summaryrefslogtreecommitdiff
path: root/spec/ruby/library/net-http/httpgenericrequest/path_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/ruby/library/net-http/httpgenericrequest/path_spec.rb')
0 files changed, 0 insertions, 0 deletions
eview2&id2=fe2f09e3ba9d5a5d21265883204bb447a45febd5'>.gdbinit524
-rw-r--r--.gitignore22
-rw-r--r--.travis.yml84
-rw-r--r--BSDL2
-rw-r--r--COPYING.ja72
-rw-r--r--ChangeLog21686
-rw-r--r--GPL39
-rw-r--r--Makefile.in132
-rw-r--r--NEWS565
-rw-r--r--README152
-rw-r--r--README.EXT1312
-rw-r--r--README.EXT.ja2116
-rw-r--r--README.ja241
-rw-r--r--ToDo124
-rw-r--r--addr2line.c562
-rw-r--r--array.c2656
-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.rb292
-rw-r--r--benchmark/bm_app_mandelbrot.rb2
-rw-r--r--benchmark/bm_app_raise.rb4
-rw-r--r--benchmark/bm_app_strconcat.rb4
-rw-r--r--benchmark/bm_hash_shift.rb10
-rw-r--r--benchmark/bm_io_select2.rb6
-rw-r--r--benchmark/bm_io_select3.rb6
-rw-r--r--benchmark/bm_loop_whileloop.rb4
-rw-r--r--benchmark/bm_loop_whileloop2.rb4
-rw-r--r--benchmark/bm_so_binary_trees.rb9
-rw-r--r--benchmark/bm_so_concatenate.rb4
-rw-r--r--benchmark/bm_so_exception.rb2
-rw-r--r--benchmark/bm_so_lists.rb2
-rw-r--r--benchmark/bm_so_nsieve_bits.rb1
-rw-r--r--benchmark/bm_so_random.rb4
-rw-r--r--benchmark/bm_so_sieve.rb4
-rw-r--r--benchmark/bm_vm1_attr_ivar.rb14
-rw-r--r--benchmark/bm_vm1_attr_ivar_set.rb14
-rw-r--r--benchmark/bm_vm1_block.rb4
-rw-r--r--benchmark/bm_vm1_const.rb2
-rw-r--r--benchmark/bm_vm1_ensure.rb4
-rw-r--r--benchmark/bm_vm1_float_simple.rb7
-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_vm1_ivar.rb2
-rw-r--r--benchmark/bm_vm1_ivar_set.rb2
-rw-r--r--benchmark/bm_vm1_length.rb4
-rw-r--r--benchmark/bm_vm1_lvar_init.rb18
-rw-r--r--benchmark/bm_vm1_lvar_set.rb5
-rw-r--r--benchmark/bm_vm1_neq.rb2
-rw-r--r--benchmark/bm_vm1_not.rb2
-rw-r--r--benchmark/bm_vm1_rescue.rb4
-rw-r--r--benchmark/bm_vm1_simplereturn.rb4
-rw-r--r--benchmark/bm_vm1_swap.rb4
-rw-r--r--benchmark/bm_vm1_yield.rb10
-rw-r--r--benchmark/bm_vm2_array.rb4
-rw-r--r--benchmark/bm_vm2_bigarray.rb106
-rw-r--r--benchmark/bm_vm2_bighash.rb5
-rw-r--r--benchmark/bm_vm2_case.rb4
-rw-r--r--benchmark/bm_vm2_defined_method.rb4
-rw-r--r--benchmark/bm_vm2_dstr.rb6
-rw-r--r--benchmark/bm_vm2_eval.rb4
-rw-r--r--benchmark/bm_vm2_method.rb4
-rw-r--r--benchmark/bm_vm2_method_missing.rb12
-rw-r--r--benchmark/bm_vm2_method_with_block.rb9
-rw-r--r--benchmark/bm_vm2_mutex.rb4
-rw-r--r--benchmark/bm_vm2_poly_method.rb4
-rw-r--r--benchmark/bm_vm2_poly_method_ov.rb4
-rw-r--r--benchmark/bm_vm2_proc.rb4
-rw-r--r--benchmark/bm_vm2_raise1.rb18
-rw-r--r--benchmark/bm_vm2_raise2.rb18
-rw-r--r--benchmark/bm_vm2_regexp.rb4
-rw-r--r--benchmark/bm_vm2_send.rb4
-rw-r--r--benchmark/bm_vm2_super.rb2
-rw-r--r--benchmark/bm_vm2_unif1.rb2
-rw-r--r--benchmark/bm_vm2_zsuper.rb2
-rw-r--r--benchmark/bm_vm3_backtrace.rb22
-rw-r--r--benchmark/bm_vm3_clearmethodcache.rb4
-rw-r--r--benchmark/bm_vm_thread_create_join.rb4
-rw-r--r--benchmark/bm_vm_thread_mutex1.rb4
-rw-r--r--benchmark/bm_vm_thread_mutex2.rb4
-rw-r--r--benchmark/bm_vm_thread_mutex3.rb4
-rw-r--r--benchmark/bm_vm_thread_pass_flood.rb2
-rw-r--r--benchmark/bm_vm_thread_queue.rb18
-rw-r--r--benchmark/bmx_temp.rb9
-rw-r--r--benchmark/driver.rb131
-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/other-lang/fact.rb4
-rw-r--r--benchmark/other-lang/loop.rb4
-rw-r--r--bignum.c7226
-rwxr-xr-xbin/erb4
-rwxr-xr-xbin/irb11
-rwxr-xr-xbin/rake1
-rwxr-xr-xbin/rdoc4
-rwxr-xr-xbin/testrb9
-rwxr-xr-xbootstraptest/runner.rb112
-rw-r--r--bootstraptest/test_autoload.rb40
-rw-r--r--bootstraptest/test_block.rb32
-rw-r--r--bootstraptest/test_class.rb10
-rw-r--r--bootstraptest/test_eval.rb37
-rw-r--r--bootstraptest/test_exception.rb16
-rw-r--r--bootstraptest/test_flow.rb37
-rw-r--r--bootstraptest/test_io.rb10
-rw-r--r--bootstraptest/test_literal.rb33
-rw-r--r--bootstraptest/test_literal_suffix.rb54
-rw-r--r--bootstraptest/test_method.rb122
-rw-r--r--bootstraptest/test_proc.rb1
-rw-r--r--bootstraptest/test_syntax.rb4
-rw-r--r--bootstraptest/test_thread.rb42
-rw-r--r--class.c572
-rw-r--r--common.mk513
-rw-r--r--compar.c32
-rw-r--r--compile.c1970
-rw-r--r--complex.c712
-rw-r--r--configure.in1944
-rw-r--r--constant.h4
-rw-r--r--cont.c311
-rw-r--r--cygwin/GNUmakefile.in4
-rw-r--r--debug.c8
-rw-r--r--defs/default_gems12
-rw-r--r--defs/gmake.mk29
-rw-r--r--defs/id.def105
-rw-r--r--defs/opt_operand.def49
-rw-r--r--dir.c527
-rw-r--r--dln.c71
-rw-r--r--dln.h19
-rw-r--r--dln_find.c48
-rw-r--r--dmydln.c2
-rw-r--r--dmyencoding.c2
-rw-r--r--dmyext.c5
-rw-r--r--dmyversion.c2
-rw-r--r--doc/.document4
-rw-r--r--doc/ChangeLog-1.8.0152
-rw-r--r--doc/ChangeLog-1.9.312157
-rw-r--r--doc/ChangeLog-2.0.024015
-rw-r--r--doc/NEWS-1.8.725
-rw-r--r--doc/NEWS-1.9.133
-rw-r--r--doc/NEWS-1.9.250
-rw-r--r--doc/NEWS-1.9.3341
-rw-r--r--doc/NEWS-2.0.0531
-rw-r--r--doc/contributing.rdoc345
-rw-r--r--doc/etc.rd75
-rw-r--r--doc/etc.rd.ja76
-rw-r--r--doc/forwardable.rd83
-rw-r--r--doc/forwardable.rd.ja44
-rw-r--r--doc/globals.rdoc69
-rw-r--r--doc/irb/irb-tools.rd.ja110
-rw-r--r--doc/irb/irb.rd391
-rw-r--r--doc/irb/irb.rd.ja372
-rw-r--r--doc/marshal.rdoc313
-rw-r--r--doc/pty/README84
-rw-r--r--doc/pty/README.expect22
-rw-r--r--doc/pty/README.expect.ja28
-rw-r--r--doc/pty/README.ja86
-rw-r--r--doc/rake/CHANGES440
-rw-r--r--doc/rake/README196
-rw-r--r--doc/rake/command_line_usage.rdoc102
-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.rdoc534
-rw-r--r--doc/rake/rational.rdoc151
-rw-r--r--doc/rake/release_notes/rake-0.8.7.rdoc55
-rw-r--r--doc/regexp.rdoc (renamed from doc/re.rdoc)231
-rw-r--r--doc/rubygems/ChangeLog5689
-rw-r--r--doc/rubygems/History.txt852
-rw-r--r--doc/rubygems/LICENSE.txt53
-rw-r--r--doc/rubygems/README41
-rw-r--r--doc/security.rdoc144
-rw-r--r--doc/shell.rd347
-rw-r--r--doc/shell.rd.ja150
-rw-r--r--doc/standard_library.rdoc126
-rw-r--r--doc/syntax.rdoc34
-rw-r--r--doc/syntax/assignment.rdoc455
-rw-r--r--doc/syntax/calling_methods.rdoc349
-rw-r--r--doc/syntax/control_expressions.rdoc500
-rw-r--r--doc/syntax/exceptions.rdoc96
-rw-r--r--doc/syntax/literals.rdoc307
-rw-r--r--doc/syntax/methods.rdoc414
-rw-r--r--doc/syntax/miscellaneous.rdoc107
-rw-r--r--doc/syntax/modules_and_classes.rdoc345
-rw-r--r--doc/syntax/precedence.rdoc60
-rw-r--r--doc/syntax/refinements.rdoc266
-rw-r--r--enc/Makefile.in10
-rw-r--r--enc/ascii.c7
-rw-r--r--enc/big5.c12
-rw-r--r--enc/cp949.c4
-rw-r--r--enc/depend96
-rw-r--r--enc/emacs_mule.c3
-rw-r--r--enc/encdb.c4
-rw-r--r--enc/encinit.c.erb26
-rw-r--r--enc/euc_jp.c292
-rw-r--r--enc/euc_kr.c4
-rw-r--r--enc/euc_tw.c4
-rw-r--r--enc/gb18030.c4
-rw-r--r--enc/gbk.c4
-rw-r--r--enc/iso_2022_jp.h7
-rw-r--r--enc/iso_8859_1.c4
-rw-r--r--enc/iso_8859_10.c4
-rw-r--r--enc/iso_8859_11.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.c4
-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_6.c4
-rw-r--r--enc/iso_8859_7.c4
-rw-r--r--enc/iso_8859_8.c4
-rw-r--r--enc/iso_8859_9.c4
-rw-r--r--enc/koi8_r.c4
-rw-r--r--enc/koi8_u.c4
-rwxr-xr-xenc/make_encmake.rb86
-rw-r--r--enc/mktable.c1162
-rw-r--r--enc/shift_jis.c279
-rw-r--r--enc/trans/JIS/JISX0213-1%UCS@BMP.src1926
-rw-r--r--enc/trans/JIS/JISX0213-1%UCS@SIP.src60
-rw-r--r--enc/trans/JIS/JISX0213-2%UCS@BMP.src2193
-rw-r--r--enc/trans/JIS/JISX0213-2%UCS@SIP.src311
-rw-r--r--enc/trans/JIS/UCS@BMP%JISX0213-1.src1922
-rw-r--r--enc/trans/JIS/UCS@BMP%JISX0213-2.src2189
-rw-r--r--enc/trans/JIS/UCS@SIP%JISX0213-1.src56
-rw-r--r--enc/trans/JIS/UCS@SIP%JISX0213-2.src307
-rw-r--r--enc/trans/big5.trans3
-rw-r--r--enc/trans/chinese.trans3
-rw-r--r--enc/trans/emoji.trans3
-rw-r--r--enc/trans/emoji_iso2022_kddi.trans3
-rw-r--r--enc/trans/emoji_sjis_docomo.trans3
-rw-r--r--enc/trans/emoji_sjis_kddi.trans3
-rw-r--r--enc/trans/emoji_sjis_softbank.trans3
-rw-r--r--enc/trans/escape.trans3
-rw-r--r--enc/trans/gb18030.trans3
-rw-r--r--enc/trans/gbk.trans3
-rw-r--r--enc/trans/iso-8859-16-tbl.rb98
-rw-r--r--enc/trans/iso2022.trans3
-rw-r--r--enc/trans/japanese.trans3
-rw-r--r--enc/trans/japanese_euc.trans15
-rw-r--r--enc/trans/japanese_sjis.trans3
-rw-r--r--enc/trans/korean.trans3
-rw-r--r--enc/trans/single_byte.trans4
-rw-r--r--enc/trans/utf8_mac-tbl.rb23655
-rw-r--r--enc/trans/utf8_mac.trans160
-rw-r--r--enc/trans/utf_16_32.trans3
-rw-r--r--enc/unicode.c1945
-rw-r--r--enc/unicode/casefold.h2238
-rw-r--r--enc/unicode/name2ctype.h15274
-rw-r--r--enc/unicode/name2ctype.h.blt15274
-rw-r--r--enc/unicode/name2ctype.kwd12679
-rw-r--r--enc/unicode/name2ctype.src12679
-rw-r--r--enc/us_ascii.c4
-rw-r--r--enc/utf_16_32.h5
-rw-r--r--enc/utf_16be.c11
-rw-r--r--enc/utf_16le.c11
-rw-r--r--enc/utf_32be.c12
-rw-r--r--enc/utf_32le.c12
-rw-r--r--enc/utf_8.c12
-rw-r--r--enc/windows_1251.c4
-rw-r--r--enc/windows_31j.c80
-rw-r--r--encoding.c483
-rw-r--r--enum.c1361
-rw-r--r--enumerator.c1063
-rw-r--r--error.c756
-rw-r--r--eval.c661
-rw-r--r--eval_error.c84
-rw-r--r--eval_intern.h102
-rw-r--r--eval_jump.c64
-rw-r--r--ext/-test-/bignum/big2str.c54
-rw-r--r--ext/-test-/bignum/bigzero.c26
-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-5832/bug.c14
-rw-r--r--ext/-test-/bug-5832/extconf.rb1
-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/extconf.rb6
-rw-r--r--ext/-test-/debug/init.c11
-rw-r--r--ext/-test-/debug/inspector.c32
-rw-r--r--ext/-test-/debug/profile_frames.c43
-rw-r--r--ext/-test-/exception/depend3
-rw-r--r--ext/-test-/exception/enc_raise.c15
-rw-r--r--ext/-test-/exception/ensured.c25
-rw-r--r--ext/-test-/exception/extconf.rb6
-rw-r--r--ext/-test-/exception/init.c11
-rw-r--r--ext/-test-/fatal/extconf.rb1
-rw-r--r--ext/-test-/fatal/rb_fatal.c19
-rw-r--r--ext/-test-/file/depend2
-rw-r--r--ext/-test-/file/extconf.rb7
-rw-r--r--ext/-test-/file/init.c11
-rw-r--r--ext/-test-/file/stat.c27
-rw-r--r--ext/-test-/iter/break.c25
-rw-r--r--ext/-test-/iter/extconf.rb1
-rw-r--r--ext/-test-/marshal/compat/extconf.rb1
-rw-r--r--ext/-test-/marshal/compat/usrcompat.c32
-rw-r--r--ext/-test-/marshal/usr/extconf.rb1
-rw-r--r--ext/-test-/marshal/usr/usrmarshal.c35
-rw-r--r--ext/-test-/method/arity.c22
-rw-r--r--ext/-test-/method/extconf.rb6
-rw-r--r--ext/-test-/method/init.c11
-rw-r--r--ext/-test-/num2int/extconf.rb1
-rw-r--r--ext/-test-/num2int/num2int.c136
-rw-r--r--ext/-test-/old_thread_select/depend6
-rw-r--r--ext/-test-/old_thread_select/extconf.rb3
-rw-r--r--ext/-test-/path_to_class/extconf.rb6
-rw-r--r--ext/-test-/path_to_class/path_to_class.c15
-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/extconf.rb1
-rw-r--r--ext/-test-/printf/printf.c100
-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-/st/numhash/numhash.c57
-rw-r--r--ext/-test-/st/update/extconf.rb1
-rw-r--r--ext/-test-/st/update/update.c34
-rw-r--r--ext/-test-/string/coderange.c30
-rw-r--r--ext/-test-/string/cstr.c8
-rw-r--r--ext/-test-/string/depend5
-rw-r--r--ext/-test-/string/enc_str_buf_cat.c14
-rw-r--r--ext/-test-/string/extconf.rb1
-rw-r--r--ext/-test-/string/normalize.c18
-rw-r--r--ext/-test-/string/qsort.c61
-rw-r--r--ext/-test-/symbol/extconf.rb6
-rw-r--r--ext/-test-/symbol/init.c11
-rw-r--r--ext/-test-/symbol/intern.c14
-rw-r--r--ext/-test-/symbol/type.c43
-rw-r--r--ext/-test-/tracepoint/depend1
-rw-r--r--ext/-test-/tracepoint/extconf.rb1
-rw-r--r--ext/-test-/tracepoint/tracepoint.c77
-rw-r--r--ext/-test-/typeddata/extconf.rb1
-rw-r--r--ext/-test-/typeddata/typeddata.c20
-rw-r--r--ext/-test-/wait_for_single_fd/depend6
-rw-r--r--ext/-test-/win32/dln/extconf.rb1
-rw-r--r--ext/.document12
-rw-r--r--ext/Setup2
-rw-r--r--ext/Setup.atheos2
-rw-r--r--ext/Setup.emx4
-rw-r--r--ext/Setup.nacl49
-rw-r--r--ext/Setup.nt3
-rw-r--r--ext/bigdecimal/README6
-rw-r--r--ext/bigdecimal/bigdecimal.c3990
-rw-r--r--ext/bigdecimal/bigdecimal.gemspec10
-rw-r--r--ext/bigdecimal/bigdecimal.h48
-rw-r--r--ext/bigdecimal/bigdecimal_en.html792
-rw-r--r--ext/bigdecimal/bigdecimal_ja.html799
-rw-r--r--ext/bigdecimal/depend2
-rw-r--r--ext/bigdecimal/lib/bigdecimal/jacobian.rb6
-rw-r--r--ext/bigdecimal/lib/bigdecimal/math.rb74
-rw-r--r--ext/bigdecimal/lib/bigdecimal/newton.rb5
-rw-r--r--ext/bigdecimal/lib/bigdecimal/util.rb46
-rw-r--r--ext/bigdecimal/sample/linear.rb1
-rw-r--r--ext/bigdecimal/sample/nlsolve.rb2
-rw-r--r--ext/coverage/coverage.c14
-rw-r--r--ext/coverage/depend11
-rw-r--r--ext/coverage/extconf.rb1
-rw-r--r--ext/curses/curses.c383
-rw-r--r--ext/curses/depend6
-rw-r--r--ext/curses/extconf.rb137
-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/date/date_core.c550
-rw-r--r--ext/date/date_parse.c825
-rw-r--r--ext/date/date_strftime.c1692
-rw-r--r--ext/date/date_strptime.c7
-rw-r--r--ext/date/date_tmx.h2
-rw-r--r--ext/date/depend7
-rw-r--r--ext/dbm/dbm.c196
-rw-r--r--ext/dbm/depend1
-rw-r--r--ext/dbm/extconf.rb382
-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.c66
-rw-r--r--ext/digest/lib/digest.rb10
-rw-r--r--ext/digest/lib/digest/hmac.rb2
-rw-r--r--ext/digest/md5/depend7
-rw-r--r--ext/digest/md5/extconf.rb4
-rw-r--r--ext/digest/md5/md5.c2
-rw-r--r--ext/digest/md5/md5init.c3
-rw-r--r--ext/digest/rmd160/depend7
-rw-r--r--ext/digest/rmd160/extconf.rb4
-rw-r--r--ext/digest/rmd160/rmd160.c10
-rw-r--r--ext/digest/rmd160/rmd160init.c3
-rw-r--r--ext/digest/sha1/depend9
-rw-r--r--ext/digest/sha1/extconf.rb4
-rw-r--r--ext/digest/sha1/sha1init.c3
-rw-r--r--ext/digest/sha2/depend9
-rw-r--r--ext/digest/sha2/extconf.rb4
-rw-r--r--ext/digest/sha2/lib/sha2.rb6
-rw-r--r--ext/digest/sha2/sha2.c23
-rw-r--r--ext/digest/sha2/sha2ossl.c2
-rw-r--r--ext/dl/callback/depend2
-rw-r--r--ext/dl/callback/mkcallback.rb28
-rw-r--r--ext/dl/cfunc.c25
-rw-r--r--ext/dl/cptr.c14
-rw-r--r--ext/dl/depend15
-rw-r--r--ext/dl/dl.c206
-rw-r--r--ext/dl/dl.h33
-rw-r--r--ext/dl/extconf.rb16
-rw-r--r--ext/dl/handle.c2
-rw-r--r--ext/dl/lib/dl.rb3
-rw-r--r--ext/dl/lib/dl/cparser.rb47
-rw-r--r--ext/dl/lib/dl/func.rb5
-rw-r--r--ext/dl/lib/dl/import.rb14
-rw-r--r--ext/dl/lib/dl/struct.rb154
-rw-r--r--ext/dl/lib/dl/types.rb6
-rw-r--r--ext/dl/lib/dl/value.rb2
-rw-r--r--ext/dl/win32/extconf.rb3
-rw-r--r--ext/etc/depend4
-rw-r--r--ext/etc/etc.c414
-rwxr-xr-xext/extmk.rb182
-rw-r--r--ext/fcntl/depend1
-rw-r--r--ext/fcntl/fcntl.c188
-rw-r--r--ext/fiddle/closure.c29
-rw-r--r--ext/fiddle/conversions.c2
-rw-r--r--ext/fiddle/depend4
-rw-r--r--ext/fiddle/extconf.rb5
-rw-r--r--ext/fiddle/fiddle.c369
-rw-r--r--ext/fiddle/fiddle.h40
-rw-r--r--ext/fiddle/function.c56
-rw-r--r--ext/fiddle/handle.c477
-rw-r--r--ext/fiddle/lib/fiddle.rb31
-rw-r--r--ext/fiddle/lib/fiddle/cparser.rb176
-rw-r--r--ext/fiddle/lib/fiddle/function.rb11
-rw-r--r--ext/fiddle/lib/fiddle/import.rb314
-rw-r--r--ext/fiddle/lib/fiddle/pack.rb128
-rw-r--r--ext/fiddle/lib/fiddle/struct.rb243
-rw-r--r--ext/fiddle/lib/fiddle/types.rb71
-rw-r--r--ext/fiddle/lib/fiddle/value.rb112
-rw-r--r--ext/fiddle/pointer.c713
-rw-r--r--ext/gdbm/depend1
-rw-r--r--ext/gdbm/gdbm.c53
-rw-r--r--ext/iconv/charset_alias.rb104
-rw-r--r--ext/iconv/depend2
-rw-r--r--ext/iconv/extconf.rb54
-rw-r--r--ext/iconv/iconv.c1256
-rw-r--r--ext/iconv/mkwrapper.rb53
-rw-r--r--ext/io/console/console.c48
-rw-r--r--ext/io/console/depend4
-rw-r--r--ext/io/console/extconf.rb12
-rw-r--r--ext/io/console/io-console.gemspec10
-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.c51
-rw-r--r--ext/json/fbuffer/fbuffer.h181
-rw-r--r--ext/json/generator/depend2
-rw-r--r--ext/json/generator/extconf.rb8
-rw-r--r--ext/json/generator/generator.c294
-rw-r--r--ext/json/generator/generator.h72
-rw-r--r--ext/json/lib/json.rb4
-rw-r--r--ext/json/lib/json/add/bigdecimal.rb28
-rw-r--r--ext/json/lib/json/add/core.rb253
-rw-r--r--ext/json/lib/json/add/date.rb34
-rw-r--r--ext/json/lib/json/add/date_time.rb50
-rw-r--r--ext/json/lib/json/add/exception.rb31
-rw-r--r--ext/json/lib/json/add/ostruct.rb31
-rw-r--r--ext/json/lib/json/add/range.rb29
-rw-r--r--ext/json/lib/json/add/regexp.rb30
-rw-r--r--ext/json/lib/json/add/struct.rb30
-rw-r--r--ext/json/lib/json/add/symbol.rb25
-rw-r--r--ext/json/lib/json/add/time.rb38
-rw-r--r--ext/json/lib/json/common.rb68
-rw-r--r--ext/json/lib/json/ext.rb6
-rw-r--r--ext/json/lib/json/generic_object.rb70
-rw-r--r--ext/json/lib/json/version.rb2
-rw-r--r--ext/json/parser/depend2
-rw-r--r--ext/json/parser/extconf.rb7
-rw-r--r--ext/json/parser/parser.c198
-rw-r--r--ext/json/parser/parser.h9
-rw-r--r--ext/json/parser/parser.rl34
-rw-r--r--ext/nkf/depend7
-rw-r--r--ext/nkf/nkf-utf8/nkf.c706
-rw-r--r--ext/nkf/nkf-utf8/nkf.h25
-rw-r--r--ext/nkf/nkf-utf8/utf8tbl.c5876
-rw-r--r--ext/nkf/nkf-utf8/utf8tbl.h13
-rw-r--r--ext/nkf/nkf.c23
-rw-r--r--ext/objspace/depend13
-rw-r--r--ext/objspace/gc_hook.c103
-rw-r--r--ext/objspace/object_tracing.c490
-rw-r--r--ext/objspace/objspace.c561
-rw-r--r--ext/objspace/objspace.h20
-rw-r--r--ext/objspace/objspace_dump.c409
-rw-r--r--ext/openssl/depend6
-rw-r--r--ext/openssl/deprecation.rb21
-rw-r--r--ext/openssl/extconf.rb53
-rw-r--r--ext/openssl/lib/openssl.rb5
-rw-r--r--ext/openssl/lib/openssl/bn.rb11
-rw-r--r--ext/openssl/lib/openssl/buffering.rb21
-rw-r--r--ext/openssl/lib/openssl/cipher.rb6
-rw-r--r--ext/openssl/lib/openssl/config.rb169
-rw-r--r--ext/openssl/lib/openssl/digest.rb34
-rw-r--r--ext/openssl/lib/openssl/ssl-internal.rb177
-rw-r--r--ext/openssl/lib/openssl/ssl.rb210
-rw-r--r--ext/openssl/lib/openssl/x509-internal.rb158
-rw-r--r--ext/openssl/lib/openssl/x509.rb164
-rw-r--r--ext/openssl/openssl_missing.c4
-rw-r--r--ext/openssl/ossl.c316
-rw-r--r--ext/openssl/ossl.h8
-rw-r--r--ext/openssl/ossl_asn1.c82
-rw-r--r--ext/openssl/ossl_bio.c2
-rw-r--r--ext/openssl/ossl_bn.c52
-rw-r--r--ext/openssl/ossl_cipher.c224
-rw-r--r--ext/openssl/ossl_config.c9
-rw-r--r--ext/openssl/ossl_engine.c196
-rw-r--r--ext/openssl/ossl_hmac.c100
-rw-r--r--ext/openssl/ossl_ns_spki.c138
-rw-r--r--ext/openssl/ossl_ocsp.c2
-rw-r--r--ext/openssl/ossl_pkcs5.c104
-rw-r--r--ext/openssl/ossl_pkey.c40
-rw-r--r--ext/openssl/ossl_pkey.h10
-rw-r--r--ext/openssl/ossl_pkey_dh.c61
-rw-r--r--ext/openssl/ossl_pkey_dsa.c73
-rw-r--r--ext/openssl/ossl_pkey_ec.c99
-rw-r--r--ext/openssl/ossl_pkey_rsa.c89
-rw-r--r--ext/openssl/ossl_ssl.c512
-rw-r--r--ext/openssl/ossl_x509attr.c4
-rw-r--r--ext/openssl/ossl_x509cert.c4
-rw-r--r--ext/openssl/ossl_x509name.c106
-rw-r--r--ext/openssl/ossl_x509store.c71
-rw-r--r--ext/openssl/ruby_missing.h13
-rw-r--r--ext/pathname/depend3
-rw-r--r--ext/pathname/lib/pathname.rb158
-rw-r--r--ext/pathname/pathname.c399
-rw-r--r--ext/psych/.gitignore11
-rw-r--r--ext/psych/depend3
-rw-r--r--ext/psych/extconf.rb32
-rw-r--r--ext/psych/lib/psych.rb274
-rw-r--r--ext/psych/lib/psych/class_loader.rb101
-rw-r--r--ext/psych/lib/psych/core_ext.rb9
-rw-r--r--ext/psych/lib/psych/deprecated.rb4
-rw-r--r--ext/psych/lib/psych/exception.rb13
-rw-r--r--ext/psych/lib/psych/handler.rb13
-rw-r--r--ext/psych/lib/psych/handlers/recorder.rb39
-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/scalar_scanner.rb73
-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.rb4
-rw-r--r--ext/psych/lib/psych/visitors/json_tree.rb7
-rw-r--r--ext/psych/lib/psych/visitors/to_ruby.rb214
-rw-r--r--ext/psych/lib/psych/visitors/yaml_tree.rb106
-rw-r--r--ext/psych/lib/psych/y.rb9
-rw-r--r--ext/psych/psych.gemspec23
-rw-r--r--ext/psych/psych.h8
-rw-r--r--ext/psych/psych_emitter.c (renamed from ext/psych/emitter.c)0
-rw-r--r--ext/psych/psych_emitter.h (renamed from ext/psych/emitter.h)0
-rw-r--r--ext/psych/psych_parser.c (renamed from ext/psych/parser.c)2
-rw-r--r--ext/psych/psych_parser.h (renamed from ext/psych/parser.h)0
-rw-r--r--ext/psych/psych_to_ruby.c (renamed from ext/psych/to_ruby.c)4
-rw-r--r--ext/psych/psych_to_ruby.h (renamed from ext/psych/to_ruby.h)0
-rw-r--r--ext/psych/psych_yaml_tree.c (renamed from ext/psych/yaml_tree.c)0
-rw-r--r--ext/psych/psych_yaml_tree.h (renamed from ext/psych/yaml_tree.h)0
-rw-r--r--ext/psych/yaml/LICENSE19
-rw-r--r--ext/psych/yaml/api.c1392
-rw-r--r--ext/psych/yaml/config.h11
-rw-r--r--ext/psych/yaml/dumper.c394
-rw-r--r--ext/psych/yaml/emitter.c2329
-rw-r--r--ext/psych/yaml/loader.c432
-rw-r--r--ext/psych/yaml/parser.c1374
-rw-r--r--ext/psych/yaml/reader.c465
-rw-r--r--ext/psych/yaml/scanner.c3570
-rw-r--r--ext/psych/yaml/writer.c141
-rw-r--r--ext/psych/yaml/yaml.h1971
-rw-r--r--ext/psych/yaml/yaml_private.h643
-rw-r--r--ext/pty/depend7
-rw-r--r--ext/pty/extconf.rb4
-rw-r--r--ext/pty/lib/expect.rb24
-rw-r--r--ext/pty/pty.c371
-rw-r--r--ext/racc/cparse/cparse.c48
-rw-r--r--ext/racc/cparse/depend1
-rw-r--r--ext/rbconfig/sizeof/depend3
-rw-r--r--ext/rbconfig/sizeof/extconf.rb2
-rw-r--r--ext/readline/README.ja343
-rw-r--r--ext/readline/depend6
-rw-r--r--ext/readline/extconf.rb103
-rw-r--r--ext/readline/readline.c980
-rw-r--r--ext/ripper/depend23
-rw-r--r--ext/ripper/eventids2.c20
-rw-r--r--ext/ripper/extconf.rb3
-rw-r--r--ext/ripper/lib/ripper.rb69
-rw-r--r--ext/ripper/lib/ripper/core.rb8
-rw-r--r--ext/ripper/lib/ripper/filter.rb21
-rw-r--r--ext/ripper/lib/ripper/lexer.rb23
-rw-r--r--ext/ripper/lib/ripper/sexp.rb4
-rwxr-xr-xext/ripper/tools/generate.rb12
-rw-r--r--ext/sdbm/_sdbm.c84
-rw-r--r--ext/sdbm/depend4
-rw-r--r--ext/sdbm/init.c352
-rw-r--r--ext/socket/.document1
-rw-r--r--ext/socket/ancdata.c134
-rw-r--r--ext/socket/basicsocket.c39
-rw-r--r--ext/socket/constants.c2
-rw-r--r--ext/socket/depend8
-rw-r--r--ext/socket/extconf.rb758
-rw-r--r--ext/socket/getaddrinfo.c10
-rw-r--r--ext/socket/getnameinfo.c8
-rw-r--r--ext/socket/ifaddr.c457
-rw-r--r--ext/socket/init.c145
-rw-r--r--ext/socket/ipsocket.c55
-rw-r--r--ext/socket/lib/socket.rb110
-rw-r--r--ext/socket/mkconstants.rb98
-rw-r--r--ext/socket/option.c212
-rw-r--r--ext/socket/raddrinfo.c427
-rw-r--r--ext/socket/rubysocket.h224
-rw-r--r--ext/socket/socket.c438
-rw-r--r--ext/socket/sockport.h71
-rw-r--r--ext/socket/tcpserver.c27
-rw-r--r--ext/socket/tcpsocket.c4
-rw-r--r--ext/socket/udpsocket.c13
-rw-r--r--ext/socket/unixserver.c6
-rw-r--r--ext/socket/unixsocket.c42
-rw-r--r--ext/stringio/depend7
-rw-r--r--ext/stringio/stringio.c274
-rw-r--r--ext/strscan/depend9
-rw-r--r--ext/strscan/extconf.rb1
-rw-r--r--ext/strscan/strscan.c139
-rw-r--r--ext/syck/bytecode.c1165
-rw-r--r--ext/syck/depend12
-rw-r--r--ext/syck/emitter.c1247
-rw-r--r--ext/syck/extconf.rb5
-rw-r--r--ext/syck/gram.c1894
-rw-r--r--ext/syck/gram.h79
-rw-r--r--ext/syck/handler.c173
-rw-r--r--ext/syck/implicit.c2990
-rw-r--r--ext/syck/lib/syck.rb447
-rw-r--r--ext/syck/lib/syck/baseemitter.rb242
-rw-r--r--ext/syck/lib/syck/basenode.rb222
-rw-r--r--ext/syck/lib/syck/constants.rb45
-rw-r--r--ext/syck/lib/syck/encoding.rb35
-rw-r--r--ext/syck/lib/syck/error.rb34
-rw-r--r--ext/syck/lib/syck/loader.rb14
-rw-r--r--ext/syck/lib/syck/rubytypes.rb467
-rw-r--r--ext/syck/lib/syck/stream.rb41
-rw-r--r--ext/syck/lib/syck/stringio.rb85
-rw-r--r--ext/syck/lib/syck/syck.rb16
-rw-r--r--ext/syck/lib/syck/tag.rb95
-rw-r--r--ext/syck/lib/syck/types.rb192
-rw-r--r--ext/syck/lib/syck/yamlnode.rb54
-rw-r--r--ext/syck/lib/syck/ypath.rb54
-rw-r--r--ext/syck/lib/yaml/syck.rb14
-rw-r--r--ext/syck/node.c407
-rw-r--r--ext/syck/rubyext.c2328
-rw-r--r--ext/syck/syck.c524
-rw-r--r--ext/syck/syck.h453
-rw-r--r--ext/syck/token.c2724
-rw-r--r--ext/syck/yaml2byte.c259
-rw-r--r--ext/syck/yamlbyte.h171
-rw-r--r--ext/syslog/depend4
-rw-r--r--ext/syslog/lib/syslog/logger.rb208
-rw-r--r--ext/syslog/syslog.c191
-rw-r--r--ext/thread/extconf.rb3
-rw-r--r--ext/thread/thread.c579
-rw-r--r--ext/tk/ChangeLog.tkextlib2
-rw-r--r--ext/tk/MANUAL_tcltklib.eng26
-rw-r--r--ext/tk/MANUAL_tcltklib.eucj584
-rw-r--r--ext/tk/MANUAL_tcltklib.ja584
-rw-r--r--ext/tk/README.1st16
-rw-r--r--ext/tk/README.ActiveTcl2
-rw-r--r--ext/tk/README.tcltklib16
-rw-r--r--ext/tk/extconf.rb107
-rw-r--r--ext/tk/lib/multi-tk.rb2
-rw-r--r--ext/tk/lib/tcltk.rb2
-rw-r--r--ext/tk/lib/tk/image.rb42
-rw-r--r--ext/tk/lib/tk/wm.rb6
-rw-r--r--ext/tk/lib/tkextlib/SUPPORT_STATUS8
-rwxr-xr-xext/tk/lib/tkextlib/pkg_checker.rb2
-rw-r--r--ext/tk/lib/tkextlib/tile/style.rb4
-rw-r--r--ext/tk/old-README.tcltklib.eucj159
-rw-r--r--ext/tk/old-README.tcltklib.ja159
-rw-r--r--ext/tk/sample/demos-en/README114
-rw-r--r--ext/tk/sample/demos-en/README.tkencoding18
-rw-r--r--ext/tk/sample/demos-en/text.rb2
-rw-r--r--ext/tk/sample/demos-en/widget2
-rw-r--r--ext/tk/sample/demos-jp/README102
-rw-r--r--ext/tk/sample/demos-jp/README.1st28
-rw-r--r--ext/tk/sample/demos-jp/anilabel.rb22
-rw-r--r--ext/tk/sample/demos-jp/aniwave.rb10
-rw-r--r--ext/tk/sample/demos-jp/arrow.rb22
-rw-r--r--ext/tk/sample/demos-jp/bind.rb38
-rw-r--r--ext/tk/sample/demos-jp/bitmap.rb20
-rw-r--r--ext/tk/sample/demos-jp/button.rb20
-rw-r--r--ext/tk/sample/demos-jp/check.rb30
-rw-r--r--ext/tk/sample/demos-jp/check2.rb30
-rw-r--r--ext/tk/sample/demos-jp/clrpick.rb28
-rw-r--r--ext/tk/sample/demos-jp/colors.rb20
-rw-r--r--ext/tk/sample/demos-jp/combo.rb36
-rw-r--r--ext/tk/sample/demos-jp/cscroll.rb22
-rw-r--r--ext/tk/sample/demos-jp/ctext.rb36
-rw-r--r--ext/tk/sample/demos-jp/dialog1.rb12
-rw-r--r--ext/tk/sample/demos-jp/dialog2.rb12
-rw-r--r--ext/tk/sample/demos-jp/entry1.rb32
-rw-r--r--ext/tk/sample/demos-jp/entry2.rb32
-rw-r--r--ext/tk/sample/demos-jp/entry3.rb46
-rw-r--r--ext/tk/sample/demos-jp/filebox.rb28
-rw-r--r--ext/tk/sample/demos-jp/floor.rb24
-rw-r--r--ext/tk/sample/demos-jp/floor2.rb24
-rw-r--r--ext/tk/sample/demos-jp/form.rb28
-rw-r--r--ext/tk/sample/demos-jp/goldberg.rb20
-rw-r--r--ext/tk/sample/demos-jp/hello6
-rw-r--r--ext/tk/sample/demos-jp/hscale.rb14
-rw-r--r--ext/tk/sample/demos-jp/icon.rb24
-rw-r--r--ext/tk/sample/demos-jp/image1.rb22
-rw-r--r--ext/tk/sample/demos-jp/image2.rb34
-rw-r--r--ext/tk/sample/demos-jp/image3.rb18
-rw-r--r--ext/tk/sample/demos-jp/items.rb60
-rw-r--r--ext/tk/sample/demos-jp/ixset240
-rw-r--r--ext/tk/sample/demos-jp/knightstour.rb20
-rw-r--r--ext/tk/sample/demos-jp/label.rb30
-rw-r--r--ext/tk/sample/demos-jp/labelframe.rb32
-rw-r--r--ext/tk/sample/demos-jp/mclist.rb58
-rw-r--r--ext/tk/sample/demos-jp/menu.rb108
-rw-r--r--ext/tk/sample/demos-jp/menu84.rb50
-rw-r--r--ext/tk/sample/demos-jp/menu8x.rb120
-rw-r--r--ext/tk/sample/demos-jp/menubu.rb28
-rw-r--r--ext/tk/sample/demos-jp/msgbox.rb30
-rw-r--r--ext/tk/sample/demos-jp/msgbox2.rb32
-rw-r--r--ext/tk/sample/demos-jp/paned1.rb16
-rw-r--r--ext/tk/sample/demos-jp/paned2.rb22
-rw-r--r--ext/tk/sample/demos-jp/pendulum.rb10
-rw-r--r--ext/tk/sample/demos-jp/plot.rb26
-rw-r--r--ext/tk/sample/demos-jp/puzzle.rb30
-rw-r--r--ext/tk/sample/demos-jp/radio.rb30
-rw-r--r--ext/tk/sample/demos-jp/radio2.rb26
-rw-r--r--ext/tk/sample/demos-jp/radio3.rb24
-rw-r--r--ext/tk/sample/demos-jp/rolodex-j132
-rw-r--r--ext/tk/sample/demos-jp/ruler.rb22
-rw-r--r--ext/tk/sample/demos-jp/sayings.rb20
-rw-r--r--ext/tk/sample/demos-jp/search.rb40
-rw-r--r--ext/tk/sample/demos-jp/spin.rb42
-rw-r--r--ext/tk/sample/demos-jp/states.rb34
-rw-r--r--ext/tk/sample/demos-jp/style.rb192
-rw-r--r--ext/tk/sample/demos-jp/tcolor34
-rw-r--r--ext/tk/sample/demos-jp/text.rb102
-rw-r--r--ext/tk/sample/demos-jp/textpeer.rb32
-rw-r--r--ext/tk/sample/demos-jp/toolbar.rb56
-rw-r--r--ext/tk/sample/demos-jp/tree.rb22
-rw-r--r--ext/tk/sample/demos-jp/ttkbut.rb56
-rw-r--r--ext/tk/sample/demos-jp/ttkmenu.rb46
-rw-r--r--ext/tk/sample/demos-jp/ttknote.rb42
-rw-r--r--ext/tk/sample/demos-jp/ttkpane.rb24
-rw-r--r--ext/tk/sample/demos-jp/ttkprogress.rb26
-rw-r--r--ext/tk/sample/demos-jp/twind.rb76
-rw-r--r--ext/tk/sample/demos-jp/twind2.rb116
-rw-r--r--ext/tk/sample/demos-jp/unicodeout.rb42
-rw-r--r--ext/tk/sample/demos-jp/vscale.rb16
-rw-r--r--ext/tk/sample/demos-jp/widget316
-rw-r--r--ext/tk/sample/figmemo_sample.rb2
-rw-r--r--ext/tk/sample/msgs_rb2/ja.msg154
-rw-r--r--ext/tk/sample/msgs_tk/README2
-rw-r--r--ext/tk/sample/tcltklib/sample0.rb12
-rw-r--r--ext/tk/sample/tcltklib/sample1.rb304
-rw-r--r--ext/tk/sample/tcltklib/sample2.rb14
-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/tkHTML/page1/index.html2
-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/tkoptdb-safeTk.rb2
-rw-r--r--ext/tk/sample/tkoptdb.rb2
-rw-r--r--ext/tk/sample/tktextframe.rb2
-rw-r--r--ext/tk/stubs.c4
-rw-r--r--ext/tk/tcltklib.c247
-rw-r--r--ext/tk/tkutil/tkutil.c97
-rw-r--r--ext/win32/extconf.rb3
-rw-r--r--ext/win32/lib/Win32API.rb (renamed from ext/dl/win32/lib/Win32API.rb)3
-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/extconf.rb11
-rw-r--r--ext/win32ole/lib/win32ole.rb22
-rw-r--r--ext/win32ole/win32ole.c232
-rw-r--r--ext/zlib/depend5
-rw-r--r--ext/zlib/extconf.rb4
-rw-r--r--ext/zlib/zlib.c1016
-rw-r--r--file.c721
-rw-r--r--gc.c7390
-rw-r--r--gc.h22
-rw-r--r--golf_prelude.rb37
-rw-r--r--goruby.c36
-rw-r--r--hash.c1099
-rw-r--r--ia64.s4
-rw-r--r--id.c52
-rw-r--r--include/ruby.h1
-rw-r--r--include/ruby/backward/rubysig.h8
-rw-r--r--include/ruby/debug.h110
-rw-r--r--include/ruby/defines.h252
-rw-r--r--include/ruby/encoding.h45
-rw-r--r--include/ruby/intern.h231
-rw-r--r--include/ruby/io.h24
-rw-r--r--include/ruby/missing.h29
-rw-r--r--include/ruby/oniguruma.h98
-rw-r--r--include/ruby/re.h8
-rw-r--r--include/ruby/regex.h8
-rw-r--r--include/ruby/ruby.h755
-rw-r--r--include/ruby/st.h44
-rw-r--r--include/ruby/subst.h1
-rw-r--r--include/ruby/thread.h45
-rw-r--r--include/ruby/util.h10
-rw-r--r--include/ruby/version.h14
-rw-r--r--include/ruby/vm.h8
-rw-r--r--include/ruby/win32.h170
-rw-r--r--inits.c1
-rw-r--r--insns.def1117
-rw-r--r--internal.h662
-rw-r--r--io.c2748
-rw-r--r--iseq.c1269
-rw-r--r--iseq.h52
-rw-r--r--lib/English.rb42
-rw-r--r--lib/README91
-rwxr-xr-x[-rw-r--r--]lib/abbrev.rb84
-rw-r--r--lib/base64.rb2
-rw-r--r--lib/benchmark.rb149
-rw-r--r--lib/cgi.rb56
-rw-r--r--lib/cgi/cookie.rb60
-rw-r--r--lib/cgi/core.rb106
-rw-r--r--lib/cgi/html.rb319
-rw-r--r--lib/cgi/session.rb8
-rw-r--r--lib/cgi/util.rb64
-rw-r--r--lib/cmath.rb2
-rw-r--r--lib/csv.rb240
-rw-r--r--lib/debug.rb202
-rw-r--r--lib/delegate.rb66
-rw-r--r--lib/drb/drb.rb115
-rw-r--r--lib/drb/eq.rb2
-rw-r--r--lib/drb/extserv.rb2
-rw-r--r--lib/drb/gw.rb42
-rw-r--r--lib/drb/invokemethod.rb2
-rw-r--r--lib/drb/observer.rb3
-rw-r--r--lib/drb/ssl.rb159
-rw-r--r--lib/drb/timeridconv.rb16
-rw-r--r--lib/drb/unix.rb7
-rw-r--r--lib/e2mmap.rb20
-rw-r--r--lib/erb.rb82
-rw-r--r--lib/fileutils.rb244
-rw-r--r--lib/find.rb42
-rw-r--r--lib/forwardable.rb168
-rw-r--r--lib/getoptlong.rb2
-rw-r--r--lib/gserver.rb5
-rw-r--r--lib/ipaddr.rb95
-rw-r--r--lib/irb.rb372
-rw-r--r--lib/irb/cmd/chws.rb3
-rw-r--r--lib/irb/cmd/fork.rb5
-rw-r--r--lib/irb/cmd/help.rb2
-rw-r--r--lib/irb/cmd/load.rb2
-rw-r--r--lib/irb/cmd/nop.rb3
-rw-r--r--lib/irb/cmd/pushws.rb2
-rw-r--r--lib/irb/cmd/subirb.rb2
-rw-r--r--lib/irb/completion.rb54
-rw-r--r--lib/irb/context.rb171
-rw-r--r--lib/irb/ext/change-ws.rb10
-rw-r--r--lib/irb/ext/history.rb15
-rw-r--r--lib/irb/ext/loader.rb17
-rw-r--r--lib/irb/ext/math-mode.rb13
-rw-r--r--lib/irb/ext/multi-irb.rb48
-rw-r--r--lib/irb/ext/save-history.rb31
-rw-r--r--lib/irb/ext/tracer.rb11
-rw-r--r--lib/irb/ext/use-loader.rb9
-rw-r--r--lib/irb/ext/workspaces.rb13
-rw-r--r--lib/irb/extend-command.rb76
-rw-r--r--lib/irb/frame.rb16
-rw-r--r--lib/irb/help.rb1
-rw-r--r--lib/irb/init.rb13
-rw-r--r--lib/irb/input-method.rb71
-rw-r--r--lib/irb/inspector.rb146
-rw-r--r--lib/irb/lc/.document4
-rw-r--r--lib/irb/lc/error.rb4
-rw-r--r--lib/irb/lc/help-message26
-rw-r--r--lib/irb/lc/ja/encoding_aliases.rb2
-rw-r--r--lib/irb/lc/ja/error.rb3
-rw-r--r--lib/irb/lc/ja/help-message20
-rw-r--r--lib/irb/locale.rb2
-rw-r--r--lib/irb/notifier.rb89
-rw-r--r--lib/irb/output-method.rb46
-rw-r--r--lib/irb/ruby-lex.rb42
-rw-r--r--lib/irb/ruby-token.rb2
-rw-r--r--lib/irb/slex.rb4
-rw-r--r--lib/irb/version.rb2
-rw-r--r--lib/irb/workspace.rb14
-rw-r--r--lib/irb/xmp.rb76
-rw-r--r--lib/logger.rb200
-rw-r--r--lib/matrix.rb425
-rw-r--r--lib/matrix/eigenvalue_decomposition.rb18
-rw-r--r--lib/matrix/lup_decomposition.rb58
-rw-r--r--lib/minitest/.document2
-rw-r--r--lib/minitest/README.txt212
-rw-r--r--lib/minitest/autorun.rb1
-rw-r--r--lib/minitest/benchmark.rb85
-rw-r--r--lib/minitest/hell.rb20
-rw-r--r--lib/minitest/mock.rb152
-rw-r--r--lib/minitest/parallel_each.rb80
-rw-r--r--lib/minitest/pride.rb36
-rw-r--r--lib/minitest/spec.rb324
-rw-r--r--lib/minitest/unit.rb795
-rw-r--r--lib/mkmf.rb4068
-rw-r--r--lib/monitor.rb2
-rw-r--r--lib/mutex_m.rb58
-rw-r--r--lib/net/.document8
-rw-r--r--lib/net/ftp.rb231
-rw-r--r--lib/net/http.rb1874
-rw-r--r--lib/net/http/backward.rb25
-rw-r--r--lib/net/http/exceptions.rb25
-rw-r--r--lib/net/http/generic_request.rb329
-rw-r--r--lib/net/http/header.rb452
-rw-r--r--lib/net/http/proxy_delta.rb16
-rw-r--r--lib/net/http/request.rb20
-rw-r--r--lib/net/http/requests.rb122
-rw-r--r--lib/net/http/response.rb405
-rw-r--r--lib/net/http/responses.rb268
-rw-r--r--lib/net/imap.rb122
-rw-r--r--lib/net/pop.rb28
-rw-r--r--lib/net/protocol.rb16
-rw-r--r--lib/net/smtp.rb44
-rw-r--r--lib/net/telnet.rb21
-rw-r--r--lib/observer.rb19
-rw-r--r--lib/open-uri.rb144
-rw-r--r--lib/open3.rb198
-rw-r--r--lib/optparse.rb75
-rw-r--r--lib/optparse/ac.rb50
-rw-r--r--lib/ostruct.rb126
-rw-r--r--lib/pp.rb188
-rw-r--r--lib/prettyprint.rb205
-rw-r--r--lib/prime.rb125
-rw-r--r--lib/profiler.rb155
-rw-r--r--lib/pstore.rb76
-rw-r--r--lib/racc/parser.rb249
-rw-r--r--lib/racc/rdoc/grammar.en.rdoc226
-rw-r--r--lib/rake.rb4
-rw-r--r--lib/rake/alt_system.rb7
-rw-r--r--lib/rake/application.rb535
-rw-r--r--lib/rake/backtrace.rb20
-rw-r--r--lib/rake/classic_namespace.rb11
-rw-r--r--lib/rake/clean.rb33
-rw-r--r--lib/rake/cloneable.rb23
-rw-r--r--lib/rake/contrib/ftptools.rb27
-rw-r--r--lib/rake/contrib/sys.rb193
-rw-r--r--lib/rake/dsl_definition.rb45
-rw-r--r--lib/rake/ext/core.rb3
-rw-r--r--lib/rake/ext/module.rb38
-rw-r--r--lib/rake/ext/string.rb7
-rw-r--r--lib/rake/ext/time.rb3
-rw-r--r--lib/rake/file_list.rb53
-rw-r--r--lib/rake/file_task.rb3
-rw-r--r--lib/rake/file_utils.rb22
-rw-r--r--lib/rake/file_utils_ext.rb13
-rw-r--r--lib/rake/gempackagetask.rb17
-rw-r--r--lib/rake/invocation_chain.rb42
-rw-r--r--lib/rake/lib/.document1
-rw-r--r--lib/rake/linked_list.rb103
-rw-r--r--lib/rake/multi_task.rb7
-rw-r--r--lib/rake/packagetask.rb17
-rw-r--r--lib/rake/phony.rb15
-rw-r--r--lib/rake/private_reader.rb20
-rw-r--r--lib/rake/promise.rb99
-rw-r--r--lib/rake/pseudo_status.rb5
-rw-r--r--lib/rake/rake_module.rb8
-rw-r--r--lib/rake/rdoctask.rb236
-rw-r--r--[-rwxr-xr-x]lib/rake/ruby182_test_unit_fix.rb6
-rw-r--r--lib/rake/runtest.rb5
-rw-r--r--lib/rake/scope.rb42
-rw-r--r--lib/rake/task.rb149
-rw-r--r--lib/rake/task_arguments.rb17
-rw-r--r--lib/rake/task_manager.rb60
-rw-r--r--lib/rake/tasklib.rb2
-rw-r--r--lib/rake/testtask.rb22
-rw-r--r--lib/rake/thread_history_display.rb48
-rw-r--r--lib/rake/thread_pool.rb161
-rw-r--r--lib/rake/trace_output.rb22
-rw-r--r--lib/rake/version.rb7
-rw-r--r--lib/rake/win32.rb5
-rw-r--r--lib/rbconfig/obsolete.rb43
-rw-r--r--lib/rdoc.rb172
-rw-r--r--lib/rdoc/alias.rb2
-rw-r--r--lib/rdoc/anon_class.rb2
-rw-r--r--lib/rdoc/any_method.rb159
-rw-r--r--lib/rdoc/attr.rb63
-rw-r--r--lib/rdoc/class_module.rb309
-rw-r--r--lib/rdoc/code_object.rb176
-rw-r--r--lib/rdoc/code_objects.rb24
-rw-r--r--lib/rdoc/comment.rb229
-rw-r--r--lib/rdoc/constant.rb118
-rw-r--r--lib/rdoc/context.rb349
-rw-r--r--lib/rdoc/context/section.rb238
-rw-r--r--lib/rdoc/cross_reference.rb136
-rw-r--r--lib/rdoc/encoding.rb69
-rw-r--r--lib/rdoc/erb_partial.rb18
-rw-r--r--lib/rdoc/extend.rb9
-rw-r--r--lib/rdoc/generator.rb32
-rw-r--r--lib/rdoc/generator/darkfish.rb515
-rw-r--r--lib/rdoc/generator/json_index.rb248
-rw-r--r--lib/rdoc/generator/markup.rb91
-rw-r--r--lib/rdoc/generator/ri.rb70
-rw-r--r--lib/rdoc/generator/template/darkfish/_footer.rhtml5
-rw-r--r--lib/rdoc/generator/template/darkfish/_head.rhtml22
-rw-r--r--lib/rdoc/generator/template/darkfish/_sidebar_VCS_info.rhtml19
-rw-r--r--lib/rdoc/generator/template/darkfish/_sidebar_classes.rhtml9
-rw-r--r--lib/rdoc/generator/template/darkfish/_sidebar_extends.rhtml15
-rw-r--r--lib/rdoc/generator/template/darkfish/_sidebar_in_files.rhtml9
-rw-r--r--lib/rdoc/generator/template/darkfish/_sidebar_includes.rhtml15
-rw-r--r--lib/rdoc/generator/template/darkfish/_sidebar_installed.rhtml15
-rw-r--r--lib/rdoc/generator/template/darkfish/_sidebar_methods.rhtml12
-rw-r--r--lib/rdoc/generator/template/darkfish/_sidebar_navigation.rhtml11
-rw-r--r--lib/rdoc/generator/template/darkfish/_sidebar_pages.rhtml12
-rw-r--r--lib/rdoc/generator/template/darkfish/_sidebar_parent.rhtml11
-rw-r--r--lib/rdoc/generator/template/darkfish/_sidebar_search.rhtml15
-rw-r--r--lib/rdoc/generator/template/darkfish/_sidebar_sections.rhtml11
-rw-r--r--lib/rdoc/generator/template/darkfish/_sidebar_table_of_contents.rhtml18
-rw-r--r--lib/rdoc/generator/template/darkfish/class.rhtml174
-rw-r--r--lib/rdoc/generator/template/darkfish/classpage.rhtml321
-rw-r--r--lib/rdoc/generator/template/darkfish/filepage.rhtml124
-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-rwxr-xr-xlib/rdoc/generator/template/darkfish/images/add.pngbin0 -> 733 bytes-rwxr-xr-xlib/rdoc/generator/template/darkfish/images/arrow_up.pngbin0 -> 372 bytes-rwxr-xr-xlib/rdoc/generator/template/darkfish/images/delete.pngbin0 -> 715 bytes-rwxr-xr-xlib/rdoc/generator/template/darkfish/images/tag_blue.pngbin0 -> 1880 bytes-rw-r--r--lib/rdoc/generator/template/darkfish/images/transparent.pngbin0 -> 97 bytes-rw-r--r--lib/rdoc/generator/template/darkfish/index.rhtml77
-rw-r--r--lib/rdoc/generator/template/darkfish/js/darkfish.js150
-rw-r--r--lib/rdoc/generator/template/darkfish/js/jquery.js44
-rw-r--r--lib/rdoc/generator/template/darkfish/js/quicksearch.js114
-rw-r--r--lib/rdoc/generator/template/darkfish/js/search.js102
-rw-r--r--lib/rdoc/generator/template/darkfish/js/thickbox-compressed.js10
-rw-r--r--lib/rdoc/generator/template/darkfish/page.rhtml18
-rw-r--r--lib/rdoc/generator/template/darkfish/rdoc.css777
-rw-r--r--lib/rdoc/generator/template/darkfish/servlet_not_found.rhtml18
-rw-r--r--lib/rdoc/generator/template/darkfish/servlet_root.rhtml63
-rw-r--r--lib/rdoc/generator/template/darkfish/table_of_contents.rhtml58
-rw-r--r--lib/rdoc/generator/template/json_index/.document1
-rw-r--r--lib/rdoc/generator/template/json_index/js/navigation.js142
-rw-r--r--lib/rdoc/generator/template/json_index/js/searcher.js228
-rw-r--r--lib/rdoc/ghost_method.rb2
-rw-r--r--lib/rdoc/include.rb99
-rw-r--r--lib/rdoc/known_classes.rb1
-rw-r--r--lib/rdoc/markdown.rb15961
-rw-r--r--lib/rdoc/markdown/entities.rb2131
-rw-r--r--lib/rdoc/markdown/literals_1_9.rb420
-rw-r--r--lib/rdoc/markup.rb335
-rw-r--r--lib/rdoc/markup/attr_changer.rb22
-rw-r--r--lib/rdoc/markup/attr_span.rb29
-rw-r--r--lib/rdoc/markup/attribute_manager.rb46
-rw-r--r--lib/rdoc/markup/attributes.rb70
-rw-r--r--lib/rdoc/markup/block_quote.rb14
-rw-r--r--lib/rdoc/markup/document.rb61
-rw-r--r--lib/rdoc/markup/formatter.rb129
-rw-r--r--lib/rdoc/markup/formatter_test_case.rb120
-rw-r--r--lib/rdoc/markup/hard_break.rb31
-rw-r--r--lib/rdoc/markup/heading.rb60
-rw-r--r--lib/rdoc/markup/include.rb42
-rw-r--r--lib/rdoc/markup/indented_paragraph.rb14
-rw-r--r--lib/rdoc/markup/inline.rb145
-rw-r--r--lib/rdoc/markup/list.rb28
-rw-r--r--lib/rdoc/markup/list_item.rb21
-rw-r--r--lib/rdoc/markup/paragraph.rb14
-rw-r--r--lib/rdoc/markup/parser.rb203
-rw-r--r--lib/rdoc/markup/pre_process.rb90
-rw-r--r--lib/rdoc/markup/raw.rb10
-rw-r--r--lib/rdoc/markup/special.rb40
-rw-r--r--lib/rdoc/markup/text_formatter_test_case.rb2
-rw-r--r--lib/rdoc/markup/to_ansi.rb15
-rw-r--r--lib/rdoc/markup/to_bs.rb2
-rw-r--r--lib/rdoc/markup/to_html.rb243
-rw-r--r--lib/rdoc/markup/to_html_crossref.rb66
-rw-r--r--lib/rdoc/markup/to_html_snippet.rb284
-rw-r--r--lib/rdoc/markup/to_joined_paragraph.rb71
-rw-r--r--lib/rdoc/markup/to_label.rb74
-rw-r--r--lib/rdoc/markup/to_markdown.rb191
-rw-r--r--lib/rdoc/markup/to_rdoc.rb52
-rw-r--r--lib/rdoc/markup/to_table_of_contents.rb87
-rw-r--r--lib/rdoc/markup/to_test.rb3
-rw-r--r--lib/rdoc/markup/to_tt_only.rb16
-rw-r--r--lib/rdoc/markup/verbatim.rb38
-rw-r--r--lib/rdoc/meta_method.rb2
-rw-r--r--lib/rdoc/method_attr.rb95
-rw-r--r--lib/rdoc/mixin.rb120
-rw-r--r--lib/rdoc/normal_class.rb39
-rw-r--r--lib/rdoc/normal_module.rb21
-rw-r--r--lib/rdoc/options.rb495
-rw-r--r--lib/rdoc/parser.rb200
-rw-r--r--lib/rdoc/parser/c.rb604
-rw-r--r--lib/rdoc/parser/changelog.rb194
-rw-r--r--lib/rdoc/parser/markdown.rb23
-rw-r--r--lib/rdoc/parser/rd.rb22
-rw-r--r--lib/rdoc/parser/ruby.rb1394
-rw-r--r--lib/rdoc/parser/ruby_tools.rb11
-rw-r--r--lib/rdoc/parser/simple.rb30
-rw-r--r--lib/rdoc/parser/text.rb11
-rw-r--r--lib/rdoc/rd.rb99
-rw-r--r--lib/rdoc/rd/block_parser.rb1055
-rw-r--r--lib/rdoc/rd/inline.rb71
-rw-r--r--lib/rdoc/rd/inline_parser.rb1207
-rw-r--r--lib/rdoc/rdoc.rb194
-rw-r--r--lib/rdoc/require.rb2
-rw-r--r--lib/rdoc/ri.rb6
-rw-r--r--lib/rdoc/ri/driver.rb663
-rw-r--r--lib/rdoc/ri/paths.rb121
-rw-r--r--lib/rdoc/ri/store.rb356
-rw-r--r--lib/rdoc/ruby_lex.rb368
-rw-r--r--lib/rdoc/ruby_token.rb132
-rw-r--r--lib/rdoc/rubygems_hook.rb61
-rw-r--r--lib/rdoc/servlet.rb441
-rw-r--r--lib/rdoc/single_class.rb2
-rw-r--r--lib/rdoc/stats.rb155
-rw-r--r--lib/rdoc/store.rb979
-rw-r--r--lib/rdoc/task.rb28
-rw-r--r--lib/rdoc/test_case.rb217
-rw-r--r--lib/rdoc/text.rb75
-rw-r--r--lib/rdoc/token_stream.rb45
-rw-r--r--lib/rdoc/tom_doc.rb257
-rw-r--r--lib/rdoc/top_level.rb368
-rw-r--r--lib/resolv-replace.rb2
-rw-r--r--lib/resolv.rb480
-rw-r--r--lib/rexml/attribute.rb7
-rw-r--r--lib/rexml/document.rb86
-rw-r--r--lib/rexml/element.rb21
-rw-r--r--lib/rexml/encoding.rb14
-rw-r--r--lib/rexml/formatters/pretty.rb2
-rw-r--r--lib/rexml/light/node.rb2
-rw-r--r--lib/rexml/output.rb7
-rw-r--r--lib/rexml/parsers/baseparser.rb68
-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/rexml.rb12
-rw-r--r--lib/rexml/sax2listener.rb16
-rw-r--r--lib/rexml/security.rb27
-rw-r--r--lib/rexml/source.rb87
-rw-r--r--lib/rexml/streamlistener.rb12
-rw-r--r--lib/rexml/text.rb22
-rw-r--r--lib/rexml/xmldecl.rb8
-rw-r--r--lib/rinda/rinda.rb50
-rw-r--r--lib/rinda/ring.rb282
-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.rb83
-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.rb26
-rw-r--r--lib/rss/maker/base.rb12
-rw-r--r--lib/rss/maker/entry.rb4
-rw-r--r--lib/rss/parser.rb2
-rw-r--r--lib/rss/rexmlparser.rb5
-rw-r--r--lib/rss/rss.rb84
-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.rb888
-rw-r--r--lib/rubygems/LICENSE.txt54
-rw-r--r--lib/rubygems/available_set.rb161
-rw-r--r--lib/rubygems/basic_specification.rb212
-rw-r--r--lib/rubygems/builder.rb99
-rw-r--r--lib/rubygems/command.rb133
-rw-r--r--lib/rubygems/command_manager.rb161
-rw-r--r--lib/rubygems/commands/build_command.rb47
-rw-r--r--lib/rubygems/commands/cert_command.rb308
-rw-r--r--lib/rubygems/commands/check_command.rb108
-rw-r--r--lib/rubygems/commands/cleanup_command.rb147
-rw-r--r--lib/rubygems/commands/contents_command.rb149
-rw-r--r--lib/rubygems/commands/dependency_command.rb163
-rw-r--r--lib/rubygems/commands/environment_command.rb145
-rw-r--r--lib/rubygems/commands/fetch_command.rb27
-rw-r--r--lib/rubygems/commands/generate_index_command.rb54
-rw-r--r--lib/rubygems/commands/help_command.rb134
-rw-r--r--lib/rubygems/commands/install_command.rb179
-rw-r--r--lib/rubygems/commands/list_command.rb19
-rw-r--r--lib/rubygems/commands/lock_command.rb2
-rw-r--r--lib/rubygems/commands/mirror_command.rb23
-rw-r--r--lib/rubygems/commands/outdated_command.rb18
-rw-r--r--lib/rubygems/commands/owner_command.rb35
-rw-r--r--lib/rubygems/commands/pristine_command.rb83
-rw-r--r--lib/rubygems/commands/push_command.rb58
-rw-r--r--lib/rubygems/commands/query_command.rb304
-rw-r--r--lib/rubygems/commands/rdoc_command.rb63
-rw-r--r--lib/rubygems/commands/search_command.rb25
-rw-r--r--lib/rubygems/commands/server_command.rb2
-rw-r--r--lib/rubygems/commands/setup_command.rb213
-rw-r--r--lib/rubygems/commands/sources_command.rb192
-rw-r--r--lib/rubygems/commands/specification_command.rb44
-rw-r--r--lib/rubygems/commands/stale_command.rb10
-rw-r--r--lib/rubygems/commands/uninstall_command.rb78
-rw-r--r--lib/rubygems/commands/unpack_command.rb30
-rw-r--r--lib/rubygems/commands/update_command.rb243
-rw-r--r--lib/rubygems/commands/which_command.rb24
-rw-r--r--lib/rubygems/commands/yank_command.rb112
-rw-r--r--lib/rubygems/compatibility.rb58
-rw-r--r--lib/rubygems/config_file.rb234
-rw-r--r--lib/rubygems/core_ext/kernel_gem.rb59
-rwxr-xr-xlib/rubygems/core_ext/kernel_require.rb149
-rw-r--r--lib/rubygems/custom_require.rb69
-rw-r--r--lib/rubygems/defaults.rb66
-rw-r--r--lib/rubygems/dependency.rb83
-rw-r--r--lib/rubygems/dependency_installer.rb443
-rw-r--r--lib/rubygems/dependency_list.rb32
-rw-r--r--lib/rubygems/deprecate.rb80
-rw-r--r--lib/rubygems/doc_manager.rb243
-rw-r--r--lib/rubygems/doctor.rb131
-rw-r--r--lib/rubygems/errors.rb120
-rw-r--r--lib/rubygems/exceptions.rb175
-rw-r--r--lib/rubygems/ext.rb4
-rw-r--r--lib/rubygems/ext/build_error.rb6
-rw-r--r--lib/rubygems/ext/builder.rb198
-rw-r--r--lib/rubygems/ext/cmake_builder.rb16
-rw-r--r--lib/rubygems/ext/configure_builder.rb6
-rw-r--r--lib/rubygems/ext/ext_conf_builder.rb60
-rw-r--r--lib/rubygems/ext/rake_builder.rb7
-rw-r--r--lib/rubygems/format.rb82
-rw-r--r--lib/rubygems/gem_openssl.rb90
-rw-r--r--lib/rubygems/gem_path_searcher.rb172
-rw-r--r--lib/rubygems/gem_runner.rb41
-rw-r--r--lib/rubygems/gemcutter_utilities.rb126
-rw-r--r--lib/rubygems/indexer.rb182
-rw-r--r--lib/rubygems/install_default_message.rb12
-rw-r--r--lib/rubygems/install_message.rb12
-rw-r--r--lib/rubygems/install_update_options.rb77
-rw-r--r--lib/rubygems/installer.rb519
-rw-r--r--lib/rubygems/installer_test_case.rb90
-rw-r--r--lib/rubygems/mock_gem_ui.rb17
-rw-r--r--lib/rubygems/name_tuple.rb121
-rw-r--r--lib/rubygems/old_format.rb153
-rw-r--r--lib/rubygems/package.rb601
-rw-r--r--lib/rubygems/package/digest_io.rb64
-rw-r--r--lib/rubygems/package/f_sync_dir.rb23
-rw-r--r--lib/rubygems/package/old.rb178
-rw-r--r--lib/rubygems/package/tar_header.rb73
-rw-r--r--lib/rubygems/package/tar_input.rb235
-rw-r--r--lib/rubygems/package/tar_output.rb146
-rw-r--r--lib/rubygems/package/tar_reader.rb23
-rw-r--r--lib/rubygems/package/tar_test_case.rb18
-rw-r--r--lib/rubygems/package/tar_writer.rb99
-rw-r--r--lib/rubygems/package_task.rb14
-rw-r--r--lib/rubygems/path_support.rb31
-rw-r--r--lib/rubygems/platform.rb67
-rw-r--r--lib/rubygems/psych_additions.rb13
-rw-r--r--lib/rubygems/psych_tree.rb29
-rw-r--r--lib/rubygems/rdoc.rb336
-rw-r--r--lib/rubygems/remote_fetcher.rb353
-rw-r--r--lib/rubygems/request.rb274
-rw-r--r--lib/rubygems/request_set.rb273
-rw-r--r--lib/rubygems/request_set/gem_dependency_api.rb513
-rw-r--r--lib/rubygems/request_set/lockfile.rb356
-rw-r--r--lib/rubygems/require_paths_builder.rb18
-rw-r--r--lib/rubygems/requirement.rb118
-rw-r--r--lib/rubygems/resolver.rb415
-rw-r--r--lib/rubygems/resolver/activation_request.rb138
-rw-r--r--lib/rubygems/resolver/api_set.rb110
-rw-r--r--lib/rubygems/resolver/api_specification.rb75
-rw-r--r--lib/rubygems/resolver/best_set.rb21
-rw-r--r--lib/rubygems/resolver/composed_set.rb39
-rw-r--r--lib/rubygems/resolver/conflict.rb123
-rw-r--r--lib/rubygems/resolver/current_set.rb13
-rw-r--r--lib/rubygems/resolver/dependency_request.rb71
-rw-r--r--lib/rubygems/resolver/git_set.rb70
-rw-r--r--lib/rubygems/resolver/git_specification.rb16
-rw-r--r--lib/rubygems/resolver/index_set.rb50
-rw-r--r--lib/rubygems/resolver/index_specification.rb69
-rw-r--r--lib/rubygems/resolver/installed_specification.rb34
-rw-r--r--lib/rubygems/resolver/installer_set.rb152
-rw-r--r--lib/rubygems/resolver/lock_set.rb60
-rw-r--r--lib/rubygems/resolver/requirement_list.rb44
-rw-r--r--lib/rubygems/resolver/set.rb27
-rw-r--r--lib/rubygems/resolver/spec_specification.rb58
-rw-r--r--lib/rubygems/resolver/specification.rb60
-rw-r--r--lib/rubygems/resolver/vendor_set.rb66
-rw-r--r--lib/rubygems/resolver/vendor_specification.rb16
-rw-r--r--lib/rubygems/security.rb861
-rw-r--r--lib/rubygems/security/policies.rb115
-rw-r--r--lib/rubygems/security/policy.rb294
-rw-r--r--lib/rubygems/security/signer.rb154
-rw-r--r--lib/rubygems/security/trust_dir.rb104
-rw-r--r--lib/rubygems/server.rb129
-rw-r--r--lib/rubygems/source.rb217
-rw-r--r--lib/rubygems/source/git.rb186
-rw-r--r--lib/rubygems/source/installed.rb34
-rw-r--r--lib/rubygems/source/local.rb128
-rw-r--r--lib/rubygems/source/specific_file.rb67
-rw-r--r--lib/rubygems/source/vendor.rb25
-rw-r--r--lib/rubygems/source_index.rb406
-rw-r--r--lib/rubygems/source_list.rb149
-rw-r--r--lib/rubygems/source_local.rb5
-rw-r--r--lib/rubygems/source_specific_file.rb4
-rw-r--r--lib/rubygems/spec_fetcher.rb345
-rw-r--r--lib/rubygems/specification.rb1443
-rw-r--r--lib/rubygems/ssl_certs/.document1
-rw-r--r--lib/rubygems/ssl_certs/Class3PublicPrimaryCertificationAuthority.pem14
-rw-r--r--lib/rubygems/ssl_certs/DigiCertHighAssuranceEVRootCA.pem23
-rw-r--r--lib/rubygems/ssl_certs/EntrustnetSecureServerCertificationAuthority.pem28
-rw-r--r--lib/rubygems/ssl_certs/GeoTrustGlobalCA.pem20
-rw-r--r--lib/rubygems/ssl_certs/ca-bundle.pem3366
-rw-r--r--lib/rubygems/stub_specification.rb176
-rw-r--r--lib/rubygems/syck_hack.rb75
-rw-r--r--lib/rubygems/test_case.rb746
-rw-r--r--lib/rubygems/test_utilities.rb202
-rw-r--r--lib/rubygems/uninstaller.rb155
-rw-r--r--lib/rubygems/uri_formatter.rb49
-rw-r--r--lib/rubygems/user_interaction.rb190
-rw-r--r--lib/rubygems/util.rb63
-rw-r--r--lib/rubygems/util/list.rb48
-rw-r--r--lib/rubygems/util/stringio.rb34
-rw-r--r--lib/rubygems/validator.rb79
-rw-r--r--lib/rubygems/version.rb39
-rw-r--r--lib/rubygems/version_option.rb10
-rw-r--r--lib/scanf.rb4
-rw-r--r--lib/securerandom.rb97
-rw-r--r--[-rwxr-xr-x]lib/set.rb739
-rw-r--r--lib/shell.rb143
-rw-r--r--lib/shell/command-processor.rb291
-rw-r--r--lib/shell/filter.rb36
-rw-r--r--lib/shell/process-controller.rb2
-rw-r--r--lib/shell/system-command.rb2
-rw-r--r--lib/shell/version.rb2
-rw-r--r--lib/shellwords.rb128
-rw-r--r--lib/sync.rb47
-rw-r--r--lib/tempfile.rb80
-rw-r--r--lib/test/unit.rb626
-rw-r--r--lib/test/unit/assertions.rb100
-rw-r--r--lib/test/unit/parallel.rb71
-rw-r--r--lib/test/unit/test-unit.gemspec14
-rw-r--r--lib/test/unit/testcase.rb11
-rw-r--r--lib/thread.rb361
-rw-r--r--lib/thwait.rb2
-rw-r--r--lib/time.rb295
-rw-r--r--lib/timeout.rb45
-rw-r--r--lib/tmpdir.rb25
-rw-r--r--lib/tracer.rb56
-rw-r--r--lib/tsort.rb242
-rw-r--r--lib/un.rb49
-rw-r--r--lib/uri/common.rb306
-rw-r--r--lib/uri/ftp.rb17
-rw-r--r--lib/uri/generic.rb88
-rw-r--r--lib/uri/http.rb2
-rw-r--r--lib/uri/mailto.rb2
-rw-r--r--lib/weakref.rb111
-rw-r--r--lib/webrick.rb11
-rw-r--r--lib/webrick/accesslog.rb7
-rw-r--r--lib/webrick/cgi.rb52
-rw-r--r--lib/webrick/config.rb32
-rw-r--r--lib/webrick/cookie.rb71
-rw-r--r--lib/webrick/htmlutils.rb5
-rw-r--r--lib/webrick/httpauth/authenticator.rb20
-rw-r--r--lib/webrick/httpauth/basicauth.rb2
-rw-r--r--lib/webrick/httpauth/digestauth.rb24
-rw-r--r--lib/webrick/httpauth/htdigest.rb9
-rw-r--r--lib/webrick/httpauth/htpasswd.rb9
-rw-r--r--lib/webrick/httpproxy.rb46
-rw-r--r--lib/webrick/httprequest.rb148
-rw-r--r--lib/webrick/httpresponse.rb109
-rw-r--r--lib/webrick/https.rb24
-rw-r--r--lib/webrick/httpserver.rb16
-rw-r--r--lib/webrick/httpservlet/abstract.rb2
-rw-r--r--lib/webrick/httpservlet/cgihandler.rb19
-rw-r--r--lib/webrick/httpservlet/filehandler.rb118
-rw-r--r--lib/webrick/httpservlet/prochandler.rb13
-rw-r--r--lib/webrick/httpstatus.rb28
-rw-r--r--lib/webrick/httputils.rb143
-rw-r--r--lib/webrick/httpversion.rb28
-rw-r--r--lib/webrick/log.rb23
-rw-r--r--lib/webrick/server.rb165
-rw-r--r--lib/webrick/ssl.rb74
-rw-r--r--lib/webrick/utils.rb30
-rw-r--r--lib/webrick/version.rb4
-rw-r--r--lib/xmlrpc.rb301
-rw-r--r--lib/xmlrpc/README.rdoc300
-rw-r--r--lib/xmlrpc/README.txt31
-rw-r--r--lib/xmlrpc/base64.rb63
-rw-r--r--lib/xmlrpc/client.rb629
-rw-r--r--lib/xmlrpc/config.rb28
-rw-r--r--lib/xmlrpc/create.rb21
-rw-r--r--lib/xmlrpc/datetime.rb119
-rw-r--r--lib/xmlrpc/httpserver.rb45
-rw-r--r--lib/xmlrpc/marshal.rb18
-rw-r--r--lib/xmlrpc/parser.rb84
-rw-r--r--lib/xmlrpc/server.rb561
-rw-r--r--lib/xmlrpc/utils.rb44
-rw-r--r--lib/yaml.rb119
-rw-r--r--lib/yaml/dbm.rb91
-rw-r--r--lib/yaml/store.rb15
-rw-r--r--load.c592
-rw-r--r--loadpath.c92
-rw-r--r--localeinit.c65
-rw-r--r--main.c4
-rw-r--r--man/erb.110
-rw-r--r--man/goruby.110
-rw-r--r--man/irb.18
-rw-r--r--man/rake.144
-rw-r--r--man/ri.111
-rw-r--r--man/ruby.141
-rw-r--r--marshal.c552
-rw-r--r--math.c363
-rw-r--r--method.h58
-rw-r--r--miniinit.c30
-rw-r--r--misc/inf-ruby.el4
-rw-r--r--misc/rdoc-mode.el2
-rw-r--r--misc/ruby-additional.el113
-rw-r--r--misc/ruby-electric.el558
-rw-r--r--misc/ruby-mode.el162
-rw-r--r--misc/ruby-style.el1
-rw-r--r--missing/alloca.c6
-rw-r--r--missing/crt_externs.h8
-rw-r--r--missing/crypt.c2
-rw-r--r--missing/file.h2
-rw-r--r--missing/flock.c7
-rw-r--r--missing/isnan.c15
-rw-r--r--missing/setproctitle.c10
-rw-r--r--nacl/GNUmakefile.in87
-rw-r--r--nacl/README.nacl34
-rw-r--r--nacl/create_nmf.rb70
-rw-r--r--nacl/dirent.h15
-rw-r--r--nacl/example.html150
-rw-r--r--nacl/ioctl.h7
-rw-r--r--nacl/nacl-config.rb61
-rw-r--r--nacl/package.rb109
-rw-r--r--nacl/pepper_main.c870
-rw-r--r--nacl/resource.h8
-rw-r--r--nacl/select.h7
-rw-r--r--nacl/signal.h6
-rw-r--r--nacl/stat.h10
-rw-r--r--nacl/unistd.h9
-rw-r--r--nacl/utime.h11
-rw-r--r--node.c66
-rw-r--r--node.h70
-rw-r--r--numeric.c1808
-rw-r--r--object.c955
-rw-r--r--pack.c674
-rw-r--r--parse.y2746
-rw-r--r--prelude.rb16
-rw-r--r--probes.d223
-rw-r--r--probes_helper.h67
-rw-r--r--proc.c856
-rw-r--r--process.c3507
-rw-r--r--random.c627
-rw-r--r--range.c546
-rw-r--r--rational.c921
-rw-r--r--re.c199
-rw-r--r--regcomp.c592
-rw-r--r--regenc.c32
-rw-r--r--regenc.h22
-rw-r--r--regerror.c23
-rw-r--r--regexec.c844
-rw-r--r--regint.h125
-rw-r--r--regparse.c1108
-rw-r--r--regparse.h17
-rw-r--r--regsyntax.c84
-rw-r--r--ruby.c396
-rw-r--r--ruby_atomic.h31
-rw-r--r--safe.c34
-rw-r--r--sample/README2
-rw-r--r--sample/cal.rb10
-rw-r--r--sample/coverage.rb4
-rw-r--r--sample/curses/hello.rb27
-rw-r--r--sample/curses/mouse.rb52
-rw-r--r--sample/curses/rain.rb74
-rw-r--r--sample/curses/view.rb (renamed from ext/curses/view.rb)2
-rw-r--r--sample/curses/view2.rb (renamed from ext/curses/view2.rb)0
-rw-r--r--sample/drb/README.ja.rdoc59
-rw-r--r--sample/drb/README.rd.ja59
-rw-r--r--sample/drb/README.rdoc (renamed from sample/drb/README.rd)6
-rw-r--r--sample/drb/dbiff.rb22
-rw-r--r--sample/drb/dchats.rb20
-rw-r--r--sample/drb/dhasenc.rb6
-rw-r--r--sample/drb/dlogd.rb4
-rw-r--r--sample/drb/gw_cu.rb2
-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/simpletuple.rb8
-rw-r--r--sample/dualstack-fetch.rb2
-rw-r--r--sample/dualstack-httpd.rb32
-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
-rwxr-xr-x[-rw-r--r--]sample/mine.rb40
-rw-r--r--sample/mkproto.rb22
-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/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/pty/expect_sample.rb2
-rw-r--r--sample/rcs.awk54
-rwxr-xr-x[-rw-r--r--]sample/test.rb143
-rw-r--r--sample/trojan.rb2
-rw-r--r--signal.c313
-rw-r--r--siphash.c2
-rw-r--r--sparc.c14
-rw-r--r--spec/default.mspec8
-rw-r--r--sprintf.c334
-rw-r--r--st.c752
-rw-r--r--strftime.c168
-rw-r--r--string.c2092
-rw-r--r--struct.c639
-rw-r--r--template/Doxyfile.tmpl20
-rw-r--r--template/GNUmakefile.in6
-rw-r--r--template/encdb.h.tmpl16
-rw-r--r--[-rwxr-xr-x]template/fake.rb.in6
-rw-r--r--template/id.c.tmpl27
-rw-r--r--template/id.h.tmpl174
-rw-r--r--template/ruby.pc.in36
-rw-r--r--template/sizes.c.tmpl30
-rw-r--r--template/verconf.h.in61
-rw-r--r--template/yarvarch.ja402
-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.rb374
-rw-r--r--test/-ext-/bignum/test_str2big.rb37
-rw-r--r--test/-ext-/bug_reporter/test_bug_reporter.rb9
-rw-r--r--test/-ext-/class/test_class2name.rb18
-rw-r--r--test/-ext-/debug/test_debug.rb58
-rw-r--r--test/-ext-/debug/test_profile_frames.rb104
-rw-r--r--test/-ext-/exception/test_enc_raise.rb15
-rw-r--r--test/-ext-/exception/test_ensured.rb32
-rw-r--r--test/-ext-/file/test_stat.rb14
-rw-r--r--test/-ext-/iter/test_iter_break.rb12
-rw-r--r--test/-ext-/marshal/test_usrmarshal.rb33
-rw-r--r--test/-ext-/method/test_arity.rb37
-rw-r--r--test/-ext-/num2int/test_num2int.rb267
-rw-r--r--test/-ext-/old_thread_select/test_old_thread_select.rb6
-rw-r--r--test/-ext-/path_to_class/test_path_to_class.rb12
-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-/st/test_numhash.rb28
-rw-r--r--test/-ext-/st/test_update.rb50
-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_enc_str_buf_cat.rb15
-rw-r--r--test/-ext-/string/test_modify_expand.rb20
-rw-r--r--test/-ext-/string/test_normalize.rb106
-rw-r--r--test/-ext-/string/test_qsort.rb19
-rw-r--r--test/-ext-/symbol/test_inadvertent_creation.rb266
-rw-r--r--test/-ext-/symbol/test_type.rb110
-rw-r--r--test/-ext-/test_bug-5832.rb21
-rw-r--r--test/-ext-/test_printf.rb184
-rw-r--r--test/-ext-/tracepoint/test_tracepoint.rb53
-rw-r--r--test/-ext-/typeddata/test_typeddata.rb16
-rw-r--r--test/-ext-/wait_for_single_fd/test_wait_for_single_fd.rb5
-rw-r--r--test/base64/test_base64.rb1
-rw-r--r--test/benchmark/test_benchmark.rb102
-rw-r--r--test/bigdecimal/test_bigdecimal.rb234
-rw-r--r--test/bigdecimal/test_bigdecimal_util.rb9
-rw-r--r--test/cgi/test_cgi_core.rb18
-rw-r--r--test/cgi/test_cgi_header.rb48
-rw-r--r--test/cgi/test_cgi_modruby.rb7
-rw-r--r--test/cgi/test_cgi_multipart.rb53
-rw-r--r--test/cgi/test_cgi_session.rb2
-rw-r--r--test/cgi/test_cgi_tag_helper.rb14
-rw-r--r--test/cgi/test_cgi_util.rb53
-rw-r--r--test/coverage/test_coverage.rb2
-rwxr-xr-xtest/csv/test_encodings.rb2
-rwxr-xr-xtest/csv/test_features.rb86
-rwxr-xr-xtest/csv/test_interface.rb6
-rwxr-xr-xtest/csv/test_row.rb33
-rwxr-xr-xtest/csv/test_serialization.rb158
-rw-r--r--test/csv/ts_all.rb1
-rw-r--r--test/date/test_date_marshal.rb12
-rw-r--r--test/date/test_date_parse.rb782
-rw-r--r--test/date/test_date_strftime.rb23
-rw-r--r--test/date/test_date_strptime.rb172
-rw-r--r--test/date/test_switch_hitter.rb89
-rw-r--r--test/dbm/test_dbm.rb61
-rwxr-xr-xtest/digest/test_digest.rb56
-rw-r--r--test/digest/test_digest_extend.rb1
-rw-r--r--test/dl/test_base.rb15
-rw-r--r--test/dl/test_c_struct_entry.rb55
-rw-r--r--test/dl/test_c_union_entity.rb31
-rw-r--r--test/dl/test_callback.rb9
-rw-r--r--test/dl/test_cfunc.rb2
-rw-r--r--test/dl/test_cparser.rb24
-rw-r--r--test/dl/test_dl2.rb43
-rw-r--r--test/dl/test_func.rb4
-rw-r--r--test/dl/test_handle.rb9
-rw-r--r--test/dl/test_import.rb9
-rw-r--r--test/drb/drbtest.rb55
-rw-r--r--test/drb/ignore_test_drb.rb16
-rw-r--r--test/drb/test_drb.rb52
-rw-r--r--test/drb/test_drbssl.rb10
-rw-r--r--test/drb/test_drbunix.rb10
-rw-r--r--test/drb/ut_array.rb2
-rw-r--r--test/drb/ut_array_drbssl.rb13
-rw-r--r--test/drb/ut_drb.rb3
-rw-r--r--test/drb/ut_drb_drbssl.rb13
-rw-r--r--test/drb/ut_eq.rb2
-rw-r--r--test/dtrace/dummy.rb1
-rw-r--r--test/dtrace/helper.rb51
-rw-r--r--test/dtrace/test_array_create.rb35
-rw-r--r--test/dtrace/test_cmethod.rb49
-rw-r--r--test/dtrace/test_function_entry.rb87
-rw-r--r--test/dtrace/test_gc.rb26
-rw-r--r--test/dtrace/test_hash_create.rb52
-rw-r--r--test/dtrace/test_load.rb52
-rw-r--r--test/dtrace/test_object_create_start.rb35
-rw-r--r--test/dtrace/test_raise.rb29
-rw-r--r--test/dtrace/test_require.rb34
-rw-r--r--test/dtrace/test_singleton_function.rb55
-rw-r--r--test/dtrace/test_string.rb27
-rw-r--r--test/erb/test_erb.rb67
-rw-r--r--test/etc/test_etc.rb17
-rw-r--r--test/fiddle/helper.rb17
-rw-r--r--test/fiddle/test_c_struct_entry.rb76
-rw-r--r--test/fiddle/test_c_union_entity.rb34
-rw-r--r--test/fiddle/test_closure.rb4
-rw-r--r--test/fiddle/test_cparser.rb35
-rw-r--r--test/fiddle/test_fiddle.rb16
-rw-r--r--test/fiddle/test_func.rb92
-rw-r--r--test/fiddle/test_function.rb5
-rw-r--r--test/fiddle/test_handle.rb189
-rw-r--r--test/fiddle/test_import.rb140
-rw-r--r--test/fiddle/test_pointer.rb234
-rw-r--r--test/fileutils/fileasserts.rb102
-rw-r--r--test/fileutils/test_dryrun.rb20
-rw-r--r--test/fileutils/test_fileutils.rb199
-rw-r--r--test/fileutils/test_nowrite.rb21
-rw-r--r--test/fileutils/test_verbose.rb18
-rw-r--r--test/fileutils/visibility_tests.rb41
-rw-r--r--test/gdbm/test_gdbm.rb100
-rw-r--r--test/iconv/test_basic.rb59
-rw-r--r--test/iconv/test_option.rb43
-rw-r--r--test/iconv/test_partial.rb41
-rw-r--r--test/iconv/utils.rb29
-rw-r--r--test/io/console/test_io_console.rb75
-rw-r--r--test/io/wait/test_io_wait.rb36
-rw-r--r--test/json/fixtures/fail18.json2
-rwxr-xr-xtest/json/test_json.rb107
-rwxr-xr-xtest/json/test_json_addition.rb33
-rw-r--r--test/json/test_json_encoding.rb4
-rwxr-xr-xtest/json/test_json_fixtures.rb4
-rwxr-xr-xtest/json/test_json_generate.rb194
-rw-r--r--test/json/test_json_generic_object.rb75
-rw-r--r--test/json/test_json_string_matching.rb4
-rwxr-xr-xtest/json/test_json_unicode.rb4
-rw-r--r--test/logger/test_logger.rb107
-rw-r--r--test/matrix/test_vector.rb15
-rw-r--r--test/minitest/metametameta.rb74
-rw-r--r--test/minitest/test_minitest_benchmark.rb18
-rw-r--r--test/minitest/test_minitest_mock.rb282
-rw-r--r--test/minitest/test_minitest_spec.rb664
-rw-r--r--test/minitest/test_minitest_unit.rb1099
-rw-r--r--test/misc/test_ruby_mode.rb41
-rw-r--r--test/mkmf/base.rb26
-rw-r--r--test/mkmf/test_config.rb17
-rw-r--r--test/mkmf/test_constant.rb37
-rw-r--r--test/mkmf/test_convertible.rb2
-rw-r--r--test/mkmf/test_framework.rb46
-rw-r--r--test/mkmf/test_have_func.rb14
-rw-r--r--test/mkmf/test_have_library.rb55
-rw-r--r--test/mkmf/test_have_macro.rb35
-rw-r--r--test/mkmf/test_libs.rb86
-rw-r--r--test/mkmf/test_signedness.rb2
-rw-r--r--test/mkmf/test_sizeof.rb2
-rw-r--r--test/net/ftp/test_ftp.rb813
-rw-r--r--test/net/http/test_http.rb489
-rw-r--r--test/net/http/test_http_request.rb79
-rw-r--r--test/net/http/test_httpheader.rb27
-rw-r--r--test/net/http/test_httpresponse.rb226
-rw-r--r--test/net/http/test_httpresponses.rb24
-rw-r--r--test/net/http/test_https.rb36
-rw-r--r--test/net/http/test_https_proxy.rb6
-rw-r--r--test/net/http/utils.rb6
-rw-r--r--test/net/imap/test_imap.rb75
-rw-r--r--test/net/imap/test_imap_response_parser.rb111
-rw-r--r--test/net/protocol/test_protocol.rb1
-rw-r--r--test/net/smtp/test_smtp.rb25
-rw-r--r--test/objspace/test_objspace.rb216
-rw-r--r--test/open-uri/test_open-uri.rb94
-rw-r--r--test/open-uri/test_ssl.rb25
-rw-r--r--test/openssl/test_asn1.rb12
-rw-r--r--test/openssl/test_bn.rb35
-rw-r--r--test/openssl/test_buffering.rb1
-rw-r--r--test/openssl/test_cipher.rb150
-rw-r--r--test/openssl/test_config.rb28
-rw-r--r--test/openssl/test_digest.rb8
-rw-r--r--test/openssl/test_engine.rb70
-rw-r--r--test/openssl/test_fips.rb14
-rw-r--r--test/openssl/test_ns_spki.rb1
-rw-r--r--test/openssl/test_pair.rb78
-rw-r--r--test/openssl/test_pkcs12.rb6
-rw-r--r--test/openssl/test_pkcs5.rb97
-rw-r--r--test/openssl/test_pkcs7.rb2
-rw-r--r--test/openssl/test_pkey_dh.rb22
-rw-r--r--test/openssl/test_pkey_dsa.rb16
-rw-r--r--test/openssl/test_pkey_ec.rb59
-rw-r--r--test/openssl/test_pkey_rsa.rb39
-rw-r--r--test/openssl/test_ssl.rb481
-rw-r--r--test/openssl/test_ssl_session.rb52
-rw-r--r--test/openssl/test_x509cert.rb19
-rw-r--r--test/openssl/test_x509crl.rb5
-rw-r--r--test/openssl/test_x509name.rb3
-rw-r--r--test/openssl/test_x509req.rb4
-rw-r--r--test/openssl/test_x509store.rb5
-rw-r--r--test/openssl/utils.rb26
-rw-r--r--test/optparse/test_acceptable.rb195
-rw-r--r--test/optparse/test_autoconf.rb63
-rw-r--r--test/optparse/test_optparse.rb3
-rw-r--r--test/optparse/test_summary.rb8
-rw-r--r--test/ostruct/test_ostruct.rb80
-rw-r--r--test/pathname/test_pathname.rb24
-rw-r--r--test/profile_test_all.rb90
-rw-r--r--test/psych/handlers/test_recorder.rb25
-rw-r--r--test/psych/helper.rb67
-rw-r--r--test/psych/test_alias_and_anchor.rb12
-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.rb10
-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.rb116
-rw-r--r--test/psych/test_engine_manager.rb12
-rw-r--r--test/psych/test_exception.rb59
-rw-r--r--test/psych/test_hash.rb2
-rw-r--r--test/psych/test_json_tree.rb2
-rw-r--r--test/psych/test_merge_keys.rb71
-rw-r--r--test/psych/test_nil.rb2
-rw-r--r--test/psych/test_null.rb2
-rw-r--r--test/psych/test_numeric.rb22
-rw-r--r--test/psych/test_object.rb2
-rw-r--r--test/psych/test_object_references.rb8
-rw-r--r--test/psych/test_omap.rb2
-rw-r--r--test/psych/test_parser.rb9
-rw-r--r--test/psych/test_psych.rb30
-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.rb19
-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.rb69
-rw-r--r--test/psych/test_struct.rb6
-rw-r--r--test/psych/test_symbol.rb2
-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.rb24
-rw-r--r--test/psych/test_yamldbm.rb197
-rw-r--r--test/psych/test_yamlstore.rb (renamed from test/syck/test_yamlstore.rb)26
-rw-r--r--test/psych/visitors/test_to_ruby.rb9
-rw-r--r--test/psych/visitors/test_yaml_tree.rb20
-rw-r--r--test/rake/helper.rb452
-rw-r--r--test/rake/support/rakefile_definitions.rb444
-rw-r--r--test/rake/support/ruby_runner.rb33
-rw-r--r--test/rake/test_private_reader.rb42
-rw-r--r--test/rake/test_rake_application.rb86
-rw-r--r--test/rake/test_rake_application_options.rb198
-rw-r--r--test/rake/test_rake_backtrace.rb113
-rw-r--r--test/rake/test_rake_clean.rb46
-rw-r--r--test/rake/test_rake_definitions.rb5
-rw-r--r--test/rake/test_rake_directory_task.rb21
-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.rb47
-rw-r--r--test/rake/test_rake_file_task.rb32
-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.rb70
-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.rb9
-rw-r--r--test/rake/test_rake_name_space.rb2
-rw-r--r--test/rake/test_rake_path_map.rb35
-rw-r--r--test/rake/test_rake_rake_test_loader.rb7
-rw-r--r--test/rake/test_rake_rdoc_task.rb83
-rw-r--r--test/rake/test_rake_reduce_compat.rb26
-rw-r--r--test/rake/test_rake_rules.rb59
-rw-r--r--test/rake/test_rake_scope.rb44
-rw-r--r--test/rake/test_rake_task.rb143
-rw-r--r--test/rake/test_rake_task_arguments.rb37
-rw-r--r--test/rake/test_rake_task_manager.rb31
-rw-r--r--test/rake/test_rake_task_manager_argument_resolution.rb17
-rw-r--r--test/rake/test_rake_task_with_arguments.rb42
-rw-r--r--test/rake/test_rake_test_task.rb3
-rw-r--r--test/rake/test_rake_thread_pool.rb142
-rw-r--r--test/rake/test_rake_top_level_functions.rb42
-rw-r--r--test/rake/test_sys.rb20
-rw-r--r--test/rake/test_thread_history_display.rb101
-rw-r--r--test/rake/test_trace_output.rb52
-rw-r--r--test/rdoc/MarkdownTest_1.0.3/Amps and angle encoding.text21
-rw-r--r--test/rdoc/MarkdownTest_1.0.3/Auto links.text13
-rw-r--r--test/rdoc/MarkdownTest_1.0.3/Backslash escapes.text120
-rw-r--r--test/rdoc/MarkdownTest_1.0.3/Blockquotes with code blocks.text11
-rw-r--r--test/rdoc/MarkdownTest_1.0.3/Code Blocks.text14
-rw-r--r--test/rdoc/MarkdownTest_1.0.3/Code Spans.text6
-rw-r--r--test/rdoc/MarkdownTest_1.0.3/Hard-wrapped paragraphs with list-like lines.text8
-rw-r--r--test/rdoc/MarkdownTest_1.0.3/Horizontal rules.text67
-rw-r--r--test/rdoc/MarkdownTest_1.0.3/Inline HTML (Advanced).text15
-rw-r--r--test/rdoc/MarkdownTest_1.0.3/Inline HTML (Simple).text69
-rw-r--r--test/rdoc/MarkdownTest_1.0.3/Inline HTML comments.text13
-rw-r--r--test/rdoc/MarkdownTest_1.0.3/Links, inline style.text12
-rw-r--r--test/rdoc/MarkdownTest_1.0.3/Links, reference style.text71
-rw-r--r--test/rdoc/MarkdownTest_1.0.3/Links, shortcut references.text20
-rw-r--r--test/rdoc/MarkdownTest_1.0.3/Literal quotes in titles.text7
-rw-r--r--test/rdoc/MarkdownTest_1.0.3/Markdown Documentation - Basics.text306
-rw-r--r--test/rdoc/MarkdownTest_1.0.3/Markdown Documentation - Syntax.text888
-rw-r--r--test/rdoc/MarkdownTest_1.0.3/Nested blockquotes.text5
-rw-r--r--test/rdoc/MarkdownTest_1.0.3/Ordered and unordered lists.text131
-rw-r--r--test/rdoc/MarkdownTest_1.0.3/Strong and em together.text7
-rw-r--r--test/rdoc/MarkdownTest_1.0.3/Tabs.text21
-rw-r--r--test/rdoc/MarkdownTest_1.0.3/Tidyness.text5
-rw-r--r--test/rdoc/test.ja.largedoc3
-rw-r--r--test/rdoc/test_attribute_manager.rb66
-rw-r--r--test/rdoc/test_rdoc_any_method.rb260
-rw-r--r--test/rdoc/test_rdoc_attr.rb89
-rw-r--r--test/rdoc/test_rdoc_class_module.rb950
-rw-r--r--test/rdoc/test_rdoc_code_object.rb184
-rw-r--r--test/rdoc/test_rdoc_comment.rb504
-rw-r--r--test/rdoc/test_rdoc_constant.rb136
-rw-r--r--test/rdoc/test_rdoc_context.rb272
-rw-r--r--test/rdoc/test_rdoc_context_section.rb118
-rw-r--r--test/rdoc/test_rdoc_cross_reference.rb44
-rw-r--r--test/rdoc/test_rdoc_encoding.rb31
-rw-r--r--test/rdoc/test_rdoc_extend.rb94
-rw-r--r--test/rdoc/test_rdoc_generator_darkfish.rb188
-rw-r--r--test/rdoc/test_rdoc_generator_json_index.rb264
-rw-r--r--test/rdoc/test_rdoc_generator_markup.rb59
-rw-r--r--test/rdoc/test_rdoc_generator_ri.rb47
-rw-r--r--test/rdoc/test_rdoc_include.rb12
-rw-r--r--test/rdoc/test_rdoc_markdown.rb980
-rw-r--r--test/rdoc/test_rdoc_markdown_test.rb1884
-rw-r--r--test/rdoc/test_rdoc_markup.rb16
-rw-r--r--test/rdoc/test_rdoc_markup_attribute_manager.rb138
-rw-r--r--test/rdoc/test_rdoc_markup_attributes.rb39
-rw-r--r--test/rdoc/test_rdoc_markup_document.rb81
-rw-r--r--test/rdoc/test_rdoc_markup_formatter.rb146
-rw-r--r--test/rdoc/test_rdoc_markup_hard_break.rb31
-rw-r--r--test/rdoc/test_rdoc_markup_heading.rb29
-rw-r--r--test/rdoc/test_rdoc_markup_include.rb19
-rw-r--r--test/rdoc/test_rdoc_markup_indented_paragraph.rb23
-rw-r--r--test/rdoc/test_rdoc_markup_paragraph.rb23
-rw-r--r--test/rdoc/test_rdoc_markup_parser.rb390
-rw-r--r--test/rdoc/test_rdoc_markup_pre_process.rb87
-rw-r--r--test/rdoc/test_rdoc_markup_raw.rb21
-rw-r--r--test/rdoc/test_rdoc_markup_to_ansi.rb49
-rw-r--r--test/rdoc/test_rdoc_markup_to_bs.rb33
-rw-r--r--test/rdoc/test_rdoc_markup_to_html.rb384
-rw-r--r--test/rdoc/test_rdoc_markup_to_html_crossref.rb149
-rw-r--r--test/rdoc/test_rdoc_markup_to_html_snippet.rb710
-rw-r--r--test/rdoc/test_rdoc_markup_to_joined_paragraph.rb32
-rw-r--r--test/rdoc/test_rdoc_markup_to_label.rb112
-rw-r--r--test/rdoc/test_rdoc_markup_to_markdown.rb389
-rw-r--r--test/rdoc/test_rdoc_markup_to_rdoc.rb48
-rw-r--r--test/rdoc/test_rdoc_markup_to_table_of_contents.rb126
-rw-r--r--test/rdoc/test_rdoc_markup_to_tt_only.rb25
-rw-r--r--test/rdoc/test_rdoc_markup_verbatim.rb29
-rw-r--r--test/rdoc/test_rdoc_method_attr.rb43
-rw-r--r--test/rdoc/test_rdoc_normal_class.rb34
-rw-r--r--test/rdoc/test_rdoc_normal_module.rb7
-rw-r--r--test/rdoc/test_rdoc_options.rb397
-rw-r--r--test/rdoc/test_rdoc_parser.rb237
-rw-r--r--test/rdoc/test_rdoc_parser_c.rb681
-rw-r--r--test/rdoc/test_rdoc_parser_changelog.rb315
-rw-r--r--test/rdoc/test_rdoc_parser_markdown.rb61
-rw-r--r--test/rdoc/test_rdoc_parser_rd.rb55
-rw-r--r--test/rdoc/test_rdoc_parser_ruby.rb1605
-rw-r--r--test/rdoc/test_rdoc_parser_simple.rb54
-rw-r--r--test/rdoc/test_rdoc_rd.rb30
-rw-r--r--test/rdoc/test_rdoc_rd_block_parser.rb533
-rw-r--r--test/rdoc/test_rdoc_rd_inline.rb63
-rw-r--r--test/rdoc/test_rdoc_rd_inline_parser.rb177
-rw-r--r--test/rdoc/test_rdoc_rdoc.rb313
-rw-r--r--test/rdoc/test_rdoc_ri_driver.rb583
-rw-r--r--test/rdoc/test_rdoc_ri_paths.rb150
-rw-r--r--test/rdoc/test_rdoc_ri_store.rb473
-rw-r--r--test/rdoc/test_rdoc_ruby_lex.rb397
-rw-r--r--test/rdoc/test_rdoc_ruby_token.rb19
-rw-r--r--test/rdoc/test_rdoc_rubygems_hook.rb133
-rw-r--r--test/rdoc/test_rdoc_servlet.rb535
-rw-r--r--test/rdoc/test_rdoc_stats.rb616
-rw-r--r--test/rdoc/test_rdoc_store.rb993
-rw-r--r--test/rdoc/test_rdoc_task.rb21
-rw-r--r--test/rdoc/test_rdoc_text.rb181
-rw-r--r--test/rdoc/test_rdoc_token_stream.rb42
-rw-r--r--test/rdoc/test_rdoc_tom_doc.rb520
-rw-r--r--test/rdoc/test_rdoc_top_level.rb245
-rw-r--r--test/rdoc/xref_test_case.rb26
-rw-r--r--test/readline/test_readline.rb285
-rw-r--r--test/readline/test_readline_history.rb43
-rw-r--r--test/resolv/test_dns.rb32
-rw-r--r--test/rexml/data/testsrc.xml128
-rw-r--r--test/rexml/data/ticket_61.xml8
-rw-r--r--test/rexml/parse/test_document_type_declaration.rb47
-rw-r--r--test/rexml/parse/test_notation_declaration.rb97
-rw-r--r--test/rexml/parser/test_sax2.rb200
-rw-r--r--test/rexml/parser/test_tree.rb40
-rw-r--r--test/rexml/parser/test_ultra_light.rb67
-rw-r--r--test/rexml/rexml_test_utils.rb1
-rw-r--r--test/rexml/test_attributes.rb22
-rw-r--r--test/rexml/test_attributes_mixin.rb3
-rw-r--r--test/rexml/test_changing_encoding.rb1
-rw-r--r--test/rexml/test_contrib.rb24
-rw-r--r--test/rexml/test_core.rb16
-rw-r--r--test/rexml/test_doctype.rb3
-rw-r--r--test/rexml/test_document.rb220
-rw-r--r--test/rexml/test_encoding.rb7
-rw-r--r--test/rexml/test_entity.rb20
-rw-r--r--test/rexml/test_jaxen.rb2
-rw-r--r--test/rexml/test_light.rb2
-rw-r--r--test/rexml/test_lightparser.rb4
-rw-r--r--test/rexml/test_listener.rb10
-rw-r--r--test/rexml/test_namespace.rb2
-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.rb9
-rw-r--r--test/rexml/test_pullparser.rb4
-rw-r--r--test/rexml/test_rexml_issuezilla.rb2
-rw-r--r--test/rexml/test_sax.rb2
-rw-r--r--test/rexml/test_stream.rb23
-rw-r--r--test/rexml/test_text.rb19
-rw-r--r--test/rexml/test_xml_declaration.rb (renamed from test/rexml/test_xml_declaration_parent_child.rb)8
-rw-r--r--test/rexml/test_xpath.rb10
-rw-r--r--test/rexml/test_xpathtext.rb2
-rw-r--r--test/rinda/test_rinda.rb227
-rw-r--r--test/ripper/dummyparser.rb2
-rw-r--r--test/ripper/test_files.rb43
-rw-r--r--test/ripper/test_parser_events.rb70
-rw-r--r--test/ripper/test_ripper.rb2
-rw-r--r--test/ripper/test_scanner_events.rb174
-rw-r--r--test/rss/rss-assertions.rb4
-rw-r--r--test/rss/rss-testcase.rb4
-rw-r--r--test/rss/test_1.0.rb56
-rw-r--r--test/rss/test_2.0.rb56
-rw-r--r--test/rss/test_accessor.rb2
-rw-r--r--test/rss/test_atom.rb26
-rw-r--r--test/rss/test_content.rb2
-rw-r--r--test/rss/test_dublincore.rb24
-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.rb10
-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.rb2
-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.rb12
-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.rb2
-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_euc_jp.rb2
-rw-r--r--test/ruby/enc/test_shift_jis.rb2
-rw-r--r--test/ruby/enc/test_utf16.rb2
-rw-r--r--test/ruby/enc/test_utf32.rb2
-rw-r--r--test/ruby/envutil.rb324
-rw-r--r--test/ruby/lbtest.rb9
-rw-r--r--test/ruby/marshaltestlib.rb144
-rw-r--r--test/ruby/memory_status.rb40
-rw-r--r--test/ruby/test_alias.rb35
-rw-r--r--test/ruby/test_argf.rb118
-rw-r--r--test/ruby/test_arity.rb71
-rw-r--r--test/ruby/test_array.rb315
-rw-r--r--test/ruby/test_autoload.rb120
-rw-r--r--test/ruby/test_backtrace.rb165
-rw-r--r--test/ruby/test_basicinstructions.rb19
-rw-r--r--test/ruby/test_beginendblock.rb122
-rw-r--r--test/ruby/test_bignum.rb234
-rw-r--r--test/ruby/test_class.rb125
-rw-r--r--test/ruby/test_comparable.rb14
-rw-r--r--test/ruby/test_complex.rb20
-rw-r--r--test/ruby/test_const.rb10
-rw-r--r--test/ruby/test_continuation.rb19
-rw-r--r--test/ruby/test_defined.rb73
-rw-r--r--test/ruby/test_dir.rb61
-rw-r--r--test/ruby/test_dir_m17n.rb198
-rw-r--r--test/ruby/test_econv.rb47
-rw-r--r--test/ruby/test_encoding.rb14
-rw-r--r--test/ruby/test_enum.rb64
-rw-r--r--test/ruby/test_enumerator.rb235
-rw-r--r--test/ruby/test_env.rb43
-rw-r--r--test/ruby/test_eval.rb221
-rw-r--r--test/ruby/test_exception.rb308
-rw-r--r--test/ruby/test_fiber.rb155
-rw-r--r--test/ruby/test_file.rb285
-rw-r--r--test/ruby/test_file_exhaustive.rb167
-rw-r--r--test/ruby/test_fixnum.rb70
-rw-r--r--test/ruby/test_flip.rb21
-rw-r--r--test/ruby/test_float.rb120
-rw-r--r--test/ruby/test_fnmatch.rb184
-rw-r--r--test/ruby/test_gc.rb95
-rw-r--r--test/ruby/test_hash.rb439
-rw-r--r--test/ruby/test_ifunless.rb14
-rw-r--r--test/ruby/test_integer.rb79
-rw-r--r--test/ruby/test_integer_comb.rb3
-rw-r--r--test/ruby/test_io.rb1828
-rw-r--r--test/ruby/test_io_m17n.rb189
-rw-r--r--test/ruby/test_iseq.rb119
-rw-r--r--test/ruby/test_iterator.rb34
-rw-r--r--test/ruby/test_keyword.rb418
-rw-r--r--test/ruby/test_lambda.rb63
-rw-r--r--test/ruby/test_lazy_enumerator.rb493
-rw-r--r--test/ruby/test_literal.rb144
-rw-r--r--test/ruby/test_m17n.rb203
-rw-r--r--test/ruby/test_m17n_comb.rb198
-rw-r--r--test/ruby/test_marshal.rb190
-rw-r--r--test/ruby/test_math.rb3
-rw-r--r--test/ruby/test_method.rb210
-rw-r--r--test/ruby/test_module.rb762
-rw-r--r--test/ruby/test_not.rb12
-rw-r--r--test/ruby/test_notimp.rb26
-rw-r--r--test/ruby/test_numeric.rb108
-rw-r--r--test/ruby/test_object.rb391
-rw-r--r--test/ruby/test_objectspace.rb33
-rw-r--r--test/ruby/test_optimization.rb39
-rw-r--r--test/ruby/test_pack.rb97
-rw-r--r--test/ruby/test_parse.rb162
-rw-r--r--test/ruby/test_proc.rb425
-rw-r--r--test/ruby/test_process.rb536
-rw-r--r--test/ruby/test_rand.rb48
-rw-r--r--test/ruby/test_range.rb211
-rw-r--r--test/ruby/test_rational.rb36
-rw-r--r--test/ruby/test_refinement.rb1115
-rw-r--r--test/ruby/test_regexp.rb241
-rw-r--r--test/ruby/test_require.rb587
-rw-r--r--test/ruby/test_rubyoptions.rb297
-rw-r--r--test/ruby/test_settracefunc.rb722
-rw-r--r--test/ruby/test_signal.rb159
-rw-r--r--test/ruby/test_sleep.rb11
-rw-r--r--test/ruby/test_sprintf.rb50
-rw-r--r--test/ruby/test_sprintf_comb.rb46
-rw-r--r--test/ruby/test_string.rb385
-rw-r--r--test/ruby/test_stringchar.rb32
-rw-r--r--test/ruby/test_struct.rb155
-rw-r--r--test/ruby/test_super.rb233
-rw-r--r--test/ruby/test_symbol.rb41
-rw-r--r--test/ruby/test_syntax.rb379
-rw-r--r--test/ruby/test_system.rb64
-rw-r--r--test/ruby/test_thread.rb726
-rw-r--r--test/ruby/test_threadgroup.rb55
-rw-r--r--test/ruby/test_time.rb469
-rw-r--r--test/ruby/test_time_tz.rb51
-rw-r--r--test/ruby/test_transcode.rb143
-rw-r--r--test/ruby/test_unicode_escape.rb4
-rw-r--r--test/ruby/test_whileuntil.rb3
-rw-r--r--test/ruby/test_yield.rb11
-rw-r--r--test/rubygems/alternate_cert.pem18
-rw-r--r--test/rubygems/alternate_cert_32.pem18
-rw-r--r--test/rubygems/alternate_key.pem27
-rw-r--r--test/rubygems/bad_rake.rb1
-rw-r--r--test/rubygems/ca_cert.pem23
-rw-r--r--test/rubygems/child_cert.pem18
-rw-r--r--test/rubygems/child_cert_32.pem18
-rw-r--r--test/rubygems/child_key.pem27
-rw-r--r--test/rubygems/client.pem49
-rw-r--r--test/rubygems/data/null-type.gemspec.rzbin553 -> 554 bytes-rw-r--r--test/rubygems/encrypted_private_key.pem30
-rw-r--r--test/rubygems/expired_cert.pem18
-rw-r--r--test/rubygems/future_cert.pem18
-rw-r--r--test/rubygems/future_cert_32.pem18
-rw-r--r--test/rubygems/good_rake.rb1
-rw-r--r--test/rubygems/grandchild_cert.pem18
-rw-r--r--test/rubygems/grandchild_cert_32.pem18
-rw-r--r--test/rubygems/grandchild_key.pem27
-rw-r--r--test/rubygems/insure_session.rb43
-rw-r--r--test/rubygems/invalid_client.pem49
-rw-r--r--test/rubygems/invalid_issuer_cert.pem18
-rw-r--r--test/rubygems/invalid_issuer_cert_32.pem18
-rw-r--r--test/rubygems/invalid_key.pem27
-rw-r--r--test/rubygems/invalid_signer_cert.pem18
-rw-r--r--test/rubygems/invalid_signer_cert_32.pem18
-rw-r--r--test/rubygems/invalidchild_cert.pem18
-rw-r--r--test/rubygems/invalidchild_cert_32.pem18
-rw-r--r--test/rubygems/invalidchild_key.pem27
-rw-r--r--test/rubygems/plugin/exception/rubygems_plugin.rb2
-rw-r--r--test/rubygems/plugin/standarderror/rubygems_plugin.rb2
-rw-r--r--test/rubygems/private_key.pem50
-rw-r--r--test/rubygems/public_cert.pem34
-rw-r--r--test/rubygems/public_cert_32.pem18
-rw-r--r--test/rubygems/public_key.pem9
-rw-r--r--test/rubygems/rubygems/commands/crash_command.rb2
-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.rb60
-rw-r--r--test/rubygems/test_config.rb10
-rw-r--r--test/rubygems/test_deprecate.rb76
-rw-r--r--test/rubygems/test_gem.rb1068
-rw-r--r--test/rubygems/test_gem_available_set.rb106
-rw-r--r--test/rubygems/test_gem_builder.rb44
-rw-r--r--test/rubygems/test_gem_command.rb10
-rw-r--r--test/rubygems/test_gem_command_manager.rb106
-rw-r--r--test/rubygems/test_gem_commands_build_command.rb32
-rw-r--r--test/rubygems/test_gem_commands_cert_command.rb634
-rw-r--r--test/rubygems/test_gem_commands_check_command.rb50
-rw-r--r--test/rubygems/test_gem_commands_cleanup_command.rb92
-rw-r--r--test/rubygems/test_gem_commands_contents_command.rb51
-rw-r--r--test/rubygems/test_gem_commands_dependency_command.rb57
-rw-r--r--test/rubygems/test_gem_commands_environment_command.rb10
-rw-r--r--test/rubygems/test_gem_commands_fetch_command.rb104
-rw-r--r--test/rubygems/test_gem_commands_generate_index_command.rb85
-rw-r--r--test/rubygems/test_gem_commands_help_command.rb15
-rw-r--r--test/rubygems/test_gem_commands_install_command.rb759
-rw-r--r--test/rubygems/test_gem_commands_list_command.rb6
-rw-r--r--test/rubygems/test_gem_commands_mirror.rb32
-rw-r--r--test/rubygems/test_gem_commands_outdated_command.rb19
-rw-r--r--test/rubygems/test_gem_commands_owner_command.rb73
-rw-r--r--test/rubygems/test_gem_commands_pristine_command.rb223
-rw-r--r--test/rubygems/test_gem_commands_push_command.rb199
-rw-r--r--test/rubygems/test_gem_commands_query_command.rb367
-rw-r--r--test/rubygems/test_gem_commands_search_command.rb17
-rw-r--r--test/rubygems/test_gem_commands_setup_command.rb129
-rw-r--r--test/rubygems/test_gem_commands_sources_command.rb122
-rw-r--r--test/rubygems/test_gem_commands_specification_command.rb103
-rw-r--r--test/rubygems/test_gem_commands_stale_command.rb4
-rw-r--r--test/rubygems/test_gem_commands_uninstall_command.rb158
-rw-r--r--test/rubygems/test_gem_commands_unpack_command.rb52
-rw-r--r--test/rubygems/test_gem_commands_update_command.rb381
-rw-r--r--test/rubygems/test_gem_commands_which_command.rb14
-rw-r--r--test/rubygems/test_gem_commands_yank_command.rb97
-rw-r--r--test/rubygems/test_gem_config_file.rb218
-rw-r--r--test/rubygems/test_gem_dependency.rb46
-rw-r--r--test/rubygems/test_gem_dependency_installer.rb464
-rw-r--r--test/rubygems/test_gem_dependency_list.rb43
-rw-r--r--test/rubygems/test_gem_dependency_resolution_error.rb28
-rw-r--r--test/rubygems/test_gem_doc_manager.rb32
-rw-r--r--test/rubygems/test_gem_doctor.rb168
-rw-r--r--test/rubygems/test_gem_ext_builder.rb265
-rw-r--r--test/rubygems/test_gem_ext_cmake_builder.rb84
-rw-r--r--test/rubygems/test_gem_ext_configure_builder.rb22
-rw-r--r--test/rubygems/test_gem_ext_ext_conf_builder.rb100
-rw-r--r--test/rubygems/test_gem_ext_rake_builder.rb24
-rw-r--r--test/rubygems/test_gem_format.rb88
-rw-r--r--test/rubygems/test_gem_gem_path_searcher.rb94
-rw-r--r--test/rubygems/test_gem_gem_runner.rb38
-rw-r--r--test/rubygems/test_gem_gemcutter_utilities.rb82
-rw-r--r--test/rubygems/test_gem_impossible_dependencies_error.rb45
-rw-r--r--test/rubygems/test_gem_indexer.rb302
-rw-r--r--test/rubygems/test_gem_install_update_options.rb89
-rw-r--r--test/rubygems/test_gem_installer.rb870
-rw-r--r--test/rubygems/test_gem_local_remote_options.rb10
-rw-r--r--test/rubygems/test_gem_name_tuple.rb37
-rw-r--r--test/rubygems/test_gem_package.rb805
-rw-r--r--test/rubygems/test_gem_package_old.rb89
-rw-r--r--test/rubygems/test_gem_package_tar_input.rb129
-rw-r--r--test/rubygems/test_gem_package_tar_output.rb101
-rw-r--r--test/rubygems/test_gem_package_tar_reader.rb41
-rw-r--r--test/rubygems/test_gem_package_tar_reader_entry.rb2
-rw-r--r--test/rubygems/test_gem_package_tar_writer.rb127
-rw-r--r--test/rubygems/test_gem_package_task.rb25
-rw-r--r--test/rubygems/test_gem_path_support.rb39
-rw-r--r--test/rubygems/test_gem_platform.rb104
-rw-r--r--test/rubygems/test_gem_rdoc.rb269
-rw-r--r--test/rubygems/test_gem_remote_fetcher.rb503
-rw-r--r--test/rubygems/test_gem_request.rb279
-rw-r--r--test/rubygems/test_gem_request_set.rb239
-rw-r--r--test/rubygems/test_gem_request_set_gem_dependency_api.rb663
-rw-r--r--test/rubygems/test_gem_request_set_lockfile.rb404
-rw-r--r--test/rubygems/test_gem_requirement.rb89
-rw-r--r--test/rubygems/test_gem_resolver.rb550
-rw-r--r--test/rubygems/test_gem_resolver_activation_request.rb63
-rw-r--r--test/rubygems/test_gem_resolver_api_set.rb167
-rw-r--r--test/rubygems/test_gem_resolver_api_specification.rb68
-rw-r--r--test/rubygems/test_gem_resolver_best_set.rb30
-rw-r--r--test/rubygems/test_gem_resolver_conflict.rb75
-rw-r--r--test/rubygems/test_gem_resolver_dependency_request.rb20
-rw-r--r--test/rubygems/test_gem_resolver_git_set.rb102
-rw-r--r--test/rubygems/test_gem_resolver_git_specification.rb36
-rw-r--r--test/rubygems/test_gem_resolver_index_set.rb28
-rw-r--r--test/rubygems/test_gem_resolver_index_specification.rb67
-rw-r--r--test/rubygems/test_gem_resolver_installed_specification.rb18
-rw-r--r--test/rubygems/test_gem_resolver_installer_set.rb22
-rw-r--r--test/rubygems/test_gem_resolver_lock_set.rb56
-rw-r--r--test/rubygems/test_gem_resolver_requirement_list.rb19
-rw-r--r--test/rubygems/test_gem_resolver_vendor_set.rb65
-rw-r--r--test/rubygems/test_gem_resolver_vendor_specification.rb71
-rw-r--r--test/rubygems/test_gem_security.rb292
-rw-r--r--test/rubygems/test_gem_security_policy.rb540
-rw-r--r--test/rubygems/test_gem_security_signer.rb208
-rw-r--r--test/rubygems/test_gem_security_trust_dir.rb98
-rw-r--r--test/rubygems/test_gem_server.rb177
-rw-r--r--test/rubygems/test_gem_silent_ui.rb4
-rw-r--r--test/rubygems/test_gem_source.rb211
-rw-r--r--test/rubygems/test_gem_source_fetch_problem.rb19
-rw-r--r--test/rubygems/test_gem_source_git.rb183
-rw-r--r--test/rubygems/test_gem_source_index.rb250
-rw-r--r--test/rubygems/test_gem_source_installed.rb28
-rw-r--r--test/rubygems/test_gem_source_list.rb111
-rw-r--r--test/rubygems/test_gem_source_local.rb106
-rw-r--r--test/rubygems/test_gem_source_specific_file.rb71
-rw-r--r--test/rubygems/test_gem_source_vendor.rb27
-rw-r--r--test/rubygems/test_gem_spec_fetcher.rb454
-rw-r--r--test/rubygems/test_gem_specification.rb1378
-rw-r--r--test/rubygems/test_gem_stub_specification.rb143
-rw-r--r--test/rubygems/test_gem_uninstaller.rb236
-rw-r--r--test/rubygems/test_gem_uri_formatter.rb28
-rw-r--r--test/rubygems/test_gem_util.rb15
-rw-r--r--test/rubygems/test_gem_validator.rb55
-rw-r--r--test/rubygems/test_gem_version.rb60
-rw-r--r--test/rubygems/test_gem_version_option.rb64
-rw-r--r--test/rubygems/test_require.rb215
-rw-r--r--test/rubygems/wrong_key_cert.pem18
-rw-r--r--test/rubygems/wrong_key_cert_32.pem18
-rw-r--r--test/runner.rb26
-rw-r--r--test/sdbm/test_sdbm.rb67
-rw-r--r--test/shell/test_command_processor.rb69
-rw-r--r--test/socket/test_addrinfo.rb23
-rw-r--r--test/socket/test_nonblock.rb16
-rw-r--r--test/socket/test_socket.rb139
-rw-r--r--test/socket/test_sockopt.rb18
-rw-r--r--test/socket/test_tcp.rb38
-rw-r--r--test/socket/test_udp.rb33
-rw-r--r--test/socket/test_unix.rb35
-rw-r--r--test/stringio/test_stringio.rb49
-rw-r--r--test/strscan/test_stringscanner.rb26
-rw-r--r--test/syck/test_array.rb18
-rw-r--r--test/syck/test_boolean.rb37
-rw-r--r--test/syck/test_class.rb27
-rw-r--r--test/syck/test_engine_manager.rb3
-rw-r--r--test/syck/test_exception.rb46
-rw-r--r--test/syck/test_hash.rb29
-rw-r--r--test/syck/test_null.rb20
-rw-r--r--test/syck/test_omap.rb56
-rw-r--r--test/syck/test_set.rb31
-rw-r--r--test/syck/test_string.rb45
-rw-r--r--test/syck/test_struct.rb42
-rw-r--r--test/syck/test_symbol.rb22
-rw-r--r--test/syck/test_time.rb24
-rw-r--r--test/syck/test_yaml.rb1413
-rw-r--r--test/syck/test_yaml_properties.rb64
-rw-r--r--test/syslog/test_syslog_logger.rb572
-rw-r--r--test/test_abbrev.rb54
-rw-r--r--test/test_curses.rb74
-rw-r--r--test/test_delegate.rb42
-rw-r--r--test/test_find.rb34
-rw-r--r--test/test_mathn.rb110
-rw-r--r--test/test_open3.rb1
-rw-r--r--test/test_pp.rb5
-rw-r--r--test/test_prime.rb2
-rw-r--r--test/test_pstore.rb26
-rw-r--r--test/test_pty.rb20
-rw-r--r--test/test_rbconfig.rb53
-rw-r--r--test/test_securerandom.rb12
-rw-r--r--test/test_set.rb721
-rw-r--r--test/test_shellwords.rb5
-rw-r--r--test/test_tempfile.rb39
-rw-r--r--test/test_time.rb9
-rw-r--r--test/test_timeout.rb28
-rw-r--r--test/test_tmpdir.rb33
-rw-r--r--test/test_tracer.rb4
-rw-r--r--test/test_tsort.rb56
-rw-r--r--test/test_weakref.rb58
-rw-r--r--test/testunit/test4test_redefinition.rb11
-rw-r--r--test/testunit/test4test_sorting.rb15
-rw-r--r--test/testunit/test_hideskip.rb22
-rw-r--r--test/testunit/test_parallel.rb22
-rw-r--r--test/testunit/test_redefinition.rb15
-rw-r--r--test/testunit/test_sorting.rb17
-rw-r--r--test/testunit/tests_for_parallel/ptest_forth.rb7
-rw-r--r--test/thread/test_cv.rb191
-rw-r--r--test/thread/test_queue.rb120
-rw-r--r--test/thread/test_sync.rb57
-rw-r--r--test/uri/test_common.rb59
-rw-r--r--test/uri/test_generic.rb114
-rw-r--r--test/uri/test_mailto.rb10
-rw-r--r--test/webrick/test_cgi.rb12
-rw-r--r--test/webrick/test_filehandler.rb6
-rw-r--r--test/webrick/test_htmlutils.rb20
-rw-r--r--test/webrick/test_httpauth.rb166
-rw-r--r--test/webrick/test_httpproxy.rb2
-rw-r--r--test/webrick/test_httpresponse.rb141
-rw-r--r--test/webrick/test_httpserver.rb72
-rw-r--r--test/webrick/test_httputils.rb4
-rw-r--r--test/webrick/test_server.rb25
-rw-r--r--test/webrick/utils.rb14
-rw-r--r--test/win32ole/test_thread.rb25
-rw-r--r--test/win32ole/test_win32ole.rb9
-rw-r--r--test/win32ole/test_win32ole_event.rb12
-rw-r--r--test/win32ole/test_win32ole_type.rb2
-rw-r--r--test/win32ole/test_win32ole_variant.rb37
-rw-r--r--test/win32ole/test_win32ole_variant_outarg.rb13
-rw-r--r--test/xmlrpc/data/blog.xml18
-rw-r--r--test/xmlrpc/test_client.rb316
-rw-r--r--test/xmlrpc/test_cookie.rb13
-rw-r--r--test/xmlrpc/test_datetime.rb2
-rw-r--r--test/xmlrpc/test_features.rb2
-rw-r--r--test/xmlrpc/test_marshal.rb2
-rw-r--r--test/xmlrpc/test_parser.rb2
-rw-r--r--test/xmlrpc/test_webrick_server.rb14
-rw-r--r--test/xmlrpc/webrick_testing.rb25
-rw-r--r--test/zlib/test_zlib.rb904
-rw-r--r--thread.c2748
-rw-r--r--thread_native.h23
-rw-r--r--thread_pthread.c665
-rw-r--r--thread_pthread.h19
-rw-r--r--thread_win32.c115
-rw-r--r--thread_win32.h11
-rw-r--r--time.c790
-rw-r--r--timev.h21
-rw-r--r--[-rwxr-xr-x]tool/asm_parse.rb0
-rwxr-xr-xtool/bisect.sh42
-rwxr-xr-xtool/change_maker.rb8
-rw-r--r--[-rwxr-xr-x]tool/compile_prelude.rb6
-rwxr-xr-xtool/config.guess1501
-rwxr-xr-xtool/config.sub1705
-rw-r--r--tool/config_files.rb8
-rwxr-xr-xtool/enc-unicode.rb90
-rw-r--r--[-rwxr-xr-x]tool/eval.rb0
-rwxr-xr-xtool/file2lastrev.rb98
-rwxr-xr-xtool/gen_dummy_probes.rb28
-rwxr-xr-xtool/gen_ruby_tapset.rb105
-rw-r--r--[-rwxr-xr-x]tool/generic_erb.rb12
-rwxr-xr-xtool/get-config_files7
-rwxr-xr-xtool/id2token.rb24
-rwxr-xr-xtool/ifchange17
-rw-r--r--tool/install-sh2
-rwxr-xr-xtool/instruction.rb104
-rwxr-xr-xtool/make-snapshot53
-rwxr-xr-xtool/merger.rb112
-rwxr-xr-xtool/mkconfig.rb55
-rwxr-xr-xtool/mkrunnable.rb116
-rw-r--r--[-rwxr-xr-x]tool/parse.rb0
-rw-r--r--tool/probes_to_wiki.rb16
-rwxr-xr-xtool/rbinstall.rb305
-rwxr-xr-xtool/rbuninstall.rb67
-rwxr-xr-xtool/rubytest.rb6
-rwxr-xr-xtool/runruby.rb12
-rw-r--r--[-rwxr-xr-x]tool/transcode-tblgen.rb108
-rwxr-xr-xtool/update-deps258
-rw-r--r--tool/vcs.rb112
-rw-r--r--tool/vpath.rb82
-rw-r--r--[-rwxr-xr-x]tool/vtlh.rb0
-rw-r--r--transcode.c247
-rw-r--r--transcode_data.h16
-rw-r--r--util.c158
-rw-r--r--variable.c832
-rw-r--r--version.c70
-rw-r--r--version.h17
-rw-r--r--vm.c1406
-rw-r--r--vm_backtrace.c1368
-rw-r--r--vm_core.h570
-rw-r--r--vm_debug.h (renamed from debug.h)10
-rw-r--r--vm_dump.c497
-rw-r--r--vm_eval.c977
-rw-r--r--vm_exec.c62
-rw-r--r--vm_exec.h33
-rw-r--r--vm_insnhelper.c2859
-rw-r--r--vm_insnhelper.h149
-rw-r--r--vm_method.c889
-rw-r--r--vm_opts.h9
-rw-r--r--vm_trace.c1495
-rw-r--r--vsnprintf.c118
-rw-r--r--win32/Makefile.sub195
-rw-r--r--win32/README.win3222
-rwxr-xr-xwin32/configure.bat63
-rw-r--r--win32/dir.h15
-rw-r--r--win32/file.c153
-rwxr-xr-xwin32/ifchange.bat24
-rwxr-xr-xwin32/mkexports.rb16
-rwxr-xr-xwin32/rm.bat4
-rw-r--r--win32/rtname.cmd18
-rw-r--r--win32/setup.mak110
-rw-r--r--win32/win32.c2184
2437 files changed, 369344 insertions, 148995 deletions
diff --git a/.document b/.document
index 8a05d61beb..9a5067bc52 100644
--- a/.document
+++ b/.document
@@ -10,13 +10,19 @@
prelude.rb
# the lib/ directory (which has its own .document file)
-
lib
-
# and some of the ext/ directory (which has its own .document file)
-
ext
# rdoc files
-doc/*.rdoc
+ChangeLog
+
+NEWS
+
+README
+README.EXT
+README.EXT.ja
+README.ja
+
+doc
diff --git a/.editorconfig b/.editorconfig
new file mode 100644
index 0000000000..67abf4b978
--- /dev/null
+++ b/.editorconfig
@@ -0,0 +1,16 @@
+root = true
+
+[*]
+end_of_line = lf
+insert_final_newline = true
+trim_trailing_whitespace = true
+tab_width = 8
+indent_style = tab
+indent_size = 4
+
+[**.bat]
+end_of_line = crlf
+
+[**.rb]
+indent_style = space
+indent_size = 2
diff --git a/.gdbinit b/.gdbinit
index 2a38da8892..78ab191c40 100644
--- a/.gdbinit
+++ b/.gdbinit
@@ -1,4 +1,25 @@
+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
+end
+
+# set prompt \033[36m(gdb)\033[m\040
+
define rp
+ ruby_gdb_init
if ruby_dummy_gdb_enums.special_consts
end
if (VALUE)($arg0) & RUBY_FIXNUM_FLAG
@@ -6,75 +27,8 @@ define rp
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
@@ -89,77 +43,52 @@ define rp
echo undef\n
else
if (VALUE)($arg0) & RUBY_IMMEDIATE_MASK
- echo immediate\n
+ if ((VALUE)($arg0) & RUBY_FLONUM_MASK) == RUBY_FLONUM_FLAG
+ 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)
+ 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) ? "*" : ""
- print (struct RClass *)($arg0)
+ 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: "
- print (struct RClass *)($arg0)
+ printf "%sT_ICLASS%s: ", $color_type, $color_end
+ rp_class $arg0
else
if ($flags & RUBY_T_MASK) == RUBY_T_MODULE
- printf "T_MODULE: "
- print (struct RClass *)($arg0)
+ 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 : \
@@ -183,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)} "
@@ -193,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
@@ -211,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)
@@ -232,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) : \
@@ -246,59 +175,59 @@ 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: "
+ printf "%sT_SYMBOL%s: ", $color_type, $color_end
print (struct RBasic *)($arg0)
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
@@ -337,6 +266,172 @@ 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
+document rp_class
+ Print the content of a Class/Module.
+end
+
define nd_type
print (enum node_type)((((NODE*)($arg0))->flags&RUBY_NODE_TYPEMASK)>>RUBY_NODE_TYPESHIFT)
end
@@ -361,257 +456,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
@@ -625,18 +720,18 @@ define rb_numtable_entry
set $rb_numtable_key = 0
set $rb_numtable_rec = 0
if $rb_numtable_tbl->entries_packed
- set $rb_numtable_p = $rb_numtable_tbl->bins
- while $rb_numtable_p && $rb_numtable_p < $rb_numtable_tbl->bins+$rb_numtable_tbl->num_entries
- if (st_data_t)$rb_numtable_p[0] == $rb_numtable_id
- set $rb_numtable_key = (st_data_t)$rb_numtable_p[0]
- set $rb_numtable_rec = (st_data_t)$rb_numtable_p[1]
+ set $rb_numtable_p = $rb_numtable_tbl->as.packed.bins
+ while $rb_numtable_p && $rb_numtable_p < $rb_numtable_tbl->as.packed.bins+$rb_numtable_tbl->num_entries
+ if $rb_numtable_p.k == $rb_numtable_id
+ set $rb_numtable_key = $rb_numtable_p.k
+ set $rb_numtable_rec = $rb_numtable_p.v
set $rb_numtable_p = 0
else
- set $rb_numtable_p = $rb_numtable_p + 2
+ set $rb_numtable_p = $rb_numtable_p + 1
end
end
else
- set $rb_numtable_p = $rb_numtable_tbl->bins[$rb_numtable_id % $rb_numtable_tbl->num_bins]
+ set $rb_numtable_p = $rb_numtable_tbl->as.big.bins[$rb_numtable_id % $rb_numtable_tbl->num_bins]
while $rb_numtable_p
if $rb_numtable_p->key == $rb_numtable_id
set $rb_numtable_key = $rb_numtable_p->key
@@ -650,12 +745,8 @@ 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
+ printf "%sID%s: ", $color_type, $color_end
+ rp_id $arg0
end
document rb_id2name
Print the name of id
@@ -684,9 +775,25 @@ 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_class $rb_ancestors_module
+ set $rb_ancestors_module = ((struct RClass *)($rb_ancestors_module))->ptr.super
+ end
+end
+document rb_ancestors
+ Print ancestors.
end
define rb_backtrace
@@ -694,7 +801,7 @@ define rb_backtrace
end
define iseq
- if dummy_gdb_enums.special_consts
+ if ruby_dummy_gdb_enums.special_consts
end
if ($arg0)->type == ISEQ_ELEMENT_NONE
echo [none]\n
@@ -731,8 +838,8 @@ define rb_ps_vm
if $ps_threads->entries_packed
set $ps_threads_i = 0
while $ps_threads_i < $ps_threads->num_entries
- set $ps_threads_key = (st_data_t)$ps_threads->bins[$ps_threads_i * 2]
- set $ps_threads_val = (st_data_t)$ps_threads->bins[$ps_threads_i * 2 + 1]
+ set $ps_threads_key = (st_data_t)$ps_threads->as.packed.entries[$ps_threads_i].key
+ set $ps_threads_val = (st_data_t)$ps_threads->as.packed.entries[$ps_threads_i].val
rb_ps_thread $ps_threads_key $ps_threads_val
set $ps_threads_i = $ps_threads_i + 1
end
@@ -755,3 +862,20 @@ define rb_ps_thread
set $ps_thread_id = $arg1
print $ps_thread_th = (rb_thread_t*)$ps_thread->data
end
+
+# Details: https://bugs.ruby-lang.org/projects/ruby-trunk/wiki/MachineInstructionsTraceWithGDB
+define trace_machine_instructions
+ set logging on
+ set height 0
+ set width 0
+ display/i $pc
+ while !$exit_code
+ info line *$pc
+ si
+ end
+end
+
+define SDR
+ call rb_vmdebug_stack_dump_raw_current()
+end
+
diff --git a/.gitignore b/.gitignore
index 57557c9c2e..9cd98beee1 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,7 +2,9 @@
*.a
*.bak
*.dSYM
+*.dmyh
*.dylib
+*.elc
*.inc
*.log
*.o
@@ -51,11 +53,10 @@ y.tab.c
/configure
/doc/capi
/enc.mk
-/enc/trans/*.c
/encdb.h
/exts.mk
/goruby
-/id.h
+/id.[ch]
/largefile.h
/lex.c
/libruby*.*
@@ -72,6 +73,7 @@ y.tab.c
/ppack
/prelude.c
/preview
+/probes.h
/rbconfig.rb
/rename2.h
/repack
@@ -80,10 +82,12 @@ y.tab.c
/rubicon
/ruby
/ruby-man.rd.gz
+/sizes.c
/test.rb
/tmp
/transdb.h
/uncommon.mk
+/verconf.h
/web
/yasmdata.rb
@@ -96,17 +100,12 @@ y.tab.c
# /ext/
/ext/extinit.c
-# /ext/dl/
-/ext/dl/*.func
-
# /ext/dl/callback/
-/ext/dl/callback/*.func
/ext/dl/callback/callback-*.c
/ext/dl/callback/callback.c
-# /ext/iconv/
-/ext/iconv/config.charset
-/ext/iconv/iconv.rb
+# /ext/rbconfig/
+/ext/rbconfig/sizeof/sizes.c
# /ext/ripper/
/ext/ripper/eventids1.c
@@ -127,5 +126,10 @@ y.tab.c
/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 286342c1cc..8db00587d6 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,8 +1,86 @@
-# no installation...
-before_script: autoconf
-script: "./configure && make all test"
+# Copyright (C) 2011 Urabe, Shyouhei. All rights reserved.
+#
+# This file is a part of the programming language Ruby. Permission is hereby
+# granted, to either redistribute or modify this file, provided that the
+# conditions mentioned in the file COPYING are met. Consult the file for
+# details.
+# This is a Travis-CI build configuration file. The list of configurations
+# available is located in
+#
+# http://about.travis-ci.org/docs/user/build-configuration/
+#
+# and as Ruby itself is a project written in C language,
+#
+# http://about.travis-ci.org/docs/user/languages/c/
+#
+# is also a good place to look at.
+
+# Language specification.
+language: c
+
+# Compilers. Several compilers are provided in Travis, so we try them all.
+# The value set here is visible via $CC environment variable.
+compiler:
+ - gcc
+ - clang
+
+# Dependencies. Some header files are missing in a Travis' worker VM, so we
+# have to install them. The "1.9.1" here is OK. It is the most adopted
+# version string for Debian/Ubuntu, and no dependencies have been changed so
+# far since the 1.9.1 release.
+before_install:
+ - "sudo apt-get -qq update"
+ - "sudo apt-get -qq install $CC" # upgrade if any
+install: "sudo apt-get -qq build-dep ruby1.9.1 2>/dev/null"
+
+# Script is where the test runs. Note we just do "make test", not other tests
+# like test-all, test-rubyspec. This is because they take too much time,
+# enough for Travis to shut down the VM as being stalled.
+before_script:
+ - "make -f common.mk BASERUBY=ruby srcdir=. update-config_files"
+ - "autoconf"
+ - "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"
+# - "make test-all TESTS='-v'"
+
+# Branch matrix. Not all branches are Travis-ready so we limit branches here.
branches:
only:
- trunk
- ruby_1_9_3
+
+# We want to be notified when something happens.
+notifications:
+ irc:
+ channels:
+ - "irc.freenode.org#ruby-core"
+ - "irc.freenode.org#ruby-ja"
+ on_success: change # [always|never|change] # default: always
+ on_failure: change # [always|never|change] # default: always
+ 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
+# indent-tabs-mode: nil
+# tab-width: 4
+# fill-column: 79
+# default-justification: full
+# End:
diff --git a/BSDL b/BSDL
index 82725534fa..a009caefea 100644
--- a/BSDL
+++ b/BSDL
@@ -1,4 +1,4 @@
-Copyright (C) 1993-2010 Yukihiro Matsumoto. All rights reserved.
+Copyright (C) 1993-2013 Yukihiro Matsumoto. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
diff --git a/COPYING.ja b/COPYING.ja
index 5b5b91c149..e50d01c8d1 100644
--- a/COPYING.ja
+++ b/COPYING.ja
@@ -1,51 +1,51 @@
-$BK\%W%m%0%i%`$O%U%j!<%=%U%H%&%'%"$G$9!%(B2-clause BSDL
-$B$^$?$O0J2<$K<($9>r7o$GK\%W%m%0%i%`$r:FG[I[$G$-$^$9(B
-2-clause BSDL$B$K$D$$$F$O(BBSDL$B%U%!%$%k$r;2>H$7$F2<$5$$!%(B
+本プログラムã¯ãƒ•リーソフトウェアã§ã™ï¼Ž2-clause BSDL
+ã¾ãŸã¯ä»¥ä¸‹ã«ç¤ºã™æ¡ä»¶ã§æœ¬ãƒ—ログラムをå†é…布ã§ãã¾ã™
+2-clause BSDLã«ã¤ã„ã¦ã¯BSDLファイルをå‚ç…§ã—ã¦ä¸‹ã•ã„.
- 1. $BJ#@=$O@)8B$J$/<+M3$G$9!%(B
+ 1. 複製ã¯åˆ¶é™ãªã自由ã§ã™ï¼Ž
- 2. $B0J2<$N>r7o$N$$$:$l$+$rK~$?$9;~$KK\%W%m%0%i%`$N%=!<%9$r(B
- $B<+M3$KJQ99$G$-$^$9!%(B
+ 2. ä»¥ä¸‹ã®æ¡ä»¶ã®ã„ãšã‚Œã‹ã‚’満ãŸã™æ™‚ã«æœ¬ãƒ—ログラムã®ã‚½ãƒ¼ã‚¹ã‚’
+ 自由ã«å¤‰æ›´ã§ãã¾ã™ï¼Ž
- (a) $B%M%C%H%K%e!<%:$K%]%9%H$7$?$j!$:n<T$KJQ99$rAwIU$9$k(B
- $B$J$I$NJ}K!$G!$JQ99$r8x3+$9$k!%(B
+ (a) ãƒãƒƒãƒˆãƒ‹ãƒ¥ãƒ¼ã‚ºã«ãƒã‚¹ãƒˆã—ãŸã‚Šï¼Œä½œè€…ã«å¤‰æ›´ã‚’é€ä»˜ã™ã‚‹
+ ãªã©ã®æ–¹æ³•ã§ï¼Œå¤‰æ›´ã‚’公開ã™ã‚‹ï¼Ž
- (b) $BJQ99$7$?K\%W%m%0%i%`$r<+J,$N=jB0$9$kAH?%FbIt$@$1$G(B
- $B;H$&!%(B
+ (b) 変更ã—ãŸæœ¬ãƒ—ãƒ­ã‚°ãƒ©ãƒ ã‚’è‡ªåˆ†ã®æ‰€å±žã™ã‚‹çµ„織内部ã ã‘ã§
+ 使ã†ï¼Ž
- (c) $BJQ99E@$rL@<($7$?$&$(!$%=%U%H%&%'%"$NL>A0$rJQ99$9$k!%(B
- $B$=$N%=%U%H%&%'%"$rG[I[$9$k;~$K$OJQ99A0$NK\%W%m%0%i(B
- $B%`$bF1;~$KG[I[$9$k!%$^$?$OJQ99A0$NK\%W%m%0%i%`$N%=!<(B
- $B%9$NF~<jK!$rL@<($9$k!%(B
+ (c) 変更点を明示ã—ãŸã†ãˆï¼Œã‚½ãƒ•トウェアã®åå‰ã‚’変更ã™ã‚‹ï¼Ž
+ ãã®ã‚½ãƒ•トウェアをé…布ã™ã‚‹æ™‚ã«ã¯å¤‰æ›´å‰ã®æœ¬ãƒ—ログラ
+ ãƒ ã‚‚åŒæ™‚ã«é…布ã™ã‚‹ï¼Žã¾ãŸã¯å¤‰æ›´å‰ã®æœ¬ãƒ—ログラムã®ã‚½ãƒ¼
+ スã®å…¥æ‰‹æ³•を明示ã™ã‚‹ï¼Ž
- (d) $B$=$NB>$NJQ99>r7o$r:n<T$H9g0U$9$k!%(B
+ (d) ãã®ä»–ã®å¤‰æ›´æ¡ä»¶ã‚’作者ã¨åˆæ„ã™ã‚‹ï¼Ž
- 3. $B0J2<$N>r7o$N$$$:$l$+$rK~$?$9;~$KK\%W%m%0%i%`$r%3%s%Q%$(B
- $B%k$7$?%*%V%8%'%/%H%3!<%I$d<B9T7A<0$G$bG[I[$G$-$^$9!%(B
+ 3. ä»¥ä¸‹ã®æ¡ä»¶ã®ã„ãšã‚Œã‹ã‚’満ãŸã™æ™‚ã«æœ¬ãƒ—ログラムをコンパイ
+ ルã—ãŸã‚ªãƒ–ジェクトコードや実行形å¼ã§ã‚‚é…布ã§ãã¾ã™ï¼Ž
- (a) $B%P%$%J%j$r<u$1<h$C$??M$,%=!<%9$rF~<j$G$-$k$h$&$K!$(B
- $B%=!<%9$NF~<jK!$rL@<($9$k!%(B
+ (a) ãƒã‚¤ãƒŠãƒªã‚’å—ã‘å–ã£ãŸäººãŒã‚½ãƒ¼ã‚¹ã‚’入手ã§ãるよã†ã«ï¼Œ
+ ソースã®å…¥æ‰‹æ³•を明示ã™ã‚‹ï¼Ž
- (b) $B5!3#2DFI$J%=!<%9%3!<%I$rE:IU$9$k!%(B
+ (b) 機械å¯èª­ãªã‚½ãƒ¼ã‚¹ã‚³ãƒ¼ãƒ‰ã‚’添付ã™ã‚‹ï¼Ž
- (c) $BJQ99$r9T$C$?%P%$%J%j$OL>A0$rJQ99$7$?$&$(!$%*%j%8%J(B
- $B%k$N%=!<%9%3!<%I$NF~<jK!$rL@<($9$k!%(B
+ (c) 変更を行ã£ãŸãƒã‚¤ãƒŠãƒªã¯åå‰ã‚’変更ã—ãŸã†ãˆï¼Œã‚ªãƒªã‚¸ãƒŠ
+ ルã®ã‚½ãƒ¼ã‚¹ã‚³ãƒ¼ãƒ‰ã®å…¥æ‰‹æ³•を明示ã™ã‚‹ï¼Ž
- (d) $B$=$NB>$NG[I[>r7o$r:n<T$H9g0U$9$k!%(B
+ (d) ãã®ä»–ã®é…布æ¡ä»¶ã‚’作者ã¨åˆæ„ã™ã‚‹ï¼Ž
- 4. $BB>$N%W%m%0%i%`$X$N0zMQ$O$$$+$J$kL\E*$G$"$l<+M3$G$9!%$?(B
- $B$@$7!$K\%W%m%0%i%`$K4^$^$l$kB>$N:n<T$K$h$k%3!<%I$O!$$=(B
- $B$l$>$l$N:n<T$N0U8~$K$h$k@)8B$,2C$($i$l$k>l9g$,$"$j$^$9!%(B
+ 4. ä»–ã®ãƒ—ログラムã¸ã®å¼•用ã¯ã„ã‹ãªã‚‹ç›®çš„ã§ã‚れ自由ã§ã™ï¼ŽãŸ
+ ã ã—,本プログラムã«å«ã¾ã‚Œã‚‹ä»–ã®ä½œè€…ã«ã‚ˆã‚‹ã‚³ãƒ¼ãƒ‰ã¯ï¼Œã
+ れãžã‚Œã®ä½œè€…ã®æ„å‘ã«ã‚ˆã‚‹åˆ¶é™ãŒåŠ ãˆã‚‰ã‚Œã‚‹å ´åˆãŒã‚りã¾ã™ï¼Ž
- $B$=$l$i%U%!%$%k$N0lMw$H$=$l$>$l$NG[I[>r7o$J$I$KIU$$$F$O(B
- LEGAL$B%U%!%$%k$r;2>H$7$F$/$@$5$$!%(B
+ ãれらファイルã®ä¸€è¦§ã¨ãれãžã‚Œã®é…布æ¡ä»¶ãªã©ã«ä»˜ã„ã¦ã¯
+ LEGALファイルをå‚ç…§ã—ã¦ãã ã•ã„.
- 5. $BK\%W%m%0%i%`$X$NF~NO$H$J$k%9%/%j%W%H$*$h$S!$K\%W%m%0%i(B
- $B%`$+$i$N=PNO$N8"Mx$OK\%W%m%0%i%`$N:n<T$G$O$J$/!$$=$l$>(B
- $B$l$NF~=PNO$r@8@.$7$??M$KB0$7$^$9!%$^$?!$K\%W%m%0%i%`$K(B
- $BAH$_9~$^$l$k$?$a$N3HD%%i%$%V%i%j$K$D$$$F$bF1MM$G$9!%(B
+ 5. 本プログラムã¸ã®å…¥åŠ›ã¨ãªã‚‹ã‚¹ã‚¯ãƒªãƒ—トãŠã‚ˆã³ï¼Œæœ¬ãƒ—ログラ
+ ムã‹ã‚‰ã®å‡ºåŠ›ã®æ¨©åˆ©ã¯æœ¬ãƒ—ログラムã®ä½œè€…ã§ã¯ãªã,ãれãž
+ れã®å…¥å‡ºåŠ›ã‚’ç”Ÿæˆã—ãŸäººã«å±žã—ã¾ã™ï¼Žã¾ãŸï¼Œæœ¬ãƒ—ログラムã«
+ 組ã¿è¾¼ã¾ã‚Œã‚‹ãŸã‚ã®æ‹¡å¼µãƒ©ã‚¤ãƒ–ラリã«ã¤ã„ã¦ã‚‚åŒæ§˜ã§ã™ï¼Ž
- 6. $BK\%W%m%0%i%`$OL5J]>Z$G$9!%:n<T$OK\%W%m%0%i%`$r%5%]!<%H(B
- $B$9$k0U;V$O$"$j$^$9$,!$%W%m%0%i%`<+?H$N%P%0$"$k$$$OK\%W(B
- $B%m%0%i%`$N<B9T$J$I$+$iH/@8$9$k$$$+$J$kB;32$KBP$7$F$b@U(B
- $BG$$r;}$A$^$;$s!%(B
+ 6. 本プログラムã¯ç„¡ä¿è¨¼ã§ã™ï¼Žä½œè€…ã¯æœ¬ãƒ—ログラムをサãƒãƒ¼ãƒˆ
+ ã™ã‚‹æ„å¿—ã¯ã‚りã¾ã™ãŒï¼Œãƒ—ログラム自身ã®ãƒã‚°ã‚ã‚‹ã„ã¯æœ¬ãƒ—
+ ログラムã®å®Ÿè¡Œãªã©ã‹ã‚‰ç™ºç”Ÿã™ã‚‹ã„ã‹ãªã‚‹æå®³ã«å¯¾ã—ã¦ã‚‚責
+ 任をæŒã¡ã¾ã›ã‚“.
diff --git a/ChangeLog b/ChangeLog
index 35fe89d9c3..2540307c53 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,17319 +1,16177 @@
-Wed Jun 26 18:28:29 2013 NAKAMURA Usaku <usa@ruby-lang.org>
+Sat Nov 23 03:44:03 2013 Eric Hodel <drbrain@segment7.net>
- * test/ruby/test_m17n.rb: assert_predicate and assert_not_predicate
- is not available on 1.9.3.
+ * lib/rubygems: Update to RubyGems master dcce4ff. Important changes
+ in this commit:
-Wed Jun 26 17:08:13 2013 Kazuki Tsujimoto <kazuki@callcc.net>
+ Remove automatic detection of gem dependencies files. This prevents a
+ security hole as described in [ruby-core:58490]
- * include/ruby/ruby.h, vm_eval.c (rb_funcall_with_block):
- new function to invoke a method with a block passed
- as an argument.
+ Fixed bugs for installing git gems.
- * string.c (sym_call): use the above function to avoid
- a block sharing. [ruby-dev:47438] [Bug #8531]
+ * test/rubygems: ditto.
- * vm_insnhelper.c (vm_yield_with_cfunc): don't set block
- in the frame.
+Fri Nov 22 22:30:00 2013 Kenta Murata <mrkn@mrkn.jp>
- * test/ruby/test_symbol.rb (TestSymbol#test_block_given_to_proc):
- run related tests.
+ * ext/bigdecimal/bigdecimal.c (BigDecimal_power):
+ Round the result value only if the precision is given.
-Wed Jun 26 17:01:22 2013 NAKAMURA Usaku <usa@ruby-lang.org>
+Fri Nov 22 17:20:50 2013 NARUSE, Yui <naruse@ruby-lang.org>
- * benchmark/bm_hash_shift.rb: add benchmark for Hash#shift
+ * transcode.c (str_transcode0): don't scrub invalid chars if
+ str.encode doesn't have explicit invalid: :replace.
+ workaround fix for see #8995
- * hash.c (rb_hash_shift): use st_shift if hash is not being iterated to
- delete element without iterating the whole hash.
+Fri Nov 22 17:11:26 2013 Narihiro Nakamura <authornari@gmail.com>
- * hash.c (shift_i): remove function
+ * include/ruby/intern.h, internal.h: Expose rb_gc_count().
- * include/ruby/st.h (st_shift): add st_shift function
+Fri Nov 22 17:07:00 2013 Kenta Murata <mrkn@mrkn.jp>
- * st.c (st_shift): ditto
+ * ext/bigdecimal/bigdecimal.gemspec: version 1.2.2.
- [Backport #8328] [ruby-core:55250] Patch by funny-falcon
+Fri Nov 22 17:04:00 2013 Kenta Murata <mrkn@mrkn.jp>
-Wed Jun 26 16:52:57 2013 Kazuki Tsujimoto <kazuki@callcc.net>
+ * ext/bigdecimal/bigdecimal.c (BigDecimal_data_type):
+ Use RUBY_TYPED_FREE_IMMEDIATELY only if it is available.
- * test/ruby/test_proc.rb (TestProc#test_block_given_method_to_proc):
- run test for r41359.
+Fri Nov 22 16:49:00 2013 Kenta Murata <mrkn@mrkn.jp>
-Wed Jun 26 16:52:57 2013 Kazuki Tsujimoto <kazuki@callcc.net>
+ * ext/bigdecimal/bigdecimal.c (BigDecimal_power): Round the result value.
+ [Bug #8818] [ruby-core:56802]
- * 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.
+ * test/bigdecimal/test_bigdecimal.rb: Add a test for the above fix.
- * proc.c (bmcall): use the above function to avoid a block sharing.
- [ruby-core:54626] [Bug #8341]
+Fri Nov 22 16:25:43 2013 Koichi Sasada <ko1@atdot.net>
- * test/ruby/test_proc.rb (TestProc#test_block_persist_between_calls):
- run related tests.
+ * gc.c (heap_set_increment): accept minimum additional page number.
-Wed Jun 26 16:36:39 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * gc.c (gc_after_sweep): allocate pages to allocate at least
+ RUBY_HEAP_MIN_SLOTS.
+ [Bug #9137]
- * defs/id.def (predefined): add "idProc".
+Fri Nov 22 16:19:52 2013 Narihiro Nakamura <authornari@gmail.com>
- * proc.c (mnew, mproc, mlambda): use predefined IDs.
+ * include/ruby/intern.h (rb_gc_set_params): Deprecate
+ rb_gc_set_params because it's only used in ruby internal.
- * vm.c (Init_VM): ditto.
+ * internal.h (ruby_gc_set_params): Declare rb_gc_set_params's
+ alias function.
-Wed Jun 26 16:36:39 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * gc.c: ditto.
- * include/ruby/intern.h (rb_block_lambda): add declaration instead of
- deprecated rb_f_lambda.
+ * ruby.c: use ruby_gc_set_params.
-Wed Jun 26 16:31:49 2013 Shugo Maeda <shugo@ruby-lang.org>
+Fri Nov 22 14:55:00 2013 Kenta Murata <mrkn@mrkn.jp>
- * lib/net/imap.rb (capability_response): should ignore trailing
- spaces. Thanks, Peter Kovacs. [ruby-core:55024] [Bug #8415]
+ * ext/bigdecimal/bigdecimal.c (BigMath_s_exp): Insert rb_thread_check_ints.
- * test/net/imap/test_imap_response_parser.rb: related test.
+Fri Nov 22 14:35:00 2013 Kenta Murata <mrkn@mrkn.jp>
-Wed Jun 26 16:29:41 2013 Charlie Somerville <charliesome@ruby-lang.org>
+ * ext/bigdecimal/bigdecimal.c (BigMath_s_exp): Fix the inserting points
+ of RB_GC_GUARDs.
- * intern.h: remove dangling rb_class_init_copy declaration
- [ruby-core:55120] [Bug #8434]
+Fri Nov 22 14:31:00 2013 Kenta Murata <mrkn@mrkn.jp>
-Wed Jun 26 16:22:12 2013 Charlie Somerville <charliesome@ruby-lang.org>
+ * ext/bigdecimal/bigdecimal.c: Fix indentation.
- * class.c (include_modules_at): invalidate method cache if included
- module contains constants
+Fri Nov 22 14:03:00 2013 NARUSE, Yui <naruse@ruby-lang.org>
- * test/ruby/test_module.rb: add test
+ * ext/nkf: merge nkf 2.1.3 2a2f2c5.
-Wed Jun 26 16:13:25 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Fri Nov 22 12:43:52 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]
+ * util.c (ruby_strtod): ignore too long fraction part, which does not
+ affect the result.
-Wed Jun 26 16:10:01 2013 Eric Hodel <drbrain@segment7.net>
+Fri Nov 22 12:17:14 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * ext/socket/extconf.rb: Enable RFC 3542 IPV6 socket options for OS X
- 10.7+. [ruby-trunk - Bug #8517]
+ * ext/openssl/lib/openssl/buffering.rb (OpenSSL::Buffering#initialize):
+ initialize of a module should pass arguments to super.
-Wed Jun 5 12:38:14 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Fri Nov 22 12:02:58 2013 Tanaka Akira <akr@fsij.org>
- * win32/win32.c (setup_overlapped, finish_overlapped): extract from
- rb_w32_read() and rb_w32_write().
+ * test/ruby/test_settracefunc.rb: Ignore events from other threads.
-Wed May 29 21:03:08 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Fri Nov 22 10:35:57 2013 Koichi Sasada <ko1@atdot.net>
- * configure.in (POSTLINK): default to : command to get rid of flag
- only command, since BSD make does not work with it.
+ * vm.c (ruby_vm_destruct): do not use ruby_xfree() after freeing
+ objspace.
-Wed May 29 20:59:38 2013 NAKAMURA Usaku <usa@ruby-lang.org>
+ * gc.c (ruby_mimfree): added. It is similar to ruby_mimmalloc().
- * lib/yaml.rb: documentation updates, patched by zzak.
- [ruby-core:54735] [Backport #8356]
+ * internal.h: ditto.
-Wed May 15 14:04:39 2013 NAKAMURA Usaku <usa@ruby-lang.org>
+Fri Nov 22 09:42:35 2013 Zachary Scott <e@zzak.io>
- * Makefile.in (miniruby): 1.9.3 doesn't have POSTLINK macro.
- reported by Takahiro Kambe at [ruby-list:49362].
+ * test/digest/test_digest.rb: Reverse order of assert_equal
+ Reported by @splattael
-Wed May 15 01:06:26 2013 NAKAMURA Usaku <usa@ruby-lang.org>
+Fri Nov 22 09:03:16 2013 NARUSE, Yui <naruse@ruby-lang.org>
- * include/ruby/intern.h: should include sys/time.h for struct timeval
- if it exists.
+ * gc.c: fix build failure on FreeBSD introduced by r43763.
+ malloc_usable_size() is defined by malloc_np.h on FreeBSD.
-Wed May 15 00:23:07 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * configure.in: check malloc.h and malloc_np.h.
- * configure.in (warnflags): disable -Werror by default unless
- development. [ruby-core:52131] [Bug #7830]
+Fri Nov 22 08:27:13 2013 Eric Hodel <drbrain@segment7.net>
-Wed May 15 00:21:31 2013 NAKAMURA Usaku <usa@ruby-lang.org>
+ * lib/rubygems: Update to RubyGems master 50a8210. Important changes
+ in this commit:
- * signal.c: need to include unistd.h for write(2).
+ 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.
-Tue May 14 20:25:58 2013 CHIKANAGA Tomoyuki <nagachika@ruby-lang.org>
+ * test/rubygems: ditto.
- * 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.
+Thu Nov 21 22:33:59 2013 Koichi Sasada <ko1@atdot.net>
+ * gc.c: RGENGC_CHECK_MODE should be 0.
-Tue May 14 11:36:22 2013 Shugo Maeda <shugo@ruby-lang.org>
+Thu Nov 21 21:40:00 2013 Kenta Murata <mrkn@mrkn.jp>
- * lib/net/imap.rb (getacl_response): parse the mailbox of an ACL
- response correctly. [ruby-core:54365] [Bug #8281]
+ * ext/bigdecimal/bigdecimal.c (VpAlloc): Fix the expr to adjust the size
+ of the digit array.
-Tue May 14 11:24:22 2013 Martin Bosslet <Martin.Bosslet@gmail.com>
+Thu Nov 21 21:36:00 2013 Kenta Murata <mrkn@mrkn.jp>
- * ext/openssl/ossl_ssl.c: Correct shutdown behavior w.r.t GC.
+ * ext/bigdecimal/bigdecimal.c (BigDecimal_sqrt): Fix the precision of
+ the result BigDecimal of sqrt.
+ [Bug #5266] [ruby-dev:44450]
- * test/openssl/test_ssl.rb: Add tests to verify correct behavior.
+ * test/bigdecimal/test_bigdecimal.rb: add tests for the above changes.
- [Bug #8240] Patch provided by Shugo Maeda. Thanks!
+Thu Nov 21 18:49:02 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Tue May 14 11:22:33 2013 Naohisa Goto <ngotogenome@gmail.com>
+ * gc.c (vm_xrealloc, vm_xfree): use malloc_usable_size() to obtain old
+ size if available.
- * configure.in (AC_CHECK_HEADERS): atomic.h for Solaris atomic_ops.
+Thu Nov 21 18:47:29 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * 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/delegate.rb (SimpleDelegator#__getobj__): target object must be set.
-Tue May 14 10:42:23 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * lib/delegate.rb (DelegateClass#__getobj__): ditto.
- * lib/mkmf.rb (MAIN_DOES_NOTHING): ensure symbols for tests to be
- preserved. [ruby-core:53745] [Bug #8169]
+Thu Nov 21 18:28:42 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Tue May 14 10:42:23 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * lib/tempfile.rb (Tempfile#initialize): use class method to get rid
+ of warnings when $VERBOSE.
- * lib/mkmf.rb (MAIN_DOES_NOTHING): force to refer symbols for tests
- to be preserved. [ruby-core:53745] [Bug #8169]
+Thu Nov 21 17:43:29 2013 Koichi Sasada <ko1@atdot.net>
-Tue May 14 10:39:33 2013 NAKAMURA Usaku <usa@ruby-lang.org>
+ * gc.c: rename initial_xxx variables to gc_params.xxx.
+ They are not only used initial values.
- * regexec.c (onig_search): fix problem with optimization of \z.
- [Backport #8210]
- patched by k_takata at [ruby-core:54251].
+ Chikanaga-san: Congratulations on RubyPrize!
-Tue May 14 09:36:14 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Thu Nov 21 17:16:00 2013 Koichi Sasada <ko1@atdot.net>
- * time.c (GetTimeval): check if already initialized instance.
+ * 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)
- * time.c (GetNewTimeval): check if newly created instance.
+ 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)
- * time.c (time_init_0, time_init_1, time_init_copy, time_mload): must
- be newly created instance. [ruby-core:53436] [Bug #8099]
+ * gc.c (initial_malloc_limit): rename to initial_malloc_limit_min.
-Thu Apr 11 11:24:42 2013 Akinori MUSHA <knu@iDaemons.org>
+Thu Nov 21 16:51:34 2013 Zachary Scott <e@zzak.io>
- * lib/ipaddr.rb (IPAddr#in6_addr): Fix a typo with the closing
- parenthesis.
+ * ext/digest/bubblebabble/bubblebabble.c: Teach RDoc digest/bubblebabble
-Thu Apr 11 11:24:42 2013 Akinori MUSHA <knu@iDaemons.org>
+Thu Nov 21 16:50:16 2013 Zachary Scott <e@zzak.io>
- * 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]
+ * test/digest/test_digest.rb: Add more tests for digest/bubblebabble
-Thu Apr 11 11:22:32 2013 Naohisa Goto <ngoto@gen-info.osaka-u.ac.jp>
+Thu Nov 21 16:32:47 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * 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]
+ * lib/delegate.rb (Delegator#method_missing): try private methods defined in
+ Kernel after the target. [Fixes GH-449]
-Thu Apr 11 11:21:25 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Thu Nov 21 16:25:08 2013 Akinori MUSHA <knu@iDaemons.org>
- * parse.y (parser_magic_comment): should pass the proper value.
- [ruby-dev:44984][Bug #5753]
+ * test/uri/test_generic.rb (URI#test_merge): Test uri + URI(path)
+ in addition to uri + path.
-Thu Apr 11 11:18:57 2013 Tadayoshi Funaba <tadf@dotrb.org>
+Thu Nov 21 15:36:08 2013 Zachary Scott <e@zzak.io>
- * ext/date/date_core.c: [ruby-core:52303]
+ * ext/openssl/lib/openssl/buffering.rb: [DOC] Fix HEREDOC comment for
+ OpenSSL::Buffering which breaks overview because of RDoc bug
-Thu Apr 4 16:21:39 2013 NAKAMURA Usaku <usa@ruby-lang.org>
+Thu Nov 21 14:46:57 2013 NAKAMURA Usaku <usa@ruby-lang.org>
- * ext/objspace/objspace.c (count_nodes): fix key for unknown node.
- based on a patch by tmm1 (Aman Gupta) in [ruby-core:53130] [Bug #8014]
+ * 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.
-Thu Apr 4 16:17:14 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * signal.c (check_stack_overflow, CHECK_STACK_OVERFLOW): now defined on
+ Windows, too.
- * 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]
+ * thread_win32.c (ruby_stack_overflowed_p): ditto.
-Thu Apr 4 09:44:10 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Thu Nov 21 14:18:24 2013 Zachary Scott <e@zzak.io>
- * configure.in (DLDFLAGS): use TARGET_ENTRY to specify an entry point
- instead of TARGET which may contain non-identifer characters.
+ * 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
- * lib/mkmf.rb (create_makefile): add TARGET_NAME which is the first
- part consists of only word characters. [ruby-core:46248][Bug #6709]
+Thu Nov 21 14:06:02 2013 Koichi Sasada <ko1@atdot.net>
-Tue Apr 2 13:13:19 2013 Martin Duerst <duerst@it.aoyama.ac.jp>
+ * gc.c (gc_marks_check): do not dump all refs.
- * 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]
+ * gc.c (allrefs_dump_i): fix output format.
-Tue Apr 2 13:13:19 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Thu Nov 21 13:43:07 2013 Koichi Sasada <ko1@atdot.net>
- * transcode.c (str_encode_bang, encoded_dup): if nothing was
- transcoded, just set encoding but leave coderange unchanged as
- forcee_encoding. [ruby-core:43557][Bug #6190]
+ * 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.
-Tue Apr 2 13:07:29 2013 Tanaka Akira <akr@fsij.org>
+ [Before marking: check WB sanity]
+ If there is a non-old object `obj' pointed from old object
+ (`parent') then `parent' or `obj' should be remembered.
- * time.c (num_exact): use to_r method only if to_int method is
- available.
- [ruby-core:53764] [Bug #8173] reported by Hiro Asari.
+ [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.)
-Tue Apr 2 13:01:55 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ [Implementation memo]
+ objspace_allrefs() creates an object graph.
+ The object graph is represented by st_table, key is object (VALUE)
+ and value is referring objects. Referring objects are stored by
+ "struct reflist".
- * configure.in (EXTDLDFLAGS): split options for each extension
- libraries, and unused in ruby.pc. [Bug #6734]
+ * gc.c (init_mark_stack): do not use push_mark_stack_chunk() at init.
+ This pre-allocation causes failure on is_mark_stask_empty()
+ without any pushing.
- * lib/mkmf.rb (MakeMakefile#configuration): add EXTDLDFLAGS.
+Thu Nov 21 13:40:20 2013 Zachary Scott <e@zzak.io>
-Tue Apr 2 12:59:35 2013 NAKAMURA Usaku <usa@ruby-lang.org>
+ * lib/observer.rb: [DOC] Clarify default observer method.
+ By @edward [Fixes GH-450] https://github.com/ruby/ruby/pull/450
- * 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]
+Thu Nov 21 13:32:53 2013 Zachary Scott <e@zzak.io>
-Tue Apr 2 12:56:15 2013 Naohisa Goto <ngotogenome@gmail.com>
+ * 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
- * signal.c (ruby_abort): fix typo in r39354 [Bug #5014]
+Thu Nov 21 10:45:22 2013 Zachary Scott <e@zzak.io>
-Tue Apr 2 12:56:15 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * ext/openssl/lib/openssl/buffering.rb: Remove unused arguments from
+ OpenSSL::Buffering.new [Fixes GH-445]
- * signal.c (check_stack_overflow): extract duplicated code and get rid
- of declaration-after-statement. [Bug #5014]
+Thu Nov 21 10:30:47 2013 Zachary Scott <e@zzak.io>
-Tue Apr 2 12:56:15 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * test/digest/test_digest.rb: Add test for Digest::SHA256.bubblebabble
- * signal.c (sigsegv): avoid to use async signal unsafe functions
- when nested sigsegv is happen.
- [Bug #5014] [ruby-dev:44082]
+Wed Nov 20 20:54:01 2013 Masaya Tarui <tarui@ruby-lang.org>
-Fri Mar 29 13:22:15 2013 NAKAMURA Usaku <usa@ruby-lang.org>
+ * tool/instruction.rb : fix typo.
- * include/ruby/missing.h: fixed merge mistake of r39985.
- [Backport #8080]
+Wed Nov 20 19:45:22 2013 Tanaka Akira <akr@fsij.org>
-Thu Mar 28 19:01:54 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * random.c (rand_init): Make it possible to specify arbitrary array
+ for init_genrand().
- * include/ruby/missing.h: removed __linux__. it's unnecessary.
+Wed Nov 20 17:34:13 2013 Koichi Sasada <ko1@atdot.net>
-Thu Mar 28 19:01:54 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * 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()).
- * 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 Nov 20 11:46:38 2013 NARUSE, Yui <naruse@ruby-lang.org>
-Thu Mar 28 19:01:54 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * 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.
- * include/ruby/missing.h (__syscall): moved to...
- * io.c: here. because __syscall() is only used from io.c.
+Wed Nov 20 01:39:02 2013 Nobuyoshi Nakada <nobu@ruby-lang.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].
+ * lib/rdoc/constant.rb (RDoc::Constant#documented?): workaround for
+ NoMethodError when the original of alias is not found.
-Thu Mar 28 19:01:54 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+Tue Nov 19 23:38:49 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * include/ruby/missing.h (struct timespec): include <sys/time.h>
+ * configure.in (--with-os-version-style): option to transform target
+ OS version string.
-Thu Mar 28 19:01:54 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+Tue Nov 19 21:27:33 2013 Tanaka Akira <akr@fsij.org>
- * configure.in: check struct timeval exist or not.
- * include/ruby/missing.h (struct timeval): check HAVE_STRUCT_TIMEVAL
- properly. and don't include sys/time.h if struct timeval exist.
+ * test/net/http/utils.rb (spawn_server): Specify zero for port to
+ avoid reusing an allocated port.
- * file.c: include sys/time.h explicitly.
- * random.c: ditto.
- * thread_pthread.c: ditto.
- * time.c: ditto.
- * ext/date/date_strftime.c: ditto.
+ * test/net/http/test_http.rb: Don't specify port here.
-Thu Mar 28 18:54:31 2013 NAKAMURA Usaku <usa@ruby-lang.org>
+ * test/net/http/test_https.rb: Ditto.
- * regcomp.c (optimize_node_left, set_optimize_info_from_tree): right
- handling for look behind anchor.
+Tue Nov 19 18:52:10 2013 Koichi Sasada <ko1@atdot.net>
- * regexec.c (onig_search): ditto.
- [Backport #8076]
+ * gc.c (heap_is_swept_object): use heap_page::before_sweep flag.
- this patch is derived from Onigmo base tree.
+Tue Nov 19 18:49:32 2013 Koichi Sasada <ko1@atdot.net>
-Thu Mar 28 18:35:01 2013 Luis Lavena <luislavena@gmail.com>
+ * gc.c (rb_objspace_reachable_objects_from_root): do major marking.
- * 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]
+Tue Nov 19 18:45:40 2013 Koichi Sasada <ko1@atdot.net>
-Thu Mar 28 18:35:01 2013 Luis Lavena <luislavena@gmail.com>
+ * 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.
- * 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.
+ * string.c (rb_fstring): use rb_gc_resurrect.
-Thu Mar 28 18:18:49 2013 Martin Bosslet <Martin.Bosslet@googlemail.com>
+ * internal.h: add decl.
- * 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]
+Tue Nov 19 09:47:02 2013 Eric Hodel <drbrain@segment7.net>
-Thu Mar 28 18:14:41 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * lib/rdoc: Update to RDoc master a1195ce. Changes include:
- * 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.
+ Improved accessibility of the main sidebar navigation.
-Thu Mar 28 18:13:38 2013 NARUSE, Yui <naruse@ruby-lang.org>
+ Fixed handling of regexp options in HTML source highlighting.
- * string.c (str_byte_substr): don't set coderange if it's not known.
- [Bug #7954] [ruby-dev:47108]
+ * test/rdoc: ditto.
-Thu Mar 28 18:12:19 2013 Kouhei Sutou <kou@cozmixng.org>
+Tue Nov 19 09:33:52 2013 Eric Hodel <drbrain@segment7.net>
- * 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]
+ * lib/rubygems: Update to RubyGems master 6a3d9f9. Changes include:
-Thu Mar 21 20:34:52 2013 NAKAMURA Usaku <usa@ruby-lang.org>
+ Compatibly renamed Gem::DependencyResolver to Gem::Resolver.
- * 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.
+ Added support for git gems in gem.deps.rb and Gemfile.
-Thu Mar 21 20:34:52 2013 NAKAMURA Usaku <usa@ruby-lang.org>
+ Fixed resolver bugs.
- * test/win32ole/test_err_in_callback.rb (TestErrInCallBack#setup): use
- relative path to get rid of "too long commandline" error.
+ * test/rubygems: ditto.
-Thu Mar 21 20:34:52 2013 NAKAMURA Usaku <usa@ruby-lang.org>
+ * lib/rubygems/LICENSE.txt: Updated to license from RubyGems trunk.
+ [ruby-trunk - Bug #9086]
- * test/win32ole/test_err_in_callback.rb
- (TestErrInCallBack#test_err_in_callback): shouldn't create a file in
- the top of build directory.
-
-Tue Feb 26 09:53:59 2013 NARUSE, Yui <naruse@ruby-lang.org>
-
- * st.c (st_add_direct): int is not always same with st_index_t. some
- version of clang reports error.
+ * lib/rubygems/commands/which_command.rb: RubyGems now indicates
+ failure when any file is missing. [ruby-trunk - Bug #9004]
- * thread.c (vm_living_thread_num): ditto.
- reported by d6rkaiz (Isao Sugimoto) at [ruby-dev:47096]
- [Backport #7946]
-
-Fri Feb 22 18:36:51 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/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]
- * lib/rexml/text.rb (REXML::Text.unnormalize): check above attribute.
-Fri Feb 22 14:48:15 2013 NARUSE, Yui <naruse@ruby-lang.org>
+Tue Nov 19 07:21:56 2013 Tanaka Akira <akr@fsij.org>
- * vm.c (vm_exec): get rid of a SEGV when calling rb_iter_break() from
- some extention libraries. [Backport #7896] [ruby-core:52607]
+ * configure.in (LOCALTIME_OVERFLOW_PROBLEM): Define it for cross
+ compiling.
+ [ruby-core:58391] [Bug #9119] Reported by Luis Lavena.
+ Analyzed by Heesob Park.
-Fri Feb 22 14:40:57 2013 Narihiro Nakamura <authornari@gmail.com>
+Tue Nov 19 05:55:05 2013 Eric Hodel <drbrain@segment7.net>
- * gc.c : remove a unused function.
+ * lib/rdoc/rubygems_hook.rb: Remove debugging puts committed by
+ accident.
-Fri Feb 22 14:40:57 2013 NARUSE, Yui <naruse@ruby-lang.org>
+Mon Nov 18 22:47:54 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * regparse.c (onig_number_of_names): suppress a warning.
+ * 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]
-Fri Feb 22 14:40:57 2013 NARUSE, Yui <naruse@ruby-lang.org>
+ * vm_eval.c (rb_catch_obj): now th->tag points previous tag until
+ TH_EXEC_TAG().
- * vm_insnhelper.c (vm_call_cfunc): remove useless hack.
+ * thread_pthread.c (ruby_init_stack): set stack_start properly by
+ get_main_stack() if possible.
-Fri Feb 22 14:40:57 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Mon Nov 18 22:45:49 2013 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.
+ * eval_jump.c (rb_exec_end_proc): unlink and free procs data before
+ calling for each procs. [Bug #9110]
-Fri Feb 22 14:28:17 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Sun Nov 17 06:33:32 2013 Shota Fukumori <her@sorah.jp>
- * eval_jump.c (rb_exec_end_proc): remember the latest exit status.
- [ruby-core:43173][Bug #5218]
+ * configure.in: Use $LIBS for base of $SOLIBS, also in darwin.
+ By this fix, environment that libgmp is located in $LIBS can build
+ ruby.
-Fri Feb 22 14:25:57 2013 NARUSE, Yui <naruse@ruby-lang.org>
+Sun Nov 17 01:56:32 2013 Tanaka Akira <akr@fsij.org>
- * ext/readline/readline.c (Init_readline): don't set 0 to
- rl_catch_signals and rl_catch_sigwinch. [Bug #5423]
+ * thread_pthread.c (rb_thread_create_timer_thread): Show error
+ message instead of error number.
+ (thread_create_core): Ditto.
-Wed Feb 13 16:18:22 2013 NAKAMURA Usaku <usa@ruby-lang.org>
+ * cont.c (fiber_machine_stack_alloc): Ditto.
- * ext/json: Import JSON 1.5.5.
+Sat Nov 16 18:28:08 2013 Kouhei Sutou <kou@cozmixng.org>
-Wed Feb 6 17:39:19 2013 Eric Hodel <drbrain@segment7.net>
+ * lib/rexml/parsers/ultralightparser.rb
+ (REXML::Parsers::UltraLightParser#parse): Fix wrong :start_doctype
+ position.
+ [Bug #9061] [ruby-dev:47778]
+ Patch by Ippei Obayashi. Thanks!!!
- * lib/rdoc: Import RDoc 3.9.5.
+ * test/rexml/parser/test_ultra_light.rb: Add a test for this case.
-Wed Feb 6 14:27:25 2013 Shugo Maeda <shugo@ruby-lang.org>
+Sat Nov 16 02:13:56 2013 Masaya Tarui <tarui@ruby-lang.org>
- * ext/socket/raddrinfo.c (rsock_unix_sockaddr_len): return
- sizeof(sa_familiy_t) if path is empty. see "Autobind Feature" in
- unix(7) for details.
+ * cont.c : Introduce ensure rollback mechanism. Please see below.
- * ext/socket/lib/socket.rb (unix_socket_abstract_name?): treat an
- empty path as an abstract name.
+ * internal.h (ruby_register_rollback_func_for_ensure): catch up above change.
+ Add rollback mechanism API.
- * test/socket/test_unix.rb: related test.
+ * vm_core.h (typedef struct rb_vm_struct): catch up above change.
+ Introduce ensure-rollback relation table.
- * ext/socket/unixsocket.c (rsock_init_unixsock): use rb_inspect()
- because rb_sys_fail_str() fails if its argument contains NUL.
+ * vm_core.h (typedef struct rb_thread_struct): catch up above change.
+ Introduce ensure stack.
- * test/socket/test_unix.rb: related test.
+ * eval.c (rb_ensure): catch up above change.
+ Introduce ensure stack.
- * ext/socket/socket.c (sock_s_pack_sockaddr_un): calculate the
- correct address length of an abstract socket.
+ * hash.c : New function for rollback ensure, and register it to
+ ensure-rollback relation table. [ruby-dev:47803] [Bug #9105]
- * test/socket/test_unix.rb: related test.
+ 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.
- * 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.
+ Current API is unstable, and only internal use.
- * 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.
+ 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.
- * 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.
+Sat Nov 16 00:18:36 2013 Masaki Matsushita <glass.saga@gmail.com>
- * test/socket/test_unix.rb: related test.
+ * eval_jump.c (rb_exec_end_proc): fix double free or corruption error
+ when reentering by callcc. [ruby-core:58329] [Bug #9110]
- * 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
+ * test/ruby/test_beginendblock.rb: test for above.
- * 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.
+Fri Nov 15 01:06:04 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * 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/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]
- * ext/socket/unixsocket.c (rsock_init_unixsock): support the longest
- path in sockaddr_un.
+ * test/objspace/test_objspace.rb (TestObjSpace#dump_my_heap_please):
+ remove temporary output file.
- * ext/socket/rubysocket.h (rsock_unixpath_str): declared.
- (rsock_unixpath): removed.
+Thu Nov 14 23:39:00 2013 CHIKANAGA Tomoyuki <nagachika@ruby-lang.org>
- * test/socket/test_unix.rb: comment out test_nul because abstract unix
- sockets may contain NULs.
+ * ext/bigdecimal/lib/bigdecimal/util.rb: [DOC] remove example of
+ Rational#to_d without argument. [Bug #8958]
-Wed Feb 6 14:20:12 2013 Tanaka Akira <akr@fsij.org>
+Thu Nov 14 20:24:15 2013 Naohisa Goto <ngotogenome@gmail.com>
- * ext/socket/basicsocket.c (bsock_getsockname): ignore truncated
- part of socket address.
- (bsock_getpeername): ditto.
- (bsock_local_address): ditto.
- (bsock_remote_address): ditto.
+ * ruby_atomic.h (ATOMIC_SIZE_CAS): fix compile error on Solaris
+ since r43460.
- * ext/socket/unixsocket.c (unix_path): ditto.
- (unix_addr): ditto.
- (unix_peeraddr): ditto.
+Thu Nov 14 19:53:00 2013 Tanaka Akira <akr@fsij.org>
- * ext/socket/init.c (cloexec_accept): ditto.
+ * 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.
-Wed Feb 6 14:19:07 2013 Kouhei Sutou <kou@cozmixng.org>
+Thu Nov 14 11:33:47 2013 Nobuyoshi Nakada <nobu@ruby-lang.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!!!
+ * hash.c (foreach_safe_i, hash_foreach_iter): deal with error detected
+ by ST_CHECK.
-Wed Feb 6 14:14:38 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * st.c (st_foreach_check): call with non-error argument in normal case.
- * file.c (realpath_rec): prevent link from GC while link_names refers
- the content.
+Thu Nov 14 02:37:14 2013 Zachary Scott <e@zzak.io>
-Wed Feb 6 14:13:25 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * ext/thread/thread.c: [DOC] This patch accomplishes the following:
- * missing/setproctitle.c (environ): use (*_NSGetEnviron()) instead of
- environ on Darwin for namespace cleanness, same as [ruby-core:00537].
- [ruby-core:45615] [Bug #6576]
+ - 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]
-Wed Feb 6 14:05:09 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Thu Nov 14 01:11:54 2013 Zachary Scott <e@zzak.io>
- * dir.c (glob_make_pattern): names under recursive need to be single
- basenames to match for each name. [ruby-core:47418] [Bug #6977]
+ * ext/bigdecimal/lib/bigdecimal/util.rb: [DOC] +precision+ is required
-Tue Jan 15 16:30:29 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+Wed Nov 13 19:21:36 2013 Zachary Scott <e@zzak.io>
- * thread_pthread.c (gvl_init): Reset gvl.wait_yield explicitly when
- fork()ing. Patch by Apollon Oikonomopoulos. Thanks!
- [Bug #7693][ruby-core:51424]
+ * ext/bigdecimal/lib/bigdecimal/util.rb: [DOC] Document the required
+ +precision+ argument for Rational#to_d [Bug #8958]
-Tue Jan 15 16:25:35 2013 Narihiro Nakamura <authornari@gmail.com>
+Wed Nov 13 19:02:05 2013 Zachary Scott <e@zzak.io>
- * 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]
+ * 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.
- * test/ruby/test_gc.rb (test_finalizing_main_thread): add a test
- for above.
+ Patched by @stomar [Bug #9027]
-Tue Jan 15 16:23:30 2013 NARUSE, Yui <naruse@ruby-lang.org>
+Wed Nov 13 18:32:12 2013 Zachary Scott <e@zzak.io>
- * lib/net/protocol.rb (Net::InternetMessageIO#each_crlf_line):
- treat \r as newline as mame pointed. [ruby-dev:46425] [Bug #7278]
+ * ext/openssl/ossl_config.c: [DOC] Document the following:
-Tue Jan 15 16:23:30 2013 NARUSE, Yui <naruse@ruby-lang.org>
+ - OpenSSL::ConfigError
+ - OpenSSL::Config::DEFAULT_CONFIG_FILE
- * lib/net/protocol.rb (Net::InternetMessageIO#each_crlf_line):
- don't use /n in universal regexp. [ruby-dev:46394] [Bug #7278]
+ Patched by @vbatts via GH-436
+ https://github.com/ruby/ruby/pull/436
-Tue Jan 15 16:13:47 2013 Kenta Murata <mrkn@mrkn.jp>
+Wed Nov 13 18:03:00 2013 Zachary Scott <e@zzak.io>
- * ext/bigdecimal/bigdecimal.c (BigDecimal_to_s): use CRuby style.
+ * 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.
-Tue Jan 15 16:13:47 2013 Kenta Murata <mrkn@mrkn.jp>
+ Based on a patch by @vbatts via GH-436
+ https://github.com/ruby/ruby/pull/436
- * ext/bigdecimal/bigdecimal.c: use `RB_TYPE_P(x, t)` instead of
- `TYPE(x) == t`.
+Wed Nov 13 17:19:36 2013 Zachary Scott <e@zzak.io>
-Tue Jan 15 16:13:47 2013 Kenta Murata <mrkn@mrkn.jp>
+ * ext/openssl/lib/openssl/config.rb: In #parse use +string+ for +str+
- * ext/bigdecimal/bigdecimal.c (BigDecimal_sub):
- need to specify precision for converting Rational and Float.
- [ruby-dev:46544] [Bug #7404]
+Wed Nov 13 17:09:45 2013 Zachary Scott <e@zzak.io>
- * ext/bigdecimal/bigdecimal.c (BigDecimal_mult): ditto.
+ * ext/openssl/lib/openssl/*.rb: [DOC] Document the following:
- * ext/bigdecimal/bigdecimal.c (BigDecimal_divide): ditto.
+ - Integer#to_bn
+ - OpenSSL::Buffering module
+ - Deprecated OpenSSL::Digest::Digest compatibility class
+ - OpenSSL::Config
- * ext/bigdecimal/bigdecimal.c (BigDecimal_DoDivmod): ditto.
+ These changes were based on a patch by @vbatts via GH-436
+ https://github.com/ruby/ruby/pull/436
- * ext/bigdecimal/bigdecimal.c (BigDecimal_divremain): ditto.
+Wed Nov 13 10:55:43 2013 Zachary Scott <e@zzak.io>
- * test/bigdecimal/test_bigdecimal.rb: add tests for the above fixes.
+ * doc/regexp.rdoc: [DOC] Fix typo in Special global variables section.
+ Reported by Alex Johnson on ruby-doc.org
-Tue Jan 15 16:03:30 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Wed Nov 13 10:43:19 2013 Zachary Scott <e@zzak.io>
- * 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]
+ * hash.c: [DOC] Adds an example for Hash#store
-Tue Jan 15 15:55:09 2013 Eric Hodel <drbrain@segment7.net>
+Wed Nov 13 09:03:40 2013 Zachary Scott <e@zzak.io>
- * object.c (Init_Object): Added RDoc location pointers for
- Kernel#methods, Kernel#protected_methods, Kernel#private_methods and
- Kernel#public_methods. [Bug #6666]
+ * doc/regexp.rdoc: [DOC] add note about Bug #4044 as suggested by
+ duerst-san in [ruby-core:43612] [Fixes GH-443] Patched by @rosenfeld
+ https://github.com/ruby/ruby/pull/443
-Fri Jan 11 17:12:44 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Tue Nov 12 10:15:14 2013 Eric Hodel <drbrain@segment7.net>
- * 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]
+ * test/rubygems/insure_session.rb: Remove unused test file.
-Fri Jan 11 17:11:26 2013 NARUSE, Yui <naruse@ruby-lang.org>
+Tue Nov 12 09:16:24 2013 Eric Hodel <drbrain@segment7.net>
- * lib/mkmf.rb: add dummy clean-static target to prevent errors for the
- case real clean-static target doesn't exist.
+ * lib/rubygems: Update to RubyGems master b9213d7. Changes include:
-Fri Jan 11 17:02:59 2013 Koichi Sasada <ko1@atdot.net>
+ Fixed tests on Windows (I hope) by forcing platform for
+ platform-dependent tests.
- * vm_exec.h (GENTRY): GENTRY should be pointer size.
- A patch by yoshidam (Yoshida Masato) [Bug #7332].
+ Fixed File.exists? warnings.
-Fri Jan 11 16:57:31 2013 NAKAMURA Usaku <usa@ruby-lang.org>
+ Improved testing infrastructure.
- * vm_trace.c (rb_threadptr_exec_event_hooks): added a parameter to pop
- a frame before JUMP_TAG() if exception occurred. This change fix bug
- of Ruby 1.9. [ruby-core:51128] [ruby-trunk - Bug #7624]
+ * test/rubygems: ditto.
- * vm_core.h (EXEC_EVENT_HOOK_AND_POP_FRAME): add to use
- `rb_threadptr_exec_event_hooks()' with the pop flag.
+ * test/rdoc/test_rdoc_rubygems_hook.rb: Switch to util_spec like
+ RubyGems.
- * vm.c (vm_exec): use EXEC_EVENT_HOOK_AND_POP_FRAME() while exception
- handling. While exception hadnling, if an exception is raised in
- hooks, need to pop current frame and raise this raised exception by
- hook.
+Mon Nov 11 18:31:12 2013 Aman Gupta <ruby@tmm1.net>
- * bootstraptest/test_flow.rb: add a test.
+ * 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 Jan 7 15:50:25 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Mon Nov 11 04:36:14 2013 Eric Hodel <drbrain@segment7.net>
- * 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]
+ * 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.
-Tue Dec 25 23:35:09 2012 NARUSE, Yui <naruse@ruby-lang.org>
+Mon Nov 11 03:15:56 2013 Koichi Sasada <ko1@atdot.net>
- * lib/mkmf.rb: fix for if config["libdir"] is nil.
+ * 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.
-Tue Dec 25 20:40:47 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+Mon Nov 11 02:51:17 2013 Eric Hodel <drbrain@segment7.net>
- * bignum.c, include/ruby/intern.h (rb_big_eql): exported.
+ * lib/rubygems: Update to RubyGems master 4bdc4f2. Important changes
+ in this commit:
- * 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]
+ RubyGems now chooses the test server port reliably. Patch by akr.
-Tue Dec 25 09:54:31 2012 Hiroshi Shirosaki <h.shirosaki@gmail.com>
+ Partial implementation of bundler's Gemfile format.
- * gc.c (obj_id_to_ref): add a macro to treat Bignum object id.
- This follows the change r38493.
+ Refactorings to improve the new resolver.
- * gc.c (id2ref): fix for working fine with Bignum object id on x64
- Windows.
- * gc.c (wmap_finalize): ditto.
+ Fixes bugs in the resolver.
-Sat Dec 22 00:33:28 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+ * test/rubygems: Tests for the above.
- * 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]
+Mon Nov 11 01:02:06 2013 Zachary Scott <e@zzak.io>
-Sat Dec 22 00:33:28 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+ * 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
- * gc.c (nonspecial_obj_id): VALUE is not compatible with Fixnum on
- LLP64 platform, such as 64bit Windows.
- reporeted by Heesob Park at [ruby-core:50255] [Bug #7454], and the
- fix is suggested by akr.
+Sun Nov 10 23:47:05 2013 Kazuki Tsujimoto <kazuki@callcc.net>
-Fri Dec 21 16:03:54 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+ * gc.c (rb_gcdebug_print_obj_condition): catch up recent changes
+ to compile on GC_DEBUG.
- * test/ruby/test_argf.rb (TestArgf#test_chars): since marshal data is
- binary, shouldn't pass via text mode. use base64 encoded data.
+Sun Nov 10 22:16:19 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-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
+ * error.c (exc_cause): captured previous exception.
+ * eval.c (make_exception): capture previous exception automagically.
+ [Feature #8257]
-Thu Dec 20 18:46:17 2012 Naohisa Goto <ngotogenome@gmail.com>
+Sun Nov 10 08:37:20 2013 Zachary Scott <e@zzak.io>
- * 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.
+ * thread.c: [DOC] Remove duplicate reference
-Thu Dec 20 18:46:17 2012 Naohisa Goto <ngotogenome@gmail.com>
+Sun Nov 10 08:09:29 2013 Zachary Scott <e@zzak.io>
- * 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.
+ * lib/drb/drb.rb: [DOC] promote better windows-safe filename regular
+ expression in DRb Logger example. Reported by Chris Pheonix
+ [Bug #9074]
-Thu Dec 20 18:46:17 2012 Naohisa Goto <ngotogenome@gmail.com>
+Sun Nov 10 08:03:05 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * 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 shoud not be ignored.
- [ruby-core:50562] [Bug #7514]
+ * gc.c (rb_define_finalizer, rb_undefine_finalizer): rename and export
+ finalizer functions.
- * ext/dl/lib/dl/import.rb (DL::Importer#bind_function): should respect
- abi and name when Fiddle is used.
+Sun Nov 10 07:41:22 2013 Zachary Scott <e@zzak.io>
- * test/dl/test_func.rb (test_name_with_block): test for "name" method
- with giving a block.
+ * lib/weakref.rb: [DOC] fix typos by @xaviershay [Fixes GH-439]
+ https://github.com/ruby/ruby/pull/439
-Thu Dec 20 18:43:00 2012 Naohisa Goto <ngotogenome@gmail.com>
+Sun Nov 10 06:14:39 2013 Charlie Somerville <charliesome@ruby-lang.org>
- * 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]
+ * compile.c (iseq_compile_each): emit opt_str_freeze if the #freeze
+ method is called on a static string literal with no arguments.
-Thu Dec 20 18:40:25 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * defs/id.def (firstline): add freeze so idFreeze is available
- * thread.c (exec_event_hooks): exceptions in event hooks should not
- propagate outside.
+ * 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
-Thu Dec 20 18:37:45 2012 NARUSE, Yui <naruse@ruby-lang.org>
+ * string.c (Init_String): define String#freeze
- * 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]
+ * vm.c (vm_init_redefined_flag): define BOP_FREEZE on String class as
+ a basic operation
-Thu Dec 20 18:37:45 2012 NARUSE, Yui <naruse@ruby-lang.org>
+ * vm_insnhelper.h: ditto
- * string.c (rb_str_crypt): crypt(3) may return NULL.
- Latest glibc (2.16?) crypt(3) actually returns NULL. [Bug #7312]
+ [Feature #8992] [ruby-core:57705]
-Thu Dec 20 18:36:19 2012 Naohisa Goto <ngotogenome@gmail.com>
+Sun Nov 10 01:34:14 2013 Koichi Sasada <ko1@atdot.net>
- * 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]
+ * gc.c (vm_malloc_increase): sweep immediately on GC due to malloc().
+ To reduce memory usage, sweep as soon as possible.
+ This behavior is same as Ruby 2.0.0 and before.
- * test/dl/test_func.rb (test_bind): test for the above
+Sun Nov 10 00:39:26 2013 Koichi Sasada <ko1@atdot.net>
-Thu Dec 20 18:35:36 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * benchmark/gc/gcbench.rb: output version description and GC::OPTS.
- * gc.h (SET_MACHINE_STACK_END): add volatile for preventing
- harmful optimization. [ruby-dev:46665] [Bug #7468]
+Sun Nov 10 00:36:42 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Thu Dec 20 18:34:38 2012 Hiroshi Shirosaki <h.shirosaki@gmail.com>
+ * gc.c (should_be_callable): allow private call since rb_eval_cmd
+ calls even private methods.
- * 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]
+Sun Nov 10 00:33:17 2013 Zachary Scott <e@zzak.io>
-Wed Dec 19 21:24:40 2012 NARUSE, Yui <naruse@ruby-lang.org>
+ * lib/racc/rdoc/grammar.en.rdoc: [DOC] fix typo by Tsuyoshi Sawada
+ [Bug #9077]
- * io.c (argf_each_codepoint): add missing ARGF#codepoints [Bug #7438]
+Sat Nov 9 22:35:35 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Wed Dec 19 21:20:23 2012 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].
- * file.c (file_expand_path): use wcscasecmp().
+Sat Nov 9 20:56:12 2013 Narihiro Nakamura <authornari@gmail.com>
-Wed Dec 19 21:15:29 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * ext/objspace/object_tracing.c: use declarations in internal.h.
- * parse.y (parser_yylex): fix false usage of local variable, it cannot
- appear in fname state [ruby-core:49659] [Bug #7408]
+ * ext/objspace/objspace.c: ditto
-Wed Dec 19 21:14:28 2012 Narihiro Nakamura <authornari@gmail.com>
+Sat Nov 9 20:32:59 2013 Tanaka Akira <akr@fsij.org>
- * gc.c: return true or false. Patch by Dirkjan Bussink. [Bug #6821]
+ * 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.
- * test/ruby/test_gc.rb: add test-case for this bug.
+Sat Nov 9 15:00:16 2013 Zachary Scott <e@zzak.io>
-Wed Dec 19 21:12:49 2012 Shugo Maeda <shugo@ruby-lang.org>
+ * io.c: [DOC] ARGF.gets may return nil [Bug #9029] patch by znz
- * 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]
+Sat Nov 9 14:54:52 2013 Zachary Scott <e@zzak.io>
- * test/ruby/test_marshal.rb: related test.
+ * lib/rss/*: [DOC] document various constants @steveklabnik [Bug #8812]
-Tue Dec 11 19:19:33 2012 Luis Lavena <luislavena@gmail.com>
+Sat Nov 9 14:50:09 2013 Zachary Scott <e@zzak.io>
- * 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]
+ * lib/rss/rss.rb: [DOC] document Time#w3cdtf by @steveklabnik
+ [Bug #8821]
-Sat Nov 17 21:45:12 Luis Lavena <luislavena@gmail.com>
+Sat Nov 9 14:29:04 2013 Zachary Scott <e@zzak.io>
- * win32/file.c (replace_to_long_name): skip expansion for all wildcard
- characters.
- [ruby-core:49451] [Bug #7374]
+ * ext/dl/cfunc.c: [DOC] fix typo in example [Bug #8944]
+ Patched by Heesob Park
- * test/ruby/test_file_exhaustive.rb: add more assertions to test.
+Sat Nov 9 13:59:58 2013 Zachary Scott <e@zzak.io>
-Tue Dec 11 19:19:33 2012 Luis Lavena <luislavena@gmail.com>
+ * lib/test/unit/assertions.rb: [DOC] better example for assert_send()
+ Patch by Andrew Grimm [Bug #8975]
- * win32/file.c (replace_to_long_name): skip automatic path expansion
- when wildcard character is used. [ruby-core:49451] [Bug #7374]
+Sat Nov 9 12:45:00 2013 Charlie Somerville <charliesome@ruby-lang.org>
- * test/ruby/test_file_exhaustive.rb: add a test for above.
+ * 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.
-Tue Dec 11 19:18:12 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+ * insns.def: ditto
+ * vm_core.h: ditto
+ * vm_insnhelper.c: ditto
- * win32/mkexports.rb (each_export): skip garbages generated by VS2012's
- nmake.
- reported and patched by Yoshida Masato at [Bug #7333] [ruby-dev:46484]
+Sat Nov 9 12:31:00 2013 Charlie Somerville <charliesome@ruby-lang.org>
-Tue Dec 11 19:15:51 2012 Nobuyoshi Nakada <nobu@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.
- * parse.y (parser_here_document): flush string content between new
- line and :string_embexpr. [ruby-core:48703] [Bug #7255]
+ * 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
-Tue Dec 11 17:53:55 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Sat Nov 9 09:22:29 2013 Masaya Tarui <tarui@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]
+ * gc.c (gc_page_sweep, rgengc_rememberset_mark): Refactoring.
+ Get bitmaps directly.
- * vm_insnhelper.c (lep_svar_get, lep_svar_set, vm_getspecial): store
- flip-flop states in an array instead of a hash.
+Sat Nov 9 09:16:36 2013 Masaya Tarui <tarui@ruby-lang.org>
- * iseq.c (set_relation): main iseq also can has local scope.
+ * gc.c (RVALUE_PROMOTE_INFANT): Refactoring. Remove duplicated nonsense
+ code.
-Tue Dec 11 17:52:30 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Sat Nov 9 09:04:48 2013 Masaya Tarui <tarui@ruby-lang.org>
- * include/ruby/backward/rubysig.h: fix visibility. [Bug #6607]
+ * gc.c (gc_marks_test): Bugfix. Fix a struct member name for build
+ with RGENGC_CHECK_MODE.
-Tue Dec 11 17:49:45 2012 Koichi Sasada <ko1@atdot.net>
+Sat Nov 9 08:58:23 2013 Masaya Tarui <tarui@ruby-lang.org>
- * vm.c (rb_vm_make_env_object): make Proc object if Env is possible
- to point block. [ruby-core:41038] [ruby-trunk - Bug #5634]
+ * 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.
- * vm.c (rb_vm_make_proc): No need to make Proc object here.
+Sat Nov 9 07:41:41 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * bootstraptest/test_proc.rb: add tests.
+ * internal.h (rb_vm_backtrace_object, rb_gc_count): make prototype
+ declarations, not old-K&R style.
-Tue Dec 11 17:47:01 2012 Narihiro Nakamura <authornari@gmail.com>
+Sat Nov 9 06:11:14 2013 vo.x (Vit Ondruch) <vondruch@redhat.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]
+ * 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].
-Thu Nov 15 15:17:11 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Sat Nov 9 01:59:18 2013 Aman Gupta <ruby@tmm1.net>
- * gc.c (free_method_entry_i): method entry may be in
- unlinked_method_entry_list. [ruby-core:43383][Bug #6171]
+ * 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.
-Wed Nov 14 20:20:46 2012 Naohisa Goto <ngotogenome@gmail.com>
+Sat Nov 9 00:26:50 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * ruby_atomic.h: renamed from atomic.h to avoid header file name
- conflict on Solaris 10. [ruby-dev:46414] [Bug #7287]
+ * 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].
- * gc.c, signal.c, vm_core.h, common.mk: reflect the rename from
- atomic.h to ruby_atomic.h.
+Fri Nov 8 18:35:31 2013 Masaki Matsushita <glass.saga@gmail.com>
-Tue Nov 13 18:13:10 2012 Narihiro Nakamura <authornari@gmail.com>
+ * lib/open3.rb: receive arguments as keyword arguments.
- * 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]
+Fri Nov 8 13:19:26 2013 Masaki Matsushita <glass.saga@gmail.com>
- * configure.in (GC_MARK_STACKFRAME_WORD): removed. It's used by
- checking stack overflow of marking.
+ * io.c (rb_io_open_with_args): use RARRAY_CONST_PTR().
- * win32/Makefile.sub (GC_MARK_STACKFRAME_WORD): ditto.
+ * io.c (rb_scan_open_args): use const qualifier for above.
- * gc.c (free_stack_chunks): it is used only when per-VM object space
- is enabled.
+ * io.c (rb_open_file): ditto.
- * gc.c (rb_objspace_call_finalizer): mark self-referencing finalizers
- before run finalizers, to fix SEGV from btest on 32bit.
+ * io.c (rb_io_open_with_args): ditto.
- * gc.c (gc_mark_stacked_objects): extract from gc_marks().
+Fri Nov 8 11:35:06 2013 Masaki Matsushita <glass.saga@gmail.com>
- * gc.c (rb_objspace_call_finalizer): call gc_mark_stacked_objects
- at suitable point.
+ * dir.c, pack.c, ruby.c, struct.c, vm_eval.c: use RARRAY_CONST_PTR().
- * 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]
+Fri Nov 8 10:58:02 2013 Masaki Matsushita <glass.saga@gmail.com>
-Sat Nov 10 01:25:52 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * compile.c (iseq_build_from_ary_exception): use RARRAY_CONST_PTR().
- * file.c (append_fspath): no need to do encoding trick here.
+ * compile.c (iseq_build_from_ary_body): ditto.
-Sat Nov 10 00:37:02 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+Fri Nov 8 10:49:34 2013 Masaki Matsushita <glass.saga@gmail.com>
- * siphash.h: check configure macros before include newer headers.
+ * enumerator.c (append_method): use RARRAY_CONST_PTR().
-Sat Nov 10 00:37:02 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * enumerator.c (lazy_init_iterator): ditto.
- * siphash.c (sip_init_state): use union to suppress warnings by gcc
- 4.7.
+Fri Nov 8 02:44:29 2013 Koichi Sasada <ko1@atdot.net>
-Sat Nov 10 00:37:02 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * 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]
- * random.c (rb_memhash): use siphash.
+ This workaround introduces possibility to set malloc_limit as
+ wrong value (*1). However, this may be rare case. So I commit it.
-Fri Nov 9 16:17:09 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ *1: Without rest_sweep() here, gc_rest_sweep() can decrease
+ malloc_increase due to ruby_sized_xfree().
- * file.c (append_fspath): revert a part of r37562.
+Fri Nov 8 02:50:25 2013 Zachary Scott <e@zzak.io>
- * file.c (rb_file_expand_path_internal): ditto.
+ * lib/securerandom.rb: [DOC] specify arguments passed to ::random_bytes
+ By @chastell [Fixes GH-412] https://github.com/ruby/ruby/pull/412
- * file.c (rb_file_expand_path_internal): ignore the encoding of the
- given path name and use filesystem encoding, except when the result
- is 8bit range and the filesystem encoding is US-ASCII.
- [ruby-dev:39393] [Bug #2154]
+Fri Nov 8 02:43:01 2013 Zachary Scott <e@zzak.io>
-Fri Nov 9 16:15:50 2012 CHIKANAGA Tomoyuki <nagachika@ruby-lang.org>
+ * ext/objspace/object_tracing.c: [DOC] trace_object_allocations_stop
+ By @srawlins [Fixes GH-421] https://github.com/ruby/ruby/pull/421
- * test/csv/test_features.rb: add require for Tempfile.
- * test/csv/test_serialization.rb: ditto.
+Fri Nov 8 02:34:20 2013 Zachary Scott <e@zzak.io>
-Fri Nov 9 13:47:45 2012 Luis Lavena <luislavena@gmail.com>
+ * 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
- * 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]
+Fri Nov 8 02:14:37 2013 Zachary Scott <e@zzak.io>
-Fri Nov 9 13:16:16 2012 Kenta Murata <mrkn@mrkn.jp>
+ * array.c: [DOC] Add note about negative indices in Array overview
+ By @ckaenzig [Fixes GH-427] https://github.com/ruby/ruby/pull/427
- * bignum.c (bigmul0): enable big_mul_toom3.
- [ruby-core:48552] [Bug #7242]
+Fri Nov 8 02:09:12 2013 Zachary Scott <e@zzak.io>
- * bignum.c (bigmul1_toom3): fix incorrect calculation.
- the patch is made by Heesob Park.
- [ruby-core:48552] [Bug #7242]
+ * 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 9 13:16:16 2012 Kenta Murata <mrkn@mrkn.jp>
+Fri Nov 8 01:01:54 2013 Zachary Scott <e@zzak.io>
- * bignum.c (bigmul0): disable big_mul_toom3 temporalily.
- [ruby-core:48552] [Bug #7242]
+ * golf_prelude.rb: syntax formatting for whitespace [Fixes GH-425]
+ Patch by @edward https://github.com/ruby/ruby/pull/425
- * test/ruby/test_bignum.rb (test_mul_large_numbers):
- add a test for bigmul1_toom3 suggested in [Bug #7242].
+Thu Nov 7 19:36:09 2013 Koichi Sasada <ko1@atdot.net>
-Thu Nov 8 17:37:54 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * gc.c: modify malloc_limit strategy.
- * file.c (append_fspath): filesystem encoding is prior to the encoding
- of argument.
+ * fix default values:
+ GC_MALLOC_LIMIT_GROWTH_FACTOR
+ GC_MALLOC_LIMIT: 8MB -> 16MB
+ GC_MALLOC_LIMIT_MAX: 384MB -> 32MB
- * file.c (rb_file_expand_path_internal, EXPAND_PATH_BUFFER): ignore
- the encoding of the given path name, use filesystem encoding always
- instead. [ruby-dev:39393] [Bug #2154]
+ * 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.
- * test/ruby/test_file_exhaustive.rb: removed 2.0 spec tests.
+Thu Nov 7 11:06:05 2013 Masaki Matsushita <glass.saga@gmail.com>
-Thu Nov 8 17:33:53 2012 Luis Lavena <luislavena@gmail.com>
+ * array.c (rb_ary_shuffle_bang): use RARRAY_PTR_USE() without WB
+ because there are not new relations.
- * ext/zlib/extconf.rb: Recognize zlibwapi as linking library.
- Patch by Daniel Berger.
+Thu Nov 7 10:34:12 2013 Masaki Matsushita <glass.saga@gmail.com>
- [ruby-core:44979] [Feature #6421]
+ * array.c (rb_ary_sample): use rb_ary_dup().
-Thu Nov 8 16:17:54 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+Thu Nov 7 09:39:41 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * test/ruby/test_dir_m17n.rb: remove a garbage.
+ * 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]
-Thu Nov 8 15:22:09 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+Wed Nov 6 21:30:55 2013 Masaya Tarui <tarui@ruby-lang.org>
- * test/ruby/test_dir_m17n.rb: sorry, typo.
+ * gc.c (gc_before_sweep): Change algorithm of malloc_limit to
+ conservative for closing to memory consumption of ruby 2.0.
-Thu Nov 8 14:50:02 2012 Masaki Suketa <masaki.suketa@nifty.ne.jp>
+ * gc.c (GC_MALLOC_LIMIT, GC_MALLOC_LIMIT_GROWTH_FACTOR):
+ Adjust parameters for new algorithm.
- * test/win32ole/test_win32ole_variant.rb: setting WIN32OLE.locale
- to pass some assertion. Thanks to Hiroshi Shirosaki.
- [ruby-core:46873][Bug #6814]
+Wed Nov 6 21:16:51 2013 Masaki Matsushita <glass.saga@gmail.com>
-Thu Nov 8 14:46:17 2012 Masaki Suketa <masaki.suketa@nifty.ne.jp>
+ * array.c (rb_ary_shift_m): use RARRAY_PTR_USE() without WB because
+ there are not new relations.
- * 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 Nov 6 21:05:20 2013 Masaki Matsushita <glass.saga@gmail.com>
+ * array.c (rb_ary_reverse): use RARRAY_PTR_USE().
-Thu Nov 8 14:43:17 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+Wed Nov 6 19:30:44 2013 Masaya Tarui <tarui@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.
+ * common.mk (help): add texts about gcbench.
-Thu Nov 8 14:43:17 2012 Luis Lavena <luislavena@gmail.com>
+Wed Nov 6 16:32:32 2013 Martin Duerst <duerst@it.aoyama.ac.jp>
- * 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]
+ * lib/open3.rb: tweaked grammar in comments
- * test/ruby/test_dir_m17n.rb (test_filename_extutf8): use filesystem
- encoding when reading entries and comparing.
+Wed Nov 6 11:46:36 2013 Masaki Matsushita <glass.saga@gmail.com>
- * test/ruby/test_dir_m17n.rb (test_filename_utf8_raw_name): removed.
+ * array.c (rb_ary_sample): use RARRAY_AREF() and RARRAY_PTR_USE()
+ instead of RARRAY_PTR().
- * test/ruby/test_dir_m17n.rb (test_filename_utf8_raw_jp_name): split test.
+Wed Nov 6 10:37:07 2013 Masaki Matsushita <glass.saga@gmail.com>
-Thu Nov 8 14:16:53 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * array.c (rb_ary_and): defer hash creation and some refactoring.
- * lib/mkmf.rb (MakeMakefile#timestamp_file): use .-. instead of !, a
- special character of NMAKE and BSD make. [Bug #7265]
+Wed Nov 6 09:14:31 2013 Koichi Sasada <ko1@atdot.net>
-Thu Nov 8 14:16:53 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * benchmark/bm_vm1_gc_short_lived.rb: added.
+ These GC benchmarks do not reflect practical applications.
+ They are only for tuning.
- * lib/mkmf.rb (MakeMakefile#timestamp_file): use ! instead of %, a GNU
- make special character.
+ * benchmark/bm_vm1_gc_short_with_complex_long.rb: added.
-Thu Nov 8 14:16:53 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * benchmark/bm_vm1_gc_short_with_long.rb: added.
- * lib/mkmf.rb (create_makefile): use timestamp for destination
- directories to make them before making or copying files there.
- [ruby-dev:46067] [Bug #6904]
+ * benchmark/bm_vm1_gc_short_with_symbol.rb: added.
-Thu Nov 8 14:13:53 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * benchmark/bm_vm1_gc_wb_ary.rb: added.
- * 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]
+ * benchmark/bm_vm1_gc_wb_obj.rb: added.
-Thu Nov 8 14:11:49 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * benchmark/bm_vm_thread_queue.rb: added.
+ This benchmark is added to know how fast C version of thread.so.
- * vm.c (rb_vm_jump_tag_but_local_jump): pass through thrown objects.
- [ruby-dev:46234] [Bug #7185]
+Wed Nov 6 09:13:32 2013 Koichi Sasada <ko1@atdot.net>
- * 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.
+ * gc.c: define RGENGC_ESTIMATE_OLDSPACE == 0 if USE_RGENGC is 0.
-Thu Nov 8 14:09:18 2012 Kenta Murata <mrkn@mrkn.jp>
+Wed Nov 6 07:13:18 2013 Koichi Sasada <ko1@atdot.net>
- * 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]
+ * gc.c (Init_GC): add GC::OPTS to show options.
-Thu Nov 8 14:05:31 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+Wed Nov 6 07:12:17 2013 Koichi Sasada <ko1@atdot.net>
- * win32/win32.c (has_redirection): should use shell (cmd.exe) when
- the commandline containts '&'.
- reported by Roger Pack at [ruby-core:47912] [Bug #7143], and
- patched by Heesob Park at [ruby-core:47931].
+ * benchmark/gc/gcbench.rb: add some options to make quiet.
-Fri Oct 26 17:22:18 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+Wed Nov 6 04:14:25 2013 Aaron Patterson <aaron@tenderlovemaking.com>
- * file.c (append_fspath): need to set the encoding to result always.
+ * 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
-Fri Oct 26 11:03:46 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Tue Nov 5 21:21:47 2013 Tanaka Akira <akr@fsij.org>
- * 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.
+ * test/ruby/test_thread.rb (test_thread_join_in_trap):
+ Run the test in a different process.
- * 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]
+Tue Nov 5 20:14:32 2013 Masaya Tarui <tarui@ruby-lang.org>
- * dir.c (check_dirname, ruby_glob0): ditto.
+ * gc.c (is_live_object): A hidden object may be a live object.
+ [ruby-dev:47788] [Bug #9072]
- * ext/pathname/pathname.c (path_sub_ext): ditto.
+Tue Nov 5 13:37:19 2013 Koichi Sasada <ko1@atdot.net>
-Fri Oct 26 11:03:46 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+ * 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.
- * util.c, include/ruby/util.h (ruby_add_suffix): remove the function.
- [Bug #5153] [ruby-core:38736]
+ 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'.
- * io.c (argf_next_argv): remove the call of above function.
+ To implement this feature, move memsize_of() function from
+ ext/objspace/objspace.c and expose rb_obj_memsize_of().
- * ext/-test-/add_suffix, test/-ext-/test_add_suffix.rb: remove the test
- extension module because this is only for testsing ruby_add_suffix().
+ 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.
- * LEGAL: remove the mention about a part of util.c, because now we
- removed the part.
+ The macro RGENGC_ESTIMATE_OLDSPACE enables/disables this feature,
+ and turned off as default.
- * io.c (argf_next_argv): now the new filename is not guranteed to
- use, so should check the return value of rename(2).
+ We need to compare 3gen GC and this feature carefully.
+ (it is possible to enable both feature)
+ We need a help to compare them.
- * test/ruby/test_argf.rb (TestArgf#test_inplace_rename_impossible):
- now we expect same result with other platforms on no_safe_rename
- platforms (=Windows).
+ * internal.h: expose rb_obj_memsize_of().
-Thu Oct 25 18:16:25 2012 NARUSE, Yui <naruse@ruby-lang.org>
+ * ext/objspace/objspace.c: use rb_obj_memsize_of() function.
- * 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
+ * cont.c (fiber_memsize): fix to check NULL.
-Thu Oct 25 17:55:01 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+ * variable.c (autoload_memsize): ditto.
- * test/etc/test_etc.rb (TestEtc#test_getpwuid): `s' is never set to nil.
+ * vm.c (vm_memsize): ditto.
-Thu Oct 25 16:59:17 2012 Luis Lavena <luislavena@gmail.com>
+Tue Nov 5 04:03:07 2013 Koichi Sasada <ko1@atdot.net>
- * test/ruby/test_file_exhaustive.rb: fix test introduced in r36811 for
- posix environments where HOME is not defined. [ruby-core:47322]
+ * gc.c (GC_MALLOC_LIMIT_MAX): fix default value 512MB -> 384MB.
+ 512MB is huge.
-Thu Oct 25 16:59:17 2012 Luis Lavena <luislavena@gmail.com>
+Tue Nov 5 03:31:23 2013 Koichi Sasada <ko1@atdot.net>
- * configure.in (mingw): add shlwapi to the list of dependency
- libs for Windows.
- * win32/Makefile.sub (EXTSOLIBS): ditto.
+ * gc.c: add 3gen GC patch, but disabled as default.
- * internal.h: declare internal functions rb_w32_init_file,
- rb_file_expand_path_internal and rb_file_expand_path_fast.
+ 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.
- * file.c (Init_File): invoke Windows initialization rb_w32_init_file
+ 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.
- * win32/file.c (rb_file_load_path_internal): new function.
- Windows-specific implementation that replaces file_expand_path.
- [Bug #6836][ruby-core:46996]
+ 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.
- * win32/file.c (rb_w32_init_file): new function. Initialize codepage
- cache for faster conversion encodings lookup.
+ To solve this problem, generational GC with more generations
+ technique is known. This patch implements three generations gen GC.
- * file.c (file_expand_path): rename to rb_file_expand_path_internal.
- Conditionally exclude from Windows.
+ 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.
- * file.c (rb_file_expand_path_fast): new function. delegates to
- rb_file_expand_path_internal without performing a hit to the
- filesystem.
+ Representation of generations:
+ * Infant: !FL_PROMOTED and !oldgen_bitmap [00]
+ * Young : FL_PROMOTED and !oldgen_bitmap [10]
+ * Old : FL_PROMOTED and oldgen_bitmap [11]
- * 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.
+ 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.
- * load.c (rb_get_expanded_load_path): use rb_file_expand_path_fast.
- * load.c (rb_feature_provided): ditto.
+ To evaluate this feature on more applications, I commit this patch.
+ Reports are very welcome.
- * file.c (rb_file_expand_path): use rb_file_expand_path_internal with
- path expansion.
- * file.c (rb_file_absolute_path): ditto.
+ This patch includes some refactoring (renaming names, etc).
- * test/ruby/test_file_exhaustive.rb: new tests to exercise
- rb_file_expand_path_internal implementation and compliance with
- existing behaviors.
+ * include/ruby/ruby.h: catch up 3gen GC.
-Thu Oct 25 16:59:17 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+ * .gdbinit: fix to show a prompt "[PROMOTED]" for promoted objects.
- * win32/file.c (INVALID_FILE_ATTRIBUTES): define for old SDK.
+Tue Nov 5 00:05:51 2013 Koichi Sasada <ko1@atdot.net>
-Thu Oct 25 16:59:17 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * node.h: catch up comments for last commit.
- * win32/makedirs.bat: new command to make intermediate
- directories, and not to report any errors if the directory
- already exists.
+Tue Nov 5 00:02:00 2013 Koichi Sasada <ko1@atdot.net>
- * win32/Makefile.sub (MAKEDIRS): enable command extensions.
+ * include/ruby/ruby.h: rename FL_OLDGEN to FL_PROMOTED.
+ This flag represents that "this object is promoted at least once."
-Thu Oct 25 16:59:17 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+ * gc.c, debug.c, object.c: catch up this change.
- * win32/Makefile.sub (MAKEDIRS): use mkdir of cmd.exe instead of ruby.
- [Bug #6103] [ruby-core:43012]
+Mon Nov 4 22:20:16 2013 Tanaka Akira <akr@fsij.org>
- * win32/README.win32: added a notice about command extension of cmd.exe.
+ * test/xmlrpc: Don't use fixed ports: 8070 and 8071.
-Thu Oct 25 16:59:17 2012 Hiroshi Shirosaki <h.shirosaki@gmail.com>
+Mon Nov 4 15:25:52 2013 Tanaka Akira <akr@fsij.org>
- * Makefile.in (PLATFORM_DIR): add a variable for `win32` directory.
- * Makefile.in (clean-platform): add new target.
- It cleans `win32` directory.
+ * test/xmlrpc/webrick_testing.rb (start_server): Initialize the server
+ at main thread to fail early.
- * 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.
+Mon Nov 4 10:08:17 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * configure.in: move win32.o into `win32` directory and add
- win32/file.o to MISSING.
+ * 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
- * 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.
+Sun Nov 3 23:06:51 2013 Tanaka Akira <akr@fsij.org>
- * 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.
+ * sample/test.rb: Make temporary file names unique.
- * 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.
+Sun Nov 3 20:41:17 2013 Tanaka Akira <akr@fsij.org>
- Patch created with Luis Lavena.
- [ruby-core:42480] [Feature #5999]
+ * test/xmlrpc: Wrap definitions by TestXMLRPC module.
-Fri Oct 19 13:28:29 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Sun Nov 3 20:23:38 2013 Tanaka Akira <akr@fsij.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]
+ * test/xmlrpc/webrick_testing.rb (stop_server): Don't try to shutdown
+ the server if the server is not started.
-Tue Oct 16 11:18:06 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Sun Nov 3 09:35:47 2013 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]
+ * load.c (rb_feature_p): deal with default loadable suffixes.
-Tue Oct 16 10:56:55 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * load.c (load_lock): initialize statically linked extensions.
- * file.c (rb_find_file_ext_safe, rb_find_file_safe): default to
- US-ASCII for encdb and transdb.
+ * load.c (search_required, rb_require_safe): deal with statically
+ linked extensions.
- * load.c (search_required): keep encoding of feature name. set
- loading path to filesystem encoding. [Bug #6377][ruby-core:44750]
+ * load.c (ruby_init_ext): defer initialization of statically linked
+ extensions until required actually. [Bug #8883]
- * ruby.c (add_modules, require_libraries): assume default external
- encoding as well as ARGV.
+Sat Nov 2 15:14:33 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Tue Oct 16 10:47:43 2012 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]
- * random.c (random_s_rand): ensure default PRNG is re-initialized
- after fork. patched by Eric Wong. [ruby-core:41209][Bug #5661]
+ * test/logger/test_logger.rb (TestLogDevice#run_children): don't use
+ fork.
-Tue Oct 16 10:21:23 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Sat Nov 2 07:08:43 2013 NARUSE, Yui <naruse@ruby-lang.org>
- * ruby.c (rb_f_sub, rb_f_gsub): pass the given block.
- [ruby-core:47967] [Bug #7157]
+ * 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]
-Tue Oct 16 09:47:47 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+Fri Nov 1 23:24:31 2013 Nobuyoshi Nakada <nobu@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.
+ * gc.c (wmap_mark_map): mark live objects only, but delete zombies.
+ [ruby-dev:47787] [Bug #9069]
-Tue Oct 16 09:47:47 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+Fri Nov 1 22:45:54 2013 Masaya Tarui <tarui@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.
+ * gc.c (struct heap_page, gc_page_sweep, gc_sweep): Refactoring for
+ performance. Add before_sweep condition to heap_page structure.
-Sun Oct 14 01:21:42 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+ * gc.c (rb_gc_force_recycle): Use before_sweep member.
- * regparse.c (parse_char_class): should match with a hyphen after a
- range in a character class.
+ * gc.c (heap_is_before_sweep, is_before_sweep): Remove. They have not
+ already been used.
- * test/ruby/test_regexp.rb (TestRegexp#test_char_class): fixed wrong
- test.
+Fri Nov 1 22:20:28 2013 Masaya Tarui <tarui@ruby-lang.org>
- * test/ruby/test_regexp.rb (TestRegexp#check): now can accept the
- error message.
+ * gc.c (make_deferred): Refactoring. Collect codes which should be
+ atomic.
- * test/ruby/test_regexp.rb
- (TextRegexp#test_raw_hyphen_and_tk_char_type_after_range): renamed
- because the previous name was wrong.
+ * gc.c (make_io_deferred, obj_free, rb_objspace_call_finalizer,
+ gc_page_sweep): Correspond to the above.
- * test/ruby/test_regexp.rb
- (TextRegexp#test_raw_hyphen_and_tk_char_type_after_range): added
- more test pattern.
+Fri Nov 1 21:40:35 2013 Masaya Tarui <tarui@ruby-lang.org>
-Sat Oct 13 01:41:38 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+ * gc.c (typedef struct rb_objspace): Refactoring. Move some members
+ into profile member.
- * regparse.c (parse_char_class): also need to check the type of token
- after raw hyphen in regexp class, because the charcter code area
- is union'ed with the property of TK_CHAR_TYPE.
- reported by Bushi Zhang at [ruby-core:47115] [Backport #6853].
+ * gc.c (newobj_of): Correspond to the above.
-Sat Oct 13 01:39:46 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+ * gc.c (finalize_list): Ditto.
- * 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 18:19:35 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * file.c (rb_get_path_check): path name must not contain NUL bytes.
-
-Fri Oct 12 17:51:43 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.
+ * gc.c (objspace_live_num): Ditto.
-Fri Oct 12 16:11:23 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * gc.c (gc_page_sweep): Ditto.
- * 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]
+ * gc.c (rb_gc_force_recycle): Ditto.
- * ruby.c (ruby_init_loadpath_safe): ditto.
+ * gc.c (garbage_collect_body): Ditto.
-Fri Oct 12 13:56:01 2012 Ayumu AIZAWA <ayumu.aizawa@gmail.com>
+ * gc.c (rb_gc_count): Ditto.
- * test/rexml/test_encoding.rb:
- Add require 'require 'rexml/document'
+ * gc.c (gc_stat): Ditto.
-Fri Oct 12 13:36:32 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+ * gc.c (gc_prof_set_heap_info): Ditto.
- * numeric.c (flodivmod): must through the same pass if HAVE_FMOD or not.
- this is a bugfix of r35013.
+ * gc.c (gc_profile_dump_on): Ditto.
-Fri Oct 12 13:28:37 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+Fri Nov 1 20:53:56 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * io.c (rb_cloexec_fcntl_dupfd): get rid of compile error on windows.
- reported by Donovan Lampa at [ruby-core:43152] [Backport #6127],
- based on a patch by Hiroshi Shirosaki at [ruby-core:47917].
+ * string.c (rb_str_scrub): fix typo, should yield invalid byte
+ sequence to be scrubbed. reported by znz at IRC.
-Fri Oct 12 00:30:17 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+Fri Nov 1 17:25:30 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * 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.
+ * gc.c (is_live_object): finalizer may not run because of lazy-sweep.
+ [ruby-dev:47786] [Bug #9069]
-Fri Oct 12 00:30:17 2012 NARUSE, Yui <naruse@ruby-lang.org>
+Fri Nov 1 16:55:52 2013 Nobuyoshi Nakada <nobu@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.
+ * string.c (rb_str_scrub): export with fixed length arguments, and
+ allow nil as replacement string instead of omitting.
-Tue Sep 25 09:30:36 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+Fri Nov 1 06:20:44 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
- * win32/mkexports.rb: should not export DllMain().
- reported by luis at [ruby-core:46743] [Bug #6790], solved by
- Heesob Park, and confirmed by nobu.
+ * 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]
-Mon Sep 24 16:34:07 2012 Hiroshi Shirosaki <h.shirosaki@gmail.com>
+Fri Nov 1 01:08:33 2013 Koichi Sasada <ko1@atdot.net>
- * 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]
+ * benchmark/gc/gcbench.rb: print HWM (high water mark) if possible.
-Mon Sep 24 10:38:55 2012 Luis Lavena <luislavena@gmail.com>
+Thu Oct 31 21:48:31 2013 Kouhei Sutou <kou@cozmixng.org>
- * 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]
+ * lib/rexml/parsers/streamparser.rb: Add dependency file require.
+ [Bug #9062] [ruby-dev:47779]
+ Reported by Ippei Obayashi. Thanks!!!
-Mon Sep 24 10:37:56 2012 NARUSE, Yui <naruse@ruby-lang.org>
+Thu Oct 31 14:09:32 2013 Koichi Sasada <ko1@atdot.net>
- * 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]
+ * vm_method.c (rb_method_entry_make): fix to pass an ISeq value.
+ OBJ_WRITTEN() accepts only VALUE.
-Fri Sep 21 19:53:38 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+Wed Oct 30 19:07:57 2013 Akinori MUSHA <knu@iDaemons.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)
+ * 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]
-Fri Sep 21 18:45:20 2012 Luis Lavena <luislavena@gmail.com>
+Wed Oct 30 12:44:28 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * include/ruby/win32.h: undef stat to silence mingw-w64 stat
- redefinition warnings (GCC 4.6.3).
+ * win32/Makefile.sub (config.status): add missing variables,
+ PLATFORM_DIR and THREAD_MODEL.
-Fri Sep 21 17:54:54 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+Wed Oct 30 12:20:32 2013 Tanaka Akira <akr@fsij.org>
- * configure.in: add -Wall always.
+ * time.c (v2w): Normalize a rational value to an integer if possible.
+ [ruby-core:58070] [Bug #9059] reported by Isaac Schwabacher.
-Thu Sep 20 10:23:37 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+Wed Oct 30 12:08:41 2013 Masaki Matsushita <glass.saga@gmail.com>
- * thread_pthread.c (native_cond_initialize): destroy condattr
- after using it. Patch by Stanislav Sedov. Thank you.
- [Bug #7041] [ruby-core:47619]
+ * array.c (rb_ary_uniq_bang): use rb_ary_modify_check() instead of
+ rb_ary_modify() because the array will be unshared soon.
-Sun Sep 9 23:01:43 2012 Tanaka Akira <akr@fsij.org>
+Wed Oct 30 03:25:10 2013 Aaron Patterson <aaron@tenderlovemaking.com>
- * ext/zlib/extconf.rb: detect z_crc_t type which will be defined
- since zlib-1.2.7.
+ * ext/psych/lib/psych/visitors/yaml_tree.rb: make less garbage when
+ testing if a string is binary.
- * ext/zlib/zlib.c (rb_zlib_crc_table): use z_crc_t if available.
+Wed Oct 30 03:08:24 2013 Aaron Patterson <aaron@tenderlovemaking.com>
-Sun Sep 9 02:44:21 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.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
- * ext/zlib/extconf.rb: Use an exception instaed of bare puts.
+ * test/psych/test_string.rb: test for fix
-Sun Sep 9 02:44:21 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+Tue Oct 29 23:01:18 2013 Masaki Matsushita <glass.saga@gmail.com>
- * ext/psych/extconf.rb: Use an exception instaed of bare abort.
+ * array.c (rb_ary_zip): some refactoring.
-Sun Sep 9 02:44:21 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+Tue Oct 29 22:11:37 2013 Masaki Matsushita <glass.saga@gmail.com>
- * ext/fiddle/extconf.rb: Use an exception instaed of bare abort.
+ * array.c (rb_ary_uniq_bang): use st_foreach() instead of for loop.
-Sun Sep 9 02:44:21 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+Tue Oct 29 20:01:58 2013 Koichi Sasada <ko1@atdot.net>
- * ext/readline/extconf.rb: Use an exception instead of bare exit.
+ * add RUBY_TYPED_FREE_IMMEDIATELY to data types which only use
+ safe functions during garbage collection such as xfree().
-Sun Sep 9 02:34:39 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ 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.
- * 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.
+ 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.
-Sun Sep 9 02:30:20 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * cont.c: ditto.
- * thread.c (rb_mutex_lock): stop multiple threads use
- pthread_cond_timedwait() concurrently. [Bug #6278] [ruby-core:44275]
+ * dir.c: ditto.
-Thu Aug 30 09:24:43 2012 NARUSE, Yui <naruse@ruby-lang.org>
+ * encoding.c: ditto.
- * lib/uri/ftp.rb (URI::FTP#initialize): raise InvalidURIError if "//"
- is not present [ruby-core:47344] [Bug #6945]
+ * enumerator.c: ditto.
-Tue Aug 28 00:40:14 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+ * error.c: ditto.
- * test/webrick/test_cgi.rb (TestWEBrickCGI#start_cgi_server): there are
- no guarantee of existance of RbConfig::CONFIG['LIBPATHENV'].
- it only exists in Unix-like environments.
-
- * test/webrick/test_filehandler.rb
- (WEBrick::TestFileHandler#test_script_disclosure): ditto.
+ * file.c: ditto.
-Thu Aug 23 12:08:25 2012 Hiroshi Shirosaki <h.shirosaki@gmail.com>
+ * gc.c: ditto.
- * 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.
+ * io.c: ditto.
- * win32/win32.c (check_valid_dir): for performance, check the path
- by FindFirstFileW only if the path contains "...".
+ * iseq.c: 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]
+ * marshal.c: ditto.
-Thu Aug 23 11:19:51 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * parse.y: ditto.
- * thread_pthread.c (ruby_init_stack): STACK_GROW_DIR_DETECTION is
- necessary on platforms with unknown stack direction. [Bug #6761]
+ * proc.c: ditto.
-Thu Aug 23 11:19:51 2012 NARUSE, Yui <naruse@ruby-lang.org>
+ * process.c: ditto.
- * thread_pthread.c (get_stack): Linux is the only OS which includes
- the size of guard page into the stack size.
+ * random.c: ditto.
-Thu Aug 23 11:19:51 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * thread.c: ditto.
- * gc.h (IS_STACK_DIR_UPPER): utility macro.
+ * time.c: ditto.
- * thread_pthread.c (get_stack): seems stack size does not include
- guard size on Mac OS X.
+ * transcode.c: ditto.
- * thread_pthread.c (ruby_init_stack): adjust stack size for offset of
- addr from the bottom.
+ * variable.c: ditto.
-Thu Aug 23 11:19:51 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * vm.c: ditto.
- * thread_pthread.c (ruby_init_stack): use stack info if possible.
+ * vm_backtrace.c: ditto.
-Mon Aug 20 17:11:01 2012 NARUSE, Yui <naruse@ruby-lang.org>
+ * vm_trace.c: ditto.
- * 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.
+ * ext/bigdecimal/bigdecimal.c: ditto.
-Thu Aug 9 22:48:58 2012 NARUSE, Yui <naruse@ruby-lang.org>
+ * ext/objspace/objspace.c: ditto.
- * 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]
+ * ext/stringio/stringio.c: ditto.
-Tue Jul 31 10:36:12 2012 Aaron Patterson <aaron@tenderlovemaking.com>
+ * ext/strscan/strscan.c: ditto.
- * ext/psych/lib/psych.rb: updated to released version.
+Tue Oct 29 19:48:33 2013 Koichi Sasada <ko1@atdot.net>
- * ext/psych/psych.gemspec: ditto
+ * include/ruby/ruby.h: fix typo (FL_WB_PROTECT -> FL_WB_PROTECTED).
-Thu Jul 19 09:33:46 2012 Aaron Patterson <aaron@tenderlovemaking.com>
+Tue Oct 29 18:45:08 2013 Koichi Sasada <ko1@atdot.net>
- * ext/psych/emitter.c (initialize): allow a configuration object to be
- passed to the constructor so that mutation isn't required after
- instantiation.
+ * vm_trace.c (tp_free): removed because empty free function.
+ Use RUBY_TYPED_NEVER_FREE instead.
- * ext/psych/lib/psych/handler.rb: add configuration object
+Tue Oct 29 18:37:33 2013 Koichi Sasada <ko1@atdot.net>
- * ext/psych/lib/psych/visitors/emitter.rb: use configuration object if
- extra configuration is present.
+ * 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).
-Tue Jul 17 03:56:34 2012 Aaron Patterson <aaron@tenderlovemaking.com>
+ * gc.c (obj_free): support RUBY_TYPED_FREE_IMMEDIATELY.
- * 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
+Tue Oct 29 16:49:03 2013 Koichi Sasada <ko1@atdot.net>
-Sat Jun 16 01:27:14 2012 Aaron Patterson <aaron@tenderlovemaking.com>
+ * gc.c (vm_malloc_increase): decrease it more carefully.
- * ext/psych/lib/psych.rb: bumping psych to 1.3.3
- * ext/psych/psych.gemspec: ditto
+Tue Oct 29 16:24:52 2013 Koichi Sasada <ko1@atdot.net>
-Fri May 18 15:53:05 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * gc.c (heap_page_resurrect): return a page in tomb heap even if
+ freelist is NULL.
- * ext/psych/extconf.rb: Use an exception instaed of bare abort.
+Tue Oct 29 15:46:30 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Fri May 18 01:28:21 2012 Aaron Patterson <aaron@tenderlovemaking.com>
+ * ruby_atomic.h (ATOMIC_SIZE_CAS): new macro, compare and swap size_t.
- * ext/psych/parser.c (transcode_string): fix encoding index names.
- Thanks markizko for reporting.
+Tue Oct 29 12:08:05 2013 Tanaka Akira <akr@fsij.org>
-Wed May 16 05:11:29 2012 Aaron Patterson <aaron@tenderlovemaking.com>
+ * ext/readline/readline.c (readline_getc): Consider
+ NULL as input.
- * ext/psych/lib/psych/visitors/to_ruby.rb: fix a bug with string
- subclass dumping and loading.
+Tue Oct 29 11:10:08 2013 Aman Gupta <ruby@tmm1.net>
- * test/psych/test_array.rb: pertinent tests
+ * gc.c (gc_profile_total_time): fix off-by-one error in
+ GC::Profiler.total_time.
+ * test/ruby/test_gc.rb (class TestGc): test for above.
- * test/psych/test_string.rb: ditto
+Tue Oct 29 09:53:00 2013 Charlie Somerville <charliesome@ruby-lang.org>
-Wed May 16 01:31:21 2012 Aaron Patterson <aaron@tenderlovemaking.com>
+ * 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.
- * ext/psych/lib/psych/visitors/to_ruby.rb: convert omap tagged maps to
- Psych::Omap objects rather than hashes. [Bug #6425]
+ * 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
- * test/psych/test_omap.rb: pertinent test.
+ * class.c, include/ruby/intern.h, variable.c, vm_method.c: add
+ rb_clear_constant_cache
-Wed May 16 01:15:45 2012 Aaron Patterson <aaron@tenderlovemaking.com>
+ * compile.c, vm_core.h, vm_insnhelper.c: rename vmstat field in
+ rb_call_info_struct to method_state
- * ext/psych/lib/psych/visitors/yaml_tree.rb: keep a reference to
- custom coders so that GC does not impact dumped yaml reference ids.
+ * vm_method.c: rename vmstat field in struct cache_entry to method_state
-Mon Apr 30 04:43:53 2012 Aaron Patterson <aaron@tenderlovemaking.com>
+Mon Oct 28 23:26:04 2013 Tanaka Akira <akr@fsij.org>
- * ext/psych/lib/psych/json/yaml_events.rb: implicit styles should not
- be changeable for JSON events.
+ * test/readline/test_readline.rb (teardown): Clear Readline.input and
+ Readline.output.
-Sun Jul 29 04:32:31 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Mon Oct 28 21:35:31 2013 Tanaka Akira <akr@fsij.org>
- * configure.in (ruby_pc): make configurable. [Bug #6051]
+ * ext/-test-/file/depend, ext/-test-/postponed_job/depend,
+ ext/-test-/tracepoint/depend: New files for dependencies.
-Sun Jul 29 04:32:06 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Mon Oct 28 15:32:18 2013 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]
+ * ext/openssl/depend (ossl.o): work around of dependency of
+ thread_native.h, which depends on headers by THREAD_MODEL.
+ [ruby-dev:47777]
-Sun Jul 29 04:31:01 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * ext/openssl/extconf.rb: need THREAD_MODEL.
- * bignum.c: Added #include <strings.h> for ffs(). Patch by Perry
- Smith. Thank you. [Bug #6748]
+Mon Oct 28 14:57:01 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Sat Jul 28 04:04:01 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * load.c (ruby_init_ext): share feature names between frame name and
+ provided features.
- * include/ruby/intern.h (rb_num_zerodiv): Added NORETURN.
- Patched by Xi Wang. [Bug #6736]
+Mon Oct 28 14:41:27 2013 Akinori MUSHA <knu@iDaemons.org>
-Wed Jul 4 19:36:17 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+ * misc/ruby-electric.el: Import ruby-electric.el 2.1 from
+ https://github.com/knu/ruby-electric.el.
- * 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)
+ * Hitting the newline-and-indent key within a comment fires
+ comment-indent-new-line.
-Tue Jul 3 19:37:52 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * Introduce a new feature
+ `ruby-electric-autoindent-on-closing-char`.
- * file.c (rmext): no extension to strip if empty string.
+ * Fix fallback behavior of ruby-electric-space/return that
+ caused error with auto-complete.
- * proc.c (rb_vm_rewrite_dfp_in_errinfo): Fix `unexpected return'
- occurs when a proc is called in ensure. [Backport #6460]
+Mon Oct 28 13:17:17 2013 Or Cohen <orc@fewbytes.com>
-Tue Jul 3 11:44:23 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * error.c (name_err_to_s): remove no longer needed overriding, since
+ r30455 which made exc_to_s almost same. Fixes [GH-413].
- * 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.
+Mon Oct 28 12:42:11 2013 Tanaka Akira <akr@fsij.org>
- * 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]
+ * common.mk, ext/objspace/depend, ext/coverage/depend,
+ ext/-test-/debug/depend, ext/date/depend: Update dependencies.
- * dir.c (check_dirname, ruby_glob0): ditto.
+Mon Oct 28 09:29:00 2013 Charlie Somerville <charliesome@ruby-lang.org>
- * ext/pathname/pathname.c (path_sub_ext): ditto.
+ * vm.c: vm_clear_all_cache is not necessary now we use a 64 bit counter
+ for global state version.
-Tue Jul 3 11:43:46 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * vm_insnhelper.h: ruby_vm_global_state_version overflow is unnecessary
- * dir.c (dir_chdir, check_dirname): get rid of optimization-out.
+Mon Oct 28 07:47:32 2013 Aman Gupta <ruby@tmm1.net>
-Thu Jun 28 17:57:49 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+ * vm_backtrace.c (rb_profile_frame_classpath): do not use rb_inspect
+ directly, since it might have a custom implementation or show ivars.
- * win32/win32.c (is_socket, is_console): add prototypes to fix compile
- problem with gcc introduced at r32549.
+Mon Oct 28 04:10:41 2013 Aman Gupta <ruby@tmm1.net>
-Wed Jun 27 08:31:50 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * 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.
- * insns.def (splatarray): make new array if flag is set.
+Mon Oct 28 00:52:36 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * compile.c (iseq_compile_each): make new array with
- splat. [ruby-core:21901][Feature #1125]
+ * struct.c (new_struct): fix warning message, class name and encoding.
-Wed Jun 27 04:23:26 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Sun Oct 27 20:53:08 2013 Tanaka Akira <akr@fsij.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]
+ * 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.
-Wed Jun 27 04:20:41 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ [ruby-dev:47033] [Bug #8749] reported by Nobuhiro IMAI.
+ [ruby-core:57951] [Bug #9040] reported by Eamonn Webster.
- * bignum.c (rb_big_pow): estimate result bit size more precisely.
- [ruby-core:30735][Feature #3429]
+Sat Oct 26 19:31:28 2013 Kazuki Tsujimoto <kazuki@callcc.net>
-Tue Jun 26 20:36:53 2012 Tanaka Akira <akr@fsij.org>
+ * gc.c: catch up recent changes to compile on GC_DEBUG,
+ RGENGC_CHECK_MODE.
- * 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]
+Sat Oct 26 19:08:00 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Tue Jun 26 20:35:59 2012 Eric Hodel <drbrain@segment7.net>
+ * range.c (range_initialize_copy): disallow to modify after
+ initialized.
- * 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 Oct 26 17:48:54 2013 Tanaka Akira <akr@fsij.org>
-Thu Jun 21 13:42:57 2012 NARUSE, Yui <naruse@ruby-lang.org>
+ * lib/open-uri.rb (meta_add_field): : Re-implemented.
+ [ruby-core:58017] [Bug #9051] patch by Eamonn Webster.
- * 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 Oct 26 14:35:09 2013 Koichi Sasada <ko1@atdot.net>
-Mon Jun 11 19:56:22 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * gc.c (gc_profile_dump_on): use "Page" terminology.
- * 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 Oct 26 13:25:45 2013 Koichi Sasada <ko1@atdot.net>
-Tue Jun 5 14:03:53 2012 Akinori MUSHA <knu@iDaemons.org>
+ * gc.c (gc_sweep, gc_heap_lazy_sweep): fix measurement code.
+ We only need one sweep time measurement without lazy sweep.
- * lib/ipaddr.rb: Inhibit zero-filled octets in an IPv4 address in
- all platforms. [ruby-dev:45671]
+Sat Oct 26 11:59:13 2013 Tanaka Akira <akr@fsij.org>
- * 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.
+ * 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).
- * lib/ipaddr.rb: Stop exposing IPSocket.valid*? methods which were
- only usable on non-IPv6-ready platforms.
+Sat Oct 26 11:35:22 2013 Koichi Sasada <ko1@atdot.net>
-Sat Jun 2 18:49:39 2012 NARUSE, Yui <naruse@ruby-lang.org>
+ * gc.c: tuning parameters.
- * 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]
+ * gc.c (GC_MALLOC_LIMIT): change default value to 16MB.
-Wed May 30 17:19:56 2012 Eric Hodel <drbrain@segment7.net>
+ * gc.c (GC_MALLOC_LIMIT_GROWTH_FACTOR): change default value to 2.0.
- * ext/zlib/zlib.c (do_inflate): Inflate more data if buffered data
- exists. Allows Zlib::Inflate#set_dictionary to work.
- [ruby-trunk - Bug #5929]
+ * gc.c (gc_before_sweep): change decrease ratio of `malloc_limit'
+ from 1/4 to 1/10.
-Mon May 28 11:40:19 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Sat Oct 26 11:30:07 2013 Koichi Sasada <ko1@atdot.net>
- * io.c (rb_io_extract_modeenc): fail only if conflicting
- text/binary modes given explicitly. [ruby-dev:45268][Bug #6055]
+ * 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.
-Fri May 25 17:18:06 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Sat Oct 26 06:35:41 2013 Masaya Tarui <tarui@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]
+ * gc.c (gc_before_heap_sweep): Restructure code to mean clearly.
+ heap->freelist is connected to end of list.
-Fri May 25 10:40:31 2012 Hiroshi Shirosaki <h.shirosaki@gmail.com>
+Sat Oct 26 04:01:35 2013 Koichi Sasada <ko1@atdot.net>
- * include/ruby/win32.h (FD_SET): change function to macro.
- To avoid buffer overflow when smaller FD_SETSISE is used in ext
- libraries.
+ * 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.
- * win32/win32.c (rb_w32_fdset): this function is not used anymore.
- But we leave this for compatibility.
+Thu Oct 24 21:57:24 2013 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
- * win32/win32.c (rb_w32_select_with_thread): fix SEGV when smaller
- FD_SETSISE is used in ext libraries. Dereference of fd_set pointer
- causes SEGV.
+ * parse.y: Remove +(binary) and -(binary) special cases
+ [Feature #9048]
- * 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.
+Thu Oct 24 12:45:53 2013 Zachary Scott <e@zzak.io>
- [ruby-core:44588] [Bug #6352]
+ * object.c: [DOC] Document first argument also takes string for:
-Fri May 25 10:38:06 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ rb_mod_const_get, rb_mod_const_set, rb_mod_const_defined
- * io.c (io_strip_bom): check EOF. [Bug #6487][ruby-core:45203]
+ Also added note about NameError exception for invalid constant name
-Fri May 25 10:36:38 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Thu Oct 24 12:23:58 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
- * 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]
+ * thread.c (rb_thread_terminate_all): add a comment why we need
+ state check and call terminate_i again.
-Mon May 21 16:24:40 2012 Akinori MUSHA <knu@iDaemons.org>
+Thu Oct 24 12:15:02 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
- * ext/syslog/syslog.c (mSyslog_inspect): Use rb_sprintf().
+ * thread.c (rb_thread_terminate_all): add a comment why infinite
+ sleep is safe.
- * ext/syslog/syslog.c (mSyslog_inspect): Make sure self is a
- module before calling rb_class2name().
+Thu Oct 24 07:41:42 2013 Aman Gupta <ruby@tmm1.net>
-Sat May 19 14:42:37 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+ * gc.c: add new initial_growth_max tuning parameter.
+ [ruby-core:57928] [Bug #9035]
+ * gc.c (heap_set_increment): when initial_growth_max is set,
+ do not grow number of slots by more than growth_max at a time.
+ * gc.c (rb_gc_set_params): load optional new tuning value from
+ RUBY_HEAP_SLOTS_GROWTH_MAX environment variable.
+ * test/ruby/test_gc.rb (class TestGc): test for above.
- * test/drb/drbtest.rb ({DRbCore,DRbAry}#teardown}: cannot pass SIGTERM
- to another process on Windows, so use SIGINT instead.
+Thu Oct 24 01:34:12 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Sat May 19 14:42:20 2012 Tanaka Akira <akr@fsij.org>
+ * include/ruby/win32.h (rb_infinity_float): suppress overflow in
+ constant arithmetic warnings. [ruby-core:57981] [Bug #9044]
- * 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]
+Thu Oct 24 00:11:24 2013 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
-Sat May 19 14:41:45 2012 Tanaka Akira <akr@fsij.org>
+ * 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/drb/drbtest.rb: rescue Errno::ESRCH for Process.kill.
- reported by NARUSE, Yui. [ruby-dev:45551]
+ * test/ostruct/test_ostruct.rb: Added tests for above.
-Sat May 19 14:41:09 2012 Tanaka Akira <akr@fsij.org>
+Thu Oct 24 00:10:22 2013 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
- * lib/drb/extservm.rb (DRb::ExtServManager): don't use /bin/sh to
- invoke service subprocess. mark detach threads for clean up.
+ * array.c: Add Array#to_h [Feature #7292]
- * test/drb/drbtest.rb: clean up the service subprocess in teardown.
+ * enum.c: Add Enumerable#to_h
- * test/drb/test_drb.rb: set @service_name for teardown.
+Wed Oct 23 23:48:28 2013 Aman Gupta <ruby@tmm1.net>
- * test/drb/test_drbunix.rb: ditto.
+ * 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--
- * test/drb/test_drbssl.rb: ditto.
+Wed Oct 23 22:51:03 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Sat May 19 14:40:49 2012 Tanaka Akira <akr@fsij.org>
+ * win32/Makefile.sub (config.h): VC 2013 supports C99 mathematics
+ functions. [ruby-core:57981] [Bug #9044]
- * lib/drb/ssl.rb: close accepted TCP socket if SSL accept is failed.
- [ruby-dev:45541]
+Wed Oct 23 19:13:18 2013 Koichi Sasada <ko1@atdot.net>
-Sat May 19 14:39:50 2012 Tanaka Akira <akr@fsij.org>
+ * gc.c: move increment from heap to heap_pages.
+ Share `increment' information with heaps.
- * lib/webrick/utils.rb: fix fcntl call.
+ * gc.c: change ratio of heap_pages_free_min_page
+ to 0.80.
+ This change means slow down page freeing speed.
- * lib/drb/unix.rb: ditto.
+Wed Oct 23 17:52:03 2013 Koichi Sasada <ko1@atdot.net>
-Fri May 18 18:13:44 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * gc.c (heap_pages_free_unused_pages): cast to (int) for size_t
+ variable `i'.
- * lib/mkmf.rb (MakeMakefile#configuration): keep space at end of
- OUTFLAG and COUTFLAG. [ruby-dev:45650]
+Wed Oct 23 17:39:35 2013 Koichi Sasada <ko1@atdot.net>
-Fri May 18 00:04:53 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * 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.
- * win32/win32.c (rb_w32_fstat, rb_w32_fstati64): convert FILETIME
- to time_t directly, not to be affected by TZ unnecessarily.
+ 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)
- * win32/win32.c (unixtime_to_filetime): convert time_t to FILETIME
- simply.
+ To introduce this patch, there are several tuning of GC parameters.
-Wed May 16 01:07:46 2012 Aaron Patterson <aaron@tenderlovemaking.com>
+Wed Oct 23 14:20:56 2013 Koichi Sasada <ko1@atdot.net>
- * ext/digest/md5/extconf.rb: use pkg_config for openssl so that
- customized ssl paths are used for linking. Backports fixes for
- [ruby-core:44755].
- * ext/digest/rmd160/extconf.rb: ditto
- * ext/digest/sha1/extconf.rb: ditto
- * ext/digest/sha2/extconf.rb: ditto
+ * gc.c (gc_prof_sweep_timer_stop): catch up recent changes
+ to compile on GC_PROFILE_MORE_DETAIL=1.
-Mon May 14 17:14:10 2012 CHIKANAGA Tomoyuki <nagachika@ruby-lang.org>
+Wed Oct 23 11:43:27 2013 Zachary Scott <e@zzak.io>
- * 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]
+ * file.c: [DOC] fix rdoc format of File#expand_path from r43386
-Mon May 14 17:14:10 2012 CHIKANAGA Tomoyuki <nagachika@ruby-lang.org>
+Tue Oct 22 21:58:28 2013 URABE Shyouhei <shyouhei@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]
+ * vm_core.h (enum): avoid syntax error.
-Mon May 14 13:18:56 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * method.h: ditto.
- * parse.y (parser_tokadd_string): insert a backslash only if
- quoted by single quotes. [ruby-dev:45281] [Bug #6069]
+ * internal.h: ditto.
-Mon May 14 13:17:57 2012 Luis Lavena <luislavena@gmail.com>
+Tue Oct 22 19:53:16 2013 Koichi Sasada <ko1@atdot.net>
- * 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]
+ * gc.c (Init_heap): move logics from heap_pages_init() and remove
+ heap_pages_init().
-Fri May 11 14:09:48 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Tue Oct 22 19:19:05 2013 Koichi Sasada <ko1@atdot.net>
- * 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.
+ * 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.
-Fri May 11 01:04:54 2012 Hiroshi Shirosaki <h.shirosaki@gmail.com>
+ * 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.
- * 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]
+ 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.
- * test/ruby/test_io_m17n.rb (TestIO_M17N#test_pos_with_buffer_end_cr):
- add a test for above.
+ Now, there is only one heap called `eden', which is a space for all
+ new generated objects.
-Wed May 9 15:59:17 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Tue Oct 22 18:26:12 2013 Tanaka Akira <akr@fsij.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]
+ * 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.
-Mon May 7 20:23:29 2012 Tanaka Akira <akr@fsij.org>
+Tue Oct 22 16:57:48 2013 Benoit Daloze <eregontp@gmail.com>
- * lib/securerandom.rb (random_bytes): call to_int method for the
- argument at first.
+ * file.c (File#expand_path): [DOC] improve documentation of File#expand_path.
+ Based on patch by Prathamesh Sonpatki. [ruby-core:57734] [Bug #9002]
-Mon May 7 20:23:29 2012 Tanaka Akira <akr@fsij.org>
+Tue Oct 22 15:59:51 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * lib/securerandom.rb: show actual read length in an error message.
+ * dir.c (glob_helper): don't skip current directories if FNM_DOTMATCH
+ is given. [ruby-core:53108] [Bug #8006]
-Mon May 7 11:09:20 2012 NARUSE, Yui <naruse@ruby-lang.org>
+Tue Oct 22 14:53:11 2013 Koichi Sasada <ko1@atdot.net>
- * ext/bigdecimal/bigdecimal.c (Init_bigdecimal): define IDs before
- they are used. [ruby-core:44900] [Bug #6406]
+ * vm_trace.c: exterminate Zombies.
+ There is a bug that T_ZOMBIE objects are not collected.
+ Because there is a pass to miss finalizer postponed job
+ with multi-threading. This patch solve this issue.
-Fri Apr 27 11:02:33 2012 Masatoshi SEKI <m_seki@mva.biglobe.ne.jp>
+ * 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.
- * test/rinda/test_rinda.rb (test_core_03_notify): Fixed test failures
- [ruby-dev:44430] [Ruby 1.9 - Bug #372]
+ * vm_trace.c (rb_postponed_job_register_one): check interrupt
+ carefully.
-Fri Apr 27 08:29:51 2012 Masatoshi SEKI <m_seki@mva.biglobe.ne.jp>
+ * vm_trace.c (rb_postponed_job_register_one): use additional space
+ to avoid buffer full.
- * test/rinda/test_rinda.rb: fix sticks on some testsf problem
- [Bug #6272]
+ * gc.c (gc_finalize_deferred_register): check failure.
-Wed Apr 25 05:56:56 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * thread.c (rb_threadptr_execute_interrupts): check
+ `postponed_job_interrupt' immediately. There is a possibility
+ to miss this flag.
- * lib/optparse.rb (OptionParser#to_a): split for each lines.
- [ruby-dev:45568][Bug #6348]
+Tue Oct 22 12:11:16 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Tue Apr 24 21:20:39 2012 NARUSE, Yui <naruse@ruby-lang.org>
+ * configure.in: check if the given CFLAGS and LDFLAGS are working, and
+ bail out early if not.
- * 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 Oct 22 00:06:57 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Tue Apr 24 14:55:41 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * file.c (rb_file_exists_p): warn deprecated name. [Bug #9041]
- * lib/optparse.rb (OptionParser#to_a): String#to_a is no longer
- defined. [ruby-dev:45568][Bug #6348]
+Mon Oct 21 23:57:53 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Sat Apr 21 07:16:16 2012 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]
- * strftime.c (rb_strftime_with_timespec): fix padding of time zone
- offset. [ruby-dev:43287][Bug #4458]
+Sun Oct 20 15:41:22 2013 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.
+ * 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]
- * 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]
+Sun Oct 20 15:29:05 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Fri Apr 20 12:30:06 2012 Eric Hodel <drbrain@segment7.net>
+ * error.c (rb_syserr_fail_path_in): new function split from
+ rb_sys_fail_path_in to raise SystemCallError without errno.
- * 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.
+ * internal.h (rb_syserr_fail_path): like rb_sys_fail_path but without
+ errno.
-Fri Apr 20 08:30:55 2012 Eric Hodel <drbrain@segment7.net>
+Sun Oct 20 13:58:47 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * lib/rubygems: Update to RubyGems 1.8.23 which contains security
- fixes:
+ * include/ruby/ruby.h (rb_obj_wb_unprotect, rb_obj_written),
+ (rb_obj_write): suppress unused-parameter warnings.
- RubyGems now disallows redirection from HTTPS to HTTP.
+Sun Oct 20 10:32:48 2013 Eric Hodel <drbrain@segment7.net>
- RubyGems now verifies SSL connections.
+ * lib/rubygems: Update RubyGems to master 0886307. This commit
+ improves documentation and should bring ruby above 75% documented on
+ rubyci.
- See https://github.com/rubygems/rubygems/blob/1.8/History.txt for
- changes since 1.8.22.
- * test/rubygems: ditto.
+Sun Oct 20 09:30:56 2013 Eric Hodel <drbrain@segment7.net>
-Fri Apr 20 07:39:50 2012 Eric Hodel <drbrain@segment7.net>
+ * lib/rubygems: Update to RubyGems master 3de7e0f. Changes:
- * lib/rubygems: Update to RubyGems 1.8.22 plus r33517 and r35337 which
- were ported to the rubygems git repository.
+ Only attempt to build extensions for newly-installed gems. This
+ prevents compilation attempts at gem activation time for gems that
+ already have extensions built.
- See https://github.com/rubygems/rubygems/blob/1.8/History.txt for
- changes since 1.8.11.
+ Fix crash in the dependency resolver for dependencies that cannot be
+ resolved.
* test/rubygems: ditto.
- * lib/rubygems/version.rb: Fixed init_with warning by calling into
- yaml_initialize (for syck) from psych's init_with
-
-Thu Apr 19 12:55:31 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]
-
-Wed Apr 18 23:08:58 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.
-
-Tue Apr 17 21:35:47 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!!!
-
-Mon Apr 17 14:27:22 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]
-
-Sun Apr 15 14:57:00 2012 Tanaka Akira <akr@fsij.org>
-
- * test/test_pty.rb (test_pty_check_default): call PTY.check until
- "cat" command is finished.
-
-Sun Apr 15 14:54:16 2012 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.
-
-Sun Apr 15 06:40:28 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]
-
-Sun Apr 15 06:40:28 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]
-
-Sun Apr 15 04:35:48 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.
-
-Sun Apr 15 03:00:54 2012 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * io.c (io_unread): fixed memory leak. report by nagachika via IRC.
-
-Sun Apr 15 03:00:54 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]
-
-Sun Apr 15 03:00:54 2012 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * test/ruby/test_io.rb (TestIO#test_pos_with_getc): updated.
- see [ruby-core:43550]
-
-Sun Apr 15 03:00:54 2012 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * test/ruby/test_io.rb (TestIO#test_pos_with_getc): added.
- see [Bug #6179][ruby-core:43518]
-
-Wed Apr 11 16:22:16 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * ext/-test-/add_suffix/bug.c (ruby_add_suffix): no static
- declaration. [ruby-core:44277][Bug #6279]
-
-Sun Apr 8 06:53:55 2012 NARUSE, Yui <naruse@ruby-lang.org>
-
- * io.c (io_unread): cast as long the value for extra_max.
- [ruby-core:44137] [Bug #6257]
-
-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
-
-Wed Apr 4 18:29:15 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.
-
-Wed Apr 4 11:32:09 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * ext/-test-/add_suffix/bug.c: make all functions in util.c static
- to get rid of multiple definitions. reported at
- https://trac.macports.org/ticket/33814
-
-Tue Apr 3 18:34:33 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * process.c (setreuid, setregid): suppress warnings.
- [ruby-core:43374][Bug #6169]
-
-Sat Mar 31 12:11:21 2012 Martin Bosslet <Martin.Bosslet@googlemail.com>
-
- * ext/openssl/ossl_x509cert.c: Fix doc typo.
-
-Fri Mar 30 14:17:17 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]
-
-Fri Mar 30 14:17: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]
-
-Fri Mar 30 14:15:40 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]
-
-Fri Mar 30 14:14:36 2012 Tadayoshi Funaba <tadf@dotrb.org>
-
- * ext/date/date_core.c (datetime_s_now): [ruby-core:43256].
-
-Fri Mar 30 14:12:53 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 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
-
-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.
-
-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.
-
-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 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
-
-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 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 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
-
-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
-
-Wed Dec 21 02:25:36 2011 Aaron Patterson <aaron@tenderlovemaking.com>
-
- * ext/psych/emitter.c: fixing clang warnings. Thanks Joey!
-
-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.
-
-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.
-
-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 22 04:46:22 2011 Aaron Patterson <aaron@tenderlovemaking.com>
+Sun Oct 20 05:24:29 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * ext/psych/lib/psych.rb: remove autoload from psych
- * ext/psych/lib/psych/json.rb: ditto
+ * variable.c (rb_class2name): should return real class name, not
+ singleton class or iclass.
-Wed Nov 9 04:52:16 2011 Aaron Patterson <aaron@tenderlovemaking.com>
+Sun Oct 20 04:18:48 2013 Aman Gupta <ruby@tmm1.net>
- * 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
-
-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.
-
-Thu Oct 27 08:47:38 2011 Martin Bosslet <Martin.Bosslet@googlemail.com>
-
- * ext/psych/parser.c: remove unused variable.
-
-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 Mar 27 22:22:50 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * 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]
-
-Mon Mar 26 09:57:12 2012 NARUSE, Yui <naruse@ruby-lang.org>
-
- * parse.y (parser_nextc): set encoding for the buffer of ripper.
-
-Sun Mar 18 13:23:28 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]
-
-Tue Mar 6 18:55:37 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * lib/test/unit/assertions.rb (assert_send, assert_not_send):
- parenthesize non-empty arguments.
-
-Tue Mar 6 18:55:37 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * lib/test/unit/assertions.rb (assert_send): make arguments in
- the default message clearer.
-
-Tue Mar 6 12:48:08 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 12:40:08 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * ext/io/console/console.c (console_raw, console_set_raw)
- (console_getch): optional parameters. [EXPERIMENTAL]
-
-Tue Mar 6 12:39:27 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * ext/io/console/console.c (console_cooked, console_set_cooked):
- new methods to reset cooked mode. [EXPERIMENTAL]
-
-Tue Mar 6 12:31:47 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.
-
-Tue Mar 6 12:29:34 2012 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
-
-Tue Mar 6 11:42:52 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
-
-Fri Mar 2 22:09:03 2012 Hiroshi Nakamura <nahi@ruby-lang.org>
-
- * .travis.yml: Backport TravisCI configuration from trunk.
-
-Thu Mar 1 18:39:44 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * file.c (rb_file_join): honor input encodings than ASCII-8BIT.
- [ruby-core:40338] [Bug #5483]
-
-Tue Feb 28 11:56:52 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * configure.in (debugflags): check if -ggdb is accepted.
- [ruby-core:42875][Bug #6080]
-
-Mon Feb 27 17:25:40 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 02:28:17 2012 NARUSE, Yui <naruse@ruby-lang.org>
-
- * regparse.c (add_code_range_to_buf0): wrong condition of duplicated
- warnings.
-
-Sun Feb 26 12:26:26 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.
-
-Sat Feb 25 23:47:49 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * file.c (utime_internal): fix a variable missed to replace.
- [ruby-core:42864] [Bug #6077]
-
-Sat Feb 25 21:29:09 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
-
-Sat Feb 25 21:29:09 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.
-
-Sat Feb 25 21:18:12 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 21:18:12 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 17:10:51 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:39:13 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]
-
-Fri Feb 24 23:49:05 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]
-
-Fri Feb 24 08:53:28 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]
-
-Thu Feb 23 14:44:36 2012 NARUSE, Yui <naruse@ruby-lang.org>
-
- * lib/uri/common.rb (URI::Parser#initialize_regexp):
- use \A \z instead of ^ $. [Bug #5843]
-
-Thu Feb 23 08:08:23 2012 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * win32/win32.c (rb_w32_uchmod): typo. [Bug#5671] [ruby-dev:44898]
+ * variable.c (rb_class2name): call rb_tmp_class_path() directly to
+ avoid extra rb_str_dup() from rb_class_name().
- * test/ruby/test_file.rb (TestFile#test_chmod_m17n): test of above bug.
+Sat Oct 19 19:59:02 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Wed Feb 22 23:27:52 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * win32/file.c (code_page): use simple array instead of st_table.
- * test/iconv/test_option.rb: enabled. [ruby-core:42802][Bug #6061]
+ * encoding.c (rb_locale_encindex): defer initialization of win32 code
+ page table until encoding db loaded.
-Wed Feb 22 22:04:15 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Sat Oct 19 08:25:05 2013 Koichi Sasada <ko1@atdot.net>
- * io.c (rb_io_s_foreach): argument check before making Enumerator.
- [ruby-dev:31525]
+ * 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.
-Wed Feb 22 22:04:15 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Sat Oct 19 07:14:40 2013 Eric Hodel <drbrain@segment7.net>
- * io.c (rb_io_s_foreach): return enumerator including kerword
- arguments. [ruby-dev:45267][Bug #6054]
+ * lib/rubygems: Update to RubyGems master 42543b6. Changes:
-Wed Feb 22 21:42:16 2012 NARUSE, Yui <naruse@ruby-lang.org>
+ Fix `gem update` for gems with multiple platforms.
- * configure.in: remove workaround replacement from gcc to gcc-4.2.
- [Backport #6043]
-
-Wed Feb 22 08:11:06 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]
-
-Sun Feb 19 12:27:24 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * configure.in: ignore all warnings from an arbitrary
- header in /usr/local/include.
-
-Fri Feb 17 12:51:25 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * lib/mkmf.rb (create_header): log the content of header.
-
-Fri Feb 17 12:26:15 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.
-
-Fri Feb 17 11:46:39 2012 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]
-
-Fri Feb 17 10:15:54 2012 Tanaka Akira <akr@fsij.org>
-
- * ext/dbm/extconf.rb: check _DB_H_ macro unavailable except
- Berkeley DB library.
-
-Fri Feb 17 10:14:47 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 09:53:46 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.
+ * test/rubygems: ditto.
- * tool/enc-unicode.rb: ditto.
+Sat Oct 19 06:55:52 2013 Eric Hodel <drbrain@segment7.net>
-Thu Feb 16 17:54:14 2012 NARUSE, Yui <naruse@ruby-lang.org>
+ * lib/rubygems: Update to RubyGems master 0a3814b. Changes:
- * ext/dbm/extconf.rb: merge trunk's ext/dbm/extconf.rb and
- related functions of lib/mkmf.rb. [Backport #6021]
+ Fixed extension directory in Gem::Specification#require_paths.
-Thu Feb 16 09:25:52 2012 NARUSE, Yui <naruse@ruby-lang.org>
+ Allow installation of gems when $HOME is nonexistent or unwritable.
- * configure.in (enable_pthread): use -pthread on OpenBSD without
- explicit option. patched by Jeremy Evans. [ruby-core:38572]
+ Use proper API in InstallCommand.
-Thu Feb 16 07:34:34 2012 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
+ Improve support for path option in gem dependency files.
- * cont.c (rb_fiber_reset_root_local_storage): add a new function to
- restore rb_thread_t::local_storage.
+ Remove warnings.
- * cont.c (rb_obj_is_fiber): add a new function to tell finalizer to
- prevent fibers from destroy.
+ * test/rubygems: ditto.
- * gc.c (rb_objspace_call_finalizer): don't sweep fibers at finalizing
- objspace.
+Fri Oct 18 15:23:34 2013 Koichi Sasada <ko1@atdot.net>
- * internal.h (rb_fiber_reset_root_local_storage, rb_obj_is_fiber):
- add prototypes.
+ * 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").
- * 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]
+ See https://bugs.ruby-lang.org/attachments/4008/data-heap_structure.png.
- * test/ruby/test_fiber.rb (test_fork_from_fiber): add test for fork
- from fiber.
+Fri Oct 18 09:40:43 2013 Eric Hodel <drbrain@segment7.net>
-Thu Feb 16 06:30:37 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * lib/rubygems: Update to RubyGems master cee6788. Changes:
- * ext/fiddle/closure.c (callback): deal with unsinged integers.
- [ruby-core:42458][Bug #5991][Bug #6022]
+ Fix test failure on vc10-x64 Server on rubyci.org due to attempting
+ to File.chmod where it is not supported.
- * ext/fiddle/conversions.c (value_to_generic, generic_to_value):
- ditto.
+ Continuing work on improved gem dependencies file (Gemfile) support.
- * ext/fiddle/closure.c (callback): same as r34506.
+ * test: ditto.
-Wed Feb 15 10:35:43 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Fri Oct 18 06:02:49 2013 Eric Hodel <drbrain@segment7.net>
- * include/ruby/ruby.h (FIXNUM_P): simple flag should be int.
+ * lib/rubygems: Update to RubyGems master f738c67. Changes:
-Wed Feb 15 10:33:41 2012 Eric Hodel <drbrain@segment7.net>
+ Fixed test bug for ruby with ENABLE_SHARED = no
- * vm_eval.c (check_funcall): Call respond_to? with matching arity for
- legacy single-argument implementations. [ruby-trunk - Bug #6000]
+ * test/rubygems: ditto.
-Wed Feb 15 10:25:22 2012 Naohisa Goto <ngotogenome@gmail.com>
+Fri Oct 18 00:57:07 2013 Tanaka Akira <akr@fsij.org>
- * 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.
+ * lib/tsort.rb (TSort.tsort): Extracted from TSort#tsort.
+ (TSort.tsort_each): Extracted from TSort#tsort_each.
+ (TSort.strongly_connected_components): Extracted from
+ TSort#strongly_connected_components.
+ (TSort.each_strongly_connected_component): Extracted from
+ TSort#each_strongly_connected_component.
-Wed Feb 15 10:25:22 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Thu Oct 17 18:50:08 2013 Koichi Sasada <ko1@atdot.net>
- * test/ruby/test_object.rb: tests that respond_to? returns false.
+ * 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.
-Wed Feb 15 10:25:22 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Thu Oct 17 18:45:41 2013 Koichi Sasada <ko1@atdot.net>
- * vm_eval.c (check_funcall): try respond_to? first if redefined.
- [Bug #5158]
+ * string.c (STR_HEAP_SIZE): includes TERM_LEN(str).
-Wed Feb 15 07:15:50 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * string.c (rb_str_memsize): use STR_HEAP_SIZE().
- * compile.c (defined_expr): guard the whole expression.
- [ruby-dev:45021][Bug#5786]
+Thu Oct 17 17:43:00 2013 Shugo Maeda <shugo@ruby-lang.org>
-Wed Feb 15 05:08:25 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * vm_insnhelper.c (vm_call_method): set ci->me to 0 when the
+ original method of a refined method is undef to avoid SEGV.
- * ext/dl/cptr.c (rb_dlptr_s_to_ptr): use rb_check_funcall.
+ * vm_method.c (rb_method_entry_without_refinements): return 0 when
+ the original method of a refined method is undef to avoid SEGV.
- * 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.
+ * test/ruby/test_refinement.rb: related test.
-Wed Feb 15 05:04:47 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Thu Oct 17 17:38:36 2013 Koichi Sasada <ko1@atdot.net>
- * ext/dl/cptr.c (rb_dlptr_aref, rb_dlptr_aset): check NULL pointer
- dereference.
+ * gc.c, internal.h: rename ruby_xsizefree/realloc to
+ rb_sized_free/realloc.
- * test/rinda/test_rinda.rb: decrease the code that depends on timing.
- [Bug #372] [Bug #4160]
+ * array.c: catch up these changes.
-Wed Feb 15 05:03:41 2012 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
+ * string.c: ditto.
- * test/rinda/test_rinda.rb (test_remote_array_and_hash):
- add local variables to protect objects from GC. [ruby-dev:44253]
- [Bug #5104]
+Thu Oct 17 17:32:51 2013 Koichi Sasada <ko1@atdot.net>
-Wed Feb 15 05:02:43 2012 Masaki Suketa <masaki.suketa@nifty.ne.jp>
+ * array.c, string.c: use ruby_xsizedfree() and ruby_xsizedrealloc().
- * test/win32ole/test_err_in_callback.rb (test_err_in_callback):
- skip test if ADODB.connection is not available.
+ * internal.h (SIZED_REALLOC_N): define a macro as REALLOC_N().
-Wed Feb 15 04:49:23 2012 Yusuke Endoh <mame@tsg.ne.jp>
+Thu Oct 17 17:11:17 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * parse.y (debug_lines, coverage): set file path encoding for coverage
- result. [ruby-dev:44950]
+ * win32/win32.c (console_emulator_p): check by comparison between
+ module handle of WriteConsoleW and kernel32.dll.
-Tue Feb 14 16:57:11 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+ * configure.in, win32/Makefile.sub, win32/setup.mak: no longer need
+ psapi.lib.
- * 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
+Thu Oct 17 16:53:30 2013 Koichi Sasada <ko1@atdot.net>
-Tue Feb 14 16:52:17 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+ * gc.c, internal.h: add new internal memory management functions.
+ * void *ruby_xsizedrealloc(void *ptr, size_t new_size, size_t old_size)
+ * void ruby_xsizedfree(void *x, size_t size)
+ These functions accept additional size parameter to calculate more
+ accurate malloc_increase parameter which control GC timing.
+ [Feature #8985]
- * lib/rdoc/encoding.rb (RDoc::Encoding.read_file): fixup newline chars
- on Windows.
- see https://github.com/rdoc/rdoc/issues/87
+Thu Oct 17 14:21:34 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * test/rdoc/test_rdoc_markup_pre_process.rb
- (TestRDocMarkupPreProcess#test_include_file,
- TestRDocMarkupPreProcess#test_include_file_encoding_incompatible):
- follow above change.
+ * win32/file.c (rb_file_expand_path_internal): fix memory leaks at
+ a non-absolute home exception.
-Tue Feb 14 16:34:11 2012 Shota Fukumori <sorah@tubusu.net>
+Thu Oct 17 14:06:39 2013 Koichi Sasada <ko1@atdot.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].
+ * 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.
-Tue Feb 14 15:58:31 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Thu Oct 17 12:30:16 2013 Tanaka Akira <akr@fsij.org>
- * gc.c (initial_params): pack in a struct.
+ * lib/tsort.rb (TSort.each_strongly_connected_component_from):
+ Extracted from TSort#each_strongly_connected_component_from.
- * gc.c (rb_gc_set_params): set parameters always.
- [ruby-dev:44648] [Bug #5467]
+Thu Oct 17 11:07:06 2013 Eric Hodel <drbrain@segment7.net>
-Tue Feb 14 15:44:42 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+ * lib/rubygems: Update to RubyGems master 941c21a. Changes:
- * test/irb/test_completion.rb: skip if cannot load irb/completion
- (maybe readline does not exist).
+ Restored method bundler wants to remove for compatibility.
-Tue Feb 14 15:07:23 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ Improvements to Gemfile compatibility.
- * lib/test/unit/assertions.rb (build_message): skip escaped
- question marks.
+ * test/rubygems: ditto.
-Mon Feb 13 12:06:29 2012 Loren Segal <lsegal@soen.ca>
+Thu Oct 17 08:08:11 2013 Koichi Sasada <ko1@atdot.net>
- * io.c (Init_IO): use directive hack to make ARGF documentable
- in other tools. [ruby-core:42515][Bug #6007]
+ * ext/objspace/object_tracing.c (newobj_i): add workaround.
+ some bugs hits this check.
-Sun Feb 12 16:57:56 2012 Akinori MUSHA <knu@iDaemons.org>
+ * ext/objspace/object_tracing.c (object_allocations_reporter_i): cast as pointer.
- * misc/rdoc-mode.el (rdoc-imenu-create-index): Add imenu support
- to rdoc-mode.
+Thu Oct 17 07:36:53 2013 Eric Hodel <drbrain@segment7.net>
- * misc/rdoc-mode.el (rdoc-mode): Fix regexp patterns containing
- "\s " where CR/LF is not supposed to match.
+ * lib/rubygems: Update to RubyGems master 2abce58. Changes:
-Sun Feb 12 16:56:23 2012 Akinori MUSHA <knu@iDaemons.org>
+ Fixed documentation generation when sdoc and json are installed as
+ gems.
- * misc/rdoc-mode.el (rdoc-mode): Add provide so that requiring
- this library succeeds.
+ Added some missing documentation.
-Sun Feb 12 16:53:18 2012 Akinori MUSHA <knu@iDaemons.org>
+Thu Oct 17 07:10:26 2013 Zachary Scott <e@zzak.io>
- * 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.
+ * ext/curses/curses.c: [DOC] Cleaned up formatting consistency of rdoc
+ comments for Curses, including period spacing and column width.
- * lib/tempfile.rb (Tempfile#unlink, Tempfile::Remover#call): My
- comment about thread safeness is obsolete.
+ This patch also fixed some typos. Thanks to @postmodern for the patch!
+ [Fixes GH-420] https://github.com/ruby/ruby/pull/420
-Sun Feb 12 16:50:28 2012 Akinori MUSHA <knu@iDaemons.org>
+Thu Oct 17 06:58:42 2013 Zachary Scott <e@zzak.io>
- * lib/shellwords.rb: Fix rdoc markups.
+ * 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
-Sun Feb 12 16:50:28 2012 Akinori MUSHA <knu@iDaemons.org>
+Thu Oct 17 05:52:31 2013 Zachary Scott <e@zzak.io>
- * lib/shellwords.rb (Shellwords#shellsplit): Fix a bug where
- consecutive backslashes in double quotes are all removed except
- the one at the tail.
+ * 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
-Sun Feb 12 16:38:13 2012 Akinori MUSHA <knu@iDaemons.org>
+Thu Oct 17 05:40:33 2013 Koichi Sasada <ko1@atdot.net>
- * lib/shellwords.rb (Shellwords#shellescape): Drop the //n flag
- that only causes warnings with no real effect. [Bug #5637]
+ * gc.c (objspace_each_objects): do not skip empty RVALUEs.
-Sun Feb 12 16:34:55 2012 Akinori MUSHA <knu@iDaemons.org>
+Thu Oct 17 05:31:31 2013 Koichi Sasada <ko1@atdot.net>
- * tool/merger.rb (#default_merge_branch): Add support for
- Subversion 1.7 which adopted a whole new working directory
- structure.
+ * error.c (rb_bug_reporter_add): return simply 0 if failed.
+ Please check return value.
-Sun Feb 12 09:38:46 2012 Yukihiro Matsumoto <matz@ruby-lang.org>
+Thu Oct 17 05:17:33 2013 Koichi Sasada <ko1@atdot.net>
- * vm_method.c (rb_add_method): should not call method_added hook
- for undef operation. [Bug #5015]
+ * 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.
-Sun Feb 12 09:29:28 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Wed Oct 16 22:35:27 2013 Zachary Scott <e@zzak.io>
- * regint.h (PLATFORM_UNALIGNED_WORD_ACCESS): Power PC does not
- allow unaligned word access.
+ * ext/io/nonblock/nonblock.c: use rb_cIO instead of VALUE
- * st.c (UNALIGNED_WORD_ACCESS): x86_64 allows unaligned word
- access as well as i386.
+Wed Oct 16 17:45:13 2013 Koichi Sasada <ko1@atdot.net>
-Sat Feb 11 08:06:12 2012 Tanaka Akira <akr@fsij.org>
+ * bootstraptest/runner.rb: check nil before calling `signal?'
+ for a process status.
- * test/openssl/test_ssl.rb (test_multibyte_read_write): start server
- for each length to avoid race condition.
+Wed Oct 16 17:37:17 2013 Koichi Sasada <ko1@atdot.net>
-Sat Feb 11 06:13:07 2012 NARUSE, Yui <naruse@ruby-lang.org>
+ * 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.
- * dir.c (fnmatch): The * needs to be escaped to avoid formatting in
- fnmatch comment.
- patched by @dalton. https://github.com/ruby/ruby/pull/91
+ * ext/-test-/bug_reporter/bug_reporter.c: add a test for this C-API.
-Sat Feb 11 03:38:48 2012 Hiroshi Shirosaki <h.shirosaki@gmail.com>
+ * ext/-test-/bug_reporter/extconf.rb: ditto.
- * io.c (rb_sys_fail_path): move the definition.
- Move above for using it in set_binary_mode_with_seek_cur().
+ * test/-ext-/bug_reporter/test_bug_reporter.rb: ditto.
- * 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.
+Wed Oct 16 15:14:21 2013 Koichi Sasada <ko1@atdot.net>
- And cleanups as below.
- Remove unnecessary parentheses of `fptr`.
- Use return value of setmode().
+ * NEWS: add a line into NEWS for last commit.
- * test/ruby/test_io_m17n.rb
- (TestIO_M17N#test_seek_with_setting_binmode): add a test for abobe.
- [ruby-core:41671] [Bug #5714]
+Wed Oct 16 15:09:14 2013 Koichi Sasada <ko1@atdot.net>
-Sat Feb 11 03:38:48 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+ * 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/ruby/test_io_m17n.rb
- (TestIO_M17N#test_{read_with_binmode_and_get[cs]}): only for Windows.
+ * test/objspace/test_objspace.rb: add a test.
-Sat Feb 11 03:38:48 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+Wed Oct 16 15:00:21 2013 Eric Hodel <drbrain@segment7.net>
- * win32/win32.c, include/ruby/win32.h (rb_w32_fd_is_text): new function.
+ * lib/rubygems: Update to RubyGems master b955554. Changes:
- * win32/win32.c (init_stdhandle): set default mode of stdin as binmode.
+ Fixed NameError for Gem::Ext due to re-entering file lookup in
+ RubyGems' overridden require. Bug by Koichi Sasada.
- * 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.
+ Fixed possible circular require warning in tests.
- * io.c (do_writeconv): set text mode when needed.
+ Used existing constant for `gem install -g` dependency file list.
- * 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/rubygems: ditto.
- * 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.
+Wed Oct 16 09:42:42 2013 Eric Hodel <drbrain@segment7.net>
- all patches are written by Hiroshi Shirosaki. [ruby-core:41496]
- [Feature #5714]
+ * lib/rubygems: Update to RubyGems master 278d00d. Changes:
-Sat Feb 11 03:37:56 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+ Fixes building extensions without a "clean" make rule
- * test/rexml/test_order.rb (OrderTester#test_more_ordering): use
- GZip::GzReader.open instead of GZip::GzReader.new with File.new.
- fixed a test error on Windows introduced at r33946.
+ Adds gem dependency file autodetection to "gem install -g"
-Sat Feb 11 03:37:34 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+ * test/rubygems: Tests for the above.
- * 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
- fixed test errors on Windows introduced at r33953.
- the maintainer of this library should judge it.
- 2nd, usually Zlib::GzReader.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.
+Wed Oct 16 09:12:23 2013 Eric Hodel <drbrain@segment7.net>
- fixed test errors on Windows introduced at r33947.
-Sat Feb 11 03:23:58 2012 Luis Lavena <luislavena@gmail.com>
+ * lib/rubygems: Update to RubyGems master commit 2a74263. This fixes
+ several bugs in RubyGems 2.2.0.preview.1.
- * ext/zlib/zlib.c (rb_gzreader_initialize): use binary mode by default
- under Windows. Patch by Hiroshi Shirosaki. [ruby-core:40706]
- [Feature #5562]
+ * test/rubygems: ditto.
- * include/ruby/encoding.h (void rb_econv_binmode): define NEWLINE
- decorator.
+Wed Oct 16 07:25:02 2013 Aman Gupta <ruby@tmm1.net>
- * 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.
+ * gc.c (gc_mark_roots): rename roots to be categories
+ instead of function names.
- * test/ruby/test_io_m17n.rb (EOT): add test for pipe and stdin in
- binary mode.
+Tue Oct 15 19:18:13 2013 Koichi Sasada <ko1@atdot.net>
- * win32/win32.c (init_stdhandle): remove O_BINARY from stdhandle
- initialization.
- * win32/win32.c (rb_w32_write): use FTEXT mode accordingly.
+ * 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.
-Sat Feb 11 03:20:22 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+ * gc.c (gc_mark_roots): separate from gc_marks_body().
- * io.c (argf_next_argv): wrong timing of setting ecflags.
- fixed the failure of TestArgf#test_textmode introduced at r33662.
+Tue Oct 15 17:47:59 2013 Tanaka Akira <akr@fsij.org>
-Sat Feb 11 03:19:45 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+ * process.c: Fix a typo. MacOS X doesn't have ENOTSUPP.
- * test/ruby/test_io_m17n.rb
- (TestIO_M17N#test_default_stdout_stderr_mode): new test for
- r33627-33629. see [backport #5565]
-Sat Feb 11 03:20:22 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+Mon Oct 14 12:32:52 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * include/ruby/encoding.h (ECONV_NEWLINE_DECORATOR_READ_MASK,
- ECONV_NEWLINE_DECORATOR_WRITE_MASK): new macro.
+ * ruby.c (process_options): load statically linked extensions before
+ rubygems, because of ext/thread.
- * 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.
+ * ruby.c (process_options): use gem_prelude instead of requiring
+ rubygems directly when --enable=gems is given.
- * io.c (make_writeconv): drop decorators for reading.
+ * Makefile.in (DEFAULT_PRELUDES): always use gem_prelude regardless of
+ --disable-rubygems.
- * io.c (make_readconv): drop decorators for writing.
+Mon Oct 14 11:07:51 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * io.c (do_writeconv): existing writeconv is not the condition to raise
- ArgumentError. should check textmode or not.
+ * 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.
- * test/ruby/test_io_m17n.rb
- (TestIO_M17N#test_{cr,lf,crlf}_decorator_on_stdout): test above
- changes.
+ * 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>
-Sat Feb 11 03:19:45 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+ * vsnprintf.c: Fix spelling from compliment to complement.
+ Patch by @agrimm.
- * 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.
+ * include/ruby/ruby.h: ditto
-Sat Feb 11 03:17:41 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+Sun Oct 13 20:59:27 2013 Nobuyoshi Nakada <nobu@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].
+ * vm.c (Init_BareVM): initialize defined_module_hash here,
+ Init_top_self() is too late to register core classes/modules.
-Sat Feb 11 03:13:27 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * compile.c (compile_array_): no hash to merge if it is empty.
- * transcode.c: enabled econv newline option.
+ * vm.c (m_core_hash_merge_kwd): just check keys if only one argument
+ is given, without merging.
-Sat Feb 11 02:39:09 2012 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
+Sat Oct 12 06:35:01 2013-10-11 Eric Hodel <drbrain@segment7.net>
- * variable.c (set_const_visibility): clear inine-cache when constant's
- visibility is modified. [ruby-dev:44929]
+ * lib/rake: Update to rake 10.1.0
+ * bin/rake: ditto.
+ * test/rake: ditto.
- * test/ruby/test_module.rb (test_private_constants_clear_inlinecache):
- add test for it.
+ * NEWS: Update NEWS to include rake 10.1.0 and links to release notes.
-Sat Feb 11 02:39:09 2012 Yusuke Endoh <mame@tsg.ne.jp>
+Sat Oct 12 03:26:04 2013 Koichi Sasada <ko1@atdot.net>
- * variable.c (set_const_visibility): print a warning when no argument
- is passwd to Module#private_constant. [ruby-list:48558]
+ * class.c, variable.c, gc.c (rb_class_tbl): removed.
- * vm_method.c (set_method_visibility): ditto for
- Module#private_class_method.
+ * 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.
-Sat Feb 11 02:39:09 2012 Yusuke Endoh <mame@tsg.ne.jp>
+ * gc.c (RGENGC_PRINT_TICK): disable (revert).
- * 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]
+Sat Oct 12 03:24:49 2013 Koichi Sasada <ko1@atdot.net>
- * test/ruby/test_module.rb: add a test for above.
+ * vm_method.c (rb_gc_mark_unlinked_live_method_entries):
+ revert last commit to introduce debug prints.
-Sat Feb 11 02:39:09 2012 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
+Fri Oct 11 21:05:19 2013 Koichi Sasada <ko1@atdot.net>
- * variable.c (set_const_visibility): clear inine-cache when constant's
- visibility is modified. [ruby-dev:44929]
+ * internal.h, parse.y: use `full_mark' instead of `full_marking'.
- * test/ruby/test_module.rb (test_private_constants_clear_inlinecache):
- add test for it.
+Fri Oct 11 20:58:16 2013 Koichi Sasada <ko1@atdot.net>
-Sat Feb 11 02:39:09 2012 Yusuke Endoh <mame@tsg.ne.jp>
+ * gc.c: use terminology `full_mark' instead of `minor_gc'
+ in mark functions.
- * variable.c (set_const_visibility): print a warning when no argument
- is passwd to Module#private_constant. [ruby-list:48558]
+Fri Oct 11 20:46:09 2013 Koichi Sasada <ko1@atdot.net>
- * vm_method.c (set_method_visibility): ditto for
- Module#private_class_method.
+ * gc.c: use __GNUC__ instead of __GCC__.
-Sat Feb 11 02:39:09 2012 Yusuke Endoh <mame@tsg.ne.jp>
+Fri Oct 11 20:35:59 2013 Koichi Sasada <ko1@atdot.net>
- * 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]
+ * 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.
- * test/ruby/test_module.rb: add a test for above.
+ * internal.h: change prototype of rb_gc_mark_symbols().
-Sat Feb 11 02:26:51 2012 Martin Bosslet <Martin.Bosslet@googlemail.com>
+Fri Oct 11 19:27:22 2013 Akinori MUSHA <knu@iDaemons.org>
- * lib/openssl/buffering.rb: Force multi-byte strings to be treated as
- binary data.
- * test/openssl/test_ssl.rb: Add test for it.
+ * 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.
- Thanks to Niklas Baumstark for reporting the issue!
+ * ruby-forward-sexp is inappropriate here because it moves the
+ cursor past the keyword.
- [Ruby 1.9 - Bug #5233] [ruby-core:39120]
+ * Fix a reversed looking-back check in
+ ruby-electric--block-beg-keyword-at-point-p.
-Fri Feb 10 17:25:28 2012 Tanaka Akira <akr@fsij.org>
+ * Do not add end again if space or return is hit repeatedly
+ after a block beginning keyword.
- * 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]
+Fri Oct 11 18:12:47 2013 Koichi Sasada <ko1@atdot.net>
-Fri Feb 10 17:02:12 2012 okkez <okkez000@gmail.com>
+ * ext/objspace/gc_hook.c: prohibit reentrant.
- * thread_pthread.c (rb_thread_create_timer_thread): fix memory
- leak. [ruby-dev:44904] [Bug #5688]
+Fri Oct 11 18:11:34 2013 Koichi Sasada <ko1@atdot.net>
-Fri Feb 10 05:22:32 2012 NARUSE, Yui <naruse@ruby-lang.org>
+ * vm_trace.c (rb_postponed_job_flush): fix bit operation.
- * cont.c (fiber_setcontext): Use longjmp() instead of swapcontext() on
- FreeBSD 9. [ruby-dev:41316] [Bug #3295] [Bug #5526]
+Fri Oct 11 17:33:24 2013 Akinori MUSHA <knu@iDaemons.org>
-Fri Feb 10 05:13:12 2012 Ayumu AIZAWA <ayumu.aizawa@gmail.com>
+ * 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.
- * object.c: Added examples for Object#is_a? and
- Object#instance_of? patcheed from Manoj Kumar.
- [Bug #5880] [ruby-core:42057]
+ * 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.
-Fri Feb 10 05:11:43 2012 NARUSE, Yui <naruse@ruby-lang.org>
+ * Add ruby-electric-mode-hook.
- * io.c (argf_next_argv): reset ARGF.next_p on ARGV.replace.
- r34409 breaks replacing ARGV.
- [ruby-dev:45160] [Bug #5952]
+ * Use a remap in binding ruby-electric-delete-backward-char.
-Fri Feb 10 05:11:43 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * Totally revamp electric keywords and then introduce electric
+ return. Modifier keywords are now properly detected making
+ use of ruby-mode's indentation level calculator, and
- * io.c (argf_close): skip stdin, which should be readable again.
- [ruby-dev:45160] [Bug #5952]
+ * block-mid keywords (then, else, elsif, when, rescue and
+ ensure) also become electric with automatic reindentation.
- * io.c (argf_readlines): reinitialize after all read to be
- readable again.
+ * Add standardized comments for ELPA integration.
-Fri Feb 9 01:36:19 2012 Martin Bosslet <Martin.Bosslet@googlemail.com>
+ * Fix interaction with smartparens-mode by disabling its end
+ keyword completion, since ruby-electric has become more clever
+ at it.
- * backport r34482 from trunk
+ * The custom variable `ruby-electric-keywords` is changed to
+ `ruby-electric-keywords-alist`, allowing user to fine-grained
+ configuration.
- * ext/openssl/ossl_ssl.c: Add SSL constants and allow to unset SSL
- option to prevent BEAST attack. See [Bug #5353].
+Fri Oct 11 16:53:28 2013 Koichi Sasada <ko1@atdot.net>
- In OpenSSL, OP_DONT_INSERT_EMPTY_FRAGMENTS is used to prevent
- TLS-CBC-IV vulunerability 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)
+ * vm_trace.c (rb_postponed_job_flush): simplify.
- 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.
+Fri Oct 11 03:36:49 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- 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.
+ * thread.c (rb_threadptr_execute_interrupts): flush postponed job only
+ once at last.
- Following is an example to enable 0/n split for BEAST prevention.
+ * 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]
- ctx.options = OP_ALL & ~OP_DONT_INSERT_EMPTY_FRAGMENTS
+Thu Oct 10 23:04:00 2013 Masaki Matsushita <glass.saga@gmail.com>
- * test/openssl/test_ssl.rb: Test above option exists.
+ * array.c (rb_ary_or): remove unused variables.
-Thu Feb 9 17:08:20 2012 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
+Thu Oct 10 23:01:16 2013 Masaki Matsushita <glass.saga@gmail.com>
- * cont.c (cont_mark): mark original Thread object from saved_thread.
- [ruby-dev:44567] [Bug #5386]
+ * array.c (rb_ary_or): use rb_hash_keys().
-Thu Feb 9 17:05:07 2012 NARUSE, Yui <naruse@ruby-lang.org>
+Thu Oct 10 21:36:16 2013 Masaki Matsushita <glass.saga@gmail.com>
- * cont.c (HAVE_GETCONTEXT): see getcontext(3) because DragonFly BSD
- x64 port doesn't have it.
+ * array.c (rb_ary_compact_bang): use ary_resize_smaller().
-Thu Feb 9 16:19:04 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+Thu Oct 10 17:25:28 2013 Koichi Sasada <ko1@atdot.net>
- * test/ruby/memory_status.rb (Memory::Win32): 64bit support.
+ * vm.c (vm_exec): support :b_return event for "lambda{return}.call".
+ [Bug #8622]
-Thu Feb 9 16:19:04 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+ * test/ruby/test_settracefunc.rb: add a test.
- * ext/dl/lib/value.rb (DL::ValueUtil.{unsigned_value,signed_value}):
- currenly pack/unpack does not accept "q!" and "Q!".
+Thu Oct 10 13:52:37 2013 Koichi Sasada <ko1@atdot.net>
-Thu Feb 9 16:19:04 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+ * 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.
- * ext/fiddle/conversions.c (value_to_generic): src is not guranteed as
- a Bignum if the type is LONG_LONG. it may be a Fixnum if the value
- is small.
+ * vm_core.h: change data structure.
-Thu Feb 9 16:19:04 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+Thu Oct 10 11:11:33 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * ext/dl/lib/types.rb: Win64 support.
+ * vm.c (Init_VM): hide also the singleton class of frozen-core, not
+ only frozen-core itself.
-Thu Feb 9 11:11:15 2012 Hiroshi Shirosaki <h.shirosaki@gmail.com>
+Thu Oct 10 06:02:08 2013 Koichi Sasada <ko1@atdot.net>
- * 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]
+ * test/ruby/test_rand.rb: fix r43224. local variable `e' is
+ no longer available.
-Thu Feb 9 11:11:15 2012 Tanaka Akira <akr@fsij.org>
+Thu Oct 10 00:02:35 2013 Yusuke Endoh <mame@tsg.ne.jp>
- * 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]
+ * 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.
-Thu Feb 9 11:11:15 2012 Tanaka Akira <akr@fsij.org>
+Wed Oct 9 23:57:02 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * ext/dbm/extconf.rb: detect gdbm_version in libgdbm.
+ * object.c (id_for_attr): avoid inadvertent symbol creation.
- * ext/dbm/dbm.c: make DBM::VERSION more informative for gdbm, qdbm and
- Berkeley DB 1.x. [ruby-dev:44944]
+Wed Oct 9 18:03:01 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Thu Feb 9 07:32:40 2012 NARUSE, Yui <naruse@ruby-lang.org>
+ * vm_method.c (rb_attr): preserve encoding of the attribute ID in
+ error message.
- * numeric.c (rb_enc_uint_char): raise RangeError when added codepoint
- is invalid. [Feature #5855] [Bug #5863] [Bug #5864]
+Wed Oct 9 17:40:16 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * string.c (rb_str_concat): ditto.
+ * 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]
- * 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.
+Wed Oct 9 13:53:14 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * regenc.c (onigenc_mb2_code_to_mbclen): rearrange error code.
+ * compar.c (cmp_eq): fail if recursion. [ruby-core:57736] [Bug #9003]
- * enc/euc_jp.c (code_to_mbclen): ditto.
+ * thread.c (rb_exec_recursive_paired_outer): new function which is
+ combination of paired and outer variants.
- * enc/shift_jis.c (code_to_mbclen): ditto.
+Wed Oct 9 09:18:14 2013 Koichi Sasada <ko1@atdot.net>
-Thu Feb 9 07:28:43 2012 NARUSE, Yui <naruse@ruby-lang.org>
+ * 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().
- * test/pathname/test_pathname.rb: not read but binread.
- patched by Benoit Daloze, [ruby-core:42440] [Bug #5984]
+ * ext/-test-/debug/profile_frames.c,
+ test/-ext-/debug/test_profile_frames.rb: fix a test for this change.
-Wed Feb 8 22:29:59 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * string.c (rb_str_modify_expand): fix memory leak.
+Wed Oct 9 00:55:51 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Wed Feb 8 10:58:45 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * load.c (load_lock): display backtrace to $stderr at circular
+ require.
- * ext/readline/readline.c (readline_attempted_completion_function):
- respect encodings. [Bug #5941]
+ * vm_backtrace.c (rb_backtrace_print_to): new function to print
+ backtrace to the given output.
-Wed Feb 8 10:56:00 2012 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
+Tue Oct 8 21:03:35 2013 Koichi Sasada <ko1@atdot.net>
- * ext/readline/readline.c (readline_attempted_completion_function):
- fix compile error.
+ * 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)
-Wed Feb 8 10:56:00 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * iseq.c (rb_iseq_klass), internal.h: add new internal function
+ rb_iseq_method_name().
- * ext/readline/readline.c (readline_attempted_completion_function):
- empty completion result does not mean memory error.
+ * ext/-test-/debug/profile_frames.c (profile_frames),
+ test/-ext-/debug/test_profile_frames.rb: add a test.
-Wed Feb 8 10:54:49 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Tue Oct 8 16:11:11 2013 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]
+ * array.c (rb_ary_uniq): use rb_hash_values(), as well as the case no
+ block is given.
-Wed Feb 8 10:52:51 2012 NARUSE, Yui <naruse@ruby-lang.org>
+ * internal.h: define rb_hash_values() as internal API.
- * 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.
+Tue Oct 8 13:53:21 2013 Masaki Matsushita <glass.saga@gmail.com>
- * ext/readline/readline.c (hist_set): use history_replace_offset_func.
+ * array.c (rb_ary_uniq): use rb_hash_keys().
-Wed Feb 8 10:52:36 2012 NARUSE, Yui <naruse@ruby-lang.org>
+ * internal.h: define rb_hash_keys() as internal API.
- * ext/readline/readline.c (Init_readline): fix wrong condition.
+ * hash.c (rb_hash_keys): ditto.
-Wed Feb 8 10:50:11 2012 Naohisa Goto <ngotogenome@gmail.com>
+Tue Oct 8 10:56:39 2013 KOSAKI Motohiro <kosaki.motohiro@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]
+ * 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]
-Wed Feb 8 10:38:36 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Tue Oct 8 05:58:12 2013 Tanaka Akira <akr@fsij.org>
- * Makefile.in (CFLAGS): append ARCH_FLAG.
+ * lib/time.rb (Time.strptime): Time.strptime('0', '%s') returns local
+ time Time object as Ruby 2.0 and before.
- * configure.in (ARCH_FLAG): exclude from CFLAGS.
+Tue Oct 8 05:40:37 2013 Eric Hodel <drbrain@segment7.net>
-Wed Feb 08 09:19:00 2012 Martin Bosslet <Martin.Bosslet@googlemail.com>
+ * .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
- * ext/openssl/ossl_cipher.c: Add warning about key as IV.
+Tue Oct 8 04:28:25 2013 Akinori MUSHA <knu@iDaemons.org>
-Wed Feb 8 10:37:31 2012 Martin Bosslet <Martin.Bosslet@googlemail.com>
+ * misc/ruby-mode.el: Use preceding-char/following-char
+ (returning 0 at BOF/EOF) instead of char-before/char-after
+ (returning nil at BOF/EOF) to avoid error from char-syntax when
+ at BOF/EOF.
- * ext/openssl/ossl_cipher.c: Update and complete documentation.
+Tue Oct 8 04:12:45 2013 Akinori MUSHA <knu@iDaemons.org>
-Wed Feb 08 09:57:33 2012 Martin Bosslet <Martin.Bosslet@googlemail.com>
+ * misc/ruby-additional.el (ruby-mode-set-encoding): Add a missing
+ else clause to unbreak with `cp932`, etc.
- * 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]
+ * misc/ruby-mode.el (ruby-mode-set-encoding): Ditto.
-Wed Feb 8 10:34:59 2012 TAKAO Kouji <kouji@takao7.net>
+Tue Oct 8 03:57:34 2013 Akinori MUSHA <knu@iDaemons.org>
- * 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]
+ * misc/ruby-additional.el (ruby-mode-set-encoding): Use
+ `default-buffer-file-coding-system` if the :prefer-utf-8
+ property is not available.
-Wed Feb 8 09:47:52 2012 Tanaka Akira <akr@fsij.org>
+ * misc/ruby-mode.el (ruby-mode-set-encoding): Ditto.
- * test/ruby/test_sleep.rb (test_sleep_5sec): 0.1sec tolerance is too
- small for busy environment.
+ * misc/ruby-additional.el (ruby-encoding-map): Override the
+ default value.
-Wed Feb 8 09:45:23 2012 Tanaka Akira <akr@fsij.org>
+Tue Oct 8 03:19:19 2013 Akinori MUSHA <knu@iDaemons.org>
- * test/dbm/test_dbm.rb: split tests for read only database.
+ * misc/ruby-additional.el (ruby-mode-set-encoding): Add support
+ for `prefer-utf-8` which was introduced in Emacs trunk.
- * test/gdbm/test_gdbm.rb: ditto.
+ * 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.
-Wed Feb 8 09:43:48 2012 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
+ * misc/ruby-additional.el (ruby-mode-set-encoding): Add support
+ for encodings mapped to nil in `ruby-encoding-map`.
- * error.c (name_err_mesg_to_str): clear rb_thread_t::errinfo when
- ignore exception under rb_protect(). [ruby-core:41612] [Bug #5755]
+ * 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.
- * test/ruby/test_exception.rb (test_exception_in_name_error_to_str):
- add a corresponding test.
+ * misc/ruby-additional.el (ruby-encoding-map): Add type
+ declaration for better customize UI.
-Wed Feb 8 09:36:42 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * misc/ruby-mode.el: Ditto for the above.
- * encoding.c (require_enc): reject only loading from untrusted
- load paths. [ruby-dev:44541] [Bug #5279]
+Tue Oct 8 00:14:53 2013 Akinori MUSHA <knu@iDaemons.org>
- * transcode.c (load_transcoder_entry): ditto.
+ * misc/ruby-additional.el: Add a standard header and footer,
+ including (provide 'ruby-additional).
-Wed Feb 8 09:36:42 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Mon Oct 7 22:52:45 2013 Akinori MUSHA <knu@iDaemons.org>
- * encoding.c (load_encoding): predefined encoding names are safe.
- [ruby-dev:44469] [Bug #5279]
+ * 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.
- * transcode.c (load_transcoder_entry): ditto.
+ * misc/ruby-electric.el (ruby-electric-keywords): New custom
+ variable to replace `ruby-electric-simple-keywords-re` with.
-Tue Feb 7 14:29:16 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Mon Oct 7 22:52:16 2013 Akinori MUSHA <knu@iDaemons.org>
- * st.c (st_foreach): should not yield same pair when checking
- after unpacking.
+ * 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.
-Tue Feb 7 14:03:45 2012 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
+Mon Oct 7 22:45:20 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * lib/tempfile.rb (Tempfile#_close): clear @tempfile and @data[1] even
- when exception is raised at @tempfile.close. [ruby-dev:45113]
+ * cont.c (FIBER_USE_NATIVE): split long conditions.
- * lib/tempfile.rb (Tempfile#unlink): fix a typo.
+Mon Oct 7 20:29:31 2013 Zachary Scott <e@zzak.io>
-Tue Feb 7 14:02:32 2012 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
+ * lib/time.rb: [DOC] typo in Time.rb overview by @srt32 [Fixes GH-416]
+ https://github.com/ruby/ruby/pull/416
- * 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]
+Mon Oct 7 20:07:20 2013 Tanaka Akira <akr@fsij.org>
-Tue Feb 7 13:59:26 2012 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
+ * lib/time.rb (Time.strptime): Use :offset.
+ Patch by Felipe Contreras. [ruby-core:57694]
- * gc.c (run_finalizer): clear rb_thread_t::errinfo when ignore
- an exception under rb_protect(). [ruby-dev:45113]
+Mon Oct 7 16:47:27 2013 Koichi Sasada <ko1@atdot.net>
-Mon Feb 6 15:34:47 2012 Tanaka Akira <akr@fsij.org>
+ * test/-ext-/debug/test_profile_frames.rb: rename class C to
+ something long name because one test depends on absence of
+ class ::C.
- * ruby.c (fill_standard_fds): use fstat() instead of fcntl(F_GETFD)
- for MinGW. reported by Luis Lavena. [ruby-core:40526] [Bug #5516]
+Mon Oct 7 16:33:10 2013 Koichi Sasada <ko1@atdot.net>
-Mon Feb 6 15:34:47 2012 Tanaka Akira <akr@fsij.org>
+ * ext/-test-/debug/profile_frames.c:
+ test/-ext-/debug/test_profile_frames.rb: add a test for new C-APIs.
- * ruby.c (fill_standard_fds): new function to open closed standard
- file descriptors.
- (ruby_sysinit): call fill_standard_fds.
+Mon Oct 7 16:12:36 2013 Koichi Sasada <ko1@atdot.net>
-Mon Feb 6 15:19:17 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * 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.
- * 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]
+ * 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.
-Mon Feb 6 15:01:55 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ 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_eval.c (vm_call0): should pass block to enumerators. patched
- by Kazuki Tsujimoto. [ruby-dev:44961][Bug #5731]
+ * vm_backtrace.c: implement above APIs.
- * vm_eval.c (method_missing), vm_insnhelper.c (vm_call_method):
- ditto. patched by satoshi shiba.
+ * iseq.c (rb_iseq_klass): return local_iseq's class.
-Mon Feb 6 21:52:20 2012 Yuki Sonoda (Yugui) <yugui@yugui.jp>
+Mon Oct 7 14:26:01 2013 Koichi Sasada <ko1@atdot.net>
- * 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.
+ * proc.c: catch up last commit.
+ Type of return value of rb_iseq_first_lineno() is now VALUE.
- Reported by Rainer Orth <ro AT cebitec.uni-bielefeld.de>,
- patch by George Koehler <xkernigh AT netscape.net>.
+ * vm_insnhelper.c (argument_error): ditto.
-Mon Feb 6 21:21:46 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+ * vm_method.c (rb_method_entry_make): ditto.
- * test/unit/assertions.rb (MINI_DIR): quick dirty hack to get rid of
- warnings when using assert/assert_respond_to.
+Mon Oct 7 14:07:45 2013 Koichi Sasada <ko1@atdot.net>
-Mon Feb 6 20:38:19 2012 NARUSE, Yui <naruse@ruby-lang.org>
+ * 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);
- * file.c (file_expand_path): reset coderange after expanding path.
+ * 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.
-Mon Feb 6 20:32:17 2012 Tadayoshi Funaba <tadf@dotrb.org>
+ * proc.c. vm_insnhelper.c, vm_method.c: catch up this change.
- * ext/date/date_strptime.c: moved detector of leftover.
+Sun Oct 6 08:37:39 2013 Zachary Scott <e@zzak.io>
-Mon Feb 6 20:32:17 2012 Tadayoshi Funaba <tadf@dotrb.org>
+ * lib/webrick.rb: [DOC] fix grammar in WEBrick overview [Fixes GH-413]
+ Based on patch by @chastell https://github.com/ruby/ruby/pull/413
- * ext/date/date_parse.c: [ruby-core:42173].
+Sat Oct 5 11:21:01 2013 Aaron Pfeifer <aaron.pfeifer@gmail.com>
-Mon Feb 6 20:31:35 2012 Tadayoshi Funaba <tadf@dotrb.org>
+ * thread.c (terminate_atfork_i): fix locking mutexes not unlocked in
+ forks when not tracked in thread. [ruby-core:55102] [Bug #8433]
- * ext/date/date_core.c: uses to_integer instead.
- * test/date/test_switch_hitter.rb: added a test.
+Fri Oct 4 19:54:09 2013 Zachary Scott <e@zzak.io>
-Mon Feb 6 20:31:35 2012 NARUSE, Yui <naruse@ruby-lang.org>
+ * ext/dbm/dbm.c: [DOC] Fix wrong constant name in DBM by @edward
+ [Fixes GH-409] https://github.com/ruby/ruby/pull/409
- * ext/date/date_core.c (wholenum): fix the type of the return value.
+Fri Oct 4 19:49:42 2013 Aman Gupta <ruby@tmm1.net>
-Mon Feb 6 20:31:35 2012 Tadayoshi Funaba <tadf@dotrb.org>
+ * gc.c: rename heap.free_num as heap.swept_num to clarify meaning and
+ avoid confusion with objspace_free_num().
- * ext/date/date_core.c: [ruby-dev:45008].
+Fri Oct 4 19:02:01 2013 Aman Gupta <ruby@tmm1.net>
-Mon Feb 6 16:38:56 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+ * gc.c (objspace_free_num): new method for available/free slots on
+ heap. [ruby-core:57633] [Bug #8983]
+ * gc.c (gc_stat): change heap_free_num definition to use new method.
+ * test/ruby/test_gc.rb: test for above.
- * win32/win32.c (unixtime_to_filetime): should check the return value
- of localtime(). reported by snowjail at gmail.com.
- [ruby-dev:44838] [Bug #5596]
+Fri Oct 4 18:53:42 2013 Aman Gupta <ruby@tmm1.net>
-Mon Feb 6 16:36:25 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * gc.c: add rb_objspace.limit to keep accurate count of total heap
+ slots [ruby-core:57633] [Bug #8983]
- * 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
+Fri Oct 4 09:32:33 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Mon Feb 6 16:31:16 2012 NAKAMURA Usaku <usa@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]
- * 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.
+Thu Oct 3 18:20:47 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Mon Feb 6 16:21:57 2012 NARUSE, Yui <naruse@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]
- * file.c (file_expand_path): reset coderange after expanding path.
+Thu Oct 3 18:01:44 2013 Koichi Sasada <ko1@atdot.net>
-Mon Feb 6 00:06:39 2012 NARUSE, Yui <naruse@ruby-lang.org>
+ * gc.c: define gc_profile_record::allocated_size if
+ CALC_EXACT_MALLOC_SIZE is true.
- * 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
+Thu Oct 3 13:42:51 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Fri Feb 3 16:16:10 2012 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]
- * test/ruby/envutil.rb (EnvUtil.invoke_ruby): yield also child pid
- in block form.
+Thu Oct 3 00:17:15 2013 Akinori MUSHA <knu@iDaemons.org>
-Fri Feb 3 16:16:10 2012 Hiroshi Shirosaki <h.shirosaki@gmail.com>
+ * misc/ruby-additional.el: Properly quote the body. An unquoted
+ body given to eval-after-load is evaluated immediately!
- * test/ruby/test_thread.rb
- (TestThreadGroup#test_thread_timer_and_interrupt): skip exit status
- assertion because we cannot get signal status on Windows.
+Wed Oct 2 21:38:30 2013 Yusuke Endoh <mame@tsg.ne.jp>
- * win32/win32.c (CreateChild): create process group to receive the
- signal by GenerateConsoleCtrlEvent().
+ * 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.
- * 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]
+Wed Oct 2 21:37:04 2013 Yusuke Endoh <mame@tsg.ne.jp>
-Fri Feb 3 16:16:10 2012 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
+ * random.c (make_seed_value): a local array declaration was accessed
+ out of scope. Coverity Scan found this bug.
- * test/ruby/envutil.rb (invoke_ruby): remove :timeout option before
- pass it to Kernel#spawn.
+Wed Oct 2 18:52:40 2013 Koichi Sasada <ko1@atdot.net>
-Fri Feb 3 10:10:02 2012 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
+ * gc.c: relax GC condition due to malloc_limit.
- * 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().
+ * gc.c (GC_MALLOC_LIMIT_MAX): change default value
+ (256MB -> 512MB) and permit zero to ignore max value.
-Fri Feb 3 10:10:02 2012 NARUSE, Yui <naruse@ruby-lang.org>
+ * gc.c (vm_malloc_increase, vm_xrealloc): do not cause GC on realloc.
- * 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.
+ * gc.c (gc_before_sweep): change debug messages.
-Wed Feb 1 09:50:10 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Wed Oct 2 16:26:49 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * doc/re.rdoc (Repetition): fix typo. reported by Ori Avtalion
- and patched by Zachary Scott. [Bug #5947]
+ * io.c (rb_io_close_read): duplex IO should wait its child process
+ even after close_read.
-Tue Jan 24 11:38:05 2012 NARUSE, Yui <naruse@ruby-lang.org>
+Wed Oct 2 15:39:13 2013 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]
+ * 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
- * lib/uri/common.rb (URI.decode_www_form_component): initialize on
+Wed Oct 2 14:19:57 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Sat Jan 28 05:53:34 2012 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]
- * lib/irb/completion.rb (IRB::InputCompletor::CompletionProc):
- ignore non-string name modules. [ruby-core:42244][Bug #5938]
+ * 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.
-Mon Jan 23 18:18:58 2012 NARUSE, Yui <naruse@ruby-lang.org>
+Tue Oct 1 23:44:00 2013 Charlie Somerville <charliesome@ruby-lang.org>
- * encoding.c (rb_enc_compatible): fix segv on symbols.
- [ruby-core:42204] [Bug #5921]
+ * 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 Jan 17 17:18:41 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Tue Oct 1 22:03:48 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * configure.in (SPT_TYPE): enable as SPT_REUSEARGV on Darwin.
+ * lib/tempfile.rb (Tempfile#unlink): finalizer is no longer needed
+ after unlinking. patched by by normalperson (Eric Wong) at
+ [ruby-core:56521] [Bug #8768]
- * missing/setproctitle.c (ruby_init_setproctitle): changed prefix.
+Tue Oct 1 20:54:33 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Mon Jan 16 16:41:53 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * file.c (stat_new_0): constify.
- * lib/optparse.rb (Regexp): fix incorrect options when casting to
- a Regexp, and suppress encoding option warnings.
- https://github.com/ruby/ruby/pull/82
+ * file.c (rb_stat_new): constify and export. based on a patch by
+ Hanmac (Hans Mackowiak) at [ruby-core:53225]. [Feature #8050]
-Fri Jan 13 15:22:43 2012 Tanaka Akira <akr@fsij.org>
+Tue Oct 1 16:03:42 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * time.c (TIME_COPY_GMT): copy vtm.utc_offset and vtm.zone too.
- patch by Tomoyuki Chikanaga.
- [ruby-dev:44827] [Bug #5586]
+ * include/ruby/ruby.h (ruby_safe_level_4_warning): needed by extension
+ libraries which check safe level 4. [ruby-dev:47517] [Bug #8652]
-Thu Jan 12 13:52:13 2012 NARUSE, Yui <naruse@ruby-lang.org>
+Mon Sep 30 23:14:36 2013 Zachary Scott <e@zzak.io>
- * 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.
+ * ext/objspace/objspace.c: [DOC] Cleaned up many rdoc formatting
+ issues and several duplicate grammar bugs.
- * cont.c (cont_restore_1): revert workaround introduced in r32201.
+Mon Sep 30 23:01:01 2013 Zachary Scott <e@zzak.io>
-Thu Jan 12 01:40:33 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+ * ext/objspace/object_tracing.c: [DOC] Adjust rdoc formatting and fix
+ small grammar typo
- * test/ruby/test_io.rb (TestIO#test_autoclose): Tempfile.new doesn't
- accept the block argument.
+Mon Sep 30 17:28:39 2013 Koichi Sasada <ko1@atdot.net>
-Sat Jan 7 22:46:36 2012 Kouhei Sutou <kou@cozmixng.org>
+ * ext/objspace/object_tracing.c: [DOC] add some notes for
+ ObjectSpace::trace_object_allocations.
- * lib/rexml/parsers/baseparser.rb: use private instead of _xxx
- method name. This is Ruby code not Python code.
- refs #5696
+Mon Sep 30 16:46:58 2013 Koichi Sasada <ko1@atdot.net>
-Tue Jan 03 23:57:37 2012 Ayumu AIZAWA <ayumu.aizawa@gmail.com>
+ * 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.
- * lib/rexml/parsers/baseparser.rb: rexml BaseParser uses
- instance_eval unnecessarily on listener add.
- patch from Charles Nutter. [Bug #5696] [ruby-core:41437]
+ * test/objspace/test_objspace.rb: add a test for new methods.
-Tue Jan 03 19:13:05 2012 Ayumu AIZAWA <ayumu.aizawa@gmail.com>
+ * NEWS: add a description for new methods.
- * test/rexml/test_sax.rb: add require 'rexml/document'.
- [Backport #5834] [ruby-dev:45079]
+Mon Sep 30 11:18:04 2013 Koichi Sasada <ko1@atdot.net>
-Tue Jan 3 19:05:42 2012 Naohisa Goto <ngotogenome@gmail.com>
+ * gc.c (rb_gc_disable): do rest_sweep() before disable GC.
+ This fix may solve a failure of
+ TestTracepointObj#test_tracks_objspace_events
+ [test/-ext-/tracepoint/test_tracepoint.rb:43].
- * include/ruby/defines.h (FLUSH_REGISTER_WINDOWS): move sparc asm code
- to a separete 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.
+Mon Sep 30 10:40:20 2013 Shugo Maeda <shugo@ruby-lang.org>
-Mon Jan 2 23:52:20 2012 TAKAO Kouji <kouji@takao7.net>
+ * vm_method.c (rb_undef): raise a NameError if the original method
+ of a refined method is not defined.
- * 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]
+ * vm_insnhelper.c (rb_method_entry_eq): added NULL check to avoid SEGV.
-Mon Jan 2 23:47:58 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * test/ruby/test_refinement.rb: related test.
- * tool/rbinstall.rb (install_recursive, bin-comm): split mere
- string not path name. [ruby-core:40462] [Bug #5492]
+Sun Sep 29 23:45:42 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Mon Jan 2 23:41:57 2012 Tajima Akil <artonx@yahoo.co.jp>
+ * parse.y (rb_id_attrset, intern_str): allow junk attrset ID for
+ Struct.
- * win32/Makefile.sub (CONFIG_H): have stdint.h if VC2010.
- [Bug #5243]
+ * 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.
-Mon Jan 2 21:40:45 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+Sun Sep 29 18:45:05 2013 Kazuki Tsujimoto <kazuki@callcc.net>
- * tool/merger.rb (#version_up): version.h date should be Japanese
- locale date.
+ * 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]
-Mon Jan 2 21:36:56 2012 Luis Lavena <luislavena@gmail.com>
+ * test/ruby/test_keyword.rb: tests for the above.
- * configure.in: check -fno-omit-frame-pointer acceptance and usage
- under MinGW. [ruby-core:39957] [Bug #5407]
+Sat Sep 28 23:25:56 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Mon Jan 2 20:05:10 2012 NARUSE, Yui <naruse@ruby-lang.org>
+ * math.c (math_log, math_log2, math_log10): fix for Bignum argument.
+ numbits should be add only when right shifted.
- * include/ruby/ruby.h (SIZE_MAX): define SIZE_MAX if not defined.
- patched by The Written Word Inc. [ruby-core:40422] [Bug #5489]
+Sat Sep 28 14:30:29 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-Mon Jan 2 20:00:01 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * 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.
- * ext/pty/pty.c (pty_check): should return nil until the child
- terminates or stops. [ruby-dev:44600] [Bug #2642]
+Sat Sep 28 00:19:41 2013 Shugo Maeda <shugo@ruby-lang.org>
-Mon Jan 2 19:27:18 2012 Yusuke Endoh <mame@tsg.ne.jp>
+ * ext/curses/extconf.rb: check the size of chtype.
- * 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/curses/curses.c (NUM2CH, CH2NUM): use proper macros for
+ the size of chtype.
- * test/coverage/test_coverage.rb: add a test for above.
+ [ruby-core:56090] [Bug #8659]
-Mon Jan 2 19:08:54 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+Fri Sep 27 18:33:23 2013 Koichi Sasada <ko1@atdot.net>
- * thread_pthread.c (gvl_yield): don't prevent concurrent sched_yield().
- [Bug #5130] [ruby-core:38647]
+ * gc.c: add two GC tuning environment variables.
+ RUBY_GC_MALLOC_LIMIT_MAX and RUBY_GC_MALLOC_LIMIT_GROWTH_FACTOR.
+ See r43067 for details.
-Mon Jan 2 18:54:52 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+ * gc.c (rb_gc_set_params): refactoring. And change verbose notation.
+ Mostly duplicated functions get_envparam_int/double is not cool.
+ Please rewrite it.
- * win32/configure.bat: disable delayed expansion of enironment variable.
- [Bug #5517] [ruby-core:40531]
+ * test/ruby/test_gc.rb: fix a test for this change.
-Wed Dec 28 11:22:45 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Fri Sep 27 17:44:41 2013 Koichi Sasada <ko1@atdot.net>
- * lib/fileutils.rb (FileUtils::Entry_#entries): use utility method
- instead of typoed regexp. [ruby-core:41829] [Bug #5817]
+ * gc.c (GC_MALLOC_LIMIT): 8,000,000 -> 8 * 1,024 * 1,024.
-Thu Dec 15 10:44:54 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Fri Sep 27 17:19:39 2013 Koichi Sasada <ko1@atdot.net>
- * 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]
+ * gc.c (gc_before_sweep): cast to size_t to suppress warnings.
-Wed Dec 14 15:28:31 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Fri Sep 27 17:07:55 2013 Koichi Sasada <ko1@atdot.net>
- * transcode.c (str_encode): about the extension of :fallback
- option since 1.9.3.
+ * 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.
-Tue Oct 4 06:43:47 2011 Aaron Patterson <aaron@tenderlovemaking.com>
+Fri Sep 27 16:32:27 2013 Koichi Sasada <ko1@atdot.net>
- * ext/psych/lib/psych.rb: update psych version.
- * ext/psych/psych.gemspec: generate new gemspec for new version.
+ * 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.
-Tue Oct 4 06:29:55 2011 Aaron Patterson <aaron@tenderlovemaking.com>
+ * 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.
- * 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
+ * gc.c (ruby_gc_params_t): add initial_malloc_limit_factor and
+ initial_malloc_limit_max.
-Tue Oct 4 06:20:19 2011 Aaron Patterson <aaron@tenderlovemaking.com>
+ * gc.c (vm_malloc_prepare, vm_xrealloc): use vm_malloc_increase to
+ add and check malloc_increase.
- * ext/psych/lib/psych/scalar_scanner.rb: Match values against the
- floating point spec defined in YAML to avoid erronious parses.
- * test/psych/test_numeric.rb: corresponding test.
+Fri Sep 27 01:05:00 2013 Zachary Scott <e@zzak.io>
-Tue Oct 4 05:59:24 2011 Aaron Patterson <aaron@tenderlovemaking.com>
+ * re.c: [DOC] arguments of Regexp::union receive #to_regexp [Bug #8205]
- * 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.
+Fri Sep 27 00:39:27 2013 Zachary Scott <e@zzak.io>
-Tue Oct 4 05:47:23 2011 Aaron Patterson <aaron@tenderlovemaking.com>
+ * struct.c: [DOC] grammar of ArgumentError in Struct.new [Bug #8936]
+ Patch by Prathamesh Sonpatki
- * 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.
+Thu Sep 26 22:11:56 2013 Zachary Scott <e@zzak.io>
-Fri Sep 2 04:05:25 2011 Aaron Patterson <aaron@tenderlovemaking.com>
+ * 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
- * 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.
+Thu Sep 26 22:08:11 2013 Zachary Scott <e@zzak.io>
-Wed Dec 7 19:04:22 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * lib/observer.rb: [DOC] syntax improvement in example by @chastell
+ [Fixes GH-400] https://github.com/ruby/ruby/pull/400
- * configure.in (rpath): fix typo in the help string. a patch from
- Yuji Yamano <yyamano AT kt.rim.or.jp> in [ruby-list:48568].
+Thu Sep 26 22:03:15 2013 Zachary Scott <e@zzak.io>
-Wed Nov 30 18:22:10 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * ext/digest/digest.c: [DOC] typo in overview by @chastell
+ [Fixes GH-399] https://github.com/ruby/ruby/pull/399
- * complex.c (nucomp_rationalize): fix function. [ruby-core:40667]
- [Bug #5546]
+Thu Sep 26 22:00:42 2013 Zachary Scott <e@zzak.io>
-Thu Nov 17 10:36:46 2011 Aaron Patterson <aaron@tenderlovemaking.com>
+ * ext/openssl/ossl.c: [DOC] typo in example by @zoranzaric
+ [Fixes GH-401] https://github.com/ruby/ruby/pull/401
- * ext/psych/lib/psych.rb (load_file): make sure opened yaml files are
- also closed. [ruby-core:41088]
+Thu Sep 26 21:07:49 2013 Akinori MUSHA <knu@iDaemons.org>
-Wed Nov 30 02:58:46 2011 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
+ * misc/ruby-electric.el (ruby-electric-delete-backward-char): Add
+ support for smartparens-mode.
- * numeric.c (dbl2ival): Fix Float#divmod and #round for 32 bit
- platform. part 1 of [bug #5276]
+ * 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.
-Wed Nov 30 02:58:46 2011 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
+Thu Sep 26 16:51:00 2013 Shota Fukumori <her@sorah.jp>
- * numeric.c (flo_round): Fix criteria for 32 bits platform
- part 2 of [bug #5276]
+ * insns.def (opt_regexpmatch2): Check String#=~ hasn't overridden
+ before calling rb_reg_match().
-Wed Nov 30 02:37:32 2011 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
+ * test/ruby/test_string.rb: Test for above.
- * numeric.c (flo_round): Make Float#round round big values [bug
- #5272]
+ * vm.c (vm_init_redefined_flag): Add BOP flag for String#=~
-Wed Nov 30 02:37:32 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ [ruby-core:57385] [Bug #8953]
- * numeric.c (flo_round): substitute machine dependent magic number.
+Thu Sep 26 16:43:42 2013 Akinori MUSHA <knu@iDaemons.org>
-Wed Nov 30 02:28:22 2011 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
+ * 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.
- * numeric.c (int_round): Integer#round always returns an Integer [Bug
- #5271]
+Thu Sep 26 16:24:00 2013 Charlie Somerville <charliesome@ruby-lang.org>
-Fri Nov 4 01:56:30 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+ * insns.def (opt_regexpmatch1): check Regexp#=~ is not defined before
+ calling rb_reg_match()
- * 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.
+ * test/ruby/test_regexp.rb: add test
-Mon Nov 7 23:39:23 2011 Tajima Akio <artonx@yahoo.co.jp>
+ * vm.c (ruby_vm_redefined_flag): change type to short[]
- * io.c (io_fflush): remove fsync().
- * io.c (rb_io_flush, rb_io_rewind): fsync() here.
- These pathces are backports of trunk r33651 for [Bug #5585]
+ * vm.c (vm_redefinition_check_flag): return REGEXP_REDEFINED_OP_FLAG if
+ klass == rb_cRegexp
-Mon Oct 10 22:33:12 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * vm.c (vm_init_redefined_flag): setup BOP flag for Regexp#=~
- * 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]
+ * vm_insnhelper.h: add REGEXP_REDEFINED_OP_FLAG
-Tue Oct 4 16:17:50 2011 NARUSE, Yui <naruse@ruby-lang.org>
+ [ruby-core:57385] [Bug #8953]
- * lib/time.rb (Time.strptime): use Time.at if d[:seconds] is set.
- Reported by Christopher Eberz. [ruby-core:39903] Bug #5399
+Thu Sep 26 14:46:49 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Tue Oct 4 11:44:10 2011 NARUSE, Yui <naruse@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]
- * gc.c (rb_gc_set_params): ruby_verbose can be Qnil, so use RTEST.
+Wed Sep 25 17:41:29 2013 Koichi Sasada <ko1@atdot.net>
-Mon Oct 3 23:56:39 2011 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
+ * 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]
- * 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]
+Wed Sep 25 17:12:08 2013 Koichi Sasada <ko1@atdot.net>
- * test/ruby/test_gc.rb (test_gc_parameter): add test for it.
+ * 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).
-Wed Sep 28 09:14:16 2011 Nobuyoshi Nakada <>
+ * 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.
- * 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 25 16:58:33 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Tue Sep 13 15:02:48 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * internal.h (rb_float_value, rb_float_new): move inline functions
+ from ruby/ruby.h.
- * lib/pstore.rb (PStore): always open in binary mode even if
- default encodings are set. [Bug #5311] [ruby-core:39503]
+ * numeric.c (rb_float_value, rb_float_new): define external functions
+ for extension libraries.
-Sat Oct 8 07:31:42 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Wed Sep 25 15:37:02 2013 Koichi Sasada <ko1@atdot.net>
- * array.c (ary_join_1): should not copy the encoding of non-string
- element after string element. [ruby-core:39776] [Bug #5379]
+ * test/rdoc/test_rdoc_generator_darkfish.rb: add a guard for windows.
-Sat Oct 8 06:51:46 2011 Eric Hodel <drbrain@segment7.net>
+Wed Sep 25 09:53:11 2013 Eric Hodel <drbrain@segment7.net>
- * lib/rubygems: Update to RubyGems 1.8.11. Move Deprecate into the
- Gem namespace.
+ * lib/rubygems: Fix CVE-2013-4363. Miscellaneous minor improvements.
-Sat Oct 8 06:37:08 2011 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
+ * test/rubygems: Tests for the above.
- * 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]
+Tue Sep 24 17:38:56 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * test/ruby/test_gc.rb (test_gc_parameter): add test for it.
+ * string.c (rb_str_inspect): get rid of out-of-bound access.
-Sat Oct 8 06:26:24 2011 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
+ * string.c (rb_str_inspect): when a UTF-16/32 string doesn't have a
+ BOM, inspect as a dummy encoding string.
- * 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]
+Tue Sep 24 17:15:10 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * test/ruby/test_gc.rb (test_gc_parameter): add test for it.
+ * enc/encdb.c (ENC_DUMMY_UNICODE): make BOM-encodings dummy.
- * test/ruby/envutil.rb (assert_normal_exit): add :child_env option to
- enable pass environemnt variables to child process.
+ * encoding.c (enc_autoload): keep dummy encodings dummy.
-Sat Oct 8 05:45:28 2011 Eric Hodel <drbrain@segment7.net>
+Tue Sep 24 16:41:15 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * proc.c (proc_call): Update documentation to match argument handling
- of proc/Proc.new/lambda/->()
+ * ext/win32/lib/win32/registry.rb (Win32::Registry#write): data size
+ is in bytes, not chars. terminators should be placed automatically.
-Sat Oct 8 05:38:29 2011 Eric Hodel <drbrain@segment7.net>
+Tue Sep 24 16:39:36 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * proc.c (proc_call): Fix documentation of Proc#call vs Proc#===.
- [Ruby 1.9 - Bug #5349]
+ * ext/win32/lib/win32/registry.rb (Win32::Registry#each_value): encode
+ name.
-Tue Sep 27 13:05:39 2011 Martin Bosslet <Martin.Bosslet@googlemail.com>
+ * ext/win32/lib/win32/registry.rb (Win32::Registry#each_key): ditto.
- * 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.
+ * ext/win32/lib/win32/registry.rb (Win32::Registry#export_string):
+ encode to locale encoding if default internal is not set.
- Thanks to Hiroshi Yoshida for reporting this bug.
- [Bug #5363] [ruby-dev:44542]
+Tue Sep 24 16:35:09 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Sat Sep 17 23:34:10 2011 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.
- * parse.y (parser_data_type): inherit the core type in ripper so
- that checks in core would work. [ruby-core:39591] [Bug #5331]
+Tue Sep 24 14:07:00 2013 Charlie Somerville <charliesome@ruby-lang.org>
-Fri Sep 23 14:15:01 2011 Martin Bosslet <Martin.Bosslet@googlemail.com>
+ * gc.c (free_method_cache_entry_i): unused function
- * ext/openssl/ossl_asn1.c
- ext/openssl/ossl_pkey.c: Remove unused variables.
+ * gc.c (rb_free_mc_table): ditto
-Fri Sep 23 06:54:44 2011 Martin Bosslet <Martin.Bosslet@googlemail.com>
+ * internal.h (method_cache_entry_t): unused struct
- * backport r33315 from trunk.
+ * vm_method.c (verify_method_cache): remove unused variable
- * 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]
+ * vm_method.c (rb_method_entry): ditto
-Fri Sep 23 12:18:52 2011 Martin Bosslet <Martin.Bosslet@googlemail.com>
+Tue Sep 24 14:01:00 2013 Charlie Somerville <charliesome@ruby-lang.org>
- * backport r33311 from trunk.
+ * class.c (class_alloc): remove mc_tbl
- * 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]
+ * gc.c (obj_free): ditto
-Thu Sep 22 19:45:22 2011 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
+ * internal.h (struct rb_classext_struct): ditto
- * 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.
+ * method.h (rb_method_entry): remove ent param
-Wed Sep 21 16:57:03 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+ * vm_method.c: restore the global method cache. Per class cache tables
+ turned out to be far too slow.
- * test/io/wait/test_io_wait.rb (TestIOWait#setup): of course, the
- behavior of mingw is just same with mswin.
+ [ruby-core:57289] [Bug #8930]
-Sat Sep 17 22:21:26 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Tue Sep 24 12:51:07 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * vm.c (rb_vm_make_env_object, rb_vm_get_sourceline): export as a
- workaround for ruby-debug19 for the time being.
- [ruby-core:38972] [Bug #5193]
+ * ext/win32/lib/win32/registry.rb (Win32::Registry::API): need
+ Constants.
-Fri Sep 16 01:08:19 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+ * ext/win32/lib/win32/registry.rb (Win32::Registry::API#EnumValue):
+ size of the name is in WCHARs, not in bytes.
- * NEWS: cosmetic changes.
+Mon Sep 23 22:16:09 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Wed Sep 14 12:39:00 2011 Kenta Murata <mrkn@mrkn.jp>
+ * 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]
- * configure.in: do not use gcc-4.2 as the default compiler.
+Mon Sep 23 12:11:26 2013 Masaki Matsushita <glass.saga@gmail.com>
- * NEWS: describe the issue about Xcode.
+ * hash.c (env_each_pair): do not call rb_assoc_new() if
+ it isn't needed.
-Wed Sep 14 11:46:30 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+Mon Sep 23 10:42:30 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * thread.c (rb_fd_rcopy): added an argument guard.
- Patch by NAKAMURA Usaku. [Bug #5306] [ruby-core:39435]
+ * 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].
-Tue Sep 13 09:28:58 2011 Koichi Sasada <ko1@atdot.net>
+Mon Sep 23 05:07:49 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * NEWS: wrote about rb_reserved_fd_p() and objspace.
+ * include/ruby/intern.h (rb_ary_cat): move from internal.h, since it
+ is described in README.EXT.
-Mon Sep 12 20:47:52 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Sun Sep 22 20:55:20 2013 Kazuki Tsujimoto <kazuki@callcc.net>
- * thread.c (rb_thread_select): fix a typo to initialize efds
- properly. [Bug #5299] [ruby-core:39380]
+ * vm_insnhelper.c (vm_make_proc_with_iseq): fix bug message.
+ This is follow up to changes in r42637.
-Mon Sep 12 20:41:20 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+Sun Sep 22 20:35:38 2013 Kazuki Tsujimoto <kazuki@callcc.net>
- * 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.
+ * ext/-test-/tracepoint/tracepoint.c (Init_tracepoint): prevent from GC.
- * test/-ext-/old_thread_select/test_old_thread_select.rb
- (test_old_select_false_positive): test for bug5306.
+Sun Sep 22 19:00:28 2013 Benoit Daloze <eregontp@gmail.com>
- * 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.
+ * 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.
-Tue Sep 6 13:15:44 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Sat Sep 21 20:11:06 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * encoding.c (load_encoding): predefined encoding names are safe.
- [ruby-dev:44469] [Bug #5279]
+ * 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]
- * transcode.c (load_transcoder_entry): ditto.
+Sat Sep 21 01:04:25 2013 Zachary Scott <e@zzak.io>
-Fri Sep 9 16:02:04 2011 NARUSE, Yui <naruse@ruby-lang.org>
+ * lib/benchmark.rb: [DOC] grammar of Benchmark#bm [Bug #8888]
+ Patch by Prathamesh Sonpatki
- * insns.def (concatstrings): don't use initial ASCII-8BIT string.
- [ruby-core:38635] [Bug #5126]
+Sat Sep 21 00:50:02 2013 Zachary Scott <e@zzak.io>
-Thu Sep 8 21:17:36 2011 NARUSE, Yui <naruse@ruby-lang.org>
+ * enumerator.c: [DOC] Enumerator#each arguments documentation [GH-388]
+ Patch by @kachick https://github.com/ruby/ruby/pull/388
- * ext/nkf/nkf-utf8/nkf.c: import nkf 2.1.2 (be9c280)
- Bump version number/release date only.
+Sat Sep 21 00:49:16 2013 Zachary Scott <e@zzak.io>
-Wed Sep 7 23:42:45 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * enum.c: [DOC] Enumerable#to_a accepts arguments [GH-388]
+ Patch by @kachick https://github.com/ruby/ruby/pull/388
- * io.c (argf_next_argv): open in default text mode.
- [ruby-core:39234] [Bug #5268]
+Sat Sep 21 00:47:44 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Mon Sep 5 15:06:55 2011 NARUSE, Yui <naruse@ruby-lang.org>
+ * string.c (rb_str_conv_enc_opts): make sure to scan coderange to get
+ rid of unnecessary conversion.
- * test/rubygems/test_gem_security.rb
- (test_class_build_self_signed_cert): reset opt[:trust_dir] to apply
- temporary Gem.user_home.
+Sat Sep 21 00:21:08 2013 Zachary Scott <e@zzak.io>
-Sun Sep 4 00:56:58 2011 Kazuki Tsujimoto <kazuki@callcc.net>
+ * ext/openssl/lib/openssl/ssl.rb: [DOC] Document OpenSSL::SSLServer
+ Based on a patch by Rafal Lisowski [Bug #8758]
- * backport r33177 from trunk.
+Fri Sep 20 23:54:03 2013 Zachary Scott <e@zzak.io>
- * 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).
+ * lib/gserver.rb: [DOC] correct gserver.rb license [Bug #8913]
-Fri Sep 2 21:11:16 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Fri Sep 20 23:48:34 2013 Zachary Scott <e@zzak.io>
- * io.c (validate_enc_binmode, prep_stdio): default to text mode on
- dosish platforms. [ruby-core:38822] [Bug #5164]
+ * ext/psych/yaml/yaml.h: [DOC] merge upstream typo fix by @GreenGeorge
+ https://github.com/tenderlove/psych/pull/161
- * transcode.c (rb_econv_prepare_options): keep default ecflags
- unchanged if no options.
+Fri Sep 20 23:37:40 2013 Zachary Scott <e@zzak.io>
-Fri Sep 2 14:36:47 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * lib/securerandom.rb: [DOC] SecureRandom.hex length argument
+ [Fixes GH-394] Patch by @avdi https://github.com/ruby/ruby/pull/394
- * vm_insnhelper.c (vm_search_const_defined_class): search
- ancestors only when global scope. [ruby-core:39227] [Bug #5264]
+Fri Sep 20 23:34:48 2013 Zachary Scott <e@zzak.io>
-Fri Sep 2 09:58:08 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * benchmark/bm_app_answer.rb: removed duplicate code [Fixes GH-393]
+ Patch by @gouravtiwari https://github.com/ruby/ruby/pull/393
- * 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 20 23:24:08 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Thu Sep 1 17:31:22 2011 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.
- * 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]
+ * common.mk (test-sample): ditto, and use $(MINIRUBY) as rubytest.rb
+ does not need extension libraries.
-Thu Sep 1 14:11:16 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+ * tool/rubytest.rb: pass $(RUN_OPTS) to testing ruby using --run-opt.
- * 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.
+Fri Sep 20 15:01:46 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Wed Aug 31 16:02:45 2011 NARUSE, Yui <naruse@ruby-lang.org>
+ * parse.y (intern_str): sigil only names are junk, at least one
+ identifier character is needed. [ruby-dev:47723] [Bug #8928]
- * ext/json: Merge json gem v1.5.4 (3dab4c5a6a97fac03dac).
+ * parse.y (rb_enc_symname_type): fix out of bound access.
-Wed Aug 31 13:19:31 2011 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
+Fri Sep 20 14:14:32 2013 Tanaka Akira <akr@fsij.org>
- * numeric.c (flo_round): Avoid overflow by optimizing for trivial
- cases
- [Bug #5227]
+ * ext/-test-/printf/printf.c (printf_test_call): Fix an end of buffer
+ argument.
-Wed Aug 31 06:45:32 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+Thu Sep 19 16:59:02 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * configure.in: fix r32835. $withval can't be used outer AC_ARG_WITH().
+ * parse.y (lambda): adjust position to the beginning of the block.
-Wed Aug 31 05:29:03 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+Thu Sep 19 16:25:06 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * win32/win32.c (rb_w32_select_with_thread): and my typo. we all must
- be more careful.
+ * vsnprintf.c (BSD_vfprintf): initialize cp so that size is 0 in the
+ commented case. fix an accidental bug at r16716.
-Wed Aug 31 05:28:45 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+Thu Sep 19 14:33:14 2013 Koichi Sasada <ko1@atdot.net>
- * thread.c (rb_thread_select): critical typo in r33117.
+ * NEWS: add a news for r42974.
-Wed Aug 31 05:28:26 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+Thu Sep 19 14:12:02 2013 Koichi Sasada <ko1@atdot.net>
- * 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.
+ * include/ruby/ruby.h: make Symbol objects frozen.
+ [Feature #8906]
+ I want to freeze this good day, too.
-Wed Aug 31 05:27:59 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+ * test/ruby/test_eval.rb: catch up this change.
- * ext/-test-/old_thread_select/old_thread_select.c (old_thread_select):
- typo.
+ * test/ruby/test_symbol.rb: add a test to check frozen symbols.
- * 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.
+Thu Sep 19 09:11:33 2013 Eric Hodel <drbrain@segment7.net>
-Wed Aug 31 05:26:30 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+ * NEWS: Update for RDoc 4.1.0.preview.1 and RubyGems 2.2.0.preview.1
- * 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 #5229] [ruby-core:39102]
+Thu Sep 19 08:59:41 2013 Eric Hodel <drbrain@segment7.net>
- * 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.
+ * lib/rdoc/markdown/literals_1_9.rb: Fix trailing whitespace.
-Tue Aug 30 11:25:21 2011 NARUSE, Yui <naruse@ruby-lang.org>
+ Previously kpeg (which generates this file) added trailing
+ whitespace, but this bug is now fixed.
- * ext/json: Merge json gem 1.5.4+ (2149f4185c598fb97db1).
- [Bug #5173] [ruby-core:38866]
+ * lib/rdoc/markdown.rb: ditto.
-Tue Aug 30 09:53:59 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+Thu Sep 19 08:33:14 2013 Eric Hodel <drbrain@segment7.net>
- * 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]
+ * lib/rdoc: Update to RDoc 4.1.0.preview.1
-Tue Aug 30 09:52:29 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ RDoc 4.1.0 contains a number of enhancements including a new default
+ style and accessibility support. You can see the changelog here:
- * backport r33117 from trunk.
+ https://github.com/rdoc/rdoc/blob/v4.1.0.preview.1/History.rdoc
- * 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/rdoc: ditto.
- * 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.
+Thu Sep 19 07:16:26 2013 Aaron Patterson <aaron@tenderlovemaking.com>
-Tue Aug 30 09:16:17 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * ext/psych/lib/psych.rb: updating Psych version
- * 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]
+ * ext/psych/psych.gemspec: ditto
-Sun Aug 28 15:38:17 2011 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
+Thu Sep 19 06:39:40 2013 Eric Hodel <drbrain@segment7.net>
- * backport r33106 from trunk.
+ * lib/rubygems/dependency_resolver.rb: Switch the iterative resolver
+ algorithm from recursive to iterative to avoid possible
+ SystemStackError.
- * ext/date/date_parse.c (date_zone_to_diff): keep a temporary string
- stored in variable while the contents buffer is beeing used.
+Thu Sep 19 06:29:30 2013 Eric Hodel <drbrain@segment7.net>
- * ext/date/date_parse.c (date_zone_to_diff): get rid of out of bounds
- memory read. [ruby-dev:44409] [Bug #5213]
+ * lib/rubygems: Update to RubyGems 2.2.0.preview.1
-Sun Aug 28 05:29:50 2011 Ryan Davis <ryand-ruby@zenspider.com>
+ This brings several new features to RubyGems summarized here:
- * backport r33102 from trunk.
+ https://github.com/rubygems/rubygems/blob/v2.2.0.preview.1/History.txt
- * lib/minitest/*: Imported minitest 2.5.1 (r6596)
- * test/minitest/*: ditto
+ * test/rubygems: ditto.
-Sat Aug 27 20:54:54 2011 Kazuki Tsujimoto <kazuki@callcc.net>
+Wed Sep 18 23:14:58 2013 Masaki Matsushita <glass.saga@gmail.com>
- * backport r33099 from trunk.
+ * 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]
- * vm.c (rb_vm_rewrite_dfp_in_errinfo): change return type
- to suppress a warning.
+ * 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.
- * vm_core.h: ditto.
+Wed Sep 18 16:32:15 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Sat Aug 27 19:03:44 2011 Kazuki Tsujimoto <kazuki@callcc.net>
+ * proc.c (mnew_from_me): allocate structs after allocated wrapper
+ object successfully, to get rid of potential memory leak.
- * backport r33096 from trunk.
+Tue Sep 17 15:54:03 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * proc.c (proc_new): force to rewrite errinfo when calling Proc.new in ensure.
- [Bug #5234] [ruby-core:39125]
+ * 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]
- * vm.c (rb_vm_rewrite_dfp_in_errinfo): new function.
+ * lib/test/unit/assertions.rb (Test::Unit::Assertions#assert_throw):
+ assertion for throw. MiniTest::Assertions#assert_throws discards
+ the caught value.
- * vm.c (vm_make_env_each): changed accordingly.
+ * lib/test/unit/assertions.rb (Test::Unit::Assertions#assert_nothing_thrown):
+ returns the result of the given block.
- * vm_core.h: ditto.
+Tue Sep 17 12:55:58 2013 Eric Hodel <drbrain@segment7.net>
- * bootstraptest/test_flow.rb: add tests for above.
+ * doc/regexp.rdoc: [DOC] Replace paragraphs in verbatim sections with
+ plain paragraphs to improve readability as ri and HTML.
-Sat Aug 27 08:59:12 2011 Eric Hodel <drbrain@segment7.net>
+Mon Sep 16 07:32:35 2013 Tadayoshi Funaba <tadf@dotrb.org>
- * NEWS: Update version of rake to 0.9.2.2.
+ * complex.c: removed meaningless lines.
+ * rational.c: ditto.
-Sat Aug 27 08:44:58 2011 Eric Hodel <drbrain@segment7.net>
+Mon Sep 16 00:44:23 2013 Masaki Matsushita <glass.saga@gmail.com>
- * backport r33087 from trunk
+ * ext/socket/mkconstants.rb: define MSG_FASTOPEN.
+ [ruby-core:57138] [Feature #8897]
- * lib/rdoc: Import RDoc 3.9.4. Typo and grammar fixes by Luke Gruber.
- [Ruby 1.9 - Bug #5203]
+Sun Sep 15 13:31:23 2013 Tadayoshi Funaba <tadf@dotrb.org>
-Sat Aug 27 07:53:34 2011 Eric Hodel <drbrain@segment7.net>
+ * 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.
- * backport r33087 from trunk.
+Sat Sep 14 06:08:10 2013 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
+ * dir.c (dir_s_glob): [DOC] Improve wording and layout.
-Sat Aug 27 07:22:07 2011 Eric Hodel <drbrain@segment7.net>
+ * dir.c (file_s_fnmatch): ditto.
- * backport r33086 from trunk.
+ * dir.c (Init_Dir): [DOC] Document File::Constants::FNM_XXX
+ constants. (These won't show up in RDoc until a new RDoc is
+ imported.)
- * 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
+Thu Sep 12 14:58:58 2013 NARUSE, Yui <naruse@ruby-lang.org>
-Fri Aug 26 10:10:37 2011 Eric Hodel <drbrain@segment7.net>
+ * lib/uri/generic.rb (URI::Generic.find_proxy): return nil if
+ http_proxy environment variable is empty string.
+ [ruby-core:57140] [Bug #8898]
- * backport r33074 from trunk.
+Fri Sep 13 10:40:28 2013 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.
+ * lib/rubygems: Update to RubyGems 2.1.3
-Wed Aug 24 09:49:10 2011 Koichi Sasada <ko1@atdot.net>
+ Fixed installing platform gems
- * backport r33045 from trunk.
+ Restored concurrent requires
- * insns.def (defined): fix to checking class variable.
- A patch by Magnus Holm <judofyr@gmail.com>. Thanks!
+ Fixed installing gems with extensions with --install-dir
-Fri Aug 26 08:21:10 2011 Aaron Patterson <aaron@tenderlovemaking.com>
+ Fixed `gem fetch -v` to install the latest version
- * test/ruby/test_variable.rb: add a test for above.
+ Fixed installing gems with "./" in their files entries
-Thu Aug 25 09:43:16 2011 Eric Hodel <drbrain@segment7.net>
+ * test/rubygems/test_gem_package.rb: Tests for the above.
- * backport r33066 from trunk.
+ * NEWS: Updated for RubyGems 2.1.3
- * ext/openssl/lib/openssl/bn.rb: Hide copyright info from RDoc.
- * ext/openssl/lib/openssl/digest.rb: ditto
- * ext/openssl/lib/openssl/cipher.rb: ditto
+Thu Sep 12 22:40:03 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Thu Aug 25 09:25:48 2011 Eric Hodel <drbrain@segment7.net>
+ * configure.in (RUBY_CHECK_SIGNEDNESS): macro to check signedness of a
+ type.
- * backport r33065 from trunk.
+ * configure.in (size_t): must be unsigned.
+ [ruby-core:57149] [Feature #8890]
- * 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 Sep 12 22:37:08 2013 Anton Ovchinnikov <revolver112@gmail.com>
-Thu Aug 25 08:19:43 2011 Koichi Sasada <ko1@atdot.net>
+ * 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]
- * 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).
+Thu Sep 12 21:35:46 2013 Naohisa Goto <ngotogenome@gmail.com>
- * bootstraptest/test_flow.rb: add a test for above.
+ * 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 Aug 25 08:04:08 2011 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
+Thu Sep 12 20:07:29 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * numeric.c (int_round): Fix Integer#round [ruby-core:39096]
+ * vsnprintf.c (MAXEXP, MAXFRACT): calculate depending on constants in
+ float.h.
-Thu Aug 25 06:51:08 2011 Aaron Patterson <aaron@tenderlovemaking.com>
+ * vsnprintf.c (BSD_vfprintf): limit length for cvt() to get rid of
+ buffer overflow. [ruby-core:57023] [Bug #8864]
- * ext/psych/lib/psych.rb: Fixing psych version number.
+ * vsnprintf.c (exponent): make expbuf size more precise.
-Thu Aug 25 06:11:35 2011 Aaron Patterson <aaron@tenderlovemaking.com>
+Wed Sep 11 17:30:45 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * ext/psych/lib/psych/nodes/node.rb: default `to_yaml` encoding to be
- UTF-8.
- * test/psych/test_encoding.rb: test yaml dump encoding.
+ * 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 Aug 24 08:53:06 2011 Eric Hodel <drbrain@segment7.net>
+Wed Sep 11 07:55:17 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
- * backport r33043 from trunk.
+ * thread.c (rb_mutex_unlock): Mutex#unlock no longer raise
+ an exception even if uses on trap. [Bug #8891]
- * 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.
+Tue Sep 10 14:37:01 2013 Shota Fukumori <sorah@tubusu.net>
-Wed Aug 24 07:57:43 2011 Eric Hodel <drbrain@segment7.net>
+ * vm_backtrace.c (vm_backtrace_to_ary): Ignore the second argument if
+ it is nil. [Bug #8884] [ruby-core:57094]
- * backport r33040 from trunk.
+ * test/ruby/test_backtrace.rb (test_caller_with_nil_length):
+ Test for above.
- * lib/rubygems: Update to RubyGems 1.8.9. Fixes uninstalling multiple
- gems and gem cleanup.
+Tue Sep 10 12:39:17 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Wed Aug 24 06:45:20 2011 Ryan Davis <ryand-ruby@zenspider.com>
+ * class.c (method_entry_i): should exclude refined methods from
+ instance method list. [ruby-core:57080] [Bug #8881]
- * backport r33036 from trunk.
+Tue Sep 10 12:05:04 2013 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
- * lib/minitest/*: Imported minitest 2.5.0 (r6557)
- * test/minitest/*: ditto
+ * io.c (rb_f_printf): [DOC] add missing parenthesis in rdoc.
-Tue Aug 23 15:23:56 2011 Eric Hodel <drbrain@segment7.net>
+Tue Sep 10 10:08:00 2013 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
- * backport r33027 from trunk.
+ * NEWS: Update RubyGems note.
- * load.c (rb_f_require): Improve documentation of Kernel#require.
- [Ruby 1.9 - Bug #5210]
+Tue Sep 10 09:51:22 2013 Eric Hodel <drbrain@segment7.net>
-Tue Aug 23 15:11:48 2011 Hiroshi Nakamura <nahi@ruby-lang.org>
+ * lib/rubygems: Update to RubyGems 2.1.0. Fixes CVE-2013-4287.
- * backport r33023 from trunk.
+ See http://rubygems.rubyforge.org/rubygems-update/CVE-2013-4287_txt.html
+ for CVE information.
- * ext/zlib/zlib.c (gzfile_read_header): Ensure that each section of
- gzip header is readable to avoid SEGV.
+ See http://rubygems.rubyforge.org/rubygems-update/History_txt.html#label-2.1.0+%2F+2013-09-09
+ for release notes.
- * test/zlib/test_zlib.rb (test_corrupted_header): Test it.
+ * test/rubygems: Tests for the above.
-Mon Aug 22 23:43:33 2011 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
+Mon Sep 9 21:31:45 2013 Tanaka Akira <akr@fsij.org>
- * backport r33021 from trunk.
+ * 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/
- * sprintf.c (rb_str_format): add RB_GC_GUARD to prevent temporary
- strings from GC.
+ * time.c: Ditto.
-Sun Aug 21 17:58:38 2011 Kazuki Tsujimoto <kazuki@callcc.net>
+ * ext/socket/ancdata.c: Ditto.
- * backport r33019 from trunk.
+Mon Sep 9 16:55:59 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * iseq.c (iseq_s_disasm): remove variable which is no longer used
- since r33013.
+ * 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]
-Sun Aug 21 14:20:58 2011 Naohisa Goto <ngotogenome@gmail.com>
+Mon Sep 9 09:14:58 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * configure.in: use LD_LIBRARY_PATH_64 on 64-bit Solaris.
+ * tool/rbinstall.rb (Gem::Specification#initialize): default date to
+ RUBY_RELEASE_DATE. [ruby-core:57072] [Bug #8878]
-Sun Aug 21 11:13:54 2011 Naohisa Goto <ngotogenome@gmail.com>
+ * tool/rbinstall.rb (Gem::Specification#to_ruby): add date.
- * backport r32895 from trunk.
+Sun Sep 8 16:01:54 2013 Tanaka Akira <akr@fsij.org>
- * 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]
+ * rational.c (f_gcd): Relax the condition to use GMP.
- * ext/fiddle/closure.c (callback): ditto
+Sun Sep 8 13:56:38 2013 Masaki Suketa <masaki.suketa@nifty.ne.jp>
- * ext/fiddle/conversions.h (fiddle_generic): ditto
+ * ext/win32ole/win32ole.c (folevariant_initialize): check type of
+ element of array.
- * ext/fiddle/conversions.c (value_to_generic): char, short and int
- are strictly distinguished on big-endian CPU, e.g. sparc64.
+ * test/win32ole/test_win32ole_variant.rb (test_s_new_ary): ditto.
-Sat Aug 20 13:28:32 2011 Kazuki Tsujimoto <kazuki@callcc.net>
+Sat Sep 7 21:33:10 2013 Tanaka Akira <akr@fsij.org>
- * backport r33013 from trunk.
+ * math.c (math_log): Test the sign for bignums.
+ (math_log2): Ditto.
+ (math_log10): Ditto.
- * iseq.c (iseq_s_disasm): fix a bug that may cause SEGV.
+Sat Sep 7 20:25:47 2013 Tanaka Akira <akr@fsij.org>
- * test/ruby/test_method.rb (test_body): add a test for the above change.
+ * math.c (math_log): Support bignums bigger than 2**1024.
+ (math_log2): Ditto.
+ (math_log10): Ditto.
-Sat Aug 20 10:43:24 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Sat Sep 7 15:36:00 2013 Charlie Somerville <charliesome@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.
+ * vm_eval.c (vm_call0): fix prototype, the id parameter should be of
+ type ID, not VALUE
-Fri Aug 19 14:25:51 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * 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]
- * process.c (proc_spawn_v, proc_spawn): should not wait the
- spawned process.
+ * test/ruby/test_refinement.rb: add test
- * process.c (proc_spawn_v): fix missing argument, and try with
- /bin/sh only if failed with ENOEXEC.
+Sat Sep 7 13:49:40 2013 Kazuki Tsujimoto <kazuki@callcc.net>
-Fri Aug 19 14:12:57 2011 Shugo Maeda <shugo@ruby-lang.org>
+ * variable.c (classname): the name of class that has
+ non class id should not be nil. This bug was introduced
+ in r36577.
- * backport r33007 from trunk.
+ * test/thread/test_cv.rb: test for change.
- * 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]
+Sat Sep 7 13:29:22 2013 Kazuki Tsujimoto <kazuki@callcc.net>
-Fri Aug 19 11:28:58 2011 Shugo Maeda <shugo@ruby-lang.org>
+ * lib/find.rb (Find.find): respect the encodings of arguments.
+ [ruby-dev:47530] [Feature #8657]
- * backport r33001 from trunk.
+ * test/test_find.rb: add tests.
- * lib/net/imap.rb (msg_att): accepts extra space before ')'.
- based on the patch by art lussos. [Bug #5163] [ruby-core:38820]
+Sat Sep 7 10:40:32 2013 Tanaka Akira <akr@fsij.org>
-Wed Aug 17 15:27:00 2011 Kenta Murata <mrkn@mrkn.jp>
+ * ext/socket/mkconstants.rb (TCP_FASTOPEN): Defined for TCP fast open.
+ [ruby-core:57048] [Feature #8871] patch by Masaki Matsushita.
- * backport r32996 from trunk.
+Fri Sep 6 23:53:31 2013 Masaki Matsushita <glass.saga@gmail.com>
- * 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]
+ * common.mk: use RUNRUBY instead of MINIRUBY because MINIRUBY can't
+ require extension libraries. The patch is from nobu
+ (Nobuyoshi Nakada).
- * ext/bigdecimal/bigdecimal.c (BigDecimalValueWithPrec): use
- cannot_be_coerced_into_BigDecimal function.
+ * ext/thread/extconf.rb: for build ext/thread/thread.c.
- * ext/bigdecimal/bigdecimal.c (BigMath_s_exp): ditto.
-
- * ext/bigdecimal/bigdecimal.c (BigMath_s_log): ditto.
+ * include/ruby/intern.h: ditto.
- * test/bigdecimal/test_bigdecimal.rb: test for the avobe changes.
+ * thread.c: ditto.
- * test/bigdecimal/testbase.rb (under_gc_stress): add a new utility
- method to run tests under the condition of GC.stress = true.
+ * lib/thread.rb: removed and replaced by ext/thread/thread.c.
-Wed Aug 17 10:16:00 2011 Kenta Murata <mrkn@mrkn.jp>
+ * 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]
- * backport r32994 from trunk.
+ * 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]
- * 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]
+Fri Sep 6 22:47:12 2013 Tanaka Akira <akr@fsij.org>
- * test/ruby/test_rational.rb (test_coerce): test for the above change.
+ * configure.in: Define ac_cv_func_clock_getres to yes for mingw*.
-Wed Aug 17 06:33:19 2011 Martin Bosslet <Martin.Bosslet@googlemail.com>
+Fri Sep 6 21:04:10 2013 Tanaka Akira <akr@fsij.org>
- * backport r32992 from trunk.
+ * 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.
- * ext/openssl/ossl_x509cert.c: Add class documentation for
- OpenSSL::X509::Certificate.
+ * internal.h (rb_gcd_normal): Declared.
+ (rb_gcd_gmp): Ditto.
-Wed Aug 17 05:02:25 2011 Martin Bosslet <Martin.Bosslet@googlemail.com>
+ * ext/-test-/rational: New directory.
- * backport r32987 from trunk.
+ * test/-ext-/rational: New directory.
- * ext/openssl/ossl_pkey.c: corrected docs, OpenSSL::PKey::DH does
- *not* support #sign/verify.
+Fri Sep 6 14:23:22 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Tue Aug 16 18:56:54 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * win32/win32.c (clock_getres): required as well as clock_gettime().
+ [ruby-dev:47699] [Bug #8869]
- * vm.c (ruby_threadptr_data_type): rename to hide.
- [ruby-core:38972]
+Fri Sep 6 11:45:27 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Tue Aug 16 18:52:08 2011 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.
- * win32/mkexports.rb (Exports::Mswin#each_export): exclude Init_
- and _threadptr_ functions, as well as mingw.
+Fri Sep 6 02:37:22 2013 Aaron Patterson <aaron@tenderlovemaking.com>
-Tue Aug 16 09:38:37 2011 Eric Hodel <drbrain@segment7.net>
+ * ext/psych/lib/psych/visitors/yaml_tree.rb: use double quotes when
+ strings start with special characters.
+ https://github.com/tenderlove/psych/issues/157
- * backport r32981 and r32982 from trunk.
+ * test/psych/test_string.rb: test for change.
- * ext/dl: Add documentation. Patch by Vincent Batts.
- [Ruby 1.9 - Bug #5192]
+Fri Sep 6 00:05:14 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * ext/.document (fiddle): Remove duplicate entry
+ * class.c (rewrite_cref_stack): remove recursion.
- * ext/fiddle: Complete documentation of Fiddle. Patch by Vincent
- Batts. [#5192]
+Thu Sep 5 18:05:00 2013 Charlie Somerville <charliesome@ruby-lang.org>
-Tue Aug 16 08:00:15 2011 Eric Hodel <drbrain@segment7.net>
+ * string.c (fstring_cmp): take string encoding into account when
+ comparing fstrings [ruby-core:57037] [Bug #8866]
- * backport r32977 from trunk
+ * test/ruby/test_string.rb: add test
- * ext/socket: Make Socket documentation appear. Add documentation for
- Socket, TCPServer, SOCKSSocket. Patch by Sylvain Daubert.
- [Ruby 1.9 - Feature #5182]
+Thu Sep 5 17:25:49 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Mon Aug 15 10:16:55 2011 Martin Bosslet <Martin.Bosslet@googlemail.com>
- * backport r32973 from trunk.
+ * string.c (rb_fstring, rb_str_free): use st_data_t instead of VALUE.
- * ext/openssl/ossl_ssl.c: Support disabling OpenSSL compression.
+ * string.c (rb_fstring): get rid of duplicating already frozen object.
- * 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]
+Thu Sep 5 14:01:22 2013 Eric Hodel <drbrain@segment7.net>
-Sat Aug 13 22:17:27 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * lib/optparse.rb: The Integer acceptable now allows binary and
+ hexadecimal numbers per the documentation. [ruby-trunk - Bug #8865]
- * tool/mkconfig.rb: do not make the entries related to sitedir and
- verdordir if disabled by --without options. [ruby-core:38922]
- [Bug #5187]
+ DecimalInteger, OctalInteger, DecimalNumeric now validate their input
+ before converting to a number. [ruby-trunk - Bug #8865]
-Sat Aug 13 17:06:57 2011 Tadayoshi Funaba <tadf@dotrb.org>
+ * test/optparse/test_acceptable.rb: Tests for the above, tests for all
+ numeric acceptables for existing behavior.
- * ext/date/date_core.c: [ruby-core:38861]
+Thu Sep 5 13:49:00 2013 Charlie Somerville <charliesome@ruby-lang.org>
-Sat Aug 13 16:59:51 2011 Tadayoshi Funaba <tadf@dotrb.org>
+ * include/ruby/ruby.h: add RSTRING_FSTR flag
- * test/date/test_*.rb: added tests.
+ * internal.h: add rb_fstring() prototype
-Sat Aug 13 09:36:19 2011 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
+ * string.c (rb_fstring): deduplicate frozen string literals
- * ext/date/date_parse.c (parse_ddd_cb): fix r32896. RB_GC_GUARD
- insertion position was mistaken. [ruby-dev:44337] [Bug #5152]
+ * string.c (rb_str_free): delete fstrings from frozen_strings table when
+ they are GC'd
-Sat Aug 13 09:26:24 2011 Aaron Patterson <aaron@tenderlovemaking.com>
+ * string.c (Init_String): initialize frozen_strings table
- * ext/psych/lib/psych/core_ext.rb: Make Kernel#y private.
- [ruby-core:38913]
+Thu Sep 5 12:48:00 2013 Kenta Murata <mrkn@cookpad.com>
- * test/psych/test_yaml.rb: corresponding test.
+ * configure.in (with_gmp): set with_gmp no if it is empty.
-Sat Aug 13 09:15:16 2011 Tadayoshi Funaba <tadf@dotrb.org>
+Thu Sep 5 10:41:00 2013 Charlie Somerville <charliesome@ruby-lang.org>
- * ext/date/date_core.c (date_strftime_alloc): followed the change
- of r32885.
+ * vm_insnhelper.c (vm_getivar): use class sequence to check class
+ identity, instead of pointer + vm state
- * NEWS: followed the above change.
+ * vm_insnhelper.c (vm_setivar): ditto
-Sat Aug 13 08:49:05 2011 Tadayoshi Funaba <tadf@dotrb.org>
+Thu Sep 5 08:20:58 2013 Tanaka Akira <akr@fsij.org>
- * ext/date/date_core.c: [ruby-core:38855].
+ * 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.
-Sat Aug 13 03:41:37 2011 Eric Hodel <drbrain@segment7.net>
+ * internal.h (rb_big_divrem_gmp): Declared.
- * backport r32953 from trunk.
+Thu Sep 5 06:22:42 2013 Tanaka Akira <akr@fsij.org>
- * lib/uri/common.rb: Fix documentation of URI::Parser.new. Patch by
- Steve Klabnik. [Ruby 1.9 - Bug #5177]
+ * bignum.c (bary_divmod_normal): Reduce temporary array allocations.
-Sat Aug 13 02:19:57 2011 Eric Hodel <drbrain@segment7.net>
+Thu Sep 5 02:17:06 2013 Tanaka Akira <akr@fsij.org>
- * backport r32950 from trunk.
+ * bignum.c (rb_big_divrem_normal): Add GC guards.
- * ext/digest/digest.c: Add documentation for the Digest module. Patch
- by Sylvain Daubert. [Ruby 1.9 - Bug #5167]
+Thu Sep 5 00:38:32 2013 Tanaka Akira <akr@fsij.org>
-Fri Aug 5 13:32:43 2011 Shugo Maeda <shugo@ruby-lang.org>
+ * bignum.c (rb_big_divrem_normal): New function.
- * backport r32856 from trunk.
+ * internal.h (rb_big_divrem_normal): Declared.
- * lib/xmlrpc/client.rb, lib/xmlrpc/server.rb: should use
- String#bytesize instead of String#size.
+ * ext/-test-/bignum/div.c: New file.
-Fri Aug 12 13:53:03 2011 Narihiro Nakamura <narihiro@netlab.jp>
+ * test/-ext-/bignum/test_div.rb: New file.
- * backport r32894 from trunk.
+Thu Sep 5 00:08:44 2013 Tanaka Akira <akr@fsij.org>
- * 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]
+ * bignum.c (bigdivrem_normal): Removed.
+ (bary_divmod_normal): New function.
+ (bary_divmod): Use bary_divmod_normal.
+ (bigdivrem): Use bary_divmod_normal.
- * gc.c (gc_clear_mark_on_sweep_slots): if a sweeping was
- interrupted, we expand the heap if at all possible.
+Wed Sep 4 23:02:12 2013 Tanaka Akira <akr@fsij.org>
-Fri Aug 12 12:28:17 2011 Eric Hodel <drbrain@segment7.net>
+ * bignum.c (bigdivrem): Useless declaration removed.
- * lib/rake: Update to Rake 0.9.2.2. Prevent pollution of toplevel
- namespace by Commands. Remove unused variable and debugging
- statement in tests.
+Wed Sep 4 22:56:49 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Fri Aug 12 09:00:24 2011 Eric Hodel <drbrain@segment7.net>
+ * numeric.c (NUM_STEP_GET_INF): split from NUM_STEP_SCAN_ARGS(), since
+ inf is not used in num_step_size().
- * backport r32941 from trunk
+Wed Sep 4 20:22:43 2013 Tanaka Akira <akr@fsij.org>
- * lib/rubygems: Import RubyGems 1.8.8. Fixes encoding of YAML gemspec
- from gems. Github Issue #149
+ * bignum.c (bigdivrem_normal): Add assertions.
-Fri Aug 12 03:24:35 2011 Eric Hodel <drbrain@segment7.net>
+Wed Sep 4 19:18:40 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * backport r32935 from trunk
+ * internal.h (vm_state_version_t): prefer LONG_LONG to uint64_t.
- * lib/rdoc: Import RDoc 3.9.2. Fixes TIDYLINK for HTML output.
+Wed Sep 4 16:28:14 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Tue Aug 2 22:04:46 2011 NARUSE, Yui <naruse@ruby-lang.org>
+ * internal.h (vm_state_version_t): use uint64_t when it is larger than
+ LONG_LONG, and fallback to unsigned long.
- * backport r32815 from trunk.
+Wed Sep 4 15:37:05 2013 NARUSE, Yui <naruse@ruby-lang.org>
- * gc.c (init_heap): allocate sigaltstack after heaps are allocated.
- [ruby-dev:44315] [Bug #5139]
+ * enc/trans/utf8_mac-tbl.rb: fix r42789.
+ Fix conversion table and logic. [ruby-dev:47680]
- * vm.c (thread_free): use free because objspace is not ready.
+Wed Sep 4 14:08:00 2013 Charlie Somerville <charliesome@ruby-lang.org>
- * vm.c (th_init): use malloc because objspace is not ready.
+ * 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.
-Thu Aug 11 19:04:38 2011 Hiroshi Nakamura <nahi@ruby-lang.org>
+ [ruby-core:55053] [Feature #8426] [GH-387]
- * backport r32931 from trunk.
+Wed Sep 4 11:13:40 2013 Nobuyoshi Nakada <nobu@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.
+ * 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 Aug 11 15:07:36 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Wed Sep 4 11:11:37 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * lib/mkmf.rb (link_command): use LIBRUBYARG in rbconfig for
- unbundled extensions. [ruby-core:38802] [Bug #5147]
+ * configure.in (SOLIBS): LIBRUBY_SO also needs linking with gmp, to
+ run worker processes in test-all on non-ELF platforms.
- * lib/mkmf.rb (init_mkmf): revert r32902. [ruby-core:38903]
+Tue Sep 3 23:01:41 2013 Kouhei Sutou <kou@cozmixng.org>
-Wed Aug 10 19:30:00 2011 Kenta Murata <mrkn@mrkn.jp>
+ * test/rexml/parser/test_tree.rb
+ (TestTreeParser::TestInvalid#test_unmatched_close_tag):
+ Compute expected value from test value.
- * backport r32903 from trunk.
+Tue Sep 3 22:59:58 2013 Kouhei Sutou <kou@cozmixng.org>
- * 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]
+ * 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.
- * test/ruby/test_complex.rb (test_rationalize): add a test for the
- above change.
+Tue Sep 3 22:57:57 2013 Kouhei Sutou <kou@cozmixng.org>
- * complex.c (nucomp_to_r): fix RDoc comment. The patch is made by
- Marc-Andre Lafortune.
+ * test/rexml/parser/test_tree.rb: Fix test name to describe test
+ content.
-Wed Aug 10 14:11:07 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Tue Sep 3 22:54:46 2013 Kouhei Sutou <kou@cozmixng.org>
- * lib/mkmf.rb (init_mkmf): set $LIBRUBYARG regardless of shared
- option. [ruby-core:38802] [Bug #5147]
+ * 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.
-Wed Aug 10 02:57:01 2011 NARUSE, Yui <naruse@ruby-lang.org>
+Tue Sep 3 22:03:49 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * lib/net/http.rb: come back autoload. OpenSSL constant is used
- some places, so it leads mistakes like HTTP.start.
+ * string.c (rb_enc_str_new_cstr): new function to create a string from
+ the C-string pointer with the specified encoding.
-Tue Aug 9 22:57:45 2011 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
+Tue Sep 3 21:41:37 2013 Akira Matsuda <ronnie@dio.jp>
- * ext/date/date_parse.c (date_zone_to_diff): add RB_GC_GUARD.
- [ruby-dev:44337] [Bug #5152]
+ * eval.c (Init_eval): Make Module#include and Module#prepend public
+ [Feature #8846]
- * ext/date/data_parse.c (parse_ddd_cb): ditto.
+ * test/ruby/test_module.rb (class TestModule): Test for above
-Tue Aug 9 12:20:33 2011 Naohisa Goto <ngotogenome@gmail.com>
+Tue Sep 3 21:35:19 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * test/fiddle/helper.rb (libc_so, libm_so): Solaris support added.
- [ruby-core:38853] [Bug #5168]
+ * thread_pthread.c (sys/dyntune.h): for gettune().
- * test/dl/test_base.rb (libc_so, libm_so): on Solaris, remove libc
- and libm version numbers for detecting default libc and libm.
+ * thread_pthread.c (hpux_attr_getstackaddr): fix missing *.
+ [ruby-core:56983] [Feature #8793]
-Tue Aug 9 10:49:52 2011 Igor Zubkov <igor.zubkov@gmail.com>
+Tue Sep 3 20:12:46 2013 Tanaka Akira <akr@fsij.org>
- * array.c: Fix typo. https://github.com/ruby/ruby/pull/36
+ * 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.
-Mon Aug 8 00:10:45 2011 Akinori MUSHA <knu@iDaemons.org>
+ * internal.h (rb_str2big_gmp): Declared.
- * test/test_syslog.rb (TestSyslog#test_log): Do not be too
- specific about the log line format. Fixes #5081.
+Tue Sep 3 19:44:40 2013 NAKAMURA Usaku <usa@ruby-lang.org>
-Sun Aug 7 23:39:44 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * ext/win32/lib/win32/registry.rb (Win32::Registry#values): added.
+ [Feature #7763] [ruby-core:51783]
- * time.c (rb_strftime_alloc): raise ERANGE if width is too large.
- Patch by Nobuyoshi Nakada. [Bug #4457] [ruby-dev:43285]
+Tue Sep 3 18:26:00 2013 Akinori MUSHA <knu@iDaemons.org>
- * test/ruby/test_time.rb (class TestTime): add a test for the
- above change.
+ * misc/inf-ruby.el (inf-ruby-keys, run-ruby): Add magic autoload
+ comments.
-Sun Aug 7 14:15:10 2011 Kazuki Tsujimoto <kazuki@callcc.net>
+ * misc/rdoc-mode.el (rdoc-mode): Ditto.
- * backport r32876 from trunk.
+ * misc/ruby-electric.el (ruby-electric-mode): Ditto.
- * ext/objspace/objspace.c: fix typos in a document.
+ * misc/ruby-style.el (ruby-style-c-mode): Ditto.
-Sun Aug 7 04:42:36 2011 Eric Hodel <drbrain@segment7.net>
+Tue Sep 3 17:06:15 2013 NAKAMURA Usaku <usa@ruby-lang.org>
- * marshal.c (w_object): Fix exception message when _dump_data
- is not defined on a T_DATA object.
+ * test/ruby/test_rubyoptions.rb
+ (TestRubyOptions::SEGVTest::ExpectedStderr): the URL was changed at
+ r42800.
-Sat Aug 6 06:14:20 2011 Eric Hodel <drbrain@segment7.net>
+Tue Sep 3 14:48:25 2013 Zachary Scott <e@zzak.io>
- * lib/rdoc: Update to 3.9.1. Fixes === lines in verbatim sections.
- Fixes :nodoc: on class aliases. Fixes :stopdoc: creating references
- to Object. Fixes spacing when class comments are merged in ri.
- Fixes `ri []` crash. Fixes bug report URL when rdoc crashes. Adds
- :doc: and :nodoc: to allow hiding of implementation details in ruby.
- Makes `rdoc` and `ri` gem-aware.
+ * lib/thread.rb: [DOC] CV#wait typo by @avdi [Fixes GH-386]
+ https://github.com/ruby/ruby/pull/386
-Sat Aug 6 03:19:45 2011 Eric Hodel <drbrain@segment7.net>
+Tue Sep 3 14:37:53 2013 Zachary Scott <e@zzak.io>
- * lib/rubygems: Import RubyGems 1.8.7:
- Added missing require for `gem uninstall --format-executable`.
+ * error.c: [DOC] Update bug tracker url by @ScotterC [Fixes GH-390]
+ https://github.com/ruby/ruby/pull/390
- The correct name of the executable being uninstalled is now displayed
- with --format-executable.
+Tue Sep 3 12:45:23 2013 Tanaka Akira <akr@fsij.org>
- Fixed `gem unpack uninstalled_gem` default version picker.
+ * bignum.c (rb_str2big_poweroftwo): New function.
+ (rb_str2big_normal): Ditto.
+ (rb_str2big_karatsuba): Ditto.
- RubyGems no longer claims a nonexistent gem can be uninstalled.
+ * internal.h (rb_str2big_poweroftwo): Declared.
+ (rb_str2big_normal): Ditto.
+ (rb_str2big_karatsuba): Ditto.
- `gem which` no longer claims directories are requirable files.
+ * ext/-test-/bignum/str2big.c: New file.
- `gem cleanup` continues cleaning up gems if one can't be uninstalled
- due to permissions. Issue #82.
+ * test/-ext-/bignum/test_str2big.rb: New file.
- Gem repository directories are no longer created world-writable.
- Patch by Sakuro OZAWA. [Ruby 1.9 - Bug #4930]
+ * ext/-test-/bignum/depend: Add the dependency for str2big.c.
-Fri Aug 5 23:08:39 2011 Naohisa Goto <ngotogenome@gmail.com>
+Tue Sep 3 12:09:08 2013 Tanaka Akira <akr@fsij.org>
- * backport r32845 from trunk.
+ * process.c (rb_clock_gettime): Support times() based monotonic clock.
+ (rb_clock_getres): Ditto.
- * configure.in: when Solaris cc, use $(CC) to link shared libs.
+Tue Sep 3 12:03:02 2013 Tanaka Akira <akr@fsij.org>
-Fri Aug 5 22:16:20 2011 Naohisa Goto <ngotogenome@gmail.com>
+ * bignum.c (str2big_scan_digits): Extracted from rb_cstr_to_inum.
- * numeric.c (rb_infinity, rb_nan): use WORDS_BIGENDIAN to get endian.
- fix [Bug #5160] [ruby-dev:44356]
+Tue Sep 3 11:23:57 2013 NAKAMURA Usaku <usa@ruby-lang.org>
-Fri Aug 5 15:57:10 2011 Naohisa Goto <ngotogenome@gmail.com>
+ * 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.
- * complex.c (f_signbit): fix compile error in gcc4 on Solaris with
- CFLAGS="-std=gnu99". [ruby-dev:44355] fix [Bug #5159]
+Tue Sep 3 11:00:28 2013 NAKAMURA Usaku <usa@ruby-lang.org>
- * math.c: ditto.
+ * win32/win32.c (do_select): constify timeout.
-Thu Aug 5 10:09:00 2011 Kenta Murata <mrkn@mrkn.jp>
+ * win32/win32.c (rb_w32_select_with_thread): constify 10ms wait and
+ 0ms wait structs.
- * backport r32846 from trunk.
+Tue Sep 3 10:03:42 2013 NAKAMURA Usaku <usa@ruby-lang.org>
- * 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].
+ * 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".
- * thread_pthread.c (native_cond_broadcast): ditto.
+Tue Sep 3 08:20:46 2013 NARUSE, Yui <naruse@ruby-lang.org>
- * thread_pthread.c (struct cached_thread_entry): stop using
- pthread_cond_t and its functions directly.
+ * 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]
- * thread_pthread.c (register_cached_thread_and_wait): ditto.
+Tue Sep 3 07:49:25 2013 Akinori MUSHA <knu@iDaemons.org>
- * thread_pthread.c (use_cached_thread): ditto.
+ * 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.
-Fri Aug 5 07:35:00 2011 Luis Lavena <luislavena@gmail.com>
+ * test/ruby/test_float.rb (TestFloat#test_num2dbl): Revert.
- * lib/rubygems/installer.rb (class Gem): Correct path check on Windows
- Possible fix for [Ruby 1.9 - Bug #5111]
+ * test/ruby/test_numeric.rb (TestNumeric#test_step): Fix test
+ cases for the above change.
- * test/rubygems/test_gem_installer.rb (load Gem): ditto
- Backported from trunk r32804
+Tue Sep 3 07:39:58 2013 Tanaka Akira <akr@fsij.org>
-Fri Aug 5 07:00:31 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * bignum.c (bytes_2comp): Define it only for little endian
+ environment.
- * 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]
+Tue Sep 3 07:31:29 2013 Akinori MUSHA <knu@iDaemons.org>
-Wed Aug 4 02:35:00 2011 Kenta Murata <mrkn@mrkn.jp>
+ * numeric.c (NUM_STEP_SCAN_ARGS): Numeric#step should raise
+ TypeError if a non-numeric parameter is given.
- * configure.in: use build_os variable for checking C and C++ compilers
- matching.
+ * test/ruby/test_float.rb (TestFloat#test_num2dbl): Allow nil as
+ step, as with the keyword argument.
- * configure.in: use clang++ if clang is used.
+ * test/ruby/test_numeric.rb (TestNumeric#test_step): Add tests for
+ nil as step or limit.
-Thu Aug 4 02:21:10 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Tue Sep 3 07:28:49 2013 Tanaka Akira <akr@fsij.org>
- * lib/mkmf.rb (link_command): use static library only for bundled
- extensions. [Bug #5147]
+ * 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.
-Wed Aug 3 00:11:08 2011 Tanaka Akira <akr@fsij.org>
+Tue Sep 3 03:17:26 2013 Koichi Sasada <ko1@atdot.net>
- * lib/prettyprint.rb: update document. [ruby-core:36776]
+ * 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.
-Tue Aug 2 20:10:16 2011 Shota Fukumori <sorah@tubusu.net>
+Mon Sep 2 23:46:29 2013 Akinori MUSHA <knu@iDaemons.org>
- * test/testunit/test_parallel.rb: pass "--ruby" option to
- test/testunit/tests_for_parallel/runner.rb. [Bug #5132] [ruby-dev:44303]
- Backported from trunk r32812.
+ * 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]
-Tue Aug 2 12:03:16 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * numeric.c (num_step): Optimize for infinite loop.
- * hash.c (recursive_hash): hash value of emptied hash should be
- equal to an empty hash. [ruby-core:38650]
+Mon Sep 2 22:55:59 2013 Tanaka Akira <akr@fsij.org>
-Tue Aug 2 11:42:15 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * bignum.c (ISDIGIT): Unused macro removed.
- * parse.y (rb_enc_symname2_p): :! is valid symbol. [Bug #5136]
+Mon Sep 2 22:49:15 2013 Tanaka Akira <akr@fsij.org>
-Tue Aug 2 03:26:02 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+ * bignum.c (str2big_poweroftwo): Extracted from rb_cstr_to_inum.
+ (str2big_normal): Ditto.
+ (str2big_karatsuba): Ditto.
- * test/rake/test_rake_directory_task.rb (TestRakeDirectoryTask#
- test_directory_win32): fixed wrong test.
- backported r32670 from trunk.
+Mon Sep 2 14:39:29 2013 Akinori MUSHA <knu@iDaemons.org>
-Mon Aug 1 15:45:23 2011 Eric Hodel <drbrain@segment7.net>
+ * ruby.c (Process#setproctitle): [DOC] Fix and improve rdoc.
- * 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
+ * ruby.c (Process#argv0): [DOC] Improve rdoc.
-Mon Aug 1 05:21:42 2011 TAKANO Mitsuhiro (takano32) <tak@no32.tk>
+Mon Sep 2 14:15:00 2013 Kenta Murata <mrkn@cookpad.com>
- * cont.c (cont_save_thread): fix missing semicolon.
+ * NEWS: fix description of number literal suffixes.
-Sun Jul 31 22:57:16 2011 Yuki Sonoda (Yugui) <yugui@yugui.jp>
+Mon Sep 2 14:01:00 2013 Charlie Somerville <charliesome@ruby-lang.org>
- * 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.
+ * test/rake/test_rake_rules.rb: add space after string literal to
+ prevent conflict with string options syntax "foo"opts
-Sun Jul 31 22:44:08 2011 Kazuki Tsujimoto <kazuki@callcc.net>
+ * test/rss/rss-assertions.rb: ditto
- * configure.in: fix typos.
+Mon Sep 2 12:28:38 2013 Tanaka Akira <akr@fsij.org>
-Sun Jul 31 21:19:51 2011 Yuki Sonoda (Yugui) <yugui@yugui.jp>
+ * test/ruby/test_bignum.rb (test_interrupt_during_to_s): Disable it
+ when GMP is used.
- * 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.
+Mon Sep 2 07:02:10 2013 Tanaka Akira <akr@fsij.org>
-Sun Jul 31 21:16:02 2011 Yuki Sonoda (Yugui) <yugui@yugui.jp>
+ * bignum.c (Init_Bignum): Define Bignum::GMP_VERSION when GMP is used.
- * complex.c (f_signbit): gcc4 on Solaris DOES have signbit but does
- not have it on header.
+Mon Sep 2 01:46:14 2013 Tanaka Akira <akr@fsij.org>
- * math.c: ditto.
+ * bignum.c (big2str_generic): Reduce arguments.
+ (big2str_gmp): Ditto.
+ (rb_big2str1): Follow the above change.
-Sun Jul 31 21:09:04 2011 Yuki Sonoda (Yugui) <yugui@yugui.jp>
+Mon Sep 2 00:08:08 2013 Tanaka Akira <akr@fsij.org>
- * common.mk (node_name.inc): Use $(Q) for consistency.
+ * 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.
- * Makefile.in (INSNS): ditto.
+Sun Sep 1 23:30:47 2013 Tanaka Akira <akr@fsij.org>
-Sun Jul 31 20:39:12 2011 Yuki Sonoda (Yugui) <yugui@yugui.jp>
+ * bignum.c (GMP_BIG2STR_DIGITS): New constant.
+ (big2str_gmp): New function.
+ (rb_big2str1): Use big2str_gmp for big bignums.
- * common.mk (ECHO1): nmake does not allow parenthesis in make variable
- replacement.
+ * internal.h (rb_big2str_gmp): Declared.
-Sun Jul 31 20:21:36 2011 "Yuki Sonoda (Yugui)" <yugui@yugui.jp>
+ * ext/-test-/bignum/big2str.c (big2str_gmp): New method.
- * common.mk (ECHO1): ":" in a make variable replacement cause a syntax
- error with /usr/ccs/bin/make on Solaris. Uses $(NULLCMD) instead.
+Sun Sep 1 22:37:51 2013 Tanaka Akira <akr@fsij.org>
- * configure.in (NULLCMD): new check.
+ * bignum.c (bary_mul_gmp): Use mpz_init and mpz_clear instead of
+ mpz_inits and mpz_clears.
+ Older GMP don't have them.
- * Makefile.in (NULLCMD): Reflects checking in configure.
+Sun Sep 1 21:17:54 2013 Tanaka Akira <akr@fsij.org>
- * win32/Makefile.sub (NULLCMD): new assignment.
+ * test/net/http/test_http.rb (test_bind_to_local_port): Choose an open
+ port more reliably.
-Sun Jul 31 11:31:07 2011 Kazuki Tsujimoto <kazuki@callcc.net>
+Sun Sep 1 20:32:40 2013 Tanaka Akira <akr@fsij.org>
- * backport r32768 from trunk.
+ * 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.
- * vm.c: check if cfp is valid. [Bug #5083] [ruby-dev:44208]
+ * internal.h (rb_big2str_poweroftwo): Declared.
+ (rb_big2str_generic): Ditto.
-Sat Jul 31 01:23:45 2011 Kenta Murata <mrkn@mrkn.jp>
+ * ext/-test-/bignum/big2str.c: New file.
- * backport r32762 from trunk.
+ * test/-ext-/bignum/test_big2str.rb: New file.
- * test/bigdecimal/test_bigdecimal.rb (test_version): removed.
+Sun Sep 1 15:21:21 2013 Tanaka Akira <akr@fsij.org>
-Sat Jul 30 23:51:44 2011 Tadayoshi Funaba <tadf@dotrb.org>
+ * bignum.c (big2str_2bdigits): Renamed from big2str_orig.
- * lib/cmath.rb (cbrt): should return a real number if possible.
+Sun Sep 1 13:02:24 2013 Tanaka Akira <akr@fsij.org>
-Sat Jul 30 23:48:04 2011 Tadayoshi Funaba <tadf@dotrb.org>
+ * bignum.c: Remove BITSPERDIG >= INT_MAX test. The static assertion,
+ SIZEOF_BDIGITS <= sizeof(BDIGIT) is enough.
- * ext/date/date_core.c: an issue that is same as [ruby-dev:44071].
+Sun Sep 1 11:38:26 2013 Tanaka Akira <akr@fsij.org>
- * ext/date/date_strftime.c: identical to [ruby-dev:44112].
+ * bignum.c (maxpow_in_bdigit): Removed.
-Sat Jul 30 23:19:09 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Sun Sep 1 10:30:42 2013 Tanaka Akira <akr@fsij.org>
- * defs/default_gems: separate from tool/rbinstall.rb.
+ * numeric.c (rb_fix_bit_length): Moved from bignum.c.
-Sat Jul 30 23:14:44 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Sun Sep 1 09:55:45 2013 Tanaka Akira <akr@fsij.org>
- * io.c (rb_io_each_byte): rbuf can be refreshed during yield.
- [Bug #5119]
+ * internal.h (bit_length): Moved from bignum.c.
+ (nlz_int): Ditto.
+ (nlz_long): Ditto.
+ (nlz_long_long): Ditto.
+ (nlz_int128): Ditto.
-Sat Jul 30 22:35:50 2011 Naohisa Goto <ngotogenome@gmail.com>
+Sun Sep 1 03:32:22 2013 Tanaka Akira <akr@fsij.org>
- * strftime.c (NEEDS): avoid SEGV due to integer overflow in
- sparc-solaris2.10 and i686-linux. fix [Bug #4456] [ruby-dev:43284]
+ * bignum.c (bit_length): Renamed from bitsize.
-Sat Jul 30 14:27:00 2011 Kenta Murata <mrkn@mrkn.jp>
+Sun Sep 1 00:07:09 2013 Tanaka Akira <akr@fsij.org>
- * backport r32754 from trunk.
+ * bignum.c (rb_big_bit_length): New method.
+ (rb_fix_bit_length): Ditto.
+ [ruby-core:56247] [Feature #8700]
- * ext/bigdecimal/bigdecimal.c (BigDecimal_version): version 1.1.0.
+Sat Aug 31 22:18:29 2013 Tanaka Akira <akr@fsij.org>
- * ext/bigdecimal/bigdecimal.gemspec: turn into a default gem.
+ * process.c (rb_clock_getres): New method.
+ (timetick2dblnum_reciprocal): New function.
- * tool/rbinstall.rb: ditto.
+ * configure.in: Check clock_getres.
-Sat Jul 30 13:52:00 2011 Kenta Murata <mrkn@mrkn.jp>
+ [ruby-core:56780] [Feature #8809] accepted as a CRuby feature at
+ DevelopersMeeting20130831Japan
+ https://bugs.ruby-lang.org/projects/ruby/wiki/DevelopersMeeting20130831Japan
- * ext/bigdecimal/lib/bigdecimal/util.rb (Rational#to_d):
- revive zero and implicit precision support as a deprecated feature.
+Sat Aug 31 21:02:07 2013 Tanaka Akira <akr@fsij.org>
- * test/bigdecimal/test_bigdecimal_util.rb: modify a test for the above
- change.
+ * 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.
- * NEWS: describes the above change.
+ * configure.in: Detect GMP.
-Sat Jul 30 10:58:10 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ [ruby-core:56658] [Feature #8796]
- * 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].
+Sat Aug 31 15:03:00 2013 Charlie Somerville <charliesome@ruby-lang.org>
- * signal.c (rb_register_sigaltstack): ditto.
+ * compile.c (NODE_MATCH3): pass CALL_INFO to opt_regexpmatch2
- * vm_core.h: moved ALT_STACK_SIZE definition from signal.c.
+ * insns.def (opt_regexpmatch2): use CALL_SIMPLE_METHOD to call =~ if
+ the receiver is not a T_STRING [Bug #8847] [ruby-core:56916]
- * vm.c (thread_free): use xfree() instead of free().
+Sat Aug 31 14:07:11 2013 Tanaka Akira <akr@fsij.org>
-Sat Jul 30 07:20:49 2011 Tanaka Akira <akr@fsij.org>
+ * lib/securerandom.rb (random_bytes): Use Process.clock_gettime.
- * ext/socket/lib/socket.rb (udp_server_sockets): unused variable
- removed.
- patch by Jeremy Evans. [ruby-core:38600]
+Sat Aug 31 00:25:15 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Fri Jul 29 23:56:32 2011 Tanaka Akira <akr@fsij.org>
+ * include/ruby/encoding.h (rb_{ascii8bit,utf8,usascii}_encindex): get
+ rid of conflict with macros defined in internal.h.
- * lib/securerandom.rb: call OpenSSL::Random.seed at the
- SecureRandom.random_bytes call.
- based on the patch by Masahiro Tomita. [ruby-dev:44270]
+Fri Aug 30 22:37:57 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Fri Jul 29 20:48:39 2011 Tanaka Akira <akr@fsij.org>
+ * thread_pthread.c (native_thread_init_stack): wait the creator thread
+ to fill machine stack info, if get_stack_of() is available.
- * ext/socket/mkconstants.rb: fix typos.
+ * thread_pthread.c (native_thread_create): fill the created thread
+ stack info after starting, if get_stack_of() is available.
-Fri Jul 29 20:28:56 2011 Tanaka Akira <akr@fsij.org>
+ * thread_pthread.c (native_thread_create): define attr only if it is
+ used, and merge pthread_create() calls.
- * ext/socket/mkconstants.rb: use whitespaces as a separator.
+ * thread_pthread.c (get_main_stack): separate function to get stack of
+ main thread.
-Fri Jul 29 18:59:07 2011 Tanaka Akira <akr@fsij.org>
+Thu Aug 29 18:05:33 2013 Koichi Sasada <ko1@atdot.net>
- * ext/socket/mkconstants.rb: add documents for constants.
- patch by Eric Hodel. [ruby-core:37853] [Bug #4989]
+ * struct.c (rb_struct_define_without_accessor_under): added.
+ This function is similar to rb_define_class_under() against
+ rb_define_class().
-Mon Jul 25 23:51:01 2011 Yusuke Endoh <mame@tsg.ne.jp>
+ * include/ruby/intern.h: add a declaration of this function.
- * backport r32671 from trunk.
+Thu Aug 29 17:03:10 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * 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]
+ * 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]
-Mon Jul 25 22:36:11 2011 Yusuke Endoh <mame@tsg.ne.jp>
+Thu Aug 29 05:35:58 2013 Eric Hodel <drbrain@segment7.net>
- * backport r32669 from trunk.
+ * 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.
- * 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]
+Thu Aug 29 02:40:45 2013 Aaron Patterson <aaron@tenderlovemaking.com>
-Thu Jul 28 23:36:28 2011 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
+ * ext/psych/lib/psych/scalar_scanner.rb: invalid floats should be
+ treated as strings.
+ https://github.com/tenderlove/psych/issues/156
- * 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]
+ * test/psych/test_string.rb: test for change
-Thu Jul 28 22:51:27 2011 Hiroshi Nakamura <nahi@ruby-lang.org>
+Wed Aug 28 17:20:07 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * backport r32723 from trunk.
+ * 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]
- * 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.
+Wed Aug 28 11:24:20 2013 Michal Rokos <michal@rokos.cz>
- 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.
+ * configure.in (sys/pstat.h): fix missing header check for
+ missing/setproctitle.c on HP-UX. [ruby-core:56644] [Bug #8792]
- * test/openssl/test_cipher.rb: test it.
+Wed Aug 28 04:54:33 2013 Eric Hodel <drbrain@segment7.net>
-Thu Jul 28 04:53:31 2011 Eric Hodel <drbrain@segment7.net>
+ * ext/openssl/ossl_ssl.c (ossl_ssl_read): Replace duplicate
+ wait_writable with wait_readable.
- * lib/delegate.rb: Move file-level documentation to the appropriate
- classes.
+Tue Aug 27 17:18:40 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Thu Jul 28 00:33:47 2011 NARUSE, Yui <naruse@ruby-lang.org>
+ * lib/timeout.rb (Timeout#timeout): skip rescue clause only when no
+ exception class is given.
- * test/fileutils/test_fileutils.rb: add OpenBSD case.
- patched by Jeremy Evans [ruby-core:38530] see #5097
+Tue Aug 27 17:02:58 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * test/ruby/test_process.rb: ditto.
+ * 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]
-Wed Jul 27 17:59:46 2011 NARUSE, Yui <naruse@ruby-lang.org>
+Tue Aug 27 17:02:33 2013 Nobuyoshi Nakada <nobu@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.
+ * io.c (copy_stream_body): move common open flags.
-Wed Jul 27 15:39:14 2011 Eric Hodel <drbrain@segment7.net>
+Tue Aug 27 16:56:50 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * object.c: Add usage documentation for BasicObject. Based on patch
- by Thomas Sawyer. [Ruby 1.9 - Bug #5067]
+ * enumerator.c (enumerator_size): use rb_check_funcall() instead of
+ respond_to? and call.
-Wed Jul 27 12:24:17 2011 Eric Hodel <drbrain@segment7.net>
+ * enumerator.c (enumerator_each): ensure that argument array size
+ does not overflow at appending.
- * lib/rubygems/uninstaller.rb: Add missing require and update
- messaging to avoid confusion with uninstall --format-executable.
- [Ruby 1.9 - Bug #4062]
+Tue Aug 27 16:46:05 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Wed Jul 27 10:47:57 2011 Eric Hodel <drbrain@segment7.net>
+ * array.c (rb_ary_index, rb_ary_rindex): use optimized equality to
+ improve performance. [Feature #8820]
- * lib/rubygems: Update to RubyGems 1.8.6.1.
+ * vm_insnhelper.c (rb_equal_opt): optimized equality function.
-Wed Jul 27 10:04:06 2011 Martin Bosslet <Martin.Bosslet@googlemail.com>
+Tue Aug 27 16:11:05 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * backport r32690 from trunk.
+ * vm_insnhelper.c (opt_eq_func): use RBASIC_CLASS() instead of HEAP_CLASS_OF().
- * test/openssl/test_pkcs12.rb: Add test and intermediate certificates.
- [ Ruby 1.9 - Feature #3793 ] [ruby-core:32088]
+ * 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.
-Sat Jul 27 01:26:00 2011 Kenta Murata <mrkn@mrkn.jp>
+Tue Aug 27 16:08:26 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * NEWS: add changes of bigdecimal and bigdecimal/util.
+ * vm_eval.c (rb_check_funcall, rb_check_funcall_with_hook): constify
+ argv.
-Wed Jul 27 01:13:00 2011 Kenta Murata <mrkn@mrkn.jp>
+Tue Aug 27 13:03:33 2013 Koichi Sasada <ko1@atdot.net>
- * ext/bigdecimal/lib/bigdecimal/util.rb (Rational#to_d):
- zero or negative precision is error. fixes #5098.
- [ruby-dev:44210]
+ * ext/stringio/stringio.c (strio_read_nonblock): declare local
+ variables at the first of function.
- * ext/bigdecimal/lib/bigdecimal/util.rb (Float#to_d): modified for
- specifying precision. fixes #5098. [ruby-dev:44210]
+Tue Aug 27 11:51:37 2013 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
- * ext/bigdecimal/lib/bigdecimal/util.rb (Integer#to_d): added
- for symmetry to BigDecimal() function with an Integer.
- fixes #5098. [ruby-dev:44210]
+ * enumerator.c: Allow Enumerator size argument to be any callable.
+ Patch by Avdi Grimm. [bug #8641] [ruby-core:56032] [fix GH-362]
- * ext/bigdecimal/lib/bigdecimal/util.rb (BigDecimal#to_d): added
- for adapting other Numeric subclasses. [ruby-dev:44245]
+ * test/ruby/test_enumerator.rb: Test for above
- * test/bigdecimal/test_bigdecimal_util.rb: add tests for the above
- changes.
+Tue Aug 27 11:46:31 2013 Koichi Sasada <ko1@atdot.net>
-Wed Jul 27 00:54:38 2011 Kenta Murata <mrkn@mrkn.jp>
+ * gc.c (gc_profile_clear): do rest_sweep() before clearing
+ profile.current_record.
- * bigdecimal/bigdecimal.c (VpDup) a new function for duplicating
- a BigDecimal.
+Tue Aug 27 07:35:05 2013 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]
+ * 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
-Mon Jul 25 22:24:09 2011 Hiroshi Nakamura <nahi@ruby-lang.org>
+Tue Aug 27 05:24:34 2013 Eric Hodel <drbrain@segment7.net>
- * backport r32666 from trunk.
+ * lib/rubygems: Import RubyGems 2.1.0 Release Candidate
+ * test/rubygems: ditto.
- * 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.
+Mon Aug 26 16:24:58 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * test/xmlrpc/test_webrick_server.rb: test it.
+ * parse.y (parser_nextc): warn carriage return in middle of line.
+ [ruby-core:56240] [Feature #8699]
-Mon Jul 25 15:36:07 2011 Hiroshi Nakamura <nahi@ruby-lang.org>
+Mon Aug 26 15:27:39 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * ext/openssl/lib/openssl/{x509.rb,ssl.rb}: Add deprecation warning
- for openssl/{x509,ssl} usage. Users should require "openssl" instead
- of "openssl/ssl" and "openssl/x509". Start of transition period
- introduced by [ruby-dev:38018].
+ * lib/timeout.rb (Timeout#timeout): should not be caught by rescue
+ clause. [Bug #8730]
-Mon Jul 25 13:50:33 2011 Hiroshi Nakamura <nahi@ruby-lang.org>
+Mon Aug 26 14:44:26 2013 Koichi Sasada <ko1@atdot.net>
- * backport r32662 from trunk.
+ * array.c (rb_ary_splice): use RARRAY_PTR_USE() without WB because
+ there are not new relations.
- * ext/openssl/lib/openssl/x509.rb: Cosmetic change: move definition
- introduced in r30152 to x509-internal.rb.
+ * enum.c (enum_sort_by): ditto.
-Mon Jul 25 13:35:20 2011 Hiroshi Nakamura <nahi@ruby-lang.org>
+ * struct.c (setup_struct): use RARRAY_RAWPTR().
- * backport r32658 from trunk.
+ * vm_eval.c (yield_under): ditto.
- * 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.
+ * ext/pathname/pathname.c (path_entries): use RARRAY_AREF().
- By design, we're ignoring any error at SSL_shutdown() so we clear
- global error stack after SSL_shutdown is called. See #5039.
+ * ext/pathname/pathname.c (path_s_glob): ditto.
-Sun Jul 24 20:29:53 2011 Tanaka Akira <akr@fsij.org>
+Mon Aug 26 13:11:10 2013 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
- * ext/socket/extconf.rb: refine the recvmsg test.
+ * array.c (ary_ensure_room_for_push): fix typo in r42658.
-Sun Jul 24 20:02:31 2011 Tanaka Akira <akr@fsij.org>
+Mon Aug 26 12:37:10 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * ext/socket/extconf.rb: fix the recvmsg test.
+ * template/sizes.c.tmpl: generate automatically by extracting
+ RUBY_CHECK_SIZEOF from configure.in.
-Sun Jul 24 08:42:51 2011 Tanaka Akira <akr@fsij.org>
+Mon Aug 26 10:16:59 2013 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
- * ext/socket/extconf.rb: test recvmsg allocates file descriptors for
- fd passing even with MSG_PEEK.
+ * process.c (gcd_timetick_int): Renamed from gcd_timtick_int.
- * ext/socket/ancdata.c: use the above test result.
+Sun Aug 25 21:02:15 2013 Tanaka Akira <akr@fsij.org>
-Sun Jul 24 01:24:31 2011 Eric Hodel <drbrain@segment7.net>
+ * sizes.c (Init_sizes): Define the size of clock_t.
- * lib/rubygems/specification.rb: Restore behavior of
- Gem::Specification#loaded. [Ruby 1.9 - Bug #5032]
+Sun Aug 25 01:47:47 2013 Tanaka Akira <akr@fsij.org>
-Sun Jul 24 01:14:49 2011 NARUSE, Yui <naruse@ruby-lang.org>
+ * bignum.c (BARY_SHORT_MUL): Renamed from BARY_MUL1.
+ (bary_short_mul): Renamed from bary_mul1.
- * 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 Aug 24 10:35:09 2013 Tanaka Akira <akr@fsij.org>
- * test/rake/test_rake_rake_test_loader.rb: ditto.
+ * process.c (rb_clock_gettime): The emulated clock names changed.
- * test/rake/test_rake_task_argument_parsing.rb
- (test_terminal_width_using_hardcoded_80): hardcoded 80 is used
- when app.unix? is false.
+Fri Aug 23 22:22:07 2013 Tanaka Akira <akr@fsij.org>
-Sun Jul 24 00:42:00 2011 Kenta Murata <mrkn@mrkn.jp>
+ * process.c (rb_clock_gettime): Add a cast to fix compile error by
+ -Werror,-Wshorten-64-to-32.
- * configure.in: change the default compiler to gcc-4.2 if target os
- is OS X 10.7 (Lion).
+Fri Aug 23 22:12:13 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Sat Jul 23 17:06:25 2011 Tanaka Akira <akr@fsij.org>
+ * process.c (rb_intern): no symbol cache while initialization.
- * io.c (rb_update_max_fd): validate fd.
+Fri Aug 23 22:07:45 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * ext/socket/rubysocket.h (rsock_discard_cmsg_resource): add
- msg_peek_p argument for the declaration.
+ * configure.in (clock_t): needs time.h.
- * 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.
+Fri Aug 23 21:37:28 2013 Tanaka Akira <akr@fsij.org>
- * ext/socket/unixsocket.c (unix_recv_io): call
- rsock_discard_cmsg_resource with msg_peek_p argument.
+ * process.c (reduce_factors): New function.
+ (timetick2dblnum): Use reduce_factors.
+ (timetick2integer): Ditto.
+ (make_clock_result): Follow the above change.
+ (rb_clock_gettime): Ditto.
-Sat Jul 23 14:38:28 2011 Eric Hodel <drbrain@segment7.net>
+Fri Aug 23 21:00:55 2013 Tanaka Akira <akr@fsij.org>
- * test/rake*: Remove dependencies on flexmock and session gems.
- [Ruby 1.9 - Bug #4987]
+ * 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 Jul 22 21:46:54 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+Fri Aug 23 20:50:40 2013 Tanaka Akira <akr@fsij.org>
- * 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 #5076] [ruby-dev:44185]
+ * 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 Jul 22 21:50:16 2011 NARUSE, Yui <naruse@ruby-lang.org>
+Fri Aug 23 18:39:04 2013 Koichi Sasada <ko1@atdot.net>
- * lib/uri/generic.rb (WFKV_): unroll the loop of regexp.
+ * array.c (ary_make_shared): shared ary as shady. Need more effort to
+ make it normal object.
- * lib/uri/generic.rb (URI.decode_www_form_component): ditto.
+ * array.c (rb_ary_modify): use RARRAY_PTR_USE() without WB because
+ there are not new relations.
-Fri Jul 22 21:49:48 2011 NARUSE, Yui <naruse@ruby-lang.org>
+ * array.c (ary_ensure_room_for_unshift): use RARRAY_RAWPTR() because
+ there are not new relations.
- * 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
+Fri Aug 23 11:25:57 2013 Koichi Sasada <ko1@atdot.net>
-Fri Jul 22 21:49:28 2011 NARUSE, Yui <naruse@ruby-lang.org>
+ * array.c: introduce ARY_SHARED_OCCUPIED(shared).
- * 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]
+Fri Aug 23 11:07:08 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Fri Jul 22 21:45:21 2011 NARUSE, Yui <naruse@ruby-lang.org>
+ * win32/Makefile.sub (config.h): now SIZEOF_CLOCK_T is needed for
+ unsigned_clock_t.
- * ext/dl/handle.c (dlhandle_sym): clear previous error with dlerror()
- before calling dlsym(). [ruby-dev:44091] [Bug #5021]
+Thu Aug 22 22:01:04 2013 Tanaka Akira <akr@fsij.org>
-Fri Jul 22 19:05:47 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * process.c (rb_clock_gettime): Strip "s" from unit names.
- * parse.y (rb_enc_symname2_p): get rid of potential out-of-bound
- access.
+Thu Aug 22 20:14:59 2013 Tanaka Akira <akr@fsij.org>
-Fri Jul 22 13:55:59 2011 Eric Hodel <drbrain@segment7.net>
+ * process.c (unsigned_clock_t): Defined.
+ (rb_clock_gettime): Consider clock_t overflow for
+ ISO_C_CLOCK_BASED_CLOCK_PROCESS_CPUTIME_ID.
- * lib/net/http.rb: Net::HTTP#finish is used to manually close
- connections. [Ruby 1.9 - Bug #5045]
+ * configure.in: Check the size of clock_t.
-Fri Jul 22 13:51:29 2011 Eric Hodel <drbrain@segment7.net>
+Thu Aug 22 16:22:48 2013 Koichi Sasada <ko1@atdot.net>
- * ext/readline/readline.c: Add examples for Readline.completion_proc=.
- [Ruby 1.9 - Bug #5057]
+ * compile.c (build_postexe_iseq): fix to setup the local table.
-Fri Jul 22 13:20:33 2011 Eric Hodel <drbrain@segment7.net>
+Thu Aug 22 15:42:43 2013 Koichi Sasada <ko1@atdot.net>
- * tool/rbinstall.rb (default gems): Install executables into the fake
- gem dir for Gem.bin_path. [Ruby 1.9 - Bug #4485]
+ * compile.c (rb_iseq_compile_node): accept NODE_IFUNC to support
+ custom compilation.
-Fri Jul 22 13:03:12 2011 Martin Bosslet <Martin.Bosslet@googlemail.com>
+ * compile.c (NODE_POSTEXE): compile to
+ "ONCE{ VMFrozenCore::core#set_postexe{...} }" with a new custom
+ compiler `build_postexe_iseq()'.
- * backport r32609 from trunk.
+ * vm.c (m_core_set_postexe): remove parameters (passed by a block).
- * ext/openssl/ossl_hmac.c: Revert checking return type of
- HMAC_Init_ex as it is not compatible with OpenSSL < 1.0.0.
+Thu Aug 22 06:54:15 2013 Tanaka Akira <akr@fsij.org>
-Fri Jul 22 11:22:20 2011 Martin Bosslet <Martin.Bosslet@googlemail.com>
+ * process.c (rb_clock_gettime): Change emulation symbols for
+ Process.clock_gettime.
- * backport r32606 from trunk.
+Thu Aug 22 06:24:54 2013 Tanaka Akira <akr@fsij.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]
+ * process.c (make_clock_result): Extracted from rb_clock_gettime.
-Fri Jul 22 09:17:43 2011 Martin Bosslet <Martin.Bosslet@googlemail.com>
+Wed Aug 21 22:30:51 2013 Tanaka Akira <akr@fsij.org>
- * backport r32604 from trunk.
+ * process.c (rb_clock_gettime): clock() based CLOCK_PROCESS_CPUTIME_ID
+ emulation implemented.
- * 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]
+Wed Aug 21 21:02:37 2013 Tanaka Akira <akr@fsij.org>
-Fri Jul 22 06:39:34 2011 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
+ * process.c (rb_proc_times): Use RB_GC_GUARD to guard objects from GC.
- * lib/csv.rb: Do not modify CSV.generate's argument [ruby-core:38356]
+Wed Aug 21 20:33:01 2013 Tanaka Akira <akr@fsij.org>
-Thu Jul 21 20:02:11 2011 Yusuke Endoh <mame@tsg.ne.jp>
+ * process.c (get_clk_tck): Extracted from rb_proc_times.
+ (rb_clock_gettime): times() based CLOCK_PROCESS_CPUTIME_ID emulation
+ is implemented.
- * 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]
+Wed Aug 21 19:31:48 2013 Tanaka Akira <akr@fsij.org>
- * test/ruby/test_continuation.rb (class TestContinuation): add a test
- for above. a patch from James M. Lawrence.
+ * process.c: POSIX_GETTIMEOFDAY_CLOCK_REALTIME is renamed to
+ SUS_GETTIMEOFDAY_CLOCK_REALTIME.
-Thu Jul 21 20:59:59 2011 Tanaka Akira <akr@fsij.org>
+Wed Aug 21 19:17:46 2013 Tanaka Akira <akr@fsij.org>
- * ext/socket/ancdata.c (discard_cmsg): workaround for MacOS X Lion.
+ * 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>
-Thu Jul 21 07:07:57 2011 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]
- * backport r32579, r32581, r32587 by akr and r32588 by kazu.
+Wed Aug 21 02:32:32 2013 Koichi Sasada <ko1@atdot.net>
- r32579:
+ * insns.def: fix regexp's once option behavior.
+ fix [ruby-trunk - Bug #6701]
- * io.c (rb_update_max_fd): new function.
+ * insns.def: remove `onceinlinecache' and introduce `once' instruction.
+ `once' doesn't use `setinlinecache' insn any more.
- * internal.h (rb_update_max_fd): declare rb_update_max_fd.
+ * vm_core.h: `union iseq_inline_storage_entry' to store once data.
- * thread_pthread.c (rb_thread_create_timer_thread): update max fd when
- timer thread pipe is created.
+ * compile.c: catch up above changes.
- r32581:
+ * iseq.c: ditto.
- * io.c (UPDATE_MAXFD): removed.
+ * vm.c, vm_insnhelper.c: ditto. fix `m_core_set_postexe()' which
+ is depend on `onceinlinecache' insn.
- r32587:
+ * test/ruby/test_regexp.rb: add tests.
- * include/ruby/intern.h (rb_update_max_fd): declaration moved from
- internal.h.
+ * iseq.c: ISEQ_MINOR_VERSION to 1 (should increment major?)
- * file.c: ditto.
+Wed Aug 21 02:30:15 2013 Koichi Sasada <ko1@atdot.net>
- * io.c: call rb_update_max_fd for each new fds.
+ * gc.c (rb_gcdebug_print_obj_condition): add printing information.
- * process.c: ditto.
+Tue Aug 20 13:38:00 2013 Naohisa Goto <ngotogenome@gmail.com>
- * random.c: ditto.
-
- * ruby.c: ditto.
+ * 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]
- * ext/io/console/console.c: ditto.
+Tue Aug 20 02:32:52 2013 Zachary Scott <e@zzak.io>
- * ext/openssl/ossl_bio.c: ditto.
+ * 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.
- * ext/pty/pty.c: ditto.
+ This patch was based on a patch submitted by Steve Klabnik.
+ [ruby-core:56694] [Bug #8778]
- * ext/socket/init.c: ditto.
+Tue Aug 20 02:10:19 2013 Zachary Scott <e@zzak.io>
- * ext/socket/socket.c: ditto.
+ * lib/rss/rss.rb: [DOC] Document for constants by Steve Klabnik
+ [ruby-core:56705] [Bug #8798]
- * ext/socket/ancdata.c: ditto.
+Tue Aug 20 02:01:10 2013 Zachary Scott <e@zzak.io>
- * ext/socket/unixsocket.c: ditto.
+ * lib/rss/xmlparser.rb: [DOC] Hide legacy constant from rdoc
+ Patch by Steve Klabnik [ruby-core:56708] [Bug #8799]
- r32588:
-
- * io.c (rb_update_max_fd): remove parentheses. they are not in
- macro.
+Tue Aug 20 01:52:05 2013 Zachary Scott <e@zzak.io>
-Sun Jul 17 08:07:31 2011 Martin Bosslet <Martin.Bosslet@googlemail.com>
+ * 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]
- * backport r32563 from trunk
+Tue Aug 20 01:19:22 2013 Tanaka Akira <akr@fsij.org>
- * 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]
+ * configure.in: Define ac_cv_func_clock_gettime to yes for mingw*.
-Sat Jul 16 17:29:20 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Mon Aug 19 21:31:35 2013 Tanaka Akira <akr@fsij.org>
- * configure.in (RUBY_UNIVERSAL_ARCH): restore arch flag.
- Bug #4977
+ * 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.
-Sat Jul 16 11:18:26 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+Mon Aug 19 20:55:12 2013 Koichi Sasada <ko1@atdot.net>
- * win32/setup.mak: support to build x64-mswin64 on Windows7 (and Vista,
- perhaps).
- backported r32521 from trunk
+ * gc.c: fix around GC_DEBUG.
-Sat Jul 16 06:31:23 2011 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
+ * gc.c (RVALUE::line): should be VALUE. On some environment
+ (such as mswin64), `int' introduces alignment mismatch.
- * lib/uri/common.rb (module): Remove optional parser argument to
- Kernel#URI
- [ruby-core:38061]
+ * gc.c (newobj_of): add an assertion to check VALUE alignment.
- * lib/uri/generic.rb (module): ditto
+ * gc.c (aligned_malloc): `&' is low priority than `=='.
-Sat Jul 16 01:15:53 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * gc.c: define GC_DEBUG everytime and use it as value 0 or 1.
- * time.c (time_dup): used rb_obj_class() instead of CLASS_OF().
- The patch is made by Kazuki Tsujimoto. [Bug #5012] [ruby-dev:44071]
+Mon Aug 19 17:43:44 2013 Koichi Sasada <ko1@atdot.net>
- * test/ruby/test_time.rb (TestTime#test_getlocal_dont_share_eigenclass):
- added a new test for eigenclass of time object.
+ * test/ruby/test_fiber.rb: collect garbage fibers immediately.
-Fri Jul 15 19:11:00 2011 Kenta Murata <mrkn@mrkn.jp>
+Mon Aug 19 17:41:49 2013 Koichi Sasada <ko1@atdot.net>
- * bignum.c (bigsub_int): add RB_GC_GUARD. This patch is made by
- Makoto Kishimoto. fixes #4223 [ruby-dev:42907]
+ * test/profile_test_all.rb: add `failed?' information.
- * bignum.c (bigadd_int): ditto.
+Mon Aug 19 17:00:53 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Fri Jul 15 09:59:12 2011 Hiroshi Nakamura <nahi@ruby-lang.org>
+ * process.c (retry_fork): retry with GC if ENOMEM occurred, to free
+ swap/kernel space.
- * backport r32546 from trunk.
+Mon Aug 19 13:28:47 2013 NAKAMURA Usaku <usa@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.
+ * include/ruby/win32.h (CLOCK_MONOTONIC): typo.
- * test/digest/test_digest.rb: add test for unalignment access.
+ * win32/win32.c: removed duplicated declarations.
+Mon Aug 19 13:03:08 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Thu Jul 14 12:40:07 2011 Hiroshi Nakamura <nahi@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.
- * backport r32537 from trunk.
+Mon Aug 19 12:56:49 2013 Tanaka Akira <akr@fsij.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.
+ * process.c (Init_process): Add constants: CLOCK_REALTIME_ALARM and
+ CLOCK_BOOTTIME_ALARM.
- * test/openssl/test_ssl.rb
- (test_exception_in_verify_callback_is_ignored): test it.
+Sun Aug 18 20:17:41 2013 Kazuki Tsujimoto <kazuki@callcc.net>
-Wed Jul 13 08:20:08 2011 Shota Fukumori <sorah@tubusu.net>
+ * variable.c, vm_method.c: remove dead code.
- * lib/test/unit.rb(Test::Unit::Options#process_args): Fix bug.
- Fix process_args didn't return `@option` after r30939. Backported
- r32526 from trunk.
+ * test/ruby/test_fiber.rb, test/ruby/test_thread.rb:
+ change accordingly.
-Mon Jul 11 23:50:39 2011 Yutaka Kanemoto <kanemoto@ruby-lang.org>
+Sun Aug 18 19:32:26 2013 Kazuki Tsujimoto <kazuki@callcc.net>
- * time.c: can't compile time.c on AIX due to missing declaration for
- ffs(). It is declared in strings.h on AIX. backported r32518 from
- trunk.
+ * error.c, file.c, gc.c, hash.c, thread.c, variable.c, vm_eval.c, bin/erb:
+ $SAFE=4 is obsolete.
-Mon Jul 11 23:47:00 2011 Yutaka Kanemoto <kanemoto@ruby-lang.org>
+Sun Aug 18 14:30:47 2013 Tanaka Akira <akr@fsij.org>
- * thread_pthread.c (get_stack): need to adjust stack addr for
- [Bug #1813] on AIX. backported r32511 from trunk.
+ * process.c (rb_clock_gettime): Rename POSIX_TIME_CLOCK_REALTIME to
+ ISO_C_TIME_CLOCK_REALTIME.
-Mon Jul 11 15:17:03 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+Sun Aug 18 14:22:45 2013 Tanaka Akira <akr@fsij.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.
- backported r32512 from trunk.
+ * configure.in: Revert r42604. It causes linking librt on systems
+ with newer glibc uselessly.
-Sun Jul 10 23:58:55 2011 Yuki Sonoda (Yugui) <yugui@yugui.jp>
+Sun Aug 18 13:18:38 2013 Tanaka Akira <akr@fsij.org>
- * version.h: 1.9.3 is no longer trunk.
+ * process.c (Init_process): Add constants: CLOCK_REALTIME_COARSE,
+ CLOCK_MONOTONIC_COARSE and CLOCK_BOOTTIME.
-Sun Jul 10 23:24:29 2011 Yuki Sonoda (Yugui) <yugui@yugui.jp>
+Sun Aug 18 12:41:50 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * class.c (rb_mix_module): reverted r31873.
- (check_mix_method_i, do_mix_method_i) reverted r31917.
+ * 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.
- * test/ruby/test_module.rb (TestModule#test_mix_const): reverted
- r31918.
+Sun Aug 18 10:05:12 2013 Tanaka Akira <akr@fsij.org>
-Sun Jul 10 22:50:00 2011 Kenta Murata <mrkn@mrkn.jp>
+ * bignum.c (rb_big2str1): Make an expression more explicit.
- * ext/bigdecimal/bigdecimal.c (rmpd_power_by_big_decimal): fix
- precision treatment errors.
+Sun Aug 18 03:18:45 2013 Tanaka Akira <akr@fsij.org>
- * test/bigdecimal/test_bigdecimal.rb: add tests for the above change.
- fix precision treatment errors.
+ * bignum.c (rb_big2str1): Use power_level instead of bitsize(xn).
- * ext/bigdecimal/bigdecimal.c (BigDecimal_power): precision argument
- should be optional for its compatibility.
+Sun Aug 18 00:44:58 2013 Tanaka Akira <akr@fsij.org>
-Sun Jul 10 22:38:09 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * bignum.c (BIGDIVREM_EXTRA_WORDS): Redefine to 1.
+ (bigdivrem_num_extra_words): Removed.
+ (bigdivrem_normal): Simplified.
+ (big2str_karatsuba): Ditto.
- * parse.y (var_ref): distinguish vcall from local variable
- references. based on a patch by Michael Edgar michael.j.edgar
- AT dartmouth.edu. Bug #5002
+Sat Aug 17 23:25:19 2013 Benoit Daloze <eregontp@gmail.com>
-Sun Jul 10 21:51:29 2011 Koichi Sasada <ko1@atdot.net>
+ * test/ruby/test_time.rb: use the in_timezone() helper
+ and define it at the top with other helpers.
- * internal.h: add comments (cautions).
+Sat Aug 17 22:20:47 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Sun Jul 10 20:59:38 2011 Shota Fukumori <sorah@tubusu.net>
+ * time.c (time_mload): ignore auxiliary data, offset and zone, if
+ invalid. [ruby-core:56648] [Bug #8795]
- * lib/test/unit.rb: Add new class variable `@@testfile_prefix`.
- This is for changing test name prefix. (For testing)
+Sat Aug 17 20:11:49 2013 Benoit Daloze <eregontp@gmail.com>
- * test/testunit/tests_for_parallel/ptest_first.rb: Renamed from
- test_first.rb
+ * 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
- * test/testunit/tests_for_parallel/ptest_second.rb: Renamed from
- test_second.rb
+Fri Aug 16 18:12:05 2013 Koichi Sasada <ko1@atdot.net>
- * test/testunit/tests_for_parallel/ptest_third.rb: Renamed from
- test_third.rb
+ * test/profile_test_all.rb: fix typo.
- * test/testunit/tests_for_parallel/ptest_forth.rb: Renamed from
- test_forth.rb
+Fri Aug 16 18:09:20 2013 Koichi Sasada <ko1@atdot.net>
- * test/testunit/tests_for_parallel/runner.rb: Remove misc.rb
+ * test/profile_test_all.rb: remove space characters from test names.
- * test/testunit/tests_for_parallel/ptest_first.rb: ditto.
+Fri Aug 16 17:32:02 2013 Koichi Sasada <ko1@atdot.net>
- * test/testunit/tests_for_parallel/ptest_second.rb: ditto.
+ * test/profile_test_all.rb: refactoring memory profiling tool for
+ test-all.
+ Add profiling targets /proc/meminfo and /proc/self/status.
- * test/testunit/tests_for_parallel/ptest_third.rb: ditto.
+ * test/runner.rb: accept other than 'true'.
- * test/testunit/tests_for_parallel/ptest_forth.rb: ditto.
+Fri Aug 16 11:23:35 2013 NAKAMURA Usaku <usa@ruby-lang.org>
- * test/testunit/tests_for_parallel/misc.rb: Removed because no longer
- needed.
+ * file.c (rb_file_size, rb_file_flock): improve performance of Windows.
- * test/testunit/test_parallel.rb: Fix assertions for above.
+ * file.c (rb_file_truncate): removed unnecessary #ifdef.
-Sun Jul 10 16:57:08 2011 Koichi Sasada <ko1@atdot.net>
+ * test/test_file.rb (TestFile#test_truncate_size): added an assertion
+ for File#size.
- * vm_insnhelper.c (vm_throw): check a class frame.
- Fixes Bug #4648.
- The patch is contributed by Kazuki Tsujimoto.
+Fri Aug 16 10:07:59 2013 Tanaka Akira <akr@fsij.org>
- * bootstraptest/test_proc.rb: add tests for above.
+ * 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.
-Sun Jul 10 17:28:01 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+Fri Aug 16 09:17:00 2013 Tanaka Akira <akr@fsij.org>
- * thread_pthread.c (mutex_debug): use exit(EXIT_FAILURE) instad of
- exit(1).
- * thread_pthread.c (add_signal_thread_list): ditto.
- * thread.c (rb_thread_call_with_gvl): ditto.
- * util.c (Bug): ditto.
+ * bignum.c (bary_small_rshift): Specify the higher BDIGIT instead of
+ sign bit.
+ (big_shift3): Follow the above change.
-Sun Jul 10 15:58:12 2011 NARUSE, Yui <naruse@ruby-lang.org>
+Fri Aug 16 02:20:39 2013 Tanaka Akira <akr@fsij.org>
- * ext/json: Merge json gem 1.5.4+ (f7f78896607b6f6226cd).
- [Bug #4700]
+ * bignum.c (bary_mul_toom3): Reduce a branch.
-Sun Jul 10 16:41:32 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+Fri Aug 16 02:14:09 2013 NARUSE, Yui <naruse@ruby-lang.org>
- * vm_core.h (typedef struct rb_vm_struct): create a new
- 'inhibit_thread_creation' field.
- * thread.c (rb_thread_terminate_all): set inhibit_thread_creation.
- * thread.c (thread_s_new): don't permit to create new thread
- if the VM is under destruction. Otherwise evil finalizer code
- can make SEGV. [Bug #4992][ruby-core:37858]
+ * process.c (rb_clock_gettime): add CLOCK_MONOTONIC support on OS X.
+ http://developer.apple.com/library/mac/qa/qa1398/_index.html
+ [Feature #8658]
- * bootstraptest/test_objectspace.rb: new test for this fix.
+Fri Aug 16 01:37:43 2013 Tanaka Akira <akr@fsij.org>
-Sun Jul 10 16:06:16 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * bignum.c (bigdivrem_single): Use shift when y is a power of two.
- * signal.c (sigsegv): use abort() instead of exit() when nested
- SEGV was happen. Because unnested SEGV use abort().
- [Bug #5013][ruby-dev:44078]
+Fri Aug 16 01:09:33 2013 Tanaka Akira <akr@fsij.org>
-Sun Jul 10 15:30:00 2011 Kenta Murata <mrkn@mrkn.jp>
+ * bignum.c (bigdivrem_restoring): Use bigdivrem_single if non-topmost
+ BDIGITs of y are zero.
- * load.c (rb_f_autoload): prevent to autoload for singleton
- classes. fixes [Bug #4886] [ruby-dev:43816]
+Fri Aug 16 00:33:12 2013 Tanaka Akira <akr@fsij.org>
- * bootstraptest/test_autoload.rb: add tests for the above change.
+ * bignum.c (rb_big2str1): Truncate topmost zeros of x.
-Sun Jul 10 15:09:17 2011 Shota Fukumori <sorah@tubusu.net>
+Fri Aug 16 00:00:57 2013 Tanaka Akira <akr@fsij.org>
- * lib/test/unit/assertions.rb: Import documentation patch by Justin
- Collins. [ruby-core:37225] [Feature #4903]
+ * bignum.c (bary_divmod): Simplify an expression.
-Sun Jul 10 14:57:36 2011 Tadayoshi Funaba <tadf@dotrb.org>
+Thu Aug 15 23:26:12 2013 Tanaka Akira <akr@fsij.org>
- * ext/date/date_core.c: canonicalizes nth and sf.
+ * bignum.c (bigdivrem_normal): Remove a local variable.
-Sun Jul 10 14:13:50 2011 Koichi Sasada <ko1@atdot.net>
+Thu Aug 15 23:08:32 2013 Tanaka Akira <akr@fsij.org>
- * internal.h (rb_thread_call_with_gvl, rb_thread_call_without_gvl):
- make them visible as experimental C APIs. fixes Feature #4328.
+ * bignum.c (big2str_karatsuba): Use bigdivrem_restoring directly to
+ reduce working buffer and memory copy.
+ (rb_big2str1): Allocate working buffer for big2str_karatsuba here.
-Sun Jul 10 12:18:00 2011 Kenta Murata <mrkn@mrkn.jp>
+Thu Aug 15 20:51:29 2013 NAKAMURA Usaku <usa@ruby-lang.org>
- * ext/bigdecimal/bigdecimal.c (BigDecimal_power): support non-integral
- exponent. fixes [Bug #3271]
+ * io.c, internal.h (rb_io_flush_raw): new function to select calling
+ fsync() (on Windows).
- * ext/bigdecimal/bigdecimal.c (rmpd_power_by_big_decimal): ditto.
+ * io.c (rb_io_flush_raw): use above function.
- * ext/bigdecimal/bigdecimal.c (BigDecimal_power_op): add a function to
- only use for "**" operator.
+ * file.c (rb_file_truncate): use above function.
- * test/bigdecimal/test_bigdecimal.rb: add a bunch of tests for the
+ * test/ruby/test_file.rb (TestFile#test_truncate_size): test for
above changes.
- * ext/bigdecimal/bigdecimal.c (is_integer): add an utility function.
+Thu Aug 15 18:39:31 2013 NAKAMURA Usaku <usa@ruby-lang.org>
- * ext/bigdecimal/bigdecimal.c (is_negative): ditto.
+ * win32/win32.c (clock_gettime): improve precision when freq is less
+ than and nearly equals 10**9.
- * ext/bigdecimal/bigdecimal.c (is_positive): ditto.
+Thu Aug 15 17:43:15 2013 Koichi Sasada <ko1@atdot.net>
- * ext/bigdecimal/bigdecimal.c (is_zero): ditto.
+ * gc.c (gc_lazy_sweep): remove heap_increment() here because heap_inc
+ may be 0.
- * ext/bigdecimal/bigdecimal.c (is_one): ditto.
+Thu Aug 15 16:59:56 2013 NAKAMURA Usaku <usa@ruby-lang.org>
- * ext/bigdecimal/bigdecimal.c (is_even): ditto.
+ * io.c (rb_io_rewind): remove fsync() for Windows to improve the
+ performance.
-Sun Jul 10 12:08:39 2011 Yusuke Endoh <mame@tsg.ne.jp>
+Thu Aug 15 16:30:23 2013 NAKAMURA Usaku <usa@ruby-lang.org>
- * compile.c (when_vals): when a string literal is written on when
- clause, skip string creation to make it faster. [ruby-dev:44068]
- [Feature #5000]
+ * test/fileutils/test_fileutils.rb (TestFileUtils#test_rmdir):
+ FileUtils.rmdir ignores Errno::ENOTEMPTY, so, in such cases, this
+ assertion is nonsense.
-Sun Jul 10 11:35:29 2011 Yusuke Endoh <mame@tsg.ne.jp>
+Thu Aug 15 15:49:35 2013 Tanaka Akira <akr@fsij.org>
- * parse.y (reduce_nodes_gen): NODE_RETURN in rescue body must not be
- reduced when there is an else clause. This caused bizarre behavior
- in [Bug #4473] [ruby-core:35629] [ruby-core:37884].
+ * process.c (rb_clock_gettime): [DOC] FreeBSD 7.1 supports
+ CLOCK_THREAD_CPUTIME_ID.
+ http://www.freebsd.org/releases/7.1R/relnotes.html
-Sun Jul 10 09:46:14 2011 Masaya Tarui <tarui@ruby-lnag.org>
+Thu Aug 15 14:30:23 2013 NAKAMURA Usaku <usa@ruby-lang.org>
- * range.c (range_max): fix behavior with excluded end value.
- [Bug #4591]
+ * include/ruby/win32.h, win32/Makefile.sub, win32/win32.c
+ (clock_gettime): [experimental] emulates clock_gettime(2) of posix.
-Sun Jul 10 09:13:18 2011 Eric Hodel <drbrain@segment7.net>
+Thu Aug 15 02:32:40 2013 Zachary Scott <e@zzak.io>
- * NEWS: Fix RubyGems version. [Ruby 1.9 - Bug #5004]
+ * hash.c (rb_hash_aset): [DOC] Document key dup patch by @kachick
+ [Fixes GH-382] https://github.com/ruby/ruby/pull/382
-Sat Jul 9 20:01:59 2011 Tadayoshi Funaba <tadf@dotrb.org>
+Wed Aug 14 14:28:39 2013 NAKAMURA Usaku <usa@ruby-lang.org>
- * internal.h: rb_rational_reciprocal is defined in rational.c.
+ * 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]
-Sat Jul 9 19:48:31 2011 Tadayoshi Funaba <tadf@dotrb.org>
+ * NEWS: documents about above change and def-expr (see r42337).
- * internal.h: added declarations.
- * complex.c: followed the above change.
+ * test/ruby/test_module.rb: tests about above change.
-Sat Jul 9 17:24:41 2011 Tadayoshi Funaba <tadf@dotrb.org>
+Wed Aug 14 00:51:14 2013 Tanaka Akira <akr@fsij.org>
- * NEWS: bigdecimal is not a builtin.
+ * bignum.c (bigdivrem_restoring): xn argument removed.
+ (bigdivrem_normal): Follow the above change.
-Sat Jul 9 17:17:53 2011 Tadayoshi Funaba <tadf@dotrb.org>
+Wed Aug 14 00:18:39 2013 Tanaka Akira <akr@fsij.org>
- * ext/date/date_core.c: some improvements for performance.
+ * bignum.c (big_div_struct): Remove xn and j field. Add zn field.
+ (bigdivrem1): Follow the above change.
+ (bigdivrem_restoring): Ditto.
-Sat Jul 9 16:56:01 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Tue Aug 13 23:38:17 2013 Tanaka Akira <akr@fsij.org>
- * atomic.h (ATOMIC_OR): _InterlockedOr is unavailable in VC6.
+ * bignum.c (big_div_struct): ynzero field removed.
+ (bigdivrem1): Follow the above change.
+ (bigdivrem_restoring): Ditto.
- * numeric.c (ULLONG_MAX): fallback definition.
+Tue Aug 13 23:01:16 2013 Tanaka Akira <akr@fsij.org>
-Sat Jul 9 15:59:19 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * bignum.c (bigdivrem_restoring): Extracted from bigdivrem_normal.
- * win32/win32.c (rb_w32_{read,write}): should be signed.
- Bug #5001
+Tue Aug 13 22:12:59 2013 Kenichi Kamiya <kachick1@gmail.com>
-Sat Jul 9 14:02:20 2011 Takeyuki FUJIOKA <xibbar@ruby-lang.org>
+ * random.c (rb_random_ulong_limited): coerce before check negative.
+ [Fixes GH-379]
- * lib/cgi/core.rb: fix multipart form parsing bug. [Bug #3866]
+Tue Aug 13 21:52:15 2013 Kenichi Kamiya <kachick1@gmail.com>
-Sat Jul 9 11:41:03 2011 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
+ * object.c (Init_Object): undef Module#prepend_features on Class, as
+ well as Module#append_features. [Fixes GH-376]
- * lib/matrix.rb: Add Vector#normalize [ruby-dev:43829]
+ * test_class.rb: Added test for above. And ensure type checking
+ on similar methods as module_function.
-Sat Jul 9 09:25:06 2011 Eric Hodel <drbrain@segment7.net>
+Tue Aug 13 08:52:18 2013 Zachary Scott <e@zzak.io>
- * enumerator.c: Remove "enumeration sequenced by".
- [Ruby 1.9 - Bug #4757]
+ * doc/syntax/literals.rdoc: [DOC] String literal concat by @cknadler
+ [Fixes GH-380] https://github.com/ruby/ruby/pull/380
-Sat Jul 9 09:14:56 2011 Eric Hodel <drbrain@segment7.net>
+Mon Aug 12 23:07:21 2013 Masaya Tarui <tarui@ruby-lang.org>
- * io.c: Note that methods other than IO#gets may increase IO#lineno.
- [Ruby 1.9 - Bug #4902]
+ * gc.c (gc_marks_test): inhibit gc for st's operation.
-Sat Jul 9 08:39:39 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Mon Aug 12 15:59:50 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * common.mk (RUN_OPT): disable gems.
+ * parse.y (parser_whole_match_p): treat CR in middle of a line as a
+ mere whitespace.
-Sat Jul 9 08:37:05 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Mon Aug 12 15:16:58 2013 Koichi Sasada <ko1@atdot.net>
- * io.c (rb_io_close): close(2) on a fd which is being read by
- another thread causes deadlock on Mac OS X 10.5
+ * 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.
-Fri Jul 8 21:20:39 2011 NARUSE, Yui <naruse@ruby-lang.org>
+ * test/ruby/test_module.rb: add a test for WB miss.
- * addr2line.c: use USE_ELF instead of __ELF__ because Solaris
- doesn't define it. USE_ELF is already provided by configure.
- patched by Naohisa Goto. [ruby-dev:44066] [Bug #4998]
+Mon Aug 12 13:47:54 2013 Zachary Scott <e@zzak.io>
- * addr2line.h: ditto.
+ * process.c: [DOC] RDoc formatting of Process.clock_gettime
- * vm_dump.c: ditto.
+Mon Aug 12 13:29:09 2013 Zachary Scott <e@zzak.io>
-Fri Jul 8 16:40:38 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * lib/yaml/dbm.rb: [DOC] Document call-seq for YAML::DBM
- * ext/json/parser/parser.rl (convert_encoding): should not modify
- the argument.
+Mon Aug 12 12:57:26 2013 Zachary Scott <e@zzak.io>
- * ext/json/parser/parser.rl (convert_encoding): no needs to use
- force_encoding.
+ * 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.
-Fri Jul 8 15:53:31 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Mon Aug 12 12:53:39 2013 Zachary Scott <e@zzak.io>
- * error.c (rb_bug): get rid of segfault after all threads
- disposed.
+ * ext/dbm/dbm.c: [DOC] Reformat headings of DBM class
-Fri Jul 8 15:01:06 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+Mon Aug 12 12:46:31 2013 Zachary Scott <e@zzak.io>
- * ext/openssl/ossl.h: include openssl/e_os2.h before checking the
- definition of OPENSSL_SYS_WIN32.
+ * 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.
-Fri Jul 8 14:40:39 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+Mon Aug 12 02:51:32 2013 NARUSE, Yui <naruse@ruby-lang.org>
- * win32/win32.c (wunlink): reverted a part of r32426. it was mistakenly
- mixed.
+ * 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.
-Fri Jul 8 14:29:47 2011 Narihiro Nakamura <authornari@gmail.com>
+ * ext/readline/readline.c (readline_s_set_output): ditto.
- * configure.in: can't subtract void *.
+Sun Aug 11 23:27:00 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Fri Jul 8 14:33:26 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+ * file.c (rb_str_encode_ospath): OS path encoding on Mac OS X is also
+ fixed.
- * win32/Makefile.sub (config.h): define GC_MARK_STACKFRAME_WORD.
- fixed build problem of r32438. the value (30) is temporary value.
- maybe it's enough by 20~24 according to my observation.
+Sun Aug 11 22:57:24 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Fri Jul 8 13:47:39 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * 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]
- * thread.c (rb_mutex_unlock_all): folded into
- rb_threadptr_unlock_all_locking_mutexes.
- * thread.c (rb_threadptr_unlock_all_locking_mutexes) ditto.
+Sun Aug 11 19:11:45 2013 Kouhei Sutou <kou@cozmixng.org>
-Fri Jul 8 13:36:02 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * test/rexml/parser/test_sax2.rb: Expand abbreviated class name.
- * thread.c (thread_unlock_all_locking_mutexes): rename to
- rb_threadptr_unlock_all_locking_mutexes and remove static.
- * vm_core.h: add rb_threadptr_unlock_all_locking_mutexes declaration.
- * thread.c (thread_start_func_2): adjust the above rename.
+Sun Aug 11 19:06:03 2013 Kouhei Sutou <kou@cozmixng.org>
- * eval.c (ruby_cleanup): call rb_threadptr_unlock_all_locking_mutexes
- again after finalizer. [Bug #4988] [ruby-dev:44049]
+ * 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.
-Fri Jul 8 13:06:09 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+Sun Aug 11 18:44:04 2013 Kouhei Sutou <kou@cozmixng.org>
- * cont.c (FIBER_MACHINE_STACK_ALLOCATION_SIZE): Fiber stack size
- don't need to keep multiple number of sizeof(VALUE).
+ * lib/rexml/sax2listener.rb (REXML::SAX2Listener#elementdecl): Fix wrong
+ examples. [Bug #8731] [ruby-dev:47582]
+ Reported by Ippei Obayashi.
-Fri Jul 8 11:39:12 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Sun Aug 11 18:42:13 2013 Kouhei Sutou <kou@cozmixng.org>
- * common.mk (sudo-precheck): true command is not standard on
- Windows.
-
-Fri Jul 8 10:39:52 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * thread_pthread.c (gvl_destroy): fix cond_t leak.
-
-Fri Jul 8 09:17:59 2011 Eric Hodel <drbrain@segment7.net>
-
- * gc.c: Improve documentation
-
-Thu Jul 7 23:35:31 2011 Narihiro Nakamura <authornari@gmail.com>
-
- * gc.c: change water_mark value that may call
- gc_mark(lev <= GC_LEVEL_MAX) in gc_mark().
- In ruby_stack_check(), water_mark is a value that may call some
- C function. Fixes Bug #3781
-
- * configure.in: define GC_MARK_STACKFRAME_WORD that approximate
- size of gc_mark() and gc_mark_children() stackframes.
-
-Thu Jul 7 17:55:05 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+ * lib/rexml/parsers/sax2parser.rb
+ (REXML::Parsers::SAX2Parser#handle_entitydecl): Extract.
- * test/testunit/test_parallel.rb (TestParallelWorker#teardown): wait
- the child process even if the communication pipe is broken.
+Sun Aug 11 18:40:25 2013 Kouhei Sutou <kou@cozmixng.org>
-Thu Jul 7 15:44:42 2011 Nobuyoshi Nakada <nobu@ruby-lang.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.
- * encoding.c (rb_enc_set_index, rb_enc_associate_index): should
- check if frozen.
+Sun Aug 11 18:08:40 2013 Kouhei Sutou <kou@cozmixng.org>
- * parse.y (rb_intern3), ruby.c (process_options, ruby_script):
- defer freezing after associating encodings.
+ * 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.
-Thu Jul 7 15:16:51 2011 NARUSE, Yui <naruse@ruby-lang.org>
+Sun Aug 11 18:07:39 2013 Kouhei Sutou <kou@cozmixng.org>
- * numeric.c (rb_num2ull): use own switch sentence.
- Current implementation can't convert 18446744073709551615.
+ * lib/rexml/parsers/baseparser.rb
+ (REXML::Parsers::BaseParser#pull_event): Support optional NDATA
+ in external ID entity declaration.
-Thu Jul 7 06:56:15 2011 NARUSE, Yui <naruse@ruby-lang.org>
+Sun Aug 11 17:54:07 2013 Kouhei Sutou <kou@cozmixng.org>
- * cont.c (FIBER_STACK_FLAGS): workaround fix for r32420 on FreeBSD.
+ * 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.
-Thu Jul 7 06:46:12 2011 Eric Hodel <drbrain@segment7.net>
+Sun Aug 11 17:41:41 2013 Kouhei Sutou <kou@cozmixng.org>
- * benchmark/driver.rb: Add difference column to report that averages
- across all runs of a benchmark. [Ruby 1.9 - Feature #4982]
+ * test/rexml/parser/test_sax2.rb: Add SAX2 API test.
-Thu Jul 7 06:19:38 2011 Eric Hodel <drbrain@segment7.net>
+Sun Aug 11 15:10:40 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * lib/rubygems.rb: Reduce requires to improve `make benchmark`.
- [#4962]
- * lib/rubygems/specification.rb: Delay initialization of rubygems
- until require is called.
+ * parse.y (rb_enc_symname_type): allow ID_ATTRSET for ID_INSTANCE,
+ ID_GLOBAL, ID_CLASS, ID_JUNK too. [Bug #8756]
-Thu Jul 7 04:31:26 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Sun Aug 11 13:17:00 2013 Charlie Somerville <charliesome@ruby-lang.org>
- * parse.y (arg): rescue_mod is in inverse order from other
- modifiers. patched by michael.j.edgar AT dartmouth.edu at
- [ruby-core:36248]. fixed #4716.
+ * include/ruby/encoding.h: Reduce ENCODING_INLINE_MAX to 127 as this
+ should be sufficient to represent all the encodings Ruby supports.
-Thu Jul 7 00:40:16 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+Sun Aug 11 11:54:38 2013 Tanaka Akira <akr@fsij.org>
- * win32/win32.c (kill): check that the process exited or not before
- terminating it. [Bug #4943]
+ * 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]
-Wed Jul 6 23:13:19 2011 Yukihiro Matsumoto <matz@ruby-lang.org>
+Sun Aug 11 10:40:48 2013 Zachary Scott <e@zzak.io>
- * parse.y (opt_call_args): allow trailing comma after assoc
- argument e.g. 'foo(bar:1,)'. fixed #3456
+ * lib/time.rb: [DOC] Correcting rdoc visibility of time.rb constants
+ Reported by Tanaka Akira [ruby-core:56517]
-Wed Jul 6 22:11:12 2011 Shota Fukumori <sorah@tubusu.net>
+Sun Aug 11 04:48:14 2013 NARUSE, Yui <naruse@ruby-lang.org>
- * test/cgi/test_cgi_header.rb(test_cgi_header_nph): Validate date in
- "Date:" header
+ * 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.
-Wed Jul 6 21:29:33 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+Sun Aug 11 03:26:07 2013 Tanaka Akira <akr@fsij.org>
- * cont.c (fiber_machine_stack_alloc): cleanup pointer arithmetic.
- "size/sizeof(VALUE)" is ugly and easy confusing.
- * cont.c (fiber_initialize_machine_stack_context): ditto.
+ * bignum.c (bitsize): Fix a conditional expression.
-Wed Jul 6 21:24:53 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+Sun Aug 11 02:44:03 2013 Zachary Scott <e@zzak.io>
- * cont.c (fiber_machine_stack_alloc): fix mprotect misuse. A stack
- guard page should have PROT_NONE.
- * cont.c (fiber_initialize_machine_stack_context):
- th->machine_stack_maxsize shouldn't be included guard pages size.
- [Bug #4983][ruby-dev:44043]
+ * lib/time.rb: [DOC] Document constants by @markijbema [Fixes GH-377]
+ https://github.com/ruby/ruby/pull/377
-Wed Jul 6 21:23:38 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+Sun Aug 11 01:28:52 2013 Tanaka Akira <akr@fsij.org>
- * cont.c (fiber_machine_stack_alloc): use MAP_STACK if it's provided.
+ * 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
-Wed Jul 6 21:22:16 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+Sat Aug 10 13:53:22 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * cont.c (fiber_machine_stack_alloc): use MAP_FAILED instead of -1.
+ * parse.y (rb_id_attrset): allow other than ID_ATTRSET.
-Wed Jul 6 21:21:05 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * parse.y (intern_str): ditto. try stem ID for ID_INSTANCE,
+ ID_GLOBAL, ID_CLASS, ID_JUNK too. [Bug #8756]
- * cont.c (fiber_machine_stack_alloc): remove unnecessary cast.
+Sat Aug 10 12:49:50 2013 Kouhei Sutou <kou@cozmixng.org>
-Wed Jul 6 18:10:13 2011 Shota Fukumori <sorah@tubusu.net>
+ * lib/rexml/parsers/baseparser.rb
+ (REXML::Parsers::BaseParser::CDATA_END): Use "\A" instead of "^".
+ It is not an used constant but I fix it. (Or should I remove it?)
- * test/cgi/test_cgi_header.rb(test_cgi_header_nph): Adding space after
- comma.
+Sat Aug 10 12:47:19 2013 Kouhei Sutou <kou@cozmixng.org>
- * test/cgi/test_cgi_header.rb(test_cgi_header_nph): Remove variable
- `now`. Suppress warning.
+ * 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.
-Wed Jul 6 12:18:09 2011 Shota Fukumori <sorah@tubusu.net>
+Sat Aug 10 12:43:15 2013 Kouhei Sutou <kou@cozmixng.org>
- * test/cgi/test_cgi_header.rb(test_cgi_header_nph): Fix bug depends to
- time. The test fails if time past 1 second in line 136-145
+ * 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.
-Tue Jul 5 15:28:04 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Sat Aug 10 12:39:00 2013 Kouhei Sutou <kou@cozmixng.org>
- * parse.y (parser_here_document): should dispatch heredoc_end
- scanner event on an empty here document. fixed Bug#4543.
+ * test/rexml/parse/test_document_type_declaration.rb: Add tests for
+ parsing document type declaration.
-Tue Jul 5 13:49:26 2011 Yusuke Endoh <mame@tsg.ne.jp>
+Sat Aug 10 12:00:45 2013 Kouhei Sutou <kou@cozmixng.org>
- * addr2line.c: fix r32407 to check HAVE_ALLOCA_H.
+ * 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!!!
-Tue Jul 5 14:05:43 2011 NARUSE, Yui <naruse@ruby-lang.org>
+Sat Aug 10 11:58:24 2013 Kouhei Sutou <kou@cozmixng.org>
- * lib/webrick/httpauth/digestauth.rb (_authenticate):
- Literal texts in HTTP ABNF is case-insensitive (RFC2616 2.1),
- and a sample implementation in RFC2617 also ignores the case
- of algorithms. So now this ignores those cases.
- [ruby-dev:43965] [Feature #4936]
+ * test/rexml/parse/test_notation_declaration.rb (#test_system_public):
+ Add a test for PUBLIC notation and SYSTEM notation order case.
- * lib/webrick/httpauth/digestauth.rb (initialize):
- Because of above, opera_hack is useless and removed.
+Sat Aug 10 11:31:35 2013 Kouhei Sutou <kou@cozmixng.org>
-Tue Jul 5 01:30:01 2011 Yusuke Endoh <mame@tsg.ne.jp>
+ * 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.
- * thread_pthread.c (native_sleep): cut the waiting time up to
- 100,000,000 because Solaris cond_timedwait() return EINVAL if an
- argument is greater than current_time + 100,000,000. This is
- considered as a kind of spurious wakeup. The caller to native_sleep
- should care about spurious wakeup.
+Sat Aug 10 09:20:21 2013 Zachary Scott <e@zzak.io>
-Tue Jul 5 01:24:26 2011 Yusuke Endoh <mame@tsg.ne.jp>
+ * NEWS: [DOC] typo in example reported by @moretea
+ https://github.com/ruby/ruby/commit/a39e724#commitcomment-3831489
- * cont.c: disable FIBER_USE_NATIVE on Solaris because resuming any
- Fiber caused SEGV. I haven't follow up the issue deeply, but it
- works when disabling the feature.
+Sat Aug 10 09:19:04 2013 Zachary Scott <e@zzak.io>
-Tue Jul 5 01:22:46 2011 Yusuke Endoh <mame@tsg.ne.jp>
+ * proc.c: [DOC] rdoc code formatting
- * addr2line.c: include <alloca.h> to fix a build issue on Solaris.
+Sat Aug 10 09:12:01 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Tue Jul 5 00:49:05 2011 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
+ * parse.y (rb_id_attrset): check if the argument is valid type as an
+ attribute.
- * ext/coverage/coverage.c: resurrect r32071 + add GC guard for
- rb_coverages. [ruby-core:37352] [Bug #4927]
- [ruby-core:36539] [Feature #4796]
+Sat Aug 10 05:44:08 2013 Zachary Scott <e@zzak.io>
- * test/coverage/test_coverage.rb resurrect r32071.
+ * lib/rss/trackback.rb: [DOC] Hide RSS::Trackback from rdoc
+ Patch by Steve Klabnik [Bug #8755] [ruby-core:56456]
-Mon Jul 4 22:24:46 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+Sat Aug 10 04:52:21 2013 Tanaka Akira <akr@fsij.org>
- * thread_pthread.c (get_stack): For NetBSD/FreeBSD, use
- pthread_attr_getstack() if possible. and, remove an assumption
- of stack growing direction.
+ * bignum.c (big_div_struct): Use size_t.
+ (bigdivrem1): Ditto.
+ (bigdivrem_num_extra_words): Ditto.
+ (bigdivrem_single): Ditto.
+ (bigdivrem_normal): Ditto.
+ (bary_divmod): Ditto.
-Mon Jul 4 20:42:31 2011 Yusuke Endoh <mame@tsg.ne.jp>
+Fri Aug 9 23:47:15 2013 Kouhei Sutou <kou@cozmixng.org>
- * ext/coverage/coverage.c: revert r32071. The commit caused SEGV on
- some minor nonfree OS. I have no means of debugging the bug. My
- personal opinion is that such OS should be unsupported unless there
- is an active maintainer. [ruby-core:37352]
+ * 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!!!
- * test/coverage/test_coverage.rb: ditto.
+Fri Aug 9 22:51:10 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Mon Jul 4 07:14:12 2011 NARUSE, Yui <naruse@ruby-lang.org>
+ * configure.in (XLDFLAGS, LIBRUBYARG_STATIC): CoreFoundation framework
+ option is now needed always, regardless enable-shared.
+ [ruby-core:56467] [Bug #8759]
- * thread_pthread.c (get_stack): the return address of get_stack
- must be the highest address of the current thread's stack.
+Fri Aug 9 22:20:51 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Mon Jul 4 06:37:22 2011 Koichi Sasada <ko1@atdot.net>
+ * ruby.c (load_file_internal): use rb_parser_compile_string_path and
+ rb_parser_compile_file_path, String path name versions. [Bug #8753]
- * include/ruby/intern.h, thread_pthread.c (rb_reserved_fd_p,
- RB_RESERVED_FD_P): added. This C API is to limit to access
- fds which are used by RubyVM internal. In this version of
- CRuby, return 1 if fd is communication pipe.
- If your application needs to close all file descriptors to
- present resource leak, skip internal fds using this C API.
- We also define a macro RB_RESERVED_FD_P(fd). So you can write
- #ifndef RB_RESERVED_FD_P
- #define RB_RESERVED_FD_P(fd) 0
- #endif
- for Ruby 1.9.2 or previous version to write compatible extensions.
- See [ruby-core:37727]
+Fri Aug 9 07:16:00 2013 Charlie Somerville <charliesome@ruby-lang.org>
- * thread_win32.c (rb_reserved_fd_p): added (return 0 for any fds).
+ * 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.
- * io.c (rb_io_initialize): raise ArgumentError if given fd is reserved by Ruby.
+Fri Aug 9 19:13:54 2013 Koichi Sasada <ko1@atdot.net>
-Sun Jul 3 23:43:56 2011 Yuki Sonoda (Yugui) <yugui@yugui.jp>
+ * NEWS: update about new methods for Binding.
- * ext/extmk.rb (extmake): suppresses outputs from extconf.rb.
- (extmake) warns a failure in extconf.rb.
+Fri Aug 9 18:48:09 2013 Koichi Sasada <ko1@atdot.net>
-Sun Jul 3 13:44:51 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * proc.c: add Binding#local_variable_get/set/defined?
+ to access local variables which a binding contains.
+ Most part of implementation by nobu.
- * array.c (ary_reject_bang): should not remove elements which are
- not yielded. [Bug #2545]
+ * test/ruby/test_proc.rb: add a tests for above.
-Sun Jul 3 06:10:26 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * 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.
- * thread_pthread.c (get_stack): pthread_attr_getstack() doesn't
- return stack start address, but stack base address. Thus,
- we need to add stack size for getting stack start address.
- And, we don't have to decrease guard size twice.
- * thread_pthread.c (thread_start_func_1): don't use inaccurate
- stack start guess if native_thread_init_stack() can be used.
- [Bug #1813] [ruby-core:24540]
+Fri Aug 9 14:02:01 2013 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-Sun Jul 3 04:50:08 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * tool/make-snapshot: Fix order of priority for option parameter.
- * thread_pthread.c (get_stack): add to a care of guard page on Mac
- OS X. [Bug #1813] [ruby-core:24540]
- * signal.c (ruby_signal): SIGBUS use alternative stack too.
- * signal.c (sigbus): On Mac, thread stack overflow makes SIGBUS
- instead of SIGSEGV. thus, added stackoverflow check.
- * signal.c (default_handler): get rid of compilation warning.
- * signal.c (Init_signal): ditto.
+Fri Aug 9 12:06:49 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Sat Jul 02 08:59:20 2011 Martin Bosslet <Martin.Bosslet@googlemail.com>
+ * file.c (rb_str_normalize_ospath): normalize to Normalization Form C
+ using CFString.
- * test/openssl/test_ocsp.rb
- * test/openssl/test_x509_cert.rb: Perform SHA-256 tests only if
- supported by the available OpenSSL version. Versions < 0.9.8 don't
- support it. [ruby-core:37724]
+Fri Aug 9 10:53:57 2013 Kazuki Tsujimoto <kazuki@callcc.net>
-Sat Jul 2 07:17:45 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * time.c (get_timeval, get_new_timeval): use rb_obj_class()
+ instead of CLASS_OF() because CLASS_OF() may return
+ a singleton class.
- * array.c (rb_ary_reject_bang, rb_ary_delete_if): rejected
- elements should be removed. fixed [Bug #2545]
+Fri Aug 9 10:42:11 2013 Kazuki Tsujimoto <kazuki@callcc.net>
-Sat Jul 2 01:57:00 2011 Kenta Murata <mrkn@mrkn.jp>
+ * vm_insnhelper.c (vm_invoke_block): returning from lambda proc
+ now always exits from the Proc. [ruby-core:56193] [Feature #8693]
- * NEWS: remove a description of Kernel#respond_to? because it has
- been reverted at revision 28564.
+ * NEWS, test/ruby/test_lambda.rb: ditto. Patch by nobu.
-Sat Jul 2 00:58:00 2011 Kenta Murata <mrkn@mrkn.jp>
+Fri Aug 9 00:10:32 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * NEWS: describe a change of multiplication of Bignum.
+ * enumerator.c (lazy_zip_func): fix non-single argument. fix
+ out-of-bound access and pack multiple yielded values.
+ [ruby-core:56383] [Bug #8735]
-Fri Jul 1 18:52:31 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+Thu Aug 8 23:01:20 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * benchmark/bm_app_erb.rb: increase loop count. too short
- measurement time makes less accuracy.
- * benchmark/bm_app_factorial.rb: ditto.
- * benchmark/bm_app_mandelbrot.rb: ditto.
- * benchmark/bm_app_strconcat.rb: ditto.
+ * 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]
- * benchmark/bm_io_file_create.rb: ditto.
- * benchmark/bm_io_file_read.rb: ditto.
- * benchmark/bm_io_file_write.rb: ditto.
+Thu Aug 8 21:56:44 2013 Tanaka Akira <akr@fsij.org>
- * benchmark/bm_so_concatenate.rb: ditto.
- * benchmark/bm_so_lists.rb: ditto.
- * benchmark/bm_so_matrix.rb: ditto.
- * benchmark/bm_so_random.rb: ditto.
- * benchmark/bm_so_sieve.rb: ditto.
+ * time.c (time_overflow_p): Avoid signed integer overflow.
+ (rb_time_new): Fix overflow condition.
- * benchmark/bm_vm_thread_mutex1.rb: ditto.
- * benchmark/bm_vm_thread_mutex2.rb: ditto.
- * benchmark/bm_vm_thread_mutex3.rb: ditto.
+Thu Aug 8 19:58:02 2013 Koichi Sasada <ko1@atdot.net>
- * benchmark/bm_vm1_block.rb: cleanup.
- * benchmark/bm_vm1_const.rb: cleanup.
- * benchmark/bm_vm1_ensure.rb: cleanup.
- * benchmark/bm_vm1_ivar.rb: cleanup.
- * benchmark/bm_vm1_length.rb: cleanup.
- * benchmark/bm_vm1_neq.rb: cleanup.
- * benchmark/bm_vm1_not.rb: cleanup.
- * benchmark/bm_vm1_rescue.rb: cleanup.
- * benchmark/bm_vm1_simplereturn.rb: cleanup.
- * benchmark/bm_vm1_swap.rb: cleanup.
+ * thread.c (rb_threadptr_pending_interrupt_check_mask):
+ use RARRAY_RAWPTR() instead of RARRAY_PTR() because
+ there is no new reference.
- * benchmark/bm_vm2_array.rb: cleanup.
- * benchmark/bm_vm2_case.rb: cleanup.
- * benchmark/bm_vm2_defined_method.rb: cleanup.
- * benchmark/bm_vm2_eval.rb: cleanup.
- * benchmark/bm_vm2_method.rb: cleanup.
- * benchmark/bm_vm2_mutex.rb: cleanup.
- * benchmark/bm_vm2_poly_method.rb: cleanup.
- * benchmark/bm_vm2_poly_method_ov.rb: cleanup.
- * benchmark/bm_vm2_proc.rb: cleanup.
- * benchmark/bm_vm2_regexp.rb: cleanup.
- * benchmark/bm_vm2_send.rb: cleanup.
- * benchmark/bm_vm2_super.rb: cleanup.
- * benchmark/bm_vm2_unif1.rb: cleanup.
- * benchmark/bm_vm2_zsuper.rb: cleanup.
+Thu Aug 8 19:56:52 2013 Koichi Sasada <ko1@atdot.net>
- * benchmark/bm_vm_thread_alive_check1.rb: cleanup.
+ * string.c (rb_str_format_m): use RARRAY_RAWPTR() instead of
+ RARRAY_PTR() because there is no new reference.
-Fri Jul 1 15:23:00 2011 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
+Thu Aug 8 19:55:51 2013 Koichi Sasada <ko1@atdot.net>
- * lib/matrix: Add LUP decomposition
+ * include/ruby/ruby.h: define USE_RGENGC_LOGGING_WB_UNPROTECT.
-Fri Jul 1 15:21:14 2011 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
+Thu Aug 8 16:44:25 2013 Koichi Sasada <ko1@atdot.net>
- * lib/matrix.rb: Allow non integer exponents for Matrix#**
+ * 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.
-Fri Jul 1 15:13:25 2011 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
+Thu Aug 8 15:37:53 2013 NAKAMURA Usaku <usa@ruby-lang.org>
- * lib/matrix: Add Eigenvalue Decomposition
+ * 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.
-Fri Jul 1 15:10:22 2011 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
-
- * lib/matrix: Add Matrix#round
-
-Fri Jul 1 11:41:12 2011 NARUSE, Yui <naruse@ruby-lang.org>
-
- * string.c (tr_trans): free heap ptr when the str is not embedded.
- patched by Eric Wong. [Bug #4956] [ruby-core:37708]
-
-Fri Jul 1 11:07:43 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * thread.c (do_select): fix memory leak.
- Patch by Eric Wong. Thank you! [Bug #4953] [ruby-core:37702]
-
-Fri Jul 1 08:21:28 2011 Koichi Sasada <ko1@atdot.net>
-
- * vm_insnhelper.c (vm_getivar): check vm state version
- to invalidate inline cache (ivar index).
- fixes Bug #4926.
-
- * vm_insnhelper.c (vm_setivar): ditto.
+Thu Aug 8 14:54:18 2013 Shugo Maeda <shugo@ruby-lang.org>
-Fri Jul 1 08:03:15 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * NEWS: add description of incompatibility introduced by r42396.
+ [ruby-core:56329] [Bug #8722]
- * error.c, thread_pthread.c (WRITE_CONST): suppress warnings
- `ignoring return value'.
+Thu Aug 8 14:50:36 2013 NARUSE, Yui <naruse@ruby-lang.org>
-Fri Jul 1 06:41:36 2011 Koichi Sasada <ko1@atdot.net>
+ * common.mk (mini): portable target to build miniruby
- * thread.c (rb_threadptr_check_signal): only wake up main thread.
+ * common.mk (bisect): run git-bisect with miniruby
- * thread.c (rb_threadptr_execute_interrupts_common): check signal
- delivery if it is main thread.
- fixes [ruby-dev:44005] [Ruby 1.9 - Bug #4950]
+ * common.mk (bisect-ruby): run git-bisect with ruby
- * bootstraptest/test_fork.rb: add a test for above.
+ * tool/bisect.sh: script for git-bisect
- * signal.c (rb_get_next_signal): skip if signal_buff is empty.
- (check signal_buff.size first)
+Thu Aug 8 12:11:43 2013 NAKAMURA Usaku <usa@ruby-lang.org>
- * vm_core.h: remove unused variable rb_thread_t::exec_signal.
+ * 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.
- * thread.c (rb_thread_check_trap_pending): check
- rb_signal_buff_size() because rb_thread_t::exec_signal
- is no longer available.
+Thu Aug 8 10:27:18 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Fri Jul 1 03:28:25 2011 Yukihiro Matsumoto <matz@ruby-lang.org>
+ * range.c (range_last): revert r42400. [Bug #8739]
- * class.c (Init_class_hierarchy): should name BasicObject
- explicitly.
+Thu Aug 8 10:26:25 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * variable.c (rb_const_defined_0): should not check for
- superclasses as const_get.
+ * file.c (rb_str_normalize_ospath): extract and move from dir.c.
-Fri Jul 1 03:24:03 2011 Tadayoshi Funaba <tadf@dotrb.org>
+Thu Aug 8 05:59:00 2013 Charlie Somerville <charliesome@ruby-lang.org>
- * ext/date/date_core.c: mathn is still alive (should die soon).
+ * test/openssl/test_ssl.rb: Fix test for CVE-2013-4073.
+ Patch by Antonio Terceiro. [Bug #8750] [ruby-core:56437]
-Thu Jun 30 23:50:00 2011 Kenta Murata <mrkn@mrkn.jp>
+Thu Aug 8 03:37:38 2013 Eric Hodel <drbrain@segment7.net>
- * misc/ruby-mode.el (ruby-indent-beg-re): Fix broken regular
- expression. Fixes #4546
+ * 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.
-Thu Jun 30 23:43:30 2011 Martin Bosslet <Martin.Bosslet@googlemail.com>
+Wed Aug 7 23:06:26 2013 Akinori MUSHA <knu@iDaemons.org>
- * ext/openssl/ossl.c/.h: Added ossl_x509_name_sk2ary.
- * ext/openssl/ossl.c: Replaced ossl_x509_ary2k by generic macro to
- simplify future conversions.
- * ext/openssl/ossl_ssl.c: Implement SSLSocket#client_ca.
- * test/openssl/test_ssl.rb: Add test for SSLSocket#client_ca.
- Thanks to Ippei Obayashi for providing the patch!
- [ Ruby 1.9 - Feature #4481 ] [ruby-core:35461]
+ * ruby.c (Process.argv0): New method to return the original value
+ of $0. [Feature #8696]
-Thu Jun 30 22:38:58 2011 Koichi Sasada <ko1@atdot.net>
+Wed Aug 7 23:05:55 2013 Akinori MUSHA <knu@iDaemons.org>
- * benchmark/bm_vm2_defined_method.rb: added to measure performance of
- bmethod (method defined by define_method()).
+ * ruby.c (Process.setproctitle): New method to change the title of
+ the running process that is shown in ps(1). [Feature #8696]
-Thu Jun 30 22:17:04 2011 Koichi Sasada <ko1@atdot.net>
+Wed Aug 7 20:05:38 2013 Tanaka Akira <akr@fsij.org>
- * vm_insnhelper.c (vm_call_bmethod): fix to hook call/return event
- for methods defined by define_method(). fixes Bug #4613.
+ * bignum.c (rb_big_odd_p): Check the bignum length.
+ (rb_big_even_p): Ditto.
- * thread.c (call_trace_proc): Fix to skip if class is not given (0).
- Note that ID and Class object are passed for call/return event
- if the called method was defined by define_method().
- If you are author of tracer/profiler/debugger, this may be an
- important change. You should check passed class as zero or
- non-zero instead of checking the event type.
+Wed Aug 7 19:29:26 2013 Tanaka Akira <akr@fsij.org>
- * test/ruby/test_settracefunc.rb: add a test for above.
+ * bignum.c (dbl2big): A condition simplified.
-Thu Jun 30 21:18:35 2011 Yutaka Kanemoto <kanemoto@ruby-lang.org>
+Wed Aug 7 16:34:30 2013 NAKAMURA Usaku <usa@ruby-lang.org>
- * configure.in: Add warnflags for XL/C on AIX during configure
- to avoid [Bug #3971]. See [ruby-core:32859]
+ * test/webrick/test_cgi.rb (TestWEBrickCGI#{start_cgi_server,test_cgi}):
+ mswin is not only mswin32 but also mswin64. [Bug #8746]
-Thu Jun 30 21:16:04 2011 Tadayoshi Funaba <tadf@dotrb.org>
+Wed Aug 7 16:19:12 2013 Koichi Sasada <ko1@atdot.net>
- * ext/date/date_core.c (m_ajd): refers a constant.
+ * cont.c (rb_fiber_start): use RARRAY_RAWPTR() instead of
+ RARRAY_PTR() because there is no new reference.
-Thu Jun 30 20:54:25 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * proc.c (curry): ditto.
- * ext/io/console/io-console.gemspec: spin-off gem for 1.9.2.
+ * proc.c (rb_proc_call): remove line break.
-Thu Jun 30 20:36:23 2011 Tadayoshi Funaba <tadf@dotrb.org>
+Wed Aug 7 13:20:12 2013 Koichi Sasada <ko1@atdot.net>
- * ext/date/date_core.c: trivial changes.
+ * random.c (random_load): use RARRAY_RAWPTR() instead of
+ RARRAY_PTR() because there is no new reference.
-Thu Jun 30 20:12:36 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Wed Aug 7 12:58:23 2013 Koichi Sasada <ko1@atdot.net>
- * test/ruby/test_module.rb: tests for [Bug #3422] and [Bug #3423].
+ * thread.c (thread_start_func_2): use RARRAY_RAWPTR() instead of
+ RARRAY_PTR() because there is no new reference.
-Thu Jun 30 20:03:39 2011 Tadayoshi Funaba <tadf@dotrb.org>
+Wed Aug 7 09:00:24 2013 Zachary Scott <e@zzak.io>
- * ext/date/date_core.c: modified doc.
+ * string.c: [DOC] Description of rb_str_equal [Fixes GH-375]
+ Based on a patch by @markijbema
+ https://github.com/ruby/ruby/pull/375
-Thu Jun 30 19:09:19 2011 Koichi Sasada <ko1@atdot.net>
+Wed Aug 7 08:30:38 2013 Zachary Scott <e@zzak.io>
- * thread_pthread.c (thread_timer): ignore unknown errno.
- (we observed that select(2) was canceled by errno=514 on
- boron == Linux/Xen environment)
+ * 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
-Thu Jun 30 17:33:25 2011 Koichi Sasada <ko1@atdot.net>
+Wed Aug 7 07:46:23 2013 Zachary Scott <e@zzak.io>
- * ext/objspace/objspace.c (ObjectSpace.count_tdata_objects):
- Fix rdoc. Fixes Bug #3892.
+ * lib/rss/utils.rb: [DOC] RSS::Utils by Steve Klabnik [Bug #8745]
- * ext/objspace/objspace.c (ObjectSpace.count_tdata_objects):
- Change key type if the klass of a object is zero (internal object).
- Read rdoc for details.
+Wed Aug 7 07:38:39 2013 Tanaka Akira <akr@fsij.org>
- * internal.h: export rb_objspace_data_type_name().
+ * 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.
-Thu Jun 30 17:25:08 2011 Koichi Sasada <ko1@atdot.net>
+Tue Aug 6 22:38:15 2013 Zachary Scott <e@zzak.io>
- * thread_pthread.c (ping_signal_thread_list, thread_timer):
- fix to keep polling state if there are any ping-tasks.
+ * time.c: [DOC] Typo in Time overview by @sparr [Fixes GH-374]
+ https://github.com/ruby/ruby/pull/374
-Thu Jun 30 12:25:34 2011 Koichi Sasada <ko1@atdot.net>
+Tue Aug 6 22:35:32 2013 Zachary Scott <e@zzak.io>
- * thread_pthread.c (rb_thread_create_timer_thread): allocate
- machine stack for the timer thread at least 12KB. FreeBSD 8.2
- AMD64 causes machine stack overflow (SIGSEGV) only with
- PTHREAD_STACK_MIN (maybe defined as 2KB).
+ * lib/rss/1.0.rb: [DOC] Document RSS10 by Steve Klabnik [Bug #8740]
-Thu Jun 30 09:36:37 2011 Eric Hodel <drbrain@segment7.net>
+Tue Aug 6 22:14:11 2013 Kouji Takao <kouji.takao@gmail.com>
- * lib/weakref.rb: Attach documentation to WeakRef and add missing
- documentation
+ * ext/readline/readline.c (readline_s_delete_text): remove
+ checking "$SAFE == 4".
-Thu Jun 30 09:30:14 2011 Eric Hodel <drbrain@segment7.net>
+ * ext/readline/readline.c: fix rdoc, remove "Raises SecurityError"
+ and add "Raises NotImplementedError".
- * lib/yaml.rb: Document toplevel YAML and YAML::ENGINE to describe
- Psych vs Syck engines.
+Tue Aug 6 22:04:38 2013 Kouji Takao <kouji.takao@gmail.com>
-Thu Jun 30 09:21:52 2011 Eric Hodel <drbrain@segment7.net>
+ * ext/readline/readline.c, test/readline/test_readline.rb: fix
+ indent.
- * lib/cmath.rb: Hide handle_no_method_error from RDoc.
- * error.c: Document or hide undocumented error classes.
+Tue Aug 6 21:59:56 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Thu Jun 30 07:49:04 2011 Eric Hodel <drbrain@segment7.net>
+ * range.c (range_last): return nil for empty range, or in the case the
+ predecessor is smaller than the begin. [Bug #8739]
- * hash.c: Document ENV
+Tue Aug 6 21:48:31 2013 Kouji Takao <kouji.takao@gmail.com>
-Thu Jun 30 06:37:43 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * ext/readline/readline.c (readline_s_set_point, Init_readline):
+ add Readline.point=(pos). Patched by naruse. [ruby-dev:47535]
+ [Feature #8675]
- * ruby.c (ruby_init_loadpath_safe): ensure RUBYLIB_PREFIX stored
- before RUBYLIB, even if MANGLED_PATH is enabled. fixed #1679.
- MANGLED_PATH is disabled by the default and will be removed
- completely in the future.
+Tue Aug 6 21:14:11 2013 Kouji Takao <kouji.takao@gmail.com>
-Thu Jun 30 06:32:21 2011 Eric Hodel <drbrain@segment7.net>
+ * 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]
- * lib/drb/drb.rb: Hide deprecated toplevel DRb constants.
+Tue Aug 6 17:56:40 2013 Koichi Sasada <ko1@atdot.net>
-Thu Jun 30 06:17:02 2011 NARUSE, Yui <naruse@ruby-lang.org>
+ * vm_insnhelper.c (vm_push_frame): change type of stack_max to size_t.
- * lib/cmath.rb (CMath.log): second argument: b can be nil.
+Tue Aug 6 17:42:47 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Thu Jun 30 06:23:28 2011 Eric Hodel <drbrain@segment7.net>
+ * range.c (range_last): exclude the last number of the exclusive range
+ if the end is Numeric. [ruby-dev:47587] [Bug #8739]
- * thread.c (ruby_thread_s_pass): Fix typo.
+Tue Aug 6 17:42:21 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Thu Jun 30 06:16:53 2011 Eric Hodel <drbrain@segment7.net>
-
- * lib/rdoc: Update to RDoc 3.8 which contains fixes for documentation
- in trunk.
-
-Thu Jun 30 02:53:26 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * thread.c (rb_threadptr_execute_interrupts_common): remove
- meaningless native_thread_yield(). It never close a race.
-
-Thu Jun 30 02:41:47 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * thread.c (rb_thread_schedule_limits): minor optimization.
- eliminate machine context saving when running time is enough small.
-
-Thu Jun 30 02:28:11 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * thread.c (rb_thread_schedule_rec): move interrupt_flag check to
- rb_thread_schedule().
- And also rename to rb_thread_schedule_limits() and remove
- sched_depth argument. It's no longer called recursive.
- * thread.c (rb_thread_schedule): add to check interrupt_flag as
- above explained.
-
- * thread.c (rb_threadptr_execute_interrupts_rec): rename to
- rb_threadptr_execute_interrupts_common() and remove sched_depth
- argument. It's no longer called recursive.
-
- * thread.c (rb_thread_sleep): adapt the renaming.
- * thread.c (rb_threadptr_execute_interrupts): ditto.
- * thread.c (rb_thread_execute_interrupts): ditto.
-
-Thu Jun 30 01:31:33 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * thread.c (thread_s_pass): change RDoc description and remove
- a sample code. The actual implementation never behave as explained by
- an example. It's a documentation bug.
-
-Thu Jun 30 00:54:33 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * thread.c (rb_thread_stop): change RDoc sample code. The old
- example is buggy and may cause deadlock. The patch is
- suggested by Heesob Park <phasis@gmail.com>. Thank you!
- [Bug #3606][ruby-core:31454]
-
-Thu Jun 30 00:49:53 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * thread.c (rb_thread_wakeup): change RDoc sample code. The old
- example is buggy and may not display anything by a race.
- The patch is suggested by Heesob Park <phasis@gmail.com>.
- Thank you! [Bug #3606][ruby-core:31454]
-
-Thu Jun 30 00:43:33 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * thread.c (rb_thread_run): change RDoc. The old example is buggy
- and may cause deadlock. The patch is suggested by Heesob Park
- <phasis@gmail.com>. Thank you! [Bug #3606][ruby-core:31454]
-
-Thu Jun 30 00:30:15 2011 Keiju Ishitsuka <keiju@ishitsuka.com>
-
- * lib/cmath.rb: make same exception for Math. fix [Bug #3137].
-
-Thu Jun 30 00:03:20 2011 Keiju Ishitsuka <keiju@ishitsuka.com>
-
- * lib/irb/completion.rb: complement correctly string literal. fix
- [Bug #1145].
-
-Wed Jun 29 23:42:51 2011 Tadayoshi Funaba <tadf@dotrb.org>
-
- * ext/date/date_core.c: avoided using timev.
- * ext/date/date_strftime.c: ditto.
- * ext/date/date_tmx.h: ditto.
-
-Wed Jun 29 23:17:57 2011 WATANABE Hirofumi <eban@ruby-lang.org>
-
- * ext/openssl/ossl.h (OPENSSL_SYS_WIN32): support for mingw(msys).
-
-Wed Jun 29 23:09:14 2011 WATANABE Hirofumi <eban@ruby-lang.org>
-
- * ext/tk/extconf.rb (intptr_t, uintptr_t): support for the latest ActiveTcl with mingw.
-
-Wed Jun 29 22:49:10 2011 Keiju Ishitsuka <keiju@ishitsuka.com>
-
- * lib/irb/cmd/help.rb: support RDoc 3.7. fix [Bug #3760].
-
-Wed Jun 29 22:04:14 2011 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
-
- * lib/tracer.rb: Tracer.on only if required by -r command-line option.
- and consider --disable-gems option.
- * test/test_tracer.rb: add tests for it.
-
-Wed Jun 29 13:55:36 2011 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * variable.c (rb_const_get_0): should not look for superclasses if
- the second optional argument is given for #const_get().
- fix [Bug #3422] [Bug #3423]
-
-Wed Jun 29 12:07:27 2011 Eric Hodel <drbrain@segment7.net>
-
- * math.c: Attach documentation for Math.
- * object.c: Document NIL, TRUE, FALSE.
- * io.c: Improve grammar in ARGF comment. Document STDIN/OUT/ERR.
- Document ARGF global constant.
- * lib/rake: Hide deprecated toplevel constants from RDoc (import from
- rake trunk).
- * lib/thwait.rb: Document ThWait.
- * lib/mathn.rb: Hide Math redefinition from RDoc
- * lib/sync.rb: Add a basic comment for Sync_m, Synchronizer_m, Sync,
- Synchronizer.
- * parse.y: Document SCRIPT_LINES__.
- * hash.c: Document ENV class and global constant.
- * vm.c: Document TOPLEVEL_BINDING.
- * version.c: Document RUBY_* constants.
- * ruby.c: Document DATA and ARGV.
-
-Wed Jun 29 10:13:12 2011 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
-
- * lib/matrix.rb: Matrix.zero can build rectangular matrices.
- Vector#r should be called #magnitude
-
-Wed Jun 29 10:11:08 2011 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
-
- * lib/matrix.rb: Add Matrix#diagonal?, hermitian?, normal?,
- orthogonal?
- permutation?, symmetric?, {lower|upper}triangular?, unitary?, zero?
-
-Wed Jun 29 10:09:35 2011 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
-
- * lib/matrix.rb: Specialize Matrix#find_index to return [row, col]
- and accept the same optional argument as #each
-
-Wed Jun 29 10:07:32 2011 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
-
- * lib/matrix.rb: Matrix#each{_with_index} can iterate over a subset
- of the Matrix
-
-Wed Jun 29 06:21:02 2011 Koichi Sasada <ko1@atdot.net>
-
- * thread_pthread.c (native_stop_timer_thread): skip to close
- communication pipe to avoid timing bug (process termination timing).
- The communication pipe will closed by OS.
-
-Wed Jun 29 06:09:54 2011 Koichi Sasada <ko1@atdot.net>
-
- * error.c (rb_async_bug_errno): async-safe bug report function.
- In timer thread, signal handler should use it.
- The patch is contributed by Eric Wong <normalperson@yhbt.net>.
- Refs: [ruby-core:37644] and [ruby-core:37647]
-
- * thread_pthread.c: use rb_async_bug_errno().
- And replace all fprintf() to write().
-
- * internal.h (rb_async_bug_errno): add decl. of above func.
-
-Tue Jun 28 23:46:08 2011 Keiju Ishitsuka <keiju@ishitsuka.com>
-
- * lib/tracer.rb: count only non-internal libraries in stack trace,
- ignoring custom_require.
-
-Tue Jun 28 21:44:58 2011 Keiju Ishitsuka <keiju@ishitsuka.com>
-
- * lib/irb/ruby-lex.rb: recognize '\char' in ruby statement.
-
-Tue Jun 28 20:39:29 2011 Hiroshi Nakamura <nahi@ruby-lang.org>
-
- * lib/debug.rb (var_list): Command 'var *' did not work on 1.9(!).
- global_variables, local_variables, and instance_variables returns
- Symbols from 1.9 and need to stringify before evaling it.
- See #4931.
-
-Tue Jun 28 19:23:01 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * signal.c: Now, USE_TRAP_SIGMASK depend on HAVE_PTHREAD_SIGMASK.
- The code have already depended on pthread_sigmask since r27464.
-
-Tue Jun 28 15:09:21 2011 NARUSE, Yui <naruse@ruby-lang.org>
-
- * lib/benchmark.rb: merge eregon/benchmark.
- https://github.com/eregon/ruby/tree/benchmark
- patched by Benoit Daloze. [ruby-core:37593] [Bug #4940]
-
- * lib/benchmark (Benchmark#bmbm): bmbm should be consistent with bm
- for the return value.
-
- * test/benchmark: remove preemptive test instead of skipping
- I removed the preemptive test I wrote for Feature #4197.
- I'll add it back when the implementation will be able to satisfy it.
-
- * lib/benchmark (Benchmark#bmbm): remove useless explicit call,
- #format is an alias of #to_s test/benchmark: add a test for
- format of long time.
-
- * lib/benchmark: fix label width: always add 1 to ensure there is a
- space delimiter even with times over 100s
- When I asked for Feature #4197, I wanted to make delimiting spaces
- consistent for #bm and #bmbm.
- But with times over 100s, the output contains no space between the
- label and the first time (user).
- Now both ensure there is always a space, even if that means 3 spaces
- with times under 10s (because it is formatted as %10.6f)
-
- * test/benchmark: let labels be a constant
- lib/benchmark (Benchmark#realtime): avoid creating an unused Proc
- lib/benchmark (Benchmark#benchmark): use ensure clause to restore
- STDOUT.sync, as in #bmbm
-
-Tue Jun 28 13:41:51 2011 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * thread_win32.c (native_stop_timer_thread): fixed commit miss of
- r32244. grep sources before changing the signature of a function.
-
-Tue Jun 28 11:49:14 2011 Koichi Sasada <ko1@atdot.net>
-
- * thread_pthread.c (consume_communication_pipe):
- Make "buff" as static. (Maybe) "buff" can be shared between
- any caller (any threads) because no one use the read values.
- "buff" (1024 byte) on stack may cause stack overflow on
- several environment (we found a crash on FreeBSD).
- And remove const value "buff_size", and define CCP_READ_BUFF_SIZE
- macro.
-
-Tue Jun 28 11:45:30 2011 Eric Hodel <drbrain@segment7.net>
-
- * lib/rake: Update rake to fix some bugs and hide deprecated features
- from RDoc.
- * lib/rake/version.rb: Bump version to 0.9.2.1 to distinguish it from
- the released version.
- * NEWS: ditto
-
-Tue Jun 28 11:17:28 2011 Eric Hodel <drbrain@segment7.net>
-
- * lib/rdoc: Update to RDoc 3.7 (final)
- * NEWS: ditto
-
-Tue Jun 28 10:18:42 2011 NARUSE, Yui <naruse@ruby-lang.org>
-
- * process.c (rb_daemon): fix wrong #endif position.
-
-Tue Jun 28 07:50:32 2011 Eric Hodel <drbrain@segment7.net>
-
- * object.c (Init_Object): Teach RDoc what Init_class_hierarchy does to
- hook up ri for BasicObject, Object, Module and Class.
-
-Tue Jun 28 05:03:32 2011 Hiroshi Nakamura <nahi@ruby-lang.org>
-
- * thread.c (rb_thread_local_aref): RDoc fix. Thread#[] example
- had a race. See #4480.
-
-Tue Jun 28 01:22:00 2011 Kenta Murata <mrkn@mrkn.jp>
-
- * ext/bigdecimal/bigdecimal.c (BigMath_s_log): move BigMath.log from
- bigdecimal/math.rb.
-
- * ext/bigdecimal/lib/bigdecimal/math.rb: ditto.
-
- * test/bigdecimal/test_bigdecimal.rb: move test for BigMath.log from
- test/bigdecimal/test_bigmath.rb.
-
- * test/bigdecimal/test_bigmath.rb: ditto.
-
-Tue Jun 28 01:19:52 2011 Keiju Ishitsuka <keiju@ishitsuka.com>
-
- * lib/irb/ruby-lex.rb: fix [Bug #4232].
-
-Tue Jun 28 00:14:13 2011 Masatoshi SEKI <m_seki@mva.biglobe.ne.jp>
-
- * lib/drb/drb.rb: fix [Bug #4409]. add DRbServer#here?.
-
- * test/drb/test_drb.rb: ditto.
-
- * test/drb/drbtest.rb: ditto.
-
- * test/drb/ut_eq.rb: ditto.
-
-Tue Jun 28 00:08:43 2011 Keiju Ishitsuka <keiju@ishitsuka.com>
-
- * lib/irb/workspace.rb: fix BUG#4793.
-
-Mon Jun 27 22:06:12 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * thread_pthread.c (consume_communication_pipe): don't use C99
- style variable length array.
-
-Mon Jun 27 22:04:27 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * thread_pthread.c (consume_communication_pipe): change return
- type to void. caller doesn't use it.
-
-Mon Jun 27 21:29:50 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * thread_pthread.h (rb_global_vm_lock_struct): add volatile to
- gvl->waiting. now thread_timer() access it w/o lock.
-
-Mon Jun 27 21:16:11 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * thread_pthread.c: s/__gvl_acquire/gvl_acquire_common/ and
- s/__gvl_release/gvl_release_common/.
-
-Mon Jun 27 11:41:47 2011 NARUSE, Yui <naruse@ruby-lang.org>
-
- * thread_pthread.c (rb_thread_create_timer_thread):
- the type of return value of write(2) is ssize_t.
-
-Mon Jun 27 09:57:02 2011 Koichi Sasada <ko1@atdot.net>
-
- * thread_pthread.c (rb_thread_create_timer_thread):
- Fixes missing initialization of oflags.
-
-Mon Jun 27 09:07:42 2011 Koichi Sasada <ko1@atdot.net>
-
- * thread_pthread.c: Stop polling in the timer thread when there are
- no waiting thread. If there are 2 or more runnable threads,
- the timer thread does polling. Avoid polling makes power save
- for several computers (0.2W per a Ruby process, when I measured).
- If outside-event such as signal or Thread#kill was occurred
- when the timer thread does not do polling, then wake-up
- the timer thread using communication-pipe (the timer thread
- waits this communication-pipe with select(2)).
- The discussion about this modification can be found from the post
- [ruby-core:33456] and other related posts.
- Note that Eric Wong and KOSAKI Motohiro give us the huge
- contributions for this modification. Thanks.
-
- * thread_pthread.c (rb_thread_wakeup_timer_thread): add a function.
- This function wakes up the timer thread using communication-pipe.
-
- * thread.c (rb_thread_stop_timer_thread): add a parameter which
- specify closing communication-pipe or not.
-
- * thread.c (rb_thread_terminate_all): do not stop timer thread here
- (ruby_cleanup() terminate timer thread).
-
- * signal.c: wake up timer thread using
- rb_thread_wakeup_timer_thread() from signal handler.
-
- * eval.c (ruby_cleanup): use rb_thread_stop_timer_thread(1).
-
- * process.c: use rb_thread_stop_timer_thread(0)
- (reuse communication-pipe).
-
- * thread_win32.c (rb_thread_wakeup_timer_thread): add a dummy
- function.
-
- * vm_core.h: add and fix decl. of functions.
-
-Mon Jun 27 08:01:19 2011 Tadayoshi Funaba <tadf@dotrb.org>
-
- * ext/date/date_parse.c: should use ALLOCA_N.
-
-Mon Jun 27 01:34:18 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * test/etc/test_etc.rb (TestEtc#test_get{pw,gr}nam): skip entries
- start with + sign, which means NIS. these are returned in the
- case that passwd and group entries in /etc/nsswitch.conf are set
- to use "nis" explicitly on Debian. fixed #3683
-
-Mon Jun 27 00:44:53 2011 NARUSE, Yui <naruse@ruby-lang.org>
-
- * parse.y (rb_parser_end_seen_p): fix documentation about return
- value. patched by Sho Hashimoto. [Bug #4511]
-
-Mon Jun 27 00:40:47 2011 NARUSE, Yui <naruse@ruby-lang.org>
-
- * hash.c (rb_hash_reject): add documentation that Hash#reject
- without block returns enumerator.
- patched by Michael Edgar [Bug #4847] [ruby-core:36800]
-
-Sun Jun 26 23:49:21 2011 Tadayoshi Funaba <tadf@dotrb.org>
-
- * test/date/test_switch_hitter.rb: added a test.
-
- Sun Jun 26 22:21:23 2011 Tadayoshi Funaba <tadf@dotrb.org>
-
- * ext/date/date_core.c: refactoring.
-
-Sun Jun 26 18:03:30 2011 URABE Shyouhei <shyouhei@ruby-lang.org>
-
- * parse.y: comma at the end of line is no longer allowed.
- A patch from Yukihiro Matsumoto <matz AT ruby-lang.org>.
- (fixed #3456).
-
-Sun Jun 26 13:35:35 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * win32/win32.c (rb_w32_conv_from_wchar): converted string to CP_UTF8
+ should have UTF-8 encoding. otherwise no conversion takes place
+ later.
- * vm_dump.c (rb_vm_bugreport): change CrashReporter suggestion messages
- on Mac. It should be placed after "-- C level backtrace" line.
- Suggested by Endoh-san.
+Tue Aug 6 17:21:38 2013 Koichi Sasada <ko1@atdot.net>
- <before>
- -- See Crash Report log file under ~/Library/Logs/CrashReporter or ---------
- -- /Library/Logs/CrashReporter, for the more detail of ---------------------
- -- C level backtrace information -------------------------------------------
+ * 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.
- <after>
- -- C level backtrace information -------------------------------------------
+ * vm_core.h (CHECK_VM_STACK_OVERFLOW0): add to share the stack overflow
+ checking code.
- See Crash Report log file under ~/Library/Logs/CrashReporter or
- /Library/Logs/CrashReporter, for the more detail of.
+ * insns.def: catch up this change.
-Sun Jun 26 10:08:28 2011 Martin Bosslet <Martin.Bosslet@googlemail.com>
+ * vm.c, vm_eval.c: ditto.
- * ext/openssl/extconf.rb
- * ext/openssl/ossl_missing.h/.c: add ASN1_put_eoc if missing.
+ * test/ruby/test_exception.rb: add a stack overflow test.
+ This code is reported by nobu.
- * ext/openssl/ossl_asn1.c: introduce ossl_asn1_object_size and
- ossl_asn1_put_object to wrap functionality depending on OpenSSL
- version in use.
- Fixes [ Ruby 1.9 - Bug #4916 ] reported by Hiroshi Nakamura.
- [ruby-core:37286]
+Tue Aug 6 17:02:17 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Sun Jun 26 01:00:15 2011 Tadayoshi Funaba <tadf@dotrb.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.
- * ext/date/date_core.c (date_strftime_internal): removed meaningless braces.
- * ext/date/date_core.c (gengo): the value should be int.
+Tue Aug 6 16:14:32 2013 Shugo Maeda <shugo@ruby-lang.org>
-Sat Jun 25 23:45:30 2011 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
+ * vm_eval.c (eval_string_with_cref): copy cref to limit the scope of
+ refinements in the eval string. [ruby-core:56329] [Bug #8722]
- * vm_insnhelper.c (vm_search_superclass): avoid control frame
- stack overrun. currently super() in Proc created in a method
- defined by Module#define_method raise NoMethodError. [Bug #4881]
- * test/ruby/test_method.rb t_super_in_proc_from_define_method):
- add test for it.
+ * test/ruby/test_refinement.rb: related test.
-Sat Jun 25 23:23:14 2011 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
+Tue Aug 6 12:23:12 2013 Tanaka Akira <akr@fsij.org>
- * thread.c (sleep_forever): now Kernel#sleep don't wakeup by
- signal handler execution. [Bug #4072]
+ * bignum.c (rb_big_realloc): Use VALGRIND_MAKE_MEM_UNDEFINED to
+ declare undefined memory area.
+ (bignew_1): Ditto.
-Sat Jun 25 23:14:47 2011 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
+ * internal.h (VALGRIND_MAKE_MEM_DEFINED): Moved from gc.c
+ (VALGRIND_MAKE_MEM_UNDEFINED): Ditto.
- * thread.c (rb_threadptr_check_signal): remove unnecessary th->status
- backup. fix race condition which may results unexpected main thread's
- status transition. see #4072
+Tue Aug 6 01:40:37 2013 Zachary Scott <e@zzak.io>
-Fri Jun 24 19:57:30 2011 Hiroshi Nakamura <nahi@ruby-lang.org>
+ * process.c: [DOC] Document caveats of command form of Process.spawn
+ with regard to the shell and OS. Patched by Steve Klabnik [Bug #8550]
- * lib/webrick/httprequest.rb (setup_forwarded_info): Parsing request
- header failed when the request is from 2 or more Apache reverse
- proxies. It's said that all X-Forwarded-* headers will contain more
- than one (comma-separated) value if the original request already
- contained one of these headers. Since we could use these values as
- Host header, we choose the initial(first) value. See #4922.
+Tue Aug 6 01:28:35 2013 Zachary Scott <e@zzak.io>
- * test/webrick/test_httprequest.rb (test_forwarded): Test it.
+ * lib/rss/0.9.rb: [DOC] Typo in example [Bug #8732]
-Fri Jun 24 17:06:33 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Tue Aug 6 01:22:37 2013 Zachary Scott <e@zzak.io>
- * process.c (proc_daemon): should not start timer thread
- twice. fixed Bug#4920.
+ * lib/rss/2.0.rb: [DOC] Document RSS::Rss by Steve Klabnik #8740
+ * lib/rss/atom.rb: [DOC] Typo in rdoc by Steve Klabnik
-Fri Jun 24 15:54:14 2011 Hiroshi Nakamura <nahi@ruby-lang.org>
+Mon Aug 5 23:47:59 2013 Tanaka Akira <akr@fsij.org>
- * ext/openssl/ossl_ssl.c (ossl_ssl_shutdown): Try to shutdown SSL
- connection more gracefully. Call SSL_shutdown() max 4 times until it
- returns 1 (success). Bi-directional SSL close has several states but
- SSL_shutdown() kicks only 1 transition per call. Max 4 is from
- mod_ssl.c of Apache httpd that says 'max 2x pending + 2x data = 4'.
- See #4237.
+ * bignum.c: Rename local variables.
-Fri Jun 24 07:24:37 2011 Eric Hodel <drbrain@segment7.net>
+Mon Aug 5 22:23:59 2013 Zachary Scott <e@zzak.io>
- * lib/rake/version.rb: Fixed VERSION to work with tool/rbinstall.rb
- * bin/rake: Import bin/rake from 0.9.2
- * tool/rbinstall.rb (install): Rake::VERSION is now in
- lib/rake/version.rb. Fixes `make install`
+ * 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
-Fri Jun 24 07:11:37 2011 Eric Hodel <drbrain@segment7.net>
+Mon Aug 5 17:38:15 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * lib/rake: Import Rake 0.9.2
+ * 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]
-Fri Jun 24 00:44:15 2011 Tadayoshi Funaba <tadf@dotrb.org>
+ * 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.
- * ext/date/date_core.c (c_valid_{julian,gregorian}_p): fixed the range of month.
+Mon Aug 5 11:51:00 2013 Charlie Somerville <charliesome@ruby-lang.org>
-Fri Jun 24 00:14:23 2011 Tadayoshi Funaba <tadf@dotrb.org>
+ * include/ruby/encoding.h: document which user flags are used by
+ ENCODING_MASK for better greppability
- * ext/date/date_core.c: trivial changes on text.
+Mon Aug 5 10:01:00 2013 Charlie Somerville <charliesome@ruby-lang.org>
-Thu Jun 23 22:46:57 2011 Hiroshi Nakamura <nahi@ruby-lang.org>
+ * object.c (rb_class_inherited_p): allow iclasses to be tested for
+ inheritance. [Bug #8686] [ruby-core:56174]
- * ext/openssl/ossl_x509name.c: Add X509::Name#hash_old as a wrapper
- for X509_NAME_hash_old in OpenSSL 1.0.0. See #4805
+ * test/ruby/test_method.rb: add test
- * test/openssl/test_x509name.rb (test_hash): Make test pass with
- OpenSSL 1.0.0.
+Mon Aug 5 06:13:48 2013 Zachary Scott <e@zzak.io>
- * NEWS: Add it.
+ * enumerator.c: [DOC] Remove reference to Enumerator::Lazy#cycle
+ Patch by @kachick [Fixes GH-372]
+ https://github.com/ruby/ruby/pull/372
-Thu Jun 23 19:30:53 2011 Hiroshi Nakamura <nahi@ruby-lang.org>
+Mon Aug 5 03:57:16 2013 Zachary Scott <e@zzak.io>
- * ext/openssl/ossl_ssl_session.c (ossl_ssl_session_set_time): Check
- argument type with NUM2LONG if the arg is not a Time object.
- See #4919.
+ * lib/rss/0.9.rb: [DOC] Document RSS09 by Steve Klabnik [Bug #8732]
- * ext/openssl/ossl_ssl_session.c (ossl_ssl_session_set_timeout): Check
- type with NUM2LONG. Time as an arg is not allowed. See #4919.
+Mon Aug 5 03:35:11 2013 Zachary Scott <e@zzak.io>
- * test/openssl/test_ssl_session.rb (test_session_time,
- test_session_timeout): Test it.
+ * lib/rexml/attribute.rb: [DOC] Update example for #namespace
+ Patch by Ippei Obayashi [Bug #8685] [ruby-core:56173]
-Wed Jun 23 13:30:30 2011 Shota Fukumori <sorah@tubusu.net>
+Sun Aug 4 21:08:29 2013 Masaki Matsushita <glass.saga@gmail.com>
- * signal.c(ruby_atomic_exchange): Fix definition style.
+ * array.c (rb_ary_zip): performance implement by using
+ ALLOCA_N() to allocate tmp buffer.
-Wed Jun 22 22:34:05 2011 Hiroshi Nakamura <nahi@ruby-lang.org>
+Sun Aug 4 07:14:49 2013 Tanaka Akira <akr@fsij.org>
- * ext/openssl/ossl_ssl.c (ossl_sslctx_session_new_cb): Return 0 to
- OpenSSL from the callback for SSL_CTX_sess_set_get_cb().
- Returning 0 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
- internally.
- This potential issue was pointed by Ippei Obayashi. See #4416.
+ * README.EXT, README.EXT.ja: Mention rb_integer_pack and
+ rb_integer_unpack.
- * test/openssl/test_ssl_session.rb (test_ctx_server_session_cb): Test
- it.
+Sun Aug 4 01:54:45 2013 Tanaka Akira <akr@fsij.org>
-Wed Jun 22 22:21:17 2011 Martin Bosslet <Martin.Bosslet@googlemail.com>
+ * 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.
- * ext/openssl/ossl_ssl_session.c: Respect T_BIGNUM time values. Patch by
- Tomoyuki Chikanaga.
- [ Ruby 1.9 - Bug #4919 ] [ruby-dev:43869]
+Sun Aug 4 00:57:58 2013 Tanaka Akira <akr@fsij.org>
-Wed Jun 22 21:29:25 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * bignum.c (big2str_karatsuba): Don't allocate new temporary buffer
+ if the buffer is enough for current invocation.
- * ext/socket/depend (SOCK_HEADERS): use $(top_srcdir) instead of
- $(topdir). sorry!
+Sun Aug 4 00:22:34 2013 Tanaka Akira <akr@fsij.org>
-Wed Jun 22 19:47:03 2011 NARUSE, Yui <naruse@ruby-lang.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.
- * cont.c (cont_capture): add volatile.
- On clang -O, it is needed to avoid the optimization.
- With this and llvm/clang's recent fix, clang 3.0 can
- build ruby-trunk with -O option.
+Sat Aug 3 22:47:11 2013 Tanaka Akira <akr@fsij.org>
- * cont.c (cont_capture): use for-loop.
+ * 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.
- * array.c (rb_ary_each): add volatile and use it.
+Sat Aug 3 22:23:31 2013 Tanaka Akira <akr@fsij.org>
- * vm_insnhelper.c (vm_call_cfunc): ditto.
+ * 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.
-Wed Jun 22 18:20:46 2011 Hiroshi Nakamura <nahi@ruby-lang.org>
+Sat Aug 3 13:30:04 2013 Tanaka Akira <akr@fsij.org>
- * ext/openssl/ossl_ssl.c (ossl_sslctx_session_remove_cb):
- OpenSSL::SSL::SSLContext#session_remove_cb was broken. It wrongly
- tried to call the session_*new*_cb callback.
+ * 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.
- * test/openssl/test_ssl_session.rb (class OpenSSL): Test it.
+Sat Aug 3 10:33:52 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Wed Jun 22 17:37:49 2011 Martin Bosslet <Martin.Bosslet@googlemail.com>
+ * parse.y (parser_set_integer_literal): use rb_rational_raw1() for
+ integral rational because no reduction is needed with 1.
- * ext/openssl/ossl.h: Introduced OSSL_BIO_reset macro for PEM/DER
- fallback scenarios.
+Sat Aug 3 09:46:07 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * ext/openssl/ossl_pkey_dsa.c
- * ext/openssl/ossl_x509req.c
- * ext/openssl/ossl_pkey_rsa.c
- * ext/openssl/ossl_pkey_ec.c
- * ext/openssl/ossl_ssl_session.c
- * ext/openssl/ossl_x509crl.c
- * ext/openssl/ossl_pkey.c
- * ext/openssl/ossl_pkey_dh.c
- * ext/openssl/ossl_x509cert.c
- * ext/openssl/ossl_pkcs7.c: Use OSSL_BIO_reset.
+ * ext/etc/etc.c (setup_passwd, setup_group): set proper encodings to
+ string members.
- * ext/openssl/ossl_ssl.c
- * ext/openssl/ossl_cipher.c
- * ext/openssl/ossl_pkey_ec.c
- * ext/openssl/ossl_pkcs12.c
- * ext/openssl/ossl_ssl_session.c: Replace rb_raise occurrences by
- ossl_raise. This automatically flushes OpenSSL's error queue.
+Sat Aug 3 09:30:57 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * ext/openssl/ossl_pkcs7.c: Raise error if DER fallback for parsing
- fails.
+ * struct.c (rb_struct_define_under): new function to define Struct
+ under the given namespace, not under Struct. [Feature #8264]
- * test/openssl/test_pkey_ec.rb
- * test/openssl/test_pkey_dsa.rb
- * test/openssl/test_pkey_rsa.rb: Add assertions that OpenSSL.errors is
- empty.
+ * ext/etc/etc.c: use rb_struct_define_under.
- * test/openssl/test_pkey_rsa.rb: Remove initial OpenSSL.errors call in
- test_new.
- [ Ruby 1.9 - Bug #4885 ] [ruby-core:37134]
+Sat Aug 3 06:55:29 2013 NAKAMURA Usaku <usa@ruby-lang.org>
-Wed Jun 22 15:01:24 2011 Martin Bosslet <Martin.Bosslet@googlemail.com>
+ * 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]
- * ext/openssl/ossl_ssl.c: Use SSL_MODE_RELEASE_BUFFERS if available.
- Thanks, Eric Wong, for providing the patch.
- [ Ruby 1.9 - Feature #4672 ] [ruby-core:36127]
+Sat Aug 3 04:23:48 2013 Eric Hodel <drbrain@segment7.net>
-Wed Jun 22 14:47:53 2011 Martin Bosslet <Martin.Bosslet@googlemail.com>
+ * doc/syntax/refinements.rdoc: Remove mention of instance_eval and
+ module_eval from scope section per:
+ http://twitter.com/shugomaeda/status/363219951336693761
- * test/openssl/test_buffering.rb
- * test/openssl/test_pkcs12.rb: Inherit from Test::Unit::TestCase
- instead of MiniTest::Unit::TestCase. [ruby-core:37275]
+Sat Aug 3 02:22:05 2013 Tanaka Akira <akr@fsij.org>
-Wed Jun 22 12:41:03 2011 Hiroshi Nakamura <nahi@ruby-lang.org>
+ * bignum.c (big2str_orig): Refactored.
- * ext/openssl/ossl_ssl_session.c (ossl_ssl_session_to_der):
- OpenSSL::SSL::Session#to_der was broken. Fix buffer handling.
+Sat Aug 3 01:20:19 2013 Tanaka Akira <akr@fsij.org>
- * test/openssl/test_ssl_session.rb (test_session): Test it.
+ * bignum.c (bigadd_core): Removed.
+ (bigadd): Use bary_add instead of bigadd_core.
-Wed Jun 22 12:38:52 2011 Hiroshi Nakamura <nahi@ruby-lang.org>
+Sat Aug 3 00:52:43 2013 Tanaka Akira <akr@fsij.org>
- * test/openssl/test_ssl_session.rb: Split out SSL::Session related
- tests from test_ssl.rb
+ * bignum.c (rb_big2str1): Simplify power_level calculation.
-Wed Jun 22 03:20:52 2011 Aaron Patterson <aaron@tenderlovemaking.com>
+Sat Aug 3 00:34:20 2013 Masaki Matsushita <glass.saga@gmail.com>
- * ext/psych/lib/psych/visitors/to_ruby.rb: Fix cyclic references of
- objects. Thanks to CvX for reporting the bug and a test case.
- * test/psych/test_object.rb: test for cyclic object references.
+ * array.c (rb_ary_zip): use rb_ary_new2() to create buffer
+ if rb_block_arity() > 1.
-Wed Jun 22 02:39:54 2011 Hiroshi Nakamura <nahi@ruby-lang.org>
+Sat Aug 3 00:12:00 2013 Masaki Matsushita <glass.saga@gmail.com>
- * lib/net/http.rb (Net::HTTP.post_form): Do not ignore query part of
- the given URI to post. See #655.
+ * NEWS: Add the description that IO#seek supports SEEK_DATA
+ and SEEK_HOLE.
- * test/net/http/test_http.rb, test/net/http/utils.rb: Test it.
+Fri Aug 2 23:57:57 2013 NAKAMURA Usaku <usa@ruby-lang.org>
-Wed Jun 22 01:28:13 2011 Hiroshi Nakamura <nahi@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/openssl/test_x509store.rb (test_set_errors): Redhat is
- distributing a patched version of OpenSSL that allows multiple CRL
- for a key (multi-crl.patch.) Make test pass on such env. See #4122,
- #4554.
+ * test/ruby/test_syntax.rb (TestSyntax#test_value_of_def): test for
+ above changes.
-Tue Jun 21 21:50:37 2011 Hiroshi Nakamura <nahi@ruby-lang.org>
+Fri Aug 2 23:54:11 2013 Masaki Matsushita <glass.saga@gmail.com>
- * lib/webrick/httpresponse.rb (HTTPResponse#setup_header): Close
- HTTP/1.1 connection when returning an IO object as response body
- without setting HTTPResponse#chunked to true. See #855 no.1.
+ * array.c (rb_ary_zip): performance improvement by avoiding
+ array creation if rb_block_arity() > 1.
- * test/webrick/test_httpserver.rb: Test it.
+Fri Aug 2 23:50:53 2013 Tanaka Akira <akr@fsij.org>
-Tue Jun 21 21:27:34 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * bignum.c (power_cache_get_power): Apply bigtrunc to the result of
+ bigsq.
+ (big2str_karatsuba): Fix number of leading zero characters.
- * internal.h: move rb_thread_io_blocking_region() declaration
- from intern.h to internal.h. It's still experimental API and
- need more discussion. [ruby-dev:43698]
- * include/ruby/intern.h: ditto.
+Fri Aug 2 23:48:36 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * ext/socket/rubysocket.h: include internal.h.
- * ext/socket/depend: add internal.h dependency.
- * ext/socket/extconf.rb: add $INCFLAGS to topdir.
+ * parse.y (parser_yylex): calculate denominator directly as powers of
+ ten, not parsing string.
-Tue Jun 21 20:38:47 2011 Tadayoshi Funaba <tadf@dotrb.org>
+ * parse.y (parser_number_literal_suffix): return bit set of found
+ suffixes.
- * ext/date/date_core.c (datetime_s_*): canonicalize 24 o'clock.
+ * parse.y (parser_set_number_literal, parser_set_integer_literal):
+ split from parser_number_literal_suffix to set yylval.
-Tue Jun 21 19:46:23 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * parse.y (parser_yylex): parse rational number literal with decimal
+ point precisely.
- * test/ruby/test_thread.rb (TestThread#test_priority): enable
- this test again. Current GVL respect thread priority rather
- than past.
+ * parse.y (simple_numeric): integrate numeric literals and simplify
+ numeric rules.
-Tue Jun 21 13:25:35 2011 TAKAO Kouji <kouji@takao7.net>
+ * ext/ripper/eventids2.c (ripper_init_eventids2): ripper support for
+ new literals, tRATIONAL and tIMAGINARY.
- * ext/readline/readline.c (readline_getc): applied a patch in
- #3827 by by Akio Tajima <artonx AT yahoo.co.jp>. (see #3827)
+Fri Aug 2 18:33:28 2013 Tanaka Akira <akr@fsij.org>
-Tue Jun 21 13:16:31 2011 TAKAO Kouji <kouji@takao7.net>
+ * bignum.c (big2str_karatsuba): Reduce power_level more than one at
+ recursion, if possible.
+ (rb_big2str1): Follow the above change.
- * ext/readline/extconf.rb: fixed bug, specify --disable-libedit
- then disable libedit, does not specify then check readline and
- libedit if failed checking readline. (fixes #3375)
+Fri Aug 2 12:25:15 2013 Tanaka Akira <akr@fsij.org>
-Mon Jun 20 22:52:07 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * 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.
- * process.c (before_exec): use sig_do_nothing instead of SIG_DFL
- for avoiding a race.
- * process.c (sig_do_nothing): new function.
+Fri Aug 2 10:39:00 2013 Charlie Somerville <charliesome@ruby-lang.org>
-Mon Jun 20 21:31:03 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * parse.y (negate_lit): add T_RATIONAL and T_COMPLEX to the switch
+ statement, and call rb_bug() if an unknown type is passed to
+ negate_lit(). [ruby-core:56316] [Bug #8717]
- * thread_pthread.c (thread_timer): rename timeout_10ms to
- time_quantum. it's no longer 10ms.
+ * bootstraptest/test_literal_suffix.rb (assert_equal): add test
-Mon Jun 20 18:46:02 2011 Hiroshi Nakamura <nahi@ruby-lang.org>
+Fri Aug 2 09:14:47 2013 Eric Hodel <drbrain@segment7.net>
- * ext/openssl/ossl_cipher.c, ext/openssl/lib/openssl/cipher.rb:
- Documentation fix by Ippei Obayashi. See #4419.
+ * doc/syntax/refinements.rdoc: Improve description of where you may
+ activate refinements.
-Mon Jun 20 15:41:33 2011 Hiroshi Nakamura <nahi@ruby-lang.org>
+Fri Aug 2 07:45:55 2013 Tanaka Akira <akr@fsij.org>
- * lib/webrick/cookie.rb (WEBrick::Cookie.parse): Revert r31228.
- r31228 was for allowing the 'Cookie:' header which did not have no
- SP after ';' for separating cookie-pairs but RFC6265 requires single
- SP after ';' there. We allow multiple SPs here for compatibility
- with older WEBrick version.
+ * bignum.c (big2str_orig): Remove len argument.
+ (big2str_karatsuba): Ditto.
+ (rb_big2str1): Follow above change.
- * test/webrick/test_cookie.rb: Test it.
+Thu Aug 2 02:32:00 2013 Kenta Murata <mrkn@mrkn.jp>
-Sun Jun 19 13:31:26 2011 Shota Fukumori <sorah@tubusu.net>
+ * NEWS: Add the description of number literal suffixes.
- * NEWS: Introduce --hide-skip on test/unit.
+Thu Aug 2 00:02:00 2013 Kenta Murata <mrkn@mrkn.jp>
-Sun Jun 19 10:05:16 2011 Shota Fukumori <sorah@tubusu.net>
+ * bootstraptest/test_literal_suffix.rb: add two test cases to
+ examine that "1if true" and "1rescue nil" are recognized as 1.
- * lib/test/unit/parallel.rb: Override Test::Unit::TestCase#on_parallel_worker?
- only when $0 == __FILE__.
+Thu Aug 1 23:45:00 2013 Kenta Murata <mrkn@mrkn.jp>
- * lib/test/unit/parallel.rb: Run Test::Unit::Worker.run only when
- $0 == __FILE__.
+ * rational.c (rb_flt_rationalize_with_prec): new public C function
+ to rationalize a Float instance with a precision.
-Sat Jun 18 23:59:24 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * rational.c (rb_flt_rationalize): new public C function to
+ rationalize a Float instance. A precision is calculated from
+ the given float number.
- * io.c (fill_cbuf): finish reading at EOF, and the readconv has
- been cleared by another thread while io_fillbuf() is waiting at
- select(). a patch in [ruby-core:37197] by Hiroshi Shirosaki
- <h.shirosaki AT gmail.com>. fixed #3840
+ * include/ruby/intern.h: Add rb_flt_rationalize_with_prec and
+ rb_flt_rationalize.
-Sat Jun 18 21:36:29 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * parse.y: implement number literal suffixes, 'r' and 'i'.
+ [ruby-core:55096] [Feature #8430]
- * thread_pthread.c: remove GVL_DEBUG
+ * bootstraptest/test_literal_suffix.rb: add tests for parser to scan
+ number literals with the above tsuffixes.
-Sat Jun 18 21:32:02 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+Thu Aug 1 23:55:08 2013 Tanaka Akira <akr@fsij.org>
- * vm.c, vm_core.h (rb_vm_stack_to_heap): remove const.
- It makes compilations warnings.
+ * bignum.c (rb_big2str1): Remove a local variable.
-Sat Jun 18 18:54:15 2011 Koichi Sasada <ko1@atdot.net>
+Thu Aug 1 23:33:01 2013 Tanaka Akira <akr@fsij.org>
- * vm.c, vm_core.h (rb_vm_stack_to_heap): fix "const" place.
+ * bignum.c (rb_cstr_to_inum): Use power_cache_get_power.
-Sat Jun 18 17:23:38 2011 Tanaka Akira <akr@fsij.org>
+Thu Aug 1 21:02:48 2013 Tanaka Akira <akr@fsij.org>
- * eval.c, hash.c, load.c, proc.c, range.c, thread.c, time.c: don't
- declare internal functions.
+ * bignum.c (rb_big2str1): Raise an error for too big number.
- * internal.h, vm_core.h: declare internal functions.
+Thu Aug 1 20:46:29 2013 Tanaka Akira <akr@fsij.org>
- * array.c: include internal.h.
+ * bignum.c (power_cache_get_power): Hide cached Bignum objects.
- * common.mk: update dependency for array.o.
+Thu Aug 1 19:15:05 2013 Tanaka Akira <akr@fsij.org>
-Sat Jun 18 13:39:33 2011 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.
- * internal.h: declarations declared in include/ruby/*.h removed.
+Thu Aug 1 12:37:58 2013 Tanaka Akira <akr@fsij.org>
-Sat Jun 18 12:42:17 2011 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.
- * method.h, internal.h iseq.h: declare internal functions.
+Thu Aug 1 07:36:27 2013 Tanaka Akira <akr@fsij.org>
- * compile.c, eval.c, iseq.c, object.c, parse.y, proc.c, process.c,
- thread.c, vm.c, vm_eval.c, vm_insnhelper.c, vm_method.c: don't
- declare internal functions.
+ * bignum.c (big2str_orig): Use temporary buffer when trim mode.
- Note that rb_method_entry_eq() is defined in vm_method.c but
- there was a declaration in proc.c with different const-ness.
- Now it is declared in method.h with same const-ness to the
- definition.
+Thu Aug 1 06:28:48 2013 Tanaka Akira <akr@fsij.org>
- * object.c (rb_mod_module_exec): don't declare functions declared in
- include/ruby/intern.h.
+ * bignum.c (big2str_orig): Simplified because RBIGNUM_LEN(x) <= 2 now.
+ (big2str_struct): Two fields added: hbase2, hbase2_numdigits.
+ (rb_big2str1): Initialize above fields.
-Sat Jun 18 12:05:08 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Thu Aug 1 04:06:17 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * include/ruby/backward/classext.h: for evil gems. fixed #4803
+ * 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]
-Sat Jun 18 11:12:13 2011 Tanaka Akira <akr@fsij.org>
+ * test/test_rdoc_markup_pre_process.rb (TestRDocMarkupPreProcess#setup):
+ fix input_file_name, as the test script is not pre-processed.
- * common.mk: update dependencies.
+Thu Aug 1 01:45:18 2013 Tanaka Akira <akr@fsij.org>
-Sat Jun 18 11:09:03 2011 Tanaka Akira <akr@fsij.org>
+ * bignum.c (big2str_karatsuba): Fix a condition of power_level.
- * io.c: suppress warnings.
+Thu Aug 1 01:09:02 2013 Tanaka Akira <akr@fsij.org>
-Sat Jun 18 10:22:39 2011 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.
- * internal.h: declare more internal functions.
+Wed Jul 31 23:59:28 2013 Tanaka Akira <akr@fsij.org>
- * iseq.h (rb_method_get_iseq): declared.
+ * bignum.c (big2str_find_n1): Change the return type to size_t.
+ (big2str_orig): Ditto.
+ (big2str_karatsuba): Ditto.
+ (rb_big2str1): Follow the above changes.
- * compile.c, eval.c, eval_error.c, iseq.c, parse.y, proc.c, range.c,
- ruby.c, time.c, util.c, vm.c: don't declare internal functions.
+Wed Jul 31 23:19:06 2013 Tanaka Akira <akr@fsij.org>
- * eval.c, parse.y, thread_pthread.c: non-existing function declarations
- removed.
-
-Sat Jun 18 08:12:54 2011 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.
- * common.mk: dependencies updated.
+Wed Jul 31 22:59:47 2013 Kouhei Sutou <kou@cozmixng.org>
- * tool/update-deps: new file to assist update dependencies in
- common.mk.
+ * test/rexml/parse/test_notation_declaration.rb: Change class
+ name to follow file name change.
-Sat Jun 18 07:27:27 2011 Tanaka Akira <akr@fsij.org>
+Wed Jul 31 22:57:50 2013 Kouhei Sutou <kou@cozmixng.org>
- * internal.h: declare internal functions here.
+ * test/rexml/test_notationdecl_parsetest.rb: Rename to ...
+ * test/rexml/parse/test_notation_declaration.rb: ... this.
- * node.h: declare NODE dependent internal functions here.
+Wed Jul 31 22:54:39 2013 Kouhei Sutou <kou@cozmixng.org>
- * iseq.h: declare rb_iseq_t dependent internal functions here.
+ * test/rexml/test_notationdecl_mixin.rb: Remove duplicated tests.
- * vm_core.h: declare rb_thread_t dependent internal functions here.
+Wed Jul 31 22:52:55 2013 Kouhei Sutou <kou@cozmixng.org>
- * bignum.c, class.c, compile.c, complex.c, cont.c, dir.c, encoding.c,
- enumerator.c, error.c, eval.c, file.c, gc.c, hash.c, inits.c, io.c,
- iseq.c, load.c, marshal.c, math.c, numeric.c, object.c, parse.y,
- proc.c, process.c, range.c, rational.c, re.c, ruby.c, string.c,
- thread.c, time.c, transcode.c, variable.c, vm.c,
- tool/compile_prelude.rb: don't declare internal functions declared
- in above headers. include above headers if required.
+ * test/rexml/test_notationdecl_parsetest.rb: Fix typos in expected
+ value.
+ pubilc ->
+ public
+ ^^
- Note that rb_thread_mark() was declared as
- void rb_thread_mark(rb_thread_t *th) in cont.c but defined as
- void rb_thread_mark(void *ptr) in vm.c. Now it is declared as
- the later in internal.h.
+Wed Jul 31 22:50:51 2013 Kouhei Sutou <kou@cozmixng.org>
-Sat Jun 18 02:36:00 2011 Kenta Murata <mrkn@mrkn.jp>
-
- * ext/bigdecimal/bigdecimal.c (VpNewRbClass): fix type of the 2nd
- argument.
+ * test/rexml/test_notationdecl_parsetest.rb: Add tests that focus
+ system literal in external ID system notation declaration.
- * ext/bigdecimal/bigdecimal.h: ditto.
+Wed Jul 31 22:36:21 2013 Tanaka Akira <akr@fsij.org>
-Sat Jun 18 02:30:00 2011 Kenta Murata <mrkn@mrkn.jp>
+ * 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.
- * ext/bigdecimal/bigdecimal.c (BigMath_s_exp): move BigMath.exp from
- bigdecimal/math.rb.
+Wed Jul 31 22:04:36 2013 Kouhei Sutou <kou@cozmixng.org>
- * ext/bigdecimal/lib/bigdecimal/math.rb: ditto.
+ * test/rexml/test_notationdecl_parsetest.rb: Fix a typo.
+ Extern ID ->
+ ExternalID
+ ^^
- * test/bigdecimal/test_bigdecimal.rb: move test for BigMath.exp from
- test/bigdecimal/test_bigmath.rb.
+Wed Jul 31 22:01:36 2013 Kouhei Sutou <kou@cozmixng.org>
- * test/bigdecimal/test_bigmath.rb: ditto.
+ * test/rexml/test_notationdecl_parsetest.rb: Add tests that focus
+ public ID in external ID notation declaration.
-Sat Jun 18 00:20:54 2011 Tadayoshi Funaba <tadf@dotrb.org>
+Wed Jul 31 22:01:24 2013 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
- * ext/date/date_core.c: do not define wnum[01].
+ * parse.y: fix build error with bison-3.0.
-Fri Jun 17 18:57:36 2011 NARUSE, Yui <naruse@ruby-lang.org>
+Wed Jul 31 21:58:53 2013 Kouhei Sutou <kou@cozmixng.org>
- * compile.c (iseq_compile_each): fix return value of obj[a,*b]=c.
+ * test/rexml/test_notationdecl_parsetest.rb: Split test patterns.
-Fri Jun 17 13:09:45 2011 Eric Hodel <drbrain@segment7.net>
+Wed Jul 31 21:42:33 2013 Kouhei Sutou <kou@cozmixng.org>
- * ext/curses/curses.c: Clean up documentation.
+ * test/rexml/test_notationdecl_parsetest.rb: Group tests.
-Fri Jun 17 09:25:14 2011 Eric Hodel <drbrain@segment7.net>
+Wed Jul 31 21:37:51 2013 Kouhei Sutou <kou@cozmixng.org>
- * ext/curses/curses.c: Document curses constants. Patch by Vincent
- Batts. [Ruby 1.9 - Bug #4880]
+ * test/rexml/test_notationdecl_mixin.rb (TestNotationDecl#test_name):
+ Move to ...
+ * test/rexml/test_notationdecl_parsetest.rb
+ (TestNotationDecl#test_name): ... here.
-Fri Jun 17 09:11:05 2011 Eric Hodel <drbrain@segment7.net>
+Wed Jul 31 21:37:47 2013 Kouhei Sutou <kou@cozmixng.org>
- * object.c: Document Module#method_added and #method_removed.
- Patch by Bryce Kerley. [Ruby 1.9 - Feature #4867]
+Wed Jul 31 21:31:49 2013 Kouhei Sutou <kou@cozmixng.org>
-Fri Jun 17 08:50:16 2011 Eric Hodel <drbrain@segment7.net>
+ * test/rexml/test_notationdecl_parsetest.rb: Remove setup because it
+ doesn't share anything with other tests.
- * io.c: Improve documentation of IO and File open and new.
- Patch by Roger Pack. [Ruby 1.9 - Bug #4790]
+Wed Jul 31 21:24:55 2013 Kouhei Sutou <kou@cozmixng.org>
-Fri Jun 17 07:53:50 2011 Eric Hodel <drbrain@segment7.net>
+ * 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.
- * lib/csv.rb: Document #raw_encoding. Patch by David Czarnecki.
- [Ruby 1.9 - Bug #4874]
+Wed Jul 31 21:20:08 2013 Kouhei Sutou <kou@cozmixng.org>
-Fri Jun 17 07:46:50 2011 Eric Hodel <drbrain@segment7.net>
+ * test/rexml/test_notationdecl_parsetest.rb: remove a needless shebang.
- * lib/benchmark.rb: Document Benchmark::Tms#memberwise. Patch by
- David Czarnecki. [Ruby 1.9 - Bug #4873]
+Wed Jul 31 20:11:01 2013 Masaki Matsushita <glass.saga@gmail.com>
-Fri Jun 17 07:38:31 2011 Eric Hodel <drbrain@segment7.net>
+ * string.c (rb_str_rindex): fix bug introduced in r42269.
+ "".rindex("") should return 0.
+ (str_rindex): ditto.
- * lib/prettyprint.rb: Improve documentation. Patch by Ysiad
- Ferreiras. [#4834]
+Wed Jul 31 19:55:33 2013 Tanaka Akira <akr@fsij.org>
-Fri Jun 17 07:23:03 2011 Eric Hodel <drbrain@segment7.net>
+ * 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.
- * array.c (rb_ary_drop): Improve documentation. Patch by Caley Woods.
- [Ruby 1.9 - Bug #4858]
+Wed Jul 31 18:32:25 2013 Akinori MUSHA <knu@iDaemons.org>
-Fri Jun 17 06:11:31 2011 Eric Hodel <drbrain@segment7.net>
+ * lib/uri/common.rb (URI.decode_www_form_component): Use String#b.
- * lib/webrick/log.rb: Improve documentation of BasicLog and Log.
- Patch by Olivier Brisse. [Ruby 1.9 - Bug #4833]
- * lib/webrick/httpstatus.rb: Improve documentation of
- WEBrick::HTTPStatus. Patch by Olivier Brisse.
- [Ruby 1.9 - Bug #4833]
+Wed Jul 31 18:24:02 2013 Shugo Maeda <shugo@ruby-lang.org>
-Fri Jun 17 04:48:22 2011 Koichi Sasada <ko1@atdot.net>
+ * eval.c (rb_mod_refine, mod_using, top_using): don't show
+ warnings because Refinements are no longer experimental.
+ [ruby-core:55993] [Feature #8632]
- * thread_pthread.c, thread_pthread.h: remove unused variables.
- (native_thread_data_t::gvl_cond, native_thread_data_t::gvl_next)
+ * test/ruby/test_refinement.rb: related test.
-Thu Jun 16 14:32:31 2011 NARUSE, Yui <naruse@ruby-lang.org>
+ * NEWS: fixes for the above change.
- * time.c (rb_time_new): prevent overflow by "* 1000".
+Wed Jul 31 17:55:55 2013 Shota Fukumori <her@sorah.jp>
-Fri Jun 17 03:07:36 2011 Koichi Sasada <ko1@atdot.net>
+ * lib/uri/common.rb (URI.decode_www_form_component):
+ Don't raise error when str includes multibyte characters.
- * benchmark/bm_vm4_thread_create_join.rb,
- benchmark/bm_vm4_thread_mutex[1-3].rb: renamed to
- bm_thread_* (fix last rename).
+Wed Jul 31 17:45:39 2013 Masaki Matsushita <glass.saga@gmail.com>
-Fri Jun 17 02:26:47 2011 Koichi Sasada <ko1@atdot.net>
+ * string.c (rb_str_rindex): performance improvement by using
+ memrchr(3).
- * thread_pthread.c (native_thread_create): fix debug message.
- (add last newline)
+Wed Jul 31 16:43:30 2013 Masaki Matsushita <glass.saga@gmail.com>
-Thu Jun 16 23:40:49 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * string.c (rb_str_rindex): refactoring and avoid to call str_nth() if
+ pos == 0.
- * thread.c (rb_thread_schedule_rec): fix {UN,}LIKELY macro misuse.
- * gc.c (rb_newobj): ditto.
- * vm_insnhelper.c (vm_method_search): ditto.
+Wed Jul 31 14:41:36 2013 Akinori MUSHA <knu@iDaemons.org>
-Thu Jun 16 20:06:15 2011 Shota Fukumori <sorah@tubusu.net>
+ * lib/set.rb: [DOC] Add a couple of notes on Hash as storage.
+ ref. [Feature #6589]
- * test/testunit/test_parallel.rb: Fix Regexp for test.
+Wed Jul 31 14:38:52 2013 Akinori MUSHA <knu@iDaemons.org>
- * test/testunit/tests_for_parallel/test_third.rb: Use
- Test::Unit::TestCase#on_parallel_worker? for detecting worker.
+ * lib/set.rb: [DOC] Fix example result. Hash is now ordered.
- * lib/test/unit/testcase.rb(Test::Unit::TestCase#on_parallel_worker?):
- New Method Test::Unit::TestCase#on_parallel_worker? returns true
- when a testcase is running on parallel worker.
- * lib/test/unit/parallel.rb(Test::Unit::TestCase#on_parallel_worker?):
- ditto.
+Wed Jul 31 14:38:10 2013 Akinori MUSHA <knu@iDaemons.org>
-Thu Jun 16 19:27:12 2011 Hiroshi Nakamura <nahi@ruby-lang.org>
+ * lib/set.rb: [DOC] Use the term "sorted" instead of "ordered"
+ when mentioning SortSet.
- * test/test_securerandom.rb: Add testcase. This testcase does NOT aim
- to test cryptographically strongness and randomness. It includes
- the test for PID recycle issue of OpenSSL described in #4579 but
- it's disabled by default.
+Wed Jul 31 12:18:47 2013 Tanaka Akira <akr@fsij.org>
-Thu Jun 16 17:55:07 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * bignum.c (big2str_struct): New structure.
+ (big2str_orig): Use big2str_struct.
+ (big2str_karatsuba): Ditto.
+ (rb_big2str1): Ditto.
- * test/ruby/test_io.rb (TestIO#test_copy_stream_socket): fix
- test hanging up issue. Patch by CHIKANAGA Tomoyuki.
+Wed Jul 31 12:02:16 2013 Zachary Scott <e@zzak.io>
-Thu Jun 16 15:17:39 2011 Eric Hodel <drbrain@segment7.net>
+ * lib/rubygems.rb: [DOC] typo in url patch by @Red54 [Fixes #369]
+ https://github.com/ruby/ruby/pull/369
- * variable.c (const_missing): Add simple example of const_missing.
- Patch by Anuj Dutta. [Ruby 1.9 - Bug #4794]
+Wed Jul 31 07:09:07 2013 Eric Hodel <drbrain@segment7.net>
-Thu Jun 16 15:09:29 2011 Eric Hodel <drbrain@segment7.net>
+ * lib/rubygems: Import RubyGems from master as of commit 523551c
+ * test/rubygems: ditto.
- * lib/monitor.rb: Improve documentation. Patch by Sandor Szucs.
- [Ruby 1.9 - Bug #4823]
+Tue Jul 30 22:21:54 2013 Masaki Matsushita <glass.saga@gmail.com>
-Thu Jun 16 14:54:09 2011 Eric Hodel <drbrain@segment7.net>
+ * test/ruby/test_hash.rb: add a test for enumeration order of Hash.
- * lib/webrick/utils.rb: Document WEBrick::Utils. Patch by Olivier
- Brisse. [Ruby 1.9 - Bug #4819]
+Tue Jul 30 18:52:27 2013 Akinori MUSHA <knu@iDaemons.org>
-Thu Jun 16 14:26:46 2011 Eric Hodel <drbrain@segment7.net>
+ * 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.
- * lib/webrick/httpservlet/erbhandler.rb: Allow the ERB document to
- alter the content-type of the response. [Ruby 1.9 - Bug #4685]
+Tue Jul 30 17:16:15 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Thu Jun 16 14:15:47 2011 Eric Hodel <drbrain@segment7.net>
+ * sprintf.c (ruby__sfvextra): add QUOTE flag to escape unprintable
+ characters.
- * lib/timeout.rb: Clarify timeout duration types. Patch by Alf Mikula.
- [Ruby 1.9 - Bug #4791]
- * lib/net/http.rb: ditto
+Tue Jul 30 11:00:52 2013 Zachary Scott <e@zzak.io>
-Thu Jun 16 13:25:25 2011 Eric Hodel <drbrain@segment7.net>
+ * ext/curses/extconf.rb: [DOC] nodoc to reduce Object pollution
- * lib/rdoc*: Import RDoc 3.7 release candidate
+Tue Jul 30 08:19:42 2013 Tanaka Akira <akr@fsij.org>
-Thu Jun 16 11:35:09 2011 Shugo Maeda <shugo@ruby-lang.org>
+ * sizes.c (Init_sizes): Define sizes only if the type actually exists.
- * lib/net/imap.rb (search_response): parses SEARCH responses from
- the Yahoo IMAP server correctly. patched by Mark Nadig. [Bug #4509]
+Mon Jul 29 22:55:26 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Thu Jun 16 09:12:38 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * sizes.c (Init_sizes): define RbConfig::SIZEOF. [Feature #8568]
- * fix for build on solaris 10.
+Mon Jul 29 22:25:20 2013 Zachary Scott <e@zzak.io>
-Thu Jun 16 09:08:39 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * 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
- * test/io/console/test_io_console.rb (TestIO_Console#test_sync):
- fix for daemon process.
+Mon Jul 29 22:16:11 2013 Tanaka Akira <akr@fsij.org>
-Thu Jun 16 07:58:01 2011 Shota Fukumori <sorah@tubusu.net>
+ * bignum.c (LOG2_KARATSUBA_BIG2STR_DIGITS): Renamed from
+ LOG2_KARATSUBA_DIGITS.
+ (KARATSUBA_BIG2STR_DIGITS): Renamed from KARATSUBA_DIGITS.
- * test/testunit/test_parallel.rb(test_ignore_tzero): Test for r32109.
+Mon Jul 29 22:04:45 2013 Masaki Matsushita <glass.saga@gmail.com>
- * test/testunit/tests_for_parallel/test_third.rb: Use another way to
- detect that test is running on worker. This fixes sometimes
- TestParallel failing.
+ * hash.c (rb_hash_compare_by_id): add function prototype.
-Thu Jun 16 07:20:06 2011 Shota Fukumori <sorah@tubusu.net>
+Mon Jul 29 21:53:41 2013 Masaki Matsushita <glass.saga@gmail.com>
- * lib/test/unit.rb(Test::Unit::Runner#_run_parallel): Ignore -j0
- because it makes blocking forever by IO.select.
+ * hash.c (rb_hash_compare_by_id): don't call rb_hash_rehash()
+ if self.compare_by_identity? == true.
-Thu Jun 16 03:08:11 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+Mon Jul 29 21:29:48 2013 Masaki Matsushita <glass.saga@gmail.com>
- * test/testunit/test_parallel.rb (TestParallel::TestParallelWorker#
- setup): now can run on Windows, probably.
+ * 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/testunit/test_parallel.rb (TestParallel::TestParallel#setup):
- ditto.
+ * test/ruby/test_hash.rb: add a test for above.
-Thu Jun 16 03:00:26 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+Mon Jul 29 21:15:30 2013 Akinori MUSHA <knu@iDaemons.org>
- * thread.c (do_select): Windows: no need to poll if select(2) is
- cancelable.
+ * 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().
- * thread_win32.c (native_fd_select): new function to make select(2)
- cancelable.
+Mon Jul 29 21:06:42 2013 Akinori MUSHA <knu@iDaemons.org>
- * thread_win32.c (rb_w32_check_interrupt): new function for checking
- interrupt.
+ * 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.
- * win32/win32.c (rb_w32_select_with_thread): new function. cancelable
- select(2).
+ * enumerator.c (generator_init): Ditto.
- * win32/win32.c (rb_w32_select): use above function internally.
+Mon Jul 29 20:14:24 2013 Masaki Matsushita <glass.saga@gmail.com>
-Wed Jun 15 23:30:45 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * hash.c (rb_hash_assoc): revert r42224. table->type->compare is
+ called only if hashes are matched.
- * gc.c: fix a regression by r31690 on AIX because AIX malloc
- return NULL if it's passed 0. But some caller don't expect it.
- patch by Yutaka Kanemoto. [ruby-dev:43779]
- (vm_malloc_prepare): return calculated size.
- (vm_xmalloc): use above result.
- (vm_xcalloc): ditto.
+ * test/ruby/test_hash.rb: add a test to check using #== to compare.
-Wed Jun 15 23:11:35 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+Mon Jul 29 17:00:31 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * thread.c: remove BLOCKING_REGION_CORE() macro. It's no longer used
- since r32022.
+ * parse.y (yycompile): store file name as String to keep the encoding.
-Wed Jun 15 21:00:47 2011 Martin Bosslet <Martin.Bosslet@googlemail.com>
+ * parse.y (rb_parser_compile_string_path, rb_parser_compile_file_path):
+ new functions to pass file name as a String.
- * test/openssl/test_config.rb: execute based on the existence of the
- OpenSSL module.
+ * parse.y (gettable_gen): return a copy of the original file name, not
+ a copy in filesystem encoding.
-Wed Jun 15 12:35:11 2011 Tanaka Akira <akr@fsij.org>
+ * vm_eval.c (eval_string_with_cref): use Qundef instead of "(eval)".
- * test/ruby/test_io.rb (test_copy_stream_socket): wait a child process
- before SIGUSR1 handler is removed.
+Mon Jul 29 16:53:18 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * test/pathname/test_pathname.rb (define_assertion): use line number
- for test method names.
+ * hash.c (rb_hash_initialize_copy): copy st_table type even if empty.
+ [ruby-core:56256] [Bug #8703]
-Wed Jun 15 10:37:43 2011 NARUSE, Yui <naruse@ruby-lang.org>
+Mon Jul 29 16:34:29 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * file.c (rb_stat_rdev): use DEVT2NUM.
+ * hash.c (rb_hash_initialize_copy): clear old table before copy new
+ table.
- * file.c (rb_stat_rdev_major): ditto.
+Mon Jul 29 16:34:09 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * file.c (rb_stat_rdev_minor): ditto.
+ * hash.c (rb_hash_assoc): aggregate object can be initialized only
+ with link time constants.
-Wed Jun 15 05:12:59 2011 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
+Mon Jul 29 14:54:44 2013 Masaki Matsushita <glass.saga@gmail.com>
- * ext/tk/tcltklib.c (lib_eventloop_core): revert the last change (it's
- the part for ruby_1_8), and use rb_thread_check_ints() when RUBY_VM
- is defined.
+ * hash.c (rb_hash_assoc): performance improvement by replacing
+ compare function in RHASH(hash)->ntbl->type temporarily.
-Wed Jun 15 04:42:47 2011 Koichi Sasada <ko1@atdot.net>
+Mon Jul 29 14:52:46 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * benchmark/bm_vm3_thread_*.rb: renamed bm_vm3_thread_*.rb to
- benchmark/bm_vm_thread_*.rb.
+ * lib/mkmf.rb (xsystem): expand environment variable in all macros not
+ expanded with RbConfig. [Bug #8702]
-Wed Jun 15 04:28:39 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * test/mkmf/test_framework.rb (create_framework): replace all $@ not
+ only once.
- * benchmark/bm_vm4_thread_pass.rb: rename bm_vm4* to
- bm_vm_thread_*. suggested by ko1.
- * benchmark/bm_vm4_pipe.rb: ditto.
- * benchmark/bm_vm4_alive_check1.rb: ditto.
- * benchmark/bm_vm4_pass_flood.rb: ditto.
+Mon Jul 29 06:54:30 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Wed Jun 15 03:52:50 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * win32/win32.c (rb_w32_pipe): use enum for compile time constants,
+ instead of const int for debugging.
- * benchmark/bm_vm4_pass_flood.rb: new benchmark for GVL fairness.
- * benchmark/bm_vm4_alive_check1.rb: ditto.
+Mon Jul 29 00:11:49 2013 Tanaka Akira <akr@fsij.org>
-Wed Jun 15 01:27:53 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * bignum.c (bigdivrem): Specialized implementation added for
+ nx == 2 && ny == 2
- * thread_pthread.c (gvl_yield): fix live lock issue on 1-2 cpus
- system. It's additional fix for r32021.
- * thread_pthread.c (gvl_init): add switch_wait_cond.
- * thread_pthread.h (typedef struct rb_global_vm_lock_struct): ditto.
+Sun Jul 28 20:28:41 2013 Masaki Matsushita <glass.saga@gmail.com>
-Tue Jun 14 23:16:22 2011 Tanaka Akira <akr@fsij.org>
+ * io.c (io_getpartial): use rb_str_locktmp_ensure().
+ [ruby-core:56121] [Bug #8669]
- * bootstraptest/runner.rb (show_progress): refine verbose mode.
- (exec_test): ditto.
+ * io.c (rb_io_sysread): ditto.
-Tue Jun 14 23:02:36 2011 Tanaka Akira <akr@fsij.org>
+ * test/ruby/test_io.rb: add tests for above.
- * bootstraptest/runner.rb (show_progress): extracted from assert_check.
- (assert_check): use show_progress.
- (assert_normal_exit): ditto.
- (assert_finish): ditto.
- (flunk): ditto.
+Sun Jul 28 20:10:49 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Tue Jun 14 22:51:42 2011 Tadayoshi Funaba <tadf@dotrb.org>
+ * ext/extmk.rb (extmake): should make static libraries for extensions
+ to be statically linked. [Bug #7948]
- * test/date/test_*.rb: added tests.
+Sun Jul 28 17:38:32 2013 Masaki Matsushita <glass.saga@gmail.com>
-Tue Jun 14 22:09:58 2011 Tadayoshi Funaba <tadf@dotrb.org>
+ * string.c: add internal API rb_str_locktmp_ensure().
- * ext/date/date_core.c: renamed some functions.
- * ext/date/date_core.c: modified doc.
+ * io.c (io_fread): use rb_str_locktmp_ensure().
+ [ruby-core:56121] [Bug #8669]
-Tue Jun 14 21:26:01 2011 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
+ * test/ruby/test_io.rb: add a test for above.
- * cont.c (cont_save_thread): add new utility function.
- rb_context_t::saved_thread.machine_stack_start and
- machine_stack_end should be cleared immediately after a snapshot of
- current thread is stored to saved_thread. [ruby-dev:43680] [Bug #4855]
- this change aims to get rid of unnecessary GC mark at machine stack.
+Sun Jul 28 13:04:39 2013 Masaki Matsushita <glass.saga@gmail.com>
-Tue Jun 14 19:50:49 2011 Tanaka Akira <akr@fsij.org>
+ * 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_autoload.rb: remove temporary directory.
+ * test/ruby/test_io.rb: Add tests for above.
-Tue Jun 14 11:05:03 2011 Narihiro Nakamura <narihiro@netlab.jp>
+Sun Jul 28 12:41:39 2013 Tanaka Akira <akr@fsij.org>
- * gc.c (rb_gc_set_params): call initial_expand_heap if
- initial_heap_min_slots is set.
+ * bignum.c (absint_numwords_generic): The char_bit variable changed
+ to static constant.
-Tue Jun 14 11:02:08 2011 Narihiro Nakamura <narihiro@netlab.jp>
+Sun Jul 28 12:03:23 2013 Tanaka Akira <akr@fsij.org>
- * gc.c: use size_t.
+ * bignum.c: Constify bary_* functions.
-Tue Jun 14 01:10:38 2011 Yusuke Endoh <mame@tsg.ne.jp>
+Sun Jul 28 11:12:07 2013 Tanaka Akira <akr@fsij.org>
- * test/coverage/test_coverage.rb: add a test for restart. a patch
- from Xavier Shay. [ruby-core:36745]
+ * 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]
-Tue Jun 14 01:05:10 2011 Yusuke Endoh <mame@tsg.ne.jp>
+Sun Jul 28 10:54:26 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * ext/coverage/coverage.c: make it restartable. [ruby-core:36539]
+ * win32/win32.c (rb_w32_pipe): fix pipe name formatting. as "%x" may
+ not contain '0' at all, fill at fixed position instead.
-Mon Jun 13 23:55:40 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+Sun Jul 28 00:35:14 2013 Tanaka Akira <akr@fsij.org>
- * thread.c (rb_thread_schedule_rec): call gvl_yield() unconditionally.
- * thread_pthread.c: remove HAVE_GVL_YIELD macro.
- * thread_win32.c (gvl_yield): new. this fallback logic was moved from
- rb_thread_schedule_rec().
+ * bignum.c (rb_big_size): Return the bignum "bytewise" size.
+ [ruby-core:55578] [Feature #8553]
+ This is accepted by matz on DevelopersMeeting20130727Japan.
-Mon Jun 13 23:50:25 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+Sun Jul 28 00:07:48 2013 Tanaka Akira <akr@fsij.org>
- * ext/io/console/console.c (console_dev): typo.
+ * include/ruby/intern.h (rb_integer_pack): Declaration moved from
+ internal.h.
+ (rb_integer_unpack): Ditto.
+ [ruby-core:42813] [Feature #6065]
-Mon Jun 13 23:38:23 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Fri Jul 26 23:18:13 2013 Kouhei Sutou <kou@cozmixng.org>
- * parse.y (parser_parse_string): flush delayed token. based on a
- patch by Masaya Tarui in [ruby-dev:43762]. Bug #4544
+ * NEWS: Add a new feature that REXML::Parsers::StreamParser
+ supports "entity" event.
- * parse.y (yylex): revert r24557. delayed token at the end of
- string should be flushed already by the above change.
+Fri Jul 26 23:14:31 2013 Kouhei Sutou <kou@cozmixng.org>
-Mon Jun 13 23:33:31 2011 Nobuyoshi Nakada <nobu@ruby-lang.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.
- * ext/io/console/console.c (console_dev): console should be
- unbuffered.
+Fri Jul 26 23:05:27 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * ext/io/console/console.c (console_dev): take care of no-ctty
- case.
+ * parse.y (parser_yylex): separate numeric literal from succeeding
+ token, and treat 'e' as floating point number only if followed by
+ exponent part.
-Mon Jun 13 23:06:12 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+Fri Jul 26 22:14:10 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * thread_pthread.c: rewrite GVL completely. This fix improve some
- benchmark dramatically (e.g. vm3_thread_mutex result changed
- form 120.601sec to 3.426sec).
- * thread_win32.c: ditto.
- * thread_pthread.h: ditto.
- * vm_core.h: ditto.
- * thread.c: ditto.
+ * vm_exec.h (CHECK_VM_STACK_OVERFLOW_FOR_INSN): surround with
+ do/while (0), and remove unnecessary casts.
-Mon Jun 13 23:11:52 2011 Tanaka Akira <akr@fsij.org>
+Fri Jul 26 20:12:07 2013 Akinori MUSHA <knu@iDaemons.org>
- * test/socket/test_unix.rb: don't use Thread.abort_on_exception.
+ * 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
-Mon Jun 13 23:05:01 2011 Tanaka Akira <akr@fsij.org>
+Fri Jul 26 19:25:17 2013 Koichi Sasada <ko1@atdot.net>
- * ext/socket/unixsocket.c (unix_send_io): race condition fixed.
- (unix_recv_io): ditto.
- fixed by Eric Wong. [ruby-core:35574]
+ * 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).
- * test/socket/test_unix.rb: test added for above problem.
+Fri Jul 26 18:30:14 2013 Koichi Sasada <ko1@atdot.net>
-Mon Jun 13 21:41:05 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * array.c (ary_memcpy): cast to int to suppress a warning.
- * thread_win32.c (native_cond_signal): remove unnecessary rb_bug().
- It's additional fix for r32021. [Bug #4696]
+Fri Jul 26 18:21:58 2013 Koichi Sasada <ko1@atdot.net>
-Mon Jun 13 20:50:49 2011 Martin Bosslet <Martin.Bosslet@googlemail.com>
+ * 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.
- * test/openssl/test_ec.rb
- test/openssl/test_pkey_ec.rb: merge both files into test_pkey_ec.rb.
- Removed redundant group instantiation from PKey tests.
- * test/openssl/utils.rb: only create TEST_PKEY_EC_P256V1 if EC is
- defined.
+Fri Jul 26 17:49:26 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Mon Jun 13 20:28:24 2011 Martin Bosslet <Martin.Bosslet@googlemail.com>
+ * win32/file.c (fix_string_encoding): fix target encoding. the
+ parameter `encoding' is not the target encoding but the original
+ encoding.
- * test/openssl/digest.rb: remove MDC2 from test, it is not available
- by default in an OpenSSL installation.
+Fri Jul 26 14:05:19 2013 Zachary Scott <e@zzak.io>
-Mon Jun 13 20:18:55 2011 Koichi Sasada <ko1@atdot.net>
+ * ext/fiddle/*: [DOC] More doc on dlopen and RTLD_DEFAULT from r42184
- * vm_core.h, vm_insnhelper.h: move decl. of
- ruby_vm_global_state_version and related macros
- from vm_core.h to vm_insnhelper.h.
+Fri Jul 26 13:08:53 2013 Zachary Scott <e@zzak.io>
- * vm.c (vm_clear_all_cache): added. This function is called
- when ruby_vm_global_state_version overflows.
- TODO: vm_clear_all_inline_method_cache() is only place holder.
- We need to implement it ASAP.
+ * ext/fiddle/lib/fiddle.rb: [DOC] Document Fiddle.dlopen(nil)
+ * ext/fiddle/handle.c: [DOC] Document Fiddle::Handle.new(nil)
- * vm_method.c (vm_clear_global_method_cache): added.
+Fri Jul 26 13:04:15 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Mon Jun 13 19:46:21 2011 Keiju Ishitsuka <keiju@ishitsuka.com>
+ * load.c (rb_load_internal): use rb_load_file_str() to keep path
+ encoding.
- * lib/cmath.rb: add new method Object#real?. fix #3137
+ * load.c (rb_require_safe): search in OS path encoding for Windows.
-Mon Jun 13 18:52:00 2011 Kenta Murata <mrkn@mrkn.jp>
+ * ruby.c (rb_load_file_str): load file with keeping path encoding.
- * ext/bigdecimal/bigdecimal.c (is_kind_of_BigDecimal): new function to
- examine the whether the object is kind of BigDecimal.
+ * win32/file.c (rb_file_load_ok): use WCHAR type API assuming incoming
+ path is encoded in UTF-8. [ruby-core:56136] [Bug #8676]
-Mon Jun 13 18:49:00 2011 Kenta Murata <mrkn@mrkn.jp>
+ * file.c (rb_str_encode_ospath): simplify using rb_str_conv_enc().
- * ext/bigdecimal/bigdecimal.c (BigDecimalCmp): use GetVpValueWithPrec
- for Float and Rational arguments.
+ * win32/file.c (fix_string_encoding): simplify with rb_str_conv_enc().
- * test/bigdecimal/test_bigdecimal.rb (test_new, test_cmp, test_power):
- add and modify tests for the above change.
+ * win32/file.c (convert_mb_to_wchar): use bare pointer instead of
+ VALUE, and remove useless argument.
- * ext/bigdecimal/bigdecimal.c (BigDecimalCmp): modify coding style to
- match ruby's standard.
+Fri Jul 26 11:42:07 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Mon Jun 13 18:33:04 2011 Tanaka Akira <akr@fsij.org>
+ * rational.c (f_round_common): Rational is expected to be returned by
+ Rational#*, but mathn.rb breaks that assumption. [ruby-core:56177]
+ [Bug #8687]
- * lib/securerandom.rb (SecureRandom.random_bytes): modify PRNG state
- to prevent random number sequence repetition at forked child
- process which has same pid.
- reported by Eric Wong. [ruby-core:35765]
+Fri Jul 26 01:37:45 2013 NARUSE, Yui <naruse@ruby-lang.org>
-Mon Jun 13 17:02:34 2011 NARUSE, Yui <naruse@ruby-lang.org>
+ * include/ruby/ruby.h: check defined(USE_RGENGC_LOGGING_WB_UNPROTECT)
- * lib/net/http.rb (Net::HTTP#use_ssl?): require 'openssl' only when
- https is needed. fixes r31933.
+Fri Jul 26 01:21:41 2013 NARUSE, Yui <naruse@ruby-lang.org>
-Mon Jun 13 14:35:00 2011 Kenta Murata <mrkn@mrkn.jp>
+ * file.c (rb_file_expand_path_internal): fix r42160; skip '~'.
- * lib/cmath.rb (CMath.cbrt): returns the principal value of the cube
- root of the argument. fix #3676
+Thu Jul 25 17:53:18 2013 NARUSE, Yui <naruse@ruby-lang.org>
- * test/test_cmath.rb (test_cbrt_returns_principal_value_of_cube_root):
- test for the above change.
+ * lib/net/http.rb (Net::HTTP#connect): disable Nagle's algorithm on
+ HTTP connection. [ruby-core:56158] [Feature #8681]
-Mon Jun 13 14:17:00 2011 Kenta Murata <mrkn@mrkn.jp>
+Thu Jul 25 17:49:42 2013 NARUSE, Yui <naruse@ruby-lang.org>
- * lib/test/unit.rb (Test::Unit::GlobOption#non_options): fix typo.
+ * re.c (rb_reg_to_s): convert closing parenthesis to the target encoding
+ if it is ASCII incompatible encoding. [ruby-core:56063] [Bug #8650]
-Mon Jun 13 13:04:20 2011 Martin Bosslet <Martin.Bosslet@googlemail.com>
+Thu Jul 25 17:21:21 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * ext/openssl/ossl_digest.c: fix error for digests that have no oid
- (e.g. DSS1).
- * test/openssl/test_digest.c: add tests for this.
+ * 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.
-Mon Jun 13 12:51:51 2011 NARUSE, Yui <naruse@ruby-lang.org>
+Thu Jul 25 17:17:52 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * lib/yaml.rb: load psych only when syck is not loaded.
+ * file.c (rb_file_expand_path_internal): should clear coderange after
+ copying user name as binary data.
-Mon Jun 13 12:23:39 2011 NARUSE, Yui <naruse@ruby-lang.org>
+Thu Jul 25 16:17:55 2013 Koichi Sasada <ko1@atdot.net>
-Mon Jun 13 12:23:39 2011 NARUSE, Yui <naruse@ruby-lang.org>
+ * encoding.c (check_encoding): Check T_DATA or not.
+ is_data_encoding(obj) assumes that `obj' is T_DATA.
- * ext/psych/lib/psych/deprecated.rb (Object#to_yaml_properties):
- undef to_yaml_properties before redefine it.
+Thu Jul 25 13:06:46 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * ext/syck/lib/syck/rubytypes.rb: ditto.
+ * dir.c (dir_s_home): use rb_home_dir_of and rb_default_home_dir.
-Mon Jun 13 11:30:10 2011 Martin Bosslet <Martin.Bosslet@googlemail.com>
+ * 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.
- * ext/openssl/ossl_digest.c: allow Digests to be created by sn, ln or
- oid.
- * test/openssl/test_digest.rb: add tests for this.
- [Ruby 1.9 - Feature #4412] [ruby-core:35319]
+ * file.c (rb_default_home_dir): split from rb_home_dir() for the home
+ directry of the current user.
-Mon Jun 13 10:54:03 2011 Martin Bosslet <Martin.Bosslet@googlemail.com>
+Thu Jul 25 12:32:11 2013 Koichi Sasada <ko1@atdot.net>
- * ext/openssl/pkey_dh.c: corrected documentation.
- * test/openssl/utils.rb: add test key for DH.
- * test/openssl/test_pkey_dh.rb: add tests.
+ * ext/openssl/ossl.c: support additional three thread synchronization
+ functions. [ruby-trunk - Bug #8386]
-Mon Jun 13 10:13:08 2011 Martin Bosslet <Martin.Bosslet@googlemail.com>
+Thu Jul 25 07:15:58 2013 Eric Hodel <drbrain@segment7.net>
- * ext/openssl/pkey_dh.c: clarify difference between DH#public_key and
- DH#pub_key in documentation.
+ * lib/rubygems: Import RubyGems from master as of commit 4ff70cc
+ * test/rubygems: ditto.
-Mon Jun 13 05:50:43 2011 Martin Bosslet <Martin.Bosslet@googlemail.com>
+Wed Jul 24 20:57:44 2013 Koichi Sasada <ko1@atdot.net>
- * NEWS: introduce PKey.read.
+ * compile.c (iseq_set_arguments): use RARRAY_RAWPTR() instead of
+ RARRAY_PTR() because there is no new reference.
-Mon Jun 13 05:17:29 2011 Martin Bosslet <Martin.Bosslet@googlemail.com>
+ * compile.c (iseq_set_exception_table): ditto.
- * ext/openssl/ossl_pkey.c: added PKey.read module function that allows
- reading arbitrary public/private keys from DER-/PEM-encoded File or
- string instances.
- * ext/openssl/ossl_pkey_dh.c: improved documentation.
- * test/openssl/utils.rb: added EC test key.
- * test/openssl/test_pkey_rsa.rb
- test/openssl/test_pkey_dsa.rb: Test PKey.read. Reuse keys from
- OpenSSL::TestUtils.
- * test/openssl/test_pkey_ec.rb: Created test file for EC tests.
- Test PKey.read.
- [Ruby 1.9 - Feature #4424] [ruby-core:35330]
+Wed Jul 24 19:49:54 2013 NARUSE, Yui <naruse@ruby-lang.org>
-Mon Jun 13 04:42:24 2011 Koichi Sasada <ko1@atdot.net>
+ * lib/uri/generic.rb (find_proxy): raise BadURIError if the URI is
+ a relative URI. [Bug #8645]
- * ext/objspace/objspace.c (total_i): fix to skip no ruby objects.
+Wed Jul 24 18:56:06 2013 Koichi Sasada <ko1@atdot.net>
-Mon Jun 13 03:07:38 2011 NARUSE, Yui <naruse@ruby-lang.org>
+ * vm_insnhelper.c (vm_expandarray): use RARRAY_RAWPTR() instead of
+ RARRAY_PTR() because there is no new reference.
- * test/benchmark/test_benchmark.rb (capture_output):
- replace '-' as space. On NetBSD, subtract between two Process.times
- after and before the short process may return negative value like:
- t0=Process.times; yield; t1=Process.times; p t1.utime-t0.utime
+ * vm_insnhelper.c (vm_caller_setup_args): ditto.
-Mon Jun 13 02:40:23 2011 Martin Bosslet <Martin.Bosslet@googlemail.com>
+ * vm_insnhelper.c (vm_yield_setup_block_args): ditto.
- * test/openssl/test_pkey_dsa.rb: Test for DSA#syssign/sysverify.
+Wed Jul 24 18:40:11 2013 Koichi Sasada <ko1@atdot.net>
-Mon Jun 13 01:59:19 2011 Martin Bosslet <Martin.Bosslet@googlemail.com>
+ * array.c, gc.c: move ary_unprotect_logging() into
+ rb_gc_unprotect_logging() which is general version
- * ext/openssl/ossl_pkey_dh.c: completed documentation.
- * ext/openssl/ossl_pkey_dsa.c: corrected examples. Improved parameter
- sections.
+ * include/ruby/ruby.h: add USE_RGENGC_LOGGING_WB_UNPROTECT
+ to enable.
-Mon Jun 13 00:25:10 2011 Martin Bosslet <Martin.Bosslet@googlemail.com>
+Wed Jul 24 17:37:50 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * ext/openssl/ossl_pkey_dsa.c: completed documentation.
+ * file.c (rb_file_expand_path_internal): preserve the file name
+ encoding in an exception message.
-Sun Jun 12 23:36:46 2011 Masatoshi SEKI <m_seki@mva.biglobe.ne.jp>
+Wed Jul 24 08:04:49 2013 Koichi Sasada <ko1@atdot.net>
- * lib/drb/drb.rb (kill_sub_thread): remove the method. [ruby-core:34185]
+ * test/-ext-/tracepoint/test_tracepoint.rb: add GC on/off to count
+ GC events strictly.
-Sun Jun 12 21:01:56 2011 Tadayoshi Funaba <tadf@dotrb.org>
+Tue Jul 23 23:19:24 2013 NARUSE, Yui <naruse@ruby-lang.org>
- * ext/date/date_core.c (d_lite_marshal_load): should give converted value.
+ * ext/openssl/extconf.rb (CRYPTO_THREADID): check exist or not.
-Sun Jun 12 20:36:30 2011 Tadayoshi Funaba <tadf@dotrb.org>
+ * 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/date/date_core.c: edited doc.
+ * 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
-Sun Jun 12 18:12:07 2011 Koichi Sasada <ko1@atdot.net>
+ * ext/openssl/ossl.c (ossl_threadid_func): defined for above.
- * benchmark/bm_vm3_clearmethodcache.rb: added.
+Tue Jul 23 20:47:36 2013 Tanaka Akira <akr@fsij.org>
-Sun Jun 12 17:40:29 2011 Koichi Sasada <ko1@atdot.net>
+ * bignum.c: Move functions.
- * vm_method.c (rb_clear_cache*): update only vm state version.
+Tue Jul 23 20:14:55 2013 Tanaka Akira <akr@fsij.org>
- * vm_method.c (rb_method_entry_get_without_cache, rb_method_entry):
- Fill method cache entry with vm state version, and
- check current vm state version for method (cache) look up.
- This modification speed-up invalidating of global method cache table.
- [Ruby 1.9 - Feature #3905] [ruby-core:36908]
+ * bignum.c (bary_divmod): Add special cases for x < y easily detected
+ and nx == 2 && ny == 2.
-Sun Jun 12 16:19:48 2011 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
+Tue Jul 23 19:48:38 2013 Koichi Sasada <ko1@atdot.net>
- * ext/tk/extconf.rb: fail on Mac OS X. [Bug #4853][ruby-dev:43655]
+ * thread_(pthread|win32).h: rename rb_thread_cond_t to
+ rb_nativethread_cond_t.
-Sun Jun 12 15:56:08 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * thread.c, thread_pthread.c, thread_win32.c, vm_core.h: catch up
+ renaming.
- * thread.c: remove th->transition_for_lock. It's thread unsafe.
- [Bug #4723][ruby-dev:43563]
+Tue Jul 23 19:44:32 2013 Koichi Sasada <ko1@atdot.net>
-Sun Jun 12 15:47:35 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * thread_native.h: add rb_nativethread_self() which returns
+ current running native thread identifier.
- * thread.c: introduce spurious wakeup safe deadlock check.
- [Bug #4696][ruby-dev:43554]
+ * thread_[pthread|win32].c: implement rb_nativethread_self().
-Sun Jun 12 13:33:52 2011 Koichi Sasada <ko1@atdot.net>
+Tue Jul 23 19:34:11 2013 Koichi Sasada <ko1@atdot.net>
- * benchmark/bm_vm3_thread_mutex.rb: remove it.
+ * thread_pthread.h, thread_win32.h: rename rb_thread_id_t to
+ rb_nativethread_id_t.
- * benchmark/bm_vm3_thread_mutex[1-3].rb: added 3 benchmarks.
- 1: one thread with one mutex (no contention).
- 2: two threads with one mutex (contention).
- 3: 1000 threads with one mutex (huge number of contention)
- Above removed benchmark was type 3.
- Therefore, this commit adds type 1 and 2 benchmark.
+ * thread_pthread.c, vm_core.h: use rb_nativethread_id_t.
-Sun Jun 12 11:16:59 2011 Tanaka Akira <akr@fsij.org>
+Tue Jul 23 18:56:11 2013 Koichi Sasada <ko1@atdot.net>
- * io.c: use select() appropriately for sendfile().
- Fixed by Eric Wong. [ruby-core:36150]
- (maygvl_copy_stream_wait_readwrite): removed.
- (nogvl_copy_stream_sendfile): use nogvl_copy_stream_wait_write and
- maygvl_copy_stream_wait_read instead of
- maygvl_copy_stream_wait_readwrite.
+ * 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.
-Sun Jun 12 09:32:13 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Tue Jul 23 18:44:15 2013 Koichi Sasada <ko1@atdot.net>
- * atomic.h (ATOMIC_OR): _InterlockedOr is not available on mingw.h
- * gc.c (rb_gc_set_params): VM_OBJSPACE is disabled on mingw.
+ * thread_native.h: added.
+ Move native thread related lines from vm_core.h.
+ And declare several functions "rb_nativethread_lock_*",
+ manipulate locking.
-Sun Jun 12 01:07:09 2011 Tadayoshi Funaba <tadf@dotrb.org>
+ * common.mk: add thread_native.h.
- * ext/date/date_core.c: edited doc.
+ * thread.c: add functions "rb_nativethread_lock_*".
-Sat Jun 11 23:18:00 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * 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.
- * vm_core.h (RUBY_VM_SET_TIMER_INTERRUPT, RUBY_VM_SET_INTERRUPT,
- RUBY_VM_SET_FINALIZER_INTERRUPT): use atomic ops for preventing
- interrupt_flag bit lost. [Bug #4770][ruby-dev:43467]
- * thread.c (rb_threadptr_execute_interrupts_rec): ditto.
- * vm_core.h (typedef struct rb_thread_struct): change type of
- interrupt_flag to rb_atomic_t.
- * atomic.h: move atomic ops definition from signal.c.
- * signal.c: remove atomic ops definition.
- * common.mk (gc, signal, thread, cont): add to dependency to atomic.h.
+Tue Jul 23 16:14:57 2013 Koichi Sasada <ko1@atdot.net>
-Sat Jun 11 23:23:52 2011 Tadayoshi Funaba <tadf@dotrb.org>
+ * gc.c (gc_before_sweep): fix spacing.
- * ext/date/date_core.c: edited doc.
+Tue Jul 23 15:57:11 2013 Koichi Sasada <ko1@atdot.net>
-Sat Jun 11 23:02:36 2011 Hiroshi Nakamura <nahi@ruby-lang.org>
+ * gc.c (heap_get_freeobj): clear slot->freelist here.
+ This means that this slot doesn't have any free objects.
+ And store this slot with objspace->heap.using_slot.
- * ext/openssl/lib/openssl/buffering.rb (module OpenSSL):
- Buffering#each_byte should return String in accordance with IO in
- 1.9.
+ * 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.
- * test/openssl/test_buffering.rb (class OpenSSL): add tests for getc
- and each_byte.
+ * gc.c (gc_slot_sweep): do not need to clear slot->freelist.
-Sat Jun 11 22:41:37 2011 Tadayoshi Funaba <tadf@dotrb.org>
+Tue Jul 23 09:34:49 2013 Zachary Scott <e@zzak.io>
- * time.c: a correction of doc for strftime (%v).
+ * sample/drb/README*.rdoc: [DOC] migrate DRb sample READMEs to rdoc
-Sat Jun 11 22:30:53 2011 Tadayoshi Funaba <tadf@dotrb.org>
+Tue Jul 23 09:28:05 2013 Zachary Scott <e@zzak.io>
- * ext/date/date_core.c: replaced doc for strftime based on Time's one.
+ * lib/drb/invokemethod.rb: [DOC] nodoc InvokeMethod18Mixin
-Sat Jun 11 22:07:56 2011 Tadayoshi Funaba <tadf@dotrb.org>
+Tue Jul 23 08:44:37 2013 Eric Hodel <drbrain@segment7.net>
- * ext/date/date_core.c (datetime_s_{iso8601,rfc3339,xmlschema,rfc2822,httpdate}):
- do not take argument comp.
+ * 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.
-Sat Jun 11 21:58:31 2011 Tadayoshi Funaba <tadf@dotrb.org>
+Tue Jul 23 08:11:32 2013 Zachary Scott <e@zzak.io>
- * ext/date/date_core.c: added examples.
+ * lib/rexml/streamlistener.rb: [DOC] Fix examples in
+ REXML::StreamListener#entitydecl patch by Ippei Obayashi [Bug #8665]
-Sat Jun 11 19:40:45 2011 Narihiro Nakamura <authornari@gmail.com>
+Tue Jul 23 07:44:59 2013 Eric Hodel <drbrain@segment7.net>
- * gc.c: expand heap if initial_heap_min_slots is bigger than
- HEAP_MIN_SLOTS.
+ * lib/rubygems: Import RubyGems from master as of commit b165260
+ * test/rubygems: ditto.
-Sat Jun 11 19:42:50 2011 WATANABE Hirofumi <eban@ruby-lang.org>
+Tue Jul 23 07:14:31 2013 Tanaka Akira <akr@fsij.org>
- * ChangeLog (vim): set shiftwidth to 2.
+ * bignum.c (bary_mulsub_1xN): New function.
+ (bary_mul_toom3): Use bary_mulsub_1xN.
-Sat Jun 11 19:27:06 2011 Hiroshi Nakamura <nahi@ruby-lang.org>
+Tue Jul 23 03:32:23 2013 Tanaka Akira <akr@fsij.org>
- * ext/openssl/ossl_x509req.c: raise RequestError instead of
- CertificateError when Request#to_der gets an error from OpenSSL.
- Patch from Ippei Obayashi, see #4420. I cannot write a test for
- this... Request does not allow to create broken bytes...
+ * 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.
-Sat Jun 11 19:34:51 2011 Tadayoshi Funaba <tadf@dotrb.org>
+Tue Jul 23 01:34:45 2013 Tanaka Akira <akr@fsij.org>
- * ext/date/date_core.c (Date::(ABBR_)?(MONTH|DAY)NAMES): should be usascii.
+ * bignum.c (bigdivrem_mulsub): Extracted from bigdivrem1.
+ (bigdivrem1): Use bary_add.
-Sat Jun 11 19:24:33 2011 Tadayoshi Funaba <tadf@dotrb.org>
+Mon Jul 22 18:39:52 2013 Masaki Matsushita <glass.saga@gmail.com>
- * ext/date/date_core.c: rewrote doc.
+ * string.c (rb_str_enumerate_chars): specify array capa
+ with str_strlen().
-Sat Jun 11 19:04:15 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * string.c (rb_str_enumerate_codepoints): ditto.
- * lib/test/unit.rb (Test::Unit::GlobOption#non_options): should run
- with 1.8.
+Mon Jul 22 18:01:33 2013 Masaki Matsushita <glass.saga@gmail.com>
-Sat Jun 11 18:05:57 2011 WATANABE Hirofumi <eban@ruby-lang.org>
+ * string.c (rb_str_enumerate_chars): specify array capa.
- * bootstraptest/runner.rb: should initialize $stress to avoid warnings.
+Mon Jul 22 17:24:14 2013 Masaki Matsushita <glass.saga@gmail.com>
-Sat Jun 11 18:02:09 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * string.c (rb_str_each_char_size): performance improvement by
+ using rb_str_length().
- * io.c (io_getc): should be 7bit if ascii. fixes #4557
+Mon Jul 22 16:32:48 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Sat Jun 11 16:52:16 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * vm_eval.c (eval_string_with_cref): check by Check_TypedStruct
+ instead of rb_obj_is_kind_of.
- * numeric.c (rb_enc_uint_chr): fix message format. Bug#4869
+Mon Jul 22 13:19:22 2013 Koichi Sasada <ko1@atdot.net>
-Sat Jun 11 16:28:25 2011 Kouhei Sutou <kou@cozmixng.org>
+ * array.c (ary_resize_capa): use RARRAY_RAWPTR() because
+ this code creates no new references.
- * lib/rexml/formatters/pretty.rb
- (REXML::Formatters::Pretty#write_text),
- test/rexml/test_core.rb
- (Tester#test_pretty_format_long_text_finite): don't ignore
- 'width' parameter in pretty formatter. fixes #4498
- Reported by Michael Frasca. Thanks!!!
+Mon Jul 22 12:58:18 2013 Koichi Sasada <ko1@atdot.net>
-Sat Jun 11 16:11:36 2011 Kouhei Sutou <kou@cozmixng.org>
+ * array.c (ary_memfill): added.
- * test/rexml/test_core.rb
- (Tester#test_pretty_format_long_text_finite): remove needless
- assert_nothing_raised.
+ * array.c (rb_ary_initialize): use ary_memfill().
-Sat Jun 11 16:04:03 2011 Kouhei Sutou <kou@cozmixng.org>
+ * array.c (rb_ary_fill): ditto.
- * lib/rexml/parsers/xpathparser.rb
- (REXML::Parsers::XPathParser#parse),
- test/rexml/test_elements.rb
- (ElementsTester#test_each_with_frozen_condition):
- don't modify original XPath. fixes #4161
- Reported by Pavel Shved. Thanks!!!
+ * array.c (rb_ary_slice_bang): use RARRAY_RAWPTR() because
+ this code creates no new references.
-Sat Jun 11 15:53:27 2011 Kouhei Sutou <kou@cozmixng.org>
+Mon Jul 22 10:09:46 2013 Koichi Sasada <ko1@atdot.net>
- * test/rexml/test_elements.rb (ElementsTester): remove needless
- prefix from test name.
+ * gc.c (gc_slot_sweep): need to add empty RVALUE as freeobj.
-Sat Jun 11 15:36:36 2011 Martin Duerst <duerst@it.aoyama.ac.jp>
- * common.mk: fixed a grammatical error
+Mon Jul 22 09:48:31 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Sat Jun 11 14:20:16 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * 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].
- * vm.c (thread_memsize): don't ignore size of th->local_storage.
+Mon Jul 22 09:24:19 2013 Kouji Takao <kouji@takao7.net>
-Sat Jun 11 10:32:46 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * 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.
- * lib/mkmf.rb: should quote arch_hdrdir and libpath for the case
- installed prefix contains spaces.
+ Thanks, Nobuyoshi Nakada, for the patch.
-Sat Jun 11 10:20:52 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Mon Jul 22 03:15:54 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * thread_pthread.c (native_cond_timeout): wrap conditionally used
- label.
+ * ext/date/date_parse.c (rfc2822_cb): check if wday is given, since it
+ can be omitted.
- * thread_pthread.c (native_sleep): remove unused variable.
+Mon Jul 22 00:15:20 2013 Tanaka Akira <akr@fsij.org>
-Sat Jun 11 10:15:50 2011 Tanaka Akira <akr@fsij.org>
+ * bignum.c (bary_sq_fast): Refine expressions.
- * thread.c (rb_thread_execute_interrupts): use GetThreadPtr to extract
- rb_thread_t from VALUE.
- reported by Motohiro KOSAKI. [ruby-dev:43700]
+Sun Jul 21 21:08:59 2013 Tanaka Akira <akr@fsij.org>
-Sat Jun 11 10:00:49 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * bignum.c (bary_mul): Use simple multiplication if yl is small.
+ (rb_cstr_to_inum): Invoke bigsq instead of bigmul0.
+ (bigsq): Re-implemented.
+ (bigmul0): Invoke bigsq if two arguments are identical.
- * ruby.c (ruby_process_options): add missing return type.
+Sun Jul 21 09:58:19 2013 Tanaka Akira <akr@fsij.org>
-Fri Jun 10 23:18:09 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * 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.
- * ext/tk/tcltklib.c (lib_eventloop_core): replace CHECK_INTS with
- rb_thread_check_ints(). Because current code can't be compiled.
+Sun Jul 21 08:12:16 2013 Kazuki Tsujimoto <kazuki@callcc.net>
-Fri Jun 10 16:38:13 2011 NARUSE, Yui <naruse@ruby-lang.org>
+ * proc.c (proc_to_s): use PRIsVALUE to preserve the result encoding.
- * encoding.c (rb_locale_charmap): When ruby process is run as Windows
- Service the console codepage is not set, GetConsoleCP returns 0.
- So on such environment, use GetACP().
- http://blogs.msdn.com/b/michkap/archive/2005/02/08/369197.aspx
- patched by Rafal Bigaj [ruby-core:36832] [Bug #4854]
+Sun Jul 21 03:36:18 2013 NARUSE, Yui <naruse@ruby-lang.org>
-Fri Jun 10 14:34:24 2011 Koichi Sasada <ko1@atdot.net>
+ * hash.c (rb_hash_flatten): use NUM2INT to raise TypeError on 32bit
+ platform. it's introduced by r42039
- * common.mk: restore TESTRUN_SCRIPT to "$(srcdir)/test.rb".
- TESTRUN_SCRIPT is used by "make run", "make gdb" and so on.
+Sun Jul 21 01:07:45 2013 Benoit Daloze <eregontp@gmail.com>
-Fri Jun 10 13:01:24 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * 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]
- * test/ruby/test_module.rb (TestModule#remove_rake_mixins): remove all
- module related to Rake.
+Sat Jul 20 22:44:50 2013 Zachary Scott <e@zzak.io>
-Fri Jun 10 09:52:38 2011 Eric Hodel <drbrain@segment7.net>
+ * common.mk: Document running a single test [Fixes GH-363]
+ Patch by Avdi Grimm https://github.com/ruby/ruby/pull/363
- * encoding.c: Mention that Encoding.compatible? can work with more
- than just Strings.
+Sat Jul 20 22:39:56 2013 Zachary Scott <e@zzak.io>
-Fri Jun 10 02:25:53 2011 Aaron Patterson <aaron@tenderlovemaking.com>
+ * sample/*: whitespace patch by Sergio Campama [Fixes GH-364]
+ https://github.com/ruby/ruby/pull/364
- * ext/psych/lib/psych.rb: updating version to match released gem.
+Sat Jul 20 22:33:13 2013 Zachary Scott <e@zzak.io>
-Fri Jun 10 01:06:29 2011 Tadayoshi Funaba <tadf@dotrb.org>
+ * doc/regexp.rdoc: [DOC] Fix typo in example [Fixes GH-365]
+ Patch by Juanito Fatas https://github.com/ruby/ruby/pull/365
- * ext/bigdecimal (BigDecimal_to_i): Integer#** may return flonum.
+Sat Jul 20 17:46:03 2013 NARUSE, Yui <naruse@ruby-lang.org>
-Fri Jun 10 00:35:12 2011 Tadayoshi Funaba <tadf@dotrb.org>
+ * string.c (rb_str_succ): add missing case NEIGHBOR_WRAPPED.
+ r42078 caused buggy behavior like "\xFF".b -> "\x01\xFF".b
- * complex.c (string_to_c_internal): uses rb_reg_nth_match;
- * rational.c (string_to_r_internal): ditto.
+Sat Jul 20 15:22:38 2013 Koichi Sasada <ko1@atdot.net>
-Fri Jun 10 00:25:03 2011 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
+ * array.c (rb_ary_resize): use simple memcpy because there are no new
+ references.
- * gc.c: remove an unused declaration.
+Sat Jul 20 15:02:51 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Fri Jun 10 00:24:04 2011 Tadayoshi Funaba <tadf@dotrb.org>
+ * safe.c (ruby_safe_level_4_warning): define for old extension
+ libraries. [Bug #8652]
- * rational.c (string_to_r): Rational#** may return flonum.
+Sat Jul 20 14:38:00 2013 Koichi Sasada <ko1@atdot.net>
-Thu Jun 9 23:57:53 2011 Tanaka Akira <akr@fsij.org>
+ * 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.
- * io.c: fix IO.copy_stream interrupt handling.
- based on the patch by Eric Wong. [ruby-core:36156]
+Sat Jul 20 12:14:07 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * vm_core.h (rb_thread_call_with_gvl): don't declare here.
+ * string.c (enc_succ_char, enc_pred_char): consider wchar case.
+ [ruby-core:56071] [Bug #8653]
- * thread.c: include internal.h.
- (rb_thread_execute_interrupts): new function.
+ * string.c (rb_str_succ): do not replace with invalid char.
- * internal.h (rb_thread_execute_interrupts): declared.
- (rb_thread_call_with_gvl): declared.
+ * 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.
-Thu Jun 9 23:34:01 2011 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
+ * include/ruby/encoding.h (rb_enc_code_to_mbclen): declaration and
+ shortcut macro.
- * gc.c (rb_objspace_call_finalizer): use rb_typeddata_is_kind_of() for
- type check to get rid of a double free when main Thread has singleton
- class. [ruby-core:36741] [Bug #4828]
- * thread.c (rb_obj_is_mutex): add a new utility function.
- * vm.c (rb_obj_is_thread): ditto.
+Fri Jul 19 21:59:12 2013 Koichi Sasada <ko1@atdot.net>
-Thu Jun 9 22:53:49 2011 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
+ * gc.c: declare type_name() at the beginning of file.
- * test/ruby/test_thread.rb (TestThread#test_kill_thread_subclass):
- add test for Thread.kill with Thread subclass instance.
+Fri Jul 19 21:35:09 2013 Koichi Sasada <ko1@atdot.net>
-Thu Jun 9 22:31:47 2011 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
+ * array.c: reduce shady operations.
- * test/ruby/test_thread.rb (TestThread#test_kill_wrong_argument):
- test for [ruby-core:35086].
- partially forward porting r31402 from ruby_1_9_2 branch.
+ * 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().
-Thu Jun 9 18:36:00 2011 Kenta Murata <mrkn@mrkn.jp>
+ * array.c (rb_ary_shift): use RARRAY_PTR_USE() without WB because
+ there are not new relations.
- * string.c: Fix the ambiguous description of the behavior of
- rb_str_aref_m with a range. It returns nil when the beginning of
- the range is greater than the end of the string rather than the range.
+ * array.c (ary_ensure_room_for_unshift): ditto.
-Thu Jun 9 10:57:03 2011 Aaron Patterson <aaron@tenderlovemaking.com>
+ * array.c (rb_ary_sort_bang): ditto.
- * ext/psych/lib/psych/visitors/to_ruby.rb: Hash subclasses can be read
- from YAML files.
- * ext/psych/lib/psych/visitors/yaml_tree.rb: Hash subclasses can be
- dumped to YAML files.
- * test/psych/test_hash.rb: corresponding test.
+ * array.c (rb_ary_delete_at): ditto.
-Thu Jun 9 09:18:51 2011 Aaron Patterson <aaron@tenderlovemaking.com>
+ * array.c (rb_ary_reverse_m): use RARRAY_RAWPTR() because
+ there are not new relations.
- * ext/psych/lib/psych/visitors/to_ruby.rb: Ruby modules can be loaded
- from YAML files.
- * ext/psych/lib/psych/visitors/yaml_tree.rb: Ruby modules can be
- dumped to YAML files.
- * test/psych/test_class.rb: corresponding test.
+Fri Jul 19 20:58:20 2013 Koichi Sasada <ko1@atdot.net>
-Thu Jun 9 09:05:04 2011 Aaron Patterson <aaron@tenderlovemaking.com>
+ * array.c: reduce shade operations.
- * ext/psych/lib/psych/visitors/to_ruby.rb: Ruby classes can be loaded
- from YAML files.
- * ext/psych/lib/psych/visitors/yaml_tree.rb: Ruby classes can be
- dumped to YAML files.
- * test/psych/test_class.rb: corresponding test.
+ * array.c (rb_ary_modify): use RARRAY_RAWPTR().
-Wed Jun 8 21:38:57 2011 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
+ * 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().
- * cont.c (root_fiber_alloc): set root fiber's status RUNNING.
- in cont_mark() only RUNNING fiber's machine stack is marked.
- root fiber's status should be RUNNING at the beginning regardless of
- FIBER_USE_NATIVE. [ruby-core:36735] fixes #4827
+Fri Jul 19 19:55:28 2013 Koichi Sasada <ko1@atdot.net>
-Tue Jun 7 20:50:11 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * array.c (ary_mem_clear): added. This operation doesn't need WB
+ because this operation creates a reference to Qnil.
- * doc/irb/irb.rd: fix typo. patch by Nobuhiro IMAI.
- [Bug #4843] [ruby-dev:43639]
- * doc/irb/irb.rd.ja: ditto.
- * doc/ChangeLog-YARV: ditto.
+ * 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().
-Tue Jun 7 18:52:55 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+ * array.c (ary_make_shared): use RARRAY_RAWPTR() instead of RARRAY_PTR().
- * lib/rubygems/user_interaction.rb (Gem::StreamUI#tty?): IO#tty? of
- Windows has been fixed at r29969.
+Fri Jul 19 19:18:51 2013 Koichi Sasada <ko1@atdot.net>
- * test/rubygems/test_gem_stream_ui.rb: now can run tests.
+ * array.c: fix commit miss.
+ RGENGC_UNPROTECT_LOGGING should be 0.
-Tue Jun 7 18:36:41 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+Fri Jul 19 19:15:30 2013 Koichi Sasada <ko1@atdot.net>
- * test/rubygems/test_gem.rb (TestGem#{test_self_user_home_userprofile,
- test_self_user_home_user_drive_and_path}): should simply ignore
- meaningless tests instead of skipping them.
+ * array.c (rb_ary_resurrect): use RARRAY_RAWPTR() because there is no
+ writing.
-Tue Jun 7 18:15:00 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+ * array.c (rb_ary_new_from_values): use ary_memcpy().
- * test/ruby/test_rubyoptions.rb (TestRubyOptions#test_set_program_name):
- should show some messages when skipping tests.
+Fri Jul 19 19:07:31 2013 Koichi Sasada <ko1@atdot.net>
-Tue Jun 7 13:59:47 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * array.c (ary_memcpy): add a function to copy VALUEs into ary
+ with write barrier. If ary is promoted, use write barrier correctly.
- * ext/date/date_core.c (date_s_today, datetime_s_now): check the
- result of localtime_r().
+ * 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().
-Tue Jun 7 13:36:51 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Fri Jul 19 15:32:57 2013 Koichi Sasada <ko1@atdot.net>
- * ext/tk/extconf.rb: use $defs not $CPPFLAGS to get rid of
- command line escape issues on Windows. fixed #4835.
+ * array.c (rb_ary_store): use RARRAY_PTR_USE() instead of RARRAY_PTR().
+ Clearing memory space doesn't need WBs.
-Tue Jun 7 03:18:45 2011 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
+Fri Jul 19 15:19:37 2013 Koichi Sasada <ko1@atdot.net>
- * test/ruby/test_io.rb (TestIO#test_s_{,bin}write): do not create a
- file under /tmp. [Bug #4846]
+ * array.c (ary_ensure_room_for_push): use RARRAY_RAWPTR() instead of
+ RARRAY_PTR. In this code, there are no "write" operation.
-Mon Jun 6 22:51:43 2011 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
+ * array.c (rb_ary_equal): ditto.
- * cont.c: use #if FIBER_USE_NATIVE instead of #ifdef.
- you can suppress use of setcontext for Fiber with compile option
- -DFIBER_USE_NATIVE=0
+ * array.c (recursive_equal): ditto.
-Mon Jun 6 21:59:23 2011 Tadayoshi Funaba <tadf@dotrb.org>
+Fri Jul 19 15:09:22 2013 Koichi Sasada <ko1@atdot.net>
- * test/date/test_switch_hitter.rb: added a test.
+ * 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).
-Mon Jun 6 21:37:45 2011 Tadayoshi Funaba <tadf@dotrb.org>
+Fri Jul 19 14:56:00 2013 Koichi Sasada <ko1@atdot.net>
- * ext/date/date_core.c: added notes.
+ * array.c (ary_unprotect_logging): use (void *) for first parameter
+ because VALUE is not defined before including ruby/ruby.h.
-Mon Jun 6 21:02:12 2011 Tadayoshi Funaba <tadf@dotrb.org>
+Fri Jul 19 14:19:48 2013 Kazuki Tsujimoto <kazuki@callcc.net>
- * ext/date/date_core.c: flattened format to strftimev.
- * ext/date/date_core.c (date_strftime_internal): taints run.
+ * ext/pathname/pathname.c (path_inspect): use PRIsVALUE to preserve
+ the result encoding.
-Mon Jun 6 15:10:17 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+Fri Jul 19 12:35:41 2013 Tanaka Akira <akr@fsij.org>
- * include/ruby/{defines,missing}.h (rb_infinity, rb_nan): move from
- defines.h to missing.h. (couldn't use RUBY_EXTERN there.)
+ * test/socket/test_tcp.rb (test_initialize_failure): Use EADDRNOTAVAIL
+ to test an error message generated by bind() failure.
-Mon Jun 6 14:35:48 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+Fri Jul 19 11:27:38 2013 Zachary Scott <e@zzak.io>
- * test/rdoc/test_rdoc_markup_pre_process.rb (TestRDocMarkupPreProcess#
- {test_include_file,test_include_file_encoding_incompatible}): no
- need to write such workaround. don't hide the bug of ruby. (and the
- bug is already fixed.)
+ * lib/racc/parser.rb: [DOC] Capitalize "Ruby" in documentation
+ Patch by Dave Worth https://github.com/ruby/ruby/pull/341
-Mon Jun 6 14:11:11 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+Fri Jul 19 11:26:28 2013 Zachary Scott <e@zzak.io>
- * ext/date/date_core.c (valid_jd_sub): need to convert from VALUE to
- double.
+ * ext/psych/lib/psych*: [DOC] Capitalize "Ruby" in documentation
+ Patch by Dave Worth https://github.com/ruby/ruby/pull/341
- * ext/date/date_core.c (offset_to_sec): get rid of a compiler warning.
+Fri Jul 19 11:25:12 2013 Zachary Scott <e@zzak.io>
-Mon Jun 6 14:09:08 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+ * lib/rdoc/*: [DOC] Capitalize "Ruby" in documentation
+ Patch by Dave Worth https://github.com/ruby/ruby/pull/341
- * include/ruby/defines.h (rb_infinity, rb_nan): export for Windows.
+Fri Jul 19 11:23:55 2013 Zachary Scott <e@zzak.io>
-Mon Jun 6 10:54:45 2011 Shota Fukumori <sorah@tubusu.net>
+ * lib/rubygems*: [DOC] Capitalize "Ruby" in documentation
+ Patch by Dave Worth https://github.com/ruby/ruby/pull/341
- * lib/test/unit.rb(Test::Unit::Runner#puke):
- Add overriding from MiniTest::Unit#puke. This reverts minitest's fix
- that skip messages are hidden when not verbose mode (-v option).
- To hide skip messages, use --hide-skip option instead.
+Fri Jul 19 11:16:54 2013 Akinori MUSHA <knu@iDaemons.org>
-Mon Jun 6 10:52:13 2011 NARUSE, Yui <naruse@ruby-lang.org>
+ * lib/set.rb (Set#to_set): Define Set#to_set so that aSet.to_set
+ returns self. [Fixes GH-359]
- * lib/net/http.rb: don't use autoload.
+Fri Jul 19 11:10:23 2013 Zachary Scott <e@zzak.io>
-Mon Jun 6 09:39:43 2011 Aaron Patterson <aaron@tenderlovemaking.com>
+ * lib/rake/*: [DOC] Capitalize "Ruby" in documentation
+ Patch by Dave Worth https://github.com/ruby/ruby/pull/341
- * ext/psych/parser.c (parse): release event objects to plug memory
- leak. Thanks Mark J. Titorenko!
+Fri Jul 19 01:04:14 2013 Tanaka Akira <akr@fsij.org>
-Sun Jun 5 23:26:15 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * ext/-test-/bignum/intpack.c: Renamed from ext/-test-/bignum/pack.c.
+ (Init_intpack): Renamed from Init_pack.
+ Reported by Naohisa Goto. [ruby-dev:47526] [Bug #8655]
- * eval.c: remove rb_thread_stop_timer_thread function declaration.
- Instead, include vm_core.h.
- * process.c: ditto.
+Fri Jul 19 00:54:27 2013 Benoit Daloze <eregontp@gmail.com>
-Sun Jun 5 21:38:51 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * test/ruby/test_array.rb (test_count): add a test case for #count
+ with an argument. See Bug #8654.
- * thread_pthread.c (thread_timer): add to care a spurious wakeup.
- When native_cond_timedwait() return 0 by spurious wakeup, we
- don't have to neither 1) call timer_thread_function and 2)
- exit the timer thread.
+Thu Jul 18 23:45:06 2013 Masaki Matsushita <glass.saga@gmail.com>
-Sun Jun 5 17:50:01 2011 Tadayoshi Funaba <tadf@dotrb.org>
+ * array.c (rb_ary_eql): compare RARRAY_PTR() for performance
+ improvement in case of that self and other are shared.
- * ext/date/date_core.c (m_real_cwyear): new. derived from m_cwyear.
- * ext/date/date_strftime.c: trivial changes.
+Thu Jul 18 22:46:42 2013 Zachary Scott <e@zzak.io>
-Sun Jun 5 17:22:01 2011 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
+ * 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
- * ext/tk/config_list.in: add new options for tcltklib.
+Thu Jul 18 21:30:50 2013 Tanaka Akira <akr@fsij.org>
-Sun Jun 5 10:06:50 2011 Tadayoshi Funaba <tadf@dotrb.org>
+ * bignum.c (bary_sq_fast): Specialize the last iteration of the
+ outer loop.
+ (bigfixize): A condition simplified.
- * ext/date/date_tmx.h: now does not place decoded data. allows to
- access indirectly via functions on demand.
- * ext/date/date_strftime.c: ditto.
- * ext/date/date_core.c: ditto.
- * ext/date/date_core.c ({d|dt}_lite_to_s): use strftime.
+Thu Jul 18 21:15:41 2013 Masaki Matsushita <glass.saga@gmail.com>
-Sun Jun 5 06:22:02 2011 Tadayoshi Funaba <tadf@dotrb.org>
+ * array.c (rb_ary_equal): compare RARRAY_PTR() for performance
+ improvement in case of that self and other are shared.
- * NEWS: wrote about changes of date.
+Thu Jul 18 20:44:51 2013 Masaki Matsushita <glass.saga@gmail.com>
-Sat Jun 4 16:59:26 2011 Tadayoshi Funaba <tadf@dotrb.org>
+ * array.c (rb_ary_fill): use memfill().
- * ext/date/date_core.c (d_lite_inspect): changed the format.
- * ext/date/date_core.c: refactoring and fixing some bugs.
+Thu Jul 18 20:35:14 2013 Benoit Daloze <eregontp@gmail.com>
-Sat Jun 4 04:04:41 2011 NARUSE, Yui <naruse@ruby-lang.org>
+ * array.c (rb_ary_count): check length to avoid SEGV
+ while iterating. Remove other pointer loop when arg is given.
- * test/rubygems/test_gem_commands_which_command.rb:
- "missing" exists on ruby's top source directory. [Bug #4815]
+ * test/ruby/test_array.rb (test_count): add test for bug.
+ [ruby-core:56072] [Bug #8654]
-Fri Jun 3 21:48:12 2011 NARUSE, Yui <naruse@ruby-lang.org>
+Thu Jul 18 18:14:36 2013 Masaki Matsushita <glass.saga@gmail.com>
- * lib/rubygems/test_case.rb: Refix for test-all in separate directory.
- r31147 + r31151.
+ * array.c (rb_ary_count): iterate items appropriately.
+ [Bug #8654]
-Fri Jun 3 20:58:47 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+Thu Jul 18 17:35:41 2013 Masaki Matsushita <glass.saga@gmail.com>
- * ext/date/date_core.c (d_lite_plus): get rid of compiler warnings.
+ * hash.c (rb_hash_flatten): performance improvement by not using
+ rb_hash_to_a() to avoid array creation with rb_assoc_new().
-Fri Jun 3 20:56:40 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+Thu Jul 18 16:16:17 2013 Koichi Sasada <ko1@atdot.net>
- * include/ruby/missing.h, numeric.c (round): moved prototype of round()
- from numeric.c to missing.h. (note: round() is C99 feature, so ruby
- provides it if not exist in C runtime.)
+ * array.c: add logging feature for RGenGC's write barrier unprotect
+ event.
-Fri Jun 3 20:42:04 2011 Shota Fukumori <sorah@tubusu.net>
+Thu Jul 18 15:45:47 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * lib/test/unit/parallel.rb: Keep $stdin, $stdout before run testcase
- and restore after run. Because some test break $stdin, $stdout.
- Fixes [Bug #4433] [ruby-core:35353]
+ * 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]
-Fri Jun 3 19:58:14 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+Thu Jul 18 15:42:01 2013 Koichi Sasada <ko1@atdot.net>
- * io.c (io_fflush): windows -- call fsync() only when the FD is tied to
- file, because if the FD is pipe, it blocks.
+ * include/ruby/ruby.h: fix spell miss.
-Fri Jun 3 09:27:31 2011 NARUSE, Yui <naruse@ruby-lang.org>
+Thu Jul 18 15:11:11 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * lib/net/http.rb (URI::HTTP#request_uri): return nil when the uri
- is path-rootless form. Bug #4759
+ * include/ruby/ruby.h (ruby_safe_level_4): get rid of special
+ character. [ruby-dev:47512] [misc #8646]
-Thu Jun 2 23:51:03 2011 James Edward Gray II <jeg2@ruby-lang.org>
+Thu Jul 18 14:51:39 2013 Koichi Sasada <ko1@atdot.net>
- * lib/csv.rb: Improve the line ending detection algorithm
- patch by Alexey).
+ * array.c (ary_alloc): slim setup process.
-Thu Jun 2 20:05:57 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+Thu Jul 18 14:37:57 2013 Koichi Sasada <ko1@atdot.net>
- * io.c (rb_io_s_write, rb_io_s_binwrite): return!!!
+ * string.c (str_alloc): no need to clear RString (already cleared).
-Thu Jun 2 16:29:34 2011 Shota Fukumori <sorah@tubusu.net>
+Thu Jul 18 12:57:47 2013 Tanaka Akira <akr@fsij.org>
- * io.c: Add File.write, File.binwrite. [Feature #1081] [ruby-core:21701]
+ * 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.
- * test/ruby/test_io.rb: Test for File.write, File.binwrite.
+Thu Jul 18 06:30:02 2013 Koichi Sasada <ko1@atdot.net>
- * NEWS: News for above.
+ * 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().
-Thu Jun 2 12:33:09 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+ * gc.c: rename a heap management function with prefix "heap_".
+ * get_freeobj() -> heap_get_freeobj().
- * io.c (io_fflush, rb_io_flush): need to fsync() when ruby calls
- internal flush. [ruby-core:36670] [Bug #4813]
+ * gc.c: rename markable_object_p() to is_markable_object().
-Thu Jun 2 07:56:24 2011 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
+Wed Jul 17 22:57:40 2013 Masaki Matsushita <glass.saga@gmail.com>
- * ext/tk/tcltklib.c: reduce CPU power required by an eventloop.
+ * hash.c (delete_if_i): use ST_DELETE.
-Tue May 31 21:28:33 2011 Tanaka Akira <akr@fsij.org>
+Wed Jul 17 22:34:47 2013 Tanaka Akira <akr@fsij.org>
- * test/ruby/test_signal.rb (TestSignal#test_signal_requiring):
- redirect stderr to null device.
+ * 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.
-Thu Jun 2 00:45:26 2011 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
+Wed Jul 17 22:13:26 2013 Masaki Matsushita <glass.saga@gmail.com>
- * ext/tk/extconf.rb: fix for uninitialized global variables.
- [Ruby 1.9 - Bug #4811]
+ * hash.c (rb_hash_replace): performance improvement by using
+ st_copy().
-Wed Jun 1 21:57:08 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+Wed Jul 17 17:19:54 2013 Koichi Sasada <ko1@atdot.net>
- * thread_pthread.c (native_sleep): fix 1000times calculation error.
- this is a regression since r31457. [Bug #4808] [ruby-dev:43606]
+ * 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().
-Wed Jun 1 17:19:16 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * gc.c (initial_expand_heap): inlined in rb_gc_set_params().
- * thread_pthread.c: remove unused macro.
+Wed Jul 17 17:12:23 2013 Matthew M. Boedicker <matthewm@boedicker.org>
-Wed Jun 1 15:42:18 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * hash.c (env_fetch): Add key name to message on ENV.fetch KeyError,
+ as well as Hash#fetch. [ruby-core:56062] [Feature #8649]
- * parse.y (peek_n): new macro to see next nth char.
+Wed Jul 17 15:59:33 2013 Koichi Sasada <ko1@atdot.net>
-Wed Jun 1 15:40:46 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * gc.c: catch up last changes for debugging/checking mode.
- * tool/rbinstall.rb (gem): fix for rubygems change.
+Wed Jul 17 15:50:10 2013 Koichi Sasada <ko1@atdot.net>
-Wed Jun 1 14:07:57 2011 Ryan Davis <ryand-ruby@zenspider.com>
+ * gc.c (rb_objspace_free): free slot itself.
- * lib/minitest/*: Imported minitest 2.2.2 (r6281)
- * test/minitest/*: ditto
+ * gc.c (objspace_each_objects): fix condition.
+ Use slot->body instead of slot.
-Wed Jun 1 12:35:50 2011 Ryan Davis <ryand-ruby@zenspider.com>
+ * gc.c (count_objects): use "slot" variable.
- * lib/rubygems*: Import rubygems 1.8.5 (released @ 137c80f)
- * test/rubygems: Ditto
+Wed Jul 17 15:21:10 2013 Koichi Sasada <ko1@atdot.net>
-Wed Jun 1 12:34:00 2011 Kenta Murata <mrkn@mrkn.jp>
+ * gc.c (unlink_heap_slot): fix memory leak.
+ free slot itself at free_heap_slot().
- * NEWS: add new features of bigdecimal.
+ 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.
-Wed Jun 1 09:41:14 2011 Eric Hodel <drbrain@segment7.net>
+ * gc.c (unlink_heap_slot): remove not working code.
- * lib/cgi/util.rb: Improve documentation. Patch by Kuba Fietkiewicz.
- [Ruby 1.9 - Bug #4775]
- * lib/cgi/core.rb: ditto
+Wed Jul 17 14:31:13 2013 Koichi Sasada <ko1@atdot.net>
-Wed Jun 1 09:26:05 2011 Eric Hodel <drbrain@segment7.net>
+ * gc.c: re-design the heap structure.
- * lib/mathn.rb: Improve documentation and attach it to Numeric.
- Modified from patch by Anil V. [Ruby 1.9 - Bug #4762]
+ (1) The heap is consists of a set of slots.
+ (2) Each "slot" has a "slot_body".
+ slot::start and slot::limit specify RVALUE beginning address
+ and number of RVALUE in a "slot_body".
+ (3) "slot_body" contains a pointer to slot (slot_body::header::slot)
+ and an array of RVALUE.
+ (4) heap::sorted is an array of "slots", sorted by an address of
+ slot::body.
-Wed Jun 1 09:21:30 2011 Eric Hodel <drbrain@segment7.net>
+ See https://bugs.ruby-lang.org/projects/ruby-trunk/wiki/GC_design
+ for more details (figure).
- * lib/prime.rb: Indent examples enough to appear as code sections.
- Note that Prime is Enumerable. [#4762]
+ * gc.c: Avoid "heaps" terminology. It is ambiguous.
-Wed Jun 1 07:34:57 2011 Eric Hodel <drbrain@segment7.net>
+Wed Jul 17 13:29:16 2013 Koichi Sasada <ko1@atdot.net>
- * hash.c (key_i): Change rdoc from "the first occurrence" to "an
- occurrence" since first occurrence is not a specification of
- Hash#key. [Ruby 1.9 - Bug #4760]
+ * gc.c: fix heaps_header and heaps_slot to reduce memory consumption.
+ (1) move heaps_header::start and limit to heaps_slot.
+ (2) remove heaps_header::end which can be calculated by start+limit.
-Wed Jun 1 07:26:19 2011 Eric Hodel <drbrain@segment7.net>
+ * gc.c: catch up above change.
- * ext/pty/pty.c (pty_check): Restore "not reached" comment.
- [Ruby 1.9 - Bug #4756]
+Wed Jul 17 12:30:05 2013 Tanaka Akira <akr@fsij.org>
-Wed Jun 1 07:21:40 2011 Eric Hodel <drbrain@segment7.net>
+ * include/ruby/st.h (st_strcasecmp): Macro defined for compatibility.
+ (st_strncasecmp): Ditto.
- * ext/zlib/zlib.c: Fix document-method declarations for set_sync and
- set_comment. [Ruby 1.9 - Bug #4695]
+Wed Jul 17 11:57:45 2013 Takeyuki FUJIOKA <xibbar@ruby-lang.org>
-Wed Jun 1 06:43:13 2011 Masaya Tarui <tarui@ruby-lang.org>
+ * lib/cgi/util.rb (CGI::Util#escape, unescape): Avoid use of regexp
+ special global variable. [Feature #8648] Thanks to fotos.
- * load.c (loaded_feature_path): cut nonsense loop execution to fix
- performance bug.
+Wed Jul 17 11:57:10 2013 Takeyuki FUJIOKA <xibbar@ruby-lang.org>
-Wed Jun 1 01:16:02 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * lib/erb.rb (ERB::Util#url_encode): Avoid use of regexp special global
+ variable. [Feature #8648] Thanks to fotos.
- * class.c (rb_mix_module): implement Module#mix.
+Wed Jul 17 08:12:41 2013 Tanaka Akira <akr@fsij.org>
-Wed Jun 1 01:15:12 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * st.c (st_locale_insensitive_strcasecmp): Renamed from st_strcasecmp.
+ (st_locale_insensitive_strncasecmp): Renamed from st_strncasecmp.
- * io.c (io_encoding_set): should honor already set ecflags since it
- might be set by mode option. fixed #4804
+ * include/ruby/st.h: Follow above changes.
-Wed Jun 1 00:34:04 2011 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
+ * include/ruby/ruby.h: Ditto.
- * ext/bigdecimal/bigdecimal.c (GetVpValueWithPrec): remove unused
- variable.
+Wed Jul 17 00:14:59 2013 Tanaka Akira <akr@fsij.org>
-Wed Jun 1 00:32:00 2011 Kenta Murata <mrkn@mrkn.jp>
+ * bignum.c (bigmul1_toom3): Use bigdivrem_single instead of bigdivrem.
+ (big_three): Removed.
+ (Init_Bignum): Don't initialize big_three.
- * ext/bigdecimal/bigdecimal.c (GetVpValueWithPrec): support instantiation from
- a Float through Rational.
+Tue Jul 16 21:46:03 2013 Masaki Matsushita <glass.saga@gmail.com>
- * ext/bigdecimal/bigdecimal.c (BigDecimal_new): ditto.
+ * configure.in: revert r42008. strcasecmp() uses the current locale.
- * test/bigdecimal/test_bigdecimal.rb (test_global_new_float): add a test for
- the above changes.
+ * include/ruby/ruby.h: ditto.
- * test/bigdecimal/test_bigdecimal.rb (test_new_with_float): ditto.
+ * st.c (st_strcasecmp): ditto.
-Wed Jun 1 00:07:00 2011 Kenta Murata <mrkn@mrkn.jp>
+Tue Jul 16 21:07:04 2013 Masaki Matsushita <glass.saga@gmail.com>
- * ext/bigdecimal/bigdecimal.c (BigDecimal_coerce): support coerce with a
- Rational. The precision used for instantiate a BigDecimal from the
- given Rational is obtained from the receiver BigDecimal.
+ * configure.in: check strcasecmp().
- * test/bigdecimal/test_bigdecimal.rb (test_coerce): add a test for the
- above change.
+ * include/ruby/ruby.h: use strcasecmp() as st_strcasecmp() if it
+ exists.
-Tue May 31 23:49:08 2011 Tadayoshi Funaba <tadf@dotrb.org>
+ * st.c (st_strcasecmp): define the function only if strcasecmp()
+ doesn't exist.
- * ext/date/date_core.c (offset_to_sec): fixed invalid validation.
+Tue Jul 16 20:21:28 2013 Tanaka Akira <akr@fsij.org>
-Tue May 31 23:43:00 2011 Kenta Murata <mrkn@mrkn.jp>
+ * bignum.c (bigsq): Renamed from bigsqr.
- * ext/bigdecimal/bigdecimal.c (GetVpValueWithPrec): replace the algorithm for
- coercing from a Rational to stop requiring "bigdecimal/util.rb".
- [ruby-core:34318]
+Tue Jul 16 19:42:08 2013 Tanaka Akira <akr@fsij.org>
- * ext/bigdecimal/bigdecimal.c (GetVpValue): refactoring.
+ * bignum.c (USHORT): Unused macro removed.
- * ext/bigdecimal/bigdecimal.c (BigDecimal_new): support instantiation from a
- Rational.
+Tue Jul 16 19:18:51 2013 Koichi Sasada <ko1@atdot.net>
- * test/bigdecimal/test_bigdecimal.rb (test_global_new_with_rational): add a
- test for the above change.
+ * gc.c: slim a path of newobj_of().
- * test/bigdecimal/test_bigdecimal.rb (test_new_with_rational): ditto.
+ * gc.c (objspace): add a new field objspace::freelist, which contains
+ available RVALUEs.
-Tue May 31 22:44:00 2011 Kenta Murata <mrkn@mrkn.jp>
+ * 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.
- * ext/bigdecimal/bigdecimal.c (BigDecimal_new): support instantiation a
- BigDecimal object from an Integer.
+ * gc.c (before_gc_sweep): clear objspace::freelist.
- * test/bigdecimal/test_bigdecimal.rb (test_new_with_integer):
- add for testing the above change.
+ * gc.c (slot_sweep): clear slot::freelist.
- * ext/bigdecimal/bigdecimal.c (BigDecimal_global_new): replace its body
- with a BigDecimal_new call.
+ * gc.c (heaps_prepare_freeslot): renamed to heaps_prepare_freeslot.
- * test/bigdecimal/test_bigdecimal.rb (test_global_new_with_integer):
- add for testing the above change.
+ * gc.c (unlink_free_heap_slot): remove unused function.
-Tue May 31 22:24:39 2011 Tadayoshi Funaba <tadf@dotrb.org>
+ * gc.c (rb_free_const_table): remove unused function.
- * ext/date/date_core.c: use simple/complex mode instead of light/right mode.
- * test/date/*.rb: followed the above changes.
+Tue Jul 16 19:05:12 2013 Tanaka Akira <akr@fsij.org>
-Tue May 31 21:28:33 2011 Tanaka Akira <akr@fsij.org>
+ * bignum.c (big_shift3): Big shift width is not a problem for right
+ shift.
- * test/ruby/test_signal.rb (TestSignal#test_signal_requiring):
- initialize SIGINT handler.
+Tue Jul 16 18:50:08 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Tue May 31 17:03:24 2011 Hiroshi Nakamura <nahi@ruby-lang.org>
+ * array.c (rb_ary_count): [DOC] fix typo. Array#count uses ==, not
+ ===. a question at asakusa.rb ML.
- * lib/net/http.rb, lib/net/protocol.rb: Allow to configure to wait
- server returning '100 continue' response before sending HTTP request
- body. See NEWS for more detail. See #3622.
- Original patch is made by Eric Hodel <drbrain@segment7.net>.
+Tue Jul 16 18:35:48 2013 Tanaka Akira <akr@fsij.org>
- * test/net/http/test_http.rb: test it.
+ * bignum.c (bary_mul_karatsuba): Avoid duplicate calculation when
+ squaring.
+ (bary_mul_toom3_branch): Ditto.
- * NEWS: Add new feature.
+Tue Jul 16 17:43:22 2013 Koichi Sasada <ko1@atdot.net>
-Tue May 31 14:17:49 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+ * gc.c (link_free_heap_slot): removed.
- * io.c (rb_io_s_pipe): potential bug. the mode of read IO is set as
- DEFAULT_TEXTMODE in call of io_set_encoding(), and of write IO is
- also set as it in call of io_new_instance() via rb_protect().
- so, if DEFAULT_TEXTMODE is not 0, we should check the result of
- extract_binmode() and avoid crush of default IO mode and the result.
+ * gc.c (slot_sweep): use `heaps_add_freeslot' instead of
+ `link_free_heap_slot'.
-Tue May 31 13:00:17 2011 Yuki Sonoda (Yugui) <yugui@yugui.jp>
+ * gc.c (assign_heap_slot): use local variable `slot' instead of
+ `heaps'.
- * strftime.c (rb_strftime_with_timespec): improved style consistency.
- constified some variables.
+Tue Jul 16 17:21:39 2013 Koichi Sasada <ko1@atdot.net>
- * test/test_time.rb (TestTime#test_huge_precision): test for #4456.
+ * gc.c (assign_heap_slot): refactoring variable names.
-Tue May 31 12:53:10 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+ * gc.c (slot_add_freeobj): added.
- * test/io/wait/test_io_wait.rb (TestIOWait#{test_nread,test_ready?,
- test_wait}: give system some time to process the written data.
+ * gc.c (heaps_add_freeslot): added.
-Tue May 31 12:40:49 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+ * gc.c (finalize_list, rb_gc_force_recycle, slot_sweep): use
+ `slot_add_freeobj' instead of modifying linked list directly.
- * test/ruby/test_io.rb (TestIO#test_open_mode): MUST release resources
- explicitly. fix problem of r31671
+Tue Jul 16 16:30:58 2013 Koichi Sasada <ko1@atdot.net>
-Tue May 31 10:49:55 2011 NARUSE, Yui <naruse@ruby-lang.org>
+ * gc.c (lazy_sweep): refactoring.
- * vm_exec.c: remove conditions for clang
- because clang version 3.0 (trunk 132165) doesn't need them.
+Tue Jul 16 13:32:06 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Mon May 30 22:19:33 2011 Tanaka Akira <akr@fsij.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.
- * test/ruby/test_signal.rb (TestSignal#test_signal_requiring): don't
- close stderr.
+Tue Jul 16 11:12:03 2013 Masaki Matsushita <glass.saga@gmail.com>
-Mon May 30 20:22:00 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+ * proc.c (rb_block_arity): raise ArgumentError if no block given.
- * test/ruby/test_signal.rb (TestSignal#test_signal_requiring): small
- but critical typo of r31642. sorry...
- [Bug #4798] [ruby-core:36550]
+Tue Jul 16 08:15:22 2013 Zachary Scott <e@zzak.io>
-Mon May 30 15:44:16 2011 NARUSE, Yui <naruse@ruby-lang.org>
+ * ext/bigdecimal/lib/bigdecimal/util.rb: [DOC] document top-level
+ classes from BigDecimal utils native extensions
- * insns.def (opt_mult): as r31805, volatile it.
- Without this, clang -O fails calculation.
+Tue Jul 16 03:23:03 2013 Zachary Scott <e@zzak.io>
- * numeric.c (fix_mul): ditto.
+ * numeric.c: [DOC] improve rdoc formatting for parameters and links
- * rational.c (f_imul): ditto.
+Mon Jul 15 14:40:00 2013 Tanaka Akira <akr@fsij.org>
-Mon May 30 10:26:51 2011 NARUSE, Yui <naruse@ruby-lang.org>
+ * include/ruby/intern.h (rb_big2str0): Deprecated.
- * numeric.c (int_pow): make sure to assign the result of x * z.
- If xz is optimized out, the value won't overflow.
+ * bignum.c (rb_big2str1): Renamed from rb_big2str0.
+ (rb_big2str0): Deprecated wrapper for rb_big2str1.
+ (rb_big2str): Invoke rb_big2str1 instead of rb_big2str0.
-Sun May 29 23:17:29 2011 NARUSE, Yui <naruse@ruby-lang.org>
+Mon Jul 15 14:13:02 2013 Masaki Matsushita <glass.saga@gmail.com>
- * re.c (rb_reg_match): fix rdoc of Regexp#=~.
- patched by Tsuyoshi Sawada. [Bug #4781]
+ * 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.
-Sun May 29 23:10:42 2011 NARUSE, Yui <naruse@ruby-lang.org>
+Mon Jul 15 13:46:26 2013 Tanaka Akira <akr@fsij.org>
- * lib/webrick/https.rb (WEBrick::HTTPRequest#parse_uri):
- keep parse_uri as private. patched by okkez. [Bug #4773]
+ * bignum.c: Add static assertions.
-Sun May 29 17:53:03 2011 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
+Mon Jul 15 13:36:02 2013 Masaki Matsushita <glass.saga@gmail.com>
- * numeric.c: add #include "internal.h" for rb_big_uminus() prototype.
+ * hash.c (rb_hash_each_pair): performance improvement by using
+ rb_block_arity().
-Sun May 29 15:09:05 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Mon Jul 15 13:15:37 2013 Masaki Matsushita <glass.saga@gmail.com>
- * numeric.c (flo_round): fix for negative value.
+ * proc.c (rb_block_arity): create internal API rb_block_arity().
+ it returns arity of given block.
-Sun May 29 02:16:53 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+Mon Jul 15 13:07:27 2013 Yuki Yugui Sonoda <yugui@yugui.jp>
- * test/net/http/utils.rb (TestNetHTTPUtils#teardown): add nil check.
+ * lib/prime.rb (Prime::EratosthenesGenerator,
+ Prime::EratosthenesSieve): New implementation by
+ robertjlooby <robertjlooby AT gmail.com>.
-Sun May 29 00:22:40 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * test/test_prime.rb: updated with new method name
- * process.c (before_exec, after_exec): change from macro to function.
+Mon Jul 15 11:32:46 2013 Zachary Scott <e@zzak.io>
-Sat May 28 19:30:17 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * numeric.c (rb_cNumeric): [DOC] Added comment for Numeric to fix doc
- * process.c (before_exec, after_exec): change SIGPIPE handler to SIG_DFL
- before calling execve(). Because r31760 reintroduced an issue that
- system() may hang up (i.e. [ruby-dev:12261]).
- * process.c (save_sigpipe, restore_sigpipe): new.
+Mon Jul 15 11:24:48 2013 Tanaka Akira <akr@fsij.org>
-Sat May 28 16:08:16 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * bignum.c (maxpow_in_bdigit_dbl): Useless #if removed.
- * signal.c (Init_signal, default_handler): change default SIGPIPE handler
- from empty function to SIG_IGN. [ruby-dev:43215]
- * signal.c (sigpipe): removed.
+Mon Jul 15 11:10:46 2013 Zachary Scott <e@zzak.io>
-Sat May 28 03:04:27 2011 NARUSE, Yui <naruse@ruby-lang.org>
+ * 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
- * io.c (fill_cbuf): return MORE_CHAR_SUSPENDED when cbuf is not empty.
+Mon Jul 15 10:56:01 2013 Zachary Scott <e@zzak.io>
-Sat May 28 02:22:48 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * thread.c (mutex_sleep): [DOC] Awake thread will reacquire lock
+ By Tim Abdulla [Fixes GH-342] https://github.com/ruby/ruby/pull/342
- * string.c (rb_str_bytesize): rb_str_bytesize() should use LONG2NUM().
- Patch by Nikolai Weibull. [Bug #4789] [ruby-core:36511]
+Mon Jul 15 10:45:09 2013 Tanaka Akira <akr@fsij.org>
-Sat May 28 02:06:26 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * 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.
- * io.c (fill_cbuf): Fix test-all crash.
+ * configure.in: Check __builtin_clz, __builtin_clzl and
+ __builtin_clzll.
-Sat May 28 00:58:40 2011 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
+Mon Jul 15 09:39:07 2013 Tanaka Akira <akr@fsij.org>
- * lib/ostruct.rb (method_missing): Handle [] and []= correctly.
- Based on a patch by Caius Durling, bug #4179 [ruby-core:33792]
+ * bignum.c (power_cache_get_power): Use bitsize instead of ceil_log2.
+ (ones): Removed.
+ (next_pow2): Removed.
+ (floor_log2): Removed.
+ (ceil_log2): Removed.
-Fri May 27 23:56:54 2011 Kouhei Sutou <kou@cozmixng.org>
+ * configure.in (__builtin_popcountl): Don't check.
- * test/rexml/test_core.rb (Tester::test_text_frozen): split frozen
- string test. refs #4783
+Mon Jul 15 02:47:09 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Fri May 27 22:46:23 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * localeinit.c (rb_locale_charmap, Init_enc_set_filesystem_encoding):
+ move from encoding.c.
- * tool/rbinstall.rb (gem): install gemspec of json. fixed #4784
+ * miniinit.c (rb_locale_charmap, Init_enc_set_filesystem_encoding):
+ define miniruby specific functions only.
-Fri May 27 22:45:10 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Mon Jul 15 02:32:58 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * io.c (validate_enc_binmode): do not clear textmode flag if
- default. fixed #4732
+ * encoding.c (rb_enc_init): no longer needs NO_PRESERVED_ENCODING.
- * io.c (fill_cbuf): finish reading at EOF.
+ * encoding.c (enc_inspect): defer loading autoloaded encoding.
-Fri May 27 11:31:51 2011 misfo <tedwardo2@gmail.com>
+ * encoding.c (enc_check_encoding): use is_data_encoding() to check
+ type consistently.
- * lib/rexml/text.rb (REXML::Text#initialize): prevent an error
- when passing a frozen string to REXML::Text.new
+ * encoding.c (must_encoding): return rb_encoding* instead of encoding
+ index.
- dup the string passed in instead of cloning so that it's frozen
- state is ignored
+ * encoding.c (enc_check_encoding): use is_data_encoding() to check
+ type consistently.
-Fri May 27 08:47:26 2011 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
+ * encoding.c (must_encoding): return rb_encoding* instead of encoding
+ index.
- * thread.c (ppoll): typo bug fix.
+Mon Jul 15 02:21:39 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Fri May 27 08:35:04 2011 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
+ * 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]
- * ext/tk/lib/tk.rb: hang-up at exit before calling Tk.mainloop.
+ * encoding.c (enc_inspect): use PRIsVALUE to preserve the result
+ encoding.
- * ext/tk/lib/tk/extconf.rb: cannot make on MinGW [Ruby 1.9 - Bug #4141].
+Sun Jul 14 23:21:47 2013 Tanaka Akira <akr@fsij.org>
-Thu May 27 00:34:07 2011 James Edward Gray II <jeg2@ruby-lang.org>
+ * configure.in: Check __builtin_popcountl, __builtin_bswap32 and
+ __builtin_bswap64.
- * lib/csv.rb: Enhance each() to support Enumerator.
+ * 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.
-Thu May 26 10:32:11 2011 James Edward Gray II <jeg2@ruby-lang.org>
+ * bignum.c (ones): Use the configure result for the condition to use
+ __builtin_popcountl.
+ (bary_unpack_internal): Use appropriate types for swap argument.
- * lib/csv.rb: Documentation improvements from Ysiad Ferreiras.
- [Ruby 1.9 - Bug #4785]
+Sun Jul 14 22:21:11 2013 Tanaka Akira <akr@fsij.org>
-Thu May 26 15:42:02 2011 Cezary Baginski <cezary.baginski@gmail.com>
+ * 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.
- * lib/xmlrpc/parser.rb (FaultException): fix to_s and inspect
+Sun Jul 14 00:36:03 2013 Tanaka Akira <akr@fsij.org>
- * test/xmlrpc/parser.rb: test for the above
+ * bignum.c (DIGSPERLONG): Unused macro removed.
+ (DIGSPERLL): Ditto.
-Wed May 25 11:54:31 2011 Eric Hodel <drbrain@segment7.net>
+Sun Jul 14 00:32:51 2013 Tanaka Akira <akr@fsij.org>
- * ext/curses/curses.c: Remove color constants block.
- [Ruby 1.9 - Bug #4748]
+ * bignum.c (rb_big_aref): Less scan when the number is negative.
-Wed May 25 09:56:45 2011 Eric Hodel <drbrain@segment7.net>
+Sun Jul 14 00:17:42 2013 Tanaka Akira <akr@fsij.org>
- * ext/curses/curses.c: Add missing documentation for button state, MIN
- and MAX comments. Add Curses. to TABSIZE= and ESCDELAY= methods.
- [Ruby 1.9 - Bug #4747]
+ * bignum.c (big_shift): Avoid signed integer overflow.
-Wed May 25 09:35:31 2011 Eric Hodel <drbrain@segment7.net>
+Sun Jul 14 00:14:15 2013 Tanaka Akira <akr@fsij.org>
- * lib/benchmark.rb: Restore nodoc for Benchmark::Job and
- Benchmark::Report. [Ruby 1.9 - Bug #4726]
+ * bignum.c (bary_mul_precheck): Use bary_small_lshift or
+ bary_mul_normal if xl is 1.
-Wed May 25 09:29:38 2011 Eric Hodel <drbrain@segment7.net>
+Sat Jul 13 22:58:16 2013 Tanaka Akira <akr@fsij.org>
- * lib/net/pop.rb: Hide implementation details from RDoc.
- [Ruby 1.9 - Bug #4711]
+ * 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.
-Wed May 25 09:26:29 2011 Eric Hodel <drbrain@segment7.net>
+Sat Jul 13 15:51:38 2013 Tanaka Akira <akr@fsij.org>
- * lib/net/ftp.rb: Add :nodoc: for private methods.
- [Ruby 1.9 - Bug #4710]
+ * bignum.c (bary_small_lshift): Use size_t instead of long.
+ (bary_small_rshift): Ditto.
-Wed May 25 09:19:17 2011 Eric Hodel <drbrain@segment7.net>
+Sat Jul 13 15:33:33 2013 Tanaka Akira <akr@fsij.org>
- * ext/zlib/zlib.c: Fix Document-method declarations. Improve
- Zlib::GzipFile's method catalog. [Ruby 1.9 - Bug #4695]
+ * bignum.c (bary_small_lshift): Functions moved to remove
+ declaration.
+ (bary_small_rshift): Ditto.
-Wed May 25 08:22:12 2011 Eric Hodel <drbrain@segment7.net>
+Sat Jul 13 12:27:34 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * lib/erb.rb: Hide documentation for implementation details of ERB.
- [Ruby 1.9 - Bug #4694]
+ * encoding.c (rb_enc_associate_index): fill new terminator length, not
+ old one.
-Wed May 25 07:58:14 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Sat Jul 13 12:24:24 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * lib/tempfile.rb (Tempfile.{mkdir,rmdir}): revert for backward
- compatibility.
+ * 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.
-Wed May 25 07:13:12 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Sat Jul 13 09:26:09 2013 Tanaka Akira <akr@fsij.org>
- * spec/README: update the description.
+ * bignum.c (biglsh_bang): Removed.
+ (bigrsh_bang): Ditto.
+ (bigmul1_toom3): Use bary_small_lshift and bary_small_rshift.
-Wed May 25 07:12:16 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Sat Jul 13 01:04:43 2013 Zachary Scott <e@zzak.io>
- * lib/tempfile.rb (Tempfile.{lock,unlock}_tempfile): refactor.
+ * lib/rubygems/psych_additions.rb: Ignore Psych docs here
-Tue May 24 17:30:36 2011 NARUSE, Yui <naruse@ruby-lang.org>
+Fri Jul 12 18:10:46 2013 NAKAMURA Usaku <usa@ruby-lang.org>
- * spec/README: fix typo.
- patched by bowsersenior. https://github.com/ruby/ruby/pull/24
+ * ext/fiddle/win32/lib/win32/registry.rb
+ (Win32::Registry::API#make_wstr): same as r41922.
-Tue May 24 07:06:34 2011 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
+Fri Jul 12 16:28:37 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * ext/tk/lib/tk.rb: fail to start Tk.mainloop (exit immediately) on
- some environment (reported on [ruby-talk:381444]).
+ * encoding.c (rb_enc_associate_index): refill the terminator if it
+ becomes longer than before. [ruby-dev:47500] [Bug #8624]
- * ext/tk/lib/tk/canvas.rb: support creating a canvas item object from
- an item ID number.
+ * string.c (str_null_char, str_fill_term): get rid of out of bound
+ access.
- * ext/tk/lib/tk/image.rb: import documents which are pull-requested.
- [Ruby 1.9 - Feature #4595]
+ * string.c (rb_str_fill_terminator): add a parameter for the length of
+ new terminator.
- * ext/tk/lib/tk/extconf.rb: search directories for 64bit library (e.g.
- /usr/lib64), add some new configure options (see README.tcltklib),
- and bug fix.
+Fri Jul 12 11:26:25 2013 Masaki Matsushita <glass.saga@gmail.com>
- * ext/tk/lib/tk/README.tcltklib: modify docs for some new configure
- options.
+ * hash.c (rb_hash_reject_bang): do not call rb_hash_foreach() if RHash
+ has ntbl and it is empty.
-Tue May 24 04:01:46 2011 Aaron Patterson <aaron@tenderlovemaking.com>
+Fri Jul 12 11:17:41 2013 Masaki Matsushita <glass.saga@gmail.com>
- * lib/yaml.rb: switch default YAML engine to Psych, old syck engine
- may be enabled via YAML::ENGINE.yamler = "syck". [ruby-core:36374]
+ * hash.c (recursive_hash): use RHASH_SIZE() to check hash size.
-Mon May 23 09:45:26 2011 Hiroshi Nakamura <nahi@ruby-lang.org>
+Fri Jul 12 00:20:00 2013 Masaki Matsushita <glass.saga@gmail.com>
- * include/ruby/defines.h (CASEFOLD_FILESYSTEM): Revert r30508. Forgot to
- include this file in the commit r31692. __APPLE__ is not
- CASEFOLD_FILESYSTEM again, from this time.
+ * hash.c (rb_hash_size): use RHASH_SIZE().
-Mon May 23 10:01:02 2011 Martin Bosslet <Martin.Bosslet@googlemail.com>
+Fri Jul 12 00:08:24 2013 Masaki Matsushita <glass.saga@gmail.com>
- * ext/openssl/ossl_asn1.c: Do not parse zero-tagged values as EOC. Do
- not let current length become negative for infinite length constructed
- values. Support constructed values of length zero. Added tests.
+ * hash.c (rb_hash_values): set array capa to RHASH_SIZE().
-Mon May 23 09:19:53 2011 Eric Hodel <drbrain@segment7.net>
+Thu Jul 11 23:54:45 2013 Masaki Matsushita <glass.saga@gmail.com>
- * lib/net/smtp.rb: Document Net::SMTP::Response. Patch by J.R. Garcia.
- [Ruby 1.9 - Bug #4768]
+ * hash.c (rb_hash_keys): set array capa to RHASH_SIZE().
-Mon May 23 09:03:52 2011 Shota Fukumori <sorah@tubusu.net>
+Thu Jul 11 21:30:17 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * lib/test/unit/parallel.rb: Never Ignore SIGINT. When received
- Interrupt, immediately puts result and exit. [ruby-dev:43571]
+ * win32/win32.c (rb_w32_pow): undef pow to get rid of infinite
+ recursive call. re-fix [Bug #8495]. [ruby-core:55923] [Bug #8621]
- * lib/test/unit.rb: When received Interrupt, wait results from workers
- and collect them. [ruby-dev:43571]
+Thu Jul 11 20:18:13 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Mon May 23 09:08:07 2011 Eric Hodel <drbrain@segment7.net>
+ * ext/dl/win32/lib/win32/registry.rb (Win32::Registry::API#make_wstr):
+ remove workaround to append WCHAR terminator.
- * lib/mathn.rb: Improve documentation. Patch by Sandor Szucs.
- [Ruby 1.9 - Bug #4767]
+ * transcode.c (str_encode_associate): fill terminator after conversion.
-Mon May 23 08:45:55 2011 Eric Hodel <drbrain@segment7.net>
+ * string.c (rb_enc_str_new, rb_str_set_len, rb_str_resize): fill
+ minimum length of the encoding as the terminator.
- * lib/ostruct.rb: Improve documentation. Patch by Franklin Webber.
- [Ruby 1.9 - Bug #4761]
+ * string.c (str_buf_cat, rb_str_buf_append, rb_str_splice_0): ditto.
-Mon May 23 08:35:24 2011 Eric Hodel <drbrain@segment7.net>
+ * string.c (str_make_independent_expand, rb_str_modify_expand): make
+ the capacity enough for multi-byte terminator.
- * hash.c: Improve documentation of Hash#key. Patch by Utkarsh
- Kukreti. [Ruby 1.9 - Bug #4760]
+ * string.c (rb_string_value_cstr): fill minimum length of the encoding
+ as the terminator.
-Mon May 23 08:32:59 2011 Eric Hodel <drbrain@segment7.net>
+ * string.c (rb_string_value_cstr): check null char in char, not in
+ byte.
- * enumerator.c: Improve documentation. Patch by Dave Copeland.
- [Ruby 1.9 - Bug #4757]
+Thu Jul 11 14:48:35 2013 Zachary Scott <e@zzak.io>
-Mon May 23 07:19:45 2011 Martin Bosslet <Martin.Bosslet@googlemail.com>
+ * 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
- * NEWS (openssl): Infinite length support. Different behavior of
- Constructive and Primitive constructors.
+Thu Jul 11 14:22:37 2013 Zachary Scott <e@zzak.io>
-Mon May 23 06:58:33 2011 Martin Bosslet <Martin.Bosslet@googlemail.com>
+ * 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
- * ext/openssl/ossl_asn1.c: Forbid Constructives whose value is not an
- Array to prevent segfault. Added test.
+Thu Jul 11 13:48:03 2013 Zachary Scott <e@zzak.io>
-Mon May 23 06:33:17 2011 Martin Bosslet <Martin.Bosslet@googlemail.com>
+ * sprintf.c: Fix typo patch by @hynkle [Fixes GH-357]
+ https://github.com/ruby/ruby/pull/357
- * ext/openssl/ossl_asn1.c: Forbid Constructive without infinite
- length. This also prevents a segfault. Added test and improved
- documentation.
+Thu Jul 11 13:00:34 2013 Zachary Scott <e@zzak.io>
-Mon May 23 05:58:14 2011 Martin Bosslet <Martin.Bosslet@googlemail.com>
+ * lib/securerandom.rb: Refactor conditions by Rafal Chmiel
+ [Fixes GH-326] https://github.com/ruby/ruby/pull/326
- * ext/openssl/ossl_asn1.c: Fix decoding of infinite length values.
- Simplified ossl_asn1_decode0 by splitting it into three separate
- functions. Add tests.
- [Ruby 1.9 - Bug #4374][ruby-core:35123]
+Thu Jul 11 12:04:47 2013 Tanaka Akira <akr@fsij.org>
-Mon May 23 04:03:46 2011 Martin Bosslet <Martin.Bosslet@googlemail.com>
+ * 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.
- * ext/openssl/ossl_asn1.c (ossl_asn1_initialize): Allow creation of
- Constructives with an explicit tag_class parameter without
- automatically setting tagging to :EXPLICIT. Fixes a bug when encoding
- infinite length primitive values.
+Thu Jul 11 10:46:38 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Mon May 23 04:03:46 2011 Martin Bosslet <Martin.Bosslet@googlemail.com>
+ * tool/probes_to_wiki.rb: fix usage comment. use Enumerable#grep
+ which yields each elements to reduce unnecessary array.
- * ext/openssl/ossl_asn1.c (ossl_asn1_cons_to_der): Add an additional
- EOC for infinite length Constructives that are supposed to be encoded
- with explicit tagging. Also tabify method correctly.
+Thu Jul 11 10:09:18 2013 NARUSE, Yui <naruse@ruby-lang.org>
-Mon May 23 03:44:39 2011 Martin Bosslet <Martin.Bosslet@googlemail.com>
+ * process.c (rb_daemon): daemon(3) is implemented with fork(2).
+ Therefore it needs rb_thread_atfork(). (and revert r41903)
- * ext/openssl/ossl_asn1.c (ossl_asn1data_to_der): Remove redundant
- flag tmp_cons.
+Thu Jul 11 03:22:10 2013 Aaron Patterson <aaron@tenderlovemaking.com>
-Mon May 23 00:35:00 2001 Kenta Murata <mrkn@mrkn.jp>
+ * tool/probes_to_wiki.rb: adding a script to convert probes.d to wiki
+ format for easy wiki updates.
- * bignum.c (dump_bignum, bigmul1_balance, big_split, biglsh_bang),
- (bigrsh_bang, big_split3, bigmul1_toom3, bigmul0): implement Toom3 (Toom-Cook)
- multiplication.
+Thu Jul 11 00:54:07 2013 Zachary Scott <zachary@zacharyscott.net>
- * include/ruby/defines.h: add format prefixes for BDIGIT and BDIGIT_DBL.
+ * man/ri.1: Incorrect use of .Dd macro [Bug #8620] by Tristan Hill
-Sun May 22 23:24:02 2011 Martin Bosslet <Martin.Bosslet@googlemail.com>
+Thu Jul 11 00:48:29 2013 Zachary Scott <zachary@zacharyscott.net>
- * ext/openssl/ossl_asn1.c: Instead of rb_intern use static symbols to
- improve performance.
+ * lib/delegate.rb: Add example for __setobj__ and __getobj__
+ [Bug #8615] Patch by Caleb Thompson
-Sun May 22 21:56:51 2011 Martin Bosslet <Martin.Bosslet@googlemail.com>
+Wed Jul 10 23:29:22 2013 Zachary Scott <zachary@zacharyscott.net>
- * ext/openssl/ossl_asn1.c: Use OpenSSL constants V_ASN1_xxx instead of
- hardcoded numbers for initializing class_tag_map.
+ * lib/logger.rb: Use :call-seq: for method signature rdoc
-Sun May 22 21:29:29 2011 Hiroshi Nakamura <nahi@ruby-lang.org>
+Wed Jul 10 23:23:18 2013 Zachary Scott <zachary@zacharyscott.net>
- * include/ruby/defines.h (CASEFOLD_FILESYSTEM): Revert r30508. See #4255.
- Now __APPLE__ is not CASEFOLD_FILESYSTEM again.
+ * lib/logger.rb (#add): Remove incorrect rdoc for return value
+ [Bug #8567] Reported by Tim Pease.
- * load.c (loaded_feature_path, rb_feature_p, load_lock): Revert r30508.
- See #4255. Make $LOADED_FEATURES scanning case-sensitive again.
+Wed Jul 10 23:12:00 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Sun May 22 18:59:27 2011 Hiroshi Nakamura <nahi@ruby-lang.org>
+ * string.c (rb_str_subpos): make public function.
- * ext/openssl/ossl_asn1.c(ossl_asn1_default_tag): avoid using RCLASS_SUPER
- to make it compilable. Plus, tabify and change variable definition style.
+Wed Jul 10 22:44:19 2013 Tanaka Akira <akr@fsij.org>
-Sun May 22 18:26:43 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * bignum.c: Add a static assertion for RBIGNUM_EMBED_LEN_MAX.
- * gc.c (vm_xcalloc): use calloc provided by platforms.
- fixes #4754
+Wed Jul 10 22:31:25 2013 Masaki Matsushita <glass.saga@gmail.com>
-Sun May 22 11:44:53 2011 Eric Hodel <drbrain@segment7.net>
+ * string.c (rb_str_index): cache single byte flag and some
+ cosmetic changes.
- * ext/pty/pty.c: Improve documentation. Patch by David Copeland.
- [Ruby 1.9 - Bug #4756]
+Wed Jul 10 22:03:27 2013 Tanaka Akira <akr@fsij.org>
-Sun May 22 11:26:39 2011 Eric Hodel <drbrain@segment7.net>
+ * bignum.c (bary_2comp): Don't use bary_plus_one.
+ (bary_add_one): Replaced by the implementation of bary_plus_one.
- * lib/timeout.rb: Improve documentation. Patch by David Copeland.
- [Ruby 1.9 - Bug #4755]
+Wed Jul 10 20:48:22 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Sun May 22 11:21:41 2011 Eric Hodel <drbrain@segment7.net>
+ * bignum.c (sizeof_bdigit_dbl): check sizeof(BDIGIT_DBL).
- * lib/ipaddr.rb: Improve documentation. Patch by Sandor Szucs.
- [Ruby 1.9 - Bug #4753]
+ * internal.h (STATIC_ASSERT): move from enum.c.
-Sun May 22 11:14:40 2011 Eric Hodel <drbrain@segment7.net>
+Wed Jul 10 20:08:21 2013 Tanaka Akira <akr@fsij.org>
- * lib/forwardable.rb: Document def_delegator. Patch by Sandor Szucs.
- [Ruby 1.9 - Bug #4752]
+ * bignum.c (SIZEOF_BDIGIT_DBL): Add a ifdef guard for test.
-Sun May 22 11:11:41 2011 Eric Hodel <drbrain@segment7.net>
+Wed Jul 10 14:18:59 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * lib/fileutils.rb: Document block behavior of FileUtils.cd. Patch by
- Bil Kleb. [Ruby 1.9 - Bug #4751]
+ * process.c (fork_daemon): kill the other threads all and abandon the
+ kept mutexes.
-Sun May 22 11:07:47 2011 Eric Hodel <drbrain@segment7.net>
+Wed Jul 10 11:35:36 2013 NAKAMURA Usaku <usa@ruby-lang.org>
- * ext/curses/curses.c: Complete documentation. Patch by Vincent
- Batts. [Ruby 1.9 - Bug #4748]
+ * 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.
-Sun May 22 09:29:43 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+Wed Jul 10 10:20:07 2013 NARUSE, Yui <naruse@ruby-lang.org>
- * test/ruby/test_rubyoptions.rb (TestRubyOptions#test_set_program_name):
- use spawn. it prevent that other tests inherit renamed $0.
+ * tool/rbinstall.rb: always require rubygems to stabilize rubygems
+ related status like whether Gem::Specification is defined or not.
-Sun May 22 08:57:13 2011 Martin Bosslet <Martin.Bosslet@googlemail.com>
+ * tool/rbinstall.rb (Gem::Specification.unresolved_deps): define stub.
- * ext/openssl/ossl_asn1.c: Default tag lookup in constant time via hash
- instead of previous linear algorithm.
- [Ruby 1.9 - Feature #4309][ruby-core:34813]
+Wed Jul 10 08:21:15 2013 Eric Hodel <drbrain@segment7.net>
-Sun May 22 07:54:16 2011 Martin Bosslet <Martin.Bosslet@googlemail.com>
+ * lib/rubygems: Import RubyGems 2.1
+ * test/rubygems: Ditto.
- * ext/openssl/ossl_digest.c: Explain DSS and DSS1 in documentation.
+Wed Jul 10 07:34:34 2013 Eric Hodel <drbrain@segment7.net>
-Sun May 22 07:10:25 2011 Martin Bosslet <Martin.Bosslet@googlemail.com>
+ * 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.
- * test/openssl/test_pkey_dsa.rb: Add tests for sign/verify.
+ * lib/rubygems/psych_tree.rb (module Gem): Add backward compatibility
+ for r41148
-Sun May 22 06:07:17 2011 Martin Bosslet <Martin.Bosslet@googlemail.com>
+ * test/rubygems/test_gem_package.rb: Add backward compatibility for
+ double-slash elimination.
- * test/openssl/test_x509cert.rb: Merge DSA-related tests from ruby_1_8
- branch.
+Wed Jul 10 06:22:27 2013 Tadayoshi Funaba <tadf@dotrb.org>
-Sun May 22 04:11:12 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * ext/date/date_parse.c (date_zone_to_diff): [ruby-core:55831].
- * thread.c (Init_Thread): add a code comment why the meaningless
- line is necessary.
+Wed Jul 10 00:41:42 2013 Tanaka Akira <akr@fsij.org>
-Sun May 22 01:35:12 2011 Tadayoshi Funaba <tadf@dotrb.org>
+ * bignum.c (bary_mul): x*1 is x.
- * ext/date/date_core.c: modified documentation.
+Tue Jul 9 22:24:39 2013 Tanaka Akira <akr@fsij.org>
-Sat May 21 22:46:26 2011 Tadayoshi Funaba <tadf@dotrb.org>
+ * bignum.c (bary_mul1): No need to invoke MEMZERO at last.
+ (bary_mul_single): Invoke MEMZERO here.
- * ext/date/date_strftime(date_strftime_with_tmx): "%v" means "%e-%b-%Y".
+Tue Jul 9 21:40:01 2013 Kouhei Sutou <kou@cozmixng.org>
-Sat May 21 22:14:35 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * test/rexml/test_text.rb: Add missing tests for Text#<<.
+ Reported by nagachika. Thanks!!!
- * io.c (rb_io_extract_modeenc): accept combination hash and
- File::Constants. (eg. File.open('yo', :mode => File::WRONLY))
- [Feature #4742][ruby-core:36338]
- * test/ruby/test_io.rb (TestIO#test_open_mode): new test.
+Tue Jul 9 18:02:38 2013 Akinori MUSHA <knu@iDaemons.org>
-Sat May 21 21:44:14 2011 Tadayoshi Funaba <tadf@dotrb.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.
- * test/date/test_switch_hitter.rb: new.
+Tue Jul 9 17:58:26 2013 Akinori MUSHA <knu@iDaemons.org>
-Sat May 21 21:18:29 2011 Tadayoshi Funaba <tadf@dotrb.org>
+ * test/fileutils/test_fileutils.rb
+ (TestFileUtils#assert_output_lines): New utility assertion
+ method for testing verbose output.
- * ext/date/date_{core,parse}.c: moved nearly all core code from ext/date/lib.
- * ext/date/lib/{date,date/format}.rb: removed nearly all code.
+Tue Jul 9 17:43:57 2013 Koichi Sasada <ko1@atdot.net>
-Sat May 21 02:58:46 2011 Eric Hodel <drbrain@segment7.net>
+ * test/test_tracer.rb: catch up recent rubygems changes.
- * ext/.document: Add curses to documented extensions.
- * ext/curses/curses.c: Improve documentation. Patch by Vincent Batts.
- [Ruby 1.9 - Bug #4747]
+Tue Jul 9 16:58:30 2013 NAKAMURA Usaku <usa@ruby-lang.org>
-Sat May 21 02:51:01 2011 Eric Hodel <drbrain@segment7.net>
+ * 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).
- * ext/bigdecimal/lib/bigdecimal/util.rb: Improve documentation. Patch
- by Pete Higgins. [Ruby 1.9 - Bug #4746]
+Tue Jul 9 15:57:20 2013 Akinori MUSHA <knu@iDaemons.org>
-Sat May 21 02:44:10 2011 Eric Hodel <drbrain@segment7.net>
+ * object.c: Fix rdoc for Kernel#<=>. [Fixes GH-352]
- * ext/bigdecimal/lib/bigdecimal/jacobian.rb: Document isEqual. Patch
- by Kuba Fietkiewicz. [Ruby 1.9 - Bug #4744]
+Tue Jul 9 15:53:51 2013 Akinori MUSHA <knu@iDaemons.org>
-Sat May 21 02:22:34 2011 Eric Hodel <drbrain@segment7.net>
+ * lib/fileutils.rb (FileUtils#mode_to_s): Define mode_to_s() also
+ as singleton method, or FileUtils.chmod fails in verbose mode.
- * ext/date/lib/date/format.rb: Document date formats. Patch by
- Clinton Nixon. [Ruby 1.9 - Bug #4743]
+Tue Jul 9 15:16:02 2013 Akinori MUSHA <knu@iDaemons.org>
-Fri May 20 05:15:19 2011 Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
+ * test/fileutils/fileasserts.rb
+ (Test::Unit::FileAssertions#assert_not_symlink): Add a missing
+ optional argument "message".
- * gc.c: Fix build on m68k by 'error: too few arguments to
- function 'mark_locations_array''.
+Tue Jul 9 15:03:24 2013 Akinori MUSHA <knu@iDaemons.org>
-Fri May 20 04:23:42 2011 Eric Hodel <drbrain@segment7.net>
+ * lib/fileutils.rb (FileUtils#chown, FileUtils#chown_R): If user
+ and group are both nil, print ":".
- * lib/scanf.rb: Improve documentation. Patch by Gabe McArthur.
- [Ruby 1.9 - Bug #4735]
+Tue Jul 9 12:47:08 2013 Masaki Matsushita <glass.saga@gmail.com>
-Fri May 20 00:58:01 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * io.c (appendline): use READ_CHAR_PENDING_XXX macros and
+ RSTRING_END().
- * enc/trans/ibm737-tbl.rb: greek code page. fixes #4738
+ * io.c (rb_io_getline_1): rewrite nested if statement into one
+ statement.
-Thu May 19 14:44:05 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+Tue Jul 9 11:04:35 2013 NAKAMURA Usaku <usa@ruby-lang.org>
- * test/ruby/test_signal.rb (test_signal_requiring): skip on Windows.
- we can send SIGINT only to pid 0 and the process itself.
+ * ext/{dl,fiddle}/win32/lib/win32/registry.rb (Win32::Registry#check):
+ should report the position of the error.
-Thu May 19 09:07:08 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * ext/{dl,fiddle}/win32/lib/win32/registry.rb
+ (Win32::Registry#QueryValue): workaround for test-all crash.
- * lib: revert r31635-r31638 and untabify with expand(1).
+Tue Jul 9 10:27:56 2013 NAKAMURA Usaku <usa@ruby-lang.org>
-Thu May 19 07:47:26 2011 Martin Bosslet <Martin.Bosslet@googlemail.com>
+ * ext/{dl,fiddle}/win32/lib/win32/registry.rb
+ (Win32::Registry.expand_environ): use suitable encoding for the
+ string.
- * test/openssl/test_pkey_rsa.rb: Add tests for sign/verify.
+ * 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.
-Thu May 19 07:19:16 2011 Martin Bosslet <Martin.Bosslet@googlemail.com>
+Tue Jul 9 10:02:45 2013 NAKAMURA Usaku <usa@ruby-lang.org>
- * ext/openssl/ossl_pkey.c: Add documentation.
+ * ext/{dl,fiddle}/win32/lib/win32/registry.rb
+ (Win32::Registry::Error#initialize): use suitable encoding for the
+ string.
-Thu May 19 07:06:56 2011 Eric Hodel <drbrain@segment7.net>
+Tue Jul 9 09:46:53 2013 NAKAMURA Usaku <usa@ruby-lang.org>
- * lib/benchmark.rb: Fix indentation.
- * lib/net/imap.rb: Fix indentation of regular expressions.
+ * ext/dl/win32/lib/win32/registry.rb (Win32::Registry.expand_environ):
+ use suitable encoding for the string. fixed a test-all error of
+ r41838.
-Thu May 19 06:36:11 2011 Eric Hodel <drbrain@segment7.net>
+ * ext/fiddle/win32/lib/win32/registry.rb: same changes of r41838 and
+ this revision of dl's win32/registry.rb.
- * lib/net/imap.rb: Fix indentation of EOF for heredoc.
- * lib/debug.rb (Commands): Fix indentation of EOHELP for heredoc.
+Tue Jul 9 07:39:45 2013 Eric Hodel <drbrain@segment7.net>
-Thu May 19 06:30:38 2011 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
- * lib/mkmf.rb: Fix indentation of EOM for heredoc.
+Tue Jul 9 01:47:16 2013 Tanaka Akira <akr@fsij.org>
-Thu May 19 06:16:41 2011 Eric Hodel <drbrain@segment7.net>
+ * bignum.c (biglsh_bang): Don't shift a BDIGIT with BITSPERDIG bits.
+ (bigrsh_bang): Ditto.
- * lib: Convert tabs to spaces for ruby files per
- http://redmine.ruby-lang.org/projects/ruby/wiki/DeveloperHowto#coding-style
- Patch by Steve Klabnik [Ruby 1.9 - Bug #4730]
- Patch by Jason Dew [Ruby 1.9 - Feature #4718]
+Tue Jul 9 01:17:57 2013 Tanaka Akira <akr@fsij.org>
-Thu May 19 06:06:07 2011 Eric Hodel <drbrain@segment7.net>
+ * bignum.c (bigrsh_bang): Fix bignum digits overrun.
- * lib/cgi/util.rb: Improve documentation. Patch by Clinton Nixon.
- [Ruby 1.9 - Bug #4733]
- * lib/cgi/core.rb: ditto
- * lib/cgi/cookie.rb: ditto
+Tue Jul 9 00:46:22 2013 Tanaka Akira <akr@fsij.org>
-Thu May 19 06:02:21 2011 Eric Hodel <drbrain@segment7.net>
+ * bignum.c (biglsh_bang): Fix bignum digits under-run.
- * lib/tempfile.rb: Document Dir.mkdir and Dir.rmdir. Patch by Clinton
- Nixon. [Ruby 1.9 - Bug #4728]
+Mon Jul 8 23:36:45 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Thu May 19 05:57:52 2011 Eric Hodel <drbrain@segment7.net>
+ * ext/dl/win32/lib/win32/registry.rb (Error, API): use WCHAR
+ interfaces. c.f. [Bug #8508]
- * encoding.c: Improve documentation for Encoding#default_external and
- Encoding#default_internal.
+Mon Jul 8 23:13:11 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Wed May 18 22:45:26 2011 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]
- * ext/io/console/lib/console/size.rb (IO#console_size): new
- method. (EXPERIMENTAL)
+ * numeric.c (finite): add declaration for strict ANSI.
+ [ruby-core:55312] [Bug #8495]
-Wed May 18 22:41:51 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * 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]
- * internal.h: add for internal use only.
+ * win32/win32.c (gettimeofday): use __cdecl instead of _cdecl.
-Wed May 18 22:36:43 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Mon Jul 8 22:41:12 2013 Tanaka Akira <akr@fsij.org>
- * eval.c (setup_exception): internal exception should be hidden
+ * bignum.c (bary_mul): Arguments for work memory added.
+ (bary_mul_balance): Ditto.
+ (bary_mul_karatsuba): Ditto.
-Wed May 18 20:25:04 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+Mon Jul 8 22:03:30 2013 Tanaka Akira <akr@fsij.org>
- * lib/timeout.rb (Timeout#timeout): don't leak "execution expired"
- exception. [Bug #4283] [ruby-core:34534].
+ * bignum.c (rb_big_sq_fast): New function for testing.
+ (rb_big_mul_toom3): Ditto.
-Wed May 18 06:09:24 2011 Eric Hodel <drbrain@segment7.net>
+ * internal.h (rb_big_sq_fast): Declared.
+ (rb_big_mul_toom3): Ditto.
- * lib/cmath.rb: Add some examples and improve documentation. Patch by
- Sandor Szucs. [Ruby 1.9 - Bug #4727]
+Mon Jul 8 21:59:34 2013 Tanaka Akira <akr@fsij.org>
-Wed May 18 05:40:31 2011 Eric Hodel <drbrain@segment7.net>
+ * bignum.c (bary_mul_balance): Initialize a local variable to suppress
+ a warning.
- * lib/benchmark.rb: Remove nodoc from Benchmark::Job and
- Benchmark::Report. Patch by Sandor Szucs. [Ruby 1.9 - Bug #4726]
+Mon Jul 8 20:55:22 2013 Tanaka Akira <akr@fsij.org>
-Wed May 18 05:29:26 2011 Eric Hodel <drbrain@segment7.net>
+ * bignum.c (bary_mul_balance): Reduce work memory.
- * lib/webrick/compat.rb: Improve documentation. Patch by Sandor
- Szucs. [Ruby 1.9 - Bug #4725]
+Mon Jul 8 08:26:15 2013 Martin Bosslet <Martin.Bosslet@gmail.com>
-Wed May 18 05:10:35 2011 Eric Hodel <drbrain@segment7.net>
+ * test/openssl/test_pkey_ec.rb: Skip tests for "Oakley" curves as
+ they are not suitable for ECDSA.
+ [ruby-core:54881] [Bug #8384]
- * lib/tracer.rb: Improve documentation. Patch by Richard Ramsden.
- [Ruby 1.9 - Feature #4720]
+Mon Jul 8 08:03:01 2013 Tanaka Akira <akr@fsij.org>
-Wed May 18 04:53:41 2011 Eric Hodel <drbrain@segment7.net>
+ * bignum.c (bary_mul): Add a RB_GC_GUARD.
- * lib/cmath.rb: Improve documentation. Patch by Jason Dew.
- [Ruby 1.9 - Feature #4717]
+Sun Jul 7 23:56:32 2013 Tanaka Akira <akr@fsij.org>
-Wed May 18 04:50:24 2011 Eric Hodel <drbrain@segment7.net>
+ * bignum.c (bary_mul_karatsuba): Unreachable code removed. Remove
+ several branches.
- * lib/net/ftp.rb: Improve documentation. Patch by Vincent Batts.
- [Ruby 1.9 - Bug #4710]
+Sun Jul 7 22:59:06 2013 Tanaka Akira <akr@fsij.org>
-Wed May 18 03:14:49 2011 Eric Hodel <drbrain@segment7.net>
+ * internal.h (rb_big_mul_normal): Declared.
+ (rb_big_mul_balance): Ditto.
+ (rb_big_mul_karatsuba): Ditto.
- * test/test_singleton.rb: Add tests from lib/singleton.rb. Patch by
- Pete Higgins. [Ruby 1.9 - Bug #4715]
+ * bignum.c (rb_big_mul_normal): New function for tests.
+ (rb_big_mul_balance): Ditto.
+ (rb_big_mul_karatsuba): Ditto.
-Wed May 18 03:03:07 2011 Eric Hodel <drbrain@segment7.net>
+Sun Jul 7 19:21:30 2013 Tanaka Akira <akr@fsij.org>
- * lib/singleton.rb: Improve documentation. Patch by Pete Higgins.
- [Ruby 1.9 - Bug #4709]
+ * bignum.c: Reorder functions to decrease forward reference.
-Tue May 17 21:24:04 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+Sun Jul 7 14:41:57 2013 Tanaka Akira <akr@fsij.org>
- * thread.c (rb_mutex_lock): remove remove_signal_thread_list() call.
- It's meaningless because lock_interrupt doesn't call
- add_signal_thread_list().
+ * 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.
-Tue May 17 20:20:49 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+Sun Jul 7 11:54:33 2013 Kouhei Sutou <kou@cozmixng.org>
- * vm_core.h (rb_thread_struct): add volatile to
- transition_for_lock because it is not protected by lock.
+ * NEWS: Add REXML::Text#<< related updates.
-Tue May 17 20:08:53 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+Sun Jul 7 11:49:19 2013 Kouhei Sutou <kou@cozmixng.org>
- * LEGAL (missing/{elf,tgamma,lgamma_r}.c): they've been replaced by
- public domain implementations.
+ * lib/rexml/text.rb (REXML::Text#<<): Support appending in not
+ "raw" mode. [Bug #8602] [ruby-dev:47482]
+ Reported by Ippei Obayashi. Thanks!!!
- * LEGAL (vsnprintf.c): it has moved to srcdir from missing/.
+Sun Jul 7 11:43:13 2013 Kouhei Sutou <kou@cozmixng.org>
- * LEGAL (missing/crypt.c): list its original license.
+ * lib/rexml/text.rb (REXML::Text#<<): Support method chain use by "<<"
+ like other objects.
-Tue May 17 19:54:26 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+Sun Jul 7 11:34:18 2013 Kouhei Sutou <kou@cozmixng.org>
- * LEGAL (configure): add missing/setproctitle.c
+ * lib/rexml/text.rb (REXML::Text#clear_cache): Extract common
+ cache clear code.
-Tue May 17 19:35:01 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
- Fix FreeBSD test failure.
+Sun Jul 7 11:01:03 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * test/ruby/test_rubyoptions.rb (TestRubyOptions#test_set_program_name):
- use ps -o command instead of ps -o cmd. FreeBSD doesn't support
- -o cmd option.
+ * 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].
-Tue May 17 08:04:26 2011 Martin Bosslet <Martin.Bosslet@googlemail.com>
+Sun Jul 7 10:07:22 2013 Tanaka Akira <akr@fsij.org>
- * ext/openssl/ossl_digest.c: Add documentation.
+ * 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.
-Tue May 17 07:14:58 2011 Eric Hodel <drbrain@segment7.net>
+Sat Jul 6 07:37:43 2013 Martin Bosslet <Martin.Bosslet@gmail.com>
- * lib/net/http.rb: Improve documentation of proxy configuration
- methods. Patch by Alf Mikula. [Ruby 1.9 - Bug #4714]
+ * 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]
-Tue May 17 07:09:01 2011 Eric Hodel <drbrain@segment7.net>
+ Thanks to Vit Ondruch for providing the patch!
- * lib/net/pop.rb: Improve documentation. Patch by Vincent Batts.
- [Ruby 1.9 - Bug #4711]
- * lib/net/telnet.rb: ditto
+Sat Jul 6 07:12:39 2013 Martin Bosslet <Martin.Bosslet@gmail.com>
-Tue May 17 07:00:41 2011 Eric Hodel <drbrain@segment7.net>
+ * test/openssl/test_x509crl.rb: Remove unused variable.
+ [ruby-core:53501] [Bug #8114]
- * lib/net/http.rb: Fix nodoc for Net::HTTP::version_1_1?. Patch by
- Alf Mikula. [Ruby 1.9 - Bug #4713]
+ Thanks, Vipul Amler, for pointing this out!
-Tue May 17 06:56:26 2011 Eric Hodel <drbrain@segment7.net>
+Sat Jul 6 06:37:10 2013 Martin Bosslet <Martin.Bosslet@gmail.com>
- * lib/optparse.rb: Add link to make_switch to improve documentation.
- Patch by David Copeland. [Ruby 1.9 - Bug #4708]
+ * 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]
-Tue May 17 06:50:40 2011 Eric Hodel <drbrain@segment7.net>
+ Thanks, Dirkjan Bussink, for the patch!
- * lib/observer.rb: Improve documentation. Patch by David Copeland.
- [Ruby 1.9 - Bug #4707]
+Sat Jul 6 06:06:16 2013 Martin Bosslet <Martin.Bosslet@gmail.com>
-Tue May 17 06:42:53 2011 Eric Hodel <drbrain@segment7.net>
+ * 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/logger.rb: Improve documentation. Patch by David Copeland.
- [Ruby 1.9 - Bug #4706]
+ [id, criticality, octet_string] if critical,
+ [id, octet_string] if not.
-Tue May 17 06:28:14 2011 Eric Hodel <drbrain@segment7.net>
+ Making sure to pick the last element of X509 extension and use it as
+ SAN value.
+ [ruby-core:55685] [Bug #8575]
- * lib/gserver.rb: Improve documentation. Patch by David Copeland.
- [Ruby 1.9 - Bug #4705]
+ Thank you @nahi for providing the patch!
-Tue May 17 06:21:15 2011 Eric Hodel <drbrain@segment7.net>
+Sat Jul 6 04:49:38 2013 Aaron Patterson <aaron@tenderlovemaking.com>
- * lib/cgi.rb: Add toplevel documentation to class CGI
- * lib/cgi/session.rb: Add overview documentation to CGI::Cookie
- * lib/cgi/html.rb: Don't add CGI::TagMaker documentation to CGI.
- Patch by David Copeland. [Ruby 1.9 - Bug #4704]
- * lib/cgi/core.rb: Clean up CGI documentation. Patch by David
- Copeland. [Ruby 1.9 - Bug #4704]
- * lib/cgi/cookie.rb: Clean up CGI::Cookie documentation. Patch by
- David Copeland. [Ruby 1.9 - Bug #4704]
+ * 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.
-Tue May 17 05:52:30 2011 Eric Hodel <drbrain@segment7.net>
+Fri Jul 5 20:46:39 2013 NAKAMURA Usaku <usa@ruby-lang.org>
- * ext/digest: Improve documentation of Digest, Digest::HMAC and
- Digest::SHA2. Patch by Pete Higgins. [Ruby 1.9 - Bug #4702]
+ * 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.
-Tue May 17 03:51:42 2011 Eric Hodel <drbrain@segment7.net>
+Fri Jul 5 19:05:40 2013 Akinori MUSHA <knu@iDaemons.org>
- * lib/abbrev.rb: Hide copyright and revision information from RDoc.
- Inspired by patch from David Copeland, bug #4703.
+ * 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".
-Tue May 17 03:33:21 2011 Eric Hodel <drbrain@segment7.net>
+Fri Jul 5 16:21:56 2013 Akinori MUSHA <knu@iDaemons.org>
- * lib/timeout.rb (module Timeout): Hide internal constants. Patch by
- Pete Higgins. [Ruby 1.9 - Bug #4701]
+ * 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
-Mon May 16 11:21:09 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+ * 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.
- * configure.in, win32/Makefile.sub (RUBY_SO_NAME): add CPU as prefix
- of RUBY_SO_NAME on x64/ia64 mswin/mingw.
- [Feature #4602]
+Fri Jul 5 12:14:40 2013 NAKAMURA Usaku <usa@ruby-lang.org>
-Mon May 16 08:00:05 2011 Eric Hodel <drbrain@segment7.net>
+ * test/ruby/test_rubyoptions.rb (TestRubyOptions#test_notfound): after
+ r41710, the path of command uses backslash as the separator on
+ Windows.
- * lib/rdoc.rb: Update to RDoc 3.6.1, allows OpenSSL::Digest to be
- found.
+Fri Jul 5 11:29:47 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Mon May 16 05:49:54 2011 Eric Hodel <drbrain@segment7.net>
+ * lib/test/unit/assertions.rb (assert_raise_with_message): move from
+ test/fileutils/test_fileutils.rb. this is still experimental and
+ the interface may be changed.
- * lib/drb/acl.rb: Add documentation.
+Fri Jul 5 11:08:00 2013 NAKAMURA Usaku <usa@ruby-lang.org>
-Mon May 16 05:13:20 2011 Martin Bosslet <Martin.Bosslet@googlemail.com>
+ * 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.
- * ext/openssl/ossl_asn1.c: Add documentation.
+Fri Jul 5 09:53:15 2013 NARUSE, Yui <naruse@ruby-lang.org>
+ * lib/mkmf.rb (CONFIG['CPPOUTFILE']): fix r41769; CONFIG['CPPOUTFILE']
+ may be nil.
-Mon May 16 00:32:05 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+Fri Jul 5 05:39:53 2013 Tanaka Akira <akr@fsij.org>
- * test/ruby/test_signal.rb (TestSignal#test_signal_process_group):
- skip if the platform doesn't have :pgroup capability. (i.e. skip
- if mswin32)
+ * bignum.c (BARY_MUL1): Renamed from BARY_MUL.
+ (bary_mul1): Renamed from bary_mul.
+ (bary_mul): Renamed from bary_mul2.
-Sun May 15 23:53:31 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+Fri Jul 5 04:58:05 2013 Tanaka Akira <akr@fsij.org>
- * include/ruby/intern.h: resurrect old rb_fd_copy().
- * thread.c (rb_fd_copy): ditto.
+ * bignum.c (bary_mul_balance): Extracted from bigmul1_balance and
+ use bary_mul2 and bary_add to decrease allocations.
-Sun May 15 23:45:11 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+Fri Jul 5 02:14:00 2013 Akinori MUSHA <knu@iDaemons.org>
- * include/ruby/intern.h: remove rb_fd_copy() to rb_fd_dup() and
- rb_w32_fdcopy() to rb_w32_fd_dup().
- * win32/win32.c: ditto.
- * thread.c: ditto.
+ * 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.
-Sun May 15 22:26:39 2011 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
+ * 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.
- * signal.c (rb_f_kill): accept '-SIGXXX' style signal with Symbol or
- implicit convertion with #to_str. [ruby-dev:43169] fixes #4362
- * test/ruby/test_signal.rb (test_signal_process_group): add a test
- for send signal to process group.
+Fri Jul 5 00:25:39 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Sun May 15 21:22:35 2011 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
+ * lib/mkmf.rb (have_framework): allow header file to check.
+ [ruby-core:55745] [Bug #8593]
- * cont.c (cont_init): clear macihne_stack_start/end of saved thread to
- prevent mark machine stack of GC'ed Thread. root Fiber is not
- initialized by fiber_init().
- based on a patch by Serge Balyuk [ruby-core:35891] fixes #4612
- * test/ruby/test_fiber.rb (test_gc_root_fiber): add test for it.
+Thu Jul 4 22:31:00 2013 Charlie Somerville <charliesome@ruby-lang.org>
-Sun May 15 21:04:29 2011 Nobuyoshi Nakada <nobu@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
- * transcode.c (econv_init): revert r31353. [ruby-dev:43512]
+Thu Jul 4 20:39:20 2013 Tanaka Akira <akr@fsij.org>
-Sun May 15 03:39:35 2011 Eric Hodel <drbrain@segment7.net>
+ * tool/make-snapshot: Exit with EXIT_FAILURE when it fails.
- * ext/zlib/zlib.c: Improve documentation. Patch by Vincent Batts.
- [Ruby 1.9 - Bug #4695]
+Thu Jul 4 20:20:23 2013 Tanaka Akira <akr@fsij.org>
-Sun May 15 03:23:46 2011 Eric Hodel <drbrain@segment7.net>
+ * bignum.c (maxpow_in_bdigit_dbl): Use tables if available.
+ (maxpow_in_bdigit): Ditto.
+ (U16): New macro.
+ (U32): Ditto.
+ (U64): Ditto.
+ (U128): Ditto.
+ (maxpow16_exp): New table.
+ (maxpow16_num): New table.
+ (maxpow32_exp): New table.
+ (maxpow32_num): New table.
+ (maxpow64_exp): New table.
+ (maxpow64_num): New table.
+ (maxpow128_exp): New table.
+ (maxpow128_num): New table.
- * lib/erb.rb: Document ERB::Compiler. Patch by Simon Chiang.
- [Ruby 1.9 - Bug #4694]
+Thu Jul 4 18:25:25 2013 Tanaka Akira <akr@fsij.org>
-Sun May 15 00:58:47 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
- fix mswin32 build error.
+ * bignum.c (rb_cstr_to_inum): Avoid temporary buffer allocation except
+ very big base non-power-of-2 numbers.
- * missing/setproctitle.c: add #ifdef HAVE_UNISTD_H.
- * win32/Makefile.sub (MISSING): add setproctitle.obj
+Thu Jul 4 15:51:56 2013 NARUSE, Yui <naruse@ruby-lang.org>
-Sat May 14 22:45:28 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * string.c (rb_str_succ): use ONIGENC_MBCLEN_CHARFOUND_P correctly.
- * missing/setproctitle.c: add to include "ruby/util.h".
+ * string.c (rb_str_dump): ditto.
-Sat May 14 19:52:22 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+Thu Jul 4 10:04:11 2013 NARUSE, Yui <naruse@ruby-lang.org>
- * test/ruby/test_rubyoptions.rb (TestRubyOptions#test_set_program_name):
- add for $0 test.
+ * regcomp.c (): Merge Onigmo 5.13.5 23b523076d6f1161.
-Sat May 14 19:50:46 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * [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.
- * missing/setproctitle.c (compat_init_setproctitle): use
- ruby_strdup() instead of strdup().
+Thu Jul 4 00:36:03 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Sat May 14 19:37:31 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * internal.h (SIGNED_INTEGER_MAX): suppress warning C4146 on VC6.
+ seems a logical ORed expression becomes unsigned.
- * include/ruby/missing.h: add setproctitle() declaration.
- * missing/setproctitle.c: added.
- * configure.in: add check for missing/setproctitle.c.
+Thu Jul 4 00:13:01 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * ruby.c (ruby_process_options): add to call compat_init_setproctitle().
- * ruby.c (set_arg0): remove all platform specific code. it's
- moved to missing/setproctitle.c.
- * ruby.c (origarg): remove len field. It's no longer used.
- * ruby.c (get_arglen): removed.
+ * ruby_atomic.h (rb_w32_atomic_cas): call InterlockedCompareExchange
+ directly.
- This patch makes a lot of cleanup set_arg0 related code and fixes
- [Feature #4689].
+ * ruby_atomic.h (ATOMIC_CAS): fix missing function call.
-Sat May 14 17:42:21 2011 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
+Wed Jul 3 23:47:35 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * process.c (rb_proc_times): improve documentation.
- [ruby-core:35785] fixes #4581, reported by Andrew Grimm.
+ * ruby_atomic.h (ATOMIC_CAS): suppress C4022 and C4047 warnings in
+ VC6. only InterlockedCompareExchange is declared using PVOID.
-Sat May 14 12:12:54 2011 Martin Bosslet <Martin.Bosslet@googlemail.com>
+Wed Jul 3 22:29:20 2013 Tanaka Akira <akr@fsij.org>
- * test/openssl/test_pkey_dsa.rb: Add basic tests and tests that
- ensure new public key PEM encoding behavior and ensure backward
- compatibility.
- [Ruby 1.9 - Bug #4422] [ruby-core:35328]
- * test/openssl/test_pkey_rsa.rb: Remove line with 'puts'.
+ * internal.h (ruby_digit36_to_number_table): Declared.
-Sat May 14 12:06:49 2011 Eric Hodel <drbrain@segment7.net>
+ * util.c (ruby_digit36_to_number_table): Moved from scan_digits.
- * lib/rdoc/context.rb (class RDoc): Fix infinite loop caused by
- re-encountering BasicObject.
+ * bignum.c (conv_digit): Use ruby_digit36_to_number_table.
-Sat May 14 10:32:36 2011 Martin Bosslet <Martin.Bosslet@googlemail.com>
+ * pack.c (hex2num): Ditto.
- * test/openssl/test_pkey_rsa.rb: Add tests that ensure new public key
- encoding behavior and also ensure backward compatibility.
- [Ruby 1.9 - Bug #4421] [ruby-core:35327]
+Wed Jul 3 18:12:56 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Sat May 14 09:50:10 2011 Eric Hodel <drbrain@segment7.net>
+ * lib/mkmf.rb (install_dirs): revert DESTDIR prefix by r39841, since
+ it is fixed by r41648. [ruby-core:55760] [Bug #8115]
- * lib/yaml/dbm.rb: Add documentation. Patch by Justin Collins.
- [Ruby 1.9 - Bug #4693]
- * lib/yaml/store.rb: ditto
+Wed Jul 3 14:15:25 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Sat May 14 09:31:43 2011 Eric Hodel <drbrain@segment7.net>
+ * 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]
- * lib/rdoc.rb: Updated to RDoc 3.6
+Wed Jul 3 12:06:42 2013 Tanaka Akira <akr@fsij.org>
-Sat May 14 07:30:29 2011 Aaron Patterson <aaron@tenderlovemaking.com>
+ * bignum.c (maxpow_in_bdigit): Renamed from calc_hbase and return
+ maxpow.
- * ext/psych/lib/psych.rb: released a new gem, so increasing version.
+Tue Jul 2 23:47:50 2013 Tanaka Akira <akr@fsij.org>
-Sat May 14 05:08:32 2011 Martin Bosslet <Martin.Bosslet@googlemail.com>
+ * bignum.c (roomof): Cast to long.
+ (rb_ull2big): Fix bignew arguments.
- * ext/openssl/ossl_digest.c
- * ext/openssl/ossl_pkey.c
- * ext/openssl/ossl_pkey.h
- * test/openssl/pkey/test_pkey_rsa.rb
- Reverted premature commit. Sorry for the noise!
+Tue Jul 2 21:17:37 2013 Tanaka Akira <akr@fsij.org>
-Sat May 14 05:02:58 2011 Eric Hodel <drbrain@segment7.net>
+ * bignum.c (rb_cstr_to_inum): Merge two temporary buffers.
- * lib/uri.rb: Add toplevel documentation. Patch by Vincent Batts.
- [Ruby 1.9 - Bug #4690]
+Tue Jul 2 20:25:04 2013 Tanaka Akira <akr@fsij.org>
-Sat May 14 04:19:06 2011 Martin Bosslet <Martin.Bosslet@googlemail.com>
+ * bignum.c (rb_cstr_to_inum): Use BDIGIT_DBL to collect adjacent digits.
+ (BDIGIT_DBL_MAX): New macro.
+ (maxpow_in_bdigit_dbl): New function.
- * NEWS: Describe altered behaviour for RSA and DSA public key
- encoding. [Ruby 1.9 - Bug #4421, Bug #4422]
- [ruby-core:35327,35328]
+Tue Jul 2 17:23:33 2013 Shugo Maeda <shugo@ruby-lang.org>
-Sat May 14 02:57:52 2011 Eric Hodel <drbrain@segment7.net>
+ * doc/syntax/refinements.rdoc: add description of Module#using and
+ refinement inheritance by module inclusion.
- * lib/ipaddr.rb (unless Socket): Document valid*? methods. Patch by
- Sebastian Martinez. [Ruby 1.9 - Feature #4687]
+Tue Jul 2 17:22:44 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Sat May 14 02:54:04 2011 Eric Hodel <drbrain@segment7.net>
+ * internal.h: add EUC-JP and Windows-31J.
- * lib/rexml/functions.rb: Add some documentation for REXML::Functions.
- Patch by Sebastian Martinez. [Ruby 1.9 - Feature #4688]
+ * re.c (rb_char_to_option_kcode): use built-in encoding indexes in
+ internal.h.
-Sat May 14 02:51:42 2011 Eric Hodel <drbrain@segment7.net>
+ * internal.h: add UTF8-MAC.
- * lib/resolv.rb: Hide private method and state-tracking constants from
- RDoc. Patch by Mark Turner. [Ruby 1.9 - Feature #4691]
+ * dir.c (rb_utf8mac_encoding): use built-in encoding indexes in
+ internal.h.
-Fri May 13 19:23:21 2011 URABE Shyouhei <shyouhei@ruby-lang.org>
+ * internal.h: add UTF-{16,32} dummy encodings.
- * numeric.c (flo_coerce): Add #flo_coerce documentation.
- Patch by Sebastian Martinez.
- https://github.com/ruby/ruby/pull/21
+ * string.c (rb_str_inspect, str_scrub0): use built-in encoding indexes
+ in internal.h.
-Fri May 13 18:42:22 2011 URABE Shyouhei <shyouhei@ruby-lang.org>
+ * internal.h: add UTF-{16,32}{BE,LE}.
- * README.EXT: fix typo. Patch by William Blackerby.
- https://github.com/ruby/ruby/pull/19
+ * io.c (io_strip_bom): use built-in encoding indexes in internal.h.
- * README.EXT.ja: ditto.
+ * internal.h (rb_{ascii8bit,utf8,usascii}_encindex): use built-in
+ encoding indexes for optimization.
-Fri May 13 15:22:34 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+ * encoding.c (enc_inspect, rb_locale_encindex),
+ (enc_set_filesystem_encoding, rb_filesystem_encindex): use built-in
+ encoding indexes directly.
- * win32/win32.c (rb_w32_select): check invalid handle before doing
- select operations. see [ruby-dev:43513], [ruby-dev:43535]
+ * encoding.c (rb_enc_set_index, rb_enc_associate_index): validate
+ argument encoding index.
-Fri May 13 08:34:00 2011 Eric Hodel <drbrain@segment7.net>
+ * include/ruby/encoding.h (ENCODING_SET): use rb_enc_set_index()
+ instead of setting inlined bits directly.
- * lib/rdoc/rdoc.rb: Output summary after documentation report.
- * lib/rdoc/stats/normal.rb: Don't output information for users when
- we're not on a TTY
+ * encoding.c (rb_enc_init): register preserved indexes.
-Fri May 13 07:49:02 2011 Eric Hodel <drbrain@segment7.net>
+ * internal.h (ruby_preserved_encindex): move from encoding.c.
- * lib/fileutils.rb: Hide internal methods from RDoc. Patch by Darragh
- Curran. [Ruby 1.9 - Bug #4684]
+Tue Jul 2 11:14:36 2013 Shota Fukumori <sorah@cookpad.com>
-Fri May 13 07:36:23 2011 Eric Hodel <drbrain@segment7.net>
+ * lib/mkmf.rb (try_config): Fix to not replace $LDFLAGS with $libs
+ (1.9.3 behavior) [ruby-core:55752] [Bug #8595]
- * lib/webrick/httpservlet/erbhandler.rb: Add documentation.
+Tue Jul 2 00:39:59 2013 Tanaka Akira <akr@fsij.org>
-Fri May 13 07:04:33 2011 Eric Hodel <drbrain@segment7.net>
+ * ext/socket/ipsocket.c (init_inetsock_internal): Don't try mismatched
+ address family if already failed.
- * lib/mathn.rb: Fix indentation. Patch by Jason Dew.
- [Ruby 1.9 - Feature #4682]
+Mon Jul 1 23:07:38 2013 NARUSE, Yui <naruse@ruby-lang.org>
-Fri May 13 06:50:43 2011 Eric Hodel <drbrain@segment7.net>
+ * template/encdb.h.tmpl: define encoding index macros to use the index
+ statically from C source.
- * lib/mathn.rb: Add documentation. Patch by Jason Dew. [Ruby 1.9 -
- Feature #4667]
+Mon Jul 1 22:57:19 2013 Tanaka Akira <akr@fsij.org>
-Fri May 13 05:44:19 2011 Eric Hodel <drbrain@segment7.net>
+ * bignum.c (bary_mul2): New function.
+ (rb_cstr_to_inum): Use a better algorithm to compose the result
+ if input length is very long.
- * lib/logger.rb (class Logger): Document Logger#datetime_format.
- Patch by Sergio Gil Perez de la Manga. [Ruby 1.9 - Bug #4678]
+Mon Jul 1 20:22:00 2013 Kenta Murata <mrkn@cookpad.com>
-Fri May 13 05:39:11 2011 Eric Hodel <drbrain@segment7.net>
+ * ext/bigdecimal/bigdecimal.h (RB_UNUSED_VAR, UNREACHABLE):
+ import macros from ruby.h for 1.9.3.
+ [Bug #8588] [ruby-core:55730]
- * re.c (Init_Regexp): Document option constants. Patch by Vincent
- Batts. [Ruby 1.9 - Bug #4677]
- * lib/uri/common.rb (module URI): Documentation for URI. Patch by
- Vincent Batts. [Ruby 1.9- Bug #4677]
- * lib/uri/ftp.rb (module URI): ditto
- * lib/uri/generic.rb (module URI): ditto
- * lib/uri/http.rb (module URI): ditto
- * lib/uri/https.rb (module URI): ditto
- * lib/uri/ldap.rb (module URI): ditto
- * lib/uri/ldaps.rb (module URI): ditto
- * lib/uri/mailto.rb (module URI): ditto
- * process.c (Init_process): Document Process constants. Patch by
- Vincent Batts. [Ruby 1.9- Bug #4677]
+ * ext/bigdecimal/bigdecimal.gemspec: Bump version to 1.2.1.
-Fri May 13 05:16:38 2011 Eric Hodel <drbrain@segment7.net>
+Mon Jul 1 20:03:39 2013 Tanaka Akira <akr@fsij.org>
- * lib/rss/atom.rb (module RSS): Document URIs. Patch by Mark Turner.
- [Ruby 1.9 - #4671]
- * lib/rss/rss.rb (module RSS): Document exception classes. Patch by
- Mark Turner. [Ruby 1.9 - #4671]
+ * 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.
-Fri May 13 02:15:18 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+Mon Jul 1 15:05:00 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * io.c (select_internal): remove unused variable (interrupt_flag).
+ * lib/csv.rb (CSV#<<): use StringIO#set_encoding instead of creating
+ new StringIO instance with String#force_encoding, forcing encoding
+ discards the cached coderange bits and can make further operations
+ very slow. [ruby-core:55714] [Bug #8585]
-Thu May 12 18:24:34 2011 Kouhei Sutou <kou@clear-code.com>
+ * ext/stringio/stringio.c (strio_write): keep coderange of
+ ptr->string.
- * configure.in: limit to "T" type for prefix of external symbols
- because x86_64-w64-mingw32-gcc on Debian GNU/Linux generates the
- following symbol:
- 0000000068483390 D _GLOBAL__F__conftest_external
+ * 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.
- Approved by nobu.
+Mon Jul 1 12:56:41 2013 Shugo Maeda <shugo@ruby-lang.org>
-Thu May 12 14:50:52 2011 NAKAMURA Usaku <usa@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/dl/test_base.rb (Fiddle::LIBC_SO): its always msvc*.dll on
- mswin/mingw.
+ * test/ruby/test_refinement.rb: related test.
-Thu May 12 14:47:53 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+Mon Jul 1 12:02:39 2013 Tanaka Akira <akr@fsij.org>
- * lib/mkmf.rb (Logging.postpone): copy only when temporary logfile
- exists.
+ * bignum.c (rb_cstr_to_inum): Skip leading zeros.
-Thu May 12 12:24:22 2011 Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
+Mon Jul 1 00:59:23 2013 Tanaka Akira <akr@fsij.org>
- * ext/openssl/ossl_ssl.c: By trunk@31346, function check of SSLv2 is
- executed.
- However, the problem is not revised in this.
- This adds the control of using function of SSLv2 in made macro by
- function check.
+ * 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.
-Thu May 12 08:10:46 2011 Eric Hodel <drbrain@segment7.net>
+Sun Jun 30 22:40:00 2013 Charlie Somerville <charliesome@ruby-lang.org>
- * lib/set.rb (class Set): Add nodoc to internal-use methods. Patch
- by Pete Higgins. [Ruby 1.9 - Bug #4665]
+ * lib/prime.rb: Corrected a few comments. Patch by @Nullset14.
+ Fixes GH-346.
-Thu May 12 08:01:14 2011 Martin Bosslet <Martin.Bosslet@googlemail.com>
+Sun Jun 30 21:53:38 2013 Tanaka Akira <akr@fsij.org>
- * ext/openssl/ossl_pkey_ec.c: Allow encryption when PEM-encoding
- Elliptic Curve private keys.
- [ruby-core:35329] [Bug #4423]
+ * bignum.c (rb_cstr_to_inum): Use rb_integer_unpack if base is a power
+ of 2.
-Thu May 12 07:54:59 2011 Eric Hodel <drbrain@segment7.net>
+Sun Jun 30 10:59:23 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * object.c (rb_obj_equal): Add documentation. Patch by Vincent Batts.
- [Ruby 1.9 - Bug #4664]
- * lib/rexml: ditto
- * lib/mkmf.rb: ditto
- * ext/socket/lib/socket.rb: ditto
+ * 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]
-Thu May 12 07:30:08 2011 Eric Hodel <drbrain@segment7.net>
+ * io.c (spawnv, spawn): use UTF-8 spawn family. [Bug #1771]
- * Various .document files: Update .document files to match files which
- have documentation.
+ * process.c (proc_exec_sh, proc_spawn_cmd, proc_spawn_sh): ditto.
-Thu May 12 07:18:45 2011 Martin Bosslet <Martin.Bosslet@googlemail.com>
+ * win32/win32.c (translate_char, join_argv, has_redirection): make
+ codepage aware.
- * ext/openssl/ossl_pkey_dsa.c: Use generic X.509 SubjectPublicKeyInfo
- format for PEM-encoding DSA public keys.
- [ruby-core:35328] [Bug #4422]
+ * win32/win32.c (rb_w32_udln_find_exe_r, rb_w32_udln_find_file_r):
+ codepage independent versions.
-Thu May 12 06:27:31 2011 Martin Bosslet <Martin.Bosslet@googlemail.com>
+ * win32/win32.c (w32_spawn): extract codepage aware code from
+ rb_w32_spawn().
- * ext/openssl/ossl_pkey_rsa.c: Use generic X.509 SubjectPublicKeyInfo
- format for encoding RSA public keys.
- [ruby-core:35327] [Bug #4421]
+ * win32/win32.c (rb_w32_uspawn): add UTF-8 version function.
-Wed May 11 19:45:27 2011 Keiju Ishitsuka <keiju@ishitsuka.com>
+ * win32/win32.c (w32_aspawn_flags): extract codepage aware code from
+ rb_w32_aspawn_flags().
- * lib/forwardable.rb: support 'delegate :foo => :bar' for to meet
- by specification of RDOC.
+ * win32/win32.c (rb_w32_uaspawn_flags, rb_w32_uaspawn_flags): add
+ UTF-8 version functions.
-Wed May 11 08:36:38 2011 Eric Hodel <drbrain@segment7.net>
+ * win32/win32.c (w32_getenv): extract codepage aware code from
+ rb_w32_ugetenv() and rb_w32_getenv().
- * lib/webrick: Add documentation for WEBrick::HTTPAuth
+ * win32/win32.c (w32_stati64): extract codepage aware code from
+ rb_w32_ustati64() and rb_w32_stati64().
-Wed May 11 03:06:35 2011 Eric Hodel <drbrain@segment7.net>
+ * dln.h (DLN_FIND_EXTRA_ARG, DLN_FIND_EXTRA_ARG_DECL): allow extra
+ arguments to dln_find_{exe,file}_r().
- * lib/rss.rb: Add documentation for RSS. Patch by Steve Klabnik.
- [Ruby 1.9 - Bug #4663]
+ * dln_find.c (dln_find_exe_r, dln_find_file_r): add extract arguments.
-Tue May 10 14:50:32 2011 Shota Fukumori <sorah@tubusu.net>
+ * process.c (EXPORT_STR, EXPORT_DUP): convert to default process
+ encoding if defined.
- * lib/test/unit.rb: Add option for hiding skip messages when test
- ends. #4657
+ * process.c (check_exec_env_i): convert environment variables too.
- * test/testunit/test_hideskip.rb, test/testunit/test4test_hideskip.rb:
- test for above.
+ * process.c (rb_exec_fillarg): convert program path and arguments too.
-Tue May 10 10:53:04 2011 Eric Hodel <drbrain@segment7.net>
+Sun Jun 30 01:57:08 2013 Tanaka Akira <akr@fsij.org>
- * common.mk (rdoc): Add rdoc-coverage rule
+ * bignum.c (big_rshift): Use abs2twocomp and twocomp2abs_bang.
-Tue May 10 09:13:21 2011 Eric Hodel <drbrain@segment7.net>
+Sun Jun 30 00:14:20 2013 Tanaka Akira <akr@fsij.org>
- * lib/webrick: Add Documentation
+ * bignum.c (RBIGNUM_SET_NEGATIVE_SIGN): New macro.
+ (RBIGNUM_SET_POSITIVE_SIGN): Ditto.
+ (rb_big_neg): Inline get2comp to avoid double negation.
-Tue May 10 04:22:09 Eric Hodel <drbrain@segment7.net>
+Sat Jun 29 23:26:41 2013 Tanaka Akira <akr@fsij.org>
- * lib/webrick/log.rb: Hide copyright info from ri
- * lib/webrick/httpstatus.rb: ditto
- * lib/webrick/htmlutils.rb: ditto
- * lib/webrick/httpversion.rb: ditto
- * lib/webrick/version.rb: ditto
- * lib/webrick/httpauth/userdb.rb: ditto
- * lib/webrick/httpauth/authenticator.rb: ditto
- * lib/webrick/accesslog.rb: ditto
+ * bignum.c (bary_neg): Extracted from bary_2comp.
+ (bary_plus_one): Extracted from bary_2comp.
+ (bary_2comp): Use bary_neg and bary_plus_one.
+ (big_extend_carry): Extracted from get2comp.
+ (get2comp): Use big_extend_carry.
+ (rb_integer_unpack): Use big_extend_carry.
+ (rb_big_neg): Use bary_neg.
-Mon May 9 20:57:13 2011 Tadayoshi Funaba <tadf@dotrb.org>
+Sat Jun 29 22:31:59 2013 Tanaka Akira <akr@fsij.org>
- * test/ruby/test_{complex,rational}.rb: added tests.
+ * bignum.c (bary_2comp): Simplified.
-Mon May 9 20:29:44 2011 Tadayoshi Funaba <tadf@dotrb.org>
+Sat Jun 29 09:33:53 2013 Tanaka Akira <akr@fsij.org>
- * complex.c (string_to_c_internal): a refactoring.
+ * bignum.c (bigor_int): Return -1 if y == -1.
-Mon May 9 18:33:05 2011 NARUSE, Yui <naruse@ruby-lang.org>
+Sat Jun 29 09:07:16 2013 Tanaka Akira <akr@fsij.org>
- * string.c: Improve documentation for String#start_with? and
- String#end_with?. fixes #4652
- patched by Andrew Grimm <andrew.j.grimm at gmail.com>
+ * 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.
-Mon May 9 13:49:00 2011 Kenta Murata <mrkn@mrkn.jp>
+Sat Jun 29 08:19:58 2013 Tanaka Akira <akr@fsij.org>
- * complex.c (string_to_c_internal): support scientific notation.
- patched by Tinco Andringa. https://github.com/ruby/ruby/pull/16
- [ruby-core:36046][Bug #4655]
+ * 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.
-Mon May 9 11:52:48 2011 NARUSE, Yui <naruse@ruby-lang.org>
+Fri Jun 29 01:08:00 2013 Charlie Somerville <charliesome@ruby-lang.org>
- * numeric.c (int_ord): remove K&R style.
- patched by Daehyub Kim. https://github.com/ruby/ruby/pull/17
+ * 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
-Sun May 8 22:17:24 2011 Tadayoshi Funaba <tadf@dotrb.org>
+ * test/ruby/test_integer_comb.rb (class TestIntegerComb): add test case
- * test/ruby/test_{complex2,complexrational}.rb: use skip.
- * test/date/*.rb: ditto.
+Fri Jun 28 12:26:53 2013 Tanaka Akira <akr@fsij.org>
-Sun May 8 21:02:31 2011 Tadayoshi Funaba <tadf@dotrb.org>
+ * bignum.c (rb_big_and): Allocate new bignum with same size to shorter
+ argument if it's high bits are zero.
- * test/ruby/test_{complex2,complexrational}.rb: NEVER SKIP.
+Fri Jun 28 12:14:04 2013 Tanaka Akira <akr@fsij.org>
-Sun May 8 21:01:21 2011 Tadayoshi Funaba <tadf@dotrb.org>
+ * ext/socket/ipsocket.c (init_inetsock_internal): Don't use local
+ addresses which address family is different to remote address.
- * test/date/test_date_base.rb: fixed.
+Fri Jun 28 08:06:22 2013 Tanaka Akira <akr@fsij.org>
-Sun May 8 20:54:11 2011 Tadayoshi Funaba <tadf@dotrb.org>
+ * bignum.c (bigand_int): Add arguments, xn and hibitsx.
+ Use twocomp2abs_bang.
- * test/date/*.rb: NEVER SKIP.
+Thu Jun 27 23:58:13 2013 Tanaka Akira <akr@fsij.org>
-Sun May 8 20:37:33 2011 Tadayoshi Funaba <tadf@dotrb.org>
+ * bignum.c (abs2twocomp_bang): Removed.
+ (abs2twocomp): Take n_ret argument to return actual length.
+ (rb_big_and): Follow above change.
- * test/date/*.rb: reverted 31432.
+Thu Jun 27 22:52:19 2013 Tanaka Akira <akr@fsij.org>
-Sun May 8 20:32:43 2011 Tadayoshi Funaba <tadf@dotrb.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.
- * test/date/*.rb: reverted 31483.
+Thu Jun 27 20:03:13 2013 CHIKANAGA Tomoyuki <nagachika@ruby-lang.org>
-Sun May 8 19:39:16 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * ext/openssl/lib/openssl/ssl.rb (verify_certificate_identity): fix
+ hostname verification. Patched by nahi.
- * thread_pthread.c (native_cond_timedwait): add to care EINTR.
- * thread_pthread.c (thread_timer): remove EINTR check.
+ * test/openssl/test_ssl.rb (test_verify_certificate_identity): test for
+ above.
-Sun May 8 19:04:15 2011 Tadayoshi Funaba <tadf@dotrb.org>
- * lib/time.rb (xmlschema): avoid passing any negative numbers.
+Thu Jun 27 00:23:57 2013 Tanaka Akira <akr@fsij.org>
-Sun May 8 18:40:03 2011 Tadayoshi Funaba <tadf@dotrb.org>
+ * bignum.c (rb_big_pow): Retry if y is a Bignum and it is
+ representable as a Fixnum.
+ Use rb_absint_numwords.
- * ext/date/date_{parse,strptime}.c: introduced some macros.
+Wed Jun 26 23:53:00 2013 Charlie Somerville <charliesome@ruby-lang.org>
-Sun May 8 17:17:13 2011 Tadayoshi Funaba <tadf@dotrb.org>
+ * ext/bigdecimal/bigdecimal.c (BigDecimal_save_rounding_mode): fix typo.
+ Fixes GH-343. Patch by @jgarber.
- * test/date/*.rb: use skip /w messages.
+Wed Jun 26 23:22:21 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Sun May 8 17:04:55 2011 Tadayoshi Funaba <tadf@dotrb.org>
+ * enumerator.c (rb_enumeratorize_with_size): use strict definition
+ rb_enumerator_size_func.
- * ext/date/lib/date/format.rb (_httpdate): omitted to call zone_to_diff.
+Wed Jun 26 23:11:14 2013 Kouhei Sutou <kou@cozmixng.org>
-Sun May 8 16:56:19 2011 Tadayoshi Funaba <tadf@dotrb.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.
- * ext/date/date_core.c (date_s_test_*): use macros.
+Wed Jun 26 22:44:00 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Sun May 8 10:24:16 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * include/ruby/intern.h (rb_enumeratorize_with_size): cast for
+ backward compatibility.
- * thread_pthread.c: cleanup signal_thread_list related ifdef.
- 1) we don't have to use #ifdef FOO-PLATFORM directly 2) About
- half #ifdef didn't care symbian properly.
+ * include/ruby/intern.h (rb_enumerator_size_func): define strict
+ function declaration for rb_enumeratorize_with_size().
-Sun May 8 05:19:37 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+Wed Jun 26 21:01:22 2013 Hiroshi Shirosaki <h.shirosaki@gmail.com>
- * test/io/wait/test_io_wait.rb: Linux socketpair(2) only support
- AF_UNIX, but windows socketpair doesn't support it. we can't
- avoid platform check. sigh!
+ * test/ruby/test_io.rb (TestIO#test_write_32bit_boundary): skip if
+ writing a file is slow.
+ [ruby-core:55541] [Bug #8519]
-Sun May 8 00:13:05 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+Wed Jun 26 16:42:11 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * test/io/wait/test_io_wait.rb: use Socket.pair instead of pipe.
- Windows can only treat a socket.
+ * 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.
-Sat May 7 22:43:48 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+Wed Jun 26 12:48:22 2013 Tanaka Akira <akr@fsij.org>
- * thread.c (rb_fd_zero): remove redundant zero fill.
+ * bignum.c (bigxor_int): Fix a buffer over read.
-Sat May 7 22:38:04 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+Wed Jun 26 12:13:12 2013 Tanaka Akira <akr@fsij.org>
- * thread.c (rb_fd_init): remove volatile qualifier.
+ * 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).
-Sat May 7 22:34:29 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+Wed Jun 26 12:08:51 2013 Tanaka Akira <akr@fsij.org>
- * thread.c (rb_fd_init_copy): new internal api. It provide efficient
- copy constructor semantics.
- * thread.c (do_select): use rb_fd_init_copy().
+ * test/socket/test_udp.rb: Close sockets explicitly.
+ Don't use fixed port number.
-Sat May 7 15:18:06 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
- fix incorrect native_cond_signal call when deadlock was detected.
+Wed Jun 26 07:27:17 2013 Tanaka Akira <akr@fsij.org>
- * thread.c (lock_func): decrement cond_waiting if timeout was happen.
+ * bignum.c (bigand_int): Fix a buffer over read.
-Sat May 7 18:28:37 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Wed Jun 26 06:48:07 2013 Tanaka Akira <akr@fsij.org>
- * thread_pthread.c (USE_MONOTONIC_COND): check the availability
- more strictly.
+ * bignum.c (bigadd_int): Fix a buffer over read.
- * thread_pthread.h (rb_thread_cond_t): ditto.
+Wed Jun 26 01:18:13 2013 Masaya Tarui <tarui@ruby-lang.org>
-Sat May 7 15:15:10 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * gc.c (is_before_sweep): Add new helper function that check the object
+ is before sweep?
+ * gc.c (rb_gc_force_recycle): Have to clear mark bit if object's slot
+ already ready to minor sweep.
- fix win32 native_cond_timedwait() makes SIGSEGV.
+Wed Jun 26 01:17:29 2013 Tanaka Akira <akr@fsij.org>
- * thread_win32.h (rb_thread_cond_struct): add prev field instead of
- last. (ie cond_event_entry is now using double linked list instead of
- single)
- * thread_win32.c (cond_event_entry): add prev field.
+ * bignum.c (bigsub_int): Fix a buffer over read.
- * thread_win32.c (__cond_timedwait): remove entry properly if timeout
- was happen.
+Tue Jun 25 22:45:43 2013 Tanaka Akira <akr@fsij.org>
- * thread_win32.c (native_cond_signal): change for double linked list.
- * thread_win32.c (native_cond_broadcast): ditto.
- * thread_win32.c (native_cond_initialize): ditto.
+ * bignum.c (rb_absint_singlebit_p): Use POW2_P.
+ (bary_pack): Ditto.
+ (rb_big2str0): Ditto.
+ (POW2_P): Moved to top.
-Sat May 7 12:41:04 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
- fix mutex deadlock test hang-up.
+Tue Jun 25 22:28:07 2013 Akinori MUSHA <knu@iDaemons.org>
- * thread_win32.c (abs_timespec_to_timeout_ms): fix 1000x calculation
- mistake. (ie fix hang-up native_cond_timedwait())
+ * 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]
-Sat May 7 03:14:13 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+Tue Jun 25 21:43:13 2013 Tanaka Akira <akr@fsij.org>
- sleep_cond use monotonic time if possible.
+ * bignum.c (big2dbl): Use (BDIGIT)1 instead of 1UL.
+ (bary_mul_normal): Remove a useless cast.
- * thread_pthread.c (native_thread_init): change sleep_cond
- attribute to monotonic.
- * thread_pthread.c (native_sleep): use native_cond_timeout().
+Tue Jun 25 21:26:00 2013 Kenta Murata <mrkn@mrkn.jp>
- * thread_pthread.c (native_cond_timeout): add overflow care.
- * thread_win32.c (native_cond_timeout): ditto.
+ * 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
-Sat May 7 02:49:12 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
- fix win32 compile error.
+Tue Jun 25 20:36:31 2013 Tanaka Akira <akr@fsij.org>
- * thread_win32.c (RB_CONDATTR_CLOCK_MONOTONIC): define
- RB_CONDATTR_CLOCK_MONOTONIC always.
- * thread_pthread.c (RB_CONDATTR_CLOCK_MONOTONIC): ditto.
+ * bignum.c (big2ulong): "check" argument removed.
+ (rb_big2ulong): Follow above change.
+ (rb_big2long): Ditto.
+ (rb_big_rshift): Ditto.
+ (rb_big_aref): Ditto.
-Sat May 7 02:29:41 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+Tue Jun 25 20:08:29 2013 Tanaka Akira <akr@fsij.org>
- mutex: deadlock check timeout use monotonic time.
+ * bignum.c (rb_big2ulong_pack): Use rb_integer_pack.
+ (rb_big_aref): Call big2ulong with TRUE for "check" argument.
+ It should be non-effective.
- * thread_pthread.c (native_cond_timeout): new internal api.
- it calculate a proper time for argument of native_cond_timedwait().
- * thread_win32.c (native_cond_timeout): ditto.
+Tue Jun 25 19:07:33 2013 Tanaka Akira <akr@fsij.org>
- * thread_pthread.c (thread_timer): use native_cond_timeout()
- instead of get_ts.
- * thread.c (lock_func): ditto.
+ * 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
- * thread_pthread.c (get_ts): removed. use native_cond_timeout().
- * thread.c (init_lock_timeout): ditto.
+Tue Jun 25 19:03:00 2013 Tanaka Akira <akr@fsij.org>
-Sat May 7 01:54:21 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * bignum.c (big2ulong): Add a cast.
+ (big2ull): Add a specialized code for SIZEOF_LONG_LONG <=
+ SIZEOF_BDIGITS.
- * thread_pthread.c (get_ts): add monotonic clock capability.
- * thread_pthread.c (rb_thread_create_timer_thread): use monotonic
- clock if possible.
+Tue Jun 25 12:42:57 2013 Tanaka Akira <akr@fsij.org>
-Sat May 7 01:43:37 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * bignum.c (integer_unpack_single_bdigit): Use "1 + ~u" instead of
+ "-u" to suppress warning (C4146) by Visual Studio.
+ Reported by ko1 via IRC.
- * thread_pthread.h (rb_thread_cond_t): add clockid field. it's
- no longer an alias of pthread_cond_t.
- * thread_pthread.c: adapt new rb_thread_cond_t type.
- * thread.c (mutex_alloc): ditto.
- * thread_win32.c (native_cond_initialize): ditto.
- * configure.in: add check for pthread_cond_attr_setclock() and
- clockid_t type.
+Tue Jun 25 12:28:57 2013 Tanaka Akira <akr@fsij.org>
-Fri May 6 23:29:47 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * bignum.c (big2ulong): Add code specialized for SIZEOF_LONG <=
+ SIZEOF_BDIGITS.
+ This prevents shift width warning from "num <<= BITSPERDIG".
- * thread.c (rb_wait_for_single_fd): use ppoll() instead of poll()
- if possible. based on a patch from Eric Wong. [ruby-core:36003].
+Tue Jun 25 12:23:30 2013 Koichi Sasada <ko1@atdot.net>
-Fri May 6 23:13:43 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * gc.c: fix oldgen/remembered_shady counting algorithm.
- * configure.in: remove nanosleep check. we no longer use it.
- r20124 removed last usage.
+ * gc.c (rgengc_check_shady): increment
+ `objspace->rgengc.remembered_shady_object_count' here.
-Fri May 6 22:35:56 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * gc.c (rgengc_remember): return FALSE if obj is already remembered.
- * ext/syck/rubyext.c (mktime_do): extra digits are not used.
+ * gc.c (rgengc_rememberset_mark): make it void.
-Fri May 6 17:43:07 2011 NARUSE, Yui <naruse@ruby-lang.org>
+ * gc.c (gc_mark_children): fix to double counting oldgen_object_count
+ at minor GC.
- * ext/syck/rubyext.c (mktime_do): remove unused variable offset.
+Tue Jun 25 12:07:18 2013 Tanaka Akira <akr@fsij.org>
- * ext/syck/syck.h: use #ifdef instead of #if DEBUG.
+ * 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.
-Fri May 6 16:27:33 2011 NARUSE, Yui <naruse@ruby-lang.org>
+ * marshal.c (shortlen): Use SIZEOF_BDIGITS instead of sizeof(BDIGIT).
- * ext/date/date_core.c (DAY_IN_NANOSECONDS): refix: 31438.
- check with LONG_MAX and cast as long; without this the calculation
- will be done as int and overflow.
+ * ext/openssl/ossl_bn.c (ossl_bn_initialize): Use SIZEOF_BDIGITS
+ instead of sizeof(BDIGIT).
-Fri May 6 15:01:11 2011 URABE Shyouhei <shyouhei@ruby-lang.org>
+Tue Jun 25 11:40:08 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * ext/syck/rubyext.c (mktime_do): avoid buffer overrun, by
- silently ignoring lesser significant digits. Required buffer
- length can be computable so you might at first think of
- allocating enough memory space on the fly using alloca(). That
- is a wrong idea because when using alloca there is always risk
- of integer overflow. A function that accepts outer-process
- resources like this should not blindly trust its inputs. In
- this particular case we just want to generate milliseconds
- resolution by strtod() so the string in question needs no more
- length than what we originally have. Ignoring lesser
- significant digits should suffice I believe.
+ * bignum.c (big2ulong): suppress shorten-64-to-32 warning. BDIGIT can
+ be bigger than long now.
-Fri May 6 14:25:53 2011 Tinco Andringa <mail@tinco.nl>
+ * bignum.c (LSHIFTX): remove redundant never-true expression.
- * ext/syck/rubyext.c (mktime_do): YAML.load time correctly parse
- usecs smaller than 1 fixes #4571
+Tue Jun 25 00:55:54 2013 Masaya Tarui <tarui@ruby-lang.org>
-Thu May 5 22:23:34 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * 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.
- * thread_pthread.c (native_mutex_reinitialize_atfork): removed
- unused macro.
- * thread_win32.c (native_mutex_reinitialize_atfork): ditto.
+Mon Jun 24 23:30:31 2013 Tanaka Akira <akr@fsij.org>
-Thu May 5 22:09:39 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * bignum.c (integer_unpack_single_bdigit): Refine code to filling
+ higher bits and use BIGLO.
- * ext/date/date_core.c (DAY_IN_NANOSECONDS): long long int is not
- available on all platforms.
+Mon Jun 24 22:26:31 2013 Hiroshi Shirosaki <h.shirosaki@gmail.com>
-Thu May 5 17:36:31 2011 CHIKANAGA Tomoyuki <nagachika00@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.
- * eval.c (frame_func_id): store result of method_entry_of_iseq() to
- cfp->me because method_entry_of_iseq() might become expensive.
+Mon Jun 24 22:11:37 2013 Hiroshi Shirosaki <h.shirosaki@gmail.com>
-Thu May 5 15:03:51 2011 CHIKANAGA Tomoyuki <nagachika00@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.
- * eval.c (frame_func_id): __method__ return different name from
- methods defined by Module#define_method with a same block.
- [ruby-core:35386] fixes #4606
- * eval.c (method_entry_of_iseq): new helper function. search control
- frame stack for a method entry which has given iseq.
- * test/ruby/test_method.rb: add tests for #4606
+Mon Jun 24 22:06:14 2013 Hiroshi Shirosaki <h.shirosaki@gmail.com>
-Wed May 4 22:13:09 2011 KOSAKI Motohiro <kosaki.motohiro@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]
- * benchmark/bm_vm4_pipe.rb: Reduced iterations. Too slow benchmark
- is bad.
- * benchmark/bm_vm4_thread_pass.rb: ditto.
+Mon Jun 24 22:04:02 2013 Hiroshi Shirosaki <h.shirosaki@gmail.com>
-Wed May 4 22:08:22 2011 KOSAKI Motohiro <kosaki.motohiro@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.
- * test/date/test_date_base.rb: don't use no message skip().
+Mon Jun 24 22:04:00 2013 Charlie Somerville <charliesome@ruby-lang.org>
-Wed May 4 21:11:28 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * 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
- * benchmark/bm_io_select2.rb: reduce number of using file
- descriptors. because gdb need some fds.
+Mon Jun 24 20:31:00 2013 Charlie Somerville <charliesome@ruby-lang.org>
-Wed May 4 19:00:59 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * 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
- * thread.c (rb_wait_for_single_fd): Fix wrong return value.
- * test/-ext-/wait_for_single_fd/test_wait_for_single_fd.rb
- (TestWaitForSingleFD#test_wait_for_closed_pipe): test for it.
+Mon Jun 24 07:57:18 2013 Masaya Tarui <tarui@ruby-lang.org>
-Wed May 4 18:46:39 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * 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.
- * ext/-test-/wait_for_single_fd: New. for testing
- rb_wait_for_single_fd() internal function.
- The patch was written by Eric Wong. [ruby-core:35991]
+Mon Jun 24 02:53:09 2013 Zachary Scott <zachary@zacharyscott.net>
- * test/-ext-/wait_for_single_fd/test_wait_for_single_fd.rb: ditto.
+ * array.c: Return value in Array overview example found by @PragTob
+ [Fixes GH-336] https://github.com/ruby/ruby/pull/336
-Wed May 4 12:46:25 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+Mon Jun 24 02:45:51 2013 Zachary Scott <zachary@zacharyscott.net>
- * thread.c (rb_wait_for_single_fd): Added POLLNVAL check.
- based on a patch from Eric Wong at [ruby-core:35991].
+ * array.c (rb_ary_zip): typo by @PragTob [Fixes GH-337]
+ https://github.com/ruby/ruby/pull/337
-Wed May 4 11:51:01 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+Mon Jun 24 02:42:01 2013 Zachary Scott <zachary@zacharyscott.net>
- * io.c (rb_f_select): remove useless ifdef.
+ * win32/README.win32: grammar typo by @blankenshipz [Fixes GH-334]
+ https://github.com/ruby/ruby/pull/334
-Wed May 4 11:42:47 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+Mon Jun 24 00:59:35 2013 Tanaka Akira <akr@fsij.org>
- * ext/socket/init.c (wait_connectable): fix error handling code.
- RB_WAITFD_OUT is turned on even though an error occur.
+ * 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.
-Wed May 4 10:12:39 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+Sun Jun 23 23:05:58 2013 Tanaka Akira <akr@fsij.org>
- * ext/readline/readline.c (readline_event): use rb_wait_for_single_fd().
- The patch was written by Eric Wong. [Ruby 1.9 - Feature #4531]
+ * 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.
-Wed May 4 10:10:28 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * include/ruby/ruby.h (RBIGNUM_EMBED_LEN_MAX): Define it only if it is
+ not defined yet.
- * ext/socket/init.c (wait_connectable): use rb_wait_for_single_fd().
- The patch was written by Eric Wong. [Ruby 1.9 - Feature #4531]
+Sun Jun 23 17:29:51 2013 Tanaka Akira <akr@fsij.org>
- * ext/socket/init.c (try_wait_connectable, wait_connectable_ensure):
- removed.
+ * bignum.c (integer_unpack_single_bdigit): Use a cast.
-Wed May 4 10:07:48 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+Sun Jun 23 15:38:07 2013 Koichi Sasada <ko1@atdot.net>
- * ext/io/wait/wait.c (io_wait): use rb_wait_for_single_fd().
- The patch was written by Eric Wong. [Ruby 1.9 - Feature #4531]
+ * bootstraptest/test_thread.rb: rescue resource limitation errors.
-Wed May 4 10:01:27 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+Sun Jun 23 08:19:27 2013 Tanaka Akira <akr@fsij.org>
- * thread.c (rb_wait_for_single_fd): new. poll(2) based backend for
- rb_wait_for_single_fd().
- Now only Linux uses it.
+ * bignum.c (integer_unpack_single_bdigit): Extracted from
+ bary_unpack_internal.
- The patch was written by Eric Wong. [Ruby 1.9 - Feature #4531]
+Sun Jun 23 07:41:52 2013 Tanaka Akira <akr@fsij.org>
-Wed May 4 09:56:57 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * bignum.c (bary_unpack_internal): Suppress warnings (C4146) on Visual Studio.
+ Reported by ko1 via IRC.
- * thread.c (rb_wait_for_single_fd): new.
- * thread.c (select_single): select(2) based backend for
- rb_wait_for_single_fd().
+Sun Jun 23 06:49:28 2013 Koichi Sasada <ko1@atdot.net>
- * io.c (make_writeconv): use rb_wait_for_single_fd() instead of
- rb_thread_fd_select().
- * io.c (rb_io_wait_readable): ditto.
- * thread.c (rb_thread_wait_fd_rw): ditto.
+ * 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(),
- * io.c (wait_readable): removed.
- * thread.c (init_set_fd): new helper function.
- * include/ruby/io.h (RB_WAITFD_IN, RB_WAITFD_PRI, RB_WAITFD_OUT):
- new constant for rb_single_wait_fd().
+ * class.c, eval.c, hash.c: use OBJ_WB_UNPROTECT().
- The patch was written by Eric Wong. [Ruby 1.9 - Feature #4531]
+Sun Jun 23 05:41:32 2013 Koichi Sasada <ko1@atdot.net>
-Wed May 4 08:04:59 2011 Aaron Patterson <aaron@tenderlovemaking.com>
+ * 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.
- * ext/psych/lib/psych/visitors/yaml_tree.rb: fix time dumping so that
- Syck can load UTC times that Psych dumps.
+ * vm_method.c (rb_method_entry_make): add write barriers.
-Wed May 4 07:33:00 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+Sun Jun 23 01:27:54 2013 Tanaka Akira <akr@fsij.org>
- * thread.c (rb_fd_copy): fix wrong argument.This issue was pointed
- out by Eric Wong. [ruby-core:35982]
+ * bignum.c (bytes_zero_p): Removed.
+ (bary_pack): Don't call bytes_zero_p.
-Tue May 3 20:29:33 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+Sun Jun 23 00:51:29 2013 Tanaka Akira <akr@fsij.org>
- * test/fileutils/test_fileutils.rb (TestFileUtils#test_chmod_symbol_mode):
- Skip sticky bit test if the platform is FreeBSD. It doesn't allow to
- change sticky bit if a target is regular file.
+ * bignum.c (bytes_zero_p): Extracted from bary_pack.
+ (bary_pack): Use bytes_zero_p.
-Tue May 3 18:23:57 2011 Yuki Sonoda (Yugui) <yugui@yugui.jp>
+Sun Jun 23 00:16:57 2013 Tanaka Akira <akr@fsij.org>
- * test/date/test_date.rb (TestDate#test_coerce):
- test for [ruby-core:35127].
+ * bignum.c (MSB): New macro.
+ (bary_unpack_internal): Use MSB.
+ (bary_divmod): Ditto.
+ (bigdivrem): Ditto.
-Tue May 3 04:27:53 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Sat Jun 22 23:45:22 2013 Tanaka Akira <akr@fsij.org>
- * thread.c (rb_thread_select): preserve errno if no error
- occurred.
+ * bignum.c (bary_swap): New function.
+ (bary_pack): Use bary_swap.
+ (bary_unpack_internal): Ditto.
-Tue May 3 03:57:04 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Sat Jun 22 23:18:39 2013 Tanaka Akira <akr@fsij.org>
- * include/ruby/intern.h (rb_w32_fdcopy): add prototype. fixes
- #4640
+ * 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.
-Mon May 2 01:02:04 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+Sat Jun 22 21:46:18 2013 Tanaka Akira <akr@fsij.org>
- * lib/fileutils.rb (FileUtils#chmod): accept symbolic mode argument.
- The patch was written by takkanm. [ruby-core:26029][Feature #2190]
+ * bignum.c (rb_integer_unpack): Don't allocate a Bignum if possible.
- * lib/fileutils.rb (FileUtils#fu_mode): new helper function.
- * lib/fileutils.rb (FileUtils#symbolic_modes_to_i): ditto.
- * lib/fileutils.rb (FileUtils#mode_mask): ditto.
- * lib/fileutils.rb (FileUtils#user_mask): ditto.
+Sat Jun 22 21:03:58 2013 Tanaka Akira <akr@fsij.org>
- * test/fileutils/test_fileutils.rb (TestFileUtils#test_chmod_symbol_mode):
- new test for the above symbolic mode.
- * test/fileutils/test_fileutils.rb (TestFileUtils#test_chmod_R): ditto.
+ * pack.c (pack_unpack): Remove specialized unpackers for integers.
-Mon May 2 00:36:12 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+Sat Jun 22 20:36:50 2013 Tanaka Akira <akr@fsij.org>
- * ext/socket/init.c (rsock_connect): add to care EINTR. based
- on a patch from Eric Wong at [ruby-core:35621][Bug #4555]
+ * 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.
-Sun May 1 01:06:24 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+Sat Jun 22 18:53:10 2013 Tanaka Akira <akr@fsij.org>
- * thread.c (rb_thread_select): release GVL while waiting select().
+ * 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.
-Sat Apr 30 23:10:15 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * internal.h (INTEGER_PACK_FORCE_GENERIC_IMPLEMENTATION): Defined.
- * win32/win32.c (rb_w32_fdcopy): New. This can copy even though
- fdset size exceed FD_SETSIZE.
- * include/ruby/intern.h (rb_fd_copy): use rb_w32_fdcopy()
+Sat Jun 22 15:41:25 2013 Koichi Sasada <ko1@atdot.net>
-Sat Apr 30 20:18:43 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * gc.c (rgengc_check_shady): add new WB miss checking
+ on RGENGC_CHECK_MODE >= 2.
- * thread.c (do_select): Change argument type to rb_fdset_t.
- Now do_select() is free from unexpected hangup if
- HAVE_RB_FD_INIT=1 [Bug #4636]
+ (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.
- * thread.c (rb_thread_fd_select, rb_thread_wait_fd_rw):
- adapt new argument type.
+ This idea of this checker is by Masaya Tarui <tarui@ruby-lang.org>.
- * thread.c (rb_thread_select): make dummy implementation.
+Sat Jun 22 15:25:00 2013 Charlie Somerville <charliesome@ruby-lang.org>
-Sat Apr 30 20:16:53 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * ext/etc/etc.c (setup_passwd): revert r41560, unnecessary
- * thread.c (rb_fd_copy): Change function argument. Now
- rb_fd_copy() has fully copy semantics.
- * include/ruby/intern.h: ditto.
+Sat Jun 22 14:39:00 2013 Charlie Somerville <charliesome@ruby-lang.org>
-Sat Apr 30 20:11:47 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * 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
- * include/ruby/intern.h (rb_thread_select): mark as deprecated.
+Sat Jun 22 14:35:40 2013 Tanaka Akira <akr@fsij.org>
- * ext/io/wait/wait.c (wait_readable): use rb_thread_fd_select
- instead of rb_thread_select.
- * ext/socket/init.c (wait_connectable0): ditto.
- * ext/readline/readline.c (readline_event): ditto.
- * io.c (rb_io_wait_readable, wait_readable, rb_io_wait_writable,
- wait_writable): ditto.
+ * ext/dl/cfunc.c (rb_dlcfunc_call): Use rb_big_pack instead of
+ rb_big2ulong_pack and rb_big2ull.
-Sat Apr 30 20:06:36 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * include/ruby/intern.h (rb_big2ulong_pack): Deprecated.
- * thread.c (do_select): remove useless ifdef. time calculation
- is not heavy weight.
+Sat Jun 22 14:31:00 2013 Charlie Somerville <charliesome@ruby-lang.org>
-Sat Apr 30 16:48:36 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * 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
- * benchmark/bm_io_select3.rb: New.
+Sat Jun 22 13:47:13 2013 Tanaka Akira <akr@fsij.org>
-Sat Apr 30 16:27:09 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * bignum.c (bary_pack): MEMZERO can be used even if nails is not zero.
- * io.c (copy_stream_body, rb_io_s_copy_stream): move rb_fd_init()
- from copy_stream_body to rb_io_s_copy_stream. fds of passing
- rb_fd_term() have to be guaranteed initialized.
+Sat Jun 22 13:43:00 2013 Charlie Somerville <charliesome@ruby-lang.org>
-Sat Apr 30 16:13:17 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * ext/etc/etc.c (etc_getpwnam): use PRIsVALUE in format string instead
+ of %s and RSTRING_PTR
- * benchmark/bm_io_select.rb, benchmark/bm_io_select2.rb: New.
- based on a patch from Eric Wong at [Feature #4531]
+ * ext/etc/etc.c (etc_getgrnam): ditto
-Sat Apr 30 03:25:53 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+Sat Jun 22 13:07:15 2013 Tanaka Akira <akr@fsij.org>
- * test/io/wait/test_io_wait.rb: New. for testing ext/io/wait.
- the patch was written by Eric Wong. [Feature #4531]
+ * bignum.c (CLEAR_LOWBITS): Rewritten without RSHIFTX.
+ (RSHIFTX): Removed.
-Sat Apr 30 00:34:56 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+Sat Jun 22 10:38:03 2013 Tanaka Akira <akr@fsij.org>
- * include/ruby/win32.h: remove redundant declaration of
- rb_w32_time_subtract().
+ * pack.c (num2i32): Removed.
+ (pack_pack): Don't use num2i32.
-Sat Apr 30 00:16:40 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+Sat Jun 22 09:55:13 2013 Tanaka Akira <akr@fsij.org>
- * thread_pthread.c (gvl_init): fix hangup if GVL_SIMPLE_LOCK=1.
- We don't have to call mutex_unlock() before initialize it!
+ * 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.
-Fri Apr 29 13:15:15 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+Sat Jun 22 09:11:33 2013 Ryan Davis <ryand-ruby@zenspider.com>
- * thread_win32.c (native_cond_timedwait): New. r31373 caused
- win32 build failure.
+ * lib/minitest/*: Imported minitest 4.7.5 (r8724)
+ * test/minitest/*: ditto
- * thread_win32.c (__cond_timedwait, abs_timespec_to_timeout_ms):
- New helper functions.
+Sat Jun 22 07:20:30 2013 Koichi Sasada <ko1@atdot.net>
- * win32/win32.c (rb_w32_time_subtract): rename from subtract and
- remove static.
+ * 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))
-Fri Apr 29 10:43:09 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * gc.c (gc_marks): record `oldgen_object_count' into current profile`
+ record directly.
- * benchmark/bm_vm4_pipe.rb: Add two new benchmark for GVL
- performance. They was written by Koichi Sasada.
- * benchmark/bm_vm4_thread_pass.rb: ditto.
+ * gc.c (rgengc_rememberset_mark): same for remembered_normal_objects
+ and remembered_shady_objects.
-Fri Apr 29 10:25:31 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+Sat Jun 22 06:46:04 2013 Koichi Sasada <ko1@atdot.net>
- * vm_method.c (rb_clear_cache_by_class): Revert r29673. It made
- a segmentation fault regression. [Bug #4289][ruby-core:34554].
+ * 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.
-Fri Apr 29 10:24:51 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * gc.c: use above fields.
- * io.c (make_writeconv): do not add textmode newline decorator if any
- newline decorator is set already. fixes #4618, fixes #4619
+Sat Jun 22 06:05:36 2013 Koichi Sasada <ko1@atdot.net>
-Fri Apr 29 10:17:42 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * gc.c (rb_gc_giveup_promoted_writebarrier): remove `rest_sweep()'
+ because all of remembered objects are called for gc_mark_children().
- * thread.c (lock_func): small cleanup.
+Sat Jun 22 05:08:03 2013 Koichi Sasada <ko1@atdot.net>
-Fri Apr 29 10:07:13 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * gc.c (rgengc_rememberset_mark): call gc_mark_children() for
+ remembered objects directly instead of pushing on the mark stack.
- * thread.c (rb_mutex_lock, lock_func): Avoid busy loop and
- performance regression. bm_vm3_thread_mutex.rb performance
- change from 109.064sec to 16.331sec. [Feature #4607]
+Sat Jun 22 04:48:53 2013 Koichi Sasada <ko1@atdot.net>
- * thread.c (init_lock_timeout): New helper function.
+ * include/ruby/ruby.h (OBJ_WRITE): cast to (VALUE *) for second
+ parameter `slot'. You don't need to write a cast (VALUE *) any more.
-Thu Apr 28 16:15:49 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+ * class.c, compile.c, hash.c, iseq.c, proc.c, re.c, variable.c,
+ vm.c, vm_method.c: remove cast expressions for OBJ_WRITE().
- * win32/{win32.c,dir.h} (rb_w32_uopendir): new API to pass UTF-8 path.
+Sat Jun 22 04:37:08 2013 Koichi Sasada <ko1@atdot.net>
- * win32/win32.c (opendir_internal, rb_w32_opendir): extract and merge
- common part of rb_w32_opendir() and rb_w32_uopendir().
+ * gc.c (slot_sweep_body): rename to slot_sweep().
+ No need to separate major/minor GC.
- * dir.c (do_opendir, glob_helper): encoding.
+ * gc.c (gc_setup_mark_bits): remove gc_clear_mark_bits() and unify to
+ this function.
- * dir.c (dir_initialize, do_opendir): convert path to UTF-8 and call
- rb_w32_uopendir() instead of rb_w32_opendir() on Windows.
- fixes #4491, reported by Joey Zhou.
+Sat Jun 22 04:20:21 2013 Koichi Sasada <ko1@atdot.net>
-Thu Apr 28 15:32:53 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+ * gc.c (check_bitmap_consistency): add to check flag and bitmap consistency.
+ Use this function in several places.
- * test/dl/test_base.rb (DL::LIBC_SO): its always msvc*.dll on
- mswin/mingw.
+Sat Jun 22 02:18:07 2013 Tanaka Akira <akr@fsij.org>
-Thu Apr 28 06:07:06 2011 Nobuyoshi Nakada <nobu@ruby-lang.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.
- * lib/csv.rb (CSV::open): suppress universal newline decorator.
- fixes #4603
+ * internal.h (swap16): Moved from pack.c
+ (swap32): Ditto.
+ (swap64): Ditto.
- * lib/csv.rb (CSV.read): no mode is needed.
+Fri Jun 21 21:29:49 2013 Masaya Tarui <tarui@ruby-lang.org>
-Thu Apr 28 06:06:56 2011 Nobuyoshi Nakada <nobu@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.
- * io.c (rb_io_extract_modeenc, rb_f_backquote): set default text
- mode. fixes #4619
+Fri Jun 21 21:11:53 2013 Koichi Sasada <ko1@atdot.net>
- * io.c (pipe_open): set universal newline decorator if needed.
+ * gc.c (allocate_sorted_heaps): remove unused variable `add'.
-Wed Apr 27 11:33:08 2011 NARUSE, Yui <naruse@ruby-lang.org>
+Fri Jun 21 20:50:32 2013 Koichi Sasada <ko1@atdot.net>
- * enc/trans/emoji_iso2022_kddi.trans: ISO-2022-JP-KDDI doesn't have
- CP932 UDA. Another reason is emacs-mule: the implementation of
- stateless-iso-2022-jp doesn't support beyond 94x94 (0x7fxx);
- but CP932 UDA is in 7Fxx-92xx.
+ * include/ruby/ruby.h: constify RArray::as::ary and RArray::heap::ptr.
+ Use RARRAY_ASET() or RARRAY_PTR_USE() to modify Array objects.
-Wed Apr 27 07:42:44 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * array.c, gc.c: catch up above changes.
- * configure.in (STRIP): use proper toolchain. based on a patch
- from Jon Forums at [ruby-core:35909]. fixes #4617
+Fri Jun 21 20:32:13 2013 Koichi Sasada <ko1@atdot.net>
-Wed Apr 27 01:20:59 2011 Tadayoshi Funaba <tadf@dotrb.org>
+ * vm_eval.c (eval_string_with_cref): fix WB miss.
- * ext/date/date_core.c (date_zone_to_diff): renamed.
- * ext/date/date_parse.c: ditto.
- * ext/date/date_strptime.c: ditto.
+Fri Jun 21 20:15:49 2013 Koichi Sasada <ko1@atdot.net>
-Wed Apr 27 01:16:59 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * include/ruby/ruby.h: support write barrier protection for T_STRUCT.
+ Introduce the following C APIs:
+ * RSTRUCT_RAWPTR(st) returns pointer (do WB on your risk).
+ The type of returned pointer is (const VALUE *).
+ * RSTRUCT_GET(st, idx) returns idx-th value of struct.
+ * RSTRUCT_SET(st, idx, v) set idx-th value by v with WB.
+ And
+ * RSTRUCT_PTR(st) returns pointer with shady operation.
+ The type of returned pointer is (VALUE *).
- * encoding.c (enc_find): accept Encoding objects.
+ * struct.c, re.c, gc.c, marshal.c: rewrite with above APIs.
-Wed Apr 27 00:55:56 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Fri Jun 21 19:38:37 2013 Tanaka Akira <akr@fsij.org>
- * transcode.c (econv_opts): add newline option.
+ * bignum.c (BDIGMAX): Use BIGRAD.
+ (BIGLO): Use BDIGMAX.
+ (bigdivrem1): Ditto.
+ (bigor_int): Ditto.
+ (rb_big_or): Ditto.
- * io.c (validate_enc_binmode, rb_io_extract_modeenc): set newline
- decorator according to open mode.
+Fri Jun 21 19:18:48 2013 Tanaka Akira <akr@fsij.org>
- * transcode.c (rb_econv_prepare_options): new function, to prepare
- econv options with newline flags.
+ * pack.c (pack_pack): Move the implementation for 'c' directive after
+ pack_integer label.
- * include/ruby/encoding.h (ECONV_NEWLINE_DECORATOR_MASK): add.
+Fri Jun 21 19:11:56 2013 Koichi Sasada <ko1@atdot.net>
-Wed Apr 27 00:51:01 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * include/ruby/ruby.h, re.c: support write barrier for T_REGEXP.
- * file.c (rb_file_truncate): fix function.
+ 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.
- * include/ruby/win32.h (ftruncate, truncate, ftello, fseeko): non-64
- versions on mingw are useless because they use int32_t. fixes #4564
+Fri Jun 21 18:56:58 2013 Tanaka Akira <akr@fsij.org>
-Wed Apr 27 00:50:33 2011 Tadayoshi Funaba <tadf@dotrb.org>
+ * bignum.c (bigsub_int): Use bdigit_roomof.
+ (bigadd_int): Ditto.
+ (bigand_int): Ditto.
+ (bigor_int): Ditto.
+ (bigxor_int): Ditto.
- * ext/date/date_core.c: modified validation methods.
- * ext/date/lib/date.rb: ditto.
+Fri Jun 21 17:56:25 2013 Koichi Sasada <ko1@atdot.net>
-Wed Apr 27 00:00:37 2011 Tadayoshi Funaba <tadf@dotrb.org>
+ * benchmark/gc/gcbench.rb: fix summary of benchmark result notation.
- * ext/date/date_core.c (dt_lite_set_tmx): should get df value.
+Fri Jun 21 16:38:00 2013 Charlie Somerville <charliesome@ruby-lang.org>
-Tue Apr 26 22:34:04 2011 Tadayoshi Funaba <tadf@dotrb.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
- * ext/date/lib/date/format.rb (_iso8601): allowed day only civil
- date. disallowed separatorless day only ordinal date.
+Fri Jun 21 15:26:45 2013 Koichi Sasada <ko1@atdot.net>
-Mon Apr 25 21:31:36 2011 Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
+ * gc.c (gc_sweep): profile sweep time correctly when LAZY_SWEEP is
+ disabled.
- * ext/openssl/extconf.rb: Should check SSLv2_*method.
- openssl compiled with "no-ssl2" the extconf don't fail
- when running `make' having this compilation errors.
- Patched by Laurent Arnoud. fixes #4562, #4556
+ * gc.c (gc_marks_test): store oldgen count and shady count
+ before test marking and restore them after marking.
-Mon Apr 25 20:53:32 2011 Tajima, Akio <artonx@yahoo.co.jp>
+Fri Jun 21 15:07:42 2013 Koichi Sasada <ko1@atdot.net>
- * win32/win32.c (kill): accept 0 only sig is SIGINT #4596
+ * gc.c: enable lazy sweep (commit miss).
-Mon Apr 25 19:59:47 2011 Tajima, Akio <artonx@yahoo.co.jp>
+Fri Jun 21 14:31:29 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * win32/win32.c (kill): accept 0 as pid, fixes #4596
+ * hash.c (ruby_setenv): refine error message so include the variable
+ name.
-Mon Apr 25 16:43:45 2011 NARUSE, Yui <naruse@ruby-lang.org>
+Fri Jun 21 14:15:08 2013 Koichi Sasada <ko1@atdot.net>
- * random.c (random_rand): remove unused variables.
+ * gc.c: fix to use total_allocated_object_num and heaps_used
+ at the GC time for profiler.
- * struct.c (rb_struct_define_without_accessor): ditto.
+Fri Jun 21 12:35:35 2013 Koichi Sasada <ko1@atdot.net>
- * strftime.c (rb_strftime_with_timespec): ditto.
+ * gc.c: RGENGC_CHECK_MODE should be 0.
- * sprintf.c: ditto.
+Fri Jun 21 11:18:25 2013 Koichi Sasada <ko1@atdot.net>
- * time.c (time_asctime): remove useless GetTimeval().
+ * gc.c (gc_marks_body): fix to get `th' in this function.
- * thread_pthread.c: cast to (void *) for %p.
+Fri Jun 21 10:21:44 2013 Koichi Sasada <ko1@atdot.net>
-Mon Apr 25 11:02:11 2011 NARUSE, Yui <naruse@ruby-lang.org>
+ * gc.c (heaps_header/heaps_slot): embed bitmaps into heaps_slot.
+ no need to maintain allocation/free bitmaps.
- * ext/ripper/lib/ripper/sexp.rb: fix rdoc around sexp.
- patched by Sho Hashimoto. fixes #4599
+Fri Jun 21 09:22:16 2013 Koichi Sasada <ko1@atdot.net>
-Mon Apr 25 08:24:04 2011 Shota Fukumori <sorah@tubusu.net>
+ * gc.c (slot_sweep_body): add counters at a time.
- * random.c (rb_f_rand, random_s_rand): RDocs for them.
+ * gc.c (gc_profile_dump_on): fix line break position.
-Mon Apr 25 07:18:00 2011 Kenta Murata <mrkn@mrkn.jp>
+Fri Jun 21 08:14:00 2013 Masaya Tarui <tarui@ruby-lang.org>
- * random.c (random_s_rand, Init_Random): Random.rand should behave as
- Random::DEFAULT.rand rather than Kernel#rand.
+ * gc.c: refactoring bitmaps. introduce bits_t type and some Consts.
- * random.c (rand_range, random_rand): rand_range function extracted
- from random_rand function.
+Fri Jun 21 08:04:32 2013 Koichi Sasada <ko1@atdot.net>
- * random.c (rb_f_rand): accept a Range argument as Random#rand
- [ruby-dev:43427] #4605
+ * gc.c: fix to support USE_RGENGC == 0 (disable RGenGC).
+ If USE_RGENGC==0, it caused compilation error.
-Mon Apr 25 03:31:06 2011 Tadayoshi Funaba <tadf@dotrb.org>
+Fri Jun 21 08:08:11 2013 Masaya Tarui <tarui@ruby-lang.org>
- * lib/time.rb: require 'date'.
- * ext/date/lib/date/format.rb: removed require line.
+ * gc.c (lazy_sweep): Use is_lazy_sweeping()
+ * gc.c (rest_sweep): Ditto.
+ * gc.c (gc_prepare_free_objects): Ditto.
-Mon Apr 25 03:08:39 2011 Tadayoshi Funaba <tadf@dotrb.org>
+Fri Jun 21 07:34:47 2013 Koichi Sasada <ko1@atdot.net>
- * ext/date/lib/date/format.rb: require 'date'.
+ * gc.c (gc_profile_record::oldgen_objects): added.
-Mon Apr 25 03:04:16 2011 Tadayoshi Funaba <tadf@dotrb.org>
+ * gc.c (gc_profile_dump_on): print the following information:
+ * Living object counts
+ * Free object counts
+ If RGENGC_PROFILE > 0 then
+ * Oldgen object counts
+ * Remembered normal object counts
+ * Remembered shady object counts
- * ext/date/lib/date/format.rb (_iso8601): added a pattern.
+Fri Jun 21 06:43:59 2013 Tanaka Akira <akr@fsij.org>
-Mon Apr 25 02:51:22 2011 NARUSE, Yui <naruse@ruby-lang.org>
+ * bignum.c (rb_ull2big): Refactored.
+ (rb_uint2big): Useless code removed.
- * ext/date/lib/date/format.rb: require 'date_core.so'.
- date/format needs methods which are now in date_core.so.
- This breaks make rdoc which uses Date._parse from time.rb.
+Fri Jun 21 05:37:39 2013 Koichi Sasada <ko1@atdot.net>
-Mon Apr 25 02:47:46 2011 Tadayoshi Funaba <tadf@dotrb.org>
+ * gc.c (gc_prof_sweep_timer_stop): accumulate sweep time only when
+ record->gc_time > 0.
- * ext/date/lib/date/format.rb (_iso8601): fixed a bug of regex.
+Fri Jun 21 00:37:31 2013 Tanaka Akira <akr@fsij.org>
-Mon Apr 25 02:12:26 2011 Tadayoshi Funaba <tadf@dotrb.org>
+ * ext/bigdecimal: Workaround fix for bigdecimal test failures caused
+ by [ruby-dev:47413] [Feature #8509]
- * ext/date/lib/date/format.rb: an adjustment of regex.
+ * 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.
-Mon Apr 25 01:58:50 2011 Tadayoshi Funaba <tadf@dotrb.org>
+ * ext/bigdecimal/bigdecimal.c (RBIGNUM_ZERO_P): Use rb_bigzero_p.
+ (bigzero_p): Removed.
+ (is_even): Use rb_big_pack.
- * ext/date/lib/date/format.rb: omitted to call _parse.
+Thu Jun 20 22:52:42 2013 Tanaka Akira <akr@fsij.org>
-Mon Apr 25 01:03:03 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * bignum.c (bigmul1_toom3): Don't call bignorm twice.
- * string.c (rb_to_id): remove unused variable.
+Thu Jun 20 22:49:27 2013 Tanaka Akira <akr@fsij.org>
-Sun Apr 24 22:19:05 2011 Tadayoshi Funaba <tadf@dotrb.org>
+ * bignum.c (bignorm): Don't call bigtrunc if the result is a fixnum.
- * complex.c, rational.c: omitted some method calls.
+Thu Jun 20 22:29:42 2013 Tanaka Akira <akr@fsij.org>
-Sun Apr 24 02:57:27 2011 Tadayoshi Funaba <tadf@dotrb.org>
+ * bignum.c (rb_uint2big): Refactored.
- * ext/date/date_parse.c (n2i): takes long.
+Thu Jun 20 22:24:41 2013 Tanaka Akira <akr@fsij.org>
-Sun Apr 24 02:51:06 2011 Tadayoshi Funaba <tadf@dotrb.org>
+ * bignum.c (dump_bignum): Use SIZEOF_BDIGITS.
- * ext/date/date_parse.c: reverted.
+Thu Jun 20 22:22:46 2013 Tanaka Akira <akr@fsij.org>
-Sun Apr 24 02:25:23 2011 NARUSE, Yui <naruse@ruby-lang.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.
- * include/ruby/intern.h: pcc can't use __builtin_constant_p.
+Thu Jun 20 22:02:46 2013 Tanaka Akira <akr@fsij.org>
- * vm_exec.c: change condition.
+ * 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.
-Sun Apr 24 01:58:01 2011 NARUSE, Yui <naruse@ruby-lang.org>
+Thu Jun 20 21:17:19 2013 Koichi Sasada <ko1@atdot.net>
- * ext/date/date_core.c (leap_p): suppress warning: parentheses.
+ * gc.c (rgengc_rememberset_mark): record
+ (1) normal objects count in remember set
+ (2) shady objects count in remember set
+ each GC timing.
- * ext/date/date_core.c (date_s__parse_internal): remove unused
- variable "str".
+ * gc.c (gc_profile_record_get): enable to access above information
+ and REMOVING_OBJECTS, EMPTY_OBJECTS.
- * ext/date/date_parse.c (parse_ddd_cb): use RSTRING_LENINT.
+Thu Jun 20 18:29:26 2013 Koichi Sasada <ko1@atdot.net>
- * ext/date/date_strftime.c (date_strftime_with_tmx): remove unused
- variable.
+ * benchmark/gc/gcbench.rb: Do not use GC::Profiler::disable because
+ GC::Profiler::disable prohibit to access profiling data. It should
+ be spec bug.
-Sun Apr 24 00:34:23 2011 Tadayoshi Funaba <tadf@dotrb.org>
+ Skip GC::Profiler::report if RUBY_VERSION < '2.0.0'
- * ext/date/date_parse.c: removed some unused macros. use strchr()
- instead of index().
+Thu Jun 20 17:59:08 2013 Koichi Sasada <ko1@atdot.net>
-Sat Apr 23 21:29:42 2011 Tadayoshi Funaba <tadf@dotrb.org>
+ * benchmark/gc/gcbench.rb: stop GC::Profiler before output results.
+ Generating GC::Profiler result under profiling causes infinite loop.
- * ext/date/date_core.c: replacement of implementation of
- _parse. [experimental]
- * ext/date/date_parse.c: new.
- * ext/date/lib/date/format.rb: removed ruby version of _parse.
+Thu Jun 20 17:24:24 2013 Koichi Sasada <ko1@atdot.net>
-Fri Apr 22 12:04:15 2011 NARUSE, Yui <naruse@ruby-lang.org>
+ * benchmark/gc/gcbench.rb: don't use __dir__ to make compatible
+ with ruby 1.9.3.
- * array.c (rb_ary_sort_bang): fix rdoc.
- patched by burningTyger. https://github.com/ruby/ruby/pull/11
+Thu Jun 20 16:57:19 2013 Koichi Sasada <ko1@atdot.net>
-Fri Apr 22 11:49:49 2011 NARUSE, Yui <naruse@ruby-lang.org>
+ * benchmark/bm_app_aobench.rb: use attr_accessor/reader instead of
+ defining methods.
- * lib/xmlrpc/create.rb (XMLRPC::Create#conv2value):
- XML-RPC's int is 32bit int, and Fixnum also may be beyond 32bit.
+Thu Jun 20 16:46:46 2013 Koichi Sasada <ko1@atdot.net>
- * lib/xmlrpc/create.rb (XMLRPC::Create#conv2value):
- XML-RPC doesn't allow Infinity and NaN.
- http://www.xmlrpc.com/spec
+ * benchmark/bm_app_aobench.rb: added.
-Fri Apr 22 04:16:14 2011 Aaron Patterson <aaron@tenderlovemaking.com>
+ * benchmark/gc/aobench.rb: added.
- * ext/psych/parser.c (parse): strings from psych have proper taint
- markings.
+Thu Jun 20 16:28:33 2013 Koichi Sasada <ko1@atdot.net>
- * test/psych/test_tainted.rb: test for string taint
+ * benchmark/bm_so_binary_trees.rb: disable `puts' method
+ and change iteration parameter to increase execution time.
-Thu Apr 21 01:30:02 2011 NARUSE, Yui <naruse@ruby-lang.org>
+ * benchmark/gc/binarytree.rb: added.
- * random.c (rb_f_srand): fix rdoc: srand(0)'s 0 is a seed.
- [ruby-core:35833] fixes #4590
+Thu Jun 20 16:06:37 2013 Koichi Sasada <ko1@atdot.net>
-Thu Apr 21 01:01:28 2011 Masaya Tarui <tarui@ruby-lang.org>
+ * benchmark/gc/pentomino.rb: added.
+ Simply load pentomino puzzle in the benchmark/ directory.
- * win32/win32.c (CreateChild): maximum length of lpCommandLine is
- 32,768 characters, including the Unicode terminating null character.
+Thu Jun 20 15:32:56 2013 Koichi Sasada <ko1@atdot.net>
-Wed Apr 20 21:32:11 2011 Tadayoshi Funaba <tadf@dotrb.org>
+ * benchmark/gc/redblack.rb: import red black tree benchmark from
+ https://github.com/jruby/rubybench/blob/master/time/bench_red_black.rb
- * ext/date/date_strptime.c (date__strptime_internal): do not
- overwrite local variables.
+ * benchmark/gc/ring.rb: add a benchmark. This benchmark create many
+ old objects.
-Wed Apr 20 14:41:28 2011 NARUSE, Yui <naruse@ruby-lang.org>
+Thu Jun 20 15:14:00 2013 Koichi Sasada <ko1@atdot.net>
- * string.c (rb_str_each_line): check string's length when compare
- separator and string. [ruby-core:35815] fixes #4586
+ * benchmark/gc: create a directory to store GC related benchmark.
-Wed Apr 20 00:02:13 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * benchmark/gc/gcbench.rb: moved from tool/gcbench.rb.
- * misc/ruby-mode.el (ruby-parse-partial): use position of open paren.
+ * benchmark/gc/hash(1|2).rb: ditto.
-Tue Apr 19 01:00:21 2011 Tajima Akio <artonx@yahoo.co.jp>
+ * benchmark/gc/rdoc.rb: ditto.
- * test/ruby/test_io.rb (TestIO#test_cross_thread_close_fd):
- skip cross thread pipe close if windows
+ * benchmark/gc/null.rb: added.
-Mon Apr 18 12:15:46 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+ * common.mk: fix rule.
- * test/ruby/test_range.rb (TestRange#test_step_ruby_core_35753):
- avoid float error. [ruby-core:35804]
+Thu Jun 20 14:09:54 2013 Koichi Sasada <ko1@atdot.net>
-Sun Apr 17 00:20:14 2011 Tadayoshi Funaba <tadf@dotrb.org>
+ * tool/hashbench1.rb: fix parameter too. Increase temporary objects.
- * ext/date/date_{core,strftime}.c: use struct tmx instead of vtm.
- * ext/date/date_tmx.h: new.
+Thu Jun 20 14:01:35 2013 Koichi Sasada <ko1@atdot.net>
-Sat Apr 16 22:23:52 2011 Tadayoshi Funaba <tadf@dotrb.org>
+ * tool/hashbench1.rb: fix parameters.
- * ext/date/date_strftime.c (date_strftime_wo_timespec): changed
- the way of validation of locale modifiers.
+Thu Jun 20 14:00:34 2013 Koichi Sasada <ko1@atdot.net>
-Sat Apr 16 21:55:12 2011 Tadayoshi Funaba <tadf@dotrb.org>
+ * common.mk: remove dependency from ruby.
- * ext/date/date_core.c: replacement of implementation of
- _strptime. [experimental]
- * ext/date/date_strptime.c: new.
- * ext/date/lib/date/format.rb: removed ruby version of _strptime.
+Thu Jun 20 13:14:06 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Sat Apr 16 10:18:30 2011 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
+ * error.c (rb_check_backtrace): evaluate RARRAY_AREF only once.
+ the first argument of RB_TYPE_P is expanded twice for non-immediate
+ types.
- * vm.c (Init_VM): suppress warning: "OPT_BASIC_OPERATIONS" is not
- defined.
+Thu Jun 20 08:09:29 2013 Koichi Sasada <ko1@atdot.net>
-Fri Apr 15 23:41:18 2011 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
+ * tool/gcbench.rb: Summary in one line.
- * ruby.c (proc_options): suppress warning:
- "ALLOW_DEFAULT_SOURCE_ENCODING" is not defined.
+ * common.mk: separate gcbench-hash to gcbench-hash1 and gcbench-hash2.
-Fri Apr 15 15:10:29 2011 Akinori MUSHA <knu@iDaemons.org>
+Thu Jun 20 08:07:23 2013 Tanaka Akira <akr@fsij.org>
- * lib/uri/generic.rb (#route_from_path): Fix a bug where
- URI('http://h/b/').route_to('http://h/b') wrongly returned './'
- (should be '../b'). [Bug #4476]
+ * bignum.c (BIGSIZE): New macro.
+ (bigfixize): Use BIGSIZE.
+ (big2ulong): Ditto.
+ (check_shiftdown): Ditto.
+ (rb_big_aref): Ditto.
-Fri Apr 15 14:58:06 2011 Akinori MUSHA <knu@iDaemons.org>
+Thu Jun 20 07:46:48 2013 Masaya Tarui <tarui@ruby-lang.org>
- * lib/fileutils.rb (FileUtils#touch): Fix corrupted output when
- mtime is specified in addition to nocreate (and verbose).
- ref [ruby-dev:43401]
+ * gc.c (rb_gc_writebarrier): give up rescan A and register B directly
+ if A has huge number of children.
-Thu Apr 14 23:43:43 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+Thu Jun 20 07:30:35 2013 Koichi Sasada <ko1@atdot.net>
- * numeric.c (ruby_float_step): wrong loop condition.
- fixes [ruby-core:35753], reported by Joey Zhou.
+ * common.mk: add new rules `gcbench-rdoc', `gcbench-hash'.
- * test/ruby/test_range.rb (TestRange#test_step_ruby_core_35753):
- test above change.
+ * tool/gcbench.rb: separate GC bench framework and process.
-Thu Apr 14 22:48:12 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * 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.
- * lib/test/unit.rb (Test::Unit::Options#setup_options): set possible
- values for completion. no conversion is needed.
+ * tool/rdocbench.rb: separated.
- * lib/test/unit.rb (Test::Unit::Runner::Worker#initialize): use
- positional arguments instead of keyword arguments.
+Thu Jun 20 06:25:39 2013 Koichi Sasada <ko1@atdot.net>
- * lib/test/unit.rb (Test::Unit::Runner#jobs_status): io/console may
- not be available. use 80 as the last resort if IO#winsize and
- COLUMNS are unavailable.
+ * tool/rdocbench.rb: add summary.
- * lib/test/unit.rb (Test::Unit::Runner::Worker#died): rename using a
- verb.
+Thu Jun 20 06:18:01 2013 Koichi Sasada <ko1@atdot.net>
- * lib/test/unit.rb (Test::Unit::Runner#_run_parallel): check if worker
- is signaled and use its exit status.
+ * gc.c (gc_profile_total_time): check objspace->profile.next_index > 0.
- * lib/test/unit.rb (Test::Unit::Runner::Worker#dead): no longer @in
- and @out are separated.
+Thu Jun 20 05:47:41 2013 Koichi Sasada <ko1@atdot.net>
-Thu Apr 14 21:23:29 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * gc.c (gc_prof_sweep_timer_start): fix merge miss.
- * variable.c (rb_autoload_p): search superclasses as same as actual
- loading. fixes [ruby-core:35679]
+ * gc.c (GC_PROFILE_MORE_DETAIL): set it 0.
-Thu Apr 14 21:21:06 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Thu Jun 20 05:38:56 2013 Koichi Sasada <ko1@atdot.net>
- * include/ruby/win32.h (frexp, modf): wrongly declared as pure in
- mingw math.h.
+ * gc.c: Accumulate sweep time to GC time.
+ Now [GC time] is [mark time] + [sweep time] + [misc].
+ ([GC time] >= [mark time] + [sweep time])
- * include/ruby/win32.h (ftruncate, truncate): mingw64 misses
- prototypes.
+ * gc.c (gc_prof_sweep_slot_timer_start/stop): rename to
+ gc_prof_sweep_timer_start/stop and locate at lazy_sweep().
- * win32/win32.c (rb_w32_read): suppress warning.
+ * gc.c (elapsed_time_from): add a utility function.
-Thu Apr 14 19:55:54 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+Thu Jun 20 05:08:53 2013 Koichi Sasada <ko1@atdot.net>
- * lib/fileutils.rb (FileUtils#touch): fix corrupted output when
- FileUtils.touch(:nocreate => true, :verbose => true) case.
- The patch was written by Hiroyuki Iwatsuki. [ruby-dev:43401]
+ * gc.c (gc_marks): fix wrong option. FALSE means major/full GC.
+ It should be TRUE (minor marking).
-Thu Apr 14 16:01:45 2011 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
+Thu Jun 20 02:44:45 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * io.c (rb_f_syscall): suppress warning: "HAVE___SYSCALL" is not
- defined.
+ * 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 Apr 14 00:41:09 2011 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
+Thu Jun 20 01:34:15 2013 Tanaka Akira <akr@fsij.org>
- * thread.c (thread_fd_close_i): IOError exception should be assigned
- to rb_thread_t::thrown_errinfo.
+ * 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.
-Wed Apr 13 20:12:26 2011 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
+Thu Jun 20 01:07:39 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * io.c (rb_io_fdatasync): remove unused variable.
+ * gc.c (MARKED_IN_BITMAP, FL_TEST2): return boolean value since always
+ used as boolean value.
-Tue Apr 12 20:54:12 2011 Tanaka Akira <akr@fsij.org>
+ * gc.c (MARK_IN_BITMAP, CLEAR_IN_BITMAP): evaluate bits once.
- * include/ruby/st.h: parenthesize macro arguments.
+Thu Jun 20 00:05:07 2013 Koichi Sasada <ko1@atdot.net>
-Tue Apr 12 19:19:50 2011 NARUSE, Yui <naruse@ruby-lang.org>
+ * gc.c (RVALUE_PROMOTED): fix type.
- * lib/uri/common.rb: avoid race condition. fixes #4572
+Wed Jun 19 23:39:01 2013 Koichi Sasada <ko1@atdot.net>
-Tue Apr 12 18:07:13 2011 TAKAO Kouji <kouji@takao7.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)
- * ext/readline/extconf.rb: --disable-libedit to disable
- libedit. fixes #4550
+Wed Jun 19 23:51:48 2013 Tanaka Akira <akr@fsij.org>
-Tue Apr 12 10:37:39 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+ * bignum.c (bigfixize): Use rb_absint_size.
+ (check_shiftdown): Ditto.
+ (big2ulong): Use bdigit_roomof.
- * include/ruby/win32.h: VC doesn't have ftruncate() and others, but
- ruby needs HAVE_ macros to use our emulation functions.
- (fix the problem of 31262)
+Wed Jun 19 23:32:23 2013 Koichi Sasada <ko1@atdot.net>
-Tue Apr 12 01:33:00 2011 Luis Lavena <luislavena@gmail.com>
+ * gc.c (RVALUE_PROMOTED): check consistency between oldgen flag and
+ oldgen bitmap if RGENGC_CHECK_MODE > 0.
- * configure.in: properly evaluate existence of truncate, ftruncate
- and ftello for MinGW. [ruby-core:35678]
- * win32/win32.c: rename truncate, ftruncate and ftello to avoid
- redefinitions.
- * win32/win32.h: ditto.
+Wed Jun 19 23:29:29 2013 Koichi Sasada <ko1@atdot.net>
-Mon Apr 11 21:51:52 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * gc.c (rb_gc_force_recycle): clear oldgen bitmap, too.
- * io.c: revert r31230. Because it made a regression.
- [ruby-core:35631]
+Wed Jun 19 21:02:13 2013 Tanaka Akira <akr@fsij.org>
-Mon Apr 11 21:49:18 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * 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.
- * test/ruby/test_io.rb: Added TestIO#test_cross_thread_close_stdio
- and TestIO#test_cross_thread_close_fd.
- The patch was written by Eric Wong. [ruby-core:35669]
+Wed Jun 19 20:51:21 2013 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
-Mon Apr 11 21:15:54 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * gc.c (gc_stress_get): GC.stress can be Fixnum.
- * file.c (rb_group_member): kill 256K of stack usage.
- the patch was written by Eric Wong. [ruby-core:35699]
+Wed Jun 19 19:31:30 2013 Tanaka Akira <akr@fsij.org>
-Mon Apr 11 07:24:13 2011 Eric Hodel <drbrain@segment7.net>
+ * 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.
- * ext/openssl/ossl.c: Fix typo, document version constants.
+Wed Jun 19 15:14:30 2013 Koichi Sasada <ko1@atdot.net>
-Sun Apr 10 22:23:45 2011 Tanaka Akira <akr@fsij.org>
+ * 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.
- * include/ruby/ruby.h: parenthesize macro arguments.
+ * iseq.c: making non-shady iseq objects.
-Sat Apr 9 23:31:47 2011 Shota Fukumori <sorah@tubusu.net>
+ * class.c, compile.c, proc.c, vm.c: add WB for iseq objects.
- * ext/stringio/stringio.c (strio_each, strio_readlines):
- Use `NUM2LONG` instead of `FIX2INT`. Fixes [ruby-dev:43395].
+ * vm_core.h, iseq.h: constify fields to detect WB insertion.
-Sat Apr 9 23:22:27 2011 Shota Fukumori <sorah@tubusu.net>
+Wed Jun 19 15:11:13 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * ext/stringio/stringio.c (strio_each):
- Fix exception message and don't raise immediately if block is not
- given.
- Fixes [ruby-dev:43394].
+ * gc.c (gc_mark_children): show more info for broken object.
- * test/stringio/test_stringio.rb (test_each_line_limit_0):
- Fix test for above.
+Wed Jun 19 14:04:41 2013 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
-Sat Apr 9 21:54:15 2011 Shota Fukumori <sorah@tubusu.net>
+ * test/ruby/envutil.rb (EnvUtil#rubybin): remove unnecessary
+ unless expression.
- * ext/stringio/stringio.c (strio_each, strio_readlines):
- limit must not be zero. Fixes [ruby-dev:43392].
+Wed Jun 19 07:47:48 2013 Koichi Sasada <ko1@atdot.net>
- * test/stringio/test_stringio.rb: Add tests for above.
+ * gc.c (garbage_collect_body): use FIX2INT for ruby_gc_stress.
-Sat Apr 9 18:01:36 2011 Tanaka Akira <akr@fsij.org>
+Wed Jun 19 07:44:31 2013 Koichi Sasada <ko1@atdot.net>
- * include/ruby/util.h: parenthesize macro arguments.
+ * gc.c (rb_objspace::gc_stress): int -> VALUE to store Fixnum object.
-Fri Apr 8 16:01:56 2011 NARUSE, Yui <naruse@ruby-lang.org>
+Wed Jun 19 07:25:35 2013 Koichi Sasada <ko1@atdot.net>
- * ext/stringio/stringio.c (strio_getline): check whether str is
- a string when str and lim are given.
- https://twitter.com/watson1978/status/56225052152168449
+ * gc.c (make_deferred): clear flags to T_ZOMBIE.
-Thu Apr 7 20:03:52 2011 Tanaka Akira <akr@fsij.org>
+ * gc.c (slot_sweep_body): fix indent.
- * include/ruby/io.h: parenthesize macro arguments.
+Wed Jun 19 07:18:47 2013 Tanaka Akira <akr@fsij.org>
-Wed Apr 6 21:08:31 2011 Tanaka Akira <akr@fsij.org>
+ * bignum.c (rb_big_aref): Apply BIGLO to ~xds[i] for environment which
+ BDIGIT is 16bit.
- * include/ruby/intern.h: parenthesize macro arguments.
+Wed Jun 19 07:09:26 2013 Koichi Sasada <ko1@atdot.net>
-Wed Apr 6 15:12:40 2011 NARUSE, Yui <naruse@ruby-lang.org>
+ * gc.c (rgengc_remember): fix output level.
- * ext/openssl/ossl_pkey_dh.c (ossl_dh_initialize):
- pop pushed error after each try of reading. fixes #4550
+ * gc.c (rgengc_rememberset_mark): fix to output clear count.
+ (shady_object_count + clear_count = count of remembered objects)
- * ext/openssl/ossl_pkey_dsa.c (ossl_dsa_initialize): ditto.
+Wed Jun 19 07:06:21 2013 Koichi Sasada <ko1@atdot.net>
- * ext/openssl/ossl_pkey_ec.c (ossl_ec_initialize): ditto.
+ * gc.c (rgengc_remember): check T_NONE and T_ZOMBIE
+ if RGENGC_CHECK_MODE > 0.
-Wed Apr 6 11:36:44 2011 NARUSE, Yui <naruse@ruby-lang.org>
+Wed Jun 19 07:02:19 2013 Koichi Sasada <ko1@atdot.net>
- * ext/openssl/ossl_pkey_rsa.c (ossl_rsa_initialize):
- pop pushed error after each try of reading. fixes #4550
+ * gc.c (RGENGC_CHECK_MODE): add new check mode `3'.
+ In this mode, show all references if there is
+ a miss-corrected object.
-Tue Apr 5 20:33:43 2011 Tanaka Akira <akr@fsij.org>
+Wed Jun 19 06:31:08 2013 Koichi Sasada <ko1@atdot.net>
- * include/ruby/encoding.h: parenthesize macro arguments.
+ * 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.
-Mon Apr 4 22:02:16 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ You can debug RGenGC (WB) using `GC.stress = 1'.
+ Using this option, do minor marking at all possible places.
- * ext/io/nonblock/nonblock.c (io_nonblock_set): Avoid F_SETFL if
- we're not changing the O_NONBLOCK bit. F_SETFL is an expensive
- operation since it needs to affect all processes with the same
- file object.
- The patch is written by Eric Wong. [ruby-core:35556]
+ GC::STRESS_MINOR_MARK = 1 and GC::STRESS_LAZY_SWEEP = 2
+ seem good to add.
-Mon Apr 4 21:41:26 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+Wed Jun 19 06:29:31 2013 Koichi Sasada <ko1@atdot.net>
- * io.c (rb_io_syswrite): While local FS writes are usually
- buffered, the buffers can be full or the file opened with
- O_SYNC. IO#syswrite can also be used on blocking IOs
- (pipe/socket) just like IO#write.
- The patch is written by Eric Wong. [ruby-core:35554]
+ * vm.c (kwmerge_i): add WB.
-Mon Apr 4 11:50:40 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+Wed Jun 19 06:26:49 2013 Koichi Sasada <ko1@atdot.net>
- * test/test_tempfile.rb: simply ignore platform dependent testcases
- instead of skipping.
+ * 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()'
-Sun Apr 3 22:52:22 2011 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
+Wed Jun 19 04:33:22 2013 Koichi Sasada <ko1@atdot.net>
- * ext/syslog/syslog.c: improve rdoc.
- a patch by Jonas Pfenniger. [ruby-core:35592] fixes #4545
+ * variable.c (rb_const_set): fix WB miss.
-Sun Apr 3 22:10:09 2011 Tanaka Akira <akr@fsij.org>
+ WBs had located before creating reference between a klass
+ and constant value. It causes GC bug.
- * ext/zlib/zlib.c: parenthesize macro arguments.
+ # pseudo code:
+ WB(klass, value); # WB and remember klass
+ st_insert(klass->const_table, const_id, value);
-Sun Apr 3 21:33:58 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ `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
- * configure.in: disable fdatasync again on Mac OS X.
- [ruby-core:35493][Bug #4500]
+ Lesson: The place of a WB is important.
-Sun Apr 3 21:16:20 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+Tue Jun 18 22:01:00 2013 Charlie Somerville <charliesome@ruby-lang.org>
- * io.c (io_reopen): IO#close releases GVL if possible.
- close() may block for certain file types (NFS, SO_LINGER
- sockets, inotify), so let other threads run. The patch was
- created by Eric Wong [ruby-core:35555][Bug #4527]
+ * vm_insnhelper.c (vm_call_method): ensure methods of type
+ VM_METHOD_TYPE_ATTR_SET are called with 1 argument
- * io.c (fptr_finalize): ditto.
+ * test/ruby/test_module.rb
+ (TestModule#test_attr_writer_with_no_arguments): add test
+ [ruby-core:55543] [Bug #8540]
- * io.c (maygvl_fclose): new.
- * io.c (nogvl_fclose): ditto.
- * io.c (maygvl_close): ditto.
- * io.c (nogvl_close): ditto.
+Tue Jun 18 22:36:23 2013 Masaya Tarui <tarui@ruby-lang.org>
-Fri Apr 1 22:25:50 2011 Tanaka Akira <akr@fsij.org>
+ * gc.c (gc_profile_record_flag): fix typo.
- * ext/syslog/syslog.c: parenthesize macro arguments.
+Tue Jun 18 22:08:53 2013 Zachary Scott <zachary@zacharyscott.net>
-Fri Apr 1 18:53:06 2011 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
+ * ext/objspace/object_tracing.c: Return for ::allocation_generation
- * lib/webrick/cookie.rb (WEBrick::Cookie.parse): 'white space is
- permitted between tokens' according to RFC2965. Though 'Netscape
- spec' does not define the syntax clearly, make it tolerant as a
- server. As a real-world example, rest-client gem sends
- 'Cookie: foo=1;bar=2'
+Tue Jun 18 22:04:35 2013 Zachary Scott <zachary@zacharyscott.net>
- * test/webrick/test_cookie.rb (test_parse_non_whitespace): test it.
+ * ext/objspace/object_tracing.c: Document object_tracing methods.
-Fri Apr 1 13:19:20 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Tue Jun 18 21:58:17 2013 Zachary Scott <zachary@zacharyscott.net>
- * vm_core.h (RUBY_VM_CHECK_INTS_TH): merge a patch by ko1
- in [ruby-dev:43373].
+ * gc.c: Rename rb_mObSpace -> rb_mObjSpace
-Thu Mar 31 23:15:46 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Tue Jun 18 20:55:05 2013 Zachary Scott <zachary@zacharyscott.net>
- * misc/ruby-mode.el (ruby-brace-to-do-end, ruby-do-end-to-brace):
- adjust space between block beginning and block arguments
+ * ext/objspace/objspace.c: Document ObjectSpace::InternalObjectWrapper.
-Thu Mar 31 20:42:05 2011 Tanaka Akira <akr@fsij.org>
+Tue Jun 18 20:39:04 2013 Zachary Scott <zachary@zacharyscott.net>
- * ext/strscan/strscan.c: parenthesize macro arguments.
+ * ext/objspace/object_tracing.c: Teach rdoc object_tracing.c [Bug #8537]
-Thu Mar 31 18:06:12 2011 Shugo Maeda <shugo@ruby-lang.org>
+Tue Jun 18 20:29:47 2013 Zachary Scott <zachary@zacharyscott.net>
- * vm_insnhelper.c (vm_get_ev_const): should ignore crefs with
- the NODE_FL_CREF_PUSHED_BY_EVAL flag.
+ * ext/.document: add object_tracing.c to document file
-Thu Mar 31 16:49:56 2011 Shugo Maeda <shugo@ruby-lang.org>
+Tue Jun 18 20:20:27 2013 Zachary Scott <zachary@zacharyscott.net>
- * vm_insnhelper.c (vm_get_ev_const): search root cref properly.
- [ruby-dev:43365]
+ * ext/objspace/objspace.c: rdoc on require to overview from r41355
-Thu Mar 31 14:50:25 2011 Shugo Maeda <shugo@ruby-lang.org>
+Tue Jun 18 18:39:58 2013 Tanaka Akira <akr@fsij.org>
- * eval.c (rb_mod_s_constants): should ignore crefs with
- the NODE_FL_CREF_PUSHED_BY_EVAL flag.
+ * configure.in: Check __int128.
-Wed Mar 30 22:55:47 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * include/ruby/defines.h (BDIGIT_DBL): Use uint128_t if it is available.
+ (BDIGIT): Use uint64_t if uint128_t is available.
+ (SIZEOF_BDIGITS): Defined for above case.
+ (BDIGIT_DBL_SIGNED): Ditto.
+ (PRI_BDIGIT_PREFIX): Ditto.
- * misc/ruby-mode.el (ruby-toggle-block): toggle do/end and {}.
+ * include/ruby/ruby.h (PRI_64_PREFIX): Defined.
- * misc/ruby-mode.el (ruby-move-to-block): move to opening of
- block.
+ * bignum.c (rb_big_pow): Don't use BITSPERDIG for the condition which
+ rb_big_pow returns Float or Bignum.
-Wed Mar 30 14:35:15 2011 Shugo Maeda <shugo@ruby-lang.org>
+ [ruby-dev:47413] [Feature #8509]
- * vm_insnhelper.h (COPY_CREF): should copy
- the NODE_FL_CREF_PUSHED_BY_EVAL flag to hide constants from
- methods defined by class_eval. [ruby-dev:43365]
+Tue Jun 18 16:43:44 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Wed Mar 30 00:24:53 2011 Tanaka Akira <akr@fsij.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.
- * ext/stringio/stringio.c: parenthesize macro arguments.
+Tue Jun 18 12:53:25 2013 Tanaka Akira <akr@fsij.org>
-Tue Mar 29 21:51:31 2011 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
+ * bignum.c (nlz): Cast the result explicitly.
+ (big2dbl): Don't assign BDIGIT values to int variable.
- * object.c (rb_String): Kernel#String should call to_str before to_s.
+Tue Jun 18 12:25:16 2013 Tanaka Akira <akr@fsij.org>
-Tue Mar 29 10:28:08 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+ * bignum.c (rb_big_xor): Non-effective code removed.
- * test/webrick/test_filehandler.rb
- (WEBrick::TestFileHandler#test_short_filename): the cgi doesn't exist
- on current directory.
+Tue Jun 18 11:26:05 2013 Koichi Sasada <ko1@atdot.net>
-Tue Mar 29 05:19:57 2011 Tanaka Akira <akr@fsij.org>
+ * gc.c (gc_stat): add `generated_normal_object_count_types' for
+ RGENGC_PROFILE >= 2.
- * ext/socket/raddrinfo.c: parenthesize macro arguments.
+Tue Jun 18 11:02:18 2013 Koichi Sasada <ko1@atdot.net>
-Tue Mar 29 00:03:51 2011 Tajima Akio <artonx@yahoo.co.jp>
+ * gc.c (gc_mark_maybe): check to skip T_NONE.
- * test/webrick/test_filehandler.rb (test_short_filename):
- read real short filename by cmd because smb mounted files
- have different naming convention.
+ * gc.c (markable_object_p): do not need to check (flags == 0) here.
-Mon Mar 28 11:38:08 2011 NARUSE, Yui <naruse@ruby-lang.org>
+Tue Jun 18 10:17:37 2013 Koichi Sasada <ko1@atdot.net>
- * ext/date/date_core.c (date_s_today): use int for year.
+ * variable.c (rb_autoload): fix WB miss.
- * ext/date/date_core.c (datetime_s_now): ditto.
+Tue Jun 18 04:20:18 2013 Koichi Sasada <ko1@atdot.net>
-Mon Mar 28 11:07:41 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+ * gc.c (gc_mark_children): don't need to care about T_ZOMBIE here.
- * ext/extmk.rb: set MFLAGS from MAKEFLAGS when using nmake.
+Mon Jun 17 22:16:02 2013 Kazuki Tsujimoto <kazuki@callcc.net>
-Mon Mar 28 11:07:00 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+ * test/ruby/test_proc.rb (TestProc#test_block_given_method_to_proc):
+ run test for r41359.
- * common.mk (love): all you need is love.
+Mon Jun 17 21:42:18 2013 Kazuki Tsujimoto <kazuki@callcc.net>
-Sun Mar 27 23:16:31 2011 Tanaka Akira <akr@fsij.org>
+ * include/ruby/ruby.h, vm_eval.c (rb_funcall_with_block):
+ new function to invoke a method with a block passed
+ as an argument.
- * ext/socket/ipsocket.c: parenthesize macro arguments.
+ * string.c (sym_call): use the above function to avoid
+ a block sharing. [ruby-dev:47438] [Bug #8531]
-Sun Mar 27 16:55:34 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * vm_insnhelper.c (vm_yield_with_cfunc): don't set block
+ in the frame.
- * misc/ruby-mode.el (ruby-mode-map): remove unnecessary
- binding. fixes
- http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=468952
+ * test/ruby/test_symbol.rb (TestSymbol#test_block_given_to_proc):
+ run related tests.
- * misc/ruby-mode.el: suppress warnings at byte compile. fixes
- http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=502926
+Mon Jun 17 21:33:27 2013 Kazuki Tsujimoto <kazuki@callcc.net>
-Sun Mar 27 11:18:35 2011 Tadayoshi Funaba <tadf@dotrb.org>
+ * 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.
- * ext/date/date_core.c: removed unused variables.
+ * proc.c (bmcall): use the above function to avoid a block sharing.
+ [ruby-core:54626] [Bug #8341]
-Sat Mar 26 15:16:09 2011 Tanaka Akira <akr@fsij.org>
+ * test/ruby/test_proc.rb (TestProc#test_block_persist_between_calls):
+ run related tests.
- * ext/socket/getaddrinfo.c: parenthesize macro arguments.
+Mon Jun 17 20:53:21 2013 Tanaka Akira <akr@fsij.org>
-Sat Mar 26 05:27:34 2011 NARUSE, Yui <naruse@ruby-lang.org>
+ * loadpath.c (RUBY_REVISION): Defined to suppress revision.h
+ inclusion actually. r41352 removes the dependency.
- * ext/date/lib/date/format.rb (DateTime#strftime): removed because
- date_core defines it.
+Mon Jun 17 18:15:57 2013 Benoit Daloze <eregontp@gmail.com>
-Fri Mar 25 21:59:45 2011 Tadayoshi Funaba <tadf@dotrb.org>
+ * ext/objspace/objspace.c: let rdoc know about objspace methods.
+ Specify 'objspace' should be required. See #8537.
- * ext/date/date_core.c: should not force cast with macros.
+Mon Jun 17 17:44:31 2013 Benoit Daloze <eregontp@gmail.com>
-Fri Mar 25 21:56:10 2011 Tanaka Akira <akr@fsij.org>
+ * gc.c (ObjectSpace): is a module not a class.
- * ext/sdbm/init.c: parenthesize macro arguments.
+ * ext/objspace/objspace.c: try to include overview in rdoc,
+ see #8537.
-Fri Mar 25 19:39:40 2011 Ben Walton <bwalton@artsci.utoronto.ca>
+Mon Jun 17 17:38:24 2013 Benoit Daloze <eregontp@gmail.com>
- * test/test_syslog.rb:
- Skip syslog tests that rely on LOG_PERROR unless it's defined
+ * gc.c: fix example of ObjectSpace.define_finalizer in overview
- Instead of checking looking at the platform to determine if the tests
- relying on LOG_PERROR should be run, look for the definition of the
- constant as this will be robust against all platforms as long as the
- underlying syslog.c code sets it up correctly.
+Mon Jun 17 16:59:53 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- This specifically addresses failures on Solaris 9.
+ * 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]
- Use LOG_PID instead of LOG_PERROR in Syslog.open test
+Mon Jun 17 14:27:54 2013 Zachary Scott <zachary@zacharyscott.net>
- LOG_PERROR isn't a POSIX option for syslog, so it fails on platforms
- that don't define it. Solaris 9 and 10 are examples of this.
+ * vm_backtrace.c: Update rdoc for Backtrace#label with @_ko1
- Use LOG_PID instead.
+Mon Jun 17 13:04:01 2013 Akinori MUSHA <knu@iDaemons.org>
-Fri Mar 25 15:42:17 2011 NARUSE, Yui <naruse@ruby-lang.org>
+ * tool/ifchange (until): Fix the condition, although harmless in
+ this case.
- * ext/sdbm/_sdbm.c (sdbm_open): use size_t.
+Mon Jun 17 11:50:29 2013 Koichi Sasada <ko1@atdot.net>
- * ext/syck/bytecode.c: ditto.
+ * gc.c (gc_mark_maybe): added. check `is_pointer_to_heap()' and
+ type is not T_ZOMBIE.
- * ext/sdbm/_sdbm.c (delpair): use ptrdiff_t.
+ * gc.c: use `gc_mark_maybe()'. T_ZOMBIE objects should not be pushed
+ to the mark stack.
- * ext/sdbm/init.c: use RSTRING_LENINT.
+Mon Jun 17 07:56:24 2013 Tanaka Akira <akr@fsij.org>
- * ext/dl/handle.c: suppress warning: shorten-64-to-32.
+ * bignum.c (bary_small_lshift): Renamed from bdigs_small_lshift.
+ (bary_small_rshift): Renamed from bdigs_small_rshift.
- * ext/strscan/strscan.c: ditto.
+Mon Jun 17 07:38:48 2013 Tanaka Akira <akr@fsij.org>
- * ext/syck/emitter.c: ditto.
+ * bignum.c (absint_numwords_bytes): Removed.
+ (rb_absint_numwords): Don't call absint_numwords_bytes.
- * ext/syck/implicit.c: ditto.
+Sun Jun 16 23:14:58 2013 Tanaka Akira <akr@fsij.org>
- * ext/syck/syck.c: ditto.
+ * 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.
- * ext/syck/token.c: ditto.
+Sun Jun 16 21:41:39 2013 Tanaka Akira <akr@fsij.org>
-Fri Mar 25 12:14:58 2011 NARUSE, Yui <naruse@ruby-lang.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.
- * ext/nkf/nkf-utf8/nkf.c: import nkf 7f18e30.
+ * internal.h (rb_integer_unpack_2comp): Removed.
-Fri Mar 25 11:49:29 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+ * pack.c: Follow the above change.
- * test/ruby/test_process.rb (TestProcess#test_no_curdir): skip silently
- on Windows, because this tests a platform specific feature and it'll
- never be supported on ruby on Windows.
+Sun Jun 16 18:41:42 2013 Tanaka Akira <akr@fsij.org>
- * test/ruby/test_dir_m17n.rb
- (TestDir_M17N#test_filename_extutf8_invalid,
- TestDir_M17N#test_filename_as_bytes_extutf8): ditto.
+ * internal.h (INTEGER_PACK_2COMP): Defined.
+ (rb_integer_pack_2comp): Removed.
- * test/open-uri/test_open-uri.rb
- (TestOpenURI#test_find_proxy_case_sensitive_env): ditto.
+ * 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.
- * test/dl/test_handle.rb (DL::TestHandle#test_NEXT,
- DL::TestHandle#test_DEFAULT): ditto.
+ * pack.c (pack_pack): Ditto.
-Thu Mar 24 23:06:29 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * sprintf.c (rb_str_format): Ditto.
- * vm_insnhelper.c (vm_get_ev_const): should not autoload in
- defined? mode.
+Sun Jun 16 17:48:14 2013 Tanaka Akira <akr@fsij.org>
- * variable.c (rb_const_defined_0): fix autoloading base.
- [ruby-core:35509]
+ * bignum.c (absint_numwords_generic): rb_funcall invocations removed.
-Thu Mar 24 22:48:43 2011 Tanaka Akira <akr@fsij.org>
+Sun Jun 16 16:04:38 2013 NARUSE, Yui <naruse@ruby-lang.org>
- * ext/sdbm/_sdbm.c: parenthesize macro arguments.
+ * tool/config_files.rb: use URI.read to allow it runs with Ruby 1.8.5.
-Thu Mar 24 14:45:57 2011 NARUSE, Yui <naruse@ruby-lang.org>
+Sun Jun 16 14:32:25 2013 Tanaka Akira <akr@fsij.org>
- * ext/openssl/ossl.c: suppress warning: shorten-64-to-32.
+ * bignum.c (bary_pack) Extracted from rb_integer_pack_internal.
+ (absint_numwords_generic): Use bary_pack.
- * ext/openssl/ossl.h: ditto.
+Sun Jun 16 11:01:57 2013 Kouhei Sutou <kou@cozmixng.org>
- * ext/openssl/ossl_asn1.c: ditto.
+ * NEWS (XMLRPC::Client#http): Add.
+ [ruby-core:55197] [Feature #8461]
- * ext/openssl/ossl_bio.c: ditto.
+Sun Jun 16 10:38:45 2013 Tanaka Akira <akr@fsij.org>
- * ext/openssl/ossl_bn.c: ditto.
+ * bignum.c (bary_add): New function.
+ (bary_zero_p): Extracted from bigzero_p.
+ (absint_numwords_generic): Use bary_zero_p and bary_add.
+ (bary_mul): Fix an argument for bary_mul_single.
+ (bary_divmod): Use size_t for arguments.
- * ext/openssl/ossl_cipher.c: ditto.
+Sun Jun 16 08:55:22 2013 Tanaka Akira <akr@fsij.org>
- * ext/openssl/ossl_hmac.c: ditto.
+ * bignum.c (bigdivrem): Use a BDIGIT variable to store the return
+ value of bigdivrem_single.
- * ext/openssl/ossl_ns_spki.c: ditto.
+Sun Jun 16 08:43:59 2013 Tanaka Akira <akr@fsij.org>
- * ext/openssl/ossl_ocsp.c: ditto.
+ * 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.
- * ext/openssl/ossl_pkcs5.c: ditto.
+Sun Jun 16 05:51:51 2013 Masaya Tarui <tarui@ruby-lang.org>
- * ext/openssl/ossl_pkey.c: ditto.
+ * 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.
- * ext/openssl/ossl_pkey_dh.c: ditto.
+Sun Jun 16 05:15:36 2013 Masaya Tarui <tarui@ruby-lang.org>
- * ext/openssl/ossl_pkey_dsa.c: ditto.
+ * gc.c: Add some columns to more detail profile.
+ new columns: Allocated size, Prepare Time, Removing Objects, Empty Objects
- * ext/openssl/ossl_pkey_ec.c: ditto.
+Sun Jun 16 02:04:40 2013 Masaya Tarui <tarui@ruby-lang.org>
- * ext/openssl/ossl_pkey_rsa.c: ditto.
+ * 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.
- * ext/openssl/ossl_rand.c: ditto.
+Sat Jun 15 23:50:24 2013 Tanaka Akira <akr@fsij.org>
- * ext/openssl/ossl_ssl.c: ditto.
+ * bignum.c (bary_sub): New function.
+ (absint_numwords_generic): Use bary_sub.
+ (bigsub_core): Skip unnecessary copy.
- * ext/openssl/ossl_x509ext.c: ditto.
+Sat Jun 15 22:05:30 2013 Tanaka Akira <akr@fsij.org>
- * ext/openssl/ossl_x509name.c: ditto.
+ * 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.
-Thu Mar 24 11:48:19 2011 NARUSE, Yui <naruse@ruby-lang.org>
+Sat Jun 15 20:13:46 2013 Tanaka Akira <akr@fsij.org>
- * ext/openssl/ossl_rand.c (ossl_rand_egd_bytes): use NUM2INT because
- the result is used with functions whose argument is int.
+ * 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.
- * ext/openssl/ossl_ssl.c (ossl_sslctx_setup): ditto.
+Sat Jun 15 19:35:04 2013 Tanaka Akira <akr@fsij.org>
- * ext/openssl/ossl_x509store.c (ossl_x509store_set_purpose): ditto.
+ * bignum.c (absint_numwords_bytes): Make it static.
+ (absint_numwords_small): Ditto.
+ (absint_numwords_generic): Ditto.
- * ext/openssl/ossl_x509store.c (ossl_x509store_set_trust): ditto.
+Sat Jun 15 17:14:32 2013 Tanaka Akira <akr@fsij.org>
- * ext/openssl/ossl_x509store.c (ossl_x509stctx_set_purpose): ditto.
+ * bignum.c (bigmul1_normal): Shrink the result Bignum length.
- * ext/openssl/ossl_x509store.c (ossl_x509stctx_set_trust): ditto.
+Sat Jun 15 10:19:42 2013 Zachary Scott <zachary@zacharyscott.net>
-Thu Mar 24 11:36:55 2011 NARUSE, Yui <naruse@ruby-lang.org>
+ * ext/bigdecimal/bigdecimal.c: Update overview formatting of headers
- * ext/openssl/ossl_x509name.c: id_aref's type is ID.
+Sat Jun 15 10:19:06 2013 Zachary Scott <zachary@zacharyscott.net>
-Thu Mar 24 10:04:35 2011 NARUSE, Yui <naruse@ruby-lang.org>
+ * ext/bigdecimal/bigdecimal.gemspec: Update authors
- * ext/io/console/console.c (console_set_winsize):
- suppress warning: shorten-64-to-32.
+Sat Jun 15 10:02:26 2013 Tanaka Akira <akr@fsij.org>
-Thu Mar 24 09:56:19 2011 NARUSE, Yui <naruse@ruby-lang.org>
+ * bignum.c (bdigs_small_rshift): Extracted from big_rshift.
+ (bigdivrem): Use bdigs_small_rshift.
- * ext/openssl/ossl_ocsp.c (ossl_ocspreq_verify): flags is VALUE,
- so it should use NUM2INT.
+Sat Jun 15 08:37:28 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * ext/openssl/ossl_ocsp.c (ossl_ocspbres_verify): 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 Mar 23 21:09:29 2011 Tanaka Akira <akr@fsij.org>
+Sat Jun 15 02:40:18 2013 Tanaka Akira <akr@fsij.org>
- * ext/readline/readline.c: parenthesize macro arguments.
+ * bignum.c (bdigs_small_lshift): Extracted from big_lshift.
+ (bigdivrem): Use bdigs_small_lshift.
-Wed Mar 23 08:07:33 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Fri Jun 14 20:47:41 2013 Tanaka Akira <akr@fsij.org>
- * numeric.c (flo_round): fix inaccurate results.
+ * bignum.c (bigdivrem): Reduce number of digits before bignew() for div.
-Wed Mar 23 00:12:16 2011 Tajima Akio <artonx@yahoo.co.jp>
+Fri Jun 14 20:12:37 2013 Tanaka Akira <akr@fsij.org>
- * win32/win32.c: wait process real termination after reading
- exit code. fixes #4518
+ * bignum.c (bigdivrem): Use bignew when ny == 1.
-Tue Mar 22 21:20:10 2011 NARUSE, Yui <naruse@ruby-lang.org>
+Fri Jun 14 18:52:51 2013 Koichi Sasada <ko1@atdot.net>
- * lib/rubygems/test_case.rb: save current dir to @current_dir
- before Dir.chdir.
+ * compile.c (rb_iseq_compile_node): fix location of a `trace'
+ instruction (b_return event).
+ [ruby-core:55305] [ruby-trunk - Bug #8489]
+ (need a backport to 2.0.0?)
-Tue Mar 22 20:10:04 2011 Tanaka Akira <akr@fsij.org>
+ * test/ruby/test_settracefunc.rb: add a test.
- * ext/psych/parser.c: parenthesize macro arguments.
+Fri Jun 14 18:18:07 2013 Koichi Sasada <ko1@atdot.net>
-Tue Mar 22 20:10:01 2011 Tanaka Akira <akr@fsij.org>
+ * class.c, include/ruby/ruby.h: add write barriers for T_CLASS,
+ T_MODULE, T_ICLASS.
- * ext/openssl/ruby_missing.h: parenthesize macro arguments.
+ * constant.h: constify rb_const_entry_t::value and file to detect
+ assignment.
-Tue Mar 22 13:33:22 2011 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
+ * variable.c, internal.h (rb_st_insert_id_and_value, rb_st_copy):
+ added. update table with write barrier.
- * ext/openssl/lib/openssl/buffering.rb: removed circular require of
- openssl.rb.
+ * method.h: constify some variables to detect assignment.
- * ext/openssl/lib/openssl/*: removed following comment for transition
- measures of avoiding circular require. No one claimed about this as
- far as I know.
- ##
- # Should we care what if somebody require this file directly?
- # require "openssl"
+ * object.c (init_copy): add WBs.
-Tue Mar 22 10:57:36 2011 NARUSE, Yui <naruse@ruby-lang.org>
+ * variable.c: ditto.
- * test/runner.rb: set Gem::TestCase's @@project_dir.
+ * vm_method.c (rb_add_method): ditto.
- * lib/rubygems/test_case.rb: set Gem::TestCase's @@project_dir only
- when it is not defined.
+Fri Jun 14 14:33:47 2013 Shugo Maeda <shugo@ruby-lang.org>
-Tue Mar 22 09:38:19 2011 NARUSE, Yui <naruse@ruby-lang.org>
+ * NEWS: add a note for Module#using.
- * numeric.c (flo_round): use pow instead of while-loop. fixes #4510
- patched by Alex Young [ruby-core:35526]
+Fri Jun 14 13:40:27 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Tue Mar 22 06:47:46 2011 NARUSE, Yui <naruse@ruby-lang.org>
+ * .travis.yml (before_script): update config files.
- * ext/date/date_strftime.c (date_strftime_wo_timespec):
- suppress warning: shorten-64-to-32.
+ * common.mk ($(srcdir)/tool/config.{guess,sub}): use get-config_files.
-Tue Mar 22 06:42:42 2011 NARUSE, Yui <naruse@ruby-lang.org>
+ * tool/config_files.rb: split get-config_files.
- * ext/date/date_core.c: suppress warning: shorten-64-to-32.
+ * common.mk (update-config_files): rule to download config files.
-Tue Mar 22 06:41:37 2011 NARUSE, Yui <naruse@ruby-lang.org>
+ * tool/config.guess, tool/config.sub: remove and download from the
+ upstream.
- * lib/test/unit/parallel.rb: remove unused variable.
+ * tool/config_files.rb: download config files from GNU.
-Tue Mar 22 06:19:42 2011 NARUSE, Yui <naruse@ruby-lang.org>
+Fri Jun 14 12:21:20 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * enc/utf_16le.c: suppress warning: shorten-64-to-32.
+ * include/ruby/ruby.h (RUBY_SAFE_LEVEL_CHECK): suppress warnings
+ "left-hand operand of comma expression has no effect", on gcc 4.4.
- * ext/dbm/dbm.c: ditto.
+Fri Jun 14 09:48:48 2013 Shugo Maeda <shugo@ruby-lang.org>
- * ext/gdbm/gdbm.c: ditto.
+ * NEWS: add notes for $SAFE.
- * parse.y (Init_ripper): suppress warning: unused value.
+ * doc/security.rdoc: remove the description of $SAFE=4.
-Mon Mar 21 11:21:32 2011 Shota Fukumori <sorah@tubusu.net>
+Fri Jun 14 00:14:29 2013 Tanaka Akira <akr@fsij.org>
- * lib/test/unit.rb: Refactoring. Unified if and elsif.
+ * bignum.c (bigdivrem): Zero test condition simplified.
-Sun Mar 20 23:09:34 2011 Tadayoshi Funaba <tadf@dotrb.org>
+Thu Jun 13 23:43:11 2013 Zachary Scott <zachary@zacharyscott.net>
- * ext/date/date_strftime.c: checks duplicated modifiers.
+ * ext/bigdecimal/*: improve documentation, nodoc samples with @mrkn
-Sun Mar 20 22:32:30 2011 Tadayoshi Funaba <tadf@dotrb.org>
+Thu Jun 13 23:02:14 2013 Kouhei Sutou <kou@cozmixng.org>
- * ext/date/date_strftime.c: removed unused code and arguments.
+ * lib/xmlrpc/client.rb (XMLRPC::Client#http): Add reader for raw
+ Net::HTTP. [ruby-core:55197] [Feature #8461]
+ Reported by Herwin Weststrate. Thanks!!!
-Sun Mar 20 21:34:49 2011 Tadayoshi Funaba <tadf@dotrb.org>
+Thu Jun 13 22:44:52 2013 Kouhei Sutou <kou@cozmixng.org>
- * ext/date/date_core.c: replacement of implementation of
- strftime. It has some limitations that is same as Time's
- one. [experimental]
- * ext/date/date_strftime.c: new.
- * ext/date/lib/date/format.rb: removed ruby version of strftime.
+ * 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.
-Sun Mar 20 12:43:12 2011 Tanaka Akira <akr@fsij.org>
+Thu Jun 13 22:35:50 2013 Kouhei Sutou <kou@cozmixng.org>
- * ext/openssl/ossl_x509store.c: parenthesize macro arguments.
+ * lib/xmlrpc/client.rb (XMLRPC::Client#parse_set_cookies): Use
+ guard style.
-Sun Mar 20 01:39:48 2011 Tajima Akio <artonx@yahoo.co.jp>
+Thu Jun 13 22:12:32 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * hash.c (ruby_setenv): check env process block size with OS ver.
- * win32/win32.c: export rb_w32_osver for above patch.
- * include/ruby/win32.h: declare rb_w32_osver for Win32 Libs.
+ * lib/fileutils.rb (FileUtils#rmdir): fix traversal loop, not trying
+ remove same directory only.
-Sat Mar 19 18:35:05 2011 Tajima Akio <artonx@yahoo.co.jp>
+Thu Jun 13 21:30:14 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * hash.c (ruby_setenv): calculate total env block size for win32.
- * test/ruby/test_env.rb: add test for above patch.
+ * configure.in (opt-dir), tool/ifchange: get rid of "alternate value"
+ expansion for legacy sh. [ruby-dev:47420] [Bug #8524]
-Sat Mar 19 17:14:46 2011 Tajima Akio <artonx@yahoo.co.jp>
+Thu Jun 13 21:24:09 2013 Tanaka Akira <akr@fsij.org>
- * hash.c (ruby_setenv): checking with max process environment
- block size for Win32. 32767 for 2000/XP, 2003. if failed to
- read the block, then checking with 5120 for earlier Windows.
+ * bignum.c (bigdivrem): Refactored to use ALLOCV_N for temporary
+ buffers.
-Sat Mar 19 12:30:25 2011 Tanaka Akira <akr@fsij.org>
+Thu Jun 13 18:54:11 2013 NAKAMURA Usaku <usa@ruby-lang.org>
- * ext/openssl/ossl_x509revoked.c: parenthesize macro arguments.
+ * 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.
-Fri Mar 18 20:44:36 2011 Tanaka Akira <akr@fsij.org>
+Thu Jun 13 18:53:14 2013 Tanaka Akira <akr@fsij.org>
- * ext/openssl/ossl_x509req.c: parenthesize macro arguments.
+ * test/ruby/test_thread.rb (test_thread_local_security): Don't create
+ an unused thread.
-Fri Mar 18 08:48:06 2011 Oleg Shaldybin <oleg.shaldybin@gmail.com>
+Thu Jun 13 18:34:20 2013 Tanaka Akira <akr@fsij.org>
- * lib/fileutils.rb (FileUtils::Entry_#copy_file): updated FileUtils.cp
- to still copy file permissions when :preserve is false (as cp does
- this even when -p isn't set).
+ * bignum.c (bigdivrem): Use nlz.
-Fri Mar 18 00:59:38 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Thu Jun 13 14:51:06 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * ext/win32ole/extconf.rb (create_docfile): removed. should not
- modify source directory unnecessarily, platform dependent
- documentation should be dealt with by rdoc. [ruby-core:35495]
+ * include/ruby/ruby.h (RUBY_SAFE_LEVEL_CHECK): check constant safe
+ level at compile time.
-Fri Mar 18 00:54:20 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Thu Jun 13 14:39:08 2013 Shugo Maeda <shugo@ruby-lang.org>
- * include/ruby/ruby.h (rb_funcall_passing_block): add prototype.
- a patch by James M. Lawrence at [ruby-core:35501]
+ * 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.
-Wed Mar 17 06:23:31 2011 Tanaka Akira <akr@fsij.org>
+Thu Jun 13 10:47:16 2013 Shugo Maeda <shugo@ruby-lang.org>
- * ext/openssl/ossl_x509name.c: parenthesize macro arguments.
+ * bootstraptest/test_autoload.rb, bootstraptest/test_method.rb:
+ remove tests for $SAFE=4.
-Wed Mar 16 20:36:56 2011 Tanaka Akira <akr@fsij.org>
+ * lib/pp.rb: use taint instead of untrust to avoid warnings when
+ $VERBOSE is set to true.
- * ext/socket/ipsocket.c (init_inetsock_internal): raise an error on
- listen(2) failure.
- reported by Xavier Shay. [ruby-core:35505]
+Thu Jun 13 06:12:18 2013 Tanaka Akira <akr@fsij.org>
-Wed Mar 16 15:06:21 2011 Eric Hodel <drbrain@segment7.net>
+ * 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]
- * ext/openssl/lib/openssl/buffering.rb (module OpenSSL): #flush should
- not change sync mode on exception.
- * test/openssl/test_buffering.rb: added
+Thu Jun 13 05:32:13 2013 Eric Hodel <drbrain@segment7.net>
-Wed Mar 16 13:45:28 2011 Eric Hodel <drbrain@segment7.net>
+ * ext/socket/extconf.rb: Enable RFC 3542 IPV6 socket options for OS X
+ 10.7+. [ruby-trunk - Bug #8517]
- * ext/openssl/lib/openssl/buffering.rb: de-nest Buffering module
+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.
- * ext/openssl/lib/openssl/buffering.rb: add RDoc
+Wed Jun 12 20:18:03 2013 Kouhei Sutou <kou@cozmixng.org>
-Wed Mar 16 08:40:39 2011 Tanaka Akira <akr@fsij.org>
+ * lib/xmlrpc/client.rb (XMLRPC::Client#parse_set_cookies): Extract.
- * ext/openssl/ossl_x509ext.c: parenthesize macro arguments.
+Wed Jun 12 18:19:41 2013 Tanaka Akira <akr@fsij.org>
-Tue Mar 15 18:34:27 2011 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.
- * ext/openssl/ossl_x509crl.c: parenthesize macro arguments.
+Wed Jun 12 16:41:38 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Tue Mar 15 09:49:03 2011 Shota Fukumori <sorah@tubusu.net>
+ * array.c (rb_ary_sort_bang): remove duplicated assertions.
+ ARY_HEAP_PTR() implies ary not to be embedded. [ruby-dev:47419]
+ [Bug #8518]
- * test/misc/test_ruby_mode.rb (test_singleton_class): Skip for Pending.
+Wed Jun 12 12:44:45 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Mon Mar 14 21:20:44 2011 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
+ * io.c (io_getc): fix 7bit coderange condition, check if ascii read
+ data instead of read length. [ruby-core:55444] [Bug #8516]
- * test/ruby/test_require.rb (test_require_too_long_filename):
- increase path length, because MAXPATHLEN is defined as 4096 on linux.
+Wed Jun 12 12:35:13 2013 Tanaka Akira <akr@fsij.org>
- * test/ruby/test_require.rb (test_require_path_home_1): ditto.
+ * pack.c (pack_pack): Use rb_integer_pack_2comp.
- * test/ruby/test_require.rb (test_require_path_home_2): ditto.
+Wed Jun 12 12:07:04 2013 Tanaka Akira <akr@fsij.org>
-Mon Mar 14 19:54:37 2011 Tanaka Akira <akr@fsij.org>
+ * sprintf.c (rb_str_format): Fix a dynamic format string.
- * ext/openssl/ossl_x509cert.c: parenthesize macro arguments.
+Wed Jun 12 12:04:09 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Sun Mar 13 18:11:28 2011 Tanaka Akira <akr@fsij.org>
+ * array.c (rb_ary_uniq_bang): must not be modified once frozen even in
+ a callback method.
- * ext/openssl/ossl_x509attr.c: parenthesize macro arguments.
+Wed Jun 12 12:03:43 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Sun Mar 13 16:07:58 2011 Shota Fukumori <sorah@tubusu.net>
+ * array.c (rb_ary_sort_bang): must not be modified once frozen even in
+ a callback method.
- * lib/pstore.rb: Fix don't raise "nested transaction" when thread_safe
- is true. Patch by Masaki Matsushita (Glass_saga). [ruby-dev:43337]
+Wed Jun 12 12:00:15 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * test/test_pstore.rb: Test for above.
- Patch by Masaki Matsushita (Glass_saga) [ruby-dev:43337]
+ * array.c (FL_SET_EMBED): shared object is frozen even when get
+ unshared.
-Sat Mar 12 04:12:41 2011 Tanaka Akira <akr@fsij.org>
+ * array.c (rb_ary_modify): ARY_SET_CAPA needs unshared array.
- * ext/openssl/ossl_ssl_session.c: parenthesize macro arguments.
+Wed Jun 12 07:32:01 2013 Tanaka Akira <akr@fsij.org>
-Sat Mar 12 02:27:07 2011 Tadayoshi Funaba <tadf@dotrb.org>
+ * random.c (rand_int): Use rb_big_uminus.
- * ext/date/date_core.c ({d,dt}_lite_marshal_load): checks the given
- argument.
+Wed Jun 12 07:12:54 2013 Eric Hodel <drbrain@segment7.net>
-Sat Mar 12 01:26:24 2011 Tadayoshi Funaba <tadf@dotrb.org>
+ * 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.
- * ext/date/date_core.c: changed some directives.
+Wed Jun 12 06:35:01 2013 Tanaka Akira <akr@fsij.org>
-Sat Mar 12 01:16:02 2011 Tadayoshi Funaba <tadf@dotrb.org>
+ * internal.h (INTEGER_PACK_NEGATIVE): Defined.
+ (rb_integer_unpack): sign argument removed.
- * ext/date/date_core.c, ext/date/lib/*: moved rdoc descriptions.
+ * 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.
-Sat Mar 12 00:06:24 2011 Tadayoshi Funaba <tadf@dotrb.org>
+ * pack.c (pack_unpack): Follow the above change.
- * ext/date/lib: moved from lib.
+ * random.c (int_pair_to_real_inclusive): Ditto.
+ (make_seed_value): Ditto.
+ (mt_state): Ditto.
+ (limited_big_rand): Ditto.
-Fri Mar 11 23:32:38 2011 Tadayoshi Funaba <tadf@dotrb.org>
+ * marshal.c (r_object0): Ditto.
- * lib/date/delta*: removed undocumented delta.
+Wed Jun 12 00:07:46 2013 Kouhei Sutou <kou@cozmixng.org>
-Fri Mar 11 18:42:43 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * test/xmlrpc/test_client.rb (XMLRPC::ClientTest#test_cookie_simple):
+ Add a test for the extracted method.
- * lib/mkmf.rb (find_executable0): should exclude directories.
+Tue Jun 11 23:56:24 2013 Kouhei Sutou <kou@cozmixng.org>
-Fri Mar 11 01:40:35 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * test/xmlrpc/test_client.rb (XMLRPC::ClientTest::Fake::HTTP#started):
+ Add a missing empty line.
- * process.c (proc_getmaxgroups, proc_setmaxgroups): Process#maxgroups
- and Process#maxgroups= now raise NotImplementedError if the
- platform don't support supplementary groups concept.
+Tue Jun 11 23:37:19 2013 Tanaka Akira <akr@fsij.org>
-Fri Mar 11 01:25:03 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * 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.
- * process.c (get_sc_ngroups_max): return -1 if platform don't
- support NGROUPS_MAX.
+ * hash.c (rb_hash): Ditto.
-Thu Mar 10 22:28:15 2011 Tanaka Akira <akr@fsij.org>
+ * time.c (v2w_bignum): Ditto.
- * ext/openssl/ossl_ssl.h: parenthesize macro arguments.
+Tue Jun 11 23:01:57 2013 Tanaka Akira <akr@fsij.org>
-Thu Mar 10 21:59:37 2011 NARUSE, Yui <naruse@ruby-lang.org>
+ * bignum.c (validate_integer_pack_format): Refine error messages.
- * parse.y (parser_encode_length): add exception as UTF8-MAC for
- magic comment's emacs newline specifier
- patched by James M. Lawrence [ruby-core:35476] fixes #4489
+Tue Jun 11 22:25:04 2013 Tanaka Akira <akr@fsij.org>
-Thu Mar 10 16:00:22 2011 NARUSE, Yui <naruse@ruby-lang.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.
- * parse.y (parser_encode_length): fix typo: the length of
- "-dos" and "-mac" is not 5 but 4.
- patched by James M. Lawrence [ruby-core:35476] fixes #4489
+Tue Jun 11 20:52:43 2013 Tanaka Akira <akr@fsij.org>
-Thu Mar 10 10:52:01 2011 NAKAMURA Usaku <usa@ruby-lang.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.
- * test/ruby/test_require.rb: setting too long string to ENV causes
- Errno::EINVAL on Windows. long path name errors may causes over
- about 1024 bytes, then limit it about 4000 bytes.
+ * internal.h (rb_integer_pack_2comp): Declared.
-Thu Mar 10 10:09:35 2011 NARUSE, Yui <naruse@ruby-lang.org>
+ * 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.
- * lib/test/unit.rb (Test::Unit::Runner::Worker#read): fix for the case
- when IO#read or IO#gets returns nil.
+Tue Jun 11 16:15:03 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Thu Mar 10 07:12:03 2011 Ryan Davis <ryand-ruby@zenspider.com>
+ * array.c (ary_shrink_capa): shrink the capacity so it fits just with
+ the length.
- * lib/rubygems*: Import rubygems 1.6.2 (release candidate @ 2026fbb5)
- * test/rubygems: Ditto
- * test/runner.rb: Added test to load path to fix test requires.
+ * array.c (ary_make_shared): release never used elements from frozen
+ array to be shared. [ruby-dev:47416] [Bug #8510]
-Thu Mar 10 03:00:43 2011 Tanaka Akira <akr@fsij.org>
+Tue Jun 11 12:49:01 2013 Zachary Scott <zachary@zacharyscott.net>
- * ext/openssl/ossl_ssl.c: parenthesize macro arguments.
+ * doc/re.rdoc: Rename to doc/regexp.rdoc
+ * re.c: Update rdoc include for rename of file
-Wed Mar 9 23:51:26 2011 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
+Tue Jun 11 07:13:13 2013 Masaya Tarui <tarui@ruby-lang.org>
- * test/ruby/test_io_m17n.rb (test_io_new_enc): "sjis" is now an alias
- of Windows-31J.
+ * eval_error.c (error_print): keep that errat is non-shady object.
+ and guard errat from GC.
-Wed Mar 9 23:06:13 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Tue Jun 11 05:04:25 2013 Benoit Daloze <eregontp@gmail.com>
- * misc/ruby-mode.el (ruby-parse-partial): fix indent after aref.
+ * 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.
-Wed Mar 9 12:50:24 2011 Aaron Patterson <aaron@tenderlovemaking.com>
+Mon Jun 10 23:51:51 2013 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
- * ext/psych/lib/psych/visitors/yaml_tree.rb: Rescue exceptions when
- people implement the method method. Thanks Lin Jen-Shin.
- [ruby-core:35255]
+ * 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
- * test/psych/visitors/test_yaml_tree.rb: test for implementation of
- method method.
+Mon Jun 10 21:51:03 2013 Kouhei Sutou <kou@cozmixng.org>
-Wed Mar 9 11:53:31 2011 NARUSE, Yui <naruse@ruby-lang.org>
+ * ext/socket/raddrinfo.c (nogvl_getaddrinfo): Fix indent.
- * enc/shift_jis.c: Change SJIS as an alias of Windows-31J.
- [ruby-dev:43027] fixes #4280
+Mon Jun 10 21:49:43 2013 Kouhei Sutou <kou@cozmixng.org>
- * enc/shift_jis.c: Add PCK as an alias of Windows-31J.
+ * ext/socket/raddrinfo.c (nogvl_getaddrinfo): Add missing return
+ value assignment.
-Wed Mar 9 00:45:29 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Mon Jun 10 20:58:11 2013 NARUSE, Yui <naruse@ruby-lang.org>
- * ext/extmk.rb: nmake substitutes all occurrences in macro.
+ * ext/socket/raddrinfo.c (nogvl_getaddrinfo): work around for Ubuntu
+ 13.04's getaddrinfo issue with mdns4. [ruby-list:49420]
- * ext/extmk.rb: workaround for nmake.
+Mon Jun 10 19:34:39 2013 Tanaka Akira <akr@fsij.org>
-Tue Mar 8 23:49:45 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * bignum.c (rb_integer_pack): Returns sign instead of words.
+ (absint_numwords_generic): Follow the above change.
+ (big2str_base_powerof2): Follow the above change.
- * process.c (proc_setgroups): cleanup.
+ * internal.h: Ditto.
-Tue Mar 8 23:40:30 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * hash.c (rb_hash): Ditto.
- * test/misc/test_ruby_mode.rb: test for ruby-mode.el.
+ * pack.c (pack_pack): Ditto.
-Tue Mar 8 23:27:38 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * random.c (int_pair_to_real_inclusive): Ditto.
+ (rand_init): Ditto.
+ (random_load): Ditto.
+ (limited_big_rand): Ditto.
- * process.c (get_sc_ngroups_max): try to use NGROUPS_MAX at first if
- _SC_NGROUP_MAX is not defined.
+ * time.c (v2w_bignum): Ditto.
-Tue Mar 8 23:10:16 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Mon Jun 10 17:20:01 2013 Koichi Sasada <ko1@atdot.net>
- * misc/ruby-mode.el (ruby-parse-partial): fix for array in block.
+ * gc.c (rgengc_remember): permit promoted object.
+ (rb_gc_writebarrier -> remember)
-Tue Mar 8 21:44:49 2011 Tanaka Akira <akr@fsij.org>
+Mon Jun 10 17:14:01 2013 Koichi Sasada <ko1@atdot.net>
- * ext/openssl/ossl_rand.c: parenthesize macro arguments.
+ * gc.c (RVALUE_PROMOTE): fix parameter name (`x' to `obj')
+ and make it inline function (like RVALUE_PROMOTE).
-Tue Mar 8 16:45:31 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+Mon Jun 10 16:22:50 2013 Koichi Sasada <ko1@atdot.net>
- * hash.c (ruby_setenv): MSDN says that Windows XP or earlier limits
- the total size of environment block to 5,120 chars. and on such
- OS, putenv() causes SEGV. So, ruby should limit the size of an
- environment variable to 5,120 bytes for workaround.
+ * array.c (rb_ary_new_from_values): add assertion
+ (ary should be young object).
-Tue Mar 8 15:57:20 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+Mon Jun 10 16:05:59 2013 Koichi Sasada <ko1@atdot.net>
- * test/rubygems/test_gem_spec_fetcher.rb
- (TestGemSpecFetcher#test_cache_dir_escapes_windows_paths): cache_dir
- may have driveletter and `:' for base of cache_dir itself, so need
- to skip it for checking.
+ * gc.c (wmap_mark): check allocation of `w->obj2wmap'.
+ (no-allocation `w->obj2wmap' will be NULL pointer reference)
-Tue Mar 8 12:30:06 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Mon Jun 10 15:36:00 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * misc/ruby-mode.el (ruby-deep-indent-paren-p, ruby-calculate-indent):
- do not apply deep-indent inside parens at the beginning of
- expressions.
+ * eval_error.c (error_print): use checking functions instead of
+ catching exceptions.
-Tue Mar 8 09:32:48 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * eval_error.c (error_print): restore errinfo for the case new
+ exception raised while printing the message. [ruby-core:55365]
+ [Bug #8501]
- * common.mk (configure-ext, build-ext), ext/extmk.rb (extmake):
- support parallel-make under ext.
+ * eval_error.c (error_print): reduce calling setjmp.
-Tue Mar 8 09:25:23 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Mon Jun 10 12:10:06 2013 Tanaka Akira <akr@fsij.org>
- * process.c (proc_setgroups): use getgrnam() if getgrnam_r() is
- not available.
+ * 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.
- * process.c: RARRAY_LEN() returns long int.
+Mon Jun 10 05:38:23 2013 Tanaka Akira <akr@fsij.org>
-Tue Mar 8 09:07:03 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * bignum.c (absint_numwords_small): New function.
+ (absint_numwords_generic): Use absint_numwords_small if possible.
- * configure.in (RUBY_REPLACE_TYPE): enclose in quotes for multiple
- type names.
+Mon Jun 10 01:07:57 2013 Tanaka Akira <akr@fsij.org>
-Tue Mar 8 01:43:11 2011 NARUSE, Yui <naruse@ruby-lang.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.
- * process.c (get_sc_ngroups_max): define to wrap sysconf(3).
- this also supports Windows which doesn't have sysconf(3).
+Sun Jun 9 21:33:15 2013 Tanaka Akira <akr@fsij.org>
- * process.c (maxgroups): use get_sc_ngroups_max.
+ * bignum.c (rb_absint_numwords): Return (size_t)-1 when overflow.
+ Refine variable names.
+ (rb_absint_size): Refine variable names.
- * process.c (proc_setmaxgroups): ditto.
+ * internal.h (rb_absint_size): Refine an argument name.
+ (rb_absint_numwords): Ditto.
-Tue Mar 8 01:16:49 2011 NARUSE, Yui <naruse@ruby-lang.org>
+Sun Jun 9 16:51:41 2013 Tanaka Akira <akr@fsij.org>
- * gc.c (rb_objspace): an initializer must be a constant.
+ * bignum.c (rb_absint_numwords): Renamed from rb_absint_size_in_word.
-Tue Mar 8 01:11:44 2011 NARUSE, Yui <naruse@ruby-lang.org>
+ * internal.h (rb_absint_numwords): Follow the above change.
- * process.c (maxgroups): cast because sysconf(3)'s return value is long.
+ * pack.c (pack_pack): Ditto.
- * process.c (proc_setmaxgroups): ditto.
+ * random.c (rand_init): Ditto.
+ (limited_big_rand): Ditto.
- * process.c (proc_setgroups): cast because RARRAY_LEN() is long.
+Sun Jun 9 14:41:05 2013 Tanaka Akira <akr@fsij.org>
-Tue Mar 8 00:02:47 2011 Tanaka Akira <akr@fsij.org>
+ * bignum.c (rb_integer_pack): numwords_allocated argument removed.
- * ext/openssl/ossl_pkey_rsa.c: parenthesize macro arguments.
+ * internal.h (rb_integer_pack): Follow the above change.
-Mon Mar 7 22:59:39 2011 Shota Fukumori <sorah@tubusu.net>
+ * hash.c (rb_hash): Ditto.
- * lib/pstore.rb: Delete variable @transaction and fix #4474. Patch by
- Masaki Matsushita (Glass_saga).
+ * time.c (v2w_bignum): Ditto.
- * test/test_pstore.rb(test_thread_safe): Add test for #4474.
+ * pack.c (pack_pack): Ditto.
-Mon Mar 7 21:31:38 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * random.c (int_pair_to_real_inclusive): Ditto.
+ (rand_init): Ditto.
+ (random_load): Ditto.
+ (limited_big_rand): Ditto.
- * process.c (proc_setgroups): replace getgrnam() with getgrnam_r()
- because getgrnam() isn't thread safe.
+Sun Jun 9 09:34:44 2013 Tanaka Akira <akr@fsij.org>
-Mon Mar 7 20:49:12 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * bignum.c (big2str_base_powerof2): New function.
+ (rb_big2str0): Use big2str_base_powerof2 if base is 2, 4, 8, 16 or 32.
- * process.c (proc_getmaxgroups, proc_setmaxgroups): reflect
- platform maxgroups limitation by default instead hardcoded 65536.
+Sun Jun 9 00:59:04 2013 Tanaka Akira <akr@fsij.org>
-Mon Mar 7 17:13:00 2011 Yukihiro Matsumoto <matz@ruby-lang.org>
+ * hash.c (rb_hash): Use rb_integer_pack to obtain least significant
+ long integer.
- * gc.c (rb_gc_set_params): allow GC parameter configuration by
- environment variables. based on a patch from funny-falcon at
- https://gist.github.com/856296, but honors safe level.
+Sat Jun 8 23:56:00 2013 Tanaka Akira <akr@fsij.org>
-Mon Mar 7 09:05:18 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * numeric.c (rb_num_to_uint): Use rb_absint_size instead of
+ RBIGNUM_LEN.
- * process.c: NUM2RLIM is defined but no getrlimit and setrlimit on
- mingw.
+Sat Jun 8 22:53:45 2013 Tanaka Akira <akr@fsij.org>
-Mon Mar 7 08:38:14 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * marshal.c (r_object0): Use rb_integer_unpack.
- * ext/date/date_core.c (DateTimeData): should not use bare 'long long'
- and 'long double', which are not defined by C89.
+Sat Jun 8 22:18:57 2013 Tanaka Akira <akr@fsij.org>
- * ext/date/date_core.c (dt_lite_plus): get rid of overflow at casting
- down double to integer.
+ * time.c (v2w): Use rb_absint_size instead of RBIGNUM_LEN.
-Mon Mar 7 00:21:11 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+Sat Jun 8 21:47:33 2013 Tanaka Akira <akr@fsij.org>
- * process.c (proc_getgroups): get rid of maxgroups dependency.
- ngroups can be calculated dynamically.
+ * time.c (v2w_bignum): Simplified using rb_integer_pack.
+ (rb_big_abs_find_maxbit): Removed.
-Sun Mar 6 23:45:40 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+Sat Jun 8 21:03:40 2013 Tanaka Akira <akr@fsij.org>
- * configure.in: rlim_t use standard RUBY_REPLACE_TYPE mechanism.
+ * bignum.c (rb_absint_singlebit_p): New function.
-Sun Mar 6 23:26:07 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * internal.h (rb_absint_singlebit_p): Declared.
- * process.c (proc_setmaxgroups): added negative value check.
- This was suggested by Daniel Berger. Thanks Daniel!
- [ruby-core:35426][Bug#4467]
+ * time.c (v2w_bignum): Use rb_absint_singlebit_p instead of
+ rb_big_abs_find_minbit.
+ (rb_big_abs_find_minbit): Removed.
-Sun Mar 6 23:18:23 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+Sat Jun 8 20:24:23 2013 Tanaka Akira <akr@fsij.org>
- * process.c (maxgroups, proc_setmaxgroups): increase max groups
- limitation up to 65536.
+ * time.c (rb_big_abs_find_maxbit): Use rb_absint_size.
+ (bdigit_find_maxbit): Removed.
-Sun Mar 6 22:20:59 2011 Tanaka Akira <akr@fsij.org>
+Sat Jun 8 19:47:00 2013 Charlie Somerville <charliesome@ruby-lang.org>
- * ext/openssl/ossl_pkey_ec.c: parenthesize macro arguments.
+ * class.c (include_modules_at): invalidate method cache if included
+ module contains constants
-Sun Mar 6 21:49:04 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * test/ruby/test_module.rb: add test
- * sample/list.rb (MyElem#initialize): initialize @head
- explicitly. Otherwise -W2 option makes following warning.
- "warning: instance variable @head not initialized".
- This issue was founded by Andrew Grimm. Thanks Andrew!
- [ruby-core:35435][Bug#4471]
+Sat Jun 8 19:31:00 2013 Charlie Somerville <charliesome@ruby-lang.org>
-Sun Mar 6 05:21:41 2011 NARUSE, Yui <naruse@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.
- * class.c: fix camelCase to snake_case in documentation code examples.
- patched by Andrew Grimm. fixes Bug #4469
+Sat Jun 8 19:23:53 2013 NARUSE, Yui <naruse@ruby-lang.org>
- * marshal.c: ditto.
+ * 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.
- * proc.c: ditto.
+Sat Jun 8 19:06:26 2013 Tanaka Akira <akr@fsij.org>
- * sample/biorhythm.rb: ditto.
+ * random.c: Unused RBignum internal accessing macros removed.
- * vm_eval.c: ditto.
+Sat Jun 8 19:04:15 2013 Tanaka Akira <akr@fsij.org>
- * vm_method.c: ditto.
+ * 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>
-Sun Mar 6 03:22:27 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * random.c (make_seed_value): Fix the length given for
+ rb_integer_unpack.
- * io.c (io_cntl): use rb_thread_io_blocking_region() instead
- rb_thread_blocking_region().
+Sat Jun 8 16:38:02 2013 Tanaka Akira <akr@fsij.org>
-Sat Mar 5 22:54:36 2011 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
+ * bignum.c (rb_integer_unpack): Don't use rb_funcall if possible.
- * include/ruby/intern.h: fix a typo of prototype declaration.
- rb_mutex_try_lock -> rb_mutex_trylock [ruby-dev:43213]
+ * random.c: Use uint32_t for elements of seed.
+ (make_seed_value): Use rb_integer_unpack.
-Sat Mar 5 19:44:03 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+Sat Jun 8 15:58:18 2013 Tanaka Akira <akr@fsij.org>
- * test/ruby/test_io.rb (TestIO#test_fcntl_lock): small clean up.
+ * 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 Mar 5 01:33:46 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+Sat Jun 8 15:30:03 2013 Tanaka Akira <akr@fsij.org>
- * io.c (io_cntl, nogvl_io_cntl): IO.fcntl() and IO.ioctl()
- release GVL during calling kernel interface.
- Suggested by Eric Wong. [ruby-core:35417][Bug #4463]
+ * random.c (rand_init): Use rb_integer_pack.
+ (roomof): Removed.
- * test/ruby/test_io.rb (TestIO#test_fcntl_lock): add new test for
- IO.fcntl().
+Sat Jun 8 14:58:32 2013 Tanaka Akira <akr@fsij.org>
-Fri Mar 4 23:09:12 2011 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
+ * internal.h (INTEGER_PACK_FORCE_BIGNUM): New flag constant.
- * test/testunit/test_parallel.rb
- (test_should_run_all_without_any_leaks): consider that the order of
- testcase could change. [ruby-dev:43300] [Bug #4466]
+ * bignum.c (rb_integer_unpack): Support INTEGER_PACK_FORCE_BIGNUM.
-Fri Mar 4 22:01:14 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * random.c (int_pair_to_real_inclusive): Use
+ INTEGER_PACK_FORCE_BIGNUM to use rb_big_mul instead of rb_funcall.
- * io.c (io_cntl): change 'cmd' type to int. ioctl and fcntl need to
- be passed int.
- * io.c (rb_io_ctl): ditto.
+Sat Jun 8 14:17:01 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Fri Mar 4 21:10:40 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * configure.in: check for NET_LUID. header macro varies across
+ compiler versions.
- * configure.in: save warnflags. the patch is created by Eric Wong.
- [Bug #4465]
+ * win32/win32.c: use configured macro.
-Wed Mar 2 21:15:00 2011 Tanaka Akira <akr@fsij.org>
+Sat Jun 8 11:59:55 2013 Tanaka Akira <akr@fsij.org>
- * ext/openssl/ossl_pkey_dsa.c: parenthesize macro arguments.
+ * random.c (int_pair_to_real_inclusive): Use rb_funcall instead of
+ rb_big_mul because rb_integer_unpack can return a Fixnum.
-Thu Mar 3 22:10:26 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+Sat Jun 8 11:17:39 2013 Tanaka Akira <akr@fsij.org>
- * process.c (check_exec_redirect_fd, check_exec_redirect): raise
- ArgumentError if fd >= 3 on Windows because the feature is not
- supported.
+ * random.c (int_pair_to_real_inclusive): Use rb_integer_pack.
- * test/ruby/test_process.rb (test_execopts_redirect): remove meaningless
- argument.
+Sat Jun 8 09:49:42 2013 Tanaka Akira <akr@fsij.org>
-Thu Mar 3 21:21:42 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+ * random.c (int_pair_to_real_inclusive): Use rb_integer_unpack.
- * test/ruby/test_process.rb (test_execopts_redirect): redirecting fd
- >= 3 is not supported on Windows, so should not specify such options
- when calling spawn or others.
+Sat Jun 8 08:12:22 2013 Tanaka Akira <akr@fsij.org>
-Thu Mar 3 18:59:04 2011 NARUSE, Yui <naruse@ruby-lang.org>
+ * random.c (random_load): Use rb_integer_pack.
- * string.c (rb_str_slice_bang): raise error when the string is frozen.
+Sat Jun 8 06:15:46 2013 Tanaka Akira <akr@fsij.org>
-Thu Mar 3 14:25:19 2011 NARUSE, Yui <naruse@ruby-lang.org>
+ * random.c (numberof): Removed.
- * strftime.c (STRFTIME): return 0 and ERANGE when precision is too
- large. [ruby-dev:43284] fixes #4456
+Sat Jun 8 06:00:47 2013 Tanaka Akira <akr@fsij.org>
-Thu Mar 3 00:46:51 2011 NARUSE, Yui <naruse@ruby-lang.org>
+ * random.c: include internal.h.
+ (mt_state): Use rb_integer_unpack.
- * addr2line.c (uleb128): cast the value to unsigned long.
+Sat Jun 8 00:55:51 2013 Tanaka Akira <akr@fsij.org>
- * addr2line.c (fill_lines): print error when lseek fails.
+ * 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.
-Thu Mar 3 00:36:29 2011 NARUSE, Yui <naruse@ruby-lang.org>
+Sat Jun 8 00:37:32 2013 Tanaka Akira <akr@fsij.org>
- * lib/rexml/encoding.rb (REXML::Encoding#encoding=): store @encoding
- a String which means the name of the encoding.
- this partially revert r29646.
+ * 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.
- * lib/rexml/document.rb: follow above.
+Fri Jun 7 23:58:06 2013 Tanaka Akira <akr@fsij.org>
- * lib/rexml/output.rb: ditto.
+ * 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.
- * lib/rexml/parsers/baseparser.rb: ditto.
+ * pack.c: Ditto.
- * lib/rexml/source.rb: 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.
- * lib/rexml/xmldecl.rb: ditto.
+Fri Jun 7 22:10:50 2013 NARUSE, Yui <naruse@ruby-lang.org>
-Wed Mar 2 23:19:56 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * lib/rubygems/specification.rb (Gem::Specification#to_yaml):
+ use Gem::NoAliasYAMLTree.create instead of Gem::NoAliasYAMLTree.new
+ to suppress deprecated warnings.
- * string.c (str_byte_substr): return nil for negative length.
+Fri Jun 7 21:39:39 2013 Tanaka Akira <akr@fsij.org>
-Wed Mar 2 21:15:00 2011 Tanaka Akira <akr@fsij.org>
+ * bignum.c (rb_integer_pack): Renamed from rb_int_export.
+ (rb_integer_unpack): Renamed from rb_int_import.
- * ext/openssl/ossl_pkey_dh.c: parenthesize macro arguments.
+ * internal.h, pack.c: Follow the above change.
-Wed Mar 2 14:24:04 2011 Shota Fukumori <sorah@tubusu.net>
+Fri Jun 7 21:05:26 2013 Tanaka Akira <akr@fsij.org>
- * lib/test/unit/parallel.rb: Fix name from `inclement_io` to
- `increment_io`.
+ * bignum.c (integer_format_loop_setup): Extracted from rb_int_export
+ and rb_int_import.
-Wed Mar 2 14:06:01 2011 NARUSE, Yui <naruse@ruby-lang.org>
+Fri Jun 7 19:48:38 2013 Tanaka Akira <akr@fsij.org>
- * string.c (rb_str_slice_bang): move treatments which is only needed
- when the result is not nil.
+ * bignum.c (validate_integer_format): Extracted from rb_int_export and
+ rb_int_import.
-Wed Mar 2 14:02:29 2011 Shota Fukumori <sorah@tubusu.net>
+Fri Jun 7 19:23:15 2013 Tanaka Akira <akr@fsij.org>
- * test/testunit/test_parallel.rb(TestParallel#spawn_runner):
- Fix outputing empty line in running test.
+ * bignum.c (rb_absint_size): Use numberof.
+ (rb_int_export): Ditto.
- * test/testunit/tests_for_parallel/test_third.rb: Remove `sleep`
+Fri Jun 7 18:58:56 2013 Tanaka Akira <akr@fsij.org>
-Tue Mar 1 22:29:10 2011 Tanaka Akira <akr@fsij.org>
+ * internal.h (numberof): Gathered from various files.
- * ext/openssl/ossl_pkey.h: parenthesize macro arguments.
+ * 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.
-Tue Mar 1 22:02:35 2011 Shota Fukumori <sorah@tubusu.net>
+Fri Jun 7 18:24:39 2013 Tanaka Akira <akr@fsij.org>
- * lib/test/unit/parallel.rb: Fix number.
+ * bignum.c (rb_absint_size): Declare a variable, i, just before used
+ to suppress a warning.
+ (rb_int_export): Ditto.
-Tue Mar 1 21:48:22 2011 Shota Fukumori <sorah@tubusu.net>
+Fri Jun 7 17:41:00 2013 Charlie Somerville <charliesome@ruby-lang.org>
- * lib/test/unit/parallel.rb: For Windows.
+ * 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
- * test/testunit/test_parallel.rb(TestParallelWorker#test_quit_in_test):
- Fix for above specification change.
- * test/testunit/test_parallel.rb(TestParallel#spawn_runner):
- Fix outputing empty line in running test.
+Fri Jun 7 17:31:00 2013 Charlie Somerville <charliesome@ruby-lang.org>
-Tue Mar 1 20:51:57 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * internal.h (RCLASS_SUPER): use descriptive variable name
+ * internal.h (RCLASS_SET_SUPER): ditto
- * test/ruby/test_system.rb (TestSystem#test_system_at):
- remove tests for [bug#4396]. because we decided to reject this
- ticket.
+Fri Jun 7 13:25:27 2013 NARUSE, Yui <naruse@ruby-lang.org>
-Tue Mar 1 19:46:19 2011 Tadayoshi Funaba <tadf@dotrb.org>
+ * ext/json/fbuffer/fbuffer.h (fbuffer_append_str): change the place of
+ RB_GC_GUARD. it should be after the object is used.
- * test/date/{test_date.rb,test_date_attr.rb}: [ruby-dev:43280]
+Fri Jun 7 13:22:43 2013 NARUSE, Yui <naruse@ruby-lang.org>
-Tue Mar 1 18:40:38 2011 Ryan Davis <ryan@YPCMC09457>
+ * gc.c (before_gc_sweep): noinline can also avoid the segv instead of
+ -O0 of r41084. this way is expected less slow.
- * lib/rubygems*: Import rubygems 1.6.0 (released version @ 58d8a0b9)
- * test/rubygems: Ditto
+Fri Jun 7 11:45:42 2013 Kenta Murata <mrkn@cookpad.com>
-Tue Mar 1 16:22:22 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+ * 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]
- * win32/win32.c: revert r30987 because it causes some failures in
- test-all, especially webrick.
+ * numeric.c (num_quo): ditto.
-Tue Mar 1 15:59:53 2011 NARUSE, Yui <naruse@ruby-lang.org>
+ * test/test_mathn.rb: add a test for the change at r41109.
- * string.c (rb_str_byteslice): the resulted encoding should keep
- original encoding. this also fixes the encoding when the result
- shares internal string. [ruby-core:35376]
+Fri Jun 7 11:41:42 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Tue Mar 1 13:25:00 2011 Kenta Murata <mrkn@mrkn.jp>
+ * configure.in: revert r41106. size_t may not be unsigned
- * ext/bigdecimal/bigdecimal.c (VpMemAlloc): CVE-2011-0188.
- Fixes a bug reported by Drew Yao <ayao at apple.com>
+ * bignum.c (rb_absint_size_in_word, rb_int_export, rb_int_import): use
+ NUM2SIZET() and SIZET2NUM() already defined in ruby/ruby.h.
-Tue Mar 1 10:34:39 2011 NARUSE, Yui <naruse@ruby-lang.org>
+Fri Jun 7 11:28:37 2013 Masaya Tarui <tarui@ruby-lang.org>
- * string.c (rb_str_byteslice): Add String#byteslice. [ruby-core:35376]
+ * 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.
-Tue Mar 1 00:12:49 2011 Tajima Akio <artonx@yahoo.co.jp>
+Fri Jun 7 11:25:56 2013 Masaya Tarui <tarui@ruby-lang.org>
- * include/ruby/win32.h: define WIN32 if neither _WIN64 nor WIN32
- defined. it forces to use push/pop for pack(4) pragma.
+ * gc.c: introduce oldgen bitmap for preparing performance tuning.
-Mon Feb 28 23:52:13 2011 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
+Fri Jun 7 11:20:57 2013 Masaya Tarui <tarui@ruby-lang.org>
- * test/testunit/test_rake_integration.rb (test_with_rake_runner):
- use assert_in_out_err for suppress messages.
+ * gc.c (MARKED_IN_BITMAP, MARK_IN_BITMAP, CLEAR_IN_BITMAP): bring
+ bitmap macros in one place, and introduce BITMAP_BIT.
-Mon Feb 28 22:48:56 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+Fri Jun 7 11:18:35 2013 Masaya Tarui <tarui@ruby-lang.org>
- * win32/win32.c (rb_w32_spawn): use shell if a commandline contain
- double-quote character.
- * win32/win32.c (is_internal_cmd): similar, use shell if a commandline
- contain caret character.
+ * array.c (ary_new): change order of allocation in order
+ to remove FL_OLDGEN operation.
- * test/ruby/test_system.rb (TestSystem#test_system_at): fix
- wrong test case. if system() invoke a command by using shell,
- system() never return nil. Also, "" quotation must not appear
- twice in a command line.
+Fri Jun 7 11:16:28 2013 Masaya Tarui <tarui@ruby-lang.org>
-Mon Feb 28 17:36:57 2011 Tanaka Akira <akr@fsij.org>
+ * tool/rdocbench.rb: add gc total time information.
- * ext/openssl/ossl_pkcs7.c: parenthesize macro arguments.
+Fri Jun 7 10:12:01 2013 Koichi Sasada <ko1@atdot.net>
-Mon Feb 28 16:48:42 2011 Tanaka Akira <akr@fsij.org>
+ * gc.c: remove "Sunny" terminology.
+ "Sunny" doesn't mean antonym of "Shady" (questionable, doubtful, etc).
+ Instead of "Sunny", use "non-shady" or "normal".
- * ext/openssl/ossl_pkcs12.c: parenthesize macro arguments.
+Fri Jun 7 09:29:33 2013 Kenta Murata <mrkn@cookpad.com>
-Mon Feb 28 16:28:15 2011 NARUSE, Yui <naruse@ruby-lang.org>
+ * bignum.c (rb_int_import): explicitly casting BDIGIT_DBL to BDIGIT
+ to prevent warning.
- * string.c (tr_trans): when the hash for multibyte repl is empty,
- tr is inverse mode, and a character doesn't much the table, the
- character should be replaced by last replacement. Bug #4449
+Fri Jun 7 07:29:33 2013 Tanaka Akira <akr@fsij.org>
-Mon Feb 28 16:38:56 2011 Tanaka Akira <akr@fsij.org>
+ * internal.h (rb_int_export): countp argument is split into
+ wordcount_allocated and wordcount.
- * ext/openssl/ossl_ocsp.c: parenthesize macro arguments.
+ * bignum.c (rb_int_export): Follow the above change.
-Mon Feb 28 13:02:15 2011 Danial Pearce <github@tigris.id.au>
+ * pack.c (pack_pack): Ditto.
- * lib/tempfile.rb: Fix example file paths in docs for tempfile.
- https://github.com/ruby/ruby/pull/5
+Fri Jun 7 07:17:00 2013 Kenta Murata <mrkn@mrkn.jp>
-Mon Feb 28 12:56:18 2011 URABE Shyouhei <shyouhei@ruby-lang.org>
+ * NEWS: describe a compatibility issue of Numeric#quo
+ introduced at r41109.
- * ext/openssl/ossl_cipher.c (ossl_cipher_init): typo fix.
- https://github.com/ruby/ruby/pull/8
+Fri Jun 7 07:15:00 2013 Kenta Murata <mrkn@mrkn.jp>
-Mon Feb 28 12:28:13 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+ * NEWS: fix style.
- * ext/date/date_core.c (datetime_s_now): localtime() and localtime_r()
- required time_t pointer as 1st parameter, and tv_sec member of struct
- timeval is long.
+Fri Jun 7 06:48:17 2013 Benoit Daloze <eregontp@gmail.com>
-Mon Feb 28 11:57:40 2011 Shota Fukumori <sorah@tubusu.net>
+ * numeric.c: remove unused ID id_to_r introduced in r41109.
- * test/testunit/test_parallel.rb: Temporally disable test on Windows.
+Fri Jun 7 06:15:31 2013 Tanaka Akira <akr@fsij.org>
-Mon Feb 28 07:28:35 2011 Shota Fukumori <sorah@tubusu.net>
+ * bignum.c (rb_int_import): New function.
+ (int_import_push_bits): Ditto.
- * lib/test/unit.rb(Test::Unit::Runner#after_worker_quit):
- method name more be natural English.
+ * internal.h (rb_int_import): Declared.
- * lib/test/unit.rb(Test::Unit::Runner::Worker.launch):
- IO.sync doesn't need. Should use "b" for mode.
+ * pack.c (pack_unpack): Use rb_int_import for BER compressed integer.
-Sun Feb 27 21:59:37 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+Thu Jun 6 22:24:00 2013 Kenta Murata <mrkn@mrkn.jp>
- * test/ruby/test_system.rb (TestSystem#test_system_redirect_win):
- add test for system().
+ * numeric.c (num_quo): Use to_r method to convert the receiver to
+ rational. [ruby-core:41575] [Bug #5736]
-Sun Feb 27 18:00:09 2011 Shota Fukumori <sorah@tubusu.net>
+ * test/ruby/test_numeric.rb: add a test for the above change.
- * lib/test/unit.rb: Refactoring; Worker never use Hash for internal
- storage.
+Thu Jun 6 20:40:17 2013 Tanaka Akira <akr@fsij.org>
- * lib/test/unit.rb: Never use Kernel#spawn. Use IO.popen instead.
+ * 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.
-Sun Feb 27 13:16:48 2011 Tanaka Akira <akr@fsij.org>
+ * internal.h (rb_absint_size): Declared.
+ (rb_absint_size_in_word): Ditto.
+ (rb_int_export): Ditto.
- * ext/openssl/ossl_ns_spki.c: parenthesize macro arguments.
+ * 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.
-Sat Feb 26 17:07:53 2011 Tadayoshi Funaba <tadf@dotrb.org>
+ * pack.c (pack_pack): Use rb_int_export for BER compressed integer.
- * lib/date.rb: [Feature #4257]
+Thu Jun 6 19:31:33 2013 Tadayoshi Funaba <tadf@dotrb.org>
- * ext/date/extconf.rb: new
+ * ext/date/date_core.c: fixed coding error [ruby-core:55337].
+ reported by Riley Lynch.
- * ext/date/date_core.c: new
+Thu Jun 6 14:16:37 2013 Narihiro Nakamura <authornari@gmail.com>
-Sat Feb 26 16:10:23 2011 Shota Fukumori <sorah@tubusu.net>
+ * ext/objspace/object_tracing.c: rename allocation_info to
+ lookup_allocation_info. At times I confused "struct
+ allocation_info" with "function allocation_info".
- * lib/test/unit.rb: --jobs-status won't puts over 2 lines.
+Thu Jun 6 13:57:06 2013 Narihiro Nakamura <authornari@gmail.com>
- * test/testunit/test_parallel.rb: Fix test for above.
+ * ext/objspace/object_tracing.c: allocation_info function isn't
+ called by any other file.
- * lib/test/*: refactoring.
+Thu Jun 6 09:41:00 2013 Kenta Murata <mrkn@cookpad.com>
-Sat Feb 26 07:10:05 2011 Aaron Patterson <aaron@tenderlovemaking.com>
+ * numeric.c (num_quo): should return a Float for a Float argument.
+ [ruby-dev:44710] [Bug #5515]
- * ext/psych/lib/psych/scalar_scanner.rb: fix parsing timezone's whose
- whose format is (+/-)hhmm. Thanks Goncalo Silva!
+ * test/ruby/test_fixnum.rb: Add an assertion for the above change.
- * test/psych/test_scalar_scanner.rb: test for bug.
+ * test/ruby/test_bignum.rb: ditto.
-Thu Feb 24 23:02:55 2011 Tanaka Akira <akr@fsij.org>
+Thu Jun 6 00:59:44 2013 Masaya Tarui <tarui@ruby-lang.org>
- * ext/openssl/ossl_hmac.c: parenthesize macro arguments.
+ * 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.
-Thu Feb 24 22:53:10 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ change sunny old check point in order to save mark stack and
+ remove unnatural rest_sweep & demote.
- * common.mk (love): for the birthday.
+Thu Jun 6 00:52:42 2013 Masaya Tarui <tarui@ruby-lang.org>
-Thu Feb 24 22:51:54 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * gc.c (rgengc_rememberset_mark): change scan algorithm for performance:
+ from object's pointer base to bitmap one.
- * vm.c (ruby_vm_destruct): run vm exit hooks after all objects are
- destructed.
+Thu Jun 6 00:30:04 2013 NARUSE, Yui <naruse@ruby-lang.org>
-Thu Feb 24 14:40:33 2011 Shota Fukumori <sorah@tubusu.net>
+ * 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
- * ChangeLog (vim): Modeline for vim
+Thu Jun 6 00:05:08 2013 Akinori MUSHA <knu@iDaemons.org>
-Thu Feb 24 13:39:25 2011 Shota Fukumori <sorah@tubusu.net>
+ * 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]
- * common.mk: Use $RUNRUBY for worker process.
+Wed Jun 5 22:40:42 2013 Shugo Maeda <shugo@ruby-lang.org>
- * lib/test/unit.rb: Fix bug.
+ * lib/net/imap.rb (capability_response): should ignore trailing
+ spaces. Thanks, Peter Kovacs. [ruby-core:55024] [Bug #8415]
- * lib/test/unit.rb: @options[:ruby](@opts[:ruby]) is now Array.
+ * test/net/imap/test_imap_response_parser.rb: related test.
- * test/testunit/parallel.rb: Fix for above.
+Wed Jun 5 21:17:08 2013 Tanaka Akira <akr@fsij.org>
-Thu Feb 24 10:05:55 2011 Shota Fukumori <sorah@tubusu.net>
+ * bignum.c (big_fdiv): Use nlz() instead of bdigbitsize().
+ (bdigbitsize): Removed.
- * test/testunit/tests_for_parallel/misc.rb: Fix bug in r30947.
+Wed Jun 5 20:32:00 2013 Kenta Murata <mrkn@cookpad.com>
- * lib/test/unit.rb, lib/test/unit/assertions.rb: For this test.
+ * include/ruby/ruby.h: fix alignment in comment.
-Wed Feb 23 23:07:38 2011 Shota Fukumori <sorah@tubusu.net>
+Wed Jun 5 20:05:29 2013 Tanaka Akira <akr@fsij.org>
- * test/testunit/test_parallel.rb, test/testunit/parallel/*:
- Test for r30939.
+ * 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.
- * lib/test/unit.rb: For test.
+Wed Jun 5 15:26:10 2013 NARUSE, Yui <naruse@ruby-lang.org>
- * lib/test/parallel.rb: For test.
+ * 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
- * lib/test/unit/testcase.rb: For test.
+Wed Jun 5 09:46:46 2013 NARUSE, Yui <naruse@ruby-lang.org>
-Wed Feb 23 22:05:13 2011 Tanaka Akira <akr@fsij.org>
+ * test/fileutils/test_fileutils.rb (TestFileUtils#test_mkdir): add
+ EACCES for Windows.
- * ext/openssl/ossl_engine.c: parenthesize macro arguments.
+Wed Jun 5 08:13:37 2013 Tanaka Akira <akr@fsij.org>
-Tue Feb 22 23:15:17 2011 Shota Fukumori <sorah@tubusu.net>
+ * bignum.c (rb_big_pow): Don't need to multiply SIZEOF_BDIGITS.
+ Use nlz instead of bitlength_bdigit.
+ (bitlength_bdigit): Removed.
- * lib/test/unit.rb: Fix --ruby option doesn't effect.
+Wed Jun 5 07:14:18 2013 Tadayoshi Funaba <tadf@dotrb.org>
- * lib/test/unit.rb: Fix typo.
+ * ext/date/date_core.c (d_lite_cmp, d_lite_equal): simplified.
-Tue Feb 22 21:39:28 2011 Tanaka Akira <akr@fsij.org>
+Wed Jun 5 07:07:01 2013 Tadayoshi Funaba <tadf@dotrb.org>
- * ext/openssl/ossl_digest.c: parenthesize macro arguments.
+ * ext/date/date_core.c: fixed a bug [ruby-core:55295]. reported
+ by Riley Lynch.
-Tue Feb 22 14:34:26 2011 Shota Fukumori <sorah@tubusu.net>
+Wed Jun 5 06:44:08 2013 Eric Hodel <drbrain@segment7.net>
- * lib/test/unit.rb: Fix merging miss.
+ * lib/rubygems: Update to RubyGems 2.0.3
-Tue Feb 22 12:27:26 2011 Shota Fukumori <sorah@tubusu.net>
+ * test/rubygems: Tests for the above.
- * lib/test/unit.rb: Add new options; --jobs,-j,--ruby,--jobs-status,
- --no-retry.
- [Feature #4415] [ruby-dev:43226],[ruby-dev:43222],[ruby-core:35294]
+ * NEWS: Added RubyGems 2.0.3 note.
- * lib/test/unit/parallel.rb: Used at test/unit --jobs(-j) option.
+Wed Jun 5 06:35:15 2013 Eric Hodel <drbrain@segment7.net>
- * test/csv/test_serialization.rb: test/unit parallel running ready.
+ * doc/marshal.rdoc: Add description of Marshal format.
- * test/rake/test_file_task.rb: test/unit parallel running ready.
+Wed Jun 5 01:16:09 2013 Benoit Daloze <eregontp@gmail.com>
-Tue Feb 22 06:09:10 2011 Eric Hodel <drbrain@segment7.net>
+ * array.c (Array#+): fix documentation example.
+ Patch by Logan Serman. [Fixes GH-324]
- * ext/syslog/syslog.c: Apply documentation patch from mathew murphy.
- [Bug #4149]
+Wed Jun 5 00:21:54 2013 Ayumu AIZAWA <ayumu.aizawa@gmail.com>
-Tue Feb 22 03:09:10 2011 Aaron Patterson <aaron@tenderlovemaking.com>
+ * lib/irb/lc/ja/help-message: update help messages.
+ following r41028. [ruby-dev:46707] [Feature #7510]
- * ext/psych/lib/psych.rb: increase Psych to 1.1.0 for help with
- debugging.
+Wed Jun 5 00:09:32 2013 Tanaka Akira <akr@fsij.org>
-Tue Feb 22 03:04:46 2011 Aaron Patterson <aaron@tenderlovemaking.com>
+ * marshal.c (r_object0): Generalize a round up expression.
+ Use BDIGIT instead of int.
- * ext/psych/lib/psych/streaming.rb: refactor streaming methods to a
- module.
- * ext/psych/lib/psych/stream.rb: extracted streaming specific methods
- to a module.
- * ext/psych/lib/psych/json/stream.rb: JSON stream inherits from
- JSONTree and includes streaming methods.
- * ext/psych/lib/psych/visitors/json_tree.rb: JSON does not support
- object references, so remove object reference testing when building
- JSON trees.
+Tue Jun 4 23:44:02 2013 Ayumu AIZAWA <ayumu.aizawa@gmail.com>
-Tue Feb 22 02:41:51 2011 Aaron Patterson <aaron@tenderlovemaking.com>
+ * object.c (rb_Hash): fix docs. patched by Stefan Sch"ussler.
+ [ruby-core:55299] [Bug #8487]
- * ext/psych/lib/psych/visitors/yaml_tree.rb (accept): use Hash#key?
- when looking up object references to err on the side of cache
- misses.
+Tue Jun 4 23:16:49 2013 Benoit Daloze <eregontp@gmail.com>
-Mon Feb 21 10:58:39 2011 Aaron Patterson <aaron@tenderlovemaking.com>
+ * lib/irb/completion.rb: Use %w literal construction for long lists.
+ Patch by Dave Goodchild. [Fixes GH-299]
- * ext/psych/lib/psych/json/yaml_events.rb: refactoring JSON event
- handling methods to a module for reuse.
- * ext/psych/lib/psych/json/tree_builder.rb: AST builder uses JSON
- event methods.
- * ext/psych/lib/psych/json/stream.rb: stream emitter uses JSON event
- methods.
+Tue Jun 4 23:08:42 2013 Benoit Daloze <eregontp@gmail.com>
-Mon Feb 21 10:54:29 2011 Aaron Patterson <aaron@tenderlovemaking.com>
+ * ext/objspace/objspace.c: improve wording and remove duplicated comment.
+ Based on a patch by Dave Goodchild. [Fixes GH-299]
- * ext/psych/lib/psych/json/stream.rb: do not emit custom tags in maps
- or sequences when emitting JSON.
- * ext/psych/lib/psych/json/tree_builder.rb: do not emit custom tags in
- sequences when emitting JSON.
- * test/psych/json/test_stream.rb: tests for custom stream emits.
- * test/psych/test_json_tree.rb: tests for JSON emits.
+Tue Jun 4 18:41:47 2013 Tanaka Akira <akr@fsij.org>
-Mon Feb 21 10:05:10 2011 Aaron Patterson <aaron@tenderlovemaking.com>
+ * bignum.c (bitlength_bdigit): Fix an off-by-one error.
- * ext/psych/lib/psych/json/ruby_events.rb: DRY up ruby event handling
- for JSON.
- * ext/psych/lib/psych/visitors/json_tree.rb: use ruby events module
- * ext/psych/lib/psych/json/stream.rb: ditto
+Tue Jun 4 15:30:00 2013 Kenta Murata <mrkn@cookpad.com>
-Mon Feb 21 10:01:01 2011 Aaron Patterson <aaron@tenderlovemaking.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
- * ext/psych/lib/psych/json/stream.rb: fix JSON stream emits to use
- double quotes during stream.
- * test/psych/json/test_stream.rb: tests to reflect changes.
+ * test/bigdecimal/test_bigdecimal_util.rb: fix for the above change.
-Mon Feb 21 00:38:56 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+Tue Jun 4 00:44:27 2013 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
- * test/ruby/test_system.rb (TestSystem#test_system_at):
- add testcase for bug4396.
+ * test/fileutils/test_fileutils.rb (TestFileUtils#test_mkdir): add
+ EEXIST for Linux. (suggested by nurse)
-Sun Feb 20 19:59:32 2011 Tanaka Akira <akr@fsij.org>
+Mon Jun 3 23:58:19 2013 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
- * ext/openssl/ossl_cipher.c: parenthesize macro arguments.
+ * lib/fileutils.rb (FileUtils.rmdir): use remove_tailing_slash.
+ * test/fileutils/test_fileutils.rb: test for above.
-Sun Feb 20 16:26:45 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Mon Jun 3 23:47:55 2013 Tanaka Akira <akr@fsij.org>
- * thread.c (exec_recursive): prevent temporary objects from GC.
+ * bignum.c (bitlength_bdigit): New function.
+ (rb_big_pow): Use bitlength_bdigit instead of ffs.
- * prevent temporary objects from GC, and should not use
- RSTRING_PTR() for function calls since it evaluates the argument
- a couple of times.
+Mon Jun 3 23:11:19 2013 Ayumu AIZAWA <ayumu.aizawa@gmail.com>
-Sun Feb 20 16:22:53 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * 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]
- * file.c (rb_file_flock): use rb_thread_io_blocking_region for the
- time being.
+Mon Jun 3 19:02:20 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Sun Feb 20 05:33:17 2011 Ryan Davis <ryand-ruby@zenspider.com>
+ * dir.c (is_hfs): use the file descriptor instead of a path.
- * lib/minitest/*.rb: Imported minitest 2.0.2 r6207.
- * test/minitest/*: ditto
+Mon Jun 3 07:15:17 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-Sun Feb 20 02:14:09 2011 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.
- * signal.c (sig_trap): avoid pthread_sigmask(xx, &mask, &mask) usage
- because FreeBSD don't permit it. If it's used, it behave as
- pthread_sigmask(xx, NULL, &mask).
+ * 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.
- * signal.c (init_sigchld): ditto.
+Mon Jun 3 03:40:29 2013 NARUSE, Yui <naruse@ruby-lang.org>
-Sun Feb 20 00:46:51 2011 Tanaka Akira <akr@fsij.org>
+ * vm_insnhelper.c (vm_yield_setup_block_args): partially revert r41019.
+ The code is not useless.
- * ext/openssl/ossl_bn.c: parenthesize macro arguments.
+Mon Jun 3 01:25:25 2013 Ayumu AIZAWA <ayumu.aizawa@gmail.com>
-Sat Feb 19 22:37:42 2011 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
+ * test/socket/test_sockopt.rb: change test name. follow r41037.
- * vm_insnhelper.c (vm_check_if_namespace): guard temporary object
- from GC.
+Mon Jun 3 01:08:43 2013 Ayumu AIZAWA <ayumu.aizawa@gmail.com>
-Sat Feb 19 06:36:27 2011 Aaron Patterson <aaron@tenderlovemaking.com>
+ * test/rinda/test_rinda.rb: rename functions introduced in r41009.
- * lib/test/unit.rb: partial revert of r30849. [ruby-core:32864]
+Sun Jun 2 23:33:42 2013 Kazuki Tsujimoto <kazuki@callcc.net>
- * test/testunit/test_rake_integration.rb: adding an integration test
- with the rake loader to prevent regressions.
+ * 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.
-Fri Feb 18 19:31:31 2011 Shugo Maeda <shugo@ruby-lang.org>
+Sun Jun 2 22:44:42 2013 NARUSE, Yui <naruse@ruby-lang.org>
- * lib/fileutils.rb (FileUtils::remove_entry_secure): there is a
- race condition in the case where the given path is a directory,
- and some other user can move that directory, and create a
- symlink while this method is executing.
- Reported by: Nicholas Jefferson <nicholas at pythonic.com.au>
+ * 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)
-Fri Feb 18 00:28:39 2011 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
+Sun Jun 2 16:15:29 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * compile.c (get_exception_sym2type): guard temporary object from GC.
+ * dln_find.c (dln_find_exe, dln_find_file): remove deprecated
+ non-reentrant functions.
-Thu Feb 17 23:54:29 2011 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
+Sun Jun 2 15:04:35 2013 Zachary Scott <zachary@zacharyscott.net>
- * iseq.c (prepare_iseq_build): initialize iseq_compile_data::err_info
- with nil. this fix exception in rb_iseq_load().
+ * lib/cgi/util.rb, lib/erb.rb: Use String#b [Feature #8394] by znz
-Thu Feb 17 22:32:35 2011 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
+Sun Jun 2 14:10:21 2013 Zachary Scott <zachary@zacharyscott.net>
- * test/ruby/test_marshal.rb (test_marshal_dump_extra_iv):
- fix a typo of local variable. [Bug #3720] [ruby-dev:42083]
+ * lib/irb/lc/help-message: Apply english updates for irb --help #7510
-Thu Feb 17 21:32:53 2011 Tanaka Akira <akr@fsij.org>
+Sun Jun 2 12:03:58 2013 Zachary Scott <zachary@zacharyscott.net>
- * ext/openssl/ossl.h: parenthesize macro arguments.
+ * range.c: Fix rdoc on Range#bsearch [Bug #8242] [ruby-core:54143]
-Wed Feb 16 20:37:48 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+Sun Jun 2 02:08:37 2013 NARUSE, Yui <naruse@ruby-lang.org>
- * eval_jump.c (rb_exec_end_proc): changed at_exit and END proc
- evaluation order. [Bug #4400] [ruby-core:35237]
- * eval_jump.c (rb_mark_end_proc): ditto.
+ * enc/euc_jp.c: fix typo: the name of EUC-JIS-2004.
- * test/ruby/test_beginendblock.rb (TestBeginEndBlock#test_nested_at_exit):
- added a test for nested at_exit.
- * test/ruby/test_beginendblock.rb (TestBeginEndBlock#test_beginendblock):
- changed the test to adopt new spec.
+Sat Jun 1 23:17:00 2013 Charlie Somerville <charliesome@ruby-lang.org>
-Wed Feb 16 20:17:06 2011 Tanaka Akira <akr@fsij.org>
+ * vm_eval.c (rb_mod_module_eval): mention in docs that arguments passed
+ to the method are passed to the block
- * ext/openssl/openssl_missing.h: parenthesize macro arguments.
+Sat Jun 1 17:58:13 2013 Akinori MUSHA <knu@iDaemons.org>
-Tue Feb 15 21:37:45 2011 Tanaka Akira <akr@fsij.org>
+ * lib/set.rb (Set#freeze, taint, untaint): Save a "self" by
+ utilizing super returning self, and add tests while at it.
- * ext/gdbm/gdbm.c: parenthesize macro arguments.
+Sat Jun 1 17:24:47 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Tue Feb 15 20:34:53 2011 Tanaka Akira <akr@fsij.org>
+ * compile.c (iseq_set_arguments): not a simple single argument if any
+ keyword arguments exist. [ruby-core:55203] [Bug #8463]
- * array.c (ary_join_1): fix array size.
+ * 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]
-Tue Feb 15 19:43:23 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+Sat Jun 1 11:16:22 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * configure.in: fix and resubmit r30621. [ruby-dev:43203]
+ * error.c (rb_exc_new_cstr): rename from rb_exc_new2.
-Tue Feb 15 15:41:30 2011 NARUSE, Yui <naruse@ruby-lang.org>
+ * error.c (rb_exc_new_str): rename from rb_exc_new3.
- * array.c (array_join): copy the encoding of the first element as
- an initial encoding.
+Sat Jun 1 10:13:17 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * array.c (array_join_0): ditto.
+ * string.c (rb_str_new[2-5], rb_{tainted,usascii}_str_new2),
+ (rb_str_buf_new2): remove old interfaces.
- * array.c (array_join_1): ditto.
+Sat Jun 1 08:00:46 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * array.c (inspect_ary): ditto.
+ * ext/zlib/zlib.c (gzfile_read, gzfile_read_all, gzfile_getc),
+ (gzreader_gets): check EOF. [ruby-core:55220] [Bug #8467]
- * array.c (array_join_1): add an argument to check the appending is
- first one or not.
+Sat Jun 1 07:32:15 2013 Tanaka Akira <akr@fsij.org>
-Tue Feb 15 15:40:53 2011 NARUSE, Yui <naruse@ruby-lang.org>
+ * bignum.c: Use BDIGIT type for hbase.
- * hash.c (inspect_i): copy the encoding of the first key as
- an initial encoding.
+Sat Jun 1 02:37:35 2013 NARUSE, Yui <naruse@ruby-lang.org>
-Mon Feb 14 15:00:16 2011 NARUSE, Yui <naruse@ruby-lang.org>
+ * ext/socket/option.c (sockopt_s_byte): constructor of the sockopt
+ whose value's is byte.
- * array.c (inspect_ary): don't taint the inspected result of a
- recursive array.
+ * ext/socket/option.c (sockopt_byte): getter for above.
-Tue Feb 15 15:43:29 2011 NARUSE, Yui <naruse@ruby-lang.org>
+ * ext/socket/option.c (inspect_byte): inspect for above.
- * encoding.c (rb_enc_compatible): change the rule for empty strings:
- remove the special treatment of the US-ASCII encoded empty string.
- Now Encoding.compatible? usually respect the encoding of the
- receiver.
+ * ext/socket/option.c (sockopt_s_ip_multicast_loop): constructor of
+ the sockopt whose optname is IP_MULTICAST_LOOP.
-Tue Feb 15 15:39:37 2011 NARUSE, Yui <naruse@ruby-lang.org>
+ * ext/socket/option.c (sockopt_ip_multicast_loop): getter for above.
- * string.c (rb_enc_cr_str_buf_cat): remove special treatment of
- ASCII-8BIT receivers.
+ * ext/socket/option.c (sockopt_s_ip_multicast_ttl): constructor of
+ the sockopt whose optname is IP_MULTICAST_TTL.
- * string.c (str_gsub): set initial encoding of the buffer as the
- same of the receiver. [ruby-core:35141]
+ * ext/socket/option.c (sockopt_ip_multicast_ttl): getter for above.
-Tue Feb 15 09:49:33 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+ * ext/socket/option.c (sockopt_inspect): use above.
- * test/ruby/test_system.rb (TestSystem#test_system_at): use findstr
- command instead of find command, because the latter is confusing
- another famous Unix command.
+Sat Jun 01 01:50:00 2013 Kenta Murata <mrkn@mrkn.jp>
-Mon Feb 14 23:01:19 2011 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
+ * ext/bigdecimal/bigdecimal.c (BigDecimal_power): use rb_dbl2big
+ to convert a double value to a Bignum.
- * thread.c (rb_thread_io_blocking_region): reset th->waiting_fd
- after blocking region, because remaining waiting_fd might
- cause unnecessary IOError.
+Sat Jun 1 00:19:50 2013 Tanaka Akira <akr@fsij.org>
-Mon Feb 14 21:06:50 2011 URABE Shyouhei <shyouhei@ruby-lang.org>
+ * bignum.c (calc_hbase): Make hbase the maximum power of base
+ representable in BDIGIT.
- * configure.in: revert r30621. That revision introduced mkmf test
- failures and it turned out to be OK to revert. [ruby-dev:43203]
+Fri May 31 23:56:13 2013 Tanaka Akira <akr@fsij.org>
-Mon Feb 14 21:04:01 2011 Tanaka Akira <akr@fsij.org>
+ * bignum.c (calc_hbase): Extracted from rb_big2str0.
- * ext/fiddle/conversions.h: parenthesize macro arguments.
+Fri May 31 23:22:24 2013 Tanaka Akira <akr@fsij.org>
-Mon Feb 14 18:41:47 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * 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.
- * win32/setup.mak (USE_RUBYGEMS): fixed r30835. It didn't work on
- mswin32 port. If you changed win32/configure.bat, you should change
- setup.mak too.
+Fri May 31 17:57:21 2013 Zachary Scott <zachary@zacharyscott.net>
-Mon Feb 14 17:28:34 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * process.c: Improve Process::exec documentation
- * test/ruby/test_system.rb (TestSystem#test_system_at):
- added test. [ruby-core:35218] (#4393)
+Fri May 31 17:26:42 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Mon Feb 14 13:15:35 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+ * vm_eval.c (rb_funcallv): add better names of rb_funcall2.
- * win32/win32.c (is_internal_cmd): if the first char of prog is '@',
- execute it via shell. [ruby-core:35218] (#4393)
+ * vm_eval.c (rb_funcallv_public): ditto for rb_funcall3.
-Mon Feb 14 10:33:45 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+Fri May 31 17:04:45 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * lib/test/unit.rb: revert r30863, because it causes too many noise.
+ * array.c (rb_ary_new_capa): add better names of rb_ary_new2.
-Mon Feb 14 07:34:55 2011 Tanaka Akira <akr@fsij.org>
+ * array.c (rb_ary_new_from_args): ditto for rb_ary_new3.
- * ext/curses/curses.c: parenthesize macro arguments.
+ * array.c (rb_ary_new_from_values): ditto for rb_ary_new4.
-Sun Feb 13 19:41:47 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Fri May 31 16:35:44 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * lib/test/unit.rb (Test::Unit::RequireFiles#non_options): skip
- test suites failed to load instead of mere messages.
+ * configure.in (HAVE_ATTRIBUTE_FUNCTION_ALIAS): define to tell if
+ alias attribute is available.
-Sun Feb 13 09:56:44 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Fri May 31 16:03:23 2013 Zachary Scott <zachary@zacharyscott.net>
- * test/openssl/test_config.rb (OpenSSL#test_freeze): fix error
- message assertion.
+ * object.c, proc.c: s/call_seq/call-seq in rdoc. [Fixes GH-322]
- * test/io/nonblock/test_flush.rb (TestIONonblock#flush_test):
- return true to finish the test.
+Fri May 31 15:56:36 2013 Zachary Scott <zachary@zacharyscott.net>
- * test/syck/test_string.rb (Syck::TestString#test_non_binary_string):
- use assert_not instead of refute, unless required minitest
- explicitly.
+ * ext/openssl/ossl_ssl.c: Add missing paren in rdoc [Fixes GH-321]
- * test/test_prime.rb (TestPrime::sieve.Integer): ditto.
+Fri May 31 11:58:24 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * test/xmlrpc/webrick_testing.rb (WEBrick_Testing#start_server):
- catch IOError when server socket was closed.
+ * vm_method.c (set_visibility): extract from rb_mod_public(),
+ rb_mod_protected() and rb_mod_private().
-Sun Feb 13 07:39:51 2011 Yukihiro Matsumoto <matz@ruby-lang.org>
+Thu May 30 19:47:42 2013 Yusuke Endoh <mame@tsg.ne.jp>
- * enum.c (enum_inject): typo fixed. a patch from Gaku Ueda in
- [ruby-core:35216].
+ * 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]
-Sun Feb 13 00:48:47 2011 Tadayoshi Funaba <tadf@dotrb.org>
+ * test/ruby/test_keyword.rb: update a test for above.
- * lib/date.rb (Date#===): [ruby-core:35127]
+Thu May 30 17:55:04 2013 Zachary Scott <zachary@zacharyscott.net>
-Sun Feb 13 00:29:18 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * process.c: RDoc on Process.spawn
- * lib/test/unit.rb (Test::Unit::Options#process_args): always
- return options.
+Thu May 30 00:08:14 2013 Koichi Sasada <ko1@atdot.net>
- * lib/test/unit.rb (Test::Unit::RequireFiles#non_options): return
- if any test case get loaded.
+ * 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).
- * lib/test/unit.rb (Test::Unit::AutoRunner#initialize): do not add
- default directory if it is nil.
+Wed May 29 10:33:27 2013 Koichi Sasada <ko1@atdot.net>
- * lib/test/unit.rb (Test::Unit::AutoRunner#process_args): return
- true if any test cases to run.
+ * 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().
-Sat Feb 12 23:17:43 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Tue May 28 12:31:21 2013 Koichi Sasada <ko1@atdot.net>
- * lib/test/unit.rb (assert_include): add alias.
+ * 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'.
-Sat Feb 12 14:44:20 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * 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>
- * thread.c (rb_thread_io_blocking_region): new function to run
- blocking region with GIL released, for fd.
+ * test/objspace/test_objspace.rb: add a test.
- * thread.c (rb_thread_fd_close): implement. [ruby-core:35203]
+Tue May 28 11:30:02 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * vm.c (th_init): rename from th_init2.
+ * ext/extmk.rb (extmake): leave makefiles untouched if the content is
+ not changed, to get rid of unnecessary re-linking.
-Sat Feb 12 14:41:36 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Tue May 28 03:11:02 2013 Koichi Sasada <ko1@atdot.net>
- * lib/test/unit.rb (Test::Unit::AutoRunner#initialize): use
- default_dir if no test case given.
+ * 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)
- * lib/test/unit.rb (Test::Unit::Runner): rename from Test::Unit::Mini.
+ Note that hooks are not kicked immediately. Procs are kicked
+ at postponed_job.
- * lib/test/unit.rb (Test::Unit::GlobOption#non_options): run tests
- under base directory if no argument given.
+ This feature is a sample of new internal event and
+ rb_postponed_job API.
-Sat Feb 12 08:03:12 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Tue May 28 02:56:15 2013 Koichi Sasada <ko1@atdot.net>
- * test/ruby/test_settracefunc.rb (TestSetTraceFunc): ensure to use
- method_added hook defined in Module.
+ * gc.c (gc_stat): remove wrong rest_sweep().
-Sat Feb 12 01:04:02 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Tue May 28 02:44:23 2013 Koichi Sasada <ko1@atdot.net>
- * ruby.c (proc_options): enable rubygems if --gem option is given.
+ * gc.c (garbage_collect_body): fix GC_ENABLE_LAZY_SWEEP condition.
- * ruby.c (process_options): load rubygems if it is disabled but
- --gem option is given.
+ * gc.c (GC_NOTIFY): move debug print location and use stderr instead
+ of stdout.
-Fri Feb 11 23:27:50 2011 Yuki Sonoda (Yugui) <yugui@yugui.jp>
+Tue May 28 02:07:21 2013 Koichi Sasada <ko1@atdot.net>
- * ruby.c (proc_options): add --gem=enabled as an alias of
- --enable=gems and --gem=disabled as an alias of --disable=gems.
- Gem named "enabled" or "disabled" has already been reserved
- legitimately for this purpose.
+ * vm_trace.c (rb_postponed_job_register_one): fix iteration bug.
-Fri Feb 11 23:17:04 2011 Tanaka Akira <akr@fsij.org>
+ * ext/-test-/postponed_job/postponed_job.c,
+ test/-ext-/postponed_job/test_postponed_job.rb: add a test.
- * ext/dl/cfunc.c: parenthesize macro arguments.
+Tue May 28 00:34:23 2013 Koichi Sasada <ko1@atdot.net>
-Fri Feb 11 21:41:53 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * 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) ...]
- * bin/testrb, test/runner.rb, lib/test/unit.rb: improve backward
- compatibility.
+ * ext/-test-/tracepoint/tracepoint.c,
+ test/-ext-/tracepoint/test_tracepoint.rb: modify a test.
-Fri Feb 11 19:45:26 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Tue May 28 00:18:57 2013 Koichi Sasada <ko1@atdot.net>
- * eval.c (ruby_cleanup): use rb_ary_free to free internal object.
+ * vm_trace.c (rb_postponed_job_flush): remove a wrong comment.
- * gc.h (RUBY_FREE_UNLESS_NULL): get rid of double free.
- [ruby-core:35192]
+Mon May 27 22:09:33 2013 Tanaka Akira <akr@fsij.org>
-Fri Feb 11 16:57:03 2011 Nobuyoshi Nakada <nobu@ruby-lang.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.
- * test/ruby/test_transcode.rb (test_from_cp50221): fix wrong
- assertion and move back.
+Mon May 27 19:25:47 2013 Koichi Sasada <ko1@atdot.net>
-Fri Feb 11 14:33:18 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * include/ruby/ruby.h: rename RUBY_INTERNAL_EVENT_FREE to
+ RUBY_INTERNAL_EVENT_FREEOBJ.
- * lib/test/unit/assertions.rb (assert_no_match): alias for
- backward compatibility.
+ * ext/-test-/tracepoint/tracepoint.c,
+ ext/objspace/object_tracing.c,
+ gc.c, vm_trace.c: catch up this change.
-Fri Feb 11 12:06:48 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Mon May 27 18:57:28 2013 Koichi Sasada <ko1@atdot.net>
- * ruby.c (add_gems, require_libraries, proc_options): add
- --require and --gem options.
+ * 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.
-Fri Feb 11 12:03:24 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * test/objspace/test_objspace.rb: add a test.
- * configure.in (rubygems): add --disable-rubygems option.
+ * ext/objspace/object_tracing.c: ditto.
-Fri Feb 11 11:39:03 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * gc.c (rb_gc_count): add. This function returns GC count.
- * template/fake.rb.in (CROSS_COMPILING): get rid of NameError.
+ * internal.h: add decl. of rb_gc_count(). Same as `GC.count'.
-Thu Feb 10 23:12:34 2011 Tanaka Akira <akr@fsij.org>
+Mon May 27 17:33:28 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * ext/dl/dl.h: parenthesize macro arguments.
+ * tool/rbinstall.rb (install_recursive): add maxdepth option.
-Wed Feb 9 23:11:27 2011 Tanaka Akira <akr@fsij.org>
+ * tool/rbinstall.rb (bin-comm): limit depth of bindir and reject empty
+ files. [ruby-core:55101] [Bug #8432]
- * ext/pty/pty.c: parenthesize macro arguments.
+Mon May 27 16:16:18 2013 Koichi Sasada <ko1@atdot.net>
-Tue Feb 8 11:47:11 2011 Loren Sands-Ramshaw <lorensr@gmail.com>
+ * vm_trace.c (rb_postponed_job_flush, rb_postponed_job_register): use
+ ruby_xmalloc/xfree. It is safe during GC.
- * array.c: documentation clarification in rotate, rotate!,
- index, and rindex. [ruby-core:35144]
+Mon May 27 09:24:03 2013 Koichi Sasada <ko1@atdot.net>
-Wed Feb 9 09:45:43 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+ * test/-ext-/postponed_job/test_postponed_job.rb: fix typo and class name.
- * test/rdoc/test_rdoc_encoding.rb: remove unnecessary (and wrong)
- platform-dependent hacks.
+Mon May 27 09:05:17 2013 Koichi Sasada <ko1@atdot.net>
-Wed Feb 9 00:47:18 2011 Tanaka Akira <akr@fsij.org>
+ * 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'.
- * ext/etc/etc.c: parenthesize macro arguments.
+ 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.
-Tue Feb 8 19:38:00 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ This change is mostly written by Aman Gupta (tmm1).
+ https://bugs.ruby-lang.org/issues/8107#note-12
+ [Feature #8107]
- * misc/ruby-mode.el (ruby-expr-beg): fix for invalid nest errors.
+ * 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.
-Tue Feb 8 19:22:59 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * ext/-test-/tracepoint/extconf.rb,
+ ext/-test-/tracepoint/tracepoint.c,
+ test/-ext-/tracepoint/test_tracepoint.rb: add a test.
- * configure.in (AC_MSG_CHECKING): fixed typo. the patch is
- created by Benoit Daloze. Thanks a lot. [Bug #4384][ruby-core:35148]
+Mon May 27 08:38:21 2013 Koichi Sasada <ko1@atdot.net>
-Tue Feb 8 16:04:03 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * ext/-test-/postponed_job/postponed_job.c: fix `init' function name.
- * io.c (rb_io_s_sysopen): use NUM2MODET() instead NUM2UINT().
+Mon May 27 06:22:41 2013 Koichi Sasada <ko1@atdot.net>
-Tue Feb 8 15:59:23 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * 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.
- * process.c (rb_run_exec_options_err): use MODET2NUM() instead
- LONG2NUM().
+ 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).
-Tue Feb 8 13:59:56 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ This change is mostly written by Aman Gupta (tmm1).
+ https://bugs.ruby-lang.org/issues/8107#note-15
+ [Feature #8107]
- * configure.in: revert r30725. Now we have proper runtime fallback.
- Therefore, no need compile time disabling. (see r30762).
+ * gc.c: use postponed job API for finalizer.
-Tue Feb 8 01:00:21 2011 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
+ * common.mk: add dependency from vm_trace.c to debug.h.
- * process.c (proc_setgroups): add GC guard to prevent intermediate
- variable from GC.
+ * ext/-test-/postponed_job/extconf.rb, postponed_job.c,
+ test/-ext-/postponed_job/test_postponed_job.rb: add a test.
-Tue Feb 8 00:56:33 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * thread.c: implement postponed API.
- * misc/ruby-mode.el (ruby-expr-beg, ruby-in-here-doc-p): tell
- singleton class definitions from here documents.
+ * vm_core.h: ditto.
- * misc/ruby-mode.el (ruby-expr-beg, ruby-parse-partial): keyword
- followed by colon is label.
+Mon May 27 02:26:02 2013 Koichi Sasada <ko1@atdot.net>
-Mon Feb 7 22:56:16 2011 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
+ * gc.c (gc_stat): collect promote_operation_count and
+ types (RGENGC_PROFILE >= 2).
- * lib/benchmark.rb (Benchmark#bmbm): use ensure clause instead of
- Object#tap to restore STDOUT.sync.
+Mon May 27 01:40:58 2013 Koichi Sasada <ko1@atdot.net>
-Mon Feb 7 22:34:20 2011 Tanaka Akira <akr@fsij.org>
+ * 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.
- * lib/net/http.rb (Net::HTTP#connect): support SNI (Server Name
- Indication) for HTTPS. [ruby-dev:43164]
- http://stackoverflow.com/questions/4685736/openssl-server-name-indication-support-in-ruby
+Mon May 27 01:15:22 2013 Koichi Sasada <ko1@atdot.net>
-Mon Feb 7 16:05:32 2011 Eric Hodel <drbrain@segment7.net>
+ * hash.c (rb_hash_tbl_raw), internal.h: added.
+ Returns st_table without shading hash.
- * lib/rdoc: Upgrade to RDoc 3.5.3 Fixes [Bug #4376]
+ * array.c: use rb_hash_tbl_raw() for read-only purpose.
-Mon Feb 7 11:46:59 2011 NARUSE, Yui <naruse@ruby-lang.org>
+ * compile.c (iseq_compile_each): ditto.
- * common.mk (rdoc): add --encoding=UTF-8; ruby's rdoc must be UTF-8.
+ * gc.c (count_objects): ditto.
-Mon Feb 7 10:21:50 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+ * insns.def: ditto.
- * test/rdoc/test_rdoc_options.rb (TestRDocOptions#test_check_files):
- there is no easy way to create owner unreadable file on Windows.
- So, skip the test.
+ * process.c: ditto.
-Sun Feb 6 13:48:29 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * thread.c (clear_coverage): ditto.
- * ext/json/lib/json/common.rb (JSON::MissingUnicodeSupport.iconv):
- should not drop rest of the result. use Iconv.conv instead.
+ * vm_insnhelper.c: ditto.
-Sun Feb 6 12:46:02 2011 Eric Hodel <drbrain@segment7.net>
+Mon May 27 00:31:09 2013 NARUSE, Yui <naruse@ruby-lang.org>
- * string.c (gsub): Ensure result encoding is the same as input
- encoding. [Bug #4340].
+ * tool/make-snapshot: use ENV["AUTOCONF"] instead of directly using
+ literal "autoconf".
-Sun Feb 6 12:18:25 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Sun May 26 21:31:46 2013 Koichi Sasada <ko1@atdot.net>
- * parse.y (words, qwords): dispatch array events. based on a
- patch from Michael Edgar. [Bug #4365].
+ * 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().
-Sun Feb 6 12:12:59 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * include/ruby/intern.h: declare rb_hash_set_ifnone(hash, ifnone).
- * test/fileutils/fileasserts.rb (FileAssertions): separate module.
+ * marshal.c (r_object0): use RHASH_SET_IFNONE().
-Sun Feb 6 11:29:23 2011 Tanaka Akira <akr@fsij.org>
+ * ext/openssl/ossl_x509name.c (Init_ossl_x509name): ditto.
- * ext/dbm/dbm.c: parenthesize macro arguments.
+Sat May 25 23:22:38 2013 Kazuki Tsujimoto <kazuki@callcc.net>
-Sat Feb 5 22:01:59 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * 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.
- * lib/test/unit/assertions.rb (Test::Unit::Assertions#assert):
- revert r30796. r30797 and r30798 are an alternative fix.
- [ruby-dev:43174]
+Sat May 25 21:29:34 2013 NARUSE, Yui <naruse@ruby-lang.org>
-Sat Feb 5 21:47:09 2011 Nobuyoshi Nakada <nobu@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
- * parse.y (mlhs_basic): include mlhs_post for ripper. a patch
- from Michael Edgar at [ruby-core:35078].
+Sat May 25 18:46:23 2013 Yusuke Endoh <mame@tsg.ne.jp>
-Sat Feb 5 21:22:21 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * 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.
- * lib/test/unit/assertions.rb (assert_block): move from
- test/fileutils/fileasserts.rb.
+Sat May 25 18:08:06 2013 Yusuke Endoh <mame@tsg.ne.jp>
- * test/fileutils/fileasserts.rb (assert_block): pass arguments
- as-is. [ruby-dev:43174]
+ * 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 Feb 5 16:47:54 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+Sat May 25 17:06:25 2013 Koichi Sasada <ko1@atdot.net>
- * lib/test/unit/assertions.rb (Test::Unit::Assertions#assert):
- msg can be passed nil. [Bug #4371] [ruby-dev:43174]
+ * gc.c (after_gc_sweep): reduce full GC timing.
-Sat Feb 5 15:18:25 2011 Eric Hodel <drbrain@segment7.net>
+Sat May 25 11:28:49 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * lib/rdoc: Upgrade to RDoc 3.5.2
+ * variable.c (set_const_visibility): return without clearing method
+ cache if no arguments.
-Sat Feb 5 12:05:27 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * vm_method.c (set_method_visibility): ditto.
- * ext/syck/rubyext.c (syck_node_init_copy): SyckNode is not
- copiable. [ruby-core:35094]
+Sat May 25 11:27:32 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Sat Feb 5 11:48:47 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * vm_method.c (set_method_visibility): quote unprintable method name.
- * ext/openssl/ossl_cipher.c (ossl_cipher_alloc): leave data ptr
- NULL.
+Sat May 25 11:24:24 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * ext/openssl/ossl_cipher.c (ossl_cipher_new, ossl_cipher_initialize):
- allocate internal structure. [ruby-core:35094]
+ * eval.c (rb_frame_callee): returns the called name of the current
+ frame, not the previous frame.
- * ext/openssl/ossl_cipher.c (ossl_cipher_copy): ditto.
+ * eval.c (prev_frame_callee, prev_frame_func): rename and make static,
+ as these are used by rb_f_method_name() and rb_f_callee_name() only.
-Sat Feb 5 11:29:10 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * variable.c (set_const_visibility): use the called name.
- * ext/json/parser/parser.h (GET_PARSER): raise TypeError.
+Sat May 25 08:58:23 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * ext/json/parser/parser.rl (cParser_initialize): ditto.
+ * string.c (rb_str_quote_unprintable): check if argument is a string.
- * ext/json/parser/parser.h (GET_PARSER): check if initialized.
- [ruby-core:35079]
+Fri May 24 19:32:00 2013 Charlie Somerville <charliesome@ruby-lang.org>
- * ext/json/parser/parser.rl (cParser_initialize): ditto.
+ * variable.c (set_const_visibility): use rb_frame_this_func() instead
+ of rb_frame_callee() for getting the name of the called method
-Sat Feb 5 10:09:31 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * test/ruby/test_module.rb: add test for private_constant with no args
- * load.c (rb_get_expanded_load_path): always expand load paths.
+Fri May 24 18:53:10 2013 Koichi Sasada <ko1@atdot.net>
-Sat Feb 5 09:38:08 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * 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!)
- * transcode.c (encoded_dup): extract.
+Fri May 24 17:07:00 2013 Charlie Somerville <charliesome@ruby-lang.org>
-Sat Feb 5 03:37:47 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * intern.h: remove dangling rb_class_init_copy declaration
+ [ruby-core:55120] [Bug #8434]
- * lib/fileutils.rb (FileUtils::LowMethods): make low level methods
- in NoWrite and DryRun to do nothing. [ruby-dev:43129]
+Fri May 24 16:31:23 2013 NARUSE, Yui <naruse@ruby-lang.org>
- * test/fileutils/fileasserts.rb: add message arguments.
+ * ext/strscan/strscan.c (strscan_aref): raise error if given
+ name reference is not found.
- * test/fileutils/fileasserts.rb (Test::Unit::Assertions#assert_block):
- show the given message.
+Fri May 24 15:48:18 2013 Koichi Sasada <ko1@atdot.net>
-Sat Feb 5 02:09:39 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * 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.
- * parse.y (lex_getline, parser_set_encode): set encoding of lines
- in SCRIPT_LINES__ as source encoding. [ruby-dev:43168]
+ * gc.c (after_gc_sweep): remove TODO comments.
-Sat Feb 5 02:08:37 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Fri May 24 11:04:00 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * vm.c (ruby_thread_data_type): add prefix.
+ * 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]
-Sat Feb 5 00:59:54 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+Fri May 24 02:57:17 2013 Koichi Sasada <ko1@atdot.net>
- * vm_core.h (GetThreadPtr): use TypedData_Get_Struct() instead
- CoreDataFromValue() because we need type check. Otherwise,
- type mismatch can cause segmentation fault crash.
- [ruby-core:35086] [Ruby 1.9-Bug#4367]
+ * object.c (rb_obj_clone): should not propagate OLDGEN status.
+ This propagation had caused WB miss for class.
- * vm.c (thread_data_type): remove static.
+Thu May 23 17:35:30 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Fri Feb 4 19:14:27 2011 Tanaka Akira <akr@fsij.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 '/'.
- * enc/trans/utf8_mac.trans: parenthesize macro arguments.
+Thu May 23 17:21:22 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Fri Feb 4 12:11:51 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * gc.c (gc_profile_dump_on): revert r40898. ok to show the record
+ accumulating while lazy_sweep().
- * string.c (str_utf8_nth): fixed a condition of optimized lead
- byte counting. [Bug #4366][ruby-dev:43170]
+Wed May 22 16:50:18 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Fri Feb 4 01:50:13 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * 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.
- * string.c (count_utf8_lead_bytes_with_word): wrote function
- comments.
+Wed May 22 15:18:59 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Fri Feb 4 00:14:55 2011 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]
- * ext/zlib/zlib.c (gzfile_reader_get_unused): no need to dup
- before rb_str_resurrect.
+ * win32/win32.c (setup_overlapped, finish_overlapped): extract from
+ rb_w32_read() and rb_w32_write().
-Thu Feb 3 20:04:44 2011 Tanaka Akira <akr@fsij.org>
+Wed May 22 14:19:56 2013 Koichi Sasada <ko1@atdot.net>
- * ext/curses/curses.c (CHECK): unused macro removed.
+ * gc.c (gc_prepare_free_objects, rest_sweep, lazy_sweep): fix position
+ of `during_gc' setting.
-Thu Feb 3 18:33:26 2011 NARUSE, Yui <naruse@ruby-lang.org>
+Wed May 22 07:36:08 2013 Koichi Sasada <ko1@atdot.net>
- * ext/zlib/zlib.c (gzfile_reader_get_unused): use rb_str_resurrect
- because gz->z.input is hidden string. [ruby-core:35057]
+ * gc.c (garbage_collect): all GC is start from garbage_collect()
+ (or garbage_collect_body()). `garbage_collect()' accept additional
+ two parameters `full_mark' and `immediate_sweep'.
+ If `full_mark' is TRUE, then force it full gc (major gc), otherwise,
+ it depends on status of object space. Now, it will be minor gc.
+ If `immediate_sweep' is TRUE, then disable lazy sweep.
+ To allocate free memory, `full_mark' and `immediate_sweep' should be
+ TRUE. Otherwise, they should be FALSE.
-Thu Feb 3 16:34:10 2011 NARUSE, Yui <naruse@ruby-lang.org>
+ * gc.c (gc_prepare_free_objects): use `garbage_collect_body()'.
- * enc/shift_jis.c (code_to_mbc): cast as int from the subtraction of
- pointers.
+ * gc.c (slot_sweep, before_gc_sweep, after_gc_sweep): add logging code.
- * enc/utf_16le.c (utf16le_mbc_enc_len): use ptrdiff_t.
+Tue May 21 22:47:06 2013 NARUSE, Yui <naruse@ruby-lang.org>
- * enc/utf_32be.c (utf32be_left_adjust_char_head): ditto.
+ * ext/strscan/strscan.c (strscan_aref): support named captures.
+ patched by Konstantin Haase [ruby-core:54664] [Feature #8343]
- * enc/utf_32le.c (utf32le_left_adjust_char_head): ditto.
+Tue May 21 21:48:44 2013 Kouhei Sutou <kou@cozmixng.org>
-Thu Feb 3 16:31:43 2011 NARUSE, Yui <naruse@ruby-lang.org>
+ * test/ruby/test_dir_m17n.rb (TestDir_M17N#test_entries_compose):
+ Use #each instead of #map just for iteration.
- * include/ruby/missing.h: don't use HAVE_STDDEF_H because it never
- defined by configure though configure.bat defines it.
+Tue May 21 19:57:22 2013 Akinori MUSHA <knu@iDaemons.org>
- * include/ruby/ruby.h: move include stddef.h to defines.h
+ * ext/digest/lib/digest.rb (Digest::Class.file): Take optional
+ arguments that are passed to the constructor of the digest
+ class.
- * include/ruby/defines.h: ditto.
+Tue May 21 17:21:12 2013 Koichi Sasada <ko1@atdot.net>
-Wed Feb 2 20:25:04 2011 NARUSE, Yui <naruse@ruby-lang.org>
+ * gc.c: remove gc_profile_record::is_marked. always true.
- * include/ruby/encoding.h (rb_enc_step_back): cast 4th argument 'n'
- as int because Ruby usually treats length value as long but
- onigenc_step_back's 4th argument is int.
+Tue May 21 17:13:40 2013 Koichi Sasada <ko1@atdot.net>
-Thu Feb 3 07:20:46 2011 Aaron Patterson <aaron@tenderlovemaking.com>
+ * gc.c: fix to collect additional information for GC::Profiler.
+ * major/minor GC
+ * trigger reason of GC
- * ext/psych/lib/psych/visitors/to_ruby.rb: use Regexp::NOENCODING
- rather than magic number.
+ * gc.c (gc_profile_dump_on): change reporting format with
+ added information.
- * ext/syck/lib/syck/rubytypes.rb: ditto
+ * gc.c (gc_profile_record_get): return added information by
+ :GC_FLAGS => array.
-Thu Feb 3 07:16:11 2011 Aaron Patterson <aaron@tenderlovemaking.com>
+Tue May 21 16:45:31 2013 Koichi Sasada <ko1@atdot.net>
- * re.c (Init_Regexp): added a constant for ARG_ENCODING_NONE
- [ruby-core:35054]
+ * 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.
- * test/ruby/test_regexp.rb: corresponding test.
+Tue May 21 16:29:09 2013 Koichi Sasada <ko1@atdot.net>
-Thu Feb 3 07:02:16 2011 Aaron Patterson <aaron@tenderlovemaking.com>
+ * 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.
- * ext/psych/lib/psych/visitors/to_ruby.rb: ARG_ENCODING_NONE regular
- expressions can round trip. [ruby-core:34969]
+ * tool/rdocbench.rb: added for `rdoc-bench'.
- * test/psych/test_yaml.rb: test for ARG_ENCODING_NONE regex
+Tue May 21 16:25:05 2013 Koichi Sasada <ko1@atdot.net>
- * ext/sych/lib/syck/rubytypes.rb: ARG_ENCODING_NONE regular
- expressions can round trip.
+ * gc.c (gc_profile_dump_on): `count' should be (int) because it
+ can be negative number.
+ And use pointer for `record' (don't copy).
- * test/syck/test_yaml.rb: test for ARG_ENCODING_NONE regex
+Tue May 21 03:11:18 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Wed Feb 2 17:09:22 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * dir.c (dir_each): compose HFS file names from
+ UTF8-MAC. [ruby-core:48745] [Bug #7267]
- * io.c (rb_io_fdatasync): Use fsync(2) if the underlying
- operating system does not support fdatasync(2).
+Tue May 21 03:08:52 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Wed Feb 2 14:51:08 2011 Eric Hodel <drbrain@segment7.net>
+ * test/ruby/envutil.rb (assert_separately): require envutil in the
+ child process too.
- * lib/rdoc/markup/to_tt_only.rb: commit miss
- * test/rdoc/test_rdoc_markup_to_tt_only.rb: ditto
- * test/rdoc/test_rdoc_single_class.rb: ditto
+Tue May 21 03:07:26 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Wed Feb 2 09:27:53 2011 Eric Hodel <drbrain@segment7.net>
+ * string.c (rb_str_conv_enc_opts): should infect.
- * lib/rdoc: Upgrade to RDoc 3.5.1
+Mon May 20 22:24:45 2013 Akinori MUSHA <knu@iDaemons.org>
-Wed Feb 2 00:30:43 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * 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.
- * include/ruby/st.h (st_table): Added comment why we need __extension__.
+Mon May 20 22:00:31 2013 Zachary Scott <zachary@zacharyscott.net>
-Tue Feb 1 20:45:44 2011 Tanaka Akira <akr@fsij.org>
+ * lib/e2mmap.rb: Format of E2MM documentation
- * enc/encdb.c: parenthesize macro arguments.
+Mon May 20 21:41:15 2013 Zachary Scott <zachary@zacharyscott.net>
-Tue Feb 1 15:12:26 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+ * ext/extmk.rb: nodoc this file
- * test/ruby/test_require.rb (TestRequire#test_require_with_unc):
- use ``127.0.0.1'' instead of ``localhost'' as host name, because
- XP or earlier cannot resolv it as NBT hostname.
+Mon May 20 20:43:32 2013 Zachary Scott <zachary@zacharyscott.net>
-Tue Feb 1 13:20:39 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * lib/cmath.rb: Remove duplicate RDoc heading from overview
- * test/benchmark/test_benchmark.rb (#capture_bench_output):
- Added explicit sleep. Windows have imprecise time support.
- Thus Tms.new.Add!{} may be or may be not equal 0. The
- test failure started since r30747.
+Mon May 20 20:36:19 2013 Zachary Scott <zachary@zacharyscott.net>
-Tue Feb 1 11:03:47 2011 Ryan Davis <ryan@lust.local>
+ * lib/securerandom.rb: Update position of overview for RDoc
- * lib/rubygems*: Import rubygems 1.5.0 (released version @ 1fb59d0)
- * test/rubygems: Ditto
+Mon May 20 19:33:55 2013 Benoit Daloze <eregontp@gmail.com>
-Tue Feb 1 08:01:39 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * math.c: improve and fix documentation of sin, tan and log
- * ext/io/console/console.c (console_set_winsize): new method to set
- console size. [EXPERIMENTAL]
+Mon May 20 19:31:49 2013 Benoit Daloze <eregontp@gmail.com>
- * ext/io/console/console.c (console_winsize): use GetWriteFD.
+ * lib/logger.rb (Logger::Application): show namespace in documentation
-Tue Feb 1 02:28:14 2011 Masaya Tarui <tarui@ruby-lnag.org>
+Mon May 20 11:50:12 2013 Zachary Scott <zachary@zacharyscott.net>
- * include/ruby/win32.h, win32/win32.c: add rb_w32_inet_ntop.
- inet_ntop's minimum supported client is Vista.
+ * lib/pp.rb: Revert part of r40834 and nodoc PP::ObjectMixin
+ [ruby-core:55068]
-Tue Feb 1 00:10:30 2011 NARUSE, Yui <naruse@ruby-lang.org>
+Mon May 20 10:40:21 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * lib/benchmark.rb: fix benchmark to work with current ruby.
- patched by Benoit Daloze [ruby-core:33846] [ruby-dev:43143]
- merged from https://github.com/eregon/ruby/commits/benchmark
+ * lib/webrick/htmlutils.rb (WEBrick::HTMLUtils#escape): replace HTML
+ meta chars even in non-ascii string. [Bug #8425] [ruby-core:55052]
- * lib/benchmark (Report#width): update documentation
- * lib/benchmark: document the return value of #benchmark and the
- :list attribute in Report
- * lib/benchmark (Tms#format): rename variables, use String#%
- instead of Kernel.format
- * lib/benchmark: remove undocumented Benchmark::times (an alias
- of Process::times used twice)
- * lib/benchmark (#benchmark): use label_width for the caption
- * lib/benchmark (Tms#initialize): rename variables
- * lib/benchmark: allow title to not be a String and call #to_s
- * lib/benchmark (Benchmark#bm): return an Array of the times with
- the labels
- * lib/benchmark: correct output for Benchmark#bmbm
- (remove the extra space)
- * lib/benchmark: add a few tests for Benchmark::Tms output
- * lib/benchmark: improve style (enumerators, ljust, unused vars)
- * lib/benchmark: add spec about output and return value
- * lib/benchmark: improve basic style and consistency
- no parenthesis for print and use interpolation instead of printf
- * lib/benchmark: remove unnecessary conversions and variables
- * lib/benchmark: correct indentation
- * lib/benchmark: rename the FMTSTR constant and variable to FORMAT
- * lib/benchmark: remove useless exception
+ * lib/webrick/httputils.rb (WEBrick::HTTPUtils#{_escape,_unescape}):
+ fix %-escape encodings. [Bug #8425] [ruby-core:55052]
- * test/benchmark: remove unused variable warnings
+ * lib/webrick/httpservlet/filehandler.rb (set_dir_list): revert r20152
+ partially and fix misuse of bytesize and regexp repetition operator.
-Mon Jan 31 23:27:23 2011 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
+Mon May 20 08:03:51 2013 Zachary Scott <zachary@zacharyscott.net>
- * node.c (add_id): remove duplicated rb_id2str() call.
+ * lib/profiler.rb: Document Profiler__ methods
-Sun Jan 30 17:19:46 2011 Tanaka Akira <akr@fsij.org>
+Mon May 20 08:02:13 2013 Zachary Scott <zachary@zacharyscott.net>
- * missing/langinfo.c: parenthesize macro arguments.
+ * lib/tempfile.rb: nodoc Tempfile#inspect
-Mon Jan 31 21:57:39 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+Mon May 20 07:48:24 2013 Zachary Scott <zachary@zacharyscott.net>
- * configure.in: revert r30698.
+ * ext/stringio/stringio.c: Correct position of method rdoc
-Mon Jan 31 21:32:44 2011 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
+Mon May 20 07:27:41 2013 Zachary Scott <zachary@zacharyscott.net>
- * thread.c (thread_start_func_2): check deadlock condition before
- release thread stack. fix memory violation when deadlock detected.
- reported by Max Aller. [Bug #4009] [ruby-core:32982]
+ * math.c: RDoc formatting of Math core docs with domains and codomains
+ Patch by @eLobato [Fixes GH-309]
-Mon Jan 31 14:45:47 2011 Yuki Sonoda (Yugui) <yugui@yugui.jp>
+Mon May 20 05:58:12 2013 Zachary Scott <zachary@zacharyscott.net>
- * lib/irb/locale.rb (IRB::Locale::#search_file):
- Gem might be undefined if --disable-gems. [ruby-core:34990]
+ * ext/bigdecimal/bigdecimal.c: Formatting for BigMath [Fixes GH-306]
+ Based on a patch by @eLobato.
+ * ext/bigdecimal/lib/bigdecimal/math.rb: ditto
-Mon Jan 31 12:26:14 2011 NARUSE, Yui <naruse@ruby-lang.org>
+Mon May 20 04:56:59 2013 Zachary Scott <zachary@zacharyscott.net>
- * addr2line.c: suppressed shorten-64-to-32 warnings.
- * regcomp.c: ditto.
- * regexec.c: ditto.
- * regint.h: ditto.
- * regparse.c: ditto.
- * regparse.h: ditto.
- * time.c: ditto.
- * variable.c: ditto.
+ * lib/forwardable.rb: Forwardable examples in overview were broken
+ Based on patch by @joem [Fixes GH-303] [Bug #8392]
-Mon Jan 31 04:45:12 2011 NARUSE, Yui <naruse@ruby-lang.org>
+Mon May 20 03:35:26 2013 Zachary Scott <zachary@zacharyscott.net>
- * array.c (rb_ary_uniq_bang): call ARY_SET_LEN(ary, 0) before
- ary_resize_capa because ary_resize_capa expects resized length is
- smaller than current array length. call rb_ary_unshare before
- ary_resize_capa because ary_resize_capa lost the reference to
- original shared array. [ruby-core:34997]
+ * lib/optparse.rb: nodoc OptionParser::Version and SPLAT_PROC
-Sun Jan 30 17:19:46 2011 Tanaka Akira <akr@fsij.org>
+Mon May 20 03:16:52 2013 Zachary Scott <zachary@zacharyscott.net>
- * missing/crypt.c: parenthesize macro arguments.
+ * lib/pp.rb: Document PP::ObjectMixin [Fixes GH-312]
-Sun Jan 30 16:40:27 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Sun May 19 23:52:22 2013 Ayumu AIZAWA <ayumu.aizawa@gmail.com>
- * test/rubygems/test_gem_security.rb (TestGemSecurity): valid only
- if OpenSSL is available.
+ * test/webrick/test_htmlutils.rb: add test for WEBrick::HTMLUtils.
- * test/dl/test_dl2.rb (TestDL#test_sin): math functions do not
- work on x86_64 due to the design of DL2.
+Sun May 19 23:12:07 2013 Ayumu AIZAWA <ayumu.aizawa@gmail.com>
- * test/dl/test_func.rb (DL::TestFunc#test_{sinf,sin): ditto.
+ * encoding.c: document fix, change default script encoding.
+ patched by @windwiny [Fixes GH-310]
-Sun Jan 30 16:09:22 2011 Tanaka Akira <akr@fsij.org>
+Sun May 19 17:29:07 2013 Akinori MUSHA <knu@iDaemons.org>
- * strftime.c (rb_strftime_with_timespec): %G produces 4 digits.
+ * lib/set.rb (Set#delete_if, Set#keep_if): Add comments.
-Sun Jan 30 15:13:19 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Sun May 19 11:37:36 2013 Kazuki Tsujimoto <kazuki@callcc.net>
- * enc/emacs_mule.c (emacsmule_islead): 7bit range is also leading
- byte.
+ * ext/fiddle/extconf.rb: ignore rc version of libffi to fix build failure.
-Sun Jan 30 13:03:16 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Sun May 19 10:38:50 2013 Akinori MUSHA <knu@iDaemons.org>
- * hash.c (rb_hash_fetch_m): use useful message for longer key, not a
- nonsense id value.
+ * misc/ruby-electric.el (ruby-electric-delete-backward-char): Use
+ delete-char instead of delete-backward-char, which is an
+ interactive function.
- * string.c (rb_str_ellipsize): new function to ellipsize a string.
+Sun May 19 03:59:29 2013 NARUSE, Yui <naruse@ruby-lang.org>
- * include/ruby/encoding.h (rb_enc_step_back): new function to step
- back n characters.
+ * string.c (str_scrub0): added for refactoring.
-Sun Jan 30 12:53:38 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Sun May 19 03:48:26 2013 NARUSE, Yui <naruse@ruby-lang.org>
- * enc/emacs_mule.c (emacsmule_islead): fix inverse condition.
+ * lib/uri/common.rb (URI.decode_www_form): scrub string if decoded
+ bytes are invalid for the encoding.
-Sun Jan 30 09:37:25 2011 Yutaka Kanemoto <kanemoto@ruby-lang.org>
+Sun May 19 02:46:32 2013 Akinori MUSHA <knu@iDaemons.org>
- * io.c (struct argf): char behaves like an unsigned char
- by default on AIX.
+ * 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 Jan 30 08:02:55 2011 NARUSE, Yui <naruse@ruby-lang.org>
+Sun May 19 02:33:09 2013 Akinori MUSHA <knu@iDaemons.org>
- * configure.in: Mac OS X wrongly reports it has fdatasync(3).
+ * 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.
-Sun Jan 30 03:29:47 2011 NARUSE, Yui <naruse@ruby-lang.org>
+ * misc/ruby-electric.el (ruby-electric-delete-backward-char):
+ Introduce electric DEL that deletes what the previous electric
+ command has input.
- * ext/openssl/ossl_bn.c (GetBNPtr): add missing nil case.
- patched by Martin Bosslet. [ruby-core:34987]
+ * misc/ruby-electric.el (ruby-electric-matching-char): Make
+ electric quotes work again at the end of buffer.
-Sun Jan 30 01:02:28 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+Sun May 19 01:39:50 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * include/ruby/ruby.h: Added NUM2MODET() and MODET2NUM() default
+ * configure.in (setjmp-type): check if setjmpex() is really available.
+ workaround for i686-w64-mingw32 which declares it but lacks its
definition.
- Because r30686 introduced win32 build failure.
-
-Sat Jan 29 22:16:26 2011 NARUSE, Yui <naruse@ruby-lang.org>
-
- * array.c (rb_ary_join): [].join.encoding must be US-ASCII.
- [ruby-list:47790]
-
-Sat Jan 29 20:22:39 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * benchmark/driver.rb (BenchmarkDriver#measure): Show command line
- when abnormal exiting occur.
-
-Sat Jan 29 10:53:16 2011 Yusuke Endoh <mame@tsg.ne.jp>
-
- * vm_insnhelper.c (vm_get_ev_const): no-scope reference to toplevel
- private constant has been prohibited incorrectly.
-
- * test/ruby/test_module.rb (test_toplevel_private_constant): add a
- test for above.
-
-Sat Jan 29 08:43:23 2011 Ryan Davis <ryand-ruby@zenspider.com>
-
- * lib/rubygems*: Import rubygems 1.5.0 (release candidate @ 09893d9)
- * test/rubygems: Ditto
-
-Sat Jan 29 02:02:37 2011 Yusuke Endoh <mame@tsg.ne.jp>
-
- * variable.c (rb_mod_const_of, sv_i): Module#constant should exclude
- private constants. see [ruby-core:32912].
-
- * test/ruby/test_module.rb (test_constants_with_private_constant): add
- a test for above.
-
-Sat Jan 29 01:36:41 2011 Yusuke Endoh <mame@tsg.ne.jp>
-
- * variable.c (rb_const_set): const_set should preserve constant
- visibility. see [ruby-core:32912].
-
- * test/ruby/test_module.rb: add a test for above.
-
-Sat Jan 29 01:24:57 2011 Yusuke Endoh <mame@tsg.ne.jp>
-
- * compile.c (NODE_CLASS, NODE_MODULE), insns.def (defineclass): raise
- an exception when "class Foo::Bar" is evaluated and Foo::Bar is
- private. To implement this, define_type of "defineclass" is added
- so that the instruction can distinguish whether the class definition
- is scoped (class Foo::Bar) or not (class Bar).
-
- * test/ruby/test_class.rb (test_redefine_private_class),
- test/ruby/test_module.rb
- (test_define_module_under_private_constant): add tests for above.
-
-Sat Jan 29 01:19:17 2011 Yusuke Endoh <mame@tsg.ne.jp>
-
- * constant.h, variable.c: to ensure compatibility, rb_const_get_* must
- not raise an exception even when the constant is private. Instead,
- rb_public_const_get_* and rb_public_const_defined_* are introduced,
- which raise an exception when the referring constant is private.
- see [ruby-core:32912].
-
- * vm_insnhelper.c (vm_get_ev_const): use rb_public_const_get_* instead
- of rb_const_get_* to follow the constant visibility when user code
- refers a constant.
-
- * test/ruby/test_marshal.rb (test_marshal_private_class): add a test.
- This test had failed because of incompatibility of rb_const_get.
-
-Sat Jan 29 00:30:44 2011 Yusuke Endoh <mame@tsg.ne.jp>
-
- * variable.c (set_const_visibility): fix typo. a patch from Tomoyuki
- Chikanaga in [ruby-core:32919].
-
-Fri Jan 28 23:20:28 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * test/gdbm/test_gdbm.rb (TestGDBM#test_s_open_no_create,
- TestGDBM2#test_writer_open_notexist): We only need to skip libgdbm
- 1.8.0, not all 1.8.x. 1.8.1 or later don't have GDBM_WRITER sickness.
-
-Fri Jan 28 21:56:57 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * ext/dbm/extconf.rb: Added new header places for Fedora13.
-
-Fri Jan 28 21:49:30 2011 Tanaka Akira <akr@fsij.org>
-
- * ext/zlib/zlib.c: parenthesize macro arguments.
-
-Fri Jan 28 17:47:33 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * test/gdbm/test_gdbm.rb (TestGDBM2#test_writer_open_notexist):
- gdbm 1.8.x changed GDBM::WRITER behavior. Thus our testcase need
- to be changed too.
-
-Fri Jan 28 17:33:28 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * test/gdbm/test_gdbm.rb (TestGDBM#test_s_open_no_create): skip
- the test if gdbm version is 1.8.x.
-
-Fri Jan 28 16:30:51 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * test/ruby/test_require.rb (TestRequire#test_require_too_long_filename):
- Added -w option because too long path error don't output a message
- by default since r30660. [Bug #4336] [ruby-dev:43134]
-
-Fri Jan 28 16:19:38 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * test/ruby/test_require.rb (TestRequire#test_require_path_home_{1,2}):
- Added -w option because too long path error don't output a message
- by default since r30660. [Bug #4336] [ruby-dev:43134]
-
-Fri Jan 28 16:04:54 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * test/ruby/test_require.rb (TestRequire#test_require_path_home_{1,2,3}):
- split from test_require_path_home.
-
-Fri Jan 28 13:04:38 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * configure.in (--with-valgrind): Fixed r29683. Now this option
- is really default on.
-
-Fri Jan 28 12:05:48 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * configure.in: Add #include<sys/stat.h> when struct stat is
- tested. Otherwise, incomplete type dereference error will occur.
-
-Fri Jan 28 11:53:19 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * configure.in: redundant variable names made strange conftest
- error. Fixed it.
-
-Fri Jan 28 11:47:00 2011 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * test/ruby/test_process.rb (TestProcess#test_too_long_path{,2}):
- should handle Errno::E2BIG, because this test checks crash of ruby,
- not the error type system.
-
-Fri Jan 28 11:23:54 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * io.c (rb_io_open): Use NUM2MODET() instead NUM2UINT().
- * io.c (rb_scan_open_args): ditto.
-
-Fri Jan 28 10:58:20 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * configure.in: Added mode_t type checking.
- * process.c (rb_exec_arg_addopt): Use NUM2MODET() instead
- NUM2LONG because clang makes compile error by this narrowing
- conversion.
- * process.c (rb_run_exec_options_err): ditto.
-
-Fri Jan 28 02:37:18 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * re.c (rb_reg_raise): add GC guard to prevent intermediate
- variable from GC.
-
-Fri Jan 28 02:35:41 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * hash.c (rb_hash_fetch_m): add GC guard to prevent intermediate
- variable from GC.
-
-Fri Jan 28 01:33:51 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * test/ruby/test_process.rb (TestProcess#test_too_long_path)
- TestProcess#test_too_long_path): Reduced string size from 100MB
- to 10MB. 100MB may cause no memory error. It isn't intended.
-
-Fri Jan 28 01:27:42 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * test/ruby/test_process.rb (TestProcess#test_too_long_path2):
- Factored out from test_too_long_path. A test should only do
- one test.
-
-Thu Jan 27 23:29:36 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * st.c (st_foreach): check if unpacked.
-Thu Jan 27 23:14:19 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * include/ruby/defines.h: include setjmpex.h only if also setjmpex()
+ is available.
- * misc/ruby-mode.el (ruby-mode-map): remove deprecated binding.
- use M-; instead.
+Sat May 18 23:57:46 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Thu Jan 27 21:58:32 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * configure.in (setjmp-type): use setjmpex() on w64-mingw32 to get rid
+ of -Wclobbered warnings.
- * bignum.c (rb_str_to_inum): get rid of too huge alloca().
+ * include/ruby/defines.h: include setjmpex.h here becase setjmp.h is
+ included from win32.h via intrin.h, winnt.h, and so on.
-Thu Jan 27 21:43:29 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+Sat May 18 20:28:12 2013 Tanaka Akira <akr@fsij.org>
- * object.c (rb_str_to_dbl): rewrite again. use ALLOCV instead
- rb_str_tmp_new().
+ * ext/socket/mkconstants.rb (INTEGER2NUM): Make less comparisons.
-Thu Jan 27 21:41:47 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+Sat May 18 20:15:28 2013 NARUSE, Yui <naruse@ruby-lang.org>
- * win32/win32.c: get rid of STRNDUPA(). It's dangerous API.
+ * string.c (str_scrub_bang): add String#scrub!. [Feature #8414]
-Thu Jan 27 21:31:57 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+Sat May 18 16:59:52 2013 Tanaka Akira <akr@fsij.org>
- * win32/win32.c (rb_w32_aspawn): get rid of too huge alloca().
- [Bug #4330] [ruby-core:34898]
+ * ext/socket/mkconstants.rb (INTEGER2NUM): Renamed from INTEGER2VALUE.
-Thu Jan 27 20:30:18 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+Sat May 18 16:57:58 2013 Tanaka Akira <akr@fsij.org>
- * win32/win32.c (rb_w32_spawn): get rid of too huge alloca().
+ * ext/socket/mkconstants.rb (INTEGER2VALUE): Suppress a warning:
+ comparison between signed and unsigned integer expressions
-Thu Jan 27 18:49:53 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+Sat May 18 16:38:39 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * win32/win32.c (open_dir_handle): get rid of too huge alloca().
+ * compile.c (iseq_compile_each): forward anonymous and first keyword
+ rest argument one. [ruby-core:55033] [Bug #8416].
-Thu Jan 27 18:34:58 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+Sat May 18 15:49:14 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * file.c (w32_io_info): get rid of too huge alloca().
- [Bug #4313] [ruby-core:34830]
+ * vm_core.h (rb_vm_tag): move jmpbuf between tag and prev so ensure to
+ be accessible.
-Thu Jan 27 18:19:51 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+Sat May 18 11:05:14 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * win32/win32.c (wstati64): get rid of too huge alloca().
- [Bug #4316] [ruby-core:34834]
+ * enumerator.c (inspect_enumerator): use VALUE instead of mere char*
+ by using rb_sprintf() and rb_id2str().
-Thu Jan 27 15:11:52 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+ * enumerator.c (append_method): extract from inspect_enumerator().
- * win32/win32.c (rb_w32_spawn, rb_w32_aspawn): get rid of too huge
- alloca(). this is the real fix of [ruby-core:34833].
+Sat May 18 09:00:32 2013 Tanaka Akira <akr@fsij.org>
-Thu Jan 27 12:46:25 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * ext/socket/mkconstants.rb (INTEGER2VALUE): Use LONG2FIX if possible.
- * process.c (ALLOC_ARGV_WITH_STR): fix void pointer arithmetic.
+Sat May 18 00:38:47 2013 Tanaka Akira <akr@fsij.org>
-Thu Jan 27 08:41:40 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * ext/socket/mkconstants.rb: Convert integer constants bigger than int
+ correctly.
- * process.c (proc_exec_v, rb_proc_exec_n, rb_proc_exec)
- (proc_spawn_n, proc_spawn): get rid of too huge alloca().
- [ruby-core:34827], [ruby-core:34833]
+Fri May 17 22:02:15 2013 Tanaka Akira <akr@fsij.org>
-Thu Jan 27 08:32:17 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * ext/socket/ifaddr.c: Use unsigned LONG_LONG to represent flags
+ because SunOS 5.11 (OpenIndiana) defines ifa_flags as uint64_t.
- * include/ruby/ruby.h (ALLOCV): new API for exception-safe
- temporary buffer. [ruby-core:34844]
+Fri May 17 21:47:00 2013 Zachary Scott <zachary@zacharyscott.net>
- * string.c (rb_alloc_tmp_buffer, rb_free_tmp_buffer):
- implementation of the API.
+ * cont.c: Typo in constant MAX_MACHINE_STACK_CACHE from '..MAHINE..'
+ patch by @schmurfy [Fixes GH-307]
-Thu Jan 27 08:22:49 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Fri May 17 19:18:24 2013 Akinori MUSHA <knu@iDaemons.org>
- * dln_find.c (dln_find_1): use rb_warning and return immediately
- if fname is longer than buffer.
+ * 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 ?\".
-Wed Jan 26 22:57:30 2011 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
+Fri May 17 18:06:15 2013 Tanaka Akira <akr@fsij.org>
- * class.c (clone_method): add GC guard to prevent intermediate
- variable from GC. [Bug #4321] [ruby-dev:43107]
+ * 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.
-Wed Jan 26 22:45:16 2011 Tanaka Akira <akr@fsij.org>
+Fri May 17 17:34:48 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * template/id.h.tmpl: parenthesize macro arguments.
+ * gc.c (rb_gc_guarded_ptr): unoptimize on other compilers than gcc and
+ msvc.
-Wed Jan 26 22:28:49 2011 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
+Fri May 17 11:06:48 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * vm_eval.c (rb_throw_obj): add GC guard to prevent intermediate
- variable from GC. [Bug #4322] [ruby-dev:43108]
+ * eval_intern.h (TH_PUSH_TAG): ensure jmpbuf to be accessible before
+ pushing tag to get rid of unaccessible tag by stack overflow.
-Wed Jan 26 17:08:59 2011 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
+Thu May 16 17:15:32 2013 NARUSE, Yui <naruse@ruby-lang.org>
- * ext/openssl/ossl_asn1.c (ossl_asn1_decode0): OpenSSL::ASN1.decode
- should reject indefinite length primitive encodings as that is
- illegal. Patch by Martin Bosslet. See #4324.
+ * 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
-Wed Jan 26 10:36:28 2011 NARUSE, Yui <naruse@ruby-lang.org>
+Thu May 16 16:19:50 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * string.c (=~): documentation fix; the return value is nil when
- it doesn't match. patched by Andrei Kulakov [ruby-core:34562]
+ * win32/Makefile.sub (verconf.in): no longer used.
-Tue Jan 25 08:41:58 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * win32/Makefile.sub (config.status): fix typo.
- * dln_find.c (dln_find_1): omit too long pathnames.
+ * configure.in, template/verconf.h.in (RUBY_EXEC_PREFIX): fix for
+ default prefix.
-Tue Jan 25 08:28:19 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Thu May 16 13:12:27 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * string.c (rb_str_resize): get rid of out-of-bound access.
-
-Tue Jan 25 07:48:22 2011 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
-
- * test/ruby/test_thread.rb: remove unused variables.
-
-Tue Jan 25 07:45:44 2011 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
-
- * test/ruby/test_thread.rb (TestThread#test_condvar_nolock_2): get
- rid of method redefined.
-
-Tue Jan 25 07:00:52 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * string.c (rb_string_value_cstr): rb_str_modify can change
- RSTRING_PTR.
-
-Tue Jan 25 03:24:28 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * test/ruby/test_thread.rb: Added various ConditionVariable tests.
-
-Mon Jan 24 22:26:33 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * object.c (rb_str_to_dbl): Fix again. use rb_str_tmp_new()
- instead ALLOC_N.
-
-Mon Jan 24 21:50:48 2011 Tanaka Akira <akr@fsij.org>
-
- * vm_insnhelper.h: parenthesize macro arguments.
-
-Mon Jan 24 21:28:34 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * object.c (rb_str_to_dbl): use ALLOC_N instead ALLOCA_N because
- ALLOC_N may cause stack overflow.
-
-Mon Jan 24 21:04:45 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * error.c (rb_invalid_str): prevent intermediate variable from GC.
- [ruby-core:34820]
-
-Sun Jan 23 23:01:54 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * test/io/console/test_io_console.rb: Don't run test if the system
- don't support io/console.
-
-Sun Jan 23 22:17:07 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * test/fiddle/test_fiddle.rb: Don't run test if the system don't support
- fiddle.
-
- * test/fiddle/test_function.rb: ditto.
- * test/fiddle/test_closure.rb: ditto.
-
-Sun Jan 23 11:39:18 2011 Tanaka Akira <akr@fsij.org>
-
- * vm_exec.h: parenthesize macro arguments.
-
-Sun Jan 23 10:33:02 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * template/fake.rb.in (ruby): suppress warnings.
-
-Sun Jan 23 08:00:09 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * string.c (str_nth_len, str_utf8_nth): return the rest length together.
-
- * string.c (rb_str_substr): get rid of measure the length always
- to improve performance for huge string. [ruby-core:34648]
-
-Sun Jan 23 00:40:10 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * test/test_syslog.rb: Fix to make a lot of test failure if
- the platform doesn't support syslog.
-
-Sat Jan 22 11:49:55 2011 Aaron Patterson <aaron@tenderlovemaking.com>
-
- * ext/psych/lib/psych/visitors/to_ruby.rb: fixing merge key support
- when multiple merge keys are specified.
-
- * test/psych/test_merge_keys.rb: tests for multi-merge key support
-
-Sat Jan 22 11:33:04 2011 Aaron Patterson <aaron@tenderlovemaking.com>
-
- * ext/psych/lib/psych/visitors/to_ruby.rb: merge keys are actually
- part of YAML 1.1, so they should be supported. Remove warning and
- merge keys to parent. [ruby-core:34679]
-
- * test/psych/test_merge_keys.rb: test for merge keys
-
-Sat Jan 22 10:25:19 2011 Aaron Patterson <aaron@tenderlovemaking.com>
-
- * ext/psych/parser.c (parse): add the file name to the exception when
- parse errors occur.
-
- * test/psych/test_parser.rb: test for parse error file name
-
-Sat Jan 22 10:12:30 2011 Aaron Patterson <aaron@tenderlovemaking.com>
-
- * ext/psych/parser.c (parse): fix assertion error when reusing a
- parser after an exception has been raised
-
- * test/psych/test_parser.rb: test for assertion error
-
-Sat Jan 22 04:09:22 2011 Aaron Patterson <aaron@tenderlovemaking.com>
-
- * ext/psych/lib/psych/nodes/node.rb: Make Psych::Nodes::Node
- enumerable.
-
- * ext/psych/lib/psych/visitors/depth_first.rb: Add a depth-first
- visitor to enumerate over a YAML AST in a depth-first fashion
-
- * test/psych/nodes/test_enumerable.rb: test for enumerating nodes
-
- * test/psych/visitors/test_depth_first.rb: test for depth-first
- visitor
-
-Sat Jan 22 00:53:42 2011 Tanaka Akira <akr@fsij.org>
-
- * vm_core.h: parenthesize macro arguments.
-
-Fri Jan 21 18:15:09 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * configure.in: should not use -Werror=* flags while conftests.
-
-Fri Jan 21 09:17:00 2011 Luis Lavena <luislavena@gmail.com>
-
- * configure.in: Fix incorrectly detected x86_64-w64-mingw32 due
- canonalization of target_os. Bug #3889 [ruby-core:32634]
-
-Thu Jan 20 23:44:00 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * configure.in: Fix rb_cv_va_args_macro was broken. We are using
- -Werror=implicit-function-declaration compile option. therefore
- we need a function declaration explicitly.
-
-Thu Jan 20 23:58:02 2011 Tanaka Akira <akr@fsij.org>
-
- * node.h: parenthesize macro arguments.
-
-Thu Jan 20 23:25:28 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * configure.in: Add '#include <stdlib.h>' to
- rb_cv_localtime_overflow test too. It's reported by Tomoyuki
- Chikanaga. Thanks.
-
-Thu Jan 20 16:11:00 2011 Kenta Murata <mrkn@mrkn.jp>
-
- * README.EXT, README.EXT.ja: You shouldn't choose ``conftest.c'' as a
- name of a source file.
-
-Thu Jan 20 12:15:44 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * configure.in: Add stdlib.h inclusion into rb_cv_negative_time_t
- test because it's required for exit(3). The patch is
- created by Tomoyuki Chikanaga. [Bug #4287] [ruby-dev:43060]
-
-Thu Jan 20 11:39:41 2011 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * test/webrick/utils.rb (TestWEBrick::RubyBin): test CGI does not need
- to load rubygems. if it activated, ruby raises LoadError about
+ * template/verconf.h.in: generate verconf.h from the template and
rbconfig.rb.
-Thu Jan 20 09:19:42 2011 Aaron Patterson <aaron@tenderlovemaking.com>
-
- * ext/psych/lib/psych/visitors/json_tree.rb: Fix JSON emit for
- DateTime and Time classes.
-
- * test/psych/test_json_tree.rb: test for JSON emit
-
-Thu Jan 20 08:02:46 2011 Aaron Patterson <aaron@tenderlovemaking.com>
-
- * ext/psych/lib/psych/coder.rb (represent_object): arbitrary objects
- may be passed to the Psych::Coder object.
-
- * ext/psych/lib/psych/visitors/yaml_tree.rb: support for visiting
- arbitrary objects set on the coder.
-
- * test/psych/test_coder.rb: supporting test case.
-
-Thu Jan 20 06:03:17 2011 Tanaka Akira <akr@fsij.org>
-
- * method.h: parenthesize macro arguments.
-
-Wed Jan 19 13:16:05 2011 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/commands/sources_command.rb: Finish removing code,
- (fixes sources command test).
-
-Wed Jan 19 13:04:16 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * proc.c (proc_call): Add gc guard to avoid segfault. The fix
- is created by Tomoyuki Chikanaga. [Bug #4238][ruby-dev:42963]
-
-Wed Jan 19 12:31:28 2011 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems.rb: Since gem_prelude requires rubygems, enable
- custom_require always.
-
-Wed Jan 19 12:08:08 2011 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/commands/dependency_command.rb: Remove require of
- deleted file.
- * lib/rubygems/commands/fetch_command.rb: ditto
- * lib/rubygems/commands/setup_command.rb: ditto
- * lib/rubygems/commands/sources_command.rb: ditto
- * lib/rubygems/commands/specification_command.rb: ditto
-
-Wed Jan 19 08:13:59 2011 Ryan Davis <ryand-ruby@zenspider.com>
-
- * lib/rubygems*: Import rubygems 1.5.0 (release candidate)
- * test/rubygems: Ditto
-
-Tue Jan 18 23:31:01 2011 Yusuke Endoh <mame@tsg.ne.jp>
-
- * parse.y: avoid NULL reference. [ruby-dev:43067]
-
-Wed Jan 19 02:54:04 2011 NARUSE, Yui <naruse@ruby-lang.org>
-
- * vsnprintf.c (cvt): set first byte of buf to NUL for the case when
- no bytes are written to the buf. [ruby-dev:43062]
-
-Tue Jan 18 23:04:51 2011 Tanaka Akira <akr@fsij.org>
-
- * gc.h: parenthesize macro arguments.
-
-Tue Jan 18 18:31:14 2011 Keiju Ishitsuka <keiju@ishitsuka.com>
-
- * lib/irb/completion.rb: Irb tab completion support for XX::method
- forms.
-
-Tue Jan 18 15:05:55 2011 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
-
- * lib/logger.rb: added RDoc document for logging message escape
- by Hal Brodigan. See #3869
-
-Tue Jan 18 07:53:52 2011 Tanaka Akira <akr@fsij.org>
-
- * eval_intern.h: parenthesize macro arguments.
-
-Tue Jan 18 04:42:44 2011 Aaron Patterson <aaron@tenderlovemaking.com>
-
- * ext/psych/lib/psych/parser.rb (Mark): Adding a class to wrap
- marker information
-
- * ext/psych/parser.c (mark): Add a method to return the mark object
- for the parser
-
- * test/psych/test_parser.rb: tests for the Mark class.
-
-Tue Jan 18 02:46:55 2011 Aaron Patterson <aaron@tenderlovemaking.com>
-
- * ext/psych/lib/psych/visitors/json_tree.rb (visit_String): JSON
- strings should be dumped with double quotes. [ruby-core:34186]
-
- * test/psych/test_json_tree.rb: test for double quotes
-
-Mon Jan 17 23:36:33 2011 Tanaka Akira <akr@fsij.org>
-
- * array.c (rb_ary_times): less MEMCPY calls.
-
-Mon Jan 17 22:54:33 2011 Tanaka Akira <akr@fsij.org>
-
- * debug.h: parenthesize macro arguments.
-
-Mon Jan 17 21:40:25 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * ruby.c (process_options): revert r30549.
-
-Sun Jan 16 20:55:45 2011 Tanaka Akira <akr@fsij.org>
-
- * vsnprintf.c: parenthesize macro arguments.
-
-Sat Jan 15 11:57:30 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * configure.in (warnflags): add -Werror=implicit-function-declaration
- if available.
-
- * lib/mkmf.rb (init_mkmf): ignore warnings in mkmf tests.
-
- * test/mkmf/base.rb (setup, teardown): restore config values.
-
- * test/mkmf/test_flags.rb: split from test_find_executable.rb.
-
-Sat Jan 15 10:04:14 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * ruby.c (process_options): autoload rubygems.
-
- * tool/compile_prelude.rb (Prelude#initialize): ignore empty
- preludes.
-
- * ruby.c (ruby_init_prelude): get rid of global namespace
- pollution.
-
-Sat Jan 15 09:42:12 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * include/ruby/io.h: missing prototypes.
-
-Fri Jan 14 23:25:55 2011 Tanaka Akira <akr@fsij.org>
-
- * vm_method.c: parenthesize macro arguments.
-
-Fri Jan 14 15:32:29 2011 Shugo Maeda <shugo@ruby-lang.org>
-
- * test/net/imap/test_imap.rb: call neither logout nor disconnect
- unless connected. patch by Kazuhiro NISHIYAMA. [ruby-dev:42860]
-
-Fri Jan 14 14:56:57 2011 NARUSE, Yui <naruse@ruby-lang.org>
-
- * lib/net/imap.rb: use bytesize for binary strings.
- patched by Yoshimasa Niwa. [ruby-core:34222]
-
-Fri Jan 14 14:01:12 2011 NARUSE, Yui <naruse@ruby-lang.org>
-
- * pack.c (pack_unpack): the resulted string of unpack('M') must have
- ASCII-8BIT encoding (and ENC_CODERANGE_VALID). [ruby-core:34482]
-
-Fri Jan 14 13:38:58 2011 NARUSE, Yui <naruse@ruby-lang.org>
-
- * ext/zlib/zlib.c (gzfile_check_footer): ISIZE (Input SIZE) in
- gzip's header is the size of uncompressed input data modulo 2^32.
- [ruby-core:34481] http://www.ietf.org/rfc/rfc1952.txt
-
-Fri Jan 14 11:36:25 2011 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * configure.in, win32/Makefile.sub (RUNRUBY): require path should
- include "." because rbconfig.rb is there.
-
-Fri Jan 14 10:40:11 2011 Ryan Davis <ryan@lust.local>
-
- * gem_prelude.rb: Just require rubygems. Fixes rubygems 1.4.
- * lib/rubygems.rb: removed all Gem::Quickloader code.
- * ruby.c: renamed ruby_init_gems to ruby_init_prelude. Set
- $disable_rubygems since there is no fine grained mechanism to
- skip parts of the prelude. Open to suggestions on how to do this
- better.
- * test/*.rb: Load path isn't set up correctly, so add
- --disable-gems as needed to failing tests that are explicitly
- testing stderr w/ ==.
-
-Fri Jan 14 07:30:47 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * io.c (argf_next_argv): go advance when the next file cannot be
- read. [ruby-core:34446]
-
-Thu Jan 13 20:49:19 2011 Tanaka Akira <akr@fsij.org>
-
- * vm_insnhelper.c: parenthesize macro arguments.
-
-Thu Jan 13 13:21:00 2011 Kenta Murata <mrkn@mrkn.jp>
-
- * vm_dump.c: delete dashes to make lines 80 chars, Patched by
- Shota Fukumori (sora_h). [Bug #4275] [ruby-dev:43021]
-
-Thu Jan 13 13:21:00 2011 Kenta Murata <mrkn@mrkn.jp>
-
- * vm_dump.c: fix misspelling of CrashReporter, Patched by Shota
- Fukumori (sora_h). [Bug #4275] [ruby-dev:43021]
-
-Thu Jan 13 06:27:29 2011 Ryan Davis <ryand-ruby@zenspider.com>
-
- * error.c: Exception#to_s should actually call to_s.
-
-Thu Jan 13 00:32:54 2011 NARUSE, Yui <naruse@ruby-lang.org>
-
- * addr2line.c (get_nth_dirname): decrement the directory index
- because the index specifies the index of given included_directories
- which is separated by NUL and its index is begun from 1.
- Note that 0 specifies the current directory of the compilation.
- see also http://www.dwarfstd.org/doc/dwarf-2.0.0.pdf
-
-Thu Jan 13 00:06:38 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * io.c (rb_f_syscall): Add warning messages. [ruby-core:34062]
-
-Thu Jan 13 00:00:07 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+Thu May 16 05:47:18 2013 Aaron Patterson <aaron@tenderlovemaking.com>
- * io.c (rb_f_syscall): Some syscall return unsigned or pointer value.
- Therefore we should only check the result is -1 or not.
- [ruby-core:34062]
+ * ext/psych/lib/psych/visitors/yaml_tree.rb: fix syntax error.
+ Thanks @spastorino! [ruby-core:55011]
-Wed Jan 12 23:55:48 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+Thu May 16 03:05:45 2013 Koichi Sasada <ko1@atdot.net>
- * io.c (rb_f_syscall): Add 64bit Linux support. Some syscall takes
- long type arguments.
+ * gc.c (rb_node_newnode): use newobj_of() instead of rb_newobj().
-Wed Jan 12 19:37:10 2011 Tanaka Akira <akr@fsij.org>
+Thu May 16 02:03:39 2013 Tanaka Akira <akr@fsij.org>
- * vm_dump.c: parenthesize macro arguments.
+ * ext/socket/depend: Add a dependency for ifaddr.o.
-Wed Jan 12 19:28:23 2011 Tanaka Akira <akr@fsij.org>
+Thu May 16 01:44:45 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * vm.c (thread_free): reset ruby_current_thread if it points the
- thread to free.
- * gc.c (slot_sweep): don't call RUBY_VM_SET_FINALIZER_INTERRUPT if
- there is no current thread.
- [ruby-dev:43000]
-
-Wed Jan 12 19:09:29 2011 Tanaka Akira <akr@fsij.org>
-
- * enum.c (sort_by_i): reenter check more strictly.
- (sort_by_cmp): ditto.
- [ruby-dev:43003] reported by Usaku NAKAMURA.
-
-Wed Jan 12 16:25:12 2011 Yuki Sonoda (Yugui) <yugui@yugui.jp>
-
- * lib/net/http.rb (Net::HTTP#connect): makes it timeout during
- SSL handshake too. [ruby-core:34203]
- Patch by Marc Slemko.
-
- * test/net/http/test_http.rb (TestNetHTTP_v1_2#test_timeout_during_HTTP_session):
- test for [ruby-core:34203]
-
- * test/net/http/test_https.rb (TestNetHTTPS#test_timeout_during_SSL_handshake):
- ditto.
-
-Wed Jan 12 16:24:53 2011 Yuki Sonoda (Yugui) <yugui@yugui.jp>
-
- * ext/readline/extconf.rb: new checks for RL_PROMPT_START_IGNORE
- and RL_PROMPT_END_IGNORE. [ruby-core:34331]
-
- * ext/readline/readline.c: enables USE_INSERT_IGNORE_ESCAPE only if
- RL_PROMPT_{START,END}_IGNORE are available to get rid of compilation
- error with libedit.
-
-Wed Jan 12 15:53:49 2011 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * README.EXT.ja (rb_ensure): typo.
-
-Wed Jan 12 11:33:46 2011 NARUSE, Yui <naruse@ruby-lang.org>
-
- * addr2line.c: OpenBSD uses the elf_abi.h header file instead of the
- elf.h header file. patched by Jeremy Evans [ruby-core:34384]
-
-Wed Jan 12 03:59:36 2011 NARUSE, Yui <naruse@ruby-lang.org>
-
- * test/webrick/test_cgi.rb: Removes usage of deprecated
- :RequestHandler option.
- patched by Peter Weldon [ruby-core:34010]
-
- * test/webrick/test_httpproxy.rb: ditto.
-
- * test/webrick/test_httpserver.rb: Add a test of the deprecation
- behaviour.
-
-Wed Jan 12 08:37:07 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * hash.c (hash_i): return different values for inverse hash.
- [ruby-core:34334]
-
-Tue Jan 11 20:32:59 2011 Tanaka Akira <akr@fsij.org>
-
- * variable.c: parenthesize macro arguments.
-
-Tue Jan 11 13:06:38 2011 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * array.c (rb_ary_resize): should care of embeded array when extending
- the array.
-
- * array.c (rb_ary_resize): need to set capa when changing the real
- size of the array.
- these are latent bugs.
-
-Mon Jan 10 22:46:43 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * include/ruby/defines.h (CASEFOLD_FILESYSTEM): HFS+ is case
- insensitive.
-
- * load.c (loaded_feature_path, rb_feature_p, load_lock): on a
- case-insensitive filesystem, loaded features search should
- ignore case. [ruby-core:34297]
-
-Mon Jan 10 21:34:12 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * common.mk (showflags): show LD commands.
-
-Mon Jan 10 14:32:55 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * test/ruby/test_method.rb (TestMethod#test_define_method): method
- transplanting between class and module is impossible.
-
-Mon Jan 10 13:51:17 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * misc/rdoc-mode.el (rdoc-mode): show trailing whitespace.
-
-Mon Jan 10 11:22:02 2011 Tanaka Akira <akr@fsij.org>
-
- * util.c: parenthesize macro arguments.
-
-Mon Jan 10 07:41:31 2011 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
-
- * misc/README: mention rdoc-mode.el and ruby-style.el.
-
-Sun Jan 9 20:37:21 2011 Tanaka Akira <akr@fsij.org>
-
- * transcode.c: parenthesize macro arguments.
-
-Sun Jan 9 16:31:53 2011 Yuki Sonoda (Yugui) <yugui@yugui.jp>
-
- * io.c (Kernel.#syscall): implemented on LP64/LLP64 environments too.
- also uses __syscall if available for *BSD on 64bit architecture.
- [ruby-core:34062]
-
-Sun Jan 9 16:31:34 2011 Yuki Sonoda (Yugui) <yugui@yugui.jp>
-
- * lib/irb/locale.rb (IRB::Locale::LOCALE_NAME_RE):
- some platform has a locale without territory but with
- encoding.
- (#each_sub_locale): ditto.
-
-Sun Jan 9 14:47:50 2011 TAKAO Kouji <kouji@takao7.net>
-
- * ext/readline/readline.c: apply a patch from Nobuyoshi Nakada.
- fixed #3616 [ruby-core:31484] IRB + readline incorrectly counts
- non-printing characters in prompt
-
-Sat Jan 8 21:47:26 2011 Tanaka Akira <akr@fsij.org>
-
- * enum.c (enum_sort_by): use rb_ary_resize.
- (ary_cutoff): removed.
-
-Sat Jan 8 21:24:17 2011 Tanaka Akira <akr@fsij.org>
-
- * pack.c (swapf): compilation condition simplified.
- (swapd): ditto.
-
-Sat Jan 8 20:51:25 2011 Tanaka Akira <akr@fsij.org>
-
- * pack.c (swapd): remove duplicated code.
-
-Sat Jan 8 19:28:55 2011 Tanaka Akira <akr@fsij.org>
-
- * thread.c: parenthesize macro arguments.
-
-Fri Jan 7 23:07:40 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * lib/mkmf.rb (configuration): backref needs to capture.
-
-Fri Jan 7 21:57:22 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * misc/ruby-mode.el (ruby-mode-variables), misc/ruby-style.el:
- show trailing whitespace.
-
- * misc/ruby-mode.el (ruby-font-lock-syntactic-keywords): highlight
- regexp after open bracket. [ruby-core:34183]
-
-Fri Jan 7 00:37:35 2011 Tanaka Akira <akr@fsij.org>
-
- * string.c: parenthesize macro arguments.
-
-Thu Jan 6 22:42:02 2011 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * bignum.c (bigmul1_karatsuba): avoid overflow that make assertion
- fail in certain case. this patch is contributed from Ray Chason
- <chasonr at gmail.com> in personal communication.
-
-Thu Jan 6 20:55:49 2011 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * lib/mkmf.rb (create_makefile): ignore rest from first dot from
- TARGET to generate init function name.
- this is followup of r30464.
-
-Thu Jan 6 11:27:01 2011 Aaron Patterson <aaron@tenderlovemaking.com>
-
- * ext/psych/lib/psych/json/tree_builder.rb (start_mapping): tags
- should not be included in JSON mapping
-
-Thu Jan 6 09:23:33 2011 Aaron Patterson <aaron@tenderlovemaking.com>
-
- * lib/net/protocol.rb (eof?): BufferedIO should proxy eof? to the
- underlying IO object.
-
-Thu Jan 6 09:12:31 2011 Aaron Patterson <aaron@tenderlovemaking.com>
-
- * lib/mkmf.rb (configuration): fixing gsub when multiple error flags
- are passed to GCC.
-
-Thu Jan 6 05:25:49 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * array.c (rb_ary_modify): export.
-
-Thu Jan 6 05:14:41 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * ext/stringio/stringio.c (get_strio, strio_set_string)
- (strio_reopen): check if frozen. [ruby-core:33648]
-
-Thu Jan 6 05:10:58 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * array.c (rb_ary_resize): new utility function. [ruby-dev:42912]
-
-Thu Jan 6 05:03:26 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * dln.c (init_funcname_len): ignore rest from first dot.
- [ruby-dev:41774]
-
-Thu Jan 6 02:55:48 2011 Aaron Patterson <aaron@tenderlovemaking.com>
-
- * ext/psych/lib/psych/visitors/yaml_tree.rb: use YAML 1.0 output
- format for serializing nil values. Thanks Eric Hodel!
-
- * test/psych/test_nil.rb: test for nil values
-
-Wed Jan 5 14:21:34 2011 Mark Dodwell <hi@mkdynamic.co.uk>
-
- * string.c: fix rdoc typo.
- https://github.com/shyouhei/ruby/pull/3
-
-Wed Jan 5 14:06:01 2011 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * test/rdoc/test_rdoc_options.rb (TestRDocOptions#test_check_files):
- skip on Windows because chmod 0 doesn't mean unreadable by owner.
-
-Wed Jan 5 13:56:54 2011 Akinori MUSHA <knu@iDaemons.org>
-
- * lib/net/http.rb (Net::HTTP#get): A header hash given should not
- be modified.
-
-Wed Jan 5 12:10:08 2011 Aaron Patterson <aaron@tenderlovemaking.com>
-
- * ext/dl/{cfunc.c,dl.h,handle.c}, ext/fiddle/fiddle.{h,c}: Use _WIN32
- rather than checking for windows.h. Thanks Jon Forums!
- [ruby-core:33977]
-
-Sat Jan 1 17:02:50 2011 Yuki Sonoda (Yugui) <yugui@yugui.jp>
-
- * lib/irb/locale.rb (IRB::Locale#search_file): make it possible
- to load a localization from a gem.
- (IRB::Locale#lc_path): obsoleted because of the change of #search_file
- (IRB::Locale#each_localized_path): new private method, based on
- lc_path
- (IRB::Locale#find): follows the change of #search_file.
- (IRB::Locale#load): removed duplicate with #find.
-
-Sat Jan 1 11:44:42 2011 Tanaka Akira <akr@fsij.org>
-
- * strftime.c: parenthesize macro arguments.
-
-Sat Jan 1 11:10:29 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * ext/zlib/zlib.c: take care of platforms where long is bigger
- than int.
-
-Sat Jan 1 11:03:58 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * NEWS (optparse): shell completion support.
-
- * misc/README (rb_optparse.{bash,zsh}): for shell completion.
-
- * include/ruby/intern.h (VALUE rb_ary_print_on): I have never seen
- this function anywhere.
-
-Sat Jan 1 04:20:11 2011 NARUSE, Yui <naruse@ruby-lang.org>
-
- * win32/win32.c (rb_w32_write_console): don't raise exception when
- the conversion is for writing to console.
- Patched by Heesob Park [ruby-core:33999]
-
-Fri Dec 31 12:02:06 2010 Tanaka Akira <akr@fsij.org>
+ * common.mk (verconf.h): $< cannot be used in explicit rules with
+ nmake.
- * enum.c (enum_sort_by): use less temporary objects.
+ * win32/Makefile.sub (CONFIG_H): create verconf.in instead of
+ verconf.h.
-Fri Dec 31 11:46:47 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Thu May 16 01:25:07 2013 Aaron Patterson <aaron@tenderlovemaking.com>
- * configure.in (warnflags), lib/mkmf.rb (configuration): turn
- warnings into errors only for bundled extensions.
- [ruby-core:33815]
+ * ext/psych/lib/psych/visitors/yaml_tree.rb: only emit warnings when
+ -w is enabled.
-Fri Dec 31 11:15:57 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Wed May 15 18:58:17 2013 Koichi Sasada <ko1@atdot.net>
- * ext/zlib/zlib.c (sizeof): zlib.h mistakenly assumes the result
- of sizeof to be int, not size_t.
+ * 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.
-Fri Dec 31 10:27:34 2010 Tanaka Akira <akr@fsij.org>
+ * gc.c (rb_data_object_alloc, rb_data_typed_object_alloc):
+ use newobj_of().
- * st.c: parenthesize macro arguments.
+Wed May 15 17:55:49 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Fri Dec 31 03:23:26 2010 NARUSE, Yui <naruse@ruby-lang.org>
+ * configure.in (RUBY_PLATFORM): move to config.h as needed by
+ version.c.
- * vsnprintf.c (BSD__uqtoa): Fix overflow when long != quad_t.
- patched by Peter Weldon <peter.weldon AT null.net>
- [ruby-core:33985]
+Wed May 15 17:04:11 2013 Koichi Sasada <ko1@atdot.net>
-Fri Dec 31 03:00:34 2010 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
+ * gc.c: add an additional RGENGC_PROFILE mode (2).
+ Profiling result can be check by GC.stat.
- * Makefile.in: remove unnecessary semicolons.
+ * gc.c (type_name): separate from obj_type_name().
-Thu Dec 30 23:09:47 2010 wanabe <s.wanabe@gmail.com>
+Wed May 15 16:58:24 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * vm.c (vm_define_method): guard iseq from GC while method definition.
- [ruby-dev:42832]
+ * configure.in: save configured load path values into verconf.in.
-Thu Dec 30 20:18:32 2010 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * common.mk (verconf.h): create from verconf.in with shvar_to_cpp.rb.
- * win32/Makefile.sub: ditto.
+ * tool/shvar_to_cpp.rb: turn shell variables into C macros.
+ [Bug #7959]
-Thu Dec 30 20:57:09 2010 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * loadpath.c: split load path staffs from version.c.
- * Makefile.in: Check V=1 argument if run "make clean" or similar.
+ * dmyloadpath.c: miniruby has no builtin load paths, so verconf.h is
+ not needed.
-Thu Dec 30 20:41:50 2010 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+Wed May 15 03:56:09 2013 Aaron Patterson <aaron@tenderlovemaking.com>
- * Makefile.in: Kill ugly line continuation.
+ * ext/psych/lib/psych/visitors/yaml_tree.rb: adding backwards
+ compatible YAMLTree.new method
-Thu Dec 30 11:49:40 2010 Tanaka Akira <akr@fsij.org>
+Wed May 15 02:22:16 2013 Aaron Patterson <aaron@tenderlovemaking.com>
- * sprintf.c: parenthesize macro arguments.
+ * 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 Dec 29 21:20:13 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Wed May 15 02:06:35 2013 Aaron Patterson <aaron@tenderlovemaking.com>
- * io.c (maygvl_copy_stream_wait_readwrite): define if USE_SENDFILE
+ * test/psych/helper.rb: envutil is not available outside Ruby, so
+ port the functions from envutil to the test helper.
-Wed Dec 29 20:37:43 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * test/psych/test_deprecated.rb: ditto
- * ext/extmk.rb: strip current directory prefix.
+ * test/psych/test_encoding.rb: ditto
- * enc/depend (clean): remove name2ctype.h when out-of-place build.
+Wed May 15 00:42:54 2013 NAKAMURA Usaku <usa@ruby-lang.org>
- * win32/Makefile.sub (clean-enc): pass V to inferior make.
+ * 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)
-Wed Dec 29 18:23:46 2010 NAKAMURA Usaku <usa@ruby-lang.org>
+Tue May 14 23:43:05 2013 Tanaka Akira <akr@fsij.org>
- * re.c (rb_reg_expr_str): need to escape if the coderange is invalid.
+ * ext/socket/.document: Add ifaddr.c.
-Wed Dec 29 10:06:51 2010 Tanaka Akira <akr@fsij.org>
+Tue May 14 23:24:31 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * signal.c: parenthesize macro arguments.
+ * ext/socket/extconf.rb: check for if_nametoindex() for
+ i686-w64-mingw32, and check for declarations of if_indextoname() and
+ if_nametoindex().
-Wed Dec 29 07:22:15 2010 Eric Hodel <drbrain@segment7.net>
+ * ext/socket/ifaddr.c (ifaddr_ifindex): not-implement unless
+ if_nametoindex() is available.
- * lib/rake/rdoctask.rb: Deprecate in favor of rdoc/task.
+ * ext/socket/rubysocket.h: declare if_indextoname() and
+ if_nametoindex() if available but not declared.
-Wed Dec 29 07:07:06 2010 Eric Hodel <drbrain@segment7.net>
+Tue May 14 19:58:17 2013 CHIKANAGA Tomoyuki <nagachika@ruby-lang.org>
- * lib/rdoc: Import RDoc 3.1
+ * 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 Dec 28 18:36:38 2010 NAKAMURA Usaku <usa@ruby-lang.org>
- * error.c, include/ruby/intern.h (rb_compile_error_with_enc): new
- function to raise syntax error, with source encoding'ed message.
+Tue May 14 14:51:52 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * parse.y (compile_error): use above function.
- [ruby-core:33951] (#4217)
+ * 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 Dec 28 07:37:38 2010 Tanaka Akira <akr@fsij.org>
+Tue May 14 12:21:28 2013 NAKAMURA Usaku <usa@ruby-lang.org>
- * ruby.c: parenthesize macro arguments.
+ * win32/win32.c (NET_LUID): mingw may have NET_LUID and not defined
+ _IFDEF_.
-Tue Dec 28 07:17:11 2010 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
+Tue May 14 03:33:17 2013 Koichi Sasada <ko1@atdot.net>
- * NEWS: add ARGF.write and so on.
+ * string.c (rb_str_new_frozen): remove debug print.
-Tue Dec 28 07:12:38 2010 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
+Tue May 14 03:22:51 2013 Koichi Sasada <ko1@atdot.net>
- * NEWS: add new magic-comment. (warn-indent) [ruby-core:25442]
+ * include/ruby/ruby.h: enable to generate write barrier protected
+ arrays (T_ARRAY).
-Tue Dec 28 04:32:37 2010 Aaron Patterson <aaron@tenderlovemaking.com>
+Tue May 14 03:21:42 2013 Koichi Sasada <ko1@atdot.net>
- * ext/fiddle/extconf.rb: check for windows.h while building fiddle.
- Thanks Jon Forums! [ruby-core:33923]
+ * include/ruby/ruby.h: enable to generate write barrier protected
+ strings (T_STRING).
-Tue Dec 28 01:45:12 2010 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
+Tue May 14 03:19:59 2013 Koichi Sasada <ko1@atdot.net>
- * NEWS: Add Zlib.deflate and Zlib.inflate.
- [ruby-dev:42833]
+ * include/ruby/ruby.h: enable to generate write barrier protected
+ objects (T_OBJECT).
-Mon Dec 27 21:22:33 2010 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+Tue May 14 03:17:15 2013 Koichi Sasada <ko1@atdot.net>
- * win32/configure.bat: Remove obsoleted coding rule. Now, we
- don't support to build on Windows 95/98 and Me.
+ * include/ruby/ruby.h: enable to generate write barrier protected
+ objects for numeric types (Float, Complex, Rational, Bignum).
-Mon Dec 27 18:27:13 2010 Tanaka Akira <akr@fsij.org>
+Tue May 14 03:10:59 2013 Koichi Sasada <ko1@atdot.net>
- * re.c: parenthesize macro arguments.
+ * include/ruby/ruby.h: enable RGENGC (USE_RGENGC)
+ but no type creates write protected (sunny) objects
+ (RGENGC_WB_PROTECTED_* == 0).
-Mon Dec 27 15:22:23 2010 NAKAMURA Usaku <usa@ruby-lang.org>
+Tue May 14 02:47:30 2013 Koichi Sasada <ko1@atdot.net>
- * win32/README.win32: note to need NT based OS to build ruby.
+ * gc.c: support RGENGC. [ruby-trunk - Feature #8339]
+ See this ticket about RGENGC.
-Mon Dec 27 12:14:46 2010 NAKAMURA Usaku <usa@ruby-lang.org>
+ * gc.c: Add several flags:
+ * RGENGC_DEBUG: if >0, then prints debug information.
+ * RGENGC_CHECK_MODE: if >0, add assertions.
+ * RGENGC_PROFILE: if >0, add profiling features.
+ check GC.stat and GC::Profiler.
- * common.mk (EXTMK_ARGS): specify to pass macro V, because nmake
- doesn't pass it via MAKEFLAGS.
+ * include/ruby/ruby.h: disable RGENGC by default (USE_RGENGC == 0).
-Mon Dec 27 10:33:43 2010 NARUSE, Yui <naruse@ruby-lang.org>
+ * array.c: add write barriers for T_ARRAY and generate sunny objects.
- * ext/zlib/zlib.c (Init_zlib): Add Zlib.deflate and Zlib.inflate.
- [ruby-dev:42833]
+ * 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.
-Mon Dec 27 07:38:07 2010 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
+ * bignum.c, marshal.c, random.c: generate T_BIGNUM sunny objects.
- * misc/rb_optparse.zsh: add compdef for generator.
+ * complex.c, include/ruby/ruby.h: add write barriers for T_COMPLEX
+ and generate sunny objects.
-Mon Dec 27 07:32:07 2010 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
+ * rational.c (nurat_s_new_internal), include/ruby/ruby.h: add write
+ barriers for T_RATIONAL and generate sunny objects.
- * lib/optparse.rb (OptionParser#compsys): escape brackets too.
- [ruby-dev:42754]
+ * internal.h: add write barriers for RBasic::klass.
-Mon Dec 27 01:30:08 2010 Tanaka Akira <akr@fsij.org>
+ * numeric.c (rb_float_new_in_heap): generate sunny T_FLOAT objects.
- * ext/socket/mkconstants.rb: add IF_NAMESIZE.
- add a default for INET6_ADDRSTRLEN.
+ * object.c (rb_class_allocate_instance), range.c:
+ generate sunny T_OBJECT objects.
-Sun Dec 26 23:49:47 2010 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * string.c: add write barriers for T_STRING and generate sunny objects.
- * win32/Makefile.sub: suppress a strange error message when RMALL
- found no such file.
- * win32/rmall.bat: new.
+ * variable.c: add write barriers for ivars.
-Sun Dec 26 21:23:23 2010 <kosaki.motohiro@gmail.com>
+ * vm_insnhelper.c (vm_setivar): ditto.
- * win32/Makefile.sub: fix 'nmake clean-enc' breakage since r28322.
+ * include/ruby/ruby.h, debug.c: use two flags
+ FL_WB_PROTECTED and FL_OLDGEN.
-Sun Dec 26 22:25:07 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * node.h (NODE_FL_CREF_PUSHED_BY_EVAL, NODE_FL_CREF_OMOD_SHARED):
+ move flag bits.
- * ext/ripper/depend (ripper.y): fix messages with nmake.
- [ruby-dev:42896]
+Tue May 14 01:54:48 2013 Koichi Sasada <ko1@atdot.net>
-Sun Dec 26 22:24:14 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * gc.c: remove rb_objspace_t::marked_num.
+ We can use `objspace_live_num()' instead of removed `marked_num'
+ if it is after `after_gc_sweep()' function call.
- * file.c (file_expand_path): get rid of warnings caused by
- -Wdeclaration-after-statement on cygwin.
+ * gc.c (after_gc_sweep): use objspace_live_num() instead of removed
+ rb_objspace_t::marked_num.
-Sun Dec 26 20:28:34 2010 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * gc.c (gc_mark_ptr, gc_marks): remove rb_objspace_t::marked_num code.
- * process.c (before_exec): add small comment.
+ * 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.
-Sun Dec 26 20:52:21 2010 Tanaka Akira <akr@fsij.org>
+ * gc.c (lazy_sweep): call after_gc_sweep() if there are no sweep_able entry.
- * ext/socket/mkconstants.rb: define INET_ADDRSTRLEN as 16 if not
- available. fix compilation error on mswin32-60. reported by nobu.
+ * gc.c (rest_sweep, gc_prepare_free_objects): remove after_gc_sweep() call.
-Sun Dec 26 19:37:37 2010 Tanaka Akira <akr@fsij.org>
+Tue May 14 01:50:41 2013 Koichi Sasada <ko1@atdot.net>
- * ext/socket/option.c: define IFNAMSIZ if not available.
- fix compilation error on mingw32. reported by nobu.
+ * gc.c: disable GC_PROFILE_MORE_DETAIL (fix last commit).
-Sun Dec 26 12:16:29 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * gc.c (gc_prof_set_malloc_info): fix "objspace->heap.live_num" to
+ "objspace_live_num(objspace)". There is no such member variable.
- * lib/rdoc/ri/paths.rb (RDoc::RI::Paths::HOMEDIR): no exception if
- HOME is not set. [ruby-core:33867]
+Tue May 14 01:25:55 2013 Koichi Sasada <ko1@atdot.net>
-Sun Dec 26 11:39:11 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * gc.c: refactoring GC::Profiler.
- * parse.y (stmt): missing ripper rule. i.e., `a::B ||= c 1'.
- http://twitter.com/#!/wannabe53/status/18797576396472321
- http://twitter.com/#!/wannabe53/status/18798416150663168
+ * gc.c (gc_prof_sweep_timer_start/stop): removed because
+ they doesn't support lazy sweep.
-Sun Dec 26 11:15:50 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * gc.c (gc_prof_sweep_slot_timer_start/stop): added.
+ redefine `sweeping time' to accumulated time of all of
+ slot_sweep().
- * test/with_different_ofs.rb (DifferentOFS): should not affect
- original classes.
+ * 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.
-Sun Dec 26 09:35:07 2010 Tanaka Akira <akr@fsij.org>
+Tue May 14 00:48:55 2013 Koichi Sasada <ko1@atdot.net>
- * rational.c: parenthesize macro arguments.
+ * 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].
-Sun Dec 26 09:22:19 2010 Tanaka Akira <akr@fsij.org>
+ TODO: API design. RRATIONAL_SET(rat,num,den) is enough?
+ TODO: Setting constify variable with cast has same issue of r40691.
- * ext/socket/option.c (rb_if_indextoname): new function to abstract
- environments without if_indextoname.
- (inspect_ipv6_multicast_if): new function to inspect
- IPV6_MULTICAST_IF.
- Socket::Option.new(:INET6, :IPV6, :MULTICAST_IF,
- [2].pack("I!")).inspect is
- "#<Socket::Option: INET6 IPV6 MULTICAST_IF eth0>".
+ * complex.c, rational.c: use above macros.
-Sun Dec 26 04:31:15 2010 Luis Lavena <luislavena@gmail.com>
+Mon May 13 21:49:17 2013 Tanaka Akira <akr@fsij.org>
- * ext/dl/win32/registry.rb: Corrected RegCreateKeyExA signature.
- Patch by Rafal Michalski [ruby-core:33874] [Ruby 1.9-Bug#4203]
+ * ext/socket/extconf.rb: Check socketpair again.
+ It is required on Unix.
-Sun Dec 26 02:31:58 2010 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+Mon May 13 21:20:32 2013 NAKAMURA Usaku <usa@ruby-lang.org>
- * io.c (advice_arg_check): Change argument check.
- Now, an unsupported advice makes NotImplementedError.
- [ruby-dev:42887] [Ruby 1.9-Feature#4204]
+ * win32/win32.c (getipaddrs): use alternative interface name if
+ available, because if_nametoindex() requires them.
-Sun Dec 26 03:00:53 2010 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+Mon May 13 20:23:24 2013 NAKAMURA Usaku <usa@ruby-lang.org>
- * ext/socket/extconf.rb: Fix build error which was introduced r30372.
+ * win32/win32.c, include/ruby/win32.h (getipaddrs): [experimental]
+ emulate getipaddrs(3) on Unix.
-Sun Dec 26 01:37:10 2010 NAKAMURA Usaku <usa@ruby-lang.org>
+ * win32/Makefile.sub, configure.in (LIBS): need iphlpapi.lib for above
+ function.
- * ext/socket/extconf.rb: check the existence of if_indextoname().
+ * include/ruby/win32.h (socketpair): rb_w32_socketpair() doesn't
+ substitute for any function, so use non-prefixed name.
- * ext/socket/option.c: yesterday's akr's commits destroyed the build of
- some unrelated platforms (such as Windows).
+ * ext/socket/extconf.rb (socketpair); follow above change.
-Sat Dec 25 23:29:11 2010 Tanaka Akira <akr@fsij.org>
+Mon May 13 20:11:06 2013 Koichi Sasada <ko1@atdot.net>
- * ext/socket/option.c (inspect_ipv4_add_drop_membership): new function
- to inspect struct ip_mreq and struct ip_mreqn for
- IP_ADD_MEMBERSHIP and IP_DROP_MEMBERSHIP.
- Socket::Option.new(:INET, :IP, :ADD_MEMBERSHIP,
- [239,255,99,81, 0,0,0,0].pack("CCCCCCCC")).inspect is now
- "#<Socket::Option: INET IP ADD_MEMBERSHIP 239.255.99.81 0.0.0.0>".
- (inspect_ipv4_multicast_if): new function to inspect struct in_addr
- and struct ip_mreqn for IP_MULTICAST_IF.
- Socket::Option.new(:INET, :IP, :MULTICAST_IF,
- [192,168,0,7].pack("CCCC")).inspect is now
- "#<Socket::Option: INET IP MULTICAST_IF 192.168.0.7>".
+ * iseq.c (prepare_iseq_build): remove additional line break.
- * ext/socket/extconf.rb: check struct ip_mreq and struct ip_mreqn.
+Mon May 13 19:29:54 2013 Koichi Sasada <ko1@atdot.net>
-Sat Dec 25 22:49:10 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * 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].
- * test/csv: DifferentOFS needs to be include in each classes.
+ * 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);
- * test/digest/test_digest_extend.rb (TestDigestExtend#setup):
- should not depend on the result of previous tests
+ TODO: API design. rb_obj_reveal() should be replaced with others.
- * test/with_different_ofs.rb (DifferentOFS::WithDifferentOFS): give
- name.
+ 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)".
- * test/with_different_ofs.rb (DifferentOFS): test suite for test
- suites affected by $,.
+ * 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.
- * test/digest/test_digest_extend.rb (TestDigestExtend): should not
- assume $, invariant.
+ * 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.
- * test/csv/test_data_converters.rb, test/csv/test_table.rb: don't
- call setup within tests.
+ * ext/coverage/coverage.c, ext/readline/readline.c,
+ ext/socket/ancdata.c, ext/socket/init.c,
+ * ext/zlib/zlib.c: ditto.
-Sat Dec 25 20:01:40 2010 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+Mon May 13 18:44:14 2013 Koichi Sasada <ko1@atdot.net>
- * io.c (pipe_open): Added rb_thread_atfork(). We must reinitialize
- GVL at new process creation.
+ * *.c, parse.y, insns.def: use RARRAY_AREF/ASET macro
+ instead of using RARRAY_PTR().
-Sat Dec 25 18:26:55 2010 Tanaka Akira <akr@fsij.org>
+Mon May 13 16:53:53 2013 Koichi Sasada <ko1@atdot.net>
- * ext/socket/option.c (inspect_ipv6_mreq): new function to inspect
- struct ipv6_mreq for IPV6_JOIN_GROUP and IPV6_LEAVE_GROUP.
- Socket::Option.new(:INET6, :IPV6, :JOIN_GROUP,
- [0xff12,0,0,0,0,0,0,1, 2].pack("nnnnnnnnI!")).inspect is now
- "#<Socket::Option: INET6 IPV6 JOIN_GROUP ff12::1 eth0>".
+ * 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].
- * ext/socket/extconf.rb: check struct ipv6_mreq.
+Mon May 13 15:31:10 2013 Koichi Sasada <ko1@atdot.net>
-Sat Dec 25 18:04:30 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * object.c (rb_obj_setup): added.
- * lib/csv.rb (CSV.foreach): 'rb' mode is defaulted in open.
+ * include/ruby/ruby.h (OBJSETUP): use rb_obj_setup() instead of
+ a macro.
- * lib/csv.rb (CSV#init_separators): cannonicalize encoding options
- as Encoding objects.
+Mon May 13 15:24:16 2013 Koichi Sasada <ko1@atdot.net>
-Sat Dec 25 18:30:34 2010 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * gc.c (rb_data_object_alloc): check klass only if klass is not 0.
+ klass==0 means internal object.
- * thread.c (rb_thread_atfork): Add small comment why we need
- reset random seed.
+Mon May 13 14:57:28 2013 Koichi Sasada <ko1@atdot.net>
-Sat Dec 25 17:33:55 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * gc.c (rb_data_object_alloc, rb_data_typed_object_alloc):
+ use NEWOBJ_OF() instead of NEWOBJ().
- * test/csv/base.rb (TestCSV.with_different_ofs): give name to
- anonymous classes.
+Mon May 13 14:51:59 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * lib/csv.rb (CSV#init_separators): use IO#gets with length
- parameter to get rid of wrong convertion.
+ * 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]
- * lib/csv.rb (CSV::foreach, CSV#initialize): directly use encoding
+ * vm_method.c (rb_method_entry_at): return the method entry for id at
+ klass, without ancestors.
- * lib/csv.rb, test/csv: should not assume $, invariant.
+ * class.c (rb_singleton_class_get): get the singleton class if exists,
+ or nil.
-Sat Dec 25 16:08:06 2010 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+Mon May 13 10:20:59 2013 Yuki Yugui Sonoda <yugui@google.com>
- * signal.c: change rb_atomic_t definition from uchar to uint.
+ * ext/openssl/ossl_ssl.c: Disabled OpenSSL::SSL::SSLSocket if
+ defined(OPENSSL_NO_SOCK).
-Sat Dec 25 15:04:05 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ 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.
- * test/csv/test_encodings.rb (TestEncodings#setup): fix evil test
- suite writing to the source directory.
+Mon May 13 10:30:04 2013 Zachary Scott <zachary@zacharyscott.net>
-Sat Dec 25 15:08:08 2010 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * hash.c: Hash[] and {} are not equivalent by @eam [Fixes GH-301]
- * ext/pty/pty.c (chfunc): Added rb_thread_atfork_before_exec().
- We must reinitialize GVL at new process creation. Otherwise
- we may meet an insane deadlock. [Bug#4121][ruby-dev:42686]
+Mon May 13 10:04:22 2013 Zachary Scott <zachary@zacharyscott.net>
-Sat Dec 25 14:27:09 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * random.c: Document Random::DEFAULT by @eLobato [Fixes GH-304]
- * io.c (rb_io_extract_encoding_option): accept Encoding object as
- encoding: optional argument. [ruby-dev:42884]
+Sun May 12 21:12:42 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Sat Dec 25 13:37:55 2010 Ryan Davis <ryand-ruby@zenspider.com>
+ * include/ruby/ruby.h (OFFT2NUM): RUBY_REPLACE_TYPE also defines macro
+ to convert int type to VALUE if found.
- * lib/minitest/*.rb: Imported minitest 2.0.2 r6093.
+Wed May 8 13:46:52 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-Sat Dec 25 13:05:59 2010 Tanaka Akira <akr@fsij.org>
+ * include/ruby/intern.h (rb_iv_set, rb_iv_get): removed. Because
+ ruby.h has a declaration for that.
- * random.c: parenthesize macro arguments.
+Wed May 8 13:49:06 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-Sat Dec 25 12:48:50 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * 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.
- * load.c (rb_f_require_relative): don't omit return type.
+Sun May 12 17:52:23 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-Sat Dec 25 11:06:00 2010 Eric Hodel <drbrain@segment7.net>
+ * configure.in: removes 'ac_cv_func_fseeko=yes' form MinGW
+ specific definitions.
- * load.c (rb_f_require_relative): Add documentation.
+Sun May 12 17:25:46 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-Sat Dec 25 11:02:52 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * file.c (rb_file_s_truncate): use correct type. chsize takes
+ a long.
- * ext/zlib/zlib.c (gzreader_gets): support optional length
- parameter.
+Sun May 12 17:18:46 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
- * ext/zlib/zlib.c (gzfile_read, gzfile_readpartial): length should
- be long.
+ * process.c: move '#define HAVE_SPAWNV 1' to win32/Makefile.sub.
+ * win32/Makefile.sub: see above.
-Sat Dec 25 10:51:03 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Sun May 12 17:13:32 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
- * ext/json/generator/generator.{c,h} (fbuffer_free_only_buffer):
+ * configure.in: removes AC_CHECK_FUNCS(setitimer) because it's
unused.
- * ext/openssl/ossl_pkcs5.c (ossl_pkcs5_pbkdf2_hmac): add casts.
-
-Fri Dec 24 08:46:04 2010 Tanaka Akira <akr@fsij.org>
-
- * process.c: parenthesize macro arguments.
-
-Thu Dec 23 19:17:14 2010 Yuki Sonoda (Yugui) <yugui@yugui.jp>
-
- * test/net/imap/cacert.pem: updated because it has been expired.
-
- * test/net/imap/server.crt: signed again because CA cert was expired.
-
-Thu Dec 23 11:16:52 2010 Tanaka Akira <akr@fsij.org>
-
- * parse.y: parenthesize macro arguments.
-
-Thu Dec 23 11:00:09 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * error.c (rb_check_type): check for type from extensions for ruby
- 1.8. see [ruby-core:33797].
-
-Thu Dec 23 08:12:59 2010 Aaron Patterson <aaron@tenderlovemaking.com>
-
- * lib/net/smtp.rb: refactoring Net::SMTP#esmtp= to use an
- attr_accessor
-
-Thu Dec 23 06:35:41 2010 Aaron Patterson <aaron@tenderlovemaking.com>
-
- * lib/net/smtp.rb: Net::SMTP should close the SSL connection if the
- connection verification fails.
-
-Thu Dec 23 01:47:58 2010 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
-
- * NEWS: remove #object_id. [ruby-dev:42840]
-
-Wed Dec 22 08:56:39 2010 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
-
- * NEWS: add Module#private_constant and Module#public_constant.
- [ruby-dev:39685][ruby-core:32698]
-
-Wed Dec 22 07:59:23 2010 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
-
- * NEWS: add IO#advise. [ruby-core:33110] [Ruby 1.9-Feature#4038]
-
-Tue Dec 21 23:45:31 2010 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * gc.c (Init_GC): move back object_id to Kernel. [ruby-dev:42840]
-
-Tue Dec 21 12:45:16 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * configure.in (target_archs): remove temporary objects.
-
- * enc/Makefile.in, enc/depend (clean): remove work directories.
-
-Tue Dec 21 07:39:12 2010 Tanaka Akira <akr@fsij.org>
-
- * pack.c: parenthesize macro arguments.
-
-Tue Dec 21 06:25:43 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * test/rexml/test_contrib.rb (ContribTester#test_pos): should not
- use fixed path name for tests. [ruby-dev:42827]
-
- * test/rexml/test_sax.rb (SAX2Tester#test_socket): should not use
- fixed port for tests. [ruby-dev:42828]
-
-Tue Dec 21 06:10:18 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * compile.c (setup_args), vm.c (invoke_block_from_c),
- vm_insnhelper.c (caller_setup_args): reverted r30241 and r30243
- except for the test.
-
-Tue Dec 21 01:41:42 2010 Masaya Tarui <tarui@ruby-lnag.org>
-
- * io.c : add an extra byte to buffer for the specification of read
- in Windows. see [ruby-core:33460] and r29980. and, we have to
- discuss how to do this one byte.
-
-Tue Dec 21 01:18:06 2010 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * error.c: Fix build error for win32. This regression was
- introduced by r30271.
+Sun May 12 17:08:16 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-Tue Dec 21 00:59:40 2010 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * configure.in: removes AC_CHECK_FUNCS(pause) because it's unused.
- * thread.c (thread_cleanup_func): Moved interrupted_lock
- destroying code from native_thread_destroy() to
- thread_cleanup_func() because it's platform independent logic.
+Sun May 12 17:05:18 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
- * thread_win32.c (native_thread_destroy): ditto.
- * thread_pthread.c (native_thread_destroy): ditto.
+ * signal.c (rb_f_kill): fixes typo. s/HAS_KILLPG/HAVE_KILLPG/.
-Tue Dec 21 00:46:20 2010 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+Sun May 12 17:03:27 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
- * thread.c (thread_cleanup_func): Don't touch native threading
- resource at fork. Sadly this is purely bandaid. We need to
- implement proper fix later. [Bug #4169] [ruby-core:33767]
+ * configure.in: abort if gettimeofday doesn't exist.
-Tue Dec 21 00:22:44 2010 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+Sun May 12 16:31:27 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
- * error.c (exit_success_p): Check status code more carefully.
- status code may have garbage in upper bit.
+ * 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.
-Mon Dec 20 23:12:37 2010 Tanaka Akira <akr@fsij.org>
+Sun May 12 16:03:41 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
- * node.c: parenthesize macro arguments.
+ * configure.in: removes AC_CHECK_FUNC(fseeko, fseeko64, ftello,
+ ftello64). They are not used from anywhere.
-Mon Dec 20 20:04:41 2010 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
+ * 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'.
- * NEWS: add #__id__ and #object_id. [ruby-dev:42778]
+Sun May 12 15:51:47 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-Mon Dec 20 20:03:21 2010 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * configure.in: remove AC_CHECK_FUNC(close). It is not used from
+ anywhere.
- * thread_pthread.c (native_thread_destroy): Fixed gvl_cond leak.
+Sun May 12 15:50:45 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-Mon Dec 20 13:49:05 2010 Eric Hodel <drbrain@segment7.net>
+ * configure.in: adds comments for setjmp check.
- * NEWS: Add item for RDoc 3.0.1
+Sun May 12 15:38:09 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
- * lib/rdoc: Import RDoc 3.0.1, remove require for perl parser.
+ * configure.in: move clock_gettime() check into regular place.
-Mon Dec 20 12:15:32 2010 Eric Hodel <drbrain@segment7.net>
+Wed May 8 13:45:53 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
- * lib/rdoc: Import RDoc 3.0.
+ * configure.in: add getenv() declaration check.
+ * dln_find.c: add HAVE_DECL_GETENV test.
-Mon Dec 20 01:55:03 2010 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+Sun May 12 15:33:18 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
- * io.c (Init_IO): Added O_DIRECT. This feature was proposed by
- Run Paint Run Run.
- [Feature #4015] [ruby-core:33018]
+ * configure.in: sorts AC_CHECK_FUNCS()s as alphabetical order.
-Sun Dec 19 19:15:23 2010 Tanaka Akira <akr@fsij.org>
+Wed May 8 13:41:57 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
- * marshal.c: parenthesize macro arguments.
+ * bignum.c: remove redundant decl for big_lshift() big_rshift().
-Sat Dec 18 21:52:37 2010 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
+Sun May 12 16:06:43 2013 NARUSE, Yui <naruse@ruby-lang.org>
- * vsnprintf.c (BSD_vfprintf): suppress warning: "_WIN32" is not
- defined.
-
-Sat Dec 18 16:02:27 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * compile.c (setup_args), vm.c (invoke_block_from_c),
- vm_insnhelper.c (caller_setup_args): fix of r30241. lambda block
- should check argument number.
+ * ext/socket/rubysocket.h (rsock_inspect_sockaddr): as r40646
+ check HAVE_TYPE_STRUCT_SOCKADDR_DL.
-Sat Dec 18 14:42:29 2010 Tanaka Akira <akr@fsij.org>
+Sat May 11 23:01:58 2013 NARUSE, Yui <naruse@ruby-lang.org>
- * load.c: parenthesize macro arguments.
+ * 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 Dec 18 10:07:04 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Sat May 11 22:07:42 2013 Tanaka Akira <akr@fsij.org>
- * compile.c (setup_args, iseq_compile_each): optimize AMPER LAMBDA
- combination as block.
+ * test/rinda/test_rinda.rb: Socket.getifaddrs may returns an interface
+ which #addr method returns nil for venet0 in OpenVZ.
-Fri Dec 17 22:07:16 2010 Yukihiro Matsumoto <matz@ruby-lang.org>
+Sat May 11 21:56:34 2013 Tanaka Akira <akr@fsij.org>
- * gc.c (Init_GC): move #__id__ and #object_id to BasicObject.
- [ruby-dev:42778]
+ * ext/socket/raddrinfo.c (rsock_inspect_sockaddr): Add casts to
+ suppress warnings.
-Fri Dec 17 19:35:13 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Sat May 11 17:28:51 2013 Tanaka Akira <akr@fsij.org>
- * test/mkmf/base.rb (TestMkmf::FakeLog): capture output from mkmf.
+ * ext/socket: New method, Socket.getifaddrs, implemented.
+ [ruby-core:54777] [Feature #8368]
- * test/mkmf/test_find_executable.rb (test_find_executable):
- suppress meaningless differences for chkbuild.
+Sat May 11 00:47:22 2013 Tanaka Akira <akr@fsij.org>
-Fri Dec 17 13:26:54 2010 NAKAMURA Usaku <usa@ruby-lang.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/
- * win32/setup.mak (BASERUBY): quit with an error when BASERUBY was not
- able to set, just like configure.in does. [ruby-dev:42782]
+Fri May 10 23:56:34 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Fri Dec 17 07:04:09 2010 Tanaka Akira <akr@fsij.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]
- * iseq.c: parenthesize macro arguments.
+Fri May 10 20:22:40 2013 Tanaka Akira <akr@fsij.org>
-Fri Dec 17 04:18:37 2010 Eric Hodel <drbrain@segment7.net>
+ * configure.in: Move library checks into "Checks for libraries." part.
- * transcode.c (str_encode): Alter comment for better wording and ri
- output.
+Fri May 10 19:32:01 2013 Tanaka Akira <akr@fsij.org>
-Fri Dec 17 00:05:40 2010 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * configure.in: Reformat arguments of AC_CHECK_HEADERS and
+ AC_CHECK_FUNCS to track modifications easily.
- * io.c (rb_io_advise): New API. IO#advise() allows to tell the
- ruby runtime how it expects to use a file handle. This feature
- can be improved a performance some situations.
- Note: This feature is mainly developed by Run Paint Run Run.
- Thank you! [ruby-core:33110] [Ruby 1.9-Feature#4038]
+Fri May 10 12:01:36 2013 Tanaka Akira <akr@fsij.org>
- * io.c (do_io_advise): Helper function.
- * io.c (io_advise_sym_to_const): ditto.
+ * 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 Dec 16 23:29:20 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Thu May 9 22:00:35 2013 Tanaka Akira <akr@fsij.org>
- * tool/rbinstall.rb (bin-comm): use transformed name.
- [ruby-dev:42777]
+ * ext/socket/ancdata.c (bsock_sendmsg_internal): controls_num should
+ not be negative.
-Thu Dec 16 21:52:07 2010 Tanaka Akira <akr@fsij.org>
+Thu May 9 21:09:57 2013 Tanaka Akira <akr@fsij.org>
- * io.c: parenthesize macro arguments.
+ * 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 Dec 16 21:46:39 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Thu May 9 20:43:41 2013 Tanaka Akira <akr@fsij.org>
- * tool/mkconfig.rb (RbConfig): honor ARCHFLAGS and RC_ARCHS to
- override embedded ARCH_FLAG value on universal-darwin.
+ * 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 Dec 16 19:50:12 2010 NAKAMURA Usaku <usa@ruby-lang.org>
+Thu May 9 12:06:07 2013 Tanaka Akira <akr@fsij.org>
- * win32/{configure.bat,setup.mak,Makefile.sub} (PROGRAM_PREFIX,
- PROGRAM_SUFFIX): unite the differences of the names of macros of
- prefix and suffix.
- reported by HANEDA Norikatsu. [ruby-dev:42775]
+ * 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 Dec 16 08:04:47 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Thu May 9 11:30:02 2013 Zachary Scott <zachary@zacharyscott.net>
- * node.h (RNode): match the type of flags to RBasic, and renamed
- nd_file as nd_reserved.
+ * string.c: Add call-seq alias for String#=== [Bug #8381]
- * iseq.c (set_relation), vm_insnhelper.c (vm_cref_push): nd_file
- is always zero-cleared.
+Thu May 9 11:14:18 2013 Zachary Scott <zachary@zacharyscott.net>
-Thu Dec 16 07:22:30 2010 Ryan Davis <ryand-ruby@zenspider.com>
+ * doc/contributing.rdoc: Add guide for contributing to CRuby
- * lib/minitest/unit.rb: Imported minitest 2.0.1 r6079.
+Thu May 9 04:55:49 2013 Tanaka Akira <akr@fsij.org>
-Wed Dec 15 20:45:02 2010 NAKAMURA Usaku <usa@ruby-lang.org>
+ * configure.in: Check socket library again. shutdown() is used in
+ io.c.
- * lib/test/unit.rb (process_args): need to setup @help to print options.
+Thu May 9 01:52:31 2013 Tanaka Akira <akr@fsij.org>
-Wed Dec 15 11:19:33 2010 NAKAMURA Usaku <usa@ruby-lang.org>
+ * configure.in: Don't check socketpair. socketpair is not used in
+ ruby command itself.
- * test/zlib/test_zlib.rb (test_to_io): forgotten to fix with r30201.
+Thu May 9 01:05:41 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Wed Dec 15 11:07:34 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * class.c (rb_mod_included_modules): should not include non-modules.
+ [ruby-core:53158] [Bug #8025]
- * io.c (simple_sendfile): enable on Mac OS X.
+Wed May 8 22:46:59 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * io.c (nogvl_copy_stream_sendfile): moved precheck of copy length.
+ * class.c (rb_mod_included_modules): should not include the original
+ module itself. [ruby-core:53158] [Bug #8025]
- * io.c (nogvl_copy_stream_sendfile): should wait for both of
- read/write fds.
+Wed May 8 17:43:55 2013 NARUSE, Yui <naruse@ruby-lang.org>
-Wed Dec 15 07:11:55 2010 Tanaka Akira <akr@fsij.org>
+ * io.c (rb_io_ext_int_to_encs): ignore internal encoding if external
+ encoding is ASCII-8BIT. [Bug #8342]
- * hash.c: parenthesize macro arguments.
+Wed May 8 13:49:38 2013 NARUSE, Yui <naruse@ruby-lang.org>
-Wed Dec 15 04:02:00 2010 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * ext/json/generator/generator.c (isArrayOrObject): cast char to
+ unsigned char. [Bug #8378]
- * ext/openssl/ossl_x509ext.c (ossl_x509extfactory_set_config):
- fix compile error when !HAVE_X509V3_SET_NCONF. Thanks
- Chikanaga-san. [ruby-dev:42761] [Ruby 1.9-Bug#4158]
+Wed May 8 13:46:10 2013 NARUSE, Yui <naruse@ruby-lang.org>
-Wed Dec 15 03:41:31 2010 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * ext/json/generator/depend: fix dependencies [Bug #8379]
- * test/ripper/test_parser_events.rb (TestRipper#test_block_variables):
- Limit address space 100MB instead 100KB. Quite frankly, This
- margin is too narrow to contain ruby. [ruby-dev:42763] [Bug#4159]
+ * ext/json/parser/depend: ditto.
-Tue Dec 14 23:53:52 2010 NARUSE, Yui <naruse@ruby-lang.org>
+Wed May 8 13:07:17 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * io.c (simple_sendfile): improve linux compatibility on FreeBSD,
- and now it works. But without cpuset -l 0, it still gets stuck.
+ * parse.y (parser_yylex): fail if $, @, @@ are not followed by a valid
+ name character. [ruby-core:54846] [Bug #8375].
-Tue Dec 14 20:31:33 2010 Tanaka Akira <akr@fsij.org>
+Wed May 8 13:06:31 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * gc.c: parenthesize macro arguments.
+ * include/ruby/ruby.h (ISGRAPH): add missing macro.
-Tue Dec 14 18:31:48 2010 NAKAMURA Usaku <usa@ruby-lang.org>
+Wed May 8 06:42:56 2013 NARUSE, Yui <naruse@ruby-lang.org>
- * lib/test/unit.rb: help messages.
-
-Tue Dec 14 18:19:03 2010 NAKAMURA Usaku <usa@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().
- * common.mk (help): there is no reason to use the abbreviation for here.
+Tue May 7 22:12:34 2013 Tanaka Akira <akr@fsij.org>
-Tue Dec 14 15:03:46 2010 NAKAMURA Usaku <usa@ruby-lang.org>
+ * ext/readline/readline.c (insert_ignore_escape): Add a cast to
+ unsigned char * before dereference.
+ This suppress a warning on Cygwin.
- * test/ruby/test_io.rb (test_reopen, test_reinitialize): should close
- the temporary files.
+Tue May 7 12:15:24 2013 Tanaka Akira <akr@fsij.org>
-Tue Dec 14 14:24:15 2010 NAKAMURA Usaku <usa@ruby-lang.org>
+ * ext/socket/ancdata.c (bsock_recvmsg_internal): Add a cast to
+ suppress warning.
+ Bionic defines socklen_t as int.
+ Bionic defines msg_controllen as unsigned int (__kernel_size_t)
+ instead of socklen_t as POSIX.
- * test/ruby/test_io.rb (make_tempfile): change the prefix from 'foo'
- to 'test_io' because the old one is meaningless and inconvenient.
+Tue May 7 12:12:42 2013 Tanaka Akira <akr@fsij.org>
- * test/ruby/test_io.rb (test_binmode_after_closed): the temporary file
- maked by make_temfile is already closed.
+ * 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 Dec 14 13:52:19 2010 NAKAMURA Usaku <usa@ruby-lang.org>
+Tue May 7 12:10:52 2013 Tanaka Akira <akr@fsij.org>
- * test/ruby/test_io.rb (test_flush_in_finalizer[12]): should close
- temporary file because it's only used for taking pathname and
- unlinking the file after the end of the test (in GC phase).
+ * ext/socket/socket.c (socket_s_ip_address_list): Cast EXTRA_SPACE as
+ int. This suppress a warning.
-Tue Dec 14 13:34:33 2010 NAKAMURA Usaku <usa@ruby-lang.org>
+Tue May 7 12:09:29 2013 Tanaka Akira <akr@fsij.org>
- * ext/zlib/zlib.c (gzfile_s_open): should close the IO if some error
- occurs in initializing.
+ * 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 Dec 14 13:04:16 2010 NARUSE, Yui <naruse@ruby-lang.org>
+Tue May 7 12:07:35 2013 Tanaka Akira <akr@fsij.org>
- * lib/net/http.rb (Net::HTTPRequest#send_request_body_data):
- set binmode to tempfile.
+ * pack.c (swap32): Don't redefine it if it is already defined.
+ Bionic defines it.
+ (swap64): Ditto.
-Tue Dec 14 12:55:46 2010 NAKAMURA Usaku <usa@ruby-lang.org>
+Mon May 6 20:50:37 2013 Tanaka Akira <akr@fsij.org>
- * test/zlib/test_zlib.rb (*): should close files associated with zlib.
+ * 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.
-Tue Dec 14 11:30:17 2010 NAKAMURA Usaku <usa@ruby-lang.org>
+Sun May 5 18:56:52 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * test/ruby/test_argf.rb (test_inplace_rename_impossible): unlink
- the renamed temporary file on no_safe_rename platforms.
+ * insns.def (defined): use vm_search_superclass() like as normal super
+ call. based on a patch <https://gist.github.com/wanabe/5520026> by
+ wanabe.
- * test/ruby/test_argf.rb (test_readlines_limit_0,
- test_each_line_limit_0): should close argf because the associated
- Tempfile object cannot unlink the temporary file when it's gc'ed
- on some platforms (Windows, etc.)
+ * vm_insnhelper.c (vm_search_superclass): return error but not raise
+ exceptions.
-Tue Dec 14 11:27:07 2010 NARUSE, Yui <naruse@ruby-lang.org>
+ * vm_insnhelper.c (vm_search_super_method): check the result of
+ vm_search_superclass and raise exceptions on error.
- * lib/minitest/unit.rb (Minitest::Unit#_run_suite): split test
- name and its time. Thiw allows to know test's name when you are
- running tests and meet a test which spends long time at realtime.
+Sun May 5 16:29:41 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Tue Dec 14 11:25:20 2010 NARUSE, Yui <naruse@ruby-lang.org>
+ * insns.def (defined): get method entry from the method top level
+ frame, not block frame. [ruby-core:54769] [Bug #8367]
- * configure.in: Add -Werror=declaration-after-statement to default
- warning flag. If you are using GCC, this flag is useful to
- prevent breaking VC build.
+Sun May 5 13:28:54 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Tue Dec 14 10:25:57 2010 NAKAMURA Usaku <usa@ruby-lang.org>
+ * template/ruby.pc.in (Cflags): use rubyarchhdrdir for multiarch.
+ [Bug #7874]
- * ext/openssl/ossl_asn1.c (ossl_asn1_decode0): how many gcc-c99isms
- must a man mend; before he can build with VC? r30178
+Sat May 4 07:20:00 2013 Zachary Scott <zachary@zacharyscott.net>
-Mon Dec 13 21:26:33 2010 NARUSE, Yui <naruse@ruby-lang.org>
+ * doc/security.rdoc: Add note about reporting security vulns
- * io.c (simple_sendfile): disable the use of sendfile(2) on
- FreeBSD. It blocks on TestIO#test_copy_stream_socket.
+Sat May 4 04:13:27 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-Mon Dec 13 18:35:33 2010 NARUSE, Yui <naruse@ruby-lang.org>
+ * include/ruby/defines.h (RUBY_ATTR_ALLOC_SIZE): New for
+ attribute((alloc_size(params))).
- * io.c: define USE_SENDFILE on FreeBSD or DragonFly BSD.
- Remove Mac OS X because its argument is different from them.
+ * include/ruby/defines.h (xmalloc, xmalloc2, xcalloc)
+ (xrealloc, xrealloc2): Annotated by RUBY_ATTR_ALLOC_SIZE.
+ * include/ruby/ruby.h (rb_alloc_tmp_buffer): ditto.
-Mon Dec 13 12:00:09 2010 Tanaka Akira <akr@fsij.org>
+Fri May 3 19:32:13 2013 Takeyuki FUJIOKA <xibbar@ruby-lang.org>
- * file.c: parenthesize macro arguments.
+ * lib/cgi/util.rb: All class methods modulized.
+ We can use these methods like a function when "include CGI::Util".
+ [Feature #8354]
-Mon Dec 13 11:21:14 2010 NARUSE, Yui <naruse@ruby-lang.org>
+Fri May 3 14:09:45 2013 Tanaka Akira <akr@fsij.org>
- * io.c (simple_sendfile): added for BSD version of sendfile(2).
+ * 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
-Mon Dec 13 09:50:09 2010 NARUSE, Yui <naruse@ruby-lang.org>
+Fri May 3 13:35:26 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * lib/net/http.rb (Net::HTTPRequest#set_form): Added to support
- both application/x-www-form-urlencoded and multipart/form-data.
- There is a similar API, Net::HTTPRequest#set_form_data, but
- to keep its compatibility this is newly added. [ruby-dev:42729]
+ * ext/socket/{getaddrinfo,getnameinfo}.c: define socklen_t if not
+ defined, e.g., older VC.
-Sun Dec 12 23:45:27 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Fri May 3 13:29:11 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * compile.c (iseq_compile_each): fix for __goto__ and __label__
- where were totally broken.
+ * 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.
-Sun Dec 12 22:45:43 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Fri May 3 13:22:12 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * common.mk (ID_H_INCLUDES): now id.h depends on vm_opts.h.
+ * win32/win32.c (poll_child_status): fix build error on older mingw.
-Sun Dec 12 20:42:47 2010 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
+Fri May 3 00:15:58 2013 Ayumu AIZAWA <ayumu.aizawa@gmail.com>
- * template/id.h.tmpl: suppress all warning: "SUPPORT_JOKE" is not
- defined. [ruby-dev:42730]
+ * common.mk: remove timestamps in distclean-ext realclean-ext.
-Sun Dec 12 20:35:07 2010 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
+Thu May 2 23:23:49 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * misc/rb_optparse.zsh: update how to install.
+ * object.c (rb_obj_is_kind_of): skip prepending modules.
+ [ruby-core:54742] [Bug #8357]
- * misc/rb_optparse.zsh: avoid error when setopt noclobber.
+ * object.c (rb_class_inherited_p): ditto.
+ [ruby-core:54736] [Bug #8357]
- * lib/optparse.rb: fix typo. pointed out at
- <http://d.hatena.ne.jp/nagachika/20101207>.
+Thu May 2 22:11:47 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Sun Dec 12 13:27:35 2010 Tanaka Akira <akr@fsij.org>
+ * bin/irb: remove dead code from sample/irb.rb.
- * eval_error.c: parenthesize macro arguments.
+Thu May 2 17:32:45 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Sun Dec 12 11:53:24 2010 Tanaka Akira <akr@fsij.org>
+ * marshal.c (copy_ivar_i): get rid of overwriting already copied
+ instance variables. c.f. [Bug #8276]
- * error.c: parenthesize macro arguments.
+Thu May 2 16:55:43 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Sun Dec 12 04:01:58 2010 NARUSE, Yui <naruse@ruby-lang.org>
+ * thread.c (id_locals): use cached ID.
- * string.c (rb_str_inspect): fix: extra back slash is added when
- the string is dummy encoding and includes \x22 or \x5C.
+ * vm.c (ruby_thread_init): ditto.
-Sun Dec 12 02:42:24 2010 Aaron Patterson <aaron@tenderlovemaking.com>
+ * defs/id.def: add more predefined IDs used in core.
- * ext/openssl/ossl_asn1.c: indefinite length BER to DER encoding is
- properly supported. Thanks Martin Bosslet! [ruby-core:33082]
+Thu May 2 13:42:42 2013 Ryan Davis <ryand-ruby@zenspider.com>
-Sat Dec 11 17:43:34 2010 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
+ * lib/minitest/*: Imported minitest 4.7.4 (r8483)
+ * test/minitest/*: ditto
- * ext/bigdecimal/bigdecimal.h: suppress "warning: 'VPrint' declared
- 'static' but never defined".
+Thu May 2 11:32:22 2013 NAKAMURA Usaku <usa@ruby-lang.org>
-Sat Dec 11 09:24:57 2010 Tanaka Akira <akr@fsij.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.
- * encoding.c: parenthesize macro arguments.
+ * test/ruby/test_process.rb (TestProcess#test_no_curdir): maybe now
+ we can test it.
-Sat Dec 11 08:12:48 2010 Eric Hodel <drbrain@segment7.net>
+ * test/ruby/test_thread.rb (TestThread#test_thread_timer_and_interrupt):
+ ditto.
- * ext/openssl/ossl.c, ext/openssl/ossl_pkey_rsa.c: Document RSA, RSA
- encryption/decryption and PKCS #5 encryption/decryption.
+Thu May 2 11:24:00 2013 Zachary Scott <zachary@zacharyscott.net>
-Sat Dec 11 06:23:41 2010 Eric Hodel <drbrain@segment7.net>
+ * lib/yaml.rb: nodoc EngineManager, add History doc #8344
- * ext/openssl/ossl_x509name.c: include Comparable to provide #==.
- Document OpenSSL::X509::Name#<=>. [Ruby 1.9-Feature#4116]
+Wed May 1 21:11:17 2013 Tanaka Akira <akr@fsij.org>
-Sat Dec 11 05:48:28 2010 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
+ * time.c (localtime_with_gmtoff_zone): musl libc may return NULL for
+ tm_zone.
- * ext/tk/lib/multi-tk.rb: infinite loop on method_missing at loading.
- [ruby-dev:42716] [Ruby 1.9-Bug#4129]
+Wed May 1 18:59:36 2013 Benoit Daloze <eregontp@gmail.com>
- * ext/tk/lib/multi-tk.rb: when no eventloop is running, ruby freezes at
- exit.
+ * enum.c (Enumerable#chunk): fix grammar of error message
+ for symbols beginning with an underscore [Bug #8351]
-Sat Dec 11 02:23:15 2010 Aaron Patterson <aaron@tenderlovemaking.com>
+Wed May 1 16:47:47 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * ext/openssl/extconf.rb: try pkgconfig first, then fall back to
- normal have_library, etc. Thanks Erik Hollensbe. [ruby-core:32406]
+ * ext/curses/extconf.rb (curses_version): try once for each tests, a
+ function or a variable. fallback to variable for old SVR4.
-Fri Dec 10 22:33:39 2010 Tanaka Akira <akr@fsij.org>
+Wed May 1 16:17:46 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * dln_find.c: parenthesize macro arguments.
+ * ext/extmk.rb (extmake): extensions not to be installed should not
+ make static libraries, but make dynamic libraries always.
-Fri Dec 10 20:05:42 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Wed May 1 12:20:00 2013 Zachary Scott <zachary@zacharyscott.net>
- * template/id.h.tmpl (ruby_method_ids): suppress warnings.
- [ruby-dev:42730]
+ * lib/rake/version.rb: Fix RDoc warning with :include: [Bug #8347]
-Fri Dec 10 18:29:20 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Wed May 1 11:40:25 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * ruby.c (ruby_init_loadpath_safe): relatively called non-shared
- binary cannot be found in PATH, so use given pathname.
+ * defs/id.def (predefined): add "idProc".
-Fri Dec 10 18:28:40 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * eval.c (frame_func_id): use predefined IDs.
- * cygwin/GNUmakefile.in (SCRIPTPROGRAMS): ignore backup files and etc.
+ * proc.c (mnew, mproc, mlambda): use predefined IDs.
- * cygwin/GNUmakefile.in (scriptbin): set executable bit.
+ * vm.c (rb_vm_control_frame_id_and_class): ditto.
- * tool/rbinstall.rb (install_recursive): always skip default ignored
- files. if block is given, call it instead of calling install.
+ * vm.c (Init_VM): ditto.
- * tool/rbinstall.rb (bin-comm): use install_recursive.
+Tue Apr 30 23:18:00 2013 Zachary Scott <zachary@zacharyscott.net>
-Fri Dec 10 18:12:31 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * lib/benchmark.rb: Update Benchmark results on newer CPU
- * test/mkmf/base.rb (TestMkmf#config_value): extract macro value from
- config.h.
+Tue Apr 30 12:31:40 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * test/mkmf/test_sizeof.rb (TestMkmf::TestSizeof#test_sizeof_builtin),
- (TestMkmf::TestSizeof#test_sizeof_struct): more tests.
+ * proc.c (mproc, mlambda): use frozen core methods instead of plain
+ global methods, so that methods cannot be overridden.
+ [ruby-core:54687] [Bug #8345]
- * lib/mkmf.rb (check_signedness): should use the prelude code.
- [ruby-dev:42731]
+ * vm.c (Init_VM): define proc and lambda on the frozen core object.
- * lib/mkmf.rb (Logging.log_close): separate from Logging.logfile.
+ * include/ruby/intern.h (rb_block_lambda): add declaration instead of
+ deprecated rb_f_lambda.
- * test/mkmf/base.rb (TestMkmf::MKMFLOG): show mkmf.log at failures.
+Mon Apr 29 17:02:30 2013 NARUSE, Yui <naruse@ruby-lang.org>
- * test/mkmf/base.rb (TestMkmf#teardown): close log file for each tests.
+ * ext/nkf/nkf-utf8/nkf.h: Bionic libc doesn't have locale.
+ [Feature #8338]
-Fri Dec 10 11:36:43 2010 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
- * compile.c (enum): remove a comma at end of enumerator list.
+Mon Apr 29 06:58:30 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * constant.h (rb_const_flag_t): ditto.
+ * ext/openssl/ossl_bn.c (ossl_bn_initialize): no need of alloca for
+ small fixed size array.
- * iseq.h (enum catch_type): ditto.
+ * ext/openssl/ossl_bn.c (ossl_bn_initialize): check overflow first,
+ and use alloca for small size input.
- * iseq.h (enum defined_type): ditto.
+Mon Apr 29 00:40:13 2013 Benoit Daloze <eregontp@gmail.com>
- * vm_core.h (enum iseq_type): ditto.
+ * lib/yaml.rb: Clarify documentation about YAML being always Psych.
+ Give a tip about using Syck. See #8344.
- * vm_core.h (enum vm_special_object_type): ditto.
+Sun Apr 28 23:34:01 2013 Benoit Daloze <eregontp@gmail.com>
-Fri Dec 10 10:47:53 2010 NARUSE, Yui <naruse@ruby-lang.org>
+ * lib/yaml.rb: Use another trick to define the YAML module.
+ https://twitter.com/n0kada/status/328342207511801856
- * sprintf.c (_HAVE_SANE_QUAD_): Don't forget LP64, r30156.
+Sun Apr 28 23:19:00 2013 Zachary Scott <zachary@zacharyscott.net>
-Fri Dec 10 10:37:17 2010 NAKAMURA Usaku <usa@ruby-lang.org>
+ * lib/pp.rb: Update PP module overview by @geopet
- * sprintf.c (_HAVE_SANE_QUAD_): if a certain platform has LONG_LONG in
- 8 byte, it might be sane quad. [ruby-core:33634]
+Sun Apr 28 22:04:37 2013 Hiroshi Shirosaki <h.shirosaki@gmail.com>
-Fri Dec 10 10:07:59 2010 NARUSE, Yui <naruse@ruby-lang.org>
+ * 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]
- * lib/net/http.rb: remove version 1.1 features.
+Sun Apr 28 12:38:04 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Fri Dec 10 02:18:02 2010 Aaron Patterson <aaron@tenderlovemaking.com>
+ * README.EXT: correct method name to be used. [Bug #7982]
- * ext/openssl/ossl_x509store.c (ossl_x509stctx_cleanup): removing C
- implementation of `cleanup`.
+ * README.EXT.ja: add notes too.
- * ext/openssl/lib/openssl/x509.rb: adding ruby implementation of
- `cleanup`. OpenSSL::X509::StoreContext#cleanup is deprecated since
- reusing the underlying struct doesn't make sense. [ruby-dev:42546]
+Sun Apr 28 10:35:00 2013 Zachary Scott <zachary@zacharyscott.net>
-Thu Dec 9 20:14:39 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * object.c: With feedback from Steve Klabnik, reverted a change to
+ #untrusted? and #tainted?. Also adjusted grammar for $SAFE levels
- * parse.y (lvar_defined_gen, shadowing_lvar_gen, dvar_defined): no
- warnings for unused method and block arguments.
- [ruby-dev:42718] [ruby-dev:42724]
+Sun Apr 28 10:10:00 2013 Zachary Scott <zachary@zacharyscott.net>
-Thu Dec 9 19:25:49 2010 Tanaka Akira <akr@fsij.org>
+ * lib/yaml.rb: Disable setting YAML const twice [ruby-core:54642]
- * dln.c: parenthesize macro arguments.
+Sun Apr 28 09:50:00 2013 Zachary Scott <zachary@zacharyscott.net>
-Thu Dec 9 18:51:06 2010 Tanaka Akira <akr@fsij.org>
+ * object.c: Documentation for taint and trust [Bug #8162]
- * lib/webrick/accesslog.rb (WEBrick::AccessLog#format): support
- %{remote}p for logging remote (client) port number.
- [ruby-dev:42670]
+Sun Apr 28 09:40:00 2013 Zachary Scott <zachary@zacharyscott.net>
-Thu Dec 9 11:00:30 2010 Yukihiro Matsumoto <matz@ruby-lang.org>
+ * README.EXT: Copy note from r40505 for rb_sprintf() [Bug #7982]
- * array.c (rb_ary_dup): should copy contents only. no instance
- variable, no class would be copied. it would affect methods
- #sort, #reject, #transpose, #uniq, #compact, and #shuffle.
- [ruby-core:33640]
+Sun Apr 28 08:28:00 2013 Zachary Scott <zachary@zacharyscott.net>
- * array.c (rb_ary_reverse_m): ditto.
+ * ext/curses/curses.c: Update Curses::Window example for nicer output
+ Patch by Michal Suchanek [Bug #8121] [ruby-core:53520]
- * array.c (rb_ary_rotate_m): ditto.
+Sun Apr 28 08:10:00 2013 Zachary Scott <zachary@zacharyscott.net>
-Wed Dec 8 21:38:40 2010 NARUSE, Yui <naruse@ruby-lang.org>
+ * README.EXT: Update note from r40504, by Jeremy Evans [Bug #7982]
- * ext/dl/lib/dl/struct.rb: clean a warning: assigned but unused
- variable. patched by Kouhei Yanagita. [ruby-dev:42722]
+Sun Apr 28 08:02:00 2013 Zachary Scott <zachary@zacharyscott.net>
- * ext/dl/lib/dl/import.rb: ditto.
+ * README.EXT: Add note to warn use of %i in Exceptions [Bug #7982]
-Wed Dec 8 21:36:16 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Sun Apr 28 02:41:05 2013 Tanaka Akira <akr@fsij.org>
- * parse.y (shadowing_lvar_gen): fix line number. [ruby-dev:42718]
+ * configure.in: Fix a typo. Should check endgrent() instead of
+ endgrnam().
-Wed Dec 8 20:37:11 2010 Tanaka Akira <akr@fsij.org>
+Sun Apr 28 00:35:45 2013 Tanaka Akira <akr@fsij.org>
- * dir.c: parenthesize macro arguments.
+ * process.c (obj2gid): Don't call endgrent() if not exist.
+ Bionic (Android's libc) don't have endgrent().
-Tue Dec 7 22:37:15 2010 Masaya Tarui <tarui@ruby-lnag.org>
+ * configure.in: Check endgrnam function.
- * io.c (io_read): duplicate string if shared. [ruby-dev:42719]
+Sat Apr 27 23:53:00 2013 Charlie Somerville <charlie@charliesomerville.com>
-Tue Dec 7 22:31:08 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * lib/yaml.rb: add security warning to YAML documentation
- * lib/optparse.rb (OptionParser::Officious): separate completion
- options from --help. [ruby-dev:42690]
+Sat Apr 27 23:25:00 2013 Zachary Scott <zachary@zacharyscott.net>
- * lib/optparse.rb (OptionParser::Completion#candidate),
- (OptionParser::Switch#compsys): remove unused variables.
+ * lib/yaml.rb: Documentation for YAML module [Bug #8213]
-Tue Dec 7 22:05:25 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Sat Apr 27 20:19:21 2013 Tanaka Akira <akr@fsij.org>
- * transcode.c (transcode_loop): call default handler of the given
- hash, method, proc or [] method as fallback. [ruby-dev:42692]
+ * thread_pthread.c (ruby_init_stack): Add STACK_GROW_DIR_DETECTION.
+ This fixes a compilation failure while cross-compiling for Tensilica
+ Xtensa Processor.
-Tue Dec 7 21:59:37 2010 Kouhei Sutou <kou@cozmixng.org>
+Sat Apr 27 19:32:44 2013 Benoit Daloze <eregontp@gmail.com>
- * lib/rexml/light/node.rb: remove circular require.
+ * thread.c: fix typos and documentation
-Tue Dec 7 21:56:01 2010 Kouhei Sutou <kou@cozmixng.org>
+Sat Apr 27 19:04:55 2013 Tanaka Akira <akr@fsij.org>
- * test/rexml/test_light.rb: really suppress a warning.
+ * 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
-Tue Dec 7 21:51:57 2010 Kouhei Sutou <kou@cozmixng.org>
+Sat Apr 27 17:22:50 2013 Tanaka Akira <akr@fsij.org>
- * test/rexml/test_light.rb: suppress a warning.
+ * ext/socket/extconf.rb: Redundant test removed.
-Tue Dec 7 21:14:03 2010 Tanaka Akira <akr@fsij.org>
+Sat Apr 27 16:00:10 2013 Tanaka Akira <akr@fsij.org>
- * debug.c: parenthesize macro arguments.
+ * ext/socket/extconf.rb (test_recvmsg_with_msg_peek_creates_fds):
+ Extracted.
-Tue Dec 7 21:06:38 2010 Kouhei Sutou <kou@cozmixng.org>
+Sat Apr 27 15:50:40 2013 Tanaka Akira <akr@fsij.org>
- * lib/rexml/doctype.rb, test/rexml/test_doctype.rb: suppress warnings.
- [ruby-core:33305]
- Reported by Aaron Patterson. Thanks!!!
+ * 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.
-Tue Dec 7 18:56:52 2010 NARUSE, Yui <naruse@ruby-lang.org>
+ * thread.c (TIMEVAL_SEC_MAX): Use SIGNED_INTEGER_MAX.
+ (TIMEVAL_SEC_MIN): Use SIGNED_INTEGER_MIN.
- * ext/nkf/lib/kconv.rb (String#kconv): fix typo and update rdoc.
- patched by Kouhei Yanagita [ruby-dev:42696]
+Sat Apr 27 10:52:52 2013 Tanaka Akira <akr@fsij.org>
-Tue Dec 7 20:32:11 2010 Kouhei Sutou <kou@cozmixng.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).
- * test/rexml/test_doctype.rb: add Accessor to test case name.
+Fri Apr 26 23:34:59 2013 Kouhei Sutou <kou@cozmixng.org>
-Tue Dec 7 20:31:02 2010 Kouhei Sutou <kou@clear-code.com>
+ * 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.
- * test/rexml/test_doctype.rb: Doctype -> DocType.
+Fri Apr 26 22:53:55 2013 Kouhei Sutou <kou@cozmixng.org>
-Tue Dec 7 20:29:23 2010 Kouhei Sutou <kou@clear-code.com>
+ * 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.
- * test/rexml/test_doctype_mixin.rb: rename to ...
- * test/rexml/test_doctype.rb: ... this to remove needless name.
+Fri Apr 26 21:48:29 2013 Kouhei Sutou <kou@cozmixng.org>
-Tue Dec 7 17:03:16 2010 Shugo Maeda <shugo@ruby-lang.org>
+ * lib/rss/atom.rb (RSS::Atom::Entry): Fix indent of document comment.
- * lib/net/imap.rb (xlist): supported the XLIST command, which is an
- extension by Apple and Google. patch by Geoff Youngs.
- [ruby-core:33521]
+Fri Apr 26 21:21:17 2013 Kouhei Sutou <kou@cozmixng.org>
-Tue Dec 7 08:00:44 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * lib/rss/maker.rb (RSS::Maker): Fix indent of document comment.
- * configure.in, win32/Makefile.sub (WERRORFLAG): flag to treat
- warnings as errors.
+Fri Apr 26 18:41:04 2013 Tanaka Akira <akr@fsij.org>
- * lib/mkmf.rb (Logging.postpone): yield log file object.
+ * ext/socket/extconf.rb: Use a block of enable_config() for
+ --{enable,disable}-close-fds-by-recvmsg-with-peek configure option
- * lib/mkmf.rb (xsystem): add options, :werror only right now.
+Fri Apr 26 18:08:08 2013 Tanaka Akira <akr@fsij.org>
- * lib/mkmf.rb (with_werror): check as if warnings are errors.
+ * dir.c (dir_set_pos): Fix a compilation error when seekdir() is not
+ exist.
- * lib/mkmf.rb (convertible_int): make declaration conflict
- warnings errors not to pass wrong type. [ruby-dev:42684]
+Fri Apr 26 17:41:17 2013 Tanaka Akira <akr@fsij.org>
- * lib/mkmf.rb (COMMON_MACROS): get rid of conflicts.
+ * thread_pthread.c (ruby_init_stack): Add STACK_GROW_DIR_DETECTION.
+ This fixes a compilation failure while cross-compiling for ARM.
- * win32/Makefile.sub (WARNFLAGS): make declaration conflict
- warnings errors if possible.
+Fri Apr 26 14:35:00 2013 Zachary Scott <zachary@zacharyscott.net>
-Sun Dec 7 21:16:10 2010 Tanaka Akira <akr@fsij.org>
+ * 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
- * cont.c: parenthesize macro arguments.
+Fri Apr 26 12:41:22 2013 Tanaka Akira <akr@fsij.org>
-Tue Dec 7 00:27:14 2010 Masaya Tarui <tarui@ruby-lnag.org>
+ * ext/curses/extconf.rb: Test linkability of curses_version at first.
- * win32/win32.c (rb_w32_read): fixed more for readline,
- and so on. [ruby-core:33511]
+ * 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.
-Mon Dec 6 23:18:22 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Fri Apr 26 00:07:52 2013 Hiroshi Shirosaki <h.shirosaki@gmail.com>
- * test/mkmf/base.rb (TestMkmf#setup): run quietly.
+ * lib/rinda/ring.rb (Rinda::RingServer#initialize): accept array
+ arguments of address to specify multicast interface.
- * test/mkmf/test_find_executable.rb (test_find_executable): use
- configured results.
+ * lib/rinda/ring.rb (Rinda::RingServer#make_socket): add optional
+ arguments for multicast interface.
- * common.mk (test-build): test for build process.
+ * test/rinda/test_rinda.rb
+ (TestRingFinger#test_ring_server_ipv4_multicast,
+ TestRingFinger#test_ring_server_ipv6_multicast): add tests for
+ above change.
-Mon Dec 6 22:47:15 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * 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]
- * lib/optparse.rb (OptionParser#candidate): skip separators.
+Thu Apr 25 23:45:02 2013 Hiroshi Shirosaki <h.shirosaki@gmail.com>
- * sample/optparse/opttest.rb: should not override --help.
- [ruby-dev:42690]
+ * 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.
-Mon Dec 6 19:00:48 2010 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
+ * lib/rinda/ring.rb (Rinda::RingServer#make_socket): ditto.
- * misc/rb_optparse.zsh: fix typos.
+Thu Apr 25 23:39:42 2013 Hiroshi Shirosaki <h.shirosaki@gmail.com>
-Mon Dec 6 18:59:04 2010 Kazuhiro NISHIYAMA <zn@mbf.nifty.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.
- * NEWS: add new encodings.
+Thu Apr 25 23:16:28 2013 Tanaka Akira <akr@fsij.org>
-Mon Dec 6 18:56:42 2010 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
+ * ext/curses/extconf.rb: Implement
+ --with-curses-version={function,variable} configure option for
+ cross-compiling.
- * test/ruby/test_string.rb (TestString#test_scan): add a test for
- [ruby-core:33338] #4087.
+Thu Apr 25 18:15:46 2013 Tanaka Akira <akr@fsij.org>
-Mon Dec 6 18:55:36 2010 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
+ * ext/socket/extconf.rb: Don't use WIDE getaddrinfo by default.
- * test/uri/test_common.rb (TestCommon#test_encode_www_form): add
- tests for r30015.
+Thu Apr 25 17:56:39 2013 Tanaka Akira <akr@fsij.org>
-Mon Dec 6 10:39:54 2010 NARUSE, Yui <naruse@ruby-lang.org>
+ * ext/socket/extconf.rb: Remove obsolete options: ---with-ipv6-lib and
+ --with-ipv6-libdir.
- * lib/uri/common.rb (URI::Parser#initialize_pattern):
- refix for restrict the pattern.
+Thu Apr 25 17:43:49 2013 Tanaka Akira <akr@fsij.org>
-Mon Dec 6 09:45:11 2010 Eric Hodel <drbrain@segment7.net>
+ * 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.
- * ext/openssl (OpenSSL): add toplevel documentation
- * ext/openssl/ossl_ssl.c (SSLContext, SSLSocket: add additional
- documentation
- * ext/openssl: move "let rdoc know about mOSSL" comments so they don't
- show up in output
+Thu Apr 25 16:11:06 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Mon Dec 6 09:16:46 2010 NARUSE, Yui <naruse@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]
- * lib/uri/common.rb (URI::Parser#initialize_pattern):
- workaround fix pattern of hostname for RFC 3986. [ruby-dev:42672]
+ * io.c (io_set_encoding_by_bom): reset extenal encoding if no BOM
+ found. [ruby-core:54569]
-Mon Dec 6 09:14:38 2010 NARUSE, Yui <naruse@ruby-lang.org>
+Thu Apr 25 14:35:01 2013 NARUSE, Yui <naruse@ruby-lang.org>
- * lib/mkmf.rb (check_signedness): rename unused variable prelude.
+ * ext/openssl/ossl_bn.c (ossl_bn_initialize): allow Fixnum and Bignum.
+ [ruby-core:53986] [Feature #8217]
-Sun Dec 5 17:56:36 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Thu Apr 25 14:26:32 2013 NARUSE, Yui <naruse@ruby-lang.org>
- * class.c (make_metaclass): fix probable typo. builtin type flag
- cannot be used with FL_TEST.
+ * 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]
-Sun Dec 5 12:09:27 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * lib/uri/common.rb (URI.decode_www_form): follow current URL Standard.
+ It gets encoding argument to convert before percent encode.
+ Now UTF-16 strings aren't converted to UTF-8 before percent encode
+ by default.
- * lib/irb/init.rb (IRB.parse_opts): fix typo. [ruby-core:33574]
+Wed Apr 25 14:26:00 2013 Charlie Somerville <charlie@charliesomerville.com>
-Sun Dec 5 11:27:08 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * benchmark/bm_hash_shift.rb: add benchmark for Hash#shift
- * ruby.c (load_file_internal): decrement for ungotten line.
- [ruby-dev:42680]
+ * hash.c (rb_hash_shift): use st_shift if hash is not being iterated to
+ delete element without iterating the whole hash.
-Sun Dec 5 10:32:11 2010 Tanaka Akira <akr@fsij.org>
+ * hash.c (shift_i): remove function
- * complex.c: parenthesize macro arguments.
+ * include/ruby/st.h (st_shift): add st_shift function
-Sat Dec 4 11:39:17 2010 Eric Hodel <drbrain@segment7.net>
+ * st.c (st_shift): ditto
- * ext/openssl/ossl_x509ext.c (initialize): add documentation.
+ [Bug #8312] [ruby-core:54524] Patch by funny-falcon
-Sat Dec 4 11:21:50 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Thu Apr 25 12:03:38 2013 Tanaka Akira <akr@fsij.org>
- * hash.c (rb_hash_update_by): new API for Hash#update.
+ * ext/socket/extconf.rb: Extract C programs as toplevel constants.
-Sat Dec 4 11:18:10 2010 Tanaka Akira <akr@fsij.org>
+Thu Apr 25 02:23:28 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * class.c: parenthesize macro arguments.
+ * configure.in (RUBY_RM_RECURSIVE): this hack is needed by only
+ autoconf 2.69 or earlier on darwin.
-Sat Dec 4 11:07:57 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Thu Apr 25 01:22:41 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * vm_core.h (rb_vm_inc_const_missing_count): missing prototype.
+ * lib/tracer.rb (get_line): simply read by File.readlines.
-Sat Dec 4 08:50:10 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * lib/debug.rb (script_lines): get source lines from SCRIPT_LINES__ or
+ read from the file.
- * ext/iconv/iconv.c (Init_iconv): no warnings if $VERBOSE is nil.
+ * lib/debug.rb (display_list): use script_lines instead of recursion.
+ [Bug #8318]
-Sat Dec 4 08:25:15 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * lib/debug.rb (line_at): use script_lines same as display_list.
- * vm_insnhelper.c (vm_call_method): revert r30064 and r30071,
- because of [ruby-core:26761]. Bug#4106 rejected.
+ * 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]
-Sat Dec 4 07:46:48 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Wed Apr 24 21:51:13 2013 Tanaka Akira <akr@fsij.org>
- * lib/mkmf.rb (String#tr_cpp): substitute * with P like as
- autoconf.
+ * configure.in: Check mblen().
+ mblen() is optional in uClibc.
-Fri Dec 3 22:36:45 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * eval_intern.h (CharNext): Don't use mblen() is not available.
- * vm_insnhelper.c (vm_call_method): protected methods should be
- checked against the real class.
+Wed Apr 24 15:55:06 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-Fri Dec 3 20:23:31 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * io.c (rb_fd_fix_cloexec): use rb_update_max_fd().
- * lib/mkmf.rb (convertible_int): define printf format prefix too.
+Wed Apr 24 14:08:00 2013 Zachary Scott <zachary@zacharyscott.net>
- * lib/mkmf.rb (convertible_int): detect convertible integer type.
- port RUBY_REPLACE_INT from configure.in.
+ * numeric.c: Fix wiki link on Float imprecision in overview, patched
+ by Makoto Kishimoto [Bug #8304] [ruby-dev:47280]
- * lib/mkmf.rb (check_sizeof): should return integer always.
+Wed Apr 24 14:03:59 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Fri Dec 3 12:54:48 2010 NAKAMURA Usaku <usa@ruby-lang.org>
+ * parse.y (parser_yylex): disallow $- without following identifier
+ character. [ruby-talk:406969]
- * win32/Makefile.sub (RCFLAGS): VC10 and after only. fixed the problem
- of r30015. [ruby-core:33530]
+ * parse.y (is_special_global_name): mere $- is not a valid global
+ variable name.
-Fri Dec 3 12:41:52 2010 URABE Shyouhei <shyouhei@ruby-lang.org>
+Wed Apr 24 13:54:00 2013 Zachary Scott <zachary@zacharyscott.net>
- * gc.c (rb_objspace_free): With our "lazy-sweep" GC engine, it is
- possible for an object to survive until its surrounding object
- space is about to be freed. Those objects, if any, remains
- leaked for the rest of a process life. This is problematic
- because for instance a T_DATA object may have its own destructor
- to terminate something.
+ * string.c: Document String#setbyte return value by @gjmurakami-10gen
+ [Fixes GH-294]
- * vm.c (ruby_vm_destruct): ruby_current_vm termination should be
- somewhere after rb_objspace_free for above reason.
+Wed Apr 24 13:45:00 2013 Zachary Scott <zachary@zacharyscott.net>
-Fri Dec 3 12:17:19 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * class.c: Example of Object#methods by @windwiny [Fixes GH-293]
+ * ruby.c: Document return values of Kernel #sub, #gsub, and #chop
- * vm_insnhelper.c (vm_call_method): protected singleton methods should
- be visible from same real class methods. [ruby-core:33506]
+Wed Apr 24 12:54:00 2013 Zachary Scott <zachary@zacharyscott.net>
-Fri Dec 3 07:08:42 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * ext/socket/lib/socket.rb: Doc typos by @vipulnsward [Fixes GH-292]
- * ext/stringio/stringio.c (strio_getline): round upto next char
- boundary. [ruby-dev:42674]
-Fri Dec 3 06:52:46 2010 Tanaka Akira <akr@fsij.org>
+Wed Apr 24 12:54:00 2013 Zachary Scott <zachary@zacharyscott.net>
- * compile.c: parenthesize macro arguments.
+ * ext/socket/lib/socket.rb: Doc typos by @vipulnsward [Fixes GH-292]
-Fri Dec 3 04:08:59 2010 NARUSE, Yui <naruse@ruby-lang.org>
+Wed Apr 24 12:27:00 2013 Zachary Scott <zachary@zacharyscott.net>
- * encoding.c (enc_alias_internal): use st_insert2 and change return
- value to int.
+ * array.c: Fix documentation for Array#index and #replace aliases
+ Based on a patch by @phiggins [Fixes GH-282]
- * encoding.c (enc_alias): follow enc_alias_internal.
+Tue Apr 23 21:14:38 2013 NARUSE, Yui <naruse@ruby-lang.org>
-Fri Dec 3 01:52:43 2010 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]
- * encoding.c (enc_alias_internal): use xfree instead of free.
+Tue Apr 23 20:10:02 2013 Tanaka Akira <akr@fsij.org>
-Thu Dec 2 23:52:26 2010 URABE Shyouhei <shyouhei@ruby-lang.org>
+ * missing/isnan.c (isnan): Don't define if isnan() macro is defined.
+ This fixes a compilation failure on uClibc based Gentoo system.
- * NEWS: entry for ruby_vm_at_exit().
+Tue Apr 23 17:40:40 2013 Martin Duerst <duerst@it.aoyama.ac.jp>
- * eval.c (ruby_cleanup): bug fix around at_exit (1) timing was
- wrong. (2) execution order was opposite.
+ * lib/rexml/document.rb, lib/rexml/element.rb,
+ lib/rexml/formatters/pretty.rb: remove opinionated
+ language in documentation. [Bug #8309],
+ reported by Charles Beckmann
-Thu Dec 2 23:05:14 2010 NAKAMURA Usaku <usa@ruby-lang.org>
+Tue Apr 23 14:04:44 2013 Shugo Maeda <shugo@ruby-lang.org>
- * win32/Makefile.sub (RCFLAGS): -nologo switch is only available in
- newer versions of rc.exe. fixed the problem of r30012.
+ * lib/net/imap.rb (getacl_response): parse the mailbox of an ACL
+ response correctly. [ruby-core:54365] [Bug #8281]
-Thu Dec 2 21:28:07 2010 NARUSE, Yui <naruse@ruby-lang.org>
+Tue Apr 23 11:58:46 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * ext/json/lib/json/add/rails.rb: removed.
+ * string.c (rb_str_scrub): fix for UTF-32. strlen() on strings
+ contain NUL returns wrong result, use sizeof operator instead.
+ [ruby-dev:45975] [Feature #6752]
-Thu Dec 2 21:22:05 2010 NARUSE, Yui <naruse@ruby-lang.org>
+Tue Apr 23 10:26:50 2013 Akinori MUSHA <knu@iDaemons.org>
- * encoding.c (enc_alias_internal): free the copied key and
- return NULL when given key is already registered.
+ * test/ruby/test_module.rb
+ (TestModule#test_const_get_invalid_name)
+ (test_const_defined_invalid_name): Fix expected values.
- * encoding.c (enc_alias): call set_encoding_const only when the
- alias is not registered yet.
+Tue Apr 23 09:51:26 2013 Akinori MUSHA <knu@iDaemons.org>
-Thu Dec 2 19:58:24 2010 URABE Shyouhei <shyouhei@ruby-lang.org>
+ * string.c (rb_str_inspect): NUL should not be represented as "\0"
+ when octal digits may follow. [ruby-core:54458] [Bug #8290]
- * vm.c (ruby_vm_at_exit): new API. This enables extension libs to
- hook a VM termination. Right now, because the VM we have is
- process global, most extensions do not deallocate resources and
- leave them to Operating System's reaping userland processes. But
- in a future we plan to have multiple VMs to run simultaneously in
- a single process (MVM project). At that stage we can no longer
- rely on OSes and have to manage every resources to be reclaimed
- properly. So it is. For a forward-compatibility reason this API
- is introduced now, encouraging you to be as gentle as you can for
- your resources; that is, tidy up your room.
+Mon Apr 22 22:54:00 2013 Charlie Somerville <charlie@charliesomerville.com>
- * include/ruby/vm.h: ditto.
+ * insns.def (opt_mod): Use % operator if both operands are positive for
+ a significant performance improvement. Thanks to @samsaffron.
- * vm_core.h (rb_vm_struct): new field.
+Mon Apr 22 17:09:37 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * vm.c (vm_init2): initialize above new field.
+ * marshal.c (r_object0): copy all instance variables not only generic
+ ivars, before calling post proc. [ruby-core:51163] [Bug #7627]
- * eval.c (ruby_cleanup): trigger those hooks.
+Mon Apr 22 10:25:21 2013 NARUSE, Yui <naruse@ruby-lang.org>
-Thu Dec 2 17:00:44 2010 Tanaka Akira <akr@fsij.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.
- * bignum.c: parenthesize macro arguments.
+Sun Apr 21 23:19:00 2013 Charlie Somerville <charlie@charliesomerville.com>
-Thu Dec 2 15:31:14 2010 NAKAMURA Usaku <usa@ruby-lang.org>
+ * configure.in: Revert using sigsetjmp by default due to performance
+ problems on some systems (eg. older Linux)
- * win32/win32.c (rb_w32_read): more fix. [ruby-core:33513]
+Sun Apr 21 21:35:00 2013 Charlie Somerville <charlie@charliesomerville.com>
-Thu Dec 2 13:41:43 2010 NAKAMURA Usaku <usa@ruby-lang.org>
+ * 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]
- * win32/win32.c (rb_w32_read): workaround for console reading troubles.
- fixed [ruby-core:33511]
+ * configure.in: Manually check for presence of sigsetjmp. It is not a
+ function on some systems, so AC_CHECK_FUNCS cannot be used.
-Thu Dec 2 13:10:42 2010 NARUSE, Yui <naruse@ruby-lang.org>
+Sun Apr 21 08:00:55 2013 Tanaka Akira <akr@fsij.org>
- * lib/uri/common.rb (URI.encode_www_form):
- split key-value when the value is Array like object.
+ * 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.
-Thu Dec 2 10:39:39 2010 NARUSE, Yui <naruse@ruby-lang.org>
+Sun Apr 21 00:15:36 2013 Tanaka Akira <akr@fsij.org>
- * lib/net/http.rb (Net::HTTP#set_form_data):
- use URI.encode_www_form for application/x-www-form-urlencoded.
+ * lib/tempfile.rb (Tempfile.create): Close when the block exits.
-Thu Dec 2 10:38:40 2010 NARUSE, Yui <naruse@ruby-lang.org>
+Sat Apr 20 23:38:14 2013 Tanaka Akira <akr@fsij.org>
- * ext/extmk.rb: remove $makeflags.defined?, it should be $mflags.
+ * lib/webrick/httpauth/htpasswd.rb: Use Tempfile.create to avoid
+ unintentional unlink() by the finalizer.
+ lib/webrick/httpauth/htdigest.rb: Ditto.
-Thu Dec 2 10:19:47 2010 NAKAMURA Usaku <usa@ruby-lang.org>
+Sat Apr 20 22:47:48 2013 Tanaka Akira <akr@fsij.org>
- * win32/Makefile.sub (rc): suppress meaningless message.
+ * lib/tempfile.rb (Tempfile.create): New method.
+ The method name is proposed by Shugo Maeda. [ruby-dev:47220]
+ [ruby-core:41478] [Feature #5707]
-Thu Dec 2 10:09:40 2010 NARUSE, Yui <naruse@ruby-lang.org>
+Sat Apr 20 14:22:10 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * ext/json/generator/extconf.rb: remove the lines which set -O3
- when -O option is not set.
- Note that -O3 doesn't always exist.
+ * marshal.c (w_object): dump no ivars to the original by marshal_dump.
+ [ruby-core:54334] [Bug #8276]
- * ext/json/parser/extconf.rb: ditto.
+ * marshal.c (r_object0): copy all ivars of marshal_dump data to the
+ result object instead. [ruby-core:51163] [Bug #7627]
-Thu Dec 2 10:01:59 2010 NARUSE, Yui <naruse@ruby-lang.org>
+Sat Apr 20 02:33:27 2013 NARUSE, Yui <naruse@ruby-lang.org>
- * ext/extmk.rb: define $makeflags.defined? like $mflags.
+ * string.c (str_scrub): add ruby method String#scrub which verify and
+ fix invalid byte sequence. [ruby-dev:45975] [Feature #6752]
-Thu Dec 2 07:20:20 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * string.c (str_compat_and_valid): check given string is compatible
+ and valid with given encoding.
- * lib/test/unit.rb (Test::Unit::GCStressOption): --gc-stress
- option.
+ * transcode.c (str_transcode0): If invalid: :replace is specified for
+ String#encode, replace invalid byte sequence even if the destination
+ encoding equals to the source encoding.
- * lib/test/unit.rb (Test::Unit::Mini#_run_suites): show the result
- even when interrupted on the way.
+Fri Apr 19 21:55:40 2013 Kouhei Sutou <kou@cozmixng.org>
-Thu Dec 2 07:08:38 2010 Nobuyoshi Nakada <nobu@ruby-lang.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]
- * ext/io/console/console.c (setattr): should retry on EINTR.
- [ruby-dev:42666]
+Fri Apr 19 17:54:57 2013 Shugo Maeda <shugo@ruby-lang.org>
-Thu Dec 2 02:30:50 2010 Eric Hodel <drbrain@segment7.net>
+ * lib/net/imap.rb (body_type_msg): should accept
+ message/delivery-status with extra data.
+ [ruby-core:53741] [Bug #8167]
- * lib/net/http.rb: fixed positional wording to match revised order.
+ * test/net/imap/test_imap_response_parser.rb: related test.
-Thu Dec 2 01:24:39 2010 NARUSE, Yui <naruse@ruby-lang.org>
+Fri Apr 19 13:03:14 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * ext/json/lib/json/common.rb: don't use iconv on 1.9.
- patched by Shota Fukumori [ruby-core:33164]
+ * marshal.c (w_object): do not dump encoding which is dumped with
+ marshal_dump data. [ruby-core:54334] [Bug #8276]
-Thu Dec 2 01:02:03 2010 NARUSE, Yui <naruse@ruby-lang.org>
+Fri Apr 19 11:36:53 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * ext/json: Update github/flori/json from 1.4.2+ to
- e22b2f2bdfe6a9b0. this fixes some bugs.
+ * configure.in (stack_protector): control use of -fstack-protector.
-Thu Dec 2 00:05:44 2010 NARUSE, Yui <naruse@ruby-lang.org>
+ * configure.in (debugflags): let -fstack-protector precede and disable
+ debugflags, because they can't work together on SmartOS. [Bug #8268]
- * lib/net/http.rb: improve rdoc.
- This change the order of chapter because such overview should
- begin with simple examples.
- patched by Eric Hodel [ruby-core:33469]
+Fri Apr 19 07:43:52 2013 NARUSE, Yui <naruse@ruby-lang.org>
-Wed Dec 1 22:01:49 2010 NAKAMURA Usaku <usa@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
- * numeric.c (Init_Numeric): fixed a potential bug when using bccwin32
- ruby with Microsoft's dll, though we already gave up of supporting
- bccwin32. [ruby-core:33503]
+Thu Apr 18 16:58:51 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Wed Dec 1 21:43:21 2010 Tanaka Akira <akr@fsij.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]
- * array.c: parenthesize macro arguments.
+Thu Apr 18 16:20:51 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Wed Dec 1 21:41:57 2010 Tanaka Akira <akr@fsij.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]
- * test/socket/test_addrinfo.rb: extract Errno::EADDRINUSE as a method.
+Thu Apr 18 16:20:21 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * test/socket/test_socket.rb: ditto.
+ * pack.c (pack_unpack): increase buffer size to fix buffer overflow,
+ and fix garbage just after unpacking without missing paddings.
+ [Bug #8286]
-Wed Dec 1 15:08:32 2010 NAKAMURA Usaku <usa@ruby-lang.org>
+Thu Apr 18 13:35:54 2013 NARUSE, Yui <naruse@ruby-lang.org>
- * test/openssl/test_ssl.rb (test_not_started_session): non socket
- argument of SSLSocket.new is not supported on Windows.
+ * pack.c (pack_unpack): output characters even if the input doesn't
+ have paddings. [Bug #8286]
-Wed Dec 1 14:36:36 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Thu Apr 18 08:20:48 2013 NARUSE, Yui <naruse@ruby-lang.org>
- * string.c (rb_memhash): zero-filled strings should return
- different values. [ruby-core:33500]
+ * common.mk (clean-ext): remove timestamps.
-Wed Dec 1 14:27:49 2010 Ryan Davis <ryand-ruby@zenspider.com>
+Wed Apr 17 22:07:50 2013 Tanaka Akira <akr@fsij.org>
- * lib/minitest/*.rb: Imported minitest 2.0.0 r5952.
- * test/minitest/*.rb: ditto.
- * lib/test/unit.rb: Compatibility fix for minitest changes.
+ * ext/socket/rubysocket.h (SOCKLEN_MAX): Expression simplified.
-Wed Dec 1 10:16:41 2010 NARUSE, Yui <naruse@ruby-lang.org>
+Wed Apr 17 20:09:19 2013 Aman Gupta <ruby@tmm1.net>
- * string.c (rb_str_inspect): fix typo (not 0xFD but 0xFE).
+ * compile.c (iseq_add_mark_object): Use new rb_iseq_add_mark_object().
-Wed Dec 1 09:28:27 2010 NARUSE, Yui <naruse@ruby-lang.org>
+ * insns.def (setinlinecache): Ditto.
- * addr2line.c: Follow .gnu_debuglink section.
- A user of distribution provided ruby will see line
- info if s/he has a debug package for ruby.
- patched by Shinichiro Hamaji [ruby-dev:42655]
+ * iseq.c (rb_iseq_add_mark_object): New function to allocate
+ iseq->mark_ary on demand. [Bug #8142]
-Wed Dec 1 01:29:15 2010 NARUSE, Yui <naruse@ruby-lang.org>
+ * iseq.h (rb_iseq_add_mark_object): Ditto.
- * string.c (rb_str_inspect): inspect as a dummy encoding string
- when a UTF-16/32 (not BE/LE) string does not have a BOM.
- Unicode and some RFCs say that a string labeled as UTF-16/32
- doesn't have a BOM, it should be considered big endian.
- But many Windows programs generates little endian UTF-16
- strings without a BOM. So String#inspect treats a string
- labeled UTF-16/32 without a BOM as a dummy encoding string.
- patched by Martin Duerst. [ruby-core:33461]
+ * iseq.c (prepare_iseq_build): Avoid allocating mark_ary until needed.
-Tue Nov 30 17:04:10 2010 NARUSE, Yui <naruse@ruby-lang.org>
+ * iseq.c (rb_iseq_build_for_ruby2cext): Ditto.
- * addr2line.c (parse_debug_line_cu): ignore DW_LNE_set_discriminator.
- To ignore, it needs to read a single unsigned LEB128 integer.
+Wed Apr 17 20:00:18 2013 Tanaka Akira <akr@fsij.org>
-Tue Nov 30 16:29:19 2010 NARUSE, Yui <naruse@ruby-lang.org>
+ * ext/socket/rubysocket.h (SOCKLEN_MAX): Defined.
- * vm_dump.c: undef HAVE_BACKTRACE when the OS is FreeBSD (in other
- words backtrace() is libexecinfo) and it is optimized.
- This temporary hack may be also applied to other libexecinfo
- environments.
+ * ext/socket/raddrinfo.c (ext/socket/raddrinfo.c): Reject too long
+ Linux abstract socket name.
-Tue Nov 30 16:23:23 2010 NARUSE, Yui <naruse@ruby-lang.org>
+Wed Apr 17 19:45:27 2013 Aman Gupta <tmm1@ruby-lang.org>
- * lib/net/http.rb: improve rdoc.
- patched by Eric Hodel ref #4100
+ * iseq.c (iseq_location_setup): re-use existing string when iseq has
+ the same path and absolute_path. [Bug #8149]
-Tue Nov 30 12:23:52 2010 NAKAMURA Usaku <usa@ruby-lang.org>
+Wed Apr 17 11:38:37 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * win32/win32.c (rb_w32_read): read only 1 byte at once on console.
- workaround of Windows bug. see [ruby-core:33460].
- this is not the final solution.
+ * lib/test/unit/assertions.rb (Test::Unit::Assertions#assert):
+ UNASSIGNED is not a valid message.
-Tue Nov 30 11:39:13 2010 NARUSE, Yui <naruse@ruby-lang.org>
+Wed Apr 17 10:58:18 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * lib/net/http.rb: improve rdoc.
- patched by mathew murphy [ruby-core:33472] ref #4100
+ * thread.c (sleep_timeval): get rid of overflow on Windows where
+ timeval.tv_sec is not time_t but mere long.
-Tue Nov 30 05:03:44 2010 Eric Hodel <drbrain@segment7.net>
+Tue Apr 16 23:07:12 2013 Tanaka Akira <akr@fsij.org>
- * lib/uri/common.rb (encode_www_form, encode_www_form_component):
- Improve English in documentation.
+ * ext/socket/unixsocket.c (unix_send_io): Suppress a warning by clang.
+ (unix_recv_io): Ditto.
- * ext/openssl/ossl_ssl.c (ssl_version=, ciphers=): Document
- #ssl_version=, add documentation for #ciphers=.
+Tue Apr 16 12:27:00 2013 Zachary Scott <zachary@zacharyscott.net>
-Mon Nov 29 22:55:24 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * ext/sdbm/init.c: Fix comment indentation, by windwiny [Fixes GH-277]
- * lib/uri/common.rb (URI::WFKV_): get rid of backtrack explosion
- by nested repeat operators. [ruby-core:33464]
+Tue Apr 16 12:25:00 2013 Zachary Scott <zachary@zacharyscott.net>
-Mon Nov 29 22:53:13 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * 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
- * win32/Makefile.sub (scriptbin.mk): fix generated rules.
+Tue Apr 16 11:23:00 2013 Zachary Scott <zachary@zacharyscott.net>
- * win32/win32.c (rb_w32_write_console): fix argument type.
+ * ext/openssl/*: Document synonymous methods, by windwiny [GH-277]
-Mon Nov 29 21:12:51 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Mon Apr 15 22:21:42 2013 Tanaka Akira <akr@fsij.org>
- * misc/ruby-mode.el (ruby-forward-sexp): stop after literal hash
- key labels.
+ * ext/fiddle/depend: New file.
- * misc/ruby-mode.el (ruby-font-lock-keywords): highlight literal
- hash key labels as symbols.
+Mon Apr 15 22:01:02 2013 Akinori MUSHA <knu@iDaemons.org>
-Mon Nov 29 18:31:31 2010 Martin Duerst <duerst@it.aoyama.ac.jp>
+ * misc/ruby-electric.el (ruby-electric-insert): Check
+ ruby-electric-is-last-command-char-expandable-punct-p here.
- * test/ruby/test_transcode.rb (test_unicode_public_review_issue_121):
- - Removed commented-out options that are no longer under discussion.
- - Added two more tests for forthcomming clarifications.
+ * 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 Nov 29 14:31:17 2010 NAKAMURA Usaku <usa@ruby-lang.org>
+Mon Apr 15 12:54:42 2013 Martin Bosslet <Martin.Bosslet@gmail.com>
- * win32/win32.c (rb_w32_isatty): use GetConsoleMode() to determine the
- fd is console or not, just like rb_w32_write_console(). [experimental]
+ * ext/openssl/ossl_ssl.c: Correct shutdown behavior w.r.t GC.
-Mon Nov 29 14:19:40 2010 NAKAMURA Usaku <usa@ruby-lang.org>
+ * test/openssl/test_ssl.rb: Add tests to verify correct behavior.
- * include/ruby/win32.h (rb_w32_write_console): wrong prototype.
+ [Bug #8240] Patch provided by Shugo Maeda. Thanks!
-Mon Nov 29 14:10:55 2010 NAKAMURA Usaku <usa@ruby-lang.org>
+Mon Apr 15 10:23:39 2013 NARUSE, Yui <naruse@ruby-lang.org>
- * win32/win32.c (rb_w32_write_console): fixed indentation.
+ * ext/coverage/depend: fix id.h place as r40283.
-Sun Nov 28 22:13:39 2010 Koichi Sasada <ko1@atdot.net>
+ * ext/coverage/extconf.rb: add topdir and topsrcdir to VPATH.
- * thread_pthread.c (NATIVE_MUTEX_LOCK_DEBUG): move and use it.
+Sun Apr 14 19:46:14 2013 Tanaka Akira <akr@fsij.org>
- * ChangeLog: fix my timezone.
+ * ext/-test-/debug/depend: New file.
-Mon Nov 28 21:58:58 2010 Koichi Sasada <ko1@atdot.net>
+ * ext/-test-/exception/depend: Ditto.
- * thread_pthread.c: remove pthread_atfork().
+ * ext/-test-/printf/depend: Ditto.
-Mon Nov 28 21:54:22 2010 Koichi Sasada <ko1@atdot.net>
+ * ext/-test-/string/depend: Ditto.
- * thread_pthread.c (native_cond_*): Check return code.
- (Some OSes except Linux return error code).
+ * ext/coverage/depend: Ditto.
-Sun Nov 28 21:46:21 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * ext/io/console/depend: Ditto.
- * thread_pthread.c (thread_start_func_1): initialize native thread
- data immediately before starting.
+ * ext/io/nonblock/depend: Ditto.
-Sun Nov 28 14:56:32 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * ext/io/wait/depend: Ditto.
- * io.c (struct argf): make lineno long, and reorder members.
+ * ext/openssl/depend: Ditto.
-Sun Nov 28 14:55:42 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * ext/pathname/depend: Ditto.
- * thread_win32.c (gvl_release, gvl_init): suppress warnings.
+ * ext/psych/depend: Ditto.
-Sun Nov 28 14:48:24 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * ext/zlib/depend: Ditto.
- * thread_pthread.c (gvl_release, gvl_init): suppress warnings.
+Sun Apr 14 02:46:50 2013 NARUSE, Yui <naruse@ruby-lang.org>
- * vm_core.h (rb_vm_gvl_destroy): add prototype.
+ * lib/mkmf.rb (MakeMakefile#create_makefile): remove {$(VPATH)} other
+ than nmake.
-Sun Nov 28 14:46:24 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * ext/ripper/depend: use VPATH expecting removed by above.
- * thread_pthread.c (gvl_reinit): register atfork handler only in
- the parent process, to get rid of dead lock.
+Sat Apr 13 23:06:20 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Sun Nov 28 12:23:57 2010 Koichi Sasada <ko1@atdot.net>
+ * lib/mkmf.rb (timestamp_file): gather timestamp files in one
+ directory from each extension directories.
- * thread.c, vm_core.h: make gvl_acquire/release/init/destruct
- APIs to modularize GVL implementation.
+Sat Apr 13 21:09:02 2013 NAKAMURA Usaku <usa@ruby-lang.org>
- * thread_pthread.c, thread_pthread.h: Two GVL implementations.
- (1) Simple locking GVL which is same as existing GVL.
- (2) Wake-up queued threads. The wake-up order is simple FIFO.
- (We can make several queues to support exact priorities, however
- this causes some issues such as priority inversion and so on.)
- This impl. prevents spin-loop (*1) caused on SMP environments.
- *1: Only one Ruby thread acquires GVL again and again.
- Bug #2359 [ruby-core:26694]
+ * lib/mkmf.rb (MakeMakefile#create_makefile): output new macro
+ disthdrdir to specify the path of id.h, parse.h and etc.
- * thread_win32.c, thread_win32.h: Using simple lock
- not by CRITICAL_SECTION but by Mutex.
- Bug #3890 [ruby-dev:42315]
+ * ext/ripper/depend: use above macro.
- * vm.c (ruby_vm_destruct): ditto.
+Sat Apr 13 20:28:08 2013 NARUSE, Yui <naruse@ruby-lang.org>
-Sun Nov 28 04:40:00 2010 Luis Lavena <luislavena@gmail.com>
+ * Merge Onigmo 5.13.4 f22cf2e566712cace60d17f84d63119d7c5764ee.
+ [bug] fix problem with optimization of \z (Issue #16) [Bug #8210]
- * io.c (io_fwrite): use rb_w32_write_console under Windows.
+Sat Apr 13 18:56:15 2013 NAKAMURA Usaku <usa@ruby-lang.org>
- * win32/win32.c (rb_w32_write_console): added to write to write
- Unicode using WriteConsoleW for stdout/stderr. [ruby-core:33166]
+ * ext/ripper/depend: parse.h and id.h may be created on topdir.
-Sun Nov 28 03:58:47 2010 NARUSE, Yui <naruse@ruby-lang.org>
+Sat Apr 13 12:08:16 2013 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
- * lib/net/http.rb: improve rdoc.
- patched by Mike Perham [ruby-core:33433]
+ * lib/matrix.rb: Add Vector#cross_product, patch by Luis Ezcurdia
+ [fix GH-276] [rubyspec:81eec89a124]
-Sat Nov 27 19:12:10 2010 Tanaka Akira <akr@fsij.org>
+Sat Apr 13 10:20:37 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * time.c: parenthesize macro arguments.
+ * struct.c (rb_struct_define_without_accessor, rb_struct_define),
+ (rb_struct_s_def): hide member names array.
-Sat Nov 27 18:08:18 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * struct.c (anonymous_struct, new_struct, setup_struct): split
+ make_struct() for each purpose.
- * time.c (leap_year_v_p): fixed typo. [ruby-dev:42631]
+Sat Apr 13 09:34:31 2013 Tanaka Akira <akr@fsij.org>
-Sat Nov 27 17:57:08 2010 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.
- * resolv.rb (Resolv::DNS): use the same DNS server when retry using
- TCP. reported by Julian Mehnle. [ruby-core:32970]
+ * ext/-test-/old_thread_select/depend: Update dependencies.
-Sat Nov 27 15:45:27 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * ext/-test-/wait_for_single_fd/depend: Ditto.
- * vm_dump.c (rb_vm_bugreport): see CrashReport log on Mac OS X.
+ * ext/bigdecimal/depend: Ditto.
- * configure.in: link addr2line only for ELF.
+ * ext/curses/depend: Ditto.
-Sat Nov 27 13:58:55 2010 Shugo Maeda <shugo@ruby-lang.org>
+ * ext/digest/bubblebabble/depend: Ditto.
- * lib/optparse.rb (OptionParser#candidate): : was missing. Thanks,
- Shota Fukumori. [ruby-dev:42634]
+ * ext/digest/depend: Ditto.
-Sat Nov 27 12:07:05 2010 Yukihiro Matsumoto <matz@ruby-lang.org>
+ * ext/digest/md5/depend: Ditto.
- * man/ruby.1: Ruby man page from Arthur Gunn in [ruby-core:33412]
+ * ext/digest/rmd160/depend: Ditto.
-Sat Nov 27 11:29:24 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * ext/digest/sha1/depend: Ditto.
- * lib/optparse.rb (OptionParser#candidate): get rid of 1.9 syntax
- so that BASERUBY can be 1.8.
+ * ext/digest/sha2/depend: Ditto.
-Sat Nov 27 08:16:21 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * ext/dl/callback/depend: Ditto.
- * addr2line.c (rb_dump_backtrace_with_lines): should close fd on
- edge case.
+ * ext/dl/depend: Ditto.
-Fri Nov 26 13:33:24 2010 NARUSE, Yui <naruse@ruby-lang.org>
+ * ext/etc/depend: Ditto.
- * addr2line.c: apply a patch from shinichiro.h.
+ * ext/nkf/depend: Ditto.
-Fri Nov 26 12:21:20 2010 NARUSE, Yui <naruse@ruby-lang.org>
+ * ext/objspace/depend: Ditto.
- * addr2line.c: added to show source filename and line number of
- functions in backtrace. [ruby-dev:42625]
- a patch from shinichiro.h <shinichiro.hamaji AT gmail.com>
+ * ext/pty/depend: Ditto.
- * addr2line.h: ditto.
+ * ext/readline/depend: Ditto.
- * common.mk: add addr2line.$(OBJEXT).
+ * ext/ripper/depend: Ditto.
- * configure.in: check dl_iterate_phdr.
+ * ext/sdbm/depend: Ditto.
- * vm_dump.c (rb_vm_bugreport): use rb_dump_backtrace_with_lines in
- addr2line.c when the binary is ELF.
+ * ext/socket/depend: Ditto.
-Fri Nov 26 12:12:50 2010 NARUSE, Yui <naruse@ruby-lang.org>
+ * ext/stringio/depend: Ditto.
- * regcomp.c (setup_tree): restart setup_tree() for a node whose
- AnchorNode's type is ANCHOR_PREC_BEHIND or ANCHOR_PREC_BEHIND_NOT
- and divide_look_behind_alternatives() divided it to NT_ALT or
- NT_LIST. [ruby-core:33370]
+ * ext/strscan/depend: Ditto.
-Fri Nov 26 11:40:11 2010 NAKAMURA Usaku <usa@ruby-lang.org>
+ * ext/syslog/depend: Ditto.
- * vm_dump.c (dump_thread): get only required rights of the target
- thread because THREAD_ALL_ACCESS causes an access error on XP.
- reported by Masaya TARUI via IRC.
+ * ext/-test-/num2int/depend: Removed.
-Fri Nov 26 11:09:07 2010 NAKAMURA Usaku <usa@ruby-lang.org>
+ * ext/dbm/depend: Ditto.
- * vm_dump.c (dump_thread): show the displacement from the beginning
- of the symbol.
+ * ext/fcntl/depend: Ditto.
-Fri Nov 26 10:48:23 2010 NAKAMURA Usaku <usa@ruby-lang.org>
+ * ext/gdbm/depend: Ditto.
- * vm_dump.c (dump_thread): follow the output of glibc.
- see [ruby-dev:42627]
+ * ext/racc/cparse/depend: Ditto.
-Fri Nov 26 09:48:45 2010 NAKAMURA Usaku <usa@ruby-lang.org>
+Sat Apr 13 00:15:54 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * re.c (rb_reg_initialize_str): should succeed the taint status from
- the origin. [ruby-core:33338]
+ * ext/etc/etc.c (Init_etc): move Passwd and Group under Etc namespace
+ as primary names.
-Fri Nov 26 09:32:37 2010 NAKAMURA Usaku <usa@ruby-lang.org>
+Fri Apr 12 21:06:55 2013 Tanaka Akira <akr@fsij.org>
- * vm_dump.c (dump_thread): seems to be necessary the 3rd argument of
- SymGetLineFromAddr64(), even though MSDN says it can be zero.
+ * common.mk: pack.o depends on internal.h.
-Fri Nov 26 09:03:38 2010 NARUSE, Yui <naruse@ruby-lang.org>
+Fri Apr 12 20:59:24 2013 Tanaka Akira <akr@fsij.org>
- * regcomp.c (onig_is_prelude): added to check whether ruby is still
- in prelude (or other boot processes) or not.
+ * bignum.c (ones): Use __builtin_popcountl if available.
- * regcomp.c (optimize_node_left): use onig_is_prelude for printing.
+ * internal.h (GCC_VERSION_SINCE): Macro moved from pack.c.
- * regcomp.c (set_optimize_info_from_tree): ditto.
+ * pack.c: Include internal.h for GCC_VERSION_SINCE.
- * regcomp.c (onig_compile): ditto.
+Fri Apr 12 18:29:42 2013 Tanaka Akira <akr@fsij.org>
- * regcomp.c (print_compiled_byte_code_list): print its address.
+ * 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]
- * regcomp.c (print_indent_tree): print its contents tree of
- ANCHOR_PREC_READ(_NOT) and ANCHOR_PREC_BEHIND(_NOT).
+Fri Apr 12 15:21:24 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Thu Nov 25 23:10:49 2010 NARUSE, Yui <naruse@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.
- * regcomp.c (print_distance_range): use PRIuSIZE.
+Fri Apr 12 11:58:00 2013 Zachary Scott <zachary@zacharyscott.net>
- * regcomp.c (print_optimize_info): use %ld because the type of
- calculated value of integers is long.
+ * 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
- * regexec.c (onig_print_compiled_byte_code): add prototype.
+Thu Apr 11 23:41:46 2013 Tanaka Akira <akr@fsij.org>
- * regexec.c (match_at): add 2nd argument.
+ * common.mk: Add dependencies for include/ruby.h
-Thu Nov 25 10:29:55 2010 NAKAMURA Usaku <usa@ruby-lang.org>
+ * tool/update-deps: Use "make -p all miniruby ruby golf" to extract
+ dependencies in makefiles.
- * ext/dl/callback/mkcallback.rb (gencallback): shouldn't assume that
- VALUE is the same size with long.
+Thu Apr 11 23:21:17 2013 Tanaka Akira <akr@fsij.org>
-Thu Nov 25 10:03:14 2010 NAKAMURA Usaku <usa@ruby-lang.org>
+ * tool/update-deps: Use "make -p all golf" to extract dependencies in
+ makefiles.
- * test/win32ole/test_err_in_callback.rb (teardown): remove tmp file
- only when it exists.
+Thu Apr 11 21:02:19 2013 Tanaka Akira <akr@fsij.org>
-Thu Nov 25 01:38:25 2010 NARUSE, Yui <naruse@ruby-lang.org>
+ * common.mk: Dependency updated.
- * enc/trans/big5-hkscs-tbl.rb: Update table as HKSCS-2008.
- patched by oCameLo oTnTh [ruby-core:33256]
+ * tool/update-deps: Rewritten.
- * enc/big5.c: add alias Big5-HKSCS:2008 to Big5-HKSCS.
+Thu Apr 11 19:59:48 2013 NARUSE, Yui <naruse@ruby-lang.org>
-Wed Nov 24 15:18:07 2010 NAKAMURA Usaku <usa@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)
- * vsnprintf (BSD_vfprintf): use QUADINT macro only when _HAVE_SANE_QUAD_
- macro is defined.
+Thu Apr 11 16:10:01 2013 NARUSE, Yui <naruse@ruby-lang.org>
-Wed Nov 24 12:47:16 2010 NAKAMURA Usaku <usa@ruby-lang.org>
+ * ext/fiddle/closure.c (USE_FFI_CLOSURE_ALLOC): define 0 on
+ Mac OS X and Linux [Bug #3371]
- * vsnprintf (BSD_vfprintf): added VC++ compatible size specifications
- (I, I32, I64).
+Thu Apr 11 13:19:22 2013 NAKAMURA Usaku <usa@ruby-lang.org>
-Wed Nov 24 11:19:13 2010 NARUSE, Yui <naruse@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]
- * string.c (rb_str_inspect): treat UTF-16 and UTF-32 as BE or LE.
+Thu Apr 11 11:11:38 2013 Akinori MUSHA <knu@iDaemons.org>
-Wed Nov 24 06:35:32 2010 NARUSE, Yui <naruse@ruby-lang.org>
+ * dir.c: Fix a typo.
- * enc/trans/utf_16_32.trans: add the UTF-32 converter.
+Thu Apr 11 10:39:34 2013 NARUSE, Yui <naruse@ruby-lang.org>
-Wed Nov 24 05:40:33 2010 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).
-Wed Nov 24 06:13:32 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Thu Apr 11 09:27:04 2013 Konstantin Haase <me@rkh.im>
- * win32/win32.c (filecp, wstr_to_mbstr, mbstr_to_wstr):
- refactored.
+ * dir.c (file_s_fnmatch): Document File::FNM_EXTGLOB flag.
-Wed Nov 24 05:40:33 2010 NARUSE, Yui <naruse@ruby-lang.org>
+Thu Apr 11 09:17:00 2013 Zachary Scott <zachary@zacharyscott.net>
- * enc/trans/utf_16_32.trans: add a converter from UTF-8 to UTF-16.
+ * README: Fix typo by Benjamin Winkler [Fixes GH-281]
-Wed Nov 24 03:21:35 2010 NARUSE, Yui <naruse@ruby-lang.org>
+Thu Apr 11 06:15:51 2013 NARUSE, Yui <naruse@ruby-lang.org>
- * enc/trans/utf_16_32.trans: raise error on unpaired upper
- surrogates.
+ * regint.h: fix typo: _M_AMD86 -> _M_AMD64.
-Wed Nov 24 01:40:23 2010 NARUSE, Yui <naruse@ruby-lang.org>
+ * siphash.c: ditto.
- * enc/utf_16_32.h: add UTF-16 and UTF-32 as a dummy encoding.
+ * st.c: ditto.
- * enc/trans/utf_16_32.trans: add a converter from UTF-16 to UTF-8.
+Thu Apr 11 06:09:57 2013 NARUSE, Yui <naruse@ruby-lang.org>
-Tue Nov 23 21:59:47 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * ext/fiddle/extconf.rb: define RUBY_LIBFFI_MODVERSION macro.
- * win32/win32.c (wlink, rb_w32_getppid): use typedef instead of
- repeating complicated function prototypes.
+ * ext/fiddle/closure.c (USE_FFI_CLOSURE_ALLOC): define 0 or 1
+ with platform and libffi's version. [Bug #3371]
-Tue Nov 23 18:54:03 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Thu Apr 11 05:30:43 2013 NARUSE, Yui <naruse@ruby-lang.org>
- * vm.c (rb_thread_mark): should mark self in control
- frames. [ruby-core:33289]
+ * lib/mkmf.rb (pkg_config): Add optional argument "option".
+ If it is given, it returns the result of
+ `pkg-config --<option> <pkgname>`.
-Tue Nov 23 07:57:31 2010 Tadayoshi Funaba <tadf@dotrb.org>
+Thu Apr 11 03:33:05 2013 NARUSE, Yui <naruse@ruby-lang.org>
- * lib/date/delta/parser.{ry,rb}: fixed a bug of token scanner.
+ * 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
-Tue Nov 23 07:29:24 2010 Tadayoshi Funaba <tadf@dotrb.org>
+Wed Apr 10 17:39:13 2013 Tanaka Akira <akr@fsij.org>
- * complex.c, rational.c ({nucomp,nurat}_expt): added a check.
+ * ext/bigdecimal/bigdecimal.c (VpCtoV): Initialize a local variable
+ even when overflow.
-Tue Nov 23 07:27:27 2010 Tadayoshi Funaba <tadf@dotrb.org>
+Wed Apr 10 12:32:37 2013 Tanaka Akira <akr@fsij.org>
- * lib/date.rb (daynum): should be private.
+ * bignum.c (rb_ll2big): Don't overflow on signed integer negation.
-Tue Nov 23 07:22:54 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * 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.
- * ChangeLog (change-log-indent-text): hanging indent.
+Wed Apr 10 06:32:12 2013 Tanaka Akira <akr@fsij.org>
-Tue Nov 23 06:30:51 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * internal.h (MUL_OVERFLOW_INT_P): New macro.
- * configure.in (SITE_DIR, VENDOR_DIR),
- version.c (ruby_initial_load_paths): exclude directories that
- are configured without them from $LOAD_PATH. [ruby-core:33267]
+ * sprintf.c (GETNUM): Don't overflow on signed integer multiplication.
- * configure.in (rubylibprefix): No ruby, No libprefix.
+Tue Apr 9 20:38:20 2013 Tanaka Akira <akr@fsij.org>
-Tue Nov 23 01:05:27 2010 NARUSE, Yui <naruse@ruby-lang.org>
+ * internal.h (MUL_OVERFLOW_SIGNED_INTEGER_P): New macro.
+ (MUL_OVERFLOW_FIXNUM_P): Ditto.
+ (MUL_OVERFLOW_LONG_P): Ditto.
- * vsnprintf.c (BSD_vfprintf): don't output floating point
- when the precision is 0. [ruby-dev:42615]
+ * array.c (rb_ary_product): Don't overflow on signed integer
+ multiplication.
-Mon Nov 22 21:30:57 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * numeric.c (fix_mul): Ditto.
+ (int_pow): Ditto.
- * string.c (rb_str_inspect): fix for ascii-compatible external
- encoding and different encoding string. [ruby-core:33283]
+ * rational.c (f_imul): Ditto.
-Mon Nov 22 18:45:44 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * insns.def (opt_mult): Ditto.
- * lib/mkmf.rb (create_makefile): should not duplicate rules.
- bug fix of r29842.
+ * thread.c (sleep_timeval): Don't overflow on signed integer addition.
-Mon Nov 22 18:04:40 2010 NARUSE, Yui <naruse@ruby-lang.org>
+ * bignum.c (rb_int2big): Don't overflow on signed integer negation.
+ (rb_big2ulong): Ditto.
+ (rb_big2long): Ditto.
+ (rb_big2ull): Ditto.
+ (rb_big2ll): Ditto.
- * enc/big5.c: split CP950 from Big5.
+Tue Apr 9 19:45:44 2013 Tanaka Akira <akr@fsij.org>
- * enc/big5.c: split CP951 from Big5-HKSCS.
+ * 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.
- * enc/trans/big5.trans: import conversion table of Big5, Big5-HKSCS,
- CP950, and CP951 from ICU. they need fallback conversions.
- ref [ruby-core:33256]
- http://source.icu-project.org/repos/icu/data/trunk/charset/data/ucm/
+Tue Apr 9 15:26:12 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * tool/transcode-tblgen.rb (import_ucm): add to import ucm files.
+ * compile.c (iseq_compile_each): append keyword hash to argument array
+ to splat if needed. [ruby-core:54094] [Bug #8236]
-Mon Nov 22 18:33:30 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Tue Apr 9 10:02:39 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * string.c (rb_str_inspect): append for each chars instead of bulk
- copy if encoding conversion is needed. [ruby-core:33283]
+ * lib/mkmf.rb (timestamp_file): gather timestamp files in one
+ directory from each extension directories, with considering
+ target_prefix.
-Mon Nov 22 14:22:45 2010 NARUSE, Yui <naruse@ruby-lang.org>
+Tue Apr 9 04:57:59 JST 2013 Charles Oliver Nutter <headius@headius.com>
- * time.c (time_zone): use rb_locale_str_new_cstr to set encoding
- as locale and convert its content to internal encoding.
- [ruby-core:33278]
+ * 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.
-Mon Nov 22 11:58:11 2010 NARUSE, Yui <naruse@ruby-lang.org>
+Tue Apr 9 02:44:32 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * string.c (rb_str_concat): set ENC_CODERANGE_VALID when the
- receiver is 7BIT and the argument is non ASCII.
+ * ext/socket/extconf.rb: $defs needs -D or -U. nothing is added
+ otherwize.
-Mon Nov 22 01:48:58 2010 Tadayoshi Funaba <tadf@dotrb.org>
+ * ext/socket/extconf.rb: check struct in_addr6, which is defined in
+ VC6 instead of in6_addr.
- * lib/date.rb: some improvements for performance.
+ * ext/socket/option.c (optname_to_sym): fix macro name.
-Sat Nov 20 07:45:50 2010 Aaron Patterson <aaron@tenderlovemaking.com>
+ * ext/socket/constants.c (rsock_cmsg_type_arg): fix macro name.
- * lib/mkmf.rb: adding compilation support for ObjC/ObjC++ extensions.
- Thanks Scott Gonyea! [ruby-core:33260]
+Mon Apr 8 23:57:21 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Sat Nov 20 01:57:55 2010 Akio Tajima <artonx@yahoo.co.jp>
+ * object.c (id_for_setter): extract common code from const, class
+ variable, instance variable setters.
- * common.mk: add dependency(insns.inc) to compile.obj
+Mon Apr 8 23:55:53 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Fri Nov 19 23:05:48 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * ext/depend (ENCOBJS, TRANSOBJS): use explicit path to ruby.h for
+ nmake.
- * win32/Makefile.sub (insns_rules.mk): remove extra backslash.
+ * 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.
- * cygwin/GNUmakefile.in, win32/Makefile.sub (clean): rc files are
- made at compile time, so should be removed by clean.
+Mon Apr 8 20:30:37 2013 Yuki Yugui Sonoda <yugui@google.com>
-Fri Nov 19 22:09:46 2010 Kouhei Sutou <kou@cozmixng.org>
+ * ext/depend (ENCOBJS, TRANSOBJS): Add missing dependencies.
- * test/rexml/test_core.rb
- (Tester#test_pretty_format_long_text_finite): skip a test that
- uses long string on small memory system. [ruby-dev:42599]
+Mon Apr 8 17:19:28 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Fri Nov 19 21:07:06 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * ext/win32ole/win32ole.c (fole_missing): should check actual argument
+ count before accessing.
- * lib/optparse.rb: shell completion support for zsh. based on
- <http://d.hatena.ne.jp/rubikitch/20071002/zshcomplete>
+Mon Apr 8 16:03:55 2013 Yuki Yugui Sonoda <yugui@google.com>
- * lib/optparse.rb: shell completion support for bash.
+ 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.
-Fri Nov 19 00:00:00 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Mon Apr 8 12:05:02 2013 NARUSE, Yui <naruse@ruby-lang.org>
- * cygwin/GNUmakefile.in (SCRIPTPROGRAMS): no needs on cygwin.
+ * 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.
- * win32/Makefile.sub (scriptbin): create script binaries.
+ * object.c (rb_mod_const_set): ditto.
-Thu Nov 18 23:21:23 2010 Kouhei Sutou <kou@cozmixng.org>
+ * object.c (rb_mod_cvar_set): ditto.
- * lib/rexml/formatters/pretty.rb (REXML::Formatters::Pretty#wrap):
- REXML::Formatters::Pretty#wrap used a recursive method call to
- format text. This switches it to use an iterative approach.
- [ruby-core:33245]
- Patch by Jeremy Evans. Thanks!!!
+Sun Apr 7 13:56:16 2013 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
- * test/rexml/test_core.rb: add a test for it.
+ * test/ruby/test_require.rb (TestRequire#test_require_nonascii_path):
+ RUBY_PLATFORM should escape as Regexp,
+ because RUBY_PLATFORM may contain '.'.
-Thu Nov 18 22:58:43 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Sun Apr 7 10:44:01 2013 Tanaka Akira <akr@fsij.org>
- * include/ruby/io.h (rb_io_buffer_t): extract from rb_io_t.
+ * include/ruby/defines.h: Simplify the logic to include sys/select.h.
+ This fixes a compilation error on Haiku (gcc2 and gcc4).
-Thu Nov 18 07:37:44 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * configure.in: Use shared linker as $(CC) for Haiku.
+ This fixes a build error on Haiku (gcc2).
- * Makefile.in (reconfig): force reconfigure with previous options.
+Sun Apr 7 10:41:30 2013 Tanaka Akira <akr@fsij.org>
- * common.mk (showconfig): show configure flags, like as
- `config.status --config' generated by recent autoconf.
+ * lib/resolv.rb (MDNSOneShot#sender): Delete an unused variable.
-Thu Nov 18 07:16:49 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Sun Apr 7 03:24:36 2013 NARUSE, Yui <naruse@ruby-lang.org>
- * missing/langinfo.c (strncasecmp): get rid of redefinition.
+ * addr2line.c: use more generic type:
+ * u_char -> unsigned char
+ * u_short -> unsigned short
+ * u_int -> unsigned int
+ * u_long -> unsigned long
+ * quad_t -> int64_t
+ * u_quad_t -> uint64_t
-Thu Nov 18 00:02:17 2010 James Edward Gray II <jeg2@ruby-lang.org>
+ * addr2line.c (imax): inline is defined by configure.
- * lib/csv.rb: Upgrading output encoding with ASCII content
- as needed. [ruby-core:33229]
+Sun Apr 7 01:40:39 2013 Akinori MUSHA <knu@iDaemons.org>
-Wed Nov 17 23:19:21 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * misc/ruby-electric.el (ruby-electric-hash): New electric
+ function that expands a hash sign inside a string or regexp to
+ "#{}".
- * win32/configure.bat: remove quotes from arguments to be quoted.
+ * misc/ruby-electric.el (ruby-electric-curlies): Do not insert
+ spaces inside when the curly brace is a delimiter of %r, %w,
+ etc.
- * lib/mkmf.rb (create_makefile): use forward slashes in messages.
+ * misc/ruby-electric.el (ruby-electric-curlies): Insert another
+ space before a closing curly brace when
+ ruby-electric-newline-before-closing-bracket is nil.
- * lib/mkmf.rb (create_makefile): make extension libraries messages
- brief.
+Sun Apr 7 01:01:26 2013 Tanaka Akira <akr@fsij.org>
- * win32/Makefile.sub (MAKEDIRS): should not include silent flag.
+ * strftime.c (rb_strftime_with_timespec): Test yday range.
+ [ruby-core:44088] [Bug #6247] reported by Ruby Submit.
- * common.mk (ext/ripper/ripper.c, ext/json/parser/parser.c): pass
- Q and ECHO. [ruby-core:33226]
+Sat Apr 6 23:46:54 2013 Naohisa Goto <ngotogenome@gmail.com>
-Wed Nov 17 16:09:52 2010 Yuki Sonoda (Yugui) <yugui@yugui.jp>
+ * configure.in (AC_CHECK_HEADERS): atomic.h for Solaris atomic_ops.
- * test/test_tracer.rb: new test case.
- minimal regression test for r29280.
+ * ruby_atomic.h: Skip using Solaris10 atomic_ops on Solaris 9 or
+ earlier if atomic.h is not available. [ruby-dev:47229] [Bug #8228]
-Wed Nov 17 16:04:23 2010 Yuki Sonoda (Yugui) <yugui@yugui.jp>
+Sat Apr 6 23:40:40 2013 Tanaka Akira <akr@fsij.org>
- * test/ruby/envutil.rb (Test::Unit::Assersions#assert_warn):
- new assertion to assert that a particular warning message is
- displayed.
- forward port from branches/ruby_1_9_2@29795.
+ * lib/resolv.rb: Support LOC resources.
+ [ruby-core:23361] [Feature #1436] by JB Smith.
-Wed Nov 17 15:16:48 2010 NARUSE, Yui <naruse@ruby-lang.org>
+Sat Apr 6 23:38:09 2013 Naohisa Goto <ngotogenome@gmail.com>
- * regint.h (OnigOpInfoType): constify name.
+ * 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]
- * regcomp.c (op2name): constify return value.
+Sat Apr 6 23:31:38 2013 Tanaka Akira <akr@fsij.org>
- * regcomp.c (onig_print_compiled_byte_code): use PRIuPTR and
- uintptr_t to clean warnings.
+ * lib/resolv.rb: Add one-shot multicast DNS support.
+ [ruby-core:53387] [Feature #8089] by Eric Hodel.
- * regcomp.c (print_indent_tree): use PRIxPTR and intptr_t.
+Sat Apr 6 22:12:01 2013 Tanaka Akira <akr@fsij.org>
- * regexec.c (match_at): use PRIdPTR and intptr_t.
+ * lib/resolv.rb (Resolv::DNS.fetch_resource): New method to obtain
+ full result.
+ [ruby-dev:43587] [Feature #4788] proposed by Makoto Kishimoto.
-Wed Nov 17 09:49:10 2010 NARUSE, Yui <naruse@ruby-lang.org>
+Sat Apr 6 20:17:51 2013 Tanaka Akira <akr@fsij.org>
- * enc/shift_jis.c (property_name_to_ctype): fix memory leak.
+ * 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.
- * enc/euc_jp.c (property_name_to_ctype): ditto.
+ * ext/socket/rubysocket.h: Follow the above change.
-Wed Nov 17 08:54:04 2010 James Edward Gray II <jeg2@ruby-lang.org>
+Sat Apr 6 19:24:59 2013 Tanaka Akira <akr@fsij.org>
- * lib/csv.rb: Upgrading output encoding as needed. [ruby-core:33135]
+ * 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.
-Tue Nov 16 22:30:39 2010 Yusuke Endoh <mame@tsg.ne.jp>
+ * ext/socket/rubysocket.h (rsock_sys_fail_sockaddr): Follow the above
+ change.
- * vm_insnhelper.c (vm_throw): remove fear of undefined behavior :-)
- Coverity Scan found this bug.
+Sat Apr 6 14:28:23 2013 Tanaka Akira <akr@fsij.org>
-Tue Nov 16 09:33:00 2010 Kenta Murata <mrkn@mrkn.jp>
+ * 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/bigdecimal/lib/bigdecimal/util.rb (to_digits): avoid unused
- variables warning, reported by Aaron Patterson.
+ * 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.
-Tue Nov 16 06:39:31 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * 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.
- * pack.c (PACK_ITEM_ADJUST): return nil not result array and yield
- values if block is given. [ruby-core:33193]
+Sat Apr 6 13:34:20 2013 Tanaka Akira <akr@fsij.org>
-Tue Nov 16 00:21:20 2010 Yusuke Endoh <mame@tsg.ne.jp>
+ * ext/socket/socket.c (rsock_sys_fail_sockaddr): Delete 2nd argument.
- * regparse.c (and_cclass, or_cclass): fix memory leak. Coverity Scan
- found this bug. [ruby-dev:42579]
+ * ext/socket/rubysocket.h (rsock_sys_fail_sockaddr): Follow above
+ change.
-Tue Nov 16 00:07:32 2010 Yusuke Endoh <mame@tsg.ne.jp>
+Sat Apr 6 13:13:39 2013 Tanaka Akira <akr@fsij.org>
- * gc.c (assign_heap_slot): fix fear of memory leak and memory
- violation. Coverity Scan found this bug.
+ * ext/socket/socket.c (rsock_sys_fail_path): Use rb_str_inspect only
+ for String to avoid SEGV.
-Mon Nov 15 23:54:45 2010 Yusuke Endoh <mame@tsg.ne.jp>
+Sat Apr 6 12:40:16 2013 Tanaka Akira <akr@fsij.org>
- * eval_intern.h (CHECK_STACK_OVERFLOW): it was not intended to add
- size_t to a pointer typed VALUE*. Coverity Scan found this defect.
+ * ext/socket/rubysocket.h (rsock_sys_fail_host_port): Wrap by NORETURN.
+ (rsock_sys_fail_path): Ditto.
+ (rsock_sys_fail_sockaddr): Ditto.
-Mon Nov 15 23:41:21 2010 Yusuke Endoh <mame@tsg.ne.jp>
+Sat Apr 6 11:49:35 2013 Tanaka Akira <akr@fsij.org>
- * compile.c (iseq_set_exception_local_table, iseq_set_local_table,
- rb_iseq_build_from_ary): fix type inconsistency (which is benign
- because sizeof(ID) == sizeof(ID*), though). Coverity Scan found
- these bugs.
+ * ext/socket/socket.c (rsock_sys_fail_path): Use rb_str_inspect if the
+ path contains a NUL.
-Mon Nov 15 22:47:27 2010 Yusuke Endoh <mame@tsg.ne.jp>
+Sat Apr 6 11:39:19 2013 Tanaka Akira <akr@fsij.org>
- * vm_eval.c (rb_funcall): ensure va_end after va_init_list. Coverity
- Scan found this bug.
+ * ext/socket: Improve socket exception message to show socket address.
+ [ruby-core:45617] [Feature #6583] proposed Eric Hodel.
-Mon Nov 15 08:36:12 2010 Aaron Patterson <aaron@tenderlovemaking.com>
+ * ext/socket/rubysocket.h (rsock_sys_fail_host_port): Declared.
+ (rsock_sys_fail_path): Ditto.
+ (rsock_sys_fail_sockaddr): Ditto.
- * lib/racc/parser.rb (do_parse, yyparse): using class eval to define
- method and avoid __send__.
+ * ext/socket/udpsocket.c (udp_connect): Use rsock_sys_fail_host_port.
+ (udp_bind): Ditto.
+ (udp_send): Ditto.
-Mon Nov 15 06:43:48 2010 Aaron Patterson <aaron@tenderlovemaking.com>
+ * ext/socket/init.c (rsock_init_sock): Specify a string for rb_sys_fail
+ argument.
+ (make_fd_nonblock): Ditto.
+ (rsock_s_accept): Ditto.
- * etc/openssl/ossl_ssl.c (ossl_ssl_get_cert): raise exception if
- pointer is invalid. Thanks Ippei Obayashi! [ruby-dev:42573]
+ * ext/socket/ipsocket.c (init_inetsock_internal): Use
+ rsock_sys_fail_host_port.
-Sun Nov 14 17:57:45 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * 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.
- * enc/Makefile.in (distclean): should not remove sources which are
- distributed in tarball.
+ * 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.
-Sun Nov 14 16:48:56 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * 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.
- * parse.y (parser_set_token_info): turn on/off with directives.
- [ruby-core:25442]
+Sat Apr 6 11:23:18 2013 Hiroshi Shirosaki <h.shirosaki@gmail.com>
-Sun Nov 14 12:05:24 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * test/ruby/test_require.rb (TestRequire#test_require_nonascii_path):
+ fix load path for encoding to run the test as stand-alone.
- * io.c (argf_readlines): forward to current_file for arguments
- check. http://twitter.com/nagachika/status/3634254856589312
+Sat Apr 6 09:54:20 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Sun Nov 14 08:48:06 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * pack.c (NATINT_LEN): fix definition order, must be after
+ NATINT_PACK.
- * win32/setup.mak (-basic-vars-, -runtime-): suppress trailing
- space and compiler command line.
+Sat Apr 6 03:11:07 2013 Aaron Patterson <aaron@tenderlovemaking.com>
-Sun Nov 14 04:22:32 2010 Alexander Zavorine <alexandre.zavorine@nokia.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
- * symbian/setup (config.h): Added HAVE_LABS and HAVE_LLABS to config.h.
+Sat Apr 6 02:54:08 2013 Aaron Patterson <aaron@tenderlovemaking.com>
- * symbian/configure.bat: Changed packaging version in line with API
- style 3 versioning.
+ * 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 Nov 13 16:37:56 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Sat Apr 6 02:30:28 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * common.mk (showflags, help): emit messages at once.
+ * parse.y (new_defined): remove all extra parentheses, and return
+ "nil" for defined? with empty expression.
+ [ruby-core:54024] [Bug #8224]
- * win32/Makefile.sub (MSG, EOM): remove surrounding quotes by %~I.
+Sat Apr 6 02:06:04 2013 Aaron Patterson <aaron@tenderlovemaking.com>
-Sat Nov 13 01:31:30 2010 Akio Tajima <artonx@yahoo.co.jp>
+ * ext/psych/lib/psych/visitors/to_ruby.rb: correctly register
+ self-referential strings. Fixes tenderlove/psych #135
- * win32/Makefile.sub: reorder variable End Of Message (don't display it)
+ * test/psych/test_string.rb: appropriate test.
-Fri Nov 12 20:52:34 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Sat Apr 6 01:21:56 2013 Tanaka Akira <akr@fsij.org>
- * common.mk (showflags, help): use caret to quote leading spaces on
- Windows.
+ * 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.
- * Makefile.in, common.mk, cygwin/GNUmakefile.in, enc/depend,
- ext/ripper/depend, lib/mkmf.rb, win32/Makefile.sub: caddle up.
+Sat Apr 6 00:19:30 2013 Hiroshi Shirosaki <h.shirosaki@gmail.com>
-Fri Nov 12 16:35:31 2010 NARUSE, Yui <naruse@ruby-lang.org>
+ * 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]
- * configure.in: support C level backtrace information on FreeBSD.
- When devel/libexecinfo is installed on FreeBSD, now ruby
- can show C level backtrace information.
- http://www.freebsd.org/cgi/cvsweb.cgi/ports/devel/libexecinfo/
+ * test/ruby/test_require.rb (TestRequire#test_require_nonascii_path):
+ a test for the above.
-Fri Nov 12 09:58:30 2010 NAKAMURA Usaku <usa@ruby-lang.org>
+Fri Apr 5 20:41:49 2013 Tanaka Akira <akr@fsij.org>
- * win32/setup.mak: use findstr.exe instead of find.exe, because all
- target build platforms should have findstr.exe, and, find.exe often
- means another command such as cygwin's.
+ * include/ruby/defines.h (HAVE_TRUE_LONG_LONG): Defined to distinguish
+ availability of long long and availability of 64bit integer type.
-Fri Nov 12 00:30:19 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * pack.c: Use HAVE_TRUE_LONG_LONG to distinguish q! and Q! support.
- * win32/Makefile.sub (config.h): need PRI_LL_PREFIX.
+Fri Apr 5 20:19:42 2013 Tanaka Akira <akr@fsij.org>
-Thu Nov 11 23:38:32 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * addr2line.c: Include ruby/missing.h to fix compile error on Debian.
- * configure.in: ANSI C-conforming const and volatile are mandatory
+Fri Apr 5 19:39:52 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * configure.in (AC_C_CONST, AC_C_INLINE, AC_C_VOLATILE): check
- before used in other checks.
+ * compile.c (iseq_compile_each): fix of defined? with empty
+ expression. [ruby-core:53999] [Bug #8220]
- * configure.in (RUBY_CHECK_PRINTF_PREFIX): should not break from
- RUBY_WERROR_FLAG, so that ac_c_werror_flag gets restored.
+Fri Apr 5 13:22:59 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Thu Nov 11 23:04:44 2010 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]
- * ext/iconv/iconv.c (warn_deprecated): show caller position.
+Fri Apr 5 12:06:00 2013 Zachary Scott <zachary@zacharyscott.net>
-Thu Nov 11 23:03:12 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * ext/curses/hello.rb: Typo in Curses example by Drew Blas
+ [Fixes GH-273]
- * io.c (argf_close): untie tied io before closing.
+Thu Apr 4 23:45:13 2013 Tanaka Akira <akr@fsij.org>
- * io.c (argf_write): add ARGF.write and so on.
+ * 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.
- * io.c (argf_read_nonblock): add ARGF.read_nonblock.
+Thu Apr 4 23:24:45 2013 Tanaka Akira <akr@fsij.org>
-Thu Nov 11 21:49:06 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * ext/socket/extconf.rb: Remove condition for bcc.
- * lib/rdoc/stats.rb (RDoc#print): get rid of NaN.
+Thu Apr 4 22:53:23 2013 Tanaka Akira <akr@fsij.org>
-Thu Nov 11 21:47:12 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * include/ruby/ruby.h (FIX2LONG): Parenthesize the macro body.
- * common.mk (SHOWFLAGS): show compile flags.
+Thu Apr 4 22:32:32 2013 Tanaka Akira <akr@fsij.org>
- * common.mk: hide long command lines by default. verbose-mode is
- turned on by V=1 as before.
- http://jarp.does.notwork.org/diary/200605b.html#200605121
+ * time.c (time_strftime): Describe %L and %N truncates digits under
+ the specified length.
+ [ruby-core:52130] [Bug #7829]
-Thu Nov 11 21:32:09 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Thu Apr 4 22:08:46 2013 Tanaka Akira <akr@fsij.org>
- * lib/mkmf.rb (try_func): accept variable address.
+ * object.c (rb_mod_cvar_set): Reverted "avoid inadvertent
+ symbol creation" to avoid SEGV by
+ Class.new.class_variable_set(1, 2).
- * ext/win32ole/extconf.rb: libuuid is needed on cygwin.
+Thu Apr 4 20:07:19 2013 Tanaka Akira <akr@fsij.org>
-Thu Nov 11 21:24:36 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * ext/pathname/pathname.c (path_write): New method.
+ (path_binwrite): Ditto.
+ [ruby-core:49468] [Feature #7378]
- * file.c (file_expand_path): use cygwin_conv_path on cygwin 1.7 or
- later.
+Thu Apr 4 16:51:29 2013 Yuki Yugui Sonoda <yugui@google.com>
- * ruby.c (push_include_cygwin): ditto.
+ * thread_pthread.c: Fixes wrong scopes of #if USE_SLEEPY_TIMER_THREAD
+ .. #endif sections. This fixes a build error on NativeClient.
-Thu Nov 11 20:49:48 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Wed Apr 3 17:25:31 2013 Yuki Yugui Sonoda <yugui@google.com>
- * include/ruby/ruby.h (PRI_LL_PREFIX): format type specifier for
- LONG_LONG may vary on platforms.
+ * thread_pthread.c (ruby_init_stack): Avoid using uninitialized value.
+ stackaddr and size are not set if get_stack() fails.
-Thu Nov 11 20:45:23 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Thu Apr 4 16:55:08 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * configure.in (SYMBOL_PREFIX): separate from EXPORT_PREFIX.
+ * struct.c (make_struct): avoid inadvertent symbol creation.
+ (rb_struct_aref): ditto.
+ (rb_struct_aset): ditto.
- * win32/mkexports.rb (Exports#each_export): use SYMBOL_PREFIX.
+Thu Apr 4 16:54:40 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Wed Nov 10 07:20:10 2010 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.
- * cygwin/GNUmakefile.in (scriptbin): make executable file from
- scripts with stub.
+Thu Apr 4 15:46:48 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * ruby.c (load_file_internal): assume xflag for exe file as well
- as no-shebang file.
+ * enum.c (enum_inject): avoid inadvertent symbol creation.
- * tool/rbinstall.rb: install script programs.
+Thu Apr 4 14:37:07 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * win32/mkexports.rb (Exports#initialize): alias ruby_sysinit for
- stub.
+ * thread.c (rb_thread_aref): avoid inadvertent symbol creation.
+ (rb_thread_variable_get): ditto.
+ (rb_thread_key_p): ditto.
+ (rb_thread_variable_p): ditto.
- * win32/stub.c: stub for scripts. [EXPERIMENTAL]
+Thu Apr 4 11:33:57 2013 NARUSE, Yui <naruse@ruby-lang.org>
-Tue Nov 9 21:57:45 2010 Nobuyoshi Nakada <nobu@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.
- * dln.c (init_funcname): allocate and build initialization
- funciton name at once.
+Thu Apr 4 07:24:18 2013 Tanaka Akira <akr@fsij.org>
-Tue Nov 9 21:14:54 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * ext/socket/extconf.rb: Specify arguments to test functions.
- * configure.in (AC_FUNC_GETPGRP, AC_FUNC_SETPGRP): no need when
- not used.
+Thu Apr 4 03:25:09 2013 NARUSE, Yui <naruse@ruby-lang.org>
- * configure.in (EXPORT_PREFIX): check generic prefix.
+ * ext/openssl/ossl_bn.c (ossl_bn_initialize): fix can't create from bn.
-Tue Nov 9 13:24:33 2010 NARUSE, Yui <naruse@ruby-lang.org>
+Wed Apr 3 22:09:25 2013 Tanaka Akira <akr@fsij.org>
- * regenc.c (onigenc_minimum_property_name_to_ctype):
- \p{...} should be case insensitive. [ruby-core:33000]
+ * ext/socket/extconf.rb: Test functions and libraries after headers.
- * regenc.c (onigenc_property_list_add_property):
- ditto.
+Wed Apr 3 21:23:29 2013 Tanaka Akira <akr@fsij.org>
- * enc/euc_jp.c (init_property_list, property_name_to_ctype):
- to lowercase property names.
+ * io.c (rb_io_seek_m): Accept :CUR, :END, :SET as "whence" argument.
+ (interpret_seek_whence): New function.
+ [ruby-dev:45818] [Feature #6643]
- * enc/shift_jis.c (init_property_list, property_name_to_ctype):
- ditto.
+Wed Apr 3 20:52:49 2013 Tanaka Akira <akr@fsij.org>
-Tue Nov 9 13:29:36 2010 NAKAMURA Usaku <usa@ruby-lang.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]
- * win32/win32.c (overlapped_socket_io): get rid of a warning of 64bit
- mingw.
+Wed Apr 3 20:27:37 2013 Tanaka Akira <akr@fsij.org>
-Tue Nov 9 10:44:19 2010 NARUSE, Yui <naruse@ruby-lang.org>
+ * ext/extmk.rb (extmake): Invoke Logging::log_close in a ensure
+ clause.
- * util.c (ruby_strtod): this code uses FPU's rounding system.
- But x86's FPU calculates double precision floating-point
- numbers in 80bit precision, so it fails to round the value.
- So ensure the value is assigned a variable. [ruby-dev:42551]
- see also [ruby-math:00802]
- http://www.shudo.net/java-grandprix99/strictfp/
+Wed Apr 3 18:53:58 2013 Tanaka Akira <akr@fsij.org>
-Tue Nov 9 07:30:15 2010 Nobuyoshi Nakada <nobu@ruby-lang.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.
- * error.c (rb_syserr_new): new function to make SystemCallError
- instance without errno. [EXPERIMENTAL]
+ * lib/mkmf.rb (Logging.log_opened?): New method.
- * error.c (rb_syserr_fail, rb_mod_syserr_fail): ditto.
+ [ruby-dev:47215] [Bug #8209]
-Tue Nov 9 05:54:57 2010 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
+Wed Apr 3 17:11:15 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * lib/*.rb: Remove unused variable warnings.
- Patch by Run Paint [ruby-core:30991]
+ * 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]
- * lib/rubygems/*, lib/rdoc/*.rb, lib/rake/*.rb: ditto
+Wed Apr 3 16:35:32 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Mon Nov 8 18:26:03 2010 NARUSE, Yui <naruse@ruby-lang.org>
+ * bignum.c (rb_big_eq): hide intermediate Bignums not just freeing
+ memory. [ruby-core:53893] [Bug #8204]
- * util.c (ruby_hdtoa): fix type cast and bufsize.
+ * object.c (rb_obj_hide): hide an object by clearing klass.
-Mon Nov 8 15:40:56 2010 NARUSE, Yui <naruse@ruby-lang.org>
+ * bignum.c (rb_big_eq): test as Fixnum if possible and get rid of zero
+ length Bignum. [ruby-core:53893] [Bug #8204]
- * vsnprintf.c (BSD_vfprintf): fix precision specifier doesn't
- work well on %f. [ruby-dev:42552]
+Tue Apr 2 23:56:03 2013 Tanaka Akira <akr@fsij.org>
-Mon Nov 8 14:41:40 2010 NAKAMURA Usaku <usa@ruby-lang.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]
- * win32/win32.c (get_wsa_extension_function): typos.
+Tue Apr 2 20:24:52 2013 Tanaka Akira <akr@fsij.org>
-Mon Nov 8 13:41:33 2010 NARUSE, Yui <naruse@ruby-lang.org>
+ * pack.c: Support Q! and q! for long long.
+ (natstr): Moved to toplevel. Add q and Q if there is long long type.
+ (endstr): Moved to toplevel.
+ (NATINT_PACK): Consider long long.
+ (NATINT_LEN_Q): New macro.
+ (pack_pack): Support Q! and q!.
+ (pack_unpack): Ditto.
+ [ruby-dev:43970] [Feature #3946]
- * tool/enc-unicode.rb,
- enc/unicode/name2ctype.h, enc/unicode/name2ctype.h.blt,
- enc/unicode/name2ctype.kwd, enc/unicode/name2ctype.src:
- Add Age property to regexp. [ruby-core:33019]
- patched by Ammar Ali, tested by Run Paint Run Run
+Tue Apr 2 19:24:26 2013 Tanaka Akira <akr@fsij.org>
-Mon Nov 8 12:16:39 2010 Ben Walton <bwalton@artsci.utoronto.ca>
+ * ext/-test-/num2int/num2int.c: Define utility methods
+ as module methods of Num2int.
- * configure.in: support -h for solaris linker when gcc not used
+ * test/-ext-/num2int/test_num2int.rb: Follow the above change.
-Mon Nov 8 11:47:39 2010 NAKAMURA Usaku <usa@ruby-lang.org>
+Tue Apr 2 18:49:01 2013 Tanaka Akira <akr@fsij.org>
- * win32/win32.c (finish_overlapped_socket): refactoring.
+ * lib/securerandom.rb: Don't use Array#to_s.
+ [ruby-core:52058] [Bug #7811] fixed by zzak (Zachary Scott).
-Mon Nov 8 11:02:21 2010 NAKAMURA Usaku <usa@ruby-lang.org>
+Tue Apr 2 17:38:20 2013 NARUSE, Yui <naruse@ruby-lang.org>
- * win32/win32.c (get_proc_address): refactoring.
+ * 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]
- * win32/win32.c (get_wsa_exetinsion_function): refactoring.
+Tue Apr 2 16:00:06 2013 NARUSE, Yui <naruse@ruby-lang.org>
-Mon Nov 8 09:45:35 2010 NARUSE, Yui <naruse@ruby-lang.org>
+ * vm_dump.c (rb_print_backtrace): separate to ease showing C backtrace.
- * enc/trans/gbk-tbl.rb: Add euro sign. [ruby-core:33094]
- CP936, which is de facto definition of GBK, has it.
- http://msdn.microsoft.com/en-us/goglobal/cc305153.aspx
+ * internal.h (rb_print_backtrace): ditto.
-Mon Nov 8 07:26:20 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Tue Apr 2 15:22:09 2013 NARUSE, Yui <naruse@ruby-lang.org>
- * configure.in: check only the first symbol to get rid of
- duplication. [ruby-core:33084] #4031
+ * test/ruby/envutil.rb (assert_separately): stop_auto_run of
+ Test::Unit::Runner to prevent auto runner use ARGV.
-Sun Nov 7 10:13:30 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * test/ruby/envutil.rb (assert_separately): add $: to separate process.
- * configure.in (NM): check on all platforms. #4031
+ * test/ruby/envutil.rb (assert_separately): fail if stderr is not
+ empty and ignore_stderr is false.
-Sun Nov 7 06:16:33 2010 Aaron Patterson <aaron@tenderlovemaking.com>
+Tue Apr 2 06:46:59 2013 Tanaka Akira <akr@fsij.org>
- * test/openssl/test_ocsp.rb: adding test for r29699. Thanks Elise
- Huard! [ruby-core:32460]
+ * ext/-test-/num2int/num2int.c: Rename utility methods
+ to global functions to ease manual experiments.
-Sat Nov 6 07:33:08 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * test/-ext-/num2int/test_num2int.rb: Follow the above change.
- * configure.in (rb_cv_export_prefix): check for prefixed
- underscore of exported symbols
+Mon Apr 1 22:26:17 2013 Tanaka Akira <akr@fsij.org>
- * tool/rbinstall.rb (bin-comm): prepend prolog shell script if
- necessary.
+ * 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.
- * configure.in (LIBRUBY_RELATIVE): use rpath token expansion.
+Mon Apr 1 22:08:02 2013 Benoit Daloze <eregontp@gmail.com>
-Sat Nov 6 07:24:01 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * ext/zlib/zlib.c (Zlib::Inflate.new):
+ Fix documentation syntax and naming errors.
+ Based on patch by Robin Dupret. Fix GH-271.
- * template/ruby.pc.in (arch, sitearch): reordered.
+Mon Apr 1 21:22:31 2013 Tanaka Akira <akr@fsij.org>
- * configure.in: keep failed file.
+ * test/-ext-/num2int/test_num2int.rb: Test small bignums.
-Sat Nov 6 07:03:49 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Mon Apr 1 21:10:56 2013 Tanaka Akira <akr@fsij.org>
- * process.c (rb_fork_err): save errinfo before fdopen.
+ * 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.
-Sat Nov 6 00:43:58 2010 Aaron Patterson <aaron@tenderlovemaking.com>
+Mon Apr 1 20:57:57 2013 Tanaka Akira <akr@fsij.org>
- * ext/openssl/ossl_ocsp.c (ossl_ocspcid_initialize): an optional
- parameter may be used to specify the OpenSSL::OCSP::CertificateId on
- initialization. Thanks Elise Huard! [ruby-core:32460]
+ * ext/-test-/num2int/num2int.c: Return string for result, instead of
+ printing.
-Fri Nov 5 12:23:01 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * test/-ext-/num2int/test_num2int.rb: updated to follow above change.
- * test/ruby/test_{process,system}.rb (test_fallback_to_sh):
- meaningless and wrong tests where /bin/sh does not exist.
+Mon Apr 1 20:08:07 2013 Tanaka Akira <akr@fsij.org>
- * process.c (proc_spawn_v): should spawn, not exec.
+ * numeric.c (rb_num2long): Don't use SIGNED_VALUE uselessly.
+ (check_int): Ditto.
+ (check_short): Ditto.
+ (rb_num2fix): Ditto.
+ (rb_num2ulong_internal): Add a cast.
-Fri Nov 5 01:21:31 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Mon Apr 1 18:41:35 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * process.c (proc_exec_v, proc_spawn_v): try to execute with sh if
- no shebang. [ruby-core:32745] [EXPERIMENTAL]
+ * configure.in: skip autoconf 2.64 and 2.66, 2.67 seems short-lived
+ but stick on it for Debian Squeeze.
-Fri Nov 5 00:39:00 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Mon Apr 1 14:22:52 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * io.c (rb_io_readlines, rb_io_each_line): limit must not be zero.
- a patch from Tomoyuki Chikanaga at [ruby-dev:42538]. #4024
+ * configure.in: check clang version by predefined macro values.
+ [Bug #8192]
-Fri Nov 5 00:14:15 2010 Aaron Patterson <aaron@tenderlovemaking.com>
+Mon Apr 1 12:05:15 2013 Tanaka Akira <akr@fsij.org>
- * ext/fiddle/extconf.rb: fixing ffi library location on windows.
- Thanks Usa! [ruby-core:32930]
+ * numeric.c (check_uint): Take the 1st argument as unsigned long,
+ instead of VALUE. Refine the validity test conditions.
+ (check_ushort): Ditto.
-Thu Nov 4 20:04:44 2010 Koichi Sasada <ko1@atdot.net>
+Mon Apr 1 07:15:03 2013 Ayumu AIZAWA <ayumu.aizawa@gmail.com>
- * gc.c (rb_newobj): force garbage_collect() if GC.stress == true.
+ * configure.in: use quadrigraph to put '[' or ']'. [Bug #8192]
-Thu Nov 4 19:48:22 2010 Koichi Sasada <ko1@atdot.net>
+Mon Apr 1 04:16:41 2013 NARUSE, Yui <naruse@ruby-lang.org>
- * ChangeLog: missed to write a last ChangeLog.
+ * configure.in: kick old clang. [ruby-dev:47204] [Bug #8192]
- * gc.c (gc_finalize_deferred): removed.
+Mon Apr 1 01:12:46 2013 Tanaka Akira <akr@fsij.org>
- * gc.c (rb_gc_finalize_deferred): Do not invoke a free_unused_heaps().
+ * include/ruby/ruby.h (FIX2ULONG): Make it consistent with NUM2ULONG.
-Thu Nov 4 19:45:27 2010 Koichi Sasada <ko1@atdot.net>
+ * ext/-test-/num2int/num2int.c: Add utility methods for FIX2XXX tests.
- * gc.c (run_final): do not need argument obj.
+ * test/-ext-/num2int/test_num2int.rb: Add tests for FIX2XXX.
-Thu Nov 4 19:26:10 2010 Koichi Sasada <ko1@atdot.net>
+Sun Mar 31 17:17:56 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * gc.c (before_gc_sweep): fix commit miss.
+ * proc.c (rb_mod_define_method): consider visibility in define_method.
+ patch by mashiro <mail AT mashiro.org>. fix GH-268.
-Thu Nov 4 19:20:46 2010 Koichi Sasada <ko1@atdot.net>
+Sun Mar 31 15:40:30 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * gc.c (after_gc_sweep, before_gc_sweep):
- invoke rb_sweep_method_entry() as soon as possible.
+ * win32/configure.bat: try to fix option arguments split by commas and
+ equals here. this batch file no longer run with old command.com.
-Thu Nov 4 19:13:58 2010 Koichi Sasada <ko1@atdot.net>
+ * tool/mkconfig.rb: no hacks for cmd.exe.
- * gc.c (after_gc_sweep, slot_sweep): finalizers should be invoked
- as soon as possible.
+Sun Mar 31 13:47:04 2013 Tanaka Akira <akr@fsij.org>
-Thu Nov 4 10:30:40 2010 URABE Shyouhei <shyouhei@ruby-lang.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.
- * configure.in (--with-valgrind): Now this option is default on.
- You can still explicitly disable this feature by specifying
- --without-valgrind.
+Sun Mar 31 06:27:17 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Thu Nov 4 02:06:16 2010 Yusuke Endoh <mame@tsg.ne.jp>
+ * 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]
- * cont.c (fiber_t_alloc): raise an error when fiber is going to be
- initialized twice. [ruby-dev:42524]
+Sat Mar 30 14:11:28 2013 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
-Thu Nov 4 02:04:25 2010 Yusuke Endoh <mame@tsg.ne.jp>
+ * bcc32: removed. agreed at
+ http://bugs.ruby-lang.org/projects/ruby/wiki/DevelopersMeeting20130223Japan
- * cont.c (rb_fiber_resume): raise an "double resume" error when root
- fiber is going to be resumed. [ruby-dev:42523]
+Sat Mar 30 03:58:00 2013 NAKAMURA Usaku <usa@ruby-lang.org>
-Wed Nov 3 14:17:18 2010 Nobuyoshi Nakada <nobu@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).
- * lib/ostruct.rb (OpenStruct#delete_field): also undefine
- accessor methods. [ruby-core:33010]
+Sat Mar 30 03:49:21 2013 NAKAMURA Usaku <usa@ruby-lang.org>
-Wed Nov 3 14:13:46 2010 Nobuyoshi Nakada <nobu@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).
- * string.c (rb_enc_cr_str_buf_cat): concatenation of valid
- encoding string and invalid encoding string should result
- invalid encoding. [ruby-core:33027]
+Fri Mar 29 22:09:46 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Wed Nov 3 08:58:59 2010 Koichi Sasada <ko1@atdot.net>
+ * thread.c (rb_mutex_synchronize_m): yield no block params. patch by
+ splattael (Peter Suschlik) in [ruby-core:53773] [Bug #8097].
+ fix GH-266.
- * gc.c, vm.c, vm_core.h: remove USE_VALUE_CACHE option.
+Fri Mar 29 16:51:39 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Wed Nov 3 07:47:25 2010 Yukihiro Matsumoto <matz@ruby-lang.org>
+ * io.c (argf_next_argv): set init flag if succeeded to forward, after
+ skipping.
- * lib/irb/ruby-lex.rb (RubyLex#identify_string): parse multiple
- regex options. a patch from Heesob Park in [ruby-core:32988].
+ * io.c (argf_block_call_i, argf_block_call): no more forwarding if
+ forwarded after skipping. [ruby-list:49185]
-Wed Nov 3 07:33:57 2010 Tanaka Akira <akr@fsij.org>
+ * io.c (argf_close): deal with init flag.
- * vm_method.c (rb_clear_cache_by_class): just return if the class has
- no method. reported by Eric Wong. [ruby-core:32689]
+ * io.c (argf_block_call_i, argf_block_call): forward next file if
+ skipped while iteration, to get rid of IOError. [ruby-list:49185]
-Tue Nov 2 22:50:25 2010 Aaron Patterson <aaron@tenderlovemaking.com>
+Fri Mar 29 11:09:48 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * ext/psych/lib/psych/visitors/visitor.rb (initialize): push accessor
- methods to subclass that actually uses them.
+ * lib/mkmf.rb (configuration): not include all CFLAGS in CXXFLAGS, to
+ use different set than C for C++. [ruby-core:45273] [Bug #6504]
-Tue Nov 2 22:47:08 2010 Aaron Patterson <aaron@tenderlovemaking.com>
+Fri Mar 29 10:24:10 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * ext/psych/lib/psych/visitors/visitor.rb (accept): switch to
- a dispatch cache rather than case / when statement.
+ * 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]
-Tue Nov 2 21:46:52 2010 Kouhei Sutou <kou@cozmixng.org>
+Fri Mar 29 06:39:42 2013 Tanaka Akira <akr@fsij.org>
- * NEWS: fix a typo.
+ * 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
-Tue Nov 2 20:10:32 2010 Tajima Akio <artonx@yahoo.co.jp>
+Fri Mar 29 00:54:54 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * test/rake/test_tasks.rb: clear env var which is used by the test.
- [ruby-dev:42508]
+ * lib/mkmf.rb (MAIN_DOES_NOTHING): ensure symbols for tests to be
+ preserved. [ruby-core:53745] [Bug #8169]
-Tue Nov 2 00:25:54 2010 NAKAMURA Usaku <usa@ruby-lang.org>
+Thu Mar 28 23:11:25 2013 Tanaka Akira <akr@fsij.org>
- * ext/socket/extconf.rb: win64 is just same with win32 about socket.
- notice: but wince is not same.
+ * 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.
-Mon Nov 1 21:25:57 2010 URABE Shyouhei <shyouhei@ruby-lang.org>
+Thu Mar 28 23:10:10 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * main.c: <stdlib.h> is needed, to introduce the getenv(3)
- prototype declaration. Without it a C compiler shall infer
- the getenv type as "int getenv(...);", but this is totally
- wrong, especially when your machine's sizeof(int) and
- sizeof(char*) differs. On such environment a return value
- of getenv(3), which is in fact a char*, might first casted
- into a int (loses data here), and then casted back to char*
- by automatic integral promotion to fit to the prototype of
- ruby_set_debug_option().
+ * include/ruby/io.h: rename SVR3,4 member names as POSIX compliant,
+ to get rid of conflict on AIX. [ruby-core:53765] [Bug #8174]
-Sun Oct 31 23:27:09 2010 Koichi Sasada <ko1@atdot.net>
+Thu Mar 28 18:22:21 2013 Tanaka Akira <akr@fsij.org>
- * gc.c (finalizer_table, objspace->final.table):
- Create finalizer_table at Init_heap().
- Remove all null checks of finalizer_table.
+ * test/-ext-/num2int/test_num2int.rb: extract
+ assert_num2i_success_internal and assert_num2i_error_internal and
+ provide assertion messages as "NUM2XXX(NNN)".
- * gc.c (mark_tbl): skip if no table entries.
+Thu Mar 28 07:05:25 2013 Tanaka Akira <akr@fsij.org>
- * gc.c (slot_swee): remove useless need_call_final check.
+ * include/ruby/intern.h: Delete redundant inclusions caused by
+ AC_INCLUDES_DEFAULT in defines.h.
-Sun Oct 31 22:32:08 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * include/ruby/defines.h: Ditto.
- * gc.c (rb_objspace_free): finalizers should be called separately
- from freeing objspace. [ruby-dev:42479]
+ * include/ruby/ruby.h: Ditto.
-Sun Oct 31 22:24:14 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * include/ruby/st.h: Ditto.
- * eval.c (ruby_cleanup): free current VM and its objspace even
- when exiting by SystemExit.
+Thu Mar 28 06:51:31 2013 Tanaka Akira <akr@fsij.org>
-Sun Oct 31 22:10:56 2010 Nobuyoshi Nakada <nobu@ruby-lang.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.
- * compile.c (new_child_iseq): adjust argument types.
+Wed Mar 27 22:09:14 2013 Tanaka Akira <akr@fsij.org>
- * iseq.c (prepare_iseq_build, rb_iseq_new),
- (rb_iseq_new_with_bopt_and_opt, rb_iseq_new_with_opt),
- (rb_iseq_new_with_bopt): ditto.
+ * 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.
- * compile.c (iseq_set_exception_table): suppress warnings.
+ * 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.
- * insns.def (putspecialobject, defined): ditto.
+Wed Mar 27 20:59:47 2013 Tanaka Akira <akr@fsij.org>
- * iseq.c (iseq_load): ditto.
+ * test/-ext-/num2int/test_num2int.rb (assert_num2i_success): New
+ utility method.
+ (assert_num2i_error): Ditto.
-Sun Oct 31 09:30:51 2010 Koichi Sasada <ko1@atdot.net>
+Wed Mar 27 20:37:59 2013 Tanaka Akira <akr@fsij.org>
- * vm_core.h: some refactoring.
- - move decl. of rb_compile_option_struct to iseq.h.
- - define enum iseq_type.
- - define enum vm_special_object_type.
+ * time.c (num_exact): Use to_r method only if to_int method is
+ available.
+ [ruby-core:53764] [Bug #8173] Reported by Hiro Asari.
- * compile.c: some refactoring.
- - apply above changes.
- - (struct iseq_link_element): change value of type.
- - remove unused decl.
- - fix comment.
- - rename iseq_build_body and iseq_build_exception to
- iseq_build_from_ary_body and iseq_build_from_ary_exception.
+Wed Mar 27 12:07:40 2013 Tanaka Akira <akr@fsij.org>
- * iseq.h: define enum catch_type and enum defined_type.
+ * test/-ext-/num2int/test_num2int.rb (test_num2ll): test LLONG_MIN,
+ not LONG_MIN.
- * insns.def: apply above changes.
+Wed Mar 27 12:02:45 2013 Tanaka Akira <akr@fsij.org>
- * iseq.c: define ISEQ_MAJOR_VERSION and ISEQ_MINOR_VERSION.
+ * internal.h (TIMET_MAX_PLUS_ONE): definition simplified.
-Sat Oct 30 23:38:59 2010 Kouhei Sutou <kou@cozmixng.org>
+Wed Mar 27 06:39:41 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * lib/rexml/encoding.rb: untabify.
+ * lib/mkmf.rb (MAIN_DOES_NOTHING): force to refer symbols for tests
+ to be preserved. [ruby-core:53745] [Bug #8169]
-Sat Oct 30 21:06:37 2010 Kouhei Sutou <kou@cozmixng.org>
+Wed Mar 27 05:15:37 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * lib/rexml/encoding.rb: use Ruby native encoding mechanism.
- [ruby-dev:42464]
- * lib/rexml/encodings/: remove.
+ * configure.in (RUBY_REPLACE_TYPE): define SIGNEDNESS_OF_type same as
+ check_signedness of mkmf.rb.
- * lib/rexml/document.rb, lib/rexml/formatters/default.rb,
- lib/rexml/output.rb, lib/rexml/parseexception.rb,
- lib/rexml/parsers/baseparser.rb, lib/rexml/source.rb,
- lib/rexml/xmldecl.rb: use Ruby's native Encoding object.
+ * internal.h (TIMET_MAX, TIMET_MIN, TIMET_MAX_PLUS_ONE): use
+ SIGNEDNESS_OF_TIME_T.
- * test/rexml/, test/rss/: follow the above encoding changes.
+Wed Mar 27 00:28:45 2013 Tanaka Akira <akr@fsij.org>
- * NEWS: add REXML's incompatible change about encoding.
+ * internal.h (TIMET_MAX_PLUS_ONE): Defined.
-Sat Oct 30 17:23:19 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * thread.c (double2timeval): Saturate out-of-range values.
- * util.c (ruby_strtod): get rid of overflow/underflow as possible.
+Tue Mar 26 23:41:18 2013 Tanaka Akira <akr@fsij.org>
-Sat Oct 30 14:37:39 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * internal.h: Define TIMET_MAX and TIMET_MIN here.
- * configure.in (ruby_pc): erase runtime-defined variables and
- check if generated pc file is valid.
+ * time.c: Remove TIMET_MAX and TIMET_MIN definitions.
- * template/ruby.pc.in (DEFFILE): need for mingw.
+ * thread.c: Ditto.
- * template/ruby.pc.in (LIBRUBY): fix the order.
+ * thread_pthread.c: Remove TIMET_MAX definition.
-Sat Oct 30 11:33:54 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * thread_win32.c: Ditto.
- * win32/Makefile.sub (ruby_pc): ignore missing variables.
+Tue Mar 26 22:31:10 2013 Tanaka Akira <akr@fsij.org>
- * template/ruby.pc.in: add missing variables for mswin.
+ * ext/socket/socket.c (sockaddr_len): return the shortest length for
+ unknown socket address.
-Sat Oct 30 10:24:35 2010 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
+Tue Mar 26 22:14:46 2013 Tanaka Akira <akr@fsij.org>
- * object.c: Make BasicObject.new accept no parameter.
- Revert of r26135 [ruby-core:27080], as per [ruby-core:32952].
+ * thread.c (double2timeval): convert the infinity to TIME_MAX to avoid
+ SEGV by Thread.new {}.join(Float::INFINITY) on
+ Debian GNU/Linux (amd64).
-Sat Oct 30 09:40:54 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Mon Mar 25 07:09:20 2013 Eric Hodel <drbrain@segment7.net>
- * enum.c: use constants in id.h.
+ * lib/rinda/tuplespace.rb: Only return tuple entry once on move,
+ either through port or regular return, not both. This results in a
+ 120% speedup when combined with #8125. Patch by Joel VanderWerf.
+ [ruby-trunk - Feature #8119]
-Sat Oct 30 09:08:27 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Mon Mar 25 06:59:01 2013 Eric Hodel <drbrain@segment7.net>
- * ext/fiddle/closure.c (fiddle_closure): embed cif not reference
- so that the content surely get initialized. [ruby-dev:42480]
+ * test/rinda/test_rinda.rb: Skip IPv6 tests if no IPv6 addresses
+ exist. Skip fork-dependent test if fork is not available.
+ [ruby-trunk - Bug #8159]
-Sat Oct 30 07:01:53 2010 Tanaka Akira <akr@fsij.org>
+Sun Mar 24 10:38:24 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
- * lib/resolv-replace.rb: suppress warning.
+ * addr2line.c (putce): suppress unused return value warning.
- * lib/open-uri.rb: ditto.
+Mon Mar 25 02:01:03 2013 Narihiro Nakamura <authornari@gmail.com>
-Sat Oct 30 06:32:52 2010 Tanaka Akira <akr@fsij.org>
+ * proc.c (bm_free): need to clean up the mark flag of a free and
+ unlinked method entry. [Bug #8100] [ruby-core:53439]
- * test/pathname/test_pathname.rb (TestPathname#test_grpowned?): the
- group of the created file is inherited from the parent
- directory on BSDs and MacOS X. Linux also inherit the group if
- the setgid bit of the directory is set. It causes the test fail.
- fixed by Shota Fukumori. [ruby-dev:42458]
+Sun Mar 24 22:13:51 2013 NARUSE, Yui <naruse@ruby-lang.org>
-Sat Oct 30 05:58:54 2010 Tanaka Akira <akr@fsij.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]
- * lib/resolv.rb: retry via TCP if UDP reply is truncated.
- fixed by Julian Mehnle. [ruby-core:32407]
+Sun Mar 24 18:29:46 2013 Akinori MUSHA <knu@iDaemons.org>
-Sat Oct 30 00:35:13 2010 Koichi Sasada <ko1@atdot.net>
+ * string.c (rb_str_rpartition): Fix String#rpartition(/re/)
+ against a multibyte string. [Bug #8138] [ruby-dev:47183]
- * iseq.c (iseq_s_compile): fix optional argument.
- a patch from Yutaka HARA [ruby-core:32953] [Ruby 1.9-Bug#4001]
+Sun Mar 24 13:42:24 2013 Narihiro Nakamura <authornari@gmail.com>
-Sat Oct 30 00:24:42 2010 Koichi Sasada <ko1@atdot.net>
+ * gc.c (GC_ENABLE_LAZY_SWEEP): new macro to switch lazy sweeping
+ for debugging. [Feature #8024] [ruby-dev:47135]
- * ext/objspace/objspace.c (memsize_of): take care of
- T_CLASS/const_tbl.
- a patch from nagachika <nagachika00@gmail.com> [ruby-dev:42490]
+Sun Mar 24 12:55:47 2013 Narihiro Nakamura <authornari@gmail.com>
-Fri Oct 29 23:32:36 2010 Koichi Sasada <ko1@atdot.net>
+ * 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.
- * test/profile_test_all.rb: added.
- You can use test-all profiler with the following command:
- RUBY_TEST_ALL_PROFILE=true make test-all
- This command generates ./test_all_profile and you can analyze
- which tests consume memories.
+Sun Mar 24 11:03:31 2013 Tanaka Akira <akr@fsij.org>
- * test/runner.rb: ditto.
+ * test/ruby/test_require.rb: Remove temporally files in the tests.
-Fri Oct 29 10:02:03 2010 NARUSE, Yui <naruse@ruby-lang.org>
+ * test/ruby/test_rubyoptions.rb: Ditto.
- * tool/enc-unicode.rb,
- enc/unicode/name2ctype.h, enc/unicode/name2ctype.h.blt,
- enc/unicode/name2ctype.kwd, enc/unicode/name2ctype.src:
- Add 'Unknown' Script.
- patched by Run Paint Run Run. [ruby-core:32937] #3998
+ * test/logger/test_logger.rb: Ditto.
-Fri Oct 29 05:13:34 2010 Koichi Sasada <ko1@atdot.net>
+ * test/psych/test_psych.rb: Ditto.
- * ext/objspace/objspace.c (ObjectSpace.memsize_of_all): rename
- ObjectSpace.total_memsize_of_all_objects() to
- ObjectSpace.memsize_of_all([klass]).
- Accept Class object to filter the objects.
+ * test/readline/test_readline.rb: Ditto.
- * test/objspace/test_objspace.rb: fix test for above change.
+ * test/syslog/test_syslog_logger.rb: Ditto.
-Fri Oct 29 03:04:16 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * test/webrick/test_httpauth.rb: Ditto.
- * string.c (rb_str_dump): fix expected length. [ruby-core:32935]
+ * test/zlib/test_zlib.rb: Ditto.
-Thu Oct 28 23:31:39 2010 Koichi Sasada <ko1@atdot.net>
+Sun Mar 24 05:36:29 2013 Eric Hodel <drbrain@segment7.net>
- * gc.c (before_gc_sweep, run_final): fix decrement timing of final_num.
+ * lib/rinda/ring.rb: Added documentation for multicast support.
-Thu Oct 28 20:11:30 2010 NARUSE, Yui <naruse@ruby-lang.org>
+ * NEWS: Point to above documentation.
- * tool/enc-unicode.rb,
- enc/unicode/name2ctype.h, enc/unicode/name2ctype.h.blt,
- enc/unicode/name2ctype.kwd, enc/unicode/name2ctype.src:
- Update Oniguruma for Unicode 6.
- patched by Run Paint Run Run. [ruby-core:32923] #3989
+Sun Mar 24 05:32:39 2013 Eric Hodel <drbrain@segment7.net>
-Thu Oct 28 20:06:25 2010 NARUSE, Yui <naruse@ruby-lang.org>
+ * test/rinda/test_rinda.rb: Restore tests commented out while fixing
+ test slowdown bug before r39895.
- * include/ruby/oniguruma.h (ONIGENC_CTYPE_SPECIAL_MASK):
- change mask from 128 to 256. [ruby-core:32931]
+Sun Mar 24 05:03:36 2013 Eric Hodel <drbrain@segment7.net>
-Thu Oct 28 12:06:54 2010 NARUSE, Yui <naruse@ruby-lang.org>
+ * 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.
- * lib/webrick/httprequest.rb (read_request_line): extend max
- length to 2083. This is from Internet Explorer's max uri
- length. http://support.microsoft.com/kb/208427 [ruby-core:32924]
+ * NEWS: Update with Rinda multicast support
-Thu Oct 28 04:00:08 2010 Koichi Sasada <ko1@atdot.net>
+Sun Mar 24 04:13:27 2013 Eric Hodel <drbrain@segment7.net>
- * gc.c (GC.stat): added. [ruby-dev:38607]
+ * test/rinda/test_rinda.rb: Fixed test failures in r39890 and r39891
+ due to stopping DRb service.
- * test/ruby/test_gc.rb: add a test for above.
+Sun Mar 24 03:34:02 2013 Eric Hodel <drbrain@segment7.net>
-Thu Oct 28 03:13:06 2010 Koichi Sasada <ko1@atdot.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.
- * ext/objspace/objspace.c (memsize_of): fix rdoc.
+Sun Mar 24 02:14:53 2013 Tanaka Akira <akr@fsij.org>
- * ext/objspace/objspace.c (total_memsize_of_all_objects): added.
+ * test/mkmf/test_have_macro.rb: remove temporally files in the tests.
- * test/objspace/test_objspace.rb:
- - add a test for ObjectSpace.total_memsize_of_all_objects.
- - add two tests for ObjectSpace.memsize_of (for nil and Fixnum).
+Sat Mar 23 23:50:04 2013 NARUSE, Yui <naruse@ruby-lang.org>
-Wed Oct 27 23:55:27 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * addr2line.c (kprintf): added from FreeBSD libstand's printf.
+ this is consided as async signal safe function.
- * ext/iconv/iconv.c (Init_iconv): warn deprecated use.
+ * addr2line.c (rb_dump_backtrace_with_lines): use kfprintf.
+ [Bug #8144] [ruby-core:53632]
-Wed Oct 27 18:50:17 2010 NAKAMURA Usaku <usa@ruby-lang.org>
+Sat Mar 23 23:28:00 2013 Kenta Murata <mrkn@mrkn.jp>
- * bignum.c (rb_big2long, rb_big2ulong): rb2ulong() returns VALUE, but
- its real range is ulong. So, if the size of VALUE is bigger than
- ulong, upper bits are always zero even if the actual value is
- negative.
- fixed #3490
+ * ext/bigdecimal/bigdecimal.c (BigDecimal_divide): Use Qnil and NIL_P
+ instead of (VALUE)0 as a return value.
-Wed Oct 27 18:27:17 2010 NAKAMURA Usaku <usa@ruby-lang.org>
+ * ext/bigdecimal/bigdecimal.c (BigDecimal_div): ditto.
- * test/ruby/test_io.rb (TestIO#pipe): should close write end of pipe
- before closing read end, to get rid of timing problem.
+ * ext/bigdecimal/bigdecimal.c (BigDecimal_divremain): ditto.
- * test/ruby/test_io_m17n.rb (TestIO_M17N#pipe): ditto.
+ * ext/bigdecimal/bigdecimal.c (BigDecimal_remainder): ditto.
-Wed Oct 27 18:14:27 2010 NAKAMURA Usaku <usa@ruby-lang.org>
+Sat Mar 23 17:39:49 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * win32/win32.c (rb_w32_getppid): support Win64.
+ * 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]
-Wed Oct 27 15:07:19 2010 NAKAMURA Usaku <usa@ruby-lang.org>
+Fri Mar 22 17:48:34 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * thread_win32.c (w32_error): should get error no only once, because
- the result of the second getting will indicate the error of the
- first FormatMessage() call.
+ * 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].
-Wed Oct 27 13:51:25 2010 NAKAMURA Usaku <usa@ruby-lang.org>
+Fri Mar 22 17:38:42 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * test/ruby/test_io.rb (TestIO#pipe): need to propagate exceptions
- in read/write thread. fix r29541.
+ * 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]
- * test/ruby/test_io_m17n.rb (TestIO_M17N#pipe): ditto.
+Fri Mar 22 10:29:00 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Wed Oct 27 12:05:40 2010 NAKAMURA Usaku <usa@ruby-lang.org>
+ * ext/bigdecimal/bigdecimal.c: Fix style.
- * class.c (clone_const): need to return value. fix r29602.
+Fri Mar 22 05:30:49 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Wed Oct 27 11:58:58 2010 NAKAMURA Usaku <usa@ruby-lang.org>
+ * parse.y (ambiguous_operator): refine warning message, since this
+ warning is shown after literal too.
- * include/ruby/ruby.h (NUM2LONG_internal): add cast to get rid of a
- non GCC compiler warning. this is intentional type conversion.
+Fri Mar 22 04:51:14 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Wed Oct 27 09:25:46 2010 NARUSE, Yui <naruse@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]
- * cont.c: apply documentation patch by Run Paint Run Run.
- [ruby-core:32915]
+Fri Mar 22 01:00:17 2013 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
-Wed Oct 27 02:12:10 2010 Yusuke Endoh <mame@tsg.ne.jp>
+ * process.c (rb_execarg_addopt, run_exec_pgroup): use rb_pid_t
+ instead of pid_t.
- * object.c (Init_Object), constant.h, variable.c
- (rb_mod_private_constant, rb_mod_public_constant,
- set_const_visibility, rb_const_get_0): add Module#public_constant
- and private_constant. [ruby-dev:39685][ruby-core:32698]
+ * ext/pty/pty.c (raise_from_check, pty_check): ditto.
- * test/ruby/test_module.rb: add tests for above.
+Fri Mar 22 00:04:15 2013 NARUSE, Yui <naruse@ruby-lang.org>
-Wed Oct 27 02:02:54 2010 Yusuke Endoh <mame@tsg.ne.jp>
+ * addr2line.c (rb_dump_backtrace_with_lines): output line at once.
- * class.c, constant.h, gc.c, method.h, object.c, variable.c,
- vm_insnhelper.c: use struct rb_constant_entry_t as entry of
- RCLASS_CONST_TBL. RCLASS_CONST_TBL has contained VALUE of constant
- directly. Now instead rb_const_entry_t is contained in
- RCLASS_CONST_TBL, rb_const_entry_t is managed by malloc, and
- have not only the value itself but also visibility flag.
- This is another preparation for private constant (see
- [ruby-dev:39685][ruby-core:32698]).
+Thu Mar 21 23:17:08 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Wed Oct 27 01:56:34 2010 Yusuke Endoh <mame@tsg.ne.jp>
+ * thread.c (ruby_kill): get rid of deadlock on signal 0.
+ [ruby-dev:47182] [Bug #8137]
- * class.c, gc.c, object.c, variable.c, vm_insnhelper.c,
- include/ruby/ruby.h: separate RCLASS_CONST_TBL from RCLASS_IV_TBL.
- RCLASS_IV_TBL has contained not only instance variable table but
- also constant table. Now the two table are separated to
- RCLASS_CONST_TBL and RCLASS_IV_TBL. This is a preparation for
- private constant (see [ruby-dev:39685][ruby-core:32698]).
+Thu Mar 21 22:39:46 2013 Naohisa Goto <ngotogenome@gmail.com>
-Tue Oct 26 18:51:00 2010 NARUSE, Yui <naruse@ruby-lang.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]
- * lib/scanf.rb (extract_float): allow 2.e+2 style.
- [ruby-dev:42452] #3978
+Thu Mar 21 16:48:06 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Tue Oct 26 18:09:36 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * parse.y (simple_re_meta): escape all closing characters, not only
+ round parenthesis. [ruby-core:53578] [Bug #8133]
- * Makefile.in (ASFLAGS): needs INCFLAGS.
+Thu Mar 21 13:50:46 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * configure.in (rb_cv_dynamic_alloca): check if extra source for
- dynamic size alloca.
+ * vm_core.h (UNINITIALIZED_VAR): suppress warnings by clang 4.2.
+ [ruby-core:51742] [Bug #7756]
- * missing/x86_64-chkstk.s (___chkstk): necessary for alloca of
- amd64-mingw32msvc-gcc on Ubuntu.
+Thu Mar 21 07:34:00 2013 Zachary Scott <zachary@zacharyscott.net>
- * thread_win32.c (ruby_alloca_chkstk): check stack overflow
+ * ext/date/date_core.c: Typo in Date::MONTHNAMES by Matt Gauger
+ [GH fixes #261]
-Tue Oct 26 18:04:53 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Wed Mar 20 22:53:14 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * template/ruby.pc.in (Libs): needs DLDFLAGS.
+ * lib/mkmf.rb (find_library): fix to format message.
+ [ruby-core:53568] [Bug #8130]
-Tue Oct 26 12:47:10 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Wed Mar 20 22:52:52 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * common.mk (pkgconfig-data): moved from Makefile.in.
+ * lib/mkmf.rb (install_dirs, with_destdir): prefix with DESTDIR
+ directories to install only unless bundled extension libraries.
+ [ruby-core:53502] [Bug #8115]
- * tool/rbinstall.rb: install pc file only if non-empty.
- [ruby-core:32901] #3983
+Wed Mar 20 17:47:53 2013 NAKAMURA Usaku <usa@ruby-lang.org>
- * win32/Makefile.sub (ruby_pc): create pc file.
+ * 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.
-Tue Oct 26 09:13:34 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Wed Mar 20 16:40:48 2013 Hiroshi Shirosaki <h.shirosaki@gmail.com>
- * configure.in (rb_cv_gcc_atomic_builtins): check for atomic
- builtins, all are not available in Apple derivative gcc.
+ * test/ruby/test_signal.rb (test_hup_me): skip if HUP isn't supported.
+ On Windows this test causes ArgumentError.
-Tue Oct 26 00:29:26 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Wed Mar 20 16:24:12 2013 Hiroshi Shirosaki <h.shirosaki@gmail.com>
- * Makefile.in (pkgconfig-data): create pkg-config metadata file.
+ * 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]
- * tool/rbinstall.rb: install pkg-config metadata file.
+Wed Mar 20 15:22:07 2013 NAKAMURA Usaku <usa@ruby-lang.org>
- * template/ruby.pc.in: template of pkg-config metadata file.
+ * test/win32ole/test_err_in_callback.rb (TestErrInCallBack#setup): use
+ relative path to get rid of "too long commandline" error.
-Mon Oct 25 16:38:07 2010 URABE Shyouhei <shyouhei@ruby-lang.org>
+Wed Mar 20 04:27:42 2013 Ayumu AIZAWA <ayumu.aizawa@gmail.com>
- * signal.c (rb_atomic_t): GCC (of at least recent versions)
- has ubiquitous support for atomic operations. On that
- compiler a C program can issue a memory barrier using these
- dedicated instructions. According to the GCC manual they
- cargo culted this feature form the Itanium ABI so chances
- are that other compilers could also support this feature.
- But so far GCC is the only compiler that I know to have it.
- Also note that this works on non-Itanium machines.
+ * test/rinda/test_rinda.rb: remove unused variables.
+ patched by Vipul A M <vipulnsward@gmail.com>
-Mon Oct 25 06:21:35 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Wed Mar 20 04:15:32 2013 Ayumu AIZAWA <ayumu.aizawa@gmail.com>
- * vsnprintf.c (BSD_vfprintf): prec digits fractal part should be
- appended to 0 if prec is given. [ruby-dev:42453] #3979
+ * ext/bigdecimal/bigdecimal.c: fixed typo.
+ patched by Vipul A M <vipulnsward@gmail.com>
-Mon Oct 25 02:57:21 2010 Koichi Sasada <ko1@atdot.net>
+Sat Mar 16 03:40:49 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
- * common.mk (run.gdb): Quit gdb on 'make gdb' when
- no signals are received.
+ * test/ruby/test_signal.rb (test_hup_me): added a few comments.
-Mon Oct 25 00:25:23 2010 Tadayoshi Funaba <tadf@dotrb.org>
+Sat Mar 16 03:39:38 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
- * lib/date.rb: some corrections of documentation.
+ * thread.c (ruby_kill): added a few comments.
-Sun Oct 24 17:14:00 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Sat Mar 16 03:36:56 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
- * array.c, gc.c, hash.c, object.c, string.c, struct.c,
- transcode.c, variable.c, vm.c, vm_insnhelper.c, vm_method.c:
- replace calls to rb_error_frozen() with rb_check_frozen(). a
- patch from Run Paint Run Run at [ruby-core:32014]
+ * thread.c (ruby_kill): release GVL while waiting signal delivered.
- * include/ruby/intern.h (rb_check_frozen): optimize.
- [ruby-core:32878]
+Tue Mar 19 19:50:48 2013 NAKAMURA Usaku <usa@ruby-lang.org>
-Sun Oct 24 15:16:30 2010 Nobuyoshi Nakada <nobu@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.
- * lib/test/unit.rb (Test::Unit::Mini#run): abort if interrupted.
+Tue Mar 19 17:09:30 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * lib/test/unit.rb (Test::Unit::Mini#run_test_suites): show the
- result even when interrupted on the way.
+ * string.c (rb_str_conv_enc_opts): convert with one converter, instead
+ of re-creating converters for each buffer expansion.
- * lib/test/unit.rb (Test::Unit::Mini#run_test_suites): ensure
- output sync mode to be restored.
+Tue Mar 19 17:06:50 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Sun Oct 24 14:11:16 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * dir.c (glob_helper): compose HFS file names from UTF8-MAC.
+ [ruby-core:48745] [Bug #7267]
- * vm.c (vm_define_method): defined method is run with the default
- public visibility regardless the visibility context of definition.
- [ruby-core:30638]
+Sat Mar 16 01:44:29 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-Sun Oct 24 12:08:54 2010 Aaron Patterson <aaron@tenderlovemaking.com>
+ * internal.h: added a declaration of ruby_kill().
+ * thread.c (ruby_kill): helper function of kill().
- * lib/test/unit.rb: make test/unit play nicely with the rake test
- loader. [ruby-core:32864]
+ * 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]
-Sun Oct 24 00:25:13 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * 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_rubyoptions.rb (test_segv_test): follow up the
- change at r29556.
+ * test/ruby/test_signal.rb (TestSignal#test_hup_me): test for
+ the above.
-Sat Oct 23 14:39:58 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Sat Mar 16 00:42:39 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
- * lib/mkmf.rb: $extmk should be true for test/runner.
+ * io.c (linux_iocparm_len): enable only exist _IOC_SIZE().
+ Because musl libc doesn't have it. [Bug #8051] [ruby-core:53229]
-Sat Oct 23 10:55:37 2010 Koichi Sasada <ko1@atdot.net>
+Tue Mar 19 10:05:04 2013 Shota Fukumori <her@sorah.jp>
- * vm_dump.c (rb_vm_bugreport): fix to add bug outputs.
- - loaded script ($0)
- - loaded features ($")
- - process memory map on Linux (/proc/self/maps)
+ * ext/objspace/objspace.c: Fix typo in doc. Patch by Sho Hashimoto.
+ [Bug #8116] [ruby-dev:47177]
- * vm_dump.c (rb_vmdebug_stack_dump_raw): fix header message.
+Tue Mar 19 02:13:00 2013 Kenta Murata <mrkn@mrkn.jp>
-Fri Oct 22 14:50:13 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * configure.in: set ac_cv_prog_cxx if CXX is supplied.
- * lib/test/unit/assertions.rb (Test::Unit::Assertions#assert):
- assertion message must not be nil.
+Tue Mar 19 01:18:00 2013 Kenta Murata <mrkn@mrkn.jp>
-Fri Oct 22 13:59:50 2010 NARUSE, Yui <naruse@ruby-lang.org>
+ * configure.in: Fix c++ compiler auto-selection not only for
+ Darwin 11.x, but also the other versions of Darwin.
- * lib/test/unit/assertions.rb (Test::Unit::Assertions#assert):
- treat nil case. Please run test-all before commit such change.
+Tue Mar 19 00:26:22 2013 Narihiro Nakamura <authornari@gmail.com>
-Thu Oct 21 23:58:14 2010 Koichi Sasada <ko1@atdot.net>
+ * gc.c: Improve accuracy of objspace_live_num() and
+ allocated/freed counters. patched by tmm1(Aman Gupta).
+ [Bug #8092] [ruby-core:53392]
- * gc.c (gc_lazy_sweep): Variable declarations should be at
- the head of block.
+Mon Mar 18 21:42:48 2013 Narihiro Nakamura <authornari@gmail.com>
-Thu Oct 21 23:56:54 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * gc.c: Avoid unnecessary heap growth. patched by tmm1(Aman Gupta).
+ [Bug #8093] [ruby-core:53393]
- * gc.c (objspace_each_objects, rb_objspace_each_objects): use
- struct.
+Mon Mar 18 17:58:36 2013 Narihiro Nakamura <authornari@gmail.com>
- * gc.c (objspace_each_objects): fix return with no value.
+ * gc.c: Fix unlimited memory growth with large values of
+ RUBY_FREE_MIN. patched by tmm1(Aman Gupta).
+ [Bug #8095] [ruby-core:53405]
-Thu Oct 21 23:47:12 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Mon Mar 18 14:46:19 2013 NAKAMURA Usaku <usa@ruby-lang.org>
- * dir.c (dir_initialize): remove useless intermediate variable.
+ * test/win32ole/test_err_in_callback.rb
+ (TestErrInCallBack#test_err_in_callback): shouldn't create a file in
+ the top of build directory.
-Thu Oct 21 16:07:20 2010 NARUSE, Yui <naruse@ruby-lang.org>
+Mon Mar 18 13:29:52 2013 NARUSE, Yui <naruse@ruby-lang.org>
- * io.c (rb_f_select): change rdoc.
- patched by Eito Katagiri [ruby-core:31805]
+ * vm_dump.c (backtrace): on darwin use custom backtrace() to trace
+ beyond _sigtramp. darwin's backtrace can't trace beyond signal
+ trampoline with sigaltstack.
-Thu Oct 21 15:55:21 2010 NARUSE, Yui <naruse@ruby-lang.org>
+ * configure.in: check execinfo.h on darwin.
- * lib/webrick/httpauth/digestauth.rb
- (WEBrick::HTTPAuth::ProxyDigestAuth#check_uri): privated.
- [ruby-dev:42344]
+Mon Mar 18 11:03:23 2013 NARUSE, Yui <naruse@ruby-lang.org>
-Thu Oct 21 15:50:25 2010 NARUSE, Yui <naruse@ruby-lang.org>
+ * vm_exec.h (END_INSN): revert r39517 because the segv seems fixed by
+ r39806.
- * io.c (rb_f_select): add correct rdoc.
- patched by Dave Thomas [ruby-core:32467]
+Mon Mar 18 10:41:06 2013 NARUSE, Yui <naruse@ruby-lang.org>
-Thu Oct 21 15:42:01 2010 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.
- * lib/net/telnet.rb (Net::Telnet#close): added.
- patched by Erik Hollensbe [ruby-dev:42260] #3830
+Mon Mar 18 03:18:00 2013 Zachary Scott <zachary@zacharyscott.net>
-Thu Oct 21 13:08:00 2010 Narihiro Nakamura <authornari@gmail.com>
+ * array.c: Typo in Array#delete by Timo Sand [GH fixes #258]
- * gc.c (rb_objspace_each_objects): don't lazy sweep in
- rb_objspace_each_objects. [Bug #3940] [ruby-dev:42369]
+Mon Mar 18 01:14:56 2013 NARUSE, Yui <naruse@ruby-lang.org>
-Thu Oct 21 00:05:45 2010 Nobuyoshi Nakada <nobu@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
- * test/ruby/test_io.rb (TestIO#pipe): get rid of deadlock on pipe.
- a patch from Tomoyuki Chikanaga at [ruby-dev:42435]. #3970
+Sun Mar 17 02:38:21 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
- * test/ruby/test_io_m17n.rb (TestIO_M17N#pipe): ditto.
+ * ext/date/date_core.c: include sys/time.h for avoiding implicit
+ declaration of gettimeofday().
-Wed Oct 20 23:54:36 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Sun Mar 17 00:55:31 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
- * ext/dbm/dbm.c: rdoc based on a patch by mathew meta AT
- pobox.com, at [ruby-core:32853].
+ * include/ruby/missing.h: removed __linux__. it's unnecessary.
-Wed Oct 20 10:47:21 2010 NARUSE, Yui <naruse@ruby-lang.org>
+Fri Mar 15 14:57:16 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
- * util.c (ruby_strtod): reject 0x1.p+0. [ruby-dev:42432] #3966
+ * 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 Oct 20 10:00:57 2010 NARUSE, Yui <naruse@ruby-lang.org>
+Wed Mar 13 15:16:35 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
- * vsnprintf.c (BSD_vfprintf): print floating point on "%#a".
- [ruby-dev:42431] Bug#3965
+ * include/ruby/missing.h (__syscall): moved to...
+ * io.c: here. because __syscall() is only used from io.c.
-Tue Oct 19 19:30:11 2010 NARUSE, Yui <naruse@ruby-lang.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].
- * vsnprintf.c (BSD_vfprintf): clear ALT flag for %a.
- [ruby-core:32841] [ruby-core:32848]
+Wed Mar 13 14:38:53 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-Tue Oct 19 12:19:25 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * include/ruby/missing.h (struct timespec): include <sys/time.h>
- * vsnprintf.c (BSD_vfprintf): fix over-count of field size.
+Wed Mar 13 13:54:45 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-Tue Oct 19 03:08:52 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * configure.in: check struct timeval exist or not.
+ * include/ruby/missing.h (struct timeval): check HAVE_STRUCT_TIMEVAL
+ properly. and don't include sys/time.h if struct timeval exist.
- * vsnprintf.c (BSD_vfprintf): use HEXPREFIX flag for prefix of %a.
- [ruby-core:32841]
+ * file.c: include sys/time.h explicitly.
+ * random.c: ditto.
+ * thread_pthread.c: ditto.
+ * time.c: ditto.
+ * ext/date/date_strftime.c: ditto.
-Mon Oct 18 13:18:01 2010 Akinori MUSHA <knu@iDaemons.org>
+Fri Mar 15 14:45:02 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
- * ext/digest/digest.c (rb_digest_class_init): Define
- Digest::Class.new(). [Feature #3954]
+ * configure.in (_FORTIFY_SOURCE): added a few comments.
-Mon Oct 18 12:58:40 2010 Tanaka Akira <akr@fsij.org>
+Fri Mar 15 14:17:55 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
- * pack.c (pack_pack): refine the document. [ruby-dev:42397]
- (pack_unpack): ditto.
+ * thread_pthread.c (numberof): renamed from ARRAY_SIZE() because
+ other all files use numberof().
-Mon Oct 18 10:19:00 2010 NARUSE, Yui <naruse@ruby-lang.org>
+Say Mar 15 01:33:00 2013 Charles Oliver Nutter <headius@headius.com>
- * lib/net/http.rb (transport_request): @socket may be nil.
- patched by Egbert Eich [ruby-core:32829]
+ * 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.
-Mon Oct 18 09:57:28 2010 NARUSE, Yui <naruse@ruby-lang.org>
+Fri Mar 15 23:06:18 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * sprintf.c (BSD_vfprintf): wrong padding around prefix and
- floating point with %a. [ruby-dev:42403] Bug #3956
+ * time.c (GetTimeval): check if already initialized instance.
-Sun Oct 17 22:36:33 2010 Tadayoshi Funaba <tadf@dotrb.org>
+ * time.c (GetNewTimeval): check if newly created instance.
- * lib/date/delta.rb: added an rdoc tag.
+ * time.c (time_init_0, time_init_1, time_init_copy, time_mload): must
+ be newly created instance. [ruby-core:53436] [Bug #8099]
-Sun Oct 17 10:47:12 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Fri Mar 15 14:51:33 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * variable.c (rb_mod_remove_const): update rdoc.
- [ruby-core:31957]
+ * file.c (rb_sys_fail_path_with_func): share same function, and path
+ may be nil.
-Sun Oct 17 10:40:17 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Fri Mar 15 08:24:51 2013 NARUSE, Yui <naruse@ruby-lang.org>
- * class.c (rb_define_{class,module}_id_under): register to be
- marked, which probably are defined and used internally.
+ * io.c (rb_sys_fail_path): define & use rb_sys_fail_path0 like r39752
-Sat Oct 16 11:10:55 2010 Masaki Suketa <masaki.suketa@nifty.ne.jp>
+Fri Mar 15 04:08:00 2013 Zachary Scott <zachary@zacharyscott.net>
- * ext/win32ole/win32ole.c (ole_encoding2cp): set codepage 20936
- according to GB2312. [Bug #3937] [ruby-core:32758]
+ * proc.c: Typo in Proc.arity found by Jack Nagel [Bug #8094]
-Sat Oct 16 10:54:57 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Thu Mar 14 16:59:09 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * Makefile.in (CPP): already used in .c.i rule.
+ * configure.in (rb_cv_function_name_string): macro for function name
+ string predefined identifier, __func__ in C99, or __FUNCTION__ in
+ gcc.
- * cygwin/GNUmakefile.in (DLLWRAP, WINDRES): add --driver-name and
- --preprocessor options explicitly. [ruby-core:32776]
+ * file.c (rb_sys_fail_path): use RUBY_FUNCTION_NAME_STRING.
-Sat Oct 16 10:06:08 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Thu Mar 14 14:12:34 2013 NARUSE, Yui <naruse@ruby-lang.org>
- * ext/sdbm/_sdbm.c (SEEDUPS, BADMESS): make settable using command
- line options.
+ * file.c (rb_sys_fail_path): use rb_sys_fail_path0 only on GCC.
+ __func__ is C99 feature.
- * ext/sdbm/_sdbm.c (makroom): suppress unused result warning.
+Thu Mar 14 12:59:59 2013 NARUSE, Yui <naruse@ruby-lang.org>
- * ext/sdbm/extconf.rb: disable BADMESS, a library should not emit
- messages directly.
+ * 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
-Sat Oct 16 08:39:03 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * file.c (rb_sys_fail_path): use rb_sys_fail_path0.
- * dln.c (dln_strerror): get English message first, instead of
- system default. see [ruby-dev:42358].
+Thu Mar 14 12:53:15 2013 Luis Lavena <luislavena@gmail.com>
-Sat Oct 16 00:08:00 2010 Koichi Sasada <ko1@atdot.net>
+ * 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]
- * hash.c (rb_hash_aref): skip calling "default" method
- if it is not needed, for speed-up.
+Thu Mar 14 11:53:01 2013 Narihiro Nakamura <authornari@gmail.com>
-Fri Oct 15 23:36:25 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * NEWS: describe RUBY_HEAP_SLOTS_GROWTH_FACTOR.
- * file.c (NUM2DEVT, DEVT2NUM, PRI_DEVT_PREFIX): fallback to
- unsigned int.
+Thu Mar 14 10:01:12 2013 Eric Hodel <drbrain@segment7.net>
-Fri Oct 15 22:54:46 2010 Masaki Suketa <masaki.suketa@nifty.ne.jp>
+ * doc/globals.rdoc: $? is thread-local
- * ext/win32ole/win32ole.c (ole_hresult2msg): get English message first,
- instead of system default. [ruby-core:32765]
+Wed Mar 13 23:25:59 2013 Narihiro Nakamura <authornari@gmail.com>
-Fri Oct 15 22:47:31 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * gc.c: allow to tune growth of heap by environment variable
+ RUBY_HEAP_SLOTS_GROWTH_FACTOR. patched by tmm1(Aman Gupta).
+ [Feature #8015] [ruby-core:53131]
- * include/ruby/ruby.h (VALUE): prefer long over uintptr_t,
- FIX2LONG expects VALUE to be long at least.
+Wed Mar 13 19:43:46 2013 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
- * include/ruby/ruby.h (FIX2LONG): parenthesize the argument.
+ * doc/irb/irb.rd.ja: fix typo
-Fri Oct 15 20:30:30 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * ext/tk/MANUAL_tcltklib.eng: fix typos
- * configure.in (dev_t): use RUBY_REPLACE_TYPE.
+ * ext/tk/sample/tktextframe.rb (Tk#component_delegates): fix typo
- * file.c (rb_stat_inspect): use PRI_DEVT_PREFIX.
+Wed Mar 13 15:13:04 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Fri Oct 15 17:26:57 2010 NARUSE, Yui <naruse@ruby-lang.org>
+ * class.c (rb_obj_singleton_methods): collect methods from the origin
+ class. [ruby-core:53207] [Bug #8044]
- * pack.c (pack_pack): simplify comparison of explicit_endian
- as pointed by nobu.
+Wed Mar 13 14:51:26 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * pack.c (pack_unpack): ditto.
+ * 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 Oct 15 16:40:37 2010 NARUSE, Yui <naruse@ruby-lang.org>
+Wed Mar 13 13:06:26 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * pack.c (pack_pack): fix more than one modifiers appear in the
- format string. [ruby-core:32793]
+ * configure.in (rm, shvar_to_cpp, unexpand_shvar): local is not
+ available on old shells.
- * pack.c (pack_unpack): ditto.
+ * configure.in (shvar_to_cpp): escape quotes for old shells.
+ [Bug #7959] [Bug #8071]
-Thu Oct 14 23:20:42 2010 Masaki Suketa <masaki.suketa@nifty.ne.jp>
+Wed Mar 13 11:11:07 2013 Shugo Maeda <shugo@ruby-lang.org>
- * test/win32ole/test_folderitem2_invokeverb.rb: refactoring.
+ * object.c (Init_Object): remove Module#used, which has been
+ introduced in Ruby 2.0 by mistake. [Bug #7916] [ruby-core:52719]
-Thu Oct 14 22:18:29 2010 Koichi Sasada <ko1@atdot.net>
+Wed Mar 13 05:49:29 2013 Eric Hodel <drbrain@segment7.net>
- * insns.def, iseq.c, vm_insnhelper.c: rename variable name
- (ip -> iseq).
+ * lib/irb.rb: Fix typo
-Thu Oct 14 20:41:27 2010 NARUSE, Yui <naruse@ruby-lang.org>
+Tue Mar 12 22:20:47 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * pack.c (pack_pack): support endian modifiers: < and >.
- [ruby-dev:42376] Feature #3491
+ * compile.c (iseq_set_arguments, iseq_compile_each): support required
+ keyword arguments. [ruby-core:51454] [Feature #7701]
- * pack.c (pack_unpack): ditto.
+ * iseq.c (rb_iseq_parameters): ditto.
-Thu Oct 14 20:50:51 2010 Masaki Suketa <masaki.suketa@nifty.ne.jp>
+ * parse.y (f_kw, f_block_kw): ditto. this syntax is still
+ experimental, the notation may change.
- * ext/win32ole/win32ole.c (reg_get_val): expand environment in
- the pathname. [Bug #3907]
+ * vm_core.h (rb_iseq_struct): ditto.
-Thu Oct 14 07:35:07 2010 NARUSE, Yui <naruse@ruby-lang.org>
+ * vm_insnhelper.c (vm_callee_setup_keyword_arg): ditto.
- * file.c (DEVT2NUM): added. Size of dev_t is depend on the
- environment even if POSIX defines dev_t as unsigned integer.
- For example, OpenVMS, 64bit Solaris 9, and NetBSD 6 defines
- dev_t as 64bit unsigned integer.
+Tue Mar 12 17:02:53 2013 TAKANO Mitsuhiro <tak@no32.tk>
- * file.c (rb_stat_dev): use DEVT2NUM.
+ * date_core.c: clearly specify operator precedence.
- * file.c (rb_stat_dev_major): dev_t is not long. major(3)'s return
- value is int.
+Tue Mar 12 17:00:45 2013 TAKANO Mitsuhiro <tak@no32.tk>
- * file.c (rb_stat_dev_minor): dev_t is not long. minor(3)'s return
- value is int.
+ * insns.def: fix condition.
- * configure.in: check size of dev_t.
+Tue Mar 12 16:48:19 2013 TAKANO Mitsuhiro <tak@no32.tk>
-Thu Oct 14 07:22:12 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * rational.c: fix dangling if, else-if and else.
- * array.c (rb_ary_and, rb_ary_or), class.c (rb_mod_init_copy),
- gc.c (undefine_final), time.c (time_mload): get rid of
- type-punning casts.
+Tue Mar 12 06:27:59 2013 Eric Hodel <drbrain@segment7.net>
-Thu Oct 14 04:16:41 2010 NARUSE, Yui <naruse@ruby-lang.org>
+ * 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.
- * numeric.c (ruby_float_step): fix Numeric#step with infinity unit
- doesn't works well. [ruby-core:32779]
+ * lib/rubygems/ext/ext_conf_builder.rb: Use full path to siteconf.rb
+ in case the extconf.rb changes directories (like memcached does).
-Wed Oct 13 23:16:46 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * 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.
- * tool/enc-unicode.rb: get rid of lots of warnings.
+ * 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.
- * iseq.c (insn_operand_intern, rb_iseq_disasm): fix format specifiers.
+Tue Mar 12 02:25:19 2013 Eric Hodel <drbrain@segment7.net>
- * vm.c (thread_free): ditto.
+ * 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.
- * numeric.c (check_uint): get rid of overflow on LLP64 platforms.
+Mon Mar 11 22:44:57 2013 Tanaka Akira <akr@fsij.org>
- * insns.def (opt_case_dispatch): use st_data_t.
+ * 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.
-Wed Oct 13 22:32:34 2010 Takeyuki FUJIOKA <xibbar@ruby-lang.org>
+Mon Mar 11 19:22:54 2013 NAKAMURA Usaku <usa@ruby-lang.org>
- * lib/cgi/util.rb (CGI::unescape): bugfix to unescape the multibyte
- string. Thanks nobu and tDiary dev members. [Bug #3909]
+ * test/mkmf/base.rb: class name conflict.
-Wed Oct 13 21:13:00 2010 NARUSE, Yui <naruse@ruby-lang.org>
+Mon Mar 11 18:45:09 2013 NARUSE, Yui <naruse@ruby-lang.org>
- * numeric.c (int_chr): raise error when the value is negative.
+ * enumerator.c (enumerator_with_index): try to convert given offset to
+ integer. fix bug introduced in r39594.
-Wed Oct 13 19:24:08 2010 URABE Shyouhei <shyouhei@ruby-lang.org>
+Mon Mar 11 17:27:57 2013 NARUSE, Yui <naruse@ruby-lang.org>
- * vm.c (ruby_vm_destruct): This function type was wrong; correct to the prototype.
+ * test/ruby/envutil.rb (EnvUtil.with_default_external): add for
+ changing Encoding.default_external without warnings.
-Wed Oct 13 14:58:09 2010 NARUSE, Yui <naruse@ruby-lang.org>
+ * test/ruby/envutil.rb (EnvUtil.with_default_internal): ditto.
- * numeric.c (rb_num_to_uint): fix 32bit logic.
+ * test/ruby/test_io_m17n.rb: use above with_default_external.
-Wed Oct 13 12:53:43 2010 NARUSE, Yui <naruse@ruby-lang.org>
+Mon Mar 11 16:57:00 2013 NARUSE, Yui <naruse@ruby-lang.org>
- * numeric.c (rb_num_to_uint): added to check the range of arguments.
- Mainly for negative value with NUM2UINT on 32bit environment.
+ * io.c (extract_binmode): raise error even if binmode and textmode
+ don't conflict. [Bug #5918] [ruby-core:42199]
- * string.c (rb_str_concat): use rb_num_to_uint.
+Mon Mar 11 12:25:12 2013 NARUSE, Yui <naruse@ruby-lang.org>
-Wed Oct 13 12:10:02 2010 NAKAMURA Usaku <usa@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]
- * thread_win32.c (w32_error): get English message first, instead
- of system default. see [ruby-core:32765].
- [experimental]
+Mon Mar 11 11:53:35 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Wed Oct 13 11:04:03 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * lib/mkmf.rb (MakeMakefile#dir_config, MakeMakefile#_libdir_basename):
+ defer use of instance variable until needed. [Bug #8074]
- * debug.c (ruby_set_debug_option): define always for binary
- compatibility with debug env enabled binary.
+Thu Mar 7 10:42:28 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
- * signal.c (ruby_enable_coredump): ditto.
+ * 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.
-Wed Oct 13 10:52:51 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Thu Mar 7 10:40:49 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
- * include/ruby/ruby.h (ruby_executable_node): missing prototype.
+ * tool/change_maker.rb (#diff2index): check Encoding::BINARY.
+ BASERUBY may still be 1.8.x.
-Wed Oct 13 05:23:04 2010 NARUSE, Yui <naruse@ruby-lang.org>
+Thu Mar 7 08:47:42 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
- * missing/strchr.c: add strlen's prototype.
+ * NEWS (Mutex#owned?): no longer experimental.
- * missing/strstr.c: ditto.
+Sun Mar 10 23:38:15 2013 Luis Lavena <luislavena@gmail.com>
-Wed Oct 13 00:21:17 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * win32/file.c (rb_file_expand_path_internal): Expand home directory when
+ used as second parameter (dir_string). [ruby-core:53168] [Bug #8034]
+ * test/ruby/test_file_exhaustive.rb: add test to verify.
- * ext/syck/rubyext.c (struct mktime_arg): constified.
+Sun Mar 10 23:27:05 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * ext/syck/rubyext.c (mktime_do, mktime_r, rb_syck_mktime): fix
- function signatures.
+ * 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]
-Wed Oct 13 00:18:18 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Sun Mar 10 17:00:22 2013 Tadayoshi Funaba <tadf@dotrb.org>
- * st.c (MurmurMagic): get rid of literal overflow.
+ * complex.c: edited rdoc.
+ * rational.c: ditto.
- * configure.in (RUBY_CHECK_PRINTF_PREFIX): check for printf format
- specifier if possible.
+Sun Mar 10 15:02:39 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-Tue Oct 12 23:58:19 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * process.c (setup_communication_pipe): remove unused function.
+ it was unintentionally added r39683.
- * win32/win32.c (rb_w32_open_osfhandle, rb_w32_wopen, rb_w32_pipe):
- use uintptr_t instead of long for win64.
+Wed Mar 6 00:30:40 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
- * win32/win32.c (socketpair_internal): suppress warnings.
+ * tool/gen_ruby_tapset.rb: add tapset generator.
- * win32/win32.c (ftruncate): use HANDLE instead of long for win64.
+Wed Mar 6 03:27:43 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
- * vsnprintf.c (BSD_vfprintf): fix cast.
+ * probes.d (symbol-create): change argument name `string' to
+ `str'. `string' is a keyword for systemtap.
- * numeric.c (rb_num2fix): result of rb_num2long is SIGNED_VALUE.
+Tue Mar 5 22:23:01 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
- * compile.c (iseq_build_body), error.c (set_syserr, get_syserr),
- (syserr_initialize), gc.c (define_final, rb_gc_copy_finalizer),
- (run_final), hash.c (rb_hash_aref, rb_hash_lookup2),
- (rb_hash_fetch_m, rb_hash_clear, rb_hash_aset, eql_i),
- iseq.c (iseq_load, iseq_data_to_ary), marshal.c (r_symlink),
- thread.c (rb_thread_local_aref),
- variable.c (generic_ivar_remove, ivar_get, rb_const_get_0),
- (rb_cvar_get), vm.c (rb_vm_check_redefinition_opt_method),
- vm_insnhelper.c (vm_get_ev_const), vm_method.c (remove_method),
- ext/iconv/iconv.c (map_charset): use st_data_t.
+ * probes.d: added argument name
- * compile.c (iseq_build_body), insns.def (getglobal, setglobal),
- iseq.c (iseq_load, iseq_data_to_ary), util.c (valid_filename):
- use VALUE.
+Thu Mar 7 01:17:00 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
- * gc.c (obj_free, rb_objspace_call_finalizer): fix truncating
- cast.
+ * 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.
- * gc.c (mark_current_machine_context): suppress warnings.
+Thu Mar 7 00:14:51 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
- * compile.c (iseq_compile_each): fix truncating cast.
+ * io.c (rb_update_max_fd): use ATOMIC_CAS because this function
+ is used from timer thread too.
- * cont.c (fiber_setcontext): missing variable definition.
+Wed Mar 6 23:30:21 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-Tue Oct 12 19:25:13 2010 NARUSE, Yui <naruse@ruby-lang.org>
+ * thread_pthread.c (ARRAY_SIZE): new.
+ * thread_pthread.c (gvl_acquire_common): use low priority
+ notification for avoiding timer thread interval confusion.
+ If we use timer_thread_pipe[1], every gvl_yield() request
+ one more gvl_yield(). It lead to thread starvation.
+ [Bug #7999] [ruby-core:53095]
+ * thread_pthread.c (rb_reserved_fd_p): adds timer_thread_pipe_low
+ to reserved fds.
- * error.c (exc_to_s): use OBJ_INFECT.
+Wed Mar 6 22:36:19 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
- * error.c (name_err_to_s): ditto.
+ * 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.
- * error.c (name_err_mesg_to_str): ditto.
+ * thread_pthread.c (timer_thread_sleep): adjust the above changes.
- * error.c (syserr_initialize): ditto.
+ * thread_pthread.c (setup_communication_pipe_internal): factor
+ out pipe initialize logic.
-Tue Oct 12 19:07:55 2010 NARUSE, Yui <naruse@ruby-lang.org>
+Wed Mar 6 22:56:14 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
- * error.c (syserr_initialize): taint message if mesg is given
- and it is tainted.
+ * thread_pthread.c (ubf_select): add to small comments why we
+ need to call rb_thread_wakeup_timer_thread().
-Tue Oct 12 18:25:43 2010 NARUSE, Yui <naruse@ruby-lang.org>
+Wed Mar 6 21:42:24 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
- * io.c (rb_io_ungetc): always see Bignum. On 32bit valid value
- may be a Bignum. On 64bit for errors. [ruby-dev:42366]
+ * 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 Oct 12 18:25:04 2010 NARUSE, Yui <naruse@ruby-lang.org>
+Sun Mar 3 02:42:29 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
- * string.c (rb_str_concat): use unsigned int for GB18030.
+ * thread_pthread.c (consume_communication_pipe): retry when
+ read returned CCP_READ_BUFF_SIZE.
-Tue Oct 12 17:53:49 2010 NARUSE, Yui <naruse@ruby-lang.org>
+Wed Mar 6 21:31:35 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
- * numeric (check_uint): the mask must refer to VALUE.
+ * 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 Oct 12 17:47:10 2010 NARUSE, Yui <naruse@ruby-lang.org>
+Wed Mar 6 21:00:23 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
- * numeric (check_uint): set MSB for negative value.
+ * thread_pthread.c (USE_SLEEPY_TIMER_THREAD): use more accurate
+ ifdef conditions.
- * numeric (rb_num2uint): return value's type of rb_num2ulong
- is VALUE.
+Sun Mar 3 02:30:36 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
- * numeric (int_chr): variable i can't be negative.
+ * 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 Oct 12 16:04:37 2010 NAKAMURA Usaku <usa@ruby-lang.org>
+Sun Mar 10 09:12:51 2013 Tadayoshi Funaba <tadf@dotrb.org>
- * win32/win32.c (rb_w32_strerror): get English message first, instead
- of system default. see [ruby-dev:42358].
- [experimental]
+ * complex.c: described syntax of string form.
+ * rational.c: ditto.
-Tue Oct 12 15:52:35 2010 NAKAMURA Usaku <usa@ruby-lang.org>
+Sat Mar 9 11:58:39 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * win32/win32.c (rb_w32_strerror): unmap some range of errno for
- workaround of VC10's strerror() and sys_nerr problem.
- based on a patch from Akio Tajima, [ruby-dev:42355].
+ * marshal.c (w_extended): check for prepended object.
+ [ruby-core:53206] [Bug #8043]
-Tue Oct 12 15:36:09 2010 NARUSE, Yui <naruse@ruby-lang.org>
+Sat Mar 9 08:36:58 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * io.c (rb_io_ungetc): use unsigned int for GB18030.
+ * 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].
-Tue Oct 12 15:14:21 2010 NARUSE, Yui <naruse@ruby-lang.org>
+Sat Mar 9 00:25:57 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * io.c (rb_io_putc): support multibyte characters.
- [ruby-core:30697]
+ * 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]
-Tue Oct 12 15:10:31 2010 NARUSE, Yui <naruse@ruby-lang.org>
+Fri Mar 8 19:44:00 2013 Akinori MUSHA <knu@iDaemons.org>
- * numeric.c (rb_enc_uint_chr): split from int_chr.
+ * man/rake.1, man/ruby.1: Use the Pa macro to make URLs stand out.
- * numeric.c (int_chr): use rb_enc_uint_chr.
+Fri Mar 8 13:20:00 2013 Zachary Scott <zachary@zacharyscott.net>
- * include/ruby/encoding.h (rb_enc_uint_chr): added.
+ * ext/pathname/pathname.c (path_f_pathname): rdoc for Pathname()
-Tue Oct 12 14:04:41 2010 NARUSE, Yui <naruse@ruby-lang.org>
+Fri Mar 8 12:00:00 2013 Zachary Scott <zachary@zacharyscott.net>
- * numeric.c (int_chr): a codepoint of Ruby M17N must be 32bit
- unsigned int; GB18030 uses MSB. Also note that OnigCodePoint
- is defined as unsigned int.
+ * man/rake.1: Document ENVIRONMENT variables on RAKE(1) manpage
-Tue Oct 12 12:20:54 2010 NAKAMURA Usaku <usa@ruby-lang.org>
+Fri Mar 8 10:44:00 2013 Zachary Scott <zachary@zacharyscott.net>
- * vm_dump.c (dump_thread): foolish mistake.
+ * lib/webrick/httpproxy.rb: Fix typos in HTTPProxyServer [Bug #8013]
+ Patch by Nobuhiro IMAI [ruby-core:53127]
-Tue Oct 12 10:39:08 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Fri Mar 8 03:16:15 2013 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
- * configure.in (RUBY_MINGW32): canonicalize only on mingw.
+ * class.c (rb_mod_ancestors): Include singleton_class in ancestors
+ list [Feature #8035]
-Mon Oct 11 20:20:23 2010 NARUSE, Yui <naruse@ruby-lang.org>
+ * test/ruby/test_module.rb (class): test for above
- * lib/net/http.rb (HTTP.get): specify ASCII-8BIT as the result
- encoding of Zlib::GzipReader.
- http://hibari.2ch.net/test/read.cgi/tech/1281473294/271
+ * test/ruby/marshaltestlib.rb (module): adapt test
-Mon Oct 11 17:42:54 2010 NARUSE, Yui <naruse@ruby-lang.org>
+ * NEWS: list change
- * error.c (syserr_initialize): use mesg's encoding when locale
- encoding is US-ASCII. If locale encoding is not US-ASCII,
- assume err has non ASCII characters. [ruby-dev:42358]
+Thu Mar 7 14:21:37 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Mon Oct 11 14:03:54 2010 NARUSE, Yui <naruse@ruby-lang.org>
+ * compile.c (iseq_compile_each): pass keyword arguments to zsuper,
+ with current values. [ruby-core:53114] [Bug #8008]
- * error.c (syserr_initialize): set the encoding of Errno::*#message
- as locale. [ruby-dev:42358]
+Thu Mar 7 12:53:47 2013 Eric Hodel <drbrain@segment7.net>
-Mon Oct 11 06:38:27 2010 NARUSE, Yui <naruse@ruby-lang.org>
+ * lib/rubygems/commands/setup_command.rb: Install .pem files.
+ * test/rubygems/test_gem_commands_setup_command.rb: Test for the
+ above.
- * ext/stringio/stringio.c (strio_set_encoding):
- StringIO#set_encoding can get 2nd argument and optional hash
- for API compatibility to IO. [ruby-dev:42356]
+ * 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.
-Mon Oct 11 06:11:30 2010 NARUSE, Yui <naruse@ruby-lang.org>
+ * lib/rubygems.rb: Version 2.0.2
- * io.c (rb_io_set_encoding): use rb_funcall2 when the io is not
- a T_FILE. [ruby-dev:42356]
+ * lib/rubygems/test_utilities.rb: Ensure scheme and uri class match.
-Sun Oct 10 18:42:23 2010 Akinori MUSHA <knu@iDaemons.org>
+Thu Mar 7 10:39:04 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * lib/set.rb (Set#replace): Apply a bit of optimization.
+ * tool/rbinstall.rb (gem): Gem.ensure_gem_subdirectories now has mode
+ option since r39607. refix of r38870.
-Sun Oct 10 10:20:07 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Wed Mar 6 13:14:28 2013 Eric Hodel <drbrain@segment7.net>
- * configure.in (RUBY_MINGW32): canonicalize as like mswin version.
+ * test/rubygems/test_gem_spec_fetcher.rb: Removed unused variable.
-Sun Oct 10 05:33:14 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Wed Mar 6 08:10:15 2013 Eric Hodel <drbrain@segment7.net>
- * vm_core.h (rb_signal_buff_size, rb_signal_exec): moved
- declarations from thread.c.
+ * test/rubygems/test_require.rb: Fix tests when 'a.rb' exists.
+ [ruby-trunk - Bug #7749]
-Sat Oct 9 16:54:28 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Wed Mar 6 08:00:59 2013 Eric Hodel <drbrain@segment7.net>
- * configure.in (RSHIFT): quote to get rid of argument expansion
- for autoconf 2.68.
+ * lib/rubygems.rb: Allow specification of directory permissions.
+ [ruby-trunk - Bug #7713]
+ * test/rubygems/test_gem.rb: Test for the above.
-Sat Oct 9 11:00:06 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Wed Mar 6 07:40:21 2013 Eric Hodel <drbrain@segment7.net>
- * thread.c (thread_reset_event_flags, exec_event_hooks): ignore
- hooks marked as removed.
+ * 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.
- * thread.c (thread_exec_event_hooks): remove hooks to be removed.
+ * lib/rubygems/security.rb: Make OpenSSL optional for RubyGems.
+ * lib/rubygems/commands/cert_command.rb: ditto.
- * thread.c (rb_threadptr_remove_event_hook, rb_remove_event_hook):
- defer removing hooks if running the hooks. [ruby-dev:42350]
+ * lib/rubygems/config_file.rb: Display file with YAML error, not
+ ~/.gemrc
-Sat Oct 9 10:51:00 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * lib/rubygems/remote_fetcher.rb: Only create gem subdirectories when
+ installing gems.
+ * lib/rubygems/dependency_resolver.rb: ditto.
+ * lib/rubygems/test_utilities.rb: ditto.
+ * test/rubygems/test_gem_commands_fetch_command.rb: Test for the
+ above.
- * thread.c (rb_threadptr_exec_event_hooks): suppress each event
- hooks separately.
+ * 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.
- * thread.c (thread_suppress_tracing): split from
- ruby_suppress_tracing, accepting thread pointer and event mask.
+ * lib/rubygems.rb: Update win_platform? check for JRuby compatibility.
-Sat Oct 9 08:16:01 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * test/rubygems/test_gem_installer.rb: Update for Ruby 1.9.2
+ compatibility
- * thread.c (rb_threadptr_remove_event_hook): fix typo.
+Wed Mar 6 01:19:28 2013 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
-Fri Oct 8 10:52:25 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * enumerator.c (enumerator_with_index, lazy_take): use INT2FIX(0)
+ instead of INT2NUM(0).
- * common.mk (RBCONFIG): depends on version.h due to
- RUBY_PATCHLEVEL. [ruby-core:32709]
+ * ext/bigdecimal/bigdecimal.c (BigMath_s_exp): ditto.
-Fri Oct 8 00:24:54 2010 James Edward Gray II <jeg2@ruby-lang.org>
+ * ext/fiddle/function.c (function_call): ditto.
- * lib/csv.rb: Fixing documentation typos. [ruby-core:32712]
+ * ext/openssl/ossl_x509store.c (ossl_x509store_initialize): ditto.
-Thu Oct 7 09:14:28 2010 NARUSE, Yui <naruse@ruby-lang.org>
+ * process.c (proc_getsid): ditto.
- * vm_exec.c (vm_exec_core): Treat clang as non gcc on this
- context: It has __asm__ but doesn't works well.
+ * transcode.c (econv_finish): ditto.
-Wed Oct 6 12:28:22 2010 Tanaka Akira <akr@fsij.org>
+Tue Mar 5 21:36:43 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * lib/uri/generic.rb (URI::Generic#hostname): new method.
- (URI::Generic#hostname=): ditto.
+ * class.c (rb_prepend_module): check redefinition of built-in optimized
+ methods. [ruby-dev:47124] [Bug #7983]
- * lib/open-uri.rb: use URI#hostname
+ * vm.c (rb_vm_check_redefinition_by_prepend): ditto.
- * lib/net/http.rb: ditto.
+Tue Mar 5 20:29:25 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- reported by Adam Majer. [ruby-core:32056]
+ * proc.c (mnew): revert r39224. [ruby-core:53038] [Bug #7988]
-Wed Oct 6 11:52:12 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Tue Mar 5 20:23:54 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * io.c (fptr_finalize): write_mutex might have been destroyed
- already in finalization phase, as the order of finalizers is not
- guaranteed. rb_mutex_t should be used in place of Mutex object
- in the future.
+ * 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 Oct 5 22:17:02 2010 wanabe <s.wanabe@gmail.com>
+Tue Mar 5 12:30:55 2013 Eric Hodel <drbrain@segment7.net>
- * win32/mkexports.rb: revert r29320 and r29402.
+ * lib/rubygems.rb: Bump version to 2.0.1 for upcoming bugfix release
-Mon Oct 4 12:43:47 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * lib/rubygems/ext/ext_conf_builder.rb: Restore ruby 1.8 compatibility
+ for [Bug #7698]
+ * test/rubygems/test_gem_installer.rb: Ditto.
- * parse.y (regexp): dregexp has literal string only at the head
- and successors are array. [ruby-core:32682]
+ * lib/rubygems/package.rb: Restore ruby 1.8 compatibility.
-Mon Oct 4 10:22:21 2010 NARUSE, Yui <naruse@ruby-lang.org>
+ * test/rubygems/test_gem_dependency_installer.rb: Fix warnings
- * random.c (rand_init): This checks the value is in 32bit or not,
- so use int32_t, not int.
+Tue Mar 5 12:24:23 2013 Eric Hodel <drbrain@segment7.net>
-Mon Oct 4 09:47:39 2010 NARUSE, Yui <naruse@ruby-lang.org>
+ * enumerator.c (enumerator_with_index): Restore handling of a nil memo
+ from r39594.
- * random.c (rand_init): remove useless assignment.
+Tue Mar 5 10:40:22 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * re.c (update_char_offset): remove unused variable.
+ * 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]
- * re.c (read_escaped_byte): ditto.
+Tue Mar 5 10:20:16 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Mon Oct 4 09:30:42 2010 NARUSE, Yui <naruse@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]
- * ext/openssl/lib/openssl/bn.rb (Integer#to_bn): OpenSSL::BN.new
- accepts only Strings, so call Integer#to_s(16).
- 16 is for an optimization. [ruby-dev:42336]
+ * numeric.c (rb_int_succ, rb_int_pred): shortcut optimization for
+ Bignum.
-Mon Oct 4 07:57:51 2010 NARUSE, Yui <naruse@ruby-lang.org>
+Tue Mar 5 10:02:48 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * cont.c (fiber_memsize): Return size.
- Before this change, fiber_memsize always returns 0.
+ * lib/rubygems/ext/ext_conf_builder.rb (Gem::Ext::ExtConfBuilder.build):
+ clear DESTDIR so RUBYARCHDIR and RUBYLIBDIR are not be overridden.
+ [Bug #7698]
-Mon Oct 4 07:16:55 2010 NARUSE, Yui <naruse@ruby-lang.org>
+Mon Mar 4 15:33:40 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * enc/unicode.c (onigenc_unicode_property_name_to_ctype):
- remove useless assignment.
+ * 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]
- * vm.c (vm_make_proc_from_block): ditto.
+Mon Mar 4 14:13:36 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * variable.c (rb_ivar_count): ditto.
+ * 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 Oct 4 06:40:24 2010 NARUSE, Yui <naruse@ruby-lang.org>
+Mon Mar 4 10:23:00 2013 Zachary Scott <zachary@zacharyscott.net>
- * Makefile.in (clean-rdoc): Don't use \ in variable expansion.
- BSD make treats it as an escape character.
+ * encoding.c: Typo in Encoding overview by Tom Wardrop [GH fixes #255]
-Mon Oct 4 00:01:53 2010 wanabe <s.wanabe@gmail.com>
+Sun Mar 3 12:35:08 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * tool/config.sub: revert r29320, r29324, r29347, r29354, r29365
- to automake-1.11.1. [ruby-core:32634]
+ * lib/mkmf.rb (MakeMakefile#libpath_env): set runtime library path for
+ the case rpath is disabled.
- * win32/mkexports.rb: no longer use 'mingw64'. a patch from Luis Lavena
- at [ruby-core:32678].
+Sun Mar 3 12:17:47 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Sun Oct 3 20:36:37 2010 Akio Tajima (arton) <artonx@yahoo.co.jp>
+ * 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]
- * test/win32ole/test_folderitem2_invokeverb.rb: Change creating
- shortcut verb to 'Link' [Bug #3339]
+Sun Mar 3 07:33:00 2013 Zachary Scott <zachary@zacharyscott.net>
-Sun Oct 3 19:44:23 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * ext/socket/tcpserver.c: Grammar for TCPServer.new from r39554
- * configure.in (Makefile): get rid of duplicated ruby target when
- already there it was.
+Sun Mar 3 01:17:20 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Sat Oct 2 22:59:32 2010 Masaki Suketa <masaki.suketa@nifty.ne.jp>
+ * 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]
- * test/win32ole/test_thread.rb: add for win32ole with Thread.
+ * lib/rubygems/ext/ext_conf_builder.rb (Gem::Ext::ExtConfBuilder.build):
+ use RUBYOPT instead of -r option, and revert some tests. [Bug #7698]
-Fri Oct 1 17:03:00 2010 URABE Shyouhei <shyouhei@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]
- * test/webrick/test_httpproxy.rb (TestWEBrickHTTPProxy::test_upstream_proxy):
- My machine fails this test at this line, saying 503 service unavailable.
+Sun Mar 3 00:04:20 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Thu Sep 30 16:11:08 2010 NAKAMURA Usaku <usa@ruby-lang.org>
+ * enc/depend (CPPFLAGS), lib/mkmf.rb (MakeMakefile#create_makefile):
+ define RUBY_EXPORT for static-linked-ext mswin. [Bug #7960]
- * win32/win32.c (rb_w32_getenv): should return NULL if specified name
- is empty. a patch from Heesob Park at [ruby-core:32650]
+Sat Mar 2 22:49:47 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Thu Sep 30 15:18:23 2010 Yukihiro Matsumoto <matz@ruby-lang.org>
+ * win32/Makefile.sub (ENCOBJS, EXTOBJS, config.h): definitions for
+ static-linked-ext. [Bug #7960]
- * parse.y (command_asgn): allow command_call to be right hand side
- expression of chained assignment. [ruby-dev:42313]
+Sat Mar 2 17:34:19 2013 Tanaka Akira <akr@fsij.org>
-Thu Sep 30 10:55:38 2010 NAKAMURA Usaku <usa@ruby-lang.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).
- * hash.c (ruby_setenv): workaround for old Windows. a patch from
- Heesob Park. [ruby-core:32353]
+Sat Mar 2 02:45:00 2013 Zachary Scott <zachary@zacharyscott.net>
-Thu Sep 30 09:29:06 2010 NARUSE, Yui <naruse@ruby-lang.org>
+ * array.c: typo in comment patch by Nami-Doc [Github fixes #253]
- * lib/uri/common.rb (URI.encode_www_form): change treatment of
- undefined value in given array as latest internet draft for
- application/www-form-urlencoded.
- http://tools.ietf.org/html/draft-hoehrmann-urlencoded-01
+Sat Mar 2 01:33:17 2013 NARUSE, Yui <naruse@ruby-lang.org>
-Thu Sep 30 09:34:03 2010 NAKAMURA Usaku <usa@ruby-lang.org>
+ * Merge Onigmo 0fe387da2fee089254f6b04990541c731a26757f
+ v5.13.3 [Bug#7972] [Bug#7974]
- * vm_dump.c (dump_thread): fixed wrong type of return value of
- SymGetModuleBase64(). [ruby-dev:42306]
+Fri Mar 1 11:09:06 2013 Eric Hodel <drbrain@segment7.net>
-Wed Sep 29 21:04:05 2010 URABE Shyouhei <shyouhei@ruby-lang.org>
+ * lib/fileutils.rb: Revert r34669 which altered the way
+ metaprogramming in FileUtils occurred. [ruby-trunk - Bug #7958]
- * test/ruby/test_rubyoptions.rb (TestRubyOptions::test_script_from_stdin):
- As usual, PTY is not always available.
+ * 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.
-Wed Sep 29 18:38:14 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Fri Mar 1 09:18:00 2013 Zachary Scott <zachary@zacharyscott.net>
- * tool/config.sub (x64): regularize only for pc vendor, and strip
- useless 64 suffix.
+ * lib/psych.rb: specify in rdoc what object is returned in parser
+ By Adam Stankiewicz [Github tenderlove/psych#133]
-Wed Sep 29 17:53:02 2010 Kenta Murata <mrkn@mrkn.jp>
+Fri Mar 1 07:21:41 2013 Eric Hodel <drbrain@segment7.net>
- * ext/bigdecimal/bigdecimal.c (BIGDECIMAL_ENABLE_VPRINT):
- VPrint is usually disabled. It's only used in debugging.
+ * 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.
-Wed Sep 29 17:41:34 2010 Kenta Murata <mrkn@mrkn.jp>
+ * 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.
- * ext/bigdecimal/bigdecimal.c (BigDecimal_save_limit):
- return the result of a block.
+Fri Mar 1 03:25:00 2013 Zachary Scott <zachary@zacharyscott.net>
- * test/bigdecimal/test_bigdecimal.rb (test_save_limit):
- add a test for the above change.
+ * ext/psych/lib/psych.rb: rdoc for Psych overview by Adam Stankiewicz
+ [Github tenderlove/psych#134]
-Wed Sep 29 16:18:03 2010 NAKAMURA Usaku <usa@ruby-lang.org>
+Thu Feb 28 22:57:48 2013 Koichi Sasada <ko1@atdot.net>
- * vm_dump.c (dump_thread): remove unused optional arguments.
+ * compile.c (iseq_compile_each): remove redundant trace(line)
+ instruction. for example, at the following script
+ def m()
+ p:xyzzy
+ 1
+ 2
+ end
+ compiler ignores `1' because there is no effect. However,
+ `trace(line)' instruction remains in bytecode.
+ This modification removes such redundant trace(line) instruction.
-Wed Sep 29 13:26:30 2010 Kenta Murata <mrkn@mrkn.jp>
+ * test/ruby/test_iseq.rb: add a test.
- * ext/bigdecimal/bigdecimal.c (BigDecimal_save_rounding_mode):
- return the result of a block.
+Thu Feb 28 22:23:27 2013 Tanaka Akira <akr@fsij.org>
- * test/bigdecimal/test_bigdecimal.rb (test_save_rounding_mode):
- add a test for the above change.
+ * 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.
- * test/bigdecimal/test_bigdecimal.rb (test_save_exception_mode):
- add a test for the return value of BigDecimal.save_exception_mode.
+Thu Feb 28 21:33:01 2013 WATANABE Hirofumi <eban@ruby-lang.org>
-Wed Sep 29 12:45:30 2010 NAKAMURA Usaku <usa@ruby-lang.org>
+ * configure.in(AC_DISABLE_OPTION_CHECKING): avoid warning "WARNING:
+ Unrecognized options: --with-PACKAGE".
- * ext/bigdecimal/bigdecimal.c (BigDecimal_div2, BigDecimal_add2,
- BigDecimal_sub2, BigDecimal_mult2, VpLimitRound): remove meaningless
- casts to get rid of compiler warnings.
+Thu Feb 28 20:22:04 2013 Koichi Sasada <ko1@atdot.net>
-Wed Sep 29 12:35:13 2010 Nobuyoshi Nakada <nobu@ruby-lang.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.
- * ext/bigdecimal/bigdecimal.c (VPrint, VpToString): fix format.
+ * test/ruby/test_iseq.rb: add a test of lines after ISeq#to_a.
-Wed Sep 29 12:31:12 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Thu Feb 28 08:20:33 2013 Eric Hodel <drbrain@segment7.net>
- * lib/rdoc/known_classes.rb (RDoc::KNOWN_CLASSES): add Encoding.
+ * lib/rubygems/available_set.rb: Undent for style
-Tue Sep 28 20:50:23 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * 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.
- * tool/config.sub (x64): regularize same as mswin.
+ * lib/rubygems/dependency_installer.rb: Don't display "Done installing
+ documentation" if documentation will not be installed.
+ * lib/rubygems/rdoc.rb: ditto
-Tue Sep 28 20:06:14 2010 NAKAMURA Usaku <usa@ruby-lang.org>
+ * lib/rubygems/dependency_list.rb: Use Array#concat for Ruby 1.x
+ performance.
- * vm_dump.c (rb_vm_bugreport): add windows support.
- based on patches from Peter Weldon at [ruby-core:32551]
+ * 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.
-Mon Sep 27 23:30:34 2010 Koichi Sasada <ko1@atdot.net>
+ * lib/rubygems/package.rb: Use more explicit feature check to work
+ around JRuby bug #552
- * insns.def (opt_case_dispatch), vm_insnhelper.c:
- execute the procedures of "when" clauses by bytecode
- instead of st_foreach() when the object does not hit
- prepared hash. [ruby-dev:42304]
+ * lib/rubygems/ssl_certs/GeoTrust_Global_CA.pem: Added GeoTrust root
+ certificate.
-Mon Sep 27 15:54:03 2010 URABE Shyouhei <shyouhei@ruby-lang.org>
+ * test/rubygems/test_gem_source_list.rb: Use "example" instead of real
+ hostname
- * test/net/http/test_https.rb: As always, localhost is not
- guaranteed to be resolved as 127.0.0.1. But a SSL
- certificate needs a socket to listen on a specific address
- where a CN resolves to. On situations where localhost is
- not 127.0.0.1, these tests are not possible.
+Thu Feb 28 05:57:00 2013 Zachary Scott <zachary@zacharyscott.net>
-Mon Sep 27 15:25:05 2010 URABE Shyouhei <shyouhei@ruby-lang.org>
+ * thread.c: rdoc formatting for Thread, ThreadGroup, and ThreadError
- * test/net/imap/test_imap.rb: resurrection of r29259.
- this change depends on minitest 1.7.1.
+Thu Feb 28 02:42:00 2013 Zachary Scott <zachary@zacharyscott.net>
- * lib/test/unit/assertions.rb: ditto.
+ * vm.c: Typo in overview for example of Thread#status returning false
+ Reported by Lee Jarvis
-Sun Sep 26 22:59:45 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Wed Feb 27 22:54:27 2013 Tanaka Akira <akr@fsij.org>
- * tool/config.sub (x86_64-pc-mingw64): regularize.
+ * ext/socket/rubysocket.h (union_sockaddr): make it longer for SunOS
+ and Darwin.
-Sun Sep 26 22:21:07 2010 wanabe <s.wanabe@gmail.com>
+Wed Feb 27 21:14:34 2013 Kouhei Sutou <kou@cozmixng.org>
- * ext/openssl/ossl_hmac.c (ossl_hmac_hexdigest, ossl_hmac_s_hexdigest),
- ext/openssl/ossl_pkey_ec.c (ossl_ec_group_set_seed),
- ext/openssl/ossl_ssl_session.c (ossl_ssl_session_to_der),
- ext/openssl/ossl_pkcs7.c (numberof): suppress warnings.
- [ruby-core:31932]
+ * 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.
-Sun Sep 26 10:25:24 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Wed Feb 27 19:53:32 2013 Benoit Daloze <eregontp@gmail.com>
- * tool/config.{guess,sub}: updated to automake-1.11.1.
+ * vm.c (Thread): fix typos in overview
-Sat Sep 25 22:48:30 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Wed Feb 27 13:21:00 2013 Zachary Scott <zachary@zacharyscott.net>
- * configure.in (LIBRUBY_DLDFLAGS): fix quoting.
+ * vm.c (Thread): Typo in overview, swap setting and getting
-Sat Sep 25 10:30:37 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Wed Feb 27 13:02:00 2013 Zachary Scott <zachary@zacharyscott.net>
- * configure.in (LIBRUBY_DLDFLAGS): use -unexported_symbol only
- when available. http://trac.macports.org/ticket/26341
+ * vm.c (Thread): Documentation overview of Thread class
-Sat Sep 25 10:05:49 2010 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+Wed Feb 27 12:57:00 2013 Zachary Scott <zachary@zacharyscott.net>
- * configure.in: Always add -mieee for Renesas SH4.
- Thanks, Nobuhiro Iwamatsu. [Feature #3874] [ruby-core:32548]
+ * thread.c (rb_thread_wakeup): rdoc formatting
-Sat Sep 25 01:34:41 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Wed Feb 27 12:53:00 2013 Zachary Scott <zachary@zacharyscott.net>
- * Makefile.in (install-cross): target to install cross-compiling
- stuff.
+ * thread.c (rb_thread_group): rdoc formatting
-Fri Sep 24 23:44:59 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Wed Feb 27 12:33:00 2013 Zachary Scott <zachary@zacharyscott.net>
- * string.c (sym_call), vm.c (invoke_block_from_c),
- vm_insnhelper.c (vm_yield_with_cfunc): pass given block.
- [ruby-core:32075]
+ * lib/ostruct.rb: Typo in OpenStruct overview [Github Fixes #251]
+ Patch by Chun-wei Kuo
- * vm_eval.c (rb_funcall_passing_block): new function to call
- method with passing given block.
+Wed Feb 27 12:13:32 2013 NARUSE, Yui <naruse@ruby-lang.org>
-Fri Sep 24 15:50:43 2010 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]
- * string.c (rb_str_to_i): fix rdoc: String#to_i raises an
- exception when base is invalid. [ruby-core:31685]
+Wed Feb 27 10:23:00 2013 Zachary Scott <zachary@zacharyscott.net>
-Fri Sep 24 15:28:35 2010 NARUSE, Yui <naruse@ruby-lang.org>
+ * thread.c (thread_raise_m): rdoc formatting
- * string.c (rb_str_rindex): use rb_enc_prev_char instead of repeated
- str_nth.
- patched by Michael Selig [ruby-core:32498]
+Tue Feb 26 23:32:44 2013 Kouhei Sutou <kou@cozmixng.org>
-Fri Sep 24 14:19:12 2010 URABE Shyouhei <shyouhei@ruby-lang.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.
- * test/test_pty.rb: Same as 229281; existence of PTY class do not
- guarantee a successful pty operation.
+Tue Feb 26 23:26:13 2013 Kouhei Sutou <kou@cozmixng.org>
-Fri Sep 24 06:25:55 2010 Ryan Davis <ryand-ruby@zenspider.com>
+ * lib/rexml/document.rb: move entity_expansion_text_limit accessor to ...
+ * lib/rexml/rexml.rb: ... here to make rexml/text independent from
+ REXML::Document. It causes circular require.
+ * lib/rexml/document.rb (REXML::Document.entity_expansion_text_limit):
+ deprecated.
+ * lib/rexml/document.rb (REXML::Document.entity_expansion_text_limit=):
+ deprecated.
+ * lib/rexml/text.rb: add missing require "rexml/rexml" for
+ REXML.entity_expansion_text_limit.
+ Reported by Robert Ulejczyk. Thanks!!! [ruby-core:52895] [Bug #7961]
- * lib/minitest/*.rb: Imported minitest 1.7.2 r5879.
- * test/minitest/*.rb: ditto.
+Tue Feb 26 15:12:11 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Thu Sep 23 23:09:08 2010 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.
- * vm_insnhelper.c (vm_get_cref0): cref is stacked only in normal
- iseqs, so check if it is the case first.
+Tue Feb 26 15:04:19 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Thu Sep 23 23:08:41 2010 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]
- * tool/config.sub: mingw64 should use x86_64. [ruby-core:32514]
+Tue Feb 26 10:24:49 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Thu Sep 23 21:40:40 2010 wanabe <s.wanabe@gmail.com>
+ * parse.y (IS_LABEL_POSSIBLE): allow labels for keyword arguments just
+ after method definition without a parenthesis. [ruby-core:52820]
+ [Bug #7942]
- * ext/socket/raddrinfo.c (init_addrinfo, inspect_sockaddr): suppress
- warnings. see [ruby-core:31932].
+Tue Feb 26 04:50:00 2013 Zachary Scott <zachary@zacharyscott.net>
-Thu Sep 23 19:27:57 2010 wanabe <s.wanabe@gmail.com>
+ * error.c: clarify reason for sleep in SignalException example
- * thread_win32.c (w32_wait_events, w32_close_handle): suppress warnings.
- see [ruby-core:31932].
+Tue Feb 26 03:47:00 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-Thu Sep 23 18:54:39 2010 wanabe <s.wanabe@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]
- * tool/config.sub: add mingw64.
+Mon Feb 25 23:51:04 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * win32/mkexports.rb (Exports::Mingw64): added.
+ * include/ruby/version.h: bump RUBY_API_VERSION same as RUBY_VERSION.
- * win32/mkexports.rb (Exports::Mingw32): renamed from Exports::Mingw.
+Mon Feb 25 21:03:34 2013 NARUSE, Yui <naruse@ruby-lang.org>
-Thu Sep 23 09:01:28 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * string.c (str_byte_substr): don't set coderange if it's not known.
+ [Bug #7954] [ruby-dev:47108]
- * vm_insnhelper.c (vm_cref_push): no outer cref is needed for proc
- from method. Bug #3786, Bug #3860, [ruby-core:32501]
+Mon Feb 25 16:47:02 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Wed Sep 22 17:12:01 2010 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
+ * common.mk (realclean-local): miniprelude.c is made by srcs, so it
+ should not removed by distclean but by realclean. [Bug #6807]
- * test/openssl/utils.rb (OpenSSL#silent): always restore $VERBOSE.
- [ruby-dev:42285]
+Mon Feb 25 16:30:30 2013 Eric Hodel <drbrain@segment7.net>
-Wed Sep 22 16:59:40 2010 Yuki Sonoda (Yugui) <yugui@yugui.jp>
+ * 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/test_prime.rb (TestPrime#test_new): the warning expected have
- not been displayed when $VERBOSE == nil. Patch by Shota Fukumori
- a.k.a. sora_h. [ruby-dev:42272]
- Recovers $stderr even if StringIO.new fails. Reported by unak.
+ * test/rubygems/test_gem_commands_push_command.rb: Remove duplicated
+ test.
-Wed Sep 22 01:55:48 2010 Koichi Sasada <ko1@atdot.net>
+Mon Feb 25 15:47:18 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * bootstraptest/test_method.rb: fix last commit.
+ * enc/depend (ARFLAGS): VisualC++ linker does not allow spaces between
+ output option and the output file name. [Bug #7950]
-Wed Sep 22 01:49:52 2010 Koichi Sasada <ko1@atdot.net>
+ * enc/depend (RANLIB): set default command to do nothing, or make the
+ entire line a label on Windows.
- * bootstraptest/test_method.rb: add a test for [ruby-core:30534].
+Mon Feb 25 14:41:07 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Wed Sep 22 00:52:44 2010 WATANABE Hirofumi <eban@ruby-lang.org>
+ * lib/mkmf.rb (MakeMakefile#init_mkmf): default libdirname to libdir.
- * lib/rdoc/ri/store.rb (save_cache): remove duplicate entries.
+ * tool/rbinstall.rb: ditto.
-Wed Sep 22 00:00:05 2010 Tanaka Akira <akr@fsij.org>
+Mon Feb 25 13:12:39 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * ext/pathname/pathname.c (path_f_pathname): Pathname() translated
- from pathname.rb.
+ * 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.
-Tue Sep 21 22:18:30 2010 NAKAMURA Usaku <usa@ruby-lang.org>
+Mon Feb 25 12:48:00 2013 Zachary Scott <zachary@zacharyscott.net>
- * tool/mkconfig.rb: fixed build problem on mswin64 introduced in r29278.
+ * thread.c: Document Thread::new, clean up ::fork and mention calling
+ super if subclassing Thread
-Tue Sep 21 02:42:35 2010 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
+Mon Feb 25 12:38:50 2013 Tanaka Akira <akr@fsij.org>
- * test/pathname/test_pathname.rb (TestPathname#test_mkdir): fix typo.
+ * 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 Sep 20 23:23:05 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Mon Feb 25 11:03:38 2013 Akinori MUSHA <knu@iDaemons.org>
- * dir.c (bracket): get rid of scanning at the end of the pattern
- string, not to raise an exception while globbing command line.
- [ruby-core:32478]
+ * configure.in (unexpand_shvar): Use the numeric comparison
+ operator instead of '==' which is a ksh extension. [Bug #7941]
-Mon Sep 20 11:25:49 2010 Tanaka Akira <akr@fsij.org>
+Mon Feb 25 02:37:56 2013 Tanaka Akira <akr@fsij.org>
- * ext/pathname/pathname.c (Init_pathname): Pathname#=~ undefinition
- translated from pathname.rb.
+ * ext/socket: define and use union_sockaddr instead of struct
+ sockaddr_storage for less casts.
-Mon Sep 20 02:34:11 2010 Kenta Murata <mrkn@mrkn.jp>
+ * ext/socket/rubysocket.h (union_sockaddr): defined.
- * ext/bigdecimal/bigdecimal.c (check_rounding_mode, BigDecimal_mode):
- raise ArgumentError instead of TypeError passing invalid modes.
+ * ext/socket/socket.c (sock_accept): use union_sockaddr.
+ (sock_accept_nonblock): ditto.
+ (sock_sysaccept): ditto.
+ (sock_s_getnameinfo): ditto.
- * test/bigdecimal/test_bigdecimal.rb (test_mode, test_round):
- change against the above modifications.
+ * ext/socket/basicsocket.c (bsock_getsockname): ditto.
+ (bsock_getpeername): ditto.
+ (bsock_local_address): ditto.
+ (bsock_remote_address): ditto.
-Sun Sep 19 22:08:39 2010 Yuki Sonoda (Yugui) <yugui@yugui.jp>
+ * ext/socket/ancdata.c (bsock_recvmsg_internal): ditto.
- * lib/mkmf.rb (try_link): rdoc
- (try_compile): ditto
- (try_cpp): ditto
- (try_func): ditto
- (try_var): ditto
- (try_run): ditto
- (egrep_cpp): ditto
+ * ext/socket/init.c (recvfrom_arg): ditto.
+ (recvfrom_blocking): ditto.
+ (rsock_s_recvfrom): ditto.
+ (rsock_s_recvfrom_nonblock): ditto.
+ (rsock_getfamily): ditto.
-Sun Sep 19 20:43:33 2010 Yuki Sonoda (Yugui) <yugui@yugui.jp>
+ * 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.
- * configure.in (--disable-install-doc): disables capi too, in addition
- to rdoc.
- (--disable-install-rdoc): a new option for disabling only rdoc.
- (--disable-install-capi): a new option for disabling only capi.
+ * ext/socket/tcpserver.c (tcp_accept): ditto.
+ (tcp_accept_nonblock): ditto.
+ (tcp_sysaccept): ditto.
-Sun Sep 19 20:37:45 2010 Yuki Sonoda (Yugui) <yugui@yugui.jp>
+ * ext/socket/ipsocket.c (ip_addr): ditto.
+ (ip_peeraddr): ditto.
+ (ip_s_getaddress): ditto.
- * common.mk (clean): removes all documents on cleaning.o
- (CAPIOUT): new variable.
- (clean-capi, distclean-capi, realclean-capi): new targets
+Sun Feb 24 21:15:05 2013 Tadayoshi Funaba <tadf@dotrb.org>
- * Makefile.in (clean-capi, distclean-capi, realclean-capi): ditto.
+ * ext/date/date_core.c: [ruby-core:52303]
- * win32/Makefile.sub (clean-capi, distclean-capi, realclean-capi):
- ditto.
+Sun Feb 24 15:33:46 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Sun Sep 19 13:44:24 2010 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]
- * configure.in (LIBRUBY_SO): fix an oversight of replace
- RUBY_INSTALL_NAME with RUBY_SO_NAME. a patch from Jeremy Evans
- at [ruby-core:32474].
+Sun Feb 24 15:32:36 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Sun Sep 19 07:48:20 2010 Tanaka Akira <akr@fsij.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]
- * ext/pathname/pathname.c (path_unlink): Pathname#unlink and
- Pathname#delete translated from pathname.rb.
+Sun Feb 24 15:14:43 2013 Eric Hodel <drbrain@segment7.net>
-Sun Sep 19 06:06:07 2010 Kenta Murata <mrkn@mrkn.jp>
+ * 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.
- * ext/bigdecimal/bigdecimal.c (check_rounding_mode): added for
- converting symbol to rounding mode number.
+Wed Feb 20 14:28:00 2013 Zachary Scott <zachary@zacharyscott.net>
- * ext/bigdecimal/bigdecimal.c (BigDecimal_mode, BigDecimal_round):
- support to specify rounding mode by symbol.
+ * thread.c: Document ThreadGroup::Default
- * test/bigdecimal/test_bigdecimal.rb (test_mode, test_round):
- add tests for above changes.
+Wed Feb 20 14:23:00 2013 Zachary Scott <zachary@zacharyscott.net>
-Sun Sep 19 05:14:35 2010 Kenta Murata <mrkn@mrkn.jp>
+ * thread.c: Grammar for #backtrace_locations and ::handle_interrupt
- * ext/bigdecimal/bigdecimal.c: fix rounding algorithms for half-down
- and half-even. This change is based on the patch created by Matthew
- Willson, the reporter of this bug. [Bug #3803] [ruby-core:32136]
+Sun Feb 24 13:35:57 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * test/bigdecimal/test_bigdecimal.rb: add tests for above changes.
+ * 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 Sep 18 20:09:51 2010 Tanaka Akira <akr@fsij.org>
+Wed Feb 20 13:23:00 2013 Zachary Scott <zachary@zacharyscott.net>
- * ext/pathname/pathname.c (path_each_entry): Pathname#each_entry
- translated from pathname.rb.
+ * object.c: Document methods receiving string and convert to symbol
+ Patch by Stefan Rusterholz
+ * vm_eval.c: ditto
+ * vm_method.c: ditto
-Fri Sep 17 23:44:07 2010 Kouhei Sutou <kou@cozmixng.org>
+Wed Feb 20 07:20:56 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
- * lib/rexml/xpath_parser.rb, test/rexml/test_xpath.rb:
- add missing method availability check. [ruby-core:32447]
- Reported by Wiebe Cazemier. Thanks!!!
+ * signal.c (sigsegv): suppress unused result warning. Because
+ write(2) is marked __warn_unused_result__ on Linux glibc.
-Fri Sep 17 23:23:26 2010 Kouhei Sutou <kou@cozmixng.org>
+Sun Feb 24 07:50:53 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * test/rexml/test_sax.rb: don't use thread and sleep to avoid slow test.
+ * compile.c (iseq_set_arguments): no keyword check if any keyword rest
+ argument exists, even unnamed. [ruby-core:52744] [Bug #7922]
-Fri Sep 17 23:10:44 2010 Kouhei Sutou <kou@cozmixng.org>
+Sat Feb 23 16:51:00 2013 Zachary Scott <zachary@zacharyscott.net>
- * test/rexml/test_core.rb: enable.
+ * thread.c: Documentation for Thread#backtrace_locations
-Fri Sep 17 22:46:02 2010 Kouhei Sutou <kou@cozmixng.org>
+Sat Feb 23 16:05:00 2013 Zachary Scott <zachary@zacharyscott.net>
- * test/rexml/: untabify.
+ * vm.c: Typo in ObjectSpace::WeakMap overview
-Fri Sep 17 22:29:56 2010 Kouhei Sutou <kou@cozmixng.org>
+Sat Feb 23 16:00:00 2013 Zachary Scott <zachary@zacharyscott.net>
- * test/rexml/: fix fixture data path. All REXML tests are worked.
+ * thread.c: Improved rdoc for ::handle_interrupt, ::pending_interrupt?
+ and #pending_interrupt?
-Fri Sep 17 22:15:15 2010 Kouhei Sutou <kou@cozmixng.org>
+Sat Feb 23 12:26:43 2013 Akinori MUSHA <knu@iDaemons.org>
- * test/rexml/test_listener.rb: remove needless codes.
+ * misc/ruby-electric.el (ruby-electric-curlies)
+ (ruby-electric-matching-char, ruby-electric-bar): Avoid electric
+ insertion when there is a prefix argument.
-Fri Sep 17 22:12:23 2010 Kouhei Sutou <kou@cozmixng.org>
+ * 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.
- * test/rexml/: import REXML tests from
- http://www.germane-software.com/repos/rexml/trunk/test/.
- Many tests are failed temporary. I'll fix them quickly. Sorry.
+Sat Feb 23 12:35:00 2013 Zachary Scott <zachary@zacharyscott.net>
-Fri Sep 17 16:48:49 2010 URABE Shyouhei <shyouhei@ruby-lang.org>
+ * 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
- * test/io/console/test_io_console.rb (TestIO_Console::helper):
- PTY.open is not guaranteed to work. On my machine opening a
- pty is prohibited via process control group. On those cases
- exceptions shall occur, and that doesn't mean our fault.
- Skip those tests on such situations.
+Sat Feb 23 10:50:00 2013 Zachary Scott <zachary@zacharyscott.net>
-Fri Sep 17 08:30:27 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * array.c (rb_ary_diff, rb_ary_and, rb_ary_or): Document return order
+ [RubySpec #7803]
- * lib/tracer.rb: count only non-internal libraries in stack trace,
- ignoring custom_require. [ruby-core:31858]
+Sat Feb 23 10:17:00 2013 Zachary Scott <zachary@zacharyscott.net>
-Fri Sep 17 02:18:41 2010 Akinori MUSHA <knu@iDaemons.org>
+ * object.c (rb_obj_comp): Documenting Object#<=> return values
+ Patch by Stefan Rusterholz
- * tool/mkconfig.rb: Fix build with m4 1.4.15 generating duplicate
- lines in config.status. According to nobu, the mswin32 port may
- depend on the piece of code in question, so the behavior is left
- unchanged on mswin32.
+Sat Feb 23 09:48:41 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Thu Sep 16 23:47:59 2010 Tanaka Akira <akr@fsij.org>
+ * dir.c (file_s_fnmatch, fnmatch_brace): encoding-incompatible pattern
+ and string do not match, instead of exception. [ruby-dev:47069]
+ [Bug #7911]
- * ext/pathname/pathname.c (path_opendir): Pathname#opendir translated
- from pathname.rb.
+Sat Feb 23 08:57:46 2013 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
-Thu Sep 16 21:40:37 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * doc/NEWS-*: Update NEWS from their respective branches
- * lib/test/unit.rb (Test::Unit::GlobOption): merged RejectOption.
+Sat Feb 23 08:14:43 2013 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
- * test/runner.rb: utilize GlobOption.
+ * NEWS: many additions for Ruby 2.0.0
-Thu Sep 16 21:31:24 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * object.c: Add doc for Module.prepended
- * lib/rdoc/ri/driver.rb (RDoc::RI::Driver.setup_options)
- (RDoc::RI::Driver.fixup_options): split from process_args.
- libraries should not parse ARGV inside, since it's a task of
- applications, not libraries.
+Sat Feb 23 07:52:53 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Thu Sep 16 21:02:30 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * template/ruby.pc.in: reorder library flags which may refer library
+ names. [Bug #7913]
- * lib/rdoc/ri/paths.rb (RDoc::RI::Paths.each): HOMEDIR can be nil
- if $HOME is unset.
+Fri Feb 22 23:46:20 2013 CHIKANAGA Tomoyuki <nagachika@ruby-lang.org>
-Thu Sep 16 14:50:42 2010 URABE Shyouhei <shyouhei@ruby-lang.org>
+ * lib/rexml/document.rb (REXML::Document.entity_expansion_text_limit):
+ fix a typo in comment in r39384.
- * test/ruby/test_file_exhaustive.rb (TestFileExhaustive::test_expand_path):
- ENV["HOME"] might not be set. On those cases without it an
- exception raises here, which effectively disables later
- tests on this method.
+Fri Feb 22 18:31:46 2013 Aaron Patterson <aaron@tenderlovemaking.com>
-Thu Sep 16 08:30:28 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * lib/rexml/document.rb (REXML::Document.entity_expansion_text_limit):
+ new attribute to read/write entity expansion text limit. the default
+ limit is 10Kb.
- * sprintf.c (rb_f_sprintf): fix rdoc. pointed out by Tomoyuki
- Chikanaga at [ruby-core:32395], and a patch from Daniel
- Bovensiepen at [ruby-core:32403].
+ * lib/rexml/text.rb (REXML::Text.unnormalize): check above attribute.
-Thu Sep 16 08:27:36 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Fri Feb 22 17:36:23 2013 NARUSE, Yui <naruse@ruby-lang.org>
- * ext/etc/extconf.rb: use expanded sysconfdir with empty DESTDIR.
- [ruby-core:32394]
+ * test/test_rbconfig.rb (TestRbConfig): fix r39372.
+ It must see RbConfig::CONFIG instead of CONFIG.
-Thu Sep 16 06:07:24 2010 Tanaka Akira <akr@fsij.org>
+Fri Feb 22 14:55:41 2013 Naohisa Goto <ngotogenome@gmail.com>
- * ext/pathname/pathname.c (path_rmdir): Pathname#rmdir translated
- from pathname.rb.
+ * signal.c (ruby_abort): fix typo in r39354 [Bug #5014]
-Thu Sep 16 00:36:25 2010 NARUSE, Yui <naruse@ruby-lang.org>
+Fri Feb 22 12:46:41 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * ext/readline/extconf.rb: Remove Readline 6 check because
- Ruby's license is now GPLv3 compatible. [ruby-core:28736]
+ * random.c (rb_random_ulong_limited): fix error message for negative
+ value. [ruby-dev:47061] [Bug #7903]
-Thu Sep 16 00:26:00 2010 NARUSE, Yui <naruse@ruby-lang.org>
+Fri Feb 22 11:36:45 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * COPYING: change Ruby's License from a dual license with GPLv2
- to a dual license with 2-clause BSDL.
- [ruby-dev:42166] [ruby-core:31971]
- [ruby-dev:39167] [ruby-core:25272]
+ * test/test_rbconfig.rb (TestRbConfig): skip user defined values by
+ configuration options. [Bug #7902]
- * COPYING.ja: ditto.
+Fri Feb 22 11:33:42 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * BSDL: added. this is from The FreeBSD License.
+ * lib/mkmf.rb (MakeMakefile#init_mkmf): adjust default library path
+ for multiarch. [Bug #7874]
-Wed Sep 15 21:07:06 2010 Tanaka Akira <akr@fsij.org>
+Fri Feb 22 11:10:00 2013 Zachary Scott <zachary@zacharyscott.net>
- * ext/pathname/pathname.c (path_mkdir): Pathname#mkdir translated
- from pathname.rb.
+ * enum.c (Enumerable#chunk: Improved examples, grammar, and formatting
+ Patch by Dan Bernier and Rich Bruchal of newhaven.rb
+ [Github documenting-ruby/ruby#8]
-Wed Sep 15 13:37:00 2010 URABE Shyouhei <shyouhei@ruby-lang.org>
+Fri Feb 22 11:00:00 2013 Zachary Scott <zachary@zacharyscott.net>
- * test/net/imap/test_imap.rb: "localhost" not guaranteed to
- resolve to "127.0.0.1". On my machine it is "::1" instead.
- The problem is, you have to connect to the imaps server via
- the canonical name written in a server certificate, and that
- of the server.cert is "localhost". So you have to listen to
- the address of what "localhost" resolves to. I think this
- situation cannot be resolved in a handy manner because the
- test "test_imaps_post_connection_check" is actually
- expecting to connect to a server via an address other than
- the CN. On my machine several assertions won't pass because
- the test cannot connect to the server.
+ * 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]
-Wed Sep 15 09:12:03 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Fri Feb 22 07:04:41 2013 Eric Hodel <drbrain@segment7.net>
- * io.c (rb_io_puts): fix for wide char encoding strings.
- [ruby-dev:42212]
+ * 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.
-Wed Sep 15 07:27:52 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Fri Feb 22 06:30:57 2013 Eric Hodel <drbrain@segment7.net>
- * string.c (rb_str_format_m): mentioned about Hash argument. a patch
- from Daniel Bovensiepen at [ruby-core:32386].
+ * doc/globals.rdoc: Document what setting $DEBUG does.
- * sprintf.c (get_hash): ditto, and fix typo.
+ * doc/globals.rdoc: Added pointer to $-d for full documentation.
-Wed Sep 15 07:22:20 2010 Tanaka Akira <akr@fsij.org>
+Fri Feb 22 06:27:07 2013 Eric Hodel <drbrain@segment7.net>
- * ext/pathname/pathname.c (path_entries): Pathname#entries translated
- from pathname.rb.
+ * doc/globals.rdoc: Document what setting $VERBOSE does. [Bug #7899]
-Wed Sep 15 02:13:44 2010 Aaron Patterson <aaron@tenderlovemaking.com>
+ * doc/globals.rdoc: Added pointer to $-w and $-v for full
+ documentation.
- * ext/fiddle/closure.c : Don't use FFI closure alloc on OpenBSD.
- Thanks Jeremy Evans! [ruby-core:32384]
+Fri Feb 22 02:33:00 2013 Zachary Scott <zachary@zacharyscott.net>
-Tue Sep 14 20:17:48 2010 Tanaka Akira <akr@fsij.org>
+ * lib/abbrev.rb: Add words parameter to Abbrev::abbrev
+ Patch by Devin Weaver [Github documenting-ruby/ruby#7]
- * ext/pathname/pathname.c (path_s_getwd): Pathname.getwd and
- Pathname.pwd translated from pathname.rb.
+Thu Feb 21 17:28:14 2013 NARUSE, Yui <naruse@ruby-lang.org>
-Tue Sep 14 05:13:04 2010 Tanaka Akira <akr@fsij.org>
+ * tool/merger.rb: add interaction when only ChangeLog is modified.
- * ext/pathname/pathname.c (path_s_glob): Pathname.glob translated
- from pathname.rb.
+Thu Feb 21 16:34:46 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Tue Sep 14 01:24:51 2010 Yutaka Kanemoto <kanemoto@ruby-lang.org>
+ * signal.c (check_stack_overflow): extract duplicated code and get rid
+ of declaration-after-statement. [Bug #5014]
- * ext/socket/raddrinfo.c (ruby_getaddrinfo__aix): suppress a
- warning.
+Thu Feb 21 14:14:13 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-Mon Sep 13 20:48:30 2010 Tanaka Akira <akr@fsij.org>
+ * signal.c (sigsegv): avoid to use async signal unsafe functions
+ when nested sigsegv is happen.
+ [Bug #5014] [ruby-dev:44082]
- * ext/pathname/pathname.c (path_zero_p): Pathname#zero? translated
- from pathname.rb.
+Thu Feb 21 13:47:59 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-Mon Sep 13 19:56:50 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * file.c (rb_group_member): added an error check. SUS says,
+ getgroups(small_value) may return EINVAL.
- * ext/socket/rubysocket.h (__DARWIN_ALIGNBYTES): workaround of a
- bug in system header of darwin 9. [ruby-core:32341]
+Thu Feb 21 13:37:07 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-Mon Sep 13 18:11:55 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * process.c (RB_MAX_GROUPS): moved to
+ * internal.h (RB_MAX_GROUPS): here.
- * lib/mkmf.rb (try_do): fix typo. a patch from Peter Weldon
- at [ruby-core:32327].
+ * file.c (rb_group_member): use RB_MAX_GROUPS instead of
+ RUBY_GROUP_MAX. They are the same.
-Mon Sep 13 10:12:09 2010 NARUSE, Yui <naruse@ruby-lang.org>
+Thu Feb 21 13:15:40 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
- * util.c (ruby_strtod): reject Float('0x0.').
- [ruby-dev:42239] Bug #3820
+ * 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.
-Mon Sep 13 09:23:58 2010 NARUSE, Yui <naruse@ruby-lang.org>
+Thu Feb 21 13:04:59 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
- * ext/openssl/ossl_bn.c (ossl_bn_is_prime): fix comparison
- with rb_scan_args. Before this fix, OpenSSL::BN#prime?
- is fully broken. [ruby-dev:42225]
+ * file.c (eaccess): use access() when not using setuid nor setgid.
+ This is minor optimization.
-Mon Sep 13 06:45:24 2010 Tanaka Akira <akr@fsij.org>
+Thu Feb 21 12:56:19 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
- * ext/pathname/pathname.c (path_writable_real_p):
- Pathname#writable_real? translated from pathname.rb.
+ * file.c (rb_group_member): get rid of NGROUPS dependency.
+ [Bug #7886] [ruby-core:52537]
-Sun Sep 12 21:21:50 2010 Tadayoshi Funaba <tadf@dotrb.org>
+Thu Feb 21 12:45:03 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * lib/date.rb: [ruby-core:32096] Thanks Colin Bartlett.
+ * ruby.c (ruby_init_loadpath_safe): try two levels upper for stripping
+ libdir name. [Bug #7874]
-Sun Sep 12 19:30:27 2010 Tanaka Akira <akr@fsij.org>
+ * configure.in (libdir_basename): expand with multiarch in configure,
+ not to defer the expansion till ruby.pc.in and mkmf.rb. [Bug #7874]
- * ext/pathname/pathname.c (path_world_writable_p):
- Pathname#world_writable? translated from pathname.rb.
+ * configure.in (libdir_basename): also -rpath and -install_name flags
+ are affected when libruby directory changes. [Bug #7874]
-Sun Sep 12 09:16:06 2010 Tanaka Akira <akr@fsij.org>
+Wed Feb 20 19:27:02 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * ext/pathname/pathname.c (path_writable_p): Pathname#writable?
- translated from pathname.rb.
+ * include/ruby/ruby.h (HAVE_RB_SCAN_ARGS_OPTIONAL_HASH): for
+ rb_scan_args() optional hash feature. [Bug #7861]
-Sun Sep 12 08:36:15 2010 Tanaka Akira <akr@fsij.org>
+Wed Feb 20 18:02:26 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * process.c (rlimit_resource_name2int): support more limits:
- RLIMIT_MSGQUEUE, RLIMIT_NICE, RLIMIT_RTPRIO, RLIMIT_RTTIME and
- RLIMIT_SIGPENDING.
- (Init_process): ditto.
- patch by Run Paint Run Run. [ruby-core:32262]
+ * configure.in (target_os): do not strip -gnu suffix on Linux if
+ --target is given explicitly. [Bug #7874]
-Sun Sep 12 04:27:13 2010 Tanaka Akira <akr@fsij.org>
+ * configure.in (libdirname): adjust library path name which libruby
+ files will be installed. [Bug #7874]
- * process.c (rlimit_resource_name2int): use STRCASECMP to avoid
- ALLOCA_N.
+ * tool/rbinstall.rb (libdir): ditto.
-Sat Sep 11 16:47:41 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Wed Feb 20 13:37:00 2013 Zachary Scott <zachary@zacharyscott.net>
- * hash.c (ruby_setenv): raise if putenv and SetEnvironmentVariable
- failed, because of the restriction of the size on Windows.
- based on a patch from Peter Weldon at [ruby-core:32304]. fix:
- Bug#3812, [ruby-core:32250]
+ * ext/pty/pty.c: Documentation for the PTY module
-Sat Sep 11 15:19:57 2010 Eric Hodel <drbrain@segment7.net>
+Wed Feb 20 12:18:00 2013 Zachary Scott <zachary@zacharyscott.net>
- * lib/webrick/httpauth/digestauth.rb (WEBrick::Config::DigestAuth):
- Add documentation
+ * object.c: Document Data class [Bug #7890] [ruby-core:52549]
+ Patch by Matthew Mongeau
- * lib/webrick/config.rb (WEBrick::Config::DigestAuth): Add
- documentation
+Wed Feb 20 11:50:00 2013 Zachary Scott <zachary@zacharyscott.net>
-Sat Sep 11 12:32:05 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * lib/mutex_m.rb: Add rdoc for Mutex_m module
- * include/ruby/intern.h (rb_set_kcode, rb_get_kcode): removed
- zombie prototype declarations. a patch from Eric Hodel
- at [ruby-core:32305].
+Wed Feb 20 09:34:43 2013 Eric Hodel <drbrain@segment7.net>
-Sat Sep 11 06:53:12 2010 Tanaka Akira <akr@fsij.org>
+ * 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.
- * ext/pathname/pathname.c (path_symlink_p): Pathname#symlink?
- translated from pathname.rb.
+Wed Feb 20 07:51:19 2013 Eric Hodel <drbrain@segment7.net>
-Fri Sep 10 23:03:43 2010 Tanaka Akira <akr@fsij.org>
+ * lib/rubygems/installer.rb: Use gsub instead of gsub! to avoid
+ altering @bin_dir. Fixes tests on windows. [ruby-trunk - Bug #7885]
- * ext/pathname/pathname.c (path_sticky_p): Pathname#sticky? translated
- from pathname.rb.
+Tue Feb 19 20:50:00 2013 Kenta MURATA <mrkn@mrkn.jp>
-Fri Sep 10 19:11:13 2010 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
+ * ext/bigdecimal/bigdecimal.gemspec: bump to 1.2.0.
+ [ruby-core:51777] [Bug #7761]
- * lib/webrick/httprequest.rb (WEBrick::HTTPRequest#continue): add
- method for generating HTTP/1.1 100 continue response if the client
- expects it, otherwise does nothing. Patch by Brian Candler.
- ref #855.
+Tue Feb 19 13:07:25 2013 Akinori MUSHA <knu@iDaemons.org>
- * test/webrick/test_httprequest.rb: test added.
+ * ext/syslog/syslog.c (Init_syslog): Define inspect as a singleton
+ method and remove it as an instance method. [Bug #6502]
-Fri Sep 10 17:49:34 2010 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
+Tue Feb 19 12:30:00 2013 Zachary Scott <zachary@zacharyscott.net>
- * ext/openssl/lib/openssl/x509-internal.rb: removed unused local
- variable.
+ * object.c: rdoc formatting for Kernel#Array()
+ * array.c: Add rdoc for Array() method to Creating Arrays section
- * test/openssl/*: less warnings while test running with -w.
+Tue Feb 19 10:35:52 2013 Eric Hodel <drbrain@segment7.net>
-Fri Sep 10 16:49:20 2010 Akinori MUSHA <knu@iDaemons.org>
+ * ext/openssl/ossl.c (class OpenSSL): Use only inner parenthesis in
+ create_extension examples.
- * class.c (rb_scan_args): Add support for optional keyword
- argument hash. [ruby-dev:42221] [ruby-dev:38048]
+Tue Feb 19 10:27:12 2013 Eric Hodel <drbrain@segment7.net>
- * README.EXT, README.EXT.ja: Update documentation accordingly.
+ * ext/openssl/ossl.c (class OpenSSL): Fixed ExtensionFactory example.
+ Patch by Richard Bradley. [ruby-trunk - Bug #7551]
- * dir.c (dir_initialize): Make use of the new rb_scan_args()
- feature.
+Tue Feb 19 08:32:11 2013 Koichi Sasada <ko1@atdot.net>
- * io.c (rb_io_s_popen, rb_scan_open_args, rb_io_initialize)
- (rb_io_s_pipe, open_key_args, io_s_foreach, io_s_readlines)
- (rb_io_s_read, rb_io_set_encoding): Ditto.
+ * vm_eval.c (vm_call0_body): check interrupts after method dispatch
+ from C methods. [Bug #7878]
- * transcode.c (str_transcode, econv_args)
- (econv_primitive_convert): Ditto.
+Tue Feb 19 08:14:40 2013 Eric Hodel <drbrain@segment7.net>
- * ext/zlib/zlib.c (rb_gzreader_initialize): Ditto.
+ * lib/rubygems/installer.rb: Fixed placement of executables with
+ --user-install. [ruby-trunk - Bug #7779]
+ * test/rubygems/test_gem_installer.rb: Test for above.
-Fri Sep 10 10:33:18 2010 NARUSE, Yui <naruse@ruby-lang.org>
+Tue Feb 19 06:04:06 2013 NARUSE, Yui <naruse@ruby-lang.org>
- * random.c (rb_genrand_ulong_limited): renamed from
- rb_rand_internal and now this is public API.
+ * 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).
- * include/ruby/ruby.h (rb_genrand_ulong_limited): added.
+ * configure.in: remove r38342's hack and check libunwind.
- * bignum.c (big_sparse_p): use rb_genrand_ulong_limited.
+Tue Feb 19 04:26:29 2013 NARUSE, Yui <naruse@ruby-lang.org>
-Fri Sep 10 13:07:22 2010 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
+ * configure.in: check whether backtrace(3) works well or not.
- * ext/digest/lib/digest.rb: removed unused exception variable
- assignment to avoid a warning.
+ * vm_dump.c: set HAVE_BACKTRACE 0 if BROKEN_BACKTRACE.
-Fri Sep 10 07:29:14 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Mon Feb 18 16:30:18 2013 Akinori MUSHA <knu@iDaemons.org>
- * ext/etc/etc.c (etc_systmpdir): assume system default tmpdir
- safe. [ruby-dev:42089]
+ * lib/ipaddr.rb (IPAddr#in6_addr): Fix a typo with the closing
+ parenthesis.
-Fri Sep 10 07:03:23 2010 Tanaka Akira <akr@fsij.org>
+Mon Feb 18 12:32:24 2013 Akinori MUSHA <knu@iDaemons.org>
- * ext/pathname/pathname.c (path_size_p): Pathname#size? translated from
- pathname.rb.
+ * 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]
-Fri Sep 10 02:15:29 2010 Tanaka Akira <akr@fsij.org>
+Mon Feb 18 10:09:54 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * ext/socket/option.c (inspect_peercred): support OpenBSD-current.
- patch by Jeremy Evans. [ruby-core:32240]
+ * configure.in (unexpand_shvar): regularize a shell variable by
+ unexpanding shell variables in it.
-Thu Sep 9 23:25:53 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Sun Feb 17 20:55:44 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * vm.c (vm_backtrace_each): skip allocator frames which have no
- name. [ruby-core:32231]
+ * compar.c (rb_invcmp): compare by inversed comparison, with preventing
+ from infinite recursion. [ruby-core:52305] [Bug #7870]
-Thu Sep 9 22:39:08 2010 Tanaka Akira <akr@fsij.org>
+ * string.c (rb_str_cmp_m), time.c (time_cmp): get rid of infinite
+ recursion.
- * ext/pathname/pathname.c (path_size): Pathname#size translated from
- pathname.rb.
+Sun Feb 17 17:23:22 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Thu Sep 9 22:34:48 2010 wanabe <s.wanabe@gmail.com>
+ * 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]
- * compile.c (case_when_optimizable_literal): When float value can be
- treated as integer, add to table hash of case that way.
- based on a patch from Ikuo KOBORI. [ruby-dev:42038]
+Sun Feb 17 01:19:00 2013 Zachary Scott <zachary@zacharyscott.net>
- * insns.def (opt_case_dispatch): ditto.
+ * ext/psych/lib/psych/y.rb: Document Kernel#y by Adam Stankiewicz
+ [Github tenderlove/psych#127]
- * test/ruby/test_case.rb: add tests.
+Sun Feb 17 00:52:14 2013 NARUSE, Yui <naruse@ruby-lang.org>
-Thu Sep 9 17:15:15 2010 NAKAMURA, Hiroshi <nahi@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.
- * test/net/http/test_https.rb (test_identity_verify_failure): follows
- the SSL hostname check error message of openssl.
+Sat Feb 16 20:51:17 2013 Kazuki Tsujimoto <kazuki@callcc.net>
-Thu Sep 9 10:44:46 2010 NARUSE, Yui <naruse@ruby-lang.org>
+ * vm.c (ENV_IN_HEAP_P): fix off-by-one error.
- * test/ruby/test_env.rb (test_aset): OpenBSD acts like NetBSD in
- that it ignores characters after = in ENV.
- patched by Jeremy Evans [ruby-core:32184]
+Sat Feb 16 20:47:16 2013 Akinori MUSHA <knu@iDaemons.org>
-Thu Sep 9 09:02:01 2010 NARUSE, Yui <naruse@ruby-lang.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.
- * tool/rbinstall.rb (install?): gemspec filename should include
- its version. patched by Luis Lavena [ruby-core:32165]
+Sat Feb 16 20:43:20 2013 Tanaka Akira <akr@fsij.org>
-Wed Sep 8 22:46:31 2010 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
+ * ext/socket/ancdata.c (rsock_recvmsg): ignore truncated part of
+ socket address returned from recvmsg().
- * ext/openssl/ossl_ssl.c (ssl_get_error): Thread context switch was
- blocked on Windows while blocking call for SSLSocket. Need to
- convert errno for letting rb_io_wait_readable detect EWOULDBLOCK.
- Patch by arton. ref #3794.
+ * ext/socket/init.c (recvfrom_blocking): ignore truncated part of
+ socket address returned from recvfrom().
+ (rsock_s_recvfrom_nonblock): ditto.
-Wed Sep 8 20:56:57 2010 Tanaka Akira <akr@fsij.org>
+Sat Feb 16 20:05:26 2013 Ayumu AIZAWA <ayumu.aizawa@gmail.com>
- * ext/pathname/pathname.c (path_setgid_p): Pathname#setgid? translated
- from pathname.rb.
+ * test/ruby/test_thread.rb: fixed typo
+ patched by Hiroki Matsue via https://github.com/ruby/ruby/pull/248
-Wed Sep 8 06:25:41 2010 Tanaka Akira <akr@fsij.org>
+Sat Feb 16 16:08:35 2013 Koichi Sasada <ko1@atdot.net>
- * ext/pathname/pathname.c (path_setuid_p): Pathname#setuid? translated
- from pathname.rb.
+ * 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]
-Tue Sep 7 21:03:35 2010 Tanaka Akira <akr@fsij.org>
+ 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.
- * ext/pathname/pathname.c (path_readable_real_p):
- Pathname#readable_real? translated from pathname.rb.
+ * test/ruby/test_method.rb: add a test.
-Mon Sep 6 23:07:25 2010 Tanaka Akira <akr@fsij.org>
+Sat Feb 16 15:45:56 2013 Koichi Sasada <ko1@atdot.net>
- * ext/pathname/pathname.c (path_world_readable_p):
- Pathname#world_readable? translated from pathname.rb.
+ * 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]
-Mon Sep 6 11:03:13 2010 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
+ * test/ruby/test_settracefunc.rb: add a test.
- * Fixed wrong check of missing functions. Patch by Adrian Quark.
- ref #3400
- The patch contains following comment:
- This patch should avoid unnecessary incompatibility with future
- versions of Openssl. Changes suggested by bmaher_at_amazon.com.
+Sat Feb 16 13:40:13 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Mon Sep 6 10:46:55 2010 NAKAMURA, Hiroshi <nahi@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]
- * Fixed exception message for SSL post connection check failure. Patch
- by Paul Betteridge. ref [Bug #3704]
+Sat Feb 16 13:13:04 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Mon Sep 6 10:31:59 2010 NARUSE, Yui <naruse@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/readline/readline.c (readline_s_get_line_buffer):
- Readline.line_buffer should return locale string.
- [ruby-dev:42184] #3791
+ * ext/io/console/console.c (console_dev): compatibility with ruby 1.8.
-Mon Sep 6 09:47:24 2010 NARUSE, Yui <naruse@ruby-lang.org>
+ * ext/io/console/console.c (rawmode_opt, console_dev): compatibility
+ with ruby 1.9. [ruby-core:52220] [Bug #7847]
- * util.c (ruby_strtod): check there is at least 1 digit after
- "0x" before ".". [ruby-dev:42183] #3790
+Sat Feb 16 12:45:50 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Mon Sep 6 09:44:50 2010 NARUSE, Yui <naruse@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]
- * util.c (ruby_strtod): check integer overflow.
- [ruby-dev:42180] #3789
+Sat Feb 16 12:15:20 2013 Aaron Patterson <aaron@tenderlovemaking.com>
-Mon Sep 6 06:17:21 2010 Tanaka Akira <akr@fsij.org>
+ * parse.y: add dtrace probe for symbol create.
- * ext/pathname/pathname.c (path_readable_p): Pathname#readable?
- translated from pathname.rb.
+ * probes.d: ditto
-Sun Sep 5 23:02:34 2010 Tanaka Akira <akr@fsij.org>
+Sat Feb 16 09:27:37 2013 Tanaka Akira <akr@fsij.org>
- * ext/pathname/pathname.c (path_owned_p): Pathname#owned?
- translated from pathname.rb.
+ * 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 Sep 4 23:48:47 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Sat Feb 16 09:24:37 2013 Tanaka Akira <akr@fsij.org>
- * file.c (rb_file_s_readlink): symlink target should be in
- filesystem encoding.
+ * ext/socket/extconf.rb: reorder header tests to consider inclusion
+ order in rubysocket.h.
-Sat Sep 4 10:40:50 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Sat Feb 16 08:42:58 2013 Tanaka Akira <akr@fsij.org>
- * load.c (ruby_init_ext): export for golfers.
+ * configure.in, ext/socket/extconf.rb: test netinet/in_systm.h in
+ ext/socket/extconf.rb instead of configure.in.
- * vm_core.h (rb_iseq_eval, rb_iseq_compile_with_option): ditto.
+ Originally, netinet/in_systm.h is included for NextStep, OpenStep,
+ and Rhapsody. [ruby-core:1596]
-Sun May 23 17:29:41 2010 Yuki Sonoda (Yugui) <yugui@yugui.jp>
+Sat Feb 16 07:55:40 2013 Tanaka Akira <akr@fsij.org>
- * common.mk (capi): uses a timestamp file to get rid of
- generating twice.
+ * configure.in: don't test xti.h here.
-Fri Jun 18 01:33:21 2010 Yuki Sonoda (Yugui) <yugui@yugui.jp>
+ * ext/socket/extconf.rb: test xti.h here.
- * enc/Makefile.in (realclean): has been missing. necessary
- for make realclean-enc.
+ Originally, xti.h is included for IRIX [ruby-core:14447].
-Fri Sep 3 23:51:26 2010 Tanaka Akira <akr@fsij.org>
+Sat Feb 16 07:16:49 2013 Tanaka Akira <akr@fsij.org>
- * ext/pathname/pathname.c (path_socket_p): Pathname#socket?
- translated from pathname.rb.
+ * ext/socket/extconf.rb: test struct sockaddr_un and its member,
+ sun_len.
-Fri Sep 3 06:40:44 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * ext/socket/sockport.h (INIT_SOCKADDR_UN): new macro defined.
- * ext/pty/pty.c (chfunc): pass through exceptions.
+ * ext/socket/socket.c (sock_s_pack_sockaddr_un): use INIT_SOCKADDR_UN.
- * io.c (rb_io_bufwrite, rb_io_bufread): added.
+ * ext/socket/unixsocket.c (rsock_init_unixsock): ditto.
- * process.c (rb_fork_err): protect from exceptions.
+ * ext/socket/raddrinfo.c (init_unix_addrinfo): ditto.
+ (addrinfo_mload): ditto.
-Fri Sep 3 06:16:07 2010 Tanaka Akira <akr@fsij.org>
+Sat Feb 16 07:05:59 2013 Tanaka Akira <akr@fsij.org>
- * ext/pathname/pathname.c (path_pipe_p): Pathname#pipe?
- translated from pathname.rb.
+ * ext/socket/sockport.h (INIT_SOCKADDR_IN): don't need family
+ argument. it is always AF_INET.
-Fri Sep 3 06:14:40 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * ext/socket/raddrinfo.c (make_inetaddr): follow INIT_SOCKADDR_IN
+ change.
+ (addrinfo_ipv6_to_ipv4): ditto.
- * ext/pty/pty.c (chfunc): restore errno from SystemCallError and
- propagate proper exception to the parent. [ruby-dev:41965]
+Sat Feb 16 04:21:07 2013 NAKAMURA Usaku <usa@ruby-lang.org>
-Thu Sep 2 22:10:38 2010 Tanaka Akira <akr@fsij.org>
+ * ext/socket/extconf.rb: workaround for mswin/mingw build problem.
+ sendmsg emulation in win32/win32.c is not enough.
- * ext/pathname/pathname.c (path_file_p): Pathname#file?
- translated from pathname.rb.
+Sat Feb 16 00:19:20 2013 Tanaka Akira <akr@fsij.org>
-Thu Sep 2 09:12:02 2010 NAKAMURA Usaku <usa@ruby-lang.org>
+ * ext/socket/extconf.rb: use all all tested available headers for
+ have_func.
- * win32/win32.c (rb_w32_spawn, rb_w32_aspawn): don't forget to free
- memory.
+Fri Feb 15 22:21:37 2013 Akinori MUSHA <knu@iDaemons.org>
-Thu Sep 2 09:01:13 2010 NAKAMURA Usaku <usa@ruby-lang.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]
- * win32/win32.c (CreateChild): unicodize.
+Fri Feb 15 20:29:11 2013 Tanaka Akira <akr@fsij.org>
- * win32/win32.c (rb_w32_spawn, rb_w32_aspawn): convert arguments of
- CreateChild() from ACP to WideChar.
+ * ext/socket/sockport.h (SET_SIN_LEN): defined for strict-aliasing
+ rule.
+ (INIT_SOCKADDR_IN): ditto.
-Thu Sep 2 06:53:43 2010 Tanaka Akira <akr@fsij.org>
+ * ext/socket/raddrinfo.c (make_inetaddr): use INIT_SOCKADDR_IN.
+ (addrinfo_ipv6_to_ipv4): ditto.
- * ext/pathname/pathname.c (path_directory_p): Pathname#directory?
- translated from pathname.rb.
+Fri Feb 15 18:24:48 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Wed Sep 1 22:03:41 2010 Tanaka Akira <akr@fsij.org>
+ * lib/mkmf.rb (MakeMakefile#try_run): bail out explicitly if cross
+ compiling, because it cannot work of course.
- * ext/pathname/pathname.c (path_grpowned_p): Pathname#grpowned?
- translated from pathname.rb.
+Fri Feb 15 12:34:58 2013 Tanaka Akira <akr@fsij.org>
-Wed Sep 1 17:39:02 2010 Ryan Davis <ryand-ruby@zenspider.com>
+ * ext/socket/extconf.rb: test struct sockaddr_storage directly.
- * lib/minitest/*.rb: Imported minitest 1.7.1 r5835.
- * test/minitest/*.rb: ditto.
+ * ext/socket/rubysocket.h: use HAVE_TYPE_STRUCT_SOCKADDR_STORAGE.
-Wed Sep 1 16:50:42 2010 NARUSE, Yui <naruse@ruby-lang.org>
+Fri Feb 15 12:26:13 2013 Tanaka Akira <akr@fsij.org>
- * string.c (tr_setup_table): optimized. don't create hash objects
- when given pattern is ASCII only.
+ * ext/socket/getaddrinfo.c (GET_AI): don't cast 1st argument for
+ INIT_SOCKADDR.
- * string.c (tr_find): ditto.
+Fri Feb 15 08:12:11 2013 Tanaka Akira <akr@fsij.org>
-Wed Sep 1 14:35:29 2010 NARUSE, Yui <naruse@ruby-lang.org>
+ * ext/socket/sockport.h (SET_SS_LEN): removed.
+ (SET_SIN_LEN): removed.
+ (INIT_SOCKADDR): new macro.
- * array.c (rb_ary_rotate_m): fix typo of rdoc.
- patched by Andrei Kulakov [ruby-core:31975]
+ * ext/socket/ancdata.c (extract_ipv6_pktinfo): use INIT_SOCKADDR.
-Wed Sep 1 14:33:36 2010 NARUSE, Yui <naruse@ruby-lang.org>
+ * ext/socket/raddrinfo.c (make_inetaddr): use INIT_SOCKADDR.
+ (addrinfo_ipv6_to_ipv4): ditto.
- * enum.c (enum_zip): fix typo of rdoc.
- patched by Andrei Kulakov [ruby-core:31974]
+ * ext/socket/getaddrinfo.c (GET_AI): use INIT_SOCKADDR.
-Wed Sep 1 12:56:36 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Fri Feb 15 07:49:27 2013 Eric Hodel <drbrain@segment7.net>
- * thread.c (ruby_suppress_tracing): restore the state and invoke
- the func with normal state. a patch from Satoshi Shiba <shiba
- AT rvm.jp> at [ruby-dev:42162]. [ruby-core:31783]
+ * lib/rdoc.rb: Update to release version of 4.0.0
-Tue Aug 31 21:10:23 2010 Tanaka Akira <akr@fsij.org>
+ * lib/rubygems.rb: Update to release version of 2.0.0
- * ext/pathname/pathname.c (path_exist_p): Pathname#exist? translated
- from pathname.rb.
+Fri Feb 15 07:07:27 2013 Tanaka Akira <akr@fsij.org>
-Tue Aug 31 17:32:34 2010 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
+ * ext/socket/sockport.h (SA_LEN): removed because unused now.
+ (SS_LEN): ditto.
+ (SIN_LEN): ditto.
- * ext/tk/stubs.c: fix [Bug #3771] "VC++ can't make ext/tk with enabling
- stubs". Thanks, Akio Tajima [ruby-dev:42159].
+Thu Feb 14 10:45:31 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-Tue Aug 31 03:42:14 2010 NARUSE, Yui <naruse@ruby-lang.org>
+ * test/ruby/test_process.rb (test_setsid): Added a workaround for
+ MacOS X. Patch by nagachika. [Bug #7826] [ruby-core:52126]
- * string.c (tr_setup_table): fix bug in r29146.
- Initialize table even if cflag is 0; tr_find see whether
- del is empty or not.
+Fri Feb 15 00:15:31 2013 Tanaka Akira <akr@fsij.org>
- * string.c (tr_find): nodel can't be NULL; if NULL, it means
- it is not specified.
+ * ext/socket/sockport.h (VALIDATE_SOCKLEN): new macro to validate
+ sa_len member of 4.4BSD socket address.
-Mon Aug 30 21:29:21 2010 Tanaka Akira <akr@fsij.org>
+ * ext/socket/getnameinfo.c (getnameinfo): use VALIDATE_SOCKLEN,
+ instead of SA_LEN.
- * ext/pathname/pathname.c (path_executable_real_p):
- Pathname#executable_real? translated from pathname.rb.
+ * ext/socket/socket.c (sock_s_getnameinfo): use VALIDATE_SOCKLEN
+ instead of SS_LEN.
-Mon Aug 30 15:00:13 2010 NARUSE, Yui <naruse@ruby-lang.org>
+Thu Feb 14 22:25:54 2013 Tanaka Akira <akr@fsij.org>
- * string.c (tr_setup_table): initialize negating table when
- negating string is given. [ruby-core:31851]
+ * 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.
- * string.c (tr_find): add a sentence for the time when
- target characters include negating one.
+Thu Feb 14 20:11:23 2013 Tanaka Akira <akr@fsij.org>
- * string.c (rb_str_count): move definition.
+ * ext/socket: always operate length of socket address companion with
+ socket address.
-Mon Aug 30 07:32:41 2010 Tanaka Akira <akr@fsij.org>
+ * ext/socket/rubysocket.h (rsock_make_ipaddr): add an argument for
+ socket address length.
+ (rsock_ipaddr): ditto.
- * ext/pathname/pathname.c (path_executable_p): Pathname#executable?
- translated from pathname.rb.
+ * ext/socket/ipsocket.c (ip_addr): pass length to rsock_ipaddr.
+ (ip_peeraddr): ditto.
+ (ip_s_getaddress): pass length to rsock_make_ipaddr.
-Sun Aug 29 23:54:10 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * 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.
- * lib/rdoc/parser/ruby.rb (RDoc#parse_call_parameters): don't
- include assignment. [Bug #3759], [ruby-dev:42154]
+ * ext/socket/init.c (rsock_s_recvfrom): pass length to rsock_ipaddr.
+ (rsock_s_recvfrom_nonblock): ditto.
- * lib/rdoc/parser/ruby.rb (RDoc#parse_class): ignore non-constant
- name singleton class. [Bug #3759], [ruby-dev:42154]
+ * ext/socket/tcpsocket.c (tcp_sockaddr): pass length to
+ rsock_make_ipaddr.
-Sun Aug 29 23:25:18 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * 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.
- * file.c (rb_get_path_check): clarify error message for
- ASCII-incompatible path name.
+Thu Feb 14 14:31:43 2013 Eric Hodel <drbrain@segment7.net>
-Sun Aug 29 16:02:54 2010 NARUSE, Yui <naruse@ruby-lang.org>
+ * lib/net/http.rb: Removed OpenSSL dependency from Net::HTTP.
- * common.mk (node_name.inc): remove command option -n and give
- file as stdin, because IronRuby 1.1 still doesn't support it.
- So now we can use ir.exe as BASERUBY.
+ * test/net/http/test_http.rb: Remove Zlib dependency from tests.
+ * test/net/http/test_http_request.rb: ditto.
- * tool/node_name.rb: read stdin with while gets.
+Thu Feb 14 11:08:15 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Sun Aug 29 13:22:43 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * class.c (include_modules_at): detect cyclic prepend with original
+ method table. [ruby-core:52205] [Bug #7841]
- * vm.c (rb_thread_method_id_and_class): curried proc has no
- method. [ruby-core:31871]
+Thu Feb 14 10:30:41 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Sun Aug 29 12:51:33 2010 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]
- * load.c (rb_provide_feature): clarify error message for frozen
- $LOADED_FEATURES. based on a patch from Run Paint Run Run at
- [ruby-core:31913].
+Thu Feb 14 10:05:57 2013 Eric Hodel <drbrain@segment7.net>
-Sun Aug 29 12:19:58 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * 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.
- * load.c (load_failed): should honor encoding. [ruby-core:31915]
+Thu Feb 14 08:18:47 2013 Tanaka Akira <akr@fsij.org>
-Sun Aug 29 09:35:10 2010 NARUSE, Yui <naruse@ruby-lang.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.
- * common.mk (clean): exclude *.inc. [ruby-dev:41931]
+Wed Feb 13 20:59:48 2013 Tanaka Akira <akr@fsij.org>
- * common.mk (distclean): include *.inc.
+ * ext/socket/extconf.rb: don't define socklen_t here, just test.
- * common.mk (help): change description about clean and distclean.
+ * ext/socket/rubysocket.h: define socklen_t if not available.
-Sat Aug 29 06:34:52 2010 Tanaka Akira <akr@fsij.org>
+Wed Feb 13 18:37:50 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * ext/pathname/pathname.c (path_chardev_p): Pathname#chardev?
- translated from pathname.rb.
+ * proc.c (mnew): skip prepending modules and return the method bound
+ on the given class. [ruby-core:52160] [Bug #7836]
-Sat Aug 28 17:39:33 2010 Kenta Murata <mrkn@mrkn.jp>
+Wed Feb 13 18:11:59 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * ext/bigdecimal/bigdecimal.c (BigDecimal_save_exception_mode,
- BigDecimal_save_rounding_mode, BigDecimal_save_limit): added.
+ * proc.c (method_original_name): new methods Method#original_name and
+ UnboundMethod#original_name. [ruby-core:52048] [Bug #7806]
+ [EXPERIMENTAL]
- * test/bigdecimal/test_bigdecimal.rb: added tests for the above
- features.
+ * proc.c (method_inspect): show the given name primarily, and
+ original_id if aliased. [ruby-core:52048] [Bug #7806]
-Sat Aug 28 08:11:05 2010 Tanaka Akira <akr@fsij.org>
+Wed Feb 13 17:56:39 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * ext/pathname/pathname.c (path_blockdev_p): Pathname#blockdev?
- translated from pathname.rb.
+ * configure.in (warnflags): disable -Werror by default unless
+ development. [ruby-core:52131] [Bug #7830]
-Fri Aug 27 16:20:01 2010 URABE Shyouhei <shyouhei@ruby-lang.org>
+Wed Feb 13 06:05:52 2013 Eric Hodel <drbrain@segment7.net>
- * string.c (rb_str_prepend): new method by Shota Fukumori (sora_h)
- [Feature #3765]
+ * 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.
-Fri Aug 27 15:24:20 2010 NAKAMURA Usaku <usa@ruby-lang.org>
+Wed Feb 13 05:49:21 2013 Tanaka Akira <akr@fsij.org>
- * math.c (math_atan2): you should know that M_PI is not the feature
- of C90.
- fixed build failure caused by r29115.
+ * ext/socket/extconf.rb: test functions just after struct members.
-Fri Aug 27 15:26:33 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Tue Feb 12 12:02:35 2013 NARUSE, Yui <naruse@ruby-lang.org>
- * file.c (null_device): move from io.c.
+ * 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
-Fri Aug 27 12:47:44 2010 Kenta Murata <mrkn@mrkn.jp>
+Mon Feb 11 23:08:48 2013 Tanaka Akira <akr@fsij.org>
- * math.c (math_atan2): change the behavior when x and y are zero.
- [ruby-dev:42090] [Bug #3736] [ruby-dev:42116]
+ * configure.in: enable rb_cv_page_size_log test for MirOS BSD.
- * test/ruby/test_math.rb (test_atan2): add tests for the above
- changes.
+Mon Feb 11 20:06:38 2013 Tanaka Akira <akr@fsij.org>
-Fri Aug 27 12:26:23 2010 NAKAMURA Usaku <usa@ruby-lang.org>
+ * configure.in: use -pthread on mirbsd*.
- * object.c (rb_obj_class): remove mention of obsolete method.
- a patch from Run Paint Run Run at [ruby-core:31842].
+Mon Feb 11 16:07:09 2013 Tanaka Akira <akr@fsij.org>
-Fri Aug 27 12:25:03 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * configure.in: add SOLIBS and LIBRUBY_SO definition for mirbsd*.
- * io.c (null_device): the name of null device. [ruby-dev:41791]
+Mon Feb 11 13:17:20 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Fri Aug 27 07:57:34 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * configure.in (rubysitearchprefix): sitearchdir and vendorarchdir
+ should use sitearch, not arch. [ruby-dev:46964] [Bug #7823]
- * array.c (rb_ary_shuffle_bang): bail out from modification during
- shuffle.
+ * win32/Makefile.sub (config.status): site and vendor directories
+ should use sitearch, not arch. [ruby-dev:46964] [Bug #7823]
- * array.c (rb_ary_sample): ditto.
+Mon Feb 11 12:31:25 2013 Tanaka Akira <akr@fsij.org>
-Fri Aug 27 05:11:51 2010 Tanaka Akira <akr@fsij.org>
+ * configure.in: move OS specific header/function knowledge before
+ automatic header tests.
- * ext/pathname/pathname.c (path_sysopen): Pathname#sysopen translated
- from pathname.rb.
+Mon Feb 11 11:04:29 2013 Tanaka Akira <akr@fsij.org>
-Thu Aug 26 22:53:56 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * configure.in: move the test for -march=i486 just after
+ RUBY_UNIVERSAL_ARCH/RUBY_DEFAULT_ARCH.
- * array.c (rb_ary_shuffle): rdoc fix. argument name was missing.
- a patch from Run Paint Run Run at [ruby-core:31848].
+Sun Feb 10 23:42:26 2013 Tanaka Akira <akr@fsij.org>
-Thu Aug 26 21:49:46 2010 Tanaka Akira <akr@fsij.org>
+ * ext/socket/extconf.rb: test structure members just after types test.
- * ext/pathname/pathname.c (path_readlines): Pathname#readlines
- translated from pathname.rb.
+Sun Feb 10 20:58:17 2013 Tanaka Akira <akr@fsij.org>
-Thu Aug 26 10:37:00 2010 NARUSE, Yui <naruse@ruby-lang.org>
+ * ext/socket/extconf.rb: test types just after headers test.
- * regint.h (OnigStackIndex): the type should be intptr_t.
- Original Oniguruma assumes the size of long and that of void *
- are equal, but it's not true on LLP64 platform: mswin64.
- originally patched by shintaro kuwamoto [ruby-dev:42133]
+Sun Feb 10 16:00:00 2013 Zachary Scott <zachary@zacharyscott.net>
-Thu Aug 26 10:38:11 2010 Yutaka Kanemoto <kanemoto@ruby-lang.org>
+ * 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
- * test/dl/test_base.rb: AIX does not have dynamically loadable lib[cm].
+Sun Feb 10 15:26:00 2013 Zachary Scott <zachary@zacharyscott.net>
- * test/fiddle/helper.rb: AIX does not have dynamically loadable lib[cm].
+ * lib/rake/doc/*: Sync Rake rdoc files from upstream
-Thu Aug 26 09:49:50 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Sun Feb 10 15:50:02 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
- * array.c (rb_ary_shuffle_bang): check number of argument.
+ * vm_exec.h (DISPATCH_ARCH_DEPEND_WAY): use __asm__ __volatile__
+ instead of asm volatile.
-Tue Aug 26 09:11:40 2010 Kenta Murata <mrkn@mrkn.jp>
+Sun Feb 10 15:50:02 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
- * ext/bigdecimal/bigdecimal.c (Init_bigdecimal,
- rmpd_set_thread_local_exception_mode, VpGetException,
- VpSetException): thread-local exception mode.
+ * gc.h (SET_MACHINE_STACK_END): use __volatile__ instead of volatile.
- * ext/bigdecimal/bigdecimal.c (Init_bigdecimal,
- rmpd_set_thread_local_precision_limit, VpGetPrecLimit,
- VpSetPrecLimit): thread-local precision limit.
+Sun Feb 10 14:25:00 2013 Zachary Scott <zachary@zacharyscott.net>
- * ext/bigdecimal/bigdecimal.c (Init_bigdecimal,
- rmpd_set_thread_local_rounding_mode, VpGetRoundMode,
- VpSetRoundMode, VpException, VpInternalRound):
- thread-local rounding mode.
+ * doc/rake/, lib/rake/doc/: Move Rake rdoc files to lib/rake
- * ext/bigdecimal/bigdecimal.c (BigDecimal_mode, BigDecimal_round,
- VpIsRoundMode, VpGetRoundMode, VpSetRoundMode, VpActiveRound,
- VpMidRound, VpLeftRound), ext/bigdecimal/bigdecimal.h:
- use unsigned short for rounding mode.
+Sun Feb 10 12:10:25 2013 Tanaka Akira <akr@fsij.org>
- * test/bigdecimal/test_bigdecimal.rb (test_mode): add test for
- setting rounding mode.
+ * ext/socket/extconf.rb: test headers at first.
- * test/bigdecimal/test_bigdecimal.rb (test_thread_local_mode):
- add test for setting mode thread-locally.
+Sun Feb 10 12:00:00 2013 Zachary Scott <zachary@zacharyscott.net>
-Thu Aug 26 07:29:54 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * doc/rake/*: Removed stale Rake static files
- * array.c (rb_ary_{shuffle_bang,sample}): use Random class object.
+Sun Feb 10 09:10:00 2013 Zachary Scott <zachary@zacharyscott.net>
- * random.c (try_get_rnd): use default_rand for Random as same as
- singleton methods.
+ * lib/pp.rb, lib/prettyprint.rb: Documentation for PP and PrettyPrint
+ Based on a patch by Vincent Batts [ruby-core:51253] [Bug #7656]
- * random.c (rb_random_real): check the range of result.
+Sat Feb 9 21:11:21 2013 Tanaka Akira <akr@fsij.org>
-Wed Aug 25 22:11:11 2010 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.
- * ext/pathname/pathname.c (path_binread): Pathname#binread translated
- from pathname.rb.
+Sat Feb 9 17:45:58 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Wed Aug 25 03:42:43 2010 NAKAMURA Usaku <usa@ruby-lang.org>
+ * configure.in, version.c: prevent duplicated load paths by empty
+ version string, it does not work right now.
- * ext/dl/cfunc.c (rb_dlcfunc_call): workaround for VC9 for x64.
- reported by kuwamoto shintaro in [ruby-dev:42125].
+Sat Feb 9 17:38:41 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Tue Aug 24 23:28:50 2010 Yusuke Endoh <mame@tsg.ne.jp>
+ * configure.in: fix arch parameters in help message. [Bug #7804]
- * .gitignore: updated.
+Sat Feb 9 13:13:00 2013 Zachary Scott <zachary@zacharyscott.net>
-Tue Aug 24 22:07:28 2010 Tanaka Akira <akr@fsij.org>
+ * vm_trace.c: Note about TracePoint events set, and comment on
+ Kernel#set_trace_func to prefer new TracePoint API
- * ext/pathname/pathname.c (path_read): Pathname#read translated from
- pathname.rb.
+Sat Feb 9 10:07:47 2013 Kazuki Tsujimoto <kazuki@callcc.net>
-Tue Aug 24 10:11:04 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * BSDL: update copyright notice for 2013.
- * configure.in: read API version from include/ruby/version.h.
+Sat Feb 9 09:24:38 2013 Eric Hodel <drbrain@segment7.net>
- * {bcc,win}32/setup.mak (-version-): ditto.
+ * lib/rubygems/package/old.rb: Fix behavior only on ruby 1.8.
- * version.h (RUBY_LIB_VERSION): use API version numbers.
+ * lib/rubygems/package.rb: Include checksums.yaml.gz signatures for
+ verification.
+ * test/rubygems/test_gem_package.rb: Test for the above.
-Tue Aug 24 07:07:28 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Sat Feb 9 01:23:24 2013 Tanaka Akira <akr@fsij.org>
- * array.c (rb_ary_shuffle_bang, rb_ary_sample): add optional
- argument random. [ruby-dev:41923] [EXPERIMENTAL]
+ * test/fiddle/helper.rb: specify libc and libm locations for MirOS BSD.
- * random.c (rb_random_{int32,real,bytes}): fallback to normal
- method invocation.
+ * test/dl/test_base.rb: ditto.
-Tue Aug 24 06:08:10 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Fri Feb 8 23:25:33 2013 Tanaka Akira <akr@fsij.org>
- * include/ruby/version.h (RUBY_API_VERSION_*): renamed and moved
- from version.h. [ruby-dev:42103]
+ * configure.in: change CFLAGS temporally to test
+ ARCH_FLAG="-march=i486".
-Tue Aug 24 05:58:18 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Fri Feb 8 21:19:41 2013 Tanaka Akira <akr@fsij.org>
- * ChangeLog: flushed. [ruby-dev:42050]
+ * 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
diff --git a/GPL b/GPL
index 5b6e7c66c2..d159169d10 100644
--- a/GPL
+++ b/GPL
@@ -1,12 +1,12 @@
- GNU GENERAL PUBLIC LICENSE
- Version 2, June 1991
+ GNU GENERAL PUBLIC LICENSE
+ Version 2, June 1991
- Copyright (C) 1989, 1991 Free Software Foundation, Inc.
- 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
- Preamble
+ Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
@@ -15,7 +15,7 @@ software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
-the GNU Library General Public License instead.) You can apply it to
+the GNU Lesser General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
@@ -55,8 +55,8 @@ patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
-
- GNU GENERAL PUBLIC LICENSE
+
+ GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
@@ -110,7 +110,7 @@ above, provided that you also meet all of these conditions:
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
-
+
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
@@ -168,7 +168,7 @@ access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
-
+
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
@@ -225,7 +225,7 @@ impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
-
+
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
@@ -255,7 +255,7 @@ make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
- NO WARRANTY
+ NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
@@ -277,9 +277,9 @@ YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
- END OF TERMS AND CONDITIONS
-
- How to Apply These Terms to Your New Programs
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
@@ -303,10 +303,9 @@ the "copyright" line and a pointer to where the full notice is found.
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
+ You should have received a copy of the GNU General Public License along
+ with this program; if not, write to the Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
Also add information on how to contact you by electronic and paper mail.
@@ -336,5 +335,5 @@ necessary. Here is a sample; alter the names:
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
-library. If this is what you want to do, use the GNU Library General
+library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License.
diff --git a/Makefile.in b/Makefile.in
index 41ea4122e8..98749dec61 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -1,9 +1,13 @@
SHELL = /bin/sh
NULLCMD = @NULLCMD@
+n=$(NULLCMD)
+ECHO1 = $(V:1=@$n)
RUNCMD = $(SHELL)
+CDPATH = .
CHDIR = @CHDIR@
exec = exec
NULL = /dev/null
+PATH_SEPARATOR = @PATH_SEPARATOR@
#### Start of system configuration section. ####
@@ -14,6 +18,7 @@ PLATFORM_DIR = @PLATFORM_DIR@
CC = @CC@
CPP = @CPP@
+LD = @LD@
YACC = bison
PURIFY =
AUTOCONF = autoconf
@@ -21,6 +26,7 @@ AUTOCONF = autoconf
MKFILES = @MAKEFILES@
BASERUBY = @BASERUBY@
TEST_RUNNABLE = @TEST_RUNNABLE@
+CROSS_COMPILING = @CROSS_COMPILING@
DOXYGEN = @DOXYGEN@
prefix = @prefix@
@@ -34,6 +40,7 @@ datadir = @datadir@
arch = @arch@
sitearch = @sitearch@
sitedir = @sitedir@
+archlibdir = @archlibdir@
ruby_version = @ruby_version@
TESTUI = console
@@ -46,6 +53,7 @@ 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@
@@ -53,36 +61,49 @@ CFLAGS = @CFLAGS@ $(ARCH_FLAG)
cflags = @cflags@
optflags = @optflags@
debugflags = @debugflags@
-warnflags = @warnflags@
+warnflags = @warnflags@ @strict_warnflags@
INCFLAGS = -I. -I$(arch_hdrdir) -I$(hdrdir) -I$(srcdir)
XCFLAGS = @XCFLAGS@
CPPFLAGS = @CPPFLAGS@ $(INCFLAGS)
LDFLAGS = @STATIC@ $(CFLAGS) @LDFLAGS@
-EXTLDFLAGS =
+EXTLDFLAGS = @EXTLDFLAGS@
XLDFLAGS = @XLDFLAGS@ $(EXTLDFLAGS)
EXTLIBS =
LIBS = @LIBS@ $(EXTLIBS)
MISSING = @LIBOBJS@ @ALLOCA@
LDSHARED = @LIBRUBY_LDSHARED@
-DLDFLAGS = @LIBRUBY_DLDFLAGS@ $(EXTLDFLAGS) $(ARCH_FLAG)
+DLDFLAGS = @LIBRUBY_DLDFLAGS@ $(XLDFLAGS) $(ARCH_FLAG)
SOLIBS = @SOLIBS@
MAINLIBS = @MAINLIBS@
ARCHMINIOBJS = @MINIOBJS@
+DLNOBJ = @DLNOBJ@
+ENCOBJS = @ENCOBJS@
+EXTOBJS = @EXTOBJS@
BUILTIN_ENCOBJS = @BUILTIN_ENCOBJS@
BUILTIN_TRANSSRCS = @BUILTIN_TRANSSRCS@
BUILTIN_TRANSOBJS = @BUILTIN_TRANSOBJS@
+POSTLINK = @POSTLINK@
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)
RUBY = $(RUBY_INSTALL_NAME)
MINIRUBY = @MINIRUBY@\
$(MINIRUBYOPT)
-RUNRUBY = @RUNRUBY@ $(RUNRUBYOPT) -- $(RUN_OPTS)
+# RUNRUBY_COMMAND:: runruby.rb or baseruby. do not append options directly
+RUNRUBY_COMMAND = @RUNRUBY_COMMAND@
+# RUNRUBY:: run ruby with RUN_OPTS which is passed to ruby
+RUNRUBY = @RUNRUBY@ $(RUN_OPTS)
+# RUNRUBY_DEBUGGER:: debugging option for runruby.rb
+RUNRUBY_DEBUGGER = --debugger='gdb -x run.gdb --quiet --args'
XRUBY = @XRUBY@
+BTESTRUBY = @BTESTRUBY@\
+ $(MINIRUBYOPT)
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
@@ -91,7 +112,7 @@ XRUBY_LIBDIR = @XRUBY_LIBDIR@
XRUBY_RUBYLIBDIR = @XRUBY_RUBYLIBDIR@
XRUBY_RUBYHDRDIR = @XRUBY_RUBYHDRDIR@
-DEFAULT_PRELUDES = $(@USE_RUBYGEMS@_GEM_PRELUDE)
+DEFAULT_PRELUDES = $(GEM_PRELUDE)
#### End of system configuration section. ####
@@ -106,6 +127,8 @@ LIBRUBY = @LIBRUBY@
LIBRUBYARG = @LIBRUBYARG@
LIBRUBYARG_STATIC = @LIBRUBYARG_STATIC@
LIBRUBYARG_SHARED = @LIBRUBYARG_SHARED@
+LIBRUBY_RELATIVE = @LIBRUBY_RELATIVE@
+LIBRUBY_A_OBJS = @LIBRUBY_A_OBJS@
THREAD_MODEL = @THREAD_MODEL@
@@ -134,6 +157,10 @@ OBJDUMP = @OBJDUMP@
OBJCOPY = @OBJCOPY@
VCS = @VCS@
VCSUP = @VCSUP@
+DTRACE = @DTRACE@
+DTRACE_EXT = @DTRACE_EXT@
+DTRACE_OBJ = @DTRACE_OBJ@
+DTRACE_GLOMMED_OBJ = @DTRACE_GLOMMED_OBJ@
OBJEXT = @OBJEXT@
ASMEXT = S
@@ -145,14 +172,25 @@ INSTALLED_LIST= .installed.list
MKMAIN_CMD = mkmain.sh
+NEWLINE_C = newline.c
+MINIPRELUDE_C = miniprelude.c
+RBCONFIG = .rbconfig.time
+
SRC_FILE = $<
+OS_SRC_FILE = $<
+DEST_FILE = $@
+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
configure_args = @configure_args@
#### End of variables
+.SUFFIXES: .inc .h .c .y .i .$(DTRACE_EXT)
+
all:
.DEFAULT: all
@@ -163,12 +201,13 @@ all:
miniruby$(EXEEXT):
@-if test -f $@; then $(MV) -f $@ $@.old; $(RM) $@.old; fi
$(ECHO) linking $@
- $(Q) $(PURIFY) $(CC) $(LDFLAGS) $(XLDFLAGS) $(NORMALMAINOBJ) $(MINIOBJS) $(COMMONOBJS) $(DMYEXT) $(MAINLIBS) $(LIBS) $(OUTFLAG)$@
+ $(Q) $(PURIFY) $(CC) $(LDFLAGS) $(XLDFLAGS) $(NORMALMAINOBJ) $(MINIOBJS) $(COMMONOBJS) $(DMYEXT) $(DTRACE_OBJ) $(MAINLIBS) $(LIBS) $(OUTFLAG)$@
$(PROGRAM):
@$(RM) $@
$(ECHO) linking $@
- $(Q) $(PURIFY) $(CC) $(LDFLAGS) $(XLDFLAGS) $(MAINOBJ) $(EXTOBJS) $(LIBRUBYARG) $(MAINLIBS) $(LIBS) $(OUTFLAG)$@
+ $(Q) $(PURIFY) $(CC) $(LDFLAGS) $(XLDFLAGS) $(MAINOBJ) $(EXTOBJS) $(LIBRUBYARG) $(MAINLIBS) $(LIBS) $(EXTLIBS) $(OUTFLAG)$@
+ $(Q) $(POSTLINK)
# We must `rm' the library each time this rule is invoked because "updating" a
# MAB library on Apple/NeXT (see --enable-fat-binary in configure) is not
@@ -176,19 +215,21 @@ $(PROGRAM):
$(LIBRUBY_A):
@$(RM) $@
$(ECHO) linking static-library $@
- $(Q) $(AR) $(ARFLAGS) $@ $(OBJS) $(DMYEXT)
+ $(Q) $(AR) $(ARFLAGS) $@ $(LIBRUBY_A_OBJS) $(DMYEXT)
@-$(RANLIB) $@ 2> /dev/null || true
+ $(ECHO) verifying static-library $@
+ @$(PURIFY) $(CC) $(LDFLAGS) $(XLDFLAGS) $(MAINOBJ) $(LIBRUBY_A) $(MAINLIBS) $(EXTLIBS) $(LIBS) $(OUTFLAG)conftest$(EXEEXT)
+ @$(RM) conftest$(EXEEXT) conftest.c
$(LIBRUBY_SO):
@-$(PRE_LIBRUBY_UPDATE)
$(ECHO) linking shared-library $@
- $(Q) $(LDSHARED) $(DLDFLAGS) $(OBJS) $(DLDOBJS) $(SOLIBS) $(OUTFLAG)$@
+ $(Q) $(LDSHARED) $(DLDFLAGS) $(OBJS) $(DLDOBJS) $(DTRACE_OBJ) $(SOLIBS) $(EXTSOLIBS) $(OUTFLAG)$@
-$(Q) $(OBJCOPY) -w -L '$(SYMBOL_PREFIX)Init_*' -L '$(SYMBOL_PREFIX)*_threadptr_*' $@
- @-$(MINIRUBY) -e 'ARGV.each{|link| File.delete link if File.exist? link; \
+ $(Q) $(POSTLINK)
+ @-$(MINIRUBY) -e 'ARGV.each{|link| File.delete link rescue nil; \
File.symlink "$(LIBRUBY_SO)", link}' \
$(LIBRUBY_ALIASES) || true
-
-fake: $(arch)-fake.rb
$(arch)-fake.rb: config.status $(srcdir)/template/fake.rb.in
@./config.status --file=$@:$(srcdir)/template/fake.rb.in
@chmod +x $@
@@ -217,14 +258,16 @@ install-cross: $(arch)-fake.rb $(RBCONFIG) rbconfig.rb $(arch_hdrdir)/ruby/confi
Makefile: $(srcdir)/Makefile.in $(srcdir)/enc/Makefile.in
$(MKFILES): config.status
- MAKE=$(MAKE) $(SHELL) ./config.status
- @{ \
+ @[ -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' $< > $@
@@ -235,7 +278,8 @@ config.status-args = ./config.status --recheck
reconfig-exec-0 = exec 3>&1; exit `exec 4>&1; { "$$@" 3>&- 4>&-; echo $$? 1>&4; } | fgrep -v '(cached)' 1>&3`
reconfig-exec-1 = set -x; "$$@"
-reconfig config.status: $(srcdir)/configure $(srcdir)/enc/Makefile.in
+reconfig config.status: $(srcdir)/configure $(srcdir)/enc/Makefile.in \
+ $(srcdir)/include/ruby/version.h
@PWD= MINIRUBY="$(MINIRUBY)"; export MINIRUBY; \
set $(SHELL) $($@-args); $(reconfig-exec-$(V))
@@ -243,6 +287,7 @@ $(srcdir)/configure: $(srcdir)/configure.in
$(CHDIR) $(srcdir) && exec $(AUTOCONF)
incs: id.h
+all-incs: probes.h
# Things which should be considered:
# * with gperf v.s. without gperf
@@ -276,7 +321,7 @@ enc/unicode/name2ctype.h: enc/unicode/name2ctype.kwd
trap '$(RM) $@-1.h $@-2.h' 0 && \
set -x; \
sed '/^#ifdef USE_UNICODE_PROPERTIES/,/^#endif/d' $? | gperf $(NAME2CTYPE_OPTIONS) > $@-1.h && \
- gperf $(NAME2CTYPE_OPTIONS) < $? > $@-2.h && \
+ sed '/^#ifdef USE_UNICODE_PROPERTIES/d;/^#endif/d' $? | gperf $(NAME2CTYPE_OPTIONS) > $@-2.h && \
diff -DUSE_UNICODE_PROPERTIES $@-1.h $@-2.h > $@.tmp || :; \
$(MV) $@.tmp $@ && \
$(CP) $? $(?:.kwd=.src) && \
@@ -297,16 +342,47 @@ enc/unicode/name2ctype.h: enc/unicode/name2ctype.kwd
.c.i:
@$(ECHO) preprocessing $<
- $(Q) $(CPP) $(XCFLAGS) $(CPPFLAGS) $(COUTFLAG)$@ -E $< > $@
+ $(Q) $(CPP) $(warnflags) $(XCFLAGS) $(CPPFLAGS) $(COUTFLAG)$@ -E $< > $@
+
+.d.h:
+ @$(ECHO) translating probes $<
+ $(Q) $(DTRACE) -o $@.tmp -h -C $(INCFLAGS) -s $<
+ $(Q) sed -e 's/RUBY_/RUBY_DTRACE_/g' -e 's/PROBES_H_TMP/PROBES_H/g' -e 's/(char \*/(const char */g' -e 's/, char \*/, const char */g' $@.tmp > $@
+ $(Q) $(RM) $@.tmp
+
+.dmyh.h:
+ @$(ECHO) copying dummy $(DEST_FILE)
+ $(Q) $(CP) $(OS_SRC_FILE) $(OS_DEST_FILE)
+
+probes.@OBJEXT@: $(srcdir)/probes.d
+ @$(ECHO) processing probes in object files
+ $(Q) stamp="$*.stamp"; \
+ if test -f "$$stamp" -o -f "$@"; then \
+ $(RM) $(DTRACE_DEPENDENT_OBJS) "$$stamp"; \
+ for o in $(DTRACE_DEPENDENT_OBJS); do \
+ echo "rebuilding $$o which was modified by \"dtrace -G\""; \
+ $(MAKE) "$$o"; \
+ done; \
+ fi; \
+ touch "$$stamp"
+ $(RM) $@
+ $(Q) $(DTRACE) -G -C $(INCFLAGS) -s $(srcdir)/probes.d -o $@ $(DTRACE_DEPENDENT_OBJS)
+
+# DTrace static library hacks described here:
+# http://mail.opensolaris.org/pipermail/dtrace-discuss/2005-August/000207.html
+ruby-glommed.$(OBJEXT):
+ @$(ECHO) generating a glommed object with DTrace probes for static library
+ $(Q) $(LD) -r -o $@ $(OBJS) $(DTRACE_OBJ)
clean-local::
- $(Q)$(RM) ext/extinit.c ext/extinit.$(OBJEXT) ext/ripper/y.output
+ $(Q)$(RM) ext/extinit.c ext/extinit.$(OBJEXT) ext/ripper/y.output \
+ enc/encinit.c enc/encinit.$(OBJEXT)
-$(Q)$(RM) $(pkgconfig_DATA)
distclean-local::
$(Q)$(RM) ext/config.cache $(RBCONFIG) Doxyfile
-$(Q)$(RM) run.gdb
- -$(Q)$(RM) $(INSTALLED_LIST) $(arch_hdrdir)/ruby/config.h
+ -$(Q)$(RM) $(INSTALLED_LIST) $(arch_hdrdir)/ruby/config.h verconf.h
-$(Q)$(RMDIRS) $(arch_hdrdir)/ruby 2> /dev/null || true
clean-ext distclean-ext realclean-ext::
@@ -324,8 +400,10 @@ clean-ext distclean-ext realclean-ext::
$(RMDIRS) "ext/$$dir" 2> /dev/null || true;; \
esac; \
done
+ -$(Q)$(RM) ext/extinit.$(OBJEXT)
distclean-ext realclean-ext::
+ -$(Q)$(RM) ext/extinit.c
-$(Q)$(RMDIR) ext 2> /dev/null || true
clean-extout:
@@ -351,9 +429,16 @@ ext/extinit.$(OBJEXT): ext/extinit.c $(SETUP)
$(ECHO) compiling $@
$(Q) $(CC) $(CFLAGS) $(XCFLAGS) $(CPPFLAGS) $(COUTFLAG)$@ -c ext/extinit.c
+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 \
@@ -386,4 +471,9 @@ $(INSNS): $(srcdir)/insns.def vm_opts.h \
$(srcdir)/defs/opt_operand.def $(srcdir)/defs/opt_insn_unif.def \
$(srcdir)/tool/instruction.rb $(srcdir)/tool/insns2vm.rb
$(ECHO) generating $@
- $(Q) $(BASERUBY) -Ks $(srcdir)/tool/insns2vm.rb $(INSNS2VMOPT) $@
+ $(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 30fec33fdd..ae44d7effb 100644
--- a/NEWS
+++ b/NEWS
@@ -1,5 +1,6 @@
-# -*- rd -*-
-= NEWS
+# -*- rdoc -*-
+
+= NEWS for Ruby 2.1.0
This document is a list of user visible feature changes made between
releases except for bug fixes.
@@ -8,334 +9,304 @@ 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.2 release
-=== License
+== Changes since the 2.0.0 release
-* Ruby's License is changed from a dual license with GPLv2
- to a dual license with 2-clause BSDL.
+=== Language changes
-=== Known platform dependent issues
-==== OS X Lion
+* 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
+ * added environment variable:
+ * RUBY_HEAP_SLOTS_GROWTH_FACTOR: growth rate of the heap.
+
+* Integer
+ * New methods
+ * Fixnum#bit_length
+ * Bignum#bit_length
+ * Bignum performance improvement
+ * Use GMP if available.
+ GMP is used only for several operations:
+ multiplication, division, radix conversion, GCD
+
+* IO
+ * 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.
-* You have to configure ruby with '--with-gcc=gcc-4.2' if you're using
- Xcode 4.1, or, if you're using Xcode 4.2, you have to configure ruby
- with '--with-gcc=clang'.
+* Mutex
+ * misc
+ * Mutex#owned? is no longer experimental.
-=== C API updates
+* 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.
+
+* Process
+ * New methods:
+ * alternative methods to $0/$0=:
+ * Process.argv0() returns the original value of $0.
+ * Process.setproctitle() sets the process title without affecting $0.
+ * Process.clock_gettime
+ * Process.clock_getres
+
+* RbConfig
+ * New constants:
+ * RbConfig::SIZEOF is added to provide the size of C types.
+
+* String
+ * New methods:
+ * String#scrub and String#scrub! verify and fix invalid byte sequence.
+ * extended methods:
+ * If invalid: :replace is specified for String#encode, replace
+ invalid byte sequence even if the destination encoding equals to
+ the source encoding.
-* rb_scan_args() is enhanced with support for option hash argument
- extraction.
-
-* ruby_vm_at_exit() added. This enables extension libs to hook a VM
- termination.
-
-* rb_reserved_fd_p() added. If you want to close all file descriptors,
- check using this API. [ruby-core:37759]
-
-=== Library updates (outstanding ones only)
-
-* builtin classes
-
- * ARGF
- * new methods:
- * ARGF.print
- * ARGF.printf
- * ARGF.putc
- * ARGF.puts
- * ARGF.read_nonblock
- * ARGF.to_write_io
- * ARGF.write
+* Symbol
+ * All symbols are now frozen.
- * Array
- * extended method:
- * Array#pack supports endian modifiers
+* pack/unpack (Array/String)
+ * Q! and q! directives for long long type if platform has the type.
- * Bignum
- * Multiplication algorithm for Bignums with a large number of digits over
- 150 BDIGITs is changed in order to reduce its calculation time.
- Now such large Bignums are multiplied by using Toom-3 algorithm.
+* 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.
- * Encoding
- * new encodings:
- * CP950
- * CP951
- * UTF-16
- * UTF-32
- * change alias:
- * SJIS is Windows-31J
+=== Core classes compatibility issues (excluding feature bug fixes)
- * File
- * new constant:
- * File::NULL
- name of NULL device.
- * File::DIRECT
- name of O_DIRECT.
+* IO
+ * incompatible changes:
+ * open ignore internal encoding if external encoding is ASCII-8BIT.
- * IO
- * extended method:
- * IO#putc supports multibyte characters
- * new methods:
- * IO#advise
- * IO.write(name, string, [offset] )
- Write `string` to file `name`.
- Opposite with File.read.
- * IO.binwrite(name, string, [offset] )
- binary version of IO.write.
+* 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
- * move #__id__ to BasicObject.
- * extended method:
- * Kernel#rand supports range argument
+* 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
- * new methods:
- * Module#private_constant
- * Module#public_constant
+* Module#ancestors
+ * The ancestors of a singleton class now include singleton classes,
+ in particular itself.
- * Random
- * extended method:
- * Random.rand supports range argument
+* Module#define_method and Object#define_singleton_method
+ * Now they return the symbols of the defined methods, not the methods/procs
+ themselves.
- * String
- * extended method:
- * String#unpack supports endian modifiers
- * new method:
- * String#prepend
- * String#byteslice
+* Numeric#quo
+ * Raises TypeError instead of ArgumentError if the receiver doesn't have
+ to_r method.
- * Time
- * extended method:
- * Time#strftime supports %:z and %::z.
-
- * Process
- * Process#maxgroups and Process#maxgroups= now raise NotImplementedError if
- the platform don't support supplementary groups concept.
-
-* bigdecimal
-
- * BigDecimal#power and BigDecimal#** support non-integral exponent.
-
- * Kernel.BigDecimal and BigDecimal.new now accept instances of Integer,
- Rational, Float, and BigDecimal. If you pass a Rational or a Float to
- them, you must specify the precision to produce the digits of a BigDecimal.
-
- * The behavior of BigDecimal#coerce with a Rational is changed. It uses
- the precision of the receiver BigDecimal to produce the digits of a
- BigDecimal from the given Rational.
-
-* bigdecimal/util
-
- * BigDecimal#to_d and Integer#to_d are added.
-
- * Float#to_d accepts a precision.
-
- * Rational#to_d raises ArgumentError when passing zero or negative
- precision.
-
- * Rational#to_d
-
- * Zero and an implicit precision is deprecated.
- This feature is removed at the next release of bigdecimal.
-
- * A negative precision isn't supported.
- Be careful it is an incompatible change.
-
-* date
-
- * Accepts flonum explicitly with limitations.
- * If the given offset is flonum, DateTime assumes its precision is
- at most second.
-
- DateTime.new(2001,2,3,0,0,0,3.0/24) ==
- DateTime.new(2001,2,3,0,0,0,'+03:00')
- #=> true
-
- * If the given operand for -/+ is flonum, DateTime assumes its
- precision is at most nanosecond.
-
- DateTime.new(2001,2,3) + 0.5 == DateTime.new(2001,2,3,12)
- #=> true
-
- * Precision of offset is always at most second.
-
- Rational('0.5') == Rational('0.500001') #=> false
- DateTime.new(2001,2,3,0,0,0,Rational('0.5')) ==
- DateTime.new(2001,2,3,0,0,0,Rational('0.500001'))
- #=> true
-
- * Ignores long offset and far reform day (with warning).
-
- * Now accepts only:
-
- -1<=offset<=1 (-24:00..+24:00)
- 2298874<=start<=2426355 or -/+oo
- (proleptic Gregorian/Julian mean -/+oo)
-
- * A method strftime cannot produce huge output (same as Time's one).
-
- * Even though Date/DateTime can handle far dates, the following causes
- an exception.
-
- DateTime.new(1<<10000).strftime('%Y') # Errno::ERANGE
-
- * Changed the format of inspect.
- * Changed the format of marshal (but, can load old dumps).
+* 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.
-* io/console
- * new methods:
- * IO#noecho {|io| }
- * IO#echo=
- * IO#echo?
- * IO#raw {|io| }
- * IO#raw!
- * IO#getch
- * IO#winsize
- * IO.console
+=== Stdlib updates (outstanding ones only)
-* json
- * updated to v1.5.4.
+* CGI::Util
+ * All class methods modulized.
-* matrix
- * new classes:
- * Matrix::EigenvalueDecomposition
- * Matrix::LUPDecomposition
- * new methods:
- * Matrix#diagonal?
- * Matrix#eigen
- * Matrix#eigensystem
- * Matrix#hermitian?
- * Matrix#lower_triangular?
- * Matrix#lup
- * Matrix#lup_decomposition
- * Matrix#normal?
- * Matrix#orthogonal?
- * Matrix#permutation?
- * Matrix#round
- * Matrix#symmetric?
- * Matrix#unitary?
- * Matrix#upper_triangular?
- * Matrix#zero?
- * Vector#magnitude, #norm
- * Vector#normalize
+* Digest
* extended methods:
- * Matrix#each and #each_with_index can iterate on a subset of the elements
- * Matrix#find_index returns [row, column] and can iterate on a subset
- of the elements
- * Matrix#** implements Numeric exponents (using the eigensystem)
- * Matrix.zero can build rectangular matrices
-
-* minitest
- * Minitest has been updated to version 2.2.2.
- * For full details, see https://github.com/seattlerb/minitest/blob/master/History.txt
-
-* net/http
- * SNI (Server Name Indication) supported for HTTPS.
-
- * Allow to configure to wait server returning '100 continue' response
- before sending HTTP request body. Set Net::HTTP#continue_timeout AND pass
- 'expect' => '100-continue' to a extra HTTP header.
-
- For example, the following code sends HTTP header and waits for getting
- '100 continue' response before sending HTTP request body. When 0.5 [sec]
- timeout occurs or the server send '100 continue', the client sends HTTP
- request body.
- http.continue_timeout = 0.5
- http.request_post('/continue', 'body=BODY', 'expect' => '100-continue')
+ * Digest::Class.file takes optional arguments for its constructor
- * new method:
- * Net::HTTPRequest#set_form): Added to support
- both application/x-www-form-urlencoded and multipart/form-data.
+* Matrix
+ * Added Vector#cross_product.
+
+* Net::SMTP
+ * Added Net::SMTP#rset to implement the RSET command
* objspace
* new method:
- * ObjectSpace::memsize_of_all
-
-* openssl
- * PKey::RSA and PKey::DSA now use the generic X.509 encoding scheme
- (e.g. used in a X.509 certificate's Subject Public Key Info) when
- exporting public keys to DER or PEM. Backward compatibility is
- ensured by (already existing) fallbacks during creation.
- * OpenSSL::ASN1::Constructive#new and OpenSSL::ASN1::Primitive#new
- (and the constructors of their sub-classes) will no longer force
- tagging to be set to :EXPLICIT when tag and/or tag_class are passed
- as parameters. tagging must be set explicitly.
- * Support for infinite length encodings via infinite_length attribute.
- * OpenSSL::PKey.read( file | string [, pwd] ) allows to read arbitrary
- public/private keys in DER-/PEM-encoded form with an optional password
- for encrypted PEM encodings.
- * Add new method OpenSSL::X509::Name#hash_old as a wrapper of
- X509_NAME_hash_old() defined from OpenSSL 1.0.0. It returns OpenSSL 0.9.8
- compatible hash value.
-
-* optparse
- * support for bash/zsh completion.
-
-* Rake
- * Rake has been upgraded from 0.8.7 to 0.9.2.2. For full release notes see
- https://github.com/jimweirich/rake/blob/master/CHANGES
+ * 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
+
+* OpenSSL::BN
+ * extended methods:
+ * OpenSSL::BN.new allows Fixnum/Bignum argument.
-* RDoc
- * RDoc has been upgraded to version 3.9.4. For full release notes see
- http://docs.seattlerb.org/rdoc/History_txt.html
+* open-uri
+ * Support multiple fields with same field name (like Set-Cookie).
-* rexml
- * Support Ruby native encoding mechanism and iconv dependency is dropped.
+* Pathname
+ * New methods:
+ * Pathname#write
+ * Pathname#binwrite
-* RubyGems
- * RubyGems has been upgraded to version 1.8.10. For full release notes see
- http://rubygems.rubyforge.org/rubygems-update/History_txt.html
-
-* stringio
- * extended method:
- * StringIO#set_encoding can get 2nd argument and optional hash.
-
-* test/unit
- * New arguments:
- * -j N, --jobs=N: Allow run N testcases at once.
- * --jobs-status: Show status of jobs when parallel running.
- * --no-retry: Don't retry testcases which failed when parallel running.
- * --ruby=RUBY: path to ruby for job(worker) process. optional.
- * --hide-skip: Hide skip messages. You'll see the number of skips at end of
- test result.
-
-* uri
- * new methods:
- * URI::Generic#hostname
- * URI::Generic#hostname=
-
-* webrick
- * new method:
- * WEBrick::HTTPRequest#continue for generating '100 continue' response.
- * new logging directive:
- * %{remote}p for remote (client) port number.
+* 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.
-* yaml
- * The default YAML engine is now Psych. You may downgrade to syck by setting
- YAML::ENGINE.yamler = 'syck'.
+ For a complete list of changes since rake 0.9.6 see:
-* zlib
- * new methods:
- * Zlib.deflate
- * Zlib.inflate
+ http://rake.rubyforge.org/doc/release_notes/rake-10_1_0_rdoc.html
-* FileUtils
- * extended method:
- * FileUtils#chmod supports symbolic mode argument.
+ http://rake.rubyforge.org/doc/release_notes/rake-10_0_3_rdoc.html
-=== Language changes
+* RDoc
+ * Updated to 4.1.0.preview.2. 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
-* Regexps now support Unicode 6.0. (new characters and scripts)
+* REXML::Parsers::SAX2Parser
+ * Fixes wrong number of arguments of entitydecl event. Document of the event
+ says "an array of the entity declaration" but implementation passes two
+ or more arguments. It is an implementation bug but it breaks backword
+ compatibility.
-* [experimental] Regexps now support Age property.
- Unlike Perl, current implementation takes interpretation of the
- interpretation of UTS #18.
- http://www.unicode.org/reports/tr18/
+* REXML::Parsers::StreamParser
+ * Supports "entity" event.
-* Turning on/off indentation warnings with directives.
- ("# -*- warn-indent: true -*-" / "# -*- warn-indent: false -*-")
+* REXML::Text
+ * REXML::Text#<< supports method chain like 'text << "XXX" << "YYY"'.
+ * REXML::Text#<< supports not "raw" mode.
-=== Compatibility issues (excluding feature bug fixes)
+* Rinda::RingServer, Rinda::RingFinger
+ * Rinda now supports multicast sockets. See Rinda::RingServer and
+ Rinda::RingFinger for details.
- * Rational#to_d
+* RubyGems
+ * Updated to 2.2.0.preview.2 For a list of enhancements and bug fixes see:
+ https://github.com/rubygems/rubygems/blob/v2.2.0.preview.1/History.txt
+
+* Set
+ * New methods:
+ * Set#intersect?
+ * Set#disjoint?
+
+* Socket
+ * New methods:
+ * Socket.getifaddrs
- See above.
+* 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.
+
+=== 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
diff --git a/README b/README
index 3d2e636e4d..3ffe3553a8 100644
--- a/README
+++ b/README
@@ -1,4 +1,4 @@
-* What's Ruby
+= What's Ruby
Ruby is the interpreted scripting language for quick and
easy object-oriented programming. It has many features to
@@ -6,113 +6,130 @@ process text files and to do system management tasks (as in
Perl). It is simple, straight-forward, and extensible.
-* Features of Ruby
+== 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
+* 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://redmine.ruby-lang.org/wiki/ruby-19/SupportedPlatforms
+ cf. http://bugs.ruby-lang.org/projects/ruby-trunk/wiki/SupportedPlatforms
-* How to get Ruby
+== 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/
+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
+== Ruby home-page
The URL of the Ruby home-page is:
- http://www.ruby-lang.org/
+http://www.ruby-lang.org/
-* Mailing list
+== Mailing list
There is a mailing list to talk about Ruby.
To subscribe this list, please send the following phrase
- subscribe YourFirstName YourFamilyName
+ subscribe YourFirstName YourFamilyName
e.g.
subscribe Joseph Smith
-in the mail body (not subject) to the address <ruby-talk-ctl@ruby-lang.org>.
+in the mail body (not subject) to the address <mailto:ruby-talk-ctl@ruby-lang.org>.
-* How to compile and install
+== How to compile and install
This is what you need to do to compile and install Ruby:
- 1. If ./configure does not exist or is older than configure.in,
+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.
+2. 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.
+ 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.
+3. Edit +defines.h+ if you need. Usually this step will not be needed.
- 4. Remove comment mark(#) before the module names from ext/Setup (or
- add module names if not present), if you want to link modules
+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 "#option nodynamic" in
- ext/Setup.
+ remove comment mark from the line "<tt>#option nodynamic</tt>" in
+ +ext/Setup+.
+
+ Usually this step will not be needed.
- 5. Run make.
+5. Run +make+.
- 6. Optionally, run 'make test' to check whether the compiled Ruby
- interpreter works well. If you see the message "test succeeded",
+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 'make install'
+7. Run '<tt>make install</tt>'
This command will create following directories and install files
onto them.
- * ${DESTDIR}${prefix}/bin
- * ${DESTDIR}${prefix}/include/ruby-${MAJOR}.${MINOR}.${TEENY}
- * ${DESTDIR}${prefix}/include/ruby-${MAJOR}.${MINOR}.${TEENY}/${PLATFORM}
- * ${DESTDIR}${prefix}/lib
- * ${DESTDIR}${prefix}/lib/ruby
- * ${DESTDIR}${prefix}/lib/ruby/${MAJOR}.${MINOR}.${TEENY}
- * ${DESTDIR}${prefix}/lib/ruby/${MAJOR}.${MINOR}.${TEENY}/${PLATFORM}
- * ${DESTDIR}${prefix}/lib/ruby/site_ruby
- * ${DESTDIR}${prefix}/lib/ruby/site_ruby/${MAJOR}.${MINOR}.${TEENY}
- * ${DESTDIR}${prefix}/lib/ruby/site_ruby/${MAJOR}.${MINOR}.${TEENY}/${PLATFORM}
- * ${DESTDIR}${prefix}/lib/ruby/vendor_ruby
- * ${DESTDIR}${prefix}/lib/ruby/vendor_ruby/${MAJOR}.${MINOR}.${TEENY}
- * ${DESTDIR}${prefix}/lib/ruby/vendor_ruby/${MAJOR}.${MINOR}.${TEENY}/${PLATFORM}
- * ${DESTDIR}${prefix}/lib/ruby/gems/${MAJOR}.${MINOR}.${TEENY}
- * ${DESTDIR}${prefix}/share/man/man1
- * ${DESTDIR}${prefix}/share/ri/${MAJOR}.${MINOR}.${TEENY}/system
-
- If Ruby's API version is `x.y.z', the ((|${MAJOR}|)) is `x', the
- ((|${MINOR}|)) is `y', and the ((|${TEENY}|)) is `z'.
-
- NOTE: teeny of the API version may be different from one of
+ * <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.
@@ -120,21 +137,30 @@ This is what you need to do to compile and 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+.
-* Copying
+== Feedback
-See the file COPYING.
+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
+== The Author
-Feel free to send comments and bug reports to the author. Here is the
-author's latest mail address:
+Ruby was originally designed and developed by Yukihiro Matsumoto (Matz) in 1995.
- matz@netlab.jp
+<mailto:matz@ruby-lang.org>
--------------------------------------------------------
-created at: Thu Aug 3 11:57:36 JST 1995
+--
Local variables:
-mode: indented-text
+mode: rdoc
end:
diff --git a/README.EXT b/README.EXT
index de63f54699..b7a1728110 100644
--- a/README.EXT
+++ b/README.EXT
@@ -1,8 +1,8 @@
-.\" README.EXT - -*- Text -*- created at: Mon Aug 7 16:45:54 JST 1995
+# README.EXT - -*- RDoc -*- created at: Mon Aug 7 16:45:54 JST 1995
This document explains how to make extension libraries for Ruby.
-1. Basic knowledge
+= Basic Knowledge
In C, variables have types and data do not have types. In contrast,
Ruby variables do not have a static type, and data themselves have
@@ -13,47 +13,46 @@ has its data-type.
To retrieve C data from a VALUE, you need to:
- (1) Identify the VALUE's data type
- (2) Convert the VALUE into C data
+1. Identify the VALUE's data type
+2. Convert the VALUE into C data
Converting to the wrong data type may cause serious problems.
-
-1.1 Data-types
+== Data-Types
The Ruby interpreter has the following data types:
- T_NIL nil
- T_OBJECT ordinary object
- T_CLASS class
- T_MODULE module
- T_FLOAT floating point number
- T_STRING string
- T_REGEXP regular expression
- T_ARRAY array
- T_HASH associative array
- T_STRUCT (Ruby) structure
- T_BIGNUM multi precision integer
- T_FIXNUM Fixnum(31bit or 63bit integer)
- T_COMPLEX complex number
- T_RATIONAL rational number
- T_FILE IO
- T_TRUE true
- T_FALSE false
- T_DATA data
- T_SYMBOL symbol
+T_NIL :: nil
+T_OBJECT :: ordinary object
+T_CLASS :: class
+T_MODULE :: module
+T_FLOAT :: floating point number
+T_STRING :: string
+T_REGEXP :: regular expression
+T_ARRAY :: array
+T_HASH :: associative array
+T_STRUCT :: (Ruby) structure
+T_BIGNUM :: multi precision integer
+T_FIXNUM :: Fixnum(31bit or 63bit integer)
+T_COMPLEX :: complex number
+T_RATIONAL :: rational number
+T_FILE :: IO
+T_TRUE :: true
+T_FALSE :: false
+T_DATA :: data
+T_SYMBOL :: symbol
In addition, there are several other types used internally:
- T_ICLASS
- T_MATCH
- T_UNDEF
- T_NODE
- T_ZOMBIE
+T_ICLASS :: included module
+T_MATCH :: MatchData object
+T_UNDEF :: undefined
+T_NODE :: syntax tree node
+T_ZOMBIE :: object awaiting finalization
Most of the types are represented by C structures.
-1.2 Check Data Type of the VALUE
+== Check Data Type of the VALUE
The macro TYPE() defined in ruby.h shows the data type of the VALUE.
TYPE() returns the constant number T_XXXX described above. To handle
@@ -87,7 +86,7 @@ There are also faster check macros for fixnums and nil.
FIXNUM_P(obj)
NIL_P(obj)
-1.3 Convert VALUE into C data
+== Convert VALUE into C Data
The data for type T_NIL, T_FALSE, T_TRUE are nil, false, true
respectively. They are singletons for the data type.
@@ -126,30 +125,33 @@ 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
interesting bugs.
-1.4 Convert C data into VALUE
+== Convert C Data into VALUE
To convert C data to Ruby values:
- * FIXNUM
+FIXNUM ::
- left shift 1 bit, and turn on LSB.
+ left shift 1 bit, and turn on LSB.
- * Other pointer values
+Other pointer values::
- cast to VALUE.
+ cast to VALUE.
-You can determine whether a VALUE is pointer or not by checking its LSB.
+You can determine whether a VALUE is pointer or not by checking its LSB.
Notice Ruby does not allow arbitrary pointer values to be a VALUE. They
should be pointers to the structures which Ruby knows about. The known
@@ -157,146 +159,161 @@ structures are defined in <ruby.h>.
To convert C numbers to Ruby values, use these macros.
- INT2FIX() for integers within 31bits.
- INT2NUM() for arbitrary sized integer.
+INT2FIX() :: for integers within 31bits.
+INT2NUM() :: for arbitrary sized integer.
INT2NUM() converts an integer into a Bignum if it is out of the FIXNUM
range, but is a bit slower.
-1.5 Manipulating Ruby data
+== Manipulating Ruby Data
As I already mentioned, it is not recommended to modify an object's
internal structure. To manipulate objects, use the functions supplied
by the Ruby interpreter. Some (not all) of the useful functions are
listed below:
- String functions
+=== String Functions
+
+rb_str_new(const char *ptr, long len) ::
+
+ Creates a new Ruby string.
+
+rb_str_new2(const char *ptr) ::
+rb_str_new_cstr(const char *ptr) ::
- rb_str_new(const char *ptr, long len)
+ Creates a new Ruby string from a C string. This is equivalent to
+ rb_str_new(ptr, strlen(ptr)).
- Creates a new Ruby string.
+rb_tainted_str_new(const char *ptr, long len) ::
- rb_str_new2(const char *ptr)
- rb_str_new_cstr(const char *ptr)
+ Creates a new tainted Ruby string. Strings from external data
+ sources should be tainted.
- Creates a new Ruby string from a C string. This is equivalent to
- rb_str_new(ptr, strlen(ptr)).
+rb_tainted_str_new2(const char *ptr) ::
+rb_tainted_str_new_cstr(const char *ptr) ::
- rb_tainted_str_new(const char *ptr, long len)
+ Creates a new tainted Ruby string from a C string.
- Creates a new tainted Ruby string. Strings from external data
- sources should be tainted.
+rb_sprintf(const char *format, ...) ::
+rb_vsprintf(const char *format, va_list ap) ::
- rb_tainted_str_new2(const char *ptr)
- rb_tainted_str_new_cstr(const char *ptr)
+ Creates a new Ruby string with printf(3) format.
- Creates a new tainted Ruby string from a C string.
+ Note: In the format string, %i is used for Object#to_s (or Object#inspect if
+ '+' flag is set) output (and related argument must be a VALUE). For integers
+ in format strings, use %d.
- rb_sprintf(const char *format, ...)
- rb_vsprintf(const char *format, va_list ap)
+rb_str_cat(VALUE str, const char *ptr, long len) ::
- Creates a new Ruby string with printf(3) format.
+ Appends len bytes of data from ptr to the Ruby string.
- rb_str_cat(VALUE str, const char *ptr, long len)
+rb_str_cat2(VALUE str, const char* ptr) ::
- Appends len bytes of data from ptr to the Ruby string.
+ Appends C string ptr to Ruby string str. This function is
+ equivalent to rb_str_cat(str, ptr, strlen(ptr)).
- rb_str_cat2(VALUE str, const char* ptr)
+rb_str_catf(VALUE str, const char* format, ...) ::
+rb_str_vcatf(VALUE str, const char* format, va_list ap) ::
- Appends C string ptr to Ruby string str. This function is
- equivalent to rb_str_cat(str, ptr, strlen(ptr)).
+ Appends C string format and successive arguments to Ruby string
+ str according to a printf-like format. These functions are
+ equivalent to rb_str_cat2(str, rb_sprintf(format, ...)) and
+ rb_str_cat2(str, rb_vsprintf(format, ap)), respectively.
- rb_str_catf(VALUE str, const char* format, ...)
- rb_str_vcatf(VALUE str, const char* format, va_list ap)
+rb_enc_str_new(const char *ptr, long len, rb_encoding *enc) ::
+rb_enc_str_new_cstr(const char *ptr, rb_encoding *enc) ::
- Appends C string format and successive arguments to Ruby string
- str according to a printf-like format. These functions are
- equivalent to rb_str_cat2(str, rb_sprintf(format, ...)) and
- rb_str_cat2(str, rb_vsprintf(format, ap)), respectively.
+ Creates a new Ruby string with the specified encoding.
- rb_enc_str_new(const char *ptr, long len, rb_encoding *enc)
-
- Creates a new Ruby string with the specified encoding.
-
- rb_usascii_str_new(const char *ptr, long len)
- rb_usascii_str_new_cstr(const char *ptr)
+rb_usascii_str_new(const char *ptr, long len) ::
+rb_usascii_str_new_cstr(const char *ptr) ::
- Creates a new Ruby string with encoding US-ASCII.
+ Creates a new Ruby string with encoding US-ASCII.
- rb_str_resize(VALUE str, long len)
+rb_str_resize(VALUE str, long len) ::
- Resizes Ruby string to len bytes. If str is not modifiable, this
- function raises an exception. The length of str must be set in
- advance. If len is less than the old length the content beyond
- len bytes is discarded, else if len is greater than the old length
- the content beyond the old length bytes will not be preserved but
- will be garbage. Note that RSTRING_PTR(str) may change by calling
- this function.
+ Resizes Ruby string to len bytes. If str is not modifiable, this
+ function raises an exception. The length of str must be set in
+ advance. If len is less than the old length the content beyond
+ len bytes is discarded, else if len is greater than the old length
+ the content beyond the old length bytes will not be preserved but
+ will be garbage. Note that RSTRING_PTR(str) may change by calling
+ this function.
- rb_str_set_len(VALUE str, long len)
+rb_str_set_len(VALUE str, long len) ::
- Sets the length of Ruby string. If str is not modifiable, this
- function raises an exception. This function preserves the content
- upto len bytes, regardless RSTRING_LEN(str). len must not exceed
- the capacity of str.
+ Sets the length of Ruby string. If str is not modifiable, this
+ function raises an exception. This function preserves the content
+ upto len bytes, regardless RSTRING_LEN(str). len must not exceed
+ the capacity of str.
- Array functions
+=== Array Functions
- rb_ary_new()
+rb_ary_new() ::
- Creates an array with no elements.
+ Creates an array with no elements.
- rb_ary_new2(long len)
+rb_ary_new2(long len) ::
+rb_ary_new_capa(long len) ::
- Creates an array with no elements, allocating internal buffer
- for len elements.
+ Creates an array with no elements, allocating internal buffer
+ for len elements.
- rb_ary_new3(long n, ...)
+rb_ary_new3(long n, ...) ::
+rb_ary_new_from_args(long n, ...) ::
- Creates an n-element array from the arguments.
+ Creates an n-element array from the arguments.
- rb_ary_new4(long n, VALUE *elts)
+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.
+ Creates an n-element array from a C array.
- rb_ary_to_ary(VALUE obj)
+rb_ary_to_ary(VALUE obj) ::
- Converts the object into an array.
- Equivalent to Object#to_ary.
+ Converts the object into an array.
+ Equivalent to Object#to_ary.
- There are many functions to operate an array.
- They may dump core if other types are given.
+There are many functions to operate an array. They may dump core if other
+types are given.
- rb_ary_aref(argc, VALUE *argv, VALUE ary)
+rb_ary_aref(argc, VALUE *argv, VALUE ary) ::
- Equivaelent to Array#[].
+ Equivalent to Array#[].
- rb_ary_entry(VALUE ary, long offset)
+rb_ary_entry(VALUE ary, long offset) ::
- ary[offset]
+ ary[offset]
- rb_ary_subseq(VALUE ary, long beg, long len)
+rb_ary_store(VALUE ary, long offset, VALUE obj) ::
- ary[beg, len]
+ ary[offset] = obj
- rb_ary_push(VALUE ary, VALUE val)
- rb_ary_pop(VALUE ary)
- rb_ary_shift(VALUE ary)
- rb_ary_unshift(VALUE ary, VALUE val)
+rb_ary_subseq(VALUE ary, long beg, long len) ::
+ ary[beg, len]
-2. Extending Ruby with C
+rb_ary_push(VALUE ary, VALUE val) ::
+rb_ary_pop(VALUE ary) ::
+rb_ary_shift(VALUE ary) ::
+rb_ary_unshift(VALUE ary, VALUE val) ::
-2.1 Adding new features to Ruby
+rb_ary_cat(VALUE ary, const VALUE *ptr, long len) ::
+
+ Appends len elements of objects from ptr to the array.
+
+= Extending Ruby with C
+
+== Adding New Features to Ruby
You can add new features (classes, methods, etc.) to the Ruby
interpreter. Ruby provides APIs for defining the following things:
- * Classes, Modules
- * Methods, Singleton Methods
- * Constants
+* Classes, Modules
+* Methods, Singleton Methods
+* Constants
-2.1.1 Class/module definition
+=== Class and Module Definition
To define a class or module, use the functions below:
@@ -311,21 +328,21 @@ To define nested classes or modules, use the functions below:
VALUE rb_define_class_under(VALUE outer, const char *name, VALUE super)
VALUE rb_define_module_under(VALUE outer, const char *name)
-2.1.2 Method/singleton method definition
+=== Method and Singleton Method Definition
To define methods or singleton methods, use these functions:
- void rb_define_method(VALUE klass, const char *name,
+ void rb_define_method(VALUE klass, const char *name,
VALUE (*func)(), int argc)
- void rb_define_singleton_method(VALUE object, const char *name,
+ void rb_define_singleton_method(VALUE object, const char *name,
VALUE (*func)(), int argc)
The `argc' represents the number of the arguments to the C function,
which must be less than 17. But I doubt you'll need that many.
If `argc' is negative, it specifies the calling sequence, not number of
-the arguments.
+the arguments.
If argc is -1, the function will be called as:
@@ -343,16 +360,16 @@ where obj is the receiver, and args is the Ruby array containing
actual arguments.
There are some more functions to define methods. One takes an ID
-as the name of method to be defined. See 2.2.2 for IDs.
+as the name of method to be defined. See also ID or Symbol below.
- void rb_define_method_id(VALUE klass, ID name,
+ void rb_define_method_id(VALUE klass, ID name,
VALUE (*func)(ANYARGS), int argc)
There are two functions to define private/protected methods:
- void rb_define_private_method(VALUE klass, const char *name,
+ void rb_define_private_method(VALUE klass, const char *name,
VALUE (*func)(), int argc)
- void rb_define_protected_method(VALUE klass, const char *name,
+ void rb_define_protected_method(VALUE klass, const char *name,
VALUE (*func)(), int argc)
At last, rb_define_module_function defines a module functions,
@@ -369,7 +386,7 @@ or
To define module functions, use:
- void rb_define_module_function(VALUE module, const char *name,
+ void rb_define_module_function(VALUE module, const char *name,
VALUE (*func)(), int argc)
In addition, function-like methods, which are private methods defined
@@ -394,7 +411,7 @@ 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.
-2.1.3 Constant definition
+=== Constant Definition
We have 2 functions to define constants:
@@ -404,11 +421,11 @@ We have 2 functions to define constants:
The former is to define a constant under specified class/module. The
latter is to define a global constant.
-2.2 Use Ruby features from C
+== Use Ruby Features from C
There are several ways to invoke Ruby's features from C code.
-2.2.1 Evaluate Ruby Programs in a String
+=== Evaluate Ruby Programs in a String
The easiest way to use Ruby's functionality from a C program is to
evaluate the string as Ruby program. This function will do the job:
@@ -418,7 +435,7 @@ evaluate the string as Ruby program. This function will do the job:
Evaluation is done under the current context, thus current local variables
of the innermost method (which is defined by Ruby) can be accessed.
-Note that the evaluation can raise an exception. There is a safer
+Note that the evaluation can raise an exception. There is a safer
function:
VALUE rb_eval_string_protect(const char *str, int *state)
@@ -426,8 +443,7 @@ function:
It returns nil when an error occur. Moreover, *state is zero if str was
successfully evaluated, or nonzero otherwise.
-
-2.2.2 ID or Symbol
+=== ID or Symbol
You can invoke methods directly, without parsing the string. First I
need to explain about ID. ID is the integer number to represent
@@ -435,18 +451,30 @@ Ruby's identifiers such as variable names. The Ruby data type
corresponding to ID is Symbol. It can be accessed from Ruby in the
form:
- :Identifier
+ :Identifier
+
or
- :"any kind of string"
+
+ :"any kind of string"
You can get the ID value from a string within C code by using
rb_intern(const char *name)
+ rb_intern_str(VALUE name)
You can retrieve ID from Ruby object (Symbol or String) given as an
argument by using
rb_to_id(VALUE symbol)
+ rb_check_id(volatile VALUE *name)
+ rb_check_id_cstr(const char *name, long len, rb_encoding *enc)
+
+These functions try to convert the argument to a String if it was not
+a Symbol nor a String. The second function stores the converted
+result into *name, and returns 0 if the string is not a known symbol.
+After this function returned a non-zero value, *name is always a
+Symbol or a String, otherwise it is a String if the result is 0.
+The third function takes NUL-terminated C string, not Ruby VALUE.
You can convert C ID to Ruby Symbol by using
@@ -456,7 +484,7 @@ and to convert Ruby Symbol object to ID, use
ID SYM2ID(VALUE symbol)
-2.2.3 Invoke Ruby method from C
+=== Invoke Ruby Method from C
To invoke methods directly, you can use the function below
@@ -465,7 +493,7 @@ To invoke methods directly, you can use the function below
This function invokes a method on the recv, with the method name
specified by the symbol mid.
-2.2.4 Accessing the variables and constants
+=== Accessing the Variables and Constants
You can access class variables and instance variables using access
functions. Also, global variables can be shared between both
@@ -482,11 +510,11 @@ To access the constants of the class/module:
VALUE rb_const_get(VALUE obj, ID id)
-See 2.1.3 for defining new constant.
+See also Constant Definition above.
-3. Information sharing between Ruby and C
+= Information Sharing Between Ruby and C
-3.1 Ruby constants that C can be accessed from C
+=== Ruby Constants That C Can Be Accessed From C
As stated in section 1.3,
the following Ruby constants can be referred from C.
@@ -500,7 +528,7 @@ Boolean values. Qfalse is false in C also (i.e. 0).
Ruby nil in C scope.
-3.2 Global variables shared between C and Ruby
+== Global Variables Shared Between C and Ruby
Information can be shared between the two environments using shared global
variables. To define them, you can use functions listed below:
@@ -544,12 +572,12 @@ The prototypes of the getter and setter functions are as follows:
void (*setter)(VALUE val, ID id);
-3.3 Encapsulate C data into a Ruby object
+== Encapsulate C Data into a Ruby Object
To wrap and objectify a C pointer as a Ruby object (so called
DATA), use Data_Wrap_Struct().
- Data_Wrap_Struct(klass, mark, free, ptr)
+ Data_Wrap_Struct(klass, mark, free, sval)
Data_Wrap_Struct() returns a created DATA object. The klass argument
is the class for the DATA object. The mark argument is the function
@@ -582,25 +610,25 @@ Data_Get_Struct().
A pointer to the structure will be assigned to the variable sval.
-See the example below for details.
+See the example below for details.
-4. Example - Creating dbm extension
+= Example - Creating dbm Extension
OK, here's the example of making an extension library. This is the
extension to access DBMs. The full source is included in the ext/
directory in the Ruby's source tree.
-(1) make the directory
+== Make the Directory
% mkdir ext/dbm
Make a directory for the extension library under ext directory.
-(2) design the library
+== Design the Library
You need to design the library features, before making it.
-(3) write C code.
+== Write the C Code
You need to write C code for your extension library. If your library
has only one source file, choosing ``LIBRARY.c'' as a file name is
@@ -617,41 +645,37 @@ the library.
Here's the example of an initializing function.
---
-void
-Init_dbm(void)
-{
- /* define DBM class */
- cDBM = rb_define_class("DBM", rb_cObject);
- /* DBM includes Enumerate module */
- rb_include_module(cDBM, rb_mEnumerable);
-
- /* DBM has class method open(): arguments are received as C array */
- rb_define_singleton_method(cDBM, "open", fdbm_s_open, -1);
-
- /* DBM instance method close(): no args */
- rb_define_method(cDBM, "close", fdbm_close, 0);
- /* DBM instance method []: 1 argument */
- rb_define_method(cDBM, "[]", fdbm_fetch, 1);
- :
-
- /* ID for a instance variable to store DBM data */
- id_dbm = rb_intern("dbm");
-}
---
-
-The dbm extension wraps the dbm struct in the C environment using
-Data_Make_Struct.
+ void
+ Init_dbm(void)
+ {
+ /* define DBM class */
+ cDBM = rb_define_class("DBM", rb_cObject);
+ /* DBM includes Enumerate module */
+ rb_include_module(cDBM, rb_mEnumerable);
+
+ /* DBM has class method open(): arguments are received as C array */
+ rb_define_singleton_method(cDBM, "open", fdbm_s_open, -1);
+
+ /* DBM instance method close(): no args */
+ rb_define_method(cDBM, "close", fdbm_close, 0);
+ /* DBM instance method []: 1 argument */
+ rb_define_method(cDBM, "[]", fdbm_fetch, 1);
+
+ /* ... */
---
-struct dbmdata {
- int di_size;
- DBM *di_dbm;
-};
+ /* ID for a instance variable to store DBM data */
+ id_dbm = rb_intern("dbm");
+ }
+
+The dbm extension wraps the dbm struct in the C environment using
+Data_Make_Struct.
+ struct dbmdata {
+ int di_size;
+ DBM *di_dbm;
+ };
-obj = Data_Make_Struct(klass, struct dbmdata, 0, free_dbm, dbmp);
---
+ obj = Data_Make_Struct(klass, struct dbmdata, 0, free_dbm, dbmp);
This code wraps the dbmdata structure into a Ruby object. We avoid
wrapping DBM* directly, because we want to cache size information.
@@ -659,12 +683,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) {\
- Data_Get_Struct(obj, struct dbmdata, dbmp);\
- if (dbmp->di_dbm == 0) closed_dbm();\
-}
---
+ #define GetDBM(obj, dbmp) {\
+ Data_Get_Struct(obj, struct dbmdata, dbmp);\
+ if (dbmp->di_dbm == 0) closed_dbm();\
+ }
This sort of complicated macro does the retrieving and close checking for
the DBM.
@@ -672,13 +694,11 @@ the DBM.
There are three kinds of way to receive method arguments. First,
methods with a fixed number of arguments receive arguments like this:
---
-static VALUE
-fdbm_delete(VALUE obj, VALUE keystr)
-{
- :
-}
---
+ static VALUE
+ fdbm_delete(VALUE obj, VALUE keystr)
+ {
+ /* ... */
+ }
The first argument of the C function is the self, the rest are the
arguments to the method.
@@ -686,17 +706,15 @@ arguments to the method.
Second, methods with an arbitrary number of arguments receive
arguments like this:
---
-static VALUE
-fdbm_s_open(int argc, VALUE *argv, VALUE klass)
-{
- :
- if (rb_scan_args(argc, argv, "11", &file, &vmode) == 1) {
- mode = 0666; /* default value */
- }
- :
-}
---
+ static VALUE
+ fdbm_s_open(int argc, VALUE *argv, VALUE klass)
+ {
+ /* ... */
+ if (rb_scan_args(argc, argv, "11", &file, &vmode) == 1) {
+ mode = 0666; /* default value */
+ }
+ /* ... */
+ }
The first argument is the number of method arguments, the second
argument is the C array of the method arguments, and the third
@@ -711,25 +729,21 @@ references.
The following is an example of a method that takes arguments by Ruby's
array:
---
-static VALUE
-thread_initialize(VALUE thread, VALUE args)
-{
- :
-}
---
+ static VALUE
+ thread_initialize(VALUE thread, VALUE args)
+ {
+ /* ... */
+ }
The first argument is the receiver, the second one is the Ruby array
which contains the arguments to the method.
-** Notice
-
-GC should know about global variables which refer to Ruby's objects, but
-are not exported to the Ruby world. You need to protect them by
+*Notice*: GC should know about global variables which refer to Ruby's objects,
+but are not exported to the Ruby world. You need to protect them by
void rb_global_variable(VALUE *var)
-(4) prepare extconf.rb
+== Prepare extconf.rb
If the file named extconf.rb exists, it will be executed to generate
Makefile.
@@ -742,10 +756,26 @@ need to put
at the top of the file. You can use the functions below to check
various conditions.
- have_library(lib, func): check whether library containing function exists.
- have_func(func, header): check whether function exists
- have_header(header): check whether header file exists
- create_makefile(target): generate Makefile
+ have_macro(macro[, headers[, opt]]): check whether macro is defined
+ have_library(lib[, func[, headers[, opt]]]): check whether library containing function exists
+ find_library(lib[, func, *paths]): find library from paths
+ have_func(func[, headers[, opt]): check whether function exists
+ have_var(var[, headers[, opt]]): check whether variable exists
+ have_header(header[, preheaders[, opt]]): check whether header file exists
+ find_header(header, *paths): find header from paths
+ have_framework(fw): check whether framework exists (for MacOS X)
+ have_struct_member(type, member[, headers[, opt]]): check whether struct has member
+ have_type(type[, headers[, opt]]): check whether type exists
+ find_type(type, opt, *headers): check whether type exists in headers
+ have_const(const[, headers[, opt]]): check whether constant is defined
+ check_sizeof(type[, headers[, opts]]): check size of type
+ check_signedness(type[, headers[, opts]]): check signedness of type
+ convertible_int(type[, headers[, opts]]): find convertible integer type
+ find_executable(bin[, path]): find executable file path
+ create_header(header): generate configured header
+ create_makefile(target[, target_prefix]): generate Makefile
+
+See MakeMakefile for full documentation of these functions.
The value of the variables below will affect the Makefile.
@@ -762,7 +792,7 @@ If a compilation condition is not fulfilled, you should not call
``create_makefile''. The Makefile will not be generated, compilation will
not be done.
-(5) prepare depend (optional)
+== Prepare Depend (Optional)
If the file named depend exists, Makefile will include that file to
check dependencies. You can make this file by invoking
@@ -771,7 +801,7 @@ check dependencies. You can make this file by invoking
It's harmless. Prepare it.
-(6) generate Makefile
+== Generate Makefile
Try generating the Makefile by:
@@ -786,7 +816,7 @@ You don't need this step if you put the extension library under the ext
directory of the ruby source tree. In that case, compilation of the
interpreter will do this step for you.
-(7) make
+== Run make
Type
@@ -795,36 +825,38 @@ Type
to compile your extension. You don't need this step either if you have
put the extension library under the ext directory of the ruby source tree.
-(8) debug
+== Debug
You may need to rb_debug the extension. Extensions can be linked
statically by adding the directory name in the ext/Setup file so that
you can inspect the extension with the debugger.
-(9) done, now you have the extension library
+== Done! Now You Have the Extension Library
You can do anything you want with your library. The author of Ruby
will not claim any restrictions on your code depending on the Ruby API.
Feel free to use, modify, distribute or sell your program.
-Appendix A. Ruby source files overview
+= Appendix A. Ruby Source Files Overview
-ruby language core
+== Ruby Language Core
- class.c : classes and modules
- error.c : exception classes and exception mechanism
- gc.c : memory management
- load.c : library loading
- object.c : objects
- variable.c : variables and constants
+class.c :: classes and modules
+error.c :: exception classes and exception mechanism
+gc.c :: memory management
+load.c :: library loading
+object.c :: objects
+variable.c :: variables and constants
-ruby syntax parser
- parse.y
- -> parse.c : automatically generated
- keywords : reserved keywords
- -> lex.c : automatically generated
+== Ruby Syntax Parser
+
+parse.y :: grammar definition
+parse.c :: automatically generated from parse.y
+keywords :: reserved keywords
+lex.c :: automatically generated from keywords
+
+== Ruby Evaluator (a.k.a. YARV)
-ruby evaluator (a.k.a. YARV)
compile.c
eval.c
eval_error.c
@@ -832,7 +864,7 @@ ruby evaluator (a.k.a. YARV)
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
@@ -849,7 +881,8 @@ ruby evaluator (a.k.a. YARV)
-> opt*.inc : automatically generated
-> vm.inc : automatically generated
-regular expression engine (oniguruma)
+== Regular Expression Engine (Oniguruma)
+
regex.c
regcomp.c
regenc.c
@@ -858,18 +891,18 @@ regular expression engine (oniguruma)
regparse.c
regsyntax.c
-utility functions
+== Utility Functions
- debug.c : debug symbols for C debuggger
- dln.c : dynamic loading
- st.c : general purpose hash table
- strftime.c : formatting times
- util.c : misc utilities
+debug.c :: debug symbols for C debugger
+dln.c :: dynamic loading
+st.c :: general purpose hash table
+strftime.c :: formatting times
+util.c :: misc utilities
-ruby interpreter implementation
+== Ruby Interpreter Implementation
dmyext.c
- dmydln.c
+ dmydln.c
dmyencoding.c
id.c
inits.c
@@ -880,587 +913,584 @@ ruby interpreter implementation
gem_prelude.rb
prelude.rb
+== Class Library
+
+array.c :: Array
+bignum.c :: Bignum
+compar.c :: Comparable
+complex.c :: Complex
+cont.c :: Fiber, Continuation
+dir.c :: Dir
+enum.c :: Enumerable
+enumerator.c :: Enumerator
+file.c :: File
+hash.c :: Hash
+io.c :: IO
+marshal.c :: Marshal
+math.c :: Math
+numeric.c :: Numeric, Integer, Fixnum, Float
+pack.c :: Array#pack, String#unpack
+proc.c :: Binding, Proc
+process.c :: Process
+random.c :: random number
+range.c :: Range
+rational.c :: Rational
+re.c :: Regexp, MatchData
+signal.c :: Signal
+sprintf.c :: String#sprintf
+string.c :: String
+struct.c :: Struct
+time.c :: Time
+
+defs/known_errors.def :: Errno::* exception classes
+-> known_errors.inc :: automatically generated
+
+== Multilingualization
+
+encoding.c :: Encoding
+transcode.c :: Encoding::Converter
+enc/*.c :: encoding classes
+enc/trans/* :: codepoint mapping tables
+
+== goruby Interpreter Implementation
-class library
-
- array.c : Array
- bignum.c : Bignum
- compar.c : Comparable
- complex.c : Complex
- cont.c : Fiber, Continuation
- dir.c : Dir
- enum.c : Enumerable
- enumerator.c : Enumerator
- file.c : File
- hash.c : Hash
- io.c : IO
- marshal.c : Marshal
- math.c : Math
- numeric.c : Numeric, Integer, Fixnum, Float
- pack.c : Array#pack, String#unpack
- proc.c : Binding, Proc
- process.c : Process
- random.c : random number
- range.c : Range
- rational.c : Rational
- re.c : Regexp, MatchData
- signal.c : Signal
- sprintf.c :
- string.c : String
- struct.c : Struct
- time.c : Time
-
- defs/known_errors.def : Errno::* exception classes
- -> known_errors.inc : automatically generated
-
-multilingualization
- encoding.c : Encoding
- transcode.c : Encoding::Converter
- enc/*.c : encoding classes
- enc/trans/* : codepoint mapping tables
-
-goruby interpreter implementation
-
goruby.c
golf_prelude.rb : goruby specific libraries.
-> golf_prelude.c : automatically generated
-Appendix B. Ruby extension API reference
+= Appendix B. Ruby Extension API Reference
-** Types
+== Types
- VALUE
+VALUE ::
-The type for the Ruby object. Actual structures are defined in ruby.h,
-such as struct RString, etc. To refer the values in structures, use
-casting macros like RSTRING(obj).
+ The type for the Ruby object. Actual structures are defined in ruby.h,
+ such as struct RString, etc. To refer the values in structures, use
+ casting macros like RSTRING(obj).
-** Variables and constants
+== Variables and Constants
- Qnil
+Qnil::
+ nil object
-const: nil object
+Qtrue::
+ true object (default true value)
- Qtrue
+Qfalse::
+ false object
-const: true object(default true value)
+== C Pointer Wrapping
- Qfalse
+Data_Wrap_Struct(VALUE klass, void (*mark)(), void (*free)(), void *sval) ::
-const: false object
+ Wrap a C pointer into a Ruby object. If object has references to other
+ Ruby objects, they should be marked by using the mark function during
+ the GC process. Otherwise, mark should be 0. When this object is no
+ longer referred by anywhere, the pointer will be discarded by free
+ function.
-** C pointer wrapping
+Data_Make_Struct(klass, type, mark, free, sval) ::
- Data_Wrap_Struct(VALUE klass, void (*mark)(), void (*free)(), void *sval)
+ This macro allocates memory using malloc(), assigns it to the variable
+ sval, and returns the DATA encapsulating the pointer to memory region.
-Wrap a C pointer into a Ruby object. If object has references to other
-Ruby objects, they should be marked by using the mark function during
-the GC process. Otherwise, mark should be 0. When this object is no
-longer referred by anywhere, the pointer will be discarded by free
-function.
+Data_Get_Struct(data, type, sval) ::
- Data_Make_Struct(klass, type, mark, free, sval)
+ This macro retrieves the pointer value from DATA, and assigns it to
+ the variable sval.
-This macro allocates memory using malloc(), assigns it to the variable
-sval, and returns the DATA encapsulating the pointer to memory region.
+== Checking Data Types
- Data_Get_Struct(data, type, sval)
+TYPE(value) ::
-This macro retrieves the pointer value from DATA, and assigns it to
-the variable sval.
+ Internal type (T_NIL, T_FIXNUM, etc.)
-** Checking data types
+FIXNUM_P(value) ::
-TYPE(value)
-FIXNUM_P(value)
-NIL_P(value)
-void Check_Type(VALUE value, int type)
-void Check_SafeStr(VALUE value)
+ Is +value+ a Fixnum?
-** Data type conversion
+NIL_P(value) ::
-FIX2INT(value), INT2FIX(i)
-FIX2LONG(value), LONG2FIX(l)
-NUM2INT(value), INT2NUM(i)
-NUM2UINT(value), UINT2NUM(ui)
-NUM2LONG(value), LONG2NUM(l)
-NUM2ULONG(value), ULONG2NUM(ul)
-NUM2LL(value), LL2NUM(ll)
-NUM2ULL(value), ULL2NUM(ull)
-NUM2OFFT(value), OFFT2NUM(off)
-NUM2SIZET(value), SIZET2NUM(size)
-NUM2SSIZET(value), SSIZET2NUM(ssize)
-NUM2DBL(value)
-rb_float_new(f)
-StringValue(value)
-StringValuePtr(value)
-StringValueCStr(value)
-rb_str_new2(s)
+ Is +value+ nil?
-** defining class/module
+void Check_Type(VALUE value, int type) ::
- VALUE rb_define_class(const char *name, VALUE super)
+ Ensures +value+ is of the given internal +type+ or raises a TypeError
-Defines a new Ruby class as a subclass of super.
+SaveStringValue(value) ::
- VALUE rb_define_class_under(VALUE module, const char *name, VALUE super)
+ Checks that +value+ is a String and is not tainted
-Creates a new Ruby class as a subclass of super, under the module's
-namespace.
+== Data Type Conversion
- VALUE rb_define_module(const char *name)
+FIX2INT(value), INT2FIX(i) ::
-Defines a new Ruby module.
+ Fixnum <-> integer
- VALUE rb_define_module_under(VALUE module, const char *name)
+FIX2LONG(value), LONG2FIX(l) ::
-Defines a new Ruby module under the module's namespace.
+ Fixnum <-> long
- void rb_include_module(VALUE klass, VALUE module)
+NUM2INT(value), INT2NUM(i) ::
-Includes module into class. If class already includes it, just
-ignored.
+ Numeric <-> integer
- void rb_extend_object(VALUE object, VALUE module)
+NUM2UINT(value), UINT2NUM(ui) ::
-Extend the object with the module's attributes.
+ Numeric <-> unsigned integer
-** Defining Global Variables
+NUM2LONG(value), LONG2NUM(l) ::
- void rb_define_variable(const char *name, VALUE *var)
+ Numeric <-> long
-Defines a global variable which is shared between C and Ruby. If name
-contains a character which is not allowed to be part of the symbol,
-it can't be seen from Ruby programs.
+NUM2ULONG(value), ULONG2NUM(ul) ::
- void rb_define_readonly_variable(const char *name, VALUE *var)
+ Numeric <-> unsigned long
-Defines a read-only global variable. Works just like
-rb_define_variable(), except the defined variable is read-only.
+NUM2LL(value), LL2NUM(ll) ::
- void rb_define_virtual_variable(const char *name,
- VALUE (*getter)(), VALUE (*setter)())
+ Numeric <-> long long
-Defines a virtual variable, whose behavior is defined by a pair of C
-functions. The getter function is called when the variable is
-referenced. The setter function is called when the variable is set to a
-value. The prototype for getter/setter functions are:
+NUM2ULL(value), ULL2NUM(ull) ::
- VALUE getter(ID id)
- void setter(VALUE val, ID id)
+ Numeric <-> unsigned long long
-The getter function must return the value for the access.
+NUM2OFFT(value), OFFT2NUM(off) ::
- void rb_define_hooked_variable(const char *name, VALUE *var,
- VALUE (*getter)(), VALUE (*setter)())
+ Numeric <-> off_t
-Defines hooked variable. It's a virtual variable with a C variable.
-The getter is called as
+NUM2SIZET(value), SIZET2NUM(size) ::
- VALUE getter(ID id, VALUE *var)
+ Numeric <-> size_t
-returning a new value. The setter is called as
+NUM2SSIZET(value), SSIZET2NUM(ssize) ::
- void setter(VALUE val, ID id, VALUE *var)
+ Numeric <-> ssize_t
-GC requires C global variables which hold Ruby values to be marked.
+rb_integer_pack(value, words, numwords, wordsize, nails, flags), rb_integer_unpack(words, numwords, wordsize, nails, flags) ::
- void rb_global_variable(VALUE *var)
+ Numeric <-> Arbitrary size integer buffer
-Tells GC to protect these variables.
+NUM2DBL(value) ::
-** Constant Definition
+ Numeric -> double
- void rb_define_const(VALUE klass, const char *name, VALUE val)
+rb_float_new(f) ::
-Defines a new constant under the class/module.
+ double -> Float
- void rb_define_global_const(const char *name, VALUE val)
+StringValue(value) ::
-Defines a global constant. This is just the same as
+ Object with #to_str -> String
- rb_define_const(cKernal, name, val)
+StringValuePtr(value) ::
-** Method Definition
+ Object with #to_str -> pointer to String data
- rb_define_method(VALUE klass, const char *name, VALUE (*func)(), int argc)
+StringValueCStr(value) ::
-Defines a method for the class. func is the function pointer. argc
-is the number of arguments. if argc is -1, the function will receive
-3 arguments: argc, argv, and self. if argc is -2, the function will
-receive 2 arguments, self and args, where args is a Ruby array of
-the method arguments.
+ Object with #to_str -> pointer to String data without NULL bytes
- rb_define_private_method(VALUE klass, const char *name, VALUE (*func)(), int argc)
+rb_str_new2(s) ::
-Defines a private method for the class. Arguments are same as
-rb_define_method().
+ char * -> String
- rb_define_singleton_method(VALUE klass, const char *name, VALUE (*func)(), int argc)
+== Defining Class and Module
-Defines a singleton method. Arguments are same as rb_define_method().
+VALUE rb_define_class(const char *name, VALUE super) ::
- rb_scan_args(int argc, VALUE *argv, const char *fmt, ...)
+ Defines a new Ruby class as a subclass of super.
-Retrieve argument from argc and argv to given VALUE references
-according to the format string. The format can be described in ABNF
-as follows:
+VALUE rb_define_class_under(VALUE module, const char *name, VALUE super) ::
---
-scan-arg-spec := param-arg-spec [option-hash-arg-spec] [block-arg-spec]
+ Creates a new Ruby class as a subclass of super, under the module's
+ namespace.
-param-arg-spec := pre-arg-spec [post-arg-spec] / post-arg-spec / pre-opt-post-arg-spec
-pre-arg-spec := num-of-leading-mandatory-args [num-of-optional-args]
-post-arg-spec := sym-for-variable-length-args [num-of-trailing-mandatory-args]
-pre-opt-post-arg-spec := num-of-leading-mandatory-args num-of-optional-args num-of-trailing-mandatory-args
-option-hash-arg-spec := sym-for-option-hash-arg
-block-arg-spec := sym-for-block-arg
+VALUE rb_define_module(const char *name) ::
-num-of-leading-mandatory-args := DIGIT ; The number of leading
- ; mandatory arguments
-num-of-optional-args := DIGIT ; The number of optional
- ; arguments
-sym-for-variable-length-args := "*" ; Indicates that variable
- ; length arguments are
- ; captured as a ruby array
-num-of-trailing-mandatory-args := DIGIT ; The number of trailing
- ; mandatory arguments
-sym-for-option-hash-arg := ":" ; Indicates that an option
- ; hash is captured if the last
- ; argument is a hash or can be
- ; converted to a hash with
- ; #to_hash. When the last
- ; argument is nil, it is
- ; captured if it is not
- ; ambiguous to take it as
- ; empty option hash; i.e. '*'
- ; is not specified and
- ; arguments are given more
- ; than sufficient.
-sym-for-block-arg := "&" ; Indicates that an iterator
- ; block should be captured if
- ; given
---
+ Defines a new Ruby module.
-For example, "12" means that the method requires at least one
-argument, and at most receives three (1+2) arguments. So, the format
-string must be followed by three variable references, which are to be
-assigned to captured arguments. For omitted arguments, variables are
-set to Qnil. NULL can be put in place of a variable reference, which
-means the corresponding captured argument(s) should be just dropped.
+VALUE rb_define_module_under(VALUE module, const char *name) ::
-The number of given arguments, excluding an option hash or iterator
-block, is returned.
+ Defines a new Ruby module under the module's namespace.
-** Invoking Ruby method
+void rb_include_module(VALUE klass, VALUE module) ::
- VALUE rb_funcall(VALUE recv, ID mid, int narg, ...)
+ Includes module into class. If class already includes it, just ignored.
-Invokes a method. To retrieve mid from a method name, use rb_intern().
+void rb_extend_object(VALUE object, VALUE module) ::
- VALUE rb_funcall2(VALUE recv, ID mid, int argc, VALUE *argv)
+ Extend the object with the module's attributes.
-Invokes a method, passing arguments by an array of values.
+== Defining Global Variables
- VALUE rb_eval_string(const char *str)
+void rb_define_variable(const char *name, VALUE *var) ::
-Compiles and executes the string as a Ruby program.
+ Defines a global variable which is shared between C and Ruby. If name
+ contains a character which is not allowed to be part of the symbol,
+ it can't be seen from Ruby programs.
- ID rb_intern(const char *name)
+void rb_define_readonly_variable(const char *name, VALUE *var) ::
-Returns ID corresponding to the name.
+ Defines a read-only global variable. Works just like
+ rb_define_variable(), except the defined variable is read-only.
- char *rb_id2name(ID id)
+void rb_define_virtual_variable(const char *name, VALUE (*getter)(), VALUE (*setter)()) ::
-Returns the name corresponding ID.
+ Defines a virtual variable, whose behavior is defined by a pair of C
+ functions. The getter function is called when the variable is
+ referenced. The setter function is called when the variable is set to a
+ value. The prototype for getter/setter functions are:
- char *rb_class2name(VALUE klass)
+ VALUE getter(ID id)
+ void setter(VALUE val, ID id)
-Returns the name of the class.
+ The getter function must return the value for the access.
- int rb_respond_to(VALUE object, ID id)
+void rb_define_hooked_variable(const char *name, VALUE *var, VALUE (*getter)(), VALUE (*setter)()) ::
-Returns true if the object responds to the message specified by id.
+ Defines hooked variable. It's a virtual variable with a C variable.
+ The getter is called as
-** Instance Variables
+ VALUE getter(ID id, VALUE *var)
- VALUE rb_iv_get(VALUE obj, const char *name)
+ returning a new value. The setter is called as
-Retrieve the value of the instance variable. If the name is not
-prefixed by `@', that variable shall be inaccessible from Ruby.
+ void setter(VALUE val, ID id, VALUE *var)
- VALUE rb_iv_set(VALUE obj, const char *name, VALUE val)
+ GC requires C global variables which hold Ruby values to be marked.
-Sets the value of the instance variable.
+void rb_global_variable(VALUE *var)
-** Control Structure
+ Tells GC to protect these variables.
- VALUE rb_block_call(VALUE recv, ID mid, int argc, VALUE * argv,
- VALUE (*func) (ANYARGS), VALUE data2)
+== Constant Definition
-Calls a method on the recv, with the method name specified by the
-symbol mid, with argc arguments in argv, supplying func as the
-block. When func is called as the block, it will receive the value
-from yield as the first argument, and data2 as the second argument.
-When yielded with multiple values (in C, rb_yield_values(),
-rb_yield_values2() and rb_yield_splat()), data2 is packed as an Array,
-whereas yielded values can be gotten via argc/argv of the third/fourth
-arguments.
+void rb_define_const(VALUE klass, const char *name, VALUE val) ::
- [OBSOLETE] VALUE rb_iterate(VALUE (*func1)(), void *arg1, VALUE (*func2)(), void *arg2)
+ Defines a new constant under the class/module.
-Calls the function func1, supplying func2 as the block. func1 will be
-called with the argument arg1. func2 receives the value from yield as
-the first argument, arg2 as the second argument.
-
-When rb_iterate is used in 1.9, func1 has to call some Ruby-level method.
-This function is obsolete since 1.9; use rb_block_call instead.
+void rb_define_global_const(const char *name, VALUE val) ::
- VALUE rb_yield(VALUE val)
+ Defines a global constant. This is just the same as
-Evaluates the block with value val.
+ rb_define_const(cKernal, name, val)
- VALUE rb_rescue(VALUE (*func1)(), VALUE arg1, VALUE (*func2)(), VALUE arg2)
+== Method Definition
-Calls the function func1, with arg1 as the argument. If an exception
-occurs during func1, it calls func2 with arg2 as the argument. The
-return value of rb_rescue() is the return value from func1 if no
-exception occurs, from func2 otherwise.
+rb_define_method(VALUE klass, const char *name, VALUE (*func)(), int argc) ::
- VALUE rb_ensure(VALUE (*func1)(), VALUE arg1, VALUE (*func2)(), VALUE arg2)
+ Defines a method for the class. func is the function pointer. argc
+ is the number of arguments. if argc is -1, the function will receive
+ 3 arguments: argc, argv, and self. if argc is -2, the function will
+ receive 2 arguments, self and args, where args is a Ruby array of
+ the method arguments.
-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_define_private_method(VALUE klass, const char *name, VALUE (*func)(), int argc) ::
- VALUE rb_protect(VALUE (*func) (VALUE), VALUE arg, int *state)
+ Defines a private method for the class. Arguments are same as
+ rb_define_method().
-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.
-Otherwise, it returns Qnil and sets *state to nonzero. If state is
-NULL, it is not set in both cases.
+rb_define_singleton_method(VALUE klass, const char *name, VALUE (*func)(), int argc) ::
- void rb_jump_tag(int state)
+ Defines a singleton method. Arguments are same as rb_define_method().
-Continues the exception caught by rb_protect() and rb_eval_string_protect().
-state must be the returned value from those functions. This function
-never return to the caller.
+rb_scan_args(int argc, VALUE *argv, const char *fmt, ...) ::
-** Exceptions and Errors
+ Retrieve argument from argc and argv to given VALUE references
+ according to the format string. The format can be described in ABNF
+ as follows:
- void rb_warn(const char *fmt, ...)
+ scan-arg-spec := param-arg-spec [option-hash-arg-spec] [block-arg-spec]
-Prints a warning message according to a printf-like format.
+ param-arg-spec := pre-arg-spec [post-arg-spec] / post-arg-spec /
+ pre-opt-post-arg-spec
+ pre-arg-spec := num-of-leading-mandatory-args [num-of-optional-args]
+ post-arg-spec := sym-for-variable-length-args
+ [num-of-trailing-mandatory-args]
+ pre-opt-post-arg-spec := num-of-leading-mandatory-args num-of-optional-args
+ num-of-trailing-mandatory-args
+ option-hash-arg-spec := sym-for-option-hash-arg
+ block-arg-spec := sym-for-block-arg
- void rb_warning(const char *fmt, ...)
+ num-of-leading-mandatory-args := DIGIT ; The number of leading
+ ; mandatory arguments
+ num-of-optional-args := DIGIT ; The number of optional
+ ; arguments
+ sym-for-variable-length-args := "*" ; Indicates that variable
+ ; length arguments are
+ ; captured as a ruby array
+ num-of-trailing-mandatory-args := DIGIT ; The number of trailing
+ ; mandatory arguments
+ sym-for-option-hash-arg := ":" ; Indicates that an option
+ ; hash is captured if the last
+ ; argument is a hash or can be
+ ; converted to a hash with
+ ; #to_hash. When the last
+ ; argument is nil, it is
+ ; captured if it is not
+ ; ambiguous to take it as
+ ; empty option hash; i.e. '*'
+ ; is not specified and
+ ; arguments are given more
+ ; than sufficient.
+ sym-for-block-arg := "&" ; Indicates that an iterator
+ ; block should be captured if
+ ; given
-Prints a warning message according to a printf-like format, if
-$VERBOSE is true.
+ For example, "12" means that the method requires at least one
+ argument, and at most receives three (1+2) arguments. So, the format
+ string must be followed by three variable references, which are to be
+ assigned to captured arguments. For omitted arguments, variables are
+ set to Qnil. NULL can be put in place of a variable reference, which
+ means the corresponding captured argument(s) should be just dropped.
-void rb_raise(rb_eRuntimeError, const char *fmt, ...)
+ The number of given arguments, excluding an option hash or iterator
+ block, is returned.
-Raises RuntimeError. The fmt is a format string just like printf().
+== Invoking Ruby method
- void rb_raise(VALUE exception, const char *fmt, ...)
+VALUE rb_funcall(VALUE recv, ID mid, int narg, ...) ::
-Raises a class exception. The fmt is a format string just like printf().
+ Invokes a method. To retrieve mid from a method name, use rb_intern().
+ Able to call even private/protected methods.
- void rb_fatal(const char *fmt, ...)
+VALUE rb_funcall2(VALUE recv, ID mid, int argc, VALUE *argv) ::
+VALUE rb_funcallv(VALUE recv, ID mid, int argc, VALUE *argv) ::
-Raises a fatal error, terminates the interpreter. No exception handling
-will be done for fatal errors, but ensure blocks will be executed.
+ Invokes a method, passing arguments as an array of values.
+ Able to call even private/protected methods.
- void rb_bug(const char *fmt, ...)
+VALUE rb_funcallv_public(VALUE recv, ID mid, int argc, VALUE *argv) ::
-Terminates the interpreter immediately. This function should be
-called under the situation caused by the bug in the interpreter. No
-exception handling nor ensure execution will be done.
+ Invokes a method, passing arguments as an array of values.
+ Able to call only public methods.
-** Initialize and Start the Interpreter
+VALUE rb_eval_string(const char *str) ::
-The embedding API functions are below (not needed for extension libraries):
+ Compiles and executes the string as a Ruby program.
- void ruby_init()
+ID rb_intern(const char *name) ::
-Initializes the interpreter.
+ Returns ID corresponding to the name.
- void ruby_options(int argc, char **argv)
+char *rb_id2name(ID id) ::
-Process command line arguments for the interpreter.
+ Returns the name corresponding ID.
- void ruby_run()
+char *rb_class2name(VALUE klass) ::
-Starts execution of the interpreter.
+ Returns the name of the class.
- void ruby_script(char *name)
+int rb_respond_to(VALUE object, ID id) ::
-Specifies the name of the script ($0).
+ Returns true if the object responds to the message specified by id.
-** Hooks for the Interpreter Events
+== Instance Variables
- void rb_add_event_hook(rb_event_hook_func_t func, rb_event_flag_t events, VALUE data)
+VALUE rb_iv_get(VALUE obj, const char *name) ::
-Adds a hook function for the specified interpreter events.
-events should be Or'ed value of:
-
- RUBY_EVENT_LINE
- RUBY_EVENT_CLASS
- RUBY_EVENT_END
- RUBY_EVENT_CALL
- RUBY_EVENT_RETURN
- RUBY_EVENT_C_CALL
- RUBY_EVENT_C_RETURN
- RUBY_EVENT_RAISE
- RUBY_EVENT_ALL
+ Retrieve the value of the instance variable. If the name is not
+ prefixed by `@', that variable shall be inaccessible from Ruby.
-The definition of rb_event_hook_func_t is below:
+VALUE rb_iv_set(VALUE obj, const char *name, VALUE val) ::
- typedef void (*rb_event_hook_func_t)(rb_event_t event, VALUE data,
- VALUE self, ID id, VALUE klass)
+ Sets the value of the instance variable.
-The third argument `data' to rb_add_event_hook() is passed to the hook
-function as the second argument, which was the pointer to the current
-NODE in 1.8. See RB_EVENT_HOOKS_HAVE_CALLBACK_DATA below.
+== Control Structure
- int rb_remove_event_hook(rb_event_hook_func_t func)
+VALUE rb_block_call(VALUE recv, ID mid, int argc, VALUE * argv, VALUE (*func) (ANYARGS), VALUE data2) ::
-Removes the specified hook function.
+ Calls a method on the recv, with the method name specified by the
+ symbol mid, with argc arguments in argv, supplying func as the
+ block. When func is called as the block, it will receive the value
+ from yield as the first argument, and data2 as the second argument.
+ When yielded with multiple values (in C, rb_yield_values(),
+ rb_yield_values2() and rb_yield_splat()), data2 is packed as an Array,
+ whereas yielded values can be gotten via argc/argv of the third/fourth
+ arguments.
-** Macros for the Compatibilities
+[OBSOLETE] VALUE rb_iterate(VALUE (*func1)(), void *arg1, VALUE (*func2)(), void *arg2) ::
-Some macros to check API compatibilities are available by default.
+ Calls the function func1, supplying func2 as the block. func1 will be
+ called with the argument arg1. func2 receives the value from yield as
+ the first argument, arg2 as the second argument.
+
+ When rb_iterate is used in 1.9, func1 has to call some Ruby-level method.
+ This function is obsolete since 1.9; use rb_block_call instead.
+
+VALUE rb_yield(VALUE val) ::
+
+ Evaluates the block with value val.
+
+VALUE rb_rescue(VALUE (*func1)(), VALUE arg1, VALUE (*func2)(), VALUE arg2) ::
- NORETURN_STYLE_NEW
+ Calls the function func1, with arg1 as the argument. If an exception
+ occurs during func1, it calls func2 with arg2 as the argument. The
+ return value of rb_rescue() is the return value from func1 if no
+ exception occurs, from func2 otherwise.
-Means that NORETURN macro is functional style instead of prefix.
+VALUE rb_ensure(VALUE (*func1)(), VALUE arg1, VALUE (*func2)(), VALUE arg2) ::
- HAVE_RB_DEFINE_ALLOC_FUNC
+ Calls the function func1 with arg1 as the argument, then calls func2
+ with arg2 if execution terminated. The return value from
+ rb_ensure() is that of func1 when no exception occurred.
-Means that function rb_define_alloc_func() is provided, that means the
-allocation framework is used. This is same as the result of
-have_func("rb_define_alloc_func", "ruby.h").
+VALUE rb_protect(VALUE (*func) (VALUE), VALUE arg, int *state) ::
- HAVE_RB_REG_NEW_STR
+ Calls the function func with arg as the argument. If no exception
+ occurred during func, it returns the result of func and *state is zero.
+ Otherwise, it returns Qnil and sets *state to nonzero. If state is
+ NULL, it is not set in both cases.
+ You have to clear the error info with rb_set_errinfo(Qnil) when
+ ignoring the caught exception.
-Means that function rb_reg_new_str() is provided, that creates Regexp
-object from String object. This is same as the result of
-have_func("rb_reg_new_str", "ruby.h").
+void rb_jump_tag(int state) ::
- HAVE_RB_IO_T
+ Continues the exception caught by rb_protect() and rb_eval_string_protect().
+ state must be the returned value from those functions. This function
+ never return to the caller.
-Means that type rb_io_t is provided.
+void rb_iter_break() ::
- USE_SYMBOL_AS_METHOD_NAME
+ Exits from the current innermost block. This function never return to
+ the caller.
-Means that Symbols will be returned as method names, e.g.,
-Module#methods, #singleton_methods and so on.
+void rb_iter_break_value(VALUE value) ::
- HAVE_RUBY_*_H
+ Exits from the current innermost block with the value. The block will
+ return the given argument value. This function never return to the
+ caller.
-Defined in ruby.h and means correspoinding header is available. For
-instance, when HAVE_RUBY_ST_H is defined you should use ruby/st.h not
-mere st.h.
+== Exceptions and Errors
- RB_EVENT_HOOKS_HAVE_CALLBACK_DATA
+void rb_warn(const char *fmt, ...) ::
-Means that rb_add_event_hook() takes the third argument `data', to be
-passed to the given event hook function.
+ Prints a warning message according to a printf-like format.
-Appendix C. Functions Available in extconf.rb
+void rb_warning(const char *fmt, ...) ::
-These functions are available in extconf.rb:
+ Prints a warning message according to a printf-like format, if
+ $VERBOSE is true.
- have_macro(macro, headers)
+void rb_raise(rb_eRuntimeError, const char *fmt, ...) ::
-Checks whether macro is defined with header. Returns true if the macro
-is defined.
+ Raises RuntimeError. The fmt is a format string just like printf().
- have_library(lib, func)
+void rb_raise(VALUE exception, const char *fmt, ...) ::
-Checks whether the library exists, containing the specified function.
-Returns true if the library exists.
+ Raises a class exception. The fmt is a format string just like printf().
- find_library(lib, func, path...)
+void rb_fatal(const char *fmt, ...) ::
+
+ Raises a fatal error, terminates the interpreter. No exception handling
+ will be done for fatal errors, but ensure blocks will be executed.
+
+void rb_bug(const char *fmt, ...) ::
+
+ Terminates the interpreter immediately. This function should be
+ called under the situation caused by the bug in the interpreter. No
+ exception handling nor ensure execution will be done.
+
+Note: In the format string, %i is used for Object#to_s (or Object#inspect if
+'+' flag is set) output (and related argument must be a VALUE). For integers
+in format strings, use %d.
+
+== Initialize and Start the Interpreter
+
+The embedding API functions are below (not needed for extension libraries):
-Checks whether a library which contains the specified function exists in
-path. Returns true if the library exists.
+void ruby_init() ::
- have_func(func, header)
+ Initializes the interpreter.
-Checks whether func exists with header. Returns true if the function
-exists. To check functions in an additional library, you need to
-check that library first using have_library().
+void ruby_options(int argc, char **argv) ::
- have_var(var, header)
+ Process command line arguments for the interpreter.
-Checks whether var exists with header. Returns true if the variable
-exists. To check variables in an additional library, you need to
-check that library first using have_library().
+void ruby_run() ::
- have_header(header)
+ Starts execution of the interpreter.
-Checks whether header exists. Returns true if the header file exists.
+void ruby_script(char *name) ::
- find_header(header, path...)
+ Specifies the name of the script ($0).
-Checks whether header exists in path. Returns true if the header file
-exists.
+== Hooks for the Interpreter Events
- have_struct_member(type, member, header)
+ void rb_add_event_hook(rb_event_hook_func_t func, rb_event_flag_t events,
+ VALUE data)
-Checks whether type has member with header. Returns true if the type
-is defined and has the member.
+Adds a hook function for the specified interpreter events.
+events should be OR'ed value of:
+
+ RUBY_EVENT_LINE
+ RUBY_EVENT_CLASS
+ RUBY_EVENT_END
+ RUBY_EVENT_CALL
+ RUBY_EVENT_RETURN
+ RUBY_EVENT_C_CALL
+ RUBY_EVENT_C_RETURN
+ RUBY_EVENT_RAISE
+ RUBY_EVENT_ALL
+
+The definition of rb_event_hook_func_t is below:
+
+ typedef void (*rb_event_hook_func_t)(rb_event_t event, VALUE data,
+ VALUE self, ID id, VALUE klass)
+
+The third argument `data' to rb_add_event_hook() is passed to the hook
+function as the second argument, which was the pointer to the current
+NODE in 1.8. See RB_EVENT_HOOKS_HAVE_CALLBACK_DATA below.
+
+ int rb_remove_event_hook(rb_event_hook_func_t func)
+
+Removes the specified hook function.
+
+== Macros for Compatibility
+
+Some macros to check API compatibilities are available by default.
- have_type(type, header, opt)
+NORETURN_STYLE_NEW ::
-Checks whether type is defined with header. Returns true if the type
-is defined.
+ Means that NORETURN macro is functional style instead of prefix.
- check_sizeof(type, header)
+HAVE_RB_DEFINE_ALLOC_FUNC ::
-Checks the size of type in char with header. Returns the size if the
-type is defined, otherwise nil.
+ Means that function rb_define_alloc_func() is provided, that means the
+ allocation framework is used. This is same as the result of
+ have_func("rb_define_alloc_func", "ruby.h").
- create_makefile(target)
+HAVE_RB_REG_NEW_STR ::
-Generates the Makefile for the extension library. If you don't invoke
-this method, the compilation will not be done.
+ Means that function rb_reg_new_str() is provided, that creates Regexp
+ object from String object. This is same as the result of
+ have_func("rb_reg_new_str", "ruby.h").
- find_executable(bin, path)
+HAVE_RB_IO_T ::
-Finds command in path, which is File::PATH_SEPARATOR-separated list of
-directories. If path is nil or omitted, environment variable PATH
-will be used. Returns the path name of the command if it is found,
-otherwise nil.
+ Means that type rb_io_t is provided.
- with_config(withval[, default=nil])
+USE_SYMBOL_AS_METHOD_NAME ::
-Parses the command line options and returns the value specified by
---with-<withval>.
+ Means that Symbols will be returned as method names, e.g.,
+ Module#methods, #singleton_methods and so on.
- enable_config(config, *defaults)
- disable_config(config, *defaults)
+HAVE_RUBY_*_H ::
-Parses the command line options for boolean. Returns true if
---enable-<config> is given, or false if --disable-<config> is given.
-Otherwise, yields defaults to the given block and returns the result
-if it is called with a block, or returns defaults.
+ Defined in ruby.h and means corresponding header is available. For
+ instance, when HAVE_RUBY_ST_H is defined you should use ruby/st.h not
+ mere st.h.
- dir_config(target[, default_dir])
- dir_config(target[, default_include, default_lib])
+RB_EVENT_HOOKS_HAVE_CALLBACK_DATA ::
-Parses the command line options and adds the directories specified by
---with-<target>-dir, --with-<target>-include, and/or --with-<target>-lib
-to $CFLAGS and/or $LDFLAGS. --with-<target>-dir=/path is equivalent to
---with-<target>-include=/path/include --with-<target>-lib=/path/lib.
-Returns an array of the added directories ([include_dir, lib_dir]).
+ Means that rb_add_event_hook() takes the third argument `data', to be
+ passed to the given event hook function.
- pkg_config(pkg)
+= Appendix C. Functions available for use in extconf.rb
-Obtains the information for pkg by pkg-config command. The actual
-command name can be overridden by --with-pkg-config command line
-option.
+See documentation for {mkmf}[rdoc-ref:MakeMakefile].
/*
* Local variables:
diff --git a/README.EXT.ja b/README.EXT.ja
index f2d7609ff5..9bba51a0d0 100644
--- a/README.EXT.ja
+++ b/README.EXT.ja
@@ -1,941 +1,963 @@
-.\" README.EXT.ja - -*- Text -*- created at: Mon Aug 7 16:45:54 JST 1995
+# README.EXT.ja - -*- RDoc -*- created at: Mon Aug 7 16:45:54 JST 1995
-Ruby¤Î³ÈÄ¥¥é¥¤¥Ö¥é¥ê¤Îºî¤êÊý¤òÀâÌÀ¤·¤Þ¤¹¡¥
+Rubyã®æ‹¡å¼µãƒ©ã‚¤ãƒ–ラリã®ä½œã‚Šæ–¹ã‚’説明ã—ã¾ã™ï¼Ž
-1¡¥´ðÁÃÃμ±
+= 基礎知識
-C¤ÎÊÑ¿ô¤Ë¤Ï·¿¤¬¤¢¤ê¡¤¥Ç¡¼¥¿¤Ë¤Ï·¿¤¬¤¢¤ê¤Þ¤»¤ó¡¥¤Ç¤¹¤«¤é¡¤¤¿
-¤È¤¨¤Ð¥Ý¥¤¥ó¥¿¤òint¤ÎÊÑ¿ô¤ËÂåÆþ¤¹¤ë¤È¡¤¤½¤ÎÃͤÏÀ°¿ô¤È¤·¤Æ¼è
-¤ê°·¤ï¤ì¤Þ¤¹¡¥µÕ¤ËRuby¤ÎÊÑ¿ô¤Ë¤Ï·¿¤¬¤Ê¤¯¡¤¥Ç¡¼¥¿¤Ë·¿¤¬¤¢¤ê¤Þ
-¤¹¡¥¤³¤Î°ã¤¤¤Î¤¿¤á¡¤C¤ÈRuby¤ÏÁê¸ß¤ËÊÑ´¹¤·¤Ê¤±¤ì¤Ð¡¤¤ª¸ß¤¤¤Î
-¥Ç¡¼¥¿¤ò¥¢¥¯¥»¥¹¤Ç¤­¤Þ¤»¤ó¡¥
+Cã®å¤‰æ•°ã«ã¯åž‹ãŒã‚り,データã«ã¯åž‹ãŒã‚りã¾ã›ã‚“.ã§ã™ã‹ã‚‰ï¼ŒãŸ
+ã¨ãˆã°ãƒã‚¤ãƒ³ã‚¿ã‚’intã®å¤‰æ•°ã«ä»£å…¥ã™ã‚‹ã¨ï¼Œãã®å€¤ã¯æ•´æ•°ã¨ã—ã¦å–
+り扱ã‚れã¾ã™ï¼Žé€†ã«Rubyã®å¤‰æ•°ã«ã¯åž‹ãŒãªã,データã«åž‹ãŒã‚りã¾
+ã™ï¼Žã“ã®é•ã„ã®ãŸã‚,Cã¨Rubyã¯ç›¸äº’ã«å¤‰æ›ã—ãªã‘れã°ï¼ŒãŠäº’ã„ã®
+データをアクセスã§ãã¾ã›ã‚“.
-Ruby¤Î¥Ç¡¼¥¿¤ÏVALUE¤È¤¤¤¦C¤Î·¿¤Çɽ¸½¤µ¤ì¤Þ¤¹¡¥VALUE·¿¤Î¥Ç¡¼
-¥¿¤Ï¤½¤Î¥Ç¡¼¥¿¥¿¥¤¥×¤ò¼«Ê¬¤ÇÃΤäƤ¤¤Þ¤¹¡¥¤³¤Î¥Ç¡¼¥¿¥¿¥¤¥×¤È
-¤¤¤¦¤Î¤Ï¥Ç¡¼¥¿(¥ª¥Ö¥¸¥§¥¯¥È)¤Î¼ÂºÝ¤Î¹½Â¤¤ò°ÕÌ£¤·¤Æ¤¤¤Æ¡¤Ruby
-¤Î¥¯¥é¥¹¤È¤Ï¤Þ¤¿°ã¤Ã¤¿¤â¤Î¤Ç¤¹¡¥
+Rubyã®ãƒ‡ãƒ¼ã‚¿ã¯VALUEã¨ã„ã†Cã®åž‹ã§è¡¨ç¾ã•れã¾ã™ï¼ŽVALUEåž‹ã®ãƒ‡ãƒ¼
+ã‚¿ã¯ãã®ãƒ‡ãƒ¼ã‚¿ã‚¿ã‚¤ãƒ—を自分ã§çŸ¥ã£ã¦ã„ã¾ã™ï¼Žã“ã®ãƒ‡ãƒ¼ã‚¿ã‚¿ã‚¤ãƒ—ã¨
+ã„ã†ã®ã¯ãƒ‡ãƒ¼ã‚¿(オブジェクト)ã®å®Ÿéš›ã®æ§‹é€ ã‚’æ„味ã—ã¦ã„ã¦ï¼ŒRuby
+ã®ã‚¯ãƒ©ã‚¹ã¨ã¯ã¾ãŸé•ã£ãŸã‚‚ã®ã§ã™ï¼Ž
-VALUE¤«¤éC¤Ë¤È¤Ã¤Æ°ÕÌ£¤Î¤¢¤ë¥Ç¡¼¥¿¤ò¼è¤ê½Ð¤¹¤¿¤á¤Ë¤Ï
+VALUEã‹ã‚‰Cã«ã¨ã£ã¦æ„味ã®ã‚るデータをå–り出ã™ãŸã‚ã«ã¯
- (1) VALUE¤Î¥Ç¡¼¥¿¥¿¥¤¥×¤òÃΤë
- (2) VALUE¤òC¤Î¥Ç¡¼¥¿¤ËÊÑ´¹¤¹¤ë
+1. VALUEã®ãƒ‡ãƒ¼ã‚¿ã‚¿ã‚¤ãƒ—を知る
+2. VALUEã‚’Cã®ãƒ‡ãƒ¼ã‚¿ã«å¤‰æ›ã™ã‚‹
-¤ÎξÊý¤¬É¬ÍפǤ¹¡¥(1)¤ò˺¤ì¤ë¤È´Ö°ã¤Ã¤¿¥Ç¡¼¥¿¤ÎÊÑ´¹¤¬¹Ô¤ï¤ì
-¤Æ¡¤ºÇ°­¥×¥í¥°¥é¥à¤¬core dump¤·¤Þ¤¹¡¥
+ã®ä¸¡æ–¹ãŒå¿…è¦ã§ã™ï¼Ž(1)を忘れるã¨é–“é•ã£ãŸãƒ‡ãƒ¼ã‚¿ã®å¤‰æ›ãŒè¡Œã‚れ
+ã¦ï¼Œæœ€æ‚ªãƒ—ログラムãŒcore dumpã—ã¾ã™ï¼Ž
-1.1 ¥Ç¡¼¥¿¥¿¥¤¥×
+== データタイプ
-Ruby¤Ë¤Ï¥æ¡¼¥¶¤¬»È¤¦²ÄǽÀ­¤Î¤¢¤ë°Ê²¼¤Î¥¿¥¤¥×¤¬¤¢¤ê¤Þ¤¹¡¥
+Rubyã«ã¯ãƒ¦ãƒ¼ã‚¶ãŒä½¿ã†å¯èƒ½æ€§ã®ã‚る以下ã®ã‚¿ã‚¤ãƒ—ãŒã‚りã¾ã™ï¼Ž
- T_NIL nil
- T_OBJECT Ä̾ï¤Î¥ª¥Ö¥¸¥§¥¯¥È
- T_CLASS ¥¯¥é¥¹
- T_MODULE ¥â¥¸¥å¡¼¥ë
- T_FLOAT ÉâÆ°¾®¿ôÅÀ¿ô
- T_STRING ʸ»úÎó
- T_REGEXP Àµµ¬É½¸½
- T_ARRAY ÇÛÎó
- T_HASH Ï¢ÁÛÇÛÎó
- T_STRUCT (Ruby¤Î)¹½Â¤ÂÎ
- T_BIGNUM ¿ÇÜĹÀ°¿ô
- T_FIXNUM Fixnum(31bit¤Þ¤¿¤Ï63bitĹÀ°¿ô)
- T_COMPLEX Ê£ÁÇ¿ô
- T_RATIONAL Í­Íý¿ô
- T_FILE Æþ½ÐÎÏ
- T_TRUE ¿¿
- T_FALSE µ¶
- T_DATA ¥Ç¡¼¥¿
- T_SYMBOL ¥·¥ó¥Ü¥ë
+T_NIL :: nil
+T_OBJECT :: 通常ã®ã‚ªãƒ–ジェクト
+T_CLASS :: クラス
+T_MODULE :: モジュール
+T_FLOAT :: æµ®å‹•å°æ•°ç‚¹æ•°
+T_STRING :: 文字列
+T_REGEXP :: æ­£è¦è¡¨ç¾
+T_ARRAY :: é…列
+T_HASH :: 連想é…列
+T_STRUCT :: (Rubyã®)構造体
+T_BIGNUM :: 多å€é•·æ•´æ•°
+T_FIXNUM :: Fixnum(31bitã¾ãŸã¯63bité•·æ•´æ•°)
+T_COMPLEX :: 複素数
+T_RATIONAL :: æœ‰ç†æ•°
+T_FILE :: 入出力
+T_TRUE :: 真
+T_FALSE :: å½
+T_DATA :: データ
+T_SYMBOL :: シンボル
-¤½¤Î¾¤ËÆâÉô¤ÇÍøÍѤµ¤ì¤Æ¤¤¤ë°Ê²¼¤Î¥¿¥¤¥×¤¬¤¢¤ê¤Þ¤¹¡¥
+ãã®ä»–ã«å†…部ã§åˆ©ç”¨ã•れã¦ã„る以下ã®ã‚¿ã‚¤ãƒ—ãŒã‚りã¾ã™ï¼Ž
- T_ICLASS
- T_MATCH
- T_UNDEF
- T_NODE
- T_ZOMBIE
+ T_ICLASS
+ T_MATCH
+ T_UNDEF
+ T_NODE
+ T_ZOMBIE
-¤Û¤È¤ó¤É¤Î¥¿¥¤¥×¤ÏC¤Î¹½Â¤ÂΤǼÂÁõ¤µ¤ì¤Æ¤¤¤Þ¤¹¡¥
+ã»ã¨ã‚“ã©ã®ã‚¿ã‚¤ãƒ—ã¯Cã®æ§‹é€ ä½“ã§å®Ÿè£…ã•れã¦ã„ã¾ã™ï¼Ž
-1.2 VALUE¤Î¥Ç¡¼¥¿¥¿¥¤¥×¤ò¥Á¥§¥Ã¥¯¤¹¤ë
+== VALUEã®ãƒ‡ãƒ¼ã‚¿ã‚¿ã‚¤ãƒ—ã‚’ãƒã‚§ãƒƒã‚¯ã™ã‚‹
-ruby.h¤Ç¤ÏTYPE()¤È¤¤¤¦¥Þ¥¯¥í¤¬ÄêµÁ¤µ¤ì¤Æ¤¤¤Æ¡¤VALUE¤Î¥Ç¡¼¥¿
-¥¿¥¤¥×¤òÃΤ뤳¤È¤¬½ÐÍè¤Þ¤¹¡¥TYPE()¥Þ¥¯¥í¤Ï¾å¤Ç¾Ò²ð¤·¤¿T_XXXX
-¤Î·Á¼°¤ÎÄê¿ô¤òÊÖ¤·¤Þ¤¹¡¥VALUE¤Î¥Ç¡¼¥¿¥¿¥¤¥×¤Ë±þ¤¸¤Æ½èÍý¤¹¤ë
-¾ì¹ç¤Ë¤Ï¡¤TYPE()¤ÎÃͤÇʬ´ô¤¹¤ë¤³¤È¤Ë¤Ê¤ê¤Þ¤¹¡¥
+ruby.hã§ã¯TYPE()ã¨ã„ã†ãƒžã‚¯ãƒ­ãŒå®šç¾©ã•れã¦ã„ã¦ï¼ŒVALUEã®ãƒ‡ãƒ¼ã‚¿
+タイプを知るã“ã¨ãŒå‡ºæ¥ã¾ã™ï¼ŽTYPE()マクロã¯ä¸Šã§ç´¹ä»‹ã—ãŸT_XXXX
+ã®å½¢å¼ã®å®šæ•°ã‚’è¿”ã—ã¾ã™ï¼ŽVALUEã®ãƒ‡ãƒ¼ã‚¿ã‚¿ã‚¤ãƒ—ã«å¿œã˜ã¦å‡¦ç†ã™ã‚‹
+å ´åˆã«ã¯ï¼ŒTYPE()ã®å€¤ã§åˆ†å²ã™ã‚‹ã“ã¨ã«ãªã‚Šã¾ã™ï¼Ž
switch (TYPE(obj)) {
case T_FIXNUM:
- /* FIXNUM¤Î½èÍý */
+ /* FIXNUMã®å‡¦ç† */
break;
case T_STRING:
- /* ʸ»úÎó¤Î½èÍý */
+ /* 文字列ã®å‡¦ç† */
break;
case T_ARRAY:
- /* ÇÛÎó¤Î½èÍý */
+ /* é…列ã®å‡¦ç† */
break;
default:
- /* Îã³°¤òȯÀ¸¤µ¤»¤ë */
+ /* 例外を発生ã•ã›ã‚‹ */
rb_raise(rb_eTypeError, "not valid value");
break;
}
-¤½¤ì¤È¥Ç¡¼¥¿¥¿¥¤¥×¤ò¥Á¥§¥Ã¥¯¤·¤Æ¡¤Àµ¤·¤¯¤Ê¤±¤ì¤ÐÎã³°¤òȯÀ¸¤¹
-¤ë´Ø¿ô¤¬ÍѰդµ¤ì¤Æ¤¤¤Þ¤¹¡¥
+ãれã¨ãƒ‡ãƒ¼ã‚¿ã‚¿ã‚¤ãƒ—ã‚’ãƒã‚§ãƒƒã‚¯ã—ã¦ï¼Œæ­£ã—ããªã‘れã°ä¾‹å¤–を発生ã™
+る関数ãŒç”¨æ„ã•れã¦ã„ã¾ã™ï¼Ž
void Check_Type(VALUE value, int type)
-¤³¤Î´Ø¿ô¤Ïvalue¤¬type¤Ç̵¤±¤ì¤Ð¡¤Îã³°¤òȯÀ¸¤µ¤»¤Þ¤¹¡¥°ú¿ô¤È
-¤·¤ÆÍ¿¤¨¤é¤ì¤¿VALUE¤Î¥Ç¡¼¥¿¥¿¥¤¥×¤¬Àµ¤·¤¤¤«¤É¤¦¤«¥Á¥§¥Ã¥¯¤¹
-¤ë¤¿¤á¤Ë¤Ï¡¤¤³¤Î´Ø¿ô¤ò»È¤¤¤Þ¤¹¡¥
+ã“ã®é–¢æ•°ã¯valueãŒtypeã§ç„¡ã‘れã°ï¼Œä¾‹å¤–を発生ã•ã›ã¾ã™ï¼Žå¼•æ•°ã¨
+ã—ã¦ä¸Žãˆã‚‰ã‚ŒãŸVALUEã®ãƒ‡ãƒ¼ã‚¿ã‚¿ã‚¤ãƒ—ãŒæ­£ã—ã„ã‹ã©ã†ã‹ãƒã‚§ãƒƒã‚¯ã™
+ã‚‹ãŸã‚ã«ã¯ï¼Œã“ã®é–¢æ•°ã‚’使ã„ã¾ã™ï¼Ž
-FIXNUM¤ÈNIL¤Ë´Ø¤·¤Æ¤Ï¤è¤ê¹â®¤ÊȽÊÌ¥Þ¥¯¥í¤¬ÍѰդµ¤ì¤Æ¤¤¤Þ¤¹¡¥
+FIXNUMã¨NILã«é–¢ã—ã¦ã¯ã‚ˆã‚Šé«˜é€Ÿãªåˆ¤åˆ¥ãƒžã‚¯ãƒ­ãŒç”¨æ„ã•れã¦ã„ã¾ã™ï¼Ž
FIXNUM_P(obj)
NIL_P(obj)
-1.3 VALUE¤òC¤Î¥Ç¡¼¥¿¤ËÊÑ´¹¤¹¤ë
-
-¥Ç¡¼¥¿¥¿¥¤¥×¤¬T_NIL¡¤T_FALSE¡¤T_TRUE¤Ç¤¢¤ë»þ¡¤¥Ç¡¼¥¿¤Ï¤½¤ì¤¾
-¤ìnil¡¤false¡¤true¤Ç¤¹¡¥¤³¤Î¥Ç¡¼¥¿¥¿¥¤¥×¤Î¥ª¥Ö¥¸¥§¥¯¥È¤Ï¤Ò¤È
-¤Ä¤º¤Ä¤·¤«Â¸ºß¤·¤Þ¤»¤ó¡¥
+== VALUEã‚’Cã®ãƒ‡ãƒ¼ã‚¿ã«å¤‰æ›ã™ã‚‹
+
+データタイプãŒT_NIL,T_FALSE,T_TRUEã§ã‚る時,データã¯ãれãž
+れnil,false,trueã§ã™ï¼Žã“ã®ãƒ‡ãƒ¼ã‚¿ã‚¿ã‚¤ãƒ—ã®ã‚ªãƒ–ジェクトã¯ã²ã¨
+ã¤ãšã¤ã—ã‹å­˜åœ¨ã—ã¾ã›ã‚“.
+
+データタイプãŒT_FIXNUMã®æ™‚,ã“れã¯31bitã¾ãŸã¯63bitã®ã‚µã‚¤ã‚ºã‚’
+æŒã¤æ•´æ•°ã§ã™ï¼Žlongã®ã‚µã‚¤ã‚ºãŒ32bitã®ãƒ—ラットフォームã§ã‚れã°
+31bitã«ï¼Œlongã®ã‚µã‚¤ã‚ºãŒ64bitã®ãƒ—ラットフォームã§ã‚れã°63bit
+ã«ãªã‚Šã¾ã™. FIXNUM ã‚’ C ã®æ•´æ•°ã«å¤‰æ›ã™ã‚‹ãŸã‚ã«ã¯ãƒžã‚¯ãƒ­
+「FIX2INT()ã€ã¾ãŸã¯ã€ŒFIX2LONG()ã€ã‚’使ã„ã¾ã™ï¼Žã“れらã®ãƒžã‚¯ãƒ­
+を使用ã™ã‚‹éš›ã«ã¯äº‹å‰ã«ãƒ‡ãƒ¼ã‚¿ã‚¿ã‚¤ãƒ—ãŒFIXNUMã§ã‚ã‚‹ã“ã¨ã‚’確èªã™
+ã‚‹å¿…è¦ãŒã‚りã¾ã™ãŒï¼Œæ¯”較的高速ã«å¤‰æ›ã‚’行ã†ã“ã¨ãŒã§ãã¾ã™ï¼Žã¾
+ãŸï¼Œã€ŒFIX2LONG()ã€ã¯ä¾‹å¤–を発生ã—ã¾ã›ã‚“ãŒï¼Œã€ŒFIX2INT()ã€ã¯å¤‰
+æ›çµæžœãŒintã®ã‚µã‚¤ã‚ºã«åŽã¾ã‚‰ãªã„å ´åˆã«ã¯ä¾‹å¤–を発生ã—ã¾ã™ï¼Ž
+ãれã‹ã‚‰ï¼ŒFIXNUMã«é™ã‚‰ãšRubyã®ãƒ‡ãƒ¼ã‚¿ã‚’æ•´æ•°ã«å¤‰æ›ã™ã‚‹
+「NUM2INT()ã€ãŠã‚ˆã³ã€ŒNUM2LONG()ã€ã¨ã„ã†ãƒžã‚¯ãƒ­ãŒã‚りã¾ã™ï¼Žã“
+れらã®ãƒžã‚¯ãƒ­ã¯ãƒžã‚¯ãƒ­ã¯ãƒ‡ãƒ¼ã‚¿ã‚¿ã‚¤ãƒ—ã®ãƒã‚§ãƒƒã‚¯ç„¡ã—ã§ä½¿ãˆã¾ã™
+(æ•´æ•°ã«å¤‰æ›ã§ããªã„å ´åˆã«ã¯ä¾‹å¤–ãŒç™ºç”Ÿã™ã‚‹)ï¼ŽåŒæ§˜ã«ãƒã‚§ãƒƒã‚¯ç„¡
+ã§ä½¿ãˆã‚‹å¤‰æ›ãƒžã‚¯ãƒ­ã¯doubleã‚’å–り出ã™ã€ŒNUM2DBL()ã€ãŒã‚りã¾ã™ï¼Ž
-¥Ç¡¼¥¿¥¿¥¤¥×¤¬T_FIXNUM¤Î»þ¡¤¤³¤ì¤Ï31bit¤Þ¤¿¤Ï63bit¤Î¥µ¥¤¥º¤ò
-»ý¤ÄÀ°¿ô¤Ç¤¹¡¥long¤Î¥µ¥¤¥º¤¬32bit¤Î¥×¥é¥Ã¥È¥Õ¥©¡¼¥à¤Ç¤¢¤ì¤Ð
-31bit¤Ë¡¤long¤Î¥µ¥¤¥º¤¬64bit¤Î¥×¥é¥Ã¥È¥Õ¥©¡¼¥à¤Ç¤¢¤ì¤Ð63bit
-¤Ë¤Ê¤ê¤Þ¤¹. FIXNUM ¤ò C ¤ÎÀ°¿ô¤ËÊÑ´¹¤¹¤ë¤¿¤á¤Ë¤Ï¥Þ¥¯¥í
-¡ÖFIX2INT()¡×¤Þ¤¿¤Ï¡ÖFIX2LONG()¡×¤ò»È¤¤¤Þ¤¹¡¥¤³¤ì¤é¤Î¥Þ¥¯¥í
-¤ò»ÈÍѤ¹¤ëºÝ¤Ë¤Ï»öÁ°¤Ë¥Ç¡¼¥¿¥¿¥¤¥×¤¬FIXNUM¤Ç¤¢¤ë¤³¤È¤ò³Îǧ¤¹
-¤ëɬÍפ¬¤¢¤ê¤Þ¤¹¤¬¡¤Èæ³ÓŪ¹â®¤ËÊÑ´¹¤ò¹Ô¤¦¤³¤È¤¬¤Ç¤­¤Þ¤¹¡¥¤Þ
-¤¿¡¤¡ÖFIX2LONG()¡×¤ÏÎã³°¤òȯÀ¸¤·¤Þ¤»¤ó¤¬¡¤¡ÖFIX2INT()¡×¤ÏÊÑ
-´¹·ë²Ì¤¬int¤Î¥µ¥¤¥º¤Ë¼ý¤Þ¤é¤Ê¤¤¾ì¹ç¤Ë¤ÏÎã³°¤òȯÀ¸¤·¤Þ¤¹¡¥
-¤½¤ì¤«¤é¡¤FIXNUM¤Ë¸Â¤é¤ºRuby¤Î¥Ç¡¼¥¿¤òÀ°¿ô¤ËÊÑ´¹¤¹¤ë
-¡ÖNUM2INT()¡×¤ª¤è¤Ó¡ÖNUM2LONG()¡×¤È¤¤¤¦¥Þ¥¯¥í¤¬¤¢¤ê¤Þ¤¹¡¥¤³
-¤ì¤é¤Î¥Þ¥¯¥í¤Ï¥Þ¥¯¥í¤Ï¥Ç¡¼¥¿¥¿¥¤¥×¤Î¥Á¥§¥Ã¥¯Ìµ¤·¤Ç»È¤¨¤Þ¤¹
-(À°¿ô¤ËÊÑ´¹¤Ç¤­¤Ê¤¤¾ì¹ç¤Ë¤ÏÎã³°¤¬È¯À¸¤¹¤ë)¡¥Æ±Íͤ˥Á¥§¥Ã¥¯Ìµ
-¤Ç»È¤¨¤ëÊÑ´¹¥Þ¥¯¥í¤Ïdouble¤ò¼è¤ê½Ð¤¹¡ÖNUM2DBL()¡×¤¬¤¢¤ê¤Þ¤¹¡¥
+char* ã‚’å–り出ã™å ´åˆï¼Œ StringValue() 㨠StringValuePtr()
+を使ã„ã¾ã™ï¼Ž
+StringValue(var) 㯠var ㌠String
+ã§ã‚れã°ä½•ã‚‚ã›ãšï¼Œãã†ã§ãªã‘れ㰠var ã‚’ var.to_str() ã®çµæžœ
+ã«ç½®ãæ›ãˆã‚‹ãƒžã‚¯ãƒ­ï¼ŒStringValuePtr(var) ã¯åŒæ§˜ã« var ã‚’
+String ã«ç½®ãæ›ãˆã¦ã‹ã‚‰ var ã®ãƒã‚¤ãƒˆåˆ—表ç¾ã«å¯¾ã™ã‚‹ char* ã‚’
+è¿”ã™ãƒžã‚¯ãƒ­ã§ã™ï¼Žvar ã®å†…å®¹ã‚’ç›´æŽ¥ç½®ãæ›ãˆã‚‹å‡¦ç†ãŒå…¥ã‚‹ã®ã§ï¼Œ
+var 㯠lvalue ã§ã‚ã‚‹å¿…è¦ãŒã‚りã¾ã™ï¼Ž
+ã¾ãŸï¼ŒStringValuePtr() ã«é¡žä¼¼ã—㟠StringValueCStr() ã¨ã„ã†ãƒž
+クロもã‚りã¾ã™ï¼ŽStringValueCStr(var) 㯠var ã‚’ String ã«ç½®ã
+æ›ãˆã¦ã‹ã‚‰ var ã®æ–‡å­—列表ç¾ã«å¯¾ã™ã‚‹ char* ã‚’è¿”ã—ã¾ã™ï¼Žè¿”ã•れ
+ã‚‹æ–‡å­—åˆ—ã®æœ«å°¾ã«ã¯ nul 文字ãŒä»˜åŠ ã•れã¾ã™ï¼ŽãªãŠï¼Œé€”中㫠nul
+文字ãŒå«ã¾ã‚Œã‚‹å ´åˆã¯ ArgumentError ãŒç™ºç”Ÿã—ã¾ã™ï¼Ž
+一方,StringValuePtr() ã§ã¯ï¼Œæœ«å°¾ã« nul 文字ãŒã‚ã‚‹ä¿è¨¼ã¯ãªã,
+途中㫠nul 文字ãŒå«ã¾ã‚Œã¦ã„ã‚‹å¯èƒ½æ€§ã‚‚ã‚りã¾ã™ï¼Ž
-char* ¤ò¼è¤ê½Ð¤¹¾ì¹ç¡¤ StringValue() ¤È StringValuePtr()
-¤ò»È¤¤¤Þ¤¹¡¥
-StringValue(var) ¤Ï var ¤¬ String
-¤Ç¤¢¤ì¤Ð²¿¤â¤»¤º¡¤¤½¤¦¤Ç¤Ê¤±¤ì¤Ð var ¤ò var.to_str() ¤Î·ë²Ì
-¤ËÃÖ¤­´¹¤¨¤ë¥Þ¥¯¥í¡¤StringValuePtr(var) ¤ÏƱÍÍ¤Ë var ¤ò
-String ¤ËÃÖ¤­´¹¤¨¤Æ¤«¤é var ¤Î¥Ð¥¤¥ÈÎóɽ¸½¤ËÂФ¹¤ë char* ¤ò
-ÊÖ¤¹¥Þ¥¯¥í¤Ç¤¹¡¥var ¤ÎÆâÍÆ¤òľÀÜÃÖ¤­´¹¤¨¤ë½èÍý¤¬Æþ¤ë¤Î¤Ç¡¤
-var ¤Ï lvalue ¤Ç¤¢¤ëɬÍפ¬¤¢¤ê¤Þ¤¹¡¥
-¤Þ¤¿¡¤StringValuePtr() ¤ËÎà»÷¤·¤¿ StringValueCStr() ¤È¤¤¤¦¥Þ
-¥¯¥í¤â¤¢¤ê¤Þ¤¹¡¥StringValueCStr(var) ¤Ï var ¤ò String ¤ËÃÖ¤­
-´¹¤¨¤Æ¤«¤é var ¤Îʸ»úÎóɽ¸½¤ËÂФ¹¤ë char* ¤òÊÖ¤·¤Þ¤¹¡¥ÊÖ¤µ¤ì
-¤ëʸ»úÎó¤ÎËöÈø¤Ë¤Ï nul ʸ»ú¤¬Éղ䵤ì¤Þ¤¹¡¥¤Ê¤ª¡¤ÅÓÃæ¤Ë nul
-ʸ»ú¤¬´Þ¤Þ¤ì¤ë¾ì¹ç¤Ï ArgumentError ¤¬È¯À¸¤·¤Þ¤¹¡¥
-°ìÊý¡¤StringValuePtr() ¤Ç¤Ï¡¤ËöÈø¤Ë nul ʸ»ú¤¬¤¢¤ëÊݾڤϤʤ¯¡¤
-ÅÓÃæ¤Ë nul ʸ»ú¤¬´Þ¤Þ¤ì¤Æ¤¤¤ë²ÄǽÀ­¤â¤¢¤ê¤Þ¤¹¡¥
+ãれ以外ã®ãƒ‡ãƒ¼ã‚¿ã‚¿ã‚¤ãƒ—ã¯å¯¾å¿œã™ã‚‹Cã®æ§‹é€ ä½“ãŒã‚りã¾ã™ï¼Žå¯¾å¿œã™
+る構造体ã®ã‚ã‚‹VALUEã¯ãã®ã¾ã¾ã‚­ãƒ£ã‚¹ãƒˆ(型変æ›)ã™ã‚Œã°æ§‹é€ ä½“ã®
+ãƒã‚¤ãƒ³ã‚¿ã«å¤‰æ›ã§ãã¾ã™ï¼Ž
-¤½¤ì°Ê³°¤Î¥Ç¡¼¥¿¥¿¥¤¥×¤ÏÂбþ¤¹¤ëC¤Î¹½Â¤ÂΤ¬¤¢¤ê¤Þ¤¹¡¥Âбþ¤¹
-¤ë¹½Â¤ÂΤΤ¢¤ëVALUE¤Ï¤½¤Î¤Þ¤Þ¥­¥ã¥¹¥È(·¿ÊÑ´¹)¤¹¤ì¤Ð¹½Â¤ÂΤÎ
-¥Ý¥¤¥ó¥¿¤ËÊÑ´¹¤Ç¤­¤Þ¤¹¡¥
+構造体ã¯ã€Œstruct RXxxxxã€ã¨ã„ã†åå‰ã§ruby.hã§å®šç¾©ã•れã¦ã„ã¾
+ã™ï¼Žä¾‹ãˆã°æ–‡å­—列ã¯ã€Œstruct RStringã€ã§ã™ï¼Žå®Ÿéš›ã«ä½¿ã†å¯èƒ½æ€§ãŒ
+ã‚ã‚‹ã®ã¯æ–‡å­—列ã¨é…列ãらã„ã ã¨æ€ã„ã¾ã™ï¼Ž
-¹½Â¤ÂΤϡÖstruct RXxxxx¡×¤È¤¤¤¦Ì¾Á°¤Çruby.h¤ÇÄêµÁ¤µ¤ì¤Æ¤¤¤Þ
-¤¹¡¥Î㤨¤Ðʸ»úÎó¤Ï¡Östruct RString¡×¤Ç¤¹¡¥¼ÂºÝ¤Ë»È¤¦²ÄǽÀ­¤¬
-¤¢¤ë¤Î¤Ïʸ»úÎó¤ÈÇÛÎ󤯤餤¤À¤È»×¤¤¤Þ¤¹¡¥
+ruby.hã§ã¯æ§‹é€ ä½“ã¸ã‚­ãƒ£ã‚¹ãƒˆã™ã‚‹ãƒžã‚¯ãƒ­ã‚‚「RXXXXX()ã€(全部大文
+å­—ã«ã—ãŸã‚‚ã®)ã¨ã„ã†åå‰ã§æä¾›ã•れã¦ã„ã¾ã™(例: RSTRING()).ãŸ
+ã ã—ã€æ§‹é€ ä½“ã¸ã®ç›´æŽ¥ã®ã‚¢ã‚¯ã‚»ã‚¹ã¯ã§ãã‚‹ã ã‘é¿ã‘,対応ã™ã‚‹
+rb_xxxx() ã¨ã„ã£ãŸé–¢æ•°ã‚’使ã†ã‚ˆã†ã«ã—ã¦ä¸‹ã•ã„.例ãˆã°ï¼Œé…列ã®
+è¦ç´ ã¸ã‚¢ã‚¯ã‚»ã‚¹ã™ã‚‹å ´åˆã¯ï¼Œrb_ary_entry(ary, offset),
+rb_ary_store(ary, offset, obj) を利用ã™ã‚‹ã‚ˆã†ã«ã—ã¦ä¸‹ã•ã„.
-ruby.h¤Ç¤Ï¹½Â¤ÂΤإ­¥ã¥¹¥È¤¹¤ë¥Þ¥¯¥í¤â¡ÖRXXXXX()¡×(Á´ÉôÂçʸ
-»ú¤Ë¤·¤¿¤â¤Î)¤È¤¤¤¦Ì¾Á°¤ÇÄ󶡤µ¤ì¤Æ¤¤¤Þ¤¹(Îã: RSTRING())¡¥
+構造体ã‹ã‚‰ãƒ‡ãƒ¼ã‚¿ã‚’å–り出ã™ãƒžã‚¯ãƒ­ãŒæä¾›ã•れã¦ã„ã¾ã™ï¼Žæ–‡å­—列
+strã®é•·ã•ã‚’å¾—ã‚‹ãŸã‚ã«ã¯ã€ŒRSTRING_LEN(str)ã€ã¨ã—,文字列strã‚’
+char*ã¨ã—ã¦å¾—ã‚‹ãŸã‚ã«ã¯ã€ŒRSTRING_PTR(str)ã€ã¨ã—ã¾ã™ï¼Ž
-¹½Â¤ÂΤ«¤é¥Ç¡¼¥¿¤ò¼è¤ê½Ð¤¹¥Þ¥¯¥í¤¬Ä󶡤µ¤ì¤Æ¤¤¤Þ¤¹¡¥Ê¸»úÎó
-str¤ÎŤµ¤òÆÀ¤ë¤¿¤á¤Ë¤Ï¡ÖRSTRING_LEN(str)¡×¤È¤·¡¤Ê¸»úÎóstr¤ò
-char*¤È¤·¤ÆÆÀ¤ë¤¿¤á¤Ë¤Ï¡ÖRSTRING_PTR(str)¡×¤È¤·¤Þ¤¹¡¥ÇÛÎó¤Î
-¾ì¹ç¤Ë¤Ï¡¤¤½¤ì¤¾¤ì¡ÖRARRAY_LEN(ary)¡×¡¤¡ÖRARRAY_PTR(ary)¡×¤È
-¤Ê¤ê¤Þ¤¹¡¥
+Rubyã®æ§‹é€ ä½“を直接アクセスã™ã‚‹æ™‚ã«æ°—ã‚’ã¤ã‘ãªã‘れã°ãªã‚‰ãªã„ã“
+ã¨ã¯ï¼Œé…åˆ—ã‚„æ–‡å­—åˆ—ã®æ§‹é€ ä½“ã®ä¸­èº«ã¯å‚ç…§ã™ã‚‹ã ã‘ã§ï¼Œç›´æŽ¥å¤‰æ›´ã—
+ãªã„ã“ã¨ã§ã™ï¼Žç›´æŽ¥å¤‰æ›´ã—ãŸå ´åˆï¼Œã‚ªãƒ–ジェクトã®å†…å®¹ã®æ•´åˆæ€§ãŒ
+ã¨ã‚Œãªããªã£ã¦ï¼Œæ€ã‚ã¬ãƒã‚°ã®åŽŸå› ã«ãªã‚Šã¾ã™ï¼Ž
-Ruby¤Î¹½Â¤ÂΤòľÀÜ¥¢¥¯¥»¥¹¤¹¤ë»þ¤Ëµ¤¤ò¤Ä¤±¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¤³
-¤È¤Ï¡¤ÇÛÎó¤äʸ»úÎó¤Î¹½Â¤ÂΤÎÃæ¿È¤Ï»²¾È¤¹¤ë¤À¤±¤Ç¡¤Ä¾ÀÜÊѹ¹¤·
-¤Ê¤¤¤³¤È¤Ç¤¹¡¥Ä¾ÀÜÊѹ¹¤·¤¿¾ì¹ç¡¤¥ª¥Ö¥¸¥§¥¯¥È¤ÎÆâÍÆ¤ÎÀ°¹çÀ­¤¬
-¤È¤ì¤Ê¤¯¤Ê¤Ã¤Æ¡¤»×¤ï¤Ì¥Ð¥°¤Î¸¶°ø¤Ë¤Ê¤ê¤Þ¤¹¡¥
+== Cã®ãƒ‡ãƒ¼ã‚¿ã‚’VALUEã«å¤‰æ›ã™ã‚‹
-1.4 C¤Î¥Ç¡¼¥¿¤òVALUE¤ËÊÑ´¹¤¹¤ë
+VALUEã®å®Ÿéš›ã®æ§‹é€ ã¯
-VALUE¤Î¼ÂºÝ¤Î¹½Â¤¤Ï
+FIXNUMã®å ´åˆ ::
- * FIXNUM¤Î¾ì¹ç
+ 1bit左シフトã—ã¦ï¼ŒLSBã‚’ç«‹ã¦ã‚‹ï¼Ž
- 1bitº¸¥·¥Õ¥È¤·¤Æ¡¤LSB¤òΩ¤Æ¤ë¡¥
+ãã®ä»–ã®ãƒã‚¤ãƒ³ã‚¿ã®å ´åˆ ::
- * ¤½¤Î¾¤Î¥Ý¥¤¥ó¥¿¤Î¾ì¹ç
+ ãã®ã¾ã¾VALUEã«ã‚­ãƒ£ã‚¹ãƒˆã™ã‚‹ï¼Ž
- ¤½¤Î¤Þ¤ÞVALUE¤Ë¥­¥ã¥¹¥È¤¹¤ë¡¥
+ã¨ãªã£ã¦ã„ã¾ã™ï¼Žã‚ˆã£ã¦ï¼ŒLSBã‚’ãƒã‚§ãƒƒã‚¯ã™ã‚Œã°VALUEãŒFIXNUMã‹ã©
+ã†ã‹ã‚ã‹ã‚‹ã‚ã‘ã§ã™(ãƒã‚¤ãƒ³ã‚¿ã®LSBãŒç«‹ã£ã¦ã„ãªã„ã“ã¨ã‚’仮定ã—ã¦
+ã„ã‚‹).
-¤È¤Ê¤Ã¤Æ¤¤¤Þ¤¹¡¥¤è¤Ã¤Æ¡¤LSB¤ò¥Á¥§¥Ã¥¯¤¹¤ì¤ÐVALUE¤¬FIXNUM¤«¤É
-¤¦¤«¤ï¤«¤ë¤ï¤±¤Ç¤¹(¥Ý¥¤¥ó¥¿¤ÎLSB¤¬Î©¤Ã¤Æ¤¤¤Ê¤¤¤³¤È¤ò²¾Äꤷ¤Æ
-¤¤¤ë)¡¥
+ã§ã™ã‹ã‚‰ï¼ŒFIXNUM以外ã®Rubyã®ã‚ªãƒ–ã‚¸ã‚§ã‚¯ãƒˆã®æ§‹é€ ä½“ã¯å˜ã«VALUE
+ã«ã‚­ãƒ£ã‚¹ãƒˆã™ã‚‹ã ã‘ã§VALUEã«å¤‰æ›å‡ºæ¥ã¾ã™ï¼ŽãŸã ã—,任æ„ã®æ§‹é€ 
+体ãŒVALUEã«ã‚­ãƒ£ã‚¹ãƒˆå‡ºæ¥ã‚‹ã‚ã‘ã§ã¯ã‚りã¾ã›ã‚“.キャストã™ã‚‹ã®
+ã¯Rubyã®çŸ¥ã£ã¦ã„る構造体(ruby.hã§å®šç¾©ã•れã¦ã„ã‚‹struct RXxxx
+ã®ã‚‚ã®)ã ã‘ã§ã™ï¼Ž
-¤Ç¤¹¤«¤é¡¤FIXNUM°Ê³°¤ÎRuby¤Î¥ª¥Ö¥¸¥§¥¯¥È¤Î¹½Â¤ÂΤÏñ¤ËVALUE
-¤Ë¥­¥ã¥¹¥È¤¹¤ë¤À¤±¤ÇVALUE¤ËÊÑ´¹½ÐÍè¤Þ¤¹¡¥¤¿¤À¤·¡¤Ç¤°Õ¤Î¹½Â¤
-ÂΤ¬VALUE¤Ë¥­¥ã¥¹¥È½ÐÍè¤ë¤ï¤±¤Ç¤Ï¤¢¤ê¤Þ¤»¤ó¡¥¥­¥ã¥¹¥È¤¹¤ë¤Î
-¤ÏRuby¤ÎÃΤäƤ¤¤ë¹½Â¤ÂÎ(ruby.h¤ÇÄêµÁ¤µ¤ì¤Æ¤¤¤ëstruct RXxxx
-¤Î¤â¤Î)¤À¤±¤Ç¤¹¡¥
+FIXNUMã«é–¢ã—ã¦ã¯å¤‰æ›ãƒžã‚¯ãƒ­ã‚’経由ã™ã‚‹å¿…è¦ãŒã‚りã¾ã™ï¼ŽCã®æ•´æ•°
+ã‹ã‚‰VALUEã«å¤‰æ›ã™ã‚‹ãƒžã‚¯ãƒ­ã¯ä»¥ä¸‹ã®ã‚‚ã®ãŒã‚りã¾ã™ï¼Žå¿…è¦ã«å¿œã˜
+ã¦ä½¿ã„分ã‘ã¦ãã ã•ã„.
-FIXNUM¤Ë´Ø¤·¤Æ¤ÏÊÑ´¹¥Þ¥¯¥í¤ò·Ðͳ¤¹¤ëɬÍפ¬¤¢¤ê¤Þ¤¹¡¥C¤ÎÀ°¿ô
-¤«¤éVALUE¤ËÊÑ´¹¤¹¤ë¥Þ¥¯¥í¤Ï°Ê²¼¤Î¤â¤Î¤¬¤¢¤ê¤Þ¤¹¡¥É¬Íפ˱þ¤¸
-¤Æ»È¤¤Ê¬¤±¤Æ¤¯¤À¤µ¤¤¡¥
+INT2FIX() :: ã‚‚ã¨ã®æ•´æ•°ãŒ31bitã¾ãŸã¯63bit以内ã«åŽã¾ã‚‹è‡ªä¿¡
+ ãŒã‚る時
+INT2NUM() :: ä»»æ„ã®æ•´æ•°ã‹ã‚‰VALUEã¸
- INT2FIX() ¤â¤È¤ÎÀ°¿ô¤¬31bit¤Þ¤¿¤Ï63bit°ÊÆâ¤Ë¼ý¤Þ¤ë¼«¿®
- ¤¬¤¢¤ë»þ
- INT2NUM() Ǥ°Õ¤ÎÀ°¿ô¤«¤éVALUE¤Ø
+INT2NUM()ã¯æ•´æ•°ãŒFIXNUMã®ç¯„囲ã«åŽã¾ã‚‰ãªã„å ´åˆï¼ŒBignumã«å¤‰æ›
+ã—ã¦ãれã¾ã™(ãŒï¼Œå°‘ã—é…ã„).
-INT2NUM()¤ÏÀ°¿ô¤¬FIXNUM¤ÎÈϰϤ˼ý¤Þ¤é¤Ê¤¤¾ì¹ç¡¤Bignum¤ËÊÑ´¹
-¤·¤Æ¤¯¤ì¤Þ¤¹(¤¬¡¤¾¯¤·ÃÙ¤¤)¡¥
+== Rubyã®ãƒ‡ãƒ¼ã‚¿ã‚’æ“作ã™ã‚‹
-1.5 Ruby¤Î¥Ç¡¼¥¿¤òÁàºî¤¹¤ë
+先程も述ã¹ãŸé€šã‚Šï¼ŒRubyã®æ§‹é€ ä½“をアクセスã™ã‚‹æ™‚ã«å†…å®¹ã®æ›´æ–°ã‚’
+行ã†ã“ã¨ã¯å‹§ã‚られã¾ã›ã‚“.ã§ï¼ŒRubyã®ãƒ‡ãƒ¼ã‚¿ã‚’æ“作ã™ã‚‹æ™‚ã«ã¯
+RubyãŒç”¨æ„ã—ã¦ã„る関数を用ã„ã¦ãã ã•ã„.
-ÀèÄø¤â½Ò¤Ù¤¿Ä̤ꡤRuby¤Î¹½Â¤ÂΤò¥¢¥¯¥»¥¹¤¹¤ë»þ¤ËÆâÍÆ¤Î¹¹¿·¤ò
-¹Ô¤¦¤³¤È¤Ï´«¤á¤é¤ì¤Þ¤»¤ó¡¥¤Ç¡¤Ruby¤Î¥Ç¡¼¥¿¤òÁàºî¤¹¤ë»þ¤Ë¤Ï
-Ruby¤¬ÍѰդ·¤Æ¤¤¤ë´Ø¿ô¤òÍѤ¤¤Æ¤¯¤À¤µ¤¤¡¥
+ã“ã“ã§ã¯ã‚‚ã£ã¨ã‚‚使ã‚れるã§ã‚ã‚ã†æ–‡å­—列ã¨é…列ã®ç”Ÿæˆ/æ“作を行
+ã†é–¢æ•°ã‚’ã‚ã’ã¾ã™(全部ã§ã¯ãªã„ã§ã™).
-¤³¤³¤Ç¤Ï¤â¤Ã¤È¤â»È¤ï¤ì¤ë¤Ç¤¢¤í¤¦Ê¸»úÎó¤ÈÇÛÎó¤ÎÀ¸À®/Áàºî¤ò¹Ô
-¤¤´Ø¿ô¤ò¤¢¤²¤Þ¤¹(Á´Éô¤Ç¤Ï¤Ê¤¤¤Ç¤¹)¡¥
+=== 文字列ã«å¯¾ã™ã‚‹é–¢æ•°
- ʸ»úÎó¤ËÂФ¹¤ë´Ø¿ô
+rb_str_new(const char *ptr, long len) ::
- rb_str_new(const char *ptr, long len)
+ æ–°ã—ã„Rubyã®æ–‡å­—列を生æˆã™ã‚‹ï¼Ž
- ¿·¤·¤¤Ruby¤Îʸ»úÎó¤òÀ¸À®¤¹¤ë¡¥
+rb_str_new2(const char *ptr)
+rb_str_new_cstr(const char *ptr)
- rb_str_new2(const char *ptr)
- rb_str_new_cstr(const char *ptr)
+ Cã®æ–‡å­—列ã‹ã‚‰Rubyã®æ–‡å­—列を生æˆã™ã‚‹ï¼Žã“ã®é–¢æ•°ã®æ©Ÿèƒ½ã¯
+ rb_str_new(ptr, strlen(ptr))ã¨åŒç­‰ã§ã‚る.
- C¤Îʸ»úÎ󤫤éRuby¤Îʸ»úÎó¤òÀ¸À®¤¹¤ë¡¥¤³¤Î´Ø¿ô¤Îµ¡Ç½¤Ï
- rb_str_new(ptr, strlen(ptr))¤ÈƱÅù¤Ç¤¢¤ë¡¥
+rb_tainted_str_new(const char *ptr, long len)
- rb_tainted_str_new(const char *ptr, long len)
+ 汚染マークãŒä»˜åŠ ã•ã‚ŒãŸæ–°ã—ã„Rubyã®æ–‡å­—列を生æˆã™ã‚‹ï¼Žå¤–部
+ ã‹ã‚‰ã®ãƒ‡ãƒ¼ã‚¿ã«åŸºã¥ã文字列ã«ã¯æ±šæŸ“マークãŒä»˜åŠ ã•れるã¹ã
+ ã§ã‚る.
- ±øÀ÷¥Þ¡¼¥¯¤¬Éղ䵤줿¿·¤·¤¤Ruby¤Îʸ»úÎó¤òÀ¸À®¤¹¤ë¡¥³°Éô
- ¤«¤é¤Î¥Ç¡¼¥¿¤Ë´ð¤Å¤¯Ê¸»úÎó¤Ë¤Ï±øÀ÷¥Þ¡¼¥¯¤¬Éղ䵤ì¤ë¤Ù¤­
- ¤Ç¤¢¤ë¡¥
+rb_tainted_str_new2(const char *ptr)
+rb_tainted_str_new_cstr(const char *ptr)
- rb_tainted_str_new2(const char *ptr)
- rb_tainted_str_new_cstr(const char *ptr)
+ Cã®æ–‡å­—列ã‹ã‚‰æ±šæŸ“マークãŒä»˜åŠ ã•れãŸRubyã®æ–‡å­—列を生æˆã™ã‚‹ï¼Ž
- C¤Îʸ»úÎ󤫤鱸À÷¥Þ¡¼¥¯¤¬Éղ䵤줿Ruby¤Îʸ»úÎó¤òÀ¸À®¤¹¤ë¡¥
+rb_sprintf(const char *format, ...)
+rb_vsprintf(const char *format, va_list ap)
- rb_sprintf(const char *format, ...)
- rb_vsprintf(const char *format, va_list ap)
+ Cã®æ–‡å­—列formatã¨ç¶šã引数をprintf(3)ã®ãƒ•ォーマットã«ã—ãŸãŒã£ã¦
+ æ•´å½¢ã—,Rubyã®æ–‡å­—列を生æˆã™ã‚‹ï¼Ž
- C¤Îʸ»úÎóformat¤È³¤¯°ú¿ô¤òprintf(3)¤Î¥Õ¥©¡¼¥Þ¥Ã¥È¤Ë¤·¤¿¤¬¤Ã¤Æ
- À°·Á¤·¡¤Ruby¤Îʸ»úÎó¤òÀ¸À®¤¹¤ë¡¥
+ 注æ„: %iã¯Object#to_s('+'ãƒ•ãƒ©ã‚°ãŒæŒ‡å®šã•れã¦ã„ã‚‹ã¨ãã¯Object#inspect)ã‚’
+ 使ã£ãŸVALUEã®å‡ºåŠ›ã«ä½¿ç”¨ã•れã¦ã„ã‚‹ãŸã‚,整数ã«ã¯%dを使用ã™ã‚‹ã“ã¨ï¼Ž
- rb_str_cat(VALUE str, const char *ptr, long len)
+rb_str_cat(VALUE str, const char *ptr, long len)
- Ruby¤Îʸ»úÎóstr¤Ëlen¥Ð¥¤¥È¤Îʸ»úÎóptr¤òÄɲ乤롥
+ Rubyã®æ–‡å­—列strã«lenãƒã‚¤ãƒˆã®æ–‡å­—列ptrを追加ã™ã‚‹ï¼Ž
- rb_str_cat2(VALUE str, const char* ptr)
+rb_str_cat2(VALUE str, const char* ptr)
- Ruby¤Îʸ»úÎóstr¤ËC¤Îʸ»úÎóptr¤òÄɲ乤롥¤³¤Î´Ø¿ô¤Îµ¡Ç½¤Ï
- rb_str_cat(str, ptr, strlen(ptr))¤ÈƱÅù¤Ç¤¢¤ë¡¥
+ Rubyã®æ–‡å­—列strã«Cã®æ–‡å­—列ptrを追加ã™ã‚‹ï¼Žã“ã®é–¢æ•°ã®æ©Ÿèƒ½ã¯
+ rb_str_cat(str, ptr, strlen(ptr))ã¨åŒç­‰ã§ã‚る.
- rb_str_catf(VALUE str, const char* format, ...)
- rb_str_vcatf(VALUE str, const char* format, va_list ap)
+rb_str_catf(VALUE str, const char* format, ...)
+rb_str_vcatf(VALUE str, const char* format, va_list ap)
- C¤Îʸ»úÎóformat¤È³¤¯°ú¿ô¤òprintf(3)¤Î¥Õ¥©¡¼¥Þ¥Ã¥È¤Ë¤·¤¿¤¬¤Ã¤Æ
- À°·Á¤·¡¤Ruby¤Îʸ»úÎóstr¤ËÄɲ乤롥¤³¤Î´Ø¿ô¤Îµ¡Ç½¤Ï¡¤¤½¤ì¤¾¤ì
- rb_str_cat2(str, rb_sprintf(format, ...)) ¤ä
- rb_str_cat2(str, rb_vsprintf(format, ap)) ¤ÈƱÅù¤Ç¤¢¤ë¡¥
+ Cã®æ–‡å­—列formatã¨ç¶šã引数をprintf(3)ã®ãƒ•ォーマットã«ã—ãŸãŒã£ã¦
+ æ•´å½¢ã—,Rubyã®æ–‡å­—列strã«è¿½åŠ ã™ã‚‹ï¼Žã“ã®é–¢æ•°ã®æ©Ÿèƒ½ã¯ï¼Œãれãžã‚Œ
+ rb_str_cat2(str, rb_sprintf(format, ...)) ã‚„
+ rb_str_cat2(str, rb_vsprintf(format, ap)) ã¨åŒç­‰ã§ã‚る.
- rb_enc_str_new(const char *ptr, long len, rb_encoding *enc)
-
- »ØÄꤵ¤ì¤¿¥¨¥ó¥³¡¼¥Ç¥£¥ó¥°¤ÇRuby¤Îʸ»úÎó¤òÀ¸À®¤¹¤ë.
-
- rb_usascii_str_new(const char *ptr, long len)
- rb_usascii_str_new_cstr(const char *ptr)
+rb_enc_str_new(const char *ptr, long len, rb_encoding *enc)
+rb_enc_str_new_cstr(const char *ptr, rb_encoding *enc)
- ¥¨¥ó¥³¡¼¥Ç¥£¥ó¥°¤¬US-ASCII¤ÎRuby¤Îʸ»úÎó¤òÀ¸À®¤¹¤ë.
+ 指定ã•れãŸã‚¨ãƒ³ã‚³ãƒ¼ãƒ‡ã‚£ãƒ³ã‚°ã§Rubyã®æ–‡å­—列を生æˆã™ã‚‹.
- rb_str_resize(VALUE str, long len)
+rb_usascii_str_new(const char *ptr, long len)
+rb_usascii_str_new_cstr(const char *ptr)
- Ruby¤Îʸ»úÎó¤Î¥µ¥¤¥º¤òlen¥Ð¥¤¥È¤ËÊѹ¹¤¹¤ë¡¥str¤ÎŤµ¤ÏÁ°
- °Ê¤Æ¥»¥Ã¥È¤µ¤ì¤Æ¤¤¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡¥len¤¬¸µ¤ÎŤµ¤è¤ê¤âû
- ¤¤»þ¤Ï¡¤len¥Ð¥¤¥È¤ò±Û¤¨¤¿Éôʬ¤ÎÆâÍÆ¤Ï¼Î¤Æ¤é¤ì¤ë¡¥len¤¬¸µ
- ¤ÎŤµ¤è¤ê¤âŤ¤»þ¤Ï¡¤¸µ¤ÎŤµ¤ò±Û¤¨¤¿Éôʬ¤ÎÆâÍÆ¤ÏÊݸ¤µ
- ¤ì¤Ê¤¤¤Ç¥´¥ß¤Ë¤Ê¤ë¤À¤í¤¦¡¥¤³¤Î´Ø¿ô¤Î¸Æ¤Ó½Ð¤·¤Ë¤è¤Ã¤Æ
- RSTRING_PTR(str)¤¬Êѹ¹¤µ¤ì¤ë¤«¤â¤·¤ì¤Ê¤¤¤³¤È¤ËÃí°Õ¡¥
+ エンコーディングãŒUS-ASCIIã®Rubyã®æ–‡å­—列を生æˆã™ã‚‹.
- rb_str_set_len(VALUE str, long len)
+rb_str_resize(VALUE str, long len)
- Ruby¤Îʸ»úÎó¤Î¥µ¥¤¥º¤òlen¥Ð¥¤¥È¤Ë¥»¥Ã¥È¤¹¤ë¡¥str¤¬Êѹ¹²Ä
- ǽ¤Ç¤Ê¤±¤ì¤ÐÎã³°¤¬È¯À¸¤¹¤ë¡¥RSTRING_LEN(str)¤È¤Ï̵´Ø·¸¤Ë¡¤
- len¥Ð¥¤¥È¤Þ¤Ç¤ÎÆâÍÆ¤ÏÊݸ¤µ¤ì¤ë¡¥len¤Ïstr¤ÎÍÆÎ̤ò±Û¤¨¤Æ¤¤
- ¤Æ¤Ï¤Ê¤é¤Ê¤¤¡¥
+ Rubyã®æ–‡å­—列ã®ã‚µã‚¤ã‚ºã‚’lenãƒã‚¤ãƒˆã«å¤‰æ›´ã™ã‚‹ï¼Žstrã®é•·ã•ã¯å‰
+ 以ã¦ã‚»ãƒƒãƒˆã•れã¦ã„ãªã‘れã°ãªã‚‰ãªã„.lenãŒå…ƒã®é•·ã•よりも短
+ ã„æ™‚ã¯ï¼Œlenãƒã‚¤ãƒˆã‚’è¶ŠãˆãŸéƒ¨åˆ†ã®å†…å®¹ã¯æ¨ã¦ã‚‰ã‚Œã‚‹ï¼ŽlenãŒå…ƒ
+ ã®é•·ã•ã‚ˆã‚Šã‚‚é•·ã„æ™‚ã¯ï¼Œå…ƒã®é•·ã•ã‚’è¶ŠãˆãŸéƒ¨åˆ†ã®å†…容ã¯ä¿å­˜ã•
+ れãªã„ã§ã‚´ãƒŸã«ãªã‚‹ã ã‚ã†ï¼Žã“ã®é–¢æ•°ã®å‘¼ã³å‡ºã—ã«ã‚ˆã£ã¦
+ RSTRING_PTR(str)ãŒå¤‰æ›´ã•れるã‹ã‚‚ã—れãªã„ã“ã¨ã«æ³¨æ„.
+rb_str_set_len(VALUE str, long len)
- ÇÛÎó¤ËÂФ¹¤ë´Ø¿ô
+ Rubyã®æ–‡å­—列ã®ã‚µã‚¤ã‚ºã‚’lenãƒã‚¤ãƒˆã«ã‚»ãƒƒãƒˆã™ã‚‹ï¼ŽstrãŒå¤‰æ›´å¯
+ 能ã§ãªã‘れã°ä¾‹å¤–ãŒç™ºç”Ÿã™ã‚‹ï¼ŽRSTRING_LEN(str)ã¨ã¯ç„¡é–¢ä¿‚ã«ï¼Œ
+ lenãƒã‚¤ãƒˆã¾ã§ã®å†…容ã¯ä¿å­˜ã•れる.lenã¯strã®å®¹é‡ã‚’è¶Šãˆã¦ã„
+ ã¦ã¯ãªã‚‰ãªã„.
- rb_ary_new()
- Í×ÁǤ¬0¤ÎÇÛÎó¤òÀ¸À®¤¹¤ë¡¥
+== é…列ã«å¯¾ã™ã‚‹é–¢æ•°
- rb_ary_new2(long len)
+rb_ary_new()
- Í×ÁǤ¬0¤ÎÇÛÎó¤òÀ¸À®¤¹¤ë¡¥lenÍ×ÁÇʬ¤ÎÎΰè¤ò¤¢¤é¤«¤¸¤á³ä¤ê
- Åö¤Æ¤Æ¤ª¤¯¡¥
+ è¦ç´ ãŒ0ã®é…列を生æˆã™ã‚‹ï¼Ž
- rb_ary_new3(long n, ...)
+rb_ary_new2(long len)
+rb_ary_new_capa(long len)
- °ú¿ô¤Ç»ØÄꤷ¤¿nÍ×ÁǤò´Þ¤àÇÛÎó¤òÀ¸À®¤¹¤ë¡¥
+ è¦ç´ ãŒ0ã®é…列を生æˆã™ã‚‹ï¼Žlenè¦ç´ åˆ†ã®é ˜åŸŸã‚’ã‚らã‹ã˜ã‚割り
+ 当ã¦ã¦ãŠã.
- rb_ary_new4(long n, VALUE *elts)
+rb_ary_new3(long n, ...)
+rb_ary_new_from_args(long n, ...)
- ÇÛÎó¤ÇÍ¿¤¨¤¿nÍ×ÁǤÎÇÛÎó¤òÀ¸À®¤¹¤ë¡¥
+ å¼•æ•°ã§æŒ‡å®šã—ãŸnè¦ç´ ã‚’å«ã‚€é…列を生æˆã™ã‚‹ï¼Ž
- rb_ary_to_ary(VALUE obj)
+rb_ary_new4(long n, VALUE *elts)
+rb_ary_new_from_values(long n, VALUE *elts)
- ¥ª¥Ö¥¸¥§¥¯¥È¤òÇÛÎó¤ËÊÑ´¹¤¹¤ë.
- Object#to_ary¤ÈƱÅù¤Ç¤¢¤ë.
+ é…列ã§ä¸ŽãˆãŸnè¦ç´ ã®é…列を生æˆã™ã‚‹ï¼Ž
- ¾¤Ë¤âÇÛÎó¤òÁàºî¤¹¤ë´Ø¿ô¤¬Â¿¿ô¤¢¤ë. ¤³¤ì¤é¤Ï
- °ú¿ôary¤ËÇÛÎó¤òÅϤµ¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤. ¤µ¤â¤Ê¤¤¤È
- ¥³¥¢¤òÅǤ¯.
+rb_ary_to_ary(VALUE obj)
- rb_ary_aref(argc, VALUE *argv, VALUE ary)
+ オブジェクトをé…列ã«å¤‰æ›ã™ã‚‹.
+ Object#to_aryã¨åŒç­‰ã§ã‚ã‚‹.
- Array#[]¤ÈƱÅù.
+ä»–ã«ã‚‚é…列をæ“作ã™ã‚‹é–¢æ•°ãŒå¤šæ•°ã‚ã‚‹. ã“れらã¯
+引数aryã«é…列を渡ã•ãªã‘れã°ãªã‚‰ãªã„. ã•ã‚‚ãªã„ã¨
+コアをåã.
- rb_ary_entry(VALUE ary, long offset)
+rb_ary_aref(argc, VALUE *argv, VALUE ary)
- ary[offset]
+ Array#[]ã¨åŒç­‰.
- rb_ary_subseq(VALUE ary, long beg, long len)
+rb_ary_entry(VALUE ary, long offset)
- ary[beg, len]
+ ary[offset]
- rb_ary_push(VALUE ary, VALUE val)
- rb_ary_pop(VALUE ary)
- rb_ary_shift(VALUE ary)
- rb_ary_unshift(VALUE ary, VALUE val)
+rb_ary_store(VALUE ary, long offset, VALUE obj) ::
-2¡¥Ruby¤Îµ¡Ç½¤ò»È¤¦
+ ary[offset] = obj
-¸¶ÍýŪ¤ËRuby¤Ç½ñ¤±¤ë¤³¤È¤ÏC¤Ç¤â½ñ¤±¤Þ¤¹¡¥Ruby¤½¤Î¤â¤Î¤¬C¤Çµ­
-½Ò¤µ¤ì¤Æ¤¤¤ë¤ó¤Ç¤¹¤«¤é¡¤ÅöÁ³¤È¤¤¤¨¤ÐÅöÁ³¤Ê¤ó¤Ç¤¹¤±¤É¡¥¤³¤³¤Ç
-¤ÏRuby¤Î³ÈÄ¥¤Ë»È¤¦¤³¤È¤¬Â¿¤¤¤À¤í¤¦¤Èͽ¬¤µ¤ì¤ëµ¡Ç½¤òÃæ¿´¤Ë¾Ò
-²ð¤·¤Þ¤¹¡¥
+rb_ary_subseq(VALUE ary, long beg, long len)
-2.1 Ruby¤Ëµ¡Ç½¤òÄɲ乤ë
+ ary[beg, len]
-Ruby¤ÇÄ󶡤µ¤ì¤Æ¤¤¤ë´Ø¿ô¤ò»È¤¨¤ÐRuby¥¤¥ó¥¿¥×¥ê¥¿¤Ë¿·¤·¤¤µ¡Ç½
-¤òÄɲ乤뤳¤È¤¬¤Ç¤­¤Þ¤¹¡¥Ruby¤Ç¤Ï°Ê²¼¤Îµ¡Ç½¤òÄɲä¹¤ë´Ø¿ô¤¬
-Ä󶡤µ¤ì¤Æ¤¤¤Þ¤¹¡¥
+rb_ary_push(VALUE ary, VALUE val)
+rb_ary_pop(VALUE ary)
+rb_ary_shift(VALUE ary)
+rb_ary_unshift(VALUE ary, VALUE val)
- * ¥¯¥é¥¹¡¤¥â¥¸¥å¡¼¥ë
- * ¥á¥½¥Ã¥É¡¤ÆÃ°Û¥á¥½¥Ã¥É¤Ê¤É
- * Äê¿ô
+rb_ary_cat(VALUE ary, const VALUE *ptr, long len)
-¤Ç¤Ï½ç¤Ë¾Ò²ð¤·¤Þ¤¹¡¥
+ é…列aryã«ptrã‹ã‚‰len個ã®ã‚ªãƒ–ジェクトを追加ã™ã‚‹ï¼Ž
-2.1.1 ¥¯¥é¥¹/¥â¥¸¥å¡¼¥ëÄêµÁ
+= Rubyã®æ©Ÿèƒ½ã‚’使ã†
-¥¯¥é¥¹¤ä¥â¥¸¥å¡¼¥ë¤òÄêµÁ¤¹¤ë¤¿¤á¤Ë¤Ï¡¤°Ê²¼¤Î´Ø¿ô¤ò»È¤¤¤Þ¤¹¡¥
+原ç†çš„ã«Rubyã§æ›¸ã‘ã‚‹ã“ã¨ã¯Cã§ã‚‚書ã‘ã¾ã™ï¼ŽRubyãã®ã‚‚ã®ãŒCã§è¨˜
+è¿°ã•れã¦ã„ã‚‹ã‚“ã§ã™ã‹ã‚‰ï¼Œå½“ç„¶ã¨ã„ãˆã°å½“ç„¶ãªã‚“ã§ã™ã‘ã©ï¼Žã“ã“ã§
+ã¯Rubyã®æ‹¡å¼µã«ä½¿ã†ã“ã¨ãŒå¤šã„ã ã‚ã†ã¨äºˆæ¸¬ã•れる機能を中心ã«ç´¹
+介ã—ã¾ã™ï¼Ž
+
+== Rubyã«æ©Ÿèƒ½ã‚’追加ã™ã‚‹
+
+Rubyã§æä¾›ã•れã¦ã„る関数を使ãˆã°Rubyã‚¤ãƒ³ã‚¿ãƒ—ãƒªã‚¿ã«æ–°ã—ã„æ©Ÿèƒ½
+を追加ã™ã‚‹ã“ã¨ãŒã§ãã¾ã™ï¼ŽRubyã§ã¯ä»¥ä¸‹ã®æ©Ÿèƒ½ã‚’追加ã™ã‚‹é–¢æ•°ãŒ
+æä¾›ã•れã¦ã„ã¾ã™ï¼Ž
+
+* クラス,モジュール
+* メソッド,特異メソッドãªã©
+* 定数
+
+ã§ã¯é †ã«ç´¹ä»‹ã—ã¾ã™ï¼Ž
+
+=== クラス/モジュール定義
+
+クラスやモジュールを定義ã™ã‚‹ãŸã‚ã«ã¯ï¼Œä»¥ä¸‹ã®é–¢æ•°ã‚’使ã„ã¾ã™ï¼Ž
VALUE rb_define_class(const char *name, VALUE super)
VALUE rb_define_module(const char *name)
-¤³¤ì¤é¤Î´Ø¿ô¤Ï¿·¤·¤¯ÄêµÁ¤µ¤ì¤¿¥¯¥é¥¹¤ä¥â¥¸¥å¡¼¥ë¤òÊÖ¤·¤Þ¤¹¡¥
-¥á¥½¥Ã¥É¤äÄê¿ô¤ÎÄêµÁ¤Ë¤³¤ì¤é¤ÎÃͤ¬É¬ÍפʤΤǡ¤¤Û¤È¤ó¤É¤Î¾ì¹ç
-¤ÏÌá¤êÃͤòÊÑ¿ô¤Ë³ÊǼ¤·¤Æ¤ª¤¯É¬Íפ¬¤¢¤ë¤Ç¤·¤ç¤¦¡¥
+ã“れらã®é–¢æ•°ã¯æ–°ã—ã定義ã•れãŸã‚¯ãƒ©ã‚¹ã‚„モジュールを返ã—ã¾ã™ï¼Ž
+メソッドや定数ã®å®šç¾©ã«ã“れらã®å€¤ãŒå¿…è¦ãªã®ã§ï¼Œã»ã¨ã‚“ã©ã®å ´åˆ
+ã¯æˆ»ã‚Šå€¤ã‚’å¤‰æ•°ã«æ ¼ç´ã—ã¦ãŠãå¿…è¦ãŒã‚ã‚‹ã§ã—ょã†ï¼Ž
-¥¯¥é¥¹¤ä¥â¥¸¥å¡¼¥ë¤ò¾¤Î¥¯¥é¥¹¤ÎÆâÉô¤Ë¥Í¥¹¥È¤·¤ÆÄêµÁ¤¹¤ë»þ¤Ë
-¤Ï°Ê²¼¤Î´Ø¿ô¤ò»È¤¤¤Þ¤¹¡¥
+クラスやモジュールを他ã®ã‚¯ãƒ©ã‚¹ã®å†…部ã«ãƒã‚¹ãƒˆã—ã¦å®šç¾©ã™ã‚‹æ™‚ã«
+ã¯ä»¥ä¸‹ã®é–¢æ•°ã‚’使ã„ã¾ã™ï¼Ž
VALUE rb_define_class_under(VALUE outer, const char *name, VALUE super)
VALUE rb_define_module_under(VALUE outer, const char *name)
-2.1.2 ¥á¥½¥Ã¥É/ÆÃ°Û¥á¥½¥Ã¥ÉÄêµÁ
+=== メソッド/特異メソッド定義
-¥á¥½¥Ã¥É¤äÆÃ°Û¥á¥½¥Ã¥É¤òÄêµÁ¤¹¤ë¤Ë¤Ï°Ê²¼¤Î´Ø¿ô¤ò»È¤¤¤Þ¤¹¡¥
+メソッドや特異メソッドを定義ã™ã‚‹ã«ã¯ä»¥ä¸‹ã®é–¢æ•°ã‚’使ã„ã¾ã™ï¼Ž
- void rb_define_method(VALUE klass, const char *name,
- VALUE (*func)(), int argc)
+ void rb_define_method(VALUE klass, const char *name,
+ VALUE (*func)(), int argc)
- void rb_define_singleton_method(VALUE object, const char *name,
- VALUE (*func)(), int argc)
+ void rb_define_singleton_method(VALUE object, const char *name,
+ VALUE (*func)(), int argc)
-ǰ¤Î¤¿¤áÀâÌÀ¤¹¤ë¤È¡ÖÆÃ°Û¥á¥½¥Ã¥É¡×¤È¤Ï¡¤¤½¤ÎÆÃÄê¤Î¥ª¥Ö¥¸¥§¥¯
-¥È¤ËÂФ·¤Æ¤À¤±Í­¸ú¤Ê¥á¥½¥Ã¥É¤Ç¤¹¡¥Ruby¤Ç¤Ï¤è¤¯Smalltalk¤Ë¤ª
-¤±¤ë¥¯¥é¥¹¥á¥½¥Ã¥É¤È¤·¤Æ¡¤¥¯¥é¥¹¤ËÂФ¹¤ëÆÃ°Û¥á¥½¥Ã¥É¤¬»È¤ï¤ì
-¤Þ¤¹¡¥
+念ã®ãŸã‚説明ã™ã‚‹ã¨ã€Œç‰¹ç•°ãƒ¡ã‚½ãƒƒãƒ‰ã€ã¨ã¯ï¼Œãã®ç‰¹å®šã®ã‚ªãƒ–ジェク
+トã«å¯¾ã—ã¦ã ã‘有効ãªãƒ¡ã‚½ãƒƒãƒ‰ã§ã™ï¼ŽRubyã§ã¯ã‚ˆãSmalltalkã«ãŠ
+ã‘るクラスメソッドã¨ã—ã¦ï¼Œã‚¯ãƒ©ã‚¹ã«å¯¾ã™ã‚‹ç‰¹ç•°ãƒ¡ã‚½ãƒƒãƒ‰ãŒä½¿ã‚れ
+ã¾ã™ï¼Ž
-¤³¤ì¤é¤Î´Ø¿ô¤Î argc¤È¤¤¤¦°ú¿ô¤ÏC¤Î´Ø¿ô¤ØÅϤµ¤ì¤ë°ú¿ô¤Î¿ô(¤È
-·Á¼°)¤ò·è¤á¤Þ¤¹¡¥argc¤¬0°Ê¾å¤Î»þ¤Ï´Ø¿ô¤Ë°ú¤­ÅϤ¹°ú¿ô¤Î¿ô¤ò°Õ
-Ì£¤·¤Þ¤¹¡¥16¸Ä°Ê¾å¤Î°ú¿ô¤Ï»È¤¨¤Þ¤»¤ó(¤¬¡¤Íפê¤Þ¤»¤ó¤è¤Í¡¤¤½
-¤ó¤Ê¤Ë)¡¥¼ÂºÝ¤Î´Ø¿ô¤Ë¤ÏÀèÆ¬¤Î°ú¿ô¤È¤·¤Æself¤¬Í¿¤¨¤é¤ì¤Þ¤¹¤Î
-¤Ç¡¤»ØÄꤷ¤¿¿ô¤è¤ê1¿¤¤°ú¿ô¤ò»ý¤Ä¤³¤È¤Ë¤Ê¤ê¤Þ¤¹¡¥
+ã“れらã®é–¢æ•°ã® argcã¨ã„ã†å¼•æ•°ã¯Cã®é–¢æ•°ã¸æ¸¡ã•ã‚Œã‚‹å¼•æ•°ã®æ•°(ã¨
+å½¢å¼)を決ã‚ã¾ã™ï¼ŽargcãŒ0ä»¥ä¸Šã®æ™‚ã¯é–¢æ•°ã«å¼•ãæ¸¡ã™å¼•æ•°ã®æ•°ã‚’æ„
+味ã—ã¾ã™ï¼Ž16個以上ã®å¼•æ•°ã¯ä½¿ãˆã¾ã›ã‚“(ãŒï¼Œè¦ã‚Šã¾ã›ã‚“よã­ï¼Œã
+ã‚“ãªã«).実際ã®é–¢æ•°ã«ã¯å…ˆé ­ã®å¼•æ•°ã¨ã—ã¦selfãŒä¸Žãˆã‚‰ã‚Œã¾ã™ã®
+ã§ï¼ŒæŒ‡å®šã—ãŸæ•°ã‚ˆã‚Š1多ã„引数をæŒã¤ã“ã¨ã«ãªã‚Šã¾ã™ï¼Ž
-argc¤¬Éé¤Î»þ¤Ï°ú¿ô¤Î¿ô¤Ç¤Ï¤Ê¤¯¡¤·Á¼°¤ò»ØÄꤷ¤¿¤³¤È¤Ë¤Ê¤ê¤Þ¤¹¡¥
-argc¤¬-1¤Î»þ¤Ï°ú¿ô¤òÇÛÎó¤ËÆþ¤ì¤ÆÅϤµ¤ì¤Þ¤¹¡¥argc¤¬-2¤Î»þ¤Ï°ú
-¿ô¤ÏRuby¤ÎÇÛÎó¤È¤·¤ÆÅϤµ¤ì¤Þ¤¹¡¥
+argcãŒè² ã®æ™‚ã¯å¼•æ•°ã®æ•°ã§ã¯ãªã,形å¼ã‚’指定ã—ãŸã“ã¨ã«ãªã‚Šã¾ã™ï¼Ž
+argcãŒ-1ã®æ™‚ã¯å¼•æ•°ã‚’é…列ã«å…¥ã‚Œã¦æ¸¡ã•れã¾ã™ï¼ŽargcãŒ-2ã®æ™‚ã¯å¼•
+æ•°ã¯Rubyã®é…列ã¨ã—ã¦æ¸¡ã•れã¾ã™ï¼Ž
-¥á¥½¥Ã¥É¤òÄêµÁ¤¹¤ë´Ø¿ô¤Ï¤Þ¤À¤¤¤¯¤Ä¤«¤¢¤ê¤Þ¤¹. ¤Ò¤È¤Ä¤Ï¥á¥½¥Ã¥É
-̾¤È¤·¤ÆID¤ò¼è¤ê¤Þ¤¹. ID¤Ë¤Ä¤¤¤Æ¤Ï2.2.2¤ò»²¾È.
+メソッドを定義ã™ã‚‹é–¢æ•°ã¯ã¾ã ã„ãã¤ã‹ã‚りã¾ã™. ã²ã¨ã¤ã¯ãƒ¡ã‚½ãƒƒãƒ‰
+åã¨ã—ã¦IDã‚’å–りã¾ã™. IDã«ã¤ã„ã¦ã¯2.2.2ã‚’å‚ç…§.
- void rb_define_method_id(VALUE klass, ID name,
+ void rb_define_method_id(VALUE klass, ID name,
VALUE (*func)(ANYARGS), int argc)
-private/protected¤Ê¥á¥½¥Ã¥É¤òÄêµÁ¤¹¤ë¤Õ¤¿¤Ä¤Î´Ø¿ô¤¬¤¢¤ê¤Þ¤¹.
+private/protectedãªãƒ¡ã‚½ãƒƒãƒ‰ã‚’定義ã™ã‚‹ãµãŸã¤ã®é–¢æ•°ãŒã‚りã¾ã™.
- void rb_define_private_method(VALUE klass, const char *name,
+ void rb_define_private_method(VALUE klass, const char *name,
VALUE (*func)(), int argc)
- void rb_define_protected_method(VALUE klass, const char *name,
+ void rb_define_protected_method(VALUE klass, const char *name,
VALUE (*func)(), int argc)
-private¥á¥½¥Ã¥É¤È¤Ï´Ø¿ô·Á¼°¤Ç¤·¤«¸Æ¤Ó½Ð¤¹¤³¤È¤Î½ÐÍè¤Ê¤¤¥á¥½¥Ã
-¥É¤Ç¤¹¡¥
+privateメソッドã¨ã¯é–¢æ•°å½¢å¼ã§ã—ã‹å‘¼ã³å‡ºã™ã“ã¨ã®å‡ºæ¥ãªã„メソッ
+ドã§ã™ï¼Ž
-ºÇ¸å¤Ë¡¤ rb_define_module´Ø¿ô¤Ï¥â¥¸¥å¡¼¥ë´Ø¿ô¤òÄêµÁ¤·¤Þ¤¹¡¥
-¥â¥¸¥å¡¼¥ë´Ø¿ô¤È¤Ï¥â¥¸¥å¡¼¥ë¤ÎÆÃ°Û¥á¥½¥Ã¥É¤Ç¤¢¤ê¡¤Æ±»þ¤Ë
-private¥á¥½¥Ã¥É¤Ç¤â¤¢¤ë¤â¤Î¤Ç¤¹¡¥Îã¤ò¤¢¤²¤ë¤ÈMath¥â¥¸¥å¡¼¥ë
-¤Îsqrt()¤Ê¤É¤¬¤¢¤²¤é¤ì¤Þ¤¹¡¥¤³¤Î¥á¥½¥Ã¥É¤Ï
+最後ã«ï¼Œ rb_define_module関数ã¯ãƒ¢ã‚¸ãƒ¥ãƒ¼ãƒ«é–¢æ•°ã‚’定義ã—ã¾ã™ï¼Ž
+モジュール関数ã¨ã¯ãƒ¢ã‚¸ãƒ¥ãƒ¼ãƒ«ã®ç‰¹ç•°ãƒ¡ã‚½ãƒƒãƒ‰ã§ã‚ã‚Šï¼ŒåŒæ™‚ã«
+privateメソッドã§ã‚‚ã‚ã‚‹ã‚‚ã®ã§ã™ï¼Žä¾‹ã‚’ã‚ã’ã‚‹ã¨Mathモジュール
+ã®sqrt()ãªã©ãŒã‚ã’られã¾ã™ï¼Žã“ã®ãƒ¡ã‚½ãƒƒãƒ‰ã¯
Math.sqrt(4)
-¤È¤¤¤¦·Á¼°¤Ç¤â
+ã¨ã„ã†å½¢å¼ã§ã‚‚
include Math
sqrt(4)
-¤È¤¤¤¦·Á¼°¤Ç¤â»È¤¨¤Þ¤¹¡¥¥â¥¸¥å¡¼¥ë´Ø¿ô¤òÄêµÁ¤¹¤ë´Ø¿ô¤Ï°Ê²¼¤Î
-Ä̤ê¤Ç¤¹¡¥
+ã¨ã„ã†å½¢å¼ã§ã‚‚使ãˆã¾ã™ï¼Žãƒ¢ã‚¸ãƒ¥ãƒ¼ãƒ«é–¢æ•°ã‚’定義ã™ã‚‹é–¢æ•°ã¯ä»¥ä¸‹ã®
+通りã§ã™ï¼Ž
- void rb_define_module_function(VALUE module, const char *name,
+ void rb_define_module_function(VALUE module, const char *name,
VALUE (*func)(), int argc)
-´Ø¿ôŪ¥á¥½¥Ã¥É(Kernel¥â¥¸¥å¡¼¥ë¤Îprivate method)¤òÄêµÁ¤¹¤ë¤¿
-¤á¤Î´Ø¿ô¤Ï°Ê²¼¤ÎÄ̤ê¤Ç¤¹¡¥
+関数的メソッド(Kernelモジュールã®private method)を定義ã™ã‚‹ãŸ
+ã‚ã®é–¢æ•°ã¯ä»¥ä¸‹ã®é€šã‚Šã§ã™ï¼Ž
void rb_define_global_function(const char *name, VALUE (*func)(), int argc)
-¥á¥½¥Ã¥É¤ÎÊÌ̾¤òÄêµÁ¤¹¤ë¤¿¤á¤Î´Ø¿ô¤Ï°Ê²¼¤ÎÄ̤ê¤Ç¤¹¡¥
+メソッドã®åˆ¥åを定義ã™ã‚‹ãŸã‚ã®é–¢æ•°ã¯ä»¥ä¸‹ã®é€šã‚Šã§ã™ï¼Ž
void rb_define_alias(VALUE module, const char* new, const char* old);
-°À­¤Î¼èÆÀ¡¦ÀßÄê¥á¥½¥Ã¥É¤òÄêµÁ¤¹¤ë¤Ë¤Ï
+属性ã®å–得・設定メソッドを定義ã™ã‚‹ã«ã¯
void rb_define_attr(VALUE klass, const char *name, int read, int write)
-¥¯¥é¥¹¥á¥½¥Ã¥Éallocate¤òÄêµÁ¤·¤¿¤êºï½ü¤·¤¿¤ê¤¹¤ë¤¿¤á¤Î´Ø¿ô¤Ï
-°Ê²¼¤ÎÄ̤ê¤Ç¤¹¡¥
+クラスメソッドallocateを定義ã—ãŸã‚Šå‰Šé™¤ã—ãŸã‚Šã™ã‚‹ãŸã‚ã®é–¢æ•°ã¯
+以下ã®é€šã‚Šã§ã™ï¼Ž
void rb_define_alloc_func(VALUE klass, VALUE (*func)(VALUE klass));
void rb_undef_alloc_func(VALUE klass);
-func¤Ï¥¯¥é¥¹¤ò°ú¿ô¤È¤·¤Æ¼õ¤±¼è¤Ã¤Æ¡¤¿·¤·¤¯³ä¤êÅö¤Æ¤é¤ì¤¿¥¤¥ó
-¥¹¥¿¥ó¥¹¤òÊÖ¤µ¤Ê¤¯¤Æ¤Ï¤Ê¤ê¤Þ¤»¤ó¡¥¤³¤Î¥¤¥ó¥¹¥¿¥ó¥¹¤Ï¡¤³°Éô¥ê
-¥½¡¼¥¹¤Ê¤É¤ò´Þ¤Þ¤Ê¤¤¡¤¤Ç¤­¤ë¤À¤±¡Ö¶õ¡×¤Î¤Þ¤Þ¤Ë¤·¤Æ¤ª¤¤¤¿¤Û¤¦
-¤¬¤è¤¤¤Ç¤·¤ç¤¦¡¥
+funcã¯ã‚¯ãƒ©ã‚¹ã‚’引数ã¨ã—ã¦å—ã‘å–ã£ã¦ï¼Œæ–°ã—ã割り当ã¦ã‚‰ã‚ŒãŸã‚¤ãƒ³
+スタンスを返ã•ãªãã¦ã¯ãªã‚Šã¾ã›ã‚“.ã“ã®ã‚¤ãƒ³ã‚¹ã‚¿ãƒ³ã‚¹ã¯ï¼Œå¤–部リ
+ソースãªã©ã‚’å«ã¾ãªã„,ã§ãã‚‹ã ã‘「空ã€ã®ã¾ã¾ã«ã—ã¦ãŠã„ãŸã»ã†
+ãŒã‚ˆã„ã§ã—ょã†ï¼Ž
-2.1.3 Äê¿ôÄêµÁ
+=== 定数定義
-³ÈÄ¥¥é¥¤¥Ö¥é¥ê¤¬É¬ÍפÊÄê¿ô¤Ï¤¢¤é¤«¤¸¤áÄêµÁ¤·¤Æ¤ª¤¤¤¿Êý¤¬Îɤ¤
-¤Ç¤·¤ç¤¦¡¥Äê¿ô¤òÄêµÁ¤¹¤ë´Ø¿ô¤ÏÆó¤Ä¤¢¤ê¤Þ¤¹¡¥
+拡張ライブラリãŒå¿…è¦ãªå®šæ•°ã¯ã‚らã‹ã˜ã‚定義ã—ã¦ãŠã„ãŸæ–¹ãŒè‰¯ã„
+ã§ã—ょã†ï¼Žå®šæ•°ã‚’定義ã™ã‚‹é–¢æ•°ã¯äºŒã¤ã‚りã¾ã™ï¼Ž
void rb_define_const(VALUE klass, const char *name, VALUE val)
void rb_define_global_const(const char *name, VALUE val)
-Á°¼Ô¤ÏÆÃÄê¤Î¥¯¥é¥¹/¥â¥¸¥å¡¼¥ë¤Ë°¤¹¤ëÄê¿ô¤òÄêµÁ¤¹¤ë¤â¤Î¡¤¸å
-¼Ô¤Ï¥°¥í¡¼¥Ð¥ë¤ÊÄê¿ô¤òÄêµÁ¤¹¤ë¤â¤Î¤Ç¤¹¡¥
+å‰è€…ã¯ç‰¹å®šã®ã‚¯ãƒ©ã‚¹/モジュールã«å±žã™ã‚‹å®šæ•°ã‚’定義ã™ã‚‹ã‚‚ã®ï¼Œå¾Œ
+者ã¯ã‚°ãƒ­ãƒ¼ãƒãƒ«ãªå®šæ•°ã‚’定義ã™ã‚‹ã‚‚ã®ã§ã™ï¼Ž
-2.2 Ruby¤Îµ¡Ç½¤òC¤«¤é¸Æ¤Ó½Ð¤¹
+== Rubyã®æ©Ÿèƒ½ã‚’Cã‹ã‚‰å‘¼ã³å‡ºã™
-´û¤Ë¡Ø1.5 Ruby¤Î¥Ç¡¼¥¿¤òÁàºî¤¹¤ë¡Ù¤Ç°ìÉô¾Ò²ð¤·¤¿¤è¤¦¤Ê´Ø¿ô¤ò
-»È¤¨¤Ð¡¤Ruby¤Îµ¡Ç½¤ò¼Â¸½¤·¤Æ¤¤¤ë´Ø¿ô¤òľÀܸƤӽФ¹¤³¤È¤¬½ÐÍè
-¤Þ¤¹¡¥
+æ—¢ã«ã€Ž1.5 Rubyã®ãƒ‡ãƒ¼ã‚¿ã‚’æ“作ã™ã‚‹ã€ã§ä¸€éƒ¨ç´¹ä»‹ã—ãŸã‚ˆã†ãªé–¢æ•°ã‚’
+使ãˆã°ï¼ŒRubyã®æ©Ÿèƒ½ã‚’実ç¾ã—ã¦ã„る関数を直接呼ã³å‡ºã™ã“ã¨ãŒå‡ºæ¥
+ã¾ã™ï¼Ž
-# ¤³¤Î¤è¤¦¤Ê´Ø¿ô¤Î°ìÍ÷ɽ¤Ï¤¤¤Þ¤Î¤È¤³¤í¤¢¤ê¤Þ¤»¤ó¡¥¥½¡¼¥¹¤ò¸«
-# ¤ë¤·¤«¤Ê¤¤¤Ç¤¹¤Í¡¥
+# ã“ã®ã‚ˆã†ãªé–¢æ•°ã®ä¸€è¦§è¡¨ã¯ã„ã¾ã®ã¨ã“ã‚ã‚りã¾ã›ã‚“.ソースを見
+# ã‚‹ã—ã‹ãªã„ã§ã™ã­ï¼Ž
-¤½¤ì°Ê³°¤Ë¤âRuby¤Îµ¡Ç½¤ò¸Æ¤Ó½Ð¤¹ÊýË¡¤Ï¤¤¤¯¤Ä¤«¤¢¤ê¤Þ¤¹¡¥
+ãれ以外ã«ã‚‚Rubyã®æ©Ÿèƒ½ã‚’呼ã³å‡ºã™æ–¹æ³•ã¯ã„ãã¤ã‹ã‚りã¾ã™ï¼Ž
-2.2.1 Ruby¤Î¥×¥í¥°¥é¥à¤òeval¤¹¤ë
+=== Rubyã®ãƒ—ログラムをevalã™ã‚‹
-C¤«¤éRuby¤Îµ¡Ç½¤ò¸Æ¤Ó½Ð¤¹¤â¤Ã¤È¤â´Êñ¤ÊÊýË¡¤È¤·¤Æ¡¤Ê¸»úÎó¤Ç
-Í¿¤¨¤é¤ì¤¿Ruby¤Î¥×¥í¥°¥é¥à¤òɾ²Á¤¹¤ë°Ê²¼¤Î´Ø¿ô¤¬¤¢¤ê¤Þ¤¹¡¥
+Cã‹ã‚‰Rubyã®æ©Ÿèƒ½ã‚’呼ã³å‡ºã™ã‚‚ã£ã¨ã‚‚ç°¡å˜ãªæ–¹æ³•ã¨ã—ã¦ï¼Œæ–‡å­—列ã§
+与ãˆã‚‰ã‚ŒãŸRubyã®ãƒ—ログラムを評価ã™ã‚‹ä»¥ä¸‹ã®é–¢æ•°ãŒã‚りã¾ã™ï¼Ž
VALUE rb_eval_string(const char *str)
-¤³¤Îɾ²Á¤Ï¸½ºß¤Î´Ä¶­¤Ç¹Ô¤ï¤ì¤Þ¤¹¡¥¤Ä¤Þ¤ê¡¤¸½ºß¤Î¥í¡¼¥«¥ëÊÑ¿ô
-¤Ê¤É¤ò¼õ¤±·Ñ¤®¤Þ¤¹¡¥
+ã“ã®è©•価ã¯ç¾åœ¨ã®ç’°å¢ƒã§è¡Œã‚れã¾ã™ï¼Žã¤ã¾ã‚Šï¼Œç¾åœ¨ã®ãƒ­ãƒ¼ã‚«ãƒ«å¤‰æ•°
+ãªã©ã‚’å—ã‘ç¶™ãŽã¾ã™ï¼Ž
-ɾ²Á¤ÏÎã³°¤òȯÀ¸¤¹¤ë¤«¤â¤·¤ì¤Ê¤¤¤³¤È¤ËÃí°Õ¤·¤Þ¤·¤ç¤¦. ¤è¤ê°ÂÁ´
-¤Ê´Ø¿ô¤â¤¢¤ê¤Þ¤¹.
+評価ã¯ä¾‹å¤–を発生ã™ã‚‹ã‹ã‚‚ã—れãªã„ã“ã¨ã«æ³¨æ„ã—ã¾ã—ょã†. より安全
+ãªé–¢æ•°ã‚‚ã‚りã¾ã™.
VALUE rb_eval_string_protect(const char *str, int *state)
-¤³¤Î´Ø¿ô¤Ï¥¨¥é¡¼¤¬È¯À¸¤¹¤ë¤Ènil¤òÊÖ¤·¤Þ¤¹¡¥¤½¤·¤Æ¡¤À®¸ù»þ¤Ë¤Ï
-*state¤Ï¥¼¥í¤Ë¡¤¤µ¤â¤Ê¤¯¤ÐÈó¥¼¥í¤Ë¤Ê¤ê¤Þ¤¹¡¥
+ã“ã®é–¢æ•°ã¯ã‚¨ãƒ©ãƒ¼ãŒç™ºç”Ÿã™ã‚‹ã¨nilã‚’è¿”ã—ã¾ã™ï¼Žãã—ã¦ï¼ŒæˆåŠŸæ™‚ã«ã¯
+*stateã¯ã‚¼ãƒ­ã«ï¼Œã•ã‚‚ãªãã°éžã‚¼ãƒ­ã«ãªã‚Šã¾ã™ï¼Ž
+=== IDã¾ãŸã¯ã‚·ãƒ³ãƒœãƒ«
-2.2.2 ID¤Þ¤¿¤Ï¥·¥ó¥Ü¥ë
+Cã‹ã‚‰æ–‡å­—列を経由ã›ãšã«Rubyã®ãƒ¡ã‚½ãƒƒãƒ‰ã‚’呼ã³å‡ºã™ã“ã¨ã‚‚ã§ãã¾
+ã™ï¼Žãã®å‰ã«ï¼ŒRubyインタプリタ内ã§ãƒ¡ã‚½ãƒƒãƒ‰ã‚„変数åを指定ã™ã‚‹
+時ã«ä½¿ã‚れã¦ã„ã‚‹IDã«ã¤ã„ã¦èª¬æ˜Žã—ã¦ãŠãã¾ã—ょã†ï¼Ž
-C¤«¤éʸ»úÎó¤ò·Ðͳ¤»¤º¤ËRuby¤Î¥á¥½¥Ã¥É¤ò¸Æ¤Ó½Ð¤¹¤³¤È¤â¤Ç¤­¤Þ
-¤¹¡¥¤½¤ÎÁ°¤Ë¡¤Ruby¥¤¥ó¥¿¥×¥ê¥¿Æâ¤Ç¥á¥½¥Ã¥É¤äÊÑ¿ô̾¤ò»ØÄꤹ¤ë
-»þ¤Ë»È¤ï¤ì¤Æ¤¤¤ëID¤Ë¤Ä¤¤¤ÆÀâÌÀ¤·¤Æ¤ª¤­¤Þ¤·¤ç¤¦¡¥
+IDã¨ã¯å¤‰æ•°å,メソッドåã‚’è¡¨ã™æ•´æ•°ã§ã™ï¼ŽRubyã®ä¸­ã§ã¯
-ID¤È¤ÏÊÑ¿ô̾¡¤¥á¥½¥Ã¥É̾¤òɽ¤¹À°¿ô¤Ç¤¹¡¥Ruby¤ÎÃæ¤Ç¤Ï
+ :識別å­
- :¼±ÊÌ»Ò
-¤Þ¤¿¤Ï
- :"Ǥ°Õ¤Îʸ»úÎó"
+ã¾ãŸã¯
-¤Ç¥¢¥¯¥»¥¹¤Ç¤­¤Þ¤¹¡¥C¤«¤é¤³¤ÎÀ°¿ô¤òÆÀ¤ë¤¿¤á¤Ë¤Ï´Ø¿ô
+ :"ä»»æ„ã®æ–‡å­—列"
+
+ã§ã‚¢ã‚¯ã‚»ã‚¹ã§ãã¾ã™ï¼ŽCã‹ã‚‰ã“ã®æ•´æ•°ã‚’å¾—ã‚‹ãŸã‚ã«ã¯é–¢æ•°
rb_intern(const char *name)
+ rb_intern_str(VALUE name)
-¤ò»È¤¤¤Þ¤¹¡¥Ruby¤«¤é°ú¿ô¤È¤·¤ÆÍ¿¤¨¤é¤ì¤¿¥·¥ó¥Ü¥ë(¤Þ¤¿¤Ïʸ»ú
-Îó)¤òID¤ËÊÑ´¹¤¹¤ë¤Ë¤Ï°Ê²¼¤Î´Ø¿ô¤ò»È¤¤¤Þ¤¹¡¥
+を使ã„ã¾ã™ï¼ŽRubyã‹ã‚‰å¼•æ•°ã¨ã—ã¦ä¸Žãˆã‚‰ã‚ŒãŸã‚·ãƒ³ãƒœãƒ«(ã¾ãŸã¯æ–‡å­—
+列)ã‚’IDã«å¤‰æ›ã™ã‚‹ã«ã¯ä»¥ä¸‹ã®é–¢æ•°ã‚’使ã„ã¾ã™ï¼Ž
rb_to_id(VALUE symbol)
+ rb_check_id(volatile VALUE *name)
+ rb_check_id_cstr(const char *name, long len, rb_encoding *enc)
+
+ã‚‚ã—引数ãŒã‚·ãƒ³ãƒœãƒ«ã§ã‚‚文字列ã§ã‚‚ãªã‘れã°ã€to_strãƒ¡ã‚½ãƒƒãƒ‰ã§æ–‡
+字列ã«å¤‰æ›ã—よã†ã¨ã—ã¾ã™ï¼Žç¬¬äºŒã®é–¢æ•°ã¯ãã®å¤‰æ›çµæžœã‚’*nameã«ä¿
+å­˜ã—,ãã®åå‰ãŒæ—¢çŸ¥ã®ã‚·ãƒ³ãƒœãƒ«ã§ãªã„å ´åˆã¯0ã‚’è¿”ã—ã¾ã™ï¼Žã“ã®é–¢
+æ•°ãŒ0以外を返ã—ãŸå ´åˆã¯*nameã¯å¸¸ã«ã‚·ãƒ³ãƒœãƒ«ã‹æ–‡å­—列ã§ã‚りã€0ã‚’
+è¿”ã—ãŸå ´åˆã¯å¸¸ã«æ–‡å­—列ã§ã™ï¼Žç¬¬ä¸‰ã®é–¢æ•°ã¯Rubyã®æ–‡å­—列ã§ã¯ãªã
+NUL終端ã•れãŸCã®æ–‡å­—列を使ã„ã¾ã™ï¼Ž
-2.2.3 C¤«¤éRuby¤Î¥á¥½¥Ã¥É¤ò¸Æ¤Ó½Ð¤¹
+=== Cã‹ã‚‰Rubyã®ãƒ¡ã‚½ãƒƒãƒ‰ã‚’呼ã³å‡ºã™
-C¤«¤éʸ»úÎó¤ò·Ðͳ¤»¤º¤ËRuby¤Î¥á¥½¥Ã¥É¤ò¸Æ¤Ó½Ð¤¹¤¿¤á¤Ë¤Ï°Ê²¼
-¤Î´Ø¿ô¤ò»È¤¤¤Þ¤¹¡¥
+Cã‹ã‚‰æ–‡å­—列を経由ã›ãšã«Rubyã®ãƒ¡ã‚½ãƒƒãƒ‰ã‚’呼ã³å‡ºã™ãŸã‚ã«ã¯ä»¥ä¸‹
+ã®é–¢æ•°ã‚’使ã„ã¾ã™ï¼Ž
VALUE rb_funcall(VALUE recv, ID mid, int argc, ...)
-¤³¤Î´Ø¿ô¤Ï¥ª¥Ö¥¸¥§¥¯¥Èrecv¤Îmid¤Ç»ØÄꤵ¤ì¤ë¥á¥½¥Ã¥É¤ò¸Æ¤Ó½Ð
-¤·¤Þ¤¹¡¥¤½¤Î¾¤Ë°ú¿ô¤Î»ØÄê¤Î»ÅÊý¤¬°ã¤¦°Ê²¼¤Î´Ø¿ô¤â¤¢¤ê¤Þ¤¹¡¥
+ã“ã®é–¢æ•°ã¯ã‚ªãƒ–ジェクトrecvã®midã§æŒ‡å®šã•れるメソッドを呼ã³å‡º
+ã—ã¾ã™ï¼Žãã®ä»–ã«å¼•æ•°ã®æŒ‡å®šã®ä»•æ–¹ãŒé•ã†ä»¥ä¸‹ã®é–¢æ•°ã‚‚ã‚りã¾ã™ï¼Ž
VALUE rb_funcall2(VALUE recv, ID mid, int argc, VALUE *argv)
+ VALUE rb_funcallv(VALUE recv, ID mid, int argc, VALUE *argv)
VALUE rb_apply(VALUE recv, ID mid, VALUE args)
-apply¤Ë¤Ï°ú¿ô¤È¤·¤ÆRuby¤ÎÇÛÎó¤òÍ¿¤¨¤Þ¤¹¡¥
+applyã«ã¯å¼•æ•°ã¨ã—ã¦Rubyã®é…列を与ãˆã¾ã™ï¼Ž
-2.2.4 ÊÑ¿ô/Äê¿ô¤ò»²¾È/¹¹¿·¤¹¤ë
+=== 変数/定数をå‚ç…§/æ›´æ–°ã™ã‚‹
-C¤«¤é´Ø¿ô¤ò»È¤Ã¤Æ»²¾È¡¦¹¹¿·¤Ç¤­¤ë¤Î¤Ï¡¤Äê¿ô¡¤¥¤¥ó¥¹¥¿¥ó¥¹ÊÑ
-¿ô¤Ç¤¹¡¥Âç°èÊÑ¿ô¤Ï°ìÉô¤Î¤â¤Î¤ÏC¤ÎÂç°èÊÑ¿ô¤È¤·¤Æ¥¢¥¯¥»¥¹¤Ç¤­
-¤Þ¤¹¡¥¥í¡¼¥«¥ëÊÑ¿ô¤ò»²¾È¤¹¤ëÊýË¡¤Ï¸ø³«¤·¤Æ¤¤¤Þ¤»¤ó¡¥
+Cã‹ã‚‰é–¢æ•°ã‚’使ã£ã¦å‚照・更新ã§ãã‚‹ã®ã¯ï¼Œå®šæ•°ï¼Œã‚¤ãƒ³ã‚¹ã‚¿ãƒ³ã‚¹å¤‰
+æ•°ã§ã™ï¼Žå¤§åŸŸå¤‰æ•°ã¯ä¸€éƒ¨ã®ã‚‚ã®ã¯Cã®å¤§åŸŸå¤‰æ•°ã¨ã—ã¦ã‚¢ã‚¯ã‚»ã‚¹ã§ã
+ã¾ã™ï¼Žãƒ­ãƒ¼ã‚«ãƒ«å¤‰æ•°ã‚’å‚ç…§ã™ã‚‹æ–¹æ³•ã¯å…¬é–‹ã—ã¦ã„ã¾ã›ã‚“.
-¥ª¥Ö¥¸¥§¥¯¥È¤Î¥¤¥ó¥¹¥¿¥ó¥¹ÊÑ¿ô¤ò»²¾È¡¦¹¹¿·¤¹¤ë´Ø¿ô¤Ï°Ê²¼¤ÎÄÌ
-¤ê¤Ç¤¹¡¥
+オブジェクトã®ã‚¤ãƒ³ã‚¹ã‚¿ãƒ³ã‚¹å¤‰æ•°ã‚’å‚照・更新ã™ã‚‹é–¢æ•°ã¯ä»¥ä¸‹ã®é€š
+りã§ã™ï¼Ž
VALUE rb_ivar_get(VALUE obj, ID id)
VALUE rb_ivar_set(VALUE obj, ID id, VALUE val)
-id¤Ïrb_intern()¤ÇÆÀ¤é¤ì¤ë¤â¤Î¤ò»È¤Ã¤Æ¤¯¤À¤µ¤¤¡¥
+idã¯rb_intern()ã§å¾—られるもã®ã‚’使ã£ã¦ãã ã•ã„.
-Äê¿ô¤ò»²¾È¤¹¤ë¤Ë¤Ï°Ê²¼¤Î´Ø¿ô¤ò»È¤Ã¤Æ¤¯¤À¤µ¤¤¡¥
+定数をå‚ç…§ã™ã‚‹ã«ã¯ä»¥ä¸‹ã®é–¢æ•°ã‚’使ã£ã¦ãã ã•ã„.
VALUE rb_const_get(VALUE obj, ID id)
-Äê¿ô¤ò¿·¤·¤¯ÄêµÁ¤¹¤ë¤¿¤á¤Ë¤Ï¡Ø2.1.3 Äê¿ôÄêµÁ¡Ù¤Ç¾Ò²ð¤µ
-¤ì¤Æ¤¤¤ë´Ø¿ô¤ò»È¤Ã¤Æ¤¯¤À¤µ¤¤¡¥
+定数を新ã—ã定義ã™ã‚‹ãŸã‚ã«ã¯ã€Ž2.1.3 定数定義ã€ã§ç´¹ä»‹ã•
+れã¦ã„る関数を使ã£ã¦ãã ã•ã„.
-3¡¥Ruby¤ÈC¤È¤Î¾ðÊó¶¦Í­
+= Rubyã¨Cã¨ã®æƒ…報共有
-C¸À¸ì¤ÈRuby¤Î´Ö¤Ç¾ðÊó¤ò¶¦Í­¤¹¤ëÊýË¡¤Ë¤Ä¤¤¤Æ²òÀ⤷¤Þ¤¹¡¥
+C言語ã¨Rubyã®é–“ã§æƒ…報を共有ã™ã‚‹æ–¹æ³•ã«ã¤ã„ã¦è§£èª¬ã—ã¾ã™ï¼Ž
-3.1 C¤«¤é»²¾È¤Ç¤­¤ëRuby¤ÎÄê¿ô
+== Cã‹ã‚‰å‚ç…§ã§ãã‚‹Rubyã®å®šæ•°
-°Ê²¼¤ÎRuby¤ÎÄê¿ô¤ÏC¤Î¥ì¥Ù¥ë¤«¤é»²¾È¤Ç¤­¤Þ¤¹¡¥
+以下ã®Rubyã®å®šæ•°ã¯Cã®ãƒ¬ãƒ™ãƒ«ã‹ã‚‰å‚ç…§ã§ãã¾ã™ï¼Ž
Qtrue
Qfalse
- ¿¿µ¶ÃÍ¡¥Qfalse¤ÏC¸À¸ì¤Ç¤âµ¶¤È¤ß¤Ê¤µ¤ì¤Þ¤¹(¤Ä¤Þ¤ê0)¡¥
+真å½å€¤ï¼ŽQfalseã¯C言語ã§ã‚‚å½ã¨ã¿ãªã•れã¾ã™(ã¤ã¾ã‚Š0).
Qnil
- C¸À¸ì¤«¤é¸«¤¿¡Önil¡×¡¥
+C言語ã‹ã‚‰è¦‹ãŸã€Œnilã€ï¼Ž
-3.2 C¤ÈRuby¤Ç¶¦Í­¤µ¤ì¤ëÂç°èÊÑ¿ô
+== Cã¨Rubyã§å…±æœ‰ã•れる大域変数
-C¤ÈRuby¤ÇÂç°èÊÑ¿ô¤ò»È¤Ã¤Æ¾ðÊó¤ò¶¦Í­¤Ç¤­¤Þ¤¹¡¥¶¦Í­¤Ç¤­¤ëÂç°è
-ÊÑ¿ô¤Ë¤Ï¤¤¤¯¤Ä¤«¤Î¼ïÎब¤¢¤ê¤Þ¤¹¡¥¤½¤Î¤Ê¤«¤Ç¤â¤Ã¤È¤âÎɤ¯»È¤ï
-¤ì¤ë¤È»×¤ï¤ì¤ë¤Î¤Ïrb_define_variable()¤Ç¤¹¡¥
+Cã¨Rubyã§å¤§åŸŸå¤‰æ•°ã‚’使ã£ã¦æƒ…報を共有ã§ãã¾ã™ï¼Žå…±æœ‰ã§ãる大域
+変数ã«ã¯ã„ãã¤ã‹ã®ç¨®é¡žãŒã‚りã¾ã™ï¼Žãã®ãªã‹ã§ã‚‚ã£ã¨ã‚‚良ã使ã‚
+ã‚Œã‚‹ã¨æ€ã‚れるã®ã¯rb_define_variable()ã§ã™ï¼Ž
void rb_define_variable(const char *name, VALUE *var)
-¤³¤Î´Ø¿ô¤ÏRuby¤ÈC¤È¤Ç¶¦Í­¤¹¤ëÂç°èÊÑ¿ô¤òÄêµÁ¤·¤Þ¤¹¡¥ÊÑ¿ô̾¤¬
-`$'¤Ç»Ï¤Þ¤é¤Ê¤¤»þ¤Ë¤Ï¼«Æ°Åª¤ËÄɲ䵤ì¤Þ¤¹¡¥¤³¤ÎÊÑ¿ô¤ÎÃͤòÊÑ
-¹¹¤¹¤ë¤È¼«Æ°Åª¤ËRuby¤ÎÂбþ¤¹¤ëÊÑ¿ô¤ÎÃͤâÊѤï¤ê¤Þ¤¹¡¥
+ã“ã®é–¢æ•°ã¯Rubyã¨Cã¨ã§å…±æœ‰ã™ã‚‹å¤§åŸŸå¤‰æ•°ã‚’定義ã—ã¾ã™ï¼Žå¤‰æ•°åãŒ
+`$'ã§å§‹ã¾ã‚‰ãªã„時ã«ã¯è‡ªå‹•çš„ã«è¿½åŠ ã•れã¾ã™ï¼Žã“ã®å¤‰æ•°ã®å€¤ã‚’変
+æ›´ã™ã‚‹ã¨è‡ªå‹•çš„ã«Rubyã®å¯¾å¿œã™ã‚‹å¤‰æ•°ã®å€¤ã‚‚変ã‚りã¾ã™ï¼Ž
-¤Þ¤¿Ruby¦¤«¤é¤Ï¹¹¿·¤Ç¤­¤Ê¤¤ÊÑ¿ô¤â¤¢¤ê¤Þ¤¹¡¥¤³¤Îread only¤Î
-ÊÑ¿ô¤Ï°Ê²¼¤Î´Ø¿ô¤ÇÄêµÁ¤·¤Þ¤¹¡¥
+ã¾ãŸRubyå´ã‹ã‚‰ã¯æ›´æ–°ã§ããªã„変数もã‚りã¾ã™ï¼Žã“ã®read onlyã®
+変数ã¯ä»¥ä¸‹ã®é–¢æ•°ã§å®šç¾©ã—ã¾ã™ï¼Ž
void rb_define_readonly_variable(const char *name, VALUE *var)
-¤³¤ì¤éÊÑ¿ô¤Î¾¤Ëhook¤ò¤Ä¤±¤¿Âç°èÊÑ¿ô¤òÄêµÁ¤Ç¤­¤Þ¤¹¡¥hookÉÕ¤­
-¤ÎÂç°èÊÑ¿ô¤Ï°Ê²¼¤Î´Ø¿ô¤òÍѤ¤¤ÆÄêµÁ¤·¤Þ¤¹¡¥hookÉÕ¤­Âç°èÊÑ¿ô¤Î
-Ãͤλ²¾È¤äÀßÄê¤Ïhook¤Ç¹Ô¤¦É¬Íפ¬¤¢¤ê¤Þ¤¹¡¥
+ã“れら変数ã®ä»–ã«hookã‚’ã¤ã‘ãŸå¤§åŸŸå¤‰æ•°ã‚’定義ã§ãã¾ã™ï¼Žhook付ã
+ã®å¤§åŸŸå¤‰æ•°ã¯ä»¥ä¸‹ã®é–¢æ•°ã‚’用ã„ã¦å®šç¾©ã—ã¾ã™ï¼Žhook付ã大域変数ã®
+値ã®å‚照や設定ã¯hookã§è¡Œã†å¿…è¦ãŒã‚りã¾ã™ï¼Ž
void rb_define_hooked_variable(const char *name, VALUE *var,
VALUE (*getter)(), void (*setter)())
-¤³¤Î´Ø¿ô¤ÏC¤Î´Ø¿ô¤Ë¤è¤Ã¤Æhook¤Î¤Ä¤±¤é¤ì¤¿Âç°èÊÑ¿ô¤òÄêµÁ¤·¤Þ
-¤¹¡¥ÊÑ¿ô¤¬»²¾È¤µ¤ì¤¿»þ¤Ë¤Ï´Ø¿ôgetter¤¬¡¤ÊÑ¿ô¤ËÃͤ¬¥»¥Ã¥È¤µ¤ì
-¤¿»þ¤Ë¤Ï´Ø¿ôsetter¤¬¸Æ¤Ð¤ì¤ë¡¥hook¤ò»ØÄꤷ¤Ê¤¤¾ì¹ç¤Ïgetter¤ä
-setter¤Ë0¤ò»ØÄꤷ¤Þ¤¹¡¥
-# getter¤âsetter¤â0¤Ê¤é¤Ðrb_define_variable()¤ÈƱ¤¸¤Ë¤Ê¤ë¡¥
+ã“ã®é–¢æ•°ã¯Cã®é–¢æ•°ã«ã‚ˆã£ã¦hookã®ã¤ã‘られãŸå¤§åŸŸå¤‰æ•°ã‚’定義ã—ã¾
+ã™ï¼Žå¤‰æ•°ãŒå‚ç…§ã•ã‚ŒãŸæ™‚ã«ã¯é–¢æ•°getterãŒï¼Œå¤‰æ•°ã«å€¤ãŒã‚»ãƒƒãƒˆã•れ
+ãŸæ™‚ã«ã¯é–¢æ•°setterãŒå‘¼ã°ã‚Œã‚‹ï¼Žhookを指定ã—ãªã„å ´åˆã¯getterã‚„
+setterã«0を指定ã—ã¾ã™ï¼Ž
+# getterã‚‚setterã‚‚0ãªã‚‰ã°rb_define_variable()ã¨åŒã˜ã«ãªã‚‹ï¼Ž
-getter¤Èsetter¤Î»ÅÍͤϼ¡¤ÎÄ̤ê¤Ç¤¹¡¥
+getterã¨setterã®ä»•æ§˜ã¯æ¬¡ã®é€šã‚Šã§ã™ï¼Ž
VALUE (*getter)(ID id, VALUE *var);
void (*setter)(VALUE val, ID id, VALUE *var);
-¤½¤ì¤«¤é¡¤Âбþ¤¹¤ëC¤ÎÊÑ¿ô¤ò»ý¤¿¤Ê¤¤Ruby¤ÎÂç°èÊÑ¿ô¤òÄêµÁ¤¹¤ë
-¤³¤È¤â¤Ç¤­¤Þ¤¹. ¤½¤ÎÊÑ¿ô¤ÎÃͤϥե寴ؿô¤Î¤ß¤Ë¤è¤Ã¤Æ¼èÆÀ¡¦ÀßÄê
-¤µ¤ì¤Þ¤¹.
+ãれã‹ã‚‰ï¼Œå¯¾å¿œã™ã‚‹Cã®å¤‰æ•°ã‚’æŒãŸãªã„Rubyã®å¤§åŸŸå¤‰æ•°ã‚’定義ã™ã‚‹
+ã“ã¨ã‚‚ã§ãã¾ã™. ãã®å¤‰æ•°ã®å€¤ã¯ãƒ•ック関数ã®ã¿ã«ã‚ˆã£ã¦å–得・設定
+ã•れã¾ã™.
void rb_define_virtual_variable(const char *name,
VALUE (*getter)(), void (*setter)())
-¤³¤Î´Ø¿ô¤Ë¤è¤Ã¤ÆÄêµÁ¤µ¤ì¤¿Ruby¤ÎÂç°èÊÑ¿ô¤¬»²¾È¤µ¤ì¤¿»þ¤Ë¤Ï
-getter¤¬¡¤ÊÑ¿ô¤ËÃͤ¬¥»¥Ã¥È¤µ¤ì¤¿»þ¤Ë¤Ïsetter¤¬¸Æ¤Ð¤ì¤Þ¤¹¡¥
+ã“ã®é–¢æ•°ã«ã‚ˆã£ã¦å®šç¾©ã•れãŸRubyã®å¤§åŸŸå¤‰æ•°ãŒå‚ç…§ã•ã‚ŒãŸæ™‚ã«ã¯
+getterãŒï¼Œå¤‰æ•°ã«å€¤ãŒã‚»ãƒƒãƒˆã•ã‚ŒãŸæ™‚ã«ã¯setterãŒå‘¼ã°ã‚Œã¾ã™ï¼Ž
-getter¤Èsetter¤Î»ÅÍͤϰʲ¼¤ÎÄ̤ê¤Ç¤¹¡¥
+getterã¨setterã®ä»•様ã¯ä»¥ä¸‹ã®é€šã‚Šã§ã™ï¼Ž
(*getter)(ID id);
(*setter)(VALUE val, ID id);
-3.3 C¤Î¥Ç¡¼¥¿¤òRuby¥ª¥Ö¥¸¥§¥¯¥È¤Ë¤¹¤ë
+== Cã®ãƒ‡ãƒ¼ã‚¿ã‚’Rubyオブジェクトã«ã™ã‚‹
-C¤ÎÀ¤³¦¤ÇÄêµÁ¤µ¤ì¤¿¥Ç¡¼¥¿(¹½Â¤ÂÎ)¤òRuby¤Î¥ª¥Ö¥¸¥§¥¯¥È¤È¤·¤Æ
-¼è¤ê°·¤¤¤¿¤¤¾ì¹ç¤¬¤¢¤ê¤¨¤Þ¤¹¡¥¤³¤Î¤è¤¦¤Ê¾ì¹ç¤Ë¤Ï¡¤Data¤È¤¤¤¦
-Ruby¥ª¥Ö¥¸¥§¥¯¥È¤ËC¤Î¹½Â¤ÂÎ(¤Ø¤Î¥Ý¥¤¥ó¥¿)¤ò¤¯¤ë¤à¤³¤È¤ÇRuby
-¥ª¥Ö¥¸¥§¥¯¥È¤È¤·¤Æ¼è¤ê°·¤¨¤ë¤è¤¦¤Ë¤Ê¤ê¤Þ¤¹¡¥
+Cã®ä¸–界ã§å®šç¾©ã•れãŸãƒ‡ãƒ¼ã‚¿(構造体)ã‚’Rubyã®ã‚ªãƒ–ジェクトã¨ã—ã¦
+å–り扱ã„ãŸã„å ´åˆãŒã‚りãˆã¾ã™ï¼Žã“ã®ã‚ˆã†ãªå ´åˆã«ã¯ï¼ŒDataã¨ã„ã†
+Rubyオブジェクトã«Cã®æ§‹é€ ä½“(ã¸ã®ãƒã‚¤ãƒ³ã‚¿)ã‚’ãã‚‹ã‚€ã“ã¨ã§Ruby
+オブジェクトã¨ã—ã¦å–り扱ãˆã‚‹ã‚ˆã†ã«ãªã‚Šã¾ã™ï¼Ž
-Data¥ª¥Ö¥¸¥§¥¯¥È¤òÀ¸À®¤·¤Æ¹½Â¤ÂΤòRuby¥ª¥Ö¥¸¥§¥¯¥È¤Ë¥«¥×¥»¥ë
-²½¤¹¤ë¤¿¤á¤Ë¤Ï¡¤°Ê²¼¤Î¥Þ¥¯¥í¤ò»È¤¤¤Þ¤¹¡¥
+Dataオブジェクトを生æˆã—ã¦æ§‹é€ ä½“ã‚’Rubyオブジェクトã«ã‚«ãƒ—セル
+化ã™ã‚‹ãŸã‚ã«ã¯ï¼Œä»¥ä¸‹ã®ãƒžã‚¯ãƒ­ã‚’使ã„ã¾ã™ï¼Ž
- Data_Wrap_Struct(klass, mark, free, ptr)
+ Data_Wrap_Struct(klass, mark, free, sval)
-¤³¤Î¥Þ¥¯¥í¤ÎÌá¤êÃͤÏÀ¸À®¤µ¤ì¤¿Data¥ª¥Ö¥¸¥§¥¯¥È¤Ç¤¹¡¥
+ã“ã®ãƒžã‚¯ãƒ­ã®æˆ»ã‚Šå€¤ã¯ç”Ÿæˆã•れãŸDataオブジェクトã§ã™ï¼Ž
-klass¤Ï¤³¤ÎData¥ª¥Ö¥¸¥§¥¯¥È¤Î¥¯¥é¥¹¤Ç¤¹¡¥ptr¤Ï¥«¥×¥»¥ë²½¤¹¤ë
-C¤Î¹½Â¤ÂΤؤΥݥ¤¥ó¥¿¤Ç¤¹¡¥mark¤Ï¤³¤Î¹½Â¤ÂΤ¬Ruby¤Î¥ª¥Ö¥¸¥§
-¥¯¥È¤Ø¤Î»²¾È¤¬¤¢¤ë»þ¤Ë»È¤¦´Ø¿ô¤Ç¤¹¡¥¤½¤Î¤è¤¦¤Ê»²¾È¤ò´Þ¤Þ¤Ê¤¤
-»þ¤Ë¤Ï0¤ò»ØÄꤷ¤Þ¤¹¡¥
+klassã¯ã“ã®Dataオブジェクトã®ã‚¯ãƒ©ã‚¹ã§ã™ï¼Žmarkã¯ã“ã®æ§‹é€ ä½“ãŒ
+Rubyã®ã‚ªãƒ–ジェクトã¸ã®å‚ç…§ãŒã‚る時ã«ä½¿ã†é–¢æ•°ã§ã™ï¼Žãã®ã‚ˆã†ãª
+å‚ç…§ã‚’å«ã¾ãªã„時ã«ã¯0を指定ã—ã¾ã™ï¼Ž
-# ¤½¤Î¤è¤¦¤Ê»²¾È¤Ï´«¤á¤é¤ì¤Þ¤»¤ó¡¥
+# ãã®ã‚ˆã†ãªå‚ç…§ã¯å‹§ã‚られã¾ã›ã‚“.
-free¤Ï¤³¤Î¹½Â¤ÂΤ¬¤â¤¦ÉÔÍפˤʤä¿»þ¤Ë¸Æ¤Ð¤ì¤ë´Ø¿ô¤Ç¤¹¡¥¤³¤Î
-´Ø¿ô¤¬¥¬¡¼¥Ù¡¼¥¸¥³¥ì¥¯¥¿¤«¤é¸Æ¤Ð¤ì¤Þ¤¹¡¥¤³¤ì¤¬-1¤Î¾ì¹ç¤Ï¡¤Ã±
-½ã¤Ë³«Êü¤µ¤ì¤Þ¤¹¡¥
+freeã¯ã“ã®æ§‹é€ ä½“ãŒã‚‚ã†ä¸è¦ã«ãªã£ãŸæ™‚ã«å‘¼ã°ã‚Œã‚‹é–¢æ•°ã§ã™ï¼Žã“ã®
+関数ãŒã‚¬ãƒ¼ãƒ™ãƒ¼ã‚¸ã‚³ãƒ¬ã‚¯ã‚¿ã‹ã‚‰å‘¼ã°ã‚Œã¾ã™ï¼Žã“れãŒ-1ã®å ´åˆã¯ï¼Œå˜
+ç´”ã«é–‹æ”¾ã•れã¾ã™ï¼Ž
-mark¤ª¤è¤Ófree´Ø¿ô¤ÏGC¼Â¹ÔÃæ¤Ë¸Æ¤Ó½Ð¤µ¤ì¤Þ¤¹.
-¤Ê¤ª, GC¼Â¹ÔÃæ¤ÏRuby¥ª¥Ö¥¸¥§¥¯¥È¤Î¥¢¥í¥±¡¼¥·¥ç¥ó¤Ï¶Ø»ß¤µ¤ì¤Þ
-¤¹. ¤è¤Ã¤Æ, mark¤ª¤è¤Ófree´Ø¿ô¤ÇRuby¥ª¥Ö¥¸¥§¥¯¥È¤Î¥¢¥í¥±¡¼¥·
-¥ç¥ó¤Ï¹Ô¤ï¤Ê¤¤¤Ç¤¯¤À¤µ¤¤.
+markãŠã‚ˆã³free関数ã¯GC実行中ã«å‘¼ã³å‡ºã•れã¾ã™.
+ãªãŠ, GC実行中ã¯Rubyオブジェクトã®ã‚¢ãƒ­ã‚±ãƒ¼ã‚·ãƒ§ãƒ³ã¯ç¦æ­¢ã•れã¾
+ã™. よã£ã¦, markãŠã‚ˆã³free関数ã§Rubyオブジェクトã®ã‚¢ãƒ­ã‚±ãƒ¼ã‚·
+ョンã¯è¡Œã‚ãªã„ã§ãã ã•ã„.
-C¤Î¹½Â¤ÂΤγäÅö¤ÈData¥ª¥Ö¥¸¥§¥¯¥È¤ÎÀ¸À®¤òƱ»þ¤Ë¹Ô¤¦¥Þ¥¯¥í¤È
-¤·¤Æ°Ê²¼¤Î¤â¤Î¤¬Ä󶡤µ¤ì¤Æ¤¤¤Þ¤¹¡¥
+Cã®æ§‹é€ ä½“ã®å‰²å½“ã¨Dataオブジェクトã®ç”Ÿæˆã‚’åŒæ™‚ã«è¡Œã†ãƒžã‚¯ãƒ­ã¨
+ã—ã¦ä»¥ä¸‹ã®ã‚‚ã®ãŒæä¾›ã•れã¦ã„ã¾ã™ï¼Ž
Data_Make_Struct(klass, type, mark, free, sval)
-¤³¤Î¥Þ¥¯¥í¤ÎÌá¤êÃͤÏÀ¸À®¤µ¤ì¤¿Data¥ª¥Ö¥¸¥§¥¯¥È¤Ç¤¹¡¥
+ã“ã®ãƒžã‚¯ãƒ­ã®æˆ»ã‚Šå€¤ã¯ç”Ÿæˆã•れãŸDataオブジェクトã§ã™ï¼Žã“ã®ãƒžã‚¯
+ロã¯ä»¥ä¸‹ã®å¼ã®ã‚ˆã†ã«åƒãã¾ã™:
-klass, mark, free¤ÏData_Wrap_Struct¤ÈƱ¤¸Æ¯¤­¤ò¤·¤Þ¤¹¡¥type
-¤Ï³ä¤êÅö¤Æ¤ëC¹½Â¤ÂΤη¿¤Ç¤¹¡¥³ä¤êÅö¤Æ¤é¤ì¤¿¹½Â¤ÂΤÏÊÑ¿ôsval
-¤ËÂåÆþ¤µ¤ì¤Þ¤¹¡¥¤³¤ÎÊÑ¿ô¤Î·¿¤Ï (type*) ¤Ç¤¢¤ëɬÍפ¬¤¢¤ê¤Þ¤¹¡¥
+ (sval = ALLOC(type), Data_Wrap_Struct(klass, mark, free, sval))
-Data¥ª¥Ö¥¸¥§¥¯¥È¤«¤é¥Ý¥¤¥ó¥¿¤ò¼è¤ê½Ð¤¹¤Î¤Ï°Ê²¼¤Î¥Þ¥¯¥í¤òÍѤ¤
-¤Þ¤¹¡¥
+klass, mark, freeã¯Data_Wrap_Structã¨åŒã˜åƒãã‚’ã—ã¾ã™ï¼Žtype
+ã¯å‰²ã‚Šå½“ã¦ã‚‹C構造体ã®åž‹ã§ã™ï¼Žå‰²ã‚Šå½“ã¦ã‚‰ã‚ŒãŸæ§‹é€ ä½“ã¯å¤‰æ•°sval
+ã«ä»£å…¥ã•れã¾ã™ï¼Žã“ã®å¤‰æ•°ã®åž‹ã¯ (type*) ã§ã‚ã‚‹å¿…è¦ãŒã‚りã¾ã™ï¼Ž
+
+Dataオブジェクトã‹ã‚‰ãƒã‚¤ãƒ³ã‚¿ã‚’å–り出ã™ã®ã¯ä»¥ä¸‹ã®ãƒžã‚¯ãƒ­ã‚’用ã„
+ã¾ã™ï¼Ž
Data_Get_Struct(obj, type, sval)
-C¤Î¹½Â¤ÂΤؤΥݥ¤¥ó¥¿¤ÏÊÑ¿ôsval¤ËÂåÆþ¤µ¤ì¤Þ¤¹¡¥
+Cã®æ§‹é€ ä½“ã¸ã®ãƒã‚¤ãƒ³ã‚¿ã¯å¤‰æ•°svalã«ä»£å…¥ã•れã¾ã™ï¼Ž
-¤³¤ì¤é¤ÎData¤Î»È¤¤Êý¤Ï¤Á¤ç¤Ã¤Èʬ¤«¤ê¤Ë¤¯¤¤¤Î¤Ç¡¤¸å¤ÇÀâÌÀ¤¹¤ë
-ÎãÂê¤ò»²¾È¤·¤Æ¤¯¤À¤µ¤¤¡¥
+ã“れらã®Dataã®ä½¿ã„æ–¹ã¯ã¡ã‚‡ã£ã¨åˆ†ã‹ã‚Šã«ãã„ã®ã§ï¼Œå¾Œã§èª¬æ˜Žã™ã‚‹
+例題をå‚ç…§ã—ã¦ãã ã•ã„.
-4¡¥ÎãÂê - dbm¥Ñ¥Ã¥±¡¼¥¸¤òºî¤ë
+= 例題 - dbmパッケージを作る
-¤³¤³¤Þ¤Ç¤ÎÀâÌÀ¤Ç¤È¤ê¤¢¤¨¤º³ÈÄ¥¥é¥¤¥Ö¥é¥ê¤Ïºî¤ì¤ë¤Ï¤º¤Ç¤¹¡¥
-Ruby¤Îext¥Ç¥£¥ì¥¯¥È¥ê¤Ë¤¹¤Ç¤Ë´Þ¤Þ¤ì¤Æ¤¤¤ëdbm¥é¥¤¥Ö¥é¥ê¤òÎã¤Ë
-¤·¤ÆÃʳ¬Åª¤ËÀâÌÀ¤·¤Þ¤¹¡¥
+ã“ã“ã¾ã§ã®èª¬æ˜Žã§ã¨ã‚Šã‚ãˆãšæ‹¡å¼µãƒ©ã‚¤ãƒ–ãƒ©ãƒªã¯ä½œã‚Œã‚‹ã¯ãšã§ã™ï¼Ž
+Rubyã®extディレクトリã«ã™ã§ã«å«ã¾ã‚Œã¦ã„ã‚‹dbmライブラリを例ã«
+ã—ã¦æ®µéšŽçš„ã«èª¬æ˜Žã—ã¾ã™ï¼Ž
-(1) ¥Ç¥£¥ì¥¯¥È¥ê¤òºî¤ë
+== ディレクトリを作る
% mkdir ext/dbm
-Ruby 1.1¤«¤é¤ÏǤ°Õ¤Î¥Ç¥£¥ì¥¯¥È¥ê¤Ç¥À¥¤¥Ê¥ß¥Ã¥¯¥é¥¤¥Ö¥é¥ê¤òºî
-¤ë¤³¤È¤¬¤Ç¤­¤ë¤è¤¦¤Ë¤Ê¤ê¤Þ¤·¤¿¡¥Ruby¤ËÀÅŪ¤Ë¥ê¥ó¥¯¤¹¤ë¾ì¹ç¤Ë
-¤ÏRuby¤òŸ³«¤·¤¿¥Ç¥£¥ì¥¯¥È¥ê¤Î²¼¡¤ext¥Ç¥£¥ì¥¯¥È¥ê¤ÎÃæ¤Ë³ÈÄ¥
-¥é¥¤¥Ö¥é¥êÍѤΥǥ£¥ì¥¯¥È¥ê¤òºî¤ëɬÍפ¬¤¢¤ê¤Þ¤¹¡¥Ì¾Á°¤ÏŬÅö¤Ë
-Áª¤ó¤Ç¹½¤¤¤Þ¤»¤ó¡¥
-
-(2) À߷פ¹¤ë
-
-¤Þ¤¢¡¤ÅöÁ³¤Ê¤ó¤Ç¤¹¤±¤É¡¤¤É¤¦¤¤¤¦µ¡Ç½¤ò¼Â¸½¤¹¤ë¤«¤É¤¦¤«¤Þ¤ºÀß
-·×¤¹¤ëɬÍפ¬¤¢¤ê¤Þ¤¹¡¥¤É¤ó¤Ê¥¯¥é¥¹¤ò¤Ä¤¯¤ë¤«¡¤¤½¤Î¥¯¥é¥¹¤Ë¤Ï
-¤É¤ó¤Ê¥á¥½¥Ã¥É¤¬¤¢¤ë¤«¡¤¥¯¥é¥¹¤¬Ä󶡤¹¤ëÄê¿ô¤Ê¤É¤Ë¤Ä¤¤¤ÆÀß·×
-¤·¤Þ¤¹¡¥
-
-(3) C¥³¡¼¥É¤ò½ñ¤¯
-
-³ÈÄ¥¥é¥¤¥Ö¥é¥êËÜÂΤȤʤëC¸À¸ì¤Î¥½¡¼¥¹¤ò½ñ¤­¤Þ¤¹¡¥C¸À¸ì¤Î¥½¡¼
-¥¹¤¬¤Ò¤È¤Ä¤Î»þ¤Ë¤Ï¡Ö¥é¥¤¥Ö¥é¥ê̾.c¡×¤òÁª¤Ö¤ÈÎɤ¤¤Ç¤·¤ç¤¦¡¥C
-¸À¸ì¤Î¥½¡¼¥¹¤¬Ê£¿ô¤Î¾ì¹ç¤Ë¤ÏµÕ¤Ë¡Ö¥é¥¤¥Ö¥é¥ê̾.c¡×¤È¤¤¤¦¥Õ¥¡
-¥¤¥ë̾¤ÏÈò¤±¤ëɬÍפ¬¤¢¤ê¤Þ¤¹¡¥¥ª¥Ö¥¸¥§¥¯¥È¥Õ¥¡¥¤¥ë¤È¥â¥¸¥å¡¼
-¥ëÀ¸À®»þ¤ËÃæ´ÖŪ¤ËÀ¸À®¤µ¤ì¤ë¡Ö¥é¥¤¥Ö¥é¥ê̾.o¡×¤È¤¤¤¦¥Õ¥¡¥¤¥ë
-¤È¤¬¾×ÆÍ¤¹¤ë¤«¤é¤Ç¤¹¡¥¤Þ¤¿¡¤¸å½Ò¤¹¤ë mkmf ¥é¥¤¥Ö¥é¥ê¤Î¤¤¤¯¤Ä
-¤«¤Î´Ø¿ô¤¬¥³¥ó¥Ñ¥¤¥ë¤òÍפ¹¤ë¥Æ¥¹¥È¤Î¤¿¤á¤Ë¡Öconftest.c¡×¤È¤¤
-¤¦¥Õ¥¡¥¤¥ë̾¤ò»ÈÍѤ¹¤ë¤³¤È¤ËÃí°Õ¤·¤Æ¤¯¤À¤µ¤¤¡¥¥½¡¼¥¹¥Õ¥¡¥¤¥ë
-̾¤È¤·¤Æ¡Öconftest.c¡×¤ò»ÈÍѤ·¤Æ¤Ï¤Ê¤ê¤Þ¤»¤ó¡¥
-
-Ruby¤Ï³ÈÄ¥¥é¥¤¥Ö¥é¥ê¤ò¥í¡¼¥É¤¹¤ë»þ¤Ë¡ÖInit_¥é¥¤¥Ö¥é¥ê̾¡×¤È
-¤¤¤¦´Ø¿ô¤ò¼«Æ°Åª¤Ë¼Â¹Ô¤·¤Þ¤¹¡¥dbm¥é¥¤¥Ö¥é¥ê¤Î¾ì¹ç¡ÖInit_dbm¡×
-¤Ç¤¹¡¥¤³¤Î´Ø¿ô¤ÎÃæ¤Ç¥¯¥é¥¹¡¤¥â¥¸¥å¡¼¥ë¡¤¥á¥½¥Ã¥É¡¤Äê¿ô¤Ê¤É¤Î
-ÄêµÁ¤ò¹Ô¤¤¤Þ¤¹¡¥dbm.c¤«¤é°ìÉô°úÍѤ·¤Þ¤¹¡¥
-
---
-void
-Init_dbm(void)
-{
- /* DBM¥¯¥é¥¹¤òÄêµÁ¤¹¤ë */
- cDBM = rb_define_class("DBM", rb_cObject);
- /* DBM¤ÏEnumerate¥â¥¸¥å¡¼¥ë¤ò¥¤¥ó¥¯¥ë¡¼¥É¤¹¤ë */
- rb_include_module(cDBM, rb_mEnumerable);
-
- /* DBM¥¯¥é¥¹¤Î¥¯¥é¥¹¥á¥½¥Ã¥Éopen(): °ú¿ô¤ÏC¤ÎÇÛÎó¤Ç¼õ¤±¤ë */
- rb_define_singleton_method(cDBM, "open", fdbm_s_open, -1);
-
- /* DBM¥¯¥é¥¹¤Î¥á¥½¥Ã¥Éclose(): °ú¿ô¤Ï¤Ê¤· */
- rb_define_method(cDBM, "close", fdbm_close, 0);
- /* DBM¥¯¥é¥¹¤Î¥á¥½¥Ã¥É[]: °ú¿ô¤Ï1¸Ä */
- rb_define_method(cDBM, "[]", fdbm_fetch, 1);
- :
-
- /* DBM¥Ç¡¼¥¿¤ò³ÊǼ¤¹¤ë¥¤¥ó¥¹¥¿¥ó¥¹ÊÑ¿ô̾¤Î¤¿¤á¤ÎID */
- id_dbm = rb_intern("dbm");
-}
---
-
-DBM¥é¥¤¥Ö¥é¥ê¤Ïdbm¤Î¥Ç¡¼¥¿¤ÈÂбþ¤¹¤ë¥ª¥Ö¥¸¥§¥¯¥È¤Ë¤Ê¤ë¤Ï¤º¤Ç
-¤¹¤«¤é¡¤C¤ÎÀ¤³¦¤Îdbm¤òRuby¤ÎÀ¤³¦¤Ë¼è¤ê¹þ¤àɬÍפ¬¤¢¤ê¤Þ¤¹¡¥
-
-
-dbm.c¤Ç¤ÏData_Make_Struct¤ò°Ê²¼¤Î¤è¤¦¤Ë»È¤Ã¤Æ¤¤¤Þ¤¹¡¥
-
---
-struct dbmdata {
- int di_size;
- DBM *di_dbm;
-};
-
-
-obj = Data_Make_Struct(klass, struct dbmdata, 0, free_dbm, dbmp);
---
-
-¤³¤³¤Ç¤Ïdbmstruct¹½Â¤ÂΤؤΥݥ¤¥ó¥¿¤òData¤Ë¥«¥×¥»¥ë²½¤·¤Æ¤¤
-¤Þ¤¹¡¥DBM*¤òľÀÜ¥«¥×¥»¥ë²½¤·¤Ê¤¤¤Î¤Ïclose()¤·¤¿»þ¤Î½èÍý¤ò¹Í
-¤¨¤Æ¤Î¤³¤È¤Ç¤¹¡¥
-
-Data¥ª¥Ö¥¸¥§¥¯¥È¤«¤édbmstruct¹½Â¤ÂΤΥݥ¤¥ó¥¿¤ò¼è¤ê½Ð¤¹¤¿¤á
-¤Ë°Ê²¼¤Î¥Þ¥¯¥í¤ò»È¤Ã¤Æ¤¤¤Þ¤¹¡¥
-
---
-#define GetDBM(obj, dbmp) {\
- Data_Get_Struct(obj, struct dbmdata, dbmp);\
- if (dbmp->di_dbm == 0) closed_dbm();\
-}
---
-
-¤Á¤ç¤Ã¤ÈÊ£»¨¤Ê¥Þ¥¯¥í¤Ç¤¹¤¬¡¤Íפ¹¤ë¤Ëdbmdata¹½Â¤ÂΤΥݥ¤¥ó¥¿
-¤Î¼è¤ê½Ð¤·¤È¡¤close¤µ¤ì¤Æ¤¤¤ë¤«¤É¤¦¤«¤Î¥Á¥§¥Ã¥¯¤ò¤Þ¤È¤á¤Æ¤¤
-¤ë¤À¤±¤Ç¤¹¡¥
-
-DBM¥¯¥é¥¹¤Ë¤Ï¤¿¤¯¤µ¤ó¥á¥½¥Ã¥É¤¬¤¢¤ê¤Þ¤¹¤¬¡¤Ê¬Îह¤ë¤È3¼ïÎà¤Î
-°ú¿ô¤Î¼õ¤±Êý¤¬¤¢¤ê¤Þ¤¹¡¥¤Ò¤È¤Ä¤Ï°ú¿ô¤Î¿ô¤¬¸ÇÄê¤Î¤â¤Î¤Ç¡¤Îã¤È
-¤·¤Æ¤Ïdelete¥á¥½¥Ã¥É¤¬¤¢¤ê¤Þ¤¹¡¥delete¥á¥½¥Ã¥É¤ò¼ÂÁõ¤·¤Æ¤¤¤ë
-fdbm_delete()¤Ï¤³¤Î¤è¤¦¤Ë¤Ê¤Ã¤Æ¤¤¤Þ¤¹¡¥
-
---
-static VALUE
-fdbm_delete(VALUE obj, VALUE keystr)
-{
- :
-}
---
-
-°ú¿ô¤Î¿ô¤¬¸ÇÄê¤Î¥¿¥¤¥×¤ÏÂè1°ú¿ô¤¬self¡¤Âè2°ú¿ô°Ê¹ß¤¬¥á¥½¥Ã¥É
-¤Î°ú¿ô¤È¤Ê¤ê¤Þ¤¹¡¥
-
-°ú¿ô¤Î¿ô¤¬ÉÔÄê¤Î¤â¤Î¤ÏC¤ÎÇÛÎó¤Ç¼õ¤±¤ë¤â¤Î¤ÈRuby¤ÎÇÛÎó¤Ç¼õ¤±
-¤ë¤â¤Î¤È¤¬¤¢¤ê¤Þ¤¹¡¥dbm¥é¥¤¥Ö¥é¥ê¤ÎÃæ¤Ç¡¤C¤ÎÇÛÎó¤Ç¼õ¤±¤ë¤â¤Î
-¤ÏDBM¤Î¥¯¥é¥¹¥á¥½¥Ã¥É¤Ç¤¢¤ëopen()¤Ç¤¹¡¥¤³¤ì¤ò¼ÂÁõ¤·¤Æ¤¤¤ë´Ø
-¿ôfdbm_s_open()¤Ï¤³¤¦¤Ê¤Ã¤Æ¤¤¤Þ¤¹¡¥
-
---
-static VALUE
-fdbm_s_open(int argc, VALUE *argv, VALUE klass)
-{
- :
- if (rb_scan_args(argc, argv, "11", &file, &vmode) == 1) {
- mode = 0666; /* default value */
- }
- :
-}
---
-
-¤³¤Î¥¿¥¤¥×¤Î´Ø¿ô¤ÏÂè1°ú¿ô¤¬Í¿¤¨¤é¤ì¤¿°ú¿ô¤Î¿ô¡¤Âè2°ú¿ô¤¬Í¿¤¨
-¤é¤ì¤¿°ú¿ô¤ÎÆþ¤Ã¤Æ¤¤¤ëÇÛÎó¤Ë¤Ê¤ê¤Þ¤¹¡¥self¤ÏÂè3°ú¿ô¤È¤·¤ÆÍ¿
-¤¨¤é¤ì¤Þ¤¹¡¥
-
-¤³¤ÎÇÛÎó¤ÇÍ¿¤¨¤é¤ì¤¿°ú¿ô¤ò²òÀϤ¹¤ë¤¿¤á¤Î´Ø¿ô¤¬open()¤Ç¤â»È¤ï
-¤ì¤Æ¤¤¤ërb_scan_args()¤Ç¤¹¡¥Âè3°ú¿ô¤Ë»ØÄꤷ¤¿¥Õ¥©¡¼¥Þ¥Ã¥È¤Ë½¾
-¤¤¡¤Âè4ÊÑ¿ô°Ê¹ß¤Ë»ØÄꤷ¤¿VALUE¤Ø¤Î»²¾È¤ËÃͤòÂåÆþ¤·¤Æ¤¯¤ì¤Þ
-¤¹¡¥
-
-
-°ú¿ô¤òRuby¤ÎÇÛÎó¤È¤·¤Æ¼õ¤±¼è¤ë¥á¥½¥Ã¥É¤ÎÎã¤Ë¤Ï
-Thread#initialize¤¬¤¢¤ê¤Þ¤¹¡¥¼ÂÁõ¤Ï¤³¤¦¤Ç¤¹¡¥
-
---
-static VALUE
-thread_initialize(VALUE thread, VALUE args)
-{
- :
-}
---
-
-Âè1°ú¿ô¤Ïself¡¤Âè2°ú¿ô¤ÏRuby¤ÎÇÛÎó¤Ç¤¹¡¥
-
-** Ãí°Õ»ö¹à
-
-Ruby¤È¶¦Í­¤Ï¤·¤Ê¤¤¤¬Ruby¤Î¥ª¥Ö¥¸¥§¥¯¥È¤ò³ÊǼ¤¹¤ë²ÄǽÀ­¤Î¤¢¤ë
-C¤ÎÂç°èÊÑ¿ô¤Ï°Ê²¼¤Î´Ø¿ô¤ò»È¤Ã¤ÆRuby¥¤¥ó¥¿¥×¥ê¥¿¤ËÊÑ¿ô¤Î¸ºß
-¤ò¶µ¤¨¤Æ¤¢¤²¤Æ¤¯¤À¤µ¤¤¡¥¤Ç¤Ê¤¤¤ÈGC¤Ç¥È¥é¥Ö¥ë¤òµ¯¤³¤·¤Þ¤¹¡¥
+Ruby 1.1ã‹ã‚‰ã¯ä»»æ„ã®ãƒ‡ã‚£ãƒ¬ã‚¯ãƒˆãƒªã§ãƒ€ã‚¤ãƒŠãƒŸãƒƒã‚¯ãƒ©ã‚¤ãƒ–ラリを作
+ã‚‹ã“ã¨ãŒã§ãるよã†ã«ãªã‚Šã¾ã—ãŸï¼ŽRubyã«é™çš„ã«ãƒªãƒ³ã‚¯ã™ã‚‹å ´åˆã«
+ã¯Rubyを展開ã—ãŸãƒ‡ã‚£ãƒ¬ã‚¯ãƒˆãƒªã®ä¸‹ï¼Œextディレクトリã®ä¸­ã«æ‹¡å¼µ
+ライブラリ用ã®ãƒ‡ã‚£ãƒ¬ã‚¯ãƒˆãƒªã‚’作る必è¦ãŒã‚りã¾ã™ï¼Žåå‰ã¯é©å½“ã«
+é¸ã‚“ã§æ§‹ã„ã¾ã›ã‚“.
+
+== 設計ã™ã‚‹
+
+ã¾ã‚,当然ãªã‚“ã§ã™ã‘ã©ï¼Œã©ã†ã„ã†æ©Ÿèƒ½ã‚’実ç¾ã™ã‚‹ã‹ã©ã†ã‹ã¾ãšè¨­
+計ã™ã‚‹å¿…è¦ãŒã‚りã¾ã™ï¼Žã©ã‚“ãªã‚¯ãƒ©ã‚¹ã‚’ã¤ãã‚‹ã‹ï¼Œãã®ã‚¯ãƒ©ã‚¹ã«ã¯
+ã©ã‚“ãªãƒ¡ã‚½ãƒƒãƒ‰ãŒã‚ã‚‹ã‹ï¼Œã‚¯ãƒ©ã‚¹ãŒæä¾›ã™ã‚‹å®šæ•°ãªã©ã«ã¤ã„ã¦è¨­è¨ˆ
+ã—ã¾ã™ï¼Ž
+
+== Cコードを書ã
+
+拡張ライブラリ本体ã¨ãªã‚‹C言語ã®ã‚½ãƒ¼ã‚¹ã‚’書ãã¾ã™ï¼ŽC言語ã®ã‚½ãƒ¼
+スãŒã²ã¨ã¤ã®æ™‚ã«ã¯ã€Œãƒ©ã‚¤ãƒ–ラリå.cã€ã‚’é¸ã¶ã¨è‰¯ã„ã§ã—ょã†ï¼ŽC
+言語ã®ã‚½ãƒ¼ã‚¹ãŒè¤‡æ•°ã®å ´åˆã«ã¯é€†ã«ã€Œãƒ©ã‚¤ãƒ–ラリå.cã€ã¨ã„ã†ãƒ•ã‚¡
+イルåã¯é¿ã‘ã‚‹å¿…è¦ãŒã‚りã¾ã™ï¼Žã‚ªãƒ–ジェクトファイルã¨ãƒ¢ã‚¸ãƒ¥ãƒ¼
+ãƒ«ç”Ÿæˆæ™‚ã«ä¸­é–“çš„ã«ç”Ÿæˆã•れる「ライブラリå.oã€ã¨ã„ã†ãƒ•ァイル
+ã¨ãŒè¡çªã™ã‚‹ã‹ã‚‰ã§ã™ï¼Žã¾ãŸï¼Œå¾Œè¿°ã™ã‚‹ mkmf ライブラリã®ã„ãã¤
+ã‹ã®é–¢æ•°ãŒã‚³ãƒ³ãƒ‘イルをè¦ã™ã‚‹ãƒ†ã‚¹ãƒˆã®ãŸã‚ã«ã€Œconftest.cã€ã¨ã„
+ã†ãƒ•ァイルåを使用ã™ã‚‹ã“ã¨ã«æ³¨æ„ã—ã¦ãã ã•ã„.ソースファイル
+åã¨ã—ã¦ã€Œconftest.cã€ã‚’使用ã—ã¦ã¯ãªã‚Šã¾ã›ã‚“.
+
+Rubyã¯æ‹¡å¼µãƒ©ã‚¤ãƒ–ラリをロードã™ã‚‹æ™‚ã«ã€ŒInit_ライブラリåã€ã¨
+ã„ã†é–¢æ•°ã‚’自動的ã«å®Ÿè¡Œã—ã¾ã™ï¼Ždbmライブラリã®å ´åˆã€ŒInit_dbmã€
+ã§ã™ï¼Žã“ã®é–¢æ•°ã®ä¸­ã§ã‚¯ãƒ©ã‚¹ï¼Œãƒ¢ã‚¸ãƒ¥ãƒ¼ãƒ«ï¼Œãƒ¡ã‚½ãƒƒãƒ‰ï¼Œå®šæ•°ãªã©ã®
+定義を行ã„ã¾ã™ï¼Ždbm.cã‹ã‚‰ä¸€éƒ¨å¼•用ã—ã¾ã™ï¼Ž
+
+ void
+ Init_dbm(void)
+ {
+ /* DBMクラスを定義ã™ã‚‹ */
+ cDBM = rb_define_class("DBM", rb_cObject);
+ /* DBMã¯Enumerateモジュールをインクルードã™ã‚‹ */
+ rb_include_module(cDBM, rb_mEnumerable);
+
+ /* DBMクラスã®ã‚¯ãƒ©ã‚¹ãƒ¡ã‚½ãƒƒãƒ‰open(): 引数ã¯Cã®é…列ã§å—ã‘ã‚‹ */
+ rb_define_singleton_method(cDBM, "open", fdbm_s_open, -1);
+
+ /* DBMクラスã®ãƒ¡ã‚½ãƒƒãƒ‰close(): 引数ã¯ãªã— */
+ rb_define_method(cDBM, "close", fdbm_close, 0);
+ /* DBMクラスã®ãƒ¡ã‚½ãƒƒãƒ‰[]: 引数ã¯1個 */
+ rb_define_method(cDBM, "[]", fdbm_fetch, 1);
+
+ /* ... */
+
+ /* DBMデータを格ç´ã™ã‚‹ã‚¤ãƒ³ã‚¹ã‚¿ãƒ³ã‚¹å¤‰æ•°åã®ãŸã‚ã®ID */
+ id_dbm = rb_intern("dbm");
+ }
+
+DBMライブラリã¯dbmã®ãƒ‡ãƒ¼ã‚¿ã¨å¯¾å¿œã™ã‚‹ã‚ªãƒ–ジェクトã«ãªã‚‹ã¯ãšã§
+ã™ã‹ã‚‰ï¼ŒCã®ä¸–界ã®dbmã‚’Rubyã®ä¸–界ã«å–り込む必è¦ãŒã‚りã¾ã™ï¼Ž
+
+dbm.cã§ã¯Data_Make_Structを以下ã®ã‚ˆã†ã«ä½¿ã£ã¦ã„ã¾ã™ï¼Ž
+
+ struct dbmdata {
+ int di_size;
+ DBM *di_dbm;
+ };
+
+
+ obj = Data_Make_Struct(klass, struct dbmdata, 0, free_dbm, dbmp);
+
+ã“ã“ã§ã¯dbmstruct構造体ã¸ã®ãƒã‚¤ãƒ³ã‚¿ã‚’Dataã«ã‚«ãƒ—セル化ã—ã¦ã„
+ã¾ã™ï¼ŽDBM*を直接カプセル化ã—ãªã„ã®ã¯close()ã—ãŸæ™‚ã®å‡¦ç†ã‚’考
+ãˆã¦ã®ã“ã¨ã§ã™ï¼Ž
+
+Dataオブジェクトã‹ã‚‰dbmstruct構造体ã®ãƒã‚¤ãƒ³ã‚¿ã‚’å–り出ã™ãŸã‚
+ã«ä»¥ä¸‹ã®ãƒžã‚¯ãƒ­ã‚’使ã£ã¦ã„ã¾ã™ï¼Ž
+
+ #define GetDBM(obj, dbmp) {\
+ Data_Get_Struct(obj, struct dbmdata, dbmp);\
+ if (dbmp->di_dbm == 0) closed_dbm();\
+ }
+
+ã¡ã‚‡ã£ã¨è¤‡é›‘ãªãƒžã‚¯ãƒ­ã§ã™ãŒï¼Œè¦ã™ã‚‹ã«dbmdata構造体ã®ãƒã‚¤ãƒ³ã‚¿
+ã®å–り出ã—ã¨ï¼Œcloseã•れã¦ã„ã‚‹ã‹ã©ã†ã‹ã®ãƒã‚§ãƒƒã‚¯ã‚’ã¾ã¨ã‚ã¦ã„
+ã‚‹ã ã‘ã§ã™ï¼Ž
+
+DBMクラスã«ã¯ãŸãã•んメソッドãŒã‚りã¾ã™ãŒï¼Œåˆ†é¡žã™ã‚‹ã¨3種類ã®
+引数ã®å—ã‘æ–¹ãŒã‚りã¾ã™ï¼Žã²ã¨ã¤ã¯å¼•æ•°ã®æ•°ãŒå›ºå®šã®ã‚‚ã®ã§ï¼Œä¾‹ã¨
+ã—ã¦ã¯deleteメソッドãŒã‚りã¾ã™ï¼Ždeleteメソッドを実装ã—ã¦ã„ã‚‹
+fdbm_delete()ã¯ã“ã®ã‚ˆã†ã«ãªã£ã¦ã„ã¾ã™ï¼Ž
+
+ static VALUE
+ fdbm_delete(VALUE obj, VALUE keystr)
+ {
+ /* ... */
+ }
+
+å¼•æ•°ã®æ•°ãŒå›ºå®šã®ã‚¿ã‚¤ãƒ—ã¯ç¬¬1引数ãŒself,第2引数以é™ãŒãƒ¡ã‚½ãƒƒãƒ‰
+ã®å¼•æ•°ã¨ãªã‚Šã¾ã™ï¼Ž
+
+å¼•æ•°ã®æ•°ãŒä¸å®šã®ã‚‚ã®ã¯Cã®é…列ã§å—ã‘ã‚‹ã‚‚ã®ã¨Rubyã®é…列ã§å—ã‘
+ã‚‹ã‚‚ã®ã¨ãŒã‚りã¾ã™ï¼Ždbmライブラリã®ä¸­ã§ï¼ŒCã®é…列ã§å—ã‘ã‚‹ã‚‚ã®
+ã¯DBMã®ã‚¯ãƒ©ã‚¹ãƒ¡ã‚½ãƒƒãƒ‰ã§ã‚ã‚‹open()ã§ã™ï¼Žã“れを実装ã—ã¦ã„ã‚‹é–¢
+æ•°fdbm_s_open()ã¯ã“ã†ãªã£ã¦ã„ã¾ã™ï¼Ž
+
+ static VALUE
+ fdbm_s_open(int argc, VALUE *argv, VALUE klass)
+ {
+ /* ... */
+
+ if (rb_scan_args(argc, argv, "11", &file, &vmode) == 1) {
+ mode = 0666; /* default value */
+ }
+
+ /* ... */
+ }
+
+ã“ã®ã‚¿ã‚¤ãƒ—ã®é–¢æ•°ã¯ç¬¬1引数ãŒä¸Žãˆã‚‰ã‚ŒãŸå¼•æ•°ã®æ•°ï¼Œç¬¬2引数ãŒä¸Žãˆ
+られãŸå¼•æ•°ã®å…¥ã£ã¦ã„ã‚‹é…列ã«ãªã‚Šã¾ã™ï¼Žselfã¯ç¬¬3引数ã¨ã—ã¦ä¸Ž
+ãˆã‚‰ã‚Œã¾ã™ï¼Ž
+
+ã“ã®é…列ã§ä¸Žãˆã‚‰ã‚ŒãŸå¼•æ•°ã‚’è§£æžã™ã‚‹ãŸã‚ã®é–¢æ•°ãŒopen()ã§ã‚‚使ã‚
+れã¦ã„ã‚‹rb_scan_args()ã§ã™ï¼Žç¬¬3å¼•æ•°ã«æŒ‡å®šã—ãŸãƒ•ォーマットã«å¾“
+ã„,第4変数以é™ã«æŒ‡å®šã—ãŸVALUEã¸ã®å‚ç…§ã«å€¤ã‚’代入ã—ã¦ãれã¾
+ã™ï¼Ž
+
+
+引数をRubyã®é…列ã¨ã—ã¦å—ã‘å–るメソッドã®ä¾‹ã«ã¯
+Thread#initializeãŒã‚りã¾ã™ï¼Žå®Ÿè£…ã¯ã“ã†ã§ã™ï¼Ž
+
+ static VALUE
+ thread_initialize(VALUE thread, VALUE args)
+ {
+ /* ... */
+ }
+
+第1引数ã¯self,第2引数ã¯Rubyã®é…列ã§ã™ï¼Ž
+
+*注æ„事項*
+
+Rubyã¨å…±æœ‰ã¯ã—ãªã„ãŒRubyã®ã‚ªãƒ–ジェクトを格ç´ã™ã‚‹å¯èƒ½æ€§ã®ã‚ã‚‹
+Cã®å¤§åŸŸå¤‰æ•°ã¯ä»¥ä¸‹ã®é–¢æ•°ã‚’使ã£ã¦Rubyインタプリタã«å¤‰æ•°ã®å­˜åœ¨
+ã‚’æ•™ãˆã¦ã‚ã’ã¦ãã ã•ã„.ã§ãªã„ã¨GCã§ãƒˆãƒ©ãƒ–ルを起ã“ã—ã¾ã™ï¼Ž
void rb_global_variable(VALUE *var)
-(4) extconf.rb¤òÍѰդ¹¤ë
+== extconf.rbを用æ„ã™ã‚‹
-Makefile¤òºî¤ë¾ì¹ç¤Î¿÷·¿¤Ë¤Ê¤ëextconf.rb¤È¤¤¤¦¥Õ¥¡¥¤¥ë¤òºî¤ê
-¤Þ¤¹¡¥extconf.rb¤Ï¥é¥¤¥Ö¥é¥ê¤Î¥³¥ó¥Ñ¥¤¥ë¤ËɬÍפʾò·ï¤Î¥Á¥§¥Ã
-¥¯¤Ê¤É¤ò¹Ô¤¦¤³¤È¤¬ÌÜŪ¤Ç¤¹¡¥¤Þ¤º¡¤
+Makefileを作る場åˆã®é››åž‹ã«ãªã‚‹extconf.rbã¨ã„ã†ãƒ•ァイルを作り
+ã¾ã™ï¼Žextconf.rbã¯ãƒ©ã‚¤ãƒ–ラリã®ã‚³ãƒ³ãƒ‘イルã«å¿…è¦ãªæ¡ä»¶ã®ãƒã‚§ãƒƒ
+クãªã©ã‚’行ã†ã“ã¨ãŒç›®çš„ã§ã™ï¼Žã¾ãšï¼Œ
require 'mkmf'
-¤òextconf.rb¤ÎÀèÆ¬¤ËÃÖ¤­¤Þ¤¹¡¥extconf.rb¤ÎÃæ¤Ç¤Ï°Ê²¼¤ÎRuby´Ø
-¿ô¤ò»È¤¦¤³¤È¤¬½ÐÍè¤Þ¤¹¡¥
+ã‚’extconf.rbã®å…ˆé ­ã«ç½®ãã¾ã™ï¼Žextconf.rbã®ä¸­ã§ã¯ä»¥ä¸‹ã®Rubyé–¢
+数を使ã†ã“ã¨ãŒå‡ºæ¥ã¾ã™ï¼Ž
- have_library(lib, func): ¥é¥¤¥Ö¥é¥ê¤Î¸ºß¥Á¥§¥Ã¥¯
- have_func(func, header): ´Ø¿ô¤Î¸ºß¥Á¥§¥Ã¥¯
- have_header(header): ¥Ø¥Ã¥À¥Õ¥¡¥¤¥ë¤Î¸ºß¥Á¥§¥Ã¥¯
- create_makefile(target): Makefile¤ÎÀ¸À®
+ have_library(lib, func): ライブラリã®å­˜åœ¨ãƒã‚§ãƒƒã‚¯
+ have_func(func, header): 関数ã®å­˜åœ¨ãƒã‚§ãƒƒã‚¯
+ have_header(header): ヘッダファイルã®å­˜åœ¨ãƒã‚§ãƒƒã‚¯
+ create_makefile(target[, target_prefix]): Makefileã®ç”Ÿæˆ
-°Ê²¼¤ÎÊÑ¿ô¤ò»È¤¦¤³¤È¤¬¤Ç¤­¤Þ¤¹¡¥
+以下ã®å¤‰æ•°ã‚’使ã†ã“ã¨ãŒã§ãã¾ã™ï¼Ž
- $CFLAGS: ¥³¥ó¥Ñ¥¤¥ë»þ¤ËÄɲÃŪ¤Ë»ØÄꤹ¤ë¥Õ¥é¥°(-O¤Ê¤É)
- $CPPFLAGS: ¥×¥ê¥×¥í¥»¥Ã¥µ¤ËÄɲÃŪ¤Ë»ØÄꤹ¤ë¥Õ¥é¥°(-I¤ä-D¤Ê¤É)
- $LDFLAGS: ¥ê¥ó¥¯»þ¤ËÄɲÃŪ¤Ë»ØÄꤹ¤ë¥Õ¥é¥°(-L¤Ê¤É)
- $objs: ¥ê¥ó¥¯¤µ¤ì¤ë¥ª¥Ö¥¸¥§¥¯¥È¥Õ¥¡¥¤¥ë̾¤Î¥ê¥¹¥È
+ $CFLAGS: コンパイル時ã«è¿½åŠ çš„ã«æŒ‡å®šã™ã‚‹ãƒ•ラグ(-Oãªã©)
+ $CPPFLAGS: プリプロセッサã«è¿½åŠ çš„ã«æŒ‡å®šã™ã‚‹ãƒ•ラグ(-Iã‚„-Dãªã©)
+ $LDFLAGS: リンク時ã«è¿½åŠ çš„ã«æŒ‡å®šã™ã‚‹ãƒ•ラグ(-Lãªã©)
+ $objs: リンクã•れるオブジェクトファイルåã®ãƒªã‚¹ãƒˆ
-¥ª¥Ö¥¸¥§¥¯¥È¥Õ¥¡¥¤¥ë¤Î¥ê¥¹¥È¤Ï¡¤Ä̾ï¤Ï¥½¡¼¥¹¥Õ¥¡¥¤¥ë¤ò¸¡º÷¤·
-¤Æ¼«Æ°Åª¤ËÀ¸À®¤µ¤ì¤Þ¤¹¤¬¡¤make¤ÎÅÓÃæ¤Ç¥½¡¼¥¹¤òÀ¸À®¤¹¤ë¤è¤¦¤Ê
-¾ì¹ç¤ÏÌÀ¼¨Åª¤Ë»ØÄꤹ¤ëɬÍפ¬¤¢¤ê¤Þ¤¹¡¥
+オブジェクトファイルã®ãƒªã‚¹ãƒˆã¯ï¼Œé€šå¸¸ã¯ã‚½ãƒ¼ã‚¹ãƒ•ァイルを検索ã—
+ã¦è‡ªå‹•çš„ã«ç”Ÿæˆã•れã¾ã™ãŒï¼Œmakeã®é€”中ã§ã‚½ãƒ¼ã‚¹ã‚’生æˆã™ã‚‹ã‚ˆã†ãª
+å ´åˆã¯æ˜Žç¤ºçš„ã«æŒ‡å®šã™ã‚‹å¿…è¦ãŒã‚りã¾ã™ï¼Ž
-¥é¥¤¥Ö¥é¥ê¤ò¥³¥ó¥Ñ¥¤¥ë¤¹¤ë¾ò·ï¤¬Â·¤ï¤º¡¤¤½¤Î¥é¥¤¥Ö¥é¥ê¤ò¥³¥ó
-¥Ñ¥¤¥ë¤·¤Ê¤¤»þ¤Ë¤Ïcreate_makefile¤ò¸Æ¤Ð¤Ê¤±¤ì¤ÐMakefile¤ÏÀ¸
-À®¤µ¤ì¤º¡¤¥³¥ó¥Ñ¥¤¥ë¤â¹Ô¤ï¤ì¤Þ¤»¤ó¡¥
+ライブラリをコンパイルã™ã‚‹æ¡ä»¶ãŒæƒã‚ãšï¼Œãã®ãƒ©ã‚¤ãƒ–ラリをコン
+パイルã—ãªã„時ã«ã¯create_makefileを呼ã°ãªã‘れã°Makefileã¯ç”Ÿ
+æˆã•れãšï¼Œã‚³ãƒ³ãƒ‘イルも行ã‚れã¾ã›ã‚“.
-(5) depend¤òÍѰդ¹¤ë
+== dependを用æ„ã™ã‚‹
-¤â¤·¡¤¥Ç¥£¥ì¥¯¥È¥ê¤Ëdepend¤È¤¤¤¦¥Õ¥¡¥¤¥ë¤¬Â¸ºß¤¹¤ì¤Ð¡¤
-Makefile¤¬°Í¸´Ø·¸¤ò¥Á¥§¥Ã¥¯¤·¤Æ¤¯¤ì¤Þ¤¹¡¥
+ã‚‚ã—,ディレクトリã«dependã¨ã„ã†ãƒ•ァイルãŒå­˜åœ¨ã™ã‚Œã°ï¼Œ
+MakefileãŒä¾å­˜é–¢ä¿‚ã‚’ãƒã‚§ãƒƒã‚¯ã—ã¦ãれã¾ã™ï¼Ž
% gcc -MM *.c > depend
-¤Ê¤É¤Çºî¤ë¤³¤È¤¬½ÐÍè¤Þ¤¹¡¥¤¢¤Ã¤ÆÂ»¤Ï̵¤¤¤Ç¤·¤ç¤¦¡¥
+ãªã©ã§ä½œã‚‹ã“ã¨ãŒå‡ºæ¥ã¾ã™ï¼Žã‚ã£ã¦æã¯ç„¡ã„ã§ã—ょã†ï¼Ž
-(6) Makefile¤òÀ¸À®¤¹¤ë
+== Makefileを生æˆã™ã‚‹
-Makefile¤ò¼ÂºÝ¤ËÀ¸À®¤¹¤ë¤¿¤á¤Ë¤Ï
+Makefileを実際ã«ç”Ÿæˆã™ã‚‹ãŸã‚ã«ã¯
ruby extconf.rb
-¤È¤·¤Þ¤¹¡¥extconf.rb¤Ë require 'mkmf' ¤Î¹Ô¤¬¤Ê¤¤¾ì¹ç¤Ë¤Ï¥¨¥é¡¼
-¤Ë¤Ê¤ê¤Þ¤¹¤Î¤Ç¡¤°ú¿ô¤òÄɲä·¤Æ
+ã¨ã—ã¾ã™ï¼Žextconf.rbã« require 'mkmf' ã®è¡ŒãŒãªã„å ´åˆã«ã¯ã‚¨ãƒ©ãƒ¼
+ã«ãªã‚Šã¾ã™ã®ã§ï¼Œå¼•数を追加ã—ã¦
ruby -r mkmf extconf.rb
-¤È¤·¤Æ¤¯¤À¤µ¤¤¡¥
+ã¨ã—ã¦ãã ã•ã„.
-site_ruby ¥Ç¥£¥ì¥¯¥È¥ê¤Ç¤Ê¤¯¡¤
-vendor_ruby ¥Ç¥£¥ì¥¯¥È¥ê¤Ë¥¤¥ó¥¹¥È¡¼¥ë¤¹¤ë¾ì¹ç¤Ë¤Ï
-°Ê²¼¤Î¤è¤¦¤Ë --vendor ¥ª¥×¥·¥ç¥ó¤ò²Ã¤¨¤Æ¤¯¤À¤µ¤¤¡¥
+site_ruby ディレクトリã§ãªã,
+vendor_ruby ディレクトリã«ã‚¤ãƒ³ã‚¹ãƒˆãƒ¼ãƒ«ã™ã‚‹å ´åˆã«ã¯
+以下ã®ã‚ˆã†ã« --vendor オプションを加ãˆã¦ãã ã•ã„.
ruby extconf.rb --vendor
-¥Ç¥£¥ì¥¯¥È¥ê¤òext°Ê²¼¤ËÍѰդ·¤¿¾ì¹ç¤Ë¤ÏRubyÁ´ÂΤÎmake¤Î»þ¤Ë
-¼«Æ°Åª¤ËMakefile¤¬À¸À®¤µ¤ì¤Þ¤¹¤Î¤Ç¡¤¤³¤Î¥¹¥Æ¥Ã¥×¤ÏÉÔÍפǤ¹¡¥
+ディレクトリをext以下ã«ç”¨æ„ã—ãŸå ´åˆã«ã¯Ruby全体ã®makeã®æ™‚ã«
+自動的ã«MakefileãŒç”Ÿæˆã•れã¾ã™ã®ã§ï¼Œã“ã®ã‚¹ãƒ†ãƒƒãƒ—ã¯ä¸è¦ã§ã™ï¼Ž
-(7) make¤¹¤ë
+== makeã™ã‚‹
-ưŪ¥ê¥ó¥¯¥é¥¤¥Ö¥é¥ê¤òÀ¸À®¤¹¤ë¾ì¹ç¤Ë¤Ï¤½¤Î¾ì¤Çmake¤·¤Æ¤¯¤À¤µ
-¤¤¡¥É¬ÍפǤ¢¤ì¤Ð make install ¤Ç¥¤¥ó¥¹¥È¡¼¥ë¤µ¤ì¤Þ¤¹¡¥
+動的リンクライブラリを生æˆã™ã‚‹å ´åˆã«ã¯ãã®å ´ã§makeã—ã¦ãã ã•
+ã„.必è¦ã§ã‚れ㰠make install ã§ã‚¤ãƒ³ã‚¹ãƒˆãƒ¼ãƒ«ã•れã¾ã™ï¼Ž
-ext°Ê²¼¤Ë¥Ç¥£¥ì¥¯¥È¥ê¤òÍѰդ·¤¿¾ì¹ç¤Ï¡¤Ruby¤Î¥Ç¥£¥ì¥¯¥È¥ê¤Ç
-make¤ò¼Â¹Ô¤¹¤ë¤ÈMakefile¤òÀ¸À®¤«¤émake¡¤É¬Íפˤè¤Ã¤Æ¤Ï¤½¤Î¥â
-¥¸¥å¡¼¥ë¤ÎRuby¤Ø¤Î¥ê¥ó¥¯¤Þ¤Ç¼«Æ°Åª¤Ë¼Â¹Ô¤·¤Æ¤¯¤ì¤Þ¤¹¡¥
-extconf.rb¤ò½ñ¤­´¹¤¨¤ë¤Ê¤É¤·¤ÆMakefile¤ÎºÆÀ¸À®¤¬É¬Íפʻþ¤Ï¤Þ
-¤¿Ruby¥Ç¥£¥ì¥¯¥È¥ê¤Çmake¤·¤Æ¤¯¤À¤µ¤¤¡¥
+ext以下ã«ãƒ‡ã‚£ãƒ¬ã‚¯ãƒˆãƒªã‚’用æ„ã—ãŸå ´åˆã¯ï¼ŒRubyã®ãƒ‡ã‚£ãƒ¬ã‚¯ãƒˆãƒªã§
+makeを実行ã™ã‚‹ã¨Makefileを生æˆã‹ã‚‰make,必è¦ã«ã‚ˆã£ã¦ã¯ãã®ãƒ¢
+ジュールã®Rubyã¸ã®ãƒªãƒ³ã‚¯ã¾ã§è‡ªå‹•çš„ã«å®Ÿè¡Œã—ã¦ãれã¾ã™ï¼Ž
+extconf.rbã‚’æ›¸ãæ›ãˆã‚‹ãªã©ã—ã¦Makefileã®å†ç”ŸæˆãŒå¿…è¦ãªæ™‚ã¯ã¾
+ãŸRubyディレクトリã§makeã—ã¦ãã ã•ã„.
-³ÈÄ¥¥é¥¤¥Ö¥é¥ê¤Ïmake install¤ÇRuby¥é¥¤¥Ö¥é¥ê¤Î¥Ç¥£¥ì¥¯¥È¥ê¤Î
-²¼¤Ë¥³¥Ô¡¼¤µ¤ì¤Þ¤¹¡¥¤â¤·³ÈÄ¥¥é¥¤¥Ö¥é¥ê¤È¶¨Ä´¤·¤Æ»È¤¦Ruby¤Çµ­
-½Ò¤µ¤ì¤¿¥×¥í¥°¥é¥à¤¬¤¢¤ê¡¤Ruby¥é¥¤¥Ö¥é¥ê¤ËÃÖ¤­¤¿¤¤¾ì¹ç¤Ë¤Ï¡¤
-³ÈÄ¥¥é¥¤¥Ö¥é¥êÍѤΥǥ£¥ì¥¯¥È¥ê¤Î²¼¤Ë lib ¤È¤¤¤¦¥Ç¥£¥ì¥¯¥È¥ê
-¤òºî¤ê¡¤¤½¤³¤Ë ³ÈÄ¥»Ò .rb ¤Î¥Õ¥¡¥¤¥ë¤òÃÖ¤¤¤Æ¤ª¤±¤ÐƱ»þ¤Ë¥¤¥ó
-¥¹¥È¡¼¥ë¤µ¤ì¤Þ¤¹¡¥
+拡張ライブラリã¯make installã§Rubyライブラリã®ãƒ‡ã‚£ãƒ¬ã‚¯ãƒˆãƒªã®
+下ã«ã‚³ãƒ”ーã•れã¾ã™ï¼Žã‚‚ã—æ‹¡å¼µãƒ©ã‚¤ãƒ–ラリã¨å”調ã—ã¦ä½¿ã†Rubyã§è¨˜
+è¿°ã•れãŸãƒ—ログラムãŒã‚り,Rubyライブラリã«ç½®ããŸã„å ´åˆã«ã¯ï¼Œ
+拡張ライブラリ用ã®ãƒ‡ã‚£ãƒ¬ã‚¯ãƒˆãƒªã®ä¸‹ã« lib ã¨ã„ã†ãƒ‡ã‚£ãƒ¬ã‚¯ãƒˆãƒª
+を作り,ãã“ã« æ‹¡å¼µå­ .rb ã®ãƒ•ァイルを置ã„ã¦ãŠã‘ã°åŒæ™‚ã«ã‚¤ãƒ³
+ストールã•れã¾ã™ï¼Ž
-(8) ¥Ç¥Ð¥Ã¥°
+== デãƒãƒƒã‚°
-¤Þ¤¢¡¤¥Ç¥Ð¥Ã¥°¤·¤Ê¤¤¤Èư¤«¤Ê¤¤¤Ç¤·¤ç¤¦¤Í¡¥ext/Setup¤Ë¥Ç¥£¥ì
-¥¯¥È¥ê̾¤ò½ñ¤¯¤ÈÀÅŪ¤Ë¥ê¥ó¥¯¤¹¤ë¤Î¤Ç¥Ç¥Ð¥Ã¥¬¤¬»È¤¨¤ë¤è¤¦¤Ë¤Ê
-¤ê¤Þ¤¹¡¥¤½¤Îʬ¥³¥ó¥Ñ¥¤¥ë¤¬ÃÙ¤¯¤Ê¤ê¤Þ¤¹¤±¤É¡¥
+ã¾ã‚,デãƒãƒƒã‚°ã—ãªã„ã¨å‹•ã‹ãªã„ã§ã—ょã†ã­ï¼Žext/Setupã«ãƒ‡ã‚£ãƒ¬
+クトリåを書ãã¨é™çš„ã«ãƒªãƒ³ã‚¯ã™ã‚‹ã®ã§ãƒ‡ãƒãƒƒã‚¬ãŒä½¿ãˆã‚‹ã‚ˆã†ã«ãª
+りã¾ã™ï¼Žãã®åˆ†ã‚³ãƒ³ãƒ‘イルãŒé…ããªã‚Šã¾ã™ã‘ã©ï¼Ž
-(9) ¤Ç¤­¤¢¤¬¤ê
+== ã§ãã‚ãŒã‚Š
-¸å¤Ï¤³¤Ã¤½¤ê»È¤¦¤Ê¤ê¡¤¹­¤¯¸ø³«¤¹¤ë¤Ê¤ê¡¤Çä¤ë¤Ê¤ê¡¤¤´¼«Í³¤Ë¤ª
-»È¤¤¤¯¤À¤µ¤¤¡¥Ruby¤Îºî¼Ô¤Ï³ÈÄ¥¥é¥¤¥Ö¥é¥ê¤Ë´Ø¤·¤Æ°ìÀڤθ¢Íø¤ò
-¼çÄ¥¤·¤Þ¤»¤ó¡¥
+後ã¯ã“ã£ãり使ã†ãªã‚Šï¼Œåºƒã公開ã™ã‚‹ãªã‚Šï¼Œå£²ã‚‹ãªã‚Šï¼Œã”自由ã«ãŠ
+使ã„ãã ã•ã„.Rubyã®ä½œè€…ã¯æ‹¡å¼µãƒ©ã‚¤ãƒ–ラリã«é–¢ã—ã¦ä¸€åˆ‡ã®æ¨©åˆ©ã‚’
+主張ã—ã¾ã›ã‚“.
-Appendix A. Ruby¤Î¥½¡¼¥¹¥³¡¼¥É¤ÎʬÎà
+= Appendix A. Rubyã®ã‚½ãƒ¼ã‚¹ã‚³ãƒ¼ãƒ‰ã®åˆ†é¡ž
-Ruby¤Î¥½¡¼¥¹¤Ï¤¤¤¯¤Ä¤«¤ËʬÎह¤ë¤³¤È¤¬½ÐÍè¤Þ¤¹¡¥¤³¤Î¤¦¤Á¥¯¥é
-¥¹¥é¥¤¥Ö¥é¥ê¤ÎÉôʬ¤Ï´ðËÜŪ¤Ë³ÈÄ¥¥é¥¤¥Ö¥é¥ê¤ÈƱ¤¸ºî¤êÊý¤Ë¤Ê¤Ã
-¤Æ¤¤¤Þ¤¹¡¥¤³¤ì¤é¤Î¥½¡¼¥¹¤Ïº£¤Þ¤Ç¤ÎÀâÌÀ¤Ç¤Û¤È¤ó¤ÉÍý²ò¤Ç¤­¤ë¤È
-»×¤¤¤Þ¤¹¡¥
+Rubyã®ã‚½ãƒ¼ã‚¹ã¯ã„ãã¤ã‹ã«åˆ†é¡žã™ã‚‹ã“ã¨ãŒå‡ºæ¥ã¾ã™ï¼Žã“ã®ã†ã¡ã‚¯ãƒ©
+スライブラリã®éƒ¨åˆ†ã¯åŸºæœ¬çš„ã«æ‹¡å¼µãƒ©ã‚¤ãƒ–ラリã¨åŒã˜ä½œã‚Šæ–¹ã«ãªã£
+ã¦ã„ã¾ã™ï¼Žã“れらã®ã‚½ãƒ¼ã‚¹ã¯ä»Šã¾ã§ã®èª¬æ˜Žã§ã»ã¨ã‚“ã©ç†è§£ã§ãã‚‹ã¨
+æ€ã„ã¾ã™ï¼Ž
-Ruby¸À¸ì¤Î¥³¥¢
+== Ruby言語ã®ã‚³ã‚¢
- class.c : ¥¯¥é¥¹¤È¥â¥¸¥å¡¼¥ë
- error.c : Îã³°¥¯¥é¥¹¤ÈÎã³°µ¡¹½
- gc.c : µ­²±Îΰè´ÉÍý
- load.c : ¥é¥¤¥Ö¥é¥ê¤Î¥í¡¼¥É
- object.c : ¥ª¥Ö¥¸¥§¥¯¥È
- variable.c : ÊÑ¿ô¤ÈÄê¿ô
+class.c :: クラスã¨ãƒ¢ã‚¸ãƒ¥ãƒ¼ãƒ«
+error.c :: 例外クラスã¨ä¾‹å¤–機構
+gc.c :: 記憶領域管ç†
+load.c :: ライブラリã®ãƒ­ãƒ¼ãƒ‰
+object.c :: オブジェクト
+variable.c :: 変数ã¨å®šæ•°
-Ruby¤Î¹½Ê¸²òÀÏ´ï
- parse.y : »ú¶ç²òÀÏ´ï¤È¹½Ê¸ÄêµÁ
- -> parse.c : ¼«Æ°À¸À®
- keywords : ͽÌó¸ì
- -> lex.c : ¼«Æ°À¸À®
+== Rubyã®æ§‹æ–‡è§£æžå™¨
-Ruby¤Îɾ²Á´ï (Ä̾ÎYARV)
+ parse.y : å­—å¥è§£æžå™¨ã¨æ§‹æ–‡å®šç¾©
+ -> parse.c : 自動生æˆ
+ keywords : 予約語
+ -> lex.c : 自動生æˆ
+
+== Rubyã®è©•価器 (通称YARV)
compile.c
eval.c
eval_error.c
eval_jump.c
eval_safe.c
- insns.def : ²¾ÁÛµ¡³£¸ì¤ÎÄêµÁ
- iseq.c : VM::ISeq¤Î¼ÂÁõ
- thread.c : ¥¹¥ì¥Ã¥É´ÉÍý¤È¥³¥ó¥Æ¥­¥¹¥ÈÀÚ¤êÂØ¤¨
- thread_win32.c : ¥¹¥ì¥Ã¥É¼ÂÁõ
- thread_pthread.c : Ʊ¾å
+ insns.def : 仮想機械語ã®å®šç¾©
+ iseq.c : VM::ISeqã®å®Ÿè£…
+ thread.c : スレッド管ç†ã¨ã‚³ãƒ³ãƒ†ã‚­ã‚¹ãƒˆåˆ‡ã‚Šæ›¿ãˆ
+ thread_win32.c : スレッド実装
+ thread_pthread.c : åŒä¸Š
vm.c
vm_dump.c
vm_eval.c
@@ -943,14 +965,15 @@ Ruby¤Îɾ²Á´ï (Ä̾ÎYARV)
vm_insnhelper.c
vm_method.c
- opt_insns_unif.def : Ì¿ÎáÍ»¹ç
- opt_operand.def : ºÇŬ²½¤Î¤¿¤á¤ÎÄêµÁ
+ opt_insns_unif.def : 命令èžåˆ
+ opt_operand.def : 最é©åŒ–ã®ãŸã‚ã®å®šç¾©
+
+ -> insn*.inc : 自動生æˆ
+ -> opt*.inc : 自動生æˆ
+ -> vm.inc : 自動生æˆ
- -> insn*.inc : ¼«Æ°À¸À®
- -> opt*.inc : ¼«Æ°À¸À®
- -> vm.inc : ¼«Æ°À¸À®
+== æ­£è¦è¡¨ç¾ã‚¨ãƒ³ã‚¸ãƒ³ (鬼車)
-Àµµ¬É½¸½¥¨¥ó¥¸¥ó (µ´¼Ö)
regex.c
regcomp.c
regenc.c
@@ -959,15 +982,15 @@ Ruby¤Îɾ²Á´ï (Ä̾ÎYARV)
regparse.c
regsyntax.c
-¥æ¡¼¥Æ¥£¥ê¥Æ¥£´Ø¿ô
+== ユーティリティ関数
- debug.c : C¥Ç¥Ð¥Ã¥¬ÍѤΥǥХå°¥·¥ó¥Ü¥ë
- dln.c : ưŪ¥í¡¼¥Ç¥£¥ó¥°
- st.c : ÈÆÍѥϥå·¥åɽ
- strftime.c : »þ¹ïÀ°·Á
- util.c : ¤½¤Î¾¤Î¥æ¡¼¥Æ¥£¥ê¥Æ¥£
+debug.c :: Cデãƒãƒƒã‚¬ç”¨ã®ãƒ‡ãƒãƒƒã‚°ã‚·ãƒ³ãƒœãƒ«
+dln.c :: 動的ローディング
+st.c :: 汎用ãƒãƒƒã‚·ãƒ¥è¡¨
+strftime.c :: 時刻整形
+util.c :: ãã®ä»–ã®ãƒ¦ãƒ¼ãƒ†ã‚£ãƒªãƒ†ã‚£
-Ruby¥³¥Þ¥ó¥É¤Î¼ÂÁõ
+== Rubyコマンドã®å®Ÿè£…
dmyext.c
dmydln.c
@@ -981,587 +1004,628 @@ Ruby¥³¥Þ¥ó¥É¤Î¼ÂÁõ
gem_prelude.rb
prelude.rb
-¥¯¥é¥¹¥é¥¤¥Ö¥é¥ê
-
- array.c : Array
- bignum.c : Bignum
- compar.c : Comparable
- complex.c : Complex
- cont.c : Fiber, Continuation
- dir.c : Dir
- enum.c : Enumerable
- enumerator.c : Enumerator
- file.c : File
- hash.c : Hash
- io.c : IO
- marshal.c : Marshal
- math.c : Math
- numeric.c : Numeric, Integer, Fixnum, Float
- pack.c : Array#pack, String#unpack
- proc.c : Binding, Proc
- process.c : Process
- random.c : Íð¿ô
- range.c : Range
- rational.c : Rational
- re.c : Regexp, MatchData
- signal.c : Signal
- sprintf.c :
- string.c : String
- struct.c : Struct
- time.c : Time
-
- defs/known_errors.def : Îã³°¥¯¥é¥¹ Errno::*
- -> known_errors.inc : ¼«Æ°À¸À®
-
-¿¸À¸ì²½
- encoding.c : Encoding
- transcode.c : Encoding::Converter
- enc/*.c : ¥¨¥ó¥³¡¼¥Ç¥£¥ó¥°¥¯¥é¥¹·²
- enc/trans/* : ¥³¡¼¥É¥Ý¥¤¥ó¥ÈÂбþɽ
-
-goruby¥³¥Þ¥ó¥É¤Î¼ÂÁõ
-
- goruby.c
- golf_prelude.rb : goruby¸ÇÍ­¤Î¥é¥¤¥Ö¥é¥ê
- -> golf_prelude.c : ¼«Æ°À¸À®
+== クラスライブラリ
+
+array.c :: Array
+bignum.c :: Bignum
+compar.c :: Comparable
+complex.c :: Complex
+cont.c :: Fiber, Continuation
+dir.c :: Dir
+enum.c :: Enumerable
+enumerator.c :: Enumerator
+file.c :: File
+hash.c :: Hash
+io.c :: IO
+marshal.c :: Marshal
+math.c :: Math
+numeric.c :: Numeric, Integer, Fixnum, Float
+pack.c :: Array#pack, String#unpack
+proc.c :: Binding, Proc
+process.c :: Process
+random.c :: 乱数
+range.c :: Range
+rational.c :: Rational
+re.c :: Regexp, MatchData
+signal.c :: Signal
+sprintf.c :: String#sprintf
+string.c :: String
+struct.c :: Struct
+time.c :: Time
+defs/known_errors.def :: 例外クラス Errno::*
+-> known_errors.inc :: 自動生æˆ
+
+== 多言語化
+
+encoding.c :: Encoding
+transcode.c :: Encoding::Converter
+enc/*.c :: エンコーディングクラス群
+enc/trans/* :: コードãƒã‚¤ãƒ³ãƒˆå¯¾å¿œè¡¨
+
+== gorubyコマンドã®å®Ÿè£…
+ goruby.c
+ golf_prelude.rb : goruby固有ã®ãƒ©ã‚¤ãƒ–ラリ
+ -> golf_prelude.c : 自動生æˆ
-Appendix B. ³ÈÄ¥ÍÑ´Ø¿ô¥ê¥Õ¥¡¥ì¥ó¥¹
+= Appendix B. 拡張用関数リファレンス
-C¸À¸ì¤«¤éRuby¤Îµ¡Ç½¤òÍøÍѤ¹¤ëAPI¤Ï°Ê²¼¤ÎÄ̤ê¤Ç¤¢¤ë¡¥
+C言語ã‹ã‚‰Rubyã®æ©Ÿèƒ½ã‚’利用ã™ã‚‹APIã¯ä»¥ä¸‹ã®é€šã‚Šã§ã‚る.
-** ·¿
+== åž‹
-VALUE
+VALUE ::
- Ruby¥ª¥Ö¥¸¥§¥¯¥È¤òɽ¸½¤¹¤ë·¿¡¥É¬Íפ˱þ¤¸¤Æ¥­¥ã¥¹¥È¤·¤ÆÍѤ¤¤ë¡¥
- ÁȤ߹þ¤ß·¿¤òɽ¸½¤¹¤ëC¤Î·¿¤Ïruby.h¤Ëµ­½Ò¤·¤Æ¤¢¤ëR¤Ç»Ï¤Þ¤ë¹½Â¤
- ÂΤǤ¢¤ë¡¥VALUE·¿¤ò¤³¤ì¤é¤Ë¥­¥ã¥¹¥È¤¹¤ë¤¿¤á¤ËR¤Ç»Ï¤Þ¤ë¹½Â¤ÂÎ
- ̾¤òÁ´¤ÆÂçʸ»ú¤Ë¤·¤¿Ì¾Á°¤Î¥Þ¥¯¥í¤¬ÍѰդµ¤ì¤Æ¤¤¤ë¡¥
+ Rubyオブジェクトを表ç¾ã™ã‚‹åž‹ï¼Žå¿…è¦ã«å¿œã˜ã¦ã‚­ãƒ£ã‚¹ãƒˆã—ã¦ç”¨ã„る.
+ 組ã¿è¾¼ã¿åž‹ã‚’表ç¾ã™ã‚‹Cã®åž‹ã¯ruby.hã«è¨˜è¿°ã—ã¦ã‚ã‚‹Rã§å§‹ã¾ã‚‹æ§‹é€ 
+ 体ã§ã‚る.VALUE型をã“れらã«ã‚­ãƒ£ã‚¹ãƒˆã™ã‚‹ãŸã‚ã«Rã§å§‹ã¾ã‚‹æ§‹é€ ä½“
+ åã‚’å…¨ã¦å¤§æ–‡å­—ã«ã—ãŸåå‰ã®ãƒžã‚¯ãƒ­ãŒç”¨æ„ã•れã¦ã„る.
-** ÊÑ¿ô¡¦Äê¿ô
+== 変数・定数
-Qnil
+Qnil ::
- Äê¿ô: nil¥ª¥Ö¥¸¥§¥¯¥È
+ 定数: nilオブジェクト
-Qtrue
+Qtrue ::
- Äê¿ô: true¥ª¥Ö¥¸¥§¥¯¥È(¿¿¤Î¥Ç¥Õ¥©¥ë¥ÈÃÍ)
+ 定数: trueオブジェクト(真ã®ãƒ‡ãƒ•ォルト値)
-Qfalse
+Qfalse ::
- Äê¿ô: false¥ª¥Ö¥¸¥§¥¯¥È
+ 定数: falseオブジェクト
-** C¥Ç¡¼¥¿¤Î¥«¥×¥»¥ë²½
+== Cデータã®ã‚«ãƒ—セル化
-Data_Wrap_Struct(VALUE klass, void (*mark)(), void (*free)(), void *sval)
+Data_Wrap_Struct(VALUE klass, void (*mark)(), void (*free)(), void *sval) ::
- C¤ÎǤ°Õ¤Î¥Ý¥¤¥ó¥¿¤ò¥«¥×¥»¥ë²½¤·¤¿Ruby¥ª¥Ö¥¸¥§¥¯¥È¤òÊÖ¤¹¡¥¤³
- ¤Î¥Ý¥¤¥ó¥¿¤¬Ruby¤«¤é¥¢¥¯¥»¥¹¤µ¤ì¤Ê¤¯¤Ê¤Ã¤¿»þ¡¤free¤Ç»ØÄꤷ¤¿
- ´Ø¿ô¤¬¸Æ¤Ð¤ì¤ë¡¥¤Þ¤¿¡¤¤³¤Î¥Ý¥¤¥ó¥¿¤Î»Ø¤¹¥Ç¡¼¥¿¤¬Â¾¤ÎRuby¥ª¥Ö
- ¥¸¥§¥¯¥È¤ò»Ø¤·¤Æ¤¤¤ë¾ì¹ç¡¤mark¤Ë»ØÄꤹ¤ë´Ø¿ô¤Ç¥Þ¡¼¥¯¤¹¤ëɬÍ×
- ¤¬¤¢¤ë¡¥
+ Cã®ä»»æ„ã®ãƒã‚¤ãƒ³ã‚¿ã‚’カプセル化ã—ãŸRubyオブジェクトを返ã™ï¼Žã“
+ ã®ãƒã‚¤ãƒ³ã‚¿ãŒRubyã‹ã‚‰ã‚¢ã‚¯ã‚»ã‚¹ã•れãªããªã£ãŸæ™‚,freeã§æŒ‡å®šã—ãŸ
+ 関数ãŒå‘¼ã°ã‚Œã‚‹ï¼Žã¾ãŸï¼Œã“ã®ãƒã‚¤ãƒ³ã‚¿ã®æŒ‡ã™ãƒ‡ãƒ¼ã‚¿ãŒä»–ã®Rubyオブ
+ ジェクトを指ã—ã¦ã„ã‚‹å ´åˆï¼Œmarkã«æŒ‡å®šã™ã‚‹é–¢æ•°ã§ãƒžãƒ¼ã‚¯ã™ã‚‹å¿…è¦
+ ãŒã‚る.
-Data_Make_Struct(klass, type, mark, free, sval)
+Data_Make_Struct(klass, type, mark, free, sval) ::
- type·¿¤Î¥á¥â¥ê¤òmalloc¤·¡¤ÊÑ¿ôsval¤ËÂåÆþ¤·¤¿¸å¡¤¤½¤ì¤ò¥«¥×¥»
- ¥ë²½¤·¤¿¥Ç¡¼¥¿¤òÊÖ¤¹¥Þ¥¯¥í¡¥
+ typeåž‹ã®ãƒ¡ãƒ¢ãƒªã‚’mallocã—,変数svalã«ä»£å…¥ã—ãŸå¾Œï¼Œãれをカプセ
+ ル化ã—ãŸãƒ‡ãƒ¼ã‚¿ã‚’è¿”ã™ãƒžã‚¯ãƒ­ï¼Ž
-Data_Get_Struct(data, type, sval)
+Data_Get_Struct(data, type, sval) ::
- data¤«¤étype·¿¤Î¥Ý¥¤¥ó¥¿¤ò¼è¤ê½Ð¤·ÊÑ¿ôsval¤ËÂåÆþ¤¹¤ë¥Þ¥¯¥í¡¥
+ dataã‹ã‚‰typeåž‹ã®ãƒã‚¤ãƒ³ã‚¿ã‚’å–り出ã—変数svalã«ä»£å…¥ã™ã‚‹ãƒžã‚¯ãƒ­ï¼Ž
-** ·¿¥Á¥§¥Ã¥¯
+== åž‹ãƒã‚§ãƒƒã‚¯
-TYPE(value)
-FIXNUM_P(value)
-NIL_P(value)
-void Check_Type(VALUE value, int type)
-void Check_SafeStr(VALUE value)
+ TYPE(value)
+ FIXNUM_P(value)
+ NIL_P(value)
+ void Check_Type(VALUE value, int type)
+ SafeStringValue(value)
-** ·¿ÊÑ´¹
+== 型変æ›
-FIX2INT(value), INT2FIX(i)
-FIX2LONG(value), LONG2FIX(l)
-NUM2INT(value), INT2NUM(i)
-NUM2UINT(value), UINT2NUM(ui)
-NUM2LONG(value), LONG2NUM(l)
-NUM2ULONG(value), ULONG2NUM(ul)
-NUM2LL(value), LL2NUM(ll)
-NUM2ULL(value), ULL2NUM(ull)
-NUM2OFFT(value), OFFT2NUM(off)
-NUM2SIZET(value), SIZET2NUM(size)
-NUM2SSIZET(value), SSIZET2NUM(ssize)
-NUM2DBL(value)
-rb_float_new(f)
-StringValue(value)
-StringValuePtr(value)
-StringValueCStr(value)
-rb_str_new2(s)
+ FIX2INT(value), INT2FIX(i)
+ FIX2LONG(value), LONG2FIX(l)
+ NUM2INT(value), INT2NUM(i)
+ NUM2UINT(value), UINT2NUM(ui)
+ NUM2LONG(value), LONG2NUM(l)
+ NUM2ULONG(value), ULONG2NUM(ul)
+ NUM2LL(value), LL2NUM(ll)
+ NUM2ULL(value), ULL2NUM(ull)
+ NUM2OFFT(value), OFFT2NUM(off)
+ NUM2SIZET(value), SIZET2NUM(size)
+ NUM2SSIZET(value), SSIZET2NUM(ssize)
+ rb_integer_pack(value, words, numwords, wordsize, nails, flags), rb_integer_unpack(words, numwords, wordsize, nails, flags)
+ NUM2DBL(value)
+ rb_float_new(f)
+ StringValue(value)
+ StringValuePtr(value)
+ StringValueCStr(value)
+ rb_str_new2(s)
-** ¥¯¥é¥¹/¥â¥¸¥å¡¼¥ëÄêµÁ
+== クラス/モジュール定義
-VALUE rb_define_class(const char *name, VALUE super)
+VALUE rb_define_class(const char *name, VALUE super) ::
- super¤Î¥µ¥Ö¥¯¥é¥¹¤È¤·¤Æ¿·¤·¤¤Ruby¥¯¥é¥¹¤òÄêµÁ¤¹¤ë¡¥
+ superã®ã‚µãƒ–クラスã¨ã—ã¦æ–°ã—ã„Rubyクラスを定義ã™ã‚‹ï¼Ž
-VALUE rb_define_class_under(VALUE module, const char *name, VALUE super)
+VALUE rb_define_class_under(VALUE module, const char *name, VALUE super) ::
- super¤Î¥µ¥Ö¥¯¥é¥¹¤È¤·¤Æ¿·¤·¤¤Ruby¥¯¥é¥¹¤òÄêµÁ¤·¡¤module¤Î
- Äê¿ô¤È¤·¤ÆÄêµÁ¤¹¤ë¡¥
+ superã®ã‚µãƒ–クラスã¨ã—ã¦æ–°ã—ã„Rubyクラスを定義ã—,moduleã®
+ 定数ã¨ã—ã¦å®šç¾©ã™ã‚‹ï¼Ž
-VALUE rb_define_module(const char *name)
+VALUE rb_define_module(const char *name) ::
- ¿·¤·¤¤Ruby¥â¥¸¥å¡¼¥ë¤òÄêµÁ¤¹¤ë¡¥
+ æ–°ã—ã„Rubyモジュールを定義ã™ã‚‹ï¼Ž
-VALUE rb_define_module_under(VALUE module, const char *name)
+VALUE rb_define_module_under(VALUE module, const char *name) ::
- ¿·¤·¤¤Ruby¥â¥¸¥å¡¼¥ë¤òÄêµÁ¤·¡¤module¤ÎÄê¿ô¤È¤·¤ÆÄêµÁ¤¹¤ë¡¥
+ æ–°ã—ã„Rubyモジュールを定義ã—,moduleã®å®šæ•°ã¨ã—ã¦å®šç¾©ã™ã‚‹ï¼Ž
-void rb_include_module(VALUE klass, VALUE module)
+void rb_include_module(VALUE klass, VALUE module) ::
- ¥â¥¸¥å¡¼¥ë¤ò¥¤¥ó¥¯¥ë¡¼¥É¤¹¤ë¡¥class¤¬¤¹¤Ç¤Ëmodule¤ò¥¤¥ó¥¯
- ¥ë¡¼¥É¤·¤Æ¤¤¤ë»þ¤Ë¤Ï²¿¤â¤·¤Ê¤¤(¿½Å¥¤¥ó¥¯¥ë¡¼¥É¤Î¶Ø»ß)¡¥
+ モジュールをインクルードã™ã‚‹ï¼ŽclassãŒã™ã§ã«moduleをインク
+ ルードã—ã¦ã„る時ã«ã¯ä½•ã‚‚ã—ãªã„(多é‡ã‚¤ãƒ³ã‚¯ãƒ«ãƒ¼ãƒ‰ã®ç¦æ­¢).
-void rb_extend_object(VALUE object, VALUE module)
+void rb_extend_object(VALUE object, VALUE module) ::
- ¥ª¥Ö¥¸¥§¥¯¥È¤ò¥â¥¸¥å¡¼¥ë(¤ÇÄêµÁ¤µ¤ì¤Æ¤¤¤ë¥á¥½¥Ã¥É)¤Ç³ÈÄ¥¤¹¤ë¡¥
+ オブジェクトをモジュール(ã§å®šç¾©ã•れã¦ã„るメソッド)ã§æ‹¡å¼µã™ã‚‹ï¼Ž
-** Âç°èÊÑ¿ôÄêµÁ
+== 大域変数定義
-void rb_define_variable(const char *name, VALUE *var)
+void rb_define_variable(const char *name, VALUE *var) ::
- Ruby¤ÈC¤È¤Ç¶¦Í­¤¹¤ë¥°¥í¡¼¥Ð¥ëÊÑ¿ô¤òÄêµÁ¤¹¤ë¡¥ÊÑ¿ô̾¤¬`$'¤Ç
- »Ï¤Þ¤é¤Ê¤¤»þ¤Ë¤Ï¼«Æ°Åª¤ËÄɲ䵤ì¤ë¡¥name¤È¤·¤ÆRuby¤Î¼±ÊÌ»Ò
- ¤È¤·¤Æµö¤µ¤ì¤Ê¤¤Ê¸»ú(Î㤨¤Ð` ')¤ò´Þ¤à¾ì¹ç¤Ë¤ÏRuby¥×¥í¥°¥é
- ¥à¤«¤é¤Ï¸«¤¨¤Ê¤¯¤Ê¤ë¡¥
+ Rubyã¨Cã¨ã§å…±æœ‰ã™ã‚‹ã‚°ãƒ­ãƒ¼ãƒãƒ«å¤‰æ•°ã‚’定義ã™ã‚‹ï¼Žå¤‰æ•°åãŒ`$'ã§
+ å§‹ã¾ã‚‰ãªã„時ã«ã¯è‡ªå‹•çš„ã«è¿½åŠ ã•れる.nameã¨ã—ã¦Rubyã®è­˜åˆ¥å­
+ ã¨ã—ã¦è¨±ã•れãªã„文字(例ãˆã°` ')ã‚’å«ã‚€å ´åˆã«ã¯Rubyプログラ
+ ムã‹ã‚‰ã¯è¦‹ãˆãªããªã‚‹ï¼Ž
-void rb_define_readonly_variable(const char *name, VALUE *var)
+void rb_define_readonly_variable(const char *name, VALUE *var) ::
- Ruby¤ÈC¤È¤Ç¶¦Í­¤¹¤ëread only¤Î¥°¥í¡¼¥Ð¥ëÊÑ¿ô¤òÄêµÁ¤¹¤ë¡¥
- read only¤Ç¤¢¤ë¤³¤È°Ê³°¤Ïrb_define_variable()¤ÈƱ¤¸¡¥
+ Rubyã¨Cã¨ã§å…±æœ‰ã™ã‚‹read onlyã®ã‚°ãƒ­ãƒ¼ãƒãƒ«å¤‰æ•°ã‚’定義ã™ã‚‹ï¼Ž
+ read onlyã§ã‚ã‚‹ã“ã¨ä»¥å¤–ã¯rb_define_variable()ã¨åŒã˜ï¼Ž
-void rb_define_virtual_variable(const char *name,
- VALUE (*getter)(), void (*setter)())
+void rb_define_virtual_variable(const char *name, VALUE (*getter)(), void (*setter)()) ::
- ´Ø¿ô¤Ë¤è¤Ã¤Æ¼Â¸½¤µ¤ì¤ëRubyÊÑ¿ô¤òÄêµÁ¤¹¤ë¡¥ÊÑ¿ô¤¬»²¾È¤µ¤ì¤¿
- »þ¤Ë¤Ïgetter¤¬¡¤ÊÑ¿ô¤ËÃͤ¬¥»¥Ã¥È¤µ¤ì¤¿»þ¤Ë¤Ïsetter¤¬¸Æ¤Ð¤ì
- ¤ë¡¥
+ 関数ã«ã‚ˆã£ã¦å®Ÿç¾ã•れるRuby変数を定義ã™ã‚‹ï¼Žå¤‰æ•°ãŒå‚ç…§ã•れãŸ
+ 時ã«ã¯getterãŒï¼Œå¤‰æ•°ã«å€¤ãŒã‚»ãƒƒãƒˆã•ã‚ŒãŸæ™‚ã«ã¯setterãŒå‘¼ã°ã‚Œ
+ る.
-void rb_define_hooked_variable(const char *name, VALUE *var,
- VALUE (*getter)(), void (*setter)())
+void rb_define_hooked_variable(const char *name, VALUE *var, VALUE (*getter)(), void (*setter)()) ::
- ´Ø¿ô¤Ë¤è¤Ã¤Æhook¤Î¤Ä¤±¤é¤ì¤¿¥°¥í¡¼¥Ð¥ëÊÑ¿ô¤òÄêµÁ¤¹¤ë¡¥ÊÑ¿ô
- ¤¬»²¾È¤µ¤ì¤¿»þ¤Ë¤Ïgetter¤¬¡¤´Ø¿ô¤ËÃͤ¬¥»¥Ã¥È¤µ¤ì¤¿»þ¤Ë¤Ï
- setter¤¬¸Æ¤Ð¤ì¤ë¡¥getter¤äsetter¤Ë0¤ò»ØÄꤷ¤¿»þ¤Ë¤Ïhook¤ò
- »ØÄꤷ¤Ê¤¤¤Î¤ÈƱ¤¸»ö¤Ë¤Ê¤ë¡¥
+ 関数ã«ã‚ˆã£ã¦hookã®ã¤ã‘られãŸã‚°ãƒ­ãƒ¼ãƒãƒ«å¤‰æ•°ã‚’定義ã™ã‚‹ï¼Žå¤‰æ•°
+ ãŒå‚ç…§ã•ã‚ŒãŸæ™‚ã«ã¯getterãŒï¼Œé–¢æ•°ã«å€¤ãŒã‚»ãƒƒãƒˆã•ã‚ŒãŸæ™‚ã«ã¯
+ setterãŒå‘¼ã°ã‚Œã‚‹ï¼Žgetterã‚„setterã«0を指定ã—ãŸæ™‚ã«ã¯hookã‚’
+ 指定ã—ãªã„ã®ã¨åŒã˜äº‹ã«ãªã‚‹ï¼Ž
void rb_global_variable(VALUE *var)
- GC¤Î¤¿¤á¡¤Ruby¥×¥í¥°¥é¥à¤«¤é¤Ï¥¢¥¯¥»¥¹¤µ¤ì¤Ê¤¤¤¬, Ruby¥ª¥Ö
- ¥¸¥§¥¯¥È¤ò´Þ¤àÂç°èÊÑ¿ô¤ò¥Þ¡¼¥¯¤¹¤ë¡¥
+ GCã®ãŸã‚,Rubyプログラムã‹ã‚‰ã¯ã‚¢ã‚¯ã‚»ã‚¹ã•れãªã„ãŒ, Rubyオブ
+ ジェクトをå«ã‚€å¤§åŸŸå¤‰æ•°ã‚’マークã™ã‚‹ï¼Ž
+
+== 定数
+
+void rb_define_const(VALUE klass, const char *name, VALUE val) ::
-** Äê¿ô
+ 定数を定義ã™ã‚‹ï¼Ž
-void rb_define_const(VALUE klass, const char *name, VALUE val)
+void rb_define_global_const(const char *name, VALUE val) ::
- Äê¿ô¤òÄêµÁ¤¹¤ë¡¥
+ 大域定数を定義ã™ã‚‹ï¼Ž
-void rb_define_global_const(const char *name, VALUE val)
+ rb_define_const(rb_cObject, name, val)
- Âç°èÄê¿ô¤òÄêµÁ¤¹¤ë¡¥
+ ã¨åŒã˜æ„味.
- rb_define_const(rb_cObject, name, val)
+== メソッド定義
- ¤ÈƱ¤¸°ÕÌ£¡¥
+rb_define_method(VALUE klass, const char *name, VALUE (*func)(), int argc) ::
-** ¥á¥½¥Ã¥ÉÄêµÁ
+ メソッドを定義ã™ã‚‹ï¼Žargcã¯selfを除ãå¼•æ•°ã®æ•°ï¼ŽargcãŒ-1ã®æ™‚,
+ 関数ã«ã¯å¼•æ•°ã®æ•°(selfã‚’å«ã¾ãªã„)を第1引数, 引数ã®é…列を第2
+ 引数ã¨ã™ã‚‹å½¢å¼ã§ä¸Žãˆã‚‰ã‚Œã‚‹(第3引数ã¯self).argcãŒ-2ã®æ™‚,
+ 第1引数ãŒself, 第2引数ãŒargs(argsã¯å¼•æ•°ã‚’å«ã‚€Rubyã®é…列)ã¨
+ ã„ã†å½¢å¼ã§ä¸Žãˆã‚‰ã‚Œã‚‹ï¼Ž
-rb_define_method(VALUE klass, const char *name, VALUE (*func)(), int argc)
+rb_define_private_method(VALUE klass, const char *name, VALUE (*func)(), int argc) ::
- ¥á¥½¥Ã¥É¤òÄêµÁ¤¹¤ë¡¥argc¤Ïself¤ò½ü¤¯°ú¿ô¤Î¿ô¡¥argc¤¬-1¤Î»þ,
- ´Ø¿ô¤Ë¤Ï°ú¿ô¤Î¿ô(self¤ò´Þ¤Þ¤Ê¤¤)¤òÂè1°ú¿ô, °ú¿ô¤ÎÇÛÎó¤òÂè2
- °ú¿ô¤È¤¹¤ë·Á¼°¤ÇÍ¿¤¨¤é¤ì¤ë(Âè3°ú¿ô¤Ïself)¡¥argc¤¬-2¤Î»þ,
- Âè1°ú¿ô¤¬self, Âè2°ú¿ô¤¬args(args¤Ï°ú¿ô¤ò´Þ¤àRuby¤ÎÇÛÎó)¤È
- ¤¤¤¦·Á¼°¤ÇÍ¿¤¨¤é¤ì¤ë¡¥
-
-rb_define_private_method(VALUE klass, const char *name, VALUE (*func)(), int argc)
+ privateメソッドを定義ã™ã‚‹ï¼Žå¼•æ•°ã¯rb_define_method()ã¨åŒã˜ï¼Ž
- private¥á¥½¥Ã¥É¤òÄêµÁ¤¹¤ë¡¥°ú¿ô¤Ïrb_define_method()¤ÈƱ¤¸¡¥
+rb_define_singleton_method(VALUE klass, const char *name, VALUE (*func)(), int argc) ::
-rb_define_singleton_method(VALUE klass, const char *name, VALUE (*func)(), int argc)
+ 特異メソッドを定義ã™ã‚‹ï¼Žå¼•æ•°ã¯rb_define_method()ã¨åŒã˜ï¼Ž
- ÆÃ°Û¥á¥½¥Ã¥É¤òÄêµÁ¤¹¤ë¡¥°ú¿ô¤Ïrb_define_method()¤ÈƱ¤¸¡¥
+rb_scan_args(int argc, VALUE *argv, const char *fmt, ...) ::
-rb_scan_args(int argc, VALUE *argv, const char *fmt, ...)
+ argc, argvå½¢å¼ã§ä¸Žãˆã‚‰ã‚ŒãŸæŒ‡å®šã•れãŸãƒ•ォーマットã«å¾“ã£ã¦å¼•
+ 数を分解ã—,続ãVALUEã¸ã®å‚ç…§ã«ã‚»ãƒƒãƒˆã—ã¾ã™ï¼Žã“ã®ãƒ•ォーマッ
+ トã¯ï¼ŒABNFã§è¨˜è¿°ã™ã‚‹ã¨ä»¥ä¸‹ã®é€šã‚Šã§ã™ï¼Ž
- argc, argv·Á¼°¤ÇÍ¿¤¨¤é¤ì¤¿»ØÄꤵ¤ì¤¿¥Õ¥©¡¼¥Þ¥Ã¥È¤Ë½¾¤Ã¤Æ°ú
- ¿ô¤òʬ²ò¤·¡¤Â³¤¯VALUE¤Ø¤Î»²¾È¤Ë¥»¥Ã¥È¤·¤Þ¤¹¡¥¤³¤Î¥Õ¥©¡¼¥Þ¥Ã
- ¥È¤Ï¡¤ABNF¤Çµ­½Ò¤¹¤ë¤È°Ê²¼¤ÎÄ̤ê¤Ç¤¹¡¥
+ scan-arg-spec := param-arg-spec [option-hash-arg-spec] [block-arg-spec]
---
-scan-arg-spec := param-arg-spec [option-hash-arg-spec] [block-arg-spec]
+ param-arg-spec := pre-arg-spec [post-arg-spec] / post-arg-spec /
+ pre-opt-post-arg-spec
+ pre-arg-spec := num-of-leading-mandatory-args [num-of-optional-args]
+ post-arg-spec := sym-for-variable-length-args
+ [num-of-trailing-mandatory-args]
+ pre-opt-post-arg-spec := num-of-leading-mandatory-args num-of-optional-args
+ num-of-trailing-mandatory-args
+ option-hash-arg-spec := sym-for-option-hash-arg
+ block-arg-spec := sym-for-block-arg
-param-arg-spec := pre-arg-spec [post-arg-spec] / post-arg-spec / pre-opt-post-arg-spec
-pre-arg-spec := num-of-leading-mandatory-args [num-of-optional-args]
-post-arg-spec := sym-for-variable-length-args [num-of-trailing-mandatory-args]
-pre-opt-post-arg-spec := num-of-leading-mandatory-args num-of-optional-args num-of-trailing-mandatory-args
-option-hash-arg-spec := sym-for-option-hash-arg
-block-arg-spec := sym-for-block-arg
+ num-of-leading-mandatory-args := DIGIT ; 先頭ã«ç½®ã‹ã‚Œã‚‹çœç•¥ä¸èƒ½ãªå¼•æ•°ã®æ•°
+ num-of-optional-args := DIGIT ; ç¶šã„ã¦ç½®ã‹ã‚Œã‚‹çœç•¥å¯èƒ½ãªå¼•æ•°ã®æ•°
+ sym-for-variable-length-args := "*" ; ç¶šã„ã¦ç½®ã‹ã‚Œã‚‹å¯å¤‰é•·å¼•æ•°ã‚’
+ ; Rubyã®é…列ã§å–å¾—ã™ã‚‹ãŸã‚ã®æŒ‡å®š
+ num-of-trailing-mandatory-args := DIGIT ; 終端ã«ç½®ã‹ã‚Œã‚‹çœç•¥ä¸èƒ½ãªå¼•æ•°ã®æ•°
+ sym-for-option-hash-arg := ":" ; オプションãƒãƒƒã‚·ãƒ¥ã‚’å–å¾—ã™ã‚‹
+ ; ãŸã‚ã®æŒ‡å®š; çœç•¥ä¸èƒ½ãªå¼•æ•°ã®
+ ; 数よりも多ãã®å¼•æ•°ãŒæŒ‡å®šã•れ,
+ ; 最後ã®å¼•æ•°ãŒãƒãƒƒã‚·ãƒ¥ï¼ˆã¾ãŸã¯
+ ; #to_hashã§å¤‰æ›å¯èƒ½ï¼‰ã®å ´åˆã«
+ ; å–å¾—ã•れる.最後ã®å¼•æ•°ãŒnilã®
+ ; å ´åˆï¼Œå¯å¤‰é•·å¼•数指定ãŒãªã,
+ ; çœç•¥ä¸èƒ½å¼•æ•°ã®æ•°ã‚ˆã‚Šã‚‚多ãã®
+ ; å¼•æ•°ãŒæŒ‡å®šã•れãŸå ´åˆã«å–å¾—ã•れる
+ sym-for-block-arg := "&" ; イテレータブロックをå–å¾—ã™ã‚‹ãŸã‚ã®
+ ; 指定
-num-of-leading-mandatory-args := DIGIT ; ÀèÆ¬¤ËÃÖ¤«¤ì¤ë¾ÊάÉÔǽ¤Ê°ú¿ô¤Î¿ô
-num-of-optional-args := DIGIT ; ³¤¤¤ÆÃÖ¤«¤ì¤ë¾Êά²Äǽ¤Ê°ú¿ô¤Î¿ô
-sym-for-variable-length-args := "*" ; ³¤¤¤ÆÃÖ¤«¤ì¤ë²ÄÊÑŰú¿ô¤ò
- ; Ruby¤ÎÇÛÎó¤Ç¼èÆÀ¤¹¤ë¤¿¤á¤Î»ØÄê
-num-of-trailing-mandatory-args := DIGIT ; ½ªÃ¼¤ËÃÖ¤«¤ì¤ë¾ÊάÉÔǽ¤Ê°ú¿ô¤Î¿ô
-sym-for-option-hash-arg := ":" ; ¥ª¥×¥·¥ç¥ó¥Ï¥Ã¥·¥å¤ò¼èÆÀ¤¹¤ë
- ; ¤¿¤á¤Î»ØÄê; ¾ÊάÉÔǽ¤Ê°ú¿ô¤Î
- ; ¿ô¤è¤ê¤â¿¤¯¤Î°ú¿ô¤¬»ØÄꤵ¤ì¡¤
- ; ºÇ¸å¤Î°ú¿ô¤¬¥Ï¥Ã¥·¥å¡Ê¤Þ¤¿¤Ï
- ; #to_hash¤ÇÊÑ´¹²Äǽ¡Ë¤Î¾ì¹ç¤Ë
- ; ¼èÆÀ¤µ¤ì¤ë¡¥ºÇ¸å¤Î°ú¿ô¤¬nil¤Î
- ; ¾ì¹ç¡¤²ÄÊÑŰú¿ô»ØÄ꤬¤Ê¤¯¡¤
- ; ¾ÊάÉÔǽ°ú¿ô¤Î¿ô¤è¤ê¤â¿¤¯¤Î
- ; °ú¿ô¤¬»ØÄꤵ¤ì¤¿¾ì¹ç¤Ë¼èÆÀ¤µ¤ì¤ë
-sym-for-block-arg := "&" ; ¥¤¥Æ¥ì¡¼¥¿¥Ö¥í¥Ã¥¯¤ò¼èÆÀ¤¹¤ë¤¿¤á¤Î
- ; »ØÄê
---
+ フォーマットãŒ"12"ã®å ´åˆï¼Œå¼•æ•°ã¯æœ€ä½Ž1ã¤ã§ï¼Œ3ã¤(1+2)ã¾ã§è¨±ã•
+ れるã¨ã„ã†æ„味ã«ãªã‚Šã¾ã™ï¼Žå¾“ã£ã¦ï¼Œãƒ•ォーマット文字列ã«ç¶šã„
+ ã¦3ã¤ã®VALUEã¸ã®å‚ç…§ã‚’ç½®ãå¿…è¦ãŒã‚りã¾ã™ï¼Žãれらã«ã¯å–å¾—ã—ãŸ
+ 変数ãŒã‚»ãƒƒãƒˆã•れã¾ã™ï¼Žå¤‰æ•°ã¸ã®å‚ç…§ã®ä»£ã‚りã«NULLを指定ã™ã‚‹
+ ã“ã¨ã‚‚ã§ã,ãã®å ´åˆã¯å–å¾—ã—ãŸå¼•æ•°ã®å€¤ã¯æ¨ã¦ã‚‰ã‚Œã¾ã™ï¼ŽãªãŠï¼Œ
+ çœç•¥å¯èƒ½å¼•æ•°ãŒçœç•¥ã•ã‚ŒãŸæ™‚ã®å¤‰æ•°ã®å€¤ã¯nil(C言語ã®ãƒ¬ãƒ™ãƒ«ã§ã¯
+ Qnil)ã«ãªã‚Šã¾ã™ï¼Ž
- ¥Õ¥©¡¼¥Þ¥Ã¥È¤¬"12"¤Î¾ì¹ç¡¤°ú¿ô¤ÏºÇÄã1¤Ä¤Ç¡¤3¤Ä(1+2)¤Þ¤Çµö¤µ
- ¤ì¤ë¤È¤¤¤¦°ÕÌ£¤Ë¤Ê¤ê¤Þ¤¹¡¥½¾¤Ã¤Æ¡¤¥Õ¥©¡¼¥Þ¥Ã¥Èʸ»úÎó¤Ë³¤¤
- ¤Æ3¤Ä¤ÎVALUE¤Ø¤Î»²¾È¤òÃÖ¤¯É¬Íפ¬¤¢¤ê¤Þ¤¹¡¥¤½¤ì¤é¤Ë¤Ï¼èÆÀ¤·¤¿
- ÊÑ¿ô¤¬¥»¥Ã¥È¤µ¤ì¤Þ¤¹¡¥ÊÑ¿ô¤Ø¤Î»²¾È¤ÎÂå¤ï¤ê¤ËNULL¤ò»ØÄꤹ¤ë
- ¤³¤È¤â¤Ç¤­¡¤¤½¤Î¾ì¹ç¤Ï¼èÆÀ¤·¤¿°ú¿ô¤ÎÃͤϼΤƤé¤ì¤Þ¤¹¡¥¤Ê¤ª¡¤
- ¾Êά²Äǽ°ú¿ô¤¬¾Êά¤µ¤ì¤¿»þ¤ÎÊÑ¿ô¤ÎÃͤÏnil(C¸À¸ì¤Î¥ì¥Ù¥ë¤Ç¤Ï
- Qnil)¤Ë¤Ê¤ê¤Þ¤¹¡¥
+ 返り値ã¯ä¸Žãˆã‚‰ã‚ŒãŸå¼•æ•°ã®æ•°ã§ã™ï¼Žã‚ªãƒ—ションãƒãƒƒã‚·ãƒ¥ãŠã‚ˆã³ã‚¤
+ ãƒ†ãƒ¬ãƒ¼ã‚¿ãƒ–ãƒ­ãƒƒã‚¯ã¯æ•°ãˆã¾ã›ã‚“.
- ÊÖ¤êÃͤÏÍ¿¤¨¤é¤ì¤¿°ú¿ô¤Î¿ô¤Ç¤¹¡¥¥ª¥×¥·¥ç¥ó¥Ï¥Ã¥·¥å¤ª¤è¤Ó¥¤
- ¥Æ¥ì¡¼¥¿¥Ö¥í¥Ã¥¯¤Ï¿ô¤¨¤Þ¤»¤ó¡¥
+== Rubyメソッド呼ã³å‡ºã—
-** Ruby¥á¥½¥Ã¥É¸Æ¤Ó½Ð¤·
+VALUE rb_funcall(VALUE recv, ID mid, int narg, ...) ::
-VALUE rb_funcall(VALUE recv, ID mid, int narg, ...)
+ メソッド呼ã³å‡ºã—.文字列ã‹ã‚‰midã‚’å¾—ã‚‹ãŸã‚ã«ã¯rb_intern()ã‚’
+ 使ã†ï¼Ž
+ private/protectedãªãƒ¡ã‚½ãƒƒãƒ‰ã§ã‚‚呼ã³å‡ºã›ã‚‹ï¼Ž
- ¥á¥½¥Ã¥É¸Æ¤Ó½Ð¤·¡¥Ê¸»úÎ󤫤émid¤òÆÀ¤ë¤¿¤á¤Ë¤Ïrb_intern()¤ò
- »È¤¦¡¥
+VALUE rb_funcall2(VALUE recv, ID mid, int argc, VALUE *argv) ::
+VALUE rb_funcallv(VALUE recv, ID mid, int argc, VALUE *argv) ::
-VALUE rb_funcall2(VALUE recv, ID mid, int argc, VALUE *argv)
+ メソッド呼ã³å‡ºã—.引数をargc, argvå½¢å¼ã§æ¸¡ã™ï¼Ž
+ private/protectedãªãƒ¡ã‚½ãƒƒãƒ‰ã§ã‚‚呼ã³å‡ºã›ã‚‹ï¼Ž
- ¥á¥½¥Ã¥É¸Æ¤Ó½Ð¤·¡¥°ú¿ô¤òargc, argv·Á¼°¤ÇÅϤ¹¡¥
+VALUE rb_funcallv_public(VALUE recv, ID mid, int argc, VALUE *argv) ::
+
+ メソッド呼ã³å‡ºã—.
+ publicãªãƒ¡ã‚½ãƒƒãƒ‰ã—ã‹å‘¼ã¹ãªã„.
VALUE rb_eval_string(const char *str)
- ʸ»úÎó¤òRuby¥¹¥¯¥ê¥×¥È¤È¤·¤Æ¥³¥ó¥Ñ¥¤¥ë¡¦¼Â¹Ô¤¹¤ë¡¥
+ 文字列をRubyスクリプトã¨ã—ã¦ã‚³ãƒ³ãƒ‘イル・実行ã™ã‚‹ï¼Ž
+
+ID rb_intern(const char *name) ::
+
+ 文字列ã«å¯¾å¿œã™ã‚‹IDã‚’è¿”ã™ï¼Ž
-ID rb_intern(const char *name)
+char *rb_id2name(ID id) ::
- ʸ»úÎó¤ËÂбþ¤¹¤ëID¤òÊÖ¤¹¡¥
+ IDã«å¯¾å¿œã™ã‚‹æ–‡å­—列を返ã™(デãƒãƒƒã‚°ç”¨).
-char *rb_id2name(ID id)
+char *rb_class2name(VALUE klass) ::
- ID¤ËÂбþ¤¹¤ëʸ»úÎó¤òÊÖ¤¹(¥Ç¥Ð¥Ã¥°ÍÑ)¡¥
+ クラスã®åå‰ã‚’è¿”ã™(デãƒãƒƒã‚°ç”¨).クラスãŒåå‰ã‚’æŒãŸãªã„時ã«
+ ã¯, 祖先をé¡ã£ã¦åå‰ã‚’æŒã¤ã‚¯ãƒ©ã‚¹ã®åå‰ã‚’è¿”ã™ï¼Ž
-char *rb_class2name(VALUE klass)
+int rb_respond_to(VALUE obj, ID id) ::
- ¥¯¥é¥¹¤Î̾Á°¤òÊÖ¤¹(¥Ç¥Ð¥Ã¥°ÍÑ)¡¥¥¯¥é¥¹¤¬Ì¾Á°¤ò»ý¤¿¤Ê¤¤»þ¤Ë
- ¤Ï, ÁÄÀè¤òÁ̤äÆÌ¾Á°¤ò»ý¤Ä¥¯¥é¥¹¤Î̾Á°¤òÊÖ¤¹¡¥
+ objãŒidã§ç¤ºã•れるメソッドをæŒã¤ã‹ã©ã†ã‹ã‚’è¿”ã™ï¼Ž
-int rb_respond_to(VALUE obj, ID id)
+== インスタンス変数
- obj¤¬id¤Ç¼¨¤µ¤ì¤ë¥á¥½¥Ã¥É¤ò»ý¤Ä¤«¤É¤¦¤«¤òÊÖ¤¹¡¥
+VALUE rb_iv_get(VALUE obj, const char *name) ::
-** ¥¤¥ó¥¹¥¿¥ó¥¹ÊÑ¿ô
+ objã®ã‚¤ãƒ³ã‚¹ã‚¿ãƒ³ã‚¹å¤‰æ•°ã®å€¤ã‚’得る.`@'ã§å§‹ã¾ã‚‰ãªã„インスタン
+ ス変数㯠Rubyプログラムã‹ã‚‰ã‚¢ã‚¯ã‚»ã‚¹ã§ããªã„「隠れãŸã€ã‚¤ãƒ³
+ スタンス変数ã«ãªã‚‹ï¼Žå®šæ•°ã¯å¤§æ–‡å­—ã®åå‰ã‚’æŒã¤ã‚¯ãƒ©ã‚¹(ã¾ãŸã¯
+ モジュール)ã®ã‚¤ãƒ³ã‚¹ã‚¿ãƒ³ã‚¹å¤‰æ•°ã¨ã—ã¦å®Ÿè£…ã•れã¦ã„る.
-VALUE rb_iv_get(VALUE obj, const char *name)
+VALUE rb_iv_set(VALUE obj, const char *name, VALUE val) ::
- obj¤Î¥¤¥ó¥¹¥¿¥ó¥¹ÊÑ¿ô¤ÎÃͤòÆÀ¤ë¡¥`@'¤Ç»Ï¤Þ¤é¤Ê¤¤¥¤¥ó¥¹¥¿¥ó
- ¥¹ÊÑ¿ô¤Ï Ruby¥×¥í¥°¥é¥à¤«¤é¥¢¥¯¥»¥¹¤Ç¤­¤Ê¤¤¡Ö±£¤ì¤¿¡×¥¤¥ó
- ¥¹¥¿¥ó¥¹ÊÑ¿ô¤Ë¤Ê¤ë¡¥Äê¿ô¤ÏÂçʸ»ú¤Î̾Á°¤ò»ý¤Ä¥¯¥é¥¹(¤Þ¤¿¤Ï
- ¥â¥¸¥å¡¼¥ë)¤Î¥¤¥ó¥¹¥¿¥ó¥¹ÊÑ¿ô¤È¤·¤Æ¼ÂÁõ¤µ¤ì¤Æ¤¤¤ë¡¥
+ objã®ã‚¤ãƒ³ã‚¹ã‚¿ãƒ³ã‚¹å¤‰æ•°ã‚’valã«ã‚»ãƒƒãƒˆã™ã‚‹ï¼Ž
-VALUE rb_iv_set(VALUE obj, const char *name, VALUE val)
+== 制御構造
- obj¤Î¥¤¥ó¥¹¥¿¥ó¥¹ÊÑ¿ô¤òval¤Ë¥»¥Ã¥È¤¹¤ë¡¥
+VALUE rb_block_call(VALUE obj, ID mid, int argc, VALUE * argv, VALUE (*func) (ANYARGS), VALUE data2) ::
-** À©¸æ¹½Â¤
+ funcをブロックã¨ã—ã¦è¨­å®šã—,objをレシーãƒï¼Œargcã¨argvを引数
+ ã¨ã—ã¦midメソッドを呼ã³å‡ºã™ï¼Žfuncã¯ç¬¬ä¸€å¼•æ•°ã«yieldã•れãŸå€¤ï¼Œ
+ 第二引数ã«data2ã‚’å—ã‘å–る.複数ã®å€¤ãŒyieldã•れãŸå ´åˆ(Cã§ã¯
+ rb_yield_values()ã¨rb_yield_values2(), rb_yield_splat()),
+ data2ã¯Arrayã¨ã—ã¦ãƒ‘ックã•れã¦ã„る.第三, 第四引数ã®argcã¨
+ argvã«ã‚ˆã£ã¦yieldã•れãŸå€¤ã‚’å–り出ã™ã“ã¨ãŒã§ãる.
-VALUE rb_block_call(VALUE obj, ID mid, int argc, VALUE * argv,
- VALUE (*func) (ANYARGS), VALUE data2)
+[OBSOLETE] VALUE rb_iterate(VALUE (*func1)(), VALUE arg1, VALUE (*func2)(), VALUE arg2) ::
- func¤ò¥Ö¥í¥Ã¥¯¤È¤·¤ÆÀßÄꤷ¡¤obj¤ò¥ì¥·¡¼¥Ð¡¤argc¤Èargv¤ò°ú¿ô
- ¤È¤·¤Æmid¥á¥½¥Ã¥É¤ò¸Æ¤Ó½Ð¤¹¡¥func¤ÏÂè°ì°ú¿ô¤Ëyield¤µ¤ì¤¿ÃÍ¡¤
- ÂèÆó°ú¿ô¤Ëdata2¤ò¼õ¤±¼è¤ë¡¥Ê£¿ô¤ÎÃͤ¬yield¤µ¤ì¤¿¾ì¹ç(C¤Ç¤Ï
- rb_yield_values()¤Èrb_yield_values2(), rb_yield_splat())¡¤
- data2¤ÏArray¤È¤·¤Æ¥Ñ¥Ã¥¯¤µ¤ì¤Æ¤¤¤ë¡¥Âè»°, Âè»Í°ú¿ô¤Îargc¤È
- argv¤Ë¤è¤Ã¤Æyield¤µ¤ì¤¿Ãͤò¼è¤ê½Ð¤¹¤³¤È¤¬¤Ç¤­¤ë¡¥
+ func2をブロックã¨ã—ã¦è¨­å®šã—, func1をイテレータã¨ã—ã¦å‘¼ã¶ï¼Ž
+ func1ã«ã¯ arg1ãŒå¼•æ•°ã¨ã—ã¦æ¸¡ã•れ, func2ã«ã¯ç¬¬1引数ã«ã‚¤ãƒ†ãƒ¬ãƒ¼
+ ã‚¿ã‹ã‚‰ä¸Žãˆã‚‰ã‚ŒãŸå€¤, 第2引数ã«arg2ãŒæ¸¡ã•れる.
-[OBSOLETE] VALUE rb_iterate(VALUE (*func1)(), VALUE arg1, VALUE (*func2)(), VALUE arg2)
+ 1.9ã§rb_iterateを使ã†å ´åˆã¯, func1ã®ä¸­ã§Rubyレベルã®ãƒ¡ã‚½ãƒƒãƒ‰
+ を呼ã³å‡ºã•ãªã‘れã°ãªã‚‰ãªã„.
+ 1.9ã§obsoleteã¨ãªã£ãŸ. 代ã‚りã«rb_block_callãŒç”¨æ„ã•れãŸ.
- func2¤ò¥Ö¥í¥Ã¥¯¤È¤·¤ÆÀßÄꤷ, func1¤ò¥¤¥Æ¥ì¡¼¥¿¤È¤·¤Æ¸Æ¤Ö¡¥
- func1¤Ë¤Ï arg1¤¬°ú¿ô¤È¤·¤ÆÅϤµ¤ì, func2¤Ë¤ÏÂè1°ú¿ô¤Ë¥¤¥Æ¥ì¡¼
- ¥¿¤«¤éÍ¿¤¨¤é¤ì¤¿ÃÍ, Âè2°ú¿ô¤Ëarg2¤¬ÅϤµ¤ì¤ë¡¥
-
- 1.9¤Çrb_iterate¤ò»È¤¦¾ì¹ç¤Ï, func1¤ÎÃæ¤ÇRuby¥ì¥Ù¥ë¤Î¥á¥½¥Ã¥É
- ¤ò¸Æ¤Ó½Ð¤µ¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤.
- 1.9¤Çobsolete¤È¤Ê¤Ã¤¿. Âå¤ï¤ê¤Ërb_block_call¤¬ÍѰդµ¤ì¤¿.
+VALUE rb_yield(VALUE val) ::
-VALUE rb_yield(VALUE val)
+ valを値ã¨ã—ã¦ã‚¤ãƒ†ãƒ¬ãƒ¼ã‚¿ãƒ–ロックを呼ã³å‡ºã™ï¼Ž
- val¤òÃͤȤ·¤Æ¥¤¥Æ¥ì¡¼¥¿¥Ö¥í¥Ã¥¯¤ò¸Æ¤Ó½Ð¤¹¡¥
+VALUE rb_rescue(VALUE (*func1)(), VALUE arg1, VALUE (*func2)(), VALUE arg2) ::
-VALUE rb_rescue(VALUE (*func1)(), VALUE arg1, VALUE (*func2)(), VALUE arg2)
+ 関数func1ã‚’arg1を引数ã«å‘¼ã³å‡ºã™ï¼Žfunc1ã®å®Ÿè¡Œä¸­ã«ä¾‹å¤–ãŒç™ºç”Ÿ
+ ã—ãŸæ™‚ã«ã¯ func2ã‚’arg2を引数ã¨ã—ã¦å‘¼ã¶ï¼Žæˆ»ã‚Šå€¤ã¯ä¾‹å¤–ãŒç™ºç”Ÿ
+ ã—ãªã‹ã£ãŸæ™‚ã¯func1ã®æˆ»ã‚Šå€¤, 例外ãŒç™ºç”Ÿã—ãŸæ™‚ã«ã¯func2ã®æˆ»
+ り値ã§ã‚る.
- ´Ø¿ôfunc1¤òarg1¤ò°ú¿ô¤Ë¸Æ¤Ó½Ð¤¹¡¥func1¤Î¼Â¹ÔÃæ¤ËÎã³°¤¬È¯À¸
- ¤·¤¿»þ¤Ë¤Ï func2¤òarg2¤ò°ú¿ô¤È¤·¤Æ¸Æ¤Ö¡¥Ìá¤êÃͤÏÎã³°¤¬È¯À¸
- ¤·¤Ê¤«¤Ã¤¿»þ¤Ïfunc1¤ÎÌá¤êÃÍ, Îã³°¤¬È¯À¸¤·¤¿»þ¤Ë¤Ïfunc2¤ÎÌá
- ¤êÃͤǤ¢¤ë¡¥
+VALUE rb_ensure(VALUE (*func1)(), VALUE arg1, VALUE (*func2)(), VALUE arg2) ::
-VALUE rb_ensure(VALUE (*func1)(), VALUE arg1, VALUE (*func2)(), VALUE arg2)
+ 関数func1ã‚’arg1を引数ã¨ã—ã¦å®Ÿè¡Œã—, 実行終了後(ãŸã¨ãˆä¾‹å¤–ãŒ
+ 発生ã—ã¦ã‚‚) func2ã‚’arg2を引数ã¨ã—ã¦å®Ÿè¡Œã™ã‚‹ï¼Žæˆ»ã‚Šå€¤ã¯func1
+ ã®æˆ»ã‚Šå€¤ã§ã‚ã‚‹(例外ãŒç™ºç”Ÿã—ãŸæ™‚ã¯æˆ»ã‚‰ãªã„).
- ´Ø¿ôfunc1¤òarg1¤ò°ú¿ô¤È¤·¤Æ¼Â¹Ô¤·, ¼Â¹Ô½ªÎ»¸å(¤¿¤È¤¨Îã³°¤¬
- ȯÀ¸¤·¤Æ¤â) func2¤òarg2¤ò°ú¿ô¤È¤·¤Æ¼Â¹Ô¤¹¤ë¡¥Ìá¤êÃͤÏfunc1
- ¤ÎÌá¤êÃͤǤ¢¤ë(Îã³°¤¬È¯À¸¤·¤¿»þ¤ÏÌá¤é¤Ê¤¤)¡¥
+VALUE rb_protect(VALUE (*func) (VALUE), VALUE arg, int *state) ::
-VALUE rb_protect(VALUE (*func) (VALUE), VALUE arg, int *state)
+ 関数funcã‚’argを引数ã¨ã—ã¦å®Ÿè¡Œã—, 例外ãŒç™ºç”Ÿã—ãªã‘れã°ãã®æˆ»
+ り値を返ã™ï¼Žä¾‹å¤–ãŒç™ºç”Ÿã—ãŸå ´åˆã¯, *stateã«éž0をセットã—ã¦
+ Qnilã‚’è¿”ã™ï¼Ž
+ rb_jump_tag()を呼ã°ãšã«æ•æ‰ã—ãŸä¾‹å¤–を無視ã™ã‚‹å ´åˆã«ã¯ï¼Œ
+ rb_set_errinfo(Qnil)ã§ã‚¨ãƒ©ãƒ¼æƒ…報をクリアã—ãªã‘れã°ãªã‚‰ãªã„.
- ´Ø¿ôfunc¤òarg¤ò°ú¿ô¤È¤·¤Æ¼Â¹Ô¤·, Îã³°¤¬È¯À¸¤·¤Ê¤±¤ì¤Ð¤½¤ÎÌá
- ¤êÃͤòÊÖ¤¹¡¥Îã³°¤¬È¯À¸¤·¤¿¾ì¹ç¤Ï, *state¤ËÈó0¤ò¥»¥Ã¥È¤·¤Æ
- Qnil¤òÊÖ¤¹¡¥
+void rb_jump_tag(int state) ::
-void rb_jump_tag(int state)
+ rb_protect()ã‚„rb_eval_string_protect()ã§æ•æ‰ã•れãŸä¾‹å¤–ã‚’å†
+ é€ã™ã‚‹ï¼Žstateã¯ãれらã®é–¢æ•°ã‹ã‚‰è¿”ã•れãŸå€¤ã§ãªã‘れã°ãªã‚‰ãªã„.
+ ã“ã®é–¢æ•°ã¯ç›´æŽ¥ã®å‘¼ã³å‡ºã—å…ƒã«æˆ»ã‚‰ãªã„.
- rb_protect()¤ärb_eval_string_protect()¤ÇÊ᪤µ¤ì¤¿Îã³°¤òºÆ
- Á÷¤¹¤ë¡¥state¤Ï¤½¤ì¤é¤Î´Ø¿ô¤«¤éÊÖ¤µ¤ì¤¿ÃͤǤʤ±¤ì¤Ð¤Ê¤é¤Ê¤¤¡¥
- ¤³¤Î´Ø¿ô¤ÏľÀܤθƤӽФ·¸µ¤ËÌá¤é¤Ê¤¤¡¥
+void rb_iter_break() ::
-** Îã³°¡¦¥¨¥é¡¼
+ ç¾åœ¨ã®æœ€ã‚‚内å´ã®ãƒ–ロックを終了ã™ã‚‹ï¼Žã“ã®é–¢æ•°ã¯ç›´æŽ¥ã®å‘¼ã³å‡º
+ ã—å…ƒã«æˆ»ã‚‰ãªã„.
-void rb_warning(const char *fmt, ...)
+void rb_iter_break_value(VALUE value) ::
- rb_verbose»þ¤Ëɸ½à¥¨¥é¡¼½ÐÎϤ˷ٹð¾ðÊó¤òɽ¼¨¤¹¤ë¡¥°ú¿ô¤Ï
- printf()¤ÈƱ¤¸¡¥
+ ç¾åœ¨ã®æœ€ã‚‚内å´ã®ãƒ–ロックをvalueã§çµ‚了ã™ã‚‹ï¼Žãƒ–ロックã¯å¼•æ•°ã§
+ 与ãˆã‚‰ã‚ŒãŸvalueã‚’è¿”ã™ï¼Žã“ã®é–¢æ•°ã¯ç›´æŽ¥ã®å‘¼ã³å‡ºã—å…ƒã«æˆ»ã‚‰ãªã„.
-void rb_raise(rb_eRuntimeError, const char *fmt, ...)
+== 例外・エラー
- RuntimeErrorÎã³°¤òȯÀ¸¤µ¤»¤ë¡¥°ú¿ô¤Ïprintf()¤ÈƱ¤¸¡¥
+void rb_warning(const char *fmt, ...) ::
-void rb_raise(VALUE exception, const char *fmt, ...)
+ rb_verboseæ™‚ã«æ¨™æº–エラー出力ã«è­¦å‘Šæƒ…報を表示ã™ã‚‹ï¼Žå¼•æ•°ã¯
+ printf()ã¨åŒã˜ï¼Ž
- exception¤Ç»ØÄꤷ¤¿Îã³°¤òȯÀ¸¤µ¤»¤ë¡¥fmt°Ê²¼¤Î°ú¿ô¤Ï
- printf()¤ÈƱ¤¸¡¥
+void rb_raise(rb_eRuntimeError, const char *fmt, ...) ::
-void rb_fatal(const char *fmt, ...)
+ RuntimeError例外を発生ã•ã›ã‚‹ï¼Žå¼•æ•°ã¯printf()ã¨åŒã˜ï¼Ž
- Ã×̿ŪÎã³°¤òȯÀ¸¤µ¤»¤ë¡¥Ä̾ï¤ÎÎã³°½èÍý¤Ï¹Ô¤Ê¤ï¤ì¤º, ¥¤¥ó¥¿¡¼
- ¥×¥ê¥¿¤¬½ªÎ»¤¹¤ë(¤¿¤À¤·ensure¤Ç»ØÄꤵ¤ì¤¿¥³¡¼¥É¤Ï½ªÎ»Á°¤Ë
- ¼Â¹Ô¤µ¤ì¤ë)¡¥
+void rb_raise(VALUE exception, const char *fmt, ...) ::
-void rb_bug(const char *fmt, ...)
+ exceptionã§æŒ‡å®šã—ãŸä¾‹å¤–を発生ã•ã›ã‚‹ï¼Žfmt以下ã®å¼•æ•°ã¯
+ printf()ã¨åŒã˜ï¼Ž
- ¥¤¥ó¥¿¡¼¥×¥ê¥¿¤Ê¤É¥×¥í¥°¥é¥à¤Î¥Ð¥°¤Ç¤·¤«È¯À¸¤¹¤ë¤Ï¤º¤Î¤Ê¤¤
- ¾õ¶·¤Î»þ¸Æ¤Ö¡¥¥¤¥ó¥¿¡¼¥×¥ê¥¿¤Ï¥³¥¢¥À¥ó¥×¤·Ä¾¤Á¤Ë½ªÎ»¤¹¤ë¡¥
- Îã³°½èÍý¤Ï°ìÀڹԤʤï¤ì¤Ê¤¤¡¥
+void rb_fatal(const char *fmt, ...) ::
-** Ruby¤Î½é´ü²½¡¦¼Â¹Ô
+ 致命的例外を発生ã•ã›ã‚‹ï¼Žé€šå¸¸ã®ä¾‹å¤–処ç†ã¯è¡Œãªã‚れãš, インター
+ プリタãŒçµ‚了ã™ã‚‹(ãŸã ã—ensureã§æŒ‡å®šã•れãŸã‚³ãƒ¼ãƒ‰ã¯çµ‚了å‰ã«
+ 実行ã•れる).
-Ruby¤ò¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¤ËËä¤á¹þ¤à¾ì¹ç¤Ë¤Ï°Ê²¼¤Î¥¤¥ó¥¿¥Õ¥§¡¼¥¹
-¤ò»È¤¦¡¥Ä̾ï¤Î³ÈÄ¥¥é¥¤¥Ö¥é¥ê¤Ë¤ÏɬÍפʤ¤¡¥
+void rb_bug(const char *fmt, ...) ::
-void ruby_init()
+ インタープリタãªã©ãƒ—ログラムã®ãƒã‚°ã§ã—ã‹ç™ºç”Ÿã™ã‚‹ã¯ãšã®ãªã„
+ 状æ³ã®æ™‚呼ã¶ï¼Žã‚¤ãƒ³ã‚¿ãƒ¼ãƒ—リタã¯ã‚³ã‚¢ãƒ€ãƒ³ãƒ—ã—ç›´ã¡ã«çµ‚了ã™ã‚‹ï¼Ž
+ 例外処ç†ã¯ä¸€åˆ‡è¡Œãªã‚れãªã„.
- Ruby¥¤¥ó¥¿¥×¥ê¥¿¤Î½é´ü²½¤ò¹Ô¤Ê¤¦¡¥
+注æ„: %iã¯Object#to_s('+'ãƒ•ãƒ©ã‚°ãŒæŒ‡å®šã•れã¦ã„ã‚‹ã¨ãã¯Object#inspect)ã‚’
+使ã£ãŸVALUEã®å‡ºåŠ›ã«ä½¿ç”¨ã•れã¦ã„ã‚‹ãŸã‚,整数ã«ã¯%dを使用ã™ã‚‹ã“ã¨ï¼Ž
-void ruby_options(int argc, char **argv)
+== Rubyã®åˆæœŸåŒ–・実行
- Ruby¥¤¥ó¥¿¥×¥ê¥¿¤Î¥³¥Þ¥ó¥É¥é¥¤¥ó°ú¿ô¤Î½èÍý¤ò¹Ô¤Ê¤¦¡¥
+Rubyをアプリケーションã«åŸ‹ã‚込む場åˆã«ã¯ä»¥ä¸‹ã®ã‚¤ãƒ³ã‚¿ãƒ•ェース
+を使ã†ï¼Žé€šå¸¸ã®æ‹¡å¼µãƒ©ã‚¤ãƒ–ラリã«ã¯å¿…è¦ãªã„.
-void ruby_run()
+void ruby_init() ::
- Ruby¥¤¥ó¥¿¥×¥ê¥¿¤ò¼Â¹Ô¤¹¤ë¡¥
+ Rubyインタプリタã®åˆæœŸåŒ–を行ãªã†ï¼Ž
-void ruby_script(char *name)
+void ruby_options(int argc, char **argv) ::
- Ruby¤Î¥¹¥¯¥ê¥×¥È̾($0)¤òÀßÄꤹ¤ë¡¥
+ Rubyインタプリタã®ã‚³ãƒžãƒ³ãƒ‰ãƒ©ã‚¤ãƒ³å¼•æ•°ã®å‡¦ç†ã‚’行ãªã†ï¼Ž
-** ¥¤¥ó¥¿¥×¥ê¥¿¤Î¥¤¥Ù¥ó¥È¤Î¥Õ¥Ã¥¯
+void ruby_run() ::
- void rb_add_event_hook(rb_event_hook_func_t func, rb_event_flag_t events, VALUE data)
+ Rubyインタプリタを実行ã™ã‚‹ï¼Ž
-»ØÄꤵ¤ì¤¿¥¤¥ó¥¿¥×¥ê¥¿¤Î¥¤¥Ù¥ó¥È¤ËÂФ¹¤ë¥Õ¥Ã¥¯´Ø¿ô¤òÄɲä·¤Þ¤¹¡¥
-events¤Ï°Ê²¼¤ÎÃͤÎor¤Ç¤Ê¤±¤ì¤Ð¤Ê¤ê¤Þ¤»¤ó:
+void ruby_script(char *name) ::
- RUBY_EVENT_LINE
- RUBY_EVENT_CLASS
- RUBY_EVENT_END
- RUBY_EVENT_CALL
- RUBY_EVENT_RETURN
- RUBY_EVENT_C_CALL
- RUBY_EVENT_C_RETURN
- RUBY_EVENT_RAISE
- RUBY_EVENT_ALL
+ Rubyã®ã‚¹ã‚¯ãƒªãƒ—トå($0)を設定ã™ã‚‹ï¼Ž
-rb_event_hook_func_t¤ÎÄêµÁ¤Ï°Ê²¼¤ÎÄ̤ê¤Ç¤¹:
+== インタプリタã®ã‚¤ãƒ™ãƒ³ãƒˆã®ãƒ•ック
- typedef void (*rb_event_hook_func_t)(rb_event_t event, VALUE data,
- VALUE self, ID id, VALUE klass)
+ void rb_add_event_hook(rb_event_hook_func_t func, rb_event_flag_t events,
+ VALUE data)
-rb_add_event_hook() ¤ÎÂè3°ú¿ô data ¤Ï¡¤¥Õ¥Ã¥¯´Ø¿ô¤ÎÂè2°ú¿ô¤È
-¤·¤ÆÅϤµ¤ì¤Þ¤¹¡¥¤³¤ì¤Ï1.8¤Ç¤Ï¸½ºß¤ÎNODE¤Ø¤Î¥Ý¥¤¥ó¥¿¤Ç¤·¤¿¡¥°Ê
-²¼¤Î RB_EVENT_HOOKS_HAVE_CALLBACK_DATA ¤â»²¾È¤·¤Æ¤¯¤À¤µ¤¤¡¥
+指定ã•れãŸã‚¤ãƒ³ã‚¿ãƒ—リタã®ã‚¤ãƒ™ãƒ³ãƒˆã«å¯¾ã™ã‚‹ãƒ•ック関数を追加ã—ã¾ã™ï¼Ž
+eventsã¯ä»¥ä¸‹ã®å€¤ã®orã§ãªã‘れã°ãªã‚Šã¾ã›ã‚“:
- int rb_remove_event_hook(rb_event_hook_func_t func)
+ RUBY_EVENT_LINE
+ RUBY_EVENT_CLASS
+ RUBY_EVENT_END
+ RUBY_EVENT_CALL
+ RUBY_EVENT_RETURN
+ RUBY_EVENT_C_CALL
+ RUBY_EVENT_C_RETURN
+ RUBY_EVENT_RAISE
+ RUBY_EVENT_ALL
-»ØÄꤵ¤ì¤¿¥Õ¥Ã¥¯´Ø¿ô¤òºï½ü¤·¤Þ¤¹¡¥
+rb_event_hook_func_tã®å®šç¾©ã¯ä»¥ä¸‹ã®é€šã‚Šã§ã™:
-** ¸ß´¹À­¤Î¤¿¤á¤Î¥Þ¥¯¥í
+ typedef void (*rb_event_hook_func_t)(rb_event_t event, VALUE data,
+ VALUE self, ID id, VALUE klass)
-API¤Î¸ß´¹À­¤ò¥Á¥§¥Ã¥¯¤¹¤ë¤¿¤á¤Ë°Ê²¼¤Î¥Þ¥¯¥í¤¬¥Ç¥Õ¥©¥ë¥È¤ÇÄêµÁ¤µ¤ì¤Æ¤¤¤Þ¤¹¡¥
+rb_add_event_hook() ã®ç¬¬3引数 data ã¯ï¼Œãƒ•ック関数ã®ç¬¬2引数ã¨
+ã—ã¦æ¸¡ã•れã¾ã™ï¼Žã“れã¯1.8ã§ã¯ç¾åœ¨ã®NODEã¸ã®ãƒã‚¤ãƒ³ã‚¿ã§ã—ãŸï¼Žä»¥
+下㮠RB_EVENT_HOOKS_HAVE_CALLBACK_DATA ã‚‚å‚ç…§ã—ã¦ãã ã•ã„.
-NORETURN_STYLE_NEW
+ int rb_remove_event_hook(rb_event_hook_func_t func)
- NORETURN ¥Þ¥¯¥í¤¬´Ø¿ô·¿¥Þ¥¯¥í¤È¤·¤ÆÄêµÁ¤µ¤ì¤Æ¤¤¤ë¤³¤È¤ò°ÕÌ£¤¹¤ë¡¥
+指定ã•れãŸãƒ•ック関数を削除ã—ã¾ã™ï¼Ž
-HAVE_RB_DEFINE_ALLOC_FUNC
+== äº’æ›æ€§ã®ãŸã‚ã®ãƒžã‚¯ãƒ­
- rb_define_alloc_func() ´Ø¿ô¤¬Ä󶡤µ¤ì¤Æ¤¤¤ë¤³¤È¡¤¤Ä¤Þ¤ê
- allocation framework ¤¬»È¤ï¤ì¤ë¤³¤È¤ò°ÕÌ£¤¹¤ë¡¥
+APIã®äº’æ›æ€§ã‚’ãƒã‚§ãƒƒã‚¯ã™ã‚‹ãŸã‚ã«ä»¥ä¸‹ã®ãƒžã‚¯ãƒ­ãŒãƒ‡ãƒ•ォルトã§å®šç¾©ã•れã¦ã„ã¾ã™ï¼Ž
+
+NORETURN_STYLE_NEW ::
+
+ NORETURN マクロãŒé–¢æ•°åž‹ãƒžã‚¯ãƒ­ã¨ã—ã¦å®šç¾©ã•れã¦ã„ã‚‹ã“ã¨ã‚’æ„味ã™ã‚‹ï¼Ž
+
+HAVE_RB_DEFINE_ALLOC_FUNC ::
+
+ rb_define_alloc_func() é–¢æ•°ãŒæä¾›ã•れã¦ã„ã‚‹ã“ã¨ï¼Œã¤ã¾ã‚Š
+ allocation framework ãŒä½¿ã‚れるã“ã¨ã‚’æ„味ã™ã‚‹ï¼Ž
have_func("rb_define_alloc_func", "ruby.h")
- ¤Î·ë²Ì¤ÈƱ¤¸¡¥
+ ã®çµæžœã¨åŒã˜ï¼Ž
-HAVE_RB_REG_NEW_STR
+HAVE_RB_REG_NEW_STR ::
- String¥ª¥Ö¥¸¥§¥¯¥È¤«¤éRegexp¥ª¥Ö¥¸¥§¥¯¥È¤òºî¤ë
- rb_reg_new_str() ´Ø¿ô¤¬Ä󶡤µ¤ì¤Æ¤¤¤ë¤³¤È¤ò°ÕÌ£¤¹¤ë¡¥
+ Stringオブジェクトã‹ã‚‰Regexpオブジェクトを作る
+ rb_reg_new_str() é–¢æ•°ãŒæä¾›ã•れã¦ã„ã‚‹ã“ã¨ã‚’æ„味ã™ã‚‹ï¼Ž
have_func("rb_reg_new_str", "ruby.h").
- ¤Î·ë²Ì¤ÈƱ¤¸¡¥
+ ã®çµæžœã¨åŒã˜ï¼Ž
-HAVE_RB_IO_T
+HAVE_RB_IO_T ::
- rb_io_t ·¿¤¬Ä󶡤µ¤ì¤Æ¤¤¤ë¤³¤È¤ò°ÕÌ£¤¹¤ë¡¥
+ rb_io_t åž‹ãŒæä¾›ã•れã¦ã„ã‚‹ã“ã¨ã‚’æ„味ã™ã‚‹ï¼Ž
-USE_SYMBOL_AS_METHOD_NAME
+USE_SYMBOL_AS_METHOD_NAME ::
- ¥á¥½¥Ã¥É̾¤òÊÖ¤¹¥á¥½¥Ã¥É¡¤Module#methods, #singleton_methods
- ¤Ê¤É¤¬Symbol¤òÊÖ¤¹¤³¤È¤ò°ÕÌ£¤¹¤ë¡¥
+ メソッドåã‚’è¿”ã™ãƒ¡ã‚½ãƒƒãƒ‰ï¼ŒModule#methods, #singleton_methods
+ ãªã©ãŒSymbolã‚’è¿”ã™ã“ã¨ã‚’æ„味ã™ã‚‹ï¼Ž
-HAVE_RUBY_*_H
+HAVE_RUBY_*_H ::
- ruby.h ¤ÇÄêµÁ¤µ¤ì¤Æ¤¤¤ë¡¥Âбþ¤¹¤ë¥Ø¥Ã¥À¤¬Ä󶡤µ¤ì¤Æ¤¤¤ë¤³¤È
- ¤ò°ÕÌ£¤¹¤ë¡¥¤¿¤È¤¨¤Ð¡¤HAVE_RUBY_ST_H ¤¬ÄêµÁ¤µ¤ì¤Æ¤¤¤ë¾ì¹ç¤Ï
- ñ¤Ê¤ë st.h ¤Ç¤Ï¤Ê¤¯ ruby/st.h ¤ò»ÈÍѤ¹¤ë¡¥
+ ruby.h ã§å®šç¾©ã•れã¦ã„る.対応ã™ã‚‹ãƒ˜ãƒƒãƒ€ãŒæä¾›ã•れã¦ã„ã‚‹ã“ã¨
+ ã‚’æ„味ã™ã‚‹ï¼ŽãŸã¨ãˆã°ï¼ŒHAVE_RUBY_ST_H ãŒå®šç¾©ã•れã¦ã„ã‚‹å ´åˆã¯
+ å˜ãªã‚‹ st.h ã§ã¯ãªã ruby/st.h を使用ã™ã‚‹ï¼Ž
-RB_EVENT_HOOKS_HAVE_CALLBACK_DATA
+RB_EVENT_HOOKS_HAVE_CALLBACK_DATA ::
- rb_add_event_hook() ¤¬¥Õ¥Ã¥¯´Ø¿ô¤ËÅϤ¹ data ¤òÂè3°ú¿ô¤È¤·¤Æ
- ¼õ¤±¼è¤ë¤³¤È¤ò°ÕÌ£¤¹¤ë¡¥
+ rb_add_event_hook() ãŒãƒ•ãƒƒã‚¯é–¢æ•°ã«æ¸¡ã™ data を第3引数ã¨ã—ã¦
+ å—ã‘å–ã‚‹ã“ã¨ã‚’æ„味ã™ã‚‹ï¼Ž
-Appendix C. extconf.rb¤Ç»È¤¨¤ë´Ø¿ô¤¿¤Á
+= Appendix C. extconf.rbã§ä½¿ãˆã‚‹é–¢æ•°ãŸã¡
-extconf.rb¤ÎÃæ¤Ç¤ÏÍøÍѲÄǽ¤Ê¥³¥ó¥Ñ¥¤¥ë¾ò·ï¥Á¥§¥Ã¥¯¤Î´Ø¿ô¤Ï°Ê
-²¼¤ÎÄ̤ê¤Ç¤¢¤ë¡¥
+extconf.rbã®ä¸­ã§ã¯åˆ©ç”¨å¯èƒ½ãªã‚³ãƒ³ãƒ‘イルæ¡ä»¶ãƒã‚§ãƒƒã‚¯ã®é–¢æ•°ã¯ä»¥
+下ã®é€šã‚Šã§ã‚る.
-have_macro(macro, headers)
+have_macro(macro, headers) ::
- ¥Ø¥Ã¥À¥Õ¥¡¥¤¥ëheader¤ò¥¤¥ó¥¯¥ë¡¼¥É¤·¤Æ¥Þ¥¯¥ímacro¤¬ÄêµÁ¤µ
- ¤ì¤Æ¤¤¤ë¤«¤É¤¦¤«¥Á¥§¥Ã¥¯¤¹¤ë¡¥¥Þ¥¯¥í¤¬ÄêµÁ¤µ¤ì¤Æ¤¤¤ë»þtrue
- ¤òÊÖ¤¹¡¥
+ ヘッダファイルheaderをインクルードã—ã¦ãƒžã‚¯ãƒ­macroãŒå®šç¾©ã•
+ れã¦ã„ã‚‹ã‹ã©ã†ã‹ãƒã‚§ãƒƒã‚¯ã™ã‚‹ï¼Žãƒžã‚¯ãƒ­ãŒå®šç¾©ã•れã¦ã„る時true
+ ã‚’è¿”ã™ï¼Ž
-have_library(lib, func)
+have_library(lib, func) ::
- ´Ø¿ôfunc¤òÄêµÁ¤·¤Æ¤¤¤ë¥é¥¤¥Ö¥é¥êlib¤Î¸ºß¤ò¥Á¥§¥Ã¥¯¤¹¤ë¡¥
- ¥é¥¤¥Ö¥é¥ê¤¬Â¸ºß¤¹¤ë»þ¡¤true¤òÊÖ¤¹¡¥
+ 関数funcを定義ã—ã¦ã„るライブラリlibã®å­˜åœ¨ã‚’ãƒã‚§ãƒƒã‚¯ã™ã‚‹ï¼Ž
+ ãƒã‚§ãƒƒã‚¯ã«æˆåŠŸã™ã‚‹ã¨ï¼Œ-llibã‚’$libsã«è¿½åŠ ã—,trueã‚’è¿”ã™ï¼Ž
-find_library(lib, func, path...)
+find_library(lib, func, path...) ::
- ´Ø¿ôfunc¤òÄêµÁ¤·¤Æ¤¤¤ë¥é¥¤¥Ö¥é¥êlib¤Î¸ºß¤ò -Lpath ¤òÄɲÃ
- ¤·¤Ê¤¬¤é¥Á¥§¥Ã¥¯¤¹¤ë¡¥¥é¥¤¥Ö¥é¥ê¤¬¸«ÉÕ¤«¤Ã¤¿»þ¡¤true¤òÊÖ¤¹¡¥
+ 関数funcを定義ã—ã¦ã„るライブラリlibã®å­˜åœ¨ã‚’ -Lpath を追加
+ ã—ãªãŒã‚‰ãƒã‚§ãƒƒã‚¯ã™ã‚‹ï¼Žãƒã‚§ãƒƒã‚¯ã«æˆåŠŸã™ã‚‹ã¨ï¼Œ-llibã‚’$libsã«
+ 追加ã—,trueã‚’è¿”ã™ï¼Ž
-have_func(func, header)
+have_func(func, header) ::
- ¥Ø¥Ã¥À¥Õ¥¡¥¤¥ëheader¤ò¥¤¥ó¥¯¥ë¡¼¥É¤·¤Æ´Ø¿ôfunc¤Î¸ºß¤ò¥Á¥§
- ¥Ã¥¯¤¹¤ë¡¥func¤¬É¸½à¤Ç¤Ï¥ê¥ó¥¯¤µ¤ì¤Ê¤¤¥é¥¤¥Ö¥é¥êÆâ¤Î¤â¤Î¤Ç
- ¤¢¤ë»þ¤Ë¤ÏÀè¤Ëhave_library¤Ç¤½¤Î¥é¥¤¥Ö¥é¥ê¤ò¥Á¥§¥Ã¥¯¤·¤Æ¤ª
- ¤¯»ö¡¥´Ø¿ô¤¬Â¸ºß¤¹¤ë»þtrue¤òÊÖ¤¹¡¥
+ ヘッダファイルheaderをインクルードã—ã¦é–¢æ•°funcã®å­˜åœ¨ã‚’ãƒã‚§
+ ックã™ã‚‹ï¼ŽfuncãŒæ¨™æº–ã§ã¯ãƒªãƒ³ã‚¯ã•れãªã„ライブラリ内ã®ã‚‚ã®ã§
+ ã‚る時ã«ã¯å…ˆã«have_libraryã§ãã®ãƒ©ã‚¤ãƒ–ラリをãƒã‚§ãƒƒã‚¯ã—ã¦ãŠ
+ ã事.ãƒã‚§ãƒƒã‚¯ã«æˆåŠŸã™ã‚‹ã¨ï¼Œãƒ—リプロセッサマクロ
+ `HAVE_{FUNC}` を定義ã—,trueã‚’è¿”ã™ï¼Ž
-have_var(var, header)
+have_var(var, header) ::
- ¥Ø¥Ã¥À¥Õ¥¡¥¤¥ëheader¤ò¥¤¥ó¥¯¥ë¡¼¥É¤·¤ÆÊÑ¿ôvar¤Î¸ºß¤ò¥Á¥§¥Ã
- ¥¯¤¹¤ë¡¥var¤¬É¸½à¤Ç¤Ï¥ê¥ó¥¯¤µ¤ì¤Ê¤¤¥é¥¤¥Ö¥é¥êÆâ¤Î¤â¤Î¤Ç¤¢
- ¤ë»þ¤Ë¤ÏÀè¤Ëhave_library¤Ç¤½¤Î¥é¥¤¥Ö¥é¥ê¤ò¥Á¥§¥Ã¥¯¤·¤Æ¤ª¤¯
- »ö¡¥ÊÑ¿ô¤¬Â¸ºß¤¹¤ë»þtrue¤òÊÖ¤¹¡¥
+ ヘッダファイルheaderをインクルードã—ã¦å¤‰æ•°varã®å­˜åœ¨ã‚’ãƒã‚§ãƒƒ
+ クã™ã‚‹ï¼ŽvarãŒæ¨™æº–ã§ã¯ãƒªãƒ³ã‚¯ã•れãªã„ライブラリ内ã®ã‚‚ã®ã§ã‚
+ る時ã«ã¯å…ˆã«have_libraryã§ãã®ãƒ©ã‚¤ãƒ–ラリをãƒã‚§ãƒƒã‚¯ã—ã¦ãŠã
+ 事.ãƒã‚§ãƒƒã‚¯ã«æˆåŠŸã™ã‚‹ã¨ï¼Œãƒ—リプロセッサマクロ
+ `HAVE_{VAR}` を定義ã—,trueã‚’è¿”ã™ï¼Ž
-have_header(header)
+have_header(header) ::
- ¥Ø¥Ã¥À¥Õ¥¡¥¤¥ë¤Î¸ºß¤ò¥Á¥§¥Ã¥¯¤¹¤ë¡¥¥Ø¥Ã¥À¥Õ¥¡¥¤¥ë¤¬Â¸ºß¤¹
- ¤ë»þtrue¤òÊÖ¤¹¡¥
+ ヘッダファイルã®å­˜åœ¨ã‚’ãƒã‚§ãƒƒã‚¯ã™ã‚‹ï¼Žãƒã‚§ãƒƒã‚¯ã«æˆåŠŸã™ã‚‹ã¨ï¼Œ
+ プリプロセッサマクロ `HAVE_{HEADER_H}` を定義ã—,trueã‚’è¿”ã™ï¼Ž
+ (スラッシュやドットã¯ã‚¢ãƒ³ãƒ€ãƒ¼ã‚¹ã‚³ã‚¢ã«ç½®æ›ã•れる)
-find_header(header, path...)
+find_header(header, path...) ::
- ¥Ø¥Ã¥À¥Õ¥¡¥¤¥ëheader¤Î¸ºß¤ò -Ipath ¤òÄɲ䷤ʤ¬¤é¥Á¥§¥Ã¥¯
- ¤¹¤ë¡¥¥Ø¥Ã¥À¥Õ¥¡¥¤¥ë¤¬¸«ÉÕ¤«¤Ã¤¿»þ¡¤true¤òÊÖ¤¹¡¥
+ ヘッダファイルheaderã®å­˜åœ¨ã‚’ -Ipath を追加ã—ãªãŒã‚‰ãƒã‚§ãƒƒã‚¯
+ ã™ã‚‹ï¼Žãƒã‚§ãƒƒã‚¯ã«æˆåŠŸã™ã‚‹ã¨ï¼Œãƒ—リプロセッサマクロ
+ `HAVE_{HEADER_H}` を定義ã—,trueã‚’è¿”ã™ï¼Ž
+ (スラッシュやドットã¯ã‚¢ãƒ³ãƒ€ãƒ¼ã‚¹ã‚³ã‚¢ã«ç½®æ›ã•れる)
-have_struct_member(type, member, header)
+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)
+have_type(type, header, opt) ::
- ¥Ø¥Ã¥À¥Õ¥¡¥¤¥ëheader¤ò¥¤¥ó¥¯¥ë¡¼¥É¤·¤Æ·¿type¤¬Â¸ºß¤¹¤ë¤«¤ò
- ¥Á¥§¥Ã¥¯¤¹¤ë¡¥type¤¬ÄêµÁ¤µ¤ì¤Æ¤¤¤ë»þtrue¤òÊÖ¤¹¡¥
+ ヘッダファイルheaderをインクルードã—ã¦åž‹typeãŒå­˜åœ¨ã™ã‚‹ã‹ã‚’
+ ãƒã‚§ãƒƒã‚¯ã™ã‚‹ï¼Žãƒã‚§ãƒƒã‚¯ã«æˆåŠŸã™ã‚‹ã¨ï¼Œãƒ—リプロセッサマクロ
+ `HAVE_TYPE_{TYPE}` を定義ã—,trueã‚’è¿”ã™ï¼Ž
-check_sizeof(type, header)
+check_sizeof(type, header) ::
- ¥Ø¥Ã¥À¥Õ¥¡¥¤¥ëheader¤ò¥¤¥ó¥¯¥ë¡¼¥É¤·¤Æ·¿type¤Îcharñ°Ì¥µ¥¤
- ¥º¤òÄ´¤Ù¤ë¡¥type¤¬ÄêµÁ¤µ¤ì¤Æ¤¤¤ë»þ¤½¤Î¥µ¥¤¥º¤òÊÖ¤¹¡¥ÄêµÁ¤µ
- ¤ì¤Æ¤¤¤Ê¤¤¤È¤­¤Ïnil¤òÊÖ¤¹¡¥
+ ヘッダファイルheaderをインクルードã—ã¦åž‹typeã®charå˜ä½ã‚µã‚¤
+ ズを調ã¹ã‚‹ï¼Žãƒã‚§ãƒƒã‚¯ã«æˆåŠŸã™ã‚‹ã¨ï¼Œãƒ—リプロセッサマクロ
+ `SIZEOF_{TYPE}` を定義ã—,ãã®ã‚µã‚¤ã‚ºã‚’è¿”ã™ï¼Žå®šç¾©ã•れã¦ã„ãª
+ ã„ã¨ãã¯nilã‚’è¿”ã™ï¼Ž
-create_makefile(target)
+create_makefile(target[, target_prefix]) ::
- ³ÈÄ¥¥é¥¤¥Ö¥é¥êÍѤÎMakefile¤òÀ¸À®¤¹¤ë¡¥¤³¤Î´Ø¿ô¤ò¸Æ¤Ð¤Ê¤±¤ì
- ¤Ð¤½¤Î¥é¥¤¥Ö¥é¥ê¤Ï¥³¥ó¥Ñ¥¤¥ë¤µ¤ì¤Ê¤¤¡¥target¤Ï¥â¥¸¥å¡¼¥ë̾
- ¤òɽ¤¹¡¥
+ 拡張ライブラリ用ã®Makefileを生æˆã™ã‚‹ï¼Žã“ã®é–¢æ•°ã‚’呼ã°ãªã‘れ
+ ã°ãã®ãƒ©ã‚¤ãƒ–ラリã¯ã‚³ãƒ³ãƒ‘イルã•れãªã„.targetã¯ãƒ¢ã‚¸ãƒ¥ãƒ¼ãƒ«å
+ を表ã™ï¼Ž
-find_executable(command, path)
+find_executable(command, path) ::
- ¥³¥Þ¥ó¥Écommand¤òFile::PATH_SEPARATOR¤Ç¶èÀÚ¤é¤ì¤¿¥Ñ¥¹Ì¾¤Î
- ¥ê¥¹¥Èpath¤«¤éõ¤¹¡¥path¤¬nil¤Þ¤¿¤Ï¾Êά¤µ¤ì¤¿¾ì¹ç¤Ï¡¤´Ä¶­
- ÊÑ¿ôPATH¤ÎÃͤò»ÈÍѤ¹¤ë¡¥¼Â¹Ô²Äǽ¤Ê¥³¥Þ¥ó¥É¤¬¸«¤Ä¤«¤Ã¤¿¾ì¹ç
- ¤Ï¥Ñ¥¹¤ò´Þ¤à¥Õ¥¡¥¤¥ë̾¡¤¸«¤Ä¤«¤é¤Ê¤«¤Ã¤¿¾ì¹ç¤Ïnil¤òÊÖ¤¹¡¥
+ コマンドcommandã‚’File::PATH_SEPARATORã§åŒºåˆ‡ã‚‰ã‚ŒãŸãƒ‘スåã®
+ リストpathã‹ã‚‰æŽ¢ã™ï¼ŽpathãŒnilã¾ãŸã¯çœç•¥ã•れãŸå ´åˆã¯ï¼Œç’°å¢ƒ
+ 変数PATHã®å€¤ã‚’使用ã™ã‚‹ï¼Žå®Ÿè¡Œå¯èƒ½ãªã‚³ãƒžãƒ³ãƒ‰ãŒè¦‹ã¤ã‹ã£ãŸå ´åˆ
+ ã¯ãƒ‘スをå«ã‚€ãƒ•ァイルå,見ã¤ã‹ã‚‰ãªã‹ã£ãŸå ´åˆã¯nilã‚’è¿”ã™ï¼Ž
-with_config(withval[, default=nil])
+with_config(withval[, default=nil]) ::
- ¥³¥Þ¥ó¥É¥é¥¤¥ó¾å¤Î--with-<withval>¤Ç»ØÄꤵ¤ì¤¿¥ª¥×¥·¥ç¥óÃÍ
- ¤òÆÀ¤ë¡¥
+ コマンドライン上ã®--with-<withval>ã§æŒ‡å®šã•れãŸã‚ªãƒ—ション値
+ を得る.
-enable_config(config, *defaults)
-disable_config(config, *defaults)
+enable_config(config, *defaults) ::
+disable_config(config, *defaults) ::
- ¥³¥Þ¥ó¥É¥é¥¤¥ó¾å¤Î--enable-<config>¤Þ¤¿¤Ï
- --disable-<config>¤Ç»ØÄꤵ¤ì¤¿¿¿µ¶ÃͤòÆÀ¤ë¡¥
- --enable-<config>¤¬»ØÄꤵ¤ì¤Æ¤¤¤¿¾ì¹ç¤Ïtrue¡¤
- --disable-<config>¤¬»ØÄꤵ¤ì¤Æ¤¤¤¿¾ì¹ç¤Ïfalse¤òÊÖ¤¹¡¥
- ¤É¤Á¤é¤â»ØÄꤵ¤ì¤Æ¤¤¤Ê¤¤¾ì¹ç¤Ï¡¤¥Ö¥í¥Ã¥¯¤Ä¤­¤Ç¸Æ¤Ó½Ð¤µ¤ì¤Æ
- ¤¤¤ë¾ì¹ç¤Ï*defaults¤òyield¤·¤¿·ë²Ì¡¤¥Ö¥í¥Ã¥¯¤Ê¤·¤Ê¤é
- *defaults¤òÊÖ¤¹¡¥
+ コマンドライン上ã®--enable-<config>ã¾ãŸã¯
+ --disable-<config>ã§æŒ‡å®šã•れãŸçœŸå½å€¤ã‚’得る.
+ --enable-<config>ãŒæŒ‡å®šã•れã¦ã„ãŸå ´åˆã¯true,
+ --disable-<config>ãŒæŒ‡å®šã•れã¦ã„ãŸå ´åˆã¯falseã‚’è¿”ã™ï¼Ž
+ ã©ã¡ã‚‰ã‚‚指定ã•れã¦ã„ãªã„å ´åˆã¯ï¼Œãƒ–ロックã¤ãã§å‘¼ã³å‡ºã•れã¦
+ ã„ã‚‹å ´åˆã¯*defaultsã‚’yieldã—ãŸçµæžœï¼Œãƒ–ロックãªã—ãªã‚‰
+ *defaultsã‚’è¿”ã™ï¼Ž
-dir_config(target[, default_dir])
-dir_config(target[, default_include, default_lib])
+dir_config(target[, default_dir]) ::
+dir_config(target[, default_include, default_lib]) ::
- ¥³¥Þ¥ó¥É¥é¥¤¥ó¾å¤Î--with-<target>-dir, --with-<target>-include,
- --with-<target>-lib¤Î¤¤¤º¤ì¤«¤Ç»ØÄꤵ¤ì¤ë¥Ç¥£¥ì¥¯¥È¥ê¤ò
- $CFLAGS ¤ä $LDFLAGS ¤ËÄɲ乤롥--with-<target>-dir=/path¤Ï
+ コマンドライン上ã®--with-<target>-dir, --with-<target>-include,
+ --with-<target>-libã®ã„ãšã‚Œã‹ã§æŒ‡å®šã•れるディレクトリを
+ $CFLAGS ã‚„ $LDFLAGS ã«è¿½åŠ ã™ã‚‹ï¼Ž--with-<target>-dir=/pathã¯
--with-<target>-include=/path/include --with-<target>-lib=/path/lib
- ¤ÈÅù²Á¤Ç¤¢¤ë¡¥Äɲ䵤줿 include ¥Ç¥£¥ì¥¯¥È¥ê¤È lib ¥Ç¥£¥ì
- ¥¯¥È¥ê¤ÎÇÛÎó¤òÊÖ¤¹¡¥ ([include_dir, lib_dir])
+ ã¨ç­‰ä¾¡ã§ã‚る.追加ã•れ㟠include ディレクトリ㨠lib ディレ
+ クトリã®é…列を返ã™ï¼Ž ([include_dir, lib_dir])
+
+pkg_config(pkg, option=nil) ::
+
+ pkg-configコマンドã‹ã‚‰ãƒ‘ッケージpkgã®æƒ…報を [cflags, ldflags, libs]
+ ã®é…列ã¨ã—ã¦å¾—る.$CFLAGS, $LDFLAGS, $libs ã«ã¯ãれãžã‚Œã®å€¤ãŒ
+ 追加ã•れる.
+
+ pkg-configã®å®Ÿéš›ã®ã‚³ãƒžãƒ³ãƒ‰ã¯ï¼Œä»¥ä¸‹ã®é †ã§è©¦ã•れる.
-pkg_config(pkg)
+ 1. コマンドラインã§--with-{pkg}-config={command}オプションãŒ
+ 指定ã•れãŸå ´åˆ: {command} {option}
+ 2. {pkg}-config {option}
+ 3. pkg-config {option} {pkg}
- pkg-config¥³¥Þ¥ó¥É¤«¤é¥Ñ¥Ã¥±¡¼¥¸pkg¤Î¾ðÊó¤òÆÀ¤ë¡¥
- pkg-config¤Î¼ÂºÝ¤Î¥³¥Þ¥ó¥É̾¤Ï¡¤--with-pkg-config¥³¥Þ¥ó¥É
- ¥é¥¤¥ó¥ª¥×¥·¥ç¥ó¤Ç»ØÄê²Äǽ¡¥
+ optionãŒæŒ‡å®šã•れãŸå ´åˆã¯ã€ä¸Šè¨˜ã®é…列ã®ä»£ã‚りã«ãã®ã‚ªãƒ—ションを
+ 指定ã—ã¦å¾—られãŸå‡ºåŠ›ã‚’stripã—ãŸã‚‚ã®ã‚’è¿”ã™ï¼Ž
/*
* Local variables:
diff --git a/README.ja b/README.ja
index dd7f67ca59..9ab2f3ca0e 100644
--- a/README.ja
+++ b/README.ja
@@ -1,185 +1,192 @@
-* Ruby¤È¤Ï
+= Rubyã¨ã¯
-Ruby¤Ï¥·¥ó¥×¥ë¤«¤Ä¶¯ÎϤʥª¥Ö¥¸¥§¥¯¥È»Ø¸þ¥¹¥¯¥ê¥×¥È¸À¸ì¤Ç¤¹¡¥
-Ruby¤ÏºÇ½é¤«¤é½ã¿è¤Ê¥ª¥Ö¥¸¥§¥¯¥È»Ø¸þ¸À¸ì¤È¤·¤ÆÀ߷פµ¤ì¤Æ¤¤¤Þ
-¤¹¤«¤é¡¤¥ª¥Ö¥¸¥§¥¯¥È»Ø¸þ¥×¥í¥°¥é¥ß¥ó¥°¤ò¼ê·Ú¤Ë¹Ô¤¦»ö¤¬½ÐÍè¤Þ
-¤¹¡¥¤â¤Á¤í¤óÄ̾ï¤Î¼ê³¤­·¿¤Î¥×¥í¥°¥é¥ß¥ó¥°¤â²Äǽ¤Ç¤¹¡¥
+Rubyã¯ã‚·ãƒ³ãƒ—ルã‹ã¤å¼·åŠ›ãªã‚ªãƒ–ジェクト指å‘スクリプト言語ã§ã™ï¼Ž
+Rubyã¯æœ€åˆã‹ã‚‰ç´”粋ãªã‚ªãƒ–ジェクト指å‘言語ã¨ã—ã¦è¨­è¨ˆã•れã¦ã„ã¾
+ã™ã‹ã‚‰ï¼Œã‚ªãƒ–ジェクト指å‘プログラミングを手軽ã«è¡Œã†äº‹ãŒå‡ºæ¥ã¾
+ã™ï¼Žã‚‚ã¡ã‚ã‚“é€šå¸¸ã®æ‰‹ç¶šãåž‹ã®ãƒ—ログラミングもå¯èƒ½ã§ã™ï¼Ž
-Ruby¤Ï¥Æ¥­¥¹¥È½èÍý´Ø·¸¤ÎǽÎϤʤɤËÍ¥¤ì¡¤Perl¤ÈƱ¤¸¤¯¤é¤¤¶¯ÎÏ
-¤Ç¤¹¡¥¤µ¤é¤Ë¥·¥ó¥×¥ë¤Êʸˡ¤È¡¤Îã³°½èÍý¤ä¥¤¥Æ¥ì¡¼¥¿¤Ê¤É¤Îµ¡¹½
-¤Ë¤è¤Ã¤Æ¡¤¤è¤êʬ¤«¤ê¤ä¤¹¤¤¥×¥í¥°¥é¥ß¥ó¥°¤¬½ÐÍè¤Þ¤¹¡¥
+Rubyã¯ãƒ†ã‚­ã‚¹ãƒˆå‡¦ç†é–¢ä¿‚ã®èƒ½åŠ›ãªã©ã«å„ªã‚Œï¼ŒPerlã¨åŒã˜ãらã„強力
+ã§ã™ï¼Žã•らã«ã‚·ãƒ³ãƒ—ãƒ«ãªæ–‡æ³•ã¨ï¼Œä¾‹å¤–処ç†ã‚„イテレータãªã©ã®æ©Ÿæ§‹
+ã«ã‚ˆã£ã¦ï¼Œã‚ˆã‚Šåˆ†ã‹ã‚Šã‚„ã™ã„プログラミングãŒå‡ºæ¥ã¾ã™ï¼Ž
-* Ruby¤ÎÆÃĹ
+== Rubyã®ç‰¹é•·
- + ¥·¥ó¥×¥ë¤Êʸˡ
- + ÉáÄ̤Υª¥Ö¥¸¥§¥¯¥È»Ø¸þµ¡Ç½(¥¯¥é¥¹¡¤¥á¥½¥Ã¥É¥³¡¼¥ë¤Ê¤É)
- + ÆÃ¼ì¤Ê¥ª¥Ö¥¸¥§¥¯¥È»Ø¸þµ¡Ç½(Mixin, ÆÃ°Û¥á¥½¥Ã¥É¤Ê¤É)
- + ±é»»»Ò¥ª¡¼¥Ð¡¼¥í¡¼¥É
- + Îã³°½èÍýµ¡Ç½
- + ¥¤¥Æ¥ì¡¼¥¿¤È¥¯¥í¡¼¥¸¥ã
- + ¥¬¡¼¥Ù¡¼¥¸¥³¥ì¥¯¥¿
- + ¥À¥¤¥Ê¥ß¥Ã¥¯¥í¡¼¥Ç¥£¥ó¥° (¥¢¡¼¥­¥Æ¥¯¥Á¥ã¤Ë¤è¤ë)
- + °Ü¿¢À­¤¬¹â¤¤¡¥Â¿¤¯¤ÎUnix-like/POSIX¸ß´¹¥×¥é¥Ã¥È¥Õ¥©¡¼¥à¾å¤Ç
- ư¤¯¤À¤±¤Ç¤Ê¤¯¡¤Windows¡¤ Mac OS X¡¤BeOS¤Ê¤É¤Î¾å¤Ç¤âư¤¯
- cf. http://redmine.ruby-lang.org/wiki/ruby-19/SupportedPlatformsJa
+* ã‚·ãƒ³ãƒ—ãƒ«ãªæ–‡æ³•
+* 普通ã®ã‚ªãƒ–ã‚¸ã‚§ã‚¯ãƒˆæŒ‡å‘æ©Ÿèƒ½(クラス,メソッドコールãªã©)
+* 特殊ãªã‚ªãƒ–ã‚¸ã‚§ã‚¯ãƒˆæŒ‡å‘æ©Ÿèƒ½(Mixin, 特異メソッドãªã©)
+* 演算å­ã‚ªãƒ¼ãƒãƒ¼ãƒ­ãƒ¼ãƒ‰
+* ä¾‹å¤–å‡¦ç†æ©Ÿèƒ½
+* イテレータã¨ã‚¯ãƒ­ãƒ¼ã‚¸ãƒ£
+* ガーベージコレクタ
+* ダイナミックローディング (アーキテクãƒãƒ£ã«ã‚ˆã‚‹)
+* ç§»æ¤æ€§ãŒé«˜ã„.多ãã®Unix-like/POSIX互æ›ãƒ—ラットフォーム上ã§
+ å‹•ãã ã‘ã§ãªã,Windows, Mac OS X,BeOSãªã©ã®ä¸Šã§ã‚‚å‹•ã
+ cf. http://bugs.ruby-lang.org/projects/ruby-trunk/wiki/SupportedPlatformsJa
-* Æþ¼êË¡
+== 入手法
-** FTP¤Ç
+=== FTPã§
-°Ê²¼¤Î¾ì½ê¤Ë¤ª¤¤¤Æ¤¢¤ê¤Þ¤¹¡¥
+以下ã®å ´æ‰€ã«ãŠã„ã¦ã‚りã¾ã™ï¼Ž
- ftp://ftp.ruby-lang.org/pub/ruby/
+ftp://ftp.ruby-lang.org/pub/ruby/
-** Subversion¤Ç
+=== 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ã«å…¬é–‹ã—ã¦ã„ã¾ã™ï¼Ž
+以下ã®ã‚³ãƒžãƒ³ãƒ‰ã§ãƒªãƒã‚¸ãƒˆãƒªã‚’å–å¾—ã§ãã¾ã™ï¼Ž
-Ruby¤Î¥Û¡¼¥à¥Ú¡¼¥¸¤ÎURL¤Ï
+ $ git clone git://github.com/ruby/ruby.git
- http://www.ruby-lang.org/
+== ホームページ
-¤Ç¤¹¡¥
+Rubyã®ãƒ›ãƒ¼ãƒ ãƒšãƒ¼ã‚¸ã®URLã¯
+http://www.ruby-lang.org/
-* ¥á¡¼¥ê¥ó¥°¥ê¥¹¥È
+ã§ã™ï¼Ž
-Ruby¤Î¥á¡¼¥ê¥ó¥°¥ê¥¹¥È¤¬¤¢¤ê¤Þ¤¹¡£»²²Ã´õ˾¤ÎÊý¤Ï
- ruby-list-ctl@ruby-lang.org
+== メーリングリスト
-¤Þ¤ÇËÜʸ¤Ë
+Rubyã®ãƒ¡ãƒ¼ãƒªãƒ³ã‚°ãƒªã‚¹ãƒˆãŒã‚りã¾ã™ã€‚å‚åŠ å¸Œæœ›ã®æ–¹ã¯
+
+mailto:ruby-list-ctl@ruby-lang.org
+
+ã¾ã§æœ¬æ–‡ã«
subscribe YourFirstName YourFamilyName
-
-¤È½ñ¤¤¤ÆÁ÷¤Ã¤Æ²¼¤µ¤¤¡£
-Ruby³«È¯¼Ô¸þ¤±¥á¡¼¥ê¥ó¥°¥ê¥¹¥È¤â¤¢¤ê¤Þ¤¹¡£¤³¤Á¤é¤Ç¤Ïruby¤Î¥Ð
-¥°¡¢¾­Íè¤Î»ÅÍͳÈÄ¥¤Ê¤É¼ÂÁõ¾å¤ÎÌäÂê¤Ë¤Ä¤¤¤ÆµÄÏÀ¤µ¤ì¤Æ¤¤¤Þ¤¹¡£
-»²²Ã´õ˾¤ÎÊý¤Ï
+ã¨æ›¸ã„ã¦é€ã£ã¦ä¸‹ã•ã„。
+
+Ruby開発者å‘ã‘メーリングリストもã‚りã¾ã™ã€‚ã“ã¡ã‚‰ã§ã¯rubyã®ãƒ
+ã‚°ã€å°†æ¥ã®ä»•様拡張ãªã©å®Ÿè£…上ã®å•題ã«ã¤ã„ã¦è­°è«–ã•れã¦ã„ã¾ã™ã€‚
+å‚åŠ å¸Œæœ›ã®æ–¹ã¯
- ruby-dev-ctl@ruby-lang.org
+mailto:ruby-dev-ctl@ruby-lang.org
-¤Þ¤Çruby-list¤ÈƱÍͤÎÊýË¡¤Ç¥á¡¼¥ë¤·¤Æ¤¯¤À¤µ¤¤¡£
+ã¾ã§ruby-listã¨åŒæ§˜ã®æ–¹æ³•ã§ãƒ¡ãƒ¼ãƒ«ã—ã¦ãã ã•ã„。
-Ruby³ÈÄ¥¥â¥¸¥å¡¼¥ë¤Ë¤Ä¤¤¤ÆÏ䷹礦ruby-ext¥á¡¼¥ê¥ó¥°¥ê¥¹¥È¤È
-¿ô³Ø´Ø·¸¤ÎÏÃÂê¤Ë¤Ä¤¤¤ÆÏ䷹礦ruby-math¥á¡¼¥ê¥ó¥°¥ê¥¹¥È¤È
-±Ñ¸ì¤ÇÏ䷹礦ruby-talk¥á¡¼¥ê¥ó¥°¥ê¥¹¥È¤â¤¢¤ê¤Þ¤¹¡£»²²ÃÊýË¡
-¤Ï¤É¤ì¤âƱ¤¸¤Ç¤¹¡£
+Ruby拡張モジュールã«ã¤ã„ã¦è©±ã—åˆã†ruby-extメーリングリストã¨
+数学関係ã®è©±é¡Œã«ã¤ã„ã¦è©±ã—åˆã†ruby-mathメーリングリストã¨
+英語ã§è©±ã—åˆã†ruby-talkメーリングリストもã‚りã¾ã™ã€‚å‚加方法
+ã¯ã©ã‚Œã‚‚åŒã˜ã§ã™ã€‚
-* ¥³¥ó¥Ñ¥¤¥ë¡¦¥¤¥ó¥¹¥È¡¼¥ë
+== コンパイル・インストール
-°Ê²¼¤Î¼ê½ç¤Ç¹Ô¤Ã¤Æ¤¯¤À¤µ¤¤¡¥
+ä»¥ä¸‹ã®æ‰‹é †ã§è¡Œã£ã¦ãã ã•ã„.
- 1. ¤â¤·configure¥Õ¥¡¥¤¥ë¤¬¸«¤Ä¤«¤é¤Ê¤¤¡¢¤â¤·¤¯¤Ï
- configure.in¤è¤ê¸Å¤¤¤è¤¦¤Ê¤é¡¢autoconf¤ò¼Â¹Ô¤·¤Æ
- ¿·¤·¤¯configure¤òÀ¸À®¤¹¤ë
+1. ã‚‚ã— +configure+ ファイルãŒè¦‹ã¤ã‹ã‚‰ãªã„ã€ã‚‚ã—ãã¯
+ +configure.in+ よりå¤ã„よã†ãªã‚‰ã€ +autoconf+ を実行ã—ã¦
+ æ–°ã—ã +configure+ を生æˆã™ã‚‹
- 2. configure¤ò¼Â¹Ô¤·¤ÆMakefile¤Ê¤É¤òÀ¸À®¤¹¤ë
+2. +configure+ を実行ã—㦠+Makefile+ ãªã©ã‚’生æˆã™ã‚‹
- ´Ä¶­¤Ë¤è¤Ã¤Æ¤Ï¥Ç¥Õ¥©¥ë¥È¤ÎC¥³¥ó¥Ñ¥¤¥éÍÑ¥ª¥×¥·¥ç¥ó¤¬ÉÕ¤­
- ¤Þ¤¹¡¥configure¥ª¥×¥·¥ç¥ó¤Ç optflags=.. warnflags=.. Åù
- ¤Ç¾å½ñ¤­¤Ç¤­¤Þ¤¹¡¥
+ 環境ã«ã‚ˆã£ã¦ã¯ãƒ‡ãƒ•ォルトã®Cコンパイラ用オプションãŒä»˜ã
+ ã¾ã™ï¼Ž +configure+ オプション㧠<tt>optflags=..</tt> <tt>warnflags=..</tt> ç­‰
+ ã§ä¸Šæ›¸ãã§ãã¾ã™ï¼Ž
- 3. (ɬÍפʤé¤Ð)defines.h¤òÊÔ½¸¤¹¤ë
+3. (å¿…è¦ãªã‚‰ã°)+defines.h+ を編集ã™ã‚‹
- ¿ʬ¡¤É¬Í×̵¤¤¤È»×¤¤¤Þ¤¹¡¥
+ 多分,必è¦ç„¡ã„ã¨æ€ã„ã¾ã™ï¼Ž
- 4. (ɬÍפʤé¤Ð)ext/Setup¤ËÀÅŪ¤Ë¥ê¥ó¥¯¤¹¤ë³ÈÄ¥¥â¥¸¥å¡¼¥ë¤ò
- »ØÄꤹ¤ë
+4. (å¿…è¦ãªã‚‰ã°)+ext/Setup+ ã«é™çš„ã«ãƒªãƒ³ã‚¯ã™ã‚‹æ‹¡å¼µãƒ¢ã‚¸ãƒ¥ãƒ¼ãƒ«ã‚’
+ 指定ã™ã‚‹
- ext/Setup¤Ëµ­½Ò¤·¤¿¥â¥¸¥å¡¼¥ë¤ÏÀÅŪ¤Ë¥ê¥ó¥¯¤µ¤ì¤Þ¤¹¡¥
+ +ext/Setup+ ã«è¨˜è¿°ã—ãŸãƒ¢ã‚¸ãƒ¥ãƒ¼ãƒ«ã¯é™çš„ã«ãƒªãƒ³ã‚¯ã•れã¾ã™ï¼Ž
- ¥À¥¤¥Ê¥ß¥Ã¥¯¥í¡¼¥Ç¥£¥ó¥°¤ò¥µ¥Ý¡¼¥È¤·¤Æ¤¤¤Ê¤¤¥¢¡¼¥­¥Æ¥¯
- ¥Á¥ã¤Ç¤ÏSetup¤Î1¹ÔÌܤΡÖoption nodynamic¡×¤È¤¤¤¦¹Ô¤Î¥³
- ¥á¥ó¥È¤ò³°¤¹É¬Íפ¬¤¢¤ê¤Þ¤¹¡¥¤Þ¤¿¡¤¤³¤Î¥¢¡¼¥­¥Æ¥¯¥Á¥ã¤Ç
- ³ÈÄ¥¥â¥¸¥å¡¼¥ë¤òÍøÍѤ¹¤ë¤¿¤á¤Ë¤Ï¡¤¤¢¤é¤«¤¸¤áÀÅŪ¤Ë¥ê¥ó
- ¥¯¤·¤Æ¤ª¤¯É¬Íפ¬¤¢¤ê¤Þ¤¹¡¥
+ ダイナミックローディングをサãƒãƒ¼ãƒˆã—ã¦ã„ãªã„アーキテク
+ ãƒãƒ£ã§ã¯ +Setup+ ã®1行目ã®ã€Œ<tt>option nodynamic</tt>ã€ã¨ã„ã†è¡Œã®ã‚³
+ メントを外ã™å¿…è¦ãŒã‚りã¾ã™ï¼Žã¾ãŸï¼Œã“ã®ã‚¢ãƒ¼ã‚­ãƒ†ã‚¯ãƒãƒ£ã§
+ 拡張モジュールを利用ã™ã‚‹ãŸã‚ã«ã¯ï¼Œã‚らã‹ã˜ã‚é™çš„ã«ãƒªãƒ³
+ クã—ã¦ãŠãå¿…è¦ãŒã‚りã¾ã™ï¼Ž
- 5. make¤ò¼Â¹Ô¤·¤Æ¥³¥ó¥Ñ¥¤¥ë¤¹¤ë
+5. +make+ を実行ã—ã¦ã‚³ãƒ³ãƒ‘イルã™ã‚‹
- 6. make test¤Ç¥Æ¥¹¥È¤ò¹Ô¤¦¡¥
+6. <tt>make check</tt>ã§ãƒ†ã‚¹ãƒˆã‚’行ã†ï¼Ž
- ¡Ötest succeeded¡×¤Èɽ¼¨¤µ¤ì¤ì¤ÐÀ®¸ù¤Ç¤¹¡¥¤¿¤À¤·¥Æ¥¹¥È
- ¤ËÀ®¸ù¤·¤Æ¤â´°àú¤À¤ÈÊݾڤµ¤ì¤Æ¤¤¤ëÌõ¤Ç¤Ï¤¢¤ê¤Þ¤»¤ó¡¥
+ 「<tt>check succeeded</tt>ã€ã¨è¡¨ç¤ºã•ã‚Œã‚Œã°æˆåŠŸã§ã™ï¼ŽãŸã ã—テスト
+ ã«æˆåŠŸã—ã¦ã‚‚完璧ã ã¨ä¿è¨¼ã•れã¦ã„る訳ã§ã¯ã‚りã¾ã›ã‚“.
- 7. make install
+7. <tt>make install</tt>
- °Ê²¼¤Î¥Ç¥£¥ì¥¯¥È¥ê¤òºî¤Ã¤Æ¡¤¤½¤³¤Ë¥Õ¥¡¥¤¥ë¤ò¥¤¥ó¥¹¥È¡¼
- ¥ë¤·¤Þ¤¹¡¥
+ 以下ã®ãƒ‡ã‚£ãƒ¬ã‚¯ãƒˆãƒªã‚’作ã£ã¦ï¼Œãã“ã«ãƒ•ァイルをインストー
+ ルã—ã¾ã™ï¼Ž
- * ${DESTDIR}${prefix}/bin
- * ${DESTDIR}${prefix}/include/ruby-${MAJOR}.${MINOR}.${TEENY}
- * ${DESTDIR}${prefix}/include/ruby-${MAJOR}.${MINOR}.${TEENY}/${PLATFORM}
- * ${DESTDIR}${prefix}/lib
- * ${DESTDIR}${prefix}/lib/ruby
- * ${DESTDIR}${prefix}/lib/ruby/${MAJOR}.${MINOR}.${TEENY}
- * ${DESTDIR}${prefix}/lib/ruby/${MAJOR}.${MINOR}.${TEENY}/${PLATFORM}
- * ${DESTDIR}${prefix}/lib/ruby/site_ruby
- * ${DESTDIR}${prefix}/lib/ruby/site_ruby/${MAJOR}.${MINOR}.${TEENY}
- * ${DESTDIR}${prefix}/lib/ruby/site_ruby/${MAJOR}.${MINOR}.${TEENY}/${PLATFORM}
- * ${DESTDIR}${prefix}/lib/ruby/vendor_ruby
- * ${DESTDIR}${prefix}/lib/ruby/vendor_ruby/${MAJOR}.${MINOR}.${TEENY}
- * ${DESTDIR}${prefix}/lib/ruby/vendor_ruby/${MAJOR}.${MINOR}.${TEENY}/${PLATFORM}
- * ${DESTDIR}${prefix}/lib/ruby/gems/${MAJOR}.${MINOR}.${TEENY}
- * ${DESTDIR}${prefix}/share/man/man1
- * ${DESTDIR}${prefix}/share/ri/${MAJOR}.${MINOR}.${TEENY}/system
+ * <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'¤Ç¤¢¤ì¤Ð¡¤((|${MAJOR}|))¤Ï
- `x'¤Ç¡¤((|${MINOR}|))¤Ï`y'¡¤((|${TEENY}|))¤Ï`z'¤Ç¤¹¡¥
+ Rubyã®APIãƒãƒ¼ã‚¸ãƒ§ãƒ³ãŒ'_x.y.z_'ã§ã‚れã°ï¼Œ<tt>${MAJOR}</tt>ã¯
+ '_x_'ã§ï¼Œ<tt>${MINOR}</tt>ã¯'_y_',<tt>${TEENY}</tt>ã¯'_z_'ã§ã™ï¼Ž
- Ãí°Õ: API¥Ð¡¼¥¸¥ç¥ó¤Îteeny¤Ï¡¤Ruby¥×¥í¥°¥é¥à¤Î¥Ð¡¼¥¸¥ç
- ¥ó¤È¤Ï°Û¤Ê¤ë¤³¤È¤¬¤¢¤ê¤Þ¤¹¡¥
+ <b>注æ„</b>: APIãƒãƒ¼ã‚¸ãƒ§ãƒ³ã® +teeny+ ã¯ï¼ŒRubyプログラムã®ãƒãƒ¼ã‚¸ãƒ§
+ ンã¨ã¯ç•°ãªã‚‹ã“ã¨ãŒã‚りã¾ã™ï¼Ž
- root¤Çºî¶È¤¹¤ëɬÍפ¬¤¢¤ë¤«¤â¤·¤ì¤Þ¤»¤ó¡¥
+ +root+ ã§ä½œæ¥­ã™ã‚‹å¿…è¦ãŒã‚ã‚‹ã‹ã‚‚ã—れã¾ã›ã‚“.
-¤â¤·¡¤¥³¥ó¥Ñ¥¤¥ë»þ¤Ë¥¨¥é¡¼¤¬È¯À¸¤·¤¿¾ì¹ç¤Ë¤Ï¥¨¥é¡¼¤Î¥í¥°¤È¥Þ
-¥·¥ó¡¤OS¤Î¼ïÎà¤ò´Þ¤à¤Ç¤­¤ë¤À¤±¾Ü¤·¤¤¥ì¥Ý¡¼¥È¤òºî¼Ô¤ËÁ÷¤Ã¤Æ¤¯
-¤À¤µ¤ë¤È¾¤ÎÊý¤Î¤¿¤á¤Ë¤â¤Ê¤ê¤Þ¤¹¡¥
+ã‚‚ã—,コンパイル時ã«ã‚¨ãƒ©ãƒ¼ãŒç™ºç”Ÿã—ãŸå ´åˆã«ã¯ã‚¨ãƒ©ãƒ¼ã®ãƒ­ã‚°ã¨ãƒž
+シン,OSã®ç¨®é¡žã‚’å«ã‚€ã§ãã‚‹ã ã‘詳ã—ã„レãƒãƒ¼ãƒˆã‚’作者ã«é€ã£ã¦ã
+ã ã•ã‚‹ã¨ä»–ã®æ–¹ã®ãŸã‚ã«ã‚‚ãªã‚Šã¾ã™ï¼Ž
-* °Ü¿¢
+== ç§»æ¤
-UNIX¤Ç¤¢¤ì¤Ðconfigure¤¬¤Û¤È¤ó¤É¤Îº¹°Û¤òµÛ¼ý¤·¤Æ¤¯¤ì¤ë¤Ï¤º¤Ç
-¤¹¤¬¡¤»×¤ï¤Ì¸«Íî¤È¤·¤¬¤¢¤Ã¤¿¾ì¹ç(¤¢¤ë¤Ë°ã¤¤¤Ê¤¤)¡¤ºî¼Ô¤Ë¤½¤Î
-¤³¤È¤ò¥ì¥Ý¡¼¥È¤¹¤ì¤Ð¡¤²ò·è¤Ç¤­¤ë¤«¤âÃΤì¤Þ¤»¤ó¡¥
+UNIXã§ã‚れ㰠+configure+ ãŒã»ã¨ã‚“ã©ã®å·®ç•°ã‚’å¸åŽã—ã¦ãれるã¯ãšã§
+ã™ãŒï¼Œæ€ã‚ã¬è¦‹è½ã¨ã—ãŒã‚ã£ãŸå ´åˆ(ã‚ã‚‹ã«é•ã„ãªã„),作者ã«ãã®
+ã“ã¨ã‚’レãƒãƒ¼ãƒˆã™ã‚Œã°ï¼Œè§£æ±ºã§ãã‚‹ã‹ã‚‚知れã¾ã›ã‚“.
-¥¢¡¼¥­¥Æ¥¯¥Á¥ã¤Ë¤â¤Ã¤È¤â°Í¸¤¹¤ë¤Î¤ÏGCÉô¤Ç¤¹¡¥Ruby¤ÎGC¤ÏÂоÝ
-¤Î¥¢¡¼¥­¥Æ¥¯¥Á¥ã¤¬setjmp()¤Þ¤¿¤Ïgetcontext()¤Ë¤è¤Ã¤ÆÁ´¤Æ¤Î¥ì
-¥¸¥¹¥¿¤òjmp_buf¤äucontext_t¤Ë³ÊǼ¤¹¤ë¤³¤È¤È¡¤jmp_buf¤ä
-ucontext_t¤È¥¹¥¿¥Ã¥¯¤¬32bit¥¢¥é¥¤¥ó¥á¥ó¥È¤µ¤ì¤Æ¤¤¤ë¤³¤È¤ò²¾Äê
-¤·¤Æ¤¤¤Þ¤¹¡¥ÆÃ¤ËÁ°¼Ô¤¬À®Î©¤·¤Ê¤¤¾ì¹ç¤ÎÂбþ¤ÏÈó¾ï¤Ëº¤Æñ¤Ç¤·¤ç
-¤¦¡¥¸å¼Ô¤Î²ò·è¤ÏÈæ³ÓŪ´Êñ¤Ç¡¤gc.c¤Ç¥¹¥¿¥Ã¥¯¤ò¥Þ¡¼¥¯¤·¤Æ¤¤¤ë
-Éôʬ¤Ë¥¢¥é¥¤¥ó¥á¥ó¥È¤Î¥Ð¥¤¥È¿ô¤À¤±¤º¤é¤·¤Æ¥Þ¡¼¥¯¤¹¤ë¥³¡¼¥É¤ò
-Äɲ乤ë¤À¤±¤ÇºÑ¤ß¤Þ¤¹¡¥¡Ödefined(__mc68000__)¡×¤Ç³ç¤é¤ì¤Æ¤¤
-¤ëÉôʬ¤ò»²¹Í¤Ë¤·¤Æ¤¯¤À¤µ¤¤¡¥
+アーキテクãƒãƒ£ã«ã‚‚ã£ã¨ã‚‚ä¾å­˜ã™ã‚‹ã®ã¯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¤Ç¤Ï¡¤¥ì¥¸¥¹¥¿¥¦¥£¥ó¥É¥¦¤ò¥¹¥¿¥Ã
-¥¯¤Ë¥Õ¥é¥Ã¥·¥å¤¹¤ë¥¢¥»¥ó¥Ö¥é¥³¡¼¥É¤òÄɲ乤ëɬÍפ¬¤¢¤ë¤«¤âÃÎ
-¤ì¤Þ¤»¤ó¡¥
+レジスタウィンドウをæŒã¤CPUã§ã¯ï¼Œãƒ¬ã‚¸ã‚¹ã‚¿ã‚¦ã‚£ãƒ³ãƒ‰ã‚¦ã‚’スタッ
+クã«ãƒ•ラッシュã™ã‚‹ã‚¢ã‚»ãƒ³ãƒ–ラコードを追加ã™ã‚‹å¿…è¦ãŒã‚ã‚‹ã‹ã‚‚知
+れã¾ã›ã‚“.
-* ÇÛÉÛ¾ò·ï
+== é…布æ¡ä»¶
-COPYING.ja¥Õ¥¡¥¤¥ë¤ò»²¾È¤·¤Æ¤¯¤À¤µ¤¤¡£
++COPYING.ja+ ファイルをå‚ç…§ã—ã¦ãã ã•ã„。
-* Ãø¼Ô
+== 著者
-¥³¥á¥ó¥È¡¤¥Ð¥°¥ì¥Ý¡¼¥È¤½¤Î¾¤Ï matz@netlab.jp ¤Þ¤Ç¡¥
+コメント,ãƒã‚°ãƒ¬ãƒãƒ¼ãƒˆãã®ä»–㯠mailto:matz@ruby-lang.org ã¾ã§ï¼Ž
-------------------------------------------------------
created at: Thu Aug 3 11:57:36 JST 1995
+--
Local variables:
-mode: indented-text
+mode: rdoc
end:
diff --git a/ToDo b/ToDo
deleted file mode 100644
index 7e5ef523a8..0000000000
--- a/ToDo
+++ /dev/null
@@ -1,124 +0,0 @@
-Language Spec.
-
-- Class#allocate - basicNew
-- class Foo::Bar<Baz .. end, module Boo::Bar .. end
-- raise exception by `` error
-- a +1 to be a+1, not a(+1).
-- clarify evaluation order of operator argument (=~, .., ...)
-- :symbol => value hash in the form of {symbol: value, ...} ??
-* operator !! for rescue. ???
-* objectify characters
-* ../... outside condition invokes operator method too.
-* ... inside condition turns off just before right condition.???
-* package or access control for global variables??
-* named arguments like foo(nation:="german") or foo(nation: "german").
-* method to retrieve argument information (needs new C API)
-* multiple return values, yield values. maybe incompatible ???
-* cascading method invocation ???
-* def Class#method .. end ??
-* def Foo::Bar::baz() .. end ??
-* I18N (or M17N) script/string/regexp
-* discourage use of symbol variables (e.g. $/, etc.) in manual
-* discourage use of Perlish features by giving warnings.
-* non confusing in-block local variable (is it possible?)
- + remove scope by block
- + variables appears within block may have independent values.
-* Regexp: make /o thread safe.
-* decide whether begin with rescue or ensure make do..while loop.
-* unify == and eql? again
-* to_i returns nil if str contains no digit.
-* jar like combined library package. -> RubyGems?
-* method combination, e.g. before, after, around, etc.
-* .. or something like defadvice in Emacs.
-* property - for methods, or for objects in general.
-* "in" modifier, to annotate, or to encourage assertion.
-* selector namespace - something like generic-flet in CLOS, to help RubyBehavior
-* private instance variable (as in Python?) @_foo in class Foo => @_Foo_foo
-* warn/error "bare word" method, like "foo", you should type "foo()"
-
-Hacking Interpreter
-
-- generational GC
-* non-blocking open (e.g. for named pipe) for thread
-* avoid blocking with gethostbyname/gethostbyaddr (use fork ???)
-* objectify interpreters ???
-* remove rb_eval() recursions
-* syntax tree -> bytecode ???
-* scrambled script, or script filter
-* setuid ruby
-* performance tune for in-block (dynamic) local variables.
-* give warnings to assign magic variables.
-* export rb_io_{addstr,printf,puts,print}
-* autoload should work with threads [ruby-talk:4589]
-* remove stdio dependency from IOs.
-* warn for inconsistent local variable usage (lv m and method m at the same time).
-* MicroRuby
-* Built-in Interactive Ruby.
-* Parser API
-* trap every method invocation, which can be enabled by e.g. trap_call :method.
-* unify Errno exceptions of same errno, or new exception comparison scheme.
-* 2.times{|i| if i==0 then a = 15 else puts eval("a") end} should print nil.
-* Thread#max_stack_size attribute (possible??)
-
-Standard Libraries
-
-- Module#define_method which takes a name and a body (block, proc or method).
-- Enume#inject
-- Array#fetch
-- IO::for_fd
-- Process::waitall [ruby-talk:4557]
-- Process::Status
-- File::lchown, File::lchmod; xxx - still need work for non existing platforms
-- move Time::times to Process.
-- Enumerable#sort_by for Schwartzian transformation
-- fork_and_kill_other_threads.
-- signal list (Signal::trap, Signal::list).
-- move NameError under StandardError.
-- Integer#to_s(base)
-- Hash::new{default}
-- hash etc. should handle self referenceing array/hash
-- Array#select(n1,n2...) works like Array#indexes(n1,n2...)
-- use Mersenne Twister RNG for random.
-- deprecate Array#indexes, and Array#indices.
-- remove dependency on MAXPATHLEN.
-- String#scanf(?)
-* Object#fmt(?)
-* Time::strptime
-* Integer[num], Float[num]; Fixnum[num]?
-* method to retrieve non-number trailer for to_i/to_f.
-* Stream or Port, abstract superclass of IO ?
-* String#{pred,prev}, String#downto
-* optional stepsize argument for succ()
-* Ruby module -- Ruby::Version, Ruby::Interpreter
-* introduce Boolean class; super of TrueClass, FalseClass
-* synchronized method - synchronized{...}, synchronized :foo, :bar
-* Array#&, Array#| to allow duplication. ???
-* way to specify immortal (fork endurance) thread;
-* or raise ForkException to every thread but fork caller.
-* new user-defined marshal scheme. _dump(dumper), _load(restorer)
-* library to load per-user profile seeking .ruby_profile or ruby.ini file.
-* warning framework (warn, warning for Ruby level)
-* marshal should not depend on sprintf (works bad with locale).
-* ternary arg pow: a.pow(b,c) == a**b%c
-* new caller(), e.g. call_stack; needs better name.
-* pointer share mechanism similar to one in String for Array.
-* require "1.6" etc. by /usr/lib/ruby/1.6/1.6.rb ;-)
-* save both "feature names" and "normalized path" in $"
-* implement Mutex_m (or MutexMixin) using Mutex.
-
-Extension Libraries
-
-* ptk.rb pTk wrapper that is compatible to tk.rb
-* Berkeley DB extension
-* BitVector
-* thread-safe fcgi
-
-Ruby Libraries
-
-- urllib.rb, nttplib.rb, etc.
-* format like perl's
-
-Tools
-
-* freeze or undump to bundle everything
-* bundle using zlib
diff --git a/addr2line.c b/addr2line.c
index 219d1d4b47..f936694724 100644
--- a/addr2line.c
+++ b/addr2line.c
@@ -1,6 +1,6 @@
/**********************************************************************
- addr2line.h -
+ addr2line.c -
$Author$
@@ -9,6 +9,7 @@
**********************************************************************/
#include "ruby/config.h"
+#include "ruby/missing.h"
#include "addr2line.h"
#include <stdio.h>
@@ -16,14 +17,10 @@
#ifdef USE_ELF
-#ifdef __OpenBSD__
-#include <elf_abi.h>
-#else
-#include <elf.h>
-#endif
#include <fcntl.h>
#include <limits.h>
#include <stdio.h>
+#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <sys/mman.h>
@@ -31,10 +28,33 @@
#include <sys/stat.h>
#include <unistd.h>
-#if defined(HAVE_ALLOCA_H)
-#include <alloca.h>
+#ifdef __OpenBSD__
+#include <elf_abi.h>
+#else
+#include <elf.h>
#endif
+/* Make alloca work the best possible way. */
+#ifdef __GNUC__
+# ifndef atarist
+# ifndef alloca
+# define alloca __builtin_alloca
+# endif
+# endif /* atarist */
+#else
+# ifdef HAVE_ALLOCA_H
+# include <alloca.h>
+# else
+# ifdef _AIX
+#pragma alloca
+# else
+# ifndef alloca /* predefined by HP cc +Olibcalls */
+void *alloca();
+# endif
+# endif /* AIX */
+# endif /* HAVE_ALLOCA_H */
+#endif /* __GNUC__ */
+
#ifdef HAVE_DL_ITERATE_PHDR
# ifndef _GNU_SOURCE
# define _GNU_SOURCE
@@ -68,6 +88,11 @@
# define ElfW(x) Elf32##_##x
# endif
#endif
+#ifndef PATH_MAX
+#define PATH_MAX 4096
+#endif
+
+int kprintf(const char *fmt, ...);
typedef struct {
const char *dirname;
@@ -84,7 +109,8 @@ typedef struct {
static char binary_filename[PATH_MAX];
static unsigned long
-uleb128(char **p) {
+uleb128(char **p)
+{
unsigned long r = 0;
int s = 0;
for (;;) {
@@ -100,7 +126,8 @@ uleb128(char **p) {
}
static long
-sleb128(char **p) {
+sleb128(char **p)
+{
long r = 0;
int s = 0;
for (;;) {
@@ -130,7 +157,7 @@ get_nth_dirname(unsigned long dir, char *p)
while (*p) p++;
p++;
if (!*p) {
- fprintf(stderr, "Unexpected directory number %lu in %s\n",
+ kprintf("Unexpected directory number %lu in %s\n",
dir, binary_filename);
return "";
}
@@ -150,7 +177,7 @@ fill_filename(int file, char *include_directories, char *filenames,
filename = p;
if (!*p) {
/* Need to output binary file name? */
- fprintf(stderr, "Unexpected file number %d in %s\n",
+ kprintf("Unexpected file number %d in %s\n",
file, binary_filename);
return;
}
@@ -215,19 +242,19 @@ parse_debug_line_cu(int num_traces, void **traces,
int default_is_stmt, line_base;
unsigned int header_length, minimum_instruction_length, line_range,
opcode_base;
- unsigned char *standard_opcode_lengths;
+ /* unsigned char *standard_opcode_lengths; */
/* The registers. */
unsigned long addr = 0;
unsigned int file = 1;
unsigned int line = 1;
- unsigned int column = 0;
+ /* unsigned int column = 0; */
int is_stmt;
- int basic_block = 0;
- int end_sequence = 0;
- int prologue_end = 0;
- int epilogue_begin = 0;
- unsigned int isa = 0;
+ /* int basic_block = 0; */
+ /* int end_sequence = 0; */
+ /* int prologue_end = 0; */
+ /* int epilogue_begin = 0; */
+ /* unsigned int isa = 0; */
p = *debug_line;
@@ -263,7 +290,7 @@ parse_debug_line_cu(int num_traces, void **traces,
opcode_base = *(unsigned char *)p;
p++;
- standard_opcode_lengths = (unsigned char *)p - 1;
+ /* standard_opcode_lengths = (unsigned char *)p - 1; */
p += opcode_base - 1;
include_directories = p;
@@ -283,7 +310,7 @@ parse_debug_line_cu(int num_traces, void **traces,
do { \
fill_line(num_traces, traces, addr, file, line, \
include_directories, filenames, lines); \
- basic_block = prologue_end = epilogue_begin = 0; \
+ /*basic_block = prologue_end = epilogue_begin = 0;*/ \
} while (0)
while (p < cu_end) {
@@ -306,13 +333,13 @@ parse_debug_line_cu(int num_traces, void **traces,
file = (unsigned int)uleb128(&p);
break;
case DW_LNS_set_column:
- column = (unsigned int)uleb128(&p);
+ /*column = (unsigned int)*/(void)uleb128(&p);
break;
case DW_LNS_negate_stmt:
is_stmt = !is_stmt;
break;
case DW_LNS_set_basic_block:
- basic_block = 1;
+ /*basic_block = 1; */
break;
case DW_LNS_const_add_pc:
a = ((255 - opcode_base) / line_range) *
@@ -324,35 +351,35 @@ parse_debug_line_cu(int num_traces, void **traces,
addr += a;
break;
case DW_LNS_set_prologue_end:
- prologue_end = 1;
+ /* prologue_end = 1; */
break;
case DW_LNS_set_epilogue_begin:
- epilogue_begin = 1;
+ /* epilogue_begin = 1; */
break;
case DW_LNS_set_isa:
- isa = (unsigned int)uleb128(&p);
+ /* isa = (unsigned int)*/(void)uleb128(&p);
break;
case 0:
a = *(unsigned char *)p++;
op = *p++;
switch (op) {
case DW_LNE_end_sequence:
- end_sequence = 1;
+ /* end_sequence = 1; */
FILL_LINE();
addr = 0;
file = 1;
line = 1;
- column = 0;
+ /* column = 0; */
is_stmt = default_is_stmt;
- end_sequence = 0;
- isa = 0;
+ /* end_sequence = 0; */
+ /* isa = 0; */
break;
case DW_LNE_set_address:
addr = *(unsigned long *)p;
p += sizeof(unsigned long);
break;
case DW_LNE_define_file:
- fprintf(stderr, "Unsupported operation in %s\n",
+ kprintf("Unsupported operation in %s\n",
binary_filename);
break;
case DW_LNE_set_discriminator:
@@ -360,7 +387,7 @@ parse_debug_line_cu(int num_traces, void **traces,
uleb128(&p);
break;
default:
- fprintf(stderr, "Unknown extended opcode: %d in %s\n",
+ kprintf("Unknown extended opcode: %d in %s\n",
op, binary_filename);
}
break;
@@ -388,7 +415,7 @@ parse_debug_line(int num_traces, void **traces,
parse_debug_line_cu(num_traces, traces, &debug_line, lines);
}
if (debug_line != debug_line_end) {
- fprintf(stderr, "Unexpected size of .debug_line in %s\n",
+ kprintf("Unexpected size of .debug_line in %s\n",
binary_filename);
}
}
@@ -450,22 +477,39 @@ fill_lines(int num_traces, void **traces, char **syms, int check_debuglink,
if (filesize < 0) {
int e = errno;
close(fd);
- fprintf(stderr, "lseek: %s\n", strerror(e));
+ kprintf("lseek: %s\n", strerror(e));
return;
}
+#if SIZEOF_OFF_T > SIZEOF_SIZE_T
+ if (filesize > (off_t)SIZE_MAX) {
+ close(fd);
+ kprintf("Too large file %s\n", binary_filename);
+ return;
+ }
+#endif
lseek(fd, 0, SEEK_SET);
/* async-signal unsafe */
- file = (char *)mmap(NULL, filesize, PROT_READ, MAP_SHARED, fd, 0);
+ file = (char *)mmap(NULL, (size_t)filesize, PROT_READ, MAP_SHARED, fd, 0);
if (file == MAP_FAILED) {
int e = errno;
close(fd);
- fprintf(stderr, "mmap: %s\n", strerror(e));
+ kprintf("mmap: %s\n", strerror(e));
+ return;
+ }
+
+ ehdr = (ElfW(Ehdr) *)file;
+ if (memcmp(ehdr->e_ident, "\177ELF", 4) != 0) {
+ /*
+ * Huh? Maybe filename was overridden by setproctitle() and
+ * it match non-elf file.
+ */
+ close(fd);
return;
}
current_line->fd = fd;
current_line->mapped = file;
- current_line->mapped_size = filesize;
+ current_line->mapped_size = (size_t)filesize;
for (i = 0; i < num_traces; i++) {
const char *path;
@@ -476,7 +520,6 @@ fill_lines(int num_traces, void **traces, char **syms, int check_debuglink,
}
}
- ehdr = (ElfW(Ehdr) *)file;
shdr = (ElfW(Shdr) *)(file + ehdr->e_shoff);
shstr_shdr = shdr + ehdr->e_shstrndx;
@@ -575,23 +618,22 @@ rb_dump_backtrace_with_lines(int num_traces, void **trace, char **syms)
fill_lines(num_traces, trace, syms, 1, &lines[i], lines);
}
- /* fprintf may not be async-signal safe */
for (i = 0; i < num_traces; i++) {
line_info_t *line = &lines[i];
if (line->line > 0) {
- fprintf(stderr, "%s ", syms[i]);
if (line->filename) {
if (line->dirname && line->dirname[0]) {
- fprintf(stderr, "%s/", line->dirname);
+ 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);
}
- fprintf(stderr, "%s", line->filename);
} else {
- fprintf(stderr, "???");
+ kprintf("%s ???:%d\n", syms[i], line->line);
}
- fprintf(stderr, ":%d\n", line->line);
} else {
- fprintf(stderr, "%s\n", syms[i]);
+ kprintf("%s\n", syms[i]);
}
}
@@ -605,6 +647,436 @@ rb_dump_backtrace_with_lines(int num_traces, void **trace, char **syms)
free(lines);
}
+/* From FreeBSD's lib/libstand/printf.c */
+/*-
+ * Copyright (c) 1986, 1988, 1991, 1993
+ * The Regents of the University of California. All rights reserved.
+ * (c) UNIX System Laboratories, Inc.
+ * All or some portions of this file are derived from material licensed
+ * to the University of California by American Telephone and Telegraph
+ * Co. or Unix System Laboratories, Inc. and are reproduced herein with
+ * the permission of UNIX System Laboratories, Inc.
+ *
+ * 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.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
+ *
+ * @(#)subr_prf.c 8.3 (Berkeley) 1/21/94
+ */
+
+#include <stdarg.h>
+#define MAXNBUF (sizeof(intmax_t) * CHAR_BIT + 1)
+extern int rb_toupper(int c);
+#define toupper(c) rb_toupper(c)
+#define hex2ascii(hex) (hex2ascii_data[hex])
+char const hex2ascii_data[] = "0123456789abcdefghijklmnopqrstuvwxyz";
+static inline int imax(int a, int b) { return (a > b ? a : b); }
+static int kvprintf(char const *fmt, void (*func)(int), void *arg, int radix, va_list ap);
+
+static void putce(int c)
+{
+ char s[1];
+ ssize_t ret;
+
+ s[0] = (char)c;
+ ret = write(2, s, 1);
+ (void)ret;
+}
+
+int
+kprintf(const char *fmt, ...)
+{
+ va_list ap;
+ int retval;
+
+ va_start(ap, fmt);
+ retval = kvprintf(fmt, putce, NULL, 10, ap);
+ va_end(ap);
+ return retval;
+}
+
+/*
+ * Put a NUL-terminated ASCII number (base <= 36) in a buffer in reverse
+ * order; return an optional length and a pointer to the last character
+ * written in the buffer (i.e., the first character of the string).
+ * The buffer pointed to by `nbuf' must have length >= MAXNBUF.
+ */
+static char *
+ksprintn(char *nbuf, uintmax_t num, int base, int *lenp, int upper)
+{
+ char *p, c;
+
+ p = nbuf;
+ *p = '\0';
+ do {
+ c = hex2ascii(num % base);
+ *++p = upper ? toupper(c) : c;
+ } while (num /= base);
+ if (lenp)
+ *lenp = (int)(p - nbuf);
+ return (p);
+}
+
+/*
+ * Scaled down version of printf(3).
+ *
+ * Two additional formats:
+ *
+ * The format %b is supported to decode error registers.
+ * Its usage is:
+ *
+ * printf("reg=%b\n", regval, "<base><arg>*");
+ *
+ * where <base> is the output base expressed as a control character, e.g.
+ * \10 gives octal; \20 gives hex. Each arg is a sequence of characters,
+ * the first of which gives the bit number to be inspected (origin 1), and
+ * the next characters (up to a control character, i.e. a character <= 32),
+ * give the name of the register. Thus:
+ *
+ * kvprintf("reg=%b\n", 3, "\10\2BITTWO\1BITONE\n");
+ *
+ * would produce output:
+ *
+ * reg=3<BITTWO,BITONE>
+ *
+ * XXX: %D -- Hexdump, takes pointer and separator string:
+ * ("%6D", ptr, ":") -> XX:XX:XX:XX:XX:XX
+ * ("%*D", len, ptr, " " -> XX XX XX XX ...
+ */
+static int
+kvprintf(char const *fmt, void (*func)(int), void *arg, int radix, va_list ap)
+{
+#define PCHAR(c) {int cc=(c); if (func) (*func)(cc); else *d++ = cc; retval++; }
+ char nbuf[MAXNBUF];
+ char *d;
+ const char *p, *percent, *q;
+ unsigned char *up;
+ int ch, n;
+ uintmax_t num;
+ int base, lflag, qflag, tmp, width, ladjust, sharpflag, neg, sign, dot;
+ int cflag, hflag, jflag, tflag, zflag;
+ int dwidth, upper;
+ char padc;
+ int stop = 0, retval = 0;
+
+ num = 0;
+ if (!func)
+ d = (char *) arg;
+ else
+ d = NULL;
+
+ if (fmt == NULL)
+ fmt = "(fmt null)\n";
+
+ if (radix < 2 || radix > 36)
+ radix = 10;
+
+ for (;;) {
+ padc = ' ';
+ width = 0;
+ while ((ch = (unsigned char)*fmt++) != '%' || stop) {
+ if (ch == '\0')
+ return (retval);
+ PCHAR(ch);
+ }
+ percent = fmt - 1;
+ qflag = 0; lflag = 0; ladjust = 0; sharpflag = 0; neg = 0;
+ sign = 0; dot = 0; dwidth = 0; upper = 0;
+ cflag = 0; hflag = 0; jflag = 0; tflag = 0; zflag = 0;
+reswitch: switch (ch = (unsigned char)*fmt++) {
+ case '.':
+ dot = 1;
+ goto reswitch;
+ case '#':
+ sharpflag = 1;
+ goto reswitch;
+ case '+':
+ sign = 1;
+ goto reswitch;
+ case '-':
+ ladjust = 1;
+ goto reswitch;
+ case '%':
+ PCHAR(ch);
+ break;
+ case '*':
+ if (!dot) {
+ width = va_arg(ap, int);
+ if (width < 0) {
+ ladjust = !ladjust;
+ width = -width;
+ }
+ } else {
+ dwidth = va_arg(ap, int);
+ }
+ goto reswitch;
+ case '0':
+ if (!dot) {
+ padc = '0';
+ goto reswitch;
+ }
+ case '1': case '2': case '3': case '4':
+ case '5': case '6': case '7': case '8': case '9':
+ for (n = 0;; ++fmt) {
+ n = n * 10 + ch - '0';
+ ch = *fmt;
+ if (ch < '0' || ch > '9')
+ break;
+ }
+ if (dot)
+ dwidth = n;
+ else
+ width = n;
+ goto reswitch;
+ case 'b':
+ num = (unsigned int)va_arg(ap, int);
+ p = va_arg(ap, char *);
+ for (q = ksprintn(nbuf, num, *p++, NULL, 0); *q;)
+ PCHAR(*q--);
+
+ if (num == 0)
+ break;
+
+ for (tmp = 0; *p;) {
+ n = *p++;
+ if (num & (1 << (n - 1))) {
+ PCHAR(tmp ? ',' : '<');
+ for (; (n = *p) > ' '; ++p)
+ PCHAR(n);
+ tmp = 1;
+ } else
+ for (; *p > ' '; ++p)
+ continue;
+ }
+ if (tmp)
+ PCHAR('>');
+ break;
+ case 'c':
+ PCHAR(va_arg(ap, int));
+ break;
+ case 'D':
+ up = va_arg(ap, unsigned char *);
+ p = va_arg(ap, char *);
+ if (!width)
+ width = 16;
+ while(width--) {
+ PCHAR(hex2ascii(*up >> 4));
+ PCHAR(hex2ascii(*up & 0x0f));
+ up++;
+ if (width)
+ for (q=p;*q;q++)
+ PCHAR(*q);
+ }
+ break;
+ case 'd':
+ case 'i':
+ base = 10;
+ sign = 1;
+ goto handle_sign;
+ case 'h':
+ if (hflag) {
+ hflag = 0;
+ cflag = 1;
+ } else
+ hflag = 1;
+ goto reswitch;
+ case 'j':
+ jflag = 1;
+ goto reswitch;
+ case 'l':
+ if (lflag) {
+ lflag = 0;
+ qflag = 1;
+ } else
+ lflag = 1;
+ goto reswitch;
+ case 'n':
+ if (jflag)
+ *(va_arg(ap, intmax_t *)) = retval;
+ else if (qflag)
+ *(va_arg(ap, int64_t *)) = retval;
+ else if (lflag)
+ *(va_arg(ap, long *)) = retval;
+ else if (zflag)
+ *(va_arg(ap, size_t *)) = retval;
+ else if (hflag)
+ *(va_arg(ap, short *)) = retval;
+ else if (cflag)
+ *(va_arg(ap, char *)) = retval;
+ else
+ *(va_arg(ap, int *)) = retval;
+ break;
+ case 'o':
+ base = 8;
+ goto handle_nosign;
+ case 'p':
+ base = 16;
+ sharpflag = (width == 0);
+ sign = 0;
+ num = (uintptr_t)va_arg(ap, void *);
+ goto number;
+ case 'q':
+ qflag = 1;
+ goto reswitch;
+ case 'r':
+ base = radix;
+ if (sign)
+ goto handle_sign;
+ goto handle_nosign;
+ case 's':
+ p = va_arg(ap, char *);
+ if (p == NULL)
+ p = "(null)";
+ if (!dot)
+ n = (int)strlen (p);
+ else
+ for (n = 0; n < dwidth && p[n]; n++)
+ continue;
+
+ width -= n;
+
+ if (!ladjust && width > 0)
+ while (width--)
+ PCHAR(padc);
+ while (n--)
+ PCHAR(*p++);
+ if (ladjust && width > 0)
+ while (width--)
+ PCHAR(padc);
+ break;
+ case 't':
+ tflag = 1;
+ goto reswitch;
+ case 'u':
+ base = 10;
+ goto handle_nosign;
+ case 'X':
+ upper = 1;
+ case 'x':
+ base = 16;
+ goto handle_nosign;
+ case 'y':
+ base = 16;
+ sign = 1;
+ goto handle_sign;
+ case 'z':
+ zflag = 1;
+ goto reswitch;
+handle_nosign:
+ sign = 0;
+ if (jflag)
+ num = va_arg(ap, uintmax_t);
+ else if (qflag)
+ num = va_arg(ap, uint64_t);
+ else if (tflag)
+ num = va_arg(ap, ptrdiff_t);
+ else if (lflag)
+ num = va_arg(ap, unsigned long);
+ else if (zflag)
+ num = va_arg(ap, size_t);
+ else if (hflag)
+ num = (unsigned short)va_arg(ap, int);
+ else if (cflag)
+ num = (unsigned char)va_arg(ap, int);
+ else
+ num = va_arg(ap, unsigned int);
+ goto number;
+handle_sign:
+ if (jflag)
+ num = va_arg(ap, intmax_t);
+ else if (qflag)
+ num = va_arg(ap, int64_t);
+ else if (tflag)
+ num = va_arg(ap, ptrdiff_t);
+ else if (lflag)
+ num = va_arg(ap, long);
+ else if (zflag)
+ num = va_arg(ap, ssize_t);
+ else if (hflag)
+ num = (short)va_arg(ap, int);
+ else if (cflag)
+ num = (char)va_arg(ap, int);
+ else
+ num = va_arg(ap, int);
+number:
+ if (sign && (intmax_t)num < 0) {
+ neg = 1;
+ num = -(intmax_t)num;
+ }
+ p = ksprintn(nbuf, num, base, &n, upper);
+ tmp = 0;
+ if (sharpflag && num != 0) {
+ if (base == 8)
+ tmp++;
+ else if (base == 16)
+ tmp += 2;
+ }
+ if (neg)
+ tmp++;
+
+ if (!ladjust && padc == '0')
+ dwidth = width - tmp;
+ width -= tmp + imax(dwidth, n);
+ dwidth -= n;
+ if (!ladjust)
+ while (width-- > 0)
+ PCHAR(' ');
+ if (neg)
+ PCHAR('-');
+ if (sharpflag && num != 0) {
+ if (base == 8) {
+ PCHAR('0');
+ } else if (base == 16) {
+ PCHAR('0');
+ PCHAR('x');
+ }
+ }
+ while (dwidth-- > 0)
+ PCHAR('0');
+
+ while (*p)
+ PCHAR(*p--);
+
+ if (ladjust)
+ while (width-- > 0)
+ PCHAR(' ');
+
+ break;
+ default:
+ while (percent < fmt)
+ PCHAR(*percent++);
+ /*
+ * Since we ignore an formatting argument it is no
+ * longer safe to obey the remaining formatting
+ * arguments as the arguments will no longer match
+ * the format specs.
+ */
+ stop = 1;
+ break;
+ }
+ }
+#undef PCHAR
+}
#else /* defined(USE_ELF) */
#error not supported
#endif
diff --git a/array.c b/array.c
index e427cb3320..5d01fdb551 100644
--- a/array.c
+++ b/array.c
@@ -16,17 +16,17 @@
#include "ruby/st.h"
#include "ruby/encoding.h"
#include "internal.h"
+#include "probes.h"
+#include "id.h"
#ifndef ARRAY_DEBUG
# define NDEBUG
#endif
#include <assert.h>
-#define numberof(array) (int)(sizeof(array) / sizeof((array)[0]))
-
VALUE rb_cArray;
-static ID id_cmp;
+static ID id_cmp, id_div, id_power;
#define ARY_DEFAULT_SIZE 16
#define ARY_MAX_SIZE (LONG_MAX / (int)sizeof(VALUE))
@@ -39,6 +39,14 @@ rb_mem_clear(register VALUE *mem, register long size)
}
}
+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)
{
@@ -47,6 +55,46 @@ memfill(register VALUE *mem, register long size, register VALUE val)
}
}
+static void
+ary_memfill(VALUE ary, long beg, long size, VALUE val)
+{
+ RARRAY_PTR_USE(ary, ptr, {
+ memfill(ptr + beg, size, val);
+ OBJ_WRITTEN(ary, Qundef, val);
+ });
+}
+
+static void
+ary_memcpy(VALUE ary, long beg, long argc, const VALUE *argv)
+{
+#if 1
+ if (OBJ_PROMOTED(ary)) {
+ if (argc > (int)(128/sizeof(VALUE)) /* is magic number (cache line size) */) {
+ rb_gc_writebarrier_remember_promoted(ary);
+ RARRAY_PTR_USE(ary, ptr, {
+ MEMCPY(ptr+beg, argv, VALUE, argc);
+ });
+ }
+ else {
+ int i;
+ RARRAY_PTR_USE(ary, ptr, {
+ for (i=0; i<argc; i++) {
+ OBJ_WRITE(ary, &ptr[i+beg], argv[i]);
+ }
+ });
+ }
+ }
+ else {
+ RARRAY_PTR_USE(ary, ptr, {
+ MEMCPY(ptr+beg, argv, VALUE, argc);
+ });
+ }
+#else
+ /* use shady (traditional way) */
+ MEMCPY(RARRAY_PTR(ary)+beg, argv, VALUE, argc);
+#endif
+}
+
# define ARY_SHARED_P(ary) \
(assert(!FL_TEST((ary), ELTS_SHARED) || !FL_TEST((ary), RARRAY_EMBED_FLAG)), \
FL_TEST((ary),ELTS_SHARED)!=0)
@@ -61,11 +109,11 @@ 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 { \
assert(!ARY_SHARED_P(a)); \
- assert(!OBJ_FROZEN(a)); \
FL_SET((a), RARRAY_EMBED_FLAG); \
} while (0)
#define FL_UNSET_EMBED(ary) FL_UNSET((ary), RARRAY_EMBED_FLAG|RARRAY_EMBED_LEN_MASK)
@@ -126,15 +174,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_)); \
+ 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); \
@@ -160,23 +211,36 @@ 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);
+ size_t size = ARY_HEAP_SIZE(ary);
+
+ if (len > capacity) len = capacity;
+ MEMCPY((VALUE *)RARRAY(ary)->as.ary, ptr, VALUE, len);
FL_SET_EMBED(ary);
ARY_SET_LEN(ary, len);
- xfree(ptr);
+ ruby_sized_xfree((VALUE *)ptr, size);
}
}
}
+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)
{
@@ -245,8 +309,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
@@ -254,19 +316,30 @@ 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);
- VALUE shared = ARY_SHARED(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_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_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);
@@ -274,6 +347,48 @@ rb_ary_modify(VALUE ary)
}
}
+static void
+ary_ensure_room_for_push(VALUE ary, long add_len)
+{
+ long new_len = RARRAY_LEN(ary) + add_len;
+ long capa;
+
+ if (ARY_SHARED_P(ary)) {
+ if (new_len > RARRAY_EMBED_LEN_MAX) {
+ VALUE shared = ARY_SHARED(ary);
+ if (ARY_SHARED_OCCUPIED(shared)) {
+ if (RARRAY_CONST_PTR(ary) - RARRAY_CONST_PTR(shared) + new_len <= RARRAY_LEN(shared)) {
+ rb_ary_modify_check(ary);
+ }
+ else {
+ /* 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;
+ }
+ }
+ }
+ rb_ary_modify(ary);
+ capa = ARY_CAPA(ary);
+ if (new_len > capa) {
+ ary_double_capa(ary, new_len);
+ }
+}
+
+/*
+ * call-seq:
+ * ary.freeze -> ary
+ *
+ * Calls Object#freeze on +ary+ to prevent any further
+ * modification. A RuntimeError will be raised if a modification
+ * attempt is made.
+ *
+ */
+
VALUE
rb_ary_freeze(VALUE ary)
{
@@ -284,8 +399,8 @@ rb_ary_freeze(VALUE ary)
* call-seq:
* ary.frozen? -> true or false
*
- * Return <code>true</code> if this array is frozen (or temporarily frozen
- * while being sorted).
+ * Return +true+ if this array is frozen (or temporarily frozen
+ * while being sorted). See also Object#frozen?
*/
static VALUE
@@ -295,21 +410,50 @@ rb_ary_frozen_p(VALUE ary)
return Qfalse;
}
+/* This can be used to take a snapshot of an array (with
+ e.g. rb_ary_replace) and check later whether the array has been
+ modified from the snapshot. The snapshot is cheap, though if
+ something does modify the array it will pay the cost of copying
+ it. If Array#pop or Array#shift has been called, the array will
+ be still shared with the snapshot, but the array length will
+ differ. */
+VALUE
+rb_ary_shared_with_p(VALUE ary1, VALUE ary2)
+{
+ if (!ARY_EMBED_P(ary1) && ARY_SHARED_P(ary1) &&
+ !ARY_EMBED_P(ary2) && ARY_SHARED_P(ary2) &&
+ RARRAY(ary1)->as.heap.aux.shared == RARRAY(ary2)->as.heap.aux.shared &&
+ RARRAY(ary1)->as.heap.len == RARRAY(ary2)->as.heap.len) {
+ return Qtrue;
+ }
+ return Qfalse;
+}
+
static VALUE
ary_alloc(VALUE klass)
{
- NEWOBJ(ary, struct RArray);
- OBJSETUP(ary, 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;
}
static VALUE
+empty_ary_alloc(VALUE klass)
+{
+ if (RUBY_DTRACE_ARRAY_CREATE_ENABLED()) {
+ RUBY_DTRACE_ARRAY_CREATE(0, rb_sourcefile(), rb_sourceline());
+ }
+
+ return ary_alloc(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)");
@@ -317,34 +461,40 @@ ary_new(VALUE klass, long capa)
if (capa > ARY_MAX_SIZE) {
rb_raise(rb_eArgError, "array size too big");
}
- ary = ary_alloc(klass);
+
+ if (RUBY_DTRACE_ARRAY_CREATE_ENABLED()) {
+ RUBY_DTRACE_ARRAY_CREATE(capa, rb_sourcefile(), rb_sourceline());
+ }
+
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;
@@ -354,7 +504,7 @@ rb_ary_new3(long n, ...)
va_start(ar, n);
for (i=0; i<n; i++) {
- RARRAY_PTR(ary)[i] = va_arg(ar, VALUE);
+ RARRAY_ASET(ary, i, va_arg(ar, VALUE));
}
va_end(ar);
@@ -363,13 +513,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);
}
@@ -386,7 +536,7 @@ 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));
}
}
@@ -420,18 +570,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(shared, struct RArray);
- OBJSETUP(shared, 0, T_ARRAY);
+ long capa = ARY_CAPA(ary), len = RARRAY_LEN(ary);
+ NEWOBJ_OF(shared, struct RArray, 0, T_ARRAY); /* keep shared ary as shady */
FL_UNSET_EMBED(shared);
- ARY_SET_LEN((VALUE)shared, RARRAY_LEN(ary));
- ARY_SET_PTR((VALUE)shared, RARRAY_PTR(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);
@@ -441,14 +592,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 {
@@ -563,8 +715,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);
@@ -604,27 +756,26 @@ 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;
}
-
/*
-* Returns a new array populated with the given objects.
-*
-* Array.[]( 1, 'a', /^A/ )
-* Array[ 1, 'a', /^A/ ]
-* [ 1, 'a', /^A/ ]
-*/
+ * Returns a new array populated with the given objects.
+ *
+ * Array.[]( 1, 'a', /^A/ ) # => [1, "a", /^A/]
+ * Array[ 1, 'a', /^A/ ] # => [1, "a", /^A/]
+ * [ 1, 'a', /^A/ ] # => [1, "a", /^A/]
+ */
static VALUE
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);
}
@@ -634,11 +785,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) {
@@ -649,15 +802,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;
+ RARRAY_ASET(ary, idx, val);
}
static VALUE
@@ -669,7 +821,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;
}
@@ -678,7 +830,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);
@@ -705,24 +857,24 @@ ary_take_first_or_last(int argc, VALUE *argv, VALUE ary, enum ary_take_pos_flags
{
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);
}
-static VALUE rb_ary_push_1(VALUE ary, VALUE item);
-
/*
* call-seq:
* ary << obj -> ary
@@ -739,8 +891,12 @@ static VALUE rb_ary_push_1(VALUE ary, VALUE item);
VALUE
rb_ary_push(VALUE ary, VALUE item)
{
- rb_ary_modify(ary);
- return rb_ary_push_1(ary, item);
+ long idx = RARRAY_LEN(ary);
+
+ ary_ensure_room_for_push(ary, 1);
+ RARRAY_ASET(ary, idx, item);
+ ARY_SET_LEN(ary, idx + 1);
+ return ary;
}
static VALUE
@@ -751,32 +907,42 @@ rb_ary_push_1(VALUE ary, VALUE item)
if (idx >= ARY_CAPA(ary)) {
ary_double_capa(ary, idx);
}
- RARRAY_PTR(ary)[idx] = item;
+ RARRAY_ASET(ary, idx, item);
ARY_SET_LEN(ary, idx + 1);
return ary;
}
+VALUE
+rb_ary_cat(VALUE ary, const VALUE *ptr, long len)
+{
+ long oldlen = RARRAY_LEN(ary);
+
+ ary_ensure_room_for_push(ary, len);
+ ary_memcpy(ary, oldlen, len, ptr);
+ ARY_SET_LEN(ary, oldlen + len);
+ return ary;
+}
+
/*
* call-seq:
* ary.push(obj, ... ) -> ary
*
- * Append---Pushes the given object(s) on to the end of this array. This
+ * Append --- Pushes the given object(s) on to the end of this array. This
* expression returns the array itself, so several appends
- * may be chained together.
+ * may be chained together. See also Array#pop for the opposite
+ * effect.
*
* a = [ "a", "b", "c" ]
* a.push("d", "e", "f")
* #=> ["a", "b", "c", "d", "e", "f"]
+ * [1, 2, 3,].push(4).push(5)
+ * #=> [1, 2, 3, 4, 5]
*/
static VALUE
rb_ary_push_m(int argc, VALUE *argv, VALUE ary)
{
- rb_ary_modify(ary);
- while (argc--) {
- rb_ary_push_1(ary, *argv++);
- }
- return ary;
+ return rb_ary_cat(ary, argv, argc);
}
VALUE
@@ -784,16 +950,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);
}
/*
@@ -802,10 +969,11 @@ rb_ary_pop(VALUE ary)
* ary.pop(n) -> new_ary
*
* Removes the last element from +self+ and returns it, or
- * <code>nil</code> if the array is empty.
+ * +nil+ if the array is empty.
*
- * If a number _n_ is given, returns an array of the last n elements
- * (or less) just like <code>array.slice!(-n, n)</code> does.
+ * If a number +n+ is given, returns an array of the last +n+ elements
+ * (or less) just like <code>array.slice!(-n, n)</code> does. See also
+ * Array#push for the opposite effect.
*
* a = [ "a", "b", "c", "d" ]
* a.pop #=> "d"
@@ -832,23 +1000,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;
+ RARRAY_ASET(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_ASET(ary, 0, Qnil);
}
ARY_INCREASE_PTR(ary, 1); /* shift ptr */
ARY_INCREASE_LEN(ary, -1);
@@ -861,12 +1032,14 @@ rb_ary_shift(VALUE ary)
* ary.shift -> obj or nil
* ary.shift(n) -> new_ary
*
- * Returns the first element of +self+ and removes it (shifting all
- * other elements down by one). Returns <code>nil</code> if the array
+ * Removes the first element of +self+ and returns it (shifting all
+ * other elements down by one). Returns +nil+ if the array
* is empty.
*
- * If a number _n_ is given, returns an array of the first n elements
- * (or less) just like <code>array.slice!(0, n)</code> does.
+ * If a number +n+ is given, returns an array of the first +n+ elements
+ * (or less) just like <code>array.slice!(0, n)</code> does. With +ary+
+ * containing only the remainder elements, not including what was shifted to
+ * +new_ary+. See also Array#unshift for the opposite effect.
*
* args = [ "-m", "-q", "filename" ]
* args.shift #=> "-m"
@@ -891,25 +1064,78 @@ 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
+ary_ensure_room_for_unshift(VALUE ary, int argc)
+{
+ long len = RARRAY_LEN(ary);
+ long new_len = len + argc;
+ long capa;
+ const VALUE *head, *sharedp;
+
+ if (ARY_SHARED_P(ary)) {
+ VALUE shared = ARY_SHARED(ary);
+ capa = RARRAY_LEN(shared);
+ if (ARY_SHARED_OCCUPIED(shared) && capa > new_len) {
+ head = RARRAY_CONST_PTR(ary);
+ sharedp = RARRAY_CONST_PTR(shared);
+ goto makeroom_if_need;
+ }
+ }
+
+ rb_ary_modify(ary);
+ capa = ARY_CAPA(ary);
+ if (capa - (capa >> 6) <= new_len) {
+ ary_double_capa(ary, new_len);
+ }
+
+ /* use shared array for big "queues" */
+ if (new_len > ARY_DEFAULT_SIZE * 4) {
+ /* make a room for unshifted items */
+ capa = ARY_CAPA(ary);
+ ary_make_shared(ary);
+
+ head = sharedp = RARRAY_CONST_PTR(ary);
+ goto makeroom;
+ makeroom_if_need:
+ if (head - sharedp < argc) {
+ long room;
+ makeroom:
+ room = capa - new_len;
+ room -= room >> 4;
+ MEMMOVE((VALUE *)sharedp + argc + room, head, VALUE, len);
+ head = sharedp + argc + room;
+ }
+ ARY_SET_PTR(ary, head - argc);
+ }
+ else {
+ /* sliding items */
+ RARRAY_PTR_USE(ary, ptr, {
+ MEMMOVE(ptr + argc, ptr, VALUE, len);
+ });
+ }
+}
+
/*
* call-seq:
* ary.unshift(obj, ...) -> ary
*
- * Prepends objects to the front of +self+,
- * moving other elements upwards.
+ * Prepends objects to the front of +self+, moving other elements upwards.
+ * See also Array#shift for the opposite effect.
*
* a = [ "b", "c", "d" ]
* a.unshift("a") #=> ["a", "b", "c", "d"]
@@ -919,19 +1145,16 @@ rb_ary_shift_m(int argc, VALUE *argv, VALUE ary)
static VALUE
rb_ary_unshift_m(int argc, VALUE *argv, VALUE ary)
{
- long len;
+ long len = RARRAY_LEN(ary);
- rb_ary_modify(ary);
- if (argc == 0) return ary;
- if (ARY_CAPA(ary) <= (len = RARRAY_LEN(ary)) + argc) {
- ary_double_capa(ary, len + argc);
+ if (argc == 0) {
+ rb_ary_modify_check(ary);
+ return ary;
}
- /* sliding items */
- MEMMOVE(RARRAY_PTR(ary) + argc, RARRAY_PTR(ary), VALUE, len);
- MEMCPY(RARRAY_PTR(ary), argv, VALUE, argc);
- ARY_INCREASE_LEN(ary, argc);
-
+ ary_ensure_room_for_unshift(ary, argc);
+ ary_memcpy(ary, 0, argc, argv);
+ ARY_SET_LEN(ary, len + argc);
return ary;
}
@@ -945,11 +1168,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
@@ -965,12 +1189,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);
@@ -987,13 +1212,16 @@ rb_ary_subseq(VALUE ary, long beg, long len)
* ary.slice(start, length) -> new_ary or nil
* ary.slice(range) -> new_ary or nil
*
- * Element Reference---Returns the element at _index_,
- * or returns a subarray starting at _start_ and
- * continuing for _length_ elements, or returns a subarray
- * specified by _range_.
- * Negative indices count backward from the end of the
- * array (-1 is the last element). Returns +nil+ if the index
- * (or starting index) are out of range.
+ * Element Reference --- Returns the element at +index+, or returns a
+ * subarray starting at the +start+ index and continuing for +length+
+ * elements, or returns a subarray specified by +range+ of indices.
+ *
+ * Negative indices count backward from the end of the array (-1 is the last
+ * element). For +start+ and +range+ cases the starting index is just before
+ * an element. Additionally, an empty array is returned when the starting
+ * index for an element range is at the end of the array.
+ *
+ * Returns +nil+ if the index (or starting index) are out of range.
*
* a = [ "a", "b", "c", "d", "e" ]
* a[2] + a[0] + a[1] #=> "cab"
@@ -1005,6 +1233,7 @@ rb_ary_subseq(VALUE ary, long beg, long len)
* a[-3, 3] #=> [ "c", "d", "e" ]
* # special cases
* a[5] #=> nil
+ * a[6, 1] #=> nil
* a[5, 1] #=> []
* a[5..10] #=> []
*
@@ -1025,7 +1254,7 @@ rb_ary_aref(int argc, VALUE *argv, VALUE ary)
return rb_ary_subseq(ary, beg, len);
}
if (argc != 1) {
- rb_scan_args(argc, argv, "11", 0, 0);
+ rb_scan_args(argc, argv, "11", NULL, NULL);
}
arg = argv[0];
/* special case - speeding up */
@@ -1048,9 +1277,9 @@ rb_ary_aref(int argc, VALUE *argv, VALUE ary)
* call-seq:
* ary.at(index) -> obj or nil
*
- * Returns the element at _index_. A
- * negative index counts from the end of +self+. Returns +nil+
- * if the index is out of range. See also <code>Array#[]</code>.
+ * Returns the element at +index+. A negative index counts from the end of
+ * +self+. Returns +nil+ if the index is out of range. See also
+ * Array#[].
*
* a = [ "a", "b", "c", "d", "e" ]
* a.at(0) #=> "a"
@@ -1069,8 +1298,9 @@ rb_ary_at(VALUE ary, VALUE pos)
* ary.first(n) -> new_ary
*
* Returns the first element, or the first +n+ elements, of the array.
- * If the array is empty, the first form returns <code>nil</code>, and the
- * second form returns an empty array.
+ * If the array is empty, the first form returns +nil+, and the
+ * second form returns an empty array. See also Array#last for
+ * the opposite effect.
*
* a = [ "q", "r", "s", "t" ]
* a.first #=> "q"
@@ -1082,7 +1312,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);
@@ -1095,7 +1325,9 @@ rb_ary_first(int argc, VALUE *argv, VALUE ary)
* ary.last(n) -> new_ary
*
* Returns the last element(s) of +self+. If the array is empty,
- * the first form returns <code>nil</code>.
+ * the first form returns +nil+.
+ *
+ * See also Array#first for the opposite effect.
*
* a = [ "w", "x", "y", "z" ]
* a.last #=> "z"
@@ -1106,8 +1338,9 @@ VALUE
rb_ary_last(int argc, 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);
@@ -1117,21 +1350,24 @@ rb_ary_last(int argc, VALUE *argv, VALUE ary)
/*
* call-seq:
* ary.fetch(index) -> obj
- * ary.fetch(index, default ) -> obj
- * ary.fetch(index) {|index| block } -> obj
+ * ary.fetch(index, default) -> obj
+ * ary.fetch(index) { |index| block } -> obj
*
- * Tries to return the element at position <i>index</i>. If the index
- * lies outside the array, the first form throws an
- * <code>IndexError</code> exception, the second form returns
- * <i>default</i>, and the third form returns the value of invoking
- * the block, passing in the index. Negative values of <i>index</i>
- * count from the end of the array.
+ * Tries to return the element at position +index+, but throws an IndexError
+ * exception if the referenced +index+ lies outside of the array bounds. This
+ * error can be prevented by supplying a second argument, which will act as a
+ * +default+ value.
+ *
+ * Alternatively, if a block is given it will only be executed when an
+ * invalid +index+ is referenced. Negative values of +index+ count from the
+ * end of the array.
*
* a = [ 11, 22, 33, 44 ]
* a.fetch(1) #=> 22
* a.fetch(-1) #=> 44
* a.fetch(4, 'cat') #=> "cat"
- * a.fetch(4) { |i| i*i } #=> 16
+ * a.fetch(100) { |i| puts "#{i} is out of bounds" }
+ * #=> "100 is out of bounds"
*/
static VALUE
@@ -1159,70 +1395,90 @@ rb_ary_fetch(int argc, VALUE *argv, VALUE ary)
}
return ifnone;
}
- return RARRAY_PTR(ary)[idx];
+ return RARRAY_AREF(ary, idx);
}
/*
* call-seq:
- * ary.index(obj) -> int or nil
- * ary.index {|item| block} -> int or nil
- * ary.index -> an_enumerator
+ * 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
*
- * Returns the index of the first object in +self+ such that the object is
- * <code>==</code> to <i>obj</i>. If a block is given instead of an
- * argument, returns index of first object for which <em>block</em> is true.
- * Returns <code>nil</code> if no match is found.
- * See also <code>Array#rindex</code>.
+ * Returns the _index_ of the first object in +ary+ such that the object is
+ * <code>==</code> to +obj+.
*
- * If neither block nor argument is given, an enumerator is returned instead.
+ * If a block is given instead of an argument, returns the _index_ of the
+ * first object for which the block returns +true+. Returns +nil+ if no
+ * match is found.
*
- * a = [ "a", "b", "c" ]
- * a.index("b") #=> 1
- * a.index("z") #=> nil
- * a.index{|x|x=="b"} #=> 1
+ * See also Array#rindex.
*
- * This is an alias of <code>#find_index</code>.
+ * An Enumerator is returned if neither a block nor argument is given.
+ *
+ * a = [ "a", "b", "c" ]
+ * a.index("b") #=> 1
+ * a.index("z") #=> nil
+ * a.index { |x| x == "b" } #=> 1
*/
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;
}
/*
* call-seq:
- * ary.rindex(obj) -> int or nil
- * ary.rindex {|item| block} -> int or nil
- * ary.rindex -> an_enumerator
+ * ary.rindex(obj) -> int or nil
+ * ary.rindex { |item| block } -> int or nil
+ * ary.rindex -> Enumerator
+ *
+ * Returns the _index_ of the last object in +self+ <code>==</code> to +obj+.
*
- * Returns the index of the last object in +self+
- * <code>==</code> to <i>obj</i>. If a block is given instead of an
- * argument, returns index of first object for which <em>block</em> is
- * true, starting from the last object.
- * Returns <code>nil</code> if no match is found.
- * See also <code>Array#index</code>.
+ * If a block is given instead of an argument, returns the _index_ of the
+ * first object for which the block returns +true+, starting from the last
+ * object.
*
- * If neither block nor argument is given, an enumerator is returned instead.
+ * Returns +nil+ if no match is found.
+ *
+ * See also Array#index.
+ *
+ * If neither block nor argument is given, an Enumerator is returned instead.
*
* a = [ "a", "b", "b", "b", "c" ]
* a.rindex("b") #=> 3
@@ -1233,29 +1489,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;
}
@@ -1273,17 +1540,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) {
@@ -1292,41 +1561,56 @@ 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 */
}
- rb_ary_modify(ary);
- if (beg >= RARRAY_LEN(ary)) {
+ if (beg >= olen) {
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 */
len = beg + rlen;
- if (len >= ARY_CAPA(ary)) {
- ary_double_capa(ary, len);
- }
- 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_memcpy(ary, beg, rlen, RARRAY_CONST_PTR(rpl));
}
ARY_SET_LEN(ary, len);
}
else {
long alen;
- alen = RARRAY_LEN(ary) + rlen - len;
+ rb_ary_modify(ary);
+ 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);
}
}
}
+void
+rb_ary_set_len(VALUE ary, long len)
+{
+ long capa;
+
+ rb_ary_modify_check(ary);
+ if (ARY_SHARED_P(ary)) {
+ rb_raise(rb_eRuntimeError, "can't set length of shared ");
+ }
+ if (len > (capa = (long)ARY_CAPA(ary))) {
+ rb_bug("probable buffer overflow: %ld for %ld", len, capa);
+ }
+ ARY_SET_LEN(ary, len);
+}
+
/*!
* expands or shrinks \a ary to \a len elements.
* expanded region will be filled with Qnil.
@@ -1350,8 +1634,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);
@@ -1360,12 +1644,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);
@@ -1379,16 +1663,21 @@ rb_ary_resize(VALUE ary, long len)
* ary[start, length] = obj or other_ary or nil -> obj or other_ary or nil
* ary[range] = obj or other_ary or nil -> obj or other_ary or nil
*
- * Element Assignment---Sets the element at _index_,
- * or replaces a subarray starting at _start_ and
- * continuing for _length_ elements, or replaces a subarray
- * specified by _range_. If indices are greater than
- * the current capacity of the array, the array grows
- * automatically. A negative indices will count backward
- * from the end of the array. Inserts elements if _length_ is
- * zero. An +IndexError+ is raised if a negative index points
- * past the beginning of the array. See also
- * <code>Array#push</code>, and <code>Array#unshift</code>.
+ * Element Assignment --- Sets the element at +index+, or replaces a subarray
+ * from the +start+ index for +length+ elements, or replaces a subarray
+ * specified by the +range+ of indices.
+ *
+ * If indices are greater than the current capacity of the array, the array
+ * grows automatically. Elements are inserted into the array at +start+ if
+ * +length+ is zero.
+ *
+ * Negative indices will count backward from the end of the array. For
+ * +start+ and +range+ cases the starting index is just before an element.
+ *
+ * An IndexError is raised if a negative index points past the beginning of
+ * the array.
+ *
+ * See also Array#push, and Array#unshift.
*
* a = Array.new
* a[4] = "4"; #=> [nil, nil, nil, nil, "4"]
@@ -1399,6 +1688,8 @@ rb_ary_resize(VALUE ary, long len)
* a[-1] = "Z" #=> ["A", "Z"]
* a[1..-1] = nil #=> ["A", nil]
* a[1..-1] = [] #=> ["A"]
+ * a[0, 0] = [ 1, 2 ] #=> [1, 2, "A"]
+ * a[3, 0] = "B" #=> [1, 2, "A", "B"]
*/
static VALUE
@@ -1413,9 +1704,7 @@ rb_ary_aset(int argc, VALUE *argv, VALUE ary)
rb_ary_splice(ary, beg, len, argv[2]);
return argv[2];
}
- if (argc != 2) {
- rb_raise(rb_eArgError, "wrong number of arguments (%d for 2)", argc);
- }
+ rb_check_arity(argc, 2, 2);
rb_ary_modify_check(ary);
if (FIXNUM_P(argv[0])) {
offset = FIX2LONG(argv[0]);
@@ -1437,8 +1726,10 @@ fixnum:
* call-seq:
* ary.insert(index, obj...) -> ary
*
- * Inserts the given values before the element with the given index
- * (which may be negative).
+ * 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.
*
* a = %w{ a b c d }
* a.insert(2, 99) #=> ["a", "b", 99, "c", "d"]
@@ -1450,9 +1741,7 @@ rb_ary_insert(int argc, VALUE *argv, VALUE ary)
{
long pos;
- if (argc < 1) {
- rb_raise(rb_eArgError, "wrong number of arguments (at least 1)");
- }
+ rb_check_arity(argc, 1, UNLIMITED_ARGUMENTS);
rb_ary_modify_check(ary);
if (argc == 1) return ary;
pos = NUM2LONG(argv[0]);
@@ -1466,15 +1755,24 @@ rb_ary_insert(int argc, VALUE *argv, VALUE ary)
return 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
- * ary.each -> an_enumerator
+ * ary.each { |item| block } -> ary
+ * ary.each -> Enumerator
*
- * Calls <i>block</i> once for each element in +self+, passing that
- * element as a parameter.
+ * Calls the given block once for each element in +self+, passing that element
+ * as a parameter.
*
- * If no block is given, an enumerator is returned instead.
+ * An Enumerator is returned if no block is given.
*
* a = [ "a", "b", "c" ]
* a.each {|x| print x, " -- " }
@@ -1490,23 +1788,22 @@ rb_ary_each(VALUE array)
long i;
volatile VALUE ary = array;
- RETURN_ENUMERATOR(ary, 0, 0);
+ 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;
}
/*
* call-seq:
- * ary.each_index {|index| block } -> ary
- * ary.each_index -> an_enumerator
- *
- * Same as <code>Array#each</code>, but passes the index of the element
- * instead of the element itself.
+ * ary.each_index { |index| block } -> ary
+ * ary.each_index -> Enumerator
*
- * If no block is given, an enumerator is returned instead.
+ * Same as Array#each, but passes the +index+ of the element instead of the
+ * element itself.
*
+ * An Enumerator is returned if no block is given.
*
* a = [ "a", "b", "c" ]
* a.each_index {|x| print x, " -- " }
@@ -1520,7 +1817,7 @@ static VALUE
rb_ary_each_index(VALUE ary)
{
long i;
- RETURN_ENUMERATOR(ary, 0, 0);
+ RETURN_SIZED_ENUMERATOR(ary, 0, 0, ary_enum_length);
for (i=0; i<RARRAY_LEN(ary); i++) {
rb_yield(LONG2NUM(i));
@@ -1530,11 +1827,10 @@ rb_ary_each_index(VALUE ary)
/*
* call-seq:
- * ary.reverse_each {|item| block } -> ary
- * ary.reverse_each -> an_enumerator
+ * ary.reverse_each { |item| block } -> ary
+ * ary.reverse_each -> Enumerator
*
- * Same as <code>Array#each</code>, but traverses +self+ in reverse
- * order.
+ * Same as Array#each, but traverses +self+ in reverse order.
*
* a = [ "a", "b", "c" ]
* a.reverse_each {|x| print x, " " }
@@ -1549,12 +1845,14 @@ rb_ary_reverse_each(VALUE ary)
{
long len;
- RETURN_ENUMERATOR(ary, 0, 0);
+ 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;
@@ -1567,6 +1865,7 @@ rb_ary_reverse_each(VALUE ary)
* Returns the number of elements in +self+. May be zero.
*
* [ 1, 2, 3, 4, 5 ].length #=> 5
+ * [].length #=> 0
*/
static VALUE
@@ -1580,7 +1879,7 @@ rb_ary_length(VALUE ary)
* call-seq:
* ary.empty? -> true or false
*
- * Returns <code>true</code> if +self+ contains no elements.
+ * Returns +true+ if +self+ contains no elements.
*
* [].empty? #=> true
*/
@@ -1596,16 +1895,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;
@@ -1636,14 +1936,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);
}
}
@@ -1656,14 +1955,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) {
@@ -1678,8 +1976,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;
@@ -1706,19 +2004,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) || OBJ_TAINTED(sep)) taint = TRUE;
- if (OBJ_UNTRUSTED(ary) || OBJ_UNTRUSTED(sep)) untrust = TRUE;
+ if (OBJ_TAINTED(ary)) taint = 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) {
@@ -1726,7 +2022,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);
@@ -1738,7 +2033,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;
@@ -1746,10 +2040,12 @@ rb_ary_join(VALUE ary, VALUE sep)
/*
* call-seq:
- * ary.join(sep=$,) -> str
+ * ary.join(separator=$,) -> str
*
* Returns a string created by converting each element of the array to
- * a string, separated by <i>sep</i>.
+ * a string, separated by the given +separator+.
+ * If the +separator+ is +nil+, it uses current $,.
+ * If both the +separator+ and $, are nil, it uses empty string.
*
* [ "a", "b", "c" ].join #=> "abc"
* [ "a", "b", "c" ].join("-") #=> "a-b-c"
@@ -1770,32 +2066,31 @@ 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;
}
/*
* call-seq:
- * ary.to_s -> string
* ary.inspect -> string
+ * ary.to_s -> string
*
* Creates a string representation of +self+.
+ *
+ * [ "a", "b", "c" ].to_s #=> "[\"a\", \"b\", \"c\"]"
*/
static VALUE
@@ -1815,8 +2110,9 @@ rb_ary_to_s(VALUE ary)
* call-seq:
* ary.to_a -> ary
*
- * Returns +self+. If called on a subclass of Array, converts
- * the receiver to an Array object.
+ * Returns +self+.
+ *
+ * If called on a subclass of Array, converts the receiver to an Array object.
*/
static VALUE
@@ -1832,6 +2128,32 @@ 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. Elements other than pairs of
+ * values are ignored.
+ *
+ * [[: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) && (RARRAY_LEN(key_value_pair) == 2)) {
+ 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+.
@@ -1844,8 +2166,7 @@ rb_ary_to_ary_m(VALUE ary)
}
static void
-ary_reverse(p1, p2)
- VALUE *p1, *p2;
+ary_reverse(VALUE *p1, VALUE *p2)
{
while (p1 < p2) {
VALUE tmp = *p1;
@@ -1857,13 +2178,15 @@ ary_reverse(p1, 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;
}
@@ -1887,7 +2210,7 @@ rb_ary_reverse_bang(VALUE ary)
/*
* call-seq:
- * ary.reverse -> new_ary
+ * ary.reverse -> new_ary
*
* Returns a new array containing +self+'s elements in reverse order.
*
@@ -1902,8 +2225,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));
@@ -1939,11 +2262,13 @@ rb_ary_rotate(VALUE ary, long cnt)
/*
* call-seq:
- * ary.rotate!(cnt=1) -> ary
+ * ary.rotate!(count=1) -> ary
*
- * Rotates +self+ in place so that the element at +cnt+ comes first,
- * and returns +self+. If +cnt+ is negative then it rotates in
- * the opposite direction.
+ * Rotates +self+ in place so that the element at +count+ comes first, and
+ * returns +self+.
+ *
+ * If +count+ is negative then it rotates in the opposite direction, starting
+ * from the end of the array where +-1+ is the last element.
*
* a = [ "a", "b", "c", "d" ]
* a.rotate! #=> ["b", "c", "d", "a"]
@@ -1968,11 +2293,13 @@ rb_ary_rotate_bang(int argc, VALUE *argv, VALUE ary)
/*
* call-seq:
- * ary.rotate(cnt=1) -> new_ary
+ * ary.rotate(count=1) -> new_ary
+ *
+ * Returns a new array by rotating +self+ so that the element at +count+ is
+ * the first element of the new array.
*
- * Returns new array by rotating +self+ so that the element at
- * +cnt+ in +self+ is the first element of the new array. If +cnt+
- * is negative then it rotates in the opposite direction.
+ * If +count+ is negative then it rotates in the opposite direction, starting
+ * from the end of +self+ where +-1+ is the last element.
*
* a = [ "a", "b", "c", "d" ]
* a.rotate #=> ["b", "c", "d", "a"]
@@ -1984,7 +2311,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) {
@@ -1997,11 +2325,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;
@@ -2019,7 +2346,7 @@ enum {
sort_optimizable_count
};
-#define STRING_P(s) (TYPE(s) == T_STRING && CLASS_OF(s) == rb_cString)
+#define STRING_P(s) (RB_TYPE_P((s), T_STRING) && CLASS_OF(s) == rb_cString)
#define SORT_OPTIMIZABLE_BIT(type) (1U << TOKEN_PASTE(sort_opt_,type))
#define SORT_OPTIMIZABLE(data, type) \
@@ -2069,7 +2396,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);
@@ -2079,17 +2406,22 @@ sort_2(const void *ap, const void *bp, void *dummy)
/*
* call-seq:
* ary.sort! -> ary
- * ary.sort! {| a,b | block } -> ary
+ * ary.sort! { |a, b| block } -> ary
+ *
+ * Sorts +self+ in place.
+ *
+ * Comparisons for the sort will be done using the <code><=></code> operator
+ * or using an optional code block.
*
- * Sorts +self+. Comparisons for
- * the sort will be done using the <code><=></code> operator or using
- * an optional code block. The block implements a comparison between
- * <i>a</i> and <i>b</i>, returning -1, 0, or +1. See also
- * <code>Enumerable#sort_by</code>.
+ * The block must implement a comparison between +a+ and +b+, and return
+ * +-1+, when +a+ follows +b+, +0+ when +a+ and +b+ are equivalent, or ++1+
+ * if +b+ follows +a+.
+ *
+ * See also Enumerable#sort_by.
*
* a = [ "d", "a", "e", "c", "b" ]
* a.sort! #=> ["a", "b", "c", "d", "e"]
- * a.sort! {|x,y| y <=> x } #=> ["e", "d", "c", "b", "a"]
+ * a.sort! { |x,y| y <=> x } #=> ["e", "d", "c", "b", "a"]
*/
VALUE
@@ -2100,29 +2432,29 @@ rb_ary_sort_bang(VALUE ary)
if (RARRAY_LEN(ary) > 1) {
VALUE tmp = ary_make_substitution(ary); /* only ary refers tmp */
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), RARRAY_LEN(tmp), 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, ARY_CAPA(tmp));
+ ARY_SET_CAPA(ary, RARRAY_LEN(tmp));
}
else {
assert(!ARY_SHARED_P(tmp));
@@ -2134,11 +2466,11 @@ 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_HEAP_LEN(ary, RARRAY_LEN(tmp));
- ARY_SET_CAPA(ary, ARY_CAPA(tmp));
+ ARY_SET_PTR(ary, RARRAY_CONST_PTR(tmp));
+ ARY_SET_HEAP_LEN(ary, len);
+ ARY_SET_CAPA(ary, RARRAY_LEN(tmp));
}
/* tmp was lost ownership for the ptr */
FL_UNSET(tmp, FL_FREEZE);
@@ -2147,7 +2479,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;
}
@@ -2155,17 +2487,23 @@ rb_ary_sort_bang(VALUE ary)
/*
* call-seq:
* ary.sort -> new_ary
- * ary.sort {| a,b | block } -> new_ary
+ * ary.sort { |a, b| block } -> new_ary
+ *
+ * Returns a new array created by sorting +self+.
+ *
+ * Comparisons for the sort will be done using the <code><=></code> operator
+ * or using an optional code block.
*
- * Returns a new array created by sorting +self+. Comparisons for
- * the sort will be done using the <code><=></code> operator or using
- * an optional code block. The block implements a comparison between
- * <i>a</i> and <i>b</i>, returning -1, 0, or +1. See also
- * <code>Enumerable#sort_by</code>.
+ * The block must implement a comparison between +a+ and +b+, and return
+ * +-1+, when +a+ follows +b+, +0+ when +a+ and +b+ are equivalent, or ++1+
+ * if +b+ follows +a+.
+ *
+ *
+ * See also Enumerable#sort_by.
*
* a = [ "d", "a", "e", "c", "b" ]
* a.sort #=> ["a", "b", "c", "d", "e"]
- * a.sort {|x,y| y <=> x } #=> ["e", "d", "c", "b", "a"]
+ * a.sort { |x,y| y <=> x } #=> ["e", "d", "c", "b", "a"]
*/
VALUE
@@ -2176,6 +2514,107 @@ rb_ary_sort(VALUE ary)
return ary;
}
+/*
+ * call-seq:
+ * ary.bsearch {|x| block } -> elem
+ *
+ * By using binary search, finds a value from this array which meets
+ * the given condition in O(log n) where n is the size of the array.
+ *
+ * You can use this method in two use cases: a find-minimum mode and
+ * a find-any mode. In either case, the elements of the array must be
+ * monotone (or sorted) with respect to the block.
+ *
+ * In find-minimum mode (this is a good choice for typical use case),
+ * the block must return true or false, and there must be an index i
+ * (0 <= i <= ary.size) so that:
+ *
+ * - the block returns false for any element whose index is less than
+ * i, and
+ * - the block returns true for any element whose index is greater
+ * than or equal to i.
+ *
+ * This method returns the i-th element. If i is equal to ary.size,
+ * it returns nil.
+ *
+ * ary = [0, 4, 7, 10, 12]
+ * ary.bsearch {|x| x >= 4 } #=> 4
+ * ary.bsearch {|x| x >= 6 } #=> 7
+ * ary.bsearch {|x| x >= -1 } #=> 0
+ * ary.bsearch {|x| x >= 100 } #=> nil
+ *
+ * In find-any mode (this behaves like libc's bsearch(3)), the block
+ * must return a number, and there must be two indices i and j
+ * (0 <= i <= j <= ary.size) so that:
+ *
+ * - the block returns a positive number for ary[k] if 0 <= k < i,
+ * - the block returns zero for ary[k] if i <= k < j, and
+ * - the block returns a negative number for ary[k] if
+ * j <= k < ary.size.
+ *
+ * Under this condition, this method returns any element whose index
+ * is within i...j. If i is equal to j (i.e., there is no element
+ * that satisfies the block), this method returns nil.
+ *
+ * ary = [0, 4, 7, 10, 12]
+ * # try to find v such that 4 <= v < 8
+ * ary.bsearch {|x| 1 - x / 4 } #=> 4 or 7
+ * # try to find v such that 8 <= v < 10
+ * ary.bsearch {|x| 4 - x / 2 } #=> nil
+ *
+ * You must not mix the two modes at a time; the block must always
+ * return either true/false, or always return a number. It is
+ * undefined which value is actually picked up at each iteration.
+ */
+
+static VALUE
+rb_ary_bsearch(VALUE ary)
+{
+ long low = 0, high = RARRAY_LEN(ary), mid;
+ int smaller = 0, satisfied = 0;
+ VALUE v, val;
+
+ RETURN_ENUMERATOR(ary, 0, 0);
+ while (low < high) {
+ mid = low + ((high - low) / 2);
+ val = rb_ary_entry(ary, mid);
+ v = rb_yield(val);
+ if (FIXNUM_P(v)) {
+ if (FIX2INT(v) == 0) return val;
+ smaller = FIX2INT(v) < 0;
+ }
+ else if (v == Qtrue) {
+ satisfied = 1;
+ smaller = 1;
+ }
+ else if (v == Qfalse || v == Qnil) {
+ smaller = 0;
+ }
+ else if (rb_obj_is_kind_of(v, rb_cNumeric)) {
+ const VALUE zero = INT2FIX(0);
+ switch (rb_cmpint(rb_funcallv(v, id_cmp, 1, &zero), v, INT2FIX(0))) {
+ case 0: return val;
+ case 1: smaller = 1; break;
+ case -1: smaller = 0;
+ }
+ }
+ else {
+ rb_raise(rb_eTypeError, "wrong argument type %s"
+ " (must be numeric, true, false or nil)",
+ rb_obj_classname(v));
+ }
+ if (smaller) {
+ high = mid;
+ }
+ else {
+ low = mid + 1;
+ }
+ }
+ if (low == RARRAY_LEN(ary)) return Qnil;
+ if (!satisfied) return Qnil;
+ return rb_ary_entry(ary, low);
+}
+
static VALUE
sort_by_i(VALUE i)
@@ -2185,13 +2624,13 @@ sort_by_i(VALUE i)
/*
* call-seq:
- * ary.sort_by! {| obj | block } -> ary
- * ary.sort_by! -> an_enumerator
+ * ary.sort_by! { |obj| block } -> ary
+ * ary.sort_by! -> Enumerator
*
* Sorts +self+ in place using a set of keys generated by mapping the
* values in +self+ through the given block.
*
- * If no block is given, an enumerator is returned instead.
+ * If no block is given, an Enumerator is returned instead.
*
*/
@@ -2200,7 +2639,7 @@ rb_ary_sort_by_bang(VALUE ary)
{
VALUE sorted;
- RETURN_ENUMERATOR(ary, 0, 0);
+ 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);
@@ -2210,20 +2649,22 @@ rb_ary_sort_by_bang(VALUE ary)
/*
* call-seq:
- * ary.collect {|item| block } -> new_ary
- * ary.map {|item| block } -> new_ary
- * ary.collect -> an_enumerator
- * ary.map -> an_enumerator
+ * ary.collect { |item| block } -> new_ary
+ * ary.map { |item| block } -> new_ary
+ * ary.collect -> Enumerator
+ * ary.map -> Enumerator
+ *
+ * Invokes the given block once for each element of +self+.
+ *
+ * Creates a new array containing the values returned by the block.
*
- * Invokes <i>block</i> once for each element of +self+. Creates a
- * new array containing the values returned by the block.
- * See also <code>Enumerable#collect</code>.
+ * See also Enumerable#collect.
*
- * If no block is given, an enumerator is returned instead.
+ * If no block is given, an Enumerator is returned instead.
*
* a = [ "a", "b", "c", "d" ]
- * a.collect {|x| x + "!" } #=> ["a!", "b!", "c!", "d!"]
- * a #=> ["a", "b", "c", "d"]
+ * a.map { |x| x + "!" } #=> ["a!", "b!", "c!", "d!"]
+ * a #=> ["a", "b", "c", "d"]
*/
static VALUE
@@ -2232,10 +2673,10 @@ rb_ary_collect(VALUE ary)
long i;
VALUE collect;
- RETURN_ENUMERATOR(ary, 0, 0);
+ 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;
}
@@ -2245,18 +2686,19 @@ rb_ary_collect(VALUE ary)
* call-seq:
* ary.collect! {|item| block } -> ary
* ary.map! {|item| block } -> ary
- * ary.collect -> an_enumerator
- * ary.map -> an_enumerator
+ * ary.collect! -> Enumerator
+ * ary.map! -> Enumerator
+ *
+ * Invokes the given block once for each element of +self+, replacing the
+ * element with the value returned by the block.
*
- * Invokes the block once for each element of +self+, replacing the
- * element with the value returned by _block_.
- * See also <code>Enumerable#collect</code>.
+ * See also Enumerable#collect.
*
- * If no block is given, an enumerator is returned instead.
+ * If no block is given, an Enumerator is returned instead.
*
* a = [ "a", "b", "c", "d" ]
- * a.collect! {|x| x + "!" }
- * a #=> [ "a!", "b!", "c!", "d!" ]
+ * a.map! {|x| x + "!" }
+ * a #=> [ "a!", "b!", "c!", "d!" ]
*/
static VALUE
@@ -2264,10 +2706,10 @@ rb_ary_collect_bang(VALUE ary)
{
long i;
- RETURN_ENUMERATOR(ary, 0, 0);
+ 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;
}
@@ -2284,15 +2726,13 @@ rb_get_values_at(VALUE obj, long olen, int argc, VALUE *argv, VALUE (*func) (VAL
continue;
}
/* check if idx is Range */
- switch (rb_range_beg_len(argv[i], &beg, &len, olen, 0)) {
- case Qfalse:
- break;
- case Qnil:
- continue;
- default:
- for (j=0; j<len; j++) {
- rb_ary_push(result, (*func)(obj, j+beg));
+ if (rb_range_beg_len(argv[i], &beg, &len, olen, 1)) {
+ long end = olen < beg+len ? olen : beg+len;
+ for (j = beg; j < end; j++) {
+ rb_ary_push(result, (*func)(obj, j));
}
+ if (beg + len > j)
+ rb_ary_resize(result, RARRAY_LEN(result) + (beg + len) - j);
continue;
}
rb_ary_push(result, (*func)(obj, NUM2LONG(argv[i])));
@@ -2302,18 +2742,20 @@ rb_get_values_at(VALUE obj, long olen, int argc, VALUE *argv, VALUE (*func) (VAL
/*
* call-seq:
- * ary.values_at(selector,... ) -> new_ary
+ * ary.values_at(selector, ...) -> new_ary
+ *
+ * Returns an array containing the elements in +self+ corresponding to the
+ * given +selector+(s).
*
- * 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>Array#select</code>.
+ * The selectors may be either integer indices or ranges.
+ *
+ * See also Array#select.
*
* 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)
+ * a.values_at(1, 3, 5) # => ["b", "d", "f"]
+ * a.values_at(1, 3, 5, 7) # => ["b", "d", "f", nil]
+ * a.values_at(-1, -2, -2, -7) # => ["f", "e", "e", nil]
+ * a.values_at(4..6, 3...6) # => ["e", "f", nil, "d", "e", "f"]
*/
static VALUE
@@ -2325,17 +2767,20 @@ rb_ary_values_at(int argc, VALUE *argv, VALUE ary)
/*
* call-seq:
- * ary.select {|item| block } -> new_ary
- * ary.select -> an_enumerator
+ * ary.select { |item| block } -> new_ary
+ * ary.select -> Enumerator
+ *
+ * Returns a new array containing all elements of +ary+
+ * for which the given +block+ returns a true value.
*
- * Invokes the block passing in successive elements from +self+,
- * returning an array containing those elements for which the block
- * returns a true value (equivalent to <code>Enumerable#select</code>).
+ * If no block is given, an Enumerator is returned instead.
*
- * If no block is given, an enumerator is returned instead.
+ * [1,2,3,4,5].select { |num| num.even? } #=> [2, 4]
*
* a = %w{ a b c d e f }
- * a.select {|v| v =~ /[aeiou]/} #=> ["a", "e"]
+ * a.select { |v| v =~ /[aeiou]/ } #=> ["a", "e"]
+ *
+ * See also Enumerable#select.
*/
static VALUE
@@ -2344,10 +2789,10 @@ rb_ary_select(VALUE ary)
VALUE result;
long i;
- RETURN_ENUMERATOR(ary, 0, 0);
+ 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));
}
}
@@ -2356,16 +2801,17 @@ rb_ary_select(VALUE ary)
/*
* call-seq:
- * ary.select! {|item| block } -> ary or nil
- * ary.select! -> an_enumerator
+ * ary.select! {|item| block } -> ary or nil
+ * ary.select! -> Enumerator
+ *
+ * Invokes the given block passing in successive elements from +self+,
+ * deleting elements for which the block returns a +false+ value.
+ *
+ * If changes were made, it will return +self+, otherwise it returns +nil+.
*
- * Invokes the block passing in successive elements from
- * +self+, deleting elements for which the block returns a
- * false value. It returns +self+ if changes were made,
- * otherwise it returns <code>nil</code>.
- * See also <code>Array#keep_if</code>
+ * See also Array#keep_if
*
- * If no block is given, an enumerator is returned instead.
+ * If no block is given, an Enumerator is returned instead.
*
*/
@@ -2374,10 +2820,10 @@ rb_ary_select_bang(VALUE ary)
{
long i1, i2;
- RETURN_ENUMERATOR(ary, 0, 0);
+ 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);
@@ -2385,46 +2831,61 @@ 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;
}
/*
* call-seq:
- * ary.keep_if {|item| block } -> ary
- * ary.keep_if -> an_enumerator
+ * ary.keep_if { |item| block } -> ary
+ * ary.keep_if -> Enumerator
+ *
+ * Deletes every element of +self+ for which the given block evaluates to
+ * +false+.
*
- * Deletes every element of +self+ for which <i>block</i> evaluates
- * to false.
- * See also <code>Array#select!</code>
+ * See also Array#select!
*
- * If no block is given, an enumerator is returned instead.
+ * If no block is given, an Enumerator is returned instead.
*
* a = %w{ a b c d e f }
- * a.keep_if {|v| v =~ /[aeiou]/} #=> ["a", "e"]
+ * a.keep_if { |v| v =~ /[aeiou]/ } #=> ["a", "e"]
*/
static VALUE
rb_ary_keep_if(VALUE ary)
{
- RETURN_ENUMERATOR(ary, 0, 0);
+ RETURN_SIZED_ENUMERATOR(ary, 0, 0, ary_enum_length);
rb_ary_select_bang(ary);
return ary;
}
+static void
+ary_resize_smaller(VALUE ary, long len)
+{
+ rb_ary_modify(ary);
+ if (RARRAY_LEN(ary) > len) {
+ ARY_SET_LEN(ary, len);
+ if (len * 2 < ARY_CAPA(ary) &&
+ ARY_CAPA(ary) > ARY_DEFAULT_SIZE) {
+ ary_resize_capa(ary, len * 2);
+ }
+ }
+}
+
/*
* call-seq:
- * ary.delete(obj) -> obj or nil
- * ary.delete(obj) { block } -> obj or nil
+ * ary.delete(obj) -> item or nil
+ * ary.delete(obj) { block } -> item or result of block
+ *
+ * Deletes all items from +self+ that are equal to +obj+.
+ *
+ * Returns the last deleted item, or +nil+ if no matching item is found.
*
- * Deletes items from +self+ that are equal to <i>obj</i>.
- * If any items are found, returns <i>obj</i>. If
- * the item is not found, returns <code>nil</code>. If the optional
- * code block is given, returns the result of <i>block</i> if the item
- * is not found. (To remove <code>nil</code> elements and
- * get an informative return value, use #compact!)
+ * If the optional code block is given, the result of the block is returned if
+ * the item is not found. (To remove +nil+ elements and get an informative
+ * return value, use Array#compact!)
*
* a = [ "a", "b", "b", "b", "c" ]
* a.delete("b") #=> "b"
@@ -2440,7 +2901,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;
@@ -2458,16 +2919,32 @@ rb_ary_delete(VALUE ary, VALUE item)
return Qnil;
}
- rb_ary_modify(ary);
- if (RARRAY_LEN(ary) > i2) {
- ARY_SET_LEN(ary, i2);
- if (i2 * 2 < ARY_CAPA(ary) &&
- ARY_CAPA(ary) > ARY_DEFAULT_SIZE) {
- ary_resize_capa(ary, i2*2);
+ ary_resize_smaller(ary, i2);
+
+ return v;
+}
+
+void
+rb_ary_delete_same(VALUE ary, VALUE item)
+{
+ long i1, i2;
+
+ for (i1 = i2 = 0; i1 < RARRAY_LEN(ary); i1++) {
+ VALUE e = RARRAY_AREF(ary, i1);
+
+ if (e == item) {
+ continue;
}
+ if (i1 != i2) {
+ rb_ary_store(ary, i2, e);
+ }
+ i2++;
+ }
+ if (RARRAY_LEN(ary) == i2) {
+ return;
}
- return v;
+ ary_resize_smaller(ary, i2);
}
VALUE
@@ -2483,9 +2960,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;
@@ -2495,11 +2973,12 @@ rb_ary_delete_at(VALUE ary, long pos)
* call-seq:
* ary.delete_at(index) -> obj or nil
*
- * Deletes the element at the specified index, returning that element,
- * or <code>nil</code> if the index is out of range. See also
- * <code>Array#slice!</code>.
+ * Deletes the element at the specified +index+, returning that element, or
+ * +nil+ if the +index+ is out of range.
*
- * a = %w( ant bat cat dog )
+ * See also Array#slice!
+ *
+ * a = ["ant", "bat", "cat", "dog"]
* a.delete_at(2) #=> "cat"
* a #=> ["ant", "bat", "dog"]
* a.delete_at(99) #=> nil
@@ -2517,9 +2996,11 @@ rb_ary_delete_at_m(VALUE ary, VALUE pos)
* ary.slice!(start, length) -> new_ary or nil
* ary.slice!(range) -> new_ary or nil
*
- * Deletes the element(s) given by an index (optionally with a length)
- * or by a range. Returns the deleted object (or objects), or
- * <code>nil</code> if the index is out of range.
+ * Deletes the element(s) given by an +index+ (optionally up to +length+
+ * elements) or by a +range+.
+ *
+ * Returns the deleted object (or objects), or +nil+ if the +index+ is out of
+ * range.
*
* a = [ "a", "b", "c" ]
* a.slice!(1) #=> "b"
@@ -2552,8 +3033,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;
}
@@ -2587,7 +3068,7 @@ 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);
}
@@ -2603,7 +3084,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;
@@ -2617,38 +3098,38 @@ ary_reject_bang(VALUE ary)
/*
* call-seq:
- * ary.reject! {|item| block } -> ary or nil
- * ary.reject! -> an_enumerator
+ * ary.reject! { |item| block } -> ary or nil
+ * ary.reject! -> Enumerator
*
- * Equivalent to <code>Array#delete_if</code>, deleting elements from
- * +self+ for which the block evaluates to true, but returns
- * <code>nil</code> if no changes were made.
- * The array is changed instantly every time the block is called and
- * not after the iteration is over.
- * See also <code>Enumerable#reject</code> and <code>Array#delete_if</code>.
+ * Equivalent to Array#delete_if, deleting elements from +self+ for which the
+ * block evaluates to +true+, but returns +nil+ if no changes were made.
*
- * If no block is given, an enumerator is returned instead.
+ * The array is changed instantly every time the block is called, not after
+ * the iteration is over.
*
+ * See also Enumerable#reject and Array#delete_if.
+ *
+ * If no block is given, an Enumerator is returned instead.
*/
static VALUE
rb_ary_reject_bang(VALUE ary)
{
- RETURN_ENUMERATOR(ary, 0, 0);
+ RETURN_SIZED_ENUMERATOR(ary, 0, 0, ary_enum_length);
return ary_reject_bang(ary);
}
/*
* call-seq:
- * ary.reject {|item| block } -> new_ary
- * ary.reject -> an_enumerator
+ * ary.reject {|item| block } -> new_ary
+ * ary.reject -> Enumerator
*
- * Returns a new array containing the items in +self+
- * for which the block is not true.
- * See also <code>Array#delete_if</code>
+ * Returns a new array containing the items in +self+ for which the given
+ * block is not +true+.
*
- * If no block is given, an enumerator is returned instead.
+ * See also Array#delete_if
*
+ * If no block is given, an Enumerator is returned instead.
*/
static VALUE
@@ -2656,7 +3137,7 @@ rb_ary_reject(VALUE ary)
{
VALUE rejected_ary;
- RETURN_ENUMERATOR(ary, 0, 0);
+ RETURN_SIZED_ENUMERATOR(ary, 0, 0, ary_enum_length);
rejected_ary = rb_ary_new();
ary_reject(ary, rejected_ary);
return rejected_ary;
@@ -2664,25 +3145,26 @@ rb_ary_reject(VALUE ary)
/*
* call-seq:
- * ary.delete_if {|item| block } -> ary
- * ary.delete_if -> an_enumerator
+ * ary.delete_if { |item| block } -> ary
+ * ary.delete_if -> Enumerator
*
- * Deletes every element of +self+ for which <i>block</i> evaluates
- * to true.
- * The array is changed instantly every time the block is called and
- * not after the iteration is over.
- * See also <code>Array#reject!</code>
+ * Deletes every element of +self+ for which block evaluates to +true+.
*
- * If no block is given, an enumerator is returned instead.
+ * The array is changed instantly every time the block is called, not after
+ * the iteration is over.
*
- * a = [ "a", "b", "c" ]
- * a.delete_if {|x| x >= "b" } #=> ["a"]
+ * See also Array#reject!
+ *
+ * If no block is given, an Enumerator is returned instead.
+ *
+ * scores = [ 97, 42, 75 ]
+ * scores.delete_if {|score| score < 80 } #=> [97]
*/
static VALUE
rb_ary_delete_if(VALUE ary)
{
- RETURN_ENUMERATOR(ary, 0, 0);
+ RETURN_SIZED_ENUMERATOR(ary, 0, 0, ary_enum_length);
ary_reject_bang(ary);
return ary;
}
@@ -2705,61 +3187,88 @@ take_items(VALUE obj, long n)
if (!NIL_P(result)) return rb_ary_subseq(result, 0, n);
result = rb_ary_new2(n);
args[0] = result; args[1] = (VALUE)n;
- rb_block_call(obj, rb_intern("each"), 0, 0, take_i, (VALUE)args);
+ if (rb_check_block_call(obj, idEach, 0, 0, take_i, (VALUE)args) == Qundef)
+ rb_raise(rb_eTypeError, "wrong argument type %"PRIsVALUE" (must respond to :each)",
+ rb_obj_class(obj));
return result;
}
/*
* call-seq:
- * ary.zip(arg, ...) -> new_ary
- * ary.zip(arg, ...) {| arr | block } -> nil
- *
- * Converts any arguments to arrays, then merges elements of
- * +self+ with corresponding elements from each argument. This
- * generates a sequence of <code>self.size</code> <em>n</em>-element
- * arrays, where <em>n</em> is one more that the count of arguments. If
- * the size of any argument is less than <code>enumObj.size</code>,
- * <code>nil</code> values are supplied. If a block is given, it is
- * invoked for each output array, otherwise an array of arrays is
- * returned.
+ * ary.zip(arg, ...) -> new_ary
+ * ary.zip(arg, ...) { |arr| block } -> nil
+ *
+ * Converts any arguments to arrays, then merges elements of +self+ with
+ * corresponding elements from each argument.
+ *
+ * This generates a sequence of <code>ary.size</code> _n_-element arrays,
+ * where _n_ is one more than the count of arguments.
+ *
+ * If the size of any argument is less than the size of the initial array,
+ * +nil+ values are supplied.
+ *
+ * If a block is given, it is invoked for each output +array+, otherwise an
+ * array of arrays is returned.
*
* a = [ 4, 5, 6 ]
* b = [ 7, 8, 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]]
+ * [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]]
*/
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 && argc+1 < 0x100) {
+ VALUE *tmp = ALLOCA_N(VALUE, 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);
+ }
}
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;
}
@@ -2767,11 +3276,13 @@ rb_ary_zip(int argc, VALUE *argv, VALUE ary)
* call-seq:
* ary.transpose -> new_ary
*
- * Assumes that +self+ is an array of arrays and transposes the
- * rows and columns.
+ * Assumes that +self+ is an array of arrays and transposes the rows and
+ * columns.
*
* a = [[1,2], [3,4], [5,6]]
* a.transpose #=> [[1, 3, 5], [2, 4, 6]]
+ *
+ * If the length of the subarrays don't match, an IndexError is raised.
*/
static VALUE
@@ -2805,9 +3316,10 @@ 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
- * <i>other_ary</i>, truncating or expanding if necessary.
+ * Replaces the contents of +self+ with the contents of +other_ary+,
+ * truncating or expanding if necessary.
*
* a = [ "a", "b", "c", "d", "e" ]
* a.replace([ "x", "y", "z" ]) #=> ["x", "y", "z"]
@@ -2822,19 +3334,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);
}
@@ -2843,13 +3353,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);
}
@@ -2885,27 +3395,32 @@ rb_ary_clear(VALUE ary)
/*
* call-seq:
- * ary.fill(obj) -> ary
- * ary.fill(obj, start [, length]) -> ary
- * ary.fill(obj, range ) -> ary
- * ary.fill {|index| block } -> ary
- * ary.fill(start [, length] ) {|index| block } -> ary
- * ary.fill(range) {|index| block } -> ary
+ * ary.fill(obj) -> ary
+ * ary.fill(obj, start [, length]) -> ary
+ * ary.fill(obj, range ) -> ary
+ * ary.fill { |index| block } -> ary
+ * ary.fill(start [, length] ) { |index| block } -> ary
+ * ary.fill(range) { |index| block } -> ary
*
* The first three forms set the selected elements of +self+ (which
- * may be the entire array) to <i>obj</i>. A <i>start</i> of
- * <code>nil</code> is equivalent to zero. A <i>length</i> of
- * <code>nil</code> is equivalent to <i>self.length</i>. The last three
- * forms fill the array with the value of the block. The block is
- * passed the absolute index of each element to be filled.
- * Negative values of <i>start</i> count from the end of the array.
+ * may be the entire array) to +obj+.
+ *
+ * A +start+ of +nil+ is equivalent to zero.
+ *
+ * A +length+ of +nil+ is equivalent to the length of the array.
+ *
+ * The last three forms fill the array with the value of the given block,
+ * which is passed the absolute index of each element to be filled.
+ *
+ * Negative values of +start+ count from the end of the array, where +-1+ is
+ * the last element.
*
* a = [ "a", "b", "c", "d" ]
* a.fill("x") #=> ["x", "x", "x", "x"]
* a.fill("z", 2, 2) #=> ["x", "x", "z", "z"]
* a.fill("y", 0..1) #=> ["y", "y", "z", "z"]
- * a.fill {|i| i*i} #=> [0, 1, 4, 9]
- * a.fill(-2) {|i| i*i*i} #=> [0, 1, 8, 27]
+ * a.fill { |i| i*i } #=> [0, 1, 4, 9]
+ * a.fill(-2) { |i| i*i*i } #=> [0, 1, 8, 27]
*/
static VALUE
@@ -2913,7 +3428,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()) {
@@ -2955,7 +3469,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);
}
@@ -2966,15 +3480,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;
+ RARRAY_ASET(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;
}
@@ -2983,23 +3493,32 @@ rb_ary_fill(int argc, VALUE *argv, VALUE ary)
* call-seq:
* ary + other_ary -> new_ary
*
- * Concatenation---Returns a new array built by concatenating the
+ * Concatenation --- Returns a new array built by concatenating the
* two arrays together to produce a third array.
*
* [ 1, 2, 3 ] + [ 4, 5 ] #=> [ 1, 2, 3, 4, 5 ]
+ * a = [ "a", "b", "c" ]
+ * c = a + [ "d", "e", "f" ]
+ * c #=> [ "a", "b", "c", "d", "e", "f" ]
+ * a #=> [ "a", "b", "c" ]
+ *
+ * See also Array#concat.
*/
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;
}
@@ -3008,12 +3527,16 @@ rb_ary_plus(VALUE x, VALUE y)
* call-seq:
* ary.concat(other_ary) -> ary
*
- * Appends the elements of <i>other_ary</i> to +self+.
+ * Appends the elements of +other_ary+ to +self+.
*
* [ "a", "b" ].concat( ["c", "d"] ) #=> [ "a", "b", "c", "d" ]
+ * a = [ 1, 2, 3 ]
+ * a.concat( [ 4, 5 ] )
+ * a #=> [ 1, 2, 3, 4, 5 ]
+ *
+ * See also Array#+.
*/
-
VALUE
rb_ary_concat(VALUE x, VALUE y)
{
@@ -3031,9 +3554,11 @@ rb_ary_concat(VALUE x, VALUE y)
* ary * int -> new_ary
* ary * str -> new_string
*
- * Repetition---With a String argument, equivalent to
- * self.join(str). Otherwise, returns a new array
- * built by concatenating the _int_ copies of +self+.
+ * Repetition --- With a String argument, equivalent to
+ * <code>ary.join(str)</code>.
+ *
+ * Otherwise, returns a new array built by concatenating the +int+ copies of
+ * +self+.
*
*
* [ 1, 2, 3 ] * 3 #=> [ 1, 2, 3, 1, 2, 3, 1, 2, 3 ]
@@ -3044,7 +3569,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);
@@ -3068,17 +3594,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:
@@ -3091,13 +3616,13 @@ rb_ary_times(VALUE ary, VALUE times)
* call-seq:
* ary.assoc(obj) -> new_ary or nil
*
- * Searches through an array whose elements are also arrays
- * comparing _obj_ with the first element of each contained array
- * using obj.==.
- * Returns the first contained array that matches (that
- * is, the first associated array),
- * or +nil+ if no match is found.
- * See also <code>Array#rassoc</code>.
+ * Searches through an array whose elements are also arrays comparing +obj+
+ * with the first element of each contained array using <code>obj.==</code>.
+ *
+ * Returns the first contained array that matches (that is, the first
+ * associated array), or +nil+ if no match is found.
+ *
+ * See also Array#rassoc
*
* s1 = [ "colors", "red", "blue", "green" ]
* s2 = [ "letters", "a", "b", "c" ]
@@ -3114,9 +3639,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;
@@ -3126,10 +3651,14 @@ rb_ary_assoc(VALUE ary, VALUE key)
* call-seq:
* ary.rassoc(obj) -> new_ary or nil
*
- * Searches through the array whose elements are also arrays. Compares
- * _obj_ with the second element of each contained array using
- * <code>==</code>. Returns the first contained array that matches. See
- * also <code>Array#assoc</code>.
+ * Searches through the array whose elements are also arrays.
+ *
+ * Compares +obj+ with the second element of each contained array using
+ * <code>obj.==</code>.
+ *
+ * Returns the first contained array that matches +obj+.
+ *
+ * See also Array#assoc.
*
* a = [ [ 1, "one"], [2, "two"], [3, "three"], ["ii", "two"] ]
* a.rassoc("two") #=> [2, "two"]
@@ -3143,10 +3672,10 @@ rb_ary_rassoc(VALUE ary, VALUE value)
VALUE v;
for (i = 0; i < RARRAY_LEN(ary); ++i) {
- v = RARRAY_PTR(ary)[i];
- if (TYPE(v) == T_ARRAY &&
+ 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;
@@ -3155,12 +3684,32 @@ rb_ary_rassoc(VALUE ary, VALUE value)
static VALUE
recursive_equal(VALUE ary1, VALUE ary2, int recur)
{
- long i;
+ long i, len1;
+ const VALUE *p1, *p2;
if (recur) return Qtrue; /* Subtle! */
- for (i=0; i<RARRAY_LEN(ary1); i++) {
- if (!rb_equal(rb_ary_elt(ary1, i), rb_ary_elt(ary2, i)))
- return Qfalse;
+
+ p1 = RARRAY_CONST_PTR(ary1);
+ p2 = RARRAY_CONST_PTR(ary2);
+ len1 = RARRAY_LEN(ary1);
+
+ for (i = 0; i < len1; i++) {
+ if (*p1 != *p2) {
+ if (rb_equal(*p1, *p2)) {
+ len1 = RARRAY_LEN(ary1);
+ if (len1 != RARRAY_LEN(ary2))
+ return Qfalse;
+ if (len1 < i)
+ return Qtrue;
+ p1 = RARRAY_CONST_PTR(ary1) + i;
+ p2 = RARRAY_CONST_PTR(ary2) + i;
+ }
+ else {
+ return Qfalse;
+ }
+ }
+ p1++;
+ p2++;
}
return Qtrue;
}
@@ -3169,9 +3718,9 @@ recursive_equal(VALUE ary1, VALUE ary2, int recur)
* call-seq:
* ary == other_ary -> bool
*
- * Equality---Two arrays are equal if they contain the same number
- * of elements and if each element is equal to (according to
- * Object.==) the corresponding element in the other array.
+ * Equality --- Two arrays are equal if they contain the same number of
+ * elements and if each element is equal to (according to Object#==) the
+ * corresponding element in +other_ary+.
*
* [ "a", "c" ] == [ "a", "c", 7 ] #=> false
* [ "a", "c", 7 ] == [ "a", "c", 7 ] #=> true
@@ -3183,13 +3732,14 @@ static VALUE
rb_ary_equal(VALUE ary1, VALUE ary2)
{
if (ary1 == ary2) return Qtrue;
- if (TYPE(ary2) != T_ARRAY) {
+ if (!RB_TYPE_P(ary2, T_ARRAY)) {
if (!rb_respond_to(ary2, rb_intern("to_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);
}
@@ -3210,16 +3760,17 @@ recursive_eql(VALUE ary1, VALUE ary2, int recur)
* call-seq:
* ary.eql?(other) -> true or false
*
- * Returns <code>true</code> if +self+ and _other_ are the same object,
- * or are both arrays with the same content.
+ * Returns +true+ if +self+ and +other+ are the same object,
+ * or are both arrays with the same content (according to Object#eql?).
*/
static VALUE
rb_ary_eql(VALUE ary1, VALUE ary2)
{
if (ary1 == ary2) return Qtrue;
- if (TYPE(ary2) != T_ARRAY) return Qfalse;
+ 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);
}
@@ -3236,7 +3787,7 @@ recursive_hash(VALUE ary, VALUE dummy, int recur)
}
else {
for (i=0; i<RARRAY_LEN(ary); i++) {
- n = rb_hash(RARRAY_PTR(ary)[i]);
+ n = rb_hash(RARRAY_AREF(ary, i));
h = rb_hash_uint(h, NUM2LONG(n));
}
}
@@ -3248,8 +3799,10 @@ recursive_hash(VALUE ary, VALUE dummy, int recur)
* call-seq:
* ary.hash -> fixnum
*
- * Compute a hash-code for this array. Two arrays with the same content
- * will have the same hash code (and will compare using <code>eql?</code>).
+ * Compute a hash-code for this array.
+ *
+ * Two arrays with the same content will have the same hash code (and will
+ * compare using #eql?).
*/
static VALUE
@@ -3260,11 +3813,10 @@ rb_ary_hash(VALUE ary)
/*
* call-seq:
- * ary.include?(obj) -> true or false
+ * ary.include?(object) -> true or false
*
- * Returns <code>true</code> if the given object is present in
- * +self+ (that is, if any object <code>==</code> <i>anObject</i>),
- * <code>false</code> otherwise.
+ * Returns +true+ if the given +object+ is present in +self+ (that is, if any
+ * element <code>==</code> +object+), otherwise returns +false+.
*
* a = [ "a", "b", "c" ]
* a.include?("b") #=> true
@@ -3277,7 +3829,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;
}
}
@@ -3296,7 +3848,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;
}
@@ -3308,16 +3861,21 @@ recursive_cmp(VALUE ary1, VALUE ary2, int recur)
* call-seq:
* ary <=> other_ary -> -1, 0, +1 or nil
*
- * Comparison---Returns an integer (-1, 0,
- * or +1) if this array is less than, equal to, or greater than
- * <i>other_ary</i>. Each object in each array is compared
- * (using <=>). If any value isn't
- * equal, then that inequality is the return value. If all the
- * values found are equal, then the return is based on a
- * comparison of the array lengths. Thus, two arrays are
- * ``equal'' according to <code>Array#<=></code> 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.
+ * 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.
+ *
+ * If all the values are equal, then the return is based on a comparison of
+ * the array lengths. Thus, two arrays are "equal" according to Array#<=> if,
+ * and only if, they have the same length and the value of each element is
+ * equal to the value of the corresponding element in the other array.
*
* [ "a", "a", "c" ] <=> [ "a", "b", "c" ] #=> -1
* [ 1, 2, 3, 4, 5, 6 ] <=> [ 1, 2 ] #=> +1
@@ -3347,7 +3905,7 @@ 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);
+ rb_hash_aset(hash, RARRAY_AREF(ary, i), Qtrue);
}
return hash;
}
@@ -3357,7 +3915,7 @@ ary_tmp_hash_new(void)
{
VALUE hash = rb_hash_new();
- RBASIC(hash)->klass = 0;
+ RBASIC_CLEAR_CLASS(hash);
return hash;
}
@@ -3403,12 +3961,17 @@ ary_recycle_hash(VALUE hash)
* call-seq:
* ary - other_ary -> new_ary
*
- * Array Difference---Returns a new array that is a copy of
- * the original array, removing any items that also appear in
- * <i>other_ary</i>. (If you need set-like behavior, see the
- * library class Set.)
+ * Array Difference
+ *
+ * Returns a new array that is a copy of the original array, removing any
+ * items that also appear in +other_ary+. The order is preserved from the
+ * original array.
+ *
+ * It compares elements using their #hash and #eql? methods for efficiency.
*
* [ 1, 1, 2, 2, 3, 3, 4, 5 ] - [ 1, 2, 4 ] #=> [ 3, 3, 5 ]
+ *
+ * If you need set-like behavior, see the library class Set.
*/
static VALUE
@@ -3422,7 +3985,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);
@@ -3433,10 +3996,16 @@ rb_ary_diff(VALUE ary1, VALUE ary2)
* call-seq:
* ary & other_ary -> new_ary
*
- * Set Intersection---Returns a new array
- * containing elements common to the two arrays, with no duplicates.
+ * Set Intersection --- Returns a new array containing elements common to the
+ * two arrays, excluding any duplicates. The order is preserved from the
+ * original array.
+ *
+ * It compares elements using their #hash and #eql? methods for efficiency.
+ *
+ * [ 1, 1, 3, 5 ] & [ 1, 2, 3 ] #=> [ 1, 3 ]
+ * [ 'a', 'b', 'b', 'z' ] & [ 'a', 'b', 'c' ] #=> [ 'a', 'b' ]
*
- * [ 1, 1, 3, 5 ] & [ 1, 2, 3 ] #=> [ 1, 3 ]
+ * See also Array#uniq.
*/
@@ -3444,20 +4013,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);
}
}
@@ -3470,41 +4039,36 @@ rb_ary_and(VALUE ary1, VALUE ary2)
* call-seq:
* ary | other_ary -> new_ary
*
- * Set Union---Returns a new array by joining this array with
- * <i>other_ary</i>, removing duplicates.
+ * Set Union --- Returns a new array by joining +ary+ with +other_ary+,
+ * excluding any duplicates and preserving the order from the original array.
*
- * [ "a", "b", "c" ] | [ "c", "d", "a" ]
- * #=> [ "a", "b", "c", "d" ]
+ * It compares elements using their #hash and #eql? methods for efficiency.
+ *
+ * [ "a", "b", "c" ] | [ "c", "d", "a" ] #=> [ "a", "b", "c", "d" ]
+ *
+ * See also Array#uniq.
*/
static VALUE
rb_ary_or(VALUE ary1, VALUE ary2)
{
- VALUE hash, ary3, v;
- st_data_t vv;
- long i;
+ VALUE hash, ary3;
ary2 = to_ary(ary2);
- ary3 = rb_ary_new2(RARRAY_LEN(ary1)+RARRAY_LEN(ary2));
hash = ary_add_hash(ary_make_hash(ary1), ary2);
-
- 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);
- }
- }
+ ary3 = rb_hash_keys(hash);
ary_recycle_hash(hash);
return ary3;
}
static int
+push_key(st_data_t key, st_data_t val, st_data_t ary)
+{
+ rb_ary_push((VALUE)ary, (VALUE)key);
+ return ST_CONTINUE;
+}
+
+static int
push_value(st_data_t key, st_data_t val, st_data_t ary)
{
rb_ary_push((VALUE)ary, (VALUE)val);
@@ -3516,10 +4080,14 @@ push_value(st_data_t key, st_data_t val, st_data_t ary)
* ary.uniq! -> ary or nil
* ary.uniq! { |item| ... } -> ary or nil
*
- * Removes duplicate elements from +self+. If a block is given,
- * it will use the return value of the block for comparison.
- * Returns <code>nil</code> if no changes are made (that is, no
- * duplicates are found).
+ * Removes duplicate elements from +self+.
+ *
+ * If a block is given, it will use the return value of the block for
+ * comparison.
+ *
+ * It compares values using their #hash and #eql? methods for efficiency.
+ *
+ * Returns +nil+ if no changes are made (that is, no duplicates are found).
*
* a = [ "a", "a", "b", "b", "c" ]
* a.uniq! # => ["a", "b", "c"]
@@ -3535,37 +4103,41 @@ 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()) {
hash = ary_make_hash_by(ary);
- if (RARRAY_LEN(ary) == (i = RHASH_SIZE(hash))) {
+ 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, i);
- st_foreach(RHASH_TBL(hash), push_value, ary);
+ ary_resize_capa(ary, hash_size);
+ st_foreach(rb_hash_tbl_raw(hash), push_value, ary);
}
else {
hash = ary_make_hash(ary);
- if (RARRAY_LEN(ary) == (long)RHASH_SIZE(hash)) {
+ hash_size = RHASH_SIZE(hash);
+ if (RARRAY_LEN(ary) == hash_size) {
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);
- }
+ 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_SET_LEN(ary, j);
+ ary_resize_capa(ary, hash_size);
+ st_foreach(rb_hash_tbl_raw(hash), push_key, ary);
}
ary_recycle_hash(hash);
@@ -3577,8 +4149,11 @@ rb_ary_uniq_bang(VALUE ary)
* ary.uniq -> new_ary
* ary.uniq { |item| ... } -> new_ary
*
- * Returns a new array by removing duplicate values in +self+. If a block
- * is given, it will use the return value of the block for comparison.
+ * Returns a new array by removing duplicate values in +self+.
+ *
+ * If a block is given, it will use the return value of the block for comparison.
+ *
+ * It compares values using their #hash and #eql? methods for efficiency.
*
* a = [ "a", "a", "b", "b", "c" ]
* a.uniq # => ["a", "b", "c"]
@@ -3591,26 +4166,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_keys(hash);
}
+ RBASIC_SET_CLASS(uniq, rb_obj_class(ary));
ary_recycle_hash(hash);
return uniq;
@@ -3621,8 +4189,8 @@ rb_ary_uniq(VALUE ary)
* ary.compact! -> ary or nil
*
* Removes +nil+ elements from the array.
- * Returns +nil+ if no changes were made, otherwise returns
- * <i>ary</i>.
+ *
+ * Returns +nil+ if no changes were made, otherwise returns the array.
*
* [ "a", nil, "b", nil, "c" ].compact! #=> [ "a", "b", "c" ]
* [ "a", "b", "c" ].compact! #=> nil
@@ -3635,21 +4203,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;
}
@@ -3674,45 +4239,50 @@ rb_ary_compact(VALUE ary)
/*
* call-seq:
- * ary.count -> int
- * ary.count(obj) -> int
+ * ary.count -> int
+ * ary.count(obj) -> int
* ary.count { |item| block } -> int
*
- * Returns the number of elements. If an argument is given, counts
- * the number of elements which equals to <i>obj</i>. If a block is
- * given, counts the number of elements yielding a true value.
+ * Returns the number of elements.
+ *
+ * If an argument is given, counts the number of elements which equal +obj+
+ * using <code>==</code>.
+ *
+ * If a block is given, counts the number of elements for which the block
+ * returns a true value.
*
* ary = [1, 2, 4, 2]
- * ary.count #=> 4
- * ary.count(2) #=> 2
- * ary.count{|x|x%2==0} #=> 3
+ * ary.count #=> 4
+ * ary.count(2) #=> 2
+ * ary.count { |x| x%2 == 0 } #=> 3
*
*/
static VALUE
rb_ary_count(int argc, VALUE *argv, VALUE ary)
{
- long n = 0;
+ long i, n = 0;
if (argc == 0) {
- VALUE *p, *pend;
+ VALUE v;
if (!rb_block_given_p())
return LONG2NUM(RARRAY_LEN(ary));
- for (p = RARRAY_PTR(ary), pend = p + RARRAY_LEN(ary); p < pend; p++) {
- if (RTEST(rb_yield(*p))) n++;
+ for (i = 0; i < RARRAY_LEN(ary); i++) {
+ v = RARRAY_AREF(ary, i);
+ if (RTEST(rb_yield(v))) n++;
}
}
else {
- VALUE obj, *p, *pend;
+ VALUE obj;
rb_scan_args(argc, argv, "1", &obj);
if (rb_block_given_p()) {
rb_warn("given block not used");
}
- for (p = RARRAY_PTR(ary), pend = p + RARRAY_LEN(ary); p < pend; p++) {
- if (rb_equal(*p, obj)) n++;
+ for (i = 0; i < RARRAY_LEN(ary); i++) {
+ if (rb_equal(RARRAY_AREF(ary, i), obj)) n++;
}
}
@@ -3735,7 +4305,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");
@@ -3769,19 +4339,21 @@ 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;
}
/*
* call-seq:
* ary.flatten! -> ary or nil
- * ary.flatten!(level) -> array or nil
+ * ary.flatten!(level) -> ary or nil
*
* Flattens +self+ in place.
- * Returns <code>nil</code> if no modifications were made (i.e.,
- * <i>ary</i> contains no subarrays.) If the optional <i>level</i>
- * argument determines the level of recursion to flatten.
+ *
+ * Returns +nil+ if no modifications were made (i.e., the array contains no
+ * subarrays.)
+ *
+ * The optional +level+ argument determines the level of recursion to flatten.
*
* a = [ 1, 2, [3, [4, 5] ] ]
* a.flatten! #=> [1, 2, 3, 4, 5]
@@ -3819,10 +4391,14 @@ rb_ary_flatten_bang(int argc, VALUE *argv, VALUE ary)
* ary.flatten -> new_ary
* ary.flatten(level) -> new_ary
*
- * Returns a new array that is a one-dimensional flattening of this
- * array (recursively). That is, for every element that is an array,
- * extract its elements into the new array. If the optional
- * <i>level</i> argument determines the level of recursion to flatten.
+ * Returns a new array that is a one-dimensional flattening of +self+
+ * (recursively).
+ *
+ * That is, for every element that is an array, extract its elements into
+ * the new array.
+ *
+ * The optional +level+ argument determines the level of recursion to
+ * flatten.
*
* s = [ 1, 2, 3 ] #=> [1, 2, 3]
* t = [ 4, 5, 6, [7, 8] ] #=> [4, 5, 6, [7, 8]]
@@ -3852,7 +4428,7 @@ rb_ary_flatten(int argc, VALUE *argv, VALUE ary)
(argc > 0 && !NIL_P((opts) = rb_check_hash_type(argv[argc-1])) && (--argc, 1))
static VALUE sym_random;
-#define RAND_UPTO(max) (long)(rb_random_real(randgen)*(max))
+#define RAND_UPTO(max) (long)rb_random_ulong_limited((randgen), (max)-1)
/*
* call-seq:
@@ -3860,36 +4436,34 @@ static VALUE sym_random;
* ary.shuffle!(random: rng) -> ary
*
* Shuffles elements in +self+ in place.
- * If +rng+ is given, it will be used as the random number generator.
+ *
+ * The optional +rng+ argument will be used as the random number generator.
*/
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);
}
- if (argc > 0) {
- rb_raise(rb_eArgError, "wrong number of arguments (%d for 0)", argc);
- }
+ 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;
}
@@ -3899,12 +4473,12 @@ rb_ary_shuffle_bang(int argc, VALUE *argv, VALUE ary)
* ary.shuffle -> new_ary
* ary.shuffle(random: rng) -> new_ary
*
- * Returns a new array with elements of this array shuffled.
+ * Returns a new array with elements of +self+ shuffled.
*
* a = [ 1, 2, 3 ] #=> [1, 2, 3]
* a.shuffle #=> [2, 3, 1]
*
- * If +rng+ is given, it will be used as the random number generator.
+ * The optional +rng+ argument will be used as the random number generator.
*
* a.shuffle(random: Random.new(1)) #=> [1, 3, 2]
*/
@@ -3925,40 +4499,42 @@ rb_ary_shuffle(int argc, VALUE *argv, VALUE ary)
* ary.sample(n) -> new_ary
* ary.sample(n, random: rng) -> new_ary
*
- * Choose a random element or +n+ random elements from the array. The elements
- * are chosen by using random and unique indices into the array in order to
- * ensure that an element doesn't repeat itself unless the array already
- * contained duplicate elements. If the array is empty the first form returns
- * <code>nil</code> and the second form returns an empty array.
+ * Choose a random element or +n+ random elements from the array.
*
- * If +rng+ is given, it will be used as the random number generator.
+ * The elements are chosen by using random and unique indices into the array
+ * in order to ensure that an element doesn't repeat itself unless the array
+ * already contained duplicate elements.
+ *
+ * If the array is empty the first form returns +nil+ and the second form
+ * returns an empty array.
+ *
+ * The optional +rng+ argument will be used as the random number generator.
+ *
+ * a = [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ]
+ * a.sample #=> 7
+ * a.sample(4) #=> [6, 4, 2, 5]
*/
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];
- double rnds[numberof(idx)];
+ long rnds[numberof(idx)];
if (OPTHASH_GIVEN_P(opts)) {
randgen = rb_hash_lookup2(opts, sym_random, randgen);
}
- 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 {
- double x = rb_random_real(randgen);
- if ((len = RARRAY_LEN(ary)) == 0) return Qnil;
- i = (long)(x * len);
- }
- return RARRAY_PTR(ary)[i];
+ else
+ i = RAND_UPTO(len);
+
+ return rb_ary_elt(ary, i);
}
rb_scan_args(argc, argv, "1", &nv);
n = NUM2LONG(nv);
@@ -3966,40 +4542,44 @@ rb_ary_sample(int argc, VALUE *argv, VALUE ary)
if (n > len) n = len;
if (n <= numberof(idx)) {
for (i = 0; i < n; ++i) {
- rnds[i] = rb_random_real(randgen);
+ rnds[i] = RAND_UPTO(len - i);
}
}
+ k = len;
len = RARRAY_LEN(ary);
- ptr = RARRAY_PTR(ary);
+ 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 = (long)(rnds[0] * len);
- return rb_ary_new4(1, &ptr[i]);
+ i = rnds[0];
+ return rb_ary_new_from_values(1, &RARRAY_AREF(ary, i));
case 2:
- i = (long)(rnds[0] * len);
- j = (long)(rnds[1] * (len-1));
+ 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 = (long)(rnds[0] * len);
- j = (long)(rnds[1] * (len-1));
- k = (long)(rnds[2] * (len-2));
+ i = rnds[0];
+ j = rnds[1];
+ k = rnds[2];
{
long l = j, g = i;
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] = (long)(rnds[0] * len);
+ sorted[0] = idx[0] = rnds[0];
for (i=1; i<n; i++) {
- k = (long)(rnds[i] * --len);
+ k = rnds[i];
for (j = 0; j < i; ++j) {
if (k < sorted[j]) break;
++k;
@@ -4007,48 +4587,65 @@ 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);
return result;
}
+static VALUE
+rb_ary_cycle_size(VALUE self, VALUE args, VALUE eobj)
+{
+ long mul;
+ VALUE n = Qnil;
+ if (args && (RARRAY_LEN(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);
+ n = LONG2FIX(mul);
+ return rb_funcallv(rb_ary_length(self), '*', 1, &n);
+}
/*
* call-seq:
- * ary.cycle(n=nil) {|obj| block } -> nil
- * ary.cycle(n=nil) -> an_enumerator
+ * ary.cycle(n=nil) { |obj| block } -> nil
+ * ary.cycle(n=nil) -> Enumerator
*
- * Calls <i>block</i> for each element repeatedly _n_ times or
- * forever if none or +nil+ is given. If a non-positive number is
- * given or the array is empty, does nothing. Returns +nil+ if the
- * loop has finished without getting interrupted.
+ * Calls the given block for each element +n+ times or forever if +nil+ is
+ * given.
*
- * If no block is given, an enumerator is returned instead.
+ * Does nothing if a non-positive number is given or the array is empty.
*
+ * Returns +nil+ if the loop has finished without getting interrupted.
+ *
+ * If no block is given, an Enumerator is returned instead.
*
* a = ["a", "b", "c"]
- * a.cycle {|x| puts x } # print, a, b, c, a, b, c,.. forever.
- * a.cycle(2) {|x| puts x } # print, a, b, c, a, b, c.
+ * a.cycle { |x| puts x } # print, a, b, c, a, b, c,.. forever.
+ * a.cycle(2) { |x| puts x } # print, a, b, c, a, b, c.
*
*/
@@ -4060,7 +4657,7 @@ rb_ary_cycle(int argc, VALUE *argv, VALUE ary)
rb_scan_args(argc, argv, "01", &nv);
- RETURN_ENUMERATOR(ary, argc, argv);
+ RETURN_SIZED_ENUMERATOR(ary, argc, argv, rb_ary_cycle_size);
if (NIL_P(nv)) {
n = -1;
}
@@ -4071,19 +4668,21 @@ 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 [0..n-1].
+ * Recursively compute permutations of +r+ elements of the set
+ * <code>[0..n-1]</code>.
+ *
* When we have a complete permutation of array indexes, copy the values
* at those indexes into a new array and yield that array.
*
@@ -4127,29 +4726,70 @@ permute0(long n, long r, long *p, long index, char *used, VALUE values)
}
/*
+ * Returns the product of from, from-1, ..., from - how_many + 1.
+ * http://en.wikipedia.org/wiki/Pochhammer_symbol
+ */
+static VALUE
+descending_factorial(long from, long how_many)
+{
+ VALUE cnt = LONG2FIX(how_many >= 0);
+ while (how_many-- > 0) {
+ VALUE v = LONG2FIX(from--);
+ cnt = rb_funcallv(cnt, '*', 1, &v);
+ }
+ return cnt;
+}
+
+static VALUE
+binomial_coefficient(long comb, long size)
+{
+ VALUE r, v;
+ if (comb > size-comb) {
+ comb = size-comb;
+ }
+ if (comb < 0) {
+ return LONG2FIX(0);
+ }
+ 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, VALUE eobj)
+{
+ long n = RARRAY_LEN(ary);
+ long k = (args && (RARRAY_LEN(args) > 0)) ? NUM2LONG(RARRAY_AREF(args, 0)) : n;
+
+ return descending_factorial(n, k);
+}
+
+/*
* call-seq:
* ary.permutation { |p| block } -> ary
- * ary.permutation -> an_enumerator
+ * ary.permutation -> Enumerator
* ary.permutation(n) { |p| block } -> ary
- * ary.permutation(n) -> an_enumerator
+ * ary.permutation(n) -> Enumerator
+ *
+ * When invoked with a block, yield all permutations of length +n+ of the
+ * elements of the array, then return the array itself.
*
- * When invoked with a block, yield all permutations of length <i>n</i>
- * of the elements of <i>ary</i>, then return the array itself.
- * If <i>n</i> is not specified, yield all permutations of all elements.
- * The implementation makes no guarantees about the order in which
- * the permutations are yielded.
+ * If +n+ is not specified, yield all permutations of all elements.
*
- * If no block is given, an enumerator is returned instead.
+ * The implementation makes no guarantees about the order in which the
+ * permutations are yielded.
+ *
+ * If no block is given, an Enumerator is returned instead.
*
* Examples:
*
- * a = [1, 2, 3]
- * a.permutation.to_a #=> [[1,2,3],[1,3,2],[2,1,3],[2,3,1],[3,1,2],[3,2,1]]
- * a.permutation(1).to_a #=> [[1],[2],[3]]
- * a.permutation(2).to_a #=> [[1,2],[1,3],[2,1],[2,3],[3,1],[3,2]]
- * a.permutation(3).to_a #=> [[1,2,3],[1,3,2],[2,1,3],[2,3,1],[3,1,2],[3,2,1]]
- * a.permutation(0).to_a #=> [[]] # one permutation of length 0
- * a.permutation(4).to_a #=> [] # no permutations of length 4
+ * a = [1, 2, 3]
+ * a.permutation.to_a #=> [[1,2,3],[1,3,2],[2,1,3],[2,3,1],[3,1,2],[3,2,1]]
+ * a.permutation(1).to_a #=> [[1],[2],[3]]
+ * a.permutation(2).to_a #=> [[1,2],[1,3],[2,1],[2,3],[3,1],[3,2]]
+ * a.permutation(3).to_a #=> [[1,2,3],[1,3,2],[2,1,3],[2,3,1],[3,1,2],[3,2,1]]
+ * a.permutation(0).to_a #=> [[]] # one permutation of length 0
+ * a.permutation(4).to_a #=> [] # no permutations of length 4
*/
static VALUE
@@ -4159,7 +4799,7 @@ rb_ary_permutation(int argc, VALUE *argv, VALUE ary)
long r, n, i;
n = RARRAY_LEN(ary); /* Array length */
- RETURN_ENUMERATOR(ary, argc, argv); /* Return enumerator if no block */
+ RETURN_SIZED_ENUMERATOR(ary, argc, argv, rb_ary_permutation_size); /* Return enumerator if no block */
rb_scan_args(argc, argv, "01", &num);
r = NIL_P(num) ? n : NUM2LONG(num); /* Permutation size from argument */
@@ -4171,7 +4811,7 @@ 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 */
@@ -4180,29 +4820,39 @@ rb_ary_permutation(int argc, VALUE *argv, VALUE ary)
volatile VALUE t1 = tmpbuf(n,sizeof(char));
char *used = (char*)RSTRING_PTR(t1);
VALUE ary0 = ary_make_shared_copy(ary); /* private defensive copy of ary */
- RBASIC(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;
+ RBASIC_SET_CLASS_RAW(ary0, rb_cArray);
}
return ary;
}
+static VALUE
+rb_ary_combination_size(VALUE ary, VALUE args, VALUE eobj)
+{
+ long n = RARRAY_LEN(ary);
+ long k = NUM2LONG(RARRAY_AREF(args, 0));
+
+ return binomial_coefficient(k, n);
+}
+
/*
* call-seq:
* ary.combination(n) { |c| block } -> ary
- * ary.combination(n) -> an_enumerator
+ * ary.combination(n) -> Enumerator
*
- * When invoked with a block, yields all combinations of length <i>n</i>
- * of elements from <i>ary</i> and then returns <i>ary</i> itself.
- * The implementation makes no guarantees about the order in which
- * the combinations are yielded.
+ * When invoked with a block, yields all combinations of length +n+ of elements
+ * from the array and then returns the array itself.
*
- * If no block is given, an enumerator is returned instead.
+ * The implementation makes no guarantees about the order in which the
+ * combinations are yielded.
+ *
+ * If no block is given, an Enumerator is returned instead.
*
* Examples:
*
@@ -4222,7 +4872,7 @@ rb_ary_combination(VALUE ary, VALUE num)
long n, i, len;
n = NUM2LONG(num);
- RETURN_ENUMERATOR(ary, 1, &num);
+ RETURN_SIZED_ENUMERATOR(ary, 1, &num, rb_ary_combination_size);
len = RARRAY_LEN(ary);
if (n < 0 || len < n) {
/* yield nothing */
@@ -4232,7 +4882,7 @@ 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 {
@@ -4245,9 +4895,9 @@ rb_ary_combination(VALUE ary, VALUE num)
MEMZERO(stack, long, n);
stack[0] = -1;
for (;;) {
- chosen[lev] = RARRAY_PTR(ary)[stack[lev+1]];
+ chosen[lev] = RARRAY_AREF(ary, stack[lev+1]);
for (lev++; lev < n; lev++) {
- chosen[lev] = RARRAY_PTR(ary)[stack[lev+1] = stack[lev]+1];
+ chosen[lev] = RARRAY_AREF(ary, stack[lev+1] = stack[lev]+1);
}
rb_yield(rb_ary_new4(n, chosen));
if (RBASIC(t0)->klass) {
@@ -4266,8 +4916,9 @@ rb_ary_combination(VALUE ary, VALUE num)
}
/*
- * Recursively compute repeated permutations of r elements of the set
- * [0..n-1].
+ * Recursively compute repeated permutations of +r+ elements of the set
+ * <code>[0..n-1]</code>.
+ *
* When we have a complete repeated permutation of array indexes, copy the
* values at those indexes into a new array and yield that array.
*
@@ -4304,17 +4955,33 @@ rpermute0(long n, long r, long *p, long index, VALUE values)
}
}
+static VALUE
+rb_ary_repeated_permutation_size(VALUE ary, VALUE args, VALUE eobj)
+{
+ long n = RARRAY_LEN(ary);
+ long k = NUM2LONG(RARRAY_AREF(args, 0));
+ VALUE v;
+
+ if (k < 0) {
+ return LONG2FIX(0);
+ }
+
+ v = LONG2NUM(k);
+ return rb_funcallv(LONG2NUM(n), id_power, 1, &v);
+}
+
/*
* call-seq:
* ary.repeated_permutation(n) { |p| block } -> ary
- * ary.repeated_permutation(n) -> an_enumerator
+ * ary.repeated_permutation(n) -> Enumerator
+ *
+ * When invoked with a block, yield all repeated permutations of length +n+ of
+ * the elements of the array, then return the array itself.
*
- * When invoked with a block, yield all repeated permutations of length
- * <i>n</i> of the elements of <i>ary</i>, then return the array itself.
- * The implementation makes no guarantees about the order in which
- * the repeated permutations are yielded.
+ * The implementation makes no guarantees about the order in which the repeated
+ * permutations are yielded.
*
- * If no block is given, an enumerator is returned instead.
+ * If no block is given, an Enumerator is returned instead.
*
* Examples:
*
@@ -4332,7 +4999,7 @@ rb_ary_repeated_permutation(VALUE ary, VALUE num)
long r, n, i;
n = RARRAY_LEN(ary); /* Array length */
- RETURN_ENUMERATOR(ary, 1, &num); /* Return enumerator if no block */
+ RETURN_SIZED_ENUMERATOR(ary, 1, &num, rb_ary_repeated_permutation_size); /* Return Enumerator if no block */
r = NUM2LONG(num); /* Permutation size from argument */
if (r < 0) {
@@ -4343,18 +5010,18 @@ 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);
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;
+ RBASIC_SET_CLASS_RAW(ary0, rb_cArray);
}
return ary;
}
@@ -4383,30 +5050,41 @@ rcombinate0(long n, long r, long *p, long index, long rest, VALUE values)
}
}
+static VALUE
+rb_ary_repeated_combination_size(VALUE ary, VALUE args, VALUE eobj)
+{
+ long n = RARRAY_LEN(ary);
+ long k = NUM2LONG(RARRAY_AREF(args, 0));
+ if (k == 0) {
+ return LONG2FIX(1);
+ }
+ return binomial_coefficient(k, n + k - 1);
+}
+
/*
* call-seq:
* ary.repeated_combination(n) { |c| block } -> ary
- * ary.repeated_combination(n) -> an_enumerator
+ * ary.repeated_combination(n) -> Enumerator
*
- * When invoked with a block, yields all repeated combinations of
- * length <i>n</i> of elements from <i>ary</i> and then returns
- * <i>ary</i> itself.
- * The implementation makes no guarantees about the order in which
- * the repeated combinations are yielded.
+ * When invoked with a block, yields all repeated combinations of length +n+ of
+ * elements from the array and then returns the array itself.
*
- * If no block is given, an enumerator is returned instead.
+ * The implementation makes no guarantees about the order in which the repeated
+ * combinations are yielded.
+ *
+ * If no block is given, an Enumerator is returned instead.
*
* Examples:
*
- * a = [1, 2, 3]
- * a.repeated_combination(1).to_a #=> [[1], [2], [3]]
- * a.repeated_combination(2).to_a #=> [[1,1],[1,2],[1,3],[2,2],[2,3],[3,3]]
- * a.repeated_combination(3).to_a #=> [[1,1,1],[1,1,2],[1,1,3],[1,2,2],[1,2,3],
- * # [1,3,3],[2,2,2],[2,2,3],[2,3,3],[3,3,3]]
- * a.repeated_combination(4).to_a #=> [[1,1,1,1],[1,1,1,2],[1,1,1,3],[1,1,2,2],[1,1,2,3],
- * # [1,1,3,3],[1,2,2,2],[1,2,2,3],[1,2,3,3],[1,3,3,3],
- * # [2,2,2,2],[2,2,2,3],[2,2,3,3],[2,3,3,3],[3,3,3,3]]
- * a.repeated_combination(0).to_a #=> [[]] # one combination of length 0
+ * a = [1, 2, 3]
+ * a.repeated_combination(1).to_a #=> [[1], [2], [3]]
+ * a.repeated_combination(2).to_a #=> [[1,1],[1,2],[1,3],[2,2],[2,3],[3,3]]
+ * a.repeated_combination(3).to_a #=> [[1,1,1],[1,1,2],[1,1,3],[1,2,2],[1,2,3],
+ * # [1,3,3],[2,2,2],[2,2,3],[2,3,3],[3,3,3]]
+ * a.repeated_combination(4).to_a #=> [[1,1,1,1],[1,1,1,2],[1,1,1,3],[1,1,2,2],[1,1,2,3],
+ * # [1,1,3,3],[1,2,2,2],[1,2,2,3],[1,2,3,3],[1,3,3,3],
+ * # [2,2,2,2],[2,2,2,3],[2,2,3,3],[2,3,3,3],[3,3,3,3]]
+ * a.repeated_combination(0).to_a #=> [[]] # one combination of length 0
*
*/
@@ -4416,7 +5094,7 @@ rb_ary_repeated_combination(VALUE ary, VALUE num)
long n, i, len;
n = NUM2LONG(num); /* Combination size from argument */
- RETURN_ENUMERATOR(ary, 1, &num); /* Return enumerator if no block */
+ RETURN_SIZED_ENUMERATOR(ary, 1, &num, rb_ary_repeated_combination_size); /* Return enumerator if no block */
len = RARRAY_LEN(ary);
if (n < 0) {
/* yield nothing */
@@ -4426,7 +5104,7 @@ 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) {
@@ -4436,11 +5114,11 @@ rb_ary_repeated_combination(VALUE ary, VALUE num)
volatile VALUE t0 = tmpbuf(n, sizeof(long));
long *p = (long*)RSTRING_PTR(t0);
VALUE ary0 = ary_make_shared_copy(ary); /* private defensive copy of ary */
- RBASIC(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;
+ RBASIC_SET_CLASS_RAW(ary0, rb_cArray);
}
return ary;
}
@@ -4451,11 +5129,12 @@ rb_ary_repeated_combination(VALUE ary, VALUE num)
* ary.product(other_ary, ...) { |p| block } -> ary
*
* Returns an array of all combinations of elements from all arrays.
- * The length of the returned array is the product of the length
- * of +self+ and the argument arrays.
- * If given a block, <i>product</i> will yield all combinations
- * and return +self+ instead.
*
+ * The length of the returned array is the product of the length of +self+ and
+ * the argument arrays.
+ *
+ * If given a block, #product will yield all combinations and return +self+
+ * instead.
*
* [1,2,3].product([4,5]) #=> [[1,4],[1,5],[2,4],[2,5],[3,4],[3,5]]
* [1,2].product([1,2]) #=> [[1,1],[1,2],[2,1],[2,2]]
@@ -4477,8 +5156,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);
@@ -4500,15 +5179,14 @@ rb_ary_product(int argc, VALUE *argv, VALUE ary)
else {
/* Compute the length of the result array; return [] if any is empty */
for (i = 0; i < n; i++) {
- long k = RARRAY_LEN(arrays[i]), l = resultlen;
+ long k = RARRAY_LEN(arrays[i]);
if (k == 0) {
result = rb_ary_new2(0);
goto done;
}
- resultlen *= k;
- if (resultlen < k || resultlen < l || resultlen / k != l) {
+ if (MUL_OVERFLOW_LONG_P(resultlen, k))
rb_raise(rb_eRangeError, "too big to product");
- }
+ resultlen *= k;
}
result = rb_ary_new2(resultlen);
}
@@ -4521,7 +5199,7 @@ rb_ary_product(int argc, VALUE *argv, VALUE ary)
}
/* put it on the result array */
- if(NIL_P(result)) {
+ if (NIL_P(result)) {
FL_SET(t0, FL_USER5);
rb_yield(subarray);
if (! FL_TEST(t0, FL_USER5)) {
@@ -4559,7 +5237,11 @@ done:
* call-seq:
* ary.take(n) -> new_ary
*
- * Returns first n elements from <i>ary</i>.
+ * Returns first +n+ elements from the array.
+ *
+ * If a negative number is given, raises an ArgumentError.
+ *
+ * See also Array#drop
*
* a = [1, 2, 3, 4, 5, 0]
* a.take(3) #=> [1, 2, 3]
@@ -4578,16 +5260,18 @@ rb_ary_take(VALUE obj, VALUE n)
/*
* call-seq:
- * ary.take_while {|arr| block } -> new_ary
- * ary.take_while -> an_enumerator
+ * ary.take_while { |arr| block } -> new_ary
+ * ary.take_while -> Enumerator
+ *
+ * Passes elements to the block until the block returns +nil+ or +false+, then
+ * stops iterating and returns an array of all prior elements.
*
- * Passes elements to the block until the block returns +nil+ or +false+,
- * then stops iterating and returns an array of all prior elements.
+ * If no block is given, an Enumerator is returned instead.
*
- * If no block is given, an enumerator is returned instead.
+ * See also Array#drop_while
*
* a = [1, 2, 3, 4, 5, 0]
- * a.take_while {|i| i < 3 } #=> [1, 2]
+ * a.take_while { |i| i < 3 } #=> [1, 2]
*
*/
@@ -4598,7 +5282,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));
}
@@ -4607,8 +5291,12 @@ rb_ary_take_while(VALUE ary)
* call-seq:
* ary.drop(n) -> new_ary
*
- * Drops first n elements from +ary+ and returns the rest of
- * the elements in an array.
+ * Drops first +n+ elements from +ary+ and returns the rest of the elements in
+ * an array.
+ *
+ * If a negative number is given, raises an ArgumentError.
+ *
+ * See also Array#take
*
* a = [1, 2, 3, 4, 5, 0]
* a.drop(3) #=> [4, 5, 0]
@@ -4631,14 +5319,16 @@ rb_ary_drop(VALUE ary, VALUE n)
/*
* call-seq:
- * ary.drop_while {|arr| block } -> new_ary
- * ary.drop_while -> an_enumerator
+ * ary.drop_while { |arr| block } -> new_ary
+ * ary.drop_while -> Enumerator
*
- * Drops elements up to, but not including, the first element for
- * which the block returns +nil+ or +false+ and returns an array
- * containing the remaining elements.
+ * Drops elements up to, but not including, the first element for which the
+ * block returns +nil+ or +false+ and returns an array containing the
+ * remaining elements.
*
- * If no block is given, an enumerator is returned instead.
+ * If no block is given, an Enumerator is returned instead.
+ *
+ * See also Array#take_while
*
* a = [1, 2, 3, 4, 5, 0]
* a.drop_while {|i| i < 3 } #=> [3, 4, 5, 0]
@@ -4652,18 +5342,246 @@ 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));
}
-
-
-/* Arrays are ordered, integer-indexed collections of any object.
- * Array indexing starts at 0, as in C or Java. A negative index is
- * assumed to be relative to the end of the array---that is, an index of -1
- * indicates the last element of the array, -2 is the next to last
- * element in the array, and so on.
+/*
+ * Arrays are ordered, integer-indexed collections of any object.
+ *
+ * Array indexing starts at 0, as in C or Java. A negative index is assumed
+ * to be relative to the end of the array---that is, an index of -1 indicates
+ * the last element of the array, -2 is the next to last element in the
+ * array, and so on.
+ *
+ * == Creating Arrays
+ *
+ * A new array can be created by using the literal constructor
+ * <code>[]</code>. Arrays can contain different types of objects. For
+ * example, the array below contains an Integer, a String and a Float:
+ *
+ * ary = [1, "two", 3.0] #=> [1, "two", 3.0]
+ *
+ * An array can also be created by explicitly calling Array.new with zero, one
+ * (the initial size of the Array) or two arguments (the initial size and a
+ * default object).
+ *
+ * ary = Array.new #=> []
+ * Array.new(3) #=> [nil, nil, nil]
+ * Array.new(3, true) #=> [true, true, true]
+ *
+ * Note that the second argument populates the array with references to the
+ * same object. Therefore, it is only recommended in cases when you need to
+ * instantiate arrays with natively immutable objects such as Symbols,
+ * numbers, true or false.
+ *
+ * To create an array with separate objects a block can be passed instead.
+ * This method is safe to use with mutable objects such as hashes, strings or
+ * other arrays:
+ *
+ * Array.new(4) { Hash.new } #=> [{}, {}, {}, {}]
+ *
+ * This is also a quick way to build up multi-dimensional arrays:
+ *
+ * empty_table = Array.new(3) { Array.new(3) }
+ * #=> [[nil, nil, nil], [nil, nil, nil], [nil, nil, nil]]
+ *
+ * An array can also be created by using the Array() method, provided by
+ * Kernel, which tries to call #to_ary, then #to_a on its argument.
+ *
+ * Array({:a => "a", :b => "b"}) #=> [[:a, "a"], [:b, "b"]]
+ *
+ * == Example Usage
+ *
+ * In addition to the methods it mixes in through the Enumerable module, the
+ * Array class has proprietary methods for accessing, searching and otherwise
+ * manipulating arrays.
+ *
+ * Some of the more common ones are illustrated below.
+ *
+ * == Accessing Elements
+ *
+ * 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. Negative indices start counting from the end,
+ * with -1 being the last element.
+ *
+ * arr = [1, 2, 3, 4, 5, 6]
+ * arr[2] #=> 3
+ * arr[100] #=> nil
+ * 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
+ *
+ * arr.at(0) #=> 1
+ *
+ * The #slice method works in an identical manner to Array#[].
+ *
+ * To raise an error for indices outside of the array bounds or else to
+ * provide a default value when that happens, you can use #fetch.
+ *
+ * arr = ['a', 'b', 'c', 'd', 'e', 'f']
+ * arr.fetch(100) #=> IndexError: index 100 outside of array bounds: -6...6
+ * arr.fetch(100, "oops") #=> "oops"
+ *
+ * The special methods #first and #last will return the first and last
+ * elements of an array, respectively.
+ *
+ * arr.first #=> 1
+ * arr.last #=> 6
+ *
+ * To return the first +n+ elements of an array, use #take
+ *
+ * arr.take(3) #=> [1, 2, 3]
+ *
+ * #drop does the opposite of #take, by returning the elements after +n+
+ * elements have been dropped:
+ *
+ * arr.drop(3) #=> [4, 5, 6]
+ *
+ * == Obtaining Information about an Array
+ *
+ * Arrays keep track of their own length at all times. To query an array
+ * about the number of elements it contains, use #length, #count or #size.
+ *
+ * browsers = ['Chrome', 'Firefox', 'Safari', 'Opera', 'IE']
+ * browsers.length #=> 5
+ * browsers.count #=> 5
+ *
+ * To check whether an array contains any elements at all
+ *
+ * browsers.empty? #=> false
+ *
+ * To check whether a particular item is included in the array
+ *
+ * browsers.include?('Konqueror') #=> false
+ *
+ * == Adding Items to Arrays
+ *
+ * Items can be added to the end of an array by using either #push or #<<
+ *
+ * arr = [1, 2, 3, 4]
+ * arr.push(5) #=> [1, 2, 3, 4, 5]
+ * arr << 6 #=> [1, 2, 3, 4, 5, 6]
+ *
+ * #unshift will add a new item to the beginning of an array.
+ *
+ * arr.unshift(0) #=> [0, 1, 2, 3, 4, 5, 6]
+ *
+ * With #insert you can add a new element to an array at any position.
+ *
+ * arr.insert(3, 'apple') #=> [0, 1, 2, 'apple', 3, 4, 5, 6]
+ *
+ * Using the #insert method, you can also insert multiple values at once:
+ *
+ * arr.insert(3, 'orange', 'pear', 'grapefruit')
+ * #=> [0, 1, 2, "orange", "pear", "grapefruit", "apple", 3, 4, 5, 6]
+ *
+ * == Removing Items from an Array
+ *
+ * The method #pop removes the last element in an array and returns it:
+ *
+ * arr = [1, 2, 3, 4, 5, 6]
+ * arr.pop #=> 6
+ * arr #=> [1, 2, 3, 4, 5]
+ *
+ * To retrieve and at the same time remove the first item, use #shift:
+ *
+ * arr.shift #=> 1
+ * arr #=> [2, 3, 4, 5]
+ *
+ * To delete an element at a particular index:
+ *
+ * arr.delete_at(2) #=> 4
+ * arr #=> [2, 3, 5]
+ *
+ * To delete a particular element anywhere in an array, use #delete:
+ *
+ * arr = [1, 2, 2, 3]
+ * arr.delete(2) #=> 2
+ * arr #=> [1,3]
+ *
+ * A useful method if you need to remove +nil+ values from an array is
+ * #compact:
+ *
+ * arr = ['foo', 0, nil, 'bar', 7, 'baz', nil]
+ * arr.compact #=> ['foo', 0, 'bar', 7, 'baz']
+ * arr #=> ['foo', 0, nil, 'bar', 7, 'baz', nil]
+ * arr.compact! #=> ['foo', 0, 'bar', 7, 'baz']
+ * arr #=> ['foo', 0, 'bar', 7, 'baz']
+ *
+ * Another common need is to remove duplicate elements from an array.
+ *
+ * It has the non-destructive #uniq, and destructive method #uniq!
+ *
+ * arr = [2, 5, 6, 556, 6, 6, 8, 9, 0, 123, 556]
+ * arr.uniq #=> [2, 5, 6, 556, 8, 9, 0, 123]
+ *
+ * == Iterating over Arrays
+ *
+ * Like all classes that include the Enumerable module, Array has an each
+ * method, which defines what elements should be iterated over and how. In
+ * case of Array's #each, all elements in the Array instance are yielded to
+ * the supplied block in sequence.
+ *
+ * Note that this operation leaves the array unchanged.
+ *
+ * arr = [1, 2, 3, 4, 5]
+ * arr.each { |a| print a -= 10, " " }
+ * # prints: -9 -8 -7 -6 -5
+ * #=> [1, 2, 3, 4, 5]
+ *
+ * Another sometimes useful iterator is #reverse_each which will iterate over
+ * the elements in the array in reverse order.
+ *
+ * words = %w[first second third fourth fifth sixth]
+ * str = ""
+ * 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:
+ *
+ * arr.map { |a| 2*a } #=> [2, 4, 6, 8, 10]
+ * arr #=> [1, 2, 3, 4, 5]
+ * arr.map! { |a| a**2 } #=> [1, 4, 9, 16, 25]
+ * arr #=> [1, 4, 9, 16, 25]
+ *
+ * == Selecting Items from an Array
+ *
+ * Elements can be selected from an array according to criteria defined in a
+ * block. The selection can happen in a destructive or a non-destructive
+ * manner. While the destructive operations will modify the array they were
+ * called on, the non-destructive methods usually return a new array with the
+ * selected elements, but leave the original array unchanged.
+ *
+ * === Non-destructive Selection
+ *
+ * arr = [1, 2, 3, 4, 5, 6]
+ * arr.select { |a| a > 3 } #=> [4, 5, 6]
+ * arr.reject { |a| a < 3 } #=> [3, 4, 5, 6]
+ * arr.drop_while { |a| a < 4 } #=> [4, 5, 6]
+ * arr #=> [1, 2, 3, 4, 5, 6]
+ *
+ * === Destructive Selection
+ *
+ * #select! and #reject! are the corresponding destructive methods to #select
+ * and #reject
+ *
+ * Similar to #select vs. #reject, #delete_if and #keep_if have the exact
+ * opposite result when supplied with the same block:
+ *
+ * arr.delete_if { |a| a < 4 } #=> [4, 5, 6]
+ * arr #=> [4, 5, 6]
+ *
+ * arr = [1, 2, 3, 4, 5, 6]
+ * arr.keep_if { |a| a < 4 } #=> [1, 2, 3]
+ * arr #=> [1, 2, 3]
+ *
*/
void
@@ -4675,7 +5593,7 @@ Init_Array(void)
rb_cArray = rb_define_class("Array", rb_cObject);
rb_include_module(rb_cArray, rb_mEnumerable);
- rb_define_alloc_func(rb_cArray, ary_alloc);
+ rb_define_alloc_func(rb_cArray, empty_ary_alloc);
rb_define_singleton_method(rb_cArray, "[]", rb_ary_s_create, -1);
rb_define_singleton_method(rb_cArray, "try_convert", rb_ary_s_try_convert, 1);
rb_define_method(rb_cArray, "initialize", rb_ary_initialize, -1);
@@ -4684,6 +5602,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);
@@ -4776,7 +5695,10 @@ Init_Array(void)
rb_define_method(rb_cArray, "take_while", rb_ary_take_while, 0);
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);
id_cmp = rb_intern("<=>");
sym_random = ID2SYM(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..807349089f
--- /dev/null
+++ b/benchmark/bm_app_aobench.rb
@@ -0,0 +1,292 @@
+# AO rebder benchmark
+# Original program (C) Syoyo Fujita in Javascript (and other languages)
+# http://lucille.atso-net.jp/blog/?p=642
+# http://lucille.atso-net.jp/blog/?p=711
+# 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_mandelbrot.rb b/benchmark/bm_app_mandelbrot.rb
index 89069db7ab..801b75e8e2 100644
--- a/benchmark/bm_app_mandelbrot.rb
+++ b/benchmark/bm_app_mandelbrot.rb
@@ -3,7 +3,7 @@ require 'complex'
def mandelbrot? z
i = 0
while i<100
- i+=1
+ i += 1
z = z * z
return false if z.abs > 2
end
diff --git a/benchmark/bm_app_raise.rb b/benchmark/bm_app_raise.rb
index 01d2ae3219..5db8f95d50 100644
--- a/benchmark/bm_app_raise.rb
+++ b/benchmark/bm_app_raise.rb
@@ -1,6 +1,6 @@
-i=0
+i = 0
while i<300000
- i+=1
+ i += 1
begin
raise
rescue
diff --git a/benchmark/bm_app_strconcat.rb b/benchmark/bm_app_strconcat.rb
index 7b2f2da5a7..7eed7c1aed 100644
--- a/benchmark/bm_app_strconcat.rb
+++ b/benchmark/bm_app_strconcat.rb
@@ -1,5 +1,5 @@
-i=0
+i = 0
while i<2_000_000
"#{1+1} #{1+1} #{1+1}"
- i+=1
+ i += 1
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_io_select2.rb b/benchmark/bm_io_select2.rb
index 7b167af774..10e37d71b2 100644
--- a/benchmark/bm_io_select2.rb
+++ b/benchmark/bm_io_select2.rb
@@ -2,7 +2,11 @@
ios = []
nr = 1000000
-max = Process.getrlimit(Process::RLIMIT_NOFILE)[0]
+if defined?(Process::RLIMIT_NOFILE)
+ max = Process.getrlimit(Process::RLIMIT_NOFILE)[0]
+else
+ max = 64
+end
puts "max fd: #{max} (results not apparent with <= 1024 max fd)"
((max / 2) - 10).times do
diff --git a/benchmark/bm_io_select3.rb b/benchmark/bm_io_select3.rb
index fcdbb96e0e..7d0ba1f092 100644
--- a/benchmark/bm_io_select3.rb
+++ b/benchmark/bm_io_select3.rb
@@ -2,7 +2,11 @@
ios = []
nr = 100
-max = Process.getrlimit(Process::RLIMIT_NOFILE)[0]
+if defined?(Process::RLIMIT_NOFILE)
+ max = Process.getrlimit(Process::RLIMIT_NOFILE)[0]
+else
+ max = 64
+end
puts "max fd: #{max} (results not apparent with <= 1024 max fd)"
(max - 10).times do
diff --git a/benchmark/bm_loop_whileloop.rb b/benchmark/bm_loop_whileloop.rb
index 43d35e1131..0072822c06 100644
--- a/benchmark/bm_loop_whileloop.rb
+++ b/benchmark/bm_loop_whileloop.rb
@@ -1,4 +1,4 @@
-i=0
+i = 0
while i<30_000_000 # benchmark loop 1
- i+=1
+ i += 1
end
diff --git a/benchmark/bm_loop_whileloop2.rb b/benchmark/bm_loop_whileloop2.rb
index e514989661..47d02dffc4 100644
--- a/benchmark/bm_loop_whileloop2.rb
+++ b/benchmark/bm_loop_whileloop2.rb
@@ -1,4 +1,4 @@
-i=0
+i = 0
while i< 6_000_000 # benchmark loop 2
- i+=1
+ i += 1
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_concatenate.rb b/benchmark/bm_so_concatenate.rb
index 56b9410632..873214de7c 100644
--- a/benchmark/bm_so_concatenate.rb
+++ b/benchmark/bm_so_concatenate.rb
@@ -5,9 +5,9 @@
# based on code from Aristarkh A Zagorodnikov and Dat Nguyen
STUFF = "hello\n"
-i=0
+i = 0
while i<10
- i+=1
+ i += 1
hello = ''
4_000_000.times do |e|
hello << STUFF
diff --git a/benchmark/bm_so_exception.rb b/benchmark/bm_so_exception.rb
index d8b461290c..deb003a594 100644
--- a/benchmark/bm_so_exception.rb
+++ b/benchmark/bm_so_exception.rb
@@ -56,6 +56,6 @@ end
i = 1
max = NUM+1
while i < max
- i+=1
+ i += 1
some_function(i+1)
end
diff --git a/benchmark/bm_so_lists.rb b/benchmark/bm_so_lists.rb
index f8d26797aa..e8f4a2a5f7 100644
--- a/benchmark/bm_so_lists.rb
+++ b/benchmark/bm_so_lists.rb
@@ -40,7 +40,7 @@ end
i = 0
while i<NUM
- i+=1
+ i += 1
result = test_lists()
end
diff --git a/benchmark/bm_so_nsieve_bits.rb b/benchmark/bm_so_nsieve_bits.rb
index 019b8b6382..6f958ee44e 100644
--- a/benchmark/bm_so_nsieve_bits.rb
+++ b/benchmark/bm_so_nsieve_bits.rb
@@ -1,4 +1,5 @@
#!/usr/bin/ruby
+#coding: us-ascii
#
# The Great Computer Language Shootout
# http://shootout.alioth.debian.org/
diff --git a/benchmark/bm_so_random.rb b/benchmark/bm_so_random.rb
index 57f700b863..a66b9e8e63 100644
--- a/benchmark/bm_so_random.rb
+++ b/benchmark/bm_so_random.rb
@@ -12,9 +12,9 @@ end
N = 3_000_000
-i=0
+i = 0
while i<N
- i+=1
+ i +=1
gen_random(100.0)
end
# "%.9f" % gen_random(100.0)
diff --git a/benchmark/bm_so_sieve.rb b/benchmark/bm_so_sieve.rb
index 3f1b138bd1..43dc302648 100644
--- a/benchmark/bm_so_sieve.rb
+++ b/benchmark/bm_so_sieve.rb
@@ -4,12 +4,12 @@ count = i = j = 0
flags0 = Array.new(8192,1)
k = 0
while k < num
- k+=1
+ k += 1
count = 0
flags = flags0.dup
i = 2
while i<8192
- i+=1
+ i += 1
if flags[i]
# remove all multiples of prime: i
j = i*i
diff --git a/benchmark/bm_vm1_attr_ivar.rb b/benchmark/bm_vm1_attr_ivar.rb
new file mode 100644
index 0000000000..16906f3605
--- /dev/null
+++ b/benchmark/bm_vm1_attr_ivar.rb
@@ -0,0 +1,14 @@
+class C
+ attr_reader :a, :b
+ def initialize
+ @a = nil
+ @b = nil
+ end
+end
+obj = C.new
+i = 0
+while i<30_000_000 # while loop 1
+ i += 1
+ j = obj.a
+ k = obj.b
+end
diff --git a/benchmark/bm_vm1_attr_ivar_set.rb b/benchmark/bm_vm1_attr_ivar_set.rb
new file mode 100644
index 0000000000..7e7a6b48c0
--- /dev/null
+++ b/benchmark/bm_vm1_attr_ivar_set.rb
@@ -0,0 +1,14 @@
+class C
+ attr_accessor :a, :b
+ def initialize
+ @a = nil
+ @b = nil
+ end
+end
+obj = C.new
+i = 0
+while i<30_000_000 # while loop 1
+ i += 1
+ obj.a = 1
+ obj.b = 2
+end
diff --git a/benchmark/bm_vm1_block.rb b/benchmark/bm_vm1_block.rb
index 0a97883974..a9f56b15ea 100644
--- a/benchmark/bm_vm1_block.rb
+++ b/benchmark/bm_vm1_block.rb
@@ -2,9 +2,9 @@ def m
yield
end
-i=0
+i = 0
while i<30_000_000 # while loop 1
- i+=1
+ i += 1
m{
}
end
diff --git a/benchmark/bm_vm1_const.rb b/benchmark/bm_vm1_const.rb
index 066916dc31..ac59ebccf1 100644
--- a/benchmark/bm_vm1_const.rb
+++ b/benchmark/bm_vm1_const.rb
@@ -2,7 +2,7 @@ Const = 1
i = 0
while i<30_000_000 # while loop 1
- i+= 1
+ i += 1
j = Const
k = Const
end
diff --git a/benchmark/bm_vm1_ensure.rb b/benchmark/bm_vm1_ensure.rb
index b1948f7621..a1596145f2 100644
--- a/benchmark/bm_vm1_ensure.rb
+++ b/benchmark/bm_vm1_ensure.rb
@@ -1,6 +1,6 @@
-i=0
+i = 0
while i<30_000_000 # benchmark loop 1
- i+=1
+ i += 1
begin
begin
ensure
diff --git a/benchmark/bm_vm1_float_simple.rb b/benchmark/bm_vm1_float_simple.rb
new file mode 100644
index 0000000000..d4581439ff
--- /dev/null
+++ b/benchmark/bm_vm1_float_simple.rb
@@ -0,0 +1,7 @@
+i = 0.0; f = 0.0
+while i<30_000_000
+ i += 1
+ f += 0.1; f -= 0.1
+ f += 0.1; f -= 0.1
+ f += 0.1; f -= 0.1
+end
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_vm1_ivar.rb b/benchmark/bm_vm1_ivar.rb
index 3ba56427f4..68a73cf92f 100644
--- a/benchmark/bm_vm1_ivar.rb
+++ b/benchmark/bm_vm1_ivar.rb
@@ -2,7 +2,7 @@
i = 0
while i<30_000_000 # while loop 1
- i+= 1
+ i += 1
j = @a
k = @a
end
diff --git a/benchmark/bm_vm1_ivar_set.rb b/benchmark/bm_vm1_ivar_set.rb
index c8076c6ab6..bd81b06c34 100644
--- a/benchmark/bm_vm1_ivar_set.rb
+++ b/benchmark/bm_vm1_ivar_set.rb
@@ -1,6 +1,6 @@
i = 0
while i<30_000_000 # while loop 1
- i+= 1
+ i += 1
@a = 1
@b = 2
end
diff --git a/benchmark/bm_vm1_length.rb b/benchmark/bm_vm1_length.rb
index ccb773278f..353de3ab0e 100644
--- a/benchmark/bm_vm1_length.rb
+++ b/benchmark/bm_vm1_length.rb
@@ -1,8 +1,8 @@
a = 'abc'
b = [1, 2, 3]
-i=0
+i = 0
while i<30_000_000 # while loop 1
- i+=1
+ i += 1
a.length
b.length
end
diff --git a/benchmark/bm_vm1_lvar_init.rb b/benchmark/bm_vm1_lvar_init.rb
new file mode 100644
index 0000000000..36f2068811
--- /dev/null
+++ b/benchmark/bm_vm1_lvar_init.rb
@@ -0,0 +1,18 @@
+def m v
+ unless v
+ # unreachable code
+ v1 = v2 = v3 = v4 = v5 = v6 = v7 = v8 = v9 = v10 =
+ v11 = v12 = v13 = v14 = v15 = v16 = v17 = v18 = v19 = v20 =
+ v21 = v22 = v23 = v24 = v25 = v26 = v27 = v28 = v29 = v30 =
+ v31 = v32 = v33 = v34 = v35 = v36 = v37 = v38 = v39 = v40 =
+ v41 = v42 = v43 = v44 = v45 = v46 = v47 = v48 = v49 = v50 = 1
+ end
+end
+
+i = 0
+
+while i<30_000_000 # while loop 1
+ i += 1
+ m i
+end
+
diff --git a/benchmark/bm_vm1_lvar_set.rb b/benchmark/bm_vm1_lvar_set.rb
new file mode 100644
index 0000000000..222e864134
--- /dev/null
+++ b/benchmark/bm_vm1_lvar_set.rb
@@ -0,0 +1,5 @@
+i = 0
+while i<30_000_000 # while loop 1
+ i += 1
+ a = b = c = d = e = f = g = h = j = k = l = m = n = o = p = q = r = 1
+end
diff --git a/benchmark/bm_vm1_neq.rb b/benchmark/bm_vm1_neq.rb
index 9254a0ca9b..bbb4ae07a4 100644
--- a/benchmark/bm_vm1_neq.rb
+++ b/benchmark/bm_vm1_neq.rb
@@ -3,6 +3,6 @@ obj1 = Object.new
obj2 = Object.new
while i<30_000_000 # while loop 1
- i+= 1
+ i += 1
obj1 != obj2
end
diff --git a/benchmark/bm_vm1_not.rb b/benchmark/bm_vm1_not.rb
index ee9d0f3605..b09ecdcc21 100644
--- a/benchmark/bm_vm1_not.rb
+++ b/benchmark/bm_vm1_not.rb
@@ -2,6 +2,6 @@ i = 0
obj = Object.new
while i<30_000_000 # while loop 1
- i+= 1
+ i += 1
!obj
end
diff --git a/benchmark/bm_vm1_rescue.rb b/benchmark/bm_vm1_rescue.rb
index 3af12bb0f3..b0d3e2bdfa 100644
--- a/benchmark/bm_vm1_rescue.rb
+++ b/benchmark/bm_vm1_rescue.rb
@@ -1,6 +1,6 @@
-i=0
+i = 0
while i<30_000_000 # while loop 1
- i+=1
+ i += 1
begin
rescue
end
diff --git a/benchmark/bm_vm1_simplereturn.rb b/benchmark/bm_vm1_simplereturn.rb
index 8e9bcb0129..63f9f21675 100644
--- a/benchmark/bm_vm1_simplereturn.rb
+++ b/benchmark/bm_vm1_simplereturn.rb
@@ -1,9 +1,9 @@
def m
return 1
end
-i=0
+i = 0
while i<30_000_000 # while loop 1
- i+=1
+ i += 1
m
end
diff --git a/benchmark/bm_vm1_swap.rb b/benchmark/bm_vm1_swap.rb
index 611baf6b99..918f8b2112 100644
--- a/benchmark/bm_vm1_swap.rb
+++ b/benchmark/bm_vm1_swap.rb
@@ -1,8 +1,8 @@
a = 1
b = 2
-i=0
+i = 0
while i<30_000_000 # while loop 1
- i+=1
+ i += 1
a, b = b, a
end
diff --git a/benchmark/bm_vm1_yield.rb b/benchmark/bm_vm1_yield.rb
new file mode 100644
index 0000000000..775597cea6
--- /dev/null
+++ b/benchmark/bm_vm1_yield.rb
@@ -0,0 +1,10 @@
+def m
+ i = 0
+ while i<30_000_000 # while loop 1
+ i += 1
+ yield
+ end
+end
+
+m{}
+
diff --git a/benchmark/bm_vm2_array.rb b/benchmark/bm_vm2_array.rb
index 7713ae9f25..df9037c83c 100644
--- a/benchmark/bm_vm2_array.rb
+++ b/benchmark/bm_vm2_array.rb
@@ -1,5 +1,5 @@
-i=0
+i = 0
while i<6_000_000 # benchmark loop 2
- i+=1
+ i += 1
a = [1,2,3,4,5,6,7,8,9,10]
end
diff --git a/benchmark/bm_vm2_bigarray.rb b/benchmark/bm_vm2_bigarray.rb
new file mode 100644
index 0000000000..b02509d6a2
--- /dev/null
+++ b/benchmark/bm_vm2_bigarray.rb
@@ -0,0 +1,106 @@
+i = 0
+while i<6_000_000 # benchmark loop 2
+ i += 1
+ a = [
+ 1,2,3,4,5,6,7,8,9,10,
+ 1,2,3,4,5,6,7,8,9,10,
+ 1,2,3,4,5,6,7,8,9,10,
+ 1,2,3,4,5,6,7,8,9,10,
+ 1,2,3,4,5,6,7,8,9,10,
+ 1,2,3,4,5,6,7,8,9,10,
+ 1,2,3,4,5,6,7,8,9,10,
+ 1,2,3,4,5,6,7,8,9,10,
+ 1,2,3,4,5,6,7,8,9,10,
+ 1,2,3,4,5,6,7,8,9,10,
+ 1,2,3,4,5,6,7,8,9,10,
+ 1,2,3,4,5,6,7,8,9,10,
+ 1,2,3,4,5,6,7,8,9,10,
+ 1,2,3,4,5,6,7,8,9,10,
+ 1,2,3,4,5,6,7,8,9,10,
+ 1,2,3,4,5,6,7,8,9,10,
+ 1,2,3,4,5,6,7,8,9,10,
+ 1,2,3,4,5,6,7,8,9,10,
+ 1,2,3,4,5,6,7,8,9,10,
+ 1,2,3,4,5,6,7,8,9,10,
+ 1,2,3,4,5,6,7,8,9,10,
+ 1,2,3,4,5,6,7,8,9,10,
+ 1,2,3,4,5,6,7,8,9,10,
+ 1,2,3,4,5,6,7,8,9,10,
+ 1,2,3,4,5,6,7,8,9,10,
+ 1,2,3,4,5,6,7,8,9,10,
+ 1,2,3,4,5,6,7,8,9,10,
+ 1,2,3,4,5,6,7,8,9,10,
+ 1,2,3,4,5,6,7,8,9,10,
+ 1,2,3,4,5,6,7,8,9,10,
+ 1,2,3,4,5,6,7,8,9,10,
+ 1,2,3,4,5,6,7,8,9,10,
+ 1,2,3,4,5,6,7,8,9,10,
+ 1,2,3,4,5,6,7,8,9,10,
+ 1,2,3,4,5,6,7,8,9,10,
+ 1,2,3,4,5,6,7,8,9,10,
+ 1,2,3,4,5,6,7,8,9,10,
+ 1,2,3,4,5,6,7,8,9,10,
+ 1,2,3,4,5,6,7,8,9,10,
+ 1,2,3,4,5,6,7,8,9,10,
+ 1,2,3,4,5,6,7,8,9,10,
+ 1,2,3,4,5,6,7,8,9,10,
+ 1,2,3,4,5,6,7,8,9,10,
+ 1,2,3,4,5,6,7,8,9,10,
+ 1,2,3,4,5,6,7,8,9,10,
+ 1,2,3,4,5,6,7,8,9,10,
+ 1,2,3,4,5,6,7,8,9,10,
+ 1,2,3,4,5,6,7,8,9,10,
+ 1,2,3,4,5,6,7,8,9,10,
+ 1,2,3,4,5,6,7,8,9,10,
+ 1,2,3,4,5,6,7,8,9,10,
+ 1,2,3,4,5,6,7,8,9,10,
+ 1,2,3,4,5,6,7,8,9,10,
+ 1,2,3,4,5,6,7,8,9,10,
+ 1,2,3,4,5,6,7,8,9,10,
+ 1,2,3,4,5,6,7,8,9,10,
+ 1,2,3,4,5,6,7,8,9,10,
+ 1,2,3,4,5,6,7,8,9,10,
+ 1,2,3,4,5,6,7,8,9,10,
+ 1,2,3,4,5,6,7,8,9,10,
+ 1,2,3,4,5,6,7,8,9,10,
+ 1,2,3,4,5,6,7,8,9,10,
+ 1,2,3,4,5,6,7,8,9,10,
+ 1,2,3,4,5,6,7,8,9,10,
+ 1,2,3,4,5,6,7,8,9,10,
+ 1,2,3,4,5,6,7,8,9,10,
+ 1,2,3,4,5,6,7,8,9,10,
+ 1,2,3,4,5,6,7,8,9,10,
+ 1,2,3,4,5,6,7,8,9,10,
+ 1,2,3,4,5,6,7,8,9,10,
+ 1,2,3,4,5,6,7,8,9,10,
+ 1,2,3,4,5,6,7,8,9,10,
+ 1,2,3,4,5,6,7,8,9,10,
+ 1,2,3,4,5,6,7,8,9,10,
+ 1,2,3,4,5,6,7,8,9,10,
+ 1,2,3,4,5,6,7,8,9,10,
+ 1,2,3,4,5,6,7,8,9,10,
+ 1,2,3,4,5,6,7,8,9,10,
+ 1,2,3,4,5,6,7,8,9,10,
+ 1,2,3,4,5,6,7,8,9,10,
+ 1,2,3,4,5,6,7,8,9,10,
+ 1,2,3,4,5,6,7,8,9,10,
+ 1,2,3,4,5,6,7,8,9,10,
+ 1,2,3,4,5,6,7,8,9,10,
+ 1,2,3,4,5,6,7,8,9,10,
+ 1,2,3,4,5,6,7,8,9,10,
+ 1,2,3,4,5,6,7,8,9,10,
+ 1,2,3,4,5,6,7,8,9,10,
+ 1,2,3,4,5,6,7,8,9,10,
+ 1,2,3,4,5,6,7,8,9,10,
+ 1,2,3,4,5,6,7,8,9,10,
+ 1,2,3,4,5,6,7,8,9,10,
+ 1,2,3,4,5,6,7,8,9,10,
+ 1,2,3,4,5,6,7,8,9,10,
+ 1,2,3,4,5,6,7,8,9,10,
+ 1,2,3,4,5,6,7,8,9,10,
+ 1,2,3,4,5,6,7,8,9,10,
+ 1,2,3,4,5,6,7,8,9,10,
+ 1,2,3,4,5,6,7,8,9,10,
+ 1,2,3,4,5,6,7,8,9,10,
+ ]
+end
diff --git a/benchmark/bm_vm2_bighash.rb b/benchmark/bm_vm2_bighash.rb
new file mode 100644
index 0000000000..5e3f437bb8
--- /dev/null
+++ b/benchmark/bm_vm2_bighash.rb
@@ -0,0 +1,5 @@
+i = 0
+while i<60_000 # benchmark loop 2
+ i += 1
+ a = {0=>0, 1=>1, 2=>2, 3=>3, 4=>4, 5=>5, 6=>6, 7=>7, 8=>8, 9=>9, 10=>10, 11=>11, 12=>12, 13=>13, 14=>14, 15=>15, 16=>16, 17=>17, 18=>18, 19=>19, 20=>20, 21=>21, 22=>22, 23=>23, 24=>24, 25=>25, 26=>26, 27=>27, 28=>28, 29=>29, 30=>30, 31=>31, 32=>32, 33=>33, 34=>34, 35=>35, 36=>36, 37=>37, 38=>38, 39=>39, 40=>40, 41=>41, 42=>42, 43=>43, 44=>44, 45=>45, 46=>46, 47=>47, 48=>48, 49=>49, 50=>50, 51=>51, 52=>52, 53=>53, 54=>54, 55=>55, 56=>56, 57=>57, 58=>58, 59=>59, 60=>60, 61=>61, 62=>62, 63=>63, 64=>64, 65=>65, 66=>66, 67=>67, 68=>68, 69=>69, 70=>70, 71=>71, 72=>72, 73=>73, 74=>74, 75=>75, 76=>76, 77=>77, 78=>78, 79=>79, 80=>80, 81=>81, 82=>82, 83=>83, 84=>84, 85=>85, 86=>86, 87=>87, 88=>88, 89=>89, 90=>90, 91=>91, 92=>92, 93=>93, 94=>94, 95=>95, 96=>96, 97=>97, 98=>98, 99=>99, 100=>100, 101=>101, 102=>102, 103=>103, 104=>104, 105=>105, 106=>106, 107=>107, 108=>108, 109=>109, 110=>110, 111=>111, 112=>112, 113=>113, 114=>114, 115=>115, 116=>116, 117=>117, 118=>118, 119=>119, 120=>120, 121=>121, 122=>122, 123=>123, 124=>124, 125=>125, 126=>126, 127=>127, 128=>128, 129=>129, 130=>130, 131=>131, 132=>132, 133=>133, 134=>134, 135=>135, 136=>136, 137=>137, 138=>138, 139=>139, 140=>140, 141=>141, 142=>142, 143=>143, 144=>144, 145=>145, 146=>146, 147=>147, 148=>148, 149=>149, 150=>150, 151=>151, 152=>152, 153=>153, 154=>154, 155=>155, 156=>156, 157=>157, 158=>158, 159=>159, 160=>160, 161=>161, 162=>162, 163=>163, 164=>164, 165=>165, 166=>166, 167=>167, 168=>168, 169=>169, 170=>170, 171=>171, 172=>172, 173=>173, 174=>174, 175=>175, 176=>176, 177=>177, 178=>178, 179=>179, 180=>180, 181=>181, 182=>182, 183=>183, 184=>184, 185=>185, 186=>186, 187=>187, 188=>188, 189=>189, 190=>190, 191=>191, 192=>192, 193=>193, 194=>194, 195=>195, 196=>196, 197=>197, 198=>198, 199=>199, 200=>200, 201=>201, 202=>202, 203=>203, 204=>204, 205=>205, 206=>206, 207=>207, 208=>208, 209=>209, 210=>210, 211=>211, 212=>212, 213=>213, 214=>214, 215=>215, 216=>216, 217=>217, 218=>218, 219=>219, 220=>220, 221=>221, 222=>222, 223=>223, 224=>224, 225=>225, 226=>226, 227=>227, 228=>228, 229=>229, 230=>230, 231=>231, 232=>232, 233=>233, 234=>234, 235=>235, 236=>236, 237=>237, 238=>238, 239=>239, 240=>240, 241=>241, 242=>242, 243=>243, 244=>244, 245=>245, 246=>246, 247=>247, 248=>248, 249=>249, 250=>250, 251=>251, 252=>252, 253=>253, 254=>254, 255=>255, 256=>256, 257=>257, 258=>258, 259=>259, 260=>260, 261=>261, 262=>262, 263=>263, 264=>264, 265=>265, 266=>266, 267=>267, 268=>268, 269=>269, 270=>270, 271=>271, 272=>272, 273=>273, 274=>274, 275=>275, 276=>276, 277=>277, 278=>278, 279=>279, 280=>280, 281=>281, 282=>282, 283=>283, 284=>284, 285=>285, 286=>286, 287=>287, 288=>288, 289=>289, 290=>290, 291=>291, 292=>292, 293=>293, 294=>294, 295=>295, 296=>296, 297=>297, 298=>298, 299=>299, 300=>300, 301=>301, 302=>302, 303=>303, 304=>304, 305=>305, 306=>306, 307=>307, 308=>308, 309=>309, 310=>310, 311=>311, 312=>312, 313=>313, 314=>314, 315=>315, 316=>316, 317=>317, 318=>318, 319=>319, 320=>320, 321=>321, 322=>322, 323=>323, 324=>324, 325=>325, 326=>326, 327=>327, 328=>328, 329=>329, 330=>330, 331=>331, 332=>332, 333=>333, 334=>334, 335=>335, 336=>336, 337=>337, 338=>338, 339=>339, 340=>340, 341=>341, 342=>342, 343=>343, 344=>344, 345=>345, 346=>346, 347=>347, 348=>348, 349=>349, 350=>350, 351=>351, 352=>352, 353=>353, 354=>354, 355=>355, 356=>356, 357=>357, 358=>358, 359=>359, 360=>360, 361=>361, 362=>362, 363=>363, 364=>364, 365=>365, 366=>366, 367=>367, 368=>368, 369=>369, 370=>370, 371=>371, 372=>372, 373=>373, 374=>374, 375=>375, 376=>376, 377=>377, 378=>378, 379=>379, 380=>380, 381=>381, 382=>382, 383=>383, 384=>384, 385=>385, 386=>386, 387=>387, 388=>388, 389=>389, 390=>390, 391=>391, 392=>392, 393=>393, 394=>394, 395=>395, 396=>396, 397=>397, 398=>398, 399=>399, 400=>400, 401=>401, 402=>402, 403=>403, 404=>404, 405=>405, 406=>406, 407=>407, 408=>408, 409=>409, 410=>410, 411=>411, 412=>412, 413=>413, 414=>414, 415=>415, 416=>416, 417=>417, 418=>418, 419=>419, 420=>420, 421=>421, 422=>422, 423=>423, 424=>424, 425=>425, 426=>426, 427=>427, 428=>428, 429=>429, 430=>430, 431=>431, 432=>432, 433=>433, 434=>434, 435=>435, 436=>436, 437=>437, 438=>438, 439=>439, 440=>440, 441=>441, 442=>442, 443=>443, 444=>444, 445=>445, 446=>446, 447=>447, 448=>448, 449=>449, 450=>450, 451=>451, 452=>452, 453=>453, 454=>454, 455=>455, 456=>456, 457=>457, 458=>458, 459=>459, 460=>460, 461=>461, 462=>462, 463=>463, 464=>464, 465=>465, 466=>466, 467=>467, 468=>468, 469=>469, 470=>470, 471=>471, 472=>472, 473=>473, 474=>474, 475=>475, 476=>476, 477=>477, 478=>478, 479=>479, 480=>480, 481=>481, 482=>482, 483=>483, 484=>484, 485=>485, 486=>486, 487=>487, 488=>488, 489=>489, 490=>490, 491=>491, 492=>492, 493=>493, 494=>494, 495=>495, 496=>496, 497=>497, 498=>498, 499=>499, 500=>500,}
+end
diff --git a/benchmark/bm_vm2_case.rb b/benchmark/bm_vm2_case.rb
index cd09788a85..adc6e4df0a 100644
--- a/benchmark/bm_vm2_case.rb
+++ b/benchmark/bm_vm2_case.rb
@@ -1,4 +1,4 @@
-i=0
+i = 0
while i<6_000_000 # while loop 2
case :foo
when :bar
@@ -8,7 +8,7 @@ while i<6_000_000 # while loop 2
when :boo
raise
when :foo
- i+=1
+ i += 1
end
end
diff --git a/benchmark/bm_vm2_defined_method.rb b/benchmark/bm_vm2_defined_method.rb
index 06c0d01baa..053ed6c912 100644
--- a/benchmark/bm_vm2_defined_method.rb
+++ b/benchmark/bm_vm2_defined_method.rb
@@ -2,8 +2,8 @@ class Object
define_method(:m){}
end
-i=0
+i = 0
while i<6_000_000 # benchmark loop 2
- i+=1
+ i += 1
m; m; m; m; m; m; m; m;
end
diff --git a/benchmark/bm_vm2_dstr.rb b/benchmark/bm_vm2_dstr.rb
new file mode 100644
index 0000000000..58c0f7bbc3
--- /dev/null
+++ b/benchmark/bm_vm2_dstr.rb
@@ -0,0 +1,6 @@
+i = 0
+x = y = 'z'
+while i<6_000_000 # benchmark loop 2
+ i += 1
+ str = "foo#{x}bar#{y}baz"
+end
diff --git a/benchmark/bm_vm2_eval.rb b/benchmark/bm_vm2_eval.rb
index e72b4661ac..307cfc28ef 100644
--- a/benchmark/bm_vm2_eval.rb
+++ b/benchmark/bm_vm2_eval.rb
@@ -1,6 +1,6 @@
-i=0
+i = 0
while i<6_000_000 # benchmark loop 2
- i+=1
+ i += 1
eval("1")
end
diff --git a/benchmark/bm_vm2_method.rb b/benchmark/bm_vm2_method.rb
index f92e39a73f..a8ccff7138 100644
--- a/benchmark/bm_vm2_method.rb
+++ b/benchmark/bm_vm2_method.rb
@@ -2,8 +2,8 @@ def m
nil
end
-i=0
+i = 0
while i<6_000_000 # benchmark loop 2
- i+=1
+ i += 1
m; m; m; m; m; m; m; m;
end
diff --git a/benchmark/bm_vm2_method_missing.rb b/benchmark/bm_vm2_method_missing.rb
new file mode 100644
index 0000000000..2badc73101
--- /dev/null
+++ b/benchmark/bm_vm2_method_missing.rb
@@ -0,0 +1,12 @@
+class C
+ def method_missing mid
+ end
+end
+
+obj = C.new
+
+i = 0
+while i<6_000_000 # benchmark loop 2
+ i += 1
+ obj.m; obj.m; obj.m; obj.m; obj.m; obj.m; obj.m; obj.m;
+end
diff --git a/benchmark/bm_vm2_method_with_block.rb b/benchmark/bm_vm2_method_with_block.rb
new file mode 100644
index 0000000000..b4efb4f520
--- /dev/null
+++ b/benchmark/bm_vm2_method_with_block.rb
@@ -0,0 +1,9 @@
+def m
+ nil
+end
+
+i = 0
+while i<6_000_000 # benchmark loop 2
+ i += 1
+ m{}; m{}; m{}; m{}; m{}; m{}; m{}; m{};
+end
diff --git a/benchmark/bm_vm2_mutex.rb b/benchmark/bm_vm2_mutex.rb
index 01b1c478cb..7362f738c5 100644
--- a/benchmark/bm_vm2_mutex.rb
+++ b/benchmark/bm_vm2_mutex.rb
@@ -2,8 +2,8 @@ require 'thread'
m = Mutex.new
-i=0
+i = 0
while i<6_000_000 # benchmark loop 2
- i+=1
+ i += 1
m.synchronize{}
end
diff --git a/benchmark/bm_vm2_poly_method.rb b/benchmark/bm_vm2_poly_method.rb
index 921457d817..c82c0e4bce 100644
--- a/benchmark/bm_vm2_poly_method.rb
+++ b/benchmark/bm_vm2_poly_method.rb
@@ -12,9 +12,9 @@ end
o1 = C1.new
o2 = C2.new
-i=0
+i = 0
while i<6_000_000 # benchmark loop 2
o = (i % 2 == 0) ? o1 : o2
o.m; o.m; o.m; o.m; o.m; o.m; o.m; o.m
- i+=1
+ i += 1
end
diff --git a/benchmark/bm_vm2_poly_method_ov.rb b/benchmark/bm_vm2_poly_method_ov.rb
index bf09837dd7..aa5fd1dd38 100644
--- a/benchmark/bm_vm2_poly_method_ov.rb
+++ b/benchmark/bm_vm2_poly_method_ov.rb
@@ -12,9 +12,9 @@ end
o1 = C1.new
o2 = C2.new
-i=0
+i = 0
while i<6_000_000 # benchmark loop 2
o = (i % 2 == 0) ? o1 : o2
# o.m; o.m; o.m; o.m; o.m; o.m; o.m; o.m
- i+=1
+ i += 1
end
diff --git a/benchmark/bm_vm2_proc.rb b/benchmark/bm_vm2_proc.rb
index 3f51056bf9..65e5217371 100644
--- a/benchmark/bm_vm2_proc.rb
+++ b/benchmark/bm_vm2_proc.rb
@@ -6,9 +6,9 @@ pr = m{
a = 1
}
-i=0
+i = 0
while i<6_000_000 # benchmark loop 2
- i+=1
+ i += 1
pr.call
end
diff --git a/benchmark/bm_vm2_raise1.rb b/benchmark/bm_vm2_raise1.rb
new file mode 100644
index 0000000000..aa5387987f
--- /dev/null
+++ b/benchmark/bm_vm2_raise1.rb
@@ -0,0 +1,18 @@
+def rec n
+ if n > 0
+ rec n-1
+ else
+ raise
+ end
+end
+
+i = 0
+while i<6_000_000 # benchmark loop 2
+ i += 1
+
+ begin
+ rec 1
+ rescue
+ # ignore
+ end
+end
diff --git a/benchmark/bm_vm2_raise2.rb b/benchmark/bm_vm2_raise2.rb
new file mode 100644
index 0000000000..1f61c63157
--- /dev/null
+++ b/benchmark/bm_vm2_raise2.rb
@@ -0,0 +1,18 @@
+def rec n
+ if n > 0
+ rec n-1
+ else
+ raise
+ end
+end
+
+i = 0
+while i<6_000_000 # benchmark loop 2
+ i += 1
+
+ begin
+ rec 10
+ rescue
+ # ignore
+ end
+end
diff --git a/benchmark/bm_vm2_regexp.rb b/benchmark/bm_vm2_regexp.rb
index 428099e55a..55f9e957a3 100644
--- a/benchmark/bm_vm2_regexp.rb
+++ b/benchmark/bm_vm2_regexp.rb
@@ -1,6 +1,6 @@
-i=0
+i = 0
str = 'xxxhogexxx'
while i<6_000_000 # benchmark loop 2
/hoge/ =~ str
- i+=1
+ i += 1
end
diff --git a/benchmark/bm_vm2_send.rb b/benchmark/bm_vm2_send.rb
index 37c79fb1c3..6a3ab6fdab 100644
--- a/benchmark/bm_vm2_send.rb
+++ b/benchmark/bm_vm2_send.rb
@@ -5,8 +5,8 @@ end
o = C.new
-i=0
+i = 0
while i<6_000_000 # benchmark loop 2
- i+=1
+ i += 1
o.__send__ :m
end
diff --git a/benchmark/bm_vm2_super.rb b/benchmark/bm_vm2_super.rb
index d4f0b647de..afd8579e7b 100644
--- a/benchmark/bm_vm2_super.rb
+++ b/benchmark/bm_vm2_super.rb
@@ -16,5 +16,5 @@ obj = CC.new
i = 0
while i<6_000_000 # benchmark loop 2
obj.m
- i+=1
+ i += 1
end
diff --git a/benchmark/bm_vm2_unif1.rb b/benchmark/bm_vm2_unif1.rb
index 775f4d37e6..1774625942 100644
--- a/benchmark/bm_vm2_unif1.rb
+++ b/benchmark/bm_vm2_unif1.rb
@@ -3,6 +3,6 @@ def m a, b
end
while i<6_000_000 # benchmark loop 2
- i+=1
+ i += 1
m 100, 200
end
diff --git a/benchmark/bm_vm2_zsuper.rb b/benchmark/bm_vm2_zsuper.rb
index 7e90df1822..2a43e62217 100644
--- a/benchmark/bm_vm2_zsuper.rb
+++ b/benchmark/bm_vm2_zsuper.rb
@@ -16,5 +16,5 @@ obj = CC.new
while i<6_000_000 # benchmark loop 2
obj.m 10
- i+=1
+ i += 1
end
diff --git a/benchmark/bm_vm3_backtrace.rb b/benchmark/bm_vm3_backtrace.rb
new file mode 100644
index 0000000000..0fbf73e1ca
--- /dev/null
+++ b/benchmark/bm_vm3_backtrace.rb
@@ -0,0 +1,22 @@
+# get last backtrace
+
+begin
+ caller(0, 0)
+rescue ArgumentError
+ alias caller_orig caller
+ def caller lev, n
+ caller_orig(lev)[0..n]
+ end
+end
+
+def rec n
+ if n < 0
+ 100_000.times{
+ caller(0, 1)
+ }
+ else
+ rec(n-1)
+ end
+end
+
+rec 50
diff --git a/benchmark/bm_vm3_clearmethodcache.rb b/benchmark/bm_vm3_clearmethodcache.rb
index a25c372f06..9661323cd2 100644
--- a/benchmark/bm_vm3_clearmethodcache.rb
+++ b/benchmark/bm_vm3_clearmethodcache.rb
@@ -1,6 +1,6 @@
-i=0
+i = 0
while i<200_000
- i+=1
+ i += 1
Class.new{
def m; end
diff --git a/benchmark/bm_vm_thread_create_join.rb b/benchmark/bm_vm_thread_create_join.rb
index 325a66d587..393cd45df9 100644
--- a/benchmark/bm_vm_thread_create_join.rb
+++ b/benchmark/bm_vm_thread_create_join.rb
@@ -1,6 +1,6 @@
-i=0
+i = 0
while i<100_000 # benchmark loop 3
- i+=1
+ i += 1
Thread.new{
}.join
end
diff --git a/benchmark/bm_vm_thread_mutex1.rb b/benchmark/bm_vm_thread_mutex1.rb
index 588506e87c..5c9f85dfb7 100644
--- a/benchmark/bm_vm_thread_mutex1.rb
+++ b/benchmark/bm_vm_thread_mutex1.rb
@@ -7,9 +7,9 @@ max = 2000
lmax = max * max
(1..1).map{
Thread.new{
- i=0
+ i = 0
while i<lmax
- i+=1
+ i += 1
m.synchronize{
r += 1
}
diff --git a/benchmark/bm_vm_thread_mutex2.rb b/benchmark/bm_vm_thread_mutex2.rb
index d700b146d4..10de59054f 100644
--- a/benchmark/bm_vm_thread_mutex2.rb
+++ b/benchmark/bm_vm_thread_mutex2.rb
@@ -7,9 +7,9 @@ max = 2000
lmax = (max * max)/2
(1..2).map{
Thread.new{
- i=0
+ i = 0
while i<lmax
- i+=1
+ i += 1
m.synchronize{
r += 1
}
diff --git a/benchmark/bm_vm_thread_mutex3.rb b/benchmark/bm_vm_thread_mutex3.rb
index f502b6ac84..7f9a44b39d 100644
--- a/benchmark/bm_vm_thread_mutex3.rb
+++ b/benchmark/bm_vm_thread_mutex3.rb
@@ -6,9 +6,9 @@ r = 0
max = 2000
(1..max).map{
Thread.new{
- i=0
+ i = 0
while i<max
- i+=1
+ i += 1
m.synchronize{
r += 1
}
diff --git a/benchmark/bm_vm_thread_pass_flood.rb b/benchmark/bm_vm_thread_pass_flood.rb
index 56b5b0a956..27157d1a6f 100644
--- a/benchmark/bm_vm_thread_pass_flood.rb
+++ b/benchmark/bm_vm_thread_pass_flood.rb
@@ -2,7 +2,7 @@
Thread.new{loop{Thread.pass}}
}
-i=0
+i = 0
while i<10000
i += 1
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/bmx_temp.rb b/benchmark/bmx_temp.rb
deleted file mode 100644
index 0b4b219ca2..0000000000
--- a/benchmark/bmx_temp.rb
+++ /dev/null
@@ -1,9 +0,0 @@
-def m
- nil
-end
-
-i=0
-while i<800000 # benchmark loop 2
- i+=1
- m; m; m; m; m; m; m; m;
-end
diff --git a/benchmark/driver.rb b/benchmark/driver.rb
index 7dab292a15..695dc41aff 100644
--- a/benchmark/driver.rb
+++ b/benchmark/driver.rb
@@ -60,22 +60,25 @@ class BenchmarkDriver
if /(.+)::(.+)/ =~ e
# ex) ruby-a::/path/to/ruby-a
- v = $1.strip
- e = $2
+ label = $1.strip
+ path = $2
+ version = `#{path} -v`.chomp
else
- v = `#{e} -v`.chomp
- v.sub!(/ patchlevel \d+/, '')
+ path = e
+ version = label = `#{path} -v`.chomp
end
- [e, v]
+ [path, label, version]
}.compact
@dir = dir
@repeat = opt[:repeat] || 1
@repeat = 1 if @repeat < 1
@pattern = opt[:pattern] || nil
+ @exclude = opt[:exclude] || nil
@verbose = opt[:quiet] ? false : (opt[:verbose] || false)
@output = opt[:output] ? open(opt[:output], 'w') : nil
@loop_wl1 = @loop_wl2 = nil
+ @ruby_arg = opt[:ruby_arg] || nil
@opt = opt
# [[name, [[r-1-1, r-1-2, ...], [r-2-1, r-2-2, ...]]], ...]
@@ -84,14 +87,33 @@ class BenchmarkDriver
if @verbose
@start_time = Time.now
message @start_time
- @execs.each_with_index{|(e, v), i|
- message "target #{i}: #{v}"
+ @execs.each_with_index{|(path, label, version), i|
+ message "target #{i}: " + (label == version ? "#{label}" : "#{label} (#{version})") + " at \"#{path}\""
}
end
end
- def average results
- results.inject(:+) / results.length
+ def adjusted_results name, results
+ s = nil
+ results.each_with_index{|e, i|
+ r = e.min
+ case name
+ when /^vm1_/
+ if @loop_wl1
+ r -= @loop_wl1[i]
+ r = 0 if r < 0
+ s = '*'
+ end
+ when /^vm2_/
+ if @loop_wl2
+ r -= @loop_wl2[i]
+ r = 0 if r < 0
+ s = '*'
+ end
+ end
+ yield r
+ }
+ s
end
def show_results
@@ -103,7 +125,7 @@ class BenchmarkDriver
message
message PP.pp(@results, "", 79)
message
- message "Elapesed time: #{Time.now - @start_time} (sec)"
+ message "Elapsed time: #{Time.now - @start_time} (sec)"
end
output '-----------------------------------------------------------'
@@ -113,50 +135,49 @@ class BenchmarkDriver
output "minimum results in each #{@repeat} measurements."
end
- difference = "\taverage difference" if @execs.length == 2
- total_difference = 0
-
- output "name\t#{@execs.map{|(e, v)| v}.join("\t")}#{difference}"
+ output "Execution time (sec)"
+ output "name\t#{@execs.map{|(_, v)| v}.join("\t")}"
@results.each{|v, result|
rets = []
- s = nil
- result.each_with_index{|e, i|
- r = e.min
- case v
- when /^vm1_/
- if @loop_wl1
- r -= @loop_wl1[i]
- s = '*'
- end
- when /^vm2_/
- if @loop_wl2
- r -= @loop_wl2[i]
- s = '*'
- end
- end
+ s = adjusted_results(v, result){|r|
rets << sprintf("%.3f", r)
}
-
- if difference
- diff = average(result.last) - average(result.first)
- total_difference += diff
- rets << sprintf("%.3f", diff)
- end
-
output "#{v}#{s}\t#{rets.join("\t")}"
}
- if difference and @verbose
- output '-----------------------------------------------------------'
- output "average total difference is #{total_difference}"
+ if @execs.size > 1
+ output
+ output "Speedup ratio: compare with the result of `#{@execs[0][1]}' (greater is better)"
+ output "name\t#{@execs[1..-1].map{|(_, v)| v}.join("\t")}"
+ @results.each{|v, result|
+ rets = []
+ first_value = nil
+ s = adjusted_results(v, result){|r|
+ if first_value
+ if r == 0
+ rets << "Error"
+ else
+ rets << sprintf("%.3f", first_value/r)
+ end
+ else
+ first_value = r
+ end
+ }
+ output "#{v}#{s}\t#{rets.join("\t")}"
+ }
+ end
+
+ if @opt[:output]
+ output
+ output "Log file: #{@opt[:output]}"
end
end
def files
flag = {}
- vm1 = vm2 = wl1 = wl2 = false
@files = Dir.glob(File.join(@dir, 'bm*.rb')).map{|file|
next if @pattern && /#{@pattern}/ !~ File.basename(file)
+ next if @exclude && /#{@exclude}/ =~ File.basename(file)
case file
when /bm_(vm[12])_/, /bm_loop_(whileloop2?).rb/
flag[$1] = true
@@ -218,31 +239,35 @@ class BenchmarkDriver
end
def measure executable, file
- cmd = "#{executable} #{file}"
+ cmd = "#{executable} #{@ruby_arg} #{file}"
+
m = Benchmark.measure{
`#{cmd}`
}
if $? != 0
- raise "\`#{cmd}\' exited with abnormal status (#{$?})"
+ output "\`#{cmd}\' exited with abnormal status (#{$?})"
+ 0
+ else
+ m.real
end
-
- m.real
end
end
if __FILE__ == $0
opt = {
- :execs => ['ruby'],
- :dir => './',
+ :execs => [],
+ :dir => File.dirname(__FILE__),
:repeat => 1,
:output => "bmlog-#{Time.now.strftime('%Y%m%d-%H%M%S')}.#{$$}",
}
parser = OptionParser.new{|o|
o.on('-e', '--executables [EXECS]',
- "Specify benchmark one or more targets. (exec1; exec2; exec3, ...)"){|e|
- opt[:execs] = e.split(/;/)
+ "Specify benchmark one or more targets (e1::path1; e2::path2; e3::path3;...)"){|e|
+ e.split(/;/).each{|path|
+ opt[:execs] << path
+ }
}
o.on('-d', '--directory [DIRECTORY]', "Benchmark suites directory"){|d|
opt[:dir] = d
@@ -250,11 +275,17 @@ if __FILE__ == $0
o.on('-p', '--pattern [PATTERN]', "Benchmark name pattern"){|p|
opt[:pattern] = p
}
+ o.on('-x', '--exclude [PATTERN]', "Benchmark exclude pattern"){|e|
+ opt[:exclude] = e
+ }
o.on('-r', '--repeat-count [NUM]', "Repeat count"){|n|
opt[:repeat] = n.to_i
}
- o.on('-o', '--output-file [FILE]', "Output file"){|o|
- opt[:output] = o
+ o.on('-o', '--output-file [FILE]', "Output file"){|f|
+ opt[:output] = f
+ }
+ 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
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..b038b71b54
--- /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}"
+
+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/other-lang/fact.rb b/benchmark/other-lang/fact.rb
index 7e97b22b39..6cedc752cd 100644
--- a/benchmark/other-lang/fact.rb
+++ b/benchmark/other-lang/fact.rb
@@ -6,8 +6,8 @@ def fact(n)
end
end
-i=0
+i = 0
while i<10000
- i+=1
+ i += 1
fact(100)
end
diff --git a/benchmark/other-lang/loop.rb b/benchmark/other-lang/loop.rb
index d43cef61f3..b367b9dbf3 100644
--- a/benchmark/other-lang/loop.rb
+++ b/benchmark/other-lang/loop.rb
@@ -1,4 +1,4 @@
-i=0
+i = 0
while i<30000000
- i+=1
+ i += 1
end
diff --git a/bignum.c b/bignum.c
index 2f0eca7fca..bced660134 100644
--- a/bignum.c
+++ b/bignum.c
@@ -10,6 +10,7 @@
**********************************************************************/
#include "ruby/ruby.h"
+#include "ruby/thread.h"
#include "ruby/util.h"
#include "internal.h"
@@ -24,30 +25,2853 @@
#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 defined(HAVE_INT64_T) && defined(HAVE_INT128_T)
+# define SIZEOF_BDIGIT_DBL SIZEOF_INT128_T
+# elif SIZEOF_INT*2 <= SIZEOF_LONG_LONG
+# define SIZEOF_BDIGIT_DBL SIZEOF_LONG_LONG
+# else
+# define SIZEOF_BDIGIT_DBL SIZEOF_LONG
+# 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_BDIGITS <= sizeof(BDIGIT));
+STATIC_ASSERT(sizeof_bdigit_and_dbl, SIZEOF_BDIGITS*2 <= SIZEOF_BDIGIT_DBL);
+STATIC_ASSERT(bdigit_signedness, 0 < (BDIGIT)-1);
+STATIC_ASSERT(bdigit_dbl_signedness, 0 < (BDIGIT_DBL)-1);
+STATIC_ASSERT(bdigit_dbl_signed_signedness, 0 > (BDIGIT_DBL_SIGNED)-1);
+STATIC_ASSERT(rbignum_embed_len_max, RBIGNUM_EMBED_LEN_MAX <= (RBIGNUM_EMBED_LEN_MASK >> RBIGNUM_EMBED_LEN_SHIFT));
+
+#if SIZEOF_BDIGITS < SIZEOF_LONG
+STATIC_ASSERT(sizeof_long_and_sizeof_bdigit, SIZEOF_LONG % SIZEOF_BDIGITS == 0);
+#else
+STATIC_ASSERT(sizeof_long_and_sizeof_bdigit, SIZEOF_BDIGITS % 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 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_BDIGITS == 2
+# define swap_bdigit(x) swap16(x)
+#elif SIZEOF_BDIGITS == 4
+# define swap_bdigit(x) swap32(x)
+#elif SIZEOF_BDIGITS == 8
+# define swap_bdigit(x) swap64(x)
+#endif
#define BIGZEROP(x) (RBIGNUM_LEN(x) == 0 || \
(BDIGITS(x)[0] == 0 && \
(RBIGNUM_LEN(x) == 1 || bigzero_p(x))))
+#define BIGSIZE(x) (RBIGNUM_LEN(x) == 0 ? (size_t)0 : \
+ BDIGITS(x)[RBIGNUM_LEN(x)-1] ? \
+ (size_t)(RBIGNUM_LEN(x)*SIZEOF_BDIGITS - nlz(BDIGITS(x)[RBIGNUM_LEN(x)-1])/CHAR_BIT) : \
+ rb_absint_size(x, NULL))
+
+#define BIGDIVREM_EXTRA_WORDS 1
+#define roomof(n, m) ((long)(((n)+(m)-1) / (m)))
+#define bdigit_roomof(n) roomof(n, SIZEOF_BDIGITS)
+#define BARY_ARGS(ary) ary, numberof(ary)
+
+#define BARY_ADD(z, x, y) bary_add(BARY_ARGS(z), BARY_ARGS(x), BARY_ARGS(y))
+#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 RBIGNUM_SET_NEGATIVE_SIGN(b) RBIGNUM_SET_SIGN(b, 0)
+#define RBIGNUM_SET_POSITIVE_SIGN(b) RBIGNUM_SET_SIGN(b, 1)
+
+#define bignew(len,sign) bignew_1(rb_cBignum,(len),(sign))
+
+#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, long len, int sign);
+static inline VALUE bigtrunc(VALUE x);
+
+static VALUE bigsq(VALUE x);
+static void bigdivmod(VALUE x, VALUE y, volatile VALUE *divp, volatile VALUE *modp);
+static inline VALUE power_cache_get_power(int base, int power_level, size_t *numdigits_ret);
+
+#if SIZEOF_BDIGITS <= SIZEOF_INT
+static int nlz(BDIGIT x) { return nlz_int((unsigned int)x) - (SIZEOF_INT-SIZEOF_BDIGITS) * CHAR_BIT; }
+#elif SIZEOF_BDIGITS <= SIZEOF_LONG
+static int nlz(BDIGIT x) { return nlz_long((unsigned long)x) - (SIZEOF_LONG-SIZEOF_BDIGITS) * CHAR_BIT; }
+#elif SIZEOF_BDIGITS <= SIZEOF_LONG_LONG
+static int nlz(BDIGIT x) { return nlz_long_long((unsigned LONG_LONG)x) - (SIZEOF_LONG_LONG-SIZEOF_BDIGITS) * CHAR_BIT; }
+#elif SIZEOF_BDIGITS <= SIZEOF_INT128_T
+static int nlz(BDIGIT x) { return nlz_int128((uint128_t)x) - (SIZEOF_INT128_T-SIZEOF_BDIGITS) * CHAR_BIT; }
+#endif
+
+#define U16(a) ((uint16_t)(a))
+#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"
+}
+
+ */
+
+#ifdef HAVE_UINT16_T
+static const int maxpow16_exp[35] = {
+ 15, 10, 7, 6, 6, 5, 5, 5, 4, 4, 4, 4, 4, 4, 3, 3, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+};
+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),
+};
+#endif
+#ifdef HAVE_UINT32_T
+static const int maxpow32_exp[35] = {
+ 31, 20, 15, 13, 12, 11, 10, 10, 9, 9, 8, 8, 8, 8, 7, 7, 7, 7, 7, 7,
+ 7, 7, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
+};
+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),
+};
+#endif
+#ifdef HAVE_UINT64_T
+static const int maxpow64_exp[35] = {
+ 63, 40, 31, 27, 24, 22, 21, 20, 19, 18, 17, 17, 16, 16, 15, 15, 15,
+ 15, 14, 14, 14, 14, 13, 13, 13, 13, 13, 13, 13, 12, 12, 12, 12, 12,
+ 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),
+};
+#endif
+#ifdef HAVE_UINT128_T
+static const int maxpow128_exp[35] = {
+ 127, 80, 63, 55, 49, 45, 42, 40, 38, 37, 35, 34, 33, 32, 31, 31, 30,
+ 30, 29, 29, 28, 28, 27, 27, 27, 26, 26, 26, 26, 25, 25, 25, 25, 24,
+ 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_BDIGITS
+ if (wordsize == 2 && (uintptr_t)words % ALIGNOF(uint16_t) == 0) {
+ uint16_t u = (uint16_t)(d = dp[0]);
+ if (need_swap) u = swap16(u);
+ *((uint16_t *)words) = u;
+ return ((1 < de - dp || CLEAR_LOWBITS(d, 16) != 0) ? 2 : 1) * sign;
+ }
+#endif
+#if defined(HAVE_UINT32_T) && 4 <= SIZEOF_BDIGITS
+ if (wordsize == 4 && (uintptr_t)words % ALIGNOF(uint32_t) == 0) {
+ uint32_t u = (uint32_t)(d = dp[0]);
+ if (need_swap) u = swap32(u);
+ *((uint32_t *)words) = u;
+ return ((1 < de - dp || CLEAR_LOWBITS(d, 32) != 0) ? 2 : 1) * sign;
+ }
+#endif
+#if defined(HAVE_UINT64_T) && 8 <= SIZEOF_BDIGITS
+ if (wordsize == 8 && (uintptr_t)words % ALIGNOF(uint64_t) == 0) {
+ uint64_t u = (uint64_t)(d = dp[0]);
+ if (need_swap) u = swap64(u);
+ *((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_BDIGITS
+ if (wordsize == 2 && (uintptr_t)words % ALIGNOF(uint16_t) == 0) {
+ uint16_t u = (uint16_t)(d = -(BDIGIT_DBL_SIGNED)dp[0]);
+ if (need_swap) u = swap16(u);
+ *((uint16_t *)words) = u;
+ return (wordsize == SIZEOF_BDIGITS && de - dp == 2 && dp[1] == 1 && dp[0] == 0) ? -1 :
+ (1 < de - dp || FILL_LOWBITS(d, 16) != -1) ? -2 : -1;
+ }
+#endif
+#if defined(HAVE_UINT32_T) && 4 <= SIZEOF_BDIGITS
+ if (wordsize == 4 && (uintptr_t)words % ALIGNOF(uint32_t) == 0) {
+ uint32_t u = (uint32_t)(d = -(BDIGIT_DBL_SIGNED)dp[0]);
+ if (need_swap) u = swap32(u);
+ *((uint32_t *)words) = u;
+ return (wordsize == SIZEOF_BDIGITS && de - dp == 2 && dp[1] == 1 && dp[0] == 0) ? -1 :
+ (1 < de - dp || FILL_LOWBITS(d, 32) != -1) ? -2 : -1;
+ }
+#endif
+#if defined(HAVE_UINT64_T) && 8 <= SIZEOF_BDIGITS
+ if (wordsize == 8 && (uintptr_t)words % ALIGNOF(uint64_t) == 0) {
+ uint64_t u = (uint64_t)(d = -(BDIGIT_DBL_SIGNED)dp[0]);
+ if (need_swap) u = swap64(u);
+ *((uint64_t *)words) = u;
+ return (wordsize == SIZEOF_BDIGITS && de - dp == 2 && dp[1] == 1 && dp[0] == 0) ? -1 :
+ (1 < de - dp || FILL_LOWBITS(d, 64) != -1) ? -2 : -1;
+ }
+#endif
+ }
+ }
+#if !defined(WORDS_BIGENDIAN)
+ if (nails == 0 && SIZEOF_BDIGITS == sizeof(BDIGIT) &&
+ (flags & INTEGER_PACK_WORDORDER_MASK) == INTEGER_PACK_LSWORD_FIRST &&
+ (flags & INTEGER_PACK_BYTEORDER_MASK) != INTEGER_PACK_MSBYTE_FIRST) {
+ size_t src_size = (de - dp) * SIZEOF_BDIGITS;
+ 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_BDIGITS == sizeof(BDIGIT) &&
+ wordsize % SIZEOF_BDIGITS == 0 && (uintptr_t)words % ALIGNOF(BDIGIT) == 0) {
+ size_t bdigits_per_word = wordsize / SIZEOF_BDIGITS;
+ size_t src_num_bdigits = de - dp;
+ size_t dst_num_bdigits = numwords * bdigits_per_word;
+ int overflow = 0;
+ 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_BDIGITS * 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_BDIGITS && 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_BDIGITS
+ if (wordsize == 2 && (uintptr_t)words % ALIGNOF(uint16_t) == 0) {
+ uint16_t u = *(uint16_t *)buf;
+ return integer_unpack_single_bdigit(need_swap ? swap16(u) : u, sizeof(uint16_t), flags, dp);
+ }
+#endif
+#if defined(HAVE_UINT32_T) && 4 <= SIZEOF_BDIGITS
+ if (wordsize == 4 && (uintptr_t)words % ALIGNOF(uint32_t) == 0) {
+ uint32_t u = *(uint32_t *)buf;
+ return integer_unpack_single_bdigit(need_swap ? swap32(u) : u, sizeof(uint32_t), flags, dp);
+ }
+#endif
+#if defined(HAVE_UINT64_T) && 8 <= SIZEOF_BDIGITS
+ if (wordsize == 8 && (uintptr_t)words % ALIGNOF(uint64_t) == 0) {
+ uint64_t u = *(uint64_t *)buf;
+ return integer_unpack_single_bdigit(need_swap ? swap64(u) : u, sizeof(uint64_t), flags, dp);
+ }
+#endif
+ }
+#if !defined(WORDS_BIGENDIAN)
+ if (nails == 0 && SIZEOF_BDIGITS == sizeof(BDIGIT) &&
+ (flags & INTEGER_PACK_WORDORDER_MASK) == INTEGER_PACK_LSWORD_FIRST &&
+ (flags & INTEGER_PACK_BYTEORDER_MASK) != INTEGER_PACK_MSBYTE_FIRST) {
+ size_t src_size = numwords * wordsize;
+ size_t dst_size = num_bdigits * SIZEOF_BDIGITS;
+ 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_BDIGITS == sizeof(BDIGIT) &&
+ wordsize % SIZEOF_BDIGITS == 0) {
+ size_t bdigits_per_word = wordsize / SIZEOF_BDIGITS;
+ int mswordfirst_p = (flags & INTEGER_PACK_MSWORD_FIRST) != 0;
+ int msbytefirst_p = (flags & INTEGER_PACK_NATIVE_BYTE_ORDER) ? HOST_BIGENDIAN_P :
+ (flags & INTEGER_PACK_MSBYTE_FIRST) != 0;
+ 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 = RBIGNUM_LEN(x), yn = RBIGNUM_LEN(y), zn = xn + yn;
+ VALUE z = bignew(zn, RBIGNUM_SIGN(x)==RBIGNUM_SIGN(y));
+ bary_mul_normal(BDIGITS(z), zn, BDIGITS(x), xn, BDIGITS(y), yn);
+ RB_GC_GUARD(x);
+ RB_GC_GUARD(y);
+ 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 = RBIGNUM_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 = RBIGNUM_LEN(x), yn = RBIGNUM_LEN(y), zn = xn + yn;
+ VALUE z = bignew(zn, RBIGNUM_SIGN(x)==RBIGNUM_SIGN(y));
+ bary_mul_balance_with_mulfunc(BDIGITS(z), zn, BDIGITS(x), xn, BDIGITS(y), yn, NULL, 0, bary_mul_toom3_start);
+ RB_GC_GUARD(x);
+ RB_GC_GUARD(y);
+ 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_BDIGITS * zn <= 16) {
+ uint128_t z, x, y;
+ ssize_t i;
+ for (x = 0, i = xn-1; 0 <= i; i--) { x <<= SIZEOF_BDIGITS*CHAR_BIT; x |= xds[i]; }
+ for (y = 0, i = yn-1; 0 <= i; i--) { y <<= SIZEOF_BDIGITS*CHAR_BIT; y |= yds[i]; }
+ for (z = 0, i = zn-1; 0 <= i; i--) { z <<= SIZEOF_BDIGITS*CHAR_BIT; z |= zds[i]; }
+ assert(z == x * y);
+ }
+ */
+
+ 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 = RBIGNUM_LEN(x), yn = RBIGNUM_LEN(y), zn = xn + yn;
+ VALUE z = bignew(zn, RBIGNUM_SIGN(x)==RBIGNUM_SIGN(y));
+ if (!((xn <= yn && yn < 2) || KARATSUBA_BALANCED(xn, yn)))
+ rb_raise(rb_eArgError, "unexpected bignum length for karatsuba");
+ bary_mul_karatsuba(BDIGITS(z), zn, BDIGITS(x), xn, BDIGITS(y), yn, NULL, 0);
+ 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 = RBIGNUM_LEN(x), yn = RBIGNUM_LEN(y), zn = xn + yn;
+ VALUE z = bignew(zn, RBIGNUM_SIGN(x)==RBIGNUM_SIGN(y));
+ if (xn > yn || yn < 3 || !TOOM3_BALANCED(xn,yn))
+ rb_raise(rb_eArgError, "unexpected bignum length for toom3");
+ bary_mul_toom3(BDIGITS(z), zn, BDIGITS(x), xn, BDIGITS(y), yn, NULL, 0);
+ 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_BDIGITS)*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 = RBIGNUM_LEN(x), yn = RBIGNUM_LEN(y), zn = xn + yn;
+ VALUE z = bignew(zn, RBIGNUM_SIGN(x)==RBIGNUM_SIGN(y));
+ bary_mul_gmp(BDIGITS(z), zn, BDIGITS(x), xn, BDIGITS(y), yn);
+ RB_GC_GUARD(x);
+ RB_GC_GUARD(y);
+ 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 (xds[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 = RBIGNUM_LEN(x), yn = RBIGNUM_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, RBIGNUM_SIGN(x)==RBIGNUM_SIGN(y));
+ qds = BDIGITS(q);
+
+ rn = yn;
+ r = bignew(rn, RBIGNUM_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_BDIGITS)*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 = RBIGNUM_LEN(x), yn = RBIGNUM_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, RBIGNUM_SIGN(x)==RBIGNUM_SIGN(y));
+ qds = BDIGITS(q);
+
+ rn = yn;
+ r = bignew(rn, RBIGNUM_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
@@ -58,7 +2882,7 @@ dump_bignum(VALUE x)
long i;
printf("%c0x0", RBIGNUM_SIGN(x) ? '+' : '-');
for (i = RBIGNUM_LEN(x); i--; ) {
- printf("_%08"PRIxBDIGIT, BDIGITS(x)[i]);
+ printf("_%0*"PRIxBDIGIT, SIZEOF_BDIGITS*2, BDIGITS(x)[i]);
}
printf(", len=%lu", RBIGNUM_LEN(x));
puts("");
@@ -77,13 +2901,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), RBIGNUM_LEN(x));
}
int
@@ -104,7 +2922,7 @@ rb_cmpint(VALUE val, VALUE a, VALUE b)
if (l < 0) return -1;
return 0;
}
- if (TYPE(val) == T_BIGNUM) {
+ if (RB_BIGNUM_TYPE_P(val)) {
if (BIGZEROP(val)) return 0;
if (RBIGNUM_SIGN(val)) return 1;
return -1;
@@ -139,6 +2957,7 @@ rb_big_realloc(VALUE big, long len)
ds = RBIGNUM(big)->as.heap.digits;
RBASIC(big)->flags |= RBIGNUM_EMBED_FLAG;
RBIGNUM_SET_LEN(big, len);
+ (void)VALGRIND_MAKE_MEM_UNDEFINED((void*)RBIGNUM(big)->as.ary, sizeof(RBIGNUM(big)->as.ary));
if (ds) {
MEMCPY(RBIGNUM(big)->as.ary, ds, BDIGIT, len);
xfree(ds);
@@ -165,23 +2984,21 @@ rb_big_resize(VALUE big, long len)
static VALUE
bignew_1(VALUE klass, long len, int sign)
{
- NEWOBJ(big, struct RBignum);
- OBJSETUP(big, klass, T_BIGNUM);
+ NEWOBJ_OF(big, struct RBignum, klass, T_BIGNUM | (RGENGC_WB_PROTECTED_BIGNUM ? FL_WB_PROTECTED : 0));
RBIGNUM_SET_SIGN(big, sign?1:0);
if (len <= RBIGNUM_EMBED_LEN_MAX) {
RBASIC(big)->flags |= RBIGNUM_EMBED_FLAG;
RBIGNUM_SET_LEN(big, len);
+ (void)VALGRIND_MAKE_MEM_UNDEFINED((void*)RBIGNUM(big)->as.ary, sizeof(RBIGNUM(big)->as.ary));
}
else {
RBIGNUM(big)->as.heap.digits = ALLOC_N(BDIGIT, len);
RBIGNUM(big)->as.heap.len = len;
}
-
+ OBJ_FREEZE(big);
return (VALUE)big;
}
-#define bignew(len,sign) bignew_1(rb_cBignum,(len),(sign))
-
VALUE
rb_big_new(long len, int sign)
{
@@ -198,26 +3015,22 @@ rb_big_clone(VALUE x)
return z;
}
+static void
+big_extend_carry(VALUE x)
+{
+ rb_big_resize(x, RBIGNUM_LEN(x)+1);
+ BDIGITS(x)[RBIGNUM_LEN(x)-1] = 1;
+}
+
/* modify a bignum by 2's complement */
static void
get2comp(VALUE x)
{
long i = RBIGNUM_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,6 +3040,36 @@ rb_big_2comp(VALUE x) /* get 2's complement */
get2comp(x);
}
+static BDIGIT
+abs2twocomp(VALUE *xp, long *n_ret)
+{
+ VALUE x = *xp;
+ long n = RBIGNUM_LEN(x);
+ BDIGIT *ds = BDIGITS(x);
+ BDIGIT hibits = 0;
+
+ BARY_TRUNC(ds, n);
+
+ if (n != 0 && RBIGNUM_NEGATIVE_P(x)) {
+ VALUE z = bignew_1(CLASS_OF(x), n, 0);
+ MEMCPY(BDIGITS(z), ds, BDIGIT, n);
+ bary_2comp(BDIGITS(z), n);
+ hibits = BDIGMAX;
+ *xp = z;
+ }
+ *n_ret = n;
+ return hibits;
+}
+
+static void
+twocomp2abs_bang(VALUE x, int hibits)
+{
+ RBIGNUM_SET_SIGN(x, !hibits);
+ if (hibits) {
+ get2comp(x);
+ }
+}
+
static inline VALUE
bigtrunc(VALUE x)
{
@@ -244,36 +3087,52 @@ bigtrunc(VALUE x)
static inline VALUE
bigfixize(VALUE x)
{
- long len = RBIGNUM_LEN(x);
+ size_t n = RBIGNUM_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_BDIGITS < 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_BDIGITS < SIZEOF_LONG
+ if (sizeof(long)/SIZEOF_BDIGITS < n)
+ goto return_big;
+ else {
+ int i = (int)n;
+ u = 0;
+ while (i--) {
+ u = (unsigned long)(BIGUP(u) + ds[i]);
+ }
}
+#else /* SIZEOF_BDIGITS >= SIZEOF_LONG */
+ if (1 < n)
+ goto return_big;
+ else
+ u = ds[0];
+#endif
+
+ if (RBIGNUM_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 (!FIXNUM_P(x) && TYPE(x) == T_BIGNUM) {
- x = bigfixize(bigtrunc(x));
+ if (RB_BIGNUM_TYPE_P(x)) {
+ x = bigfixize(x);
}
return x;
}
@@ -287,19 +3146,20 @@ 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_BDIGITS >= 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);
return big;
@@ -309,13 +3169,17 @@ VALUE
rb_int2big(SIGNED_VALUE n)
{
long neg = 0;
+ VALUE u;
VALUE big;
if (n < 0) {
- n = -n;
+ u = 1 + (VALUE)(-(n + 1)); /* u = -n avoiding overflow */
neg = 1;
}
- big = rb_uint2big(n);
+ else {
+ u = n;
+ }
+ big = rb_uint2big(u);
if (neg) {
RBIGNUM_SET_SIGN(big, 0);
}
@@ -336,257 +3200,788 @@ 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.
+ * 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_BDIGITS >= 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 + RBIGNUM_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_BDIGITS - 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;
}
-/* See rb_big_pack comment for endianness of buf. */
-VALUE
-rb_big_unpack(unsigned long *buf, long num_longs)
-{
- 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;
+/*
+ * 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
}
- 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;
+ 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;
+}
+
+/* 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 : RBIGNUM_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 : RBIGNUM_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)
+{
+ 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_BDIGITS >= 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 + RBIGNUM_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_BDIGITS >= 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 = RBIGNUM_POSITIVE_P(val) ? 1 : -1;
+ ds = BDIGITS(val);
+ num_bdigits = RBIGNUM_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);
-}
-#else
+ if ((flags & INTEGER_PACK_FORCE_BIGNUM) && sign != 0 &&
+ bary_zero_p(BDIGITS(val), RBIGNUM_LEN(val)))
+ sign = 0;
+ RBIGNUM_SET_SIGN(val, 0 <= sign);
-static int
-quad_buf_complement(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;
+ if (flags & INTEGER_PACK_FORCE_BIGNUM)
+ return bigtrunc(val);
+ return bignorm(val);
}
+#define QUAD_SIZE 8
+
void
rb_quad_pack(char *buf, VALUE val)
{
- long len;
+ rb_integer_pack(val, buf, 1, QUAD_SIZE, 0,
+ INTEGER_PACK_NATIVE_BYTE_ORDER|
+ INTEGER_PACK_2COMP);
+}
- memset(buf, 0, QUAD_SIZE);
- val = rb_to_int(val);
- if (FIXNUM_P(val)) {
- val = rb_int2big(FIX2LONG(val));
+VALUE
+rb_quad_unpack(const char *buf, int signed_p)
+{
+ return rb_integer_unpack(buf, 1, QUAD_SIZE, 0,
+ INTEGER_PACK_NATIVE_BYTE_ORDER|
+ (signed_p ? INTEGER_PACK_2COMP : 0));
+}
+
+#define conv_digit(c) (ruby_digit36_to_number_table[(unsigned char)(c)])
+
+static void
+str2big_scan_digits(const char *s, const char *str, int base, int badcheck, size_t *num_digits_p, size_t *len_p)
+{
+ 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;
}
- len = RBIGNUM_LEN(val) * SIZEOF_BDIGITS;
- if (len > QUAD_SIZE) {
- len = QUAD_SIZE;
+ if (badcheck) {
+ str--;
+ if (s+1 < str && str[-1] == '_') goto bad;
+ while (*str && ISSPACE(*str)) str++;
+ if (*str) {
+ bad:
+ rb_invalid_str(s, "Integer()");
+ }
}
- memcpy(buf, (char*)BDIGITS(val), len);
- if (RBIGNUM_NEGATIVE_P(val)) {
- quad_buf_complement(buf, QUAD_SIZE);
+ *num_digits_p = num_digits;
+ *len_p = digits_end - digits_start;
+}
+
+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;
+
+ 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;
+ }
+ }
+ if (numbits) {
+ *dp++ = BIGLO(dd);
}
+ assert((size_t)(dp - BDIGITS(z)) == num_bdigits);
+
+ return z;
}
-#define BNEG(b) (RSHIFT(((BDIGIT*)(b))[QUAD_SIZE/SIZEOF_BDIGITS-1],BITSPERDIG-1) != 0)
+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;
-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;
- memcpy((char*)BDIGITS(big), buf, QUAD_SIZE);
- if (sign && BNEG(buf)) {
- char *tmp = (char*)BDIGITS(big);
+ 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);
+ }
- RBIGNUM_SET_SIGN(big, 0);
- quad_buf_complement(tmp, QUAD_SIZE);
+ return z;
+}
+
+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;
+
+ size_t i;
+ const char *p;
+ int c;
+ VALUE z;
+
+ uds = ALLOCV_N(BDIGIT, tmpuv, 2*num_bdigits);
+ vds = uds + num_bdigits;
+
+ powerv = power_cache_get_power(base, power_level, NULL);
+
+ 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), RBIGNUM_LEN(powerv), uds+i+unit, unit);
+ bary_add(vds+i, unit*2, vds+i, unit*2, uds+i, unit);
+ }
+ else if (unit <= num_bdigits - i) {
+ bary_mul(vds+i, num_bdigits-i, BDIGITS(powerv), RBIGNUM_LEN(powerv), uds+i+unit, num_bdigits-(i+unit));
+ bary_add(vds+i, num_bdigits-i, vds+i, num_bdigits-i, uds+i, unit);
+ }
+ else {
+ 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_BDIGITS)*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++;
@@ -607,15 +4002,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;
@@ -628,47 +4027,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;
@@ -687,9 +4067,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;
@@ -712,50 +4093,36 @@ rb_cstr_to_inum(const char *str, int base, int badcheck)
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 = 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);
@@ -770,6 +4137,7 @@ rb_str_to_inum(VALUE str, int base, int badcheck)
VALUE ret;
StringValue(str);
+ rb_must_asciicompat(str);
if (badcheck) {
s = StringValueCStr(str);
}
@@ -792,24 +4160,176 @@ 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_BDIGITS >= 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);
return big;
@@ -819,13 +4339,17 @@ 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);
}
@@ -860,128 +4384,168 @@ 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 = RBIGNUM_LEN(x);
+ z = bignew(xn+s1+1, RBIGNUM_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)RBIGNUM_LEN(x) <= shift_numdigits) {
+ if (RBIGNUM_POSITIVE_P(x) ||
+ bary_zero_p(BDIGITS(x), RBIGNUM_LEN(x)))
+ return INT2FIX(0);
+ else
+ return INT2FIX(-1);
+ }
+ 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 RBIGNUM_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]);
- }
- return big2str_power_cache[base - 2][i];
-}
-
-static VALUE
-power_cache_get_power(int base, long n1, long* m1)
-{
- int i, m;
- long j;
- VALUE t;
-
- if (n1 <= KARATSUBA_DIGITS)
- rb_bug("n1 > KARATSUBA_DIGITS");
-
- 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);
-
- j = KARATSUBA_DIGITS*(1 << i);
- while (n1 > j) {
- t = bigsqr(t);
- j *= 2;
+ /*
+ * 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 t;
+ if (numdigits_ret)
+ *numdigits_ret = base36_numdigits_cache[base - 2][power_level];
+ return base36_power_cache[base - 2][power_level];
}
-/* big2str_muraken_find_n1
+/*
+ * deprecated. (used only from deprecated rb_big2str0)
+ *
+ * big2str_muraken_find_n1
*
* Let a natural number x is given by:
* x = 2^0 * x_0 + 2^1 * x_1 + ... + 2^(B*n_0 - 1) * x_{B*n_0 - 1},
@@ -1029,122 +4593,430 @@ big2str_find_n1(VALUE x, int base)
bits = BITSPERDIG*RBIGNUM_LEN(x);
}
- return (long)ceil(bits/log_2[base - 2]);
+ /* @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]);
}
-static long
-big2str_orig(VALUE x, int base, char* ptr, long len, long hbase, int trim)
+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)
{
- long i = RBIGNUM_LEN(x), j = len;
- BDIGIT* ds = BDIGITS(x);
+ 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++ = '-';
+}
- while (i && j > 0) {
- long k = i;
- BDIGIT_DBL num = 0;
+static void
+big2str_2bdigits(struct big2str_struct *b2s, BDIGIT *xds, size_t xn, size_t taillen)
+{
+ 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;
+}
- 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;
+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;
+
+ /*
+ * 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.
+ */
+
+ 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;
+ }
+
+ if (power_level == 0) {
+ big2str_2bdigits(b2s, xds, xn, taillen);
+ return;
+ }
+
+ lower_power_level = power_level-1;
+ b = power_cache_get_power(b2s->base, lower_power_level, &lower_numdigits);
+ bn = RBIGNUM_LEN(b);
+ bds = BDIGITS(b);
+
+ 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 = RBIGNUM_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 {
+ 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);
+ }
+}
+
+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 (RBIGNUM_NEGATIVE_P(x)) {
+ if (LONG_MAX-1 < numwords)
+ rb_raise(rb_eArgError, "too big number");
+ result = rb_usascii_str_new(0, 1+numwords);
+ ptr = RSTRING_PTR(result);
+ *ptr++ = RBIGNUM_POSITIVE_P(x) ? '+' : '-';
}
- if (trim) {
- while (j < len && ptr[j] == '0') j++;
- MEMMOVE(ptr, ptr + j, char, len - j);
- len -= j;
+ else {
+ 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 len;
+ return result;
}
-static long
-big2str_karatsuba(VALUE x, int base, char* ptr,
- long n1, long len, long hbase, int trim)
+VALUE
+rb_big2str_poweroftwo(VALUE x, int base)
{
- long lh, ll, m1;
- VALUE b, q, r;
+ return big2str_base_poweroftwo(x, base);
+}
- if (BIGZEROP(x)) {
- if (trim) return 0;
- else {
- memset(ptr, '0', len);
- return len;
- }
+static VALUE
+big2str_generic(VALUE x, int base)
+{
+ BDIGIT *xds;
+ size_t xn;
+ struct big2str_struct b2s_data;
+ int power_level;
+ VALUE power;
+
+ xds = BDIGITS(x);
+ xn = RBIGNUM_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);
+
+ 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)RBIGNUM_LEN(power) <= (xn+1)/2) {
+ power_level++;
+ power = power_cache_get_power(base, power_level, NULL);
}
+ assert(power_level != MAX_BASE36_POWER_TABLE_ENTRIES);
- if (n1 <= KARATSUBA_DIGITS) {
- return big2str_orig(x, base, ptr, len, hbase, trim);
+ if ((size_t)RBIGNUM_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++;
}
- 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);
+ b2s_data.negative = RBIGNUM_NEGATIVE_P(x);
+ b2s_data.base = base;
+ b2s_data.hbase2 = maxpow_in_bdigit_dbl(base, &b2s_data.hbase2_numdigits);
- return lh + ll;
+ b2s_data.result = Qnil;
+ b2s_data.ptr = NULL;
+
+ if (power_level == 0) {
+ big2str_2bdigits(&b2s_data, xds, xn, 0);
+ }
+ else {
+ VALUE tmpw = 0;
+ BDIGIT *wds;
+ size_t wn;
+ wn = power_level * BIGDIVREM_EXTRA_WORDS + RBIGNUM_LEN(power);
+ wds = ALLOCV_N(BDIGIT, tmpw, xn + wn);
+ MEMCPY(wds, xds, BDIGIT, xn);
+ big2str_karatsuba(&b2s_data, wds, xn, wn, power_level, 0);
+ if (tmpw)
+ ALLOCV_END(tmpw);
+ }
+ 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_big2str0(VALUE x, int base, int trim)
+rb_big2str_generic(VALUE x, int base)
+{
+ return big2str_generic(x, base);
+}
+
+#ifdef USE_GMP
+VALUE
+big2str_gmp(VALUE x, int base)
+{
+ const size_t nails = (sizeof(BDIGIT)-SIZEOF_BDIGITS)*CHAR_BIT;
+ mpz_t mx;
+ size_t size;
+ VALUE str;
+ BDIGIT *xds = BDIGITS(x);
+ size_t xn = RBIGNUM_LEN(x);
+
+ mpz_init(mx);
+ mpz_import(mx, xn, -1, sizeof(BDIGIT), 0, nails, xds);
+
+ size = mpz_sizeinbase(mx, base);
+
+ if (RBIGNUM_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);
+
+ if (RSTRING_PTR(str)[RSTRING_LEN(str)-1] == '\0') {
+ rb_str_set_len(str, RSTRING_LEN(str)-1);
+ }
+
+ RB_GC_GUARD(x);
+ return str;
+}
+
+VALUE
+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 = RBIGNUM_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) ? '+' : '-';
+ if (xn >= LONG_MAX/BITSPERDIG) {
+ rb_raise(rb_eRangeError, "bignum too big to convert into `string'");
+ }
- hbase = base*base;
-#if SIZEOF_BDIGITS > 2
- hbase *= hbase;
+ if (POW2_P(base)) {
+ /* base == 2 || base == 4 || base == 8 || base == 16 || base == 32 */
+ return big2str_base_poweroftwo(x, base);
+ }
+
+#ifdef USE_GMP
+ if (GMP_BIG2STR_DIGITS < xn) {
+ return big2str_gmp(x, base);
+ }
#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);
+
+ return big2str_generic(x, base);
+}
+
+/* deprecated */
+VALUE
+rb_big2str0(VALUE x, int base, int trim)
+{
+ VALUE str;
+ long oldlen;
+ long n2;
+
+ str = rb_big2str1(x, base);
+
+ if (trim || FIXNUM_P(x) || BIGZEROP(x))
+ return str;
+
+ oldlen = RSTRING_LEN(str);
+ if (oldlen && RSTRING_PTR(str)[0] != '-') {
+ rb_str_resize(str, oldlen+1);
+ MEMMOVE(RSTRING_PTR(str)+1, RSTRING_PTR(str), char, oldlen);
+ RSTRING_PTR(str)[0] = '+';
}
- else {
- len = off + big2str_karatsuba(xx, base, ptr + off, n1,
- n2, hbase, trim);
+
+ n2 = big2str_find_n1(x, base);
+
+ oldlen = RSTRING_LEN(str);
+ if (oldlen-1 < n2) {
+ long off = n2 - (oldlen-1);
+ rb_str_resize(str, n2+1);
+ MEMMOVE(RSTRING_PTR(str)+1+off, RSTRING_PTR(str)+1, char, oldlen-1);
+ memset(RSTRING_PTR(str)+1, '0', off);
}
- rb_big_resize(xx, 0);
- ptr[len] = '\0';
- rb_str_resize(ss, len);
+ RSTRING_PTR(str)[RSTRING_LEN(str)] = '\0';
- return ss;
+ return str;
}
VALUE
rb_big2str(VALUE x, int base)
{
- return rb_big2str0(x, base, 1);
+ return rb_big2str1(x, base);
}
/*
@@ -1176,62 +5048,74 @@ 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;
+ 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_BDIGITS
+ num = (unsigned long)ds[0];
+#else
num = 0;
while (len--) {
- num = BIGUP(num);
- num += ds[len];
+ num <<= BITSPERDIG;
+ num += (unsigned long)ds[len]; /* overflow is already checked */
}
- return (VALUE)num;
+#endif
+ return num;
}
+/* deprecated */
VALUE
rb_big2ulong_pack(VALUE x)
{
- VALUE num = big2ulong(x, "unsigned long", FALSE);
- if (!RBIGNUM_SIGN(x)) {
- return (VALUE)(-(SIGNED_VALUE)num);
- }
+ unsigned long num;
+ rb_integer_pack(x, &num, 1, sizeof(num), 0,
+ INTEGER_PACK_NATIVE_BYTE_ORDER|INTEGER_PACK_2COMP);
return num;
}
VALUE
rb_big2ulong(VALUE x)
{
- VALUE num = big2ulong(x, "unsigned long", TRUE);
+ unsigned long num = big2ulong(x, "unsigned long");
- if (!RBIGNUM_SIGN(x)) {
- if ((long)num < 0) {
- rb_raise(rb_eRangeError, "bignum out of range of unsigned long");
- }
- return (VALUE)(-(SIGNED_VALUE)num);
+ if (RBIGNUM_POSITIVE_P(x)) {
+ return num;
}
- 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 out of range of unsigned long");
}
SIGNED_VALUE
rb_big2long(VALUE x)
{
- VALUE num = big2ulong(x, "long", TRUE);
+ unsigned long num = big2ulong(x, "long");
- if ((long)num < 0 &&
- (RBIGNUM_SIGN(x) || (long)num != LONG_MIN)) {
- rb_raise(rb_eRangeError, "bignum too big to convert into `long'");
+ if (RBIGNUM_POSITIVE_P(x)) {
+ if (num <= LONG_MAX)
+ return num;
}
- if (!RBIGNUM_SIGN(x)) return -(SIGNED_VALUE)num;
- 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'");
}
#if HAVE_LONG_LONG
@@ -1240,17 +5124,22 @@ static unsigned LONG_LONG
big2ull(VALUE x, const char *type)
{
long len = RBIGNUM_LEN(x);
- BDIGIT_DBL num;
- BDIGIT *ds;
+ 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_BDIGITS
+ num = (unsigned LONG_LONG)ds[0];
+#else
num = 0;
while (len--) {
num = BIGUP(num);
num += ds[len];
}
+#endif
return num;
}
@@ -1259,9 +5148,16 @@ rb_big2ull(VALUE x)
{
unsigned LONG_LONG num = big2ull(x, "unsigned long long");
- if (!RBIGNUM_SIGN(x))
- return (VALUE)(-(SIGNED_VALUE)num);
- return num;
+ if (RBIGNUM_POSITIVE_P(x)) {
+ 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 out of range of unsigned long long");
}
LONG_LONG
@@ -1269,12 +5165,17 @@ rb_big2ll(VALUE x)
{
unsigned LONG_LONG num = big2ull(x, "long long");
- if ((LONG_LONG)num < 0 && (RBIGNUM_SIGN(x)
- || (LONG_LONG)num != LLONG_MIN)) {
- rb_raise(rb_eRangeError, "bignum too big to convert into `long long'");
+ if (RBIGNUM_POSITIVE_P(x)) {
+ if (num <= LLONG_MAX)
+ return num;
}
- if (!RBIGNUM_SIGN(x)) return -(LONG_LONG)num;
- 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'");
}
#endif /* HAVE_LONG_LONG */
@@ -1295,7 +5196,7 @@ dbl2big(double d)
rb_raise(rb_eFloatDomainError, "NaN");
}
- while (!POSFIXABLE(u) || 0 != (long)u) {
+ while (1.0 <= u) {
u /= (double)(BIGRAD);
i++;
}
@@ -1317,27 +5218,6 @@ 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)
{
@@ -1359,16 +5239,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;
}
}
@@ -1417,108 +5298,165 @@ rb_big_to_f(VALUE x)
return DBL2NUM(rb_big2dbl(x));
}
+VALUE
+rb_integer_float_cmp(VALUE x, VALUE y)
+{
+ double yd = RFLOAT_VALUE(y);
+ double yi, yf;
+ VALUE rel;
+
+ if (isnan(yd))
+ return Qnil;
+ if (isinf(yd)) {
+ if (yd > 0.0) return INT2FIX(-1);
+ else return INT2FIX(1);
+ }
+ yf = modf(yd, &yi);
+ if (FIXNUM_P(x)) {
+#if SIZEOF_LONG * CHAR_BIT < DBL_MANT_DIG /* assume FLT_RADIX == 2 */
+ double xd = (double)FIX2LONG(x);
+ if (xd < yd)
+ return INT2FIX(-1);
+ if (xd > yd)
+ return INT2FIX(1);
+ return INT2FIX(0);
+#else
+ long xn, yn;
+ if (yi < FIXNUM_MIN)
+ return INT2FIX(1);
+ if (FIXNUM_MAX+1 <= yi)
+ return INT2FIX(-1);
+ xn = FIX2LONG(x);
+ yn = (long)yi;
+ if (xn < yn)
+ return INT2FIX(-1);
+ if (xn > yn)
+ return INT2FIX(1);
+ if (yf < 0.0)
+ return INT2FIX(1);
+ if (0.0 < yf)
+ return INT2FIX(-1);
+ return INT2FIX(0);
+#endif
+ }
+ y = rb_dbl2big(yi);
+ rel = rb_big_cmp(x, y);
+ if (yf == 0.0 || rel != INT2FIX(0))
+ return rel;
+ if (yf < 0.0)
+ return INT2FIX(1);
+ return INT2FIX(-1);
+}
+
+VALUE
+rb_integer_float_eq(VALUE x, VALUE y)
+{
+ double yd = RFLOAT_VALUE(y);
+ double yi, yf;
+
+ if (isnan(yd) || isinf(yd))
+ return Qfalse;
+ yf = modf(yd, &yi);
+ if (yf != 0)
+ return Qfalse;
+ if (FIXNUM_P(x)) {
+#if SIZEOF_LONG * CHAR_BIT < DBL_MANT_DIG /* assume FLT_RADIX == 2 */
+ double xd = (double)FIX2LONG(x);
+ if (xd != yd)
+ return Qfalse;
+ return Qtrue;
+#else
+ long xn, yn;
+ if (yi < LONG_MIN || LONG_MAX < yi)
+ return Qfalse;
+ xn = FIX2LONG(x);
+ yn = (long)yi;
+ if (xn != yn)
+ return Qfalse;
+ return Qtrue;
+#endif
+ }
+ y = rb_dbl2big(yi);
+ return rb_big_eq(x, y);
+}
+
/*
* call-seq:
* big <=> numeric -> -1, 0, +1 or nil
*
- * Comparison---Returns -1, 0, or +1 depending on whether <i>big</i> is
- * less than, equal to, or greater than <i>numeric</i>. This is the
- * basis for the tests in <code>Comparable</code>.
+ * Comparison---Returns -1, 0, or +1 depending on whether +big+ is
+ * less than, equal to, or greater than +numeric+. This is the
+ * basis for the tests in Comparable.
+ *
+ * +nil+ is returned if the two values are incomparable.
*
*/
VALUE
rb_big_cmp(VALUE x, VALUE y)
{
- long xlen = RBIGNUM_LEN(x);
- BDIGIT *xds, *yds;
+ int cmp;
- switch (TYPE(y)) {
- case T_FIXNUM:
+ if (FIXNUM_P(y)) {
y = rb_int2big(FIX2LONG(y));
- break;
-
- case T_BIGNUM:
- break;
-
- case T_FLOAT:
- {
- double a = RFLOAT_VALUE(y);
-
- if (isinf(a)) {
- if (a > 0.0) return INT2FIX(-1);
- else return INT2FIX(1);
- }
- return rb_dbl_cmp(rb_big2dbl(x), a);
- }
-
- default:
+ }
+ else if (RB_BIGNUM_TYPE_P(y)) {
+ }
+ else if (RB_FLOAT_TYPE_P(y)) {
+ return rb_integer_float_cmp(x, y);
+ }
+ 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);
- 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), RBIGNUM_LEN(x), BDIGITS(y), RBIGNUM_LEN(y));
+ if (RBIGNUM_SIGN(x))
+ return INT2FIX(cmp);
+ else
+ return INT2FIX(-cmp);
}
+enum big_op_t {
+ big_op_gt,
+ big_op_ge,
+ big_op_lt,
+ big_op_le
+};
+
static VALUE
-big_op(VALUE x, VALUE y, int op)
+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:
- {
- double a = RFLOAT_VALUE(y);
-
- if (isinf(a)) {
- if (a > 0.0) rel = INT2FIX(-1);
- else rel = INT2FIX(1);
- break;
- }
- rel = rb_dbl_cmp(rb_big2dbl(x), a);
- break;
- }
-
- default:
- {
- ID id = 0;
- switch (op) {
- case 0: id = '>'; break;
- case 1: id = rb_intern(">="); break;
- case 2: id = '<'; break;
- case 3: id = rb_intern("<="); break;
- }
- return rb_num_coerce_relop(x, y, id);
+ }
+ else if (RB_FLOAT_TYPE_P(y)) {
+ rel = rb_integer_float_cmp(x, y);
+ }
+ 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;
n = FIX2INT(rel);
switch (op) {
- case 0: return n > 0 ? Qtrue : Qfalse;
- case 1: return n >= 0 ? Qtrue : Qfalse;
- case 2: return n < 0 ? Qtrue : Qfalse;
- case 3: return n <= 0 ? Qtrue : Qfalse;
+ case big_op_gt: return n > 0 ? Qtrue : Qfalse;
+ case big_op_ge: return n >= 0 ? Qtrue : Qfalse;
+ case big_op_lt: return n < 0 ? Qtrue : Qfalse;
+ case big_op_le: return n <= 0 ? Qtrue : Qfalse;
}
return Qundef;
}
@@ -1534,7 +5472,7 @@ big_op(VALUE x, VALUE y, int op)
static VALUE
big_gt(VALUE x, VALUE y)
{
- return big_op(x, y, 0);
+ return big_op(x, y, big_op_gt);
}
/*
@@ -1548,7 +5486,7 @@ big_gt(VALUE x, VALUE y)
static VALUE
big_ge(VALUE x, VALUE y)
{
- return big_op(x, y, 1);
+ return big_op(x, y, big_op_ge);
}
/*
@@ -1562,7 +5500,7 @@ big_ge(VALUE x, VALUE y)
static VALUE
big_lt(VALUE x, VALUE y)
{
- return big_op(x, y, 2);
+ return big_op(x, y, big_op_lt);
}
/*
@@ -1576,7 +5514,7 @@ big_lt(VALUE x, VALUE y)
static VALUE
big_le(VALUE x, VALUE y)
{
- return big_op(x, y, 3);
+ return big_op(x, y, big_op_le);
}
/*
@@ -1593,22 +5531,16 @@ 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:
- {
- volatile double a, b;
-
- a = RFLOAT_VALUE(y);
- if (isnan(a) || isinf(a)) return Qfalse;
- b = rb_big2dbl(x);
- return (a == b)?Qtrue:Qfalse;
- }
- default:
+ }
+ else if (RB_BIGNUM_TYPE_P(y)) {
+ }
+ else if (RB_FLOAT_TYPE_P(y)) {
+ return rb_integer_float_eq(x, y);
+ }
+ else {
return rb_equal(y, x);
}
if (RBIGNUM_SIGN(x) != RBIGNUM_SIGN(y)) return Qfalse;
@@ -1631,7 +5563,7 @@ rb_big_eq(VALUE x, VALUE y)
VALUE
rb_big_eql(VALUE x, VALUE y)
{
- if (TYPE(y) != T_BIGNUM) return Qfalse;
+ if (!RB_BIGNUM_TYPE_P(y)) 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;
@@ -1671,78 +5603,49 @@ static VALUE
rb_big_neg(VALUE x)
{
VALUE z = rb_big_clone(x);
- BDIGIT *ds;
- long i;
+ BDIGIT *ds = BDIGITS(z);
+ long n = RBIGNUM_LEN(z);
- 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);
+ if (!n) return INT2FIX(-1);
- return bignorm(z);
-}
-
-static void
-bigsub_core(BDIGIT *xds, long xn, BDIGIT *yds, long yn, BDIGIT *zds, long zn)
-{
- BDIGIT_DBL_SIGNED num;
- long i;
-
- 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 (RBIGNUM_POSITIVE_P(z)) {
+ if (bary_add_one(ds, n)) {
+ big_extend_carry(z);
+ }
+ RBIGNUM_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);
+ RBIGNUM_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;
-
- /* 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;
- }
- }
- }
+ VALUE z;
+ BDIGIT *xds, *yds, *zds;
+ long xn, yn, zn;
+
+ xn = RBIGNUM_LEN(x);
+ yn = RBIGNUM_LEN(y);
+ zn = xn < yn ? yn : xn;
- z = bignew(RBIGNUM_LEN(x), z==0);
- bigsub_core(BDIGITS(x), RBIGNUM_LEN(x),
- BDIGITS(y), RBIGNUM_LEN(y),
- BDIGITS(z), RBIGNUM_LEN(z));
+ z = bignew(zn, 1);
+
+ xds = BDIGITS(x);
+ yds = BDIGITS(y);
+ zds = BDIGITS(z);
+
+ if (bary_sub(zds, zn, xds, xn, yds, yn)) {
+ bary_2comp(zds, zn);
+ RBIGNUM_SET_NEGATIVE_SIGN(z);
+ }
return z;
}
@@ -1754,7 +5657,7 @@ bigsub_int(VALUE x, long y0)
{
VALUE z;
BDIGIT *xds, *zds;
- long xn;
+ long xn, zn;
BDIGIT_DBL_SIGNED num;
long i, y;
@@ -1762,10 +5665,19 @@ bigsub_int(VALUE x, long y0)
xds = BDIGITS(x);
xn = RBIGNUM_LEN(x);
- z = bignew(xn, RBIGNUM_SIGN(x));
+ if (xn == 0)
+ return LONG2NUM(-y0);
+
+ zn = xn;
+#if SIZEOF_BDIGITS < SIZEOF_LONG
+ if (zn < bdigit_roomof(SIZEOF_LONG))
+ zn = bdigit_roomof(SIZEOF_LONG);
+#endif
+ z = bignew(zn, RBIGNUM_SIGN(x));
zds = BDIGITS(z);
-#if SIZEOF_BDIGITS == SIZEOF_LONG
+#if SIZEOF_BDIGITS >= SIZEOF_LONG
+ assert(xn == zn);
num = (BDIGIT_DBL_SIGNED)xds[0] - y;
if (xn == 1 && num < 0) {
RBIGNUM_SET_SIGN(z, !RBIGNUM_SIGN(x));
@@ -1776,26 +5688,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_BDIGITS < 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_BDIGITS < 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);
+ RBIGNUM_SET_SIGN(z, !RBIGNUM_SIGN(x));
}
RB_GC_GUARD(x);
return bignorm(z);
@@ -1813,79 +5761,75 @@ bigadd_int(VALUE x, long y)
xds = BDIGITS(x);
xn = RBIGNUM_LEN(x);
- if (xn < 2) {
- zn = 3;
- }
- else {
- zn = xn + 1;
- }
+ if (xn == 0)
+ return LONG2NUM(y);
+
+ zn = xn;
+#if SIZEOF_BDIGITS < SIZEOF_LONG
+ if (zn < bdigit_roomof(SIZEOF_LONG))
+ zn = bdigit_roomof(SIZEOF_LONG);
+#endif
+ zn++;
+
z = bignew(zn, RBIGNUM_SIGN(x));
zds = BDIGITS(z);
-#if SIZEOF_BDIGITS == SIZEOF_LONG
+#if SIZEOF_BDIGITS >= 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);
-}
+ goto finish;
-static void
-bigadd_core(BDIGIT *xds, long xn, BDIGIT *yds, long yn, BDIGIT *zds, long zn)
-{
- BDIGIT_DBL num = 0;
- long i;
-
- 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
@@ -1908,9 +5852,9 @@ bigadd(VALUE x, VALUE y, int sign)
}
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), RBIGNUM_LEN(z),
+ BDIGITS(x), RBIGNUM_LEN(x),
+ BDIGITS(y), RBIGNUM_LEN(y));
return z;
}
@@ -1927,8 +5871,7 @@ 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) {
@@ -1940,14 +5883,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, '+');
}
}
@@ -1964,8 +5907,7 @@ 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) {
@@ -1977,573 +5919,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);
+ 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;
- do {
- *zds-- = num | xds[--xn]>>s3;
- num = xds[xn]<<s2;
- }
- while (xn > 0);
- *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;
- do {
- xds[i++] = (BDIGIT)(*zds<<s3) | num;
- num = *zds++>>s2;
- }
- while (i < xn - s1 - 1);
- 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;
+ long xn, yn, zn;
+ VALUE z;
+ BDIGIT *xds, *yds, *zds;
+
+ if (x == y)
+ return bigsq(x);
xn = RBIGNUM_LEN(x);
yn = RBIGNUM_LEN(y);
- assert(xn <= yn); /* assume y >= x */
+ zn = xn + yn;
- 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));
-
- /* z2 <- z2 + z1 - z(inf) == z2 + z1 - u4 */
- z2 = bigtrunc(bigadd(z2, z1, 1));
- z2 = bigtrunc(bigadd(z2, u4, 0));
-
- /* z1 <- z1 - z3 */
- z1 = bigtrunc(bigadd(z1, z3, 0));
-
- /*
- * [Step3] Substituting base value into b of the polynomial z(b),
- */
-
- zn = 6*n + 1;
z = bignew(zn, RBIGNUM_SIGN(x)==RBIGNUM_SIGN(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);
-}
+ xds = BDIGITS(x);
+ yds = BDIGITS(y);
+ zds = BDIGITS(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
@@ -2554,196 +5999,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;
- BDIGIT *yds, *zds;
- VALUE stop;
-};
-
static VALUE
-bigdivrem1(void *ptr)
+bigdivrem(VALUE x, VALUE y, volatile VALUE *divp, volatile VALUE *modp)
{
- struct big_div_struct *bds = (struct big_div_struct*)ptr;
- long nx = bds->nx, ny = bds->ny;
- long i, j, nyzero;
- BDIGIT *yds = bds->yds, *zds = bds->zds;
- BDIGIT_DBL t2;
- BDIGIT_DBL_SIGNED num;
- BDIGIT q;
-
- j = nx==ny?nx+1:nx;
- for (nyzero = 0; !yds[nyzero]; nyzero++);
- do {
- if (bds->stop) return Qnil;
- 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 = 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 Qnil;
-}
+ long xn = RBIGNUM_LEN(x), yn = RBIGNUM_LEN(y);
+ VALUE z;
+ BDIGIT *xds, *yds, *zds;
+ BDIGIT dd;
-static void
-rb_big_stop(void *ptr)
-{
- VALUE *stop = (VALUE*)ptr;
- *stop = Qtrue;
-}
+ VALUE q = Qnil, r = Qnil;
+ BDIGIT *qds, *rds;
+ long qn, rn;
-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;
+ yds = BDIGITS(y);
+ BARY_TRUNC(yds, yn);
+ if (yn == 0)
+ rb_num_zerodiv();
- 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(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, RBIGNUM_SIGN(x)==RBIGNUM_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);
+ *modp = rb_uint2big((VALUE)dd);
RBIGNUM_SET_SIGN(*modp, RBIGNUM_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)), RBIGNUM_SIGN(x)==RBIGNUM_SIGN(y));
+ zds = BDIGITS(z);
+ zds[0] = BIGLO(q0);
+ zds[1] = BIGLO(BIGDN(q0));
+ *divp = z;
+ }
+ if (modp) {
+ z = bignew(bdigit_roomof(sizeof(BDIGIT_DBL)), RBIGNUM_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, RBIGNUM_SIGN(x)==RBIGNUM_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;
- if (nx > 10000 || ny > 10000) {
- rb_thread_blocking_region(bigdivrem1, &bds, rb_big_stop, &bds.stop);
+ if (modp) {
+ rn = yn;
+ r = bignew(rn, RBIGNUM_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
@@ -2767,26 +6128,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:
- {
- double div = rb_big2dbl(x) / RFLOAT_VALUE(y);
- if (op == '/') {
- return DBL2NUM(div);
- }
- else {
- return rb_dbl2big(div);
- }
+ }
+ 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);
@@ -2836,15 +6193,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);
@@ -2866,15 +6218,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);
@@ -2894,15 +6241,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);
@@ -2910,84 +6252,59 @@ 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 = RBIGNUM_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);
- bignum:
- bigdivrem(x, y, &z, 0);
- l = ex - ey;
+ bigdivrem(x, y, &z, 0);
+ l = ex - ey;
#if SIZEOF_LONG > SIZEOF_INT
- {
- /* Visual C++ can't be here */
- if (l > INT_MAX) return DBL2NUM(INFINITY);
- if (l < INT_MIN) return DBL2NUM(0.0);
- }
-#endif
- return DBL2NUM(ldexp(big2dbl(z), (int)l));
- }
- case T_FLOAT:
- y = dbl2big(ldexp(frexp(RFLOAT_VALUE(y), &i), DBL_MANT_DIG));
- ey = i - DBL_MANT_DIG;
- goto bignum;
+ {
+ /* Visual C++ can't be here */
+ if (l > INT_MAX) return DBL2NUM(INFINITY);
+ if (l < INT_MIN) return DBL2NUM(0.0);
}
- rb_bug("big_fdiv");
- /* NOTREACHED */
+#endif
+ return DBL2NUM(ldexp(big2dbl(z), (int)l));
+}
+
+static VALUE
+big_fdiv_int(VALUE x, VALUE y)
+{
+ long l, ey;
+ bigtrunc(y);
+ l = RBIGNUM_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);
}
/*
@@ -3009,39 +6326,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
@@ -3061,20 +6368,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))
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)
@@ -3082,85 +6390,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 inline VALUE
-bit_coerce(VALUE x)
-{
- while (!FIXNUM_P(x) && TYPE(x) != T_BIGNUM) {
- if (TYPE(x) == T_FLOAT) {
- rb_raise(rb_eTypeError, "can't convert Float into Integer");
- }
- x = rb_to_int(x);
- }
- return x;
-}
-
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_BDIGITS >= SIZEOF_LONG
+ if (!hibitsy) {
y &= xds[0];
return LONG2NUM(y);
}
#endif
- z = bignew(zn, RBIGNUM_SIGN(x) || sign);
+ zn = xn;
+#if SIZEOF_BDIGITS < 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_BDIGITS >= SIZEOF_LONG
i = 1;
zds[0] = xds[0] & 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;
}
- if (!RBIGNUM_SIGN(z)) get2comp(z);
+ for (;i < zn; i++) {
+ zds[i] = hibitsx & hibitsy;
+ }
+ twocomp2abs_bang(z, hibitsx && hibitsy);
+ RB_GC_GUARD(x);
return bignorm(z);
}
@@ -3172,86 +6479,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;
- x = xx;
- y = bit_coerce(yy);
- if (!RBIGNUM_SIGN(x)) {
- x = rb_big_clone(x);
- get2comp(x);
+ if (!FIXNUM_P(y) && !RB_BIGNUM_TYPE_P(y)) {
+ return rb_num_coerce_bit(x, y, '&');
}
+
+ hibitsx = abs2twocomp(&x, &xn);
if (FIXNUM_P(y)) {
- return bigand_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 bigand_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?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 = RBIGNUM_LEN(x);
+#if SIZEOF_BDIGITS < SIZEOF_LONG
+ if (zn < bdigit_roomof(SIZEOF_LONG))
+ zn = bdigit_roomof(SIZEOF_LONG);
+#endif
+ z = bignew(zn, 0);
zds = BDIGITS(z);
-#if SIZEOF_BDIGITS == SIZEOF_LONG
+#if SIZEOF_BDIGITS >= SIZEOF_LONG
i = 1;
zds[0] = xds[0] | 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;
+ }
+ goto finish;
+
+ fill_hibits:
+ for (; i < zn; i++) {
+ zds[i] = BDIGMAX;
}
- if (!RBIGNUM_SIGN(z)) get2comp(z);
+
+ finish:
+ twocomp2abs_bang(z, hibitsx || hibitsy);
+ RB_GC_GUARD(x);
return bignorm(z);
}
@@ -3263,87 +6605,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;
-
- x = xx;
- y = bit_coerce(yy);
+ long i, xn, yn, n1, n2;
+ BDIGIT hibitsx, hibitsy;
+ BDIGIT hibits1, hibits2;
+ VALUE tmpv;
+ BDIGIT tmph;
+ long tmpn;
- if (!RBIGNUM_SIGN(x)) {
- x = rb_big_clone(x);
- get2comp(x);
+ if (!FIXNUM_P(y) && !RB_BIGNUM_TYPE_P(y)) {
+ return rb_num_coerce_bit(x, y, '|');
}
+
+ hibitsx = abs2twocomp(&x, &xn);
if (FIXNUM_P(y)) {
- return bigor_int(x, FIX2LONG(y));
+ return bigor_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?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 = RBIGNUM_LEN(x);
+#if SIZEOF_BDIGITS < SIZEOF_LONG
+ if (zn < bdigit_roomof(SIZEOF_LONG))
+ zn = bdigit_roomof(SIZEOF_LONG);
+#endif
+ z = bignew(zn, 0);
zds = BDIGITS(z);
-#if SIZEOF_BDIGITS == SIZEOF_LONG
+#if SIZEOF_BDIGITS >= SIZEOF_LONG
i = 1;
zds[0] = xds[0] ^ 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);
}
/*
@@ -3354,68 +6705,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;
-
- x = xx;
- y = bit_coerce(yy);
+ long i, xn, yn, n1, n2;
+ BDIGIT hibitsx, hibitsy;
+ BDIGIT hibits1, hibits2;
+ VALUE tmpv;
+ BDIGIT tmph;
+ long tmpn;
- if (!RBIGNUM_SIGN(x)) {
- x = rb_big_clone(x);
- get2comp(x);
+ if (!FIXNUM_P(y) && !RB_BIGNUM_TYPE_P(y)) {
+ return rb_num_coerce_bit(x, y, '^');
}
+
+ hibitsx = abs2twocomp(&x, &xn);
if (FIXNUM_P(y)) {
- return bigxor_int(x, FIX2LONG(y));
+ return bigxor_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);
- }
- 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
@@ -3426,59 +6762,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 (TYPE(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:
@@ -3490,77 +6800,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 (TYPE(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)) {
- save_x = x = rb_big_clone(x);
- get2comp(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);
- }
- return z;
}
/*
@@ -3586,42 +6850,40 @@ static VALUE
rb_big_aref(VALUE x, VALUE y)
{
BDIGIT *xds;
- BDIGIT_DBL num;
- VALUE shift;
+ unsigned long shift;
long i, s1, s2;
+ BDIGIT bit;
- if (TYPE(y) == T_BIGNUM) {
+ if (RB_BIGNUM_TYPE_P(y)) {
if (!RBIGNUM_SIGN(y))
return INT2FIX(0);
bigtrunc(y);
- if (RBIGNUM_LEN(y) > DIGSPERLONG) {
+ if (BIGSIZE(y) > sizeof(long)) {
out_of_range:
return RBIGNUM_SIGN(x) ? INT2FIX(0) : INT2FIX(1);
}
- shift = big2ulong(y, "long", FALSE);
+ shift = big2ulong(y, "long");
}
else {
i = NUM2LONG(y);
if (i < 0) return INT2FIX(0);
- shift = (VALUE)i;
+ shift = i;
}
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);
+
+ xds = BDIGITS(x);
+ if (RBIGNUM_POSITIVE_P(x))
+ return (xds[s1] & bit) ? INT2FIX(1) : INT2FIX(0);
+ if (xds[s1] & (bit-1))
+ return (xds[s1] & bit) ? INT2FIX(0) : INT2FIX(1);
+ 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);
}
/*
@@ -3641,29 +6903,36 @@ rb_big_hash(VALUE x)
}
/*
- * 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
rb_big_coerce(VALUE x, VALUE y)
{
if (FIXNUM_P(y)) {
- return rb_assoc_new(rb_int2big(FIX2LONG(y)), x);
- }
- else if (TYPE(y) == T_BIGNUM) {
- return rb_assoc_new(y, x);
+ y = rb_int2big(FIX2LONG(y));
}
- else {
+ else if (!RB_BIGNUM_TYPE_P(y)) {
rb_raise(rb_eTypeError, "can't coerce %s to Bignum",
rb_obj_classname(y));
}
- /* not reached */
- return Qnil;
+ return rb_assoc_new(y, x);
}
/*
* call-seq:
* big.abs -> aBignum
+ * big.magnitude -> aBignum
*
* Returns the absolute value of <i>big</i>.
*
@@ -3695,7 +6964,79 @@ 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
+ *
+ */
+
+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 (RBIGNUM_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);
}
/*
@@ -3708,7 +7049,7 @@ rb_big_size(VALUE big)
static VALUE
rb_big_odd_p(VALUE num)
{
- if (BDIGITS(num)[0] & 1) {
+ if (RBIGNUM_LEN(num) != 0 && BDIGITS(num)[0] & 1) {
return Qtrue;
}
return Qfalse;
@@ -3724,7 +7065,7 @@ rb_big_odd_p(VALUE num)
static VALUE
rb_big_even_p(VALUE num)
{
- if (BDIGITS(num)[0] & 1) {
+ if (RBIGNUM_LEN(num) != 0 && BDIGITS(num)[0] & 1) {
return Qfalse;
}
return Qtrue;
@@ -3754,6 +7095,7 @@ Init_Bignum(void)
rb_cBignum = rb_define_class("Bignum", rb_cInteger);
rb_define_method(rb_cBignum, "to_s", rb_big_to_s, -1);
+ rb_define_alias(rb_cBignum, "inspect", "to_s");
rb_define_method(rb_cBignum, "coerce", rb_big_coerce, 1);
rb_define_method(rb_cBignum, "-@", rb_big_uminus, 0);
rb_define_method(rb_cBignum, "+", rb_big_plus, 1);
@@ -3788,11 +7130,13 @@ 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
+ 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 0de43c97ec..4e0bbb7b7a 100755
--- a/bin/rake
+++ b/bin/rake
@@ -24,6 +24,7 @@
begin
require 'rubygems'
+ gem 'rake'
rescue LoadError
end
diff --git a/bin/rdoc b/bin/rdoc
index 20d866c220..aaa23292df 100755
--- a/bin/rdoc
+++ b/bin/rdoc
@@ -18,6 +18,10 @@ require 'rdoc/rdoc'
begin
r = RDoc::RDoc.new
r.document ARGV
+rescue Errno::ENOSPC
+ $stderr.puts 'Ran out of space creating documentation'
+ $stderr.puts
+ $stderr.puts 'Please free up some space and try again'
rescue SystemExit
raise
rescue Exception => e
diff --git a/bin/testrb b/bin/testrb
index e9046eb147..23a00b439f 100755
--- a/bin/testrb
+++ b/bin/testrb
@@ -1,10 +1,3 @@
#!/usr/bin/env ruby
require 'test/unit'
-tests = Test::Unit::AutoRunner.new(true)
-tests.options.banner.sub!(/\[options\]/, '\& tests...')
-unless tests.process_args(ARGV)
- abort tests.options.banner
-end
-files = tests.to_run
-$0 = files.size == 1 ? File.basename(files[0]) : files.to_s
-exit tests.run
+exit Test::Unit::AutoRunner.run(true)
diff --git a/bootstraptest/runner.rb b/bootstraptest/runner.rb
index df58ca58f3..5fdfc42a63 100755
--- a/bootstraptest/runner.rb
+++ b/bootstraptest/runner.rb
@@ -1,4 +1,4 @@
-"exec" "${RUBY-ruby}" "-x" "$0" "$@"; true # -*- mode: ruby; coding: utf-8 -*-
+"exec" "${RUBY-ruby}" "-x" "$0" "$@" || true # -*- mode: ruby; coding: utf-8 -*-
#!./ruby
# $Id$
@@ -61,6 +61,9 @@ def main
@ruby = File.expand_path('miniruby')
@verbose = false
$stress = false
+ @color = nil
+ @tty = nil
+ @quiet = false
dir = nil
quiet = false
tests = nil
@@ -81,8 +84,17 @@ def main
true
when /\A(--stress|-s)/
$stress = true
+ when /\A--color(?:=(?:always|(auto)|(never)|(.*)))?\z/
+ warn "unknown --color argument: #$3" if $3
+ @color = $1 ? nil : !$2
+ true
+ when /\A--tty(=(?:yes|(no)|(.*)))?\z/
+ warn "unknown --tty argument: #$3" if $3
+ @tty = !$1 || !$2
+ true
when /\A(-q|--q(uiet))\z/
quiet = true
+ @quiet = true
true
when /\A(-v|--v(erbose))\z/
@verbose = true
@@ -92,12 +104,16 @@ Usage: #{File.basename($0, '.*')} --ruby=PATH [--sets=NAME,NAME,...]
--sets=NAME,NAME,... Name of test sets.
--dir=DIRECTORY Working directory.
default: /tmp/bootstraptestXXXXX.tmpwd
+ --color[=WHEN] Colorize the output. WHEN defaults to 'always'
+ or can be 'never' or 'auto'.
-s, --stress stress test.
-v, --verbose Output test name before exec.
-q, --quiet Don\'t print header message.
-h, --help Print this message and quit.
End
exit true
+ when /\A-j/
+ true
else
false
end
@@ -110,6 +126,24 @@ End
tests = Dir.glob("#{File.dirname($0)}/test_*.rb").sort if tests.empty?
pathes = tests.map {|path| File.expand_path(path) }
+ @progress = %w[- \\ | /]
+ @progress_bs = "\b" * @progress[0].size
+ @tty = $stderr.tty? if @tty.nil?
+ case @color
+ when nil
+ @color = @tty && /dumb/ !~ ENV["TERM"]
+ end
+ @tty &&= !@verbose
+ if @color
+ # dircolors-like style
+ colors = (colors = ENV['TEST_COLORS']) ? Hash[colors.scan(/(\w+)=([^:]*)/)] : {}
+ @passed = "\e[#{colors["pass"] || "32"}m"
+ @failed = "\e[#{colors["fail"] || "31"}m"
+ @reset = "\e[m"
+ @erase = "\r\e[2K\r"
+ else
+ @passed = @failed = @reset = @erase = ""
+ end
unless quiet
puts Time.now
if defined?(RUBY_DESCRIPTION)
@@ -135,23 +169,34 @@ def exec_test(pathes)
@errbuf = []
@location = nil
pathes.each do |path|
- $stderr.print "\n#{File.basename(path)} "
+ @basename = File.basename(path)
+ $stderr.print @basename, " "
$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
+ else
+ $stderr.print "#{@progress_bs}#{@failed}FAIL #{@error-error}/#{@count-count}#{@reset}"
+ end
+ end
+ $stderr.puts unless @quiet and @tty
end
- $stderr.puts
if @error == 0
if @count == 0
$stderr.puts "No tests, no problem"
else
- $stderr.puts "PASS all #{@count} tests"
+ $stderr.puts "#{@passed}PASS#{@reset} all #{@count} tests"
end
exit true
else
@errbuf.each do |msg|
$stderr.puts msg
end
- $stderr.puts "FAIL #{@error}/#{@count} tests failed"
+ $stderr.puts "#{@failed}FAIL#{@reset} #{@error}/#{@count} tests failed"
exit false
end
end
@@ -159,22 +204,42 @@ end
def show_progress(message = '')
if @verbose
$stderr.print "\##{@count} #{@location} "
+ elsif @tty
+ $stderr.print "#{@progress_bs}#{@progress[@count % @progress.size]}"
end
- faildesc = yield
+ faildesc, errout = with_stderr {yield}
if !faildesc
- $stderr.print '.'
+ if @tty
+ $stderr.print "#{@progress_bs}#{@progress[@count % @progress.size]}"
+ else
+ $stderr.print '.'
+ end
$stderr.puts if @verbose
else
- $stderr.print 'F'
+ $stderr.print "#{@failed}F#{@reset}"
$stderr.puts if @verbose
error faildesc, message
+ unless errout.empty?
+ $stderr.print "#{@failed}stderr output is not empty#{@reset}\n", adjust_indent(errout)
+ end
+ if @tty and !@verbose
+ $stderr.print @basename, " ", @progress[@count % @progress.size]
+ end
end
+rescue Interrupt
+ raise Interrupt
rescue Exception => err
$stderr.print 'E'
$stderr.puts if @verbose
error err.message, message
end
+# NativeClient is special. The binary is cross-compiled. But runs on the build environment.
+# So RUBY_PLATFORM in this process is not useful to detect it.
+def nacl?
+ @ruby and File.basename(@ruby.split(/\s/).first)['sel_ldr']
+end
+
def assert_check(testsrc, message = '', opt = '')
show_progress(message) {
result = get_result_string(testsrc, opt)
@@ -256,7 +321,7 @@ def assert_normal_exit(testsrc, *rest)
$stderr.reopen(old_stderr)
old_stderr.close
end
- if status.signaled?
+ if status && status.signaled?
signo = status.termsig
signame = Signal.list.invert[signo]
unless ignore_signals and ignore_signals.include?(signame)
@@ -342,6 +407,7 @@ def get_result_string(src, opt = '')
begin
`#{@ruby} -W0 #{opt} #{filename}`
ensure
+ raise Interrupt if $? and $?.signaled? && $?.termsig == Signal.list["INT"]
raise CoreDumpError, "core dumped" if $? and $?.coredump?
end
else
@@ -349,6 +415,27 @@ def get_result_string(src, opt = '')
end
end
+def with_stderr
+ out = err = nil
+ begin
+ r, w = IO.pipe
+ stderr = $stderr.dup
+ $stderr.reopen(w)
+ w.close
+ reader = Thread.start {r.read}
+ begin
+ out = yield
+ ensure
+ $stderr.reopen(stderr)
+ err = reader.value
+ end
+ ensure
+ w.close rescue nil
+ r.close rescue nil
+ end
+ return out, err
+end
+
def newtest
@location = File.basename(caller(2).first)
@count += 1
@@ -356,7 +443,12 @@ def newtest
end
def error(msg, additional_message)
- @errbuf.push "\##{@count} #{@location}: #{msg} #{additional_message}"
+ msg = "#{@failed}\##{@count} #{@location}#{@reset}: #{msg} #{additional_message}"
+ if @tty
+ $stderr.puts "#{@erase}#{msg}"
+ else
+ @errbuf.push msg
+ end
@error += 1
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_block.rb b/bootstraptest/test_block.rb
index ea6768cc25..6a2ccfc6da 100644
--- a/bootstraptest/test_block.rb
+++ b/bootstraptest/test_block.rb
@@ -565,3 +565,35 @@ assert_normal_exit %q{
t.test_for_bug
}, '[ruby-core:14395]'
+assert_equal 'true', %q{
+ class C0
+ def foo
+ block_given?
+ end
+ end
+
+ class C1 < C0
+ def foo
+ super
+ end
+ end
+
+ C1.new.foo{}
+}
+
+assert_equal 'true', %q{
+ class C0
+ def foo
+ block_given?
+ end
+ end
+
+ class C1 < C0
+ def foo
+ super()
+ end
+ end
+
+ C1.new.foo{}
+}
+
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_eval.rb b/bootstraptest/test_eval.rb
index c347d50ac9..bf7478006d 100644
--- a/bootstraptest/test_eval.rb
+++ b/bootstraptest/test_eval.rb
@@ -264,24 +264,18 @@ assert_equal 'ok', %q{
}, '[ruby-core:16794]'
assert_equal 'ok', %q{
- begin
- nil.instance_eval {
- def a() :a end
- }
- rescue TypeError
- :ok
- end
-}, '[ruby-core:16796]'
+ nil.instance_eval {
+ def defd_using_instance_eval() :ok end
+ }
+ nil.defd_using_instance_eval
+}, '[ruby-core:28324]'
assert_equal 'ok', %q{
- begin
- nil.instance_exec {
- def a() :a end
- }
- rescue TypeError
- :ok
- end
-}, '[ruby-core:16796]'
+ nil.instance_exec {
+ def defd_using_instance_exec() :ok end
+ }
+ nil.defd_using_instance_exec
+}, '[ruby-core:28324]'
assert_normal_exit %q{
eval("", method(:proc).call {}.binding)
@@ -316,6 +310,15 @@ assert_normal_exit %q{
end
begin
eval "class C; @@h = #{hash.inspect}; end"
- rescue SystemStackError
end
}, '[ruby-core:25714]'
+
+assert_normal_exit %q{
+ begin
+ eval("# encoding:utf-16le\nfoo")
+ rescue Exception => e
+ p e
+ RubyVM::InstructionSequence.compile("p:hello")
+ end
+}, 'check escaping the internal value th->base_block'
+
diff --git a/bootstraptest/test_exception.rb b/bootstraptest/test_exception.rb
index f7d5eeaa07..35c8d25e37 100644
--- a/bootstraptest/test_exception.rb
+++ b/bootstraptest/test_exception.rb
@@ -414,3 +414,19 @@ assert_equal 'exception class/object expected', %q{
e.message
end
}, '[ruby-core:24767]'
+
+assert_equal 'ok', %q{
+ class C
+ def ===(o)
+ true
+ end
+ end
+ begin
+ begin
+ raise
+ rescue C.new
+ end
+ rescue TypeError
+ :ok
+ end
+}
diff --git a/bootstraptest/test_flow.rb b/bootstraptest/test_flow.rb
index 6b3ef749c3..0390062a24 100644
--- a/bootstraptest/test_flow.rb
+++ b/bootstraptest/test_flow.rb
@@ -563,16 +563,29 @@ assert_equal %Q{ENSURE\n}, %q{
assert_equal "true", src + %q{e.include?(:foo)}, bug
end
-assert_equal('ok', %q{
- class FOO < RuntimeError; end
- class BAR < RuntimeError; end
- def m
- raise FOO
- end
- set_trace_func(proc{|t,| raise BAR if t == 'return'})
- begin
- m
- rescue BAR
- 'ok'
+assert_equal "foo", %q{
+ class Bug6460
+ def m1
+ m2 {|e|
+ return e
+ }
+ end
+
+ def m2
+ begin
+ yield :foo
+ ensure
+ begin
+ begin
+ yield :foo
+ ensure
+ Proc.new
+ raise ''
+ end
+ rescue
+ end
+ end
+ end
end
-}, '[ruby-core:51128] [ruby-trunk - Bug #7624]')
+ Bug6460.new.m1
+}, '[ruby-dev:46372]'
diff --git a/bootstraptest/test_io.rb b/bootstraptest/test_io.rb
index 7304aebc26..f7360f34b3 100644
--- a/bootstraptest/test_io.rb
+++ b/bootstraptest/test_io.rb
@@ -53,7 +53,7 @@ assert_equal 'ok', %q{
STDIN.reopen(rw)
STDIN.reopen(save)
rw.close
- File.unlink(tmpname)
+ File.unlink(tmpname) unless RUBY_PLATFORM['nacl']
:ok
}
@@ -70,10 +70,16 @@ assert_equal 'ok', %q{
STDIN.print "a"
STDIN.reopen(save)
rw.close
- File.unlink(tmpname)
+ File.unlink(tmpname) unless RUBY_PLATFORM['nacl']
:ok
}
+assert_equal 'ok', %q{
+ dup = STDIN.dup
+ dupfd = dup.fileno
+ dupfd == STDIN.dup.fileno ? :ng : :ok
+}, '[ruby-dev:46834]'
+
assert_normal_exit %q{
ARGF.set_encoding "foo"
}
diff --git a/bootstraptest/test_literal.rb b/bootstraptest/test_literal.rb
index ab028e2c1e..b95a2f2d0a 100644
--- a/bootstraptest/test_literal.rb
+++ b/bootstraptest/test_literal.rb
@@ -65,8 +65,10 @@ assert_equal ':a3c', ':"a#{1+2}c".inspect'
assert_equal 'Symbol', ':"a#{1+2}c".class'
# xstring
-assert_equal "foo\n", %q(`echo foo`)
-assert_equal "foo\n", %q(s = "foo"; `echo #{s}`)
+unless nacl?
+ assert_equal "foo\n", %q(`echo foo`)
+ assert_equal "foo\n", %q(s = "foo"; `echo #{s}`)
+end
# regexp
assert_equal '', '//.source'
@@ -200,3 +202,30 @@ assert_equal 'ok', %q{
assert_equal 'ok', %q{
"#{}o""#{}k""#{}"
}, '[ruby-core:25284]'
+
+assert_equal 'ok', %q{ # long array literal
+ x = nil
+ eval "a = [#{(1..10_000).map{'x'}.join(", ")}]"
+ :ok
+}
+
+assert_equal 'ok', %q{ # long array literal (optimized)
+ eval "a = [#{(1..10_000).to_a.join(", ")}]"
+ :ok
+}
+
+assert_equal 'ok', %q{ # long hash literal
+ x = nil
+ eval "a = {#{(1..10_000).map{|n| "#{n} => x"}.join(', ')}}"
+ :ok
+}
+
+assert_equal 'ok', %q{ # long hash literal (optimized)
+ eval "a = {#{(1..10_000).map{|n| "#{n} => #{n}"}.join(', ')}}"
+ :ok
+}
+
+assert_equal 'ok', %q{
+ [print(:ok), exit] # void literal with side-effect
+ :dummy
+}
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 2baf33539d..4282bc6273 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)
@@ -1184,3 +1140,81 @@ assert_equal 'ok', %q{
'ok'
}, '[ruby-core:30534]'
+# should not cache when splat
+assert_equal 'ok', %q{
+ class C
+ attr_reader :a
+ def initialize
+ @a = 1
+ end
+ end
+
+ def m *args
+ C.new.a(*args)
+ end
+
+ m()
+ begin
+ m(1)
+ rescue ArgumentError
+ 'ok'
+ end
+}
+
+assert_equal 'DC', %q{
+ $result = []
+
+ class C
+ def foo *args
+ $result << 'C'
+ end
+ end
+ class D
+ def foo *args
+ $result << 'D'
+ end
+ end
+
+ o1 = $o1 = C.new
+ o2 = $o2 = D.new
+
+ args = Object.new
+ def args.to_a
+ test1 $o2, nil
+ []
+ end
+ def test1 o, args
+ o.foo(*args)
+ end
+ test1 o1, args
+ $result.join
+}
+
+assert_equal 'DC', %q{
+ $result = []
+
+ class C
+ def foo *args
+ $result << 'C'
+ end
+ end
+ class D
+ def foo *args
+ $result << 'D'
+ end
+ end
+
+ o1 = $o1 = C.new
+ o2 = $o2 = D.new
+
+ block = Object.new
+ def block.to_proc
+ test2 $o2, %w(a, b, c), nil
+ Proc.new{}
+ end
+ def test2 o, args, block
+ o.foo(*args, &block)
+ end
+ test2 o1, [], block
+ $result.join
+}
diff --git a/bootstraptest/test_proc.rb b/bootstraptest/test_proc.rb
index dfe89033d8..c23394e8d2 100644
--- a/bootstraptest/test_proc.rb
+++ b/bootstraptest/test_proc.rb
@@ -480,3 +480,4 @@ assert_equal 'ok', %q{
end
eval('yield', m)
}, '[Bug #5634]'
+
diff --git a/bootstraptest/test_syntax.rb b/bootstraptest/test_syntax.rb
index ef1c622ace..80eaa6416d 100644
--- a/bootstraptest/test_syntax.rb
+++ b/bootstraptest/test_syntax.rb
@@ -529,7 +529,7 @@ def assert_syntax_error expected, code, message = ''
end
assert_syntax_error "unterminated string meets end of file", '().."', '[ruby-dev:29732]'
assert_equal %q{[]}, %q{$&;[]}, '[ruby-dev:31068]'
-assert_syntax_error "syntax error, unexpected tSTAR, expecting '}'", %q{{*0}}, '[ruby-dev:31072]'
+assert_syntax_error "syntax error, unexpected *, expecting '}'", %q{{*0}}, '[ruby-dev:31072]'
assert_syntax_error "`@0' is not allowed as an instance variable name", %q{@0..0}, '[ruby-dev:31095]'
assert_syntax_error "identifier $00 is not valid to get", %q{$00..0}, '[ruby-dev:31100]'
assert_syntax_error "identifier $00 is not valid to set", %q{0..$00=1}
@@ -541,7 +541,7 @@ assert_equal %q{1}, %q{
assert_syntax_error "Can't set variable $1", %q{0..$1=1}, '[ruby-dev:31118]'
assert_valid_syntax %q{1.times{1+(1&&next)}}, '[ruby-dev:31119]'
assert_valid_syntax %q{x=-1;loop{x+=1&&redo if (x+=1).zero?}}, '[ruby-dev:31119]'
-assert_syntax_error %q{syntax error, unexpected $end}, %q{!}, '[ruby-dev:31243]'
+assert_syntax_error %q{syntax error, unexpected end-of-input}, %q{!}, '[ruby-dev:31243]'
assert_equal %q{[nil]}, %q{[()]}, '[ruby-dev:31252]'
assert_equal %q{true}, %q{!_=()}, '[ruby-dev:31263]'
assert_equal 'ok', %q{while true; redo; end if 1 == 2; :ok}, '[ruby-dev:31360]'
diff --git a/bootstraptest/test_thread.rb b/bootstraptest/test_thread.rb
index 2494cccbf3..c2b2b8ce9b 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 e.message =~ "can't create Thread"
+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{
@@ -189,18 +197,18 @@ assert_equal %q{11}, %q{
}.value + Thread.current[:a]
}
assert_normal_exit %q{
-begin
- 100.times do |i|
- begin
- th = Thread.start(Thread.current) {|u| u.raise }
- raise
- rescue
- ensure
- th.join
+ begin
+ 100.times do |i|
+ begin
+ th = Thread.start(Thread.current) {|u| u.raise }
+ raise
+ rescue
+ ensure
+ th.join
+ end
end
+ rescue
end
-rescue
-end
}, '[ruby-dev:31371]'
assert_equal 'true', %{
@@ -267,7 +275,7 @@ assert_normal_exit %q{
assert_equal 'ok', %q{
def m
- t = Thread.new { while true do // =~ "" end }
+ t = Thread.new { while true; // =~ "" end }
sleep 0.1
10.times {
if /((ab)*(ab)*)*(b)/ =~ "ab"*7
@@ -380,7 +388,9 @@ assert_equal 'ok', %q{
assert_equal 'ok', %q{
begin
- 10000.times { Thread.new(true) {|x| x == false } }
+ 100.times{
+ (1..100).map{ Thread.new(true) {|x| x == false } }.each{|th| th.join}
+ }
rescue NoMemoryError, StandardError
end
:ok
diff --git a/class.c b/class.c
index 02e682688c..8d237985b8 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 = malloc(sizeof(*entry));
+ 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 = malloc(sizeof(*entry));
+ 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;
+ }
+ free(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;
+ }
+
+ free(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,15 +154,22 @@ static ID id_attached;
static VALUE
class_alloc(VALUE flags, VALUE klass)
{
- rb_classext_t *ext = ALLOC(rb_classext_t);
- NEWOBJ(obj, struct RClass);
- OBJSETUP(obj, klass, flags);
- obj->ptr = ext;
+ 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_SET_SUPER((VALUE)obj, 0);
+ RCLASS_ORIGIN(obj) = (VALUE)obj;
RCLASS_IV_INDEX_TBL(obj) = 0;
+
+ RCLASS_EXT(obj)->subclasses = NULL;
+ RCLASS_EXT(obj)->parent_subclasses = NULL;
+ RCLASS_EXT(obj)->module_subclasses = NULL;
+ RCLASS_EXT(obj)->class_serial = rb_next_class_serial();
+
+ RCLASS_REFINED_CLASS(obj) = Qnil;
+ RCLASS_EXT(obj)->allocator = 0;
return (VALUE)obj;
}
@@ -76,7 +188,7 @@ rb_class_boot(VALUE super)
{
VALUE klass = class_alloc(T_CLASS, rb_cClass);
- RCLASS_SUPER(klass) = super;
+ RCLASS_SET_SUPER(klass, super);
RCLASS_M_TBL(klass) = st_init_numtable();
OBJ_INFECT(klass, super);
@@ -93,7 +205,7 @@ rb_class_boot(VALUE super)
void
rb_check_inheritable(VALUE super)
{
- if (TYPE(super) != T_CLASS) {
+ if (!RB_TYPE_P(super, T_CLASS)) {
rb_raise(rb_eTypeError, "superclass must be a Class (%s given)",
rb_obj_classname(super));
}
@@ -120,43 +232,72 @@ rb_class_new(VALUE super)
return rb_class_boot(super);
}
-struct clone_method_data {
- st_table *tbl;
- VALUE klass;
-};
-
-VALUE rb_iseq_clone(VALUE iseqval, VALUE newcbase);
+static void
+rewrite_cref_stack(NODE *node, VALUE old_klass, VALUE new_klass, NODE **new_cref_ptr)
+{
+ NODE *new_node;
+ while (node) {
+ if (node->nd_clss == old_klass) {
+ new_node = NEW_CREF(new_klass);
+ new_node->nd_next = node->nd_next;
+ *new_cref_ptr = new_node;
+ return;
+ }
+ new_node = NEW_CREF(node->nd_clss);
+ node = node->nd_next;
+ *new_cref_ptr = new_node;
+ new_cref_ptr = &new_node->nd_next;
+ }
+ *new_cref_ptr = NULL;
+}
-static int
-clone_method(ID mid, const rb_method_entry_t *me, struct clone_method_data *data)
+static void
+clone_method(VALUE klass, ID mid, const rb_method_entry_t *me)
{
VALUE newiseqval;
if (me->def && me->def->type == VM_METHOD_TYPE_ISEQ) {
rb_iseq_t *iseq;
- newiseqval = rb_iseq_clone(me->def->body.iseq->self, data->klass);
+ NODE *new_cref;
+ newiseqval = rb_iseq_clone(me->def->body.iseq->self, klass);
GetISeqPtr(newiseqval, iseq);
- rb_add_method(data->klass, mid, VM_METHOD_TYPE_ISEQ, iseq, me->flag);
+ rewrite_cref_stack(me->def->body.iseq->cref_stack, me->klass, klass, &new_cref);
+ OBJ_WRITE(iseq->self, &iseq->cref_stack, new_cref);
+ rb_add_method(klass, mid, VM_METHOD_TYPE_ISEQ, iseq, me->flag);
RB_GC_GUARD(newiseqval);
}
else {
- rb_method_entry_set(data->klass, mid, me, me->flag);
+ rb_method_entry_set(klass, mid, me, me->flag);
}
+}
+
+static int
+clone_method_i(st_data_t key, st_data_t value, st_data_t data)
+{
+ clone_method((VALUE)data, (ID)key, (const rb_method_entry_t *)value);
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);
+ OBJ_WRITTEN(arg->klass, Qundef, ce->value);
+ OBJ_WRITTEN(arg->klass, Qundef, ce->file);
+
+ st_insert(arg->tbl, key, (st_data_t)nce);
return ST_CONTINUE;
}
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
@@ -182,39 +323,41 @@ rb_mod_init_copy(VALUE clone, VALUE orig)
}
rb_obj_init_copy(clone, orig);
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(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__");
st_delete(RCLASS_IV_TBL(clone), &id, 0);
CONST_ID(id, "__classid__");
st_delete(RCLASS_IV_TBL(clone), &id, 0);
}
if (RCLASS_CONST_TBL(orig)) {
+ struct clone_const_arg arg;
if (RCLASS_CONST_TBL(clone)) {
rb_free_const_table(RCLASS_CONST_TBL(clone));
}
RCLASS_CONST_TBL(clone) = st_init_numtable();
- 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)) {
- struct clone_method_data data;
-
if (RCLASS_M_TBL(clone)) {
rb_free_m_table(RCLASS_M_TBL(clone));
}
- data.tbl = RCLASS_M_TBL(clone) = st_init_numtable();
- data.klass = clone;
- st_foreach(RCLASS_M_TBL(orig), clone_method,
- (st_data_t)&data);
+ RCLASS_M_TBL(clone) = st_init_numtable();
+ st_foreach(RCLASS_M_TBL(orig), clone_method_i, (st_data_t)clone);
}
return clone;
@@ -223,38 +366,48 @@ rb_mod_init_copy(VALUE clone, VALUE orig)
VALUE
rb_singleton_class_clone(VALUE obj)
{
+ return rb_singleton_class_clone_and_attach(obj, Qundef);
+}
+
+VALUE
+rb_singleton_class_clone_and_attach(VALUE obj, VALUE attach)
+{
VALUE klass = RBASIC(obj)->klass;
if (!FL_TEST(klass, FL_SINGLETON))
return klass;
else {
- struct clone_method_data data;
/* copy singleton(unnamed) class */
- VALUE clone = class_alloc((RBASIC(klass)->flags & ~(FL_MARK)), 0);
+ VALUE clone = class_alloc(RBASIC(klass)->flags, 0);
if (BUILTIN_TYPE(obj) == T_CLASS) {
- RBASIC(clone)->klass = (VALUE)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();
- data.tbl = RCLASS_M_TBL(clone);
- data.klass = (VALUE)clone;
- st_foreach(RCLASS_M_TBL(klass), clone_method,
- (st_data_t)&data);
- rb_singleton_class_attached(RBASIC(clone)->klass, (VALUE)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 (VALUE)clone;
+
+ return clone;
}
}
@@ -269,13 +422,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
@@ -284,6 +438,14 @@ rb_singleton_class_attached(VALUE klass, VALUE obj)
*/
#define META_CLASS_OF_CLASS_CLASS_P(k) (METACLASS_OF(k) == (k))
+/*!
+ * whether k has a metaclass
+ * @retval 1 if \a k has a metaclass
+ * @retval 0 otherwise
+ */
+#define HAVE_METACLASS_P(k) \
+ (FL_TEST(METACLASS_OF(k), FL_SINGLETON) && \
+ rb_ivar_get(METACLASS_OF(k), id_attached) == (k))
/*!
* ensures \a klass belongs to its own eigenclass.
@@ -293,7 +455,7 @@ rb_singleton_class_attached(VALUE klass, VALUE obj)
* @note this macro creates a new eigenclass if necessary.
*/
#define ENSURE_EIGENCLASS(klass) \
- (rb_ivar_get(METACLASS_OF(klass), id_attached) == (klass) ? METACLASS_OF(klass) : make_metaclass(klass))
+ (HAVE_METACLASS_P(klass) ? METACLASS_OF(klass) : make_metaclass(klass))
/*!
@@ -315,17 +477,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));
@@ -345,10 +508,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;
}
@@ -356,12 +519,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;
}
@@ -369,19 +530,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;
+ 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);
}
@@ -473,7 +631,7 @@ rb_define_class(const char *name, VALUE super)
id = rb_intern(name);
if (rb_const_defined(rb_cObject, id)) {
klass = rb_const_get(rb_cObject, id);
- if (TYPE(klass) != T_CLASS) {
+ if (!RB_TYPE_P(klass, T_CLASS)) {
rb_raise(rb_eTypeError, "%s is not a class", name);
}
if (rb_class_real(RCLASS_SUPER(klass)) != super) {
@@ -485,7 +643,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);
@@ -540,7 +698,7 @@ rb_define_class_id_under(VALUE outer, ID id, VALUE super)
if (rb_const_defined_at(outer, id)) {
klass = rb_const_get_at(outer, id);
- if (TYPE(klass) != T_CLASS) {
+ if (!RB_TYPE_P(klass, T_CLASS)) {
rb_raise(rb_eTypeError, "%s is not a class", rb_id2name(id));
}
if (rb_class_real(RCLASS_SUPER(klass)) != super) {
@@ -591,12 +749,12 @@ rb_define_module(const char *name)
id = rb_intern(name);
if (rb_const_defined(rb_cObject, id)) {
module = rb_const_get(rb_cObject, id);
- if (TYPE(module) == T_MODULE)
+ if (RB_TYPE_P(module, T_MODULE))
return module;
rb_raise(rb_eTypeError, "%s is not a module", rb_obj_classname(module));
}
module = rb_define_module_id(id);
- st_add_direct(rb_class_tbl, id, module);
+ rb_vm_add_root_module(id, module);
rb_const_set(rb_cObject, id, module);
return module;
@@ -615,7 +773,7 @@ rb_define_module_id_under(VALUE outer, ID id)
if (rb_const_defined_at(outer, id)) {
module = rb_const_get_at(outer, id);
- if (TYPE(module) == T_MODULE)
+ if (RB_TYPE_P(module, T_MODULE))
return module;
rb_raise(rb_eTypeError, "%s::%s is not a module",
rb_class2name(outer), rb_obj_classname(module));
@@ -628,8 +786,8 @@ rb_define_module_id_under(VALUE outer, ID id)
return module;
}
-static VALUE
-include_class_new(VALUE module, VALUE super)
+VALUE
+rb_include_class_new(VALUE module, VALUE super)
{
VALUE klass = class_alloc(T_ICLASS, rb_cClass);
@@ -644,13 +802,15 @@ 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(module);
- RCLASS_SUPER(klass) = super;
- if (TYPE(module) == T_ICLASS) {
- RBASIC(klass)->klass = RBASIC(module)->klass;
+
+ RCLASS_M_TBL(OBJ_WB_UNPROTECT(klass)) = RCLASS_M_TBL(OBJ_WB_UNPROTECT(RCLASS_ORIGIN(module)));
+
+ RCLASS_SET_SUPER(klass, super);
+ if (RB_TYPE_P(module, T_ICLASS)) {
+ 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);
@@ -658,28 +818,47 @@ include_class_new(VALUE module, VALUE super)
return (VALUE)klass;
}
+static int include_modules_at(const VALUE klass, VALUE c, VALUE module);
+
void
rb_include_module(VALUE klass, VALUE module)
{
- VALUE p, c;
int changed = 0;
rb_frozen_class_p(klass);
- if (!OBJ_UNTRUSTED(klass)) {
- rb_secure(4);
- }
- if (TYPE(module) != T_MODULE) {
+ if (!RB_TYPE_P(module, T_MODULE)) {
Check_Type(module, T_MODULE);
}
OBJ_INFECT(klass, module);
- c = klass;
+
+ changed = include_modules_at(klass, RCLASS_ORIGIN(klass), module);
+ if (changed < 0)
+ rb_raise(rb_eArgError, "cyclic include detected");
+}
+
+static int
+add_refined_method_entry_i(st_data_t key, st_data_t value, st_data_t data)
+{
+ rb_add_refined_method_entry((VALUE) data, (ID) key);
+ return ST_CONTINUE;
+}
+
+static int
+include_modules_at(const VALUE klass, VALUE c, VALUE module)
+{
+ 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) {
int superclass_seen = FALSE;
- if (RCLASS_M_TBL(klass) == RCLASS_M_TBL(module))
- rb_raise(rb_eArgError, "cyclic include detected");
+ if (RCLASS_ORIGIN(module) != module)
+ goto skip;
+ if (klass_m_tbl && klass_m_tbl == RCLASS_M_TBL(module))
+ return -1;
/* ignore if the module included already in superclasses */
for (p = RCLASS_SUPER(klass); p; p = RCLASS_SUPER(p)) {
switch (BUILTIN_TYPE(p)) {
@@ -696,15 +875,95 @@ rb_include_module(VALUE klass, VALUE module)
break;
}
}
- c = RCLASS_SUPER(c) = 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);
+
+ st_foreach(RMODULE_M_TBL(module), add_refined_method_entry_i,
+ (st_data_t) refined_class);
+ FL_SET(c, RMODULE_INCLUDED_INTO_REFINEMENT);
+ }
if (RMODULE_M_TBL(module) && 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);
}
- if (changed) rb_clear_cache();
+
+ if (method_changed) rb_clear_method_cache_by_class(klass);
+ if (constant_changed) rb_clear_constant_cache();
+
+ return method_changed;
+}
+
+static int
+move_refined_method(st_data_t key, st_data_t value, st_data_t data)
+{
+ rb_method_entry_t *me = (rb_method_entry_t *) value;
+ st_table *tbl = (st_table *) data;
+
+ if (me->def->type == VM_METHOD_TYPE_REFINED) {
+ if (me->def->body.orig_me) {
+ rb_method_entry_t *orig_me = me->def->body.orig_me, *new_me;
+ me->def->body.orig_me = NULL;
+ new_me = ALLOC(rb_method_entry_t);
+ *new_me = *me;
+ st_add_direct(tbl, key, (st_data_t) new_me);
+ *me = *orig_me;
+ xfree(orig_me);
+ return ST_CONTINUE;
+ }
+ else {
+ st_add_direct(tbl, key, (st_data_t) me);
+ return ST_DELETE;
+ }
+ }
+ else {
+ return ST_CONTINUE;
+ }
+}
+
+void
+rb_prepend_module(VALUE klass, VALUE module)
+{
+ void rb_vm_check_redefinition_by_prepend(VALUE klass);
+ VALUE origin;
+ int changed = 0;
+
+ rb_frozen_class_p(klass);
+
+ Check_Type(module, T_MODULE);
+
+ OBJ_INFECT(klass, module);
+
+ origin = RCLASS_ORIGIN(klass);
+ if (origin == klass) {
+ origin = class_alloc(T_ICLASS, klass);
+ OBJ_WB_UNPROTECT(origin); /* TODO: conservertive shading. Need more survery. */
+ 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();
+ st_foreach(RCLASS_M_TBL(origin), move_refined_method,
+ (st_data_t) RCLASS_M_TBL(klass));
+ }
+ changed = include_modules_at(klass, klass, module);
+ if (changed < 0)
+ rb_raise(rb_eArgError, "cyclic prepend detected");
+ if (changed) {
+ rb_vm_check_redefinition_by_prepend(klass);
+ }
}
/*
@@ -729,10 +988,13 @@ rb_mod_included_modules(VALUE mod)
{
VALUE ary = rb_ary_new();
VALUE p;
+ VALUE origin = RCLASS_ORIGIN(mod);
for (p = RCLASS_SUPER(mod); p; p = RCLASS_SUPER(p)) {
- if (BUILTIN_TYPE(p) == T_ICLASS) {
- rb_ary_push(ary, RBASIC(p)->klass);
+ if (p != origin && BUILTIN_TYPE(p) == T_ICLASS) {
+ VALUE m = RBASIC(p)->klass;
+ if (RB_TYPE_P(m, T_MODULE))
+ rb_ary_push(ary, m);
}
}
return ary;
@@ -793,12 +1055,10 @@ 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);
}
- else {
+ else if (p == RCLASS_ORIGIN(p)) {
rb_ary_push(ary, p);
}
}
@@ -860,10 +1120,10 @@ method_entry_i(st_data_t key, st_data_t value, st_data_t data)
st_table *list = (st_table *)data;
long type;
- if ((ID)key == ID_ALLOCATOR) {
- return ST_CONTINUE;
+ if (me && me->def->type == VM_METHOD_TYPE_REFINED) {
+ me = rb_resolve_refined_method(Qnil, me, NULL);
+ if (!me) return ST_CONTINUE;
}
-
if (!st_lookup(list, key, 0)) {
if (UNDEFINED_METHOD_ENTRY_P(me)) {
type = -1; /* none */
@@ -880,7 +1140,7 @@ 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))
{
VALUE ary;
- int recur;
+ int recur, prepended = 0;
st_table *list;
if (argc == 0) {
@@ -892,10 +1152,15 @@ class_instance_method_list(int argc, VALUE *argv, VALUE mod, int obj, int (*func
recur = RTEST(r);
}
+ if (!recur && RCLASS_ORIGIN(mod) != mod) {
+ mod = RCLASS_ORIGIN(mod);
+ prepended = 1;
+ }
+
list = st_init_numtable();
for (; mod; mod = RCLASS_SUPER(mod)) {
- st_foreach(RCLASS_M_TBL(mod), method_entry_i, (st_data_t)list);
- if (BUILTIN_TYPE(mod) == T_ICLASS) continue;
+ if (RCLASS_M_TBL(mod)) st_foreach(RCLASS_M_TBL(mod), method_entry_i, (st_data_t)list);
+ if (BUILTIN_TYPE(mod) == T_ICLASS && !prepended) continue;
if (obj && FL_TEST(mod, FL_SINGLETON)) continue;
if (!recur) break;
}
@@ -994,11 +1259,14 @@ rb_class_public_instance_methods(int argc, VALUE *argv, VALUE mod)
/*
* call-seq:
- * obj.methods -> 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>regular</i> parameter is set to <code>false</code>,
+ * Returns an array of obj's public and protected singleton methods,
+ * the array will not include methods in modules included in <i>obj</i>.
*
* class Klass
* def klass_method()
@@ -1009,6 +1277,14 @@ rb_class_public_instance_methods(int argc, VALUE *argv, VALUE mod)
* # :==~, :!, :eql?
* # :hash, :<=>, :class, :singleton_class]
* k.methods.length #=> 57
+ *
+ * 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
@@ -1016,9 +1292,6 @@ rb_obj_methods(int argc, VALUE *argv, VALUE obj)
{
retry:
if (argc == 0) {
- VALUE args[1];
-
- args[0] = Qtrue;
return class_instance_method_list(argc, argv, CLASS_OF(obj), 1, ins_methods_i);
}
else {
@@ -1114,8 +1387,8 @@ rb_obj_public_methods(int argc, VALUE *argv, VALUE obj)
VALUE
rb_obj_singleton_methods(int argc, 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;
@@ -1124,14 +1397,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)) {
- 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) || TYPE(klass) == T_ICLASS)) {
- st_foreach(RCLASS_M_TBL(klass), method_entry_i, (st_data_t)list);
+ while (klass && (FL_TEST(klass, FL_SINGLETON) || RB_TYPE_P(klass, T_ICLASS))) {
+ if (klass != origin && (mtbl = RCLASS_M_TBL(klass)) != 0)
+ st_foreach(mtbl, method_entry_i, (st_data_t)list);
klass = RCLASS_SUPER(klass);
}
}
@@ -1243,6 +1519,20 @@ rb_undef_method(VALUE klass, const char *name)
}\
} while (0)
+static inline VALUE
+special_singleton_class_of(VALUE obj)
+{
+ SPECIAL_SINGLETON(Qnil, rb_cNilClass);
+ SPECIAL_SINGLETON(Qfalse, rb_cFalseClass);
+ SPECIAL_SINGLETON(Qtrue, rb_cTrueClass);
+ return Qnil;
+}
+
+VALUE
+rb_special_singleton_class(VALUE obj)
+{
+ return special_singleton_class_of(obj);
+}
/*!
* \internal
@@ -1258,14 +1548,20 @@ singleton_class_of(VALUE obj)
{
VALUE klass;
- if (FIXNUM_P(obj) || SYMBOL_P(obj)) {
+ if (FIXNUM_P(obj) || FLONUM_P(obj) || SYMBOL_P(obj)) {
rb_raise(rb_eTypeError, "can't define singleton");
}
- if (rb_special_const_p(obj)) {
- SPECIAL_SINGLETON(Qnil, rb_cNilClass);
- SPECIAL_SINGLETON(Qfalse, rb_cFalseClass);
- SPECIAL_SINGLETON(Qtrue, rb_cTrueClass);
- rb_bug("unknown immediate %p", (void *)obj);
+ if (SPECIAL_CONST_P(obj)) {
+ klass = special_singleton_class_of(obj);
+ if (NIL_P(klass))
+ rb_bug("unknown immediate %p", (void *)obj);
+ return klass;
+ }
+ else {
+ enum ruby_value_type type = BUILTIN_TYPE(obj);
+ if (type == T_FLOAT || type == T_BIGNUM) {
+ rb_raise(rb_eTypeError, "can't define singleton");
+ }
}
if (FL_TEST(RBASIC(obj)->klass, FL_SINGLETON) &&
@@ -1282,17 +1578,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);
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.
@@ -1317,7 +1627,7 @@ rb_singleton_class(VALUE obj)
VALUE klass = singleton_class_of(obj);
/* ensures an exposed class belongs to its own eigenclass */
- if (TYPE(obj) == T_CLASS) (void)ENSURE_EIGENCLASS(klass);
+ if (RB_TYPE_P(obj, T_CLASS)) (void)ENSURE_EIGENCLASS(klass);
return klass;
}
@@ -1402,7 +1712,7 @@ rb_define_attr(VALUE klass, const char *name, int read, int write)
int
rb_obj_basic_to_s_p(VALUE obj)
{
- const rb_method_entry_t *me = rb_method_entry(CLASS_OF(obj), rb_intern("to_s"));
+ const rb_method_entry_t *me = rb_method_entry(CLASS_OF(obj), rb_intern("to_s"), 0);
if (me && me->def && me->def->type == VM_METHOD_TYPE_CFUNC &&
me->def->body.cfunc.func == rb_any_to_s)
return 1;
@@ -1475,7 +1785,7 @@ rb_scan_args(int argc, const VALUE *argv, const char *fmt, ...)
argc--;
}
else {
- hash = rb_check_convert_type(last, T_HASH, "Hash", "to_hash");
+ hash = rb_check_hash_type(last);
if (!NIL_P(hash))
argc--;
}
@@ -1533,18 +1843,12 @@ rb_scan_args(int argc, const VALUE *argv, const char *fmt, ...)
}
va_end(vargs);
- if (argi < argc)
- goto argc_error;
+ if (argi < argc) {
+ argc_error:
+ rb_error_arity(argc, n_mand, f_var ? UNLIMITED_ARGUMENTS : n_mand + n_opt);
+ }
return argc;
-
- argc_error:
- if (0 < n_opt)
- rb_raise(rb_eArgError, "wrong number of arguments (%d for %d..%d%s)",
- argc, n_mand, n_mand + n_opt, f_var ? "+" : "");
- else
- rb_raise(rb_eArgError, "wrong number of arguments (%d for %d%s)",
- argc, n_mand, f_var ? "+" : "");
}
/*!
diff --git a/common.mk b/common.mk
index ccc964701e..e94c4756ea 100644
--- a/common.mk
+++ b/common.mk
@@ -2,41 +2,38 @@ bin: $(PROGRAM) $(WPROGRAM)
lib: $(LIBRUBY)
dll: $(LIBRUBY_SO)
-.SUFFIXES: .inc .h .c .y .i
+.SUFFIXES: .inc .h .c .y .i .$(DTRACE_EXT)
# V=0 quiet, V=1 verbose. other values don't work.
V = 0
Q1 = $(V:1=)
Q = $(Q1:0=@)
-n=$(NULLCMD)
-ECHO1 = $(V:1=@$n)
ECHO = $(ECHO1:0=@echo)
-RUBYLIB = -
+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
STATIC_RUBY = static-ruby
EXTCONF = extconf.rb
-RBCONFIG = ./.rbconfig.time
LIBRUBY_EXTS = ./.libruby-with-ext.time
REVISION_H = ./.revision.time
PLATFORM_D = ./$(PLATFORM_DIR)/.time
RDOCOUT = $(EXTOUT)/rdoc
CAPIOUT = doc/capi
-ID_H_TARGET = -id.h-
DMYEXT = dmyext.$(OBJEXT)
NORMALMAINOBJ = main.$(OBJEXT)
MAINOBJ = $(NORMALMAINOBJ)
-EXTOBJS =
+EXTOBJS =
DLDOBJS = $(DMYEXT)
-MINIOBJS = $(ARCHMINIOBJS) dmyencoding.$(OBJEXT) dmyversion.$(OBJEXT) miniprelude.$(OBJEXT)
+EXTSOLIBS =
+MINIOBJS = $(ARCHMINIOBJS) miniinit.$(OBJEXT) miniprelude.$(OBJEXT)
ENC_MK = enc.mk
COMMONOBJS = array.$(OBJEXT) \
@@ -46,6 +43,7 @@ COMMONOBJS = array.$(OBJEXT) \
complex.$(OBJEXT) \
dir.$(OBJEXT) \
dln_find.$(OBJEXT) \
+ encoding.$(OBJEXT) \
enum.$(OBJEXT) \
enumerator.$(OBJEXT) \
error.$(OBJEXT) \
@@ -87,30 +85,32 @@ COMMONOBJS = array.$(OBJEXT) \
transcode.$(OBJEXT) \
util.$(OBJEXT) \
variable.$(OBJEXT) \
+ version.$(OBJEXT) \
compile.$(OBJEXT) \
debug.$(OBJEXT) \
iseq.$(OBJEXT) \
vm.$(OBJEXT) \
vm_dump.$(OBJEXT) \
+ vm_backtrace.$(OBJEXT) \
+ vm_trace.$(OBJEXT) \
thread.$(OBJEXT) \
cont.$(OBJEXT) \
$(BUILTIN_ENCOBJS) \
$(BUILTIN_TRANSOBJS) \
$(MISSING)
-EXPORTOBJS = dln.$(OBJEXT) \
- encoding.$(OBJEXT) \
- version.$(OBJEXT) \
+EXPORTOBJS = $(DLNOBJ) \
+ localeinit.$(OBJEXT) \
+ loadpath.$(OBJEXT) \
$(COMMONOBJS)
OBJS = $(EXPORTOBJS) prelude.$(OBJEXT)
+ALLOBJS = $(NORMALMAINOBJ) $(MINIOBJS) $(COMMONOBJS) $(DMYEXT)
GOLFOBJS = goruby.$(OBJEXT) golf_prelude.$(OBJEXT)
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
@@ -120,7 +120,7 @@ SCRIPT_ARGS = --dest-dir="$(DESTDIR)" \
--make-flags="$(MAKEFLAGS)"
EXTMK_ARGS = $(SCRIPT_ARGS) --extension $(EXTS) --extstatic $(EXTSTATIC) \
--make-flags="V=$(V) MINIRUBY='$(MINIRUBY)'" --
-INSTRUBY = $(SUDO) $(MINIRUBY) $(srcdir)/tool/rbinstall.rb
+INSTRUBY = $(SUDO) $(RUNRUBY) -r./$(arch)-fake $(srcdir)/tool/rbinstall.rb
INSTRUBY_ARGS = $(SCRIPT_ARGS) \
--data-mode=$(INSTALL_DATA_MODE) \
--prog-mode=$(INSTALL_PROG_MODE) \
@@ -143,7 +143,7 @@ COMPILE_PRELUDE = $(MINIRUBY) -I$(srcdir) $(srcdir)/tool/compile_prelude.rb
all: showflags main docs
-main: showflags encs exts
+main: showflags $(EXTSTATIC:static=lib)encs exts
@$(NULLCMD)
.PHONY: showflags
@@ -159,46 +159,47 @@ 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
EXTS_MK = exts.mk
-$(EXTS_MK): $(MKFILES) incs $(PREP) $(RBCONFIG) $(LIBRUBY)
- @$(MINIRUBY) $(srcdir)/ext/extmk.rb --make="$(MAKE)" --command-output=$(EXTS_MK) $(EXTMK_ARGS) configure
+$(EXTS_MK): $(MKFILES) all-incs $(PREP) $(RBCONFIG) $(LIBRUBY)
+ $(ECHO) generating makefile $@
+ $(Q)$(MINIRUBY) $(srcdir)/ext/extmk.rb --make="$(MAKE)" --command-output=$(EXTS_MK) $(EXTMK_ARGS) configure
configure-ext: $(EXTS_MK)
build-ext: $(EXTS_MK)
- $(Q)$(MAKE) -f $(EXTS_MK) $(MFLAGS)
+ $(Q)$(MAKE) -f $(EXTS_MK) $(MFLAGS) $(EXTSTATIC) LIBRUBY_EXTS=$(LIBRUBY_EXTS) ENCOBJS="$(ENCOBJS)"
-$(MKMAIN_CMD): $(MKFILES) incs $(PREP) $(RBCONFIG) $(LIBRUBY)
- @$(MINIRUBY) $(srcdir)/ext/extmk.rb --make="$(MAKE)" --command-output=$@ $(EXTMK_ARGS)
+$(MKMAIN_CMD): $(MKFILES) all-incs $(PREP) $(RBCONFIG) $(LIBRUBY)
+ $(Q)$(MINIRUBY) $(srcdir)/ext/extmk.rb --make="$(MAKE)" --command-output=$@ $(EXTMK_ARGS)
prog: program wprogram
-loadpath: $(PREP) PHONY
- $(MINIRUBY) -e 'p $$:'
-
$(PREP): $(MKFILES)
-miniruby$(EXEEXT): config.status $(NORMALMAINOBJ) $(MINIOBJS) $(COMMONOBJS) $(DMYEXT) $(ARCHFILE)
+miniruby$(EXEEXT): config.status $(ALLOBJS) $(ARCHFILE) $(DTRACE_OBJ)
+
+objs: $(ALLOBJS)
GORUBY = go$(RUBY_INSTALL_NAME)
golf: $(LIBRUBY) $(GOLFOBJS) PHONY
$(Q) $(MAKE) $(MFLAGS) MAINOBJ="$(GOLFOBJS)" PROGRAM=$(GORUBY)$(EXEEXT) program
capi: $(CAPIOUT)/.timestamp PHONY
-doc/capi/.timestamp: Doxyfile $(PREP)
- $(Q) $(MAKEDIRS) doc/capi
+$(CAPIOUT)/.timestamp: Doxyfile $(PREP)
+ $(Q) $(MAKEDIRS) "$(@D)"
$(ECHO) generating capi
$(Q) $(DOXYGEN) -b
- $(Q) $(MINIRUBY) -e 'File.open("$(CAPIOUT)/.timestamp", "w"){|f| f.puts(Time.now)}'
+ $(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)
$(ECHO) generating $@
@@ -207,10 +208,11 @@ Doxyfile: $(srcdir)/template/Doxyfile.tmpl $(PREP) $(srcdir)/tool/generic_erb.rb
program: showflags $(PROGRAM)
wprogram: showflags $(WPROGRAM)
+mini: PHONY miniruby$(EXEEXT)
-$(PROGRAM): $(LIBRUBY) $(MAINOBJ) $(OBJS) $(EXTOBJS) $(SETUP) $(PREP)
+$(PROGRAM) $(WPROGRAM): $(LIBRUBY) $(MAINOBJ) $(OBJS) $(EXTOBJS) $(SETUP) $(PREP)
-$(LIBRUBY_A): $(OBJS) $(DMYEXT) $(ARCHFILE)
+$(LIBRUBY_A): $(OBJS) $(MAINOBJ) $(DTRACE_OBJ) $(DTRACE_GLOMMED_OBJ) $(DMYEXT) $(ARCHFILE)
$(LIBRUBY_SO): $(OBJS) $(DLDOBJS) $(LIBRUBY_A) $(PREP) $(LIBRUBY_SO_UPDATE) $(BUILTIN_ENCOBJS)
@@ -218,11 +220,11 @@ $(LIBRUBY_EXTS):
@exit > $@
$(STATIC_RUBY)$(EXEEXT): $(MAINOBJ) $(DLDOBJS) $(EXTOBJS) $(LIBRUBY_A)
- @$(RM) $@
+ $(Q)$(RM) $@
$(PURIFY) $(CC) $(MAINOBJ) $(DLDOBJS) $(EXTOBJS) $(LIBRUBY_A) $(MAINLIBS) $(EXTLIBS) $(LIBS) $(OUTFLAG)$@ $(LDFLAGS) $(XLDFLAGS)
ruby.imp: $(EXPORTOBJS)
- @$(NM) -Pgp $(EXPORTOBJS) | \
+ $(Q)$(NM) -Pgp $(EXPORTOBJS) | \
awk 'BEGIN{print "#!"}; $$2~/^[BDT]$$/&&$$1!~/^(Init_|.*_threadptr_|\.)/{print $$1}' | \
sort -u -o $@
@@ -246,20 +248,20 @@ 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: $(PREP)
+do-install-local: $(PROGRAM)
$(INSTRUBY) --make="$(MAKE)" $(INSTRUBY_ARGS) --install=local
post-install-local:: post-install-bin post-install-lib post-install-man
install-ext: pre-install-ext do-install-ext post-install-ext
pre-install-ext:: pre-install-ext-arch pre-install-ext-comm
-do-install-ext: $(PREP)
+do-install-ext: exts
$(INSTRUBY) --make="$(MAKE)" $(INSTRUBY_ARGS) --install=ext
post-install-ext:: post-install-ext-arch post-install-ext-comm
install-arch: pre-install-arch do-install-arch post-install-arch
pre-install-arch:: pre-install-bin pre-install-ext-arch
do-install-arch: main
- $(INSTRUBY) --make="$(MAKE)" $(INSTRUBY_ARGS) --install=bin --install=ext-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
@@ -270,7 +272,7 @@ 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: $(PREP)
+do-install-bin: $(PROGRAM)
$(INSTRUBY) --make="$(MAKE)" $(INSTRUBY_ARGS) --install=bin
post-install-bin::
@$(NULLCMD)
@@ -284,14 +286,14 @@ post-install-lib::
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: $(PREP)
+do-install-ext-comm: exts
$(INSTRUBY) --make="$(MAKE)" $(INSTRUBY_ARGS) --install=ext-comm
post-install-ext-comm::
@$(NULLCMD)
install-ext-arch: pre-install-ext-arch do-install-ext-arch post-install-ext-arch
pre-install-ext-arch:: install-prereq
-do-install-ext-arch: $(PREP)
+do-install-ext-arch: exts
$(INSTRUBY) --make="$(MAKE)" $(INSTRUBY_ARGS) --install=ext-arch
post-install-ext-arch::
@$(NULLCMD)
@@ -320,6 +322,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)
+ $(Q)$(SUDO) $(MINIRUBY) $(srcdir)/tool/rbuninstall.rb --destdir=$(DESTDIR) $(INSTALLED_LIST)
+
+reinstall: 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
@@ -402,13 +409,30 @@ do-install-doc: $(PROGRAM)
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)
+ $(INSTRUBY) --make="$(MAKE)" $(INSTRUBY_ARGS) --install=gem
+post-install-gem::
+ @$(NULLCMD)
+
rdoc: PHONY main
@echo Generating RDoc documentation
- $(Q) $(XRUBY) "$(srcdir)/bin/rdoc" --encoding=UTF-8 --no-force-update --all --ri --op "$(RDOCOUT)" $(RDOCFLAGS) "$(srcdir)"
+ $(Q) $(XRUBY) "$(srcdir)/bin/rdoc" --root "$(srcdir)" --page-dir "$(srcdir)/doc" --encoding=UTF-8 --no-force-update --all --ri --op "$(RDOCOUT)" --debug $(RDOCFLAGS) "$(srcdir)"
rdoc-coverage: PHONY main
@echo Generating RDoc coverage report
- $(Q) $(XRUBY) "$(srcdir)/bin/rdoc" --encoding=UTF-8 --all --quiet -C $(RDOCFLAGS) "$(srcdir)"
+ $(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
@@ -422,19 +446,19 @@ post-no-install-doc::
CLEAR_INSTALLED_LIST = clear-installed-list
-install-prereq: $(CLEAR_INSTALLED_LIST) PHONY
+install-prereq: $(CLEAR_INSTALLED_LIST) yes-fake 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
- @$(RM) $(OBJS) $(MINIOBJS) $(MAINOBJ) $(LIBRUBY_A) $(LIBRUBY_SO) $(LIBRUBY) $(LIBRUBY_ALIASES)
- @$(RM) $(PROGRAM) $(WPROGRAM) miniruby$(EXEEXT) dmyext.$(OBJEXT) $(ARCHFILE) .*.time
- @$(RM) y.tab.c y.output encdb.h transdb.h prelude.c config.log rbconfig.rb $(ruby_pc)
+ $(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)
clean-ext:: PHONY
clean-golf: PHONY
- @$(RM) $(GORUBY)$(EXEEXT) $(GOLFOBJS)
+ $(Q)$(RM) $(GORUBY)$(EXEEXT) $(GOLFOBJS)
clean-rdoc: PHONY
clean-capi: PHONY
clean-platform: PHONY
@@ -443,12 +467,12 @@ clean-docs: clean-rdoc clean-capi
distclean: distclean-ext distclean-local distclean-enc distclean-golf distclean-extout distclean-platform
distclean-local:: clean-local
- @$(RM) $(MKFILES) yasmdata.rb *.inc
- @$(RM) config.cache config.status config.status.lineno $(PRELUDES)
- @$(RM) *~ *.bak *.stackdump core *.core gmon.out $(PREP)
+ $(Q)$(RM) $(MKFILES) yasmdata.rb *.inc
+ $(Q)$(RM) config.cache config.status config.status.lineno
+ $(Q)$(RM) *~ *.bak *.stackdump core *.core gmon.out $(PREP)
distclean-ext:: PHONY
distclean-golf: clean-golf
- @$(RM) $(GOLFPRELUDES)
+ $(Q)$(RM) $(GOLFPRELUDES)
distclean-rdoc: PHONY
distclean-capi: PHONY
distclean-extout: clean-extout
@@ -456,58 +480,67 @@ distclean-platform: clean-platform
realclean:: realclean-ext realclean-local realclean-enc realclean-golf realclean-extout
realclean-local:: distclean-local
- @$(RM) parse.c parse.h lex.c newline.c revision.h
-realclean-ext::
+ $(Q)$(RM) parse.c parse.h lex.c newline.c miniprelude.c revision.h
+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
+
clean-enc distclean-enc realclean-enc: PHONY
-check: test test-all
+check: main test test-all
+ $(ECHO) check succeeded
check-ruby: test test-ruby
-btest: miniruby$(EXEEXT) $(TEST_RUNNABLE)-btest
+fake: $(CROSS_COMPILING)-fake
+yes-fake: $(arch)-fake.rb $(RBCONFIG) PHONY
+no-fake: PHONY
+
+btest: $(TEST_RUNNABLE)-btest
no-btest: PHONY
-yes-btest: PHONY
- $(BOOTSTRAPRUBY) "$(srcdir)/bootstraptest/runner.rb" --ruby="$(MINIRUBY)" $(OPTS)
+yes-btest: fake miniruby$(EXEEXT) PHONY
+ $(BOOTSTRAPRUBY) "$(srcdir)/bootstraptest/runner.rb" --ruby="$(BTESTRUBY) $(RUN_OPTS)" $(OPTS) $(TESTOPTS)
-btest-ruby: miniruby$(EXEEXT) $(RBCONFIG) $(PROGRAM) $(TEST_RUNNABLE)-btest-ruby
+btest-ruby: $(TEST_RUNNABLE)-btest-ruby
no-btest-ruby: PHONY
-yes-btest-ruby: PHONY
- @$(RUNRUBY) "$(srcdir)/bootstraptest/runner.rb" --ruby="$(PROGRAM) -I$(srcdir)/lib" -q $(OPTS)
+yes-btest-ruby: prog PHONY
+ $(Q)$(RUNRUBY) "$(srcdir)/bootstraptest/runner.rb" --ruby="$(PROGRAM) -I$(srcdir)/lib $(RUN_OPTS)" -q $(OPTS) $(TESTOPTS)
-test-sample: miniruby$(EXEEXT) $(RBCONFIG) $(PROGRAM) $(TEST_RUNNABLE)-test-sample
+test-sample: $(TEST_RUNNABLE)-test-sample
no-test-sample: PHONY
-yes-test-sample: PHONY
- @$(RUNRUBY) $(srcdir)/tool/rubytest.rb
+yes-test-sample: prog PHONY
+ $(Q)$(RUNRUBY) $(srcdir)/tool/rubytest.rb --run-opt=$(RUN_OPTS) $(OPTS) $(TESTOPTS)
test-knownbugs: test-knownbug
-test-knownbug: miniruby$(EXEEXT) $(PROGRAM) $(RBCONFIG) $(TEST_RUNNABLE)-test-knownbug
+test-knownbug: $(TEST_RUNNABLE)-test-knownbug
no-test-knownbug: PHONY
-yes-test-knownbug: PHONY
- -$(RUNRUBY) "$(srcdir)/bootstraptest/runner.rb" --ruby="$(PROGRAM)" $(OPTS) $(srcdir)/KNOWNBUGS.rb
+yes-test-knownbug: prog PHONY
+ -$(RUNRUBY) "$(srcdir)/bootstraptest/runner.rb" --ruby="$(PROGRAM) $(RUN_OPTS)" $(OPTS) $(TESTOPTS) $(srcdir)/KNOWNBUGS.rb
test: test-sample btest-ruby test-knownbug
test-all: $(TEST_RUNNABLE)-test-all
-yes-test-all: PHONY
- $(RUNRUBY) "$(srcdir)/test/runner.rb" --ruby="$(RUNRUBY)" $(TESTS)
+yes-test-all: prog PHONY
+ $(RUNRUBY) "$(srcdir)/test/runner.rb" --ruby="$(RUNRUBY)" $(TESTOPTS) $(TESTS)
TESTS_BUILD = mkmf
no-test-all: PHONY
- $(MINIRUBY) -I"$(srcdir)/lib" "$(srcdir)/test/runner.rb" $(TESTS_BUILD)
+ $(MINIRUBY) -I"$(srcdir)/lib" "$(srcdir)/test/runner.rb" $(TESTOPTS) $(TESTS_BUILD)
test-ruby: $(TEST_RUNNABLE)-test-ruby
no-test-ruby: PHONY
-yes-test-ruby: PHONY
- $(RUNRUBY) "$(srcdir)/test/runner.rb" ruby
+yes-test-ruby: prog encs PHONY
+ $(RUNRUBY) "$(srcdir)/test/runner.rb" -q $(TESTOPTS) -- ruby -ext-
extconf: $(PREP)
$(Q) $(MAKEDIRS) "$(EXTCONFDIR)"
$(RUNRUBY) -C "$(EXTCONFDIR)" $(EXTCONF) $(EXTCONFARGS)
$(RBCONFIG): $(srcdir)/tool/mkconfig.rb config.status $(srcdir)/version.h $(PREP)
- @$(MINIRUBY) $(srcdir)/tool/mkconfig.rb -timestamp=$@ \
+ $(Q)$(MINIRUBY) $(srcdir)/tool/mkconfig.rb -timestamp=$@ \
-install_name=$(RUBY_INSTALL_NAME) \
-so_name=$(RUBY_SO_NAME) rbconfig.rb
@@ -516,18 +549,27 @@ test-rubyspec-precheck:
test-rubyspec: test-rubyspec-precheck
$(RUNRUBY) $(srcdir)/spec/mspec/bin/mspec run -B $(srcdir)/spec/default.mspec $(MSPECOPT)
+RUNNABLE = $(LIBRUBY_RELATIVE:no=un)-runnable
+runnable: $(RUNNABLE) prog $(srcdir)/tool/mkrunnable.rb PHONY
+ $(Q) $(MINIRUBY) $(srcdir)/tool/mkrunnable.rb -v $(EXTOUT)
+yes-runnable: PHONY
+
encs: enc trans
-encs enc trans: showflags $(ENC_MK) $(LIBRUBY) $(PREP)
+libencs: libenc libtrans
+encs enc trans libencs libenc libtrans: showflags $(ENC_MK) $(LIBRUBY) $(PREP)
$(ECHO) making $@
- $(Q) $(MAKE) -f $(ENC_MK) RUBY="$(MINIRUBY)" MINIRUBY="$(MINIRUBY)" $(MFLAGS) $@
+ $(Q) $(MAKE) -f $(ENC_MK) V="$(V)" \
+ RUBY="$(MINIRUBY)" MINIRUBY="$(MINIRUBY)" \
+ $(MFLAGS) $@
-enc: {$(VPATH)}encdb.h
-trans: {$(VPATH)}transdb.h
+
+libenc enc: {$(VPATH)}encdb.h
+libtrans trans: {$(VPATH)}transdb.h
$(ENC_MK): $(srcdir)/enc/make_encmake.rb $(srcdir)/enc/Makefile.in $(srcdir)/enc/depend \
- $(srcdir)/lib/mkmf.rb $(RBCONFIG)
+ $(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)" $@ $(ENCS)
+ $(Q) $(MINIRUBY) $(srcdir)/enc/make_encmake.rb --builtin-encs="$(BUILTIN_ENCOBJS)" --builtin-transes="$(BUILTIN_TRANSOBJS)" --module$(EXTSTATIC) $@ $(ENCS)
.PRECIOUS: $(MKFILES)
@@ -543,16 +585,35 @@ $(ENC_MK): $(srcdir)/enc/make_encmake.rb $(srcdir)/enc/Makefile.in $(srcdir)/enc
PHONY:
-{$(VPATH)}parse.c: {$(VPATH)}parse.y $(srcdir)/tool/ytab.sed
-parse.h {$(VPATH)}parse.h: {$(VPATH)}parse.c
+{$(VPATH)}parse.c: {$(VPATH)}parse.y $(srcdir)/tool/ytab.sed {$(VPATH)}id.h
+{$(VPATH)}parse.h: {$(VPATH)}parse.c
{$(srcdir)}.y.c:
- $(YACC) -d $(YFLAGS) -o y.tab.c $(SRC_FILE)
- 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
+ $(ECHO) generating $@
+ $(Q)$(BASERUBY) $(srcdir)/tool/id2token.rb --path-separator=.$(PATH_SEPARATOR)./ --vpath=$(VPATH) id.h $(SRC_FILE) > parse.tmp.y
+ $(Q)$(YACC) -d $(YFLAGS) -o y.tab.c parse.tmp.y
+ $(Q)$(RM) parse.tmp.y
+ $(Q)sed -f $(srcdir)/tool/ytab.sed -e "/^#/s!parse\.tmp\.[iy]!parse.y!" -e "/^#/s!y\.tab\.c!$@!" y.tab.c > $@.new
+ $(Q)$(MV) $@.new $@
+ $(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 > $@
+
+###
+
+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
+
+###
acosh.$(OBJEXT): {$(VPATH)}acosh.c
alloca.$(OBJEXT): {$(VPATH)}alloca.c {$(VPATH)}config.h
@@ -564,9 +625,12 @@ 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) $(hdrdir)/ruby.h
strchr.$(OBJEXT): {$(VPATH)}strchr.c
strdup.$(OBJEXT): {$(VPATH)}strdup.c
strerror.$(OBJEXT): {$(VPATH)}strerror.c
+strlcat.$(OBJEXT): {$(VPATH)}strlcat.c
+strlcpy.$(OBJEXT): {$(VPATH)}strlcpy.c
strstr.$(OBJEXT): {$(VPATH)}strstr.c
strtod.$(OBJEXT): {$(VPATH)}strtod.c
strtol.$(OBJEXT): {$(VPATH)}strtol.c
@@ -576,34 +640,18 @@ dl_os2.$(OBJEXT): {$(VPATH)}dl_os2.c
ia64.$(OBJEXT): {$(VPATH)}ia64.s
$(CC) $(CFLAGS) -c $<
-$(PLATFORM_D):
- $(Q) $(MAKEDIRS) $(PLATFORM_DIR)
- @exit > $@
-
-win32/win32.$(OBJEXT): {$(VPATH)}win32/win32.c $(RUBY_H_INCLUDES) $(PLATFORM_D)
-win32/file.$(OBJEXT): {$(VPATH)}win32/file.c $(RUBY_H_INCLUDES) $(PLATFORM_D)
-
###
-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
-ID_H_INCLUDES = {$(VPATH)}id.h {$(VPATH)}vm_opts.h
-VM_CORE_H_INCLUDES = {$(VPATH)}vm_core.h {$(VPATH)}thread_$(THREAD_MODEL).h \
- {$(VPATH)}node.h {$(VPATH)}method.h {$(VPATH)}ruby_atomic.h \
- $(ID_H_INCLUDES)
-
+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
+ $(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)}internal.h
+ {$(VPATH)}thread.h {$(VPATH)}internal.h
class.$(OBJEXT): {$(VPATH)}class.c $(RUBY_H_INCLUDES) \
- $(VM_CORE_H_INCLUDES) {$(VPATH)}debug.h {$(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
@@ -611,71 +659,69 @@ 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 $(ID_H_INCLUDES)
-enumerator.$(OBJEXT): {$(VPATH)}enumerator.c $(RUBY_H_INCLUDES)
+ {$(VPATH)}util.h {$(VPATH)}id.h {$(VPATH)}internal.h
+enumerator.$(OBJEXT): {$(VPATH)}enumerator.c $(RUBY_H_INCLUDES) \
+ {$(VPATH)}internal.h {$(VPATH)}node.h
error.$(OBJEXT): {$(VPATH)}error.c {$(VPATH)}known_errors.inc \
$(RUBY_H_INCLUDES) $(VM_CORE_H_INCLUDES) $(ENCODING_H_INCLUDES) \
- {$(VPATH)}debug.h \
- {$(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)}debug.h {$(VPATH)}gc.h {$(VPATH)}iseq.h \
- $(ENCODING_H_INCLUDES) {$(VPATH)}internal.h
+ {$(VPATH)}eval_jump.c {$(VPATH)}gc.h {$(VPATH)}iseq.h \
+ $(ENCODING_H_INCLUDES) {$(VPATH)}internal.h $(PROBES_H_INCLUDES) {$(VPATH)}vm_opts.h {$(VPATH)}probes_helper.h
load.$(OBJEXT): {$(VPATH)}load.c {$(VPATH)}eval_intern.h \
{$(VPATH)}util.h $(RUBY_H_INCLUDES) $(VM_CORE_H_INCLUDES) \
- {$(VPATH)}dln.h {$(VPATH)}debug.h \
- {$(VPATH)}internal.h
+ {$(VPATH)}dln.h {$(VPATH)}internal.h $(PROBES_H_INCLUDES) {$(VPATH)}vm_opts.h
file.$(OBJEXT): {$(VPATH)}file.c $(RUBY_H_INCLUDES) {$(VPATH)}io.h \
$(ENCODING_H_INCLUDES) {$(VPATH)}util.h {$(VPATH)}dln.h \
{$(VPATH)}internal.h
gc.$(OBJEXT): {$(VPATH)}gc.c $(RUBY_H_INCLUDES) {$(VPATH)}re.h \
{$(VPATH)}regex.h $(ENCODING_H_INCLUDES) $(VM_CORE_H_INCLUDES) \
{$(VPATH)}gc.h {$(VPATH)}io.h {$(VPATH)}eval_intern.h {$(VPATH)}util.h \
- {$(VPATH)}debug.h {$(VPATH)}internal.h {$(VPATH)}constant.h
+ {$(VPATH)}internal.h {$(VPATH)}constant.h \
+ {$(VPATH)}thread.h $(PROBES_H_INCLUDES) {$(VPATH)}vm_opts.h {$(VPATH)}debug.h
hash.$(OBJEXT): {$(VPATH)}hash.c $(RUBY_H_INCLUDES) {$(VPATH)}util.h \
- $(ENCODING_H_INCLUDES)
+ $(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
-main.$(OBJEXT): {$(VPATH)}main.c $(RUBY_H_INCLUDES) {$(VPATH)}debug.h \
- {$(VPATH)}node.h
+ {$(VPATH)}util.h $(ENCODING_H_INCLUDES) {$(VPATH)}dln.h \
+ {$(VPATH)}internal.h {$(VPATH)}thread.h {$(VPATH)}id.h {$(VPATH)}ruby_atomic.h
+main.$(OBJEXT): {$(VPATH)}main.c $(RUBY_H_INCLUDES) {$(VPATH)}node.h {$(VPATH)}vm_debug.h {$(VPATH)}vm_opts.h $(hdrdir)/ruby.h
marshal.$(OBJEXT): {$(VPATH)}marshal.c $(RUBY_H_INCLUDES) {$(VPATH)}io.h \
$(ENCODING_H_INCLUDES) {$(VPATH)}util.h {$(VPATH)}internal.h
math.$(OBJEXT): {$(VPATH)}math.c $(RUBY_H_INCLUDES) \
{$(VPATH)}internal.h
node.$(OBJEXT): {$(VPATH)}node.c $(RUBY_H_INCLUDES) \
- $(VM_CORE_H_INCLUDES) {$(VPATH)}debug.h
+ $(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)}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
+ {$(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) $(ID_H_INCLUDES) {$(VPATH)}regenc.h \
+ $(ENCODING_H_INCLUDES) {$(VPATH)}id.h {$(VPATH)}regenc.h \
{$(VPATH)}regex.h {$(VPATH)}util.h {$(VPATH)}lex.c \
{$(VPATH)}defs/keywords {$(VPATH)}id.c {$(VPATH)}parse.y \
- {$(VPATH)}parse.h \
- {$(VPATH)}internal.h
+ {$(VPATH)}parse.h {$(VPATH)}internal.h $(PROBES_H_INCLUDES) {$(VPATH)}vm_opts.h
proc.$(OBJEXT): {$(VPATH)}proc.c {$(VPATH)}eval_intern.h \
$(RUBY_H_INCLUDES) {$(VPATH)}gc.h $(VM_CORE_H_INCLUDES) \
- {$(VPATH)}debug.h {$(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)}debug.h {$(VPATH)}internal.h
+ $(VM_CORE_H_INCLUDES) {$(VPATH)}internal.h \
+ {$(VPATH)}thread.h {$(VPATH)}vm_opts.h
random.$(OBJEXT): {$(VPATH)}random.c $(RUBY_H_INCLUDES) \
- {$(VPATH)}siphash.c {$(VPATH)}siphash.h
+ {$(VPATH)}siphash.c {$(VPATH)}siphash.h {$(VPATH)}internal.h
range.$(OBJEXT): {$(VPATH)}range.c $(RUBY_H_INCLUDES) \
- $(ENCODING_H_INCLUDES) {$(VPATH)}internal.h
-rational.$(OBJEXT): {$(VPATH)}rational.c $(RUBY_H_INCLUDES) {$(VPATH)}internal.h
+ $(ENCODING_H_INCLUDES) {$(VPATH)}internal.h {$(VPATH)}id.h
+rational.$(OBJEXT): {$(VPATH)}rational.c $(RUBY_H_INCLUDES) {$(VPATH)}internal.h $(hdrdir)/ruby.h
re.$(OBJEXT): {$(VPATH)}re.c $(RUBY_H_INCLUDES) {$(VPATH)}re.h \
{$(VPATH)}regex.h $(ENCODING_H_INCLUDES) {$(VPATH)}util.h \
{$(VPATH)}regint.h {$(VPATH)}regenc.h {$(VPATH)}internal.h
@@ -695,88 +741,125 @@ 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)}debug.h {$(VPATH)}internal.h
-safe.$(OBJEXT): {$(VPATH)}safe.c $(RUBY_H_INCLUDES) \
- $(VM_CORE_H_INCLUDES) {$(VPATH)}debug.h
+ {$(VPATH)}dln.h {$(VPATH)}internal.h {$(VPATH)}vm_opts.h
+safe.$(OBJEXT): {$(VPATH)}safe.c $(RUBY_H_INCLUDES) $(VM_CORE_H_INCLUDES) {$(VPATH)}vm_opts.h {$(VPATH)}internal.h
signal.$(OBJEXT): {$(VPATH)}signal.c $(RUBY_H_INCLUDES) \
- $(VM_CORE_H_INCLUDES) {$(VPATH)}debug.h
+ $(VM_CORE_H_INCLUDES) {$(VPATH)}vm_opts.h {$(VPATH)}internal.h {$(VPATH)}ruby_atomic.h {$(VPATH)}eval_intern.h
sprintf.$(OBJEXT): {$(VPATH)}sprintf.c $(RUBY_H_INCLUDES) {$(VPATH)}re.h \
- {$(VPATH)}regex.h {$(VPATH)}vsnprintf.c $(ENCODING_H_INCLUDES)
+ {$(VPATH)}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
+ {$(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
+ {$(VPATH)}regex.h $(ENCODING_H_INCLUDES) {$(VPATH)}internal.h $(PROBES_H_INCLUDES) {$(VPATH)}vm_opts.h {$(VPATH)}node.h {$(VPATH)}ruby_atomic.h {$(VPATH)}vm_core.h {$(VPATH)}vm_debug.h {$(VPATH)}id.h {$(VPATH)}method.h {$(VPATH)}thread_$(THREAD_MODEL).h {$(VPATH)}thread_native.h
struct.$(OBJEXT): {$(VPATH)}struct.c $(RUBY_H_INCLUDES) {$(VPATH)}internal.h
thread.$(OBJEXT): {$(VPATH)}thread.c {$(VPATH)}eval_intern.h \
$(RUBY_H_INCLUDES) {$(VPATH)}gc.h $(VM_CORE_H_INCLUDES) \
- {$(VPATH)}debug.h {$(VPATH)}thread_$(THREAD_MODEL).c $(ENCODING_H_INCLUDES) \
- {$(VPATH)}internal.h {$(VPATH)}io.h
+ {$(VPATH)}thread_$(THREAD_MODEL).c $(ENCODING_H_INCLUDES) \
+ {$(VPATH)}internal.h {$(VPATH)}io.h {$(VPATH)}thread.h {$(VPATH)}timev.h {$(VPATH)}vm_opts.h
transcode.$(OBJEXT): {$(VPATH)}transcode.c $(RUBY_H_INCLUDES) \
$(ENCODING_H_INCLUDES) {$(VPATH)}transcode_data.h {$(VPATH)}internal.h
cont.$(OBJEXT): {$(VPATH)}cont.c $(RUBY_H_INCLUDES) \
$(VM_CORE_H_INCLUDES) {$(VPATH)}gc.h {$(VPATH)}eval_intern.h \
- {$(VPATH)}debug.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
-dmyversion.$(OBJEXT): {$(VPATH)}dmyversion.c version.$(OBJEXT)
+ $(srcdir)/include/ruby/version.h $(srcdir)/version.h $(srcdir)/revision.h {$(VPATH)}config.h
+loadpath.$(OBJEXT): {$(VPATH)}loadpath.c $(RUBY_H_INCLUDES) \
+ $(srcdir)/include/ruby/version.h $(srcdir)/version.h {$(VPATH)}config.h \
+ verconf.h
+localeinit.$(OBJEXT): {$(VPATH)}localeinit.c $(RUBY_H_INCLUDES) \
+ $(ENCODING_H_INCLUDES) {$(VPATH)}internal.h
+miniinit.$(OBJEXT): {$(VPATH)}miniinit.c $(RUBY_H_INCLUDES) \
+ $(ENCODING_H_INCLUDES)
compile.$(OBJEXT): {$(VPATH)}compile.c {$(VPATH)}iseq.h \
$(RUBY_H_INCLUDES) $(VM_CORE_H_INCLUDES) {$(VPATH)}insns.inc \
- {$(VPATH)}insns_info.inc {$(VPATH)}optinsn.inc {$(VPATH)}debug.h \
+ {$(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)}debug.h {$(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
vm.$(OBJEXT): {$(VPATH)}vm.c {$(VPATH)}gc.h {$(VPATH)}iseq.h \
{$(VPATH)}eval_intern.h $(RUBY_H_INCLUDES) $(ENCODING_H_INCLUDES) \
$(VM_CORE_H_INCLUDES) {$(VPATH)}vm_method.c {$(VPATH)}vm_eval.c \
{$(VPATH)}vm_insnhelper.c {$(VPATH)}vm_insnhelper.h {$(VPATH)}vm_exec.c \
{$(VPATH)}vm_exec.h {$(VPATH)}insns.def {$(VPATH)}vmtc.inc \
- {$(VPATH)}vm.inc {$(VPATH)}insns.inc {$(VPATH)}debug.h \
- {$(VPATH)}internal.h {$(VPATH)}vm.h {$(VPATH)}constant.h
+ {$(VPATH)}vm.inc {$(VPATH)}insns.inc \
+ {$(VPATH)}internal.h {$(VPATH)}vm.h {$(VPATH)}constant.h \
+ $(PROBES_H_INCLUDES) {$(VPATH)}probes_helper.h {$(VPATH)}vm_opts.h
vm_dump.$(OBJEXT): {$(VPATH)}vm_dump.c $(RUBY_H_INCLUDES) \
- $(VM_CORE_H_INCLUDES) {$(VPATH)}debug.h {$(VPATH)}addr2line.h
+ $(VM_CORE_H_INCLUDES) {$(VPATH)}addr2line.h \
+ {$(VPATH)}internal.h {$(VPATH)}vm_opts.h
debug.$(OBJEXT): {$(VPATH)}debug.c $(RUBY_H_INCLUDES) \
$(ENCODING_H_INCLUDES) $(VM_CORE_H_INCLUDES) {$(VPATH)}eval_intern.h \
- {$(VPATH)}util.h {$(VPATH)}debug.h
-id.$(OBJEXT): {$(VPATH)}id.c $(RUBY_H_INCLUDES) $(ID_H_INCLUDES)
+ {$(VPATH)}util.h {$(VPATH)}vm_opts.h {$(VPATH)}internal.h
+id.$(OBJEXT): {$(VPATH)}id.c $(RUBY_H_INCLUDES) {$(VPATH)}id.h {$(VPATH)}vm_opts.h
+vm_backtrace.$(OBJEXT): {$(VPATH)}vm_backtrace.c \
+ $(VM_CORE_H_INCLUDES) $(RUBY_H_INCLUDES) $(ENCODING_H_INCLUDES) \
+ {$(VPATH)}internal.h {$(VPATH)}iseq.h {$(VPATH)}debug.h {$(VPATH)}vm_opts.h {$(VPATH)}ruby_atomic.h {$(VPATH)}eval_intern.h
+vm_trace.$(OBJEXT): {$(VPATH)}vm_trace.c $(ENCODING_H_INCLUDES) \
+ $(VM_CORE_H_INCLUDES) $(RUBY_H_INCLUDES) {$(VPATH)}debug.h \
+ {$(VPATH)}internal.h {$(VPATH)}vm_opts.h {$(VPATH)}ruby_atomic.h {$(VPATH)}eval_intern.h
miniprelude.$(OBJEXT): {$(VPATH)}miniprelude.c $(RUBY_H_INCLUDES) \
- $(VM_CORE_H_INCLUDES) {$(VPATH)}debug.h {$(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)}debug.h {$(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)}debug.h {$(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)}debug.h {$(VPATH)}node.h
+ {$(VPATH)}vm_debug.h {$(VPATH)}node.h $(hdrdir)/ruby.h
+
+sizes.$(OBJEXT): {$(VPATH)}sizes.c $(RUBY_H_INCLUDES)
ascii.$(OBJEXT): {$(VPATH)}ascii.c {$(VPATH)}regenc.h {$(VPATH)}config.h \
- {$(VPATH)}oniguruma.h {$(VPATH)}missing.h
+ {$(VPATH)}oniguruma.h {$(VPATH)}missing.h $(RUBY_H_INCLUDES)
us_ascii.$(OBJEXT): {$(VPATH)}us_ascii.c {$(VPATH)}regenc.h \
- {$(VPATH)}config.h {$(VPATH)}oniguruma.h {$(VPATH)}missing.h
+ {$(VPATH)}config.h {$(VPATH)}oniguruma.h {$(VPATH)}missing.h $(RUBY_H_INCLUDES)
unicode.$(OBJEXT): {$(VPATH)}unicode.c {$(VPATH)}regint.h \
{$(VPATH)}config.h {$(VPATH)}defines.h {$(VPATH)}regenc.h \
{$(VPATH)}oniguruma.h {$(VPATH)}st.h {$(VPATH)}ruby.h \
- {$(VPATH)}missing.h {$(VPATH)}intern.h {$(VPATH)}enc/unicode/name2ctype.h \
- {$(VPATH)}subst.h
+ {$(VPATH)}missing.h {$(VPATH)}intern.h \
+ {$(VPATH)}enc/unicode/name2ctype.h {$(VPATH)}enc/unicode/casefold.h \
+ {$(VPATH)}subst.h $(RUBY_H_INCLUDES)
utf_8.$(OBJEXT): {$(VPATH)}utf_8.c {$(VPATH)}regenc.h {$(VPATH)}config.h \
- {$(VPATH)}oniguruma.h {$(VPATH)}missing.h
+ {$(VPATH)}oniguruma.h {$(VPATH)}missing.h $(RUBY_H_INCLUDES)
-newline.c: $(srcdir)/enc/trans/newline.trans $(srcdir)/tool/transcode-tblgen.rb
- $(Q) $(BASERUBY) "$(srcdir)/tool/transcode-tblgen.rb" -vo newline.c $(srcdir)/enc/trans/newline.trans
-newline.$(OBJEXT): {$(VPATH)}newline.c {$(VPATH)}defines.h \
+win32/win32.$(OBJEXT): {$(VPATH)}win32/win32.c {$(VPATH)}dln.h {$(VPATH)}dln_find.c \
+ {$(VPATH)}internal.h $(RUBY_H_INCLUDES) $(PLATFORM_D)
+win32/file.$(OBJEXT): {$(VPATH)}win32/file.c $(RUBY_H_INCLUDES) $(PLATFORM_D)
+
+$(NEWLINE_C): $(srcdir)/enc/trans/newline.trans $(srcdir)/tool/transcode-tblgen.rb
+ $(Q) $(BASERUBY) "$(srcdir)/tool/transcode-tblgen.rb" -vo $@ $(srcdir)/enc/trans/newline.trans
+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.in $(srcdir)/tool/generic_erb.rb $(RBCONFIG)
+ $(ECHO) creating $@
+ $(Q) $(MINIRUBY) "$(srcdir)/tool/generic_erb.rb" $(srcdir)/template/verconf.h.in > $@
+
+DTRACE_DEPENDENT_OBJS = array.$(OBJEXT) \
+ eval.$(OBJEXT) \
+ gc.$(OBJEXT) \
+ hash.$(OBJEXT) \
+ load.$(OBJEXT) \
+ object.$(OBJEXT) \
+ parse.$(OBJEXT) \
+ string.$(OBJEXT) \
+ vm.$(OBJEXT)
+
+probes.$(OBJEXT): $(DTRACE_DEPENDENT_OBJS)
+ruby-glommed.$(OBJEXT): $(OBJS) $(DTRACE_OBJ)
+
$(OBJS): {$(VPATH)}config.h {$(VPATH)}missing.h
INSNS2VMOPT = --srcdir="$(srcdir)"
@@ -797,9 +880,10 @@ INSNS2VMOPT = --srcdir="$(srcdir)"
{$(VPATH)}vm.inc: $(srcdir)/template/vm.inc.tmpl
-srcs: {$(VPATH)}parse.c {$(VPATH)}lex.c {$(VPATH)}newline.c srcs-ext srcs-enc
+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
+EXT_SRCS = $(srcdir)/ext/ripper/ripper.c $(srcdir)/ext/json/parser/parser.c \
+ $(srcdir)/ext/dl/callback/callback.c $(srcdir)/ext/rbconfig/sizeof/sizes.c
srcs-ext: $(EXT_SRCS)
@@ -807,15 +891,21 @@ srcs-enc: $(ENC_MK)
$(ECHO) making srcs under enc
$(Q) $(MAKE) -f $(ENC_MK) RUBY="$(MINIRUBY)" MINIRUBY="$(MINIRUBY)" $(MFLAGS) srcs
+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
+ $(srcdir)/revision.h $(REVISION_H) enc/unicode/name2ctype.h {$(VPATH)}id.h {$(VPATH)}probes.dmyh
insns: $(INSNS)
-id.h: parse.h $(srcdir)/tool/generic_erb.rb $(srcdir)/template/id.h.tmpl
+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/id.h.tmpl --vpath=$(VPATH) parse.h
+ $(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/id.c.tmpl
node_name.inc: {$(VPATH)}node.h
$(ECHO) generating $@
@@ -829,16 +919,19 @@ transdb.h: $(PREP) srcs-enc $(srcdir)/tool/generic_erb.rb $(srcdir)/template/tra
$(ECHO) generating $@
$(Q) $(MINIRUBY) $(srcdir)/tool/generic_erb.rb -c -o $@ $(srcdir)/template/transdb.h.tmpl $(srcdir)/enc/trans enc/trans
+enc/encinit.c: $(ENC_MK) $(srcdir)/enc/encinit.c.erb
+
known_errors.inc: $(srcdir)/template/known_errors.inc.tmpl $(srcdir)/defs/known_errors.def
$(ECHO) generating $@
$(Q) $(BASERUBY) $(srcdir)/tool/generic_erb.rb -c -o $@ $(srcdir)/template/known_errors.inc.tmpl $(srcdir)/defs/known_errors.def
-miniprelude.c: $(srcdir)/tool/compile_prelude.rb $(srcdir)/prelude.rb
+$(MINIPRELUDE_C): $(srcdir)/tool/compile_prelude.rb $(srcdir)/prelude.rb
$(ECHO) generating $@
$(Q) $(BASERUBY) -I$(srcdir) $(srcdir)/tool/compile_prelude.rb $(srcdir)/prelude.rb $@
prelude.c: $(srcdir)/tool/compile_prelude.rb $(RBCONFIG) \
- $(srcdir)/lib/rubygems/defaults.rb $(srcdir)/lib/rubygems/custom_require.rb \
+ $(srcdir)/lib/rubygems/defaults.rb \
+ $(srcdir)/lib/rubygems/core_ext/kernel_gem.rb \
$(PRELUDE_SCRIPTS) $(PREP)
$(ECHO) generating $@
$(Q) $(COMPILE_PRELUDE) $(PRELUDE_SCRIPTS) $@
@@ -847,6 +940,11 @@ golf_prelude.c: $(srcdir)/tool/compile_prelude.rb $(RBCONFIG) $(srcdir)/prelude.
$(ECHO) generating $@
$(Q) $(COMPILE_PRELUDE) $(srcdir)/golf_prelude.rb $@
+probes.dmyh: {$(srcdir)}probes.d $(srcdir)/tool/gen_dummy_probes.rb
+ $(BASERUBY) $(srcdir)/tool/gen_dummy_probes.rb $(srcdir)/probes.d > $@
+
+probes.h: {$(VPATH)}probes.$(DTRACE_EXT)
+
prereq: incs srcs preludes PHONY
preludes: {$(VPATH)}miniprelude.c
@@ -856,47 +954,64 @@ $(srcdir)/revision.h:
@exit > $@
$(REVISION_H): $(srcdir)/version.h $(srcdir)/ChangeLog $(srcdir)/tool/file2lastrev.rb $(REVISION_FORCE)
- @-$(BASERUBY) $(srcdir)/tool/file2lastrev.rb --revision.h "$(srcdir)" > "$(srcdir)/revision.tmp"
- @$(IFCHANGE) "--timestamp=$@" "$(srcdir)/revision.h" "$(srcdir)/revision.tmp"
+ -$(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=. 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 $@
$(Q) $(CHDIR) $(@D) && $(exec) $(MAKE) -f prereq.mk $(MFLAGS) \
- Q=$(Q) ECHO=$(ECHO) top_srcdir=../../.. srcdir=.
+ Q=$(Q) ECHO=$(ECHO) top_srcdir=../../.. srcdir=. VPATH=../../.. BASERUBY="$(BASERUBY)"
+
+$(srcdir)/ext/dl/callback/callback.c: $(srcdir)/ext/dl/callback/mkcallback.rb $(srcdir)/ext/dl/dl.h
+ $(ECHO) generating $@
+ $(Q) $(CHDIR) $(@D) && $(exec) $(MAKE) -f depend $(MFLAGS) \
+ Q=$(Q) ECHO=$(ECHO) top_srcdir=../.. srcdir=. VPATH=../.. RUBY="$(BASERUBY)"
+
+$(srcdir)/ext/rbconfig/sizeof/sizes.c: $(srcdir)/ext/rbconfig/sizeof/depend \
+ $(srcdir)/tool/generic_erb.rb $(srcdir)/template/sizes.c.tmpl $(srcdir)/configure.in
+ $(ECHO) generating $@
+ $(Q) $(CHDIR) $(@D) && $(exec) $(MAKE) -f depend $(MFLAGS) \
+ Q=$(Q) ECHO=$(ECHO) top_srcdir=../../.. srcdir=. VPATH=../../.. RUBY="$(BASERUBY)"
##
-run: miniruby$(EXEEXT) PHONY
- $(MINIRUBY) $(TESTRUN_SCRIPT) $(RUNOPT)
+run: fake miniruby$(EXEEXT) PHONY
+ $(BTESTRUBY) $(TESTRUN_SCRIPT) $(RUNOPT)
runruby: $(PROGRAM) PHONY
$(RUNRUBY) $(TESTRUN_SCRIPT)
-parse: miniruby$(EXEEXT) PHONY
- $(MINIRUBY) $(srcdir)/tool/parse.rb $(TESTRUN_SCRIPT)
+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 =
+ITEM =
+OPTS =
benchmark: $(PROGRAM) PHONY
$(BASERUBY) $(srcdir)/benchmark/driver.rb -v \
- --executables="$(COMPARE_RUBY); $(RUNRUBY)" \
+ --executables="$(COMPARE_RUBY); built-ruby::$(RUNRUBY)" \
--pattern='bm_' --directory=$(srcdir)/benchmark $(OPTS)
benchmark-each: $(PROGRAM) PHONY
$(BASERUBY) $(srcdir)/benchmark/driver.rb -v \
- --executables="$(COMPARE_RUBY); $(RUNRUBY)" \
+ --executables="$(COMPARE_RUBY); built-ruby::$(RUNRUBY)" \
--pattern=$(ITEM) --directory=$(srcdir)/benchmark $(OPTS)
tbench: $(PROGRAM) PHONY
$(BASERUBY) $(srcdir)/benchmark/driver.rb -v \
- --executables="$(COMPARE_RUBY); $(RUNRUBY)" \
+ --executables="$(COMPARE_RUBY); built-ruby::$(RUNRUBY)" \
--pattern='bmx_' --directory=$(srcdir)/benchmark $(OPTS)
run.gdb:
@@ -917,13 +1032,19 @@ gdb: miniruby$(EXEEXT) run.gdb PHONY
gdb -x run.gdb --quiet --args $(MINIRUBY) $(TESTRUN_SCRIPT)
gdb-ruby: $(PROGRAM) run.gdb PHONY
- gdb -x run.gdb --quiet --args $(PROGRAM) $(TESTRUN_SCRIPT)
+ $(Q) $(RUNRUBY_COMMAND) $(RUNRUBY_DEBUGGER) -- $(TESTRUN_SCRIPT)
dist:
$(BASERUBY) $(srcdir)/tool/make-snapshot tmp $(RELNAME)
up::
- -@$(MAKE) $(MFLAGS) REVISION_FORCE=PHONY "$(REVISION_H)"
+ -$(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:
@@ -941,6 +1062,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)
@@ -961,10 +1084,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" \
@@ -974,5 +1099,5 @@ help: PHONY
" golf: for golfers" \
"" \
"see DeveloperHowto for more detail: " \
- " http://redmine.ruby-lang.org/wiki/ruby/DeveloperHowto" \
+ " http://bugs.ruby-lang.org/wiki/ruby/DeveloperHowto" \
$(MESSAGE_END)
diff --git a/compar.c b/compar.c
index 65def78484..2f4db291a4 100644
--- a/compar.c
+++ b/compar.c
@@ -32,9 +32,36 @@ rb_cmperr(VALUE x, VALUE y)
}
static VALUE
+invcmp_recursive(VALUE x, VALUE y, int recursive)
+{
+ if (recursive) return Qnil;
+ return rb_check_funcall(y, cmp, 1, &x);
+}
+
+VALUE
+rb_invcmp(VALUE x, VALUE y)
+{
+ VALUE invcmp = rb_exec_recursive(invcmp_recursive, x, y);
+ if (invcmp == Qundef || NIL_P(invcmp)) {
+ return Qnil;
+ }
+ else {
+ int result = -rb_cmpint(invcmp, x, y);
+ return INT2FIX(result);
+ }
+}
+
+static VALUE
+cmp_eq_recursive(VALUE arg1, VALUE arg2, int recursive)
+{
+ if (recursive) return Qfalse;
+ return rb_funcallv(arg1, cmp, 1, &arg2);
+}
+
+static VALUE
cmp_eq(VALUE *a)
{
- VALUE c = rb_funcall(a[0], cmp, 1, a[1]);
+ VALUE c = rb_exec_recursive_paired_outer(cmp_eq_recursive, a[0], a[1], a[1]);
if (NIL_P(c)) return Qfalse;
if (rb_cmpint(c, a[0], a[1]) == 0) return Qtrue;
@@ -54,6 +81,9 @@ cmp_failed(void)
* Compares two objects based on the receiver's <code><=></code>
* method, returning true if it returns 0. Also returns true if
* _obj_ and _other_ are the same object.
+ *
+ * Even if _obj_ <=> _other_ raised an exception, the exception
+ * is ignored and returns false.
*/
static VALUE
diff --git a/compile.c b/compile.c
index bbc80e5ef5..2b58462d16 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))
@@ -51,7 +50,7 @@ typedef struct iseq_label_data {
typedef struct iseq_insn_data {
LINK_ELEMENT link;
enum ruby_vminsn_type insn_id;
- int line_no;
+ unsigned int line_no;
int operand_size;
int sc_state;
VALUE *operands;
@@ -128,7 +127,7 @@ struct iseq_compile_data_ensure_node_stack {
(ruby_debug_print_node(1, CPDEBUG, "", (NODE *)(node)), gl_node_level)), \
gl_node_level++)
-#define debug_node_end() gl_node_level --;
+#define debug_node_end() gl_node_level --
#else
@@ -165,11 +164,11 @@ r_value(VALUE value)
/* create new label */
#define NEW_LABEL(l) new_label_body(iseq, (l))
-#define iseq_filename(iseq) \
- (((rb_iseq_t*)DATA_PTR(iseq))->filename)
+#define iseq_path(iseq) \
+ (((rb_iseq_t*)DATA_PTR(iseq))->location.path)
-#define iseq_filepath(iseq) \
- (((rb_iseq_t*)DATA_PTR(iseq))->filepath)
+#define iseq_absolute_path(iseq) \
+ (((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))
@@ -185,16 +184,14 @@ r_value(VALUE value)
#define ADD_INSN(seq, line, insn) \
ADD_ELEM((seq), (LINK_ELEMENT *) new_insn_body(iseq, (line), BIN(insn), 0))
-/* add an instruction with label operand */
-#define ADD_INSNL(seq, line, insn, label) \
- ADD_ELEM((seq), (LINK_ELEMENT *) \
- new_insn_body(iseq, (line), BIN(insn), 1, (VALUE)(label)))
-
/* add an instruction with some operands (1, 2, 3, 5) */
#define ADD_INSN1(seq, line, insn, op1) \
ADD_ELEM((seq), (LINK_ELEMENT *) \
new_insn_body(iseq, (line), BIN(insn), 1, (VALUE)(op1)))
+/* add an instruction with label operand (alias of ADD_INSN1) */
+#define ADD_INSNL(seq, line, insn, label) ADD_INSN1(seq, line, insn, label)
+
#define ADD_INSN2(seq, line, insn, op1, op2) \
ADD_ELEM((seq), (LINK_ELEMENT *) \
new_insn_body(iseq, (line), BIN(insn), 2, (VALUE)(op1), (VALUE)(op2)))
@@ -211,10 +208,10 @@ r_value(VALUE value)
ADD_INSN((seq), (line), putself)
#define ADD_CALL(seq, line, id, argc) \
- ADD_SEND_R((seq), (line), (id), (argc), (VALUE)Qfalse, (VALUE)INT2FIX(VM_CALL_FCALL_BIT))
+ ADD_SEND_R((seq), (line), (id), (argc), (VALUE)Qfalse, (VALUE)INT2FIX(VM_CALL_FCALL))
#define ADD_CALL_WITH_BLOCK(seq, line, id, argc, block) \
- ADD_SEND_R((seq), (line), (id), (argc), (block), (VALUE)INT2FIX(VM_CALL_FCALL_BIT))
+ ADD_SEND_R((seq), (line), (id), (argc), (block), (VALUE)INT2FIX(VM_CALL_FCALL))
#define ADD_SEND_R(seq, line, id, argc, block, flag) \
ADD_ELEM((seq), (LINK_ELEMENT *) \
@@ -225,14 +222,14 @@ r_value(VALUE value)
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)); \
} \
if (iseq->compile_data->option->trace_instruction) { \
ADD_INSN1((seq), (line), trace, INT2FIX(event)); \
} \
- }while(0);
+ } while (0)
/* add label */
#define ADD_LABEL(seq, label) \
@@ -281,7 +278,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; \
+ OBJ_WRITE(iseq->self, &iseq->compile_data->err_info, GET_THREAD()->errinfo); \
GET_THREAD()->errinfo = tmp; \
ret = 0; \
break; \
@@ -301,7 +298,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
@@ -418,12 +415,12 @@ static int
iseq_add_mark_object(rb_iseq_t *iseq, VALUE v)
{
if (!SPECIAL_CONST_P(v)) {
- rb_ary_push(iseq->mark_ary, v);
+ rb_iseq_add_mark_object(iseq, v);
}
return COMPILE_OK;
}
-#define ruby_sourcefile RSTRING_PTR(iseq->filename)
+#define ruby_sourcefile RSTRING_PTR(iseq->location.path)
static int
iseq_add_mark_object_compile_time(rb_iseq_t *iseq, VALUE v)
@@ -444,6 +441,7 @@ validate_label(st_data_t name, st_data_t label, st_data_t arg)
int ret;
COMPILE_ERROR((ruby_sourcefile, lobj->position,
"%s: undefined label", rb_id2name((ID)name)));
+ if (ret) break;
} while (0);
}
return ST_CONTINUE;
@@ -476,37 +474,46 @@ rb_iseq_compile_node(VALUE self, NODE *node)
iseq_set_arguments(iseq, ret, node->nd_args);
switch (iseq->type) {
- case ISEQ_TYPE_BLOCK: {
- LABEL *start = iseq->compile_data->start_label = NEW_LABEL(0);
- LABEL *end = iseq->compile_data->end_label = NEW_LABEL(0);
-
- ADD_LABEL(ret, start);
- COMPILE(ret, "block body", node->nd_body);
- ADD_LABEL(ret, end);
-
- /* wide range catch handler must put at last */
- ADD_CATCH_ENTRY(CATCH_TYPE_REDO, start, end, 0, start);
- ADD_CATCH_ENTRY(CATCH_TYPE_NEXT, start, end, 0, end);
- break;
- }
- case ISEQ_TYPE_CLASS: {
- ADD_TRACE(ret, FIX2INT(iseq->line_no), RUBY_EVENT_CLASS);
- COMPILE(ret, "scoped node", node->nd_body);
- ADD_TRACE(ret, nd_line(node), RUBY_EVENT_END);
- break;
- }
- case ISEQ_TYPE_METHOD: {
- ADD_TRACE(ret, FIX2INT(iseq->line_no), RUBY_EVENT_CALL);
- COMPILE(ret, "scoped node", node->nd_body);
- ADD_TRACE(ret, nd_line(node), RUBY_EVENT_RETURN);
- break;
- }
+ case ISEQ_TYPE_BLOCK:
+ {
+ 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);
+ COMPILE(ret, "block body", node->nd_body);
+ ADD_LABEL(ret, end);
+ ADD_TRACE(ret, nd_line(node), RUBY_EVENT_B_RETURN);
+
+ /* wide range catch handler must put at last */
+ ADD_CATCH_ENTRY(CATCH_TYPE_REDO, start, end, 0, start);
+ ADD_CATCH_ENTRY(CATCH_TYPE_NEXT, start, end, 0, end);
+ break;
+ }
+ case ISEQ_TYPE_CLASS:
+ {
+ ADD_TRACE(ret, FIX2INT(iseq->location.first_lineno), RUBY_EVENT_CLASS);
+ COMPILE(ret, "scoped node", node->nd_body);
+ ADD_TRACE(ret, nd_line(node), RUBY_EVENT_END);
+ break;
+ }
+ case ISEQ_TYPE_METHOD:
+ {
+ ADD_TRACE(ret, FIX2INT(iseq->location.first_lineno), RUBY_EVENT_CALL);
+ COMPILE(ret, "scoped node", node->nd_body);
+ ADD_TRACE(ret, nd_line(node), RUBY_EVENT_RETURN);
+ break;
+ }
default: {
COMPILE(ret, "scoped node", node->nd_body);
break;
}
}
}
+ 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:
@@ -536,7 +543,7 @@ rb_iseq_compile_node(VALUE self, NODE *node)
}
if (iseq->type == ISEQ_TYPE_RESCUE || iseq->type == ISEQ_TYPE_ENSURE) {
- ADD_INSN2(ret, 0, getdynamic, INT2FIX(2), INT2FIX(0));
+ ADD_INSN2(ret, 0, getlocal, INT2FIX(2), INT2FIX(0));
ADD_INSN1(ret, 0, throw, INT2FIX(0) /* continue throw */ );
}
else {
@@ -936,20 +943,41 @@ new_insn_body(rb_iseq_t *iseq, int line_no, int insn_id, int argc, ...)
return new_insn_core(iseq, line_no, insn_id, argc, operands);
}
+static rb_call_info_t *
+new_callinfo(rb_iseq_t *iseq, ID mid, int argc, VALUE block, unsigned long flag)
+{
+ rb_call_info_t *ci = (rb_call_info_t *)compile_data_alloc(iseq, sizeof(rb_call_info_t));
+ ci->mid = mid;
+ ci->flag = flag;
+ ci->orig_argc = argc;
+ ci->argc = argc;
+
+ if (block) {
+ GetISeqPtr(block, ci->blockiseq);
+ }
+ else {
+ ci->blockiseq = 0;
+ if (!(ci->flag & (VM_CALL_ARGS_SPLAT | VM_CALL_ARGS_BLOCKARG))) {
+ ci->flag |= VM_CALL_ARGS_SKIP_SETUP;
+ }
+ }
+ ci->method_serial = 0;
+ ci->class_serial = 0;
+ ci->blockptr = 0;
+ ci->recv = Qundef;
+ ci->call = 0; /* TODO: should set default function? */
+
+ ci->aux.index = iseq->callinfo_size++;
+
+ return ci;
+}
+
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, VALUE id, VALUE argc, VALUE block, VALUE flag)
{
- INSN *iobj = 0;
- VALUE *operands =
- (VALUE *)compile_data_alloc(iseq, sizeof(VALUE) * 5);
- operands[0] = id;
- operands[1] = argc;
- operands[2] = block;
- operands[3] = flag;
- operands[4] = INT2FIX(iseq->ic_size++);
- iobj = new_insn_core(iseq, line_no, BIN(send), 5, operands);
- return iobj;
+ VALUE *operands = (VALUE *)compile_data_alloc(iseq, sizeof(VALUE) * 1);
+ operands[0] = (VALUE)new_callinfo(iseq, SYM2ID(id), FIX2INT(argc), block, FIX2INT(flag));
+ return new_insn_core(iseq, line_no, BIN(send), 1, operands);
}
static VALUE
@@ -959,8 +987,9 @@ new_child_iseq(rb_iseq_t *iseq, NODE *node,
VALUE ret;
debugs("[new_child_iseq]> ---------------------------------------\n");
- ret = rb_iseq_new_with_opt(node, name, iseq_filename(iseq->self), iseq_filepath(iseq->self), INT2FIX(line_no),
- parent, type, iseq->compile_data->option);
+ ret = rb_iseq_new_with_opt(node, name,
+ iseq_path(iseq->self), iseq_absolute_path(iseq->self),
+ INT2FIX(line_no), parent, type, iseq->compile_data->option);
debugs("[new_child_iseq]< ---------------------------------------\n");
iseq_add_mark_object(iseq, ret);
return ret;
@@ -1032,6 +1061,17 @@ iseq_set_exception_local_table(rb_iseq_t *iseq)
}
static int
+get_lvar_level(rb_iseq_t *iseq)
+{
+ int lev = 0;
+ while (iseq != iseq->local_iseq) {
+ lev++;
+ iseq = iseq->parent_iseq;
+ }
+ return lev;
+}
+
+static int
get_dyna_var_idx_at_raw(rb_iseq_t *iseq, ID id)
{
int i;
@@ -1085,52 +1125,34 @@ iseq_set_arguments(rb_iseq_t *iseq, LINK_ANCHOR *optargs, NODE *node_args)
debugs("iseq_set_arguments: %s\n", node_args ? "" : "0");
if (node_args) {
- NODE *node_aux = node_args->nd_next;
- NODE *node_opt = node_args->nd_opt;
+ struct rb_args_info *args = node_args->nd_ainfo;
ID rest_id = 0;
int last_comma = 0;
ID block_id = 0;
- NODE *node_init = 0;
if (nd_type(node_args) != NODE_ARGS) {
rb_bug("iseq_set_arguments: NODE_ARGS is expected, but %s",
ruby_node_name(nd_type(node_args)));
}
- /*
- * new argument information:
- * NODE_ARGS [m: int, o: NODE_OPT_ARG, ->]
- * NODE_ARGS_AUX [r: ID, b: ID, ->]
- * NODE_ARGS_AUX [Pst: id, Plen: int, init: NODE*]
- * optarg information:
- * NODE_OPT_ARGS [idx, expr, next ->]
- * init arg:
- * NODE_AND(m_init, p_init)
- * if "r" is 1, it's means "{|x,|}" type block parameter.
- */
- iseq->argc = (int)node_args->nd_frml;
+ iseq->argc = (int)args->pre_args_num;
debugs(" - argc: %d\n", iseq->argc);
- if (node_aux) {
- rest_id = node_aux->nd_rest;
- if (rest_id == 1) {
- last_comma = 1;
- rest_id = 0;
- }
- block_id = (ID)node_aux->nd_body;
- node_aux = node_aux->nd_next;
-
- if (node_aux) {
- ID post_start_id = node_aux->nd_pid;
- iseq->arg_post_start = get_dyna_var_idx_at_raw(iseq, post_start_id);
- iseq->arg_post_len = (int)node_aux->nd_plen;
- node_init = node_aux->nd_next;
- }
+ rest_id = args->rest_arg;
+ if (rest_id == 1) {
+ last_comma = 1;
+ rest_id = 0;
}
+ block_id = args->block_arg;
- if (node_opt) {
- NODE *node = node_opt;
+ if (args->first_post_arg) {
+ iseq->arg_post_start = get_dyna_var_idx_at_raw(iseq, args->first_post_arg);
+ iseq->arg_post_len = args->post_args_num;
+ }
+
+ if (args->opt_args) {
+ NODE *node = args->opt_args;
LABEL *label;
VALUE labels = rb_ary_tmp_new(1);
int i = 0, j;
@@ -1152,7 +1174,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;
}
@@ -1162,13 +1184,53 @@ iseq_set_arguments(rb_iseq_t *iseq, LINK_ANCHOR *optargs, NODE *node_args)
iseq->arg_opts = 0;
}
- if (node_init) {
- if (node_init->nd_1st) { /* m_init */
- COMPILE_POPED(optargs, "init arguments (m)", node_init->nd_1st);
+ if (args->kw_args) {
+ NODE *node = args->kw_args;
+ VALUE keywords = rb_ary_tmp_new(1);
+ VALUE required = 0;
+ int i = 0, j, r = 0;
+
+ iseq->arg_keyword = get_dyna_var_idx_at_raw(iseq, args->kw_rest_arg->nd_vid);
+ COMPILE(optargs, "kwarg", args->kw_rest_arg);
+ while (node) {
+ VALUE list = keywords;
+ if (node->nd_body->nd_value == (NODE *)-1) {
+ ++r;
+ if (!required) required = rb_ary_tmp_new(1);
+ list = required;
+ }
+ rb_ary_push(list, INT2FIX(node->nd_body->nd_vid));
+ COMPILE_POPED(optargs, "kwarg", node); /* nd_type(node) == NODE_KW_ARG */
+ node = node->nd_next;
+ i += 1;
}
- if (node_init->nd_2nd) { /* p_init */
- COMPILE_POPED(optargs, "init arguments (p)", node_init->nd_2nd);
+ iseq->arg_keyword_check = (args->kw_rest_arg->nd_vid & ID_SCOPE_MASK) == ID_JUNK;
+ iseq->arg_keywords = i;
+ iseq->arg_keyword_required = r;
+ iseq->arg_keyword_table = ALLOC_N(ID, i);
+ if (r) {
+ rb_ary_concat(required, keywords);
+ keywords = required;
+ }
+ for (j = 0; j < i; j++) {
+ iseq->arg_keyword_table[j] = FIX2INT(RARRAY_AREF(keywords, j));
}
+ ADD_INSN(optargs, nd_line(args->kw_args), pop);
+ }
+ else if (args->kw_rest_arg) {
+ iseq->arg_keyword = get_dyna_var_idx_at_raw(iseq, args->kw_rest_arg->nd_vid);
+ COMPILE(optargs, "kwarg", args->kw_rest_arg);
+ ADD_INSN(optargs, nd_line(args->kw_rest_arg), pop);
+ }
+ else {
+ iseq->arg_keyword = -1;
+ }
+
+ if (args->pre_init) { /* m_init */
+ COMPILE_POPED(optargs, "init arguments (m)", args->pre_init);
+ }
+ if (args->post_init) { /* p_init */
+ COMPILE_POPED(optargs, "init arguments (p)", args->post_init);
}
if (rest_id) {
@@ -1188,11 +1250,15 @@ iseq_set_arguments(rb_iseq_t *iseq, LINK_ANCHOR *optargs, NODE *node_args)
}
if (iseq->arg_opts != 0 || iseq->arg_post_len != 0 ||
- iseq->arg_rest != -1 || iseq->arg_block != -1) {
+ iseq->arg_rest != -1 || iseq->arg_block != -1 ||
+ iseq->arg_keyword != -1) {
iseq->arg_simple = 0;
/* set arg_size: size of arguments */
- if (iseq->arg_block != -1) {
+ if (iseq->arg_keyword != -1) {
+ iseq->arg_size = iseq->arg_keyword + 1;
+ }
+ else if (iseq->arg_block != -1) {
iseq->arg_size = iseq->arg_block + 1;
}
else if (iseq->arg_post_len) {
@@ -1214,7 +1280,8 @@ iseq_set_arguments(rb_iseq_t *iseq, LINK_ANCHOR *optargs, NODE *node_args)
}
if (iseq->type == ISEQ_TYPE_BLOCK) {
- if (iseq->arg_opts == 0 && iseq->arg_post_len == 0 && iseq->arg_rest == -1) {
+ if (iseq->arg_opts == 0 && iseq->arg_post_len == 0 &&
+ iseq->arg_rest == -1 && iseq->arg_keyword == -1) {
if (iseq->argc == 1 && last_comma == 0) {
/* {|a|} */
iseq->arg_simple |= 0x02;
@@ -1281,7 +1348,7 @@ static st_index_t
cdhash_hash(VALUE a)
{
if (SPECIAL_CONST_P(a)) return (st_index_t)a;
- if (TYPE(a) == T_STRING) return rb_str_hash(a);
+ if (RB_TYPE_P(a, T_STRING)) return rb_str_hash(a);
{
VALUE hval = rb_hash(a);
return (st_index_t)FIX2LONG(hval);
@@ -1293,6 +1360,21 @@ static const struct st_hash_type cdhash_type = {
cdhash_hash,
};
+struct cdhash_set_label_struct {
+ VALUE hash;
+ int pos;
+ int len;
+};
+
+static int
+cdhash_set_label_i(VALUE key, VALUE val, void *ptr)
+{
+ struct cdhash_set_label_struct *data = (struct cdhash_set_label_struct *)ptr;
+ LABEL *lobj = (LABEL *)(val & ~1);
+ rb_hash_aset(data->hash, key, INT2FIX(lobj->position - (data->pos+data->len)));
+ return ST_CONTINUE;
+}
+
/**
ruby insn object list -> raw instruction sequence
*/
@@ -1301,7 +1383,8 @@ iseq_set_sequence(rb_iseq_t *iseq, LINK_ANCHOR *anchor)
{
LABEL *lobj;
INSN *iobj;
- struct iseq_insn_info_entry *insn_info_table;
+ struct iseq_line_info_entry *line_info_table;
+ unsigned int last_line = 0;
LINK_ELEMENT *list;
VALUE *generated_iseq;
@@ -1344,7 +1427,7 @@ iseq_set_sequence(rb_iseq_t *iseq, LINK_ANCHOR *anchor)
default:
dump_disasm_list(FIRST_ELEMENT(anchor));
dump_disasm_list(list);
- rb_compile_error(RSTRING_PTR(iseq->filename), line,
+ rb_compile_error(RSTRING_PTR(iseq->location.path), line,
"error: set_sequence");
break;
}
@@ -1353,9 +1436,11 @@ iseq_set_sequence(rb_iseq_t *iseq, LINK_ANCHOR *anchor)
/* make instruction sequence */
generated_iseq = ALLOC_N(VALUE, pos);
- insn_info_table = ALLOC_N(struct iseq_insn_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);
+ line_info_table = ALLOC_N(struct iseq_line_info_entry, k);
+ iseq->is_entries = ALLOC_N(union iseq_inline_storage_entry, iseq->is_size);
+ MEMZERO(iseq->is_entries, union iseq_inline_storage_entry, iseq->is_size);
+ iseq->callinfo_entries = ALLOC_N(rb_call_info_t, iseq->callinfo_size);
+ /* MEMZERO(iseq->callinfo_entries, rb_call_info_t, iseq->callinfo_size); */
list = FIRST_ELEMENT(anchor);
k = pos = sp = 0;
@@ -1387,11 +1472,11 @@ iseq_set_sequence(rb_iseq_t *iseq, LINK_ANCHOR *anchor)
if (iobj->operand_size != len - 1) {
/* printf("operand size miss! (%d, %d)\n", iobj->operand_size, len); */
dump_disasm_list(list);
- rb_compile_error(RSTRING_PTR(iseq->filename), iobj->line_no,
+ rb_compile_error(RSTRING_PTR(iseq->location.path), iobj->line_no,
"operand size miss! (%d for %d)",
iobj->operand_size, len - 1);
xfree(generated_iseq);
- xfree(insn_info_table);
+ xfree(line_info_table);
return 0;
}
@@ -1404,50 +1489,29 @@ iseq_set_sequence(rb_iseq_t *iseq, LINK_ANCHOR *anchor)
/* label(destination position) */
lobj = (LABEL *)operands[j];
if (!lobj->set) {
- rb_compile_error(RSTRING_PTR(iseq->filename), iobj->line_no,
+ rb_compile_error(RSTRING_PTR(iseq->location.path), iobj->line_no,
"unknown label");
}
if (lobj->sp == -1) {
lobj->sp = sp;
}
- generated_iseq[pos + 1 + j] =
- lobj->position - (pos + len);
+ generated_iseq[pos + 1 + j] = lobj->position - (pos + len);
break;
}
case TS_CDHASH:
{
- /*
- * [obj, label, ...]
- */
- int i;
- VALUE lits = operands[j];
- VALUE map = rb_hash_new();
- RHASH_TBL(map)->type = &cdhash_type;
-
- for (i=0; i < RARRAY_LEN(lits); i+=2) {
- VALUE obj = rb_ary_entry(lits, i);
- VALUE lv = rb_ary_entry(lits, i+1);
- lobj = (LABEL *)(lv & ~1);
-
- if (!lobj->set) {
- rb_compile_error(RSTRING_PTR(iseq->filename), iobj->line_no,
- "unknown label");
- }
- if (!st_lookup(rb_hash_tbl(map), obj, 0)) {
- rb_hash_aset(map, obj, INT2FIX(lobj->position - (pos+len)));
- }
- else {
- rb_compile_warning(RSTRING_PTR(iseq->filename), iobj->line_no,
- "duplicated when clause is ignored");
- }
- }
+ VALUE map = operands[j];
+ struct cdhash_set_label_struct data;
+ data.hash = map;
+ data.pos = pos;
+ data.len = len;
+ rb_hash_foreach(map, cdhash_set_label_i, (VALUE)&data);
+
hide_obj(map);
generated_iseq[pos + 1 + j] = map;
- iseq_add_mark_object(iseq, map);
break;
}
case TS_LINDEX:
- case TS_DINDEX:
case TS_NUM: /* ulong */
generated_iseq[pos + 1 + j] = FIX2INT(operands[j]);
break;
@@ -1472,14 +1536,25 @@ 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;
}
+ case TS_CALLINFO: /* call info */
+ {
+ rb_call_info_t *base_ci = (rb_call_info_t *)operands[j];
+ rb_call_info_t *ci = &iseq->callinfo_entries[base_ci->aux.index];
+ *ci = *base_ci;
+
+ if (UNLIKELY(base_ci->aux.index >= iseq->callinfo_size)) {
+ rb_bug("iseq_set_sequence: ci_index overflow: index: %d, size: %d", base_ci->argc, iseq->callinfo_size);
+ }
+ generated_iseq[pos + 1 + j] = (VALUE)ci;
+ break;
+ }
case TS_ID: /* ID */
generated_iseq[pos + 1 + j] = SYM2ID(operands[j]);
break;
@@ -1491,18 +1566,19 @@ iseq_set_sequence(rb_iseq_t *iseq, LINK_ANCHOR *anchor)
}
break;
default:
- rb_compile_error(RSTRING_PTR(iseq->filename), iobj->line_no,
+ rb_compile_error(RSTRING_PTR(iseq->location.path), iobj->line_no,
"unknown operand type: %c", type);
xfree(generated_iseq);
- xfree(insn_info_table);
+ xfree(line_info_table);
return 0;
}
}
- insn_info_table[k].line_no = iobj->line_no;
- insn_info_table[k].position = pos;
- insn_info_table[k].sp = sp;
+ if (last_line != iobj->line_no) {
+ line_info_table[k].line_no = last_line = iobj->line_no;
+ line_info_table[k].position = pos;
+ k++;
+ }
pos += len;
- k++;
break;
}
case ISEQ_ELEMENT_LABEL:
@@ -1530,19 +1606,21 @@ iseq_set_sequence(rb_iseq_t *iseq, LINK_ANCHOR *anchor)
if (adjust->line_no != -1) {
if (orig_sp - sp > 0) {
- insn_info_table[k].line_no = adjust->line_no;
- insn_info_table[k].position = pos;
- insn_info_table[k].sp = sp;
- k++;
+ if (last_line != (unsigned int)adjust->line_no) {
+ line_info_table[k].line_no = last_line = adjust->line_no;
+ line_info_table[k].position = pos;
+ k++;
+ }
generated_iseq[pos++] = BIN(adjuststack);
generated_iseq[pos++] = orig_sp - sp;
}
else if (orig_sp - sp == 0) {
/* jump to next insn */
- insn_info_table[k].line_no = adjust->line_no;
- insn_info_table[k].position = pos;
- insn_info_table[k].sp = sp;
- k++;
+ if (last_line != (unsigned int)adjust->line_no) {
+ line_info_table[k].line_no = last_line = adjust->line_no;
+ line_info_table[k].position = pos;
+ k++;
+ }
generated_iseq[pos++] = BIN(jump);
generated_iseq[pos++] = 0;
}
@@ -1568,10 +1646,12 @@ iseq_set_sequence(rb_iseq_t *iseq, LINK_ANCHOR *anchor)
iseq->iseq = (void *)generated_iseq;
iseq->iseq_size = pos;
- iseq->insn_info_table = insn_info_table;
- iseq->insn_info_size = k;
iseq->stack_max = stack_max;
+ line_info_table = ruby_xrealloc(line_info_table, k * sizeof(struct iseq_line_info_entry));
+ iseq->line_info_table = line_info_table;
+ iseq->line_info_size = k;
+
return COMPILE_OK;
}
@@ -1590,18 +1670,18 @@ 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;
for (i = 0; i < tlen; i++) {
- ptr = RARRAY_PTR(tptr[i]);
+ ptr = RARRAY_CONST_PTR(tptr[i]);
entry = &iseq->catch_table[i];
entry->type = (enum catch_type)(ptr[0] & 0xffff);
entry->start = label_get_position((LABEL *)(ptr[1] & ~1));
@@ -1631,7 +1711,7 @@ iseq_set_exception_table(rb_iseq_t *iseq)
}
}
- iseq->compile_data->catch_table_ary = 0; /* free */
+ OBJ_WRITE(iseq->self, &iseq->compile_data->catch_table_ary, 0); /* free */
return COMPILE_OK;
}
@@ -1805,15 +1885,17 @@ iseq_peephole_optimize(rb_iseq_t *iseq, LINK_ELEMENT *list, const int do_tailcal
* send ...
* leave
* =>
- * send ..., ... | VM_CALL_TAILCALL_BIT, ...
+ * send ..., ... | VM_CALL_TAILCALL, ...
* 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->operands[2] == 0 /* block */
- ) {
- piobj->operands[3] = FIXNUM_OR(piobj->operands[3], VM_CALL_TAILCALL_BIT);
+ 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;
+ }
}
}
return COMPILE_OK;
@@ -1822,18 +1904,18 @@ iseq_peephole_optimize(rb_iseq_t *iseq, LINK_ELEMENT *list, const int do_tailcal
static int
insn_set_specialized_instruction(rb_iseq_t *iseq, INSN *iobj, int insn_id)
{
- int i, old_opsize = iobj->operand_size;
-
+ int old_opsize = iobj->operand_size;
iobj->insn_id = insn_id;
iobj->operand_size = insn_len(insn_id) - 1;
- /* printf("iobj->operand_size: %d\n", iobj->operand_size); */
if (iobj->operand_size > old_opsize) {
- iobj->operands = (VALUE *)compile_data_alloc(iseq, iobj->operand_size);
- }
-
- for (i=0; i<iobj->operand_size; i++) {
- iobj->operands[i] = INT2FIX(iseq->ic_size++);
+ VALUE *old_operands = iobj->operands;
+ if (insn_id != BIN(opt_neq)) {
+ rb_bug("insn_set_specialized_instruction: unknown insn: %d", insn_id);
+ }
+ iobj->operands = (VALUE *)compile_data_alloc(iseq, iobj->operand_size * sizeof(VALUE));
+ iobj->operands[0] = old_operands[0];
+ iobj->operands[1] = (VALUE)new_callinfo(iseq, idEq, 1, 0, 0);
}
return COMPILE_OK;
@@ -1843,72 +1925,45 @@ static int
iseq_specialized_instruction(rb_iseq_t *iseq, INSN *iobj)
{
if (iobj->insn_id == BIN(send)) {
- ID mid = SYM2ID(OPERAND_AT(iobj, 0));
- int argc = FIX2INT(OPERAND_AT(iobj, 1));
- VALUE block = OPERAND_AT(iobj, 2);
- VALUE flag = OPERAND_AT(iobj, 3);
-
- /* TODO: should be more sophisticated search */
- if (block == 0 && flag == INT2FIX(0)) {
- if (argc == 0) {
- if (mid == idLength) {
- insn_set_specialized_instruction(iseq, iobj, BIN(opt_length));
- }
- else if (mid == idSize) {
- insn_set_specialized_instruction(iseq, iobj, BIN(opt_size));
- }
- else if (mid == idSucc) {
- insn_set_specialized_instruction(iseq, iobj, BIN(opt_succ));
- }
- else if (mid == idNot) {
- insn_set_specialized_instruction(iseq, iobj, BIN(opt_not));
- }
- }
- else if (argc == 1) {
- if (0) {
+ rb_call_info_t *ci = (rb_call_info_t *)OPERAND_AT(iobj, 0);
+
+#define SP_INSN(opt) insn_set_specialized_instruction(iseq, iobj, BIN(opt_##opt))
+ if (ci->blockiseq == 0 && (ci->flag & ~VM_CALL_ARGS_SKIP_SETUP) == 0) {
+ switch (ci->orig_argc) {
+ case 0:
+ switch (ci->mid) {
+ case idLength: SP_INSN(length); return COMPILE_OK;
+ case idSize: SP_INSN(size); return COMPILE_OK;
+ case idEmptyP: SP_INSN(empty_p);return COMPILE_OK;
+ case idSucc: SP_INSN(succ); return COMPILE_OK;
+ case idNot: SP_INSN(not); return COMPILE_OK;
}
- else if (mid == idPLUS) {
- insn_set_specialized_instruction(iseq, iobj, BIN(opt_plus));
- }
- else if (mid == idMINUS) {
- insn_set_specialized_instruction(iseq, iobj, BIN(opt_minus));
- }
- else if (mid == idMULT) {
- insn_set_specialized_instruction(iseq, iobj, BIN(opt_mult));
- }
- else if (mid == idDIV) {
- insn_set_specialized_instruction(iseq, iobj, BIN(opt_div));
- }
- else if (mid == idMOD) {
- insn_set_specialized_instruction(iseq, iobj, BIN(opt_mod));
- }
- else if (mid == idEq) {
- insn_set_specialized_instruction(iseq, iobj, BIN(opt_eq));
- }
- else if (mid == idNeq) {
- insn_set_specialized_instruction(iseq, iobj, BIN(opt_neq));
- }
- else if (mid == idLT) {
- insn_set_specialized_instruction(iseq, iobj, BIN(opt_lt));
- }
- else if (mid == idLE) {
- insn_set_specialized_instruction(iseq, iobj, BIN(opt_le));
- }
- else if (mid == idGT) {
- insn_set_specialized_instruction(iseq, iobj, BIN(opt_gt));
- }
- else if (mid == idGE) {
- insn_set_specialized_instruction(iseq, iobj, BIN(opt_ge));
- }
- else if (mid == idLTLT) {
- insn_set_specialized_instruction(iseq, iobj, BIN(opt_ltlt));
- }
- else if (mid == idAREF) {
- insn_set_specialized_instruction(iseq, iobj, BIN(opt_aref));
+ break;
+ case 1:
+ switch (ci->mid) {
+ case idPLUS: SP_INSN(plus); return COMPILE_OK;
+ case idMINUS: SP_INSN(minus); return COMPILE_OK;
+ case idMULT: SP_INSN(mult); return COMPILE_OK;
+ case idDIV: SP_INSN(div); return COMPILE_OK;
+ case idMOD: SP_INSN(mod); return COMPILE_OK;
+ case idEq: SP_INSN(eq); return COMPILE_OK;
+ case idNeq: SP_INSN(neq); return COMPILE_OK;
+ case idLT: SP_INSN(lt); return COMPILE_OK;
+ case idLE: SP_INSN(le); return COMPILE_OK;
+ case idGT: SP_INSN(gt); return COMPILE_OK;
+ case idGE: SP_INSN(ge); return COMPILE_OK;
+ case idLTLT: SP_INSN(ltlt); return COMPILE_OK;
+ case idAREF: SP_INSN(aref); return COMPILE_OK;
}
+ break;
}
}
+ if (ci->flag & VM_CALL_ARGS_SKIP_SETUP) {
+ iobj->insn_id = BIN(opt_send_simple);
+ }
}
+#undef SP_INSN
+
return COMPILE_OK;
}
@@ -2057,7 +2112,7 @@ insn_set_sc_state(rb_iseq_t *iseq, INSN *iobj, int state)
dump_disasm_list((LINK_ELEMENT *)iobj);
dump_disasm_list((LINK_ELEMENT *)lobj);
printf("\n-- %d, %d\n", lobj->sc_state, nstate);
- rb_compile_error(RSTRING_PTR(iseq->filename), iobj->line_no,
+ rb_compile_error(RSTRING_PTR(iseq->location.path), iobj->line_no,
"insn_set_sc_state error\n");
return 0;
}
@@ -2159,7 +2214,7 @@ iseq_set_sequence_stackcaching(rb_iseq_t *iseq, LINK_ANCHOR *anchor)
case SCS_XX:
goto normal_insn;
default:
- rb_compile_error(RSTRING_PTR(iseq->filename), iobj->line_no,
+ rb_compile_error(RSTRING_PTR(iseq->location.path), iobj->line_no,
"unreachable");
}
/* remove useless pop */
@@ -2190,10 +2245,8 @@ iseq_set_sequence_stackcaching(rb_iseq_t *iseq, LINK_ANCHOR *anchor)
return COMPILE_OK;
}
-
-
static int
-compile_dstr_fragments(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int *cntp)
+compile_dstr_fragments(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE *node, int *cntp)
{
NODE *list = node->nd_next;
VALUE lit = node->nd_lit;
@@ -2207,7 +2260,14 @@ compile_dstr_fragments(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int *cntp
}
while (list) {
- COMPILE(ret, "each string", list->nd_head);
+ node = list->nd_head;
+ if (nd_type(node) == NODE_STR) {
+ hide_obj(node->nd_lit);
+ ADD_INSN1(ret, nd_line(node), putobject, node->nd_lit);
+ }
+ else {
+ COMPILE(ret, "each string", node);
+ }
cnt++;
list = list->nd_next;
}
@@ -2279,65 +2339,163 @@ compile_branch_condition(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * cond,
return COMPILE_OK;
}
+enum compile_array_type_t {
+ COMPILE_ARRAY_TYPE_ARRAY,
+ COMPILE_ARRAY_TYPE_HASH,
+ COMPILE_ARRAY_TYPE_ARGS
+};
+
static int
compile_array_(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE* node_root,
- VALUE opt_p, int poped)
+ enum compile_array_type_t type, int poped)
{
NODE *node = node_root;
- int len = (int)node->nd_alen, line = (int)nd_line(node), i=0;
- DECL_ANCHOR(anchor);
+ int line = (int)nd_line(node);
+ int len = 0;
+
+ if (nd_type(node) == NODE_ZARRAY) {
+ if (!poped) {
+ switch (type) {
+ case COMPILE_ARRAY_TYPE_ARRAY: ADD_INSN1(ret, line, newarray, INT2FIX(0)); break;
+ case COMPILE_ARRAY_TYPE_HASH: ADD_INSN1(ret, line, newhash, INT2FIX(0)); break;
+ case COMPILE_ARRAY_TYPE_ARGS: /* do nothing */ break;
+ }
+ }
+ }
+ else {
+ int opt_p = 1;
+ int first = 1, i;
- INIT_ANCHOR(anchor);
- if (nd_type(node) != NODE_ZARRAY) {
while (node) {
- if (nd_type(node) != NODE_ARRAY) {
- rb_bug("compile_array: This node is not NODE_ARRAY, but %s",
- ruby_node_name(nd_type(node)));
+ NODE *start_node = node, *end_node;
+ NODE *kw = 0;
+ const int max = 0x100;
+ DECL_ANCHOR(anchor);
+ INIT_ANCHOR(anchor);
+
+ for (i=0; i<max && node; i++, len++, node = node->nd_next) {
+ if (CPDEBUG > 0 && nd_type(node) != NODE_ARRAY) {
+ rb_bug("compile_array: This node is not NODE_ARRAY, but %s", ruby_node_name(nd_type(node)));
+ }
+
+ if (type == COMPILE_ARRAY_TYPE_HASH && !node->nd_head) {
+ opt_p = 0;
+ kw = node->nd_next;
+ node = kw->nd_next;
+ kw = kw->nd_head;
+ break;
+ }
+ if (opt_p && nd_type(node->nd_head) != NODE_LIT) {
+ opt_p = 0;
+ }
+
+ COMPILE_(anchor, "array element", node->nd_head, poped);
}
- i++;
- if (opt_p && nd_type(node->nd_head) != NODE_LIT) {
- opt_p = Qfalse;
+ if (opt_p && type != COMPILE_ARRAY_TYPE_ARGS) {
+ if (!poped) {
+ VALUE ary = rb_ary_tmp_new(i);
+
+ end_node = node;
+ node = start_node;
+
+ while (node != end_node) {
+ rb_ary_push(ary, node->nd_head->nd_lit);
+ node = node->nd_next;
+ }
+ while (node && nd_type(node->nd_head) == NODE_LIT &&
+ node->nd_next && nd_type(node->nd_next->nd_head) == NODE_LIT) {
+ rb_ary_push(ary, node->nd_head->nd_lit);
+ node = node->nd_next;
+ rb_ary_push(ary, node->nd_head->nd_lit);
+ node = node->nd_next;
+ len++;
+ }
+
+ OBJ_FREEZE(ary);
+
+ iseq_add_mark_object_compile_time(iseq, ary);
+
+ if (first) {
+ first = 0;
+ if (type == COMPILE_ARRAY_TYPE_ARRAY) {
+ ADD_INSN1(ret, line, duparray, ary);
+ }
+ 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));
+ }
+ }
+ else {
+ if (type == COMPILE_ARRAY_TYPE_ARRAY) {
+ ADD_INSN1(ret, line, putobject, ary);
+ ADD_INSN(ret, line, concatarray);
+ }
+ 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));
+ }
+ }
+ }
}
- COMPILE_(anchor, "array element", node->nd_head, poped);
- node = node->nd_next;
- }
- }
+ else {
+ if (!poped) {
+ switch (type) {
+ case COMPILE_ARRAY_TYPE_ARRAY:
+ ADD_INSN1(anchor, line, newarray, INT2FIX(i));
- if (len != i) {
- if (0) {
- rb_bug("node error: compile_array (%d: %d-%d)",
- (int)nd_line(node_root), len, i);
- }
- len = i;
- }
+ if (first) {
+ first = 0;
+ }
+ else {
+ ADD_INSN(anchor, line, concatarray);
+ }
- if (opt_p == Qtrue) {
- if (!poped) {
- VALUE ary = rb_ary_tmp_new(len);
- node = node_root;
- while (node) {
- rb_ary_push(ary, node->nd_head->nd_lit);
- node = node->nd_next;
+ APPEND_LIST(ret, anchor);
+ break;
+ case COMPILE_ARRAY_TYPE_HASH:
+ 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, ID2SYM(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));
+ if (i > 0 || !first) ADD_INSN(ret, line, swap);
+ COMPILE(ret, "keyword splat", kw);
+ ADD_SEND(ret, line, ID2SYM(id_core_hash_merge_kwd), nhash);
+ }
+ first = 0;
+ break;
+ case COMPILE_ARRAY_TYPE_ARGS:
+ APPEND_LIST(ret, anchor);
+ break;
+ }
+ }
+ else {
+ /* poped */
+ APPEND_LIST(ret, anchor);
+ }
}
- OBJ_FREEZE(ary);
- iseq_add_mark_object_compile_time(iseq, ary);
- ADD_INSN1(ret, nd_line(node_root), duparray, ary);
- }
- }
- else {
- if (!poped) {
- ADD_INSN1(anchor, line, newarray, INT2FIX(len));
}
- APPEND_LIST(ret, anchor);
}
return len;
}
static VALUE
-compile_array(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE* node_root, VALUE opt_p)
+compile_array(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE* node_root, enum compile_array_type_t type)
{
- return compile_array_(iseq, ret, node_root, opt_p, 0);
+ return compile_array_(iseq, ret, node_root, type, 0);
}
static VALUE
@@ -2347,7 +2505,7 @@ case_when_optimizable_literal(NODE * node)
case NODE_LIT: {
VALUE v = node->nd_lit;
double ival;
- if (TYPE(v) == T_FLOAT &&
+ if (RB_TYPE_P(v, T_FLOAT) &&
modf(RFLOAT_VALUE(v), &ival) == 0.0) {
return FIXABLE(ival) ? LONG2FIX((long)ival) : rb_dbl2big(ival);
}
@@ -2359,27 +2517,30 @@ case_when_optimizable_literal(NODE * node)
case NODE_STR:
return node->nd_lit;
}
- return Qfalse;
+ return Qundef;
}
-static VALUE
-when_vals(rb_iseq_t *iseq, LINK_ANCHOR *cond_seq, NODE *vals, LABEL *l1, VALUE special_literals)
+static int
+when_vals(rb_iseq_t *iseq, LINK_ANCHOR *cond_seq, NODE *vals, LABEL *l1, int only_special_literals, VALUE literals)
{
while (vals) {
- VALUE lit;
- NODE* val;
-
- val = vals->nd_head;
+ NODE* val = vals->nd_head;
+ VALUE lit = case_when_optimizable_literal(val);
- if (special_literals &&
- (lit = case_when_optimizable_literal(val)) != Qfalse) {
- rb_ary_push(special_literals, lit);
- rb_ary_push(special_literals, (VALUE)(l1) | 1);
+ if (lit == Qundef) {
+ only_special_literals = 0;
}
else {
- special_literals = Qfalse;
+ if (rb_hash_lookup(literals, lit) != Qnil) {
+ rb_compile_warning(RSTRING_PTR(iseq->location.path), nd_line(val), "duplicated when clause is ignored");
+ }
+ else {
+ rb_hash_aset(literals, lit, (VALUE)(l1) | 1);
+ }
}
+ ADD_INSN(cond_seq, nd_line(val), dup); /* dup target */
+
if (nd_type(val) == NODE_STR) {
debugp_param("nd_lit", val->nd_lit);
OBJ_FREEZE(val->nd_lit);
@@ -2388,12 +2549,12 @@ when_vals(rb_iseq_t *iseq, LINK_ANCHOR *cond_seq, NODE *vals, LABEL *l1, VALUE s
else {
COMPILE(cond_seq, "when cond", val);
}
- ADD_INSN1(cond_seq, nd_line(val), topn, INT2FIX(1));
- ADD_SEND(cond_seq, nd_line(val), ID2SYM(idEqq), INT2FIX(1));
+
+ ADD_INSN1(cond_seq, nd_line(vals), checkmatch, INT2FIX(VM_CHECKMATCH_TYPE_CASE));
ADD_INSNL(cond_seq, nd_line(val), branchif, l1);
vals = vals->nd_next;
}
- return special_literals;
+ return only_special_literals;
}
static int
@@ -2402,15 +2563,16 @@ compile_massign_lhs(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE *node)
switch (nd_type(node)) {
case NODE_ATTRASGN: {
INSN *iobj;
+ rb_call_info_t *ci;
VALUE dupidx;
COMPILE_POPED(ret, "masgn lhs (NODE_ATTRASGN)", node);
+
POP_ELEMENT(ret); /* pop pop insn */
iobj = (INSN *)POP_ELEMENT(ret); /* pop send insn */
-
- dupidx = iobj->operands[1];
- dupidx = FIXNUM_INC(dupidx, 1);
- iobj->operands[1] = dupidx;
+ ci = (rb_call_info_t *)iobj->operands[0];
+ ci->orig_argc += 1; ci->argc = ci->orig_argc;
+ dupidx = INT2FIX(ci->orig_argc);
ADD_INSN1(ret, nd_line(node), topn, dupidx);
ADD_ELEM(ret, (LINK_ELEMENT *)iobj);
@@ -2623,23 +2785,23 @@ static int
defined_expr(rb_iseq_t *iseq, LINK_ANCHOR *ret,
NODE *node, LABEL **lfinish, VALUE needstr)
{
- const char *estr = 0;
+ enum defined_type expr_type = 0;
enum node_type type;
switch (type = nd_type(node)) {
/* easy literals */
case NODE_NIL:
- estr = "nil";
+ expr_type = DEFINED_NIL;
break;
case NODE_SELF:
- estr = "self";
+ expr_type = DEFINED_SELF;
break;
case NODE_TRUE:
- estr = "true";
+ expr_type = DEFINED_TRUE;
break;
case NODE_FALSE:
- estr = "false";
+ expr_type = DEFINED_FALSE;
break;
case NODE_ARRAY:{
@@ -2660,13 +2822,13 @@ defined_expr(rb_iseq_t *iseq, LINK_ANCHOR *ret,
case NODE_AND:
case NODE_OR:
default:
- estr = "expression";
+ expr_type = DEFINED_EXPR;
break;
/* variables */
case NODE_LVAR:
case NODE_DVAR:
- estr = "local-variable";
+ expr_type = DEFINED_LVAR;
break;
case NODE_IVAR:
@@ -2788,16 +2950,14 @@ defined_expr(rb_iseq_t *iseq, LINK_ANCHOR *ret,
case NODE_CDECL:
case NODE_CVDECL:
case NODE_CVASGN:
- estr = "assignment";
+ expr_type = DEFINED_ASGN;
break;
}
- if (estr != 0) {
+ if (expr_type) {
if (needstr != Qfalse) {
- VALUE str = rb_str_new2(estr);
- hide_obj(str);
- ADD_INSN1(ret, nd_line(node), putstring, str);
- iseq_add_mark_object_compile_time(iseq, str);
+ VALUE str = rb_iseq_defined_string(expr_type);
+ ADD_INSN1(ret, nd_line(node), putobject, str);
}
else {
ADD_INSN1(ret, nd_line(node), putobject, Qtrue);
@@ -2821,7 +2981,7 @@ defined_expr(rb_iseq_t *iseq, LINK_ANCHOR *ret,
VALUE rescue = NEW_CHILD_ISEQVAL(NEW_NIL(),
rb_str_concat(rb_str_new2
("defined guard in "),
- iseq->name),
+ iseq->location.label),
ISEQ_TYPE_DEFINED_GUARD, 0);
APPEND_LABEL(ret, lcur, lstart);
ADD_LABEL(ret, lend);
@@ -2848,10 +3008,10 @@ make_name_for_block(rb_iseq_t *iseq)
}
if (level == 1) {
- return rb_sprintf("block in %s", RSTRING_PTR(ip->name));
+ return rb_sprintf("block in %"PRIsVALUE, ip->location.label);
}
else {
- return rb_sprintf("block (%d levels) in %s", level, RSTRING_PTR(ip->name));
+ return rb_sprintf("block (%d levels) in %"PRIsVALUE, level, ip->location.label);
}
}
@@ -2931,7 +3091,7 @@ setup_args(rb_iseq_t *iseq, LINK_ANCHOR *args, NODE *argn, VALUE *flag)
INIT_ANCHOR(args_splat);
if (argn && nd_type(argn) == NODE_BLOCK_PASS) {
COMPILE(arg_block, "block", argn->nd_body);
- *flag |= VM_CALL_ARGS_BLOCKARG_BIT;
+ *flag |= VM_CALL_ARGS_BLOCKARG;
argn = argn->nd_head;
}
@@ -2942,7 +3102,7 @@ setup_args(rb_iseq_t *iseq, LINK_ANCHOR *args, NODE *argn, VALUE *flag)
COMPILE(args, "args (splat)", argn->nd_head);
argc = INT2FIX(1);
nsplat++;
- *flag |= VM_CALL_ARGS_SPLAT_BIT;
+ *flag |= VM_CALL_ARGS_SPLAT;
break;
}
case NODE_ARGSCAT:
@@ -2965,11 +3125,10 @@ setup_args(rb_iseq_t *iseq, LINK_ANCHOR *args, NODE *argn, VALUE *flag)
}
INSERT_LIST(args_splat, tmp);
nsplat++;
- *flag |= VM_CALL_ARGS_SPLAT_BIT;
+ *flag |= VM_CALL_ARGS_SPLAT;
if (next_is_array) {
- argc = INT2FIX(compile_array(iseq, args, argn->nd_head, Qfalse) + 1);
- POP_ELEMENT(args);
+ argc = INT2FIX(compile_array(iseq, args, argn->nd_head, COMPILE_ARRAY_TYPE_ARGS) + 1);
}
else {
argn = argn->nd_head;
@@ -2978,8 +3137,7 @@ setup_args(rb_iseq_t *iseq, LINK_ANCHOR *args, NODE *argn, VALUE *flag)
break;
}
case NODE_ARRAY: {
- argc = INT2FIX(compile_array(iseq, args, argn, Qfalse));
- POP_ELEMENT(args);
+ argc = INT2FIX(compile_array(iseq, args, argn, COMPILE_ARRAY_TYPE_ARGS));
break;
}
default: {
@@ -2999,12 +3157,23 @@ setup_args(rb_iseq_t *iseq, LINK_ANCHOR *args, NODE *argn, VALUE *flag)
ADD_SEQ(args, args_splat);
}
- if (*flag & VM_CALL_ARGS_BLOCKARG_BIT) {
+ if (*flag & VM_CALL_ARGS_BLOCKARG) {
ADD_SEQ(args, arg_block);
}
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, ID2SYM(id_core_set_postexe), argc, block);
+ iseq_set_local_table(iseq, 0);
+ return Qnil;
+}
/**
compile each node
@@ -3017,6 +3186,8 @@ 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) {
if (!poped) {
@@ -3026,13 +3197,14 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
return COMPILE_OK;
}
- iseq->compile_data->last_line = (int)nd_line(node);
+ iseq->compile_data->last_line = line = (int)nd_line(node);
debug_node_start(node);
type = nd_type(node);
if (node->flags & NODE_FL_NEWLINE) {
- ADD_TRACE(ret, nd_line(node), RUBY_EVENT_LINE);
+ ADD_TRACE(ret, line, RUBY_EVENT_LINE);
+ saved_last_element = ret->last;
}
switch (type) {
@@ -3056,9 +3228,9 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
INIT_ANCHOR(cond_seq);
INIT_ANCHOR(then_seq);
INIT_ANCHOR(else_seq);
- then_label = NEW_LABEL(nd_line(node));
- else_label = NEW_LABEL(nd_line(node));
- end_label = NEW_LABEL(nd_line(node));
+ then_label = NEW_LABEL(line);
+ else_label = NEW_LABEL(line);
+ end_label = NEW_LABEL(line);
compile_branch_condition(iseq, cond_seq, node->nd_cond,
then_label, else_label);
@@ -3069,7 +3241,7 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
ADD_LABEL(ret, then_label);
ADD_SEQ(ret, then_seq);
- ADD_INSNL(ret, nd_line(node), jump, end_label);
+ ADD_INSNL(ret, line, jump, end_label);
ADD_LABEL(ret, else_label);
ADD_SEQ(ret, else_seq);
@@ -3085,11 +3257,15 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
DECL_ANCHOR(head);
DECL_ANCHOR(body_seq);
DECL_ANCHOR(cond_seq);
- VALUE special_literals = rb_ary_tmp_new(1);
+ int only_special_literals = 1;
+ VALUE literals = rb_hash_new();
INIT_ANCHOR(head);
INIT_ANCHOR(body_seq);
INIT_ANCHOR(cond_seq);
+
+ rb_hash_tbl_raw(literals)->type = &cdhash_type;
+
if (node->nd_head == 0) {
COMPILE_(ret, "when", node->nd_body, poped);
break;
@@ -3098,37 +3274,39 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
node = node->nd_body;
type = nd_type(node);
+ line = nd_line(node);
if (type != NODE_WHEN) {
COMPILE_ERROR((ERROR_ARGS "NODE_CASE: unexpected node. must be NODE_WHEN, but %s", ruby_node_name(type)));
}
- endlabel = NEW_LABEL(nd_line(node));
- elselabel = NEW_LABEL(nd_line(node));
+ endlabel = NEW_LABEL(line);
+ elselabel = NEW_LABEL(line);
ADD_SEQ(ret, head); /* case VAL */
while (type == NODE_WHEN) {
LABEL *l1;
- l1 = NEW_LABEL(nd_line(node));
+ l1 = NEW_LABEL(line);
ADD_LABEL(body_seq, l1);
- ADD_INSN(body_seq, nd_line(node), pop);
+ ADD_INSN(body_seq, line, pop);
COMPILE_(body_seq, "when body", node->nd_body, poped);
- ADD_INSNL(body_seq, nd_line(node), jump, endlabel);
+ ADD_INSNL(body_seq, line, jump, endlabel);
vals = node->nd_head;
if (vals) {
switch (nd_type(vals)) {
case NODE_ARRAY:
- special_literals = when_vals(iseq, cond_seq, vals, l1, special_literals);
+ only_special_literals = when_vals(iseq, cond_seq, vals, l1, only_special_literals, literals);
break;
case NODE_SPLAT:
case NODE_ARGSCAT:
case NODE_ARGSPUSH:
- special_literals = 0;
+ only_special_literals = 0;
+ ADD_INSN (cond_seq, nd_line(vals), dup);
COMPILE(cond_seq, "when/cond splat", vals);
- ADD_INSN1(cond_seq, nd_line(vals), checkincludearray, Qtrue);
+ ADD_INSN1(cond_seq, nd_line(vals), checkmatch, INT2FIX(VM_CHECKMATCH_TYPE_CASE | VM_CHECKMATCH_ARRAY));
ADD_INSNL(cond_seq, nd_line(vals), branchif, l1);
break;
default:
@@ -3145,13 +3323,14 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
break;
}
type = nd_type(node);
+ line = nd_line(node);
}
/* else */
if (node) {
ADD_LABEL(cond_seq, elselabel);
- ADD_INSN(cond_seq, nd_line(node), pop);
+ ADD_INSN(cond_seq, line, pop);
COMPILE_(cond_seq, "else", node, poped);
- ADD_INSNL(cond_seq, nd_line(node), jump, endlabel);
+ ADD_INSNL(cond_seq, line, jump, endlabel);
}
else {
debugs("== else (implicit)\n");
@@ -3163,11 +3342,11 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
ADD_INSNL(cond_seq, nd_line(tempnode), jump, endlabel);
}
- if (special_literals) {
+ if (only_special_literals) {
+ iseq_add_mark_object(iseq, literals);
+
ADD_INSN(ret, nd_line(tempnode), dup);
- ADD_INSN2(ret, nd_line(tempnode), opt_case_dispatch,
- special_literals, elselabel);
- iseq_add_mark_object_compile_time(iseq, special_literals);
+ ADD_INSN2(ret, nd_line(tempnode), opt_case_dispatch, literals, elselabel);
}
ADD_SEQ(ret, cond_seq);
@@ -3183,13 +3362,13 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
DECL_ANCHOR(body_seq);
INIT_ANCHOR(body_seq);
- endlabel = NEW_LABEL(nd_line(node));
+ endlabel = NEW_LABEL(line);
while (node && nd_type(node) == NODE_WHEN) {
- LABEL *l1 = NEW_LABEL(nd_line(node));
+ LABEL *l1 = NEW_LABEL(line = nd_line(node));
ADD_LABEL(body_seq, l1);
COMPILE_(body_seq, "when", node->nd_body, poped);
- ADD_INSNL(body_seq, nd_line(node), jump, endlabel);
+ ADD_INSNL(body_seq, line, jump, endlabel);
vals = node->nd_head;
if (!vals) {
@@ -3209,8 +3388,7 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
case NODE_ARGSPUSH:
ADD_INSN(ret, nd_line(vals), putnil);
COMPILE(ret, "when2/cond splat", vals);
- ADD_INSN1(ret, nd_line(vals), checkincludearray, Qfalse);
- ADD_INSN(ret, nd_line(vals), pop);
+ ADD_INSN1(ret, nd_line(vals), checkmatch, INT2FIX(VM_CHECKMATCH_TYPE_WHEN | VM_CHECKMATCH_ARRAY));
ADD_INSNL(ret, nd_line(vals), branchif, l1);
break;
default:
@@ -3238,28 +3416,28 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
struct iseq_compile_data_ensure_node_stack enl;
- LABEL *next_label = iseq->compile_data->start_label = NEW_LABEL(nd_line(node)); /* next */
- LABEL *redo_label = iseq->compile_data->redo_label = NEW_LABEL(nd_line(node)); /* redo */
- LABEL *break_label = iseq->compile_data->end_label = NEW_LABEL(nd_line(node)); /* break */
- LABEL *end_label = NEW_LABEL(nd_line(node));
+ LABEL *next_label = iseq->compile_data->start_label = NEW_LABEL(line); /* next */
+ LABEL *redo_label = iseq->compile_data->redo_label = NEW_LABEL(line); /* redo */
+ LABEL *break_label = iseq->compile_data->end_label = NEW_LABEL(line); /* break */
+ LABEL *end_label = NEW_LABEL(line);
- LABEL *next_catch_label = NEW_LABEL(nd_line(node));
+ LABEL *next_catch_label = NEW_LABEL(line);
LABEL *tmp_label = NULL;
iseq->compile_data->loopval_popped = 0;
push_ensure_entry(iseq, &enl, 0, 0);
if (type == NODE_OPT_N || node->nd_state == 1) {
- ADD_INSNL(ret, nd_line(node), jump, next_label);
+ ADD_INSNL(ret, line, jump, next_label);
}
else {
- tmp_label = NEW_LABEL(nd_line(node));
- ADD_INSNL(ret, nd_line(node), jump, tmp_label);
+ tmp_label = NEW_LABEL(line);
+ ADD_INSNL(ret, line, jump, tmp_label);
}
- ADD_INSN(ret, nd_line(node), putnil);
+ ADD_INSN(ret, line, putnil);
ADD_LABEL(ret, next_catch_label);
- ADD_INSN(ret, nd_line(node), pop);
- ADD_INSNL(ret, nd_line(node), jump, next_label);
+ ADD_INSN(ret, line, pop);
+ ADD_INSNL(ret, line, jump, next_label);
if (tmp_label) ADD_LABEL(ret, tmp_label);
ADD_LABEL(ret, redo_label);
@@ -3271,31 +3449,31 @@ 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, nd_line(node));
- ADD_CALL(ret, nd_line(node), ID2SYM(idGets), INT2FIX(0));
- ADD_INSNL(ret, nd_line(node), branchif, redo_label);
+ ADD_CALL_RECEIVER(ret, line);
+ ADD_CALL(ret, line, ID2SYM(idGets), INT2FIX(0));
+ ADD_INSNL(ret, line, branchif, redo_label);
/* opt_n */
}
ADD_LABEL(ret, end_label);
if (node->nd_state == Qundef) {
- /* ADD_INSN(ret, nd_line(node), putundef); */
+ /* ADD_INSN(ret, line, putundef); */
rb_bug("unsupported: putundef");
}
else {
- ADD_INSN(ret, nd_line(node), putnil);
+ ADD_INSN(ret, line, putnil);
}
ADD_LABEL(ret, break_label); /* break */
if (poped) {
- ADD_INSN(ret, nd_line(node), pop);
+ ADD_INSN(ret, line, pop);
}
ADD_CATCH_ENTRY(CATCH_TYPE_BREAK, redo_label, break_label,
@@ -3315,9 +3493,8 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
case NODE_ITER:
case NODE_FOR:{
VALUE prevblock = iseq->compile_data->current_block;
- LABEL *retry_label = NEW_LABEL(nd_line(node));
- LABEL *retry_end_l = NEW_LABEL(nd_line(node));
- ID mid = 0;
+ LABEL *retry_label = NEW_LABEL(line);
+ LABEL *retry_end_l = NEW_LABEL(line);
ADD_LABEL(ret, retry_label);
if (nd_type(node) == NODE_FOR) {
@@ -3325,22 +3502,21 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
iseq->compile_data->current_block =
NEW_CHILD_ISEQVAL(node->nd_body, make_name_for_block(iseq),
- ISEQ_TYPE_BLOCK, nd_line(node));
+ ISEQ_TYPE_BLOCK, line);
- mid = idEach;
- ADD_SEND_R(ret, nd_line(node), ID2SYM(idEach), INT2FIX(0),
+ ADD_SEND_R(ret, line, ID2SYM(idEach), INT2FIX(0),
iseq->compile_data->current_block, INT2FIX(0));
}
else {
iseq->compile_data->current_block =
NEW_CHILD_ISEQVAL(node->nd_body, make_name_for_block(iseq),
- ISEQ_TYPE_BLOCK, nd_line(node));
+ ISEQ_TYPE_BLOCK, line);
COMPILE(ret, "iter caller", node->nd_iter);
}
ADD_LABEL(ret, retry_end_l);
if (poped) {
- ADD_INSN(ret, nd_line(node), pop);
+ ADD_INSN(ret, line, pop);
}
iseq->compile_data->current_block = prevblock;
@@ -3356,23 +3532,23 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
/* while/until */
LABEL *splabel = NEW_LABEL(0);
ADD_LABEL(ret, splabel);
- ADD_ADJUST(ret, nd_line(node), iseq->compile_data->redo_label);
+ ADD_ADJUST(ret, line, iseq->compile_data->redo_label);
COMPILE_(ret, "break val (while/until)", node->nd_stts, iseq->compile_data->loopval_popped);
add_ensure_iseq(ret, iseq, 0);
- ADD_INSNL(ret, nd_line(node), jump, iseq->compile_data->end_label);
+ ADD_INSNL(ret, line, jump, iseq->compile_data->end_label);
ADD_ADJUST_RESTORE(ret, splabel);
if (!poped) {
- ADD_INSN(ret, nd_line(node), putnil);
+ ADD_INSN(ret, line, putnil);
}
}
else if (iseq->type == ISEQ_TYPE_BLOCK) {
break_by_insn:
/* escape from block */
COMPILE(ret, "break val (block)", node->nd_stts);
- ADD_INSN1(ret, nd_line(node), throw, INT2FIX(level | 0x02) /* TAG_BREAK */ );
+ ADD_INSN1(ret, line, throw, INT2FIX(level | 0x02) /* TAG_BREAK */ );
if (poped) {
- ADD_INSN(ret, nd_line(node), pop);
+ ADD_INSN(ret, line, pop);
}
}
else if (iseq->type == ISEQ_TYPE_EVAL) {
@@ -3419,25 +3595,25 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
ADD_LABEL(ret, splabel);
COMPILE(ret, "next val/valid syntax?", node->nd_stts);
add_ensure_iseq(ret, iseq, 0);
- ADD_ADJUST(ret, nd_line(node), iseq->compile_data->redo_label);
- ADD_INSNL(ret, nd_line(node), jump, iseq->compile_data->start_label);
+ ADD_ADJUST(ret, line, iseq->compile_data->redo_label);
+ ADD_INSNL(ret, line, jump, iseq->compile_data->start_label);
ADD_ADJUST_RESTORE(ret, splabel);
if (!poped) {
- ADD_INSN(ret, nd_line(node), putnil);
+ ADD_INSN(ret, line, putnil);
}
}
else if (iseq->compile_data->end_label) {
LABEL *splabel = NEW_LABEL(0);
debugs("next in block\n");
ADD_LABEL(ret, splabel);
- ADD_ADJUST(ret, nd_line(node), iseq->compile_data->start_label);
+ ADD_ADJUST(ret, line, iseq->compile_data->start_label);
COMPILE(ret, "next val", node->nd_stts);
add_ensure_iseq(ret, iseq, 0);
- ADD_INSNL(ret, nd_line(node), jump, iseq->compile_data->end_label);
+ ADD_INSNL(ret, line, jump, iseq->compile_data->end_label);
ADD_ADJUST_RESTORE(ret, splabel);
if (!poped) {
- ADD_INSN(ret, nd_line(node), putnil);
+ ADD_INSN(ret, line, putnil);
}
}
else if (iseq->type == ISEQ_TYPE_EVAL) {
@@ -3469,10 +3645,10 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
}
if (ip != 0) {
COMPILE(ret, "next val", node->nd_stts);
- ADD_INSN1(ret, nd_line(node), throw, INT2FIX(level | 0x03) /* TAG_NEXT */ );
+ ADD_INSN1(ret, line, throw, INT2FIX(level | 0x03) /* TAG_NEXT */ );
if (poped) {
- ADD_INSN(ret, nd_line(node), pop);
+ ADD_INSN(ret, line, pop);
}
}
else {
@@ -3486,12 +3662,12 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
LABEL *splabel = NEW_LABEL(0);
debugs("redo in while");
ADD_LABEL(ret, splabel);
- ADD_ADJUST(ret, nd_line(node), iseq->compile_data->redo_label);
+ ADD_ADJUST(ret, line, iseq->compile_data->redo_label);
add_ensure_iseq(ret, iseq, 0);
- ADD_INSNL(ret, nd_line(node), jump, iseq->compile_data->redo_label);
+ ADD_INSNL(ret, line, jump, iseq->compile_data->redo_label);
ADD_ADJUST_RESTORE(ret, splabel);
if (!poped) {
- ADD_INSN(ret, nd_line(node), putnil);
+ ADD_INSN(ret, line, putnil);
}
}
else if (iseq->type == ISEQ_TYPE_EVAL) {
@@ -3504,12 +3680,12 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
debugs("redo in block");
ADD_LABEL(ret, splabel);
add_ensure_iseq(ret, iseq, 0);
- ADD_ADJUST(ret, nd_line(node), iseq->compile_data->start_label);
- ADD_INSNL(ret, nd_line(node), jump, iseq->compile_data->start_label);
+ ADD_ADJUST(ret, line, iseq->compile_data->start_label);
+ ADD_INSNL(ret, line, jump, iseq->compile_data->start_label);
ADD_ADJUST_RESTORE(ret, splabel);
if (!poped) {
- ADD_INSN(ret, nd_line(node), putnil);
+ ADD_INSN(ret, line, putnil);
}
}
else {
@@ -3536,11 +3712,11 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
ip = ip->parent_iseq;
}
if (ip != 0) {
- ADD_INSN(ret, nd_line(node), putnil);
- ADD_INSN1(ret, nd_line(node), throw, INT2FIX(level | 0x05) /* TAG_REDO */ );
+ ADD_INSN(ret, line, putnil);
+ ADD_INSN1(ret, line, throw, INT2FIX(level | 0x05) /* TAG_REDO */ );
if (poped) {
- ADD_INSN(ret, nd_line(node), pop);
+ ADD_INSN(ret, line, pop);
}
}
else {
@@ -3551,11 +3727,11 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
}
case NODE_RETRY:{
if (iseq->type == ISEQ_TYPE_RESCUE) {
- ADD_INSN(ret, nd_line(node), putnil);
- ADD_INSN1(ret, nd_line(node), throw, INT2FIX(0x04) /* TAG_RETRY */ );
+ ADD_INSN(ret, line, putnil);
+ ADD_INSN1(ret, line, throw, INT2FIX(0x04) /* TAG_RETRY */ );
if (poped) {
- ADD_INSN(ret, nd_line(node), pop);
+ ADD_INSN(ret, line, pop);
}
}
else {
@@ -3568,26 +3744,26 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
break;
}
case NODE_RESCUE:{
- LABEL *lstart = NEW_LABEL(nd_line(node));
- LABEL *lend = NEW_LABEL(nd_line(node));
- LABEL *lcont = NEW_LABEL(nd_line(node));
+ LABEL *lstart = NEW_LABEL(line);
+ LABEL *lend = NEW_LABEL(line);
+ LABEL *lcont = NEW_LABEL(line);
VALUE rescue = NEW_CHILD_ISEQVAL(
node->nd_resq,
- rb_str_concat(rb_str_new2("rescue in "), iseq->name),
- ISEQ_TYPE_RESCUE, nd_line(node));
+ rb_str_concat(rb_str_new2("rescue in "), iseq->location.label),
+ ISEQ_TYPE_RESCUE, line);
ADD_LABEL(ret, lstart);
COMPILE(ret, "rescue head", node->nd_head);
ADD_LABEL(ret, lend);
if (node->nd_else) {
- ADD_INSN(ret, nd_line(node), pop);
+ ADD_INSN(ret, line, pop);
COMPILE(ret, "rescue else", node->nd_else);
}
- ADD_INSN(ret, nd_line(node), nop);
+ ADD_INSN(ret, line, nop);
ADD_LABEL(ret, lcont);
if (poped) {
- ADD_INSN(ret, nd_line(node), pop);
+ ADD_INSN(ret, line, pop);
}
/* register catch entry */
@@ -3601,30 +3777,28 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
LABEL *label_miss, *label_hit;
while (resq) {
- label_miss = NEW_LABEL(nd_line(node));
- label_hit = NEW_LABEL(nd_line(node));
+ label_miss = NEW_LABEL(line);
+ label_hit = NEW_LABEL(line);
narg = resq->nd_args;
if (narg) {
switch (nd_type(narg)) {
case NODE_ARRAY:
while (narg) {
+ ADD_INSN2(ret, line, getlocal, INT2FIX(2), INT2FIX(0));
COMPILE(ret, "rescue arg", narg->nd_head);
- ADD_INSN2(ret, nd_line(node), getdynamic, INT2FIX(2), INT2FIX(0));
- ADD_SEND(ret, nd_line(node), ID2SYM(idEqq), INT2FIX(1));
- ADD_INSNL(ret, nd_line(node), branchif, label_hit);
+ ADD_INSN1(ret, line, checkmatch, INT2FIX(VM_CHECKMATCH_TYPE_RESCUE));
+ ADD_INSNL(ret, line, branchif, label_hit);
narg = narg->nd_next;
}
break;
case NODE_SPLAT:
case NODE_ARGSCAT:
case NODE_ARGSPUSH:
- ADD_INSN2(ret, nd_line(node), getdynamic, INT2FIX(2), INT2FIX(0));
+ ADD_INSN2(ret, line, getlocal, INT2FIX(2), INT2FIX(0));
COMPILE(ret, "rescue/cond splat", narg);
- ADD_INSN1(ret, nd_line(node), checkincludearray, Qtrue);
- ADD_INSN(ret, nd_line(node), swap);
- ADD_INSN(ret, nd_line(node), pop);
- ADD_INSNL(ret, nd_line(node), branchif, label_hit);
+ ADD_INSN1(ret, line, checkmatch, INT2FIX(VM_CHECKMATCH_TYPE_RESCUE | VM_CHECKMATCH_ARRAY));
+ ADD_INSNL(ret, line, branchif, label_hit);
break;
default:
rb_bug("NODE_RESBODY: unknown node (%s)",
@@ -3632,19 +3806,18 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
}
}
else {
- ADD_INSN1(ret, nd_line(node), putobject,
- rb_eStandardError);
- ADD_INSN2(ret, nd_line(node), getdynamic, INT2FIX(2), INT2FIX(0));
- ADD_SEND(ret, nd_line(node), ID2SYM(idEqq), INT2FIX(1));
- ADD_INSNL(ret, nd_line(node), branchif, label_hit);
+ ADD_INSN2(ret, line, getlocal, INT2FIX(2), INT2FIX(0));
+ ADD_INSN1(ret, line, putobject, rb_eStandardError);
+ ADD_INSN1(ret, line, checkmatch, INT2FIX(VM_CHECKMATCH_TYPE_RESCUE));
+ ADD_INSNL(ret, line, branchif, label_hit);
}
- ADD_INSNL(ret, nd_line(node), jump, label_miss);
+ ADD_INSNL(ret, line, jump, label_miss);
ADD_LABEL(ret, label_hit);
COMPILE(ret, "resbody body", resq->nd_body);
if (iseq->compile_data->option->tailcall_optimization) {
- ADD_INSN(ret, nd_line(node), nop);
+ ADD_INSN(ret, line, nop);
}
- ADD_INSN(ret, nd_line(node), leave);
+ ADD_INSN(ret, line, leave);
ADD_LABEL(ret, label_miss);
resq = resq->nd_head;
}
@@ -3655,11 +3828,11 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
VALUE ensure = NEW_CHILD_ISEQVAL(node->nd_ensr,
rb_str_concat(rb_str_new2
("ensure in "),
- iseq->name),
- ISEQ_TYPE_ENSURE, nd_line(node));
- LABEL *lstart = NEW_LABEL(nd_line(node));
- LABEL *lend = NEW_LABEL(nd_line(node));
- LABEL *lcont = NEW_LABEL(nd_line(node));
+ iseq->location.label),
+ ISEQ_TYPE_ENSURE, line);
+ LABEL *lstart = NEW_LABEL(line);
+ LABEL *lend = NEW_LABEL(line);
+ LABEL *lcont = NEW_LABEL(line);
struct ensure_range er;
struct iseq_compile_data_ensure_node_stack enl;
struct ensure_range *erange;
@@ -3676,7 +3849,7 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
COMPILE_(ret, "ensure head", node->nd_head, poped);
ADD_LABEL(ret, lend);
if (ensr->anchor.next == 0) {
- ADD_INSN(ret, nd_line(node), nop);
+ ADD_INSN(ret, line, nop);
}
else {
ADD_SEQ(ret, ensr);
@@ -3696,19 +3869,19 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
case NODE_AND:
case NODE_OR:{
- LABEL *end_label = NEW_LABEL(nd_line(node));
+ LABEL *end_label = NEW_LABEL(line);
COMPILE(ret, "nd_1st", node->nd_1st);
if (!poped) {
- ADD_INSN(ret, nd_line(node), dup);
+ ADD_INSN(ret, line, dup);
}
if (type == NODE_AND) {
- ADD_INSNL(ret, nd_line(node), branchunless, end_label);
+ ADD_INSNL(ret, line, branchunless, end_label);
}
else {
- ADD_INSNL(ret, nd_line(node), branchif, end_label);
+ ADD_INSNL(ret, line, branchif, end_label);
}
if (!poped) {
- ADD_INSN(ret, nd_line(node), pop);
+ ADD_INSN(ret, line, pop);
}
COMPILE_(ret, "nd_2nd", node->nd_2nd, poped);
ADD_LABEL(ret, end_label);
@@ -3728,9 +3901,9 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
COMPILE(ret, "rvalue", node->nd_value);
if (!poped) {
- ADD_INSN(ret, nd_line(node), dup);
+ ADD_INSN(ret, line, dup);
}
- ADD_INSN1(ret, nd_line(node), setlocal, INT2FIX(idx));
+ ADD_INSN2(ret, line, setlocal, INT2FIX(idx), INT2FIX(get_lvar_level(iseq)));
break;
}
@@ -3741,7 +3914,7 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
debugp_param("dassn id", rb_str_new2(rb_id2name(node->nd_vid) ? rb_id2name(node->nd_vid) : "*"));
if (!poped) {
- ADD_INSN(ret, nd_line(node), dup);
+ ADD_INSN(ret, line, dup);
}
idx = get_dyna_var_idx(iseq, node->nd_vid, &lv, &ls);
@@ -3750,17 +3923,16 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
rb_bug("NODE_DASGN(_CURR): unknown id (%s)", rb_id2name(node->nd_vid));
}
- ADD_INSN2(ret, nd_line(node), setdynamic,
- INT2FIX(ls - idx), INT2FIX(lv));
+ ADD_INSN2(ret, line, setlocal, INT2FIX(ls - idx), INT2FIX(lv));
break;
}
case NODE_GASGN:{
COMPILE(ret, "lvalue", node->nd_value);
if (!poped) {
- ADD_INSN(ret, nd_line(node), dup);
+ ADD_INSN(ret, line, dup);
}
- ADD_INSN1(ret, nd_line(node), setglobal,
+ ADD_INSN1(ret, line, setglobal,
((VALUE)node->nd_entry | 1));
break;
}
@@ -3768,36 +3940,36 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
case NODE_IASGN2:{
COMPILE(ret, "lvalue", node->nd_value);
if (!poped) {
- ADD_INSN(ret, nd_line(node), dup);
+ ADD_INSN(ret, line, dup);
}
- ADD_INSN2(ret, nd_line(node), setinstancevariable,
- ID2SYM(node->nd_vid), INT2FIX(iseq->ic_size++));
+ ADD_INSN2(ret, line, setinstancevariable,
+ ID2SYM(node->nd_vid), INT2FIX(iseq->is_size++));
break;
}
case NODE_CDECL:{
COMPILE(ret, "lvalue", node->nd_value);
if (!poped) {
- ADD_INSN(ret, nd_line(node), dup);
+ ADD_INSN(ret, line, dup);
}
if (node->nd_vid) {
- ADD_INSN1(ret, nd_line(node), putspecialobject,
+ ADD_INSN1(ret, line, putspecialobject,
INT2FIX(VM_SPECIAL_OBJECT_CONST_BASE));
- ADD_INSN1(ret, nd_line(node), setconstant, ID2SYM(node->nd_vid));
+ ADD_INSN1(ret, line, setconstant, ID2SYM(node->nd_vid));
}
else {
compile_cpath(ret, iseq, node->nd_else);
- ADD_INSN1(ret, nd_line(node), setconstant, ID2SYM(node->nd_else->nd_mid));
+ ADD_INSN1(ret, line, setconstant, ID2SYM(node->nd_else->nd_mid));
}
break;
}
case NODE_CVASGN:{
COMPILE(ret, "cvasgn val", node->nd_value);
if (!poped) {
- ADD_INSN(ret, nd_line(node), dup);
+ ADD_INSN(ret, line, dup);
}
- ADD_INSN1(ret, nd_line(node), setclassvariable,
+ ADD_INSN1(ret, line, setclassvariable,
ID2SYM(node->nd_vid));
break;
}
@@ -3832,7 +4004,7 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
*/
if (!poped) {
- ADD_INSN(ret, nd_line(node), putnil);
+ ADD_INSN(ret, line, putnil);
}
COMPILE(ret, "NODE_OP_ASGN1 recv", node->nd_recv);
switch (nd_type(node->nd_args->nd_head)) {
@@ -3846,8 +4018,8 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
argc = setup_args(iseq, args, node->nd_args->nd_head, &flag);
ADD_SEQ(ret, args);
}
- ADD_INSN1(ret, nd_line(node), dupn, FIXNUM_INC(argc, 1 + boff));
- ADD_SEND_R(ret, nd_line(node), ID2SYM(idAREF), argc, Qfalse, LONG2FIX(flag));
+ ADD_INSN1(ret, line, dupn, FIXNUM_INC(argc, 1 + boff));
+ ADD_SEND_R(ret, line, ID2SYM(idAREF), argc, Qfalse, LONG2FIX(flag));
if (id == 0 || id == 1) {
/* 0: or, 1: and
@@ -3859,92 +4031,92 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
nil
end
*/
- LABEL *label = NEW_LABEL(nd_line(node));
- LABEL *lfin = NEW_LABEL(nd_line(node));
+ LABEL *label = NEW_LABEL(line);
+ LABEL *lfin = NEW_LABEL(line);
- ADD_INSN(ret, nd_line(node), dup);
+ ADD_INSN(ret, line, dup);
if (id == 0) {
/* or */
- ADD_INSNL(ret, nd_line(node), branchif, label);
+ ADD_INSNL(ret, line, branchif, label);
}
else {
/* and */
- ADD_INSNL(ret, nd_line(node), branchunless, label);
+ ADD_INSNL(ret, line, branchunless, label);
}
- ADD_INSN(ret, nd_line(node), pop);
+ ADD_INSN(ret, line, pop);
COMPILE(ret, "NODE_OP_ASGN1 args->body: ", node->nd_args->nd_body);
if (!poped) {
- ADD_INSN1(ret, nd_line(node), setn, FIXNUM_INC(argc, 2+boff));
+ ADD_INSN1(ret, line, setn, FIXNUM_INC(argc, 2+boff));
}
- if (flag & VM_CALL_ARGS_SPLAT_BIT) {
- ADD_INSN1(ret, nd_line(node), newarray, INT2FIX(1));
+ if (flag & VM_CALL_ARGS_SPLAT) {
+ ADD_INSN1(ret, line, newarray, INT2FIX(1));
if (boff > 0) {
- ADD_INSN1(ret, nd_line(node), dupn, INT2FIX(3));
- ADD_INSN(ret, nd_line(node), swap);
- ADD_INSN(ret, nd_line(node), pop);
+ ADD_INSN1(ret, line, dupn, INT2FIX(3));
+ ADD_INSN(ret, line, swap);
+ ADD_INSN(ret, line, pop);
}
- ADD_INSN(ret, nd_line(node), concatarray);
+ ADD_INSN(ret, line, concatarray);
if (boff > 0) {
- ADD_INSN1(ret, nd_line(node), setn, INT2FIX(3));
- ADD_INSN(ret, nd_line(node), pop);
- ADD_INSN(ret, nd_line(node), pop);
+ ADD_INSN1(ret, line, setn, INT2FIX(3));
+ ADD_INSN(ret, line, pop);
+ ADD_INSN(ret, line, pop);
}
- ADD_SEND_R(ret, nd_line(node), ID2SYM(idASET),
+ ADD_SEND_R(ret, line, ID2SYM(idASET),
argc, Qfalse, LONG2FIX(flag));
}
else {
if (boff > 0)
- ADD_INSN(ret, nd_line(node), swap);
- ADD_SEND_R(ret, nd_line(node), ID2SYM(idASET),
+ ADD_INSN(ret, line, swap);
+ ADD_SEND_R(ret, line, ID2SYM(idASET),
FIXNUM_INC(argc, 1), Qfalse, LONG2FIX(flag));
}
- ADD_INSN(ret, nd_line(node), pop);
- ADD_INSNL(ret, nd_line(node), jump, lfin);
+ ADD_INSN(ret, line, pop);
+ ADD_INSNL(ret, line, jump, lfin);
ADD_LABEL(ret, label);
if (!poped) {
- ADD_INSN1(ret, nd_line(node), setn, FIXNUM_INC(argc, 2+boff));
+ ADD_INSN1(ret, line, setn, FIXNUM_INC(argc, 2+boff));
}
- ADD_INSN1(ret, nd_line(node), adjuststack, FIXNUM_INC(argc, 2+boff));
+ ADD_INSN1(ret, line, adjuststack, FIXNUM_INC(argc, 2+boff));
ADD_LABEL(ret, lfin);
}
else {
COMPILE(ret, "NODE_OP_ASGN1 args->body: ", node->nd_args->nd_body);
- ADD_SEND(ret, nd_line(node), ID2SYM(id), INT2FIX(1));
+ ADD_SEND(ret, line, ID2SYM(id), INT2FIX(1));
if (!poped) {
- ADD_INSN1(ret, nd_line(node), setn, FIXNUM_INC(argc, 2+boff));
+ ADD_INSN1(ret, line, setn, FIXNUM_INC(argc, 2+boff));
}
- if (flag & VM_CALL_ARGS_SPLAT_BIT) {
- ADD_INSN1(ret, nd_line(node), newarray, INT2FIX(1));
+ if (flag & VM_CALL_ARGS_SPLAT) {
+ ADD_INSN1(ret, line, newarray, INT2FIX(1));
if (boff > 0) {
- ADD_INSN1(ret, nd_line(node), dupn, INT2FIX(3));
- ADD_INSN(ret, nd_line(node), swap);
- ADD_INSN(ret, nd_line(node), pop);
+ ADD_INSN1(ret, line, dupn, INT2FIX(3));
+ ADD_INSN(ret, line, swap);
+ ADD_INSN(ret, line, pop);
}
- ADD_INSN(ret, nd_line(node), concatarray);
+ ADD_INSN(ret, line, concatarray);
if (boff > 0) {
- ADD_INSN1(ret, nd_line(node), setn, INT2FIX(3));
- ADD_INSN(ret, nd_line(node), pop);
- ADD_INSN(ret, nd_line(node), pop);
+ ADD_INSN1(ret, line, setn, INT2FIX(3));
+ ADD_INSN(ret, line, pop);
+ ADD_INSN(ret, line, pop);
}
- ADD_SEND_R(ret, nd_line(node), ID2SYM(idASET),
+ ADD_SEND_R(ret, line, ID2SYM(idASET),
argc, Qfalse, LONG2FIX(flag));
}
else {
if (boff > 0)
- ADD_INSN(ret, nd_line(node), swap);
- ADD_SEND_R(ret, nd_line(node), ID2SYM(idASET),
+ ADD_INSN(ret, line, swap);
+ ADD_SEND_R(ret, line, ID2SYM(idASET),
FIXNUM_INC(argc, 1), Qfalse, LONG2FIX(flag));
}
- ADD_INSN(ret, nd_line(node), pop);
+ ADD_INSN(ret, line, pop);
}
break;
}
case NODE_OP_ASGN2:{
ID atype = node->nd_next->nd_mid;
- LABEL *lfin = NEW_LABEL(nd_line(node));
- LABEL *lcfin = NEW_LABEL(nd_line(node));
+ LABEL *lfin = NEW_LABEL(line);
+ LABEL *lcfin = NEW_LABEL(line);
/*
class C; attr_accessor :c; end
r = C.new
@@ -3988,53 +4160,121 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
*/
COMPILE(ret, "NODE_OP_ASGN2#recv", node->nd_recv);
- ADD_INSN(ret, nd_line(node), dup);
- ADD_SEND(ret, nd_line(node), ID2SYM(node->nd_next->nd_vid),
+ ADD_INSN(ret, line, dup);
+ ADD_SEND(ret, line, ID2SYM(node->nd_next->nd_vid),
INT2FIX(0));
if (atype == 0 || atype == 1) { /* 0: OR or 1: AND */
- ADD_INSN(ret, nd_line(node), dup);
+ ADD_INSN(ret, line, dup);
if (atype == 0) {
- ADD_INSNL(ret, nd_line(node), branchif, lcfin);
+ ADD_INSNL(ret, line, branchif, lcfin);
}
else {
- ADD_INSNL(ret, nd_line(node), branchunless, lcfin);
+ ADD_INSNL(ret, line, branchunless, lcfin);
}
- ADD_INSN(ret, nd_line(node), pop);
+ ADD_INSN(ret, line, pop);
COMPILE(ret, "NODE_OP_ASGN2 val", node->nd_value);
- ADD_INSN(ret, nd_line(node), swap);
- ADD_INSN1(ret, nd_line(node), topn, INT2FIX(1));
- ADD_SEND(ret, nd_line(node), ID2SYM(node->nd_next->nd_aid),
+ 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_INSNL(ret, nd_line(node), jump, lfin);
+ ADD_INSNL(ret, line, jump, lfin);
ADD_LABEL(ret, lcfin);
- ADD_INSN(ret, nd_line(node), swap);
+ ADD_INSN(ret, line, swap);
ADD_LABEL(ret, lfin);
- ADD_INSN(ret, nd_line(node), pop);
+ ADD_INSN(ret, line, pop);
if (poped) {
/* we can apply more optimize */
- ADD_INSN(ret, nd_line(node), pop);
+ ADD_INSN(ret, line, pop);
}
}
else {
COMPILE(ret, "NODE_OP_ASGN2 val", node->nd_value);
- ADD_SEND(ret, nd_line(node), ID2SYM(node->nd_next->nd_mid),
+ ADD_SEND(ret, line, ID2SYM(node->nd_next->nd_mid),
INT2FIX(1));
if (!poped) {
- ADD_INSN(ret, nd_line(node), swap);
- ADD_INSN1(ret, nd_line(node), topn, INT2FIX(1));
+ ADD_INSN(ret, line, swap);
+ ADD_INSN1(ret, line, topn, INT2FIX(1));
}
- ADD_SEND(ret, nd_line(node), ID2SYM(node->nd_next->nd_aid),
+ ADD_SEND(ret, line, ID2SYM(node->nd_next->nd_aid),
INT2FIX(1));
- ADD_INSN(ret, nd_line(node), pop);
+ ADD_INSN(ret, line, pop);
+ }
+ break;
+ }
+ case NODE_OP_CDECL: {
+ LABEL *lfin = 0;
+ LABEL *lassign = 0;
+ ID mid;
+
+ switch (nd_type(node->nd_head)) {
+ case NODE_COLON3:
+ ADD_INSN1(ret, line, putobject, rb_cObject);
+ break;
+ case NODE_COLON2:
+ COMPILE(ret, "NODE_OP_CDECL/colon2#nd_head", node->nd_head->nd_head);
+ break;
+ default:
+ do {
+ COMPILE_ERROR((ERROR_ARGS "%s: invalid node in NODE_OP_CDECL",
+ ruby_node_name(nd_type(node->nd_head))));
+ } while (0);
+ return COMPILE_NG;
+ }
+ mid = node->nd_head->nd_mid;
+ /* cref */
+ if (node->nd_aid == 0) {
+ lassign = NEW_LABEL(line);
+ ADD_INSN(ret, line, dup); /* cref cref */
+ ADD_INSN3(ret, line, defined, INT2FIX(DEFINED_CONST),
+ ID2SYM(mid), Qfalse); /* cref bool */
+ ADD_INSNL(ret, line, branchunless, lassign); /* cref */
+ }
+ ADD_INSN(ret, line, dup); /* cref cref */
+ ADD_INSN1(ret, line, getconstant, ID2SYM(mid)); /* cref obj */
+
+ if (node->nd_aid == 0 || node->nd_aid == 1) {
+ lfin = NEW_LABEL(line);
+ if (!poped) ADD_INSN(ret, line, dup); /* cref [obj] obj */
+ if (node->nd_aid == 0)
+ ADD_INSNL(ret, line, branchif, lfin);
+ else
+ ADD_INSNL(ret, line, branchunless, lfin);
+ /* cref [obj] */
+ if (!poped) ADD_INSN(ret, line, pop); /* cref */
+ if (lassign) ADD_LABEL(ret, lassign);
+ COMPILE(ret, "NODE_OP_CDECL#nd_value", node->nd_value);
+ /* cref value */
+ if (poped)
+ ADD_INSN1(ret, line, topn, INT2FIX(1)); /* cref value cref */
+ else {
+ ADD_INSN1(ret, line, dupn, INT2FIX(2)); /* cref value cref value */
+ ADD_INSN(ret, line, swap); /* cref value value cref */
+ }
+ ADD_INSN1(ret, line, setconstant, ID2SYM(mid)); /* cref [value] */
+ ADD_LABEL(ret, lfin); /* cref [value] */
+ if (!poped) ADD_INSN(ret, line, swap); /* [value] cref */
+ ADD_INSN(ret, line, pop); /* [value] */
+ }
+ else {
+ COMPILE(ret, "NODE_OP_CDECL#nd_value", node->nd_value);
+ /* cref obj value */
+ ADD_CALL(ret, line, ID2SYM(node->nd_aid), INT2FIX(1));
+ /* cref value */
+ ADD_INSN(ret, line, swap); /* value cref */
+ if (!poped) {
+ ADD_INSN1(ret, line, topn, INT2FIX(1)); /* value cref value */
+ ADD_INSN(ret, line, swap); /* value value cref */
+ }
+ ADD_INSN1(ret, line, setconstant, ID2SYM(mid));
}
break;
}
case NODE_OP_ASGN_AND:
case NODE_OP_ASGN_OR:{
- LABEL *lfin = NEW_LABEL(nd_line(node));
+ LABEL *lfin = NEW_LABEL(line);
LABEL *lassign;
if (nd_type(node) == NODE_OP_ASGN_OR) {
@@ -4044,36 +4284,47 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
defined_expr(iseq, ret, node->nd_head, lfinish, Qfalse);
lassign = lfinish[1];
if (!lassign) {
- lassign = NEW_LABEL(nd_line(node));
+ lassign = NEW_LABEL(line);
}
- ADD_INSNL(ret, nd_line(node), branchunless, lassign);
+ ADD_INSNL(ret, line, branchunless, lassign);
}
else {
- lassign = NEW_LABEL(nd_line(node));
+ lassign = NEW_LABEL(line);
}
COMPILE(ret, "NODE_OP_ASGN_AND/OR#nd_head", node->nd_head);
- ADD_INSN(ret, nd_line(node), dup);
+ ADD_INSN(ret, line, dup);
if (nd_type(node) == NODE_OP_ASGN_AND) {
- ADD_INSNL(ret, nd_line(node), branchunless, lfin);
+ ADD_INSNL(ret, line, branchunless, lfin);
}
else {
- ADD_INSNL(ret, nd_line(node), branchif, lfin);
+ ADD_INSNL(ret, line, branchif, lfin);
}
- ADD_INSN(ret, nd_line(node), pop);
+ ADD_INSN(ret, line, pop);
ADD_LABEL(ret, lassign);
COMPILE(ret, "NODE_OP_ASGN_AND/OR#nd_value", node->nd_value);
ADD_LABEL(ret, lfin);
if (poped) {
/* we can apply more optimize */
- ADD_INSN(ret, nd_line(node), pop);
+ ADD_INSN(ret, line, pop);
}
break;
}
case NODE_CALL:
+ 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;
+ }
case NODE_FCALL:
case NODE_VCALL:{ /* VCALL: variable or call */
/*
@@ -4093,12 +4344,18 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
INIT_ANCHOR(args);
#if SUPPORT_JOKE
if (nd_type(node) == NODE_VCALL) {
- if (mid == idBitblt) {
- ADD_INSN(ret, nd_line(node), bitblt);
+ ID id_bitblt;
+ ID id_answer;
+
+ CONST_ID(id_bitblt, "bitblt");
+ CONST_ID(id_answer, "the_answer_to_life_the_universe_and_everything");
+
+ if (mid == id_bitblt) {
+ ADD_INSN(ret, line, bitblt);
break;
}
- else if (mid == idAnswer) {
- ADD_INSN(ret, nd_line(node), answer);
+ else if (mid == id_answer) {
+ ADD_INSN(ret, line, answer);
break;
}
}
@@ -4126,8 +4383,8 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
label_name = SYM2ID(node->nd_args->nd_head->nd_lit);
if (!st_lookup(labels_table, (st_data_t)label_name, &data)) {
- label = NEW_LABEL(nd_line(node));
- label->position = nd_line(node);
+ label = NEW_LABEL(line);
+ label->position = line;
st_insert(labels_table, (st_data_t)label_name, (st_data_t)label);
}
else {
@@ -4140,7 +4397,7 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
if (mid == goto_id) {
- ADD_INSNL(ret, nd_line(node), jump, label);
+ ADD_INSNL(ret, line, jump, label);
}
else {
ADD_LABEL(ret, label);
@@ -4154,7 +4411,7 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
COMPILE(recv, "recv", node->nd_recv);
}
else if (type == NODE_FCALL || type == NODE_VCALL) {
- ADD_CALL_RECEIVER(recv, nd_line(node));
+ ADD_CALL_RECEIVER(recv, line);
}
/* args */
@@ -4173,43 +4430,45 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
switch (nd_type(node)) {
case NODE_VCALL:
- flag |= VM_CALL_VCALL_BIT;
+ flag |= VM_CALL_VCALL;
/* VCALL is funcall, so fall through */
case NODE_FCALL:
- flag |= VM_CALL_FCALL_BIT;
+ flag |= VM_CALL_FCALL;
}
- ADD_SEND_R(ret, nd_line(node), ID2SYM(mid),
+ ADD_SEND_R(ret, line, ID2SYM(mid),
argc, parent_block, LONG2FIX(flag));
if (poped) {
- ADD_INSN(ret, nd_line(node), pop);
+ ADD_INSN(ret, line, pop);
}
break;
}
case NODE_SUPER:
case NODE_ZSUPER:{
DECL_ANCHOR(args);
- VALUE argc;
+ int argc;
VALUE flag = 0;
VALUE parent_block = iseq->compile_data->current_block;
INIT_ANCHOR(args);
iseq->compile_data->current_block = Qfalse;
if (nd_type(node) == NODE_SUPER) {
- argc = setup_args(iseq, args, node->nd_args, &flag);
+ VALUE vargc = setup_args(iseq, args, node->nd_args, &flag);
+ argc = FIX2INT(vargc);
}
else {
/* NODE_ZSUPER */
int i;
rb_iseq_t *liseq = iseq->local_iseq;
+ int lvar_level = get_lvar_level(iseq);
- argc = INT2FIX(liseq->argc);
+ argc = liseq->argc;
/* normal arguments */
for (i = 0; i < liseq->argc; i++) {
int idx = liseq->local_size - i;
- ADD_INSN1(args, nd_line(node), getlocal, INT2FIX(idx));
+ ADD_INSN2(args, line, getlocal, INT2FIX(idx), INT2FIX(lvar_level));
}
if (!liseq->arg_simple) {
@@ -4218,18 +4477,18 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
int j;
for (j = 0; j < liseq->arg_opts - 1; j++) {
int idx = liseq->local_size - (i + j);
- ADD_INSN1(args, nd_line(node), getlocal, INT2FIX(idx));
+ ADD_INSN2(args, line, getlocal, INT2FIX(idx), INT2FIX(lvar_level));
}
i += j;
- argc = INT2FIX(i);
+ argc = i;
}
if (liseq->arg_rest != -1) {
/* rest argument */
int idx = liseq->local_size - liseq->arg_rest;
- ADD_INSN1(args, nd_line(node), getlocal, INT2FIX(idx));
- argc = INT2FIX(liseq->arg_rest + 1);
- flag |= VM_CALL_ARGS_SPLAT_BIT;
+ ADD_INSN2(args, line, getlocal, INT2FIX(idx), INT2FIX(lvar_level));
+ argc = liseq->arg_rest + 1;
+ flag |= VM_CALL_ARGS_SPLAT;
}
if (liseq->arg_post_len) {
@@ -4241,43 +4500,63 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
int j;
for (j=0; j<post_len; j++) {
int idx = liseq->local_size - (post_start + j);
- ADD_INSN1(args, nd_line(node), getlocal, INT2FIX(idx));
+ ADD_INSN2(args, line, getlocal, INT2FIX(idx), INT2FIX(lvar_level));
}
- ADD_INSN1(args, nd_line(node), newarray, INT2FIX(j));
- ADD_INSN (args, nd_line(node), concatarray);
- /* argc is setteled at above */
+ ADD_INSN1(args, line, newarray, INT2FIX(j));
+ ADD_INSN (args, line, concatarray);
+ /* argc is settled at above */
}
else {
int j;
for (j=0; j<post_len; j++) {
int idx = liseq->local_size - (post_start + j);
- ADD_INSN1(args, nd_line(node), getlocal, INT2FIX(idx));
+ ADD_INSN2(args, line, getlocal, INT2FIX(idx), INT2FIX(lvar_level));
}
- argc = INT2FIX(post_len + post_start);
+ argc = post_len + post_start;
+ }
+ }
+
+ if (liseq->arg_keyword >= 0) {
+ int local_size = liseq->local_size;
+ int idx = local_size - liseq->arg_keyword;
+ argc++;
+ ADD_INSN1(args, line, putspecialobject, INT2FIX(VM_SPECIAL_OBJECT_VMCORE));
+ ADD_INSN2(args, line, getlocal, INT2FIX(idx), INT2FIX(lvar_level));
+ ADD_SEND (args, line, ID2SYM(rb_intern("dup")), INT2FIX(0));
+ for (i = 0; i < liseq->arg_keywords; ++i) {
+ ID id = liseq->arg_keyword_table[i];
+ idx = local_size - get_local_var_idx(liseq, id);
+ ADD_INSN1(args, line, putobject, ID2SYM(id));
+ ADD_INSN2(args, line, getlocal, INT2FIX(idx), INT2FIX(lvar_level));
+ }
+ ADD_SEND(args, line, ID2SYM(id_core_hash_merge_ptr), INT2FIX(i * 2 + 1));
+ if (liseq->arg_rest != -1) {
+ ADD_INSN1(args, line, newarray, INT2FIX(1));
+ ADD_INSN (args, line, concatarray);
+ --argc;
}
}
}
}
/* dummy receiver */
- ADD_INSN1(ret, nd_line(node), putobject,
- nd_type(node) == NODE_ZSUPER ? Qfalse : Qtrue);
+ ADD_INSN1(ret, line, putobject, nd_type(node) == NODE_ZSUPER ? Qfalse : Qtrue);
ADD_SEQ(ret, args);
- ADD_INSN3(ret, nd_line(node), invokesuper,
- argc, parent_block, LONG2FIX(flag));
+ ADD_INSN1(ret, line, invokesuper, new_callinfo(iseq, 0, argc, parent_block,
+ flag | VM_CALL_SUPER | VM_CALL_FCALL));
if (poped) {
- ADD_INSN(ret, nd_line(node), pop);
+ ADD_INSN(ret, line, pop);
}
break;
}
case NODE_ARRAY:{
- compile_array_(iseq, ret, node, Qtrue, poped);
+ compile_array_(iseq, ret, node, COMPILE_ARRAY_TYPE_ARRAY, poped);
break;
}
case NODE_ZARRAY:{
if (!poped) {
- ADD_INSN1(ret, nd_line(node), newarray, INT2FIX(0));
+ ADD_INSN1(ret, line, newarray, INT2FIX(0));
}
break;
}
@@ -4287,37 +4566,33 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
COMPILE(ret, "values item", n->nd_head);
n = n->nd_next;
}
- ADD_INSN1(ret, nd_line(node), newarray, INT2FIX(node->nd_alen));
+ ADD_INSN1(ret, line, newarray, INT2FIX(node->nd_alen));
if (poped) {
- ADD_INSN(ret, nd_line(node), pop);
+ ADD_INSN(ret, line, pop);
}
break;
}
case NODE_HASH:{
DECL_ANCHOR(list);
- VALUE size = 0;
int type = node->nd_head ? nd_type(node->nd_head) : NODE_ZARRAY;
INIT_ANCHOR(list);
switch (type) {
- case NODE_ARRAY:{
- compile_array(iseq, list, node->nd_head, Qfalse);
- size = OPERAND_AT(POP_ELEMENT(list), 0);
+ case NODE_ARRAY:
+ compile_array(iseq, list, node->nd_head, COMPILE_ARRAY_TYPE_HASH);
ADD_SEQ(ret, list);
break;
- }
+
case NODE_ZARRAY:
- size = INT2FIX(0);
+ ADD_INSN1(ret, line, newhash, INT2FIX(0));
break;
default:
rb_bug("can't make hash with this node: %s", ruby_node_name(type));
}
- ADD_INSN1(ret, nd_line(node), newhash, size);
-
if (poped) {
- ADD_INSN(ret, nd_line(node), pop);
+ ADD_INSN(ret, line, pop);
}
break;
}
@@ -4334,25 +4609,25 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
if (is->type == ISEQ_TYPE_METHOD) {
splabel = NEW_LABEL(0);
ADD_LABEL(ret, splabel);
- ADD_ADJUST(ret, nd_line(node), 0);
+ ADD_ADJUST(ret, line, 0);
}
COMPILE(ret, "return nd_stts (return val)", node->nd_stts);
if (is->type == ISEQ_TYPE_METHOD) {
add_ensure_iseq(ret, iseq, 1);
- ADD_TRACE(ret, nd_line(node), RUBY_EVENT_RETURN);
- ADD_INSN(ret, nd_line(node), leave);
+ ADD_TRACE(ret, line, RUBY_EVENT_RETURN);
+ ADD_INSN(ret, line, leave);
ADD_ADJUST_RESTORE(ret, splabel);
if (!poped) {
- ADD_INSN(ret, nd_line(node), putnil);
+ ADD_INSN(ret, line, putnil);
}
}
else {
- ADD_INSN1(ret, nd_line(node), throw, INT2FIX(0x01) /* TAG_RETURN */ );
+ ADD_INSN1(ret, line, throw, INT2FIX(0x01) /* TAG_RETURN */ );
if (poped) {
- ADD_INSN(ret, nd_line(node), pop);
+ ADD_INSN(ret, line, pop);
}
}
}
@@ -4377,10 +4652,10 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
}
ADD_SEQ(ret, args);
- ADD_INSN2(ret, nd_line(node), invokeblock, argc, LONG2FIX(flag));
+ ADD_INSN1(ret, line, invokeblock, new_callinfo(iseq, 0, FIX2INT(argc), 0, flag));
if (poped) {
- ADD_INSN(ret, nd_line(node), pop);
+ ADD_INSN(ret, line, pop);
}
break;
}
@@ -4390,7 +4665,7 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
int idx = iseq->local_iseq->local_size - get_local_var_idx(iseq, id);
debugs("id: %s idx: %d\n", rb_id2name(id), idx);
- ADD_INSN1(ret, nd_line(node), getlocal, INT2FIX(idx));
+ ADD_INSN2(ret, line, getlocal, INT2FIX(idx), INT2FIX(get_lvar_level(iseq)));
}
break;
}
@@ -4402,23 +4677,23 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
if (idx < 0) {
rb_bug("unknown dvar (%s)", rb_id2name(node->nd_vid));
}
- ADD_INSN2(ret, nd_line(node), getdynamic, INT2FIX(ls - idx), INT2FIX(lv));
+ ADD_INSN2(ret, line, getlocal, INT2FIX(ls - idx), INT2FIX(lv));
}
break;
}
case NODE_GVAR:{
- ADD_INSN1(ret, nd_line(node), getglobal,
+ ADD_INSN1(ret, line, getglobal,
((VALUE)node->nd_entry | 1));
if (poped) {
- ADD_INSN(ret, nd_line(node), pop);
+ ADD_INSN(ret, line, pop);
}
break;
}
case NODE_IVAR:{
debugi("nd_vid", node->nd_vid);
if (!poped) {
- ADD_INSN2(ret, nd_line(node), getinstancevariable,
- ID2SYM(node->nd_vid), INT2FIX(iseq->ic_size++));
+ ADD_INSN2(ret, line, getinstancevariable,
+ ID2SYM(node->nd_vid), INT2FIX(iseq->is_size++));
}
break;
}
@@ -4426,41 +4701,41 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
debugi("nd_vid", node->nd_vid);
if (iseq->compile_data->option->inline_const_cache) {
- LABEL *lend = NEW_LABEL(nd_line(node));
- int ic_index = iseq->ic_size++;
+ LABEL *lend = NEW_LABEL(line);
+ int ic_index = iseq->is_size++;
- ADD_INSN2(ret, nd_line(node), getinlinecache, lend, INT2FIX(ic_index));
- ADD_INSN1(ret, nd_line(node), getconstant, ID2SYM(node->nd_vid));
- ADD_INSN1(ret, nd_line(node), setinlinecache, INT2FIX(ic_index));
+ ADD_INSN2(ret, line, getinlinecache, lend, INT2FIX(ic_index));
+ ADD_INSN1(ret, line, getconstant, ID2SYM(node->nd_vid));
+ ADD_INSN1(ret, line, setinlinecache, INT2FIX(ic_index));
ADD_LABEL(ret, lend);
}
else {
- ADD_INSN(ret, nd_line(node), putnil);
- ADD_INSN1(ret, nd_line(node), getconstant, ID2SYM(node->nd_vid));
+ ADD_INSN(ret, line, putnil);
+ ADD_INSN1(ret, line, getconstant, ID2SYM(node->nd_vid));
}
if (poped) {
- ADD_INSN(ret, nd_line(node), pop);
+ ADD_INSN(ret, line, pop);
}
break;
}
case NODE_CVAR:{
if (!poped) {
- ADD_INSN1(ret, nd_line(node), getclassvariable,
+ ADD_INSN1(ret, line, getclassvariable,
ID2SYM(node->nd_vid));
}
break;
}
case NODE_NTH_REF:{
if (!poped) {
- ADD_INSN2(ret, nd_line(node), getspecial, INT2FIX(1) /* '~' */,
+ ADD_INSN2(ret, line, getspecial, INT2FIX(1) /* '~' */,
INT2FIX(node->nd_nth << 1));
}
break;
}
case NODE_BACK_REF:{
if (!poped) {
- ADD_INSN2(ret, nd_line(node), getspecial, INT2FIX(1) /* '~' */,
+ ADD_INSN2(ret, line, getspecial, INT2FIX(1) /* '~' */,
INT2FIX(0x01 | (node->nd_nth << 1)));
}
break;
@@ -4473,10 +4748,10 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
INIT_ANCHOR(recv);
INIT_ANCHOR(val);
- switch(nd_type(node)) {
+ switch (nd_type(node)) {
case NODE_MATCH:
- ADD_INSN1(recv, nd_line(node), putobject, node->nd_lit);
- ADD_INSN2(val, nd_line(node), getspecial, INT2FIX(0),
+ ADD_INSN1(recv, line, putobject, node->nd_lit);
+ ADD_INSN2(val, line, getspecial, INT2FIX(0),
INT2FIX(0));
break;
case NODE_MATCH2:
@@ -4495,30 +4770,30 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
INSN_OF(recv->last) == BIN(putobject) &&
nd_type(node) == NODE_MATCH2) {
ADD_SEQ(ret, val);
- ADD_INSN1(ret, nd_line(node), opt_regexpmatch1,
+ ADD_INSN1(ret, line, opt_regexpmatch1,
OPERAND_AT(recv->last, 0));
}
else {
ADD_SEQ(ret, recv);
ADD_SEQ(ret, val);
- ADD_INSN(ret, nd_line(node), 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, nd_line(node), ID2SYM(idEqTilde), INT2FIX(1));
+ ADD_SEND(ret, line, ID2SYM(idEqTilde), INT2FIX(1));
}
if (poped) {
- ADD_INSN(ret, nd_line(node), pop);
+ ADD_INSN(ret, line, pop);
}
break;
}
case NODE_LIT:{
debugp_param("lit", node->nd_lit);
if (!poped) {
- ADD_INSN1(ret, nd_line(node), putobject, node->nd_lit);
+ ADD_INSN1(ret, line, putobject, node->nd_lit);
}
break;
}
@@ -4526,7 +4801,7 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
debugp_param("nd_lit", node->nd_lit);
if (!poped) {
OBJ_FREEZE(node->nd_lit);
- ADD_INSN1(ret, nd_line(node), putstring, node->nd_lit);
+ ADD_INSN1(ret, line, putstring, node->nd_lit);
}
break;
}
@@ -4534,28 +4809,28 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
compile_dstr(iseq, ret, node);
if (poped) {
- ADD_INSN(ret, nd_line(node), pop);
+ ADD_INSN(ret, line, pop);
}
break;
}
case NODE_XSTR:{
OBJ_FREEZE(node->nd_lit);
- ADD_CALL_RECEIVER(ret, nd_line(node));
- ADD_INSN1(ret, nd_line(node), putobject, node->nd_lit);
- ADD_CALL(ret, nd_line(node), ID2SYM(idBackquote), INT2FIX(1));
+ ADD_CALL_RECEIVER(ret, line);
+ ADD_INSN1(ret, line, putobject, node->nd_lit);
+ ADD_CALL(ret, line, ID2SYM(idBackquote), INT2FIX(1));
if (poped) {
- ADD_INSN(ret, nd_line(node), pop);
+ ADD_INSN(ret, line, pop);
}
break;
}
case NODE_DXSTR:{
- ADD_CALL_RECEIVER(ret, nd_line(node));
+ ADD_CALL_RECEIVER(ret, line);
compile_dstr(iseq, ret, node);
- ADD_CALL(ret, nd_line(node), ID2SYM(idBackquote), INT2FIX(1));
+ ADD_CALL(ret, line, ID2SYM(idBackquote), INT2FIX(1));
if (poped) {
- ADD_INSN(ret, nd_line(node), pop);
+ ADD_INSN(ret, line, pop);
}
break;
}
@@ -4563,10 +4838,10 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
COMPILE(ret, "nd_body", node->nd_body);
if (poped) {
- ADD_INSN(ret, nd_line(node), pop);
+ ADD_INSN(ret, line, pop);
}
else {
- ADD_INSN(ret, nd_line(node), tostring);
+ ADD_INSN(ret, line, tostring);
}
break;
}
@@ -4574,83 +4849,78 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
compile_dregx(iseq, ret, node);
if (poped) {
- ADD_INSN(ret, nd_line(node), pop);
+ ADD_INSN(ret, line, pop);
}
break;
}
case NODE_DREGX_ONCE:{
- /* TODO: once? */
- LABEL *lend = NEW_LABEL(nd_line(node));
- 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, nd_line(node), onceinlinecache, lend, INT2FIX(ic_index));
- ADD_INSN(ret, nd_line(node), pop);
-
- compile_dregx(iseq, ret, node);
-
- ADD_INSN1(ret, nd_line(node), setinlinecache, INT2FIX(ic_index));
- ADD_LABEL(ret, lend);
+ ADD_INSN2(ret, line, once, block_iseq, INT2FIX(ic_index));
if (poped) {
- ADD_INSN(ret, nd_line(node), pop);
+ ADD_INSN(ret, line, pop);
}
break;
}
case NODE_ARGSCAT:{
if (poped) {
COMPILE(ret, "argscat head", node->nd_head);
- ADD_INSN1(ret, nd_line(node), splatarray, Qfalse);
- ADD_INSN(ret, nd_line(node), pop);
+ ADD_INSN1(ret, line, splatarray, Qfalse);
+ ADD_INSN(ret, line, pop);
COMPILE(ret, "argscat body", node->nd_body);
- ADD_INSN1(ret, nd_line(node), splatarray, Qfalse);
- ADD_INSN(ret, nd_line(node), pop);
+ ADD_INSN1(ret, line, splatarray, Qfalse);
+ ADD_INSN(ret, line, pop);
}
else {
COMPILE(ret, "argscat head", node->nd_head);
COMPILE(ret, "argscat body", node->nd_body);
- ADD_INSN(ret, nd_line(node), concatarray);
+ ADD_INSN(ret, line, concatarray);
}
break;
}
case NODE_ARGSPUSH:{
if (poped) {
COMPILE(ret, "arsgpush head", node->nd_head);
- ADD_INSN1(ret, nd_line(node), splatarray, Qfalse);
- ADD_INSN(ret, nd_line(node), pop);
+ ADD_INSN1(ret, line, splatarray, Qfalse);
+ ADD_INSN(ret, line, pop);
COMPILE_(ret, "argspush body", node->nd_body, poped);
}
else {
COMPILE(ret, "arsgpush head", node->nd_head);
COMPILE_(ret, "argspush body", node->nd_body, poped);
- ADD_INSN1(ret, nd_line(node), newarray, INT2FIX(1));
- ADD_INSN(ret, nd_line(node), concatarray);
+ ADD_INSN1(ret, line, newarray, INT2FIX(1));
+ ADD_INSN(ret, line, concatarray);
}
break;
}
case NODE_SPLAT:{
COMPILE(ret, "splat", node->nd_head);
- ADD_INSN1(ret, nd_line(node), splatarray, Qtrue);
+ ADD_INSN1(ret, line, splatarray, Qtrue);
if (poped) {
- ADD_INSN(ret, nd_line(node), pop);
+ ADD_INSN(ret, line, pop);
}
break;
}
case NODE_DEFN:{
VALUE iseqval = NEW_ISEQVAL(node->nd_defn,
rb_str_dup(rb_id2str(node->nd_mid)),
- ISEQ_TYPE_METHOD, nd_line(node));
+ ISEQ_TYPE_METHOD, line);
debugp_param("defn/iseq", iseqval);
- ADD_INSN1(ret, nd_line(node), putspecialobject, INT2FIX(VM_SPECIAL_OBJECT_VMCORE));
- ADD_INSN1(ret, nd_line(node), putspecialobject, INT2FIX(VM_SPECIAL_OBJECT_CBASE));
- ADD_INSN1(ret, nd_line(node), putobject, ID2SYM(node->nd_mid));
- ADD_INSN1(ret, nd_line(node), putiseq, iseqval);
- ADD_SEND (ret, nd_line(node), ID2SYM(id_core_define_method), INT2FIX(3));
+ ADD_INSN1(ret, line, putspecialobject, INT2FIX(VM_SPECIAL_OBJECT_VMCORE));
+ ADD_INSN1(ret, line, putspecialobject, INT2FIX(VM_SPECIAL_OBJECT_CBASE));
+ ADD_INSN1(ret, line, putobject, ID2SYM(node->nd_mid));
+ ADD_INSN1(ret, line, putiseq, iseqval);
+ ADD_SEND (ret, line, ID2SYM(id_core_define_method), INT2FIX(3));
if (poped) {
- ADD_INSN(ret, nd_line(node), pop);
+ ADD_INSN(ret, line, pop);
}
debugp_param("defn", iseqval);
@@ -4659,52 +4929,52 @@ 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)),
- ISEQ_TYPE_METHOD, nd_line(node));
+ ISEQ_TYPE_METHOD, line);
debugp_param("defs/iseq", iseqval);
- ADD_INSN1(ret, nd_line(node), putspecialobject, INT2FIX(VM_SPECIAL_OBJECT_VMCORE));
+ ADD_INSN1(ret, line, putspecialobject, INT2FIX(VM_SPECIAL_OBJECT_VMCORE));
COMPILE(ret, "defs: recv", node->nd_recv);
- ADD_INSN1(ret, nd_line(node), putobject, ID2SYM(node->nd_mid));
- ADD_INSN1(ret, nd_line(node), putiseq, iseqval);
- ADD_SEND (ret, nd_line(node), ID2SYM(id_core_define_singleton_method), INT2FIX(3));
+ 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));
if (poped) {
- ADD_INSN(ret, nd_line(node), pop);
+ ADD_INSN(ret, line, pop);
}
break;
}
case NODE_ALIAS:{
- ADD_INSN1(ret, nd_line(node), putspecialobject, INT2FIX(VM_SPECIAL_OBJECT_VMCORE));
- ADD_INSN1(ret, nd_line(node), putspecialobject, INT2FIX(VM_SPECIAL_OBJECT_CBASE));
+ ADD_INSN1(ret, line, putspecialobject, INT2FIX(VM_SPECIAL_OBJECT_VMCORE));
+ 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, nd_line(node), ID2SYM(id_core_set_method_alias), INT2FIX(3));
+ ADD_SEND(ret, line, ID2SYM(id_core_set_method_alias), INT2FIX(3));
if (poped) {
- ADD_INSN(ret, nd_line(node), pop);
+ ADD_INSN(ret, line, pop);
}
break;
}
case NODE_VALIAS:{
- ADD_INSN1(ret, nd_line(node), putspecialobject, INT2FIX(VM_SPECIAL_OBJECT_VMCORE));
- ADD_INSN1(ret, nd_line(node), putobject, ID2SYM(node->u1.id));
- ADD_INSN1(ret, nd_line(node), putobject, ID2SYM(node->u2.id));
- ADD_SEND(ret, nd_line(node), ID2SYM(id_core_set_variable_alias), INT2FIX(2));
+ 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));
if (poped) {
- ADD_INSN(ret, nd_line(node), pop);
+ ADD_INSN(ret, line, pop);
}
break;
}
case NODE_UNDEF:{
- ADD_INSN1(ret, nd_line(node), putspecialobject, INT2FIX(VM_SPECIAL_OBJECT_VMCORE));
- ADD_INSN1(ret, nd_line(node), putspecialobject, INT2FIX(VM_SPECIAL_OBJECT_CBASE));
+ 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, nd_line(node), ID2SYM(id_core_undef_method), INT2FIX(2));
+ ADD_SEND(ret, line, ID2SYM(id_core_undef_method), INT2FIX(2));
if (poped) {
- ADD_INSN(ret, nd_line(node), pop);
+ ADD_INSN(ret, line, pop);
}
break;
}
@@ -4713,14 +4983,17 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
NEW_CHILD_ISEQVAL(
node->nd_body,
rb_sprintf("<class:%s>", rb_id2name(node->nd_cpath->nd_mid)),
- ISEQ_TYPE_CLASS, nd_line(node));
+ ISEQ_TYPE_CLASS, line);
VALUE noscope = compile_cpath(ret, iseq, node->nd_cpath);
+ int flags = VM_DEFINECLASS_TYPE_CLASS;
+ if (!noscope) flags |= VM_DEFINECLASS_FLAG_SCOPED;
+ if (node->nd_super) flags |= VM_DEFINECLASS_FLAG_HAS_SUPERCLASS;
COMPILE(ret, "super", node->nd_super);
- ADD_INSN3(ret, nd_line(node), defineclass,
- ID2SYM(node->nd_cpath->nd_mid), iseqval, INT2FIX(noscope ? 3 : 0));
+ ADD_INSN3(ret, line, defineclass,
+ ID2SYM(node->nd_cpath->nd_mid), iseqval, INT2FIX(flags));
if (poped) {
- ADD_INSN(ret, nd_line(node), pop);
+ ADD_INSN(ret, line, pop);
}
break;
}
@@ -4728,39 +5001,42 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
VALUE iseqval = NEW_CHILD_ISEQVAL(
node->nd_body,
rb_sprintf("<module:%s>", rb_id2name(node->nd_cpath->nd_mid)),
- ISEQ_TYPE_CLASS, nd_line(node));
+ ISEQ_TYPE_CLASS, line);
VALUE noscope = compile_cpath(ret, iseq, node->nd_cpath);
- ADD_INSN (ret, nd_line(node), putnil); /* dummy */
- ADD_INSN3(ret, nd_line(node), defineclass,
- ID2SYM(node->nd_cpath->nd_mid), iseqval, INT2FIX(noscope ? 5 : 2));
+ int flags = VM_DEFINECLASS_TYPE_MODULE;
+ if (!noscope) flags |= VM_DEFINECLASS_FLAG_SCOPED;
+ ADD_INSN (ret, line, putnil); /* dummy */
+ ADD_INSN3(ret, line, defineclass,
+ ID2SYM(node->nd_cpath->nd_mid), iseqval, INT2FIX(flags));
if (poped) {
- ADD_INSN(ret, nd_line(node), pop);
+ ADD_INSN(ret, line, pop);
}
break;
}
case NODE_SCLASS:{
ID singletonclass;
VALUE iseqval =
- NEW_ISEQVAL(node->nd_body, rb_str_new2("singletonclass"),
- ISEQ_TYPE_CLASS, nd_line(node));
+ NEW_ISEQVAL(node->nd_body, rb_str_new2("singleton class"),
+ ISEQ_TYPE_CLASS, line);
COMPILE(ret, "sclass#recv", node->nd_recv);
- ADD_INSN (ret, nd_line(node), putnil);
+ ADD_INSN (ret, line, putnil);
CONST_ID(singletonclass, "singletonclass");
- ADD_INSN3(ret, nd_line(node), defineclass,
- ID2SYM(singletonclass), iseqval, INT2FIX(1));
+ ADD_INSN3(ret, line, defineclass,
+ ID2SYM(singletonclass), iseqval,
+ INT2FIX(VM_DEFINECLASS_TYPE_SINGLETON_CLASS));
if (poped) {
- ADD_INSN(ret, nd_line(node), pop);
+ ADD_INSN(ret, line, pop);
}
break;
}
case NODE_COLON2:{
if (rb_is_const_id(node->nd_mid)) {
/* constant */
- LABEL *lend = NEW_LABEL(nd_line(node));
- int ic_index = iseq->ic_size++;
+ LABEL *lend = NEW_LABEL(line);
+ int ic_index = iseq->is_size++;
DECL_ANCHOR(pref);
DECL_ANCHOR(body);
@@ -4770,16 +5046,16 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
compile_colon2(iseq, node, pref, body);
if (LIST_SIZE_ZERO(pref)) {
if (iseq->compile_data->option->inline_const_cache) {
- ADD_INSN2(ret, nd_line(node), getinlinecache, lend, INT2FIX(ic_index));
+ ADD_INSN2(ret, line, getinlinecache, lend, INT2FIX(ic_index));
}
else {
- ADD_INSN(ret, nd_line(node), putnil);
+ ADD_INSN(ret, line, putnil);
}
ADD_SEQ(ret, body);
if (iseq->compile_data->option->inline_const_cache) {
- ADD_INSN1(ret, nd_line(node), setinlinecache, INT2FIX(ic_index));
+ ADD_INSN1(ret, line, setinlinecache, INT2FIX(ic_index));
ADD_LABEL(ret, lend);
}
}
@@ -4790,38 +5066,38 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
}
else {
/* function call */
- ADD_CALL_RECEIVER(ret, nd_line(node));
+ ADD_CALL_RECEIVER(ret, line);
COMPILE(ret, "colon2#nd_head", node->nd_head);
- ADD_CALL(ret, nd_line(node), ID2SYM(node->nd_mid),
+ ADD_CALL(ret, line, ID2SYM(node->nd_mid),
INT2FIX(1));
}
if (poped) {
- ADD_INSN(ret, nd_line(node), pop);
+ ADD_INSN(ret, line, pop);
}
break;
}
case NODE_COLON3:{
- LABEL *lend = NEW_LABEL(nd_line(node));
- int ic_index = iseq->ic_size++;
+ LABEL *lend = NEW_LABEL(line);
+ int ic_index = iseq->is_size++;
- debugi("colon3#nd_mid", node->nd_mid);
+ debugi("colon3#nd_mid", node->nd_mid);
/* add cache insn */
if (iseq->compile_data->option->inline_const_cache) {
- ADD_INSN2(ret, nd_line(node), getinlinecache, lend, INT2FIX(ic_index));
- ADD_INSN(ret, nd_line(node), pop);
+ ADD_INSN2(ret, line, getinlinecache, lend, INT2FIX(ic_index));
+ ADD_INSN(ret, line, pop);
}
- ADD_INSN1(ret, nd_line(node), putobject, rb_cObject);
- ADD_INSN1(ret, nd_line(node), getconstant, ID2SYM(node->nd_mid));
+ ADD_INSN1(ret, line, putobject, rb_cObject);
+ ADD_INSN1(ret, line, getconstant, ID2SYM(node->nd_mid));
if (iseq->compile_data->option->inline_const_cache) {
- ADD_INSN1(ret, nd_line(node), setinlinecache, INT2FIX(ic_index));
+ ADD_INSN1(ret, line, setinlinecache, INT2FIX(ic_index));
ADD_LABEL(ret, lend);
}
if (poped) {
- ADD_INSN(ret, nd_line(node), pop);
+ ADD_INSN(ret, line, pop);
}
break;
}
@@ -4831,19 +5107,19 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
COMPILE(ret, "min", (NODE *) node->nd_beg);
COMPILE(ret, "max", (NODE *) node->nd_end);
if (poped) {
- ADD_INSN(ret, nd_line(node), pop);
- ADD_INSN(ret, nd_line(node), pop);
+ ADD_INSN(ret, line, pop);
+ ADD_INSN(ret, line, pop);
}
else {
- ADD_INSN1(ret, nd_line(node), newrange, flag);
+ ADD_INSN1(ret, line, newrange, flag);
}
break;
}
case NODE_FLIP2:
case NODE_FLIP3:{
- LABEL *lend = NEW_LABEL(nd_line(node));
- LABEL *lfin = NEW_LABEL(nd_line(node));
- LABEL *ltrue = NEW_LABEL(nd_line(node));
+ LABEL *lend = NEW_LABEL(line);
+ LABEL *lfin = NEW_LABEL(line);
+ LABEL *ltrue = NEW_LABEL(line);
rb_iseq_t *local_iseq = iseq->local_iseq;
rb_num_t cnt;
VALUE key;
@@ -4851,63 +5127,63 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
cnt = local_iseq->flip_cnt++ + DEFAULT_SPECIAL_VAR_COUNT;
key = INT2FIX(cnt);
- ADD_INSN2(ret, nd_line(node), getspecial, key, INT2FIX(0));
- ADD_INSNL(ret, nd_line(node), branchif, lend);
+ ADD_INSN2(ret, line, getspecial, key, INT2FIX(0));
+ ADD_INSNL(ret, line, branchif, lend);
/* *flip == 0 */
COMPILE(ret, "flip2 beg", node->nd_beg);
- ADD_INSN(ret, nd_line(node), dup);
- ADD_INSNL(ret, nd_line(node), branchunless, lfin);
+ ADD_INSN(ret, line, dup);
+ ADD_INSNL(ret, line, branchunless, lfin);
if (nd_type(node) == NODE_FLIP3) {
- ADD_INSN(ret, nd_line(node), dup);
- ADD_INSN1(ret, nd_line(node), setspecial, key);
- ADD_INSNL(ret, nd_line(node), jump, lfin);
+ ADD_INSN(ret, line, dup);
+ ADD_INSN1(ret, line, setspecial, key);
+ ADD_INSNL(ret, line, jump, lfin);
}
else {
- ADD_INSN1(ret, nd_line(node), setspecial, key);
+ ADD_INSN1(ret, line, setspecial, key);
}
/* *flip == 1 */
ADD_LABEL(ret, lend);
COMPILE(ret, "flip2 end", node->nd_end);
- ADD_INSNL(ret, nd_line(node), branchunless, ltrue);
- ADD_INSN1(ret, nd_line(node), putobject, Qfalse);
- ADD_INSN1(ret, nd_line(node), setspecial, key);
+ ADD_INSNL(ret, line, branchunless, ltrue);
+ ADD_INSN1(ret, line, putobject, Qfalse);
+ ADD_INSN1(ret, line, setspecial, key);
ADD_LABEL(ret, ltrue);
- ADD_INSN1(ret, nd_line(node), putobject, Qtrue);
+ ADD_INSN1(ret, line, putobject, Qtrue);
ADD_LABEL(ret, lfin);
break;
}
case NODE_SELF:{
if (!poped) {
- ADD_INSN(ret, nd_line(node), putself);
+ ADD_INSN(ret, line, putself);
}
break;
}
case NODE_NIL:{
if (!poped) {
- ADD_INSN(ret, nd_line(node), putnil);
+ ADD_INSN(ret, line, putnil);
}
break;
}
case NODE_TRUE:{
if (!poped) {
- ADD_INSN1(ret, nd_line(node), putobject, Qtrue);
+ ADD_INSN1(ret, line, putobject, Qtrue);
}
break;
}
case NODE_FALSE:{
if (!poped) {
- ADD_INSN1(ret, nd_line(node), putobject, Qfalse);
+ ADD_INSN1(ret, line, putobject, Qfalse);
}
break;
}
case NODE_ERRINFO:{
if (!poped) {
if (iseq->type == ISEQ_TYPE_RESCUE) {
- ADD_INSN2(ret, nd_line(node), getdynamic, INT2FIX(2), INT2FIX(0));
+ ADD_INSN2(ret, line, getlocal, INT2FIX(2), INT2FIX(0));
}
else {
rb_iseq_t *ip = iseq;
@@ -4920,24 +5196,29 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
level++;
}
if (ip) {
- ADD_INSN2(ret, nd_line(node), getdynamic, INT2FIX(2), INT2FIX(level));
+ ADD_INSN2(ret, line, getlocal, INT2FIX(2), INT2FIX(level));
}
else {
- ADD_INSN(ret, nd_line(node), putnil);
+ ADD_INSN(ret, line, putnil);
}
}
}
break;
}
case NODE_DEFINED:{
- if (!poped) {
+ if (poped) break;
+ if (!node->nd_head) {
+ VALUE str = rb_iseq_defined_string(DEFINED_NIL);
+ ADD_INSN1(ret, nd_line(node), putobject, str);
+ }
+ else {
LABEL *lfinish[2];
- lfinish[0] = NEW_LABEL(nd_line(node));
+ lfinish[0] = NEW_LABEL(line);
lfinish[1] = 0;
- ADD_INSN(ret, nd_line(node), putnil);
+ ADD_INSN(ret, line, putnil);
defined_expr(iseq, ret, node->nd_head, lfinish, Qtrue);
- ADD_INSN(ret, nd_line(node), swap);
- ADD_INSN(ret, nd_line(node), pop);
+ ADD_INSN(ret, line, swap);
+ ADD_INSN(ret, line, pop);
if (lfinish[1]) {
ADD_LABEL(ret, lfinish[1]);
}
@@ -4946,32 +5227,65 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
break;
}
case NODE_POSTEXE:{
- LABEL *lend = NEW_LABEL(nd_line(node));
- VALUE block = NEW_CHILD_ISEQVAL(node->nd_body, make_name_for_block(iseq), ISEQ_TYPE_BLOCK, nd_line(node));
- int ic_index = iseq->ic_size++;
-
- ADD_INSN2(ret, nd_line(node), onceinlinecache, lend, INT2FIX(ic_index));
- ADD_INSN(ret, nd_line(node), pop);
-
- ADD_INSN1(ret, nd_line(node), putspecialobject, INT2FIX(VM_SPECIAL_OBJECT_VMCORE));
- ADD_INSN1(ret, nd_line(node), putiseq, block);
- ADD_SEND (ret, nd_line(node), ID2SYM(id_core_set_postexe), INT2FIX(1));
+ /* 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, nd_line(node), setinlinecache, INT2FIX(ic_index));
- ADD_LABEL(ret, lend);
+ ADD_INSN2(ret, line, once, once_iseq, INT2FIX(is_index));
if (poped) {
- ADD_INSN(ret, nd_line(node), pop);
+ ADD_INSN(ret, line, pop);
+ }
+ break;
+ }
+ case NODE_KW_ARG:{
+ LABEL *default_label = NEW_LABEL(line);
+ LABEL *end_label = 0;
+ int idx, lv, ls;
+ ID id = node->nd_body->nd_vid;
+
+ ADD_INSN(ret, line, dup);
+ ADD_INSN1(ret, line, putobject, ID2SYM(id));
+ ADD_SEND(ret, line, ID2SYM(rb_intern("key?")), INT2FIX(1));
+ ADD_INSNL(ret, line, branchunless, default_label);
+ ADD_INSN(ret, line, dup);
+ ADD_INSN1(ret, line, putobject, ID2SYM(id));
+ ADD_SEND(ret, line, ID2SYM(rb_intern("delete")), INT2FIX(1));
+ switch (nd_type(node->nd_body)) {
+ case NODE_LASGN:
+ idx = iseq->local_iseq->local_size - get_local_var_idx(iseq, id);
+ ADD_INSN2(ret, line, setlocal, INT2FIX(idx), INT2FIX(get_lvar_level(iseq)));
+ break;
+ case NODE_DASGN:
+ case NODE_DASGN_CURR:
+ idx = get_dyna_var_idx(iseq, id, &lv, &ls);
+ ADD_INSN2(ret, line, setlocal, INT2FIX(ls - idx), INT2FIX(lv));
+ break;
+ default:
+ rb_bug("iseq_compile_each (NODE_KW_ARG): unknown node: %s", ruby_node_name(nd_type(node->nd_body)));
+ }
+ if (node->nd_body->nd_value != (NODE *)-1) {
+ end_label = NEW_LABEL(nd_line(node));
+ ADD_INSNL(ret, nd_line(node), jump, end_label);
+ }
+ ADD_LABEL(ret, default_label);
+ if (node->nd_body->nd_value != (NODE *)-1) {
+ COMPILE_POPED(ret, "keyword default argument", node->nd_body);
+ ADD_LABEL(ret, end_label);
}
break;
}
case NODE_DSYM:{
compile_dstr(iseq, ret, node);
if (!poped) {
- ADD_SEND(ret, nd_line(node), ID2SYM(idIntern), INT2FIX(0));
+ ADD_SEND(ret, line, ID2SYM(idIntern), INT2FIX(0));
}
else {
- ADD_INSN(ret, nd_line(node), pop);
+ ADD_INSN(ret, line, pop);
}
break;
}
@@ -4986,8 +5300,8 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
argc = setup_args(iseq, args, node->nd_args, &flag);
if (node->nd_recv == (NODE *) 1) {
- flag |= VM_CALL_FCALL_BIT;
- ADD_INSN(recv, nd_line(node), putself);
+ flag |= VM_CALL_FCALL;
+ ADD_INSN(recv, line, putself);
}
else {
COMPILE(recv, "recv", node->nd_recv);
@@ -4997,51 +5311,37 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
debugp_param("nd_mid", ID2SYM(node->nd_mid));
if (!poped) {
- ADD_INSN(ret, nd_line(node), putnil);
+ ADD_INSN(ret, line, putnil);
ADD_SEQ(ret, recv);
ADD_SEQ(ret, args);
- if (flag & VM_CALL_ARGS_BLOCKARG_BIT) {
- ADD_INSN1(ret, nd_line(node), topn, INT2FIX(1));
- if (flag & VM_CALL_ARGS_SPLAT_BIT) {
- ADD_INSN1(ret, nd_line(node), putobject, INT2FIX(-1));
- ADD_SEND(ret, nd_line(node), ID2SYM(idAREF), INT2FIX(1));
+ if (flag & VM_CALL_ARGS_BLOCKARG) {
+ 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_INSN1(ret, nd_line(node), setn, FIXNUM_INC(argc, 3));
- ADD_INSN (ret, nd_line(node), pop);
+ ADD_INSN1(ret, line, setn, FIXNUM_INC(argc, 3));
+ ADD_INSN (ret, line, pop);
}
- else if (flag & VM_CALL_ARGS_SPLAT_BIT) {
- ADD_INSN(ret, nd_line(node), dup);
- ADD_INSN1(ret, nd_line(node), putobject, INT2FIX(-1));
- ADD_SEND(ret, nd_line(node), ID2SYM(idAREF), INT2FIX(1));
- ADD_INSN1(ret, nd_line(node), setn, FIXNUM_INC(argc, 2));
- ADD_INSN (ret, nd_line(node), pop);
+ 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_INSN1(ret, line, setn, FIXNUM_INC(argc, 2));
+ ADD_INSN (ret, line, pop);
}
else {
- ADD_INSN1(ret, nd_line(node), setn, FIXNUM_INC(argc, 1));
+ ADD_INSN1(ret, line, setn, FIXNUM_INC(argc, 1));
}
}
else {
ADD_SEQ(ret, recv);
ADD_SEQ(ret, args);
}
- ADD_SEND_R(ret, nd_line(node), ID2SYM(node->nd_mid), argc, 0, LONG2FIX(flag));
- ADD_INSN(ret, nd_line(node), pop);
-
- break;
- }
- case NODE_OPTBLOCK:{
- /* for optimize */
- LABEL *redo_label = NEW_LABEL(0);
- LABEL *next_label = NEW_LABEL(0);
-
- iseq->compile_data->start_label = next_label;
- iseq->compile_data->redo_label = redo_label;
+ ADD_SEND_R(ret, line, ID2SYM(node->nd_mid), argc, 0, LONG2FIX(flag));
+ ADD_INSN(ret, line, pop);
- ADD_LABEL(ret, redo_label);
- COMPILE_(ret, "optblock body", node->nd_head, 1 /* pop */ );
- ADD_LABEL(ret, next_label);
- ADD_INSN(ret, 0, opt_checkenv);
break;
}
case NODE_PRELUDE:{
@@ -5051,13 +5351,13 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
}
case NODE_LAMBDA:{
/* compile same as lambda{...} */
- VALUE block = NEW_CHILD_ISEQVAL(node->nd_body, make_name_for_block(iseq), ISEQ_TYPE_BLOCK, nd_line(node));
+ VALUE block = NEW_CHILD_ISEQVAL(node->nd_body, make_name_for_block(iseq), ISEQ_TYPE_BLOCK, line);
VALUE argc = INT2FIX(0);
- ADD_INSN1(ret, nd_line(node), putspecialobject, INT2FIX(VM_SPECIAL_OBJECT_VMCORE));
- ADD_CALL_WITH_BLOCK(ret, nd_line(node), ID2SYM(idLambda), argc, block);
+ ADD_INSN1(ret, line, putspecialobject, INT2FIX(VM_SPECIAL_OBJECT_VMCORE));
+ ADD_CALL_WITH_BLOCK(ret, line, ID2SYM(idLambda), argc, block);
if (poped) {
- ADD_INSN(ret, nd_line(node), pop);
+ ADD_INSN(ret, line, pop);
}
break;
}
@@ -5066,6 +5366,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;
}
@@ -5117,18 +5424,20 @@ insn_data_to_s_detail(INSN *iobj)
{
rb_iseq_t *iseq = (rb_iseq_t *)OPERAND_AT(iobj, j);
VALUE val = Qnil;
- if (iseq) {
+ if (0 && iseq) { /* TODO: invalidate now */
val = iseq->self;
}
rb_str_concat(str, rb_inspect(val));
}
break;
case TS_LINDEX:
- case TS_DINDEX:
case TS_NUM: /* ulong */
case TS_VALUE: /* VALUE */
- rb_str_concat(str, rb_inspect(OPERAND_AT(iobj, j)));
- break;
+ {
+ VALUE v = OPERAND_AT(iobj, j);
+ rb_str_concat(str, rb_inspect(v));
+ break;
+ }
case TS_ID: /* ID */
rb_str_concat(str, rb_inspect(OPERAND_AT(iobj, j)));
break;
@@ -5137,10 +5446,17 @@ insn_data_to_s_detail(INSN *iobj)
struct rb_global_entry *entry = (struct rb_global_entry *)
(OPERAND_AT(iobj, j) & (~1));
rb_str_cat2(str, rb_id2name(entry->id));
+ break;
}
- case TS_IC: /* method cache */
+ case TS_IC: /* inline cache */
rb_str_catf(str, "<ic:%d>", FIX2INT(OPERAND_AT(iobj, j)));
break;
+ case TS_CALLINFO: /* call info */
+ {
+ rb_call_info_t *ci = (rb_call_info_t *)OPERAND_AT(iobj, j);
+ rb_str_catf(str, "<callinfo:%s, %d>", ci->mid ? rb_id2name(ci->mid) : "", ci->orig_argc);
+ break;
+ }
case TS_CDHASH: /* case/when condition cache */
rb_str_cat2(str, "<ch>");
break;
@@ -5172,8 +5488,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), insn_data_line_no(iobj));
pos += insn_data_length(iobj);
break;
}
@@ -5203,6 +5518,12 @@ dump_disasm_list(struct iseq_link_element *link)
printf("---------------------\n");
}
+const char *
+rb_insns_name(int i)
+{
+ return insn_name_info[i];
+}
+
VALUE
rb_insns_name_array(void)
{
@@ -5268,16 +5589,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;
@@ -5291,6 +5613,8 @@ iseq_build_from_ary_exception(rb_iseq_t *iseq, struct st_table *labels_table,
lcont = register_label(iseq, labels_table, ptr[4]);
sp = NUM2INT(ptr[5]);
+ (void)sp;
+
ADD_CATCH_ENTRY(type, lstart, lend, eiseqval, lcont);
}
return COMPILE_OK;
@@ -5310,15 +5634,33 @@ insn_make_insn_table(void)
return table;
}
+static VALUE
+iseq_build_load_iseq(rb_iseq_t *iseq, VALUE op)
+{
+ VALUE iseqval;
+ if (RB_TYPE_P(op, T_ARRAY)) {
+ iseqval = rb_iseq_load(op, iseq->self, Qnil);
+ }
+ else if (CLASS_OF(op) == rb_cISeq) {
+ iseqval = op;
+ }
+ else {
+ rb_raise(rb_eSyntaxError, "ISEQ is required");
+ }
+ iseq_add_mark_object(iseq, iseqval);
+ return iseqval;
+}
+
static int
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;
+
/*
* index -> LABEL *label
*/
@@ -5338,22 +5680,22 @@ iseq_build_from_ary_body(rb_iseq_t *iseq, LINK_ANCHOR *anchor,
else if (FIXNUM_P(obj)) {
line_no = NUM2INT(obj);
}
- else if (TYPE(obj) == T_ARRAY) {
+ else if (RB_TYPE_P(obj, T_ARRAY)) {
VALUE *argv = 0;
int argc = RARRAY_LENINT(obj) - 1;
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);
- rb_compile_error(RSTRING_PTR(iseq->filename), line_no,
+ rb_compile_error(RSTRING_PTR(iseq->location.path), line_no,
"unknown instruction: %s", RSTRING_PTR(insn));
}
if (argc != insn_len((VALUE)insn_id)-1) {
- rb_compile_error(RSTRING_PTR(iseq->filename), line_no,
+ rb_compile_error(RSTRING_PTR(iseq->location.path), line_no,
"operand size mismatch");
}
@@ -5368,7 +5710,6 @@ iseq_build_from_ary_body(rb_iseq_t *iseq, LINK_ANCHOR *anchor,
break;
}
case TS_LINDEX:
- case TS_DINDEX:
case TS_NUM:
(void)NUM2INT(op);
argv[j] = op;
@@ -5380,16 +5721,7 @@ iseq_build_from_ary_body(rb_iseq_t *iseq, LINK_ANCHOR *anchor,
case TS_ISEQ:
{
if (op != Qnil) {
- if (TYPE(op) == T_ARRAY) {
- argv[j] = rb_iseq_load(op, iseq->self, Qnil);
- }
- else if (CLASS_OF(op) == rb_cISeq) {
- argv[j] = op;
- }
- else {
- rb_raise(rb_eSyntaxError, "ISEQ is required");
- }
- iseq_add_mark_object(iseq, argv[j]);
+ argv[j] = iseq_build_load_iseq(iseq, op);
}
else {
argv[j] = 0;
@@ -5402,8 +5734,30 @@ 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:
+ {
+ ID mid = 0;
+ int orig_argc = 0;
+ VALUE block = 0;
+ unsigned long flag = 0;
+
+ if (!NIL_P(op)) {
+ VALUE vmid = rb_hash_aref(op, ID2SYM(rb_intern("mid")));
+ VALUE vflag = rb_hash_aref(op, ID2SYM(rb_intern("flag")));
+ VALUE vorig_argc = rb_hash_aref(op, ID2SYM(rb_intern("orig_argc")));
+ VALUE vblock = rb_hash_aref(op, ID2SYM(rb_intern("block")));
+
+ if (!NIL_P(vmid)) mid = SYM2ID(vmid);
+ if (!NIL_P(vflag)) flag = NUM2ULONG(vflag);
+ if (!NIL_P(vorig_argc)) orig_argc = FIX2INT(vorig_argc);
+ if (!NIL_P(vblock)) block = iseq_build_load_iseq(iseq, vblock);
+ }
+ argv[j] = (VALUE)new_callinfo(iseq, mid, orig_argc, block, flag);
+ }
break;
case TS_ID:
argv[j] = rb_convert_type(op, T_SYMBOL,
@@ -5463,7 +5817,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 5b1a5102a1..3e9d63117a 100644
--- a/complex.c
+++ b/complex.c
@@ -1,5 +1,5 @@
/*
- complex.c: Coded by Tadayoshi Funaba 2008-2011
+ complex.c: Coded by Tadayoshi Funaba 2008-2012
This implementation is based on Keiju Ishitsuka's Complex library
which is written in ruby.
@@ -21,7 +21,8 @@ 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;
+ id_real, id_real_p, id_to_f, id_to_i, id_to_r, id_to_s,
+ id_i_real, id_i_imag;
#define f_boolcast(x) ((x) ? Qtrue : Qfalse)
@@ -121,7 +122,7 @@ f_mul(VALUE x, VALUE y)
if (FIXNUM_P(y)) {
long iy = FIX2LONG(y);
if (iy == 0) {
- if (FIXNUM_P(x) || TYPE(x) == T_BIGNUM)
+ if (FIXNUM_P(x) || RB_TYPE_P(x, T_BIGNUM))
return ZERO;
}
else if (iy == 1)
@@ -130,7 +131,7 @@ f_mul(VALUE x, VALUE y)
else if (FIXNUM_P(x)) {
long ix = FIX2LONG(x);
if (ix == 0) {
- if (FIXNUM_P(y) || TYPE(y) == T_BIGNUM)
+ if (FIXNUM_P(y) || RB_TYPE_P(y, T_BIGNUM))
return ZERO;
}
else if (ix == 1)
@@ -166,14 +167,14 @@ fun1(real_p)
inline static VALUE
f_to_i(VALUE x)
{
- if (TYPE(x) == T_STRING)
+ if (RB_TYPE_P(x, T_STRING))
return rb_str_to_inum(x, 10, 0);
return rb_funcall(x, id_to_i, 0);
}
inline static VALUE
f_to_f(VALUE x)
{
- if (TYPE(x) == T_STRING)
+ if (RB_TYPE_P(x, T_STRING))
return DBL2NUM(rb_str_to_dbl(x, 0));
return rb_funcall(x, id_to_f, 0);
}
@@ -209,17 +210,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);
}
@@ -229,19 +229,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;
-
- return f_boolcast(FIXNUM_P(num) && FIX2LONG(num) == 1 &&
- FIXNUM_P(den) && FIX2LONG(den) == 1);
- }
+ }
+ 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 rb_funcall(x, id_eqeq_p, 1, ONE);
}
@@ -312,11 +311,10 @@ k_complex_p(VALUE x)
inline static VALUE
nucomp_s_new_internal(VALUE klass, VALUE real, VALUE imag)
{
- NEWOBJ(obj, struct RComplex);
- OBJSETUP(obj, 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 +381,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");
}
@@ -439,6 +434,8 @@ nucomp_s_canonicalize_internal(VALUE klass, VALUE real, VALUE imag)
* Complex.rectangular(real[, imag]) -> complex
*
* Returns a complex object which denotes the given rectangular form.
+ *
+ * Complex.rectangular(1, 2) #=> (1+2i)
*/
static VALUE
nucomp_s_new(int argc, VALUE *argv, VALUE klass)
@@ -478,6 +475,31 @@ f_complex_new2(VALUE klass, VALUE x, VALUE y)
* Complex(x[, y]) -> numeric
*
* Returns x+i*y;
+ *
+ * Complex(1, 2) #=> (1+2i)
+ * Complex('1+2i') #=> (1+2i)
+ *
+ * Syntax of string form:
+ *
+ * string form = extra spaces , complex , extra spaces ;
+ * complex = real part | [ sign ] , imaginary part
+ * | real part , sign , imaginary part
+ * | rational , "@" , rational ;
+ * real part = rational ;
+ * imaginary part = imaginary unit | unsigned rational , imaginary unit ;
+ * rational = [ sign ] , unsigned rational ;
+ * unsigned rational = numerator | numerator , "/" , denominator ;
+ * numerator = integer part | fractional part | integer part , fractional part ;
+ * denominator = digits ;
+ * integer part = digits ;
+ * fractional part = "." , digits , [ ( "e" | "E" ) , [ sign ] , digits ] ;
+ * imaginary unit = "i" | "I" | "j" | "J" ;
+ * sign = "-" | "+" ;
+ * digits = digit , { digit | "_" , digit };
+ * digit = "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" ;
+ * extra spaces = ? \s* ? ;
+ *
+ * See String#to_c.
*/
static VALUE
nucomp_f_complex(int argc, VALUE *argv, VALUE klass)
@@ -587,10 +609,10 @@ f_complex_polar(VALUE klass, VALUE x, VALUE y)
*
* Returns a complex object which denotes the given polar form.
*
- * Complex.polar(3, 0) #=> (3.0+0.0i)
- * Complex.polar(3, Math::PI/2) #=> (1.836909530733566e-16+3.0i)
- * Complex.polar(3, Math::PI) #=> (-3.0+3.673819061467132e-16i)
- * Complex.polar(3, -Math::PI/2) #=> (1.836909530733566e-16-3.0i)
+ * Complex.polar(3, 0) #=> (3.0+0.0i)
+ * Complex.polar(3, Math::PI/2) #=> (1.836909530733566e-16+3.0i)
+ * Complex.polar(3, Math::PI) #=> (-3.0+3.673819061467132e-16i)
+ * Complex.polar(3, -Math::PI/2) #=> (1.836909530733566e-16-3.0i)
*/
static VALUE
nucomp_s_polar(int argc, VALUE *argv, VALUE klass)
@@ -615,6 +637,9 @@ nucomp_s_polar(int argc, VALUE *argv, VALUE klass)
* cmp.real -> real
*
* Returns the real part.
+ *
+ * Complex(7).real #=> 7
+ * Complex(9, -4).real #=> 9
*/
static VALUE
nucomp_real(VALUE self)
@@ -629,6 +654,9 @@ nucomp_real(VALUE self)
* cmp.imaginary -> real
*
* Returns the imaginary part.
+ *
+ * Complex(7).imaginary #=> 0
+ * Complex(9, -4).imaginary #=> -4
*/
static VALUE
nucomp_imag(VALUE self)
@@ -642,6 +670,8 @@ nucomp_imag(VALUE self)
* -cmp -> complex
*
* Returns negation of the value.
+ *
+ * -Complex(1, 2) #=> (-1-2i)
*/
static VALUE
nucomp_negate(VALUE self)
@@ -679,6 +709,12 @@ f_addsub(VALUE self, VALUE other,
* cmp + numeric -> complex
*
* Performs addition.
+ *
+ * Complex(2, 3) + Complex(2, 3) #=> (4+6i)
+ * Complex(900) + Complex(1) #=> (901+0i)
+ * Complex(-2, 9) + Complex(-9, 2) #=> (-11+11i)
+ * Complex(9, 8) + 4 #=> (13+8i)
+ * Complex(20, 9) + 9.8 #=> (29.8+9i)
*/
static VALUE
nucomp_add(VALUE self, VALUE other)
@@ -691,6 +727,12 @@ nucomp_add(VALUE self, VALUE other)
* cmp - numeric -> complex
*
* Performs subtraction.
+ *
+ * Complex(2, 3) - Complex(2, 3) #=> (0+0i)
+ * Complex(900) - Complex(1) #=> (899+0i)
+ * Complex(-2, 9) - Complex(-9, 2) #=> (7+7i)
+ * Complex(9, 8) - 4 #=> (5+8i)
+ * Complex(20, 9) - 9.8 #=> (10.2+9i)
*/
static VALUE
nucomp_sub(VALUE self, VALUE other)
@@ -703,6 +745,12 @@ nucomp_sub(VALUE self, VALUE other)
* cmp * numeric -> complex
*
* Performs multiplication.
+ *
+ * Complex(2, 3) * Complex(2, 3) #=> (-5+12i)
+ * Complex(900) * Complex(1) #=> (900+0i)
+ * Complex(-2, 9) * Complex(-9, 2) #=> (0-85i)
+ * Complex(9, 8) * 4 #=> (36+32i)
+ * Complex(20, 9) * 9.8 #=> (196.0+88.2i)
*/
static VALUE
nucomp_mul(VALUE self, VALUE other)
@@ -790,10 +838,11 @@ f_divide(VALUE self, VALUE other,
*
* Performs division.
*
- * For example:
- *
- * Complex(10.0) / 3 #=> (3.3333333333333335+(0/1)*i)
- * Complex(10) / 3 #=> ((10/3)+(0/1)*i) # not (3+0i)
+ * Complex(2, 3) / Complex(2, 3) #=> ((1/1)+(0/1)*i)
+ * Complex(900) / Complex(1) #=> ((900/1)+(0/1)*i)
+ * Complex(-2, 9) / Complex(-9, 2) #=> ((36/85)-(77/85)*i)
+ * Complex(9, 8) / 4 #=> ((9/4)+(2/1)*i)
+ * Complex(20, 9) / 9.8 #=> (2.0408163265306123+0.9183673469387754i)
*/
static VALUE
nucomp_div(VALUE self, VALUE other)
@@ -809,9 +858,7 @@ nucomp_div(VALUE self, VALUE other)
*
* Performs division as each part is a float, never returns a float.
*
- * For example:
- *
- * Complex(11,22).fdiv(3) #=> (3.6666666666666665+7.333333333333333i)
+ * Complex(11, 22).fdiv(3) #=> (3.6666666666666665+7.333333333333333i)
*/
static VALUE
nucomp_fdiv(VALUE self, VALUE other)
@@ -831,10 +878,8 @@ f_reciprocal(VALUE x)
*
* Performs exponentiation.
*
- * For example:
- *
- * Complex('i') ** 2 #=> (-1+0i)
- * Complex(-8) ** Rational(1,3) #=> (1.0000000000000002+1.7320508075688772i)
+ * Complex('i') ** 2 #=> (-1+0i)
+ * Complex(-8) ** Rational(1, 3) #=> (1.0000000000000002+1.7320508075688772i)
*/
static VALUE
nucomp_expt(VALUE self, VALUE other)
@@ -887,7 +932,7 @@ nucomp_expt(VALUE self, VALUE other)
if (r)
break;
- x = f_complex_new2(CLASS_OF(self),
+ x = nucomp_s_new_internal(CLASS_OF(self),
f_sub(f_mul(dat->real, dat->real),
f_mul(dat->imag, dat->imag)),
f_mul(f_mul(TWO, dat->real), dat->imag));
@@ -920,6 +965,12 @@ nucomp_expt(VALUE self, VALUE other)
* cmp == object -> true or false
*
* Returns true if cmp equals object numerically.
+ *
+ * Complex(2, 3) == Complex(2, 3) #=> true
+ * Complex(5) == 5 #=> true
+ * Complex(0) == 0.0 #=> true
+ * Complex('1/3') == 0.33 #=> false
+ * Complex('1/2') == '1/2' #=> false
*/
static VALUE
nucomp_eqeq_p(VALUE self, VALUE other)
@@ -944,7 +995,7 @@ nucomp_coerce(VALUE self, VALUE other)
{
if (k_numeric_p(other) && f_real_p(other))
return rb_assoc_new(f_complex_new_bang1(CLASS_OF(self), other), self);
- if (TYPE(other) == T_COMPLEX)
+ if (RB_TYPE_P(other, T_COMPLEX))
return rb_assoc_new(other, self);
rb_raise(rb_eTypeError, "%s can't be coerced into %s",
@@ -958,6 +1009,9 @@ nucomp_coerce(VALUE self, VALUE other)
* cmp.magnitude -> real
*
* Returns the absolute part of its polar form.
+ *
+ * Complex(-1).abs #=> 1
+ * Complex(3.0, -4.0).abs #=> 5.0
*/
static VALUE
nucomp_abs(VALUE self)
@@ -984,6 +1038,9 @@ nucomp_abs(VALUE self)
* cmp.abs2 -> real
*
* Returns square of the absolute value.
+ *
+ * Complex(-1).abs2 #=> 1
+ * Complex(3.0, -4.0).abs2 #=> 25.0
*/
static VALUE
nucomp_abs2(VALUE self)
@@ -1001,8 +1058,7 @@ nucomp_abs2(VALUE self)
*
* Returns the angle part of its polar form.
*
- * Complex.polar(3, Math::PI/2).arg #=> 1.5707963267948966
- *
+ * Complex.polar(3, Math::PI/2).arg #=> 1.5707963267948966
*/
static VALUE
nucomp_arg(VALUE self)
@@ -1017,6 +1073,8 @@ nucomp_arg(VALUE self)
* cmp.rectangular -> array
*
* Returns an array; [cmp.real, cmp.imag].
+ *
+ * Complex(1, 2).rectangular #=> [1, 2]
*/
static VALUE
nucomp_rect(VALUE self)
@@ -1030,6 +1088,8 @@ nucomp_rect(VALUE self)
* cmp.polar -> array
*
* Returns an array; [cmp.abs, cmp.arg].
+ *
+ * Complex(1, 2).polar #=> [2.23606797749979, 1.1071487177940904]
*/
static VALUE
nucomp_polar(VALUE self)
@@ -1043,6 +1103,8 @@ nucomp_polar(VALUE self)
* cmp.conjugate -> complex
*
* Returns the complex conjugate.
+ *
+ * Complex(1, 2).conjugate #=> (1-2i)
*/
static VALUE
nucomp_conj(VALUE self)
@@ -1110,8 +1172,6 @@ nucomp_denominator(VALUE self)
*
* Returns the numerator.
*
- * For example:
- *
* 1 2 3+4i <- numerator
* - + -i -> ----
* 2 3 6 <- denominator
@@ -1173,15 +1233,13 @@ nucomp_eql_p(VALUE self, VALUE other)
inline static VALUE
f_signbit(VALUE x)
{
-#if defined(HAVE_SIGNBIT) && defined(__GNUC__) && defined(__sun__) && \
+#if defined(HAVE_SIGNBIT) && defined(__GNUC__) && defined(__sun) && \
!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);
}
@@ -1217,6 +1275,12 @@ f_format(VALUE self, VALUE (*func)(VALUE))
* cmp.to_s -> string
*
* Returns the value as a string.
+ *
+ * Complex(2).to_s #=> "2+0i"
+ * Complex('-8/6').to_s #=> "-4/3+0i"
+ * Complex('1/2i').to_s #=> "0+1/2i"
+ * Complex(0, Float::INFINITY).to_s #=> "0+Infinity*i"
+ * Complex(Float::NAN, Float::NAN).to_s #=> "NaN+NaN*i"
*/
static VALUE
nucomp_to_s(VALUE self)
@@ -1229,6 +1293,12 @@ nucomp_to_s(VALUE self)
* cmp.inspect -> string
*
* Returns the value as a string for inspection.
+ *
+ * Complex(2).inspect #=> "(2+0i)"
+ * Complex('-8/6').inspect #=> "((-4/3)+0i)"
+ * Complex('1/2i').inspect #=> "(0+(1/2)*i)"
+ * Complex(0, Float::INFINITY).inspect #=> "(0+Infinity*i)"
+ * Complex(Float::NAN, Float::NAN).inspect #=> "(NaN+NaN*i)"
*/
static VALUE
nucomp_inspect(VALUE self)
@@ -1244,6 +1314,25 @@ nucomp_inspect(VALUE self)
/* :nodoc: */
static VALUE
+nucomp_dumper(VALUE self)
+{
+ return self;
+}
+
+/* :nodoc: */
+static VALUE
+nucomp_loader(VALUE self, VALUE a)
+{
+ get_dat1(self);
+
+ RCOMPLEX_SET_REAL(dat, rb_ivar_get(a, id_i_real));
+ RCOMPLEX_SET_IMAG(dat, rb_ivar_get(a, id_i_imag));
+
+ return self;
+}
+
+/* :nodoc: */
+static VALUE
nucomp_marshal_dump(VALUE self)
{
VALUE a;
@@ -1258,13 +1347,11 @@ nucomp_marshal_dump(VALUE self)
static VALUE
nucomp_marshal_load(VALUE self, VALUE a)
{
- get_dat1(self);
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));
- dat->real = RARRAY_PTR(a)[0];
- dat->imag = RARRAY_PTR(a)[1];
- rb_copy_generic_ivar(self, a);
+ rb_ivar_set(self, id_i_real, RARRAY_AREF(a, 0));
+ rb_ivar_set(self, id_i_imag, RARRAY_AREF(a, 1));
return self;
}
@@ -1303,7 +1390,12 @@ rb_Complex(VALUE x, VALUE y)
* call-seq:
* cmp.to_i -> integer
*
- * Returns the value as an integer if possible.
+ * Returns the value as an integer if possible (the imaginary part
+ * should be exactly zero).
+ *
+ * Complex(1, 0).to_i #=> 1
+ * Complex(1, 0.0).to_i # RangeError
+ * Complex(1, 2).to_i # RangeError
*/
static VALUE
nucomp_to_i(VALUE self)
@@ -1322,7 +1414,12 @@ nucomp_to_i(VALUE self)
* call-seq:
* cmp.to_f -> float
*
- * Returns the value as a float if possible.
+ * Returns the value as a float if possible (the imaginary part should
+ * be exactly zero).
+ *
+ * Complex(1, 0).to_f #=> 1.0
+ * Complex(1, 0.0).to_f # RangeError
+ * Complex(1, 2).to_f # RangeError
*/
static VALUE
nucomp_to_f(VALUE self)
@@ -1341,8 +1438,14 @@ nucomp_to_f(VALUE self)
* call-seq:
* cmp.to_r -> rational
*
- * If the imaginary part is exactly 0, returns the real part as a Rational,
- * otherwise a RangeError is raised.
+ * Returns the value as a rational if possible (the imaginary part
+ * should be exactly zero).
+ *
+ * Complex(1, 0).to_r #=> (1/1)
+ * Complex(1, 0.0).to_r # RangeError
+ * Complex(1, 2).to_r # RangeError
+ *
+ * See rationalize.
*/
static VALUE
nucomp_to_r(VALUE self)
@@ -1361,8 +1464,14 @@ nucomp_to_r(VALUE self)
* call-seq:
* cmp.rationalize([eps]) -> rational
*
- * If the imaginary part is exactly 0, returns the real part as a Rational,
- * otherwise a RangeError is raised.
+ * Returns the value as a rational if possible (the imaginary part
+ * should be exactly zero).
+ *
+ * Complex(1.0/3, 0).rationalize #=> (1/3)
+ * Complex(1, 0.0).rationalize # RangeError
+ * Complex(1, 2).rationalize # RangeError
+ *
+ * See to_r.
*/
static VALUE
nucomp_rationalize(int argc, VALUE *argv, VALUE self)
@@ -1381,6 +1490,21 @@ nucomp_rationalize(int argc, VALUE *argv, VALUE self)
/*
* call-seq:
+ * complex.to_c -> self
+ *
+ * Returns self.
+ *
+ * Complex(2).to_c #=> (2+0i)
+ * Complex(-8, 6).to_c #=> (-8+6i)
+ */
+static VALUE
+nucomp_to_c(VALUE self)
+{
+ return self;
+}
+
+/*
+ * call-seq:
* nil.to_c -> (0+0i)
*
* Returns zero as a complex.
@@ -1403,159 +1527,298 @@ numeric_to_c(VALUE self)
return rb_complex_new1(self);
}
-static VALUE comp_pat0, comp_pat1, comp_pat2, a_slash, a_dot_and_an_e,
- null_string, underscores_pat, an_underscore;
+#include <ctype.h>
-#define WS "\\s*"
-#define DIGITS "(?:[0-9](?:_[0-9]|[0-9])*)"
-#define NUMERATOR "(?:" DIGITS "?\\.)?" DIGITS "(?:[eE][-+]?" DIGITS ")?"
-#define DENOMINATOR DIGITS
-#define NUMBER "[-+]?" NUMERATOR "(?:\\/" DENOMINATOR ")?"
-#define NUMBERNOS NUMERATOR "(?:\\/" DENOMINATOR ")?"
-#define PATTERN0 "\\A" WS "(" NUMBER ")@(" NUMBER ")" WS
-#define PATTERN1 "\\A" WS "([-+])?(" NUMBER ")?[iIjJ]" WS
-#define PATTERN2 "\\A" WS "(" NUMBER ")(([-+])(" NUMBERNOS ")?[iIjJ])?" WS
+inline static int
+issign(int c)
+{
+ return (c == '-' || c == '+');
+}
-static void
-make_patterns(void)
+static int
+read_sign(const char **s,
+ char **b)
{
- static const char comp_pat0_source[] = PATTERN0;
- static const char comp_pat1_source[] = PATTERN1;
- static const char comp_pat2_source[] = PATTERN2;
- static const char underscores_pat_source[] = "_+";
+ int sign = '?';
- if (comp_pat0) return;
+ if (issign(**s)) {
+ sign = **b = **s;
+ (*s)++;
+ (*b)++;
+ }
+ return sign;
+}
- comp_pat0 = rb_reg_new(comp_pat0_source, sizeof comp_pat0_source - 1, 0);
- rb_gc_register_mark_object(comp_pat0);
+inline static int
+isdecimal(int c)
+{
+ return isdigit((unsigned char)c);
+}
+
+static int
+read_digits(const char **s, int strict,
+ char **b)
+{
+ int us = 1;
+
+ if (!isdecimal(**s))
+ return 0;
+
+ while (isdecimal(**s) || **s == '_') {
+ if (**s == '_') {
+ if (strict) {
+ if (us)
+ return 0;
+ }
+ us = 1;
+ }
+ else {
+ **b = **s;
+ (*b)++;
+ us = 0;
+ }
+ (*s)++;
+ }
+ if (us)
+ do {
+ (*s)--;
+ } while (**s == '_');
+ return 1;
+}
- comp_pat1 = rb_reg_new(comp_pat1_source, sizeof comp_pat1_source - 1, 0);
- rb_gc_register_mark_object(comp_pat1);
+inline static int
+islettere(int c)
+{
+ return (c == 'e' || c == 'E');
+}
- comp_pat2 = rb_reg_new(comp_pat2_source, sizeof comp_pat2_source - 1, 0);
- rb_gc_register_mark_object(comp_pat2);
+static int
+read_num(const char **s, int strict,
+ char **b)
+{
+ if (**s != '.') {
+ if (!read_digits(s, strict, b))
+ return 0;
+ }
- a_slash = rb_usascii_str_new2("/");
- rb_gc_register_mark_object(a_slash);
+ if (**s == '.') {
+ **b = **s;
+ (*s)++;
+ (*b)++;
+ if (!read_digits(s, strict, b)) {
+ (*b)--;
+ return 0;
+ }
+ }
- a_dot_and_an_e = rb_usascii_str_new2(".eE");
- rb_gc_register_mark_object(a_dot_and_an_e);
+ if (islettere(**s)) {
+ **b = **s;
+ (*s)++;
+ (*b)++;
+ read_sign(s, b);
+ if (!read_digits(s, strict, b)) {
+ (*b)--;
+ return 0;
+ }
+ }
+ return 1;
+}
- null_string = rb_usascii_str_new2("");
- rb_gc_register_mark_object(null_string);
+inline static int
+read_den(const char **s, int strict,
+ char **b)
+{
+ if (!read_digits(s, strict, b))
+ return 0;
+ return 1;
+}
- underscores_pat = rb_reg_new(underscores_pat_source,
- sizeof underscores_pat_source - 1, 0);
- rb_gc_register_mark_object(underscores_pat);
+static int
+read_rat_nos(const char **s, int strict,
+ char **b)
+{
+ if (!read_num(s, strict, b))
+ return 0;
+ if (**s == '/') {
+ **b = **s;
+ (*s)++;
+ (*b)++;
+ if (!read_den(s, strict, b)) {
+ (*b)--;
+ return 0;
+ }
+ }
+ return 1;
+}
- an_underscore = rb_usascii_str_new2("_");
- rb_gc_register_mark_object(an_underscore);
+static int
+read_rat(const char **s, int strict,
+ char **b)
+{
+ read_sign(s, b);
+ if (!read_rat_nos(s, strict, b))
+ return 0;
+ return 1;
}
-#define id_match rb_intern("match")
-#define f_match(x,y) rb_funcall((x), id_match, 1, (y))
+inline static int
+isimagunit(int c)
+{
+ return (c == 'i' || c == 'I' ||
+ c == 'j' || c == 'J');
+}
-#define id_gsub_bang rb_intern("gsub!")
-#define f_gsub_bang(x,y,z) rb_funcall((x), id_gsub_bang, 2, (y), (z))
+VALUE rb_cstr_to_rat(const char *, int);
static VALUE
-string_to_c_internal(VALUE self)
+str2num(char *s)
{
- VALUE s;
+ if (strchr(s, '/'))
+ return rb_cstr_to_rat(s, 0);
+ if (strpbrk(s, ".eE"))
+ return DBL2NUM(rb_cstr_to_dbl(s, 0));
+ return rb_cstr_to_inum(s, 10, 0);
+}
- s = self;
+static int
+read_comp(const char **s, int strict,
+ VALUE *ret, char **b)
+{
+ char *bb;
+ int sign;
+ VALUE num, num2;
- if (RSTRING_LEN(s) == 0)
- return rb_assoc_new(Qnil, self);
+ bb = *b;
- {
- VALUE m, sr, si, re, r, i;
- int po;
-
- m = f_match(comp_pat0, s);
- if (!NIL_P(m)) {
- sr = rb_reg_nth_match(1, m);
- si = rb_reg_nth_match(2, m);
- re = rb_reg_match_post(m);
- po = 1;
- }
- if (NIL_P(m)) {
- m = f_match(comp_pat1, s);
- if (!NIL_P(m)) {
- sr = Qnil;
- si = rb_reg_nth_match(1, m);
- if (NIL_P(si))
- si = rb_usascii_str_new2("");
- {
- VALUE t;
-
- t = rb_reg_nth_match(2, m);
- if (NIL_P(t))
- t = rb_usascii_str_new2("1");
- rb_str_concat(si, t);
- }
- re = rb_reg_match_post(m);
- po = 0;
- }
+ sign = read_sign(s, b);
+
+ if (isimagunit(**s)) {
+ (*s)++;
+ num = INT2FIX((sign == '-') ? -1 : + 1);
+ *ret = rb_complex_new2(ZERO, num);
+ return 1; /* e.g. "i" */
+ }
+
+ if (!read_rat_nos(s, strict, b)) {
+ **b = '\0';
+ num = str2num(bb);
+ *ret = rb_complex_new2(num, ZERO);
+ return 0; /* e.g. "-" */
+ }
+ **b = '\0';
+ num = str2num(bb);
+
+ if (isimagunit(**s)) {
+ (*s)++;
+ *ret = rb_complex_new2(ZERO, num);
+ return 1; /* e.g. "3i" */
+ }
+
+ if (**s == '@') {
+ int st;
+
+ (*s)++;
+ bb = *b;
+ st = read_rat(s, strict, b);
+ **b = '\0';
+ if (strlen(bb) < 1 ||
+ !isdecimal(*(bb + strlen(bb) - 1))) {
+ *ret = rb_complex_new2(num, ZERO);
+ return 0; /* e.g. "1@-" */
}
- if (NIL_P(m)) {
- m = f_match(comp_pat2, s);
- if (NIL_P(m))
- return rb_assoc_new(Qnil, self);
- sr = rb_reg_nth_match(1, m);
- if (NIL_P(rb_reg_nth_match(2, m)))
- si = Qnil;
- else {
- VALUE t;
-
- si = rb_reg_nth_match(3, m);
- t = rb_reg_nth_match(4, m);
- if (NIL_P(t))
- t = rb_usascii_str_new2("1");
- rb_str_concat(si, t);
+ num2 = str2num(bb);
+ *ret = rb_complex_polar(num, num2);
+ if (!st)
+ return 0; /* e.g. "1@2." */
+ else
+ return 1; /* e.g. "1@2" */
+ }
+
+ if (issign(**s)) {
+ bb = *b;
+ sign = read_sign(s, b);
+ if (isimagunit(**s))
+ num2 = INT2FIX((sign == '-') ? -1 : + 1);
+ else {
+ if (!read_rat_nos(s, strict, b)) {
+ *ret = rb_complex_new2(num, ZERO);
+ return 0; /* e.g. "1+xi" */
}
- re = rb_reg_match_post(m);
- po = 0;
+ **b = '\0';
+ num2 = str2num(bb);
}
- r = INT2FIX(0);
- i = INT2FIX(0);
- if (!NIL_P(sr)) {
- if (strchr(RSTRING_PTR(sr), '/'))
- r = f_to_r(sr);
- else if (strpbrk(RSTRING_PTR(sr), ".eE"))
- r = f_to_f(sr);
- else
- r = f_to_i(sr);
+ if (!isimagunit(**s)) {
+ *ret = rb_complex_new2(num, ZERO);
+ return 0; /* e.g. "1+3x" */
}
- if (!NIL_P(si)) {
- if (strchr(RSTRING_PTR(si), '/'))
- i = f_to_r(si);
- else if (strpbrk(RSTRING_PTR(si), ".eE"))
- i = f_to_f(si);
- else
- i = f_to_i(si);
- }
- if (po)
- return rb_assoc_new(rb_complex_polar(r, i), re);
- else
- return rb_assoc_new(rb_complex_new2(r, i), re);
+ (*s)++;
+ *ret = rb_complex_new2(num, num2);
+ return 1; /* e.g. "1+2i" */
}
+ /* !(@, - or +) */
+ {
+ *ret = rb_complex_new2(num, ZERO);
+ return 1; /* e.g. "3" */
+ }
+}
+
+inline static void
+skip_ws(const char **s)
+{
+ while (isspace((unsigned char)**s))
+ (*s)++;
+}
+
+static int
+parse_comp(const char *s, int strict,
+ VALUE *num)
+{
+ char *buf, *b;
+
+ buf = ALLOCA_N(char, strlen(s) + 1);
+ b = buf;
+
+ skip_ws(&s);
+ if (!read_comp(&s, strict, num, &b))
+ return 0;
+ skip_ws(&s);
+
+ if (strict)
+ if (*s != '\0')
+ return 0;
+ return 1;
}
static VALUE
string_to_c_strict(VALUE self)
{
- VALUE a = string_to_c_internal(self);
- if (NIL_P(RARRAY_PTR(a)[0]) || RSTRING_LEN(RARRAY_PTR(a)[1]) > 0) {
- VALUE s = f_inspect(self);
+ char *s;
+ VALUE num;
+
+ rb_must_asciicompat(self);
+
+ s = RSTRING_PTR(self);
+
+ if (!s || memchr(s, '\0', RSTRING_LEN(self)))
+ rb_raise(rb_eArgError, "string contains null byte");
+
+ if (s && s[RSTRING_LEN(self)]) {
+ rb_str_modify(self);
+ s = RSTRING_PTR(self);
+ s[RSTRING_LEN(self)] = '\0';
+ }
+
+ if (!s)
+ s = (char *)"";
+
+ if (!parse_comp(s, 1, &num)) {
+ VALUE ins = f_inspect(self);
rb_raise(rb_eArgError, "invalid value for convert(): %s",
- StringValuePtr(s));
+ StringValuePtr(ins));
}
- return RARRAY_PTR(a)[0];
-}
-#define id_gsub rb_intern("gsub")
-#define f_gsub(x,y,z) rb_funcall((x), id_gsub, 2, (y), (z))
+ return num;
+}
/*
* call-seq:
@@ -1566,8 +1829,6 @@ string_to_c_strict(VALUE self)
* sequences can be separated by an underscore. Returns zero for null
* or garbage string.
*
- * For example:
- *
* '9'.to_c #=> (9+0i)
* '2.5'.to_c #=> (2.5+0i)
* '2.5/1'.to_c #=> ((5/2)+0i)
@@ -1579,23 +1840,31 @@ string_to_c_strict(VALUE self)
* '-0.0-0.0i'.to_c #=> (-0.0-0.0i)
* '1/2+3/4i'.to_c #=> ((1/2)+(3/4)*i)
* 'ruby'.to_c #=> (0+0i)
+ *
+ * See Kernel.Complex.
*/
static VALUE
string_to_c(VALUE self)
{
- VALUE s, a, backref;
+ char *s;
+ VALUE num;
- backref = rb_backref_get();
- rb_match_busy(backref);
+ rb_must_asciicompat(self);
- s = f_gsub(self, underscores_pat, an_underscore);
- a = string_to_c_internal(s);
+ s = RSTRING_PTR(self);
- rb_backref_set(backref);
+ if (s && s[RSTRING_LEN(self)]) {
+ rb_str_modify(self);
+ s = RSTRING_PTR(self);
+ s[RSTRING_LEN(self)] = '\0';
+ }
- if (!NIL_P(RARRAY_PTR(a)[0]))
- return RARRAY_PTR(a)[0];
- return rb_complex_new1(INT2FIX(0));
+ if (!s)
+ s = (char *)"";
+
+ (void)parse_comp(s, 0, &num);
+
+ return num;
}
static VALUE
@@ -1611,30 +1880,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);
@@ -1643,8 +1899,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);
@@ -1653,8 +1908,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;
}
@@ -1742,6 +1996,7 @@ numeric_arg(VALUE self)
/*
* call-seq:
* num.rect -> array
+ * num.rectangular -> array
*
* Returns an array; [num, 0].
*/
@@ -1829,6 +2084,7 @@ float_arg(VALUE self)
void
Init_Complex(void)
{
+ VALUE compat;
#undef rb_intern
#define rb_intern(str) rb_intern_const(str)
@@ -1858,6 +2114,8 @@ Init_Complex(void)
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 */
rb_cComplex = rb_define_class("Complex", rb_cNumeric);
@@ -1946,8 +2204,10 @@ Init_Complex(void)
rb_define_method(rb_cComplex, "to_s", nucomp_to_s, 0);
rb_define_method(rb_cComplex, "inspect", nucomp_inspect, 0);
- rb_define_method(rb_cComplex, "marshal_dump", nucomp_marshal_dump, 0);
- rb_define_method(rb_cComplex, "marshal_load", nucomp_marshal_load, 1);
+ rb_define_private_method(rb_cComplex, "marshal_dump", nucomp_marshal_dump, 0);
+ compat = rb_define_class_under(rb_cComplex, "compatible", rb_cObject);
+ rb_define_private_method(compat, "marshal_load", nucomp_marshal_load, 1);
+ rb_marshal_define_compat(rb_cComplex, compat, nucomp_dumper, nucomp_loader);
/* --- */
@@ -1955,11 +2215,10 @@ Init_Complex(void)
rb_define_method(rb_cComplex, "to_f", nucomp_to_f, 0);
rb_define_method(rb_cComplex, "to_r", nucomp_to_r, 0);
rb_define_method(rb_cComplex, "rationalize", nucomp_rationalize, -1);
+ rb_define_method(rb_cComplex, "to_c", nucomp_to_c, 0);
rb_define_method(rb_cNilClass, "to_c", nilclass_to_c, 0);
rb_define_method(rb_cNumeric, "to_c", numeric_to_c, 0);
- make_patterns();
-
rb_define_method(rb_cString, "to_c", string_to_c, 0);
rb_define_private_method(CLASS_OF(rb_cComplex), "convert", nucomp_s_convert, -1);
@@ -1983,6 +2242,9 @@ Init_Complex(void)
rb_define_method(rb_cFloat, "angle", float_arg, 0);
rb_define_method(rb_cFloat, "phase", float_arg, 0);
+ /*
+ * The imaginary unit.
+ */
rb_define_const(rb_cComplex, "I",
f_complex_new_bang2(rb_cComplex, ZERO, ONE));
}
diff --git a/configure.in b/configure.in
index 7453c9165b..5d86e14bd0 100644
--- a/configure.in
+++ b/configure.in
@@ -1,15 +1,37 @@
dnl Process this file with autoconf to produce a configure script.
-dnl {
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))])
-dnl environment section {
+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=''
+ for arg do
+ AS_CASE("$arg",
+ [--*], [],
+ [-*r*], [break],
+ [conftest.*], [if test -d "$arg"; then rm_recursive=-r; break; fi],
+ [])
+ done
+ command rm $rm_recursive "[$]@"
+}
+])])])
+
+{ # environment section
AC_ARG_WITH(baseruby,
AS_HELP_STRING([--with-baseruby=RUBY], [use RUBY as baseruby; RUBY is the pathname of ruby]),
@@ -19,10 +41,20 @@ AC_ARG_WITH(baseruby,
[
BASERUBY="ruby"
])
-test "`RUBYOPT=- $BASERUBY -e 'p 42' 2>/dev/null`" = 42 ||
+if test "`RUBYOPT=- $BASERUBY -e 'p 42' 2>/dev/null`" = 42; then
+ if test "`RUBYOPT=- $BASERUBY --disable=gems -e 'p 42' 2>/dev/null`" = 42; then
+ BASERUBY="$BASERUBY --disable=gems"
+ fi
+else
BASERUBY="echo executable host ruby is required. use --with-baseruby option.; false"
+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*], [
@@ -33,7 +65,10 @@ AC_CACHE_CHECK(for mingw32 environment, rb_cv_mingw32,
#endif
], rb_cv_mingw32=yes,rb_cv_mingw32=no)
rm -f conftest*])
-test "$rb_cv_mingw32" = yes && target_os="mingw32"
+if test "$rb_cv_mingw32" = yes; then
+ target_os="mingw32"
+ : ${ac_tool_prefix:="`expr "$CC" : ['\(.*-\)g\?cc[^/]*$']`"}
+fi
])
AS_CASE(["$target_os"], [mingw*msvc], [
target_os="`echo ${target_os} | sed 's/msvc$//'`"
@@ -43,12 +78,93 @@ target_cpu=x64
])
])
+AC_DEFUN([RUBY_NACL],
+[
+ AS_CASE(["${host_os}"],
+[nacl], [
+ ac_cv_exeext=.nexe
+ host_vendor=chromium
+ ac_cv_host=chromium
+ AC_MSG_CHECKING([wheather \$NACL_SDK_ROOT is set])
+ if test x"${NACL_SDK_ROOT}" = x; then
+ AC_MSG_RESULT([no])
+ AC_MSG_ERROR([You need to set \$NACL_SDK_ROOT environment variable to build for NativeClient])
+ fi
+ AC_MSG_RESULT([yes])
+
+ nacl_cv_build_variant=glibc
+ AC_ARG_WITH(newlib,
+ AS_HELP_STRING([--with-newlib], [uses newlib version of NativeClient SDK]),
+ [AS_CASE([$withval],
+ [no], [nacl_cv_build_variant=glibc],
+ [yes], [nacl_cv_build_variant=newlib])])
+
+ AS_CASE(["$build_cpu"],
+ [x86_64|i?86], [nacl_cv_cpu_nick=x86], [nacl_cv_cpu_nick=$build_cpu])
+ AS_CASE(["$build_os"],
+ [linux*], [nacl_cv_os_nick=linux],
+ [darwin*], [nacl_cv_os_nick=mac],
+ [cygwin*|mingw*], [nacl_cv_os_nick=win],
+ [nacl_cv_os_nick=$build_os])
+
+ host="$host_cpu-chromium-$host_os-"
+ ac_tool_prefix="$host_cpu-nacl-"
+
+ AC_MSG_CHECKING([NativeClient toolchain])
+ if test -d \
+ "${NACL_SDK_ROOT}/toolchain/${nacl_cv_os_nick}_${nacl_cv_cpu_nick}_${nacl_cv_build_variant}"; then
+ NACL_TOOLCHAIN="${nacl_cv_os_nick}_${nacl_cv_cpu_nick}_${nacl_cv_build_variant}"
+ else
+ AS_CASE(
+ ["${nacl_cv_build_variant}"],
+ [glibc], [if test \
+ -d "${NACL_SDK_ROOT}/toolchain/${nacl_cv_os_nick}_${nacl_cv_cpu_nick}_newlib" \
+ -a -d "${NACL_SDK_ROOT}/toolchain/${nacl_cv_os_nick}_${nacl_cv_cpu_nick}"; then
+ NACL_TOOLCHAIN="${nacl_cv_os_nick}_${nacl_cv_cpu_nick}"
+ fi],
+ [newlib], [ NACL_TOOLCHAIN="${nacl_cv_os_nick}_${nacl_cv_cpu_nick}" ])
+ fi
+ if test ! -e "${NACL_SDK_ROOT}/toolchain/${NACL_TOOLCHAIN}/${ac_tool_prefix}gcc"; then
+ if test "${build_cpu}" = i686 -a -e "${NACL_SDK_ROOT}/toolchain/${NACL_TOOLCHAIN}/nacl-gcc"; then
+ ac_tool_prefix=nacl-
+ fi
+ if test "${build_cpu}" = x86_64 -a -e "${NACL_SDK_ROOT}/toolchain/${NACL_TOOLCHAIN}/nacl-gcc"; then
+ ac_tool_prefix=nacl64-
+ fi
+ fi
+ if test -z "${NACL_TOOLCHAIN}"; then
+ AC_MSG_ERROR([Unrecognized --host and --build combination or NaCl SDK is not installed])
+ fi
+ AC_MSG_RESULT(${NACL_TOOLCHAIN})
+
+ AC_MSG_CHECKING([path to SDK])
+ if ! echo -- "${PATH}" | grep -F "${NACL_SDK_ROOT}/toolchain/${NACL_TOOLCHAIN}/bin" > /dev/null; then
+ PATH="${PATH}:${NACL_SDK_ROOT}/toolchain/${NACL_TOOLCHAIN}/bin"
+ fi
+
+ AC_SUBST(NACL_TOOLCHAIN)
+ AC_SUBST(NACL_SDK_ROOT)
+ AC_SUBST(NACL_SDK_VARIANT, nacl_cv_build_variant)
+])])
+
+AC_DEFUN([RUBY_NACL_CHECK_PEPPER_TYPES],
+[AS_CASE(["${host_os}"],
+[nacl], [
+ AC_CHECK_TYPES([struct PPB_Core, struct PPB_Messaging, struct PPB_Var,
+ struct PPB_URLLoader, struct PPB_URLRequestInfo,
+ struct PPB_URLResponseInfo, struct PPB_FileRef,
+ struct PPP_Instance])
+])
+])
+
AC_DEFUN([RUBY_CPPOUTFILE],
[AC_CACHE_CHECK(whether ${CPP} accepts -o, rb_cv_cppoutfile,
-[cppflags=$CPPFLAGS
-CPPFLAGS='-o conftest.i'
-AC_TRY_CPP([], rb_cv_cppoutfile=yes, rb_cv_cppoutfile=no)
-CPPFLAGS=$cppflags
+[save_CPPFLAGS="$CPPFLAGS"
+CPPFLAGS='-o conftest-1.i'
+rb_cv_cppoutfile=no
+AC_TRY_CPP([test-for-cppout],
+ [grep test-for-cppout conftest-1.i > /dev/null && rb_cv_cppoutfile=yes])
+CPPFLAGS="$save_CPPFLAGS"
rm -f conftest*])
if test "$rb_cv_cppoutfile" = yes; then
CPPOUTFILE='-o conftest.i'
@@ -84,12 +200,10 @@ 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`
-if test "$MAJOR" = "1"; then
- AC_DEFINE(CANONICALIZATION_FOR_MATHN)
-fi
-
+AC_DEFINE(CANONICALIZATION_FOR_MATHN)
dnl checks for alternative programs
AC_CANONICAL_BUILD
+RUBY_RM_RECURSIVE
AC_ARG_WITH(gcc,
AS_HELP_STRING([--without-gcc], [never use gcc]),
[
@@ -104,7 +218,7 @@ then
(it is also a good idea to do 'make clean' before compiling))
fi
AS_CASE(["$build_os"],
- [darwin11.*], [
+ [darwin1*.*], [
AS_CASE(["x$CC"],
[xgcc-4.2|x/usr/bin/gcc-4.2], [: ${CXX=g++-4.2}],
[xgcc|x/usr/bin/gcc], [: ${CXX=g++}],
@@ -112,6 +226,7 @@ AS_CASE(["$build_os"],
[xclang|x/usr/bin/clang], [: ${CXX=clang++}])
])
test -z "$CC" || ac_cv_prog_CC="$CC"
+test -z "$CXX" || ac_cv_prog_CXX="$CXX"
if test "$program_prefix" = NONE; then
program_prefix=
@@ -120,11 +235,36 @@ 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_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.
+AS_CASE($target_os,
+ [darwin*], [os_version_style=major+0],
+ [os_version_style=full])
+AC_ARG_WITH(os-version-style,
+ AS_HELP_STRING([--with-os-version-style=TYPE],
+ [OS version number for target and target_os [[full]]]
+ [(full|teeny|minor+0|minor|major+0|major|none)]),
+ [os_version_style=$withval])
+os_version_style_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)
AS_CASE([" [$]{$1-} "],
@@ -197,7 +337,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
@@ -279,17 +418,41 @@ if test -z "${CXXFLAGS+set}"; then
cxxflags="$cxxflags "'${optflags} ${debugflags} ${warnflags}'
fi
+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)
fi
+
AC_PROG_CC
AC_PROG_CXX
+RUBY_MINGW32
AC_PROG_GCC_TRADITIONAL
AC_SUBST(GCC)
+AS_CASE(["$target_os"],
+[solaris*], [AC_PATH_TOOL([LD], [ld], [/usr/ccs/bin/ld], [/usr/ccs/bin:$PATH])],
+[AC_CHECK_TOOL([LD], [ld], [ld])])
+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
@@ -302,12 +465,44 @@ RUBY_CPPOUTFILE
AC_SUBST(OUTFLAG)
AC_SUBST(COUTFLAG)
-RUBY_MINGW32
+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")
fi
+AS_CASE(["$target_cpu-$target_os"], [[i[3-6]86*]], [
+ AC_CACHE_CHECK([for __sync_val_compare_and_swap], [rb_cv_gcc_compiler_cas], [
+ AC_TRY_LINK([unsigned long atomic_var;],
+ [
+ __sync_val_compare_and_swap(&atomic_var, 0, 1);
+ ],
+ [rb_cv_gcc_compiler_cas=yes],
+ [rb_cv_gcc_compiler_cas=no])])
+ if test "$rb_cv_gcc_compiler_cas" = no; then
+ unset rb_cv_gcc_compiler_cas
+ save_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS -march=i486"
+ AC_CACHE_CHECK([for __sync_val_compare_and_swap with -march=i486], [rb_cv_gcc_compiler_cas], [
+ AC_TRY_LINK([unsigned long atomic_var;],
+ [
+ __sync_val_compare_and_swap(&atomic_var, 0, 1);
+ ],
+ [rb_cv_gcc_compiler_cas=yes
+ ARCH_FLAG="-march=i486"],
+ [rb_cv_gcc_compiler_cas=no])])
+ CFLAGS="$save_CFLAGS"
+ fi])
+
AC_CHECK_TOOL(RANLIB, ranlib, :)
AC_CHECK_TOOL(AR, ar)
if test -z "$AR"; then
@@ -344,6 +539,9 @@ AS_CASE(["$target_os"],
sed -n '/^[[ ]]*dll name: \(msvc.*\)\.dll$/{s//\1/p;q;}'`],
[rb_cv_msvcrt=msvcrt])
test "$rb_cv_msvcrt" = "" && rb_cv_msvcrt=msvcrt])
+ RT_VER=`echo "$rb_cv_msvcrt" | tr -cd [0-9]`
+ test "$RT_VER" = "" && RT_VER=60
+ AC_DEFINE_UNQUOTED(RUBY_MSVCRT_VERSION, $RT_VER)
])
: ${enable_shared=yes}
],
@@ -366,8 +564,51 @@ fi
MAKEDIRS="$MKDIR_P"
AC_SUBST(MAKEDIRS)
+AC_DEFUN([RUBY_DTRACE_AVAILABLE],
+[AC_CACHE_CHECK(whether dtrace USDT is available, rb_cv_dtrace_available,
+[
+ echo "provider conftest{ probe fire(); };" > conftest_provider.d
+ if $DTRACE -h -o conftest_provider.h -s conftest_provider.d >/dev/null 2>/dev/null; then
+ # DTrace is available on the system
+ rb_cv_dtrace_available=yes
+ else
+ # DTrace is not available while dtrace command exists
+ # for example FreeBSD 8 or FreeBSD 9 without DTrace build option
+ rb_cv_dtrace_available=no
+ fi
+ rm -f conftest.[co] conftest_provider.[dho]
+])
+])
+
+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.c <<_CONF &&
+ @%:@include "conftest_provider.h"
+ int main(void){ CONFTEST_FIRE(); return 0; }
+_CONF
+ $CC $CFLAGS -c -o conftest.o conftest.c &&
+ $DTRACE -G -s conftest_provider.d conftest.o 2>/dev/null
+ }; then
+ rb_cv_prog_dtrace_g=yes
+ else
+ rb_cv_prog_dtrace_g=no
+ fi
+ rm -f conftest.[co] conftest_provider.[dho]
+])
+])
+
+AC_CHECK_PROG([DTRACE], [${ac_tool_prefix}dtrace], [${ac_tool_prefix}dtrace])
+if test "$cross_compiling:$ac_cv_prog_DTRACE" = no: -a -n "$ac_tool_prefix"; then
+ AC_CHECK_PROG([DTRACE], [dtrace], [dtrace])
+fi
+
AC_CHECK_PROGS(DOT, dot)
AC_CHECK_PROGS(DOXYGEN, doxygen)
+AS_CASE(["${host_os}"], [nacl], [AC_PATH_PROG(PYTHON, python)])
AC_CHECK_PROG(PKG_CONFIG, pkg-config, [pkg-config], [], [],
[`"$as_dir/$ac_word$ac_exec_ext" --print-errors --version > /dev/null 2>&1 || echo "$as_dir/$ac_word$ac_exec_ext"`])
@@ -397,7 +638,7 @@ $as_ln_s ../build . > /dev/null 2>&1 && cd build &&
for chdir in 'cd -P' 'PWD= cd'; do
/bin/sh -c "$chdir ../src && echo '$chdir' > cdcmd" 2> /dev/null && break
done)
-if test -e conf$$.dir/src/cdcmd; then
+if test -f conf$$.dir/src/cdcmd; then
read CHDIR < conf$$.dir/src/cdcmd 2> /dev/null
else
CHDIR=cd
@@ -406,8 +647,8 @@ rm -fr conf$$.dir
AC_MSG_RESULT([$CHDIR])
AC_SUBST(CHDIR)
-dnl }
-dnl compiler section {
+}
+{ # compiler section
AC_DEFUN([RUBY_WERROR_FLAG], [dnl
save_CFLAGS="$CFLAGS"
@@ -427,8 +668,27 @@ else
unset ac_c_werror_flag
fi])
+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])
+ AC_TRY_LINK([], [],
+ [AC_MSG_RESULT(yes)],
+ [
+ AC_MSG_RESULT(no)
+ AC_MSG_ERROR([something wrong with LDFLAGS="$LDFLAGS"])
+ ]
+ )
+])
+
AC_DEFUN(RUBY_TRY_CFLAGS, [
- AC_MSG_CHECKING([whether ]$1[ is accepted])
+ AC_MSG_CHECKING([whether ]$1[ is accepted as CFLAGS])
RUBY_WERROR_FLAG([
CFLAGS="[$]CFLAGS $1"
AC_TRY_COMPILE([$4], [$5],
@@ -442,7 +702,7 @@ AC_DEFUN(RUBY_TRY_CFLAGS, [
AC_DEFUN(RUBY_TRY_LDFLAGS, [
save_LDFLAGS="$LDFLAGS"
LDFLAGS="[$]LDFLAGS $1"
- AC_MSG_CHECKING([whether $1 is accepted])
+ AC_MSG_CHECKING([whether $1 is accepted as LDFLAGS])
RUBY_WERROR_FLAG([
AC_TRY_LINK([$4], [$5],
[$2
@@ -465,23 +725,34 @@ AC_ARG_ENABLE(werror,
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 \
-Werror=pointer-arith \
-Werror=write-strings \
-Werror=declaration-after-statement \
-Werror=shorten-64-to-32 \
-Werror=implicit-function-declaration \
+ -Werror=division-by-zero \
+ $extra_warning \
; do
if test "$particular_werror_flags" != yes; then
wflag=`echo x$wflag | sed 's/^x-Werror=/-W/;s/^x//'`
fi
ok=no
- RUBY_TRY_CFLAGS($wflag, [warnflags="${warnflags+$warnflags }$wflag" ok=yes])
+ RUBY_TRY_CFLAGS($wflag, [
+ RUBY_APPEND_OPTIONS(warnflags, $wflag)
+ ok=yes
+ ])
AS_CASE([$ok:$wflag], [no:-Werror=*], [
wflag=`echo x$wflag | sed 's/^x-Werror=/-W/'`
RUBY_TRY_CFLAGS($wflag, [
- warnflags="${warnflags+$warnflags }$wflag"
+ RUBY_APPEND_OPTIONS(warnflags, $wflag)
particular_werror_flags=no
])
])
@@ -494,42 +765,349 @@ if test "$GCC:${warnflags+set}:no" = yes::no; then
warnflags=
fi
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)
+ RUBY_APPEND_OPTION(LDFLAGS, -fstack-protector)
+ fi
+
+ AS_CASE(["$target_os"],[mingw*], [
+ # 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.
+ ],
+ [cygwin*|darwin*|netbsd*], [
+ # need lgamma_r(), finite()
+ ],
+ [haiku], [
+ # Haiku R1/alpha3 uses gcc-4.4.4 which can not handle anonymous union
+ # with ANSI standard flags. Anonumous union is required to compile
+ # socket extension where <net/if.h> uses anonymous union.
+ ],
+ [
+ # ANSI (no XCFLAGS because this is C only)
+ RUBY_TRY_CFLAGS(-ansi -std=iso9899:199409, [
+ RUBY_APPEND_OPTION(warnflags, -ansi -std=iso9899:199409)
+ RUBY_APPEND_OPTION(strict_warnflags, -ansi -std=iso9899:199409)
+ ])
+ ])
+
+ # suppress annoying -Wstrict-overflow warnings
+ 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}
if test "$GCC" = ""; then
- AS_CASE(["$target_os"],[aix*],[warnflags="-qinfo=por"])
+ 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
- test "$visibility_option" = no || OBJCOPY=:
+ test "$visibility_option" = no -o "$host_os" = nacl || OBJCOPY=:
fi
if test "$GCC" = yes; then
+ # optflags
+
AS_CASE(["$target_os"], [mingw*], [
RUBY_TRY_CFLAGS(-fno-omit-frame-pointer, [optflags="${optflags+$optflags }-fno-omit-frame-pointer"])
])
+
+ # disable fast-math
+ for oflag in -fno-fast-math; do
+ RUBY_TRY_CFLAGS($oflag, [RUBY_APPEND_OPTION(optflags, $oflag)])
+ done
fi
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\""
+}
+{ # header and library section
+
+AC_ARG_WITH(winnt-ver,
+ AS_HELP_STRING([--with-winnt-ver=0xXXXX], [target Windows NT version (default to 0x0501)]),
+ [with_winnt_ver="$withval"], [with_winnt_ver="0x0501"])
+AS_CASE(["$target_os"],
+[mingw*], [
+ RUBY_APPEND_OPTION(CPPFLAGS, -D_WIN32_WINNT=$with_winnt_ver)
+])
+
+AS_CASE(["$target_os"],
+[freebsd*], [
+ AC_CACHE_CHECK([whether pthread should be enabled by default],
+ rb_cv_enable_pthread_default,
+ [AC_TRY_CPP([
+#include <osreldate.h>
+#if __FreeBSD_version < 502102
+#error pthread should be disabled on this platform
+#endif
+ ],
+ rb_cv_enable_pthread_default=yes,
+ rb_cv_enable_pthread_default=no)])
+ enable_pthread=$rb_cv_enable_pthread_default
+ ],
+[mingw*], [
+ enable_pthread=no
+ ],
+[
+ enable_pthread=yes
+ ])
+
+AC_ARG_ENABLE(pthread,
+ AS_HELP_STRING([--enable-pthread], [obsolete, and ignored]))
+
+dnl Checks for libraries.
+AS_CASE(["$target_os"],[*bsd*|dragonfly*],[],[ac_cv_func_daemon=no])
+
+POSTLINK=:
+AC_SUBST(POSTLINK)
+AS_CASE(["$target_os"],
+[nextstep*], [ ],
+[openstep*], [ ],
+[rhapsody*], [ ],
+[darwin*], [ RUBY_PREPEND_OPTION(LIBS, -lobjc)
+ RUBY_APPEND_OPTIONS(CPPFLAGS, -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT)
+ AC_MSG_CHECKING(whether Mac OS X 10.5 or later)
+ AC_TRY_CPP([#include <AvailabilityMacros.h>
+ #if MAC_OS_X_VERSION_MAX_ALLOWED <= 1040
+ #error pre OS X 10.4
+ [!<===== pre OS X 10.4 =====>]
+ #endif
+ ],
+ [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
+ else
+ AC_DEFINE(BROKEN_SETREUID, 1)
+ AC_DEFINE(BROKEN_SETREGID, 1)
+ fi
+ 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_CACHE_CHECK(for broken crypt with 8bit chars, rb_cv_broken_crypt,
+ [AC_TRY_RUN([
+#include <stdio.h>
+#include <unistd.h>
+#include <string.h>
+
+int
+main()
+{
+ int i;
+ for (i = 0; i < 128*128; i++) {
+ char salt[2], buf[256], *s;
+ salt[0] = 0x80 | (i & 0x7f);
+ salt[1] = 0x80 | (i >> 7);
+ strcpy(buf, crypt("", salt));
+ if (strcmp(buf, s = crypt("", salt))) {
+#if 0
+ printf("%.2x%.2x: %s -> %s\n", (unsigned char)salt[0], (unsigned char)salt[1],
+ buf+2, s+2);
+#endif
+ return 1;
+ }
+ }
+ return 0;
+}
+],
+ rb_cv_broken_crypt=no,
+ rb_cv_broken_crypt=yes,
+ rb_cv_broken_crypt=yes)])
+ if test "$rb_cv_broken_crypt" = yes; then
+ AC_DEFINE(BROKEN_CRYPT, 1)
+ fi
+ AC_CHECK_PROGS(codesign, codesign)
+ if test -n "$codesign"; then
+ POSTLINK="test -z '\$(RUBY_CODESIGN)' || $codesign -s '\$(RUBY_CODESIGN)' -f \$@"
+ LINK_SO="$LINK_SO
+\$(POSTLINK)"
+ fi
+ AC_CHECK_HEADERS(crt_externs.h, [], [], [
+ #include <crt_externs.h>
+ ])
+ ],
+[hpux*], [ LIBS="-lm $LIBS"
+ ac_cv_c_inline=no],
+[beos*|haiku*], [
+ ac_cv_func_link=no
+ ac_cv_func_sched_yield=no
+ ac_cv_func_pthread_attr_setinheritsched=no
+ AS_CASE(["$target_os"],
+ [beos*], [ ac_cv_header_net_socket_h=yes],
+ [haiku*], [ ac_cv_func_shutdown=no])
+ LIBS="$LIBS" # m lib is include in root under BeOS/Haiku
+ ],
+[cygwin*], [ ac_cv_header_langinfo_h=yes
+ AC_CHECK_FUNCS(cygwin_conv_path)
+ AC_LIBOBJ([langinfo])
+ ],
+[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
+ ac_cv_header_sys_ioctl_h=no
+ ac_cv_header_sys_param_h=no
+ ac_cv_header_sys_resource_h=no
+ ac_cv_header_sys_select_h=no
+ ac_cv_header_sys_time_h=no
+ ac_cv_header_sys_times_h=no
+ ac_cv_header_sys_socket_h=no
+ ac_cv_func_times=yes
+ ac_cv_func_waitpid=yes
+ ac_cv_func_fsync=yes
+ ac_cv_func_seekdir=yes
+ ac_cv_func_telldir=yes
+ ac_cv_func_isinf=yes
+ ac_cv_func_isnan=yes
+ ac_cv_func_finite=yes
+ ac_cv_func_link=yes
+ ac_cv_lib_crypt_crypt=no
+ ac_cv_func_getpgrp_void=no
+ ac_cv_func_memcmp_working=yes
+ ac_cv_lib_dl_dlopen=no
+ rb_cv_binary_elf=no
+ rb_cv_negative_time_t=no
+ ac_cv_func_fcntl=yes
+ ac_cv_func_flock=yes
+ 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
+ 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_LIBOBJ([langinfo])
+ ],
+[os2-emx*], [ LIBS="-lm $LIBS"
+ ac_cv_lib_dir_opendir=no],
+[bsdi*], [ LIBS="-lm $LIBS"
+ AC_DEFINE(BROKEN_SETREUID, 1)
+ AC_DEFINE(BROKEN_SETREGID, 1)
+ ac_cv_sizeof_rlim_t=8],
+[freebsd*], [ LIBS="-lm $LIBS"
+ ac_cv_func_getpeername=no
+ ac_cv_func_getsockname=no
+ ac_cv_func_shutdown=no
+ ac_cv_func_close=no
+ ],
+[dragonfly*], [ LIBS="-lm $LIBS"
+ # isinf() and isnan() are macros on DragonFly.
+ ac_cv_func_isinf=yes
+ ac_cv_func_isnan=yes
+ ],
+[nacl], [
+ LIBS="-lm $LIBS"
+ if test "${nacl_cv_build_variant}" = "newlib"; then
+ RUBY_APPEND_OPTION(CPPFLAGS, -DNACL_NEWLIB)
+ RUBY_APPEND_OPTION(LIBS, '-lnosys')
+ else
+ RUBY_APPEND_OPTION(XCFLAGS, -fPIC)
+ fi
+ ac_cv_func_shutdown=no
+ ac_cv_func_fcntl=no
+ ],
+[ LIBS="-lm $LIBS"])
+
+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 \
+ float.h \
+ ieeefp.h \
+ ucontext.h \
+ intrinsics.h \
+ langinfo.h \
+ locale.h \
+ sys/sendfile.h \
+ time.h \
+ net/socket.h \
+ sys/socket.h \
+ process.h \
+ sys/prctl.h \
+ atomic.h \
+ malloc.h \
+ malloc_np.h \
+ setjmpex.h
+)
+
+AC_ARG_WITH([gmp],
+ [AS_HELP_STRING([--without-gmp],
+ [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])])
+
dnl check for large file stuff
mv confdefs.h confdefs1.h
: > confdefs.h
@@ -597,11 +1175,8 @@ static ac__type_sizeof_ *rbcv_ptr;
done
done
}])
- m4_ifval([$2][$3], [case "${AS_TR_SH(ac_cv_sizeof_$1)}" in
- #(
- [SIZEOF_*]);;
- #(
- *)])
+ m4_ifval([$2][$3],
+ [test "${AS_TR_SH(ac_cv_sizeof_$1)@%:@SIZEOF_}" = "${AS_TR_SH(ac_cv_sizeof_$1)}" && ]){
test "$universal_binary" = yes && cross_compiling=yes
AC_COMPUTE_INT([t], AS_TR_CPP(SIZEOF_$1), [AC_INCLUDES_DEFAULT([$4])]
[${cond+$cond
@@ -615,7 +1190,7 @@ ${cond+@%:@endif}
if test ${t-0} != 0; then
AS_TR_SH(ac_cv_sizeof_$1)="${AS_TR_SH(ac_cv_sizeof_$1)+${AS_TR_SH(ac_cv_sizeof_$1)-} }${t}"
fi
- m4_ifval([$2][$3], [;; esac])
+ }
: ${AS_TR_SH(ac_cv_sizeof_$1)=0}
])
{
@@ -646,11 +1221,13 @@ 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_DEFUN([RUBY_CHECK_PRINTF_PREFIX], [
AC_CACHE_CHECK([for printf prefix for $1], [rb_cv_pri_prefix_]AS_TR_SH($1),[
@@ -682,6 +1259,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],
@@ -694,10 +1276,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"
@@ -722,7 +1301,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,
@@ -734,7 +1315,17 @@ RUBY_REPLACE_TYPE(gid_t, int, GIDT)
RUBY_REPLACE_TYPE(time_t, [], TIMET, [@%:@include <time.h>])
RUBY_REPLACE_TYPE(dev_t, [int long "long long"], DEVT)
RUBY_REPLACE_TYPE(mode_t, ["unsigned int" long], MODET, [@%:@include <sys/stat.h>])
-RUBY_REPLACE_TYPE(rlim_t, [int long "long long"], RLIM, [@%:@include <sys/resource.h>])
+RUBY_REPLACE_TYPE(rlim_t, [int long "long long"], RLIM, [
+@%:@ifdef HAVE_SYS_TYPES_H
+@%:@include <sys/types.h>
+@%:@endif
+@%:@ifdef HAVE_SYS_TYPES_H
+@%:@include <sys/time.h>
+@%:@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);],
@@ -745,12 +1336,12 @@ if test "$rb_cv_have_prototypes" = yes; then
fi
AC_CACHE_CHECK(token paste string, rb_cv_tokenpaste,
- [AC_TRY_COMPILE([#define paste(a,b) a##b],
+ [AC_TRY_COMPILE([@%:@define paste(a,b) a@%:@@%:@b],
[int xy = 1; return paste(x,y);],
rb_cv_tokenpaste=ansi,
rb_cv_tokenpaste=knr)])
if test "$rb_cv_tokenpaste" = ansi; then
- AC_DEFINE(TOKEN_PASTE(x,y),[x##y])
+ AC_DEFINE(TOKEN_PASTE(x,y),[x@%:@@%:@y])
else
AC_DEFINE(TOKEN_PASTE(x,y),[x/**/y])
fi
@@ -820,12 +1411,12 @@ if test "$rb_cv_va_args_macro" = yes; then
fi
AC_DEFUN([RUBY_DEFINE_IF], [dnl
- m4_ifval([$1],[test "$1" && cat <<EOH >> confdefs.h
+ m4_ifval([$1], [AS_LITERAL_IF([$1], [], [test "X$1" = X || ])cat <<EOH >> confdefs.h
@%:@if $1
EOH
])dnl
-AC_DEFINE_UNQUOTED($2, $3)
- m4_ifval([$1],[test "$1" && cat <<EOH >> confdefs.h
+AC_DEFINE_UNQUOTED($2, $3)dnl
+ m4_ifval([$1], [AS_LITERAL_IF([$1], [], [test "X$1" = X || ])cat <<EOH >> confdefs.h
@%:@endif /* $1 */
EOH
])dnl
@@ -841,7 +1432,7 @@ m4_ifval([$3], dnl
[AS_VAR_PUSHDEF([rbcv],[$3])], dnl
[AS_VAR_PUSHDEF([rbcv],[rb_cv_func_][$1])]dnl
)dnl
-m4_ifval([$4], [rbcv_cond=[$4]; test "$rbcv_cond" || unset rbcv_cond])
+m4_ifval([$4], [rbcv_cond=["$4"]; test "$rbcv_cond" || unset rbcv_cond])
AC_CACHE_CHECK(for [$1] function attribute, rbcv,
[rbcv=x
RUBY_WERROR_FLAG([
@@ -858,10 +1449,11 @@ ${rbcv_cond+[@%:@endif]})
done
])])
if test "$rbcv" != x; then
- RUBY_DEFINE_IF([${rbcv_cond}], attrib[(x)], $rbcv)
+ RUBY_DEFINE_IF(m4_ifval([$4],[${rbcv_cond}]), attrib[(x)], $rbcv)
fi
-AS_VAR_POPDEF([attrib])
-AS_VAR_POPDEF([rbcv])
+m4_ifval([$4], [unset rbcv_cond])dnl
+AS_VAR_POPDEF([attrib])dnl
+AS_VAR_POPDEF([rbcv])dnl
])
RUBY_FUNC_ATTRIBUTE(noreturn, NORETURN)
@@ -882,6 +1474,7 @@ 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)],
@@ -900,6 +1493,18 @@ if test "$GCC" = yes; then
if test "$rb_cv_gcc_atomic_builtins" = yes; then
AC_DEFINE(HAVE_GCC_ATOMIC_BUILTINS)
fi
+
+ AC_CACHE_CHECK(for __builtin_unreachable, rb_cv_func___builtin_unreachable,
+ [RUBY_WERROR_FLAG(
+ [AC_TRY_LINK([@%:@include <stdlib.h>],
+ [exit(0); __builtin_unreachable();],
+ [rb_cv_func___builtin_unreachable=yes],
+ [rb_cv_func___builtin_unreachable=no])
+ ])
+ ])
+ if test "$rb_cv_func___builtin_unreachable" = yes; then
+ AC_DEFINE_UNQUOTED(UNREACHABLE, [__builtin_unreachable()])
+ fi
fi
AC_CACHE_CHECK(for exported function attribute, rb_cv_func_exported, [
@@ -917,240 +1522,27 @@ fi
RUBY_APPEND_OPTION(XCFLAGS, -DRUBY_EXPORT)
-dnl }
-dnl header and library section {
+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_ARG_ENABLE(win95,
- AS_HELP_STRING([--enable-win95], [enable Windows 95 series support]),
- [AS_CASE(["$enableval"],[yes|no],[enable_win95=$enableval],[unset enable_win95])])
-
-AS_CASE(["$target_os"],
-[freebsd*], [
- AC_CACHE_CHECK([whether pthread should be enabled by default],
- rb_cv_enable_pthread_default,
- [AC_TRY_CPP([
-#include <osreldate.h>
-#if __FreeBSD_version < 502102
-#error pthread should be disabled on this platform
-#endif
- ],
- rb_cv_enable_pthread_default=yes,
- rb_cv_enable_pthread_default=no)])
- enable_pthread=$rb_cv_enable_pthread_default
- ],
-[mingw*], [
- enable_pthread=no
- ],
-[
- enable_pthread=yes
- ])
+@%:@include <errno.h>])
-AC_ARG_ENABLE(pthread,
- AS_HELP_STRING([--enable-pthread], [obsolete, and ignored]))
-
-dnl Checks for libraries.
-AS_CASE(["$target_os"],[*bsd*|dragonfly*],[],[ac_cv_func_daemon=no])
-
-POSTLINK=:
-AC_SUBST(POSTLINK)
-AS_CASE(["$target_os"],
-[solaris*], [
- AC_DEFINE(SIZEOF_STRUCT_DIRENT_TOO_SMALL, 1)
- LIBS="-lm $LIBS"
- ],
-# GNU Hurd
-[gnu*], [
- AC_DEFINE(SIZEOF_STRUCT_DIRENT_TOO_SMALL, 1)
- LIBS="-lm $LIBS"
- ],
-[nextstep*], [ ],
-[openstep*], [ ],
-[rhapsody*], [ ],
-[darwin*], [ RUBY_PREPEND_OPTION(LIBS, -lobjc)
- RUBY_APPEND_OPTIONS(CPPFLAGS, -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE)
- AC_MSG_CHECKING(whether Mac OS X 10.5 or later)
- AC_TRY_CPP([#include <AvailabilityMacros.h>
- #if MAC_OS_X_VERSION_MAX_ALLOWED <= 1040
- #error pre OS X 10.4
- [!<===== pre OS X 10.4 =====>]
- #endif
- ],
- [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
- else
- AC_DEFINE(BROKEN_SETREUID, 1)
- AC_DEFINE(BROKEN_SETREGID, 1)
- fi
- 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_CACHE_CHECK(for broken crypt with 8bit chars, rb_cv_broken_crypt,
- [AC_TRY_RUN([
-#include <stdio.h>
-#include <unistd.h>
-#include <string.h>
-
-int
-main()
-{
- int i;
- for (i = 0; i < 128*128; i++) {
- char salt[2], buf[256], *s;
- salt[0] = 0x80 | (i & 0x7f);
- salt[1] = 0x80 | (i >> 7);
- strcpy(buf, crypt("", salt));
- if (strcmp(buf, s = crypt("", salt))) {
-#if 0
- printf("%.2x%.2x: %s -> %s\n", (unsigned char)salt[0], (unsigned char)salt[1],
- buf+2, s+2);
-#endif
- return 1;
- }
- }
- return 0;
-}
-],
- rb_cv_broken_crypt=no,
- rb_cv_broken_crypt=yes,
- rb_cv_broken_crypt=yes)])
- if test "$rb_cv_broken_crypt" = yes; then
- AC_DEFINE(BROKEN_CRYPT, 1)
- fi
- ],
-[hpux*], [ LIBS="-lm $LIBS"
- ac_cv_c_inline=no],
-[human*], [ ac_cv_func_getpgrp_void=yes
- ac_cv_func_setitimer=no
- AC_CHECK_LIB(signal, _harderr)
- AC_CHECK_LIB(hmem, hmemset)
- AC_CHECK_FUNCS(select)
- AC_CACHE_CHECK(whether PD libc _dtos18 fail to convert big number,
- rb_cv_missing__dtos18,
- [AC_TRY_RUN([
-#include <stdio.h>
-int
-main()
-{
- char buf[256];
- sprintf(buf, "%g", 1e+300);
- return (strcmp (buf, "1e+300") ? 0 : 1);
-}
-],
- rb_cv_missing__dtos18=yes, rb_cv_missing__dtos18=no, rb_cv_missing__dtos18=no)])
- if test "$rb_cv_missing__dtos18" = yes; then
- AC_DEFINE(MISSING__DTOS18)
- fi
- AC_CACHE_CHECK(whether PD libc fconvert fail to round,
- rb_cv_missing_fconvert,
- [AC_TRY_RUN([
-#include <stdio.h>
-#include <math.h>
-int
-main()
-{
- char buf[256];
- sprintf(buf, "%f", log(exp(1.0)));
- return (strcmp (buf, "1.000000") ? 0 : 1);
-}
-],
- rb_cv_missing_fconvert=yes, rb_cv_missing_fconvert=no, rb_cv_missing_fconvert=no)])
- if test "$rb_cv_missing_fconvert" = yes; then
- AC_DEFINE(MISSING_FCONVERT)
- fi
- ],
-[beos*|haiku*], [
- ac_cv_func_link=no
- ac_cv_func_sched_yield=no
- ac_cv_func_pthread_attr_setinheritsched=no
- AS_CASE(["$target_os"],
- [beos*], [ ac_cv_header_net_socket_h=yes],
- [haiku*], [ ac_cv_func_shutdown=no])
- LIBS="$LIBS" # m lib is include in root under BeOS/Haiku
- ],
-[cygwin*], [ ac_cv_header_langinfo_h=yes
- AC_CHECK_FUNCS(cygwin_conv_path)
- AC_LIBOBJ([langinfo])
- ],
-[mingw*], [ LIBS="-lshell32 -lws2_32 -limagehlp -lshlwapi $LIBS"
- ac_cv_header_a_out_h=no
- ac_cv_header_pwd_h=no
- ac_cv_header_utime_h=no
- ac_cv_header_sys_ioctl_h=no
- ac_cv_header_sys_param_h=no
- ac_cv_header_sys_resource_h=no
- ac_cv_header_sys_select_h=no
- ac_cv_header_sys_time_h=no
- ac_cv_header_sys_times_h=no
- ac_cv_header_sys_socket_h=no
- ac_cv_func_times=yes
- ac_cv_func_waitpid=yes
- ac_cv_func_fsync=yes
- ac_cv_func_seekdir=yes
- ac_cv_func_telldir=yes
- ac_cv_func_isinf=yes
- 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
- ac_cv_lib_dl_dlopen=no
- rb_cv_binary_elf=no
- rb_cv_negative_time_t=no
- ac_cv_func_fcntl=yes
- ac_cv_func_flock=yes
- rb_cv_large_fd_select=yes
- ac_cv_type_struct_timeval=yes
- AC_LIBOBJ([langinfo])
- : ${enable_win95=maybe}
- ],
-[os2-emx*], [ LIBS="-lm $LIBS"
- ac_cv_lib_dir_opendir=no],
-[msdosdjgpp*], [
- LIBS="-lm $LIBS"
- ac_cv_func_getpgrp_void=yes
- ac_cv_func_setitimer=no
- ac_cv_sizeof_rlim_t=4
- ac_cv_func_fork=no
- ac_cv_func_setrlimit=no
- ac_cv_header_sys_socket_h=no
- ],
-[bsdi*], [ LIBS="-lm $LIBS"
- AC_DEFINE(BROKEN_SETREUID, 1)
- AC_DEFINE(BROKEN_SETREGID, 1)
- ac_cv_sizeof_rlim_t=8],
-[freebsd*], [ LIBS="-lm $LIBS"
- ac_cv_func_getpeername=no
- ac_cv_func_getsockname=no
- ac_cv_func_shutdown=no
- ac_cv_func_close=no
- ],
-[dragonfly*], [ LIBS="-lm $LIBS"
- ],
-[bow], [ ac_cv_func_setitimer=no
- ],
-[superux*], [ ac_cv_func_setitimer=no
- ],
-[ LIBS="-lm $LIBS"])
-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
-if test "${enable_win95}" = maybe; then
- AC_HAVE_LIBRARY(unicows, [enable_win95=yes], [enable_win95=no])
-fi
-if test "${enable_win95}" = yes; then
- AC_DEFINE(WIN95)
- LIBS="-lunicows $LIBS"
-fi
+AC_CHECK_DECLS([getenv])
AS_CASE(["$target_cpu"],
[alpha*|sh4|sh4el|sh4eb], [AS_CASE(["$target_os"::"$GCC"],
@@ -1168,19 +1560,10 @@ else
ac_cv_header_sys_socket_h=${ac_cv_header_sys_socket_h=yes}
fi
-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 atomic.h)
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)
@@ -1209,8 +1592,29 @@ 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
+@%:@ifdef HAVE_SYS_TIME_H
+@%:@include <sys/time.h>
@%:@endif])
AC_CHECK_TYPES([struct timezone], [], [], [@%:@ifdef HAVE_TIME_H
@@ -1246,6 +1650,7 @@ typedef $1 t; int s = sizeof(t) == 42;])],
["$ac_cv_sizeof_long"], [ rb_cv_type_$1="m4_if([$3], [], [], [$3 ])long"],
["$ac_cv_sizeof_long_long"], [ rb_cv_type_$1="m4_if([$3], [], [], [$3 ])long long"],
["$ac_cv_sizeof___int64"], [ rb_cv_type_$1="m4_if([$3], [], [], [$3 ])__int64"],
+ ["$ac_cv_sizeof___int128"], [ rb_cv_type_$1="m4_if([$3], [], [], [$3 ])__int128"],
[ rb_cv_type_$1=no])])])
if test "${rb_cv_type_$1}" != no; then
AC_DEFINE([HAVE_]AS_TR_CPP($1), 1)
@@ -1273,18 +1678,47 @@ RUBY_DEFINT(intptr_t, void*)
RUBY_DEFINT(uintptr_t, void*, unsigned)
RUBY_DEFINT(ssize_t, size_t, [], [@%:@include <sys/types.h>]) dnl may differ from int, so not use AC_TYPE_SSIZE_T.
+RUBY_NACL_CHECK_PEPPER_TYPES
+
AC_CACHE_CHECK(for stack end address, rb_cv_stack_end_address,
[rb_cv_stack_end_address=no
-for addr in __libc_stack_end _SEND; do
AC_TRY_LINK(
- [extern void *$addr;],
- [if (!$addr) return 1;],
- [rb_cv_stack_end_address="$addr"; break])
-done])
+ [extern void *__libc_stack_end;],
+ [if (!__libc_stack_end) return 1;],
+ [rb_cv_stack_end_address="__libc_stack_end"])
+])
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*|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
+ AC_TRY_RUN([
+#include <math.h>
+#include <unistd.h>
+
+int
+main() {
+ if ((int)log2((double)sysconf(_SC_PAGESIZE)) != $page_log) return 1;
+ return 0;
+}
+ ],
+ rb_cv_page_size_log="$page_log"; break)
+ done])
+ if test $rb_cv_page_size_log != no; then
+ AC_DEFINE_UNQUOTED(HEAP_ALIGN_LOG, $rb_cv_page_size_log)
+ else
+ AC_DEFINE_UNQUOTED(HEAP_ALIGN_LOG, 12)
+ fi
+])
+
dnl Checks for library functions.
AC_TYPE_GETGROUPS
AC_TYPE_SIGNAL
@@ -1359,6 +1793,7 @@ AS_CASE(["$target_os"],
[aix* | k*bsd*-gnu | kopensolaris*-gnu | linux* | darwin*], [AC_DEFINE(SPT_TYPE,SPT_REUSEARGV)],
[hpux*], [AC_DEFINE(SPT_TYPE,SPT_PSTAT) ],
[])
+AC_CHECK_HEADERS(sys/pstat.h)
AC_CACHE_CHECK(for signbit, rb_cv_have_signbit,
@@ -1372,19 +1807,131 @@ 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 getgrnam_r\
- dlopen sigprocmask sigaction sigsetjmp _setjmp _longjmp\
- setsid telldir seekdir fchmod cosh sinh tanh log2 round\
- setuid setgid daemon select_large_fdset setenv unsetenv\
- mktime timegm gmtime_r clock_gettime gettimeofday poll ppoll\
- pread sendfile shutdown sigaltstack dl_iterate_phdr)
+
+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(chroot)
+AC_CHECK_FUNCS(chsize)
+AC_CHECK_FUNCS(clock_gettime)
+AC_CHECK_FUNCS(cosh)
+AC_CHECK_FUNCS(daemon)
+AC_CHECK_FUNCS(dl_iterate_phdr)
+AC_CHECK_FUNCS(dlopen)
+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(fork)
+AC_CHECK_FUNCS(fsync)
+AC_CHECK_FUNCS(ftruncate)
+AC_CHECK_FUNCS(ftruncate64) # used for Win32 platform
+AC_CHECK_FUNCS(getcwd)
+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(getrlimit)
+AC_CHECK_FUNCS(getsid)
+AC_CHECK_FUNCS(gettimeofday) # for making ac_cv_func_gettimeofday
+AC_CHECK_FUNCS(gmtime_r)
+AC_CHECK_FUNCS(initgroups)
+AC_CHECK_FUNCS(ioctl)
+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(mblen)
+AC_CHECK_FUNCS(memalign)
+AC_CHECK_FUNCS(memrchr)
+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(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)
+
+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_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)])
+
+# 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([
@@ -1396,6 +1943,14 @@ 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_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);}],
@@ -1404,41 +1959,52 @@ AC_CACHE_CHECK(for __builtin_setjmp, ac_cv_func___builtin_setjmp,
[ac_cv_func___builtin_setjmp=no])
])
+# we don't use _setjmp if _longjmp doesn't exist.
test x$ac_cv_func__longjmp = xno && ac_cv_func__setjmp=no
AC_MSG_CHECKING(for setjmp type)
+setjmp_suffix=
AC_ARG_WITH(setjmp-type,
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])
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
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_MSG_RESULT(${setjmp_prefix}setjmp${setjmp_suffix})
+AC_DEFINE_UNQUOTED([RUBY_SETJMP(env)], [${setjmp_prefix}setjmp${setjmp_suffix}(env${setjmp_sigmask+,0})])
AC_DEFINE_UNQUOTED([RUBY_LONGJMP(env,val)], [${setjmp_prefix}longjmp(env,val)])
AC_DEFINE_UNQUOTED(RUBY_JMP_BUF, ${setjmp_sigmask+${setjmp_prefix}}jmp_buf)
+# End of setjmp check.
AC_ARG_ENABLE(setreuid,
AS_HELP_STRING([--enable-setreuid], [use setreuid()/setregid() according to need even if obsolete]),
@@ -1449,7 +2015,7 @@ if test "$use_setreuid" = yes; then
fi
AC_STRUCT_TIMEZONE
AC_CACHE_CHECK(for struct tm.tm_gmtoff, rb_cv_member_struct_tm_tm_gmtoff,
- [AC_TRY_COMPILE([#include <time.h>],
+ [AC_TRY_COMPILE([@%:@include <time.h>],
[struct tm t; t.tm_gmtoff = 3600;],
[rb_cv_member_struct_tm_tm_gmtoff=yes],
[rb_cv_member_struct_tm_tm_gmtoff=no])])
@@ -1584,7 +2150,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
@@ -1622,9 +2188,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
@@ -1653,6 +2226,7 @@ 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)"
@@ -1672,6 +2246,7 @@ 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
@@ -1709,6 +2284,10 @@ if test "$rb_cv_frptr" != "not found"; then
fi
fi
+if test x"$ac_cv_func_gettimeofday" != xyes; then
+ AC_MSG_ERROR(gettimeofday() must exist)
+fi
+
RUBY_CHECK_SIZEOF([struct stat.st_ino], [long "long long"], [], [@%:@include <sys/stat.h>])
if test "$ac_cv_func_sysconf" = yes; then
@@ -1803,7 +2382,7 @@ 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")
@@ -1812,7 +2391,13 @@ if test x"$enable_pthread" = xyes; then
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_condattr_setclock pthread_sigmask)
+ pthread_cond_init pthread_condattr_setclock pthread_condattr_init \
+ pthread_sigmask)
+ if test "${host_os}" = "nacl"; then
+ ac_cv_func_pthread_attr_init=no
+ else
+ AC_CHECK_FUNCS(pthread_attr_init)
+ fi
fi
if test x"$ac_cv_header_ucontext_h" = xyes; then
if test x"$rb_with_pthread" = xyes; then
@@ -1885,25 +2470,9 @@ main(int argc, char *argv[])
test x$rb_cv_fork_with_pthread = xyes || AC_DEFINE(CANNOT_FORK_WITH_PTHREAD)
fi
-AS_CASE(["$target_os"],
-[freebsd*], [
- AC_CHECK_HEADERS([/usr/local/include/execinfo.h])
- if test "x$ac_cv_header__usr_local_include_execinfo_h" = xyes; then :
- RUBY_APPEND_OPTION(CPPFLAGS, -I/usr/local/include)
- LDFLAGS="${LDFLAGS:+$LDFLAGS }-L/usr/local/lib"
- DLDFLAGS="${DLDFLAGS:+$DLDFLAGS }-L/usr/local/lib"
- AC_CHECK_LIB([execinfo], [backtrace])
- fi])
-AC_CHECK_FUNCS(backtrace)
-
-AC_ARG_WITH(valgrind,
- AS_HELP_STRING([--without-valgrind],[disable valgrind memcheck support]),
- [], with_valgrind=yes)
-AS_IF([test x$with_valgrind != xno],
- [AC_CHECK_HEADERS(valgrind/memcheck.h)])
-dnl }
-dnl runtime section {
+}
+{ # runtime section
dnl wheather use dln_a_out or not
AC_ARG_WITH(dln-a-out,
@@ -1929,11 +2498,14 @@ if test "$rb_cv_binary_elf" = yes; then
if test "$with_dln_a_out" = yes; then
AC_MSG_ERROR(dln_a_out does not work with ELF)
fi
- AC_LIBOBJ([addr2line])
+ AC_CHECK_HEADERS([elf.h elf_abi.h])
+ if test $ac_cv_header_elf_h = yes -o $ac_cv_header_elf_abi_h = yes; then
+ AC_LIBOBJ([addr2line])
+ fi
fi
AS_CASE(["$target_os"],
-[linux* | gnu* | k*bsd*-gnu | bsdi* | kopensolaris*-gnu], [
+[linux* | gnu* | k*bsd*-gnu | bsdi* | kopensolaris*-gnu | nacl], [
if test "$rb_cv_binary_elf" = no; then
with_dln_a_out=yes
else
@@ -1960,7 +2532,7 @@ if test "$with_dln_a_out" != yes; then
AC_MSG_CHECKING(whether OS depend dynamic link works)
if test "$GCC" = yes; then
AS_CASE(["$target_os"],
- [nextstep*|openstep*|rhapsody*|darwin*], [
+ [darwin*], [
# The -fno-common is needed if we wish to embed the Ruby interpreter
# into a plugin module of some project (as opposed to embedding it
# within the project's application). The -I/usr/local/include is
@@ -1969,7 +2541,7 @@ if test "$with_dln_a_out" != yes; then
# mkmf.rb's have_header() to fail if the desired resource happens to be
# installed in the /usr/local tree.
RUBY_APPEND_OPTION(CCDLFLAGS, -fno-common)],
- [human*|bsdi*|beos*|haiku*|cygwin*|mingw*|aix*|interix*], [ ],
+ [bsdi*|beos*|haiku*|cygwin*|mingw*|aix*|interix*], [ ],
[
RUBY_APPEND_OPTION(CCDLFLAGS, -fPIC)])
else
@@ -1992,7 +2564,7 @@ if test "$with_dln_a_out" != yes; then
AS_CASE(["$target_os"],
[hpux*], [ DLDFLAGS="$DLDFLAGS -E"
- : ${LDSHARED='ld -b'}
+ : ${LDSHARED='$(LD) -b'}
XLDFLAGS="$XLDFLAGS -Wl,-E"
: ${LIBPATHENV=SHLIB_PATH}
if test "$rb_cv_prog_gnu_ld" = no; then
@@ -2011,17 +2583,17 @@ if test "$with_dln_a_out" != yes; then
: ${LIBPATHENV=LD_LIBRARY_PATH_64}
fi
rb_cv_dlopen=yes],
- [sunos*], [ : ${LDSHARED='ld -assert nodefinitions'}
+ [sunos*], [ : ${LDSHARED='$(LD) -assert nodefinitions'}
rb_cv_dlopen=yes],
- [irix*], [ : ${LDSHARED='ld -shared'}
+ [irix*], [ : ${LDSHARED='$(LD) -shared'}
rb_cv_dlopen=yes],
- [sysv4*], [ : ${LDSHARED='ld -G'}
+ [sysv4*], [ : ${LDSHARED='$(LD) -G'}
rb_cv_dlopen=yes],
[nto-qnx*], [ : ${LDSHARED='$(CC) -shared'}
rb_cv_dlopen=yes],
- [esix*|uxpds*], [ : ${LDSHARED="ld -G"}
+ [esix*|uxpds*], [ : ${LDSHARED='$(LD) -G'}
rb_cv_dlopen=yes],
- [osf*], [ : ${LDSHARED="ld -shared -expect_unresolved \"*\""}
+ [osf*], [ : ${LDSHARED='$(LD) -shared -expect_unresolved "*"'}
rb_cv_dlopen=yes],
[bsdi3*], [ AS_CASE(["$CC"],
[*shlicc*], [ : ${LDSHARED='$(CC) -r'}
@@ -2042,31 +2614,22 @@ if test "$with_dln_a_out" != yes; then
LDFLAGS="$LDFLAGS -rdynamic"
DLDFLAGS="$DLDFLAGS "'-Wl,-soname,$(.TARGET)'
else
- test "$GCC" = yes && test "$rb_cv_prog_gnu_ld" = yes || LDSHARED="ld -Bshareable"
+ test "$GCC" = yes && test "$rb_cv_prog_gnu_ld" = yes || LDSHARED='$(LD) -Bshareable'
fi
rb_cv_dlopen=yes],
- [openbsd*], [ : ${LDSHARED='$(CC) -shared ${CCDLFLAGS}'}
+ [openbsd*|mirbsd*], [ : ${LDSHARED='$(CC) -shared ${CCDLFLAGS}'}
if test "$rb_cv_binary_elf" = yes; then
LDFLAGS="$LDFLAGS -Wl,-E"
fi
rb_cv_dlopen=yes],
- [nextstep*], [ : ${LDSHARED='$(CC) -r -nostdlib'}
- LDFLAGS="$LDFLAGS -u libsys_s"
- rb_cv_dlopen=yes],
- [openstep*], [ : ${LDSHARED='$(CC) -dynamic -bundle -undefined suppress'}
- : ${LDFLAGS=""}
- rb_cv_dlopen=yes],
- [rhapsody*], [ : ${LDSHARED='$(CC) -dynamic -bundle -undefined suppress'}
- : ${LDFLAGS=""}
- rb_cv_dlopen=yes],
[darwin*], [ : ${LDSHARED='$(CC) -dynamic -bundle'}
- : ${DLDFLAGS="${linker_flag}-undefined${linker_flag:+,}dynamic_lookup ${linker_flag}-multiply_defined${linker_flag:+,}suppress ${linker_flag}-flat_namespace"}
+ : ${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
# some reason, but /usr/local/lib is not.
hdr=`find /usr/local/include -name \*.h -type f | sed 's:^/usr/local/include/::;q'`
- if test -n "$hdr" && $CC -E -include "$hdr" -xc /dev/null 2>/dev/null | fgrep -q "$hdr"; then
+ if test -n "$hdr" && $CC -E -include "$hdr" -xc - </dev/null 2>/dev/null | fgrep -q "$hdr"; then
$CC -print-search-dirs | grep -q '^libraries:.*:/usr/local/lib/*' ||
echo " $LDFLAGS " | grep -q ' -L */usr/local/lib/* ' ||
LDFLAGS="${LDFLAGS:+$LDFLAGS }-L/usr/local/lib"
@@ -2080,42 +2643,36 @@ if test "$with_dln_a_out" != yes; then
: ${ARCHFILE="ruby.imp"}
TRY_LINK='$(CC) $(LDFLAGS) -oconftest $(INCFLAGS) -I$(hdrdir) $(CPPFLAGS)'
TRY_LINK="$TRY_LINK"' $(CFLAGS) $(src) $(LIBPATH) $(LOCAL_LIBS) $(LIBS)'
- : ${LIBPATHENV=SHLIB_PATH}
+ : ${LIBPATHENV=LIBPATH}
RPATHFLAG=" ${linker_flag}-blibpath:%1\$-s:${prefix}/lib:${LIBPATH:-/usr/lib:/lib}"
rb_cv_dlopen=yes],
- [human*], [ : ${DLDFLAGS=''}
- : ${LDSHARED=''}
- : ${LDFLAGS=''}
- : ${LINK_SO='ar cru $@ $(OBJS)'}
- rb_cv_dlopen=yes],
[beos*], [ AS_CASE(["$target_cpu"],
[powerpc*], [
- : ${LDSHARED="ld -xms"}
+ : ${LDSHARED='$(LD) -xms'}
EXTDLDFLAGS='-export $(TARGET_ENTRY)'
DLDFLAGS="$DLDFLAGS -lbe -lroot glue-noinit.a init_term_dyn.o start_dyn.o"
LDFLAGS="$LDFLAGS -L/boot/home/config/lib -lbe -lroot"
],
[i586*], [
- : ${LDSHARED="ld -shared"}
- DLDFLAGS="$DLDFLAGS -L/boot/develop/lib/x86 -L/boot/home/config/lib \$(topdir)/_APP_ -lbe -lroot"
- LDFLAGS="$LDFLAGS -L/boot/develop/lib/x86 -L/boot/home/config/lib -lbe -lroot"
+ : ${LDSHARED='$(LD) -shared'}
+ DLDFLAGS="$DLDFLAGS -L/boot/develop/lib/x86 -L/boot/home/config/lib \$(topdir)/_APP_ -lroot"
+ LDFLAGS="$LDFLAGS -L/boot/develop/lib/x86 -L/boot/home/config/lib -lroot"
])
: ${LIBPATHENV=LIBRARY_PATH}
rb_cv_dlopen=yes],
[haiku*], [ AS_CASE(["$target_cpu"],
[powerpc*], [
- : ${LDSHARED="ld -xms"}
+ : ${LDSHARED='$(LD) -xms'}
EXTDLDFLAGS='-export $(TARGET_ENTRY)'
- DLDFLAGS="$DLDFLAGS -lbe -lroot glue-noinit.a init_term_dyn.o start_dyn.o"
+ DLDFLAGS="$DLDFLAGS -lroot glue-noinit.a init_term_dyn.o start_dyn.o"
],
[i586*], [
- : ${LDSHARED="ld -shared"}
- DLDFLAGS="$DLDFLAGS -L/boot/develop/lib/x86 -lbe -lroot"
+ : ${LDSHARED='$(CC) -shared'}
])
: ${LIBPATHENV=LIBRARY_PATH}
rb_cv_dlopen=yes ],
[nto-qnx*], [ DLDFLAGS="$DLDFLAGS -L/lib -L/usr/lib -L/usr/local/lib"
- : ${LDSHARED='ld -Bshareable -x'}
+ : ${LDSHARED='$(LD) -Bshareable -x'}
LDFLAGS="$LDFLAGS -L/lib -L/usr/lib -L/usr/local/lib"
rb_cv_dlopen=yes],
[cygwin*|mingw*], [
@@ -2124,12 +2681,13 @@ if test "$with_dln_a_out" != yes; then
DLDFLAGS="${DLDFLAGS} -Wl,--enable-auto-image-base,--enable-auto-import"
: ${LIBPATHENV=""}
rb_cv_dlopen=yes],
- [hiuxmpp], [ : ${LDSHARED='ld -r'}],
+ [hiuxmpp], [ : ${LDSHARED='$(LD) -r'}],
[atheos*], [ : ${LDSHARED='$(CC) -shared'}
rb_cv_dlopen=yes],
[os2-emx*], [ LDFLAGS="$LDFLAGS -Zomf"
],
- [ : ${LDSHARED='ld'}])
+ [nacl], [ LDSHARED='$(CC) -shared' ],
+ [ : ${LDSHARED='$(LD)'}])
AC_MSG_RESULT($rb_cv_dlopen)
fi
if test "${LDSHAREDXX}" = ""; then
@@ -2154,6 +2712,102 @@ 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"
+ test x"${LDFLAGS}" = x || LDFLAGS="$LDFLAGS "
+ LDFLAGS="$LDFLAGS$val"
+ test x"${DLDFLAGS}" = x || DLDFLAGS="$DLDFLAGS "
+ DLDFLAGS="$DLDFLAGS$val"
+ ])
+
+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])
+ 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 {
+ abort();
+ }
+ _exit(0);
+}
+int
+main()
+{
+ stack_t ss;
+ ss.ss_sp = malloc(SIGSTKSZ);
+ if (ss.ss_sp == NULL) {
+ fprintf(stderr, "cannot allocate memory for sigaltstack\n");
+ abort();
+ }
+ ss.ss_size = SIGSTKSZ;
+ ss.ss_flags = 0;
+ if (sigaltstack(&ss, NULL) == -1) {
+ fprintf(stderr, "sigaltstack failed\n");
+ abort();
+ }
+ 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);
+ int *a = NULL;
+ a[0] = 1;
+ return 0;
+}
+],
+ 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)
+AS_IF([test x$with_valgrind != xno],
+ [AC_CHECK_HEADERS(valgrind/memcheck.h)])
+
dln_a_out_works=no
if test "$ac_cv_header_a_out_h" = yes; then
if test "$with_dln_a_out" = yes || test "$rb_cv_dlopen" = unknown; then
@@ -2185,7 +2839,7 @@ else
AS_CASE(["$target_os"],
[hpux*], [
DLEXT=sl],
- [nextstep*|openstep*|rhapsody*|darwin*], [
+ [darwin*], [
RUBY_APPEND_OPTION(XLDFLAGS, [-Wl,-u,_objc_msgSend])
DLEXT=bundle],
[os2-emx*], [
@@ -2201,10 +2855,13 @@ 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
- else
- unset load_relative
fi
fi
+if test x"$LOAD_RELATIVE" = x1; then
+ load_relative=yes
+else
+ unset load_relative
+fi
len=2 # .rb
n=`expr "$DLEXT" : '.*'`; test "$n" -gt "$len" && len=$n
@@ -2223,7 +2880,7 @@ fi
AS_CASE(["$target_os"],
[linux* | gnu* | k*bsd*-gnu | kopensolaris*-gnu], [
STRIP="$STRIP -S -x"],
- [nextstep* | openstep* | rhapsody* | darwin*], [
+ [darwin*], [
STRIP="$STRIP -A -n"])
AC_ARG_WITH(ext,
@@ -2237,30 +2894,49 @@ 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
+ ENCOBJS='enc/encinit.$(OBJEXT) enc/libenc.$(LIBEXT) enc/libtrans.$(LIBEXT)'
+ EXTOBJS='ext/extinit.$(OBJEXT)'
+ AC_DEFINE_UNQUOTED(EXTSTATIC, 1)
+fi
+AC_SUBST(ENCOBJS)
+AC_SUBST(EXTOBJS)
-AS_CASE(["$target_os"],
- [human*], [
- setup=Setup.x68
- ],
- dnl OS/2 environment w/ Autoconf 2.1x for EMX
- [os2-emx], [
- setup=Setup.emx
- ],
- [*djgpp*], [
- setup=Setup.dj
- ],
- [
- 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)
-if test "$prefix" = NONE; then
- prefix=$ac_default_prefix
+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; do
+ eval val='"$'$var'"'
+ AS_CASE(["$val"], ["${RUBY_EXEC_PREFIX}"*], [val='${exec_prefix}'"`expr \"$val\" : \"$pat\"`"])
+ eval $var='"$val"'
+done
+BTESTRUBY='$(MINIRUBY)'
if test x"$cross_compiling" = xyes; then
- test x"$MINIRUBY" = x && MINIRUBY="${RUBY-$BASERUBY} -I`pwd` "-r'$(arch)-fake'
+ test x"$MINIRUBY" = x && MINIRUBY="${RUBY-$BASERUBY} -I`$CHDIR .; pwd` "-r'$(arch)-fake'
XRUBY_LIBDIR=`${RUBY-$BASERUBY} -rrbconfig -e ['puts RbConfig::CONFIG["libdir"]']`
XRUBY_RUBYLIBDIR=`${RUBY-$BASERUBY} -rrbconfig -e ['puts RbConfig::CONFIG["rubylibdir"]']`
XRUBY_RUBYHDRDIR=`${RUBY-$BASERUBY} -rrbconfig -e ['puts RbConfig::CONFIG["rubyhdrdir"]']`
@@ -2268,20 +2944,41 @@ if test x"$cross_compiling" = xyes; then
AC_SUBST(XRUBY_RUBYLIBDIR)
AC_SUBST(XRUBY_RUBYHDRDIR)
PREP='$(arch)-fake.rb'
- RUNRUBY='$(MINIRUBY) -I`cd $(srcdir)/lib; pwd`'
+ RUNRUBY_COMMAND='$(MINIRUBY) -I`cd $(srcdir)/lib; pwd`'
+ RUNRUBY='$(RUNRUBY_COMMAND)'
XRUBY='$(MINIRUBY)'
TEST_RUNNABLE=no
+ CROSS_COMPILING=yes
+
+ if test "$host_os" = "nacl"; then
+ if test "$build_cpu" = "$host_cpu" || test "${nacl_cv_cpu_nick}" = "x86" -a "$host_cpu" = "i686"; then
+ nacl_cv_sel_ldr='`$(MINIRUBY) $(srcdir)/nacl/nacl-config.rb sel_ldr`'
+ nacl_cv_irt_core='`$(MINIRUBY) $(srcdir)/nacl/nacl-config.rb irt_core`'
+ nacl_cv_runnable_ld='`$(MINIRUBY) $(srcdir)/nacl/nacl-config.rb runnable_ld`'
+ nacl_cv_host_lib='`$(MINIRUBY) $(srcdir)/nacl/nacl-config.rb host_lib`'
+ TEST_RUNNABLE=yes
+ BTESTRUBY="${nacl_cv_sel_ldr} -a -B ${nacl_cv_irt_core} -w 1:3 -w 2:4"
+ BTESTRUBY="$BTESTRUBY -- ${nacl_cv_runnable_ld} --library-path ${nacl_cv_host_lib}"
+ BTESTRUBY="$BTESTRUBY `pwd`/"'miniruby$(EXEEXT) -I`cd $(srcdir)/lib; pwd` -I.'
+ BTESTRUBY="$BTESTRUBY"' -I$(EXTOUT)/common 3>&1 4>&2 1>/dev/null 2>/dev/null '
+ fi
+ fi
else
MINIRUBY='./miniruby$(EXEEXT) -I$(srcdir)/lib -I.'
MINIRUBY="$MINIRUBY"' -I$(EXTOUT)/common'
PREP='miniruby$(EXEEXT)'
- RUNRUBY='$(MINIRUBY) $(srcdir)/tool/runruby.rb --extout=$(EXTOUT)'
+ RUNRUBY_COMMAND='$(MINIRUBY) $(srcdir)/tool/runruby.rb --extout=$(EXTOUT) $(RUNRUBYOPT)'
+ RUNRUBY='$(RUNRUBY_COMMAND) --'
XRUBY='$(RUNRUBY)'
TEST_RUNNABLE=yes
+ CROSS_COMPILING=no
fi
AC_SUBST(TEST_RUNNABLE)
+AC_SUBST(CROSS_COMPILING)
AC_SUBST(MINIRUBY)
+AC_SUBST(BTESTRUBY)
AC_SUBST(PREP)
+AC_SUBST(RUNRUBY_COMMAND)
AC_SUBST(RUNRUBY)
AC_SUBST(XRUBY)
AC_SUBST(EXTOUT, [${EXTOUT=.ext}])
@@ -2294,13 +2991,25 @@ LIBRUBYARG='$(LIBRUBYARG_STATIC)'
SOLIBS=
AS_CASE(["$target_os"],
- [cygwin*|mingw*|beos*|haiku*|openstep*|nextstep*|rhapsody*|darwin*|os2-emx*], [
+ [cygwin*|mingw*|beos*|haiku*|darwin*|os2-emx*], [
: ${DLDLIBS=""}
],
[
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)'])
@@ -2314,33 +3023,48 @@ ENABLE_SHARED=no
AC_ARG_ENABLE(shared,
AS_HELP_STRING([--enable-shared], [build a shared library for Ruby]),
[enable_shared=$enableval])
-libprefix='$(libdir)'
-LIBRUBY_RELATIVE=no
+libprefix=${multiarch+'$(archlibdir)'}${multiarch-'$(libdir)'}
+LIBRUBY_RELATIVE=${load_relative-no}
AS_CASE("$enable_shared", [yes], [
LIBRUBY='$(LIBRUBY_SO)'
LIBRUBYARG_SHARED='-l$(RUBY_SO_NAME)'
LIBRUBYARG='$(LIBRUBYARG_SHARED)'
+ LIBRUBY_RELATIVE=no
test -z "$CCDLFLAGS" || CFLAGS="$CFLAGS $CCDLFLAGS"
ENABLE_SHARED=yes
if test "$rb_cv_binary_elf" = yes; then
SOLIBS='$(LIBS)'
fi
+
# libdir can be overridden in config.site file (on OpenSUSE at least).
libdir_basename=lib
if test "$bindir" = '${exec_prefix}/bin'; then
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*], [],
+ [
+ if test "$GCC" = yes; then
+ RUBY_TRY_LDFLAGS([${linker_flag}--no-undefined], [no_undefined=yes], [no_undefined=no])
+ if test "no_undefined" = yes; then
+ RUBY_APPEND_OPTION(EXTLDFLAGS, [${linker_flag}--no-undefined])
+ fi
+ fi
+ ])
AS_CASE(["$target_os"],
[sunos4*], [
LIBRUBY_ALIASES='lib$(RUBY_SO_NAME).so.$(MAJOR).$(MINOR) lib$(RUBY_SO_NAME).so'
],
[linux* | gnu* | k*bsd*-gnu | atheos* | kopensolaris*-gnu], [
- LIBRUBY_DLDFLAGS='-Wl,-soname,lib$(RUBY_SO_NAME).so.$(MAJOR).$(MINOR)'
+ 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
],
@@ -2355,14 +3079,14 @@ AS_CASE("$enable_shared", [yes], [
[netbsd*], [
SOLIBS='$(LIBS)'
LIBRUBY_SO='lib$(RUBY_SO_NAME).so.$(MAJOR)$(MINOR).$(TEENY)'
- LIBRUBY_DLDFLAGS='-Wl,-soname,lib$(RUBY_SO_NAME).so.$(MAJOR)$(MINOR)'
+ LIBRUBY_DLDFLAGS='-Wl,-soname,lib$(RUBY_SO_NAME).so.$(MAJOR)$(MINOR)'" $LDFLAGS_OPTDIR"
if test "$rb_cv_binary_elf" = yes; then # ELF platforms
LIBRUBY_ALIASES='lib$(RUBY_SO_NAME).so.$(MAJOR)$(MINOR) lib$(RUBY_SO_NAME).so'
else # a.out platforms
LIBRUBY_ALIASES=""
fi
],
- [openbsd*], [
+ [openbsd*|mirbsd*], [
SOLIBS='$(LIBS)'
LIBRUBY_SO='lib$(RUBY_SO_NAME).so.$(MAJOR).'`expr ${MINOR} \* 10 + ${TEENY}`
],
@@ -2383,14 +3107,14 @@ AS_CASE("$enable_shared", [yes], [
LIBRUBY_ALIASES='lib$(RUBY_SO_NAME).sl.$(MAJOR).$(MINOR) lib$(RUBY_SO_NAME).sl'
],
[aix*], [
- LIBRUBY_DLDFLAGS="${linker_flag}-bnoentry $XLDFLAGS"
+ LIBRUBY_DLDFLAGS="${linker_flag}-bnoentry $XLDFLAGS $LDFLAGS_OPTDIR"
LIBRUBYARG_SHARED='-L${libdir} -l${RUBY_SO_NAME}'
SOLIBS='-lm -lc'
],
[beos*], [
AS_CASE(["$target_cpu"],
[powerpc*], [
- LIBRUBY_DLDFLAGS='-f ruby.exp -lnet -lbe -lroot glue-noinit.a init_term_dyn.o start_dyn.o'
+ LIBRUBY_DLDFLAGS="-f ruby.exp -lnet -lbe -lroot glue-noinit.a init_term_dyn.o start_dyn.o $LDFLAGS_OPTDIR"
])
],
[darwin*], [
@@ -2410,16 +3134,53 @@ 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)'
+ ],
+ [mingw*|cygwin*|mswin*], [
+ LIBRUBY_RELATIVE=yes
])
], [
LIBRUBYARG_SHARED=
+
+ # enable PIE if possible
+ pie=
+ AS_CASE(["$target_os"],
+ [haiku], [
+ # gcc supports PIE, but doesn't work correctly in Haiku
+ pie=no
+ ],
+ [nacl], [
+ # -pie implies -shared for NaCl.
+ pie=no
+ ])
+ if test "$GCC" = yes -a -z "$EXTSTATIC" -a "x$pie" != xno; then
+ RUBY_TRY_CFLAGS(-fPIE, [pie=yes], [pie=no])
+ if test "$pie" = yes; then
+ # Use -fPIE when testing -pie. RUBY_TRY_LDFLAGS sets
+ # $save_CFLAGS internally, so set other name here.
+ save_CFLAGS_before_pie="$CFLAGS"
+ CFLAGS="$CFLAGS -fPIE"
+
+ # gcc need -pie but clang need -Wl,-pie.
+ for pie in -pie -Wl,-pie; do
+ RUBY_TRY_LDFLAGS([$pie], [], [pie=])
+ if test "x$pie" != x; then
+ RUBY_APPEND_OPTION(XCFLAGS, -fPIE)
+ RUBY_APPEND_OPTION(XLDFLAGS, $pie)
+ break
+ fi
+ done
+ CFLAGS="$save_CFLAGS_before_pie"
+ fi
+ fi
])
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)"
+ LIBRUBY_RPATHFLAGS="$LIBRUBY_RPATHFLAGS${linker_flag}-R ${linker_flag}${libprefix}"
+ test "x$cross_compiling" = xyes || LIBRUBY_RPATHFLAGS="$LIBRUBY_RPATHFLAGS -L${libprefix}"
LIBRUBYARG_SHARED="$LIBRUBY_RPATHFLAGS $LIBRUBYARG_SHARED"
LIBRUBYARG_STATIC="$LIBRUBY_RPATHFLAGS $LIBRUBYARG_STATIC"
fi
@@ -2435,8 +3196,54 @@ if test "$EXEEXT" = .exe; then
AC_SUBST(EXECUTABLE_EXTS)
fi
-dnl }
-dnl build section {
+AC_ARG_ENABLE(dtrace,
+ AS_HELP_STRING([--enable-dtrace],
+ [enable DTrace for tracing inside ruby. enabled by default on systems having dtrace]),
+ [enable_dtrace=$enableval], [enable_dtrace=auto])
+
+if test "${enable_dtrace}" = "auto"; then
+ if test x"$DTRACE" != x -a x"$cross_compiling" != xyes; then
+ RUBY_DTRACE_AVAILABLE()
+ enable_dtrace=$rb_cv_dtrace_available
+ else
+ enable_dtrace=no
+ fi
+fi
+
+LIBRUBY_A_OBJS='$(OBJS)'
+if test "${enable_dtrace}" = "yes"; then
+ if test -z "$DTRACE"; then
+ AC_MSG_ERROR([dtrace(1) is missing])
+ elif test "$cross_compiling" = yes; then
+ AC_MSG_ERROR([--enable-dtrace, however, cross compiling])
+ else
+ RUBY_DTRACE_AVAILABLE()
+ enable_dtrace=$rb_cv_dtrace_available
+ if test "${enable_dtrace}" = "no"; then
+ AC_MSG_ERROR([--enable-dtrace, however, USDT is not available])
+ fi
+ RUBY_DTRACE_POSTPROCESS()
+ if test "$rb_cv_prog_dtrace_g" = 'yes'; then
+ DTRACE_OBJ='probes.$(OBJEXT)'
+ DTRACE_GLOMMED_OBJ='ruby-glommed.$(OBJEXT)'
+ LIBRUBY_A_OBJS='$(DTRACE_GLOMMED_OBJ)'
+ fi
+ AS_CASE("${target_os}", [freebsd*], [
+ # FreeBSD's dtrace requires libelf
+ LIBS="-lelf $LIBS"
+ ])
+ fi
+ DTRACE_EXT=d
+else
+ DTRACE_EXT=dmyh
+fi
+AC_SUBST(DTRACE_EXT)
+AC_SUBST(DTRACE_OBJ)
+AC_SUBST(DTRACE_GLOMMED_OBJ)
+AC_SUBST(LIBRUBY_A_OBJS)
+
+}
+{ # build section
dnl build rdoc index if requested
RDOCTARGET=""
@@ -2486,28 +3293,23 @@ AC_CACHE_CHECK([for prefix of external symbols], rb_cv_symbol_prefix, [
])
SYMBOL_PREFIX="$rb_cv_symbol_prefix"
test "x$SYMBOL_PREFIX" = xNONE && SYMBOL_PREFIX=''
+DLNOBJ=dln.o
+AC_ARG_ENABLE(dln,
+ AC_HELP_STRING([--disable-dln], [disable dynamic link feature]),
+ [test "$enableval" = yes || DLNOBJ=dmydln.o])
+AC_SUBST(DLNOBJ)
MINIDLNOBJ=dmydln.o
+
AS_CASE(["$target_os"],
[linux*], [
],
[netbsd*], [
RUBY_APPEND_OPTION(CFLAGS, -pipe)
],
- [nextstep*|openstep*], [
- RUBY_APPEND_OPTION(CPPFLAGS, -I/usr/local/include)
- ],
- [rhapsody*], [
- RUBY_APPEND_OPTIONS(CFLAGS, -pipe -no-precomp)
- ],
[darwin*], [
RUBY_APPEND_OPTION(CFLAGS, -pipe)
- ],
- [human*], [
- AC_LIBOBJ([x68.o])
- CFLAGS="$CFLAGS -fansi-only"
- XCFLAGS="$XCFLAGS -cc1-stack=262144 -cpp-stack=2694144"
- EXEEXT=.x
- OBJEXT=o
+ RUBY_APPEND_OPTION(XLDFLAGS, [-framework CoreFoundation])
+ RUBY_APPEND_OPTION(LIBRUBYARG_STATIC, [-framework CoreFoundation])
],
[os2-emx], [
AC_LIBOBJ([os2])
@@ -2536,7 +3338,7 @@ AS_CASE(["$target_os"],
CPPFLAGS="$CPPFLAGS -I/boot/home/config/include"
],
[cygwin*|mingw*], [
- RUBY_SO_NAME="${RUBY_SO_NAME}${MAJOR}${MINOR}${TEENY}"
+ RUBY_SO_NAME="${RUBY_SO_NAME}"'$(MAJOR)$(MINOR)$(TEENY)'
LIBRUBY_DLDFLAGS="${DLDFLAGS}"' -Wl,--out-implib=$(LIBRUBY)'
AS_CASE(["$target_os"],
[cygwin*], [
@@ -2580,9 +3382,13 @@ AS_CASE(["$target_os"],
XCFLAGS="$XCFLAGS -DYYMAXDEPTH=300"
YACC="$YACC -Nl40000 -Nm40000"
])],
- [*msdosdjgpp*], [
- FIRSTMAKEFILE=GNUmakefile:djgpp/GNUmakefile.in
+ [nacl], [
+ FIRSTMAKEFILE=GNUmakefile:nacl/GNUmakefile.in
])
+
+AS_CASE(["$with_gmp: $SOLIBS "], [no:* | *' -lgmp '*|*' $(LIBS) '*], [],
+ [SOLIBS="-lgmp $SOLIBS"])
+
MINIOBJS="$MINIDLNOBJ"
AS_CASE(["$THREAD_MODEL"],
@@ -2596,7 +3402,7 @@ AC_ARG_ENABLE(debug-env,
[AC_DEFINE(RUBY_DEBUG_ENV)])
AS_CASE(["$FIRSTMAKEFILE"], [*GNUmakefile:*], [gnumake=yes], [
- AC_MSG_CHECKING([for if ${MAKE-make} is GNU make])
+ AC_MSG_CHECKING([if ${MAKE-make} is GNU make])
mkdir conftest.dir
echo "all:; @echo yes" > conftest.dir/GNUmakefile
echo "all:; @echo no" > conftest.dir/Makefile
@@ -2604,8 +3410,7 @@ AS_CASE(["$FIRSTMAKEFILE"], [*GNUmakefile:*], [gnumake=yes], [
rm -fr conftest.dir
AS_CASE(["$gnumake"],
[*yes*], [
- echo "include Makefile" > GNUmakefile
- echo "-include uncommon.mk" >> GNUmakefile
+ FIRSTMAKEFILE=GNUmakefile:template/GNUmakefile.in
gnumake=yes],
[
gnumake=no])
@@ -2614,22 +3419,20 @@ AS_CASE(["$FIRSTMAKEFILE"], [*GNUmakefile:*], [gnumake=yes], [
AS_IF([test "$gnumake" = yes], [ NULLCMD=: ], [
AC_MSG_CHECKING([for safe null command for ${MAKE-make}])
mkdir conftest.dir
- echo 'A=1' > conftest.dir/Makefile
- echo 'B=$(A:1=@:)' >> conftest.dir/Makefile
- echo 'all:; $B 1 2 3 4 5 6 7 8 9' >> conftest.dir/Makefile
- if (cd conftest.dir; ${MAKE-make} >/dev/null 2>/dev/null); then
- NULLCMD=:
- else
+ NULLCMD=
+ for cmd in : true; do
echo 'A=1' > conftest.dir/Makefile
- echo 'B=$(A:1=@true)' >> conftest.dir/Makefile
+ echo 'B=$(A:1=@'$cmd')' >> conftest.dir/Makefile
echo 'all:; $B 1 2 3 4 5 6 7 8 9' >> conftest.dir/Makefile
if (cd conftest.dir; ${MAKE-make} >/dev/null 2>/dev/null); then
- NULLCMD=true
- else
- AC_MSG_ERROR(no candidate for safe null command)
+ NULLCMD=$cmd
+ break
fi
- fi
+ done
rm -fr conftest.dir
+ if test -z "$NULLCMD"; then
+ AC_MSG_ERROR(no candidate for safe null command)
+ fi
AC_MSG_RESULT($NULLCMD)
])
AC_SUBST(NULLCMD)
@@ -2652,7 +3455,7 @@ if test "${universal_binary-no}" = yes ; then
archflagpat=`eval echo '"'"${ARCH_FLAG}"'"' | sed 's/[[][|.*]]/\\&/g'`
new_cflags=`echo "$CFLAGS" | sed "s|$archflagpat"'||'`
for archs in ${universal_archnames}; do
- cpu=${archs#*=}
+ cpu=${archs@%:@*=}
archs=${archs%=*}
CFLAGS="$new_cflags -arch $archs"
archs="__${archs}__"
@@ -2666,6 +3469,42 @@ if test "${universal_binary-no}" = yes ; then
])])
fi
+AC_CHECK_FUNC(memmem, [
+ AC_CACHE_CHECK(for broken memmem, rb_cv_broken_memmem, [
+ AC_TRY_RUN([
+#include <string.h>
+
+int
+main()
+{
+ char *str = "hogefugafoobar";
+ char *rs = "foo";
+ char *empty = "";
+ char *p;
+
+ p = memmem(str, strlen(str), rs, strlen(rs));
+ if (p == str+8) {
+ p = memmem(str, strlen(str), empty, strlen(empty));
+ if (p == str)
+ return 0;
+ else
+ return 1;
+ }
+ else {
+ return 1;
+ }
+}
+ ],
+ rb_cv_broken_memmem=no,
+ rb_cv_broken_memmem=yes,
+ rb_cv_broken_memmem=yes)
+ ])
+ if test "$rb_cv_broken_memmem" = no; then
+ AC_DEFINE(HAVE_MEMMEM, 1)
+ fi
+])
+
+
CPPFLAGS="$CPPFLAGS "'$(DEFS)'
test -z "$CPPFLAGS" || CPPFLAGS="$CPPFLAGS "; CPPFLAGS="$CPPFLAGS"'${cppflags}'
if test -n "${cflags+set}"; then
@@ -2689,8 +3528,10 @@ AC_SUBST(cxxflags, ["$orig_cxxflags "'${optflags} ${debugflags} ${warnflags}'])d
AC_SUBST(optflags)dnl
AC_SUBST(debugflags)dnl
AC_SUBST(warnflags)dnl
+AC_SUBST(strict_warnflags)dnl
AC_SUBST(XCFLAGS)dnl
AC_SUBST(XLDFLAGS)dnl
+AC_SUBST(EXTLDFLAGS)dnl
AC_SUBST(EXTDLDFLAGS)dnl
AC_SUBST(LIBRUBY_LDSHARED)
AC_SUBST(LIBRUBY_DLDFLAGS)
@@ -2718,7 +3559,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)
@@ -2744,15 +3587,29 @@ AC_ARG_WITH(rubylibprefix,
AC_MSG_ERROR([No ruby, No libprefix])
fi
rubylibprefix="$withval"])
-RUBY_LIB_PREFIX=`eval echo \\"${rubylibprefix}\\"`
AC_SUBST(rubylibprefix)
+rubylibdir='${rubylibprefix}/${ruby_version}'
+rubyarchdir=${multiarch+'${rubyarchprefix}/${ruby_version}'}${multiarch-'${rubylibdir}/${arch}'}
+
+rubyarchprefix=${multiarch+'${archlibdir}/${RUBY_BASE_NAME}'}${multiarch-'${rubylibprefix}/${arch}'}
+AC_ARG_WITH(rubyarchprefix,
+ AS_HELP_STRING([--with-rubyarchprefix=DIR],
+ [prefix for architecture dependent ruby libraries [[RUBYLIBPREFIX/ARCH]]]),
+ [rubyarchprefix="$withval"])
+AC_SUBST(rubyarchprefix)
+
+rubysitearchprefix=${multiarch+'${sitearchlibdir}/${RUBY_BASE_NAME}'}${multiarch-'${rubylibprefix}/${sitearch}'}
+AC_ARG_WITH(rubysitearchprefix,
+ AS_HELP_STRING([--with-rubysitearchprefix=DIR],
+ [prefix for architecture dependent site libraries [[RUBYLIBPREFIX/SITEARCH]]]),
+ [rubysitearchprefix="$withval"])
+AC_SUBST(rubysitearchprefix)
RI_BASE_NAME=`echo ${RUBY_BASE_NAME} | sed 's/ruby/ri/'`
ridir='${datarootdir}/${RI_BASE_NAME}'
AC_ARG_WITH(ridir,
AS_HELP_STRING([--with-ridir=DIR], [ri documentation [[DATAROOTDIR/ri]]]),
[ridir=$withval])
-RIDIR=`eval echo \\"${ridir}\\"`
AC_SUBST(ridir)
AC_SUBST(RI_BASE_NAME)
@@ -2770,96 +3627,70 @@ if test ${RUBY_LIB_VERSION_STYLE+set}; then
echo "#define RUBY_LIB_VERSION_STYLE $RUBY_LIB_VERSION_STYLE"
echo '#define STRINGIZE(x) x'
test -f revision.h -o -f "${srcdir}/revision.h" || echo '#define RUBY_REVISION 0'
+ echo '#include "verconf.h"'
echo '#include "version.h"'
echo 'ruby_version=RUBY_LIB_VERSION'
} > conftest.c
- ruby_version="`$CPP -I"${srcdir}" -I"${srcdir}/include" conftest.c | sed '/^ruby_version=/!d;s/ //g'`"
+ 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]]]),
+ AS_HELP_STRING([--with-sitedir=DIR], [site libraries in DIR [[RUBY_LIB_PREFIX/site_ruby]], "no" to disable site directory]),
[sitedir=$withval],
[sitedir='${rubylibprefix}/site_ruby'])
-dir="${sitedir}"
-until SITE_DIR=`eval echo \\"${dir}\\"`; test "x${dir}" = "x${SITE_DIR}"; do
- dir="${SITE_DIR}"
-done
+sitelibdir='${sitedir}/${ruby_version}'
+
+AC_ARG_WITH(sitearchdir,
+ 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}'}])
AC_ARG_WITH(vendordir,
- AS_HELP_STRING([--with-vendordir=DIR], [vendor libraries in DIR [[RUBY_LIB_PREFIX/vendor_ruby]]]),
+ AS_HELP_STRING([--with-vendordir=DIR], [vendor libraries in DIR [[RUBY_LIB_PREFIX/vendor_ruby]], "no" to disable vendor directory]),
[vendordir=$withval],
[vendordir='${rubylibprefix}/vendor_ruby'])
-dir="${vendordir}"
-until VENDOR_DIR=`eval echo \\"${dir}\\"`; test "x${dir}" = "x${VENDOR_DIR}"; do
- dir="${VENDOR_DIR}"
-done
+vendorlibdir='${vendordir}/${ruby_version}'
+
+AC_ARG_WITH(vendorarchdir,
+ 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}'}])
if test "${LOAD_RELATIVE+set}"; then
AC_DEFINE_UNQUOTED(LOAD_RELATIVE, $LOAD_RELATIVE)
- RUBY_EXEC_PREFIX=""
- RUBY_LIB_PREFIX="`eval echo "$RUBY_LIB_PREFIX" | sed 's|^NONE/|/|;s|^'"$prefix"'/|/|'`"
- RUBY_SITE_LIB_PATH="`eval echo "$SITE_DIR" | sed 's|^NONE/|/|;s|^'"$prefix"'/|/|'`"
- RUBY_VENDOR_LIB_PATH="`eval echo "$VENDOR_DIR" | sed 's|^NONE/|/|;s|^'"$prefix"'/|/|'`"
-else
- RUBY_EXEC_PREFIX="`eval echo \\"$exec_prefix/\\" | sed 's|^NONE/|'"$prefix"'/|;s|/$||'`"
- RUBY_LIB_PREFIX="`eval echo \\"$RUBY_LIB_PREFIX\\" | sed 's|^NONE/|'"$prefix"'/|'`"
- RUBY_SITE_LIB_PATH="`eval echo \\"$SITE_DIR\\" | sed 's|^NONE/|'"$prefix"'/|'`"
- RUBY_VENDOR_LIB_PATH="`eval echo \\"$VENDOR_DIR\\" | sed 's|^NONE/|'"$prefix"'/|'`"
+ RUBY_EXEC_PREFIX=''
fi
-pat=`echo "$RUBY_LIB_PREFIX/" | tr -c '\012' .`'\(.*\)'
-AS_CASE(["$RUBY_SITE_LIB_PATH"],
- ["$RUBY_LIB_PREFIX/"*], [
- RUBY_SITE_LIB_PATH='RUBY_LIB_PREFIX"/'"`expr \"$RUBY_SITE_LIB_PATH\" : \"$pat\"`"'"'
- ],
- [
- RUBY_SITE_LIB_PATH="\"${RUBY_SITE_LIB_PATH}\""
- ])
-AS_CASE(["$RUBY_VENDOR_LIB_PATH"],
- ["$RUBY_LIB_PREFIX/"*], [
- RUBY_VENDOR_LIB_PATH='RUBY_LIB_PREFIX"/'"`expr \"$RUBY_VENDOR_LIB_PATH\" : \"$pat\"`"'"'
- ],
- [
- RUBY_VENDOR_LIB_PATH="\"${RUBY_VENDOR_LIB_PATH}\""
- ])
-pat=`echo "$RUBY_EXEC_PREFIX/" | tr -c '\012' .`'\(.*\)'
-AS_CASE(["$RUBY_LIB_PREFIX"],
- ["$RUBY_EXEC_PREFIX/"*], [
- RUBY_LIB_PREFIX='RUBY_EXEC_PREFIX"/'"`expr \"$RUBY_LIB_PREFIX\" : \"$pat\"`"'"'
- ],
- [
- RUBY_LIB_PREFIX="\"${RUBY_LIB_PREFIX}\""
- ])
-
-if test ${RUBY_LIB_VERSION_STYLE+set}; then
- AC_DEFINE_UNQUOTED(RUBY_LIB_VERSION_STYLE, $RUBY_LIB_VERSION_STYLE)
-else
- AC_DEFINE_UNQUOTED(RUBY_LIB_VERSION, [$RUBY_LIB_VERSION])
-fi
-AC_DEFINE_UNQUOTED(RUBY_EXEC_PREFIX, "${RUBY_EXEC_PREFIX}")
-AC_DEFINE_UNQUOTED(RUBY_LIB_PREFIX, ${RUBY_LIB_PREFIX})
-if test "x$SITE_DIR" = xno; then
- AC_DEFINE(NO_RUBY_SITE_LIB)
-else
- AC_DEFINE_UNQUOTED(RUBY_SITE_LIB, ${RUBY_SITE_LIB_PATH})
-fi
-if test "x$VENDOR_DIR" = xno; then
- AC_DEFINE(NO_RUBY_VENDOR_LIB)
-else
- AC_DEFINE_UNQUOTED(RUBY_VENDOR_LIB, ${RUBY_VENDOR_LIB_PATH})
-fi
+AC_SUBST(RUBY_EXEC_PREFIX)
+AC_SUBST(libdirname, ${multiarch+arch}libdir)
+AC_SUBST(archlibdir)dnl
+AC_SUBST(sitearchlibdir)dnl
+AC_SUBST(archincludedir)dnl
+AC_SUBST(sitearchincludedir)dnl
AC_SUBST(arch)dnl
AC_SUBST(sitearch)dnl
AC_SUBST(ruby_version)dnl
+AC_SUBST(rubylibdir)dnl
+AC_SUBST(rubyarchdir)dnl
AC_SUBST(sitedir)dnl
+AC_SUBST(sitelibdir)dnl
+AC_SUBST(sitearchdir)dnl
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}"
@@ -2875,7 +3706,7 @@ if test "${universal_binary-no}" = yes ; then
RUBY_DEFINE_IF([defined __${archs}__], RUBY_PLATFORM_CPU, ["${cpu}"])
done
fi
- ints='long int'
+ ints='long int short'
test "$ac_cv_type_long_long" = yes && ints="'long long' $ints"
AC_SUBST(UNIVERSAL_ARCHNAMES, "${universal_archnames}")
AC_SUBST(UNIVERSAL_INTS, "${ints}")
@@ -2889,50 +3720,54 @@ fi
unset sitearch
AS_CASE(["$target_os"],[mingw*],[sitearch="$target_cpu-$rb_cv_msvcrt"])
-test ${sitearch+set} && AC_DEFINE_UNQUOTED(RUBY_SITEARCH, "${sitearch}")
: ${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")
+ AC_SUBST(RUBY_SEARCH_PATH, $search_path)
fi
AC_ARG_WITH(rubyhdrdir,
AS_HELP_STRING([--with-rubyhdrdir=DIR], [core headers in DIR [[INCLUDEDIR/RUBY_BASE_NAME-RUBY_VERSION]]]),
[rubyhdrdir=$withval],
- [rubyhdrdir='${includedir}/${RUBY_BASE_NAME}-${ruby_version}'])
+ [rubyhdrdir='${includedir}/${RUBY_VERSION_NAME}'])
+
+AC_ARG_WITH(rubyarchhdrdir,
+ 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}'}])
AC_ARG_WITH(sitehdrdir,
AS_HELP_STRING([--with-sitehdrdir=DIR], [core site headers in DIR [[RUBYHDRDIR/site_ruby]]]),
[sitehdrdir=$withval],
[sitehdrdir='${rubyhdrdir}/site_ruby'])
+AC_ARG_WITH(sitearchhdrdir,
+ 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}'}])
+
AC_ARG_WITH(vendorhdrdir,
AS_HELP_STRING([--with-vendorhdrdir=DIR], [core vendor headers in DIR [[RUBYHDRDIR/vendor_ruby]]]),
[vendorhdrdir=$withval],
[vendorhdrdir='${rubyhdrdir}/vendor_ruby'])
+AC_ARG_WITH(vendorarchhdrdir,
+ 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}'}])
+
AC_SUBST(rubyhdrdir)dnl
AC_SUBST(sitehdrdir)dnl
AC_SUBST(vendorhdrdir)dnl
-
-AC_ARG_WITH(opt-dir,
- AS_HELP_STRING([--with-opt-dir=DIR-LIST],
- [add optional headers and libraries directories separated by $PATH_SEPARATOR]),
- [
- CPPFLAGS="$CPPFLAGS `echo \"$PATH_SEPARATOR$withval\" | sed \"s|$PATH_SEPARATOR\([[^$PATH_SEPARATOR]*]\)| -I\1/include|g;s/^ //\"`"
- set -x
- val=`IFS="$PATH_SEPARATOR"
- for dir in $withval; do
- echo x ${LIBPATHFLAG} ${RPATHFLAG} |
- sed -E 's/^x *//;s'"${PATH_SEPARATOR}"'%1\\$-s|%s'"${IFS}${dir}/lib${IFS}g"
- done | tr '\012' ' '`
- set +x
- LDFLAGS="$LDFLAGS${LDFLAGS:+ }$val"
- DLDFLAGS="$DLDFLAGS${DLDFLAGS:+ }$val"
- ])
+AC_SUBST(rubyarchhdrdir)dnl
+AC_SUBST(sitearchhdrdir)dnl
+AC_SUBST(vendorarchhdrdir)dnl
AC_ARG_WITH(mantype,
AS_HELP_STRING([--with-mantype=TYPE], [specify man page type; TYPE is one of man and doc]),
@@ -3001,21 +3836,28 @@ 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)
-AC_CONFIG_FILES(Makefile, [{
- if test -d "$srcdir/.svn"; then
+if test x"$firstmf" != x; then
+ AC_CONFIG_FILES($firstmf:$firsttmpl, [], [firstmf="$firstmf" firsttmpl="$firsttmpl"])
+fi
+AC_CONFIG_FILES(Makefile, [
+ tmpmk=confmk$$.tmp
+ {
+ if test ${VCS+set}; then
+ :
+ elif svn info "$srcdir" > /dev/null 2>&1; then
VCS='svn'
- VCSUP='$(VCS) up $(SVNUPOPTIONS)'
elif test -d "$srcdir/.git/svn"; then
VCS='git svn'
- VCSUP='$(VCS) rebase $(GITSVNREBASEOPTIONS)'
elif test -d "$srcdir/.git"; then
VCS='git'
- VCSUP='$(VCS) pull $(GITPULLOPTIONS)'
else
VCS='echo cannot'
- VCSUP='$(VCS)'
fi
+ AS_CASE("$VCS",
+ [svn], [VCSUP='$(VCS) up $(SVNUPOPTIONS)'],
+ ["git svn"], [VCSUP='$(VCS) rebase $(GITSVNREBASEOPTIONS)'],
+ [git], [VCSUP='$(VCS) pull $(GITPULLOPTIONS)'],
+ [VCSUP='$(VCS)'])
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
@@ -3024,12 +3866,20 @@ AC_CONFIG_FILES(Makefile, [{
else
echo 'distclean-local::; @$(RM) GNUmakefile uncommon.mk'
fi
- } > confmk$$.tmp && mv -f confmk$$.tmp Makefile &&
- {
- grep '^ruby:' Makefile > /dev/null ||
- ${MAKE-make} info-program | grep '^PROGRAM=ruby$' > /dev/null ||
- echo 'ruby: $(PROGRAM);' >> Makefile
- }],
+ } > $tmpmk && if ! grep '^ruby:' $tmpmk > /dev/null; then
+ if test "${gnumake}" = yes; then
+ tmpgmk=confgmk$$.tmp
+ {
+ echo "include $tmpmk"
+ echo "-include uncommon.mk"
+ } > $tmpgmk
+ else
+ tmpgmk=$tmpmk
+ fi &&
+ test -z "`${MAKE-make} -f $tmpgmk info-program | grep '^PROGRAM=ruby$'`" &&
+ echo 'ruby: $(PROGRAM);' >> $tmpmk
+ test "$tmpmk" = "$tmpgmk" || rm -f "$tmpgmk"
+ fi && mv -f $tmpmk Makefile],
[EXEEXT='$EXEEXT' gnumake='$gnumake'])
AC_ARG_WITH([ruby-pc],
@@ -3055,5 +3905,5 @@ AC_CONFIG_FILES($ruby_pc:template/ruby.pc.in,
[ruby_pc='$ruby_pc' PKG_CONFIG='$PKG_CONFIG'])
AC_OUTPUT
-dnl }
-dnl }
+}
+}
diff --git a/constant.h b/constant.h
index 8232910737..3dc9b8d4ef 100644
--- a/constant.h
+++ b/constant.h
@@ -18,7 +18,9 @@ typedef enum {
typedef struct rb_const_entry_struct {
rb_const_flag_t flag;
- VALUE value; /* should be mark */
+ const VALUE value; /* should be mark */
+ const VALUE file; /* should be mark */
+ int line;
} rb_const_entry_t;
VALUE rb_mod_private_constant(int argc, VALUE *argv, VALUE obj);
diff --git a/cont.c b/cont.c
index 1e42974145..fa9e91ee64 100644
--- a/cont.c
+++ b/cont.c
@@ -15,9 +15,6 @@
#include "gc.h"
#include "eval_intern.h"
-#if ((defined(_WIN32) && _WIN32_WINNT >= 0x0400) || (defined(HAVE_GETCONTEXT) && defined(HAVE_SETCONTEXT))) && !defined(__NetBSD__) && !defined(sun) && !defined(FIBER_USE_NATIVE)
-#define FIBER_USE_NATIVE 1
-
/* FIBER_USE_NATIVE enables Fiber performance improvement using system
* dependent method such as make/setcontext on POSIX system or
* CreateFiber() API on Windows.
@@ -29,12 +26,45 @@
* in Proc. of 51th Programming Symposium, pp.21--28 (2010) (in Japanese).
*/
+#if !defined(FIBER_USE_NATIVE)
+# if defined(HAVE_GETCONTEXT) && defined(HAVE_SETCONTEXT)
+# if 0
+# elif defined(__NetBSD__)
/* On our experience, NetBSD doesn't support using setcontext() and pthread
* simultaneously. This is because pthread_self(), TLS and other information
* are represented by stack pointer (higher bits of stack pointer).
* TODO: check such constraint on configure.
*/
-#elif !defined(FIBER_USE_NATIVE)
+# define FIBER_USE_NATIVE 0
+# elif defined(__sun)
+/* On Solaris because resuming any Fiber caused SEGV, for some reason.
+ */
+# define FIBER_USE_NATIVE 0
+# elif defined(__ia64)
+/* At least, Linux/ia64's getcontext(3) doesn't save register window.
+ */
+# define FIBER_USE_NATIVE 0
+# elif defined(__GNU__)
+/* GNU/Hurd doesn't fully support getcontext, setcontext, makecontext
+ * and swapcontext functions. Disabling their usage till support is
+ * implemented. More info at
+ * http://darnassus.sceen.net/~hurd-web/open_issues/glibc/#getcontext
+ */
+# define FIBER_USE_NATIVE 0
+# else
+# define FIBER_USE_NATIVE 1
+# endif
+# elif defined(_WIN32)
+# if _WIN32_WINNT >= 0x0400
+/* only when _WIN32_WINNT >= 0x0400 on Windows because Fiber APIs are
+ * supported only such building (and running) environments.
+ * [ruby-dev:41192]
+ */
+# define FIBER_USE_NATIVE 1
+# endif
+# endif
+#endif
+#if !defined(FIBER_USE_NATIVE)
#define FIBER_USE_NATIVE 0
#endif
@@ -47,8 +77,7 @@
#define RB_PAGE_SIZE (pagesize)
#define RB_PAGE_MASK (~(RB_PAGE_SIZE - 1))
static long pagesize;
-#define FIBER_MACHINE_STACK_ALLOCATION_SIZE (0x10000)
-#endif
+#endif /*FIBER_USE_NATIVE*/
#define CAPTURE_JUST_VALID_VM_STACK 1
@@ -78,6 +107,8 @@ typedef struct rb_context_struct {
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 {
@@ -87,13 +118,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
@@ -103,6 +134,12 @@ typedef struct rb_fiber_struct {
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;
+
#if FIBER_USE_NATIVE
#ifdef _WIN32
void *fib_handle;
@@ -123,7 +160,7 @@ static VALUE rb_eFiberError;
#define GetFiberPtr(obj, ptr) do {\
TypedData_Get_Struct((obj), rb_fiber_t, &fiber_data_type, (ptr)); \
if (!(ptr)) rb_raise(rb_eFiberError, "uninitialized fiber"); \
-} while(0)
+} while (0)
NOINLINE(static VALUE cont_capture(volatile int *stat));
@@ -188,6 +225,7 @@ cont_free(void *ptr)
#if FIBER_USE_NATIVE
if (cont->type == CONTINUATION_CONTEXT) {
/* cont */
+ ruby_xfree(cont->ensure_array);
RUBY_FREE_UNLESS_NULL(cont->machine_stack);
}
else {
@@ -218,6 +256,7 @@ cont_free(void *ptr)
#endif
}
#else /* not FIBER_USE_NATIVE */
+ ruby_xfree(cont->ensure_array);
RUBY_FREE_UNLESS_NULL(cont->machine_stack);
#endif
#ifdef __ia64
@@ -316,7 +355,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);
@@ -382,6 +422,7 @@ cont_save_machine_stack(rb_thread_t *th, rb_context_t *cont)
static const rb_data_type_t cont_data_type = {
"continuation",
{cont_mark, cont_free, cont_memsize,},
+ NULL, NULL, RUBY_TYPED_FREE_IMMEDIATELY
};
static void
@@ -448,6 +489,22 @@ 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;
@@ -459,7 +516,7 @@ cont_capture(volatile int *stat)
}
else {
*stat = 0;
- return cont->self;
+ return contval;
}
}
@@ -507,6 +564,10 @@ cont_restore_thread(rb_context_t *cont)
th->protect_tag = sth->protect_tag;
th->errinfo = sth->errinfo;
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
@@ -561,9 +622,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 */
@@ -620,7 +682,7 @@ fiber_setcontext(rb_fiber_t *newfib, rb_fiber_t *oldfib)
rb_thread_t *th = GET_THREAD(), *sth = &newfib->cont.saved_thread;
if (newfib->status != RUNNING) {
- fiber_initialize_machine_stack_context(newfib, FIBER_MACHINE_STACK_ALLOCATION_SIZE);
+ fiber_initialize_machine_stack_context(newfib, th->vm->default_params.fiber_machine_stack_size);
}
/* restore thread context */
@@ -657,17 +719,6 @@ fiber_setcontext(rb_fiber_t *newfib, rb_fiber_t *oldfib)
/* swap machine context */
#ifdef _WIN32
SwitchToFiber(newfib->fib_handle);
-#elif defined(__FreeBSD__) /* FreeBSD 9 doesn't work with swapcontext */
- if (!ruby_setjmp(oldfib->cont.jmpbuf)) {
- if (newfib->status != RUNNING) {
- if (setcontext(&newfib->context) < 0) {
- rb_bug("context switch between fiber failed");
- }
- }
- else {
- ruby_longjmp(newfib->cont.jmpbuf, 1);
- }
- }
#else
swapcontext(&oldfib->context, &newfib->context);
#endif
@@ -793,17 +844,17 @@ cont_restore_0(rb_context_t *cont, VALUE *addr_in_prev_frame)
cont_restore_1(cont);
}
#ifdef __ia64
-#define cont_restore_0(cont, vp) register_stack_extend((cont), (vp), (VALUE*)rb_ia64_bsp());
+#define cont_restore_0(cont, vp) register_stack_extend((cont), (vp), (VALUE*)rb_ia64_bsp())
#endif
/*
* Document-class: Continuation
*
- * Continuation objects are generated by <code>Kernel#callcc</code>,
- * after having <code>require</code>d <i>continuation</i>. They hold
+ * Continuation objects are generated by Kernel#callcc,
+ * after having +require+d <i>continuation</i>. They hold
* a return address and execution context, allowing a nonlocal return
* to the end of the <code>callcc</code> block from anywhere within a
- * program. Continuations are somewhat analogous to a structured
+ * program. Continuations are somewhat analogous to a structured
* version of C's <code>setjmp/longjmp</code> (although they contain
* more state, so you might consider them closer to threads).
*
@@ -849,15 +900,15 @@ cont_restore_0(rb_context_t *cont, VALUE *addr_in_prev_frame)
* call-seq:
* callcc {|cont| block } -> obj
*
- * Generates a <code>Continuation</code> object, which it passes to
+ * Generates a Continuation object, which it passes to
* the associated block. You need to <code>require
* 'continuation'</code> before using this method. Performing a
- * <em>cont</em><code>.call</code> will cause the <code>callcc</code>
+ * <em>cont</em><code>.call</code> will cause the #callcc
* to return (as will falling through the end of the block). The
- * value returned by the <code>callcc</code> is the value of the
+ * value returned by the #callcc is the value of the
* block, or the value passed to <em>cont</em><code>.call</code>. See
- * class <code>Continuation</code> for more details. Also see
- * <code>Kernel::throw</code> for an alternative mechanism for
+ * class Continuation for more details. Also see
+ * Kernel#throw for an alternative mechanism for
* unwinding a call stack.
*/
@@ -878,7 +929,7 @@ rb_callcc(VALUE self)
static VALUE
make_passing_arg(int argc, VALUE *argv)
{
- switch(argc) {
+ switch (argc) {
case 0:
return Qnil;
case 1:
@@ -888,6 +939,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, ...)
@@ -925,10 +1050,14 @@ 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);
+ /* restore `tracing' context. see [Feature #4347] */
+ th->trace_arg = cont->saved_thread.trace_arg;
+
cont_restore_0(cont, &contval);
return Qnil; /* unreachable */
}
@@ -999,11 +1128,10 @@ rb_cont_call(int argc, VALUE *argv, VALUE contval)
*
*/
-#define FIBER_VM_STACK_SIZE (4 * 1024)
-
static const rb_data_type_t fiber_data_type = {
"fiber",
{fiber_mark, fiber_free, fiber_memsize,},
+ NULL, NULL, RUBY_TYPED_FREE_IMMEDIATELY
};
static VALUE
@@ -1051,18 +1179,20 @@ fiber_init(VALUE fibval, VALUE proc)
fiber_link_join(fib);
- th->stack_size = FIBER_VM_STACK_SIZE;
+ th->stack_size = th->vm->default_params.fiber_vm_stack_size / sizeof(VALUE);
th->stack = ALLOC_N(VALUE, th->stack_size);
th->cfp = (void *)(th->stack + th->stack_size);
th->cfp--;
th->cfp->pc = 0;
th->cfp->sp = th->stack + 1;
- th->cfp->bp = 0;
- th->cfp->lfp = th->stack;
- *th->cfp->lfp = 0;
- th->cfp->dfp = th->stack;
+#if VM_DEBUG_BP_CHECK
+ th->cfp->bp_check = 0;
+#endif
+ th->cfp->ep = th->stack;
+ *th->cfp->ep = VM_ENVVAL_BLOCK_PTR(0);
th->cfp->self = Qnil;
+ th->cfp->klass = Qnil;
th->cfp->flag = 0;
th->cfp->iseq = 0;
th->cfp->proc = 0;
@@ -1098,20 +1228,19 @@ return_fiber(void)
{
rb_fiber_t *fib;
VALUE curr = rb_fiber_current();
+ VALUE prev;
GetFiberPtr(curr, fib);
- if (fib->prev == Qnil) {
- rb_thread_t *th = GET_THREAD();
+ prev = fib->prev;
+ if (NIL_P(prev)) {
+ const VALUE root_fiber = GET_THREAD()->root_fiber;
- if (th->root_fiber != curr) {
- return th->root_fiber;
- }
- else {
+ if (root_fiber == curr) {
rb_raise(rb_eFiberError, "can't yield from root fiber");
}
+ return root_fiber;
}
else {
- VALUE prev = fib->prev;
fib->prev = Qnil;
return prev;
}
@@ -1150,27 +1279,27 @@ rb_fiber_start(void)
TH_PUSH_TAG(th);
if ((state = EXEC_TAG()) == 0) {
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->local_lfp = proc->block.lfp;
- th->local_svar = Qnil;
+ th->root_lep = rb_vm_ep_local_ep(proc->block.ep);
+ th->root_svar = Qnil;
fib->status = RUNNING;
- cont->value = rb_vm_invoke_proc(th, proc, proc->block.self, argc, argv, 0);
+ cont->value = rb_vm_invoke_proc(th, proc, argc, argv, 0);
}
TH_POP_TAG();
if (state) {
- if (state == TAG_RAISE) {
- th->thrown_errinfo = th->errinfo;
+ if (state == TAG_RAISE || state == TAG_FATAL) {
+ rb_threadptr_pending_interrupt_enque(th, th->errinfo);
}
else {
- th->thrown_errinfo =
- rb_vm_make_jump_tag_but_local_jump(state, th->errinfo);
+ VALUE err = rb_vm_make_jump_tag_but_local_jump(state, th->errinfo);
+ if (!NIL_P(err))
+ rb_threadptr_pending_interrupt_enque(th, err);
}
RUBY_VM_SET_INTERRUPT(th);
}
@@ -1227,14 +1356,14 @@ fiber_store(rb_fiber_t *next_fib)
#if !FIBER_USE_NATIVE
cont_save_machine_stack(th, &fib->cont);
+#endif
- if (ruby_setjmp(fib->cont.jmpbuf)) {
-#else /* FIBER_USE_NATIVE */
- {
+ if (FIBER_USE_NATIVE || ruby_setjmp(fib->cont.jmpbuf)) {
+#if FIBER_USE_NATIVE
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++;
@@ -1275,6 +1404,13 @@ fiber_switch(VALUE fibval, int argc, VALUE *argv, int is_resume)
GetFiberPtr(fibval, fib);
cont = &fib->cont;
+ if (th->fiber == fibval) {
+ /* ignore fiber context switch
+ * because destination fiber is same as current fiber
+ */
+ return make_passing_arg(argc, argv);
+ }
+
if (cont->saved_thread.self != th->self) {
rb_raise(rb_eFiberError, "fiber called across threads");
}
@@ -1312,6 +1448,10 @@ fiber_switch(VALUE fibval, int argc, VALUE *argv, int is_resume)
if (is_resume) {
fib->prev = rb_fiber_current();
}
+ else {
+ /* restore `tracing' context. see [Feature #4347] */
+ th->trace_arg = cont->saved_thread.trace_arg;
+ }
cont->argc = argc;
cont->value = make_passing_arg(argc, argv);
@@ -1323,7 +1463,7 @@ fiber_switch(VALUE fibval, int argc, VALUE *argv, int is_resume)
rb_bug("rb_fiber_resume: unreachable");
}
#endif
- RUBY_VM_CHECK_INTS();
+ RUBY_VM_CHECK_INTS(th);
return value;
}
@@ -1343,6 +1483,9 @@ rb_fiber_resume(VALUE fibval, int argc, VALUE *argv)
if (fib->prev != Qnil || fib->cont.type == ROOT_FIBER_CONTEXT) {
rb_raise(rb_eFiberError, "double resume");
}
+ if (fib->transfered != 0) {
+ rb_raise(rb_eFiberError, "cannot resume transferred Fiber");
+ }
return fiber_switch(fibval, argc, argv, 1);
}
@@ -1421,11 +1564,41 @@ rb_fiber_m_resume(int argc, VALUE *argv, VALUE fib)
* You cannot resume a fiber that transferred control to another one.
* This will cause a double resume error. You need to transfer control
* back to this fiber before it can yield and resume.
+ *
+ * Example:
+ *
+ * fiber1 = Fiber.new do
+ * puts "In Fiber 1"
+ * Fiber.yield
+ * end
+ *
+ * fiber2 = Fiber.new do
+ * puts "In Fiber 2"
+ * fiber1.transfer
+ * puts "Never see this message"
+ * end
+ *
+ * fiber3 = Fiber.new do
+ * puts "In Fiber 3"
+ * end
+ *
+ * fiber2.resume
+ * fiber3.resume
+ *
+ * <em>produces</em>
+ *
+ * In fiber 2
+ * In fiber 1
+ * In fiber 3
+ *
*/
static VALUE
-rb_fiber_m_transfer(int argc, VALUE *argv, VALUE fib)
+rb_fiber_m_transfer(int argc, VALUE *argv, VALUE fibval)
{
- return rb_fiber_transfer(fib, argc, argv);
+ rb_fiber_t *fib;
+ GetFiberPtr(fibval, fib);
+ fib->transfered = 1;
+ return rb_fiber_transfer(fibval, argc, argv);
}
/*
@@ -1497,9 +1670,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)
@@ -1520,6 +1691,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/cygwin/GNUmakefile.in b/cygwin/GNUmakefile.in
index 19d1727dd7..5bd414d786 100644
--- a/cygwin/GNUmakefile.in
+++ b/cygwin/GNUmakefile.in
@@ -1,5 +1,4 @@
include Makefile
--include uncommon.mk
ENABLE_SHARED=@ENABLE_SHARED@
DLLWRAP = @DLLWRAP@ --target=@target_os@ --driver-name="$(CC)"
@@ -30,6 +29,9 @@ else
endif
WPROGRAM = $(RUBYW_INSTALL_NAME)$(EXEEXT)
+
+-include uncommon.mk
+
SOLIBS := $(DLL_BASE_NAME).res.@OBJEXT@ $(SOLIBS)
EXTOBJS += $(if $(filter-out $(RUBYW_INSTALL_NAME),$(@:$(EXEEXT)=)),$(RUBY_INSTALL_NAME),$(@:$(EXEEXT)=)).res.$(OBJEXT)
RCFILES = $(RUBY_INSTALL_NAME).rc $(RUBYW_INSTALL_NAME).rc $(DLL_BASE_NAME).rc
diff --git a/debug.c b/debug.c
index dcc710bc4a..2f1e03cc3a 100644
--- a/debug.c
+++ b/debug.c
@@ -12,7 +12,7 @@
#include "ruby/ruby.h"
#include "ruby/encoding.h"
#include "ruby/util.h"
-#include "debug.h"
+#include "vm_debug.h"
#include "eval_intern.h"
#include "vm_core.h"
#include "id.h"
@@ -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,10 @@ 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_MARK = FL_MARK,
- RUBY_FL_RESERVED = FL_RESERVED,
+ RUBY_FL_WB_PROTECTED = FL_WB_PROTECTED,
+ RUBY_FL_PROMOTED = FL_PROMOTED,
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 030d84f6f5..e73e383b26 100644
--- a/defs/default_gems
+++ b/defs/default_gems
@@ -1,7 +1,5 @@
-# gem versioning file [executable files under bin]
-rake lib/rake/version.rb [rake]
-rdoc lib/rdoc.rb [rdoc ri]
-minitest lib/minitest/unit.rb
-json ext/json/lib/json/version.rb
-io-console ext/io/console/io-console.gemspec
-bigdecimal ext/bigdecimal/bigdecimal.gemspec
+# gem base directory versioning file [executable files under bin]
+rake lib/rake lib/rake/version.rb [rake]
+rdoc lib/rdoc lib/rdoc.rb [rdoc ri]
+minitest lib/minitest lib/minitest/unit.rb
+json ext/json ext/json/lib/json/version.rb
diff --git a/defs/gmake.mk b/defs/gmake.mk
new file mode 100644
index 0000000000..0acb88ef57
--- /dev/null
+++ b/defs/gmake.mk
@@ -0,0 +1,29 @@
+# -*- makefile-gmake -*-
+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)
+
+ifneq ($(filter check% test,$(MAKECMDGOALS)),)
+yes-test-knownbug: $(TEST_DEPENDS) yes-btest-ruby
+yes-btest-ruby: $(TEST_DEPENDS) yes-test-sample
+yes-test-sample: $(TEST_DEPENDS)
+endif
+ifneq ($(filter check%,$(MAKECMDGOALS)) $(filter test-all,$(TEST_TARGETS)),)
+yes-test-all yes-test-ruby: $(filter-out %test-all %test-ruby check%,$(TEST_TARGETS))
+endif
+ifneq ($(filter check%,$(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: uninstall
+endif
diff --git a/defs/id.def b/defs/id.def
new file mode 100644
index 0000000000..53ed3775ad
--- /dev/null
+++ b/defs/id.def
@@ -0,0 +1,105 @@
+# -*- 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
+ succ
+ each
+ proc
+ lambda
+ send
+ __send__
+ __attached__
+ initialize
+ initialize_copy
+ initialize_clone
+ initialize_dup
+ _ UScore
+ "/*NULL*/" NULL
+ empty?
+ eql?
+ respond_to? Respond_to
+ respond_to_missing? Respond_to_missing
+ <IFUNC>
+ <CFUNC>
+ core#set_method_alias
+ core#set_variable_alias
+ core#undef_method
+ core#define_method
+ core#define_singleton_method
+ core#set_postexe
+ core#hash_from_ary
+ core#hash_merge_ary
+ core#hash_merge_ptr
+ core#hash_merge_kwd
+]
+
+class KeywordError < RuntimeError
+ def self.raise(mesg, line)
+ super(self, mesg, ["#{__FILE__}:#{line}", *caller])
+ end
+end
+
+predefined_ids = {}
+preserved_ids = []
+local_ids = []
+instance_ids = []
+global_ids = []
+const_ids = []
+class_ids = []
+names = {}
+predefined.split(/^/).each_with_index do |line, num|
+ next if /^#/ =~ line
+ line.sub!(/\s+#.*/, '')
+ name, token = line.split
+ next unless name
+ token ||= name
+ if /#/ =~ token
+ token = "_#{token.gsub(/\W+/, '_')}"
+ else
+ token = token.sub(/\?/, 'P').sub(/\A[a-z]/) {$&.upcase}
+ token.sub!(/\A\$/, "_G_")
+ token.sub!(/\A@@/, "_C_")
+ token.sub!(/\A@/, "_I_")
+ token.gsub!(/\W+/, "")
+ end
+ if prev = names[name]
+ KeywordError.raise("#{name} is already registered at line #{prev+firstline}", firstline+num)
+ end
+ if prev = predefined_ids[token]
+ KeywordError.raise("#{token} is already used for #{prev} at line #{names[prev]+firstline}", firstline+num)
+ end
+ names[name] = num
+ case name
+ when /\A[A-Z]\w*\z/; const_ids
+ when /\A(?!\d)\w+\z/; local_ids
+ when /\A\$(?:\d+|(?!\d)\w+)\z/; global_ids
+ when /\A@@(?!\d)\w+\z/; class_ids
+ when /\A@(?!\d)\w+\z/; instance_ids
+ when /\A((?!\d)\w+)=\z/
+ KeywordError.raise("use ID2ATTRSET(#{$1}) instead of ATTRSET #{name}", firstline+num)
+ else preserved_ids
+ end << token
+ predefined_ids[token] = name
+end
+{
+ "LOCAL" => local_ids,
+ "INSTANCE" => instance_ids,
+ "GLOBAL" => global_ids,
+ "CONST" => const_ids,
+ "CLASS" => class_ids,
+ :preserved => preserved_ids,
+ :predefined => predefined_ids,
+}
diff --git a/defs/opt_operand.def b/defs/opt_operand.def
index 5ca1d74028..ab7103a421 100644
--- a/defs/opt_operand.def
+++ b/defs/opt_operand.def
@@ -7,53 +7,16 @@
# wildcard: *
#
-__END__
-
-getlocal 2
-getlocal 3
-getlocal 4
-
-setlocal 2
-setlocal 3
-setlocal 4
-
-getdynamic *, 0
-getdynamic 1, 0
-getdynamic 2, 0
-getdynamic 3, 0
-getdynamic 4, 0
-
-setdynamic *, 0
-setdynamic 1, 0
-setdynamic 2, 0
-setdynamic 3, 0
-setdynamic 4, 0
+getlocal *, 0
+getlocal *, 1
+setlocal *, 0
+setlocal *, 1
putobject INT2FIX(0)
putobject INT2FIX(1)
-putobject Qtrue
-putobject Qfalse
-
-# CALL
-send *, *, Qfalse, 0, *
-send *, 0, Qfalse, 0, *
-send *, 1, Qfalse, 0, *
-send *, 2, Qfalse, 0, *
-send *, 3, Qfalse, 0, *
-
-# FCALL
-send *, *, Qfalse, 0x04, *
-send *, 0, Qfalse, 0x04, *
-send *, 1, Qfalse, 0x04, *
-send *, 2, Qfalse, 0x04, *
-send *, 3, Qfalse, 0x04, *
-
-# VCALL
-send *, 0, Qfalse, 0x0c, *
-
__END__
-
-
+putobject Qtrue
+putobject Qfalse
diff --git a/dir.c b/dir.c
index 4246b10c9d..e3a74c18b0 100644
--- a/dir.c
+++ b/dir.c
@@ -30,12 +30,7 @@
# define NAMLEN(dirent) strlen((dirent)->d_name)
#else
# define dirent direct
-# if !defined __NeXT__
-# define NAMLEN(dirent) (dirent)->d_namlen
-# else
-# /* On some versions of NextStep, d_namlen is always zero, so avoid it. */
-# define NAMLEN(dirent) strlen((dirent)->d_name)
-# endif
+# define NAMLEN(dirent) (dirent)->d_namlen
# if HAVE_SYS_NDIR_H
# include <sys/ndir.h>
# endif
@@ -49,6 +44,10 @@
# include "win32/dir.h"
# endif
#endif
+#if defined(__native_client__) && defined(NACL_NEWLIB)
+# include "nacl/dirent.h"
+# include "nacl/stat.h"
+#endif
#include <errno.h>
@@ -64,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
@@ -80,12 +75,46 @@ 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
#define FNM_DOTMATCH 0x04
#define FNM_CASEFOLD 0x08
+#define FNM_EXTGLOB 0x10
#if CASEFOLD_FILESYSTEM
#define FNM_SYSCASE FNM_CASEFOLD
#else
@@ -137,7 +166,7 @@ bracket(
p = t2 + (r2 = rb_enc_mbclen(t2, pend, enc));
if (ok) continue;
if ((r <= (send-s) && memcmp(t1, s, r) == 0) ||
- (r2 <= (send-s) && memcmp(t2, s, r) == 0)) {
+ (r2 <= (send-s) && memcmp(t2, s, r2) == 0)) {
ok = 1;
continue;
}
@@ -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)
@@ -397,7 +431,7 @@ dir_initialize(int argc, VALUE *argv, VALUE dir)
}
fsenc = rb_filesystem_encoding();
- argc = rb_scan_args(argc, argv, "1:", &dirname, &opt);
+ rb_scan_args(argc, argv, "1:", &dirname, &opt);
if (!NIL_P(opt)) {
VALUE enc = rb_hash_aref(opt, sym_enc);
@@ -434,7 +468,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 +505,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();
@@ -503,6 +540,7 @@ dir_inspect(VALUE dir)
/*
* 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 +557,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_with_enc((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
-#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)
+#if defined _WIN32
+# define READDIR(dir, enc) rb_w32_readdir((dir), (enc))
#else
-# define DEFINE_STRUCT_DIRENT struct dirent
-# define STRUCT_DIRENT(entry) (entry)
+# define READDIR(dir, enc) readdir((dir))
#endif
/*
@@ -582,20 +580,16 @@ 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 if (errno == 0) { /* end of stream */
- return Qnil;
- }
else {
- rb_sys_fail(0);
+ if (errno != 0) rb_sys_fail(0);
+ return Qnil; /* end of stream */
}
- return Qnil; /* not reached */
}
/*
@@ -623,13 +617,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,9 +698,10 @@ dir_seek(VALUE dir, VALUE pos)
#define dir_seek rb_f_notimplement
#endif
+#ifdef HAVE_SEEKDIR
/*
* call-seq:
- * dir.pos( integer ) -> integer
+ * dir.pos = integer -> integer
*
* Synonym for <code>Dir#seek</code>, but returns the position
* parameter.
@@ -712,6 +719,9 @@ dir_set_pos(VALUE dir, VALUE pos)
dir_seek(dir, pos);
return pos;
}
+#else
+#define dir_set_pos rb_f_notimplement
+#endif
/*
* call-seq:
@@ -729,9 +739,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;
@@ -879,7 +886,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());
@@ -1024,18 +1030,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)
{
@@ -1045,6 +1058,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)
@@ -1135,10 +1151,9 @@ find_dirsep(const char *p, const char *pend, int flags, rb_encoding *enc)
}
/* Remove escaping backslashes */
-static void
-remove_backslashes(char *p, rb_encoding *enc)
+static char *
+remove_backslashes(char *p, register const char *pend, rb_encoding *enc)
{
- register const char *pend = p + strlen(p);
char *t = p;
char *s = p;
@@ -1157,6 +1172,8 @@ remove_backslashes(char *p, rb_encoding *enc)
if (t != s)
memmove(t, s, p - s); /* move '\0' too */
+
+ return p;
}
/* Globing pattern */
@@ -1250,23 +1267,21 @@ glob_free_pattern(struct glob_pattern *list)
}
static char *
-join_path(const char *path, int dirsep, const char *name)
+join_path(const char *path, long len, int dirsep, const char *name, size_t namlen)
{
- long len = strlen(path);
- long len2 = strlen(name)+(dirsep?1:0)+1;
- char *buf = GLOB_ALLOC_N(char, len+len2);
+ char *buf = GLOB_ALLOC_N(char, len+namlen+(dirsep?1:0)+1);
if (!buf) return 0;
memcpy(buf, path, len);
if (dirsep) {
buf[len++] = '/';
}
- buf[len] = '\0';
- strlcat(buf+len, name, len2);
+ memcpy(buf+len, name, namlen);
+ buf[len+namlen] = '\0';
return buf;
}
-enum answer { YES, NO, UNKNOWN };
+enum answer {UNKNOWN = -1, NO, YES};
#ifndef S_ISDIR
# define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
@@ -1316,6 +1331,7 @@ glob_helper(
struct glob_pattern **cur, **new_beg, **new_end;
int plain = 0, magical = 0, recursive = 0, match_all = 0, match_dir = 0;
int escape = !(flags & FNM_NOESCAPE);
+ long pathlen;
for (cur = beg; cur < end; ++cur) {
struct glob_pattern *p = *cur;
@@ -1341,6 +1357,7 @@ glob_helper(
}
}
+ pathlen = strlen(path);
if (*path) {
if (match_all && exist == UNKNOWN) {
if (do_lstat(path, &st, flags) == 0) {
@@ -1367,7 +1384,7 @@ glob_helper(
if (status) return status;
}
if (match_dir && isdir == YES) {
- char *tmp = join_path(path, dirsep, "");
+ char *tmp = join_path(path, pathlen, dirsep, "", 0);
if (!tmp) return -1;
status = glob_call_func(func, tmp, arg, enc);
GLOB_FREE(tmp);
@@ -1380,20 +1397,50 @@ glob_helper(
if (magical || recursive) {
struct dirent *dp;
DIR *dirp;
- IF_HAVE_READDIR_R(DEFINE_STRUCT_DIRENT entry);
+ IF_HAVE_HFS(int hfs_p);
dirp = do_opendir(*path ? path : ".", flags, enc);
if (dirp == NULL) return 0;
+ IF_HAVE_HFS(hfs_p = is_hfs(dirp));
- while (READDIR(dirp, enc, &STRUCT_DIRENT(entry), dp)) {
- char *buf = join_path(path, dirsep, dp->d_name);
+ 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] == '.') {
+ ++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;
+ }
+ }
+ 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 && strcmp(dp->d_name, ".") != 0 && strcmp(dp->d_name, "..") != 0
- && fnmatch("*", rb_usascii_encoding(), dp->d_name, flags) == 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)
new_isdir = S_ISDIR(st.st_mode) ? YES : S_ISLNK(st.st_mode) ? UNKNOWN : NO;
@@ -1419,7 +1466,7 @@ glob_helper(
p = p->next; /* 0 times recursion */
}
if (p->type == PLAIN || p->type == MAGICAL) {
- if (fnmatch(p->str, enc, dp->d_name, flags) == 0)
+ if (fnmatch(p->str, enc, name, flags) == 0)
*new_end++ = p->next;
}
}
@@ -1452,7 +1499,8 @@ glob_helper(
break;
}
memcpy(name, (*cur)->str, len);
- if (escape) remove_backslashes(name, enc);
+ if (escape)
+ len = remove_backslashes(name, name+len-1, enc) - name;
new_beg = new_end = GLOB_ALLOC_N(struct glob_pattern *, end - beg);
if (!new_beg) {
@@ -1468,7 +1516,7 @@ glob_helper(
}
}
- buf = join_path(path, dirsep, name);
+ buf = join_path(path, pathlen, dirsep, name, len);
GLOB_FREE(name);
if (!buf) {
GLOB_FREE(new_beg);
@@ -1716,7 +1764,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;
@@ -1753,48 +1801,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>:: 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. Dir["c:\\foo*"] will not work
- * use Dir["c:/foo*"] 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"]
@@ -1835,7 +1891,7 @@ dir_s_glob(int argc, VALUE *argv, VALUE obj)
}
else {
volatile VALUE v = ary;
- ary = dir_globs(RARRAY_LEN(v), RARRAY_PTR(v), flags);
+ ary = dir_globs(RARRAY_LEN(v), RARRAY_CONST_PTR(v), flags);
}
if (rb_block_given_p()) {
@@ -1849,17 +1905,18 @@ static VALUE
dir_open_dir(int argc, VALUE *argv)
{
VALUE dir = rb_funcall2(rb_cDir, rb_intern("open"), argc, argv);
- struct dir_data *dirp;
- TypedData_Get_Struct(dir, struct dir_data, &dir_data_type, dirp);
+ rb_check_typeddata(dir, &dir_data_type);
return dir;
}
/*
* 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.
@@ -1889,12 +1946,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"]
*
*/
@@ -1907,43 +1968,81 @@ dir_entries(int argc, VALUE *argv, VALUE io)
return rb_ensure(rb_Array, dir, dir_close, dir);
}
+static int
+fnmatch_brace(const char *pattern, VALUE val, void *enc)
+{
+ struct brace_args *arg = (struct brace_args *)val;
+ VALUE path = arg->value;
+ rb_encoding *enc_pattern = enc;
+ rb_encoding *enc_path = rb_enc_get(path);
+
+ if (enc_pattern != enc_path) {
+ if (!rb_enc_asciicompat(enc_pattern))
+ return FNM_NOMATCH;
+ if (!rb_enc_asciicompat(enc_path))
+ return FNM_NOMATCH;
+ if (!rb_enc_str_asciionly_p(path)) {
+ int cr = ENC_CODERANGE_7BIT;
+ long len = strlen(pattern);
+ if (rb_str_coderange_scan_restartable(pattern, pattern + len,
+ enc_pattern, &cr) != len)
+ return FNM_NOMATCH;
+ if (cr != ENC_CODERANGE_7BIT)
+ return FNM_NOMATCH;
+ }
+ }
+ return (fnmatch(pattern, enc, RSTRING_PTR(path), arg->flags) == 0);
+}
+
/*
* call-seq:
* 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
@@ -1961,7 +2060,7 @@ dir_entries(int argc, VALUE *argv, VALUE io)
*
* File.fnmatch('\?', '?') #=> true # escaped wildcard becomes ordinary
* File.fnmatch('\a', 'a') #=> true # escaped ordinary remains ordinary
- * File.fnmatch('\a', '\a', File::FNM_NOESCAPE) #=> true # FNM_NOESACPE makes '\' ordinary
+ * File.fnmatch('\a', '\a', File::FNM_NOESCAPE) #=> true # FNM_NOESCAPE makes '\' ordinary
* File.fnmatch('[\?]', '?') #=> true # can escape inside bracket expression
*
* File.fnmatch('*', '.profile') #=> false # wildcard doesn't match leading
@@ -2003,9 +2102,22 @@ file_s_fnmatch(int argc, VALUE *argv, VALUE obj)
StringValue(pattern);
FilePathStringValue(path);
- if (fnmatch(RSTRING_PTR(pattern), rb_enc_get(pattern), RSTRING_PTR(path),
- flags) == 0)
- return Qtrue;
+ if (flags & FNM_EXTGLOB) {
+ struct brace_args args;
+
+ args.value = path;
+ args.flags = flags;
+ if (ruby_brace_expand(RSTRING_PTR(pattern), flags, fnmatch_brace,
+ (VALUE)&args, rb_enc_get(pattern)) > 0)
+ return Qtrue;
+ }
+ else {
+ rb_encoding *enc = rb_enc_compatible(pattern, path);
+ if (!enc) return Qfalse;
+ if (fnmatch(RSTRING_PTR(pattern), enc, RSTRING_PTR(path), flags) == 0)
+ return Qtrue;
+ }
+ RB_GC_GUARD(pattern);
return Qfalse;
}
@@ -2024,12 +2136,41 @@ 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.
+ *
+ */
+VALUE
+rb_file_directory_p()
+{
+}
+#endif
+
+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);
}
/*
@@ -2080,15 +2221,43 @@ 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); /* in file.c */
- rb_define_singleton_method(rb_cDir,"exists?", rb_file_directory_p, 1); /* in file.c */
+ rb_define_singleton_method(rb_cDir,"exist?", 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));
rb_file_const("FNM_SYSCASE", INT2FIX(FNM_SYSCASE));
}
diff --git a/dln.c b/dln.c
index 44410f75e4..e6b20d54e3 100644
--- a/dln.c
+++ b/dln.c
@@ -75,7 +75,7 @@ void *xrealloc();
char *getenv();
#endif
-#if defined(__APPLE__) && defined(__MACH__) /* Mac OS X */
+#ifdef __APPLE__
# if defined(HAVE_DLOPEN)
/* Mac OS X with dlopen (10.3 or later) */
# define MACOSX_DLOPEN
@@ -228,7 +228,7 @@ load_header(int fd, struct exec *hdrp, long disp)
#define RELOC_TARGET_SIZE(r) ((r)->r_length)
#endif
-#if defined(sun) && defined(sparc)
+#if defined(__sun) && defined(__sparc)
/* Sparc (Sun 4) macros */
# undef relocation_info
# define relocation_info reloc_info_sparc
@@ -530,7 +530,7 @@ reloc_undef(int no, struct undef *undef, struct reloc_arg *arg)
{
int datum;
char *address;
-#if defined(sun) && defined(sparc)
+#if defined(__sun) && defined(__sparc)
unsigned int mask = 0;
#endif
@@ -539,7 +539,7 @@ reloc_undef(int no, struct undef *undef, struct reloc_arg *arg)
datum = arg->value;
if (R_PCREL(&(undef->reloc))) datum -= undef->base;
-#if defined(sun) && defined(sparc)
+#if defined(__sun) && defined(__sparc)
datum += undef->reloc.r_addend;
datum >>= R_RIGHTSHIFT(&(undef->reloc));
mask = (1 << R_BITSIZE(&(undef->reloc))) - 1;
@@ -763,11 +763,11 @@ load_1(int fd, long disp, const char *need_init)
while (rel < rel_end) {
char *address = (char*)(rel->r_address + block);
long datum = 0;
-#if defined(sun) && defined(sparc)
+#if defined(__sun) && defined(__sparc)
unsigned int mask = 0;
#endif
- if(rel >= rel_beg)
+ if (rel >= rel_beg)
address += hdr.a_text;
if (rel->r_extern) { /* Look it up in symbol-table */
@@ -798,7 +798,7 @@ load_1(int fd, long disp, const char *need_init)
} /* end .. is static */
if (R_PCREL(rel)) datum -= block;
-#if defined(sun) && defined(sparc)
+#if defined(__sun) && defined(__sparc)
datum += rel->r_addend;
datum >>= R_RIGHTSHIFT(rel);
mask = (1 << R_BITSIZE(rel)) - 1;
@@ -1318,13 +1318,28 @@ dln_load(const char *file)
# define RTLD_GLOBAL 0
#endif
+#ifdef __native_client__
+ char* p, *orig;
+ if (file[0] == '.' && file[1] == '/') file+=2;
+ orig = strdup(file);
+ for (p = file; *p; ++p) {
+ if (*p == '/') *p = '_';
+ }
+#endif
/* Load file */
if ((handle = (void*)dlopen(file, RTLD_LAZY|RTLD_GLOBAL)) == NULL) {
+#ifdef __native_client__
+ free(orig);
+#endif
error = dln_strerror();
goto failed;
}
init_fct = (void(*)())(VALUE)dlsym(handle, buf);
+#ifdef __native_client__
+ strcpy(file, orig);
+ free(orig);
+#endif
#if defined __SYMBIAN32__
if (init_fct == NULL) {
init_fct = (void(*)())dlsym(handle, "1"); /* Some Symbian versions do not support symbol table in DLL, ordinal numbers only */
@@ -1385,7 +1400,7 @@ dln_load(const char *file)
}
#endif /* _AIX */
-#if defined(NeXT) || defined(MACOSX_DYLD)
+#if defined(MACOSX_DYLD)
#define DLN_DEFINED
/*----------------------------------------------------
By SHIROYAMA Takayuki Psi@fortune.nest.or.jp
@@ -1396,43 +1411,6 @@ dln_load(const char *file)
sunshine@sunshineco.com,
and... Miss ARAI Akino(^^;)
----------------------------------------------------*/
-#if defined(NeXT) && (NS_TARGET_MAJOR < 4)/* NeXTSTEP rld functions */
-
- {
- NXStream* s;
- unsigned long init_address;
- char *object_files[2] = {NULL, NULL};
-
- void (*init_fct)();
-
- object_files[0] = (char*)file;
-
- s = NXOpenFile(2,NX_WRITEONLY);
-
- /* Load object file, if return value ==0 , load failed*/
- if(rld_load(s, NULL, object_files, NULL) == 0) {
- NXFlush(s);
- NXClose(s);
- dln_loaderror("Failed to load %.200s", file);
- }
-
- /* lookup the initial function */
- if(rld_lookup(s, buf, &init_address) == 0) {
- NXFlush(s);
- NXClose(s);
- dln_loaderror("Failed to lookup Init function %.200s", file);
- }
-
- NXFlush(s);
- NXClose(s);
-
- /* Cannot call *init_address directory, so copy this value to
- function pointer */
- init_fct = (void(*)())init_address;
- (*init_fct)();
- return (void*)init_address;
- }
-#else/* OPENSTEP dyld functions */
{
int dyld_result;
NSObjectFileImage obj_file; /* handle, but not use it */
@@ -1451,7 +1429,7 @@ dln_load(const char *file)
NSLinkModule(obj_file, file, NSLINKMODULE_OPTION_BINDNOW);
/* lookup the initial function */
- if(!NSIsSymbolNameDefined(buf)) {
+ if (!NSIsSymbolNameDefined(buf)) {
dln_loaderror("Failed to lookup Init function %.200s",file);
}
init_fct = NSAddressOfSymbol(NSLookupAndBindSymbol(buf));
@@ -1459,7 +1437,6 @@ dln_load(const char *file)
return (void*)init_fct;
}
-#endif /* rld or dyld */
#endif
#if defined(__BEOS__) || defined(__HAIKU__)
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 7ce3a957ed..f41ceb051d 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"
@@ -45,14 +37,6 @@ char *dln_argv0;
# include <strings.h>
#endif
-#ifndef xmalloc
-void *xmalloc();
-void *xcalloc();
-void *xrealloc();
-#endif
-
-#define free(x) xfree(x)
-
#include <stdio.h>
#if defined(_WIN32)
#include "missing/file.h"
@@ -75,14 +59,16 @@ void *xrealloc();
# 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;
@@ -98,35 +84,23 @@ dln_find_exe_r(const char *fname, const char *path, char *buf, size_t size)
path = "/usr/local/bin:/usr/ucb:/usr/bin:/bin:.";
#endif
}
- 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/dmydln.c b/dmydln.c
index 2c8aacc06a..25872efc98 100644
--- a/dmydln.c
+++ b/dmydln.c
@@ -4,4 +4,6 @@ void*
dln_load(const char *file)
{
rb_loaderror("this executable file can't load extension libraries");
+
+ UNREACHABLE;
}
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/dmyext.c b/dmyext.c
index 4d273f7faf..34ea7a02f4 100644
--- a/dmyext.c
+++ b/dmyext.c
@@ -2,3 +2,8 @@ void
Init_ext(void)
{
}
+
+void
+Init_enc(void)
+{
+}
diff --git a/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/.document b/doc/.document
new file mode 100644
index 0000000000..b48c0387a7
--- /dev/null
+++ b/doc/.document
@@ -0,0 +1,4 @@
+*.rdoc
+ChangeLog*
+NEWS-*
+syntax
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 d440e76965..b8e3162511 100644
--- a/doc/ChangeLog-1.9.3
+++ b/doc/ChangeLog-1.9.3
@@ -1,3 +1,12154 @@
+Sun Jul 10 22:50:00 2011 Kenta Murata <mrkn@mrkn.jp>
+
+ * ext/bigdecimal/bigdecimal.c (rmpd_power_by_big_decimal): fix
+ precision treatment errors.
+
+ * test/bigdecimal/test_bigdecimal.rb: add tests for the above change.
+ fix precision treatment errors.
+
+ * ext/bigdecimal/bigdecimal.c (BigDecimal_power): precision argument
+ should be optional for its compatibility.
+
+Sun Jul 10 22:38:09 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * parse.y (var_ref): distinguish vcall from local variable
+ references. based on a patch by Michael Edgar michael.j.edgar
+ AT dartmouth.edu. Bug #5002
+
+Sun Jul 10 21:51:29 2011 Koichi Sasada <ko1@atdot.net>
+
+ * internal.h: add comments (cautions).
+
+Sun Jul 10 20:59:38 2011 Shota Fukumori <sorah@tubusu.net>
+
+ * lib/test/unit.rb: Add new class variable `@@testfile_prefix`.
+ This is for changing test name prefix. (For testing)
+
+ * test/testunit/tests_for_parallel/ptest_first.rb: Renamed from
+ test_first.rb
+
+ * test/testunit/tests_for_parallel/ptest_second.rb: Renamed from
+ test_second.rb
+
+ * test/testunit/tests_for_parallel/ptest_third.rb: Renamed from
+ test_third.rb
+
+ * test/testunit/tests_for_parallel/ptest_forth.rb: Renamed from
+ test_forth.rb
+
+ * test/testunit/tests_for_parallel/runner.rb: Remove misc.rb
+
+ * test/testunit/tests_for_parallel/ptest_first.rb: ditto.
+
+ * test/testunit/tests_for_parallel/ptest_second.rb: ditto.
+
+ * test/testunit/tests_for_parallel/ptest_third.rb: ditto.
+
+ * test/testunit/tests_for_parallel/ptest_forth.rb: ditto.
+
+ * test/testunit/tests_for_parallel/misc.rb: Removed because no longer
+ needed.
+
+ * test/testunit/test_parallel.rb: Fix assertions for above.
+
+Sun Jul 10 16:57:08 2011 Koichi Sasada <ko1@atdot.net>
+
+ * vm_insnhelper.c (vm_throw): check a class frame.
+ Fixes Bug #4648.
+ The patch is contributed by Kazuki Tsujimoto.
+
+ * bootstraptest/test_proc.rb: add tests for above.
+
+Sun Jul 10 17:28:01 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * thread_pthread.c (mutex_debug): use exit(EXIT_FAILURE) instead of
+ exit(1).
+ * thread_pthread.c (add_signal_thread_list): ditto.
+ * thread.c (rb_thread_call_with_gvl): ditto.
+ * util.c (Bug): ditto.
+
+Sun Jul 10 15:58:12 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * ext/json: Merge json gem 1.5.4+ (f7f78896607b6f6226cd).
+ [Bug #4700]
+
+Sun Jul 10 16:41:32 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * vm_core.h (typedef struct rb_vm_struct): create a new
+ 'inhibit_thread_creation' field.
+ * thread.c (rb_thread_terminate_all): set inhibit_thread_creation.
+ * thread.c (thread_s_new): don't permit to create new thread
+ if the VM is under destruction. Otherwise evil finalizer code
+ can make SEGV. [Bug #4992][ruby-core:37858]
+
+ * bootstraptest/test_objectspace.rb: new test for this fix.
+
+Sun Jul 10 16:06:16 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * signal.c (sigsegv): use abort() instead of exit() when nested
+ SEGV was happen. Because unnested SEGV use abort().
+ [Bug #5013][ruby-dev:44078]
+
+Sun Jul 10 15:30:00 2011 Kenta Murata <mrkn@mrkn.jp>
+
+ * load.c (rb_f_autoload): prevent to autoload for singleton
+ classes. fixes [Bug #4886] [ruby-dev:43816]
+
+ * bootstraptest/test_autoload.rb: add tests for the above change.
+
+Sun Jul 10 15:09:17 2011 Shota Fukumori <sorah@tubusu.net>
+
+ * lib/test/unit/assertions.rb: Import documentation patch by Justin
+ Collins. [ruby-core:37225] [Feature #4903]
+
+Sun Jul 10 14:57:36 2011 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * ext/date/date_core.c: canonicalizes nth and sf.
+
+Sun Jul 10 14:13:50 2011 Koichi Sasada <ko1@atdot.net>
+
+ * internal.h (rb_thread_call_with_gvl, rb_thread_call_without_gvl):
+ make them visible as experimental C APIs. fixes Feature #4328.
+
+Sun Jul 10 12:18:00 2011 Kenta Murata <mrkn@mrkn.jp>
+
+ * ext/bigdecimal/bigdecimal.c (BigDecimal_power): support non-integral
+ exponent. fixes [Bug #3271]
+
+ * ext/bigdecimal/bigdecimal.c (rmpd_power_by_big_decimal): ditto.
+
+ * ext/bigdecimal/bigdecimal.c (BigDecimal_power_op): add a function to
+ only use for "**" operator.
+
+ * test/bigdecimal/test_bigdecimal.rb: add a bunch of tests for the
+ above changes.
+
+ * ext/bigdecimal/bigdecimal.c (is_integer): add an utility function.
+
+ * ext/bigdecimal/bigdecimal.c (is_negative): ditto.
+
+ * ext/bigdecimal/bigdecimal.c (is_positive): ditto.
+
+ * ext/bigdecimal/bigdecimal.c (is_zero): ditto.
+
+ * ext/bigdecimal/bigdecimal.c (is_one): ditto.
+
+ * ext/bigdecimal/bigdecimal.c (is_even): ditto.
+
+Sun Jul 10 12:08:39 2011 Yusuke Endoh <mame@tsg.ne.jp>
+
+ * compile.c (when_vals): when a string literal is written on when
+ clause, skip string creation to make it faster. [ruby-dev:44068]
+ [Feature #5000]
+
+Sun Jul 10 11:35:29 2011 Yusuke Endoh <mame@tsg.ne.jp>
+
+ * parse.y (reduce_nodes_gen): NODE_RETURN in rescue body must not be
+ reduced when there is an else clause. This caused bizarre behavior
+ in [Bug #4473] [ruby-core:35629] [ruby-core:37884].
+
+Sun Jul 10 09:46:14 2011 Masaya Tarui <tarui@ruby-lnag.org>
+
+ * range.c (range_max): fix behavior with excluded end value.
+ [Bug #4591]
+
+Sun Jul 10 09:13:18 2011 Eric Hodel <drbrain@segment7.net>
+
+ * NEWS: Fix RubyGems version. [Ruby 1.9 - Bug #5004]
+
+Sat Jul 9 20:01:59 2011 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * internal.h: rb_rational_reciprocal is defined in rational.c.
+
+Sat Jul 9 19:48:31 2011 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * internal.h: added declarations.
+ * complex.c: followed the above change.
+
+Sat Jul 9 17:24:41 2011 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * NEWS: bigdecimal is not a builtin.
+
+Sat Jul 9 17:17:53 2011 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * ext/date/date_core.c: some improvements for performance.
+
+Sat Jul 9 16:56:01 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * atomic.h (ATOMIC_OR): _InterlockedOr is unavailable in VC6.
+
+ * numeric.c (ULLONG_MAX): fallback definition.
+
+Sat Jul 9 15:59:19 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * win32/win32.c (rb_w32_{read,write}): should be signed.
+ Bug #5001
+
+Sat Jul 9 14:02:20 2011 Takeyuki FUJIOKA <xibbar@ruby-lang.org>
+
+ * lib/cgi/core.rb: fix multipart form parsing bug. [Bug #3866]
+
+Sat Jul 9 11:41:03 2011 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
+
+ * lib/matrix.rb: Add Vector#normalize [ruby-dev:43829]
+
+Sat Jul 9 09:25:06 2011 Eric Hodel <drbrain@segment7.net>
+
+ * enumerator.c: Remove "enumeration sequenced by".
+ [Ruby 1.9 - Bug #4757]
+
+Sat Jul 9 09:14:56 2011 Eric Hodel <drbrain@segment7.net>
+
+ * io.c: Note that methods other than IO#gets may increase IO#lineno.
+ [Ruby 1.9 - Bug #4902]
+
+Sat Jul 9 08:39:39 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * common.mk (RUN_OPT): disable gems.
+
+Sat Jul 9 08:37:05 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * io.c (rb_io_close): close(2) on a fd which is being read by
+ another thread causes deadlock on Mac OS X 10.5
+
+Fri Jul 8 21:20:39 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * addr2line.c: use USE_ELF instead of __ELF__ because Solaris
+ doesn't define it. USE_ELF is already provided by configure.
+ patched by Naohisa Goto. [ruby-dev:44066] [Bug #4998]
+
+ * addr2line.h: ditto.
+
+ * vm_dump.c: ditto.
+
+Fri Jul 8 16:40:38 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/json/parser/parser.rl (convert_encoding): should not modify
+ the argument.
+
+ * ext/json/parser/parser.rl (convert_encoding): no needs to use
+ force_encoding.
+
+Fri Jul 8 15:53:31 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * error.c (rb_bug): get rid of segfault after all threads
+ disposed.
+
+Fri Jul 8 15:01:06 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * ext/openssl/ossl.h: include openssl/e_os2.h before checking the
+ definition of OPENSSL_SYS_WIN32.
+
+Fri Jul 8 14:40:39 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * win32/win32.c (wunlink): reverted a part of r32426. it was mistakenly
+ mixed.
+
+Fri Jul 8 14:29:47 2011 Narihiro Nakamura <authornari@gmail.com>
+
+ * configure.in: can't subtract void *.
+
+Fri Jul 8 14:33:26 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * win32/Makefile.sub (config.h): define GC_MARK_STACKFRAME_WORD.
+ fixed build problem of r32438. the value (30) is temporary value.
+ maybe it's enough by 20~24 according to my observation.
+
+Fri Jul 8 13:47:39 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * thread.c (rb_mutex_unlock_all): folded into
+ rb_threadptr_unlock_all_locking_mutexes.
+ * thread.c (rb_threadptr_unlock_all_locking_mutexes) ditto.
+
+Fri Jul 8 13:36:02 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * thread.c (thread_unlock_all_locking_mutexes): rename to
+ rb_threadptr_unlock_all_locking_mutexes and remove static.
+ * vm_core.h: add rb_threadptr_unlock_all_locking_mutexes declaration.
+ * thread.c (thread_start_func_2): adjust the above rename.
+
+ * eval.c (ruby_cleanup): call rb_threadptr_unlock_all_locking_mutexes
+ again after finalizer. [Bug #4988] [ruby-dev:44049]
+
+Fri Jul 8 13:06:09 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * cont.c (FIBER_MACHINE_STACK_ALLOCATION_SIZE): Fiber stack size
+ don't need to keep multiple number of sizeof(VALUE).
+
+Fri Jul 8 11:39:12 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * common.mk (sudo-precheck): true command is not standard on
+ Windows.
+
+Fri Jul 8 10:39:52 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * thread_pthread.c (gvl_destroy): fix cond_t leak.
+
+Fri Jul 8 09:17:59 2011 Eric Hodel <drbrain@segment7.net>
+
+ * gc.c: Improve documentation
+
+Thu Jul 7 23:35:31 2011 Narihiro Nakamura <authornari@gmail.com>
+
+ * gc.c: change water_mark value that may call
+ gc_mark(lev <= GC_LEVEL_MAX) in gc_mark().
+ In ruby_stack_check(), water_mark is a value that may call some
+ C function. Fixes Bug #3781
+
+ * configure.in: define GC_MARK_STACKFRAME_WORD that approximate
+ size of gc_mark() and gc_mark_children() stackframes.
+
+Thu Jul 7 17:55:05 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * test/testunit/test_parallel.rb (TestParallelWorker#teardown): wait
+ the child process even if the communication pipe is broken.
+
+Thu Jul 7 15:44:42 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * encoding.c (rb_enc_set_index, rb_enc_associate_index): should
+ check if frozen.
+
+ * parse.y (rb_intern3), ruby.c (process_options, ruby_script):
+ defer freezing after associating encodings.
+
+Thu Jul 7 15:16:51 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * numeric.c (rb_num2ull): use own switch sentence.
+ Current implementation can't convert 18446744073709551615.
+
+Thu Jul 7 06:56:15 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * cont.c (FIBER_STACK_FLAGS): workaround fix for r32420 on FreeBSD.
+
+Thu Jul 7 06:46:12 2011 Eric Hodel <drbrain@segment7.net>
+
+ * benchmark/driver.rb: Add difference column to report that averages
+ across all runs of a benchmark. [Ruby 1.9 - Feature #4982]
+
+Thu Jul 7 06:19:38 2011 Eric Hodel <drbrain@segment7.net>
+
+ * lib/rubygems.rb: Reduce requires to improve `make benchmark`.
+ [#4962]
+ * lib/rubygems/specification.rb: Delay initialization of rubygems
+ until require is called.
+
+Thu Jul 7 04:31:26 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * parse.y (arg): rescue_mod is in inverse order from other
+ modifiers. patched by michael.j.edgar AT dartmouth.edu at
+ [ruby-core:36248]. fixed #4716.
+
+Thu Jul 7 00:40:16 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * win32/win32.c (kill): check that the process exited or not before
+ terminating it. [Bug #4943]
+
+Wed Jul 6 23:13:19 2011 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * parse.y (opt_call_args): allow trailing comma after assoc
+ argument e.g. 'foo(bar:1,)'. fixed #3456
+
+Wed Jul 6 22:11:12 2011 Shota Fukumori <sorah@tubusu.net>
+
+ * test/cgi/test_cgi_header.rb(test_cgi_header_nph): Validate date in
+ "Date:" header
+
+Wed Jul 6 21:29:33 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * cont.c (fiber_machine_stack_alloc): cleanup pointer arithmetic.
+ "size/sizeof(VALUE)" is ugly and easy confusing.
+ * cont.c (fiber_initialize_machine_stack_context): ditto.
+
+Wed Jul 6 21:24:53 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * cont.c (fiber_machine_stack_alloc): fix mprotect misuse. A stack
+ guard page should have PROT_NONE.
+ * cont.c (fiber_initialize_machine_stack_context):
+ th->machine_stack_maxsize shouldn't be included guard pages size.
+ [Bug #4983][ruby-dev:44043]
+
+Wed Jul 6 21:23:38 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * cont.c (fiber_machine_stack_alloc): use MAP_STACK if it's provided.
+
+Wed Jul 6 21:22:16 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * cont.c (fiber_machine_stack_alloc): use MAP_FAILED instead of -1.
+
+Wed Jul 6 21:21:05 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * cont.c (fiber_machine_stack_alloc): remove unnecessary cast.
+
+Wed Jul 6 18:10:13 2011 Shota Fukumori <sorah@tubusu.net>
+
+ * test/cgi/test_cgi_header.rb(test_cgi_header_nph): Adding space after
+ comma.
+
+ * test/cgi/test_cgi_header.rb(test_cgi_header_nph): Remove variable
+ `now`. Suppress warning.
+
+Wed Jul 6 12:18:09 2011 Shota Fukumori <sorah@tubusu.net>
+
+ * test/cgi/test_cgi_header.rb(test_cgi_header_nph): Fix bug depends to
+ time. The test fails if time past 1 second in line 136-145
+
+Tue Jul 5 15:28:04 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * parse.y (parser_here_document): should dispatch heredoc_end
+ scanner event on an empty here document. fixed Bug#4543.
+
+Tue Jul 5 13:49:26 2011 Yusuke Endoh <mame@tsg.ne.jp>
+
+ * addr2line.c: fix r32407 to check HAVE_ALLOCA_H.
+
+Tue Jul 5 14:05:43 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * lib/webrick/httpauth/digestauth.rb (_authenticate):
+ Literal texts in HTTP ABNF is case-insensitive (RFC2616 2.1),
+ and a sample implementation in RFC2617 also ignores the case
+ of algorithms. So now this ignores those cases.
+ [ruby-dev:43965] [Feature #4936]
+
+ * lib/webrick/httpauth/digestauth.rb (initialize):
+ Because of above, opera_hack is useless and removed.
+
+Tue Jul 5 01:30:01 2011 Yusuke Endoh <mame@tsg.ne.jp>
+
+ * thread_pthread.c (native_sleep): cut the waiting time up to
+ 100,000,000 because Solaris cond_timedwait() return EINVAL if an
+ argument is greater than current_time + 100,000,000. This is
+ considered as a kind of spurious wakeup. The caller to native_sleep
+ should care about spurious wakeup.
+
+Tue Jul 5 01:24:26 2011 Yusuke Endoh <mame@tsg.ne.jp>
+
+ * cont.c: disable FIBER_USE_NATIVE on Solaris because resuming any
+ Fiber caused SEGV. I haven't follow up the issue deeply, but it
+ works when disabling the feature.
+
+Tue Jul 5 01:22:46 2011 Yusuke Endoh <mame@tsg.ne.jp>
+
+ * addr2line.c: include <alloca.h> to fix a build issue on Solaris.
+
+Tue Jul 5 00:49:05 2011 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
+
+ * ext/coverage/coverage.c: resurrect r32071 + add GC guard for
+ rb_coverages. [ruby-core:37352] [Bug #4927]
+ [ruby-core:36539] [Feature #4796]
+
+ * test/coverage/test_coverage.rb resurrect r32071.
+
+Mon Jul 4 22:24:46 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * thread_pthread.c (get_stack): For NetBSD/FreeBSD, use
+ pthread_attr_getstack() if possible. and, remove an assumption
+ of stack growing direction.
+
+Mon Jul 4 20:42:31 2011 Yusuke Endoh <mame@tsg.ne.jp>
+
+ * ext/coverage/coverage.c: revert r32071. The commit caused SEGV on
+ some minor nonfree OS. I have no means of debugging the bug. My
+ personal opinion is that such OS should be unsupported unless there
+ is an active maintainer. [ruby-core:37352]
+
+ * test/coverage/test_coverage.rb: ditto.
+
+Mon Jul 4 07:14:12 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * thread_pthread.c (get_stack): the return address of get_stack
+ must be the highest address of the current thread's stack.
+
+Mon Jul 4 06:37:22 2011 Koichi Sasada <ko1@atdot.net>
+
+ * include/ruby/intern.h, thread_pthread.c (rb_reserved_fd_p,
+ RB_RESERVED_FD_P): added. This C API is to limit to access
+ fds which are used by RubyVM internal. In this version of
+ CRuby, return 1 if fd is communication pipe.
+ If your application needs to close all file descriptors to
+ present resource leak, skip internal fds using this C API.
+ We also define a macro RB_RESERVED_FD_P(fd). So you can write
+ #ifndef RB_RESERVED_FD_P
+ #define RB_RESERVED_FD_P(fd) 0
+ #endif
+ for Ruby 1.9.2 or previous version to write compatible extensions.
+ See [ruby-core:37727]
+
+ * thread_win32.c (rb_reserved_fd_p): added (return 0 for any fds).
+
+ * io.c (rb_io_initialize): raise ArgumentError if given fd is reserved by Ruby.
+
+Sun Jul 3 23:43:56 2011 Yuki Sonoda (Yugui) <yugui@yugui.jp>
+
+ * ext/extmk.rb (extmake): suppresses outputs from extconf.rb.
+ (extmake) warns a failure in extconf.rb.
+
+Sun Jul 3 13:44:51 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * array.c (ary_reject_bang): should not remove elements which are
+ not yielded. [Bug #2545]
+
+Sun Jul 3 06:10:26 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * thread_pthread.c (get_stack): pthread_attr_getstack() doesn't
+ return stack start address, but stack base address. Thus,
+ we need to add stack size for getting stack start address.
+ And, we don't have to decrease guard size twice.
+ * thread_pthread.c (thread_start_func_1): don't use inaccurate
+ stack start guess if native_thread_init_stack() can be used.
+ [Bug #1813] [ruby-core:24540]
+
+Sun Jul 3 04:50:08 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * thread_pthread.c (get_stack): add to a care of guard page on Mac
+ OS X. [Bug #1813] [ruby-core:24540]
+ * signal.c (ruby_signal): SIGBUS use alternative stack too.
+ * signal.c (sigbus): On Mac, thread stack overflow makes SIGBUS
+ instead of SIGSEGV. thus, added stackoverflow check.
+ * signal.c (default_handler): get rid of compilation warning.
+ * signal.c (Init_signal): ditto.
+
+Sat Jul 02 08:59:20 2011 Martin Bosslet <Martin.Bosslet@googlemail.com>
+
+ * test/openssl/test_ocsp.rb
+ * test/openssl/test_x509_cert.rb: Perform SHA-256 tests only if
+ supported by the available OpenSSL version. Versions < 0.9.8 don't
+ support it. [ruby-core:37724]
+
+Sat Jul 2 07:17:45 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * array.c (rb_ary_reject_bang, rb_ary_delete_if): rejected
+ elements should be removed. fixed [Bug #2545]
+
+Sat Jul 2 01:57:00 2011 Kenta Murata <mrkn@mrkn.jp>
+
+ * NEWS: remove a description of Kernel#respond_to? because it has
+ been reverted at revision 28564.
+
+Sat Jul 2 00:58:00 2011 Kenta Murata <mrkn@mrkn.jp>
+
+ * NEWS: describe a change of multiplication of Bignum.
+
+Fri Jul 1 18:52:31 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * benchmark/bm_app_erb.rb: increase loop count. too short
+ measurement time makes less accuracy.
+ * benchmark/bm_app_factorial.rb: ditto.
+ * benchmark/bm_app_mandelbrot.rb: ditto.
+ * benchmark/bm_app_strconcat.rb: ditto.
+
+ * benchmark/bm_io_file_create.rb: ditto.
+ * benchmark/bm_io_file_read.rb: ditto.
+ * benchmark/bm_io_file_write.rb: ditto.
+
+ * benchmark/bm_so_concatenate.rb: ditto.
+ * benchmark/bm_so_lists.rb: ditto.
+ * benchmark/bm_so_matrix.rb: ditto.
+ * benchmark/bm_so_random.rb: ditto.
+ * benchmark/bm_so_sieve.rb: ditto.
+
+ * benchmark/bm_vm_thread_mutex1.rb: ditto.
+ * benchmark/bm_vm_thread_mutex2.rb: ditto.
+ * benchmark/bm_vm_thread_mutex3.rb: ditto.
+
+ * benchmark/bm_vm1_block.rb: cleanup.
+ * benchmark/bm_vm1_const.rb: cleanup.
+ * benchmark/bm_vm1_ensure.rb: cleanup.
+ * benchmark/bm_vm1_ivar.rb: cleanup.
+ * benchmark/bm_vm1_length.rb: cleanup.
+ * benchmark/bm_vm1_neq.rb: cleanup.
+ * benchmark/bm_vm1_not.rb: cleanup.
+ * benchmark/bm_vm1_rescue.rb: cleanup.
+ * benchmark/bm_vm1_simplereturn.rb: cleanup.
+ * benchmark/bm_vm1_swap.rb: cleanup.
+
+ * benchmark/bm_vm2_array.rb: cleanup.
+ * benchmark/bm_vm2_case.rb: cleanup.
+ * benchmark/bm_vm2_defined_method.rb: cleanup.
+ * benchmark/bm_vm2_eval.rb: cleanup.
+ * benchmark/bm_vm2_method.rb: cleanup.
+ * benchmark/bm_vm2_mutex.rb: cleanup.
+ * benchmark/bm_vm2_poly_method.rb: cleanup.
+ * benchmark/bm_vm2_poly_method_ov.rb: cleanup.
+ * benchmark/bm_vm2_proc.rb: cleanup.
+ * benchmark/bm_vm2_regexp.rb: cleanup.
+ * benchmark/bm_vm2_send.rb: cleanup.
+ * benchmark/bm_vm2_super.rb: cleanup.
+ * benchmark/bm_vm2_unif1.rb: cleanup.
+ * benchmark/bm_vm2_zsuper.rb: cleanup.
+
+ * benchmark/bm_vm_thread_alive_check1.rb: cleanup.
+
+Fri Jul 1 15:23:00 2011 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
+
+ * lib/matrix: Add LUP decomposition
+
+Fri Jul 1 15:21:14 2011 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
+
+ * lib/matrix.rb: Allow non integer exponents for Matrix#**
+
+Fri Jul 1 15:13:25 2011 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
+
+ * lib/matrix: Add Eigenvalue Decomposition
+
+Fri Jul 1 15:10:22 2011 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
+
+ * lib/matrix: Add Matrix#round
+
+Fri Jul 1 11:41:12 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * string.c (tr_trans): free heap ptr when the str is not embedded.
+ patched by Eric Wong. [Bug #4956] [ruby-core:37708]
+
+Fri Jul 1 11:07:43 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * thread.c (do_select): fix memory leak.
+ Patch by Eric Wong. Thank you! [Bug #4953] [ruby-core:37702]
+
+Fri Jul 1 08:21:28 2011 Koichi Sasada <ko1@atdot.net>
+
+ * vm_insnhelper.c (vm_getivar): check vm state version
+ to invalidate inline cache (ivar index).
+ fixes Bug #4926.
+
+ * vm_insnhelper.c (vm_setivar): ditto.
+
+Fri Jul 1 08:03:15 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * error.c, thread_pthread.c (WRITE_CONST): suppress warnings
+ `ignoring return value'.
+
+Fri Jul 1 06:41:36 2011 Koichi Sasada <ko1@atdot.net>
+
+ * thread.c (rb_threadptr_check_signal): only wake up main thread.
+
+ * thread.c (rb_threadptr_execute_interrupts_common): check signal
+ delivery if it is main thread.
+ fixes [ruby-dev:44005] [Ruby 1.9 - Bug #4950]
+
+ * bootstraptest/test_fork.rb: add a test for above.
+
+ * signal.c (rb_get_next_signal): skip if signal_buff is empty.
+ (check signal_buff.size first)
+
+ * vm_core.h: remove unused variable rb_thread_t::exec_signal.
+
+ * thread.c (rb_thread_check_trap_pending): check
+ rb_signal_buff_size() because rb_thread_t::exec_signal
+ is no longer available.
+
+Fri Jul 1 03:28:25 2011 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * class.c (Init_class_hierarchy): should name BasicObject
+ explicitly.
+
+ * variable.c (rb_const_defined_0): should not check for
+ superclasses as const_get.
+
+Fri Jul 1 03:24:03 2011 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * ext/date/date_core.c: mathn is still alive (should die soon).
+
+Thu Jun 30 23:50:00 2011 Kenta Murata <mrkn@mrkn.jp>
+
+ * misc/ruby-mode.el (ruby-indent-beg-re): Fix broken regular
+ expression. Fixes #4546
+
+Thu Jun 30 23:43:30 2011 Martin Bosslet <Martin.Bosslet@googlemail.com>
+
+ * ext/openssl/ossl.c/.h: Added ossl_x509_name_sk2ary.
+ * ext/openssl/ossl.c: Replaced ossl_x509_ary2k by generic macro to
+ simplify future conversions.
+ * ext/openssl/ossl_ssl.c: Implement SSLSocket#client_ca.
+ * test/openssl/test_ssl.rb: Add test for SSLSocket#client_ca.
+ Thanks to Ippei Obayashi for providing the patch!
+ [ Ruby 1.9 - Feature #4481 ] [ruby-core:35461]
+
+Thu Jun 30 22:38:58 2011 Koichi Sasada <ko1@atdot.net>
+
+ * benchmark/bm_vm2_defined_method.rb: added to measure performance of
+ bmethod (method defined by define_method()).
+
+Thu Jun 30 22:17:04 2011 Koichi Sasada <ko1@atdot.net>
+
+ * vm_insnhelper.c (vm_call_bmethod): fix to hook call/return event
+ for methods defined by define_method(). fixes Bug #4613.
+
+ * thread.c (call_trace_proc): Fix to skip if class is not given (0).
+ Note that ID and Class object are passed for call/return event
+ if the called method was defined by define_method().
+ If you are author of tracer/profiler/debugger, this may be an
+ important change. You should check passed class as zero or
+ non-zero instead of checking the event type.
+
+ * test/ruby/test_settracefunc.rb: add a test for above.
+
+Thu Jun 30 21:18:35 2011 Yutaka Kanemoto <kanemoto@ruby-lang.org>
+
+ * configure.in: Add warnflags for XL/C on AIX during configure
+ to avoid [Bug #3971]. See [ruby-core:32859]
+
+Thu Jun 30 21:16:04 2011 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * ext/date/date_core.c (m_ajd): refers a constant.
+
+Thu Jun 30 20:54:25 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/io/console/io-console.gemspec: spin-off gem for 1.9.2.
+
+Thu Jun 30 20:36:23 2011 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * ext/date/date_core.c: trivial changes.
+
+Thu Jun 30 20:12:36 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * test/ruby/test_module.rb: tests for [Bug #3422] and [Bug #3423].
+
+Thu Jun 30 20:03:39 2011 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * ext/date/date_core.c: modified doc.
+
+Thu Jun 30 19:09:19 2011 Koichi Sasada <ko1@atdot.net>
+
+ * thread_pthread.c (thread_timer): ignore unknown errno.
+ (we observed that select(2) was canceled by errno=514 on
+ boron == Linux/Xen environment)
+
+Thu Jun 30 17:33:25 2011 Koichi Sasada <ko1@atdot.net>
+
+ * ext/objspace/objspace.c (ObjectSpace.count_tdata_objects):
+ Fix rdoc. Fixes Bug #3892.
+
+ * ext/objspace/objspace.c (ObjectSpace.count_tdata_objects):
+ Change key type if the klass of a object is zero (internal object).
+ Read rdoc for details.
+
+ * internal.h: export rb_objspace_data_type_name().
+
+Thu Jun 30 17:25:08 2011 Koichi Sasada <ko1@atdot.net>
+
+ * thread_pthread.c (ping_signal_thread_list, thread_timer):
+ fix to keep polling state if there are any ping-tasks.
+
+Thu Jun 30 12:25:34 2011 Koichi Sasada <ko1@atdot.net>
+
+ * thread_pthread.c (rb_thread_create_timer_thread): allocate
+ machine stack for the timer thread at least 12KB. FreeBSD 8.2
+ AMD64 causes machine stack overflow (SIGSEGV) only with
+ PTHREAD_STACK_MIN (maybe defined as 2KB).
+
+Thu Jun 30 09:36:37 2011 Eric Hodel <drbrain@segment7.net>
+
+ * lib/weakref.rb: Attach documentation to WeakRef and add missing
+ documentation
+
+Thu Jun 30 09:30:14 2011 Eric Hodel <drbrain@segment7.net>
+
+ * lib/yaml.rb: Document toplevel YAML and YAML::ENGINE to describe
+ Psych vs Syck engines.
+
+Thu Jun 30 09:21:52 2011 Eric Hodel <drbrain@segment7.net>
+
+ * lib/cmath.rb: Hide handle_no_method_error from RDoc.
+ * error.c: Document or hide undocumented error classes.
+
+Thu Jun 30 07:49:04 2011 Eric Hodel <drbrain@segment7.net>
+
+ * hash.c: Document ENV
+
+Thu Jun 30 06:37:43 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ruby.c (ruby_init_loadpath_safe): ensure RUBYLIB_PREFIX stored
+ before RUBYLIB, even if MANGLED_PATH is enabled. fixed #1679.
+ MANGLED_PATH is disabled by the default and will be removed
+ completely in the future.
+
+Thu Jun 30 06:32:21 2011 Eric Hodel <drbrain@segment7.net>
+
+ * lib/drb/drb.rb: Hide deprecated toplevel DRb constants.
+
+Thu Jun 30 06:17:02 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * lib/cmath.rb (CMath.log): second argument: b can be nil.
+
+Thu Jun 30 06:23:28 2011 Eric Hodel <drbrain@segment7.net>
+
+ * thread.c (ruby_thread_s_pass): Fix typo.
+
+Thu Jun 30 06:16:53 2011 Eric Hodel <drbrain@segment7.net>
+
+ * lib/rdoc: Update to RDoc 3.8 which contains fixes for documentation
+ in trunk.
+
+Thu Jun 30 02:53:26 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * thread.c (rb_threadptr_execute_interrupts_common): remove
+ meaningless native_thread_yield(). It never close a race.
+
+Thu Jun 30 02:41:47 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * thread.c (rb_thread_schedule_limits): minor optimization.
+ eliminate machine context saving when running time is enough small.
+
+Thu Jun 30 02:28:11 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * thread.c (rb_thread_schedule_rec): move interrupt_flag check to
+ rb_thread_schedule().
+ And also rename to rb_thread_schedule_limits() and remove
+ sched_depth argument. It's no longer called recursive.
+ * thread.c (rb_thread_schedule): add to check interrupt_flag as
+ above explained.
+
+ * thread.c (rb_threadptr_execute_interrupts_rec): rename to
+ rb_threadptr_execute_interrupts_common() and remove sched_depth
+ argument. It's no longer called recursive.
+
+ * thread.c (rb_thread_sleep): adapt the renaming.
+ * thread.c (rb_threadptr_execute_interrupts): ditto.
+ * thread.c (rb_thread_execute_interrupts): ditto.
+
+Thu Jun 30 01:31:33 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * thread.c (thread_s_pass): change RDoc description and remove
+ a sample code. The actual implementation never behave as explained by
+ an example. It's a documentation bug.
+
+Thu Jun 30 00:54:33 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * thread.c (rb_thread_stop): change RDoc sample code. The old
+ example is buggy and may cause deadlock. The patch is
+ suggested by Heesob Park <phasis@gmail.com>. Thank you!
+ [Bug #3606][ruby-core:31454]
+
+Thu Jun 30 00:49:53 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * thread.c (rb_thread_wakeup): change RDoc sample code. The old
+ example is buggy and may not display anything by a race.
+ The patch is suggested by Heesob Park <phasis@gmail.com>.
+ Thank you! [Bug #3606][ruby-core:31454]
+
+Thu Jun 30 00:43:33 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * thread.c (rb_thread_run): change RDoc. The old example is buggy
+ and may cause deadlock. The patch is suggested by Heesob Park
+ <phasis@gmail.com>. Thank you! [Bug #3606][ruby-core:31454]
+
+Thu Jun 30 00:30:15 2011 Keiju Ishitsuka <keiju@ishitsuka.com>
+
+ * lib/cmath.rb: make same exception for Math. fix [Bug #3137].
+
+Thu Jun 30 00:03:20 2011 Keiju Ishitsuka <keiju@ishitsuka.com>
+
+ * lib/irb/completion.rb: complement correctly string literal. fix
+ [Bug #1145].
+
+Wed Jun 29 23:42:51 2011 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * ext/date/date_core.c: avoided using timev.
+ * ext/date/date_strftime.c: ditto.
+ * ext/date/date_tmx.h: ditto.
+
+Wed Jun 29 23:17:57 2011 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * ext/openssl/ossl.h (OPENSSL_SYS_WIN32): support for mingw(msys).
+
+Wed Jun 29 23:09:14 2011 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * ext/tk/extconf.rb (intptr_t, uintptr_t): support for the latest ActiveTcl with mingw.
+
+Wed Jun 29 22:49:10 2011 Keiju Ishitsuka <keiju@ishitsuka.com>
+
+ * lib/irb/cmd/help.rb: support RDoc 3.7. fix [Bug #3760].
+
+Wed Jun 29 22:04:14 2011 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
+
+ * lib/tracer.rb: Tracer.on only if required by -r command-line option.
+ and consider --disable-gems option.
+ * test/test_tracer.rb: add tests for it.
+
+Wed Jun 29 13:55:36 2011 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * variable.c (rb_const_get_0): should not look for superclasses if
+ the second optional argument is given for #const_get().
+ fix [Bug #3422] [Bug #3423]
+
+Wed Jun 29 12:07:27 2011 Eric Hodel <drbrain@segment7.net>
+
+ * math.c: Attach documentation for Math.
+ * object.c: Document NIL, TRUE, FALSE.
+ * io.c: Improve grammar in ARGF comment. Document STDIN/OUT/ERR.
+ Document ARGF global constant.
+ * lib/rake: Hide deprecated toplevel constants from RDoc (import from
+ rake trunk).
+ * lib/thwait.rb: Document ThWait.
+ * lib/mathn.rb: Hide Math redefinition from RDoc
+ * lib/sync.rb: Add a basic comment for Sync_m, Synchronizer_m, Sync,
+ Synchronizer.
+ * parse.y: Document SCRIPT_LINES__.
+ * hash.c: Document ENV class and global constant.
+ * vm.c: Document TOPLEVEL_BINDING.
+ * version.c: Document RUBY_* constants.
+ * ruby.c: Document DATA and ARGV.
+
+Wed Jun 29 10:13:12 2011 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
+
+ * lib/matrix.rb: Matrix.zero can build rectangular matrices.
+ Vector#r should be called #magnitude
+
+Wed Jun 29 10:11:08 2011 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
+
+ * lib/matrix.rb: Add Matrix#diagonal?, hermitian?, normal?,
+ orthogonal?
+ permutation?, symmetric?, {lower|upper}triangular?, unitary?, zero?
+
+Wed Jun 29 10:09:35 2011 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
+
+ * lib/matrix.rb: Specialize Matrix#find_index to return [row, col]
+ and accept the same optional argument as #each
+
+Wed Jun 29 10:07:32 2011 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
+
+ * lib/matrix.rb: Matrix#each{_with_index} can iterate over a subset
+ of the Matrix
+
+Wed Jun 29 06:21:02 2011 Koichi Sasada <ko1@atdot.net>
+
+ * thread_pthread.c (native_stop_timer_thread): skip to close
+ communication pipe to avoid timing bug (process termination timing).
+ The communication pipe will closed by OS.
+
+Wed Jun 29 06:09:54 2011 Koichi Sasada <ko1@atdot.net>
+
+ * error.c (rb_async_bug_errno): async-safe bug report function.
+ In timer thread, signal handler should use it.
+ The patch is contributed by Eric Wong <normalperson@yhbt.net>.
+ Refs: [ruby-core:37644] and [ruby-core:37647]
+
+ * thread_pthread.c: use rb_async_bug_errno().
+ And replace all fprintf() to write().
+
+ * internal.h (rb_async_bug_errno): add decl. of above func.
+
+Tue Jun 28 23:46:08 2011 Keiju Ishitsuka <keiju@ishitsuka.com>
+
+ * lib/tracer.rb: count only non-internal libraries in stack trace,
+ ignoring custom_require.
+
+Tue Jun 28 21:44:58 2011 Keiju Ishitsuka <keiju@ishitsuka.com>
+
+ * lib/irb/ruby-lex.rb: recognize '\char' in ruby statement.
+
+Tue Jun 28 20:39:29 2011 Hiroshi Nakamura <nahi@ruby-lang.org>
+
+ * lib/debug.rb (var_list): Command 'var *' did not work on 1.9(!).
+ global_variables, local_variables, and instance_variables returns
+ Symbols from 1.9 and need to stringify before evaling it.
+ See #4931.
+
+Tue Jun 28 19:23:01 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * signal.c: Now, USE_TRAP_SIGMASK depend on HAVE_PTHREAD_SIGMASK.
+ The code have already depended on pthread_sigmask since r27464.
+
+Tue Jun 28 15:09:21 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * lib/benchmark.rb: merge eregon/benchmark.
+ https://github.com/eregon/ruby/tree/benchmark
+ patched by Benoit Daloze. [ruby-core:37593] [Bug #4940]
+
+ * lib/benchmark (Benchmark#bmbm): bmbm should be consistent with bm
+ for the return value.
+
+ * test/benchmark: remove preemptive test instead of skipping
+ I removed the preemptive test I wrote for Feature #4197.
+ I'll add it back when the implementation will be able to satisfy it.
+
+ * lib/benchmark (Benchmark#bmbm): remove useless explicit call,
+ #format is an alias of #to_s test/benchmark: add a test for
+ format of long time.
+
+ * lib/benchmark: fix label width: always add 1 to ensure there is a
+ space delimiter even with times over 100s
+ When I asked for Feature #4197, I wanted to make delimiting spaces
+ consistent for #bm and #bmbm.
+ But with times over 100s, the output contains no space between the
+ label and the first time (user).
+ Now both ensure there is always a space, even if that means 3 spaces
+ with times under 10s (because it is formatted as %10.6f)
+
+ * test/benchmark: let labels be a constant
+ lib/benchmark (Benchmark#realtime): avoid creating an unused Proc
+ lib/benchmark (Benchmark#benchmark): use ensure clause to restore
+ STDOUT.sync, as in #bmbm
+
+Tue Jun 28 13:41:51 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * thread_win32.c (native_stop_timer_thread): fixed commit miss of
+ r32244. grep sources before changing the signature of a function.
+
+Tue Jun 28 11:49:14 2011 Koichi Sasada <ko1@atdot.net>
+
+ * thread_pthread.c (consume_communication_pipe):
+ Make "buff" as static. (Maybe) "buff" can be shared between
+ any caller (any threads) because no one use the read values.
+ "buff" (1024 byte) on stack may cause stack overflow on
+ several environment (we found a crash on FreeBSD).
+ And remove const value "buff_size", and define CCP_READ_BUFF_SIZE
+ macro.
+
+Tue Jun 28 11:45:30 2011 Eric Hodel <drbrain@segment7.net>
+
+ * lib/rake: Update rake to fix some bugs and hide deprecated features
+ from RDoc.
+ * lib/rake/version.rb: Bump version to 0.9.2.1 to distinguish it from
+ the released version.
+ * NEWS: ditto
+
+Tue Jun 28 11:17:28 2011 Eric Hodel <drbrain@segment7.net>
+
+ * lib/rdoc: Update to RDoc 3.7 (final)
+ * NEWS: ditto
+
+Tue Jun 28 10:18:42 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * process.c (rb_daemon): fix wrong #endif position.
+
+Tue Jun 28 07:50:32 2011 Eric Hodel <drbrain@segment7.net>
+
+ * object.c (Init_Object): Teach RDoc what Init_class_hierarchy does to
+ hook up ri for BasicObject, Object, Module and Class.
+
+Tue Jun 28 05:03:32 2011 Hiroshi Nakamura <nahi@ruby-lang.org>
+
+ * thread.c (rb_thread_local_aref): RDoc fix. Thread#[] example
+ had a race. See #4480.
+
+Tue Jun 28 01:22:00 2011 Kenta Murata <mrkn@mrkn.jp>
+
+ * ext/bigdecimal/bigdecimal.c (BigMath_s_log): move BigMath.log from
+ bigdecimal/math.rb.
+
+ * ext/bigdecimal/lib/bigdecimal/math.rb: ditto.
+
+ * test/bigdecimal/test_bigdecimal.rb: move test for BigMath.log from
+ test/bigdecimal/test_bigmath.rb.
+
+ * test/bigdecimal/test_bigmath.rb: ditto.
+
+Tue Jun 28 01:19:52 2011 Keiju Ishitsuka <keiju@ishitsuka.com>
+
+ * lib/irb/ruby-lex.rb: fix [Bug #4232].
+
+Tue Jun 28 00:14:13 2011 Masatoshi SEKI <m_seki@mva.biglobe.ne.jp>
+
+ * lib/drb/drb.rb: fix [Bug #4409]. add DRbServer#here?.
+
+ * test/drb/test_drb.rb: ditto.
+
+ * test/drb/drbtest.rb: ditto.
+
+ * test/drb/ut_eq.rb: ditto.
+
+Tue Jun 28 00:08:43 2011 Keiju Ishitsuka <keiju@ishitsuka.com>
+
+ * lib/irb/workspace.rb: fix BUG#4793.
+
+Mon Jun 27 22:06:12 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * thread_pthread.c (consume_communication_pipe): don't use C99
+ style variable length array.
+
+Mon Jun 27 22:04:27 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * thread_pthread.c (consume_communication_pipe): change return
+ type to void. caller doesn't use it.
+
+Mon Jun 27 21:29:50 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * thread_pthread.h (rb_global_vm_lock_struct): add volatile to
+ gvl->waiting. now thread_timer() access it w/o lock.
+
+Mon Jun 27 21:16:11 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * thread_pthread.c: s/__gvl_acquire/gvl_acquire_common/ and
+ s/__gvl_release/gvl_release_common/.
+
+Mon Jun 27 11:41:47 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * thread_pthread.c (rb_thread_create_timer_thread):
+ the type of return value of write(2) is ssize_t.
+
+Mon Jun 27 09:57:02 2011 Koichi Sasada <ko1@atdot.net>
+
+ * thread_pthread.c (rb_thread_create_timer_thread):
+ Fixes missing initialization of oflags.
+
+Mon Jun 27 09:07:42 2011 Koichi Sasada <ko1@atdot.net>
+
+ * thread_pthread.c: Stop polling in the timer thread when there are
+ no waiting thread. If there are 2 or more runnable threads,
+ the timer thread does polling. Avoid polling makes power save
+ for several computers (0.2W per a Ruby process, when I measured).
+ If outside-event such as signal or Thread#kill was occurred
+ when the timer thread does not do polling, then wake-up
+ the timer thread using communication-pipe (the timer thread
+ waits this communication-pipe with select(2)).
+ The discussion about this modification can be found from the post
+ [ruby-core:33456] and other related posts.
+ Note that Eric Wong and KOSAKI Motohiro give us the huge
+ contributions for this modification. Thanks.
+
+ * thread_pthread.c (rb_thread_wakeup_timer_thread): add a function.
+ This function wakes up the timer thread using communication-pipe.
+
+ * thread.c (rb_thread_stop_timer_thread): add a parameter which
+ specify closing communication-pipe or not.
+
+ * thread.c (rb_thread_terminate_all): do not stop timer thread here
+ (ruby_cleanup() terminate timer thread).
+
+ * signal.c: wake up timer thread using
+ rb_thread_wakeup_timer_thread() from signal handler.
+
+ * eval.c (ruby_cleanup): use rb_thread_stop_timer_thread(1).
+
+ * process.c: use rb_thread_stop_timer_thread(0)
+ (reuse communication-pipe).
+
+ * thread_win32.c (rb_thread_wakeup_timer_thread): add a dummy
+ function.
+
+ * vm_core.h: add and fix decl. of functions.
+
+Mon Jun 27 08:01:19 2011 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * ext/date/date_parse.c: should use ALLOCA_N.
+
+Mon Jun 27 01:34:18 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * test/etc/test_etc.rb (TestEtc#test_get{pw,gr}nam): skip entries
+ start with + sign, which means NIS. these are returned in the
+ case that passwd and group entries in /etc/nsswitch.conf are set
+ to use "nis" explicitly on Debian. fixed #3683
+
+Mon Jun 27 00:44:53 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * parse.y (rb_parser_end_seen_p): fix documentation about return
+ value. patched by Sho Hashimoto. [Bug #4511]
+
+Mon Jun 27 00:40:47 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * hash.c (rb_hash_reject): add documentation that Hash#reject
+ without block returns enumerator.
+ patched by Michael Edgar [Bug #4847] [ruby-core:36800]
+
+Sun Jun 26 23:49:21 2011 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * test/date/test_switch_hitter.rb: added a test.
+
+ Sun Jun 26 22:21:23 2011 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * ext/date/date_core.c: refactoring.
+
+Sun Jun 26 18:03:30 2011 URABE Shyouhei <shyouhei@ruby-lang.org>
+
+ * parse.y: comma at the end of line is no longer allowed.
+ A patch from Yukihiro Matsumoto <matz AT ruby-lang.org>.
+ (fixed #3456).
+
+Sun Jun 26 13:35:35 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * vm_dump.c (rb_vm_bugreport): change CrashReporter suggestion messages
+ on Mac. It should be placed after "-- C level backtrace" line.
+ Suggested by Endoh-san.
+
+ <before>
+ -- See Crash Report log file under ~/Library/Logs/CrashReporter or ---------
+ -- /Library/Logs/CrashReporter, for the more detail of ---------------------
+ -- C level backtrace information -------------------------------------------
+
+ <after>
+ -- C level backtrace information -------------------------------------------
+
+ See Crash Report log file under ~/Library/Logs/CrashReporter or
+ /Library/Logs/CrashReporter, for the more detail of.
+
+Sun Jun 26 10:08:28 2011 Martin Bosslet <Martin.Bosslet@googlemail.com>
+
+ * ext/openssl/extconf.rb
+ * ext/openssl/ossl_missing.h/.c: add ASN1_put_eoc if missing.
+
+ * ext/openssl/ossl_asn1.c: introduce ossl_asn1_object_size and
+ ossl_asn1_put_object to wrap functionality depending on OpenSSL
+ version in use.
+ Fixes [ Ruby 1.9 - Bug #4916 ] reported by Hiroshi Nakamura.
+ [ruby-core:37286]
+
+Sun Jun 26 01:00:15 2011 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * ext/date/date_core.c (date_strftime_internal): removed meaningless braces.
+ * ext/date/date_core.c (gengo): the value should be int.
+
+Sat Jun 25 23:45:30 2011 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
+
+ * vm_insnhelper.c (vm_search_superclass): avoid control frame
+ stack overrun. currently super() in Proc created in a method
+ defined by Module#define_method raise NoMethodError. [Bug #4881]
+ * test/ruby/test_method.rb t_super_in_proc_from_define_method):
+ add test for it.
+
+Sat Jun 25 23:23:14 2011 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
+
+ * thread.c (sleep_forever): now Kernel#sleep don't wakeup by
+ signal handler execution. [Bug #4072]
+
+Sat Jun 25 23:14:47 2011 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
+
+ * thread.c (rb_threadptr_check_signal): remove unnecessary th->status
+ backup. fix race condition which may results unexpected main thread's
+ status transition. see #4072
+
+Fri Jun 24 19:57:30 2011 Hiroshi Nakamura <nahi@ruby-lang.org>
+
+ * lib/webrick/httprequest.rb (setup_forwarded_info): Parsing request
+ header failed when the request is from 2 or more Apache reverse
+ proxies. It's said that all X-Forwarded-* headers will contain more
+ than one (comma-separated) value if the original request already
+ contained one of these headers. Since we could use these values as
+ Host header, we choose the initial(first) value. See #4922.
+
+ * test/webrick/test_httprequest.rb (test_forwarded): Test it.
+
+Fri Jun 24 17:06:33 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * process.c (proc_daemon): should not start timer thread
+ twice. fixed Bug#4920.
+
+Fri Jun 24 15:54:14 2011 Hiroshi Nakamura <nahi@ruby-lang.org>
+
+ * ext/openssl/ossl_ssl.c (ossl_ssl_shutdown): Try to shutdown SSL
+ connection more gracefully. Call SSL_shutdown() max 4 times until it
+ returns 1 (success). Bi-directional SSL close has several states but
+ SSL_shutdown() kicks only 1 transition per call. Max 4 is from
+ mod_ssl.c of Apache httpd that says 'max 2x pending + 2x data = 4'.
+ See #4237.
+
+Fri Jun 24 07:24:37 2011 Eric Hodel <drbrain@segment7.net>
+
+ * lib/rake/version.rb: Fixed VERSION to work with tool/rbinstall.rb
+ * bin/rake: Import bin/rake from 0.9.2
+ * tool/rbinstall.rb (install): Rake::VERSION is now in
+ lib/rake/version.rb. Fixes `make install`
+
+Fri Jun 24 07:11:37 2011 Eric Hodel <drbrain@segment7.net>
+
+ * lib/rake: Import Rake 0.9.2
+
+Fri Jun 24 00:44:15 2011 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * ext/date/date_core.c (c_valid_{julian,gregorian}_p): fixed the range of month.
+
+Fri Jun 24 00:14:23 2011 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * ext/date/date_core.c: trivial changes on text.
+
+Thu Jun 23 22:46:57 2011 Hiroshi Nakamura <nahi@ruby-lang.org>
+
+ * ext/openssl/ossl_x509name.c: Add X509::Name#hash_old as a wrapper
+ for X509_NAME_hash_old in OpenSSL 1.0.0. See #4805
+
+ * test/openssl/test_x509name.rb (test_hash): Make test pass with
+ OpenSSL 1.0.0.
+
+ * NEWS: Add it.
+
+Thu Jun 23 19:30:53 2011 Hiroshi Nakamura <nahi@ruby-lang.org>
+
+ * ext/openssl/ossl_ssl_session.c (ossl_ssl_session_set_time): Check
+ argument type with NUM2LONG if the arg is not a Time object.
+ See #4919.
+
+ * ext/openssl/ossl_ssl_session.c (ossl_ssl_session_set_timeout): Check
+ type with NUM2LONG. Time as an arg is not allowed. See #4919.
+
+ * test/openssl/test_ssl_session.rb (test_session_time,
+ test_session_timeout): Test it.
+
+Wed Jun 23 13:30:30 2011 Shota Fukumori <sorah@tubusu.net>
+
+ * signal.c(ruby_atomic_exchange): Fix definition style.
+
+Wed Jun 22 22:34:05 2011 Hiroshi Nakamura <nahi@ruby-lang.org>
+
+ * ext/openssl/ossl_ssl.c (ossl_sslctx_session_new_cb): Return 0 to
+ OpenSSL from the callback for SSL_CTX_sess_set_get_cb().
+ Returning 0 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
+ internally.
+ This potential issue was pointed by Ippei Obayashi. See #4416.
+
+ * test/openssl/test_ssl_session.rb (test_ctx_server_session_cb): Test
+ it.
+
+Wed Jun 22 22:21:17 2011 Martin Bosslet <Martin.Bosslet@googlemail.com>
+
+ * ext/openssl/ossl_ssl_session.c: Respect T_BIGNUM time values. Patch by
+ Tomoyuki Chikanaga.
+ [ Ruby 1.9 - Bug #4919 ] [ruby-dev:43869]
+
+Wed Jun 22 21:29:25 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * ext/socket/depend (SOCK_HEADERS): use $(top_srcdir) instead of
+ $(topdir). sorry!
+
+Wed Jun 22 19:47:03 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * cont.c (cont_capture): add volatile.
+ On clang -O, it is needed to avoid the optimization.
+ With this and llvm/clang's recent fix, clang 3.0 can
+ build ruby-trunk with -O option.
+
+ * cont.c (cont_capture): use for-loop.
+
+ * array.c (rb_ary_each): add volatile and use it.
+
+ * vm_insnhelper.c (vm_call_cfunc): ditto.
+
+Wed Jun 22 18:20:46 2011 Hiroshi Nakamura <nahi@ruby-lang.org>
+
+ * ext/openssl/ossl_ssl.c (ossl_sslctx_session_remove_cb):
+ OpenSSL::SSL::SSLContext#session_remove_cb was broken. It wrongly
+ tried to call the session_*new*_cb callback.
+
+ * test/openssl/test_ssl_session.rb (class OpenSSL): Test it.
+
+Wed Jun 22 17:37:49 2011 Martin Bosslet <Martin.Bosslet@googlemail.com>
+
+ * ext/openssl/ossl.h: Introduced OSSL_BIO_reset macro for PEM/DER
+ fallback scenarios.
+
+ * ext/openssl/ossl_pkey_dsa.c
+ * ext/openssl/ossl_x509req.c
+ * ext/openssl/ossl_pkey_rsa.c
+ * ext/openssl/ossl_pkey_ec.c
+ * ext/openssl/ossl_ssl_session.c
+ * ext/openssl/ossl_x509crl.c
+ * ext/openssl/ossl_pkey.c
+ * ext/openssl/ossl_pkey_dh.c
+ * ext/openssl/ossl_x509cert.c
+ * ext/openssl/ossl_pkcs7.c: Use OSSL_BIO_reset.
+
+ * ext/openssl/ossl_ssl.c
+ * ext/openssl/ossl_cipher.c
+ * ext/openssl/ossl_pkey_ec.c
+ * ext/openssl/ossl_pkcs12.c
+ * ext/openssl/ossl_ssl_session.c: Replace rb_raise occurrences by
+ ossl_raise. This automatically flushes OpenSSL's error queue.
+
+ * ext/openssl/ossl_pkcs7.c: Raise error if DER fallback for parsing
+ fails.
+
+ * test/openssl/test_pkey_ec.rb
+ * test/openssl/test_pkey_dsa.rb
+ * test/openssl/test_pkey_rsa.rb: Add assertions that OpenSSL.errors is
+ empty.
+
+ * test/openssl/test_pkey_rsa.rb: Remove initial OpenSSL.errors call in
+ test_new.
+ [ Ruby 1.9 - Bug #4885 ] [ruby-core:37134]
+
+Wed Jun 22 15:01:24 2011 Martin Bosslet <Martin.Bosslet@googlemail.com>
+
+ * ext/openssl/ossl_ssl.c: Use SSL_MODE_RELEASE_BUFFERS if available.
+ Thanks, Eric Wong, for providing the patch.
+ [ Ruby 1.9 - Feature #4672 ] [ruby-core:36127]
+
+Wed Jun 22 14:47:53 2011 Martin Bosslet <Martin.Bosslet@googlemail.com>
+
+ * test/openssl/test_buffering.rb
+ * test/openssl/test_pkcs12.rb: Inherit from Test::Unit::TestCase
+ instead of MiniTest::Unit::TestCase. [ruby-core:37275]
+
+Wed Jun 22 12:41:03 2011 Hiroshi Nakamura <nahi@ruby-lang.org>
+
+ * ext/openssl/ossl_ssl_session.c (ossl_ssl_session_to_der):
+ OpenSSL::SSL::Session#to_der was broken. Fix buffer handling.
+
+ * test/openssl/test_ssl_session.rb (test_session): Test it.
+
+Wed Jun 22 12:38:52 2011 Hiroshi Nakamura <nahi@ruby-lang.org>
+
+ * test/openssl/test_ssl_session.rb: Split out SSL::Session related
+ tests from test_ssl.rb
+
+Wed Jun 22 03:20:52 2011 Aaron Patterson <aaron@tenderlovemaking.com>
+
+ * ext/psych/lib/psych/visitors/to_ruby.rb: Fix cyclic references of
+ objects. Thanks to CvX for reporting the bug and a test case.
+ * test/psych/test_object.rb: test for cyclic object references.
+
+Wed Jun 22 02:39:54 2011 Hiroshi Nakamura <nahi@ruby-lang.org>
+
+ * lib/net/http.rb (Net::HTTP.post_form): Do not ignore query part of
+ the given URI to post. See #655.
+
+ * test/net/http/test_http.rb, test/net/http/utils.rb: Test it.
+
+Wed Jun 22 01:28:13 2011 Hiroshi Nakamura <nahi@ruby-lang.org>
+
+ * test/openssl/test_x509store.rb (test_set_errors): Redhat is
+ distributing a patched version of OpenSSL that allows multiple CRL
+ for a key (multi-crl.patch.) Make test pass on such env. See #4122,
+ #4554.
+
+Tue Jun 21 21:50:37 2011 Hiroshi Nakamura <nahi@ruby-lang.org>
+
+ * lib/webrick/httpresponse.rb (HTTPResponse#setup_header): Close
+ HTTP/1.1 connection when returning an IO object as response body
+ without setting HTTPResponse#chunked to true. See #855 no.1.
+
+ * test/webrick/test_httpserver.rb: Test it.
+
+Tue Jun 21 21:27:34 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * internal.h: move rb_thread_io_blocking_region() declaration
+ from intern.h to internal.h. It's still experimental API and
+ need more discussion. [ruby-dev:43698]
+ * include/ruby/intern.h: ditto.
+
+ * ext/socket/rubysocket.h: include internal.h.
+ * ext/socket/depend: add internal.h dependency.
+ * ext/socket/extconf.rb: add $INCFLAGS to topdir.
+
+Tue Jun 21 20:38:47 2011 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * ext/date/date_core.c (datetime_s_*): canonicalize 24 o'clock.
+
+Tue Jun 21 19:46:23 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * test/ruby/test_thread.rb (TestThread#test_priority): enable
+ this test again. Current GVL respect thread priority rather
+ than past.
+
+Tue Jun 21 13:25:35 2011 TAKAO Kouji <kouji@takao7.net>
+
+ * ext/readline/readline.c (readline_getc): applied a patch in
+ #3827 by by Akio Tajima <artonx AT yahoo.co.jp>. (see #3827)
+
+Tue Jun 21 13:16:31 2011 TAKAO Kouji <kouji@takao7.net>
+
+ * ext/readline/extconf.rb: fixed bug, specify --disable-libedit
+ then disable libedit, does not specify then check readline and
+ libedit if failed checking readline. (fixes #3375)
+
+Mon Jun 20 22:52:07 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * process.c (before_exec): use sig_do_nothing instead of SIG_DFL
+ for avoiding a race.
+ * process.c (sig_do_nothing): new function.
+
+Mon Jun 20 21:31:03 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * thread_pthread.c (thread_timer): rename timeout_10ms to
+ time_quantum. it's no longer 10ms.
+
+Mon Jun 20 18:46:02 2011 Hiroshi Nakamura <nahi@ruby-lang.org>
+
+ * ext/openssl/ossl_cipher.c, ext/openssl/lib/openssl/cipher.rb:
+ Documentation fix by Ippei Obayashi. See #4419.
+
+Mon Jun 20 15:41:33 2011 Hiroshi Nakamura <nahi@ruby-lang.org>
+
+ * lib/webrick/cookie.rb (WEBrick::Cookie.parse): Revert r31228.
+ r31228 was for allowing the 'Cookie:' header which did not have no
+ SP after ';' for separating cookie-pairs but RFC6265 requires single
+ SP after ';' there. We allow multiple SPs here for compatibility
+ with older WEBrick version.
+
+ * test/webrick/test_cookie.rb: Test it.
+
+Sun Jun 19 13:31:26 2011 Shota Fukumori <sorah@tubusu.net>
+
+ * NEWS: Introduce --hide-skip on test/unit.
+
+Sun Jun 19 10:05:16 2011 Shota Fukumori <sorah@tubusu.net>
+
+ * lib/test/unit/parallel.rb: Override Test::Unit::TestCase#on_parallel_worker?
+ only when $0 == __FILE__.
+
+ * lib/test/unit/parallel.rb: Run Test::Unit::Worker.run only when
+ $0 == __FILE__.
+
+Sat Jun 18 23:59:24 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * io.c (fill_cbuf): finish reading at EOF, and the readconv has
+ been cleared by another thread while io_fillbuf() is waiting at
+ select(). a patch in [ruby-core:37197] by Hiroshi Shirosaki
+ <h.shirosaki AT gmail.com>. fixed #3840
+
+Sat Jun 18 21:36:29 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * thread_pthread.c: remove GVL_DEBUG
+
+Sat Jun 18 21:32:02 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * vm.c, vm_core.h (rb_vm_stack_to_heap): remove const.
+ It makes compilations warnings.
+
+Sat Jun 18 18:54:15 2011 Koichi Sasada <ko1@atdot.net>
+
+ * vm.c, vm_core.h (rb_vm_stack_to_heap): fix "const" place.
+
+Sat Jun 18 17:23:38 2011 Tanaka Akira <akr@fsij.org>
+
+ * eval.c, hash.c, load.c, proc.c, range.c, thread.c, time.c: don't
+ declare internal functions.
+
+ * internal.h, vm_core.h: declare internal functions.
+
+ * array.c: include internal.h.
+
+ * common.mk: update dependency for array.o.
+
+Sat Jun 18 13:39:33 2011 Tanaka Akira <akr@fsij.org>
+
+ * internal.h: declarations declared in include/ruby/*.h removed.
+
+Sat Jun 18 12:42:17 2011 Tanaka Akira <akr@fsij.org>
+
+ * method.h, internal.h iseq.h: declare internal functions.
+
+ * compile.c, eval.c, iseq.c, object.c, parse.y, proc.c, process.c,
+ thread.c, vm.c, vm_eval.c, vm_insnhelper.c, vm_method.c: don't
+ declare internal functions.
+
+ Note that rb_method_entry_eq() is defined in vm_method.c but
+ there was a declaration in proc.c with different const-ness.
+ Now it is declared in method.h with same const-ness to the
+ definition.
+
+ * object.c (rb_mod_module_exec): don't declare functions declared in
+ include/ruby/intern.h.
+
+Sat Jun 18 12:05:08 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * include/ruby/backward/classext.h: for evil gems. fixed #4803
+
+Sat Jun 18 11:12:13 2011 Tanaka Akira <akr@fsij.org>
+
+ * common.mk: update dependencies.
+
+Sat Jun 18 11:09:03 2011 Tanaka Akira <akr@fsij.org>
+
+ * io.c: suppress warnings.
+
+Sat Jun 18 10:22:39 2011 Tanaka Akira <akr@fsij.org>
+
+ * internal.h: declare more internal functions.
+
+ * iseq.h (rb_method_get_iseq): declared.
+
+ * compile.c, eval.c, eval_error.c, iseq.c, parse.y, proc.c, range.c,
+ ruby.c, time.c, util.c, vm.c: don't declare internal functions.
+
+ * eval.c, parse.y, thread_pthread.c: non-existing function declarations
+ removed.
+
+Sat Jun 18 08:12:54 2011 Tanaka Akira <akr@fsij.org>
+
+ * common.mk: dependencies updated.
+
+ * tool/update-deps: new file to assist update dependencies in
+ common.mk.
+
+Sat Jun 18 07:27:27 2011 Tanaka Akira <akr@fsij.org>
+
+ * internal.h: declare internal functions here.
+
+ * node.h: declare NODE dependent internal functions here.
+
+ * iseq.h: declare rb_iseq_t dependent internal functions here.
+
+ * vm_core.h: declare rb_thread_t dependent internal functions here.
+
+ * bignum.c, class.c, compile.c, complex.c, cont.c, dir.c, encoding.c,
+ enumerator.c, error.c, eval.c, file.c, gc.c, hash.c, inits.c, io.c,
+ iseq.c, load.c, marshal.c, math.c, numeric.c, object.c, parse.y,
+ proc.c, process.c, range.c, rational.c, re.c, ruby.c, string.c,
+ thread.c, time.c, transcode.c, variable.c, vm.c,
+ tool/compile_prelude.rb: don't declare internal functions declared
+ in above headers. include above headers if required.
+
+ Note that rb_thread_mark() was declared as
+ void rb_thread_mark(rb_thread_t *th) in cont.c but defined as
+ void rb_thread_mark(void *ptr) in vm.c. Now it is declared as
+ the later in internal.h.
+
+Sat Jun 18 02:36:00 2011 Kenta Murata <mrkn@mrkn.jp>
+
+ * ext/bigdecimal/bigdecimal.c (VpNewRbClass): fix type of the 2nd
+ argument.
+
+ * ext/bigdecimal/bigdecimal.h: ditto.
+
+Sat Jun 18 02:30:00 2011 Kenta Murata <mrkn@mrkn.jp>
+
+ * ext/bigdecimal/bigdecimal.c (BigMath_s_exp): move BigMath.exp from
+ bigdecimal/math.rb.
+
+ * ext/bigdecimal/lib/bigdecimal/math.rb: ditto.
+
+ * test/bigdecimal/test_bigdecimal.rb: move test for BigMath.exp from
+ test/bigdecimal/test_bigmath.rb.
+
+ * test/bigdecimal/test_bigmath.rb: ditto.
+
+Sat Jun 18 00:20:54 2011 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * ext/date/date_core.c: do not define wnum[01].
+
+Fri Jun 17 18:57:36 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * compile.c (iseq_compile_each): fix return value of obj[a,*b]=c.
+
+Fri Jun 17 13:09:45 2011 Eric Hodel <drbrain@segment7.net>
+
+ * ext/curses/curses.c: Clean up documentation.
+
+Fri Jun 17 09:25:14 2011 Eric Hodel <drbrain@segment7.net>
+
+ * ext/curses/curses.c: Document curses constants. Patch by Vincent
+ Batts. [Ruby 1.9 - Bug #4880]
+
+Fri Jun 17 09:11:05 2011 Eric Hodel <drbrain@segment7.net>
+
+ * object.c: Document Module#method_added and #method_removed.
+ Patch by Bryce Kerley. [Ruby 1.9 - Feature #4867]
+
+Fri Jun 17 08:50:16 2011 Eric Hodel <drbrain@segment7.net>
+
+ * io.c: Improve documentation of IO and File open and new.
+ Patch by Roger Pack. [Ruby 1.9 - Bug #4790]
+
+Fri Jun 17 07:53:50 2011 Eric Hodel <drbrain@segment7.net>
+
+ * lib/csv.rb: Document #raw_encoding. Patch by David Czarnecki.
+ [Ruby 1.9 - Bug #4874]
+
+Fri Jun 17 07:46:50 2011 Eric Hodel <drbrain@segment7.net>
+
+ * lib/benchmark.rb: Document Benchmark::Tms#memberwise. Patch by
+ David Czarnecki. [Ruby 1.9 - Bug #4873]
+
+Fri Jun 17 07:38:31 2011 Eric Hodel <drbrain@segment7.net>
+
+ * lib/prettyprint.rb: Improve documentation. Patch by Ysiad
+ Ferreiras. [#4834]
+
+Fri Jun 17 07:23:03 2011 Eric Hodel <drbrain@segment7.net>
+
+ * array.c (rb_ary_drop): Improve documentation. Patch by Caley Woods.
+ [Ruby 1.9 - Bug #4858]
+
+Fri Jun 17 06:11:31 2011 Eric Hodel <drbrain@segment7.net>
+
+ * lib/webrick/log.rb: Improve documentation of BasicLog and Log.
+ Patch by Olivier Brisse. [Ruby 1.9 - Bug #4833]
+ * lib/webrick/httpstatus.rb: Improve documentation of
+ WEBrick::HTTPStatus. Patch by Olivier Brisse.
+ [Ruby 1.9 - Bug #4833]
+
+Fri Jun 17 04:48:22 2011 Koichi Sasada <ko1@atdot.net>
+
+ * thread_pthread.c, thread_pthread.h: remove unused variables.
+ (native_thread_data_t::gvl_cond, native_thread_data_t::gvl_next)
+
+Thu Jun 16 14:32:31 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * time.c (rb_time_new): prevent overflow by "* 1000".
+
+Fri Jun 17 03:07:36 2011 Koichi Sasada <ko1@atdot.net>
+
+ * benchmark/bm_vm4_thread_create_join.rb,
+ benchmark/bm_vm4_thread_mutex[1-3].rb: renamed to
+ bm_thread_* (fix last rename).
+
+Fri Jun 17 02:26:47 2011 Koichi Sasada <ko1@atdot.net>
+
+ * thread_pthread.c (native_thread_create): fix debug message.
+ (add last newline)
+
+Thu Jun 16 23:40:49 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * thread.c (rb_thread_schedule_rec): fix {UN,}LIKELY macro misuse.
+ * gc.c (rb_newobj): ditto.
+ * vm_insnhelper.c (vm_method_search): ditto.
+
+Thu Jun 16 20:06:15 2011 Shota Fukumori <sorah@tubusu.net>
+
+ * test/testunit/test_parallel.rb: Fix Regexp for test.
+
+ * test/testunit/tests_for_parallel/test_third.rb: Use
+ Test::Unit::TestCase#on_parallel_worker? for detecting worker.
+
+ * lib/test/unit/testcase.rb(Test::Unit::TestCase#on_parallel_worker?):
+ New Method Test::Unit::TestCase#on_parallel_worker? returns true
+ when a testcase is running on parallel worker.
+ * lib/test/unit/parallel.rb(Test::Unit::TestCase#on_parallel_worker?):
+ ditto.
+
+Thu Jun 16 19:27:12 2011 Hiroshi Nakamura <nahi@ruby-lang.org>
+
+ * test/test_securerandom.rb: Add testcase. This testcase does NOT aim
+ to test cryptographically strongness and randomness. It includes
+ the test for PID recycle issue of OpenSSL described in #4579 but
+ it's disabled by default.
+
+Thu Jun 16 17:55:07 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * test/ruby/test_io.rb (TestIO#test_copy_stream_socket): fix
+ test hanging up issue. Patch by CHIKANAGA Tomoyuki.
+
+Thu Jun 16 15:17:39 2011 Eric Hodel <drbrain@segment7.net>
+
+ * variable.c (const_missing): Add simple example of const_missing.
+ Patch by Anuj Dutta. [Ruby 1.9 - Bug #4794]
+
+Thu Jun 16 15:09:29 2011 Eric Hodel <drbrain@segment7.net>
+
+ * lib/monitor.rb: Improve documentation. Patch by Sandor Szucs.
+ [Ruby 1.9 - Bug #4823]
+
+Thu Jun 16 14:54:09 2011 Eric Hodel <drbrain@segment7.net>
+
+ * lib/webrick/utils.rb: Document WEBrick::Utils. Patch by Olivier
+ Brisse. [Ruby 1.9 - Bug #4819]
+
+Thu Jun 16 14:26:46 2011 Eric Hodel <drbrain@segment7.net>
+
+ * lib/webrick/httpservlet/erbhandler.rb: Allow the ERB document to
+ alter the content-type of the response. [Ruby 1.9 - Bug #4685]
+
+Thu Jun 16 14:15:47 2011 Eric Hodel <drbrain@segment7.net>
+
+ * lib/timeout.rb: Clarify timeout duration types. Patch by Alf Mikula.
+ [Ruby 1.9 - Bug #4791]
+ * lib/net/http.rb: ditto
+
+Thu Jun 16 13:25:25 2011 Eric Hodel <drbrain@segment7.net>
+
+ * lib/rdoc*: Import RDoc 3.7 release candidate
+
+Thu Jun 16 11:35:09 2011 Shugo Maeda <shugo@ruby-lang.org>
+
+ * lib/net/imap.rb (search_response): parses SEARCH responses from
+ the Yahoo IMAP server correctly. patched by Mark Nadig. [Bug #4509]
+
+Thu Jun 16 09:12:38 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * fix for build on solaris 10.
+
+Thu Jun 16 09:08:39 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * test/io/console/test_io_console.rb (TestIO_Console#test_sync):
+ fix for daemon process.
+
+Thu Jun 16 07:58:01 2011 Shota Fukumori <sorah@tubusu.net>
+
+ * test/testunit/test_parallel.rb(test_ignore_tzero): Test for r32109.
+
+ * test/testunit/tests_for_parallel/test_third.rb: Use another way to
+ detect that test is running on worker. This fixes sometimes
+ TestParallel failing.
+
+Thu Jun 16 07:20:06 2011 Shota Fukumori <sorah@tubusu.net>
+
+ * lib/test/unit.rb(Test::Unit::Runner#_run_parallel): Ignore -j0
+ because it makes blocking forever by IO.select.
+
+Thu Jun 16 03:08:11 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * test/testunit/test_parallel.rb (TestParallel::TestParallelWorker#
+ setup): now can run on Windows, probably.
+
+ * test/testunit/test_parallel.rb (TestParallel::TestParallel#setup):
+ ditto.
+
+Thu Jun 16 03:00:26 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * thread.c (do_select): Windows: no need to poll if select(2) is
+ cancelable.
+
+ * thread_win32.c (native_fd_select): new function to make select(2)
+ cancelable.
+
+ * thread_win32.c (rb_w32_check_interrupt): new function for checking
+ interrupt.
+
+ * win32/win32.c (rb_w32_select_with_thread): new function. cancelable
+ select(2).
+
+ * win32/win32.c (rb_w32_select): use above function internally.
+
+Wed Jun 15 23:30:45 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * gc.c: fix a regression by r31690 on AIX because AIX malloc
+ return NULL if it's passed 0. But some caller don't expect it.
+ patch by Yutaka Kanemoto. [ruby-dev:43779]
+ (vm_malloc_prepare): return calculated size.
+ (vm_xmalloc): use above result.
+ (vm_xcalloc): ditto.
+
+Wed Jun 15 23:11:35 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * thread.c: remove BLOCKING_REGION_CORE() macro. It's no longer used
+ since r32022.
+
+Wed Jun 15 21:00:47 2011 Martin Bosslet <Martin.Bosslet@googlemail.com>
+
+ * test/openssl/test_config.rb: execute based on the existence of the
+ OpenSSL module.
+
+Wed Jun 15 12:35:11 2011 Tanaka Akira <akr@fsij.org>
+
+ * test/ruby/test_io.rb (test_copy_stream_socket): wait a child process
+ before SIGUSR1 handler is removed.
+
+ * test/pathname/test_pathname.rb (define_assertion): use line number
+ for test method names.
+
+Wed Jun 15 10:37:43 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * file.c (rb_stat_rdev): use DEVT2NUM.
+
+ * file.c (rb_stat_rdev_major): ditto.
+
+ * file.c (rb_stat_rdev_minor): ditto.
+
+Wed Jun 15 05:12:59 2011 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
+
+ * ext/tk/tcltklib.c (lib_eventloop_core): revert the last change (it's
+ the part for ruby_1_8), and use rb_thread_check_ints() when RUBY_VM
+ is defined.
+
+Wed Jun 15 04:42:47 2011 Koichi Sasada <ko1@atdot.net>
+
+ * benchmark/bm_vm3_thread_*.rb: renamed bm_vm3_thread_*.rb to
+ benchmark/bm_vm_thread_*.rb.
+
+Wed Jun 15 04:28:39 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * benchmark/bm_vm4_thread_pass.rb: rename bm_vm4* to
+ bm_vm_thread_*. suggested by ko1.
+ * benchmark/bm_vm4_pipe.rb: ditto.
+ * benchmark/bm_vm4_alive_check1.rb: ditto.
+ * benchmark/bm_vm4_pass_flood.rb: ditto.
+
+Wed Jun 15 03:52:50 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * benchmark/bm_vm4_pass_flood.rb: new benchmark for GVL fairness.
+ * benchmark/bm_vm4_alive_check1.rb: ditto.
+
+Wed Jun 15 01:27:53 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * thread_pthread.c (gvl_yield): fix live lock issue on 1-2 cpus
+ system. It's additional fix for r32021.
+ * thread_pthread.c (gvl_init): add switch_wait_cond.
+ * thread_pthread.h (typedef struct rb_global_vm_lock_struct): ditto.
+
+Tue Jun 14 23:16:22 2011 Tanaka Akira <akr@fsij.org>
+
+ * bootstraptest/runner.rb (show_progress): refine verbose mode.
+ (exec_test): ditto.
+
+Tue Jun 14 23:02:36 2011 Tanaka Akira <akr@fsij.org>
+
+ * bootstraptest/runner.rb (show_progress): extracted from assert_check.
+ (assert_check): use show_progress.
+ (assert_normal_exit): ditto.
+ (assert_finish): ditto.
+ (flunk): ditto.
+
+Tue Jun 14 22:51:42 2011 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * test/date/test_*.rb: added tests.
+
+Tue Jun 14 22:09:58 2011 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * ext/date/date_core.c: renamed some functions.
+ * ext/date/date_core.c: modified doc.
+
+Tue Jun 14 21:26:01 2011 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
+
+ * cont.c (cont_save_thread): add new utility function.
+ rb_context_t::saved_thread.machine_stack_start and
+ machine_stack_end should be cleared immediately after a snapshot of
+ current thread is stored to saved_thread. [ruby-dev:43680] [Bug #4855]
+ this change aims to get rid of unnecessary GC mark at machine stack.
+
+Tue Jun 14 19:50:49 2011 Tanaka Akira <akr@fsij.org>
+
+ * test/ruby/test_autoload.rb: remove temporary directory.
+
+Tue Jun 14 11:05:03 2011 Narihiro Nakamura <narihiro@netlab.jp>
+
+ * gc.c (rb_gc_set_params): call initial_expand_heap if
+ initial_heap_min_slots is set.
+
+Tue Jun 14 11:02:08 2011 Narihiro Nakamura <narihiro@netlab.jp>
+
+ * gc.c: use size_t.
+
+Tue Jun 14 01:10:38 2011 Yusuke Endoh <mame@tsg.ne.jp>
+
+ * test/coverage/test_coverage.rb: add a test for restart. a patch
+ from Xavier Shay. [ruby-core:36745]
+
+Tue Jun 14 01:05:10 2011 Yusuke Endoh <mame@tsg.ne.jp>
+
+ * ext/coverage/coverage.c: make it restartable. [ruby-core:36539]
+
+Mon Jun 13 23:55:40 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * thread.c (rb_thread_schedule_rec): call gvl_yield() unconditionally.
+ * thread_pthread.c: remove HAVE_GVL_YIELD macro.
+ * thread_win32.c (gvl_yield): new. this fallback logic was moved from
+ rb_thread_schedule_rec().
+
+Mon Jun 13 23:50:25 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * ext/io/console/console.c (console_dev): typo.
+
+Mon Jun 13 23:38:23 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * parse.y (parser_parse_string): flush delayed token. based on a
+ patch by Masaya Tarui in [ruby-dev:43762]. Bug #4544
+
+ * parse.y (yylex): revert r24557. delayed token at the end of
+ string should be flushed already by the above change.
+
+Mon Jun 13 23:33:31 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/io/console/console.c (console_dev): console should be
+ unbuffered.
+
+ * ext/io/console/console.c (console_dev): take care of no-ctty
+ case.
+
+Mon Jun 13 23:06:12 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * thread_pthread.c: rewrite GVL completely. This fix improve some
+ benchmark dramatically (e.g. vm3_thread_mutex result changed
+ form 120.601sec to 3.426sec).
+ * thread_win32.c: ditto.
+ * thread_pthread.h: ditto.
+ * vm_core.h: ditto.
+ * thread.c: ditto.
+
+Mon Jun 13 23:11:52 2011 Tanaka Akira <akr@fsij.org>
+
+ * test/socket/test_unix.rb: don't use Thread.abort_on_exception.
+
+Mon Jun 13 23:05:01 2011 Tanaka Akira <akr@fsij.org>
+
+ * ext/socket/unixsocket.c (unix_send_io): race condition fixed.
+ (unix_recv_io): ditto.
+ fixed by Eric Wong. [ruby-core:35574]
+
+ * test/socket/test_unix.rb: test added for above problem.
+
+Mon Jun 13 21:41:05 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * thread_win32.c (native_cond_signal): remove unnecessary rb_bug().
+ It's additional fix for r32021. [Bug #4696]
+
+Mon Jun 13 20:50:49 2011 Martin Bosslet <Martin.Bosslet@googlemail.com>
+
+ * test/openssl/test_ec.rb
+ test/openssl/test_pkey_ec.rb: merge both files into test_pkey_ec.rb.
+ Removed redundant group instantiation from PKey tests.
+ * test/openssl/utils.rb: only create TEST_PKEY_EC_P256V1 if EC is
+ defined.
+
+Mon Jun 13 20:28:24 2011 Martin Bosslet <Martin.Bosslet@googlemail.com>
+
+ * test/openssl/digest.rb: remove MDC2 from test, it is not available
+ by default in an OpenSSL installation.
+
+Mon Jun 13 20:18:55 2011 Koichi Sasada <ko1@atdot.net>
+
+ * vm_core.h, vm_insnhelper.h: move decl. of
+ ruby_vm_global_state_version and related macros
+ from vm_core.h to vm_insnhelper.h.
+
+ * vm.c (vm_clear_all_cache): added. This function is called
+ when ruby_vm_global_state_version overflows.
+ TODO: vm_clear_all_inline_method_cache() is only place holder.
+ We need to implement it ASAP.
+
+ * vm_method.c (vm_clear_global_method_cache): added.
+
+Mon Jun 13 19:46:21 2011 Keiju Ishitsuka <keiju@ishitsuka.com>
+
+ * lib/cmath.rb: add new method Object#real?. fix #3137
+
+Mon Jun 13 18:52:00 2011 Kenta Murata <mrkn@mrkn.jp>
+
+ * ext/bigdecimal/bigdecimal.c (is_kind_of_BigDecimal): new function to
+ examine the whether the object is kind of BigDecimal.
+
+Mon Jun 13 18:49:00 2011 Kenta Murata <mrkn@mrkn.jp>
+
+ * ext/bigdecimal/bigdecimal.c (BigDecimalCmp): use GetVpValueWithPrec
+ for Float and Rational arguments.
+
+ * test/bigdecimal/test_bigdecimal.rb (test_new, test_cmp, test_power):
+ add and modify tests for the above change.
+
+ * ext/bigdecimal/bigdecimal.c (BigDecimalCmp): modify coding style to
+ match ruby's standard.
+
+Mon Jun 13 18:33:04 2011 Tanaka Akira <akr@fsij.org>
+
+ * lib/securerandom.rb (SecureRandom.random_bytes): modify PRNG state
+ to prevent random number sequence repetition at forked child
+ process which has same pid.
+ reported by Eric Wong. [ruby-core:35765]
+
+Mon Jun 13 17:02:34 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * lib/net/http.rb (Net::HTTP#use_ssl?): require 'openssl' only when
+ https is needed. fixes r31933.
+
+Mon Jun 13 14:35:00 2011 Kenta Murata <mrkn@mrkn.jp>
+
+ * lib/cmath.rb (CMath.cbrt): returns the principal value of the cube
+ root of the argument. fix #3676
+
+ * test/test_cmath.rb (test_cbrt_returns_principal_value_of_cube_root):
+ test for the above change.
+
+Mon Jun 13 14:17:00 2011 Kenta Murata <mrkn@mrkn.jp>
+
+ * lib/test/unit.rb (Test::Unit::GlobOption#non_options): fix typo.
+
+Mon Jun 13 13:04:20 2011 Martin Bosslet <Martin.Bosslet@googlemail.com>
+
+ * ext/openssl/ossl_digest.c: fix error for digests that have no oid
+ (e.g. DSS1).
+ * test/openssl/test_digest.c: add tests for this.
+
+Mon Jun 13 12:51:51 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * lib/yaml.rb: load psych only when syck is not loaded.
+
+Mon Jun 13 12:23:39 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+Mon Jun 13 12:23:39 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * ext/psych/lib/psych/deprecated.rb (Object#to_yaml_properties):
+ undef to_yaml_properties before redefine it.
+
+ * ext/syck/lib/syck/rubytypes.rb: ditto.
+
+Mon Jun 13 11:30:10 2011 Martin Bosslet <Martin.Bosslet@googlemail.com>
+
+ * ext/openssl/ossl_digest.c: allow Digests to be created by sn, ln or
+ oid.
+ * test/openssl/test_digest.rb: add tests for this.
+ [Ruby 1.9 - Feature #4412] [ruby-core:35319]
+
+Mon Jun 13 10:54:03 2011 Martin Bosslet <Martin.Bosslet@googlemail.com>
+
+ * ext/openssl/pkey_dh.c: corrected documentation.
+ * test/openssl/utils.rb: add test key for DH.
+ * test/openssl/test_pkey_dh.rb: add tests.
+
+Mon Jun 13 10:13:08 2011 Martin Bosslet <Martin.Bosslet@googlemail.com>
+
+ * ext/openssl/pkey_dh.c: clarify difference between DH#public_key and
+ DH#pub_key in documentation.
+
+Mon Jun 13 05:50:43 2011 Martin Bosslet <Martin.Bosslet@googlemail.com>
+
+ * NEWS: introduce PKey.read.
+
+Mon Jun 13 05:17:29 2011 Martin Bosslet <Martin.Bosslet@googlemail.com>
+
+ * ext/openssl/ossl_pkey.c: added PKey.read module function that allows
+ reading arbitrary public/private keys from DER-/PEM-encoded File or
+ string instances.
+ * ext/openssl/ossl_pkey_dh.c: improved documentation.
+ * test/openssl/utils.rb: added EC test key.
+ * test/openssl/test_pkey_rsa.rb
+ test/openssl/test_pkey_dsa.rb: Test PKey.read. Reuse keys from
+ OpenSSL::TestUtils.
+ * test/openssl/test_pkey_ec.rb: Created test file for EC tests.
+ Test PKey.read.
+ [Ruby 1.9 - Feature #4424] [ruby-core:35330]
+
+Mon Jun 13 04:42:24 2011 Koichi Sasada <ko1@atdot.net>
+
+ * ext/objspace/objspace.c (total_i): fix to skip no ruby objects.
+
+Mon Jun 13 03:07:38 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * test/benchmark/test_benchmark.rb (capture_output):
+ replace '-' as space. On NetBSD, subtract between two Process.times
+ after and before the short process may return negative value like:
+ t0=Process.times; yield; t1=Process.times; p t1.utime-t0.utime
+
+Mon Jun 13 02:40:23 2011 Martin Bosslet <Martin.Bosslet@googlemail.com>
+
+ * test/openssl/test_pkey_dsa.rb: Test for DSA#syssign/sysverify.
+
+Mon Jun 13 01:59:19 2011 Martin Bosslet <Martin.Bosslet@googlemail.com>
+
+ * ext/openssl/ossl_pkey_dh.c: completed documentation.
+ * ext/openssl/ossl_pkey_dsa.c: corrected examples. Improved parameter
+ sections.
+
+Mon Jun 13 00:25:10 2011 Martin Bosslet <Martin.Bosslet@googlemail.com>
+
+ * ext/openssl/ossl_pkey_dsa.c: completed documentation.
+
+Sun Jun 12 23:36:46 2011 Masatoshi SEKI <m_seki@mva.biglobe.ne.jp>
+
+ * lib/drb/drb.rb (kill_sub_thread): remove the method. [ruby-core:34185]
+
+Sun Jun 12 21:01:56 2011 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * ext/date/date_core.c (d_lite_marshal_load): should give converted value.
+
+Sun Jun 12 20:36:30 2011 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * ext/date/date_core.c: edited doc.
+
+Sun Jun 12 18:12:07 2011 Koichi Sasada <ko1@atdot.net>
+
+ * benchmark/bm_vm3_clearmethodcache.rb: added.
+
+Sun Jun 12 17:40:29 2011 Koichi Sasada <ko1@atdot.net>
+
+ * vm_method.c (rb_clear_cache*): update only vm state version.
+
+ * vm_method.c (rb_method_entry_get_without_cache, rb_method_entry):
+ Fill method cache entry with vm state version, and
+ check current vm state version for method (cache) look up.
+ This modification speed-up invalidating of global method cache table.
+ [Ruby 1.9 - Feature #3905] [ruby-core:36908]
+
+Sun Jun 12 16:19:48 2011 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
+
+ * ext/tk/extconf.rb: fail on Mac OS X. [Bug #4853][ruby-dev:43655]
+
+Sun Jun 12 15:56:08 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * thread.c: remove th->transition_for_lock. It's thread unsafe.
+ [Bug #4723][ruby-dev:43563]
+
+Sun Jun 12 15:47:35 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * thread.c: introduce spurious wakeup safe deadlock check.
+ [Bug #4696][ruby-dev:43554]
+
+Sun Jun 12 13:33:52 2011 Koichi Sasada <ko1@atdot.net>
+
+ * benchmark/bm_vm3_thread_mutex.rb: remove it.
+
+ * benchmark/bm_vm3_thread_mutex[1-3].rb: added 3 benchmarks.
+ 1: one thread with one mutex (no contention).
+ 2: two threads with one mutex (contention).
+ 3: 1000 threads with one mutex (huge number of contention)
+ Above removed benchmark was type 3.
+ Therefore, this commit adds type 1 and 2 benchmark.
+
+Sun Jun 12 11:16:59 2011 Tanaka Akira <akr@fsij.org>
+
+ * io.c: use select() appropriately for sendfile().
+ Fixed by Eric Wong. [ruby-core:36150]
+ (maygvl_copy_stream_wait_readwrite): removed.
+ (nogvl_copy_stream_sendfile): use nogvl_copy_stream_wait_write and
+ maygvl_copy_stream_wait_read instead of
+ maygvl_copy_stream_wait_readwrite.
+
+Sun Jun 12 09:32:13 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * atomic.h (ATOMIC_OR): _InterlockedOr is not available on mingw.h
+ * gc.c (rb_gc_set_params): VM_OBJSPACE is disabled on mingw.
+
+Sun Jun 12 01:07:09 2011 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * ext/date/date_core.c: edited doc.
+
+Sat Jun 11 23:18:00 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * vm_core.h (RUBY_VM_SET_TIMER_INTERRUPT, RUBY_VM_SET_INTERRUPT,
+ RUBY_VM_SET_FINALIZER_INTERRUPT): use atomic ops for preventing
+ interrupt_flag bit lost. [Bug #4770][ruby-dev:43467]
+ * thread.c (rb_threadptr_execute_interrupts_rec): ditto.
+ * vm_core.h (typedef struct rb_thread_struct): change type of
+ interrupt_flag to rb_atomic_t.
+ * atomic.h: move atomic ops definition from signal.c.
+ * signal.c: remove atomic ops definition.
+ * common.mk (gc, signal, thread, cont): add to dependency to atomic.h.
+
+Sat Jun 11 23:23:52 2011 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * ext/date/date_core.c: edited doc.
+
+Sat Jun 11 23:02:36 2011 Hiroshi Nakamura <nahi@ruby-lang.org>
+
+ * ext/openssl/lib/openssl/buffering.rb (module OpenSSL):
+ Buffering#each_byte should return String in accordance with IO in
+ 1.9.
+
+ * test/openssl/test_buffering.rb (class OpenSSL): add tests for getc
+ and each_byte.
+
+Sat Jun 11 22:41:37 2011 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * time.c: a correction of doc for strftime (%v).
+
+Sat Jun 11 22:30:53 2011 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * ext/date/date_core.c: replaced doc for strftime based on Time's one.
+
+Sat Jun 11 22:07:56 2011 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * ext/date/date_core.c (datetime_s_{iso8601,rfc3339,xmlschema,rfc2822,httpdate}):
+ do not take argument comp.
+
+Sat Jun 11 21:58:31 2011 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * ext/date/date_core.c: added examples.
+
+Sat Jun 11 19:40:45 2011 Narihiro Nakamura <authornari@gmail.com>
+
+ * gc.c: expand heap if initial_heap_min_slots is bigger than
+ HEAP_MIN_SLOTS.
+
+Sat Jun 11 19:42:50 2011 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * ChangeLog (vim): set shiftwidth to 2.
+
+Sat Jun 11 19:27:06 2011 Hiroshi Nakamura <nahi@ruby-lang.org>
+
+ * ext/openssl/ossl_x509req.c: raise RequestError instead of
+ CertificateError when Request#to_der gets an error from OpenSSL.
+ Patch from Ippei Obayashi, see #4420. I cannot write a test for
+ this... Request does not allow to create broken bytes...
+
+Sat Jun 11 19:34:51 2011 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * ext/date/date_core.c (Date::(ABBR_)?(MONTH|DAY)NAMES): should be usascii.
+
+Sat Jun 11 19:24:33 2011 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * ext/date/date_core.c: rewrote doc.
+
+Sat Jun 11 19:04:15 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/test/unit.rb (Test::Unit::GlobOption#non_options): should run
+ with 1.8.
+
+Sat Jun 11 18:05:57 2011 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * bootstraptest/runner.rb: should initialize $stress to avoid warnings.
+
+Sat Jun 11 18:02:09 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * io.c (io_getc): should be 7bit if ascii. fixes #4557
+
+Sat Jun 11 16:52:16 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * numeric.c (rb_enc_uint_chr): fix message format. Bug#4869
+
+Sat Jun 11 16:28:25 2011 Kouhei Sutou <kou@cozmixng.org>
+
+ * lib/rexml/formatters/pretty.rb
+ (REXML::Formatters::Pretty#write_text),
+ test/rexml/test_core.rb
+ (Tester#test_pretty_format_long_text_finite): don't ignore
+ 'width' parameter in pretty formatter. fixes #4498
+ Reported by Michael Frasca. Thanks!!!
+
+Sat Jun 11 16:11:36 2011 Kouhei Sutou <kou@cozmixng.org>
+
+ * test/rexml/test_core.rb
+ (Tester#test_pretty_format_long_text_finite): remove needless
+ assert_nothing_raised.
+
+Sat Jun 11 16:04:03 2011 Kouhei Sutou <kou@cozmixng.org>
+
+ * lib/rexml/parsers/xpathparser.rb
+ (REXML::Parsers::XPathParser#parse),
+ test/rexml/test_elements.rb
+ (ElementsTester#test_each_with_frozen_condition):
+ don't modify original XPath. fixes #4161
+ Reported by Pavel Shved. Thanks!!!
+
+Sat Jun 11 15:53:27 2011 Kouhei Sutou <kou@cozmixng.org>
+
+ * test/rexml/test_elements.rb (ElementsTester): remove needless
+ prefix from test name.
+
+Sat Jun 11 15:36:36 2011 Martin Duerst <duerst@it.aoyama.ac.jp>
+ * common.mk: fixed a grammatical error
+
+Sat Jun 11 14:20:16 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * vm.c (thread_memsize): don't ignore size of th->local_storage.
+
+Sat Jun 11 10:32:46 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/mkmf.rb: should quote arch_hdrdir and libpath for the case
+ installed prefix contains spaces.
+
+Sat Jun 11 10:20:52 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * thread_pthread.c (native_cond_timeout): wrap conditionally used
+ label.
+
+ * thread_pthread.c (native_sleep): remove unused variable.
+
+Sat Jun 11 10:15:50 2011 Tanaka Akira <akr@fsij.org>
+
+ * thread.c (rb_thread_execute_interrupts): use GetThreadPtr to extract
+ rb_thread_t from VALUE.
+ reported by Motohiro KOSAKI. [ruby-dev:43700]
+
+Sat Jun 11 10:00:49 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ruby.c (ruby_process_options): add missing return type.
+
+Fri Jun 10 23:18:09 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * ext/tk/tcltklib.c (lib_eventloop_core): replace CHECK_INTS with
+ rb_thread_check_ints(). Because current code can't be compiled.
+
+Fri Jun 10 16:38:13 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * encoding.c (rb_locale_charmap): When ruby process is run as Windows
+ Service the console codepage is not set, GetConsoleCP returns 0.
+ So on such environment, use GetACP().
+ http://blogs.msdn.com/b/michkap/archive/2005/02/08/369197.aspx
+ patched by Rafal Bigaj [ruby-core:36832] [Bug #4854]
+
+Fri Jun 10 14:34:24 2011 Koichi Sasada <ko1@atdot.net>
+
+ * common.mk: restore TESTRUN_SCRIPT to "$(srcdir)/test.rb".
+ TESTRUN_SCRIPT is used by "make run", "make gdb" and so on.
+
+Fri Jun 10 13:01:24 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * test/ruby/test_module.rb (TestModule#remove_rake_mixins): remove all
+ module related to Rake.
+
+Fri Jun 10 09:52:38 2011 Eric Hodel <drbrain@segment7.net>
+
+ * encoding.c: Mention that Encoding.compatible? can work with more
+ than just Strings.
+
+Fri Jun 10 02:25:53 2011 Aaron Patterson <aaron@tenderlovemaking.com>
+
+ * ext/psych/lib/psych.rb: updating version to match released gem.
+
+Fri Jun 10 01:06:29 2011 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * ext/bigdecimal (BigDecimal_to_i): Integer#** may return flonum.
+
+Fri Jun 10 00:35:12 2011 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * complex.c (string_to_c_internal): uses rb_reg_nth_match;
+ * rational.c (string_to_r_internal): ditto.
+
+Fri Jun 10 00:25:03 2011 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
+
+ * gc.c: remove an unused declaration.
+
+Fri Jun 10 00:24:04 2011 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * rational.c (string_to_r): Rational#** may return flonum.
+
+Thu Jun 9 23:57:53 2011 Tanaka Akira <akr@fsij.org>
+
+ * io.c: fix IO.copy_stream interrupt handling.
+ based on the patch by Eric Wong. [ruby-core:36156]
+
+ * vm_core.h (rb_thread_call_with_gvl): don't declare here.
+
+ * thread.c: include internal.h.
+ (rb_thread_execute_interrupts): new function.
+
+ * internal.h (rb_thread_execute_interrupts): declared.
+ (rb_thread_call_with_gvl): declared.
+
+Thu Jun 9 23:34:01 2011 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
+
+ * gc.c (rb_objspace_call_finalizer): use rb_typeddata_is_kind_of() for
+ type check to get rid of a double free when main Thread has singleton
+ class. [ruby-core:36741] [Bug #4828]
+ * thread.c (rb_obj_is_mutex): add a new utility function.
+ * vm.c (rb_obj_is_thread): ditto.
+
+Thu Jun 9 22:53:49 2011 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
+
+ * test/ruby/test_thread.rb (TestThread#test_kill_thread_subclass):
+ add test for Thread.kill with Thread subclass instance.
+
+Thu Jun 9 22:31:47 2011 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
+
+ * test/ruby/test_thread.rb (TestThread#test_kill_wrong_argument):
+ test for [ruby-core:35086].
+ partially forward porting r31402 from ruby_1_9_2 branch.
+
+Thu Jun 9 18:36:00 2011 Kenta Murata <mrkn@mrkn.jp>
+
+ * string.c: Fix the ambiguous description of the behavior of
+ rb_str_aref_m with a range. It returns nil when the beginning of
+ the range is greater than the end of the string rather than the range.
+
+Thu Jun 9 10:57:03 2011 Aaron Patterson <aaron@tenderlovemaking.com>
+
+ * ext/psych/lib/psych/visitors/to_ruby.rb: Hash subclasses can be read
+ from YAML files.
+ * ext/psych/lib/psych/visitors/yaml_tree.rb: Hash subclasses can be
+ dumped to YAML files.
+ * test/psych/test_hash.rb: corresponding test.
+
+Thu Jun 9 09:18:51 2011 Aaron Patterson <aaron@tenderlovemaking.com>
+
+ * ext/psych/lib/psych/visitors/to_ruby.rb: Ruby modules can be loaded
+ from YAML files.
+ * ext/psych/lib/psych/visitors/yaml_tree.rb: Ruby modules can be
+ dumped to YAML files.
+ * test/psych/test_class.rb: corresponding test.
+
+Thu Jun 9 09:05:04 2011 Aaron Patterson <aaron@tenderlovemaking.com>
+
+ * ext/psych/lib/psych/visitors/to_ruby.rb: Ruby classes can be loaded
+ from YAML files.
+ * ext/psych/lib/psych/visitors/yaml_tree.rb: Ruby classes can be
+ dumped to YAML files.
+ * test/psych/test_class.rb: corresponding test.
+
+Wed Jun 8 21:38:57 2011 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
+
+ * cont.c (root_fiber_alloc): set root fiber's status RUNNING.
+ in cont_mark() only RUNNING fiber's machine stack is marked.
+ root fiber's status should be RUNNING at the beginning regardless of
+ FIBER_USE_NATIVE. [ruby-core:36735] fixes #4827
+
+Tue Jun 7 20:50:11 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * doc/irb/irb.rd: fix typo. patch by Nobuhiro IMAI.
+ [Bug #4843] [ruby-dev:43639]
+ * doc/irb/irb.rd.ja: ditto.
+ * doc/ChangeLog-YARV: ditto.
+
+Tue Jun 7 18:52:55 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * lib/rubygems/user_interaction.rb (Gem::StreamUI#tty?): IO#tty? of
+ Windows has been fixed at r29969.
+
+ * test/rubygems/test_gem_stream_ui.rb: now can run tests.
+
+Tue Jun 7 18:36:41 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * test/rubygems/test_gem.rb (TestGem#{test_self_user_home_userprofile,
+ test_self_user_home_user_drive_and_path}): should simply ignore
+ meaningless tests instead of skipping them.
+
+Tue Jun 7 18:15:00 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * test/ruby/test_rubyoptions.rb (TestRubyOptions#test_set_program_name):
+ should show some messages when skipping tests.
+
+Tue Jun 7 13:59:47 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/date/date_core.c (date_s_today, datetime_s_now): check the
+ result of localtime_r().
+
+Tue Jun 7 13:36:51 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/tk/extconf.rb: use $defs not $CPPFLAGS to get rid of
+ command line escape issues on Windows. fixed #4835.
+
+Tue Jun 7 03:18:45 2011 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
+
+ * test/ruby/test_io.rb (TestIO#test_s_{,bin}write): do not create a
+ file under /tmp. [Bug #4846]
+
+Mon Jun 6 22:51:43 2011 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
+
+ * cont.c: use #if FIBER_USE_NATIVE instead of #ifdef.
+ you can suppress use of setcontext for Fiber with compile option
+ -DFIBER_USE_NATIVE=0
+
+Mon Jun 6 21:59:23 2011 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * test/date/test_switch_hitter.rb: added a test.
+
+Mon Jun 6 21:37:45 2011 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * ext/date/date_core.c: added notes.
+
+Mon Jun 6 21:02:12 2011 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * ext/date/date_core.c: flattened format to strftimev.
+ * ext/date/date_core.c (date_strftime_internal): taints run.
+
+Mon Jun 6 15:10:17 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * include/ruby/{defines,missing}.h (rb_infinity, rb_nan): move from
+ defines.h to missing.h. (couldn't use RUBY_EXTERN there.)
+
+Mon Jun 6 14:35:48 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * test/rdoc/test_rdoc_markup_pre_process.rb (TestRDocMarkupPreProcess#
+ {test_include_file,test_include_file_encoding_incompatible}): no
+ need to write such workaround. don't hide the bug of ruby. (and the
+ bug is already fixed.)
+
+Mon Jun 6 14:11:11 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * ext/date/date_core.c (valid_jd_sub): need to convert from VALUE to
+ double.
+
+ * ext/date/date_core.c (offset_to_sec): get rid of a compiler warning.
+
+Mon Jun 6 14:09:08 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * include/ruby/defines.h (rb_infinity, rb_nan): export for Windows.
+
+Mon Jun 6 10:54:45 2011 Shota Fukumori <sorah@tubusu.net>
+
+ * lib/test/unit.rb(Test::Unit::Runner#puke):
+ Add overriding from MiniTest::Unit#puke. This reverts minitest's fix
+ that skip messages are hidden when not verbose mode (-v option).
+ To hide skip messages, use --hide-skip option instead.
+
+Mon Jun 6 10:52:13 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * lib/net/http.rb: don't use autoload.
+
+Mon Jun 6 09:39:43 2011 Aaron Patterson <aaron@tenderlovemaking.com>
+
+ * ext/psych/parser.c (parse): release event objects to plug memory
+ leak. Thanks Mark J. Titorenko!
+
+Sun Jun 5 23:26:15 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * eval.c: remove rb_thread_stop_timer_thread function declaration.
+ Instead, include vm_core.h.
+ * process.c: ditto.
+
+Sun Jun 5 21:38:51 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * thread_pthread.c (thread_timer): add to care a spurious wakeup.
+ When native_cond_timedwait() return 0 by spurious wakeup, we
+ don't have to neither 1) call timer_thread_function and 2)
+ exit the timer thread.
+
+Sun Jun 5 17:50:01 2011 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * ext/date/date_core.c (m_real_cwyear): new. derived from m_cwyear.
+ * ext/date/date_strftime.c: trivial changes.
+
+Sun Jun 5 17:22:01 2011 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
+
+ * ext/tk/config_list.in: add new options for tcltklib.
+
+Sun Jun 5 10:06:50 2011 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * ext/date/date_tmx.h: now does not place decoded data. allows to
+ access indirectly via functions on demand.
+ * ext/date/date_strftime.c: ditto.
+ * ext/date/date_core.c: ditto.
+ * ext/date/date_core.c ({d|dt}_lite_to_s): use strftime.
+
+Sun Jun 5 06:22:02 2011 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * NEWS: wrote about changes of date.
+
+Sat Jun 4 16:59:26 2011 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * ext/date/date_core.c (d_lite_inspect): changed the format.
+ * ext/date/date_core.c: refactoring and fixing some bugs.
+
+Sat Jun 4 11:30:57 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * class.c (check_mix_method_i, do_mix_method_i): not mix methods
+ renamed as nil.
+
+Sat Jun 4 04:04:41 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * test/rubygems/test_gem_commands_which_command.rb:
+ "missing" exists on ruby's top source directory. [Bug #4815]
+
+Fri Jun 3 21:48:12 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * lib/rubygems/test_case.rb: Refix for test-all in separate directory.
+ r31147 + r31151.
+
+Fri Jun 3 20:58:47 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * ext/date/date_core.c (d_lite_plus): get rid of compiler warnings.
+
+Fri Jun 3 20:56:40 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * include/ruby/missing.h, numeric.c (round): moved prototype of round()
+ from numeric.c to missing.h. (note: round() is C99 feature, so ruby
+ provides it if not exist in C runtime.)
+
+Fri Jun 3 20:42:04 2011 Shota Fukumori <sorah@tubusu.net>
+
+ * lib/test/unit/parallel.rb: Keep $stdin, $stdout before run testcase
+ and restore after run. Because some test break $stdin, $stdout.
+ Fixes [Bug #4433] [ruby-core:35353]
+
+Fri Jun 3 19:58:14 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * io.c (io_fflush): windows -- call fsync() only when the FD is tied to
+ file, because if the FD is pipe, it blocks.
+
+Fri Jun 3 09:27:31 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * lib/net/http.rb (URI::HTTP#request_uri): return nil when the uri
+ is path-rootless form. Bug #4759
+
+Thu Jun 2 23:51:03 2011 James Edward Gray II <jeg2@ruby-lang.org>
+
+ * lib/csv.rb: Improve the line ending detection algorithm
+ patch by Alexey).
+
+Thu Jun 2 20:05:57 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * io.c (rb_io_s_write, rb_io_s_binwrite): return!!!
+
+Thu Jun 2 16:29:34 2011 Shota Fukumori <sorah@tubusu.net>
+
+ * io.c: Add File.write, File.binwrite. [Feature #1081] [ruby-core:21701]
+
+ * test/ruby/test_io.rb: Test for File.write, File.binwrite.
+
+ * NEWS: News for above.
+
+Thu Jun 2 12:33:09 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * io.c (io_fflush, rb_io_flush): need to fsync() when ruby calls
+ internal flush. [ruby-core:36670] [Bug #4813]
+
+Thu Jun 2 07:56:24 2011 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
+
+ * ext/tk/tcltklib.c: reduce CPU power required by an eventloop.
+
+Tue May 31 21:28:33 2011 Tanaka Akira <akr@fsij.org>
+
+ * test/ruby/test_signal.rb (TestSignal#test_signal_requiring):
+ redirect stderr to null device.
+
+Thu Jun 2 00:45:26 2011 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
+
+ * ext/tk/extconf.rb: fix for uninitialized global variables.
+ [Ruby 1.9 - Bug #4811]
+
+Wed Jun 1 21:57:08 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * thread_pthread.c (native_sleep): fix 1000times calculation error.
+ this is a regression since r31457. [Bug #4808] [ruby-dev:43606]
+
+Wed Jun 1 17:19:16 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * thread_pthread.c: remove unused macro.
+
+Wed Jun 1 15:42:18 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * parse.y (peek_n): new macro to see next nth char.
+
+Wed Jun 1 15:40:46 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * tool/rbinstall.rb (gem): fix for rubygems change.
+
+Wed Jun 1 14:07:57 2011 Ryan Davis <ryand-ruby@zenspider.com>
+
+ * lib/minitest/*: Imported minitest 2.2.2 (r6281)
+ * test/minitest/*: ditto
+
+Wed Jun 1 12:35:50 2011 Ryan Davis <ryand-ruby@zenspider.com>
+
+ * lib/rubygems*: Import rubygems 1.8.5 (released @ 137c80f)
+ * test/rubygems: Ditto
+
+Wed Jun 1 12:34:00 2011 Kenta Murata <mrkn@mrkn.jp>
+
+ * NEWS: add new features of bigdecimal.
+
+Wed Jun 1 09:41:14 2011 Eric Hodel <drbrain@segment7.net>
+
+ * lib/cgi/util.rb: Improve documentation. Patch by Kuba Fietkiewicz.
+ [Ruby 1.9 - Bug #4775]
+ * lib/cgi/core.rb: ditto
+
+Wed Jun 1 09:26:05 2011 Eric Hodel <drbrain@segment7.net>
+
+ * lib/mathn.rb: Improve documentation and attach it to Numeric.
+ Modified from patch by Anil V. [Ruby 1.9 - Bug #4762]
+
+Wed Jun 1 09:21:30 2011 Eric Hodel <drbrain@segment7.net>
+
+ * lib/prime.rb: Indent examples enough to appear as code sections.
+ Note that Prime is Enumerable. [#4762]
+
+Wed Jun 1 07:34:57 2011 Eric Hodel <drbrain@segment7.net>
+
+ * hash.c (key_i): Change rdoc from "the first occurrence" to "an
+ occurrence" since first occurrence is not a specification of
+ Hash#key. [Ruby 1.9 - Bug #4760]
+
+Wed Jun 1 07:26:19 2011 Eric Hodel <drbrain@segment7.net>
+
+ * ext/pty/pty.c (pty_check): Restore "not reached" comment.
+ [Ruby 1.9 - Bug #4756]
+
+Wed Jun 1 07:21:40 2011 Eric Hodel <drbrain@segment7.net>
+
+ * ext/zlib/zlib.c: Fix document-method declarations for set_sync and
+ set_comment. [Ruby 1.9 - Bug #4695]
+
+Wed Jun 1 06:43:13 2011 Masaya Tarui <tarui@ruby-lang.org>
+
+ * load.c (loaded_feature_path): cut nonsense loop execution to fix
+ performance bug.
+
+Wed Jun 1 01:16:02 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * class.c (rb_mix_module): implement Module#mix.
+
+Wed Jun 1 01:15:12 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * io.c (io_encoding_set): should honor already set ecflags since it
+ might be set by mode option. fixed #4804
+
+Wed Jun 1 00:34:04 2011 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
+
+ * ext/bigdecimal/bigdecimal.c (GetVpValueWithPrec): remove unused
+ variable.
+
+Wed Jun 1 00:32:00 2011 Kenta Murata <mrkn@mrkn.jp>
+
+ * ext/bigdecimal/bigdecimal.c (GetVpValueWithPrec): support instantiation from
+ a Float through Rational.
+
+ * ext/bigdecimal/bigdecimal.c (BigDecimal_new): ditto.
+
+ * test/bigdecimal/test_bigdecimal.rb (test_global_new_float): add a test for
+ the above changes.
+
+ * test/bigdecimal/test_bigdecimal.rb (test_new_with_float): ditto.
+
+Wed Jun 1 00:07:00 2011 Kenta Murata <mrkn@mrkn.jp>
+
+ * ext/bigdecimal/bigdecimal.c (BigDecimal_coerce): support coerce with a
+ Rational. The precision used for instantiate a BigDecimal from the
+ given Rational is obtained from the receiver BigDecimal.
+
+ * test/bigdecimal/test_bigdecimal.rb (test_coerce): add a test for the
+ above change.
+
+Tue May 31 23:49:08 2011 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * ext/date/date_core.c (offset_to_sec): fixed invalid validation.
+
+Tue May 31 23:43:00 2011 Kenta Murata <mrkn@mrkn.jp>
+
+ * ext/bigdecimal/bigdecimal.c (GetVpValueWithPrec): replace the algorithm for
+ coercing from a Rational to stop requiring "bigdecimal/util.rb".
+ [ruby-core:34318]
+
+ * ext/bigdecimal/bigdecimal.c (GetVpValue): refactoring.
+
+ * ext/bigdecimal/bigdecimal.c (BigDecimal_new): support instantiation from a
+ Rational.
+
+ * test/bigdecimal/test_bigdecimal.rb (test_global_new_with_rational): add a
+ test for the above change.
+
+ * test/bigdecimal/test_bigdecimal.rb (test_new_with_rational): ditto.
+
+Tue May 31 22:44:00 2011 Kenta Murata <mrkn@mrkn.jp>
+
+ * ext/bigdecimal/bigdecimal.c (BigDecimal_new): support instantiation a
+ BigDecimal object from an Integer.
+
+ * test/bigdecimal/test_bigdecimal.rb (test_new_with_integer):
+ add for testing the above change.
+
+ * ext/bigdecimal/bigdecimal.c (BigDecimal_global_new): replace its body
+ with a BigDecimal_new call.
+
+ * test/bigdecimal/test_bigdecimal.rb (test_global_new_with_integer):
+ add for testing the above change.
+
+Tue May 31 22:24:39 2011 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * ext/date/date_core.c: use simple/complex mode instead of light/right mode.
+ * test/date/*.rb: followed the above changes.
+
+Tue May 31 21:28:33 2011 Tanaka Akira <akr@fsij.org>
+
+ * test/ruby/test_signal.rb (TestSignal#test_signal_requiring):
+ initialize SIGINT handler.
+
+Tue May 31 17:03:24 2011 Hiroshi Nakamura <nahi@ruby-lang.org>
+
+ * lib/net/http.rb, lib/net/protocol.rb: Allow to configure to wait
+ server returning '100 continue' response before sending HTTP request
+ body. See NEWS for more detail. See #3622.
+ Original patch is made by Eric Hodel <drbrain@segment7.net>.
+
+ * test/net/http/test_http.rb: test it.
+
+ * NEWS: Add new feature.
+
+Tue May 31 14:17:49 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * io.c (rb_io_s_pipe): potential bug. the mode of read IO is set as
+ DEFAULT_TEXTMODE in call of io_set_encoding(), and of write IO is
+ also set as it in call of io_new_instance() via rb_protect().
+ so, if DEFAULT_TEXTMODE is not 0, we should check the result of
+ extract_binmode() and avoid crush of default IO mode and the result.
+
+Tue May 31 13:00:17 2011 Yuki Sonoda (Yugui) <yugui@yugui.jp>
+
+ * strftime.c (rb_strftime_with_timespec): improved style consistency.
+ constified some variables.
+
+ * test/test_time.rb (TestTime#test_huge_precision): test for #4456.
+
+Tue May 31 12:53:10 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * test/io/wait/test_io_wait.rb (TestIOWait#{test_nread,test_ready?,
+ test_wait}: give system some time to process the written data.
+
+Tue May 31 12:40:49 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * test/ruby/test_io.rb (TestIO#test_open_mode): MUST release resources
+ explicitly. fix problem of r31671
+
+Tue May 31 10:49:55 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * vm_exec.c: remove conditions for clang
+ because clang version 3.0 (trunk 132165) doesn't need them.
+
+Mon May 30 22:19:33 2011 Tanaka Akira <akr@fsij.org>
+
+ * test/ruby/test_signal.rb (TestSignal#test_signal_requiring): don't
+ close stderr.
+
+Mon May 30 20:22:00 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * test/ruby/test_signal.rb (TestSignal#test_signal_requiring): small
+ but critical typo of r31642. sorry...
+ [Bug #4798] [ruby-core:36550]
+
+Mon May 30 15:44:16 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * insns.def (opt_mult): as r31805, volatile it.
+ Without this, clang -O fails calculation.
+
+ * numeric.c (fix_mul): ditto.
+
+ * rational.c (f_imul): ditto.
+
+Mon May 30 10:26:51 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * numeric.c (int_pow): make sure to assign the result of x * z.
+ If xz is optimized out, the value won't overflow.
+
+Sun May 29 23:17:29 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * re.c (rb_reg_match): fix rdoc of Regexp#=~.
+ patched by Tsuyoshi Sawada. [Bug #4781]
+
+Sun May 29 23:10:42 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * lib/webrick/https.rb (WEBrick::HTTPRequest#parse_uri):
+ keep parse_uri as private. patched by okkez. [Bug #4773]
+
+Sun May 29 17:53:03 2011 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
+
+ * numeric.c: add #include "internal.h" for rb_big_uminus() prototype.
+
+Sun May 29 15:09:05 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * numeric.c (flo_round): fix for negative value.
+
+Sun May 29 02:16:53 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * test/net/http/utils.rb (TestNetHTTPUtils#teardown): add nil check.
+
+Sun May 29 00:22:40 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * process.c (before_exec, after_exec): change from macro to function.
+
+Sat May 28 19:30:17 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * process.c (before_exec, after_exec): change SIGPIPE handler to SIG_DFL
+ before calling execve(). Because r31760 reintroduced an issue that
+ system() may hang up (i.e. [ruby-dev:12261]).
+ * process.c (save_sigpipe, restore_sigpipe): new.
+
+Sat May 28 16:08:16 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * signal.c (Init_signal, default_handler): change default SIGPIPE handler
+ from empty function to SIG_IGN. [ruby-dev:43215]
+ * signal.c (sigpipe): removed.
+
+Sat May 28 03:04:27 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * io.c (fill_cbuf): return MORE_CHAR_SUSPENDED when cbuf is not empty.
+
+Sat May 28 02:22:48 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * string.c (rb_str_bytesize): rb_str_bytesize() should use LONG2NUM().
+ Patch by Nikolai Weibull. [Bug #4789] [ruby-core:36511]
+
+Sat May 28 02:06:26 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * io.c (fill_cbuf): Fix test-all crash.
+
+Sat May 28 00:58:40 2011 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
+
+ * lib/ostruct.rb (method_missing): Handle [] and []= correctly.
+ Based on a patch by Caius Durling, bug #4179 [ruby-core:33792]
+
+Fri May 27 23:56:54 2011 Kouhei Sutou <kou@cozmixng.org>
+
+ * test/rexml/test_core.rb (Tester::test_text_frozen): split frozen
+ string test. refs #4783
+
+Fri May 27 22:46:23 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * tool/rbinstall.rb (gem): install gemspec of json. fixed #4784
+
+Fri May 27 22:45:10 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * io.c (validate_enc_binmode): do not clear textmode flag if
+ default. fixed #4732
+
+ * io.c (fill_cbuf): finish reading at EOF.
+
+Fri May 27 11:31:51 2011 misfo <tedwardo2@gmail.com>
+
+ * lib/rexml/text.rb (REXML::Text#initialize): prevent an error
+ when passing a frozen string to REXML::Text.new
+
+ dup the string passed in instead of cloning so that it's frozen
+ state is ignored
+
+Fri May 27 08:47:26 2011 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
+
+ * thread.c (ppoll): typo bug fix.
+
+Fri May 27 08:35:04 2011 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
+
+ * ext/tk/lib/tk.rb: hang-up at exit before calling Tk.mainloop.
+
+ * ext/tk/lib/tk/extconf.rb: cannot make on MinGW [Ruby 1.9 - Bug #4141].
+
+Thu May 27 00:34:07 2011 James Edward Gray II <jeg2@ruby-lang.org>
+
+ * lib/csv.rb: Enhance each() to support Enumerator.
+
+Thu May 26 10:32:11 2011 James Edward Gray II <jeg2@ruby-lang.org>
+
+ * lib/csv.rb: Documentation improvements from Ysiad Ferreiras.
+ [Ruby 1.9 - Bug #4785]
+
+Thu May 26 15:42:02 2011 Cezary Baginski <cezary.baginski@gmail.com>
+
+ * lib/xmlrpc/parser.rb (FaultException): fix to_s and inspect
+
+ * test/xmlrpc/parser.rb: test for the above
+
+Wed May 25 11:54:31 2011 Eric Hodel <drbrain@segment7.net>
+
+ * ext/curses/curses.c: Remove color constants block.
+ [Ruby 1.9 - Bug #4748]
+
+Wed May 25 09:56:45 2011 Eric Hodel <drbrain@segment7.net>
+
+ * ext/curses/curses.c: Add missing documentation for button state, MIN
+ and MAX comments. Add Curses. to TABSIZE= and ESCDELAY= methods.
+ [Ruby 1.9 - Bug #4747]
+
+Wed May 25 09:35:31 2011 Eric Hodel <drbrain@segment7.net>
+
+ * lib/benchmark.rb: Restore nodoc for Benchmark::Job and
+ Benchmark::Report. [Ruby 1.9 - Bug #4726]
+
+Wed May 25 09:29:38 2011 Eric Hodel <drbrain@segment7.net>
+
+ * lib/net/pop.rb: Hide implementation details from RDoc.
+ [Ruby 1.9 - Bug #4711]
+
+Wed May 25 09:26:29 2011 Eric Hodel <drbrain@segment7.net>
+
+ * lib/net/ftp.rb: Add :nodoc: for private methods.
+ [Ruby 1.9 - Bug #4710]
+
+Wed May 25 09:19:17 2011 Eric Hodel <drbrain@segment7.net>
+
+ * ext/zlib/zlib.c: Fix Document-method declarations. Improve
+ Zlib::GzipFile's method catalog. [Ruby 1.9 - Bug #4695]
+
+Wed May 25 08:22:12 2011 Eric Hodel <drbrain@segment7.net>
+
+ * lib/erb.rb: Hide documentation for implementation details of ERB.
+ [Ruby 1.9 - Bug #4694]
+
+Wed May 25 07:58:14 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/tempfile.rb (Tempfile.{mkdir,rmdir}): revert for backward
+ compatibility.
+
+Wed May 25 07:13:12 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * spec/README: update the description.
+
+Wed May 25 07:12:16 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/tempfile.rb (Tempfile.{lock,unlock}_tempfile): refactor.
+
+Tue May 24 17:30:36 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * spec/README: fix typo.
+ patched by bowsersenior. https://github.com/ruby/ruby/pull/24
+
+Tue May 24 07:06:34 2011 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
+
+ * ext/tk/lib/tk.rb: fail to start Tk.mainloop (exit immediately) on
+ some environment (reported on [ruby-talk:381444]).
+
+ * ext/tk/lib/tk/canvas.rb: support creating a canvas item object from
+ an item ID number.
+
+ * ext/tk/lib/tk/image.rb: import documents which are pull-requested.
+ [Ruby 1.9 - Feature #4595]
+
+ * ext/tk/lib/tk/extconf.rb: search directories for 64bit library (e.g.
+ /usr/lib64), add some new configure options (see README.tcltklib),
+ and bug fix.
+
+ * ext/tk/lib/tk/README.tcltklib: modify docs for some new configure
+ options.
+
+Tue May 24 04:01:46 2011 Aaron Patterson <aaron@tenderlovemaking.com>
+
+ * lib/yaml.rb: switch default YAML engine to Psych, old syck engine
+ may be enabled via YAML::ENGINE.yamler = "syck". [ruby-core:36374]
+
+Mon May 23 09:45:26 2011 Hiroshi Nakamura <nahi@ruby-lang.org>
+
+ * include/ruby/defines.h (CASEFOLD_FILESYSTEM): Revert r30508. Forgot to
+ include this file in the commit r31692. __APPLE__ is not
+ CASEFOLD_FILESYSTEM again, from this time.
+
+Mon May 23 10:01:02 2011 Martin Bosslet <Martin.Bosslet@googlemail.com>
+
+ * ext/openssl/ossl_asn1.c: Do not parse zero-tagged values as EOC. Do
+ not let current length become negative for infinite length constructed
+ values. Support constructed values of length zero. Added tests.
+
+Mon May 23 09:19:53 2011 Eric Hodel <drbrain@segment7.net>
+
+ * lib/net/smtp.rb: Document Net::SMTP::Response. Patch by J.R. Garcia.
+ [Ruby 1.9 - Bug #4768]
+
+Mon May 23 09:03:52 2011 Shota Fukumori <sorah@tubusu.net>
+
+ * lib/test/unit/parallel.rb: Never Ignore SIGINT. When received
+ Interrupt, immediately puts result and exit. [ruby-dev:43571]
+
+ * lib/test/unit.rb: When received Interrupt, wait results from workers
+ and collect them. [ruby-dev:43571]
+
+Mon May 23 09:08:07 2011 Eric Hodel <drbrain@segment7.net>
+
+ * lib/mathn.rb: Improve documentation. Patch by Sandor Szucs.
+ [Ruby 1.9 - Bug #4767]
+
+Mon May 23 08:45:55 2011 Eric Hodel <drbrain@segment7.net>
+
+ * lib/ostruct.rb: Improve documentation. Patch by Franklin Webber.
+ [Ruby 1.9 - Bug #4761]
+
+Mon May 23 08:35:24 2011 Eric Hodel <drbrain@segment7.net>
+
+ * hash.c: Improve documentation of Hash#key. Patch by Utkarsh
+ Kukreti. [Ruby 1.9 - Bug #4760]
+
+Mon May 23 08:32:59 2011 Eric Hodel <drbrain@segment7.net>
+
+ * enumerator.c: Improve documentation. Patch by Dave Copeland.
+ [Ruby 1.9 - Bug #4757]
+
+Mon May 23 07:19:45 2011 Martin Bosslet <Martin.Bosslet@googlemail.com>
+
+ * NEWS (openssl): Infinite length support. Different behavior of
+ Constructive and Primitive constructors.
+
+Mon May 23 06:58:33 2011 Martin Bosslet <Martin.Bosslet@googlemail.com>
+
+ * ext/openssl/ossl_asn1.c: Forbid Constructives whose value is not an
+ Array to prevent segfault. Added test.
+
+Mon May 23 06:33:17 2011 Martin Bosslet <Martin.Bosslet@googlemail.com>
+
+ * ext/openssl/ossl_asn1.c: Forbid Constructive without infinite
+ length. This also prevents a segfault. Added test and improved
+ documentation.
+
+Mon May 23 05:58:14 2011 Martin Bosslet <Martin.Bosslet@googlemail.com>
+
+ * ext/openssl/ossl_asn1.c: Fix decoding of infinite length values.
+ Simplified ossl_asn1_decode0 by splitting it into three separate
+ functions. Add tests.
+ [Ruby 1.9 - Bug #4374][ruby-core:35123]
+
+Mon May 23 04:03:46 2011 Martin Bosslet <Martin.Bosslet@googlemail.com>
+
+ * ext/openssl/ossl_asn1.c (ossl_asn1_initialize): Allow creation of
+ Constructives with an explicit tag_class parameter without
+ automatically setting tagging to :EXPLICIT. Fixes a bug when encoding
+ infinite length primitive values.
+
+Mon May 23 04:03:46 2011 Martin Bosslet <Martin.Bosslet@googlemail.com>
+
+ * ext/openssl/ossl_asn1.c (ossl_asn1_cons_to_der): Add an additional
+ EOC for infinite length Constructives that are supposed to be encoded
+ with explicit tagging. Also tabify method correctly.
+
+Mon May 23 03:44:39 2011 Martin Bosslet <Martin.Bosslet@googlemail.com>
+
+ * ext/openssl/ossl_asn1.c (ossl_asn1data_to_der): Remove redundant
+ flag tmp_cons.
+
+Mon May 23 00:35:00 2001 Kenta Murata <mrkn@mrkn.jp>
+
+ * bignum.c (dump_bignum, bigmul1_balance, big_split, biglsh_bang),
+ (bigrsh_bang, big_split3, bigmul1_toom3, bigmul0): implement Toom3 (Toom-Cook)
+ multiplication.
+
+ * include/ruby/defines.h: add format prefixes for BDIGIT and BDIGIT_DBL.
+
+Sun May 22 23:24:02 2011 Martin Bosslet <Martin.Bosslet@googlemail.com>
+
+ * ext/openssl/ossl_asn1.c: Instead of rb_intern use static symbols to
+ improve performance.
+
+Sun May 22 21:56:51 2011 Martin Bosslet <Martin.Bosslet@googlemail.com>
+
+ * ext/openssl/ossl_asn1.c: Use OpenSSL constants V_ASN1_xxx instead of
+ hardcoded numbers for initializing class_tag_map.
+
+Sun May 22 21:29:29 2011 Hiroshi Nakamura <nahi@ruby-lang.org>
+
+ * include/ruby/defines.h (CASEFOLD_FILESYSTEM): Revert r30508. See #4255.
+ Now __APPLE__ is not CASEFOLD_FILESYSTEM again.
+
+ * load.c (loaded_feature_path, rb_feature_p, load_lock): Revert r30508.
+ See #4255. Make $LOADED_FEATURES scanning case-sensitive again.
+
+Sun May 22 18:59:27 2011 Hiroshi Nakamura <nahi@ruby-lang.org>
+
+ * ext/openssl/ossl_asn1.c(ossl_asn1_default_tag): avoid using RCLASS_SUPER
+ to make it compilable. Plus, tabify and change variable definition style.
+
+Sun May 22 18:26:43 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * gc.c (vm_xcalloc): use calloc provided by platforms.
+ fixes #4754
+
+Sun May 22 11:44:53 2011 Eric Hodel <drbrain@segment7.net>
+
+ * ext/pty/pty.c: Improve documentation. Patch by David Copeland.
+ [Ruby 1.9 - Bug #4756]
+
+Sun May 22 11:26:39 2011 Eric Hodel <drbrain@segment7.net>
+
+ * lib/timeout.rb: Improve documentation. Patch by David Copeland.
+ [Ruby 1.9 - Bug #4755]
+
+Sun May 22 11:21:41 2011 Eric Hodel <drbrain@segment7.net>
+
+ * lib/ipaddr.rb: Improve documentation. Patch by Sandor Szucs.
+ [Ruby 1.9 - Bug #4753]
+
+Sun May 22 11:14:40 2011 Eric Hodel <drbrain@segment7.net>
+
+ * lib/forwardable.rb: Document def_delegator. Patch by Sandor Szucs.
+ [Ruby 1.9 - Bug #4752]
+
+Sun May 22 11:11:41 2011 Eric Hodel <drbrain@segment7.net>
+
+ * lib/fileutils.rb: Document block behavior of FileUtils.cd. Patch by
+ Bil Kleb. [Ruby 1.9 - Bug #4751]
+
+Sun May 22 11:07:47 2011 Eric Hodel <drbrain@segment7.net>
+
+ * ext/curses/curses.c: Complete documentation. Patch by Vincent
+ Batts. [Ruby 1.9 - Bug #4748]
+
+Sun May 22 09:29:43 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * test/ruby/test_rubyoptions.rb (TestRubyOptions#test_set_program_name):
+ use spawn. it prevent that other tests inherit renamed $0.
+
+Sun May 22 08:57:13 2011 Martin Bosslet <Martin.Bosslet@googlemail.com>
+
+ * ext/openssl/ossl_asn1.c: Default tag lookup in constant time via hash
+ instead of previous linear algorithm.
+ [Ruby 1.9 - Feature #4309][ruby-core:34813]
+
+Sun May 22 07:54:16 2011 Martin Bosslet <Martin.Bosslet@googlemail.com>
+
+ * ext/openssl/ossl_digest.c: Explain DSS and DSS1 in documentation.
+
+Sun May 22 07:10:25 2011 Martin Bosslet <Martin.Bosslet@googlemail.com>
+
+ * test/openssl/test_pkey_dsa.rb: Add tests for sign/verify.
+
+Sun May 22 06:07:17 2011 Martin Bosslet <Martin.Bosslet@googlemail.com>
+
+ * test/openssl/test_x509cert.rb: Merge DSA-related tests from ruby_1_8
+ branch.
+
+Sun May 22 04:11:12 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * thread.c (Init_Thread): add a code comment why the meaningless
+ line is necessary.
+
+Sun May 22 01:35:12 2011 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * ext/date/date_core.c: modified documentation.
+
+Sat May 21 22:46:26 2011 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * ext/date/date_strftime(date_strftime_with_tmx): "%v" means "%e-%b-%Y".
+
+Sat May 21 22:14:35 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * io.c (rb_io_extract_modeenc): accept combination hash and
+ File::Constants. (eg. File.open('yo', :mode => File::WRONLY))
+ [Feature #4742][ruby-core:36338]
+ * test/ruby/test_io.rb (TestIO#test_open_mode): new test.
+
+Sat May 21 21:44:14 2011 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * test/date/test_switch_hitter.rb: new.
+
+Sat May 21 21:18:29 2011 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * ext/date/date_{core,parse}.c: moved nearly all core code from ext/date/lib.
+ * ext/date/lib/{date,date/format}.rb: removed nearly all code.
+
+Sat May 21 02:58:46 2011 Eric Hodel <drbrain@segment7.net>
+
+ * ext/.document: Add curses to documented extensions.
+ * ext/curses/curses.c: Improve documentation. Patch by Vincent Batts.
+ [Ruby 1.9 - Bug #4747]
+
+Sat May 21 02:51:01 2011 Eric Hodel <drbrain@segment7.net>
+
+ * ext/bigdecimal/lib/bigdecimal/util.rb: Improve documentation. Patch
+ by Pete Higgins. [Ruby 1.9 - Bug #4746]
+
+Sat May 21 02:44:10 2011 Eric Hodel <drbrain@segment7.net>
+
+ * ext/bigdecimal/lib/bigdecimal/jacobian.rb: Document isEqual. Patch
+ by Kuba Fietkiewicz. [Ruby 1.9 - Bug #4744]
+
+Sat May 21 02:22:34 2011 Eric Hodel <drbrain@segment7.net>
+
+ * ext/date/lib/date/format.rb: Document date formats. Patch by
+ Clinton Nixon. [Ruby 1.9 - Bug #4743]
+
+Fri May 20 05:15:19 2011 Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
+
+ * gc.c: Fix build on m68k by 'error: too few arguments to
+ function 'mark_locations_array''.
+
+Fri May 20 04:23:42 2011 Eric Hodel <drbrain@segment7.net>
+
+ * lib/scanf.rb: Improve documentation. Patch by Gabe McArthur.
+ [Ruby 1.9 - Bug #4735]
+
+Fri May 20 00:58:01 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * enc/trans/ibm737-tbl.rb: greek code page. fixes #4738
+
+Thu May 19 14:44:05 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * test/ruby/test_signal.rb (test_signal_requiring): skip on Windows.
+ we can send SIGINT only to pid 0 and the process itself.
+
+Thu May 19 09:07:08 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib: revert r31635-r31638 and untabify with expand(1).
+
+Thu May 19 07:47:26 2011 Martin Bosslet <Martin.Bosslet@googlemail.com>
+
+ * test/openssl/test_pkey_rsa.rb: Add tests for sign/verify.
+
+Thu May 19 07:19:16 2011 Martin Bosslet <Martin.Bosslet@googlemail.com>
+
+ * ext/openssl/ossl_pkey.c: Add documentation.
+
+Thu May 19 07:06:56 2011 Eric Hodel <drbrain@segment7.net>
+
+ * lib/benchmark.rb: Fix indentation.
+ * lib/net/imap.rb: Fix indentation of regular expressions.
+
+Thu May 19 06:36:11 2011 Eric Hodel <drbrain@segment7.net>
+
+ * lib/net/imap.rb: Fix indentation of EOF for heredoc.
+ * lib/debug.rb (Commands): Fix indentation of EOHELP for heredoc.
+
+Thu May 19 06:30:38 2011 Eric Hodel <drbrain@segment7.net>
+
+ * lib/mkmf.rb: Fix indentation of EOM for heredoc.
+
+Thu May 19 06:16:41 2011 Eric Hodel <drbrain@segment7.net>
+
+ * lib: Convert tabs to spaces for ruby files per
+ http://bugs.ruby-lang.org/projects/ruby/wiki/DeveloperHowto#coding-style
+ Patch by Steve Klabnik [Ruby 1.9 - Bug #4730]
+ Patch by Jason Dew [Ruby 1.9 - Feature #4718]
+
+Thu May 19 06:06:07 2011 Eric Hodel <drbrain@segment7.net>
+
+ * lib/cgi/util.rb: Improve documentation. Patch by Clinton Nixon.
+ [Ruby 1.9 - Bug #4733]
+ * lib/cgi/core.rb: ditto
+ * lib/cgi/cookie.rb: ditto
+
+Thu May 19 06:02:21 2011 Eric Hodel <drbrain@segment7.net>
+
+ * lib/tempfile.rb: Document Dir.mkdir and Dir.rmdir. Patch by Clinton
+ Nixon. [Ruby 1.9 - Bug #4728]
+
+Thu May 19 05:57:52 2011 Eric Hodel <drbrain@segment7.net>
+
+ * encoding.c: Improve documentation for Encoding#default_external and
+ Encoding#default_internal.
+
+Wed May 18 22:45:26 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/io/console/lib/console/size.rb (IO#console_size): new
+ method. (EXPERIMENTAL)
+
+Wed May 18 22:41:51 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * internal.h: add for internal use only.
+
+Wed May 18 22:36:43 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * eval.c (setup_exception): internal exception should be hidden
+
+Wed May 18 20:25:04 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * lib/timeout.rb (Timeout#timeout): don't leak "execution expired"
+ exception. [Bug #4283] [ruby-core:34534].
+
+Wed May 18 06:09:24 2011 Eric Hodel <drbrain@segment7.net>
+
+ * lib/cmath.rb: Add some examples and improve documentation. Patch by
+ Sandor Szucs. [Ruby 1.9 - Bug #4727]
+
+Wed May 18 05:40:31 2011 Eric Hodel <drbrain@segment7.net>
+
+ * lib/benchmark.rb: Remove nodoc from Benchmark::Job and
+ Benchmark::Report. Patch by Sandor Szucs. [Ruby 1.9 - Bug #4726]
+
+Wed May 18 05:29:26 2011 Eric Hodel <drbrain@segment7.net>
+
+ * lib/webrick/compat.rb: Improve documentation. Patch by Sandor
+ Szucs. [Ruby 1.9 - Bug #4725]
+
+Wed May 18 05:10:35 2011 Eric Hodel <drbrain@segment7.net>
+
+ * lib/tracer.rb: Improve documentation. Patch by Richard Ramsden.
+ [Ruby 1.9 - Feature #4720]
+
+Wed May 18 04:53:41 2011 Eric Hodel <drbrain@segment7.net>
+
+ * lib/cmath.rb: Improve documentation. Patch by Jason Dew.
+ [Ruby 1.9 - Feature #4717]
+
+Wed May 18 04:50:24 2011 Eric Hodel <drbrain@segment7.net>
+
+ * lib/net/ftp.rb: Improve documentation. Patch by Vincent Batts.
+ [Ruby 1.9 - Bug #4710]
+
+Wed May 18 03:14:49 2011 Eric Hodel <drbrain@segment7.net>
+
+ * test/test_singleton.rb: Add tests from lib/singleton.rb. Patch by
+ Pete Higgins. [Ruby 1.9 - Bug #4715]
+
+Wed May 18 03:03:07 2011 Eric Hodel <drbrain@segment7.net>
+
+ * lib/singleton.rb: Improve documentation. Patch by Pete Higgins.
+ [Ruby 1.9 - Bug #4709]
+
+Tue May 17 21:24:04 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * thread.c (rb_mutex_lock): remove remove_signal_thread_list() call.
+ It's meaningless because lock_interrupt doesn't call
+ add_signal_thread_list().
+
+Tue May 17 20:20:49 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * vm_core.h (rb_thread_struct): add volatile to
+ transition_for_lock because it is not protected by lock.
+
+Tue May 17 20:08:53 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * LEGAL (missing/{elf,tgamma,lgamma_r}.c): they've been replaced by
+ public domain implementations.
+
+ * LEGAL (vsnprintf.c): it has moved to srcdir from missing/.
+
+ * LEGAL (missing/crypt.c): list its original license.
+
+Tue May 17 19:54:26 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * LEGAL (configure): add missing/setproctitle.c
+
+Tue May 17 19:35:01 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ Fix FreeBSD test failure.
+
+ * test/ruby/test_rubyoptions.rb (TestRubyOptions#test_set_program_name):
+ use ps -o command instead of ps -o cmd. FreeBSD doesn't support
+ -o cmd option.
+
+Tue May 17 08:04:26 2011 Martin Bosslet <Martin.Bosslet@googlemail.com>
+
+ * ext/openssl/ossl_digest.c: Add documentation.
+
+Tue May 17 07:14:58 2011 Eric Hodel <drbrain@segment7.net>
+
+ * lib/net/http.rb: Improve documentation of proxy configuration
+ methods. Patch by Alf Mikula. [Ruby 1.9 - Bug #4714]
+
+Tue May 17 07:09:01 2011 Eric Hodel <drbrain@segment7.net>
+
+ * lib/net/pop.rb: Improve documentation. Patch by Vincent Batts.
+ [Ruby 1.9 - Bug #4711]
+ * lib/net/telnet.rb: ditto
+
+Tue May 17 07:00:41 2011 Eric Hodel <drbrain@segment7.net>
+
+ * lib/net/http.rb: Fix nodoc for Net::HTTP::version_1_1?. Patch by
+ Alf Mikula. [Ruby 1.9 - Bug #4713]
+
+Tue May 17 06:56:26 2011 Eric Hodel <drbrain@segment7.net>
+
+ * lib/optparse.rb: Add link to make_switch to improve documentation.
+ Patch by David Copeland. [Ruby 1.9 - Bug #4708]
+
+Tue May 17 06:50:40 2011 Eric Hodel <drbrain@segment7.net>
+
+ * lib/observer.rb: Improve documentation. Patch by David Copeland.
+ [Ruby 1.9 - Bug #4707]
+
+Tue May 17 06:42:53 2011 Eric Hodel <drbrain@segment7.net>
+
+ * lib/logger.rb: Improve documentation. Patch by David Copeland.
+ [Ruby 1.9 - Bug #4706]
+
+Tue May 17 06:28:14 2011 Eric Hodel <drbrain@segment7.net>
+
+ * lib/gserver.rb: Improve documentation. Patch by David Copeland.
+ [Ruby 1.9 - Bug #4705]
+
+Tue May 17 06:21:15 2011 Eric Hodel <drbrain@segment7.net>
+
+ * lib/cgi.rb: Add toplevel documentation to class CGI
+ * lib/cgi/session.rb: Add overview documentation to CGI::Cookie
+ * lib/cgi/html.rb: Don't add CGI::TagMaker documentation to CGI.
+ Patch by David Copeland. [Ruby 1.9 - Bug #4704]
+ * lib/cgi/core.rb: Clean up CGI documentation. Patch by David
+ Copeland. [Ruby 1.9 - Bug #4704]
+ * lib/cgi/cookie.rb: Clean up CGI::Cookie documentation. Patch by
+ David Copeland. [Ruby 1.9 - Bug #4704]
+
+Tue May 17 05:52:30 2011 Eric Hodel <drbrain@segment7.net>
+
+ * ext/digest: Improve documentation of Digest, Digest::HMAC and
+ Digest::SHA2. Patch by Pete Higgins. [Ruby 1.9 - Bug #4702]
+
+Tue May 17 03:51:42 2011 Eric Hodel <drbrain@segment7.net>
+
+ * lib/abbrev.rb: Hide copyright and revision information from RDoc.
+ Inspired by patch from David Copeland, bug #4703.
+
+Tue May 17 03:33:21 2011 Eric Hodel <drbrain@segment7.net>
+
+ * lib/timeout.rb (module Timeout): Hide internal constants. Patch by
+ Pete Higgins. [Ruby 1.9 - Bug #4701]
+
+Mon May 16 11:21:09 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * configure.in, win32/Makefile.sub (RUBY_SO_NAME): add CPU as prefix
+ of RUBY_SO_NAME on x64/ia64 mswin/mingw.
+ [Feature #4602]
+
+Mon May 16 08:00:05 2011 Eric Hodel <drbrain@segment7.net>
+
+ * lib/rdoc.rb: Update to RDoc 3.6.1, allows OpenSSL::Digest to be
+ found.
+
+Mon May 16 05:49:54 2011 Eric Hodel <drbrain@segment7.net>
+
+ * lib/drb/acl.rb: Add documentation.
+
+Mon May 16 05:13:20 2011 Martin Bosslet <Martin.Bosslet@googlemail.com>
+
+ * ext/openssl/ossl_asn1.c: Add documentation.
+
+Mon May 16 00:32:05 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * test/ruby/test_signal.rb (TestSignal#test_signal_process_group):
+ skip if the platform doesn't have :pgroup capability. (i.e. skip
+ if mswin32)
+
+Sun May 15 23:53:31 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * include/ruby/intern.h: resurrect old rb_fd_copy().
+ * thread.c (rb_fd_copy): ditto.
+
+Sun May 15 23:45:11 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * include/ruby/intern.h: remove rb_fd_copy() to rb_fd_dup() and
+ rb_w32_fdcopy() to rb_w32_fd_dup().
+ * win32/win32.c: ditto.
+ * thread.c: ditto.
+
+Sun May 15 22:26:39 2011 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
+
+ * signal.c (rb_f_kill): accept '-SIGXXX' style signal with Symbol or
+ implicit convertion with #to_str. [ruby-dev:43169] fixes #4362
+ * test/ruby/test_signal.rb (test_signal_process_group): add a test
+ for send signal to process group.
+
+Sun May 15 21:22:35 2011 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
+
+ * cont.c (cont_init): clear macihne_stack_start/end of saved thread to
+ prevent mark machine stack of GC'ed Thread. root Fiber is not
+ initialized by fiber_init().
+ based on a patch by Serge Balyuk [ruby-core:35891] fixes #4612
+ * test/ruby/test_fiber.rb (test_gc_root_fiber): add test for it.
+
+Sun May 15 21:04:29 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * transcode.c (econv_init): revert r31353. [ruby-dev:43512]
+
+Sun May 15 03:39:35 2011 Eric Hodel <drbrain@segment7.net>
+
+ * ext/zlib/zlib.c: Improve documentation. Patch by Vincent Batts.
+ [Ruby 1.9 - Bug #4695]
+
+Sun May 15 03:23:46 2011 Eric Hodel <drbrain@segment7.net>
+
+ * lib/erb.rb: Document ERB::Compiler. Patch by Simon Chiang.
+ [Ruby 1.9 - Bug #4694]
+
+Sun May 15 00:58:47 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ fix mswin32 build error.
+
+ * missing/setproctitle.c: add #ifdef HAVE_UNISTD_H.
+ * win32/Makefile.sub (MISSING): add setproctitle.obj
+
+Sat May 14 22:45:28 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * missing/setproctitle.c: add to include "ruby/util.h".
+
+Sat May 14 19:52:22 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * test/ruby/test_rubyoptions.rb (TestRubyOptions#test_set_program_name):
+ add for $0 test.
+
+Sat May 14 19:50:46 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * missing/setproctitle.c (compat_init_setproctitle): use
+ ruby_strdup() instead of strdup().
+
+Sat May 14 19:37:31 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * include/ruby/missing.h: add setproctitle() declaration.
+ * missing/setproctitle.c: added.
+ * configure.in: add check for missing/setproctitle.c.
+
+ * ruby.c (ruby_process_options): add to call compat_init_setproctitle().
+ * ruby.c (set_arg0): remove all platform specific code. it's
+ moved to missing/setproctitle.c.
+ * ruby.c (origarg): remove len field. It's no longer used.
+ * ruby.c (get_arglen): removed.
+
+ This patch makes a lot of cleanup set_arg0 related code and fixes
+ [Feature #4689].
+
+Sat May 14 17:42:21 2011 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
+
+ * process.c (rb_proc_times): improve documentation.
+ [ruby-core:35785] fixes #4581, reported by Andrew Grimm.
+
+Sat May 14 12:12:54 2011 Martin Bosslet <Martin.Bosslet@googlemail.com>
+
+ * test/openssl/test_pkey_dsa.rb: Add basic tests and tests that
+ ensure new public key PEM encoding behavior and ensure backward
+ compatibility.
+ [Ruby 1.9 - Bug #4422] [ruby-core:35328]
+ * test/openssl/test_pkey_rsa.rb: Remove line with 'puts'.
+
+Sat May 14 12:06:49 2011 Eric Hodel <drbrain@segment7.net>
+
+ * lib/rdoc/context.rb (class RDoc): Fix infinite loop caused by
+ re-encountering BasicObject.
+
+Sat May 14 10:32:36 2011 Martin Bosslet <Martin.Bosslet@googlemail.com>
+
+ * test/openssl/test_pkey_rsa.rb: Add tests that ensure new public key
+ encoding behavior and also ensure backward compatibility.
+ [Ruby 1.9 - Bug #4421] [ruby-core:35327]
+
+Sat May 14 09:50:10 2011 Eric Hodel <drbrain@segment7.net>
+
+ * lib/yaml/dbm.rb: Add documentation. Patch by Justin Collins.
+ [Ruby 1.9 - Bug #4693]
+ * lib/yaml/store.rb: ditto
+
+Sat May 14 09:31:43 2011 Eric Hodel <drbrain@segment7.net>
+
+ * lib/rdoc.rb: Updated to RDoc 3.6
+
+Sat May 14 07:30:29 2011 Aaron Patterson <aaron@tenderlovemaking.com>
+
+ * ext/psych/lib/psych.rb: released a new gem, so increasing version.
+
+Sat May 14 05:08:32 2011 Martin Bosslet <Martin.Bosslet@googlemail.com>
+
+ * ext/openssl/ossl_digest.c
+ * ext/openssl/ossl_pkey.c
+ * ext/openssl/ossl_pkey.h
+ * test/openssl/pkey/test_pkey_rsa.rb
+ Reverted premature commit. Sorry for the noise!
+
+Sat May 14 05:02:58 2011 Eric Hodel <drbrain@segment7.net>
+
+ * lib/uri.rb: Add toplevel documentation. Patch by Vincent Batts.
+ [Ruby 1.9 - Bug #4690]
+
+Sat May 14 04:19:06 2011 Martin Bosslet <Martin.Bosslet@googlemail.com>
+
+ * NEWS: Describe altered behaviour for RSA and DSA public key
+ encoding. [Ruby 1.9 - Bug #4421, Bug #4422]
+ [ruby-core:35327,35328]
+
+Sat May 14 02:57:52 2011 Eric Hodel <drbrain@segment7.net>
+
+ * lib/ipaddr.rb (unless Socket): Document valid*? methods. Patch by
+ Sebastian Martinez. [Ruby 1.9 - Feature #4687]
+
+Sat May 14 02:54:04 2011 Eric Hodel <drbrain@segment7.net>
+
+ * lib/rexml/functions.rb: Add some documentation for REXML::Functions.
+ Patch by Sebastian Martinez. [Ruby 1.9 - Feature #4688]
+
+Sat May 14 02:51:42 2011 Eric Hodel <drbrain@segment7.net>
+
+ * lib/resolv.rb: Hide private method and state-tracking constants from
+ RDoc. Patch by Mark Turner. [Ruby 1.9 - Feature #4691]
+
+Fri May 13 19:23:21 2011 URABE Shyouhei <shyouhei@ruby-lang.org>
+
+ * numeric.c (flo_coerce): Add #flo_coerce documentation.
+ Patch by Sebastian Martinez.
+ https://github.com/ruby/ruby/pull/21
+
+Fri May 13 18:42:22 2011 URABE Shyouhei <shyouhei@ruby-lang.org>
+
+ * README.EXT: fix typo. Patch by William Blackerby.
+ https://github.com/ruby/ruby/pull/19
+
+ * README.EXT.ja: ditto.
+
+Fri May 13 15:22:34 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * win32/win32.c (rb_w32_select): check invalid handle before doing
+ select operations. see [ruby-dev:43513], [ruby-dev:43535]
+
+Fri May 13 08:34:00 2011 Eric Hodel <drbrain@segment7.net>
+
+ * lib/rdoc/rdoc.rb: Output summary after documentation report.
+ * lib/rdoc/stats/normal.rb: Don't output information for users when
+ we're not on a TTY
+
+Fri May 13 07:49:02 2011 Eric Hodel <drbrain@segment7.net>
+
+ * lib/fileutils.rb: Hide internal methods from RDoc. Patch by Darragh
+ Curran. [Ruby 1.9 - Bug #4684]
+
+Fri May 13 07:36:23 2011 Eric Hodel <drbrain@segment7.net>
+
+ * lib/webrick/httpservlet/erbhandler.rb: Add documentation.
+
+Fri May 13 07:04:33 2011 Eric Hodel <drbrain@segment7.net>
+
+ * lib/mathn.rb: Fix indentation. Patch by Jason Dew.
+ [Ruby 1.9 - Feature #4682]
+
+Fri May 13 06:50:43 2011 Eric Hodel <drbrain@segment7.net>
+
+ * lib/mathn.rb: Add documentation. Patch by Jason Dew. [Ruby 1.9 -
+ Feature #4667]
+
+Fri May 13 05:44:19 2011 Eric Hodel <drbrain@segment7.net>
+
+ * lib/logger.rb (class Logger): Document Logger#datetime_format.
+ Patch by Sergio Gil Perez de la Manga. [Ruby 1.9 - Bug #4678]
+
+Fri May 13 05:39:11 2011 Eric Hodel <drbrain@segment7.net>
+
+ * re.c (Init_Regexp): Document option constants. Patch by Vincent
+ Batts. [Ruby 1.9 - Bug #4677]
+ * lib/uri/common.rb (module URI): Documentation for URI. Patch by
+ Vincent Batts. [Ruby 1.9- Bug #4677]
+ * lib/uri/ftp.rb (module URI): ditto
+ * lib/uri/generic.rb (module URI): ditto
+ * lib/uri/http.rb (module URI): ditto
+ * lib/uri/https.rb (module URI): ditto
+ * lib/uri/ldap.rb (module URI): ditto
+ * lib/uri/ldaps.rb (module URI): ditto
+ * lib/uri/mailto.rb (module URI): ditto
+ * process.c (Init_process): Document Process constants. Patch by
+ Vincent Batts. [Ruby 1.9- Bug #4677]
+
+Fri May 13 05:16:38 2011 Eric Hodel <drbrain@segment7.net>
+
+ * lib/rss/atom.rb (module RSS): Document URIs. Patch by Mark Turner.
+ [Ruby 1.9 - #4671]
+ * lib/rss/rss.rb (module RSS): Document exception classes. Patch by
+ Mark Turner. [Ruby 1.9 - #4671]
+
+Fri May 13 02:15:18 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * io.c (select_internal): remove unused variable (interrupt_flag).
+
+Thu May 12 18:24:34 2011 Kouhei Sutou <kou@clear-code.com>
+
+ * configure.in: limit to "T" type for prefix of external symbols
+ because x86_64-w64-mingw32-gcc on Debian GNU/Linux generates the
+ following symbol:
+ 0000000068483390 D _GLOBAL__F__conftest_external
+
+ Approved by nobu.
+
+Thu May 12 14:50:52 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * test/dl/test_base.rb (Fiddle::LIBC_SO): its always msvc*.dll on
+ mswin/mingw.
+
+Thu May 12 14:47:53 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * lib/mkmf.rb (Logging.postpone): copy only when temporary logfile
+ exists.
+
+Thu May 12 12:24:22 2011 Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
+
+ * ext/openssl/ossl_ssl.c: By trunk@31346, function check of SSLv2 is
+ executed.
+ However, the problem is not revised in this.
+ This adds the control of using function of SSLv2 in made macro by
+ function check.
+
+Thu May 12 08:10:46 2011 Eric Hodel <drbrain@segment7.net>
+
+ * lib/set.rb (class Set): Add nodoc to internal-use methods. Patch
+ by Pete Higgins. [Ruby 1.9 - Bug #4665]
+
+Thu May 12 08:01:14 2011 Martin Bosslet <Martin.Bosslet@googlemail.com>
+
+ * ext/openssl/ossl_pkey_ec.c: Allow encryption when PEM-encoding
+ Elliptic Curve private keys.
+ [ruby-core:35329] [Bug #4423]
+
+Thu May 12 07:54:59 2011 Eric Hodel <drbrain@segment7.net>
+
+ * object.c (rb_obj_equal): Add documentation. Patch by Vincent Batts.
+ [Ruby 1.9 - Bug #4664]
+ * lib/rexml: ditto
+ * lib/mkmf.rb: ditto
+ * ext/socket/lib/socket.rb: ditto
+
+Thu May 12 07:30:08 2011 Eric Hodel <drbrain@segment7.net>
+
+ * Various .document files: Update .document files to match files which
+ have documentation.
+
+Thu May 12 07:18:45 2011 Martin Bosslet <Martin.Bosslet@googlemail.com>
+
+ * ext/openssl/ossl_pkey_dsa.c: Use generic X.509 SubjectPublicKeyInfo
+ format for PEM-encoding DSA public keys.
+ [ruby-core:35328] [Bug #4422]
+
+Thu May 12 06:27:31 2011 Martin Bosslet <Martin.Bosslet@googlemail.com>
+
+ * ext/openssl/ossl_pkey_rsa.c: Use generic X.509 SubjectPublicKeyInfo
+ format for encoding RSA public keys.
+ [ruby-core:35327] [Bug #4421]
+
+Wed May 11 19:45:27 2011 Keiju Ishitsuka <keiju@ishitsuka.com>
+
+ * lib/forwardable.rb: support 'delegate :foo => :bar' for to meet
+ by specification of RDOC.
+
+Wed May 11 08:36:38 2011 Eric Hodel <drbrain@segment7.net>
+
+ * lib/webrick: Add documentation for WEBrick::HTTPAuth
+
+Wed May 11 03:06:35 2011 Eric Hodel <drbrain@segment7.net>
+
+ * lib/rss.rb: Add documentation for RSS. Patch by Steve Klabnik.
+ [Ruby 1.9 - Bug #4663]
+
+Tue May 10 14:50:32 2011 Shota Fukumori <sorah@tubusu.net>
+
+ * lib/test/unit.rb: Add option for hiding skip messages when test
+ ends. #4657
+
+ * test/testunit/test_hideskip.rb, test/testunit/test4test_hideskip.rb:
+ test for above.
+
+Tue May 10 10:53:04 2011 Eric Hodel <drbrain@segment7.net>
+
+ * common.mk (rdoc): Add rdoc-coverage rule
+
+Tue May 10 09:13:21 2011 Eric Hodel <drbrain@segment7.net>
+
+ * lib/webrick: Add Documentation
+
+Tue May 10 04:22:09 Eric Hodel <drbrain@segment7.net>
+
+ * lib/webrick/log.rb: Hide copyright info from ri
+ * lib/webrick/httpstatus.rb: ditto
+ * lib/webrick/htmlutils.rb: ditto
+ * lib/webrick/httpversion.rb: ditto
+ * lib/webrick/version.rb: ditto
+ * lib/webrick/httpauth/userdb.rb: ditto
+ * lib/webrick/httpauth/authenticator.rb: ditto
+ * lib/webrick/accesslog.rb: ditto
+
+Mon May 9 20:57:13 2011 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * test/ruby/test_{complex,rational}.rb: added tests.
+
+Mon May 9 20:29:44 2011 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * complex.c (string_to_c_internal): a refactoring.
+
+Mon May 9 18:33:05 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * string.c: Improve documentation for String#start_with? and
+ String#end_with?. fixes #4652
+ patched by Andrew Grimm <andrew.j.grimm at gmail.com>
+
+Mon May 9 13:49:00 2011 Kenta Murata <mrkn@mrkn.jp>
+
+ * complex.c (string_to_c_internal): support scientific notation.
+ patched by Tinco Andringa. https://github.com/ruby/ruby/pull/16
+ [ruby-core:36046][Bug #4655]
+
+Mon May 9 11:52:48 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * numeric.c (int_ord): remove K&R style.
+ patched by Daehyub Kim. https://github.com/ruby/ruby/pull/17
+
+Sun May 8 22:17:24 2011 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * test/ruby/test_{complex2,complexrational}.rb: use skip.
+ * test/date/*.rb: ditto.
+
+Sun May 8 21:02:31 2011 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * test/ruby/test_{complex2,complexrational}.rb: NEVER SKIP.
+
+Sun May 8 21:01:21 2011 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * test/date/test_date_base.rb: fixed.
+
+Sun May 8 20:54:11 2011 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * test/date/*.rb: NEVER SKIP.
+
+Sun May 8 20:37:33 2011 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * test/date/*.rb: reverted 31432.
+
+Sun May 8 20:32:43 2011 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * test/date/*.rb: reverted 31483.
+
+Sun May 8 19:39:16 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * thread_pthread.c (native_cond_timedwait): add to care EINTR.
+ * thread_pthread.c (thread_timer): remove EINTR check.
+
+Sun May 8 19:04:15 2011 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * lib/time.rb (xmlschema): avoid passing any negative numbers.
+
+Sun May 8 18:40:03 2011 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * ext/date/date_{parse,strptime}.c: introduced some macros.
+
+Sun May 8 17:17:13 2011 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * test/date/*.rb: use skip /w messages.
+
+Sun May 8 17:04:55 2011 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * ext/date/lib/date/format.rb (_httpdate): omitted to call zone_to_diff.
+
+Sun May 8 16:56:19 2011 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * ext/date/date_core.c (date_s_test_*): use macros.
+
+Sun May 8 10:24:16 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * thread_pthread.c: cleanup signal_thread_list related ifdef.
+ 1) we don't have to use #ifdef FOO-PLATFORM directly 2) About
+ half #ifdef didn't care symbian properly.
+
+Sun May 8 05:19:37 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * test/io/wait/test_io_wait.rb: Linux socketpair(2) only support
+ AF_UNIX, but windows socketpair doesn't support it. we can't
+ avoid platform check. sigh!
+
+Sun May 8 00:13:05 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * test/io/wait/test_io_wait.rb: use Socket.pair instead of pipe.
+ Windows can only treat a socket.
+
+Sat May 7 22:43:48 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * thread.c (rb_fd_zero): remove redundant zero fill.
+
+Sat May 7 22:38:04 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * thread.c (rb_fd_init): remove volatile qualifier.
+
+Sat May 7 22:34:29 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * thread.c (rb_fd_init_copy): new internal api. It provide efficient
+ copy constructor semantics.
+ * thread.c (do_select): use rb_fd_init_copy().
+
+Sat May 7 15:18:06 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ fix incorrect native_cond_signal call when deadlock was detected.
+
+ * thread.c (lock_func): decrement cond_waiting if timeout was happen.
+
+Sat May 7 18:28:37 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * thread_pthread.c (USE_MONOTONIC_COND): check the availability
+ more strictly.
+
+ * thread_pthread.h (rb_thread_cond_t): ditto.
+
+Sat May 7 15:15:10 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ fix win32 native_cond_timedwait() makes SIGSEGV.
+
+ * thread_win32.h (rb_thread_cond_struct): add prev field instead of
+ last. (ie cond_event_entry is now using double linked list instead of
+ single)
+ * thread_win32.c (cond_event_entry): add prev field.
+
+ * thread_win32.c (__cond_timedwait): remove entry properly if timeout
+ was happen.
+
+ * thread_win32.c (native_cond_signal): change for double linked list.
+ * thread_win32.c (native_cond_broadcast): ditto.
+ * thread_win32.c (native_cond_initialize): ditto.
+
+Sat May 7 12:41:04 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ fix mutex deadlock test hang-up.
+
+ * thread_win32.c (abs_timespec_to_timeout_ms): fix 1000x calculation
+ mistake. (ie fix hang-up native_cond_timedwait())
+
+Sat May 7 03:14:13 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ sleep_cond use monotonic time if possible.
+
+ * thread_pthread.c (native_thread_init): change sleep_cond
+ attribute to monotonic.
+ * thread_pthread.c (native_sleep): use native_cond_timeout().
+
+ * thread_pthread.c (native_cond_timeout): add overflow care.
+ * thread_win32.c (native_cond_timeout): ditto.
+
+Sat May 7 02:49:12 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ fix win32 compile error.
+
+ * thread_win32.c (RB_CONDATTR_CLOCK_MONOTONIC): define
+ RB_CONDATTR_CLOCK_MONOTONIC always.
+ * thread_pthread.c (RB_CONDATTR_CLOCK_MONOTONIC): ditto.
+
+Sat May 7 02:29:41 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ mutex: deadlock check timeout use monotonic time.
+
+ * thread_pthread.c (native_cond_timeout): new internal api.
+ it calculate a proper time for argument of native_cond_timedwait().
+ * thread_win32.c (native_cond_timeout): ditto.
+
+ * thread_pthread.c (thread_timer): use native_cond_timeout()
+ instead of get_ts.
+ * thread.c (lock_func): ditto.
+
+ * thread_pthread.c (get_ts): removed. use native_cond_timeout().
+ * thread.c (init_lock_timeout): ditto.
+
+Sat May 7 01:54:21 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * thread_pthread.c (get_ts): add monotonic clock capability.
+ * thread_pthread.c (rb_thread_create_timer_thread): use monotonic
+ clock if possible.
+
+Sat May 7 01:43:37 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * thread_pthread.h (rb_thread_cond_t): add clockid field. it's
+ no longer an alias of pthread_cond_t.
+ * thread_pthread.c: adapt new rb_thread_cond_t type.
+ * thread.c (mutex_alloc): ditto.
+ * thread_win32.c (native_cond_initialize): ditto.
+ * configure.in: add check for pthread_cond_attr_setclock() and
+ clockid_t type.
+
+Fri May 6 23:29:47 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * thread.c (rb_wait_for_single_fd): use ppoll() instead of poll()
+ if possible. based on a patch from Eric Wong. [ruby-core:36003].
+
+Fri May 6 23:13:43 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * configure.in: remove nanosleep check. we no longer use it.
+ r20124 removed last usage.
+
+Fri May 6 22:35:56 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/syck/rubyext.c (mktime_do): extra digits are not used.
+
+Fri May 6 17:43:07 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * ext/syck/rubyext.c (mktime_do): remove unused variable offset.
+
+ * ext/syck/syck.h: use #ifdef instead of #if DEBUG.
+
+Fri May 6 16:27:33 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * ext/date/date_core.c (DAY_IN_NANOSECONDS): refix: 31438.
+ check with LONG_MAX and cast as long; without this the calculation
+ will be done as int and overflow.
+
+Fri May 6 15:01:11 2011 URABE Shyouhei <shyouhei@ruby-lang.org>
+
+ * ext/syck/rubyext.c (mktime_do): avoid buffer overrun, by
+ silently ignoring lesser significant digits. Required buffer
+ length can be computable so you might at first think of
+ allocating enough memory space on the fly using alloca(). That
+ is a wrong idea because when using alloca there is always risk
+ of integer overflow. A function that accepts outer-process
+ resources like this should not blindly trust its inputs. In
+ this particular case we just want to generate milliseconds
+ resolution by strtod() so the string in question needs no more
+ length than what we originally have. Ignoring lesser
+ significant digits should suffice I believe.
+
+Fri May 6 14:25:53 2011 Tinco Andringa <mail@tinco.nl>
+
+ * ext/syck/rubyext.c (mktime_do): YAML.load time correctly parse
+ usecs smaller than 1 fixes #4571
+
+Thu May 5 22:23:34 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * thread_pthread.c (native_mutex_reinitialize_atfork): removed
+ unused macro.
+ * thread_win32.c (native_mutex_reinitialize_atfork): ditto.
+
+Thu May 5 22:09:39 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/date/date_core.c (DAY_IN_NANOSECONDS): long long int is not
+ available on all platforms.
+
+Thu May 5 17:36:31 2011 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
+
+ * eval.c (frame_func_id): store result of method_entry_of_iseq() to
+ cfp->me because method_entry_of_iseq() might become expensive.
+
+Thu May 5 15:03:51 2011 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
+
+ * eval.c (frame_func_id): __method__ return different name from
+ methods defined by Module#define_method with a same block.
+ [ruby-core:35386] fixes #4606
+ * eval.c (method_entry_of_iseq): new helper function. search control
+ frame stack for a method entry which has given iseq.
+ * test/ruby/test_method.rb: add tests for #4606
+
+Wed May 4 22:13:09 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * benchmark/bm_vm4_pipe.rb: Reduced iterations. Too slow benchmark
+ is bad.
+ * benchmark/bm_vm4_thread_pass.rb: ditto.
+
+Wed May 4 22:08:22 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * test/date/test_date_base.rb: don't use no message skip().
+
+Wed May 4 21:11:28 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * benchmark/bm_io_select2.rb: reduce number of using file
+ descriptors. because gdb need some fds.
+
+Wed May 4 19:00:59 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * thread.c (rb_wait_for_single_fd): Fix wrong return value.
+ * test/-ext-/wait_for_single_fd/test_wait_for_single_fd.rb
+ (TestWaitForSingleFD#test_wait_for_closed_pipe): test for it.
+
+Wed May 4 18:46:39 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * ext/-test-/wait_for_single_fd: New. for testing
+ rb_wait_for_single_fd() internal function.
+ The patch was written by Eric Wong. [ruby-core:35991]
+
+ * test/-ext-/wait_for_single_fd/test_wait_for_single_fd.rb: ditto.
+
+Wed May 4 12:46:25 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * thread.c (rb_wait_for_single_fd): Added POLLNVAL check.
+ based on a patch from Eric Wong at [ruby-core:35991].
+
+Wed May 4 11:51:01 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * io.c (rb_f_select): remove useless ifdef.
+
+Wed May 4 11:42:47 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * ext/socket/init.c (wait_connectable): fix error handling code.
+ RB_WAITFD_OUT is turned on even though an error occur.
+
+Wed May 4 10:12:39 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * ext/readline/readline.c (readline_event): use rb_wait_for_single_fd().
+ The patch was written by Eric Wong. [Ruby 1.9 - Feature #4531]
+
+Wed May 4 10:10:28 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * ext/socket/init.c (wait_connectable): use rb_wait_for_single_fd().
+ The patch was written by Eric Wong. [Ruby 1.9 - Feature #4531]
+
+ * ext/socket/init.c (try_wait_connectable, wait_connectable_ensure):
+ removed.
+
+Wed May 4 10:07:48 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * ext/io/wait/wait.c (io_wait): use rb_wait_for_single_fd().
+ The patch was written by Eric Wong. [Ruby 1.9 - Feature #4531]
+
+Wed May 4 10:01:27 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * thread.c (rb_wait_for_single_fd): new. poll(2) based backend for
+ rb_wait_for_single_fd().
+ Now only Linux uses it.
+
+ The patch was written by Eric Wong. [Ruby 1.9 - Feature #4531]
+
+Wed May 4 09:56:57 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * thread.c (rb_wait_for_single_fd): new.
+ * thread.c (select_single): select(2) based backend for
+ rb_wait_for_single_fd().
+
+ * io.c (make_writeconv): use rb_wait_for_single_fd() instead of
+ rb_thread_fd_select().
+ * io.c (rb_io_wait_readable): ditto.
+ * thread.c (rb_thread_wait_fd_rw): ditto.
+
+ * io.c (wait_readable): removed.
+ * thread.c (init_set_fd): new helper function.
+ * include/ruby/io.h (RB_WAITFD_IN, RB_WAITFD_PRI, RB_WAITFD_OUT):
+ new constant for rb_single_wait_fd().
+
+ The patch was written by Eric Wong. [Ruby 1.9 - Feature #4531]
+
+Wed May 4 08:04:59 2011 Aaron Patterson <aaron@tenderlovemaking.com>
+
+ * ext/psych/lib/psych/visitors/yaml_tree.rb: fix time dumping so that
+ Syck can load UTC times that Psych dumps.
+
+Wed May 4 07:33:00 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * thread.c (rb_fd_copy): fix wrong argument.This issue was pointed
+ out by Eric Wong. [ruby-core:35982]
+
+Tue May 3 20:29:33 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * test/fileutils/test_fileutils.rb (TestFileUtils#test_chmod_symbol_mode):
+ Skip sticky bit test if the platform is FreeBSD. It doesn't allow to
+ change sticky bit if a target is regular file.
+
+Tue May 3 18:23:57 2011 Yuki Sonoda (Yugui) <yugui@yugui.jp>
+
+ * test/date/test_date.rb (TestDate#test_coerce):
+ test for [ruby-core:35127].
+
+Tue May 3 04:27:53 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * thread.c (rb_thread_select): preserve errno if no error
+ occurred.
+
+Tue May 3 03:57:04 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * include/ruby/intern.h (rb_w32_fdcopy): add prototype. fixes
+ #4640
+
+Mon May 2 01:02:04 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * lib/fileutils.rb (FileUtils#chmod): accept symbolic mode argument.
+ The patch was written by takkanm. [ruby-core:26029][Feature #2190]
+
+ * lib/fileutils.rb (FileUtils#fu_mode): new helper function.
+ * lib/fileutils.rb (FileUtils#symbolic_modes_to_i): ditto.
+ * lib/fileutils.rb (FileUtils#mode_mask): ditto.
+ * lib/fileutils.rb (FileUtils#user_mask): ditto.
+
+ * test/fileutils/test_fileutils.rb (TestFileUtils#test_chmod_symbol_mode):
+ new test for the above symbolic mode.
+ * test/fileutils/test_fileutils.rb (TestFileUtils#test_chmod_R): ditto.
+
+Mon May 2 00:36:12 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * ext/socket/init.c (rsock_connect): add to care EINTR. based
+ on a patch from Eric Wong at [ruby-core:35621][Bug #4555]
+
+Sun May 1 01:06:24 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * thread.c (rb_thread_select): release GVL while waiting select().
+
+Sat Apr 30 23:10:15 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * win32/win32.c (rb_w32_fdcopy): New. This can copy even though
+ fdset size exceed FD_SETSIZE.
+ * include/ruby/intern.h (rb_fd_copy): use rb_w32_fdcopy()
+
+Sat Apr 30 20:18:43 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * thread.c (do_select): Change argument type to rb_fdset_t.
+ Now do_select() is free from unexpected hangup if
+ HAVE_RB_FD_INIT=1 [Bug #4636]
+
+ * thread.c (rb_thread_fd_select, rb_thread_wait_fd_rw):
+ adapt new argument type.
+
+ * thread.c (rb_thread_select): make dummy implementation.
+
+Sat Apr 30 20:16:53 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * thread.c (rb_fd_copy): Change function argument. Now
+ rb_fd_copy() has fully copy semantics.
+ * include/ruby/intern.h: ditto.
+
+Sat Apr 30 20:11:47 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * include/ruby/intern.h (rb_thread_select): mark as deprecated.
+
+ * ext/io/wait/wait.c (wait_readable): use rb_thread_fd_select
+ instead of rb_thread_select.
+ * ext/socket/init.c (wait_connectable0): ditto.
+ * ext/readline/readline.c (readline_event): ditto.
+ * io.c (rb_io_wait_readable, wait_readable, rb_io_wait_writable,
+ wait_writable): ditto.
+
+Sat Apr 30 20:06:36 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * thread.c (do_select): remove useless ifdef. time calculation
+ is not heavy weight.
+
+Sat Apr 30 16:48:36 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * benchmark/bm_io_select3.rb: New.
+
+Sat Apr 30 16:27:09 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * io.c (copy_stream_body, rb_io_s_copy_stream): move rb_fd_init()
+ from copy_stream_body to rb_io_s_copy_stream. fds of passing
+ rb_fd_term() have to be guaranteed initialized.
+
+Sat Apr 30 16:13:17 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * benchmark/bm_io_select.rb, benchmark/bm_io_select2.rb: New.
+ based on a patch from Eric Wong at [Feature #4531]
+
+Sat Apr 30 03:25:53 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * test/io/wait/test_io_wait.rb: New. for testing ext/io/wait.
+ the patch was written by Eric Wong. [Feature #4531]
+
+Sat Apr 30 00:34:56 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * include/ruby/win32.h: remove redundant declaration of
+ rb_w32_time_subtract().
+
+Sat Apr 30 00:16:40 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * thread_pthread.c (gvl_init): fix hangup if GVL_SIMPLE_LOCK=1.
+ We don't have to call mutex_unlock() before initialize it!
+
+Fri Apr 29 13:15:15 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * thread_win32.c (native_cond_timedwait): New. r31373 caused
+ win32 build failure.
+
+ * thread_win32.c (__cond_timedwait, abs_timespec_to_timeout_ms):
+ New helper functions.
+
+ * win32/win32.c (rb_w32_time_subtract): rename from subtract and
+ remove static.
+
+Fri Apr 29 10:43:09 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * benchmark/bm_vm4_pipe.rb: Add two new benchmark for GVL
+ performance. They was written by Koichi Sasada.
+ * benchmark/bm_vm4_thread_pass.rb: ditto.
+
+Fri Apr 29 10:25:31 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * vm_method.c (rb_clear_cache_by_class): Revert r29673. It made
+ a segmentation fault regression. [Bug #4289][ruby-core:34554].
+
+Fri Apr 29 10:24:51 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * io.c (make_writeconv): do not add textmode newline decorator if any
+ newline decorator is set already. fixes #4618, fixes #4619
+
+Fri Apr 29 10:17:42 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * thread.c (lock_func): small cleanup.
+
+Fri Apr 29 10:07:13 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * thread.c (rb_mutex_lock, lock_func): Avoid busy loop and
+ performance regression. bm_vm3_thread_mutex.rb performance
+ change from 109.064sec to 16.331sec. [Feature #4607]
+
+ * thread.c (init_lock_timeout): New helper function.
+
+Thu Apr 28 16:15:49 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * win32/{win32.c,dir.h} (rb_w32_uopendir): new API to pass UTF-8 path.
+
+ * win32/win32.c (opendir_internal, rb_w32_opendir): extract and merge
+ common part of rb_w32_opendir() and rb_w32_uopendir().
+
+ * dir.c (do_opendir, glob_helper): encoding.
+
+ * dir.c (dir_initialize, do_opendir): convert path to UTF-8 and call
+ rb_w32_uopendir() instead of rb_w32_opendir() on Windows.
+ fixes #4491, reported by Joey Zhou.
+
+Thu Apr 28 15:32:53 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * test/dl/test_base.rb (DL::LIBC_SO): its always msvc*.dll on
+ mswin/mingw.
+
+Thu Apr 28 06:07:06 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/csv.rb (CSV::open): suppress universal newline decorator.
+ fixes #4603
+
+ * lib/csv.rb (CSV.read): no mode is needed.
+
+Thu Apr 28 06:06:56 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * io.c (rb_io_extract_modeenc, rb_f_backquote): set default text
+ mode. fixes #4619
+
+ * io.c (pipe_open): set universal newline decorator if needed.
+
+Wed Apr 27 11:33:08 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * enc/trans/emoji_iso2022_kddi.trans: ISO-2022-JP-KDDI doesn't have
+ CP932 UDA. Another reason is emacs-mule: the implementation of
+ stateless-iso-2022-jp doesn't support beyond 94x94 (0x7fxx);
+ but CP932 UDA is in 7Fxx-92xx.
+
+Wed Apr 27 07:42:44 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * configure.in (STRIP): use proper toolchain. based on a patch
+ from Jon Forums at [ruby-core:35909]. fixes #4617
+
+Wed Apr 27 01:20:59 2011 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * ext/date/date_core.c (date_zone_to_diff): renamed.
+ * ext/date/date_parse.c: ditto.
+ * ext/date/date_strptime.c: ditto.
+
+Wed Apr 27 01:16:59 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * encoding.c (enc_find): accept Encoding objects.
+
+Wed Apr 27 00:55:56 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * transcode.c (econv_opts): add newline option.
+
+ * io.c (validate_enc_binmode, rb_io_extract_modeenc): set newline
+ decorator according to open mode.
+
+ * transcode.c (rb_econv_prepare_options): new function, to prepare
+ econv options with newline flags.
+
+ * include/ruby/encoding.h (ECONV_NEWLINE_DECORATOR_MASK): add.
+
+Wed Apr 27 00:51:01 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * file.c (rb_file_truncate): fix function.
+
+ * include/ruby/win32.h (ftruncate, truncate, ftello, fseeko): non-64
+ versions on mingw are useless because they use int32_t. fixes #4564
+
+Wed Apr 27 00:50:33 2011 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * ext/date/date_core.c: modified validation methods.
+ * ext/date/lib/date.rb: ditto.
+
+Wed Apr 27 00:00:37 2011 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * ext/date/date_core.c (dt_lite_set_tmx): should get df value.
+
+Tue Apr 26 22:34:04 2011 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * ext/date/lib/date/format.rb (_iso8601): allowed day only civil
+ date. disallowed separatorless day only ordinal date.
+
+Mon Apr 25 21:31:36 2011 Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
+
+ * ext/openssl/extconf.rb: Should check SSLv2_*method.
+ openssl compiled with "no-ssl2" the extconf don't fail
+ when running `make' having this compilation errors.
+ Patched by Laurent Arnoud. fixes #4562, #4556
+
+Mon Apr 25 20:53:32 2011 Tajima, Akio <artonx@yahoo.co.jp>
+
+ * win32/win32.c (kill): accept 0 only sig is SIGINT #4596
+
+Mon Apr 25 19:59:47 2011 Tajima, Akio <artonx@yahoo.co.jp>
+
+ * win32/win32.c (kill): accept 0 as pid, fixes #4596
+
+Mon Apr 25 16:43:45 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * random.c (random_rand): remove unused variables.
+
+ * struct.c (rb_struct_define_without_accessor): ditto.
+
+ * strftime.c (rb_strftime_with_timespec): ditto.
+
+ * sprintf.c: ditto.
+
+ * time.c (time_asctime): remove useless GetTimeval().
+
+ * thread_pthread.c: cast to (void *) for %p.
+
+Mon Apr 25 11:02:11 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * ext/ripper/lib/ripper/sexp.rb: fix rdoc around sexp.
+ patched by Sho Hashimoto. fixes #4599
+
+Mon Apr 25 08:24:04 2011 Shota Fukumori <sorah@tubusu.net>
+
+ * random.c (rb_f_rand, random_s_rand): RDocs for them.
+
+Mon Apr 25 07:18:00 2011 Kenta Murata <mrkn@mrkn.jp>
+
+ * random.c (random_s_rand, Init_Random): Random.rand should behave as
+ Random::DEFAULT.rand rather than Kernel#rand.
+
+ * random.c (rand_range, random_rand): rand_range function extracted
+ from random_rand function.
+
+ * random.c (rb_f_rand): accept a Range argument as Random#rand
+ [ruby-dev:43427] #4605
+
+Mon Apr 25 03:31:06 2011 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * lib/time.rb: require 'date'.
+ * ext/date/lib/date/format.rb: removed require line.
+
+Mon Apr 25 03:08:39 2011 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * ext/date/lib/date/format.rb: require 'date'.
+
+Mon Apr 25 03:04:16 2011 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * ext/date/lib/date/format.rb (_iso8601): added a pattern.
+
+Mon Apr 25 02:51:22 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * ext/date/lib/date/format.rb: require 'date_core.so'.
+ date/format needs methods which are now in date_core.so.
+ This breaks make rdoc which uses Date._parse from time.rb.
+
+Mon Apr 25 02:47:46 2011 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * ext/date/lib/date/format.rb (_iso8601): fixed a bug of regex.
+
+Mon Apr 25 02:12:26 2011 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * ext/date/lib/date/format.rb: an adjustment of regex.
+
+Mon Apr 25 01:58:50 2011 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * ext/date/lib/date/format.rb: omitted to call _parse.
+
+Mon Apr 25 01:03:03 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * string.c (rb_to_id): remove unused variable.
+
+Sun Apr 24 22:19:05 2011 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * complex.c, rational.c: omitted some method calls.
+
+Sun Apr 24 02:57:27 2011 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * ext/date/date_parse.c (n2i): takes long.
+
+Sun Apr 24 02:51:06 2011 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * ext/date/date_parse.c: reverted.
+
+Sun Apr 24 02:25:23 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * include/ruby/intern.h: pcc can't use __builtin_constant_p.
+
+ * vm_exec.c: change condition.
+
+Sun Apr 24 01:58:01 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * ext/date/date_core.c (leap_p): suppress warning: parentheses.
+
+ * ext/date/date_core.c (date_s__parse_internal): remove unused
+ variable "str".
+
+ * ext/date/date_parse.c (parse_ddd_cb): use RSTRING_LENINT.
+
+ * ext/date/date_strftime.c (date_strftime_with_tmx): remove unused
+ variable.
+
+Sun Apr 24 00:34:23 2011 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * ext/date/date_parse.c: removed some unused macros. use strchr()
+ instead of index().
+
+Sat Apr 23 21:29:42 2011 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * ext/date/date_core.c: replacement of implementation of
+ _parse. [experimental]
+ * ext/date/date_parse.c: new.
+ * ext/date/lib/date/format.rb: removed ruby version of _parse.
+
+Fri Apr 22 12:04:15 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * array.c (rb_ary_sort_bang): fix rdoc.
+ patched by burningTyger. https://github.com/ruby/ruby/pull/11
+
+Fri Apr 22 11:49:49 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * lib/xmlrpc/create.rb (XMLRPC::Create#conv2value):
+ XML-RPC's int is 32bit int, and Fixnum also may be beyond 32bit.
+
+ * lib/xmlrpc/create.rb (XMLRPC::Create#conv2value):
+ XML-RPC doesn't allow Infinity and NaN.
+ http://www.xmlrpc.com/spec
+
+Fri Apr 22 04:16:14 2011 Aaron Patterson <aaron@tenderlovemaking.com>
+
+ * ext/psych/parser.c (parse): strings from psych have proper taint
+ markings.
+
+ * test/psych/test_tainted.rb: test for string taint
+
+Thu Apr 21 01:30:02 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * random.c (rb_f_srand): fix rdoc: srand(0)'s 0 is a seed.
+ [ruby-core:35833] fixes #4590
+
+Thu Apr 21 01:01:28 2011 Masaya Tarui <tarui@ruby-lang.org>
+
+ * win32/win32.c (CreateChild): maximum length of lpCommandLine is
+ 32,768 characters, including the Unicode terminating null character.
+
+Wed Apr 20 21:32:11 2011 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * ext/date/date_strptime.c (date__strptime_internal): do not
+ overwrite local variables.
+
+Wed Apr 20 14:41:28 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * string.c (rb_str_each_line): check string's length when compare
+ separator and string. [ruby-core:35815] fixes #4586
+
+Wed Apr 20 00:02:13 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * misc/ruby-mode.el (ruby-parse-partial): use position of open paren.
+
+Tue Apr 19 01:00:21 2011 Tajima Akio <artonx@yahoo.co.jp>
+
+ * test/ruby/test_io.rb (TestIO#test_cross_thread_close_fd):
+ skip cross thread pipe close if windows
+
+Mon Apr 18 12:15:46 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * test/ruby/test_range.rb (TestRange#test_step_ruby_core_35753):
+ avoid float error. [ruby-core:35804]
+
+Sun Apr 17 00:20:14 2011 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * ext/date/date_{core,strftime}.c: use struct tmx instead of vtm.
+ * ext/date/date_tmx.h: new.
+
+Sat Apr 16 22:23:52 2011 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * ext/date/date_strftime.c (date_strftime_wo_timespec): changed
+ the way of validation of locale modifiers.
+
+Sat Apr 16 21:55:12 2011 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * ext/date/date_core.c: replacement of implementation of
+ _strptime. [experimental]
+ * ext/date/date_strptime.c: new.
+ * ext/date/lib/date/format.rb: removed ruby version of _strptime.
+
+Sat Apr 16 10:18:30 2011 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
+
+ * vm.c (Init_VM): suppress warning: "OPT_BASIC_OPERATIONS" is not
+ defined.
+
+Fri Apr 15 23:41:18 2011 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
+
+ * ruby.c (proc_options): suppress warning:
+ "ALLOW_DEFAULT_SOURCE_ENCODING" is not defined.
+
+Fri Apr 15 15:10:29 2011 Akinori MUSHA <knu@iDaemons.org>
+
+ * lib/uri/generic.rb (#route_from_path): Fix a bug where
+ URI('http://h/b/').route_to('http://h/b') wrongly returned './'
+ (should be '../b'). [Bug #4476]
+
+Fri Apr 15 14:58:06 2011 Akinori MUSHA <knu@iDaemons.org>
+
+ * lib/fileutils.rb (FileUtils#touch): Fix corrupted output when
+ mtime is specified in addition to nocreate (and verbose).
+ ref [ruby-dev:43401]
+
+Thu Apr 14 23:43:43 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * numeric.c (ruby_float_step): wrong loop condition.
+ fixes [ruby-core:35753], reported by Joey Zhou.
+
+ * test/ruby/test_range.rb (TestRange#test_step_ruby_core_35753):
+ test above change.
+
+Thu Apr 14 22:48:12 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/test/unit.rb (Test::Unit::Options#setup_options): set possible
+ values for completion. no conversion is needed.
+
+ * lib/test/unit.rb (Test::Unit::Runner::Worker#initialize): use
+ positional arguments instead of keyword arguments.
+
+ * lib/test/unit.rb (Test::Unit::Runner#jobs_status): io/console may
+ not be available. use 80 as the last resort if IO#winsize and
+ COLUMNS are unavailable.
+
+ * lib/test/unit.rb (Test::Unit::Runner::Worker#died): rename using a
+ verb.
+
+ * lib/test/unit.rb (Test::Unit::Runner#_run_parallel): check if worker
+ is signaled and use its exit status.
+
+ * lib/test/unit.rb (Test::Unit::Runner::Worker#dead): no longer @in
+ and @out are separated.
+
+Thu Apr 14 21:23:29 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * variable.c (rb_autoload_p): search superclasses as same as actual
+ loading. fixes [ruby-core:35679]
+
+Thu Apr 14 21:21:06 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * include/ruby/win32.h (frexp, modf): wrongly declared as pure in
+ mingw math.h.
+
+ * include/ruby/win32.h (ftruncate, truncate): mingw64 misses
+ prototypes.
+
+ * win32/win32.c (rb_w32_read): suppress warning.
+
+Thu Apr 14 19:55:54 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * lib/fileutils.rb (FileUtils#touch): fix corrupted output when
+ FileUtils.touch(:nocreate => true, :verbose => true) case.
+ The patch was written by Hiroyuki Iwatsuki. [ruby-dev:43401]
+
+Thu Apr 14 16:01:45 2011 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
+
+ * io.c (rb_f_syscall): suppress warning: "HAVE___SYSCALL" is not
+ defined.
+
+Thu Apr 14 00:41:09 2011 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
+
+ * thread.c (thread_fd_close_i): IOError exception should be assigned
+ to rb_thread_t::thrown_errinfo.
+
+Wed Apr 13 20:12:26 2011 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
+
+ * io.c (rb_io_fdatasync): remove unused variable.
+
+Tue Apr 12 20:54:12 2011 Tanaka Akira <akr@fsij.org>
+
+ * include/ruby/st.h: parenthesize macro arguments.
+
+Tue Apr 12 19:19:50 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * lib/uri/common.rb: avoid race condition. fixes #4572
+
+Tue Apr 12 18:07:13 2011 TAKAO Kouji <kouji@takao7.net>
+
+ * ext/readline/extconf.rb: --disable-libedit to disable
+ libedit. fixes #4550
+
+Tue Apr 12 10:37:39 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * include/ruby/win32.h: VC doesn't have ftruncate() and others, but
+ ruby needs HAVE_ macros to use our emulation functions.
+ (fix the problem of 31262)
+
+Tue Apr 12 01:33:00 2011 Luis Lavena <luislavena@gmail.com>
+
+ * configure.in: properly evaluate existence of truncate, ftruncate
+ and ftello for MinGW. [ruby-core:35678]
+ * win32/win32.c: rename truncate, ftruncate and ftello to avoid
+ redefinitions.
+ * win32/win32.h: ditto.
+
+Mon Apr 11 21:51:52 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * io.c: revert r31230. Because it made a regression.
+ [ruby-core:35631]
+
+Mon Apr 11 21:49:18 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * test/ruby/test_io.rb: Added TestIO#test_cross_thread_close_stdio
+ and TestIO#test_cross_thread_close_fd.
+ The patch was written by Eric Wong. [ruby-core:35669]
+
+Mon Apr 11 21:15:54 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * file.c (rb_group_member): kill 256K of stack usage.
+ the patch was written by Eric Wong. [ruby-core:35699]
+
+Mon Apr 11 07:24:13 2011 Eric Hodel <drbrain@segment7.net>
+
+ * ext/openssl/ossl.c: Fix typo, document version constants.
+
+Sun Apr 10 22:23:45 2011 Tanaka Akira <akr@fsij.org>
+
+ * include/ruby/ruby.h: parenthesize macro arguments.
+
+Sat Apr 9 23:31:47 2011 Shota Fukumori <sorah@tubusu.net>
+
+ * ext/stringio/stringio.c (strio_each, strio_readlines):
+ Use `NUM2LONG` instead of `FIX2INT`. Fixes [ruby-dev:43395].
+
+Sat Apr 9 23:22:27 2011 Shota Fukumori <sorah@tubusu.net>
+
+ * ext/stringio/stringio.c (strio_each):
+ Fix exception message and don't raise immediately if block is not
+ given.
+ Fixes [ruby-dev:43394].
+
+ * test/stringio/test_stringio.rb (test_each_line_limit_0):
+ Fix test for above.
+
+Sat Apr 9 21:54:15 2011 Shota Fukumori <sorah@tubusu.net>
+
+ * ext/stringio/stringio.c (strio_each, strio_readlines):
+ limit must not be zero. Fixes [ruby-dev:43392].
+
+ * test/stringio/test_stringio.rb: Add tests for above.
+
+Sat Apr 9 18:01:36 2011 Tanaka Akira <akr@fsij.org>
+
+ * include/ruby/util.h: parenthesize macro arguments.
+
+Fri Apr 8 16:01:56 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * ext/stringio/stringio.c (strio_getline): check whether str is
+ a string when str and lim are given.
+ https://twitter.com/watson1978/status/56225052152168449
+
+Thu Apr 7 20:03:52 2011 Tanaka Akira <akr@fsij.org>
+
+ * include/ruby/io.h: parenthesize macro arguments.
+
+Wed Apr 6 21:08:31 2011 Tanaka Akira <akr@fsij.org>
+
+ * include/ruby/intern.h: parenthesize macro arguments.
+
+Wed Apr 6 15:12:40 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * ext/openssl/ossl_pkey_dh.c (ossl_dh_initialize):
+ pop pushed error after each try of reading. fixes #4550
+
+ * ext/openssl/ossl_pkey_dsa.c (ossl_dsa_initialize): ditto.
+
+ * ext/openssl/ossl_pkey_ec.c (ossl_ec_initialize): ditto.
+
+Wed Apr 6 11:36:44 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * ext/openssl/ossl_pkey_rsa.c (ossl_rsa_initialize):
+ pop pushed error after each try of reading. fixes #4550
+
+Tue Apr 5 20:33:43 2011 Tanaka Akira <akr@fsij.org>
+
+ * include/ruby/encoding.h: parenthesize macro arguments.
+
+Mon Apr 4 22:02:16 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * ext/io/nonblock/nonblock.c (io_nonblock_set): Avoid F_SETFL if
+ we're not changing the O_NONBLOCK bit. F_SETFL is an expensive
+ operation since it needs to affect all processes with the same
+ file object.
+ The patch is written by Eric Wong. [ruby-core:35556]
+
+Mon Apr 4 21:41:26 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * io.c (rb_io_syswrite): While local FS writes are usually
+ buffered, the buffers can be full or the file opened with
+ O_SYNC. IO#syswrite can also be used on blocking IOs
+ (pipe/socket) just like IO#write.
+ The patch is written by Eric Wong. [ruby-core:35554]
+
+Mon Apr 4 11:50:40 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * test/test_tempfile.rb: simply ignore platform dependent testcases
+ instead of skipping.
+
+Sun Apr 3 22:52:22 2011 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
+
+ * ext/syslog/syslog.c: improve rdoc.
+ a patch by Jonas Pfenniger. [ruby-core:35592] fixes #4545
+
+Sun Apr 3 22:10:09 2011 Tanaka Akira <akr@fsij.org>
+
+ * ext/zlib/zlib.c: parenthesize macro arguments.
+
+Sun Apr 3 21:33:58 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * configure.in: disable fdatasync again on Mac OS X.
+ [ruby-core:35493][Bug #4500]
+
+Sun Apr 3 21:16:20 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * io.c (io_reopen): IO#close releases GVL if possible.
+ close() may block for certain file types (NFS, SO_LINGER
+ sockets, inotify), so let other threads run. The patch was
+ created by Eric Wong [ruby-core:35555][Bug #4527]
+
+ * io.c (fptr_finalize): ditto.
+
+ * io.c (maygvl_fclose): new.
+ * io.c (nogvl_fclose): ditto.
+ * io.c (maygvl_close): ditto.
+ * io.c (nogvl_close): ditto.
+
+Fri Apr 1 22:25:50 2011 Tanaka Akira <akr@fsij.org>
+
+ * ext/syslog/syslog.c: parenthesize macro arguments.
+
+Fri Apr 1 18:53:06 2011 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
+
+ * lib/webrick/cookie.rb (WEBrick::Cookie.parse): 'white space is
+ permitted between tokens' according to RFC2965. Though 'Netscape
+ spec' does not define the syntax clearly, make it tolerant as a
+ server. As a real-world example, rest-client gem sends
+ 'Cookie: foo=1;bar=2'
+
+ * test/webrick/test_cookie.rb (test_parse_non_whitespace): test it.
+
+Fri Apr 1 13:19:20 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * vm_core.h (RUBY_VM_CHECK_INTS_TH): merge a patch by ko1
+ in [ruby-dev:43373].
+
+Thu Mar 31 23:15:46 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * misc/ruby-mode.el (ruby-brace-to-do-end, ruby-do-end-to-brace):
+ adjust space between block beginning and block arguments
+
+Thu Mar 31 20:42:05 2011 Tanaka Akira <akr@fsij.org>
+
+ * ext/strscan/strscan.c: parenthesize macro arguments.
+
+Thu Mar 31 18:06:12 2011 Shugo Maeda <shugo@ruby-lang.org>
+
+ * vm_insnhelper.c (vm_get_ev_const): should ignore crefs with
+ the NODE_FL_CREF_PUSHED_BY_EVAL flag.
+
+Thu Mar 31 16:49:56 2011 Shugo Maeda <shugo@ruby-lang.org>
+
+ * vm_insnhelper.c (vm_get_ev_const): search root cref properly.
+ [ruby-dev:43365]
+
+Thu Mar 31 14:50:25 2011 Shugo Maeda <shugo@ruby-lang.org>
+
+ * eval.c (rb_mod_s_constants): should ignore crefs with
+ the NODE_FL_CREF_PUSHED_BY_EVAL flag.
+
+Wed Mar 30 22:55:47 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * misc/ruby-mode.el (ruby-toggle-block): toggle do/end and {}.
+
+ * misc/ruby-mode.el (ruby-move-to-block): move to opening of
+ block.
+
+Wed Mar 30 14:35:15 2011 Shugo Maeda <shugo@ruby-lang.org>
+
+ * vm_insnhelper.h (COPY_CREF): should copy
+ the NODE_FL_CREF_PUSHED_BY_EVAL flag to hide constants from
+ methods defined by class_eval. [ruby-dev:43365]
+
+Wed Mar 30 00:24:53 2011 Tanaka Akira <akr@fsij.org>
+
+ * ext/stringio/stringio.c: parenthesize macro arguments.
+
+Tue Mar 29 21:51:31 2011 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
+
+ * object.c (rb_String): Kernel#String should call to_str before to_s.
+
+Tue Mar 29 10:28:08 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * test/webrick/test_filehandler.rb
+ (WEBrick::TestFileHandler#test_short_filename): the cgi doesn't exist
+ on current directory.
+
+Tue Mar 29 05:19:57 2011 Tanaka Akira <akr@fsij.org>
+
+ * ext/socket/raddrinfo.c: parenthesize macro arguments.
+
+Tue Mar 29 00:03:51 2011 Tajima Akio <artonx@yahoo.co.jp>
+
+ * test/webrick/test_filehandler.rb (test_short_filename):
+ read real short filename by cmd because smb mounted files
+ have different naming convention.
+
+Mon Mar 28 11:38:08 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * ext/date/date_core.c (date_s_today): use int for year.
+
+ * ext/date/date_core.c (datetime_s_now): ditto.
+
+Mon Mar 28 11:07:41 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * ext/extmk.rb: set MFLAGS from MAKEFLAGS when using nmake.
+
+Mon Mar 28 11:07:00 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * common.mk (love): all you need is love.
+
+Sun Mar 27 23:16:31 2011 Tanaka Akira <akr@fsij.org>
+
+ * ext/socket/ipsocket.c: parenthesize macro arguments.
+
+Sun Mar 27 16:55:34 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * misc/ruby-mode.el (ruby-mode-map): remove unnecessary
+ binding. fixes
+ http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=468952
+
+ * misc/ruby-mode.el: suppress warnings at byte compile. fixes
+ http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=502926
+
+Sun Mar 27 11:18:35 2011 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * ext/date/date_core.c: removed unused variables.
+
+Sat Mar 26 15:16:09 2011 Tanaka Akira <akr@fsij.org>
+
+ * ext/socket/getaddrinfo.c: parenthesize macro arguments.
+
+Sat Mar 26 05:27:34 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * ext/date/lib/date/format.rb (DateTime#strftime): removed because
+ date_core defines it.
+
+Fri Mar 25 21:59:45 2011 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * ext/date/date_core.c: should not force cast with macros.
+
+Fri Mar 25 21:56:10 2011 Tanaka Akira <akr@fsij.org>
+
+ * ext/sdbm/init.c: parenthesize macro arguments.
+
+Fri Mar 25 19:39:40 2011 Ben Walton <bwalton@artsci.utoronto.ca>
+
+ * test/test_syslog.rb:
+ Skip syslog tests that rely on LOG_PERROR unless it's defined
+
+ Instead of checking looking at the platform to determine if the tests
+ relying on LOG_PERROR should be run, look for the definition of the
+ constant as this will be robust against all platforms as long as the
+ underlying syslog.c code sets it up correctly.
+
+ This specifically addresses failures on Solaris 9.
+
+ Use LOG_PID instead of LOG_PERROR in Syslog.open test
+
+ LOG_PERROR isn't a POSIX option for syslog, so it fails on platforms
+ that don't define it. Solaris 9 and 10 are examples of this.
+
+ Use LOG_PID instead.
+
+Fri Mar 25 15:42:17 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * ext/sdbm/_sdbm.c (sdbm_open): use size_t.
+
+ * ext/syck/bytecode.c: ditto.
+
+ * ext/sdbm/_sdbm.c (delpair): use ptrdiff_t.
+
+ * ext/sdbm/init.c: use RSTRING_LENINT.
+
+ * ext/dl/handle.c: suppress warning: shorten-64-to-32.
+
+ * ext/strscan/strscan.c: ditto.
+
+ * ext/syck/emitter.c: ditto.
+
+ * ext/syck/implicit.c: ditto.
+
+ * ext/syck/syck.c: ditto.
+
+ * ext/syck/token.c: ditto.
+
+Fri Mar 25 12:14:58 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * ext/nkf/nkf-utf8/nkf.c: import nkf 7f18e30.
+
+Fri Mar 25 11:49:29 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * test/ruby/test_process.rb (TestProcess#test_no_curdir): skip silently
+ on Windows, because this tests a platform specific feature and it'll
+ never be supported on ruby on Windows.
+
+ * test/ruby/test_dir_m17n.rb
+ (TestDir_M17N#test_filename_extutf8_invalid,
+ TestDir_M17N#test_filename_as_bytes_extutf8): ditto.
+
+ * test/open-uri/test_open-uri.rb
+ (TestOpenURI#test_find_proxy_case_sensitive_env): ditto.
+
+ * test/dl/test_handle.rb (DL::TestHandle#test_NEXT,
+ DL::TestHandle#test_DEFAULT): ditto.
+
+Thu Mar 24 23:06:29 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * vm_insnhelper.c (vm_get_ev_const): should not autoload in
+ defined? mode.
+
+ * variable.c (rb_const_defined_0): fix autoloading base.
+ [ruby-core:35509]
+
+Thu Mar 24 22:48:43 2011 Tanaka Akira <akr@fsij.org>
+
+ * ext/sdbm/_sdbm.c: parenthesize macro arguments.
+
+Thu Mar 24 14:45:57 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * ext/openssl/ossl.c: suppress warning: shorten-64-to-32.
+
+ * ext/openssl/ossl.h: ditto.
+
+ * ext/openssl/ossl_asn1.c: ditto.
+
+ * ext/openssl/ossl_bio.c: ditto.
+
+ * ext/openssl/ossl_bn.c: ditto.
+
+ * ext/openssl/ossl_cipher.c: ditto.
+
+ * ext/openssl/ossl_hmac.c: ditto.
+
+ * ext/openssl/ossl_ns_spki.c: ditto.
+
+ * ext/openssl/ossl_ocsp.c: ditto.
+
+ * ext/openssl/ossl_pkcs5.c: ditto.
+
+ * ext/openssl/ossl_pkey.c: ditto.
+
+ * ext/openssl/ossl_pkey_dh.c: ditto.
+
+ * ext/openssl/ossl_pkey_dsa.c: ditto.
+
+ * ext/openssl/ossl_pkey_ec.c: ditto.
+
+ * ext/openssl/ossl_pkey_rsa.c: ditto.
+
+ * ext/openssl/ossl_rand.c: ditto.
+
+ * ext/openssl/ossl_ssl.c: ditto.
+
+ * ext/openssl/ossl_x509ext.c: ditto.
+
+ * ext/openssl/ossl_x509name.c: ditto.
+
+Thu Mar 24 11:48:19 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * ext/openssl/ossl_rand.c (ossl_rand_egd_bytes): use NUM2INT because
+ the result is used with functions whose argument is int.
+
+ * ext/openssl/ossl_ssl.c (ossl_sslctx_setup): ditto.
+
+ * ext/openssl/ossl_x509store.c (ossl_x509store_set_purpose): ditto.
+
+ * ext/openssl/ossl_x509store.c (ossl_x509store_set_trust): ditto.
+
+ * ext/openssl/ossl_x509store.c (ossl_x509stctx_set_purpose): ditto.
+
+ * ext/openssl/ossl_x509store.c (ossl_x509stctx_set_trust): ditto.
+
+Thu Mar 24 11:36:55 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * ext/openssl/ossl_x509name.c: id_aref's type is ID.
+
+Thu Mar 24 10:04:35 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * ext/io/console/console.c (console_set_winsize):
+ suppress warning: shorten-64-to-32.
+
+Thu Mar 24 09:56:19 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * ext/openssl/ossl_ocsp.c (ossl_ocspreq_verify): flags is VALUE,
+ so it should use NUM2INT.
+
+ * ext/openssl/ossl_ocsp.c (ossl_ocspbres_verify): ditto.
+
+Wed Mar 23 21:09:29 2011 Tanaka Akira <akr@fsij.org>
+
+ * ext/readline/readline.c: parenthesize macro arguments.
+
+Wed Mar 23 08:07:33 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * numeric.c (flo_round): fix inaccurate results.
+
+Wed Mar 23 00:12:16 2011 Tajima Akio <artonx@yahoo.co.jp>
+
+ * win32/win32.c: wait process real termination after reading
+ exit code. fixes #4518
+
+Tue Mar 22 21:20:10 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * lib/rubygems/test_case.rb: save current dir to @current_dir
+ before Dir.chdir.
+
+Tue Mar 22 20:10:04 2011 Tanaka Akira <akr@fsij.org>
+
+ * ext/psych/parser.c: parenthesize macro arguments.
+
+Tue Mar 22 20:10:01 2011 Tanaka Akira <akr@fsij.org>
+
+ * ext/openssl/ruby_missing.h: parenthesize macro arguments.
+
+Tue Mar 22 13:33:22 2011 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
+
+ * ext/openssl/lib/openssl/buffering.rb: removed circular require of
+ openssl.rb.
+
+ * ext/openssl/lib/openssl/*: removed following comment for transition
+ measures of avoiding circular require. No one claimed about this as
+ far as I know.
+ ##
+ # Should we care what if somebody require this file directly?
+ # require "openssl"
+
+Tue Mar 22 10:57:36 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * test/runner.rb: set Gem::TestCase's @@project_dir.
+
+ * lib/rubygems/test_case.rb: set Gem::TestCase's @@project_dir only
+ when it is not defined.
+
+Tue Mar 22 09:38:19 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * numeric.c (flo_round): use pow instead of while-loop. fixes #4510
+ patched by Alex Young [ruby-core:35526]
+
+Tue Mar 22 06:47:46 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * ext/date/date_strftime.c (date_strftime_wo_timespec):
+ suppress warning: shorten-64-to-32.
+
+Tue Mar 22 06:42:42 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * ext/date/date_core.c: suppress warning: shorten-64-to-32.
+
+Tue Mar 22 06:41:37 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * lib/test/unit/parallel.rb: remove unused variable.
+
+Tue Mar 22 06:19:42 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * enc/utf_16le.c: suppress warning: shorten-64-to-32.
+
+ * ext/dbm/dbm.c: ditto.
+
+ * ext/gdbm/gdbm.c: ditto.
+
+ * parse.y (Init_ripper): suppress warning: unused value.
+
+Mon Mar 21 11:21:32 2011 Shota Fukumori <sorah@tubusu.net>
+
+ * lib/test/unit.rb: Refactoring. Unified if and elsif.
+
+Sun Mar 20 23:09:34 2011 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * ext/date/date_strftime.c: checks duplicated modifiers.
+
+Sun Mar 20 22:32:30 2011 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * ext/date/date_strftime.c: removed unused code and arguments.
+
+Sun Mar 20 21:34:49 2011 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * ext/date/date_core.c: replacement of implementation of
+ strftime. It has some limitations that is same as Time's
+ one. [experimental]
+ * ext/date/date_strftime.c: new.
+ * ext/date/lib/date/format.rb: removed ruby version of strftime.
+
+Sun Mar 20 12:43:12 2011 Tanaka Akira <akr@fsij.org>
+
+ * ext/openssl/ossl_x509store.c: parenthesize macro arguments.
+
+Sun Mar 20 01:39:48 2011 Tajima Akio <artonx@yahoo.co.jp>
+
+ * hash.c (ruby_setenv): check env process block size with OS ver.
+ * win32/win32.c: export rb_w32_osver for above patch.
+ * include/ruby/win32.h: declare rb_w32_osver for Win32 Libs.
+
+Sat Mar 19 18:35:05 2011 Tajima Akio <artonx@yahoo.co.jp>
+
+ * hash.c (ruby_setenv): calculate total env block size for win32.
+ * test/ruby/test_env.rb: add test for above patch.
+
+Sat Mar 19 17:14:46 2011 Tajima Akio <artonx@yahoo.co.jp>
+
+ * hash.c (ruby_setenv): checking with max process environment
+ block size for Win32. 32767 for 2000/XP, 2003. if failed to
+ read the block, then checking with 5120 for earlier Windows.
+
+Sat Mar 19 12:30:25 2011 Tanaka Akira <akr@fsij.org>
+
+ * ext/openssl/ossl_x509revoked.c: parenthesize macro arguments.
+
+Fri Mar 18 20:44:36 2011 Tanaka Akira <akr@fsij.org>
+
+ * ext/openssl/ossl_x509req.c: parenthesize macro arguments.
+
+Fri Mar 18 08:48:06 2011 Oleg Shaldybin <oleg.shaldybin@gmail.com>
+
+ * lib/fileutils.rb (FileUtils::Entry_#copy_file): updated FileUtils.cp
+ to still copy file permissions when :preserve is false (as cp does
+ this even when -p isn't set).
+
+Fri Mar 18 00:59:38 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/win32ole/extconf.rb (create_docfile): removed. should not
+ modify source directory unnecessarily, platform dependent
+ documentation should be dealt with by rdoc. [ruby-core:35495]
+
+Fri Mar 18 00:54:20 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * include/ruby/ruby.h (rb_funcall_passing_block): add prototype.
+ a patch by James M. Lawrence at [ruby-core:35501]
+
+Wed Mar 17 06:23:31 2011 Tanaka Akira <akr@fsij.org>
+
+ * ext/openssl/ossl_x509name.c: parenthesize macro arguments.
+
+Wed Mar 16 20:36:56 2011 Tanaka Akira <akr@fsij.org>
+
+ * ext/socket/ipsocket.c (init_inetsock_internal): raise an error on
+ listen(2) failure.
+ reported by Xavier Shay. [ruby-core:35505]
+
+Wed Mar 16 15:06:21 2011 Eric Hodel <drbrain@segment7.net>
+
+ * ext/openssl/lib/openssl/buffering.rb (module OpenSSL): #flush should
+ not change sync mode on exception.
+ * test/openssl/test_buffering.rb: added
+
+Wed Mar 16 13:45:28 2011 Eric Hodel <drbrain@segment7.net>
+
+ * ext/openssl/lib/openssl/buffering.rb: de-nest Buffering module
+
+ * ext/openssl/lib/openssl/buffering.rb: add RDoc
+
+Wed Mar 16 08:40:39 2011 Tanaka Akira <akr@fsij.org>
+
+ * ext/openssl/ossl_x509ext.c: parenthesize macro arguments.
+
+Tue Mar 15 18:34:27 2011 Tanaka Akira <akr@fsij.org>
+
+ * ext/openssl/ossl_x509crl.c: parenthesize macro arguments.
+
+Tue Mar 15 09:49:03 2011 Shota Fukumori <sorah@tubusu.net>
+
+ * test/misc/test_ruby_mode.rb (test_singleton_class): Skip for Pending.
+
+Mon Mar 14 21:20:44 2011 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
+
+ * test/ruby/test_require.rb (test_require_too_long_filename):
+ increase path length, because MAXPATHLEN is defined as 4096 on linux.
+
+ * test/ruby/test_require.rb (test_require_path_home_1): ditto.
+
+ * test/ruby/test_require.rb (test_require_path_home_2): ditto.
+
+Mon Mar 14 19:54:37 2011 Tanaka Akira <akr@fsij.org>
+
+ * ext/openssl/ossl_x509cert.c: parenthesize macro arguments.
+
+Sun Mar 13 18:11:28 2011 Tanaka Akira <akr@fsij.org>
+
+ * ext/openssl/ossl_x509attr.c: parenthesize macro arguments.
+
+Sun Mar 13 16:07:58 2011 Shota Fukumori <sorah@tubusu.net>
+
+ * lib/pstore.rb: Fix don't raise "nested transaction" when thread_safe
+ is true. Patch by Masaki Matsushita (Glass_saga). [ruby-dev:43337]
+
+ * test/test_pstore.rb: Test for above.
+ Patch by Masaki Matsushita (Glass_saga) [ruby-dev:43337]
+
+Sat Mar 12 04:12:41 2011 Tanaka Akira <akr@fsij.org>
+
+ * ext/openssl/ossl_ssl_session.c: parenthesize macro arguments.
+
+Sat Mar 12 02:27:07 2011 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * ext/date/date_core.c ({d,dt}_lite_marshal_load): checks the given
+ argument.
+
+Sat Mar 12 01:26:24 2011 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * ext/date/date_core.c: changed some directives.
+
+Sat Mar 12 01:16:02 2011 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * ext/date/date_core.c, ext/date/lib/*: moved rdoc descriptions.
+
+Sat Mar 12 00:06:24 2011 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * ext/date/lib: moved from lib.
+
+Fri Mar 11 23:32:38 2011 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * lib/date/delta*: removed undocumented delta.
+
+Fri Mar 11 18:42:43 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/mkmf.rb (find_executable0): should exclude directories.
+
+Fri Mar 11 01:40:35 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * process.c (proc_getmaxgroups, proc_setmaxgroups): Process#maxgroups
+ and Process#maxgroups= now raise NotImplementedError if the
+ platform don't support supplementary groups concept.
+
+Fri Mar 11 01:25:03 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * process.c (get_sc_ngroups_max): return -1 if platform don't
+ support NGROUPS_MAX.
+
+Thu Mar 10 22:28:15 2011 Tanaka Akira <akr@fsij.org>
+
+ * ext/openssl/ossl_ssl.h: parenthesize macro arguments.
+
+Thu Mar 10 21:59:37 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * parse.y (parser_encode_length): add exception as UTF8-MAC for
+ magic comment's emacs newline specifier
+ patched by James M. Lawrence [ruby-core:35476] fixes #4489
+
+Thu Mar 10 16:00:22 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * parse.y (parser_encode_length): fix typo: the length of
+ "-dos" and "-mac" is not 5 but 4.
+ patched by James M. Lawrence [ruby-core:35476] fixes #4489
+
+Thu Mar 10 10:52:01 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * test/ruby/test_require.rb: setting too long string to ENV causes
+ Errno::EINVAL on Windows. long path name errors may causes over
+ about 1024 bytes, then limit it about 4000 bytes.
+
+Thu Mar 10 10:09:35 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * lib/test/unit.rb (Test::Unit::Runner::Worker#read): fix for the case
+ when IO#read or IO#gets returns nil.
+
+Thu Mar 10 07:12:03 2011 Ryan Davis <ryand-ruby@zenspider.com>
+
+ * lib/rubygems*: Import rubygems 1.6.2 (release candidate @ 2026fbb5)
+ * test/rubygems: Ditto
+ * test/runner.rb: Added test to load path to fix test requires.
+
+Thu Mar 10 03:00:43 2011 Tanaka Akira <akr@fsij.org>
+
+ * ext/openssl/ossl_ssl.c: parenthesize macro arguments.
+
+Wed Mar 9 23:51:26 2011 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
+
+ * test/ruby/test_io_m17n.rb (test_io_new_enc): "sjis" is now an alias
+ of Windows-31J.
+
+Wed Mar 9 23:06:13 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * misc/ruby-mode.el (ruby-parse-partial): fix indent after aref.
+
+Wed Mar 9 12:50:24 2011 Aaron Patterson <aaron@tenderlovemaking.com>
+
+ * ext/psych/lib/psych/visitors/yaml_tree.rb: Rescue exceptions when
+ people implement the method method. Thanks Lin Jen-Shin.
+ [ruby-core:35255]
+
+ * test/psych/visitors/test_yaml_tree.rb: test for implementation of
+ method method.
+
+Wed Mar 9 11:53:31 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * enc/shift_jis.c: Change SJIS as an alias of Windows-31J.
+ [ruby-dev:43027] fixes #4280
+
+ * enc/shift_jis.c: Add PCK as an alias of Windows-31J.
+
+Wed Mar 9 00:45:29 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/extmk.rb: nmake substitutes all occurrences in macro.
+
+ * ext/extmk.rb: workaround for nmake.
+
+Tue Mar 8 23:49:45 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * process.c (proc_setgroups): cleanup.
+
+Tue Mar 8 23:40:30 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * test/misc/test_ruby_mode.rb: test for ruby-mode.el.
+
+Tue Mar 8 23:27:38 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * process.c (get_sc_ngroups_max): try to use NGROUPS_MAX at first if
+ _SC_NGROUP_MAX is not defined.
+
+Tue Mar 8 23:10:16 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * misc/ruby-mode.el (ruby-parse-partial): fix for array in block.
+
+Tue Mar 8 21:44:49 2011 Tanaka Akira <akr@fsij.org>
+
+ * ext/openssl/ossl_rand.c: parenthesize macro arguments.
+
+Tue Mar 8 16:45:31 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * hash.c (ruby_setenv): MSDN says that Windows XP or earlier limits
+ the total size of environment block to 5,120 chars. and on such
+ OS, putenv() causes SEGV. So, ruby should limit the size of an
+ environment variable to 5,120 bytes for workaround.
+
+Tue Mar 8 15:57:20 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * test/rubygems/test_gem_spec_fetcher.rb
+ (TestGemSpecFetcher#test_cache_dir_escapes_windows_paths): cache_dir
+ may have driveletter and `:' for base of cache_dir itself, so need
+ to skip it for checking.
+
+Tue Mar 8 12:30:06 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * misc/ruby-mode.el (ruby-deep-indent-paren-p, ruby-calculate-indent):
+ do not apply deep-indent inside parens at the beginning of
+ expressions.
+
+Tue Mar 8 09:32:48 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * common.mk (configure-ext, build-ext), ext/extmk.rb (extmake):
+ support parallel-make under ext.
+
+Tue Mar 8 09:25:23 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * process.c (proc_setgroups): use getgrnam() if getgrnam_r() is
+ not available.
+
+ * process.c: RARRAY_LEN() returns long int.
+
+Tue Mar 8 09:07:03 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * configure.in (RUBY_REPLACE_TYPE): enclose in quotes for multiple
+ type names.
+
+Tue Mar 8 01:43:11 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * process.c (get_sc_ngroups_max): define to wrap sysconf(3).
+ this also supports Windows which doesn't have sysconf(3).
+
+ * process.c (maxgroups): use get_sc_ngroups_max.
+
+ * process.c (proc_setmaxgroups): ditto.
+
+Tue Mar 8 01:16:49 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * gc.c (rb_objspace): an initializer must be a constant.
+
+Tue Mar 8 01:11:44 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * process.c (maxgroups): cast because sysconf(3)'s return value is long.
+
+ * process.c (proc_setmaxgroups): ditto.
+
+ * process.c (proc_setgroups): cast because RARRAY_LEN() is long.
+
+Tue Mar 8 00:02:47 2011 Tanaka Akira <akr@fsij.org>
+
+ * ext/openssl/ossl_pkey_rsa.c: parenthesize macro arguments.
+
+Mon Mar 7 22:59:39 2011 Shota Fukumori <sorah@tubusu.net>
+
+ * lib/pstore.rb: Delete variable @transaction and fix #4474. Patch by
+ Masaki Matsushita (Glass_saga).
+
+ * test/test_pstore.rb(test_thread_safe): Add test for #4474.
+
+Mon Mar 7 21:31:38 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * process.c (proc_setgroups): replace getgrnam() with getgrnam_r()
+ because getgrnam() isn't thread safe.
+
+Mon Mar 7 20:49:12 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * process.c (proc_getmaxgroups, proc_setmaxgroups): reflect
+ platform maxgroups limitation by default instead hardcoded 65536.
+
+Mon Mar 7 17:13:00 2011 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * gc.c (rb_gc_set_params): allow GC parameter configuration by
+ environment variables. based on a patch from funny-falcon at
+ https://gist.github.com/856296, but honors safe level.
+
+Mon Mar 7 09:05:18 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * process.c: NUM2RLIM is defined but no getrlimit and setrlimit on
+ mingw.
+
+Mon Mar 7 08:38:14 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/date/date_core.c (DateTimeData): should not use bare 'long long'
+ and 'long double', which are not defined by C89.
+
+ * ext/date/date_core.c (dt_lite_plus): get rid of overflow at casting
+ down double to integer.
+
+Mon Mar 7 00:21:11 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * process.c (proc_getgroups): get rid of maxgroups dependency.
+ ngroups can be calculated dynamically.
+
+Sun Mar 6 23:45:40 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * configure.in: rlim_t use standard RUBY_REPLACE_TYPE mechanism.
+
+Sun Mar 6 23:26:07 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * process.c (proc_setmaxgroups): added negative value check.
+ This was suggested by Daniel Berger. Thanks Daniel!
+ [ruby-core:35426][Bug#4467]
+
+Sun Mar 6 23:18:23 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * process.c (maxgroups, proc_setmaxgroups): increase max groups
+ limitation up to 65536.
+
+Sun Mar 6 22:20:59 2011 Tanaka Akira <akr@fsij.org>
+
+ * ext/openssl/ossl_pkey_ec.c: parenthesize macro arguments.
+
+Sun Mar 6 21:49:04 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * sample/list.rb (MyElem#initialize): initialize @head
+ explicitly. Otherwise -W2 option makes following warning.
+ "warning: instance variable @head not initialized".
+ This issue was founded by Andrew Grimm. Thanks Andrew!
+ [ruby-core:35435][Bug#4471]
+
+Sun Mar 6 05:21:41 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * class.c: fix camelCase to snake_case in documentation code examples.
+ patched by Andrew Grimm. fixes Bug #4469
+
+ * marshal.c: ditto.
+
+ * proc.c: ditto.
+
+ * sample/biorhythm.rb: ditto.
+
+ * vm_eval.c: ditto.
+
+ * vm_method.c: ditto.
+
+
+Sun Mar 6 03:22:27 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * io.c (io_cntl): use rb_thread_io_blocking_region() instead
+ rb_thread_blocking_region().
+
+Sat Mar 5 22:54:36 2011 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
+
+ * include/ruby/intern.h: fix a typo of prototype declaration.
+ rb_mutex_try_lock -> rb_mutex_trylock [ruby-dev:43213]
+
+Sat Mar 5 19:44:03 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * test/ruby/test_io.rb (TestIO#test_fcntl_lock): small clean up.
+
+Sat Mar 5 01:33:46 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * io.c (io_cntl, nogvl_io_cntl): IO.fcntl() and IO.ioctl()
+ release GVL during calling kernel interface.
+ Suggested by Eric Wong. [ruby-core:35417][Bug #4463]
+
+ * test/ruby/test_io.rb (TestIO#test_fcntl_lock): add new test for
+ IO.fcntl().
+
+Fri Mar 4 23:09:12 2011 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
+
+ * test/testunit/test_parallel.rb
+ (test_should_run_all_without_any_leaks): consider that the order of
+ testcase could change. [ruby-dev:43300] [Bug #4466]
+
+Fri Mar 4 22:01:14 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * io.c (io_cntl): change 'cmd' type to int. ioctl and fcntl need to
+ be passed int.
+ * io.c (rb_io_ctl): ditto.
+
+Fri Mar 4 21:10:40 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * configure.in: save warnflags. the patch is created by Eric Wong.
+ [Bug #4465]
+
+Wed Mar 2 21:15:00 2011 Tanaka Akira <akr@fsij.org>
+
+ * ext/openssl/ossl_pkey_dsa.c: parenthesize macro arguments.
+
+Thu Mar 3 22:10:26 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * process.c (check_exec_redirect_fd, check_exec_redirect): raise
+ ArgumentError if fd >= 3 on Windows because the feature is not
+ supported.
+
+ * test/ruby/test_process.rb (test_execopts_redirect): remove meaningless
+ argument.
+
+Thu Mar 3 21:21:42 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * test/ruby/test_process.rb (test_execopts_redirect): redirecting fd
+ >= 3 is not supported on Windows, so should not specify such options
+ when calling spawn or others.
+
+Thu Mar 3 18:59:04 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * string.c (rb_str_slice_bang): raise error when the string is frozen.
+
+Thu Mar 3 14:25:19 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * strftime.c (STRFTIME): return 0 and ERANGE when precision is too
+ large. [ruby-dev:43284] fixes #4456
+
+Thu Mar 3 00:46:51 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * addr2line.c (uleb128): cast the value to unsigned long.
+
+ * addr2line.c (fill_lines): print error when lseek fails.
+
+Thu Mar 3 00:36:29 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * lib/rexml/encoding.rb (REXML::Encoding#encoding=): store @encoding
+ a String which means the name of the encoding.
+ this partially revert r29646.
+
+ * lib/rexml/document.rb: follow above.
+
+ * lib/rexml/output.rb: ditto.
+
+ * lib/rexml/parsers/baseparser.rb: ditto.
+
+ * lib/rexml/source.rb: ditto.
+
+ * lib/rexml/xmldecl.rb: ditto.
+
+Wed Mar 2 23:19:56 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * string.c (str_byte_substr): return nil for negative length.
+
+Wed Mar 2 21:15:00 2011 Tanaka Akira <akr@fsij.org>
+
+ * ext/openssl/ossl_pkey_dh.c: parenthesize macro arguments.
+
+Wed Mar 2 14:24:04 2011 Shota Fukumori <sorah@tubusu.net>
+
+ * lib/test/unit/parallel.rb: Fix name from `inclement_io` to
+ `increment_io`.
+
+Wed Mar 2 14:06:01 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * string.c (rb_str_slice_bang): move treatments which is only needed
+ when the result is not nil.
+
+Wed Mar 2 14:02:29 2011 Shota Fukumori <sorah@tubusu.net>
+
+ * test/testunit/test_parallel.rb(TestParallel#spawn_runner):
+ Fix outputing empty line in running test.
+
+ * test/testunit/tests_for_parallel/test_third.rb: Remove `sleep`
+
+Tue Mar 1 22:29:10 2011 Tanaka Akira <akr@fsij.org>
+
+ * ext/openssl/ossl_pkey.h: parenthesize macro arguments.
+
+Tue Mar 1 22:02:35 2011 Shota Fukumori <sorah@tubusu.net>
+
+ * lib/test/unit/parallel.rb: Fix number.
+
+Tue Mar 1 21:48:22 2011 Shota Fukumori <sorah@tubusu.net>
+
+ * lib/test/unit/parallel.rb: For Windows.
+
+ * test/testunit/test_parallel.rb(TestParallelWorker#test_quit_in_test):
+ Fix for above specification change.
+ * test/testunit/test_parallel.rb(TestParallel#spawn_runner):
+ Fix outputing empty line in running test.
+
+Tue Mar 1 20:51:57 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * test/ruby/test_system.rb (TestSystem#test_system_at):
+ remove tests for [bug#4396]. because we decided to reject this
+ ticket.
+
+Tue Mar 1 19:46:19 2011 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * test/date/{test_date.rb,test_date_attr.rb}: [ruby-dev:43280]
+
+Tue Mar 1 18:40:38 2011 Ryan Davis <ryan@YPCMC09457>
+
+ * lib/rubygems*: Import rubygems 1.6.0 (released version @ 58d8a0b9)
+ * test/rubygems: Ditto
+
+Tue Mar 1 16:22:22 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * win32/win32.c: revert r30987 because it causes some failures in
+ test-all, especially webrick.
+
+Tue Mar 1 15:59:53 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * string.c (rb_str_byteslice): the resulted encoding should keep
+ original encoding. this also fixes the encoding when the result
+ shares internal string. [ruby-core:35376]
+
+Tue Mar 1 13:25:00 2011 Kenta Murata <mrkn@mrkn.jp>
+
+ * ext/bigdecimal/bigdecimal.c (VpMemAlloc): CVE-2011-0188.
+ Fixes a bug reported by Drew Yao <ayao at apple.com>
+
+Tue Mar 1 10:34:39 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * string.c (rb_str_byteslice): Add String#byteslice. [ruby-core:35376]
+
+Tue Mar 1 00:12:49 2011 Tajima Akio <artonx@yahoo.co.jp>
+
+ * include/ruby/win32.h: define WIN32 if neither _WIN64 nor WIN32
+ defined. it forces to use push/pop for pack(4) pragma.
+
+Mon Feb 28 23:52:13 2011 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
+
+ * test/testunit/test_rake_integration.rb (test_with_rake_runner):
+ use assert_in_out_err for suppress messages.
+
+Mon Feb 28 22:48:56 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * win32/win32.c (rb_w32_spawn): use shell if a commandline contain
+ double-quote character.
+ * win32/win32.c (is_internal_cmd): similar, use shell if a commandline
+ contain caret character.
+
+ * test/ruby/test_system.rb (TestSystem#test_system_at): fix
+ wrong test case. if system() invoke a command by using shell,
+ system() never return nil. Also, "" quotation must not appear
+ twice in a command line.
+
+Mon Feb 28 17:36:57 2011 Tanaka Akira <akr@fsij.org>
+
+ * ext/openssl/ossl_pkcs7.c: parenthesize macro arguments.
+
+Mon Feb 28 16:48:42 2011 Tanaka Akira <akr@fsij.org>
+
+ * ext/openssl/ossl_pkcs12.c: parenthesize macro arguments.
+
+Mon Feb 28 16:28:15 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * string.c (tr_trans): when the hash for multibyte repl is empty,
+ tr is inverse mode, and a character doesn't much the table, the
+ character should be replaced by last replacement. Bug #4449
+
+Mon Feb 28 16:38:56 2011 Tanaka Akira <akr@fsij.org>
+
+ * ext/openssl/ossl_ocsp.c: parenthesize macro arguments.
+
+Mon Feb 28 13:02:15 2011 Danial Pearce <github@tigris.id.au>
+
+ * lib/tempfile.rb: Fix example file paths in docs for tempfile.
+ https://github.com/ruby/ruby/pull/5
+
+Mon Feb 28 12:56:18 2011 URABE Shyouhei <shyouhei@ruby-lang.org>
+
+ * ext/openssl/ossl_cipher.c (ossl_cipher_init): typo fix.
+ https://github.com/ruby/ruby/pull/8
+
+Mon Feb 28 12:28:13 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * ext/date/date_core.c (datetime_s_now): localtime() and localtime_r()
+ required time_t pointer as 1st parameter, and tv_sec member of struct
+ timeval is long.
+
+Mon Feb 28 11:57:40 2011 Shota Fukumori <sorah@tubusu.net>
+
+ * test/testunit/test_parallel.rb: Temporally disable test on Windows.
+
+Mon Feb 28 07:28:35 2011 Shota Fukumori <sorah@tubusu.net>
+
+ * lib/test/unit.rb(Test::Unit::Runner#after_worker_quit):
+ method name more be natural English.
+
+ * lib/test/unit.rb(Test::Unit::Runner::Worker.launch):
+ IO.sync doesn't need. Should use "b" for mode.
+
+Sun Feb 27 21:59:37 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * test/ruby/test_system.rb (TestSystem#test_system_redirect_win):
+ add test for system().
+
+Sun Feb 27 18:00:09 2011 Shota Fukumori <sorah@tubusu.net>
+
+ * lib/test/unit.rb: Refactoring; Worker never use Hash for internal
+ storage.
+
+ * lib/test/unit.rb: Never use Kernel#spawn. Use IO.popen instead.
+
+Sun Feb 27 13:16:48 2011 Tanaka Akira <akr@fsij.org>
+
+ * ext/openssl/ossl_ns_spki.c: parenthesize macro arguments.
+
+Sat Feb 26 17:07:53 2011 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * lib/date.rb: [Feature #4257]
+
+ * ext/date/extconf.rb: new
+
+ * ext/date/date_core.c: new
+
+Sat Feb 26 16:10:23 2011 Shota Fukumori <sorah@tubusu.net>
+
+ * lib/test/unit.rb: --jobs-status won't puts over 2 lines.
+
+ * test/testunit/test_parallel.rb: Fix test for above.
+
+ * lib/test/*: refactoring.
+
+Sat Feb 26 07:10:05 2011 Aaron Patterson <aaron@tenderlovemaking.com>
+
+ * ext/psych/lib/psych/scalar_scanner.rb: fix parsing timezone's whose
+ whose format is (+/-)hhmm. Thanks Goncalo Silva!
+
+ * test/psych/test_scalar_scanner.rb: test for bug.
+
+Thu Feb 24 23:02:55 2011 Tanaka Akira <akr@fsij.org>
+
+ * ext/openssl/ossl_hmac.c: parenthesize macro arguments.
+
+Thu Feb 24 22:53:10 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * common.mk (love): for the birthday.
+
+Thu Feb 24 22:51:54 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * vm.c (ruby_vm_destruct): run vm exit hooks after all objects are
+ destructed.
+
+Thu Feb 24 14:40:33 2011 Shota Fukumori <sorah@tubusu.net>
+
+ * ChangeLog (vim): Modeline for vim
+
+Thu Feb 24 13:39:25 2011 Shota Fukumori <sorah@tubusu.net>
+
+ * common.mk: Use $RUNRUBY for worker process.
+
+ * lib/test/unit.rb: Fix bug.
+
+ * lib/test/unit.rb: @options[:ruby](@opts[:ruby]) is now Array.
+
+ * test/testunit/parallel.rb: Fix for above.
+
+Thu Feb 24 10:05:55 2011 Shota Fukumori <sorah@tubusu.net>
+
+ * test/testunit/tests_for_parallel/misc.rb: Fix bug in r30947.
+
+ * lib/test/unit.rb, lib/test/unit/assertions.rb: For this test.
+
+Wed Feb 23 23:07:38 2011 Shota Fukumori <sorah@tubusu.net>
+
+ * test/testunit/test_parallel.rb, test/testunit/parallel/*:
+ Test for r30939.
+
+ * lib/test/unit.rb: For test.
+
+ * lib/test/parallel.rb: For test.
+
+ * lib/test/unit/testcase.rb: For test.
+
+Wed Feb 23 22:05:13 2011 Tanaka Akira <akr@fsij.org>
+
+ * ext/openssl/ossl_engine.c: parenthesize macro arguments.
+
+Tue Feb 22 23:15:17 2011 Shota Fukumori <sorah@tubusu.net>
+
+ * lib/test/unit.rb: Fix --ruby option doesn't effect.
+
+ * lib/test/unit.rb: Fix typo.
+
+Tue Feb 22 21:39:28 2011 Tanaka Akira <akr@fsij.org>
+
+ * ext/openssl/ossl_digest.c: parenthesize macro arguments.
+
+Tue Feb 22 14:34:26 2011 Shota Fukumori <sorah@tubusu.net>
+
+ * lib/test/unit.rb: Fix merging miss.
+
+Tue Feb 22 12:27:26 2011 Shota Fukumori <sorah@tubusu.net>
+
+ * lib/test/unit.rb: Add new options; --jobs,-j,--ruby,--jobs-status,
+ --no-retry.
+ [Feature #4415] [ruby-dev:43226],[ruby-dev:43222],[ruby-core:35294]
+
+ * lib/test/unit/parallel.rb: Used at test/unit --jobs(-j) option.
+
+ * test/csv/test_serialization.rb: test/unit parallel running ready.
+
+ * test/rake/test_file_task.rb: test/unit parallel running ready.
+
+Tue Feb 22 06:09:10 2011 Eric Hodel <drbrain@segment7.net>
+
+ * ext/syslog/syslog.c: Apply documentation patch from mathew murphy.
+ [Bug #4149]
+
+Tue Feb 22 03:09:10 2011 Aaron Patterson <aaron@tenderlovemaking.com>
+
+ * ext/psych/lib/psych.rb: increase Psych to 1.1.0 for help with
+ debugging.
+
+Tue Feb 22 03:04:46 2011 Aaron Patterson <aaron@tenderlovemaking.com>
+
+ * ext/psych/lib/psych/streaming.rb: refactor streaming methods to a
+ module.
+ * ext/psych/lib/psych/stream.rb: extracted streaming specific methods
+ to a module.
+ * ext/psych/lib/psych/json/stream.rb: JSON stream inherits from
+ JSONTree and includes streaming methods.
+ * ext/psych/lib/psych/visitors/json_tree.rb: JSON does not support
+ object references, so remove object reference testing when building
+ JSON trees.
+
+Tue Feb 22 02:41:51 2011 Aaron Patterson <aaron@tenderlovemaking.com>
+
+ * ext/psych/lib/psych/visitors/yaml_tree.rb (accept): use Hash#key?
+ when looking up object references to err on the side of cache
+ misses.
+
+Mon Feb 21 10:58:39 2011 Aaron Patterson <aaron@tenderlovemaking.com>
+
+ * ext/psych/lib/psych/json/yaml_events.rb: refactoring JSON event
+ handling methods to a module for reuse.
+ * ext/psych/lib/psych/json/tree_builder.rb: AST builder uses JSON
+ event methods.
+ * ext/psych/lib/psych/json/stream.rb: stream emitter uses JSON event
+ methods.
+
+Mon Feb 21 10:54:29 2011 Aaron Patterson <aaron@tenderlovemaking.com>
+
+ * ext/psych/lib/psych/json/stream.rb: do not emit custom tags in maps
+ or sequences when emitting JSON.
+ * ext/psych/lib/psych/json/tree_builder.rb: do not emit custom tags in
+ sequences when emitting JSON.
+ * test/psych/json/test_stream.rb: tests for custom stream emits.
+ * test/psych/test_json_tree.rb: tests for JSON emits.
+
+Mon Feb 21 10:05:10 2011 Aaron Patterson <aaron@tenderlovemaking.com>
+
+ * ext/psych/lib/psych/json/ruby_events.rb: DRY up ruby event handling
+ for JSON.
+ * ext/psych/lib/psych/visitors/json_tree.rb: use ruby events module
+ * ext/psych/lib/psych/json/stream.rb: ditto
+
+Mon Feb 21 10:01:01 2011 Aaron Patterson <aaron@tenderlovemaking.com>
+
+ * ext/psych/lib/psych/json/stream.rb: fix JSON stream emits to use
+ double quotes during stream.
+ * test/psych/json/test_stream.rb: tests to reflect changes.
+
+Mon Feb 21 00:38:56 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * test/ruby/test_system.rb (TestSystem#test_system_at):
+ add testcase for bug4396.
+
+Sun Feb 20 19:59:32 2011 Tanaka Akira <akr@fsij.org>
+
+ * ext/openssl/ossl_cipher.c: parenthesize macro arguments.
+
+Sun Feb 20 16:26:45 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * thread.c (exec_recursive): prevent temporary objects from GC.
+
+ * prevent temporary objects from GC, and should not use
+ RSTRING_PTR() for function calls since it evaluates the argument
+ a couple of times.
+
+Sun Feb 20 16:22:53 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * file.c (rb_file_flock): use rb_thread_io_blocking_region for the
+ time being.
+
+Sun Feb 20 05:33:17 2011 Ryan Davis <ryand-ruby@zenspider.com>
+
+ * lib/minitest/*.rb: Imported minitest 2.0.2 r6207.
+ * test/minitest/*: ditto
+
+Sun Feb 20 02:14:09 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * signal.c (sig_trap): avoid pthread_sigmask(xx, &mask, &mask) usage
+ because FreeBSD don't permit it. If it's used, it behave as
+ pthread_sigmask(xx, NULL, &mask).
+
+ * signal.c (init_sigchld): ditto.
+
+Sun Feb 20 00:46:51 2011 Tanaka Akira <akr@fsij.org>
+
+ * ext/openssl/ossl_bn.c: parenthesize macro arguments.
+
+Sat Feb 19 22:37:42 2011 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
+
+ * vm_insnhelper.c (vm_check_if_namespace): guard temporary object
+ from GC.
+
+Sat Feb 19 06:36:27 2011 Aaron Patterson <aaron@tenderlovemaking.com>
+
+ * lib/test/unit.rb: partial revert of r30849. [ruby-core:32864]
+
+ * test/testunit/test_rake_integration.rb: adding an integration test
+ with the rake loader to prevent regressions.
+
+Fri Feb 18 19:31:31 2011 Shugo Maeda <shugo@ruby-lang.org>
+
+ * lib/fileutils.rb (FileUtils::remove_entry_secure): there is a
+ race condition in the case where the given path is a directory,
+ and some other user can move that directory, and create a
+ symlink while this method is executing.
+ Reported by: Nicholas Jefferson <nicholas at pythonic.com.au>
+
+Fri Feb 18 00:28:39 2011 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
+
+ * compile.c (get_exception_sym2type): guard temporary object from GC.
+
+Thu Feb 17 23:54:29 2011 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
+
+ * iseq.c (prepare_iseq_build): initialize iseq_compile_data::err_info
+ with nil. this fix exception in rb_iseq_load().
+
+Thu Feb 17 22:32:35 2011 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
+
+ * test/ruby/test_marshal.rb (test_marshal_dump_extra_iv):
+ fix a typo of local variable. [Bug #3720] [ruby-dev:42083]
+
+Thu Feb 17 21:32:53 2011 Tanaka Akira <akr@fsij.org>
+
+ * ext/openssl/ossl.h: parenthesize macro arguments.
+
+Wed Feb 16 20:37:48 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * eval_jump.c (rb_exec_end_proc): changed at_exit and END proc
+ evaluation order. [Bug #4400] [ruby-core:35237]
+ * eval_jump.c (rb_mark_end_proc): ditto.
+
+ * test/ruby/test_beginendblock.rb (TestBeginEndBlock#test_nested_at_exit):
+ added a test for nested at_exit.
+ * test/ruby/test_beginendblock.rb (TestBeginEndBlock#test_beginendblock):
+ changed the test to adopt new spec.
+
+Wed Feb 16 20:17:06 2011 Tanaka Akira <akr@fsij.org>
+
+ * ext/openssl/openssl_missing.h: parenthesize macro arguments.
+
+Tue Feb 15 21:37:45 2011 Tanaka Akira <akr@fsij.org>
+
+ * ext/gdbm/gdbm.c: parenthesize macro arguments.
+
+Tue Feb 15 20:34:53 2011 Tanaka Akira <akr@fsij.org>
+
+ * array.c (ary_join_1): fix array size.
+
+Tue Feb 15 19:43:23 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * configure.in: fix and resubmit r30621. [ruby-dev:43203]
+
+Tue Feb 15 15:41:30 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * array.c (array_join): copy the encoding of the first element as
+ an initial encoding.
+
+ * array.c (array_join_0): ditto.
+
+ * array.c (array_join_1): ditto.
+
+ * array.c (inspect_ary): ditto.
+
+ * array.c (array_join_1): add an argument to check the appending is
+ first one or not.
+
+Tue Feb 15 15:40:53 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * hash.c (inspect_i): copy the encoding of the first key as
+ an initial encoding.
+
+Mon Feb 14 15:00:16 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * array.c (inspect_ary): don't taint the inspected result of a
+ recursive array.
+
+Tue Feb 15 15:43:29 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * encoding.c (rb_enc_compatible): change the rule for empty strings:
+ remove the special treatment of the US-ASCII encoded empty string.
+ Now Encoding.compatible? usually respect the encoding of the
+ receiver.
+
+Tue Feb 15 15:39:37 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * string.c (rb_enc_cr_str_buf_cat): remove special treatment of
+ ASCII-8BIT receivers.
+
+ * string.c (str_gsub): set initial encoding of the buffer as the
+ same of the receiver. [ruby-core:35141]
+
+Tue Feb 15 09:49:33 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * test/ruby/test_system.rb (TestSystem#test_system_at): use findstr
+ command instead of find command, because the latter is confusing
+ another famous Unix command.
+
+Mon Feb 14 23:01:19 2011 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
+
+ * thread.c (rb_thread_io_blocking_region): reset th->waiting_fd
+ after blocking region, because remaining waiting_fd might
+ cause unnecessary IOError.
+
+Mon Feb 14 21:06:50 2011 URABE Shyouhei <shyouhei@ruby-lang.org>
+
+ * configure.in: revert r30621. That revision introduced mkmf test
+ failures and it turned out to be OK to revert. [ruby-dev:43203]
+
+Mon Feb 14 21:04:01 2011 Tanaka Akira <akr@fsij.org>
+
+ * ext/fiddle/conversions.h: parenthesize macro arguments.
+
+Mon Feb 14 18:41:47 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * win32/setup.mak (USE_RUBYGEMS): fixed r30835. It didn't work on
+ mswin32 port. If you changed win32/configure.bat, you should change
+ setup.mak too.
+
+Mon Feb 14 17:28:34 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * test/ruby/test_system.rb (TestSystem#test_system_at):
+ added test. [ruby-core:35218] (#4393)
+
+Mon Feb 14 13:15:35 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * win32/win32.c (is_internal_cmd): if the first char of prog is '@',
+ execute it via shell. [ruby-core:35218] (#4393)
+
+Mon Feb 14 10:33:45 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * lib/test/unit.rb: revert r30863, because it causes too many noise.
+
+Mon Feb 14 07:34:55 2011 Tanaka Akira <akr@fsij.org>
+
+ * ext/curses/curses.c: parenthesize macro arguments.
+
+Sun Feb 13 19:41:47 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/test/unit.rb (Test::Unit::RequireFiles#non_options): skip
+ test suites failed to load instead of mere messages.
+
+Sun Feb 13 09:56:44 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * test/openssl/test_config.rb (OpenSSL#test_freeze): fix error
+ message assertion.
+
+ * test/io/nonblock/test_flush.rb (TestIONonblock#flush_test):
+ return true to finish the test.
+
+ * test/syck/test_string.rb (Syck::TestString#test_non_binary_string):
+ use assert_not instead of refute, unless required minitest
+ explicitly.
+
+ * test/test_prime.rb (TestPrime::sieve.Integer): ditto.
+
+ * test/xmlrpc/webrick_testing.rb (WEBrick_Testing#start_server):
+ catch IOError when server socket was closed.
+
+Sun Feb 13 07:39:51 2011 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * enum.c (enum_inject): typo fixed. a patch from Gaku Ueda in
+ [ruby-core:35216].
+
+Sun Feb 13 00:48:47 2011 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * lib/date.rb (Date#===): [ruby-core:35127]
+
+Sun Feb 13 00:29:18 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/test/unit.rb (Test::Unit::Options#process_args): always
+ return options.
+
+ * lib/test/unit.rb (Test::Unit::RequireFiles#non_options): return
+ if any test case get loaded.
+
+ * lib/test/unit.rb (Test::Unit::AutoRunner#initialize): do not add
+ default directory if it is nil.
+
+ * lib/test/unit.rb (Test::Unit::AutoRunner#process_args): return
+ true if any test cases to run.
+
+Sat Feb 12 23:17:43 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/test/unit.rb (assert_include): add alias.
+
+Sat Feb 12 14:44:20 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * thread.c (rb_thread_io_blocking_region): new function to run
+ blocking region with GIL released, for fd.
+
+ * thread.c (rb_thread_fd_close): implement. [ruby-core:35203]
+
+ * vm.c (th_init): rename from th_init2.
+
+Sat Feb 12 14:41:36 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/test/unit.rb (Test::Unit::AutoRunner#initialize): use
+ default_dir if no test case given.
+
+ * lib/test/unit.rb (Test::Unit::Runner): rename from Test::Unit::Mini.
+
+ * lib/test/unit.rb (Test::Unit::GlobOption#non_options): run tests
+ under base directory if no argument given.
+
+Sat Feb 12 08:03:12 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * test/ruby/test_settracefunc.rb (TestSetTraceFunc): ensure to use
+ method_added hook defined in Module.
+
+Sat Feb 12 01:04:02 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ruby.c (proc_options): enable rubygems if --gem option is given.
+
+ * ruby.c (process_options): load rubygems if it is disabled but
+ --gem option is given.
+
+Fri Feb 11 23:27:50 2011 Yuki Sonoda (Yugui) <yugui@yugui.jp>
+
+ * ruby.c (proc_options): add --gem=enabled as an alias of
+ --enable=gems and --gem=disabled as an alias of --disable=gems.
+ Gem named "enabled" or "disabled" has already been reserved
+ legitimately for this purpose.
+
+Fri Feb 11 23:17:04 2011 Tanaka Akira <akr@fsij.org>
+
+ * ext/dl/cfunc.c: parenthesize macro arguments.
+
+Fri Feb 11 21:41:53 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * bin/testrb, test/runner.rb, lib/test/unit.rb: improve backward
+ compatibility.
+
+Fri Feb 11 19:45:26 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * eval.c (ruby_cleanup): use rb_ary_free to free internal object.
+
+ * gc.h (RUBY_FREE_UNLESS_NULL): get rid of double free.
+ [ruby-core:35192]
+
+Fri Feb 11 16:57:03 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * test/ruby/test_transcode.rb (test_from_cp50221): fix wrong
+ assertion and move back.
+
+Fri Feb 11 14:33:18 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/test/unit/assertions.rb (assert_no_match): alias for
+ backward compatibility.
+
+Fri Feb 11 12:06:48 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ruby.c (add_gems, require_libraries, proc_options): add
+ --require and --gem options.
+
+Fri Feb 11 12:03:24 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * configure.in (rubygems): add --disable-rubygems option.
+
+Fri Feb 11 11:39:03 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * template/fake.rb.in (CROSS_COMPILING): get rid of NameError.
+
+Thu Feb 10 23:12:34 2011 Tanaka Akira <akr@fsij.org>
+
+ * ext/dl/dl.h: parenthesize macro arguments.
+
+Wed Feb 9 23:11:27 2011 Tanaka Akira <akr@fsij.org>
+
+ * ext/pty/pty.c: parenthesize macro arguments.
+
+Tue Feb 8 11:47:11 2011 Loren Sands-Ramshaw <lorensr@gmail.com>
+
+ * array.c: documentation clarification in rotate, rotate!,
+ index, and rindex. [ruby-core:35144]
+
+Wed Feb 9 09:45:43 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * test/rdoc/test_rdoc_encoding.rb: remove unnecessary (and wrong)
+ platform-dependent hacks.
+
+Wed Feb 9 00:47:18 2011 Tanaka Akira <akr@fsij.org>
+
+ * ext/etc/etc.c: parenthesize macro arguments.
+
+Tue Feb 8 19:38:00 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * misc/ruby-mode.el (ruby-expr-beg): fix for invalid nest errors.
+
+Tue Feb 8 19:22:59 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * configure.in (AC_MSG_CHECKING): fixed typo. the patch is
+ created by Benoit Daloze. Thanks a lot. [Bug #4384][ruby-core:35148]
+
+Tue Feb 8 16:04:03 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * io.c (rb_io_s_sysopen): use NUM2MODET() instead NUM2UINT().
+
+Tue Feb 8 15:59:23 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * process.c (rb_run_exec_options_err): use MODET2NUM() instead
+ LONG2NUM().
+
+Tue Feb 8 13:59:56 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * configure.in: revert r30725. Now we have proper runtime fallback.
+ Therefore, no need compile time disabling. (see r30762).
+
+Tue Feb 8 01:00:21 2011 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
+
+ * process.c (proc_setgroups): add GC guard to prevent intermediate
+ variable from GC.
+
+Tue Feb 8 00:56:33 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * misc/ruby-mode.el (ruby-expr-beg, ruby-in-here-doc-p): tell
+ singleton class definitions from here documents.
+
+ * misc/ruby-mode.el (ruby-expr-beg, ruby-parse-partial): keyword
+ followed by colon is label.
+
+Mon Feb 7 22:56:16 2011 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
+
+ * lib/benchmark.rb (Benchmark#bmbm): use ensure clause instead of
+ Object#tap to restore STDOUT.sync.
+
+Mon Feb 7 22:34:20 2011 Tanaka Akira <akr@fsij.org>
+
+ * lib/net/http.rb (Net::HTTP#connect): support SNI (Server Name
+ Indication) for HTTPS. [ruby-dev:43164]
+ http://stackoverflow.com/questions/4685736/openssl-server-name-indication-support-in-ruby
+
+Mon Feb 7 16:05:32 2011 Eric Hodel <drbrain@segment7.net>
+
+ * lib/rdoc: Upgrade to RDoc 3.5.3 Fixes [Bug #4376]
+
+Mon Feb 7 11:46:59 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * common.mk (rdoc): add --encoding=UTF-8; ruby's rdoc must be UTF-8.
+
+Mon Feb 7 10:21:50 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * test/rdoc/test_rdoc_options.rb (TestRDocOptions#test_check_files):
+ there is no easy way to create owner unreadable file on Windows.
+ So, skip the test.
+
+Sun Feb 6 13:48:29 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/json/lib/json/common.rb (JSON::MissingUnicodeSupport.iconv):
+ should not drop rest of the result. use Iconv.conv instead.
+
+Sun Feb 6 12:46:02 2011 Eric Hodel <drbrain@segment7.net>
+
+ * string.c (gsub): Ensure result encoding is the same as input
+ encoding. [Bug #4340].
+
+Sun Feb 6 12:18:25 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * parse.y (words, qwords): dispatch array events. based on a
+ patch from Michael Edgar. [Bug #4365].
+
+Sun Feb 6 12:12:59 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * test/fileutils/fileasserts.rb (FileAssertions): separate module.
+
+Sun Feb 6 11:29:23 2011 Tanaka Akira <akr@fsij.org>
+
+ * ext/dbm/dbm.c: parenthesize macro arguments.
+
+Sat Feb 5 22:01:59 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * lib/test/unit/assertions.rb (Test::Unit::Assertions#assert):
+ revert r30796. r30797 and r30798 are an alternative fix.
+ [ruby-dev:43174]
+
+Sat Feb 5 21:47:09 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * parse.y (mlhs_basic): include mlhs_post for ripper. a patch
+ from Michael Edgar at [ruby-core:35078].
+
+Sat Feb 5 21:22:21 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/test/unit/assertions.rb (assert_block): move from
+ test/fileutils/fileasserts.rb.
+
+ * test/fileutils/fileasserts.rb (assert_block): pass arguments
+ as-is. [ruby-dev:43174]
+
+Sat Feb 5 16:47:54 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * lib/test/unit/assertions.rb (Test::Unit::Assertions#assert):
+ msg can be passed nil. [Bug #4371] [ruby-dev:43174]
+
+Sat Feb 5 15:18:25 2011 Eric Hodel <drbrain@segment7.net>
+
+ * lib/rdoc: Upgrade to RDoc 3.5.2
+
+Sat Feb 5 12:05:27 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/syck/rubyext.c (syck_node_init_copy): SyckNode is not
+ copiable. [ruby-core:35094]
+
+Sat Feb 5 11:48:47 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/openssl/ossl_cipher.c (ossl_cipher_alloc): leave data ptr
+ NULL.
+
+ * ext/openssl/ossl_cipher.c (ossl_cipher_new, ossl_cipher_initialize):
+ allocate internal structure. [ruby-core:35094]
+
+ * ext/openssl/ossl_cipher.c (ossl_cipher_copy): ditto.
+
+Sat Feb 5 11:29:10 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/json/parser/parser.h (GET_PARSER): raise TypeError.
+
+ * ext/json/parser/parser.rl (cParser_initialize): ditto.
+
+ * ext/json/parser/parser.h (GET_PARSER): check if initialized.
+ [ruby-core:35079]
+
+ * ext/json/parser/parser.rl (cParser_initialize): ditto.
+
+Sat Feb 5 10:09:31 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * load.c (rb_get_expanded_load_path): always expand load paths.
+
+Sat Feb 5 09:38:08 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * transcode.c (encoded_dup): extract.
+
+Sat Feb 5 03:37:47 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/fileutils.rb (FileUtils::LowMethods): make low level methods
+ in NoWrite and DryRun to do nothing. [ruby-dev:43129]
+
+ * test/fileutils/fileasserts.rb: add message arguments.
+
+ * test/fileutils/fileasserts.rb (Test::Unit::Assertions#assert_block):
+ show the given message.
+
+Sat Feb 5 02:09:39 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * parse.y (lex_getline, parser_set_encode): set encoding of lines
+ in SCRIPT_LINES__ as source encoding. [ruby-dev:43168]
+
+Sat Feb 5 02:08:37 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * vm.c (ruby_thread_data_type): add prefix.
+
+Sat Feb 5 00:59:54 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * vm_core.h (GetThreadPtr): use TypedData_Get_Struct() instead
+ CoreDataFromValue() because we need type check. Otherwise,
+ type mismatch can cause segmentation fault crash.
+ [ruby-core:35086] [Ruby 1.9-Bug#4367]
+
+ * vm.c (thread_data_type): remove static.
+
+Fri Feb 4 19:14:27 2011 Tanaka Akira <akr@fsij.org>
+
+ * enc/trans/utf8_mac.trans: parenthesize macro arguments.
+
+Fri Feb 4 12:11:51 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * string.c (str_utf8_nth): fixed a condition of optimized lead
+ byte counting. [Bug #4366][ruby-dev:43170]
+
+Fri Feb 4 01:50:13 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * string.c (count_utf8_lead_bytes_with_word): wrote function
+ comments.
+
+Fri Feb 4 00:14:55 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/zlib/zlib.c (gzfile_reader_get_unused): no need to dup
+ before rb_str_resurrect.
+
+Thu Feb 3 20:04:44 2011 Tanaka Akira <akr@fsij.org>
+
+ * ext/curses/curses.c (CHECK): unused macro removed.
+
+Thu Feb 3 18:33:26 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * ext/zlib/zlib.c (gzfile_reader_get_unused): use rb_str_resurrect
+ because gz->z.input is hidden string. [ruby-core:35057]
+
+Thu Feb 3 16:34:10 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * enc/shift_jis.c (code_to_mbc): cast as int from the subtraction of
+ pointers.
+
+ * enc/utf_16le.c (utf16le_mbc_enc_len): use ptrdiff_t.
+
+ * enc/utf_32be.c (utf32be_left_adjust_char_head): ditto.
+
+ * enc/utf_32le.c (utf32le_left_adjust_char_head): ditto.
+
+Thu Feb 3 16:31:43 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * include/ruby/missing.h: don't use HAVE_STDDEF_H because it never
+ defined by configure though configure.bat defines it.
+
+ * include/ruby/ruby.h: move include stddef.h to defines.h
+
+ * include/ruby/defines.h: ditto.
+
+Wed Feb 2 20:25:04 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * include/ruby/encoding.h (rb_enc_step_back): cast 4th argument 'n'
+ as int because Ruby usually treats length value as long but
+ onigenc_step_back's 4th argument is int.
+
+Thu Feb 3 07:20:46 2011 Aaron Patterson <aaron@tenderlovemaking.com>
+
+ * ext/psych/lib/psych/visitors/to_ruby.rb: use Regexp::NOENCODING
+ rather than magic number.
+
+ * ext/syck/lib/syck/rubytypes.rb: ditto
+
+Thu Feb 3 07:16:11 2011 Aaron Patterson <aaron@tenderlovemaking.com>
+
+ * re.c (Init_Regexp): added a constant for ARG_ENCODING_NONE
+ [ruby-core:35054]
+
+ * test/ruby/test_regexp.rb: corresponding test.
+
+Thu Feb 3 07:02:16 2011 Aaron Patterson <aaron@tenderlovemaking.com>
+
+ * ext/psych/lib/psych/visitors/to_ruby.rb: ARG_ENCODING_NONE regular
+ expressions can round trip. [ruby-core:34969]
+
+ * test/psych/test_yaml.rb: test for ARG_ENCODING_NONE regex
+
+ * ext/sych/lib/syck/rubytypes.rb: ARG_ENCODING_NONE regular
+ expressions can round trip.
+
+ * test/syck/test_yaml.rb: test for ARG_ENCODING_NONE regex
+
+Wed Feb 2 17:09:22 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * io.c (rb_io_fdatasync): Use fsync(2) if the underlying
+ operating system does not support fdatasync(2).
+
+Wed Feb 2 14:51:08 2011 Eric Hodel <drbrain@segment7.net>
+
+ * lib/rdoc/markup/to_tt_only.rb: commit miss
+ * test/rdoc/test_rdoc_markup_to_tt_only.rb: ditto
+ * test/rdoc/test_rdoc_single_class.rb: ditto
+
+Wed Feb 2 09:27:53 2011 Eric Hodel <drbrain@segment7.net>
+
+ * lib/rdoc: Upgrade to RDoc 3.5.1
+
+Wed Feb 2 00:30:43 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * include/ruby/st.h (st_table): Added comment why we need __extension__.
+
+Tue Feb 1 20:45:44 2011 Tanaka Akira <akr@fsij.org>
+
+ * enc/encdb.c: parenthesize macro arguments.
+
+Tue Feb 1 15:12:26 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * test/ruby/test_require.rb (TestRequire#test_require_with_unc):
+ use ``127.0.0.1'' instead of ``localhost'' as host name, because
+ XP or earlier cannot resolv it as NBT hostname.
+
+Tue Feb 1 13:20:39 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * test/benchmark/test_benchmark.rb (#capture_bench_output):
+ Added explicit sleep. Windows have imprecise time support.
+ Thus Tms.new.Add!{} may be or may be not equal 0. The
+ test failure started since r30747.
+
+Tue Feb 1 11:03:47 2011 Ryan Davis <ryan@lust.local>
+
+ * lib/rubygems*: Import rubygems 1.5.0 (released version @ 1fb59d0)
+ * test/rubygems: Ditto
+
+Tue Feb 1 08:01:39 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/io/console/console.c (console_set_winsize): new method to set
+ console size. [EXPERIMENTAL]
+
+ * ext/io/console/console.c (console_winsize): use GetWriteFD.
+
+Tue Feb 1 02:28:14 2011 Masaya Tarui <tarui@ruby-lnag.org>
+
+ * include/ruby/win32.h, win32/win32.c: add rb_w32_inet_ntop.
+ inet_ntop's minimum supported client is Vista.
+
+Tue Feb 1 00:10:30 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * lib/benchmark.rb: fix benchmark to work with current ruby.
+ patched by Benoit Daloze [ruby-core:33846] [ruby-dev:43143]
+ merged from https://github.com/eregon/ruby/commits/benchmark
+
+ * lib/benchmark (Report#width): update documentation
+ * lib/benchmark: document the return value of #benchmark and the
+ :list attribute in Report
+ * lib/benchmark (Tms#format): rename variables, use String#%
+ instead of Kernel.format
+ * lib/benchmark: remove undocumented Benchmark::times (an alias
+ of Process::times used twice)
+ * lib/benchmark (#benchmark): use label_width for the caption
+ * lib/benchmark (Tms#initialize): rename variables
+ * lib/benchmark: allow title to not be a String and call #to_s
+ * lib/benchmark (Benchmark#bm): return an Array of the times with
+ the labels
+ * lib/benchmark: correct output for Benchmark#bmbm
+ (remove the extra space)
+ * lib/benchmark: add a few tests for Benchmark::Tms output
+ * lib/benchmark: improve style (enumerators, ljust, unused vars)
+ * lib/benchmark: add spec about output and return value
+ * lib/benchmark: improve basic style and consistency
+ no parenthesis for print and use interpolation instead of printf
+ * lib/benchmark: remove unnecessary conversions and variables
+ * lib/benchmark: correct indentation
+ * lib/benchmark: rename the FMTSTR constant and variable to FORMAT
+ * lib/benchmark: remove useless exception
+
+ * test/benchmark: remove unused variable warnings
+
+Mon Jan 31 23:27:23 2011 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
+
+ * node.c (add_id): remove duplicated rb_id2str() call.
+
+Sun Jan 30 17:19:46 2011 Tanaka Akira <akr@fsij.org>
+
+ * missing/langinfo.c: parenthesize macro arguments.
+
+Mon Jan 31 21:57:39 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * configure.in: revert r30698.
+
+Mon Jan 31 21:32:44 2011 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
+
+ * thread.c (thread_start_func_2): check deadlock condition before
+ release thread stack. fix memory violation when deadlock detected.
+ reported by Max Aller. [Bug #4009] [ruby-core:32982]
+
+Mon Jan 31 14:45:47 2011 Yuki Sonoda (Yugui) <yugui@yugui.jp>
+
+ * lib/irb/locale.rb (IRB::Locale::#search_file):
+ Gem might be undefined if --disable-gems. [ruby-core:34990]
+
+Mon Jan 31 12:26:14 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * addr2line.c: suppressed shorten-64-to-32 warnings.
+ * regcomp.c: ditto.
+ * regexec.c: ditto.
+ * regint.h: ditto.
+ * regparse.c: ditto.
+ * regparse.h: ditto.
+ * time.c: ditto.
+ * variable.c: ditto.
+
+Mon Jan 31 04:45:12 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * array.c (rb_ary_uniq_bang): call ARY_SET_LEN(ary, 0) before
+ ary_resize_capa because ary_resize_capa expects resized length is
+ smaller than current array length. call rb_ary_unshare before
+ ary_resize_capa because ary_resize_capa lost the reference to
+ original shared array. [ruby-core:34997]
+
+Sun Jan 30 17:19:46 2011 Tanaka Akira <akr@fsij.org>
+
+ * missing/crypt.c: parenthesize macro arguments.
+
+Sun Jan 30 16:40:27 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * test/rubygems/test_gem_security.rb (TestGemSecurity): valid only
+ if OpenSSL is available.
+
+ * test/dl/test_dl2.rb (TestDL#test_sin): math functions do not
+ work on x86_64 due to the design of DL2.
+
+ * test/dl/test_func.rb (DL::TestFunc#test_{sinf,sin): ditto.
+
+Sun Jan 30 16:09:22 2011 Tanaka Akira <akr@fsij.org>
+
+ * strftime.c (rb_strftime_with_timespec): %G produces 4 digits.
+
+Sun Jan 30 15:13:19 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * enc/emacs_mule.c (emacsmule_islead): 7bit range is also leading
+ byte.
+
+Sun Jan 30 13:03:16 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * hash.c (rb_hash_fetch_m): use useful message for longer key, not a
+ nonsense id value.
+
+ * string.c (rb_str_ellipsize): new function to ellipsize a string.
+
+ * include/ruby/encoding.h (rb_enc_step_back): new function to step
+ back n characters.
+
+Sun Jan 30 12:53:38 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * enc/emacs_mule.c (emacsmule_islead): fix inverse condition.
+
+Sun Jan 30 09:37:25 2011 Yutaka Kanemoto <kanemoto@ruby-lang.org>
+
+ * io.c (struct argf): char behaves like an unsigned char
+ by default on AIX.
+
+Sun Jan 30 08:02:55 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * configure.in: Mac OS X wrongly reports it has fdatasync(3).
+
+Sun Jan 30 03:29:47 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * ext/openssl/ossl_bn.c (GetBNPtr): add missing nil case.
+ patched by Martin Bosslet. [ruby-core:34987]
+
+Sun Jan 30 01:02:28 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * include/ruby/ruby.h: Added NUM2MODET() and MODET2NUM() default
+ definition.
+ Because r30686 introduced win32 build failure.
+
+Sat Jan 29 22:16:26 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * array.c (rb_ary_join): [].join.encoding must be US-ASCII.
+ [ruby-list:47790]
+
+Sat Jan 29 20:22:39 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * benchmark/driver.rb (BenchmarkDriver#measure): Show command line
+ when abnormal exiting occur.
+
+Sat Jan 29 10:53:16 2011 Yusuke Endoh <mame@tsg.ne.jp>
+
+ * vm_insnhelper.c (vm_get_ev_const): no-scope reference to toplevel
+ private constant has been prohibited incorrectly.
+
+ * test/ruby/test_module.rb (test_toplevel_private_constant): add a
+ test for above.
+
+Sat Jan 29 08:43:23 2011 Ryan Davis <ryand-ruby@zenspider.com>
+
+ * lib/rubygems*: Import rubygems 1.5.0 (release candidate @ 09893d9)
+ * test/rubygems: Ditto
+
+Sat Jan 29 02:02:37 2011 Yusuke Endoh <mame@tsg.ne.jp>
+
+ * variable.c (rb_mod_const_of, sv_i): Module#constant should exclude
+ private constants. see [ruby-core:32912].
+
+ * test/ruby/test_module.rb (test_constants_with_private_constant): add
+ a test for above.
+
+Sat Jan 29 01:36:41 2011 Yusuke Endoh <mame@tsg.ne.jp>
+
+ * variable.c (rb_const_set): const_set should preserve constant
+ visibility. see [ruby-core:32912].
+
+ * test/ruby/test_module.rb: add a test for above.
+
+Sat Jan 29 01:24:57 2011 Yusuke Endoh <mame@tsg.ne.jp>
+
+ * compile.c (NODE_CLASS, NODE_MODULE), insns.def (defineclass): raise
+ an exception when "class Foo::Bar" is evaluated and Foo::Bar is
+ private. To implement this, define_type of "defineclass" is added
+ so that the instruction can distinguish whether the class definition
+ is scoped (class Foo::Bar) or not (class Bar).
+
+ * test/ruby/test_class.rb (test_redefine_private_class),
+ test/ruby/test_module.rb
+ (test_define_module_under_private_constant): add tests for above.
+
+Sat Jan 29 01:19:17 2011 Yusuke Endoh <mame@tsg.ne.jp>
+
+ * constant.h, variable.c: to ensure compatibility, rb_const_get_* must
+ not raise an exception even when the constant is private. Instead,
+ rb_public_const_get_* and rb_public_const_defined_* are introduced,
+ which raise an exception when the referring constant is private.
+ see [ruby-core:32912].
+
+ * vm_insnhelper.c (vm_get_ev_const): use rb_public_const_get_* instead
+ of rb_const_get_* to follow the constant visibility when user code
+ refers a constant.
+
+ * test/ruby/test_marshal.rb (test_marshal_private_class): add a test.
+ This test had failed because of incompatibility of rb_const_get.
+
+Sat Jan 29 00:30:44 2011 Yusuke Endoh <mame@tsg.ne.jp>
+
+ * variable.c (set_const_visibility): fix typo. a patch from Tomoyuki
+ Chikanaga in [ruby-core:32919].
+
+Fri Jan 28 23:20:28 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * test/gdbm/test_gdbm.rb (TestGDBM#test_s_open_no_create,
+ TestGDBM2#test_writer_open_notexist): We only need to skip libgdbm
+ 1.8.0, not all 1.8.x. 1.8.1 or later don't have GDBM_WRITER sickness.
+
+Fri Jan 28 21:56:57 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * ext/dbm/extconf.rb: Added new header places for Fedora13.
+
+Fri Jan 28 21:49:30 2011 Tanaka Akira <akr@fsij.org>
+
+ * ext/zlib/zlib.c: parenthesize macro arguments.
+
+Fri Jan 28 17:47:33 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * test/gdbm/test_gdbm.rb (TestGDBM2#test_writer_open_notexist):
+ gdbm 1.8.x changed GDBM::WRITER behavior. Thus our testcase need
+ to be changed too.
+
+Fri Jan 28 17:33:28 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * test/gdbm/test_gdbm.rb (TestGDBM#test_s_open_no_create): skip
+ the test if gdbm version is 1.8.x.
+
+Fri Jan 28 16:30:51 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * test/ruby/test_require.rb (TestRequire#test_require_too_long_filename):
+ Added -w option because too long path error don't output a message
+ by default since r30660. [Bug #4336] [ruby-dev:43134]
+
+Fri Jan 28 16:19:38 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * test/ruby/test_require.rb (TestRequire#test_require_path_home_{1,2}):
+ Added -w option because too long path error don't output a message
+ by default since r30660. [Bug #4336] [ruby-dev:43134]
+
+Fri Jan 28 16:04:54 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * test/ruby/test_require.rb (TestRequire#test_require_path_home_{1,2,3}):
+ split from test_require_path_home.
+
+Fri Jan 28 13:04:38 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * configure.in (--with-valgrind): Fixed r29683. Now this option
+ is really default on.
+
+Fri Jan 28 12:05:48 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * configure.in: Add #include<sys/stat.h> when struct stat is
+ tested. Otherwise, incomplete type dereference error will occur.
+
+Fri Jan 28 11:53:19 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * configure.in: redundant variable names made strange conftest
+ error. Fixed it.
+
+Fri Jan 28 11:47:00 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * test/ruby/test_process.rb (TestProcess#test_too_long_path{,2}):
+ should handle Errno::E2BIG, because this test checks crash of ruby,
+ not the error type system.
+
+Fri Jan 28 11:23:54 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * io.c (rb_io_open): Use NUM2MODET() instead NUM2UINT().
+ * io.c (rb_scan_open_args): ditto.
+
+Fri Jan 28 10:58:20 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * configure.in: Added mode_t type checking.
+ * process.c (rb_exec_arg_addopt): Use NUM2MODET() instead
+ NUM2LONG because clang makes compile error by this narrowing
+ conversion.
+ * process.c (rb_run_exec_options_err): ditto.
+
+Fri Jan 28 02:37:18 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * re.c (rb_reg_raise): add GC guard to prevent intermediate
+ variable from GC.
+
+Fri Jan 28 02:35:41 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * hash.c (rb_hash_fetch_m): add GC guard to prevent intermediate
+ variable from GC.
+
+Fri Jan 28 01:33:51 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * test/ruby/test_process.rb (TestProcess#test_too_long_path)
+ TestProcess#test_too_long_path): Reduced string size from 100MB
+ to 10MB. 100MB may cause no memory error. It isn't intended.
+
+Fri Jan 28 01:27:42 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * test/ruby/test_process.rb (TestProcess#test_too_long_path2):
+ Factored out from test_too_long_path. A test should only do
+ one test.
+
+Thu Jan 27 23:29:36 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * st.c (st_foreach): check if unpacked.
+
+Thu Jan 27 23:14:19 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * misc/ruby-mode.el (ruby-mode-map): remove deprecated binding.
+ use M-; instead.
+
+Thu Jan 27 21:58:32 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * bignum.c (rb_str_to_inum): get rid of too huge alloca().
+
+Thu Jan 27 21:43:29 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * object.c (rb_str_to_dbl): rewrite again. use ALLOCV instead
+ rb_str_tmp_new().
+
+Thu Jan 27 21:41:47 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * win32/win32.c: get rid of STRNDUPA(). It's dangerous API.
+
+Thu Jan 27 21:31:57 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * win32/win32.c (rb_w32_aspawn): get rid of too huge alloca().
+ [Bug #4330] [ruby-core:34898]
+
+Thu Jan 27 20:30:18 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * win32/win32.c (rb_w32_spawn): get rid of too huge alloca().
+
+Thu Jan 27 18:49:53 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * win32/win32.c (open_dir_handle): get rid of too huge alloca().
+
+Thu Jan 27 18:34:58 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * file.c (w32_io_info): get rid of too huge alloca().
+ [Bug #4313] [ruby-core:34830]
+
+Thu Jan 27 18:19:51 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * win32/win32.c (wstati64): get rid of too huge alloca().
+ [Bug #4316] [ruby-core:34834]
+
+Thu Jan 27 15:11:52 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * win32/win32.c (rb_w32_spawn, rb_w32_aspawn): get rid of too huge
+ alloca(). this is the real fix of [ruby-core:34833].
+
+Thu Jan 27 12:46:25 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * process.c (ALLOC_ARGV_WITH_STR): fix void pointer arithmetic.
+
+Thu Jan 27 08:41:40 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * process.c (proc_exec_v, rb_proc_exec_n, rb_proc_exec)
+ (proc_spawn_n, proc_spawn): get rid of too huge alloca().
+ [ruby-core:34827], [ruby-core:34833]
+
+Thu Jan 27 08:32:17 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * include/ruby/ruby.h (ALLOCV): new API for exception-safe
+ temporary buffer. [ruby-core:34844]
+
+ * string.c (rb_alloc_tmp_buffer, rb_free_tmp_buffer):
+ implementation of the API.
+
+Thu Jan 27 08:22:49 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * dln_find.c (dln_find_1): use rb_warning and return immediately
+ if fname is longer than buffer.
+
+Wed Jan 26 22:57:30 2011 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
+
+ * class.c (clone_method): add GC guard to prevent intermediate
+ variable from GC. [Bug #4321] [ruby-dev:43107]
+
+Wed Jan 26 22:45:16 2011 Tanaka Akira <akr@fsij.org>
+
+ * template/id.h.tmpl: parenthesize macro arguments.
+
+Wed Jan 26 22:28:49 2011 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
+
+ * vm_eval.c (rb_throw_obj): add GC guard to prevent intermediate
+ variable from GC. [Bug #4322] [ruby-dev:43108]
+
+Wed Jan 26 17:08:59 2011 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
+
+ * ext/openssl/ossl_asn1.c (ossl_asn1_decode0): OpenSSL::ASN1.decode
+ should reject indefinite length primitive encodings as that is
+ illegal. Patch by Martin Bosslet. See #4324.
+
+Wed Jan 26 10:36:28 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * string.c (=~): documentation fix; the return value is nil when
+ it doesn't match. patched by Andrei Kulakov [ruby-core:34562]
+
+Tue Jan 25 08:41:58 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * dln_find.c (dln_find_1): omit too long pathnames.
+
+Tue Jan 25 08:28:19 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * string.c (rb_str_resize): get rid of out-of-bound access.
+
+Tue Jan 25 07:48:22 2011 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
+
+ * test/ruby/test_thread.rb: remove unused variables.
+
+Tue Jan 25 07:45:44 2011 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
+
+ * test/ruby/test_thread.rb (TestThread#test_condvar_nolock_2): get
+ rid of method redefined.
+
+Tue Jan 25 07:00:52 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * string.c (rb_string_value_cstr): rb_str_modify can change
+ RSTRING_PTR.
+
+Tue Jan 25 03:24:28 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * test/ruby/test_thread.rb: Added various ConditionVariable tests.
+
+Mon Jan 24 22:26:33 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * object.c (rb_str_to_dbl): Fix again. use rb_str_tmp_new()
+ instead ALLOC_N.
+
+Mon Jan 24 21:50:48 2011 Tanaka Akira <akr@fsij.org>
+
+ * vm_insnhelper.h: parenthesize macro arguments.
+
+Mon Jan 24 21:28:34 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * object.c (rb_str_to_dbl): use ALLOC_N instead ALLOCA_N because
+ ALLOC_N may cause stack overflow.
+
+Mon Jan 24 21:04:45 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * error.c (rb_invalid_str): prevent intermediate variable from GC.
+ [ruby-core:34820]
+
+Sun Jan 23 23:01:54 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * test/io/console/test_io_console.rb: Don't run test if the system
+ don't support io/console.
+
+Sun Jan 23 22:17:07 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * test/fiddle/test_fiddle.rb: Don't run test if the system don't support
+ fiddle.
+
+ * test/fiddle/test_function.rb: ditto.
+ * test/fiddle/test_closure.rb: ditto.
+
+Sun Jan 23 11:39:18 2011 Tanaka Akira <akr@fsij.org>
+
+ * vm_exec.h: parenthesize macro arguments.
+
+Sun Jan 23 10:33:02 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * template/fake.rb.in (ruby): suppress warnings.
+
+Sun Jan 23 08:00:09 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * string.c (str_nth_len, str_utf8_nth): return the rest length together.
+
+ * string.c (rb_str_substr): get rid of measure the length always
+ to improve performance for huge string. [ruby-core:34648]
+
+Sun Jan 23 00:40:10 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * test/test_syslog.rb: Fix to make a lot of test failure if
+ the platform doesn't support syslog.
+
+Sat Jan 22 11:49:55 2011 Aaron Patterson <aaron@tenderlovemaking.com>
+
+ * ext/psych/lib/psych/visitors/to_ruby.rb: fixing merge key support
+ when multiple merge keys are specified.
+
+ * test/psych/test_merge_keys.rb: tests for multi-merge key support
+
+Sat Jan 22 11:33:04 2011 Aaron Patterson <aaron@tenderlovemaking.com>
+
+ * ext/psych/lib/psych/visitors/to_ruby.rb: merge keys are actually
+ part of YAML 1.1, so they should be supported. Remove warning and
+ merge keys to parent. [ruby-core:34679]
+
+ * test/psych/test_merge_keys.rb: test for merge keys
+
+Sat Jan 22 10:25:19 2011 Aaron Patterson <aaron@tenderlovemaking.com>
+
+ * ext/psych/parser.c (parse): add the file name to the exception when
+ parse errors occur.
+
+ * test/psych/test_parser.rb: test for parse error file name
+
+Sat Jan 22 10:12:30 2011 Aaron Patterson <aaron@tenderlovemaking.com>
+
+ * ext/psych/parser.c (parse): fix assertion error when reusing a
+ parser after an exception has been raised
+
+ * test/psych/test_parser.rb: test for assertion error
+
+Sat Jan 22 04:09:22 2011 Aaron Patterson <aaron@tenderlovemaking.com>
+
+ * ext/psych/lib/psych/nodes/node.rb: Make Psych::Nodes::Node
+ enumerable.
+
+ * ext/psych/lib/psych/visitors/depth_first.rb: Add a depth-first
+ visitor to enumerate over a YAML AST in a depth-first fashion
+
+ * test/psych/nodes/test_enumerable.rb: test for enumerating nodes
+
+ * test/psych/visitors/test_depth_first.rb: test for depth-first
+ visitor
+
+Sat Jan 22 00:53:42 2011 Tanaka Akira <akr@fsij.org>
+
+ * vm_core.h: parenthesize macro arguments.
+
+Fri Jan 21 18:15:09 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * configure.in: should not use -Werror=* flags while conftests.
+
+Fri Jan 21 09:17:00 2011 Luis Lavena <luislavena@gmail.com>
+
+ * configure.in: Fix incorrectly detected x86_64-w64-mingw32 due
+ canonalization of target_os. Bug #3889 [ruby-core:32634]
+
+Thu Jan 20 23:44:00 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * configure.in: Fix rb_cv_va_args_macro was broken. We are using
+ -Werror=implicit-function-declaration compile option. therefore
+ we need a function declaration explicitly.
+
+Thu Jan 20 23:58:02 2011 Tanaka Akira <akr@fsij.org>
+
+ * node.h: parenthesize macro arguments.
+
+Thu Jan 20 23:25:28 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * configure.in: Add '#include <stdlib.h>' to
+ rb_cv_localtime_overflow test too. It's reported by Tomoyuki
+ Chikanaga. Thanks.
+
+Thu Jan 20 16:11:00 2011 Kenta Murata <mrkn@mrkn.jp>
+
+ * README.EXT, README.EXT.ja: You shouldn't choose ``conftest.c'' as a
+ name of a source file.
+
+Thu Jan 20 12:15:44 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * configure.in: Add stdlib.h inclusion into rb_cv_negative_time_t
+ test because it's required for exit(3). The patch is
+ created by Tomoyuki Chikanaga. [Bug #4287] [ruby-dev:43060]
+
+Thu Jan 20 11:39:41 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * test/webrick/utils.rb (TestWEBrick::RubyBin): test CGI does not need
+ to load rubygems. if it activated, ruby raises LoadError about
+ rbconfig.rb.
+
+Thu Jan 20 09:19:42 2011 Aaron Patterson <aaron@tenderlovemaking.com>
+
+ * ext/psych/lib/psych/visitors/json_tree.rb: Fix JSON emit for
+ DateTime and Time classes.
+
+ * test/psych/test_json_tree.rb: test for JSON emit
+
+Thu Jan 20 08:02:46 2011 Aaron Patterson <aaron@tenderlovemaking.com>
+
+ * ext/psych/lib/psych/coder.rb (represent_object): arbitrary objects
+ may be passed to the Psych::Coder object.
+
+ * ext/psych/lib/psych/visitors/yaml_tree.rb: support for visiting
+ arbitrary objects set on the coder.
+
+ * test/psych/test_coder.rb: supporting test case.
+
+Thu Jan 20 06:03:17 2011 Tanaka Akira <akr@fsij.org>
+
+ * method.h: parenthesize macro arguments.
+
+Wed Jan 19 13:16:05 2011 Eric Hodel <drbrain@segment7.net>
+
+ * lib/rubygems/commands/sources_command.rb: Finish removing code,
+ (fixes sources command test).
+
+Wed Jan 19 13:04:16 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * proc.c (proc_call): Add gc guard to avoid segfault. The fix
+ is created by Tomoyuki Chikanaga. [Bug #4238][ruby-dev:42963]
+
+Wed Jan 19 12:31:28 2011 Eric Hodel <drbrain@segment7.net>
+
+ * lib/rubygems.rb: Since gem_prelude requires rubygems, enable
+ custom_require always.
+
+Wed Jan 19 12:08:08 2011 Eric Hodel <drbrain@segment7.net>
+
+ * lib/rubygems/commands/dependency_command.rb: Remove require of
+ deleted file.
+ * lib/rubygems/commands/fetch_command.rb: ditto
+ * lib/rubygems/commands/setup_command.rb: ditto
+ * lib/rubygems/commands/sources_command.rb: ditto
+ * lib/rubygems/commands/specification_command.rb: ditto
+
+Wed Jan 19 08:13:59 2011 Ryan Davis <ryand-ruby@zenspider.com>
+
+ * lib/rubygems*: Import rubygems 1.5.0 (release candidate)
+ * test/rubygems: Ditto
+
+Tue Jan 18 23:31:01 2011 Yusuke Endoh <mame@tsg.ne.jp>
+
+ * parse.y: avoid NULL reference. [ruby-dev:43067]
+
+Wed Jan 19 02:54:04 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * vsnprintf.c (cvt): set first byte of buf to NUL for the case when
+ no bytes are written to the buf. [ruby-dev:43062]
+
+Tue Jan 18 23:04:51 2011 Tanaka Akira <akr@fsij.org>
+
+ * gc.h: parenthesize macro arguments.
+
+Tue Jan 18 18:31:14 2011 Keiju Ishitsuka <keiju@ishitsuka.com>
+
+ * lib/irb/completion.rb: Irb tab completion support for XX::method
+ forms.
+
+Tue Jan 18 15:05:55 2011 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
+
+ * lib/logger.rb: added RDoc document for logging message escape
+ by Hal Brodigan. See #3869
+
+Tue Jan 18 07:53:52 2011 Tanaka Akira <akr@fsij.org>
+
+ * eval_intern.h: parenthesize macro arguments.
+
+Tue Jan 18 04:42:44 2011 Aaron Patterson <aaron@tenderlovemaking.com>
+
+ * ext/psych/lib/psych/parser.rb (Mark): Adding a class to wrap
+ marker information
+
+ * ext/psych/parser.c (mark): Add a method to return the mark object
+ for the parser
+
+ * test/psych/test_parser.rb: tests for the Mark class.
+
+Tue Jan 18 02:46:55 2011 Aaron Patterson <aaron@tenderlovemaking.com>
+
+ * ext/psych/lib/psych/visitors/json_tree.rb (visit_String): JSON
+ strings should be dumped with double quotes. [ruby-core:34186]
+
+ * test/psych/test_json_tree.rb: test for double quotes
+
+Mon Jan 17 23:36:33 2011 Tanaka Akira <akr@fsij.org>
+
+ * array.c (rb_ary_times): less MEMCPY calls.
+
+Mon Jan 17 22:54:33 2011 Tanaka Akira <akr@fsij.org>
+
+ * debug.h: parenthesize macro arguments.
+
+Mon Jan 17 21:40:25 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ruby.c (process_options): revert r30549.
+
+Sun Jan 16 20:55:45 2011 Tanaka Akira <akr@fsij.org>
+
+ * vsnprintf.c: parenthesize macro arguments.
+
+Sat Jan 15 11:57:30 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * configure.in (warnflags): add -Werror=implicit-function-declaration
+ if available.
+
+ * lib/mkmf.rb (init_mkmf): ignore warnings in mkmf tests.
+
+ * test/mkmf/base.rb (setup, teardown): restore config values.
+
+ * test/mkmf/test_flags.rb: split from test_find_executable.rb.
+
+Sat Jan 15 10:04:14 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ruby.c (process_options): autoload rubygems.
+
+ * tool/compile_prelude.rb (Prelude#initialize): ignore empty
+ preludes.
+
+ * ruby.c (ruby_init_prelude): get rid of global namespace
+ pollution.
+
+Sat Jan 15 09:42:12 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * include/ruby/io.h: missing prototypes.
+
+Fri Jan 14 23:25:55 2011 Tanaka Akira <akr@fsij.org>
+
+ * vm_method.c: parenthesize macro arguments.
+
+Fri Jan 14 15:32:29 2011 Shugo Maeda <shugo@ruby-lang.org>
+
+ * test/net/imap/test_imap.rb: call neither logout nor disconnect
+ unless connected. patch by Kazuhiro NISHIYAMA. [ruby-dev:42860]
+
+Fri Jan 14 14:56:57 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * lib/net/imap.rb: use bytesize for binary strings.
+ patched by Yoshimasa Niwa. [ruby-core:34222]
+
+Fri Jan 14 14:01:12 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * pack.c (pack_unpack): the resulted string of unpack('M') must have
+ ASCII-8BIT encoding (and ENC_CODERANGE_VALID). [ruby-core:34482]
+
+Fri Jan 14 13:38:58 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * ext/zlib/zlib.c (gzfile_check_footer): ISIZE (Input SIZE) in
+ gzip's header is the size of uncompressed input data modulo 2^32.
+ [ruby-core:34481] http://www.ietf.org/rfc/rfc1952.txt
+
+Fri Jan 14 11:36:25 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * configure.in, win32/Makefile.sub (RUNRUBY): require path should
+ include "." because rbconfig.rb is there.
+
+Fri Jan 14 10:40:11 2011 Ryan Davis <ryan@lust.local>
+
+ * gem_prelude.rb: Just require rubygems. Fixes rubygems 1.4.
+ * lib/rubygems.rb: removed all Gem::Quickloader code.
+ * ruby.c: renamed ruby_init_gems to ruby_init_prelude. Set
+ $disable_rubygems since there is no fine grained mechanism to
+ skip parts of the prelude. Open to suggestions on how to do this
+ better.
+ * test/*.rb: Load path isn't set up correctly, so add
+ --disable-gems as needed to failing tests that are explicitly
+ testing stderr w/ ==.
+
+Fri Jan 14 07:30:47 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * io.c (argf_next_argv): go advance when the next file cannot be
+ read. [ruby-core:34446]
+
+Thu Jan 13 20:49:19 2011 Tanaka Akira <akr@fsij.org>
+
+ * vm_insnhelper.c: parenthesize macro arguments.
+
+Thu Jan 13 13:21:00 2011 Kenta Murata <mrkn@mrkn.jp>
+
+ * vm_dump.c: delete dashes to make lines 80 chars, Patched by
+ Shota Fukumori (sora_h). [Bug #4275] [ruby-dev:43021]
+
+Thu Jan 13 13:21:00 2011 Kenta Murata <mrkn@mrkn.jp>
+
+ * vm_dump.c: fix misspelling of CrashReporter, Patched by Shota
+ Fukumori (sora_h). [Bug #4275] [ruby-dev:43021]
+
+Thu Jan 13 06:27:29 2011 Ryan Davis <ryand-ruby@zenspider.com>
+
+ * error.c: Exception#to_s should actually call to_s.
+
+Thu Jan 13 00:32:54 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * addr2line.c (get_nth_dirname): decrement the directory index
+ because the index specifies the index of given included_directories
+ which is separated by NUL and its index is begun from 1.
+ Note that 0 specifies the current directory of the compilation.
+ see also http://www.dwarfstd.org/doc/dwarf-2.0.0.pdf
+
+Thu Jan 13 00:06:38 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * io.c (rb_f_syscall): Add warning messages. [ruby-core:34062]
+
+Thu Jan 13 00:00:07 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * io.c (rb_f_syscall): Some syscall return unsigned or pointer value.
+ Therefore we should only check the result is -1 or not.
+ [ruby-core:34062]
+
+Wed Jan 12 23:55:48 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * io.c (rb_f_syscall): Add 64bit Linux support. Some syscall takes
+ long type arguments.
+
+Wed Jan 12 19:37:10 2011 Tanaka Akira <akr@fsij.org>
+
+ * vm_dump.c: parenthesize macro arguments.
+
+Wed Jan 12 19:28:23 2011 Tanaka Akira <akr@fsij.org>
+
+ * vm.c (thread_free): reset ruby_current_thread if it points the
+ thread to free.
+ * gc.c (slot_sweep): don't call RUBY_VM_SET_FINALIZER_INTERRUPT if
+ there is no current thread.
+ [ruby-dev:43000]
+
+Wed Jan 12 19:09:29 2011 Tanaka Akira <akr@fsij.org>
+
+ * enum.c (sort_by_i): reenter check more strictly.
+ (sort_by_cmp): ditto.
+ [ruby-dev:43003] reported by Usaku NAKAMURA.
+
+Wed Jan 12 16:25:12 2011 Yuki Sonoda (Yugui) <yugui@yugui.jp>
+
+ * lib/net/http.rb (Net::HTTP#connect): makes it timeout during
+ SSL handshake too. [ruby-core:34203]
+ Patch by Marc Slemko.
+
+ * test/net/http/test_http.rb (TestNetHTTP_v1_2#test_timeout_during_HTTP_session):
+ test for [ruby-core:34203]
+
+ * test/net/http/test_https.rb (TestNetHTTPS#test_timeout_during_SSL_handshake):
+ ditto.
+
+Wed Jan 12 16:24:53 2011 Yuki Sonoda (Yugui) <yugui@yugui.jp>
+
+ * ext/readline/extconf.rb: new checks for RL_PROMPT_START_IGNORE
+ and RL_PROMPT_END_IGNORE. [ruby-core:34331]
+
+ * ext/readline/readline.c: enables USE_INSERT_IGNORE_ESCAPE only if
+ RL_PROMPT_{START,END}_IGNORE are available to get rid of compilation
+ error with libedit.
+
+Wed Jan 12 15:53:49 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * README.EXT.ja (rb_ensure): typo.
+
+Wed Jan 12 11:33:46 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * addr2line.c: OpenBSD uses the elf_abi.h header file instead of the
+ elf.h header file. patched by Jeremy Evans [ruby-core:34384]
+
+Wed Jan 12 03:59:36 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * test/webrick/test_cgi.rb: Removes usage of deprecated
+ :RequestHandler option.
+ patched by Peter Weldon [ruby-core:34010]
+
+ * test/webrick/test_httpproxy.rb: ditto.
+
+ * test/webrick/test_httpserver.rb: Add a test of the deprecation
+ behaviour.
+
+Wed Jan 12 08:37:07 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * hash.c (hash_i): return different values for inverse hash.
+ [ruby-core:34334]
+
+Tue Jan 11 20:32:59 2011 Tanaka Akira <akr@fsij.org>
+
+ * variable.c: parenthesize macro arguments.
+
+Tue Jan 11 13:06:38 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * array.c (rb_ary_resize): should care of embeded array when extending
+ the array.
+
+ * array.c (rb_ary_resize): need to set capa when changing the real
+ size of the array.
+ these are latent bugs.
+
+Mon Jan 10 22:46:43 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * include/ruby/defines.h (CASEFOLD_FILESYSTEM): HFS+ is case
+ insensitive.
+
+ * load.c (loaded_feature_path, rb_feature_p, load_lock): on a
+ case-insensitive filesystem, loaded features search should
+ ignore case. [ruby-core:34297]
+
+Mon Jan 10 21:34:12 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * common.mk (showflags): show LD commands.
+
+Mon Jan 10 14:32:55 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * test/ruby/test_method.rb (TestMethod#test_define_method): method
+ transplanting between class and module is impossible.
+
+Mon Jan 10 13:51:17 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * misc/rdoc-mode.el (rdoc-mode): show trailing whitespace.
+
+Mon Jan 10 11:22:02 2011 Tanaka Akira <akr@fsij.org>
+
+ * util.c: parenthesize macro arguments.
+
+Mon Jan 10 07:41:31 2011 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
+
+ * misc/README: mention rdoc-mode.el and ruby-style.el.
+
+Sun Jan 9 20:37:21 2011 Tanaka Akira <akr@fsij.org>
+
+ * transcode.c: parenthesize macro arguments.
+
+Sun Jan 9 16:31:53 2011 Yuki Sonoda (Yugui) <yugui@yugui.jp>
+
+ * io.c (Kernel.#syscall): implemented on LP64/LLP64 environments too.
+ also uses __syscall if available for *BSD on 64bit architecture.
+ [ruby-core:34062]
+
+Sun Jan 9 16:31:34 2011 Yuki Sonoda (Yugui) <yugui@yugui.jp>
+
+ * lib/irb/locale.rb (IRB::Locale::LOCALE_NAME_RE):
+ some platform has a locale without territory but with
+ encoding.
+ (#each_sub_locale): ditto.
+
+Sun Jan 9 14:47:50 2011 TAKAO Kouji <kouji@takao7.net>
+
+ * ext/readline/readline.c: apply a patch from Nobuyoshi Nakada.
+ fixed #3616 [ruby-core:31484] IRB + readline incorrectly counts
+ non-printing characters in prompt
+
+Sat Jan 8 21:47:26 2011 Tanaka Akira <akr@fsij.org>
+
+ * enum.c (enum_sort_by): use rb_ary_resize.
+ (ary_cutoff): removed.
+
+Sat Jan 8 21:24:17 2011 Tanaka Akira <akr@fsij.org>
+
+ * pack.c (swapf): compilation condition simplified.
+ (swapd): ditto.
+
+Sat Jan 8 20:51:25 2011 Tanaka Akira <akr@fsij.org>
+
+ * pack.c (swapd): remove duplicated code.
+
+Sat Jan 8 19:28:55 2011 Tanaka Akira <akr@fsij.org>
+
+ * thread.c: parenthesize macro arguments.
+
+Fri Jan 7 23:07:40 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/mkmf.rb (configuration): backref needs to capture.
+
+Fri Jan 7 21:57:22 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * misc/ruby-mode.el (ruby-mode-variables), misc/ruby-style.el:
+ show trailing whitespace.
+
+ * misc/ruby-mode.el (ruby-font-lock-syntactic-keywords): highlight
+ regexp after open bracket. [ruby-core:34183]
+
+Fri Jan 7 00:37:35 2011 Tanaka Akira <akr@fsij.org>
+
+ * string.c: parenthesize macro arguments.
+
+Thu Jan 6 22:42:02 2011 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * bignum.c (bigmul1_karatsuba): avoid overflow that make assertion
+ fail in certain case. this patch is contributed from Ray Chason
+ <chasonr at gmail.com> in personal communication.
+
+Thu Jan 6 20:55:49 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * lib/mkmf.rb (create_makefile): ignore rest from first dot from
+ TARGET to generate init function name.
+ this is followup of r30464.
+
+Thu Jan 6 11:27:01 2011 Aaron Patterson <aaron@tenderlovemaking.com>
+
+ * ext/psych/lib/psych/json/tree_builder.rb (start_mapping): tags
+ should not be included in JSON mapping
+
+Thu Jan 6 09:23:33 2011 Aaron Patterson <aaron@tenderlovemaking.com>
+
+ * lib/net/protocol.rb (eof?): BufferedIO should proxy eof? to the
+ underlying IO object.
+
+Thu Jan 6 09:12:31 2011 Aaron Patterson <aaron@tenderlovemaking.com>
+
+ * lib/mkmf.rb (configuration): fixing gsub when multiple error flags
+ are passed to GCC.
+
+Thu Jan 6 05:25:49 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * array.c (rb_ary_modify): export.
+
+Thu Jan 6 05:14:41 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/stringio/stringio.c (get_strio, strio_set_string)
+ (strio_reopen): check if frozen. [ruby-core:33648]
+
+Thu Jan 6 05:10:58 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * array.c (rb_ary_resize): new utility function. [ruby-dev:42912]
+
+Thu Jan 6 05:03:26 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * dln.c (init_funcname_len): ignore rest from first dot.
+ [ruby-dev:41774]
+
+Thu Jan 6 02:55:48 2011 Aaron Patterson <aaron@tenderlovemaking.com>
+
+ * ext/psych/lib/psych/visitors/yaml_tree.rb: use YAML 1.0 output
+ format for serializing nil values. Thanks Eric Hodel!
+
+ * test/psych/test_nil.rb: test for nil values
+
+Wed Jan 5 14:21:34 2011 Mark Dodwell <hi@mkdynamic.co.uk>
+
+ * string.c: fix rdoc typo.
+ https://github.com/shyouhei/ruby/pull/3
+
+Wed Jan 5 14:06:01 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * test/rdoc/test_rdoc_options.rb (TestRDocOptions#test_check_files):
+ skip on Windows because chmod 0 doesn't mean unreadable by owner.
+
+Wed Jan 5 13:56:54 2011 Akinori MUSHA <knu@iDaemons.org>
+
+ * lib/net/http.rb (Net::HTTP#get): A header hash given should not
+ be modified.
+
+Wed Jan 5 12:10:08 2011 Aaron Patterson <aaron@tenderlovemaking.com>
+
+ * ext/dl/{cfunc.c,dl.h,handle.c}, ext/fiddle/fiddle.{h,c}: Use _WIN32
+ rather than checking for windows.h. Thanks Jon Forums!
+ [ruby-core:33977]
+
+Sat Jan 1 17:02:50 2011 Yuki Sonoda (Yugui) <yugui@yugui.jp>
+
+ * lib/irb/locale.rb (IRB::Locale#search_file): make it possible
+ to load a localization from a gem.
+ (IRB::Locale#lc_path): obsoleted because of the change of #search_file
+ (IRB::Locale#each_localized_path): new private method, based on
+ lc_path
+ (IRB::Locale#find): follows the change of #search_file.
+ (IRB::Locale#load): removed duplicate with #find.
+
+Sat Jan 1 11:44:42 2011 Tanaka Akira <akr@fsij.org>
+
+ * strftime.c: parenthesize macro arguments.
+
+Sat Jan 1 11:10:29 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/zlib/zlib.c: take care of platforms where long is bigger
+ than int.
+
+Sat Jan 1 11:03:58 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * NEWS (optparse): shell completion support.
+
+ * misc/README (rb_optparse.{bash,zsh}): for shell completion.
+
+ * include/ruby/intern.h (VALUE rb_ary_print_on): I have never seen
+ this function anywhere.
+
+Sat Jan 1 04:20:11 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * win32/win32.c (rb_w32_write_console): don't raise exception when
+ the conversion is for writing to console.
+ Patched by Heesob Park [ruby-core:33999]
+
+Fri Dec 31 12:02:06 2010 Tanaka Akira <akr@fsij.org>
+
+ * enum.c (enum_sort_by): use less temporary objects.
+
+Fri Dec 31 11:46:47 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * configure.in (warnflags), lib/mkmf.rb (configuration): turn
+ warnings into errors only for bundled extensions.
+ [ruby-core:33815]
+
+Fri Dec 31 11:15:57 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/zlib/zlib.c (sizeof): zlib.h mistakenly assumes the result
+ of sizeof to be int, not size_t.
+
+Fri Dec 31 10:27:34 2010 Tanaka Akira <akr@fsij.org>
+
+ * st.c: parenthesize macro arguments.
+
+Fri Dec 31 03:23:26 2010 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * vsnprintf.c (BSD__uqtoa): Fix overflow when long != quad_t.
+ patched by Peter Weldon <peter.weldon AT null.net>
+ [ruby-core:33985]
+
+Fri Dec 31 03:00:34 2010 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
+
+ * Makefile.in: remove unnecessary semicolons.
+
+Thu Dec 30 23:09:47 2010 wanabe <s.wanabe@gmail.com>
+
+ * vm.c (vm_define_method): guard iseq from GC while method definition.
+ [ruby-dev:42832]
+
+Thu Dec 30 20:18:32 2010 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * win32/Makefile.sub: ditto.
+
+Thu Dec 30 20:57:09 2010 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * Makefile.in: Check V=1 argument if run "make clean" or similar.
+
+Thu Dec 30 20:41:50 2010 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * Makefile.in: Kill ugly line continuation.
+
+Thu Dec 30 11:49:40 2010 Tanaka Akira <akr@fsij.org>
+
+ * sprintf.c: parenthesize macro arguments.
+
+Wed Dec 29 21:20:13 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * io.c (maygvl_copy_stream_wait_readwrite): define if USE_SENDFILE
+
+Wed Dec 29 20:37:43 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/extmk.rb: strip current directory prefix.
+
+ * enc/depend (clean): remove name2ctype.h when out-of-place build.
+
+ * win32/Makefile.sub (clean-enc): pass V to inferior make.
+
+Wed Dec 29 18:23:46 2010 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * re.c (rb_reg_expr_str): need to escape if the coderange is invalid.
+
+Wed Dec 29 10:06:51 2010 Tanaka Akira <akr@fsij.org>
+
+ * signal.c: parenthesize macro arguments.
+
+Wed Dec 29 07:22:15 2010 Eric Hodel <drbrain@segment7.net>
+
+ * lib/rake/rdoctask.rb: Deprecate in favor of rdoc/task.
+
+Wed Dec 29 07:07:06 2010 Eric Hodel <drbrain@segment7.net>
+
+ * lib/rdoc: Import RDoc 3.1
+
+Tue Dec 28 18:36:38 2010 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * error.c, include/ruby/intern.h (rb_compile_error_with_enc): new
+ function to raise syntax error, with source encoding'ed message.
+
+ * parse.y (compile_error): use above function.
+ [ruby-core:33951] (#4217)
+
+Tue Dec 28 07:37:38 2010 Tanaka Akira <akr@fsij.org>
+
+ * ruby.c: parenthesize macro arguments.
+
+Tue Dec 28 07:17:11 2010 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
+
+ * NEWS: add ARGF.write and so on.
+
+Tue Dec 28 07:12:38 2010 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
+
+ * NEWS: add new magic-comment. (warn-indent) [ruby-core:25442]
+
+Tue Dec 28 04:32:37 2010 Aaron Patterson <aaron@tenderlovemaking.com>
+
+ * ext/fiddle/extconf.rb: check for windows.h while building fiddle.
+ Thanks Jon Forums! [ruby-core:33923]
+
+Tue Dec 28 01:45:12 2010 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
+
+ * NEWS: Add Zlib.deflate and Zlib.inflate.
+ [ruby-dev:42833]
+
+Mon Dec 27 21:22:33 2010 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * win32/configure.bat: Remove obsoleted coding rule. Now, we
+ don't support to build on Windows 95/98 and Me.
+
+Mon Dec 27 18:27:13 2010 Tanaka Akira <akr@fsij.org>
+
+ * re.c: parenthesize macro arguments.
+
+Mon Dec 27 15:22:23 2010 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * win32/README.win32: note to need NT based OS to build ruby.
+
+Mon Dec 27 12:14:46 2010 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * common.mk (EXTMK_ARGS): specify to pass macro V, because nmake
+ doesn't pass it via MAKEFLAGS.
+
+Mon Dec 27 10:33:43 2010 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * ext/zlib/zlib.c (Init_zlib): Add Zlib.deflate and Zlib.inflate.
+ [ruby-dev:42833]
+
+Mon Dec 27 07:38:07 2010 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
+
+ * misc/rb_optparse.zsh: add compdef for generator.
+
+Mon Dec 27 07:32:07 2010 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
+
+ * lib/optparse.rb (OptionParser#compsys): escape brackets too.
+ [ruby-dev:42754]
+
+Mon Dec 27 01:30:08 2010 Tanaka Akira <akr@fsij.org>
+
+ * ext/socket/mkconstants.rb: add IF_NAMESIZE.
+ add a default for INET6_ADDRSTRLEN.
+
+Sun Dec 26 23:49:47 2010 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * win32/Makefile.sub: suppress a strange error message when RMALL
+ found no such file.
+ * win32/rmall.bat: new.
+
+Sun Dec 26 21:23:23 2010 <kosaki.motohiro@gmail.com>
+
+ * win32/Makefile.sub: fix 'nmake clean-enc' breakage since r28322.
+
+Sun Dec 26 22:25:07 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/ripper/depend (ripper.y): fix messages with nmake.
+ [ruby-dev:42896]
+
+Sun Dec 26 22:24:14 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * file.c (file_expand_path): get rid of warnings caused by
+ -Wdeclaration-after-statement on cygwin.
+
+Sun Dec 26 20:28:34 2010 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * process.c (before_exec): add small comment.
+
+Sun Dec 26 20:52:21 2010 Tanaka Akira <akr@fsij.org>
+
+ * ext/socket/mkconstants.rb: define INET_ADDRSTRLEN as 16 if not
+ available. fix compilation error on mswin32-60. reported by nobu.
+
+Sun Dec 26 19:37:37 2010 Tanaka Akira <akr@fsij.org>
+
+ * ext/socket/option.c: define IFNAMSIZ if not available.
+ fix compilation error on mingw32. reported by nobu.
+
+Sun Dec 26 12:16:29 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/rdoc/ri/paths.rb (RDoc::RI::Paths::HOMEDIR): no exception if
+ HOME is not set. [ruby-core:33867]
+
+Sun Dec 26 11:39:11 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * parse.y (stmt): missing ripper rule. i.e., `a::B ||= c 1'.
+ http://twitter.com/#!/wannabe53/status/18797576396472321
+ http://twitter.com/#!/wannabe53/status/18798416150663168
+
+Sun Dec 26 11:15:50 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * test/with_different_ofs.rb (DifferentOFS): should not affect
+ original classes.
+
+Sun Dec 26 09:35:07 2010 Tanaka Akira <akr@fsij.org>
+
+ * rational.c: parenthesize macro arguments.
+
+Sun Dec 26 09:22:19 2010 Tanaka Akira <akr@fsij.org>
+
+ * ext/socket/option.c (rb_if_indextoname): new function to abstract
+ environments without if_indextoname.
+ (inspect_ipv6_multicast_if): new function to inspect
+ IPV6_MULTICAST_IF.
+ Socket::Option.new(:INET6, :IPV6, :MULTICAST_IF,
+ [2].pack("I!")).inspect is
+ "#<Socket::Option: INET6 IPV6 MULTICAST_IF eth0>".
+
+Sun Dec 26 04:31:15 2010 Luis Lavena <luislavena@gmail.com>
+
+ * ext/dl/win32/registry.rb: Corrected RegCreateKeyExA signature.
+ Patch by Rafal Michalski [ruby-core:33874] [Ruby 1.9-Bug#4203]
+
+Sun Dec 26 02:31:58 2010 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * io.c (advice_arg_check): Change argument check.
+ Now, an unsupported advice makes NotImplementedError.
+ [ruby-dev:42887] [Ruby 1.9-Feature#4204]
+
+Sun Dec 26 03:00:53 2010 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * ext/socket/extconf.rb: Fix build error which was introduced r30372.
+
+Sun Dec 26 01:37:10 2010 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * ext/socket/extconf.rb: check the existence of if_indextoname().
+
+ * ext/socket/option.c: yesterday's akr's commits destroyed the build of
+ some unrelated platforms (such as Windows).
+
+Sat Dec 25 23:29:11 2010 Tanaka Akira <akr@fsij.org>
+
+ * ext/socket/option.c (inspect_ipv4_add_drop_membership): new function
+ to inspect struct ip_mreq and struct ip_mreqn for
+ IP_ADD_MEMBERSHIP and IP_DROP_MEMBERSHIP.
+ Socket::Option.new(:INET, :IP, :ADD_MEMBERSHIP,
+ [239,255,99,81, 0,0,0,0].pack("CCCCCCCC")).inspect is now
+ "#<Socket::Option: INET IP ADD_MEMBERSHIP 239.255.99.81 0.0.0.0>".
+ (inspect_ipv4_multicast_if): new function to inspect struct in_addr
+ and struct ip_mreqn for IP_MULTICAST_IF.
+ Socket::Option.new(:INET, :IP, :MULTICAST_IF,
+ [192,168,0,7].pack("CCCC")).inspect is now
+ "#<Socket::Option: INET IP MULTICAST_IF 192.168.0.7>".
+
+ * ext/socket/extconf.rb: check struct ip_mreq and struct ip_mreqn.
+
+Sat Dec 25 22:49:10 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * test/csv: DifferentOFS needs to be include in each classes.
+
+ * test/digest/test_digest_extend.rb (TestDigestExtend#setup):
+ should not depend on the result of previous tests
+
+ * test/with_different_ofs.rb (DifferentOFS::WithDifferentOFS): give
+ name.
+
+ * test/with_different_ofs.rb (DifferentOFS): test suite for test
+ suites affected by $,.
+
+ * test/digest/test_digest_extend.rb (TestDigestExtend): should not
+ assume $, invariant.
+
+ * test/csv/test_data_converters.rb, test/csv/test_table.rb: don't
+ call setup within tests.
+
+Sat Dec 25 20:01:40 2010 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * io.c (pipe_open): Added rb_thread_atfork(). We must reinitialize
+ GVL at new process creation.
+
+Sat Dec 25 18:26:55 2010 Tanaka Akira <akr@fsij.org>
+
+ * ext/socket/option.c (inspect_ipv6_mreq): new function to inspect
+ struct ipv6_mreq for IPV6_JOIN_GROUP and IPV6_LEAVE_GROUP.
+ Socket::Option.new(:INET6, :IPV6, :JOIN_GROUP,
+ [0xff12,0,0,0,0,0,0,1, 2].pack("nnnnnnnnI!")).inspect is now
+ "#<Socket::Option: INET6 IPV6 JOIN_GROUP ff12::1 eth0>".
+
+ * ext/socket/extconf.rb: check struct ipv6_mreq.
+
+Sat Dec 25 18:04:30 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/csv.rb (CSV.foreach): 'rb' mode is defaulted in open.
+
+ * lib/csv.rb (CSV#init_separators): cannonicalize encoding options
+ as Encoding objects.
+
+Sat Dec 25 18:30:34 2010 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * thread.c (rb_thread_atfork): Add small comment why we need
+ reset random seed.
+
+Sat Dec 25 17:33:55 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * test/csv/base.rb (TestCSV.with_different_ofs): give name to
+ anonymous classes.
+
+ * lib/csv.rb (CSV#init_separators): use IO#gets with length
+ parameter to get rid of wrong convertion.
+
+ * lib/csv.rb (CSV::foreach, CSV#initialize): directly use encoding
+
+ * lib/csv.rb, test/csv: should not assume $, invariant.
+
+Sat Dec 25 16:08:06 2010 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * signal.c: change rb_atomic_t definition from uchar to uint.
+
+Sat Dec 25 15:04:05 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * test/csv/test_encodings.rb (TestEncodings#setup): fix evil test
+ suite writing to the source directory.
+
+Sat Dec 25 15:08:08 2010 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * ext/pty/pty.c (chfunc): Added rb_thread_atfork_before_exec().
+ We must reinitialize GVL at new process creation. Otherwise
+ we may meet an insane deadlock. [Bug#4121][ruby-dev:42686]
+
+Sat Dec 25 14:27:09 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * io.c (rb_io_extract_encoding_option): accept Encoding object as
+ encoding: optional argument. [ruby-dev:42884]
+
+Sat Dec 25 13:37:55 2010 Ryan Davis <ryand-ruby@zenspider.com>
+
+ * lib/minitest/*.rb: Imported minitest 2.0.2 r6093.
+
+Sat Dec 25 13:05:59 2010 Tanaka Akira <akr@fsij.org>
+
+ * random.c: parenthesize macro arguments.
+
+Sat Dec 25 12:48:50 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * load.c (rb_f_require_relative): don't omit return type.
+
+Sat Dec 25 11:06:00 2010 Eric Hodel <drbrain@segment7.net>
+
+ * load.c (rb_f_require_relative): Add documentation.
+
+Sat Dec 25 11:02:52 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/zlib/zlib.c (gzreader_gets): support optional length
+ parameter.
+
+ * ext/zlib/zlib.c (gzfile_read, gzfile_readpartial): length should
+ be long.
+
+Sat Dec 25 10:51:03 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/json/generator/generator.{c,h} (fbuffer_free_only_buffer):
+ unused.
+
+ * ext/openssl/ossl_pkcs5.c (ossl_pkcs5_pbkdf2_hmac): add casts.
+
+Fri Dec 24 08:46:04 2010 Tanaka Akira <akr@fsij.org>
+
+ * process.c: parenthesize macro arguments.
+
+Thu Dec 23 19:17:14 2010 Yuki Sonoda (Yugui) <yugui@yugui.jp>
+
+ * test/net/imap/cacert.pem: updated because it has been expired.
+
+ * test/net/imap/server.crt: signed again because CA cert was expired.
+
+Thu Dec 23 11:16:52 2010 Tanaka Akira <akr@fsij.org>
+
+ * parse.y: parenthesize macro arguments.
+
+Thu Dec 23 11:00:09 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * error.c (rb_check_type): check for type from extensions for ruby
+ 1.8. see [ruby-core:33797].
+
+Thu Dec 23 08:12:59 2010 Aaron Patterson <aaron@tenderlovemaking.com>
+
+ * lib/net/smtp.rb: refactoring Net::SMTP#esmtp= to use an
+ attr_accessor
+
+Thu Dec 23 06:35:41 2010 Aaron Patterson <aaron@tenderlovemaking.com>
+
+ * lib/net/smtp.rb: Net::SMTP should close the SSL connection if the
+ connection verification fails.
+
+Thu Dec 23 01:47:58 2010 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
+
+ * NEWS: remove #object_id. [ruby-dev:42840]
+
+Wed Dec 22 08:56:39 2010 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
+
+ * NEWS: add Module#private_constant and Module#public_constant.
+ [ruby-dev:39685][ruby-core:32698]
+
+Wed Dec 22 07:59:23 2010 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
+
+ * NEWS: add IO#advise. [ruby-core:33110] [Ruby 1.9-Feature#4038]
+
+Tue Dec 21 23:45:31 2010 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * gc.c (Init_GC): move back object_id to Kernel. [ruby-dev:42840]
+
+Tue Dec 21 12:45:16 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * configure.in (target_archs): remove temporary objects.
+
+ * enc/Makefile.in, enc/depend (clean): remove work directories.
+
+Tue Dec 21 07:39:12 2010 Tanaka Akira <akr@fsij.org>
+
+ * pack.c: parenthesize macro arguments.
+
+Tue Dec 21 06:25:43 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * test/rexml/test_contrib.rb (ContribTester#test_pos): should not
+ use fixed path name for tests. [ruby-dev:42827]
+
+ * test/rexml/test_sax.rb (SAX2Tester#test_socket): should not use
+ fixed port for tests. [ruby-dev:42828]
+
+Tue Dec 21 06:10:18 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * compile.c (setup_args), vm.c (invoke_block_from_c),
+ vm_insnhelper.c (caller_setup_args): reverted r30241 and r30243
+ except for the test.
+
+Tue Dec 21 01:41:42 2010 Masaya Tarui <tarui@ruby-lnag.org>
+
+ * io.c : add an extra byte to buffer for the specification of read
+ in Windows. see [ruby-core:33460] and r29980. and, we have to
+ discuss how to do this one byte.
+
+Tue Dec 21 01:18:06 2010 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * error.c: Fix build error for win32. This regression was
+ introduced by r30271.
+
+Tue Dec 21 00:59:40 2010 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * thread.c (thread_cleanup_func): Moved interrupted_lock
+ destroying code from native_thread_destroy() to
+ thread_cleanup_func() because it's platform independent logic.
+
+ * thread_win32.c (native_thread_destroy): ditto.
+ * thread_pthread.c (native_thread_destroy): ditto.
+
+Tue Dec 21 00:46:20 2010 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * thread.c (thread_cleanup_func): Don't touch native threading
+ resource at fork. Sadly this is purely bandaid. We need to
+ implement proper fix later. [Bug #4169] [ruby-core:33767]
+
+Tue Dec 21 00:22:44 2010 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * error.c (exit_success_p): Check status code more carefully.
+ status code may have garbage in upper bit.
+
+Mon Dec 20 23:12:37 2010 Tanaka Akira <akr@fsij.org>
+
+ * node.c: parenthesize macro arguments.
+
+Mon Dec 20 20:04:41 2010 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
+
+ * NEWS: add #__id__ and #object_id. [ruby-dev:42778]
+
+Mon Dec 20 20:03:21 2010 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * thread_pthread.c (native_thread_destroy): Fixed gvl_cond leak.
+
+Mon Dec 20 13:49:05 2010 Eric Hodel <drbrain@segment7.net>
+
+ * NEWS: Add item for RDoc 3.0.1
+
+ * lib/rdoc: Import RDoc 3.0.1, remove require for perl parser.
+
+Mon Dec 20 12:15:32 2010 Eric Hodel <drbrain@segment7.net>
+
+ * lib/rdoc: Import RDoc 3.0.
+
+Mon Dec 20 01:55:03 2010 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * io.c (Init_IO): Added O_DIRECT. This feature was proposed by
+ Run Paint Run Run.
+ [Feature #4015] [ruby-core:33018]
+
+Sun Dec 19 19:15:23 2010 Tanaka Akira <akr@fsij.org>
+
+ * marshal.c: parenthesize macro arguments.
+
+Sat Dec 18 21:52:37 2010 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
+
+ * vsnprintf.c (BSD_vfprintf): suppress warning: "_WIN32" is not
+ defined.
+
+Sat Dec 18 16:02:27 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * compile.c (setup_args), vm.c (invoke_block_from_c),
+ vm_insnhelper.c (caller_setup_args): fix of r30241. lambda block
+ should check argument number.
+
+Sat Dec 18 14:42:29 2010 Tanaka Akira <akr@fsij.org>
+
+ * load.c: parenthesize macro arguments.
+
+Sat Dec 18 10:07:04 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * compile.c (setup_args, iseq_compile_each): optimize AMPER LAMBDA
+ combination as block.
+
+Fri Dec 17 22:07:16 2010 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * gc.c (Init_GC): move #__id__ and #object_id to BasicObject.
+ [ruby-dev:42778]
+
+Fri Dec 17 19:35:13 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * test/mkmf/base.rb (TestMkmf::FakeLog): capture output from mkmf.
+
+ * test/mkmf/test_find_executable.rb (test_find_executable):
+ suppress meaningless differences for chkbuild.
+
+Fri Dec 17 13:26:54 2010 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * win32/setup.mak (BASERUBY): quit with an error when BASERUBY was not
+ able to set, just like configure.in does. [ruby-dev:42782]
+
+Fri Dec 17 07:04:09 2010 Tanaka Akira <akr@fsij.org>
+
+ * iseq.c: parenthesize macro arguments.
+
+Fri Dec 17 04:18:37 2010 Eric Hodel <drbrain@segment7.net>
+
+ * transcode.c (str_encode): Alter comment for better wording and ri
+ output.
+
+Fri Dec 17 00:05:40 2010 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * io.c (rb_io_advise): New API. IO#advise() allows to tell the
+ ruby runtime how it expects to use a file handle. This feature
+ can be improved a performance some situations.
+ Note: This feature is mainly developed by Run Paint Run Run.
+ Thank you! [ruby-core:33110] [Ruby 1.9-Feature#4038]
+
+ * io.c (do_io_advise): Helper function.
+ * io.c (io_advise_sym_to_const): ditto.
+
+Thu Dec 16 23:29:20 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * tool/rbinstall.rb (bin-comm): use transformed name.
+ [ruby-dev:42777]
+
+Thu Dec 16 21:52:07 2010 Tanaka Akira <akr@fsij.org>
+
+ * io.c: parenthesize macro arguments.
+
+Thu Dec 16 21:46:39 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * tool/mkconfig.rb (RbConfig): honor ARCHFLAGS and RC_ARCHS to
+ override embedded ARCH_FLAG value on universal-darwin.
+
+Thu Dec 16 19:50:12 2010 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * win32/{configure.bat,setup.mak,Makefile.sub} (PROGRAM_PREFIX,
+ PROGRAM_SUFFIX): unite the differences of the names of macros of
+ prefix and suffix.
+ reported by HANEDA Norikatsu. [ruby-dev:42775]
+
+Thu Dec 16 08:04:47 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * node.h (RNode): match the type of flags to RBasic, and renamed
+ nd_file as nd_reserved.
+
+ * iseq.c (set_relation), vm_insnhelper.c (vm_cref_push): nd_file
+ is always zero-cleared.
+
+Thu Dec 16 07:22:30 2010 Ryan Davis <ryand-ruby@zenspider.com>
+
+ * lib/minitest/unit.rb: Imported minitest 2.0.1 r6079.
+
+Wed Dec 15 20:45:02 2010 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * lib/test/unit.rb (process_args): need to setup @help to print options.
+
+Wed Dec 15 11:19:33 2010 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * test/zlib/test_zlib.rb (test_to_io): forgotten to fix with r30201.
+
+Wed Dec 15 11:07:34 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * io.c (simple_sendfile): enable on Mac OS X.
+
+ * io.c (nogvl_copy_stream_sendfile): moved precheck of copy length.
+
+ * io.c (nogvl_copy_stream_sendfile): should wait for both of
+ read/write fds.
+
+Wed Dec 15 07:11:55 2010 Tanaka Akira <akr@fsij.org>
+
+ * hash.c: parenthesize macro arguments.
+
+Wed Dec 15 04:02:00 2010 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * ext/openssl/ossl_x509ext.c (ossl_x509extfactory_set_config):
+ fix compile error when !HAVE_X509V3_SET_NCONF. Thanks
+ Chikanaga-san. [ruby-dev:42761] [Ruby 1.9-Bug#4158]
+
+Wed Dec 15 03:41:31 2010 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * test/ripper/test_parser_events.rb (TestRipper#test_block_variables):
+ Limit address space 100MB instead 100KB. Quite frankly, This
+ margin is too narrow to contain ruby. [ruby-dev:42763] [Bug#4159]
+
+Tue Dec 14 23:53:52 2010 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * io.c (simple_sendfile): improve linux compatibility on FreeBSD,
+ and now it works. But without cpuset -l 0, it still gets stuck.
+
+Tue Dec 14 20:31:33 2010 Tanaka Akira <akr@fsij.org>
+
+ * gc.c: parenthesize macro arguments.
+
+Tue Dec 14 18:31:48 2010 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * lib/test/unit.rb: help messages.
+
+Tue Dec 14 18:19:03 2010 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * common.mk (help): there is no reason to use the abbreviation for here.
+
+Tue Dec 14 15:03:46 2010 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * test/ruby/test_io.rb (test_reopen, test_reinitialize): should close
+ the temporary files.
+
+Tue Dec 14 14:24:15 2010 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * test/ruby/test_io.rb (make_tempfile): change the prefix from 'foo'
+ to 'test_io' because the old one is meaningless and inconvenient.
+
+ * test/ruby/test_io.rb (test_binmode_after_closed): the temporary file
+ maked by make_temfile is already closed.
+
+Tue Dec 14 13:52:19 2010 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * test/ruby/test_io.rb (test_flush_in_finalizer[12]): should close
+ temporary file because it's only used for taking pathname and
+ unlinking the file after the end of the test (in GC phase).
+
+Tue Dec 14 13:34:33 2010 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * ext/zlib/zlib.c (gzfile_s_open): should close the IO if some error
+ occurs in initializing.
+
+Tue Dec 14 13:04:16 2010 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * lib/net/http.rb (Net::HTTPRequest#send_request_body_data):
+ set binmode to tempfile.
+
+Tue Dec 14 12:55:46 2010 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * test/zlib/test_zlib.rb (*): should close files associated with zlib.
+
+Tue Dec 14 11:30:17 2010 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * test/ruby/test_argf.rb (test_inplace_rename_impossible): unlink
+ the renamed temporary file on no_safe_rename platforms.
+
+ * test/ruby/test_argf.rb (test_readlines_limit_0,
+ test_each_line_limit_0): should close argf because the associated
+ Tempfile object cannot unlink the temporary file when it's gc'ed
+ on some platforms (Windows, etc.)
+
+Tue Dec 14 11:27:07 2010 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * lib/minitest/unit.rb (Minitest::Unit#_run_suite): split test
+ name and its time. Thiw allows to know test's name when you are
+ running tests and meet a test which spends long time at realtime.
+
+Tue Dec 14 11:25:20 2010 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * configure.in: Add -Werror=declaration-after-statement to default
+ warning flag. If you are using GCC, this flag is useful to
+ prevent breaking VC build.
+
+Tue Dec 14 10:25:57 2010 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * ext/openssl/ossl_asn1.c (ossl_asn1_decode0): how many gcc-c99isms
+ must a man mend; before he can build with VC? r30178
+
+Mon Dec 13 21:26:33 2010 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * io.c (simple_sendfile): disable the use of sendfile(2) on
+ FreeBSD. It blocks on TestIO#test_copy_stream_socket.
+
+Mon Dec 13 18:35:33 2010 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * io.c: define USE_SENDFILE on FreeBSD or DragonFly BSD.
+ Remove Mac OS X because its argument is different from them.
+
+Mon Dec 13 12:00:09 2010 Tanaka Akira <akr@fsij.org>
+
+ * file.c: parenthesize macro arguments.
+
+Mon Dec 13 11:21:14 2010 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * io.c (simple_sendfile): added for BSD version of sendfile(2).
+
+Mon Dec 13 09:50:09 2010 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * lib/net/http.rb (Net::HTTPRequest#set_form): Added to support
+ both application/x-www-form-urlencoded and multipart/form-data.
+ There is a similar API, Net::HTTPRequest#set_form_data, but
+ to keep its compatibility this is newly added. [ruby-dev:42729]
+
+Sun Dec 12 23:45:27 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * compile.c (iseq_compile_each): fix for __goto__ and __label__
+ where were totally broken.
+
+Sun Dec 12 22:45:43 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * common.mk (ID_H_INCLUDES): now id.h depends on vm_opts.h.
+
+Sun Dec 12 20:42:47 2010 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
+
+ * template/id.h.tmpl: suppress all warning: "SUPPORT_JOKE" is not
+ defined. [ruby-dev:42730]
+
+Sun Dec 12 20:35:07 2010 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
+
+ * misc/rb_optparse.zsh: update how to install.
+
+ * misc/rb_optparse.zsh: avoid error when setopt noclobber.
+
+ * lib/optparse.rb: fix typo. pointed out at
+ <http://d.hatena.ne.jp/nagachika/20101207>.
+
+Sun Dec 12 13:27:35 2010 Tanaka Akira <akr@fsij.org>
+
+ * eval_error.c: parenthesize macro arguments.
+
+Sun Dec 12 11:53:24 2010 Tanaka Akira <akr@fsij.org>
+
+ * error.c: parenthesize macro arguments.
+
+Sun Dec 12 04:01:58 2010 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * string.c (rb_str_inspect): fix: extra back slash is added when
+ the string is dummy encoding and includes \x22 or \x5C.
+
+Sun Dec 12 02:42:24 2010 Aaron Patterson <aaron@tenderlovemaking.com>
+
+ * ext/openssl/ossl_asn1.c: indefinite length BER to DER encoding is
+ properly supported. Thanks Martin Bosslet! [ruby-core:33082]
+
+Sat Dec 11 17:43:34 2010 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
+
+ * ext/bigdecimal/bigdecimal.h: suppress "warning: 'VPrint' declared
+ 'static' but never defined".
+
+Sat Dec 11 09:24:57 2010 Tanaka Akira <akr@fsij.org>
+
+ * encoding.c: parenthesize macro arguments.
+
+Sat Dec 11 08:12:48 2010 Eric Hodel <drbrain@segment7.net>
+
+ * ext/openssl/ossl.c, ext/openssl/ossl_pkey_rsa.c: Document RSA, RSA
+ encryption/decryption and PKCS #5 encryption/decryption.
+
+Sat Dec 11 06:23:41 2010 Eric Hodel <drbrain@segment7.net>
+
+ * ext/openssl/ossl_x509name.c: include Comparable to provide #==.
+ Document OpenSSL::X509::Name#<=>. [Ruby 1.9-Feature#4116]
+
+Sat Dec 11 05:48:28 2010 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
+
+ * ext/tk/lib/multi-tk.rb: infinite loop on method_missing at loading.
+ [ruby-dev:42716] [Ruby 1.9-Bug#4129]
+
+ * ext/tk/lib/multi-tk.rb: when no eventloop is running, ruby freezes at
+ exit.
+
+Sat Dec 11 02:23:15 2010 Aaron Patterson <aaron@tenderlovemaking.com>
+
+ * ext/openssl/extconf.rb: try pkgconfig first, then fall back to
+ normal have_library, etc. Thanks Erik Hollensbe. [ruby-core:32406]
+
+Fri Dec 10 22:33:39 2010 Tanaka Akira <akr@fsij.org>
+
+ * dln_find.c: parenthesize macro arguments.
+
+Fri Dec 10 20:05:42 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * template/id.h.tmpl (ruby_method_ids): suppress warnings.
+ [ruby-dev:42730]
+
+Fri Dec 10 18:29:20 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ruby.c (ruby_init_loadpath_safe): relatively called non-shared
+ binary cannot be found in PATH, so use given pathname.
+
+Fri Dec 10 18:28:40 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * cygwin/GNUmakefile.in (SCRIPTPROGRAMS): ignore backup files and etc.
+
+ * cygwin/GNUmakefile.in (scriptbin): set executable bit.
+
+ * tool/rbinstall.rb (install_recursive): always skip default ignored
+ files. if block is given, call it instead of calling install.
+
+ * tool/rbinstall.rb (bin-comm): use install_recursive.
+
+Fri Dec 10 18:12:31 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * test/mkmf/base.rb (TestMkmf#config_value): extract macro value from
+ config.h.
+
+ * test/mkmf/test_sizeof.rb (TestMkmf::TestSizeof#test_sizeof_builtin),
+ (TestMkmf::TestSizeof#test_sizeof_struct): more tests.
+
+ * lib/mkmf.rb (check_signedness): should use the prelude code.
+ [ruby-dev:42731]
+
+ * lib/mkmf.rb (Logging.log_close): separate from Logging.logfile.
+
+ * test/mkmf/base.rb (TestMkmf::MKMFLOG): show mkmf.log at failures.
+
+ * test/mkmf/base.rb (TestMkmf#teardown): close log file for each tests.
+
+Fri Dec 10 11:36:43 2010 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
+
+ * compile.c (enum): remove a comma at end of enumerator list.
+
+ * constant.h (rb_const_flag_t): ditto.
+
+ * iseq.h (enum catch_type): ditto.
+
+ * iseq.h (enum defined_type): ditto.
+
+ * vm_core.h (enum iseq_type): ditto.
+
+ * vm_core.h (enum vm_special_object_type): ditto.
+
+Fri Dec 10 10:47:53 2010 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * sprintf.c (_HAVE_SANE_QUAD_): Don't forget LP64, r30156.
+
+Fri Dec 10 10:37:17 2010 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * sprintf.c (_HAVE_SANE_QUAD_): if a certain platform has LONG_LONG in
+ 8 byte, it might be sane quad. [ruby-core:33634]
+
+Fri Dec 10 10:07:59 2010 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * lib/net/http.rb: remove version 1.1 features.
+
+Fri Dec 10 02:18:02 2010 Aaron Patterson <aaron@tenderlovemaking.com>
+
+ * ext/openssl/ossl_x509store.c (ossl_x509stctx_cleanup): removing C
+ implementation of `cleanup`.
+
+ * ext/openssl/lib/openssl/x509.rb: adding ruby implementation of
+ `cleanup`. OpenSSL::X509::StoreContext#cleanup is deprecated since
+ reusing the underlying struct doesn't make sense. [ruby-dev:42546]
+
+Thu Dec 9 20:14:39 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * parse.y (lvar_defined_gen, shadowing_lvar_gen, dvar_defined): no
+ warnings for unused method and block arguments.
+ [ruby-dev:42718] [ruby-dev:42724]
+
+Thu Dec 9 19:25:49 2010 Tanaka Akira <akr@fsij.org>
+
+ * dln.c: parenthesize macro arguments.
+
+Thu Dec 9 18:51:06 2010 Tanaka Akira <akr@fsij.org>
+
+ * lib/webrick/accesslog.rb (WEBrick::AccessLog#format): support
+ %{remote}p for logging remote (client) port number.
+ [ruby-dev:42670]
+
+Thu Dec 9 11:00:30 2010 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * array.c (rb_ary_dup): should copy contents only. no instance
+ variable, no class would be copied. it would affect methods
+ #sort, #reject, #transpose, #uniq, #compact, and #shuffle.
+ [ruby-core:33640]
+
+ * array.c (rb_ary_reverse_m): ditto.
+
+ * array.c (rb_ary_rotate_m): ditto.
+
+Wed Dec 8 21:38:40 2010 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * ext/dl/lib/dl/struct.rb: clean a warning: assigned but unused
+ variable. patched by Kouhei Yanagita. [ruby-dev:42722]
+
+ * ext/dl/lib/dl/import.rb: ditto.
+
+Wed Dec 8 21:36:16 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * parse.y (shadowing_lvar_gen): fix line number. [ruby-dev:42718]
+
+Wed Dec 8 20:37:11 2010 Tanaka Akira <akr@fsij.org>
+
+ * dir.c: parenthesize macro arguments.
+
+Tue Dec 7 22:37:15 2010 Masaya Tarui <tarui@ruby-lnag.org>
+
+ * io.c (io_read): duplicate string if shared. [ruby-dev:42719]
+
+Tue Dec 7 22:31:08 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/optparse.rb (OptionParser::Officious): separate completion
+ options from --help. [ruby-dev:42690]
+
+ * lib/optparse.rb (OptionParser::Completion#candidate),
+ (OptionParser::Switch#compsys): remove unused variables.
+
+Tue Dec 7 22:05:25 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * transcode.c (transcode_loop): call default handler of the given
+ hash, method, proc or [] method as fallback. [ruby-dev:42692]
+
+Tue Dec 7 21:59:37 2010 Kouhei Sutou <kou@cozmixng.org>
+
+ * lib/rexml/light/node.rb: remove circular require.
+
+Tue Dec 7 21:56:01 2010 Kouhei Sutou <kou@cozmixng.org>
+
+ * test/rexml/test_light.rb: really suppress a warning.
+
+Tue Dec 7 21:51:57 2010 Kouhei Sutou <kou@cozmixng.org>
+
+ * test/rexml/test_light.rb: suppress a warning.
+
+Tue Dec 7 21:14:03 2010 Tanaka Akira <akr@fsij.org>
+
+ * debug.c: parenthesize macro arguments.
+
+Tue Dec 7 21:06:38 2010 Kouhei Sutou <kou@cozmixng.org>
+
+ * lib/rexml/doctype.rb, test/rexml/test_doctype.rb: suppress warnings.
+ [ruby-core:33305]
+ Reported by Aaron Patterson. Thanks!!!
+
+Tue Dec 7 18:56:52 2010 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * ext/nkf/lib/kconv.rb (String#kconv): fix typo and update rdoc.
+ patched by Kouhei Yanagita [ruby-dev:42696]
+
+Tue Dec 7 20:32:11 2010 Kouhei Sutou <kou@cozmixng.org>
+
+ * test/rexml/test_doctype.rb: add Accessor to test case name.
+
+Tue Dec 7 20:31:02 2010 Kouhei Sutou <kou@clear-code.com>
+
+ * test/rexml/test_doctype.rb: Doctype -> DocType.
+
+Tue Dec 7 20:29:23 2010 Kouhei Sutou <kou@clear-code.com>
+
+ * test/rexml/test_doctype_mixin.rb: rename to ...
+ * test/rexml/test_doctype.rb: ... this to remove needless name.
+
+Tue Dec 7 17:03:16 2010 Shugo Maeda <shugo@ruby-lang.org>
+
+ * lib/net/imap.rb (xlist): supported the XLIST command, which is an
+ extension by Apple and Google. patch by Geoff Youngs.
+ [ruby-core:33521]
+
+Tue Dec 7 08:00:44 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * configure.in, win32/Makefile.sub (WERRORFLAG): flag to treat
+ warnings as errors.
+
+ * lib/mkmf.rb (Logging.postpone): yield log file object.
+
+ * lib/mkmf.rb (xsystem): add options, :werror only right now.
+
+ * lib/mkmf.rb (with_werror): check as if warnings are errors.
+
+ * lib/mkmf.rb (convertible_int): make declaration conflict
+ warnings errors not to pass wrong type. [ruby-dev:42684]
+
+ * lib/mkmf.rb (COMMON_MACROS): get rid of conflicts.
+
+ * win32/Makefile.sub (WARNFLAGS): make declaration conflict
+ warnings errors if possible.
+
+Sun Dec 7 21:16:10 2010 Tanaka Akira <akr@fsij.org>
+
+ * cont.c: parenthesize macro arguments.
+
+Tue Dec 7 00:27:14 2010 Masaya Tarui <tarui@ruby-lnag.org>
+
+ * win32/win32.c (rb_w32_read): fixed more for readline,
+ and so on. [ruby-core:33511]
+
+Mon Dec 6 23:18:22 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * test/mkmf/base.rb (TestMkmf#setup): run quietly.
+
+ * test/mkmf/test_find_executable.rb (test_find_executable): use
+ configured results.
+
+ * common.mk (test-build): test for build process.
+
+Mon Dec 6 22:47:15 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/optparse.rb (OptionParser#candidate): skip separators.
+
+ * sample/optparse/opttest.rb: should not override --help.
+ [ruby-dev:42690]
+
+Mon Dec 6 19:00:48 2010 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
+
+ * misc/rb_optparse.zsh: fix typos.
+
+Mon Dec 6 18:59:04 2010 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
+
+ * NEWS: add new encodings.
+
+Mon Dec 6 18:56:42 2010 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
+
+ * test/ruby/test_string.rb (TestString#test_scan): add a test for
+ [ruby-core:33338] #4087.
+
+Mon Dec 6 18:55:36 2010 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
+
+ * test/uri/test_common.rb (TestCommon#test_encode_www_form): add
+ tests for r30015.
+
+Mon Dec 6 10:39:54 2010 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * lib/uri/common.rb (URI::Parser#initialize_pattern):
+ refix for restrict the pattern.
+
+Mon Dec 6 09:45:11 2010 Eric Hodel <drbrain@segment7.net>
+
+ * ext/openssl (OpenSSL): add toplevel documentation
+ * ext/openssl/ossl_ssl.c (SSLContext, SSLSocket: add additional
+ documentation
+ * ext/openssl: move "let rdoc know about mOSSL" comments so they don't
+ show up in output
+
+Mon Dec 6 09:16:46 2010 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * lib/uri/common.rb (URI::Parser#initialize_pattern):
+ workaround fix pattern of hostname for RFC 3986. [ruby-dev:42672]
+
+Mon Dec 6 09:14:38 2010 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * lib/mkmf.rb (check_signedness): rename unused variable prelude.
+
+Sun Dec 5 17:56:36 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * class.c (make_metaclass): fix probable typo. builtin type flag
+ cannot be used with FL_TEST.
+
+Sun Dec 5 12:09:27 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/irb/init.rb (IRB.parse_opts): fix typo. [ruby-core:33574]
+
+Sun Dec 5 11:27:08 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ruby.c (load_file_internal): decrement for ungotten line.
+ [ruby-dev:42680]
+
+Sun Dec 5 10:32:11 2010 Tanaka Akira <akr@fsij.org>
+
+ * complex.c: parenthesize macro arguments.
+
+Sat Dec 4 11:39:17 2010 Eric Hodel <drbrain@segment7.net>
+
+ * ext/openssl/ossl_x509ext.c (initialize): add documentation.
+
+Sat Dec 4 11:21:50 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * hash.c (rb_hash_update_by): new API for Hash#update.
+
+Sat Dec 4 11:18:10 2010 Tanaka Akira <akr@fsij.org>
+
+ * class.c: parenthesize macro arguments.
+
+Sat Dec 4 11:07:57 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * vm_core.h (rb_vm_inc_const_missing_count): missing prototype.
+
+Sat Dec 4 08:50:10 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/iconv/iconv.c (Init_iconv): no warnings if $VERBOSE is nil.
+
+Sat Dec 4 08:25:15 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * vm_insnhelper.c (vm_call_method): revert r30064 and r30071,
+ because of [ruby-core:26761]. Bug#4106 rejected.
+
+Sat Dec 4 07:46:48 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/mkmf.rb (String#tr_cpp): substitute * with P like as
+ autoconf.
+
+Fri Dec 3 22:36:45 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * vm_insnhelper.c (vm_call_method): protected methods should be
+ checked against the real class.
+
+Fri Dec 3 20:23:31 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/mkmf.rb (convertible_int): define printf format prefix too.
+
+ * lib/mkmf.rb (convertible_int): detect convertible integer type.
+ port RUBY_REPLACE_INT from configure.in.
+
+ * lib/mkmf.rb (check_sizeof): should return integer always.
+
+Fri Dec 3 12:54:48 2010 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * win32/Makefile.sub (RCFLAGS): VC10 and after only. fixed the problem
+ of r30015. [ruby-core:33530]
+
+Fri Dec 3 12:41:52 2010 URABE Shyouhei <shyouhei@ruby-lang.org>
+
+ * gc.c (rb_objspace_free): With our "lazy-sweep" GC engine, it is
+ possible for an object to survive until its surrounding object
+ space is about to be freed. Those objects, if any, remains
+ leaked for the rest of a process life. This is problematic
+ because for instance a T_DATA object may have its own destructor
+ to terminate something.
+
+ * vm.c (ruby_vm_destruct): ruby_current_vm termination should be
+ somewhere after rb_objspace_free for above reason.
+
+Fri Dec 3 12:17:19 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * vm_insnhelper.c (vm_call_method): protected singleton methods should
+ be visible from same real class methods. [ruby-core:33506]
+
+Fri Dec 3 07:08:42 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/stringio/stringio.c (strio_getline): round upto next char
+ boundary. [ruby-dev:42674]
+
+Fri Dec 3 06:52:46 2010 Tanaka Akira <akr@fsij.org>
+
+ * compile.c: parenthesize macro arguments.
+
+Fri Dec 3 04:08:59 2010 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * encoding.c (enc_alias_internal): use st_insert2 and change return
+ value to int.
+
+ * encoding.c (enc_alias): follow enc_alias_internal.
+
+Fri Dec 3 01:52:43 2010 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * encoding.c (enc_alias_internal): use xfree instead of free.
+
+Thu Dec 2 23:52:26 2010 URABE Shyouhei <shyouhei@ruby-lang.org>
+
+ * NEWS: entry for ruby_vm_at_exit().
+
+ * eval.c (ruby_cleanup): bug fix around at_exit (1) timing was
+ wrong. (2) execution order was opposite.
+
+Thu Dec 2 23:05:14 2010 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * win32/Makefile.sub (RCFLAGS): -nologo switch is only available in
+ newer versions of rc.exe. fixed the problem of r30012.
+
+Thu Dec 2 21:28:07 2010 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * ext/json/lib/json/add/rails.rb: removed.
+
+Thu Dec 2 21:22:05 2010 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * encoding.c (enc_alias_internal): free the copied key and
+ return NULL when given key is already registered.
+
+ * encoding.c (enc_alias): call set_encoding_const only when the
+ alias is not registered yet.
+
+Thu Dec 2 19:58:24 2010 URABE Shyouhei <shyouhei@ruby-lang.org>
+
+ * vm.c (ruby_vm_at_exit): new API. This enables extension libs to
+ hook a VM termination. Right now, because the VM we have is
+ process global, most extensions do not deallocate resources and
+ leave them to Operating System's reaping userland processes. But
+ in a future we plan to have multiple VMs to run simultaneously in
+ a single process (MVM project). At that stage we can no longer
+ rely on OSes and have to manage every resources to be reclaimed
+ properly. So it is. For a forward-compatibility reason this API
+ is introduced now, encouraging you to be as gentle as you can for
+ your resources; that is, tidy up your room.
+
+ * include/ruby/vm.h: ditto.
+
+ * vm_core.h (rb_vm_struct): new field.
+
+ * vm.c (vm_init2): initialize above new field.
+
+ * eval.c (ruby_cleanup): trigger those hooks.
+
+Thu Dec 2 17:00:44 2010 Tanaka Akira <akr@fsij.org>
+
+ * bignum.c: parenthesize macro arguments.
+
+Thu Dec 2 15:31:14 2010 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * win32/win32.c (rb_w32_read): more fix. [ruby-core:33513]
+
+Thu Dec 2 13:41:43 2010 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * win32/win32.c (rb_w32_read): workaround for console reading troubles.
+ fixed [ruby-core:33511]
+
+Thu Dec 2 13:10:42 2010 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * lib/uri/common.rb (URI.encode_www_form):
+ split key-value when the value is Array like object.
+
+Thu Dec 2 10:39:39 2010 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * lib/net/http.rb (Net::HTTP#set_form_data):
+ use URI.encode_www_form for application/x-www-form-urlencoded.
+
+Thu Dec 2 10:38:40 2010 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * ext/extmk.rb: remove $makeflags.defined?, it should be $mflags.
+
+Thu Dec 2 10:19:47 2010 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * win32/Makefile.sub (rc): suppress meaningless message.
+
+Thu Dec 2 10:09:40 2010 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * ext/json/generator/extconf.rb: remove the lines which set -O3
+ when -O option is not set.
+ Note that -O3 doesn't always exist.
+
+ * ext/json/parser/extconf.rb: ditto.
+
+Thu Dec 2 10:01:59 2010 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * ext/extmk.rb: define $makeflags.defined? like $mflags.
+
+Thu Dec 2 07:20:20 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/test/unit.rb (Test::Unit::GCStressOption): --gc-stress
+ option.
+
+ * lib/test/unit.rb (Test::Unit::Mini#_run_suites): show the result
+ even when interrupted on the way.
+
+Thu Dec 2 07:08:38 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/io/console/console.c (setattr): should retry on EINTR.
+ [ruby-dev:42666]
+
+Thu Dec 2 02:30:50 2010 Eric Hodel <drbrain@segment7.net>
+
+ * lib/net/http.rb: fixed positional wording to match revised order.
+
+Thu Dec 2 01:24:39 2010 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * ext/json/lib/json/common.rb: don't use iconv on 1.9.
+ patched by Shota Fukumori [ruby-core:33164]
+
+Thu Dec 2 01:02:03 2010 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * ext/json: Update github/flori/json from 1.4.2+ to
+ e22b2f2bdfe6a9b0. this fixes some bugs.
+
+Thu Dec 2 00:05:44 2010 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * lib/net/http.rb: improve rdoc.
+ This change the order of chapter because such overview should
+ begin with simple examples.
+ patched by Eric Hodel [ruby-core:33469]
+
+Wed Dec 1 22:01:49 2010 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * numeric.c (Init_Numeric): fixed a potential bug when using bccwin32
+ ruby with Microsoft's dll, though we already gave up of supporting
+ bccwin32. [ruby-core:33503]
+
+Wed Dec 1 21:43:21 2010 Tanaka Akira <akr@fsij.org>
+
+ * array.c: parenthesize macro arguments.
+
+Wed Dec 1 21:41:57 2010 Tanaka Akira <akr@fsij.org>
+
+ * test/socket/test_addrinfo.rb: extract Errno::EADDRINUSE as a method.
+
+ * test/socket/test_socket.rb: ditto.
+
+Wed Dec 1 15:08:32 2010 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * test/openssl/test_ssl.rb (test_not_started_session): non socket
+ argument of SSLSocket.new is not supported on Windows.
+
+Wed Dec 1 14:36:36 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * string.c (rb_memhash): zero-filled strings should return
+ different values. [ruby-core:33500]
+
+Wed Dec 1 14:27:49 2010 Ryan Davis <ryand-ruby@zenspider.com>
+
+ * lib/minitest/*.rb: Imported minitest 2.0.0 r5952.
+ * test/minitest/*.rb: ditto.
+ * lib/test/unit.rb: Compatibility fix for minitest changes.
+
+Wed Dec 1 10:16:41 2010 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * string.c (rb_str_inspect): fix typo (not 0xFD but 0xFE).
+
+Wed Dec 1 09:28:27 2010 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * addr2line.c: Follow .gnu_debuglink section.
+ A user of distribution provided ruby will see line
+ info if s/he has a debug package for ruby.
+ patched by Shinichiro Hamaji [ruby-dev:42655]
+
+Wed Dec 1 01:29:15 2010 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * string.c (rb_str_inspect): inspect as a dummy encoding string
+ when a UTF-16/32 (not BE/LE) string does not have a BOM.
+ Unicode and some RFCs say that a string labeled as UTF-16/32
+ doesn't have a BOM, it should be considered big endian.
+ But many Windows programs generates little endian UTF-16
+ strings without a BOM. So String#inspect treats a string
+ labeled UTF-16/32 without a BOM as a dummy encoding string.
+ patched by Martin Duerst. [ruby-core:33461]
+
+Tue Nov 30 17:04:10 2010 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * addr2line.c (parse_debug_line_cu): ignore DW_LNE_set_discriminator.
+ To ignore, it needs to read a single unsigned LEB128 integer.
+
+Tue Nov 30 16:29:19 2010 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * vm_dump.c: undef HAVE_BACKTRACE when the OS is FreeBSD (in other
+ words backtrace() is libexecinfo) and it is optimized.
+ This temporary hack may be also applied to other libexecinfo
+ environments.
+
+Tue Nov 30 16:23:23 2010 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * lib/net/http.rb: improve rdoc.
+ patched by Eric Hodel ref #4100
+
+Tue Nov 30 12:23:52 2010 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * win32/win32.c (rb_w32_read): read only 1 byte at once on console.
+ workaround of Windows bug. see [ruby-core:33460].
+ this is not the final solution.
+
+Tue Nov 30 11:39:13 2010 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * lib/net/http.rb: improve rdoc.
+ patched by mathew murphy [ruby-core:33472] ref #4100
+
+Tue Nov 30 05:03:44 2010 Eric Hodel <drbrain@segment7.net>
+
+ * lib/uri/common.rb (encode_www_form, encode_www_form_component):
+ Improve English in documentation.
+
+ * ext/openssl/ossl_ssl.c (ssl_version=, ciphers=): Document
+ #ssl_version=, add documentation for #ciphers=.
+
+Mon Nov 29 22:55:24 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/uri/common.rb (URI::WFKV_): get rid of backtrack explosion
+ by nested repeat operators. [ruby-core:33464]
+
+Mon Nov 29 22:53:13 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * win32/Makefile.sub (scriptbin.mk): fix generated rules.
+
+ * win32/win32.c (rb_w32_write_console): fix argument type.
+
+Mon Nov 29 21:12:51 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * misc/ruby-mode.el (ruby-forward-sexp): stop after literal hash
+ key labels.
+
+ * misc/ruby-mode.el (ruby-font-lock-keywords): highlight literal
+ hash key labels as symbols.
+
+Mon Nov 29 18:31:31 2010 Martin Duerst <duerst@it.aoyama.ac.jp>
+
+ * test/ruby/test_transcode.rb (test_unicode_public_review_issue_121):
+ - Removed commented-out options that are no longer under discussion.
+ - Added two more tests for forthcomming clarifications.
+
+Mon Nov 29 14:31:17 2010 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * win32/win32.c (rb_w32_isatty): use GetConsoleMode() to determine the
+ fd is console or not, just like rb_w32_write_console(). [experimental]
+
+Mon Nov 29 14:19:40 2010 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * include/ruby/win32.h (rb_w32_write_console): wrong prototype.
+
+Mon Nov 29 14:10:55 2010 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * win32/win32.c (rb_w32_write_console): fixed indentation.
+
+Sun Nov 28 22:13:39 2010 Koichi Sasada <ko1@atdot.net>
+
+ * thread_pthread.c (NATIVE_MUTEX_LOCK_DEBUG): move and use it.
+
+ * ChangeLog: fix my timezone.
+
+Mon Nov 28 21:58:58 2010 Koichi Sasada <ko1@atdot.net>
+
+ * thread_pthread.c: remove pthread_atfork().
+
+Mon Nov 28 21:54:22 2010 Koichi Sasada <ko1@atdot.net>
+
+ * thread_pthread.c (native_cond_*): Check return code.
+ (Some OSes except Linux return error code).
+
+Sun Nov 28 21:46:21 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * thread_pthread.c (thread_start_func_1): initialize native thread
+ data immediately before starting.
+
+Sun Nov 28 14:56:32 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * io.c (struct argf): make lineno long, and reorder members.
+
+Sun Nov 28 14:55:42 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * thread_win32.c (gvl_release, gvl_init): suppress warnings.
+
+Sun Nov 28 14:48:24 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * thread_pthread.c (gvl_release, gvl_init): suppress warnings.
+
+ * vm_core.h (rb_vm_gvl_destroy): add prototype.
+
+Sun Nov 28 14:46:24 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * thread_pthread.c (gvl_reinit): register atfork handler only in
+ the parent process, to get rid of dead lock.
+
+Sun Nov 28 12:23:57 2010 Koichi Sasada <ko1@atdot.net>
+
+ * thread.c, vm_core.h: make gvl_acquire/release/init/destruct
+ APIs to modularize GVL implementation.
+
+ * thread_pthread.c, thread_pthread.h: Two GVL implementations.
+ (1) Simple locking GVL which is same as existing GVL.
+ (2) Wake-up queued threads. The wake-up order is simple FIFO.
+ (We can make several queues to support exact priorities, however
+ this causes some issues such as priority inversion and so on.)
+ This impl. prevents spin-loop (*1) caused on SMP environments.
+ *1: Only one Ruby thread acquires GVL again and again.
+ Bug #2359 [ruby-core:26694]
+
+ * thread_win32.c, thread_win32.h: Using simple lock
+ not by CRITICAL_SECTION but by Mutex.
+ Bug #3890 [ruby-dev:42315]
+
+ * vm.c (ruby_vm_destruct): ditto.
+
+Sun Nov 28 04:40:00 2010 Luis Lavena <luislavena@gmail.com>
+
+ * io.c (io_fwrite): use rb_w32_write_console under Windows.
+
+ * win32/win32.c (rb_w32_write_console): added to write to write
+ Unicode using WriteConsoleW for stdout/stderr. [ruby-core:33166]
+
+Sun Nov 28 03:58:47 2010 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * lib/net/http.rb: improve rdoc.
+ patched by Mike Perham [ruby-core:33433]
+
+Sat Nov 27 19:12:10 2010 Tanaka Akira <akr@fsij.org>
+
+ * time.c: parenthesize macro arguments.
+
+Sat Nov 27 18:08:18 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * time.c (leap_year_v_p): fixed typo. [ruby-dev:42631]
+
+Sat Nov 27 17:57:08 2010 Tanaka Akira <akr@fsij.org>
+
+ * resolv.rb (Resolv::DNS): use the same DNS server when retry using
+ TCP. reported by Julian Mehnle. [ruby-core:32970]
+
+Sat Nov 27 15:45:27 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * vm_dump.c (rb_vm_bugreport): see CrashReport log on Mac OS X.
+
+ * configure.in: link addr2line only for ELF.
+
+Sat Nov 27 13:58:55 2010 Shugo Maeda <shugo@ruby-lang.org>
+
+ * lib/optparse.rb (OptionParser#candidate): : was missing. Thanks,
+ Shota Fukumori. [ruby-dev:42634]
+
+Sat Nov 27 12:07:05 2010 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * man/ruby.1: Ruby man page from Arthur Gunn in [ruby-core:33412]
+
+Sat Nov 27 11:29:24 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/optparse.rb (OptionParser#candidate): get rid of 1.9 syntax
+ so that BASERUBY can be 1.8.
+
+Sat Nov 27 08:16:21 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * addr2line.c (rb_dump_backtrace_with_lines): should close fd on
+ edge case.
+
+Fri Nov 26 13:33:24 2010 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * addr2line.c: apply a patch from shinichiro.h.
+
+Fri Nov 26 12:21:20 2010 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * addr2line.c: added to show source filename and line number of
+ functions in backtrace. [ruby-dev:42625]
+ a patch from shinichiro.h <shinichiro.hamaji AT gmail.com>
+
+ * addr2line.h: ditto.
+
+ * common.mk: add addr2line.$(OBJEXT).
+
+ * configure.in: check dl_iterate_phdr.
+
+ * vm_dump.c (rb_vm_bugreport): use rb_dump_backtrace_with_lines in
+ addr2line.c when the binary is ELF.
+
+Fri Nov 26 12:12:50 2010 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * regcomp.c (setup_tree): restart setup_tree() for a node whose
+ AnchorNode's type is ANCHOR_PREC_BEHIND or ANCHOR_PREC_BEHIND_NOT
+ and divide_look_behind_alternatives() divided it to NT_ALT or
+ NT_LIST. [ruby-core:33370]
+
+Fri Nov 26 11:40:11 2010 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * vm_dump.c (dump_thread): get only required rights of the target
+ thread because THREAD_ALL_ACCESS causes an access error on XP.
+ reported by Masaya TARUI via IRC.
+
+Fri Nov 26 11:09:07 2010 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * vm_dump.c (dump_thread): show the displacement from the beginning
+ of the symbol.
+
+Fri Nov 26 10:48:23 2010 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * vm_dump.c (dump_thread): follow the output of glibc.
+ see [ruby-dev:42627]
+
+Fri Nov 26 09:48:45 2010 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * re.c (rb_reg_initialize_str): should succeed the taint status from
+ the origin. [ruby-core:33338]
+
+Fri Nov 26 09:32:37 2010 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * vm_dump.c (dump_thread): seems to be necessary the 3rd argument of
+ SymGetLineFromAddr64(), even though MSDN says it can be zero.
+
+Fri Nov 26 09:03:38 2010 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * regcomp.c (onig_is_prelude): added to check whether ruby is still
+ in prelude (or other boot processes) or not.
+
+ * regcomp.c (optimize_node_left): use onig_is_prelude for printing.
+
+ * regcomp.c (set_optimize_info_from_tree): ditto.
+
+ * regcomp.c (onig_compile): ditto.
+
+ * regcomp.c (print_compiled_byte_code_list): print its address.
+
+ * regcomp.c (print_indent_tree): print its contents tree of
+ ANCHOR_PREC_READ(_NOT) and ANCHOR_PREC_BEHIND(_NOT).
+
+Thu Nov 25 23:10:49 2010 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * regcomp.c (print_distance_range): use PRIuSIZE.
+
+ * regcomp.c (print_optimize_info): use %ld because the type of
+ calculated value of integers is long.
+
+ * regexec.c (onig_print_compiled_byte_code): add prototype.
+
+ * regexec.c (match_at): add 2nd argument.
+
+Thu Nov 25 10:29:55 2010 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * ext/dl/callback/mkcallback.rb (gencallback): shouldn't assume that
+ VALUE is the same size with long.
+
+Thu Nov 25 10:03:14 2010 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * test/win32ole/test_err_in_callback.rb (teardown): remove tmp file
+ only when it exists.
+
+Thu Nov 25 01:38:25 2010 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * enc/trans/big5-hkscs-tbl.rb: Update table as HKSCS-2008.
+ patched by oCameLo oTnTh [ruby-core:33256]
+
+ * enc/big5.c: add alias Big5-HKSCS:2008 to Big5-HKSCS.
+
+Wed Nov 24 15:18:07 2010 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * vsnprintf (BSD_vfprintf): use QUADINT macro only when _HAVE_SANE_QUAD_
+ macro is defined.
+
+Wed Nov 24 12:47:16 2010 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * vsnprintf (BSD_vfprintf): added VC++ compatible size specifications
+ (I, I32, I64).
+
+Wed Nov 24 11:19:13 2010 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * string.c (rb_str_inspect): treat UTF-16 and UTF-32 as BE or LE.
+
+Wed Nov 24 06:35:32 2010 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * enc/trans/utf_16_32.trans: add the UTF-32 converter.
+
+Wed Nov 24 05:40:33 2010 NARUSE, Yui <naruse@ruby-lang.org>
+
+Wed Nov 24 06:13:32 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * win32/win32.c (filecp, wstr_to_mbstr, mbstr_to_wstr):
+ refactored.
+
+Wed Nov 24 05:40:33 2010 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * enc/trans/utf_16_32.trans: add a converter from UTF-8 to UTF-16.
+
+Wed Nov 24 03:21:35 2010 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * enc/trans/utf_16_32.trans: raise error on unpaired upper
+ surrogates.
+
+Wed Nov 24 01:40:23 2010 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * enc/utf_16_32.h: add UTF-16 and UTF-32 as a dummy encoding.
+
+ * enc/trans/utf_16_32.trans: add a converter from UTF-16 to UTF-8.
+
+Tue Nov 23 21:59:47 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * win32/win32.c (wlink, rb_w32_getppid): use typedef instead of
+ repeating complicated function prototypes.
+
+Tue Nov 23 18:54:03 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * vm.c (rb_thread_mark): should mark self in control
+ frames. [ruby-core:33289]
+
+Tue Nov 23 07:57:31 2010 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * lib/date/delta/parser.{ry,rb}: fixed a bug of token scanner.
+
+Tue Nov 23 07:29:24 2010 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * complex.c, rational.c ({nucomp,nurat}_expt): added a check.
+
+Tue Nov 23 07:27:27 2010 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * lib/date.rb (daynum): should be private.
+
+Tue Nov 23 07:22:54 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ChangeLog (change-log-indent-text): hanging indent.
+
+Tue Nov 23 06:30:51 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * configure.in (SITE_DIR, VENDOR_DIR),
+ version.c (ruby_initial_load_paths): exclude directories that
+ are configured without them from $LOAD_PATH. [ruby-core:33267]
+
+ * configure.in (rubylibprefix): No ruby, No libprefix.
+
+Tue Nov 23 01:05:27 2010 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * vsnprintf.c (BSD_vfprintf): don't output floating point
+ when the precision is 0. [ruby-dev:42615]
+
+Mon Nov 22 21:30:57 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * string.c (rb_str_inspect): fix for ascii-compatible external
+ encoding and different encoding string. [ruby-core:33283]
+
+Mon Nov 22 18:45:44 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/mkmf.rb (create_makefile): should not duplicate rules.
+ bug fix of r29842.
+
+Mon Nov 22 18:04:40 2010 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * enc/big5.c: split CP950 from Big5.
+
+ * enc/big5.c: split CP951 from Big5-HKSCS.
+
+ * enc/trans/big5.trans: import conversion table of Big5, Big5-HKSCS,
+ CP950, and CP951 from ICU. they need fallback conversions.
+ ref [ruby-core:33256]
+ http://source.icu-project.org/repos/icu/data/trunk/charset/data/ucm/
+
+ * tool/transcode-tblgen.rb (import_ucm): add to import ucm files.
+
+Mon Nov 22 18:33:30 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * string.c (rb_str_inspect): append for each chars instead of bulk
+ copy if encoding conversion is needed. [ruby-core:33283]
+
+Mon Nov 22 14:22:45 2010 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * time.c (time_zone): use rb_locale_str_new_cstr to set encoding
+ as locale and convert its content to internal encoding.
+ [ruby-core:33278]
+
+Mon Nov 22 11:58:11 2010 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * string.c (rb_str_concat): set ENC_CODERANGE_VALID when the
+ receiver is 7BIT and the argument is non ASCII.
+
+Mon Nov 22 01:48:58 2010 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * lib/date.rb: some improvements for performance.
+
+Sat Nov 20 07:45:50 2010 Aaron Patterson <aaron@tenderlovemaking.com>
+
+ * lib/mkmf.rb: adding compilation support for ObjC/ObjC++ extensions.
+ Thanks Scott Gonyea! [ruby-core:33260]
+
+Sat Nov 20 01:57:55 2010 Akio Tajima <artonx@yahoo.co.jp>
+
+ * common.mk: add dependency(insns.inc) to compile.obj
+
+Fri Nov 19 23:05:48 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * win32/Makefile.sub (insns_rules.mk): remove extra backslash.
+
+ * cygwin/GNUmakefile.in, win32/Makefile.sub (clean): rc files are
+ made at compile time, so should be removed by clean.
+
+Fri Nov 19 22:09:46 2010 Kouhei Sutou <kou@cozmixng.org>
+
+ * test/rexml/test_core.rb
+ (Tester#test_pretty_format_long_text_finite): skip a test that
+ uses long string on small memory system. [ruby-dev:42599]
+
+Fri Nov 19 21:07:06 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/optparse.rb: shell completion support for zsh. based on
+ <http://d.hatena.ne.jp/rubikitch/20071002/zshcomplete>
+
+ * lib/optparse.rb: shell completion support for bash.
+
+Fri Nov 19 00:00:00 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * cygwin/GNUmakefile.in (SCRIPTPROGRAMS): no needs on cygwin.
+
+ * win32/Makefile.sub (scriptbin): create script binaries.
+
+Thu Nov 18 23:21:23 2010 Kouhei Sutou <kou@cozmixng.org>
+
+ * lib/rexml/formatters/pretty.rb (REXML::Formatters::Pretty#wrap):
+ REXML::Formatters::Pretty#wrap used a recursive method call to
+ format text. This switches it to use an iterative approach.
+ [ruby-core:33245]
+ Patch by Jeremy Evans. Thanks!!!
+
+ * test/rexml/test_core.rb: add a test for it.
+
+Thu Nov 18 22:58:43 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * include/ruby/io.h (rb_io_buffer_t): extract from rb_io_t.
+
+Thu Nov 18 07:37:44 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * Makefile.in (reconfig): force reconfigure with previous options.
+
+ * common.mk (showconfig): show configure flags, like as
+ `config.status --config' generated by recent autoconf.
+
+Thu Nov 18 07:16:49 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * missing/langinfo.c (strncasecmp): get rid of redefinition.
+
+Thu Nov 18 00:02:17 2010 James Edward Gray II <jeg2@ruby-lang.org>
+
+ * lib/csv.rb: Upgrading output encoding with ASCII content
+ as needed. [ruby-core:33229]
+
+Wed Nov 17 23:19:21 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * win32/configure.bat: remove quotes from arguments to be quoted.
+
+ * lib/mkmf.rb (create_makefile): use forward slashes in messages.
+
+ * lib/mkmf.rb (create_makefile): make extension libraries messages
+ brief.
+
+ * win32/Makefile.sub (MAKEDIRS): should not include silent flag.
+
+ * common.mk (ext/ripper/ripper.c, ext/json/parser/parser.c): pass
+ Q and ECHO. [ruby-core:33226]
+
+Wed Nov 17 16:09:52 2010 Yuki Sonoda (Yugui) <yugui@yugui.jp>
+
+ * test/test_tracer.rb: new test case.
+ minimal regression test for r29280.
+
+Wed Nov 17 16:04:23 2010 Yuki Sonoda (Yugui) <yugui@yugui.jp>
+
+ * test/ruby/envutil.rb (Test::Unit::Assersions#assert_warn):
+ new assertion to assert that a particular warning message is
+ displayed.
+ forward port from branches/ruby_1_9_2@29795.
+
+Wed Nov 17 15:16:48 2010 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * regint.h (OnigOpInfoType): constify name.
+
+ * regcomp.c (op2name): constify return value.
+
+ * regcomp.c (onig_print_compiled_byte_code): use PRIuPTR and
+ uintptr_t to clean warnings.
+
+ * regcomp.c (print_indent_tree): use PRIxPTR and intptr_t.
+
+ * regexec.c (match_at): use PRIdPTR and intptr_t.
+
+Wed Nov 17 09:49:10 2010 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * enc/shift_jis.c (property_name_to_ctype): fix memory leak.
+
+ * enc/euc_jp.c (property_name_to_ctype): ditto.
+
+Wed Nov 17 08:54:04 2010 James Edward Gray II <jeg2@ruby-lang.org>
+
+ * lib/csv.rb: Upgrading output encoding as needed. [ruby-core:33135]
+
+Tue Nov 16 22:30:39 2010 Yusuke Endoh <mame@tsg.ne.jp>
+
+ * vm_insnhelper.c (vm_throw): remove fear of undefined behavior :-)
+ Coverity Scan found this bug.
+
+Tue Nov 16 09:33:00 2010 Kenta Murata <mrkn@mrkn.jp>
+
+ * ext/bigdecimal/lib/bigdecimal/util.rb (to_digits): avoid unused
+ variables warning, reported by Aaron Patterson.
+
+Tue Nov 16 06:39:31 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * pack.c (PACK_ITEM_ADJUST): return nil not result array and yield
+ values if block is given. [ruby-core:33193]
+
+Tue Nov 16 00:21:20 2010 Yusuke Endoh <mame@tsg.ne.jp>
+
+ * regparse.c (and_cclass, or_cclass): fix memory leak. Coverity Scan
+ found this bug. [ruby-dev:42579]
+
+Tue Nov 16 00:07:32 2010 Yusuke Endoh <mame@tsg.ne.jp>
+
+ * gc.c (assign_heap_slot): fix fear of memory leak and memory
+ violation. Coverity Scan found this bug.
+
+Mon Nov 15 23:54:45 2010 Yusuke Endoh <mame@tsg.ne.jp>
+
+ * eval_intern.h (CHECK_STACK_OVERFLOW): it was not intended to add
+ size_t to a pointer typed VALUE*. Coverity Scan found this defect.
+
+Mon Nov 15 23:41:21 2010 Yusuke Endoh <mame@tsg.ne.jp>
+
+ * compile.c (iseq_set_exception_local_table, iseq_set_local_table,
+ rb_iseq_build_from_ary): fix type inconsistency (which is benign
+ because sizeof(ID) == sizeof(ID*), though). Coverity Scan found
+ these bugs.
+
+Mon Nov 15 22:47:27 2010 Yusuke Endoh <mame@tsg.ne.jp>
+
+ * vm_eval.c (rb_funcall): ensure va_end after va_init_list. Coverity
+ Scan found this bug.
+
+Mon Nov 15 08:36:12 2010 Aaron Patterson <aaron@tenderlovemaking.com>
+
+ * lib/racc/parser.rb (do_parse, yyparse): using class eval to define
+ method and avoid __send__.
+
+Mon Nov 15 06:43:48 2010 Aaron Patterson <aaron@tenderlovemaking.com>
+
+ * etc/openssl/ossl_ssl.c (ossl_ssl_get_cert): raise exception if
+ pointer is invalid. Thanks Ippei Obayashi! [ruby-dev:42573]
+
+Sun Nov 14 17:57:45 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * enc/Makefile.in (distclean): should not remove sources which are
+ distributed in tarball.
+
+Sun Nov 14 16:48:56 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * parse.y (parser_set_token_info): turn on/off with directives.
+ [ruby-core:25442]
+
+Sun Nov 14 12:05:24 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * io.c (argf_readlines): forward to current_file for arguments
+ check. http://twitter.com/nagachika/status/3634254856589312
+
+Sun Nov 14 08:48:06 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * win32/setup.mak (-basic-vars-, -runtime-): suppress trailing
+ space and compiler command line.
+
+Sun Nov 14 04:22:32 2010 Alexander Zavorine <alexandre.zavorine@nokia.com>
+
+ * symbian/setup (config.h): Added HAVE_LABS and HAVE_LLABS to config.h.
+
+ * symbian/configure.bat: Changed packaging version in line with API
+ style 3 versioning.
+
+Sat Nov 13 16:37:56 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * common.mk (showflags, help): emit messages at once.
+
+ * win32/Makefile.sub (MSG, EOM): remove surrounding quotes by %~I.
+
+Sat Nov 13 01:31:30 2010 Akio Tajima <artonx@yahoo.co.jp>
+
+ * win32/Makefile.sub: reorder variable End Of Message (don't display it)
+
+Fri Nov 12 20:52:34 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * common.mk (showflags, help): use caret to quote leading spaces on
+ Windows.
+
+ * Makefile.in, common.mk, cygwin/GNUmakefile.in, enc/depend,
+ ext/ripper/depend, lib/mkmf.rb, win32/Makefile.sub: caddle up.
+
+Fri Nov 12 16:35:31 2010 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * configure.in: support C level backtrace information on FreeBSD.
+ When devel/libexecinfo is installed on FreeBSD, now ruby
+ can show C level backtrace information.
+ http://www.freebsd.org/cgi/cvsweb.cgi/ports/devel/libexecinfo/
+
+Fri Nov 12 09:58:30 2010 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * win32/setup.mak: use findstr.exe instead of find.exe, because all
+ target build platforms should have findstr.exe, and, find.exe often
+ means another command such as cygwin's.
+
+Fri Nov 12 00:30:19 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * win32/Makefile.sub (config.h): need PRI_LL_PREFIX.
+
+Thu Nov 11 23:38:32 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * configure.in: ANSI C-conforming const and volatile are mandatory
+
+ * configure.in (AC_C_CONST, AC_C_INLINE, AC_C_VOLATILE): check
+ before used in other checks.
+
+ * configure.in (RUBY_CHECK_PRINTF_PREFIX): should not break from
+ RUBY_WERROR_FLAG, so that ac_c_werror_flag gets restored.
+
+Thu Nov 11 23:04:44 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/iconv/iconv.c (warn_deprecated): show caller position.
+
+Thu Nov 11 23:03:12 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * io.c (argf_close): untie tied io before closing.
+
+ * io.c (argf_write): add ARGF.write and so on.
+
+ * io.c (argf_read_nonblock): add ARGF.read_nonblock.
+
+Thu Nov 11 21:49:06 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/rdoc/stats.rb (RDoc#print): get rid of NaN.
+
+Thu Nov 11 21:47:12 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * common.mk (SHOWFLAGS): show compile flags.
+
+ * common.mk: hide long command lines by default. verbose-mode is
+ turned on by V=1 as before.
+ http://jarp.does.notwork.org/diary/200605b.html#200605121
+
+Thu Nov 11 21:32:09 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/mkmf.rb (try_func): accept variable address.
+
+ * ext/win32ole/extconf.rb: libuuid is needed on cygwin.
+
+Thu Nov 11 21:24:36 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * file.c (file_expand_path): use cygwin_conv_path on cygwin 1.7 or
+ later.
+
+ * ruby.c (push_include_cygwin): ditto.
+
+Thu Nov 11 20:49:48 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * include/ruby/ruby.h (PRI_LL_PREFIX): format type specifier for
+ LONG_LONG may vary on platforms.
+
+Thu Nov 11 20:45:23 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * configure.in (SYMBOL_PREFIX): separate from EXPORT_PREFIX.
+
+ * win32/mkexports.rb (Exports#each_export): use SYMBOL_PREFIX.
+
+Wed Nov 10 07:20:10 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * cygwin/GNUmakefile.in (scriptbin): make executable file from
+ scripts with stub.
+
+ * ruby.c (load_file_internal): assume xflag for exe file as well
+ as no-shebang file.
+
+ * tool/rbinstall.rb: install script programs.
+
+ * win32/mkexports.rb (Exports#initialize): alias ruby_sysinit for
+ stub.
+
+ * win32/stub.c: stub for scripts. [EXPERIMENTAL]
+
+Tue Nov 9 21:57:45 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * dln.c (init_funcname): allocate and build initialization
+ funciton name at once.
+
+Tue Nov 9 21:14:54 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * configure.in (AC_FUNC_GETPGRP, AC_FUNC_SETPGRP): no need when
+ not used.
+
+ * configure.in (EXPORT_PREFIX): check generic prefix.
+
+Tue Nov 9 13:24:33 2010 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * regenc.c (onigenc_minimum_property_name_to_ctype):
+ \p{...} should be case insensitive. [ruby-core:33000]
+
+ * regenc.c (onigenc_property_list_add_property):
+ ditto.
+
+ * enc/euc_jp.c (init_property_list, property_name_to_ctype):
+ to lowercase property names.
+
+ * enc/shift_jis.c (init_property_list, property_name_to_ctype):
+ ditto.
+
+Tue Nov 9 13:29:36 2010 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * win32/win32.c (overlapped_socket_io): get rid of a warning of 64bit
+ mingw.
+
+Tue Nov 9 10:44:19 2010 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * util.c (ruby_strtod): this code uses FPU's rounding system.
+ But x86's FPU calculates double precision floating-point
+ numbers in 80bit precision, so it fails to round the value.
+ So ensure the value is assigned a variable. [ruby-dev:42551]
+ see also [ruby-math:00802]
+ http://www.shudo.net/java-grandprix99/strictfp/
+
+Tue Nov 9 07:30:15 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * error.c (rb_syserr_new): new function to make SystemCallError
+ instance without errno. [EXPERIMENTAL]
+
+ * error.c (rb_syserr_fail, rb_mod_syserr_fail): ditto.
+
+Tue Nov 9 05:54:57 2010 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
+
+ * lib/*.rb: Remove unused variable warnings.
+ Patch by Run Paint [ruby-core:30991]
+
+ * lib/rubygems/*, lib/rdoc/*.rb, lib/rake/*.rb: ditto
+
+Mon Nov 8 18:26:03 2010 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * util.c (ruby_hdtoa): fix type cast and bufsize.
+
+Mon Nov 8 15:40:56 2010 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * vsnprintf.c (BSD_vfprintf): fix precision specifier doesn't
+ work well on %f. [ruby-dev:42552]
+
+Mon Nov 8 14:41:40 2010 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * win32/win32.c (get_wsa_extension_function): typos.
+
+Mon Nov 8 13:41:33 2010 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * tool/enc-unicode.rb,
+ enc/unicode/name2ctype.h, enc/unicode/name2ctype.h.blt,
+ enc/unicode/name2ctype.kwd, enc/unicode/name2ctype.src:
+ Add Age property to regexp. [ruby-core:33019]
+ patched by Ammar Ali, tested by Run Paint Run Run
+
+Mon Nov 8 12:16:39 2010 Ben Walton <bwalton@artsci.utoronto.ca>
+
+ * configure.in: support -h for solaris linker when gcc not used
+
+Mon Nov 8 11:47:39 2010 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * win32/win32.c (finish_overlapped_socket): refactoring.
+
+Mon Nov 8 11:02:21 2010 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * win32/win32.c (get_proc_address): refactoring.
+
+ * win32/win32.c (get_wsa_exetinsion_function): refactoring.
+
+Mon Nov 8 09:45:35 2010 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * enc/trans/gbk-tbl.rb: Add euro sign. [ruby-core:33094]
+ CP936, which is de facto definition of GBK, has it.
+ http://msdn.microsoft.com/en-us/goglobal/cc305153.aspx
+
+Mon Nov 8 07:26:20 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * configure.in: check only the first symbol to get rid of
+ duplication. [ruby-core:33084] #4031
+
+Sun Nov 7 10:13:30 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * configure.in (NM): check on all platforms. #4031
+
+Sun Nov 7 06:16:33 2010 Aaron Patterson <aaron@tenderlovemaking.com>
+
+ * test/openssl/test_ocsp.rb: adding test for r29699. Thanks Elise
+ Huard! [ruby-core:32460]
+
+Sat Nov 6 07:33:08 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * configure.in (rb_cv_export_prefix): check for prefixed
+ underscore of exported symbols
+
+ * tool/rbinstall.rb (bin-comm): prepend prolog shell script if
+ necessary.
+
+ * configure.in (LIBRUBY_RELATIVE): use rpath token expansion.
+
+Sat Nov 6 07:24:01 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * template/ruby.pc.in (arch, sitearch): reordered.
+
+ * configure.in: keep failed file.
+
+Sat Nov 6 07:03:49 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * process.c (rb_fork_err): save errinfo before fdopen.
+
+Sat Nov 6 00:43:58 2010 Aaron Patterson <aaron@tenderlovemaking.com>
+
+ * ext/openssl/ossl_ocsp.c (ossl_ocspcid_initialize): an optional
+ parameter may be used to specify the OpenSSL::OCSP::CertificateId on
+ initialization. Thanks Elise Huard! [ruby-core:32460]
+
+Fri Nov 5 12:23:01 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * test/ruby/test_{process,system}.rb (test_fallback_to_sh):
+ meaningless and wrong tests where /bin/sh does not exist.
+
+ * process.c (proc_spawn_v): should spawn, not exec.
+
+Fri Nov 5 01:21:31 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * process.c (proc_exec_v, proc_spawn_v): try to execute with sh if
+ no shebang. [ruby-core:32745] [EXPERIMENTAL]
+
+Fri Nov 5 00:39:00 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * io.c (rb_io_readlines, rb_io_each_line): limit must not be zero.
+ a patch from Tomoyuki Chikanaga at [ruby-dev:42538]. #4024
+
+Fri Nov 5 00:14:15 2010 Aaron Patterson <aaron@tenderlovemaking.com>
+
+ * ext/fiddle/extconf.rb: fixing ffi library location on windows.
+ Thanks Usa! [ruby-core:32930]
+
+Thu Nov 4 20:04:44 2010 Koichi Sasada <ko1@atdot.net>
+
+ * gc.c (rb_newobj): force garbage_collect() if GC.stress == true.
+
+Thu Nov 4 19:48:22 2010 Koichi Sasada <ko1@atdot.net>
+
+ * ChangeLog: missed to write a last ChangeLog.
+
+ * gc.c (gc_finalize_deferred): removed.
+
+ * gc.c (rb_gc_finalize_deferred): Do not invoke a free_unused_heaps().
+
+Thu Nov 4 19:45:27 2010 Koichi Sasada <ko1@atdot.net>
+
+ * gc.c (run_final): do not need argument obj.
+
+Thu Nov 4 19:26:10 2010 Koichi Sasada <ko1@atdot.net>
+
+ * gc.c (before_gc_sweep): fix commit miss.
+
+Thu Nov 4 19:20:46 2010 Koichi Sasada <ko1@atdot.net>
+
+ * gc.c (after_gc_sweep, before_gc_sweep):
+ invoke rb_sweep_method_entry() as soon as possible.
+
+Thu Nov 4 19:13:58 2010 Koichi Sasada <ko1@atdot.net>
+
+ * gc.c (after_gc_sweep, slot_sweep): finalizers should be invoked
+ as soon as possible.
+
+Thu Nov 4 10:30:40 2010 URABE Shyouhei <shyouhei@ruby-lang.org>
+
+ * configure.in (--with-valgrind): Now this option is default on.
+ You can still explicitly disable this feature by specifying
+ --without-valgrind.
+
+Thu Nov 4 02:06:16 2010 Yusuke Endoh <mame@tsg.ne.jp>
+
+ * cont.c (fiber_t_alloc): raise an error when fiber is going to be
+ initialized twice. [ruby-dev:42524]
+
+Thu Nov 4 02:04:25 2010 Yusuke Endoh <mame@tsg.ne.jp>
+
+ * cont.c (rb_fiber_resume): raise an "double resume" error when root
+ fiber is going to be resumed. [ruby-dev:42523]
+
+Wed Nov 3 14:17:18 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/ostruct.rb (OpenStruct#delete_field): also undefine
+ accessor methods. [ruby-core:33010]
+
+Wed Nov 3 14:13:46 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * string.c (rb_enc_cr_str_buf_cat): concatenation of valid
+ encoding string and invalid encoding string should result
+ invalid encoding. [ruby-core:33027]
+
+Wed Nov 3 08:58:59 2010 Koichi Sasada <ko1@atdot.net>
+
+ * gc.c, vm.c, vm_core.h: remove USE_VALUE_CACHE option.
+
+Wed Nov 3 07:47:25 2010 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * lib/irb/ruby-lex.rb (RubyLex#identify_string): parse multiple
+ regex options. a patch from Heesob Park in [ruby-core:32988].
+
+Wed Nov 3 07:33:57 2010 Tanaka Akira <akr@fsij.org>
+
+ * vm_method.c (rb_clear_cache_by_class): just return if the class has
+ no method. reported by Eric Wong. [ruby-core:32689]
+
+Tue Nov 2 22:50:25 2010 Aaron Patterson <aaron@tenderlovemaking.com>
+
+ * ext/psych/lib/psych/visitors/visitor.rb (initialize): push accessor
+ methods to subclass that actually uses them.
+
+Tue Nov 2 22:47:08 2010 Aaron Patterson <aaron@tenderlovemaking.com>
+
+ * ext/psych/lib/psych/visitors/visitor.rb (accept): switch to
+ a dispatch cache rather than case / when statement.
+
+Tue Nov 2 21:46:52 2010 Kouhei Sutou <kou@cozmixng.org>
+
+ * NEWS: fix a typo.
+
+Tue Nov 2 20:10:32 2010 Tajima Akio <artonx@yahoo.co.jp>
+
+ * test/rake/test_tasks.rb: clear env var which is used by the test.
+ [ruby-dev:42508]
+
+Tue Nov 2 00:25:54 2010 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * ext/socket/extconf.rb: win64 is just same with win32 about socket.
+ notice: but wince is not same.
+
+Mon Nov 1 21:25:57 2010 URABE Shyouhei <shyouhei@ruby-lang.org>
+
+ * main.c: <stdlib.h> is needed, to introduce the getenv(3)
+ prototype declaration. Without it a C compiler shall infer
+ the getenv type as "int getenv(...);", but this is totally
+ wrong, especially when your machine's sizeof(int) and
+ sizeof(char*) differs. On such environment a return value
+ of getenv(3), which is in fact a char*, might first casted
+ into a int (loses data here), and then casted back to char*
+ by automatic integral promotion to fit to the prototype of
+ ruby_set_debug_option().
+
+Sun Oct 31 23:27:09 2010 Koichi Sasada <ko1@atdot.net>
+
+ * gc.c (finalizer_table, objspace->final.table):
+ Create finalizer_table at Init_heap().
+ Remove all null checks of finalizer_table.
+
+ * gc.c (mark_tbl): skip if no table entries.
+
+ * gc.c (slot_swee): remove useless need_call_final check.
+
+Sun Oct 31 22:32:08 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * gc.c (rb_objspace_free): finalizers should be called separately
+ from freeing objspace. [ruby-dev:42479]
+
+Sun Oct 31 22:24:14 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * eval.c (ruby_cleanup): free current VM and its objspace even
+ when exiting by SystemExit.
+
+Sun Oct 31 22:10:56 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * compile.c (new_child_iseq): adjust argument types.
+
+ * iseq.c (prepare_iseq_build, rb_iseq_new),
+ (rb_iseq_new_with_bopt_and_opt, rb_iseq_new_with_opt),
+ (rb_iseq_new_with_bopt): ditto.
+
+ * compile.c (iseq_set_exception_table): suppress warnings.
+
+ * insns.def (putspecialobject, defined): ditto.
+
+ * iseq.c (iseq_load): ditto.
+
+Sun Oct 31 09:30:51 2010 Koichi Sasada <ko1@atdot.net>
+
+ * vm_core.h: some refactoring.
+ - move decl. of rb_compile_option_struct to iseq.h.
+ - define enum iseq_type.
+ - define enum vm_special_object_type.
+
+ * compile.c: some refactoring.
+ - apply above changes.
+ - (struct iseq_link_element): change value of type.
+ - remove unused decl.
+ - fix comment.
+ - rename iseq_build_body and iseq_build_exception to
+ iseq_build_from_ary_body and iseq_build_from_ary_exception.
+
+ * iseq.h: define enum catch_type and enum defined_type.
+
+ * insns.def: apply above changes.
+
+ * iseq.c: define ISEQ_MAJOR_VERSION and ISEQ_MINOR_VERSION.
+
+Sat Oct 30 23:38:59 2010 Kouhei Sutou <kou@cozmixng.org>
+
+ * lib/rexml/encoding.rb: untabify.
+
+Sat Oct 30 21:06:37 2010 Kouhei Sutou <kou@cozmixng.org>
+
+ * lib/rexml/encoding.rb: use Ruby native encoding mechanism.
+ [ruby-dev:42464]
+ * lib/rexml/encodings/: remove.
+
+ * lib/rexml/document.rb, lib/rexml/formatters/default.rb,
+ lib/rexml/output.rb, lib/rexml/parseexception.rb,
+ lib/rexml/parsers/baseparser.rb, lib/rexml/source.rb,
+ lib/rexml/xmldecl.rb: use Ruby's native Encoding object.
+
+ * test/rexml/, test/rss/: follow the above encoding changes.
+
+ * NEWS: add REXML's incompatible change about encoding.
+
+Sat Oct 30 17:23:19 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * util.c (ruby_strtod): get rid of overflow/underflow as possible.
+
+Sat Oct 30 14:37:39 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * configure.in (ruby_pc): erase runtime-defined variables and
+ check if generated pc file is valid.
+
+ * template/ruby.pc.in (DEFFILE): need for mingw.
+
+ * template/ruby.pc.in (LIBRUBY): fix the order.
+
+Sat Oct 30 11:33:54 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * win32/Makefile.sub (ruby_pc): ignore missing variables.
+
+ * template/ruby.pc.in: add missing variables for mswin.
+
+Sat Oct 30 10:24:35 2010 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
+
+ * object.c: Make BasicObject.new accept no parameter.
+ Revert of r26135 [ruby-core:27080], as per [ruby-core:32952].
+
+Sat Oct 30 09:40:54 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * enum.c: use constants in id.h.
+
+Sat Oct 30 09:08:27 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/fiddle/closure.c (fiddle_closure): embed cif not reference
+ so that the content surely get initialized. [ruby-dev:42480]
+
+Sat Oct 30 07:01:53 2010 Tanaka Akira <akr@fsij.org>
+
+ * lib/resolv-replace.rb: suppress warning.
+
+ * lib/open-uri.rb: ditto.
+
+Sat Oct 30 06:32:52 2010 Tanaka Akira <akr@fsij.org>
+
+ * test/pathname/test_pathname.rb (TestPathname#test_grpowned?): the
+ group of the created file is inherited from the parent
+ directory on BSDs and MacOS X. Linux also inherit the group if
+ the setgid bit of the directory is set. It causes the test fail.
+ fixed by Shota Fukumori. [ruby-dev:42458]
+
+Sat Oct 30 05:58:54 2010 Tanaka Akira <akr@fsij.org>
+
+ * lib/resolv.rb: retry via TCP if UDP reply is truncated.
+ fixed by Julian Mehnle. [ruby-core:32407]
+
+Sat Oct 30 00:35:13 2010 Koichi Sasada <ko1@atdot.net>
+
+ * iseq.c (iseq_s_compile): fix optional argument.
+ a patch from Yutaka HARA [ruby-core:32953] [Ruby 1.9-Bug#4001]
+
+Sat Oct 30 00:24:42 2010 Koichi Sasada <ko1@atdot.net>
+
+ * ext/objspace/objspace.c (memsize_of): take care of
+ T_CLASS/const_tbl.
+ a patch from nagachika <nagachika00@gmail.com> [ruby-dev:42490]
+
+Fri Oct 29 23:32:36 2010 Koichi Sasada <ko1@atdot.net>
+
+ * test/profile_test_all.rb: added.
+ You can use test-all profiler with the following command:
+ RUBY_TEST_ALL_PROFILE=true make test-all
+ This command generates ./test_all_profile and you can analyze
+ which tests consume memories.
+
+ * test/runner.rb: ditto.
+
+Fri Oct 29 10:02:03 2010 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * tool/enc-unicode.rb,
+ enc/unicode/name2ctype.h, enc/unicode/name2ctype.h.blt,
+ enc/unicode/name2ctype.kwd, enc/unicode/name2ctype.src:
+ Add 'Unknown' Script.
+ patched by Run Paint Run Run. [ruby-core:32937] #3998
+
+Fri Oct 29 05:13:34 2010 Koichi Sasada <ko1@atdot.net>
+
+ * ext/objspace/objspace.c (ObjectSpace.memsize_of_all): rename
+ ObjectSpace.total_memsize_of_all_objects() to
+ ObjectSpace.memsize_of_all([klass]).
+ Accept Class object to filter the objects.
+
+ * test/objspace/test_objspace.rb: fix test for above change.
+
+Fri Oct 29 03:04:16 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * string.c (rb_str_dump): fix expected length. [ruby-core:32935]
+
+Thu Oct 28 23:31:39 2010 Koichi Sasada <ko1@atdot.net>
+
+ * gc.c (before_gc_sweep, run_final): fix decrement timing of final_num.
+
+Thu Oct 28 20:11:30 2010 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * tool/enc-unicode.rb,
+ enc/unicode/name2ctype.h, enc/unicode/name2ctype.h.blt,
+ enc/unicode/name2ctype.kwd, enc/unicode/name2ctype.src:
+ Update Oniguruma for Unicode 6.
+ patched by Run Paint Run Run. [ruby-core:32923] #3989
+
+Thu Oct 28 20:06:25 2010 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * include/ruby/oniguruma.h (ONIGENC_CTYPE_SPECIAL_MASK):
+ change mask from 128 to 256. [ruby-core:32931]
+
+Thu Oct 28 12:06:54 2010 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * lib/webrick/httprequest.rb (read_request_line): extend max
+ length to 2083. This is from Internet Explorer's max uri
+ length. http://support.microsoft.com/kb/208427 [ruby-core:32924]
+
+Thu Oct 28 04:00:08 2010 Koichi Sasada <ko1@atdot.net>
+
+ * gc.c (GC.stat): added. [ruby-dev:38607]
+
+ * test/ruby/test_gc.rb: add a test for above.
+
+Thu Oct 28 03:13:06 2010 Koichi Sasada <ko1@atdot.net>
+
+ * ext/objspace/objspace.c (memsize_of): fix rdoc.
+
+ * ext/objspace/objspace.c (total_memsize_of_all_objects): added.
+
+ * test/objspace/test_objspace.rb:
+ - add a test for ObjectSpace.total_memsize_of_all_objects.
+ - add two tests for ObjectSpace.memsize_of (for nil and Fixnum).
+
+Wed Oct 27 23:55:27 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/iconv/iconv.c (Init_iconv): warn deprecated use.
+
+Wed Oct 27 18:50:17 2010 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * bignum.c (rb_big2long, rb_big2ulong): rb2ulong() returns VALUE, but
+ its real range is ulong. So, if the size of VALUE is bigger than
+ ulong, upper bits are always zero even if the actual value is
+ negative.
+ fixed #3490
+
+Wed Oct 27 18:27:17 2010 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * test/ruby/test_io.rb (TestIO#pipe): should close write end of pipe
+ before closing read end, to get rid of timing problem.
+
+ * test/ruby/test_io_m17n.rb (TestIO_M17N#pipe): ditto.
+
+Wed Oct 27 18:14:27 2010 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * win32/win32.c (rb_w32_getppid): support Win64.
+
+Wed Oct 27 15:07:19 2010 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * thread_win32.c (w32_error): should get error no only once, because
+ the result of the second getting will indicate the error of the
+ first FormatMessage() call.
+
+Wed Oct 27 13:51:25 2010 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * test/ruby/test_io.rb (TestIO#pipe): need to propagate exceptions
+ in read/write thread. fix r29541.
+
+ * test/ruby/test_io_m17n.rb (TestIO_M17N#pipe): ditto.
+
+Wed Oct 27 12:05:40 2010 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * class.c (clone_const): need to return value. fix r29602.
+
+Wed Oct 27 11:58:58 2010 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * include/ruby/ruby.h (NUM2LONG_internal): add cast to get rid of a
+ non GCC compiler warning. this is intentional type conversion.
+
+Wed Oct 27 09:25:46 2010 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * cont.c: apply documentation patch by Run Paint Run Run.
+ [ruby-core:32915]
+
+Wed Oct 27 02:12:10 2010 Yusuke Endoh <mame@tsg.ne.jp>
+
+ * object.c (Init_Object), constant.h, variable.c
+ (rb_mod_private_constant, rb_mod_public_constant,
+ set_const_visibility, rb_const_get_0): add Module#public_constant
+ and private_constant. [ruby-dev:39685][ruby-core:32698]
+
+ * test/ruby/test_module.rb: add tests for above.
+
+Wed Oct 27 02:02:54 2010 Yusuke Endoh <mame@tsg.ne.jp>
+
+ * class.c, constant.h, gc.c, method.h, object.c, variable.c,
+ vm_insnhelper.c: use struct rb_constant_entry_t as entry of
+ RCLASS_CONST_TBL. RCLASS_CONST_TBL has contained VALUE of constant
+ directly. Now instead rb_const_entry_t is contained in
+ RCLASS_CONST_TBL, rb_const_entry_t is managed by malloc, and
+ have not only the value itself but also visibility flag.
+ This is another preparation for private constant (see
+ [ruby-dev:39685][ruby-core:32698]).
+
+Wed Oct 27 01:56:34 2010 Yusuke Endoh <mame@tsg.ne.jp>
+
+ * class.c, gc.c, object.c, variable.c, vm_insnhelper.c,
+ include/ruby/ruby.h: separate RCLASS_CONST_TBL from RCLASS_IV_TBL.
+ RCLASS_IV_TBL has contained not only instance variable table but
+ also constant table. Now the two table are separated to
+ RCLASS_CONST_TBL and RCLASS_IV_TBL. This is a preparation for
+ private constant (see [ruby-dev:39685][ruby-core:32698]).
+
+Tue Oct 26 18:51:00 2010 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * lib/scanf.rb (extract_float): allow 2.e+2 style.
+ [ruby-dev:42452] #3978
+
+Tue Oct 26 18:09:36 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * Makefile.in (ASFLAGS): needs INCFLAGS.
+
+ * configure.in (rb_cv_dynamic_alloca): check if extra source for
+ dynamic size alloca.
+
+ * missing/x86_64-chkstk.s (___chkstk): necessary for alloca of
+ amd64-mingw32msvc-gcc on Ubuntu.
+
+ * thread_win32.c (ruby_alloca_chkstk): check stack overflow
+
+Tue Oct 26 18:04:53 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * template/ruby.pc.in (Libs): needs DLDFLAGS.
+
+Tue Oct 26 12:47:10 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * common.mk (pkgconfig-data): moved from Makefile.in.
+
+ * tool/rbinstall.rb: install pc file only if non-empty.
+ [ruby-core:32901] #3983
+
+ * win32/Makefile.sub (ruby_pc): create pc file.
+
+Tue Oct 26 09:13:34 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * configure.in (rb_cv_gcc_atomic_builtins): check for atomic
+ builtins, all are not available in Apple derivative gcc.
+
+Tue Oct 26 00:29:26 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * Makefile.in (pkgconfig-data): create pkg-config metadata file.
+
+ * tool/rbinstall.rb: install pkg-config metadata file.
+
+ * template/ruby.pc.in: template of pkg-config metadata file.
+
+Mon Oct 25 16:38:07 2010 URABE Shyouhei <shyouhei@ruby-lang.org>
+
+ * signal.c (rb_atomic_t): GCC (of at least recent versions)
+ has ubiquitous support for atomic operations. On that
+ compiler a C program can issue a memory barrier using these
+ dedicated instructions. According to the GCC manual they
+ cargo culted this feature form the Itanium ABI so chances
+ are that other compilers could also support this feature.
+ But so far GCC is the only compiler that I know to have it.
+ Also note that this works on non-Itanium machines.
+
+Mon Oct 25 06:21:35 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * vsnprintf.c (BSD_vfprintf): prec digits fractal part should be
+ appended to 0 if prec is given. [ruby-dev:42453] #3979
+
+Mon Oct 25 02:57:21 2010 Koichi Sasada <ko1@atdot.net>
+
+ * common.mk (run.gdb): Quit gdb on 'make gdb' when
+ no signals are received.
+
+Mon Oct 25 00:25:23 2010 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * lib/date.rb: some corrections of documentation.
+
+Sun Oct 24 17:14:00 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * array.c, gc.c, hash.c, object.c, string.c, struct.c,
+ transcode.c, variable.c, vm.c, vm_insnhelper.c, vm_method.c:
+ replace calls to rb_error_frozen() with rb_check_frozen(). a
+ patch from Run Paint Run Run at [ruby-core:32014]
+
+ * include/ruby/intern.h (rb_check_frozen): optimize.
+ [ruby-core:32878]
+
+Sun Oct 24 15:16:30 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/test/unit.rb (Test::Unit::Mini#run): abort if interrupted.
+
+ * lib/test/unit.rb (Test::Unit::Mini#run_test_suites): show the
+ result even when interrupted on the way.
+
+ * lib/test/unit.rb (Test::Unit::Mini#run_test_suites): ensure
+ output sync mode to be restored.
+
+Sun Oct 24 14:11:16 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * vm.c (vm_define_method): defined method is run with the default
+ public visibility regardless the visibility context of definition.
+ [ruby-core:30638]
+
+Sun Oct 24 12:08:54 2010 Aaron Patterson <aaron@tenderlovemaking.com>
+
+ * lib/test/unit.rb: make test/unit play nicely with the rake test
+ loader. [ruby-core:32864]
+
+Sun Oct 24 00:25:13 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * test/ruby/test_rubyoptions.rb (test_segv_test): follow up the
+ change at r29556.
+
+Sat Oct 23 14:39:58 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/mkmf.rb: $extmk should be true for test/runner.
+
+Sat Oct 23 10:55:37 2010 Koichi Sasada <ko1@atdot.net>
+
+ * vm_dump.c (rb_vm_bugreport): fix to add bug outputs.
+ - loaded script ($0)
+ - loaded features ($")
+ - process memory map on Linux (/proc/self/maps)
+
+ * vm_dump.c (rb_vmdebug_stack_dump_raw): fix header message.
+
+Fri Oct 22 14:50:13 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/test/unit/assertions.rb (Test::Unit::Assertions#assert):
+ assertion message must not be nil.
+
+Fri Oct 22 13:59:50 2010 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * lib/test/unit/assertions.rb (Test::Unit::Assertions#assert):
+ treat nil case. Please run test-all before commit such change.
+
+Thu Oct 21 23:58:14 2010 Koichi Sasada <ko1@atdot.net>
+
+ * gc.c (gc_lazy_sweep): Variable declarations should be at
+ the head of block.
+
+Thu Oct 21 23:56:54 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * gc.c (objspace_each_objects, rb_objspace_each_objects): use
+ struct.
+
+ * gc.c (objspace_each_objects): fix return with no value.
+
+Thu Oct 21 23:47:12 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * dir.c (dir_initialize): remove useless intermediate variable.
+
+Thu Oct 21 16:07:20 2010 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * io.c (rb_f_select): change rdoc.
+ patched by Eito Katagiri [ruby-core:31805]
+
+Thu Oct 21 15:55:21 2010 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * lib/webrick/httpauth/digestauth.rb
+ (WEBrick::HTTPAuth::ProxyDigestAuth#check_uri): privated.
+ [ruby-dev:42344]
+
+Thu Oct 21 15:50:25 2010 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * io.c (rb_f_select): add correct rdoc.
+ patched by Dave Thomas [ruby-core:32467]
+
+Thu Oct 21 15:42:01 2010 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * lib/net/telnet.rb (Net::Telnet#close): added.
+ patched by Erik Hollensbe [ruby-dev:42260] #3830
+
+Thu Oct 21 13:08:00 2010 Narihiro Nakamura <authornari@gmail.com>
+
+ * gc.c (rb_objspace_each_objects): don't lazy sweep in
+ rb_objspace_each_objects. [Bug #3940] [ruby-dev:42369]
+
+Thu Oct 21 00:05:45 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * test/ruby/test_io.rb (TestIO#pipe): get rid of deadlock on pipe.
+ a patch from Tomoyuki Chikanaga at [ruby-dev:42435]. #3970
+
+ * test/ruby/test_io_m17n.rb (TestIO_M17N#pipe): ditto.
+
+Wed Oct 20 23:54:36 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/dbm/dbm.c: rdoc based on a patch by mathew meta AT
+ pobox.com, at [ruby-core:32853].
+
+Wed Oct 20 10:47:21 2010 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * util.c (ruby_strtod): reject 0x1.p+0. [ruby-dev:42432] #3966
+
+Wed Oct 20 10:00:57 2010 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * vsnprintf.c (BSD_vfprintf): print floating point on "%#a".
+ [ruby-dev:42431] Bug#3965
+
+Tue Oct 19 19:30:11 2010 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * vsnprintf.c (BSD_vfprintf): clear ALT flag for %a.
+ [ruby-core:32841] [ruby-core:32848]
+
+Tue Oct 19 12:19:25 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * vsnprintf.c (BSD_vfprintf): fix over-count of field size.
+
+Tue Oct 19 03:08:52 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * vsnprintf.c (BSD_vfprintf): use HEXPREFIX flag for prefix of %a.
+ [ruby-core:32841]
+
+Mon Oct 18 13:18:01 2010 Akinori MUSHA <knu@iDaemons.org>
+
+ * ext/digest/digest.c (rb_digest_class_init): Define
+ Digest::Class.new(). [Feature #3954]
+
+Mon Oct 18 12:58:40 2010 Tanaka Akira <akr@fsij.org>
+
+ * pack.c (pack_pack): refine the document. [ruby-dev:42397]
+ (pack_unpack): ditto.
+
+Mon Oct 18 10:19:00 2010 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * lib/net/http.rb (transport_request): @socket may be nil.
+ patched by Egbert Eich [ruby-core:32829]
+
+Mon Oct 18 09:57:28 2010 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * sprintf.c (BSD_vfprintf): wrong padding around prefix and
+ floating point with %a. [ruby-dev:42403] Bug #3956
+
+Sun Oct 17 22:36:33 2010 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * lib/date/delta.rb: added an rdoc tag.
+
+Sun Oct 17 10:47:12 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * variable.c (rb_mod_remove_const): update rdoc.
+ [ruby-core:31957]
+
+Sun Oct 17 10:40:17 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * class.c (rb_define_{class,module}_id_under): register to be
+ marked, which probably are defined and used internally.
+
+Sat Oct 16 11:10:55 2010 Masaki Suketa <masaki.suketa@nifty.ne.jp>
+
+ * ext/win32ole/win32ole.c (ole_encoding2cp): set codepage 20936
+ according to GB2312. [Bug #3937] [ruby-core:32758]
+
+Sat Oct 16 10:54:57 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * Makefile.in (CPP): already used in .c.i rule.
+
+ * cygwin/GNUmakefile.in (DLLWRAP, WINDRES): add --driver-name and
+ --preprocessor options explicitly. [ruby-core:32776]
+
+Sat Oct 16 10:06:08 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/sdbm/_sdbm.c (SEEDUPS, BADMESS): make settable using command
+ line options.
+
+ * ext/sdbm/_sdbm.c (makroom): suppress unused result warning.
+
+ * ext/sdbm/extconf.rb: disable BADMESS, a library should not emit
+ messages directly.
+
+Sat Oct 16 08:39:03 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * dln.c (dln_strerror): get English message first, instead of
+ system default. see [ruby-dev:42358].
+
+Sat Oct 16 00:08:00 2010 Koichi Sasada <ko1@atdot.net>
+
+ * hash.c (rb_hash_aref): skip calling "default" method
+ if it is not needed, for speed-up.
+
+Fri Oct 15 23:36:25 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * file.c (NUM2DEVT, DEVT2NUM, PRI_DEVT_PREFIX): fallback to
+ unsigned int.
+
+Fri Oct 15 22:54:46 2010 Masaki Suketa <masaki.suketa@nifty.ne.jp>
+
+ * ext/win32ole/win32ole.c (ole_hresult2msg): get English message first,
+ instead of system default. [ruby-core:32765]
+
+Fri Oct 15 22:47:31 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * include/ruby/ruby.h (VALUE): prefer long over uintptr_t,
+ FIX2LONG expects VALUE to be long at least.
+
+ * include/ruby/ruby.h (FIX2LONG): parenthesize the argument.
+
+Fri Oct 15 20:30:30 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * configure.in (dev_t): use RUBY_REPLACE_TYPE.
+
+ * file.c (rb_stat_inspect): use PRI_DEVT_PREFIX.
+
+Fri Oct 15 17:26:57 2010 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * pack.c (pack_pack): simplify comparison of explicit_endian
+ as pointed by nobu.
+
+ * pack.c (pack_unpack): ditto.
+
+Fri Oct 15 16:40:37 2010 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * pack.c (pack_pack): fix more than one modifiers appear in the
+ format string. [ruby-core:32793]
+
+ * pack.c (pack_unpack): ditto.
+
+Thu Oct 14 23:20:42 2010 Masaki Suketa <masaki.suketa@nifty.ne.jp>
+
+ * test/win32ole/test_folderitem2_invokeverb.rb: refactoring.
+
+Thu Oct 14 22:18:29 2010 Koichi Sasada <ko1@atdot.net>
+
+ * insns.def, iseq.c, vm_insnhelper.c: rename variable name
+ (ip -> iseq).
+
+Thu Oct 14 20:41:27 2010 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * pack.c (pack_pack): support endian modifiers: < and >.
+ [ruby-dev:42376] Feature #3491
+
+ * pack.c (pack_unpack): ditto.
+
+Thu Oct 14 20:50:51 2010 Masaki Suketa <masaki.suketa@nifty.ne.jp>
+
+ * ext/win32ole/win32ole.c (reg_get_val): expand environment in
+ the pathname. [Bug #3907]
+
+Thu Oct 14 07:35:07 2010 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * file.c (DEVT2NUM): added. Size of dev_t is depend on the
+ environment even if POSIX defines dev_t as unsigned integer.
+ For example, OpenVMS, 64bit Solaris 9, and NetBSD 6 defines
+ dev_t as 64bit unsigned integer.
+
+ * file.c (rb_stat_dev): use DEVT2NUM.
+
+ * file.c (rb_stat_dev_major): dev_t is not long. major(3)'s return
+ value is int.
+
+ * file.c (rb_stat_dev_minor): dev_t is not long. minor(3)'s return
+ value is int.
+
+ * configure.in: check size of dev_t.
+
+Thu Oct 14 07:22:12 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * array.c (rb_ary_and, rb_ary_or), class.c (rb_mod_init_copy),
+ gc.c (undefine_final), time.c (time_mload): get rid of
+ type-punning casts.
+
+Thu Oct 14 04:16:41 2010 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * numeric.c (ruby_float_step): fix Numeric#step with infinity unit
+ doesn't works well. [ruby-core:32779]
+
+Wed Oct 13 23:16:46 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * tool/enc-unicode.rb: get rid of lots of warnings.
+
+ * iseq.c (insn_operand_intern, rb_iseq_disasm): fix format specifiers.
+
+ * vm.c (thread_free): ditto.
+
+ * numeric.c (check_uint): get rid of overflow on LLP64 platforms.
+
+ * insns.def (opt_case_dispatch): use st_data_t.
+
+Wed Oct 13 22:32:34 2010 Takeyuki FUJIOKA <xibbar@ruby-lang.org>
+
+ * lib/cgi/util.rb (CGI::unescape): bugfix to unescape the multibyte
+ string. Thanks nobu and tDiary dev members. [Bug #3909]
+
+Wed Oct 13 21:13:00 2010 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * numeric.c (int_chr): raise error when the value is negative.
+
+Wed Oct 13 19:24:08 2010 URABE Shyouhei <shyouhei@ruby-lang.org>
+
+ * vm.c (ruby_vm_destruct): This function type was wrong; correct to the prototype.
+
+Wed Oct 13 14:58:09 2010 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * numeric.c (rb_num_to_uint): fix 32bit logic.
+
+Wed Oct 13 12:53:43 2010 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * numeric.c (rb_num_to_uint): added to check the range of arguments.
+ Mainly for negative value with NUM2UINT on 32bit environment.
+
+ * string.c (rb_str_concat): use rb_num_to_uint.
+
+Wed Oct 13 12:10:02 2010 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * thread_win32.c (w32_error): get English message first, instead
+ of system default. see [ruby-core:32765].
+ [experimental]
+
+Wed Oct 13 11:04:03 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * debug.c (ruby_set_debug_option): define always for binary
+ compatibility with debug env enabled binary.
+
+ * signal.c (ruby_enable_coredump): ditto.
+
+Wed Oct 13 10:52:51 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * include/ruby/ruby.h (ruby_executable_node): missing prototype.
+
+Wed Oct 13 05:23:04 2010 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * missing/strchr.c: add strlen's prototype.
+
+ * missing/strstr.c: ditto.
+
+Wed Oct 13 00:21:17 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/syck/rubyext.c (struct mktime_arg): constified.
+
+ * ext/syck/rubyext.c (mktime_do, mktime_r, rb_syck_mktime): fix
+ function signatures.
+
+Wed Oct 13 00:18:18 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * st.c (MurmurMagic): get rid of literal overflow.
+
+ * configure.in (RUBY_CHECK_PRINTF_PREFIX): check for printf format
+ specifier if possible.
+
+Tue Oct 12 23:58:19 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * win32/win32.c (rb_w32_open_osfhandle, rb_w32_wopen, rb_w32_pipe):
+ use uintptr_t instead of long for win64.
+
+ * win32/win32.c (socketpair_internal): suppress warnings.
+
+ * win32/win32.c (ftruncate): use HANDLE instead of long for win64.
+
+ * vsnprintf.c (BSD_vfprintf): fix cast.
+
+ * numeric.c (rb_num2fix): result of rb_num2long is SIGNED_VALUE.
+
+ * compile.c (iseq_build_body), error.c (set_syserr, get_syserr),
+ (syserr_initialize), gc.c (define_final, rb_gc_copy_finalizer),
+ (run_final), hash.c (rb_hash_aref, rb_hash_lookup2),
+ (rb_hash_fetch_m, rb_hash_clear, rb_hash_aset, eql_i),
+ iseq.c (iseq_load, iseq_data_to_ary), marshal.c (r_symlink),
+ thread.c (rb_thread_local_aref),
+ variable.c (generic_ivar_remove, ivar_get, rb_const_get_0),
+ (rb_cvar_get), vm.c (rb_vm_check_redefinition_opt_method),
+ vm_insnhelper.c (vm_get_ev_const), vm_method.c (remove_method),
+ ext/iconv/iconv.c (map_charset): use st_data_t.
+
+ * compile.c (iseq_build_body), insns.def (getglobal, setglobal),
+ iseq.c (iseq_load, iseq_data_to_ary), util.c (valid_filename):
+ use VALUE.
+
+ * gc.c (obj_free, rb_objspace_call_finalizer): fix truncating
+ cast.
+
+ * gc.c (mark_current_machine_context): suppress warnings.
+
+ * compile.c (iseq_compile_each): fix truncating cast.
+
+ * cont.c (fiber_setcontext): missing variable definition.
+
+Tue Oct 12 19:25:13 2010 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * error.c (exc_to_s): use OBJ_INFECT.
+
+ * error.c (name_err_to_s): ditto.
+
+ * error.c (name_err_mesg_to_str): ditto.
+
+ * error.c (syserr_initialize): ditto.
+
+Tue Oct 12 19:07:55 2010 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * error.c (syserr_initialize): taint message if mesg is given
+ and it is tainted.
+
+Tue Oct 12 18:25:43 2010 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * io.c (rb_io_ungetc): always see Bignum. On 32bit valid value
+ may be a Bignum. On 64bit for errors. [ruby-dev:42366]
+
+Tue Oct 12 18:25:04 2010 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * string.c (rb_str_concat): use unsigned int for GB18030.
+
+Tue Oct 12 17:53:49 2010 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * numeric (check_uint): the mask must refer to VALUE.
+
+Tue Oct 12 17:47:10 2010 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * numeric (check_uint): set MSB for negative value.
+
+ * numeric (rb_num2uint): return value's type of rb_num2ulong
+ is VALUE.
+
+ * numeric (int_chr): variable i can't be negative.
+
+Tue Oct 12 16:04:37 2010 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * win32/win32.c (rb_w32_strerror): get English message first, instead
+ of system default. see [ruby-dev:42358].
+ [experimental]
+
+Tue Oct 12 15:52:35 2010 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * win32/win32.c (rb_w32_strerror): unmap some range of errno for
+ workaround of VC10's strerror() and sys_nerr problem.
+ based on a patch from Akio Tajima, [ruby-dev:42355].
+
+Tue Oct 12 15:36:09 2010 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * io.c (rb_io_ungetc): use unsigned int for GB18030.
+
+Tue Oct 12 15:14:21 2010 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * io.c (rb_io_putc): support multibyte characters.
+ [ruby-core:30697]
+
+Tue Oct 12 15:10:31 2010 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * numeric.c (rb_enc_uint_chr): split from int_chr.
+
+ * numeric.c (int_chr): use rb_enc_uint_chr.
+
+ * include/ruby/encoding.h (rb_enc_uint_chr): added.
+
+Tue Oct 12 14:04:41 2010 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * numeric.c (int_chr): a codepoint of Ruby M17N must be 32bit
+ unsigned int; GB18030 uses MSB. Also note that OnigCodePoint
+ is defined as unsigned int.
+
+Tue Oct 12 12:20:54 2010 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * vm_dump.c (dump_thread): foolish mistake.
+
+Tue Oct 12 10:39:08 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * configure.in (RUBY_MINGW32): canonicalize only on mingw.
+
+Mon Oct 11 20:20:23 2010 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * lib/net/http.rb (HTTP.get): specify ASCII-8BIT as the result
+ encoding of Zlib::GzipReader.
+ http://hibari.2ch.net/test/read.cgi/tech/1281473294/271
+
+Mon Oct 11 17:42:54 2010 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * error.c (syserr_initialize): use mesg's encoding when locale
+ encoding is US-ASCII. If locale encoding is not US-ASCII,
+ assume err has non ASCII characters. [ruby-dev:42358]
+
+Mon Oct 11 14:03:54 2010 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * error.c (syserr_initialize): set the encoding of Errno::*#message
+ as locale. [ruby-dev:42358]
+
+Mon Oct 11 06:38:27 2010 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * ext/stringio/stringio.c (strio_set_encoding):
+ StringIO#set_encoding can get 2nd argument and optional hash
+ for API compatibility to IO. [ruby-dev:42356]
+
+Mon Oct 11 06:11:30 2010 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * io.c (rb_io_set_encoding): use rb_funcall2 when the io is not
+ a T_FILE. [ruby-dev:42356]
+
+Sun Oct 10 18:42:23 2010 Akinori MUSHA <knu@iDaemons.org>
+
+ * lib/set.rb (Set#replace): Apply a bit of optimization.
+
+Sun Oct 10 10:20:07 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * configure.in (RUBY_MINGW32): canonicalize as like mswin version.
+
+Sun Oct 10 05:33:14 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * vm_core.h (rb_signal_buff_size, rb_signal_exec): moved
+ declarations from thread.c.
+
+Sat Oct 9 16:54:28 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * configure.in (RSHIFT): quote to get rid of argument expansion
+ for autoconf 2.68.
+
+Sat Oct 9 11:00:06 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * thread.c (thread_reset_event_flags, exec_event_hooks): ignore
+ hooks marked as removed.
+
+ * thread.c (thread_exec_event_hooks): remove hooks to be removed.
+
+ * thread.c (rb_threadptr_remove_event_hook, rb_remove_event_hook):
+ defer removing hooks if running the hooks. [ruby-dev:42350]
+
+Sat Oct 9 10:51:00 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * thread.c (rb_threadptr_exec_event_hooks): suppress each event
+ hooks separately.
+
+ * thread.c (thread_suppress_tracing): split from
+ ruby_suppress_tracing, accepting thread pointer and event mask.
+
+Sat Oct 9 08:16:01 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * thread.c (rb_threadptr_remove_event_hook): fix typo.
+
+Fri Oct 8 10:52:25 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * common.mk (RBCONFIG): depends on version.h due to
+ RUBY_PATCHLEVEL. [ruby-core:32709]
+
+Fri Oct 8 00:24:54 2010 James Edward Gray II <jeg2@ruby-lang.org>
+
+ * lib/csv.rb: Fixing documentation typos. [ruby-core:32712]
+
+Thu Oct 7 09:14:28 2010 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * vm_exec.c (vm_exec_core): Treat clang as non gcc on this
+ context: It has __asm__ but doesn't works well.
+
+Wed Oct 6 12:28:22 2010 Tanaka Akira <akr@fsij.org>
+
+ * lib/uri/generic.rb (URI::Generic#hostname): new method.
+ (URI::Generic#hostname=): ditto.
+
+ * lib/open-uri.rb: use URI#hostname
+
+ * lib/net/http.rb: ditto.
+
+ reported by Adam Majer. [ruby-core:32056]
+
+Wed Oct 6 11:52:12 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * io.c (fptr_finalize): write_mutex might have been destroyed
+ already in finalization phase, as the order of finalizers is not
+ guaranteed. rb_mutex_t should be used in place of Mutex object
+ in the future.
+
+Tue Oct 5 22:17:02 2010 wanabe <s.wanabe@gmail.com>
+
+ * win32/mkexports.rb: revert r29320 and r29402.
+
+Mon Oct 4 12:43:47 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * parse.y (regexp): dregexp has literal string only at the head
+ and successors are array. [ruby-core:32682]
+
+Mon Oct 4 10:22:21 2010 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * random.c (rand_init): This checks the value is in 32bit or not,
+ so use int32_t, not int.
+
+Mon Oct 4 09:47:39 2010 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * random.c (rand_init): remove useless assignment.
+
+ * re.c (update_char_offset): remove unused variable.
+
+ * re.c (read_escaped_byte): ditto.
+
+Mon Oct 4 09:30:42 2010 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * ext/openssl/lib/openssl/bn.rb (Integer#to_bn): OpenSSL::BN.new
+ accepts only Strings, so call Integer#to_s(16).
+ 16 is for an optimization. [ruby-dev:42336]
+
+Mon Oct 4 07:57:51 2010 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * cont.c (fiber_memsize): Return size.
+ Before this change, fiber_memsize always returns 0.
+
+Mon Oct 4 07:16:55 2010 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * enc/unicode.c (onigenc_unicode_property_name_to_ctype):
+ remove useless assignment.
+
+ * vm.c (vm_make_proc_from_block): ditto.
+
+ * variable.c (rb_ivar_count): ditto.
+
+Mon Oct 4 06:40:24 2010 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * Makefile.in (clean-rdoc): Don't use \ in variable expansion.
+ BSD make treats it as an escape character.
+
+Mon Oct 4 00:01:53 2010 wanabe <s.wanabe@gmail.com>
+
+ * tool/config.sub: revert r29320, r29324, r29347, r29354, r29365
+ to automake-1.11.1. [ruby-core:32634]
+
+ * win32/mkexports.rb: no longer use 'mingw64'. a patch from Luis Lavena
+ at [ruby-core:32678].
+
+Sun Oct 3 20:36:37 2010 Akio Tajima (arton) <artonx@yahoo.co.jp>
+
+ * test/win32ole/test_folderitem2_invokeverb.rb: Change creating
+ shortcut verb to 'Link' [Bug #3339]
+
+Sun Oct 3 19:44:23 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * configure.in (Makefile): get rid of duplicated ruby target when
+ already there it was.
+
+Sat Oct 2 22:59:32 2010 Masaki Suketa <masaki.suketa@nifty.ne.jp>
+
+ * test/win32ole/test_thread.rb: add for win32ole with Thread.
+
+Fri Oct 1 17:03:00 2010 URABE Shyouhei <shyouhei@ruby-lang.org>
+
+ * test/webrick/test_httpproxy.rb (TestWEBrickHTTPProxy::test_upstream_proxy):
+ My machine fails this test at this line, saying 503 service unavailable.
+
+Thu Sep 30 16:11:08 2010 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * win32/win32.c (rb_w32_getenv): should return NULL if specified name
+ is empty. a patch from Heesob Park at [ruby-core:32650]
+
+Thu Sep 30 15:18:23 2010 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * parse.y (command_asgn): allow command_call to be right hand side
+ expression of chained assignment. [ruby-dev:42313]
+
+Thu Sep 30 10:55:38 2010 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * hash.c (ruby_setenv): workaround for old Windows. a patch from
+ Heesob Park. [ruby-core:32353]
+
+Thu Sep 30 09:29:06 2010 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * lib/uri/common.rb (URI.encode_www_form): change treatment of
+ undefined value in given array as latest internet draft for
+ application/www-form-urlencoded.
+ http://tools.ietf.org/html/draft-hoehrmann-urlencoded-01
+
+Thu Sep 30 09:34:03 2010 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * vm_dump.c (dump_thread): fixed wrong type of return value of
+ SymGetModuleBase64(). [ruby-dev:42306]
+
+Wed Sep 29 21:04:05 2010 URABE Shyouhei <shyouhei@ruby-lang.org>
+
+ * test/ruby/test_rubyoptions.rb (TestRubyOptions::test_script_from_stdin):
+ As usual, PTY is not always available.
+
+Wed Sep 29 18:38:14 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * tool/config.sub (x64): regularize only for pc vendor, and strip
+ useless 64 suffix.
+
+Wed Sep 29 17:53:02 2010 Kenta Murata <mrkn@mrkn.jp>
+
+ * ext/bigdecimal/bigdecimal.c (BIGDECIMAL_ENABLE_VPRINT):
+ VPrint is usually disabled. It's only used in debugging.
+
+Wed Sep 29 17:41:34 2010 Kenta Murata <mrkn@mrkn.jp>
+
+ * ext/bigdecimal/bigdecimal.c (BigDecimal_save_limit):
+ return the result of a block.
+
+ * test/bigdecimal/test_bigdecimal.rb (test_save_limit):
+ add a test for the above change.
+
+Wed Sep 29 16:18:03 2010 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * vm_dump.c (dump_thread): remove unused optional arguments.
+
+Wed Sep 29 13:26:30 2010 Kenta Murata <mrkn@mrkn.jp>
+
+ * ext/bigdecimal/bigdecimal.c (BigDecimal_save_rounding_mode):
+ return the result of a block.
+
+ * test/bigdecimal/test_bigdecimal.rb (test_save_rounding_mode):
+ add a test for the above change.
+
+ * test/bigdecimal/test_bigdecimal.rb (test_save_exception_mode):
+ add a test for the return value of BigDecimal.save_exception_mode.
+
+Wed Sep 29 12:45:30 2010 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * ext/bigdecimal/bigdecimal.c (BigDecimal_div2, BigDecimal_add2,
+ BigDecimal_sub2, BigDecimal_mult2, VpLimitRound): remove meaningless
+ casts to get rid of compiler warnings.
+
+Wed Sep 29 12:35:13 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/bigdecimal/bigdecimal.c (VPrint, VpToString): fix format.
+
+Wed Sep 29 12:31:12 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/rdoc/known_classes.rb (RDoc::KNOWN_CLASSES): add Encoding.
+
+Tue Sep 28 20:50:23 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * tool/config.sub (x64): regularize same as mswin.
+
+Tue Sep 28 20:06:14 2010 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * vm_dump.c (rb_vm_bugreport): add windows support.
+ based on patches from Peter Weldon at [ruby-core:32551]
+
+Mon Sep 27 23:30:34 2010 Koichi Sasada <ko1@atdot.net>
+
+ * insns.def (opt_case_dispatch), vm_insnhelper.c:
+ execute the procedures of "when" clauses by bytecode
+ instead of st_foreach() when the object does not hit
+ prepared hash. [ruby-dev:42304]
+
+Mon Sep 27 15:54:03 2010 URABE Shyouhei <shyouhei@ruby-lang.org>
+
+ * test/net/http/test_https.rb: As always, localhost is not
+ guaranteed to be resolved as 127.0.0.1. But a SSL
+ certificate needs a socket to listen on a specific address
+ where a CN resolves to. On situations where localhost is
+ not 127.0.0.1, these tests are not possible.
+
+Mon Sep 27 15:25:05 2010 URABE Shyouhei <shyouhei@ruby-lang.org>
+
+ * test/net/imap/test_imap.rb: resurrection of r29259.
+ this change depends on minitest 1.7.1.
+
+ * lib/test/unit/assertions.rb: ditto.
+
+Sun Sep 26 22:59:45 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * tool/config.sub (x86_64-pc-mingw64): regularize.
+
+Sun Sep 26 22:21:07 2010 wanabe <s.wanabe@gmail.com>
+
+ * ext/openssl/ossl_hmac.c (ossl_hmac_hexdigest, ossl_hmac_s_hexdigest),
+ ext/openssl/ossl_pkey_ec.c (ossl_ec_group_set_seed),
+ ext/openssl/ossl_ssl_session.c (ossl_ssl_session_to_der),
+ ext/openssl/ossl_pkcs7.c (numberof): suppress warnings.
+ [ruby-core:31932]
+
+Sun Sep 26 10:25:24 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * tool/config.{guess,sub}: updated to automake-1.11.1.
+
+Sat Sep 25 22:48:30 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * configure.in (LIBRUBY_DLDFLAGS): fix quoting.
+
+Sat Sep 25 10:30:37 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * configure.in (LIBRUBY_DLDFLAGS): use -unexported_symbol only
+ when available. http://trac.macports.org/ticket/26341
+
+Sat Sep 25 10:05:49 2010 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * configure.in: Always add -mieee for Renesas SH4.
+ Thanks, Nobuhiro Iwamatsu. [Feature #3874] [ruby-core:32548]
+
+Sat Sep 25 01:34:41 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * Makefile.in (install-cross): target to install cross-compiling
+ stuff.
+
+Fri Sep 24 23:44:59 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * string.c (sym_call), vm.c (invoke_block_from_c),
+ vm_insnhelper.c (vm_yield_with_cfunc): pass given block.
+ [ruby-core:32075]
+
+ * vm_eval.c (rb_funcall_passing_block): new function to call
+ method with passing given block.
+
+Fri Sep 24 15:50:43 2010 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * string.c (rb_str_to_i): fix rdoc: String#to_i raises an
+ exception when base is invalid. [ruby-core:31685]
+
+Fri Sep 24 15:28:35 2010 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * string.c (rb_str_rindex): use rb_enc_prev_char instead of repeated
+ str_nth.
+ patched by Michael Selig [ruby-core:32498]
+
+Fri Sep 24 14:19:12 2010 URABE Shyouhei <shyouhei@ruby-lang.org>
+
+ * test/test_pty.rb: Same as 229281; existence of PTY class do not
+ guarantee a successful pty operation.
+
+Fri Sep 24 06:25:55 2010 Ryan Davis <ryand-ruby@zenspider.com>
+
+ * lib/minitest/*.rb: Imported minitest 1.7.2 r5879.
+ * test/minitest/*.rb: ditto.
+
+Thu Sep 23 23:09:08 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * vm_insnhelper.c (vm_get_cref0): cref is stacked only in normal
+ iseqs, so check if it is the case first.
+
+Thu Sep 23 23:08:41 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * tool/config.sub: mingw64 should use x86_64. [ruby-core:32514]
+
+Thu Sep 23 21:40:40 2010 wanabe <s.wanabe@gmail.com>
+
+ * ext/socket/raddrinfo.c (init_addrinfo, inspect_sockaddr): suppress
+ warnings. see [ruby-core:31932].
+
+Thu Sep 23 19:27:57 2010 wanabe <s.wanabe@gmail.com>
+
+ * thread_win32.c (w32_wait_events, w32_close_handle): suppress warnings.
+ see [ruby-core:31932].
+
+Thu Sep 23 18:54:39 2010 wanabe <s.wanabe@gmail.com>
+
+ * tool/config.sub: add mingw64.
+
+ * win32/mkexports.rb (Exports::Mingw64): added.
+
+ * win32/mkexports.rb (Exports::Mingw32): renamed from Exports::Mingw.
+
+Thu Sep 23 09:01:28 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * vm_insnhelper.c (vm_cref_push): no outer cref is needed for proc
+ from method. Bug #3786, Bug #3860, [ruby-core:32501]
+
+Wed Sep 22 17:12:01 2010 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
+
+ * test/openssl/utils.rb (OpenSSL#silent): always restore $VERBOSE.
+ [ruby-dev:42285]
+
+Wed Sep 22 16:59:40 2010 Yuki Sonoda (Yugui) <yugui@yugui.jp>
+
+ * test/test_prime.rb (TestPrime#test_new): the warning expected have
+ not been displayed when $VERBOSE == nil. Patch by Shota Fukumori
+ a.k.a. sora_h. [ruby-dev:42272]
+ Recovers $stderr even if StringIO.new fails. Reported by unak.
+
+Wed Sep 22 01:55:48 2010 Koichi Sasada <ko1@atdot.net>
+
+ * bootstraptest/test_method.rb: fix last commit.
+
+Wed Sep 22 01:49:52 2010 Koichi Sasada <ko1@atdot.net>
+
+ * bootstraptest/test_method.rb: add a test for [ruby-core:30534].
+
+Wed Sep 22 00:52:44 2010 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * lib/rdoc/ri/store.rb (save_cache): remove duplicate entries.
+
+Wed Sep 22 00:00:05 2010 Tanaka Akira <akr@fsij.org>
+
+ * ext/pathname/pathname.c (path_f_pathname): Pathname() translated
+ from pathname.rb.
+
+Tue Sep 21 22:18:30 2010 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * tool/mkconfig.rb: fixed build problem on mswin64 introduced in r29278.
+
+Tue Sep 21 02:42:35 2010 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
+
+ * test/pathname/test_pathname.rb (TestPathname#test_mkdir): fix typo.
+
+Mon Sep 20 23:23:05 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * dir.c (bracket): get rid of scanning at the end of the pattern
+ string, not to raise an exception while globbing command line.
+ [ruby-core:32478]
+
+Mon Sep 20 11:25:49 2010 Tanaka Akira <akr@fsij.org>
+
+ * ext/pathname/pathname.c (Init_pathname): Pathname#=~ undefinition
+ translated from pathname.rb.
+
+Mon Sep 20 02:34:11 2010 Kenta Murata <mrkn@mrkn.jp>
+
+ * ext/bigdecimal/bigdecimal.c (check_rounding_mode, BigDecimal_mode):
+ raise ArgumentError instead of TypeError passing invalid modes.
+
+ * test/bigdecimal/test_bigdecimal.rb (test_mode, test_round):
+ change against the above modifications.
+
+Sun Sep 19 22:08:39 2010 Yuki Sonoda (Yugui) <yugui@yugui.jp>
+
+ * lib/mkmf.rb (try_link): rdoc
+ (try_compile): ditto
+ (try_cpp): ditto
+ (try_func): ditto
+ (try_var): ditto
+ (try_run): ditto
+ (egrep_cpp): ditto
+
+Sun Sep 19 20:43:33 2010 Yuki Sonoda (Yugui) <yugui@yugui.jp>
+
+ * configure.in (--disable-install-doc): disables capi too, in addition
+ to rdoc.
+ (--disable-install-rdoc): a new option for disabling only rdoc.
+ (--disable-install-capi): a new option for disabling only capi.
+
+Sun Sep 19 20:37:45 2010 Yuki Sonoda (Yugui) <yugui@yugui.jp>
+
+ * common.mk (clean): removes all documents on cleaning.o
+ (CAPIOUT): new variable.
+ (clean-capi, distclean-capi, realclean-capi): new targets
+
+ * Makefile.in (clean-capi, distclean-capi, realclean-capi): ditto.
+
+ * win32/Makefile.sub (clean-capi, distclean-capi, realclean-capi):
+ ditto.
+
+Sun Sep 19 13:44:24 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * configure.in (LIBRUBY_SO): fix an oversight of replace
+ RUBY_INSTALL_NAME with RUBY_SO_NAME. a patch from Jeremy Evans
+ at [ruby-core:32474].
+
+Sun Sep 19 07:48:20 2010 Tanaka Akira <akr@fsij.org>
+
+ * ext/pathname/pathname.c (path_unlink): Pathname#unlink and
+ Pathname#delete translated from pathname.rb.
+
+Sun Sep 19 06:06:07 2010 Kenta Murata <mrkn@mrkn.jp>
+
+ * ext/bigdecimal/bigdecimal.c (check_rounding_mode): added for
+ converting symbol to rounding mode number.
+
+ * ext/bigdecimal/bigdecimal.c (BigDecimal_mode, BigDecimal_round):
+ support to specify rounding mode by symbol.
+
+ * test/bigdecimal/test_bigdecimal.rb (test_mode, test_round):
+ add tests for above changes.
+
+Sun Sep 19 05:14:35 2010 Kenta Murata <mrkn@mrkn.jp>
+
+ * ext/bigdecimal/bigdecimal.c: fix rounding algorithms for half-down
+ and half-even. This change is based on the patch created by Matthew
+ Willson, the reporter of this bug. [Bug #3803] [ruby-core:32136]
+
+ * test/bigdecimal/test_bigdecimal.rb: add tests for above changes.
+
+Sat Sep 18 20:09:51 2010 Tanaka Akira <akr@fsij.org>
+
+ * ext/pathname/pathname.c (path_each_entry): Pathname#each_entry
+ translated from pathname.rb.
+
+Fri Sep 17 23:44:07 2010 Kouhei Sutou <kou@cozmixng.org>
+
+ * lib/rexml/xpath_parser.rb, test/rexml/test_xpath.rb:
+ add missing method availability check. [ruby-core:32447]
+ Reported by Wiebe Cazemier. Thanks!!!
+
+Fri Sep 17 23:23:26 2010 Kouhei Sutou <kou@cozmixng.org>
+
+ * test/rexml/test_sax.rb: don't use thread and sleep to avoid slow test.
+
+Fri Sep 17 23:10:44 2010 Kouhei Sutou <kou@cozmixng.org>
+
+ * test/rexml/test_core.rb: enable.
+
+Fri Sep 17 22:46:02 2010 Kouhei Sutou <kou@cozmixng.org>
+
+ * test/rexml/: untabify.
+
+Fri Sep 17 22:29:56 2010 Kouhei Sutou <kou@cozmixng.org>
+
+ * test/rexml/: fix fixture data path. All REXML tests are worked.
+
+Fri Sep 17 22:15:15 2010 Kouhei Sutou <kou@cozmixng.org>
+
+ * test/rexml/test_listener.rb: remove needless codes.
+
+Fri Sep 17 22:12:23 2010 Kouhei Sutou <kou@cozmixng.org>
+
+ * test/rexml/: import REXML tests from
+ http://www.germane-software.com/repos/rexml/trunk/test/.
+ Many tests are failed temporary. I'll fix them quickly. Sorry.
+
+Fri Sep 17 16:48:49 2010 URABE Shyouhei <shyouhei@ruby-lang.org>
+
+ * test/io/console/test_io_console.rb (TestIO_Console::helper):
+ PTY.open is not guaranteed to work. On my machine opening a
+ pty is prohibited via process control group. On those cases
+ exceptions shall occur, and that doesn't mean our fault.
+ Skip those tests on such situations.
+
+Fri Sep 17 08:30:27 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/tracer.rb: count only non-internal libraries in stack trace,
+ ignoring custom_require. [ruby-core:31858]
+
+Fri Sep 17 02:18:41 2010 Akinori MUSHA <knu@iDaemons.org>
+
+ * tool/mkconfig.rb: Fix build with m4 1.4.15 generating duplicate
+ lines in config.status. According to nobu, the mswin32 port may
+ depend on the piece of code in question, so the behavior is left
+ unchanged on mswin32.
+
+Thu Sep 16 23:47:59 2010 Tanaka Akira <akr@fsij.org>
+
+ * ext/pathname/pathname.c (path_opendir): Pathname#opendir translated
+ from pathname.rb.
+
+Thu Sep 16 21:40:37 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/test/unit.rb (Test::Unit::GlobOption): merged RejectOption.
+
+ * test/runner.rb: utilize GlobOption.
+
+Thu Sep 16 21:31:24 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/rdoc/ri/driver.rb (RDoc::RI::Driver.setup_options)
+ (RDoc::RI::Driver.fixup_options): split from process_args.
+ libraries should not parse ARGV inside, since it's a task of
+ applications, not libraries.
+
+Thu Sep 16 21:02:30 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/rdoc/ri/paths.rb (RDoc::RI::Paths.each): HOMEDIR can be nil
+ if $HOME is unset.
+
+Thu Sep 16 14:50:42 2010 URABE Shyouhei <shyouhei@ruby-lang.org>
+
+ * test/ruby/test_file_exhaustive.rb (TestFileExhaustive::test_expand_path):
+ ENV["HOME"] might not be set. On those cases without it an
+ exception raises here, which effectively disables later
+ tests on this method.
+
+Thu Sep 16 08:30:28 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * sprintf.c (rb_f_sprintf): fix rdoc. pointed out by Tomoyuki
+ Chikanaga at [ruby-core:32395], and a patch from Daniel
+ Bovensiepen at [ruby-core:32403].
+
+Thu Sep 16 08:27:36 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/etc/extconf.rb: use expanded sysconfdir with empty DESTDIR.
+ [ruby-core:32394]
+
+Thu Sep 16 06:07:24 2010 Tanaka Akira <akr@fsij.org>
+
+ * ext/pathname/pathname.c (path_rmdir): Pathname#rmdir translated
+ from pathname.rb.
+
+Thu Sep 16 00:36:25 2010 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * ext/readline/extconf.rb: Remove Readline 6 check because
+ Ruby's license is now GPLv3 compatible. [ruby-core:28736]
+
+Thu Sep 16 00:26:00 2010 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * COPYING: change Ruby's License from a dual license with GPLv2
+ to a dual license with 2-clause BSDL.
+ [ruby-dev:42166] [ruby-core:31971]
+ [ruby-dev:39167] [ruby-core:25272]
+
+ * COPYING.ja: ditto.
+
+ * BSDL: added. this is from The FreeBSD License.
+
+Wed Sep 15 21:07:06 2010 Tanaka Akira <akr@fsij.org>
+
+ * ext/pathname/pathname.c (path_mkdir): Pathname#mkdir translated
+ from pathname.rb.
+
+Wed Sep 15 13:37:00 2010 URABE Shyouhei <shyouhei@ruby-lang.org>
+
+ * test/net/imap/test_imap.rb: "localhost" not guaranteed to
+ resolve to "127.0.0.1". On my machine it is "::1" instead.
+ The problem is, you have to connect to the imaps server via
+ the canonical name written in a server certificate, and that
+ of the server.cert is "localhost". So you have to listen to
+ the address of what "localhost" resolves to. I think this
+ situation cannot be resolved in a handy manner because the
+ test "test_imaps_post_connection_check" is actually
+ expecting to connect to a server via an address other than
+ the CN. On my machine several assertions won't pass because
+ the test cannot connect to the server.
+
+Wed Sep 15 09:12:03 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * io.c (rb_io_puts): fix for wide char encoding strings.
+ [ruby-dev:42212]
+
+Wed Sep 15 07:27:52 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * string.c (rb_str_format_m): mentioned about Hash argument. a patch
+ from Daniel Bovensiepen at [ruby-core:32386].
+
+ * sprintf.c (get_hash): ditto, and fix typo.
+
+Wed Sep 15 07:22:20 2010 Tanaka Akira <akr@fsij.org>
+
+ * ext/pathname/pathname.c (path_entries): Pathname#entries translated
+ from pathname.rb.
+
+Wed Sep 15 02:13:44 2010 Aaron Patterson <aaron@tenderlovemaking.com>
+
+ * ext/fiddle/closure.c : Don't use FFI closure alloc on OpenBSD.
+ Thanks Jeremy Evans! [ruby-core:32384]
+
+Tue Sep 14 20:17:48 2010 Tanaka Akira <akr@fsij.org>
+
+ * ext/pathname/pathname.c (path_s_getwd): Pathname.getwd and
+ Pathname.pwd translated from pathname.rb.
+
+Tue Sep 14 05:13:04 2010 Tanaka Akira <akr@fsij.org>
+
+ * ext/pathname/pathname.c (path_s_glob): Pathname.glob translated
+ from pathname.rb.
+
+Tue Sep 14 01:24:51 2010 Yutaka Kanemoto <kanemoto@ruby-lang.org>
+
+ * ext/socket/raddrinfo.c (ruby_getaddrinfo__aix): suppress a
+ warning.
+
+Mon Sep 13 20:48:30 2010 Tanaka Akira <akr@fsij.org>
+
+ * ext/pathname/pathname.c (path_zero_p): Pathname#zero? translated
+ from pathname.rb.
+
+Mon Sep 13 19:56:50 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/socket/rubysocket.h (__DARWIN_ALIGNBYTES): workaround of a
+ bug in system header of darwin 9. [ruby-core:32341]
+
+Mon Sep 13 18:11:55 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/mkmf.rb (try_do): fix typo. a patch from Peter Weldon
+ at [ruby-core:32327].
+
+Mon Sep 13 10:12:09 2010 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * util.c (ruby_strtod): reject Float('0x0.').
+ [ruby-dev:42239] Bug #3820
+
+Mon Sep 13 09:23:58 2010 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * ext/openssl/ossl_bn.c (ossl_bn_is_prime): fix comparison
+ with rb_scan_args. Before this fix, OpenSSL::BN#prime?
+ is fully broken. [ruby-dev:42225]
+
+Mon Sep 13 06:45:24 2010 Tanaka Akira <akr@fsij.org>
+
+ * ext/pathname/pathname.c (path_writable_real_p):
+ Pathname#writable_real? translated from pathname.rb.
+
+Sun Sep 12 21:21:50 2010 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * lib/date.rb: [ruby-core:32096] Thanks Colin Bartlett.
+
+Sun Sep 12 19:30:27 2010 Tanaka Akira <akr@fsij.org>
+
+ * ext/pathname/pathname.c (path_world_writable_p):
+ Pathname#world_writable? translated from pathname.rb.
+
+Sun Sep 12 09:16:06 2010 Tanaka Akira <akr@fsij.org>
+
+ * ext/pathname/pathname.c (path_writable_p): Pathname#writable?
+ translated from pathname.rb.
+
+Sun Sep 12 08:36:15 2010 Tanaka Akira <akr@fsij.org>
+
+ * process.c (rlimit_resource_name2int): support more limits:
+ RLIMIT_MSGQUEUE, RLIMIT_NICE, RLIMIT_RTPRIO, RLIMIT_RTTIME and
+ RLIMIT_SIGPENDING.
+ (Init_process): ditto.
+ patch by Run Paint Run Run. [ruby-core:32262]
+
+Sun Sep 12 04:27:13 2010 Tanaka Akira <akr@fsij.org>
+
+ * process.c (rlimit_resource_name2int): use STRCASECMP to avoid
+ ALLOCA_N.
+
+Sat Sep 11 16:47:41 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * hash.c (ruby_setenv): raise if putenv and SetEnvironmentVariable
+ failed, because of the restriction of the size on Windows.
+ based on a patch from Peter Weldon at [ruby-core:32304]. fix:
+ Bug#3812, [ruby-core:32250]
+
+Sat Sep 11 15:19:57 2010 Eric Hodel <drbrain@segment7.net>
+
+ * lib/webrick/httpauth/digestauth.rb (WEBrick::Config::DigestAuth):
+ Add documentation
+
+ * lib/webrick/config.rb (WEBrick::Config::DigestAuth): Add
+ documentation
+
+Sat Sep 11 12:32:05 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * include/ruby/intern.h (rb_set_kcode, rb_get_kcode): removed
+ zombie prototype declarations. a patch from Eric Hodel
+ at [ruby-core:32305].
+
+Sat Sep 11 06:53:12 2010 Tanaka Akira <akr@fsij.org>
+
+ * ext/pathname/pathname.c (path_symlink_p): Pathname#symlink?
+ translated from pathname.rb.
+
+Fri Sep 10 23:03:43 2010 Tanaka Akira <akr@fsij.org>
+
+ * ext/pathname/pathname.c (path_sticky_p): Pathname#sticky? translated
+ from pathname.rb.
+
+Fri Sep 10 19:11:13 2010 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
+
+ * lib/webrick/httprequest.rb (WEBrick::HTTPRequest#continue): add
+ method for generating HTTP/1.1 100 continue response if the client
+ expects it, otherwise does nothing. Patch by Brian Candler.
+ ref #855.
+
+ * test/webrick/test_httprequest.rb: test added.
+
+Fri Sep 10 17:49:34 2010 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
+
+ * ext/openssl/lib/openssl/x509-internal.rb: removed unused local
+ variable.
+
+ * test/openssl/*: less warnings while test running with -w.
+
+Fri Sep 10 16:49:20 2010 Akinori MUSHA <knu@iDaemons.org>
+
+ * class.c (rb_scan_args): Add support for optional keyword
+ argument hash. [ruby-dev:42221] [ruby-dev:38048]
+
+ * README.EXT, README.EXT.ja: Update documentation accordingly.
+
+ * dir.c (dir_initialize): Make use of the new rb_scan_args()
+ feature.
+
+ * io.c (rb_io_s_popen, rb_scan_open_args, rb_io_initialize)
+ (rb_io_s_pipe, open_key_args, io_s_foreach, io_s_readlines)
+ (rb_io_s_read, rb_io_set_encoding): Ditto.
+
+ * transcode.c (str_transcode, econv_args)
+ (econv_primitive_convert): Ditto.
+
+ * ext/zlib/zlib.c (rb_gzreader_initialize): Ditto.
+
+Fri Sep 10 10:33:18 2010 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * random.c (rb_genrand_ulong_limited): renamed from
+ rb_rand_internal and now this is public API.
+
+ * include/ruby/ruby.h (rb_genrand_ulong_limited): added.
+
+ * bignum.c (big_sparse_p): use rb_genrand_ulong_limited.
+
+Fri Sep 10 13:07:22 2010 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
+
+ * ext/digest/lib/digest.rb: removed unused exception variable
+ assignment to avoid a warning.
+
+Fri Sep 10 07:29:14 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/etc/etc.c (etc_systmpdir): assume system default tmpdir
+ safe. [ruby-dev:42089]
+
+Fri Sep 10 07:03:23 2010 Tanaka Akira <akr@fsij.org>
+
+ * ext/pathname/pathname.c (path_size_p): Pathname#size? translated from
+ pathname.rb.
+
+Fri Sep 10 02:15:29 2010 Tanaka Akira <akr@fsij.org>
+
+ * ext/socket/option.c (inspect_peercred): support OpenBSD-current.
+ patch by Jeremy Evans. [ruby-core:32240]
+
+Thu Sep 9 23:25:53 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * vm.c (vm_backtrace_each): skip allocator frames which have no
+ name. [ruby-core:32231]
+
+Thu Sep 9 22:39:08 2010 Tanaka Akira <akr@fsij.org>
+
+ * ext/pathname/pathname.c (path_size): Pathname#size translated from
+ pathname.rb.
+
+Thu Sep 9 22:34:48 2010 wanabe <s.wanabe@gmail.com>
+
+ * compile.c (case_when_optimizable_literal): When float value can be
+ treated as integer, add to table hash of case that way.
+ based on a patch from Ikuo KOBORI. [ruby-dev:42038]
+
+ * insns.def (opt_case_dispatch): ditto.
+
+ * test/ruby/test_case.rb: add tests.
+
+Thu Sep 9 17:15:15 2010 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
+
+ * test/net/http/test_https.rb (test_identity_verify_failure): follows
+ the SSL hostname check error message of openssl.
+
+Thu Sep 9 10:44:46 2010 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * test/ruby/test_env.rb (test_aset): OpenBSD acts like NetBSD in
+ that it ignores characters after = in ENV.
+ patched by Jeremy Evans [ruby-core:32184]
+
+Thu Sep 9 09:02:01 2010 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * tool/rbinstall.rb (install?): gemspec filename should include
+ its version. patched by Luis Lavena [ruby-core:32165]
+
+Wed Sep 8 22:46:31 2010 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
+
+ * ext/openssl/ossl_ssl.c (ssl_get_error): Thread context switch was
+ blocked on Windows while blocking call for SSLSocket. Need to
+ convert errno for letting rb_io_wait_readable detect EWOULDBLOCK.
+ Patch by arton. ref #3794.
+
+Wed Sep 8 20:56:57 2010 Tanaka Akira <akr@fsij.org>
+
+ * ext/pathname/pathname.c (path_setgid_p): Pathname#setgid? translated
+ from pathname.rb.
+
+Wed Sep 8 06:25:41 2010 Tanaka Akira <akr@fsij.org>
+
+ * ext/pathname/pathname.c (path_setuid_p): Pathname#setuid? translated
+ from pathname.rb.
+
+Tue Sep 7 21:03:35 2010 Tanaka Akira <akr@fsij.org>
+
+ * ext/pathname/pathname.c (path_readable_real_p):
+ Pathname#readable_real? translated from pathname.rb.
+
+Mon Sep 6 23:07:25 2010 Tanaka Akira <akr@fsij.org>
+
+ * ext/pathname/pathname.c (path_world_readable_p):
+ Pathname#world_readable? translated from pathname.rb.
+
+Mon Sep 6 11:03:13 2010 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
+
+ * Fixed wrong check of missing functions. Patch by Adrian Quark.
+ ref #3400
+ The patch contains following comment:
+ This patch should avoid unnecessary incompatibility with future
+ versions of Openssl. Changes suggested by bmaher_at_amazon.com.
+
+Mon Sep 6 10:46:55 2010 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
+
+ * Fixed exception message for SSL post connection check failure. Patch
+ by Paul Betteridge. ref [Bug #3704]
+
+Mon Sep 6 10:31:59 2010 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * ext/readline/readline.c (readline_s_get_line_buffer):
+ Readline.line_buffer should return locale string.
+ [ruby-dev:42184] #3791
+
+Mon Sep 6 09:47:24 2010 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * util.c (ruby_strtod): check there is at least 1 digit after
+ "0x" before ".". [ruby-dev:42183] #3790
+
+Mon Sep 6 09:44:50 2010 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * util.c (ruby_strtod): check integer overflow.
+ [ruby-dev:42180] #3789
+
+Mon Sep 6 06:17:21 2010 Tanaka Akira <akr@fsij.org>
+
+ * ext/pathname/pathname.c (path_readable_p): Pathname#readable?
+ translated from pathname.rb.
+
+Sun Sep 5 23:02:34 2010 Tanaka Akira <akr@fsij.org>
+
+ * ext/pathname/pathname.c (path_owned_p): Pathname#owned?
+ translated from pathname.rb.
+
+Sat Sep 4 23:48:47 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * file.c (rb_file_s_readlink): symlink target should be in
+ filesystem encoding.
+
+Sat Sep 4 10:40:50 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * load.c (ruby_init_ext): export for golfers.
+
+ * vm_core.h (rb_iseq_eval, rb_iseq_compile_with_option): ditto.
+
+Sun May 23 17:29:41 2010 Yuki Sonoda (Yugui) <yugui@yugui.jp>
+
+ * common.mk (capi): uses a timestamp file to get rid of
+ generating twice.
+
+Fri Jun 18 01:33:21 2010 Yuki Sonoda (Yugui) <yugui@yugui.jp>
+
+ * enc/Makefile.in (realclean): has been missing. necessary
+ for make realclean-enc.
+
+Fri Sep 3 23:51:26 2010 Tanaka Akira <akr@fsij.org>
+
+ * ext/pathname/pathname.c (path_socket_p): Pathname#socket?
+ translated from pathname.rb.
+
+Fri Sep 3 06:40:44 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/pty/pty.c (chfunc): pass through exceptions.
+
+ * io.c (rb_io_bufwrite, rb_io_bufread): added.
+
+ * process.c (rb_fork_err): protect from exceptions.
+
+Fri Sep 3 06:16:07 2010 Tanaka Akira <akr@fsij.org>
+
+ * ext/pathname/pathname.c (path_pipe_p): Pathname#pipe?
+ translated from pathname.rb.
+
+Fri Sep 3 06:14:40 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/pty/pty.c (chfunc): restore errno from SystemCallError and
+ propagate proper exception to the parent. [ruby-dev:41965]
+
+Thu Sep 2 22:10:38 2010 Tanaka Akira <akr@fsij.org>
+
+ * ext/pathname/pathname.c (path_file_p): Pathname#file?
+ translated from pathname.rb.
+
+Thu Sep 2 09:12:02 2010 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * win32/win32.c (rb_w32_spawn, rb_w32_aspawn): don't forget to free
+ memory.
+
+Thu Sep 2 09:01:13 2010 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * win32/win32.c (CreateChild): unicodize.
+
+ * win32/win32.c (rb_w32_spawn, rb_w32_aspawn): convert arguments of
+ CreateChild() from ACP to WideChar.
+
+Thu Sep 2 06:53:43 2010 Tanaka Akira <akr@fsij.org>
+
+ * ext/pathname/pathname.c (path_directory_p): Pathname#directory?
+ translated from pathname.rb.
+
+Wed Sep 1 22:03:41 2010 Tanaka Akira <akr@fsij.org>
+
+ * ext/pathname/pathname.c (path_grpowned_p): Pathname#grpowned?
+ translated from pathname.rb.
+
+Wed Sep 1 17:39:02 2010 Ryan Davis <ryand-ruby@zenspider.com>
+
+ * lib/minitest/*.rb: Imported minitest 1.7.1 r5835.
+ * test/minitest/*.rb: ditto.
+
+Wed Sep 1 16:50:42 2010 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * string.c (tr_setup_table): optimized. don't create hash objects
+ when given pattern is ASCII only.
+
+ * string.c (tr_find): ditto.
+
+Wed Sep 1 14:35:29 2010 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * array.c (rb_ary_rotate_m): fix typo of rdoc.
+ patched by Andrei Kulakov [ruby-core:31975]
+
+Wed Sep 1 14:33:36 2010 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * enum.c (enum_zip): fix typo of rdoc.
+ patched by Andrei Kulakov [ruby-core:31974]
+
+Wed Sep 1 12:56:36 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * thread.c (ruby_suppress_tracing): restore the state and invoke
+ the func with normal state. a patch from Satoshi Shiba <shiba
+ AT rvm.jp> at [ruby-dev:42162]. [ruby-core:31783]
+
+Tue Aug 31 21:10:23 2010 Tanaka Akira <akr@fsij.org>
+
+ * ext/pathname/pathname.c (path_exist_p): Pathname#exist? translated
+ from pathname.rb.
+
+Tue Aug 31 17:32:34 2010 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
+
+ * ext/tk/stubs.c: fix [Bug #3771] "VC++ can't make ext/tk with enabling
+ stubs". Thanks, Akio Tajima [ruby-dev:42159].
+
+Tue Aug 31 03:42:14 2010 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * string.c (tr_setup_table): fix bug in r29146.
+ Initialize table even if cflag is 0; tr_find see whether
+ del is empty or not.
+
+ * string.c (tr_find): nodel can't be NULL; if NULL, it means
+ it is not specified.
+
+Mon Aug 30 21:29:21 2010 Tanaka Akira <akr@fsij.org>
+
+ * ext/pathname/pathname.c (path_executable_real_p):
+ Pathname#executable_real? translated from pathname.rb.
+
+Mon Aug 30 15:00:13 2010 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * string.c (tr_setup_table): initialize negating table when
+ negating string is given. [ruby-core:31851]
+
+ * string.c (tr_find): add a sentence for the time when
+ target characters include negating one.
+
+ * string.c (rb_str_count): move definition.
+
+Mon Aug 30 07:32:41 2010 Tanaka Akira <akr@fsij.org>
+
+ * ext/pathname/pathname.c (path_executable_p): Pathname#executable?
+ translated from pathname.rb.
+
+Sun Aug 29 23:54:10 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/rdoc/parser/ruby.rb (RDoc#parse_call_parameters): don't
+ include assignment. [Bug #3759], [ruby-dev:42154]
+
+ * lib/rdoc/parser/ruby.rb (RDoc#parse_class): ignore non-constant
+ name singleton class. [Bug #3759], [ruby-dev:42154]
+
+Sun Aug 29 23:25:18 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * file.c (rb_get_path_check): clarify error message for
+ ASCII-incompatible path name.
+
+Sun Aug 29 16:02:54 2010 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * common.mk (node_name.inc): remove command option -n and give
+ file as stdin, because IronRuby 1.1 still doesn't support it.
+ So now we can use ir.exe as BASERUBY.
+
+ * tool/node_name.rb: read stdin with while gets.
+
+Sun Aug 29 13:22:43 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * vm.c (rb_thread_method_id_and_class): curried proc has no
+ method. [ruby-core:31871]
+
+Sun Aug 29 12:51:33 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * load.c (rb_provide_feature): clarify error message for frozen
+ $LOADED_FEATURES. based on a patch from Run Paint Run Run at
+ [ruby-core:31913].
+
+Sun Aug 29 12:19:58 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * load.c (load_failed): should honor encoding. [ruby-core:31915]
+
+Sun Aug 29 09:35:10 2010 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * common.mk (clean): exclude *.inc. [ruby-dev:41931]
+
+ * common.mk (distclean): include *.inc.
+
+ * common.mk (help): change description about clean and distclean.
+
+Sat Aug 29 06:34:52 2010 Tanaka Akira <akr@fsij.org>
+
+ * ext/pathname/pathname.c (path_chardev_p): Pathname#chardev?
+ translated from pathname.rb.
+
+Sat Aug 28 17:39:33 2010 Kenta Murata <mrkn@mrkn.jp>
+
+ * ext/bigdecimal/bigdecimal.c (BigDecimal_save_exception_mode,
+ BigDecimal_save_rounding_mode, BigDecimal_save_limit): added.
+
+ * test/bigdecimal/test_bigdecimal.rb: added tests for the above
+ features.
+
+Sat Aug 28 08:11:05 2010 Tanaka Akira <akr@fsij.org>
+
+ * ext/pathname/pathname.c (path_blockdev_p): Pathname#blockdev?
+ translated from pathname.rb.
+
+Fri Aug 27 16:20:01 2010 URABE Shyouhei <shyouhei@ruby-lang.org>
+
+ * string.c (rb_str_prepend): new method by Shota Fukumori (sora_h)
+ [Feature #3765]
+
+Fri Aug 27 15:24:20 2010 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * math.c (math_atan2): you should know that M_PI is not the feature
+ of C90.
+ fixed build failure caused by r29115.
+
+Fri Aug 27 15:26:33 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * file.c (null_device): move from io.c.
+
+Fri Aug 27 12:47:44 2010 Kenta Murata <mrkn@mrkn.jp>
+
+ * math.c (math_atan2): change the behavior when x and y are zero.
+ [ruby-dev:42090] [Bug #3736] [ruby-dev:42116]
+
+ * test/ruby/test_math.rb (test_atan2): add tests for the above
+ changes.
+
+Fri Aug 27 12:26:23 2010 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * object.c (rb_obj_class): remove mention of obsolete method.
+ a patch from Run Paint Run Run at [ruby-core:31842].
+
+Fri Aug 27 12:25:03 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * io.c (null_device): the name of null device. [ruby-dev:41791]
+
+Fri Aug 27 07:57:34 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * array.c (rb_ary_shuffle_bang): bail out from modification during
+ shuffle.
+
+ * array.c (rb_ary_sample): ditto.
+
+Fri Aug 27 05:11:51 2010 Tanaka Akira <akr@fsij.org>
+
+ * ext/pathname/pathname.c (path_sysopen): Pathname#sysopen translated
+ from pathname.rb.
+
+Thu Aug 26 22:53:56 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * array.c (rb_ary_shuffle): rdoc fix. argument name was missing.
+ a patch from Run Paint Run Run at [ruby-core:31848].
+
+Thu Aug 26 21:49:46 2010 Tanaka Akira <akr@fsij.org>
+
+ * ext/pathname/pathname.c (path_readlines): Pathname#readlines
+ translated from pathname.rb.
+
+Thu Aug 26 10:37:00 2010 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * regint.h (OnigStackIndex): the type should be intptr_t.
+ Original Oniguruma assumes the size of long and that of void *
+ are equal, but it's not true on LLP64 platform: mswin64.
+ originally patched by shintaro kuwamoto [ruby-dev:42133]
+
+Thu Aug 26 10:38:11 2010 Yutaka Kanemoto <kanemoto@ruby-lang.org>
+
+ * test/dl/test_base.rb: AIX does not have dynamically loadable lib[cm].
+
+ * test/fiddle/helper.rb: AIX does not have dynamically loadable lib[cm].
+
+Thu Aug 26 09:49:50 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * array.c (rb_ary_shuffle_bang): check number of argument.
+
+Tue Aug 26 09:11:40 2010 Kenta Murata <mrkn@mrkn.jp>
+
+ * ext/bigdecimal/bigdecimal.c (Init_bigdecimal,
+ rmpd_set_thread_local_exception_mode, VpGetException,
+ VpSetException): thread-local exception mode.
+
+ * ext/bigdecimal/bigdecimal.c (Init_bigdecimal,
+ rmpd_set_thread_local_precision_limit, VpGetPrecLimit,
+ VpSetPrecLimit): thread-local precision limit.
+
+ * ext/bigdecimal/bigdecimal.c (Init_bigdecimal,
+ rmpd_set_thread_local_rounding_mode, VpGetRoundMode,
+ VpSetRoundMode, VpException, VpInternalRound):
+ thread-local rounding mode.
+
+ * ext/bigdecimal/bigdecimal.c (BigDecimal_mode, BigDecimal_round,
+ VpIsRoundMode, VpGetRoundMode, VpSetRoundMode, VpActiveRound,
+ VpMidRound, VpLeftRound), ext/bigdecimal/bigdecimal.h:
+ use unsigned short for rounding mode.
+
+ * test/bigdecimal/test_bigdecimal.rb (test_mode): add test for
+ setting rounding mode.
+
+ * test/bigdecimal/test_bigdecimal.rb (test_thread_local_mode):
+ add test for setting mode thread-locally.
+
+Thu Aug 26 07:29:54 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * array.c (rb_ary_{shuffle_bang,sample}): use Random class object.
+
+ * random.c (try_get_rnd): use default_rand for Random as same as
+ singleton methods.
+
+ * random.c (rb_random_real): check the range of result.
+
+Wed Aug 25 22:11:11 2010 Tanaka Akira <akr@fsij.org>
+
+ * ext/pathname/pathname.c (path_binread): Pathname#binread translated
+ from pathname.rb.
+
+Wed Aug 25 03:42:43 2010 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * ext/dl/cfunc.c (rb_dlcfunc_call): workaround for VC9 for x64.
+ reported by kuwamoto shintaro in [ruby-dev:42125].
+
+Tue Aug 24 23:28:50 2010 Yusuke Endoh <mame@tsg.ne.jp>
+
+ * .gitignore: updated.
+
+Tue Aug 24 22:07:28 2010 Tanaka Akira <akr@fsij.org>
+
+ * ext/pathname/pathname.c (path_read): Pathname#read translated from
+ pathname.rb.
+
+Tue Aug 24 10:11:04 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * configure.in: read API version from include/ruby/version.h.
+
+ * {bcc,win}32/setup.mak (-version-): ditto.
+
+ * version.h (RUBY_LIB_VERSION): use API version numbers.
+
+Tue Aug 24 07:07:28 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * array.c (rb_ary_shuffle_bang, rb_ary_sample): add optional
+ argument random. [ruby-dev:41923] [EXPERIMENTAL]
+
+ * random.c (rb_random_{int32,real,bytes}): fallback to normal
+ method invocation.
+
+Tue Aug 24 06:08:10 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * include/ruby/version.h (RUBY_API_VERSION_*): renamed and moved
+ from version.h. [ruby-dev:42103]
+
+Tue Aug 24 05:58:18 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ChangeLog: flushed. [ruby-dev:42050]
+
Tue Aug 24 01:14:58 2010 Kenta Murata <mrkn@mrkn.jp>
* ext/bigdecimal/bigdecimal.c (BigDecimal_to_f): to_f must underflow
@@ -2146,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>
@@ -64766,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>
@@ -64788,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>
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/NEWS-1.8.7 b/doc/NEWS-1.8.7
index 460a7c9328..51fb5f1c6a 100644
--- a/doc/NEWS-1.8.7
+++ b/doc/NEWS-1.8.7
@@ -1,4 +1,6 @@
-= NEWS
+# -*- rdoc -*-
+
+= NEWS for Ruby 1.8.7
This document is a list of user visible feature changes made between
releases except for bug fixes.
@@ -52,7 +54,7 @@ with all sufficient information, see the ChangeLog file.
* Array#flatten
* Array#flatten!
- Take an optional argument that determines the level of recursion
+ Takes an optional argument that determines the level of recursion
to flatten.
* Array#eql?
@@ -75,6 +77,7 @@ with all sufficient information, see the ChangeLog file.
* Array#reject
* Array#reject!
* Array#delete_if
+ * Array#select
Return an enumerator if no block is given.
@@ -159,6 +162,10 @@ with all sufficient information, see the ChangeLog file.
New alias to #inject.
+ * Enumerable#to_a
+
+ Can take optional arguments and pass them to #each.
+
* Hash#eql?
* Hash#hash
* Hash#==
@@ -260,12 +267,17 @@ with all sufficient information, see the ChangeLog file.
* Regexp.union accepts an array of patterns.
+ * String#bytes
+
+ New method
+
* String#bytesize
New method, returning the size in bytes. (alias length and size)
* String#chars
* String#each_char
+ * String#lines
* String#partition
* String#rpartition
* String#start_with?
@@ -499,6 +511,15 @@ with all sufficient information, see the ChangeLog file.
always use Date.strptime() when you know what you are dealing
with.
+* REXML
+
+ * REXML::Document.entity_expansion_limit=
+
+ New method to set the entity expansion limit. By default the limit is
+ set to 10000. See the following URL for details.
+
+ http://www.ruby-lang.org/en/news/2008/08/23/dos-vulnerability-in-rexml/
+
* stringio
* StringIO#each_byte
diff --git a/doc/NEWS-1.9.1 b/doc/NEWS-1.9.1
index f2afa00bdc..fb11026d60 100644
--- a/doc/NEWS-1.9.1
+++ b/doc/NEWS-1.9.1
@@ -1,4 +1,6 @@
-= NEWS
+# -*- rdoc -*-
+
+= NEWS for Ruby 1.9.1
This document is a list of user visible feature changes made between
releases except for bug fixes.
@@ -31,18 +33,18 @@ See doc/NEWS-1.8.7 for changes between 1.8.6 and 1.8.7.
* builtin classes and objects
* Kernel and Object
- o Kernel#methods and #singleton_methods used to return an
+ o Kernel#methods and #singleton_methods used to return an
array of strings but now they return an array of symbols.
* Class and Module
o Module#attr works as Module#attr_reader by default.
Optional boolean argument is obsolete.
o Module#instance_methods, #private_instance_methods and
- #public_instance_methods used to return an array of
+ #public_instance_methods used to return an array of
strings but now they return an array of symbols.
o Extra subclassing check when binding UnboundMethods
-
+
* Exceptions
- o Exceptions are equal to each other if they belong to
+ o Exceptions are equal to each other if they belong to
the same class and have the same message and backtrace.
o SystemStackError used to be a subclass of StandardError
but not it is a direct subclass of Exception.
@@ -71,7 +73,7 @@ See doc/NEWS-1.8.7 for changes between 1.8.6 and 1.8.7.
o Most of the changes in Hash apply to hash like interfaces
such as ENV and *DBM.
* IO operations
- o Many methods used to act byte-wise but now some of those act
+ o Many methods used to act byte-wise but now some of those act
character-wise. You can use alternate byte-wise methods.
o IO#getc
o Non-blocking IO
@@ -94,7 +96,7 @@ See doc/NEWS-1.8.7 for changes between 1.8.6 and 1.8.7.
o IO#internal_encoding, IO#external_encoding,
IO#set_encoding
o IO.pipe takes encoding option
- o Directive %u behaves like %d for negative values in
+ o Directive %u behaves like %d for negative values in
printf-style formatting.
* File and Dir operations
o #to_path is called as necessary in File.path, File.chmod,
@@ -168,7 +170,7 @@ See doc/NEWS-1.8.7 for changes between 1.8.6 and 1.8.7.
* Pathname
o No longer has #to_str nor #=~.
* time and date
- o Time.parse and Date.parse interprets slashed numerical dates
+ o Time.parse and Date.parse interprets slashed numerical dates
as "dd/mm/yyyy".
* Readline
o If Readline uses libedit, Readline::HISTORY[0] returns the
@@ -209,15 +211,15 @@ See doc/NEWS-1.8.7 for changes between 1.8.6 and 1.8.7.
* New syntax and semantics
o Magic comments to declare in which encoding your source
code is written
- o New literal hash syntax and new syntax for hash style
- arguments
+ o New literal hash syntax and new syntax for hash style
+ arguments
o New syntax for lambdas
o .() and calling Procs without #call/#[]
o Block in block arguments
o Block local variables
o Mandatory arguments after optional arguments allowed
o Multiple splats allowed
- o #[] can take splatted arguments, hash style arguments
+ o #[] can take splatted arguments, hash style arguments
and a block.
o New directives in printf-style formatted strings (%).
o Newlines allowed before ternary colon operator (:) and
@@ -263,7 +265,7 @@ See doc/NEWS-1.8.7 for changes between 1.8.6 and 1.8.7.
* Enumerable and Enumerator
o Enumerator#enum_cons and Enumerator#enum_slice are
- removed. Use #each_cons and #each_slice without a block.
+ removed. Use #each_cons and #each_slice without a block.
o Enumerable#each_with_index can take optional arguments
and passes them to #each.
o Enumerable#each_with_object
@@ -333,6 +335,11 @@ See doc/NEWS-1.8.7 for changes between 1.8.6 and 1.8.7.
o Numeric#upto, #downto, #times, #step
o Numeric#real?, Complex#real?
o Numeric#magnitude
+ o Numeric#round
+ * Float
+ o Float#round
+ * Integer
+ o Integer#round
* Rational / Complex
o They are in the core library now
* Math
@@ -386,7 +393,7 @@ See doc/NEWS-1.8.7 for changes between 1.8.6 and 1.8.7.
o Readline.emacs_editing_mode?
o Readline::HISTORY.clear
* Tk
- o TkXXX widget classes are removed and redefined as aliases of
+ o TkXXX widget classes are removed and redefined as aliases of
Tk::XXX classes.
* RDoc
o Updated to version 2.2.2. See:
diff --git a/doc/NEWS-1.9.2 b/doc/NEWS-1.9.2
index 11e5c82c58..9cf58c9aff 100644
--- a/doc/NEWS-1.9.2
+++ b/doc/NEWS-1.9.2
@@ -1,5 +1,5 @@
-# -*- rd -*-
-= NEWS
+# -*- rdoc -*-
+= NEWS for Ruby 1.9.2
This document is a list of user visible feature changes made between
releases except for bug fixes.
@@ -14,7 +14,7 @@ with all sufficient information, see the ChangeLog file.
* builtin classes
* Array
- * new method:
+ * new methods:
* Array#keep_if
* Array#repeated_combination
* Array#repeated_permutation
@@ -23,11 +23,11 @@ with all sufficient information, see the ChangeLog file.
* Array#select!
* Array#sort_by!
- * extended methods:
+ * extended method:
* Array#{uniq,uniq!,product} can take a block.
* Complex
- * new methods:
+ * new method:
* Complex#rationalize
* Dir
@@ -50,7 +50,7 @@ with all sufficient information, see the ChangeLog file.
* ascii_compatible?
* Enumerable
- * New methods:
+ * new methods:
* Enumerable#chunk
* Enumerable#collect_concat
* Enumerable#each_entry
@@ -65,7 +65,7 @@ with all sufficient information, see the ChangeLog file.
* Enumerator#feed
* StopIteration#result
- * extended methods:
+ * extended method:
* #with_index accepts an optional argument that specifies the
index number to start with, defaulted to 0.
@@ -85,14 +85,13 @@ with all sufficient information, see the ChangeLog file.
* new constants:
* Float::INFINITY
* Float::NAN
- * new methods:
+ * new method:
* Float#rationalize
* File
* new methods:
* File.realpath
* File.realdirpath
- * File#size
* GC::Profiler
* new method:
@@ -104,14 +103,14 @@ with all sufficient information, see the ChangeLog file.
* Hash#select!
* IO
- * new method:
+ * new methods:
* IO#autoclose=
* IO#autoclose?
* IO#fdatasync
* IO#codepoints
* IO#each_codepoint
- * extended methods:
+ * extended method:
* IO.pipe can take a block.
* new modules:
@@ -120,7 +119,7 @@ with all sufficient information, see the ChangeLog file.
They are used to extend non-blocking exceptions.
* Integer
- * new methods:
+ * new method:
* Integer#rationalize
* Kernel
@@ -129,7 +128,7 @@ with all sufficient information, see the ChangeLog file.
* Kernel#singleton_class
* Kernel#require_relative
- * extended methods:
+ * extended method:
* Kernel#respond_to? can be used to detect methods not implemented.
For example, Process.respond_to?(:fork) returns false on Windows.
@@ -147,11 +146,15 @@ with all sufficient information, see the ChangeLog file.
platforms.
* MatchData
- * New method:
+ * new method:
* MatchData#==
+ * Method
+ * new method:
+ * Method#parameters
+
* NilClass
- * new methods:
+ * new method:
* NilClass#rationalize
* Object
@@ -160,18 +163,20 @@ with all sufficient information, see the ChangeLog file.
* printf() supports %a/%A format.
* Proc
+ * new method:
+ * Proc#parameters
* extended method:
* Proc#source_location returns location even if receiver is a method
defined by attr_reader / attr_writer / attr_accessor.
* Process
- * extended methods:
+ * extended method:
* Process.spawn accepts [:child, FD] for a redirect target.
* Random (new class to generate pseudo-random numbers)
* Rational
- * new methods:
+ * new method:
* Rational#rationalize
* String
@@ -184,22 +189,27 @@ with all sufficient information, see the ChangeLog file.
* Thread#set_trace_func
* Time
- * extended feature:
+ * extended features:
* time_t restriction is removed to represent before 1901 and after 2038.
Proleptic Gregorian calendar is used for old dates.
* Time.new have optional arguments to specify date with time offset.
* Time#getlocal, Time#localtime have optional time offset argument.
- * new method:
+ * new methods:
* Time#to_r
* Time#subsec
* Time#round
- * incompatible changes:
+ * incompatible change:
* The year argument of Time.{utc,gm,local,mktime} is now interpreted as
the value itself. For example, Time.utc(99) means the year 99 AD,
not 1999 AD.
+ * UnboundMethod
+ * new method:
+ * UnboundMethod#parameters
+
+
* digest
* new methods:
* Digest::Class.base64digest
diff --git a/doc/NEWS-1.9.3 b/doc/NEWS-1.9.3
new file mode 100644
index 0000000000..484660f420
--- /dev/null
+++ b/doc/NEWS-1.9.3
@@ -0,0 +1,341 @@
+# -*- rdoc -*-
+= NEWS for Ruby 1.9.3
+
+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.2 release
+=== License
+
+* Ruby's License is changed from a dual license with GPLv2
+ to a dual license with 2-clause BSDL.
+
+=== Known platform dependent issues
+==== OS X Lion
+
+* You have to configure ruby with '--with-gcc=gcc-4.2' if you're using
+ Xcode 4.1, or, if you're using Xcode 4.2, you have to configure ruby
+ with '--with-gcc=clang'.
+
+=== C API updates
+
+* rb_scan_args() is enhanced with support for option hash argument
+ extraction.
+
+* ruby_vm_at_exit() added. This enables extension libs to hook a VM
+ termination.
+
+* rb_reserved_fd_p() added. If you want to close all file descriptors,
+ check using this API. [ruby-core:37759]
+
+=== Library updates (outstanding ones only)
+
+* builtin classes
+
+ * ARGF
+ * new methods:
+ * ARGF.print
+ * ARGF.printf
+ * ARGF.putc
+ * ARGF.puts
+ * ARGF.read_nonblock
+ * ARGF.to_write_io
+ * ARGF.write
+
+ * Array
+ * extended method:
+ * Array#pack supports endian modifiers
+
+ * Bignum
+ * Multiplication algorithm for Bignums with a large number of digits over
+ 150 BDIGITs is changed in order to reduce its calculation time.
+ Now such large Bignums are multiplied by using Toom-3 algorithm.
+
+ * Encoding
+ * new encodings:
+ * CP950
+ * CP951
+ * UTF-16
+ * UTF-32
+ * change alias:
+ * SJIS is Windows-31J
+
+ * File
+ * new constant:
+ * File::NULL
+ name of NULL device.
+ * File::DIRECT
+ name of O_DIRECT.
+
+ * IO
+ * extended method:
+ * IO#putc supports multibyte characters
+ * new methods:
+ * IO#advise
+ * IO.write(name, string, [offset] )
+ Write `string` to file `name`.
+ Opposite with File.read.
+ * IO.binwrite(name, string, [offset] )
+ binary version of IO.write.
+
+ * Kernel
+ * move #__id__ to BasicObject.
+ * extended method:
+ * Kernel#rand supports range argument
+
+ * Module
+ * new methods:
+ * Module#private_constant
+ * Module#public_constant
+
+ * Random
+ * extended method:
+ * Random.rand supports range argument
+
+ * String
+ * extended method:
+ * String#unpack supports endian modifiers
+ * new method:
+ * String#prepend
+ * String#byteslice
+
+ * Time
+ * extended method:
+ * Time#strftime supports %:z and %::z.
+
+ * Process
+ * Process#maxgroups and Process#maxgroups= now raise NotImplementedError if
+ the platform don't support supplementary groups concept.
+
+* bigdecimal
+
+ * BigDecimal#power and BigDecimal#** support non-integral exponent.
+
+ * Kernel.BigDecimal and BigDecimal.new now accept instances of Integer,
+ Rational, Float, and BigDecimal. If you pass a Rational or a Float to
+ them, you must specify the precision to produce the digits of a BigDecimal.
+
+ * The behavior of BigDecimal#coerce with a Rational is changed. It uses
+ the precision of the receiver BigDecimal to produce the digits of a
+ BigDecimal from the given Rational.
+
+* bigdecimal/util
+
+ * BigDecimal#to_d and Integer#to_d are added.
+
+ * Float#to_d accepts a precision.
+
+ * Rational#to_d raises ArgumentError when passing zero or negative
+ precision.
+
+ * Rational#to_d
+
+ * Zero and an implicit precision is deprecated.
+ This feature is removed at the next release of bigdecimal.
+
+ * A negative precision isn't supported.
+ Be careful it is an incompatible change.
+
+* date
+
+ * Accepts flonum explicitly with limitations.
+ * If the given offset is flonum, DateTime assumes its precision is
+ at most second.
+
+ DateTime.new(2001,2,3,0,0,0,3.0/24) ==
+ DateTime.new(2001,2,3,0,0,0,'+03:00')
+ #=> true
+
+ * If the given operand for -/+ is flonum, DateTime assumes its
+ precision is at most nanosecond.
+
+ DateTime.new(2001,2,3) + 0.5 == DateTime.new(2001,2,3,12)
+ #=> true
+
+ * Precision of offset is always at most second.
+
+ Rational('0.5') == Rational('0.500001') #=> false
+ DateTime.new(2001,2,3,0,0,0,Rational('0.5')) ==
+ DateTime.new(2001,2,3,0,0,0,Rational('0.500001'))
+ #=> true
+
+ * Ignores long offset and far reform day (with warning).
+
+ * Now accepts only:
+
+ -1<=offset<=1 (-24:00..+24:00)
+ 2298874<=start<=2426355 or -/+oo
+ (proleptic Gregorian/Julian mean -/+oo)
+
+ * A method strftime cannot produce huge output (same as Time's one).
+
+ * Even though Date/DateTime can handle far dates, the following causes
+ an exception.
+
+ DateTime.new(1<<10000).strftime('%Y') # Errno::ERANGE
+
+ * Changed the format of inspect.
+ * Changed the format of marshal (but, can load old dumps).
+
+* io/console
+ * new methods:
+ * IO#noecho {|io| }
+ * IO#echo=
+ * IO#echo?
+ * IO#raw {|io| }
+ * IO#raw!
+ * IO#getch
+ * IO#winsize
+ * IO.console
+
+* json
+ * updated to v1.5.4.
+
+* matrix
+ * new classes:
+ * Matrix::EigenvalueDecomposition
+ * Matrix::LUPDecomposition
+ * new methods:
+ * Matrix#diagonal?
+ * Matrix#eigen
+ * Matrix#eigensystem
+ * Matrix#hermitian?
+ * Matrix#lower_triangular?
+ * Matrix#lup
+ * Matrix#lup_decomposition
+ * Matrix#normal?
+ * Matrix#orthogonal?
+ * Matrix#permutation?
+ * Matrix#round
+ * Matrix#symmetric?
+ * Matrix#unitary?
+ * Matrix#upper_triangular?
+ * Matrix#zero?
+ * Vector#magnitude, #norm
+ * Vector#normalize
+ * extended methods:
+ * Matrix#each and #each_with_index can iterate on a subset of the elements
+ * Matrix#find_index returns [row, column] and can iterate on a subset
+ of the elements
+ * Matrix#** implements Numeric exponents (using the eigensystem)
+ * Matrix.zero can build rectangular matrices
+
+* minitest
+ * Minitest has been updated to version 2.2.2.
+ * For full details, see https://github.com/seattlerb/minitest/blob/master/History.txt
+
+* net/http
+ * SNI (Server Name Indication) supported for HTTPS.
+
+ * Allow to configure to wait server returning '100 continue' response
+ before sending HTTP request body. Set Net::HTTP#continue_timeout AND pass
+ 'expect' => '100-continue' to a extra HTTP header.
+
+ For example, the following code sends HTTP header and waits for getting
+ '100 continue' response before sending HTTP request body. When 0.5 [sec]
+ timeout occurs or the server send '100 continue', the client sends HTTP
+ request body.
+ http.continue_timeout = 0.5
+ http.request_post('/continue', 'body=BODY', 'expect' => '100-continue')
+
+ * new method:
+ * Net::HTTPRequest#set_form): Added to support
+ both application/x-www-form-urlencoded and multipart/form-data.
+
+* objspace
+ * new method:
+ * ObjectSpace::memsize_of_all
+
+* openssl
+ * PKey::RSA and PKey::DSA now use the generic X.509 encoding scheme
+ (e.g. used in a X.509 certificate's Subject Public Key Info) when
+ exporting public keys to DER or PEM. Backward compatibility is
+ ensured by (already existing) fallbacks during creation.
+ * OpenSSL::ASN1::Constructive#new and OpenSSL::ASN1::Primitive#new
+ (and the constructors of their sub-classes) will no longer force
+ tagging to be set to :EXPLICIT when tag and/or tag_class are passed
+ as parameters. tagging must be set explicitly.
+ * Support for infinite length encodings via infinite_length attribute.
+ * OpenSSL::PKey.read( file | string [, pwd] ) allows to read arbitrary
+ public/private keys in DER-/PEM-encoded form with an optional password
+ for encrypted PEM encodings.
+ * Add new method OpenSSL::X509::Name#hash_old as a wrapper of
+ X509_NAME_hash_old() defined from OpenSSL 1.0.0. It returns OpenSSL 0.9.8
+ compatible hash value.
+
+* optparse
+ * support for bash/zsh completion.
+
+* Rake
+ * Rake has been upgraded from 0.8.7 to 0.9.2.2. For full release notes see
+ https://github.com/jimweirich/rake/blob/master/CHANGES
+
+* RDoc
+ * RDoc has been upgraded to version 3.9.4. For full release notes see
+ http://docs.seattlerb.org/rdoc/History_txt.html
+
+* rexml
+ * Support Ruby native encoding mechanism and iconv dependency is dropped.
+
+* RubyGems
+ * RubyGems has been upgraded to version 1.8.10. For full release notes see
+ http://rubygems.rubyforge.org/rubygems-update/History_txt.html
+
+* stringio
+ * extended method:
+ * StringIO#set_encoding can get 2nd argument and optional hash.
+
+* test/unit
+ * New arguments:
+ * -j N, --jobs=N: Allow run N testcases at once.
+ * --jobs-status: Show status of jobs when parallel running.
+ * --no-retry: Don't retry testcases which failed when parallel running.
+ * --ruby=RUBY: path to ruby for job(worker) process. optional.
+ * --hide-skip: Hide skip messages. You'll see the number of skips at end of
+ test result.
+
+* uri
+ * new methods:
+ * URI::Generic#hostname
+ * URI::Generic#hostname=
+
+* webrick
+ * new method:
+ * WEBrick::HTTPRequest#continue for generating '100 continue' response.
+ * new logging directive:
+ * %{remote}p for remote (client) port number.
+
+* yaml
+ * The default YAML engine is now Psych. You may downgrade to syck by setting
+ YAML::ENGINE.yamler = 'syck'.
+
+* zlib
+ * new methods:
+ * Zlib.deflate
+ * Zlib.inflate
+
+* FileUtils
+ * extended method:
+ * FileUtils#chmod supports symbolic mode argument.
+
+=== Language changes
+
+* Regexps now support Unicode 6.0. (new characters and scripts)
+
+* [experimental] Regexps now support Age property.
+ Unlike Perl, current implementation takes interpretation of the
+ interpretation of UTS #18.
+ http://www.unicode.org/reports/tr18/
+
+* Turning on/off indentation warnings with directives.
+ ("# -*- warn-indent: true -*-" / "# -*- warn-indent: false -*-")
+
+=== Compatibility issues (excluding feature bug fixes)
+
+ * Rational#to_d
+
+ See above.
diff --git a/doc/NEWS-2.0.0 b/doc/NEWS-2.0.0
new file mode 100644
index 0000000000..f99ba3e882
--- /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 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]
+
+=== 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/contributing.rdoc b/doc/contributing.rdoc
new file mode 100644
index 0000000000..85f7c920a9
--- /dev/null
+++ b/doc/contributing.rdoc
@@ -0,0 +1,345 @@
+= 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 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.
+
+== 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
+
+== 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].
+
+== 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
+* Ncurses (or something)
+* 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
+
+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.
+
+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
+
+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 also need a github account if you don't yet have one.
+
+Next copy the writable url for your fork and add it as a git remote, replace
+"my_username" with your github account name:
+
+ 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.
+
+
+
+
diff --git a/doc/etc.rd b/doc/etc.rd
deleted file mode 100644
index b69f9884ad..0000000000
--- a/doc/etc.rd
+++ /dev/null
@@ -1,75 +0,0 @@
-# etc.rd - -*- mode: rd; coding: us-ascii -*- created at: Fri Jul 14 00:47:15 JST 1995
-=begin
-
-= Etc(Module)
-
-The module to retrieve information from running OS. All operations
-defined in this module are module functions, so that you can include
-Etc module into your class.
-
-== Module Function
-
---- getlogin
-
- returns login name of the user. It this fails, try getpwuid().
-
---- getpwnam(name)
-
- searches in /etc/passwd file (or equivalent database), and
- returns password entry for the user. The return value is an
- passwd structure, which has members described below.
-
- struct passwd
- name # user name(string)
- passwd # encrypted password(string)
- uid # user ID(integer)
- gid # group ID(integer)
- gecos # gecos field(string)
- dir # home directory(string)
- shell # login shell(string)
- # members below are optional
- change # password change time(integer)
- quota # quota value(integer)
- age # password age(integer)
- class # user access class(string)
- comment # comment(string)
- expire # account expiration time(integer)
- end
-
- See getpwnam(3) for detail.
-
---- getpwuid([uid])
-
- returns passwd entry for the specified user id. If uid is
- ommitted, use the value from getuid(). See getpwuid(3) for
- detail.
-
---- getgrgid(gid)
-
- searches in /etc/group file (or equivalent database), and
- returns group entry for the group id. The return value is an
- group structure, which has members described below.
-
- struct group
- name # group name(string)
- passwd # group password(string)
- gid # group ID(integer)
- mem # array of the group member names
- end
-
- See getgrgid(3) for detail.
-
---- getgrnam(name)
-
- returns the group entry for the specified name. The return
- value is the group structure. See getgrnam(3) for detail.
-
---- group
-
- iterates over all group entries.
-
---- passwd
-
- iterates over all passwd entries.
-
-=end
diff --git a/doc/etc.rd.ja b/doc/etc.rd.ja
index 39a1efbff1..b36e05c994 100644
--- a/doc/etc.rd.ja
+++ b/doc/etc.rd.ja
@@ -1,75 +1,75 @@
# etc.rd.ja - -*- mode: rd; coding: euc-jp; -*- created at: Fri Jul 14 00:47:15 JST 1995
=begin
-= Etc(¥â¥¸¥å¡¼¥ë)
+= Etc(モジュール)
-¼Â¹Ô¤·¤Æ¤¤¤ëOS¤«¤é¤Î¾ðÊó¤òÆÀ¤ë¤¿¤á¤Î¥â¥¸¥å¡¼¥ë¡¥¥¯¥é¥¹¤Ë¥¤¥ó¥¯¥ë¡¼¥É
-¤·¤Æ»È¤¦¤³¤È¤â¤Ç¤­¤ë¡¥
+実行ã—ã¦ã„ã‚‹OSã‹ã‚‰ã®æƒ…報を得るãŸã‚ã®ãƒ¢ã‚¸ãƒ¥ãƒ¼ãƒ«ï¼Žã‚¯ãƒ©ã‚¹ã«ã‚¤ãƒ³ã‚¯ãƒ«ãƒ¼ãƒ‰
+ã—ã¦ä½¿ã†ã“ã¨ã‚‚ã§ãる.
== Module Function
--- getlogin
- ¼«Ê¬¤Îlogin̾¤òÊÖ¤¹¡¥¤³¤ì¤¬¼ºÇÔ¤·¤¿¾ì¹ç¤Ïgetpwuid()¤òÍѤ¤¤ë¤È
- Îɤ¤¡¥
+ 自分ã®loginåã‚’è¿”ã™ï¼Žã“れãŒå¤±æ•—ã—ãŸå ´åˆã¯getpwuid()を用ã„ã‚‹ã¨
+ 良ã„.
--- getpwnam(name)
- /etc/passwd¥Õ¥¡¥¤¥ë(¤¢¤ë¤¤¤ÏDBM¥Õ¥¡¥¤¥ë¤äNIS¥Ç¡¼¥¿¥Ù¡¼¥¹)¤ò¸¡
- º÷¤·¡¤name¤Î̾Á°¤ò»ý¤Äpasswd¥¨¥ó¥È¥ê¤òÊÖ¤¹¡¥Ìá¤êÃͤÏpasswd¹½Â¤
- ÂΤǰʲ¼¤Î¥á¥ó¥Ð¤ò»ý¤Ä¡¥
+ /etc/passwdファイル(ã‚ã‚‹ã„ã¯DBMファイルやNISデータベース)を検
+ ç´¢ã—,nameã®åå‰ã‚’æŒã¤passwdエントリを返ã™ï¼Žæˆ»ã‚Šå€¤ã¯passwd構造
+ 体ã§ä»¥ä¸‹ã®ãƒ¡ãƒ³ãƒã‚’æŒã¤ï¼Ž
struct passwd
- name # ¥æ¡¼¥¶Ì¾(ʸ»úÎó)
- passwd # ¥Ñ¥¹¥ï¡¼¥É(ʸ»úÎó)
- uid # ¥æ¡¼¥¶ID(À°¿ô)
- gid # ¥°¥ë¡¼¥×ID(À°¿ô)
- gecos # gecos¥Õ¥£¡¼¥ë¥É(ʸ»úÎó)
- dir # ¥Û¡¼¥à¥Ç¥£¥ì¥¯¥È¥ê(ʸ»úÎó)
- shell # ¥í¥°¥¤¥ó¥·¥§¥ë(ʸ»úÎó)
- # °Ê¹ß¤Î¥á¥ó¥Ð¤Ï¥·¥¹¥Æ¥à¤Ë¤è¤Ã¤Æ¤ÏÄ󶡤µ¤ì¤Ê¤¤¡¥
- change # ¥Ñ¥¹¥ï¡¼¥ÉÊѹ¹»þ´Ö(À°¿ô)
- quota # ¥¯¥©¡¼¥¿(À°¿ô)
- age # ¥¨¡¼¥¸(À°¿ô)
- class # ¥æ¡¼¥¶¥¢¥¯¥»¥¹¥¯¥é¥¹(ʸ»úÎó)
- comment # ¥³¥á¥ó¥È(ʸ»úÎó)
- expire # ¥¢¥«¥¦¥ó¥ÈÍ­¸ú´ü¸Â(À°¿ô)
+ name # ユーザå(文字列)
+ passwd # パスワード(文字列)
+ uid # ユーザID(整数)
+ gid # グループID(整数)
+ gecos # gecosフィールド(文字列)
+ dir # ホームディレクトリ(文字列)
+ shell # ログインシェル(文字列)
+ # 以é™ã®ãƒ¡ãƒ³ãƒã¯ã‚·ã‚¹ãƒ†ãƒ ã«ã‚ˆã£ã¦ã¯æä¾›ã•れãªã„.
+ change # パスワード変更時間(整数)
+ quota # クォータ(整数)
+ age # エージ(整数)
+ class # ユーザアクセスクラス(文字列)
+ comment # コメント(文字列)
+ expire # アカウント有効期é™(æ•´æ•°)
end
- ¾ÜºÙ¤Ïgetpwnam(3)¤ò»²¾È¤Î¤³¤È¡¥
+ 詳細ã¯getpwnam(3)ã‚’å‚ç…§ã®ã“ã¨ï¼Ž
--- getpwuid([uid])
- uid¤ò¥æ¡¼¥¶ID¤È¤¹¤ëpasswd¥¨¥ó¥È¥ê¤òÊÖ¤¹¡¥Ìá¤êÃͤÏgetpwnam()¤È
- ƱÍͤǤ¢¤ë¡¥°ú¿ô¤ò¾Êά¤·¤¿¾ì¹ç¤Ë¤Ïgetuid()¤ÎÃͤòÍѤ¤¤ë¡¥¾ÜºÙ¤Ï
- getpwuid(3)¤ò»²¾È¤Î¤³¤È¡¥
+ uidをユーザIDã¨ã™ã‚‹passwdエントリを返ã™ï¼Žæˆ»ã‚Šå€¤ã¯getpwnam()ã¨
+ åŒæ§˜ã§ã‚る.引数をçœç•¥ã—ãŸå ´åˆã«ã¯getuid()ã®å€¤ã‚’用ã„る.詳細ã¯
+ getpwuid(3)ã‚’å‚ç…§ã®ã“ã¨ï¼Ž
--- getgrgid(gid)
- /etc/group¥Õ¥¡¥¤¥ë(¤¢¤ë¤¤¤Ï¡Ägetpwnam»²¾È)¤ò¸¡º÷¤·¡¤gid¤ò¥°¥ë¡¼
- ¥×ID¤È¤¹¤ë¥°¥ë¡¼¥×¥¨¥ó¥È¥ê¤òÊÖ¤¹¡¥Ìá¤êÃͤÏgroup¹½Â¤ÂΤǰʲ¼¤Î
- ¥á¥ó¥Ð¤ò»ý¤Ä¡¥
+ /etc/groupファイル(ã‚ã‚‹ã„ã¯â€¦getpwnamå‚ç…§)を検索ã—,gidをグルー
+ プIDã¨ã™ã‚‹ã‚°ãƒ«ãƒ¼ãƒ—エントリを返ã™ï¼Žæˆ»ã‚Šå€¤ã¯group構造体ã§ä»¥ä¸‹ã®
+ メンãƒã‚’æŒã¤ï¼Ž
struct group
- name # ¥°¥ë¡¼¥×̾(ʸ»úÎó)
- passwd # ¥°¥ë¡¼¥×¤Î¥Ñ¥¹¥ï¡¼¥É(ʸ»úÎó)
- gid # ¥°¥ë¡¼¥×ID(À°¿ô)
- mem # ¥°¥ë¡¼¥×¥á¥ó¥Ð̾¤ÎÇÛÎó
+ name # グループå(文字列)
+ passwd # グループã®ãƒ‘スワード(文字列)
+ gid # グループID(整数)
+ mem # グループメンãƒåã®é…列
end
- ¾ÜºÙ¤Ïgetgrgid(3)¤ò»²¾È¤Î¤³¤È¡¥
+ 詳細ã¯getgrgid(3)ã‚’å‚ç…§ã®ã“ã¨ï¼Ž
--- getgrnam(name)
- name¤È¤¤¤¦Ì¾Á°¤Î¥°¥ë¡¼¥×¥¨¥ó¥È¥ê¤òÊÖ¤¹¡¥Ìá¤êÃͤÏgetgrgid()¤ÈƱ
- ÍͤǤ¢¤ë¡¥¾ÜºÙ¤Ïgetgrnam(3)¤ò»²¾È¡¥
+ nameã¨ã„ã†åå‰ã®ã‚°ãƒ«ãƒ¼ãƒ—エントリを返ã™ï¼Žæˆ»ã‚Šå€¤ã¯getgrgid()ã¨åŒ
+ 様ã§ã‚る.詳細ã¯getgrnam(3)ã‚’å‚照.
--- group
- Á´¤Æ¤Î¥°¥ë¡¼¥×¥¨¥ó¥È¥ê¤ò½ç¤Ë¥¢¥¯¥»¥¹¤¹¤ë¤¿¤á¤Î¥¤¥Æ¥ì¡¼¥¿¡¥
+ å…¨ã¦ã®ã‚°ãƒ«ãƒ¼ãƒ—エントリを順ã«ã‚¢ã‚¯ã‚»ã‚¹ã™ã‚‹ãŸã‚ã®ã‚¤ãƒ†ãƒ¬ãƒ¼ã‚¿ï¼Ž
--- passwd
- Á´¤Æ¤Îpasswd¥¨¥ó¥È¥ê¤ò½ç¤Ë¥¢¥¯¥»¥¹¤¹¤ë¤¿¤á¤Î¥¤¥Æ¥ì¡¼¥¿¡¥
+ å…¨ã¦ã®passwdエントリを順ã«ã‚¢ã‚¯ã‚»ã‚¹ã™ã‚‹ãŸã‚ã®ã‚¤ãƒ†ãƒ¬ãƒ¼ã‚¿ï¼Ž
=end
diff --git a/doc/forwardable.rd b/doc/forwardable.rd
deleted file mode 100644
index 0eca25b90a..0000000000
--- a/doc/forwardable.rd
+++ /dev/null
@@ -1,83 +0,0 @@
- -- forwardable.rb
-
- $Release Version: 1.1 $
- $Revision$
- Original version by Tosh
-
-=begin
-
-= Forwardable
-
-A Module to define delegations for selected methods to a class.
-
-== Usage
-
-Using through extending the class.
-
- class Foo
- extend Forwardable
-
- def_delegators("@out", "printf", "print")
- def_delegators(:@in, :gets)
- def_delegator(:@contents, :[], "content_at")
- end
- f = Foo.new
- f.printf ...
- f.gets
- f.content_at(1)
-
-== Methods
-
---- Forwardable#def_instance_delegators(accessor, *methods)
-
- adding the delegations for each method of ((|methods|)) to
- ((|accessor|)).
-
---- Forwardable#def_instance_delegator(accessor, method, ali = method)
-
- adding the delegation for ((|method|)) to ((|accessor|)). When
- you give optional argument ((|ali|)), ((|ali|)) is used as the
- name of the delegation method, instead of ((|method|)).
-
---- Forwardable#def_delegators(accessor, *methods)
-
- the alias of ((|Forwardable#def_instance_delegators|)).
-
---- Forwardable#def_delegator(accessor, method, ali = method)
-
- the alias of ((|Forwardable#def_instance_delegator|)).
-
-= SingleForwardable
-
-a Module to define delegations for selected methods to an object.
-
-== Usage
-
-Using through extending the object.
-
- g = Goo.new
- g.extend SingleForwardable
- g.def_delegator("@out", :puts)
- g.puts ...
-
-== Methods
-
---- SingleForwardable#def_singleton_delegators(accessor, *methods)
-
- adding the delegations for each method of ((|methods|)) to
- ((|accessor|)).
-
---- SingleForwardable#def_singleton_delegator(accessor, method, ali = method)
-
- adding the delegation for ((|method|)) to ((|accessor|)). When
- you give optional argument ((|ali|)), ((|ali|)) is used as the
- name of the delegation method, instead of ((|method|)).
-
---- SingleForwardable#def_delegators(accessor, *methods)
-
- the alias of ((|SingleForwardable#def_instance_delegators|)).
-
---- SingleForwardable#def_delegator(accessor, method, ali = method)
-
- the alias of ((|SingleForwardable#def_instance_delegator|)).
-=end
diff --git a/doc/forwardable.rd.ja b/doc/forwardable.rd.ja
index 48186b111f..6a5ff2e236 100644
--- a/doc/forwardable.rd.ja
+++ b/doc/forwardable.rd.ja
@@ -5,11 +5,11 @@
=begin
= Forwardable
-¥¯¥é¥¹¤ËÂФ·¥á¥½¥Ã¥É¤Î°Ñ¾ùµ¡Ç½¤òÄêµÁ¤·¤Þ¤¹.
+クラスã«å¯¾ã—メソッドã®å§”譲機能を定義ã—ã¾ã™.
-== »È¤¤Êý
+== ä½¿ã„æ–¹
-¥¯¥é¥¹¤ËÂФ·¤Æextend¤·¤Æ»È¤¤¤Þ¤¹.
+クラスã«å¯¾ã—ã¦extendã—ã¦ä½¿ã„ã¾ã™.
class Foo
extend Forwardable
@@ -23,58 +23,58 @@
f.gets
f.content_at(1)
-== ¥á¥½¥Ã¥É
+== メソッド
--- Forwardable#def_instance_delegators(accessor, *methods)
- ((|methods|))¤ÇÅϤµ¤ì¤¿¥á¥½¥Ã¥É¤Î¥ê¥¹¥È¤ò((|accessor¤Ë|))°Ñ¾ù¤¹¤ë
- ¤è¤¦¤Ë¤·¤Þ¤¹.
+ ((|methods|))ã§æ¸¡ã•れãŸãƒ¡ã‚½ãƒƒãƒ‰ã®ãƒªã‚¹ãƒˆã‚’((|accessorã«|))委譲ã™ã‚‹
+ よã†ã«ã—ã¾ã™.
--- Forwardable#def_instance_delegator(accessor, method, ali = method)
- ((||method|))¤ÇÅϤµ¤ì¤¿¥á¥½¥Ã¥É¤ò((|accessor|))¤Ë°Ñ¾ù¤¹¤ë¤è¤¦¤Ë¤·
- ¤Þ¤¹. ((|ali|))¤¬°ú¿ô¤È¤·¤ÆÅϤµ¤ì¤¿¤È¤­¤Ï, ¥á¥½¥Ã¥É((|ali|))¤¬¸Æ¤Ð
- ¤ì¤¿¤È¤­¤Ë¤Ï, ((|accessor|))¤ËÂФ·((|method|))¤ò¸Æ¤Ó½Ð¤·¤Þ¤¹.
+ ((||method|))ã§æ¸¡ã•れãŸãƒ¡ã‚½ãƒƒãƒ‰ã‚’((|accessor|))ã«å§”è­²ã™ã‚‹ã‚ˆã†ã«ã—
+ ã¾ã™. ((|ali|))ãŒå¼•æ•°ã¨ã—ã¦æ¸¡ã•れãŸã¨ãã¯, メソッド((|ali|))ãŒå‘¼ã°
+ れãŸã¨ãã«ã¯, ((|accessor|))ã«å¯¾ã—((|method|))を呼ã³å‡ºã—ã¾ã™.
--- Forwardable#def_delegators(accessor, *methods)
- ((|Forwardable#def_instance_delegators|))¤ÎÊÌ̾¤Ç¤¹.
+ ((|Forwardable#def_instance_delegators|))ã®åˆ¥åã§ã™.
--- Forwardable#def_delegator(accessor, method, ali = method)
- ((|Forwardable#def_instance_delegator|))¤ÎÊÌ̾¤Ç¤¹.
+ ((|Forwardable#def_instance_delegator|))ã®åˆ¥åã§ã™.
= SingleForwardable
-¥ª¥Ö¥¸¥§¥¯¥È¤ËÂФ·, ¥á¥½¥Ã¥É¤Î°Ñ¾ùµ¡Ç½¤òÄêµÁ¤·¤Þ¤¹.
+オブジェクトã«å¯¾ã—, メソッドã®å§”譲機能を定義ã—ã¾ã™.
-== »È¤¤Êý
+== ä½¿ã„æ–¹
-¥ª¥Ö¥¸¥§¥¯¥È¤ËÂФ·¤Æ((|extend|))¤·¤Æ»È¤¤¤Þ¤¹.
+オブジェクトã«å¯¾ã—ã¦((|extend|))ã—ã¦ä½¿ã„ã¾ã™.
g = Goo.new
g.extend SingleForwardable
g.def_delegator("@out", :puts)
g.puts ...
-== ¥á¥½¥Ã¥É
+== メソッド
--- SingleForwardable#def_singleton_delegators(accessor, *methods)
- ((|methods|))¤ÇÅϤµ¤ì¤¿¥á¥½¥Ã¥É¤Î¥ê¥¹¥È¤ò((|accessor|))¤Ë°Ñ¾ù¤¹¤ë
- ¤è¤¦¤Ë¤·¤Þ¤¹.
+ ((|methods|))ã§æ¸¡ã•れãŸãƒ¡ã‚½ãƒƒãƒ‰ã®ãƒªã‚¹ãƒˆã‚’((|accessor|))ã«å§”è­²ã™ã‚‹
+ よã†ã«ã—ã¾ã™.
--- SingleForwardable#def_singleton_delegator(accessor, method, ali = method)
- ((|method|))¤ÇÅϤµ¤ì¤¿¥á¥½¥Ã¥É¤ò((|accessor|))¤Ë°Ñ¾ù¤¹¤ë¤è¤¦¤Ë¤·¤Þ
- ¤¹. ((|ali|))¤¬°ú¿ô¤È¤·¤ÆÅϤµ¤ì¤¿¤È¤­¤Ï, ¥á¥½¥Ã¥É((|ali|))¤¬¸Æ¤Ð¤ì
- ¤¿¤È¤­¤Ë¤Ï, ((|accessor|))¤ËÂФ·((|method|))¤ò¸Æ¤Ó½Ð¤·¤Þ¤¹.
+ ((|method|))ã§æ¸¡ã•れãŸãƒ¡ã‚½ãƒƒãƒ‰ã‚’((|accessor|))ã«å§”è­²ã™ã‚‹ã‚ˆã†ã«ã—ã¾
+ ã™. ((|ali|))ãŒå¼•æ•°ã¨ã—ã¦æ¸¡ã•れãŸã¨ãã¯, メソッド((|ali|))ãŒå‘¼ã°ã‚Œ
+ ãŸã¨ãã«ã¯, ((|accessor|))ã«å¯¾ã—((|method|))を呼ã³å‡ºã—ã¾ã™.
--- SingleForwardable#def_delegators(accessor, *methods)
- ((|SingleForwardable#def_singleton_delegators|))¤ÎÊÌ̾¤Ç¤¹.
+ ((|SingleForwardable#def_singleton_delegators|))ã®åˆ¥åã§ã™.
--- SingleForwardable#def_delegator(accessor, method, ali = method)
- ((|SingleForwardable#def_singleton_delegator|))¤ÎÊÌ̾¤Ç¤¹.
+ ((|SingleForwardable#def_singleton_delegator|))ã®åˆ¥åã§ã™.
=end
diff --git a/doc/globals.rdoc b/doc/globals.rdoc
new file mode 100644
index 0000000000..06355b187a
--- /dev/null
+++ b/doc/globals.rdoc
@@ -0,0 +1,69 @@
+# -*- mode: rdoc; coding: utf-8; fill-column: 74; -*-
+
+== Pre-defined variables
+
+$!:: The exception information message set by 'raise'.
+$@:: Array of backtrace of the last exception thrown.
+$&:: The string matched by the last successful match.
+$`:: The string to the left of the last successful match.
+$':: The string to the right of the last successful match.
+$+:: The highest group matched by the last successful match.
+$1:: The Nth group of the last successful match. May be > 1.
+$~:: The information about the last match in the current scope.
+$=:: The flag for case insensitive, nil by default.
+$/:: The input record separator, newline by default.
+$\:: The output record separator for the print and IO#write. Default is nil.
+$,:: The output field separator for the print and Array#join.
+$;:: The default separator for String#split.
+$.:: The current input line number of the last file that was read.
+$<:: The virtual concatenation file of the files given on command line (or from $stdin if no files were given).
+$>:: The default output for print, printf. $stdout by default.
+$_:: 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. 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
+ output prints each exception raised to $stderr (but not its
+ 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.
+$FILENAME:: Current input file from $<. Same as $<.filename.
+$LOAD_PATH:: The alias to the $:.
+$stderr:: The current standard error output.
+$stdin:: The current standard input.
+$stdout:: The current standard output.
+$VERBOSE:: The verbose flag, which is set by the -w or -v switch. Setting
+ this to a true value enables warnings as if -w or -v were given
+ on the command line. Setting this to nil disables warnings,
+ 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.
+$-F:: The alias to $;.
+$-i:: In in-place-edit mode, this variable holds the extension, otherwise nil.
+$-I:: The alias to $:.
+$-l:: True if option -l is set. Read-only variable.
+$-p:: True if option -p is set. Read-only variable.
+$-v:: An alias of $VERBOSE. See $VERBOSE above for further discussion.
+$-w:: An alias of $VERBOSE. See $VERBOSE above for further discussion.
+
+== Pre-defined global constants
+
+TRUE:: The typical true value.
+FALSE:: The false itself.
+NIL:: The nil itself.
+STDIN:: The standard input. The default value for $stdin.
+STDOUT:: The standard output. The default value for $stdout.
+STDERR:: The standard error output. The default value for $stderr.
+ENV:: The hash contains current environment variables.
+ARGF:: The alias to the $<.
+ARGV:: The alias to the $*.
+DATA:: The file object of the script, pointing just after __END__.
+RUBY_VERSION:: The ruby version string (VERSION was deprecated).
+RUBY_RELEASE_DATE:: The release date string.
+RUBY_PLATFORM:: The platform identifier.
+
diff --git a/doc/irb/irb-tools.rd.ja b/doc/irb/irb-tools.rd.ja
index 7711f96e08..3c95faeb8a 100644
--- a/doc/irb/irb-tools.rd.ja
+++ b/doc/irb/irb-tools.rd.ja
@@ -1,70 +1,70 @@
-irb´ØÏ¢¤ª¤Þ¤±¥³¥Þ¥ó¥É¤È¥é¥¤¥Ö¥é¥ê
+irb関連ãŠã¾ã‘コマンドã¨ãƒ©ã‚¤ãƒ–ラリ
$Release Version: 0.7.1 $
$Revision$
by Keiju ISHITSUKA(Nihon Rational Co.,Ltd.)
=begin
-:¥³¥Þ¥ó¥É:
+:コマンド:
* rtags -- ruby tags command
-:´Ø¿ô¥é¥¤¥Ö¥é¥ê:
+:関数ライブラリ:
* xmp -- irb version of gotoken xmp-function
-:¥¯¥é¥¹¥é¥¤¥Ö¥é¥ê:
+:クラスライブラリ:
* frame.rb -- frame tracer
* completion.rb -- irb completor
= rtags
-rtags¤ÏemacsµÚ¤ÓviÍѤÎ, TAG¥Õ¥¡¥¤¥ë¤ò¤Ä¤¯¤ë¥³¥Þ¥ó¥É¤Ç¤¹.
+rtagsã¯emacsåŠã³vi用ã®, TAGファイルをã¤ãるコマンドã§ã™.
-== »È¤¤Êý
+== ä½¿ã„æ–¹
rtags [-vi] file....
-¥«¥ì¥ó¥È¥Ç¥£¥ì¥¯¥È¥ê¤ËemacsÍѤÎTAGS¥Õ¥¡¥¤¥ë¤¬¤Ç¤­¤Þ¤¹. -vi¥ª¥×¥·¥ç¥ó¤ò
-¤Ä¤±¤¿»þ¤Ë¤ÏviÍѤÎtags¥Õ¥¡¥¤¥ë¤òºîÀ®¤·¤Þ¤¹.
+カレントディレクトリã«emacs用ã®TAGSファイルãŒã§ãã¾ã™. -viオプションを
+ã¤ã‘ãŸæ™‚ã«ã¯vi用ã®tagsファイルを作æˆã—ã¾ã™.
-emacs¤Î¾ì¹ç, Ä̾ï¤Îetags.el¤¬¤½¤Î¤Þ¤Þ»È¤¨¤Þ¤¹. ¸¡º÷²Äǽ¤Ê¤Î¤Ï,
+emacsã®å ´åˆ, 通常ã®etags.elãŒãã®ã¾ã¾ä½¿ãˆã¾ã™. 検索å¯èƒ½ãªã®ã¯,
-* ¥¯¥é¥¹
-* ¥á¥½¥Ã¥É
-* ÆÃ°Û¥á¥½¥Ã¥É
+* クラス
+* メソッド
+* 特異メソッド
* alias
-* attr¤ÇÀë¸À¤µ¤ì¤¿¥¢¥¯¥»¥µ(¥Ñ¥é¥á¡¼¥¿¤¬¥·¥ó¥Ü¥ë¤«Ê¸»úÎó¥ê¥Æ¥é¥ë¤Ë¸Â¤ë)
-* attr_XXX¤ÇÀë¸À¤µ¤ì¤¿¥¢¥¯¥»¥µ(¥Ñ¥é¥á¡¼¥¿¤¬¥·¥ó¥Ü¥ë¤«Ê¸»úÎó¥ê¥Æ¥é¥ë¤Ë¸Â¤ë)
+* attrã§å®£è¨€ã•れãŸã‚¢ã‚¯ã‚»ã‚µ(パラメータãŒã‚·ãƒ³ãƒœãƒ«ã‹æ–‡å­—列リテラルã«é™ã‚‹)
+* attr_XXXã§å®£è¨€ã•れãŸã‚¢ã‚¯ã‚»ã‚µ(パラメータãŒã‚·ãƒ³ãƒœãƒ«ã‹æ–‡å­—列リテラルã«é™ã‚‹)
-¤Ç¤¹.
+ã§ã™.
-C¤Ê¤É¤Ç»È¤Ã¤Æ¤¤¤ë¤Î¤È°ã¤¦¤Î¤Ï, ¥³¥ó¥×¥ê¡¼¥·¥ç¥ó¤Ë´Ø¤¹¤ëÉôʬ¤Ç,
+Cãªã©ã§ä½¿ã£ã¦ã„ã‚‹ã®ã¨é•ã†ã®ã¯, コンプリーションã«é–¢ã™ã‚‹éƒ¨åˆ†ã§,
-´Ø¿ô̾¤Ï,
+関数åã¯,
- ´Ø¿ô̾(
+ 関数å(
-¥¯¥é¥¹¤Ï,
+クラスã¯,
- ::¥¯¥é¥¹Ì¾::....::¥¯¥é¥¹Ì¾
+ ::クラスå::....::クラスå
-¥á¥½¥Ã¥É¤Ï,
+メソッドã¯,
- ::¥¯¥é¥¹Ì¾::....::¥¯¥é¥¹Ì¾#¥á¥½¥Ã¥É̾
+ ::クラスå::....::クラスå#メソッドå
-ÆÃ°Û¥á¥½¥Ã¥É(¥¯¥é¥¹¥á¥½¥Ã¥É)¤Ï
+特異メソッド(クラスメソッド)ã¯
- ::¥¯¥é¥¹Ì¾::....::¥¯¥é¥¹Ì¾.¥á¥½¥Ã¥É̾
+ ::クラスå::....::クラスå.メソッドå
-¤Ç¥³¥ó¥×¥ê¡¼¥·¥ç¥ó¤ò¹Ô¤Ê¤¦¤È¤³¤í¤Ç¤¹.
+ã§ã‚³ãƒ³ãƒ—リーションを行ãªã†ã¨ã“ã‚ã§ã™.
= xmp.rb
-¤´¤È¤±¤óxmp¤Î¾å°Ì¸ß´¹¥Ð¡¼¥¸¥ç¥ó¤Ç¤¹. ¤¿¤À, Èó¾ï¤Ë½Å¤¤¤Î¤Ç¤´¤È¤±¤óxmp¤Ç
-¤ÏÂбþ¤Ç¤­¤Ê¤¤»þ¤Ë, »ÈÍѤ¹¤ë¤ÈÎɤ¤¤Ç¤·¤ç¤¦.
+ã”ã¨ã‘ã‚“xmpã®ä¸Šä½äº’æ›ãƒãƒ¼ã‚¸ãƒ§ãƒ³ã§ã™. ãŸã , éžå¸¸ã«é‡ã„ã®ã§ã”ã¨ã‘ã‚“xmpã§
+ã¯å¯¾å¿œã§ããªã„時ã«, 使用ã™ã‚‹ã¨è‰¯ã„ã§ã—ょã†.
-== »È¤¤Êý
+== ä½¿ã„æ–¹
-=== ´Ø¿ô¤È¤·¤Æ»È¤¦.
+=== 関数ã¨ã—ã¦ä½¿ã†.
require "irb/xmp"
xmp <<END
@@ -77,10 +77,10 @@ C¤Ê¤É¤Ç»È¤Ã¤Æ¤¤¤ë¤Î¤È°ã¤¦¤Î¤Ï, ¥³¥ó¥×¥ê¡¼¥·¥ç¥ó¤Ë´Ø¤¹¤ëÉôʬ¤Ç,
foo
==>1
-=== XMP¥¤¥ó¥¹¥¿¥ó¥¹¤òÍѤ¤¤ë.
+=== XMPインスタンスを用ã„ã‚‹.
-¤³¤Î¾ì¹ç¤Ï, XMP¤¬¥³¥ó¥Æ¥­¥¹¥È¾ðÊó¤ò»ý¤Ä¤Î¤Ç, ÊÑ¿ô¤ÎÃͤʤɤòÊÝ»ý¤·¤Æ¤¤
-¤Þ¤¹.
+ã“ã®å ´åˆã¯, XMPãŒã‚³ãƒ³ãƒ†ã‚­ã‚¹ãƒˆæƒ…報をæŒã¤ã®ã§, 変数ã®å€¤ãªã©ã‚’ä¿æŒã—ã¦ã„
+ã¾ã™.
require "irb/xmp"
xmp = XMP.new
@@ -99,50 +99,50 @@ C¤Ê¤É¤Ç»È¤Ã¤Æ¤¤¤ë¤Î¤È°ã¤¦¤Î¤Ï, ¥³¥ó¥×¥ê¡¼¥·¥ç¥ó¤Ë´Ø¤¹¤ëÉôʬ¤Ç,
foo
==>1
-== ¥³¥ó¥Æ¥­¥¹¥È¤Ë´Ø¤·¤Æ
+== コンテキストã«é–¢ã—ã¦
-XMP¥á¥½¥Ã¥É·²¤Î¥³¥ó¥Æ¥­¥¹¥È¤Ï, ¸Æ¤Ó½Ð¤¹Á°¤Î¥³¥ó¥Æ¥­¥¹¥È¤Çɾ²Á¤µ¤ì¤Þ¤¹.
-ÌÀ¼¨Åª¤Ë¥³¥ó¥Æ¥­¥¹¥È¤ò»ØÄꤹ¤ë¤È¤½¤Î¥³¥ó¥Æ¥­¥¹¥È¤Çɾ²Á¤·¤Þ¤¹.
+XMPメソッド群ã®ã‚³ãƒ³ãƒ†ã‚­ã‚¹ãƒˆã¯, 呼ã³å‡ºã™å‰ã®ã‚³ãƒ³ãƒ†ã‚­ã‚¹ãƒˆã§è©•価ã•れã¾ã™.
+明示的ã«ã‚³ãƒ³ãƒ†ã‚­ã‚¹ãƒˆã‚’指定ã™ã‚‹ã¨ãã®ã‚³ãƒ³ãƒ†ã‚­ã‚¹ãƒˆã§è©•価ã—ã¾ã™.
-Îã:
+例:
xmp "foo", an_binding
-:Ãí:
-¥Þ¥ë¥Á¥¹¥ì¥Ã¥É¤Ë¤ÏÂбþ¤·¤Æ¤¤¤Þ¤»¤ó.
+:注:
+マルãƒã‚¹ãƒ¬ãƒƒãƒ‰ã«ã¯å¯¾å¿œã—ã¦ã„ã¾ã›ã‚“.
= frame.rb
-¸½ºß¼Â¹ÔÃæ¤Î¥Õ¥ì¡¼¥à¾ðÊó¤ò¼è¤ê°·¤¦¤¿¤á¤Î¥¯¥é¥¹¤Ç¤¹.
+ç¾åœ¨å®Ÿè¡Œä¸­ã®ãƒ•レーム情報をå–り扱ã†ãŸã‚ã®ã‚¯ãƒ©ã‚¹ã§ã™.
* IRB::Frame.top(n = 0)
- ¾å¤«¤énÈÖÌܤΥ³¥ó¥Æ¥­¥¹¥È¤ò¼è¤ê½Ð¤·¤Þ¤¹. n¤Ï0¤¬ºÇ¾å°Ì¤Ë¤Ê¤ê¤Þ¤¹.
+ 上ã‹ã‚‰n番目ã®ã‚³ãƒ³ãƒ†ã‚­ã‚¹ãƒˆã‚’å–り出ã—ã¾ã™. nã¯0ãŒæœ€ä¸Šä½ã«ãªã‚Šã¾ã™.
* IRB::Frame.bottom(n = 0)
- ²¼¤«¤énÈÖÌܤΥ³¥ó¥Æ¥­¥¹¥È¤ò¼è¤ê½Ð¤·¤Þ¤¹. n¤Ï0¤¬ºÇ²¼°Ì¤Ë¤Ê¤ê¤Þ¤¹.
+ 下ã‹ã‚‰n番目ã®ã‚³ãƒ³ãƒ†ã‚­ã‚¹ãƒˆã‚’å–り出ã—ã¾ã™. nã¯0ãŒæœ€ä¸‹ä½ã«ãªã‚Šã¾ã™.
* IRB::Frame.sender
- ¥»¥ó¥À¤Ë¤Ê¤Ã¤Æ¤¤¤ë¥ª¥Ö¥¸¥§¥¯¥È¤ò¼è¤ê½Ð¤·¤Þ¤¹. ¥»¥ó¥À¤È¤Ï, ¤½¤Î¥á¥½¥Ã
- ¥É¤ò¸Æ¤Ó½Ð¤·¤¿Â¦¤Îself¤Î¤³¤È¤Ç¤¹.
+ センダã«ãªã£ã¦ã„るオブジェクトをå–り出ã—ã¾ã™. センダã¨ã¯, ãã®ãƒ¡ã‚½ãƒƒ
+ ドを呼ã³å‡ºã—ãŸå´ã®selfã®ã“ã¨ã§ã™.
-:Ãí:
-set_trace_func¤òÍѤ¤¤ÆRuby¤Î¼Â¹Ô¤ò¥È¥ì¡¼¥¹¤·¤Æ¤¤¤Þ¤¹. ¥Þ¥ë¥Á¥¹¥ì¥Ã¥É¤Ë
-¤ÏÂбþ¤·¤Æ¤¤¤Þ¤»¤ó.
+:注:
+set_trace_funcを用ã„ã¦Rubyã®å®Ÿè¡Œã‚’トレースã—ã¦ã„ã¾ã™. マルãƒã‚¹ãƒ¬ãƒƒãƒ‰ã«
+ã¯å¯¾å¿œã—ã¦ã„ã¾ã›ã‚“.
= completion.rb
-irb¤Îcompletionµ¡Ç½¤òÄ󶡤¹¤ë¤â¤Î¤Ç¤¹.
+irbã®completion機能をæä¾›ã™ã‚‹ã‚‚ã®ã§ã™.
-== »È¤¤Êý
+== ä½¿ã„æ–¹
% irb -r irb/completion
-¤È¤¹¤ë¤«, ~/.irbrc Ãæ¤Ë
+ã¨ã™ã‚‹ã‹, ~/.irbrc 中ã«
require "irb/completion"
-¤òÆþ¤ì¤Æ¤¯¤À¤µ¤¤. irb¼Â¹ÔÃæ¤Ë require "irb/completion" ¤·¤Æ¤â¤è¤¤¤Ç¤¹.
+を入れã¦ãã ã•ã„. irb実行中㫠require "irb/completion" ã—ã¦ã‚‚よã„ã§ã™.
-irb¼Â¹ÔÃæ¤Ë (TAB) ¤ò²¡¤¹¤È¥³¥ó¥×¥ì¡¼¥·¥ç¥ó¤·¤Þ¤¹.
+irb実行中㫠(TAB) を押ã™ã¨ã‚³ãƒ³ãƒ—レーションã—ã¾ã™.
-¥È¥Ã¥×¥ì¥Ù¥ë¤Ç(TAB)¤ò²¡¤¹¤È¤¹¤Ù¤Æ¤Î¹½Ê¸Í×ÁÇ, ¥¯¥é¥¹, ¥á¥½¥Ã¥É¤Î¸õÊ䤬¤Ç
-¤Þ¤¹. ¸õÊ䤬ͣ°ì¤Ê¤é¤Ð´°Á´¤ËÊä´°¤·¤Þ¤¹.
+トップレベルã§(TAB)を押ã™ã¨ã™ã¹ã¦ã®æ§‹æ–‡è¦ç´ , クラス, メソッドã®å€™è£œãŒã§
+ã¾ã™. 候補ãŒå”¯ä¸€ãªã‚‰ã°å®Œå…¨ã«è£œå®Œã—ã¾ã™.
irb(main):001:0> in
in inspect instance_eval
@@ -153,8 +153,8 @@ irb¼Â¹ÔÃæ¤Ë (TAB) ¤ò²¡¤¹¤È¥³¥ó¥×¥ì¡¼¥·¥ç¥ó¤·¤Þ¤¹.
irb(main):002:0> foo = Object.new
#<Object:0x4027146c>
- ((|ÊÑ¿ô̾.|))¤Î¸å¤Ë(TAB)¤ò²¡¤¹¤È, ¤½¤Î¥ª¥Ö¥¸¥§¥¯¥È¤Î¥á¥½¥Ã¥É°ìÍ÷¤¬¤Ç¤Þ
- ¤¹.
+ ((|変数å.|))ã®å¾Œã«(TAB)を押ã™ã¨, ãã®ã‚ªãƒ–ジェクトã®ãƒ¡ã‚½ãƒƒãƒ‰ä¸€è¦§ãŒã§ã¾
+ ã™.
irb(main):003:0> foo.
foo.== foo.frozen? foo.protected_methods
diff --git a/doc/irb/irb.rd b/doc/irb/irb.rd
deleted file mode 100644
index 75274006e1..0000000000
--- a/doc/irb/irb.rd
+++ /dev/null
@@ -1,391 +0,0 @@
-irb -- interactive ruby
- $Release Version: 0.9 $
- $Revision$
- by Keiju ISHITSUKA(keiju@ishitsuka.com)
- by gotoken-san who is original translater from japanese version
-
-=begin
-= What is irb?
-
-irb stands for `interactive ruby'. irb is a tool to execute interactively
-ruby expressions read from stdin.
-
-= Invoking
-
- % irb
-
-= Usage
-
-Use of irb is easy if you know ruby. Executing irb, prompts are
-displayed as follows. Then, enter expression of ruby. A input is
-executed when it is syntacticaly completed.
-
- dim% irb
- irb(main):001:0> 1+2
- 3
- irb(main):002:0> class Foo
- irb(main):003:1> def foo
- irb(main):004:2> print 1
- irb(main):005:2> end
- irb(main):006:1> end
- nil
- irb(main):007:0>
-
-And, Readline extesion module can be used with irb. Using Readline
-is the standard default action if Readline is installed.
-
-= Command line option
-
- irb.rb [options] file_name opts
- options:
- -f suppress read ~/.irbrc
- -m bc mode (fraction or matrix are available)
- -d set $DEBUG to true (same as `ruby -d')
- -Kc same as `ruby -Kc'
- -r load-module same as `ruby -r'
- --verbose command input is echoed(default)
- --noverbose command input isn't echoed
- --echo commands are echoed immediately before execution(default)
- --noecho commands aren't echoed immediately before execution
- --inspect uses `inspect' for output (the default except bc mode)
- --noinspect doesn't uses inspect for output
- --readline uses Readline extension module
- --noreadline doesn't use Readline extension module
- --prompt prompt-mode
- --prompt-mode prompt-mode
- switches prompt mode. Pre-defined prompt modes are
- `default', `simple', `xmp' and `inf-ruby'
-
- --inf-ruby-mode uses prompt appreciate for inf-ruby-mode on emacs.
- Suppresses --readline.
- --simple-prompt simple prompt mode
- --noprompt no prompt
- --tracer display trace for each execution of commands.
- --back-trace-limit n
- displayes backtrace top n and tail n. The default
- value is 16.
- --irb_debug n sets internal debug level to n (It shouldn't be used)
- -v, --version prints the version of irb
-
-= Configurations
-
-irb reads `~/.irbrc' when it is invoked. If `~/.irbrb' doesn't exist
-irb try to read in the order `.irbrc', `irb.rc', `_irbrc' then `$irbrc'.
-
-The following is altanative to the command line option. To use them
-type as follows in an irb session.
-
- IRB.conf[:IRB_NAME]="irb"
- IRB.conf[:MATH_MODE]=false
- IRB.conf[:USE_TRACER]=false
- IRB.conf[:USE_LOADER]=false
- IRB.conf[:IGNORE_SIGINT]=true
- IRB.conf[:IGNORE_EOF]=false
- IRB.conf[:INSPECT_MODE]=nil
- IRB.conf[:IRB_RC] = nil
- IRB.conf[:BACK_TRACE_LIMIT]=16
- IRB.conf[:USE_LOADER] = false
- IRB.conf[:USE_READLINE] = nil
- IRB.conf[:USE_TRACER] = false
- IRB.conf[:IGNORE_SIGINT] = true
- IRB.conf[:IGNORE_EOF] = false
- IRB.conf[:PROMPT_MODE] = :DEFALUT
- IRB.conf[:PROMPT] = {...}
- IRB.conf[:DEBUG_LEVEL]=0
- IRB.conf[:VERBOSE]=true
-
-== Customizing prompt
-
-To costomize the prompt you set a variable
-
- IRB.conf[:PROMPT]
-
-For example, describe as follows in `.irbrc'.
-
- IRB.conf[:PROMPT][:MY_PROMPT] = { # name of prompt mode
- :PROMPT_I => nil, # normal prompt
- :PROMPT_S => nil, # prompt for continuated strings
- :PROMPT_C => nil, # prompt for continuated statement
- :RETURN => " ==>%s\n" # format to return value
- }
-
-Then, invoke irb with the above prompt mode by
-
- % irb --prompt my-prompt
-
-Or add the following in `.irbrc'.
-
- IRB.conf[:PROMPT_MODE] = :MY_PROMPT
-
-Constants PROMPT_I, PROMPT_S and PROMPT_C specifies the format.
-In the prompt specification, some special strings are available.
-
- %N command name which is running
- %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").
- It can be ommited
- %NNn line number.
- %% %
-
-For instance, the default prompt mode is defined as follows:
-
-IRB.conf[:PROMPT_MODE][:DEFAULT] = {
- :PROMPT_I => "%N(%m):%03n:%i> ",
- :PROMPT_S => "%N(%m):%03n:%i%l ",
- :PROMPT_C => "%N(%m):%03n:%i* ",
- :RETURN => "%s\n"
-}
-
-RETURN is used to printf.
-
-== Configurating subirb
-
-The command line option or IRB.conf specify the default behavior of
-(sub)irb. On the other hand, each conf of in the next sction `6. Command'
-is used to individually configurate (sub)irb.
-
-If proc is set to IRB.conf[:IRB_RC], its subirb will be invoked after
-execution of that proc under giving the context of irb as its
-aregument. By this mechanism each subirb can be configurated.
-
-= Command
-
-For irb commands, both simple name and `irb_'-prefixed name are prepared.
-
---- exit, quit, irb_exit
- Quits (sub)irb.
-
---- conf, irb_context
- Displays current configuration. Modifing the configuration is
- achieved by sending message to `conf'.
-
---- conf.eval_history = N
- Sets execution result history.
- N is a integer or nil. If N > 0, the number of historys is N.
- If N == 0, the number of historys is unlimited. If N is nill,
- execution result history isn't used(default).
-
---- conf.back_trace_limit
- Sets display lines of backtrace as top n and tail n.
- The default value is 16.
-
---- conf.debug_level = N
- Sets debug level of irb.
-
---- conf.ignore_eof = true/false
- Whether ^D (control-d) will be ignored or not.
- If false is set, ^D means quit.
-
---- conf.ignore_sigint= true/false
- Whether ^C (control-c) will be ignored or not.
- If false is set, ^D means quit. If true,
- during input: cancel inputing then return to top level.
- during execute: abondon current execution.
-
---- conf.inf_ruby_mode = true/false
- Whether inf-ruby-mode or not. The default value is false.
-
---- conf.inspect_mode = true/false/nil
- Specifies inspect mode.
- true: display inspect
- false: display to_s
- nil: inspect mode in non math mode,
- non inspect mode in math mode.
-
---- conf.math_mode
- Whether bc mode or not.
-
---- conf.use_loader = true/false
- Whether irb's own file reader method is used when load/require or not.
- This mode is globaly affected (irb wide).
-
---- conf.prompt_c
- prompt for a continuating statement (e.g, immediately after of `if')
-
---- conf.prompt_i
- standard prompt
-
---- conf.prompt_s
- prompt for a continuating string
-
---- conf.rc
- Whether ~/.irbrc is read or not.
-
---- conf.use_prompt = true/false
- Prompting or not.
-
---- conf.use_readline = true/false/nil
- Whether readline is used or not.
- true: uses
- false: doen't use
- nil: intends to use readline except for inf-ruby-mode (default)
-#
-#--- conf.verbose=T/F
-# Whether verbose messages are display or not.
-
---- cws, chws, irb_change_workspace [obj]
- obj will be self. If obj is omitted, self will be home-object, or
- the main object of first started irb.
-
---- pushws, irb_pushws, irb_push_workspace [obj]
- same as UNIX-shell command pushd.
-
---- popws, irb_popws, irb_pop_workspace
- same as UNIX-shell command popd
-
---- irb [obj]
- Invoke subirb. If obj is given, obj will be self.
-
---- jobs, irb_jobs
- List of subirb
-
---- fg n, irb_fg n
- Switch into specified subirb. The following is candidates of n:
-
- irb number
- thhread
- irb object
- self(obj which is specified of irb obj)
-
---- kill n, irb_kill n
- Kill subirb. The means of n is as same as the case of irb_fg.
-
---- source, irb_source path
- This is a like UNIX-shell command source. evaluate script in path
- on current context.
-
---- irb_load path, prev
- irb-version of Ruby's load.
-
-= System variable
-
---- _ The latest value of evaluation (it is local)
---- __ The history of evaluation values.
- __[line_no] return an evaluation value of line number<line_no>. If
- line_no is a negative, return value before -<line_no> from latest
- value.
-
-= Session Example
-
- dim% ruby irb.rb
- irb(main):001:0> irb # invoke subirb
- irb#1(main):001:0> jobs # list of subirbs
- #0->irb on main (#<Thread:0x400fb7e4> : stop)
- #1->irb#1 on main (#<Thread:0x40125d64> : running)
- nil
- irb#1(main):002:0> fg 0 # switch job
- nil
- irb(main):002:0> class Foo;end
- nil
- irb(main):003:0> irb Foo # invoke subirb which has the
- # context of Foo
- irb#2(Foo):001:0> def foo # define Foo#foo
- irb#2(Foo):002:1> print 1
- irb#2(Foo):003:1> end
- nil
- irb#2(Foo):004:0> fg 0 # switch job
- nil
- irb(main):004:0> jobs # list of job
- #0->irb on main (#<Thread:0x400fb7e4> : running)
- #1->irb#1 on main (#<Thread:0x40125d64> : stop)
- #2->irb#2 on Foo (#<Thread:0x4011d54c> : stop)
- nil
- irb(main):005:0> Foo.instance_methods # Foo#foo is defined asurely
- ["foo"]
- irb(main):006:0> fg 2 # switch job
- nil
- irb#2(Foo):005:0> def bar # define Foo#bar
- irb#2(Foo):006:1> print "bar"
- irb#2(Foo):007:1> end
- nil
- irb#2(Foo):010:0> Foo.instance_methods
- ["bar", "foo"]
- irb#2(Foo):011:0> fg 0
- nil
- irb(main):007:0> f = Foo.new
- #<Foo:0x4010af3c>
- irb(main):008:0> irb f # invoke subirb which has the
- # context of f (instance of Foo)
- irb#3(#<Foo:0x4010af3c>):001:0> jobs
- #0->irb on main (#<Thread:0x400fb7e4> : stop)
- #1->irb#1 on main (#<Thread:0x40125d64> : stop)
- #2->irb#2 on Foo (#<Thread:0x4011d54c> : stop)
- #3->irb#3 on #<Foo:0x4010af3c> (#<Thread:0x4010a1e0> : running)
- nil
- irb#3(#<Foo:0x4010af3c>):002:0> foo # evaluate f.foo
- 1nil
- irb#3(#<Foo:0x4010af3c>):003:0> bar # evaluate f.bar
- barnil
- irb#3(#<Foo:0x4010af3c>):004:0> kill 1, 2, 3# kill job
- nil
- irb(main):009:0> jobs
- #0->irb on main (#<Thread:0x400fb7e4> : running)
- nil
- irb(main):010:0> exit # exit
- dim%
-
-= Restrictions
-
-Because irb evaluates the inputs immediately after the imput is
-syntactically completed, irb gives slight different result than
-directly use ruby. Known difference is pointed out here.
-
-
-== Declaration of the local variable
-
-The following causes an error in ruby:
-
- eval "foo = 0"
- foo
- --
- -:2: undefined local variable or method `foo' for #<Object:0x40283118> (NameError)
- ---
- NameError
-
-Though, the above will successfully done by irb.
-
- >> eval "foo = 0"
- => 0
- >> foo
- => 0
-
-Ruby evaluates a code after reading entire of code and determination
-of the scope of local variables. On the other hand, irb do
-immediately. More precisely, irb evaluate at first
-
- evel "foo = 0"
-
-then foo is defined on this timing. It is because of this
-incompatibility.
-
-If you'd like to detect those differences, begin...end can be used:
-
- >> begin
- ?> eval "foo = 0"
- >> foo
- >> end
- NameError: undefined local variable or method `foo' for #<Object:0x4013d0f0>
- (irb):3
- (irb_local_binding):1:in `eval'
-
-== Here-document
-
-Implementation of Here-document is incomplete.
-
-== Symbol
-
-Irb can not always recognize a symbol as to be Symbol. Concretely, an
-expression have completed, however Irb regard it as continuation line.
-
-=end
-
-% Begin Emacs Environment
-% Local Variables:
-% mode: text
-% comment-column: 0
-% comment-start: "%"
-% comment-end: "\n"
-% End:
-%
diff --git a/doc/irb/irb.rd.ja b/doc/irb/irb.rd.ja
index 6e3abd7b3c..416dec3906 100644
--- a/doc/irb/irb.rd.ja
+++ b/doc/irb/irb.rd.ja
@@ -3,23 +3,23 @@ irb -- interactive ruby
$Revision$
by Keiju ISHITSUKA(keiju@ruby-lang.org)
=begin
-= irb¤È¤Ï?
+= irbã¨ã¯?
-irb¤Ïinteractive ruby¤Îά¤Ç¤¹. ruby¤Î¼°¤òɸ½àÆþÎϤ«¤é´Êñ¤ËÆþÎÏ/¼Â¹Ô¤¹¤ë
-¤¿¤á¤Î¥Ä¡¼¥ë¤Ç¤¹.
+irbã¯interactive rubyã®ç•¥ã§ã™. rubyã®å¼ã‚’標準入力ã‹ã‚‰ç°¡å˜ã«å…¥åŠ›/実行ã™ã‚‹
+ãŸã‚ã®ãƒ„ールã§ã™.
-= µ¯Æ°
+= èµ·å‹•
% irb
-¤Ç¹Ô¤Ê¤¤¤Þ¤¹.
+ã§è¡Œãªã„ã¾ã™.
-= »È¤¤Êý
+= ä½¿ã„æ–¹
-irb¤Î»È¤¤Êý¤Ï, Ruby¤µ¤¨ÃΤäƤ¤¤ì¤Ð¤¤¤¿¤Ã¤Æ´Êñ¤Ç¤¹. ´ðËÜŪ¤Ë¤Ï irb ¤È
-¤¤¤¦¥³¥Þ¥ó¥É¤ò¼Â¹Ô¤¹¤ë¤À¤±¤Ç¤¹. irb¤ò¼Â¹Ô¤¹¤ë¤È, °Ê²¼¤Î¤è¤¦¤Ê¥×¥í¥ó¥×
-¥È¤¬É½¤ì¤Æ¤­¤Þ¤¹. ¸å¤Ï, ruby¤Î¼°¤òÆþ¤ì¤Æ²¼¤µ¤¤. ¼°¤¬´°·ë¤·¤¿»þÅÀ¤Ç¼Â¹Ô
-¤µ¤ì¤Þ¤¹.
+irbã®ä½¿ã„æ–¹ã¯, Rubyã•ãˆçŸ¥ã£ã¦ã„れã°ã„ãŸã£ã¦ç°¡å˜ã§ã™. 基本的ã«ã¯ irb ã¨
+ã„ã†ã‚³ãƒžãƒ³ãƒ‰ã‚’実行ã™ã‚‹ã ã‘ã§ã™. irbを実行ã™ã‚‹ã¨, 以下ã®ã‚ˆã†ãªãƒ—ロンプ
+トãŒè¡¨ã‚Œã¦ãã¾ã™. 後ã¯, rubyã®å¼ã‚’入れã¦ä¸‹ã•ã„. å¼ãŒå®Œçµã—ãŸæ™‚点ã§å®Ÿè¡Œ
+ã•れã¾ã™.
dim% irb
irb(main):001:0> 1+2
@@ -30,57 +30,57 @@ irb¤Î»È¤¤Êý¤Ï, Ruby¤µ¤¨ÃΤäƤ¤¤ì¤Ð¤¤¤¿¤Ã¤Æ´Êñ¤Ç¤¹. ´ðËÜŪ¤Ë¤Ï irb ¤È
irb(main):005:2> end
irb(main):006:1> end
nil
- irb(main):007:0>
+ irb(main):007:0>
-¤Þ¤¿, irb¤ÏReadline¥â¥¸¥å¡¼¥ë¤Ë¤âÂбþ¤·¤Æ¤¤¤Þ¤¹. Readline¥â¥¸¥å¡¼¥ë¤¬
-¥¤¥ó¥¹¥È¡¼¥ë¤µ¤ì¤Æ¤¤¤ë»þ¤Ë¤Ï, ¤½¤ì¤ò»È¤¦¤Î¤¬É¸½à¤Îưºî¤Ë¤Ê¤ê¤Þ¤¹.
+ã¾ãŸ, irbã¯Readlineモジュールã«ã‚‚対応ã—ã¦ã„ã¾ã™. ReadlineモジュールãŒ
+インストールã•れã¦ã„る時ã«ã¯, ãれを使ã†ã®ãŒæ¨™æº–ã®å‹•作ã«ãªã‚Šã¾ã™.
-= ¥³¥Þ¥ó¥É¥ª¥×¥·¥ç¥ó
+= コマンドオプション
irb.rb [options] file_name opts
options:
- -f ~/.irbrc ¤òÆÉ¤ß¹þ¤Þ¤Ê¤¤.
- -m bc¥â¡¼¥É(ʬ¿ô, ¹ÔÎó¤Î·×»»¤¬¤Ç¤­¤ë)
- -d $DEBUG ¤òtrue¤Ë¤¹¤ë(ruby -d ¤ÈƱ¤¸)
- -Kc ruby -Kc¤ÈƱ¤¸
- -r load-module ruby -r ¤ÈƱ¤¸.
- --verbose ¤³¤ì¤«¤é¼Â¹Ô¤¹¤ë¹Ô¤òɽ¼¨¤¹¤ë(¥Ç¥Õ¥©¥ë¥È)
- --noverbose ¤³¤ì¤«¤é¼Â¹Ô¤¹¤ë¹Ô¤òɽ¼¨¤·¤Ê¤¤
- --echo ¼Â¹Ô·ë²Ì¤òɽ¼¨¤¹¤ë(¥Ç¥Õ¥©¥ë¥È)
- --noecho ¼Â¹Ô·ë²Ì¤òɽ¼¨¤·¤Ê¤¤
- --inspect ·ë²Ì½ÐÎϤËinspect¤òÍѤ¤¤ë(bc¥â¡¼¥É°Ê³°¤Ï¥Ç¥Õ¥©¥ë¥È).
- --noinspect ·ë²Ì½ÐÎϤËinspect¤òÍѤ¤¤Ê¤¤.
- --readline readline¥é¥¤¥Ö¥é¥ê¤òÍøÍѤ¹¤ë.
- --noreadline readline¥é¥¤¥Ö¥é¥ê¤òÍøÍѤ·¤Ê¤¤. ¥Ç¥Õ¥©¥ë¥È¤Îưºî¤Ï,
- inf-ruby-mode°Ê³°¤Çreadline¥é¥¤¥Ö¥é¥ê¤òÍøÍѤ·¤è¤¦
- ¤È¤¹¤ë.
+ -f ~/.irbrc を読ã¿è¾¼ã¾ãªã„.
+ -m bcモード(分数, 行列ã®è¨ˆç®—ãŒã§ãã‚‹)
+ -d $DEBUG ã‚’trueã«ã™ã‚‹(ruby -d ã¨åŒã˜)
+ -Kc ruby -Kcã¨åŒã˜
+ -r load-module ruby -r ã¨åŒã˜.
+ --verbose ã“れã‹ã‚‰å®Ÿè¡Œã™ã‚‹è¡Œã‚’表示ã™ã‚‹(デフォルト)
+ --noverbose ã“れã‹ã‚‰å®Ÿè¡Œã™ã‚‹è¡Œã‚’表示ã—ãªã„
+ --echo å®Ÿè¡Œçµæžœã‚’表示ã™ã‚‹(デフォルト)
+ --noecho å®Ÿè¡Œçµæžœã‚’表示ã—ãªã„
+ --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¥é¥¤¥Ö¥é¥ê¤Ï»È¤ï¤Ê¤¯¤Ê¤ë.
+ プロンプトモードを切替ãˆã¾ã™. ç¾åœ¨å®šç¾©ã•れã¦ã„るプ
+ ロンプトモードã¯, default, simple, xmp, inf-rubyãŒ
+ 用æ„ã•れã¦ã„ã¾ã™. デフォルトã¯defaultプロンプトモー
+ ドã«ãªã£ã¦ã„ã¾ã™.
+
+ --inf-ruby-mode emacsã®inf-ruby-mode用ã®ãƒ—ロンプト表示を行ãªã†. 特
+ ã«æŒ‡å®šãŒãªã„é™ã‚Š, readlineライブラリã¯ä½¿ã‚ãªããªã‚‹.
--simple-prompt
- Èó¾ï¤Ë¥·¥ó¥×¥ë¤Ê¥×¥í¥ó¥×¥È¤òÍѤ¤¤ë¥â¡¼¥É¤Ç¤¹.
- --noprompt ¥×¥í¥ó¥×¥Èɽ¼¨¤ò¹Ô¤Ê¤ï¤Ê¤¤.
- --tracer ¥³¥Þ¥ó¥É¼Â¹Ô»þ¤Ë¥È¥ì¡¼¥¹¤ò¹Ô¤Ê¤¦.
+ éžå¸¸ã«ã‚·ãƒ³ãƒ—ルãªãƒ—ロンプトを用ã„るモードã§ã™.
+ --noprompt プロンプト表示を行ãªã‚ãªã„.
+ --tracer コマンド実行時ã«ãƒˆãƒ¬ãƒ¼ã‚¹ã‚’行ãªã†.
--back-trace-limit n
- ¥Ð¥Ã¥¯¥È¥ì¡¼¥¹É½¼¨¤ò¥Ð¥Ã¥¯¥È¥ì¡¼¥¹¤ÎƬ¤«¤é n, ¸å¤í
- ¤«¤én¤À¤±¹Ô¤Ê¤¦. ¥Ç¥Õ¥©¥ë¥È¤Ï16
- --irb_debug n irb¤Î¥Ç¥Ð¥Ã¥°¥Ç¥Ð¥Ã¥°¥ì¥Ù¥ë¤òn¤ËÀßÄꤹ¤ë(ÍøÍѤ·¤Ê
- ¤¤Êý¤¬ÌµÆñ¤Ç¤·¤ç¤¦).
- -v, --version irb¤Î¥Ð¡¼¥¸¥ç¥ó¤òɽ¼¨¤¹¤ë
+ ãƒãƒƒã‚¯ãƒˆãƒ¬ãƒ¼ã‚¹è¡¨ç¤ºã‚’ãƒãƒƒã‚¯ãƒˆãƒ¬ãƒ¼ã‚¹ã®é ­ã‹ã‚‰ n, 後ã‚
+ ã‹ã‚‰nã ã‘行ãªã†. デフォルトã¯16
+ --irb_debug n irbã®ãƒ‡ãƒãƒƒã‚°ãƒ‡ãƒãƒƒã‚°ãƒ¬ãƒ™ãƒ«ã‚’nã«è¨­å®šã™ã‚‹(利用ã—ãª
+ ã„æ–¹ãŒç„¡é›£ã§ã—ょã†).
+ -v, --version irbã®ãƒãƒ¼ã‚¸ãƒ§ãƒ³ã‚’表示ã™ã‚‹
-= ¥³¥ó¥Õ¥£¥®¥å¥ì¡¼¥·¥ç¥ó
+= コンフィギュレーション
-irbµ¯Æ°»þ¤Ë``~/.irbrc''¤òÆÉ¤ß¹þ¤ß¤Þ¤¹. ¤â¤·Â¸ºß¤·¤Ê¤¤¾ì¹ç¤Ï,
-``.irbrc'', ``irb.rc'', ``_irbrc'', ``$irbrc''¤Î½ç¤Ëload¤ò»î¤ß¤Þ¤¹.
+irb起動時ã«``~/.irbrc''を読ã¿è¾¼ã¿ã¾ã™. ã‚‚ã—存在ã—ãªã„å ´åˆã¯,
+``.irbrc'', ``irb.rc'', ``_irbrc'', ``$irbrc''ã®é †ã«loadを試ã¿ã¾ã™.
-¥ª¥×¥·¥ç¥ó¤òÀßÄꤹ¤ëÂå¤ï¤ê¤Ë, °Ê²¼¤Î¥³¥Þ¥ó¥É¤Ç¤â¥Ç¥Õ¥©¥ë¥È¤Îưºî¤òÀßÄê
-¤Ç¤­¤Þ¤¹.
+オプションを設定ã™ã‚‹ä»£ã‚りã«, 以下ã®ã‚³ãƒžãƒ³ãƒ‰ã§ã‚‚デフォルトã®å‹•作を設定
+ã§ãã¾ã™.
IRB.conf[:IRB_NAME]="irb"
IRB.conf[:MATH_MODE]=false
@@ -96,48 +96,48 @@ 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]
-¤òÍѤ¤¤Þ¤¹. Î㤨¤Ð, .irbrc¤ÎÃæ¤Ç²¼¤Î¤è¤¦¤Ê¼°¤òµ­½Ò¤·¤Þ¤¹:
+を用ã„ã¾ã™. 例ãˆã°, .irbrcã®ä¸­ã§ä¸‹ã®ã‚ˆã†ãªå¼ã‚’記述ã—ã¾ã™:
- IRB.conf[:PROMPT][:MY_PROMPT] = { # ¥×¥í¥ó¥×¥È¥â¡¼¥É¤Î̾Á°
- :PROMPT_I => nil, # Ä̾ï¤Î¥×¥í¥ó¥×¥È
- :PROMPT_N => nil, # ·Ñ³¹Ô¤Î¥×¥í¥ó¥×¥È
- :PROMPT_S => nil, # ʸ»úÎó¤Ê¤É¤Î·Ñ³¹Ô¤Î¥×¥í¥ó¥×¥È
- :PROMPT_C => nil, # ¼°¤¬·Ñ³¤·¤Æ¤¤¤ë»þ¤Î¥×¥í¥ó¥×¥È
- :RETURN => " ==>%s\n" # ¥ê¥¿¡¼¥ó»þ¤Î¥×¥í¥ó¥×¥È
+ IRB.conf[:PROMPT][:MY_PROMPT] = { # プロンプトモードã®åå‰
+ :PROMPT_I => nil, # 通常ã®ãƒ—ロンプト
+ :PROMPT_N => nil, # 継続行ã®ãƒ—ロンプト
+ :PROMPT_S => nil, # 文字列ãªã©ã®ç¶™ç¶šè¡Œã®ãƒ—ロンプト
+ :PROMPT_C => nil, # å¼ãŒç¶™ç¶šã—ã¦ã„る時ã®ãƒ—ロンプト
+ :RETURN => " ==>%s\n" # リターン時ã®ãƒ—ロンプト
}
-¥×¥í¥ó¥×¥È¥â¡¼¥É¤ò»ØÄꤷ¤¿¤¤»þ¤Ë¤Ï,
+プロンプトモードを指定ã—ãŸã„時ã«ã¯,
irb --prompt my-prompt
-¤Ç¤½¤Î¥×¥í¥ó¥×¥È¥â¡¼¥É¤Çµ¯Æ°¤µ¤ì¤Þ¤¹. ¤Þ¤¿¤Ï, .irbrc¤Ë²¼¼°¤òµ­½Ò¤·¤Æ¤â
-OK¤Ç¤¹.
+ã§ãã®ãƒ—ロンプトモードã§èµ·å‹•ã•れã¾ã™. ã¾ãŸã¯, .irbrcã«ä¸‹å¼ã‚’記述ã—ã¦ã‚‚
+OKã§ã™.
IRB.conf[:PROMPT_MODE] = :MY_PROMPT
-PROMPT_I, PROMPT_N, PROMPT_S, PROMPT_C¤Ï, ¥Õ¥©¡¼¥Þ¥Ã¥È¤ò»ØÄꤷ¤Þ¤¹.
+PROMPT_I, PROMPT_N, PROMPT_S, PROMPT_Cã¯, フォーマットを指定ã—ã¾ã™.
- %N µ¯Æ°¤·¤Æ¤¤¤ë¥³¥Þ¥ó¥É̾¤¬½ÐÎϤµ¤ì¤ë.
- %m main¥ª¥Ö¥¸¥§¥¯¥È(self)¤¬to_s¤Ç½ÐÎϤµ¤ì¤ë.
- %M main¥ª¥Ö¥¸¥§¥¯¥È(self)¤¬inspect¤µ¤ì¤Æ½ÐÎϤµ¤ì¤ë.
- %l ʸ»úÎóÃæ¤Î¥¿¥¤¥×¤òɽ¤¹(", ', /, ], `]'¤Ï%w¤ÎÃæ¤Î»þ)
- %NNi ¥¤¥ó¥Ç¥ó¥È¤Î¥ì¥Ù¥ë¤òɽ¤¹. NN¤Ï¿ô»ú¤¬Æþ¤êprintf¤Î%NNd¤ÈƱ¤¸. ¾Ê
- ά²Äǽ
- %NNn ¹ÔÈÖ¹æ¤òɽ¤·¤Þ¤¹.
+ %N èµ·å‹•ã—ã¦ã„るコマンドåãŒå‡ºåŠ›ã•れる.
+ %m mainオブジェクト(self)ãŒto_sã§å‡ºåŠ›ã•れる.
+ %M mainオブジェクト(self)ãŒinspectã•れã¦å‡ºåŠ›ã•れる.
+ %l 文字列中ã®ã‚¿ã‚¤ãƒ—を表ã™(", ', /, ], `]'ã¯%wã®ä¸­ã®æ™‚)
+ %NNi インデントã®ãƒ¬ãƒ™ãƒ«ã‚’表ã™. NNã¯æ•°å­—ãŒå…¥ã‚Šprintfã®%NNdã¨åŒã˜. çœ
+ ç•¥å¯èƒ½
+ %NNn 行番å·ã‚’表ã—ã¾ã™.
%% %
-Î㤨¤Ð, ¥Ç¥Õ¥©¥ë¥È¤Î¥×¥í¥ó¥×¥È¥â¡¼¥É¤Ï:
+例ãˆã°, デフォルトã®ãƒ—ロンプトモードã¯:
IRB.conf[:PROMPT_MODE][:DEFAULT] = {
:PROMPT_I => "%N(%m):%03n:%i> ",
@@ -145,216 +145,216 @@ PROMPT_I, PROMPT_N, PROMPT_S, PROMPT_C¤Ï, ¥Õ¥©¡¼¥Þ¥Ã¥È¤ò»ØÄꤷ¤Þ¤¹.
:PROMPT_S => "%N(%m):%03n:%i%l ",
:PROMPT_C => "%N(%m):%03n:%i* ",
:RETURN => "%s\n"
- }
+ }
-¤È¤Ê¤Ã¤Æ¤¤¤Þ¤¹.
+ã¨ãªã£ã¦ã„ã¾ã™.
-RETURN¤Ï, ¸½ºß¤Î¤È¤³¤íprintf·Á¼°¤Ç¤¹. ¾­Íè»ÅÍͤ¬ÊѤï¤ë¤«¤âÃΤì¤Þ¤»¤ó.
+RETURNã¯, ç¾åœ¨ã®ã¨ã“ã‚printfå½¢å¼ã§ã™. å°†æ¥ä»•様ãŒå¤‰ã‚ã‚‹ã‹ã‚‚知れã¾ã›ã‚“.
-== ¥µ¥Öirb¤ÎÀßÄê
+== サブirbã®è¨­å®š
-¥³¥Þ¥ó¥É¥é¥¤¥ó¥ª¥×¥·¥ç¥ó¤ª¤è¤ÓIRB.conf¤Ï(¥µ¥Ö)irbµ¯Æ°»þ¤Î¥Ç¥Õ¥©¥ë¥È¤Î
-ÀßÄê¤ò·è¤á¤ë¤â¤Î¤Ç, `5. ¥³¥Þ¥ó¥É'¤Ë¤¢¤ëconf¤Ç¸ÄÊ̤Î(¥µ¥Ö)irb¤ÎÀßÄ꤬¤Ç
-¤­¤ë¤è¤¦¤Ë¤Ê¤Ã¤Æ¤¤¤Þ¤¹.
+コマンドラインオプションãŠã‚ˆã³IRB.confã¯(サブ)irb起動時ã®ãƒ‡ãƒ•ォルトã®
+設定を決ã‚ã‚‹ã‚‚ã®ã§, `5. コマンド'ã«ã‚ã‚‹confã§å€‹åˆ¥ã®(サブ)irbã®è¨­å®šãŒã§
+ãるよã†ã«ãªã£ã¦ã„ã¾ã™.
-IRB.conf[:IRB_RC]¤Ëproc¤¬ÀßÄꤵ¤ì¤Æ¤¤¤ë¤È, ¥µ¥Öirb¤òµ¯Æ°¤¹¤ë»þ¤Ë¤½¤Î
-proc¤òirb¤Î¥³¥ó¥Æ¥­¥¹¥È¤ò°ú¿ô¤È¤·¤Æ¸Æ¤Ó½Ð¤·¤Þ¤¹. ¤³¤ì¤Ë¤è¤Ã¤Æ¸ÄÊ̤Υµ
-¥Öirb¤´¤È¤ËÀßÄê¤òÊѤ¨¤ë¤³¤È¤¬¤Ç¤­¤ë¤è¤¦¤Ë¤Ê¤ê¤Þ¤¹.
+IRB.conf[:IRB_RC]ã«procãŒè¨­å®šã•れã¦ã„ã‚‹ã¨, サブirbã‚’èµ·å‹•ã™ã‚‹æ™‚ã«ãã®
+procã‚’irbã®ã‚³ãƒ³ãƒ†ã‚­ã‚¹ãƒˆã‚’引数ã¨ã—ã¦å‘¼ã³å‡ºã—ã¾ã™. ã“れã«ã‚ˆã£ã¦å€‹åˆ¥ã®ã‚µ
+ブirbã”ã¨ã«è¨­å®šã‚’変ãˆã‚‹ã“ã¨ãŒã§ãるよã†ã«ãªã‚Šã¾ã™.
-= ¥³¥Þ¥ó¥É
+= コマンド
-irb³ÈÄ¥¥³¥Þ¥ó¥É¤Ï, ´Êñ¤Ê̾Á°¤ÈƬ¤Ë`irb_'¤ò¤Ä¤±¤¿Ì¾Á°¤ÈξÊýÄêµÁ¤µ¤ì¤Æ
-¤¤¤Þ¤¹. ¤³¤ì¤Ï, ´Êñ¤Ê̾Á°¤¬override¤µ¤ì¤¿»þ¤Î¤¿¤á¤Ç¤¹.
+irb拡張コマンドã¯, ç°¡å˜ãªåå‰ã¨é ­ã«`irb_'ã‚’ã¤ã‘ãŸåå‰ã¨ä¸¡æ–¹å®šç¾©ã•れã¦
+ã„ã¾ã™. ã“れã¯, ç°¡å˜ãªåå‰ãŒoverrideã•ã‚ŒãŸæ™‚ã®ãŸã‚ã§ã™.
---- exit, quit, irb_exit
- ½ªÎ»¤¹¤ë.
- ¥µ¥Öirb¤Î¾ì¹ç, ¤½¤Î¥µ¥Öirb¤ò½ªÎ»¤¹¤ë.
+--- exit, quit, irb_exit
+ 終了ã™ã‚‹.
+ サブirbã®å ´åˆ, ãã®ã‚µãƒ–irbを終了ã™ã‚‹.
--- conf, irb_context
- irb¤Î¸½ºß¤ÎÀßÄê¤òɽ¼¨¤¹¤ë. ÀßÄê¤ÎÊѹ¹¤Ï, conf¤Ë¥á¥Ã¥»¡¼¥¸¤òÁ÷¤ë¤³
- ¤È¤Ë¤è¤Ã¤Æ¹Ô¤Ê¤¨¤ë.
+ irbã®ç¾åœ¨ã®è¨­å®šã‚’表示ã™ã‚‹. 設定ã®å¤‰æ›´ã¯, confã«ãƒ¡ãƒƒã‚»ãƒ¼ã‚¸ã‚’é€ã‚‹ã“
+ ã¨ã«ã‚ˆã£ã¦è¡Œãªãˆã‚‹.
--- conf.eval_history = N
- ¼Â¹Ô·ë²Ì¤Î¥Ò¥¹¥È¥êµ¡Ç½¤ÎÀßÄê.
- nn¤ÏÀ°¿ô¤«nil¤Ç nn>0 ¤Ç¤¢¤ì¤Ð¤½¤Î¿ô¤À¤±¥Ò¥¹¥È¥ê¤Ë¤¿¤á¤ë¡£nn==0¤Î»þ¤Ï
- ̵À©¸Â¤Ëµ­²±¤¹¤ë¡¢nil¤À¤È¥Ò¥¹¥È¥êµ¡Ç½¤Ï¤ä¤á¤ë(¥Ç¥Õ¥©¥ë¥È).
+ å®Ÿè¡Œçµæžœã®ãƒ’ストリ機能ã®è¨­å®š.
+ nnã¯æ•´æ•°ã‹nilã§ nn>0 ã§ã‚れã°ãã®æ•°ã ã‘ヒストリã«ãŸã‚る。nn==0ã®æ™‚ã¯
+ 無制é™ã«è¨˜æ†¶ã™ã‚‹ã€nilã ã¨ãƒ’ストリ機能ã¯ã‚„ã‚ã‚‹(デフォルト).
--- Conf.back_trace_limit
- ¥Ð¥Ã¥¯¥È¥ì¡¼¥¹É½¼¨¤ò¥Ð¥Ã¥¯¥È¥ì¡¼¥¹¤ÎƬ¤«¤én, ¸å¤í¤«¤én¤À¤±¹Ô¤Ê¤¦.
- ¥Ç¥Õ¥©¥ë¥È¤Ï16
-
+ ãƒãƒƒã‚¯ãƒˆãƒ¬ãƒ¼ã‚¹è¡¨ç¤ºã‚’ãƒãƒƒã‚¯ãƒˆãƒ¬ãƒ¼ã‚¹ã®é ­ã‹ã‚‰n, 後ã‚ã‹ã‚‰nã ã‘行ãªã†.
+ デフォルトã¯16
+
--- conf.debug_level = N
- irbÍѤΥǥХå°¥ì¥Ù¥ë¤ÎÀßÄê
+ irb用ã®ãƒ‡ãƒãƒƒã‚°ãƒ¬ãƒ™ãƒ«ã®è¨­å®š
--- conf.ignore_eof = true/false
- ^D¤¬ÆþÎϤµ¤ì¤¿»þ¤Îưºî¤òÀßÄꤹ¤ë. true¤Î»þ¤Ï^D¤ò̵»ë¤¹¤ë, false¤Î
- »þ¤Ïirb¤ò½ªÎ»¤¹¤ë.
+ ^DãŒå…¥åŠ›ã•ã‚ŒãŸæ™‚ã®å‹•作を設定ã™ã‚‹. trueã®æ™‚ã¯^Dを無視ã™ã‚‹, falseã®
+ 時ã¯irbを終了ã™ã‚‹.
--- conf.ignore_sigint= true/false
- ^C¤¬ÆþÎϤµ¤ì¤¿»þ¤Îưºî¤òÀßÄꤹ¤ë. false»þ¤Ï, irb¤ò½ªÎ»¤¹¤ë. true¤Î
- »þ¤Îưºî¤Ï°Ê²¼¤Î¤è¤¦¤Ë¤Ê¤ë:
- ÆþÎÏÃæ: ¤³¤ì¤Þ¤ÇÆþÎϤ·¤¿¤â¤Î¤ò¥­¥ã¥ó¥»¥ë¤·¥È¥Ã¥×¥ì¥Ù¥ë¤ËÌá¤ë.
- ¼Â¹ÔÃæ: ¼Â¹Ô¤òÃæ»ß¤¹¤ë.
+ ^CãŒå…¥åŠ›ã•ã‚ŒãŸæ™‚ã®å‹•作を設定ã™ã‚‹. false時ã¯, irbを終了ã™ã‚‹. trueã®
+ 時ã®å‹•作ã¯ä»¥ä¸‹ã®ã‚ˆã†ã«ãªã‚‹:
+ 入力中: ã“れã¾ã§å…¥åŠ›ã—ãŸã‚‚ã®ã‚’キャンセルã—ãƒˆãƒƒãƒ—ãƒ¬ãƒ™ãƒ«ã«æˆ»ã‚‹.
+ 実行中: 実行を中止ã™ã‚‹.
--- conf.inf_ruby_mode = true/false
- inf-ruby-modeÍѤΥץí¥ó¥×¥Èɽ¼¨¤ò¹Ô¤Ê¤¦. ¥Ç¥Õ¥©¥ë¥È¤Ïfalse.
+ inf-ruby-mode用ã®ãƒ—ロンプト表示を行ãªã†. デフォルトã¯false.
--- conf.inspect_mode = true/false/nil
- ¥¤¥ó¥¹¥Ú¥¯¥È¥â¡¼¥É¤òÀßÄꤹ¤ë.
- true: ¥¤¥ó¥¹¥Ú¥¯¥È¤·¤ÆÉ½¼¨¤¹¤ë.
- false: Ä̾ï¤Îprint¤Çɽ¼¨¤¹¤ë.
- nil: Ä̾ï¥â¡¼¥É¤Ç¤¢¤ì¤Ð, inspect mode¤È¤Ê¤ê, math¥â¡¼¥É¤Î»þ¤Ï, non
- inspect mode¤È¤Ê¤ë.
+ インスペクトモードを設定ã™ã‚‹.
+ true: インスペクトã—ã¦è¡¨ç¤ºã™ã‚‹.
+ false: 通常ã®printã§è¡¨ç¤ºã™ã‚‹.
+ nil: 通常モードã§ã‚れã°, inspect modeã¨ãªã‚Š, mathãƒ¢ãƒ¼ãƒ‰ã®æ™‚ã¯, non
+ inspect modeã¨ãªã‚‹.
--- conf.math_mode
- »²¾È¤Î¤ß. bc¥â¡¼¥É(ʬ¿ô, ¹ÔÎó¤Î·×»»¤¬¤Ç¤­¤Þ¤¹)¤«¤É¤¦¤«?
+ å‚ç…§ã®ã¿. bcモード(分数, 行列ã®è¨ˆç®—ãŒã§ãã¾ã™)ã‹ã©ã†ã‹?
--- conf.use_loader = true/false
- load/require»þ¤Ëirb¤ÎfileÆÉ¤ß¹þ¤ßµ¡Ç½¤òÍѤ¤¤ë¥â¡¼¥É¤Î¥¹¥¤¥Ã¥Á(¥Ç¥Õ¥©
- ¥ë¥È¤ÏÍѤ¤¤Ê¤¤). ¤³¤Î¥â¡¼¥É¤ÏIRBÁ´ÂΤËÈ¿±Ç¤µ¤ì¤ë.
+ load/require時ã«irbã®file読ã¿è¾¼ã¿æ©Ÿèƒ½ã‚’用ã„るモードã®ã‚¹ã‚¤ãƒƒãƒ(デフォ
+ ルトã¯ç”¨ã„ãªã„). ã“ã®ãƒ¢ãƒ¼ãƒ‰ã¯IRB全体ã«å映ã•れる.
--- conf.prompt_c
- if¤Îľ¸å¤Ê¤É, ¹Ô¤¬·Ñ³¤·¤Æ¤¤¤ë»þ¤Î¥×¥í¥ó¥×¥È.
+ ifã®ç›´å¾Œãªã©, 行ãŒç¶™ç¶šã—ã¦ã„る時ã®ãƒ—ロンプト.
--- conf.prompt_i
- Ä̾ï¤Î¥×¥í¥ó¥×¥È.
+ 通常ã®ãƒ—ロンプト.
--- conf.prompt_s
- ʸ»úÎóÃæ¤Ê¤É¤òɽ¤¹¥×¥í¥ó¥×¥È.
+ 文字列中ãªã©ã‚’表ã™ãƒ—ロンプト.
--- conf.rc
- ~/.irbrc¤òÆÉ¤ß¹þ¤ó¤À¤«¤É¤¦¤«?
+ ~/.irbrcを読ã¿è¾¼ã‚“ã ã‹ã©ã†ã‹?
--- conf.use_prompt = true/false
- ¥×¥í¥ó¥×¥Èɽ¼¨¤¹¤ë¤«¤É¤¦¤«? ¥Ç¥Õ¥©¥ë¥È¤Ç¤Ï¥×¥í¥ó¥×¥È¤òɽ¼¨¤¹¤ë.
+ プロンプト表示ã™ã‚‹ã‹ã©ã†ã‹? デフォルトã§ã¯ãƒ—ロンプトを表示ã™ã‚‹.
--- conf.use_readline = true/false/nil
- readline¤ò»È¤¦¤«¤É¤¦¤«?
- true: readline¤ò»È¤¦.
- false: readline¤ò»È¤ï¤Ê¤¤.
- nil: (¥Ç¥Õ¥©¥ë¥È)inf-ruby-mode°Ê³°¤Çreadline¥é¥¤¥Ö¥é¥ê¤òÍøÍѤ·¤è
- ¤¦¤È¤¹¤ë.
+ readlineを使ã†ã‹ã©ã†ã‹?
+ true: readlineを使ã†.
+ false: readlineを使ã‚ãªã„.
+ nil: (デフォルト)inf-ruby-mode以外ã§readlineライブラリを利用ã—よ
+ ã†ã¨ã™ã‚‹.
#
#--- conf.verbose=T/F
-# irb¤«¤é¤¤¤í¤¤¤í¤Ê¥á¥Ã¥»¡¼¥¸¤ò½ÐÎϤ¹¤ë¤«?
+# irbã‹ã‚‰ã„ã‚ã„ã‚ãªãƒ¡ãƒƒã‚»ãƒ¼ã‚¸ã‚’出力ã™ã‚‹ã‹?
--- cws, chws, irb_cws, irb_chws, irb_change_workspace [obj]
- obj¤òself¤È¤¹¤ë. obj¤¬¾Êά¤µ¤ì¤¿¤È¤­¤Ï, home workspace, ¤¹¤Ê¤ï¤Á
- irb¤òµ¯Æ°¤·¤¿¤È¤­¤Îmain object¤òself¤È¤¹¤ë.
+ objã‚’selfã¨ã™ã‚‹. objãŒçœç•¥ã•れãŸã¨ãã¯, home workspace, ã™ãªã‚ã¡
+ irbã‚’èµ·å‹•ã—ãŸã¨ãã®main objectã‚’selfã¨ã™ã‚‹.
--- pushws, irb_pushws, irb_push_workspace [obj]
- UNIX¥·¥§¥ë¥³¥Þ¥ó¥É¤Îpushd¤ÈƱÍÍ.
+ UNIXシェルコマンドã®pushdã¨åŒæ§˜.
--- popws, irb_popws, irb_pop_workspace
- UNIX¥·¥§¥ë¥³¥Þ¥ó¥É¤Îpopd¤ÈƱÍÍ.
+ UNIXシェルコマンドã®popdã¨åŒæ§˜.
--- irb [obj]
- ¥µ¥Öirb¤òΩ¤Á¤¢¤²¤ë. obj¤¬»ØÄꤵ¤ì¤¿»þ¤Ï, ¤½¤Îobj¤òself¤È¤¹¤ë.
+ サブirbã‚’ç«‹ã¡ã‚ã’ã‚‹. objãŒæŒ‡å®šã•ã‚ŒãŸæ™‚ã¯, ãã®objã‚’selfã¨ã™ã‚‹.
--- jobs, irb_jobs
- ¥µ¥Öirb¤Î¥ê¥¹¥È
+ サブirbã®ãƒªã‚¹ãƒˆ
--- fg n, irb_fg n
- »ØÄꤷ¤¿¥µ¥Öirb¤Ë¥¹¥¤¥Ã¥Á¤¹¤ë. n¤Ï, ¼¡¤Î¤â¤Î¤ò»ØÄꤹ¤ë.
+ 指定ã—ãŸã‚µãƒ–irbã«ã‚¹ã‚¤ãƒƒãƒã™ã‚‹. nã¯, 次ã®ã‚‚ã®ã‚’指定ã™ã‚‹.
- irbÈÖ¹æ
- ¥¹¥ì¥Ã¥É
- irb¥ª¥Ö¥¸¥§¥¯¥È
- self(irb obj¤Çµ¯Æ°¤·¤¿»þ¤Îobj)
+ irb番å·
+ スレッド
+ irbオブジェクト
+ self(irb objã§èµ·å‹•ã—ãŸæ™‚ã®obj)
--- kill n, irb_kill n
- ¥µ¥Öirb¤òkill¤¹¤ë. n¤Ïfg¤ÈƱ¤¸.
+ サブirbã‚’killã™ã‚‹. nã¯fgã¨åŒã˜.
--- source, irb_source path
- UNIX¥·¥§¥ë¥³¥Þ¥ó¥É¤Îsource¤È»÷¤Æ¤¤¤ë. ¸½ºß¤Î´Ä¶­¾å¤ÇpathÆâ¤Î¥¹¥¯¥ê
- ¥×¥È¤òɾ²Á¤¹¤ë.
+ UNIXシェルコマンドã®sourceã¨ä¼¼ã¦ã„ã‚‹. ç¾åœ¨ã®ç’°å¢ƒä¸Šã§path内ã®ã‚¹ã‚¯ãƒª
+ プトを評価ã™ã‚‹.
--- irb_load path, prev
- Ruby¤Îload¤ÎirbÈÇ.
+ Rubyã®loadã®irb版.
-= ¥·¥¹¥Æ¥àÊÑ¿ô
+= システム変数
---- _
- Á°¤Î·×»»¤Î¼Â¹Ô·ë²Ì¤ò³Ð¤¨¤Æ¤¤¤ë(¥í¡¼¥«¥ëÊÑ¿ô).
---- __
- ¼Â¹Ô·ë²Ì¤ÎÍúÎò¤ò³Ð¤¨¤Æ¤¤¤ë.
- __[line_no]¤Ç¡¢¤½¤Î¹Ô¤Ç¼Â¹Ô¤·¤¿·ë²Ì¤òÆÀ¤ë¤³¤È¤¬¤Ç¤­¤ë. line_no¤¬Éé¤Î
- »þ¤Ë¤Ï¡¢ºÇ¿·¤Î·ë²Ì¤«¤é-line_noÁ°¤Î·ë²Ì¤òÆÀ¤ë¤³¤È¤¬¤Ç¤­¤ë.
+--- _
+ å‰ã®è¨ˆç®—ã®å®Ÿè¡Œçµæžœã‚’覚ãˆã¦ã„ã‚‹(ローカル変数).
+--- __
+ å®Ÿè¡Œçµæžœã®å±¥æ­´ã‚’覚ãˆã¦ã„ã‚‹.
+ __[line_no]ã§ã€ãã®è¡Œã§å®Ÿè¡Œã—ãŸçµæžœã‚’å¾—ã‚‹ã“ã¨ãŒã§ãã‚‹. line_noãŒè² ã®
+ 時ã«ã¯ã€æœ€æ–°ã®çµæžœã‹ã‚‰-line_noå‰ã®çµæžœã‚’å¾—ã‚‹ã“ã¨ãŒã§ãã‚‹.
-= »ÈÍÑÎã
+= 使用例
-°Ê²¼¤Î¤è¤¦¤Ê´¶¤¸¤Ç¤¹.
+以下ã®ã‚ˆã†ãªæ„Ÿã˜ã§ã™.
dim% ruby irb.rb
- irb(main):001:0> irb # ¥µ¥Öirb¤ÎΩ¤Á¤¢¤²
- irb#1(main):001:0> jobs # ¥µ¥Öirb¤Î¥ê¥¹¥È
+ irb(main):001:0> irb # サブirbã®ç«‹ã¡ã‚ã’
+ irb#1(main):001:0> jobs # サブirbã®ãƒªã‚¹ãƒˆ
#0->irb on main (#<Thread:0x400fb7e4> : stop)
#1->irb#1 on main (#<Thread:0x40125d64> : running)
nil
- irb#1(main):002:0> fg 0 # job¤Î¥¹¥¤¥Ã¥Á
+ irb#1(main):002:0> fg 0 # jobã®ã‚¹ã‚¤ãƒƒãƒ
nil
irb(main):002:0> class Foo;end
nil
- irb(main):003:0> irb Foo # Foo¤ò¥³¥ó¥Æ¥­¥¹¥È¤·¤Æirb
- # Ω¤Á¤¢¤²
- irb#2(Foo):001:0> def foo # Foo#foo¤ÎÄêµÁ
+ irb(main):003:0> irb Foo # Fooをコンテキストã—ã¦irb
+ # ç«‹ã¡ã‚ã’
+ irb#2(Foo):001:0> def foo # Foo#fooã®å®šç¾©
irb#2(Foo):002:1> print 1
irb#2(Foo):003:1> end
nil
- irb#2(Foo):004:0> fg 0 # job¤ò¥¹¥¤¥Ã¥Á
+ irb#2(Foo):004:0> fg 0 # jobをスイッãƒ
nil
- irb(main):004:0> jobs # job¤Î¥ê¥¹¥È
+ irb(main):004:0> jobs # jobã®ãƒªã‚¹ãƒˆ
#0->irb on main (#<Thread:0x400fb7e4> : running)
#1->irb#1 on main (#<Thread:0x40125d64> : stop)
#2->irb#2 on Foo (#<Thread:0x4011d54c> : stop)
nil
- irb(main):005:0> Foo.instance_methods # Foo#foo¤¬¤Á¤ã¤ó¤ÈÄêµÁ¤µ
- # ¤ì¤Æ¤¤¤ë
+ irb(main):005:0> Foo.instance_methods # Foo#fooãŒã¡ã‚ƒã‚“ã¨å®šç¾©ã•
+ # れã¦ã„ã‚‹
["foo"]
- irb(main):006:0> fg 2 # job¤ò¥¹¥¤¥Ã¥Á
+ irb(main):006:0> fg 2 # jobをスイッãƒ
nil
- irb#2(Foo):005:0> def bar # Foo#bar¤òÄêµÁ
+ irb#2(Foo):005:0> def bar # Foo#barを定義
irb#2(Foo):006:1> print "bar"
irb#2(Foo):007:1> end
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>
- irb(main):008:0> irb f # Foo¤Î¥¤¥ó¥¹¥¿¥ó¥¹¤Çirb¤ò
- # Ω¤Á¤¢¤²¤ë.
+ irb(main):008:0> irb f # Fooã®ã‚¤ãƒ³ã‚¹ã‚¿ãƒ³ã‚¹ã§irbã‚’
+ # ç«‹ã¡ã‚ã’ã‚‹.
irb#3(#<Foo:0x4010af3c>):001:0> jobs
#0->irb on main (#<Thread:0x400fb7e4> : stop)
#1->irb#1 on main (#<Thread:0x40125d64> : stop)
#2->irb#2 on Foo (#<Thread:0x4011d54c> : stop)
#3->irb#3 on #<Foo:0x4010af3c> (#<Thread:0x4010a1e0> : running)
nil
- irb#3(#<Foo:0x4010af3c>):002:0> foo # f.foo¤Î¼Â¹Ô
+ irb#3(#<Foo:0x4010af3c>):002:0> foo # f.fooã®å®Ÿè¡Œ
nil
- irb#3(#<Foo:0x4010af3c>):003:0> bar # f.bar¤Î¼Â¹Ô
+ irb#3(#<Foo:0x4010af3c>):003:0> bar # f.barã®å®Ÿè¡Œ
barnil
- irb#3(#<Foo:0x4010af3c>):004:0> kill 1, 2, 3# job¤Îkill
+ irb#3(#<Foo:0x4010af3c>):004:0> kill 1, 2, 3# jobã®kill
nil
irb(main):009:0> jobs
#0->irb on main (#<Thread:0x400fb7e4> : running)
nil
- irb(main):010:0> exit # ½ªÎ»
- dim%
+ irb(main):010:0> exit # 終了
+ dim%
-= »ÈÍѾå¤ÎÀ©¸Â
+= 使用上ã®åˆ¶é™
-irb¤Ï, ɾ²Á¤Ç¤­¤ë»þÅÀ(¼°¤¬ÊĤ¸¤¿»þÅÀ)¤Ç¤ÎÃ༡¼Â¹Ô¤ò¹Ô¤Ê¤¤¤Þ¤¹. ¤·¤¿¤¬¤Ã
-¤Æ, ruby¤òľÀܻȤä¿»þ¤È, ¼ã´³°Û¤Ê¤ëưºî¤ò¹Ô¤Ê¤¦¾ì¹ç¤¬¤¢¤ê¤Þ¤¹.
+irbã¯, 評価ã§ãる時点(å¼ãŒé–‰ã˜ãŸæ™‚点)ã§ã®é€æ¬¡å®Ÿè¡Œã‚’行ãªã„ã¾ã™. ã—ãŸãŒã£
+ã¦, rubyを直接使ã£ãŸæ™‚ã¨, 若干異ãªã‚‹å‹•作を行ãªã†å ´åˆãŒã‚りã¾ã™.
-¸½ºßÌÀ¤é¤«¤Ë¤Ê¤Ã¤Æ¤¤¤ëÌäÂêÅÀ¤òÀâÌÀ¤·¤Þ¤¹.
+ç¾åœ¨æ˜Žã‚‰ã‹ã«ãªã£ã¦ã„ã‚‹å•題点を説明ã—ã¾ã™.
-== ¥í¡¼¥«¥ëÊÑ¿ô¤ÎÀë¸À
+== ローカル変数ã®å®£è¨€
-ruby¤Ç¤Ï, °Ê²¼¤Î¥×¥í¥°¥é¥à¤Ï¥¨¥é¡¼¤Ë¤Ê¤ê¤Þ¤¹.
+rubyã§ã¯, 以下ã®ãƒ—ログラムã¯ã‚¨ãƒ©ãƒ¼ã«ãªã‚Šã¾ã™.
eval "foo = 0"
foo
@@ -363,24 +363,24 @@ ruby¤Ç¤Ï, °Ê²¼¤Î¥×¥í¥°¥é¥à¤Ï¥¨¥é¡¼¤Ë¤Ê¤ê¤Þ¤¹.
---
NameError
-¤È¤³¤í¤¬, irb¤òÍѤ¤¤ë¤È
+ã¨ã“ã‚ãŒ, irbを用ã„ã‚‹ã¨
>> eval "foo = 0"
=> 0
>> foo
=> 0
-¤È¤Ê¤ê, ¥¨¥é¡¼¤òµ¯¤³¤·¤Þ¤»¤ó. ¤³¤ì¤Ï, ruby¤¬ºÇ½é¤Ë¥¹¥¯¥ê¥×¥ÈÁ´ÂΤò¥³¥ó
-¥Ñ¥¤¥ë¤·¤Æ¥í¡¼¥«¥ëÊÑ¿ô¤ò·èÄꤹ¤ë¤«¤é¤Ç¤¹. ¤½¤ì¤ËÂФ·, irb¤Ï¼Â¹Ô²Äǽ¤Ë
-¤Ê¤ë(¼°¤¬ÊĤ¸¤ë)¤È¼«Æ°Åª¤Ëɾ²Á¤·¤Æ¤¤¤ë¤«¤é¤Ç¤¹. ¾åµ­¤ÎÎã¤Ç¤Ï,
+ã¨ãªã‚Š, エラーを起ã“ã—ã¾ã›ã‚“. ã“れã¯, rubyãŒæœ€åˆã«ã‚¹ã‚¯ãƒªãƒ—ト全体をコン
+パイルã—ã¦ãƒ­ãƒ¼ã‚«ãƒ«å¤‰æ•°ã‚’決定ã™ã‚‹ã‹ã‚‰ã§ã™. ãれã«å¯¾ã—, irbã¯å®Ÿè¡Œå¯èƒ½ã«
+ãªã‚‹(å¼ãŒé–‰ã˜ã‚‹)ã¨è‡ªå‹•çš„ã«è©•価ã—ã¦ã„ã‚‹ã‹ã‚‰ã§ã™. 上記ã®ä¾‹ã§ã¯,
- evel "foo = 0"
+ evel "foo = 0"
-¤ò¹Ô¤Ê¤Ã¤¿»þÅÀ¤Çɾ²Á¤ò¹Ô¤Ê¤¤, ¤½¤Î»þÅÀ¤ÇÊÑ¿ô¤¬ÄêµÁ¤µ¤ì¤ë¤¿¤á, ¼¡¼°¤Ç
-ÊÑ¿ôfoo¤ÏÄêµÁ¤µ¤ì¤Æ¤¤¤ë¤«¤é¤Ç¤¹.
+を行ãªã£ãŸæ™‚点ã§è©•価を行ãªã„, ãã®æ™‚点ã§å¤‰æ•°ãŒå®šç¾©ã•れるãŸã‚, 次å¼ã§
+変数fooã¯å®šç¾©ã•れã¦ã„ã‚‹ã‹ã‚‰ã§ã™.
-¤³¤Î¤è¤¦¤Êruby¤Èirb¤Îưºî¤Î°ã¤¤¤ò²ò·è¤·¤¿¤¤¾ì¹ç¤Ï, begin...end¤Ç³ç¤Ã¤Æ
-¥Ð¥Ã¥ÁŪ¤Ë¼Â¹Ô¤·¤Æ²¼¤µ¤¤:
+ã“ã®ã‚ˆã†ãªrubyã¨irbã®å‹•作ã®é•ã„を解決ã—ãŸã„å ´åˆã¯, begin...endã§æ‹¬ã£ã¦
+ãƒãƒƒãƒçš„ã«å®Ÿè¡Œã—ã¦ä¸‹ã•ã„:
>> begin
?> eval "foo = 0"
@@ -390,14 +390,14 @@ ruby¤Ç¤Ï, °Ê²¼¤Î¥×¥í¥°¥é¥à¤Ï¥¨¥é¡¼¤Ë¤Ê¤ê¤Þ¤¹.
(irb):3
(irb_local_binding):1:in `eval'
-== ¥Ò¥¢¥É¥­¥å¥á¥ó¥È
+== ヒアドキュメント
-¸½ºß¤Î¤È¤³¤í¥Ò¥¢¥É¥­¥å¥á¥ó¥È¤Î¼ÂÁõ¤ÏÉÔ´°Á´¤Ç¤¹.
+ç¾åœ¨ã®ã¨ã“ã‚ヒアドキュメントã®å®Ÿè£…ã¯ä¸å®Œå…¨ã§ã™.
-== ¥·¥ó¥Ü¥ë
+== シンボル
-¥·¥ó¥Ü¥ë¤Ç¤¢¤ë¤«¤É¤¦¤«¤ÎȽÃǤò´Ö°ã¤¨¤ë¤³¤È¤¬¤¢¤ê¤Þ¤¹. ¶ñÂÎŪ¤Ë¤Ï¼°¤¬´°Î»
-¤·¤Æ¤¤¤ë¤Î¤Ë·Ñ³¹Ô¤È¸«¤Ê¤¹¤³¤È¤¬¤¢¤ê¤Þ¤¹.
+シンボルã§ã‚ã‚‹ã‹ã©ã†ã‹ã®åˆ¤æ–­ã‚’é–“é•ãˆã‚‹ã“ã¨ãŒã‚りã¾ã™. 具体的ã«ã¯å¼ãŒå®Œäº†
+ã—ã¦ã„ã‚‹ã®ã«ç¶™ç¶šè¡Œã¨è¦‹ãªã™ã“ã¨ãŒã‚りã¾ã™.
=end
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/pty/README b/doc/pty/README
deleted file mode 100644
index d6368f3758..0000000000
--- a/doc/pty/README
+++ /dev/null
@@ -1,84 +0,0 @@
-pty extension version 0.3 by A.ito
-
-1. Introduction
-
-This extension module adds ruby a functionality to execute an
-arbitrary command through pseudo tty (pty).
-
-2. Install
-
-Follow the instruction below.
-
-(1) Execute
-
- ruby extconf.rb
-
- then Makefile is generated.
-
-(3) Do make; make install.
-
-3. What you can do
-
-This extension module defines a module named PTY, which contains
-following module fungtions:
-
- getpty(command)
- spawn(command)
-
- This function reserves a pty, executes command over the pty
- and returns an array. The return value is an array with three
- elements. The first element in the array is for reading and the
- second for writing. The third element is the process ID of the
- child process. If this function is called with an iterator block,
- the array is passed to the block as block parameters, and the
- function itself returns nil.
-
- When the child process is suspended or finished, an exception is
- raised. If this function is called with an iterator block,
- exception is raised only within the block. Child process
- monitor is terminated on block exit.
-
- protect_signal
- reset_signal
-
- These functions are obsolete in this version of pty.
-
- PTY.open
-
- Allocates a pty (pseudo-terminal).
-
- It returns an array which contains an IO object and a File object.
- The former is the master of the pty.
- The latter is the slave of the pty.
-
- If a block is given, it yields the array instead of return.
- The value of the block is returned.
- master_io and slave_file is closed when return if they are not closed.
-
- PTY.check(pid[, raise=false])
-
- checks the status of the child process specified by pid, and
- returns nil if the process is still alive and active.
- Otherwise, returns Process::Status about the process if raise is
- false, or PTY::ChildExited exception is raised.
-
-4. License
-
-(C) Copyright 1998 by Akinori Ito.
-
-This software may be redistributed freely for this purpose, in full
-or in part, provided that this entire copyright notice is included
-on any copies of this software and applications and derivations thereof.
-
-This software is provided on an "as is" basis, without warranty of any
-kind, either expressed or implied, as to any matter including, but not
-limited to warranty of fitness of purpose, or merchantability, or
-results obtained from use of this software.
-
-5. Bug report
-
-Please feel free to send E-mail to
-
- aito@ei5sun.yz.yamagata-u.ac.jp
-
-for any bug report, opinion, contribution, etc.
diff --git a/doc/pty/README.expect b/doc/pty/README.expect
deleted file mode 100644
index fddbb6fdad..0000000000
--- a/doc/pty/README.expect
+++ /dev/null
@@ -1,22 +0,0 @@
- README for expect
- by A. Ito, 28 October, 1998
-
- Expect library adds IO class a method called expect(), which
-does similar act to tcl's expect extension.
-
-The usage of the method is:
-
- IO#expect(pattern,timeout=9999999)
-
-where `pattern' is an instance of String or Regexp and `timeout'
-is Fixnum, which can be omitted.
- When the method is called without block, it waits until the
-input which matches the pattern is obtained from the IO or the time
-specified as the timeout passes. When the pattern is obtained from the
-IO, the method returns an array. The first element of the array is the
-entire string obtained from the IO until the pattern matches. The
-following elements indicates the specific pattern which matched to the
-anchor in the regular expression. If the method ends because of
-timeout, it returns nil.
- When the method is called with block, the array is passed as
-the block parameter.
diff --git a/doc/pty/README.expect.ja b/doc/pty/README.expect.ja
index db84695ee5..7c0456f24f 100644
--- a/doc/pty/README.expect.ja
+++ b/doc/pty/README.expect.ja
@@ -1,21 +1,21 @@
README for expect
by A. Ito, 28 October, 1998
- Expect¥é¥¤¥Ö¥é¥ê¤Ï¡¤tcl ¤Î expect ¥Ñ¥Ã¥±¡¼¥¸¤È»÷¤¿¤è¤¦¤Êµ¡Ç½¤ò
-IO¥¯¥é¥¹¤ËÄɲä·¤Þ¤¹¡¥
+ Expectライブラリã¯ï¼Œtcl ã® expect パッケージã¨ä¼¼ãŸã‚ˆã†ãªæ©Ÿèƒ½ã‚’
+IOクラスã«è¿½åŠ ã—ã¾ã™ï¼Ž
- Äɲ䵤ì¤ë¥á¥½¥Ã¥É¤Î»È¤¤Êý¤Ï¼¡¤ÎÄ̤ê¤Ç¤¹¡¥
+ 追加ã•れるメソッドã®ä½¿ã„æ–¹ã¯æ¬¡ã®é€šã‚Šã§ã™ï¼Ž
IO#expect(pattern,timeout=9999999)
-pattern ¤Ï String ¤« Regexp ¤Î¥¤¥ó¥¹¥¿¥ó¥¹¡¤timeout ¤Ï Fixnum
-¤Î¥¤¥ó¥¹¥¿¥ó¥¹¤Ç¤¹¡¥timeout ¤Ï¾Êά¤Ç¤­¤Þ¤¹¡¥
- ¤³¤Î¥á¥½¥Ã¥É¤¬¥Ö¥í¥Ã¥¯¤Ê¤·¤Ç¸Æ¤Ð¤ì¤¿¾ì¹ç¡¤¤Þ¤º¥ì¥·¡¼¥Ð¤Ç¤¢¤ë
-IO¥ª¥Ö¥¸¥§¥¯¥È¤«¤é pattern ¤Ë¥Þ¥Ã¥Á¤¹¤ë¥Ñ¥¿¡¼¥ó¤¬ÆÉ¤ß¤³¤Þ¤ì¤ë
-¤Þ¤ÇÂÔ¤Á¤Þ¤¹¡¥¥Ñ¥¿¡¼¥ó¤¬ÆÀ¤é¤ì¤¿¤é¡¤¤½¤Î¥Ñ¥¿¡¼¥ó¤Ë´Ø¤¹¤ëÇÛÎó¤ò
-ÊÖ¤·¤Þ¤¹¡¥ÇÛÎó¤ÎºÇ½é¤ÎÍ×ÁǤϡ¤pattern ¤Ë¥Þ¥Ã¥Á¤¹¤ë¤Þ¤Ç¤ËÆÉ¤ß¤³
-¤Þ¤ì¤¿ÆâÍÆ¤Îʸ»úÎó¤Ç¤¹¡¥2ÈÖÌܰʹߤÎÍ×ÁǤϡ¤pattern ¤ÎÀµµ¬É½¸½
-¤ÎÃæ¤Ë¥¢¥ó¥«¡¼¤¬¤¢¤Ã¤¿¾ì¹ç¤Ë¡¤¤½¤Î¥¢¥ó¥«¡¼¤Ë¥Þ¥Ã¥Á¤¹¤ëÉôʬ¤Ç¤¹¡¥
-¤â¤·¥¿¥¤¥à¥¢¥¦¥È¤¬µ¯¤­¤¿¾ì¹ç¤Ï¡¤¤³¤Î¥á¥½¥Ã¥É¤Ïnil¤òÊÖ¤·¤Þ¤¹¡¥
- ¤³¤Î¥á¥½¥Ã¥É¤¬¥Ö¥í¥Ã¥¯ÉÕ¤­¤Ç¸Æ¤Ð¤ì¤¿¾ì¹ç¤Ë¤Ï¡¤¥Þ¥Ã¥Á¤·¤¿Í×ÁǤÎ
-ÇÛÎ󤬥֥í¥Ã¥¯°ú¿ô¤È¤·¤ÆÅϤµ¤ì¡¤¥Ö¥í¥Ã¥¯¤¬É¾²Á¤µ¤ì¤Þ¤¹¡¥
+pattern 㯠String ã‹ Regexp ã®ã‚¤ãƒ³ã‚¹ã‚¿ãƒ³ã‚¹ï¼Œtimeout 㯠Fixnum
+ã®ã‚¤ãƒ³ã‚¹ã‚¿ãƒ³ã‚¹ã§ã™ï¼Žtimeout ã¯çœç•¥ã§ãã¾ã™ï¼Ž
+ ã“ã®ãƒ¡ã‚½ãƒƒãƒ‰ãŒãƒ–ロックãªã—ã§å‘¼ã°ã‚ŒãŸå ´åˆï¼Œã¾ãšãƒ¬ã‚·ãƒ¼ãƒã§ã‚ã‚‹
+IOオブジェクトã‹ã‚‰ pattern ã«ãƒžãƒƒãƒã™ã‚‹ãƒ‘ターンãŒèª­ã¿ã“ã¾ã‚Œã‚‹
+ã¾ã§å¾…ã¡ã¾ã™ï¼Žãƒ‘ターンãŒå¾—られãŸã‚‰ï¼Œãã®ãƒ‘ターンã«é–¢ã™ã‚‹é…列を
+è¿”ã—ã¾ã™ï¼Žé…åˆ—ã®æœ€åˆã®è¦ç´ ã¯ï¼Œpattern ã«ãƒžãƒƒãƒã™ã‚‹ã¾ã§ã«èª­ã¿ã“
+ã¾ã‚ŒãŸå†…å®¹ã®æ–‡å­—列ã§ã™ï¼Ž2番目以é™ã®è¦ç´ ã¯ï¼Œpattern ã®æ­£è¦è¡¨ç¾
+ã®ä¸­ã«ã‚¢ãƒ³ã‚«ãƒ¼ãŒã‚ã£ãŸå ´åˆã«ï¼Œãã®ã‚¢ãƒ³ã‚«ãƒ¼ã«ãƒžãƒƒãƒã™ã‚‹éƒ¨åˆ†ã§ã™ï¼Ž
+ã‚‚ã—タイムアウトãŒèµ·ããŸå ´åˆã¯ï¼Œã“ã®ãƒ¡ã‚½ãƒƒãƒ‰ã¯nilã‚’è¿”ã—ã¾ã™ï¼Ž
+ ã“ã®ãƒ¡ã‚½ãƒƒãƒ‰ãŒãƒ–ロック付ãã§å‘¼ã°ã‚ŒãŸå ´åˆã«ã¯ï¼Œãƒžãƒƒãƒã—ãŸè¦ç´ ã®
+é…列ãŒãƒ–ロック引数ã¨ã—ã¦æ¸¡ã•れ,ブロックãŒè©•価ã•れã¾ã™ï¼Ž
diff --git a/doc/pty/README.ja b/doc/pty/README.ja
index ca2a01442a..9b9d306bf7 100644
--- a/doc/pty/README.ja
+++ b/doc/pty/README.ja
@@ -1,76 +1,76 @@
-pty ³ÈÄ¥¥â¥¸¥å¡¼¥ë version 0.3 by A.ito
+pty 拡張モジュール version 0.3 by A.ito
-1. ¤Ï¤¸¤á¤Ë
+1. ã¯ã˜ã‚ã«
-¤³¤Î³ÈÄ¥¥â¥¸¥å¡¼¥ë¤Ï¡¤²¾ÁÛtty (pty) ¤òÄ̤·¤ÆÅ¬Åö¤Ê¥³¥Þ¥ó¥É¤ò
-¼Â¹Ô¤¹¤ëµ¡Ç½¤ò ruby ¤ËÄ󶡤·¤Þ¤¹¡¥
+ã“ã®æ‹¡å¼µãƒ¢ã‚¸ãƒ¥ãƒ¼ãƒ«ã¯ï¼Œä»®æƒ³tty (pty) を通ã—ã¦é©å½“ãªã‚³ãƒžãƒ³ãƒ‰ã‚’
+実行ã™ã‚‹æ©Ÿèƒ½ã‚’ ruby ã«æä¾›ã—ã¾ã™ï¼Ž
-2. ¥¤¥ó¥¹¥È¡¼¥ë
+2. インストール
-¼¡¤Î¤è¤¦¤Ë¤·¤Æ¥¤¥ó¥¹¥È¡¼¥ë¤·¤Æ¤¯¤À¤µ¤¤¡¥
+次ã®ã‚ˆã†ã«ã—ã¦ã‚¤ãƒ³ã‚¹ãƒˆãƒ¼ãƒ«ã—ã¦ãã ã•ã„.
(1) ruby extconf.rb
- ¤ò¼Â¹Ô¤¹¤ë¤È Makefile ¤¬À¸À®¤µ¤ì¤Þ¤¹¡¥
+ を実行ã™ã‚‹ã¨ Makefile ãŒç”Ÿæˆã•れã¾ã™ï¼Ž
-(2) make; make install ¤ò¼Â¹Ô¤·¤Æ¤¯¤À¤µ¤¤¡¥
+(2) make; make install を実行ã—ã¦ãã ã•ã„.
-3. ²¿¤¬¤Ç¤­¤ë¤«
+3. 何ãŒã§ãã‚‹ã‹
-¤³¤Î³ÈÄ¥¥â¥¸¥å¡¼¥ë¤Ï¡¤PTY ¤È¤¤¤¦¥â¥¸¥å¡¼¥ë¤òÄêµÁ¤·¤Þ¤¹¡¥¤½¤ÎÃæ
-¤Ë¤Ï¡¤¼¡¤Î¤è¤¦¤Ê¥â¥¸¥å¡¼¥ë´Ø¿ô¤¬´Þ¤Þ¤ì¤Æ¤¤¤Þ¤¹¡¥
+ã“ã®æ‹¡å¼µãƒ¢ã‚¸ãƒ¥ãƒ¼ãƒ«ã¯ï¼ŒPTY ã¨ã„ã†ãƒ¢ã‚¸ãƒ¥ãƒ¼ãƒ«ã‚’定義ã—ã¾ã™ï¼Žãã®ä¸­
+ã«ã¯ï¼Œæ¬¡ã®ã‚ˆã†ãªãƒ¢ã‚¸ãƒ¥ãƒ¼ãƒ«é–¢æ•°ãŒå«ã¾ã‚Œã¦ã„ã¾ã™ï¼Ž
getpty(command)
spawn(command)
- ¤³¤Î´Ø¿ô¤Ï¡¤²¾ÁÛtty¤ò³ÎÊݤ·¡¤»ØÄꤵ¤ì¤¿¥³¥Þ¥ó¥É¤ò¤½¤Î²¾ÁÛtty
- ¤Î¸þ¤³¤¦¤Ç¼Â¹Ô¤·¡¤ÇÛÎó¤òÊÖ¤·¤Þ¤¹¡¥Ìá¤êÃͤÏ3¤Ä¤ÎÍ×ÁǤ«¤é¤Ê¤ë
- ÇÛÎó¤Ç¤¹¡¥ºÇ½é¤ÎÍ×ÁǤϲ¾ÁÛtty¤«¤éÆÉ¤ß½Ð¤¹¤¿¤á¤ÎIO¥ª¥Ö¥¸¥§¥¯¥È¡¤
- 2ÈÖÌܤϽñ¤­¤³¤à¤¿¤á¤ÎIO¥ª¥Ö¥¸¥§¥¯¥È¡¤3ÈÖÌÜ¤Ï»Ò¥×¥í¥»¥¹¤Î¥×¥í
- ¥»¥¹ID¤Ç¤¹¡¥¤³¤Î´Ø¿ô¤¬¥¤¥Æ¥ì¡¼¥¿¤È¤·¤Æ¸Æ¤Ð¤ì¤¿¾ì¹ç¡¤¤³¤ì¤é¤Î
- Í×ÁǤϥ֥í¥Ã¥¯¥Ñ¥é¥á¡¼¥¿¤È¤·¤ÆÅϤµ¤ì¡¤´Ø¿ô¼«ÂΤÏnil¤òÊÖ¤·¤Þ¤¹¡¥
-
- »Ò¥×¥í¥»¥¹¤¬½ªÎ»¤·¤¿¤êÄä»ß¤·¤¿¾ì¹ç¤Ë¤Ï¡¤Îã³°¤¬È¯À¸¤·¤Þ¤¹¡¥¤³¤Î´Ø
- ¿ô¤¬¥Ö¥í¥Ã¥¯¥Ñ¥é¥á¡¼¥¿ÉÕ¤­¤Ç¸Æ¤Ð¤ì¤¿¾ì¹ç¤Ë¤Ï¡¤¤½¤Î¥Ö¥í¥Ã¥¯¤ÎÃæ¤Ç
- ¤Î¤ßÎã³°¤¬È¯À¸¤·¤Þ¤¹¡¥»Ò¥×¥í¥»¥¹¤ò¥â¥Ë¥¿¡¼¤·¤Æ¤¤¤ë¥¹¥ì¥Ã¥É¤Ï¥Ö¥í¥Ã
- ¥¯¤òÈ´¤±¤ë¤È¤­¤Ë½ªÎ»¤·¤Þ¤¹¡¥
+ ã“ã®é–¢æ•°ã¯ï¼Œä»®æƒ³ttyを確ä¿ã—,指定ã•れãŸã‚³ãƒžãƒ³ãƒ‰ã‚’ãã®ä»®æƒ³tty
+ ã®å‘ã“ã†ã§å®Ÿè¡Œã—,é…列を返ã—ã¾ã™ï¼Žæˆ»ã‚Šå€¤ã¯3ã¤ã®è¦ç´ ã‹ã‚‰ãªã‚‹
+ é…列ã§ã™ï¼Žæœ€åˆã®è¦ç´ ã¯ä»®æƒ³ttyã‹ã‚‰èª­ã¿å‡ºã™ãŸã‚ã®IOオブジェクト,
+ 2ç•ªç›®ã¯æ›¸ãã“ã‚€ãŸã‚ã®IOオブジェクト,3番目ã¯å­ãƒ—ロセスã®ãƒ—ロ
+ セスIDã§ã™ï¼Žã“ã®é–¢æ•°ãŒã‚¤ãƒ†ãƒ¬ãƒ¼ã‚¿ã¨ã—ã¦å‘¼ã°ã‚ŒãŸå ´åˆï¼Œã“れらã®
+ è¦ç´ ã¯ãƒ–ロックパラメータã¨ã—ã¦æ¸¡ã•れ,関数自体ã¯nilã‚’è¿”ã—ã¾ã™ï¼Ž
+
+ å­ãƒ—ロセスãŒçµ‚了ã—ãŸã‚Šåœæ­¢ã—ãŸå ´åˆã«ã¯ï¼Œä¾‹å¤–ãŒç™ºç”Ÿã—ã¾ã™ï¼Žã“ã®é–¢
+ æ•°ãŒãƒ–ロックパラメータ付ãã§å‘¼ã°ã‚ŒãŸå ´åˆã«ã¯ï¼Œãã®ãƒ–ロックã®ä¸­ã§
+ ã®ã¿ä¾‹å¤–ãŒç™ºç”Ÿã—ã¾ã™ï¼Žå­ãƒ—ロセスをモニターã—ã¦ã„るスレッドã¯ãƒ–ロッ
+ クを抜ã‘ã‚‹ã¨ãã«çµ‚了ã—ã¾ã™ï¼Ž
protect_signal
reset_signal
- ÇÑ»ßͽÄê¤Ç¤¹¡¥
+ 廃止予定ã§ã™ï¼Ž
PTY.open
- ²¾ÁÛtty¤ò³ÎÊݤ·¡¤¥Þ¥¹¥¿¡¼Â¦¤ËÂбþ¤¹¤ëIO¥ª¥Ö¥¸¥§¥¯¥È¤È¥¹¥ì¡¼¥Ö¦¤Ë
- Âбþ¤¹¤ëFile¥ª¥Ö¥¸¥§¥¯¥È¤ÎÇÛÎó¤òÊÖ¤·¤Þ¤¹¡¥¥Ö¥í¥Ã¥¯ÉÕ¤­¤Ç¸Æ¤Ó½Ð¤µ
- ¤ì¤¿¾ì¹ç¤Ï¡¤¤³¤ì¤é¤ÎÍ×ÁǤϥ֥í¥Ã¥¯¥Ñ¥é¥á¡¼¥¿¤È¤·¤ÆÅϤµ¤ì¡¤¥Ö¥í¥Ã
- ¥¯¤«¤éÊÖ¤µ¤ì¤¿·ë²Ì¤òÊÖ¤·¤Þ¤¹¡¥¤Þ¤¿¡¢¤³¤Î¥Þ¥¹¥¿¡¼IO¤È¥¹¥ì¡¼¥ÖFile
- ¤Ï¡¢¥Ö¥í¥Ã¥¯¤òÈ´¤±¤ë¤È¤­¤Ë¥¯¥í¡¼¥ººÑ¤ß¤Ç¤Ê¤±¤ì¤Ð¥¯¥í¡¼¥º¤µ¤ì¤Þ¤¹¡¥
+ 仮想ttyを確ä¿ã—,マスターå´ã«å¯¾å¿œã™ã‚‹IOオブジェクトã¨ã‚¹ãƒ¬ãƒ¼ãƒ–å´ã«
+ 対応ã™ã‚‹Fileオブジェクトã®é…列を返ã—ã¾ã™ï¼Žãƒ–ロック付ãã§å‘¼ã³å‡ºã•
+ れãŸå ´åˆã¯ï¼Œã“れらã®è¦ç´ ã¯ãƒ–ロックパラメータã¨ã—ã¦æ¸¡ã•れ,ブロッ
+ クã‹ã‚‰è¿”ã•れãŸçµæžœã‚’è¿”ã—ã¾ã™ï¼Žã¾ãŸã€ã“ã®ãƒžã‚¹ã‚¿ãƒ¼IOã¨ã‚¹ãƒ¬ãƒ¼ãƒ–File
+ ã¯ã€ãƒ–ロックを抜ã‘ã‚‹ã¨ãã«ã‚¯ãƒ­ãƒ¼ã‚ºæ¸ˆã¿ã§ãªã‘れã°ã‚¯ãƒ­ãƒ¼ã‚ºã•れã¾ã™ï¼Ž
PTY.check(pid[, raise=false])
- pid¤Ç»ØÄꤵ¤ì¤¿»Ò¥×¥í¥»¥¹¤Î¾õÂÖ¤ò¥Á¥§¥Ã¥¯¤·¡¤¼Â¹ÔÃæ¤Ç¤¢¤ì¤Ðnil¤ò
- ÊÖ¤·¤Þ¤¹¡¥½ªÎ»¤·¤Æ¤¤¤ë¤«Ää»ß¤·¤Æ¤¤¤ë¾ì¹ç¡¢ÂèÆó°ú¿ô¤¬µ¶¤Ç¤¢¤ì¤Ð¡¢
- Âбþ¤¹¤ëProcess::Status¥ª¥Ö¥¸¥§¥¯¥È¤òÊÖ¤·¤Þ¤¹¡£¿¿¤Ç¤¢¤ì¤Ð
- PTY::ChildExitedÎã³°¤¬È¯À¸¤·¤Þ¤¹¡¥
+ pidã§æŒ‡å®šã•れãŸå­ãƒ—ロセスã®çŠ¶æ…‹ã‚’ãƒã‚§ãƒƒã‚¯ã—,実行中ã§ã‚れã°nilã‚’
+ è¿”ã—ã¾ã™ï¼Žçµ‚了ã—ã¦ã„ã‚‹ã‹åœæ­¢ã—ã¦ã„ã‚‹å ´åˆã€ç¬¬äºŒå¼•æ•°ãŒå½ã§ã‚れã°ã€
+ 対応ã™ã‚‹Process::Statusオブジェクトを返ã—ã¾ã™ã€‚真ã§ã‚れã°
+ PTY::ChildExited例外ãŒç™ºç”Ÿã—ã¾ã™ï¼Ž
-4. ÍøÍѤˤĤ¤¤Æ
+4. 利用ã«ã¤ã„ã¦
-°ËÆ£¾´Â§¤¬Ãøºî¸¢¤òÊÝÍ­¤·¤Þ¤¹¡¥
+伊藤彰則ãŒè‘—ä½œæ¨©ã‚’ä¿æœ‰ã—ã¾ã™ï¼Ž
-¥½¡¼¥¹¥×¥í¥°¥é¥à¤Þ¤¿¤Ï¥É¥­¥å¥á¥ó¥È¤Ë¸µ¤ÎÃøºî¸¢É½¼¨¤¬²þÊѤµ¤ì¤º¤Ë
-ɽ¼¨¤µ¤ì¤Æ¤¤¤ë¾ì¹ç¤Ë¸Â¤ê¡¤Ã¯¤Ç¤â¡¤¤³¤Î¥½¥Õ¥È¥¦¥§¥¢¤ò̵½þ¤«¤ÄÃøºî
-¸¢¼Ô¤Ë̵ÃǤÇÍøÍÑ¡¦ÇÛÉÛ¡¦²þÊѤǤ­¤Þ¤¹¡¥ÍøÍÑÌÜŪ¤Ï¸ÂÄꤵ¤ì¤Æ¤¤¤Þ¤»
-¤ó¡¥
+ソースプログラムã¾ãŸã¯ãƒ‰ã‚­ãƒ¥ãƒ¡ãƒ³ãƒˆã«å…ƒã®è‘—ä½œæ¨©è¡¨ç¤ºãŒæ”¹å¤‰ã•れãšã«
+表示ã•れã¦ã„ã‚‹å ´åˆã«é™ã‚Šï¼Œèª°ã§ã‚‚,ã“ã®ã‚½ãƒ•トウェアを無償ã‹ã¤è‘—作
+権者ã«ç„¡æ–­ã§åˆ©ç”¨ãƒ»é…布・改変ã§ãã¾ã™ï¼Žåˆ©ç”¨ç›®çš„ã¯é™å®šã•れã¦ã„ã¾ã›
+ん.
-¤³¤Î¥×¥í¥°¥é¥à¤ÎÍøÍÑ¡¦ÇÛÉÛ¤½¤Î¾¤³¤Î¥×¥í¥°¥é¥à¤Ë´Ø·¸¤¹¤ë¹Ô°Ù¤Ë¤è
-¤Ã¤ÆÀ¸¤¸¤¿¤¤¤«¤Ê¤ë»³²¤ËÂФ·¤Æ¤â¡¤ºî¼Ô¤Ï°ìÀÚÀÕǤ¤òÉ餤¤Þ¤»¤ó¡¥
+ã“ã®ãƒ—ログラムã®åˆ©ç”¨ãƒ»é…布ãã®ä»–ã“ã®ãƒ—ログラムã«é–¢ä¿‚ã™ã‚‹è¡Œç‚ºã«ã‚ˆ
+ã£ã¦ç”Ÿã˜ãŸã„ã‹ãªã‚‹æå®³ã«å¯¾ã—ã¦ã‚‚,作者ã¯ä¸€åˆ‡è²¬ä»»ã‚’è² ã„ã¾ã›ã‚“.
-5. ¥Ð¥°Êó¹ðÅù
+5. ãƒã‚°å ±å‘Šç­‰
-¥Ð¥°¥ì¥Ý¡¼¥È¤Ï´¿·Þ¤·¤Þ¤¹¡¥
+ãƒã‚°ãƒ¬ãƒãƒ¼ãƒˆã¯æ­“迎ã—ã¾ã™ï¼Ž
aito@ei5sun.yz.yamagata-u.ac.jp
-¤Þ¤ÇÅŻҥ᡼¥ë¤Ç¥Ð¥°¥ì¥Ý¡¼¥È¤ò¤ªÁ÷¤ê¤¯¤À¤µ¤¤¡¥
+ã¾ã§é›»å­ãƒ¡ãƒ¼ãƒ«ã§ãƒã‚°ãƒ¬ãƒãƒ¼ãƒˆã‚’ãŠé€ã‚Šãã ã•ã„.
diff --git a/doc/rake/CHANGES b/doc/rake/CHANGES
deleted file mode 100644
index 3b1a02b812..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 c60e53f51a..0000000000
--- a/doc/rake/command_line_usage.rdoc
+++ /dev/null
@@ -1,102 +0,0 @@
-= Rake Command Line Usage
-
-Rake is invoked from the command line using:
-
- % rake [<em>options</em> ...] [<em>VAR</em>=<em>VALUE</em>] [<em>targets</em> ...]
-
-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>--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>--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_ (-p)]
- Execute some Ruby code, then continue with normal task processing.
-
-[<tt>--help</tt> (-H)]
- Display some help text and exit.
-
-[<tt>--libdir</tt> _directory_ (-I)]
- Add _directory_ to the list of directories searched for require.
-
-[<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>--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>--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> (-T)]
- Display a list of the major tasks and their comments. Comments
- are defined using the "desc" command.
-
-[<tt>--trace</tt> (-t)]
- Turn on invoke/execute tracing. Also enable full backtrace on
- errors.
-
-[<tt>--usage</tt> (-h)]
- Display a usage message and exit.
-
-[<tt>--verbose</tt> (-v)]
- Echo the Sys commands to standard output.
-
-[<tt>--version</tt> (-V)]
- Display the program version and exit.
-
-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 0ca1869306..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 (possiblity 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 39b9b88c1f..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 f8ae72c32a..0000000000
--- a/doc/rake/rakefile.rdoc
+++ /dev/null
@@ -1,534 +0,0 @@
-= Rakefile Format (as of version 0.8.3)
-
-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 (inclosed 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 paramter..
-
- 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 whereever 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 prerequites 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 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 to argumements 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 paramters, 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
-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.
-
-== Accessing Task Programatically
-
-Sometimes it is useful to manipulate tasks programatically 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 +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 specified. 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.
-
-=== Example:
-
- require 'rake/loaders/makefile'
-
- file ".depends.mf" => [SRC_LIST] do |t|
- sh "makedepend -f- -- #{CFLAGS} -- #{t.prerequisites} > #{t.name}"
- end
-
- 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 defined comment. 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 interfer with
-each other.
-
-For example:
-
- namespace "main"
- 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 verses { }
-
-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 parenthesis 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
-prerequistes 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 -- Main documentation for Rake.
diff --git a/doc/rake/rational.rdoc b/doc/rake/rational.rdoc
deleted file mode 100644
index f741e65bf8..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 truely 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 dependecies 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 excerise 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 fb0c5d4e36..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/re.rdoc b/doc/regexp.rdoc
index d629a4a79e..3c13b6683f 100644
--- a/doc/re.rdoc
+++ b/doc/regexp.rdoc
@@ -16,14 +16,47 @@ 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
_s_ followed by the letter _t_, so it matches _haystack_, also.
+== <tt>=~</tt> and Regexp#match
+
+Pattern matching may be achieved by using <tt>=~</tt> operator or Regexp#match
+method.
+
+=== <tt>=~</tt> operator
+
+<tt>=~</tt> is Ruby's basic pattern-matching operator. When one operand is a
+regular expression and the other is a string then the regular expression is
+used as a pattern to match against the string. (This operator is equivalently
+defined by Regexp and String so the order of String and Regexp do not matter.
+Other classes may have different implementations of <tt>=~</tt>.) If a match
+is found, the operator returns index of first match in string, otherwise it
+returns +nil+.
+
+ /hay/ =~ 'haystack' #=> 0
+ 'haystack' =~ /hay/ #=> 0
+ /a/ =~ 'haystack' #=> 1
+ /u/ =~ 'haystack' #=> nil
+
+Using <tt>=~</tt> operator with a String and Regexp the <tt>$~</tt> global
+variable is set after a successful match. <tt>$~</tt> holds a MatchData
+object. Regexp.last_match is equivalent to <tt>$~</tt>.
+
+=== Regexp#match method
+
+The #match method returns a MatchData object:
+
+ /st/.match('haystack') #=> #<MatchData "st">
+
== Metacharacters and Escapes
The following are <i>metacharacters</i> <tt>(</tt>, <tt>)</tt>,
@@ -78,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:
@@ -86,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>)
@@ -111,7 +148,7 @@ matches any character in the Unicode _Nd_ category.
* <tt>/[[:print:]]/</tt> - Like [:graph:], but includes the space character
* <tt>/[[:punct:]]/</tt> - Punctuation character
* <tt>/[[:space:]]/</tt> - Whitespace character (<tt>[:blank:]</tt>, newline,
- carriage return, etc.)
+ carriage return, etc.)
* <tt>/[[:upper:]]/</tt> - Uppercase alphabetical
* <tt>/[[:xdigit:]]/</tt> - Digit allowed in a hexadecimal number (i.e.,
0-9a-fA-F)
@@ -143,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
@@ -153,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>">
@@ -169,15 +208,18 @@ jeopardises the overall match.
Parentheses can be used for <i>capturing</i>. The text enclosed by the
<i>n</i><sup>th</sup> group of parentheses can be subsequently referred to
with <i>n</i>. Within a pattern use the <i>backreference</i>
-<tt>\</tt><i>n</i>; outside of the pattern use
+<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
@@ -209,26 +251,31 @@ 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">
The <tt>(?:</tt>...<tt>)</tt> construct provides grouping without
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 readabilty.
+expense of readability.
+
+The first group of parentheses captures 'n' and the second 'ti'. The second
+group is referred to later with the backreference <tt>\2</tt>:
- # The group of parentheses captures 'n' and the second 'ti'. The
- # second group is referred to later with the backreference \2
/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">
@@ -241,16 +288,18 @@ it matches becomes fixed for the remainder of the match, unless the entire
subexpression must be abandoned and subsequently revisited. In this
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 needlesly.
+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
@@ -260,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/ =~ '()'
@@ -396,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
@@ -435,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">
@@ -473,6 +533,13 @@ expression enclosed by the parentheses.
/a(?i:b)c/.match('aBc') #=> #<MatchData "aBc">
/a(?i:b)c/.match('abc') #=> #<MatchData "abc">
+Options may also be used with <tt>Regexp.new</tt>:
+
+ Regexp.new("abc", Regexp::IGNORECASE) #=> /abc/i
+ Regexp.new("abc", Regexp::MULTILINE) #=> /abc/m
+ Regexp.new("abc # Comment", Regexp::EXTENDED) #=> /abc # Comment/x
+ Regexp.new("abc", Regexp::IGNORECASE | Regexp::MULTILINE) #=> /abc/mi
+
== Free-Spacing Mode and Comments
As mentioned above, the <tt>x</tt> option enables <i>free-spacing</i>
@@ -481,7 +548,8 @@ 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
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
@@ -525,6 +593,40 @@ regexp's encoding can be explicitly fixed by supplying
#=> Encoding::CompatibilityError: incompatible encoding regexp match
(ISO-8859-1 regexp with UTF-8 string)
+== Special global variables
+
+Pattern matching sets some global variables :
+* <tt>$~</tt> is equivalent to Regexp.last_match;
+* <tt>$&</tt> contains the complete matched text;
+* <tt>$`</tt> contains string before match;
+* <tt>$'</tt> contains string after match;
+* <tt>$1</tt>, <tt>$2</tt> and so on contain text matching first, second, etc
+ capture group;
+* <tt>$+</tt> contains last capture group.
+
+Example:
+
+ m = /s(\w{2}).*(c)/.match('haystack') #=> #<MatchData "stac" 1:"ta" 2:"c">
+ $~ #=> #<MatchData "stac" 1:"ta" 2:"c">
+ Regexp.last_match #=> #<MatchData "stac" 1:"ta" 2:"c">
+
+ $& #=> "stac"
+ # same as m[0]
+ $` #=> "hay"
+ # same as m.pre_match
+ $' #=> "k"
+ # same as m.post_match
+ $1 #=> "ta"
+ # same as m[1]
+ $2 #=> "c"
+ # same as m[2]
+ $3 #=> nil
+ # no third group in pattern
+ $+ #=> "c"
+ # same as m[-1]
+
+These global variables are thread-local and method-local variables.
+
== Performance
Certain pathological combinations of constructs can lead to abysmally bad
@@ -533,18 +635,18 @@ performance.
Consider a string of 25 <i>a</i>s, a <i>d</i>, 4 <i>a</i>s, and a
<i>c</i>.
- s = 'a' * 25 + 'd' 'a' * 4 + 'c'
- #=> "aaaaaaaaaaaaaaaaaaaaaaaaadadadadac"
+ s = 'a' * 25 + 'd' + 'a' * 4 + 'c'
+ #=> "aaaaaaaaaaaaaaaaaaaaaaaaadaaaac"
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:
- /(b|a+)*c/ =~ s #=> 32
+ /(b|a+)*c/ =~ s #=> 26
This happens because an atom in the regexp is quantified by both an
immediate <tt>+</tt> and an enclosing <tt>*</tt> with nothing to
@@ -563,8 +665,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
@@ -573,10 +676,10 @@ repeatedly so as to satisfy as many of the optional matches as it can
while still matching the mandatory 29. It is plain to us that none of the
optional matches can succeed, but this fact unfortunately eludes Ruby.
-One approach for improving performance is to anchor the match to the
-beginning of the string, thus significantly reducing the amount of
-backtracking needed.
+The best way to improve performance is to significantly reduce the amount of
+backtracking needed. For this case, instead of individually matching 29
+optional <i>a</i>s, a range of optional <i>a</i>s can be matched all at once
+with <i>a{0,29}</i>:
- Regexp.new('\A' 'a?' * 29 + 'a' * 29).match('a' * 29)
- #=> #<MatchData "aaaaaaaaaaaaaaaaaaaaaaaaaaaaa">
+ Regexp.new('a{0,29}' + 'a' * 29) =~ 'a' * 29
diff --git a/doc/rubygems/ChangeLog b/doc/rubygems/ChangeLog
deleted file mode 100644
index 2e67a4c2c5..0000000000
--- a/doc/rubygems/ChangeLog
+++ /dev/null
@@ -1,5689 +0,0 @@
-# -*- coding: utf-8 -*-
-
-2010-02-20 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems.rb: 1.3.6.
- * test/*: Windows test fixes
- * lib/rubygems/remote_fetcher.rb: Fix same file detection on windows.
-
-2010-02-15 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/config_file.rb: Fix use of ConfigFile#api_key= vs
- #rubygems_api_key=. Patch by Nick Quaranto.
-
-2010-02-12 Eric Hodel <drbrain@segment7.net>
-
- * Rakefile: RubyGems doesn't depend on previous RubyGems.
-
-2010-02-11 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems.rb: http://rubygems.org is now the default source.
- * lib/rubygems/dependency.rb: Only warn once about
- #version_requirement
-
-2010-02-09 Eric Hodel <drbrain@segment7.net>
-
- * bin/update_rubygems: Use system, exec more correctly, remove
- useless puts.
- * lib/rubygems/commands/query_command.rb: List every version when
- --prerelease --all is given.
-
-2010-02-08 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/commands/dependency_command.rb: Support --prerelease.
- * lib/rubygems/commands/fetch_command.rb: Support --prerelease.
- * lib/rubygems/format.rb: Don't crash on empty files. Bug #27292 by
- Ian Ragsdale.
- * lib/rubygems/server.rb: Fix markup. Bug #27045 by Eric Young.
- * History.txt: RubyGems 1.3.6 release notes.
-
-2010-02-07 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/dependency_installer.rb: Allow prerelease gems to
- depend on non-prerelease gems.
-
-2010-02-06 Eric Hodel <drbrain@segment7.net>
-
- * test/test_gem_commands_specification_command.rb: Don't enforce YAML
- format. Patch #27791 by Aaron Patterson.
- * lib/rubygems/version.rb: Allow captial letters in prerelease
- versions.
- * lib/rubygems/config_file.rb: Explain format of ~/.gemrc. Bug
- #27698 by J Smith.
- * lib/rubygems/gem_path_searcher.rb: Handle nil require_paths.
- Patch #27334 by Roger Pack.
- * lib/rubygems/server.rb: Handle --bind option. Patch #27357 by
- Bruno Michel.
- * lib/rubygems/doc_manager: gem rdoc --overwrite to preserve built
- rdoc. Patch #25982 by Akinori MUSHA.
- * lib/rubygems/commands/which_command.rb: Fail if no paths were
- found. Adapted patch #27681 by Caio Chassot.
- * lib/rubygems/remote_fetcher.rb: Don't copy if the file is where we
- want it. Patch #27409 by Jakub Šťastný.
-
-2010-02-01 John Barnette <jbarnette@rubygems.org>
-
- * lib/rubygems/command*: Add 'gem push' and 'gem owner' for
- interacting with modern/Gemcutter sources [Nick Quaranto]
-
-2010-01-18 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/dependency_list.rb: Ignore development dependencies
- unless explicitly needed. Bug #27608 by Roger Pack.
-
-2010-01-12 John Barnette <jbarnette@rubygems.org>
-
- * Rakefile: Don't add development deps when building the
- rubygems-update gem, it borks older versions when they're updating
- from a stub index.
-
-2009-12-22 Evan Phoenix <evan@fallingsnow.net>
-
- * lib/rubygems/spec_fetcher.rb: Don't bother re-Marshaling the spec
- YAML list.
-
-2009-11-04 John Barnette <jbarnette@rubygems.org>
-
- * lib/rubygems/timer.rb: Removed. The deprecation sun set in July.
-
-2009-10-14 John Barnette <jbarnette@rubygems.org>
-
- * lib/rubygems/dependency.rb: Burndown/cleanup. Refactored code
- and tests. Gem::Dependency.version_requirement(s) is deprecated in
- favor of Gem::Dependency.requirement.
-
- * lib/rubygems/requirement.rb: Burndown/cleanup. Refactored code
- and tests. See test/support/shortcuts.rb for some new test helpers.
-
-2009-10-13 John Barnette <jbarnette@rubygems.org>
-
- * lib/rubygems/local_remote_options.rb: Make --source additive,
- not exclusive. If exclusive sources are desired, use
- --clear-sources first.
-
-2009-09-29 John Barnette <jbarnette@rubyforge.org>
-
- * lib/rubygems/spec_fetcher.rb: Be slightly more robust when faced
- with corrupted indexes.
-
-2009-09-03 John Barnette <jbarnette@rubyforge.org>
-
- * LOTS: Use "raise" consistently, not "fail".
-
-2009-09-01 John Barnette <jbarnette@rubyforge.org>
-
- * lib/rubygems/version.rb: Gem::Version immutability
- burndown. Changed canonical internal representation to an
- Array. Refactored significant amounts of the internals for
- clarity. Breaking change: Gem::Version::Requirement is no longer
- available, use Gem::Requirement instead. Breaking change: custom
- YAML marshaling is gone. Credit to Yehuda Katz for certain bits of
- a related patch.
- * test/test_gem_dependency.rb: Moved a bunch of tests over from
- test_gem_version.rb. Work in progress.
- * test/test_gem_specification.rb: Removed a failing YAML
- test. Many more will be going away shortly.
- * test/test_gem_version.rb: Significant refactoring for
- maintainability and clarity. Moved a ton of poorly-placed tests to
- test_gem_dependency.rb for future refactoring.
-
-2009-08-19 Ryan Davis <ryand-ruby@zenspider.com>
-
- * lib/rubygems.rb: Cleanup of rdoc and file layout.
- * lib/rubygems/versions.rb: Added Version#spermy_recommendation
- and fixed bug in Version::Part#inspect. General cleanup.
-
-2009-07-29 John Barnette <jbarnette@rubyforge.org>
-
- * lib/rubygems/package/tar_input.rb: Add Maglev to the list of
- implementations with working Zlib. Bug #26790 by Peter McLain.
-
-2009-07-21 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems.rb: 1.3.5.
- * lib/rubygems/package.rb: Remove dangling digest require. Reported
- by Jeremy Kemper.
-
-2009-06-25 Eric Hodel <drbrain@segment7.net>
-
- * release_notes/: Merged into History.txt for Hoe.
- * lib/rubygems/commands/setup_command.rb: Streamlined install text.
-
-2009-06-23 Eric Hodel <drbrain@segment7.net>
-
- * release_notes/rel_1_3_5.rdoc: RubyGems 1.3.5 release notes.
- * lib/rubygems/builder.rb: Only print out with verbose.
- * lib/rubygems/package_task.rb: Only print out with -t.
-
-2009-06-12 Ryan Davis <ryand@zenspider.com>
-
- * Rakefile: Switched to Hoe.
-
-2009-06-10 Phil Hagelberg <technomancy@gmail.com>
-
- * lib/rubygems/installer.rb: --user-install is no longer enabled by
- default.
- * lib/rubygems/source_index.rb: Fix use of prerelease gems.
-
-2009-06-04 Eric Hodel <drbrain@segment7.net>
-
- * util/gem_prelude.rb.template: Backports from 1.9.
-
-2009-06-03 Eric Hodel <drbrain@segment7.net>
-
- * bin/gem: Support 1.8.6+
- * lib/rubygems/digest*: Removed, support dropped for Ruby < 1.8.6
- * lib/rubygems/installer.rb: Support env(1) in wrong path, use
- /bin/sh if shebang has options. By Nobu, ruby trunk r22853.
- * lib/rubygems/config_file.rb: Switch to stdcall for appdata folder.
- [ruby-core:22601].
- * lib/rubygems.rb: Use only File::expand_path on 1.9 for home dir.
- Don't recklessly create directories. Simplify RbConfig::datadir
- definition.
-
-2009-05-30 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/commands/which_command.rb: Only print out directory
- information to a TTY.
- * lib/rubygems/rubygems_version.rb: 1.3.4.
- * doc/release_notes/rel_1_3_4.rdoc: RubyGems 1.3.4 release notes.
-
-2009-05-28 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/commands/setup_command.rb: Fix --format-executable
- option name.
- * lib/rubygems/requirement.rb: Fix typo in #parse. Bug #26000 by
- Mike Gunderloy.
-
-2009-05-21 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems.rb: Add 'dev' and svn revision for -1 RUBY_PATCHLEVEL
- and RUBY_REVISION.
-
-2009-05-20 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/defaults.rb: Restore 1.9.1 path behavior.
- * lib/rubygems/specification.rb: Fix undefined ivar warning.
- * lib/rubygems/indexer.rb: Force loading of builder gem.
- * test/gemutilities.rb: Remove gem_prelude code by hand to avoid 1.9
- warnings.
-
-2009-05-19 Luis Lavena <luislavena@gmail.com>
-
- * test/test_gem_specification.rb: skip symlinks tests on Windows.
- * test/test_gem_commands_install_command.rb: skip chmod test on
- Windows.
-
-2009-05-15 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems*: Fix 1.9 warnings about circular require.
-
-2009-05-12 Daniel Berger <djberg96@gmail.com>
-
- * lib/rubygems/remote_fetcher.rb: Fixed the download method in the
- remote_fetcher.rb file so that it handles local installs on MS
- Windows when using explicit paths that aren't on the 'C:' drive.
- Bug #25882 by Lars Christensen.
- * lib/rubygems/commands/update_command.rb: Replaced deprecated
- Gem::SourceIndex method 'search' with 'find_name' in the 'execute'
- method.
-
-2009-05-07 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/commands/query_command.rb: Support prerelease version
- listing (--prerelease), list locally installed prereleases.
- * lib/rubygems/source_info_cache.rb: Gem::SourceInfoCache is
- officially unsupported, maintaining its tests is hard.
- * lib/rubygems/source_index.rb: Add #all_gems, fix #remove_spec,
- #search to work with it. Prerelease gems can now be used.
-
-2009-05-04 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/rubygems_version.rb: 1.3.3.
- * doc/release_notes/rel_1_3_3.rdoc: RubyGems 1.3.3 release notes.
- * lib/rubygems/specification.rb: Default has_rdoc to true, ignore
- its value.
- * lib/rubygems/doc_manager.rb: Always generate RDoc regardless of
- #has_rdoc?
- * lib/rubygems.rb: Raise Gem::LoadError if Kernel#gem fails due to
- previously-loaded gem. Bug reported by Alf Mikula.
-
-2009-05-02 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/commands/server_command.rb: Allow port names with
- --port.
- * lib/rubygems/requirement.rb: Match prerelease versions and ~>
- correctly. Patch #25759 by Yossef Mendelssohn.
-
-2009-05-01 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/specification.rb: Check bindir for executables, not
- root. Bug reported by David Chelimsky. Remove Time.today, no way
- to override it before RubyGems loads. Bug #25564 by Emanuele
- Vicentini. Raise Gem::Exception for #installation_path when not
- installed. Bug #25741 by Daniel Berger. Don't error in #validate
- when homepage is nil. Bug #25677 by Mike Burrows.
- * lib/rubygems/commands/cleanup_command.rb: Clean up --user-install
- gems. Bug #25516 by Brett Eisenberg.
- * lib/rubygems/uninstaller.rb: Uninstall executables from the correct
- directory. Bug #25555 by Brett Eisenberg.
- * lib/rubygems/server.rb: Add search that jumps to RDoc. Patch
- #22959 by Vladimir Dobriakov.
-
-2009-05-01 James Tucker <jftucker@gmail.com>
-
- * lib/rubygems.rb: Gem.bin_path now escapes paths with spaces.
-
-2009-04-30 Daniel Berger <djberg96@gmail.com>
-
- * lib/rubygems/commands/install_command.rb: Replaced deprecated
- Gem::SourceIndex method 'search' with 'find_name' when using
- the -t option. Fixes bug # 25632 by Daniel Berger.
-
-2009-04-30 James Tucker <jftucker@gmail.com>
-
- * lib/rubygems/ext/rake_builder.rb: Use explicit ruby command loading
- rubygems to invoke rake.
-
-2009-04-24 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/commands/specification_command.rb: Added requesting
- single fields from a spec.
-
-2009-04-23 James Tucker <jftucker@gmail.com>
-
- * lib/rubygems/ext/configure_builder.rb: Support Gem::Command.build_args.
-
-2009-04-15 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/rubygems_version.rb: 1.3.2.
-
-2009-04-14 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/specification.rb: Complain when summary and
- description are identical.
-
-2009-04-08 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/specification.rb: Strip directories, complain for
- non-files in #validate.
-
-2009-04-07 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/specification.rb: Implement #initialize_copy.
- * lib/rubygems/commands/contents_command.rb: Add --no-prefix and
- --all.
-
-2009-04-06 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/defaults.rb: Don't allow gem to overwrite ruby on
- install. Fixes bug #24958 by Michael Soulier.
- * doc/release_notes/rel_1_3_2.rdoc: Preliminary 1.3.2 release notes.
- * Rakefile: Trim off some stale code, switch to Manifest.txt, one
- step closer to Hoe!
-
-2009-04-06 Daniel Berger <djberg96@gmail.com>
-
- * test/test_gem_ext_configure_builder.rb: Better handling for MS
- Windows.
- * test/gemutilities.rb: Added the make_command and vc_windows? helper
- methods.
-
-2009-04-03 Eric Hodel <drbrain@segment7.net>
-
- * lib/: RDoc improvements.
-
-2009-04-02 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/commands/setup_command.rb: Fix --destdir. Patch
- #24970 by Richard Brown.
-
-2009-04-02 Phil Hagelberg <technomancy@gmail.com>
-
- * lib/rubygems/version.rb: Documentation of prerelease
- versions. See http://technomancy.us/123 for details.
-
-2009-03-31 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/spec_fetcher.rb: If the cached specs file won't load,
- refetch. Bug #24961 by Dylan Stamat.
- * lib/rubygems/defaults.rb: Add a sanity check to
- Gem.default_exec_format. Workaround for bug #24958 by Michael
- Soulier.
- * lib/rubygems/commands/setup_command.rb: Fix confusion with option
- names. Patch #24971 by Richard Brown.
- * lib/rubygems/specification.rb: Make #validate complain about
- not-files.
- * lib/gauntlet_rubygems.rb: For verification of the validator.
-
-2009-03-27 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems.rb: RubyGems now loads plugins from rubygems_plugin.rb
- in installed gems. This can be used to add commands (See
- Gem::CommandManager) or add install/uninstall hooks (See
- Gem::Installer and Gem::Uninstaller).
- * setup.rb: Ensure we're in a RubyGems dir when installing.
-
-2009-03-26 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/package_task.rb: Import from Rake's
- rake/gempackagetask.rb
- * Rakefile: Switched to RDoc::Task from RDoc 2.4.2.
- * lib/rubygems.rb: Gem.find_files now returns paths in $LOAD_PATH.
- * lib/rubygems/commands/sources_command.rb: Allow sources to be added
- behind proxies. Bug #24785 by Elia Schito.
-
-2009-03-25 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/commands/install_command.rb: Fix typo. Patch #24446
- by Luis Parravicini.
- * lib/rubygems/version.rb: Handle non-String versions by calling
- #to_s. Patch #24392 by Stephen Bannasch.
-
-2009-03-22 Daniel Berger <djberg96@gmail.com>
-
- * lib/rubygems/remote_fetcher.rb: Always escape URI's to deal with spaces
- and such, regardless of platform.
- * lib/rubygesm/validator.rb: Use the test-unit gem if installed.
- Part of the fix for RF #24261 by Daniel Berger
- * lib/rubygems/commands/install_command.rb: Explictly require
- rubygems/uninstaller.rb if the user wants to bail because of failed
- tests.
- Part of the fix for RF #24261 by Daniel Berger
-
-2009-03-17 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/commands/query_command.rb: Make `gem unpack` work with
- more than one gem name, fix warning about installation location.
-
-2009-03-16 James Tucker <jftucker@gmail.com>
-
- * lib/rubygems.rb: Deprecate ConfigMap[:RUBY_INSTALL_NAME]
- * lib/rubygems/defaults.rb: Gem.default_exec_format to use
- ConfigMap[:ruby_install_name].
- Fixes Bug #24457
- * util/gem_prelude.rb.template: Fix potential bug in
- Gem.default_exec_format when ConfigMap[:BASERUBY] is not 'ruby'.
-
-2009-03-14 Luis Lavena <luislavena@gmail.com>
-
- * lib/rubygems/installer.rb: Cleanup quotes on Windows stub scripts.
- Fixes Bug #24039.
- * lib/rubygems/commands/setup_command.rb: ditto.
-
-2008-03-13 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/commands/uninstall_command.rb: Add --user-install to
- allow uninstallation from ~/.gem. Bug #23760 by Roger Pack.
- * lib/rubygems/uninstaller.rb: Automatically uninstall from
- Gem.user_dir.
- * lib/rubygems/commands/update_command.rb: Rescue InstallError
- and continue. Bug #19268 by Gabriel Wilkins.
- * lib/rubygems/doc_manager.rb: Remove some options from the args list
- that RDoc no longer supports.
-
-2008-03-12 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/specification.rb: #description no longer removes
- newlines.
- * lib/rubygems/indexer.rb: Wrap description in a pre and force-wrap
- lines to 78 characters for prettier display.
- * lib/rubygems/commands/setup_command.rb: Clarify RubyGems RDoc
- installation location. Bug #22656 by Gian Marco Gherardi.
-
-2008-03-09 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/commands/query_command.rb: Add platforms to gem list
- -d.
- * lib/rubygems/commands/setup_command.rb: Allow setup to run from
- read-only location. Patch #21862 by Luis Herrera.
- * lib/rubygems/package/tar_input.rb: Use real File methods. Bug
- #23966 by Mike Furr.
- * lib/rubygems.rb: Don't add PATCHLEVEL if it's -1. Patch #24048 by
- Jeremy Kemper.
- * lib/rubygems/package/tar_input.rb: Choose security policy
- correctly. Bug #24001 by Mike Furr.
- * lib/rubygems/remote_fetcher.rb: Handle local paths with spaces.
- Bug #24169 by Ryan Davis.
- * lib/rubygems/specification.rb: Removed Gem::Specification::list,
- causes leaks. Bug #23668 by Steve Purcell.
-
-2008-03-07 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/installer.rb: Use Gem::bin_path in executable stubs to
- work around Kernel#load bug.
- * lib/rubygems/commands/install_command.rb: Copy user_install down to
- Gem::DependencyInstaller. Patch #23573 by Alf Mikula.
- * lib/rubygems/command.rb: Add info on gem server directly to `gem
- help`. Patch #22271 by Hugh Sasse.
-
-2008-03-06 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/specification.rb: Don't allow FIXME in specs.
- * lib/rubygems/commands/spec_command.rb: Add --ruby and --marshal
- formats.
- * lib/rubygems.rb: Add Gem::bin_path. Patch #24114 by James Tucker.
-
-2008-03-04 Eric Hodel <drbrain@segment7.net>
-
- * setup.rb: Moved guts to lib/rubygems/commands/setup_command.rb.
- * lib/rubygems/indexer.rb: Added RSS feed generation on full index
- update.
-
-2008-03-04 Phil Hagelberg <technomancy@gmail.com>
-
- * lib/*: Prerelease gems go into their own index now and are excluded
- from other indices. InstallCommand only gets prereleases if explicitly
- requested. Thanks to Alex Vollmer.
-
-2008-03-04 Eric Hodel <drbrain@segment7.net>
-
- * lib/*: Add lots of pretty pretty_print stuff!
-
-2008-02-25 Ryan Davis <ryand@zenspider.com>
-
- * lib/rubygems/commands/check_command.rb: Fix various usability
- issues.
-
-2009-02-10 Daniel Berger <djberg96@gmail.com>
- * lib/rubygems/specification: Refactored and fixed the installation_path
- method. It was overwrought and it now no longer uses File::SEPARATOR
- explicitly.
- [RubyForge: bug #23879 by Daniel Berger]
-
-2009-02-10 Daniel Berger <djberg96@gmail.com>
- * lib/rubygems/validator.rb: The Gem::Validator#verify_gem_file method
- now explicitly rescues Errno::EINVAL as well as Errno::ENOENT because
- MS Windows raises a different SystemCallError for empty paths.
-
-2009-01-21 Daniel Berger <djberg96@gmail.com>
- * lib/rubygems/remote_fetcher.rb: Split out nil and file handling in
- the download method. Modified file URI handling to work properly.
- [RubyForge: bug #16495 by Paul Sadauskas]
-
-2009-01-19 Daniel Berger <djberg96@gmail.com>
- * lib/rubygems/remote_fetcher.rb: Added uri scheme validation back
- into the open_uri_or_path method, though it now accepts 'https' and
- 'file' as well.
- * test/test_gem_remote_fetcher.rb: Updated the test_fetch_size_bad_uri
- to reflect the updated error message.
-
-2009-01-15 Daniel Berger <djberg96@gmail.com>
- * lib/rubygems/remote_fetcher.rb: Removed the open_file_uri_path method
- since the URI#path method already does the same thing, and changed
- the file_uri? method so that it explicitly calls .to_s.
- * lib/rubygems/local_remote_options.rb: Allow file urls.
-
-2009-01-15 Daniel Berger <djberg96@gmail.com>
- * lib/rubygems/commands/generate_index_command.rb: Fixed a typo in
- the description.
- * test/test_gem_doc_manager.rb: The test_uninstall_doc_unwritable
- test is now skipped on Windows.
- * test/test_gem_install_update_options.rb: The
- test_user_install_disabled_read_only test is now skipped on Windows.
- * test/test_gem_installer.rb: The test_generate_bin_symlink_no_perms
- and test_generate_bin_script_no_perms tests are now skipped on Windows.
-
-2009-01-14 Daniel Berger <djberg96@gmail.com>
- * lib/rubygems/specification.rb: Added support for a license attribute.
- [RubyForge: feature #11041 (partial) by Kevin Williams]
- * lib/rubygems/commands/query_command.rb: Gem detail information now
- includes license information.
- * test/test_gem_specification.rb: Added tests for the license attribute.
-
-2009-01-05 Chad Woolley <thewoolleyman@gmail.com>
-
- * move processing of build args out of gem binary so they are handled correctly via API usage.
- * lib/rubygems/command.rb: Add class accessor for build_args.
- * lib/rubygems/ext/rake_builder.rb: Use Gem::Command.build_args instead of ARGV.
- * lib/rubygems/ext/ext_conf_builder.rb: Use Gem::Command.build_args instead of ARGV.
- * lib/rubygems/gem_runner.rb: Move build arg processing from gem binary.
- * lib/rubygems/commands/contents_command.rb: Use nonzero return code (required to make tests pass).
- * bin/gem: Move build arg processing to gem_runner.rb.
- [RubyForge: bug #23210]
-
- * lib/rubygems/config_file.rb: Fix --config-file option with no
- equals and subsequent options to properly assign config file.
- Previously config file was overwritten by subsequent option.
- Fixes bug #16688.
-
-2009-1-4 Daniel Berger <djberg96@gmail.com>
- * lib/rubygems/installer.rb: Remove existing path if it already
- exists before installing.
- [RubyForge: patch #22837 by Eric Wong]
- * lib/rubygems.rb: Minor modification to the location_of_caller
- method - deal with possible characters after line number
-
-2009-1-3 Daniel Berger <djberg96@gmail.com>
- * lib/rubygems.rb: Better activation error message.
- [RubyForge: patch #23082 by Tim Carey-Smith]
-
-2009-1-2 Daniel Berger <djberg96@gmail.com>
- * lib/rubygems/ext/rake_builder.rb: Quote path if it contains spaces
- [RubyForge: patch #23003 by Charlie Savage]
- * lib/rubygems/local_remote_options.rb: Ignore duplicate sources
- [RubyForge: bug #22277 by Elliot Temple]
- * lib/rubygems/remote_fetcher.rb: Automatically normalize the URI
- [RubyForge: bug #22151 by Alex Legler]
- * lib/rubygems/specification.rb: Ensure that specification_version is
- a Fixnum [RubyForge: bug #22598 by Tsutomu Kuroda]
- * lib/rubygems/specification.rb: Bumped the CURRENT_SPECIFICATION_VERSION
- and added an entry to the SPECIFICATION_VERSION_HISTORY
-
-2009-1-1 Daniel Berger <djberg96@gmail.com>
-
- * test/test_gem_dependency.rb: Removed a duplicate "def dep" that
- was causing a warning.
- * lib/rubygems/platform.rb: Added an empty? method in order to
- better handle gem indexing when dealing with gems created
- prior to 0.9.5. [Rubyforge: bug #22603 by Johnathan Conley]
- * lib/rubygems.rb: Added an explicit 'require "etc"'.
- [RubyForge: bug #22313 by Matthew Boedicker]
-
-2008-12-31 Daniel Berger <djberg96@gmail.com>
-
- * lib/rubygems/local_remote_options: Allow 'https' as a valid scheme
- in addition to 'http' [RubyForge: patch #22485 by Duarte Henriques]
- * setup.rb: Deal with extraneous quotation mark when autogenerating
- .bat file on MS Windows [RubyForge: bug #22712 Takayuki Ishikawa]
- * lib/rubygems/commands/unpack_command.rb: Fixed the --target option
- [RubyForge: patch #22532 by Bryan Ash]
-
-2008-12-30 Daniel Berger <djberg96@gmail.com>
-
- * lib/rubygems/builder.rb: Don't allow .gem file to be added back
- onto itself [RubyForge: bug #19136, patch #23346 by Daniel Berger]
- * lib/rubygems/defaults.rb: The default_path now only returns the
- default_dir if the Gem.user_home doesn't exist
- [RubyForge: bug #23037 by Pierre PLR]
- * lib/rubygems.rb: Handle the possibility that Etc.getpwuid might
- return nil on platforms other than Windows
- [RubyForge: bug #22764 by Dudley Flanders]
-
-2008-12-16 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/doc_manager.rb: Set title for generated documentation.
- * lib/rubygems/dependency.rb: Make #=~ work with Gem::Specification.
-
-2008-12-15 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/installer.rb: Fix documentation for
- Gem::Installer#write_spec. Issue by okkez.
-
-2008-12-12 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/local_remote_options.rb: Merge documentation fix by
- okkez [ruby-dev:37271].
- * lib/rubygems/source_info_cache_entry.rb: Merge documentation fix
- from [ruby-dev:37255].
-
-2008-12-08 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems.rb: Add Gem::promote_load_path
-
-2008-12-01 Ryan Davis <ryand-ruby@zenspider.com>
-
- * lib/rubygems/remote_fetcher.rb: made threadsafe.
-
-2008-11-25 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/commands/install_command.rb: Don't do any post-install
- stuff if no gems were installed. Issue by Daniel Berger.
-
-2008-11-20 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/source_index.rb: Read the file outside the exception
- block so we raise a sane error.
- * lib/rubygems/indexer.rb: Allow the modern index to be updated
- incrementally. Allow the legacy and modern indicies to be updated
- separately.
-
-2008-11-17 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/indexer.rb: Added ability to only generate modern or
- legacy indicies.
-
-2008-11-14 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/timer.rb: Deprecate and move methods to Gem and
- Gem::StreamUI.
-
-2008-11-11 Phil Hagelberg <technomancy@gmail.com>
-
- * lib/rubygems/, test/: Make Version understand prerelease
- versions using letters. (eg. '1.2.1.b') Thanks to Josh Susser and
- Alex Vollmer.
-
-2008-11-03 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/specification.rb: Gem name must be a String.
-
-2008-10-31 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/defaults.rb: Update to support 1.9 libdir.
- * util/gem_prelude.rb: Move to .template, automatically fold in
- defaults.
-
-2008-10-29 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems.rb: Handle nonexistent home directory. Bug #22229 by
- Alexey Verkhovsky.
-
-2008-10-25 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems.rb, lib/rubygems/custom_require.rb: Make kernel
- methods private. Patch #20801 by James M. Lawrence. Expose
- our kernel extensions to RDoc. Make Gem::location_of_caller behave on
- Windows. Patch by Daniel Berger.
- * doc/release_notes/rel_1_3_1.rdoc: Final release notes for 1.3.1.
- * lib/rubygems/rubygems_version.rb: 1.3.1.
-
-2008-10-10 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/commands/unpack_command.rb: Silence PATH warning.
-
-2008-10-09 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems.rb: Fix requires for inflate, deflate, etc.
- * test/*: Convert to minitest/unit.
- * lib/rubygems/validator.rb: Fix for MiniTest instead of test/unit
- classic in 1.9.
-
-2008-10-03 Phil Hagelberg <technomancy@gmail.com>
-
- * lib/rubygems.rb: Make Gem.dir respect :gemhome value from config.
- * lib/rubygems/config_file.rb: Expose :gemhome value.
-
-2008-09-26 Luis Lavena <luislavena@gmail.com>
-
- * lib/rubygems.rb: Disregard ownership of ~ under Windows while
- creating ~/.gem. Fixes issues related to no uid support under
- Windows.
-
-2008-09-24 Eric Hodel <drbrain@segment7.net>
-
- * doc/release_notes/rel_1_3_0.rdoc: Final release notes for 1.3.0.
- * lib/rubygems/rubygems_version.rb: 1.3.0.
- * lib/rubygems/builder.rb: Examine process status correctly. Patch
- by Nobu.
- * test/test_gem_ext_rake_builder.rb: Override Gem.ruby and
- ENV['rake'] for 1.9 integration. Patch by Nobu.
-
-2008-09-16 Phil Hagelberg <technomancy@gmail.com>
-
- * lib/rubygems.rb: Use the path set in the config file if
- applicable.
- * lib/rubygems/config_file.rb: Expose the path.
-
-2008-09-16 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems.rb: Only create ~/.gem by user owning ~. Bug #21561
- by Neil Wilson.
-
-2008-09-15 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/source_index.rb: Autoload SpecFetcher to improve load
- time. Patch #21577 by Simon Chiang.
- * lib/rubygems/commands/lock_command.rb: Modernize. Fix --strict.
- Patch #21814 by Sven Engelhardt.
- * lib/rubygems/platform.rb: Fix for solaris platform. Patch #21911
- by Bob Remeika.
-
-2008-09-10 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/commands/install_command.rb: Describe _version_ in `gem
- help install`.
- * lib/rubygems/commands/environment_command.rb: Describe environment
- variables and gemrc in `gem help env`.
- * lib/rubygems.rb: Warn when executing Gem::manage_gems.
- * lib/rubygems/doc_manager.rb: Have RubyGems update the ri cache.
- * lib/rubygems/source_index.rb: Ensure specs are read as UTF-8.
- * lib/rubygems/specification.rb: Add magic comment to .gemspec files
- so they are read in as UTF-8.
-
-2008-08-22 Luis Lavena <luislavena@gmail.com>
-
- * lib/rubygems.rb: Corrected usage of HOMEDRIVE and HOMEPATH on Windows.
- Escape Gem.ruby if spaces in the path are present. Solves bug related to
- extensions compile process.
- * test/test_gem.rb: Added test to verify both conditions.
-
-2008-08-17 Eric Hodel <drbrain@segment7.net>
-
- * doc/release_notes/rel_1_3_0.rdoc: Initial release notes for 1.3.0.
- * util/CL2notes: Release note creation helper script.
-
-2008-08-16 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/local_remote_options.rb: Added #both? to complement
- #local? and #remote?.
- * lib/rubygems/commands/query_command.rb: Print out LOCAL/REMOTE with
- --both, even without a TTY.
- * lib/rubygems.rb: Add Gem.find_files, allows a gem to discover
- features provided by other gems.
-
-2008-08-14 Wilson Bilkovich <wilson@supremetyrant.com>
-
- * lib/rubygems/source_index.rb: Deprecate options to 'search' other than
- Gem::Dependency instances and issue warning until November 2008.
- * lib/rubygems/platform.rb: Remove deprecated constant warnings
- and really deprecate them.
- * Rakefile: If the SETUP_OPTIONS environment variable is set, pass its
- contents as arguments to setup.rb
- * test/test_gem_commands_uninstall_command.rb: Added
-
-2008-08-13 Wilson Bilkovich <wilson@supremetyrant.com>
-
- * lib/rubygems/uninstaller.rb: Fix binary script uninstallation.
- Bug #21234 by Neil Wilson.
- * test/test_gem_commands_uninstall_command.rb: Added
-
-2008-08-12 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/installer.rb: Try to create directory before diverting
- to ~/.gems.
- * lib/rubygems/uninstaller.rb: Fix uninstallation with -i. Bug
- #20812 by John Clayton. Have #remove_all call #uninstall_gem so hooks
- get called. Bug #21242 by Neil Wilson.
- * lib/rubygems/commands/update_command.rb: Fix updating RubyGems when
- no previous rubygems-update is installed. Bug #20775 by Hemant Kumar.
-
-2008-08-11 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/remote_fetcher.rb: Fix HTTPS support. Patch #21072 by
- Alex Arnell. Fix Not Modified handling. Bug #21310 by Gordon
- Thiesfeld.
-
-2008-07-11 Luis Lavena <luislavena@gmail.com>
-
- * setup.rb: Properly build --destdir folder structure using Pathname.
- * test/mockgemui.rb: Fix warnings about instance variables in a module.
-
-2008-07-02 Phil Hagelberg <technomancy@gmail.com>
-
- * lib/rubygems/defaults.rb: Add Gem.user_dir to use paths like
- ~/.gem/ruby/1.8/gems and the like instead of just ~/.gem. Update
- remote fetcher and installer to use it.
-
-2008-07-01 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/installer.rb: Add #gem_home, #bin_dir for hooks. Use
- DependencyInstaller's source_index so reinstallation via -i does not
- fail.
- * lib/rubygems/uninstaller.rb: Add #gem_home, #bin_dir for hooks.
- * lib/rubygems/commands/query_command.rb: Don't print LOCAL/REMOTE
- gems if stdout is not a TTY.
- * lib/rubygems/commands/query_command.rb: Use the regexp we already
- have for `gem list --installed`. Bug #20876 by Nick Hoffman.
- * lib/rubygems/commands/which_command.rb: Clarify what `gem which` is
- for.
-
-2008-06-30 Eric Hodel <drbrain@segment7.net>
-
- * test/test_ext_configure_builder.rb: Locale-free patch by Yusuke
- Endoh [ruby-core:17444].
- * lib/rubygems.rb: Add pre/post (un)install hooks.
- * lib/rubygems/installer.rb: Call pre/post install hooks as
- appropriate.
- * lib/rubygems/uninstaller.rb: Call pre/post uninstall hooks as
- appropriate. Minor refactoring of #uninstall.
- * lib/rubygems/package/tar_reader.rb: Some OSs raise EINVAL on seek.
- Based on patch in bug #20791 by Neil Wilson.
- * lib/rubygems/specification.rb: Correctly check for support of
- development dependencies for #to_ruby. Bug #20778 by Evan Weaver.
- * lib/rubygems/spec_fetcher.rb: Correctly load all cache file even if
- latest has been loaded. Bug #20776 by Uwe Kubosch.
-
-2008-06-25 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/config_file.rb: Add Gem::ConfigFile constants for
- packagers and implementors to override defaults.
- * test/*: Fixes to run tests when under test/rubygems/. Patch by
- Yusuke ENDOH [ruby-core:17353].
-
-2008-06-24 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/remote_fetcher.rb: Cleanup to support
- if-modified-since requests. pair: Ryan Davis
- * lib/rubygems/indexer: Force platform to Gem::Platform::RUBY when
- nil or blank. Fixes various uninstallable gems.
-
-2008-06-24 Phil Hagelberg <technomancy@gmail.com>
-
- * lib/rubygems/installer.rb: Fall back on ~/.gem if GEM_HOME is
- not writable.
- * lib/rubygems/install_update_options.rb: Allow --user-install or
- --no-user-install command-line switch to explicitly force whether
- or not ~/.gem should be used.
- * lib/rubygems/remote_fetcher.rb: Use ~/.gem/cache if cache dir is
- not writable.
- * test/gemutilities.rb: Use MockGemUi for all tests.
-
-2008-06-21 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/specification.rb: Load specifications from the future.
- Roll back specification version change.
- * lib/rubygems/remote_fetcher.rb: Reset connection when an HTTP
- server misbehaves.
- * setup.rb: Fix --destdir for windows.
- * doc/release_notes/rel_1_2_0.rdoc: Bugs in RubyGems were
- unintentionally added, order bug fixes by importance.
- * lib/rubygems/rubygems_version.rb: 1.2.0.
-
-2008-06-20 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/uninstaller.rb: Improve output when a gem to uninstall
- isn't found. Bug #20746 reported by Chad Wooley.
- * setup.rb: Fix rdoc installation with --destdir. Patch #20739 by
- Matthew Kent.
- * lib/rubygems/commands/install_command.rb: Don't reset GEM_PATH when
- installing. Fixes Bug #20746 by Chad Wooley.
-
-2008-06-20 Luis Lavena <luislavena@gmail.com>
-
- * setup.rb: Only prepend install_destdir when especified. Fixes
- installation issues related to Windows paths (/C:/...)
-
-2008-06-19 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/dependency_installer.rb: Ensure that the entire
- dependency chain is installed. Fixes bug reported by Chad Woolley.
-
-2008-06-18 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/commands/dependency_command.rb: Restore matching
- everything when no name is specified, regexp matching. Fixes bug
- #20716, bug #20717 by Chad Woolley.
-
-2008-06-18 Chad Woolley <thewoolleyman@gmail.com>
-
- * lib/rubygems/config_file.rb: Fix --config-file option with no
- equals and subsequent options to properly assign config file.
- Previously config file was overwritten by subsequent option.
- Fixes bug #16688.
-
-2008-06-17 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/version.rb: Gem::Version #hash and #eql? now operate
- on the version string, terms of the version string, so "1" and "1.0"
- no longer correspond to the same slot. Fixes indexer bug reported by
- Chad Woolley.
- * setup.rb: Fix --format-executable. Patch #20698 by Richard Brown.
- * util/gem_prelude.rb: Prevent infinite recursion, check for Gem now.
- Patch from ruby trunk by nobu.
- * lib/*: Spelling cleanup. Patch from trunk by Evan Farrar.
- * test/*: Fixes for win32 test failures reported by Luis Lavena.
- * util/gem_prelude.rb: Only remove methods added by gem_prelude.rb.
-
-2008-06-16 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/indexer.rb: Fix quick_index generation.
- * lib/rubygems/specification.rb: Correctly guard new spec features
- for older RubyGems.
- * lib/rubygems/config_file.rb: Add system-wide config file
- (/etc/gemrc). Patch #14723 by Phil Hagelberg. Add windows code to
- use appropriate directory. Code by Daniel Berger.
- * doc/release_notes/rel_1_2_0.rdoc: Draft of 1.2.0 release notes.
-
-2008-06-15 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/server.rb: Store off if we are returning Marshal
- format before running =~ again. Fixes bug reported by Chad Woolley.
- * lib/rubygems/commands/stale_command.rb: `gem stale` lists gems by
- last access time. Patch #20593 by Aaron Patterson.
- * lib/rubygems/setup.rb: Add --vendor and --destdir to setup.rb for
- packagers. Patch #20610 by Richard Brown. Don't look for stub
- files to remove any more.
- * lib/rubygems/specification.rb: Bump specification version and be
- backwards compatible with type 2 specs.
- * lib/rubygems/commands/query_command.rb: Add installed location to
- details for installed gems.
-
-2008-06-09 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/dependency_installer.rb: Only install all dependencies
- when install_dir option is set. Don't include satisfied dependencies
- when gathering dependencies.
- * lib/rubygems/commands/query_command.rb: Display authors, rubyforge
- and homepage urls with details.
- * lib/rubygems/commands/environment_command.rb: Add executable
- directory (from Rubinius).
- * lib/rubygems/commands/install_command.rb: Don't set install_dir by
- default.
- * lib/rubygems/commands/update_command.rb: Don't set install_dir by
- default. Use #find_missing for efficiency.
-
-2008-06-07 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/server.rb: Fully mirror Gem::Indexer indexes, set
- correct content-type headers, always refresh the source index.
- * lib/rubygems/source_index.rb: Add spec_dirs so that #refresh! will
- always reload from the same locations. #refresh! on manually-built
- SourceIndex now raises. Fixes #20509 by Chad Woolley.
-
-2008-06-06 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/installer.rb: Remove previous bin_script_path in case
- it is a symlink.
- * lib/rubygems/commands/pristine_command.rb: Force reinstallation of
- the gem using the installer. Fixes bug #20387 by Erik Persson.
- * lib/rubygems/doc_manager.rb: Ensure args to RDoc are all strings.
- * lib/rubygems/source_index.rb: Use find_matching to discover updated
- specs instead of fetch.
- * lib/rubygems/commands/query_command.rb: Platform, not name in spec
- tuples.
-
-2008-06-05 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/local_remote_options.rb: Ensure remote repository URLs
- reference directories. Fixes bug #20134 by Neil Wilson.
- * lib/rubygems/source_index.rb: Gracefully handle ^C or explicit exit
- while loading .gemspec files from disk. Fixes bug #20523 by Joel
- VanderWerf.
- * lib/rubygems/specification.rb: Use File#expand_path in
- installation_path. Fixes bug #19317 by Hemant Kumar.
- * lib/rubygems/spec_fetcher.rb: Fix legacy test against URI.
- * lib/rubygems/remote_fetcher.rb: Always raise FetchError from
- RemoteFetcher. Fix FetchErrors without URIs. Refactor Net::HTTP
- request code to use persistent connections for HEAD requests. Feature
- Request #7973 by Christian Schachtzabel.
- * lib/rubygems.rb: Don't load custom_require until after the OS and
- implementation have had a chance to set paths.
-
-2008-06-04 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/commands/source_index.rb: Only fetch specs we need in
- #outdated.
- * lib/rubygems.rb: Fix typo in ::activate exception.
- * lib/rubygems/dependency.rb: For #to_s, display dependency type when
- nil.
- * lib/rubygems/dependency_installer.rb: Reset #installed_gems for
- every #install. Fixes bug #19444 by Glenn Rempe.
- * lib/rubygems/installer.rb: Don't re-read the disk to check for new
- gems, add them by hand on install.
-
-2008-06-03 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems.rb: Add ::gzip, ::gunzip, ::deflate and ::inflate.
- * lib/rubygems/server.rb: Add specs and latest_specs indicies.
- * setup.rb: Don't require rdoc until needed. Patch #20414 by Brian
- Candler.
- * lib/uninstaller.rb: Correctly uninstall gems installed with a
- legacy platform. Patch #19877 by Luis Lavena.
- * lib/rubygems/commands/update_command.rb: Only fetch remote specs
- when we know what we're looking for.
-
-2008-06-02 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/specification.rb: Remove double slash in
- #installation_path. Fixes bug #19896 by Heiko Seebach.
- * lib/rubygems/remote_fetcher.rb: Require StringIO. Fixes bug #19866
- by Caleb Land.
- * lib/rubygems.rb: Require rubygems/defaults/#{RBX_ENGINE}.rb and
- rubygem/defaults/operating_system.rb if they exist. (OS require comes
- first and may be overridden by operating system.)
-
-2008-06-01 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/indexer.rb: Ensure identical names, versions and
- platforms are identical for a smaller index.
- * lib/rubygems/spec_fetcher.rb: Only write to cache when we own it.
- * lib/rubygems.rb: Honor default_path if GEM_PATH environment
- variable is not set. Patch #19502 by Donavan Pantke.
- * lib/rubygems/installer.rb: Set file mode indicated by tar file.
- Patch #19737 by Jason Roelofs.
-
-2008-06-01 John Barnette <jbarnette@rubyforge.org>
-
- * lib/rubygems.rb: Add Gem.available?(gem, *specs) for easy availability
- checks at runtime.
-
-2008-05-31 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/commands/dependency_command.rb: Delay fetching specs
- until needed. Reverse dependencies can no longer be calculated for
- remote sources. Add backwards compatibility.
- * lib/rubygems/commands/fetch_command.rb: Add backwards
- compatibility.
-
-2008-05-30 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/local_remote_options.rb: --sources option should not
- add URIs to Gem.sources.
- * lib/rubygems/spec_fetcher.rb: Add #warn_legacy to help handling
- legacy sources.
- * luby/rubygems/commands/query_command.rb: Add backwards
- compatibility with legacy sources.
-
-2008-05-28 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/remote_fetcher.rb: Add #uri to
- Gem::RemoteFetcher::FetchError.
- * lib/rubygems/user_interaction.rb: Improve RDoc slightly.
- * lib/rubygems/spec_fetcher.rb: Introduce backwards compatibility for
- legacy (pre 1.2) repositories
- * lib/rubygems/commands/sources_command.rb: Backwards compatibility
- and restoration of --update.
- * lib/rubygems/specification.rb: Ensure nil-typed dependencies become
- runtime dependencies.
-
-2008-05-27 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/spec_fetcher.rb: Switch #fetch, #find_matching to be
- compatible with Gem::SourceInfoCache#search_with_source. Add caching
- for .gemspec files.
- * lib/rubygems/dependency_installer.rb: Switch to SpecFetcher.
- * lib/rubygems/source_index.rb: Switch #outdated to use SpecFetcher.
- * lib/rubygems/commands/dependency_command.rb: Switch to SpecFetcher.
- * lib/rubygems/commands/outdated_command.rb: Switch to SpecFetcher.
- * lib/rubygems/commands/query_command.rb: Switch to SpecFetcher.
- * lib/rubygems/commands/sources_command.rb: Switch to SpecFetcher.
- * lib/rubygems/commands/update_command.rb: Switch to SpecFetcher.
- * lib/rubygems/version.rb: Handle comparisons with non-Gem::Version
- objects.
-
-2008-05-13 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/spec_fetcher.rb: Add caching of specs, latest_specs
- files.
- * test/gemutilities.rb: Ensure Gem.user_home doesn't point to ~.
-
-2008-05-09 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/indexer.rb: Add Marshal format index of spec names,
- versions and platforms. WIP.
- * lib/rubygems/spec_fetcher.rb: WIP for replacement of
- Gem::SourceInfoCache and SourceInfoCacheEntry.
- * lib/rubygems/dependency.rb: Add #=~.
-
-2008-05-07 John Barnette <jbarnette@gmail.com>
-
- * lib/rubygems/specification.rb, et. al: Let gems have development
- dependencies, which aren't installed (except when --development is
- supplied) or activated.
-
-2008-05-02 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/indexer.rb: Refactored into simpler more imperative
- code.
- * lib/rubygems.rb: Leave rbconfig/datadir.rb for non-RubyGems use.
-
-2008-04-16 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/server.rb: Refresh the source index per request so new
- gems will be found after server startup.
-
-2008-04-15 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/source_index.rb: Only print out "Bulk updating" when
- verbose, fix #latest_specs documentation.
- * lib/rubygems/dependency_installer.rb: Add :cache_dir option for
- Tinderbox.
-
-2008-04-14 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/test_utilities.rb: Expose some internal testing
- utilities that are of general use.
-
-2008-04-10 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems.rb: Fix Gem.prefix so it reports nil when rubygems.rb
- is in sitelibdir, libdir, or doesn't have 'lib' as a parent directory.
- * doc/release_notes/rel_1_1_1.rdoc: RubyGems 1.1.1 release notes.
- * lib/rubygems/rubygems_version.rb: 1.1.1.
-
-2008-04-07 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/server.rb: Fix fragment URIs. Patch by James Tucker.
- * lib/rubygems/commands/update_command.rb: Pass
- --no-format-executable to setup.rb. Patch by Stephen Bannasch.
-
-2008-04-06 Chad Woolley <thewoolleyman@gmail.com>
-
- * lib/rubygems.rb: Add setter Gems.platforms=, to allow platforms
- to be set/reset when invoking or testing RubyGems programatically.
- Also force Gems.platforms to automatically reset to default of
- [Gem::Platform::RUBY, Gem::Platform.local] if cleared.
- * lib/rubygems/version_option.rb: Change add_platform_option
- to initialize Gem.platforms to contain only Gem::Platform::RUBY
-
-2008-04-04 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/source_index.rb: Make Gem::SourceIndex#refresh!
- more-correct. Reported by Paul Haddad.
- * lib/rubygems.rb: Add Gem::refresh. Bug #19176 by Hongli Lai.
- * lib/rubygems/dependency_installer.rb: Put downloaded gems into
- install_dir's cache. Patch #19182 by Richard Brown.
-
-2008-04-03 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/source_info_cache.rb: Merge full cache file into
- latest data. Don't write cache files when checking for them. Only
- update full cache file when we've read it. Refresh all data when
- loading all data.
- * lib/rubygems/dependency_installer.rb: Fix --force to work without
- network for dependent gems. Fix all-fetching test.
- * lib/rubygems/commands/query_command.rb: Obey --all flag for gem
- query.
- * lib/rubygems/commands/environment_command.rb: Don't display
- RubyGemsPackageVersion.
- * lib/rubygems/indexer.rb: Fix typo. Patch by Tom Copeland.
- * lib/rubygems/command_manager.rb: Display RubyGemsVersion with
- --version.
- * lib/rubygems/commands/pristine_command.rb: Rebuild extensions along
- with everything else. Patch #19281 by Dr. Nic Williams.
-
-2008-04-01 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems.rb: Fix prefix to point to directory above RubyGems,
- so RubyGems will be installed into lib/.
- * setup.rb: Work around apple's libdir-installed RubyGems, by
- installing into sitelibdir.
- * Rakefile: Add svnversion to RubyGems version number for `rake
- install`.
-
-2008-03-31 Luis Lavena <luislavena@gmail.com>
-
- * test/: Allow tests to use a random (but controlled) port number
- instead of a hardcoded one. This helps CI tools when running
- parallels builds.
-
-2008-03-30 Luis Lavena <luislavena@gmail.com>
-
- * test/test_gem.rb: Leave APPLE_GEM_HOME tests only to *nixes.
- * lib/rubygems/remote_fetcher.rb: Errno::ECONNABORTED raised on Windows
- on closed Keep-Alive connections.
-
-2008-03-29 Eric Hodel <drbrain@segment7.net>
-
- * gemspecs/: Removed.
- * examples/: Removed.
- * doc/design/: Removed.
- * doc/rdoc_templates/: Removed.
- * Rakefile: Package doc/release_notes/.
- * setup.rb: Use full path to release_notes, ensure RDoc can be
- both removed and installed.
-
-2008-03-28 Eric Hodel <drbrain@segment7.net>
-
- * bin/gem, Rakefile: RubyGems now requires Ruby > 1.8.3.
- * lib/rubygems.rb: Added Gem.ruby_version, Gem.read_binary,
- Gem.binary_mode.
- * lib/, test/: Read files in binary mode for windows and ruby 1.9.
- * lib/rubygems/commands/update_command.rb: Only update once.
- * lib/rubygems/commands/sources_command.rb: Ditto.
- * lib/rubygems/source_index.rb: Fix #remove_extra, #find_missing so
- legacy platform gems don't get updated repeatedly.
- * doc/release_notes/rel_1_1_0.rdoc: RubyGems 1.1.0 release notes.
- * lib/rubygems/rubygems_version.rb: 1.1.0.
-
-2008-03-28 Ryan Woodrum <rwoodrum@avvo.com>
-
- * lib/rubygems/commands/query_command.rb: Add --installed
- subcommand to check if a gem and/or version is installed.
- * test/test_gem_commands_query_command.rb: Add relevant tests.
- * test/gemutilities.rb: Override exit() for query tests.
- * test/mockgemui.rb: Add =() to manipulate output values (clear).
-
-2008-03-28 Chad Woolley <thewoolleyman@gmail.com>
-
- * lib/rubygems/source_info_cache.rb: Add reset_cache_file.
-
-2008-03-27 Chad Woolley <thewoolleyman@gmail.com>
-
- * lib/rubygems/user_interaction.rb: Raise Gem::SystemExitException
- instead of exiting, kill unused terminate_interaction!.
- * lib/rubygems/exceptions.rb: Add Gem::SystemExitException.
- * lib/rubygems/commands/install_command.rb: Raise
- Gem::SystemExitException instead of exiting.
- * bin/gem: Rescue Gem::SystemExitException and exit with
- specified exit_code.
- * test/test_gem_commands_install_command.rb: Assert on
- Gem::SystemExitException and exit_code in tests.
-
-2008-03-27 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/commands/sources_command.rb: Allow sources to be
- removed without network. Fixes bug #18644 by Mikel Lindsaar.
-
-2008-03-27 Luis Lavena <luislavena@gmail.com>
-
- * lib/rubygems/commands/environment_command.rb: Use platform specific
- PATH_SEPARATOR instead of hardcoded ':'
- * test/test_gem_commands_unpack_command.rb: Ditto.
- * test/test_gem_commands_environment_command.rb: Ditto.
- * test/gemutilities.rb: Fix binary file reads being truncated on
- Windows.
- * test/test_gem_commands_install_command.rb: Switch to read_binary.
- * test/test_gem_commands_update_command.rb: Ditto.
- * test/test_gem_commands_server_command.rb: Consider full path when
- evaluating location (instead of hardcoded or missing drive leter).
- * test/test_gem_installer.rb: Ditto.
- * test/test_gem_dependency_installer.rb: exclude no-wrapper tests for
- Windows.
-
-2008-03-26 Luis Lavena <luislavena@gmail.com>
-
- * lib/rubygems.rb: Handle backslashes that came from GEM_HOME and
- GEM_PATH on Windows.
-
-2008-03-25 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/source_index.rb: Add updating from latest index,
- default to updating from latest index. Reduces common-case update
- to under 3,000 gems at present.
- * lib/rubygems/remote_fetcher: Fix error reporting from net/http.
- * lib/rubygems.rb: Sort methods, remove last vestiges of autorequire,
- RDoc cleanup.
-
-2008-03-23 Luis Lavena <luislavena@gmail.com>
-
- * setup.rb: generated Windows stubs will honors prefix using Gem.ruby
- instead of hardcoded 'ruby.exe'
- * lib/rubygems/installer.rb: generated Windows stubs scripts will now
- work from differnt directories than Gem::bindir. Fixes bug #16259 by
- Claus Folke Brobak
-
-2008-03-20 Eric Hodel <drbrain@segment7.net>
-
- * test/test_gem_source_info_cache.rb: Test with real objects now.
- * lib/rubygems/source_index.rb: #latest_specs now has latest specs
- for all platforms.
- * lib/rubygems/source_info_cache.rb: Add latest cache data, only load
- full cache data when needed.
-
-2008-03-20 Luis Lavena <luislavena@gmail.com>
-
- * test/gemutilities.rb: Change all the file processing mechanism to
- enable binary mode by default (required for Windows file operations
- dealing with non-printable characters).
-
-2008-03-19 Luis Lavena <luislavena@gmail.com>
-
- * lib/rubygems/package/tar_output.rb: Adapted code to use #wrap instead
- of #new when dealing with Zlib::GzipWriter (fixes SEGV and warnings due
- GzipWriter object not being closed explicitly).
-
-2008-03-12 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/indexer.rb: Add latest_index.
-
-2008-03-09 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/defaults.rb: Add special case for RUBY_ENGINE constant
- when setting default gem dir.
- * Rakefile: Add update_rubinius and diff_rubinius.
-
-2008-03-08 Lincoln Stoll <lstoll@lstoll.net>
-
- * lib/rubygems/server.rb: Drop use of RDoc's TemplatePage in favor of
- ERB.
-
-2008-03-04 Ryan Davis <ryan@wrath.local>
-
- * lib/rubygems/remote_fetcher.rb: Moved #download from
- DependencyInstaller.
- * lib/rubygems/commands/fetch_command.rb: Updated to use #download.
- * lib/rubygems/dependency_installer.rb: install now takes name or dep.
- Renamed gather_specs_to_download to find_spec_by_name_and_version.
- Modifed #initialize to not take gem name or version.
-
-2008-03-04 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/package*: Removed #open_from_io and friends, switched
- to #open, no special handling for file names.
- * lib/rubygems/package/tar_output.rb: Refactored ::open to use
- instance methods.
- * lib/rubygems/remote_fetcher.rb: Print out number of requests made
- before connection reset.
-
-2008-02-29 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/package/tar_reader/entry.rb: Removed is_directory and
- is_file? in favor of file? and directory?.
-
-2008-02-28 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/package.rb: Broke up Tar bits into separate files.
- * lib/rubygems/package/tar_reader/entry.rb: Don't copy TarHeader data
- into Entry, go through #header instead. Better tests for
- TarReader::Entry.
-
-2008-02-27 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/dependency_installer.rb: Automatically fall back to
- local-only install on network error. Fixes bug #15759 by Chauk-Mean P.
- * lib/rubygems/source_index.rb: Process spec dirs so that earlier
- dirs override later dirs. Fixes bug #14816 by Kurt Stephens.
-
-2008-02-26 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/commands/update_command.rb: Only update gems that need
- updates. Fixes bug #14780 by Mathieu Lajugie. Don't force
- remote-only updates. Properly handle dependencies when updating.
- Fixes bug #17488 by Hongli Lai.
- * lib/rubygems/commands/environment_command.rb: Display path as a
- usable path.
- * lib/rubygems.rb: Don't add APPLE_GEM_HOME with ENV['GEM_HOME'].
-
-2008-02-25 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems.rb: Expand sitelibdir when checking prefix. Fixes bug
- #17983 by Hemant Kumar.
- * setup.rb: Print release notes on installation. Tell people where
- `gem` was installed.
- * bin/update_rubygems: Added --help output to explain how to install
- earlier versions of RubyGems. Added --version option workaround.
- Fixes bug #16842 by Chad Woolley.
- * lib/rubygems/install_command.rb: Give proper exit code on failure.
- Fixes bug #17438 by Josh Nichols.
-
-2008-02-23 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/remote_fetcher.rb: Change hosts correctly when
- redirecting. Handle EOFError from Net::HTTP.
- * lib/rubygems/commands/specification_command.rb: Pull specifications
- from gem files.
- * lib/rubygems/uninstaller.rb: When :executable is set, don't ask the
- user. Fixes bug #16812 by Matt Mower. Raise exception instead of
- printing message when gem is not in GEM_HOME.
- * lib/rubygems/uninstall_command.rb: Print message when gem is not in
- GEM_HOME.
- * lib/rubygems/commands/cleanup_command.rb: Clean up all old gems.
- * lib/rubygems/commands/unpack_command.rb: Scan every gem path when
- unpacking. Fixes bug #17602 by Ryan Davis.
-
-2008-02-20 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/install_update_options.rb: Add --bindir option to
- specify destination to install executables into. Patch #17937 by
- Donavan Pantke.
- * lib/rubygems/specification.rb: Fix Time.today == Time.today. Bug
- #17413 by Andrei Bocan.
- * setup.rb: Properly check for deletablitily of user and system
- caches. Bug #17869 by Alexey Verkhovsky. Fix --no-format-executable.
- Fixes bug #16879 by Charles Nutter.
-
-2008-02-19 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/remote_fetcher.rb: Add persistent connection support.
- Patch #18180 by Aaron Patterson.
- * lib/rubygems/installer.rb: Fix #shebang to use the ruby install
- name. Patch #16878 by Donavan Pantke.
- * lib/rubygems/defaults.rb, lib/rubygems.rb: Enable defaults for
- Gem.path and Gem.bindir. Patch #17886 by Donavan Pantke.
- * test/test_gem_ext_configure_builder.rb: Make test_self_build_fail
- more platform independent. Patch #17599 by Martin Krauskopf.
-
-2008-02-14 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/commands/fetch_command.rb: Fix a bug when fetching
- from non-default sources. Report non-existent gems instead of
- crashing.
-
-2008-01-09 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/commands/update_command.rb: Use portable and safe ENV
- operation. Patch by usa in ruby SVN revision 14739.
- * lib/rubygems/open-uri.rb: Fix tests. Patch by NARUSE Yui.
- [ruby-dev:33336]
-
-2007-12-23 Eric Hodel <drbrain@segment7.net>
-
- * util/gem_prelude.rb: Remove methods from Gem, not QuickLoader, to
- fix warnings.
-
-2007-12-22 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/commands/environment_command.rb: Put GEM PATHS in the
- correct order.
- * lib/rubygems/commands/uninstall_command.rb: Add --install-dir to
- specify which local repository to uninstall from. Patch #15151 by
- Donavan Pantke.
- * lib/rubygems/uninstaller.rb: Only allow uninstallation of gems from
- specified directory. Properly clean up executables on uninstall.
- Patch #15151 by Donavan Pantke.
- * lib/rubygems/install_update_options.rb: Add --no-env-shebang
- option. Patch #16508 by Donavan Pantke.
- * util/gem_prelude.rb: Use require to load rubygems.rb to make
- $LOADED_FEATURES correct on RubyGems update.
-
-2007-12-21 Eric Hodel <drbrain@segment7.net>
-
- * util/gem_prelude.rb: Place bin before lib so bin stubs work.
-
-2007-12-20 Eric Hodel <drbrain@segment7.net>
-
- * Rakefile: Require Ruby > 1.8.2. Enable CERT_DIR.
- * lib/rubygems.rb: Work with RbConfig and Config. Bug #16457 by
- Christian Ramilo, John Barnette.
- * lib/rubygems/commands/build_command.rb: Relax yaml? test to work
- with Ruby 1.8.3.
- * lib/rubygems/rubygems_version.rb: 1.0.1.
- * doc/release_notes/rel_1_0_1.rdoc: RubyGems 1.0.1 release notes.
-
-2007-12-19 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/installer.rb: Revert change that only wrapped
- executables with #!.
- * lib/rubygems/specification.rb: Warn about a lot of things that
- could be wrong with gemspecs on build, including missing #!. Use
- 'x86-mswin32' for legacy 'mswin32' platform, fix CURRENT platform.
- Paired with Luis Lavena.
- * lib/rubygems/remote_installer.rb: Deleted.
- * lib/rubygems.rb: Removed Kernel#require_gem.
- * doc/release_notes/rel_1_0_0.rdoc: RubyGems 1.0 release notes.
- * lib/rubygems/rubygems_version.rb: 1.0.0.
-
-2007-12-18 Luis Lavena <luislavena@gmail.com>
-
- * lib/rubygems/commands/mirror_command.rb: Work around URI::parse
- processing file:// scheme and drive paths on Windows.
- * test/test_gem_commands_mirror_command.rb: ditto.
-
-2007-12-17 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/installer.rb: Copy files into bindir if they don't
- have a shebang. Bug reported by Luis Lavena.
- * lib/rubygems/server.rb: Handle platforms in Gem::Server#quick.
- Exactly match gem names. Bugs reported by Chad Woolley.
- * lib/rubygems/platform.rb: Remove platform constants in favor of
- Gem::Platform::CURRENT. Bug reported by Luis Lavena.
- * lib/rubygems/dependency_installer.rb: Work around Dir::glob not
- understanding File::ALT_SEPARATOR. Bug submitted by Luis Lavena.
-
-2007-12-16 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/remote_fetcher.rb: Be more verbose in error messages
- from OpenURI.
- * lib/rubygems/server.rb: Be more verbose in error/missing responses.
-
-2007-12-15 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/installer.rb: Output extension build results when
- really verbose. From bug #15853 John Croisant.
- * lib/rubygems/specification.rb: Fix backwards compatibility with
- 0.9.4, don't allow the platform to be nil or an empty string. Bug
- #16177 by Dan Manges.
- * setup.rb: Re-exec setup.rb if rubygems is loaded and RUBYOPT is
- set. Fixes bug #15974 by Joshua Sierles.
- * lib/rubygems/update_command.rb: Tweak formatting of updated
- message. Bug #15625 by Bil Kleb.
- * lib/rubygems/remote_fetcher.rb: Add URI to exception message for
- Gem::RemoteFetcher#fetch_size. Bug #14801 by Bil Kleb.
-
-2007-12-14 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/commands/query_command.rb: Don't display duplicate
- version numbers. Bug #15828 by Tim Fletcher.
- * setup.rb: Fix my stupidity with --help. Patch #16308 by Stephen
- Bannasch. Fix --prefix= argument. Bug #16002 by Piglop.
-
-2007-12-13 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/commands/server_command.rb: Fix --no-daemon. Bug by
- Chad Woolley.
- * lib/rubygems/server.rb: Fix Marshal quick index. Bug by Chad
- Woolley.
- * lib/rubygems/installer.rb: Respect Gem::Specification#bindir. Bug
- #16202 by Suraj Kurapati.
- * lib/rubygems/commands/update_command.rb: Fix `gem update mysql`.
- Bug #16244 by Stephen Bannasch.
-
-2007-12-12 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/installer.rb: Add --format-executable option to
- install executables with ruby's program-suffix and prefix. Patch
- #14688 by Jeremy Kemper. Also, installing in really-verbose mode
- prints out written files.
- * setup.rb: Add --format-executable option to install gem with ruby's
- program-suffix and prefix. Add --help. Fixes bug #16056 by Chad
- Woolley.
- * lib/rubygems/uninstaller.rb: Fallback to original_platform_name
- correctly. Patch #15960 by Nicola Piccinini's friend.
-
-2007-12-11 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/validator.rb: Correct test run failures when no tests
- are provided. Patch #15701 by Jérémy Zurcher.
- * lib/rubygems/commands/mirror_command.rb: Don't File.join a
- URI::HTTP. Patch #16116 by Morgan Nelson.
- * lib/rubygems/commands/unpack_command.rb: Add --target option to
- `gem unpack`. Patch #16154 by Kevin Barnes.
-
-2007-12-10 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/dependency_installer.rb: Revert to nil for the default
- security policy to avoid requiring OpenSSL.
- * lib/rubygems/defaults.rb: Consolidate defaults for easier editing.
- Patch #15150 by Donavan Pantke.
-
-2007-11-27 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/source_index.rb: Remove dependency on forwadable.
- Patch by Koichi Sasada.
- * lib/rubygems/specification.rb: Reduce dependency on time.rb. Patch
- by Koichi Sasada.
-
-2007-11-26 Rich Kilmer <rich@infoether.com>
-
- * lib/rubygems/version.rb: Fix bug 15948 with version bump
- * test/test_gem_version.rb: Test for bug 15948 with version bump
- * util/gem_prelude.rb: wrap init code with exception handler
- and skip badly formed directory names
-
-2007-11-23 Rich Kilmer <rich@infoether.com>
-
- * lib/rubygems.rb: Centralize all CONFIG options into Hash
- Gem::ConfigMap with keys as symbols, change all references
- to CONFIG to ConfigMap
- * lib/rubygems/require_paths_builder.rb: Added to support
- building .require_paths file
- * lib/rubygems/installer.rb: Add building of .require_paths if
- needed
- * lib/rubygems/platform.rb: Use new ConfigMap hash for arch
- * lib/rubygems
- * util/gem_prelude.rb: new gem prelude for Ruby 1.9
- * test/test_gem_installer.rb: change to use ConfigMap hash
- * test/gemutilities.rb: change to use ConfigMap hash
-
-2007-11-21 Daniel Berger <djberg96@gmail.com>
-
- * lib/rubygems/platform.rb: Gem::Platform.new now returns
- Gem::Platform.local if the arch matches Gem::Platform::CURRENT.
- Bugs #15815 and #15782 submitted by Daniel Berger.
-
-2007-11-20 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/platform.rb: Handle bare 'mswin32' platform's CPU.
-
-2007-11-19 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/rubygems_version.rb: 0.9.5.
-
-2007-11-16 Eric Hodel <drbrain@segment7.net>
-
- * test/gemutilities: Add a legacy platform gem to the default test
- gems list.
- * lib/rubygems/specification.rb: Add Gem::Specification#original_name
- for legacy purposes
- * lib/rubygems/indexer.rb: Use #original_name to make the indexer
- backwards compatible.
- * lib/rubygems/master_index_builder.rb: Reduce memory consumption.
-
-2007-11-13 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/rubygems_version.rb: 0.9.4.7 beta.
- * lib/rubygems.rb: Patch for RUBY_FRAMEWORK for OS X 10.5. Patch
- submitted by Laurent Sansonetti.
- * lib/rubygems.rb: cygwin, djgpp, mingw are Windows platforms. Fixes
- bug #15537 by Roger Pack.
-
-2007-11-11 Eric Hodel <drbrain@segment7.net>
-
- * Rakefile: Tasks for maintaining ruby trunk export of RubyGems.
- * lib/rubygems/specification.rb: Preserve original platform across
- serialization.
- * lib/rubygems/dependency_installer.rb: Retry with original platform
- name on fetch error.
-
-2007-11-09 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/specification.rb: Set #original_platform only once.
- * lib/rubygems/indexer.rb: Handle legacy platforms.
- * lib/rubygems/platform.rb: Gem::Platform is a valid argument. Bug
- #15511 submitted by Daniel Berger.
- * lib/rubygems/custom_require.rb: Fix compatibility with 1.8.2. Bug
- #14933 submitted by Aaron Patterson.
- * lib/rubygems/command.rb: Now '-V' enables verbose. Bug #14951
- submitted by Sasa Ebach.
- * lib/rubygems/commands/check_command.rb: Change use of '-v', '-V' to
- match above.
- * lib/rubygems/package.rb: #send! is gone again.
- * lib/rubygems.rb: Don't add custom_require for 1.9.
- * test/*: Make compatible with 1.9 import.
-
-2007-10-30 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/specification.rb: Don't re-use @platform to maintain
- backwards compatibility.
- * lib/rubygems/platform.rb: Handle nil and 'ruby' platforms in ::new.
-
-2007-10-20 Daniel Berger <djberg96@gmail.com>
-
- * lib/rubygems/uninstaller.rb: Changed '.cmd' to '.bat' in the
- remove_executables method for MS Windows. Patch from Luis Lavena.
-
-2007-10-18 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/rubygems_version.rb: 0.9.4.6 beta.
-
-2007-10-19 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/commands/update_command.rb: Don't install with
- dependencies when updating. This is a hack.
-
-2007-10-19 Daniel Berger <djberg96@gmail.com>
-
- * setup.rb: gem.cmd stub is now gem.cmd, and the stub generation was
- changed - now better for NT. Patch #14725 (Luis Lavena).
- * lib/rubygems/installer.rb: Same as for setup.rb.
-
-2007-10-18 Daniel Berger <djberg96@gmail.com>
-
- * lib/rubygems/platform.rb: Modified the Platform.local method for MS
- Windows for versions built with VC++ 6. Patch #14727 (Luis Lavena).
- * test/test_gem_specification.rb: Added version independent tests for
- MS Windows. Patch #14727 (Luis Lavena).
-
-2007-10-18 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/remote_fetcher.rb: Add platform to User-Agent.
- * lib/rubygems/commands/install_command.rb: Fix typo. Debian bug
- #443135 submitted by Reuben Thomas.
- * lib/rubygems/dependency_installer.rb: Don't install dropped
- dependencies. Fixes bug #14724 submitted by Luis Lavena.
-
-2007-10-17 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/commands/update_command.rb: Unset RUBYOPT when running
- setup.rb
- * setup.rb: Re-exec without RUBYOPT if it is set. Fixes bug #14683
- submitted by Lyle Johnson.
-
-2007-10-16 Daniel Berger <djberg96@gmail.com>
-
- * lib/rubygems/indexer/abstract_index_builder.rb: The compress method
- now does a binary read to make MS Windows happy.
-
-2007-10-16 Eric Hodel <drbrain@segment7.net>
-
- * setup.rb: Installs bin stubs that warn when you try to use the old
- commands. Simple mswin deprecation stubs by Luis Lavena.
-
-2007-10-12 Eric Hodel <drbrain@segment7.net>
-
- * setup.rb: Remove source caches on install.
- * doc/release_notes/rel_0_9_5.rdoc: Draft added.
- * lib/rubygems/rubygems_version.rb: 0.9.4.5 beta.
-
-2007-10-10 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/dependency_installer.rb: Fix small bug found by Alan C.
- Francis.
-
-2007-10-09 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/dependency_installer.rb: Use install_dir so custom gem
- repos can be used.
- * lib/rubygems/specification.rb: Always set required attributes, even
- if they match the default.
-
-2007-10-08 Ryan Davis <ryan@wrath.local>
-
- * lib/rubygems.rb: Fixed require order so custom_require is
- last. Added HACK tag to remind Jim to release rake.
- * test/test_gem_source_index.rb: Fixed latest_specs' tests so
- failures were much more readable.
- * lib/rubygems/source_index.rb: Fixed latest_specs to deal with
- platforms appropriately. Returns array again.
-
-2007-10-08 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/config_file.rb: Boost bulk_threshold to 1000, Marshal
- format is smaller than yaml format quick index.
- * lib/rubygems/installer.rb: Make #shebang correctly rewrite env
- shebangs.
- * lib/rubygems/specification.rb: Mark Time.today for removal, too much
- depends upon it now.
-
-2007-10-07 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/specification.rb: Sped up ::_load.
- * lib/rubygems/source_index.rb: Sped up #search.
- * lib/rubygems/version.rb: Replace #to_ints with #ints, and cache
- result.
- * lib/rubygems/source_info_cache.rb: Only flush cache when it changes.
-
-2007-10-05 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/user_interaction.rb: Allow customization of completion
- message for progress reporters.
- * lib/rubygems/command.rb: Add --quiet option.
- * lib/rubygems/commands/generate_index_command.rb: Add description.
-
-2007-10-04 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/uninstaller.rb: Also check and uninstall old platform
- name to ensure legacy platform gems are uninstalled.
- * lib/rubygems/doc_manager.rb: Remove existing rdoc and ri directory
- so regenerating docs succeeds even if previously interrupted.
-
-2007-10-02 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/source_index.rb: Make #outdated search only for gems
- matching the current platform.
- * lib/rubygems/commands/dependency_command.rb: Add --platform.
- * lib/rubygems/commands/outdated_command.rb: Ditto.
- * lib/rubygems/commands/specification_command.rb: Ditto.
- * lib/rubygems/commands/update_command.rb: Ditto.
-
-2007-10-02 Wilson Bilkovich <wilson@supremetyrant.com>
-
- * lib/rubygems/specification.rb: Custom Marshal format to reduce index
- size.
- * lib/rubygems/requirement.rb: Ditto
- * lib/rubygems/version.rb: Ditto
-
-2007-10-01 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/platform.rb: Handle mswin32 on VC6. Partial patch and
- assistance by Luis Lavena. Handle cpu-os-version style platforms for
- command-line arguments.
-
-2007-09-30 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/specification.rb: Gem::Specification is now
- forward-compatible while loading.
-
-2007-09-29 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/source_info_cache_entry.rb: Correctly handle URIs.
- * lib/rubygems/remote_fetcher.rb: ditto.
- * lib/rubygems/remote_options.rb: Add --update-sources option. Patch
- #14246 submitted by Alan Francis.
- * lib/rubygems/config_file.rb: Add update_sources setting to control
- automatic refreshing of sources (patch #14246). Fix bug where things
- would be overwritten in ~/.gemrc when they shouldn't.
-
-2007-09-28 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/rubygems.rb: Gem.ruby now returns the full path. Added
- Gem.prefix to make self updating work right.
- * setup.rb, pre-install.rb, post-install.rb: Replace with a small,
- simple setup script that works.
- * lib/rubygems/commands/update_command.rb: Pass rdoc, ri and prefix
- flags down to setup.rb when self updating.
-
-2007-09-26 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/version_option.rb: Always include RUBY platform,
- allow RUBY platform as an option.
- * lib/rubygems/specification.rb: Gems with non-ruby platform sort
- last (first in preference for installation).
- * lib/rubygems/platform.rb: Allow matching of legacy platforms.
- * lib/rubygems/source_index.rb: Add only_platform option to #search.
-
-2007-09-24 Wilson Bilkovich <wilson@supremetyrant.com>
- * lib/rubygems/indexer.rb: Generate a Marshal index in parallel to YAML
- * lib/rubygems/source_index.rb: Fetch a Marshal index if it exists, to
- avoid the memory cost of parsing a huge YAML file
- * lib/rubygems/commands/mirror_command.rb: Check for Marshal first
- * lib/rubygems/indexer/abstract_index_builder.rb: Index refactoring
- * lib/rubygems/indexer/marshal_index_builder.rb: Build Marshal index
- * lib/rubygems/indexer/master_index_builder.rb: Simplify YAML generation
- * lib/rubygems/indexer/quick_index_builder.rb: Build Marshal quickindex
- * lib/rubygems/server.rb: Serve up Marshal index as well as YAML
- * lib/rubygems/source_info_cache_entry.rb: Expect a Marshal index
-
-2007-09-23 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/commands/fetch_command.rb: `gem fetch` downloads a gem
- to the current directory. Feature request #10752 by Bret Pettichord.
- * lib/rubygems/commands/local_remote_options.rb, etc.: Fix spelling of
- 'threshold'.
- * lib/rubygems/installer.rb: Revert feature request #8818, it
- interferes with `ruby -S` and multiple versions of ruby (1.8 and 1.9).
- * lib/rubygems/dependency_installer.rb: Fix a bug where the wrong
- platform gem would be installed.
- * lib/rubygems/version_option.rb: Add --platform.
- * lib/rubygems/install_update_options.rb: Verify --security-policy.
- * lib/rubygems/local_remote_options.rb: Verify --source, --http-proxy.
-
-2007-09-22 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/open-uri.rb: Don't document our OpenURI.
- * lib/rubygems/commands/generate_index_command.rb: Fix Indexer class
- change.
- * lib/rubygems/commands/mirror_command.rb: Fix for 1.9.
- * lib/rubygems/commands/pristine_command.rb: Have `gem pristine`
- give a better report of what it accomplished.
- * lib/rubygems/command.rb: Add optional description field.
- * lib/rubygems/installer.rb: Hack around broken Pathname#absolute? on
- windows. Patch #14139 by Jim Hughes.
-
-2007-09-20 Eric Hodel <drbrain@segment7.net>
-
- * misc files: Tests pass on 1.9.
- * test/gemutilities.rb: Added Object#send! stub for 1.8.
- * test/test_open_uri.rb: Require gem_open_uri.rb to avoid warnings.
- * lib/rubygems/commands/sources_command.rb: Clarify `gem sources -c`
- and what `gem sources` does. Patch by Hugh Sasse.
-
-2007-09-19 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/platform.rb: Make Gem::Platform a class.
- * lib/rubygems/specification.rb: Gem::Specification#validate returns
- true, non-Gem::Platform platforms are no longer allowed.
- * test/gemutilities.rb: 1.9 compatiblity fixes.
- * lib/rubygems/dependency_installer.rb: Work around a bug in URI.parse
- which misinterprets "C:/". Patch #13537 submitted by Daniel Berger.
- * lib/rubygems/format.rb: Ensure file handles are closed. Patch
- #13533 submitted by Daniel Berger.
- * test/test_gem_installer.rb: Win32 path fix. Patch #13528 submitted
- by Daniel Berger.
- * test/gemutilities.rb: Make the platform be a win32 platform on
- win32. Fixes confusion in generate_bin_symlink tests. Patch #13529
- submitted by Daniel Berger.
- * test/test_gem_specification.rb: Sequel to above. Patch
- #13535 submitted by Daniel Berger.
- * lib/rubygems/source_index.rb: Make the updating cache message more
- clear. Patch #12778 submitted by Bil Kleb.
- * lib/rubygems/server.rb: Allow gem's rdoc-style.css to be used.
- Patch #13589 by Stephen Bannasch.
- * lib/rubygems/indexer.rb: Fail on missing builder gem only when
- trying to use the indexer. Fixes bug #13939 by Bryan Stearns.
- * lib/rubygems/indexer/indexer.rb: Move Indexer up one level in
- nesting.
- * lib/rubygems/indexer/compressor.rb: Only used in
- Gem::Indexer::AbstractIndexBuilder subclasses, merged there.
- * lib/rubygems/command_aids.rb: Merged Gem::CommandAids into
- Gem::Command since that's the only place it gets used.
- * misc other files: mswin fixes. Paired with Daniel Berger.
-
-2007-08-24 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/specification.rb: Fix #full_name for versionless
- platforms.
- * lib/rubygems/command_manager.rb: We're only looking for NameError.
- * lib/rubygems/command.rb: 1.9 fix.
- * lib/rubygems/format.rb: ditto.
- * lib/rubygems/installer.rb: ditto.
-
-2007-08-24 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/rubygems_version.rb: 0.9.4.4
-
-2007-08-23 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/platform.rb: Add HPUX, AIX and NetBSD. Thanks to
- Daniel Berger, Yutaka KANEMOTO and Andre Nathan respectively.
- * lib/rubygems/installer.rb: Move all option setting to #initialize to
- make `gem pristine` work again.
- * lib/rubygems/commands/environment_command.rb: Include platforms.
- * lib/rubygems/dependency_installer.rb: Support local non-root
- installation.
-
-2007-08-22 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/dependency_installer.rb: Don't reinstall dependencies
- existing in the install dir. Don't install dependencies for older
- versions of the gem we're installing. #installed_gems now contains
- loaded gemspecs. Always prefer local gems. Handle globs correctly.
- All deps are now installed into the install_dir.
- * lib/rubygems/commands/install_command.rb: Switch to
- Gem::DependencyInstaller. Warn when -y is given, it will be removed.
- Try our best to install everything the user asked.
- * lib/rubygems.rb: Gem.bindir now handles Pathname correctly.
- * lib/rubygems/remote_fetcher.rb: Don't downcase anymore.
-
-2007-08-21 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/dependency_installer.rb: Add installation from local
- gems. Install gems in the correct order. Handle -E, -f,
- --ignore-dependencies, -i, -r, -l, -b, -P, -w, -v options for `gem
- install`
- * test/gemutilities.rb: Work around OS X /private/tmp.
- * lib/rubygems/platform.rb: Switch to using arch instead of target_*
- for JRuby compatibility. Thanks to Nick Sieger.
-
-2007-08-20 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/dependency_installer.rb: Add working but unfinished
- Gem::DependencyInstaller.
- * lib/rubygems/source_info_cache.rb: Add #search_with_source.
- * lib/rubygems/dependency_list.rb: Move #fill_dependencies to
- Gem::DependencyInstaller
- * lib/rubygems/platform.rb: Split from specification.rb. Add methods
- to recognize platforms from Config::CONFIG.
- * lib/rubygems.rb: Add Gem::platforms.
- * lib/rubygems/specification.rb: Disallow String platforms.
-
-2007-08-18 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/source_info_cache.rb: Search by Gem::Dependenency.
- * lib/rubygems/source_index: Search by Gem::Dependenency.
- * lib/rubygems/version.rb: Version can be String or Integer.
- Gem::Requirement::default is now >= 0. Gem::Requirement can be built
- from a Gem::Dependency.
- * lib/rubygems/dependency_list.rb: Uses TSort now. Add
- Gem::DependencyList#fill_dependencies.
- * lib/rubygems/server.rb: Support quick index.
-
-2007-08-17 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/dependency_list.rb: For diamond dependencies with
- different versions on the bottom of the diamond, trim all but the
- latest dependency. This will prevent gems like hoe from being
- installed multiple times.
-
-2007-08-15 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/installer.rb: Support building mkrf extensions. Fixes
- bug #11313. Patch by Jeremy Hinegardner.
- * lib/rubygems/installer.rb: Ensure bin files are executable. Fixes
- bug #8985 submitted by Ara Howard.
- * lib/rubygems/installer.rb: Insert installing gem home dir into bin
- wrapper. Patch #8818 by Ara Howard.
-
-2007-08-13 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/commands/uninstall_command.rb: Gems with version of 0
- can now be uninstalled.
-
-2007-08-11 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/config_file.rb: Command-line args override ~/.gemrc
- now. Gem.sources is pulled from ~/.gemrc now. Gem::ConfigFile can
- write itself out now.
- * lib/rubygems/commands/sources_command.rb: Now writes out
- Gem.configuration on changes. No longer checks source cache on
- --list.
-
-2007-08-09 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/source_info_cache.rb: Make Gem::SourceInfoCache#search
- only search gems in Gem.sources.
- * lib/rubygems.rb: Make Gem::configuration a real Gem::ConfigFile
- object.
- * lib/rubygems/commands/query_command.rb: Fix `gem query --details`.
- Add `gem query --no-versions`.
- * lib/rubygems/local_remote_options.rb: Make `gem mumble --source URL`
- only use that source.
- * lib/rubygems/config_file.rb: Fix Gem::ConfigFile#[]= to match
- Gem::ConfigFile#[].
-
-2007-08-08 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/commands/specification_command.rb: Match only exact gem
- names. Fixes bug #9681. Patch by Michael DeCandia.
- * lib/rubygems/commands/unpack_command.rb: Match only exact gem names.
- Fixes bug #9681. Patch by Michael DeCandia.
- * lib/rubygems/commands/contents_command.rb: Match only exact gem
- names. Fixes bug #9681. Patch by Michael DeCandia
- * lib/rubygems/remote_fetcher.rb: Perform a GET request if the HEAD
- request doesn't have Content-Length. Fixes bug #9771. Patch by Ben
- Bleything.
- * lib/rubygems.rb: Clear Gem::searcher when we Gem::clear_paths.
- Fixes bug #12886. Submitted by Peter Williams.
- * lib/rubygems.rb: Add #default_sources and rework #sources to use it.
- * post-install.rb: No longer runs install_sources.
- * pkgs/sources: Updated to something what a 0.0.2 would look like, if
- we ever make one.
-
-2007-08-02 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/gem_commands.rb: Removed and broken up into individual
- files.
- * lib/rubygems/command_manager.rb: Lazily loads gem commands. Now to
- use CommandManager just "require 'rubygems/command_manager'" and
- everything will be there.
-
-2007-08-01 Eric Hodel <drbrain@segment7.net>
-
- * lib/*, test/*: Pushed down dependencies as far as reasonable.
- Removed Gem::manage_gems. Now only 14 files are loaded with "require
- 'rubygems'". Added tests for `gem build` and `gem cert`.
- * lib/rubygems/extensions.rb: Added common place for all extensions.
-
-2007-07-26 Eric Hodel <drbrain@segment7.net>
-
- * test/test_gem_ext_configure_builder.rb: Linux has different behavior
- for `sh ./configure` when configure is missing. Fix adapted from
- Patch #10019 by Donavan Pantke.
- * lib/rubygems/commands/pristine_command.rb: Compare fully-qualified
- paths. Fixes bug #7976 by Lyle Johnson.
- * lib/rubygems/config_file.rb: Add ConfigFile#[]=, so --proxy
- command-line option works. Fixes #8152 by Justin Sabelkko.
- * lib/rubygems/post-install.rb: Make sure we use the
- latest-and-greatest RubyGems when running post-install.rb. Fixes Bug
- #8411 by Duy Nguyen.
- * lib/rubygems/remote_fetcher.rb: An empty HTTP_PROXY means no proxy.
- Fixes Bug #9042 by Michael Brodhead.
- * lib/rubygems/version.rb: Disallow newlines in version string. Strip
- spaces from version string. Fixes Bug #9499 by Bryce Kerley.
- * lib/rubygems/commands/sources_command.rb: Fix spelling error. Fixes
- Bug #11064 by Chris Eskow.
-
-2007-07-25 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/indexer.rb: Create the index in /tmp, then move it into
- place when we're done. This will prevent spurious bulk index updates
- from occurring while the quick index is missing. Remove the option to
- not build the quick index.
- * lib/rubygems/commands/generate_index_command.rb: --no-quick is gone.
- * lib/rubygems/user_interaction.rb: If stdin is not a tty, it is
- unlikely that gem is going to get a response when asking a question.
- Patch #10660 by Paul Brannan.
- * lib/rubygems/validator.rb: Output test failures when using install
- -t. Patch #10659 by Paul Brannan.
- * lib/rubygems/custom_require.rb (Kernel#require): Only rescue a
- LoadError that matches the file we are requiring. Patch #10723 by
- Tyler Rick.
- * lib/rubygems/remote_fetcher.rb: Support HTTP basic authentication.
- Patch #8121 by Max Dunn.
- * lib/rubygems/commands/install_command.rb: Don't raise an error when
- a gem has no tests. Patch #11824 by Katsuyuki MIYAMUKO.
-
-2007-07-23 Eric Hodel <drbrain@segment7.net>
-
- * lib/commands/contents_command.rb: Add --lib-only option, remove
- useless --list option. Feature request #9498 by Martin DeMello.
- * lib/rubygems/specification.rb: Restrict to only files in
- #require_paths. Add #required_rubygems_version. Feature request
- #7780 by Eric Hodel.
- * lib/rubygems/commands/dependency_command.rb: Display dependencies for
- remote gems. Feature request #12133 by Eric Hodel. -r for reverse
- dependencies is now -R.
- * lib/rubygems/commands/specification_command.rb: Display
- specifications for remote gems. Feature request #12133 by Eric Hodel.
- * lib/rubygems/installer.rb (Gem::Installer#install): Check
- required_rubygems_version.
- * lib/rubygems/user_interaction.rb
- (Gem::UserInteraction#choose_from_list): Check result for EOF. Fixes
- bug #8018. Patch by Jos Backus.
- * post-install.rb: Install using absolute path. Fixes bug #10675.
- Patch by Jeremy Burks.
- * lib/rubygems/commands/environment_command.rb: Add RUBY VERSION to
- environment output.
- * lib/rubygems/command.rb: Don't worry about duplicated command-line
- options, OptionParser takes care of them for us.
-
-2007-07-22 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/specification.rb (Gem::Specification#files): Make it
- faster
- * lib/rubygems/command.rb: Better documentation. -v flag now lets you
- get to "really verbose" mode which makes the verbose progress meter
- work. Add command groups to separate types of commands easily.
- * lib/rubygems/commands/which_command.rb, bin/gemwhich: Move `gemwhich`
- under `gem`.
- * lib/rubygems/commands/mirror_command.rb, bin/gem_mirror: Move
- `gem_mirror` under `gem`.
- * lib/rubygems/commands/lock_command.rb, bin/gemlock: Move `gemlock`
- under `gem`.
- * lib/rubygems/commands/server_command.rb, bin/gem_server: Move
- `gem_server` under `gem`.
- * lib/rubygems/doc_manager.rb (Gem::DocManager#initialize): Only raise
- when operating on the filesystem.
- * lib/rubygems/server.rb: Remove option processing, now in
- Gem::Commands::ServerCommand.
- * lib/rubygems/commands/generate_index.rb, bin/index_gem_repository.rb:
- Move `index_gem_repository.rb` to `gem generate_index`.
- * lib/rubygems/indexer (Gem::Indexer): Extract from
- index_gem_repository.rb and merge RubyForge changes.
- * lib/rubygems/command_manager.rb (Gem::CommandManager#run): Print
- backtrace when --debug is set too.
- * lib/rubygems/command_manager.rb (Gem::CommandManager#load_and_instantiate):
- Don't infinitely loop in retry.
- * bin/gemri: Removed. Everybody should have ri integration now.
- * lib/rubygems/config_file.rb: Allow settings to be examined. Pull
- settings from .gemrc.
- * lib/rubygems/commands/environment_command.rb: Add ruby executable
- and configuration settings to `gem env`.
- * lib/rubygems/indexer/indexer.rb (Gem::Indexer::Indexer#build_index):
- Now uses UserInteraction.
- * various: Use UserInteraction for output.
- * lib/gemconfigure.rb: Removed. Same as multiple gem commands.
- * lib/rubygems/commands/contents_command.rb: Removed extra --verbose
- option.
- * lib/rubygems/gem_commands.rb (Gem::LocalRemoteOptions): Moved -B,
- --source, -p from Gem::Commands::common_options.
-
-2007-07-22 Chad Fowler <chad@chadfowler.com>
-
- * lib/rubygems/gem_commands.rb: Added another example to the gem
- example output (Gile Bowkett)
- * test/test_documentation_generation.rb, lib/rubygems/doc_manager.rb:
- Added a test for documentation generation and fixed a bug when doc
- location is not writable.
-
-2007-06-16 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/gem_path_searcher.rb (Gem::GemPathSearcher): Moved out
- of lib/rubygems/custom_require.rb and added tests.
-
-2007-06-02 Jim Weirich <jim@weirichhouse.org>
-
- * lib/rubygems/source_info_cache.rb (Gem::try_file): Fix for issue
- where a non-existing source cache file causes the gem command to
- not find a gem. This fixes it by marshalling out an empty
- hash. (Thanks to Nick Sieger for this fix).
-
-2007-06-01 Jim Weirich <jim@weirichhouse.org>
-
- * lib/rubygems.rb
- (Gem::OperationNotSupportedError::latest_partials): Changed from
- match data style to $1 style regexp (on the recommendation of
- better performance).
-
-2007-05-30 Jim Weirich <jim@weirichhouse.org>
-
- * lib/rubygems/source_index.rb (Gem::SourceIndex::update):
- Modified to get the bulk_threshhold from the configuration.
- (Gem::SourceIndex::convert_specs): Ryan removed the "reduce_specs"
- method because it is not needed any more and is creating memory
- overhead.
-
- * lib/rubygems/config_file.rb (Gem::ConfigFile): Added
- bulk_threshhold field to ConfigFile.
- (Gem::ConfigFile::initialize): Initialize bulk threshhold to 500.
-
- * lib/rubygems/command.rb
- (Gem::Command::specific_extra_args_hash): Added
- -B (--bulk-threshhold) option to allow user specified bulk
- download threshhold.
-
-2007-05-23 Jim Weirich <jim@weirichhouse.org>
-
- * lib/rubygems/commands/sources_command.rb
- (Gem::Commands::SourcesCommand::initialize): Added a --clear-all
- option to the sources subcommand. Clear-all will remove the cache
- files.
-
- * lib/rubygems/source_info_cache.rb (Gem): Moved system_cache_file
- and user_cache_file to class methods so that we can get the file
- names without creating a SourceInfoCache instance.
-
-2007-05-23 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/source_info_cache.rb: Teach SIC to repair itself
- when it encounters a bad cache file.
-
-2007-05-14 Chad Fowler <chad@chadfowler.com>
- * lib/rubygems/command_manager.rb: Re-added registration for
- gem cleanup command which I accidentally removed during refactoring.
-
-2007-05-10 Jim Weirich <jim@weirichhouse.org>
-
- * lib/rubygems/remote_installer.rb: Uncommented the require
- 'sources' line.
-
- * lib/rubygems/source_info_cache.rb: Uncommented the require
- 'sources' line.
-
- * lib/rubygems/rubygems_version.rb (Gem): Bumped to version 0.9.3
- in preparation for release.
-
- * lib/rubygems/package.rb (Gem::TarInput::zipped_stream):
- Zipped_stream now always uses the in memory string IO buffer.
- There were just too many problems with ZLib (on windows)
- otherwise.
-
-2007-03-26 Jim Weirich <jim@weirichhouse.org>
-
- * (Index): new digest technique.
-
- * lib/rubygems/validator.rb (Gem::Validator::verify_gem): Removed
- really old MD5 and replaced with gem based digests.
-
- * experimental/deployment.rb (Gem::Deployment::Manager::initialize):
- New digest technique.
-
- * experimental/test_deployment.rb (TestDeployment::test_deployed_file):
- New digest technique.
-
-2007-03-26 Chad Fowler <chad@chadfowler.com>
-
- * Extracted the big ball of mud that was gem_commands.rb into
- separate files.
-
-2007-03-17 Chad Fowler <chad@chadfowler.com>
-
- * Various ruby 1.8.6 fixes for failing tests.
-
- * Updated setup.rb to 3.4.1
-
- * Renamed cmd_manager to command_manager to keep names consistent
-
- * lib/installer.rb: Rework path checking to use Pathname (ara howard bug #8811)
-
-2007-03-02 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems.rb: Add bin directory before library directory,
- otherwise gems like rake don't work.
-
-2007-03-01 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/open-uri.rb: Fix all the infinite loop errors.
-
- * lib/rubygems.rb: Add dirs from activate after -I and ENV['RUBYLIB']
- dirs. Otherwise gems won't allow -I to work when #gem is called.
-
-2007-02-11 Chad Fowler <chad@chadfowler.com>
-
- * test/gemutilities.rb: Fix to make Windows tests pass. (Anatol Pomozov)
-
-2007-02-05 Jim Weirich <jim@weirichhouse.org>
-
- * lib/rubygems/rubygems_version.rb (Gem): Bumped to version 0.9.2
- and made a release.
-
-2007-02-04 Chad Fowler <chad@chadfowler.com>
-
- * Fixed failing tests (changed from assert_equal to assert_match to
- deal with ARGV inconsistencies in test vs. production).
-
-2007-02-03 Jim Weirich <jim@weirichhouse.org>
-
- * Bumped version to 0.9.1.1.
-
- * lib/rubygems/gem_open_uri.rb: Added the patched open-uri back
- into the gems software. Evidently, the 1.8 version of open-uri
- does not handle authenticating proxies with username and password.
-
- * lib/rubygems/source_info_cache.rb (Gem::cache_data): Added
- rescue block to capture bad file loads. The original rescue was
- only around the marshal load (bug was probably introduced when the
- file data was preloaded into a string).
- (Gem::set_cache_data): Added set_cache_data to be used during
- testing to avoid reload the cache file over and over.
-
- * lib/rubygems/gem_commands.rb: Added require for command class so
- that this file can be loaded independently.
-
- * lib/rubygems/source_index.rb (Gem::SourceIndex::outdated): Minor
- cleanup.
-
- * test/gemutilities.rb
- (RubyGemTestCase::util_setup_source_info_cache): Minor cleanup
-
- * test/test_gem_source_info_cache.rb
- (TestGemSourceInfoCache::test_write_cache_user): Switched to using
- set_cache_data here and several other places to avoid rereading
- the cache data over and over again.
-
-2007-02-02 Chad Fowler <chad@chadfowler.com>
-
- * lib/rubygems/gem_commands.rb:
- Fixed gem unpack (broken since 0.9.1)
-
-2007-01-20 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/source_info_cache.rb (Gem::SourceInfoCache#cache_data):
- Read the source_cache in binary mode for mswin.
-
-2007-01-16 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/rubygems_version.rb (Gem): Released 0.9.1.
-
-2007-01-15 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/installer.rb (Gem::Installer#extract_files): Only allow
- installation to absolute directories. (Call File::expand_path first).
- More informative message for attempting to install with bad path.
- * post-install.rb: Install sources first, since its rather important.
-
-2007-01-14 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/source_info_cache.rb: require 'fileutils', as its
- needed.
-
-2007-01-12 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/installer.rb (Gem::Installer#extract_files): Don't
- allow gems to place files outside the installation directory. Fixes
- bug 7751 by Gavin Sinclair.
-
-2007-01-08 Jim Weirich <jim@weirichhouse.org>
-
- * lib/rubygems/specification.rb
- (Gem::Specification::test_suite_file): Added rescue clause for
- default_executable.
- (Gem::Specification::add_bindir): Added rescue clause for
- add_bindir.
-
- * test/test_specification.rb
- (TestSpecification::test_pathologically_bad_non_array_stuff_doesnt_goof_up_files):
- Added a sanity check on hash for some pathologically bad case.
- (TestSpecification::test_pathologically_bad_exectuables_doesnt_goof_up_hash):
- Added sanity check for pathologically bad executables field.
-
-2007-01-08 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/gem_commands.rb (Gem::PristineCommand#execute): Better
- messaging.
- * lib/rubygems.rb, lib/rubygems/custom_require.rb: Correctly include
- documentation for methods added to Kernel.
-
-2007-01-07 Eric Hodel <drbrain@segment7.net>
-
- * Rakefile: Include GPL.txt. Fixes bug #7572 by David Lee.
-
-2007-01-06 Jim Weirich <jim@weirichhouse.org>
-
- * lib/rubygems/rubygems_version.rb (Gem): Bumped to version
- 0.9.0.9.
-
- * lib/rubygems/specification.rb
- (Gem::Specification::test_suite_file): Rewrote default_executable
- to be a bit more explicit.
- (Gem::Specification::add_bindir): Rewrote the 'files' accessor to
- handle pathologically bad input.
- (Gem::Specification::copy_of): Added as_array private method.
-
- * Rakefile (package_version): Added '*.out' to clobber list.
- Removed the broken-1.0.0.gem file from the clobber list.
-
- * test/test_specification.rb
- (TestSpecification::test_default_executable):
- Seriously beefed up tests for certain specification issues.
-
- * test/gemenvironment.rb (TestEnvironment::create): Added the 'f'
- flag to deleting 'gemhome'.
-
-2006-12-30 Eric Hodel <drbrain@segment7.net>
-
- * post-install.rb, lib/rubygems/server.rb: RubyGems now installs RDoc
- and ri for itself.
-
-2006-12-28 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/installer.rb (Gem::Installer#build_extensions):
- Extension build failures now raise Gem::Installer::ExtensionBuildErrors.
-
-2006-12-26 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/package.rb (Gem::Package::TarInput#initialize): Bad
- packages now raise FormatError instead of a generic RuntimeError.
- * lib/rubygems/installer.rb (Gem::Installer#install): Raise an
- InstallError when we have a bad gem file.
-
-2006-12-25 Jim Weirich <jim@weirichhouse.org>
-
- * lib/rubygems/custom_require.rb (Gem::GemPathSearcher::find):
- Removed SUFFIX_PATTERN. Evidently this was miss during an earlier
- attempt to remove it.
- (Gem::GemPathSearcher::matching_file): Changed reference to
- SUFFIX_PATTERN into a call to Gem.suffix_pattern.
-
- * Removed tab characters from numerous source files.
-
- * lib/rubygems/installer.rb (Gem::Uninstaller::uninstall): Removed
- stray tab characters.
-
- * lib/rubygems.rb (Kernel::require_gem): Added file and line
- number information to require_gem worning (makes it easier to
- track down those offending lines of code).
- (Kernel::location_of_caller): Added helper function to determine
- file and line number of caller.
-
-2006-12-25 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/installer.rb (Gem::Installer#app_script_text):
- Simpler, more readable bin script.
- * lib/rubygems/gem_commands.rb (Gem::PristineCommand#execute):
- Regenerate bin scripts. This will clean up require_gem in scripts.
-
-2006-12-24 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/remote_fetcher.rb (Gem::RemoteFetcher#fetch_path):
- Rescue various errors and return a more-friendly error.
-
-2006-12-23 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/command.rb lib/rubygems/gem_commands.rb: Make help
- output fit in 80 columns.
- * lib/rubygems/rubygems_version.rb: Bump version to 0.9.0.8, beta
- time! (Oops, didn't go into beta.)
-
-2006-12-20 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/remote_fetcher.rb (Gem::RemoteFetcher#fetch_size): Give
- a sensible error on bad URIs.
- * lib/rubygems/gem_commands.rb (Gem::SourceCommand): Allow management
- of sources in source_cache. Fixes bug #1128.
- * lib/rubygems.rb (Kernel#require_gem): Add deprecation warning in
- favor of gem.
-
-2006-12-19 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/installer.rb (Gem::ExtBuilder): Refactored for
- uniformity.
- * lib/rubygems/remote_installer.rb
- (Gem::RemoteInstaller#specs_n_sources_matching): Don't display gems
- that can't be installed.
- * lib/rubygems.rb, pre-install.rb: Fix installation errors on 1.9.
- Fixes bug #4536 by Ryan Davis.
- * lib/rubygems/source_index.rb, lib/rubygems/gem_commands.rb,
- lib/rubygems-custom_require.rb: Use File.join with glob strings.
- Fixes bug #1096 submitted by Chad Fowler.
- * lib/rubygems/remote_installer.rb
- (Gem::RemoteInstaller#install_dependencies): Make --force actually
- force. Fixes bug #7365 by Robert James.
-
-2006-12-18 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/gem_commands (Gem::OutdatedCommand): Add a way to see
- which gems are out-of-date.
-
- * setup.rb: Ignore errors for .config and InstalledFiles when
- the source path is read-only/NFS. Fixes bugs #1395 and #1374. Patch
- by Ryan Davis.
-
- * bin/gem_server: Pull code out into lib/rubygems/server.rb for
- reusability. Closes Feature Request #2220 by Chris Morris.
-
-2006-12-16 Chad Fowler <chad@chadfowler.com>
-
- * test/: Added functional test for extension gems proving that
- non-compiling extensions don't result in success message.
-
- * lib/rubygems/specification.rb: Raise exception if loaded spec is
- nil. Closes bug #7299.
-
- * test/gemenvironment.rb: Clean out gemhome every time to avoid dirty
- directory failing tests.
-
- * lib/rubygems/installer.rb: Change uninstall to require a full gem
- name (not a partial match). Fixes bug #6007 and related unreported
- issues.
-
-2006-12-15 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/installer.rb (Gem::Uninstaller): Correctly uninstall
- executables if GEM_HOME is set. Patch #2264 by Sylvain Joyeux.
-
- * lib/rubygems.rb (Gem::loaded_specs): Expose list of currently loaded
- gems.
-
- * lib/rubygems/gem_commands (Gem::UninstallCommand): Allow multiple
- gems to be uninstalled at once.
-
-2006-12-14 Eric Hodel <drbrain@segment7.net>
-
- * post-install.rb: Don't attempt to read unreadable files. Fixes
- bug #2851.
-
-2006-12-13 Eric Hodel <drbrain@segment7.net>
-
- * pre-install.rb.rb, post-install.rb: Don't call manage_gems because
- we don't have sources installed yet. Bump version requirement to
- 1.8.2 since rubygems/open-uri.rb was removed. Should fix bug #6206.
-
- * lib/rubygems/installer.rb (Gem::Installer#build_extensions): Capture
- stderr into results when building extensions.
-
- * lib/rubygems/gem_commands.rb (Gem::ContentsCommand): Allow version
- to be passed to gem contents. Not backwards compatible, -v now -V and
- vice versa. Select newest gem for contents. Fixes bugs #2723, #7225.
- Patches by Sava Chankov, Tom Pollard.
-
- * lib/rubygems/gem_commands.rb (Gem::InstallCommand#execute): Allow
- install errors to result in non-zero exit code. Fixes bug #2773.
-
-2006-12-03 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/remote_installer.rb (Gem::RemoteInstaller#install):
- Add :cache_dir option to override the default.
-
- * lib/rubygems/remote_installer.rb (Gem::RemoteInstaller#download_gem):
- Check cache to see if the gem has been cached before downloading.
-
-2006-12-02 Jim Weirich <jim@weirichhouse.org>
-
- * lib/rubygems.rb (Gem::OperationNotSupportedError::suffixes,
- Gem::OperationNotSupportedError::suffix_pattern): Removed
- duplicate copies of the SUFFIX_PATTERN by providing a global
- method Gem.suffixes and Gem.suffix_pattern.
-
- * lib/rubygems/remote_fetcher.rb (Gem::open_uri_or_path): Reworked
- the connection options for the open-uri call. Since we are not
- using the rubygems supplied open_uri, we can use some new options
- available that make proxy handling much easier.
- (Gem::file_uri): Renamed is_file_uri to file_uri?.
-
- * lib/rubygems/loadpath_manager.rb (Gem::LoadPathManager::self):
- Added .jar to list of suffixes.
-
- * test/functional.rb (FunctionalTest::test_env_remotesources):
- Changed test to uses Gem.sources (the sources method on
- remote_fetcher was removed).
-
- * test/test_remote_fetcher.rb (TestRemoteFetcher): Renamed some of
- the test constants and instance variables so that they were more
- consistent and explained the tests a wee bit better.
- (TestRemoteFetcher::test_no_proxy): Added assert_data_from_server
- and assert_data_from_proxy to make it clear what the test was
- doing and give better error messages on errors.
- (TestRemoteFetcher::assert_data_from_server): Added
- assert_data_from_server.
- (TestRemoteFetcher::assert_data_from_proxy): Added
- assert_data_from_proxy.
-
-2006-11-30 Chad Fowler <chad@chadfowler.com>
-
- * lib/rubygems/open-uri.rb: Removed the duplicated library.
-
-2006-11-30 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/specification (Gem::Specification#eql?): Allow gemspecs
- to be used intelligently with Array#- and Array#uniq.
-
- * lib/rubygems/installer.rb: Return extension-building results in
- Exception on build failure.
-
- * lib/rubygems/remote_installer.rb: Ensure gems with similar names
- cannot be matched for install. (Broken when searching was removed
- from RemoteInstaller.)
-
-2006-11-29 Eric Hodel <drbrain@segment7.net>
-
- * post-install.rb: Now requires rbconfig.
-
- * lib/rubygems/specification.rb, lib/rubygems/version.rb: Fixed many
- ivar warnings due to YAML specs.
-
- * lib/rubygems/validator.rb, lib/rubygems/validator.rb
- (Gem::Validator#unit_test Gem::RemoteInstaller::): Ensure the
- current directory is restored.
-
- * lib/rubygems/remote_fetcher.rb, lib/rubygems/remote_installer.rb,
- lib/rubygems/installer.rb: Raise more-friendly and less-deadly errors.
-
- * lib/rubygems/remote_installer.rb (Gem::RemoteInstaller#install):
- Create version requirement correctly.
-
- * lib/rubygems/remote_installer.rb
- (Gem::RemoteInstaller#find_gem_to_install): Allow RemoteInstaller to
- work with SilentUI.
-
- * lib/rubygems/remote_fetcher.rb (RemoteFetcher#open_uri_or_path):
- Don't double-require open-uri.
-
-2006-11-27 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/specification.rb
- (Gem::Specification#default_executable): Fixed bug where @executables
- could be nil when loaded from index.
-
-2006-11-21 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/source_index.rb (Gem::SourceIndex#latest_specs): Grab
- the latest versions of everything in the index. Written by Ryan
- Davis.
-
-2006-11-20 Rich Kilmer <rich@infoether.com>
-
- * lib/rubygems/cmd_manager.rb: Added PristineCommand
-
- * lib/rubygems/gem_commands.rb: Added PristineCommand to restore
- gems to pristine condition in the event of files begin deleted
- based on the cached .gem file
-
-2006-11-19 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/*_fetcher.rb: Removed code specific to remote source
- index updating.
-
- * lib/rubygems/remote_installer.rb (Gem::RemoteInstaller#search):
- Moved to Gem::SourceInfoCache#search
-
- * lib/rubygems/source_info_cache.rb: Taught to update itself
-
- * lib/rubygems/source_info_cache_entry.rb: Taught to update itself
-
- * lib/rubygems/source_index.rb: Taught to update itself from a uri.
-
-2006-11-18 Chad Fowler <chad@chadfowler.com>
-
- * lib/rubygems/installer.rb: Applied Kevin Clark's patch to make
- RubyGems recognize mkrf files.
-
-2006-11-17 Eric Hodel <drbrain@segment7.net>
-
- * test/test_remote_fetcher.rb: Don't allow files in Dir.pwd to make
- tests fail. Spotted by Chad Fowler.
-
- * lib/rubygems/remote_installer.rb (Gem::RemoteFetcher,
- Gem::CacheFetcher): Break out of remote_installer.rb into separate
- files.
-
- * lib/rubygems/remote_installer.rb (Gem::SourceInfoCache,
- Gem::SourceInfoCacheEntry): Allow requiring just the source cache
- without the remote fetcher.
-
-2006-11-16 Eric Hodel <drbrain@segment7.net>
-
- * test/test_local_cache.rb: Moved to better name
-
- * test/test_gem_source_info_cache.rb: Renamed test methods to match
- implementations. Sorted test names.
-
- * lib/rubygems/remote_installer (Gem::SourceInfoCache): cache_data no
- longer resets dirty flag. Sped up source cache loading. Exposed
- cache file name in use.
-
-2006-11-15 Eric Hodel <drbrain@segment7.net>
-
- * test/, lib/: Made files -w clean.
-
- * test/: Made tests run independently.
-
- * Rakefile: Tests now run with warnings on.
-
-2006-11-14 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/user_interaction.rb (Gem::StreamUI#progress_reporter):
- Fix for Gem.configuration.verbose = nil, false
-
- * lib/rubygems.rb (Gem::configuration): Fix RakeFileUtils pollution.
-
-2006-10-05 Jim Weirich <jim@weirichhouse.org>
-
- * lib/rubygems/installer.rb (Gem::Installer::shebang): Updated to
- optionally call env_shebang if the command line option is set.
- (Gem::Installer::shebang_env): Added this method.
-
-2006-09-25 Jim Weirich <jim@weirichhouse.org>
-
- * lib/rubygems/rubygems_version.rb (Gem): Bumped to version
- 0.9.0.6.
-
- * lib/rubygems/security.rb (Gem::Security::Exception): Added
- permissions for cert files and directories.
- (Gem::Security::Policy::verify_gem): File.exists? => File.exist?
- (Gem::Security::self.verify_trust_dir): Beefed up code to create
- trust directory structure.
- (Gem::Security::self): Apply permissions when creating trust
- files.
-
- * lib/rubygems/package.rb (TarInput::initialize): File.exists? =>
- File.exist?
-
-2006-09-24 Jim Weirich <jim@weirichhouse.org>
-
- * lib/rubygems.rb
- (Gem::OperationNotSupportedError::configuration): Added
- method_missing to configuration hash to allow nicer reference
- syntax.
-
-2006-09-22 Jim Weirich <jim@weirichhouse.org>
-
- * lib/rubygems/remote_installer.rb
- (Gem::RemoteSourceFetcher::initialize): Proxy patch fixup to
- escape user/password from Anatol Pomozov.
- (Gem::RemoteSourceFetcher::connect_to): Proxy patch fixup to
- escape user/password from Anatol Pomozov.
-
- * test/test_remote_fetcher.rb (TestRemoteFetcher::setup): Proxy
- patch fixup to escape user/password from Anatol Pomozov.
- (TestRemoteFetcher::test_no_proxy): Proxy patch fixup to escape
- user/password from Anatol Pomozov.
-
- * test/io_capture.rb (Gem::IoCapture): Created new IoCapture
- module to handle capturing output of code under test.
-
- * test/test_installer.rb
- (TestInstaller::test_generate_bin_symlinks_win32): Removed ugly
- $TESTING hack and substituted new io capture module.
- (TestInstaller::test_install_with_message): Removed one-off stdout
- capture and replaced with new IO Capture module.
-
-2006-09-19 Jim Weirich <jim@weirichhouse.org>
-
- * lib/rubygems/rubygems_version.rb (Gem): Bumped to version
- 0.9.0.3.
-
- * test/test_version_comparison.rb (TestRequirementEquality): Added
- more tests for Dependency equality testing and one additions check
- for requirement vs non-requirement equality.
-
- * lib/rubygems/version.rb (Gem::Dependency::==) Fixed '=' bug in
- '==' code.
-
-2006-09-18 Chad Fowler <chad@chadfowler.com>
-
- * lib/rubygems/remote_installer.rb
- Only show the last 3 gem versions on a multiplatform remote
- install list.
-
-2006-09-18 Jim Weirich <jim@weirichhouse.org>
-
- * lib/rubygems/remote_installer.rb
- (Gem::RemoteInstaller::install): Added Hugh Sasse's patch for
- skipping gems on install.
-
- * lib/rubygems/rubygems_version.rb (Gem): Bumped to 0.9.0.2.
-
- * lib/rubygems/version.rb (Gem::Dependency::hash): Added hash code
- --http-proxy, the ENV var http_proxy and with no proxy.
-
-2006-08-26 Jim Weirich <jim@weirichhouse.org>
- * lib/rubygems/remote_installer.rb
- (Gem::RemoteInstaller::download_gem): Fixed download_gems so that
- it properly passes the proxy option to the fetcher class. (based
- on patch by Andy Shen).
-
-2006-08-12 Jim Weirich <jim@weirichhouse.org>
-
- * bin/index_gem_repository.rb (Indexer::sanitize): Added a
- sanitize step to the gem index generation in the hope of avoiding
- problems with non-ASCII names in the yaml data.
-
-2006-06-14 Jim Weirich <jim@weirichhouse.org>
-
- * Rakefile (announce): Added 1.9 hack for ENV['CERT_DIR']. Remove
- this in the future if 1.9 behavior changes.
-
-2006-06-13 Jim Weirich <jim@weirichhouse.org>
-
- * Rakefile: ENV['CERT_DIR'] is now '' rather than nil.
-
- * lib/rubygems/specification.rb (Gem::Specification::initialize):
- Eric added some 1.9 compatibility code (funcall vs send).
-
- * lib/rubygems/package.rb (TarOutput::self): Eric added some 1.9
- compatibility code (funcall vs send).
-
- * experimental/deployment.rb (Gem::Deployment): Moved the
- deployment code out of the live code base into the experimental
- directory. The code wasn't used and the tests were not all
- passing.
-
-2006-06-11 Jim Weirich <jim@weirichhouse.org>
-
- * bin/gemri: Added gemri to bin directory.
-
- * lib/rubygems/custom_require.rb (Gem::GemPathSearcher::find):
- Added .rbw to suffix pattern in custom_require.
-
-2006-06-07 Jim Weirich <jim@weirichhouse.org>
-
- * lib/rubygems.rb: Added copyright notices to all Ruby files.
-
-2006-04-07 Jim Weirich <jim@weirichhouse.org>
-
- * lib/rubygems/gem_commands.rb (Gem::RDocCommand::execute): Added
- RI option to the rdoc subcommand.
-
-2006-04-05 Jim Weirich <jim@weirichhouse.org>
-
- * test/test_parse_commands.rb
- (TestParseCommands::test_parsing_update_options): Fixed unit tests
- to assert that the install dir is expanded.
-
- * lib/rubygems/doc_manager.rb (Gem::DocManager::generate_ri):
- Break out from generate_rdoc to support installing all RI docs
- first.
-
- * lib/rubygems/gem_commands.rb
- (Gem::InstallUpdateOptions::add_install_update_options): Expanded
- repository directory to absolute path.
- (Gem::InstallCommand::execute): Make sure that *all* of the RI
- documents are generated before generating any RDocs (due to a bug
- in the RDoc library).
-
- * lib/rubygems/installer.rb (Gem::ExtExtConfBuilder::self): Fixed
- typo in ExtExtConfBuilder that prevented C based gems to install.
- (Gem::ExtExtConfBuilder::self): Installed patch to prevent the
- overriding of target_prefix in native extensions (thanks to Aaron
- Patterson for the patch).
-
-2006-04-04 Jim Weirich <jim@weirichhouse.org>
-
- * lib/rubygems/rubygems_version.rb (Gem): Bumped to version
- 0.8.11.10.
-
- * lib/rubygems/incremental_fetcher.rb
- (Gem::IncrementalFetcher::update_cache): Now falls back to bulk
- updates if the number of gems if over 50.
-
- * lib/rubygems/remote_installer.rb
- (Gem::RemoteSourceFetcher::source_index): Added "bulk" to the
- update message to differentiate it from the incremental message.
-
- * lib/rubygems/specification.rb
- (Gem::Specification::Specification): Modified to add dashes to
- gemspecs generated under Ruby 1.8.3. This makes it easier to run
- RubyGems on a 1.8.2 system.
-
-2006-04-01 Jim Weirich <jim@weirichhouse.org>
-
- * lib/rubygems/doc_manager.rb (Gem::DocManager::run_rdoc): Changed
- exception handler to print error message if document generation
- fails, but then to continue with the rest of the installation.
- Permission errors still terminate the install because if one
- install fails because of permission problems, chances are that all
- will fail.
- (Gem::DocManager::install_ri): Removed wrapping of exceptions with
- DocumentError. Most exceptions now don't propagate out of
- run_rdoc.
- (Gem::DocManager::install_rdoc): Removed wrapping of exceptions
- with DocumentError. Most exceptions now don't propagate out of
- run_rdoc.
-
-2006-02-23 Jim Weirich <jim@weirichhouse.org>
-
- * bin/index_gem_repository.rb (MasterIndexBuilder::cleanup): Fixed
- bug where we were trying to read the index file (to compress it)
- before it was closed, often leading to a truncated index file.
-
-Tue Jan 24 16:26:13 2006 Chad Fowler <chad@chadfowler.com>
- * lib/rubygems/config_file.rb
- Luca Pireddu reported a fatal error when permissions on
- .gemrc were too restrictive. Fixed.
-
-Tue Dec 6 14:51:13 2005 Jim Weirich <jim@tardis>
-
- * lib/rubygems/source_index.rb
- (Gem::SourceIndex::load_specification): Added an untaint call to
- make the code run in SAFE=1 mode under 1.8.3.
- (Gem::SourceIndex::load_gems_in): Untaint here too.
-
- * lib/rubygems/installer.rb (Gem::Installer::install): Untaint
- here too.
- (Gem::Installer::extract_files): Untaint here too.
-
- * lib/rubygems/custom_require.rb
- (Gem::GemPathSearcher::matching_file): Untaint here too.
-
- * test/gemenvironment.rb: Added $SAFE=1 to the test environment to
- make sure we can run in $SAFE mode.
-
-2005-12-03 Jim Weirich <jim@tardis>
-
- * lib/rubygems/rubygems_version.rb (Gem): Bumped version to
- 0.8.11.6'
-
- * lib/rubygems/user_interaction.rb
- (Gem::StreamUI::SimpleProgressReporter::done): Added several new
- progress reporters.
-
- * lib/rubygems/command.rb
- (Gem::Command::specific_extra_args_hash): Added --verbose
- processing.
-
- * lib/rubygems/config_file.rb (Gem::ConfigFile::handle_arguments):
- Added --traceback as alias for --backtrace (I always get them
- confused).
- (Gem::ConfigFile::initialize): Added a verbose option.
-
-2005-11-28 Jim Weirich <jim@tardis>
-
- * lib/rubygems/remote_installer.rb
- (Gem::SourceInfoCacheEntry::replace_source_index): Fixed the
- SourceIndexCacheEntry so that it will manufacture an empty source
- index if given a nil value for the +si+ value.
-
-2005-11-08 Chad Fowler <chad@chadfowler.com>
- * lib/rubygems.rb: Ara Howard's fix to allow 0.0.0 to be a valid gem
- version.
-
-2005-11-08 Chad Fowler <chad@chadfowler.com>
- * lib/rubygems/gem_commands.rb: Fixed bug in gem unpack. It was
- sorting incorrectly, resulting in the wrong version being unpacked in
- some edge cases. Thanks to Jakob Skjerning for the detailed bug report.
-
-2005-11-03 Chad Fowler <chad@chadfowler.com>
- * lib/rubygems/installer.rb: Fixed bug that would cause the executables
- from the wrong gem to be uninstalled if the names matched the same
- regex. Thanks Eric Hodel.
-
-2005-11-01 Jim Weirich <jim@tardis>
- * lib/rubygems/gem_commands.rb (Gem::UpdateCommand::initialize):
- Upgrade => Update change.
- (Gem::UpdateCommand::execute): Upgrade => Update change.
- (Gem::UpdateCommand::execute): Upgrade => Update change.
-
-2005-11-01 Chad Fowler <chad@chadfowler.com>
- * lib/rubygems/gem_commands.rb: Allow gem unpack to accept a gem file
- path instead of gem name: gem unpack mygem-1.0.0.gem.
-
-2005-10-31 Chad Fowler <chad@chadfowler.com>
- * lib/rubygems/installer.rb: Tilman Sauerbeck's patch to support
- extensions built with Rake!
-
-2005-09-13 Jim Weirich <jim@weirichhouse.org>
-
- * lib/rubygems/package.rb (TarInput::initialize): Removed
- requirement for SSL when signatures are found in a gem. Only
- require SSL if the security policy requires checking the
- signatures.
-
- * lib/rubygems/custom_require.rb (Kernel::require): Disabled
- autorequire during custom require.
-
-2005-09-07 Jim Weirich <jim@weirichhouse.org>
-
- * lib/rubygems/gem_openssl.rb (Gem::ensure_ssl_available): Added a
- test in gem_openssl to make sure the ruby portion of ssl is also
- loaded.
-
-2005-08-31 Jim Weirich <jim@weirichhouse.org>
-
- * Rakefile (install): Changed the rake install task to use setup.rb.
-
-2005-07-08 Chad Fowler <chad@chadfowler.com>
-
- * lib/rubygems/remote_installer.rb: Applied Daniel Roux's patch
- to make RubyGems work with authenticating proxies.
-
-2005-07-08 Jim Weirich <jim@weirichhouse.org>
-
- * Preparing for release 0.8.11.
-
-2005-06-12 Jim Weirich <jim@weirichhouse.org>
-
- * lib/rubygems/installer.rb
- (Gem::Installer::installation_satisfies_dependency): Refactored
- dependency check into ensure_dependency! and
- installation_satisfies_dependency?.
-
-2005-06-12 Chad Fowler <chad@chadfowler.com>
- * lib/rubygems.rb,lib/rubygems/installer.rb: Applied Mark Hubbart's
- * lib/rubygems/remote_installer.rb: Applied David Glasser's install-
- * Applied Paul Duncan's incredibly complete gem signing patch.
- Thanks, Paul!
- * lib/rubygems/installer.rb: Fixed bug in installer that caused
- dependency installation not to work.
-
-2005-06-06 Chad Fowler <chad@chadfowler.com>
- * lib/rubygems/specification.rb: Fixed Erik hatcher's reported bug
- of gem directories having "-" at the end of their names (e.g.
- "BlueCloth-1.0.0-".
-
-2005-06-01 Jim Weirich <jim@weirichhouse.org>
-
- * scripts/specdoc.rb (_resolve_links): Updated to generate hieraki
- format so it can be included in the docs.rubygems.org site.
-
- * test/test_specification.rb (TestSpecification::test_to_ruby):
- Fixed test on date that hard-coded a specific date.
-
-2005-05-29 Jim Weirich <jim@weirichhouse.org>
-
- * Changes from the Seattle Code fest: (1) Package list command
- (e.g. gem inspect GEM). (2) .gemrc settings now allow cvsrc like
- options to set defaults per subcommand. (3) The autorequire spec
- attribute will now accept a list. (4) Binwrappers vs symlinks
- (more info to follow). (5) Substituted Time for Date in specs,
- increasing performance dramatically in an important area.
-
-2005-05-04 Jim Weirich <jim@weirichhouse.org>
-
- * lib/rubygems.rb (Gem::Exception::find_home): Changed rescue
- clause from Exception to StandardError. Exception doesn't seem to
- catch everything ... I'm not sure I understand why.
-
-2005-04-29 Chad Fowler <chad@chadfowler.com>
- * lib/rubygems/specifiation.rb: Marcel Molina's patch to discover
- which attributes in the spec are Array attributes.
-
-2005-04-27 Chad Fowler <chad@chadfowler.com>
- * lib/rubygems/gem_commands.rb: -y is now a synonym for
- --include-dependencies
-
-2005-04-21 Chad Fowler <chad@chadfowler.com>
- * lib/rubygems/installer.rb: Added non-require_gem dependency check
- for installation.
-
-2005-04-03 Chad Fowler <chad@chadfowler.com>
-
- * pre-install.rb: Added version check to RubyGems installation.
-
-2005-03-25 Jim Weirich <jim@weirichhouse.org>
-
- * lib/rubygems/rubygems_version.rb (Gem): Created release for
- 0.8.10.
-
- * lib/rubygems/gem_commands.rb
- (Gem::UpdateCommand::do_rubygems_update): Update --system now runs
- the ruby command directly rather than trying to load the
- update-rubygems command. There were too many things to go wrong
- with the old way.
-
-2005-03-24 Jim Weirich <jim@weirichhouse.org>
-
- * lib/rubygems/remote_installer.rb
- (Gem::RemoteInstaller::find_dependencies_not_installed): Fixed to
- reload source index before attempting to detect dependencies.
-
-2005-03-23 Jim Weirich <jim@weirichhouse.org>
-
- * lib/rubygems/remote_installer.rb
- (Gem::RemoteInstaller::find_dependencies_not_installed): Switched
- to using SourceIndex#find_name to detect missing dependencies,
- avoiding a gem activation during an install.
-
- * lib/rubygems/installer.rb (Gem::Installer::install): Removed
- activate call from install step. If we need to do something about
- dependencies at this time, then we need a better way to do them.
-
- * lib/rubygems.rb: Removed the require for rubygems/timer.
-
-2005-03-16 Jim Weirich <jim@weirichhouse.org>
-
- * test/gemenvironment.rb (TestEnvironment::create): Added require
- on gem/builder.
-
- * lib/rubygems/source_index.rb (Gem::SourceIndex::initialize):
- Allowing default argument to new to be an empty hash.
- (Gem::SourceIndex::from_installed_gems): Refactored into a class
- method that invokes a instance method.
- (Gem::SourceIndex::refresh): Refresh now does a complete reload
- from disk. This should be more accurate that the earlier version.
-
- * lib/rubygems/installer.rb (Gem::Uninstaller::uninstall): removed
- unneeded refresh!.
-
- * lib/rubygems.rb (Gem::Exception::source_index): Removed
- automatic refresh from Gem.source_index ... it wasn't reliable
- when removing installed gems.
- (Gem::Exception::activate): Added detection of previously loaded
- gems.
-
-2005-03-15 Chad Fowler <chad@chadfowler.com>
-
- * bin/gem_server: (htonl) rdoc opens in existing browser window.
-
-2005-03-14 Jim Weirich <jim@weirichhouse.org>
-
- * Released 0.8.8
-
-2005-03-14 Jim Weirich <jim@weirichhouse.org>
-
- * Released 0.8.7
-
-2005-03-13 Gavin Sinclair <gsinclair@soyabean.com.au>
-
- * lib/rubygems/installer.rb (Gem::Installer#shebang): Refactored and
- stripped result to avoid ^M issues.
-
-2005-03-11 Jim Weirich <jim@weirichhouse.org>
-
- * lib/rubygems/gem_commands.rb (Gem::DependencyCommand): Added a
- new command "gem dependency" to show the dependencies of an
- installed gem.
-
- * lib/rubygems/cmd_manager.rb (Gem::CommandManager::initialize):
- Added DependencyCommand to the command manager registrar.
-
- * lib/rubygems/version.rb (Gem::Requirement): Unnested Requirement
- from the Version class. There was no benefit to having it nested.
- Gem::Version::Requirement is set to point to the new class so to
- be compatible with old gems.
-
- * lib/rubygems/installer.rb (Gem::Uninstaller::ask_if_ok): Changed
- uninstaller confirm message to read 'Continue with uninstall'.
- Its clearer that way.
-
- * lib/rubygems.rb (Gem::Exception::required_location): Switch to
- use SourceIndex#find_name rather than search. Made sure a nil
- value is returned with a path is not found.
-
- * lib/rubygems/source_index.rb (Gem::SourceIndex::search): Changed
- parameter name to gem_pattern to emphasize using Regex in search.
- (Gem::SourceIndex::find_name): Added find_name to handle the
- common case of searching for an exact match on the short name.
-
- * lib/rubygems.rb (Gem::Exception::activate): Make sure that
- activate more closely adheres to honoring the auto_require=>false
- request.
- (Gem::Exception::report_activate_error): Out of line error
- reporting for activate.
-
- * lib/rubygems/remote_installer.rb
- (Gem::RemoteInstaller::find_dependencies_not_installed): Found
- another location that was using require_gem with auto_require.
- Fixed to use :auto_require=>false.
-
- * lib/rubygems/gem_commands.rb
- (Gem::InstallUpdateOptions::add_install_update_options): Added
- --ignore-dependencies option. Still needs to be wired to logic.
-
- * lib/rubygems/installer.rb (Gem::Installer::install): Added call
- to require_gem_with_options.
-
- * lib/rubygems.rb (Kernel::require_gem_with_options): Added to
- allow easier specification of the autorequire flag for
- Gem.activate.
-
-2005-03-10 Jim Weirich <jim@weirichhouse.org>
-
- * lib/rubygems/remote_installer.rb
- (Gem::RemoteSourceFetcher::normalize_uri): Normialize a URI to
- start with http:// if it does not already.
-
- * test/test_deployment.rb (TestDeployment::xtest_deploy_sources):
- Disabled this test. It is part of the new deployment software and
- is not working yet.
-
-2005-03-09 Jim Weirich <jim@weirichhouse.org>
-
- * lib/gemconfigure.rb (Gem::self): Added to aid dynamic
- versioning.
-
- * lib/rubygems/command.rb (Gem::Command::command_manager): Moved
- command_manager to base class.
-
- * lib/rubygems/gem_commands.rb (Gem::CleanupCommand::execute):
- Both implicit and explicit gems now work with cleanup.
-
-2005-03-08 Jim Weirich <jim@weirichhouse.org>
-
- * lib/rubygems/installer.rb (Gem::Uninstaller::ok_to_remove):
- Fixed source index to be loaded from the installed gems when doing
- an "OK TO REMOVE" dependency check.
-
-2005-03-06 Rich Kilmer <rich@infoether.com>
- * lib/rubygems/deployment.rb: beginning of a deployment capability
-
- * test/test_deployment.rb: first tests of new deployment system
-
-2005-03-04 Chad Fowler <chad@chadfowler.com>
- * lib/rubygems/gem_commands.rb: Small bugfix for the case when you
- pass in a gem name (or more) to cleanup for the cleanup command.
-
-2005-03-04 Jim Weirich <jim@weirichhouse.org>
-
- * lib/rubygems/installer.rb (Gem::Uninstaller::ok_to_remove):
- Reworked logic in uninstall to be intelligent about dependencies.
- We only complain about dependencies if removing a gem will cause a
- dependency error. The uninstaller now checks for :ignore, :all
- and :executables options.
-
- * lib/rubygems/cmd_manager.rb (Gem::CommandManager::initialize):
- Registered Cleanup command.
-
- * lib/rubygems/gem_commands.rb (Gem::CleanupCommand): Added
- Cleanup command to gem.
- (Gem::UninstallCommand::initialize): Added --all, --ignore and
- --executables options to uninstall. This helps to avoid excessive
- YESes all the time.
-
-2005-02-28 Jim Weirich <jim@weirichhouse.org>
-
- * lib/rubygems/remote_installer.rb
- (Gem::LocalSourceInfoCache::write_cache): Open cache file in
- binary mode.
-
-2005-02-28 Chad Fowler <chad@chadfowler.com>
- * lib/rubygems/config_file.rb: don't warn about not being able to
- find config file.
- * lib/rubygems/doc_manager.rb: (for DHH) don't install rdoc docs for
- * lib/rubygems/gem_commands.rb: Print which gems are updated on 'gem
- update'. If --system is used, report that the rubygems system
- software has been updated.
- * lib/rubygems/installer.rb: Cleaned up the uninstall has_dependents
- logic and output. It was misleading and buggy before.
-
-2005-02-27 Jim Weirich <jim@weirichhouse.org>
-
- * lib/rubygems/config_file.rb
- (Gem::ConfigFile::default_config_file_name): Fixed bug in finding
- home directory for the .gemrc file.
-
-2005-02-27 Chad Fowler <chad@chadfowler.com>
-
- * Released 0.8.6
-
- * Fixed a small bug with shebang construction
-
-2005-02-26 Jim Weirich <jim@weirichhouse.org>
-
- * Released 0.8.5
-
- * lib/rubygems/doc_manager.rb (Gem::DocManager::generate_rdoc):
- Removed warning about generating rdocs on gems w/o an rdoc flag.
-
- * lib/rubygems/gem_commands.rb
- (Gem::UpdateCommand::do_rubygems_update): Added --system option to
- update to specifically update the version of rubygems.
- (Gem::UpdateCommand::which_to_update): Fixed some refactoring bugs
- in the which_to_update method.
-
- * lib/rubygems/remote_installer.rb
- (Gem::LocalSourceInfoCache::read_cache): switched to Marshal
- rather than Yaml for local cache.
-
- * bin/gem: Added requirement for Ruby >= 1.8.0.
-
-2005-02-10 Chad Fowler <chad@chadfowler.com>
- * bin/gem_server: Added Martin Ankerl's wonderful new gem_server
- template
-
-2005-01-27 Chad Fowler <chad@chadfowler.com>
- * lib/rubygems/gem_commands.rb: Fixed
- `gem update` so it accepts a list of gems to update and _only_
- updates those.
- * lib/rubygems/installer.rb: Fixed a bug in the new shebang code.
- * lib/rubygems/remote_installer.rb: Attempt to fix Curt Hibbs'
- reported Proxy bug without actually having a proxy to test with.
-
-2005-01-22 Chad Fowler <chad@chadfowler.com>
- * lib/rubygems/custom_require.rb: Lyle Johnson's fix for Bug #1379
-
-2005-01-20 Chad Fowler <chad@chadfowler.com>
- * lib/rubygems/validator.rb: Applied Austin Ziegler/Kasper Schiess's
- patch to fix unit test running bug.
-
-2005-01-14 Chad Fowler <chad@chadfowler.com>
- * lib/rubygems/installer.rb: attempt at fixing Ryan Davis's
- reported Shebang bug. STILL NOT WORKING, because it doesn't work
- with ^M characters.
- * lib/rubygems/config_file.rb: small but ugly error fixed if no
- config file exists.
- * lib/rubygems/remote_installer.rb: Fixed bug http://rubyforge.org/tracker/index.php?func=detail&aid=1331&group_id=126&atid=575.
-
-2005-01-01 Chad Fowler <chad@chadfowler.com>
- * Released 0.8.4
-
-2004-12-31 Jim Weirich <jim@weirichhouse.org>
-
- * Rakefile: Switch to standard Rake test tasks.
-
- * lib/rubygems/remote_installer.rb
- (Gem::RemoteSourceFetcher::read_data): Added a retry to try a
- lower case gem name if the open failed. This fixes a problem
- where case differences are preventing some gems from installing.
-
-2004-12-29 Jim Weirich <jim@weirichhouse.org>
-
- * lib/rubygems/gem_commands.rb (Gem::InstallCommand::execute):
- Changed the RemoteInstaller to take an options hash rather than
- individual options. This will leave the interface more resilient
- to changes as more options are added
- (e.g. --install_dependencies).
-
- * lib/rubygems/specification.rb (Gem::Specification): Marked array
- attributes explicitly. This allows for explicit conversion to
- arrays when assigned.
-
- * test/test_specification.rb
- (TestSimpleSpecification::test_array_attributes): Added test for
- array_attributes forcing values to arrays.
-
-2004-12-28 Jim Weirich <jim@tardis>
-
- * lib/rubygems.rb (Gem::Exception::ensure_gem_subdirectories):
- Fixed the Ryan Davis patch to work correctly when directories are
- not writable.
-
-2004-12-18 Chad Fowler <chad@chadfowler.com>
- * lib/rubygems/version.rb: Erik Veenstra's sort patch.
- * lib/rubygems.rb: Ryan Davis's installation bug fix.
-
-2004-12-14 Gavin Sinclair <gsinclair@soyabean.com.au>
-
- * test/test_loadmanager.rb: invalidated it as a unit test; it's
- incompatible with custom_require.rb.
-
-2004-12-12 Gavin Sinclair <gsinclair@soyabean.com.au>
-
- * lib/rubygems/custom_require.rb: simple bug fix.
-
-2004-12-12 Gavin Sinclair <gsinclair@soyabean.com.au>
-
- * lib/rubygems/custom_require.rb: new file to replace
- loadpath_manager.rb and speed up the custom require functionality.
-
- * lib/rubygems/timer.rb: new file; simple benchmarking tool that's
- useful at the moment but needn't stay in RubyGems permanently.
-
- * lib/rubygems/source_index.rb: include Enumerable and implement #size
- and #length.
-
- * lib/rubygems/specification.rb: removed lazy initialisation of
- attributes to reduce #copy_of invocations; folded
- Specification.copy_of into Specification#copy_of.
-
- * lib/rubygems.rb: require 'rubygems/custom_require' instead of
- 'rubygems/loadpath_manager'; removed out of date documentation; added
- "require 'rubygems/timer'" to temporarily assist with benchmarks.
-
-2004-12-07 Jim Weirich <jim@weirichhouse.org>
-
- * Released 0.8.3
-
-2004-12-06 Jim Weirich <jim@weirichhouse.org>
-
- * test/test_specification.rb
- (TestLegacyYamlSpecification::test_load): Fixed test to avoid the
- __FILE__ stuff. Running tests from rakefile guarantees that the
- file paths start from the right location.
-
- * pkgs/sources/sources.gemspec: Made Gem.sources_spec idempotent.
-
- * lib/rubygems/specification.rb (Gem::Specification::initialize):
- Added @@gather to Gem::Specification to facilitate proper loads.
- (Gem::Specification::Specification): Added Specification.load.
-
- * lib/rubygems/source_index.rb (Gem::SourceIndex): Fixed comments
- 'long name' => 'full name'.
-
- * lib/rubygems/gem_commands.rb (Gem::BuildCommand::load_gemspecs):
- Changed to use Gem.Specification.load.
-
- * Rakefile: Added sources-*.gem to clobber list.
- (egrep): Upgraded the DBG finder to include breakpoint.
-
- * post-install.rb (install_sources): Using block version of chdir.
-
- * lib/rubygems/remote_installer.rb
- (Gem::LocalSourceInfoCache::read_cache): Fixed initialization of
- cache.
-
- * lib/rubygems.rb: Updated version to 0.8.2.
-
-2004-12-04 Jim Weirich <jim@weirichhouse.org>
-
- * lib/rubygems/remote_installer.rb
- (Gem::LocalSourceInfoCache::writable_file): Now just returns the
- selected cache file (which was selected based on writability).
- (Gem::LocalSourceInfoCache::try_file): Added try_file to determine
- if a file is a candidate for a cache file.
- (Gem::LocalSourceInfoCache::select_cache_file): Added failure if
- there are not valid cache file candidates.
-
- * lib/rubygems.rb (Gem::Exception): Renamed @@cache to
- @@source_index.
- (Gem::Exception::source_index): Renamed Gem.cache to
- Gem.source_index (but left cache as an alias).
-
-2004-12-03 Jim Weirich <jim@weirichhouse.org>
-
- * lib/rubygems/remote_installer.rb (Gem::LocalSourceInfoCache):
- Added a local cache manager object to implement the read/write
- policies on the system and user cache files.
- (Gem::LocalSourceInfoCache::update): Added update and flush to the
- caching fetcher so that it knows when it needs to update the local
- cache files.
- (Gem::RemoteInstaller::initialize): Switched to using a cached
- fetcher in the remote installer. All the caching logic was
- removed from the installer. User writable cache files are now
- supported.
- (Gem::RemoteInstaller::write_gem_to_file): write_gem_to_file now
- will create the path if needed.
-
-2004-12-02 Jim Weirich <jim@weirichhouse.org>
-
- * lib/rubygems/package.rb (TarInput::zipped_stream): To workaround
- a problem with earlier than 1.2.1, we read the zipped data into a
- string, and then return an IO object on that string.
- (TarInput::each): Refactored getting a stream to the zipped data
- into <tt>zipped_stream</tt>.
-
-2004-12-01 Jim Weirich <jim@weirichhouse.org>
-
- * lib/rubygems/remote_installer.rb
- (Gem::RemoteSourceFetcher::convert_spec): We now proprocess the
- yaml string data to reduce it in size. This was done to
- workaround a problem with large YAML files (although it is just a
- temporary fix because our yaml data keeps growing and growing).
-
- * Rakefile: Added more targets to the clobber target.
-
- * test/test_remote_fetcher.rb
- (TestRemoteFetcher::test_explicit_proxy): Added tests for proxy
- support.
-
- * lib/rubygems/remote_installer.rb
- (Gem::RemoteSourceFetcher::connect_to): Refactored to add proxy
- support.
-
-2004-11-28 Chad Fowler <chad@chadfowler.com>
- * lib/rubygems/loadpath_manager.rb: Added Mauricio's patch to work
- around string contains null byte issue.
-
-2004-11-27 Jim Weirich <jim@weirichhouse.org>
-
- * lib/rubygems/remote_installer.rb
- (Gem::RemoteSourceFetcher::get_size): Switched from open-uri with
- early abort to an HTTP.head call to get the size of the yaml file
- on the server.
-
-2004-11-26 Jim Weirich <jim@weirichhouse.org>
-
- * test/test_specification.rb
- (TestDefaultSpecification::test_defaults): Added test for some
- basic defaults in a gem spec.
-
- * test/test_remote_installer.rb (MockFetcher::source_info): Made
- the fake test data more realistic.
- (TestRemoteInstaller::test_source_info): Improved tests.
-
-2004-11-26 Jim Weirich <jim@tardis>
-
- * test/test_remote_installer.rb (MockFetcher): Added MockFetcher
- to make testing the remote installer easier. Currently there are
- two remote installer test classes. Eventually TestRemoteInstaller
- will succeed RemoteInstallerTest, which is very incomplete.
-
- * test/test_package.rb (TC_TarReader::TC_TarInput): Made the unit
- test ignore the setgid bit. The setgid bit doesn't work on my
- laptop for some reason. This may be a problem with my laptop
- rather than with this code. Should investigate further.
-
- * lib/rubygems/remote_installer.rb (Gem::RemoteSourceFetcher):
- Added a Fetcher object to the remote installer to handle all the
- details of getting the remote information. This allows testing
- the logic of the remote installer without actually doing remote
- calls.
- (Gem::RemoteInstaller::sources): Renamed get_caches to
- source_info. The problem is that cache is too generic and there
- are actually several things that we will cache in the system.
-
- * lib/rubygems/cache.rb (Gem::Cache::self): Changed interface to
- from_installed_gems slightly.
- (Gem::Cache::self): Reordered rescue clauses so that the syntax
- exception might actually be handled.
-
- * lib/rubygems.rb (Gem::Exception::ensure_gem_subdirectories):
- Dumped the check_gem_subdirectories method to use the almost
- identical ensure_gem_subdirectories method.
- (Gem::Exception::ensure_gem_subdirectories): Only attempt to
- create the gem subdirectories if we can actually write them.
-
- * bin/gem_server: Added date of last file modification to header
- of /yaml. This is in preparation for using a head command with
- date/time stamping in fetching the source cache.
-
-2004-11-25 Ryan Davis <ryand@zenspider.com>
- * lib/rubygems.rb: Added GEM_SKIP functionality, which will tell
- loadpath_manager not to load specific libs from gems. For
- testing/ development purposes. Created by Ryan Davis.
-
-2004-11-24 Chad Fowler <chad@chadfowler.com>
- * lib/rubygems/specification.rb: Allow multiple authors per gem.
- * lib/rubygems/gem_commands.rb: command line error message if you
- run 'gem install' with no args.
- * lib/rubygems/loadpath_manager.rb: Fixed @specs bug as reported by
- Lothar Schulz on ruby-talk.
-
-2004-11-07 Chad Fowler <chad@chadfowler.com>
- * lib/rubygems.rb,lib/rubygems/installer.rb,lib/rubygems/cache.rb
- lib/rubygems/remote_installer.rb,lib/rubygems/gem_commands.rb:
- Fixes to make non-root installation work properly. Still need to
- fix uninstallation.
- * lib/rubygems/gem_commands.rb: Allow multiple gems/gem names on the
- command line for install.
-
-2004-10-31 Chad Fowler <chad@chadfowler.com>
- * lib/rubygems/version.rb,test/test_version_comparison.rb: Patrick May's
- * post-install.rb: Patrick May's fix for rubygems lib not being found
- during install.
-
-2004-10-29 Chad Fowler <chad@chadfowler.com>
- * packages/,pkgs,install.rb: renamed "packages" to "pkgs" to avoid
- * remote_installer.rb: Added user-agent reporting for remote
- operations
- * setup.rb,install.rb,bin/update_rubygems: removed install.rb and
- added setup.rb and post-install.rb. Changed update_rubygems so that
- params passed to it can be passed on to setup.rb
-
-2004-10-25 Jim Weirich <jim@weirichhouse.org>
-
- * lib/rubygems/installer.rb
- (Gem::Uninstaller::remove_executables): Corrected spelling of
- "addtion".
-
-2004-10-24 Jim Weirich <jim@weirichhouse.org>
-
- * lib/rubygems/version.rb (Gem::Version::Requirement::self): Now
- properly handles arrays of version constraints.
-
- * lib/rubygems/loadpath_manager.rb
- (Gem::LoadPathManager::Gem::Specification): Added comments
- describing the fast Spec class purpose. Added to_s to
- Gem::Specification (both fast and slow versions).
- (Gem::LoadPathManager.paths): Returns (cached) list of gem paths.
- (Gem::LoadPathManager::self): Refactored to use glob_over in
- search_loadpaths and search_gempaths.
-
- * lib/rubygems/installer.rb: Added some requires.
-
- * lib/rubygems/cache.rb (Gem::Cache::refresh): Fixed refresh! to
- call load_specification on the Cache class, not on itself.
-
- * lib/rubygems.rb (Gem::Exception::activate): added comments to
- activate. Also made sure that partial name matches in the gem
- cache search were avoided.
- (Gem::Exception::clear_paths): Added code to clear the gem cache
- when reseting the gem paths.
- (Gem::Exception::require): Added a function to take a gem name and
- a library file name (in that gem) and return a path to the library
- in the gem. David HH was interested in this in order to speed up
- some require statements under ModRuby. Eventually I hope we won't
- need these special tricks.
- (Gem::Exception::latest_partials): Fixed bug that assumed exactly
- three digits in a version number.
-
- * Rakefile (egrep): Added two tasks to find all the FIXME/TODO
- markers in the source code comments and to find the DBG print
- lines.
-
-2004-10-23 Jim Weirich <jim@weirichhouse.org>
-
- * test/test_specification.rb
- (TestSimpleSpecification::test_add_bindir_to_list_of_files):
- Verify that an executable doesn't need the bindir if bindir is
- set.
- (TestSimpleSpecification::test_no_bindir_in_list_of_files): Added
- test the verify that exectuable can be written without a default
- binder.
-
- * lib/rubygems/installer.rb
- (Gem::Installer::generate_bin_scripts): Added check so that the
- bindir is access only when there are actually executables to
- install. Checking for an installable bindir was giving permission
- errors when installing test gems.
-
-2004-10-21 Chad Fowler <chad@chadfowler.com>
- * lib/rubygems/installer.rb: Show extension build errors during install
- in addition to logging them to gem_make.out
-
-2004-10-02 Chad Fowler <chad@chadfowler.com>
-
- * lib/rubygems/validator.rb,lib/rubygems/gem_commands.rb: Added
- --test option for "gem check" that runs unit tests on already-
- installed gems.
-
-2004-09-30 Rich Kilmer <rich@infoether.com>
-
- * lib/rubygems/specification.rb - externalized the loaded_from runtime
- var on specification
- * lib/rubygems/cache.rb - optimized cache refresh! method and refactored
- processing of files when building cache.
- * lib/rubygems/loadpath_manager.rb - fixed bug in loadpath manager in
- finding native extensions that have ext on os x, win32 and solaris
-
-2004-09-20 Chad Fowler <chad@chadfowler.com>
- * lib/rubygems/gem_commands.rb: If file match during local install is
- a directory, don't try to treat it erroneously as a gem (bug reported
- by Rich).
- * lib/rubygems.rb: Fixed small bug in #latest_load_paths
-
- (NOTE: It looks like 0.8.0/0.8.1 was released in this timeframe)
-
-2004-09-14 Chad Fowler <chad@chadfowler.com>
- * lib/rubygems.rb: Fixed bug in require_gem (thanks Jamis Buck!)
- that would require a gem based on an inexact search of its name
- in the local cache. This caused copland-webrick to be loaded
- when a request was made for "copland".
-
-2004-09-12 Chad Fowler <chad@chadfowler.com>
- * lib/rubygems/specification.rb, test/test_specification.rb: Removed
- library_stubs attribute.
-
-2004-09-12 Gavin Sinclair <gsinclair@soyabean.com.au>
-
- * scripts/specdoc.rb: Check that all attributes are documented; and
- improved formatting.
- * scripts/specdoc.yaml: test_suite_file -> test_files; finished
- documentation.
- * scripts/specdoc.data: misc changes.
-
-2004-09-11 Chad Fowler <chad@chadfowler.com>
-
- * test/test_parse_commands.rb: Fix failing unit tests due to Rich's fix from
-
- * lib/rubygems/specification.rb: Add bindir to executable path on file list
-
-2004-09-11 Rich Kilmer <rich@infoether.com>
-
- * lib/rubygems/gem_commands.rb - got rid of stub options
-
- * lib/rubygems/install.rb - changed output of messages so the UI would format
- better
-
- * bin/gem_server - exit! from ^c
-
-2004-09-09 Chad Fowler <chad@chadfowler.com>
- * lib/rubygems/loadpath_manager.rb: Small bug when gem specs have ruby
- version requirements.
- * lib/rubygems/specification.rb, lib/rubygems/gem_commands.rb: Fixed failing
- functional test.
-
-2004-09-08 Chad Fowler <chad@chadfowler.com>
- * install.rb: added stub removal to the install process
-
-2004-09-06 Chad Fowler <chad@chadfowler.com>
- * test/test_package.rb: Fixed failing unit test as per Mauricio's email to
- the rubygems list.
- * Fixed minor issues with Windows cmd file generation.
-
-2004-09-06 Rich Kilmer <rich@infoether.com>
- * lib/rubygems/remote_installer.rb - enabled caching of source caches
- based on the size of the yaml.Z/yaml file.
-
-2004-08-29 Chad Fowler <chad@chadfowler.com>
- * /lib/rubygems/gem_command.rb: small big fix for local gem installs
- on Windows.
-
-2004-08-28 Rich Kilmer <rich@infoether.com>
-
- * /lib/rubygems/installer.rb, /lib/rubygems/doc_manager.rb,
- /lib/rubygems/cmd_manager.rb - Added an exception: FilePermissionError
- which checks to ensure write access to the install/uninstall/rdoc
- destination directories and raises a nice error instead of the standard
- one.
-
-2004-08-28 Rich Kilmer <rich@infoether.com>
-
- * /lib/rubygems/installer.rb - commented out stub addition and removal
-
-2004-08-28 Rich Kilmer <rich@infoether.com>
-
- * /lib/rubygems.rb, /lib/rubygems/loadpath_manager.rb -
- this adds all the loadpath_manager stuff with the 'ultimate require hack' to
- rubygems.rb. Also, require_gem methods body has been extracted into a method
- Gem.activate that differs in the calling signature in that the second param is
- a boolean that determines whether to autorequire or not.
-
-2004-08-27 Rich Kilmer <rich@infoether.com>
-
- * lib/rubygems/user_interaction - added ask_yes_no as a method
- which returns true/false and formats/processes the [yn] stuff.
- it also has an optional second parameter of true/false for the
- default value.
-
- * lib/rubygems/installer.rb, lib/rubygems/remote_installer.rb,
- lib/rubygems/command_manager.rb - changed all places where ask
- was used with [Yn] to ask_yes_no
-
-2004-08-24 Gavin Sinclair <gsinclair@soyabean.com.au>
-
- * lib/rubygems/installer.rb: Library stubs are now installed as per
- 'library_stubs' gemspec attribute. A stub is (still) also installed
- for the 'autorequire' attribute. All library stub handling
- refactored into two new classes: LibraryStubs and LibraryStub.
-
- * test/test_parse_commands.rb: as per 2004-08-17 below, the 'update'
- command takes --rdoc as its default now.
-
-2004-08-22 Rich Kilmer <rich@infoether.com>
- * lib/rubygems/installer.rb: fixed stub generation...i added the version
- stuff that only app stubs should have...sorry!
-
-2004-08-17 Gavin Sinclair <gsinclair@soyabean.com.au>
-
- * lib/rubygems/gem_commands.rb: --rdoc is default on 'update' command,
- consistent with 'install'. 'default_str' methods changed to reflect
- --rdoc being default now.
-
-2004-08-21 Chad Fowler <chad@chadfowler.com>
- * lib/rubygems/gem_commands.rb: Proper checking for gems in local
- directory on local install. rescue Gem::LoadError to avoid ugly
- backtrace.
- * lib/rubygems/installer.rb: created Gem::LoadError to hold extra
- metadata. Setting up for proper dependency installation on local
- installs.
-
-2004-08-20 Chad Fowler <chad@chadfowler.com>
-
- * lib/rubygems/specification.rb: Fixed small bug in the previous spec
- change commit.
-
- * lib/rubygems/cache.rb: Prevent catastrophic failure if a gemspec is
- corrupted.
-
- * lib/rubygems/installer.rb: Fixed (in not a great way) a bug that would
- cause a zero-length spec file to be written to the gem specifications
- directory.
-
-2004-08-19 Chad Fowler <chad@chadfowler.com>
-
- * lib/rubygems/specification.rb: #files auto-includes any #extensions,
- #extra_rdoc_files, #test_files, etc. that weren't explicitly added
- to the file list.
-
-2004-08-18 Chad Fowler <chad@chadfowler.com>
-
- * lib/rubygems/specification.rb: One more bug with #test_files.
- Default value of [] wasn't set, resulting in an attempt to call
- #empty? on nil.
-
- * lib/rubygems/gem_commands.rb: Unit tests appear to be working now.
- Still more testing to do.
-
- * lib/rubygems/remote_installer.rb, lib/rubygems/installer.rb: Fixed
- minor bugs in default selections for questions asked during
- installation and uninstallation
-
-2004-08-17 Gavin Sinclair <gsinclair@soyabean.com.au>
-
- * lib/rubygems/specification.rb:
- - #test_suite_file and #test_files now work on older gems.
- - Added Specification.from_yaml for loading YAML gemspecs
- - #to_ruby doesn't emit 'specification_version'
-
- * lib/rubygems/gem_commands.rb: Updated test-on-install code to use
- Specification#test_files instead of #unit_test_suite.
-
- * lib/rubygems/old_format.rb: Use Specification.from_yaml
- * lib/rubygems/package.rb: Ditto
-
-2004-08-17 Gavin Sinclair <gsinclair@soyabean.com.au>
-
- * lib/rubygems/command.rb: --debug option to turn on $DEBUG
- * lib/rubygems/config_file.rb: ditto
-
-2004-08-11 Rich Kilmer <rich@infoether.com>
- * lib/rubygems/installer.rb: The application stub now defaults to
- the latest version of the library, and optionally allows an initial
- parameter conforming to _VERSION_ to be passed to select a prior
- version of the library (this initial parameter, if present, is shifted
- off of ARGV). This change was re-added...I erased it somehow :(
-
-2004-08-11 Gavin Sinclair <gsinclair@soyabean.com.au>
-
- * lib/rubygems/gem_commands.rb:
- - 'gem spec X' displays spec for _latest_ version of X. Added
- '--all' option if you want to see all versions.
- - RDocCommand code cleanup and slight change: document _all_
- versions of the gem by default, not just the first.
-
- * lib/rubygems/doc_manager.rb: removed 'kilmer' default template
- option and obsolete error message.
-
-2004-08-12 Chad Fowler <chad@chadfowler.com>
- * Added "gem rdoc" command for generating docs for already-installed
- gems
-
-2004-08-11 Rich Kilmer <rich@infoether.com>
- * bin/generate_yaml_index: updated to work with new gem format (and use the Gem::Format
- class to read). Will deploy after testing on RubyForge.
- * lib/rubygems/gem_commands.rb: generate rdoc by default on installs (I think this is
- just good practice.
- * lib/rubygems/remote_install.rb: raise an exception if dependent gems cannot be found
- on remote_install
-
-2004-08-11 Chad Fowler <chad@chadfowler.com>
- * lib/rubygems/gem_commands.rb: query is now case insensitive (as it used to be)
- * lib/rubygems/installer.rb: gem_make.out wasn't being written when an extension failed to compile.
-
-2004-08-11 Rich Kilmer <rich@infoether.com>
-
- * removed String.to_requirement...we should not modify
- base classes in Ruby! modified to get rid of said to_requirement
- with Gem::Version::Requirement.create(obj)
-
- * specification.rb - fixed constructor bug of version requirement...
- it now defaults to Requirement.default
-
-2004-08-11 Chad Fowler <chad@chadfowler.com>
-
- * One more specification.rb bug fixed.
-
-2004-08-11 Gavin Sinclair <gsinclair@soyabean.com.au>
-
- * lib/rubygems/specification.rb:
- - Added convenience class methods: attribute_names,
- attribute_defaults, default_value, required_attributes, and
- required_attribute?.
-
- - IMPORTANT: attribute readers now use lazy initialization, just
- like some of them did before the 2004-08-01 change. This was done
- to fix the breakage when loading older gemspecs.
-
- - IMPORTANT: replaced instance variable access with attribute reader
- method calls in many cases. This is in line with the above change.
-
- - Good documentation for the "attribute" method.
-
- - Renamed _copy -> _copy_of.
-
- * lib/rubygems/cache.rb:
- - Some fairly shallow changes. Exception handling needs improvement.
-
- * lib/rubygems/version.rb:
- - (Version.create) new method (for convenience)
- - (Version::Requirement.create) new method (for convenience)
- - (Version::Requirement.default) new method (for consistency)
-
- * test/test_specification.rb: test attribute_names instead of
- attributes. Other "class convenience" methods remain to be tested
- at this stage. Also added test classes for legacy gemspecs.
-
- * test/data/legacy/keyedlist-0.4.0.ruby: added.
- * test/data/legacy/keyedlist-0.4.0.yaml: added.
-
-2004-08-06 Gavin Sinclair <gsinclair@soyabean.com.au>
-
- * lib/rubygems/specification.rb:
- - Added convenience class methods: attribute_names,
- attribute_defaults, default_value, required_attributes, and
- required_attribute?.
-
- - IMPORTANT: attribute readers now use lazy initialization, just
- like some of them did before the 2004-08-01 change. This was done
- to fix the breakage when loading older gemspecs.
-
- - Good documentation for the "attribute" method.
-
- - Renamed _copy -> _copy_of.
-
- * test/test_specification.rb: test attribute_names instead of
- attributes. Other "class convenience" methods remain to be tested
- at this stage.
-
-2004-08-01 Gavin Sinclair <gsinclair@soyabean.com.au>
-
- * lib/rubygems/specification.rb:
- - (Re)defined class methods: attribute, attributes,
- required_attribute, read_only, overwrite_accessor. @@attributes
- contains a list of attribute names and default values. This
- allows higher-level specification of gemspec attributes, and the
- handling of them in a DRY fashion.
-
- - to_yaml_properties now includes all properties, to ensure
- correct deserialization of a Gem::Specification object.
-
- - #to_ruby and #to_yaml_properties rewritten to use @@attributes
-
- - Introduced 'specification_version' attribute and three constants:
- NONEXISTENT_SPECIFICATION_VERSION, CURRENT_SPECIFICATION_VERSION, and
- SPECIFICATION_VERSION_HISTORY. This allows us to track changes to
- the spec format.
-
- - Refactored several "helper" methods, using the new class method
- 'attribute_alias_singular', which provides a "singular" alias for
- a "plural" attribute (e.g. require_path and require_paths).
-
- - All gemspec attributes now defined in a uniform fashion, which
- implies that they all have valid instance variables on
- initialization. Previously, some attributes were lazily
- initialized.
-
- - Introduced attribute 'library_stubs', to allow the specification
- of several stub files. (That feature not implemented, though.)
-
- - Introduced attribute 'test_files' and deprecated 'test_suite_file'.
-
- - Provided #warn_deprecated stub of a method, but don't know what to
- do with it.
-
- - Deprecated #has_test_suite? in favour of (new) #has_unit_tests?
-
- - Used overwrite_accessor to provide special behaviour for the
- setting of some attributes.
-
- - The 'date' attribute is now a Date object. We don't need high
- resolution, and Time objects, being system-dependent, are not nice
- to deal with.
-
- - Various code style changes.
-
- - Summary: uniform treatment of gemspec attributes; reduced code by
- refactoring; 'test_suite_file' deprecated for 'test_files';
- 'library_stubs' introduced; spec versioning introduced.
-
- * lib/rubygems/version.rb: (Dependency) added #to_s, #==, and an
- alias (requirements_list -> requirement_list).
-
- * test/test_specification.rb: several new tests: _singular_attributes,
- _deprecated_attributes, _defaults, _to_{yaml,ruby}_and_back,
- _directly_setting_dependencies_doesnt_work, and more. Plus a new
- class to give Specification a more thorough workout (TestSpecificationComplex).
-
- * scripts/runtest.rb: require 'pp' so it's always available in unit
- tests.
-
-2004-07-30 Rich Kilmer <rich@infoether.com>
-
- * lib/rubygems/installer.rb The application stub now defaults
- to the latest version of the library, and optionally allows
- an initial parameter conforming to _VERSION_ to be passed
- to select a prior version of the library (this initial
- parameter, if present, is shifted off of ARGV).
-
- * lib/rubygems/version.rb correct? is now a class method on
- Version enabling Gem::Version.correct?(...)
-
- * lib/rubygems/install.rb make it so uninstalling a gem will
- not remove executables if another version of that gem is
- installed and needs those executables
-
-2004-07-26 Jim Weirich <jim@tardis>
-
- * lib/rubygems.rb (Gem::Exception::latest_load_paths): Added
- latest_load_paths and refactored all_load_paths to use common
- code.
-
-2004-07-25 Rich Kilmer <rich@infoether.com>
- * fixed bug in using --source in command.rb (removed short -s version)
-
- * changed spec to use the RUBY_PLATFORM for Platform::CURRENT
-
- * added ability to choose from list of available gems on remote install
- if (1) some of the gems are binary and (2) there are move than one.
- If the gems are all source gems, the latest is selected.
-
-2004-07-25 Jim Weirich <jim@weirichhouse.org>
-
- * lib/rubygems.rb (Gem::Exception::all_load_paths): Added
- all_load_paths utility function.
-
- * bin/update_rubygems: Added a command to update the gem
- installation based on a update gem.
-
- * Rakefile: Pulled package file list out into a constant so it can
- be reused between the package command and the gem package command.
- Added a gem package target to support rubygems updates.
-
-2004-07-22 Gavin Sinclair <gsinclair@soyabean.com.au>
-
- * lib/rubygems/version.rb:
- * (Requirement#initialize) initialize @version to avoid warning
- * (Dependency#initialize) initialize @version_requirement to avoid
- warning
-
-2004-07-19 Chad Fowler <chad@chadfowler.com>
- * install.rb: Shebang line should point to the ruby version used during
- installation.
-
-2004-07-19 Assaph Mehr <assaph@avaya.com>
- * lib/rubygems/command.rb, packages/sources/lib/sources.rb: Added
- command-line-configurable sources.
-
-2004-07-18 Chad Fowler <chad@chadfowler.com>
- * lib/rubygems/validator.rb: Fixed a bug that would cause "managed"
- files to appear to be unmanaged due to differences in how the paths
- were formatted.
-
-2004-07-17 Gavin Sinclair <gsinclair@soyabean.com.au>
-
- * lib/rubygems/gem_commands.rb (InstallCommand#execute): removed clear
- bug (name -> gem.name).
-
-2004-07-14 Rich Kilmer <rich@infoether.com>
- * added old_format.rb which is used in the (hack) in format.rb
- to detect the older version of a gem, and if present, switches
- to that class instead.
- * fixed the ARGV passing in bin/gem to ingore args past -- which
- are used for passing params to source gems (extconf.rb)
-
-2004-07-13 Chad Fowler <chad@chadfowler.com>
- * lib/rubygems/installer.rb, lib/rubygems/package.rb,
- lib/rubygems/format.rb, test/test_package.rb: Added Mauricio
- Fernandez's patch to replace old gem format with tar.gz format.
- Fixed some failing unit tests that resulted. Still a couple left.
- * lib/rubygems.rb: Fixed a bug introduced by the previous patch.
-
-2004-07-13 Gavin Sinclair <gsinclair@soyabean.com.au>
-
- * lib/rubygems.rb: (#require_gem) added the ability to do
- "require_gem 'rake/packagetask'", for instance, which is a
- shortcut for "require_gem 'rake'; require 'rake/packagetask'".
-
-2004-07-13 Gavin Sinclair <gsinclair@soyabean.com.au>
-
- * lib/rubygems/gem_commands.rb: refactored --version option
- in all cases to the new VersionOption module.
-
-2004-07-13 Gavin Sinclair <gsinclair@soyabean.com.au>
-
- * lib/rubygems/cmd_manager.rb: added 'unpack' command.
-
- * lib/rubygems/gem_commands.rb (UnpackCommand): added.
-
- * lib/rubygems/installer.rb (Installer#unpack): added.
-
-2004-07-09 Jim Weirich <jim@weirichhouse.org>
-
- * lib/rubygems/user_interaction.rb (Gem::StreamUI::ask and
- Gem::StreamUI::choose_from_list): Added flush before each gets.
-
-2004-07-05 Gavin Sinclair <gsinclair@soyabean.com.au>
-
- * lib/rubygems/command.rb (Gem::Command#defaults_str): added.
-
- * lib/rubygems/command.rb (Gem::Command#create_option_parser):
- Defaults for the options are included in the parser output.
-
- * lib/rubygems/gem_commands.rb: all commands which have options
- and defaults now have #defaults_str implemented.
-
-2004-07-05 Jim Weirich <jim@weirichhouse.org>
-
- * lib/rubygems/command.rb (Gem::Command#create_option_parser):
- Make the argument and option sections optional. They are only
- printed if there are options or arguments defined.
-
-2004-07-05 Gavin Sinclair <gsinclair@soyabean.com.au>
-
- * lib/rubygems/gem_commands.rb:
- - scrubbed up the 'help' command a bit, removing its options
- - added information to 'help commands'
-
-2004-07-04 Gavin Sinclair <gsinclair@soyabean.com.au>
-
- * lib/rubygems/gem_commands.rb:
- - modified generic help and examples
- - improved 'list' and 'search' help, and fixed bug in 'search'
-
- * lib/rubygems/cmd_manager.rb:
- - explicit support for top-level commands --help and --version
- - no more support for --examples and --commands
-
-2004-07-04 Gavin Sinclair <gsinclair@soyabean.com.au>
-
- * lib/rubygems/gem_commands.rb:
- - added 'list' and 'search' commands ('list' is no longer an alias
- for 'query')
- - modified return value from all 'arguments' methods (see command.rb)
-
- * lib/rubygems/cmd_manager.rb: added 'search' command.
-
- * lib/rubygems/command.rb:
- (Command#create_option_parser): enhanced the option parser for 'help'
- display
- (Command#remove_option): added (to support 'list' and 'search')
-
- * Rakefile: added 'gem' target. Runs "local" (not installed) command
- and libraries.
-
-2004-07-04 Gavin Sinclair <gsinclair@soyabean.com.au>
-
- * Rakefile: added 'install' target.
-
- * lib/rubygems/cmd_manager.rb: code formatting.
-
- * lib/rubygems/gem_commands.rb:
- - refactored common install and update options into new module
- InstallUpdateOptions
- . consolidated option pairs (e.g. --test & --no-test ==> --[no-]test)
- . --gen-rdoc is now --rdoc
- - (UninstallCommand) corrected typo
- - (InstallCommand) corrected output with local install
-
- * test/test_parse_commands.rb: :%s/--gen-rdoc/--rdoc/g
-
-2004-07-03 Jim Weirich <jim@weirichhouse.org>
-
- * lib/rubygems/gem_commands.rb (Gem::InstallCommand::initialize):
- Added --no-gen-rdoc and --no-test to allow the user to override
- .gemrc default options.
-
- * lib/rubygems/doc_manager.rb (Gem::DocManager::generate_rdoc):
- Concatenate the local rdoc options to the end of the spec's rdoc
- options.
- (Gem::DocManager::configured_args): Added configured_args as a
- place to store local rdoc options.
-
- * lib/rubygems/gem_runner.rb (Gem::GemRunner::do_configuration):
- Configuration handled in do_configuration now.
- (Gem::GemRunner::do_configuration): Set the local rdoc
- configuration from the config file.
-
- * lib/rubygems/command.rb (Gem::Command::handles): Added a
- handles? method to Command so that we can detect which extra
- arguments can be used with a command.
- (Gem::Command::add_extra_args): New method to add the config
- file's extra arguments to the front of the argument list.
- (Gem::Command::extra_args): Added extra_args to Command class to
- hold the extra args discovered in the config file.
-
- * Rakefile: Added TEST=filename option to all the test targets.
-
- * test/functional.rb (FunctionalTest::test_gemrc): Added
- functional test for gemrc.
-
- * scripts/gemdoc.data: Added an example to the specification command.
-
- * lib/rubygems.rb (Gem::Exception::manage_gems): Added gem_runner
- and config_file to manage_gems.
- (Gem::Exception::use_paths): use_paths now accepts (and ignores)
- nil parameters.
-
- * bin/gem: Make Gem::GemRunner the top level object. It now
- creates and calls the CommandManager /after/ the arguments are
- processed.
-
- * Rakefile: Added test/data/gemhome to clobber list.
-
-2004-07-01 Jim Weirich <jim@weirichhouse.org>
-
- * test/test_specification.rb
- (TestSpecification::test_rdoc_files_included): Test for rdoc files
- included in file list. Test for redundent file removal.
-
- * lib/rubygems/specification.rb (Gem::Specification::validate):
- Added gem version to validation requirement. Added normalize to
- remove redundent files in lists.
-
- * lib/rubygems/gem_commands.rb (Gem::InfoCommand::usage): Added
- usage and arguments methods for InfoCommand.
- (Gem::SpecificationCommand::usage): Fixed several usage comments.
-
-2004-06-30 Jim Weirich <jim@weirichhouse.org>
-
- * lib/rubygems/gem_commands.rb (Gem::InstallCommand::usage):
- Upcased the comment on the usage statement (and corresponding
- option). This makes the variable part of the command
- (e.g. GEMNAME) stand out from the static parts.
-
- * lib/rubygems/cmd_manager.rb (Gem::CommandManager::process_args):
- Downcased commands before searching (allows upper case or mixed
- case for commands on command line).
-
- * install.rb (install_rb): Fixed bug where the installer falsely
- triggered the old repository upgrade when the directory part of
- the file contained the matching "-digits." pattern. Now the
- pattern must be in the file's base name.
-
-2004-06-26 Gavin Sinclair <gsinclair@soyabean.com.au>
-
- * scripts/specdoc.rb: added (to generate gem specificiation document)
- * scripts/specdoc.data: added (supports specdoc.rb)
- * scripts/specdoc.yaml: added (supports specdoc.rb)
-
-2004-06-27 Jim Weirich <jim@weirichhouse.org>
-
- * scripts/gemdoc.data Removed extraneous <em> marker.
-
- * lib/rubygems/specification.rb
- (Gem::Specification::satisfies_requirement): HA! Caught another
- version_requirement vs version_requirements error. (I really
- regret the decision to change that name.)
-
- * lib/rubygems/installer.rb (Gem::Uninstaller::has_dependents):
- Changed call to alert to alert_warning.
-
- * lib/rubygems/gem_commands.rb (Gem::UninstallCommand::execute):
- Again, remove local error handling to allow the error to perculate
- up the chain to the top level.
-
- * lib/rubygems/doc_manager.rb (Gem::DocManager::generate_rdoc):
- Removed one level of exception handling. Only catching RDocErrors
- at the outermost level. And instead of reporting the error and
- swallowing it, I convert it to a Gem::DocumentError (with the same
- error message). This is for better error handling.
-
- * lib/rubygems/command.rb (Gem::Command::handle_options): Removed
- exception handling from handle_options. This allows errors to be
- handled at the top level. Makes for a more consistent error
- interface.
-
- * lib/rubygems/doc_manager.rb (Gem::DocumentError): Added
- DocumentError to wrap RDocErrors (which derive from Exception
- ... yuck).
-
- * lib/rubygems/cmd_manager.rb (Gem::RemoteError): RemoteError and
- LocalInstallationError are now Gem::Exceptions (rather than
- StandardErrors).
-
- * lib/rubygems.rb (Gem::Exception): Changed base of Gem::Exception
- to RuntimeError (was ::Exception). Apps using gem as a library
- would have to catch Gem::Exceptions explicitly (yuck), or catch
- Exceptions generically. Catching Exceptions will catch
- EVERYTHING, including things like SystemExit. By makeing
- Gem::Exception a RuntimeError, apps can catch RuntimeError or even
- StandardError.
-
-2004-06-26 Jim Weirich <jim@weirichhouse.org>
-
- * test/functional.rb (FunctionalTest::test_all_command_helps):
- Added functional test to show all commands have usage messaegs.
-
- * lib/rubygems/gem_commands.rb (Gem::HelpCommand::execute): Added
- version option to help (gem help version).
- (Gem): Cleaned up the help text. Dropped unneeded verbage.
-
- * lib/rubygems/cmd_manager.rb
- (Gem::CommandManager::find_command_possibilities): Added
- find_command_possibilities to help the Help command look for
- commands.
-
- * lib/rubygems/installer.rb (Gem::Uninstaller::uninstall): Fixed
- null pointer bug where a list was destroyed in a method.
-
- * lib/rubygems/gem_commands.rb (Gem::BuildCommand::load_gemspecs):
- yaml gemspec files are now accepted by the build command.
-
- * lib/rubygems/command.rb (Gem::Command::parser): Created an
- on-demand option parser for all commands.
- (Gem::Command::handle_options): Command line option hash is now
- and instance variable with a reader.
-
- * Rakefile: Linked package version to the value in the rubygems.rb
- file. The gem env command now shows both gem version (e.g. 0.6)
- and the package version (e.g. 0.6.1).
-
-2004-06-25 Jim Weirich <jim@weirichhouse.org>
-
- * lib/rubygems/gem_commands.rb (Gem::InfoCommand): Dropped the
- version command (its available via gem env). Added a gem info
- command to extract the yaml from a gemfile.
- (Gem::LocalRemoteOptions): Refactored the local/remote options
- (adding and testing) into a mixin module.
-
- * test/test_version_comparison.rb
- (TestDependencies::test_normalization): Added some tests for the
- normalization issues mentions below.
-
- * lib/rubygems/version.rb (Gem::Dependency::normalize): Old gems
- have requirements and dependencies incoded in the Yaml spec in an
- out of date format. When loaded, they have incorrect instance
- variables for modern objects. I added a normalize call to handle
- transforming out dated objects in to modern objects. (Remember
- this next time we change the data structure of something in the
- spec file.)
- (Gem::Version::Requirement::parse): Requirements are comparable
- now, just so that we can test them with asserts.
-
- * lib/rubygems/remote_installer.rb
- (Gem::RemoteInstaller::find_dependencies_not_installed): Fixed
- recursive call to require_gem to properly pass dependency
- information.
-
- * lib/rubygems/installer.rb (Gem::Uninstaller::has_dependents):
- Fixed reference to version_requirement (needs to be plural).
-
- * lib/rubygems/command.rb (Gem::Command::invoke): Command now
- handles it own help messages. Commands no longer have to return
- true/false to trigger help messages.
-
- * lib/rubygems/cmd_manager.rb (Gem::CommandManager::process_args):
- Moved help handling into the help command.
-
- * lib/rubygems/gem_commands.rb (Gem::HelpCommand): Renamed the
- base command to HelpCommand and made it handle a lot of the help
- options. Still need work on individual command helps.
-
- * test/functional.rb (FunctionalTest::test_env_version): Added a
- bunch of new functional tests for the environment command.
-
- * lib/rubygems/gem_commands.rb (Gem::InstallCommand::execute):
- Made multiple gem names an error for now. Should look at later.
-
- * lib/rubygems/cmd_manager.rb (Gem::ListCommand): Added list as an
- alias to query.
- (Gem::UpdateCommand::initialize): Corrected spelling of install
- (intall) in several places.
-
- * bin/gem_server: Added Gem.manage_gems to the gem_server to fix
- missing requirements.
-
- * lib/rubygems/cmd_manager.rb (Gem::InstallCommand::initialize):
- Added missing --both option to install.
-
- * test/test_command.rb
- (TestCommand::test_invode_with_bad_options): Catch the termination
- request.
-
- * test/mockgemui.rb (MockGemUi::terminate_interaction): Make the
- mock UI throw an exception when a termination is requested. This
- makes sure that we don't miss accidental terminations.
-
- * lib/rubygems/cmd_manager.rb (Gem::CommandManager::find_command):
- Added find_command to handle best matching command names.
-
- * test/functional.rb (FunctionalTest::test_build): Updated
- functional tests to use the new command structure.
-
- * lib/rubygems/version.rb (Gem::Version::Requirement): Changed the
- pessimistic version comparison operator to "~>". I like to think
- of it as "approximately greater than". (It was ">*").
-
- * bin/gem: Moved gem2 into the standard gem script location. It
- is now stable enough to use as the standard command.
-
- * lib/rubygems/cmd_manager.rb (Gem::CommandManager::run): Added
- run method to trap errors while running commands. Makes for
- prettier output.
- (Gem::CommandManager): Move *all* commands to their own classes.
- Simplified CommandManager. Lowered the coupling between
- CommandManager and the Commands (the commands don't even need to
- know about the manager anymore). CommandManager maybe created
- with "new" for testing (the script will continue to use
- "instance").
- (Gem::RubyGemsInfoCommand): New command.
- (Gem::VersionCommand): New command.
-
-2004-06-24 Jim Weirich <jim@weirichhouse.org>
-
- * lib/rubygems/user_interaction.rb (Gem::UserInteraction):
- Significantly rewrote the whole user interaction scheme. We are
- now using an UI object that responds to the standard list of UI
- commands (e.g. say, alert, ask). The UserInteraction module
- defines all the interaction methods to be forwarded to the default
- UI objects. The "ui" method returns that default object (and you
- can use self.ui=(new_ui) to change it). Also the use_ui(new_ui) {
- } command is convienent for switching the UI object for a short
- period of time.
-
-2004-06-18 Rich Kilmer <rich@infoether.com>
- * broke test_cmd_manager.rb into test_parse_commands and
- test_process_commands to test the parsing of command line options
- and the funtionality, respectively.
-
-2004-06-18 Rich Kilmer <rich@infoether.com>
- * added new unit test file: test/test_cmd_manager.rb to test the
- command manager classes. this is just the first few tests which
- will be expanded to a full test suite.
-
-2004-06-17 Chad FOwler <chad@chadfowler.com>
-
- * lib/rubygems/installer.rb: Fixed bug in windows batch file generation
- which was causing file not found errors.
- * lib/rubygems/installer.rb: Uninstall now removes scripts and batch
- * lib/rubygems/specification.rb: Fixed install bug. Thanks to Mark
- Sparshatt for the fix (via the rubyforge bug tracker).
-
-2004-06-17 Jim Weirich <jim@weirichhouse.org>
-
- * lib/rubygems/doc_manager.rb (Gem::DocManager::generate_rdoc):
- Changed rdoc generation to do a chdir into the base source
- directory and then to use a relative path for all the source
- files. This makes the generated RDOC html look better and may fix
- the windows drive/rdoc bug as a side effect.
-
-2004-06-17 Rich Kilmer <rich@infoether.com>
- * Added ability to capture the UserInteraction with:
- c = Gem::UserInteraction.capture
- and then you can override specific methods like 'say':
- c.on_say {|statement| puts "you said: #{statement}"}
-
-2004-06-15 Rich Kilmer <rich@infoether.com>
- * Added refactored command handling in rubygems/cmd_manager.rb and a
- (temporary) bin/gem2 command file to test things out. Once we feel
- comfortable, we can replace gem with gem2.
-
-2004-06-10 Rich Kilmer <rich@infoether.com>
- * Isolated all user interaction to pass through module methods on a new
- Gem::UserInteraction module. Those methods will be the method of abstracting
- the interaction of RubyGems for use in a GUI-based solution.
-
-2004-06-10 Rich Kilmer <rich@infoether.com>
- * require 'rubygems' now minimally requires only the files needed
- for runtime access to gems...not management of gems. To manage
- gems you now additionally need to execute Gem::manage_gems prior
- to using the builder/installer/etc. This makes gemspecs not
- backward compatible unless they add that line to the gemspec
- after the require 'rubygems' line.
-
-2004-06-10 Gavin Sinclair <gsinclair@soyabean.com.au>
- * bin/gem: --upgrade-all was broken, probably as a result of the
- search changes listed below.
-
-2004-06-09 Chad Fowler <chad@chadfowler.com>
- * lib/rubygems/remote_install.rb: delegate search functionality to
- Cache class, bringing remote and local search and list together into
- one piece of code.
- * bin/gem, lib/rubygems/validator.rb: move all STDIO work to bin/gem.
- Validator.alien now returns a hash of ErrorData objects.
- * bin/gem, lib/rubygems/installer.rb: move most of the STDIO stuff to
- bin/gem, communicating via exceptions in this case.
-
-2004-06-08 Rich Kilmer <rich@infoether.com>
- * Fixed the drive problem on win32 (hopefully) so multiple drives
- should now work. Its still a hack until rdoc is fixed.
-
-2004-06-08 Chad Fowler <chad@chadfowler.com>
- * Fixed bug caused by method change on Version::Requirement
-
-2004-06-08 Rich Kilmer <rich@infoether.com>
- * fixed bug in doc_manager.rb whereby the extra_rdoc_files should
- be appended to the list of directories prior to prepending the
- full path.
-
-2004-06-08 Gavin Sinclair <gsinclair@soyabean.com.au>
- * bin/gem_server: List installed gems in [name,version] order.
-
-2004-06-08 Gavin Sinclair <gsinclair@soyabean.com.au>
- * lib/rubygems/installer.rb: don't warn about not being able to
- install a library stub if a library stub is already installed.
- Still warn if it's not a library stub that's there already.
-
-2004-06-08 Gavin Sinclair <gsinclair@soyabean.com.au>
- * bin/gem: renamed --upgrade-dist to --upgrade--all and fixed bug.
- * lib/rubygems/installer.rb: fixed bug with Ruby version assertion.
-
-2004-06-07 Chad Fowler <chad@chadfowler.com>
- * lib/rubygems/remote_installer.rb, lib/rubygems/version.rb: Fixed old
- dependency on #version method for Gem::Version::Requirement
- * bin/gem: new --upgrade-dist option allows one to upgrade every
- installed gem
- * lib/rubygems/specification.rb,lib/rubygems/installer.rb: new
- #required_ruby_version attribute added to gem specification for specifying a
- dependency on which version of ruby the gem needs. Format it accepts is
- the same as the Gem::Version::Requirement format.
-
-2004-06-06 Chad Fowler <chad@chadfowler.com>
- * bin/gem: install_stub is once again the default due to requests.
-
-2004-06-04 Chad Fowler <chad@chadfowler.com>
- * lib/rubygems/specification.rb, lib/rubygems/doc_manager.rb:
- Allow arbitrary files to be added for rdoc to run over them (as per
- Jim's request).
-
-2004-06-04 Chad Fowler <chad@chadfowler.com>
- * bin/gem: Reformatted --search and --list output such that
- multiple versions of a gem are compressed into a single entry
- (with version numbers in parentheses)
-
-2004-05-31 Jim Weirich <jweirich@one.net>
-
- * lib/rubygems/version.rb (Gem::Dependency): Dependency attribute
- renamed to version_requirements (made plural).
- (Gem::Version::bump): Added bump to implement pessimistic
- operator.
- (Gem::Version::Requirement): Added pessimistic operator to list of
- operators. Operators now implemented using lambda.
-
- * lib/rubygems.rb (Kernel::require_gem): require_gem now takes an
- array of requirement strings.
-
- * lib/rubygems/version.rb (Gem::Version::Requirement::initialize):
- Simplified initialization by making parse a bit smarter.
- (Gem::Version::Requirement::satisfied_by): Simplified by using
- all?
- (Gem::Version::Requirement::satisfy): Added explicit one
- requirement satisfy test.
- (Gem::Version::Requirement::parse): parse now returns a two
- element string array (operator and version string). We don't
- bother converting to an integer array during parsing.
-
-2004-05-31 18:38 chadfowler
-
- * gemspec now supports #rdoc_options, to which you can append
- strings that will be passed to rdoc as additional options.
-
-2004-05-08 21:57 chadfowler
-
- * Using Gem::RubyGemsVersion to match the release number. If we
- need to use this as an internal version format specifier in the
- future, we can use the Gem::Version semantics.
-
-2004-05-30 14:33 gsinclair
-
- * bin/gem: Split --help into --help (basic), --help-options (what
- --help used to be), and --help-examples.
-
-2004-04-30 15:57 chadfowler
-
- * bin/gem: --install-stub is no longer the default ;)
-
-2004-04-30 15:51 chadfowler
-
- * lib/rubygems/installer.rb: Rich Kilmer (who kicks butt) figured
- out how to fix the library stub stuff.
-
-2004-04-29 19:12 chadfowler
-
- * lib/rubygems/doc_manager.rb: Dick Davies fixed a bug in the doc
- generator.
-
-2004-04-29 13:41 gsinclair
-
- * lib/rubygems/installer.rb: Added skeleton code and comments to
- uninstall stub apps and libs
-
-2004-04-29 12:20 gsinclair
-
- * install.rb: Don't install library stub for 'sources'
-
-2004-04-29 12:20 gsinclair
-
- * lib/rubygems/installer.rb: Improvements to library stub
- installation: * don't overwrite existing file (emit warning) *
- nice warning if there's a permission problem * observe
- --[no-]install-stub flag (rather, observe the argument to
- #install)
-
-2004-04-29 12:16 gsinclair
-
- * bin/gem: --install-stub is now the default
-
-2004-04-26 20:20 chadfowler
-
- * test/test_remote_installer.rb: Cleaning up after Gavin and his
- test-breaking self. ;)
-
-2004-04-26 12:06 gsinclair
-
- * bin/gem, lib/rubygems/installer.rb,
- lib/rubygems/remote_installer.rb: Installing a gem now causes a
- library stub to be installed as well, allowing you to require
- 'package' without knowing it's a gem.
-
-2004-04-25 23:18 chadfowler
-
- * lib/rubygems/: installer.rb, specification.rb: Prompt user if
- trying to uninstall a gem that other gems *may* depend on.
-
-2004-04-25 09:27 chadfowler
-
- * test/test_remote_installer.rb: Changed expected test results to
- match new (old) gem naming scheme--"ruby" doesn't appear as a
- platform in the gem name.
-
-2004-04-25 05:50 gsinclair
-
- * bin/gem: Changed @directory -> @install_dir for clarity
-
-2004-04-25 05:47 gsinclair
-
- * bin/gem: Improved display of gems, platform-wise
-
-2004-04-25 05:46 gsinclair
-
- * lib/rubygems/specification.rb: Added documentation
-
-2004-04-25 04:17 jimweirich
-
- * test/functional.rb: Fixed functional test to properly name a Ruby
- platform gem.
-
-2004-04-25 04:17 jimweirich
-
- * packages/sources/.cvsignore, test/data/one/.cvsignore: Ignore the
- proper gem name.
-
-2004-04-25 04:17 jimweirich
-
- * lib/rubygems/specification.rb: Undefined several attributes that
- were redefined to avoid warnings.
-
-2004-04-25 04:17 jimweirich
-
- * lib/rubygems.rb: Need to initialize @gem_home and @gem_path with
- ||= to avoid warning.
-
-2004-04-25 03:40 gsinclair
-
- * lib/rubygems.rb, test/test_gempaths.rb: RUBY_GEMS -> GEM_PATH
- (environment variable)
-
-2004-04-25 03:33 gsinclair
-
- * lib/rubygems/specification.rb: Pretty-print the specification
-
-2004-04-25 03:18 gsinclair
-
- * lib/rubygems/specification.rb: Handle platform in a (hopefully)
- consistent manner
-
-2004-04-25 03:16 gsinclair
-
- * install.rb: Use return value from Builder#build to locate gem
- file
-
-2004-04-25 03:09 gsinclair
-
- * lib/rubygems/builder.rb: Return file name from #build
-
-2004-04-25 02:32 gsinclair
-
- * lib/rubygems/specification.rb: Platform goes at the *end* of the
- full name now.
-
-2004-04-22 06:19 chadfowler
-
- * test/test_remote_installer.rb: Fixed test to reflect fewer cache
- sources :(
-
-2004-04-21 17:19 rich
-
- * lib/rubygems/remote_installer.rb: added support to download the
- yaml index as a .Z (zlib compressed) file if it exists, then move
- on to the plain yaml file if it does not
-
-2004-04-20 20:23 chadfowler
-
- * examples/application/an-app.gemspec, lib/rubygems/format.rb,
- packages/sources/lib/sources.rb: Committed Dick Davies' patch to
- fix broken tests.
-
-2004-04-18 01:51 gsinclair
-
- * bin/gem, lib/rubygems/doc_manager.rb: RDoc generation observes
- 'rdoc' config file value
-
-2004-04-17 12:15 gsinclair
-
- * bin/gem: Improved 'build' error output
-
-2004-04-17 12:12 gsinclair
-
- * lib/: rubygems.rb, rubygems/remote_installer.rb,
- rubygems/specification.rb, rubygems/validator.rb: All
- gems-related exceptions now extend Gem::Exception
-
-2004-04-17 12:11 gsinclair
-
- * lib/rubygems/specification.rb: Improved handling of summary and
- decription strings - convert to single line
-
-2004-04-17 01:09 gsinclair
-
- * bin/gem: Prevent remote install attempt if local install was
- successful
-
-2004-04-17 00:49 gsinclair
-
- * lib/rubygems/builder.rb: Better formatted the output code
-
-2004-04-16 21:31 gsinclair
-
- * lib/rubygems/remote_installer.rb: Stoopid coding error (thanks
- Kent Sibilev)
-
-2004-04-16 00:00 rich
-
- * lib/rubygems/installer.rb: added code to optionally use nmake
- instead of make on win32 systems
-
-2004-04-15 20:12 gsinclair
-
- * bin/gem, lib/rubygems/remote_installer.rb: Clarified proxy
- handling and interface: --[no-]http-proxy [URL]
-
-2004-04-13 00:16 jimweirich
-
- * bin/gem, test/bogussources.rb, test/functional.rb: Oops, missed
- an instance of GEM_PATH in the gem binary.
-
-2004-04-12 21:28 jimweirich
-
- * lib/rubygems/cache.rb: Oops. Missed a GEM_PATH.
-
-2004-04-12 21:11 jimweirich
-
- * test/test_remote_installer.rb: removed setting of environment
- variable for now.
-
-2004-04-12 21:09 jimweirich
-
- * Rakefile, lib/rubygems.rb, lib/rubygems/cache.rb,
- lib/rubygems/installer.rb, packages/sources/.cvsignore,
- scripts/runtest.rb, test/.cvsignore, test/bogussources.rb,
- test/test_format.rb, test/test_gempaths.rb,
- test/test_remote_installer.rb, test/test_validator.rb: Added
- test/temp to the clobber list. Broke out tests into inline to
- avoid test dependencies on rubygem.
-
-2004-04-12 07:52 chadfowler
-
- * lib/: rubygems.rb, rubygems/installer.rb,
- rubygems/remote_installer.rb: Cleaning up output strings wrt
- formating of "gem (version)".
-
-2004-04-12 07:41 chadfowler
-
- * lib/rubygems/installer.rb: Gavin Sinclair's uninstall bug.
-
-2004-04-11 15:26 jimweirich
-
- * test/data/one/: .cvsignore, one-ruby-0.0.1.gem: removed
- one-ruby*.gem from source control. This gem is automatically
- generated in testing.
-
-2004-04-11 10:50 chadfowler
-
- * bin/gem: Gavin Sinclair's test code enhancements
-
-2004-04-11 07:50 chadfowler
-
- * bin/gem, lib/rubygems/installer.rb,
- lib/rubygems/remote_installer.rb, lib/rubygems/specification.rb,
- test/insure_session.rb, test/test_remote_installer.rb,
- test/data/one/one-ruby-0.0.1.gem: Gavin Sinclair patches to make
- installer return types less ambiguous.
-
-2004-04-09 10:29 chadfowler
-
- * lib/rubygems/installer.rb, test/data/one/one-ruby-0.0.1.gem: gem
- -u input validation patch by Ville Aine
-
-2004-04-07 07:49 chadfowler
-
- * bin/gem, lib/rubygems/cache.rb, test/data/one/one-ruby-0.0.1.gem:
- Finally have passing tests.
-
-2004-04-07 07:24 chadfowler
-
- * lib/rubygems/remote_installer.rb,
- test/data/one/one-ruby-0.0.1.gem: Allow default option to work on
- remote dependency prompt.
-
-2004-04-07 07:05 chadfowler
-
- * lib/rubygems/remote_installer.rb, test/test_remote_installer.rb,
- test/data/one/one-ruby-0.0.1.gem: Applied George Marrows' patch
- to remote_install
-
-2004-04-07 06:23 chadfowler
-
- * bin/gem, test/data/one/one-ruby-0.0.1.gem: No longer "seeing"
- double on remote searches
-
-2004-04-05 07:39 chadfowler
-
- * Rakefile, test/test_remote_installer.rb,
- test/data/one/one-ruby-0.0.1.gem: remote_installer tests aren't
- completely hosed anymore.
-
-2004-04-05 06:16 chadfowler
-
- * Rakefile, test/data/one/one-ruby-0.0.1.gem: Rake target for
- running all tests (unit + functional) "alltests"
-
-2004-04-05 00:48 jimweirich
-
- * test/: insure_session.rb, data/one/README.one,
- data/one/one-ruby-0.0.1.gem, data/one/one.gemspec,
- data/one/lib/one.rb: added for functional tests
-
-2004-04-05 00:48 jimweirich
-
- * test/functional.rb: Moved session gem detection to insure_session
- file. Modified functional tests to use gem command. Removed
- some directory stuff because rake guarantees the starting
- directory. Added test_info functional test. Added test_build
- functional test. Added assert status.
-
-2004-04-05 00:48 jimweirich
-
- * lib/rubygems/remote_installer.rb: Changed exceptions to inherit
- from RunTimeError
-
-2004-04-05 00:48 jimweirich
-
- * bin/gem: Changed Installer to RemoteInstaller in rubygems-info.
-
-2004-04-05 00:48 jimweirich
-
- * Rakefile: Added generated test gem to clobber list. Added
- functional test target to rakefile.
-
-2004-04-04 21:17 chadfowler
-
- * packages/sources/lib/sources.rb: Added gems mirror at
- http://gems.chadfowler.com
-
-2004-04-04 20:51 chadfowler
-
- * bin/gem, lib/rubygems/remote_installer.rb, test/functional.rb:
- More improved error messages (don't show stack trace when using
- bin/gem)
-
-2004-04-04 20:43 chadfowler
-
- * lib/rubygems/cache.rb: Only read specs that end in "gemspec".
- The code doesn't handle non-gemspecs very well at all.
-
-2004-04-04 20:15 chadfowler
-
- * test/mock/gems/specifications/sources-0.0.1.gemspec: [no log
- message]
-
-2004-04-04 20:09 chadfowler
-
- * test/mock/gems/gems/sources-0.0.1/lib/sources.rb: Rearranging
- things a bit
-
-2004-04-04 20:02 chadfowler
-
- * bin/gem, lib/rubygems/remote_installer.rb, test/bogussources.rb,
- test/functional.rb: Better error messages on unresolvable host.
-
-2004-04-04 12:50 chadfowler
-
- * redist/session.gem, test/bogussources.rb, test/functional.rb:
- Added the beginnings of a functional test suite.
-
-2004-04-03 22:02 chadfowler
-
- * lib/rubygems/validator.rb: Just had to explicitly rescue
- VerificationError. All is well.
-
-2004-04-03 22:01 chadfowler
-
- * lib/rubygems/validator.rb: Mauricio fixed a problem with alien
- (just failed to update it when we changed the gem directory), but
- now there's another issue I can't find. Anyway, this fix is
- obviously needed. But alien is broken anyway.
-
-2004-04-03 21:57 chadfowler
-
- * install.rb, lib/rubygems/builder.rb: Batsman's bug report and
- code for the bugs I introduced today. :)
-
-2004-04-03 09:50 chadfowler
-
- * lib/rubygems/specification.rb: Defaulting a spec's require_path
- to [] to avoid downstream errors.
-
-2004-04-03 09:06 chadfowler
-
- * lib/rubygems/builder.rb, test/test_builder.rb: builder now
- validates the gemspec.
-
-2004-04-03 08:48 chadfowler
-
- * lib/rubygems/specification.rb, test/test_specification.rb: Added
- checking for gem specs to make sure they have all required
- attributes.
-
-2004-04-03 08:06 chadfowler
-
- * gemspecs/rublog.gemspec: My original rublog gem was broken, in
- that it didn't have a require_path.
-
-2004-04-02 07:48 chadfowler
-
- * lib/rubygems/remote_installer.rb: Prompt for installation of
- dependencies.
-
- For now, there is a puts/gets in the middle of
- remote_installer.rb This should probably be cleaned up later
- (return control flow to the gem program to install the
- dependencies, for example.
-
-2004-04-02 07:37 chadfowler
-
- * TODO: [no log message]
-
-2004-04-02 07:34 chadfowler
-
- * test/: simple_gem.rb, test_format.rb: Some things I forgot to cvs
- add earlier.
-
-2004-04-02 07:29 chadfowler
-
- * example/: test.gemspec, lib/test.rb, lib/test/wow.rb: Removing
- example directory in favor of "examples" directory (just better
- organized).
-
-2004-04-02 07:26 chadfowler
-
- * test/test_all.rb: Removed test_all.rb. Rake is obviously a
- better way to do it.
-
-2004-03-31 19:13 chadfowler
-
- * lib/rubygems/format.rb, lib/rubygems/installer.rb,
- lib/rubygems/validator.rb, test/test_all.rb,
- test/test_validator.rb: More tests and refactoring to support
- them.
-
-2004-03-30 02:41 rich
-
- * lib/rubygems/installer.rb: allow passing parameters to extconf.rb
- with:
-
- ruby -i blah.gem --local -- --with-option
-
- everything past the -- will go to the extconf.rb...just like
- setup.rb
-
-2004-03-30 02:34 rich
-
- * lib/rubygems/: installer.rb, specification.rb: very initial
- capability to build source gems. this only lets you build native
- extensions so long as you do not have to specify --with-
- directories
-
-2004-03-29 08:31 rich
-
- * install.rb: switched migration of old gems to new ./gems subdir
- to use FileUtils rather than ftools...hope to fix reported win32
- error.
-
-2004-03-29 01:04 rich
-
- * lib/rubygems/doc_manager.rb: fixed bug in pathing based on new
- directory structure
-
-2004-03-29 01:03 rich
-
- * lib/rubygems/remote_installer.rb: fixed bug in default for proxy
- (should default to nil not true)
-
-2004-03-29 01:03 rich
-
- * bin/gem: updated with patch to allow for config file with minor
- difference from gavin's patch which passes a nil to the
- RemoteInstaller if the proxy does not exist
-
-2004-03-28 23:22 rich
-
- * install.rb: added code to migrate gems if they are in the old
- directory structure
-
-2004-03-28 21:30 rich
-
- * install.rb, lib/rubygems.rb, lib/rubygems/installer.rb,
- lib/rubygems/specification.rb: changed path of installed gems to
- be:
-
- ruby/gems/1.8/gems
-
- which cleans up the root.
-
-2004-03-28 18:53 chadfowler
-
- * test/test_all.rb: This is the file to run for all of the tests.
-
- test_remote_installer is commented out for now. The open URI
- patch that George gave us makes the code a lot nicer to look at,
- but a little harder to test.
-
-2004-03-28 18:50 chadfowler
-
- * lib/rubygems/remote_installer.rb, test/test_cache.rb,
- test/test_remote_installer.rb: Added some tests for cache search
-
-2004-03-28 12:19 chadfowler
-
- * bin/gem, lib/rubygems/validator.rb, test/test_validator.rb: Some
- tests for the validator.
-
- Made the validator more testable.
-
-2004-03-28 09:30 chadfowler
-
- * bin/gem, lib/rubygems/validator.rb: Fixed a problem with false
- alarms in the validator.
-
-2004-03-27 08:23 chadfowler
-
- * bin/gem: No longer have an option to pass http proxy host into
- the gem program. Only reads it from the environment. This is
- because George's patch (and open-uri) work this way, and I'm lazy
- right now.
-
-2004-03-27 08:17 chadfowler
-
- * lib/rubygems/remote_installer.rb: George Marrows' nice patch to
- remove a bunch of code from remote_installer.
-
- Our remote_installer tests are failing. We really need to start
- paying attention to the test directory. :(`
-
-2004-03-24 23:26 jimweirich
-
- * install.rb: Do not install commands ending in ~.
-
-2004-03-24 23:25 jimweirich
-
- * lib/rubygems/specification.rb: Changed executables from accessor
- to writer to avoid redefinition.
-
-2004-03-21 21:10 jimweirich
-
- * bin/gem: fixed uninitialized directory option
-
-2004-03-21 15:34 jimweirich
-
- * bin/gem: removed carriage returns that screwed up the #! line
-
-2004-03-21 09:02 chadfowler
-
- * bin/gem: Gavin's bin/gem refactoring.
-
-2004-03-20 17:03 jimweirich
-
- * bin/gem: added wrapping to gem listing
-
-2004-03-20 12:22 chadfowler
-
- * install.rb: More cleaning by Gavin Sinclair
-
-2004-03-20 12:08 chadfowler
-
- * examples/application/an-app.gemspec,
- examples/application/bin/myapp,
- examples/application/lib/somefunctionality.rb, lib/rubygems.rb,
- lib/rubygems/installer.rb, lib/rubygems/specification.rb: Added
- functionality for installing applications into the system bindir.
- Needs cleaning and refactoring.
-
-2004-03-20 07:53 chadfowler
-
- * bin/gem: [no log message]
-
-2004-03-19 23:03 chadfowler
-
- * bin/gem: More intuitive default.
-
-2004-03-19 10:45 chadfowler
-
- * bin/gem: * Some minor rearranging of the test stuff so that
- installation errors will also abort the test run * Don't try to
- run tests if none are included with the gem
-
-2004-03-18 22:27 chadfowler
-
- * bin/gem, example/lib/test.rb, lib/rubygems/cache.rb,
- lib/rubygems/specification.rb: * Preliminary support for: gem -i
- blah-0.0.1.gem --run-tests Needs to be cleaned up considerably.
- * Introduction of new gemspec metadata "unit_test_suite", which
- will be require'd in order to load all unit tests
-
-2004-03-17 09:33 chadfowler
-
- * bin/gem: Applied Gavin Sinclair's patch to make help output
- better.
-
-2004-03-16 21:55 chadfowler
-
- * bin/gem: Added --remote-list option for gem command to display
- all gems on server.
-
-2004-03-16 21:50 chadfowler
-
- * bin/gem, doc/UserDoc.html: Fixed --help case inconsistencies and
- documentation typos as per Scott Harper's email.
-
-2004-03-16 21:41 chadfowler
-
- * bin/gem: --list and --search display are the same.
-
-2004-03-16 21:33 chadfowler
-
- * bin/gem: Implemented some of Scott Harper's search suggestions:
- case insensitive sort of returned gems and display description
- with gem name in search results.
-
-2004-03-16 21:20 chadfowler
-
- * bin/gem, lib/rubygems/remote_installer.rb: http_proxy option
- implemented
-
-2004-03-15 07:19 chadfowler
-
- * lib/rubygems/remote_installer.rb: Installation is now case
- insensitive (like search)
-
-2004-03-15 07:07 chadfowler
-
- * TODO, bin/gem, lib/rubygems/remote_installer.rb: Better error
- messages. updated TODO list.
-
-2004-03-14 21:02 chadfowler
-
- * bin/gem, lib/rubygems/remote_installer.rb: --dir didn't work with
- remote-install. Now it does.
-
-2004-03-14 17:48 rich
-
- * bin/gem: fixed uninstall bug
-
-2004-03-14 17:18 rich
-
- * lib/rubygems/doc_manager.rb: changed to remove <drive>: on
- win32...ug
-
-2004-03-14 16:15 rich
-
- * install.rb: fixed typo
-
-2004-03-14 16:13 rich
-
- * install.rb: generate cmd files
-
-2004-03-14 16:13 rich
-
- * bin/: gem.cmd, gem_server.cmd: now generate cmd files
-
-2004-03-14 15:52 chadfowler
-
- * bin/gem: Fixed a small bug with --gen-rdoc and the remote
- installer.
-
-2004-03-14 15:38 chadfowler
-
- * lib/rubygems.rb: Back to version 1.0 ;)
-
-2004-03-14 15:36 chadfowler
-
- * lib/rubygems.rb: Updated rubygemsversion
-
-2004-03-14 15:31 chadfowler
-
- * README: credits
-
-2004-03-14 15:24 rich
-
- * README: initial readme
-
-2004-03-14 15:12 rich
-
- * doc/UserDoc.html: updated w/doc on documentation ;-)
-
-2004-03-14 15:01 rich
-
- * gemspecs/jabber4r.gemspec: added jabber4r gemspec
-
-2004-03-14 14:58 rich
-
- * bin/gem_server: change the documentation path to /
-
-2004-03-14 14:57 rich
-
- * install.rb: remove installing .rb files from ./bin
-
-2004-03-14 14:32 rich
-
- * doc/: DevDoc.txt, GemSpecification.txt, UserDoc.html,
- UserDoc.txt: updated with latest docs
-
-2004-03-14 12:05 chadfowler
-
- * test/test_remote_installer.rb: Fixed tests.
-
-2004-03-14 11:31 chadfowler
-
- * lib/rubygems/specification.rb: Fixed bug that would manifest
- itself if a gem creator put apostrophes/single-quotes in the gem
- spec.
-
-2004-03-14 00:04 rich
-
- * doc/: UserDoc.html, UserDoc.txt: finished user's guide
-
-2004-03-13 21:48 rich
-
- * doc/: DevDoc.html, UserDoc.html, UserDoc.txt: updated user's
- guide...will finish section on ruby's library mgt soon ;-)
-
-2004-03-13 20:48 chadfowler
-
- * doc/DevDoc.txt: Added documentation on making and distributing
- gems
-
-2004-03-13 20:20 chadfowler
-
- * TODO: [no log message]
-
-2004-03-13 19:51 rich
-
- * doc/: DevDoc.html, DevDoc.txt, GemSpecification.html,
- GemSpecification.txt, UserDoc.html, UserDoc.txt, doc.css,
- makedoc.rb: added these doc (wiki) files from
- http://rubygems.rubyforge.org/
-
-2004-03-13 17:56 chadfowler
-
- * TODO, gemspecs/README, gemspecs/cgikit-1.1.0.gemspec,
- gemspecs/linguistics.gemspec, gemspecs/ook.gemspec,
- gemspecs/progressbar.gemspec, gemspecs/redcloth.gemspec,
- gemspecs/rublog.gemspec, gemspecs/ruby-doom.gemspec,
- gemspecs/rubyjdwp.gemspec, gemspecs/statistics.gemspec: Added
- some gemspecs for actual RAA packages.
-
-2004-03-13 14:35 chadfowler
-
- * TODO, lib/rubygems/remote_installer.rb: Preliminary HTTP Proxy
- support. Untested.
-
-2004-03-13 09:11 chadfowler
-
- * packages/sources/lib/sources.rb: Changed to point to rubyforge
-
-2004-03-12 22:40 rich
-
- * bin/generate_yaml_index.rb: generates a yaml index for a gems
- repository
-
-2004-03-12 22:02 chadfowler
-
- * bin/gem_server: No longer serving gem specs.
-
-2004-03-12 21:42 chadfowler
-
- * TODO, bin/gem_server.cgi: We decided to trash gem_server.cgi in
- favor of the static content generator Rich is working on.
-
-2004-03-12 21:15 chadfowler
-
- * TODO: [no log message]
-
-2004-03-12 20:11 chadfowler
-
- * bin/gem, lib/rubygems/installer.rb,
- lib/rubygems/remote_installer.rb: Basic search funtionality in.
-
- Slight refactoring of Installer and RemoteInstaller
-
-2004-03-12 18:28 chadfowler
-
- * TODO: [no log message]
-
-2004-03-12 16:37 chadfowler
-
- * TODO: [no log message]
-
-2004-03-12 16:14 chadfowler
-
- * TODO: More TODO items
-
-2004-03-08 13:50 chadfowler
-
- * TODO, bin/gem_server, example/test.gemspec: Use rdoc templates
- for HTML. Nearly XHTML compliant.
-
-2004-03-08 08:21 chadfowler
-
- * TODO: Added TODO list
-
-2004-03-08 08:12 chadfowler
-
- * lib/rubygems/validator.rb: Fixed a small (but crippling) bug in
- the validator.
-
-2004-01-24 13:49 chadfowler
-
- * bin/gem, lib/rubygems.rb, lib/rubygems/cache.rb,
- lib/rubygems/validator.rb, lib/rubygems/version.rb: More cleanup.
-
-2004-01-24 13:29 chadfowler
-
- * bin/gem, lib/rubygems/remote_installer.rb: A little cleaning of
- (Remote)Installer inconsistencies
-
-2004-01-24 13:23 chadfowler
-
- * bin/gem: Removed the weird instance variable thing we had going
- on. :)
-
-2004-01-07 17:34 chadfowler
-
- * bin/gem: removed old cruft
-
-2003-12-24 11:32 chadfowler
-
- * lib/rubygems/validator.rb: Gem validation was returning false
- negatives (corrupted gems were not reporting their corruption).
-
-2003-12-18 14:18 chadfowler
-
- * lib/rubygems/cache.rb: Lyle noticed some out of date rdoc
- documentation. Thanks Lyle!
-
-2003-12-03 08:05 chadfowler
-
- * install.rb: Gavin's patch for installing the files in bin/ on
- rubygems installation.
-
-2003-11-30 00:36 chadfowler
-
- * lib/rubygems/specification.rb: Little warnings adjustment
-
-2003-11-29 17:27 jimweirich
-
- * Rakefile: added Rakefile to package
-
-2003-11-29 16:23 jimweirich
-
- * lib/rubygems/specification.rb: Removed defined? and initialized
- @platform
-
-2003-11-29 16:08 jimweirich
-
- * lib/rubygems/specification.rb: Initialized @loaded and check
- defined?(@platform) to silence some -w warnings.
-
-2003-11-29 09:26 rich
-
- * bin/gem_server, lib/rubygems/doc_manager.rb: updated to support
- /doc URL to generate list of installed gems w/doc link for rdoc
- generated links.
-
-2003-11-29 08:30 rich
-
- * lib/rubygems/doc_manager.rb: minor format change of error message
-
-2003-11-29 08:29 rich
-
- * bin/gem, lib/rubygems/builder.rb, lib/rubygems/doc_manager.rb,
- lib/rubygems/installer.rb: instantiates DocManager now. errors
- out on no install of RDoc. warns if .gemspec does not specify
- having rdoc, but rdoc is generated
-
-2003-11-29 02:13 rich
-
- * bin/gem, lib/rubygems.rb, lib/rubygems/doc_manager.rb,
- lib/rubygems/format.rb, lib/rubygems/installer.rb,
- lib/rubygems/specification.rb: added capability to generate rdoc
- on install of gem (--gen-rdoc). this doc is placed in
- Gem.dir+doc+gem.full_name fixed but in installer when moving to
- format (not calling each) added doc manager to add/remove
- documenatation (right now only rdoc)
-
-2003-11-29 01:28 rich
-
- * lib/rubygems/specification.rb: should not define the attr_readers
- for requirements/dependencies so undef is unnecessary
-
-2003-11-29 00:12 jimweirich
-
- * lib/rubygems/specification.rb: Undefing dependencies and
- requirements removes warning when used with -w.
-
-2003-11-29 00:12 jimweirich
-
- * lib/rubygems.rb: Using defined?($GEM_PATH) avoids warning when
- used with -w switch.
-
-2003-11-28 15:58 chadfowler
-
- * bin/gem, example/test.gemspec, lib/rubygems.rb,
- lib/rubygems/installer.rb, lib/rubygems/validator.rb,
- lib/rubygems/format.rb: Separated gem file reading into a
- separate class/file.
-
-2003-11-28 15:20 rich
-
- * lib/rubygems/specification.rb: added has_rdoc?/has_rdoc methods
- ... will be used to autogenerate rdoc
-
-2003-11-28 12:30 chadfowler
-
- * lib/rubygems/validator.rb: Rdoc added
-
-2003-11-28 11:51 chadfowler
-
- * bin/gem, lib/rubygems.rb, lib/rubygems/validator.rb: A little
- rearranging of the validation/alien code. It's still ugly, but
- at least it's in its own file now. :)
-
-2003-11-28 11:40 chadfowler
-
- * bin/gem: Removed a little cruft.
-
-2003-11-27 11:04 chadfowler
-
- * bin/gem: Print success message for each gem *not* containing
- errors.
-
-2003-11-27 11:00 chadfowler
-
- * bin/gem, lib/rubygems/installer.rb: Preliminary support for gem
- directory validation (--alien). Looks for bad or missing gem
- files, missing spec files, files installed that aren't part of
- the gem, checksum mismatches, etc.
-
- Very ugly code. Very ugly output. Work in progress.
-
-2003-11-24 11:58 rich
-
- * lib/rubygems/specification.rb: change full_name to include
- platform
-
-2003-11-24 09:15 chadfowler
-
- * bin/gem: Option for HTTP Proxy server for remote-install. Not
- yet implemented.
-
-2003-11-23 20:22 chadfowler
-
- * lib/rubygems/builder.rb: Removed a stray \" in builder's success
- message
-
-2003-11-23 20:16 chadfowler
-
- * lib/rubygems/specification.rb: Leaving escape in but commenting
- out its functionality because it hosed some other things up.
- Need to revisit this for the case where:
-
- s.summary = "Chad's Thing" # It's the apostrophe
-
-2003-11-23 20:08 chadfowler
-
- * lib/rubygems/specification.rb: Escape quotes to avoid invalid
- gemspecs in the #{Gem.dir}/specifications directory
-
-2003-11-23 19:21 chadfowler
-
- * bin/gem: Less ugly error message on file IO problems.
-
-2003-11-22 22:34 chadfowler
-
- * bin/gem: Very simple support for validating a gem. Will probably
- move this into the libs eventually.
-
-2003-11-22 20:53 chadfowler
-
- * example/test.gemspec, lib/rubygems/builder.rb: Generate MD5
- checksum for gem and store it in the file. Will be used to
- validate gem file before installation.
-
-2003-11-22 13:58 chadfowler
-
- * install.rb, lib/rubygems/remote_installer.rb,
- packages/sources/sources.gemspec,
- packages/sources/lib/sources.rb: remote-install sources are now
- installed as a ruby gem at the time of rubygems installation.
- sources gemspec included in the rubygems distribution.
-
-2003-11-22 12:52 chadfowler
-
- * bin/gem: Allow gem info by --version
-
-2003-11-22 11:50 chadfowler
-
- * lib/: rubygems.rb, rubygems/cache.rb: Fixed the bug I introduced
- by fixing Rich's bug with gem cache caching. ;)
-
- Gem::Cache now has a #refresh! method.
-
-2003-11-22 10:16 chadfowler
-
- * bin/gem, lib/rubygems.rb, lib/rubygems/installer.rb,
- lib/rubygems/remote_installer.rb: - Fixed bug in Gem.cache
- (though we may want to revisit it for in-memory caching - Command
- line configurable version for uninstall
-
-2003-11-22 00:28 rich
-
- * lib/rubygems/cache.rb: rdoc'd search method
-
-2003-11-22 00:24 rich
-
- * bin/gem, lib/rubygems/cache.rb, lib/rubygems/version.rb,
- test/test_version_comparison.rb: removed search_by_name because
- search does the same thing. version::requirement was updated to
- that if you did not specific a version operation, it assumes an =
- sign. updated tests accordingly
-
-2003-11-21 23:58 rich
-
- * lib/rubygems/: cache.rb, installer.rb: allow version to be
- specified in uninstall (if called programatically)
-
-2003-11-21 23:52 rich
-
- * lib/: rubygems.rb, rubygems/cache.rb, rubygems/installer.rb,
- rubygems/specification.rb: > moved all searching into cache..and
- now search by name/version and return an
- ordered list (.last == highest version).
- > modified uninstaller to allow selecting a specific version to
- uninstall if
- multiple versions are installed.
- > implemented comparison function on specification.
- > changed require_gem to use new search of cache function
-
-2003-11-21 21:06 chadfowler
-
- * bin/gem, lib/rubygems/remote_installer.rb: Added ability to
- specify optional version requirement for remote installations
-
-2003-11-21 20:25 chadfowler
-
- * test/test_remote_installer.rb: Removed carriage returns
-
-2003-11-21 19:04 chadfowler
-
- * bin/gem_server: Converted from getopts to optparse.
-
-2003-11-21 18:31 rich
-
- * lib/rubygems.rb: changed the order in which operations are
- performed in require_gem. it now requires dependent gems prior
- to adding the require_paths to a gem. otherwise we could have
- had a LoadError on a dependent gem but the paths were already
- added...potential problem
-
-2003-11-21 18:21 rich
-
- * lib/rubygems/installer.rb: updated to ensure
- (specifications/cache) directories exist for a provided path
-
-2003-11-21 18:01 rich
-
- * lib/rubygems/specification.rb: updated rdoc
-
-2003-11-21 17:59 rich
-
- * bin/gem, lib/rubygems/builder.rb, lib/rubygems/installer.rb,
- lib/rubygems/specification.rb: fixed various bugs with the
- $GEM_PATH stuff, specifically on uninstall. Also, changed to
- allow specifying a directory on install (--dir) and force install
- (--force). Changed the builder generated ruby header to use
- optparse.
-
-2003-11-21 07:03 chadfowler
-
- * lib/: rubygems.rb, rubygems/cache.rb,
- rubygems/remote_installer.rb: Remote installation of dependencies
- now works. It downloads all dependent gems or errors out.
-
- Fixed bug in require_gem. Wrong call to cache.
-
-2003-11-21 00:59 rich
-
- * bin/gem, example/test.gemspec, lib/rubygems.rb,
- lib/rubygems/cache.rb, lib/rubygems/installer.rb,
- lib/rubygems/specification.rb: added capability to support
- multiple paths $GEM_PATH in Ruby and RUBY_GEMS in the ARGV. Lots
- of changes were needed to support this. also added the --force
- and --dir options to gem installtion
-
-2003-11-20 22:50 chadfowler
-
- * bin/gem: Switched to optparse. Not a whole lot gained, but it
- seems to be the way Ruby is going. It's nice not to have to do
- the "when" stuff, I guess.
-
-2003-11-19 23:41 chadfowler
-
- * lib/rubygems/: installer.rb, remote_installer.rb: Added
- chadfowler.com to the hardcoded remote install list.
-
- Fixed a dangling YAML.load that broke uninstall.
-
-2003-11-19 22:56 rich
-
- * lib/rubygems.rb: fixed bug in loading rubygems
-
-2003-11-19 22:51 chadfowler
-
- * bin/: gem_server, gem_server.cgi: require 'yaml' :)
-
-2003-11-19 22:44 rich
-
- * lib/: rubygems.rb, rubygems/cache.rb, rubygems/specification.rb:
- changed the format of stuff stored in the spec directory to ruby
- instead of YAML. This allows us to not have to load yaml in
- 'require_gem'. switched the specification list to a Cache
- object.
-
-2003-11-19 21:56 rich
-
- * lib/rubygems/installer.rb: write the spec file in ruby and not in
- yaml format (in the spec dir)
-
-2003-11-19 20:32 rich
-
- * lib/rubygems/specification.rb: added to_ruby method to generate a
- ruby string that can be eval'ed in to build a Gem Specification
-
-2003-11-17 21:37 jimweirich
-
- * bin/: gem_server, gem_server.cgi: removed carriage returns
-
-2003-11-17 21:19 chadfowler
-
- * install.rb: Accidentally left some junk in the file.
-
-2003-11-17 19:50 dblack
-
- * test/test_version_comparison.rb: * Test cases for Version.rb
-
-2003-11-17 19:50 dblack
-
- * lib/rubygems/version.rb: * Split off tests into
- rubygems/tests/test_version_comparison.rb
-
-2003-11-17 12:37 chadfowler
-
- * install.rb: Create File.join(Config::CONFIG['libdir'], "ruby",
- "gems") + "specifications" and + "cache" during installation.
-
- Need to remove this from rubygems.rb and replace with
- ensure_directory call.
-
-2003-11-17 12:29 rich
-
- * lib/rubygems/version.rb: rdoc added
-
-2003-11-17 11:31 rich
-
- * lib/rubygems/specification.rb: rdoc added
-
-2003-11-17 10:38 rich
-
- * lib/rubygems/: cache.rb, installer.rb: made rdoc comments and
- renamed some variables
-
-2003-11-17 08:48 dblack
-
- * lib/rubygems/version.rb: * Added stricter checking of incoming
- Requirement string
-
- * Added unit tests at end of file
-
-2003-11-17 07:32 chadfowler
-
- * bin/: gem_server, gem_server.cgi: Refactored gem_server program
- and added an equivalent CGI version.
-
-2003-11-17 00:14 rich
-
- * lib/: rubygems.rb, rubygems/builder.rb, rubygems/cache.rb: added
- rdoc documentation
-
-2003-11-16 17:15 chadfowler
-
- * bin/: gem.cmd, gem_server.cmd: Added some batch files for Windows
-
-2003-11-16 17:08 rich
-
- * install.rb, bin/gem, bin/gem_server, example/test.gemspec,
- example/lib/test.rb, example/lib/test/wow.rb, lib/rubygems.rb,
- lib/rubygems/builder.rb, lib/rubygems/cache.rb,
- lib/rubygems/installer.rb, lib/rubygems/remote_installer.rb,
- lib/rubygems/specification.rb, lib/rubygems/version.rb,
- test/test_remote_installer.rb: Initial import developed at
- RubyConf 2003 by:
-
- Rich Kilmer Chad Fowler David Black Paul Brannon Jim Weirich
-
-2003-11-16 17:08 rich
-
- * install.rb, bin/gem, bin/gem_server, example/test.gemspec,
- example/lib/test.rb, example/lib/test/wow.rb, lib/rubygems.rb,
- lib/rubygems/builder.rb, lib/rubygems/cache.rb,
- lib/rubygems/installer.rb, lib/rubygems/remote_installer.rb,
- lib/rubygems/specification.rb, lib/rubygems/version.rb,
- test/test_remote_installer.rb: Initial revision
-
-Local variables:
-indent-tabs-mode: t
-tab-width: 8
-end:
diff --git a/doc/rubygems/History.txt b/doc/rubygems/History.txt
deleted file mode 100644
index 4a80b1bfb4..0000000000
--- a/doc/rubygems/History.txt
+++ /dev/null
@@ -1,852 +0,0 @@
-# -*- coding: utf-8 -*-
-
-=== 1.3.6 / 2010-02-17
-
-NOTE:
-
-http://rubygems.org is now the default source for downloading gems.
-
-You may have sources set via ~/.gemrc, so you should replace
-http://gems.rubyforge.org with http://rubygems.org
-
-http://gems.rubyforge.org will continue to work for the forseeable future.
-
-New features:
-
-* `gem` commands
- * Added `gem push` and `gem owner` for interacting with modern/Gemcutter
- sources
- * `gem dep` now supports --prerelease.
- * `gem fetch` now supports --prerelease.
- * `gem server` now supports --bind. Patch #27357 by Bruno Michel.
- * `gem rdoc` no longer overwrites built documentation. Use --overwrite
- force rebuilding. Patch #25982 by Akinori MUSHA.
-* Captial letters are now allowed in prerelease versions.
-
-Bug fixes:
-
-* Development deps are no longer added to rubygems-update gem so older
- versions can update sucessfully.
-* Installer bugs:
- * Prerelease gems can now depend on non-prerelease gems.
- * Development dependencies are ignored unless explicitly needed. Bug #27608
- by Roger Pack.
-* `gem` commands
- * `gem which` now fails if no paths were found. Adapted patch #27681 by
- Caio Chassot.
- * `gem server` no longer has invalid markup. Bug #27045 by Eric Young.
- * `gem list` and friends show both prerelease and regular gems when
- --prerelease --all is given
-* Gem::Format no longer crashes on empty files. Bug #27292 by Ian Ragsdale.
-* Gem::GemPathSearcher handles nil require_paths. Patch #27334 by Roger Pack.
-* Gem::RemoteFetcher no longer copies the file if it is where we want it.
- Patch #27409 by Jakub Šťastný.
-
-Deprecation Notices:
-
-* lib/rubygems/timer.rb has been removed.
-* Gem::Dependency#version_requirements is deprecated and will be removed on or
- after August 2010.
-* Bulk index update is no longer supported.
-* Gem::manage_gems was removed in 1.3.3.
-* Time::today was removed in 1.3.3.
-
-=== 1.3.5 / 2009-07-21
-
-Bug fixes:
-
-* Fix use of prerelease gems.
-* Gem.bin_path no longer escapes path with spaces. Bug #25935 and #26458.
-
-Deprecation Notices:
-
-* Bulk index update is no longer supported (the code currently remains, but not
- the tests)
-* Gem::manage_gems was removed in 1.3.3.
-* Time::today was removed in 1.3.3.
-
-=== 1.3.4 / 2009-05-03
-
-Bug Fixes:
-
-* Fixed various warnings
-* Gem::ruby_version works correctly for 1.8 branch and trunk
-* Prerelease gems now show up in `gem list` and can be used
-* Fixed option name for `gem setup --format-executable`
-* RubyGems now matches Ruby > 1.9.1 gem paths
-* Gem::RemoteFetcher#download now works for explicit Windows paths across
- drives. Bug #25882 by Lars Christensen
-* Fix typo in Gem::Requirement#parse. Bug #26000 by Mike Gunderloy.
-
-Deprecation Notices:
-
-* Bulk index update is no longer supported (the code currently remains, but not
- the tests)
-* Gem::manage_gems was removed in 1.3.3.
-* Time::today was removed in 1.3.3.
-
-=== 1.3.3 / 2009-05-04
-
-New Features:
-
-* `gem server` allows port names (from /etc/services) with --port.
-* `gem server` now has search that jumps to RDoc. Patch #22959 by Vladimir
- Dobriakov.
-* `gem spec` can retrieve single fields from a spec (like `gem spec rake
- authors`).
-* Gem::Specification#has_rdoc= is deprecated and ignored (defaults to true)
-* RDoc is now generated regardless of Gem::Specification#has_rdoc?
-
-Bug Fixes:
-
-* `gem clean` now cleans up --user-install gems. Bug #25516 by Brett
- Eisenberg.
-* Gem.bin_path now escapes paths with spaces.
-* Rake extension builder uses explicit correctly loads rubygems when invoking
- rake.
-* Prerelease versions now match "~>" correctly. Patch #25759 by Yossef
- Mendelssohn.
-* Check bindir for executables, not root when validating. Bug reported by
- David Chelimsky.
-* Remove Time.today, no way to override it before RubyGems loads. Bug #25564
- by Emanuele Vicentini
-* Raise Gem::Exception for #installation_path when not installed. Bug #25741
- by Daniel Berger.
-* Don't raise in Gem::Specification#validate when homepage is nil. Bug #25677
- by Mike Burrows.
-* Uninstall executables from the correct directory. Bug #25555 by Brett
- Eisenberg.
-* Raise Gem::LoadError if Kernel#gem fails due to previously-loaded gem. Bug
- reported by Alf Mikula.
-
-Deprecation Notices:
-
-* Gem::manage_gems has been removed.
-* Time::today has been removed early. There was no way to make it warn and be
- easy to override with user code.
-
-=== 1.3.2 / 2009-04-15
-
-Select New Features:
-
-* RubyGems now loads plugins from rubygems_plugin.rb in installed gems.
- This can be used to add commands (See Gem::CommandManager) or add
- install/uninstall hooks (See Gem::Installer and Gem::Uninstaller).
-* Gem::Version now understands prerelease versions using letters. (eg.
- '1.2.1.b') Thanks to Josh Susser, Alex Vollmer and Phil Hagelberg.
-* RubyGems now includes a Rake task for creating gems which replaces rake's
- Rake::GemPackageTask. See Gem::PackageTask.
-* Gem::find_files now returns paths in $LOAD_PATH.
-* Added Gem::promote_load_path for use with Gem::find_files
-* Added Gem::bin_path to make finding executables easier. Patch #24114 by
- James Tucker.
-* Various improvements to build arguments for installing gems.
-* `gem contents` added --all and --no-prefix.
-* Gem::Specification
- * #validate strips directories and errors on not-files.
- * #description no longer removes newlines.
- * #name must be a String.
- * FIXME and TODO are no longer allowed in various fields.
- * Added support for a license attribute. Feature #11041 (partial).
- * Removed Gem::Specification::list, too much process growth. Bug #23668 by
- Steve Purcell.
-* `gem generate_index`
- * Can now generate an RSS feed.
- * Modern indicies can now be updated incrementally.
- * Legacy indicies can be updated separately from modern.
-
-Select Bugs Fixed:
-
-* Better gem activation error message. Patch #23082.
-* Kernel methods are now private. Patch #20801 by James M. Lawrence.
-* Fixed various usability issues with `gem check`.
-* `gem update` now rescues InstallError and continues. Bug #19268 by Gabriel
- Wilkins.
-* Allow 'https', 'file' as a valid schemes for --source. Patch #22485.
-* `gem install`
- * Now removes existing path before installing. Bug #22837.
- * Uses Gem::bin_path in executable stubs to work around Kernel#load bug in
- 1.9.
- * Correctly handle build args (after --) via the API. Bug #23210.
-* --user-install
- * `gem install --no-user-install` now works. Patch #23573 by Alf Mikula.
- * `gem uninstall` can now uninstall from ~/.gem. Bug #23760 by Roger Pack.
-* setup.rb
- * Clarify RubyGems RDoc installation location. Bug #22656 by Gian Marco
- Gherardi.
- * Allow setup to run from read-only location. Patch #21862 by Luis Herrera.
- * Fixed overwriting ruby executable when BASERUBY was not set. Bug #24958
- by Michael Soulier.
- * Ensure we're in a RubyGems dir when installing.
- * Deal with extraneous quotation mark when autogenerating .bat file on MS
- Windows. Bug #22712.
-
-Deprecation Notices:
-
-* Gem::manage_gems has been removed.
-* Time::today will be removed in RubyGems 1.4.
-
-Special thanks to Chad Wooley for backwards compatibility testing and Luis
-Lavena and Daniel Berger for continuing windows support.
-
-=== 1.3.1 / 2008-10-28
-
-Bugs fixed:
-
-* Disregard ownership of ~ under Windows while creating ~/.gem. Fixes
- issues related to no uid support under Windows.
-* Fix requires for Gem::inflate, Gem::deflate, etc.
-* Make Gem.dir respect :gemhome value from config. (Note: this feature may be
- removed since it is hard to implement on 1.9.)
-* Kernel methods are now private. Patch #20801 by James M. Lawrence.
-* Gem::location_of_caller now behaves on Windows. Patch by Daniel Berger.
-* Silence PATH warning.
-
-Deprecation Notices:
-
-* Gem::manage_gems will be removed on or after March 2009.
-
-=== 1.3.0 / 2008-09-25
-
-New features:
-
-* RubyGems doesn't print LOCAL/REMOTE titles for `gem query` and friends if
- stdout is not a TTY, except with --both.
-* Added Gem.find_files, allows a gem to discover features provided by other
- gems.
-* Added pre/post (un)install hooks for packagers of RubyGems. (Not for gems
- themselves).
-* RubyGems now installs gems into ~/.gem if GEM_HOME is not writable. Use
- --no-user-install command-line switch to disable this behavior.
-* Fetching specs for update now uses If-Modified-Since requests.
-* RubyGems now updates the ri cache when the rdoc gem is installed and
- documentation is generated.
-
-Deprecation Notices:
-
-* Gem::manage_gems now warns when called. It will be removed on or after March
- 2009.
-
-Bugs Fixed:
-
-* RubyGems 1.3.0+ now updates when no previous rubygems-update is installed.
- Bug #20775 by Hemant Kumar.
-* RubyGems now uses the regexp we already have for `gem list --installed`. Bug
- #20876 by Nick Hoffman.
-* Platform is now forced to Gem::Platform::RUBY when nil or blank in the
- indexer. Fixes various uninstallable gems.
-* Handle EINVAL on seek. Based on patch in bug #20791 by Neil Wilson.
-* Fix HTTPS support. Patch #21072 by Alex Arnell.
-* RubyGems now loads all cache files even if latest has been loaded. Bug
- #20776 by Uwe Kubosch.
-* RubyGems checks for support of development dependencies for #to_ruby. Bug
- #20778 by Evan Weaver.
-* Now specifications from the future can be loaded.
-* Binary script uninstallation fixed. Bug #21234 by Neil Wilson.
-* Uninstallation with -i fixed. Bug #20812 by John Clayton.
-* Gem::Uninstaller#remove_all now calls Gem::Uninstaller#uninstall_gem so hooks
- get called. Bug #21242 by Neil Wilson.
-* Gem.ruby now properly escaped on windows. Fixes problem with extension
- compilation.
-* `gem lock --strict` works again. Patch #21814 by Sven Engelhardt.
-* Platform detection for Solaris was improved. Patch #21911 by Bob Remeika.
-
-Other Changes Include:
-
-* `gem help install` now describes _version_ argument to executable stubs
-* `gem help environment` describes environment variables and ~/.gemrc and
- /etc/gemrc
-* On-disk gemspecs are now read in UTF-8 and written with a UTF-8 magic comment
-* Rakefile
- * If the SETUP_OPTIONS environment variable is set, pass its contents as
- arguments to setup.rb
-* lib/rubygems/platform.rb
- * Remove deprecated constant warnings and really deprecate them. (WIN32,
- etc).
-* lib/rubygems/remote_fetcher.rb
- * Now uses ~/.gem/cache if the cache dir in GEM_HOME is not writable.
-* lib/rubygems/source_index.rb
- * Deprecate options to 'search' other than Gem::Dependency instances and
- issue warning until November 2008.
-* setup.rb
- * --destdir folder structure now built using Pathname, so it works for
- Windows platforms.
-* test/*
- * Fixes to run tests when under test/rubygems/. Patch by Yusuke ENDOH
- [ruby-core:17353].
-* test/test_ext_configure_builder.rb
- * Locale-free patch by Yusuke Endoh [ruby-core:17444].
-
-=== 1.2.0 / 2008-06-21
-
-New features:
-
-* RubyGems no longer performs bulk updates and instead only fetches the gemspec
- files it needs. Alternate sources will need to upgrade to RubyGems 1.2 to
- allow RubyGems to take advantage of the new metadata updater. If a pre 1.2
- remote source is in the sources list, RubyGems will revert to the bulk update
- code for compatibility.
-* RubyGems now has runtime and development dependency types. Use
- #add_development_dependency and #add_runtime_dependency. All typeless
- dependencies are considered to be runtime dependencies.
-* RubyGems will now require rubygems/defaults/operating_system.rb and
- rubygems/defaults/#{RBX_ENGINE}.rb if they exist. This allows packagers and
- ruby implementers to add custom behavior to RubyGems via these files. (If
- the RubyGems API is insufficient, please suggest improvements via the
- RubyGems list.)
-* /etc/gemrc (and windows equivalent) for global settings
-* setup.rb now handles --vendor and --destdir for packagers
-* `gem stale` command that lists gems by last access time
-
-Bugs Fixed:
-
-* File modes from gems are now honored, patch #19737
-* Marshal Gem::Specification objects from the future can now be loaded.
-* A trailing / is now added to remote sources when missing, bug #20134
-* Gems with legacy platforms will now be correctly uninstalled, patch #19877
-* `gem install --no-wrappers` followed by `gem install --wrappers` no longer
- overwrites executables
-* `gem pristine` now forces reinstallation of gems, bug #20387
-* RubyGems gracefully handles ^C while loading .gemspec files from disk, bug
- #20523
-* Paths are expanded in more places, bug #19317, bug #19896
-* Gem::DependencyInstaller resets installed gems every install, bug #19444
-* Gem.default_path is now honored if GEM_PATH is not set, patch #19502
-
-Other Changes Include:
-
-* setup.rb
- * stub files created by RubyGems 0.7.x and older are no longer removed. When
- upgrading from these ancient versions, upgrade to 1.1.x first to clean up
- stubs.
- * RDoc is no longer required until necessary, patch #20414
-* `gem server`
- * Now completely matches the output of `gem generate_index` and
- has correct content types
- * Refreshes from source directories for every hit. The server will no longer
- need to be restarted after installing gems.
-* `gem query --details` and friends now display author, homepage, rubyforge url
- and installed location
-* `gem install` without -i no longer reinstalls dependencies if they are in
- GEM_PATH but not in GEM_HOME
-* Gem::RemoteFetcher now performs persistent connections for HEAD requests,
- bug #7973
-
-=== 1.1.1 / 2008-04-11
-
-Bugs Fixed:
-
-* Gem.prefix now returns non-nil only when RubyGems was installed outside
- sitelibdir or libdir.
-* The `gem server` gem list now correctly links to gem details.
-* `gem update --system` now passes --no-format-executable to setup.rb.
-* Gem::SourceIndex#refresh! now works with multiple gem repositories.
-* Downloaded gems now go into --install-dir's cache directory.
-* Various fixes to downloading gem metadata.
-* `gem install --force` now ignores network errors too.
-* `gem pristine` now rebuilds extensions.
-* `gem update --system` now works on virgin Apple ruby.
-* Gem::RemoteFetcher handles Errno::ECONNABORTED.
-* Printing of release notes fixed.
-
-=== 1.1.0 / 2008-03-29
-
-New features:
-
-* RubyGems now uses persistent connections on index updates. Index updates are
- much faster now.
-* RubyGems only updates from a latest index by default, cutting candidate gems
- for updates to roughly 1/4 (at present). Index updates are even faster
- still.
- * `gem list -r` may only show the latest version of a gem, add --all to see
- all gems.
-* `gem spec` now extracts specifications from .gem files.
-* `gem query --installed` to aid automation of checking for gems.
-
-Bugs Fixed:
-
-* RubyGems works with both Config and RbConfig now.
-* Executables are now cleaned upon uninstall.
-* You can now uninstall from a particular directory.
-* Updating from non-default sources fixed.
-* Executable stubs now use ruby install name in shebang.
-* `gem unpack` checks every directory in Gem.path now.
-* `gem install` now exits with non-zero exit code when appropriate.
-* `gem update` only updates gems that need updates.
-* `gem update` doesn't force remote-only updates.
-* `gem update` handles dependencies properly when updating.
-* Gems are now loaded in Gem.path order.
-* Gem stub scripts on windows now work outside Gem.bindir.
-* `gem sources -r` now works without network access.
-
-Other Changes Include:
-
-* RubyGems now requires Ruby > 1.8.3.
-* Release notes are now printed upon installation.
-* `gem env path` now prints a usable path.
-* `gem install` reverts to local-only installation upon network error.
-* Tar handling code refactoring and cleanup.
-* Gem::DependencyInstaller's API has changed.
-
-For a full list of changes to RubyGems, see the ChangeLog file.
-
-=== 1.0.1 / 2007-12-20
-
-Bugs Fixed:
-
-* Installation on Ruby 1.8.3 through 1.8.5 fixed
-* `gem build` on 1.8.3 fixed
-
-Other Changes Include:
-
-* Since RubyGems 0.9.5, RubyGems is no longer supported on Ruby 1.8.2 or older,
- this is official in RubyGems 1.0.1.
-
-=== 1.0.0 / 2007-12-20
-
-Major New Features Include:
-
-* RubyGems warns about various problems with gemspecs during gem building
-* More-consistent versioning for the RubyGems software
-
-Other Changes Include:
-
-* Fixed various bugs and problems with installing gems on Windows
-* Fixed using `gem server` for installing gems
-* Various operations are even more verbose with --verbose
-* Built gems are now backwards compatible with 0.9.4
-* Improved detection of RUBYOPT loading rubygems
-* `ruby setup.rb` now has a --help option
-* Gem::Specification#bindir is now respected on installation
-* Executable stubs can now be installed to match ruby's name, so if ruby is
- installed as 'ruby18', foo_exec will be installed as 'foo_exec18'
-* `gem unpack` can now unpack into a specific directory with --target
-* OpenSSL is no longer required by default
-
-Deprecations and Deletions:
-
-* Kernel#require_gem has been removed
-* Executables without a shebang will not be wrapped in a future version, this
- may cause such executables to fail to operate on installation
-* Gem::Platform constants other than RUBY and CURRENT have been removed
-* Gem::RemoteInstaller was removed
-* Gem::Specification#test_suite_file and #test_suite_file= are deprecated in
- favor of #test_file and #test_file=
-* Gem::Specification#autorequire= has been deprecated
-* Time::today will be removed in a future version
-
-=== 0.9.5 / 2007-11-19
-
-Major New Features Include:
-
-* Platform support
-* Automatic installation of platform gems
-* New bandwidth and memory friendlier index file format
-* "Offline" mode (--no-update-sources)
-* Bulk update threshold can be specified (-B, --bulk-threshold)
-* New `gem fetch` command
-* `gem` now has "really verbose" output when you specify -v
-* Improved stubs and `gem.bat` on mswin, including better compatiblity
- with the One-Click Installer.
-
-Other Changes Include:
-
-* Time::today is deprecated and will be removed at a future date
-* Gem::manage_gems is deprecated and will be removed at a future date
-* `gem install --include-dependencies` (-y) is now deprecated since it is the
- default, use --ignore-dependencies to turn off automatic dependency
- installation
-* Multi-version diamond dependencies only are installed once
-* Processing a YAML bulk index update takes less memory
-* `gem install -i` makes sure all depenencies are installed
-* `gem update --system` reinstalls into the prefix it was originally installed
- in
-* `gem update --system` respects --no-rdoc and --no-ri flags
-* HTTP basic authentication support for proxies
-* Gem::Specification#platforms should no longer be a String, use
- Gem::Platform::CURRENT when building binary gems instead
-* `gem env` has more diagnostic information
-* require 'rubygems' loads less code
-* sources.gem is gone, RubyGems now uses built-in defaults
-* `gem install --source` will no longer add --source by default, use `gem
- sources --add` to make it a permanent extra source
-* `gem query` (list) no longer prints details by default
-* Exact gem names are matched in various places
-* mkrf extensions are now supported
-* A gem can depend on a specific RubyGems version
-* `gem_server` is now `gem server`
-* `gemlock` is now `gem lock`
-* `gem_mirror` is now `gem mirror`
-* `gemwhich` is now `gem which`
-* `gemri` is no longer included with RubyGems
-* `index_gem_repository.rb` is now `gem generate_index`
-* `gem` performs more validation of parameters
-* Custom rdoc styles are now supported
-* Gem indexer no longer removes quick index during index creation
-* Kernel#require only rescues a LoadError for the file being required now
-* `gem dependencies` can now display some information for remote gems
-* Updating RubyGems now works with RUBYOPT=-rubygems
-
-Special thanks to:
-
-* Daniel Berger
-* Luis Lavena
-* Tom Copeland
-* Wilson Bilkovich
-
-=== 0.9.4 / 2007-05-23
-
-If you are experiencing problems with the source index (e.g. strange
-"No Method" errors), or problems with zlib (e.g. "Buffer Error"
-messsage), we recommend upgrading to RubyGems 0.9.4.
-
-Bug Fixes Include:
-
-* Several people have been experiencing problems with no method errors
- on the source index cache. The source index cache is now a bit more
- self healing. Furthermore, if the source index cache is
- irreparable, then it is automatically dropped and reloaded.
-* The source cache files may now be dropped with the "gem sources
- --clear-all" command. (This command may require root is the system
- source cache is in a root protected area).
-* Several sub-commands were accidently dropped from the "gem" command.
- These commands have been restored.
-
-=== 0.9.3 / 2007-05-10
-
-Bug Fixes Include:
-
-The ZLib library on Windows will occasionally complains about a buffer error
-when unpacking gems. The Gems software has a workaround for that problem, but
-the workaround was only enabled for versions of ZLib 1.2.1 or earlier. We
-have received several reports of the error occuring with ZLib 1.2.3, so we
-have permanently enabled the work around on all versions.
-
-=== 0.9.2 / 2007-02-05
-
-Bug Fixes Include:
-
-* The "unpack" command now works properly.
-* User name and password are now passed properly to the authenticating
- proxy when downloading gems.
-
-=== 0.9.1 / 2007-01-16
-
-See ChangeLog
-
-=== 0.9.0 / 2006-06-28
-
-Finally, the much anticipated RubyGems version 0.9.0 is now available.
-This release includes a number of new features and bug fixes. The
-number one change is that we can now download the gem index
-incrementally. This will greatly speed up the gem command when only a
-few gems are out of date.
-
-Major Enhancments include:
-
-* The gem index is now downloaded incrementally, only updating entries
- that are out of date. If more than 50 entries are out of date, we
- revert back to a bulk download.
-* Several patches related to allowing RubyGems to work with
- authenticating proxies (from Danie Roux and Anatol Pomozov). Just
- put the user and password in the proxy URL (e.g. -p
- http://user:password@proxy.address.com:8080) or use the
- HTTP_PROXY_USER and HTTP_PROXY_PASS environment variables.
-* The gem unpack command can now accept a file path rather than just a
- install gem name.
-* Both RI and RDOC documents are now generated by default.
-* A gemri command is included to read gem RI docs (only needed for
- Ruby 1.8.4 or earlier).
-
-Minor enhancements include:
-
-* Verison 0.0.0 is now a valid gem version.
-* Better detection of missing SSL functionality.
-* SSL is not required if the security policy does not require
- signature checking.
-* Rake built extensions are now supported (Tilman Sauerbeck).
-* Several autorequire bug fixes.
-* --traceback is now an alias for --backtrace (I can never remember
- which one it is).
-* SAFE=1 compatibility fixes.
-* .rbw is now a supported suffix for RubyGem's custom require.
-* Several Ruby 1.9 compatibility fixes (Eric Hodel).
-
-Bug Fixes:
-
-* Added dashes to gemspecs generated in Ruby 1.8.3. This solves some
- cross-Ruby version compatibility issues.
-* Fixed bug where the wrong executables could be uninstalled (Eric
- Hodel).
-* Fixed bug where gem unpack occasionally unpacked the wrong gem.
-* Fixed bug where a fatal error occured when permissions on .gemrc
- were too restrictive (reported by Luca Pireddu).
-* Fixed prefix handling for native expressions (patch by Aaron Patterson).
-* Fixed several Upgrade => Update typos.
-
-=== 0.8.11 / 2005-07-13
-
-* -y is a synonym for --include-dependencies.
-* Better handling of errors in the top level rescue clause.
-* Package list command (e.g. gem inspect GEM).
-* .gemrc now allows cvsrc-like options to set defaults per subcommand.
-* The autorequire gem spec field will now accept a list.
-* Substituted Time for Date in specs, increasing performance
- dramatically.
-* Fixed reported bug of gem directories ending in "-" (reported by
- Erik Hatcher).
-* Fixed but in installer that caused dependency installation to not
- work.
-* Added Paul Duncan's gem signing patch.
-* Added Mark Hubbart's Framework patch (for better integration with OS
- X).
-* Added David Glasser's install-from-mirror patch.
-* Additional internal structural cleanup and test reorganization.
-
-=== 0.8.10 / 2005-03-27
-
-* In multi-user environments, it is common to supply mulitple versions of gems
- (for example Rails), allowing individual users to select the version of the
- gem they desire. This allows a user to be insulated from updates to that
- gem. RubyGems 0.8.10 fixes a problem where gems could occasionally become
- confused about the current versions of libraries selected by the user.
-* The other annoying bug is that if there are any existing rubygems-update gems
- installed, then the "gem update --system" command will download a new
- update, but install the latest update prior to the download.
-
-=== 0.8.9
-
-Never released
-
-=== 0.8.8 / 2005-03-14
-
-* Moved the master definition of class Requirement back under version.
- Kept the body of Requirement under Gem.
-
-=== 0.8.7 / 2005-03-14
-
-Even though it has only been a few weeks since that last release,
-there are quite a number of new features in 0.8.7. A complete list of
-new features will be given below, but here is a summary of the hot
-items.
-
-* The bug that prevented some users from installing rails has been
- squashed. A big thanks to Bill Guindon (aGorilla) for helping track
- that one down.
-
-There are several new commands available on the gem command:
-
-* gem cleanup GEMNAME -- Cleanup (uninstall) all the old versions of
- gem. If the gem name is omitted, the entire repository is cleaned.
-* gem dependency GEMNAME -- Show the dependencies for the named gems.
- This is really helpful when trying to figure out what gem needs what
- other gem.
-
-There changes to the existing commands as well.
-
-* gem uninstall is much smarter about removing gems from the
- repository. Lists of gems are now uninstalled in proper dependency
- order (ie. if A depends on B, A is uninstalled first). Also,
- warnings about broken dependencies occur only when removing the
- *last* gem that supports a dependency is removed.
-
-Both gem install and gem uninstall support some new command line
-options that can reduce the amount of yes/no queries given the user.
-For install we have:
-
-* --ignore-dependencies -- Only install requests gems, no
- dependendecies are automatically installed.
-* --include-dependencies -- Automatically install dependencies,
- without confirmation.
-
-For gem uninstall, the new options are:
-
-* --all -- Uninstall all matching gems without confirmation.
-* --ignore-dependencies -- Uninstall, even if dependencies are broken.
-* --executables -- Remove executables without confirmation
-
-Under general cleanup, gems will not, by default, run RDoc on packages
-that do not have the RDoc flag set.
-
-And finally there is a new library file 'gemconfigure' to aid in
-writing version sensitive applications (without undue dependencies on
-RubyGems); and 'gemwhich', a short script to locate libraries in the
-file system. You can read more about them here:
-
-* gemconfigure: http://docs.rubygems.org/read/chapter/4#page73
-* gemwhich: http://docs.rubygems.org/read/chapter/17
-
-=== 0.8.6 / 2005-02-27
-
-* Fixed a small bug with shebang construction
-
-=== 0.8.5 / 2005-02-26
-
-Do you know how you used to dread getting the following message while
-installing gems?
-
- Updating Gem source index for: http://gems.rubyforge.org
-
-It could take up to 30 seconds (on my machine, even worse on others) for
-that crazy source index to update.
-
-This latest release of RubyGems speeds that wait time up considerably.
-The following table gives the following times for installing RedCloth
-with a required source index update on three system we had available to
-us. No RDoc generation was included in the following times.
-
- RubyGems Linux Mac OSX Windows
- 0.8.4 33 secs 73 secs 58 secs
- 0.8.5 8 secs 14 secs 21 secs
-
-The new caching code is at least 3x faster than previous versions. Woo
-Hoo!
-
-=== 0.8.4 / 2005-01-01
-
-* Rubygems 0.8.3's installer was broken unless you already had an older
- version of RubyGems installed. That's fixed.
-* Change in the way Gem::Specification internally deals with lazy attributes
- and defaults, bringing (with some loadpath_manager changes) a fairly
- significant increase in speed.
-* Support for lower-cased Gem file names (for you, Paul Duncan :)
-* Erik Veenstra's patch for making Gem versions sortable.
-
-=== 0.8.3 / 2004-12-07
-
-No real earth shattering news here, but there were a number of really
-annoying issues involving other libraries that RubyGems depends upon.
-0.8.3 contains some workarounds for these issues. In particular:
-
-* Added workaround for the null byte in Dir string issue. (see
- http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/121702).
- (Thanks to Mauricio Fernández for the quick response on this one).
-* Added workaround for old version of Zlib on windows that caused
- Ruwiki to fail to install. (see
- http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/121770)
-* Added workaround for large YAML file issues. (We dynamically cut
- down the size of the source index YAML file and seem to have worked
- around immediate issues.
-
-There has been some minor usability enhancements and changes ...
-
-* A user specific source index cache can be used when the site-wide
- cache is unwritable (i.e. because you are running as a non-admin).
- This *greatly* speeds up gem commands run in non-admin mode when the
- site-wide cache is out of date.
-* The gem command now used an HTTP HEAD command to detect if the
- server's source index needs to be downloaed.
-* gem check gemname --test will run unit tests on installed gems that
- have unit tests.
-* Multiple gem names are allowed on the gem install command line.
- This means you can do:
-
- gem install rake rails needle postgres-pr pimki
-
- (Ok, you get the idea)
-* Multiple authors my be specified in a Gem spec.
-* Switched to using setup.rb (rather than a custom install script) for
- the installation of RubyGems itself. If you have installed RubyGems
- before, double check the installation instructions and make sure you
- use setup.rb instead of install.rb.
-* Ryan Davis has provided a patch so you can use an env variable
- (GEM_SKIP), to tell loadpath_manager not to load gems of those
- names. This was useful for him while testing libs that he had in
- development.
-
-=== 0.8.1 / 2009-09-14
-
-* Quick release to capture some bug fixes.
-
-=== 0.8.0 / 2009-09-12
-
-* Remove need for library stubs. Set the RUBYOPT environment variable to
- include "rrubygems", and a normal require will find gem files. Continue to
- use 'require_gem gem_name, version' to specify gem versions.
-* Deprecated "test_suite_file" gemspec attribute in favor of "test_files" array.
-* Generates rdoc by default on installs.
-* Adopted tar/gzip file format, thanks to Mauricio Fernandez.
-* "gem rdoc" allows generation of rdoc after gem installation (will add a "gem
- test"
-* Application stubs can now accept an optional parameter of _VERSION_ that will
- run an arbitrary version of the application requested.
-* Various bug fixes
-* Various platform-independency improvements
-* "gem spec --all" displays spec info for all installed version of a given gem.
-* Dynamic caching of sources
-* Support for user-definable sources on the command line (thanks Assaph Mehr)
-* More intelligent support for platform-dependent gems. Use Platform::CURRENT
- when building a gem to set its platform to the one you're building on.
- Installation displays a choice of platform-dependent gems, allowing the user
- to pick.
-* Added "gem unpack" for "unpacking" a gem to the current directory
-
-=== 0.7.0 / 2004-07-09
-
-See ChangeLog
-
-=== 0.6.0 / 2004-06-08
-
-* Collapse output of --search and --list (and gem_server) operations so that
- each gem is listed only once, with each of its versions listed on the same
- line.
-* bin/gem: new --upgrade-all option allows one to upgrade every installed gem
-* new #required_ruby_version attribute added to gem specification for
- specifying a dependency on which version of ruby the gem needs. Format it
- accepts is the same as the Gem::Version::Requirement format:
-
- spec.required_ruby_version = "> 1.8.0"
-* --install-stub defaults to true, so library stubs are created
-
-=== 0.5.0 / 2004-06-06
-
-* Jim added the ability to specify version constraints to avoid API
- incompatibilities. This has been the subject of much debate for the past
- couple of months, with many ideas and code contributed by Eivind Eklund and
- Mauricio Fernandez. The following set of assertions shows how it works:
-
- assert_inadequate("1.3", "~> 1.4")
- assert_adequate( "1.4", "~> 1.4")
- assert_adequate( "1.5", "~> 1.4")
- assert_inadequate("2.0", "~> 1.4") # This one is key--the new operator
- # disallows major version number
- # differences.
-* Group gem search output when multiple versions exist for a given gem:
-
- activerecord (0.7.8, 0.7.7, 0.7.6, 0.7.5)
- Implements the ActiveRecord pattern for ORM.
-* Add arbitrary RDoc-able files via gemspec (not just Ruby source files) for
- people who have, for example, README.rdoc in their distributions. Add to
- gemspec via: spec.extra_rdoc_files = ["list", "of", "files"]. Ruby files are
- automatically included.
-* Some small bug fixes
-
-=== 0.4.0 / 2004-05-31
-
-* Minor bug fixes including Windows compatability issues
-
-=== 0.3.0 / 2004-04-30
-
-* Cleanup of command-line arguments and handling. Most commands accept a
- --local or --remote modifier.
-* Creation of Application Gems (packages that include executable programs).
- See http://rubygems.rubyforge.org/wiki/wiki.pl?DeveloperGuide for information
- on how to use it.
-* Basic functionality for installing binary gems from source (:extensions
- property of gem specification holds an array of paths to extconf.rb files to
- be used for compilation)
-* Install library "stub" allowing a normal 'require' to work (which then does
- the rubygems require and 'require_gem'
-* --run-tests runs the test suite specified by the "test_suite_file" property
- of a gem specification
-* HTTP Proxy support works. Rewrite of HTTP code.
-* Unit and functional tests added (see Rakefile).
-* Prompt before remote-installing dependencies during gem installation.
-* Config file for storing preferences for 'gem' command usage.
-* Generally improved error messages (still more work to do)
-* Rearranged gem directory structure for cleanliness.
-
-=== 0.2.0 / 2004-03-14
-
-* Initial public release
-
diff --git a/doc/rubygems/LICENSE.txt b/doc/rubygems/LICENSE.txt
deleted file mode 100644
index db88c5e118..0000000000
--- a/doc/rubygems/LICENSE.txt
+++ /dev/null
@@ -1,53 +0,0 @@
-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:
-
- 1. You may make and give away verbatim copies of the source form of the
- software without restriction, provided that you duplicate all of the
- original copyright notices and associated disclaimers.
-
- 2. You may modify your copy of the software in any way, provided that
- you do at least ONE of the following:
-
- a) place your modifications in the Public Domain or otherwise
- make them Freely Available, such as by posting said
- modifications to Usenet or an equivalent medium, or by allowing
- the author to include your modifications in the software.
-
- b) use the modified software only within your corporation or
- organization.
-
- c) rename any non-standard executables so the names do not conflict
- with standard executables, which must also be provided.
-
- d) make other distribution arrangements with the author.
-
- 3. You may distribute the software in object code or executable
- form, provided that you do at least ONE of the following:
-
- a) distribute the executables and library files of the software,
- together with instructions (in the manual page or equivalent)
- on where to get the original distribution.
-
- b) accompany the distribution with the machine-readable source of
- the software.
-
- c) give non-standard executables non-standard names, with
- instructions on where to get the original software distribution.
-
- d) make other distribution arrangements with the author.
-
- 4. You may modify and include the part of the software into any other
- software (possibly commercial).
-
- 5. 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.
diff --git a/doc/rubygems/README b/doc/rubygems/README
deleted file mode 100644
index 68a52593d4..0000000000
--- a/doc/rubygems/README
+++ /dev/null
@@ -1,41 +0,0 @@
-= RubyGems
-
-* http://rubygems.org/
-* http://docs.rubygems.org/
-* http://rubygems.rubyforge.org/
-* http://rubyforge.org/projects/rubygems
-
-== DESCRIPTION
-
-RubyGems is a package management framework for Ruby.
-
-This gem is an update for the RubyGems software. You must have an
-installation of RubyGems before this update can be applied.
-
-See Gem for information on RubyGems (or `ri Gem`)
-
-To upgrade to the latest RubyGems, run:
-
- $ gem update --system # you might need to be an administrator or root
-
-NOTE: RubyGems 1.1 and 1.2 have problems upgrading when there is no
-rubygems-update installed. You will need to use the following instructions
-if you see "Nothing to update".
-
-If you have an older version of RubyGems installed, then you can still
-do it in two steps:
-
- $ gem install rubygems-update # again, might need to be admin/root
- $ update_rubygems # ... here too
-
-If you don't have any RubyGems install, there is still the pre-gem approach to
-getting software, doing it manually:
-
-1. Download from: http://rubyforge.org/frs/?group_id=126
-2. Unpack into a directory and cd there
-3. Install with: ruby setup.rb # you may need admin/root privilege
-
-For more details and other options, see:
-
- ruby setup.rb --help
-
diff --git a/doc/security.rdoc b/doc/security.rdoc
new file mode 100644
index 0000000000..d8efca0042
--- /dev/null
+++ b/doc/security.rdoc
@@ -0,0 +1,144 @@
+= Ruby Security
+
+The Ruby programming language is large and complex and there are many security
+pitfalls often encountered by newcomers and experienced Rubyists alike.
+
+This document aims to discuss many of these pitfalls and provide more secure
+alternatives where applicable.
+
+Please check the full list of publicly known CVEs and how to correctly report a
+security vulnerability, at: http://www.ruby-lang.org/en/security/
+Japanese version is here: http://www.ruby-lang.org/ja/security/
+
+Security vulnerabilities should be reported via an email to
+mailto:security@ruby-lang.org ({the PGP public
+key}[http://www.ruby-lang.org/security.asc]), which is a private mailing list.
+Reported problems will be published after fixes.
+
+== <code>$SAFE</code>
+
+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.
+
+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
+potentially malicious code. Other similar mechanisms exist on every major
+operating system.
+
+== +Marshal.load+
+
+Ruby's +Marshal+ module provides methods for serializing and deserializing Ruby
+object trees to and from a binary data format.
+
+Never use +Marshal.load+ to deserialize untrusted or user supplied data.
+Because +Marshal+ can deserialize to almost any Ruby object and has full
+control over instance variables, it is possible to craft a malicious payload
+that executes code shortly after deserialization.
+
+If you need to deserialize untrusted data, you should use JSON as it is only
+capable of returning 'primitive' types such as strings, arrays, hashes, numbers
+and nil. If you need to deserialize other classes, you should handle this
+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 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
+deserialized:
+
+ !ruby/object:ERB
+ src: puts `uname`
+
+Because of this, many of the security considerations applying to Marshal are
+also applicable to YAML. Do not use YAML to deserialize untrusted data.
+
+== Symbols
+
+Symbols are often seen as syntax sugar for simple strings, but they play a much
+more crucial role. The MRI Ruby implementation uses Symbols internally for
+method, variable and constant names. The reason for this is that symbols are
+simply integers with names attached to them, so they are faster to look up in
+hashtables.
+
+Once a symbol is created, the memory used by it is never freed. If you convert
+user input to symbols with +to_sym+ or +intern+, it is possible for an attacker
+to mount a denial of service attack against your application by flooding it
+with unique strings. Because each string is kept in memory until the Ruby
+process exits, this will cause memory consumption to grow and grow until Ruby
+runs out of memory and crashes.
+
+Be careful with passing user input to methods such as +send+,
++instance_variable_get+ or +_set+, +const_get+ or +_set+, etc. as these methods
+will convert string parameters to symbols internally and pose the same DoS
+potential as direct conversion through +to_sym+/+intern+.
+
+The workaround to this is simple - don't convert user input to symbols. You
+should attempt to leave user input in string form instead.
+
+== Regular expressions
+
+Ruby's regular expression syntax has some minor differences when compared to
+other languages. In Ruby, the <code>^</code> and <code>$</code> anchors do not
+refer to the beginning and end of the string, rather the beginning and end of a
+*line*.
+
+This means that if you're using a regular expression like
+<code>/^[a-z]+$/</code> to restrict a string to only letters, an attacker can
+bypass this check by passing a string containing a letter, then a newline, then
+any string of their choosing.
+
+If you want to match the beginning and end of the entire string in Ruby, use
+the anchors +\A+ and +\z+.
+
+== +eval+
+
+Never pass untrusted or user controlled input to +eval+.
+
+Unless you are implementing a REPL like +irb+ or +pry+, +eval+ is almost
+certainly not what you want. Do not attempt to filter user input before passing
+it to +eval+ - this approach is fraught with danger and will most likely open
+your application up to a serious remote code execution vulnerability.
+
+== +send+
+
+'Global functions' in Ruby (+puts+, +exit+, etc.) are actually private instance
+methods on +Object+. This means it is possible to invoke these methods with
++send+, even if the call to +send+ has an explicit receiver.
+
+For example, the following code snippet writes "Hello world" to the terminal:
+
+ 1.send(:puts, "Hello world")
+
+You should never call +send+ with user supplied input as the first parameter.
+Doing so can introduce a denial of service vulnerability:
+
+ foo.send(params[:bar]) # params[:bar] is "exit!"
+
+If an attacker can control the first two arguments to +send+, remote code
+execution is possible:
+
+ # params is { :a => "eval", :b => "...ruby code to be executed..." }
+ foo.send(params[:a], params[:b])
+
+When dispatching a method call based on user input, carefully verify that the
+method name. If possible, check it against a whitelist of safe method names.
+
+Note that the use of +public_send+ is also dangerous, as +send+ itself is
+public:
+
+ 1.public_send("send", "eval", "...ruby code to be executed...")
+
+== DRb
+
+As DRb allows remote clients to invoke arbitrary methods, it is not suitable to
+expose to untrusted clients.
+
+When using DRb, try to avoid exposing it over the network if possible. If this
+isn't possible and you need to expose DRb to the world, you *must* configure an
+appropriate security policy with <code>DRb::ACL</code>.
diff --git a/doc/shell.rd b/doc/shell.rd
deleted file mode 100644
index 8a1f7c5a80..0000000000
--- a/doc/shell.rd
+++ /dev/null
@@ -1,347 +0,0 @@
- -- shell.rb
- $Release Version: 0.6.0 $
- $Revision$
- by Keiju ISHITSUKA(keiju@ishitsuka.com)
-
-=begin
-
-= What's shell.rb?
-
-It realizes a wish to do execution of commands with filters and pipes
-like sh/csh by using just native facilities of ruby.
-
-= Main classes
-
-== Shell
-
-Every shell object has its own current working directory, and executes
-each command as if it stands in the directory.
-
---- Shell#cwd
---- Shell#dir
---- Shell#getwd
---- Shell#pwd
-
- Returns the current directory
-
---- Shell#system_path
-
- Returns the command search path in an array
-
---- Shell#umask
-
- Returns the umask
-
-== Filter
-
-Any result of command exection is a Filter. Filter include
-Enumerable, therefore a Filter object can use all Enumerable
-facilities.
-
-= Main methods
-
-== Command definitions
-
-In order to execute a command on your OS, you need to define it as a
-Shell method.
-
-Alternatively, you can execute any command via Shell#system even if it
-is not defined.
-
---- Shell.def_system_command(command, path = command)
-
- Defines a command. Registers <path> as a Shell method
- <command>.
-
- ex)
- Shell.def_system_command "ls"
- Defines ls.
-
- Shell.def_system_command "sys_sort", "sort"
- Defines sys_sort as sort.
-
---- Shell.undef_system_command(command)
-
- Undefines a commmand
-
---- Shell.alias_command(ali, command, *opts) {...}
-
- Aliases a command.
-
- ex)
- Shell.alias_command "lsC", "ls", "-CBF", "--show-control-chars"
- Shell.alias_command("lsC", "ls"){|*opts| ["-CBF", "--show-control-chars", *opts]}
-
---- Shell.unalias_command(ali)
-
- Unaliases a command.
-
---- Shell.install_system_commands(pre = "sys_")
-
- Defines all commands in the default_system_path as Shell method,
- all with <pre> prefixed to their names.
-
-== Creation
-
---- Shell.new
-
- Creates a Shell object which current directory is set to the
- process current directory.
-
---- Shell.cd(path)
-
- Creates a Shell object which current directory is set to
- <path>.
-
-== Process management
-
---- Shell#jobs
-
- Returns a list of scheduled jobs.
-
---- Shell#kill sig, job
-
- Sends a signal <sig> to <job>.
-
-== Current directory operations
-
---- Shell#cd(path, &block)
---- Shell#chdir
-
- Changes the current directory to <path>. If a block is given,
- it restores the current directory when the block ends.
-
---- Shell#pushd(path = nil, &block)
---- Shell#pushdir
-
- Pushes the current directory to the directory stack, changing
- the current directory to <path>. If <path> is omitted, it
- exchanges its current directory and the top of its directory
- stack. If a block is given, it restores the current directory
- when the block ends.
-
---- Shell#popd
---- Shell#popdir
-
- Pops a directory from the directory stack, and sets the current
- directory to it.
-
-== File and directory operations
-
---- Shell#foreach(path = nil, &block)
-
- Same as:
- File#foreach (when path is a file)
- Dir#foreach (when path is a directory)
-
---- Shell#open(path, mode)
-
- Same as:
- File#open (when path is a file)
- Dir#open (when path is a directory)
-
---- Shell#unlink(path)
-
- Same as:
- Dir#open (when path is a file)
- Dir#unlink (when path is a directory)
-
---- Shell#test(command, file1, file2)
---- Shell#[command, file1, file2]
-
- Same as test().
- ex)
- sh[?e, "foo"]
- sh[:e, "foo"]
- sh["e", "foo"]
- sh[:exists?, "foo"]
- sh["exists?", "foo"]
-
---- Shell#mkdir(*path)
-
- Same as Dir.mkdir (with multiple directories allowed)
-
---- Shell#rmdir(*path)
-
- Same as Dir.rmdir (with multiple directories allowed)
-
-== Command execution
-
---- System#system(command, *opts)
-
- Executes <command> with <opts>.
-
- ex)
- print sh.system("ls", "-l")
- sh.system("ls", "-l") | sh.head > STDOUT
-
---- System#rehash
-
- Does rehash.
-
---- Shell#transact &block
-
- Executes a block as self.
- ex)
- sh.transact{system("ls", "-l") | head > STDOUT}
-
---- Shell#out(dev = STDOUT, &block)
-
- Does transact, with redirecting the result output to <dev>.
-
-== Internal commands
-
---- Shell#echo(*strings)
---- Shell#cat(*files)
---- Shell#glob(patten)
---- Shell#tee(file)
-
- Return Filter objects, which are results of their execution.
-
---- Filter#each &block
-
- Iterates a block for each line of it.
-
---- Filter#<(src)
-
- Inputs from <src>, which is either a string of a file name or an
- IO.
-
---- Filter#>(to)
-
- Outputs to <to>, which is either a string of a file name or an
- IO.
-
---- Filter#>>(to)
-
- Appends the ouput to <to>, which is either a string of a file
- name or an IO.
-
---- Filter#|(filter)
-
- Processes a pipeline.
-
---- Filter#+(filter)
-
- (filter1 + filter2) outputs filter1, and then outputs filter2.
-
---- Filter#to_a
---- Filter#to_s
-
-== Built-in commands
-
---- Shell#atime(file)
---- Shell#basename(file, *opt)
---- Shell#chmod(mode, *files)
---- Shell#chown(owner, group, *file)
---- Shell#ctime(file)
---- Shell#delete(*file)
---- Shell#dirname(file)
---- Shell#ftype(file)
---- Shell#join(*file)
---- Shell#link(file_from, file_to)
---- Shell#lstat(file)
---- Shell#mtime(file)
---- Shell#readlink(file)
---- Shell#rename(file_from, file_to)
---- Shell#split(file)
---- Shell#stat(file)
---- Shell#symlink(file_from, file_to)
---- Shell#truncate(file, length)
---- Shell#utime(atime, mtime, *file)
-
- Equivalent to the class methods of File with the same names.
-
---- Shell#blockdev?(file)
---- Shell#chardev?(file)
---- Shell#directory?(file)
---- Shell#executable?(file)
---- Shell#executable_real?(file)
---- Shell#exist?(file)/Shell#exists?(file)
---- Shell#file?(file)
---- Shell#grpowned?(file)
---- Shell#owned?(file)
---- Shell#pipe?(file)
---- Shell#readable?(file)
---- Shell#readable_real?(file)
---- Shell#setgid?(file)
---- Shell#setuid?(file)
---- Shell#size(file)/Shell#size?(file)
---- Shell#socket?(file)
---- Shell#sticky?(file)
---- Shell#symlink?(file)
---- Shell#writable?(file)
---- Shell#writable_real?(file)
---- Shell#zero?(file)
-
- Equivalent to the class methods of FileTest with the same names.
-
---- Shell#syscopy(filename_from, filename_to)
---- Shell#copy(filename_from, filename_to)
---- Shell#move(filename_from, filename_to)
---- Shell#compare(filename_from, filename_to)
---- Shell#safe_unlink(*filenames)
---- Shell#makedirs(*filenames)
---- Shell#install(filename_from, filename_to, mode)
-
- Equivalent to the class methods of FileTools with the same
- names.
-
- And also, there are some aliases for convenience:
-
---- Shell#cmp <- Shell#compare
---- Shell#mv <- Shell#move
---- Shell#cp <- Shell#copy
---- Shell#rm_f <- Shell#safe_unlink
---- Shell#mkpath <- Shell#makedirs
-
-= Samples
-
-== ex1
-
- sh = Shell.cd("/tmp")
- sh.mkdir "shell-test-1" unless sh.exists?("shell-test-1")
- sh.cd("shell-test-1")
- for dir in ["dir1", "dir3", "dir5"]
- if !sh.exists?(dir)
- sh.mkdir dir
- sh.cd(dir) do
- f = sh.open("tmpFile", "w")
- f.print "TEST\n"
- f.close
- end
- print sh.pwd
- end
- end
-
-== ex2
-
- sh = Shell.cd("/tmp")
- sh.transact do
- mkdir "shell-test-1" unless exists?("shell-test-1")
- cd("shell-test-1")
- for dir in ["dir1", "dir3", "dir5"]
- if !exists?(dir)
- mkdir dir
- cd(dir) do
- f = open("tmpFile", "w")
- f.print "TEST\n"
- f.close
- end
- print pwd
- end
- end
- end
-
-== ex3
-
- sh.cat("/etc/printcap") | sh.tee("tee1") > "tee2"
- (sh.cat < "/etc/printcap") | sh.tee("tee11") > "tee12"
- sh.cat("/etc/printcap") | sh.tee("tee1") >> "tee2"
- (sh.cat < "/etc/printcap") | sh.tee("tee11") >> "tee12"
-
-== ex4
-
- print sh.cat("/etc/passwd").head.collect{|l| l =~ /keiju/}
-
-=end
diff --git a/doc/shell.rd.ja b/doc/shell.rd.ja
index 33e5a9ed9b..053b11fb99 100644
--- a/doc/shell.rd.ja
+++ b/doc/shell.rd.ja
@@ -5,142 +5,142 @@
=begin
-= ÌÜŪ
+= 目的
-ruby¾å¤Çsh/csh¤Î¤è¤¦¤Ë¥³¥Þ¥ó¥É¤Î¼Â¹ÔµÚ¤Ó¥Õ¥£¥ë¥¿¥ê¥ó¥°¤ò¼ê·Ú¤Ë¹Ô¤¦.
-sh/csh¤ÎÀ©¸æÊ¸¤Ïruby¤Îµ¡Ç½¤òÍѤ¤¤Æ¼Â¸½¤¹¤ë.
+ruby上ã§sh/cshã®ã‚ˆã†ã«ã‚³ãƒžãƒ³ãƒ‰ã®å®Ÿè¡ŒåŠã³ãƒ•ィルタリングを手軽ã«è¡Œã†.
+sh/cshã®åˆ¶å¾¡æ–‡ã¯rubyã®æ©Ÿèƒ½ã‚’用ã„ã¦å®Ÿç¾ã™ã‚‹.
-= ¼ç¤Ê¥¯¥é¥¹°ìÍ÷
+= 主ãªã‚¯ãƒ©ã‚¹ä¸€è¦§
== Shell
-Shell¥ª¥Ö¥¸¥§¥¯¥È¤Ï¥«¥ì¥ó¥È¥Ç¥£¥ì¥¯¥È¥ê¤ò»ý¤Á, ¥³¥Þ¥ó¥É¼Â¹Ô¤Ï¤½¤³¤«¤é¤Î
-ÁêÂХѥ¹¤Ë¤Ê¤ê¤Þ¤¹.
+Shellオブジェクトã¯ã‚«ãƒ¬ãƒ³ãƒˆãƒ‡ã‚£ãƒ¬ã‚¯ãƒˆãƒªã‚’æŒã¡, コマンド実行ã¯ãã“ã‹ã‚‰ã®
+相対パスã«ãªã‚Šã¾ã™.
--- Shell#cwd
--- Shell#dir
--- Shell#getwd
--- Shell#pwd
- ¥«¥ì¥ó¥È¥Ç¥£¥ì¥¯¥È¥ê¤òÊÖ¤¹¡£
+ カレントディレクトリを返ã™ã€‚
--- Shell#system_path
- ¥³¥Þ¥ó¥É¥µ¡¼¥Á¥Ñ¥¹¤ÎÇÛÎó¤òÊÖ¤¹¡£
+ コマンドサーãƒãƒ‘スã®é…列を返ã™ã€‚
--- Shell#umask
- umask¤òÊÖ¤¹¡£
+ umaskã‚’è¿”ã™ã€‚
== Filter
-¥³¥Þ¥ó¥É¤Î¼Â¹Ô·ë²Ì¤Ï¤¹¤Ù¤ÆFilter¤È¤·¤Æ¤«¤¨¤ê¤Þ¤¹. Enumerable¤òinclude¤·
-¤Æ¤¤¤Þ¤¹.
+コマンドã®å®Ÿè¡Œçµæžœã¯ã™ã¹ã¦Filterã¨ã—ã¦ã‹ãˆã‚Šã¾ã™. Enumerableã‚’includeã—
+ã¦ã„ã¾ã™.
-= ¼ç¤Ê¥á¥½¥Ã¥É°ìÍ÷
+= 主ãªãƒ¡ã‚½ãƒƒãƒ‰ä¸€è¦§
-== ¥³¥Þ¥ó¥ÉÄêµÁ
+== コマンド定義
-OS¾å¤Î¥³¥Þ¥ó¥É¤ò¼Â¹Ô¤¹¤ë¤Ë¤Ï¤Þ¤º, Shell¤Î¥á¥½¥Ã¥É¤È¤·¤ÆÄêµÁ¤·¤Þ¤¹.
+OS上ã®ã‚³ãƒžãƒ³ãƒ‰ã‚’実行ã™ã‚‹ã«ã¯ã¾ãš, Shellã®ãƒ¡ã‚½ãƒƒãƒ‰ã¨ã—ã¦å®šç¾©ã—ã¾ã™.
-Ãí) ¥³¥Þ¥ó¥É¤òÄêµÁ¤·¤Ê¤¯¤È¤âľÀܼ¹ԤǤ­¤ëShell#system¥³¥Þ¥ó¥É¤â¤¢¤ê¤Þ¤¹.
+注) コマンドを定義ã—ãªãã¨ã‚‚直接実行ã§ãã‚‹Shell#systemコマンドもã‚りã¾ã™.
--- Shell.def_system_command(command, path = command)
- Shell¤Î¥á¥½¥Ã¥É¤È¤·¤Æcommand¤òÅÐÏ¿¤·¤Þ¤¹.
+ Shellã®ãƒ¡ã‚½ãƒƒãƒ‰ã¨ã—ã¦commandを登録ã—ã¾ã™.
- Îã)
+ 例)
Shell.def_system_command "ls"
- ls ¤òÄêµÁ
+ ls を定義
Shell.def_system_command "sys_sort", "sort"
- sort¥³¥Þ¥ó¥É¤òsys_sort¤È¤·¤ÆÄêµÁ
+ sortコマンドをsys_sortã¨ã—ã¦å®šç¾©
--- Shell.undef_system_command(command)
- command¤òºï½ü¤·¤Þ¤¹.
+ commandを削除ã—ã¾ã™.
--- Shell.alias_command(ali, command, *opts) {...}
- command¤Îalias¤ò¤·¤Þ¤¹.
+ commandã®aliasã‚’ã—ã¾ã™.
- Îã)
+ 例)
Shell.alias_command "lsC", "ls", "-CBF", "--show-control-chars"
Shell.alias_command("lsC", "ls"){|*opts| ["-CBF", "--show-control-chars", *opts]}
--- Shell.unalias_command(ali)
- command¤Îalias¤òºï½ü¤·¤Þ¤¹.
+ commandã®aliasを削除ã—ã¾ã™.
--- Shell.install_system_commands(pre = "sys_")
- system_path¾å¤Ë¤¢¤ëÁ´¤Æ¤Î¼Â¹Ô²Äǽ¥Õ¥¡¥¤¥ë¤òShell¤ËÄêµÁ¤¹¤ë. ¥á¥½¥Ã
- ¥É̾¤Ï¸µ¤Î¥Õ¥¡¥¤¥ë̾¤ÎƬ¤Ëpre¤ò¤Ä¤±¤¿¤â¤Î¤È¤Ê¤ë.
+ system_path上ã«ã‚ã‚‹å…¨ã¦ã®å®Ÿè¡Œå¯èƒ½ãƒ•ァイルをShellã«å®šç¾©ã™ã‚‹. メソッ
+ ドåã¯å…ƒã®ãƒ•ァイルåã®é ­ã«preã‚’ã¤ã‘ãŸã‚‚ã®ã¨ãªã‚‹.
-== À¸À®
+== 生æˆ
--- Shell.new
- ¥×¥í¥»¥¹¤Î¥«¥ì¥ó¥È¥Ç¥£¥ì¥¯¥È¥ê¤ò¥«¥ì¥ó¥È¥Ç¥£¥ì¥¯¥È¥ê¤È¤¹¤ëShell¥ª
- ¥Ö¥¸¥§¥¯¥È¤òÀ¸À®¤·¤Þ¤¹.
+ プロセスã®ã‚«ãƒ¬ãƒ³ãƒˆãƒ‡ã‚£ãƒ¬ã‚¯ãƒˆãƒªã‚’カレントディレクトリã¨ã™ã‚‹Shellオ
+ ブジェクトを生æˆã—ã¾ã™.
--- Shell.cd(path)
- path¤ò¥«¥ì¥ó¥È¥Ç¥£¥ì¥¯¥È¥ê¤È¤¹¤ëShell¥ª¥Ö¥¸¥§¥¯¥È¤òÀ¸À®¤·¤Þ¤¹.
+ pathをカレントディレクトリã¨ã™ã‚‹Shellオブジェクトを生æˆã—ã¾ã™.
-== ¥×¥í¥»¥¹´ÉÍý
+== プロセス管ç†
--- Shell#jobs
- ¥¹¥±¥¸¥å¡¼¥ê¥ó¥°¤µ¤ì¤Æ¤¤¤ëjob¤Î°ìÍ÷¤òÊÖ¤¹.
+ スケジューリングã•れã¦ã„ã‚‹jobã®ä¸€è¦§ã‚’è¿”ã™.
--- Shell#kill sig, job
- job¤Ë¥·¥°¥Ê¥ësig¤òÁ÷¤ë
+ jobã«ã‚·ã‚°ãƒŠãƒ«sigã‚’é€ã‚‹
-== ¥«¥ì¥ó¥È¥Ç¥£¥ì¥¯¥È¥êÁàºî
+== カレントディレクトリæ“作
--- Shell#cd(path, &block)
--- Shell#chdir
- ¥«¥ì¥ó¥È¥Ç¥£¥ì¥¯¥È¥ê¤òpath¤Ë¤¹¤ë. ¥¤¥Æ¥ì¡¼¥¿¤È¤·¤Æ¸Æ¤Ð¤ì¤¿¤È¤­¤Ë¤Ï
- ¥Ö¥í¥Ã¥¯¼Â¹ÔÃæ¤Î¤ß¥«¥ì¥ó¥È¥Ç¥£¥ì¥¯¥È¥ê¤òÊѹ¹¤¹¤ë.
+ カレントディレクトリをpathã«ã™ã‚‹. イテレータã¨ã—ã¦å‘¼ã°ã‚ŒãŸã¨ãã«ã¯
+ ブロック実行中ã®ã¿ã‚«ãƒ¬ãƒ³ãƒˆãƒ‡ã‚£ãƒ¬ã‚¯ãƒˆãƒªã‚’変更ã™ã‚‹.
--- Shell#pushd(path = nil, &block)
--- Shell#pushdir
- ¥«¥ì¥ó¥È¥Ç¥£¥ì¥¯¥È¥ê¤ò¥Ç¥£¥ì¥¯¥È¥ê¥¹¥¿¥Ã¥¯¤Ë¤Ä¤ß, ¥«¥ì¥ó¥È¥Ç¥£¥ì¥¯
- ¥È¥ê¤òpath¤Ë¤¹¤ë. path¤¬¾Êά¤µ¤ì¤¿¤È¤­¤Ë¤Ï, ¥«¥ì¥ó¥È¥Ç¥£¥ì¥¯¥È¥ê¤È
- ¥Ç¥£¥ì¥¯¥È¥ê¥¹¥¿¥Ã¥¯¤Î¥È¥Ã¥×¤ò¸ò´¹¤¹¤ë. ¥¤¥Æ¥ì¡¼¥¿¤È¤·¤Æ¸Æ¤Ð¤ì¤¿¤È
- ¤­¤Ë¤Ï, ¥Ö¥í¥Ã¥¯¼Â¹ÔÃæ¤Î¤ßpushd¤¹¤ë.
+ カレントディレクトリをディレクトリスタックã«ã¤ã¿, カレントディレク
+ トリをpathã«ã™ã‚‹. pathãŒçœç•¥ã•れãŸã¨ãã«ã¯, カレントディレクトリã¨
+ ディレクトリスタックã®ãƒˆãƒƒãƒ—を交æ›ã™ã‚‹. イテレータã¨ã—ã¦å‘¼ã°ã‚ŒãŸã¨
+ ãã«ã¯, ブロック実行中ã®ã¿pushdã™ã‚‹.
--- Shell#popd
--- Shell#popdir
- ¥Ç¥£¥ì¥¯¥È¥ê¥¹¥¿¥Ã¥¯¤«¤é¥Ý¥Ã¥×¤·, ¤½¤ì¤ò¥«¥ì¥ó¥È¥Ç¥£¥ì¥¯¥È¥ê¤Ë¤¹¤ë.
+ ディレクトリスタックã‹ã‚‰ãƒãƒƒãƒ—ã—, ãれをカレントディレクトリã«ã™ã‚‹.
-== ¥Õ¥¡¥¤¥ë/¥Ç¥£¥ì¥¯¥È¥êÁàºî
+== ファイル/ディレクトリæ“作
--- Shell#foreach(path = nil, &block)
- path¤¬¥Õ¥¡¥¤¥ë¤Ê¤é, File#foreach
- path¤¬¥Ç¥£¥ì¥¯¥È¥ê¤Ê¤é, Dir#foreach
+ pathãŒãƒ•ァイルãªã‚‰, File#foreach
+ pathãŒãƒ‡ã‚£ãƒ¬ã‚¯ãƒˆãƒªãªã‚‰, Dir#foreach
--- Shell#open(path, mode)
- path¤¬¥Õ¥¡¥¤¥ë¤Ê¤é, File#open
- path¤¬¥Ç¥£¥ì¥¯¥È¥ê¤Ê¤é, Dir#open
+ pathãŒãƒ•ァイルãªã‚‰, File#open
+ pathãŒãƒ‡ã‚£ãƒ¬ã‚¯ãƒˆãƒªãªã‚‰, Dir#open
--- Shell#unlink(path)
- path¤¬¥Õ¥¡¥¤¥ë¤Ê¤é, File#unlink
- path¤¬¥Ç¥£¥ì¥¯¥È¥ê¤Ê¤é, Dir#unlink
+ pathãŒãƒ•ァイルãªã‚‰, File#unlink
+ pathãŒãƒ‡ã‚£ãƒ¬ã‚¯ãƒˆãƒªãªã‚‰, Dir#unlink
--- Shell#test(command, file1, file2)
--- Shell#[command, file1, file2]
- ¥Õ¥¡¥¤¥ë¥Æ¥¹¥È´Ø¿ôtest¤ÈƱ¤¸.
- Îã)
+ ファイルテスト関数testã¨åŒã˜.
+ 例)
sh[?e, "foo"]
sh[:e, "foo"]
sh["e", "foo"]
@@ -149,75 +149,75 @@ OS¾å¤Î¥³¥Þ¥ó¥É¤ò¼Â¹Ô¤¹¤ë¤Ë¤Ï¤Þ¤º, Shell¤Î¥á¥½¥Ã¥É¤È¤·¤ÆÄêµÁ¤·¤Þ¤¹.
--- Shell#mkdir(*path)
- Dir.mkdir¤ÈƱ¤¸(Ê£¿ô²Ä)
+ Dir.mkdirã¨åŒã˜(複数å¯)
--- Shell#rmdir(*path)
- Dir.rmdir¤ÈƱ¤¸(Ê£¿ô²Ä)
+ Dir.rmdirã¨åŒã˜(複数å¯)
-== ¥³¥Þ¥ó¥É¼Â¹Ô
+== コマンド実行
--- System#system(command, *opts)
- command¤ò¼Â¹Ô¤¹¤ë.
- Îã)
+ commandを実行ã™ã‚‹.
+ 例)
print sh.system("ls", "-l")
sh.system("ls", "-l") | sh.head > STDOUT
--- System#rehash
- ¥ê¥Ï¥Ã¥·¥å¤¹¤ë
+ リãƒãƒƒã‚·ãƒ¥ã™ã‚‹
--- Shell#transact &block
- ¥Ö¥í¥Ã¥¯Ãæ¤Ç¤Ïshell¤òself¤È¤·¤Æ¼Â¹Ô¤¹¤ë.
- Îã)
+ ブロック中ã§ã¯shellã‚’selfã¨ã—ã¦å®Ÿè¡Œã™ã‚‹.
+ 例)
sh.transact{system("ls", "-l") | head > STDOUT}
--- Shell#out(dev = STDOUT, &block)
- transact¤ò¸Æ¤Ó½Ð¤·¤½¤Î·ë²Ì¤òdev¤Ë½ÐÎϤ¹¤ë.
+ transactを呼ã³å‡ºã—ãã®çµæžœã‚’devã«å‡ºåŠ›ã™ã‚‹.
-== ÆâÉô¥³¥Þ¥ó¥É
+== 内部コマンド
--- Shell#echo(*strings)
--- Shell#cat(*files)
--- Shell#glob(patten)
--- Shell#tee(file)
- ¤³¤ì¤é¤Ï¼Â¹Ô¤¹¤ë¤È, ¤½¤ì¤é¤òÆâÍÆ¤È¤¹¤ëFilter¥ª¥Ö¥¸¥§¥¯¥È¤òÊÖ¤·¤Þ¤¹.
+ ã“れらã¯å®Ÿè¡Œã™ã‚‹ã¨, ãれらを内容ã¨ã™ã‚‹Filterオブジェクトを返ã—ã¾ã™.
--- Filter#each &block
- ¥Õ¥£¥ë¥¿¤Î°ì¹Ô¤º¤Ä¤òblock¤ËÅϤ¹.
+ フィルタã®ä¸€è¡Œãšã¤ã‚’blockã«æ¸¡ã™.
--- Filter#<(src)
- src¤ò¥Õ¥£¥ë¥¿¤ÎÆþÎϤȤ¹¤ë. src¤¬, ʸ»úÎó¤Ê¤é¤Ð¥Õ¥¡¥¤¥ë¤ò, IO¤Ç¤¢¤ì
- ¤Ð¤½¤ì¤ò¤½¤Î¤Þ¤ÞÆþÎϤȤ¹¤ë.
+ srcをフィルタã®å…¥åŠ›ã¨ã™ã‚‹. srcãŒ, 文字列ãªã‚‰ã°ãƒ•ァイルを, IOã§ã‚れ
+ ã°ãれをãã®ã¾ã¾å…¥åŠ›ã¨ã™ã‚‹.
--- Filter#>(to)
- src¤ò¥Õ¥£¥ë¥¿¤Î½ÐÎϤȤ¹¤ë. to¤¬, ʸ»úÎó¤Ê¤é¤Ð¥Õ¥¡¥¤¥ë¤Ë, IO¤Ç¤¢¤ì
- ¤Ð¤½¤ì¤ò¤½¤Î¤Þ¤Þ½ÐÎϤȤ¹¤ë.
+ srcをフィルタã®å‡ºåŠ›ã¨ã™ã‚‹. toãŒ, 文字列ãªã‚‰ã°ãƒ•ァイルã«, IOã§ã‚れ
+ ã°ãれをãã®ã¾ã¾å‡ºåŠ›ã¨ã™ã‚‹.
--- Filter#>>(to)
- src¤ò¥Õ¥£¥ë¥¿¤ËÄɲ乤ë. to¤¬, ʸ»úÎó¤Ê¤é¤Ð¥Õ¥¡¥¤¥ë¤Ë, IO¤Ç¤¢¤ì¤Ð
- ¤½¤ì¤ò¤½¤Î¤Þ¤Þ½ÐÎϤȤ¹¤ë.
+ srcをフィルタã«è¿½åŠ ã™ã‚‹. toãŒ, 文字列ãªã‚‰ã°ãƒ•ァイルã«, IOã§ã‚れã°
+ ãれをãã®ã¾ã¾å‡ºåŠ›ã¨ã™ã‚‹.
--- Filter#|(filter)
- ¥Ñ¥¤¥×·ë¹ç
+ パイプçµåˆ
--- Filter#+(filter)
- filter1 + filter2 ¤Ï filter1¤Î½ÐÎϤθå, filter2¤Î½ÐÎϤò¹Ô¤¦.
+ filter1 + filter2 㯠filter1ã®å‡ºåŠ›ã®å¾Œ, filter2ã®å‡ºåŠ›ã‚’è¡Œã†.
--- Filter#to_a
--- Filter#to_s
-== Áȹþ¤ß¥³¥Þ¥ó¥É
+== 組込ã¿ã‚³ãƒžãƒ³ãƒ‰
--- Shell#atime(file)
--- Shell#basename(file, *opt)
@@ -239,7 +239,7 @@ OS¾å¤Î¥³¥Þ¥ó¥É¤ò¼Â¹Ô¤¹¤ë¤Ë¤Ï¤Þ¤º, Shell¤Î¥á¥½¥Ã¥É¤È¤·¤ÆÄêµÁ¤·¤Þ¤¹.
--- Shell#truncate(file, length)
--- Shell#utime(atime, mtime, *file)
- ¤³¤ì¤é¤ÏFile¥¯¥é¥¹¤Ë¤¢¤ëƱ̾¤Î¥¯¥é¥¹¥á¥½¥Ã¥É¤ÈƱ¤¸¤Ç¤¹.
+ ã“れらã¯Fileクラスã«ã‚ã‚‹åŒåã®ã‚¯ãƒ©ã‚¹ãƒ¡ã‚½ãƒƒãƒ‰ã¨åŒã˜ã§ã™.
--- Shell#blockdev?(file)
--- Shell#chardev?(file)
@@ -263,7 +263,7 @@ OS¾å¤Î¥³¥Þ¥ó¥É¤ò¼Â¹Ô¤¹¤ë¤Ë¤Ï¤Þ¤º, Shell¤Î¥á¥½¥Ã¥É¤È¤·¤ÆÄêµÁ¤·¤Þ¤¹.
--- Shell#writable_real?(file)
--- Shell#zero?(file)
- ¤³¤ì¤é¤ÏFileTest¥¯¥é¥¹¤Ë¤¢¤ëƱ̾¤Î¥¯¥é¥¹¥á¥½¥Ã¥É¤ÈƱ¤¸¤Ç¤¹.
+ ã“れらã¯FileTestクラスã«ã‚ã‚‹åŒåã®ã‚¯ãƒ©ã‚¹ãƒ¡ã‚½ãƒƒãƒ‰ã¨åŒã˜ã§ã™.
--- Shell#syscopy(filename_from, filename_to)
--- Shell#copy(filename_from, filename_to)
@@ -273,9 +273,9 @@ OS¾å¤Î¥³¥Þ¥ó¥É¤ò¼Â¹Ô¤¹¤ë¤Ë¤Ï¤Þ¤º, Shell¤Î¥á¥½¥Ã¥É¤È¤·¤ÆÄêµÁ¤·¤Þ¤¹.
--- Shell#makedirs(*filenames)
--- Shell#install(filename_from, filename_to, mode)
- ¤³¤ì¤é¤ÏFileTools¥¯¥é¥¹¤Ë¤¢¤ëƱ̾¤Î¥¯¥é¥¹¥á¥½¥Ã¥É¤ÈƱ¤¸¤Ç¤¹.
+ ã“れらã¯FileToolsクラスã«ã‚ã‚‹åŒåã®ã‚¯ãƒ©ã‚¹ãƒ¡ã‚½ãƒƒãƒ‰ã¨åŒã˜ã§ã™.
- ¤½¤Î¾, °Ê²¼¤Î¤â¤Î¤¬¥¨¥¤¥ê¥¢¥¹¤µ¤ì¤Æ¤¤¤Þ¤¹.
+ ãã®ä»–, 以下ã®ã‚‚ã®ãŒã‚¨ã‚¤ãƒªã‚¢ã‚¹ã•れã¦ã„ã¾ã™.
--- Shell#cmp <- Shell#compare
--- Shell#mv <- Shell#move
@@ -283,7 +283,7 @@ OS¾å¤Î¥³¥Þ¥ó¥É¤ò¼Â¹Ô¤¹¤ë¤Ë¤Ï¤Þ¤º, Shell¤Î¥á¥½¥Ã¥É¤È¤·¤ÆÄêµÁ¤·¤Þ¤¹.
--- Shell#rm_f <- Shell#safe_unlink
--- Shell#mkpath <- Shell#makedirs
-= ¥µ¥ó¥×¥ë
+= サンプル
== ex1
diff --git a/doc/standard_library.rdoc b/doc/standard_library.rdoc
new file mode 100644
index 0000000000..e94727f913
--- /dev/null
+++ b/doc/standard_library.rdoc
@@ -0,0 +1,126 @@
+= Ruby Standard Library
+
+The Ruby Standard Library is a vast collection of classes and modules that you
+can require in your code for additional features.
+
+Below is an overview of libraries and extensions followed by a brief
+description.
+
+== Libraries
+
+Abbrev:: Calculates a set of unique abbreviations for a given set of strings
+Base64:: Support for encoding and decoding binary data using a Base64 representation
+Benchmark:: Provides methods to measure and report the time used to execute code
+CGI:: Support for the Common Gateway Interface protocol
+CMath:: Provides Trigonometric and Transcendental functions for complex numbers
+complex.rb:: Deprecated library replaced by C implementation in core
+ConditionVariable:: Augments the Mutex class, provided by thread.rb
+CSV:: Provides an interface to read and write CSV files and data
+DEBUGGER__:: Debugging functionality for Ruby
+Delegator:: Provides three abilities to delegate method calls to an object
+DRb:: Distributed object system for Ruby
+E2MM:: Module for defining custom exceptions with specific messages
+English.rb:: Require 'English.rb' to reference global variables with less cryptic names
+ERB:: An easy to use but powerful templating system for Ruby
+FileUtils:: Several file utility methods for copying, moving, removing, etc
+Find:: This module supports top-down traversal of a set of file paths
+Forwardable:: Provides delegation of specified methods to a designated object
+GetoptLong:: Parse command line options similar to the GNU C getopt_long()
+GServer:: HTTP server with logging, thread pooling and multi-server management
+IPAddr:: Provides methods to manipulate IPv4 and IPv6 IP addresses
+IRB:: Interactive Ruby command-line tool for REPL (Read Eval Print Loop)
+Logger:: Provides a simple logging utility for outputing messages
+mathn.rb:: Deprecated library that extends math operations
+MakeMakefile:: Module used to generate a Makefile for C extensions
+Matrix:: Represents a mathematical matrix.
+MiniTest:: A test suite with TDD, BDD, mocking and benchmarking
+Monitor:: Provides an object or module to use safely by more than one thread
+Mutex_m:: Mixin to extend objects to be handled like a Mutex
+Net::FTP:: Support for the File Transfer Protocol
+Net::HTTP:: HTTP client api for Ruby
+Net::IMAP:: Ruby client api for Internet Message Access Protocol
+Net::POP3:: Ruby client library for POP3
+Net::SMTP:: Simple Mail Transfer Protocol client library for Ruby
+Net::Telnet:: Telnet client library for Ruby
+Observable:: Provides a mechanism for publich/subscribe pattern in Ruby
+OpenURI:: An easy-to-use wrapper for Net::HTTP, Net::HTTPS and Net::FTP
+Open3:: Provides access to stdin, stdout and stderr when running other programs
+OptionParser:: Ruby-oriented class for command-line option analysis
+OpenStruct:: Class to build custom data structures, similar to a Hash
+PP:: Provides a PrettyPrinter for Ruby objects
+PrettyPrinter:: Implements a pretty printing algorithm for readable structure
+Prime:: Prime numbers and factorization library
+profile.rb:: Runs the Ruby Profiler__
+Profiler__:: Provides a way to profile your Ruby application
+PStore:: Implements a file based persistence mechanism based on a Hash
+Queue:: Synchronized communication between threads, provided by thread.rb
+Racc:: A LALR(1) parser generator written in Ruby.
+Rake:: Ruby build program with capabilities similar to make
+rational.rb:: Deprecated library replaced by C implementation in core
+RbConfig:: Information of your configure and build of Ruby
+RDoc:: Produces HTML and command-line documentation for Ruby
+resolv-replace.rb:: Replace Socket DNS with Resolv
+Resolv:: Thread-aware DNS resolver library in Ruby
+REXML:: An XML toolkit for Ruby
+Rinda:: The Linda distributed computing paradigm in Ruby
+RSS:: Family of libraries that support various formats of XML "feeds"
+Gem:: Package management framework for Ruby
+Scanf:: A Ruby implementation of the C function scanf(3)
+SecureRandom:: Interface for secure random number generator
+Set:: Provides a class to deal with collections of unordered, unique values
+Shell:: An idiomatic Ruby interface for common UNIX shell commands
+Shellwords:: Manipulates strings with word parsing rules of UNIX Bourne shell
+Singleton:: Implementation of the Singleton pattern for Ruby
+Synchronizer:: A module that provides a two-phase lock with a counter
+Tempfile:: A utility class for managing temporary files
+Test::Unit:: A compatibility layer for MiniTest
+Thread:: Provides support classes for threaded programs
+ThreadsWait:: Watches for termination of multiple threads
+Time:: Extends the Time class with methods for parsing and conversion
+Timeout:: Auto-terminate potentially long-running operations in Ruby
+tmpdir.rb:: Extends the Dir class to manage the OS temporary file path
+Tracer:: Outputs a source level execution trace of a Ruby program
+TSort:: Topological sorting using Tarjan's algorithm
+un.rb:: Utilities to replace common UNIX commands
+URI:: A Ruby module providing support for Uniform Resource Identifiers
+WeakRef:: Allows a referenced object to be garbage-collected
+WEBrick:: An HTTP server toolkit for Ruby
+XMLRPC:: Remote Procedure Call over HTTP support for Ruby
+YAML:: Ruby client library for the Psych YAML implementation
+
+== Extensions
+
+BigDecimal:: Provides arbitrary-precision floating point decimal arithmetic
+Coverage:: Provides coverage measurement for Ruby
+Curses:: Implements the CRT screen handling and optimization library
+Date:: A subclass of Object includes Comparable module for handling dates
+DateTime:: Subclass of Date to handling dates, hours, minutes, seconds, offsets
+DBM:: Provides a wrapper for the UNIX-style Database Manager Library
+Digest:: Provides a framework for message digest libraries
+DL:: Provides a wrapper for the UNIX dlopen() library
+Etc:: Provides access to information typically stored in UNIX /etc directory
+Fcntl:: Loads constants defined in the OS fcntl.h C header file
+Fiddle:: A libffi wrapper for Ruby
+GDBM:: Ruby extension for the GNU dbm (gdbm) library
+IO:: Extensions for Ruby IO class, including #wait and ::console
+JSON:: Implements Javascript Object Notation for Ruby
+NKF:: Ruby extension for Network Kanji Filter
+objspace:: Extends ObjectSpace module to add methods for internal statistics
+OpenSSL:: Provides SSL, TSL and general purpose cryptography for Ruby
+Pathname:: Representation of the name of a file or directory on the filesystem
+Psych:: A YAML parser and emitter for Ruby
+PTY:: Creates and manages pseudo terminals
+Readline:: Provides an interface for GNU Readline and Edit Line (libedit)
+Ripper:: Provides an interface for parsing Ruby programs into S-expressions
+SBDM:: Provides a simple file-based key-value store with String keys and values
+Socket:: Access underlying OS socket implementations
+StringIO:: Pseudo I/O on String objects
+StringScanner:: Provides lexical scanning operations on a String
+Syslog:: Ruby interface for the POSIX system logging facility
+Tk:: Provides a framework for building a Graphical User Interface (GUI)
+WIN32OLE:: Provides an interface for OLE Automation in Ruby
+Zlib:: Ruby interface for the zlib compression/decompression library
+
+
+
+
diff --git a/doc/syntax.rdoc b/doc/syntax.rdoc
new file mode 100644
index 0000000000..fe0f98ce4c
--- /dev/null
+++ b/doc/syntax.rdoc
@@ -0,0 +1,34 @@
+= Ruby Syntax
+
+The Ruby syntax is large and is split up into the following sections:
+
+Literals[rdoc-ref:syntax/literals.rdoc] ::
+ Numbers, Strings, Arrays, Hashes, etc.
+
+Assignment[rdoc-ref:syntax/assignment.rdoc] ::
+ Assignment and variables
+
+{Control Expressions}[rdoc-ref:syntax/control_expressions.rdoc] ::
+ +if+, +unless+, +while+, +until+, +for+, +break+, +next+, +redo+
+
+Methods[rdoc-ref:syntax/methods.rdoc] ::
+ Method and method argument syntax
+
+{Calling Methods}[rdoc-ref:syntax/calling_methods.rdoc] ::
+ How to call a method (or send a message to a method)
+
+{Modules and Classes}[rdoc-ref:syntax/modules_and_classes.rdoc] ::
+ Creating modules and classes including inheritance
+
+Exceptions[rdoc-ref:syntax/exceptions.rdoc] ::
+ Exception handling syntax
+
+Precedence[rdoc-ref:syntax/precedence.rdoc] ::
+ Precedence of ruby operators
+
+Refinements[rdoc-ref:syntax/refinements.rdoc] ::
+ Use and behavior of the experimental refinements feature
+
+Miscellaneous[rdoc-ref:syntax/miscellaneous.rdoc] ::
+ +alias+, +undef+, +BEGIN+, +END+
+
diff --git a/doc/syntax/assignment.rdoc b/doc/syntax/assignment.rdoc
new file mode 100644
index 0000000000..7424d4885f
--- /dev/null
+++ b/doc/syntax/assignment.rdoc
@@ -0,0 +1,455 @@
+= Assignment
+
+In Ruby assignment uses the <code>=</code> (equals sign) character. This
+example assigns the number five to the local variable +v+:
+
+ v = 5
+
+Assignment creates a local variable if the variable was not previously
+referenced.
+
+== Local Variable Names
+
+A local variable name must start with a lowercase US-ASCII letter or a
+character with the eight bit set. Typically local variables are US-ASCII
+compatible since the keys to type them exist on all keyboards.
+
+(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 local variables to contain such characters.)
+
+A local variable name may contain letters, numbers, an <code>_</code>
+(underscore or low line) or a character with the eighth bit set.
+
+== Local Variable Scope
+
+Once a local variable name has been assigned-to all uses of the name for the
+rest of the scope are considered local variables.
+
+Here is an example:
+
+ 1.times do
+ a = 1
+ puts "local variables in the block: #{local_variables.join ", "}"
+ end
+
+ puts "no local variables outside the block" if local_variables.empty?
+
+This prints:
+
+ local variables in the block: a
+ no local variables outside the block
+
+Since the block creates a new scope, any local variables created inside it do
+not leak to the surrounding scope.
+
+Variables defined in an outer scope appear inner scope:
+
+ a = 0
+
+ 1.times do
+ puts "local variables: #{local_variables.join ", "}"
+ end
+
+This prints:
+
+ local variables: a
+
+You may isolate variables in a block from the outer scope by listing them
+following a <code>;</code> in the block's arguments. See the documentation
+for block local variables in the {calling
+methods}[rdoc-ref:syntax/calling_methods.rdoc] documentation for an example.
+
+See also Kernel#local_variables, but note that a +for+ loop does not create a
+new scope like a block does.
+
+== Local Variables and Methods
+
+In Ruby local variable names and method names are nearly identical. If you
+have not assigned to one of these ambiguous names ruby will assume you wish to
+call a method. Once you have assigned to the name ruby will assume you wish
+to reference a local variable.
+
+The local variable is created when the parser encounters the assignment, not
+when the assignment occurs:
+
+ a = 0 if false # does not assign to a
+
+ p local_variables # prints [:a]
+
+ p a # prints nil
+
+The similarity between method and local variable names can lead to confusing
+code, for example:
+
+ def big_calculation
+ 42 # pretend this takes a long time
+ end
+
+ big_calculation = big_calculation()
+
+Now any reference to +big_calculation+ is considered a local variable and will
+be cached. To call the method, use <code>self.big_calculation</code>.
+
+You can force a method call by using empty argument parentheses as shown above
+or by using an explicit receiver like <code>self.</code>. Using an explicit
+receiver may raise a NameError if the method's visibility is not public.
+
+Another commonly confusing case is when using a modifier +if+:
+
+ p a if a = 0.zero?
+
+Rather than printing "true" you receive a NameError, "undefined local variable
+or method `a'". Since ruby parses the bare +a+ left of the +if+ first and has
+not yet seen an assignment to +a+ it assumes you wish to call a method. Ruby
+then sees the assignment to +a+ and will assume you are referencing a local
+method.
+
+The confusion comes from the out-of-order execution of the expression. First
+the local variable is assigned-to then you attempt to call a nonexistent
+method.
+
+== Instance Variables
+
+Instance variables are shared across all methods for the same object.
+
+An instance variable must start with a <code>@</code> ("at" sign or
+commercial at). Otherwise instance variable names follow the rules as local
+variable names. Since the instance variable starts with an <code>@</code> the
+second character may be an upper-case letter.
+
+Here is an example of instance variable usage:
+
+ class C
+ def initialize(value)
+ @instance_variable = value
+ end
+
+ def value
+ @instance_variable
+ end
+ end
+
+ object1 = C.new "some value"
+ object2 = C.new "other value"
+
+ p object1.value # prints "some value"
+ p object2.value # prints "other value"
+
+An uninitialized instance variable has a value of +nil+. If you run Ruby with
+warnings enabled you will get a warning when accessing an uninitialized
+instance variable.
+
+The +value+ method has access to the value set by the +initialize+ method, but
+only for the same object.
+
+== Class Variables
+
+Class variables are shared between a class, its subclasses and its instances.
+
+A class variable must start with a <code>@@</code> (two "at" signs). The rest
+of the name follows the same rules as instance variables.
+
+Here is an example:
+
+ class A
+ @@class_variable = 0
+
+ def value
+ @@class_variable
+ end
+
+ def update
+ @@class_variable = @@class_variable + 1
+ end
+ end
+
+ class B < A
+ def update
+ @@class_variable = @@class_variable + 2
+ end
+ end
+
+ a = A.new
+ b = B.new
+
+ puts "A value: #{a.value}"
+ puts "B value: #{b.value}"
+
+This prints:
+
+ A value: 0
+ B value: 0
+
+Continuing with the same example, we can update using objects from either
+class and the value is shared:
+
+ puts "update A"
+ a.update
+
+ puts "A value: #{a.value}"
+ puts "B value: #{b.value}"
+
+ puts "update B"
+ b.update
+
+ puts "A value: #{a.value}"
+ puts "B value: #{b.value}"
+
+ puts "update A"
+ a.update
+
+ puts "A value: #{a.value}"
+ puts "B value: #{b.value}"
+
+This prints:
+
+ update A
+ A value: 1
+ B value: 1
+ update B
+ A value: 3
+ B value: 3
+ update A
+ A value: 4
+ B value: 4
+
+Accessing an uninitialized class variable will raise a NameError exception.
+
+Note that classes have instance variables because classes are objects, so
+try not to confuse class and instance variables.
+
+== Global Variables
+
+Global variables are accessible everywhere.
+
+Global variables start with a <code>$</code> (dollar sign). The rest of the
+name follows the same rules as instance variables.
+
+Here is an example:
+
+ $global = 0
+
+ class C
+ puts "in a class: #{$global}"
+
+ def my_method
+ puts "in a method: #{$global}"
+
+ $global = $global + 1
+ $other_global = 3
+ end
+ end
+
+ C.new.my_method
+
+ puts "at top-level, $global: #{$global}, $other_global: #{$other_global}"
+
+This prints:
+
+ in a class: 0
+ in a method: 0
+ at top-level, $global: 1, $other_global: 3
+
+An uninitialized global variable has a value of +nil+.
+
+Ruby has some special globals that behave differently depending on context
+such as the regular expression match variables or that have a side-effect when
+assigned to. See the {global variables documentation}[rdoc-ref:globals.rdoc]
+for details.
+
+== Assignment Methods
+
+You can define methods that will behave like assignment, for example:
+
+ class C
+ def value=(value)
+ @value = value
+ end
+ end
+
+ c = C.new
+ c.value = 42
+
+Using assignment methods allows your programs to look nicer. When assigning
+to an instance variable most people use Module#attr_accessor:
+
+ class C
+ attr_accessor :value
+ end
+
+When using method assignment you must always have a receiver. If you do not
+have a receiver Ruby assumes you are assigning to a local variable:
+
+ class C
+ attr_accessor :value
+
+ def my_method
+ value = 42
+
+ puts "local_variables: #{local_variables.join ", "}"
+ puts "@value: #{@value.inspect}"
+ end
+ end
+
+ C.new.my_method
+
+This prints:
+
+ local_variables: value
+ @value: nil
+
+To use the assignment method you must set the receiver:
+
+ class C
+ attr_accessor :value
+
+ def my_method
+ self.value = 42
+
+ puts "local_variables: #{local_variables.join ", "}"
+ puts "@value: #{@value.inspect}"
+ end
+ end
+
+ C.new.my_method
+
+This prints:
+
+ local_variables:
+ @value: 42
+
+== Abbreviated Assignment
+
+You can mix several of the operators and assignment. To add 1 to an object
+you can write:
+
+ a = 1
+
+ a += 2
+
+ p a # prints 3
+
+This is equivalent to:
+
+ a = 1
+
+ a = a + 2
+
+ p a # prints 3
+
+You can use the following operators this way: <code>+</code>, <code>-</code>,
+<code>*</code>, <code>/</code>, <code>%</code>, <code>**</code>,
+<code>&</code>, <code>|</code>, <code>^</code>, <code><<</code>,
+<code>>></code>
+
+There are also <code>||=</code> and <code>&&=</code>. The former makes an
+assignment if the value was +nil+ or +false+ while the latter makes an
+assignment if the value was not +nil+ or +false+.
+
+Here is an example:
+
+ a ||= 0
+ a &&= 1
+
+ p a # prints 1
+
+Note that these two operators behave more like <code>a || a = 0<code> than
+<code>a = a || 0</code>.
+
+== Implicit Array Assignment
+
+You can implicitly create an array by listing multiple values when assigning:
+
+ a = 1, 2, 3
+
+ p a # prints [1, 2, 3]
+
+This implicitly creates an Array.
+
+You can use <code>*</code> or the "splat" operator or unpack an Array when
+assigning. This is similar to multiple assignment:
+
+ a = *[1, 2, 3]
+
+ p a # prints [1, 2, 3]
+
+You can splat anywhere in the left-hand side of the assignment:
+
+ a = 1, *[2, 3]
+
+ p a # prints [1, 2, 3]
+
+== Multiple Assignment
+
+You can assign multiple values on the left-hand side to multiple variables:
+
+ a, b = 1, 2
+
+ p a: a, b: b # prints {:a=>1, :b=>2}
+
+In the following sections any place "variable" is used an assignment method,
+instance, class or global will also work:
+
+ def value=(value)
+ p assigned: value
+ end
+
+ self.value, $global = 1, 2 # prints {:assigned=>1}
+
+ p $global # prints 2
+
+You can use multiple assignment to swap two values in-place:
+
+ old_value = 1
+
+ new_value, old_value = old_value, 2
+
+ 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:
+
+ a, b = 1, 2, 3
+
+ p a: a, b: b # prints {:a=>1, :b=>2}
+
+You can use <code>*</code> to gather extra values on the right-hand side of
+the assignment.
+
+ a, *b = 1, 2, 3
+
+ p a: a, b: b # prints {:a=>1, :b=>[2, 3]}
+
+The <code>*</code> can appear anywhere on the right-hand side:
+
+ *a, b = 1, 2, 3
+
+ p a: a, b: b # prints {:a=>[1, 2], :b=>3}
+
+But you may only use one <code>*</code> in an assignment.
+
+== Array Decomposition
+
+Like Array decomposition in {method arguments}[rdoc-ref:syntax/methods.rdoc]
+you can decompose an Array during assignment using parenthesis:
+
+ (a, b) = [1, 2]
+
+ p a: a, b: b # prints {:a=>1, :b=>2}
+
+You can decompose an Array as part of a larger multiple assignment:
+
+ a, (b, c) = 1, [2, 3]
+
+ p a: a, b: b, c: c # prints {:a=>1, :b=>2, :c=>3}
+
+Since each decomposition is considered its own multiple assignment you can use
+<code>*</code> to gather arguments in the decomposition:
+
+ a, (b, *c), *d = 1, [2, 3, 4], 5, 6
+
+ p a: a, b: b, c: c, d: d
+ # prints {:a=>1, :b=>2, :c=>[3, 4], :d=>[5, 6]}
+
diff --git a/doc/syntax/calling_methods.rdoc b/doc/syntax/calling_methods.rdoc
new file mode 100644
index 0000000000..79c0de59dc
--- /dev/null
+++ b/doc/syntax/calling_methods.rdoc
@@ -0,0 +1,349 @@
+= Calling Methods
+
+Calling a method sends a message to an object so it can perform some work.
+
+In ruby you send a message to an object like this:
+
+ my_method()
+
+Note that the parenthesis are optional:
+
+ my_method
+
+Except when there is difference between using and omitting parentheses, this
+document uses parenthesis when arguments are present to avoid confusion.
+
+This section only covers calling methods. See also the {syntax documentation
+on defining methods}[rdoc-ref:syntax/methods.rdoc].
+
+== Receiver
+
++self+ is the default receiver. If you don't specify any receiver +self+ will
+be used. To specify a receiver use <code>.</code>:
+
+ my_object.my_method
+
+This sends the +my_method+ message to +my_object+. Any object can be a
+receiver but depending on the method's visibility sending a message may raise a
+NoMethodError.
+
+You may also use <code>::</code> to designate a receiver, but this is rarely
+used due to the potential for confusion with <code>::</code> for namespaces.
+
+== Arguments
+
+There are three types of arguments when sending a message, the positional
+arguments, keyword (or named) arguments and the block argument. Each message
+sent may use one, two or all types of arguments, but the arguments must be
+supplied in this order.
+
+All arguments in ruby are passed by reference and are not lazily evaluated.
+
+Each argument is separated by a <code>,</code>:
+
+ my_method(1, '2', :three)
+
+Arguments may be an expression, a hash argument:
+
+ 'key' => value
+
+or a keyword argument:
+
+ key: value
+
+Hash and keyword arguments must be contiguous and must appear after all
+positional arguments, but may be mixed:
+
+ my_method('a' => 1, b: 2, 'c' => 3)
+
+=== Positional Arguments
+
+The positional arguments for the message follow the method name:
+
+ my_method(argument1, argument2)
+
+In many cases parenthesis are not necessary when sending a message:
+
+ my_method argument1, argument2
+
+However, parenthesis are necessary to avoid ambiguity. This will raise a
+SyntaxError because ruby does not know which method argument3 should be sent
+to:
+
+ method_one argument1, method_two argument2, argument3
+
+If the method definition has a <code>*argument</code> extra positional
+arguments will be assigned to +argument+ in the method as an Array.
+
+If the method definition doesn't include keyword arguments the keyword or
+hash-type arguments are assigned as a single hash to the last argument:
+
+ def my_method(options)
+ p options
+ end
+
+ my_method('a' => 1, b: 2) # prints: {'a'=>1, :b=>2}
+
+If too many positional arguments are given an ArgumentError is raised.
+
+=== Default Positional Arguments
+
+When the method defines default arguments you do not need to supply all the
+arguments to the method. Ruby will fill in the missing arguments in-order.
+
+First we'll cover the simple case where the default arguments appear on the
+right. Consider this method:
+
+ def my_method(a, b, c = 3, d = 4)
+ p [a, b, c, d]
+ end
+
+Here +c+ and +d+ have default values which ruby will apply for you. If you
+send only two arguments to this method:
+
+ my_method(1, 2)
+
+You will see ruby print <code>[1, 2, 3, 4]</code>.
+
+If you send three arguments:
+
+ my_method(1, 2, 5)
+
+You will see ruby print <code>[1, 2, 5, 4]</code>
+
+Ruby fills in the missing arguments from left to right.
+
+Ruby allows default values to appear in the middle of positional arguments.
+Consider this more complicated method:
+
+ def my_method(a, b = 2, c = 3, d)
+ p [a, b, c, d]
+ end
+
+Here +b+ and +c+ have default values. If you send only two arguments to this
+method:
+
+ my_method(1, 4)
+
+You will see ruby print <code>[1, 2, 3, 4]</code>.
+
+If you send three arguments:
+
+ my_method(1, 5, 6)
+
+You will see ruby print <code>[1, 5, 3, 6]</code>.
+
+Describing this in words gets complicated and confusing. I'll describe it
+in variables and values instead.
+
+First <code>1</code> is assigned to +a+, then <code>6</code> is assigned to
++d+. This leaves only the arguments with default values. Since
+<code>5</code> has not been assigned to a value yet, it is given to +b+ and
++c+ uses its default value of <code>3</code>.
+
+=== Keyword Arguments
+
+Keyword arguments follow any positional arguments and are separated by commas
+like positional arguments:
+
+ my_method(positional1, keyword1: value1, keyword2: value2)
+
+Any keyword arguments not given will use the default value from the method
+definition. If a keyword argument is given that the method did not list an
+ArgumentError will be raised.
+
+=== Block Argument
+
+The block argument sends a closure from the calling scope to the method.
+
+The block argument is always last when sending a message to a method. A block
+is sent to a method using <code>do ... end</code> or <code>{ ... }</code>:
+
+ my_method do
+ # ...
+ end
+
+or:
+
+ my_method {
+ # ...
+ }
+
+<code>do end</code> has lower precedence than <code>{ }</code> so:
+
+ method_1 method_2 {
+ # ...
+ }
+
+Sends the block to +method_2+ while:
+
+ method_1 method_2 do
+ # ...
+ end
+
+Sends the block to +method_1+. Note that in the first case if parentheses are
+used the block is sent to +method_1+.
+
+A block will accept arguments from the method it was sent to. Arguments are
+defined similar to the way a method defines arguments. The block's arguments
+go in <code>| ... |</code> following the opening <code>do</code> or
+<code>{</code>:
+
+ my_method do |argument1, argument2|
+ # ...
+ end
+
+==== Block Local Arguments
+
+You may also declare block-local arguments to a block using <code>;</code> in
+the block arguments list. Assigning to a block-local argument will not
+override local arguments outside the block in the caller's scope:
+
+ def my_method
+ yield self
+ end
+
+ place = "world"
+
+ my_method do |obj; place|
+ place = "block"
+ puts "hello #{obj} this is #{place}"
+ end
+
+ puts "place is: #{place}"
+
+This prints:
+
+ hello main this is block
+ place is world
+
+So the +place+ variable in the block is not the same +place+ variable as
+outside the block. Removing <code>; place</code> from the block arguments
+gives this result:
+
+ hello main this is block
+ place is block
+
+=== Array to Arguments Conversion
+
+Given the following method:
+
+ def my_method(argument1, argument2, argument3)
+ end
+
+You can turn an Array into an argument list with <code>*</code> (or splat)
+operator:
+
+ arguments = [1, 2, 3]
+ my_method(*arguments)
+
+or:
+
+ arguments = [2, 3]
+ my_method(1, *arguments)
+
+Both are equivalent to:
+
+ my_method(1, 2, 3)
+
+If the method accepts keyword arguments the splat operator will convert a hash
+at the end of the array into keyword arguments:
+
+ def my_method(a, b, c: 3)
+ end
+
+ arguments = [1, 2, { c: 4 }]
+ my_method(*arguments)
+
+You may also use the <code>**</code> (described next) to convert a Hash into
+keyword arguments.
+
+If the number of objects in the Array do not match the number of arguments for
+the method an ArgumentError will be raised.
+
+If the splat operator comes first in the call, parentheses must be used to
+avoid a warning.
+
+=== Hash to Keyword Arguments Conversion
+
+Given the following method:
+
+ def my_method(first: 1, second: 2, third: 3)
+ end
+
+You can turn a Hash into keyword arguments with the <code>**</code> operator:
+
+ arguments = { first: 3, second: 4, third: 5 }
+ my_method(**arguments)
+
+or:
+
+ arguments = { first: 3, second: 4 }
+ my_method(third: 5, **arguments)
+
+Both are equivalent to:
+
+ my_method(first: 3, second: 4, third: 5)
+
+If the method definition uses <code>**</code> to gather arbitrary keyword
+arguments they will not be gathered by <code>*</code>:
+
+ def my_method(*a, **kw)
+ p arguments: a, keywords: kw
+ end
+
+ my_method(1, 2, '3' => 4, five: 6)
+
+Prints:
+
+ {:arguments=>[1, 2], :keywords=>{"3"=>4, :five=>6}}
+
+Unlike the splat operator described above the <code>**</code> operator has no
+commonly recognized name.
+
+=== Proc to Block Conversion
+
+Given a method that use a block:
+
+ def my_method
+ yield self
+ end
+
+You can convert a proc or lambda to a block argument with the <code>&</code>
+operator:
+
+ argument = proc { |a| puts "#{a.inspect} was yielded" }
+
+ my_method(&argument)
+
+If the splat operator comes first in the call, parenthesis must be used to
+avoid a warning.
+
+Unlike the splat operator described above the <code>&</code> operator has no
+commonly recognized name.
+
+== Method Lookup
+
+When you send a message Ruby looks up the method that matches the name of the
+message for the receiver. Methods are stored in classes and modules so method
+lookup walks these, not the objects themselves.
+
+Here is the order of method lookup for the receiver's class or module +R+:
+
+* The prepended modules of +R+ in reverse order
+* For a matching method in +R+
+* The included modules of +R+ in reverse order
+
+If +R+ is a class with a superclass, this is repeated with +R+'s superclass
+until a method is found.
+
+Once a match is found method lookup stops.
+
+If no match is found this repeats from the beginning, but looking for
++method_missing+. The default +method_missing+ is BasicObject#method_missing
+which raises a NameError when invoked.
+
+If refinements (an experimental feature) are active the method lookup changes.
+See the {refinements documentation}[rdoc-ref:syntax/refinements.rdoc] for
+details.
+
diff --git a/doc/syntax/control_expressions.rdoc b/doc/syntax/control_expressions.rdoc
new file mode 100644
index 0000000000..0efc1668ad
--- /dev/null
+++ b/doc/syntax/control_expressions.rdoc
@@ -0,0 +1,500 @@
+= Control Expressions
+
+Ruby has a variety of ways to control execution. All the expressions described
+here return a value.
+
+For the tests in these control expressions, +nil+ and +false+ are false-values
+and +true+ and any other object are true-values. In this document "true" will
+mean "true-value" and "false" will mean "false-value".
+
+== +if+ Expression
+
+The simplest +if+ expression has two parts, a "test" expression and a "then"
+expression. If the "test" expression evaluates to a true then the "then"
+expression is evaluated.
+
+Here is a simple if statement:
+
+ if true then
+ puts "the test resulted in a true-value"
+ end
+
+This will print "the test resulted in a true-value".
+
+The +then+ is optional:
+
+ if true
+ puts "the test resulted in a true-value"
+ end
+
+This document will omit the optional +then+ for all expressions as that is the
+most common usage of +if+.
+
+You may also add an +else+ expression. If the test does not evaluate to true
+the +else+ expression will be executed:
+
+ if false
+ puts "the test resulted in a true-value"
+ else
+ puts "the test resulted in a false-value"
+ end
+
+This will print "the test resulted in a false-value".
+
+You may add an arbitrary number of extra tests to an if expression using
++elsif+. An +elsif+ executes when all tests above the +elsif+ are false.
+
+ a = 1
+
+ if a == 0
+ puts "a is zero"
+ elsif a == 1
+ puts "a is one"
+ else
+ puts "a is some other value"
+ end
+
+This will print "a is one" as <code>1</code> is not equal to <code>0</code>.
+Since +else+ is only executed when there are no matching conditions.
+
+Once a condition matches, either the +if+ condition or any +elsif+ condition,
+the +if+ expression is complete and no further tests will be performed.
+
+Like an +if+, an +elsif+ condition may be followed by a +then+.
+
+In this example only "a is one" is printed:
+
+ a = 1
+
+ if a == 0
+ puts "a is zero"
+ elsif a == 1
+ puts "a is one"
+ elsif a >= 1
+ puts "a is greater than or equal to one"
+ else
+ puts "a is some other value"
+ end
+
+The tests for +if+ and +elsif+ may have side-effects. The most common use of
+side-effect is to cache a value into a local variable:
+
+ if a = object.some_value
+ # do something to a
+ end
+
+The result value of an +if+ expression is the last value executed in the
+expression.
+
+== Ternary if
+
+You may also write a if-then-else expression using <code>?</code> and
+<code>:</code>. This ternary if:
+
+ input_type = gets =~ /hello/i ? "greeting" : "other"
+
+Is the same as this +if+ expression:
+
+ input_type =
+ if gets =~ /hello/i
+ "greeting"
+ else
+ "other"
+ end
+
+While the ternary if is much shorter to write than the more verbose form, for
+readability it is recommended that the ternary if is only used for simple
+conditionals. Also, avoid using multiple ternary conditions in the same
+expression as this can be confusing.
+
+== +unless+ Expression
+
+The +unless+ expression is the opposite of the +if+ expression. If the value
+is false the "then" expression is executed:
+
+ unless true
+ puts "the value is a false-value"
+ end
+
+This prints nothing as true is not a false-value.
+
+You may use an optional +then+ with +unless+ just like +if+.
+
+Note that the above +unless+ expression is the same as:
+
+ if not true
+ puts "the value is a false-value"
+ end
+
+Like an +if+ expression you may use an +else+ condition with +unless+:
+
+ unless true
+ puts "the value is false"
+ else
+ puts "the value is true"
+ end
+
+This prints "the value is true" from the +else+ condition.
+
+You may not use +elsif+ with an +unless+ expression.
+
+The result value of an +unless+ expression is the last value executed in the
+expression.
+
+== Modifier +if+ and +unless+
+
++if+ and +unless+ can also be used to modify an expression. When used as a
+modifier the left-hand side is the "then" expression and the right-hand side
+is the "test" expression:
+
+ a = 0
+
+ a += 1 if a.zero?
+
+ p a
+
+This will print 1.
+
+ a = 0
+
+ a += 1 unless a.zero?
+
+ p a
+
+This will print 0.
+
+While the modifier and standard versions have both a "test" expression and a
+"then" expression, they are not exact transformations of each other due to
+parse order. Here is an example that shows the difference:
+
+ p a if a = 0.zero?
+
+This raises the NameError "undefined local variable or method `a'".
+
+When ruby parses this expression it first encounters +a+ as a method call in
+the "then" expression, then later it sees the assignment to +a+ in the "test"
+expression and marks +a+ as a local variable.
+
+When running this line it first executes the "test" expression, <code>a =
+0.zero?</code>.
+
+Since the test is true it executes the "then" expression, <code>p a</code>.
+Since the +a+ in the body was recorded as a method which does not exist the
+NameError is raised.
+
+The same is true for +unless+.
+
+== +case+ Expression
+
+The +case+ expression can be used in two ways.
+
+The most common way is to compare an object against multiple patterns. The
+patterns are matched using the +===+ method which is aliased to +==+ on
+Object. Other classes must override it to give meaningful behavior. See
+Module#=== and Regexp#=== for examples.
+
+Here is an example of using +case+ to compare a String against a pattern:
+
+ case "12345"
+ when /^1/
+ puts "the string starts with one"
+ else
+ puts "I don't know what the string starts with"
+ end
+
+Here the string <code>"12345"</code> is compared with <code>/^1/</code> by
+calling <code>/^1/ === "12345"</code> which returns +true+. Like the +if+
+expression the first +when+ that matches is executed and all other matches are
+ignored.
+
+If no matches are found the +else+ is executed.
+
+The +else+ and +then+ are optional, this +case+ expression gives the same
+result as the one above:
+
+ case "12345"
+ when /^1/
+ puts "the string starts with one"
+ end
+
+You may place multiple conditions on the same +when+:
+
+ case "2"
+ when /^1/, "2"
+ puts "the string starts with one or is '2'"
+ end
+
+Ruby will try each condition in turn, so first <code>/^1/ === "2"</code>
+returns +false+, then <code>"2" === "2"</code> returns +true+, so "the string
+starts with one or is '2'" is printed.
+
+You may use +then+ after the +when+ condition. This is most frequently used
+to place the body of the +when+ on a single line.
+
+ case a
+ when 1, 2 then puts "a is one or two
+ when 3 then puts "a is three"
+ else puts "I don't know what a is"
+ end
+
+The other way to use a +case+ expression is like an if-elsif expression:
+
+ a = 2
+
+ case
+ when a == 1, a == 2
+ puts "a is one or two"
+ when a == 3
+ puts "a is three"
+ else
+ puts "I don't know what a is"
+ end
+
+Again, the +then+ and +else+ are optional.
+
+The result value of a +case+ expression is the last value executed in the
+expression.
+
+== +while+ Loop
+
+The +while+ loop executes while a condition is true:
+
+ a = 0
+
+ while a < 10 do
+ p a
+ a += 1
+ end
+
+ p a
+
+Prints the numbers 0 through 10. The condition <code>a < 10</code> is checked
+before the loop is entered, then the body executes, then the condition is
+checked again. When the condition results in false the loop is terminated.
+
+The +do+ keyword is optional. The following loop is equivalent to the loop
+above:
+
+ while a < 10
+ p a
+ a += 1
+ end
+
+The result of a +while+ loop is +nil+ unless +break+ is used to supply a
+value.
+
+== +until+ Loop
+
+The +until+ loop executes while a condition is false:
+
+ a = 0
+
+ until a > 10 do
+ p a
+ a += 1
+ end
+
+ p a
+
+This prints the numbers 0 through 11. Like a while loop the condition <code>a
+> 10</code> is checked when entering the loop and each time the loop body
+executes. If the condition is false the loop will continue to execute.
+
+Like a +while+ loop the +do+ is optional.
+
+Like a +while+ loop the result of an +until+ loop is nil unless +break+ is
+used.
+
+== +for+ Loop
+
+The +for+ loop consists of +for+ followed by a variable to contain the
+iteration argument followed by +in+ and the value to iterate over using #each.
+The +do+ is optional:
+
+ for value in [1, 2, 3] do
+ puts value
+ end
+
+Prints 1, 2 and 3.
+
+Like +while+ and +until+, the +do+ is optional.
+
+The +for+ loop is similar to using #each, but does not create a new variable
+scope.
+
+The result value of a +for+ loop is the value iterated over unless +break+ is
+used.
+
+The +for+ loop is rarely used in modern ruby programs.
+
+== Modifier +while+ and +until+
+
+Like +if+ and +unless+, +while+ and +until+ can be used as modifiers:
+
+ a = 0
+
+ a += 1 while a < 10
+
+ p a # prints 10
+
++until+ used as a modifier:
+
+ a = 0
+
+ a += 1 until a > 10
+
+ p a # prints 11
+
+You can use +begin+ and +end+ to create a +while+ loop that runs the body once
+before the condition:
+
+ a = 0
+
+ begin
+ a += 1
+ end while a < 10
+
+ p a # prints 10
+
+If you don't use +rescue+ or +ensure+ Ruby optimizes away any exception
+handling overhead.
+
+== +break+ Statement
+
+Use +break+ to leave a block early. This will stop iterating over the items in +values+ if one of them is even:
+
+ values.each do |value|
+ break if value.even?
+
+ # ...
+ end
+
+You can also terminate from a +while+ loop using +break+:
+
+ a = 0
+
+ while true do
+ p a
+ a += 1
+
+ break if a < 10
+ end
+
+ p a
+
+This prints the numbers 0 and 1.
+
++break+ accepts a value that supplies the result of the expression it is
+"breaking" out of:
+
+ result = [1, 2, 3].each do |value|
+ break value * 2 if value.even?
+ end
+
+ p result # prints 4
+
+== +next+ Statement
+
+Use +next+ to skip the rest of the current iteration:
+
+ result = [1, 2, 3].map do |value|
+ next if value.even?
+
+ value * 2
+ end
+
+ p result # prints [2, nil, 6]
+
++next+ accepts an argument that can be used the result of the current block
+iteration:
+
+ result = [1, 2, 3].map do |value|
+ next value if value.even?
+
+ value * 2
+ end
+
+ p result # prints [2, 2, 6]
+
+== +redo+ Statement
+
+Use +redo+ to redo the current iteration:
+
+ result = []
+
+ while result.length < 10 do
+ result << result.length
+
+ redo if result.last.even?
+
+ result << result.length + 1
+ end
+
+ p result
+
+This prints [0, 1, 3, 3, 5, 5, 7, 7, 9, 9, 11]
+
+In Ruby 1.8 you could also use +retry+ where you used +redo+. This is no
+longer true, now you will receive a SyntaxError when you use +retry+ outside
+of a +rescue+ block. See {Exceptions}[rdoc-ref:syntax/exceptions.rdoc]
+for proper usage of +retry+.
+
+== Flip-Flop
+
+The flip-flop is rarely seen conditional expression. It's primary use is
+for processing text from ruby one-line programs used with <code>ruby -n</code>
+or <code>ruby -p</code>.
+
+The form of the flip-flop is an expression that indicates when the
+flip-flop turns on, <code>..</code> (or <code>...</code>), then an expression
+that indicates when the flip-flop will turn off. While the flip-flop is on it
+will continue to evaluate to +true+, and +false+ when off.
+
+Here is an example:
+
+
+ selected = []
+
+ 0.upto 10 do |value|
+ selected << value if value==2..value==8
+ end
+
+ p selected # prints [2, 3, 4, 5, 6, 7, 8]
+
+In the above example the on condition is <code>n==2</code>. The flip-flop
+is initially off (false) for 0 and 1, but becomes on (true) for 2 and remains
+on through 8. After 8 it turns off and remains off for 9 and 10.
+
+The flip-flop must be used inside a conditional such as +if+, +while+,
++unless+, +until+ etc. including the modifier forms.
+
+When you use an inclusive range (<code>..</code>) the off condition is
+evaluated when the on condition changes:
+
+ selected = []
+
+ 0.upto 5 do |value|
+ selected << value if value==2..value==2
+ end
+
+ p selected # prints [2]
+
+Here both sides of the flip-flop are evaluated so the flip-flop turns on and
+off only when +value+ equals 2. Since the flip-flop turned on in the
+iteration it returns true.
+
+When you use an exclusive range (<code>...</code>) the off condition is
+evaluated on the following iteration:
+
+ selected = []
+
+ 0.upto 5 do |value|
+ selected << value if value==2...value==2
+ end
+
+ p selected # prints [2, 3, 4, 5]
+
+Here the flip-flop turns on when +value+ equals 2 but doesn't turn off on the
+same iteration. The off condition isn't evaluated until the following
+iteration and +value+ will never be two again.
+
diff --git a/doc/syntax/exceptions.rdoc b/doc/syntax/exceptions.rdoc
new file mode 100644
index 0000000000..0efc35a59f
--- /dev/null
+++ b/doc/syntax/exceptions.rdoc
@@ -0,0 +1,96 @@
+= Exception Handling
+
+Exceptions are rescued in a +begin+/+end+ block:
+
+ begin
+ # code that might raise
+ rescue
+ # handle exception
+ end
+
+If you are inside a method you do not need to use +begin+ or +end+ unless you
+wish to limit the scope of rescued exceptions:
+
+ def my_method
+ # ...
+ rescue
+ # ...
+ end
+
+The same is true for a +class+ or +module+.
+
+You can assign the exception to a local variable by using <tt>=>
+variable_name</tt> at the end of the +rescue+ line:
+
+ begin
+ # ...
+ rescue => exception
+ warn exception.message
+ raise # re-raise the current exception
+ end
+
+By default StandardError and its subclasses are rescued. You can rescue a
+specific set of exception classes (and their subclasses) by listing them after
++rescue+:
+
+ begin
+ # ...
+ rescue ArgumentError, NameError
+ # handle ArgumentError or NameError
+ end
+
+You may rescue different types of exceptions in different ways:
+
+ begin
+ # ...
+ rescue ArgumentError
+ # handle ArgumentError
+ rescue NameError
+ # handle NameError
+ rescue
+ # handle any StandardError
+ end
+
+The exception is matched to the rescue section starting at the top, and matches
+only once. If an ArgumentError is raised in the begin section it will not be
+handled in the StandardError section.
+
+You may retry rescued exceptions:
+
+ begin
+ # ...
+ rescue
+ # do something that may change the result of the begin block
+ retry
+ end
+
+Execution will resume at the start of the begin block, so be careful not to
+create an infinite loop.
+
+Inside a rescue block is the only valid location for +retry+, all other uses
+will raise a SyntaxError. If you wish to retry a block iteration use +redo+.
+See {Control Expressions}[rdoc-ref:syntax/control_expressions.rdoc] for
+details.
+
+To always run some code whether an exception was raised or not, use +ensure+:
+
+ begin
+ # ...
+ rescue
+ # ...
+ ensure
+ # this always runs
+ end
+
+You may also run some code when an exception is not raised:
+
+ begin
+ # ...
+ rescue
+ # ...
+ else
+ # this runs only when no exception was raised
+ ensure
+ # ...
+ end
+
diff --git a/doc/syntax/literals.rdoc b/doc/syntax/literals.rdoc
new file mode 100644
index 0000000000..e01b6875d4
--- /dev/null
+++ b/doc/syntax/literals.rdoc
@@ -0,0 +1,307 @@
+= Literals
+
+Literals create objects you can use in your program. Literals include:
+
+* Booleans and nil
+* Numbers
+* Strings
+* Symbols
+* Arrays
+* Hashes
+* Ranges
+* Regular Expressions
+* Procs
+
+== Booleans and nil
+
++nil+ and +false+ are both false values. +nil+ is sometimes used to indicate
+"no value" or "unknown" but evaluates to +false+ in conditional expressions.
+
++true+ is a true value. All objects except +nil+ and +false+ evaluate to a
+true value in conditional expressions.
+
+(There are also the constants +TRUE+, +FALSE+ and +NIL+, but the lowercase
+literal forms are preferred.)
+
+== Numbers
+
+You can write integers of any size as follows:
+
+ 1234
+ 1_234
+
+These numbers have the same value, 1,234. The underscore may be used to
+enhance readability for humans. You may place an underscore anywhere in the
+number.
+
+Floating point numbers may be written as follows:
+
+ 12.34
+ 1234e-2
+ 1.234E1
+
+These numbers have the same value, 12.34. You may use underscores in floating
+point numbers as well.
+
+You can use a special prefix to write numbers in decimal, hexadecimal, octal
+or binary formats. For decimal numbers use a prefix of <tt>0d</tt>, for
+hexadecimal numbers use a prefix of <tt>0x</tt>, for octal numbers use a
+prefix of <tt>0</tt> or <tt>0o</tt>, for binary numbers use a prefix of
+<tt>0b</tt>. The alphabetic component of the number is not case-sensitive.
+
+Examples:
+
+ 0d170
+ 0D170
+
+ 0xaa
+ 0xAa
+ 0xAA
+ 0Xaa
+ 0XAa
+ 0XaA
+
+ 0252
+ 0o252
+ 0O252
+
+ 0b10101010
+ 0B10101010
+
+All these numbers have the same decimal value, 170. Like integers and floats
+you may use an underscore for readability.
+
+== Strings
+
+The most common way of writing strings is using <tt>"</tt>:
+
+ "This is a string."
+
+The string may be many lines long.
+
+Any internal <tt>"</tt> must be escaped:
+
+ "This string has a quote: \". As you can see, it is escaped"
+
+Double-quote strings allow escaped characters such as <tt>\n</tt> for newline,
+<tt>\t</tt> for tab, etc.
+
+Double-quote strings allow interpolation of other values using
+<tt>#{...}</tt>:
+
+ "One plus one is two: #{1 + 1}"
+
+Any expression may be placed inside the interpolated section, but it's best to
+keep the expression small for readability.
+
+Interpolation may be disabled by escaping the "#" character or using
+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>).
+
+You may also create strings using <tt>%</tt>:
+
+ %(1 + 1 is #{1 + 1}) #=> "1 + 1 is 2"
+
+There are two different types of <tt>%</tt> strings <tt>%q(...)</tt> behaves
+like a single-quote string (no interpolation or character escaping) while
+<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
+"heredoc":
+
+ expected_result = <<HEREDOC
+ This would contain specially formatted text.
+
+ That might span many lines
+ HEREDOC
+
+The heredoc starts on the line following <tt><<HEREDOC</tt> and ends with the
+next line that starts with <tt>HEREDOC</tt>. The result includes the ending
+newline.
+
+You may use any identifier with a heredoc, but all-uppercase identifiers are
+typically used.
+
+You may indent the ending identifier if you place a "-" after <tt><<</tt>:
+
+ expected_result = <<-INDENTED_HEREDOC
+ This would contain specially formatted text.
+
+ That might span many lines
+ INDENTED_HEREDOC
+
+Note that the while the closing identifier may be indented, the content is
+always treated as if it is flush left. If you indent the content those spaces
+will appear in the output.
+
+A heredoc allows interpolation and escaped characters. You may disable
+interpolation and escaping by surrounding the opening identifier with single
+quotes:
+
+ expected_result = <<-'EXPECTED'
+ One plus one is #{1 + 1}
+ EXPECTED
+
+ p expected_result # prints: "One plus one is \#{1 + 1}\n"
+
+The identifier may also be surrounded with double quotes (which is the same as
+no quotes) or with backticks. When surrounded by backticks the HEREDOC
+behaves like Kernel#`:
+
+ puts <<-`HEREDOC`
+ cat #{__FILE__}
+ HEREDOC
+
+To call a method on a heredoc place it after the opening identifier:
+
+ expected_result = <<-EXPECTED.chomp
+ One plus one is #{1 + 1}
+ EXPECTED
+
+You may open multiple heredocs on the same line, but this can be difficult to
+read:
+
+ puts(<<-ONE, <<-TWO)
+ content for heredoc one
+ ONE
+ content for heredoc two
+ TWO
+
+== Symbols
+
+A Symbol represents a name inside the ruby interpreter. See Symbol for more
+details on what symbols are and when ruby creates them internally.
+
+You may reference a symbol using a colon: <tt>:my_symbol</tt>.
+
+You may also create symbols by interpolation:
+
+ :"my_symbol1"
+ :"my_symbol#{1 + 1}"
+
+Note that symbols are never garbage collected so be careful when referencing
+symbols using interpolation.
+
+Like strings, a single-quote may be used to disable interpolation:
+
+ :'my_symbol#{1 + 1}' #=> :"my_symbol\#{1 + 1}"
+
+When creating a Hash there is a special syntax for referencing a Symbol as
+well.
+
+== Arrays
+
+An array is created using the objects between <tt>[</tt> and <tt>]</tt>:
+
+ [1, 2, 3]
+
+You may place expressions inside the array:
+
+ [1, 1 + 1, 1 + 2]
+ [1, [1 + 1, [1 + 2]]]
+
+See Array for the methods you may use with an array.
+
+== Hashes
+
+A hash is created using key-value pairs between <tt>{</tt> and <tt>}</tt>:
+
+ { "a" => 1, "b" => 2 }
+
+Both the key and value may be any object.
+
+You can create a hash using symbol keys with the following syntax:
+
+ { a: 1, b: 2 }
+
+This same syntax is used for keyword arguments for a method.
+
+See Hash for the methods you may use with a hash.
+
+== Ranges
+
+A range represents an interval of values. The range may include or exclude
+its ending value.
+
+ (1..2) # includes its ending value
+ (1...2) # excludes its ending value
+
+You may create a range of any object. See the Range documentation for details
+on the methods you need to implement.
+
+== Regular Expressions
+
+A regular expression is created using "/":
+
+ /my regular expression/
+
+The regular expression may be followed by flags which adjust the matching
+behavior of the regular expression. The "i" flag makes the regular expression
+case-insensitive:
+
+ /my regular expression/i
+
+Interpolation may be used inside regular expressions along with escaped
+characters. Note that a regular expression may require additional escaped
+characters than a string.
+
+See Regexp for a description of the syntax of regular expressions.
+
+== Procs
+
+A proc can be created with <tt>-></tt>:
+
+ -> { 1 + 1 }
+
+Calling the above proc will give a result of <tt>2</tt>.
+
+You can require arguments for the proc as follows:
+
+ ->(v) { 1 + v }
+
+This proc will add one to its argument.
+
+== Percent Strings
+
+Besides <tt>%(...)</tt> which creates a String, The <tt>%</tt> may create
+other types of object. As with strings, an uppercase letter allows
+interpolation and escaped characters while a lowercase letter disables them.
+
+These are the types of percent strings in ruby:
+
+<tt>%i</tt> :: Array of Symbols
+<tt>%q</tt> :: String
+<tt>%r</tt> :: Regular Expression
+<tt>%s</tt> :: Symbol
+<tt>%w</tt> :: Array of Strings
+<tt>%x</tt> :: Backtick (capture subshell result)
+
+For the two array forms of percent string, if you wish to include a space in
+one of the array entries you must escape it with a "\\" character:
+
+ %w[one one-hundred\ one]
+ #=> ["one", "one-hundred one"]
+
+If you are using "(", "[", "{", "<" you must close it with ")", "]", "}", ">"
+respectively. You may use most other non-alphanumeric characters for percent
+string delimiters such as "%", "|", "^", etc.
+
diff --git a/doc/syntax/methods.rdoc b/doc/syntax/methods.rdoc
new file mode 100644
index 0000000000..7fd69983f3
--- /dev/null
+++ b/doc/syntax/methods.rdoc
@@ -0,0 +1,414 @@
+= Methods
+
+Methods implement the functionality of your program. Here is a simple method
+definition:
+
+ def one_plus_one
+ 1 + 1
+ 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+.
+
+This section only covers defining methods. See also the {syntax documentation
+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.
+
+(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.)
+
+Method names may contain letters, numbers, an <code>_</code> (underscore or
+low line) or a character with the eight bit set.
+
+Method names may end with a <code>!</code> (bang or exclamation mark), a
+<code>?</code> (question mark) or <code>=</code> equals sign.
+
+In the ruby core library when a method ends with a bang it indicates there is
+a non-bang method that has does not modify the receiver. This is typically
+true for the standard library but does not hold true for other ruby libraries.
+
+Methods that end with a question mark do not always return just +true+ or
++false+. Often they will may return an object to indicate a true value (or
+"truthy" value).
+
+Methods that end with an equals sign indicate an assignment method. For
+assignment methods the return value is ignored, the arguments are returned
+instead.
+
+These are method names for the various ruby operators. Each of these
+operators accept only one argument. Following the operator is the typical
+use or name of the operator. Creating an alternate meaning for the operator
+may lead to confusion as the user expects plus to add things, minus to
+subtract things, etc. Additionally, you cannot alter the precedence of the
+operators.
+
+<code>+</code> :: add
+<code>-</code> :: subtract
+<code>*</code> :: multiply
+<code>**</code> :: power
+<code>/</code> :: divide
+<code>%</code> :: modulus division, String#%
+<code>&</code> :: AND
+<code>^</code> :: XOR (exclusive OR)
+<code>>></code> :: right-shift
+<code><<</code> :: left-shift, append
+<code>==</code> :: equal
+<code>!=</code> :: not equal
+<code>===</code> :: case equality. See Object#===
+<code>=~</code> :: pattern match. (Not just for regular expressions)
+<code>!~</code> :: does not match
+<code><=></code> :: comparison aka spaceship operator. See Comparable
+<code><</code> :: less-than
+<code><=</code> :: less-than or equal
+<code>></code> :: greater-than
+<code>>=</code> :: greater-than or equal
+
+To define unary methods minus, plus, tilde and not (<code>!</code>) follow the
+operator with an <code>@</code> as in <code>+@</code> or <code>!@</code>:
+
+ class C
+ def -@
+ puts "you inverted this object"
+ end
+ end
+
+ obj = C.new
+
+ -obj # prints "you inverted this object"
+
+Unary methods accept zero arguments.
+
+== Return Values
+
+By default, a method returns the last expression that was evaluated in the body
+of the method. In the example above, the last (and only) expression evaluated
+was the simple sum <code>1 + 1</code>. The +return+ keyword can be used to
+make it explicit that a method returns a value.
+
+ def one_plus_one
+ return 1 + 1
+ end
+
+It can also be used to make a method return before the last expression is
+evaluated.
+
+ def two_plus_two
+ return 2 + 2
+ 1 + 1 # this expression is never evaluated
+ end
+
+Note that for assignment methods the return value will always be ignored.
+Instead the argument will be returned:
+
+ def a=(value)
+ return 1 + value
+ end
+
+ p(a = 5) # prints 5
+
+== Scope
+
+The standard syntax to define a method:
+
+ def my_method
+ # ...
+ end
+
+adds the method to a class. You can define an instance method on a specific
+class with the +class+ keyword:
+
+ class C
+ def my_method
+ # ...
+ end
+ end
+
+A method may be defined on another object. You may define a "class method" (a
+method that is defined on the class, not an instance of the class) like this:
+
+ class C
+ def self.my_method
+ # ...
+ end
+ end
+
+However, this is simply a special case of a greater syntactical power in Ruby,
+the ability to add methods to any object. Classes are objects, so adding
+class methods is simply adding methods to the Class object.
+
+The syntax for adding a method to an object is as follows:
+
+ greeting = "Hello"
+
+ def greeting.broaden
+ self + ", world!"
+ end
+
+ greeting.broaden # returns "Hello, world!"
+
++self+ is a keyword referring to the current object under consideration
+by the compiler, which might make the use of +self+ in defining a class
+method above a little clearer. Indeed, the example of adding a +hello+
+method to the class +String+ can be rewritten thus:
+
+ def String.hello
+ "Hello, world!"
+ end
+
+A method defined like this is called a "singleton method". +broaden+ will only
+exist on the string instance +greeting+. Other strings will not have +broaden+.
+
+== Overriding
+
+When Ruby encounters the +def+ keyword, it doesn't consider it an error if the
+method already exists: it simply redefines it. This is called
+_overriding_. Rather like extending core classes, this is a potentially
+dangerous ability, and should be used sparingly because it can cause unexpected
+results. For example, consider this irb session:
+
+ >> "43".to_i
+ => 43
+ >> class String
+ >> def to_i
+ >> 42
+ >> end
+ >> end
+ => nil
+ >> "43".to_i
+ => 42
+
+This will effectively sabotage any code which makes use of the method
+<code>String#to_i</code> to parse numbers from strings.
+
+== Arguments
+
+A method may accept arguments. The argument list follows the method name:
+
+ def add_one(value)
+ value + 1
+ end
+
+When called, the user of the +add_one+ method must provide an argument. The
+argument is a local variable in the method body. The method will then add one
+to this argument and return the value. If given +1+ this method will
+return +2+.
+
+The parentheses around the arguments are optional:
+
+ def add_one value
+ value + 1
+ end
+
+Multiple arguments are separated by a comma:
+
+ def add_values(a, b)
+ a + b
+ end
+
+When called, the arguments must be provided in the exact order. In other
+words, the arguments are positional.
+
+=== Default Values
+
+Arguments may have default values:
+
+ def add_values(a, b = 1)
+ a + b
+ end
+
+The default value does not need to appear first, but arguments with defaults
+must be grouped together. This is ok:
+
+ def add_values(a = 1, b = 2, c)
+ a + b + c
+ end
+
+This will raise a SyntaxError:
+
+ def add_values(a = 1, b, c = 1)
+ a + b + c
+ end
+
+=== Array Decomposition
+
+You can decompose (unpack or extract values from) an Array using extra
+parentheses in the arguments:
+
+ def my_method((a, b))
+ p a: a, b: b
+ end
+
+ my_method([1, 2])
+
+This prints:
+
+ {:a=>1, :b=>2}
+
+If the argument has extra elements in the Array they will be ignored:
+
+ def my_method((a, b))
+ p a: a, b: b
+ end
+
+ my_method([1, 2, 3])
+
+This has the same output as above.
+
+You can use a <code>*</code> to collect the remaining arguments. This splits
+an Array into a first element and the rest:
+
+ def my_method((a, *b))
+ p a: a, b: b
+ end
+
+ my_method([1, 2, 3])
+
+This prints:
+
+ {:a=>1, :b=>[2, 3]}
+
+The argument will be decomposed if it responds to #to_ary. You should only
+define #to_ary if you can use your object in place of an Array.
+
+Use of the inner parentheses only uses one of the sent arguments. If the
+argument is not an Array it will be assigned to the first argument in the
+decomposition and the remaining arguments in the decomposition will be +nil+:
+
+ def my_method(a, (b, c), d)
+ p a: a, b: b, c: c, d: d
+ end
+
+ my_method(1, 2, 3)
+
+This prints:
+
+ {:a=>1, :b=>2, :c=>nil, :d=>3}
+
+You can nest decomposition arbitrarily:
+
+ def my_method(((a, b), c))
+ # ...
+ end
+
+=== Array/Hash Argument
+
+Prefixing an argument with <code>*</code> causes any remaining arguments to be
+converted to an Array:
+
+ def gather_arguments(*arguments)
+ p arguments
+ end
+
+ gather_arguments 1, 2, 3 # prints [1, 2, 3]
+
+The array argument must be the last positional argument, it must appear before
+any keyword arguments.
+
+The array argument will capture a Hash as the last entry if a hash was sent by
+the caller after all positional arguments.
+
+ gather_arguments 1, a: 2 # prints [1, {:a=>2}]
+
+However, this only occurs if the method does not declare any keyword arguments.
+
+ def gather_arguments_keyword(*positional, keyword: nil)
+ p positional: positional, keyword: keyword
+ end
+
+ gather_arguments_keyword 1, 2, three: 3
+ #=> raises: unknown keyword: three (ArgumentError)
+
+Also, note that a bare <code>*</code> can be used to ignore arguments:
+
+ def ignore_arguments(*)
+ end
+
+=== Keyword Arguments
+
+Keyword arguments are similar to positional arguments with default values:
+
+ def add_values(first: 1, second: 2)
+ first + second
+ end
+
+Arbitrary keyword arguments will be accepted with <code>**</code>:
+
+ def gather_arguments(first: nil, **rest)
+ p first, rest
+ end
+
+ gather_arguments first: 1, second: 2, third: 3
+ # prints 1 then {:second=>2, :third=>3}
+
+When calling a method with keyword arguments the arguments may appear in any
+order. If an unknown keyword argument is sent by the caller an ArgumentError
+is raised.
+
+When mixing keyword arguments and positional arguments, all positional
+arguments must appear before any keyword arguments.
+
+== Block Argument
+
+The block argument is indicated by <code>&</code> and must come last:
+
+ def my_method(&my_block)
+ my_method.call(self)
+ end
+
+Most frequently the block argument is used to pass a block to another method:
+
+ def each_item(&block)
+ @items.each(&block)
+ end
+
+If you are only going to call the block and will not otherwise manipulate it
+or send it to another method using <code>yield</code> without an explicit
+block parameter is preferred. This method is equivalent to the first method
+in this section:
+
+ def my_method
+ yield self
+ end
+
+There is also a performance benefit to using yield over a calling a block
+parameter. When a block argument is assigned to a variable a Proc object is
+created which holds the block. When using yield this Proc object is not
+created.
+
+If you only need to use the block sometimes you can use Proc.new to create a
+proc from the block that was passed to your method. See Proc.new for further
+details.
+
+== Exception Handling
+
+Methods have an implied exception handling block so you do not need to use
++begin+ or +end+ to handle exceptions. This:
+
+ def my_method
+ begin
+ # code that may raise an exception
+ rescue
+ # handle exception
+ end
+ end
+
+May be written as:
+
+ def my_method
+ # code that may raise an exception
+ rescue
+ # handle exception
+ end
+
+If you wish to rescue an exception for only part of your method use +begin+ and
++end+. For more details see the page on {exception
+handling}[rdoc-ref:syntax/exceptions.rdoc].
+
diff --git a/doc/syntax/miscellaneous.rdoc b/doc/syntax/miscellaneous.rdoc
new file mode 100644
index 0000000000..8f424f019f
--- /dev/null
+++ b/doc/syntax/miscellaneous.rdoc
@@ -0,0 +1,107 @@
+= Miscellaneous Syntax
+
+== Ending an Expression
+
+Ruby uses a newline as the end of an expression. When ending a line with an
+operator, open parentheses, comma, etc. the expression will continue.
+
+You can end an expression with a <code>;</code> (semicolon). Semicolons are
+most frequently used with <code>ruby -e</code>.
+
+== Indentation
+
+Ruby does not require any indentation. Typically ruby programs are indented
+two spaces.
+
+If you run ruby with warnings enabled and have an indentation mis-match you
+will receive a warning.
+
+== +alias+
+
+The +alias+ keyword is most frequently used to alias methods. When aliasing a
+method you can use either its name or a symbol:
+
+ alias new_name old_name
+ alias :new_name :old_name
+
+For methods, Module#alias_method can often be used instead of +alias+.
+
+You can also use +alias+ to alias global variables:
+
+ $old = 0
+
+ alias $new $old
+
+ p $new # prints 0
+
+You may use +alias+ in any scope.
+
+== +undef+
+
+The +undef+ keyword prevents the current class from responding to calls to the
+named methods.
+
+ undef my_method
+
+You may use symbols instead of method names:
+
+ undef :my_method
+
+You may undef multiple methods:
+
+ undef method1, method2
+
+You may use +undef+ in any scope. See also Module#undef_method
+
+== +defined?+
+
++defined?+ is a keyword that returns a string describing its argument:
+
+ p defined?(UNDEFINED_CONSTANT) # prints nil
+ p defined?(RUBY_VERSION) # prints "constant"
+ p defined?(1 + 1) # prints "method"
+
+You don't need to use parenthesis with +defined?+ but they are recommended due
+to the {low precedence}[rdoc-ref:syntax/precedence.rdoc] of +defined?+.
+
+For example, if you wish to check if an instance variable exists and that the
+instance variable is zero:
+
+ defined? @instance_variable && @instance_variable.zero?
+
+This returns <code>"expression"</code> which is not what you want if the
+instance variable is not defined.
+
+ @instance_variable = 1
+ defined?(@instance_variable) && @instance_variable.zero?
+
+Adding parentheses when checking if the instance variable is defined is a
+better check. This correctly returns +nil+ when the instance variable is not
+defined and +false+ when the instance variable is not zero.
+
+Using the specific reflection methods such as instance_variable_defined? for
+instance variables or const_defined? for constants is less error prone than
+using +defined?+.
+
+== +BEGIN+ and +END+
+
++BEGIN+ defines a block that is run before any other code in the current file.
+It is typically used in one-liners with <code>ruby -e</code>. Similarly +END+
+defines a block that is run after any other code.
+
++BEGIN+ must appear at top-level and +END+ will issue a warning when you use it
+inside a method.
+
+Here is an example:
+
+ BEGIN {
+ count = 0
+ }
+
+You must use <code>{</code> and <code>}</code> you may not use +do+ and +end+.
+
+Here is an example one-liner that adds numbers from standard input or any files
+in the argument list:
+
+ ruby -ne 'BEGIN { count = 0 }; END { puts count }; count += gets.to_i'
+
diff --git a/doc/syntax/modules_and_classes.rdoc b/doc/syntax/modules_and_classes.rdoc
new file mode 100644
index 0000000000..f4ab1ea6f9
--- /dev/null
+++ b/doc/syntax/modules_and_classes.rdoc
@@ -0,0 +1,345 @@
+= Modules
+
+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".
+
+Mix-in functionality allows sharing common methods across multiple classes or
+modules. Ruby comes with the Enumerable mix-in module which provides many
+enumeration methods based on the +each+ method and Comparable allows comparison
+of objects based on the <code><=></code> comparison method.
+
+Note that there are many similarities between modules and classes. Besides the
+ability to mix-in a module, the description of modules below also applies to
+classes.
+
+== Module Definition
+
+A module is created using the +module+ keyword:
+
+ module MyModule
+ # ...
+ end
+
+A module may be reopened any number of times to add, change or remove
+functionality:
+
+ module MyModule
+ def my_method
+ end
+ end
+
+ module MyModule
+ alias my_alias my_method
+ end
+
+ module MyModule
+ remove_method :my_method
+ end
+
+Reopening classes is a very powerful feature of Ruby, but it is best to only
+reopen classes you own. Reopening classes you do not own may lead to naming
+conflicts or difficult to diagnose bugs.
+
+== Nesting
+
+Modules may be nested:
+
+ module Outer
+ module Inner
+ end
+ end
+
+Many packages create a single outermost module (or class) to provide a
+namespace for their functionality.
+
+You may also define inner modules using <code>::</code> provided the outer
+modules (or classes) are already defined:
+
+ module Outer::Inner::GrandChild
+ end
+
+Note that this will raise a +NameError+ if +Outer+ and
+<code>Outer::Inner</code> are not already defined.
+
+This style has the benefit of allowing the author to reduce the amount
+of indentation. Instead of 3 levels of indentation only one is necessary.
+However, the scope of constant lookup is different for creating a namespace
+using this syntax instead of the more verbose syntax.
+
+== Scope
+
+=== +self+
+
++self+ refers to the object that defines the current scope. +self+ will change
+when entering a different method or when defining a new module.
+
+=== Constants
+
+Accessible constants are different depending on the module nesting (which
+syntax was used to define the module). In the following example
+the constant <code>A::Z</code> is accessible from B as A is part of the
+nesting:
+
+ module A
+ Z = 1
+
+ module B
+ p Module.nesting #=> [A::B, A]
+ p Z #=> 1
+ end
+ end
+
+However, if you use <code>::</code> to define <code>A::B</code> without
+nesting it inside +A+ a NameError exception will be raised because the nesting
+does not include +A+:
+
+ module A
+ Z = 1
+ end
+
+ module A::B
+ p Module.nesting #=> [A::B]
+ p Z #=> raises NameError
+ end
+
+If a constant is defined at the top-level you may preceded it with
+<code>::</code> to reference it:
+
+ Z = 0
+
+ module A
+ Z = 1
+
+ module B
+ p ::Z #=> 0
+ end
+ end
+
+=== Methods
+
+For method definition documentation see the {syntax documentation for
+methods}[rdoc-ref:syntax/methods.rdoc].
+
+Class methods may be called directly. (This is slightly confusing, but a
+method on a module is often called a "class method" instead of a "module
+method". See also Module#module_function which can convert an instance method
+into a class method.)
+
+When a class method references a constant it uses the same rules as referencing
+it outside the method as the scope is the same.
+
+Instance methods defined in a module are only callable when included. These
+methods have access to the constants defined when they were included through
+the ancestors list:
+
+ module A
+ Z = 1
+
+ def z
+ Z
+ end
+ end
+
+ include A
+
+ p self.class.ancestors #=> [Object, A, Kernel, BasicObject]
+ p z #=> 1
+
+=== Visibility
+
+Ruby has three types of visibility. The default is +public+. A public method
+may be called from any other object.
+
+The second visibility is +protected+. When calling a protected method the
+sender must be a subclass of the receiver or the receiver must be a subclass of
+the sender. Otherwise a NoMethodError will be raised.
+
+Protected visibility is most frequently used to define <code>==</code> and
+other comparison methods where the author does not wish to expose an object's
+state to any caller and would like to restrict it only to inherited classes.
+
+Here is an example:
+
+ class A
+ def n(other)
+ other.m
+ end
+ end
+
+ class B < A
+ def m
+ 1
+ end
+
+ protected :m
+
+ end
+
+ class C < B
+ end
+
+ a = A.new
+ b = B.new
+ c = C.new
+
+ c.n b #=> 1 -- C is a subclass of B
+ b.n b #=> 1 -- m called on defining class
+ a.n b # raises NoMethodError A is not a subclass of B
+
+The third visibility is +private+. A private method may not be called with a
+receiver, not even +self+. If a private method is called with a receiver a
+NoMethodError will be raised.
+
+=== +alias+ and +undef+
+
+You may also alias or undefine methods, but these operations are not
+restricted to modules or classes. See the {miscellaneous syntax
+section}[rdoc-ref:syntax/miscellaneous.rdoc] for documentation.
+
+= Classes
+
+Every class is also a module, but unlike modules a class may not be mixed-in to
+another module (or class). Like a module, a class can be used as a namespace.
+A class also inherits methods and constants from its superclass.
+
+== Defining a class
+
+Use the +class+ keyword to create a class:
+
+ class MyClass
+ # ...
+ end
+
+If you do not supply a superclass your new class will inherit from Object. You
+may inherit from a different class using <code><</code> followed by a class
+name:
+
+ class MySubclass < MyClass
+ # ...
+ end
+
+There is a special class BasicObject which is designed as a blank class and
+includes a minimum of built-in methods. You can use BasicObject to create an
+independent inheritance structure. See the BasicObject documentation for
+further details.
+
+== Inheritance
+
+Any method defined on a class is callable from its subclass:
+
+ class A
+ Z = 1
+
+ def z
+ Z
+ end
+ end
+
+ class B < A
+ end
+
+ p B.new.z #=> 1
+
+The same is true for constants:
+
+ class A
+ Z = 1
+ end
+
+ class B < A
+ def z
+ Z
+ end
+ end
+
+ p B.new.z #=> 1
+
+You can override the functionality of a superclass method by redefining the
+method:
+
+ class A
+ def m
+ 1
+ end
+ end
+
+ class B < A
+ def m
+ 2
+ end
+ end
+
+ p B.new.m #=> 2
+
+If you wish to invoke the superclass functionality from a method use +super+:
+
+ class A
+ def m
+ 1
+ end
+ end
+
+ class B < A
+ def m
+ 2 + super
+ end
+ end
+
+ p B.new.m #=> 3
+
+When used without any arguments +super+ uses the arguments given to the
+subclass method. To send no arguments to the superclass method use
+<code>super()</code>. To send specific arguments to the superclass method
+provide them manually like <code>super(2)</code>.
+
++super+ may be called as many times as you like in the subclass method.
+
+= Singleton Classes
+
+The singleton class (also known as the metaclass or eigenclass) of an object is
+a class that holds methods for only that instance. You can access the
+singleton class of an object using <code>class << object</code> like this:
+
+ class C
+ end
+
+ class << C
+ # self is the singleton class here
+ end
+
+Most frequently you'll see the singleton class accessed like this:
+
+ class C
+ class << self
+ # ...
+ end
+ end
+
+This allows definition of methods and attributes on a class (or module) without
+needing to write <code>def self.my_method</code>.
+
+Since you can open the singleton class of any object this means that this code
+block:
+
+ o = Object.new
+
+ def o.my_method
+ 1 + 1
+ end
+
+is equivalent to this code block:
+
+ o = Object.new
+
+ class << o
+ def my_method
+ 1 + 1
+ end
+ end
+
+Both objects will have a +my_method+ that returns +2+.
+
diff --git a/doc/syntax/precedence.rdoc b/doc/syntax/precedence.rdoc
new file mode 100644
index 0000000000..515626c74f
--- /dev/null
+++ b/doc/syntax/precedence.rdoc
@@ -0,0 +1,60 @@
+= Precedence
+
+From highest to lowest, this is the precedence table for ruby. High precedence
+operations happen before low precedence operations.
+
+ !, ~, unary +
+
+ **
+
+ unary -
+
+ *, /, %
+
+ +, -
+
+ <<, >>
+
+ &
+
+ |, ^
+
+ >, >=, <, <=
+
+ <=>, ==, ===, !=, =~, !~
+
+ &&
+
+ ||
+
+ .., ...
+
+ ?, :
+
+ modifier-rescue
+
+ =, +=, -=, etc.
+
+ defined?
+
+ not
+
+ or, and
+
+ modifier-if, modifier-unless, modifier-while, modifier-until
+
+ { } blocks
+
+Unary <code>+</code> and unary <code>-</code> are for <code>+1</code>,
+<code>-1</code> or <code>-(a + b)</code>.
+
+Modifier-if, modifier-unless, etc. are for the modifier versions of those
+keywords. For example, this is a modifier-unless expression:
+
+ a += 1 unless a.zero?
+
+<code>{ ... }</code> blocks have priority below all listed operations, but
+<code>do ... end</code> blocks have lower priority.
+
+All other words in the precedence table above are keywords.
+
diff --git a/doc/syntax/refinements.rdoc b/doc/syntax/refinements.rdoc
new file mode 100644
index 0000000000..1a516ed8b2
--- /dev/null
+++ b/doc/syntax/refinements.rdoc
@@ -0,0 +1,266 @@
+= Refinements
+
+Due to Ruby's open classes you can redefine or add functionality to existing
+classes. This is called a "monkey patch". Unfortunately the scope of such
+changes is global. All users of the monkey-patched class see the same
+changes. This can cause unintended side-effects or breakage of programs.
+
+Refinements are designed to reduce the impact of monkey patching on other
+users of the monkey-patched class. Refinements provide a way to extend a
+class locally.
+
+Refinements are an experimental feature in Ruby 2.0. At the time of writing,
+refinements are expected to exist in future versions of Ruby but the
+specification of refinements may change. You will receive a warning the first
+time you define or activate a refinement.
+
+Here is a basic refinement:
+
+ class C
+ def foo
+ puts "C#foo"
+ end
+ end
+
+ module M
+ refine C do
+ def foo
+ puts "C#foo in M"
+ end
+ end
+ end
+
+First, a class +C+ is defined. Next a refinement for +C+ is created using
+Module#refine. Refinements only modify classes, not modules so the argument
+must be a class.
+
+Module#refine creates an anonymous module that contains the changes or
+refinements to the class (+C+ in the example). +self+ in the refine block is
+this anonymous module similar to Module#module_eval.
+
+Activate the refinement with #using:
+
+ using M
+
+ x = C.new
+
+ c.foo # prints "C#foo in M"
+
+== Scope
+
+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
+file or call a method that is defined outside the current scope the refinement
+will be deactivated:
+
+ class C
+ end
+
+ module M
+ refine C do
+ def foo
+ puts "C#foo in M"
+ end
+ end
+ end
+
+ def call_foo(x)
+ x.foo
+ end
+
+ using M
+
+ x = C.new
+ x.foo # prints "C#foo in M"
+ call_foo(x) #=> raises NoMethodError
+
+If a method is defined in a scope where a refinement is active the refinement
+will be active when the method is called. This example spans multiple files:
+
+c.rb:
+
+ class C
+ end
+
+m.rb:
+
+ require "c"
+
+ module M
+ refine C do
+ def foo
+ puts "C#foo in M"
+ end
+ end
+ end
+
+m_user.rb:
+
+ require "m"
+
+ using M
+
+ class MUser
+ def call_foo(x)
+ x.foo
+ end
+ end
+
+main.rb:
+
+ require "m_user"
+
+ x = C.new
+ m_user = MUser.new
+ m_user.call_foo(x) # prints "C#foo in M"
+ x.foo #=> raises NoMethodError
+
+Since the refinement +M+ is active in <code>m_user.rb</code> where
+<code>MUser#call_foo</code> is defined it is also active when
+<code>main.rb</code> calls +call_foo+.
+
+Since #using is a method, refinements are only active when it is called. Here
+are examples of where a refinement +M+ is and is not active.
+
+In a file:
+
+ # not activated here
+ using M
+ # activated here
+ class Foo
+ # activated here
+ def foo
+ # activated here
+ end
+ # activated here
+ end
+ # activated here
+
+In eval:
+
+ # not activated here
+ eval <<EOF
+ # not activated here
+ using M
+ # activated here
+ EOF
+ # not activated here
+
+When not evaluated:
+
+ # not activated here
+ if false
+ using M
+ end
+ # not activated here
+
+When defining multiple refinements in the same module, inside a refine block
+all refinements from the same module are active when a refined method is
+called:
+
+ module ToJSON
+ refine Integer do
+ def to_json
+ to_s
+ end
+ end
+
+ refine Array do
+ def to_json
+ "[" + map { |i| i.to_json }.join(",") + "]"
+ end
+ end
+
+ refine Hash do
+ def to_json
+ "{" + map { |k, v| k.to_s.dump + ":" + v.to_json }.join(",") + "}"
+ end
+ end
+ end
+
+ using ToJSON
+
+ 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:
+
+* If refinements are active for +C+, in the reverse order they were activated:
+ * The prepended modules from the refinement for +C+
+ * The refinement for +C+
+ * The included modules from the refinement for +C+
+* The prepended modules of +C+
+* +C+
+* The included modules of +C+
+
+If no method was found at any point this repeats with the superclass of +C+.
+
+Note that methods in a subclass have priority over refinements in a
+superclass. For example, if the method <code>/</code> is defined in a
+refinement for Integer <code>1 / 2</code> invokes the original Fixnum#/
+because Fixnum is a subclass of Integer and is searched before the refinements
+for the superclass Integer.
+
+If a method +foo+ is defined on Integer in a refinement, <code>1.foo</code>
+invokes that method since +foo+ does not exist on Fixnum.
+
+== +super+
+
+When +super+ is invoked method lookup checks:
+
+* The included modules of the current class. Note that the current class may
+ be a refinement.
+* If the current class is a refinement, the method lookup proceeds as in the
+ Method Lookup section above.
+* If the current class has a direct superclass, the method proceeds as in the
+ Method Lookup section above using the superclass.
+
+Note that +super+ in a method of a refinement invokes the method in the
+refined class even if there is another refinement which has been activated in
+the same context.
+
+== Indirect Method Calls
+
+When using indirect method access such as Kernel#send, Kernel#method or
+Kernel#respond_to? refinements are not honored for the caller context during
+method lookup.
+
+This behavior may be changed in the future.
+
+== Refinements and module inclusion
+
+Refinements are inherited by module inclusion. That is, using activates all
+refinements in the ancestors of the specified module. Refinements in a
+descendant have priority over refinements in an ancestor.
+
+== Further Reading
+
+See http://bugs.ruby-lang.org/projects/ruby-trunk/wiki/RefinementsSpec for the
+current specification for implementing refinements. The specification also
+contains more details.
+
diff --git a/enc/Makefile.in b/enc/Makefile.in
index 203a83dbfd..a64785d1c5 100644
--- a/enc/Makefile.in
+++ b/enc/Makefile.in
@@ -20,6 +20,7 @@ ENCSODIR = $(EXTOUT)/$(arch)/enc
TRANSSODIR = $(ENCSODIR)/trans
DLEXT = @DLEXT@
OBJEXT = @OBJEXT@
+LIBEXT = @LIBEXT@
BUILTIN_ENCS = ascii.c us_ascii.c\
unicode.c utf_8.c
@@ -32,7 +33,10 @@ LIBRUBYARG_SHARED = @LIBRUBYARG_SHARED@
LIBRUBYARG_STATIC = $(LIBRUBYARG_SHARED)
empty =
+AR = @AR@
CC = @CC@
+ARFLAGS = @ARFLAGS@$(empty)
+RANLIB = @RANLIB@
OUTFLAG = @OUTFLAG@$(empty)
COUTFLAG = @COUTFLAG@$(empty)
CFLAGS = $(CCDLFLAGS) @CFLAGS@ @ARCH_FLAG@
@@ -48,9 +52,13 @@ LDFLAGS = @LDFLAGS@
LDSHARED = @LDSHARED@
ldflags = $(LDFLAGS)
dldflags = @DLDFLAGS@
+extdldflags = @EXTDLDFLAGS@
archflag = @ARCH_FLAG@
-DLDFLAGS = $(ldflags) $(dldflags) $(archflag)
+DLDFLAGS = $(ldflags) $(dldflags) $(extdldflags) $(archflag)
RUBY = $(MINIRUBY)
+TARGET_NAME_ = $(@F) # BSD make seems unable to deal with @F with substitution
+TARGET_NAME = $(TARGET_NAME_:.@DLEXT@=)
+TARGET_ENTRY = @EXPORT_PREFIX@Init_$(TARGET_NAME)
WORKDIRS = @WORKDIRS@
diff --git a/enc/ascii.c b/enc/ascii.c
index 3d62ec9bf7..72150c037c 100644
--- a/enc/ascii.c
+++ b/enc/ascii.c
@@ -1,8 +1,9 @@
/**********************************************************************
- ascii.c - Oniguruma (regular expression library)
+ ascii.c - Onigmo (Oniguruma-mod) (regular expression library)
**********************************************************************/
/*-
* Copyright (c) 2002-2006 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
+ * Copyright (c) 2011 K.Takata <kentkt AT csc DOT jp>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -45,7 +46,9 @@ OnigEncodingDefine(ascii, ASCII) = {
onigenc_ascii_is_code_ctype,
onigenc_not_support_get_ctype_code_range,
onigenc_single_byte_left_adjust_char_head,
- onigenc_always_true_is_allowed_reverse_match
+ onigenc_always_true_is_allowed_reverse_match,
+ 0,
+ ONIGENC_FLAG_NONE,
};
ENC_ALIAS("BINARY", "ASCII-8BIT")
ENC_REPLICATE("IBM437", "ASCII-8BIT")
diff --git a/enc/big5.c b/enc/big5.c
index c39329170e..9d7738d8f9 100644
--- a/enc/big5.c
+++ b/enc/big5.c
@@ -299,7 +299,9 @@ OnigEncodingDefine(big5, BIG5) = {
big5_is_code_ctype,
onigenc_not_support_get_ctype_code_range,
big5_left_adjust_char_head,
- big5_is_allowed_reverse_match
+ big5_is_allowed_reverse_match,
+ 0,
+ ONIGENC_FLAG_NONE,
};
/*
@@ -331,7 +333,9 @@ OnigEncodingDefine(big5_hkscs, BIG5_HKSCS) = {
big5_is_code_ctype,
onigenc_not_support_get_ctype_code_range,
big5_left_adjust_char_head,
- big5_is_allowed_reverse_match
+ big5_is_allowed_reverse_match,
+ 0,
+ ONIGENC_FLAG_NONE,
};
ENC_ALIAS("Big5-HKSCS:2008", "Big5-HKSCS")
@@ -363,5 +367,7 @@ OnigEncodingDefine(big5_uao, BIG5_UAO) = {
big5_is_code_ctype,
onigenc_not_support_get_ctype_code_range,
big5_left_adjust_char_head,
- big5_is_allowed_reverse_match
+ big5_is_allowed_reverse_match,
+ 0,
+ ONIGENC_FLAG_NONE,
};
diff --git a/enc/cp949.c b/enc/cp949.c
index 3eb46c976a..bf1c2637a3 100644
--- a/enc/cp949.c
+++ b/enc/cp949.c
@@ -210,7 +210,9 @@ OnigEncodingDefine(cp949, CP949) = {
cp949_is_code_ctype,
onigenc_not_support_get_ctype_code_range,
cp949_left_adjust_char_head,
- cp949_is_allowed_reverse_match
+ cp949_is_allowed_reverse_match,
+ 0,
+ ONIGENC_FLAG_NONE,
};
/*
* Name: CP949
diff --git a/enc/depend b/enc/depend
index 8e930d5053..5750a0dc49 100644
--- a/enc/depend
+++ b/enc/depend
@@ -1,44 +1,18 @@
-% inplace = File.identical?($srcdir, ".")
+% inplace = File.identical?($top_srcdir, ".")
% workdirs = %w"$(ENCSODIR) $(TRANSSODIR) enc enc/trans"
% CONFIG["WORKDIRS"] = workdirs.join(' ')
-% CONFIG["DLDFLAGS"].sub!(/(\A|\s)(-\S+(?:\s*\w*)?\$\(TARGET\)\S*)/, '\1')
-% dldflags = $2
% enable_shared = CONFIG['ENABLE_SHARED'] == 'yes'
% deffile = (true if /\$\(DEFFILE\)/ =~ CONFIG["LINK_SO"])
-% encs = Dir.open($srcdir) {|d| d.grep(/.+\.c\z/)} - BUILTIN_ENCS
-% encs.each {|e| e.chomp!(".c")}
-% encs.reject! {|e| !ENC_PATTERNS.any? {|p| File.fnmatch?(p, e)}} if !ENC_PATTERNS.empty?
-% encs.reject! {|e| NOENC_PATTERNS.any? {|p| File.fnmatch?(p, e)}}
-% alphanumeric_order = proc {|e| e.scan(/(\d+)|(\D+)/).map {|n,a| a||[n.size,n.to_i]}.flatten}
-% encs = encs.sort_by(&alphanumeric_order)
-% encs.unshift(encs.delete("encdb"))
-% atrans = []
-% trans = Dir.open($srcdir+"/trans") {|d|
-% d.select {|e|
-% if e.chomp!('.trans')
-% atrans << e
-% true
-% elsif e.chomp!('.c')
-% true
-% end
-% }
-% }
-% trans -= BUILTIN_TRANSES
-% atrans -= BUILTIN_TRANSES
-% trans.uniq!
-% atrans = atrans.sort_by(&alphanumeric_order)
-% trans = trans.sort_by(&alphanumeric_order)
-% trans.unshift(trans.delete("transdb"))
-% trans.compact!
-% trans |= atrans
-% trans.map! {|e| "trans/#{e}"}
-% dependencies = encs + trans
+% dependencies = ENCS + TRANS
% cleanlibs = Shellwords.shellwords(CONFIG["cleanlibs"] || "")
% cleanobjs = Shellwords.shellwords(CONFIG["cleanobjs"] || "")
% cleanobjs << "$*.def" if deffile
% rule_subst = CONFIG["RULE_SUBST"] || "%s"
% transvpath = rule_subst.dup.sub!(/\{[^{}]+\}/, '$(TRANSVPATH)/') || "enc/trans/%s"
-% transvpath_prefix = (rule_subst.dup.sub!(/\{[^{}]+\}/, '{$(TRANSVPATH)}') || "") % ""
+% 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
@@ -54,31 +28,51 @@ else
''
end %> <%=CONFIG['LIBS']%> $(EXTLIBS)
-ENCOBJS = <%=encs.map {|e|"enc/#{e}.$(OBJEXT)"}.join(" \\\n\t ")%><%="\n" if encs.size>1%>
-ENCSOS = <%=encs.map {|e|"$(ENCSODIR)/#{e}.$(DLEXT)"}.join(" \\\n\t ")%><%="\n" if encs.size>1%>
+ENCOBJS = <%=ENCS.map {|e|"enc/#{e}.$(OBJEXT)"}.join(" \\\n\t ")%><%="\n" if ENCS.size>1%>
+ENCSOS = <%=ENCS.map {|e|"$(ENCSODIR)/#{e}.$(DLEXT)"}.join(" \\\n\t ")%><%="\n" if ENCS.size>1%>
ENCCLEANLIBS = <%=cleanlibs.map {|clean|
clean.gsub(/\$\*(\.\w+)?/) {"$(ENCOBJS#{$1 ? ":.#{CONFIG["OBJEXT"]}=#{$1}" : ""})"}
}.join(" ")%>
ENCCLEANOBJS = <%=cleanobjs.map {|clean|
clean.gsub(/\$\*(\.\w+)?/) {"$(ENCOBJS#{$1 ? ":.#{CONFIG["OBJEXT"]}=#{$1}" : ""})"}
}.join(" ")%>
+LIBENC=enc/libenc.$(LIBEXT)
TRANSVPATH = $(srcdir)/enc/trans
-TRANSCSRCS = <%=atrans.map {|e| transvpath % "#{e}.c"}.join(" \\\n\t ")%><%="\n" if trans.size>1%>
-TRANSOBJS = <%=trans.map {|e|"enc/#{e}.$(OBJEXT)"}.join(" \\\n\t ")%><%="\n" if trans.size>1%>
-TRANSSOS = <%=trans.map {|e|"$(ENCSODIR)/#{e}.$(DLEXT)"}.join(" \\\n\t ")%><%="\n" if trans.size>1%>
+TRANSCSRCS = <%=ATRANS.map {|e| transvpath % "#{e}.c"}.join(" \\\n\t ")%><%="\n" if TRANS.size>1%>
+TRANSOBJS = <%=TRANS.map {|e|"enc/#{e}.$(OBJEXT)"}.join(" \\\n\t ")%><%="\n" if TRANS.size>1%>
+TRANSSOS = <%=TRANS.map {|e|"$(ENCSODIR)/#{e}.$(DLEXT)"}.join(" \\\n\t ")%><%="\n" if TRANS.size>1%>
TRANSCLEANLIBS = <%=cleanlibs.map {|clean|
clean.gsub(/\$\*(\.\w+)?/) {"$(TRANSOBJS#{$1 ? ":.#{CONFIG["OBJEXT"]}=#{$1}" : ""})"}
}.join(" ")%>
TRANSCLEANOBJS = <%=cleanobjs.map {|clean|
clean.gsub(/\$\*(\.\w+)?/) {"$(TRANSOBJS#{$1 ? ":.#{CONFIG["OBJEXT"]}=#{$1}" : ""})"}
}.join(" ")%>
+LIBTRANS=enc/libtrans.$(LIBEXT)
encs: all
+% if MODULE_TYPE == :static
+all: libenc libtrans
+% else
all: enc trans
+%end
+libencs: libenc libtrans
enc: $(ENCSOS)
+libenc: $(LIBENC)
trans: $(TRANSSOS)
+libtrans: $(LIBTRANS)
+
+$(LIBENC): $(ENCOBJS)
+ @$(RM) $@
+ $(ECHO) linking statically-linked encoding library $@
+ $(Q) $(AR) $(ARFLAGS)$@ $(ENCOBJS)
+ @-$(RANLIB) $@ 2> /dev/null || true
+$(LIBTRANS): $(TRANSOBJS)
+ @$(RM) $@
+ $(ECHO) linking statically-linked transcoder library $@
+ $(Q) $(AR) $(ARFLAGS)$@ $(TRANSOBJS)
+ @-$(RANLIB) $@ 2> /dev/null || true
srcs: $(TRANSCSRCS)
@@ -86,24 +80,27 @@ srcs: $(TRANSCSRCS)
$(ECHO) generating table from $@
$(Q)$(MINIRUBY) "$(srcdir)/tool/transcode-tblgen.rb" -vo "$@" "$<"
-% unless encs.empty? or trans.empty?
+% unless ENCS.empty? or TRANS.empty?
-% unless encs.empty?
-$(ENCOBJS): regenc.h oniguruma.h config.h defines.h
+% unless ENCS.empty?
+$(ENCOBJS): $(hdrdir)/ruby.h regenc.h oniguruma.h config.h defines.h ruby.h missing.h subst.h intern.h st.h encoding.h
+% end
+% ENC_DEPS.each do |e, deps|
+enc/<%=e%>.$(OBJEXT): <%=deps.map {|n| rule_subst % n}.join(' ')%>
% end
-% unless trans.empty?
-$(TRANSOBJS): ruby.h intern.h config.h defines.h missing.h encoding.h oniguruma.h st.h transcode_data.h
+% unless TRANS.empty?
+$(TRANSOBJS): $(hdrdir)/ruby.h ruby.h intern.h config.h defines.h missing.h encoding.h oniguruma.h st.h transcode_data.h subst.h encoding.h
% end
-% atrans.each do |e|
+% ATRANS.each do |e|
% src = "#{e}.trans"
<%=transvpath % "#{e}.c"%>: <%= transvpath % "#{e}.trans"%>
% src = [*IO.read(File.join($srcdir, "trans", src)).scan(/^\s*require\s+[\'\"]([^\'\"]*)/).flatten.map{|c|c+".rb"}]
-<%=transvpath % "#{e}.c"%>: <%= src.map {|e| transvpath % "#{e}"}.join(" ")%> $(srcdir)/tool/transcode-tblgen.rb
+<%=transvpath % "#{e}.c"%>: <%= src.map {|s| transvpath % "#{s}"}.join(" ")%> $(srcdir)/tool/transcode-tblgen.rb
% end
% end
-% link_so = LINK_SO.gsub(/\n/, "\n\t")
+% link_so = LINK_SO.gsub(/([^\\])\n/, "\\1\n$(Q) ").gsub(/\n/, "\n\t")
% link_so.gsub!(/(-(?:implib|pdb):\S+)-\$\(arch\)\./, '\1.')
% dependencies.each do |e|
% obj = "enc/#{e}.$(OBJEXT)"
@@ -119,7 +116,6 @@ $(TRANSOBJS): ruby.h intern.h config.h defines.h missing.h encoding.h oniguruma.
$(ECHO) linking <%=mesg%> $(@F)
% cmd = link_so.sub(/\$\(OBJS\)/) {obj}
% base = File.basename(e)
-% cmd.sub!(/(?=\$\(DLDFLAGS\))/) {dldflags.sub(/\$\(TARGET\)/) {base} + " "} if dldflags
% if df
$(Q)echo> <%=df%> EXPORTS
$(Q)echo>> <%=df%> <%=EXPORT_PREFIX%>Init_<%=base%>
@@ -142,7 +138,7 @@ enc/encdb.$(OBJEXT): encdb.h
enc/trans/transdb.$(OBJEXT): transdb.h
clean:
-% %w[$(ENCSOS) $(ENCOBJS) $(ENCCLEANOBJS) $(ENCCLEANLIBS) $(TRANSSOS) $(TRANSOBJS) $(TRANSCLEANOBJS) $(TRANSCLEANLIBS)].each do |clean|
+% %w[$(ENCSOS) $(LIBENC) $(ENCOBJS) $(ENCCLEANOBJS) $(ENCCLEANLIBS) $(TRANSSOS) $(LIBTRANS) $(TRANSOBJS) $(TRANSCLEANOBJS) $(TRANSCLEANLIBS)].each do |clean|
$(Q)$(RM) <%=pathrep[clean]%>
% end
% @ignore_error = $nmake ? '' : ' 2> /dev/null || true'
@@ -150,8 +146,8 @@ clean:
$(Q)$(RM) enc/unicode/name2ctype.h
-$(Q)$(RMDIR) enc/unicode<%=@ignore_error%>
% end
-% workdirs.reverse_each do|dir|
- -$(Q)$(RMDIR) <%=pathrep[dir]%><%=@ignore_error%>
+% workdirs.reverse_each do|d|
+ -$(Q)$(RMDIR) <%=pathrep[d]%><%=@ignore_error%>
% end
clean-srcs:
@@ -160,3 +156,5 @@ clean-srcs:
$(Q)$(RM) enc/unicode/name2ctype.h
-$(Q)$(RMDIR) <%=pathrep['enc/unicode']%><%=@ignore_error%>
-$(Q)$(RMDIR) <%=pathrep['enc']%><%=@ignore_error%>
+
+<%# vim: set ft=eruby noexpandtab ts=8 sw=2 : -%>
diff --git a/enc/emacs_mule.c b/enc/emacs_mule.c
index e75e40b168..275c8f47dc 100644
--- a/enc/emacs_mule.c
+++ b/enc/emacs_mule.c
@@ -334,7 +334,8 @@ OnigEncodingDefine(emacs_mule, Emacs_Mule) = {
onigenc_not_support_get_ctype_code_range,
left_adjust_char_head,
onigenc_always_true_is_allowed_reverse_match,
- 0
+ 0,
+ ONIGENC_FLAG_NONE,
};
ENC_REPLICATE("stateless-ISO-2022-JP", "Emacs-Mule")
diff --git a/enc/encdb.c b/enc/encdb.c
index 958b33504e..fa04a5f7f6 100644
--- a/enc/encdb.c
+++ b/enc/encdb.c
@@ -14,11 +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_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/encinit.c.erb b/enc/encinit.c.erb
new file mode 100644
index 0000000000..fd3ade0c4b
--- /dev/null
+++ b/enc/encinit.c.erb
@@ -0,0 +1,26 @@
+/* Copyright 2012 Google Inc. Some Rights Reserved.
+ * Author: yugui@google.com (Yugui Sonoda)
+ */
+#include <stdio.h>
+
+#define init(func, name) { \
+ extern void func(void); \
+ ruby_init_ext(name, func); \
+}
+
+void ruby_init_ext(const char *name, void (*init)(void));
+
+void
+Init_enc(void)
+{
+% ENCS.each do |enc|
+ init(Init_<%= enc %>, "enc/<%= enc %>.so");
+% end
+
+ init(Init_transdb, "enc/trans/transdb.so");
+% TRANS.each do |trans|
+% next if trans == 'trans/transdb'
+ init(Init_trans_<%= File.basename trans %>, "enc/<%= trans %>.so");
+% end
+}
+<%# vim: set ft=eruby sw=2 : -%>
diff --git a/enc/euc_jp.c b/enc/euc_jp.c
index 7667c5800e..d7af1abaee 100644
--- a/enc/euc_jp.c
+++ b/enc/euc_jp.c
@@ -1,8 +1,9 @@
/**********************************************************************
- euc_jp.c - Oniguruma (regular expression library)
+ euc_jp.c - Onigmo (Oniguruma-mod) (regular expression library)
**********************************************************************/
/*-
- * Copyright (c) 2002-2007 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
+ * Copyright (c) 2002-2008 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
+ * Copyright (c) 2011 K.Takata <kentkt AT csc DOT jp>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -29,7 +30,6 @@
#include "regint.h"
-
#define eucjp_islead(c) ((UChar )((c) - 0xa1) > 0xfe - 0xa1)
static const int EncLen_EUCJP[] = {
@@ -114,6 +114,97 @@ static const signed char trans[][0x100] = {
#undef A
#undef F
+static const OnigPairCaseFoldCodes CaseFoldMap[] = {
+ /* Fullwidth Alphabet */
+ { 0xa3c1, 0xa3e1 },
+ { 0xa3c2, 0xa3e2 },
+ { 0xa3c3, 0xa3e3 },
+ { 0xa3c4, 0xa3e4 },
+ { 0xa3c5, 0xa3e5 },
+ { 0xa3c6, 0xa3e6 },
+ { 0xa3c7, 0xa3e7 },
+ { 0xa3c8, 0xa3e8 },
+ { 0xa3c9, 0xa3e9 },
+ { 0xa3ca, 0xa3ea },
+ { 0xa3cb, 0xa3eb },
+ { 0xa3cc, 0xa3ec },
+ { 0xa3cd, 0xa3ed },
+ { 0xa3ce, 0xa3ee },
+ { 0xa3cf, 0xa3ef },
+ { 0xa3d0, 0xa3f0 },
+ { 0xa3d1, 0xa3f1 },
+ { 0xa3d2, 0xa3f2 },
+ { 0xa3d3, 0xa3f3 },
+ { 0xa3d4, 0xa3f4 },
+ { 0xa3d5, 0xa3f5 },
+ { 0xa3d6, 0xa3f6 },
+ { 0xa3d7, 0xa3f7 },
+ { 0xa3d8, 0xa3f8 },
+ { 0xa3d9, 0xa3f9 },
+ { 0xa3da, 0xa3fa },
+
+ /* Greek */
+ { 0xa6a1, 0xa6c1 },
+ { 0xa6a2, 0xa6c2 },
+ { 0xa6a3, 0xa6c3 },
+ { 0xa6a4, 0xa6c4 },
+ { 0xa6a5, 0xa6c5 },
+ { 0xa6a6, 0xa6c6 },
+ { 0xa6a7, 0xa6c7 },
+ { 0xa6a8, 0xa6c8 },
+ { 0xa6a9, 0xa6c9 },
+ { 0xa6aa, 0xa6ca },
+ { 0xa6ab, 0xa6cb },
+ { 0xa6ac, 0xa6cc },
+ { 0xa6ad, 0xa6cd },
+ { 0xa6ae, 0xa6ce },
+ { 0xa6af, 0xa6cf },
+ { 0xa6b0, 0xa6d0 },
+ { 0xa6b1, 0xa6d1 },
+ { 0xa6b2, 0xa6d2 },
+ { 0xa6b3, 0xa6d3 },
+ { 0xa6b4, 0xa6d4 },
+ { 0xa6b5, 0xa6d5 },
+ { 0xa6b6, 0xa6d6 },
+ { 0xa6b7, 0xa6d7 },
+ { 0xa6b8, 0xa6d8 },
+
+ /* Cyrillic */
+ { 0xa7a1, 0xa7d1 },
+ { 0xa7a2, 0xa7d2 },
+ { 0xa7a3, 0xa7d3 },
+ { 0xa7a4, 0xa7d4 },
+ { 0xa7a5, 0xa7d5 },
+ { 0xa7a6, 0xa7d6 },
+ { 0xa7a7, 0xa7d7 },
+ { 0xa7a8, 0xa7d8 },
+ { 0xa7a9, 0xa7d9 },
+ { 0xa7aa, 0xa7da },
+ { 0xa7ab, 0xa7db },
+ { 0xa7ac, 0xa7dc },
+ { 0xa7ad, 0xa7dd },
+ { 0xa7ae, 0xa7de },
+ { 0xa7af, 0xa7df },
+ { 0xa7b0, 0xa7e0 },
+ { 0xa7b1, 0xa7e1 },
+ { 0xa7b2, 0xa7e2 },
+ { 0xa7b3, 0xa7e3 },
+ { 0xa7b4, 0xa7e4 },
+ { 0xa7b5, 0xa7e5 },
+ { 0xa7b6, 0xa7e6 },
+ { 0xa7b7, 0xa7e7 },
+ { 0xa7b8, 0xa7e8 },
+ { 0xa7b9, 0xa7e9 },
+ { 0xa7ba, 0xa7ea },
+ { 0xa7bb, 0xa7eb },
+ { 0xa7bc, 0xa7ec },
+ { 0xa7bd, 0xa7ed },
+ { 0xa7be, 0xa7ee },
+ { 0xa7bf, 0xa7ef },
+ { 0xa7c0, 0xa7f0 },
+ { 0xa7c1, 0xa7f1 },
+};
+
static int
mbc_enc_len(const UChar* p, const UChar* e, OnigEncoding enc ARG_UNUSED)
{
@@ -138,7 +229,7 @@ mbc_to_code(const UChar* p, const UChar* end, OnigEncoding enc)
int c, i, len;
OnigCodePoint n;
- len = enclen(enc, p, end);
+ len = mbc_enc_len(p, end, enc);
n = (OnigCodePoint )*p++;
if (len == 1) return n;
@@ -154,10 +245,10 @@ static int
code_to_mbclen(OnigCodePoint code, OnigEncoding enc ARG_UNUSED)
{
if (ONIGENC_IS_CODE_ASCII(code)) return 1;
- else if (code > 0xffffff)
- return ONIGERR_TOO_BIG_WIDE_CHAR_VALUE;
- else if (code & 0x800000) return 3;
- else if (code & 0x8000) return 2;
+ else if (code > 0x00ffffff)
+ return ONIGERR_TOO_BIG_WIDE_CHAR_VALUE;
+ else if ((code & 0xff808080) == 0x00808080) return 3;
+ else if ((code & 0xffff8080) == 0x00008080) return 2;
else
return ONIGERR_INVALID_CODE_POINT_VALUE;
}
@@ -191,10 +282,87 @@ code_to_mbc(OnigCodePoint code, UChar *buf, OnigEncoding enc)
*p++ = (UChar )(code & 0xff);
#if 1
- if (enclen(enc, buf, p) != (p - buf))
+ if (mbc_enc_len(buf, p, enc) != (p - buf))
return ONIGERR_INVALID_CODE_POINT_VALUE;
#endif
- return (int)(p - buf);
+ return (int )(p - buf);
+}
+
+static int
+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,
+ flag, f, arg);
+}
+
+static OnigCodePoint
+get_lower_case(OnigCodePoint code)
+{
+ if (ONIGENC_IS_IN_RANGE(code, 0xa3c1, 0xa3da)) {
+ /* Fullwidth Alphabet */
+ return (OnigCodePoint )(code + 0x0020);
+ }
+ else if (ONIGENC_IS_IN_RANGE(code, 0xa6a1, 0xa6b8)) {
+ /* Greek */
+ return (OnigCodePoint )(code + 0x0020);
+ }
+ else if (ONIGENC_IS_IN_RANGE(code, 0xa7a1, 0xa7c1)) {
+ /* Cyrillic */
+ return (OnigCodePoint )(code + 0x0030);
+ }
+ return code;
+}
+
+static OnigCodePoint
+get_upper_case(OnigCodePoint code)
+{
+ if (ONIGENC_IS_IN_RANGE(code, 0xa3e1, 0xa3fa)) {
+ /* Fullwidth Alphabet */
+ return (OnigCodePoint )(code - 0x0020);
+ }
+ else if (ONIGENC_IS_IN_RANGE(code, 0xa6c1, 0xa6d8)) {
+ /* Greek */
+ return (OnigCodePoint )(code - 0x0020);
+ }
+ else if (ONIGENC_IS_IN_RANGE(code, 0xa7d1, 0xa7f1)) {
+ /* Cyrillic */
+ return (OnigCodePoint )(code - 0x0030);
+ }
+ return code;
+}
+
+static int
+get_case_fold_codes_by_str(OnigCaseFoldType flag,
+ const OnigUChar* p, const OnigUChar* end,
+ OnigCaseFoldCodeItem items[], OnigEncoding enc)
+{
+ int len;
+ OnigCodePoint code, code_lo, code_up;
+
+ code = mbc_to_code(p, end, enc);
+ if (ONIGENC_IS_ASCII_CODE(code))
+ return onigenc_ascii_get_case_fold_codes_by_str(flag, p, end, items, enc);
+
+ len = mbc_enc_len(p, end, enc);
+ code_lo = get_lower_case(code);
+ code_up = get_upper_case(code);
+
+ if (code != code_lo) {
+ items[0].byte_len = len;
+ items[0].code_len = 1;
+ items[0].code[0] = code_lo;
+ return 1;
+ }
+ else if (code != code_up) {
+ items[0].byte_len = len;
+ items[0].code_len = 1;
+ items[0].code[0] = code_up;
+ return 1;
+ }
+
+ return 0;
}
static int
@@ -202,7 +370,6 @@ mbc_case_fold(OnigCaseFoldType flag,
const UChar** pp, const UChar* end, UChar* lower,
OnigEncoding enc)
{
- int len;
const UChar* p = *pp;
if (ONIGENC_IS_MBC_ASCII(p)) {
@@ -211,12 +378,11 @@ mbc_case_fold(OnigCaseFoldType flag,
return 1;
}
else {
- int i;
+ OnigCodePoint code;
+ int len;
- len = enclen(enc, p, end);
- for (i = 0; i < len; i++) {
- *lower++ = *p++;
- }
+ code = get_lower_case(mbc_to_code(p, end, enc));
+ len = code_to_mbc(code, lower, enc);
(*pp) += len;
return len; /* return byte length of converted char to lower */
}
@@ -235,7 +401,7 @@ left_adjust_char_head(const UChar* start, const UChar* s, const UChar* end, Onig
p = s;
while (!eucjp_islead(*p) && p > start) p--;
- len = enclen(enc, p, end);
+ len = mbc_enc_len(p, end, enc);
if (p + len > s) return (UChar* )p;
p += len;
return (UChar* )(p + ((s - p) & ~1));
@@ -260,15 +426,83 @@ static hash_table_type* PropertyNameTable;
static const OnigCodePoint CR_Hiragana[] = {
1,
+#ifdef ENC_EUC_JIS_2004
+ 0xa4a1, 0xa4fb
+#else
0xa4a1, 0xa4f3
+#endif
}; /* CR_Hiragana */
+#ifdef ENC_EUC_JIS_2004
+static const OnigCodePoint CR_Katakana[] = {
+ 5,
+ 0x8ea6, 0x8eaf, /* JIS X 0201 Katakana */
+ 0x8eb1, 0x8edd, /* JIS X 0201 Katakana */
+ 0xa5a1, 0xa5fe,
+ 0xa6ee, 0xa6fe,
+ 0xa7f2, 0xa7f5,
+}; /* CR_Katakana */
+#else
static const OnigCodePoint CR_Katakana[] = {
3,
+ 0x8ea6, 0x8eaf, /* JIS X 0201 Katakana */
+ 0x8eb1, 0x8edd, /* JIS X 0201 Katakana */
0xa5a1, 0xa5f6,
- 0xaaa6, 0xaaaf,
- 0xaab1, 0xaadd
}; /* CR_Katakana */
+#endif
+
+#ifdef ENC_EUC_JIS_2004
+static const OnigCodePoint CR_Han[] = {
+ /* EUC-JIS-2004 (JIS X 0213:2004) */
+ 7,
+ /* plane 1 */
+ 0xa1b8, 0xa1b8,
+ 0xaea1, 0xfefe, /* Kanji level 1, 2 and 3 */
+ /* plane 2 */
+ 0x8fa1a1, 0x8fa1fe, /* row 1 */
+ 0x8fa3a1, 0x8fa5fe, /* row 3 .. 5 */
+ 0x8fa8a1, 0x8fa8fe, /* row 8 */
+ 0x8faca1, 0x8faffe, /* row 12 .. 15 */
+ 0x8feea1, 0x8ffef6, /* row 78 .. 94 */
+}; /* CR_Han */
+#else
+static const OnigCodePoint CR_Han[] = {
+ /* EUC-JP (JIS X 0208 based) */
+ 4,
+ 0xa1b8, 0xa1b8,
+ 0xb0a1, 0xcfd3, /* Kanji level 1 */
+ 0xd0a1, 0xf4a6, /* Kanji level 2 */
+ 0x8fb0a1, 0x8fedf3 /* JIS X 0212 Supplemental Kanji (row 16 .. 77) */
+}; /* CR_Han */
+#endif
+
+static const OnigCodePoint CR_Latin[] = {
+ 4,
+ 0x0041, 0x005a,
+ 0x0061, 0x007a,
+ 0xa3c1, 0xa3da,
+ 0xa3e1, 0xa3fa,
+ /* TODO: add raw 8 .. 11 to support EUC-JIS-2004 */
+ /* TODO: add JIS X 0212 row 9 .. 11 */
+}; /* CR_Latin */
+
+static const OnigCodePoint CR_Greek[] = {
+ 2,
+ 0xa6a1, 0xa6b8,
+#ifdef ENC_EUC_JIS_2004
+ 0xa6c1, 0xa6d9,
+#else
+ 0xa6c1, 0xa6d8,
+ /* TODO: add JIS X 0212 row 6 */
+#endif
+}; /* CR_Greek */
+
+static const OnigCodePoint CR_Cyrillic[] = {
+ 2,
+ 0xa7a1, 0xa7c1,
+ 0xa7d1, 0xa7f1,
+ /* TODO: add JIS X 0212 row 7 */
+}; /* CR_Cyrillic */
static int
init_property_list(void)
@@ -277,6 +511,10 @@ init_property_list(void)
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:
@@ -300,7 +538,7 @@ property_name_to_ctype(OnigEncoding enc, UChar* p, UChar* end)
return onigenc_minimum_property_name_to_ctype(enc, s, e);
}
- return (int)ctype;
+ return (int )ctype;
}
static int
@@ -360,14 +598,15 @@ OnigEncodingDefine(euc_jp, EUC_JP) = {
code_to_mbclen,
code_to_mbc,
mbc_case_fold,
- onigenc_ascii_apply_all_case_fold,
- onigenc_ascii_get_case_fold_codes_by_str,
+ apply_all_case_fold,
+ get_case_fold_codes_by_str,
property_name_to_ctype,
is_code_ctype,
get_ctype_code_range,
left_adjust_char_head,
is_allowed_reverse_match,
- 0
+ 0,
+ ONIGENC_FLAG_NONE,
};
/*
* Name: EUC-JP
@@ -396,3 +635,10 @@ ENC_ALIAS("euc-jp-ms", "eucJP-ms")
* Link: http://msyk.at.webry.info/200511/article_2.html
*/
ENC_REPLICATE("CP51932", "EUC-JP")
+
+/*
+ * Name: EUC-JIS-2004
+ * Link: http://ja.wikipedia.org/wiki/EUC-JIS-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/euc_kr.c b/enc/euc_kr.c
index af5f7828f0..55acf00168 100644
--- a/enc/euc_kr.c
+++ b/enc/euc_kr.c
@@ -187,6 +187,8 @@ OnigEncodingDefine(euc_kr, EUC_KR) = {
euckr_is_code_ctype,
onigenc_not_support_get_ctype_code_range,
euckr_left_adjust_char_head,
- euckr_is_allowed_reverse_match
+ euckr_is_allowed_reverse_match,
+ 0,
+ ONIGENC_FLAG_NONE,
};
ENC_ALIAS("eucKR", "EUC-KR")
diff --git a/enc/euc_tw.c b/enc/euc_tw.c
index 5fed8a893d..6d193b745e 100644
--- a/enc/euc_tw.c
+++ b/enc/euc_tw.c
@@ -220,6 +220,8 @@ OnigEncodingDefine(euc_tw, EUC_TW) = {
euctw_is_code_ctype,
onigenc_not_support_get_ctype_code_range,
euctw_left_adjust_char_head,
- euctw_is_allowed_reverse_match
+ euctw_is_allowed_reverse_match,
+ 0,
+ ONIGENC_FLAG_NONE,
};
ENC_ALIAS("eucTW", "EUC-TW")
diff --git a/enc/gb18030.c b/enc/gb18030.c
index 36e60af6b5..d4184333f5 100644
--- a/enc/gb18030.c
+++ b/enc/gb18030.c
@@ -596,6 +596,8 @@ OnigEncodingDefine(gb18030, GB18030) = {
gb18030_is_code_ctype,
onigenc_not_support_get_ctype_code_range,
gb18030_left_adjust_char_head,
- gb18030_is_allowed_reverse_match
+ gb18030_is_allowed_reverse_match,
+ 0,
+ ONIGENC_FLAG_NONE,
};
diff --git a/enc/gbk.c b/enc/gbk.c
index ace7f378af..7be60a0de9 100644
--- a/enc/gbk.c
+++ b/enc/gbk.c
@@ -210,7 +210,9 @@ OnigEncodingDefine(gbk, GBK) = {
gbk_is_code_ctype,
onigenc_not_support_get_ctype_code_range,
gbk_left_adjust_char_head,
- gbk_is_allowed_reverse_match
+ gbk_is_allowed_reverse_match,
+ 0,
+ ONIGENC_FLAG_NONE,
};
/*
* Name: GBK
diff --git a/enc/iso_2022_jp.h b/enc/iso_2022_jp.h
index 8cfad0be06..399c2f56a5 100644
--- a/enc/iso_2022_jp.h
+++ b/enc/iso_2022_jp.h
@@ -5,7 +5,12 @@ ENC_ALIAS("ISO2022-JP", "ISO-2022-JP");
ENC_REPLICATE("ISO-2022-JP-2", "ISO-2022-JP");
ENC_ALIAS("ISO2022-JP2", "ISO-2022-JP-2");
-/* Windows Codepage 50220
+/*
+ * Name: CP50220
+ * MIBenum: 2260
+ * Link: http://www.iana.org/assignments/charset-reg/CP50220
+ *
+ * Windows Codepage 50220
* a ISO-2022-JP variant.
* This includes
* * US-ASCII
diff --git a/enc/iso_8859_1.c b/enc/iso_8859_1.c
index a10a7679b8..92dc14f978 100644
--- a/enc/iso_8859_1.c
+++ b/enc/iso_8859_1.c
@@ -272,7 +272,9 @@ OnigEncodingDefine(iso_8859_1, ISO_8859_1) = {
is_code_ctype,
onigenc_not_support_get_ctype_code_range,
onigenc_single_byte_left_adjust_char_head,
- onigenc_always_true_is_allowed_reverse_match
+ onigenc_always_true_is_allowed_reverse_match,
+ 0,
+ ONIGENC_FLAG_NONE,
};
ENC_ALIAS("ISO8859-1", "ISO-8859-1")
diff --git a/enc/iso_8859_10.c b/enc/iso_8859_10.c
index 1643278dfd..ec20a15baa 100644
--- a/enc/iso_8859_10.c
+++ b/enc/iso_8859_10.c
@@ -239,6 +239,8 @@ OnigEncodingDefine(iso_8859_10, ISO_8859_10) = {
is_code_ctype,
onigenc_not_support_get_ctype_code_range,
onigenc_single_byte_left_adjust_char_head,
- onigenc_always_true_is_allowed_reverse_match
+ onigenc_always_true_is_allowed_reverse_match,
+ 0,
+ ONIGENC_FLAG_NONE,
};
ENC_ALIAS("ISO8859-10", "ISO-8859-10")
diff --git a/enc/iso_8859_11.c b/enc/iso_8859_11.c
index 257d9d8919..ec9840e127 100644
--- a/enc/iso_8859_11.c
+++ b/enc/iso_8859_11.c
@@ -92,7 +92,9 @@ OnigEncodingDefine(iso_8859_11, ISO_8859_11) = {
is_code_ctype,
onigenc_not_support_get_ctype_code_range,
onigenc_single_byte_left_adjust_char_head,
- onigenc_always_true_is_allowed_reverse_match
+ onigenc_always_true_is_allowed_reverse_match,
+ 0,
+ ONIGENC_FLAG_NONE,
};
ENC_ALIAS("ISO8859-11", "ISO-8859-11")
diff --git a/enc/iso_8859_13.c b/enc/iso_8859_13.c
index f29cb2e281..4d7b328818 100644
--- a/enc/iso_8859_13.c
+++ b/enc/iso_8859_13.c
@@ -228,7 +228,9 @@ OnigEncodingDefine(iso_8859_13, ISO_8859_13) = {
is_code_ctype,
onigenc_not_support_get_ctype_code_range,
onigenc_single_byte_left_adjust_char_head,
- onigenc_always_true_is_allowed_reverse_match
+ onigenc_always_true_is_allowed_reverse_match,
+ 0,
+ ONIGENC_FLAG_NONE,
};
ENC_ALIAS("ISO8859-13", "ISO-8859-13")
diff --git a/enc/iso_8859_14.c b/enc/iso_8859_14.c
index be83f93f80..1271c8a7a6 100644
--- a/enc/iso_8859_14.c
+++ b/enc/iso_8859_14.c
@@ -241,6 +241,8 @@ OnigEncodingDefine(iso_8859_14, ISO_8859_14) = {
is_code_ctype,
onigenc_not_support_get_ctype_code_range,
onigenc_single_byte_left_adjust_char_head,
- onigenc_always_true_is_allowed_reverse_match
+ onigenc_always_true_is_allowed_reverse_match,
+ 0,
+ ONIGENC_FLAG_NONE,
};
ENC_ALIAS("ISO8859-14", "ISO-8859-14")
diff --git a/enc/iso_8859_15.c b/enc/iso_8859_15.c
index 2ec41b66c0..451033e158 100644
--- a/enc/iso_8859_15.c
+++ b/enc/iso_8859_15.c
@@ -235,6 +235,8 @@ OnigEncodingDefine(iso_8859_15, ISO_8859_15) = {
is_code_ctype,
onigenc_not_support_get_ctype_code_range,
onigenc_single_byte_left_adjust_char_head,
- onigenc_always_true_is_allowed_reverse_match
+ onigenc_always_true_is_allowed_reverse_match,
+ 0,
+ ONIGENC_FLAG_NONE,
};
ENC_ALIAS("ISO8859-15", "ISO-8859-15")
diff --git a/enc/iso_8859_16.c b/enc/iso_8859_16.c
index 3ddc1d91c6..5234cf0e7f 100644
--- a/enc/iso_8859_16.c
+++ b/enc/iso_8859_16.c
@@ -237,6 +237,8 @@ OnigEncodingDefine(iso_8859_16, ISO_8859_16) = {
is_code_ctype,
onigenc_not_support_get_ctype_code_range,
onigenc_single_byte_left_adjust_char_head,
- onigenc_always_true_is_allowed_reverse_match
+ onigenc_always_true_is_allowed_reverse_match,
+ 0,
+ ONIGENC_FLAG_NONE,
};
ENC_ALIAS("ISO8859-16", "ISO-8859-16")
diff --git a/enc/iso_8859_2.c b/enc/iso_8859_2.c
index 6c0d2d7dc1..f4cb9100df 100644
--- a/enc/iso_8859_2.c
+++ b/enc/iso_8859_2.c
@@ -237,7 +237,9 @@ OnigEncodingDefine(iso_8859_2, ISO_8859_2) = {
is_code_ctype,
onigenc_not_support_get_ctype_code_range,
onigenc_single_byte_left_adjust_char_head,
- onigenc_always_true_is_allowed_reverse_match
+ onigenc_always_true_is_allowed_reverse_match,
+ 0,
+ ONIGENC_FLAG_NONE,
};
ENC_ALIAS("ISO8859-2", "ISO-8859-2")
diff --git a/enc/iso_8859_3.c b/enc/iso_8859_3.c
index 81c0c742b6..85572574b8 100644
--- a/enc/iso_8859_3.c
+++ b/enc/iso_8859_3.c
@@ -235,6 +235,8 @@ OnigEncodingDefine(iso_8859_3, ISO_8859_3) = {
is_code_ctype,
onigenc_not_support_get_ctype_code_range,
onigenc_single_byte_left_adjust_char_head,
- onigenc_always_true_is_allowed_reverse_match
+ onigenc_always_true_is_allowed_reverse_match,
+ 0,
+ ONIGENC_FLAG_NONE,
};
ENC_ALIAS("ISO8859-3", "ISO-8859-3")
diff --git a/enc/iso_8859_4.c b/enc/iso_8859_4.c
index ec71c4bcbf..771a2cf6e7 100644
--- a/enc/iso_8859_4.c
+++ b/enc/iso_8859_4.c
@@ -237,6 +237,8 @@ OnigEncodingDefine(iso_8859_4, ISO_8859_4) = {
is_code_ctype,
onigenc_not_support_get_ctype_code_range,
onigenc_single_byte_left_adjust_char_head,
- onigenc_always_true_is_allowed_reverse_match
+ onigenc_always_true_is_allowed_reverse_match,
+ 0,
+ ONIGENC_FLAG_NONE,
};
ENC_ALIAS("ISO8859-4", "ISO-8859-4")
diff --git a/enc/iso_8859_5.c b/enc/iso_8859_5.c
index 81cc8e5b32..4ee27b10d8 100644
--- a/enc/iso_8859_5.c
+++ b/enc/iso_8859_5.c
@@ -225,6 +225,8 @@ OnigEncodingDefine(iso_8859_5, ISO_8859_5) = {
is_code_ctype,
onigenc_not_support_get_ctype_code_range,
onigenc_single_byte_left_adjust_char_head,
- onigenc_always_true_is_allowed_reverse_match
+ onigenc_always_true_is_allowed_reverse_match,
+ 0,
+ ONIGENC_FLAG_NONE,
};
ENC_ALIAS("ISO8859-5", "ISO-8859-5")
diff --git a/enc/iso_8859_6.c b/enc/iso_8859_6.c
index 7384061a1f..638a181dc2 100644
--- a/enc/iso_8859_6.c
+++ b/enc/iso_8859_6.c
@@ -92,7 +92,9 @@ OnigEncodingDefine(iso_8859_6, ISO_8859_6) = {
is_code_ctype,
onigenc_not_support_get_ctype_code_range,
onigenc_single_byte_left_adjust_char_head,
- onigenc_always_true_is_allowed_reverse_match
+ onigenc_always_true_is_allowed_reverse_match,
+ 0,
+ ONIGENC_FLAG_NONE,
};
ENC_ALIAS("ISO8859-6", "ISO-8859-6")
diff --git a/enc/iso_8859_7.c b/enc/iso_8859_7.c
index 2f916171db..aa82f880f9 100644
--- a/enc/iso_8859_7.c
+++ b/enc/iso_8859_7.c
@@ -222,7 +222,9 @@ OnigEncodingDefine(iso_8859_7, ISO_8859_7) = {
is_code_ctype,
onigenc_not_support_get_ctype_code_range,
onigenc_single_byte_left_adjust_char_head,
- onigenc_always_true_is_allowed_reverse_match
+ onigenc_always_true_is_allowed_reverse_match,
+ 0,
+ ONIGENC_FLAG_NONE,
};
ENC_ALIAS("ISO8859-7", "ISO-8859-7")
diff --git a/enc/iso_8859_8.c b/enc/iso_8859_8.c
index bd0754c2b1..87a6e7bc9b 100644
--- a/enc/iso_8859_8.c
+++ b/enc/iso_8859_8.c
@@ -92,7 +92,9 @@ OnigEncodingDefine(iso_8859_8, ISO_8859_8) = {
is_code_ctype,
onigenc_not_support_get_ctype_code_range,
onigenc_single_byte_left_adjust_char_head,
- onigenc_always_true_is_allowed_reverse_match
+ onigenc_always_true_is_allowed_reverse_match,
+ 0,
+ ONIGENC_FLAG_NONE,
};
ENC_ALIAS("ISO8859-8", "ISO-8859-8")
diff --git a/enc/iso_8859_9.c b/enc/iso_8859_9.c
index 4d46e742e2..0adafa3ed4 100644
--- a/enc/iso_8859_9.c
+++ b/enc/iso_8859_9.c
@@ -228,7 +228,9 @@ OnigEncodingDefine(iso_8859_9, ISO_8859_9) = {
is_code_ctype,
onigenc_not_support_get_ctype_code_range,
onigenc_single_byte_left_adjust_char_head,
- onigenc_always_true_is_allowed_reverse_match
+ onigenc_always_true_is_allowed_reverse_match,
+ 0,
+ ONIGENC_FLAG_NONE,
};
ENC_ALIAS("ISO8859-9", "ISO-8859-9")
diff --git a/enc/koi8_r.c b/enc/koi8_r.c
index f5b7d22349..8ec48747f8 100644
--- a/enc/koi8_r.c
+++ b/enc/koi8_r.c
@@ -213,7 +213,9 @@ OnigEncodingDefine(koi8_r, KOI8_R) = {
koi8_r_is_code_ctype,
onigenc_not_support_get_ctype_code_range,
onigenc_single_byte_left_adjust_char_head,
- onigenc_always_true_is_allowed_reverse_match
+ onigenc_always_true_is_allowed_reverse_match,
+ 0,
+ ONIGENC_FLAG_NONE,
};
ENC_ALIAS("CP878", "KOI8-R")
diff --git a/enc/koi8_u.c b/enc/koi8_u.c
index dfbaa9ac36..0e51b6eb80 100644
--- a/enc/koi8_u.c
+++ b/enc/koi8_u.c
@@ -217,5 +217,7 @@ OnigEncodingDefine(koi8_u, KOI8_U) = {
koi8_u_is_code_ctype,
onigenc_not_support_get_ctype_code_range,
onigenc_single_byte_left_adjust_char_head,
- onigenc_always_true_is_allowed_reverse_match
+ onigenc_always_true_is_allowed_reverse_match,
+ 0,
+ ONIGENC_FLAG_NONE,
};
diff --git a/enc/make_encmake.rb b/enc/make_encmake.rb
index ed3680313f..b917eca0bd 100755
--- a/enc/make_encmake.rb
+++ b/enc/make_encmake.rb
@@ -15,6 +15,7 @@ BUILTIN_ENCS = []
BUILTIN_TRANSES = []
ENC_PATTERNS = []
NOENC_PATTERNS = []
+module_type = :dynamic
until ARGV.empty?
case ARGV[0]
@@ -30,11 +31,81 @@ until ARGV.empty?
when /\A--no-encs=/
NOENC_PATTERNS.concat $'.split
ARGV.shift
+ when /\A--module$/
+ ARGV.shift
+ when /\A--modulestatic$/
+ module_type = :static
+ ARGV.shift
else
break
end
end
+ALPHANUMERIC_ORDER = proc {|e| e.scan(/(\d+)|(\D+)/).map {|n,a| a||[n.size,n.to_i]}.flatten}
+def target_encodings
+ encs = Dir.open($srcdir) {|d| d.grep(/.+\.c\z/)} - BUILTIN_ENCS - ["mktable.c"]
+ encs.each {|e| e.chomp!(".c")}
+ encs.reject! {|e| !ENC_PATTERNS.any? {|p| File.fnmatch?(p, e)}} if !ENC_PATTERNS.empty?
+ encs.reject! {|e| NOENC_PATTERNS.any? {|p| File.fnmatch?(p, e)}}
+ encs = encs.sort_by(&ALPHANUMERIC_ORDER)
+ deps = Hash.new {[]}
+ inc_srcs = Hash.new {[]}
+ default_deps = %w[regenc.h oniguruma.h config.h defines.h]
+ db = encs.delete("encdb")
+ encs.each do |e|
+ File.foreach("#$srcdir/#{e}.c") do |l|
+ if /^\s*#\s*include\s+(?:"([^\"]+)"|<(ruby\/\sw+.h)>)/ =~ l
+ n = $1 || $2
+ if /\.c$/ =~ n
+ inc_srcs[e] <<= $`
+ n = "enc/#{n}"
+ end
+ deps[e] <<= n unless default_deps.include?(n)
+ end
+ end
+ end
+ class << inc_srcs; self; end.class_eval do
+ define_method(:expand) do |d|
+ d.map {|n| deps[n] | self.expand(self[n])}.flatten
+ end
+ end
+ inc_srcs.each do |e, d|
+ deps[e].concat(inc_srcs.expand(d))
+ end
+ encs.unshift(db)
+ return encs, deps
+end
+
+def target_transcoders
+ atrans = []
+ trans = Dir.open($srcdir+"/trans") {|d|
+ d.select {|e|
+ if e.chomp!('.trans')
+ atrans << e
+ true
+ elsif e.chomp!('.c')
+ true
+ end
+ }
+ }
+ trans -= BUILTIN_TRANSES
+ atrans -= BUILTIN_TRANSES
+ trans.uniq!
+ atrans = atrans.sort_by(&ALPHANUMERIC_ORDER)
+ trans = trans.sort_by(&ALPHANUMERIC_ORDER)
+ trans.unshift(trans.delete("transdb"))
+ trans.compact!
+ trans |= atrans
+ trans.map! {|e| "trans/#{e}"}
+
+ return atrans, trans
+end
+
+# Constants that "depend" needs.
+MODULE_TYPE = module_type
+ENCS, ENC_DEPS = target_encodings
+ATRANS, TRANS = target_transcoders
+
if File.exist?(depend = File.join($srcdir, "depend"))
erb = ERB.new(File.read(depend), nil, '%')
erb.filename = depend
@@ -48,3 +119,18 @@ mkin.gsub!(/@(#{CONFIG.keys.join('|')})@/) {CONFIG[$1]}
open(ARGV[0], 'wb') {|f|
f.puts mkin, dep
}
+if MODULE_TYPE == :static
+ erb = ERB.new(File.read(File.join($srcdir, "encinit.c.erb")), nil, '%-')
+ erb.filename = "enc/encinit.c.cerb"
+ tmp = erb.result(binding)
+ begin
+ Dir.mkdir 'enc'
+ rescue Errno::EEXIST
+ end
+ File.open("enc/encinit.c", "w") {|f|
+ f.puts "/* Automatically generated from enc/encinit.c.erb"
+ f.puts " * Do not edit."
+ f.puts " */"
+ f.puts tmp
+ }
+end
diff --git a/enc/mktable.c b/enc/mktable.c
new file mode 100644
index 0000000000..49acf628d0
--- /dev/null
+++ b/enc/mktable.c
@@ -0,0 +1,1162 @@
+/**********************************************************************
+ mktable.c
+**********************************************************************/
+/*-
+ * Copyright (c) 2002-2007 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <locale.h>
+
+#define __USE_ISOC99
+#include <ctype.h>
+
+#include "regenc.h"
+
+#define ASCII 0
+#define UNICODE_ISO_8859_1 1
+#define ISO_8859_1 2
+#define ISO_8859_2 3
+#define ISO_8859_3 4
+#define ISO_8859_4 5
+#define ISO_8859_5 6
+#define ISO_8859_6 7
+#define ISO_8859_7 8
+#define ISO_8859_8 9
+#define ISO_8859_9 10
+#define ISO_8859_10 11
+#define ISO_8859_11 12
+#define ISO_8859_13 13
+#define ISO_8859_14 14
+#define ISO_8859_15 15
+#define ISO_8859_16 16
+#define KOI8 17
+#define KOI8_R 18
+
+typedef struct {
+ int num;
+ const char* name;
+} ENC_INFO;
+
+static ENC_INFO Info[] = {
+ { ASCII, "ASCII" },
+ { UNICODE_ISO_8859_1, "UNICODE_ISO_8859_1" },
+ { ISO_8859_1, "ISO_8859_1" },
+ { ISO_8859_2, "ISO_8859_2" },
+ { ISO_8859_3, "ISO_8859_3" },
+ { ISO_8859_4, "ISO_8859_4" },
+ { ISO_8859_5, "ISO_8859_5" },
+ { ISO_8859_6, "ISO_8859_6" },
+ { ISO_8859_7, "ISO_8859_7" },
+ { ISO_8859_8, "ISO_8859_8" },
+ { ISO_8859_9, "ISO_8859_9" },
+ { ISO_8859_10, "ISO_8859_10" },
+ { ISO_8859_11, "ISO_8859_11" },
+ { ISO_8859_13, "ISO_8859_13" },
+ { ISO_8859_14, "ISO_8859_14" },
+ { ISO_8859_15, "ISO_8859_15" },
+ { ISO_8859_16, "ISO_8859_16" },
+ { KOI8, "KOI8" },
+ { KOI8_R, "KOI8_R" }
+};
+
+
+static int IsAlpha(int enc, int c)
+{
+ if (enc == ASCII)
+ return isalpha(c);
+
+ if (c >= 0x41 && c <= 0x5a) return 1;
+ if (c >= 0x61 && c <= 0x7a) return 1;
+
+ switch (enc) {
+ case UNICODE_ISO_8859_1:
+ case ISO_8859_1:
+ case ISO_8859_9:
+ if (c == 0xaa) return 1;
+ if (c == 0xb5) return 1;
+ if (c == 0xba) return 1;
+ if (c >= 0xc0 && c <= 0xd6) return 1;
+ if (c >= 0xd8 && c <= 0xf6) return 1;
+ if (c >= 0xf8 && c <= 0xff) return 1;
+ break;
+
+ case ISO_8859_2:
+ if (c == 0xa1 || c == 0xa3) return 1;
+ if (c == 0xa5 || c == 0xa6) return 1;
+ if (c >= 0xa9 && c <= 0xac) return 1;
+ if (c >= 0xae && c <= 0xaf) return 1;
+ if (c == 0xb1 || c == 0xb3) return 1;
+ if (c == 0xb5 || c == 0xb6) return 1;
+ if (c >= 0xb9 && c <= 0xbc) return 1;
+ if (c >= 0xbe && c <= 0xbf) return 1;
+ if (c >= 0xc0 && c <= 0xd6) return 1;
+ if (c >= 0xd8 && c <= 0xf6) return 1;
+ if (c >= 0xf8 && c <= 0xfe) return 1;
+ break;
+
+ case ISO_8859_3:
+ if (c == 0xa1) return 1;
+ if (c == 0xa6) return 1;
+ if (c >= 0xa9 && c <= 0xac) return 1;
+ if (c == 0xaf) return 1;
+ if (c == 0xb1) return 1;
+ if (c == 0xb5 || c == 0xb6) return 1;
+ if (c >= 0xb9 && c <= 0xbc) return 1;
+ if (c == 0xbf) return 1;
+ if (c >= 0xc0 && c <= 0xc2) return 1;
+ if (c >= 0xc4 && c <= 0xcf) return 1;
+ if (c >= 0xd1 && c <= 0xd6) return 1;
+ if (c >= 0xd8 && c <= 0xe2) return 1;
+ if (c >= 0xe4 && c <= 0xef) return 1;
+ if (c >= 0xf1 && c <= 0xf6) return 1;
+ if (c >= 0xf8 && c <= 0xfe) return 1;
+ break;
+
+ case ISO_8859_4:
+ if (c >= 0xa1 && c <= 0xa3) return 1;
+ if (c == 0xa5 || c == 0xa6) return 1;
+ if (c >= 0xa9 && c <= 0xac) return 1;
+ if (c == 0xae) return 1;
+ if (c == 0xb1 || c == 0xb3) return 1;
+ if (c == 0xb5 || c == 0xb6) return 1;
+ if (c >= 0xb9 && c <= 0xbf) return 1;
+ if (c >= 0xc0 && c <= 0xd6) return 1;
+ if (c >= 0xd8 && c <= 0xf6) return 1;
+ if (c >= 0xf8 && c <= 0xfe) return 1;
+ break;
+
+ case ISO_8859_5:
+ if (c >= 0xa1 && c <= 0xcf && c != 0xad) return 1;
+ if (c >= 0xd0 && c <= 0xff && c != 0xf0 && c != 0xfd) return 1;
+ break;
+
+ case ISO_8859_6:
+ if (c >= 0xc1 && c <= 0xda) return 1;
+ if (c >= 0xe0 && c <= 0xf2) return 1;
+ break;
+
+ case ISO_8859_7:
+ if (c == 0xb6) return 1;
+ if (c >= 0xb8 && c <= 0xba) return 1;
+ if (c == 0xbc) return 1;
+ if (c >= 0xbe && c <= 0xbf) return 1;
+ if (c == 0xc0) return 1;
+ if (c >= 0xc1 && c <= 0xdb && c != 0xd2) return 1;
+ if (c >= 0xdc && c <= 0xfe) return 1;
+ break;
+
+ case ISO_8859_8:
+ if (c == 0xb5) return 1;
+ if (c >= 0xe0 && c <= 0xfa) return 1;
+ break;
+
+ case ISO_8859_10:
+ if (c >= 0xa1 && c <= 0xa6) return 1;
+ if (c >= 0xa8 && c <= 0xac) return 1;
+ if (c == 0xae || c == 0xaf) return 1;
+ if (c >= 0xb1 && c <= 0xb6) return 1;
+ if (c >= 0xb8 && c <= 0xbc) return 1;
+ if (c >= 0xbe && c <= 0xff) return 1;
+ break;
+
+ case ISO_8859_11:
+ if (c >= 0xa1 && c <= 0xda) return 1;
+ if (c >= 0xdf && c <= 0xfb) return 1;
+ break;
+
+ case ISO_8859_13:
+ if (c == 0xa8) return 1;
+ if (c == 0xaa) return 1;
+ if (c == 0xaf) return 1;
+ if (c == 0xb5) return 1;
+ if (c == 0xb8) return 1;
+ if (c == 0xba) return 1;
+ if (c >= 0xbf && c <= 0xd6) return 1;
+ if (c >= 0xd8 && c <= 0xf6) return 1;
+ if (c >= 0xf8 && c <= 0xfe) return 1;
+ break;
+
+ case ISO_8859_14:
+ if (c == 0xa1 || c == 0xa2) return 1;
+ if (c == 0xa4 || c == 0xa5) return 1;
+ if (c == 0xa6 || c == 0xa8) return 1;
+ if (c >= 0xaa && c <= 0xac) return 1;
+ if (c >= 0xaf && c <= 0xb5) return 1;
+ if (c >= 0xb7 && c <= 0xff) return 1;
+ break;
+
+ case ISO_8859_15:
+ if (c == 0xaa) return 1;
+ if (c == 0xb5) return 1;
+ if (c == 0xba) return 1;
+ if (c >= 0xc0 && c <= 0xd6) return 1;
+ if (c >= 0xd8 && c <= 0xf6) return 1;
+ if (c >= 0xf8 && c <= 0xff) return 1;
+ if (c == 0xa6) return 1;
+ if (c == 0xa8) return 1;
+ if (c == 0xb4) return 1;
+ if (c == 0xb8) return 1;
+ if (c == 0xbc) return 1;
+ if (c == 0xbd) return 1;
+ if (c == 0xbe) return 1;
+ break;
+
+ case ISO_8859_16:
+ if (c == 0xa1) return 1;
+ if (c == 0xa2) return 1;
+ if (c == 0xa3) return 1;
+ if (c == 0xa6) return 1;
+ if (c == 0xa8) return 1;
+ if (c == 0xaa) return 1;
+ if (c == 0xac) return 1;
+ if (c == 0xae) return 1;
+ if (c == 0xaf) return 1;
+ if (c == 0xb2) return 1;
+ if (c == 0xb3) return 1;
+ if (c == 0xb4) return 1;
+ if (c >= 0xb8 && c <= 0xba) return 1;
+ if (c == 0xbc) return 1;
+ if (c == 0xbd) return 1;
+ if (c == 0xbe) return 1;
+ if (c == 0xbf) return 1;
+ if (c >= 0xc0 && c <= 0xde) return 1;
+ if (c >= 0xdf && c <= 0xff) return 1;
+ break;
+
+ case KOI8_R:
+ if (c == 0xa3 || c == 0xb3) return 1;
+ /* fall */
+ case KOI8:
+ if (c >= 0xc0 && c <= 0xff) return 1;
+ break;
+
+ default:
+ exit(-1);
+ }
+
+ return 0;
+}
+
+static int IsBlank(int enc, int c)
+{
+ if (enc == ASCII)
+ return isblank(c);
+
+ if (c == 0x09 || c == 0x20) return 1;
+
+ switch (enc) {
+ case UNICODE_ISO_8859_1:
+ case ISO_8859_1:
+ case ISO_8859_2:
+ case ISO_8859_3:
+ case ISO_8859_4:
+ case ISO_8859_5:
+ case ISO_8859_6:
+ case ISO_8859_7:
+ case ISO_8859_8:
+ case ISO_8859_9:
+ case ISO_8859_10:
+ case ISO_8859_11:
+ case ISO_8859_13:
+ case ISO_8859_14:
+ case ISO_8859_15:
+ case ISO_8859_16:
+ case KOI8:
+ if (c == 0xa0) return 1;
+ break;
+
+ case KOI8_R:
+ if (c == 0x9a) return 1;
+ break;
+
+ default:
+ exit(-1);
+ }
+
+ return 0;
+}
+
+static int IsCntrl(int enc, int c)
+{
+ if (enc == ASCII)
+ return iscntrl(c);
+
+ if (c >= 0x00 && c <= 0x1F) return 1;
+
+ switch (enc) {
+ case UNICODE_ISO_8859_1:
+ if (c == 0xad) return 1;
+ /* fall */
+ case ISO_8859_1:
+ case ISO_8859_2:
+ case ISO_8859_3:
+ case ISO_8859_4:
+ case ISO_8859_5:
+ case ISO_8859_6:
+ case ISO_8859_7:
+ case ISO_8859_8:
+ case ISO_8859_9:
+ case ISO_8859_10:
+ case ISO_8859_11:
+ case ISO_8859_13:
+ case ISO_8859_14:
+ case ISO_8859_15:
+ case ISO_8859_16:
+ case KOI8:
+ if (c >= 0x7f && c <= 0x9F) return 1;
+ break;
+
+
+ case KOI8_R:
+ if (c == 0x7f) return 1;
+ break;
+
+ default:
+ exit(-1);
+ }
+
+ return 0;
+}
+
+static int IsDigit(int enc ARG_UNUSED, int c)
+{
+ if (c >= 0x30 && c <= 0x39) return 1;
+ return 0;
+}
+
+static int IsGraph(int enc, int c)
+{
+ if (enc == ASCII)
+ return isgraph(c);
+
+ if (c >= 0x21 && c <= 0x7e) return 1;
+
+ switch (enc) {
+ case UNICODE_ISO_8859_1:
+ case ISO_8859_1:
+ case ISO_8859_2:
+ case ISO_8859_4:
+ case ISO_8859_5:
+ case ISO_8859_9:
+ case ISO_8859_10:
+ case ISO_8859_13:
+ case ISO_8859_14:
+ case ISO_8859_15:
+ case ISO_8859_16:
+ if (c >= 0xa1 && c <= 0xff) return 1;
+ break;
+
+ case ISO_8859_3:
+ if (c >= 0xa1) {
+ if (c == 0xa5 || c == 0xae || c == 0xbe || c == 0xc3 || c == 0xd0 ||
+ c == 0xe3 || c == 0xf0)
+ return 0;
+ else
+ return 1;
+ }
+ break;
+
+ case ISO_8859_6:
+ if (c == 0xa4 || c == 0xac || c == 0xad || c == 0xbb || c == 0xbf)
+ return 1;
+ if (c >= 0xc1 && c <= 0xda) return 1;
+ if (c >= 0xe0 && c <= 0xf2) return 1;
+ break;
+
+ case ISO_8859_7:
+ if (c >= 0xa1 && c <= 0xfe &&
+ c != 0xa4 && c != 0xa5 && c != 0xaa &&
+ c != 0xae && c != 0xd2) return 1;
+ break;
+
+ case ISO_8859_8:
+ if (c >= 0xa2 && c <= 0xfa) {
+ if (c >= 0xbf && c <= 0xde) return 0;
+ return 1;
+ }
+ break;
+
+ case ISO_8859_11:
+ if (c >= 0xa1 && c <= 0xda) return 1;
+ if (c >= 0xdf && c <= 0xfb) return 1;
+ break;
+
+ case KOI8:
+ if (c >= 0xc0 && c <= 0xff) return 1;
+ break;
+
+ case KOI8_R:
+ if (c >= 0x80 && c <= 0xff && c != 0x9a) return 1;
+ break;
+
+ default:
+ exit(-1);
+ }
+
+ return 0;
+}
+
+static int IsLower(int enc, int c)
+{
+ if (enc == ASCII)
+ return islower(c);
+
+ if (c >= 0x61 && c <= 0x7a) return 1;
+
+ switch (enc) {
+ case UNICODE_ISO_8859_1:
+ case ISO_8859_1:
+ case ISO_8859_9:
+ if (c == 0xaa) return 1;
+ if (c == 0xb5) return 1;
+ if (c == 0xba) return 1;
+ if (c >= 0xdf && c <= 0xf6) return 1;
+ if (c >= 0xf8 && c <= 0xff) return 1;
+ break;
+
+ case ISO_8859_2:
+ if (c == 0xb1 || c == 0xb3) return 1;
+ if (c == 0xb5 || c == 0xb6) return 1;
+ if (c >= 0xb9 && c <= 0xbc) return 1;
+ if (c >= 0xbe && c <= 0xbf) return 1;
+ if (c >= 0xdf && c <= 0xf6) return 1;
+ if (c >= 0xf8 && c <= 0xfe) return 1;
+ break;
+
+ case ISO_8859_3:
+ if (c == 0xb1) return 1;
+ if (c == 0xb5 || c == 0xb6) return 1;
+ if (c >= 0xb9 && c <= 0xbc) return 1;
+ if (c == 0xbf) return 1;
+ if (c == 0xdf) return 1;
+ if (c >= 0xe0 && c <= 0xe2) return 1;
+ if (c >= 0xe4 && c <= 0xef) return 1;
+ if (c >= 0xf1 && c <= 0xf6) return 1;
+ if (c >= 0xf8 && c <= 0xfe) return 1;
+ break;
+
+ case ISO_8859_4:
+ if (c == 0xa2) return 1;
+ if (c == 0xb1 || c == 0xb3) return 1;
+ if (c == 0xb5 || c == 0xb6) return 1;
+ if (c >= 0xb9 && c <= 0xbc) return 1;
+ if (c >= 0xbe && c <= 0xbf) return 1;
+ if (c == 0xdf) return 1;
+ if (c >= 0xe0 && c <= 0xf6) return 1;
+ if (c >= 0xf8 && c <= 0xfe) return 1;
+ break;
+
+ case ISO_8859_5:
+ if (c >= 0xd0 && c <= 0xff && c != 0xf0 && c != 0xfd) return 1;
+ break;
+
+ case ISO_8859_6:
+ break;
+
+ case ISO_8859_7:
+ if (c == 0xc0) return 1;
+ if (c >= 0xdc && c <= 0xfe) return 1;
+ break;
+
+ case ISO_8859_8:
+ if (c == 0xb5) return 1;
+ break;
+
+ case ISO_8859_10:
+ if (c >= 0xb1 && c <= 0xb6) return 1;
+ if (c >= 0xb8 && c <= 0xbc) return 1;
+ if (c == 0xbe || c == 0xbf) return 1;
+ if (c >= 0xdf && c <= 0xff) return 1;
+ break;
+
+ case ISO_8859_11:
+ break;
+
+ case ISO_8859_13:
+ if (c == 0xb5) return 1;
+ if (c == 0xb8) return 1;
+ if (c == 0xba) return 1;
+ if (c == 0xbf) return 1;
+ if (c >= 0xdf && c <= 0xf6) return 1;
+ if (c >= 0xf8 && c <= 0xfe) return 1;
+ break;
+
+ case ISO_8859_14:
+ if (c == 0xa2) return 1;
+ if (c == 0xa5) return 1;
+ if (c == 0xab) return 1;
+ if (c == 0xb1 || c == 0xb3 || c == 0xb5) return 1;
+ if (c >= 0xb8 && c <= 0xba) return 1;
+ if (c == 0xbc) return 1;
+ if (c == 0xbe || c == 0xbf) return 1;
+ if (c >= 0xdf && c <= 0xff) return 1;
+ break;
+
+ case ISO_8859_15:
+ if (c == 0xaa) return 1;
+ if (c == 0xb5) return 1;
+ if (c == 0xba) return 1;
+ if (c >= 0xdf && c <= 0xf6) return 1;
+ if (c >= 0xf8 && c <= 0xff) return 1;
+ if (c == 0xa8) return 1;
+ if (c == 0xb8) return 1;
+ if (c == 0xbd) return 1;
+ break;
+
+ case ISO_8859_16:
+ if (c == 0xa2) return 1;
+ if (c == 0xa8) return 1;
+ if (c == 0xae) return 1;
+ if (c == 0xb3) return 1;
+ if (c >= 0xb8 && c <= 0xba) return 1;
+ if (c == 0xbd) return 1;
+ if (c == 0xbf) return 1;
+ if (c >= 0xdf && c <= 0xff) return 1;
+ break;
+
+ case KOI8_R:
+ if (c == 0xa3) return 1;
+ /* fall */
+ case KOI8:
+ if (c >= 0xc0 && c <= 0xdf) return 1;
+ break;
+
+ default:
+ exit(-1);
+ }
+
+ return 0;
+}
+
+static int IsPrint(int enc, int c)
+{
+ if (enc == ASCII)
+ return isprint(c);
+
+ if (c >= 0x20 && c <= 0x7e) return 1;
+
+ switch (enc) {
+ case UNICODE_ISO_8859_1:
+ /* if (c >= 0x09 && c <= 0x0d) return 1; */
+ if (c == 0x85) return 1;
+ /* fall */
+ case ISO_8859_1:
+ case ISO_8859_2:
+ case ISO_8859_4:
+ case ISO_8859_5:
+ case ISO_8859_9:
+ case ISO_8859_10:
+ case ISO_8859_13:
+ case ISO_8859_14:
+ case ISO_8859_15:
+ case ISO_8859_16:
+ if (c >= 0xa0 && c <= 0xff) return 1;
+ break;
+
+ case ISO_8859_3:
+ if (c >= 0xa0) {
+ if (c == 0xa5 || c == 0xae || c == 0xbe || c == 0xc3 || c == 0xd0 ||
+ c == 0xe3 || c == 0xf0)
+ return 0;
+ else
+ return 1;
+ }
+ break;
+
+ case ISO_8859_6:
+ if (c == 0xa0) return 1;
+ if (c == 0xa4 || c == 0xac || c == 0xad || c == 0xbb || c == 0xbf)
+ return 1;
+ if (c >= 0xc1 && c <= 0xda) return 1;
+ if (c >= 0xe0 && c <= 0xf2) return 1;
+ break;
+
+ case ISO_8859_7:
+ if (c >= 0xa0 && c <= 0xfe &&
+ c != 0xa4 && c != 0xa5 && c != 0xaa &&
+ c != 0xae && c != 0xd2) return 1;
+ break;
+
+ case ISO_8859_8:
+ if (c >= 0xa0 && c <= 0xfa) {
+ if (c >= 0xbf && c <= 0xde) return 0;
+ if (c == 0xa1) return 0;
+ return 1;
+ }
+ break;
+
+ case ISO_8859_11:
+ if (c >= 0xa0 && c <= 0xda) return 1;
+ if (c >= 0xdf && c <= 0xfb) return 1;
+ break;
+
+ case KOI8:
+ if (c == 0xa0) return 1;
+ if (c >= 0xc0 && c <= 0xff) return 1;
+ break;
+
+ case KOI8_R:
+ if (c >= 0x80 && c <= 0xff) return 1;
+ break;
+
+ default:
+ exit(-1);
+ }
+
+ return 0;
+}
+
+static int IsPunct(int enc, int c)
+{
+ if (enc == ASCII)
+ return ispunct(c);
+
+ if (enc == UNICODE_ISO_8859_1) {
+ if (c == 0x24 || c == 0x2b || c == 0x5e || c == 0x60 ||
+ c == 0x7c || c == 0x7e) return 1;
+ if (c >= 0x3c && c <= 0x3e) return 1;
+ }
+
+ if (c >= 0x21 && c <= 0x2f) return 1;
+ if (c >= 0x3a && c <= 0x40) return 1;
+ if (c >= 0x5b && c <= 0x60) return 1;
+ if (c >= 0x7b && c <= 0x7e) return 1;
+
+ switch (enc) {
+ case ISO_8859_1:
+ case ISO_8859_9:
+ case ISO_8859_15:
+ if (c == 0xad) return 1;
+ /* fall */
+ case UNICODE_ISO_8859_1:
+ if (c == 0xa1) return 1;
+ if (c == 0xab) return 1;
+ if (c == 0xb7) return 1;
+ if (c == 0xbb) return 1;
+ if (c == 0xbf) return 1;
+ break;
+
+ case ISO_8859_2:
+ case ISO_8859_4:
+ case ISO_8859_5:
+ case ISO_8859_14:
+ if (c == 0xad) return 1;
+ break;
+
+ case ISO_8859_3:
+ case ISO_8859_10:
+ if (c == 0xad) return 1;
+ if (c == 0xb7) return 1;
+ if (c == 0xbd) return 1;
+ break;
+
+ case ISO_8859_6:
+ if (c == 0xac) return 1;
+ if (c == 0xad) return 1;
+ if (c == 0xbb) return 1;
+ if (c == 0xbf) return 1;
+ break;
+
+ case ISO_8859_7:
+ if (c == 0xa1 || c == 0xa2) return 1;
+ if (c == 0xab) return 1;
+ if (c == 0xaf) return 1;
+ if (c == 0xad) return 1;
+ if (c == 0xb7 || c == 0xbb) return 1;
+ break;
+
+ case ISO_8859_8:
+ if (c == 0xab) return 1;
+ if (c == 0xad) return 1;
+ if (c == 0xb7) return 1;
+ if (c == 0xbb) return 1;
+ if (c == 0xdf) return 1;
+ break;
+
+ case ISO_8859_13:
+ if (c == 0xa1 || c == 0xa5) return 1;
+ if (c == 0xab || c == 0xad) return 1;
+ if (c == 0xb4 || c == 0xb7) return 1;
+ if (c == 0xbb) return 1;
+ if (c == 0xff) return 1;
+ break;
+
+ case ISO_8859_16:
+ if (c == 0xa5) return 1;
+ if (c == 0xab) return 1;
+ if (c == 0xad) return 1;
+ if (c == 0xb5) return 1;
+ if (c == 0xb7) return 1;
+ if (c == 0xbb) return 1;
+ break;
+
+ case KOI8_R:
+ if (c == 0x9e) return 1;
+ break;
+
+ case ISO_8859_11:
+ case KOI8:
+ break;
+
+ default:
+ exit(-1);
+ }
+
+ return 0;
+}
+
+static int IsSpace(int enc, int c)
+{
+ if (enc == ASCII)
+ return isspace(c);
+
+ if (c >= 0x09 && c <= 0x0d) return 1;
+ if (c == 0x20) return 1;
+
+ switch (enc) {
+ case UNICODE_ISO_8859_1:
+ if (c == 0x85) return 1;
+ /* fall */
+ case ISO_8859_1:
+ case ISO_8859_2:
+ case ISO_8859_3:
+ case ISO_8859_4:
+ case ISO_8859_5:
+ case ISO_8859_6:
+ case ISO_8859_7:
+ case ISO_8859_8:
+ case ISO_8859_9:
+ case ISO_8859_10:
+ case ISO_8859_11:
+ case ISO_8859_13:
+ case ISO_8859_14:
+ case ISO_8859_15:
+ case ISO_8859_16:
+ case KOI8:
+ if (c == 0xa0) return 1;
+ break;
+
+ case KOI8_R:
+ if (c == 0x9a) return 1;
+ break;
+
+ default:
+ exit(-1);
+ }
+
+ return 0;
+}
+
+static int IsUpper(int enc, int c)
+{
+ if (enc == ASCII)
+ return isupper(c);
+
+ if (c >= 0x41 && c <= 0x5a) return 1;
+
+ switch (enc) {
+ case UNICODE_ISO_8859_1:
+ case ISO_8859_1:
+ case ISO_8859_9:
+ if (c >= 0xc0 && c <= 0xd6) return 1;
+ if (c >= 0xd8 && c <= 0xde) return 1;
+ break;
+
+ case ISO_8859_2:
+ if (c == 0xa1 || c == 0xa3) return 1;
+ if (c == 0xa5 || c == 0xa6) return 1;
+ if (c >= 0xa9 && c <= 0xac) return 1;
+ if (c >= 0xae && c <= 0xaf) return 1;
+ if (c >= 0xc0 && c <= 0xd6) return 1;
+ if (c >= 0xd8 && c <= 0xde) return 1;
+ break;
+
+ case ISO_8859_3:
+ if (c == 0xa1) return 1;
+ if (c == 0xa6) return 1;
+ if (c >= 0xa9 && c <= 0xac) return 1;
+ if (c == 0xaf) return 1;
+ if (c >= 0xc0 && c <= 0xc2) return 1;
+ if (c >= 0xc4 && c <= 0xcf) return 1;
+ if (c >= 0xd1 && c <= 0xd6) return 1;
+ if (c >= 0xd8 && c <= 0xde) return 1;
+ break;
+
+ case ISO_8859_4:
+ if (c == 0xa1 || c == 0xa3) return 1;
+ if (c == 0xa5 || c == 0xa6) return 1;
+ if (c >= 0xa9 && c <= 0xac) return 1;
+ if (c == 0xae) return 1;
+ if (c == 0xbd) return 1;
+ if (c >= 0xc0 && c <= 0xd6) return 1;
+ if (c >= 0xd8 && c <= 0xde) return 1;
+ break;
+
+ case ISO_8859_5:
+ if (c >= 0xa1 && c <= 0xcf && c != 0xad) return 1;
+ break;
+
+ case ISO_8859_6:
+ break;
+
+ case ISO_8859_7:
+ if (c == 0xb6) return 1;
+ if (c >= 0xb8 && c <= 0xba) return 1;
+ if (c == 0xbc) return 1;
+ if (c >= 0xbe && c <= 0xbf) return 1;
+ if (c >= 0xc1 && c <= 0xdb && c != 0xd2) return 1;
+ break;
+
+ case ISO_8859_8:
+ case ISO_8859_11:
+ break;
+
+ case ISO_8859_10:
+ if (c >= 0xa1 && c <= 0xa6) return 1;
+ if (c >= 0xa8 && c <= 0xac) return 1;
+ if (c == 0xae || c == 0xaf) return 1;
+ if (c >= 0xc0 && c <= 0xde) return 1;
+ break;
+
+ case ISO_8859_13:
+ if (c == 0xa8) return 1;
+ if (c == 0xaa) return 1;
+ if (c == 0xaf) return 1;
+ if (c >= 0xc0 && c <= 0xd6) return 1;
+ if (c >= 0xd8 && c <= 0xde) return 1;
+ break;
+
+ case ISO_8859_14:
+ if (c == 0xa1) return 1;
+ if (c == 0xa4 || c == 0xa6) return 1;
+ if (c == 0xa8) return 1;
+ if (c == 0xaa || c == 0xac) return 1;
+ if (c == 0xaf || c == 0xb0) return 1;
+ if (c == 0xb2 || c == 0xb4 || c == 0xb7) return 1;
+ if (c == 0xbb || c == 0xbd) return 1;
+ if (c >= 0xc0 && c <= 0xde) return 1;
+ break;
+
+ case ISO_8859_15:
+ if (c >= 0xc0 && c <= 0xd6) return 1;
+ if (c >= 0xd8 && c <= 0xde) return 1;
+ if (c == 0xa6) return 1;
+ if (c == 0xb4) return 1;
+ if (c == 0xbc) return 1;
+ if (c == 0xbe) return 1;
+ break;
+
+ case ISO_8859_16:
+ if (c == 0xa1) return 1;
+ if (c == 0xa3) return 1;
+ if (c == 0xa6) return 1;
+ if (c == 0xaa) return 1;
+ if (c == 0xac) return 1;
+ if (c == 0xaf) return 1;
+ if (c == 0xb2) return 1;
+ if (c == 0xb4) return 1;
+ if (c == 0xbc) return 1;
+ if (c == 0xbe) return 1;
+ if (c >= 0xc0 && c <= 0xde) return 1;
+ break;
+
+ case KOI8_R:
+ if (c == 0xb3) return 1;
+ /* fall */
+ case KOI8:
+ if (c >= 0xe0 && c <= 0xff) return 1;
+ break;
+
+ default:
+ exit(-1);
+ }
+
+ return 0;
+}
+
+static int IsXDigit(int enc, int c)
+{
+ if (enc == ASCII)
+ return isxdigit(c);
+
+ if (c >= 0x30 && c <= 0x39) return 1;
+ if (c >= 0x41 && c <= 0x46) return 1;
+ if (c >= 0x61 && c <= 0x66) return 1;
+ return 0;
+}
+
+static int IsWord(int enc, int c)
+{
+ if (enc == ASCII) {
+ return (isalpha(c) || isdigit(c) || c == 0x5f);
+ }
+
+ if (c >= 0x30 && c <= 0x39) return 1;
+ if (c >= 0x41 && c <= 0x5a) return 1;
+ if (c == 0x5f) return 1;
+ if (c >= 0x61 && c <= 0x7a) return 1;
+
+ switch (enc) {
+ case UNICODE_ISO_8859_1:
+ case ISO_8859_1:
+ case ISO_8859_9:
+ if (c == 0xaa) return 1;
+ if (c >= 0xb2 && c <= 0xb3) return 1;
+ if (c == 0xb5) return 1;
+ if (c >= 0xb9 && c <= 0xba) return 1;
+ if (c >= 0xbc && c <= 0xbe) return 1;
+ if (c >= 0xc0 && c <= 0xd6) return 1;
+ if (c >= 0xd8 && c <= 0xf6) return 1;
+ if (c >= 0xf8 && c <= 0xff) return 1;
+ break;
+
+ case ISO_8859_2:
+ if (c == 0xa1 || c == 0xa3) return 1;
+ if (c == 0xa5 || c == 0xa6) return 1;
+ if (c >= 0xa9 && c <= 0xac) return 1;
+ if (c >= 0xae && c <= 0xaf) return 1;
+ if (c == 0xb1 || c == 0xb3) return 1;
+ if (c == 0xb5 || c == 0xb6) return 1;
+ if (c >= 0xb9 && c <= 0xbc) return 1;
+ if (c >= 0xbe && c <= 0xbf) return 1;
+ if (c >= 0xc0 && c <= 0xd6) return 1;
+ if (c >= 0xd8 && c <= 0xf6) return 1;
+ if (c >= 0xf8 && c <= 0xfe) return 1;
+ break;
+
+ case ISO_8859_3:
+ if (c == 0xa1) return 1;
+ if (c == 0xa6) return 1;
+ if (c >= 0xa9 && c <= 0xac) return 1;
+ if (c == 0xaf) return 1;
+ if (c >= 0xb1 && c <= 0xb3) return 1;
+ if (c == 0xb5 || c == 0xb6) return 1;
+ if (c >= 0xb9 && c <= 0xbd) return 1;
+ if (c == 0xbf) return 1;
+ if (c >= 0xc0 && c <= 0xc2) return 1;
+ if (c >= 0xc4 && c <= 0xcf) return 1;
+ if (c >= 0xd1 && c <= 0xd6) return 1;
+ if (c >= 0xd8 && c <= 0xe2) return 1;
+ if (c >= 0xe4 && c <= 0xef) return 1;
+ if (c >= 0xf1 && c <= 0xf6) return 1;
+ if (c >= 0xf8 && c <= 0xfe) return 1;
+ break;
+
+ case ISO_8859_4:
+ if (c >= 0xa1 && c <= 0xa3) return 1;
+ if (c == 0xa5 || c == 0xa6) return 1;
+ if (c >= 0xa9 && c <= 0xac) return 1;
+ if (c == 0xae) return 1;
+ if (c == 0xb1 || c == 0xb3) return 1;
+ if (c == 0xb5 || c == 0xb6) return 1;
+ if (c >= 0xb9 && c <= 0xbf) return 1;
+ if (c >= 0xc0 && c <= 0xd6) return 1;
+ if (c >= 0xd8 && c <= 0xf6) return 1;
+ if (c >= 0xf8 && c <= 0xfe) return 1;
+ break;
+
+ case ISO_8859_5:
+ if (c >= 0xa1 && c <= 0xcf && c != 0xad) return 1;
+ if (c >= 0xd0 && c <= 0xff && c != 0xf0 && c != 0xfd) return 1;
+ break;
+
+ case ISO_8859_6:
+ if (c >= 0xc1 && c <= 0xda) return 1;
+ if (c >= 0xe0 && c <= 0xea) return 1;
+ if (c >= 0xeb && c <= 0xf2) return 1;
+ break;
+
+ case ISO_8859_7:
+ if (c == 0xb2 || c == 0xb3) return 1;
+ if (c == 0xb6) return 1;
+ if (c >= 0xb8 && c <= 0xba) return 1;
+ if (c >= 0xbc && c <= 0xbf) return 1;
+ if (c == 0xc0) return 1;
+ if (c >= 0xc1 && c <= 0xdb && c != 0xd2) return 1;
+ if (c >= 0xdc && c <= 0xfe) return 1;
+ break;
+
+ case ISO_8859_8:
+ if (c == 0xb2 || c == 0xb3 || c == 0xb5 || c == 0xb9) return 1;
+ if (c >= 0xbc && c <= 0xbe) return 1;
+ if (c >= 0xe0 && c <= 0xfa) return 1;
+ break;
+
+ case ISO_8859_10:
+ if (c >= 0xa1 && c <= 0xff) {
+ if (c != 0xa7 && c != 0xad && c != 0xb0 && c != 0xb7 && c != 0xbd)
+ return 1;
+ }
+ break;
+
+ case ISO_8859_11:
+ if (c >= 0xa1 && c <= 0xda) return 1;
+ if (c >= 0xdf && c <= 0xfb) return 1;
+ break;
+
+ case ISO_8859_13:
+ if (c == 0xa8) return 1;
+ if (c == 0xaa) return 1;
+ if (c == 0xaf) return 1;
+ if (c == 0xb2 || c == 0xb3 || c == 0xb5 || c == 0xb9) return 1;
+ if (c >= 0xbc && c <= 0xbe) return 1;
+ if (c == 0xb8) return 1;
+ if (c == 0xba) return 1;
+ if (c >= 0xbf && c <= 0xd6) return 1;
+ if (c >= 0xd8 && c <= 0xf6) return 1;
+ if (c >= 0xf8 && c <= 0xfe) return 1;
+ break;
+
+ case ISO_8859_14:
+ if (c >= 0xa1 && c <= 0xff) {
+ if (c == 0xa3 || c == 0xa7 || c == 0xa9 || c == 0xad || c == 0xae ||
+ c == 0xb6) return 0;
+ return 1;
+ }
+ break;
+
+ case ISO_8859_15:
+ if (c == 0xaa) return 1;
+ if (c >= 0xb2 && c <= 0xb3) return 1;
+ if (c == 0xb5) return 1;
+ if (c >= 0xb9 && c <= 0xba) return 1;
+ if (c >= 0xbc && c <= 0xbe) return 1;
+ if (c >= 0xc0 && c <= 0xd6) return 1;
+ if (c >= 0xd8 && c <= 0xf6) return 1;
+ if (c >= 0xf8 && c <= 0xff) return 1;
+ if (c == 0xa6) return 1;
+ if (c == 0xa8) return 1;
+ if (c == 0xb4) return 1;
+ if (c == 0xb8) return 1;
+ break;
+
+ case ISO_8859_16:
+ if (c == 0xa1) return 1;
+ if (c == 0xa2) return 1;
+ if (c == 0xa3) return 1;
+ if (c == 0xa6) return 1;
+ if (c == 0xa8) return 1;
+ if (c == 0xaa) return 1;
+ if (c == 0xac) return 1;
+ if (c == 0xae) return 1;
+ if (c == 0xaf) return 1;
+ if (c == 0xb2) return 1;
+ if (c == 0xb3) return 1;
+ if (c == 0xb4) return 1;
+ if (c >= 0xb8 && c <= 0xba) return 1;
+ if (c == 0xbc) return 1;
+ if (c == 0xbd) return 1;
+ if (c == 0xbe) return 1;
+ if (c == 0xbf) return 1;
+ if (c >= 0xc0 && c <= 0xde) return 1;
+ if (c >= 0xdf && c <= 0xff) return 1;
+ break;
+
+ case KOI8_R:
+ if (c == 0x9d) return 1;
+ if (c == 0xa3 || c == 0xb3) return 1;
+ /* fall */
+ case KOI8:
+ if (c >= 0xc0 && c <= 0xff) return 1;
+ break;
+
+ default:
+ exit(-1);
+ }
+
+ return 0;
+}
+
+static int IsAscii(int enc ARG_UNUSED, int c)
+{
+ if (c >= 0x00 && c <= 0x7f) return 1;
+ return 0;
+}
+
+static int IsNewline(int enc ARG_UNUSED, int c)
+{
+ if (c == 0x0a) return 1;
+ return 0;
+}
+
+static int exec(FILE* fp, ENC_INFO* einfo)
+{
+#define NCOL 8
+
+ int c, val, enc;
+
+ enc = einfo->num;
+
+ fprintf(fp, "static const unsigned short Enc%s_CtypeTable[256] = {\n",
+ einfo->name);
+
+ for (c = 0; c < 256; c++) {
+ val = 0;
+ if (IsNewline(enc, c)) val |= BIT_CTYPE_NEWLINE;
+ if (IsAlpha (enc, c)) val |= (BIT_CTYPE_ALPHA | BIT_CTYPE_ALNUM);
+ if (IsBlank (enc, c)) val |= BIT_CTYPE_BLANK;
+ if (IsCntrl (enc, c)) val |= BIT_CTYPE_CNTRL;
+ if (IsDigit (enc, c)) val |= (BIT_CTYPE_DIGIT | BIT_CTYPE_ALNUM);
+ if (IsGraph (enc, c)) val |= BIT_CTYPE_GRAPH;
+ if (IsLower (enc, c)) val |= BIT_CTYPE_LOWER;
+ if (IsPrint (enc, c)) val |= BIT_CTYPE_PRINT;
+ if (IsPunct (enc, c)) val |= BIT_CTYPE_PUNCT;
+ if (IsSpace (enc, c)) val |= BIT_CTYPE_SPACE;
+ if (IsUpper (enc, c)) val |= BIT_CTYPE_UPPER;
+ if (IsXDigit(enc, c)) val |= BIT_CTYPE_XDIGIT;
+ if (IsWord (enc, c)) val |= BIT_CTYPE_WORD;
+ if (IsAscii (enc, c)) val |= BIT_CTYPE_ASCII;
+
+ if (c % NCOL == 0) fputs(" ", fp);
+ fprintf(fp, "0x%04x", val);
+ if (c != 255) fputs(",", fp);
+ if (c != 0 && c % NCOL == (NCOL-1))
+ fputs("\n", fp);
+ else
+ fputs(" ", fp);
+ }
+ fprintf(fp, "};\n");
+ return 0;
+}
+
+extern int main(int argc ARG_UNUSED, char* argv[] ARG_UNUSED)
+{
+ int i;
+ FILE* fp = stdout;
+
+ setlocale(LC_ALL, "C");
+ /* setlocale(LC_ALL, "POSIX"); */
+ /* setlocale(LC_ALL, "en_GB.iso88591"); */
+ /* setlocale(LC_ALL, "de_BE.iso88591"); */
+ /* setlocale(LC_ALL, "fr_FR.iso88591"); */
+
+ for (i = 0; i < (int )(sizeof(Info)/sizeof(ENC_INFO)); i++) {
+ exec(fp, &Info[i]);
+ }
+
+ return 0;
+}
diff --git a/enc/shift_jis.c b/enc/shift_jis.c
index 9dcacb584d..5f5a802874 100644
--- a/enc/shift_jis.c
+++ b/enc/shift_jis.c
@@ -1,8 +1,9 @@
/**********************************************************************
- sjis.c - Oniguruma (regular expression library)
+ sjis.c - Onigmo (Oniguruma-mod) (regular expression library)
**********************************************************************/
/*-
* Copyright (c) 2002-2008 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
+ * Copyright (c) 2011 K.Takata <kentkt AT csc DOT jp>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -67,6 +68,97 @@ static const char SJIS_CAN_BE_TRAIL_TABLE[256] = {
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0
};
+static const OnigPairCaseFoldCodes CaseFoldMap[] = {
+ /* Fullwidth Alphabet */
+ { 0x8260, 0x8281 },
+ { 0x8261, 0x8282 },
+ { 0x8262, 0x8283 },
+ { 0x8263, 0x8284 },
+ { 0x8264, 0x8285 },
+ { 0x8265, 0x8286 },
+ { 0x8266, 0x8287 },
+ { 0x8267, 0x8288 },
+ { 0x8268, 0x8289 },
+ { 0x8269, 0x828a },
+ { 0x826a, 0x828b },
+ { 0x826b, 0x828c },
+ { 0x826c, 0x828d },
+ { 0x826d, 0x828e },
+ { 0x826e, 0x828f },
+ { 0x826f, 0x8290 },
+ { 0x8270, 0x8291 },
+ { 0x8271, 0x8292 },
+ { 0x8272, 0x8293 },
+ { 0x8273, 0x8294 },
+ { 0x8274, 0x8295 },
+ { 0x8275, 0x8296 },
+ { 0x8276, 0x8297 },
+ { 0x8277, 0x8298 },
+ { 0x8278, 0x8299 },
+ { 0x8279, 0x829a },
+
+ /* Greek */
+ { 0x839f, 0x83bf },
+ { 0x83a0, 0x83c0 },
+ { 0x83a1, 0x83c1 },
+ { 0x83a2, 0x83c2 },
+ { 0x83a3, 0x83c3 },
+ { 0x83a4, 0x83c4 },
+ { 0x83a5, 0x83c5 },
+ { 0x83a6, 0x83c6 },
+ { 0x83a7, 0x83c7 },
+ { 0x83a8, 0x83c8 },
+ { 0x83a9, 0x83c9 },
+ { 0x83aa, 0x83ca },
+ { 0x83ab, 0x83cb },
+ { 0x83ac, 0x83cc },
+ { 0x83ad, 0x83cd },
+ { 0x83ae, 0x83ce },
+ { 0x83af, 0x83cf },
+ { 0x83b0, 0x83d0 },
+ { 0x83b1, 0x83d1 },
+ { 0x83b2, 0x83d2 },
+ { 0x83b3, 0x83d3 },
+ { 0x83b4, 0x83d4 },
+ { 0x83b5, 0x83d5 },
+ { 0x83b6, 0x83d6 },
+
+ /* Cyrillic */
+ { 0x8440, 0x8470 },
+ { 0x8441, 0x8471 },
+ { 0x8442, 0x8472 },
+ { 0x8443, 0x8473 },
+ { 0x8444, 0x8474 },
+ { 0x8445, 0x8475 },
+ { 0x8446, 0x8476 },
+ { 0x8447, 0x8477 },
+ { 0x8448, 0x8478 },
+ { 0x8449, 0x8479 },
+ { 0x844a, 0x847a },
+ { 0x844b, 0x847b },
+ { 0x844c, 0x847c },
+ { 0x844d, 0x847d },
+ { 0x844e, 0x847e },
+ { 0x844f, 0x8480 },
+ { 0x8450, 0x8481 },
+ { 0x8451, 0x8482 },
+ { 0x8452, 0x8483 },
+ { 0x8453, 0x8484 },
+ { 0x8454, 0x8485 },
+ { 0x8455, 0x8486 },
+ { 0x8456, 0x8487 },
+ { 0x8457, 0x8488 },
+ { 0x8458, 0x8489 },
+ { 0x8459, 0x848a },
+ { 0x845a, 0x848b },
+ { 0x845b, 0x848c },
+ { 0x845c, 0x848d },
+ { 0x845d, 0x848e },
+ { 0x845e, 0x848f },
+ { 0x845f, 0x8490 },
+ { 0x8460, 0x8491 },
+};
+
#define SJIS_ISMB_FIRST(byte) (EncLen_SJIS[byte] > 1)
#define SJIS_ISMB_TRAIL(byte) SJIS_CAN_BE_TRAIL_TABLE[(byte)]
@@ -138,6 +230,9 @@ code_to_mbclen(OnigCodePoint code, OnigEncoding enc ARG_UNUSED)
return ONIGERR_INVALID_CODE_POINT_VALUE;
}
else if (code <= 0xffff) {
+ int low = code & 0xff;
+ if (! SJIS_ISMB_TRAIL(low))
+ return ONIGERR_INVALID_CODE_POINT_VALUE;
return 2;
}
else
@@ -150,7 +245,7 @@ mbc_to_code(const UChar* p, const UChar* end, OnigEncoding enc)
int c, i, len;
OnigCodePoint n;
- len = enclen(enc, p, end);
+ len = mbc_enc_len(p, end, enc);
c = *p++;
n = c;
if (len == 1) return n;
@@ -172,10 +267,90 @@ code_to_mbc(OnigCodePoint code, UChar *buf, OnigEncoding enc)
*p++ = (UChar )(code & 0xff);
#if 0
- if (enclen(enc, buf) != (p - buf))
+ if (mbc_enc_len(buf, p, enc) != (p - buf))
return REGERR_INVALID_CODE_POINT_VALUE;
#endif
- return (int)(p - buf);
+ return (int )(p - buf);
+}
+
+static int
+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,
+ flag, f, arg);
+}
+
+static OnigCodePoint
+get_lower_case(OnigCodePoint code)
+{
+ if (ONIGENC_IS_IN_RANGE(code, 0x8260, 0x8279)) {
+ /* Fullwidth Alphabet */
+ return (OnigCodePoint )(code + 0x0021);
+ }
+ else if (ONIGENC_IS_IN_RANGE(code, 0x839f, 0x83b6)) {
+ /* Greek */
+ return (OnigCodePoint )(code + 0x0020);
+ }
+ else if (ONIGENC_IS_IN_RANGE(code, 0x8440, 0x8460)) {
+ /* Cyrillic */
+ int d = (code >= 0x844f) ? 1 : 0;
+ return (OnigCodePoint )(code + (0x0030 + d));
+ }
+ return code;
+}
+
+static OnigCodePoint
+get_upper_case(OnigCodePoint code)
+{
+ if (ONIGENC_IS_IN_RANGE(code, 0x8281, 0x829a)) {
+ /* Fullwidth Alphabet */
+ return (OnigCodePoint )(code - 0x0021);
+ }
+ else if (ONIGENC_IS_IN_RANGE(code, 0x83bf, 0x83d6)) {
+ /* Greek */
+ return (OnigCodePoint )(code - 0x0020);
+ }
+ else if (ONIGENC_IS_IN_RANGE(code, 0x8470, 0x847e) ||
+ ONIGENC_IS_IN_RANGE(code, 0x8480, 0x8491)) {
+ /* Cyrillic */
+ int d = (code >= 0x8480) ? 1 : 0;
+ return (OnigCodePoint )(code - (0x0030 - d));
+ }
+ return code;
+}
+
+static int
+get_case_fold_codes_by_str(OnigCaseFoldType flag,
+ const OnigUChar* p, const OnigUChar* end,
+ OnigCaseFoldCodeItem items[], OnigEncoding enc)
+{
+ int len;
+ OnigCodePoint code, code_lo, code_up;
+
+ code = mbc_to_code(p, end, enc);
+ if (ONIGENC_IS_ASCII_CODE(code))
+ return onigenc_ascii_get_case_fold_codes_by_str(flag, p, end, items, enc);
+
+ len = mbc_enc_len(p, end, enc);
+ code_lo = get_lower_case(code);
+ code_up = get_upper_case(code);
+
+ if (code != code_lo) {
+ items[0].byte_len = len;
+ items[0].code_len = 1;
+ items[0].code[0] = code_lo;
+ return 1;
+ }
+ else if (code != code_up) {
+ items[0].byte_len = len;
+ items[0].code_len = 1;
+ items[0].code[0] = code_up;
+ return 1;
+ }
+
+ return 0;
}
static int
@@ -191,12 +366,11 @@ mbc_case_fold(OnigCaseFoldType flag,
return 1;
}
else {
- int i;
- int len = enclen(enc, p, end);
+ OnigCodePoint code;
+ int len;
- for (i = 0; i < len; i++) {
- *lower++ = *p++;
- }
+ code = get_lower_case(mbc_to_code(p, end, enc));
+ len = code_to_mbc(code, lower, enc);
(*pp) += len;
return len; /* return byte length of converted char to lower */
}
@@ -245,7 +419,7 @@ left_adjust_char_head(const UChar* start, const UChar* s, const UChar* end, Onig
}
}
}
- len = enclen(enc, p, end);
+ len = mbc_enc_len(p, end, enc);
if (p + len > s) return (UChar* )p;
p += len;
return (UChar* )(p + ((s - p) & ~1));
@@ -278,6 +452,47 @@ static const OnigCodePoint CR_Katakana[] = {
0x8380, 0x8396,
}; /* CR_Katakana */
+#ifdef ENC_CP932
+static const OnigCodePoint CR_Han[] = {
+ 6,
+ 0x8157, 0x8157,
+ 0x889f, 0x9872, /* Kanji level 1 */
+ 0x989f, 0x9ffc, /* Kanji level 2 */
+ 0xe040, 0xeaa4, /* Kanji level 2 */
+ 0xed40, 0xeeec, /* NEC-selected IBM extended characters (without symbols) */
+ 0xfa5c, 0xfc4b, /* IBM extended characters (without symbols) */
+}; /* CR_Han */
+#else
+static const OnigCodePoint CR_Han[] = {
+ 4,
+ 0x8157, 0x8157,
+ 0x889f, 0x9872, /* Kanji level 1 */
+ 0x989f, 0x9ffc, /* Kanji level 2 */
+ 0xe040, 0xeaa4, /* Kanji level 2 */
+}; /* CR_Han */
+#endif
+
+static const OnigCodePoint CR_Latin[] = {
+ 4,
+ 0x0041, 0x005a,
+ 0x0061, 0x007a,
+ 0x8260, 0x8279,
+ 0x8281, 0x829a,
+}; /* CR_Latin */
+
+static const OnigCodePoint CR_Greek[] = {
+ 2,
+ 0x839f, 0x83b6,
+ 0x83bf, 0x83d6,
+}; /* CR_Greek */
+
+static const OnigCodePoint CR_Cyrillic[] = {
+ 3,
+ 0x8440, 0x8460,
+ 0x8470, 0x847f,
+ 0x8480, 0x8491,
+}; /* CR_Cyrillic */
+
static int
init_property_list(void)
{
@@ -285,6 +500,10 @@ init_property_list(void)
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:
@@ -308,7 +527,7 @@ property_name_to_ctype(OnigEncoding enc, UChar* p, UChar* end)
return onigenc_minimum_property_name_to_ctype(enc, s, e);
}
- return (int)ctype;
+ return (int )ctype;
}
static int
@@ -357,6 +576,7 @@ get_ctype_code_range(OnigCtype ctype, OnigCodePoint* sb_out,
}
}
+#ifndef ENC_CP932
OnigEncodingDefine(shift_jis, Shift_JIS) = {
mbc_enc_len,
"Shift_JIS", /* name */
@@ -367,14 +587,15 @@ OnigEncodingDefine(shift_jis, Shift_JIS) = {
code_to_mbclen,
code_to_mbc,
mbc_case_fold,
- onigenc_ascii_apply_all_case_fold,
- onigenc_ascii_get_case_fold_codes_by_str,
+ apply_all_case_fold,
+ get_case_fold_codes_by_str,
property_name_to_ctype,
is_code_ctype,
get_ctype_code_range,
left_adjust_char_head,
is_allowed_reverse_match,
- 0
+ 0,
+ ONIGENC_FLAG_NONE,
};
/*
* Name: Shift_JIS
@@ -384,38 +605,10 @@ OnigEncodingDefine(shift_jis, Shift_JIS) = {
*/
/*
- * Name: Windows-31J
- * MIBenum: 2024
- * Link: http://www.iana.org/assignments/character-sets
- * Link: http://www.microsoft.com/globaldev/reference/dbcs/932.mspx
- * Link: http://ja.wikipedia.org/wiki/Windows-31J
- * Link: http://source.icu-project.org/repos/icu/data/trunk/charset/data/ucm/windows-932-2000.ucm
- *
- * Windows Standard Character Set and its mapping to Unicode by Microsoft.
- * Since 1.9.3, SJIS is the alias of Windows-31J because its character
- * set is usually this one even if its mapping may differ.
- */
-ENC_REPLICATE("Windows-31J", "Shift_JIS")
-ENC_ALIAS("CP932", "Windows-31J")
-ENC_ALIAS("csWindows31J", "Windows-31J") /* IANA. IE6 don't accept Windows-31J but csWindows31J. */
-ENC_ALIAS("SJIS", "Windows-31J")
-
-/*
- * Name: PCK
- * Link: http://download.oracle.com/docs/cd/E19253-01/819-0606/x-2chn0/index.html
- * Link: http://download.oracle.com/docs/cd/E19253-01/819-0606/appb-pckwarn-1/index.html
- *
- * Solaris's SJIS variant. Its set is Windows Standard Character Set; it
- * consists JIS X 0201 Latin (US-ASCII), JIS X 0201 Katakana, JIS X 0208, NEC
- * special characters, NEC-selected IBM extended characters, and IBM extended
- * characters. Solaris's iconv seems to use SJIS-open.
- */
-ENC_ALIAS("PCK", "Windows-31J")
-
-/*
* Name: MacJapanese
* Link: http://unicode.org/Public/MAPPINGS/VENDORS/APPLE/JAPANESE.TXT
* Link: http://ja.wikipedia.org/wiki/MacJapanese
*/
ENC_REPLICATE("MacJapanese", "Shift_JIS")
ENC_ALIAS("MacJapan", "MacJapanese")
+#endif
diff --git a/enc/trans/JIS/JISX0213-1%UCS@BMP.src b/enc/trans/JIS/JISX0213-1%UCS@BMP.src
new file mode 100644
index 0000000000..09377be66b
--- /dev/null
+++ b/enc/trans/JIS/JISX0213-1%UCS@BMP.src
@@ -0,0 +1,1926 @@
+# $NetBSD: JISX0213-1%UCS@BMP.src,v 1.1 2007/03/05 16:58:33 tnozaki Exp $
+
+TYPE ROWCOL
+NAME "JISX0213-1/UCS:BMP"
+SRC_ZONE 0x21-0x7E / 0x21-0x7E / 8
+OOB_MODE INVALID
+DST_INVALID 0xFFFE
+DST_UNIT_BITS 16
+
+BEGIN_MAP
+## JIS X 0213:2004 vs Unicode mapping table
+##
+## Date: 22 May 2006
+## License:
+## Copyright (C) 2001 earthian@tama.or.jp, All Rights Reserved.
+## Copyright (C) 2001 I'O, All Rights Reserved.
+## Copyright (C) 2006 Project X0213, All Rights Reserved.
+## You can use, modify, distribute this table freely.
+## Note:
+## 3-XXXX JIS X 0213:2004 plane 1 (GL encoding)
+## 4-XXXX JIS X 0213:2000 plane 2 (GL encoding)
+## [1983] JIS codepoint defined by JIS X 0208-1983
+## [1990] JIS codepoint defined by JIS X 0208-1990
+## [2000] JIS codepoint defined by JIS X 0213:2000
+## [2004] JIS codepoint defined by JIS X 0213:2004
+## [Unicode3.1] UCS codepoint defined by Unicode 3.1
+## [Unicode3.2] UCS codepoint defined by Unicode 3.2
+## Fullwidth UCS fullwidth form (U+Fxxx)
+## Windows Windows (CP932) mapping
+## Some 0213 character can't represent by one UCS character.
+## In this table, such characters are described as 'U+xxxx+xxxx'.
+##
+## JIS Unicode Name Note
+0x222F = 0xFF07 # 0x0027
+0x2230 = 0xFF02 # 0x0022
+0x2231 = 0xFF0D # 0x002D
+0x2232 = 0xFF5E # 0x007E
+0x2233 = 0x3033
+0x2234 = 0x3034
+0x2235 = 0x3035
+0x2236 = 0x303B
+0x2237 = 0x303C
+0x2238 = 0x30FF
+0x2239 = 0x309F
+0x2242 = 0x2284
+0x2243 = 0x2285
+0x2244 = 0x228A
+0x2245 = 0x228B
+0x2246 = 0x2209
+0x2247 = 0x2205
+0x2248 = 0x2305
+0x2249 = 0x2306
+0x2251 = 0x2295
+0x2252 = 0x2296
+0x2253 = 0x2297
+0x2254 = 0x2225
+0x2255 = 0x2226
+0x2256 = 0xFF5F
+0x2257 = 0xFF60
+0x2258 = 0x3018
+0x2259 = 0x3019
+0x225A = 0x3016
+0x225B = 0x3017
+0x226B = 0x2262
+0x226C = 0x2243
+0x226D = 0x2245
+0x226E = 0x2248
+0x226F = 0x2276
+0x2270 = 0x2277
+0x2271 = 0x2194
+0x227A = 0x266E
+0x227B = 0x266B
+0x227C = 0x266C
+0x227D = 0x2669
+0x2321 = 0x25B7
+0x2322 = 0x25B6
+0x2323 = 0x25C1
+0x2324 = 0x25C0
+0x2325 = 0x2197
+0x2326 = 0x2198
+0x2327 = 0x2196
+0x2328 = 0x2199
+0x2329 = 0x21C4
+0x232A = 0x21E8
+0x232B = 0x21E6
+0x232C = 0x21E7
+0x232D = 0x21E9
+0x232E = 0x2934
+0x232F = 0x2935
+0x233A = 0x29BF
+0x233B = 0x25C9
+0x233C = 0x303D
+0x233D = 0xFE46
+0x233E = 0xFE45
+0x233F = 0x25E6
+0x2340 = 0x2022
+0x235B = 0x2213
+0x235C = 0x2135
+0x235D = 0x210F
+0x235E = 0x33CB
+0x235F = 0x2113
+0x2360 = 0x2127
+0x237B = 0x30A0
+0x237C = 0x2013
+0x237D = 0x29FA
+0x237E = 0x29FB
+0x2474 = 0x3094
+0x2475 = 0x3095
+0x2476 = 0x3096
+#0x2477 = 0x304B + 0x309A
+#0x2478 = 0x304D + 0x309A
+#0x2479 = 0x304F + 0x309A
+#0x247A = 0x3051 + 0x309A
+#0x247B = 0x3053 + 0x309A
+#0x2577 = 0x30AB + 0x309A
+#0x2578 = 0x30AD + 0x309A
+#0x2579 = 0x30AF + 0x309A
+#0x257A = 0x30B1 + 0x309A
+#0x257B = 0x30B3 + 0x309A
+#0x257C = 0x30BB + 0x309A
+#0x257D = 0x30C4 + 0x309A
+#0x257E = 0x30C8 + 0x309A
+0x2639 = 0x2664
+0x263A = 0x2660
+0x263B = 0x2662
+0x263C = 0x2666
+0x263D = 0x2661
+0x263E = 0x2665
+0x263F = 0x2667
+0x2640 = 0x2663
+0x2659 = 0x03C2
+0x265A = 0x24F5
+0x265B = 0x24F6
+0x265C = 0x24F7
+0x265D = 0x24F8
+0x265E = 0x24F9
+0x265F = 0x24FA
+0x2660 = 0x24FB
+0x2661 = 0x24FC
+0x2662 = 0x24FD
+0x2663 = 0x24FE
+0x2664 = 0x2616
+0x2665 = 0x2617
+0x2666 = 0x3020
+0x2667 = 0x260E
+0x2668 = 0x2600
+0x2669 = 0x2601
+0x266A = 0x2602
+0x266B = 0x2603
+0x266C = 0x2668
+0x266D = 0x25B1
+0x266E = 0x31F0
+0x266F = 0x31F1
+0x2670 = 0x31F2
+0x2671 = 0x31F3
+0x2672 = 0x31F4
+0x2673 = 0x31F5
+0x2674 = 0x31F6
+0x2675 = 0x31F7
+0x2676 = 0x31F8
+0x2677 = 0x31F9
+#0x2678 = 0x31F7 + 0x309A
+0x2679 = 0x31FA
+0x267A = 0x31FB
+0x267B = 0x31FC
+0x267C = 0x31FD
+0x267D = 0x31FE
+0x267E = 0x31FF
+0x2742 = 0x23BE
+0x2743 = 0x23BF
+0x2744 = 0x23C0
+0x2745 = 0x23C1
+0x2746 = 0x23C2
+0x2747 = 0x23C3
+0x2748 = 0x23C4
+0x2749 = 0x23C5
+0x274A = 0x23C6
+0x274B = 0x23C7
+0x274C = 0x23C8
+0x274D = 0x23C9
+0x274E = 0x23CA
+0x274F = 0x23CB
+0x2750 = 0x23CC
+0x2772 = 0x30F7
+0x2773 = 0x30F8
+0x2774 = 0x30F9
+0x2775 = 0x30FA
+0x2776 = 0x22DA
+0x2777 = 0x22DB
+0x2778 = 0x2153
+0x2779 = 0x2154
+0x277A = 0x2155
+0x277B = 0x2713
+0x277C = 0x2318
+0x277D = 0x2423
+0x277E = 0x23CE
+0x2841 = 0x3251
+0x2842 = 0x3252
+0x2843 = 0x3253
+0x2844 = 0x3254
+0x2845 = 0x3255
+0x2846 = 0x3256
+0x2847 = 0x3257
+0x2848 = 0x3258
+0x2849 = 0x3259
+0x284A = 0x325A
+0x284B = 0x325B
+0x284C = 0x325C
+0x284D = 0x325D
+0x284E = 0x325E
+0x284F = 0x325F
+0x2850 = 0x32B1
+0x2851 = 0x32B2
+0x2852 = 0x32B3
+0x2853 = 0x32B4
+0x2854 = 0x32B5
+0x2855 = 0x32B6
+0x2856 = 0x32B7
+0x2857 = 0x32B8
+0x2858 = 0x32B9
+0x2859 = 0x32BA
+0x285A = 0x32BB
+0x285B = 0x32BC
+0x285C = 0x32BD
+0x285D = 0x32BE
+0x285E = 0x32BF
+0x2867 = 0x25D0
+0x2868 = 0x25D1
+0x2869 = 0x25D2
+0x286A = 0x25D3
+0x286B = 0x203C
+0x286C = 0x2047
+0x286D = 0x2048
+0x286E = 0x2049
+0x286F = 0x01CD
+0x2870 = 0x01CE
+0x2871 = 0x01D0
+0x2872 = 0x1E3E
+0x2873 = 0x1E3F
+0x2874 = 0x01F8
+0x2875 = 0x01F9
+0x2876 = 0x01D1
+0x2877 = 0x01D2
+0x2878 = 0x01D4
+0x2879 = 0x01D6
+0x287A = 0x01D8
+0x287B = 0x01DA
+0x287C = 0x01DC
+0x2921 = 0x20AC
+0x2922 = 0x00A0
+0x2923 = 0x00A1
+0x2924 = 0x00A4
+0x2925 = 0x00A6
+0x2926 = 0x00A9
+0x2927 = 0x00AA
+0x2928 = 0x00AB
+0x2929 = 0x00AD
+0x292A = 0x00AE
+0x292B = 0x00AF
+0x292C = 0x00B2
+0x292D = 0x00B3
+0x292E = 0x00B7
+0x292F = 0x00B8
+0x2930 = 0x00B9
+0x2931 = 0x00BA
+0x2932 = 0x00BB
+0x2933 = 0x00BC
+0x2934 = 0x00BD
+0x2935 = 0x00BE
+0x2936 = 0x00BF
+0x2937 = 0x00C0
+0x2938 = 0x00C1
+0x2939 = 0x00C2
+0x293A = 0x00C3
+0x293B = 0x00C4
+0x293C = 0x00C5
+0x293D = 0x00C6
+0x293E = 0x00C7
+0x293F = 0x00C8
+0x2940 = 0x00C9
+0x2941 = 0x00CA
+0x2942 = 0x00CB
+0x2943 = 0x00CC
+0x2944 = 0x00CD
+0x2945 = 0x00CE
+0x2946 = 0x00CF
+0x2947 = 0x00D0
+0x2948 = 0x00D1
+0x2949 = 0x00D2
+0x294A = 0x00D3
+0x294B = 0x00D4
+0x294C = 0x00D5
+0x294D = 0x00D6
+0x294E = 0x00D8
+0x294F = 0x00D9
+0x2950 = 0x00DA
+0x2951 = 0x00DB
+0x2952 = 0x00DC
+0x2953 = 0x00DD
+0x2954 = 0x00DE
+0x2955 = 0x00DF
+0x2956 = 0x00E0
+0x2957 = 0x00E1
+0x2958 = 0x00E2
+0x2959 = 0x00E3
+0x295A = 0x00E4
+0x295B = 0x00E5
+0x295C = 0x00E6
+0x295D = 0x00E7
+0x295E = 0x00E8
+0x295F = 0x00E9
+0x2960 = 0x00EA
+0x2961 = 0x00EB
+0x2962 = 0x00EC
+0x2963 = 0x00ED
+0x2964 = 0x00EE
+0x2965 = 0x00EF
+0x2966 = 0x00F0
+0x2967 = 0x00F1
+0x2968 = 0x00F2
+0x2969 = 0x00F3
+0x296A = 0x00F4
+0x296B = 0x00F5
+0x296C = 0x00F6
+0x296D = 0x00F8
+0x296E = 0x00F9
+0x296F = 0x00FA
+0x2970 = 0x00FB
+0x2971 = 0x00FC
+0x2972 = 0x00FD
+0x2973 = 0x00FE
+0x2974 = 0x00FF
+0x2975 = 0x0100
+0x2976 = 0x012A
+0x2977 = 0x016A
+0x2978 = 0x0112
+0x2979 = 0x014C
+0x297A = 0x0101
+0x297B = 0x012B
+0x297C = 0x016B
+0x297D = 0x0113
+0x297E = 0x014D
+0x2A21 = 0x0104
+0x2A22 = 0x02D8
+0x2A23 = 0x0141
+0x2A24 = 0x013D
+0x2A25 = 0x015A
+0x2A26 = 0x0160
+0x2A27 = 0x015E
+0x2A28 = 0x0164
+0x2A29 = 0x0179
+0x2A2A = 0x017D
+0x2A2B = 0x017B
+0x2A2C = 0x0105
+0x2A2D = 0x02DB
+0x2A2E = 0x0142
+0x2A2F = 0x013E
+0x2A30 = 0x015B
+0x2A31 = 0x02C7
+0x2A32 = 0x0161
+0x2A33 = 0x015F
+0x2A34 = 0x0165
+0x2A35 = 0x017A
+0x2A36 = 0x02DD
+0x2A37 = 0x017E
+0x2A38 = 0x017C
+0x2A39 = 0x0154
+0x2A3A = 0x0102
+0x2A3B = 0x0139
+0x2A3C = 0x0106
+0x2A3D = 0x010C
+0x2A3E = 0x0118
+0x2A3F = 0x011A
+0x2A40 = 0x010E
+0x2A41 = 0x0143
+0x2A42 = 0x0147
+0x2A43 = 0x0150
+0x2A44 = 0x0158
+0x2A45 = 0x016E
+0x2A46 = 0x0170
+0x2A47 = 0x0162
+0x2A48 = 0x0155
+0x2A49 = 0x0103
+0x2A4A = 0x013A
+0x2A4B = 0x0107
+0x2A4C = 0x010D
+0x2A4D = 0x0119
+0x2A4E = 0x011B
+0x2A4F = 0x010F
+0x2A50 = 0x0111
+0x2A51 = 0x0144
+0x2A52 = 0x0148
+0x2A53 = 0x0151
+0x2A54 = 0x0159
+0x2A55 = 0x016F
+0x2A56 = 0x0171
+0x2A57 = 0x0163
+0x2A58 = 0x02D9
+0x2A59 = 0x0108
+0x2A5A = 0x011C
+0x2A5B = 0x0124
+0x2A5C = 0x0134
+0x2A5D = 0x015C
+0x2A5E = 0x016C
+0x2A5F = 0x0109
+0x2A60 = 0x011D
+0x2A61 = 0x0125
+0x2A62 = 0x0135
+0x2A63 = 0x015D
+0x2A64 = 0x016D
+0x2A65 = 0x0271
+0x2A66 = 0x028B
+0x2A67 = 0x027E
+0x2A68 = 0x0283
+0x2A69 = 0x0292
+0x2A6A = 0x026C
+0x2A6B = 0x026E
+0x2A6C = 0x0279
+0x2A6D = 0x0288
+0x2A6E = 0x0256
+0x2A6F = 0x0273
+0x2A70 = 0x027D
+0x2A71 = 0x0282
+0x2A72 = 0x0290
+0x2A73 = 0x027B
+0x2A74 = 0x026D
+0x2A75 = 0x025F
+0x2A76 = 0x0272
+0x2A77 = 0x029D
+0x2A78 = 0x028E
+0x2A79 = 0x0261
+0x2A7A = 0x014B
+0x2A7B = 0x0270
+0x2A7C = 0x0281
+0x2A7D = 0x0127
+0x2A7E = 0x0295
+0x2B21 = 0x0294
+0x2B22 = 0x0266
+0x2B23 = 0x0298
+0x2B24 = 0x01C2
+0x2B25 = 0x0253
+0x2B26 = 0x0257
+0x2B27 = 0x0284
+0x2B28 = 0x0260
+0x2B29 = 0x0193
+0x2B2A = 0x0153
+0x2B2B = 0x0152
+0x2B2C = 0x0268
+0x2B2D = 0x0289
+0x2B2E = 0x0258
+0x2B2F = 0x0275
+0x2B30 = 0x0259
+0x2B31 = 0x025C
+0x2B32 = 0x025E
+0x2B33 = 0x0250
+0x2B34 = 0x026F
+0x2B35 = 0x028A
+0x2B36 = 0x0264
+0x2B37 = 0x028C
+0x2B38 = 0x0254
+0x2B39 = 0x0251
+0x2B3A = 0x0252
+0x2B3B = 0x028D
+0x2B3C = 0x0265
+0x2B3D = 0x02A2
+0x2B3E = 0x02A1
+0x2B3F = 0x0255
+0x2B40 = 0x0291
+0x2B41 = 0x027A
+0x2B42 = 0x0267
+0x2B43 = 0x025A
+#0x2B44 = 0x00E6 + 0x0300
+0x2B45 = 0x01FD
+0x2B46 = 0x1F70
+0x2B47 = 0x1F71
+#0x2B48 = 0x0254 + 0x0300
+#0x2B49 = 0x0254 + 0x0301
+#0x2B4A = 0x028C + 0x0300
+#0x2B4B = 0x028C + 0x0301
+#0x2B4C = 0x0259 + 0x0300
+#0x2B4D = 0x0259 + 0x0301
+#0x2B4E = 0x025A + 0x0300
+#0x2B4F = 0x025A + 0x0301
+0x2B50 = 0x1F72
+0x2B51 = 0x1F73
+0x2B52 = 0x0361
+0x2B53 = 0x02C8
+0x2B54 = 0x02CC
+0x2B55 = 0x02D0
+0x2B56 = 0x02D1
+0x2B57 = 0x0306
+0x2B58 = 0x203F
+0x2B59 = 0x030B
+0x2B5A = 0x0301
+0x2B5B = 0x0304
+0x2B5C = 0x0300
+0x2B5D = 0x030F
+0x2B5E = 0x030C
+0x2B5F = 0x0302
+0x2B60 = 0x02E5
+0x2B61 = 0x02E6
+0x2B62 = 0x02E7
+0x2B63 = 0x02E8
+0x2B64 = 0x02E9
+#0x2B65 = 0x02E9 + 0x02E5
+#0x2B66 = 0x02E5 + 0x02E9
+0x2B67 = 0x0325
+0x2B68 = 0x032C
+0x2B69 = 0x0339
+0x2B6A = 0x031C
+0x2B6B = 0x031F
+0x2B6C = 0x0320
+0x2B6D = 0x0308
+0x2B6E = 0x033D
+0x2B6F = 0x0329
+0x2B70 = 0x032F
+0x2B71 = 0x02DE
+0x2B72 = 0x0324
+0x2B73 = 0x0330
+0x2B74 = 0x033C
+0x2B75 = 0x0334
+0x2B76 = 0x031D
+0x2B77 = 0x031E
+0x2B78 = 0x0318
+0x2B79 = 0x0319
+0x2B7A = 0x032A
+0x2B7B = 0x033A
+0x2B7C = 0x033B
+0x2B7D = 0x0303
+0x2B7E = 0x031A
+0x2C21 = 0x2776
+0x2C22 = 0x2777
+0x2C23 = 0x2778
+0x2C24 = 0x2779
+0x2C25 = 0x277A
+0x2C26 = 0x277B
+0x2C27 = 0x277C
+0x2C28 = 0x277D
+0x2C29 = 0x277E
+0x2C2A = 0x277F
+0x2C2B = 0x24EB
+0x2C2C = 0x24EC
+0x2C2D = 0x24ED
+0x2C2E = 0x24EE
+0x2C2F = 0x24EF
+0x2C30 = 0x24F0
+0x2C31 = 0x24F1
+0x2C32 = 0x24F2
+0x2C33 = 0x24F3
+0x2C34 = 0x24F4
+0x2C35 = 0x2170
+0x2C36 = 0x2171
+0x2C37 = 0x2172
+0x2C38 = 0x2173
+0x2C39 = 0x2174
+0x2C3A = 0x2175
+0x2C3B = 0x2176
+0x2C3C = 0x2177
+0x2C3D = 0x2178
+0x2C3E = 0x2179
+0x2C3F = 0x217A
+0x2C40 = 0x217B
+0x2C41 = 0x24D0
+0x2C42 = 0x24D1
+0x2C43 = 0x24D2
+0x2C44 = 0x24D3
+0x2C45 = 0x24D4
+0x2C46 = 0x24D5
+0x2C47 = 0x24D6
+0x2C48 = 0x24D7
+0x2C49 = 0x24D8
+0x2C4A = 0x24D9
+0x2C4B = 0x24DA
+0x2C4C = 0x24DB
+0x2C4D = 0x24DC
+0x2C4E = 0x24DD
+0x2C4F = 0x24DE
+0x2C50 = 0x24DF
+0x2C51 = 0x24E0
+0x2C52 = 0x24E1
+0x2C53 = 0x24E2
+0x2C54 = 0x24E3
+0x2C55 = 0x24E4
+0x2C56 = 0x24E5
+0x2C57 = 0x24E6
+0x2C58 = 0x24E7
+0x2C59 = 0x24E8
+0x2C5A = 0x24E9
+0x2C5B = 0x32D0
+0x2C5C = 0x32D1
+0x2C5D = 0x32D2
+0x2C5E = 0x32D3
+0x2C5F = 0x32D4
+0x2C60 = 0x32D5
+0x2C61 = 0x32D6
+0x2C62 = 0x32D7
+0x2C63 = 0x32D8
+0x2C64 = 0x32D9
+0x2C65 = 0x32DA
+0x2C66 = 0x32DB
+0x2C67 = 0x32DC
+0x2C68 = 0x32DD
+0x2C69 = 0x32DE
+0x2C6A = 0x32DF
+0x2C6B = 0x32E0
+0x2C6C = 0x32E1
+0x2C6D = 0x32E2
+0x2C6E = 0x32E3
+0x2C6F = 0x32FA
+0x2C70 = 0x32E9
+0x2C71 = 0x32E5
+0x2C72 = 0x32ED
+0x2C73 = 0x32EC
+0x2C7D = 0x2051
+0x2C7E = 0x2042
+0x2D21 = 0x2460
+0x2D22 = 0x2461
+0x2D23 = 0x2462
+0x2D24 = 0x2463
+0x2D25 = 0x2464
+0x2D26 = 0x2465
+0x2D27 = 0x2466
+0x2D28 = 0x2467
+0x2D29 = 0x2468
+0x2D2A = 0x2469
+0x2D2B = 0x246A
+0x2D2C = 0x246B
+0x2D2D = 0x246C
+0x2D2E = 0x246D
+0x2D2F = 0x246E
+0x2D30 = 0x246F
+0x2D31 = 0x2470
+0x2D32 = 0x2471
+0x2D33 = 0x2472
+0x2D34 = 0x2473
+0x2D35 = 0x2160
+0x2D36 = 0x2161
+0x2D37 = 0x2162
+0x2D38 = 0x2163
+0x2D39 = 0x2164
+0x2D3A = 0x2165
+0x2D3B = 0x2166
+0x2D3C = 0x2167
+0x2D3D = 0x2168
+0x2D3E = 0x2169
+0x2D3F = 0x216A
+0x2D40 = 0x3349
+0x2D41 = 0x3314
+0x2D42 = 0x3322
+0x2D43 = 0x334D
+0x2D44 = 0x3318
+0x2D45 = 0x3327
+0x2D46 = 0x3303
+0x2D47 = 0x3336
+0x2D48 = 0x3351
+0x2D49 = 0x3357
+0x2D4A = 0x330D
+0x2D4B = 0x3326
+0x2D4C = 0x3323
+0x2D4D = 0x332B
+0x2D4E = 0x334A
+0x2D4F = 0x333B
+0x2D50 = 0x339C
+0x2D51 = 0x339D
+0x2D52 = 0x339E
+0x2D53 = 0x338E
+0x2D54 = 0x338F
+0x2D55 = 0x33C4
+0x2D56 = 0x33A1
+0x2D57 = 0x216B
+0x2D5F = 0x337B
+0x2D60 = 0x301D
+0x2D61 = 0x301F
+0x2D62 = 0x2116
+0x2D63 = 0x33CD
+0x2D64 = 0x2121
+0x2D65 = 0x32A4
+0x2D66 = 0x32A5
+0x2D67 = 0x32A6
+0x2D68 = 0x32A7
+0x2D69 = 0x32A8
+0x2D6A = 0x3231
+0x2D6B = 0x3232
+0x2D6C = 0x3239
+0x2D6D = 0x337E
+0x2D6E = 0x337D
+0x2D6F = 0x337C
+0x2D73 = 0x222E
+0x2D78 = 0x221F
+0x2D79 = 0x22BF
+0x2D7D = 0x2756
+0x2D7E = 0x261E
+0x2E21 = 0x4FF1
+0x2E23 = 0x3402
+0x2E24 = 0x4E28
+0x2E25 = 0x4E2F
+0x2E26 = 0x4E30
+0x2E27 = 0x4E8D
+0x2E28 = 0x4EE1
+0x2E29 = 0x4EFD
+0x2E2A = 0x4EFF
+0x2E2B = 0x4F03
+0x2E2C = 0x4F0B
+0x2E2D = 0x4F60
+0x2E2E = 0x4F48
+0x2E2F = 0x4F49
+0x2E30 = 0x4F56
+0x2E31 = 0x4F5F
+0x2E32 = 0x4F6A
+0x2E33 = 0x4F6C
+0x2E34 = 0x4F7E
+0x2E35 = 0x4F8A
+0x2E36 = 0x4F94
+0x2E37 = 0x4F97
+0x2E38 = 0xFA30
+0x2E39 = 0x4FC9
+0x2E3A = 0x4FE0
+0x2E3B = 0x5001
+0x2E3C = 0x5002
+0x2E3D = 0x500E
+0x2E3E = 0x5018
+0x2E3F = 0x5027
+0x2E40 = 0x502E
+0x2E41 = 0x5040
+0x2E42 = 0x503B
+0x2E43 = 0x5041
+0x2E44 = 0x5094
+0x2E45 = 0x50CC
+0x2E46 = 0x50F2
+0x2E47 = 0x50D0
+0x2E48 = 0x50E6
+0x2E49 = 0xFA31
+0x2E4A = 0x5106
+0x2E4B = 0x5103
+0x2E4C = 0x510B
+0x2E4D = 0x511E
+0x2E4E = 0x5135
+0x2E4F = 0x514A
+0x2E50 = 0xFA32
+0x2E51 = 0x5155
+0x2E52 = 0x5157
+0x2E53 = 0x34B5
+0x2E54 = 0x519D
+0x2E55 = 0x51C3
+0x2E56 = 0x51CA
+0x2E57 = 0x51DE
+0x2E58 = 0x51E2
+0x2E59 = 0x51EE
+0x2E5A = 0x5201
+0x2E5B = 0x34DB
+0x2E5C = 0x5213
+0x2E5D = 0x5215
+0x2E5E = 0x5249
+0x2E5F = 0x5257
+0x2E60 = 0x5261
+0x2E61 = 0x5293
+0x2E62 = 0x52C8
+0x2E63 = 0xFA33
+0x2E64 = 0x52CC
+0x2E65 = 0x52D0
+0x2E66 = 0x52D6
+0x2E67 = 0x52DB
+0x2E68 = 0xFA34
+0x2E69 = 0x52F0
+0x2E6A = 0x52FB
+0x2E6B = 0x5300
+0x2E6C = 0x5307
+0x2E6D = 0x531C
+0x2E6E = 0xFA35
+0x2E6F = 0x5361
+0x2E70 = 0x5363
+0x2E71 = 0x537D
+0x2E72 = 0x5393
+0x2E73 = 0x539D
+0x2E74 = 0x53B2
+0x2E75 = 0x5412
+0x2E76 = 0x5427
+0x2E77 = 0x544D
+0x2E78 = 0x549C
+0x2E79 = 0x546B
+0x2E7A = 0x5474
+0x2E7B = 0x547F
+0x2E7C = 0x5488
+0x2E7D = 0x5496
+0x2E7E = 0x54A1
+0x2F21 = 0x54A9
+0x2F22 = 0x54C6
+0x2F23 = 0x54FF
+0x2F24 = 0x550E
+0x2F25 = 0x552B
+0x2F26 = 0x5535
+0x2F27 = 0x5550
+0x2F28 = 0x555E
+0x2F29 = 0x5581
+0x2F2A = 0x5586
+0x2F2B = 0x558E
+0x2F2C = 0xFA36
+0x2F2D = 0x55AD
+0x2F2E = 0x55CE
+0x2F2F = 0xFA37
+0x2F30 = 0x5608
+0x2F31 = 0x560E
+0x2F32 = 0x563B
+0x2F33 = 0x5649
+0x2F34 = 0x5676
+0x2F35 = 0x5666
+0x2F36 = 0xFA38
+0x2F37 = 0x566F
+0x2F38 = 0x5671
+0x2F39 = 0x5672
+0x2F3A = 0x5699
+0x2F3B = 0x569E
+0x2F3C = 0x56A9
+0x2F3D = 0x56AC
+0x2F3E = 0x56B3
+0x2F3F = 0x56C9
+0x2F40 = 0x56CA
+0x2F41 = 0x570A
+0x2F43 = 0x5721
+0x2F44 = 0x572F
+0x2F45 = 0x5733
+0x2F46 = 0x5734
+0x2F47 = 0x5770
+0x2F48 = 0x5777
+0x2F49 = 0x577C
+0x2F4A = 0x579C
+0x2F4B = 0xFA0F
+0x2F4D = 0x57B8
+0x2F4E = 0x57C7
+0x2F4F = 0x57C8
+0x2F50 = 0x57CF
+0x2F51 = 0x57E4
+0x2F52 = 0x57ED
+0x2F53 = 0x57F5
+0x2F54 = 0x57F6
+0x2F55 = 0x57FF
+0x2F56 = 0x5809
+0x2F57 = 0xFA10
+0x2F58 = 0x5861
+0x2F59 = 0x5864
+0x2F5A = 0xFA39
+0x2F5B = 0x587C
+0x2F5C = 0x5889
+0x2F5D = 0x589E
+0x2F5E = 0xFA3A
+0x2F5F = 0x58A9
+0x2F61 = 0x58D2
+0x2F62 = 0x58CE
+0x2F63 = 0x58D4
+0x2F64 = 0x58DA
+0x2F65 = 0x58E0
+0x2F66 = 0x58E9
+0x2F67 = 0x590C
+0x2F68 = 0x8641
+0x2F69 = 0x595D
+0x2F6A = 0x596D
+0x2F6B = 0x598B
+0x2F6C = 0x5992
+0x2F6D = 0x59A4
+0x2F6E = 0x59C3
+0x2F6F = 0x59D2
+0x2F70 = 0x59DD
+0x2F71 = 0x5A13
+0x2F72 = 0x5A23
+0x2F73 = 0x5A67
+0x2F74 = 0x5A6D
+0x2F75 = 0x5A77
+0x2F76 = 0x5A7E
+0x2F77 = 0x5A84
+0x2F78 = 0x5A9E
+0x2F79 = 0x5AA7
+0x2F7A = 0x5AC4
+0x2F7C = 0x5B19
+0x2F7D = 0x5B25
+0x2F7E = 0x525D
+0x4F55 = 0x5B41
+0x4F56 = 0x5B56
+0x4F57 = 0x5B7D
+0x4F58 = 0x5B93
+0x4F59 = 0x5BD8
+0x4F5A = 0x5BEC
+0x4F5B = 0x5C12
+0x4F5C = 0x5C1E
+0x4F5D = 0x5C23
+0x4F5E = 0x5C2B
+0x4F5F = 0x378D
+0x4F60 = 0x5C62
+0x4F61 = 0xFA3B
+0x4F62 = 0xFA3C
+0x4F64 = 0x5C7A
+0x4F65 = 0x5C8F
+0x4F66 = 0x5C9F
+0x4F67 = 0x5CA3
+0x4F68 = 0x5CAA
+0x4F69 = 0x5CBA
+0x4F6A = 0x5CCB
+0x4F6B = 0x5CD0
+0x4F6C = 0x5CD2
+0x4F6D = 0x5CF4
+0x4F6F = 0x37E2
+0x4F70 = 0x5D0D
+0x4F71 = 0x5D27
+0x4F72 = 0xFA11
+0x4F73 = 0x5D46
+0x4F74 = 0x5D47
+0x4F75 = 0x5D53
+0x4F76 = 0x5D4A
+0x4F77 = 0x5D6D
+0x4F78 = 0x5D81
+0x4F79 = 0x5DA0
+0x4F7A = 0x5DA4
+0x4F7B = 0x5DA7
+0x4F7C = 0x5DB8
+0x4F7D = 0x5DCB
+0x4F7E = 0x541E
+0x7427 = 0x5653
+0x7428 = 0x5DE2
+0x7429 = 0x5E14
+0x742A = 0x5E18
+0x742B = 0x5E58
+0x742C = 0x5E5E
+0x742D = 0x5EBE
+0x742E = 0xF928
+0x742F = 0x5ECB
+0x7430 = 0x5EF9
+0x7431 = 0x5F00
+0x7432 = 0x5F02
+0x7433 = 0x5F07
+0x7434 = 0x5F1D
+0x7435 = 0x5F23
+0x7436 = 0x5F34
+0x7437 = 0x5F36
+0x7438 = 0x5F3D
+0x7439 = 0x5F40
+0x743A = 0x5F45
+0x743B = 0x5F54
+0x743C = 0x5F58
+0x743D = 0x5F64
+0x743E = 0x5F67
+0x743F = 0x5F7D
+0x7440 = 0x5F89
+0x7441 = 0x5F9C
+0x7442 = 0x5FA7
+0x7443 = 0x5FAF
+0x7444 = 0x5FB5
+0x7445 = 0x5FB7
+0x7446 = 0x5FC9
+0x7447 = 0x5FDE
+0x7448 = 0x5FE1
+0x7449 = 0x5FE9
+0x744A = 0x600D
+0x744B = 0x6014
+0x744C = 0x6018
+0x744D = 0x6033
+0x744E = 0x6035
+0x744F = 0x6047
+0x7450 = 0xFA3D
+0x7451 = 0x609D
+0x7452 = 0x609E
+0x7453 = 0x60CB
+0x7454 = 0x60D4
+0x7455 = 0x60D5
+0x7456 = 0x60DD
+0x7457 = 0x60F8
+0x7458 = 0x611C
+0x7459 = 0x612B
+0x745A = 0x6130
+0x745B = 0x6137
+0x745C = 0xFA3E
+0x745D = 0x618D
+0x745E = 0xFA3F
+0x745F = 0x61BC
+0x7460 = 0x61B9
+0x7461 = 0xFA40
+0x7462 = 0x6222
+0x7463 = 0x623E
+0x7464 = 0x6243
+0x7465 = 0x6256
+0x7466 = 0x625A
+0x7467 = 0x626F
+0x7468 = 0x6285
+0x7469 = 0x62C4
+0x746A = 0x62D6
+0x746B = 0x62FC
+0x746C = 0x630A
+0x746D = 0x6318
+0x746E = 0x6339
+0x746F = 0x6343
+0x7470 = 0x6365
+0x7471 = 0x637C
+0x7472 = 0x63E5
+0x7473 = 0x63ED
+0x7474 = 0x63F5
+0x7475 = 0x6410
+0x7476 = 0x6414
+0x7477 = 0x6422
+0x7478 = 0x6479
+0x7479 = 0x6451
+0x747A = 0x6460
+0x747B = 0x646D
+0x747C = 0x64CE
+0x747D = 0x64BE
+0x747E = 0x64BF
+0x7521 = 0x64C4
+0x7522 = 0x64CA
+0x7523 = 0x64D0
+0x7524 = 0x64F7
+0x7525 = 0x64FB
+0x7526 = 0x6522
+0x7527 = 0x6529
+0x7528 = 0xFA41
+0x7529 = 0x6567
+0x752A = 0x659D
+0x752B = 0xFA42
+0x752C = 0x6600
+0x752D = 0x6609
+0x752E = 0x6615
+0x752F = 0x661E
+0x7530 = 0x663A
+0x7531 = 0x6622
+0x7532 = 0x6624
+0x7533 = 0x662B
+0x7534 = 0x6630
+0x7535 = 0x6631
+0x7536 = 0x6633
+0x7537 = 0x66FB
+0x7538 = 0x6648
+0x7539 = 0x664C
+0x753B = 0x6659
+0x753C = 0x665A
+0x753D = 0x6661
+0x753E = 0x6665
+0x753F = 0x6673
+0x7540 = 0x6677
+0x7541 = 0x6678
+0x7542 = 0x668D
+0x7543 = 0xFA43
+0x7544 = 0x66A0
+0x7545 = 0x66B2
+0x7546 = 0x66BB
+0x7547 = 0x66C6
+0x7548 = 0x66C8
+0x7549 = 0x3B22
+0x754A = 0x66DB
+0x754B = 0x66E8
+0x754C = 0x66FA
+0x754D = 0x6713
+0x754E = 0xF929
+0x754F = 0x6733
+0x7550 = 0x6766
+0x7551 = 0x6747
+0x7552 = 0x6748
+0x7553 = 0x677B
+0x7554 = 0x6781
+0x7555 = 0x6793
+0x7556 = 0x6798
+0x7557 = 0x679B
+0x7558 = 0x67BB
+0x7559 = 0x67F9
+0x755A = 0x67C0
+0x755B = 0x67D7
+0x755C = 0x67FC
+0x755D = 0x6801
+0x755E = 0x6852
+0x755F = 0x681D
+0x7560 = 0x682C
+0x7561 = 0x6831
+0x7562 = 0x685B
+0x7563 = 0x6872
+0x7564 = 0x6875
+0x7565 = 0xFA44
+0x7566 = 0x68A3
+0x7567 = 0x68A5
+0x7568 = 0x68B2
+0x7569 = 0x68C8
+0x756A = 0x68D0
+0x756B = 0x68E8
+0x756C = 0x68ED
+0x756D = 0x68F0
+0x756E = 0x68F1
+0x756F = 0x68FC
+0x7570 = 0x690A
+0x7571 = 0x6949
+0x7573 = 0x6935
+0x7574 = 0x6942
+0x7575 = 0x6957
+0x7576 = 0x6963
+0x7577 = 0x6964
+0x7578 = 0x6968
+0x7579 = 0x6980
+0x757A = 0xFA14
+0x757B = 0x69A5
+0x757C = 0x69AD
+0x757D = 0x69CF
+0x757E = 0x3BB6
+0x7621 = 0x3BC3
+0x7622 = 0x69E2
+0x7623 = 0x69E9
+0x7624 = 0x69EA
+0x7625 = 0x69F5
+0x7626 = 0x69F6
+0x7627 = 0x6A0F
+0x7628 = 0x6A15
+0x762A = 0x6A3B
+0x762B = 0x6A3E
+0x762C = 0x6A45
+0x762D = 0x6A50
+0x762E = 0x6A56
+0x762F = 0x6A5B
+0x7630 = 0x6A6B
+0x7631 = 0x6A73
+0x7633 = 0x6A89
+0x7634 = 0x6A94
+0x7635 = 0x6A9D
+0x7636 = 0x6A9E
+0x7637 = 0x6AA5
+0x7638 = 0x6AE4
+0x7639 = 0x6AE7
+0x763A = 0x3C0F
+0x763B = 0xF91D
+0x763C = 0x6B1B
+0x763D = 0x6B1E
+0x763E = 0x6B2C
+0x763F = 0x6B35
+0x7640 = 0x6B46
+0x7641 = 0x6B56
+0x7642 = 0x6B60
+0x7643 = 0x6B65
+0x7644 = 0x6B67
+0x7645 = 0x6B77
+0x7646 = 0x6B82
+0x7647 = 0x6BA9
+0x7648 = 0x6BAD
+0x7649 = 0xF970
+0x764A = 0x6BCF
+0x764B = 0x6BD6
+0x764C = 0x6BD7
+0x764D = 0x6BFF
+0x764E = 0x6C05
+0x764F = 0x6C10
+0x7650 = 0x6C33
+0x7651 = 0x6C59
+0x7652 = 0x6C5C
+0x7653 = 0x6CAA
+0x7654 = 0x6C74
+0x7655 = 0x6C76
+0x7656 = 0x6C85
+0x7657 = 0x6C86
+0x7658 = 0x6C98
+0x7659 = 0x6C9C
+0x765A = 0x6CFB
+0x765B = 0x6CC6
+0x765C = 0x6CD4
+0x765D = 0x6CE0
+0x765E = 0x6CEB
+0x765F = 0x6CEE
+0x7661 = 0x6D04
+0x7662 = 0x6D0E
+0x7663 = 0x6D2E
+0x7664 = 0x6D31
+0x7665 = 0x6D39
+0x7666 = 0x6D3F
+0x7667 = 0x6D58
+0x7668 = 0x6D65
+0x7669 = 0xFA45
+0x766A = 0x6D82
+0x766B = 0x6D87
+0x766C = 0x6D89
+0x766D = 0x6D94
+0x766E = 0x6DAA
+0x766F = 0x6DAC
+0x7670 = 0x6DBF
+0x7671 = 0x6DC4
+0x7672 = 0x6DD6
+0x7673 = 0x6DDA
+0x7674 = 0x6DDB
+0x7675 = 0x6DDD
+0x7676 = 0x6DFC
+0x7677 = 0xFA46
+0x7678 = 0x6E34
+0x7679 = 0x6E44
+0x767A = 0x6E5C
+0x767B = 0x6E5E
+0x767C = 0x6EAB
+0x767D = 0x6EB1
+0x767E = 0x6EC1
+0x7721 = 0x6EC7
+0x7722 = 0x6ECE
+0x7723 = 0x6F10
+0x7724 = 0x6F1A
+0x7725 = 0xFA47
+0x7726 = 0x6F2A
+0x7727 = 0x6F2F
+0x7728 = 0x6F33
+0x7729 = 0x6F51
+0x772A = 0x6F59
+0x772B = 0x6F5E
+0x772C = 0x6F61
+0x772D = 0x6F62
+0x772E = 0x6F7E
+0x772F = 0x6F88
+0x7730 = 0x6F8C
+0x7731 = 0x6F8D
+0x7732 = 0x6F94
+0x7733 = 0x6FA0
+0x7734 = 0x6FA7
+0x7735 = 0x6FB6
+0x7736 = 0x6FBC
+0x7737 = 0x6FC7
+0x7738 = 0x6FCA
+0x7739 = 0x6FF9
+0x773A = 0x6FF0
+0x773B = 0x6FF5
+0x773C = 0x7005
+0x773D = 0x7006
+0x773E = 0x7028
+0x773F = 0x704A
+0x7740 = 0x705D
+0x7741 = 0x705E
+0x7742 = 0x704E
+0x7743 = 0x7064
+0x7744 = 0x7075
+0x7745 = 0x7085
+0x7746 = 0x70A4
+0x7747 = 0x70AB
+0x7748 = 0x70B7
+0x7749 = 0x70D4
+0x774A = 0x70D8
+0x774B = 0x70E4
+0x774C = 0x710F
+0x774D = 0x712B
+0x774E = 0x711E
+0x774F = 0x7120
+0x7750 = 0x712E
+0x7751 = 0x7130
+0x7752 = 0x7146
+0x7753 = 0x7147
+0x7754 = 0x7151
+0x7755 = 0xFA48
+0x7756 = 0x7152
+0x7757 = 0x715C
+0x7758 = 0x7160
+0x7759 = 0x7168
+0x775A = 0xFA15
+0x775B = 0x7185
+0x775C = 0x7187
+0x775D = 0x7192
+0x775E = 0x71C1
+0x775F = 0x71BA
+0x7760 = 0x71C4
+0x7761 = 0x71FE
+0x7762 = 0x7200
+0x7763 = 0x7215
+0x7764 = 0x7255
+0x7765 = 0x7256
+0x7766 = 0x3E3F
+0x7767 = 0x728D
+0x7768 = 0x729B
+0x7769 = 0x72BE
+0x776A = 0x72C0
+0x776B = 0x72FB
+0x776D = 0x7327
+0x776E = 0x7328
+0x776F = 0xFA16
+0x7770 = 0x7350
+0x7771 = 0x7366
+0x7772 = 0x737C
+0x7773 = 0x7395
+0x7774 = 0x739F
+0x7775 = 0x73A0
+0x7776 = 0x73A2
+0x7777 = 0x73A6
+0x7778 = 0x73AB
+0x7779 = 0x73C9
+0x777A = 0x73CF
+0x777B = 0x73D6
+0x777C = 0x73D9
+0x777D = 0x73E3
+0x777E = 0x73E9
+0x7821 = 0x7407
+0x7822 = 0x740A
+0x7823 = 0x741A
+0x7824 = 0x741B
+0x7825 = 0xFA4A
+0x7826 = 0x7426
+0x7827 = 0x7428
+0x7828 = 0x742A
+0x7829 = 0x742B
+0x782A = 0x742C
+0x782B = 0x742E
+0x782C = 0x742F
+0x782D = 0x7430
+0x782E = 0x7444
+0x782F = 0x7446
+0x7830 = 0x7447
+0x7831 = 0x744B
+0x7832 = 0x7457
+0x7833 = 0x7462
+0x7834 = 0x746B
+0x7835 = 0x746D
+0x7836 = 0x7486
+0x7837 = 0x7487
+0x7838 = 0x7489
+0x7839 = 0x7498
+0x783A = 0x749C
+0x783B = 0x749F
+0x783C = 0x74A3
+0x783D = 0x7490
+0x783E = 0x74A6
+0x783F = 0x74A8
+0x7840 = 0x74A9
+0x7841 = 0x74B5
+0x7842 = 0x74BF
+0x7843 = 0x74C8
+0x7844 = 0x74C9
+0x7845 = 0x74DA
+0x7846 = 0x74FF
+0x7847 = 0x7501
+0x7848 = 0x7517
+0x7849 = 0x752F
+0x784A = 0x756F
+0x784B = 0x7579
+0x784C = 0x7592
+0x784D = 0x3F72
+0x784E = 0x75CE
+0x784F = 0x75E4
+0x7850 = 0x7600
+0x7851 = 0x7602
+0x7852 = 0x7608
+0x7853 = 0x7615
+0x7854 = 0x7616
+0x7855 = 0x7619
+0x7856 = 0x761E
+0x7857 = 0x762D
+0x7858 = 0x7635
+0x7859 = 0x7643
+0x785A = 0x764B
+0x785B = 0x7664
+0x785C = 0x7665
+0x785D = 0x766D
+0x785E = 0x766F
+0x785F = 0x7671
+0x7860 = 0x7681
+0x7861 = 0x769B
+0x7862 = 0x769D
+0x7863 = 0x769E
+0x7864 = 0x76A6
+0x7865 = 0x76AA
+0x7866 = 0x76B6
+0x7867 = 0x76C5
+0x7868 = 0x76CC
+0x7869 = 0x76CE
+0x786A = 0x76D4
+0x786B = 0x76E6
+0x786C = 0x76F1
+0x786D = 0x76FC
+0x786E = 0x770A
+0x786F = 0x7719
+0x7870 = 0x7734
+0x7871 = 0x7736
+0x7872 = 0x7746
+0x7873 = 0x774D
+0x7874 = 0x774E
+0x7875 = 0x775C
+0x7876 = 0x775F
+0x7877 = 0x7762
+0x7878 = 0x777A
+0x7879 = 0x7780
+0x787A = 0x7794
+0x787B = 0x77AA
+0x787C = 0x77E0
+0x787D = 0x782D
+0x7921 = 0x7843
+0x7922 = 0x784E
+0x7923 = 0x784F
+0x7924 = 0x7851
+0x7925 = 0x7868
+0x7926 = 0x786E
+0x7927 = 0xFA4B
+0x7928 = 0x78B0
+0x792A = 0x78AD
+0x792B = 0x78E4
+0x792C = 0x78F2
+0x792D = 0x7900
+0x792E = 0x78F7
+0x792F = 0x791C
+0x7930 = 0x792E
+0x7931 = 0x7931
+0x7932 = 0x7934
+0x7933 = 0xFA4C
+0x7934 = 0xFA4D
+0x7935 = 0x7945
+0x7936 = 0x7946
+0x7937 = 0xFA4E
+0x7938 = 0xFA4F
+0x7939 = 0xFA50
+0x793A = 0x795C
+0x793B = 0xFA51
+0x793C = 0xFA19
+0x793D = 0xFA1A
+0x793E = 0x7979
+0x793F = 0xFA52
+0x7940 = 0xFA53
+0x7941 = 0xFA1B
+0x7942 = 0x7998
+0x7943 = 0x79B1
+0x7944 = 0x79B8
+0x7945 = 0x79C8
+0x7946 = 0x79CA
+0x7948 = 0x79D4
+0x7949 = 0x79DE
+0x794A = 0x79EB
+0x794B = 0x79ED
+0x794C = 0x7A03
+0x794D = 0xFA54
+0x794E = 0x7A39
+0x794F = 0x7A5D
+0x7950 = 0x7A6D
+0x7951 = 0xFA55
+0x7952 = 0x7A85
+0x7953 = 0x7AA0
+0x7955 = 0x7AB3
+0x7956 = 0x7ABB
+0x7957 = 0x7ACE
+0x7958 = 0x7AEB
+0x7959 = 0x7AFD
+0x795A = 0x7B12
+0x795B = 0x7B2D
+0x795C = 0x7B3B
+0x795D = 0x7B47
+0x795E = 0x7B4E
+0x795F = 0x7B60
+0x7960 = 0x7B6D
+0x7961 = 0x7B6F
+0x7962 = 0x7B72
+0x7963 = 0x7B9E
+0x7964 = 0xFA56
+0x7965 = 0x7BD7
+0x7966 = 0x7BD9
+0x7967 = 0x7C01
+0x7968 = 0x7C31
+0x7969 = 0x7C1E
+0x796A = 0x7C20
+0x796B = 0x7C33
+0x796C = 0x7C36
+0x796D = 0x4264
+0x796F = 0x7C59
+0x7970 = 0x7C6D
+0x7971 = 0x7C79
+0x7972 = 0x7C8F
+0x7973 = 0x7C94
+0x7974 = 0x7CA0
+0x7975 = 0x7CBC
+0x7976 = 0x7CD5
+0x7977 = 0x7CD9
+0x7978 = 0x7CDD
+0x7979 = 0x7D07
+0x797A = 0x7D08
+0x797B = 0x7D13
+0x797C = 0x7D1D
+0x797D = 0x7D23
+0x797E = 0x7D31
+0x7A21 = 0x7D41
+0x7A22 = 0x7D48
+0x7A23 = 0x7D53
+0x7A24 = 0x7D5C
+0x7A25 = 0x7D7A
+0x7A26 = 0x7D83
+0x7A27 = 0x7D8B
+0x7A28 = 0x7DA0
+0x7A29 = 0x7DA6
+0x7A2A = 0x7DC2
+0x7A2B = 0x7DCC
+0x7A2C = 0x7DD6
+0x7A2D = 0x7DE3
+0x7A2E = 0xFA57
+0x7A2F = 0x7E28
+0x7A30 = 0x7E08
+0x7A31 = 0x7E11
+0x7A32 = 0x7E15
+0x7A33 = 0xFA59
+0x7A34 = 0x7E47
+0x7A35 = 0x7E52
+0x7A36 = 0x7E61
+0x7A37 = 0x7E8A
+0x7A38 = 0x7E8D
+0x7A39 = 0x7F47
+0x7A3A = 0xFA5A
+0x7A3B = 0x7F91
+0x7A3C = 0x7F97
+0x7A3D = 0x7FBF
+0x7A3E = 0x7FCE
+0x7A3F = 0x7FDB
+0x7A40 = 0x7FDF
+0x7A41 = 0x7FEC
+0x7A42 = 0x7FEE
+0x7A43 = 0x7FFA
+0x7A44 = 0xFA5B
+0x7A45 = 0x8014
+0x7A46 = 0x8026
+0x7A47 = 0x8035
+0x7A48 = 0x8037
+0x7A49 = 0x803C
+0x7A4A = 0x80CA
+0x7A4B = 0x80D7
+0x7A4C = 0x80E0
+0x7A4D = 0x80F3
+0x7A4E = 0x8118
+0x7A4F = 0x814A
+0x7A50 = 0x8160
+0x7A51 = 0x8167
+0x7A52 = 0x8168
+0x7A53 = 0x816D
+0x7A54 = 0x81BB
+0x7A55 = 0x81CA
+0x7A56 = 0x81CF
+0x7A57 = 0x81D7
+0x7A58 = 0xFA5C
+0x7A59 = 0x4453
+0x7A5A = 0x445B
+0x7A5B = 0x8260
+0x7A5C = 0x8274
+0x7A5E = 0x828E
+0x7A5F = 0x82A1
+0x7A60 = 0x82A3
+0x7A61 = 0x82A4
+0x7A62 = 0x82A9
+0x7A63 = 0x82AE
+0x7A64 = 0x82B7
+0x7A65 = 0x82BE
+0x7A66 = 0x82BF
+0x7A67 = 0x82C6
+0x7A68 = 0x82D5
+0x7A69 = 0x82FD
+0x7A6A = 0x82FE
+0x7A6B = 0x8300
+0x7A6C = 0x8301
+0x7A6D = 0x8362
+0x7A6E = 0x8322
+0x7A6F = 0x832D
+0x7A70 = 0x833A
+0x7A71 = 0x8343
+0x7A72 = 0x8347
+0x7A73 = 0x8351
+0x7A74 = 0x8355
+0x7A75 = 0x837D
+0x7A76 = 0x8386
+0x7A77 = 0x8392
+0x7A78 = 0x8398
+0x7A79 = 0x83A7
+0x7A7A = 0x83A9
+0x7A7B = 0x83BF
+0x7A7C = 0x83C0
+0x7A7D = 0x83C7
+0x7A7E = 0x83CF
+0x7B21 = 0x83D1
+0x7B22 = 0x83E1
+0x7B23 = 0x83EA
+0x7B24 = 0x8401
+0x7B25 = 0x8406
+0x7B26 = 0x840A
+0x7B27 = 0xFA5F
+0x7B28 = 0x8448
+0x7B29 = 0x845F
+0x7B2A = 0x8470
+0x7B2B = 0x8473
+0x7B2C = 0x8485
+0x7B2D = 0x849E
+0x7B2E = 0x84AF
+0x7B2F = 0x84B4
+0x7B30 = 0x84BA
+0x7B31 = 0x84C0
+0x7B32 = 0x84C2
+0x7B34 = 0x8532
+0x7B35 = 0x851E
+0x7B36 = 0x8523
+0x7B37 = 0x852F
+0x7B38 = 0x8559
+0x7B39 = 0x8564
+0x7B3A = 0xFA1F
+0x7B3B = 0x85AD
+0x7B3C = 0x857A
+0x7B3D = 0x858C
+0x7B3E = 0x858F
+0x7B3F = 0x85A2
+0x7B40 = 0x85B0
+0x7B41 = 0x85CB
+0x7B42 = 0x85CE
+0x7B43 = 0x85ED
+0x7B44 = 0x8612
+0x7B45 = 0x85FF
+0x7B46 = 0x8604
+0x7B47 = 0x8605
+0x7B48 = 0x8610
+0x7B4A = 0x8618
+0x7B4B = 0x8629
+0x7B4C = 0x8638
+0x7B4D = 0x8657
+0x7B4E = 0x865B
+0x7B4F = 0xF936
+0x7B50 = 0x8662
+0x7B51 = 0x459D
+0x7B52 = 0x866C
+0x7B53 = 0x8675
+0x7B54 = 0x8698
+0x7B55 = 0x86B8
+0x7B56 = 0x86FA
+0x7B57 = 0x86FC
+0x7B58 = 0x86FD
+0x7B59 = 0x870B
+0x7B5A = 0x8771
+0x7B5B = 0x8787
+0x7B5C = 0x8788
+0x7B5D = 0x87AC
+0x7B5E = 0x87AD
+0x7B5F = 0x87B5
+0x7B60 = 0x45EA
+0x7B61 = 0x87D6
+0x7B62 = 0x87EC
+0x7B63 = 0x8806
+0x7B64 = 0x880A
+0x7B65 = 0x8810
+0x7B66 = 0x8814
+0x7B67 = 0x881F
+0x7B68 = 0x8898
+0x7B69 = 0x88AA
+0x7B6A = 0x88CA
+0x7B6B = 0x88CE
+0x7B6D = 0x88F5
+0x7B6E = 0x891C
+0x7B6F = 0xFA60
+0x7B70 = 0x8918
+0x7B71 = 0x8919
+0x7B72 = 0x891A
+0x7B73 = 0x8927
+0x7B74 = 0x8930
+0x7B75 = 0x8932
+0x7B76 = 0x8939
+0x7B77 = 0x8940
+0x7B78 = 0x8994
+0x7B79 = 0xFA61
+0x7B7A = 0x89D4
+0x7B7B = 0x89E5
+0x7B7C = 0x89F6
+0x7B7D = 0x8A12
+0x7B7E = 0x8A15
+0x7C21 = 0x8A22
+0x7C22 = 0x8A37
+0x7C23 = 0x8A47
+0x7C24 = 0x8A4E
+0x7C25 = 0x8A5D
+0x7C26 = 0x8A61
+0x7C27 = 0x8A75
+0x7C28 = 0x8A79
+0x7C29 = 0x8AA7
+0x7C2A = 0x8AD0
+0x7C2B = 0x8ADF
+0x7C2C = 0x8AF4
+0x7C2D = 0x8AF6
+0x7C2E = 0xFA22
+0x7C2F = 0xFA62
+0x7C30 = 0xFA63
+0x7C31 = 0x8B46
+0x7C32 = 0x8B54
+0x7C33 = 0x8B59
+0x7C34 = 0x8B69
+0x7C35 = 0x8B9D
+0x7C36 = 0x8C49
+0x7C37 = 0x8C68
+0x7C38 = 0xFA64
+0x7C39 = 0x8CE1
+0x7C3A = 0x8CF4
+0x7C3B = 0x8CF8
+0x7C3C = 0x8CFE
+0x7C3D = 0xFA65
+0x7C3E = 0x8D12
+0x7C3F = 0x8D1B
+0x7C40 = 0x8DAF
+0x7C41 = 0x8DCE
+0x7C42 = 0x8DD1
+0x7C43 = 0x8DD7
+0x7C44 = 0x8E20
+0x7C45 = 0x8E23
+0x7C46 = 0x8E3D
+0x7C47 = 0x8E70
+0x7C48 = 0x8E7B
+0x7C4A = 0x8EC0
+0x7C4B = 0x4844
+0x7C4C = 0x8EFA
+0x7C4D = 0x8F1E
+0x7C4E = 0x8F2D
+0x7C4F = 0x8F36
+0x7C50 = 0x8F54
+0x7C52 = 0x8FA6
+0x7C53 = 0x8FB5
+0x7C54 = 0x8FE4
+0x7C55 = 0x8FE8
+0x7C56 = 0x8FEE
+0x7C57 = 0x9008
+0x7C58 = 0x902D
+0x7C59 = 0xFA67
+0x7C5A = 0x9088
+0x7C5B = 0x9095
+0x7C5C = 0x9097
+0x7C5D = 0x9099
+0x7C5E = 0x909B
+0x7C5F = 0x90A2
+0x7C60 = 0x90B3
+0x7C61 = 0x90BE
+0x7C62 = 0x90C4
+0x7C63 = 0x90C5
+0x7C64 = 0x90C7
+0x7C65 = 0x90D7
+0x7C66 = 0x90DD
+0x7C67 = 0x90DE
+0x7C68 = 0x90EF
+0x7C69 = 0x90F4
+0x7C6A = 0xFA26
+0x7C6B = 0x9114
+0x7C6C = 0x9115
+0x7C6D = 0x9116
+0x7C6E = 0x9122
+0x7C6F = 0x9123
+0x7C70 = 0x9127
+0x7C71 = 0x912F
+0x7C72 = 0x9131
+0x7C73 = 0x9134
+0x7C74 = 0x913D
+0x7C75 = 0x9148
+0x7C76 = 0x915B
+0x7C77 = 0x9183
+0x7C78 = 0x919E
+0x7C79 = 0x91AC
+0x7C7A = 0x91B1
+0x7C7B = 0x91BC
+0x7C7C = 0x91D7
+0x7C7D = 0x91FB
+0x7C7E = 0x91E4
+0x7D21 = 0x91E5
+0x7D22 = 0x91ED
+0x7D23 = 0x91F1
+0x7D24 = 0x9207
+0x7D25 = 0x9210
+0x7D26 = 0x9238
+0x7D27 = 0x9239
+0x7D28 = 0x923A
+0x7D29 = 0x923C
+0x7D2A = 0x9240
+0x7D2B = 0x9243
+0x7D2C = 0x924F
+0x7D2D = 0x9278
+0x7D2E = 0x9288
+0x7D2F = 0x92C2
+0x7D30 = 0x92CB
+0x7D31 = 0x92CC
+0x7D32 = 0x92D3
+0x7D33 = 0x92E0
+0x7D34 = 0x92FF
+0x7D35 = 0x9304
+0x7D36 = 0x931F
+0x7D37 = 0x9321
+0x7D38 = 0x9325
+0x7D39 = 0x9348
+0x7D3A = 0x9349
+0x7D3B = 0x934A
+0x7D3C = 0x9364
+0x7D3D = 0x9365
+0x7D3E = 0x936A
+0x7D3F = 0x9370
+0x7D40 = 0x939B
+0x7D41 = 0x93A3
+0x7D42 = 0x93BA
+0x7D43 = 0x93C6
+0x7D44 = 0x93DE
+0x7D45 = 0x93DF
+0x7D46 = 0x9404
+0x7D47 = 0x93FD
+0x7D48 = 0x9433
+0x7D49 = 0x944A
+0x7D4A = 0x9463
+0x7D4B = 0x946B
+0x7D4C = 0x9471
+0x7D4D = 0x9472
+0x7D4E = 0x958E
+0x7D4F = 0x959F
+0x7D50 = 0x95A6
+0x7D51 = 0x95A9
+0x7D52 = 0x95AC
+0x7D53 = 0x95B6
+0x7D54 = 0x95BD
+0x7D55 = 0x95CB
+0x7D56 = 0x95D0
+0x7D57 = 0x95D3
+0x7D58 = 0x49B0
+0x7D59 = 0x95DA
+0x7D5A = 0x95DE
+0x7D5B = 0x9658
+0x7D5C = 0x9684
+0x7D5D = 0xF9DC
+0x7D5E = 0x969D
+0x7D5F = 0x96A4
+0x7D60 = 0x96A5
+0x7D61 = 0x96D2
+0x7D62 = 0x96DE
+0x7D63 = 0xFA68
+0x7D64 = 0x96E9
+0x7D65 = 0x96EF
+0x7D66 = 0x9733
+0x7D67 = 0x973B
+0x7D68 = 0x974D
+0x7D69 = 0x974E
+0x7D6A = 0x974F
+0x7D6B = 0x975A
+0x7D6C = 0x976E
+0x7D6D = 0x9773
+0x7D6E = 0x9795
+0x7D6F = 0x97AE
+0x7D70 = 0x97BA
+0x7D71 = 0x97C1
+0x7D72 = 0x97C9
+0x7D73 = 0x97DE
+0x7D74 = 0x97DB
+0x7D75 = 0x97F4
+0x7D76 = 0xFA69
+0x7D77 = 0x980A
+0x7D78 = 0x981E
+0x7D79 = 0x982B
+0x7D7A = 0x9830
+0x7D7B = 0xFA6A
+0x7D7C = 0x9852
+0x7D7D = 0x9853
+0x7D7E = 0x9856
+0x7E21 = 0x9857
+0x7E22 = 0x9859
+0x7E23 = 0x985A
+0x7E24 = 0xF9D0
+0x7E25 = 0x9865
+0x7E26 = 0x986C
+0x7E27 = 0x98BA
+0x7E28 = 0x98C8
+0x7E29 = 0x98E7
+0x7E2A = 0x9958
+0x7E2B = 0x999E
+0x7E2C = 0x9A02
+0x7E2D = 0x9A03
+0x7E2E = 0x9A24
+0x7E2F = 0x9A2D
+0x7E30 = 0x9A2E
+0x7E31 = 0x9A38
+0x7E32 = 0x9A4A
+0x7E33 = 0x9A4E
+0x7E34 = 0x9A52
+0x7E35 = 0x9AB6
+0x7E36 = 0x9AC1
+0x7E37 = 0x9AC3
+0x7E38 = 0x9ACE
+0x7E39 = 0x9AD6
+0x7E3A = 0x9AF9
+0x7E3B = 0x9B02
+0x7E3C = 0x9B08
+0x7E3D = 0x9B20
+0x7E3E = 0x4C17
+0x7E3F = 0x9B2D
+0x7E40 = 0x9B5E
+0x7E41 = 0x9B79
+0x7E42 = 0x9B66
+0x7E43 = 0x9B72
+0x7E44 = 0x9B75
+0x7E45 = 0x9B84
+0x7E46 = 0x9B8A
+0x7E47 = 0x9B8F
+0x7E48 = 0x9B9E
+0x7E49 = 0x9BA7
+0x7E4A = 0x9BC1
+0x7E4B = 0x9BCE
+0x7E4C = 0x9BE5
+0x7E4D = 0x9BF8
+0x7E4E = 0x9BFD
+0x7E4F = 0x9C00
+0x7E50 = 0x9C23
+0x7E51 = 0x9C41
+0x7E52 = 0x9C4F
+0x7E53 = 0x9C50
+0x7E54 = 0x9C53
+0x7E55 = 0x9C63
+0x7E56 = 0x9C65
+0x7E57 = 0x9C77
+0x7E58 = 0x9D1D
+0x7E59 = 0x9D1E
+0x7E5A = 0x9D43
+0x7E5B = 0x9D47
+0x7E5C = 0x9D52
+0x7E5D = 0x9D63
+0x7E5E = 0x9D70
+0x7E5F = 0x9D7C
+0x7E60 = 0x9D8A
+0x7E61 = 0x9D96
+0x7E62 = 0x9DC0
+0x7E63 = 0x9DAC
+0x7E64 = 0x9DBC
+0x7E65 = 0x9DD7
+0x7E67 = 0x9DE7
+0x7E68 = 0x9E07
+0x7E69 = 0x9E15
+0x7E6A = 0x9E7C
+0x7E6B = 0x9E9E
+0x7E6C = 0x9EA4
+0x7E6D = 0x9EAC
+0x7E6E = 0x9EAF
+0x7E6F = 0x9EB4
+0x7E70 = 0x9EB5
+0x7E71 = 0x9EC3
+0x7E72 = 0x9ED1
+0x7E73 = 0x9F10
+0x7E74 = 0x9F39
+0x7E75 = 0x9F57
+0x7E76 = 0x9F90
+0x7E77 = 0x9F94
+0x7E78 = 0x9F97
+0x7E79 = 0x9FA2
+0x7E7A = 0x59F8
+0x7E7B = 0x5C5B
+0x7E7C = 0x5E77
+0x7E7D = 0x7626
+0x7E7E = 0x7E6B
+END_MAP
diff --git a/enc/trans/JIS/JISX0213-1%UCS@SIP.src b/enc/trans/JIS/JISX0213-1%UCS@SIP.src
new file mode 100644
index 0000000000..da7eab62a7
--- /dev/null
+++ b/enc/trans/JIS/JISX0213-1%UCS@SIP.src
@@ -0,0 +1,60 @@
+# $NetBSD: JISX0213-1%UCS@SIP.src,v 1.1 2007/03/05 16:58:33 tnozaki Exp $
+
+TYPE ROWCOL
+NAME "JISX0213-1/UCS:SIP"
+SRC_ZONE 0x21-0x7E / 0x21-0x7E / 8
+OOB_MODE INVALID
+DST_INVALID 0xFFFE
+DST_UNIT_BITS 16
+
+BEGIN_MAP
+## JIS X 0213:2004 vs Unicode mapping table
+##
+## Date: 22 May 2006
+## License:
+## Copyright (C) 2001 earthian@tama.or.jp, All Rights Reserved.
+## Copyright (C) 2001 I'O, All Rights Reserved.
+## Copyright (C) 2006 Project X0213, All Rights Reserved.
+## You can use, modify, distribute this table freely.
+## Note:
+## 3-XXXX JIS X 0213:2004 plane 1 (GL encoding)
+## 4-XXXX JIS X 0213:2000 plane 2 (GL encoding)
+## [1983] JIS codepoint defined by JIS X 0208-1983
+## [1990] JIS codepoint defined by JIS X 0208-1990
+## [2000] JIS codepoint defined by JIS X 0213:2000
+## [2004] JIS codepoint defined by JIS X 0213:2004
+## [Unicode3.1] UCS codepoint defined by Unicode 3.1
+## [Unicode3.2] UCS codepoint defined by Unicode 3.2
+## Fullwidth UCS fullwidth form (U+Fxxx)
+## Windows Windows (CP932) mapping
+## Some 0213 character can't represent by one UCS character.
+## In this table, such characters are described as 'U+xxxx+xxxx'.
+##
+## JIS Unicode Name Note
+0x2E22 = 0x000B
+0x2F42 = 0x123D
+0x2F4C = 0x131B
+0x2F60 = 0x146E
+0x2F7B = 0x18BD
+0x4F54 = 0x0B9F
+0x4F63 = 0x16B4
+0x4F6E = 0x1E34
+0x753A = 0x31C4
+0x7572 = 0x35C4
+0x7629 = 0x373F
+0x7632 = 0x3763
+0x7660 = 0x3CFE
+0x776C = 0x47F1
+0x787E = 0x548E
+0x7929 = 0x550E
+0x7947 = 0x5771
+0x7954 = 0x59C4
+0x796E = 0x5DA1
+0x7A5D = 0x6AFF
+0x7B33 = 0x6E40
+0x7B49 = 0x70F4
+0x7B6C = 0x7684
+0x7C49 = 0x8277
+0x7C51 = 0x83CD
+0x7E66 = 0xA190
+END_MAP
diff --git a/enc/trans/JIS/JISX0213-2%UCS@BMP.src b/enc/trans/JIS/JISX0213-2%UCS@BMP.src
new file mode 100644
index 0000000000..e22ef8aa26
--- /dev/null
+++ b/enc/trans/JIS/JISX0213-2%UCS@BMP.src
@@ -0,0 +1,2193 @@
+# $NetBSD: JISX0213-2%UCS@BMP.src,v 1.1 2007/03/05 16:58:33 tnozaki Exp $
+
+TYPE ROWCOL
+NAME "JISX0213-2/UCS:BMP"
+SRC_ZONE 0x21-0x7E / 0x21-0x7E / 8
+OOB_MODE INVALID
+DST_INVALID 0xFFFE
+DST_UNIT_BITS 16
+
+BEGIN_MAP
+## JIS X 0213:2004 vs Unicode mapping table
+##
+## Date: 22 May 2006
+## License:
+## Copyright (C) 2001 earthian@tama.or.jp, All Rights Reserved.
+## Copyright (C) 2001 I'O, All Rights Reserved.
+## Copyright (C) 2006 Project X0213, All Rights Reserved.
+## You can use, modify, distribute this table freely.
+## Note:
+## 3-XXXX JIS X 0213:2004 plane 1 (GL encoding)
+## 4-XXXX JIS X 0213:2000 plane 2 (GL encoding)
+## [1983] JIS codepoint defined by JIS X 0208-1983
+## [1990] JIS codepoint defined by JIS X 0208-1990
+## [2000] JIS codepoint defined by JIS X 0213:2000
+## [2004] JIS codepoint defined by JIS X 0213:2004
+## [Unicode3.1] UCS codepoint defined by Unicode 3.1
+## [Unicode3.2] UCS codepoint defined by Unicode 3.2
+## Fullwidth UCS fullwidth form (U+Fxxx)
+## Windows Windows (CP932) mapping
+## Some 0213 character can't represent by one UCS character.
+## In this table, such characters are described as 'U+xxxx+xxxx'.
+##
+## JIS Unicode Name Note
+0x2122 = 0x4E02
+0x2123 = 0x4E0F
+0x2124 = 0x4E12
+0x2125 = 0x4E29
+0x2126 = 0x4E2B
+0x2127 = 0x4E2E
+0x2128 = 0x4E40
+0x2129 = 0x4E47
+0x212A = 0x4E48
+0x212C = 0x4E51
+0x212D = 0x3406
+0x212F = 0x4E5A
+0x2130 = 0x4E69
+0x2131 = 0x4E9D
+0x2132 = 0x342C
+0x2133 = 0x342E
+0x2134 = 0x4EB9
+0x2135 = 0x4EBB
+0x2137 = 0x4EBC
+0x2138 = 0x4EC3
+0x2139 = 0x4EC8
+0x213A = 0x4ED0
+0x213B = 0x4EEB
+0x213C = 0x4EDA
+0x213D = 0x4EF1
+0x213E = 0x4EF5
+0x213F = 0x4F00
+0x2140 = 0x4F16
+0x2141 = 0x4F64
+0x2142 = 0x4F37
+0x2143 = 0x4F3E
+0x2144 = 0x4F54
+0x2145 = 0x4F58
+0x2147 = 0x4F77
+0x2148 = 0x4F78
+0x2149 = 0x4F7A
+0x214A = 0x4F7D
+0x214B = 0x4F82
+0x214C = 0x4F85
+0x214D = 0x4F92
+0x214E = 0x4F9A
+0x214F = 0x4FE6
+0x2150 = 0x4FB2
+0x2151 = 0x4FBE
+0x2152 = 0x4FC5
+0x2153 = 0x4FCB
+0x2154 = 0x4FCF
+0x2155 = 0x4FD2
+0x2156 = 0x346A
+0x2157 = 0x4FF2
+0x2158 = 0x5000
+0x2159 = 0x5010
+0x215A = 0x5013
+0x215B = 0x501C
+0x215C = 0x501E
+0x215D = 0x5022
+0x215E = 0x3468
+0x215F = 0x5042
+0x2160 = 0x5046
+0x2161 = 0x504E
+0x2162 = 0x5053
+0x2163 = 0x5057
+0x2164 = 0x5063
+0x2165 = 0x5066
+0x2166 = 0x506A
+0x2167 = 0x5070
+0x2168 = 0x50A3
+0x2169 = 0x5088
+0x216A = 0x5092
+0x216B = 0x5093
+0x216C = 0x5095
+0x216D = 0x5096
+0x216E = 0x509C
+0x216F = 0x50AA
+0x2171 = 0x50B1
+0x2172 = 0x50BA
+0x2173 = 0x50BB
+0x2174 = 0x50C4
+0x2175 = 0x50C7
+0x2176 = 0x50F3
+0x2178 = 0x50CE
+0x217A = 0x50D4
+0x217B = 0x50D9
+0x217C = 0x50E1
+0x217D = 0x50E9
+0x217E = 0x3492
+0x2321 = 0x5108
+0x2323 = 0x5117
+0x2324 = 0x511B
+0x2326 = 0x5160
+0x2328 = 0x5173
+0x2329 = 0x5183
+0x232A = 0x518B
+0x232B = 0x34BC
+0x232C = 0x5198
+0x232D = 0x51A3
+0x232E = 0x51AD
+0x232F = 0x34C7
+0x2330 = 0x51BC
+0x2333 = 0x51F3
+0x2334 = 0x51F4
+0x2335 = 0x5202
+0x2336 = 0x5212
+0x2337 = 0x5216
+0x2339 = 0x5255
+0x233A = 0x525C
+0x233B = 0x526C
+0x233C = 0x5277
+0x233D = 0x5284
+0x233E = 0x5282
+0x2340 = 0x5298
+0x2342 = 0x52A4
+0x2343 = 0x52A6
+0x2344 = 0x52AF
+0x2345 = 0x52BA
+0x2346 = 0x52BB
+0x2347 = 0x52CA
+0x2348 = 0x351F
+0x2349 = 0x52D1
+0x234B = 0x52F7
+0x234C = 0x530A
+0x234D = 0x530B
+0x234E = 0x5324
+0x234F = 0x5335
+0x2350 = 0x533E
+0x2351 = 0x5342
+0x2354 = 0x5367
+0x2355 = 0x536C
+0x2356 = 0x537A
+0x2357 = 0x53A4
+0x2358 = 0x53B4
+0x235A = 0x53B7
+0x235B = 0x53C0
+0x235D = 0x355D
+0x235E = 0x355E
+0x235F = 0x53D5
+0x2360 = 0x53DA
+0x2361 = 0x3563
+0x2362 = 0x53F4
+0x2363 = 0x53F5
+0x2364 = 0x5455
+0x2365 = 0x5424
+0x2366 = 0x5428
+0x2367 = 0x356E
+0x2368 = 0x5443
+0x2369 = 0x5462
+0x236A = 0x5466
+0x236B = 0x546C
+0x236C = 0x548A
+0x236D = 0x548D
+0x236E = 0x5495
+0x236F = 0x54A0
+0x2370 = 0x54A6
+0x2371 = 0x54AD
+0x2372 = 0x54AE
+0x2373 = 0x54B7
+0x2374 = 0x54BA
+0x2375 = 0x54BF
+0x2376 = 0x54C3
+0x2378 = 0x54EC
+0x2379 = 0x54EF
+0x237A = 0x54F1
+0x237B = 0x54F3
+0x237C = 0x5500
+0x237D = 0x5501
+0x237E = 0x5509
+0x2421 = 0x553C
+0x2422 = 0x5541
+0x2423 = 0x35A6
+0x2424 = 0x5547
+0x2425 = 0x554A
+0x2426 = 0x35A8
+0x2427 = 0x5560
+0x2428 = 0x5561
+0x2429 = 0x5564
+0x242B = 0x557D
+0x242C = 0x5582
+0x242D = 0x5588
+0x242E = 0x5591
+0x242F = 0x35C5
+0x2430 = 0x55D2
+0x2433 = 0x55BF
+0x2434 = 0x55C9
+0x2435 = 0x55CC
+0x2436 = 0x55D1
+0x2437 = 0x55DD
+0x2438 = 0x35DA
+0x2439 = 0x55E2
+0x243B = 0x55E9
+0x243C = 0x5628
+0x243E = 0x5607
+0x243F = 0x5610
+0x2440 = 0x5630
+0x2441 = 0x5637
+0x2442 = 0x35F4
+0x2443 = 0x563D
+0x2444 = 0x563F
+0x2445 = 0x5640
+0x2446 = 0x5647
+0x2447 = 0x565E
+0x2448 = 0x5660
+0x2449 = 0x566D
+0x244A = 0x3605
+0x244B = 0x5688
+0x244C = 0x568C
+0x244D = 0x5695
+0x244E = 0x569A
+0x244F = 0x569D
+0x2450 = 0x56A8
+0x2451 = 0x56AD
+0x2452 = 0x56B2
+0x2453 = 0x56C5
+0x2454 = 0x56CD
+0x2455 = 0x56DF
+0x2456 = 0x56E8
+0x2457 = 0x56F6
+0x2458 = 0x56F7
+0x245A = 0x5715
+0x245B = 0x5723
+0x245D = 0x5729
+0x245F = 0x5745
+0x2460 = 0x5746
+0x2461 = 0x574C
+0x2462 = 0x574D
+0x2464 = 0x5768
+0x2465 = 0x576F
+0x2466 = 0x5773
+0x2467 = 0x5774
+0x2468 = 0x5775
+0x2469 = 0x577B
+0x246C = 0x57AC
+0x246D = 0x579A
+0x246E = 0x579D
+0x246F = 0x579E
+0x2470 = 0x57A8
+0x2471 = 0x57D7
+0x2473 = 0x57CC
+0x2476 = 0x57DE
+0x2477 = 0x57E6
+0x2478 = 0x57F0
+0x2479 = 0x364A
+0x247A = 0x57F8
+0x247B = 0x57FB
+0x247C = 0x57FD
+0x247D = 0x5804
+0x247E = 0x581E
+0x2521 = 0x5820
+0x2522 = 0x5827
+0x2523 = 0x5832
+0x2524 = 0x5839
+0x2526 = 0x5849
+0x2527 = 0x584C
+0x2528 = 0x5867
+0x2529 = 0x588A
+0x252A = 0x588B
+0x252B = 0x588D
+0x252C = 0x588F
+0x252D = 0x5890
+0x252E = 0x5894
+0x252F = 0x589D
+0x2530 = 0x58AA
+0x2531 = 0x58B1
+0x2533 = 0x58C3
+0x2534 = 0x58CD
+0x2535 = 0x58E2
+0x2536 = 0x58F3
+0x2537 = 0x58F4
+0x2538 = 0x5905
+0x2539 = 0x5906
+0x253A = 0x590B
+0x253B = 0x590D
+0x253C = 0x5914
+0x253D = 0x5924
+0x253F = 0x3691
+0x2540 = 0x593D
+0x2541 = 0x3699
+0x2542 = 0x5946
+0x2543 = 0x3696
+0x2545 = 0x595B
+0x2546 = 0x595F
+0x2548 = 0x5975
+0x2549 = 0x5976
+0x254A = 0x597C
+0x254B = 0x599F
+0x254C = 0x59AE
+0x254D = 0x59BC
+0x254E = 0x59C8
+0x254F = 0x59CD
+0x2550 = 0x59DE
+0x2551 = 0x59E3
+0x2552 = 0x59E4
+0x2553 = 0x59E7
+0x2554 = 0x59EE
+0x2557 = 0x36CF
+0x2558 = 0x5A0C
+0x2559 = 0x5A0D
+0x255A = 0x5A17
+0x255B = 0x5A27
+0x255C = 0x5A2D
+0x255D = 0x5A55
+0x255E = 0x5A65
+0x255F = 0x5A7A
+0x2560 = 0x5A8B
+0x2561 = 0x5A9C
+0x2562 = 0x5A9F
+0x2563 = 0x5AA0
+0x2564 = 0x5AA2
+0x2565 = 0x5AB1
+0x2566 = 0x5AB3
+0x2567 = 0x5AB5
+0x2568 = 0x5ABA
+0x2569 = 0x5ABF
+0x256A = 0x5ADA
+0x256B = 0x5ADC
+0x256C = 0x5AE0
+0x256D = 0x5AE5
+0x256E = 0x5AF0
+0x256F = 0x5AEE
+0x2570 = 0x5AF5
+0x2571 = 0x5B00
+0x2572 = 0x5B08
+0x2573 = 0x5B17
+0x2574 = 0x5B34
+0x2575 = 0x5B2D
+0x2576 = 0x5B4C
+0x2577 = 0x5B52
+0x2578 = 0x5B68
+0x2579 = 0x5B6F
+0x257A = 0x5B7C
+0x257B = 0x5B7F
+0x257C = 0x5B81
+0x257D = 0x5B84
+0x2821 = 0x5B96
+0x2822 = 0x5BAC
+0x2823 = 0x3761
+0x2824 = 0x5BC0
+0x2825 = 0x3762
+0x2826 = 0x5BCE
+0x2827 = 0x5BD6
+0x2828 = 0x376C
+0x2829 = 0x376B
+0x282A = 0x5BF1
+0x282B = 0x5BFD
+0x282C = 0x3775
+0x282D = 0x5C03
+0x282E = 0x5C29
+0x282F = 0x5C30
+0x2831 = 0x5C5F
+0x2832 = 0x5C63
+0x2833 = 0x5C67
+0x2834 = 0x5C68
+0x2835 = 0x5C69
+0x2836 = 0x5C70
+0x2839 = 0x5C7C
+0x283C = 0x5C88
+0x283D = 0x5C8A
+0x283E = 0x37C1
+0x2841 = 0x5CA0
+0x2842 = 0x5CA2
+0x2843 = 0x5CA6
+0x2844 = 0x5CA7
+0x2846 = 0x5CAD
+0x2847 = 0x5CB5
+0x2849 = 0x5CC9
+0x284C = 0x5D06
+0x284D = 0x5D10
+0x284E = 0x5D2B
+0x284F = 0x5D1D
+0x2850 = 0x5D20
+0x2851 = 0x5D24
+0x2852 = 0x5D26
+0x2853 = 0x5D31
+0x2854 = 0x5D39
+0x2855 = 0x5D42
+0x2856 = 0x37E8
+0x2857 = 0x5D61
+0x2858 = 0x5D6A
+0x2859 = 0x37F4
+0x285A = 0x5D70
+0x285C = 0x37FD
+0x285D = 0x5D88
+0x285E = 0x3800
+0x285F = 0x5D92
+0x2860 = 0x5D94
+0x2861 = 0x5D97
+0x2862 = 0x5D99
+0x2863 = 0x5DB0
+0x2864 = 0x5DB2
+0x2865 = 0x5DB4
+0x2867 = 0x5DB9
+0x2868 = 0x5DD1
+0x2869 = 0x5DD7
+0x286A = 0x5DD8
+0x286B = 0x5DE0
+0x286D = 0x5DE4
+0x286E = 0x5DE9
+0x286F = 0x382F
+0x2870 = 0x5E00
+0x2871 = 0x3836
+0x2872 = 0x5E12
+0x2873 = 0x5E15
+0x2874 = 0x3840
+0x2875 = 0x5E1F
+0x2876 = 0x5E2E
+0x2877 = 0x5E3E
+0x2878 = 0x5E49
+0x2879 = 0x385C
+0x287A = 0x5E56
+0x287B = 0x3861
+0x287C = 0x5E6B
+0x287D = 0x5E6C
+0x287E = 0x5E6D
+0x2C21 = 0x5E6E
+0x2C23 = 0x5EA5
+0x2C24 = 0x5EAA
+0x2C25 = 0x5EAC
+0x2C26 = 0x5EB9
+0x2C27 = 0x5EBF
+0x2C28 = 0x5EC6
+0x2C29 = 0x5ED2
+0x2C2A = 0x5ED9
+0x2C2C = 0x5EFD
+0x2C2D = 0x5F08
+0x2C2E = 0x5F0E
+0x2C2F = 0x5F1C
+0x2C31 = 0x5F1E
+0x2C32 = 0x5F47
+0x2C33 = 0x5F63
+0x2C34 = 0x5F72
+0x2C35 = 0x5F7E
+0x2C36 = 0x5F8F
+0x2C37 = 0x5FA2
+0x2C38 = 0x5FA4
+0x2C39 = 0x5FB8
+0x2C3A = 0x5FC4
+0x2C3B = 0x38FA
+0x2C3C = 0x5FC7
+0x2C3D = 0x5FCB
+0x2C3E = 0x5FD2
+0x2C3F = 0x5FD3
+0x2C40 = 0x5FD4
+0x2C41 = 0x5FE2
+0x2C42 = 0x5FEE
+0x2C43 = 0x5FEF
+0x2C44 = 0x5FF3
+0x2C45 = 0x5FFC
+0x2C46 = 0x3917
+0x2C47 = 0x6017
+0x2C48 = 0x6022
+0x2C49 = 0x6024
+0x2C4A = 0x391A
+0x2C4B = 0x604C
+0x2C4C = 0x607F
+0x2C4D = 0x608A
+0x2C4E = 0x6095
+0x2C4F = 0x60A8
+0x2C51 = 0x60B0
+0x2C52 = 0x60B1
+0x2C53 = 0x60BE
+0x2C54 = 0x60C8
+0x2C55 = 0x60D9
+0x2C56 = 0x60DB
+0x2C57 = 0x60EE
+0x2C58 = 0x60F2
+0x2C59 = 0x60F5
+0x2C5A = 0x6110
+0x2C5B = 0x6112
+0x2C5C = 0x6113
+0x2C5D = 0x6119
+0x2C5E = 0x611E
+0x2C5F = 0x613A
+0x2C60 = 0x396F
+0x2C61 = 0x6141
+0x2C62 = 0x6146
+0x2C63 = 0x6160
+0x2C64 = 0x617C
+0x2C66 = 0x6192
+0x2C67 = 0x6193
+0x2C68 = 0x6197
+0x2C69 = 0x6198
+0x2C6A = 0x61A5
+0x2C6B = 0x61A8
+0x2C6C = 0x61AD
+0x2C6E = 0x61D5
+0x2C6F = 0x61DD
+0x2C70 = 0x61DF
+0x2C71 = 0x61F5
+0x2C73 = 0x6215
+0x2C74 = 0x6223
+0x2C75 = 0x6229
+0x2C76 = 0x6246
+0x2C77 = 0x624C
+0x2C78 = 0x6251
+0x2C79 = 0x6252
+0x2C7A = 0x6261
+0x2C7B = 0x6264
+0x2C7C = 0x627B
+0x2C7D = 0x626D
+0x2C7E = 0x6273
+0x2D21 = 0x6299
+0x2D22 = 0x62A6
+0x2D23 = 0x62D5
+0x2D25 = 0x62FD
+0x2D26 = 0x6303
+0x2D27 = 0x630D
+0x2D28 = 0x6310
+0x2D2B = 0x6332
+0x2D2C = 0x6335
+0x2D2D = 0x633B
+0x2D2E = 0x633C
+0x2D2F = 0x6341
+0x2D30 = 0x6344
+0x2D31 = 0x634E
+0x2D33 = 0x6359
+0x2D36 = 0x636C
+0x2D37 = 0x6384
+0x2D38 = 0x6399
+0x2D3A = 0x6394
+0x2D3B = 0x63BD
+0x2D3C = 0x63F7
+0x2D3D = 0x63D4
+0x2D3E = 0x63D5
+0x2D3F = 0x63DC
+0x2D40 = 0x63E0
+0x2D41 = 0x63EB
+0x2D42 = 0x63EC
+0x2D43 = 0x63F2
+0x2D44 = 0x6409
+0x2D45 = 0x641E
+0x2D46 = 0x6425
+0x2D47 = 0x6429
+0x2D48 = 0x642F
+0x2D49 = 0x645A
+0x2D4A = 0x645B
+0x2D4B = 0x645D
+0x2D4C = 0x6473
+0x2D4D = 0x647D
+0x2D4E = 0x6487
+0x2D4F = 0x6491
+0x2D50 = 0x649D
+0x2D51 = 0x649F
+0x2D52 = 0x64CB
+0x2D53 = 0x64CC
+0x2D54 = 0x64D5
+0x2D55 = 0x64D7
+0x2D57 = 0x64E4
+0x2D58 = 0x64E5
+0x2D59 = 0x64FF
+0x2D5A = 0x6504
+0x2D5B = 0x3A6E
+0x2D5C = 0x650F
+0x2D5D = 0x6514
+0x2D5E = 0x6516
+0x2D5F = 0x3A73
+0x2D60 = 0x651E
+0x2D61 = 0x6532
+0x2D62 = 0x6544
+0x2D63 = 0x6554
+0x2D64 = 0x656B
+0x2D65 = 0x657A
+0x2D66 = 0x6581
+0x2D67 = 0x6584
+0x2D68 = 0x6585
+0x2D69 = 0x658A
+0x2D6A = 0x65B2
+0x2D6B = 0x65B5
+0x2D6C = 0x65B8
+0x2D6D = 0x65BF
+0x2D6E = 0x65C2
+0x2D6F = 0x65C9
+0x2D70 = 0x65D4
+0x2D71 = 0x3AD6
+0x2D72 = 0x65F2
+0x2D73 = 0x65F9
+0x2D74 = 0x65FC
+0x2D75 = 0x6604
+0x2D76 = 0x6608
+0x2D77 = 0x6621
+0x2D78 = 0x662A
+0x2D79 = 0x6645
+0x2D7A = 0x6651
+0x2D7B = 0x664E
+0x2D7C = 0x3AEA
+0x2D7E = 0x6657
+0x2E21 = 0x665B
+0x2E22 = 0x6663
+0x2E25 = 0x666A
+0x2E26 = 0x666B
+0x2E27 = 0x666C
+0x2E28 = 0x666D
+0x2E29 = 0x667B
+0x2E2A = 0x6680
+0x2E2B = 0x6690
+0x2E2C = 0x6692
+0x2E2D = 0x6699
+0x2E2E = 0x3B0E
+0x2E2F = 0x66AD
+0x2E30 = 0x66B1
+0x2E31 = 0x66B5
+0x2E32 = 0x3B1A
+0x2E33 = 0x66BF
+0x2E34 = 0x3B1C
+0x2E35 = 0x66EC
+0x2E36 = 0x3AD7
+0x2E37 = 0x6701
+0x2E38 = 0x6705
+0x2E39 = 0x6712
+0x2E3B = 0x6719
+0x2E3E = 0x674C
+0x2E3F = 0x674D
+0x2E40 = 0x6754
+0x2E41 = 0x675D
+0x2E45 = 0x6774
+0x2E46 = 0x6776
+0x2E48 = 0x6792
+0x2E4A = 0x8363
+0x2E4B = 0x6810
+0x2E4C = 0x67B0
+0x2E4D = 0x67B2
+0x2E4E = 0x67C3
+0x2E4F = 0x67C8
+0x2E50 = 0x67D2
+0x2E51 = 0x67D9
+0x2E52 = 0x67DB
+0x2E53 = 0x67F0
+0x2E54 = 0x67F7
+0x2E58 = 0x6818
+0x2E59 = 0x681F
+0x2E5A = 0x682D
+0x2E5C = 0x6833
+0x2E5D = 0x683B
+0x2E5E = 0x683E
+0x2E5F = 0x6844
+0x2E60 = 0x6845
+0x2E61 = 0x6849
+0x2E62 = 0x684C
+0x2E63 = 0x6855
+0x2E64 = 0x6857
+0x2E65 = 0x3B77
+0x2E66 = 0x686B
+0x2E67 = 0x686E
+0x2E68 = 0x687A
+0x2E69 = 0x687C
+0x2E6A = 0x6882
+0x2E6B = 0x6890
+0x2E6C = 0x6896
+0x2E6D = 0x3B6D
+0x2E6E = 0x6898
+0x2E6F = 0x6899
+0x2E70 = 0x689A
+0x2E71 = 0x689C
+0x2E72 = 0x68AA
+0x2E73 = 0x68AB
+0x2E74 = 0x68B4
+0x2E75 = 0x68BB
+0x2E76 = 0x68FB
+0x2E79 = 0xFA13
+0x2E7A = 0x68C3
+0x2E7B = 0x68C5
+0x2E7C = 0x68CC
+0x2E7D = 0x68CF
+0x2E7E = 0x68D6
+0x2F21 = 0x68D9
+0x2F22 = 0x68E4
+0x2F23 = 0x68E5
+0x2F24 = 0x68EC
+0x2F25 = 0x68F7
+0x2F26 = 0x6903
+0x2F27 = 0x6907
+0x2F28 = 0x3B87
+0x2F29 = 0x3B88
+0x2F2B = 0x693B
+0x2F2C = 0x3B8D
+0x2F2D = 0x6946
+0x2F2E = 0x6969
+0x2F2F = 0x696C
+0x2F30 = 0x6972
+0x2F31 = 0x697A
+0x2F32 = 0x697F
+0x2F33 = 0x6992
+0x2F34 = 0x3BA4
+0x2F35 = 0x6996
+0x2F36 = 0x6998
+0x2F37 = 0x69A6
+0x2F38 = 0x69B0
+0x2F39 = 0x69B7
+0x2F3A = 0x69BA
+0x2F3B = 0x69BC
+0x2F3C = 0x69C0
+0x2F3D = 0x69D1
+0x2F3E = 0x69D6
+0x2F41 = 0x6A30
+0x2F44 = 0x69E3
+0x2F45 = 0x69EE
+0x2F46 = 0x69EF
+0x2F47 = 0x69F3
+0x2F48 = 0x3BCD
+0x2F49 = 0x69F4
+0x2F4A = 0x69FE
+0x2F4B = 0x6A11
+0x2F4C = 0x6A1A
+0x2F4D = 0x6A1D
+0x2F4F = 0x6A32
+0x2F50 = 0x6A33
+0x2F51 = 0x6A34
+0x2F52 = 0x6A3F
+0x2F53 = 0x6A46
+0x2F54 = 0x6A49
+0x2F55 = 0x6A7A
+0x2F56 = 0x6A4E
+0x2F57 = 0x6A52
+0x2F58 = 0x6A64
+0x2F5A = 0x6A7E
+0x2F5B = 0x6A83
+0x2F5C = 0x6A8B
+0x2F5D = 0x3BF0
+0x2F5E = 0x6A91
+0x2F5F = 0x6A9F
+0x2F60 = 0x6AA1
+0x2F62 = 0x6AAB
+0x2F63 = 0x6ABD
+0x2F64 = 0x6AC6
+0x2F65 = 0x6AD4
+0x2F66 = 0x6AD0
+0x2F67 = 0x6ADC
+0x2F68 = 0x6ADD
+0x2F6B = 0x6AEC
+0x2F6C = 0x6AF1
+0x2F6D = 0x6AF2
+0x2F6E = 0x6AF3
+0x2F6F = 0x6AFD
+0x2F71 = 0x6B0B
+0x2F72 = 0x6B0F
+0x2F73 = 0x6B10
+0x2F74 = 0x6B11
+0x2F76 = 0x6B17
+0x2F77 = 0x3C26
+0x2F78 = 0x6B2F
+0x2F79 = 0x6B4A
+0x2F7A = 0x6B58
+0x2F7B = 0x6B6C
+0x2F7C = 0x6B75
+0x2F7D = 0x6B7A
+0x2F7E = 0x6B81
+0x6E21 = 0x6B9B
+0x6E22 = 0x6BAE
+0x6E24 = 0x6BBD
+0x6E25 = 0x6BBE
+0x6E26 = 0x6BC7
+0x6E27 = 0x6BC8
+0x6E28 = 0x6BC9
+0x6E29 = 0x6BDA
+0x6E2A = 0x6BE6
+0x6E2B = 0x6BE7
+0x6E2C = 0x6BEE
+0x6E2D = 0x6BF1
+0x6E2E = 0x6C02
+0x6E2F = 0x6C0A
+0x6E30 = 0x6C0E
+0x6E31 = 0x6C35
+0x6E32 = 0x6C36
+0x6E33 = 0x6C3A
+0x6E35 = 0x6C3F
+0x6E36 = 0x6C4D
+0x6E37 = 0x6C5B
+0x6E38 = 0x6C6D
+0x6E39 = 0x6C84
+0x6E3A = 0x6C89
+0x6E3B = 0x3CC3
+0x6E3C = 0x6C94
+0x6E3D = 0x6C95
+0x6E3E = 0x6C97
+0x6E3F = 0x6CAD
+0x6E40 = 0x6CC2
+0x6E41 = 0x6CD0
+0x6E42 = 0x3CD2
+0x6E43 = 0x6CD6
+0x6E44 = 0x6CDA
+0x6E45 = 0x6CDC
+0x6E46 = 0x6CE9
+0x6E47 = 0x6CEC
+0x6E48 = 0x6CED
+0x6E4A = 0x6D00
+0x6E4B = 0x6D0A
+0x6E4C = 0x6D24
+0x6E4D = 0x6D26
+0x6E4E = 0x6D27
+0x6E4F = 0x6C67
+0x6E50 = 0x6D2F
+0x6E51 = 0x6D3C
+0x6E52 = 0x6D5B
+0x6E53 = 0x6D5E
+0x6E54 = 0x6D60
+0x6E55 = 0x6D70
+0x6E56 = 0x6D80
+0x6E57 = 0x6D81
+0x6E58 = 0x6D8A
+0x6E59 = 0x6D8D
+0x6E5A = 0x6D91
+0x6E5B = 0x6D98
+0x6E5D = 0x6E17
+0x6E61 = 0x6DAB
+0x6E62 = 0x6DAE
+0x6E63 = 0x6DB4
+0x6E64 = 0x6DC2
+0x6E65 = 0x6D34
+0x6E66 = 0x6DC8
+0x6E67 = 0x6DCE
+0x6E68 = 0x6DCF
+0x6E69 = 0x6DD0
+0x6E6A = 0x6DDF
+0x6E6B = 0x6DE9
+0x6E6C = 0x6DF6
+0x6E6D = 0x6E36
+0x6E6E = 0x6E1E
+0x6E6F = 0x6E22
+0x6E70 = 0x6E27
+0x6E71 = 0x3D11
+0x6E72 = 0x6E32
+0x6E73 = 0x6E3C
+0x6E74 = 0x6E48
+0x6E75 = 0x6E49
+0x6E76 = 0x6E4B
+0x6E77 = 0x6E4C
+0x6E78 = 0x6E4F
+0x6E79 = 0x6E51
+0x6E7A = 0x6E53
+0x6E7B = 0x6E54
+0x6E7C = 0x6E57
+0x6E7D = 0x6E63
+0x6E7E = 0x3D1E
+0x6F21 = 0x6E93
+0x6F22 = 0x6EA7
+0x6F23 = 0x6EB4
+0x6F24 = 0x6EBF
+0x6F25 = 0x6EC3
+0x6F26 = 0x6ECA
+0x6F27 = 0x6ED9
+0x6F28 = 0x6F35
+0x6F29 = 0x6EEB
+0x6F2A = 0x6EF9
+0x6F2B = 0x6EFB
+0x6F2C = 0x6F0A
+0x6F2D = 0x6F0C
+0x6F2E = 0x6F18
+0x6F2F = 0x6F25
+0x6F30 = 0x6F36
+0x6F31 = 0x6F3C
+0x6F33 = 0x6F52
+0x6F34 = 0x6F57
+0x6F35 = 0x6F5A
+0x6F36 = 0x6F60
+0x6F37 = 0x6F68
+0x6F38 = 0x6F98
+0x6F39 = 0x6F7D
+0x6F3A = 0x6F90
+0x6F3B = 0x6F96
+0x6F3C = 0x6FBE
+0x6F3D = 0x6F9F
+0x6F3E = 0x6FA5
+0x6F3F = 0x6FAF
+0x6F40 = 0x3D64
+0x6F41 = 0x6FB5
+0x6F42 = 0x6FC8
+0x6F43 = 0x6FC9
+0x6F44 = 0x6FDA
+0x6F45 = 0x6FDE
+0x6F46 = 0x6FE9
+0x6F48 = 0x6FFC
+0x6F49 = 0x7000
+0x6F4A = 0x7007
+0x6F4B = 0x700A
+0x6F4C = 0x7023
+0x6F4E = 0x7039
+0x6F4F = 0x703A
+0x6F50 = 0x703C
+0x6F51 = 0x7043
+0x6F52 = 0x7047
+0x6F53 = 0x704B
+0x6F54 = 0x3D9A
+0x6F55 = 0x7054
+0x6F56 = 0x7065
+0x6F57 = 0x7069
+0x6F58 = 0x706C
+0x6F59 = 0x706E
+0x6F5A = 0x7076
+0x6F5B = 0x707E
+0x6F5C = 0x7081
+0x6F5D = 0x7086
+0x6F5E = 0x7095
+0x6F5F = 0x7097
+0x6F60 = 0x70BB
+0x6F62 = 0x709F
+0x6F63 = 0x70B1
+0x6F65 = 0x70EC
+0x6F66 = 0x70CA
+0x6F67 = 0x70D1
+0x6F68 = 0x70D3
+0x6F69 = 0x70DC
+0x6F6A = 0x7103
+0x6F6B = 0x7104
+0x6F6C = 0x7106
+0x6F6D = 0x7107
+0x6F6E = 0x7108
+0x6F6F = 0x710C
+0x6F70 = 0x3DC0
+0x6F71 = 0x712F
+0x6F72 = 0x7131
+0x6F73 = 0x7150
+0x6F74 = 0x714A
+0x6F75 = 0x7153
+0x6F76 = 0x715E
+0x6F77 = 0x3DD4
+0x6F78 = 0x7196
+0x6F79 = 0x7180
+0x6F7A = 0x719B
+0x6F7B = 0x71A0
+0x6F7C = 0x71A2
+0x6F7D = 0x71AE
+0x6F7E = 0x71AF
+0x7021 = 0x71B3
+0x7023 = 0x71CB
+0x7024 = 0x71D3
+0x7025 = 0x71D9
+0x7026 = 0x71DC
+0x7027 = 0x7207
+0x7028 = 0x3E05
+0x7029 = 0xFA49
+0x702A = 0x722B
+0x702B = 0x7234
+0x702C = 0x7238
+0x702D = 0x7239
+0x702E = 0x4E2C
+0x702F = 0x7242
+0x7030 = 0x7253
+0x7031 = 0x7257
+0x7032 = 0x7263
+0x7034 = 0x726E
+0x7035 = 0x726F
+0x7036 = 0x7278
+0x7037 = 0x727F
+0x7038 = 0x728E
+0x703A = 0x72AD
+0x703B = 0x72AE
+0x703C = 0x72B0
+0x703D = 0x72B1
+0x703E = 0x72C1
+0x703F = 0x3E60
+0x7040 = 0x72CC
+0x7041 = 0x3E66
+0x7042 = 0x3E68
+0x7043 = 0x72F3
+0x7044 = 0x72FA
+0x7045 = 0x7307
+0x7046 = 0x7312
+0x7047 = 0x7318
+0x7048 = 0x7319
+0x7049 = 0x3E83
+0x704A = 0x7339
+0x704B = 0x732C
+0x704C = 0x7331
+0x704D = 0x7333
+0x704E = 0x733D
+0x704F = 0x7352
+0x7050 = 0x3E94
+0x7051 = 0x736B
+0x7052 = 0x736C
+0x7054 = 0x736E
+0x7055 = 0x736F
+0x7056 = 0x7371
+0x7057 = 0x7377
+0x7058 = 0x7381
+0x7059 = 0x7385
+0x705A = 0x738A
+0x705B = 0x7394
+0x705C = 0x7398
+0x705D = 0x739C
+0x705E = 0x739E
+0x705F = 0x73A5
+0x7060 = 0x73A8
+0x7061 = 0x73B5
+0x7062 = 0x73B7
+0x7063 = 0x73B9
+0x7064 = 0x73BC
+0x7065 = 0x73BF
+0x7066 = 0x73C5
+0x7067 = 0x73CB
+0x7068 = 0x73E1
+0x7069 = 0x73E7
+0x706A = 0x73F9
+0x706B = 0x7413
+0x706C = 0x73FA
+0x706D = 0x7401
+0x706E = 0x7424
+0x706F = 0x7431
+0x7070 = 0x7439
+0x7071 = 0x7453
+0x7072 = 0x7440
+0x7073 = 0x7443
+0x7074 = 0x744D
+0x7075 = 0x7452
+0x7076 = 0x745D
+0x7077 = 0x7471
+0x7078 = 0x7481
+0x7079 = 0x7485
+0x707A = 0x7488
+0x707C = 0x7492
+0x707D = 0x7497
+0x707E = 0x7499
+0x7121 = 0x74A0
+0x7122 = 0x74A1
+0x7123 = 0x74A5
+0x7124 = 0x74AA
+0x7125 = 0x74AB
+0x7126 = 0x74B9
+0x7127 = 0x74BB
+0x7128 = 0x74BA
+0x7129 = 0x74D6
+0x712A = 0x74D8
+0x712B = 0x74DE
+0x712C = 0x74EF
+0x712D = 0x74EB
+0x712F = 0x74FA
+0x7131 = 0x7520
+0x7132 = 0x7524
+0x7133 = 0x752A
+0x7134 = 0x3F57
+0x7136 = 0x753D
+0x7137 = 0x753E
+0x7138 = 0x7540
+0x7139 = 0x7548
+0x713A = 0x754E
+0x713B = 0x7550
+0x713C = 0x7552
+0x713D = 0x756C
+0x713E = 0x7572
+0x713F = 0x7571
+0x7140 = 0x757A
+0x7141 = 0x757D
+0x7142 = 0x757E
+0x7143 = 0x7581
+0x7145 = 0x758C
+0x7146 = 0x3F75
+0x7147 = 0x75A2
+0x7148 = 0x3F77
+0x7149 = 0x75B0
+0x714A = 0x75B7
+0x714B = 0x75BF
+0x714C = 0x75C0
+0x714D = 0x75C6
+0x714E = 0x75CF
+0x714F = 0x75D3
+0x7150 = 0x75DD
+0x7151 = 0x75DF
+0x7152 = 0x75E0
+0x7153 = 0x75E7
+0x7154 = 0x75EC
+0x7155 = 0x75EE
+0x7156 = 0x75F1
+0x7157 = 0x75F9
+0x7158 = 0x7603
+0x7159 = 0x7618
+0x715A = 0x7607
+0x715B = 0x760F
+0x715C = 0x3FAE
+0x715E = 0x7613
+0x715F = 0x761B
+0x7160 = 0x761C
+0x7162 = 0x7625
+0x7163 = 0x7628
+0x7164 = 0x763C
+0x7165 = 0x7633
+0x7167 = 0x3FC9
+0x7168 = 0x7641
+0x716A = 0x7649
+0x716B = 0x7655
+0x716C = 0x3FD7
+0x716D = 0x766E
+0x716E = 0x7695
+0x716F = 0x769C
+0x7170 = 0x76A1
+0x7171 = 0x76A0
+0x7172 = 0x76A7
+0x7173 = 0x76A8
+0x7174 = 0x76AF
+0x7176 = 0x76C9
+0x7178 = 0x76E8
+0x7179 = 0x76EC
+0x717B = 0x7717
+0x717C = 0x771A
+0x717D = 0x772D
+0x717E = 0x7735
+0x7222 = 0x4039
+0x7225 = 0x7758
+0x7226 = 0x7760
+0x7227 = 0x776A
+0x7229 = 0x7772
+0x722A = 0x777C
+0x722B = 0x777D
+0x722D = 0x4058
+0x722E = 0x779A
+0x722F = 0x779F
+0x7230 = 0x77A2
+0x7231 = 0x77A4
+0x7232 = 0x77A9
+0x7233 = 0x77DE
+0x7234 = 0x77DF
+0x7235 = 0x77E4
+0x7236 = 0x77E6
+0x7237 = 0x77EA
+0x7238 = 0x77EC
+0x7239 = 0x4093
+0x723A = 0x77F0
+0x723B = 0x77F4
+0x723C = 0x77FB
+0x723E = 0x7805
+0x723F = 0x7806
+0x7240 = 0x7809
+0x7241 = 0x780D
+0x7242 = 0x7819
+0x7243 = 0x7821
+0x7244 = 0x782C
+0x7245 = 0x7847
+0x7246 = 0x7864
+0x7247 = 0x786A
+0x7249 = 0x788A
+0x724A = 0x7894
+0x724B = 0x78A4
+0x724C = 0x789D
+0x724D = 0x789E
+0x724E = 0x789F
+0x724F = 0x78BB
+0x7250 = 0x78C8
+0x7251 = 0x78CC
+0x7252 = 0x78CE
+0x7253 = 0x78D5
+0x7254 = 0x78E0
+0x7255 = 0x78E1
+0x7256 = 0x78E6
+0x7257 = 0x78F9
+0x7258 = 0x78FA
+0x7259 = 0x78FB
+0x725A = 0x78FE
+0x725C = 0x7910
+0x725D = 0x791B
+0x725E = 0x7930
+0x725F = 0x7925
+0x7260 = 0x793B
+0x7261 = 0x794A
+0x7262 = 0x7958
+0x7263 = 0x795B
+0x7264 = 0x4105
+0x7265 = 0x7967
+0x7266 = 0x7972
+0x7267 = 0x7994
+0x7268 = 0x7995
+0x7269 = 0x7996
+0x726A = 0x799B
+0x726B = 0x79A1
+0x726C = 0x79A9
+0x726D = 0x79B4
+0x726E = 0x79BB
+0x726F = 0x79C2
+0x7270 = 0x79C7
+0x7271 = 0x79CC
+0x7272 = 0x79CD
+0x7273 = 0x79D6
+0x7274 = 0x4148
+0x7277 = 0x414F
+0x7278 = 0x7A0A
+0x7279 = 0x7A11
+0x727A = 0x7A15
+0x727B = 0x7A1B
+0x727C = 0x7A1E
+0x727D = 0x4163
+0x727E = 0x7A2D
+0x7321 = 0x7A38
+0x7322 = 0x7A47
+0x7323 = 0x7A4C
+0x7324 = 0x7A56
+0x7325 = 0x7A59
+0x7326 = 0x7A5C
+0x7327 = 0x7A5F
+0x7328 = 0x7A60
+0x7329 = 0x7A67
+0x732A = 0x7A6A
+0x732B = 0x7A75
+0x732C = 0x7A78
+0x732D = 0x7A82
+0x732E = 0x7A8A
+0x732F = 0x7A90
+0x7330 = 0x7AA3
+0x7331 = 0x7AAC
+0x7333 = 0x41B4
+0x7334 = 0x7AB9
+0x7335 = 0x7ABC
+0x7336 = 0x7ABE
+0x7337 = 0x41BF
+0x7338 = 0x7ACC
+0x7339 = 0x7AD1
+0x733A = 0x7AE7
+0x733B = 0x7AE8
+0x733C = 0x7AF4
+0x733F = 0x7B07
+0x7341 = 0x7B3D
+0x7342 = 0x7B27
+0x7343 = 0x7B2A
+0x7344 = 0x7B2E
+0x7345 = 0x7B2F
+0x7346 = 0x7B31
+0x7347 = 0x41E6
+0x7348 = 0x41F3
+0x7349 = 0x7B7F
+0x734A = 0x7B41
+0x734B = 0x41EE
+0x734C = 0x7B55
+0x734D = 0x7B79
+0x734E = 0x7B64
+0x734F = 0x7B66
+0x7350 = 0x7B69
+0x7351 = 0x7B73
+0x7353 = 0x4207
+0x7354 = 0x7B90
+0x7355 = 0x7B91
+0x7356 = 0x7B9B
+0x7357 = 0x420E
+0x7358 = 0x7BAF
+0x7359 = 0x7BB5
+0x735A = 0x7BBC
+0x735B = 0x7BC5
+0x735C = 0x7BCA
+0x735F = 0x7BD4
+0x7360 = 0x7BD6
+0x7361 = 0x7BDA
+0x7362 = 0x7BEA
+0x7363 = 0x7BF0
+0x7364 = 0x7C03
+0x7365 = 0x7C0B
+0x7366 = 0x7C0E
+0x7367 = 0x7C0F
+0x7368 = 0x7C26
+0x7369 = 0x7C45
+0x736A = 0x7C4A
+0x736B = 0x7C51
+0x736C = 0x7C57
+0x736D = 0x7C5E
+0x736E = 0x7C61
+0x736F = 0x7C69
+0x7370 = 0x7C6E
+0x7371 = 0x7C6F
+0x7372 = 0x7C70
+0x7376 = 0x7CA6
+0x7378 = 0x7CB6
+0x7379 = 0x7CB7
+0x737A = 0x7CBF
+0x737C = 0x7CC4
+0x737E = 0x7CC8
+0x7421 = 0x7CCD
+0x7423 = 0x7CD7
+0x7425 = 0x7CE6
+0x7426 = 0x7CEB
+0x7428 = 0x7CF5
+0x7429 = 0x7D03
+0x742A = 0x7D09
+0x742B = 0x42C6
+0x742C = 0x7D12
+0x742D = 0x7D1E
+0x7430 = 0x7D3D
+0x7431 = 0x7D3E
+0x7432 = 0x7D40
+0x7433 = 0x7D47
+0x7436 = 0x42D6
+0x7437 = 0x7D59
+0x7438 = 0x7D5A
+0x7439 = 0x7D6A
+0x743A = 0x7D70
+0x743B = 0x42DD
+0x743C = 0x7D7F
+0x743E = 0x7D86
+0x743F = 0x7D88
+0x7440 = 0x7D8C
+0x7441 = 0x7D97
+0x7443 = 0x7D9D
+0x7444 = 0x7DA7
+0x7445 = 0x7DAA
+0x7446 = 0x7DB6
+0x7447 = 0x7DB7
+0x7448 = 0x7DC0
+0x7449 = 0x7DD7
+0x744A = 0x7DD9
+0x744B = 0x7DE6
+0x744C = 0x7DF1
+0x744D = 0x7DF9
+0x744E = 0x4302
+0x7450 = 0xFA58
+0x7451 = 0x7E10
+0x7452 = 0x7E17
+0x7453 = 0x7E1D
+0x7454 = 0x7E20
+0x7455 = 0x7E27
+0x7456 = 0x7E2C
+0x7457 = 0x7E45
+0x7458 = 0x7E73
+0x7459 = 0x7E75
+0x745A = 0x7E7E
+0x745B = 0x7E86
+0x745C = 0x7E87
+0x745D = 0x432B
+0x745E = 0x7E91
+0x745F = 0x7E98
+0x7460 = 0x7E9A
+0x7461 = 0x4343
+0x7462 = 0x7F3C
+0x7463 = 0x7F3B
+0x7464 = 0x7F3E
+0x7465 = 0x7F43
+0x7466 = 0x7F44
+0x7467 = 0x7F4F
+0x7468 = 0x34C1
+0x746A = 0x7F52
+0x746C = 0x7F61
+0x746D = 0x7F63
+0x746E = 0x7F64
+0x746F = 0x7F6D
+0x7470 = 0x7F7D
+0x7471 = 0x7F7E
+0x7473 = 0x7F90
+0x7474 = 0x517B
+0x7476 = 0x7F96
+0x7477 = 0x7F9C
+0x7478 = 0x7FAD
+0x747A = 0x7FC3
+0x747B = 0x7FCF
+0x747C = 0x7FE3
+0x747D = 0x7FE5
+0x747E = 0x7FEF
+0x7521 = 0x7FF2
+0x7522 = 0x8002
+0x7523 = 0x800A
+0x7524 = 0x8008
+0x7525 = 0x800E
+0x7526 = 0x8011
+0x7527 = 0x8016
+0x7528 = 0x8024
+0x7529 = 0x802C
+0x752A = 0x8030
+0x752B = 0x8043
+0x752C = 0x8066
+0x752D = 0x8071
+0x752E = 0x8075
+0x752F = 0x807B
+0x7530 = 0x8099
+0x7531 = 0x809C
+0x7532 = 0x80A4
+0x7533 = 0x80A7
+0x7534 = 0x80B8
+0x7536 = 0x80C5
+0x7537 = 0x80D5
+0x7538 = 0x80D8
+0x7539 = 0x80E6
+0x753B = 0x810D
+0x753C = 0x80F5
+0x753D = 0x80FB
+0x753E = 0x43EE
+0x753F = 0x8135
+0x7540 = 0x8116
+0x7541 = 0x811E
+0x7542 = 0x43F0
+0x7543 = 0x8124
+0x7544 = 0x8127
+0x7545 = 0x812C
+0x7547 = 0x813D
+0x7548 = 0x4408
+0x7549 = 0x8169
+0x754A = 0x4417
+0x754B = 0x8181
+0x754C = 0x441C
+0x754D = 0x8184
+0x754E = 0x8185
+0x754F = 0x4422
+0x7550 = 0x8198
+0x7551 = 0x81B2
+0x7552 = 0x81C1
+0x7553 = 0x81C3
+0x7554 = 0x81D6
+0x7555 = 0x81DB
+0x7557 = 0x81E4
+0x7559 = 0x81EC
+0x755B = 0x81FD
+0x755C = 0x81FF
+0x755E = 0x8204
+0x7560 = 0x8219
+0x7561 = 0x8221
+0x7562 = 0x8222
+0x7564 = 0x8232
+0x7565 = 0x8234
+0x7566 = 0x823C
+0x7567 = 0x8246
+0x7568 = 0x8249
+0x7569 = 0x8245
+0x756B = 0x824B
+0x756C = 0x4476
+0x756D = 0x824F
+0x756E = 0x447A
+0x756F = 0x8257
+0x7571 = 0x825C
+0x7572 = 0x8263
+0x7574 = 0xFA5D
+0x7575 = 0xFA5E
+0x7576 = 0x8279
+0x7577 = 0x4491
+0x7578 = 0x827D
+0x7579 = 0x827F
+0x757A = 0x8283
+0x757B = 0x828A
+0x757C = 0x8293
+0x757D = 0x82A7
+0x757E = 0x82A8
+0x7621 = 0x82B2
+0x7622 = 0x82B4
+0x7623 = 0x82BA
+0x7624 = 0x82BC
+0x7625 = 0x82E2
+0x7626 = 0x82E8
+0x7627 = 0x82F7
+0x7628 = 0x8307
+0x7629 = 0x8308
+0x762A = 0x830C
+0x762B = 0x8354
+0x762C = 0x831B
+0x762D = 0x831D
+0x762E = 0x8330
+0x762F = 0x833C
+0x7630 = 0x8344
+0x7631 = 0x8357
+0x7632 = 0x44BE
+0x7633 = 0x837F
+0x7634 = 0x44D4
+0x7635 = 0x44B3
+0x7636 = 0x838D
+0x7637 = 0x8394
+0x7638 = 0x8395
+0x7639 = 0x839B
+0x763A = 0x839D
+0x763B = 0x83C9
+0x763C = 0x83D0
+0x763D = 0x83D4
+0x763E = 0x83DD
+0x763F = 0x83E5
+0x7640 = 0x83F9
+0x7641 = 0x840F
+0x7642 = 0x8411
+0x7643 = 0x8415
+0x7645 = 0x8417
+0x7646 = 0x8439
+0x7647 = 0x844A
+0x7648 = 0x844F
+0x7649 = 0x8451
+0x764A = 0x8452
+0x764B = 0x8459
+0x764C = 0x845A
+0x764D = 0x845C
+0x764F = 0x8465
+0x7650 = 0x8476
+0x7651 = 0x8478
+0x7652 = 0x847C
+0x7653 = 0x8481
+0x7654 = 0x450D
+0x7655 = 0x84DC
+0x7656 = 0x8497
+0x7657 = 0x84A6
+0x7658 = 0x84BE
+0x7659 = 0x4508
+0x765A = 0x84CE
+0x765B = 0x84CF
+0x765C = 0x84D3
+0x765E = 0x84E7
+0x765F = 0x84EA
+0x7660 = 0x84EF
+0x7661 = 0x84F0
+0x7662 = 0x84F1
+0x7663 = 0x84FA
+0x7664 = 0x84FD
+0x7665 = 0x850C
+0x7666 = 0x851B
+0x7667 = 0x8524
+0x7668 = 0x8525
+0x7669 = 0x852B
+0x766A = 0x8534
+0x766B = 0x854F
+0x766C = 0x856F
+0x766D = 0x4525
+0x766E = 0x4543
+0x766F = 0x853E
+0x7670 = 0x8551
+0x7671 = 0x8553
+0x7672 = 0x855E
+0x7673 = 0x8561
+0x7674 = 0x8562
+0x7676 = 0x857B
+0x7677 = 0x857D
+0x7678 = 0x857F
+0x7679 = 0x8581
+0x767A = 0x8586
+0x767B = 0x8593
+0x767C = 0x859D
+0x767D = 0x859F
+0x7723 = 0x85B7
+0x7724 = 0x85BC
+0x7725 = 0x85C7
+0x7726 = 0x85CA
+0x7727 = 0x85D8
+0x7728 = 0x85D9
+0x7729 = 0x85DF
+0x772A = 0x85E1
+0x772B = 0x85E6
+0x772C = 0x85F6
+0x772D = 0x8600
+0x772E = 0x8611
+0x772F = 0x861E
+0x7730 = 0x8621
+0x7731 = 0x8624
+0x7732 = 0x8627
+0x7734 = 0x8639
+0x7735 = 0x863C
+0x7737 = 0x8640
+0x7738 = 0xFA20
+0x7739 = 0x8653
+0x773A = 0x8656
+0x773B = 0x866F
+0x773C = 0x8677
+0x773D = 0x867A
+0x773E = 0x8687
+0x773F = 0x8689
+0x7740 = 0x868D
+0x7741 = 0x8691
+0x7742 = 0x869C
+0x7743 = 0x869D
+0x7744 = 0x86A8
+0x7745 = 0xFA21
+0x7746 = 0x86B1
+0x7747 = 0x86B3
+0x7748 = 0x86C1
+0x7749 = 0x86C3
+0x774A = 0x86D1
+0x774B = 0x86D5
+0x774C = 0x86D7
+0x774D = 0x86E3
+0x774E = 0x86E6
+0x774F = 0x45B8
+0x7750 = 0x8705
+0x7751 = 0x8707
+0x7752 = 0x870E
+0x7753 = 0x8710
+0x7754 = 0x8713
+0x7755 = 0x8719
+0x7756 = 0x871F
+0x7757 = 0x8721
+0x7758 = 0x8723
+0x7759 = 0x8731
+0x775A = 0x873A
+0x775B = 0x873E
+0x775C = 0x8740
+0x775D = 0x8743
+0x775E = 0x8751
+0x775F = 0x8758
+0x7760 = 0x8764
+0x7761 = 0x8765
+0x7762 = 0x8772
+0x7763 = 0x877C
+0x7766 = 0x87A7
+0x7767 = 0x8789
+0x7768 = 0x878B
+0x7769 = 0x8793
+0x776A = 0x87A0
+0x776C = 0x45E5
+0x776D = 0x87BE
+0x776F = 0x87C1
+0x7770 = 0x87CE
+0x7771 = 0x87F5
+0x7772 = 0x87DF
+0x7774 = 0x87E3
+0x7775 = 0x87E5
+0x7776 = 0x87E6
+0x7777 = 0x87EA
+0x7778 = 0x87EB
+0x7779 = 0x87ED
+0x777A = 0x8801
+0x777B = 0x8803
+0x777C = 0x880B
+0x777D = 0x8813
+0x777E = 0x8828
+0x7821 = 0x882E
+0x7822 = 0x8832
+0x7823 = 0x883C
+0x7824 = 0x460F
+0x7825 = 0x884A
+0x7826 = 0x8858
+0x7827 = 0x885F
+0x7828 = 0x8864
+0x782B = 0x8869
+0x782D = 0x886F
+0x782E = 0x88A0
+0x782F = 0x88BC
+0x7830 = 0x88BD
+0x7831 = 0x88BE
+0x7832 = 0x88C0
+0x7833 = 0x88D2
+0x7835 = 0x88D1
+0x7836 = 0x88D3
+0x7837 = 0x88DB
+0x7838 = 0x88F0
+0x7839 = 0x88F1
+0x783A = 0x4641
+0x783B = 0x8901
+0x783D = 0x8937
+0x783F = 0x8942
+0x7840 = 0x8945
+0x7841 = 0x8949
+0x7843 = 0x4665
+0x7844 = 0x8962
+0x7845 = 0x8980
+0x7846 = 0x8989
+0x7847 = 0x8990
+0x7848 = 0x899F
+0x7849 = 0x89B0
+0x784A = 0x89B7
+0x784B = 0x89D6
+0x784C = 0x89D8
+0x784D = 0x89EB
+0x784E = 0x46A1
+0x784F = 0x89F1
+0x7850 = 0x89F3
+0x7851 = 0x89FD
+0x7852 = 0x89FF
+0x7853 = 0x46AF
+0x7854 = 0x8A11
+0x7855 = 0x8A14
+0x7857 = 0x8A21
+0x7858 = 0x8A35
+0x7859 = 0x8A3E
+0x785A = 0x8A45
+0x785B = 0x8A4D
+0x785C = 0x8A58
+0x785D = 0x8AAE
+0x785E = 0x8A90
+0x785F = 0x8AB7
+0x7860 = 0x8ABE
+0x7861 = 0x8AD7
+0x7862 = 0x8AFC
+0x7864 = 0x8B0A
+0x7865 = 0x8B05
+0x7866 = 0x8B0D
+0x7867 = 0x8B1C
+0x7868 = 0x8B1F
+0x7869 = 0x8B2D
+0x786A = 0x8B43
+0x786B = 0x470C
+0x786C = 0x8B51
+0x786D = 0x8B5E
+0x786E = 0x8B76
+0x786F = 0x8B7F
+0x7870 = 0x8B81
+0x7871 = 0x8B8B
+0x7872 = 0x8B94
+0x7873 = 0x8B95
+0x7874 = 0x8B9C
+0x7875 = 0x8B9E
+0x7876 = 0x8C39
+0x7878 = 0x8C3D
+0x787B = 0x8C45
+0x787C = 0x8C47
+0x787D = 0x8C4F
+0x787E = 0x8C54
+0x7921 = 0x8C57
+0x7922 = 0x8C69
+0x7923 = 0x8C6D
+0x7924 = 0x8C73
+0x7926 = 0x8C93
+0x7927 = 0x8C92
+0x7928 = 0x8C99
+0x7929 = 0x4764
+0x792A = 0x8C9B
+0x792B = 0x8CA4
+0x792C = 0x8CD6
+0x792D = 0x8CD5
+0x792E = 0x8CD9
+0x7930 = 0x8CF0
+0x7931 = 0x8CF1
+0x7933 = 0x8D09
+0x7934 = 0x8D0E
+0x7935 = 0x8D6C
+0x7936 = 0x8D84
+0x7937 = 0x8D95
+0x7938 = 0x8DA6
+0x793A = 0x8DC6
+0x793B = 0x8DC8
+0x793C = 0x8DD9
+0x793D = 0x8DEC
+0x793E = 0x8E0C
+0x793F = 0x47FD
+0x7940 = 0x8DFD
+0x7941 = 0x8E06
+0x7943 = 0x8E14
+0x7944 = 0x8E16
+0x7945 = 0x8E21
+0x7946 = 0x8E22
+0x7947 = 0x8E27
+0x7949 = 0x4816
+0x794A = 0x8E36
+0x794B = 0x8E39
+0x794C = 0x8E4B
+0x794D = 0x8E54
+0x794E = 0x8E62
+0x794F = 0x8E6C
+0x7950 = 0x8E6D
+0x7951 = 0x8E6F
+0x7952 = 0x8E98
+0x7953 = 0x8E9E
+0x7954 = 0x8EAE
+0x7955 = 0x8EB3
+0x7956 = 0x8EB5
+0x7957 = 0x8EB6
+0x7958 = 0x8EBB
+0x795A = 0x8ED1
+0x795B = 0x8ED4
+0x795C = 0x484E
+0x795D = 0x8EF9
+0x795F = 0x8F00
+0x7960 = 0x8F08
+0x7961 = 0x8F17
+0x7962 = 0x8F2B
+0x7963 = 0x8F40
+0x7964 = 0x8F4A
+0x7965 = 0x8F58
+0x7967 = 0x8FA4
+0x7968 = 0x8FB4
+0x7969 = 0xFA66
+0x796A = 0x8FB6
+0x796C = 0x8FC1
+0x796D = 0x8FC6
+0x796E = 0xFA24
+0x796F = 0x8FCA
+0x7970 = 0x8FCD
+0x7971 = 0x8FD3
+0x7972 = 0x8FD5
+0x7973 = 0x8FE0
+0x7974 = 0x8FF1
+0x7975 = 0x8FF5
+0x7976 = 0x8FFB
+0x7977 = 0x9002
+0x7978 = 0x900C
+0x7979 = 0x9037
+0x797B = 0x9043
+0x797C = 0x9044
+0x797D = 0x905D
+0x7A22 = 0x9085
+0x7A23 = 0x908C
+0x7A24 = 0x9090
+0x7A25 = 0x961D
+0x7A26 = 0x90A1
+0x7A27 = 0x48B5
+0x7A28 = 0x90B0
+0x7A29 = 0x90B6
+0x7A2A = 0x90C3
+0x7A2B = 0x90C8
+0x7A2D = 0x90DC
+0x7A2E = 0x90DF
+0x7A30 = 0x90F6
+0x7A31 = 0x90F2
+0x7A32 = 0x9100
+0x7A33 = 0x90EB
+0x7A34 = 0x90FE
+0x7A35 = 0x90FF
+0x7A36 = 0x9104
+0x7A37 = 0x9106
+0x7A38 = 0x9118
+0x7A39 = 0x911C
+0x7A3A = 0x911E
+0x7A3B = 0x9137
+0x7A3C = 0x9139
+0x7A3D = 0x913A
+0x7A3E = 0x9146
+0x7A3F = 0x9147
+0x7A40 = 0x9157
+0x7A41 = 0x9159
+0x7A42 = 0x9161
+0x7A43 = 0x9164
+0x7A44 = 0x9174
+0x7A45 = 0x9179
+0x7A46 = 0x9185
+0x7A47 = 0x918E
+0x7A48 = 0x91A8
+0x7A49 = 0x91AE
+0x7A4A = 0x91B3
+0x7A4B = 0x91B6
+0x7A4C = 0x91C3
+0x7A4D = 0x91C4
+0x7A4E = 0x91DA
+0x7A51 = 0x91EC
+0x7A52 = 0x91EE
+0x7A53 = 0x9201
+0x7A54 = 0x920A
+0x7A55 = 0x9216
+0x7A56 = 0x9217
+0x7A58 = 0x9233
+0x7A59 = 0x9242
+0x7A5A = 0x9247
+0x7A5B = 0x924A
+0x7A5C = 0x924E
+0x7A5D = 0x9251
+0x7A5E = 0x9256
+0x7A5F = 0x9259
+0x7A60 = 0x9260
+0x7A61 = 0x9261
+0x7A62 = 0x9265
+0x7A63 = 0x9267
+0x7A64 = 0x9268
+0x7A67 = 0x927C
+0x7A68 = 0x927D
+0x7A69 = 0x927F
+0x7A6A = 0x9289
+0x7A6B = 0x928D
+0x7A6C = 0x9297
+0x7A6D = 0x9299
+0x7A6E = 0x929F
+0x7A6F = 0x92A7
+0x7A70 = 0x92AB
+0x7A73 = 0x92B2
+0x7A74 = 0x92BF
+0x7A75 = 0x92C0
+0x7A76 = 0x92C6
+0x7A77 = 0x92CE
+0x7A78 = 0x92D0
+0x7A79 = 0x92D7
+0x7A7A = 0x92D9
+0x7A7B = 0x92E5
+0x7A7C = 0x92E7
+0x7A7D = 0x9311
+0x7B22 = 0x92F7
+0x7B23 = 0x92F9
+0x7B24 = 0x92FB
+0x7B25 = 0x9302
+0x7B26 = 0x930D
+0x7B27 = 0x9315
+0x7B28 = 0x931D
+0x7B29 = 0x931E
+0x7B2A = 0x9327
+0x7B2B = 0x9329
+0x7B2E = 0x9347
+0x7B2F = 0x9351
+0x7B30 = 0x9357
+0x7B31 = 0x935A
+0x7B32 = 0x936B
+0x7B33 = 0x9371
+0x7B34 = 0x9373
+0x7B35 = 0x93A1
+0x7B38 = 0x9388
+0x7B39 = 0x938B
+0x7B3A = 0x938F
+0x7B3B = 0x939E
+0x7B3C = 0x93F5
+0x7B3F = 0x93F1
+0x7B40 = 0x93C1
+0x7B41 = 0x93C7
+0x7B42 = 0x93DC
+0x7B43 = 0x93E2
+0x7B44 = 0x93E7
+0x7B45 = 0x9409
+0x7B46 = 0x940F
+0x7B47 = 0x9416
+0x7B48 = 0x9417
+0x7B49 = 0x93FB
+0x7B4A = 0x9432
+0x7B4B = 0x9434
+0x7B4C = 0x943B
+0x7B4D = 0x9445
+0x7B50 = 0x946D
+0x7B51 = 0x946F
+0x7B52 = 0x9578
+0x7B53 = 0x9579
+0x7B54 = 0x9586
+0x7B55 = 0x958C
+0x7B56 = 0x958D
+0x7B58 = 0x95AB
+0x7B59 = 0x95B4
+0x7B5B = 0x95C8
+0x7B5E = 0x962C
+0x7B5F = 0x9633
+0x7B60 = 0x9634
+0x7B62 = 0x963C
+0x7B63 = 0x9641
+0x7B64 = 0x9661
+0x7B66 = 0x9682
+0x7B68 = 0x969A
+0x7B6A = 0x49E7
+0x7B6B = 0x96A9
+0x7B6C = 0x96AF
+0x7B6D = 0x96B3
+0x7B6E = 0x96BA
+0x7B6F = 0x96BD
+0x7B70 = 0x49FA
+0x7B72 = 0x96D8
+0x7B73 = 0x96DA
+0x7B74 = 0x96DD
+0x7B75 = 0x4A04
+0x7B76 = 0x9714
+0x7B77 = 0x9723
+0x7B78 = 0x4A29
+0x7B79 = 0x9736
+0x7B7A = 0x9741
+0x7B7B = 0x9747
+0x7B7C = 0x9755
+0x7B7D = 0x9757
+0x7B7E = 0x975B
+0x7C21 = 0x976A
+0x7C24 = 0x9796
+0x7C25 = 0x979A
+0x7C26 = 0x979E
+0x7C27 = 0x97A2
+0x7C28 = 0x97B1
+0x7C29 = 0x97B2
+0x7C2A = 0x97BE
+0x7C2B = 0x97CC
+0x7C2C = 0x97D1
+0x7C2D = 0x97D4
+0x7C2E = 0x97D8
+0x7C2F = 0x97D9
+0x7C30 = 0x97E1
+0x7C31 = 0x97F1
+0x7C32 = 0x9804
+0x7C33 = 0x980D
+0x7C34 = 0x980E
+0x7C35 = 0x9814
+0x7C36 = 0x9816
+0x7C37 = 0x4ABC
+0x7C39 = 0x9823
+0x7C3A = 0x9832
+0x7C3B = 0x9833
+0x7C3C = 0x9825
+0x7C3D = 0x9847
+0x7C3E = 0x9866
+0x7C3F = 0x98AB
+0x7C40 = 0x98AD
+0x7C41 = 0x98B0
+0x7C43 = 0x98B7
+0x7C44 = 0x98B8
+0x7C45 = 0x98BB
+0x7C46 = 0x98BC
+0x7C47 = 0x98BF
+0x7C48 = 0x98C2
+0x7C49 = 0x98C7
+0x7C4A = 0x98CB
+0x7C4B = 0x98E0
+0x7C4D = 0x98E1
+0x7C4E = 0x98E3
+0x7C4F = 0x98E5
+0x7C50 = 0x98EA
+0x7C51 = 0x98F0
+0x7C52 = 0x98F1
+0x7C53 = 0x98F3
+0x7C54 = 0x9908
+0x7C55 = 0x4B3B
+0x7C57 = 0x9916
+0x7C58 = 0x9917
+0x7C5A = 0x991A
+0x7C5B = 0x991B
+0x7C5C = 0x991C
+0x7C5E = 0x9931
+0x7C5F = 0x9932
+0x7C60 = 0x9933
+0x7C61 = 0x993A
+0x7C62 = 0x993B
+0x7C63 = 0x993C
+0x7C64 = 0x9940
+0x7C65 = 0x9941
+0x7C66 = 0x9946
+0x7C67 = 0x994D
+0x7C68 = 0x994E
+0x7C69 = 0x995C
+0x7C6A = 0x995F
+0x7C6B = 0x9960
+0x7C6C = 0x99A3
+0x7C6D = 0x99A6
+0x7C6E = 0x99B9
+0x7C6F = 0x99BD
+0x7C70 = 0x99BF
+0x7C71 = 0x99C3
+0x7C72 = 0x99C9
+0x7C73 = 0x99D4
+0x7C74 = 0x99D9
+0x7C75 = 0x99DE
+0x7C77 = 0x99F0
+0x7C78 = 0x99F9
+0x7C79 = 0x99FC
+0x7C7A = 0x9A0A
+0x7C7B = 0x9A11
+0x7C7C = 0x9A16
+0x7C7D = 0x9A1A
+0x7C7E = 0x9A20
+0x7D21 = 0x9A31
+0x7D22 = 0x9A36
+0x7D23 = 0x9A44
+0x7D24 = 0x9A4C
+0x7D25 = 0x9A58
+0x7D26 = 0x4BC2
+0x7D27 = 0x9AAF
+0x7D28 = 0x4BCA
+0x7D29 = 0x9AB7
+0x7D2A = 0x4BD2
+0x7D2B = 0x9AB9
+0x7D2D = 0x9AC6
+0x7D2E = 0x9AD0
+0x7D2F = 0x9AD2
+0x7D30 = 0x9AD5
+0x7D31 = 0x4BE8
+0x7D32 = 0x9ADC
+0x7D33 = 0x9AE0
+0x7D34 = 0x9AE5
+0x7D35 = 0x9AE9
+0x7D36 = 0x9B03
+0x7D37 = 0x9B0C
+0x7D38 = 0x9B10
+0x7D39 = 0x9B12
+0x7D3A = 0x9B16
+0x7D3B = 0x9B1C # 0x9B1D
+0x7D3C = 0x9B2B
+0x7D3D = 0x9B33
+0x7D3E = 0x9B3D
+0x7D3F = 0x4C20
+0x7D40 = 0x9B4B
+0x7D41 = 0x9B63
+0x7D42 = 0x9B65
+0x7D43 = 0x9B6B
+0x7D44 = 0x9B6C
+0x7D45 = 0x9B73
+0x7D46 = 0x9B76
+0x7D47 = 0x9B77
+0x7D48 = 0x9BA6
+0x7D49 = 0x9BAC
+0x7D4A = 0x9BB1
+0x7D4D = 0x9BB2
+0x7D4E = 0x9BB8
+0x7D4F = 0x9BBE
+0x7D50 = 0x9BC7
+0x7D51 = 0x9BF3
+0x7D52 = 0x9BD8
+0x7D53 = 0x9BDD
+0x7D54 = 0x9BE7
+0x7D55 = 0x9BEA
+0x7D56 = 0x9BEB
+0x7D57 = 0x9BEF
+0x7D58 = 0x9BEE
+0x7D5A = 0x9BFA
+0x7D5C = 0x9BF7
+0x7D5E = 0x9C16
+0x7D5F = 0x9C18
+0x7D60 = 0x9C19
+0x7D61 = 0x9C1A
+0x7D62 = 0x9C1D
+0x7D63 = 0x9C22
+0x7D64 = 0x9C27
+0x7D65 = 0x9C29
+0x7D66 = 0x9C2A
+0x7D68 = 0x9C31
+0x7D69 = 0x9C36
+0x7D6A = 0x9C37
+0x7D6B = 0x9C45
+0x7D6C = 0x9C5C
+0x7D6E = 0x9C49
+0x7D6F = 0x9C4A
+0x7D71 = 0x9C54
+0x7D72 = 0x9C58
+0x7D73 = 0x9C5B
+0x7D74 = 0x9C5D
+0x7D75 = 0x9C5F
+0x7D76 = 0x9C69
+0x7D77 = 0x9C6A
+0x7D78 = 0x9C6B
+0x7D79 = 0x9C6D
+0x7D7A = 0x9C6E
+0x7D7B = 0x9C70
+0x7D7C = 0x9C72
+0x7D7D = 0x9C75
+0x7D7E = 0x9C7A
+0x7E21 = 0x9CE6
+0x7E22 = 0x9CF2
+0x7E23 = 0x9D0B
+0x7E24 = 0x9D02
+0x7E26 = 0x9D11
+0x7E27 = 0x9D17
+0x7E28 = 0x9D18
+0x7E2A = 0x4CC4
+0x7E2C = 0x9D32
+0x7E2D = 0x4CD1
+0x7E2E = 0x9D42
+0x7E2F = 0x9D4A
+0x7E30 = 0x9D5F
+0x7E31 = 0x9D62
+0x7E33 = 0x9D69
+0x7E34 = 0x9D6B
+0x7E36 = 0x9D73
+0x7E37 = 0x9D76
+0x7E38 = 0x9D77
+0x7E39 = 0x9D7E
+0x7E3A = 0x9D84
+0x7E3B = 0x9D8D
+0x7E3C = 0x9D99
+0x7E3D = 0x9DA1
+0x7E3E = 0x9DBF
+0x7E3F = 0x9DB5
+0x7E40 = 0x9DB9
+0x7E41 = 0x9DBD
+0x7E42 = 0x9DC3
+0x7E43 = 0x9DC7
+0x7E44 = 0x9DC9
+0x7E45 = 0x9DD6
+0x7E46 = 0x9DDA
+0x7E47 = 0x9DDF
+0x7E48 = 0x9DE0
+0x7E49 = 0x9DE3
+0x7E4A = 0x9DF4
+0x7E4B = 0x4D07
+0x7E4C = 0x9E0A
+0x7E4D = 0x9E02
+0x7E4E = 0x9E0D
+0x7E4F = 0x9E19
+0x7E50 = 0x9E1C
+0x7E51 = 0x9E1D
+0x7E52 = 0x9E7B
+0x7E54 = 0x9E80
+0x7E55 = 0x9E85
+0x7E56 = 0x9E9B
+0x7E57 = 0x9EA8
+0x7E59 = 0x9EBD
+0x7E5B = 0x9EDF
+0x7E5C = 0x9EE7
+0x7E5D = 0x9EEE
+0x7E5E = 0x9EFF
+0x7E5F = 0x9F02
+0x7E60 = 0x4D77
+0x7E61 = 0x9F03
+0x7E62 = 0x9F17
+0x7E63 = 0x9F19
+0x7E64 = 0x9F2F
+0x7E65 = 0x9F37
+0x7E66 = 0x9F3A
+0x7E67 = 0x9F3D
+0x7E68 = 0x9F41
+0x7E69 = 0x9F45
+0x7E6A = 0x9F46
+0x7E6B = 0x9F53
+0x7E6C = 0x9F55
+0x7E6D = 0x9F58
+0x7E6F = 0x9F5D
+0x7E71 = 0x9F69
+0x7E73 = 0x9F6D
+0x7E74 = 0x9F70
+0x7E75 = 0x9F75
+END_MAP
diff --git a/enc/trans/JIS/JISX0213-2%UCS@SIP.src b/enc/trans/JIS/JISX0213-2%UCS@SIP.src
new file mode 100644
index 0000000000..15f8d317e6
--- /dev/null
+++ b/enc/trans/JIS/JISX0213-2%UCS@SIP.src
@@ -0,0 +1,311 @@
+# $NetBSD: JISX0213-2%UCS@SIP.src,v 1.1 2007/03/05 16:58:33 tnozaki Exp $
+
+TYPE ROWCOL
+NAME "JISX0213-2/UCS:SIP"
+SRC_ZONE 0x21-0x7E / 0x21-0x7E / 8
+OOB_MODE INVALID
+DST_INVALID 0xFFFE
+DST_UNIT_BITS 16
+
+BEGIN_MAP
+## JIS X 0213:2004 vs Unicode mapping table
+##
+## Date: 22 May 2006
+## License:
+## Copyright (C) 2001 earthian@tama.or.jp, All Rights Reserved.
+## Copyright (C) 2001 I'O, All Rights Reserved.
+## Copyright (C) 2006 Project X0213, All Rights Reserved.
+## You can use, modify, distribute this table freely.
+## Note:
+## 3-XXXX JIS X 0213:2004 plane 1 (GL encoding)
+## 4-XXXX JIS X 0213:2000 plane 2 (GL encoding)
+## [1983] JIS codepoint defined by JIS X 0208-1983
+## [1990] JIS codepoint defined by JIS X 0208-1990
+## [2000] JIS codepoint defined by JIS X 0213:2000
+## [2004] JIS codepoint defined by JIS X 0213:2004
+## [Unicode3.1] UCS codepoint defined by Unicode 3.1
+## [Unicode3.2] UCS codepoint defined by Unicode 3.2
+## Fullwidth UCS fullwidth form (U+Fxxx)
+## Windows Windows (CP932) mapping
+## Some 0213 character can't represent by one UCS character.
+## In this table, such characters are described as 'U+xxxx+xxxx'.
+##
+## JIS Unicode Name Note
+0x2121 = 0x0089
+0x212B = 0x00A2
+0x212E = 0x00A4
+0x2136 = 0x01A2
+0x2146 = 0x0213
+0x2170 = 0x032B
+0x2177 = 0x0381
+0x2179 = 0x0371
+0x2322 = 0x03F9
+0x2325 = 0x044A
+0x2327 = 0x0509
+0x2331 = 0x05D6
+0x2332 = 0x0628
+0x2338 = 0x074F
+0x233F = 0x0807
+0x2341 = 0x083A
+0x234A = 0x08B9
+0x2352 = 0x097C
+0x2353 = 0x099D
+0x2359 = 0x0AD3
+0x235C = 0x0B1D
+0x2377 = 0x0D45
+0x242A = 0x0DE1
+0x2431 = 0x0E95
+0x2432 = 0x0E6D
+0x243A = 0x0E64
+0x243D = 0x0F5F
+0x2459 = 0x1201
+0x245C = 0x1255
+0x245E = 0x127B
+0x2463 = 0x1274
+0x246A = 0x12E4
+0x246B = 0x12D7
+0x2472 = 0x12FD
+0x2474 = 0x1336
+0x2475 = 0x1344
+0x2525 = 0x13C4
+0x2532 = 0x146D
+0x253E = 0x15D7
+0x2544 = 0x6C29
+0x2547 = 0x1647
+0x2555 = 0x1706
+0x2556 = 0x1742
+0x257E = 0x19C3
+0x2830 = 0x1C56
+0x2837 = 0x1D2D
+0x2838 = 0x1D45
+0x283A = 0x1D78
+0x283B = 0x1D62
+0x283F = 0x1DA1
+0x2840 = 0x1D9C
+0x2845 = 0x1D92
+0x2848 = 0x1DB7
+0x284A = 0x1DE0
+0x284B = 0x1E33
+0x285B = 0x1F1E
+0x2866 = 0x1F76
+0x286C = 0x1FFA
+0x2C22 = 0x217B
+0x2C2B = 0x231E
+0x2C30 = 0x23AD
+0x2C50 = 0x26F3
+0x2C65 = 0x285B
+0x2C6D = 0x28AB
+0x2C72 = 0x298F
+0x2D24 = 0x2AB8
+0x2D29 = 0x2B4F
+0x2D2A = 0x2B50
+0x2D32 = 0x2B46
+0x2D34 = 0x2C1D
+0x2D35 = 0x2BA6
+0x2D39 = 0x2C24
+0x2D56 = 0x2DE1
+0x2D7D = 0x31C3
+0x2E23 = 0x31F5
+0x2E24 = 0x31B6
+0x2E3A = 0x3372
+0x2E3C = 0x33D3
+0x2E3D = 0x33D2
+0x2E42 = 0x33D0
+0x2E43 = 0x33E4
+0x2E44 = 0x33D5
+0x2E47 = 0x33DA
+0x2E49 = 0x33DF
+0x2E55 = 0x344A
+0x2E56 = 0x3451
+0x2E57 = 0x344B
+0x2E5B = 0x3465
+0x2E77 = 0x34E4
+0x2E78 = 0x355A
+0x2F2A = 0x3594
+0x2F3F = 0x3639
+0x2F40 = 0x3647
+0x2F42 = 0x3638
+0x2F43 = 0x363A
+0x2F4E = 0x371C
+0x2F59 = 0x370C
+0x2F61 = 0x3764
+0x2F69 = 0x37FF
+0x2F6A = 0x37E7
+0x2F70 = 0x3824
+0x2F75 = 0x383D
+0x6E23 = 0x3A98
+0x6E34 = 0x3C7F
+0x6E49 = 0x3D00
+0x6E5C = 0x3D40
+0x6E5E = 0x3DFA
+0x6E5F = 0x3DF9
+0x6E60 = 0x3DD3
+0x6F32 = 0x3F7E
+0x6F47 = 0x4096
+0x6F4D = 0x4103
+0x6F61 = 0x41C6
+0x6F64 = 0x41FE
+0x7022 = 0x43BC
+0x7033 = 0x4629
+0x7039 = 0x46A5
+0x7053 = 0x4896
+0x707B = 0x4A4D
+0x712E = 0x4B56
+0x7130 = 0x4B6F
+0x7135 = 0x4C16
+0x7144 = 0x4D14
+0x715D = 0x4E0E
+0x7161 = 0x4E37
+0x7166 = 0x4E6A
+0x7169 = 0x4E8B
+0x7175 = 0x504A
+0x7177 = 0x5055
+0x717A = 0x5122
+0x7221 = 0x51A9
+0x7223 = 0x51E5
+0x7224 = 0x51CD
+0x7228 = 0x521E
+0x722C = 0x524C
+0x723D = 0x542E
+0x7248 = 0x54D9
+0x725B = 0x55A7
+0x7275 = 0x57A9
+0x7276 = 0x57B4
+0x7332 = 0x59D4
+0x733D = 0x5AE4
+0x733E = 0x5AE3
+0x7340 = 0x5AF1
+0x7352 = 0x5BB2
+0x735D = 0x5C4B
+0x735E = 0x5C64
+0x7373 = 0x5E2E
+0x7374 = 0x5E56
+0x7375 = 0x5E65
+0x7377 = 0x5E62
+0x737B = 0x5ED8
+0x737D = 0x5EC2
+0x7422 = 0x5EE8
+0x7424 = 0x5F23
+0x7427 = 0x5F5C
+0x742E = 0x5FE0
+0x742F = 0x5FD4
+0x7434 = 0x600C
+0x7435 = 0x5FFB
+0x743D = 0x6017
+0x7442 = 0x6060
+0x744F = 0x60ED
+0x7469 = 0x6270
+0x746B = 0x6286
+0x7472 = 0x634C
+0x7475 = 0x3D0E
+0x7479 = 0x6402
+0x7535 = 0x667E
+0x753A = 0x66B0
+0x7546 = 0x671D
+0x7556 = 0x68DD
+0x7558 = 0x68EA
+0x755A = 0x6951
+0x755D = 0x696F
+0x755F = 0x69DD
+0x7563 = 0x6A1E
+0x756A = 0x6A58
+0x7570 = 0x6A8C
+0x7573 = 0x6AB7
+0x7644 = 0x6C73
+0x764E = 0x6CDD
+0x765D = 0x6E65
+0x7675 = 0x6F94
+0x767E = 0x6FF8
+0x7721 = 0x6FF6
+0x7722 = 0x6FF7
+0x7733 = 0x710D
+0x7736 = 0x7139
+0x7764 = 0x73DB
+0x7765 = 0x73DA
+0x776B = 0x73FE
+0x776E = 0x7410
+0x7773 = 0x7449
+0x7829 = 0x7615
+0x782A = 0x7614
+0x782C = 0x7631
+0x7834 = 0x7693
+0x783C = 0x770E
+0x783E = 0x7723
+0x7842 = 0x7752
+0x7856 = 0x7985
+0x7863 = 0x7A84
+0x7877 = 0x7BB3
+0x7879 = 0x7BBE
+0x787A = 0x7BC7
+0x7925 = 0x7CB8
+0x792F = 0x7DA0
+0x7932 = 0x7E10
+0x7939 = 0x7FB7
+0x7942 = 0x808A
+0x7948 = 0x80BB
+0x7959 = 0x8282
+0x795E = 0x82F3
+0x7966 = 0x840C
+0x796B = 0x8455
+0x797A = 0x856B
+0x797E = 0x85C8
+0x7A21 = 0x85C9
+0x7A2C = 0x86D7
+0x7A2F = 0x86FA
+0x7A4F = 0x8949
+0x7A50 = 0x8946
+0x7A57 = 0x896B
+0x7A65 = 0x8987
+0x7A66 = 0x8988
+0x7A71 = 0x89BA
+0x7A72 = 0x89BB
+0x7A7E = 0x8A1E
+0x7B21 = 0x8A29
+0x7B2C = 0x8A71
+0x7B2D = 0x8A43
+0x7B36 = 0x8A99
+0x7B37 = 0x8ACD
+0x7B3D = 0x8AE4
+0x7B3E = 0x8ADD
+0x7B4E = 0x8BC1
+0x7B4F = 0x8BEF
+0x7B57 = 0x8D10
+0x7B5A = 0x8D71
+0x7B5C = 0x8DFB
+0x7B5D = 0x8E1F
+0x7B61 = 0x8E36
+0x7B65 = 0x8E89
+0x7B67 = 0x8EEB
+0x7B69 = 0x8F32
+0x7B71 = 0x8FF8
+0x7C22 = 0x92A0
+0x7C23 = 0x92B1
+0x7C38 = 0x9490
+0x7C42 = 0x95CF
+0x7C4C = 0x967F
+0x7C56 = 0x96F0
+0x7C59 = 0x9719
+0x7C5D = 0x9750
+0x7C76 = 0x98C6
+0x7D2C = 0x9A72
+0x7D4B = 0x9DDB
+0x7D4C = 0x9E3D
+0x7D59 = 0x9E15
+0x7D5B = 0x9E8A
+0x7D5D = 0x9E49
+0x7D67 = 0x9EC4
+0x7D6D = 0x9EE9
+0x7D70 = 0x9EDB
+0x7E25 = 0x9FCE
+0x7E29 = 0xA02F
+0x7E2B = 0xA01A
+0x7E32 = 0xA0F9
+0x7E35 = 0xA082
+0x7E53 = 0x2218
+0x7E58 = 0xA38C
+0x7E5A = 0xA437
+0x7E6E = 0xA5F1
+0x7E70 = 0xA602
+0x7E72 = 0xA61A
+0x7E76 = 0xA6B2
+END_MAP
diff --git a/enc/trans/JIS/UCS@BMP%JISX0213-1.src b/enc/trans/JIS/UCS@BMP%JISX0213-1.src
new file mode 100644
index 0000000000..953e361738
--- /dev/null
+++ b/enc/trans/JIS/UCS@BMP%JISX0213-1.src
@@ -0,0 +1,1922 @@
+# $NetBSD: UCS@BMP%JISX0213-1.src,v 1.1 2007/03/05 16:58:33 tnozaki Exp $
+
+TYPE ROWCOL
+NAME "UCS:BMP/JISX0213-1"
+SRC_ZONE 0x007E - 0xFF60
+OOB_MODE INVALID
+DST_INVALID 0xFFFF
+DST_UNIT_BITS 16
+
+BEGIN_MAP
+## Shift_JIS-2004 (JIS X 0213:2004) vs Unicode mapping table
+##
+## Date: 12 Feb 2005 10:15:00 GMT
+## License:
+## Copyright (C) 2001 earthian@tama.or.jp, All Rights Reserved.
+## Copyright (C) 2001 I'O, All Rights Reserved.
+## You can use, modify, distribute this table freely.
+## Note:
+## [1983] JIS codepoint defined by JIS X 0208-1983
+## [1990] JIS codepoint defined by JIS X 0208-1990
+## [2000] JIS codepoint defined by JIS X 0213:2000
+## [2004] JIS codepoint defined by JIS X 0213:2004
+## [Unicode3.1] UCS codepoint defined by Unicode 3.1
+## [Unicode3.2] UCS codepoint defined by Unicode 3.2
+## Fullwidth UCS fullwidth form (U+Fxxx)
+## Windows Windows (CP932) mapping
+## Some 0213 character can't represent by one UCS character.
+## In this table, such characters are described as 'U+xxxx+xxxx'.
+##
+0x00A0 = 0x2922
+0x00A1 = 0x2923
+0x00A4 = 0x2924
+0x00A6 = 0x2925
+0x00A9 = 0x2926
+0x00AA = 0x2927
+0x00AB = 0x2928
+0x00AD = 0x2929
+0x00AE = 0x292A
+0x00AF = 0x292B
+0x00B2 = 0x292C
+0x00B3 = 0x292D
+0x00B7 = 0x292E
+0x00B8 = 0x292F
+0x00B9 = 0x2930
+0x00BA = 0x2931
+0x00BB = 0x2932
+0x00BC = 0x2933
+0x00BD = 0x2934
+0x00BE = 0x2935
+0x00BF = 0x2936
+0x00C0 = 0x2937
+0x00C1 = 0x2938
+0x00C2 = 0x2939
+0x00C3 = 0x293A
+0x00C4 = 0x293B
+0x00C5 = 0x293C
+0x00C6 = 0x293D
+0x00C7 = 0x293E
+0x00C8 = 0x293F
+0x00C9 = 0x2940
+0x00CA = 0x2941
+0x00CB = 0x2942
+0x00CC = 0x2943
+0x00CD = 0x2944
+0x00CE = 0x2945
+0x00CF = 0x2946
+0x00D0 = 0x2947
+0x00D1 = 0x2948
+0x00D2 = 0x2949
+0x00D3 = 0x294A
+0x00D4 = 0x294B
+0x00D5 = 0x294C
+0x00D6 = 0x294D
+0x00D8 = 0x294E
+0x00D9 = 0x294F
+0x00DA = 0x2950
+0x00DB = 0x2951
+0x00DC = 0x2952
+0x00DD = 0x2953
+0x00DE = 0x2954
+0x00DF = 0x2955
+0x00E0 = 0x2956
+0x00E1 = 0x2957
+0x00E2 = 0x2958
+0x00E3 = 0x2959
+0x00E4 = 0x295A
+0x00E5 = 0x295B
+#0x00E6 + 0x0300 = 0x2B44
+0x00E6 = 0x295C
+0x00E7 = 0x295D
+0x00E8 = 0x295E
+0x00E9 = 0x295F
+0x00EA = 0x2960
+0x00EB = 0x2961
+0x00EC = 0x2962
+0x00ED = 0x2963
+0x00EE = 0x2964
+0x00EF = 0x2965
+0x00F0 = 0x2966
+0x00F1 = 0x2967
+0x00F2 = 0x2968
+0x00F3 = 0x2969
+0x00F4 = 0x296A
+0x00F5 = 0x296B
+0x00F6 = 0x296C
+0x00F8 = 0x296D
+0x00F9 = 0x296E
+0x00FA = 0x296F
+0x00FB = 0x2970
+0x00FC = 0x2971
+0x00FD = 0x2972
+0x00FE = 0x2973
+0x00FF = 0x2974
+0x0100 = 0x2975
+0x0101 = 0x297A
+0x0102 = 0x2A3A
+0x0103 = 0x2A49
+0x0104 = 0x2A21
+0x0105 = 0x2A2C
+0x0106 = 0x2A3C
+0x0107 = 0x2A4B
+0x0108 = 0x2A59
+0x0109 = 0x2A5F
+0x010C = 0x2A3D
+0x010D = 0x2A4C
+0x010E = 0x2A40
+0x010F = 0x2A4F
+0x0111 = 0x2A50
+0x0112 = 0x2978
+0x0113 = 0x297D
+0x0118 = 0x2A3E
+0x0119 = 0x2A4D
+0x011A = 0x2A3F
+0x011B = 0x2A4E
+0x011C = 0x2A5A
+0x011D = 0x2A60
+0x0124 = 0x2A5B
+0x0125 = 0x2A61
+0x0127 = 0x2A7D
+0x012A = 0x2976
+0x012B = 0x297B
+0x0134 = 0x2A5C
+0x0135 = 0x2A62
+0x0139 = 0x2A3B
+0x013A = 0x2A4A
+0x013D = 0x2A24
+0x013E = 0x2A2F
+0x0141 = 0x2A23
+0x0142 = 0x2A2E
+0x0143 = 0x2A41
+0x0144 = 0x2A51
+0x0147 = 0x2A42
+0x0148 = 0x2A52
+0x014B = 0x2A7A
+0x014C = 0x2979
+0x014D = 0x297E
+0x0150 = 0x2A43
+0x0151 = 0x2A53
+0x0152 = 0x2B2B
+0x0153 = 0x2B2A
+0x0154 = 0x2A39
+0x0155 = 0x2A48
+0x0158 = 0x2A44
+0x0159 = 0x2A54
+0x015A = 0x2A25
+0x015B = 0x2A30
+0x015C = 0x2A5D
+0x015D = 0x2A63
+0x015E = 0x2A27
+0x015F = 0x2A33
+0x0160 = 0x2A26
+0x0161 = 0x2A32
+0x0162 = 0x2A47
+0x0163 = 0x2A57
+0x0164 = 0x2A28
+0x0165 = 0x2A34
+0x016A = 0x2977
+0x016B = 0x297C
+0x016C = 0x2A5E
+0x016D = 0x2A64
+0x016E = 0x2A45
+0x016F = 0x2A55
+0x0170 = 0x2A46
+0x0171 = 0x2A56
+0x0179 = 0x2A29
+0x017A = 0x2A35
+0x017B = 0x2A2B
+0x017C = 0x2A38
+0x017D = 0x2A2A
+0x017E = 0x2A37
+0x0193 = 0x2B29
+0x01C2 = 0x2B24
+0x01CD = 0x286F
+0x01CE = 0x2870
+0x01D0 = 0x2871
+0x01D1 = 0x2876
+0x01D2 = 0x2877
+0x01D4 = 0x2878
+0x01D6 = 0x2879
+0x01D8 = 0x287A
+0x01DA = 0x287B
+0x01DC = 0x287C
+0x01F8 = 0x2874
+0x01F9 = 0x2875
+0x01FD = 0x2B45
+0x0250 = 0x2B33
+0x0251 = 0x2B39
+0x0252 = 0x2B3A
+0x0253 = 0x2B25
+#0x0254 + 0x0300 = 0x2B48
+#0x0254 + 0x0301 = 0x2B49
+0x0254 = 0x2B38
+0x0255 = 0x2B3F
+0x0256 = 0x2A6E
+0x0257 = 0x2B26
+0x0258 = 0x2B2E
+#0x0259 + 0x0300 = 0x2B4C
+#0x0259 + 0x0301 = 0x2B4D
+0x0259 = 0x2B30
+#0x025A + 0x0300 = 0x2B4E
+#0x025A + 0x0301 = 0x2B4F
+0x025A = 0x2B43
+0x025C = 0x2B31
+0x025E = 0x2B32
+0x025F = 0x2A75
+0x0260 = 0x2B28
+0x0261 = 0x2A79
+0x0264 = 0x2B36
+0x0265 = 0x2B3C
+0x0266 = 0x2B22
+0x0267 = 0x2B42
+0x0268 = 0x2B2C
+0x026C = 0x2A6A
+0x026D = 0x2A74
+0x026E = 0x2A6B
+0x026F = 0x2B34
+0x0270 = 0x2A7B
+0x0271 = 0x2A65
+0x0272 = 0x2A76
+0x0273 = 0x2A6F
+0x0275 = 0x2B2F
+0x0279 = 0x2A6C
+0x027A = 0x2B41
+0x027B = 0x2A73
+0x027D = 0x2A70
+0x027E = 0x2A67
+0x0281 = 0x2A7C
+0x0282 = 0x2A71
+0x0283 = 0x2A68
+0x0284 = 0x2B27
+0x0288 = 0x2A6D
+0x0289 = 0x2B2D
+0x028A = 0x2B35
+0x028B = 0x2A66
+#0x028C + 0x0300 = 0x2B4A
+#0x028C + 0x0301 = 0x2B4B
+0x028C = 0x2B37
+0x028D = 0x2B3B
+0x028E = 0x2A78
+0x0290 = 0x2A72
+0x0291 = 0x2B40
+0x0292 = 0x2A69
+0x0294 = 0x2B21
+0x0295 = 0x2A7E
+0x0298 = 0x2B23
+0x029D = 0x2A77
+0x02A1 = 0x2B3E
+0x02A2 = 0x2B3D
+0x02C7 = 0x2A31
+0x02C8 = 0x2B53
+0x02CC = 0x2B54
+0x02D0 = 0x2B55
+0x02D1 = 0x2B56
+0x02D8 = 0x2A22
+0x02D9 = 0x2A58
+0x02DB = 0x2A2D
+0x02DD = 0x2A36
+0x02DE = 0x2B71
+#0x02E5 + 0x02E9 = 0x2B66
+0x02E5 = 0x2B60
+0x02E6 = 0x2B61
+0x02E7 = 0x2B62
+0x02E8 = 0x2B63
+#0x02E9 + 0x02E5 = 0x2B65
+0x02E9 = 0x2B64
+0x0300 = 0x2B5C
+0x0301 = 0x2B5A
+0x0302 = 0x2B5F
+0x0303 = 0x2B7D
+0x0304 = 0x2B5B
+0x0306 = 0x2B57
+0x0308 = 0x2B6D
+0x030B = 0x2B59
+0x030C = 0x2B5E
+0x030F = 0x2B5D
+0x0318 = 0x2B78
+0x0319 = 0x2B79
+0x031A = 0x2B7E
+0x031C = 0x2B6A
+0x031D = 0x2B76
+0x031E = 0x2B77
+0x031F = 0x2B6B
+0x0320 = 0x2B6C
+0x0324 = 0x2B72
+0x0325 = 0x2B67
+0x0329 = 0x2B6F
+0x032A = 0x2B7A
+0x032C = 0x2B68
+0x032F = 0x2B70
+0x0330 = 0x2B73
+0x0334 = 0x2B75
+0x0339 = 0x2B69
+0x033A = 0x2B7B
+0x033B = 0x2B7C
+0x033C = 0x2B74
+0x033D = 0x2B6E
+0x0361 = 0x2B52
+0x03C2 = 0x2659
+0x1E3E = 0x2872
+0x1E3F = 0x2873
+0x1F70 = 0x2B46
+0x1F71 = 0x2B47
+0x1F72 = 0x2B50
+0x1F73 = 0x2B51
+0x2013 = 0x237C
+0x2022 = 0x2340
+0x203C = 0x286B
+0x203F = 0x2B58
+0x2042 = 0x2C7E
+0x2047 = 0x286C
+0x2048 = 0x286D
+0x2049 = 0x286E
+0x2051 = 0x2C7D
+0x20AC = 0x2921
+0x210F = 0x235D
+0x2113 = 0x235F
+0x2116 = 0x2D62
+0x2121 = 0x2D64
+0x2127 = 0x2360
+0x2135 = 0x235C
+0x2153 = 0x2778
+0x2154 = 0x2779
+0x2155 = 0x277A
+0x2160 = 0x2D35
+0x2161 = 0x2D36
+0x2162 = 0x2D37
+0x2163 = 0x2D38
+0x2164 = 0x2D39
+0x2165 = 0x2D3A
+0x2166 = 0x2D3B
+0x2167 = 0x2D3C
+0x2168 = 0x2D3D
+0x2169 = 0x2D3E
+0x216A = 0x2D3F
+0x216B = 0x2D57
+0x2170 = 0x2C35
+0x2171 = 0x2C36
+0x2172 = 0x2C37
+0x2173 = 0x2C38
+0x2174 = 0x2C39
+0x2175 = 0x2C3A
+0x2176 = 0x2C3B
+0x2177 = 0x2C3C
+0x2178 = 0x2C3D
+0x2179 = 0x2C3E
+0x217A = 0x2C3F
+0x217B = 0x2C40
+0x2194 = 0x2271
+0x2196 = 0x2327
+0x2197 = 0x2325
+0x2198 = 0x2326
+0x2199 = 0x2328
+0x21C4 = 0x2329
+0x21E6 = 0x232B
+0x21E7 = 0x232C
+0x21E8 = 0x232A
+0x21E9 = 0x232D
+0x2205 = 0x2247
+0x2209 = 0x2246
+0x2213 = 0x235B
+0x221F = 0x2D78
+0x2225 = 0x2254
+0x2226 = 0x2255
+0x222E = 0x2D73
+0x2243 = 0x226C
+0x2245 = 0x226D
+0x2248 = 0x226E
+0x2262 = 0x226B
+0x2276 = 0x226F
+0x2277 = 0x2270
+0x2284 = 0x2242
+0x2285 = 0x2243
+0x228A = 0x2244
+0x228B = 0x2245
+0x2295 = 0x2251
+0x2296 = 0x2252
+0x2297 = 0x2253
+0x22BF = 0x2D79
+0x22DA = 0x2776
+0x22DB = 0x2777
+0x2305 = 0x2248
+0x2306 = 0x2249
+0x2318 = 0x277C
+0x23BE = 0x2742
+0x23BF = 0x2743
+0x23C0 = 0x2744
+0x23C1 = 0x2745
+0x23C2 = 0x2746
+0x23C3 = 0x2747
+0x23C4 = 0x2748
+0x23C5 = 0x2749
+0x23C6 = 0x274A
+0x23C7 = 0x274B
+0x23C8 = 0x274C
+0x23C9 = 0x274D
+0x23CA = 0x274E
+0x23CB = 0x274F
+0x23CC = 0x2750
+0x23CE = 0x277E
+0x2423 = 0x277D
+0x2460 = 0x2D21
+0x2461 = 0x2D22
+0x2462 = 0x2D23
+0x2463 = 0x2D24
+0x2464 = 0x2D25
+0x2465 = 0x2D26
+0x2466 = 0x2D27
+0x2467 = 0x2D28
+0x2468 = 0x2D29
+0x2469 = 0x2D2A
+0x246A = 0x2D2B
+0x246B = 0x2D2C
+0x246C = 0x2D2D
+0x246D = 0x2D2E
+0x246E = 0x2D2F
+0x246F = 0x2D30
+0x2470 = 0x2D31
+0x2471 = 0x2D32
+0x2472 = 0x2D33
+0x2473 = 0x2D34
+0x24D0 = 0x2C41
+0x24D1 = 0x2C42
+0x24D2 = 0x2C43
+0x24D3 = 0x2C44
+0x24D4 = 0x2C45
+0x24D5 = 0x2C46
+0x24D6 = 0x2C47
+0x24D7 = 0x2C48
+0x24D8 = 0x2C49
+0x24D9 = 0x2C4A
+0x24DA = 0x2C4B
+0x24DB = 0x2C4C
+0x24DC = 0x2C4D
+0x24DD = 0x2C4E
+0x24DE = 0x2C4F
+0x24DF = 0x2C50
+0x24E0 = 0x2C51
+0x24E1 = 0x2C52
+0x24E2 = 0x2C53
+0x24E3 = 0x2C54
+0x24E4 = 0x2C55
+0x24E5 = 0x2C56
+0x24E6 = 0x2C57
+0x24E7 = 0x2C58
+0x24E8 = 0x2C59
+0x24E9 = 0x2C5A
+0x24EB = 0x2C2B
+0x24EC = 0x2C2C
+0x24ED = 0x2C2D
+0x24EE = 0x2C2E
+0x24EF = 0x2C2F
+0x24F0 = 0x2C30
+0x24F1 = 0x2C31
+0x24F2 = 0x2C32
+0x24F3 = 0x2C33
+0x24F4 = 0x2C34
+0x24F5 = 0x265A
+0x24F6 = 0x265B
+0x24F7 = 0x265C
+0x24F8 = 0x265D
+0x24F9 = 0x265E
+0x24FA = 0x265F
+0x24FB = 0x2660
+0x24FC = 0x2661
+0x24FD = 0x2662
+0x24FE = 0x2663
+0x25B1 = 0x266D
+0x25B6 = 0x2322
+0x25B7 = 0x2321
+0x25C0 = 0x2324
+0x25C1 = 0x2323
+0x25C9 = 0x233B
+0x25D0 = 0x2867
+0x25D1 = 0x2868
+0x25D2 = 0x2869
+0x25D3 = 0x286A
+0x25E6 = 0x233F
+0x2600 = 0x2668
+0x2601 = 0x2669
+0x2602 = 0x266A
+0x2603 = 0x266B
+0x260E = 0x2667
+0x2616 = 0x2664
+0x2617 = 0x2665
+0x261E = 0x2D7E
+0x2660 = 0x263A
+0x2661 = 0x263D
+0x2662 = 0x263B
+0x2663 = 0x2640
+0x2664 = 0x2639
+0x2665 = 0x263E
+0x2666 = 0x263C
+0x2667 = 0x263F
+0x2668 = 0x266C
+0x2669 = 0x227D
+0x266B = 0x227B
+0x266C = 0x227C
+0x266E = 0x227A
+0x2713 = 0x277B
+0x2756 = 0x2D7D
+0x2776 = 0x2C21
+0x2777 = 0x2C22
+0x2778 = 0x2C23
+0x2779 = 0x2C24
+0x277A = 0x2C25
+0x277B = 0x2C26
+0x277C = 0x2C27
+0x277D = 0x2C28
+0x277E = 0x2C29
+0x277F = 0x2C2A
+0x2934 = 0x232E
+0x2935 = 0x232F
+0x29BF = 0x233A
+0x29FA = 0x237D
+0x29FB = 0x237E
+0x3016 = 0x225A
+0x3017 = 0x225B
+0x3018 = 0x2258
+0x3019 = 0x2259
+0x301D = 0x2D60
+0x301F = 0x2D61
+0x3020 = 0x2666
+0x3033 = 0x2233
+0x3034 = 0x2234
+0x3035 = 0x2235
+0x303B = 0x2236
+0x303C = 0x2237
+0x303D = 0x233C
+#0x304B + 0x309A = 0x2477
+#0x304D + 0x309A = 0x2478
+#0x304F + 0x309A = 0x2479
+#0x3051 + 0x309A = 0x247A
+#0x3053 + 0x309A = 0x247B
+0x3094 = 0x2474
+0x3095 = 0x2475
+0x3096 = 0x2476
+0x309F = 0x2239
+0x30A0 = 0x237B
+#0x30AB + 0x309A = 0x2577
+#0x30AD + 0x309A = 0x2578
+#0x30AF + 0x309A = 0x2579
+#0x30B1 + 0x309A = 0x257A
+#0x30B3 + 0x309A = 0x257B
+#0x30BB + 0x309A = 0x257C
+#0x30C4 + 0x309A = 0x257D
+#0x30C8 + 0x309A = 0x257E
+0x30F7 = 0x2772
+0x30F8 = 0x2773
+0x30F9 = 0x2774
+0x30FA = 0x2775
+0x30FF = 0x2238
+0x31F0 = 0x266E
+0x31F1 = 0x266F
+0x31F2 = 0x2670
+0x31F3 = 0x2671
+0x31F4 = 0x2672
+0x31F5 = 0x2673
+0x31F6 = 0x2674
+#0x31F7 + 0x309A = 0x2678
+0x31F7 = 0x2675
+0x31F8 = 0x2676
+0x31F9 = 0x2677
+0x31FA = 0x2679
+0x31FB = 0x267A
+0x31FC = 0x267B
+0x31FD = 0x267C
+0x31FE = 0x267D
+0x31FF = 0x267E
+0x3231 = 0x2D6A
+0x3232 = 0x2D6B
+0x3239 = 0x2D6C
+0x3251 = 0x2841
+0x3252 = 0x2842
+0x3253 = 0x2843
+0x3254 = 0x2844
+0x3255 = 0x2845
+0x3256 = 0x2846
+0x3257 = 0x2847
+0x3258 = 0x2848
+0x3259 = 0x2849
+0x325A = 0x284A
+0x325B = 0x284B
+0x325C = 0x284C
+0x325D = 0x284D
+0x325E = 0x284E
+0x325F = 0x284F
+0x32A4 = 0x2D65
+0x32A5 = 0x2D66
+0x32A6 = 0x2D67
+0x32A7 = 0x2D68
+0x32A8 = 0x2D69
+0x32B1 = 0x2850
+0x32B2 = 0x2851
+0x32B3 = 0x2852
+0x32B4 = 0x2853
+0x32B5 = 0x2854
+0x32B6 = 0x2855
+0x32B7 = 0x2856
+0x32B8 = 0x2857
+0x32B9 = 0x2858
+0x32BA = 0x2859
+0x32BB = 0x285A
+0x32BC = 0x285B
+0x32BD = 0x285C
+0x32BE = 0x285D
+0x32BF = 0x285E
+0x32D0 = 0x2C5B
+0x32D1 = 0x2C5C
+0x32D2 = 0x2C5D
+0x32D3 = 0x2C5E
+0x32D4 = 0x2C5F
+0x32D5 = 0x2C60
+0x32D6 = 0x2C61
+0x32D7 = 0x2C62
+0x32D8 = 0x2C63
+0x32D9 = 0x2C64
+0x32DA = 0x2C65
+0x32DB = 0x2C66
+0x32DC = 0x2C67
+0x32DD = 0x2C68
+0x32DE = 0x2C69
+0x32DF = 0x2C6A
+0x32E0 = 0x2C6B
+0x32E1 = 0x2C6C
+0x32E2 = 0x2C6D
+0x32E3 = 0x2C6E
+0x32E5 = 0x2C71
+0x32E9 = 0x2C70
+0x32EC = 0x2C73
+0x32ED = 0x2C72
+0x32FA = 0x2C6F
+0x3303 = 0x2D46
+0x330D = 0x2D4A
+0x3314 = 0x2D41
+0x3318 = 0x2D44
+0x3322 = 0x2D42
+0x3323 = 0x2D4C
+0x3326 = 0x2D4B
+0x3327 = 0x2D45
+0x332B = 0x2D4D
+0x3336 = 0x2D47
+0x333B = 0x2D4F
+0x3349 = 0x2D40
+0x334A = 0x2D4E
+0x334D = 0x2D43
+0x3351 = 0x2D48
+0x3357 = 0x2D49
+0x337B = 0x2D5F
+0x337C = 0x2D6F
+0x337D = 0x2D6E
+0x337E = 0x2D6D
+0x338E = 0x2D53
+0x338F = 0x2D54
+0x339C = 0x2D50
+0x339D = 0x2D51
+0x339E = 0x2D52
+0x33A1 = 0x2D56
+0x33C4 = 0x2D55
+0x33CB = 0x235E
+0x33CD = 0x2D63
+0x3402 = 0x2E23
+0x34B5 = 0x2E53
+0x34DB = 0x2E5B
+0x378D = 0x4F5F
+0x37E2 = 0x4F6F
+0x3B22 = 0x7549
+0x3BB6 = 0x757E
+0x3BC3 = 0x7621
+0x3C0F = 0x763A
+0x3E3F = 0x7766
+0x3F72 = 0x784D
+0x4264 = 0x796D
+0x4453 = 0x7A59
+0x445B = 0x7A5A
+0x459D = 0x7B51
+0x45EA = 0x7B60
+0x4844 = 0x7C4B
+0x49B0 = 0x7D58
+0x4C17 = 0x7E3E
+0x4E28 = 0x2E24
+0x4E2F = 0x2E25
+0x4E30 = 0x2E26
+0x4E8D = 0x2E27
+0x4EE1 = 0x2E28
+0x4EFD = 0x2E29
+0x4EFF = 0x2E2A
+0x4F03 = 0x2E2B
+0x4F0B = 0x2E2C
+0x4F48 = 0x2E2E
+0x4F49 = 0x2E2F
+0x4F56 = 0x2E30
+0x4F5F = 0x2E31
+0x4F60 = 0x2E2D
+0x4F6A = 0x2E32
+0x4F6C = 0x2E33
+0x4F7E = 0x2E34
+0x4F8A = 0x2E35
+0x4F94 = 0x2E36
+0x4F97 = 0x2E37
+0x4FC9 = 0x2E39
+0x4FE0 = 0x2E3A
+0x4FF1 = 0x2E21
+0x5001 = 0x2E3B
+0x5002 = 0x2E3C
+0x500E = 0x2E3D
+0x5018 = 0x2E3E
+0x5027 = 0x2E3F
+0x502E = 0x2E40
+0x503B = 0x2E42
+0x5040 = 0x2E41
+0x5041 = 0x2E43
+0x5094 = 0x2E44
+0x50CC = 0x2E45
+0x50D0 = 0x2E47
+0x50E6 = 0x2E48
+0x50F2 = 0x2E46
+0x5103 = 0x2E4B
+0x5106 = 0x2E4A
+0x510B = 0x2E4C
+0x511E = 0x2E4D
+0x5135 = 0x2E4E
+0x514A = 0x2E4F
+0x5155 = 0x2E51
+0x5157 = 0x2E52
+0x519D = 0x2E54
+0x51C3 = 0x2E55
+0x51CA = 0x2E56
+0x51DE = 0x2E57
+0x51E2 = 0x2E58
+0x51EE = 0x2E59
+0x5201 = 0x2E5A
+0x5213 = 0x2E5C
+0x5215 = 0x2E5D
+0x5249 = 0x2E5E
+0x5257 = 0x2E5F
+0x525D = 0x2F7E
+0x5261 = 0x2E60
+0x5293 = 0x2E61
+0x52C8 = 0x2E62
+0x52CC = 0x2E64
+0x52D0 = 0x2E65
+0x52D6 = 0x2E66
+0x52DB = 0x2E67
+0x52F0 = 0x2E69
+0x52FB = 0x2E6A
+0x5300 = 0x2E6B
+0x5307 = 0x2E6C
+0x531C = 0x2E6D
+0x5361 = 0x2E6F
+0x5363 = 0x2E70
+0x537D = 0x2E71
+0x5393 = 0x2E72
+0x539D = 0x2E73
+0x53B2 = 0x2E74
+0x5412 = 0x2E75
+0x541E = 0x4F7E
+0x5427 = 0x2E76
+0x544D = 0x2E77
+0x546B = 0x2E79
+0x5474 = 0x2E7A
+0x547F = 0x2E7B
+0x5488 = 0x2E7C
+0x5496 = 0x2E7D
+0x549C = 0x2E78
+0x54A1 = 0x2E7E
+0x54A9 = 0x2F21
+0x54C6 = 0x2F22
+0x54FF = 0x2F23
+0x550E = 0x2F24
+0x552B = 0x2F25
+0x5535 = 0x2F26
+0x5550 = 0x2F27
+0x555E = 0x2F28
+0x5581 = 0x2F29
+0x5586 = 0x2F2A
+0x558E = 0x2F2B
+0x55AD = 0x2F2D
+0x55CE = 0x2F2E
+0x5608 = 0x2F30
+0x560E = 0x2F31
+0x563B = 0x2F32
+0x5649 = 0x2F33
+0x5653 = 0x7427
+0x5666 = 0x2F35
+0x566F = 0x2F37
+0x5671 = 0x2F38
+0x5672 = 0x2F39
+0x5676 = 0x2F34
+0x5699 = 0x2F3A
+0x569E = 0x2F3B
+0x56A9 = 0x2F3C
+0x56AC = 0x2F3D
+0x56B3 = 0x2F3E
+0x56C9 = 0x2F3F
+0x56CA = 0x2F40
+0x570A = 0x2F41
+0x5721 = 0x2F43
+0x572F = 0x2F44
+0x5733 = 0x2F45
+0x5734 = 0x2F46
+0x5770 = 0x2F47
+0x5777 = 0x2F48
+0x577C = 0x2F49
+0x579C = 0x2F4A
+0x57B8 = 0x2F4D
+0x57C7 = 0x2F4E
+0x57C8 = 0x2F4F
+0x57CF = 0x2F50
+0x57E4 = 0x2F51
+0x57ED = 0x2F52
+0x57F5 = 0x2F53
+0x57F6 = 0x2F54
+0x57FF = 0x2F55
+0x5809 = 0x2F56
+0x5861 = 0x2F58
+0x5864 = 0x2F59
+0x587C = 0x2F5B
+0x5889 = 0x2F5C
+0x589E = 0x2F5D
+0x58A9 = 0x2F5F
+0x58CE = 0x2F62
+0x58D2 = 0x2F61
+0x58D4 = 0x2F63
+0x58DA = 0x2F64
+0x58E0 = 0x2F65
+0x58E9 = 0x2F66
+0x590C = 0x2F67
+0x595D = 0x2F69
+0x596D = 0x2F6A
+0x598B = 0x2F6B
+0x5992 = 0x2F6C
+0x59A4 = 0x2F6D
+0x59C3 = 0x2F6E
+0x59D2 = 0x2F6F
+0x59DD = 0x2F70
+0x59F8 = 0x7E7A
+0x5A13 = 0x2F71
+0x5A23 = 0x2F72
+0x5A67 = 0x2F73
+0x5A6D = 0x2F74
+0x5A77 = 0x2F75
+0x5A7E = 0x2F76
+0x5A84 = 0x2F77
+0x5A9E = 0x2F78
+0x5AA7 = 0x2F79
+0x5AC4 = 0x2F7A
+0x5B19 = 0x2F7C
+0x5B25 = 0x2F7D
+0x5B41 = 0x4F55
+0x5B56 = 0x4F56
+0x5B7D = 0x4F57
+0x5B93 = 0x4F58
+0x5BD8 = 0x4F59
+0x5BEC = 0x4F5A
+0x5C12 = 0x4F5B
+0x5C1E = 0x4F5C
+0x5C23 = 0x4F5D
+0x5C2B = 0x4F5E
+0x5C5B = 0x7E7B
+0x5C62 = 0x4F60
+0x5C7A = 0x4F64
+0x5C8F = 0x4F65
+0x5C9F = 0x4F66
+0x5CA3 = 0x4F67
+0x5CAA = 0x4F68
+0x5CBA = 0x4F69
+0x5CCB = 0x4F6A
+0x5CD0 = 0x4F6B
+0x5CD2 = 0x4F6C
+0x5CF4 = 0x4F6D
+0x5D0D = 0x4F70
+0x5D27 = 0x4F71
+0x5D46 = 0x4F73
+0x5D47 = 0x4F74
+0x5D4A = 0x4F76
+0x5D53 = 0x4F75
+0x5D6D = 0x4F77
+0x5D81 = 0x4F78
+0x5DA0 = 0x4F79
+0x5DA4 = 0x4F7A
+0x5DA7 = 0x4F7B
+0x5DB8 = 0x4F7C
+0x5DCB = 0x4F7D
+0x5DE2 = 0x7428
+0x5E14 = 0x7429
+0x5E18 = 0x742A
+0x5E58 = 0x742B
+0x5E5E = 0x742C
+0x5E77 = 0x7E7C
+0x5EBE = 0x742D
+0x5ECB = 0x742F
+0x5EF9 = 0x7430
+0x5F00 = 0x7431
+0x5F02 = 0x7432
+0x5F07 = 0x7433
+0x5F1D = 0x7434
+0x5F23 = 0x7435
+0x5F34 = 0x7436
+0x5F36 = 0x7437
+0x5F3D = 0x7438
+0x5F40 = 0x7439
+0x5F45 = 0x743A
+0x5F54 = 0x743B
+0x5F58 = 0x743C
+0x5F64 = 0x743D
+0x5F67 = 0x743E
+0x5F7D = 0x743F
+0x5F89 = 0x7440
+0x5F9C = 0x7441
+0x5FA7 = 0x7442
+0x5FAF = 0x7443
+0x5FB5 = 0x7444
+0x5FB7 = 0x7445
+0x5FC9 = 0x7446
+0x5FDE = 0x7447
+0x5FE1 = 0x7448
+0x5FE9 = 0x7449
+0x600D = 0x744A
+0x6014 = 0x744B
+0x6018 = 0x744C
+0x6033 = 0x744D
+0x6035 = 0x744E
+0x6047 = 0x744F
+0x609D = 0x7451
+0x609E = 0x7452
+0x60CB = 0x7453
+0x60D4 = 0x7454
+0x60D5 = 0x7455
+0x60DD = 0x7456
+0x60F8 = 0x7457
+0x611C = 0x7458
+0x612B = 0x7459
+0x6130 = 0x745A
+0x6137 = 0x745B
+0x618D = 0x745D
+0x61B9 = 0x7460
+0x61BC = 0x745F
+0x6222 = 0x7462
+0x623E = 0x7463
+0x6243 = 0x7464
+0x6256 = 0x7465
+0x625A = 0x7466
+0x626F = 0x7467
+0x6285 = 0x7468
+0x62C4 = 0x7469
+0x62D6 = 0x746A
+0x62FC = 0x746B
+0x630A = 0x746C
+0x6318 = 0x746D
+0x6339 = 0x746E
+0x6343 = 0x746F
+0x6365 = 0x7470
+0x637C = 0x7471
+0x63E5 = 0x7472
+0x63ED = 0x7473
+0x63F5 = 0x7474
+0x6410 = 0x7475
+0x6414 = 0x7476
+0x6422 = 0x7477
+0x6451 = 0x7479
+0x6460 = 0x747A
+0x646D = 0x747B
+0x6479 = 0x7478
+0x64BE = 0x747D
+0x64BF = 0x747E
+0x64C4 = 0x7521
+0x64CA = 0x7522
+0x64CE = 0x747C
+0x64D0 = 0x7523
+0x64F7 = 0x7524
+0x64FB = 0x7525
+0x6522 = 0x7526
+0x6529 = 0x7527
+0x6567 = 0x7529
+0x659D = 0x752A
+0x6600 = 0x752C
+0x6609 = 0x752D
+0x6615 = 0x752E
+0x661E = 0x752F
+0x6622 = 0x7531
+0x6624 = 0x7532
+0x662B = 0x7533
+0x6630 = 0x7534
+0x6631 = 0x7535
+0x6633 = 0x7536
+0x663A = 0x7530
+0x6648 = 0x7538
+0x664C = 0x7539
+0x6659 = 0x753B
+0x665A = 0x753C
+0x6661 = 0x753D
+0x6665 = 0x753E
+0x6673 = 0x753F
+0x6677 = 0x7540
+0x6678 = 0x7541
+0x668D = 0x7542
+0x66A0 = 0x7544
+0x66B2 = 0x7545
+0x66BB = 0x7546
+0x66C6 = 0x7547
+0x66C8 = 0x7548
+0x66DB = 0x754A
+0x66E8 = 0x754B
+0x66FA = 0x754C
+0x66FB = 0x7537
+0x6713 = 0x754D
+0x6733 = 0x754F
+0x6747 = 0x7551
+0x6748 = 0x7552
+0x6766 = 0x7550
+0x677B = 0x7553
+0x6781 = 0x7554
+0x6793 = 0x7555
+0x6798 = 0x7556
+0x679B = 0x7557
+0x67BB = 0x7558
+0x67C0 = 0x755A
+0x67D7 = 0x755B
+0x67F9 = 0x7559
+0x67FC = 0x755C
+0x6801 = 0x755D
+0x681D = 0x755F
+0x682C = 0x7560
+0x6831 = 0x7561
+0x6852 = 0x755E
+0x685B = 0x7562
+0x6872 = 0x7563
+0x6875 = 0x7564
+0x68A3 = 0x7566
+0x68A5 = 0x7567
+0x68B2 = 0x7568
+0x68C8 = 0x7569
+0x68D0 = 0x756A
+0x68E8 = 0x756B
+0x68ED = 0x756C
+0x68F0 = 0x756D
+0x68F1 = 0x756E
+0x68FC = 0x756F
+0x690A = 0x7570
+0x6935 = 0x7573
+0x6942 = 0x7574
+0x6949 = 0x7571
+0x6957 = 0x7575
+0x6963 = 0x7576
+0x6964 = 0x7577
+0x6968 = 0x7578
+0x6980 = 0x7579
+0x69A5 = 0x757B
+0x69AD = 0x757C
+0x69CF = 0x757D
+0x69E2 = 0x7622
+0x69E9 = 0x7623
+0x69EA = 0x7624
+0x69F5 = 0x7625
+0x69F6 = 0x7626
+0x6A0F = 0x7627
+0x6A15 = 0x7628
+0x6A3B = 0x762A
+0x6A3E = 0x762B
+0x6A45 = 0x762C
+0x6A50 = 0x762D
+0x6A56 = 0x762E
+0x6A5B = 0x762F
+0x6A6B = 0x7630
+0x6A73 = 0x7631
+0x6A89 = 0x7633
+0x6A94 = 0x7634
+0x6A9D = 0x7635
+0x6A9E = 0x7636
+0x6AA5 = 0x7637
+0x6AE4 = 0x7638
+0x6AE7 = 0x7639
+0x6B1B = 0x763C
+0x6B1E = 0x763D
+0x6B2C = 0x763E
+0x6B35 = 0x763F
+0x6B46 = 0x7640
+0x6B56 = 0x7641
+0x6B60 = 0x7642
+0x6B65 = 0x7643
+0x6B67 = 0x7644
+0x6B77 = 0x7645
+0x6B82 = 0x7646
+0x6BA9 = 0x7647
+0x6BAD = 0x7648
+0x6BCF = 0x764A
+0x6BD6 = 0x764B
+0x6BD7 = 0x764C
+0x6BFF = 0x764D
+0x6C05 = 0x764E
+0x6C10 = 0x764F
+0x6C33 = 0x7650
+0x6C59 = 0x7651
+0x6C5C = 0x7652
+0x6C74 = 0x7654
+0x6C76 = 0x7655
+0x6C85 = 0x7656
+0x6C86 = 0x7657
+0x6C98 = 0x7658
+0x6C9C = 0x7659
+0x6CAA = 0x7653
+0x6CC6 = 0x765B
+0x6CD4 = 0x765C
+0x6CE0 = 0x765D
+0x6CEB = 0x765E
+0x6CEE = 0x765F
+0x6CFB = 0x765A
+0x6D04 = 0x7661
+0x6D0E = 0x7662
+0x6D2E = 0x7663
+0x6D31 = 0x7664
+0x6D39 = 0x7665
+0x6D3F = 0x7666
+0x6D58 = 0x7667
+0x6D65 = 0x7668
+0x6D82 = 0x766A
+0x6D87 = 0x766B
+0x6D89 = 0x766C
+0x6D94 = 0x766D
+0x6DAA = 0x766E
+0x6DAC = 0x766F
+0x6DBF = 0x7670
+0x6DC4 = 0x7671
+0x6DD6 = 0x7672
+0x6DDA = 0x7673
+0x6DDB = 0x7674
+0x6DDD = 0x7675
+0x6DFC = 0x7676
+0x6E34 = 0x7678
+0x6E44 = 0x7679
+0x6E5C = 0x767A
+0x6E5E = 0x767B
+0x6EAB = 0x767C
+0x6EB1 = 0x767D
+0x6EC1 = 0x767E
+0x6EC7 = 0x7721
+0x6ECE = 0x7722
+0x6F10 = 0x7723
+0x6F1A = 0x7724
+0x6F2A = 0x7726
+0x6F2F = 0x7727
+0x6F33 = 0x7728
+0x6F51 = 0x7729
+0x6F59 = 0x772A
+0x6F5E = 0x772B
+0x6F61 = 0x772C
+0x6F62 = 0x772D
+0x6F7E = 0x772E
+0x6F88 = 0x772F
+0x6F8C = 0x7730
+0x6F8D = 0x7731
+0x6F94 = 0x7732
+0x6FA0 = 0x7733
+0x6FA7 = 0x7734
+0x6FB6 = 0x7735
+0x6FBC = 0x7736
+0x6FC7 = 0x7737
+0x6FCA = 0x7738
+0x6FF0 = 0x773A
+0x6FF5 = 0x773B
+0x6FF9 = 0x7739
+0x7005 = 0x773C
+0x7006 = 0x773D
+0x7028 = 0x773E
+0x704A = 0x773F
+0x704E = 0x7742
+0x705D = 0x7740
+0x705E = 0x7741
+0x7064 = 0x7743
+0x7075 = 0x7744
+0x7085 = 0x7745
+0x70A4 = 0x7746
+0x70AB = 0x7747
+0x70B7 = 0x7748
+0x70D4 = 0x7749
+0x70D8 = 0x774A
+0x70E4 = 0x774B
+0x710F = 0x774C
+0x711E = 0x774E
+0x7120 = 0x774F
+0x712B = 0x774D
+0x712E = 0x7750
+0x7130 = 0x7751
+0x7146 = 0x7752
+0x7147 = 0x7753
+0x7151 = 0x7754
+0x7152 = 0x7756
+0x715C = 0x7757
+0x7160 = 0x7758
+0x7168 = 0x7759
+0x7185 = 0x775B
+0x7187 = 0x775C
+0x7192 = 0x775D
+0x71BA = 0x775F
+0x71C1 = 0x775E
+0x71C4 = 0x7760
+0x71FE = 0x7761
+0x7200 = 0x7762
+0x7215 = 0x7763
+0x7255 = 0x7764
+0x7256 = 0x7765
+0x728D = 0x7767
+0x729B = 0x7768
+0x72BE = 0x7769
+0x72C0 = 0x776A
+0x72FB = 0x776B
+0x7327 = 0x776D
+0x7328 = 0x776E
+0x7350 = 0x7770
+0x7366 = 0x7771
+0x737C = 0x7772
+0x7395 = 0x7773
+0x739F = 0x7774
+0x73A0 = 0x7775
+0x73A2 = 0x7776
+0x73A6 = 0x7777
+0x73AB = 0x7778
+0x73C9 = 0x7779
+0x73CF = 0x777A
+0x73D6 = 0x777B
+0x73D9 = 0x777C
+0x73E3 = 0x777D
+0x73E9 = 0x777E
+0x7407 = 0x7821
+0x740A = 0x7822
+0x741A = 0x7823
+0x741B = 0x7824
+0x7426 = 0x7826
+0x7428 = 0x7827
+0x742A = 0x7828
+0x742B = 0x7829
+0x742C = 0x782A
+0x742E = 0x782B
+0x742F = 0x782C
+0x7430 = 0x782D
+0x7444 = 0x782E
+0x7446 = 0x782F
+0x7447 = 0x7830
+0x744B = 0x7831
+0x7457 = 0x7832
+0x7462 = 0x7833
+0x746B = 0x7834
+0x746D = 0x7835
+0x7486 = 0x7836
+0x7487 = 0x7837
+0x7489 = 0x7838
+0x7490 = 0x783D
+0x7498 = 0x7839
+0x749C = 0x783A
+0x749F = 0x783B
+0x74A3 = 0x783C
+0x74A6 = 0x783E
+0x74A8 = 0x783F
+0x74A9 = 0x7840
+0x74B5 = 0x7841
+0x74BF = 0x7842
+0x74C8 = 0x7843
+0x74C9 = 0x7844
+0x74DA = 0x7845
+0x74FF = 0x7846
+0x7501 = 0x7847
+0x7517 = 0x7848
+0x752F = 0x7849
+0x756F = 0x784A
+0x7579 = 0x784B
+0x7592 = 0x784C
+0x75CE = 0x784E
+0x75E4 = 0x784F
+0x7600 = 0x7850
+0x7602 = 0x7851
+0x7608 = 0x7852
+0x7615 = 0x7853
+0x7616 = 0x7854
+0x7619 = 0x7855
+0x761E = 0x7856
+0x7626 = 0x7E7D
+0x762D = 0x7857
+0x7635 = 0x7858
+0x7643 = 0x7859
+0x764B = 0x785A
+0x7664 = 0x785B
+0x7665 = 0x785C
+0x766D = 0x785D
+0x766F = 0x785E
+0x7671 = 0x785F
+0x7681 = 0x7860
+0x769B = 0x7861
+0x769D = 0x7862
+0x769E = 0x7863
+0x76A6 = 0x7864
+0x76AA = 0x7865
+0x76B6 = 0x7866
+0x76C5 = 0x7867
+0x76CC = 0x7868
+0x76CE = 0x7869
+0x76D4 = 0x786A
+0x76E6 = 0x786B
+0x76F1 = 0x786C
+0x76FC = 0x786D
+0x770A = 0x786E
+0x7719 = 0x786F
+0x7734 = 0x7870
+0x7736 = 0x7871
+0x7746 = 0x7872
+0x774D = 0x7873
+0x774E = 0x7874
+0x775C = 0x7875
+0x775F = 0x7876
+0x7762 = 0x7877
+0x777A = 0x7878
+0x7780 = 0x7879
+0x7794 = 0x787A
+0x77AA = 0x787B
+0x77E0 = 0x787C
+0x782D = 0x787D
+0x7843 = 0x7921
+0x784E = 0x7922
+0x784F = 0x7923
+0x7851 = 0x7924
+0x7868 = 0x7925
+0x786E = 0x7926
+0x78AD = 0x792A
+0x78B0 = 0x7928
+0x78E4 = 0x792B
+0x78F2 = 0x792C
+0x78F7 = 0x792E
+0x7900 = 0x792D
+0x791C = 0x792F
+0x792E = 0x7930
+0x7931 = 0x7931
+0x7934 = 0x7932
+0x7945 = 0x7935
+0x7946 = 0x7936
+0x795C = 0x793A
+0x7979 = 0x793E
+0x7998 = 0x7942
+0x79B1 = 0x7943
+0x79B8 = 0x7944
+0x79C8 = 0x7945
+0x79CA = 0x7946
+0x79D4 = 0x7948
+0x79DE = 0x7949
+0x79EB = 0x794A
+0x79ED = 0x794B
+0x7A03 = 0x794C
+0x7A39 = 0x794E
+0x7A5D = 0x794F
+0x7A6D = 0x7950
+0x7A85 = 0x7952
+0x7AA0 = 0x7953
+0x7AB3 = 0x7955
+0x7ABB = 0x7956
+0x7ACE = 0x7957
+0x7AEB = 0x7958
+0x7AFD = 0x7959
+0x7B12 = 0x795A
+0x7B2D = 0x795B
+0x7B3B = 0x795C
+0x7B47 = 0x795D
+0x7B4E = 0x795E
+0x7B60 = 0x795F
+0x7B6D = 0x7960
+0x7B6F = 0x7961
+0x7B72 = 0x7962
+0x7B9E = 0x7963
+0x7BD7 = 0x7965
+0x7BD9 = 0x7966
+0x7C01 = 0x7967
+0x7C1E = 0x7969
+0x7C20 = 0x796A
+0x7C31 = 0x7968
+0x7C33 = 0x796B
+0x7C36 = 0x796C
+0x7C59 = 0x796F
+0x7C6D = 0x7970
+0x7C79 = 0x7971
+0x7C8F = 0x7972
+0x7C94 = 0x7973
+0x7CA0 = 0x7974
+0x7CBC = 0x7975
+0x7CD5 = 0x7976
+0x7CD9 = 0x7977
+0x7CDD = 0x7978
+0x7D07 = 0x7979
+0x7D08 = 0x797A
+0x7D13 = 0x797B
+0x7D1D = 0x797C
+0x7D23 = 0x797D
+0x7D31 = 0x797E
+0x7D41 = 0x7A21
+0x7D48 = 0x7A22
+0x7D53 = 0x7A23
+0x7D5C = 0x7A24
+0x7D7A = 0x7A25
+0x7D83 = 0x7A26
+0x7D8B = 0x7A27
+0x7DA0 = 0x7A28
+0x7DA6 = 0x7A29
+0x7DC2 = 0x7A2A
+0x7DCC = 0x7A2B
+0x7DD6 = 0x7A2C
+0x7DE3 = 0x7A2D
+0x7E08 = 0x7A30
+0x7E11 = 0x7A31
+0x7E15 = 0x7A32
+0x7E28 = 0x7A2F
+0x7E47 = 0x7A34
+0x7E52 = 0x7A35
+0x7E61 = 0x7A36
+0x7E6B = 0x7E7E
+0x7E8A = 0x7A37
+0x7E8D = 0x7A38
+0x7F47 = 0x7A39
+0x7F91 = 0x7A3B
+0x7F97 = 0x7A3C
+0x7FBF = 0x7A3D
+0x7FCE = 0x7A3E
+0x7FDB = 0x7A3F
+0x7FDF = 0x7A40
+0x7FEC = 0x7A41
+0x7FEE = 0x7A42
+0x7FFA = 0x7A43
+0x8014 = 0x7A45
+0x8026 = 0x7A46
+0x8035 = 0x7A47
+0x8037 = 0x7A48
+0x803C = 0x7A49
+0x80CA = 0x7A4A
+0x80D7 = 0x7A4B
+0x80E0 = 0x7A4C
+0x80F3 = 0x7A4D
+0x8118 = 0x7A4E
+0x814A = 0x7A4F
+0x8160 = 0x7A50
+0x8167 = 0x7A51
+0x8168 = 0x7A52
+0x816D = 0x7A53
+0x81BB = 0x7A54
+0x81CA = 0x7A55
+0x81CF = 0x7A56
+0x81D7 = 0x7A57
+0x8260 = 0x7A5B
+0x8274 = 0x7A5C
+0x828E = 0x7A5E
+0x82A1 = 0x7A5F
+0x82A3 = 0x7A60
+0x82A4 = 0x7A61
+0x82A9 = 0x7A62
+0x82AE = 0x7A63
+0x82B7 = 0x7A64
+0x82BE = 0x7A65
+0x82BF = 0x7A66
+0x82C6 = 0x7A67
+0x82D5 = 0x7A68
+0x82FD = 0x7A69
+0x82FE = 0x7A6A
+0x8300 = 0x7A6B
+0x8301 = 0x7A6C
+0x8322 = 0x7A6E
+0x832D = 0x7A6F
+0x833A = 0x7A70
+0x8343 = 0x7A71
+0x8347 = 0x7A72
+0x8351 = 0x7A73
+0x8355 = 0x7A74
+0x8362 = 0x7A6D
+0x837D = 0x7A75
+0x8386 = 0x7A76
+0x8392 = 0x7A77
+0x8398 = 0x7A78
+0x83A7 = 0x7A79
+0x83A9 = 0x7A7A
+0x83BF = 0x7A7B
+0x83C0 = 0x7A7C
+0x83C7 = 0x7A7D
+0x83CF = 0x7A7E
+0x83D1 = 0x7B21
+0x83E1 = 0x7B22
+0x83EA = 0x7B23
+0x8401 = 0x7B24
+0x8406 = 0x7B25
+0x840A = 0x7B26
+0x8448 = 0x7B28
+0x845F = 0x7B29
+0x8470 = 0x7B2A
+0x8473 = 0x7B2B
+0x8485 = 0x7B2C
+0x849E = 0x7B2D
+0x84AF = 0x7B2E
+0x84B4 = 0x7B2F
+0x84BA = 0x7B30
+0x84C0 = 0x7B31
+0x84C2 = 0x7B32
+0x851E = 0x7B35
+0x8523 = 0x7B36
+0x852F = 0x7B37
+0x8532 = 0x7B34
+0x8559 = 0x7B38
+0x8564 = 0x7B39
+0x857A = 0x7B3C
+0x858C = 0x7B3D
+0x858F = 0x7B3E
+0x85A2 = 0x7B3F
+0x85AD = 0x7B3B
+0x85B0 = 0x7B40
+0x85CB = 0x7B41
+0x85CE = 0x7B42
+0x85ED = 0x7B43
+0x85FF = 0x7B45
+0x8604 = 0x7B46
+0x8605 = 0x7B47
+0x8610 = 0x7B48
+0x8612 = 0x7B44
+0x8618 = 0x7B4A
+0x8629 = 0x7B4B
+0x8638 = 0x7B4C
+0x8641 = 0x2F68
+0x8657 = 0x7B4D
+0x865B = 0x7B4E
+0x8662 = 0x7B50
+0x866C = 0x7B52
+0x8675 = 0x7B53
+0x8698 = 0x7B54
+0x86B8 = 0x7B55
+0x86FA = 0x7B56
+0x86FC = 0x7B57
+0x86FD = 0x7B58
+0x870B = 0x7B59
+0x8771 = 0x7B5A
+0x8787 = 0x7B5B
+0x8788 = 0x7B5C
+0x87AC = 0x7B5D
+0x87AD = 0x7B5E
+0x87B5 = 0x7B5F
+0x87D6 = 0x7B61
+0x87EC = 0x7B62
+0x8806 = 0x7B63
+0x880A = 0x7B64
+0x8810 = 0x7B65
+0x8814 = 0x7B66
+0x881F = 0x7B67
+0x8898 = 0x7B68
+0x88AA = 0x7B69
+0x88CA = 0x7B6A
+0x88CE = 0x7B6B
+0x88F5 = 0x7B6D
+0x8918 = 0x7B70
+0x8919 = 0x7B71
+0x891A = 0x7B72
+0x891C = 0x7B6E
+0x8927 = 0x7B73
+0x8930 = 0x7B74
+0x8932 = 0x7B75
+0x8939 = 0x7B76
+0x8940 = 0x7B77
+0x8994 = 0x7B78
+0x89D4 = 0x7B7A
+0x89E5 = 0x7B7B
+0x89F6 = 0x7B7C
+0x8A12 = 0x7B7D
+0x8A15 = 0x7B7E
+0x8A22 = 0x7C21
+0x8A37 = 0x7C22
+0x8A47 = 0x7C23
+0x8A4E = 0x7C24
+0x8A5D = 0x7C25
+0x8A61 = 0x7C26
+0x8A75 = 0x7C27
+0x8A79 = 0x7C28
+0x8AA7 = 0x7C29
+0x8AD0 = 0x7C2A
+0x8ADF = 0x7C2B
+0x8AF4 = 0x7C2C
+0x8AF6 = 0x7C2D
+0x8B46 = 0x7C31
+0x8B54 = 0x7C32
+0x8B59 = 0x7C33
+0x8B69 = 0x7C34
+0x8B9D = 0x7C35
+0x8C49 = 0x7C36
+0x8C68 = 0x7C37
+0x8CE1 = 0x7C39
+0x8CF4 = 0x7C3A
+0x8CF8 = 0x7C3B
+0x8CFE = 0x7C3C
+0x8D12 = 0x7C3E
+0x8D1B = 0x7C3F
+0x8DAF = 0x7C40
+0x8DCE = 0x7C41
+0x8DD1 = 0x7C42
+0x8DD7 = 0x7C43
+0x8E20 = 0x7C44
+0x8E23 = 0x7C45
+0x8E3D = 0x7C46
+0x8E70 = 0x7C47
+0x8E7B = 0x7C48
+0x8EC0 = 0x7C4A
+0x8EFA = 0x7C4C
+0x8F1E = 0x7C4D
+0x8F2D = 0x7C4E
+0x8F36 = 0x7C4F
+0x8F54 = 0x7C50
+0x8FA6 = 0x7C52
+0x8FB5 = 0x7C53
+0x8FE4 = 0x7C54
+0x8FE8 = 0x7C55
+0x8FEE = 0x7C56
+0x9008 = 0x7C57
+0x902D = 0x7C58
+0x9088 = 0x7C5A
+0x9095 = 0x7C5B
+0x9097 = 0x7C5C
+0x9099 = 0x7C5D
+0x909B = 0x7C5E
+0x90A2 = 0x7C5F
+0x90B3 = 0x7C60
+0x90BE = 0x7C61
+0x90C4 = 0x7C62
+0x90C5 = 0x7C63
+0x90C7 = 0x7C64
+0x90D7 = 0x7C65
+0x90DD = 0x7C66
+0x90DE = 0x7C67
+0x90EF = 0x7C68
+0x90F4 = 0x7C69
+0x9114 = 0x7C6B
+0x9115 = 0x7C6C
+0x9116 = 0x7C6D
+0x9122 = 0x7C6E
+0x9123 = 0x7C6F
+0x9127 = 0x7C70
+0x912F = 0x7C71
+0x9131 = 0x7C72
+0x9134 = 0x7C73
+0x913D = 0x7C74
+0x9148 = 0x7C75
+0x915B = 0x7C76
+0x9183 = 0x7C77
+0x919E = 0x7C78
+0x91AC = 0x7C79
+0x91B1 = 0x7C7A
+0x91BC = 0x7C7B
+0x91D7 = 0x7C7C
+0x91E4 = 0x7C7E
+0x91E5 = 0x7D21
+0x91ED = 0x7D22
+0x91F1 = 0x7D23
+0x91FB = 0x7C7D
+0x9207 = 0x7D24
+0x9210 = 0x7D25
+0x9238 = 0x7D26
+0x9239 = 0x7D27
+0x923A = 0x7D28
+0x923C = 0x7D29
+0x9240 = 0x7D2A
+0x9243 = 0x7D2B
+0x924F = 0x7D2C
+0x9278 = 0x7D2D
+0x9288 = 0x7D2E
+0x92C2 = 0x7D2F
+0x92CB = 0x7D30
+0x92CC = 0x7D31
+0x92D3 = 0x7D32
+0x92E0 = 0x7D33
+0x92FF = 0x7D34
+0x9304 = 0x7D35
+0x931F = 0x7D36
+0x9321 = 0x7D37
+0x9325 = 0x7D38
+0x9348 = 0x7D39
+0x9349 = 0x7D3A
+0x934A = 0x7D3B
+0x9364 = 0x7D3C
+0x9365 = 0x7D3D
+0x936A = 0x7D3E
+0x9370 = 0x7D3F
+0x939B = 0x7D40
+0x93A3 = 0x7D41
+0x93BA = 0x7D42
+0x93C6 = 0x7D43
+0x93DE = 0x7D44
+0x93DF = 0x7D45
+0x93FD = 0x7D47
+0x9404 = 0x7D46
+0x9433 = 0x7D48
+0x944A = 0x7D49
+0x9463 = 0x7D4A
+0x946B = 0x7D4B
+0x9471 = 0x7D4C
+0x9472 = 0x7D4D
+0x958E = 0x7D4E
+0x959F = 0x7D4F
+0x95A6 = 0x7D50
+0x95A9 = 0x7D51
+0x95AC = 0x7D52
+0x95B6 = 0x7D53
+0x95BD = 0x7D54
+0x95CB = 0x7D55
+0x95D0 = 0x7D56
+0x95D3 = 0x7D57
+0x95DA = 0x7D59
+0x95DE = 0x7D5A
+0x9658 = 0x7D5B
+0x9684 = 0x7D5C
+0x969D = 0x7D5E
+0x96A4 = 0x7D5F
+0x96A5 = 0x7D60
+0x96D2 = 0x7D61
+0x96DE = 0x7D62
+0x96E9 = 0x7D64
+0x96EF = 0x7D65
+0x9733 = 0x7D66
+0x973B = 0x7D67
+0x974D = 0x7D68
+0x974E = 0x7D69
+0x974F = 0x7D6A
+0x975A = 0x7D6B
+0x976E = 0x7D6C
+0x9773 = 0x7D6D
+0x9795 = 0x7D6E
+0x97AE = 0x7D6F
+0x97BA = 0x7D70
+0x97C1 = 0x7D71
+0x97C9 = 0x7D72
+0x97DB = 0x7D74
+0x97DE = 0x7D73
+0x97F4 = 0x7D75
+0x980A = 0x7D77
+0x981E = 0x7D78
+0x982B = 0x7D79
+0x9830 = 0x7D7A
+0x9852 = 0x7D7C
+0x9853 = 0x7D7D
+0x9856 = 0x7D7E
+0x9857 = 0x7E21
+0x9859 = 0x7E22
+0x985A = 0x7E23
+0x9865 = 0x7E25
+0x986C = 0x7E26
+0x98BA = 0x7E27
+0x98C8 = 0x7E28
+0x98E7 = 0x7E29
+0x9958 = 0x7E2A
+0x999E = 0x7E2B
+0x9A02 = 0x7E2C
+0x9A03 = 0x7E2D
+0x9A24 = 0x7E2E
+0x9A2D = 0x7E2F
+0x9A2E = 0x7E30
+0x9A38 = 0x7E31
+0x9A4A = 0x7E32
+0x9A4E = 0x7E33
+0x9A52 = 0x7E34
+0x9AB6 = 0x7E35
+0x9AC1 = 0x7E36
+0x9AC3 = 0x7E37
+0x9ACE = 0x7E38
+0x9AD6 = 0x7E39
+0x9AF9 = 0x7E3A
+0x9B02 = 0x7E3B
+0x9B08 = 0x7E3C
+0x9B20 = 0x7E3D
+0x9B2D = 0x7E3F
+0x9B5E = 0x7E40
+0x9B66 = 0x7E42
+0x9B72 = 0x7E43
+0x9B75 = 0x7E44
+0x9B79 = 0x7E41
+0x9B84 = 0x7E45
+0x9B8A = 0x7E46
+0x9B8F = 0x7E47
+0x9B9E = 0x7E48
+0x9BA7 = 0x7E49
+0x9BC1 = 0x7E4A
+0x9BCE = 0x7E4B
+0x9BE5 = 0x7E4C
+0x9BF8 = 0x7E4D
+0x9BFD = 0x7E4E
+0x9C00 = 0x7E4F
+0x9C23 = 0x7E50
+0x9C41 = 0x7E51
+0x9C4F = 0x7E52
+0x9C50 = 0x7E53
+0x9C53 = 0x7E54
+0x9C63 = 0x7E55
+0x9C65 = 0x7E56
+0x9C77 = 0x7E57
+0x9D1D = 0x7E58
+0x9D1E = 0x7E59
+0x9D43 = 0x7E5A
+0x9D47 = 0x7E5B
+0x9D52 = 0x7E5C
+0x9D63 = 0x7E5D
+0x9D70 = 0x7E5E
+0x9D7C = 0x7E5F
+0x9D8A = 0x7E60
+0x9D96 = 0x7E61
+0x9DAC = 0x7E63
+0x9DBC = 0x7E64
+0x9DC0 = 0x7E62
+0x9DD7 = 0x7E65
+0x9DE7 = 0x7E67
+0x9E07 = 0x7E68
+0x9E15 = 0x7E69
+0x9E7C = 0x7E6A
+0x9E9E = 0x7E6B
+0x9EA4 = 0x7E6C
+0x9EAC = 0x7E6D
+0x9EAF = 0x7E6E
+0x9EB4 = 0x7E6F
+0x9EB5 = 0x7E70
+0x9EC3 = 0x7E71
+0x9ED1 = 0x7E72
+0x9F10 = 0x7E73
+0x9F39 = 0x7E74
+0x9F57 = 0x7E75
+0x9F90 = 0x7E76
+0x9F94 = 0x7E77
+0x9F97 = 0x7E78
+0x9FA2 = 0x7E79
+0xF91D = 0x763B
+0xF928 = 0x742E
+0xF929 = 0x754E
+0xF936 = 0x7B4F
+0xF970 = 0x7649
+0xF9D0 = 0x7E24
+0xF9DC = 0x7D5D
+0xFA0F = 0x2F4B
+0xFA10 = 0x2F57
+0xFA11 = 0x4F72
+0xFA14 = 0x757A
+0xFA15 = 0x775A
+0xFA16 = 0x776F
+0xFA19 = 0x793C
+0xFA1A = 0x793D
+0xFA1B = 0x7941
+0xFA1F = 0x7B3A
+0xFA22 = 0x7C2E
+0xFA26 = 0x7C6A
+0xFA30 = 0x2E38
+0xFA31 = 0x2E49
+0xFA32 = 0x2E50
+0xFA33 = 0x2E63
+0xFA34 = 0x2E68
+0xFA35 = 0x2E6E
+0xFA36 = 0x2F2C
+0xFA37 = 0x2F2F
+0xFA38 = 0x2F36
+0xFA39 = 0x2F5A
+0xFA3A = 0x2F5E
+0xFA3B = 0x4F61
+0xFA3C = 0x4F62
+0xFA3D = 0x7450
+0xFA3E = 0x745C
+0xFA3F = 0x745E
+0xFA40 = 0x7461
+0xFA41 = 0x7528
+0xFA42 = 0x752B
+0xFA43 = 0x7543
+0xFA44 = 0x7565
+0xFA45 = 0x7669
+0xFA46 = 0x7677
+0xFA47 = 0x7725
+0xFA48 = 0x7755
+0xFA4A = 0x7825
+0xFA4B = 0x7927
+0xFA4C = 0x7933
+0xFA4D = 0x7934
+0xFA4E = 0x7937
+0xFA4F = 0x7938
+0xFA50 = 0x7939
+0xFA51 = 0x793B
+0xFA52 = 0x793F
+0xFA53 = 0x7940
+0xFA54 = 0x794D
+0xFA55 = 0x7951
+0xFA56 = 0x7964
+0xFA57 = 0x7A2E
+0xFA59 = 0x7A33
+0xFA5A = 0x7A3A
+0xFA5B = 0x7A44
+0xFA5C = 0x7A58
+0xFA5F = 0x7B27
+0xFA60 = 0x7B6F
+0xFA61 = 0x7B79
+0xFA62 = 0x7C2F
+0xFA63 = 0x7C30
+0xFA64 = 0x7C38
+0xFA65 = 0x7C3D
+0xFA67 = 0x7C59
+0xFA68 = 0x7D63
+0xFA69 = 0x7D76
+0xFA6A = 0x7D7B
+0xFE45 = 0x233E
+0xFE46 = 0x233D
+0xFF02 = 0x2230 # 0x0022
+0xFF07 = 0x222F # 0x0027
+0xFF0D = 0x2231 # 0x002D
+0xFF5E = 0x2232 # 0x007E
+0xFF5F = 0x2256
+0xFF60 = 0x2257
+END_MAP
diff --git a/enc/trans/JIS/UCS@BMP%JISX0213-2.src b/enc/trans/JIS/UCS@BMP%JISX0213-2.src
new file mode 100644
index 0000000000..ba53d7d72f
--- /dev/null
+++ b/enc/trans/JIS/UCS@BMP%JISX0213-2.src
@@ -0,0 +1,2189 @@
+# $NetBSD: UCS@BMP%JISX0213-2.src,v 1.1 2007/03/05 16:58:33 tnozaki Exp $
+
+TYPE ROWCOL
+NAME "UCS:BMP/JISX0213-2"
+SRC_ZONE 0x3406 - 0xFA66
+OOB_MODE INVALID
+DST_INVALID 0xFFFF
+DST_UNIT_BITS 16
+
+BEGIN_MAP
+## Shift_JIS-2004 (JIS X 0213:2004) vs Unicode mapping table
+##
+## Date: 12 Feb 2005 10:15:00 GMT
+## License:
+## Copyright (C) 2001 earthian@tama.or.jp, All Rights Reserved.
+## Copyright (C) 2001 I'O, All Rights Reserved.
+## You can use, modify, distribute this table freely.
+## Note:
+## [1983] JIS codepoint defined by JIS X 0208-1983
+## [1990] JIS codepoint defined by JIS X 0208-1990
+## [2000] JIS codepoint defined by JIS X 0213:2000
+## [2004] JIS codepoint defined by JIS X 0213:2004
+## [Unicode3.1] UCS codepoint defined by Unicode 3.1
+## [Unicode3.2] UCS codepoint defined by Unicode 3.2
+## Fullwidth UCS fullwidth form (U+Fxxx)
+## Windows Windows (CP932) mapping
+## Some 0213 character can't represent by one UCS character.
+## In this table, such characters are described as 'U+xxxx+xxxx'.
+##
+0x3406 = 0x212D
+0x342C = 0x2132
+0x342E = 0x2133
+0x3468 = 0x215E
+0x346A = 0x2156
+0x3492 = 0x217E
+0x34BC = 0x232B
+0x34C1 = 0x7468
+0x34C7 = 0x232F
+0x351F = 0x2348
+0x355D = 0x235D
+0x355E = 0x235E
+0x3563 = 0x2361
+0x356E = 0x2367
+0x35A6 = 0x2423
+0x35A8 = 0x2426
+0x35C5 = 0x242F
+0x35DA = 0x2438
+0x35F4 = 0x2442
+0x3605 = 0x244A
+0x364A = 0x2479
+0x3691 = 0x253F
+0x3696 = 0x2543
+0x3699 = 0x2541
+0x36CF = 0x2557
+0x3761 = 0x2823
+0x3762 = 0x2825
+0x376B = 0x2829
+0x376C = 0x2828
+0x3775 = 0x282C
+0x37C1 = 0x283E
+0x37E8 = 0x2856
+0x37F4 = 0x2859
+0x37FD = 0x285C
+0x3800 = 0x285E
+0x382F = 0x286F
+0x3836 = 0x2871
+0x3840 = 0x2874
+0x385C = 0x2879
+0x3861 = 0x287B
+0x38FA = 0x2C3B
+0x3917 = 0x2C46
+0x391A = 0x2C4A
+0x396F = 0x2C60
+0x3A6E = 0x2D5B
+0x3A73 = 0x2D5F
+0x3AD6 = 0x2D71
+0x3AD7 = 0x2E36
+0x3AEA = 0x2D7C
+0x3B0E = 0x2E2E
+0x3B1A = 0x2E32
+0x3B1C = 0x2E34
+0x3B6D = 0x2E6D
+0x3B77 = 0x2E65
+0x3B87 = 0x2F28
+0x3B88 = 0x2F29
+0x3B8D = 0x2F2C
+0x3BA4 = 0x2F34
+0x3BCD = 0x2F48
+0x3BF0 = 0x2F5D
+0x3C26 = 0x2F77
+0x3CC3 = 0x6E3B
+0x3CD2 = 0x6E42
+0x3D11 = 0x6E71
+0x3D1E = 0x6E7E
+0x3D64 = 0x6F40
+0x3D9A = 0x6F54
+0x3DC0 = 0x6F70
+0x3DD4 = 0x6F77
+0x3E05 = 0x7028
+0x3E60 = 0x703F
+0x3E66 = 0x7041
+0x3E68 = 0x7042
+0x3E83 = 0x7049
+0x3E94 = 0x7050
+0x3F57 = 0x7134
+0x3F75 = 0x7146
+0x3F77 = 0x7148
+0x3FAE = 0x715C
+0x3FC9 = 0x7167
+0x3FD7 = 0x716C
+0x4039 = 0x7222
+0x4058 = 0x722D
+0x4093 = 0x7239
+0x4105 = 0x7264
+0x4148 = 0x7274
+0x414F = 0x7277
+0x4163 = 0x727D
+0x41B4 = 0x7333
+0x41BF = 0x7337
+0x41E6 = 0x7347
+0x41EE = 0x734B
+0x41F3 = 0x7348
+0x4207 = 0x7353
+0x420E = 0x7357
+0x42C6 = 0x742B
+0x42D6 = 0x7436
+0x42DD = 0x743B
+0x4302 = 0x744E
+0x432B = 0x745D
+0x4343 = 0x7461
+0x43EE = 0x753E
+0x43F0 = 0x7542
+0x4408 = 0x7548
+0x4417 = 0x754A
+0x441C = 0x754C
+0x4422 = 0x754F
+0x4476 = 0x756C
+0x447A = 0x756E
+0x4491 = 0x7577
+0x44B3 = 0x7635
+0x44BE = 0x7632
+0x44D4 = 0x7634
+0x4508 = 0x7659
+0x450D = 0x7654
+0x4525 = 0x766D
+0x4543 = 0x766E
+0x45B8 = 0x774F
+0x45E5 = 0x776C
+0x460F = 0x7824
+0x4641 = 0x783A
+0x4665 = 0x7843
+0x46A1 = 0x784E
+0x46AF = 0x7853
+0x470C = 0x786B
+0x4764 = 0x7929
+0x47FD = 0x793F
+0x4816 = 0x7949
+0x484E = 0x795C
+0x48B5 = 0x7A27
+0x49E7 = 0x7B6A
+0x49FA = 0x7B70
+0x4A04 = 0x7B75
+0x4A29 = 0x7B78
+0x4ABC = 0x7C37
+0x4B3B = 0x7C55
+0x4BC2 = 0x7D26
+0x4BCA = 0x7D28
+0x4BD2 = 0x7D2A
+0x4BE8 = 0x7D31
+0x4C20 = 0x7D3F
+0x4CC4 = 0x7E2A
+0x4CD1 = 0x7E2D
+0x4D07 = 0x7E4B
+0x4D77 = 0x7E60
+0x4E02 = 0x2122
+0x4E0F = 0x2123
+0x4E12 = 0x2124
+0x4E29 = 0x2125
+0x4E2B = 0x2126
+0x4E2C = 0x702E
+0x4E2E = 0x2127
+0x4E40 = 0x2128
+0x4E47 = 0x2129
+0x4E48 = 0x212A
+0x4E51 = 0x212C
+0x4E5A = 0x212F
+0x4E69 = 0x2130
+0x4E9D = 0x2131
+0x4EB9 = 0x2134
+0x4EBB = 0x2135
+0x4EBC = 0x2137
+0x4EC3 = 0x2138
+0x4EC8 = 0x2139
+0x4ED0 = 0x213A
+0x4EDA = 0x213C
+0x4EEB = 0x213B
+0x4EF1 = 0x213D
+0x4EF5 = 0x213E
+0x4F00 = 0x213F
+0x4F16 = 0x2140
+0x4F37 = 0x2142
+0x4F3E = 0x2143
+0x4F54 = 0x2144
+0x4F58 = 0x2145
+0x4F64 = 0x2141
+0x4F77 = 0x2147
+0x4F78 = 0x2148
+0x4F7A = 0x2149
+0x4F7D = 0x214A
+0x4F82 = 0x214B
+0x4F85 = 0x214C
+0x4F92 = 0x214D
+0x4F9A = 0x214E
+0x4FB2 = 0x2150
+0x4FBE = 0x2151
+0x4FC5 = 0x2152
+0x4FCB = 0x2153
+0x4FCF = 0x2154
+0x4FD2 = 0x2155
+0x4FE6 = 0x214F
+0x4FF2 = 0x2157
+0x5000 = 0x2158
+0x5010 = 0x2159
+0x5013 = 0x215A
+0x501C = 0x215B
+0x501E = 0x215C
+0x5022 = 0x215D
+0x5042 = 0x215F
+0x5046 = 0x2160
+0x504E = 0x2161
+0x5053 = 0x2162
+0x5057 = 0x2163
+0x5063 = 0x2164
+0x5066 = 0x2165
+0x506A = 0x2166
+0x5070 = 0x2167
+0x5088 = 0x2169
+0x5092 = 0x216A
+0x5093 = 0x216B
+0x5095 = 0x216C
+0x5096 = 0x216D
+0x509C = 0x216E
+0x50A3 = 0x2168
+0x50AA = 0x216F
+0x50B1 = 0x2171
+0x50BA = 0x2172
+0x50BB = 0x2173
+0x50C4 = 0x2174
+0x50C7 = 0x2175
+0x50CE = 0x2178
+0x50D4 = 0x217A
+0x50D9 = 0x217B
+0x50E1 = 0x217C
+0x50E9 = 0x217D
+0x50F3 = 0x2176
+0x5108 = 0x2321
+0x5117 = 0x2323
+0x511B = 0x2324
+0x5160 = 0x2326
+0x5173 = 0x2328
+0x517B = 0x7474
+0x5183 = 0x2329
+0x518B = 0x232A
+0x5198 = 0x232C
+0x51A3 = 0x232D
+0x51AD = 0x232E
+0x51BC = 0x2330
+0x51F3 = 0x2333
+0x51F4 = 0x2334
+0x5202 = 0x2335
+0x5212 = 0x2336
+0x5216 = 0x2337
+0x5255 = 0x2339
+0x525C = 0x233A
+0x526C = 0x233B
+0x5277 = 0x233C
+0x5282 = 0x233E
+0x5284 = 0x233D
+0x5298 = 0x2340
+0x52A4 = 0x2342
+0x52A6 = 0x2343
+0x52AF = 0x2344
+0x52BA = 0x2345
+0x52BB = 0x2346
+0x52CA = 0x2347
+0x52D1 = 0x2349
+0x52F7 = 0x234B
+0x530A = 0x234C
+0x530B = 0x234D
+0x5324 = 0x234E
+0x5335 = 0x234F
+0x533E = 0x2350
+0x5342 = 0x2351
+0x5367 = 0x2354
+0x536C = 0x2355
+0x537A = 0x2356
+0x53A4 = 0x2357
+0x53B4 = 0x2358
+0x53B7 = 0x235A
+0x53C0 = 0x235B
+0x53D5 = 0x235F
+0x53DA = 0x2360
+0x53F4 = 0x2362
+0x53F5 = 0x2363
+0x5424 = 0x2365
+0x5428 = 0x2366
+0x5443 = 0x2368
+0x5455 = 0x2364
+0x5462 = 0x2369
+0x5466 = 0x236A
+0x546C = 0x236B
+0x548A = 0x236C
+0x548D = 0x236D
+0x5495 = 0x236E
+0x54A0 = 0x236F
+0x54A6 = 0x2370
+0x54AD = 0x2371
+0x54AE = 0x2372
+0x54B7 = 0x2373
+0x54BA = 0x2374
+0x54BF = 0x2375
+0x54C3 = 0x2376
+0x54EC = 0x2378
+0x54EF = 0x2379
+0x54F1 = 0x237A
+0x54F3 = 0x237B
+0x5500 = 0x237C
+0x5501 = 0x237D
+0x5509 = 0x237E
+0x553C = 0x2421
+0x5541 = 0x2422
+0x5547 = 0x2424
+0x554A = 0x2425
+0x5560 = 0x2427
+0x5561 = 0x2428
+0x5564 = 0x2429
+0x557D = 0x242B
+0x5582 = 0x242C
+0x5588 = 0x242D
+0x5591 = 0x242E
+0x55BF = 0x2433
+0x55C9 = 0x2434
+0x55CC = 0x2435
+0x55D1 = 0x2436
+0x55D2 = 0x2430
+0x55DD = 0x2437
+0x55E2 = 0x2439
+0x55E9 = 0x243B
+0x5607 = 0x243E
+0x5610 = 0x243F
+0x5628 = 0x243C
+0x5630 = 0x2440
+0x5637 = 0x2441
+0x563D = 0x2443
+0x563F = 0x2444
+0x5640 = 0x2445
+0x5647 = 0x2446
+0x565E = 0x2447
+0x5660 = 0x2448
+0x566D = 0x2449
+0x5688 = 0x244B
+0x568C = 0x244C
+0x5695 = 0x244D
+0x569A = 0x244E
+0x569D = 0x244F
+0x56A8 = 0x2450
+0x56AD = 0x2451
+0x56B2 = 0x2452
+0x56C5 = 0x2453
+0x56CD = 0x2454
+0x56DF = 0x2455
+0x56E8 = 0x2456
+0x56F6 = 0x2457
+0x56F7 = 0x2458
+0x5715 = 0x245A
+0x5723 = 0x245B
+0x5729 = 0x245D
+0x5745 = 0x245F
+0x5746 = 0x2460
+0x574C = 0x2461
+0x574D = 0x2462
+0x5768 = 0x2464
+0x576F = 0x2465
+0x5773 = 0x2466
+0x5774 = 0x2467
+0x5775 = 0x2468
+0x577B = 0x2469
+0x579A = 0x246D
+0x579D = 0x246E
+0x579E = 0x246F
+0x57A8 = 0x2470
+0x57AC = 0x246C
+0x57CC = 0x2473
+0x57D7 = 0x2471
+0x57DE = 0x2476
+0x57E6 = 0x2477
+0x57F0 = 0x2478
+0x57F8 = 0x247A
+0x57FB = 0x247B
+0x57FD = 0x247C
+0x5804 = 0x247D
+0x581E = 0x247E
+0x5820 = 0x2521
+0x5827 = 0x2522
+0x5832 = 0x2523
+0x5839 = 0x2524
+0x5849 = 0x2526
+0x584C = 0x2527
+0x5867 = 0x2528
+0x588A = 0x2529
+0x588B = 0x252A
+0x588D = 0x252B
+0x588F = 0x252C
+0x5890 = 0x252D
+0x5894 = 0x252E
+0x589D = 0x252F
+0x58AA = 0x2530
+0x58B1 = 0x2531
+0x58C3 = 0x2533
+0x58CD = 0x2534
+0x58E2 = 0x2535
+0x58F3 = 0x2536
+0x58F4 = 0x2537
+0x5905 = 0x2538
+0x5906 = 0x2539
+0x590B = 0x253A
+0x590D = 0x253B
+0x5914 = 0x253C
+0x5924 = 0x253D
+0x593D = 0x2540
+0x5946 = 0x2542
+0x595B = 0x2545
+0x595F = 0x2546
+0x5975 = 0x2548
+0x5976 = 0x2549
+0x597C = 0x254A
+0x599F = 0x254B
+0x59AE = 0x254C
+0x59BC = 0x254D
+0x59C8 = 0x254E
+0x59CD = 0x254F
+0x59DE = 0x2550
+0x59E3 = 0x2551
+0x59E4 = 0x2552
+0x59E7 = 0x2553
+0x59EE = 0x2554
+0x5A0C = 0x2558
+0x5A0D = 0x2559
+0x5A17 = 0x255A
+0x5A27 = 0x255B
+0x5A2D = 0x255C
+0x5A55 = 0x255D
+0x5A65 = 0x255E
+0x5A7A = 0x255F
+0x5A8B = 0x2560
+0x5A9C = 0x2561
+0x5A9F = 0x2562
+0x5AA0 = 0x2563
+0x5AA2 = 0x2564
+0x5AB1 = 0x2565
+0x5AB3 = 0x2566
+0x5AB5 = 0x2567
+0x5ABA = 0x2568
+0x5ABF = 0x2569
+0x5ADA = 0x256A
+0x5ADC = 0x256B
+0x5AE0 = 0x256C
+0x5AE5 = 0x256D
+0x5AEE = 0x256F
+0x5AF0 = 0x256E
+0x5AF5 = 0x2570
+0x5B00 = 0x2571
+0x5B08 = 0x2572
+0x5B17 = 0x2573
+0x5B2D = 0x2575
+0x5B34 = 0x2574
+0x5B4C = 0x2576
+0x5B52 = 0x2577
+0x5B68 = 0x2578
+0x5B6F = 0x2579
+0x5B7C = 0x257A
+0x5B7F = 0x257B
+0x5B81 = 0x257C
+0x5B84 = 0x257D
+0x5B96 = 0x2821
+0x5BAC = 0x2822
+0x5BC0 = 0x2824
+0x5BCE = 0x2826
+0x5BD6 = 0x2827
+0x5BF1 = 0x282A
+0x5BFD = 0x282B
+0x5C03 = 0x282D
+0x5C29 = 0x282E
+0x5C30 = 0x282F
+0x5C5F = 0x2831
+0x5C63 = 0x2832
+0x5C67 = 0x2833
+0x5C68 = 0x2834
+0x5C69 = 0x2835
+0x5C70 = 0x2836
+0x5C7C = 0x2839
+0x5C88 = 0x283C
+0x5C8A = 0x283D
+0x5CA0 = 0x2841
+0x5CA2 = 0x2842
+0x5CA6 = 0x2843
+0x5CA7 = 0x2844
+0x5CAD = 0x2846
+0x5CB5 = 0x2847
+0x5CC9 = 0x2849
+0x5D06 = 0x284C
+0x5D10 = 0x284D
+0x5D1D = 0x284F
+0x5D20 = 0x2850
+0x5D24 = 0x2851
+0x5D26 = 0x2852
+0x5D2B = 0x284E
+0x5D31 = 0x2853
+0x5D39 = 0x2854
+0x5D42 = 0x2855
+0x5D61 = 0x2857
+0x5D6A = 0x2858
+0x5D70 = 0x285A
+0x5D88 = 0x285D
+0x5D92 = 0x285F
+0x5D94 = 0x2860
+0x5D97 = 0x2861
+0x5D99 = 0x2862
+0x5DB0 = 0x2863
+0x5DB2 = 0x2864
+0x5DB4 = 0x2865
+0x5DB9 = 0x2867
+0x5DD1 = 0x2868
+0x5DD7 = 0x2869
+0x5DD8 = 0x286A
+0x5DE0 = 0x286B
+0x5DE4 = 0x286D
+0x5DE9 = 0x286E
+0x5E00 = 0x2870
+0x5E12 = 0x2872
+0x5E15 = 0x2873
+0x5E1F = 0x2875
+0x5E2E = 0x2876
+0x5E3E = 0x2877
+0x5E49 = 0x2878
+0x5E56 = 0x287A
+0x5E6B = 0x287C
+0x5E6C = 0x287D
+0x5E6D = 0x287E
+0x5E6E = 0x2C21
+0x5EA5 = 0x2C23
+0x5EAA = 0x2C24
+0x5EAC = 0x2C25
+0x5EB9 = 0x2C26
+0x5EBF = 0x2C27
+0x5EC6 = 0x2C28
+0x5ED2 = 0x2C29
+0x5ED9 = 0x2C2A
+0x5EFD = 0x2C2C
+0x5F08 = 0x2C2D
+0x5F0E = 0x2C2E
+0x5F1C = 0x2C2F
+0x5F1E = 0x2C31
+0x5F47 = 0x2C32
+0x5F63 = 0x2C33
+0x5F72 = 0x2C34
+0x5F7E = 0x2C35
+0x5F8F = 0x2C36
+0x5FA2 = 0x2C37
+0x5FA4 = 0x2C38
+0x5FB8 = 0x2C39
+0x5FC4 = 0x2C3A
+0x5FC7 = 0x2C3C
+0x5FCB = 0x2C3D
+0x5FD2 = 0x2C3E
+0x5FD3 = 0x2C3F
+0x5FD4 = 0x2C40
+0x5FE2 = 0x2C41
+0x5FEE = 0x2C42
+0x5FEF = 0x2C43
+0x5FF3 = 0x2C44
+0x5FFC = 0x2C45
+0x6017 = 0x2C47
+0x6022 = 0x2C48
+0x6024 = 0x2C49
+0x604C = 0x2C4B
+0x607F = 0x2C4C
+0x608A = 0x2C4D
+0x6095 = 0x2C4E
+0x60A8 = 0x2C4F
+0x60B0 = 0x2C51
+0x60B1 = 0x2C52
+0x60BE = 0x2C53
+0x60C8 = 0x2C54
+0x60D9 = 0x2C55
+0x60DB = 0x2C56
+0x60EE = 0x2C57
+0x60F2 = 0x2C58
+0x60F5 = 0x2C59
+0x6110 = 0x2C5A
+0x6112 = 0x2C5B
+0x6113 = 0x2C5C
+0x6119 = 0x2C5D
+0x611E = 0x2C5E
+0x613A = 0x2C5F
+0x6141 = 0x2C61
+0x6146 = 0x2C62
+0x6160 = 0x2C63
+0x617C = 0x2C64
+0x6192 = 0x2C66
+0x6193 = 0x2C67
+0x6197 = 0x2C68
+0x6198 = 0x2C69
+0x61A5 = 0x2C6A
+0x61A8 = 0x2C6B
+0x61AD = 0x2C6C
+0x61D5 = 0x2C6E
+0x61DD = 0x2C6F
+0x61DF = 0x2C70
+0x61F5 = 0x2C71
+0x6215 = 0x2C73
+0x6223 = 0x2C74
+0x6229 = 0x2C75
+0x6246 = 0x2C76
+0x624C = 0x2C77
+0x6251 = 0x2C78
+0x6252 = 0x2C79
+0x6261 = 0x2C7A
+0x6264 = 0x2C7B
+0x626D = 0x2C7D
+0x6273 = 0x2C7E
+0x627B = 0x2C7C
+0x6299 = 0x2D21
+0x62A6 = 0x2D22
+0x62D5 = 0x2D23
+0x62FD = 0x2D25
+0x6303 = 0x2D26
+0x630D = 0x2D27
+0x6310 = 0x2D28
+0x6332 = 0x2D2B
+0x6335 = 0x2D2C
+0x633B = 0x2D2D
+0x633C = 0x2D2E
+0x6341 = 0x2D2F
+0x6344 = 0x2D30
+0x634E = 0x2D31
+0x6359 = 0x2D33
+0x636C = 0x2D36
+0x6384 = 0x2D37
+0x6394 = 0x2D3A
+0x6399 = 0x2D38
+0x63BD = 0x2D3B
+0x63D4 = 0x2D3D
+0x63D5 = 0x2D3E
+0x63DC = 0x2D3F
+0x63E0 = 0x2D40
+0x63EB = 0x2D41
+0x63EC = 0x2D42
+0x63F2 = 0x2D43
+0x63F7 = 0x2D3C
+0x6409 = 0x2D44
+0x641E = 0x2D45
+0x6425 = 0x2D46
+0x6429 = 0x2D47
+0x642F = 0x2D48
+0x645A = 0x2D49
+0x645B = 0x2D4A
+0x645D = 0x2D4B
+0x6473 = 0x2D4C
+0x647D = 0x2D4D
+0x6487 = 0x2D4E
+0x6491 = 0x2D4F
+0x649D = 0x2D50
+0x649F = 0x2D51
+0x64CB = 0x2D52
+0x64CC = 0x2D53
+0x64D5 = 0x2D54
+0x64D7 = 0x2D55
+0x64E4 = 0x2D57
+0x64E5 = 0x2D58
+0x64FF = 0x2D59
+0x6504 = 0x2D5A
+0x650F = 0x2D5C
+0x6514 = 0x2D5D
+0x6516 = 0x2D5E
+0x651E = 0x2D60
+0x6532 = 0x2D61
+0x6544 = 0x2D62
+0x6554 = 0x2D63
+0x656B = 0x2D64
+0x657A = 0x2D65
+0x6581 = 0x2D66
+0x6584 = 0x2D67
+0x6585 = 0x2D68
+0x658A = 0x2D69
+0x65B2 = 0x2D6A
+0x65B5 = 0x2D6B
+0x65B8 = 0x2D6C
+0x65BF = 0x2D6D
+0x65C2 = 0x2D6E
+0x65C9 = 0x2D6F
+0x65D4 = 0x2D70
+0x65F2 = 0x2D72
+0x65F9 = 0x2D73
+0x65FC = 0x2D74
+0x6604 = 0x2D75
+0x6608 = 0x2D76
+0x6621 = 0x2D77
+0x662A = 0x2D78
+0x6645 = 0x2D79
+0x664E = 0x2D7B
+0x6651 = 0x2D7A
+0x6657 = 0x2D7E
+0x665B = 0x2E21
+0x6663 = 0x2E22
+0x666A = 0x2E25
+0x666B = 0x2E26
+0x666C = 0x2E27
+0x666D = 0x2E28
+0x667B = 0x2E29
+0x6680 = 0x2E2A
+0x6690 = 0x2E2B
+0x6692 = 0x2E2C
+0x6699 = 0x2E2D
+0x66AD = 0x2E2F
+0x66B1 = 0x2E30
+0x66B5 = 0x2E31
+0x66BF = 0x2E33
+0x66EC = 0x2E35
+0x6701 = 0x2E37
+0x6705 = 0x2E38
+0x6712 = 0x2E39
+0x6719 = 0x2E3B
+0x674C = 0x2E3E
+0x674D = 0x2E3F
+0x6754 = 0x2E40
+0x675D = 0x2E41
+0x6774 = 0x2E45
+0x6776 = 0x2E46
+0x6792 = 0x2E48
+0x67B0 = 0x2E4C
+0x67B2 = 0x2E4D
+0x67C3 = 0x2E4E
+0x67C8 = 0x2E4F
+0x67D2 = 0x2E50
+0x67D9 = 0x2E51
+0x67DB = 0x2E52
+0x67F0 = 0x2E53
+0x67F7 = 0x2E54
+0x6810 = 0x2E4B
+0x6818 = 0x2E58
+0x681F = 0x2E59
+0x682D = 0x2E5A
+0x6833 = 0x2E5C
+0x683B = 0x2E5D
+0x683E = 0x2E5E
+0x6844 = 0x2E5F
+0x6845 = 0x2E60
+0x6849 = 0x2E61
+0x684C = 0x2E62
+0x6855 = 0x2E63
+0x6857 = 0x2E64
+0x686B = 0x2E66
+0x686E = 0x2E67
+0x687A = 0x2E68
+0x687C = 0x2E69
+0x6882 = 0x2E6A
+0x6890 = 0x2E6B
+0x6896 = 0x2E6C
+0x6898 = 0x2E6E
+0x6899 = 0x2E6F
+0x689A = 0x2E70
+0x689C = 0x2E71
+0x68AA = 0x2E72
+0x68AB = 0x2E73
+0x68B4 = 0x2E74
+0x68BB = 0x2E75
+0x68C3 = 0x2E7A
+0x68C5 = 0x2E7B
+0x68CC = 0x2E7C
+0x68CF = 0x2E7D
+0x68D6 = 0x2E7E
+0x68D9 = 0x2F21
+0x68E4 = 0x2F22
+0x68E5 = 0x2F23
+0x68EC = 0x2F24
+0x68F7 = 0x2F25
+0x68FB = 0x2E76
+0x6903 = 0x2F26
+0x6907 = 0x2F27
+0x693B = 0x2F2B
+0x6946 = 0x2F2D
+0x6969 = 0x2F2E
+0x696C = 0x2F2F
+0x6972 = 0x2F30
+0x697A = 0x2F31
+0x697F = 0x2F32
+0x6992 = 0x2F33
+0x6996 = 0x2F35
+0x6998 = 0x2F36
+0x69A6 = 0x2F37
+0x69B0 = 0x2F38
+0x69B7 = 0x2F39
+0x69BA = 0x2F3A
+0x69BC = 0x2F3B
+0x69C0 = 0x2F3C
+0x69D1 = 0x2F3D
+0x69D6 = 0x2F3E
+0x69E3 = 0x2F44
+0x69EE = 0x2F45
+0x69EF = 0x2F46
+0x69F3 = 0x2F47
+0x69F4 = 0x2F49
+0x69FE = 0x2F4A
+0x6A11 = 0x2F4B
+0x6A1A = 0x2F4C
+0x6A1D = 0x2F4D
+0x6A30 = 0x2F41
+0x6A32 = 0x2F4F
+0x6A33 = 0x2F50
+0x6A34 = 0x2F51
+0x6A3F = 0x2F52
+0x6A46 = 0x2F53
+0x6A49 = 0x2F54
+0x6A4E = 0x2F56
+0x6A52 = 0x2F57
+0x6A64 = 0x2F58
+0x6A7A = 0x2F55
+0x6A7E = 0x2F5A
+0x6A83 = 0x2F5B
+0x6A8B = 0x2F5C
+0x6A91 = 0x2F5E
+0x6A9F = 0x2F5F
+0x6AA1 = 0x2F60
+0x6AAB = 0x2F62
+0x6ABD = 0x2F63
+0x6AC6 = 0x2F64
+0x6AD0 = 0x2F66
+0x6AD4 = 0x2F65
+0x6ADC = 0x2F67
+0x6ADD = 0x2F68
+0x6AEC = 0x2F6B
+0x6AF1 = 0x2F6C
+0x6AF2 = 0x2F6D
+0x6AF3 = 0x2F6E
+0x6AFD = 0x2F6F
+0x6B0B = 0x2F71
+0x6B0F = 0x2F72
+0x6B10 = 0x2F73
+0x6B11 = 0x2F74
+0x6B17 = 0x2F76
+0x6B2F = 0x2F78
+0x6B4A = 0x2F79
+0x6B58 = 0x2F7A
+0x6B6C = 0x2F7B
+0x6B75 = 0x2F7C
+0x6B7A = 0x2F7D
+0x6B81 = 0x2F7E
+0x6B9B = 0x6E21
+0x6BAE = 0x6E22
+0x6BBD = 0x6E24
+0x6BBE = 0x6E25
+0x6BC7 = 0x6E26
+0x6BC8 = 0x6E27
+0x6BC9 = 0x6E28
+0x6BDA = 0x6E29
+0x6BE6 = 0x6E2A
+0x6BE7 = 0x6E2B
+0x6BEE = 0x6E2C
+0x6BF1 = 0x6E2D
+0x6C02 = 0x6E2E
+0x6C0A = 0x6E2F
+0x6C0E = 0x6E30
+0x6C35 = 0x6E31
+0x6C36 = 0x6E32
+0x6C3A = 0x6E33
+0x6C3F = 0x6E35
+0x6C4D = 0x6E36
+0x6C5B = 0x6E37
+0x6C67 = 0x6E4F
+0x6C6D = 0x6E38
+0x6C84 = 0x6E39
+0x6C89 = 0x6E3A
+0x6C94 = 0x6E3C
+0x6C95 = 0x6E3D
+0x6C97 = 0x6E3E
+0x6CAD = 0x6E3F
+0x6CC2 = 0x6E40
+0x6CD0 = 0x6E41
+0x6CD6 = 0x6E43
+0x6CDA = 0x6E44
+0x6CDC = 0x6E45
+0x6CE9 = 0x6E46
+0x6CEC = 0x6E47
+0x6CED = 0x6E48
+0x6D00 = 0x6E4A
+0x6D0A = 0x6E4B
+0x6D24 = 0x6E4C
+0x6D26 = 0x6E4D
+0x6D27 = 0x6E4E
+0x6D2F = 0x6E50
+0x6D34 = 0x6E65
+0x6D3C = 0x6E51
+0x6D5B = 0x6E52
+0x6D5E = 0x6E53
+0x6D60 = 0x6E54
+0x6D70 = 0x6E55
+0x6D80 = 0x6E56
+0x6D81 = 0x6E57
+0x6D8A = 0x6E58
+0x6D8D = 0x6E59
+0x6D91 = 0x6E5A
+0x6D98 = 0x6E5B
+0x6DAB = 0x6E61
+0x6DAE = 0x6E62
+0x6DB4 = 0x6E63
+0x6DC2 = 0x6E64
+0x6DC8 = 0x6E66
+0x6DCE = 0x6E67
+0x6DCF = 0x6E68
+0x6DD0 = 0x6E69
+0x6DDF = 0x6E6A
+0x6DE9 = 0x6E6B
+0x6DF6 = 0x6E6C
+0x6E17 = 0x6E5D
+0x6E1E = 0x6E6E
+0x6E22 = 0x6E6F
+0x6E27 = 0x6E70
+0x6E32 = 0x6E72
+0x6E36 = 0x6E6D
+0x6E3C = 0x6E73
+0x6E48 = 0x6E74
+0x6E49 = 0x6E75
+0x6E4B = 0x6E76
+0x6E4C = 0x6E77
+0x6E4F = 0x6E78
+0x6E51 = 0x6E79
+0x6E53 = 0x6E7A
+0x6E54 = 0x6E7B
+0x6E57 = 0x6E7C
+0x6E63 = 0x6E7D
+0x6E93 = 0x6F21
+0x6EA7 = 0x6F22
+0x6EB4 = 0x6F23
+0x6EBF = 0x6F24
+0x6EC3 = 0x6F25
+0x6ECA = 0x6F26
+0x6ED9 = 0x6F27
+0x6EEB = 0x6F29
+0x6EF9 = 0x6F2A
+0x6EFB = 0x6F2B
+0x6F0A = 0x6F2C
+0x6F0C = 0x6F2D
+0x6F18 = 0x6F2E
+0x6F25 = 0x6F2F
+0x6F35 = 0x6F28
+0x6F36 = 0x6F30
+0x6F3C = 0x6F31
+0x6F52 = 0x6F33
+0x6F57 = 0x6F34
+0x6F5A = 0x6F35
+0x6F60 = 0x6F36
+0x6F68 = 0x6F37
+0x6F7D = 0x6F39
+0x6F90 = 0x6F3A
+0x6F96 = 0x6F3B
+0x6F98 = 0x6F38
+0x6F9F = 0x6F3D
+0x6FA5 = 0x6F3E
+0x6FAF = 0x6F3F
+0x6FB5 = 0x6F41
+0x6FBE = 0x6F3C
+0x6FC8 = 0x6F42
+0x6FC9 = 0x6F43
+0x6FDA = 0x6F44
+0x6FDE = 0x6F45
+0x6FE9 = 0x6F46
+0x6FFC = 0x6F48
+0x7000 = 0x6F49
+0x7007 = 0x6F4A
+0x700A = 0x6F4B
+0x7023 = 0x6F4C
+0x7039 = 0x6F4E
+0x703A = 0x6F4F
+0x703C = 0x6F50
+0x7043 = 0x6F51
+0x7047 = 0x6F52
+0x704B = 0x6F53
+0x7054 = 0x6F55
+0x7065 = 0x6F56
+0x7069 = 0x6F57
+0x706C = 0x6F58
+0x706E = 0x6F59
+0x7076 = 0x6F5A
+0x707E = 0x6F5B
+0x7081 = 0x6F5C
+0x7086 = 0x6F5D
+0x7095 = 0x6F5E
+0x7097 = 0x6F5F
+0x709F = 0x6F62
+0x70B1 = 0x6F63
+0x70BB = 0x6F60
+0x70CA = 0x6F66
+0x70D1 = 0x6F67
+0x70D3 = 0x6F68
+0x70DC = 0x6F69
+0x70EC = 0x6F65
+0x7103 = 0x6F6A
+0x7104 = 0x6F6B
+0x7106 = 0x6F6C
+0x7107 = 0x6F6D
+0x7108 = 0x6F6E
+0x710C = 0x6F6F
+0x712F = 0x6F71
+0x7131 = 0x6F72
+0x714A = 0x6F74
+0x7150 = 0x6F73
+0x7153 = 0x6F75
+0x715E = 0x6F76
+0x7180 = 0x6F79
+0x7196 = 0x6F78
+0x719B = 0x6F7A
+0x71A0 = 0x6F7B
+0x71A2 = 0x6F7C
+0x71AE = 0x6F7D
+0x71AF = 0x6F7E
+0x71B3 = 0x7021
+0x71CB = 0x7023
+0x71D3 = 0x7024
+0x71D9 = 0x7025
+0x71DC = 0x7026
+0x7207 = 0x7027
+0x722B = 0x702A
+0x7234 = 0x702B
+0x7238 = 0x702C
+0x7239 = 0x702D
+0x7242 = 0x702F
+0x7253 = 0x7030
+0x7257 = 0x7031
+0x7263 = 0x7032
+0x726E = 0x7034
+0x726F = 0x7035
+0x7278 = 0x7036
+0x727F = 0x7037
+0x728E = 0x7038
+0x72AD = 0x703A
+0x72AE = 0x703B
+0x72B0 = 0x703C
+0x72B1 = 0x703D
+0x72C1 = 0x703E
+0x72CC = 0x7040
+0x72F3 = 0x7043
+0x72FA = 0x7044
+0x7307 = 0x7045
+0x7312 = 0x7046
+0x7318 = 0x7047
+0x7319 = 0x7048
+0x732C = 0x704B
+0x7331 = 0x704C
+0x7333 = 0x704D
+0x7339 = 0x704A
+0x733D = 0x704E
+0x7352 = 0x704F
+0x736B = 0x7051
+0x736C = 0x7052
+0x736E = 0x7054
+0x736F = 0x7055
+0x7371 = 0x7056
+0x7377 = 0x7057
+0x7381 = 0x7058
+0x7385 = 0x7059
+0x738A = 0x705A
+0x7394 = 0x705B
+0x7398 = 0x705C
+0x739C = 0x705D
+0x739E = 0x705E
+0x73A5 = 0x705F
+0x73A8 = 0x7060
+0x73B5 = 0x7061
+0x73B7 = 0x7062
+0x73B9 = 0x7063
+0x73BC = 0x7064
+0x73BF = 0x7065
+0x73C5 = 0x7066
+0x73CB = 0x7067
+0x73E1 = 0x7068
+0x73E7 = 0x7069
+0x73F9 = 0x706A
+0x73FA = 0x706C
+0x7401 = 0x706D
+0x7413 = 0x706B
+0x7424 = 0x706E
+0x7431 = 0x706F
+0x7439 = 0x7070
+0x7440 = 0x7072
+0x7443 = 0x7073
+0x744D = 0x7074
+0x7452 = 0x7075
+0x7453 = 0x7071
+0x745D = 0x7076
+0x7471 = 0x7077
+0x7481 = 0x7078
+0x7485 = 0x7079
+0x7488 = 0x707A
+0x7492 = 0x707C
+0x7497 = 0x707D
+0x7499 = 0x707E
+0x74A0 = 0x7121
+0x74A1 = 0x7122
+0x74A5 = 0x7123
+0x74AA = 0x7124
+0x74AB = 0x7125
+0x74B9 = 0x7126
+0x74BA = 0x7128
+0x74BB = 0x7127
+0x74D6 = 0x7129
+0x74D8 = 0x712A
+0x74DE = 0x712B
+0x74EB = 0x712D
+0x74EF = 0x712C
+0x74FA = 0x712F
+0x7520 = 0x7131
+0x7524 = 0x7132
+0x752A = 0x7133
+0x753D = 0x7136
+0x753E = 0x7137
+0x7540 = 0x7138
+0x7548 = 0x7139
+0x754E = 0x713A
+0x7550 = 0x713B
+0x7552 = 0x713C
+0x756C = 0x713D
+0x7571 = 0x713F
+0x7572 = 0x713E
+0x757A = 0x7140
+0x757D = 0x7141
+0x757E = 0x7142
+0x7581 = 0x7143
+0x758C = 0x7145
+0x75A2 = 0x7147
+0x75B0 = 0x7149
+0x75B7 = 0x714A
+0x75BF = 0x714B
+0x75C0 = 0x714C
+0x75C6 = 0x714D
+0x75CF = 0x714E
+0x75D3 = 0x714F
+0x75DD = 0x7150
+0x75DF = 0x7151
+0x75E0 = 0x7152
+0x75E7 = 0x7153
+0x75EC = 0x7154
+0x75EE = 0x7155
+0x75F1 = 0x7156
+0x75F9 = 0x7157
+0x7603 = 0x7158
+0x7607 = 0x715A
+0x760F = 0x715B
+0x7613 = 0x715E
+0x7618 = 0x7159
+0x761B = 0x715F
+0x761C = 0x7160
+0x7625 = 0x7162
+0x7628 = 0x7163
+0x7633 = 0x7165
+0x763C = 0x7164
+0x7641 = 0x7168
+0x7649 = 0x716A
+0x7655 = 0x716B
+0x766E = 0x716D
+0x7695 = 0x716E
+0x769C = 0x716F
+0x76A0 = 0x7171
+0x76A1 = 0x7170
+0x76A7 = 0x7172
+0x76A8 = 0x7173
+0x76AF = 0x7174
+0x76C9 = 0x7176
+0x76E8 = 0x7178
+0x76EC = 0x7179
+0x7717 = 0x717B
+0x771A = 0x717C
+0x772D = 0x717D
+0x7735 = 0x717E
+0x7758 = 0x7225
+0x7760 = 0x7226
+0x776A = 0x7227
+0x7772 = 0x7229
+0x777C = 0x722A
+0x777D = 0x722B
+0x779A = 0x722E
+0x779F = 0x722F
+0x77A2 = 0x7230
+0x77A4 = 0x7231
+0x77A9 = 0x7232
+0x77DE = 0x7233
+0x77DF = 0x7234
+0x77E4 = 0x7235
+0x77E6 = 0x7236
+0x77EA = 0x7237
+0x77EC = 0x7238
+0x77F0 = 0x723A
+0x77F4 = 0x723B
+0x77FB = 0x723C
+0x7805 = 0x723E
+0x7806 = 0x723F
+0x7809 = 0x7240
+0x780D = 0x7241
+0x7819 = 0x7242
+0x7821 = 0x7243
+0x782C = 0x7244
+0x7847 = 0x7245
+0x7864 = 0x7246
+0x786A = 0x7247
+0x788A = 0x7249
+0x7894 = 0x724A
+0x789D = 0x724C
+0x789E = 0x724D
+0x789F = 0x724E
+0x78A4 = 0x724B
+0x78BB = 0x724F
+0x78C8 = 0x7250
+0x78CC = 0x7251
+0x78CE = 0x7252
+0x78D5 = 0x7253
+0x78E0 = 0x7254
+0x78E1 = 0x7255
+0x78E6 = 0x7256
+0x78F9 = 0x7257
+0x78FA = 0x7258
+0x78FB = 0x7259
+0x78FE = 0x725A
+0x7910 = 0x725C
+0x791B = 0x725D
+0x7925 = 0x725F
+0x7930 = 0x725E
+0x793B = 0x7260
+0x794A = 0x7261
+0x7958 = 0x7262
+0x795B = 0x7263
+0x7967 = 0x7265
+0x7972 = 0x7266
+0x7994 = 0x7267
+0x7995 = 0x7268
+0x7996 = 0x7269
+0x799B = 0x726A
+0x79A1 = 0x726B
+0x79A9 = 0x726C
+0x79B4 = 0x726D
+0x79BB = 0x726E
+0x79C2 = 0x726F
+0x79C7 = 0x7270
+0x79CC = 0x7271
+0x79CD = 0x7272
+0x79D6 = 0x7273
+0x7A0A = 0x7278
+0x7A11 = 0x7279
+0x7A15 = 0x727A
+0x7A1B = 0x727B
+0x7A1E = 0x727C
+0x7A2D = 0x727E
+0x7A38 = 0x7321
+0x7A47 = 0x7322
+0x7A4C = 0x7323
+0x7A56 = 0x7324
+0x7A59 = 0x7325
+0x7A5C = 0x7326
+0x7A5F = 0x7327
+0x7A60 = 0x7328
+0x7A67 = 0x7329
+0x7A6A = 0x732A
+0x7A75 = 0x732B
+0x7A78 = 0x732C
+0x7A82 = 0x732D
+0x7A8A = 0x732E
+0x7A90 = 0x732F
+0x7AA3 = 0x7330
+0x7AAC = 0x7331
+0x7AB9 = 0x7334
+0x7ABC = 0x7335
+0x7ABE = 0x7336
+0x7ACC = 0x7338
+0x7AD1 = 0x7339
+0x7AE7 = 0x733A
+0x7AE8 = 0x733B
+0x7AF4 = 0x733C
+0x7B07 = 0x733F
+0x7B27 = 0x7342
+0x7B2A = 0x7343
+0x7B2E = 0x7344
+0x7B2F = 0x7345
+0x7B31 = 0x7346
+0x7B3D = 0x7341
+0x7B41 = 0x734A
+0x7B55 = 0x734C
+0x7B64 = 0x734E
+0x7B66 = 0x734F
+0x7B69 = 0x7350
+0x7B73 = 0x7351
+0x7B79 = 0x734D
+0x7B7F = 0x7349
+0x7B90 = 0x7354
+0x7B91 = 0x7355
+0x7B9B = 0x7356
+0x7BAF = 0x7358
+0x7BB5 = 0x7359
+0x7BBC = 0x735A
+0x7BC5 = 0x735B
+0x7BCA = 0x735C
+0x7BD4 = 0x735F
+0x7BD6 = 0x7360
+0x7BDA = 0x7361
+0x7BEA = 0x7362
+0x7BF0 = 0x7363
+0x7C03 = 0x7364
+0x7C0B = 0x7365
+0x7C0E = 0x7366
+0x7C0F = 0x7367
+0x7C26 = 0x7368
+0x7C45 = 0x7369
+0x7C4A = 0x736A
+0x7C51 = 0x736B
+0x7C57 = 0x736C
+0x7C5E = 0x736D
+0x7C61 = 0x736E
+0x7C69 = 0x736F
+0x7C6E = 0x7370
+0x7C6F = 0x7371
+0x7C70 = 0x7372
+0x7CA6 = 0x7376
+0x7CB6 = 0x7378
+0x7CB7 = 0x7379
+0x7CBF = 0x737A
+0x7CC4 = 0x737C
+0x7CC8 = 0x737E
+0x7CCD = 0x7421
+0x7CD7 = 0x7423
+0x7CE6 = 0x7425
+0x7CEB = 0x7426
+0x7CF5 = 0x7428
+0x7D03 = 0x7429
+0x7D09 = 0x742A
+0x7D12 = 0x742C
+0x7D1E = 0x742D
+0x7D3D = 0x7430
+0x7D3E = 0x7431
+0x7D40 = 0x7432
+0x7D47 = 0x7433
+0x7D59 = 0x7437
+0x7D5A = 0x7438
+0x7D6A = 0x7439
+0x7D70 = 0x743A
+0x7D7F = 0x743C
+0x7D86 = 0x743E
+0x7D88 = 0x743F
+0x7D8C = 0x7440
+0x7D97 = 0x7441
+0x7D9D = 0x7443
+0x7DA7 = 0x7444
+0x7DAA = 0x7445
+0x7DB6 = 0x7446
+0x7DB7 = 0x7447
+0x7DC0 = 0x7448
+0x7DD7 = 0x7449
+0x7DD9 = 0x744A
+0x7DE6 = 0x744B
+0x7DF1 = 0x744C
+0x7DF9 = 0x744D
+0x7E10 = 0x7451
+0x7E17 = 0x7452
+0x7E1D = 0x7453
+0x7E20 = 0x7454
+0x7E27 = 0x7455
+0x7E2C = 0x7456
+0x7E45 = 0x7457
+0x7E73 = 0x7458
+0x7E75 = 0x7459
+0x7E7E = 0x745A
+0x7E86 = 0x745B
+0x7E87 = 0x745C
+0x7E91 = 0x745E
+0x7E98 = 0x745F
+0x7E9A = 0x7460
+0x7F3B = 0x7463
+0x7F3C = 0x7462
+0x7F3E = 0x7464
+0x7F43 = 0x7465
+0x7F44 = 0x7466
+0x7F4F = 0x7467
+0x7F52 = 0x746A
+0x7F61 = 0x746C
+0x7F63 = 0x746D
+0x7F64 = 0x746E
+0x7F6D = 0x746F
+0x7F7D = 0x7470
+0x7F7E = 0x7471
+0x7F90 = 0x7473
+0x7F96 = 0x7476
+0x7F9C = 0x7477
+0x7FAD = 0x7478
+0x7FC3 = 0x747A
+0x7FCF = 0x747B
+0x7FE3 = 0x747C
+0x7FE5 = 0x747D
+0x7FEF = 0x747E
+0x7FF2 = 0x7521
+0x8002 = 0x7522
+0x8008 = 0x7524
+0x800A = 0x7523
+0x800E = 0x7525
+0x8011 = 0x7526
+0x8016 = 0x7527
+0x8024 = 0x7528
+0x802C = 0x7529
+0x8030 = 0x752A
+0x8043 = 0x752B
+0x8066 = 0x752C
+0x8071 = 0x752D
+0x8075 = 0x752E
+0x807B = 0x752F
+0x8099 = 0x7530
+0x809C = 0x7531
+0x80A4 = 0x7532
+0x80A7 = 0x7533
+0x80B8 = 0x7534
+0x80C5 = 0x7536
+0x80D5 = 0x7537
+0x80D8 = 0x7538
+0x80E6 = 0x7539
+0x80F5 = 0x753C
+0x80FB = 0x753D
+0x810D = 0x753B
+0x8116 = 0x7540
+0x811E = 0x7541
+0x8124 = 0x7543
+0x8127 = 0x7544
+0x812C = 0x7545
+0x8135 = 0x753F
+0x813D = 0x7547
+0x8169 = 0x7549
+0x8181 = 0x754B
+0x8184 = 0x754D
+0x8185 = 0x754E
+0x8198 = 0x7550
+0x81B2 = 0x7551
+0x81C1 = 0x7552
+0x81C3 = 0x7553
+0x81D6 = 0x7554
+0x81DB = 0x7555
+0x81E4 = 0x7557
+0x81EC = 0x7559
+0x81FD = 0x755B
+0x81FF = 0x755C
+0x8204 = 0x755E
+0x8219 = 0x7560
+0x8221 = 0x7561
+0x8222 = 0x7562
+0x8232 = 0x7564
+0x8234 = 0x7565
+0x823C = 0x7566
+0x8245 = 0x7569
+0x8246 = 0x7567
+0x8249 = 0x7568
+0x824B = 0x756B
+0x824F = 0x756D
+0x8257 = 0x756F
+0x825C = 0x7571
+0x8263 = 0x7572
+0x8279 = 0x7576
+0x827D = 0x7578
+0x827F = 0x7579
+0x8283 = 0x757A
+0x828A = 0x757B
+0x8293 = 0x757C
+0x82A7 = 0x757D
+0x82A8 = 0x757E
+0x82B2 = 0x7621
+0x82B4 = 0x7622
+0x82BA = 0x7623
+0x82BC = 0x7624
+0x82E2 = 0x7625
+0x82E8 = 0x7626
+0x82F7 = 0x7627
+0x8307 = 0x7628
+0x8308 = 0x7629
+0x830C = 0x762A
+0x831B = 0x762C
+0x831D = 0x762D
+0x8330 = 0x762E
+0x833C = 0x762F
+0x8344 = 0x7630
+0x8354 = 0x762B
+0x8357 = 0x7631
+0x8363 = 0x2E4A
+0x837F = 0x7633
+0x838D = 0x7636
+0x8394 = 0x7637
+0x8395 = 0x7638
+0x839B = 0x7639
+0x839D = 0x763A
+0x83C9 = 0x763B
+0x83D0 = 0x763C
+0x83D4 = 0x763D
+0x83DD = 0x763E
+0x83E5 = 0x763F
+0x83F9 = 0x7640
+0x840F = 0x7641
+0x8411 = 0x7642
+0x8415 = 0x7643
+0x8417 = 0x7645
+0x8439 = 0x7646
+0x844A = 0x7647
+0x844F = 0x7648
+0x8451 = 0x7649
+0x8452 = 0x764A
+0x8459 = 0x764B
+0x845A = 0x764C
+0x845C = 0x764D
+0x8465 = 0x764F
+0x8476 = 0x7650
+0x8478 = 0x7651
+0x847C = 0x7652
+0x8481 = 0x7653
+0x8497 = 0x7656
+0x84A6 = 0x7657
+0x84BE = 0x7658
+0x84CE = 0x765A
+0x84CF = 0x765B
+0x84D3 = 0x765C
+0x84DC = 0x7655
+0x84E7 = 0x765E
+0x84EA = 0x765F
+0x84EF = 0x7660
+0x84F0 = 0x7661
+0x84F1 = 0x7662
+0x84FA = 0x7663
+0x84FD = 0x7664
+0x850C = 0x7665
+0x851B = 0x7666
+0x8524 = 0x7667
+0x8525 = 0x7668
+0x852B = 0x7669
+0x8534 = 0x766A
+0x853E = 0x766F
+0x854F = 0x766B
+0x8551 = 0x7670
+0x8553 = 0x7671
+0x855E = 0x7672
+0x8561 = 0x7673
+0x8562 = 0x7674
+0x856F = 0x766C
+0x857B = 0x7676
+0x857D = 0x7677
+0x857F = 0x7678
+0x8581 = 0x7679
+0x8586 = 0x767A
+0x8593 = 0x767B
+0x859D = 0x767C
+0x859F = 0x767D
+0x85B7 = 0x7723
+0x85BC = 0x7724
+0x85C7 = 0x7725
+0x85CA = 0x7726
+0x85D8 = 0x7727
+0x85D9 = 0x7728
+0x85DF = 0x7729
+0x85E1 = 0x772A
+0x85E6 = 0x772B
+0x85F6 = 0x772C
+0x8600 = 0x772D
+0x8611 = 0x772E
+0x861E = 0x772F
+0x8621 = 0x7730
+0x8624 = 0x7731
+0x8627 = 0x7732
+0x8639 = 0x7734
+0x863C = 0x7735
+0x8640 = 0x7737
+0x8653 = 0x7739
+0x8656 = 0x773A
+0x866F = 0x773B
+0x8677 = 0x773C
+0x867A = 0x773D
+0x8687 = 0x773E
+0x8689 = 0x773F
+0x868D = 0x7740
+0x8691 = 0x7741
+0x869C = 0x7742
+0x869D = 0x7743
+0x86A8 = 0x7744
+0x86B1 = 0x7746
+0x86B3 = 0x7747
+0x86C1 = 0x7748
+0x86C3 = 0x7749
+0x86D1 = 0x774A
+0x86D5 = 0x774B
+0x86D7 = 0x774C
+0x86E3 = 0x774D
+0x86E6 = 0x774E
+0x8705 = 0x7750
+0x8707 = 0x7751
+0x870E = 0x7752
+0x8710 = 0x7753
+0x8713 = 0x7754
+0x8719 = 0x7755
+0x871F = 0x7756
+0x8721 = 0x7757
+0x8723 = 0x7758
+0x8731 = 0x7759
+0x873A = 0x775A
+0x873E = 0x775B
+0x8740 = 0x775C
+0x8743 = 0x775D
+0x8751 = 0x775E
+0x8758 = 0x775F
+0x8764 = 0x7760
+0x8765 = 0x7761
+0x8772 = 0x7762
+0x877C = 0x7763
+0x8789 = 0x7767
+0x878B = 0x7768
+0x8793 = 0x7769
+0x87A0 = 0x776A
+0x87A7 = 0x7766
+0x87BE = 0x776D
+0x87C1 = 0x776F
+0x87CE = 0x7770
+0x87DF = 0x7772
+0x87E3 = 0x7774
+0x87E5 = 0x7775
+0x87E6 = 0x7776
+0x87EA = 0x7777
+0x87EB = 0x7778
+0x87ED = 0x7779
+0x87F5 = 0x7771
+0x8801 = 0x777A
+0x8803 = 0x777B
+0x880B = 0x777C
+0x8813 = 0x777D
+0x8828 = 0x777E
+0x882E = 0x7821
+0x8832 = 0x7822
+0x883C = 0x7823
+0x884A = 0x7825
+0x8858 = 0x7826
+0x885F = 0x7827
+0x8864 = 0x7828
+0x8869 = 0x782B
+0x886F = 0x782D
+0x88A0 = 0x782E
+0x88BC = 0x782F
+0x88BD = 0x7830
+0x88BE = 0x7831
+0x88C0 = 0x7832
+0x88D1 = 0x7835
+0x88D2 = 0x7833
+0x88D3 = 0x7836
+0x88DB = 0x7837
+0x88F0 = 0x7838
+0x88F1 = 0x7839
+0x8901 = 0x783B
+0x8937 = 0x783D
+0x8942 = 0x783F
+0x8945 = 0x7840
+0x8949 = 0x7841
+0x8962 = 0x7844
+0x8980 = 0x7845
+0x8989 = 0x7846
+0x8990 = 0x7847
+0x899F = 0x7848
+0x89B0 = 0x7849
+0x89B7 = 0x784A
+0x89D6 = 0x784B
+0x89D8 = 0x784C
+0x89EB = 0x784D
+0x89F1 = 0x784F
+0x89F3 = 0x7850
+0x89FD = 0x7851
+0x89FF = 0x7852
+0x8A11 = 0x7854
+0x8A14 = 0x7855
+0x8A21 = 0x7857
+0x8A35 = 0x7858
+0x8A3E = 0x7859
+0x8A45 = 0x785A
+0x8A4D = 0x785B
+0x8A58 = 0x785C
+0x8A90 = 0x785E
+0x8AAE = 0x785D
+0x8AB7 = 0x785F
+0x8ABE = 0x7860
+0x8AD7 = 0x7861
+0x8AFC = 0x7862
+0x8B05 = 0x7865
+0x8B0A = 0x7864
+0x8B0D = 0x7866
+0x8B1C = 0x7867
+0x8B1F = 0x7868
+0x8B2D = 0x7869
+0x8B43 = 0x786A
+0x8B51 = 0x786C
+0x8B5E = 0x786D
+0x8B76 = 0x786E
+0x8B7F = 0x786F
+0x8B81 = 0x7870
+0x8B8B = 0x7871
+0x8B94 = 0x7872
+0x8B95 = 0x7873
+0x8B9C = 0x7874
+0x8B9E = 0x7875
+0x8C39 = 0x7876
+0x8C3D = 0x7878
+0x8C45 = 0x787B
+0x8C47 = 0x787C
+0x8C4F = 0x787D
+0x8C54 = 0x787E
+0x8C57 = 0x7921
+0x8C69 = 0x7922
+0x8C6D = 0x7923
+0x8C73 = 0x7924
+0x8C92 = 0x7927
+0x8C93 = 0x7926
+0x8C99 = 0x7928
+0x8C9B = 0x792A
+0x8CA4 = 0x792B
+0x8CD5 = 0x792D
+0x8CD6 = 0x792C
+0x8CD9 = 0x792E
+0x8CF0 = 0x7930
+0x8CF1 = 0x7931
+0x8D09 = 0x7933
+0x8D0E = 0x7934
+0x8D6C = 0x7935
+0x8D84 = 0x7936
+0x8D95 = 0x7937
+0x8DA6 = 0x7938
+0x8DC6 = 0x793A
+0x8DC8 = 0x793B
+0x8DD9 = 0x793C
+0x8DEC = 0x793D
+0x8DFD = 0x7940
+0x8E06 = 0x7941
+0x8E0C = 0x793E
+0x8E14 = 0x7943
+0x8E16 = 0x7944
+0x8E21 = 0x7945
+0x8E22 = 0x7946
+0x8E27 = 0x7947
+0x8E36 = 0x794A
+0x8E39 = 0x794B
+0x8E4B = 0x794C
+0x8E54 = 0x794D
+0x8E62 = 0x794E
+0x8E6C = 0x794F
+0x8E6D = 0x7950
+0x8E6F = 0x7951
+0x8E98 = 0x7952
+0x8E9E = 0x7953
+0x8EAE = 0x7954
+0x8EB3 = 0x7955
+0x8EB5 = 0x7956
+0x8EB6 = 0x7957
+0x8EBB = 0x7958
+0x8ED1 = 0x795A
+0x8ED4 = 0x795B
+0x8EF9 = 0x795D
+0x8F00 = 0x795F
+0x8F08 = 0x7960
+0x8F17 = 0x7961
+0x8F2B = 0x7962
+0x8F40 = 0x7963
+0x8F4A = 0x7964
+0x8F58 = 0x7965
+0x8FA4 = 0x7967
+0x8FB4 = 0x7968
+0x8FB6 = 0x796A
+0x8FC1 = 0x796C
+0x8FC6 = 0x796D
+0x8FCA = 0x796F
+0x8FCD = 0x7970
+0x8FD3 = 0x7971
+0x8FD5 = 0x7972
+0x8FE0 = 0x7973
+0x8FF1 = 0x7974
+0x8FF5 = 0x7975
+0x8FFB = 0x7976
+0x9002 = 0x7977
+0x900C = 0x7978
+0x9037 = 0x7979
+0x9043 = 0x797B
+0x9044 = 0x797C
+0x905D = 0x797D
+0x9085 = 0x7A22
+0x908C = 0x7A23
+0x9090 = 0x7A24
+0x90A1 = 0x7A26
+0x90B0 = 0x7A28
+0x90B6 = 0x7A29
+0x90C3 = 0x7A2A
+0x90C8 = 0x7A2B
+0x90DC = 0x7A2D
+0x90DF = 0x7A2E
+0x90EB = 0x7A33
+0x90F2 = 0x7A31
+0x90F6 = 0x7A30
+0x90FE = 0x7A34
+0x90FF = 0x7A35
+0x9100 = 0x7A32
+0x9104 = 0x7A36
+0x9106 = 0x7A37
+0x9118 = 0x7A38
+0x911C = 0x7A39
+0x911E = 0x7A3A
+0x9137 = 0x7A3B
+0x9139 = 0x7A3C
+0x913A = 0x7A3D
+0x9146 = 0x7A3E
+0x9147 = 0x7A3F
+0x9157 = 0x7A40
+0x9159 = 0x7A41
+0x9161 = 0x7A42
+0x9164 = 0x7A43
+0x9174 = 0x7A44
+0x9179 = 0x7A45
+0x9185 = 0x7A46
+0x918E = 0x7A47
+0x91A8 = 0x7A48
+0x91AE = 0x7A49
+0x91B3 = 0x7A4A
+0x91B6 = 0x7A4B
+0x91C3 = 0x7A4C
+0x91C4 = 0x7A4D
+0x91DA = 0x7A4E
+0x91EC = 0x7A51
+0x91EE = 0x7A52
+0x9201 = 0x7A53
+0x920A = 0x7A54
+0x9216 = 0x7A55
+0x9217 = 0x7A56
+0x9233 = 0x7A58
+0x9242 = 0x7A59
+0x9247 = 0x7A5A
+0x924A = 0x7A5B
+0x924E = 0x7A5C
+0x9251 = 0x7A5D
+0x9256 = 0x7A5E
+0x9259 = 0x7A5F
+0x9260 = 0x7A60
+0x9261 = 0x7A61
+0x9265 = 0x7A62
+0x9267 = 0x7A63
+0x9268 = 0x7A64
+0x927C = 0x7A67
+0x927D = 0x7A68
+0x927F = 0x7A69
+0x9289 = 0x7A6A
+0x928D = 0x7A6B
+0x9297 = 0x7A6C
+0x9299 = 0x7A6D
+0x929F = 0x7A6E
+0x92A7 = 0x7A6F
+0x92AB = 0x7A70
+0x92B2 = 0x7A73
+0x92BF = 0x7A74
+0x92C0 = 0x7A75
+0x92C6 = 0x7A76
+0x92CE = 0x7A77
+0x92D0 = 0x7A78
+0x92D7 = 0x7A79
+0x92D9 = 0x7A7A
+0x92E5 = 0x7A7B
+0x92E7 = 0x7A7C
+0x92F7 = 0x7B22
+0x92F9 = 0x7B23
+0x92FB = 0x7B24
+0x9302 = 0x7B25
+0x930D = 0x7B26
+0x9311 = 0x7A7D
+0x9315 = 0x7B27
+0x931D = 0x7B28
+0x931E = 0x7B29
+0x9327 = 0x7B2A
+0x9329 = 0x7B2B
+0x9347 = 0x7B2E
+0x9351 = 0x7B2F
+0x9357 = 0x7B30
+0x935A = 0x7B31
+0x936B = 0x7B32
+0x9371 = 0x7B33
+0x9373 = 0x7B34
+0x9388 = 0x7B38
+0x938B = 0x7B39
+0x938F = 0x7B3A
+0x939E = 0x7B3B
+0x93A1 = 0x7B35
+0x93C1 = 0x7B40
+0x93C7 = 0x7B41
+0x93DC = 0x7B42
+0x93E2 = 0x7B43
+0x93E7 = 0x7B44
+0x93F1 = 0x7B3F
+0x93F5 = 0x7B3C
+0x93FB = 0x7B49
+0x9409 = 0x7B45
+0x940F = 0x7B46
+0x9416 = 0x7B47
+0x9417 = 0x7B48
+0x9432 = 0x7B4A
+0x9434 = 0x7B4B
+0x943B = 0x7B4C
+0x9445 = 0x7B4D
+0x946D = 0x7B50
+0x946F = 0x7B51
+0x9578 = 0x7B52
+0x9579 = 0x7B53
+0x9586 = 0x7B54
+0x958C = 0x7B55
+0x958D = 0x7B56
+0x95AB = 0x7B58
+0x95B4 = 0x7B59
+0x95C8 = 0x7B5B
+0x961D = 0x7A25
+0x962C = 0x7B5E
+0x9633 = 0x7B5F
+0x9634 = 0x7B60
+0x963C = 0x7B62
+0x9641 = 0x7B63
+0x9661 = 0x7B64
+0x9682 = 0x7B66
+0x969A = 0x7B68
+0x96A9 = 0x7B6B
+0x96AF = 0x7B6C
+0x96B3 = 0x7B6D
+0x96BA = 0x7B6E
+0x96BD = 0x7B6F
+0x96D8 = 0x7B72
+0x96DA = 0x7B73
+0x96DD = 0x7B74
+0x9714 = 0x7B76
+0x9723 = 0x7B77
+0x9736 = 0x7B79
+0x9741 = 0x7B7A
+0x9747 = 0x7B7B
+0x9755 = 0x7B7C
+0x9757 = 0x7B7D
+0x975B = 0x7B7E
+0x976A = 0x7C21
+0x9796 = 0x7C24
+0x979A = 0x7C25
+0x979E = 0x7C26
+0x97A2 = 0x7C27
+0x97B1 = 0x7C28
+0x97B2 = 0x7C29
+0x97BE = 0x7C2A
+0x97CC = 0x7C2B
+0x97D1 = 0x7C2C
+0x97D4 = 0x7C2D
+0x97D8 = 0x7C2E
+0x97D9 = 0x7C2F
+0x97E1 = 0x7C30
+0x97F1 = 0x7C31
+0x9804 = 0x7C32
+0x980D = 0x7C33
+0x980E = 0x7C34
+0x9814 = 0x7C35
+0x9816 = 0x7C36
+0x9823 = 0x7C39
+0x9825 = 0x7C3C
+0x9832 = 0x7C3A
+0x9833 = 0x7C3B
+0x9847 = 0x7C3D
+0x9866 = 0x7C3E
+0x98AB = 0x7C3F
+0x98AD = 0x7C40
+0x98B0 = 0x7C41
+0x98B7 = 0x7C43
+0x98B8 = 0x7C44
+0x98BB = 0x7C45
+0x98BC = 0x7C46
+0x98BF = 0x7C47
+0x98C2 = 0x7C48
+0x98C7 = 0x7C49
+0x98CB = 0x7C4A
+0x98E0 = 0x7C4B
+0x98E1 = 0x7C4D
+0x98E3 = 0x7C4E
+0x98E5 = 0x7C4F
+0x98EA = 0x7C50
+0x98F0 = 0x7C51
+0x98F1 = 0x7C52
+0x98F3 = 0x7C53
+0x9908 = 0x7C54
+0x9916 = 0x7C57
+0x9917 = 0x7C58
+0x991A = 0x7C5A
+0x991B = 0x7C5B
+0x991C = 0x7C5C
+0x9931 = 0x7C5E
+0x9932 = 0x7C5F
+0x9933 = 0x7C60
+0x993A = 0x7C61
+0x993B = 0x7C62
+0x993C = 0x7C63
+0x9940 = 0x7C64
+0x9941 = 0x7C65
+0x9946 = 0x7C66
+0x994D = 0x7C67
+0x994E = 0x7C68
+0x995C = 0x7C69
+0x995F = 0x7C6A
+0x9960 = 0x7C6B
+0x99A3 = 0x7C6C
+0x99A6 = 0x7C6D
+0x99B9 = 0x7C6E
+0x99BD = 0x7C6F
+0x99BF = 0x7C70
+0x99C3 = 0x7C71
+0x99C9 = 0x7C72
+0x99D4 = 0x7C73
+0x99D9 = 0x7C74
+0x99DE = 0x7C75
+0x99F0 = 0x7C77
+0x99F9 = 0x7C78
+0x99FC = 0x7C79
+0x9A0A = 0x7C7A
+0x9A11 = 0x7C7B
+0x9A16 = 0x7C7C
+0x9A1A = 0x7C7D
+0x9A20 = 0x7C7E
+0x9A31 = 0x7D21
+0x9A36 = 0x7D22
+0x9A44 = 0x7D23
+0x9A4C = 0x7D24
+0x9A58 = 0x7D25
+0x9AAF = 0x7D27
+0x9AB7 = 0x7D29
+0x9AB9 = 0x7D2B
+0x9AC6 = 0x7D2D
+0x9AD0 = 0x7D2E
+0x9AD2 = 0x7D2F
+0x9AD5 = 0x7D30
+0x9ADC = 0x7D32
+0x9AE0 = 0x7D33
+0x9AE5 = 0x7D34
+0x9AE9 = 0x7D35
+0x9B03 = 0x7D36
+0x9B0C = 0x7D37
+0x9B10 = 0x7D38
+0x9B12 = 0x7D39
+0x9B16 = 0x7D3A
+0x9B1C = 0x7D3B # 0x9B1D
+0x9B2B = 0x7D3C
+0x9B33 = 0x7D3D
+0x9B3D = 0x7D3E
+0x9B4B = 0x7D40
+0x9B63 = 0x7D41
+0x9B65 = 0x7D42
+0x9B6B = 0x7D43
+0x9B6C = 0x7D44
+0x9B73 = 0x7D45
+0x9B76 = 0x7D46
+0x9B77 = 0x7D47
+0x9BA6 = 0x7D48
+0x9BAC = 0x7D49
+0x9BB1 = 0x7D4A
+0x9BB2 = 0x7D4D
+0x9BB8 = 0x7D4E
+0x9BBE = 0x7D4F
+0x9BC7 = 0x7D50
+0x9BD8 = 0x7D52
+0x9BDD = 0x7D53
+0x9BE7 = 0x7D54
+0x9BEA = 0x7D55
+0x9BEB = 0x7D56
+0x9BEE = 0x7D58
+0x9BEF = 0x7D57
+0x9BF3 = 0x7D51
+0x9BF7 = 0x7D5C
+0x9BFA = 0x7D5A
+0x9C16 = 0x7D5E
+0x9C18 = 0x7D5F
+0x9C19 = 0x7D60
+0x9C1A = 0x7D61
+0x9C1D = 0x7D62
+0x9C22 = 0x7D63
+0x9C27 = 0x7D64
+0x9C29 = 0x7D65
+0x9C2A = 0x7D66
+0x9C31 = 0x7D68
+0x9C36 = 0x7D69
+0x9C37 = 0x7D6A
+0x9C45 = 0x7D6B
+0x9C49 = 0x7D6E
+0x9C4A = 0x7D6F
+0x9C54 = 0x7D71
+0x9C58 = 0x7D72
+0x9C5B = 0x7D73
+0x9C5C = 0x7D6C
+0x9C5D = 0x7D74
+0x9C5F = 0x7D75
+0x9C69 = 0x7D76
+0x9C6A = 0x7D77
+0x9C6B = 0x7D78
+0x9C6D = 0x7D79
+0x9C6E = 0x7D7A
+0x9C70 = 0x7D7B
+0x9C72 = 0x7D7C
+0x9C75 = 0x7D7D
+0x9C7A = 0x7D7E
+0x9CE6 = 0x7E21
+0x9CF2 = 0x7E22
+0x9D02 = 0x7E24
+0x9D0B = 0x7E23
+0x9D11 = 0x7E26
+0x9D17 = 0x7E27
+0x9D18 = 0x7E28
+0x9D32 = 0x7E2C
+0x9D42 = 0x7E2E
+0x9D4A = 0x7E2F
+0x9D5F = 0x7E30
+0x9D62 = 0x7E31
+0x9D69 = 0x7E33
+0x9D6B = 0x7E34
+0x9D73 = 0x7E36
+0x9D76 = 0x7E37
+0x9D77 = 0x7E38
+0x9D7E = 0x7E39
+0x9D84 = 0x7E3A
+0x9D8D = 0x7E3B
+0x9D99 = 0x7E3C
+0x9DA1 = 0x7E3D
+0x9DB5 = 0x7E3F
+0x9DB9 = 0x7E40
+0x9DBD = 0x7E41
+0x9DBF = 0x7E3E
+0x9DC3 = 0x7E42
+0x9DC7 = 0x7E43
+0x9DC9 = 0x7E44
+0x9DD6 = 0x7E45
+0x9DDA = 0x7E46
+0x9DDF = 0x7E47
+0x9DE0 = 0x7E48
+0x9DE3 = 0x7E49
+0x9DF4 = 0x7E4A
+0x9E02 = 0x7E4D
+0x9E0A = 0x7E4C
+0x9E0D = 0x7E4E
+0x9E19 = 0x7E4F
+0x9E1C = 0x7E50
+0x9E1D = 0x7E51
+0x9E7B = 0x7E52
+0x9E80 = 0x7E54
+0x9E85 = 0x7E55
+0x9E9B = 0x7E56
+0x9EA8 = 0x7E57
+0x9EBD = 0x7E59
+0x9EDF = 0x7E5B
+0x9EE7 = 0x7E5C
+0x9EEE = 0x7E5D
+0x9EFF = 0x7E5E
+0x9F02 = 0x7E5F
+0x9F03 = 0x7E61
+0x9F17 = 0x7E62
+0x9F19 = 0x7E63
+0x9F2F = 0x7E64
+0x9F37 = 0x7E65
+0x9F3A = 0x7E66
+0x9F3D = 0x7E67
+0x9F41 = 0x7E68
+0x9F45 = 0x7E69
+0x9F46 = 0x7E6A
+0x9F53 = 0x7E6B
+0x9F55 = 0x7E6C
+0x9F58 = 0x7E6D
+0x9F5D = 0x7E6F
+0x9F69 = 0x7E71
+0x9F6D = 0x7E73
+0x9F70 = 0x7E74
+0x9F75 = 0x7E75
+0xFA13 = 0x2E79
+0xFA20 = 0x7738
+0xFA21 = 0x7745
+0xFA24 = 0x796E
+0xFA49 = 0x7029
+0xFA58 = 0x7450
+0xFA5D = 0x7574
+0xFA5E = 0x7575
+0xFA66 = 0x7969
+END_MAP
diff --git a/enc/trans/JIS/UCS@SIP%JISX0213-1.src b/enc/trans/JIS/UCS@SIP%JISX0213-1.src
new file mode 100644
index 0000000000..f4469c60d7
--- /dev/null
+++ b/enc/trans/JIS/UCS@SIP%JISX0213-1.src
@@ -0,0 +1,56 @@
+# $NetBSD: UCS@SIP%JISX0213-1.src,v 1.1 2007/03/05 16:58:34 tnozaki Exp $
+
+TYPE ROWCOL
+NAME "UCS:SIP/JISX0213-1"
+SRC_ZONE 0x000B - 0xA190
+OOB_MODE INVALID
+DST_INVALID 0xFFFF
+DST_UNIT_BITS 16
+
+BEGIN_MAP
+## Shift_JIS-2004 (JIS X 0213:2004) vs Unicode mapping table
+##
+## Date: 12 Feb 2005 10:15:00 GMT
+## License:
+## Copyright (C) 2001 earthian@tama.or.jp, All Rights Reserved.
+## Copyright (C) 2001 I'O, All Rights Reserved.
+## You can use, modify, distribute this table freely.
+## Note:
+## [1983] JIS codepoint defined by JIS X 0208-1983
+## [1990] JIS codepoint defined by JIS X 0208-1990
+## [2000] JIS codepoint defined by JIS X 0213:2000
+## [2004] JIS codepoint defined by JIS X 0213:2004
+## [Unicode3.1] UCS codepoint defined by Unicode 3.1
+## [Unicode3.2] UCS codepoint defined by Unicode 3.2
+## Fullwidth UCS fullwidth form (U+Fxxx)
+## Windows Windows (CP932) mapping
+## Some 0213 character can't represent by one UCS character.
+## In this table, such characters are described as 'U+xxxx+xxxx'.
+##
+0x000B = 0x2E22
+0x0B9F = 0x4F54
+0x123D = 0x2F42
+0x131B = 0x2F4C
+0x146E = 0x2F60
+0x16B4 = 0x4F63
+0x18BD = 0x2F7B
+0x1E34 = 0x4F6E
+0x31C4 = 0x753A
+0x35C4 = 0x7572
+0x373F = 0x7629
+0x3763 = 0x7632
+0x3CFE = 0x7660
+0x47F1 = 0x776C
+0x548E = 0x787E
+0x550E = 0x7929
+0x5771 = 0x7947
+0x59C4 = 0x7954
+0x5DA1 = 0x796E
+0x6AFF = 0x7A5D
+0x6E40 = 0x7B33
+0x70F4 = 0x7B49
+0x7684 = 0x7B6C
+0x8277 = 0x7C49
+0x83CD = 0x7C51
+0xA190 = 0x7E66
+END_MAP
diff --git a/enc/trans/JIS/UCS@SIP%JISX0213-2.src b/enc/trans/JIS/UCS@SIP%JISX0213-2.src
new file mode 100644
index 0000000000..7a33430ee9
--- /dev/null
+++ b/enc/trans/JIS/UCS@SIP%JISX0213-2.src
@@ -0,0 +1,307 @@
+# $NetBSD: UCS@SIP%JISX0213-2.src,v 1.1 2007/03/05 16:58:34 tnozaki Exp $
+
+TYPE ROWCOL
+NAME "UCS:SIP/JISX0213-2"
+SRC_ZONE 0x0089 - 0xA6B2
+OOB_MODE INVALID
+DST_INVALID 0xFFFF
+DST_UNIT_BITS 16
+
+BEGIN_MAP
+## Shift_JIS-2004 (JIS X 0213:2004) vs Unicode mapping table
+##
+## Date: 12 Feb 2005 10:15:00 GMT
+## License:
+## Copyright (C) 2001 earthian@tama.or.jp, All Rights Reserved.
+## Copyright (C) 2001 I'O, All Rights Reserved.
+## You can use, modify, distribute this table freely.
+## Note:
+## [1983] JIS codepoint defined by JIS X 0208-1983
+## [1990] JIS codepoint defined by JIS X 0208-1990
+## [2000] JIS codepoint defined by JIS X 0213:2000
+## [2004] JIS codepoint defined by JIS X 0213:2004
+## [Unicode3.1] UCS codepoint defined by Unicode 3.1
+## [Unicode3.2] UCS codepoint defined by Unicode 3.2
+## Fullwidth UCS fullwidth form (U+Fxxx)
+## Windows Windows (CP932) mapping
+## Some 0213 character can't represent by one UCS character.
+## In this table, such characters are described as 'U+xxxx+xxxx'.
+##
+0x0089 = 0x2121
+0x00A2 = 0x212B
+0x00A4 = 0x212E
+0x01A2 = 0x2136
+0x0213 = 0x2146
+0x032B = 0x2170
+0x0371 = 0x2179
+0x0381 = 0x2177
+0x03F9 = 0x2322
+0x044A = 0x2325
+0x0509 = 0x2327
+0x05D6 = 0x2331
+0x0628 = 0x2332
+0x074F = 0x2338
+0x0807 = 0x233F
+0x083A = 0x2341
+0x08B9 = 0x234A
+0x097C = 0x2352
+0x099D = 0x2353
+0x0AD3 = 0x2359
+0x0B1D = 0x235C
+0x0D45 = 0x2377
+0x0DE1 = 0x242A
+0x0E64 = 0x243A
+0x0E6D = 0x2432
+0x0E95 = 0x2431
+0x0F5F = 0x243D
+0x1201 = 0x2459
+0x1255 = 0x245C
+0x1274 = 0x2463
+0x127B = 0x245E
+0x12D7 = 0x246B
+0x12E4 = 0x246A
+0x12FD = 0x2472
+0x1336 = 0x2474
+0x1344 = 0x2475
+0x13C4 = 0x2525
+0x146D = 0x2532
+0x15D7 = 0x253E
+0x1647 = 0x2547
+0x1706 = 0x2555
+0x1742 = 0x2556
+0x19C3 = 0x257E
+0x1C56 = 0x2830
+0x1D2D = 0x2837
+0x1D45 = 0x2838
+0x1D62 = 0x283B
+0x1D78 = 0x283A
+0x1D92 = 0x2845
+0x1D9C = 0x2840
+0x1DA1 = 0x283F
+0x1DB7 = 0x2848
+0x1DE0 = 0x284A
+0x1E33 = 0x284B
+0x1F1E = 0x285B
+0x1F76 = 0x2866
+0x1FFA = 0x286C
+0x217B = 0x2C22
+0x2218 = 0x7E53
+0x231E = 0x2C2B
+0x23AD = 0x2C30
+0x26F3 = 0x2C50
+0x285B = 0x2C65
+0x28AB = 0x2C6D
+0x298F = 0x2C72
+0x2AB8 = 0x2D24
+0x2B46 = 0x2D32
+0x2B4F = 0x2D29
+0x2B50 = 0x2D2A
+0x2BA6 = 0x2D35
+0x2C1D = 0x2D34
+0x2C24 = 0x2D39
+0x2DE1 = 0x2D56
+0x31B6 = 0x2E24
+0x31C3 = 0x2D7D
+0x31F5 = 0x2E23
+0x3372 = 0x2E3A
+0x33D0 = 0x2E42
+0x33D2 = 0x2E3D
+0x33D3 = 0x2E3C
+0x33D5 = 0x2E44
+0x33DA = 0x2E47
+0x33DF = 0x2E49
+0x33E4 = 0x2E43
+0x344A = 0x2E55
+0x344B = 0x2E57
+0x3451 = 0x2E56
+0x3465 = 0x2E5B
+0x34E4 = 0x2E77
+0x355A = 0x2E78
+0x3594 = 0x2F2A
+0x3638 = 0x2F42
+0x3639 = 0x2F3F
+0x363A = 0x2F43
+0x3647 = 0x2F40
+0x370C = 0x2F59
+0x371C = 0x2F4E
+0x3764 = 0x2F61
+0x37E7 = 0x2F6A
+0x37FF = 0x2F69
+0x3824 = 0x2F70
+0x383D = 0x2F75
+0x3A98 = 0x6E23
+0x3C7F = 0x6E34
+0x3D00 = 0x6E49
+0x3D0E = 0x7475
+0x3D40 = 0x6E5C
+0x3DD3 = 0x6E60
+0x3DF9 = 0x6E5F
+0x3DFA = 0x6E5E
+0x3F7E = 0x6F32
+0x4096 = 0x6F47
+0x4103 = 0x6F4D
+0x41C6 = 0x6F61
+0x41FE = 0x6F64
+0x43BC = 0x7022
+0x4629 = 0x7033
+0x46A5 = 0x7039
+0x4896 = 0x7053
+0x4A4D = 0x707B
+0x4B56 = 0x712E
+0x4B6F = 0x7130
+0x4C16 = 0x7135
+0x4D14 = 0x7144
+0x4E0E = 0x715D
+0x4E37 = 0x7161
+0x4E6A = 0x7166
+0x4E8B = 0x7169
+0x504A = 0x7175
+0x5055 = 0x7177
+0x5122 = 0x717A
+0x51A9 = 0x7221
+0x51CD = 0x7224
+0x51E5 = 0x7223
+0x521E = 0x7228
+0x524C = 0x722C
+0x542E = 0x723D
+0x54D9 = 0x7248
+0x55A7 = 0x725B
+0x57A9 = 0x7275
+0x57B4 = 0x7276
+0x59D4 = 0x7332
+0x5AE3 = 0x733E
+0x5AE4 = 0x733D
+0x5AF1 = 0x7340
+0x5BB2 = 0x7352
+0x5C4B = 0x735D
+0x5C64 = 0x735E
+0x5E2E = 0x7373
+0x5E56 = 0x7374
+0x5E62 = 0x7377
+0x5E65 = 0x7375
+0x5EC2 = 0x737D
+0x5ED8 = 0x737B
+0x5EE8 = 0x7422
+0x5F23 = 0x7424
+0x5F5C = 0x7427
+0x5FD4 = 0x742F
+0x5FE0 = 0x742E
+0x5FFB = 0x7435
+0x600C = 0x7434
+0x6017 = 0x743D
+0x6060 = 0x7442
+0x60ED = 0x744F
+0x6270 = 0x7469
+0x6286 = 0x746B
+0x634C = 0x7472
+0x6402 = 0x7479
+0x667E = 0x7535
+0x66B0 = 0x753A
+0x671D = 0x7546
+0x68DD = 0x7556
+0x68EA = 0x7558
+0x6951 = 0x755A
+0x696F = 0x755D
+0x69DD = 0x755F
+0x6A1E = 0x7563
+0x6A58 = 0x756A
+0x6A8C = 0x7570
+0x6AB7 = 0x7573
+0x6C29 = 0x2544
+0x6C73 = 0x7644
+0x6CDD = 0x764E
+0x6E65 = 0x765D
+0x6F94 = 0x7675
+0x6FF6 = 0x7721
+0x6FF7 = 0x7722
+0x6FF8 = 0x767E
+0x710D = 0x7733
+0x7139 = 0x7736
+0x73DA = 0x7765
+0x73DB = 0x7764
+0x73FE = 0x776B
+0x7410 = 0x776E
+0x7449 = 0x7773
+0x7614 = 0x782A
+0x7615 = 0x7829
+0x7631 = 0x782C
+0x7693 = 0x7834
+0x770E = 0x783C
+0x7723 = 0x783E
+0x7752 = 0x7842
+0x7985 = 0x7856
+0x7A84 = 0x7863
+0x7BB3 = 0x7877
+0x7BBE = 0x7879
+0x7BC7 = 0x787A
+0x7CB8 = 0x7925
+0x7DA0 = 0x792F
+0x7E10 = 0x7932
+0x7FB7 = 0x7939
+0x808A = 0x7942
+0x80BB = 0x7948
+0x8282 = 0x7959
+0x82F3 = 0x795E
+0x840C = 0x7966
+0x8455 = 0x796B
+0x856B = 0x797A
+0x85C8 = 0x797E
+0x85C9 = 0x7A21
+0x86D7 = 0x7A2C
+0x86FA = 0x7A2F
+0x8946 = 0x7A50
+0x8949 = 0x7A4F
+0x896B = 0x7A57
+0x8987 = 0x7A65
+0x8988 = 0x7A66
+0x89BA = 0x7A71
+0x89BB = 0x7A72
+0x8A1E = 0x7A7E
+0x8A29 = 0x7B21
+0x8A43 = 0x7B2D
+0x8A71 = 0x7B2C
+0x8A99 = 0x7B36
+0x8ACD = 0x7B37
+0x8ADD = 0x7B3E
+0x8AE4 = 0x7B3D
+0x8BC1 = 0x7B4E
+0x8BEF = 0x7B4F
+0x8D10 = 0x7B57
+0x8D71 = 0x7B5A
+0x8DFB = 0x7B5C
+0x8E1F = 0x7B5D
+0x8E36 = 0x7B61
+0x8E89 = 0x7B65
+0x8EEB = 0x7B67
+0x8F32 = 0x7B69
+0x8FF8 = 0x7B71
+0x92A0 = 0x7C22
+0x92B1 = 0x7C23
+0x9490 = 0x7C38
+0x95CF = 0x7C42
+0x967F = 0x7C4C
+0x96F0 = 0x7C56
+0x9719 = 0x7C59
+0x9750 = 0x7C5D
+0x98C6 = 0x7C76
+0x9A72 = 0x7D2C
+0x9DDB = 0x7D4B
+0x9E15 = 0x7D59
+0x9E3D = 0x7D4C
+0x9E49 = 0x7D5D
+0x9E8A = 0x7D5B
+0x9EC4 = 0x7D67
+0x9EDB = 0x7D70
+0x9EE9 = 0x7D6D
+0x9FCE = 0x7E25
+0xA01A = 0x7E2B
+0xA02F = 0x7E29
+0xA082 = 0x7E35
+0xA0F9 = 0x7E32
+0xA38C = 0x7E58
+0xA437 = 0x7E5A
+0xA5F1 = 0x7E6E
+0xA602 = 0x7E70
+0xA61A = 0x7E72
+0xA6B2 = 0x7E76
+END_MAP
diff --git a/enc/trans/big5.trans b/enc/trans/big5.trans
index 9dacfd1f7e..c85ada3731 100644
--- a/enc/trans/big5.trans
+++ b/enc/trans/big5.trans
@@ -26,8 +26,7 @@
<%= transcode_generated_code %>
-void
-Init_big5(void)
+TRANS_INIT(big5)
{
<%= transcode_register_code %>
}
diff --git a/enc/trans/chinese.trans b/enc/trans/chinese.trans
index 0662a3bebc..282c91aba7 100644
--- a/enc/trans/chinese.trans
+++ b/enc/trans/chinese.trans
@@ -25,8 +25,7 @@
<%= transcode_generated_code %>
-void
-Init_chinese(void)
+TRANS_INIT(chinese)
{
<%= transcode_register_code %>
}
diff --git a/enc/trans/emoji.trans b/enc/trans/emoji.trans
index 1cf13743a2..25d9fdd4d8 100644
--- a/enc/trans/emoji.trans
+++ b/enc/trans/emoji.trans
@@ -30,8 +30,7 @@
<%= transcode_generated_code %>
-void
-Init_emoji(void)
+TRANS_INIT(emoji)
{
<%= transcode_register_code %>
}
diff --git a/enc/trans/emoji_iso2022_kddi.trans b/enc/trans/emoji_iso2022_kddi.trans
index ccf3139d3c..ea180c1e42 100644
--- a/enc/trans/emoji_iso2022_kddi.trans
+++ b/enc/trans/emoji_iso2022_kddi.trans
@@ -208,8 +208,7 @@ rb_iso2022jp_kddi_encoder = {
iso2022jp_kddi_encoder_reset_sequence_size, finish_iso2022jp_kddi_encoder
};
-void
-Init_emoji_iso2022_kddi(void)
+TRANS_INIT(emoji_iso2022_kddi)
{
rb_register_transcoder(&rb_iso2022jp_kddi_decoder);
rb_register_transcoder(&rb_iso2022jp_kddi_encoder);
diff --git a/enc/trans/emoji_sjis_docomo.trans b/enc/trans/emoji_sjis_docomo.trans
index 36e6e20339..5dd9c7a1e3 100644
--- a/enc/trans/emoji_sjis_docomo.trans
+++ b/enc/trans/emoji_sjis_docomo.trans
@@ -26,8 +26,7 @@
<%= transcode_generated_code %>
-void
-Init_emoji_sjis_docomo(void)
+TRANS_INIT(emoji_sjis_docomo)
{
<%= transcode_register_code %>
}
diff --git a/enc/trans/emoji_sjis_kddi.trans b/enc/trans/emoji_sjis_kddi.trans
index 654bed134e..6df62f14d1 100644
--- a/enc/trans/emoji_sjis_kddi.trans
+++ b/enc/trans/emoji_sjis_kddi.trans
@@ -27,8 +27,7 @@
<%= transcode_generated_code %>
-void
-Init_emoji_sjis_kddi(void)
+TRANS_INIT(emoji_sjis_kddi)
{
<%= transcode_register_code %>
}
diff --git a/enc/trans/emoji_sjis_softbank.trans b/enc/trans/emoji_sjis_softbank.trans
index c152d99c76..c520035347 100644
--- a/enc/trans/emoji_sjis_softbank.trans
+++ b/enc/trans/emoji_sjis_softbank.trans
@@ -26,8 +26,7 @@
<%= transcode_generated_code %>
-void
-Init_emoji_sjis_softbank(void)
+TRANS_INIT(emoji_sjis_softbank)
{
<%= transcode_register_code %>
}
diff --git a/enc/trans/escape.trans b/enc/trans/escape.trans
index a2fbebac33..550e4ac767 100644
--- a/enc/trans/escape.trans
+++ b/enc/trans/escape.trans
@@ -85,8 +85,7 @@ rb_escape_xml_attr_quote = {
escape_xml_attr_quote_finish
};
-void
-Init_escape(void)
+TRANS_INIT(escape)
{
<%= transcode_register_code %>
rb_register_transcoder(&rb_escape_xml_attr_quote);
diff --git a/enc/trans/gb18030.trans b/enc/trans/gb18030.trans
index c7da4c64b4..94c866eb39 100644
--- a/enc/trans/gb18030.trans
+++ b/enc/trans/gb18030.trans
@@ -176,8 +176,7 @@ rb_to_GB18030 = {
};
-void
-Init_gb18030(void)
+TRANS_INIT(gb18030)
{
rb_register_transcoder(&rb_from_GB18030);
rb_register_transcoder(&rb_to_GB18030);
diff --git a/enc/trans/gbk.trans b/enc/trans/gbk.trans
index 0df148198e..3c2cf0c1af 100644
--- a/enc/trans/gbk.trans
+++ b/enc/trans/gbk.trans
@@ -9,8 +9,7 @@
<%= transcode_generated_code %>
-void
-Init_gbk(void)
+TRANS_INIT(gbk)
{
<%= transcode_register_code %>
}
diff --git a/enc/trans/iso-8859-16-tbl.rb b/enc/trans/iso-8859-16-tbl.rb
new file mode 100644
index 0000000000..27f1e49935
--- /dev/null
+++ b/enc/trans/iso-8859-16-tbl.rb
@@ -0,0 +1,98 @@
+ISO_8859_16_TO_UCS_TBL = [
+ ["A0", 0x00A0],
+ ["A1", 0x0104],
+ ["A2", 0x0105],
+ ["A3", 0x0141],
+ ["A4", 0x20AC],
+ ["A5", 0x201E],
+ ["A6", 0x0160],
+ ["A7", 0x00A7],
+ ["A8", 0x0161],
+ ["A9", 0x00A9],
+ ["AA", 0x0218],
+ ["AB", 0x00AB],
+ ["AC", 0x0179],
+ ["AD", 0x00AD],
+ ["AE", 0x017A],
+ ["AF", 0x017B],
+ ["B0", 0x00B0],
+ ["B1", 0x00B1],
+ ["B2", 0x010C],
+ ["B3", 0x0142],
+ ["B4", 0x017D],
+ ["B5", 0x201D],
+ ["B6", 0x00B6],
+ ["B7", 0x00B7],
+ ["B8", 0x017E],
+ ["B9", 0x010D],
+ ["BA", 0x0219],
+ ["BB", 0x00BB],
+ ["BC", 0x0152],
+ ["BD", 0x0153],
+ ["BE", 0x0178],
+ ["BF", 0x017C],
+ ["C0", 0x00C0],
+ ["C1", 0x00C1],
+ ["C2", 0x00C2],
+ ["C3", 0x0102],
+ ["C4", 0x00C4],
+ ["C5", 0x0106],
+ ["C6", 0x00C6],
+ ["C7", 0x00C7],
+ ["C8", 0x00C8],
+ ["C9", 0x00C9],
+ ["CA", 0x00CA],
+ ["CB", 0x00CB],
+ ["CC", 0x00CC],
+ ["CD", 0x00CD],
+ ["CE", 0x00CE],
+ ["CF", 0x00CF],
+ ["D0", 0x0110],
+ ["D1", 0x0143],
+ ["D2", 0x00D2],
+ ["D3", 0x00D3],
+ ["D4", 0x00D4],
+ ["D5", 0x0150],
+ ["D6", 0x00D6],
+ ["D7", 0x015A],
+ ["D8", 0x0170],
+ ["D9", 0x00D9],
+ ["DA", 0x00DA],
+ ["DB", 0x00DB],
+ ["DC", 0x00DC],
+ ["DD", 0x0118],
+ ["DE", 0x021A],
+ ["DF", 0x00DF],
+ ["E0", 0x00E0],
+ ["E1", 0x00E1],
+ ["E2", 0x00E2],
+ ["E3", 0x0103],
+ ["E4", 0x00E4],
+ ["E5", 0x0107],
+ ["E6", 0x00E6],
+ ["E7", 0x00E7],
+ ["E8", 0x00E8],
+ ["E9", 0x00E9],
+ ["EA", 0x00EA],
+ ["EB", 0x00EB],
+ ["EC", 0x00EC],
+ ["ED", 0x00ED],
+ ["EE", 0x00EE],
+ ["EF", 0x00EF],
+ ["F0", 0x0111],
+ ["F1", 0x0144],
+ ["F2", 0x00F2],
+ ["F3", 0x00F3],
+ ["F4", 0x00F4],
+ ["F5", 0x0151],
+ ["F6", 0x00F6],
+ ["F7", 0x015B],
+ ["F8", 0x0171],
+ ["F9", 0x00F9],
+ ["FA", 0x00FA],
+ ["FB", 0x00FB],
+ ["FC", 0x00FC],
+ ["FD", 0x0119],
+ ["FE", 0x021B],
+ ["FF", 0x00FF],
+]
diff --git a/enc/trans/iso2022.trans b/enc/trans/iso2022.trans
index 3f40cce3c8..a441f1596d 100644
--- a/enc/trans/iso2022.trans
+++ b/enc/trans/iso2022.trans
@@ -553,8 +553,7 @@ rb_cp50220_encoder = {
iso2022jp_encoder_reset_sequence_size, finish_cp50220_encoder
};
-void
-Init_iso2022(void)
+TRANS_INIT(iso2022)
{
rb_register_transcoder(&rb_iso2022jp_decoder);
rb_register_transcoder(&rb_iso2022jp_encoder);
diff --git a/enc/trans/japanese.trans b/enc/trans/japanese.trans
index ce5d0bb70f..7ff024fa8d 100644
--- a/enc/trans/japanese.trans
+++ b/enc/trans/japanese.trans
@@ -90,8 +90,7 @@ rb_sjis2eucjp = {
NULL, NULL, NULL, fun_so_sjis2eucjp
};
-void
-Init_japanese(void)
+TRANS_INIT(japanese)
{
rb_register_transcoder(&rb_eucjp2sjis);
rb_register_transcoder(&rb_sjis2eucjp);
diff --git a/enc/trans/japanese_euc.trans b/enc/trans/japanese_euc.trans
index a976fe57d3..d96f69feda 100644
--- a/enc/trans/japanese_euc.trans
+++ b/enc/trans/japanese_euc.trans
@@ -18,6 +18,12 @@
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-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") +
+ citrus_decode_mapsrc("euc", 0x8000, "JISX0213-2/UCS@BMP,JISX0213-2/UCS@SIP")
+
transcode_tblgen "UTF-8", "EUC-JP",
[["{00-7f}", :nomap]] +
@@ -35,12 +41,17 @@
[["{00-7f}", :nomap]] +
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-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") +
+ citrus_decode_mapsrc("euc", 0x8000, "UCS@BMP/JISX0213-2,UCS@SIP/JISX0213-2")
%>
<%= transcode_generated_code %>
-void
-Init_japanese_euc(void)
+TRANS_INIT(japanese_euc)
{
<%= transcode_register_code %>
}
diff --git a/enc/trans/japanese_sjis.trans b/enc/trans/japanese_sjis.trans
index 00eace27a3..8e1e13056d 100644
--- a/enc/trans/japanese_sjis.trans
+++ b/enc/trans/japanese_sjis.trans
@@ -27,8 +27,7 @@
<%= transcode_generated_code %>
-void
-Init_japanese_sjis(void)
+TRANS_INIT(japanese_sjis)
{
<%= transcode_register_code %>
}
diff --git a/enc/trans/korean.trans b/enc/trans/korean.trans
index ef1cdfcb8e..fda1a3eeda 100644
--- a/enc/trans/korean.trans
+++ b/enc/trans/korean.trans
@@ -12,8 +12,7 @@
<%= transcode_generated_code %>
-void
-Init_korean(void)
+TRANS_INIT(korean)
{
<%= transcode_register_code %>
}
diff --git a/enc/trans/single_byte.trans b/enc/trans/single_byte.trans
index 1bf1001720..50f568cb94 100644
--- a/enc/trans/single_byte.trans
+++ b/enc/trans/single_byte.trans
@@ -43,6 +43,7 @@
transcode_tblgen_singlebyte "ISO-8859-13"
transcode_tblgen_singlebyte "ISO-8859-14"
transcode_tblgen_singlebyte "ISO-8859-15"
+ transcode_tblgen_singlebyte "ISO-8859-16"
transcode_tblgen_singlebyte "WINDOWS-874"
transcode_tblgen_singlebyte "WINDOWS-1250"
transcode_tblgen_singlebyte "WINDOWS-1251"
@@ -83,8 +84,7 @@
<%= transcode_generated_code %>
-void
-Init_single_byte(void)
+TRANS_INIT(single_byte)
{
<%= transcode_register_code %>
}
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 8ea0afd73f..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
@@ -233,10 +249,8 @@ rb_from_UTF8_MAC = {
from_utf8_mac_finish
};
-void
-Init_utf8_mac(void)
+TRANS_INIT(utf8_mac)
{
<%= transcode_register_code %>
rb_register_transcoder(&rb_from_UTF8_MAC);
}
-
diff --git a/enc/trans/utf_16_32.trans b/enc/trans/utf_16_32.trans
index c841df035f..632c8808ef 100644
--- a/enc/trans/utf_16_32.trans
+++ b/enc/trans/utf_16_32.trans
@@ -539,8 +539,7 @@ rb_to_UTF_32 = {
NULL, NULL, NULL, fun_so_to_utf_32
};
-void
-Init_utf_16_32(void)
+TRANS_INIT(utf_16_32)
{
rb_register_transcoder(&rb_from_UTF_16BE);
rb_register_transcoder(&rb_to_UTF_16BE);
diff --git a/enc/unicode.c b/enc/unicode.c
index beb5fa39f0..20990c1e54 100644
--- a/enc/unicode.c
+++ b/enc/unicode.c
@@ -38,7 +38,7 @@
static const unsigned short EncUNICODE_ISO_8859_1_CtypeTable[256] = {
0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008,
- 0x4008, 0x428c, 0x4289, 0x4288, 0x4288, 0x4288, 0x4008, 0x4008,
+ 0x4008, 0x420c, 0x4209, 0x4208, 0x4208, 0x4208, 0x4008, 0x4008,
0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008,
0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008,
0x4284, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0,
@@ -103,1937 +103,8 @@ typedef struct {
CodePointList2 to;
} CaseUnfold_13_Type;
-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}}},
- { 0x023b, {1, {0x023c}}},
- { 0x023d, {1, {0x019a}}},
- { 0x0241, {1, {0x0294}}},
- { 0x0345, {1, {0x03b9}}},
- { 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}}},
- { 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}}},
- { 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}}},
- { 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}}},
- { 0x0500, {1, {0x0501}}},
- { 0x0502, {1, {0x0503}}},
- { 0x0504, {1, {0x0505}}},
- { 0x0506, {1, {0x0507}}},
- { 0x0508, {1, {0x0509}}},
- { 0x050a, {1, {0x050b}}},
- { 0x050c, {1, {0x050d}}},
- { 0x050e, {1, {0x050f}}},
- { 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}}},
- { 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}}},
- { 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}}},
- { 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}}},
- { 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}}},
- { 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}}},
- { 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}}},
- { 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_Locale[] = {
- { 0x0049, {1, {0x0069}}},
- { 0x0130, {2, {0x0069, 0x0307}}}
-};
-
-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, {0x212a, 0x004b }}},
- { 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, {0x212b, 0x00c5 }}},
- { 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 }}},
- { 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 }}},
- { 0x0253, {1, {0x0181 }}},
- { 0x0254, {1, {0x0186 }}},
- { 0x0256, {1, {0x0189 }}},
- { 0x0257, {1, {0x018a }}},
- { 0x0259, {1, {0x018f }}},
- { 0x025b, {1, {0x0190 }}},
- { 0x0260, {1, {0x0193 }}},
- { 0x0263, {1, {0x0194 }}},
- { 0x0268, {1, {0x0197 }}},
- { 0x0269, {1, {0x0196 }}},
- { 0x026f, {1, {0x019c }}},
- { 0x0272, {1, {0x019d }}},
- { 0x0275, {1, {0x019f }}},
- { 0x0280, {1, {0x01a6 }}},
- { 0x0283, {1, {0x01a9 }}},
- { 0x0288, {1, {0x01ae }}},
- { 0x028a, {1, {0x01b1 }}},
- { 0x028b, {1, {0x01b2 }}},
- { 0x0292, {1, {0x01b7 }}},
- { 0x0294, {1, {0x0241 }}},
- { 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, {0x03f5, 0x0395 }}},
- { 0x03b6, {1, {0x0396 }}},
- { 0x03b7, {1, {0x0397 }}},
- { 0x03b8, {3, {0x03f4, 0x0398, 0x03d1 }}},
- { 0x03b9, {3, {0x1fbe, 0x0399, 0x0345 }}},
- { 0x03ba, {2, {0x03f0, 0x039a }}},
- { 0x03bb, {1, {0x039b }}},
- { 0x03bc, {2, {0x00b5, 0x039c }}},
- { 0x03bd, {1, {0x039d }}},
- { 0x03be, {1, {0x039e }}},
- { 0x03bf, {1, {0x039f }}},
- { 0x03c0, {2, {0x03a0, 0x03d6 }}},
- { 0x03c1, {2, {0x03f1, 0x03a1 }}},
- { 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 }}},
- { 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 }}},
- { 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 }}},
- { 0x0501, {1, {0x0500 }}},
- { 0x0503, {1, {0x0502 }}},
- { 0x0505, {1, {0x0504 }}},
- { 0x0507, {1, {0x0506 }}},
- { 0x0509, {1, {0x0508 }}},
- { 0x050b, {1, {0x050a }}},
- { 0x050d, {1, {0x050c }}},
- { 0x050f, {1, {0x050e }}},
- { 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 }}},
- { 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, {0x1e9b, 0x1e60 }}},
- { 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 }}},
- { 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 }}},
- { 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 }}},
- { 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 }}},
- { 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 }}},
- { 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 }}},
- { 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 }}}
-};
-
-static const CaseUnfold_11_Type CaseUnfold_11_Locale[] = {
- { 0x0069, {1, {0x0049 }}}
-};
-
-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}, {1, {0x00df }}},
- { {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, {0x1f88, 0x1f80 }}},
- { {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 }}}
-};
+#include "enc/unicode/casefold.h"
-static const CaseUnfold_12_Type CaseUnfold_12_Locale[] = {
- { {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 }}}
-};
#define numberof(array) (int)(sizeof(array) / sizeof((array)[0]))
#define CODE_RANGES_NUM numberof(CodeRanges)
@@ -2080,7 +151,7 @@ onigenc_utf16_32_get_ctype_code_range(OnigCtype ctype, OnigCodePoint* sb_out,
#include "ruby/st.h"
-#define PROPERTY_NAME_MAX_SIZE MAX_WORD_LENGTH
+#define PROPERTY_NAME_MAX_SIZE (MAX_WORD_LENGTH + 1)
extern int
onigenc_unicode_property_name_to_ctype(OnigEncoding enc, UChar* name, UChar* end)
@@ -2099,7 +170,7 @@ onigenc_unicode_property_name_to_ctype(OnigEncoding enc, UChar* name, UChar* end
if (code >= 0x80)
return ONIGERR_INVALID_CHAR_PROPERTY_NAME;
- buf[len++] = (UChar )TOLOWER((unsigned char)code);
+ buf[len++] = ONIGENC_ASCII_CODE_TO_LOWER_CASE(code);
if (len >= PROPERTY_NAME_MAX_SIZE)
return ONIGERR_INVALID_CHAR_PROPERTY_NAME;
}
@@ -2167,7 +238,7 @@ static int init_case_fold_table(void)
THREAD_ATOMIC_START;
- FoldTable = st_init_numtable_with_size(1200);
+ 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];
@@ -2178,7 +249,7 @@ static int init_case_fold_table(void)
st_add_direct(FoldTable, (st_data_t )p->from, (st_data_t )&(p->to));
}
- Unfold1Table = st_init_numtable_with_size(1000);
+ 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++) {
@@ -2190,7 +261,7 @@ static int init_case_fold_table(void)
st_add_direct(Unfold1Table, (st_data_t )p1->from, (st_data_t )&(p1->to));
}
- Unfold2Table = st_init_table_with_size(&type_code2_hash, 200);
+ 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++) {
@@ -2202,7 +273,7 @@ static int init_case_fold_table(void)
st_add_direct(Unfold2Table, (st_data_t )p2->from, (st_data_t )(&p2->to));
}
- Unfold3Table = st_init_table_with_size(&type_code3_hash, 30);
+ 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++) {
diff --git a/enc/unicode/casefold.h b/enc/unicode/casefold.h
new file mode 100644
index 0000000000..b9559de4a3
--- /dev/null
+++ b/enc/unicode/casefold.h
@@ -0,0 +1,2238 @@
+/* DO NOT EDIT THIS FILE. */
+/* Generated by tool/CaseFolding.py */
+
+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_Locale[] = {
+ { 0x0049, {1, {0x0069}}},
+ { 0x0130, {2, {0x0069, 0x0307}}},
+};
+
+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 }}},
+};
+
+static const CaseUnfold_11_Type CaseUnfold_11_Locale[] = {
+ { 0x0069, {1, {0x0049 }}},
+};
+
+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_12_Type CaseUnfold_12_Locale[] = {
+ { {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 }}},
+};
+
+#define FOLD_TABLE_SIZE 1357
+#define UNFOLD1_TABLE_SIZE 1207
+#define UNFOLD2_TABLE_SIZE 88
+#define UNFOLD3_TABLE_SIZE 23
diff --git a/enc/unicode/name2ctype.h b/enc/unicode/name2ctype.h
index a45ea59a4b..2e80edf525 100644
--- a/enc/unicode/name2ctype.h
+++ b/enc/unicode/name2ctype.h
@@ -36,7 +36,4273 @@ error "gperf generated tables don't work with this execution character set. Plea
#define long size_t
-#ifdef USE_UNICODE_PROPERTIES
+/* 'NEWLINE': [[:NEWLINE:]] */
+static const OnigCodePoint CR_NEWLINE[] = {
+ 1,
+ 0x000a, 0x000a,
+}; /* CR_NEWLINE */
+
+/* 'Alpha': [[:Alpha:]] */
+static const OnigCodePoint CR_Alpha[] = {
+ 540,
+ 0x0041, 0x005a,
+ 0x0061, 0x007a,
+ 0x00aa, 0x00aa,
+ 0x00b5, 0x00b5,
+ 0x00ba, 0x00ba,
+ 0x00c0, 0x00d6,
+ 0x00d8, 0x00f6,
+ 0x00f8, 0x02c1,
+ 0x02c6, 0x02d1,
+ 0x02e0, 0x02e4,
+ 0x02ec, 0x02ec,
+ 0x02ee, 0x02ee,
+ 0x0345, 0x0345,
+ 0x0370, 0x0374,
+ 0x0376, 0x0377,
+ 0x037a, 0x037d,
+ 0x0386, 0x0386,
+ 0x0388, 0x038a,
+ 0x038c, 0x038c,
+ 0x038e, 0x03a1,
+ 0x03a3, 0x03f5,
+ 0x03f7, 0x0481,
+ 0x048a, 0x0527,
+ 0x0531, 0x0556,
+ 0x0559, 0x0559,
+ 0x0561, 0x0587,
+ 0x05b0, 0x05bd,
+ 0x05bf, 0x05bf,
+ 0x05c1, 0x05c2,
+ 0x05c4, 0x05c5,
+ 0x05c7, 0x05c7,
+ 0x05d0, 0x05ea,
+ 0x05f0, 0x05f2,
+ 0x0610, 0x061a,
+ 0x0620, 0x0657,
+ 0x0659, 0x065f,
+ 0x066e, 0x06d3,
+ 0x06d5, 0x06dc,
+ 0x06e1, 0x06e8,
+ 0x06ed, 0x06ef,
+ 0x06fa, 0x06fc,
+ 0x06ff, 0x06ff,
+ 0x0710, 0x073f,
+ 0x074d, 0x07b1,
+ 0x07ca, 0x07ea,
+ 0x07f4, 0x07f5,
+ 0x07fa, 0x07fa,
+ 0x0800, 0x0817,
+ 0x081a, 0x082c,
+ 0x0840, 0x0858,
+ 0x08a0, 0x08a0,
+ 0x08a2, 0x08ac,
+ 0x08e4, 0x08e9,
+ 0x08f0, 0x08fe,
+ 0x0900, 0x093b,
+ 0x093d, 0x094c,
+ 0x094e, 0x0950,
+ 0x0955, 0x0963,
+ 0x0971, 0x0977,
+ 0x0979, 0x097f,
+ 0x0981, 0x0983,
+ 0x0985, 0x098c,
+ 0x098f, 0x0990,
+ 0x0993, 0x09a8,
+ 0x09aa, 0x09b0,
+ 0x09b2, 0x09b2,
+ 0x09b6, 0x09b9,
+ 0x09bd, 0x09c4,
+ 0x09c7, 0x09c8,
+ 0x09cb, 0x09cc,
+ 0x09ce, 0x09ce,
+ 0x09d7, 0x09d7,
+ 0x09dc, 0x09dd,
+ 0x09df, 0x09e3,
+ 0x09f0, 0x09f1,
+ 0x0a01, 0x0a03,
+ 0x0a05, 0x0a0a,
+ 0x0a0f, 0x0a10,
+ 0x0a13, 0x0a28,
+ 0x0a2a, 0x0a30,
+ 0x0a32, 0x0a33,
+ 0x0a35, 0x0a36,
+ 0x0a38, 0x0a39,
+ 0x0a3e, 0x0a42,
+ 0x0a47, 0x0a48,
+ 0x0a4b, 0x0a4c,
+ 0x0a51, 0x0a51,
+ 0x0a59, 0x0a5c,
+ 0x0a5e, 0x0a5e,
+ 0x0a70, 0x0a75,
+ 0x0a81, 0x0a83,
+ 0x0a85, 0x0a8d,
+ 0x0a8f, 0x0a91,
+ 0x0a93, 0x0aa8,
+ 0x0aaa, 0x0ab0,
+ 0x0ab2, 0x0ab3,
+ 0x0ab5, 0x0ab9,
+ 0x0abd, 0x0ac5,
+ 0x0ac7, 0x0ac9,
+ 0x0acb, 0x0acc,
+ 0x0ad0, 0x0ad0,
+ 0x0ae0, 0x0ae3,
+ 0x0b01, 0x0b03,
+ 0x0b05, 0x0b0c,
+ 0x0b0f, 0x0b10,
+ 0x0b13, 0x0b28,
+ 0x0b2a, 0x0b30,
+ 0x0b32, 0x0b33,
+ 0x0b35, 0x0b39,
+ 0x0b3d, 0x0b44,
+ 0x0b47, 0x0b48,
+ 0x0b4b, 0x0b4c,
+ 0x0b56, 0x0b57,
+ 0x0b5c, 0x0b5d,
+ 0x0b5f, 0x0b63,
+ 0x0b71, 0x0b71,
+ 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, 0x0bcc,
+ 0x0bd0, 0x0bd0,
+ 0x0bd7, 0x0bd7,
+ 0x0c01, 0x0c03,
+ 0x0c05, 0x0c0c,
+ 0x0c0e, 0x0c10,
+ 0x0c12, 0x0c28,
+ 0x0c2a, 0x0c33,
+ 0x0c35, 0x0c39,
+ 0x0c3d, 0x0c44,
+ 0x0c46, 0x0c48,
+ 0x0c4a, 0x0c4c,
+ 0x0c55, 0x0c56,
+ 0x0c58, 0x0c59,
+ 0x0c60, 0x0c63,
+ 0x0c82, 0x0c83,
+ 0x0c85, 0x0c8c,
+ 0x0c8e, 0x0c90,
+ 0x0c92, 0x0ca8,
+ 0x0caa, 0x0cb3,
+ 0x0cb5, 0x0cb9,
+ 0x0cbd, 0x0cc4,
+ 0x0cc6, 0x0cc8,
+ 0x0cca, 0x0ccc,
+ 0x0cd5, 0x0cd6,
+ 0x0cde, 0x0cde,
+ 0x0ce0, 0x0ce3,
+ 0x0cf1, 0x0cf2,
+ 0x0d02, 0x0d03,
+ 0x0d05, 0x0d0c,
+ 0x0d0e, 0x0d10,
+ 0x0d12, 0x0d3a,
+ 0x0d3d, 0x0d44,
+ 0x0d46, 0x0d48,
+ 0x0d4a, 0x0d4c,
+ 0x0d4e, 0x0d4e,
+ 0x0d57, 0x0d57,
+ 0x0d60, 0x0d63,
+ 0x0d7a, 0x0d7f,
+ 0x0d82, 0x0d83,
+ 0x0d85, 0x0d96,
+ 0x0d9a, 0x0db1,
+ 0x0db3, 0x0dbb,
+ 0x0dbd, 0x0dbd,
+ 0x0dc0, 0x0dc6,
+ 0x0dcf, 0x0dd4,
+ 0x0dd6, 0x0dd6,
+ 0x0dd8, 0x0ddf,
+ 0x0df2, 0x0df3,
+ 0x0e01, 0x0e3a,
+ 0x0e40, 0x0e46,
+ 0x0e4d, 0x0e4d,
+ 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,
+ 0x0ecd, 0x0ecd,
+ 0x0edc, 0x0edf,
+ 0x0f00, 0x0f00,
+ 0x0f40, 0x0f47,
+ 0x0f49, 0x0f6c,
+ 0x0f71, 0x0f81,
+ 0x0f88, 0x0f97,
+ 0x0f99, 0x0fbc,
+ 0x1000, 0x1036,
+ 0x1038, 0x1038,
+ 0x103b, 0x103f,
+ 0x1050, 0x1062,
+ 0x1065, 0x1068,
+ 0x106e, 0x1086,
+ 0x108e, 0x108e,
+ 0x109c, 0x109d,
+ 0x10a0, 0x10c5,
+ 0x10c7, 0x10c7,
+ 0x10cd, 0x10cd,
+ 0x10d0, 0x10fa,
+ 0x10fc, 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,
+ 0x135f, 0x135f,
+ 0x1380, 0x138f,
+ 0x13a0, 0x13f4,
+ 0x1401, 0x166c,
+ 0x166f, 0x167f,
+ 0x1681, 0x169a,
+ 0x16a0, 0x16ea,
+ 0x16ee, 0x16f0,
+ 0x1700, 0x170c,
+ 0x170e, 0x1713,
+ 0x1720, 0x1733,
+ 0x1740, 0x1753,
+ 0x1760, 0x176c,
+ 0x176e, 0x1770,
+ 0x1772, 0x1773,
+ 0x1780, 0x17b3,
+ 0x17b6, 0x17c8,
+ 0x17d7, 0x17d7,
+ 0x17dc, 0x17dc,
+ 0x1820, 0x1877,
+ 0x1880, 0x18aa,
+ 0x18b0, 0x18f5,
+ 0x1900, 0x191c,
+ 0x1920, 0x192b,
+ 0x1930, 0x1938,
+ 0x1950, 0x196d,
+ 0x1970, 0x1974,
+ 0x1980, 0x19ab,
+ 0x19b0, 0x19c9,
+ 0x1a00, 0x1a1b,
+ 0x1a20, 0x1a5e,
+ 0x1a61, 0x1a74,
+ 0x1aa7, 0x1aa7,
+ 0x1b00, 0x1b33,
+ 0x1b35, 0x1b43,
+ 0x1b45, 0x1b4b,
+ 0x1b80, 0x1ba9,
+ 0x1bac, 0x1baf,
+ 0x1bba, 0x1be5,
+ 0x1be7, 0x1bf1,
+ 0x1c00, 0x1c35,
+ 0x1c4d, 0x1c4f,
+ 0x1c5a, 0x1c7d,
+ 0x1ce9, 0x1cec,
+ 0x1cee, 0x1cf3,
+ 0x1cf5, 0x1cf6,
+ 0x1d00, 0x1dbf,
+ 0x1e00, 0x1f15,
+ 0x1f18, 0x1f1d,
+ 0x1f20, 0x1f45,
+ 0x1f48, 0x1f4d,
+ 0x1f50, 0x1f57,
+ 0x1f59, 0x1f59,
+ 0x1f5b, 0x1f5b,
+ 0x1f5d, 0x1f5d,
+ 0x1f5f, 0x1f7d,
+ 0x1f80, 0x1fb4,
+ 0x1fb6, 0x1fbc,
+ 0x1fbe, 0x1fbe,
+ 0x1fc2, 0x1fc4,
+ 0x1fc6, 0x1fcc,
+ 0x1fd0, 0x1fd3,
+ 0x1fd6, 0x1fdb,
+ 0x1fe0, 0x1fec,
+ 0x1ff2, 0x1ff4,
+ 0x1ff6, 0x1ffc,
+ 0x2071, 0x2071,
+ 0x207f, 0x207f,
+ 0x2090, 0x209c,
+ 0x2102, 0x2102,
+ 0x2107, 0x2107,
+ 0x210a, 0x2113,
+ 0x2115, 0x2115,
+ 0x2119, 0x211d,
+ 0x2124, 0x2124,
+ 0x2126, 0x2126,
+ 0x2128, 0x2128,
+ 0x212a, 0x212d,
+ 0x212f, 0x2139,
+ 0x213c, 0x213f,
+ 0x2145, 0x2149,
+ 0x214e, 0x214e,
+ 0x2160, 0x2188,
+ 0x24b6, 0x24e9,
+ 0x2c00, 0x2c2e,
+ 0x2c30, 0x2c5e,
+ 0x2c60, 0x2ce4,
+ 0x2ceb, 0x2cee,
+ 0x2cf2, 0x2cf3,
+ 0x2d00, 0x2d25,
+ 0x2d27, 0x2d27,
+ 0x2d2d, 0x2d2d,
+ 0x2d30, 0x2d67,
+ 0x2d6f, 0x2d6f,
+ 0x2d80, 0x2d96,
+ 0x2da0, 0x2da6,
+ 0x2da8, 0x2dae,
+ 0x2db0, 0x2db6,
+ 0x2db8, 0x2dbe,
+ 0x2dc0, 0x2dc6,
+ 0x2dc8, 0x2dce,
+ 0x2dd0, 0x2dd6,
+ 0x2dd8, 0x2dde,
+ 0x2de0, 0x2dff,
+ 0x2e2f, 0x2e2f,
+ 0x3005, 0x3007,
+ 0x3021, 0x3029,
+ 0x3031, 0x3035,
+ 0x3038, 0x303c,
+ 0x3041, 0x3096,
+ 0x309d, 0x309f,
+ 0x30a1, 0x30fa,
+ 0x30fc, 0x30ff,
+ 0x3105, 0x312d,
+ 0x3131, 0x318e,
+ 0x31a0, 0x31ba,
+ 0x31f0, 0x31ff,
+ 0x3400, 0x4db5,
+ 0x4e00, 0x9fcc,
+ 0xa000, 0xa48c,
+ 0xa4d0, 0xa4fd,
+ 0xa500, 0xa60c,
+ 0xa610, 0xa61f,
+ 0xa62a, 0xa62b,
+ 0xa640, 0xa66e,
+ 0xa674, 0xa67b,
+ 0xa67f, 0xa697,
+ 0xa69f, 0xa6ef,
+ 0xa717, 0xa71f,
+ 0xa722, 0xa788,
+ 0xa78b, 0xa78e,
+ 0xa790, 0xa793,
+ 0xa7a0, 0xa7aa,
+ 0xa7f8, 0xa801,
+ 0xa803, 0xa805,
+ 0xa807, 0xa80a,
+ 0xa80c, 0xa827,
+ 0xa840, 0xa873,
+ 0xa880, 0xa8c3,
+ 0xa8f2, 0xa8f7,
+ 0xa8fb, 0xa8fb,
+ 0xa90a, 0xa92a,
+ 0xa930, 0xa952,
+ 0xa960, 0xa97c,
+ 0xa980, 0xa9b2,
+ 0xa9b4, 0xa9bf,
+ 0xa9cf, 0xa9cf,
+ 0xaa00, 0xaa36,
+ 0xaa40, 0xaa4d,
+ 0xaa60, 0xaa76,
+ 0xaa7a, 0xaa7a,
+ 0xaa80, 0xaabe,
+ 0xaac0, 0xaac0,
+ 0xaac2, 0xaac2,
+ 0xaadb, 0xaadd,
+ 0xaae0, 0xaaef,
+ 0xaaf2, 0xaaf5,
+ 0xab01, 0xab06,
+ 0xab09, 0xab0e,
+ 0xab11, 0xab16,
+ 0xab20, 0xab26,
+ 0xab28, 0xab2e,
+ 0xabc0, 0xabea,
+ 0xac00, 0xd7a3,
+ 0xd7b0, 0xd7c6,
+ 0xd7cb, 0xd7fb,
+ 0xf900, 0xfa6d,
+ 0xfa70, 0xfad9,
+ 0xfb00, 0xfb06,
+ 0xfb13, 0xfb17,
+ 0xfb1d, 0xfb28,
+ 0xfb2a, 0xfb36,
+ 0xfb38, 0xfb3c,
+ 0xfb3e, 0xfb3e,
+ 0xfb40, 0xfb41,
+ 0xfb43, 0xfb44,
+ 0xfb46, 0xfbb1,
+ 0xfbd3, 0xfd3d,
+ 0xfd50, 0xfd8f,
+ 0xfd92, 0xfdc7,
+ 0xfdf0, 0xfdfb,
+ 0xfe70, 0xfe74,
+ 0xfe76, 0xfefc,
+ 0xff21, 0xff3a,
+ 0xff41, 0xff5a,
+ 0xff66, 0xffbe,
+ 0xffc2, 0xffc7,
+ 0xffca, 0xffcf,
+ 0xffd2, 0xffd7,
+ 0xffda, 0xffdc,
+ 0x10000, 0x1000b,
+ 0x1000d, 0x10026,
+ 0x10028, 0x1003a,
+ 0x1003c, 0x1003d,
+ 0x1003f, 0x1004d,
+ 0x10050, 0x1005d,
+ 0x10080, 0x100fa,
+ 0x10140, 0x10174,
+ 0x10280, 0x1029c,
+ 0x102a0, 0x102d0,
+ 0x10300, 0x1031e,
+ 0x10330, 0x1034a,
+ 0x10380, 0x1039d,
+ 0x103a0, 0x103c3,
+ 0x103c8, 0x103cf,
+ 0x103d1, 0x103d5,
+ 0x10400, 0x1049d,
+ 0x10800, 0x10805,
+ 0x10808, 0x10808,
+ 0x1080a, 0x10835,
+ 0x10837, 0x10838,
+ 0x1083c, 0x1083c,
+ 0x1083f, 0x10855,
+ 0x10900, 0x10915,
+ 0x10920, 0x10939,
+ 0x10980, 0x109b7,
+ 0x109be, 0x109bf,
+ 0x10a00, 0x10a03,
+ 0x10a05, 0x10a06,
+ 0x10a0c, 0x10a13,
+ 0x10a15, 0x10a17,
+ 0x10a19, 0x10a33,
+ 0x10a60, 0x10a7c,
+ 0x10b00, 0x10b35,
+ 0x10b40, 0x10b55,
+ 0x10b60, 0x10b72,
+ 0x10c00, 0x10c48,
+ 0x11000, 0x11045,
+ 0x11082, 0x110b8,
+ 0x110d0, 0x110e8,
+ 0x11100, 0x11132,
+ 0x11180, 0x111bf,
+ 0x111c1, 0x111c4,
+ 0x11680, 0x116b5,
+ 0x12000, 0x1236e,
+ 0x12400, 0x12462,
+ 0x13000, 0x1342e,
+ 0x16800, 0x16a38,
+ 0x16f00, 0x16f44,
+ 0x16f50, 0x16f7e,
+ 0x16f93, 0x16f9f,
+ 0x1b000, 0x1b001,
+ 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, 0x1d6c0,
+ 0x1d6c2, 0x1d6da,
+ 0x1d6dc, 0x1d6fa,
+ 0x1d6fc, 0x1d714,
+ 0x1d716, 0x1d734,
+ 0x1d736, 0x1d74e,
+ 0x1d750, 0x1d76e,
+ 0x1d770, 0x1d788,
+ 0x1d78a, 0x1d7a8,
+ 0x1d7aa, 0x1d7c2,
+ 0x1d7c4, 0x1d7cb,
+ 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,
+ 0x20000, 0x2a6d6,
+ 0x2a700, 0x2b734,
+ 0x2b740, 0x2b81d,
+ 0x2f800, 0x2fa1d,
+}; /* CR_Alpha */
+
+/* 'Blank': [[:Blank:]] */
+static const OnigCodePoint CR_Blank[] = {
+ 9,
+ 0x0009, 0x0009,
+ 0x0020, 0x0020,
+ 0x00a0, 0x00a0,
+ 0x1680, 0x1680,
+ 0x180e, 0x180e,
+ 0x2000, 0x200a,
+ 0x202f, 0x202f,
+ 0x205f, 0x205f,
+ 0x3000, 0x3000,
+}; /* CR_Blank */
+
+/* 'Cntrl': [[:Cntrl:]] */
+static const OnigCodePoint CR_Cntrl[] = {
+ 2,
+ 0x0000, 0x001f,
+ 0x007f, 0x009f,
+}; /* CR_Cntrl */
+
+/* 'Digit': [[:Digit:]] */
+static const OnigCodePoint CR_Digit[] = {
+ 42,
+ 0x0030, 0x0039,
+ 0x0660, 0x0669,
+ 0x06f0, 0x06f9,
+ 0x07c0, 0x07c9,
+ 0x0966, 0x096f,
+ 0x09e6, 0x09ef,
+ 0x0a66, 0x0a6f,
+ 0x0ae6, 0x0aef,
+ 0x0b66, 0x0b6f,
+ 0x0be6, 0x0bef,
+ 0x0c66, 0x0c6f,
+ 0x0ce6, 0x0cef,
+ 0x0d66, 0x0d6f,
+ 0x0e50, 0x0e59,
+ 0x0ed0, 0x0ed9,
+ 0x0f20, 0x0f29,
+ 0x1040, 0x1049,
+ 0x1090, 0x1099,
+ 0x17e0, 0x17e9,
+ 0x1810, 0x1819,
+ 0x1946, 0x194f,
+ 0x19d0, 0x19d9,
+ 0x1a80, 0x1a89,
+ 0x1a90, 0x1a99,
+ 0x1b50, 0x1b59,
+ 0x1bb0, 0x1bb9,
+ 0x1c40, 0x1c49,
+ 0x1c50, 0x1c59,
+ 0xa620, 0xa629,
+ 0xa8d0, 0xa8d9,
+ 0xa900, 0xa909,
+ 0xa9d0, 0xa9d9,
+ 0xaa50, 0xaa59,
+ 0xabf0, 0xabf9,
+ 0xff10, 0xff19,
+ 0x104a0, 0x104a9,
+ 0x11066, 0x1106f,
+ 0x110f0, 0x110f9,
+ 0x11136, 0x1113f,
+ 0x111d0, 0x111d9,
+ 0x116c0, 0x116c9,
+ 0x1d7ce, 0x1d7ff,
+}; /* CR_Digit */
+
+/* 'Graph': [[:Graph:]] */
+static const OnigCodePoint CR_Graph[] = {
+ 544,
+ 0x0021, 0x007e,
+ 0x00a1, 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, 0x167f,
+ 0x1681, 0x169c,
+ 0x16a0, 0x16f0,
+ 0x1700, 0x170c,
+ 0x170e, 0x1714,
+ 0x1720, 0x1736,
+ 0x1740, 0x1753,
+ 0x1760, 0x176c,
+ 0x176e, 0x1770,
+ 0x1772, 0x1773,
+ 0x1780, 0x17dd,
+ 0x17e0, 0x17e9,
+ 0x17f0, 0x17f9,
+ 0x1800, 0x180d,
+ 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,
+ 0x200b, 0x2027,
+ 0x202a, 0x202e,
+ 0x2030, 0x205e,
+ 0x2060, 0x2064,
+ 0x206a, 0x2071,
+ 0x2074, 0x208e,
+ 0x2090, 0x209c,
+ 0x20a0, 0x20b9,
+ 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,
+ 0x3001, 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,
+ 0xe000, 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,
+ 0xfdf0, 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, 0xfffd,
+ 0x10000, 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,
+ 0x20000, 0x2a6d6,
+ 0x2a700, 0x2b734,
+ 0x2b740, 0x2b81d,
+ 0x2f800, 0x2fa1d,
+ 0xe0001, 0xe0001,
+ 0xe0020, 0xe007f,
+ 0xe0100, 0xe01ef,
+ 0xf0000, 0xffffd,
+ 0x100000, 0x10fffd,
+}; /* CR_Graph */
+
+/* 'Lower': [[:Lower:]] */
+static const OnigCodePoint CR_Lower[] = {
+ 618,
+ 0x0061, 0x007a,
+ 0x00aa, 0x00aa,
+ 0x00b5, 0x00b5,
+ 0x00ba, 0x00ba,
+ 0x00df, 0x00f6,
+ 0x00f8, 0x00ff,
+ 0x0101, 0x0101,
+ 0x0103, 0x0103,
+ 0x0105, 0x0105,
+ 0x0107, 0x0107,
+ 0x0109, 0x0109,
+ 0x010b, 0x010b,
+ 0x010d, 0x010d,
+ 0x010f, 0x010f,
+ 0x0111, 0x0111,
+ 0x0113, 0x0113,
+ 0x0115, 0x0115,
+ 0x0117, 0x0117,
+ 0x0119, 0x0119,
+ 0x011b, 0x011b,
+ 0x011d, 0x011d,
+ 0x011f, 0x011f,
+ 0x0121, 0x0121,
+ 0x0123, 0x0123,
+ 0x0125, 0x0125,
+ 0x0127, 0x0127,
+ 0x0129, 0x0129,
+ 0x012b, 0x012b,
+ 0x012d, 0x012d,
+ 0x012f, 0x012f,
+ 0x0131, 0x0131,
+ 0x0133, 0x0133,
+ 0x0135, 0x0135,
+ 0x0137, 0x0138,
+ 0x013a, 0x013a,
+ 0x013c, 0x013c,
+ 0x013e, 0x013e,
+ 0x0140, 0x0140,
+ 0x0142, 0x0142,
+ 0x0144, 0x0144,
+ 0x0146, 0x0146,
+ 0x0148, 0x0149,
+ 0x014b, 0x014b,
+ 0x014d, 0x014d,
+ 0x014f, 0x014f,
+ 0x0151, 0x0151,
+ 0x0153, 0x0153,
+ 0x0155, 0x0155,
+ 0x0157, 0x0157,
+ 0x0159, 0x0159,
+ 0x015b, 0x015b,
+ 0x015d, 0x015d,
+ 0x015f, 0x015f,
+ 0x0161, 0x0161,
+ 0x0163, 0x0163,
+ 0x0165, 0x0165,
+ 0x0167, 0x0167,
+ 0x0169, 0x0169,
+ 0x016b, 0x016b,
+ 0x016d, 0x016d,
+ 0x016f, 0x016f,
+ 0x0171, 0x0171,
+ 0x0173, 0x0173,
+ 0x0175, 0x0175,
+ 0x0177, 0x0177,
+ 0x017a, 0x017a,
+ 0x017c, 0x017c,
+ 0x017e, 0x0180,
+ 0x0183, 0x0183,
+ 0x0185, 0x0185,
+ 0x0188, 0x0188,
+ 0x018c, 0x018d,
+ 0x0192, 0x0192,
+ 0x0195, 0x0195,
+ 0x0199, 0x019b,
+ 0x019e, 0x019e,
+ 0x01a1, 0x01a1,
+ 0x01a3, 0x01a3,
+ 0x01a5, 0x01a5,
+ 0x01a8, 0x01a8,
+ 0x01aa, 0x01ab,
+ 0x01ad, 0x01ad,
+ 0x01b0, 0x01b0,
+ 0x01b4, 0x01b4,
+ 0x01b6, 0x01b6,
+ 0x01b9, 0x01ba,
+ 0x01bd, 0x01bf,
+ 0x01c6, 0x01c6,
+ 0x01c9, 0x01c9,
+ 0x01cc, 0x01cc,
+ 0x01ce, 0x01ce,
+ 0x01d0, 0x01d0,
+ 0x01d2, 0x01d2,
+ 0x01d4, 0x01d4,
+ 0x01d6, 0x01d6,
+ 0x01d8, 0x01d8,
+ 0x01da, 0x01da,
+ 0x01dc, 0x01dd,
+ 0x01df, 0x01df,
+ 0x01e1, 0x01e1,
+ 0x01e3, 0x01e3,
+ 0x01e5, 0x01e5,
+ 0x01e7, 0x01e7,
+ 0x01e9, 0x01e9,
+ 0x01eb, 0x01eb,
+ 0x01ed, 0x01ed,
+ 0x01ef, 0x01f0,
+ 0x01f3, 0x01f3,
+ 0x01f5, 0x01f5,
+ 0x01f9, 0x01f9,
+ 0x01fb, 0x01fb,
+ 0x01fd, 0x01fd,
+ 0x01ff, 0x01ff,
+ 0x0201, 0x0201,
+ 0x0203, 0x0203,
+ 0x0205, 0x0205,
+ 0x0207, 0x0207,
+ 0x0209, 0x0209,
+ 0x020b, 0x020b,
+ 0x020d, 0x020d,
+ 0x020f, 0x020f,
+ 0x0211, 0x0211,
+ 0x0213, 0x0213,
+ 0x0215, 0x0215,
+ 0x0217, 0x0217,
+ 0x0219, 0x0219,
+ 0x021b, 0x021b,
+ 0x021d, 0x021d,
+ 0x021f, 0x021f,
+ 0x0221, 0x0221,
+ 0x0223, 0x0223,
+ 0x0225, 0x0225,
+ 0x0227, 0x0227,
+ 0x0229, 0x0229,
+ 0x022b, 0x022b,
+ 0x022d, 0x022d,
+ 0x022f, 0x022f,
+ 0x0231, 0x0231,
+ 0x0233, 0x0239,
+ 0x023c, 0x023c,
+ 0x023f, 0x0240,
+ 0x0242, 0x0242,
+ 0x0247, 0x0247,
+ 0x0249, 0x0249,
+ 0x024b, 0x024b,
+ 0x024d, 0x024d,
+ 0x024f, 0x0293,
+ 0x0295, 0x02b8,
+ 0x02c0, 0x02c1,
+ 0x02e0, 0x02e4,
+ 0x0345, 0x0345,
+ 0x0371, 0x0371,
+ 0x0373, 0x0373,
+ 0x0377, 0x0377,
+ 0x037a, 0x037d,
+ 0x0390, 0x0390,
+ 0x03ac, 0x03ce,
+ 0x03d0, 0x03d1,
+ 0x03d5, 0x03d7,
+ 0x03d9, 0x03d9,
+ 0x03db, 0x03db,
+ 0x03dd, 0x03dd,
+ 0x03df, 0x03df,
+ 0x03e1, 0x03e1,
+ 0x03e3, 0x03e3,
+ 0x03e5, 0x03e5,
+ 0x03e7, 0x03e7,
+ 0x03e9, 0x03e9,
+ 0x03eb, 0x03eb,
+ 0x03ed, 0x03ed,
+ 0x03ef, 0x03f3,
+ 0x03f5, 0x03f5,
+ 0x03f8, 0x03f8,
+ 0x03fb, 0x03fc,
+ 0x0430, 0x045f,
+ 0x0461, 0x0461,
+ 0x0463, 0x0463,
+ 0x0465, 0x0465,
+ 0x0467, 0x0467,
+ 0x0469, 0x0469,
+ 0x046b, 0x046b,
+ 0x046d, 0x046d,
+ 0x046f, 0x046f,
+ 0x0471, 0x0471,
+ 0x0473, 0x0473,
+ 0x0475, 0x0475,
+ 0x0477, 0x0477,
+ 0x0479, 0x0479,
+ 0x047b, 0x047b,
+ 0x047d, 0x047d,
+ 0x047f, 0x047f,
+ 0x0481, 0x0481,
+ 0x048b, 0x048b,
+ 0x048d, 0x048d,
+ 0x048f, 0x048f,
+ 0x0491, 0x0491,
+ 0x0493, 0x0493,
+ 0x0495, 0x0495,
+ 0x0497, 0x0497,
+ 0x0499, 0x0499,
+ 0x049b, 0x049b,
+ 0x049d, 0x049d,
+ 0x049f, 0x049f,
+ 0x04a1, 0x04a1,
+ 0x04a3, 0x04a3,
+ 0x04a5, 0x04a5,
+ 0x04a7, 0x04a7,
+ 0x04a9, 0x04a9,
+ 0x04ab, 0x04ab,
+ 0x04ad, 0x04ad,
+ 0x04af, 0x04af,
+ 0x04b1, 0x04b1,
+ 0x04b3, 0x04b3,
+ 0x04b5, 0x04b5,
+ 0x04b7, 0x04b7,
+ 0x04b9, 0x04b9,
+ 0x04bb, 0x04bb,
+ 0x04bd, 0x04bd,
+ 0x04bf, 0x04bf,
+ 0x04c2, 0x04c2,
+ 0x04c4, 0x04c4,
+ 0x04c6, 0x04c6,
+ 0x04c8, 0x04c8,
+ 0x04ca, 0x04ca,
+ 0x04cc, 0x04cc,
+ 0x04ce, 0x04cf,
+ 0x04d1, 0x04d1,
+ 0x04d3, 0x04d3,
+ 0x04d5, 0x04d5,
+ 0x04d7, 0x04d7,
+ 0x04d9, 0x04d9,
+ 0x04db, 0x04db,
+ 0x04dd, 0x04dd,
+ 0x04df, 0x04df,
+ 0x04e1, 0x04e1,
+ 0x04e3, 0x04e3,
+ 0x04e5, 0x04e5,
+ 0x04e7, 0x04e7,
+ 0x04e9, 0x04e9,
+ 0x04eb, 0x04eb,
+ 0x04ed, 0x04ed,
+ 0x04ef, 0x04ef,
+ 0x04f1, 0x04f1,
+ 0x04f3, 0x04f3,
+ 0x04f5, 0x04f5,
+ 0x04f7, 0x04f7,
+ 0x04f9, 0x04f9,
+ 0x04fb, 0x04fb,
+ 0x04fd, 0x04fd,
+ 0x04ff, 0x04ff,
+ 0x0501, 0x0501,
+ 0x0503, 0x0503,
+ 0x0505, 0x0505,
+ 0x0507, 0x0507,
+ 0x0509, 0x0509,
+ 0x050b, 0x050b,
+ 0x050d, 0x050d,
+ 0x050f, 0x050f,
+ 0x0511, 0x0511,
+ 0x0513, 0x0513,
+ 0x0515, 0x0515,
+ 0x0517, 0x0517,
+ 0x0519, 0x0519,
+ 0x051b, 0x051b,
+ 0x051d, 0x051d,
+ 0x051f, 0x051f,
+ 0x0521, 0x0521,
+ 0x0523, 0x0523,
+ 0x0525, 0x0525,
+ 0x0527, 0x0527,
+ 0x0561, 0x0587,
+ 0x1d00, 0x1dbf,
+ 0x1e01, 0x1e01,
+ 0x1e03, 0x1e03,
+ 0x1e05, 0x1e05,
+ 0x1e07, 0x1e07,
+ 0x1e09, 0x1e09,
+ 0x1e0b, 0x1e0b,
+ 0x1e0d, 0x1e0d,
+ 0x1e0f, 0x1e0f,
+ 0x1e11, 0x1e11,
+ 0x1e13, 0x1e13,
+ 0x1e15, 0x1e15,
+ 0x1e17, 0x1e17,
+ 0x1e19, 0x1e19,
+ 0x1e1b, 0x1e1b,
+ 0x1e1d, 0x1e1d,
+ 0x1e1f, 0x1e1f,
+ 0x1e21, 0x1e21,
+ 0x1e23, 0x1e23,
+ 0x1e25, 0x1e25,
+ 0x1e27, 0x1e27,
+ 0x1e29, 0x1e29,
+ 0x1e2b, 0x1e2b,
+ 0x1e2d, 0x1e2d,
+ 0x1e2f, 0x1e2f,
+ 0x1e31, 0x1e31,
+ 0x1e33, 0x1e33,
+ 0x1e35, 0x1e35,
+ 0x1e37, 0x1e37,
+ 0x1e39, 0x1e39,
+ 0x1e3b, 0x1e3b,
+ 0x1e3d, 0x1e3d,
+ 0x1e3f, 0x1e3f,
+ 0x1e41, 0x1e41,
+ 0x1e43, 0x1e43,
+ 0x1e45, 0x1e45,
+ 0x1e47, 0x1e47,
+ 0x1e49, 0x1e49,
+ 0x1e4b, 0x1e4b,
+ 0x1e4d, 0x1e4d,
+ 0x1e4f, 0x1e4f,
+ 0x1e51, 0x1e51,
+ 0x1e53, 0x1e53,
+ 0x1e55, 0x1e55,
+ 0x1e57, 0x1e57,
+ 0x1e59, 0x1e59,
+ 0x1e5b, 0x1e5b,
+ 0x1e5d, 0x1e5d,
+ 0x1e5f, 0x1e5f,
+ 0x1e61, 0x1e61,
+ 0x1e63, 0x1e63,
+ 0x1e65, 0x1e65,
+ 0x1e67, 0x1e67,
+ 0x1e69, 0x1e69,
+ 0x1e6b, 0x1e6b,
+ 0x1e6d, 0x1e6d,
+ 0x1e6f, 0x1e6f,
+ 0x1e71, 0x1e71,
+ 0x1e73, 0x1e73,
+ 0x1e75, 0x1e75,
+ 0x1e77, 0x1e77,
+ 0x1e79, 0x1e79,
+ 0x1e7b, 0x1e7b,
+ 0x1e7d, 0x1e7d,
+ 0x1e7f, 0x1e7f,
+ 0x1e81, 0x1e81,
+ 0x1e83, 0x1e83,
+ 0x1e85, 0x1e85,
+ 0x1e87, 0x1e87,
+ 0x1e89, 0x1e89,
+ 0x1e8b, 0x1e8b,
+ 0x1e8d, 0x1e8d,
+ 0x1e8f, 0x1e8f,
+ 0x1e91, 0x1e91,
+ 0x1e93, 0x1e93,
+ 0x1e95, 0x1e9d,
+ 0x1e9f, 0x1e9f,
+ 0x1ea1, 0x1ea1,
+ 0x1ea3, 0x1ea3,
+ 0x1ea5, 0x1ea5,
+ 0x1ea7, 0x1ea7,
+ 0x1ea9, 0x1ea9,
+ 0x1eab, 0x1eab,
+ 0x1ead, 0x1ead,
+ 0x1eaf, 0x1eaf,
+ 0x1eb1, 0x1eb1,
+ 0x1eb3, 0x1eb3,
+ 0x1eb5, 0x1eb5,
+ 0x1eb7, 0x1eb7,
+ 0x1eb9, 0x1eb9,
+ 0x1ebb, 0x1ebb,
+ 0x1ebd, 0x1ebd,
+ 0x1ebf, 0x1ebf,
+ 0x1ec1, 0x1ec1,
+ 0x1ec3, 0x1ec3,
+ 0x1ec5, 0x1ec5,
+ 0x1ec7, 0x1ec7,
+ 0x1ec9, 0x1ec9,
+ 0x1ecb, 0x1ecb,
+ 0x1ecd, 0x1ecd,
+ 0x1ecf, 0x1ecf,
+ 0x1ed1, 0x1ed1,
+ 0x1ed3, 0x1ed3,
+ 0x1ed5, 0x1ed5,
+ 0x1ed7, 0x1ed7,
+ 0x1ed9, 0x1ed9,
+ 0x1edb, 0x1edb,
+ 0x1edd, 0x1edd,
+ 0x1edf, 0x1edf,
+ 0x1ee1, 0x1ee1,
+ 0x1ee3, 0x1ee3,
+ 0x1ee5, 0x1ee5,
+ 0x1ee7, 0x1ee7,
+ 0x1ee9, 0x1ee9,
+ 0x1eeb, 0x1eeb,
+ 0x1eed, 0x1eed,
+ 0x1eef, 0x1eef,
+ 0x1ef1, 0x1ef1,
+ 0x1ef3, 0x1ef3,
+ 0x1ef5, 0x1ef5,
+ 0x1ef7, 0x1ef7,
+ 0x1ef9, 0x1ef9,
+ 0x1efb, 0x1efb,
+ 0x1efd, 0x1efd,
+ 0x1eff, 0x1f07,
+ 0x1f10, 0x1f15,
+ 0x1f20, 0x1f27,
+ 0x1f30, 0x1f37,
+ 0x1f40, 0x1f45,
+ 0x1f50, 0x1f57,
+ 0x1f60, 0x1f67,
+ 0x1f70, 0x1f7d,
+ 0x1f80, 0x1f87,
+ 0x1f90, 0x1f97,
+ 0x1fa0, 0x1fa7,
+ 0x1fb0, 0x1fb4,
+ 0x1fb6, 0x1fb7,
+ 0x1fbe, 0x1fbe,
+ 0x1fc2, 0x1fc4,
+ 0x1fc6, 0x1fc7,
+ 0x1fd0, 0x1fd3,
+ 0x1fd6, 0x1fd7,
+ 0x1fe0, 0x1fe7,
+ 0x1ff2, 0x1ff4,
+ 0x1ff6, 0x1ff7,
+ 0x2071, 0x2071,
+ 0x207f, 0x207f,
+ 0x2090, 0x209c,
+ 0x210a, 0x210a,
+ 0x210e, 0x210f,
+ 0x2113, 0x2113,
+ 0x212f, 0x212f,
+ 0x2134, 0x2134,
+ 0x2139, 0x2139,
+ 0x213c, 0x213d,
+ 0x2146, 0x2149,
+ 0x214e, 0x214e,
+ 0x2170, 0x217f,
+ 0x2184, 0x2184,
+ 0x24d0, 0x24e9,
+ 0x2c30, 0x2c5e,
+ 0x2c61, 0x2c61,
+ 0x2c65, 0x2c66,
+ 0x2c68, 0x2c68,
+ 0x2c6a, 0x2c6a,
+ 0x2c6c, 0x2c6c,
+ 0x2c71, 0x2c71,
+ 0x2c73, 0x2c74,
+ 0x2c76, 0x2c7d,
+ 0x2c81, 0x2c81,
+ 0x2c83, 0x2c83,
+ 0x2c85, 0x2c85,
+ 0x2c87, 0x2c87,
+ 0x2c89, 0x2c89,
+ 0x2c8b, 0x2c8b,
+ 0x2c8d, 0x2c8d,
+ 0x2c8f, 0x2c8f,
+ 0x2c91, 0x2c91,
+ 0x2c93, 0x2c93,
+ 0x2c95, 0x2c95,
+ 0x2c97, 0x2c97,
+ 0x2c99, 0x2c99,
+ 0x2c9b, 0x2c9b,
+ 0x2c9d, 0x2c9d,
+ 0x2c9f, 0x2c9f,
+ 0x2ca1, 0x2ca1,
+ 0x2ca3, 0x2ca3,
+ 0x2ca5, 0x2ca5,
+ 0x2ca7, 0x2ca7,
+ 0x2ca9, 0x2ca9,
+ 0x2cab, 0x2cab,
+ 0x2cad, 0x2cad,
+ 0x2caf, 0x2caf,
+ 0x2cb1, 0x2cb1,
+ 0x2cb3, 0x2cb3,
+ 0x2cb5, 0x2cb5,
+ 0x2cb7, 0x2cb7,
+ 0x2cb9, 0x2cb9,
+ 0x2cbb, 0x2cbb,
+ 0x2cbd, 0x2cbd,
+ 0x2cbf, 0x2cbf,
+ 0x2cc1, 0x2cc1,
+ 0x2cc3, 0x2cc3,
+ 0x2cc5, 0x2cc5,
+ 0x2cc7, 0x2cc7,
+ 0x2cc9, 0x2cc9,
+ 0x2ccb, 0x2ccb,
+ 0x2ccd, 0x2ccd,
+ 0x2ccf, 0x2ccf,
+ 0x2cd1, 0x2cd1,
+ 0x2cd3, 0x2cd3,
+ 0x2cd5, 0x2cd5,
+ 0x2cd7, 0x2cd7,
+ 0x2cd9, 0x2cd9,
+ 0x2cdb, 0x2cdb,
+ 0x2cdd, 0x2cdd,
+ 0x2cdf, 0x2cdf,
+ 0x2ce1, 0x2ce1,
+ 0x2ce3, 0x2ce4,
+ 0x2cec, 0x2cec,
+ 0x2cee, 0x2cee,
+ 0x2cf3, 0x2cf3,
+ 0x2d00, 0x2d25,
+ 0x2d27, 0x2d27,
+ 0x2d2d, 0x2d2d,
+ 0xa641, 0xa641,
+ 0xa643, 0xa643,
+ 0xa645, 0xa645,
+ 0xa647, 0xa647,
+ 0xa649, 0xa649,
+ 0xa64b, 0xa64b,
+ 0xa64d, 0xa64d,
+ 0xa64f, 0xa64f,
+ 0xa651, 0xa651,
+ 0xa653, 0xa653,
+ 0xa655, 0xa655,
+ 0xa657, 0xa657,
+ 0xa659, 0xa659,
+ 0xa65b, 0xa65b,
+ 0xa65d, 0xa65d,
+ 0xa65f, 0xa65f,
+ 0xa661, 0xa661,
+ 0xa663, 0xa663,
+ 0xa665, 0xa665,
+ 0xa667, 0xa667,
+ 0xa669, 0xa669,
+ 0xa66b, 0xa66b,
+ 0xa66d, 0xa66d,
+ 0xa681, 0xa681,
+ 0xa683, 0xa683,
+ 0xa685, 0xa685,
+ 0xa687, 0xa687,
+ 0xa689, 0xa689,
+ 0xa68b, 0xa68b,
+ 0xa68d, 0xa68d,
+ 0xa68f, 0xa68f,
+ 0xa691, 0xa691,
+ 0xa693, 0xa693,
+ 0xa695, 0xa695,
+ 0xa697, 0xa697,
+ 0xa723, 0xa723,
+ 0xa725, 0xa725,
+ 0xa727, 0xa727,
+ 0xa729, 0xa729,
+ 0xa72b, 0xa72b,
+ 0xa72d, 0xa72d,
+ 0xa72f, 0xa731,
+ 0xa733, 0xa733,
+ 0xa735, 0xa735,
+ 0xa737, 0xa737,
+ 0xa739, 0xa739,
+ 0xa73b, 0xa73b,
+ 0xa73d, 0xa73d,
+ 0xa73f, 0xa73f,
+ 0xa741, 0xa741,
+ 0xa743, 0xa743,
+ 0xa745, 0xa745,
+ 0xa747, 0xa747,
+ 0xa749, 0xa749,
+ 0xa74b, 0xa74b,
+ 0xa74d, 0xa74d,
+ 0xa74f, 0xa74f,
+ 0xa751, 0xa751,
+ 0xa753, 0xa753,
+ 0xa755, 0xa755,
+ 0xa757, 0xa757,
+ 0xa759, 0xa759,
+ 0xa75b, 0xa75b,
+ 0xa75d, 0xa75d,
+ 0xa75f, 0xa75f,
+ 0xa761, 0xa761,
+ 0xa763, 0xa763,
+ 0xa765, 0xa765,
+ 0xa767, 0xa767,
+ 0xa769, 0xa769,
+ 0xa76b, 0xa76b,
+ 0xa76d, 0xa76d,
+ 0xa76f, 0xa778,
+ 0xa77a, 0xa77a,
+ 0xa77c, 0xa77c,
+ 0xa77f, 0xa77f,
+ 0xa781, 0xa781,
+ 0xa783, 0xa783,
+ 0xa785, 0xa785,
+ 0xa787, 0xa787,
+ 0xa78c, 0xa78c,
+ 0xa78e, 0xa78e,
+ 0xa791, 0xa791,
+ 0xa793, 0xa793,
+ 0xa7a1, 0xa7a1,
+ 0xa7a3, 0xa7a3,
+ 0xa7a5, 0xa7a5,
+ 0xa7a7, 0xa7a7,
+ 0xa7a9, 0xa7a9,
+ 0xa7f8, 0xa7fa,
+ 0xfb00, 0xfb06,
+ 0xfb13, 0xfb17,
+ 0xff41, 0xff5a,
+ 0x10428, 0x1044f,
+ 0x1d41a, 0x1d433,
+ 0x1d44e, 0x1d454,
+ 0x1d456, 0x1d467,
+ 0x1d482, 0x1d49b,
+ 0x1d4b6, 0x1d4b9,
+ 0x1d4bb, 0x1d4bb,
+ 0x1d4bd, 0x1d4c3,
+ 0x1d4c5, 0x1d4cf,
+ 0x1d4ea, 0x1d503,
+ 0x1d51e, 0x1d537,
+ 0x1d552, 0x1d56b,
+ 0x1d586, 0x1d59f,
+ 0x1d5ba, 0x1d5d3,
+ 0x1d5ee, 0x1d607,
+ 0x1d622, 0x1d63b,
+ 0x1d656, 0x1d66f,
+ 0x1d68a, 0x1d6a5,
+ 0x1d6c2, 0x1d6da,
+ 0x1d6dc, 0x1d6e1,
+ 0x1d6fc, 0x1d714,
+ 0x1d716, 0x1d71b,
+ 0x1d736, 0x1d74e,
+ 0x1d750, 0x1d755,
+ 0x1d770, 0x1d788,
+ 0x1d78a, 0x1d78f,
+ 0x1d7aa, 0x1d7c2,
+ 0x1d7c4, 0x1d7c9,
+ 0x1d7cb, 0x1d7cb,
+}; /* CR_Lower */
+
+/* 'Print': [[:Print:]] */
+static const OnigCodePoint CR_Print[] = {
+ 541,
+ 0x0020, 0x007e,
+ 0x00a0, 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, 0x2027,
+ 0x202a, 0x2064,
+ 0x206a, 0x2071,
+ 0x2074, 0x208e,
+ 0x2090, 0x209c,
+ 0x20a0, 0x20b9,
+ 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,
+ 0xe000, 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,
+ 0xfdf0, 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, 0xfffd,
+ 0x10000, 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,
+ 0x20000, 0x2a6d6,
+ 0x2a700, 0x2b734,
+ 0x2b740, 0x2b81d,
+ 0x2f800, 0x2fa1d,
+ 0xe0001, 0xe0001,
+ 0xe0020, 0xe007f,
+ 0xe0100, 0xe01ef,
+ 0xf0000, 0xffffd,
+ 0x100000, 0x10fffd,
+}; /* CR_Print */
+
+/* 'Punct': [[:Punct:]] */
+static const OnigCodePoint CR_Punct[] = {
+ 140,
+ 0x0021, 0x0023,
+ 0x0025, 0x002a,
+ 0x002c, 0x002f,
+ 0x003a, 0x003b,
+ 0x003f, 0x0040,
+ 0x005b, 0x005d,
+ 0x005f, 0x005f,
+ 0x007b, 0x007b,
+ 0x007d, 0x007d,
+ 0x00a1, 0x00a1,
+ 0x00a7, 0x00a7,
+ 0x00ab, 0x00ab,
+ 0x00b6, 0x00b7,
+ 0x00bb, 0x00bb,
+ 0x00bf, 0x00bf,
+ 0x037e, 0x037e,
+ 0x0387, 0x0387,
+ 0x055a, 0x055f,
+ 0x0589, 0x058a,
+ 0x05be, 0x05be,
+ 0x05c0, 0x05c0,
+ 0x05c3, 0x05c3,
+ 0x05c6, 0x05c6,
+ 0x05f3, 0x05f4,
+ 0x0609, 0x060a,
+ 0x060c, 0x060d,
+ 0x061b, 0x061b,
+ 0x061e, 0x061f,
+ 0x066a, 0x066d,
+ 0x06d4, 0x06d4,
+ 0x0700, 0x070d,
+ 0x07f7, 0x07f9,
+ 0x0830, 0x083e,
+ 0x085e, 0x085e,
+ 0x0964, 0x0965,
+ 0x0970, 0x0970,
+ 0x0af0, 0x0af0,
+ 0x0df4, 0x0df4,
+ 0x0e4f, 0x0e4f,
+ 0x0e5a, 0x0e5b,
+ 0x0f04, 0x0f12,
+ 0x0f14, 0x0f14,
+ 0x0f3a, 0x0f3d,
+ 0x0f85, 0x0f85,
+ 0x0fd0, 0x0fd4,
+ 0x0fd9, 0x0fda,
+ 0x104a, 0x104f,
+ 0x10fb, 0x10fb,
+ 0x1360, 0x1368,
+ 0x1400, 0x1400,
+ 0x166d, 0x166e,
+ 0x169b, 0x169c,
+ 0x16eb, 0x16ed,
+ 0x1735, 0x1736,
+ 0x17d4, 0x17d6,
+ 0x17d8, 0x17da,
+ 0x1800, 0x180a,
+ 0x1944, 0x1945,
+ 0x1a1e, 0x1a1f,
+ 0x1aa0, 0x1aa6,
+ 0x1aa8, 0x1aad,
+ 0x1b5a, 0x1b60,
+ 0x1bfc, 0x1bff,
+ 0x1c3b, 0x1c3f,
+ 0x1c7e, 0x1c7f,
+ 0x1cc0, 0x1cc7,
+ 0x1cd3, 0x1cd3,
+ 0x2010, 0x2027,
+ 0x2030, 0x2043,
+ 0x2045, 0x2051,
+ 0x2053, 0x205e,
+ 0x207d, 0x207e,
+ 0x208d, 0x208e,
+ 0x2329, 0x232a,
+ 0x2768, 0x2775,
+ 0x27c5, 0x27c6,
+ 0x27e6, 0x27ef,
+ 0x2983, 0x2998,
+ 0x29d8, 0x29db,
+ 0x29fc, 0x29fd,
+ 0x2cf9, 0x2cfc,
+ 0x2cfe, 0x2cff,
+ 0x2d70, 0x2d70,
+ 0x2e00, 0x2e2e,
+ 0x2e30, 0x2e3b,
+ 0x3001, 0x3003,
+ 0x3008, 0x3011,
+ 0x3014, 0x301f,
+ 0x3030, 0x3030,
+ 0x303d, 0x303d,
+ 0x30a0, 0x30a0,
+ 0x30fb, 0x30fb,
+ 0xa4fe, 0xa4ff,
+ 0xa60d, 0xa60f,
+ 0xa673, 0xa673,
+ 0xa67e, 0xa67e,
+ 0xa6f2, 0xa6f7,
+ 0xa874, 0xa877,
+ 0xa8ce, 0xa8cf,
+ 0xa8f8, 0xa8fa,
+ 0xa92e, 0xa92f,
+ 0xa95f, 0xa95f,
+ 0xa9c1, 0xa9cd,
+ 0xa9de, 0xa9df,
+ 0xaa5c, 0xaa5f,
+ 0xaade, 0xaadf,
+ 0xaaf0, 0xaaf1,
+ 0xabeb, 0xabeb,
+ 0xfd3e, 0xfd3f,
+ 0xfe10, 0xfe19,
+ 0xfe30, 0xfe52,
+ 0xfe54, 0xfe61,
+ 0xfe63, 0xfe63,
+ 0xfe68, 0xfe68,
+ 0xfe6a, 0xfe6b,
+ 0xff01, 0xff03,
+ 0xff05, 0xff0a,
+ 0xff0c, 0xff0f,
+ 0xff1a, 0xff1b,
+ 0xff1f, 0xff20,
+ 0xff3b, 0xff3d,
+ 0xff3f, 0xff3f,
+ 0xff5b, 0xff5b,
+ 0xff5d, 0xff5d,
+ 0xff5f, 0xff65,
+ 0x10100, 0x10102,
+ 0x1039f, 0x1039f,
+ 0x103d0, 0x103d0,
+ 0x10857, 0x10857,
+ 0x1091f, 0x1091f,
+ 0x1093f, 0x1093f,
+ 0x10a50, 0x10a58,
+ 0x10a7f, 0x10a7f,
+ 0x10b39, 0x10b3f,
+ 0x11047, 0x1104d,
+ 0x110bb, 0x110bc,
+ 0x110be, 0x110c1,
+ 0x11140, 0x11143,
+ 0x111c5, 0x111c8,
+ 0x12470, 0x12473,
+}; /* CR_Punct */
+
+/* 'Space': [[:Space:]] */
+static const OnigCodePoint CR_Space[] = {
+ 11,
+ 0x0009, 0x000d,
+ 0x0020, 0x0020,
+ 0x0085, 0x0085,
+ 0x00a0, 0x00a0,
+ 0x1680, 0x1680,
+ 0x180e, 0x180e,
+ 0x2000, 0x200a,
+ 0x2028, 0x2029,
+ 0x202f, 0x202f,
+ 0x205f, 0x205f,
+ 0x3000, 0x3000,
+}; /* CR_Space */
+
+/* 'Upper': [[:Upper:]] */
+static const OnigCodePoint CR_Upper[] = {
+ 610,
+ 0x0041, 0x005a,
+ 0x00c0, 0x00d6,
+ 0x00d8, 0x00de,
+ 0x0100, 0x0100,
+ 0x0102, 0x0102,
+ 0x0104, 0x0104,
+ 0x0106, 0x0106,
+ 0x0108, 0x0108,
+ 0x010a, 0x010a,
+ 0x010c, 0x010c,
+ 0x010e, 0x010e,
+ 0x0110, 0x0110,
+ 0x0112, 0x0112,
+ 0x0114, 0x0114,
+ 0x0116, 0x0116,
+ 0x0118, 0x0118,
+ 0x011a, 0x011a,
+ 0x011c, 0x011c,
+ 0x011e, 0x011e,
+ 0x0120, 0x0120,
+ 0x0122, 0x0122,
+ 0x0124, 0x0124,
+ 0x0126, 0x0126,
+ 0x0128, 0x0128,
+ 0x012a, 0x012a,
+ 0x012c, 0x012c,
+ 0x012e, 0x012e,
+ 0x0130, 0x0130,
+ 0x0132, 0x0132,
+ 0x0134, 0x0134,
+ 0x0136, 0x0136,
+ 0x0139, 0x0139,
+ 0x013b, 0x013b,
+ 0x013d, 0x013d,
+ 0x013f, 0x013f,
+ 0x0141, 0x0141,
+ 0x0143, 0x0143,
+ 0x0145, 0x0145,
+ 0x0147, 0x0147,
+ 0x014a, 0x014a,
+ 0x014c, 0x014c,
+ 0x014e, 0x014e,
+ 0x0150, 0x0150,
+ 0x0152, 0x0152,
+ 0x0154, 0x0154,
+ 0x0156, 0x0156,
+ 0x0158, 0x0158,
+ 0x015a, 0x015a,
+ 0x015c, 0x015c,
+ 0x015e, 0x015e,
+ 0x0160, 0x0160,
+ 0x0162, 0x0162,
+ 0x0164, 0x0164,
+ 0x0166, 0x0166,
+ 0x0168, 0x0168,
+ 0x016a, 0x016a,
+ 0x016c, 0x016c,
+ 0x016e, 0x016e,
+ 0x0170, 0x0170,
+ 0x0172, 0x0172,
+ 0x0174, 0x0174,
+ 0x0176, 0x0176,
+ 0x0178, 0x0179,
+ 0x017b, 0x017b,
+ 0x017d, 0x017d,
+ 0x0181, 0x0182,
+ 0x0184, 0x0184,
+ 0x0186, 0x0187,
+ 0x0189, 0x018b,
+ 0x018e, 0x0191,
+ 0x0193, 0x0194,
+ 0x0196, 0x0198,
+ 0x019c, 0x019d,
+ 0x019f, 0x01a0,
+ 0x01a2, 0x01a2,
+ 0x01a4, 0x01a4,
+ 0x01a6, 0x01a7,
+ 0x01a9, 0x01a9,
+ 0x01ac, 0x01ac,
+ 0x01ae, 0x01af,
+ 0x01b1, 0x01b3,
+ 0x01b5, 0x01b5,
+ 0x01b7, 0x01b8,
+ 0x01bc, 0x01bc,
+ 0x01c4, 0x01c4,
+ 0x01c7, 0x01c7,
+ 0x01ca, 0x01ca,
+ 0x01cd, 0x01cd,
+ 0x01cf, 0x01cf,
+ 0x01d1, 0x01d1,
+ 0x01d3, 0x01d3,
+ 0x01d5, 0x01d5,
+ 0x01d7, 0x01d7,
+ 0x01d9, 0x01d9,
+ 0x01db, 0x01db,
+ 0x01de, 0x01de,
+ 0x01e0, 0x01e0,
+ 0x01e2, 0x01e2,
+ 0x01e4, 0x01e4,
+ 0x01e6, 0x01e6,
+ 0x01e8, 0x01e8,
+ 0x01ea, 0x01ea,
+ 0x01ec, 0x01ec,
+ 0x01ee, 0x01ee,
+ 0x01f1, 0x01f1,
+ 0x01f4, 0x01f4,
+ 0x01f6, 0x01f8,
+ 0x01fa, 0x01fa,
+ 0x01fc, 0x01fc,
+ 0x01fe, 0x01fe,
+ 0x0200, 0x0200,
+ 0x0202, 0x0202,
+ 0x0204, 0x0204,
+ 0x0206, 0x0206,
+ 0x0208, 0x0208,
+ 0x020a, 0x020a,
+ 0x020c, 0x020c,
+ 0x020e, 0x020e,
+ 0x0210, 0x0210,
+ 0x0212, 0x0212,
+ 0x0214, 0x0214,
+ 0x0216, 0x0216,
+ 0x0218, 0x0218,
+ 0x021a, 0x021a,
+ 0x021c, 0x021c,
+ 0x021e, 0x021e,
+ 0x0220, 0x0220,
+ 0x0222, 0x0222,
+ 0x0224, 0x0224,
+ 0x0226, 0x0226,
+ 0x0228, 0x0228,
+ 0x022a, 0x022a,
+ 0x022c, 0x022c,
+ 0x022e, 0x022e,
+ 0x0230, 0x0230,
+ 0x0232, 0x0232,
+ 0x023a, 0x023b,
+ 0x023d, 0x023e,
+ 0x0241, 0x0241,
+ 0x0243, 0x0246,
+ 0x0248, 0x0248,
+ 0x024a, 0x024a,
+ 0x024c, 0x024c,
+ 0x024e, 0x024e,
+ 0x0370, 0x0370,
+ 0x0372, 0x0372,
+ 0x0376, 0x0376,
+ 0x0386, 0x0386,
+ 0x0388, 0x038a,
+ 0x038c, 0x038c,
+ 0x038e, 0x038f,
+ 0x0391, 0x03a1,
+ 0x03a3, 0x03ab,
+ 0x03cf, 0x03cf,
+ 0x03d2, 0x03d4,
+ 0x03d8, 0x03d8,
+ 0x03da, 0x03da,
+ 0x03dc, 0x03dc,
+ 0x03de, 0x03de,
+ 0x03e0, 0x03e0,
+ 0x03e2, 0x03e2,
+ 0x03e4, 0x03e4,
+ 0x03e6, 0x03e6,
+ 0x03e8, 0x03e8,
+ 0x03ea, 0x03ea,
+ 0x03ec, 0x03ec,
+ 0x03ee, 0x03ee,
+ 0x03f4, 0x03f4,
+ 0x03f7, 0x03f7,
+ 0x03f9, 0x03fa,
+ 0x03fd, 0x042f,
+ 0x0460, 0x0460,
+ 0x0462, 0x0462,
+ 0x0464, 0x0464,
+ 0x0466, 0x0466,
+ 0x0468, 0x0468,
+ 0x046a, 0x046a,
+ 0x046c, 0x046c,
+ 0x046e, 0x046e,
+ 0x0470, 0x0470,
+ 0x0472, 0x0472,
+ 0x0474, 0x0474,
+ 0x0476, 0x0476,
+ 0x0478, 0x0478,
+ 0x047a, 0x047a,
+ 0x047c, 0x047c,
+ 0x047e, 0x047e,
+ 0x0480, 0x0480,
+ 0x048a, 0x048a,
+ 0x048c, 0x048c,
+ 0x048e, 0x048e,
+ 0x0490, 0x0490,
+ 0x0492, 0x0492,
+ 0x0494, 0x0494,
+ 0x0496, 0x0496,
+ 0x0498, 0x0498,
+ 0x049a, 0x049a,
+ 0x049c, 0x049c,
+ 0x049e, 0x049e,
+ 0x04a0, 0x04a0,
+ 0x04a2, 0x04a2,
+ 0x04a4, 0x04a4,
+ 0x04a6, 0x04a6,
+ 0x04a8, 0x04a8,
+ 0x04aa, 0x04aa,
+ 0x04ac, 0x04ac,
+ 0x04ae, 0x04ae,
+ 0x04b0, 0x04b0,
+ 0x04b2, 0x04b2,
+ 0x04b4, 0x04b4,
+ 0x04b6, 0x04b6,
+ 0x04b8, 0x04b8,
+ 0x04ba, 0x04ba,
+ 0x04bc, 0x04bc,
+ 0x04be, 0x04be,
+ 0x04c0, 0x04c1,
+ 0x04c3, 0x04c3,
+ 0x04c5, 0x04c5,
+ 0x04c7, 0x04c7,
+ 0x04c9, 0x04c9,
+ 0x04cb, 0x04cb,
+ 0x04cd, 0x04cd,
+ 0x04d0, 0x04d0,
+ 0x04d2, 0x04d2,
+ 0x04d4, 0x04d4,
+ 0x04d6, 0x04d6,
+ 0x04d8, 0x04d8,
+ 0x04da, 0x04da,
+ 0x04dc, 0x04dc,
+ 0x04de, 0x04de,
+ 0x04e0, 0x04e0,
+ 0x04e2, 0x04e2,
+ 0x04e4, 0x04e4,
+ 0x04e6, 0x04e6,
+ 0x04e8, 0x04e8,
+ 0x04ea, 0x04ea,
+ 0x04ec, 0x04ec,
+ 0x04ee, 0x04ee,
+ 0x04f0, 0x04f0,
+ 0x04f2, 0x04f2,
+ 0x04f4, 0x04f4,
+ 0x04f6, 0x04f6,
+ 0x04f8, 0x04f8,
+ 0x04fa, 0x04fa,
+ 0x04fc, 0x04fc,
+ 0x04fe, 0x04fe,
+ 0x0500, 0x0500,
+ 0x0502, 0x0502,
+ 0x0504, 0x0504,
+ 0x0506, 0x0506,
+ 0x0508, 0x0508,
+ 0x050a, 0x050a,
+ 0x050c, 0x050c,
+ 0x050e, 0x050e,
+ 0x0510, 0x0510,
+ 0x0512, 0x0512,
+ 0x0514, 0x0514,
+ 0x0516, 0x0516,
+ 0x0518, 0x0518,
+ 0x051a, 0x051a,
+ 0x051c, 0x051c,
+ 0x051e, 0x051e,
+ 0x0520, 0x0520,
+ 0x0522, 0x0522,
+ 0x0524, 0x0524,
+ 0x0526, 0x0526,
+ 0x0531, 0x0556,
+ 0x10a0, 0x10c5,
+ 0x10c7, 0x10c7,
+ 0x10cd, 0x10cd,
+ 0x1e00, 0x1e00,
+ 0x1e02, 0x1e02,
+ 0x1e04, 0x1e04,
+ 0x1e06, 0x1e06,
+ 0x1e08, 0x1e08,
+ 0x1e0a, 0x1e0a,
+ 0x1e0c, 0x1e0c,
+ 0x1e0e, 0x1e0e,
+ 0x1e10, 0x1e10,
+ 0x1e12, 0x1e12,
+ 0x1e14, 0x1e14,
+ 0x1e16, 0x1e16,
+ 0x1e18, 0x1e18,
+ 0x1e1a, 0x1e1a,
+ 0x1e1c, 0x1e1c,
+ 0x1e1e, 0x1e1e,
+ 0x1e20, 0x1e20,
+ 0x1e22, 0x1e22,
+ 0x1e24, 0x1e24,
+ 0x1e26, 0x1e26,
+ 0x1e28, 0x1e28,
+ 0x1e2a, 0x1e2a,
+ 0x1e2c, 0x1e2c,
+ 0x1e2e, 0x1e2e,
+ 0x1e30, 0x1e30,
+ 0x1e32, 0x1e32,
+ 0x1e34, 0x1e34,
+ 0x1e36, 0x1e36,
+ 0x1e38, 0x1e38,
+ 0x1e3a, 0x1e3a,
+ 0x1e3c, 0x1e3c,
+ 0x1e3e, 0x1e3e,
+ 0x1e40, 0x1e40,
+ 0x1e42, 0x1e42,
+ 0x1e44, 0x1e44,
+ 0x1e46, 0x1e46,
+ 0x1e48, 0x1e48,
+ 0x1e4a, 0x1e4a,
+ 0x1e4c, 0x1e4c,
+ 0x1e4e, 0x1e4e,
+ 0x1e50, 0x1e50,
+ 0x1e52, 0x1e52,
+ 0x1e54, 0x1e54,
+ 0x1e56, 0x1e56,
+ 0x1e58, 0x1e58,
+ 0x1e5a, 0x1e5a,
+ 0x1e5c, 0x1e5c,
+ 0x1e5e, 0x1e5e,
+ 0x1e60, 0x1e60,
+ 0x1e62, 0x1e62,
+ 0x1e64, 0x1e64,
+ 0x1e66, 0x1e66,
+ 0x1e68, 0x1e68,
+ 0x1e6a, 0x1e6a,
+ 0x1e6c, 0x1e6c,
+ 0x1e6e, 0x1e6e,
+ 0x1e70, 0x1e70,
+ 0x1e72, 0x1e72,
+ 0x1e74, 0x1e74,
+ 0x1e76, 0x1e76,
+ 0x1e78, 0x1e78,
+ 0x1e7a, 0x1e7a,
+ 0x1e7c, 0x1e7c,
+ 0x1e7e, 0x1e7e,
+ 0x1e80, 0x1e80,
+ 0x1e82, 0x1e82,
+ 0x1e84, 0x1e84,
+ 0x1e86, 0x1e86,
+ 0x1e88, 0x1e88,
+ 0x1e8a, 0x1e8a,
+ 0x1e8c, 0x1e8c,
+ 0x1e8e, 0x1e8e,
+ 0x1e90, 0x1e90,
+ 0x1e92, 0x1e92,
+ 0x1e94, 0x1e94,
+ 0x1e9e, 0x1e9e,
+ 0x1ea0, 0x1ea0,
+ 0x1ea2, 0x1ea2,
+ 0x1ea4, 0x1ea4,
+ 0x1ea6, 0x1ea6,
+ 0x1ea8, 0x1ea8,
+ 0x1eaa, 0x1eaa,
+ 0x1eac, 0x1eac,
+ 0x1eae, 0x1eae,
+ 0x1eb0, 0x1eb0,
+ 0x1eb2, 0x1eb2,
+ 0x1eb4, 0x1eb4,
+ 0x1eb6, 0x1eb6,
+ 0x1eb8, 0x1eb8,
+ 0x1eba, 0x1eba,
+ 0x1ebc, 0x1ebc,
+ 0x1ebe, 0x1ebe,
+ 0x1ec0, 0x1ec0,
+ 0x1ec2, 0x1ec2,
+ 0x1ec4, 0x1ec4,
+ 0x1ec6, 0x1ec6,
+ 0x1ec8, 0x1ec8,
+ 0x1eca, 0x1eca,
+ 0x1ecc, 0x1ecc,
+ 0x1ece, 0x1ece,
+ 0x1ed0, 0x1ed0,
+ 0x1ed2, 0x1ed2,
+ 0x1ed4, 0x1ed4,
+ 0x1ed6, 0x1ed6,
+ 0x1ed8, 0x1ed8,
+ 0x1eda, 0x1eda,
+ 0x1edc, 0x1edc,
+ 0x1ede, 0x1ede,
+ 0x1ee0, 0x1ee0,
+ 0x1ee2, 0x1ee2,
+ 0x1ee4, 0x1ee4,
+ 0x1ee6, 0x1ee6,
+ 0x1ee8, 0x1ee8,
+ 0x1eea, 0x1eea,
+ 0x1eec, 0x1eec,
+ 0x1eee, 0x1eee,
+ 0x1ef0, 0x1ef0,
+ 0x1ef2, 0x1ef2,
+ 0x1ef4, 0x1ef4,
+ 0x1ef6, 0x1ef6,
+ 0x1ef8, 0x1ef8,
+ 0x1efa, 0x1efa,
+ 0x1efc, 0x1efc,
+ 0x1efe, 0x1efe,
+ 0x1f08, 0x1f0f,
+ 0x1f18, 0x1f1d,
+ 0x1f28, 0x1f2f,
+ 0x1f38, 0x1f3f,
+ 0x1f48, 0x1f4d,
+ 0x1f59, 0x1f59,
+ 0x1f5b, 0x1f5b,
+ 0x1f5d, 0x1f5d,
+ 0x1f5f, 0x1f5f,
+ 0x1f68, 0x1f6f,
+ 0x1fb8, 0x1fbb,
+ 0x1fc8, 0x1fcb,
+ 0x1fd8, 0x1fdb,
+ 0x1fe8, 0x1fec,
+ 0x1ff8, 0x1ffb,
+ 0x2102, 0x2102,
+ 0x2107, 0x2107,
+ 0x210b, 0x210d,
+ 0x2110, 0x2112,
+ 0x2115, 0x2115,
+ 0x2119, 0x211d,
+ 0x2124, 0x2124,
+ 0x2126, 0x2126,
+ 0x2128, 0x2128,
+ 0x212a, 0x212d,
+ 0x2130, 0x2133,
+ 0x213e, 0x213f,
+ 0x2145, 0x2145,
+ 0x2160, 0x216f,
+ 0x2183, 0x2183,
+ 0x24b6, 0x24cf,
+ 0x2c00, 0x2c2e,
+ 0x2c60, 0x2c60,
+ 0x2c62, 0x2c64,
+ 0x2c67, 0x2c67,
+ 0x2c69, 0x2c69,
+ 0x2c6b, 0x2c6b,
+ 0x2c6d, 0x2c70,
+ 0x2c72, 0x2c72,
+ 0x2c75, 0x2c75,
+ 0x2c7e, 0x2c80,
+ 0x2c82, 0x2c82,
+ 0x2c84, 0x2c84,
+ 0x2c86, 0x2c86,
+ 0x2c88, 0x2c88,
+ 0x2c8a, 0x2c8a,
+ 0x2c8c, 0x2c8c,
+ 0x2c8e, 0x2c8e,
+ 0x2c90, 0x2c90,
+ 0x2c92, 0x2c92,
+ 0x2c94, 0x2c94,
+ 0x2c96, 0x2c96,
+ 0x2c98, 0x2c98,
+ 0x2c9a, 0x2c9a,
+ 0x2c9c, 0x2c9c,
+ 0x2c9e, 0x2c9e,
+ 0x2ca0, 0x2ca0,
+ 0x2ca2, 0x2ca2,
+ 0x2ca4, 0x2ca4,
+ 0x2ca6, 0x2ca6,
+ 0x2ca8, 0x2ca8,
+ 0x2caa, 0x2caa,
+ 0x2cac, 0x2cac,
+ 0x2cae, 0x2cae,
+ 0x2cb0, 0x2cb0,
+ 0x2cb2, 0x2cb2,
+ 0x2cb4, 0x2cb4,
+ 0x2cb6, 0x2cb6,
+ 0x2cb8, 0x2cb8,
+ 0x2cba, 0x2cba,
+ 0x2cbc, 0x2cbc,
+ 0x2cbe, 0x2cbe,
+ 0x2cc0, 0x2cc0,
+ 0x2cc2, 0x2cc2,
+ 0x2cc4, 0x2cc4,
+ 0x2cc6, 0x2cc6,
+ 0x2cc8, 0x2cc8,
+ 0x2cca, 0x2cca,
+ 0x2ccc, 0x2ccc,
+ 0x2cce, 0x2cce,
+ 0x2cd0, 0x2cd0,
+ 0x2cd2, 0x2cd2,
+ 0x2cd4, 0x2cd4,
+ 0x2cd6, 0x2cd6,
+ 0x2cd8, 0x2cd8,
+ 0x2cda, 0x2cda,
+ 0x2cdc, 0x2cdc,
+ 0x2cde, 0x2cde,
+ 0x2ce0, 0x2ce0,
+ 0x2ce2, 0x2ce2,
+ 0x2ceb, 0x2ceb,
+ 0x2ced, 0x2ced,
+ 0x2cf2, 0x2cf2,
+ 0xa640, 0xa640,
+ 0xa642, 0xa642,
+ 0xa644, 0xa644,
+ 0xa646, 0xa646,
+ 0xa648, 0xa648,
+ 0xa64a, 0xa64a,
+ 0xa64c, 0xa64c,
+ 0xa64e, 0xa64e,
+ 0xa650, 0xa650,
+ 0xa652, 0xa652,
+ 0xa654, 0xa654,
+ 0xa656, 0xa656,
+ 0xa658, 0xa658,
+ 0xa65a, 0xa65a,
+ 0xa65c, 0xa65c,
+ 0xa65e, 0xa65e,
+ 0xa660, 0xa660,
+ 0xa662, 0xa662,
+ 0xa664, 0xa664,
+ 0xa666, 0xa666,
+ 0xa668, 0xa668,
+ 0xa66a, 0xa66a,
+ 0xa66c, 0xa66c,
+ 0xa680, 0xa680,
+ 0xa682, 0xa682,
+ 0xa684, 0xa684,
+ 0xa686, 0xa686,
+ 0xa688, 0xa688,
+ 0xa68a, 0xa68a,
+ 0xa68c, 0xa68c,
+ 0xa68e, 0xa68e,
+ 0xa690, 0xa690,
+ 0xa692, 0xa692,
+ 0xa694, 0xa694,
+ 0xa696, 0xa696,
+ 0xa722, 0xa722,
+ 0xa724, 0xa724,
+ 0xa726, 0xa726,
+ 0xa728, 0xa728,
+ 0xa72a, 0xa72a,
+ 0xa72c, 0xa72c,
+ 0xa72e, 0xa72e,
+ 0xa732, 0xa732,
+ 0xa734, 0xa734,
+ 0xa736, 0xa736,
+ 0xa738, 0xa738,
+ 0xa73a, 0xa73a,
+ 0xa73c, 0xa73c,
+ 0xa73e, 0xa73e,
+ 0xa740, 0xa740,
+ 0xa742, 0xa742,
+ 0xa744, 0xa744,
+ 0xa746, 0xa746,
+ 0xa748, 0xa748,
+ 0xa74a, 0xa74a,
+ 0xa74c, 0xa74c,
+ 0xa74e, 0xa74e,
+ 0xa750, 0xa750,
+ 0xa752, 0xa752,
+ 0xa754, 0xa754,
+ 0xa756, 0xa756,
+ 0xa758, 0xa758,
+ 0xa75a, 0xa75a,
+ 0xa75c, 0xa75c,
+ 0xa75e, 0xa75e,
+ 0xa760, 0xa760,
+ 0xa762, 0xa762,
+ 0xa764, 0xa764,
+ 0xa766, 0xa766,
+ 0xa768, 0xa768,
+ 0xa76a, 0xa76a,
+ 0xa76c, 0xa76c,
+ 0xa76e, 0xa76e,
+ 0xa779, 0xa779,
+ 0xa77b, 0xa77b,
+ 0xa77d, 0xa77e,
+ 0xa780, 0xa780,
+ 0xa782, 0xa782,
+ 0xa784, 0xa784,
+ 0xa786, 0xa786,
+ 0xa78b, 0xa78b,
+ 0xa78d, 0xa78d,
+ 0xa790, 0xa790,
+ 0xa792, 0xa792,
+ 0xa7a0, 0xa7a0,
+ 0xa7a2, 0xa7a2,
+ 0xa7a4, 0xa7a4,
+ 0xa7a6, 0xa7a6,
+ 0xa7a8, 0xa7a8,
+ 0xa7aa, 0xa7aa,
+ 0xff21, 0xff3a,
+ 0x10400, 0x10427,
+ 0x1d400, 0x1d419,
+ 0x1d434, 0x1d44d,
+ 0x1d468, 0x1d481,
+ 0x1d49c, 0x1d49c,
+ 0x1d49e, 0x1d49f,
+ 0x1d4a2, 0x1d4a2,
+ 0x1d4a5, 0x1d4a6,
+ 0x1d4a9, 0x1d4ac,
+ 0x1d4ae, 0x1d4b5,
+ 0x1d4d0, 0x1d4e9,
+ 0x1d504, 0x1d505,
+ 0x1d507, 0x1d50a,
+ 0x1d50d, 0x1d514,
+ 0x1d516, 0x1d51c,
+ 0x1d538, 0x1d539,
+ 0x1d53b, 0x1d53e,
+ 0x1d540, 0x1d544,
+ 0x1d546, 0x1d546,
+ 0x1d54a, 0x1d550,
+ 0x1d56c, 0x1d585,
+ 0x1d5a0, 0x1d5b9,
+ 0x1d5d4, 0x1d5ed,
+ 0x1d608, 0x1d621,
+ 0x1d63c, 0x1d655,
+ 0x1d670, 0x1d689,
+ 0x1d6a8, 0x1d6c0,
+ 0x1d6e2, 0x1d6fa,
+ 0x1d71c, 0x1d734,
+ 0x1d756, 0x1d76e,
+ 0x1d790, 0x1d7a8,
+ 0x1d7ca, 0x1d7ca,
+}; /* CR_Upper */
+
+/* 'XDigit': [[:XDigit:]] */
+static const OnigCodePoint CR_XDigit[] = {
+ 3,
+ 0x0030, 0x0039,
+ 0x0041, 0x0046,
+ 0x0061, 0x0066,
+}; /* CR_XDigit */
+
+/* 'Word': [[:Word:]] */
+static const OnigCodePoint CR_Word[] = {
+ 564,
+ 0x0030, 0x0039,
+ 0x0041, 0x005a,
+ 0x005f, 0x005f,
+ 0x0061, 0x007a,
+ 0x00aa, 0x00aa,
+ 0x00b5, 0x00b5,
+ 0x00ba, 0x00ba,
+ 0x00c0, 0x00d6,
+ 0x00d8, 0x00f6,
+ 0x00f8, 0x02c1,
+ 0x02c6, 0x02d1,
+ 0x02e0, 0x02e4,
+ 0x02ec, 0x02ec,
+ 0x02ee, 0x02ee,
+ 0x0300, 0x0374,
+ 0x0376, 0x0377,
+ 0x037a, 0x037d,
+ 0x0386, 0x0386,
+ 0x0388, 0x038a,
+ 0x038c, 0x038c,
+ 0x038e, 0x03a1,
+ 0x03a3, 0x03f5,
+ 0x03f7, 0x0481,
+ 0x0483, 0x0527,
+ 0x0531, 0x0556,
+ 0x0559, 0x0559,
+ 0x0561, 0x0587,
+ 0x0591, 0x05bd,
+ 0x05bf, 0x05bf,
+ 0x05c1, 0x05c2,
+ 0x05c4, 0x05c5,
+ 0x05c7, 0x05c7,
+ 0x05d0, 0x05ea,
+ 0x05f0, 0x05f2,
+ 0x0610, 0x061a,
+ 0x0620, 0x0669,
+ 0x066e, 0x06d3,
+ 0x06d5, 0x06dc,
+ 0x06df, 0x06e8,
+ 0x06ea, 0x06fc,
+ 0x06ff, 0x06ff,
+ 0x0710, 0x074a,
+ 0x074d, 0x07b1,
+ 0x07c0, 0x07f5,
+ 0x07fa, 0x07fa,
+ 0x0800, 0x082d,
+ 0x0840, 0x085b,
+ 0x08a0, 0x08a0,
+ 0x08a2, 0x08ac,
+ 0x08e4, 0x08fe,
+ 0x0900, 0x0963,
+ 0x0966, 0x096f,
+ 0x0971, 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, 0x09f1,
+ 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, 0x0aef,
+ 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, 0x0b6f,
+ 0x0b71, 0x0b71,
+ 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, 0x0bef,
+ 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,
+ 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, 0x0d6f,
+ 0x0d7a, 0x0d7f,
+ 0x0d82, 0x0d83,
+ 0x0d85, 0x0d96,
+ 0x0d9a, 0x0db1,
+ 0x0db3, 0x0dbb,
+ 0x0dbd, 0x0dbd,
+ 0x0dc0, 0x0dc6,
+ 0x0dca, 0x0dca,
+ 0x0dcf, 0x0dd4,
+ 0x0dd6, 0x0dd6,
+ 0x0dd8, 0x0ddf,
+ 0x0df2, 0x0df3,
+ 0x0e01, 0x0e3a,
+ 0x0e40, 0x0e4e,
+ 0x0e50, 0x0e59,
+ 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, 0x0f00,
+ 0x0f18, 0x0f19,
+ 0x0f20, 0x0f29,
+ 0x0f35, 0x0f35,
+ 0x0f37, 0x0f37,
+ 0x0f39, 0x0f39,
+ 0x0f3e, 0x0f47,
+ 0x0f49, 0x0f6c,
+ 0x0f71, 0x0f84,
+ 0x0f86, 0x0f97,
+ 0x0f99, 0x0fbc,
+ 0x0fc6, 0x0fc6,
+ 0x1000, 0x1049,
+ 0x1050, 0x109d,
+ 0x10a0, 0x10c5,
+ 0x10c7, 0x10c7,
+ 0x10cd, 0x10cd,
+ 0x10d0, 0x10fa,
+ 0x10fc, 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, 0x135f,
+ 0x1380, 0x138f,
+ 0x13a0, 0x13f4,
+ 0x1401, 0x166c,
+ 0x166f, 0x167f,
+ 0x1681, 0x169a,
+ 0x16a0, 0x16ea,
+ 0x16ee, 0x16f0,
+ 0x1700, 0x170c,
+ 0x170e, 0x1714,
+ 0x1720, 0x1734,
+ 0x1740, 0x1753,
+ 0x1760, 0x176c,
+ 0x176e, 0x1770,
+ 0x1772, 0x1773,
+ 0x1780, 0x17d3,
+ 0x17d7, 0x17d7,
+ 0x17dc, 0x17dd,
+ 0x17e0, 0x17e9,
+ 0x180b, 0x180d,
+ 0x1810, 0x1819,
+ 0x1820, 0x1877,
+ 0x1880, 0x18aa,
+ 0x18b0, 0x18f5,
+ 0x1900, 0x191c,
+ 0x1920, 0x192b,
+ 0x1930, 0x193b,
+ 0x1946, 0x196d,
+ 0x1970, 0x1974,
+ 0x1980, 0x19ab,
+ 0x19b0, 0x19c9,
+ 0x19d0, 0x19d9,
+ 0x1a00, 0x1a1b,
+ 0x1a20, 0x1a5e,
+ 0x1a60, 0x1a7c,
+ 0x1a7f, 0x1a89,
+ 0x1a90, 0x1a99,
+ 0x1aa7, 0x1aa7,
+ 0x1b00, 0x1b4b,
+ 0x1b50, 0x1b59,
+ 0x1b6b, 0x1b73,
+ 0x1b80, 0x1bf3,
+ 0x1c00, 0x1c37,
+ 0x1c40, 0x1c49,
+ 0x1c4d, 0x1c7d,
+ 0x1cd0, 0x1cd2,
+ 0x1cd4, 0x1cf6,
+ 0x1d00, 0x1de6,
+ 0x1dfc, 0x1f15,
+ 0x1f18, 0x1f1d,
+ 0x1f20, 0x1f45,
+ 0x1f48, 0x1f4d,
+ 0x1f50, 0x1f57,
+ 0x1f59, 0x1f59,
+ 0x1f5b, 0x1f5b,
+ 0x1f5d, 0x1f5d,
+ 0x1f5f, 0x1f7d,
+ 0x1f80, 0x1fb4,
+ 0x1fb6, 0x1fbc,
+ 0x1fbe, 0x1fbe,
+ 0x1fc2, 0x1fc4,
+ 0x1fc6, 0x1fcc,
+ 0x1fd0, 0x1fd3,
+ 0x1fd6, 0x1fdb,
+ 0x1fe0, 0x1fec,
+ 0x1ff2, 0x1ff4,
+ 0x1ff6, 0x1ffc,
+ 0x203f, 0x2040,
+ 0x2054, 0x2054,
+ 0x2071, 0x2071,
+ 0x207f, 0x207f,
+ 0x2090, 0x209c,
+ 0x20d0, 0x20f0,
+ 0x2102, 0x2102,
+ 0x2107, 0x2107,
+ 0x210a, 0x2113,
+ 0x2115, 0x2115,
+ 0x2119, 0x211d,
+ 0x2124, 0x2124,
+ 0x2126, 0x2126,
+ 0x2128, 0x2128,
+ 0x212a, 0x212d,
+ 0x212f, 0x2139,
+ 0x213c, 0x213f,
+ 0x2145, 0x2149,
+ 0x214e, 0x214e,
+ 0x2160, 0x2188,
+ 0x24b6, 0x24e9,
+ 0x2c00, 0x2c2e,
+ 0x2c30, 0x2c5e,
+ 0x2c60, 0x2ce4,
+ 0x2ceb, 0x2cf3,
+ 0x2d00, 0x2d25,
+ 0x2d27, 0x2d27,
+ 0x2d2d, 0x2d2d,
+ 0x2d30, 0x2d67,
+ 0x2d6f, 0x2d6f,
+ 0x2d7f, 0x2d96,
+ 0x2da0, 0x2da6,
+ 0x2da8, 0x2dae,
+ 0x2db0, 0x2db6,
+ 0x2db8, 0x2dbe,
+ 0x2dc0, 0x2dc6,
+ 0x2dc8, 0x2dce,
+ 0x2dd0, 0x2dd6,
+ 0x2dd8, 0x2dde,
+ 0x2de0, 0x2dff,
+ 0x2e2f, 0x2e2f,
+ 0x3005, 0x3007,
+ 0x3021, 0x302f,
+ 0x3031, 0x3035,
+ 0x3038, 0x303c,
+ 0x3041, 0x3096,
+ 0x3099, 0x309a,
+ 0x309d, 0x309f,
+ 0x30a1, 0x30fa,
+ 0x30fc, 0x30ff,
+ 0x3105, 0x312d,
+ 0x3131, 0x318e,
+ 0x31a0, 0x31ba,
+ 0x31f0, 0x31ff,
+ 0x3400, 0x4db5,
+ 0x4e00, 0x9fcc,
+ 0xa000, 0xa48c,
+ 0xa4d0, 0xa4fd,
+ 0xa500, 0xa60c,
+ 0xa610, 0xa62b,
+ 0xa640, 0xa672,
+ 0xa674, 0xa67d,
+ 0xa67f, 0xa697,
+ 0xa69f, 0xa6f1,
+ 0xa717, 0xa71f,
+ 0xa722, 0xa788,
+ 0xa78b, 0xa78e,
+ 0xa790, 0xa793,
+ 0xa7a0, 0xa7aa,
+ 0xa7f8, 0xa827,
+ 0xa840, 0xa873,
+ 0xa880, 0xa8c4,
+ 0xa8d0, 0xa8d9,
+ 0xa8e0, 0xa8f7,
+ 0xa8fb, 0xa8fb,
+ 0xa900, 0xa92d,
+ 0xa930, 0xa953,
+ 0xa960, 0xa97c,
+ 0xa980, 0xa9c0,
+ 0xa9cf, 0xa9d9,
+ 0xaa00, 0xaa36,
+ 0xaa40, 0xaa4d,
+ 0xaa50, 0xaa59,
+ 0xaa60, 0xaa76,
+ 0xaa7a, 0xaa7b,
+ 0xaa80, 0xaac2,
+ 0xaadb, 0xaadd,
+ 0xaae0, 0xaaef,
+ 0xaaf2, 0xaaf6,
+ 0xab01, 0xab06,
+ 0xab09, 0xab0e,
+ 0xab11, 0xab16,
+ 0xab20, 0xab26,
+ 0xab28, 0xab2e,
+ 0xabc0, 0xabea,
+ 0xabec, 0xabed,
+ 0xabf0, 0xabf9,
+ 0xac00, 0xd7a3,
+ 0xd7b0, 0xd7c6,
+ 0xd7cb, 0xd7fb,
+ 0xf900, 0xfa6d,
+ 0xfa70, 0xfad9,
+ 0xfb00, 0xfb06,
+ 0xfb13, 0xfb17,
+ 0xfb1d, 0xfb28,
+ 0xfb2a, 0xfb36,
+ 0xfb38, 0xfb3c,
+ 0xfb3e, 0xfb3e,
+ 0xfb40, 0xfb41,
+ 0xfb43, 0xfb44,
+ 0xfb46, 0xfbb1,
+ 0xfbd3, 0xfd3d,
+ 0xfd50, 0xfd8f,
+ 0xfd92, 0xfdc7,
+ 0xfdf0, 0xfdfb,
+ 0xfe00, 0xfe0f,
+ 0xfe20, 0xfe26,
+ 0xfe33, 0xfe34,
+ 0xfe4d, 0xfe4f,
+ 0xfe70, 0xfe74,
+ 0xfe76, 0xfefc,
+ 0xff10, 0xff19,
+ 0xff21, 0xff3a,
+ 0xff3f, 0xff3f,
+ 0xff41, 0xff5a,
+ 0xff66, 0xffbe,
+ 0xffc2, 0xffc7,
+ 0xffca, 0xffcf,
+ 0xffd2, 0xffd7,
+ 0xffda, 0xffdc,
+ 0x10000, 0x1000b,
+ 0x1000d, 0x10026,
+ 0x10028, 0x1003a,
+ 0x1003c, 0x1003d,
+ 0x1003f, 0x1004d,
+ 0x10050, 0x1005d,
+ 0x10080, 0x100fa,
+ 0x10140, 0x10174,
+ 0x101fd, 0x101fd,
+ 0x10280, 0x1029c,
+ 0x102a0, 0x102d0,
+ 0x10300, 0x1031e,
+ 0x10330, 0x1034a,
+ 0x10380, 0x1039d,
+ 0x103a0, 0x103c3,
+ 0x103c8, 0x103cf,
+ 0x103d1, 0x103d5,
+ 0x10400, 0x1049d,
+ 0x104a0, 0x104a9,
+ 0x10800, 0x10805,
+ 0x10808, 0x10808,
+ 0x1080a, 0x10835,
+ 0x10837, 0x10838,
+ 0x1083c, 0x1083c,
+ 0x1083f, 0x10855,
+ 0x10900, 0x10915,
+ 0x10920, 0x10939,
+ 0x10980, 0x109b7,
+ 0x109be, 0x109bf,
+ 0x10a00, 0x10a03,
+ 0x10a05, 0x10a06,
+ 0x10a0c, 0x10a13,
+ 0x10a15, 0x10a17,
+ 0x10a19, 0x10a33,
+ 0x10a38, 0x10a3a,
+ 0x10a3f, 0x10a3f,
+ 0x10a60, 0x10a7c,
+ 0x10b00, 0x10b35,
+ 0x10b40, 0x10b55,
+ 0x10b60, 0x10b72,
+ 0x10c00, 0x10c48,
+ 0x11000, 0x11046,
+ 0x11066, 0x1106f,
+ 0x11080, 0x110ba,
+ 0x110d0, 0x110e8,
+ 0x110f0, 0x110f9,
+ 0x11100, 0x11134,
+ 0x11136, 0x1113f,
+ 0x11180, 0x111c4,
+ 0x111d0, 0x111d9,
+ 0x11680, 0x116b7,
+ 0x116c0, 0x116c9,
+ 0x12000, 0x1236e,
+ 0x12400, 0x12462,
+ 0x13000, 0x1342e,
+ 0x16800, 0x16a38,
+ 0x16f00, 0x16f44,
+ 0x16f50, 0x16f7e,
+ 0x16f8f, 0x16f9f,
+ 0x1b000, 0x1b001,
+ 0x1d165, 0x1d169,
+ 0x1d16d, 0x1d172,
+ 0x1d17b, 0x1d182,
+ 0x1d185, 0x1d18b,
+ 0x1d1aa, 0x1d1ad,
+ 0x1d242, 0x1d244,
+ 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, 0x1d6c0,
+ 0x1d6c2, 0x1d6da,
+ 0x1d6dc, 0x1d6fa,
+ 0x1d6fc, 0x1d714,
+ 0x1d716, 0x1d734,
+ 0x1d736, 0x1d74e,
+ 0x1d750, 0x1d76e,
+ 0x1d770, 0x1d788,
+ 0x1d78a, 0x1d7a8,
+ 0x1d7aa, 0x1d7c2,
+ 0x1d7c4, 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,
+ 0x20000, 0x2a6d6,
+ 0x2a700, 0x2b734,
+ 0x2b740, 0x2b81d,
+ 0x2f800, 0x2fa1d,
+ 0xe0100, 0xe01ef,
+}; /* CR_Word */
+
+/* 'Alnum': [[:Alnum:]] */
+static const OnigCodePoint CR_Alnum[] = {
+ 566,
+ 0x0030, 0x0039,
+ 0x0041, 0x005a,
+ 0x0061, 0x007a,
+ 0x00aa, 0x00aa,
+ 0x00b5, 0x00b5,
+ 0x00ba, 0x00ba,
+ 0x00c0, 0x00d6,
+ 0x00d8, 0x00f6,
+ 0x00f8, 0x02c1,
+ 0x02c6, 0x02d1,
+ 0x02e0, 0x02e4,
+ 0x02ec, 0x02ec,
+ 0x02ee, 0x02ee,
+ 0x0345, 0x0345,
+ 0x0370, 0x0374,
+ 0x0376, 0x0377,
+ 0x037a, 0x037d,
+ 0x0386, 0x0386,
+ 0x0388, 0x038a,
+ 0x038c, 0x038c,
+ 0x038e, 0x03a1,
+ 0x03a3, 0x03f5,
+ 0x03f7, 0x0481,
+ 0x048a, 0x0527,
+ 0x0531, 0x0556,
+ 0x0559, 0x0559,
+ 0x0561, 0x0587,
+ 0x05b0, 0x05bd,
+ 0x05bf, 0x05bf,
+ 0x05c1, 0x05c2,
+ 0x05c4, 0x05c5,
+ 0x05c7, 0x05c7,
+ 0x05d0, 0x05ea,
+ 0x05f0, 0x05f2,
+ 0x0610, 0x061a,
+ 0x0620, 0x0657,
+ 0x0659, 0x0669,
+ 0x066e, 0x06d3,
+ 0x06d5, 0x06dc,
+ 0x06e1, 0x06e8,
+ 0x06ed, 0x06fc,
+ 0x06ff, 0x06ff,
+ 0x0710, 0x073f,
+ 0x074d, 0x07b1,
+ 0x07c0, 0x07ea,
+ 0x07f4, 0x07f5,
+ 0x07fa, 0x07fa,
+ 0x0800, 0x0817,
+ 0x081a, 0x082c,
+ 0x0840, 0x0858,
+ 0x08a0, 0x08a0,
+ 0x08a2, 0x08ac,
+ 0x08e4, 0x08e9,
+ 0x08f0, 0x08fe,
+ 0x0900, 0x093b,
+ 0x093d, 0x094c,
+ 0x094e, 0x0950,
+ 0x0955, 0x0963,
+ 0x0966, 0x096f,
+ 0x0971, 0x0977,
+ 0x0979, 0x097f,
+ 0x0981, 0x0983,
+ 0x0985, 0x098c,
+ 0x098f, 0x0990,
+ 0x0993, 0x09a8,
+ 0x09aa, 0x09b0,
+ 0x09b2, 0x09b2,
+ 0x09b6, 0x09b9,
+ 0x09bd, 0x09c4,
+ 0x09c7, 0x09c8,
+ 0x09cb, 0x09cc,
+ 0x09ce, 0x09ce,
+ 0x09d7, 0x09d7,
+ 0x09dc, 0x09dd,
+ 0x09df, 0x09e3,
+ 0x09e6, 0x09f1,
+ 0x0a01, 0x0a03,
+ 0x0a05, 0x0a0a,
+ 0x0a0f, 0x0a10,
+ 0x0a13, 0x0a28,
+ 0x0a2a, 0x0a30,
+ 0x0a32, 0x0a33,
+ 0x0a35, 0x0a36,
+ 0x0a38, 0x0a39,
+ 0x0a3e, 0x0a42,
+ 0x0a47, 0x0a48,
+ 0x0a4b, 0x0a4c,
+ 0x0a51, 0x0a51,
+ 0x0a59, 0x0a5c,
+ 0x0a5e, 0x0a5e,
+ 0x0a66, 0x0a75,
+ 0x0a81, 0x0a83,
+ 0x0a85, 0x0a8d,
+ 0x0a8f, 0x0a91,
+ 0x0a93, 0x0aa8,
+ 0x0aaa, 0x0ab0,
+ 0x0ab2, 0x0ab3,
+ 0x0ab5, 0x0ab9,
+ 0x0abd, 0x0ac5,
+ 0x0ac7, 0x0ac9,
+ 0x0acb, 0x0acc,
+ 0x0ad0, 0x0ad0,
+ 0x0ae0, 0x0ae3,
+ 0x0ae6, 0x0aef,
+ 0x0b01, 0x0b03,
+ 0x0b05, 0x0b0c,
+ 0x0b0f, 0x0b10,
+ 0x0b13, 0x0b28,
+ 0x0b2a, 0x0b30,
+ 0x0b32, 0x0b33,
+ 0x0b35, 0x0b39,
+ 0x0b3d, 0x0b44,
+ 0x0b47, 0x0b48,
+ 0x0b4b, 0x0b4c,
+ 0x0b56, 0x0b57,
+ 0x0b5c, 0x0b5d,
+ 0x0b5f, 0x0b63,
+ 0x0b66, 0x0b6f,
+ 0x0b71, 0x0b71,
+ 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, 0x0bcc,
+ 0x0bd0, 0x0bd0,
+ 0x0bd7, 0x0bd7,
+ 0x0be6, 0x0bef,
+ 0x0c01, 0x0c03,
+ 0x0c05, 0x0c0c,
+ 0x0c0e, 0x0c10,
+ 0x0c12, 0x0c28,
+ 0x0c2a, 0x0c33,
+ 0x0c35, 0x0c39,
+ 0x0c3d, 0x0c44,
+ 0x0c46, 0x0c48,
+ 0x0c4a, 0x0c4c,
+ 0x0c55, 0x0c56,
+ 0x0c58, 0x0c59,
+ 0x0c60, 0x0c63,
+ 0x0c66, 0x0c6f,
+ 0x0c82, 0x0c83,
+ 0x0c85, 0x0c8c,
+ 0x0c8e, 0x0c90,
+ 0x0c92, 0x0ca8,
+ 0x0caa, 0x0cb3,
+ 0x0cb5, 0x0cb9,
+ 0x0cbd, 0x0cc4,
+ 0x0cc6, 0x0cc8,
+ 0x0cca, 0x0ccc,
+ 0x0cd5, 0x0cd6,
+ 0x0cde, 0x0cde,
+ 0x0ce0, 0x0ce3,
+ 0x0ce6, 0x0cef,
+ 0x0cf1, 0x0cf2,
+ 0x0d02, 0x0d03,
+ 0x0d05, 0x0d0c,
+ 0x0d0e, 0x0d10,
+ 0x0d12, 0x0d3a,
+ 0x0d3d, 0x0d44,
+ 0x0d46, 0x0d48,
+ 0x0d4a, 0x0d4c,
+ 0x0d4e, 0x0d4e,
+ 0x0d57, 0x0d57,
+ 0x0d60, 0x0d63,
+ 0x0d66, 0x0d6f,
+ 0x0d7a, 0x0d7f,
+ 0x0d82, 0x0d83,
+ 0x0d85, 0x0d96,
+ 0x0d9a, 0x0db1,
+ 0x0db3, 0x0dbb,
+ 0x0dbd, 0x0dbd,
+ 0x0dc0, 0x0dc6,
+ 0x0dcf, 0x0dd4,
+ 0x0dd6, 0x0dd6,
+ 0x0dd8, 0x0ddf,
+ 0x0df2, 0x0df3,
+ 0x0e01, 0x0e3a,
+ 0x0e40, 0x0e46,
+ 0x0e4d, 0x0e4d,
+ 0x0e50, 0x0e59,
+ 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,
+ 0x0ecd, 0x0ecd,
+ 0x0ed0, 0x0ed9,
+ 0x0edc, 0x0edf,
+ 0x0f00, 0x0f00,
+ 0x0f20, 0x0f29,
+ 0x0f40, 0x0f47,
+ 0x0f49, 0x0f6c,
+ 0x0f71, 0x0f81,
+ 0x0f88, 0x0f97,
+ 0x0f99, 0x0fbc,
+ 0x1000, 0x1036,
+ 0x1038, 0x1038,
+ 0x103b, 0x1049,
+ 0x1050, 0x1062,
+ 0x1065, 0x1068,
+ 0x106e, 0x1086,
+ 0x108e, 0x108e,
+ 0x1090, 0x1099,
+ 0x109c, 0x109d,
+ 0x10a0, 0x10c5,
+ 0x10c7, 0x10c7,
+ 0x10cd, 0x10cd,
+ 0x10d0, 0x10fa,
+ 0x10fc, 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,
+ 0x135f, 0x135f,
+ 0x1380, 0x138f,
+ 0x13a0, 0x13f4,
+ 0x1401, 0x166c,
+ 0x166f, 0x167f,
+ 0x1681, 0x169a,
+ 0x16a0, 0x16ea,
+ 0x16ee, 0x16f0,
+ 0x1700, 0x170c,
+ 0x170e, 0x1713,
+ 0x1720, 0x1733,
+ 0x1740, 0x1753,
+ 0x1760, 0x176c,
+ 0x176e, 0x1770,
+ 0x1772, 0x1773,
+ 0x1780, 0x17b3,
+ 0x17b6, 0x17c8,
+ 0x17d7, 0x17d7,
+ 0x17dc, 0x17dc,
+ 0x17e0, 0x17e9,
+ 0x1810, 0x1819,
+ 0x1820, 0x1877,
+ 0x1880, 0x18aa,
+ 0x18b0, 0x18f5,
+ 0x1900, 0x191c,
+ 0x1920, 0x192b,
+ 0x1930, 0x1938,
+ 0x1946, 0x196d,
+ 0x1970, 0x1974,
+ 0x1980, 0x19ab,
+ 0x19b0, 0x19c9,
+ 0x19d0, 0x19d9,
+ 0x1a00, 0x1a1b,
+ 0x1a20, 0x1a5e,
+ 0x1a61, 0x1a74,
+ 0x1a80, 0x1a89,
+ 0x1a90, 0x1a99,
+ 0x1aa7, 0x1aa7,
+ 0x1b00, 0x1b33,
+ 0x1b35, 0x1b43,
+ 0x1b45, 0x1b4b,
+ 0x1b50, 0x1b59,
+ 0x1b80, 0x1ba9,
+ 0x1bac, 0x1be5,
+ 0x1be7, 0x1bf1,
+ 0x1c00, 0x1c35,
+ 0x1c40, 0x1c49,
+ 0x1c4d, 0x1c7d,
+ 0x1ce9, 0x1cec,
+ 0x1cee, 0x1cf3,
+ 0x1cf5, 0x1cf6,
+ 0x1d00, 0x1dbf,
+ 0x1e00, 0x1f15,
+ 0x1f18, 0x1f1d,
+ 0x1f20, 0x1f45,
+ 0x1f48, 0x1f4d,
+ 0x1f50, 0x1f57,
+ 0x1f59, 0x1f59,
+ 0x1f5b, 0x1f5b,
+ 0x1f5d, 0x1f5d,
+ 0x1f5f, 0x1f7d,
+ 0x1f80, 0x1fb4,
+ 0x1fb6, 0x1fbc,
+ 0x1fbe, 0x1fbe,
+ 0x1fc2, 0x1fc4,
+ 0x1fc6, 0x1fcc,
+ 0x1fd0, 0x1fd3,
+ 0x1fd6, 0x1fdb,
+ 0x1fe0, 0x1fec,
+ 0x1ff2, 0x1ff4,
+ 0x1ff6, 0x1ffc,
+ 0x2071, 0x2071,
+ 0x207f, 0x207f,
+ 0x2090, 0x209c,
+ 0x2102, 0x2102,
+ 0x2107, 0x2107,
+ 0x210a, 0x2113,
+ 0x2115, 0x2115,
+ 0x2119, 0x211d,
+ 0x2124, 0x2124,
+ 0x2126, 0x2126,
+ 0x2128, 0x2128,
+ 0x212a, 0x212d,
+ 0x212f, 0x2139,
+ 0x213c, 0x213f,
+ 0x2145, 0x2149,
+ 0x214e, 0x214e,
+ 0x2160, 0x2188,
+ 0x24b6, 0x24e9,
+ 0x2c00, 0x2c2e,
+ 0x2c30, 0x2c5e,
+ 0x2c60, 0x2ce4,
+ 0x2ceb, 0x2cee,
+ 0x2cf2, 0x2cf3,
+ 0x2d00, 0x2d25,
+ 0x2d27, 0x2d27,
+ 0x2d2d, 0x2d2d,
+ 0x2d30, 0x2d67,
+ 0x2d6f, 0x2d6f,
+ 0x2d80, 0x2d96,
+ 0x2da0, 0x2da6,
+ 0x2da8, 0x2dae,
+ 0x2db0, 0x2db6,
+ 0x2db8, 0x2dbe,
+ 0x2dc0, 0x2dc6,
+ 0x2dc8, 0x2dce,
+ 0x2dd0, 0x2dd6,
+ 0x2dd8, 0x2dde,
+ 0x2de0, 0x2dff,
+ 0x2e2f, 0x2e2f,
+ 0x3005, 0x3007,
+ 0x3021, 0x3029,
+ 0x3031, 0x3035,
+ 0x3038, 0x303c,
+ 0x3041, 0x3096,
+ 0x309d, 0x309f,
+ 0x30a1, 0x30fa,
+ 0x30fc, 0x30ff,
+ 0x3105, 0x312d,
+ 0x3131, 0x318e,
+ 0x31a0, 0x31ba,
+ 0x31f0, 0x31ff,
+ 0x3400, 0x4db5,
+ 0x4e00, 0x9fcc,
+ 0xa000, 0xa48c,
+ 0xa4d0, 0xa4fd,
+ 0xa500, 0xa60c,
+ 0xa610, 0xa62b,
+ 0xa640, 0xa66e,
+ 0xa674, 0xa67b,
+ 0xa67f, 0xa697,
+ 0xa69f, 0xa6ef,
+ 0xa717, 0xa71f,
+ 0xa722, 0xa788,
+ 0xa78b, 0xa78e,
+ 0xa790, 0xa793,
+ 0xa7a0, 0xa7aa,
+ 0xa7f8, 0xa801,
+ 0xa803, 0xa805,
+ 0xa807, 0xa80a,
+ 0xa80c, 0xa827,
+ 0xa840, 0xa873,
+ 0xa880, 0xa8c3,
+ 0xa8d0, 0xa8d9,
+ 0xa8f2, 0xa8f7,
+ 0xa8fb, 0xa8fb,
+ 0xa900, 0xa92a,
+ 0xa930, 0xa952,
+ 0xa960, 0xa97c,
+ 0xa980, 0xa9b2,
+ 0xa9b4, 0xa9bf,
+ 0xa9cf, 0xa9d9,
+ 0xaa00, 0xaa36,
+ 0xaa40, 0xaa4d,
+ 0xaa50, 0xaa59,
+ 0xaa60, 0xaa76,
+ 0xaa7a, 0xaa7a,
+ 0xaa80, 0xaabe,
+ 0xaac0, 0xaac0,
+ 0xaac2, 0xaac2,
+ 0xaadb, 0xaadd,
+ 0xaae0, 0xaaef,
+ 0xaaf2, 0xaaf5,
+ 0xab01, 0xab06,
+ 0xab09, 0xab0e,
+ 0xab11, 0xab16,
+ 0xab20, 0xab26,
+ 0xab28, 0xab2e,
+ 0xabc0, 0xabea,
+ 0xabf0, 0xabf9,
+ 0xac00, 0xd7a3,
+ 0xd7b0, 0xd7c6,
+ 0xd7cb, 0xd7fb,
+ 0xf900, 0xfa6d,
+ 0xfa70, 0xfad9,
+ 0xfb00, 0xfb06,
+ 0xfb13, 0xfb17,
+ 0xfb1d, 0xfb28,
+ 0xfb2a, 0xfb36,
+ 0xfb38, 0xfb3c,
+ 0xfb3e, 0xfb3e,
+ 0xfb40, 0xfb41,
+ 0xfb43, 0xfb44,
+ 0xfb46, 0xfbb1,
+ 0xfbd3, 0xfd3d,
+ 0xfd50, 0xfd8f,
+ 0xfd92, 0xfdc7,
+ 0xfdf0, 0xfdfb,
+ 0xfe70, 0xfe74,
+ 0xfe76, 0xfefc,
+ 0xff10, 0xff19,
+ 0xff21, 0xff3a,
+ 0xff41, 0xff5a,
+ 0xff66, 0xffbe,
+ 0xffc2, 0xffc7,
+ 0xffca, 0xffcf,
+ 0xffd2, 0xffd7,
+ 0xffda, 0xffdc,
+ 0x10000, 0x1000b,
+ 0x1000d, 0x10026,
+ 0x10028, 0x1003a,
+ 0x1003c, 0x1003d,
+ 0x1003f, 0x1004d,
+ 0x10050, 0x1005d,
+ 0x10080, 0x100fa,
+ 0x10140, 0x10174,
+ 0x10280, 0x1029c,
+ 0x102a0, 0x102d0,
+ 0x10300, 0x1031e,
+ 0x10330, 0x1034a,
+ 0x10380, 0x1039d,
+ 0x103a0, 0x103c3,
+ 0x103c8, 0x103cf,
+ 0x103d1, 0x103d5,
+ 0x10400, 0x1049d,
+ 0x104a0, 0x104a9,
+ 0x10800, 0x10805,
+ 0x10808, 0x10808,
+ 0x1080a, 0x10835,
+ 0x10837, 0x10838,
+ 0x1083c, 0x1083c,
+ 0x1083f, 0x10855,
+ 0x10900, 0x10915,
+ 0x10920, 0x10939,
+ 0x10980, 0x109b7,
+ 0x109be, 0x109bf,
+ 0x10a00, 0x10a03,
+ 0x10a05, 0x10a06,
+ 0x10a0c, 0x10a13,
+ 0x10a15, 0x10a17,
+ 0x10a19, 0x10a33,
+ 0x10a60, 0x10a7c,
+ 0x10b00, 0x10b35,
+ 0x10b40, 0x10b55,
+ 0x10b60, 0x10b72,
+ 0x10c00, 0x10c48,
+ 0x11000, 0x11045,
+ 0x11066, 0x1106f,
+ 0x11082, 0x110b8,
+ 0x110d0, 0x110e8,
+ 0x110f0, 0x110f9,
+ 0x11100, 0x11132,
+ 0x11136, 0x1113f,
+ 0x11180, 0x111bf,
+ 0x111c1, 0x111c4,
+ 0x111d0, 0x111d9,
+ 0x11680, 0x116b5,
+ 0x116c0, 0x116c9,
+ 0x12000, 0x1236e,
+ 0x12400, 0x12462,
+ 0x13000, 0x1342e,
+ 0x16800, 0x16a38,
+ 0x16f00, 0x16f44,
+ 0x16f50, 0x16f7e,
+ 0x16f93, 0x16f9f,
+ 0x1b000, 0x1b001,
+ 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, 0x1d6c0,
+ 0x1d6c2, 0x1d6da,
+ 0x1d6dc, 0x1d6fa,
+ 0x1d6fc, 0x1d714,
+ 0x1d716, 0x1d734,
+ 0x1d736, 0x1d74e,
+ 0x1d750, 0x1d76e,
+ 0x1d770, 0x1d788,
+ 0x1d78a, 0x1d7a8,
+ 0x1d7aa, 0x1d7c2,
+ 0x1d7c4, 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,
+ 0x20000, 0x2a6d6,
+ 0x2a700, 0x2b734,
+ 0x2b740, 0x2b81d,
+ 0x2f800, 0x2fa1d,
+}; /* CR_Alnum */
+
+/* 'ASCII': [[:ASCII:]] */
+static const OnigCodePoint CR_ASCII[] = {
+ 1,
+ 0x0000, 0x007f,
+}; /* CR_ASCII */
+
#ifdef USE_UNICODE_PROPERTIES
/* 'Any': - */
static const OnigCodePoint CR_Any[] = {
@@ -46,7 +4312,7 @@ static const OnigCodePoint CR_Any[] = {
/* 'Assigned': - */
static const OnigCodePoint CR_Assigned[] = {
- 501,
+ 539,
0x0000, 0x0377,
0x037a, 0x037e,
0x0384, 0x038a,
@@ -57,10 +4323,11 @@ static const OnigCodePoint CR_Assigned[] = {
0x0559, 0x055f,
0x0561, 0x0587,
0x0589, 0x058a,
+ 0x058f, 0x058f,
0x0591, 0x05c7,
0x05d0, 0x05ea,
0x05f0, 0x05f4,
- 0x0600, 0x0603,
+ 0x0600, 0x0604,
0x0606, 0x061b,
0x061e, 0x070d,
0x070f, 0x074a,
@@ -70,6 +4337,9 @@ static const OnigCodePoint CR_Assigned[] = {
0x0830, 0x083e,
0x0840, 0x085b,
0x085e, 0x085e,
+ 0x08a0, 0x08a0,
+ 0x08a2, 0x08ac,
+ 0x08e4, 0x08fe,
0x0900, 0x0977,
0x0979, 0x097f,
0x0981, 0x0983,
@@ -114,8 +4384,7 @@ static const OnigCodePoint CR_Assigned[] = {
0x0acb, 0x0acd,
0x0ad0, 0x0ad0,
0x0ae0, 0x0ae3,
- 0x0ae6, 0x0aef,
- 0x0af1, 0x0af1,
+ 0x0ae6, 0x0af1,
0x0b01, 0x0b03,
0x0b05, 0x0b0c,
0x0b0f, 0x0b10,
@@ -215,7 +4484,7 @@ static const OnigCodePoint CR_Assigned[] = {
0x0ec6, 0x0ec6,
0x0ec8, 0x0ecd,
0x0ed0, 0x0ed9,
- 0x0edc, 0x0edd,
+ 0x0edc, 0x0edf,
0x0f00, 0x0f47,
0x0f49, 0x0f6c,
0x0f71, 0x0f97,
@@ -223,8 +4492,9 @@ static const OnigCodePoint CR_Assigned[] = {
0x0fbe, 0x0fcc,
0x0fce, 0x0fda,
0x1000, 0x10c5,
- 0x10d0, 0x10fc,
- 0x1100, 0x1248,
+ 0x10c7, 0x10c7,
+ 0x10cd, 0x10cd,
+ 0x10d0, 0x1248,
0x124a, 0x124d,
0x1250, 0x1256,
0x1258, 0x1258,
@@ -277,13 +4547,12 @@ static const OnigCodePoint CR_Assigned[] = {
0x1aa0, 0x1aad,
0x1b00, 0x1b4b,
0x1b50, 0x1b7c,
- 0x1b80, 0x1baa,
- 0x1bae, 0x1bb9,
- 0x1bc0, 0x1bf3,
+ 0x1b80, 0x1bf3,
0x1bfc, 0x1c37,
0x1c3b, 0x1c49,
0x1c4d, 0x1c7f,
- 0x1cd0, 0x1cf2,
+ 0x1cc0, 0x1cc7,
+ 0x1cd0, 0x1cf6,
0x1d00, 0x1de6,
0x1dfc, 0x1f15,
0x1f18, 0x1f1d,
@@ -312,15 +4581,15 @@ static const OnigCodePoint CR_Assigned[] = {
0x2400, 0x2426,
0x2440, 0x244a,
0x2460, 0x26ff,
- 0x2701, 0x27ca,
- 0x27cc, 0x27cc,
- 0x27ce, 0x2b4c,
+ 0x2701, 0x2b4c,
0x2b50, 0x2b59,
0x2c00, 0x2c2e,
0x2c30, 0x2c5e,
- 0x2c60, 0x2cf1,
+ 0x2c60, 0x2cf3,
0x2cf9, 0x2d25,
- 0x2d30, 0x2d65,
+ 0x2d27, 0x2d27,
+ 0x2d2d, 0x2d2d,
+ 0x2d30, 0x2d67,
0x2d6f, 0x2d70,
0x2d7f, 0x2d96,
0x2da0, 0x2da6,
@@ -331,7 +4600,7 @@ static const OnigCodePoint CR_Assigned[] = {
0x2dc8, 0x2dce,
0x2dd0, 0x2dd6,
0x2dd8, 0x2dde,
- 0x2de0, 0x2e31,
+ 0x2de0, 0x2e3b,
0x2e80, 0x2e99,
0x2e9b, 0x2ef3,
0x2f00, 0x2fd5,
@@ -346,17 +4615,16 @@ static const OnigCodePoint CR_Assigned[] = {
0x31f0, 0x321e,
0x3220, 0x32fe,
0x3300, 0x4db5,
- 0x4dc0, 0x9fcb,
+ 0x4dc0, 0x9fcc,
0xa000, 0xa48c,
0xa490, 0xa4c6,
0xa4d0, 0xa62b,
- 0xa640, 0xa673,
- 0xa67c, 0xa697,
- 0xa6a0, 0xa6f7,
+ 0xa640, 0xa697,
+ 0xa69f, 0xa6f7,
0xa700, 0xa78e,
- 0xa790, 0xa791,
- 0xa7a0, 0xa7a9,
- 0xa7fa, 0xa82b,
+ 0xa790, 0xa793,
+ 0xa7a0, 0xa7aa,
+ 0xa7f8, 0xa82b,
0xa830, 0xa839,
0xa840, 0xa877,
0xa880, 0xa8c4,
@@ -372,7 +4640,7 @@ static const OnigCodePoint CR_Assigned[] = {
0xaa50, 0xaa59,
0xaa5c, 0xaa7b,
0xaa80, 0xaac2,
- 0xaadb, 0xaadf,
+ 0xaadb, 0xaaf6,
0xab01, 0xab06,
0xab09, 0xab0e,
0xab11, 0xab16,
@@ -383,8 +4651,7 @@ static const OnigCodePoint CR_Assigned[] = {
0xac00, 0xd7a3,
0xd7b0, 0xd7c6,
0xd7cb, 0xd7fb,
- 0xd800, 0xfa2d,
- 0xfa30, 0xfa6d,
+ 0xd800, 0xfa6d,
0xfa70, 0xfad9,
0xfb00, 0xfb06,
0xfb13, 0xfb17,
@@ -446,6 +4713,8 @@ static const OnigCodePoint CR_Assigned[] = {
0x10900, 0x1091b,
0x1091f, 0x10939,
0x1093f, 0x1093f,
+ 0x10980, 0x109b7,
+ 0x109be, 0x109bf,
0x10a00, 0x10a03,
0x10a05, 0x10a06,
0x10a0c, 0x10a13,
@@ -464,11 +4733,22 @@ static const OnigCodePoint CR_Assigned[] = {
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,
@@ -497,6 +4777,40 @@ static const OnigCodePoint CR_Assigned[] = {
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,
@@ -505,7 +4819,7 @@ static const OnigCodePoint CR_Assigned[] = {
0x1f0d1, 0x1f0df,
0x1f100, 0x1f10a,
0x1f110, 0x1f12e,
- 0x1f130, 0x1f169,
+ 0x1f130, 0x1f16b,
0x1f170, 0x1f19a,
0x1f1e6, 0x1f202,
0x1f210, 0x1f23a,
@@ -523,19 +4837,9 @@ static const OnigCodePoint CR_Assigned[] = {
0x1f442, 0x1f4f7,
0x1f4f9, 0x1f4fc,
0x1f500, 0x1f53d,
+ 0x1f540, 0x1f543,
0x1f550, 0x1f567,
- 0x1f5fb, 0x1f5ff,
- 0x1f601, 0x1f610,
- 0x1f612, 0x1f614,
- 0x1f616, 0x1f616,
- 0x1f618, 0x1f618,
- 0x1f61a, 0x1f61a,
- 0x1f61c, 0x1f61e,
- 0x1f620, 0x1f625,
- 0x1f628, 0x1f62b,
- 0x1f62d, 0x1f62d,
- 0x1f630, 0x1f633,
- 0x1f635, 0x1f640,
+ 0x1f5fb, 0x1f640,
0x1f645, 0x1f64f,
0x1f680, 0x1f6c5,
0x1f700, 0x1f773,
@@ -552,44 +4856,560 @@ static const OnigCodePoint CR_Assigned[] = {
/* 'C': Major Category */
static const OnigCodePoint CR_C[] = {
- 20,
+ 541,
0x0000, 0x001f,
0x007f, 0x009f,
0x00ad, 0x00ad,
- 0x0600, 0x0603,
+ 0x0378, 0x0379,
+ 0x037f, 0x0383,
+ 0x038b, 0x038b,
+ 0x038d, 0x038d,
+ 0x03a2, 0x03a2,
+ 0x0528, 0x0530,
+ 0x0557, 0x0558,
+ 0x0560, 0x0560,
+ 0x0588, 0x0588,
+ 0x058b, 0x058e,
+ 0x0590, 0x0590,
+ 0x05c8, 0x05cf,
+ 0x05eb, 0x05ef,
+ 0x05f5, 0x0605,
+ 0x061c, 0x061d,
0x06dd, 0x06dd,
- 0x070f, 0x070f,
- 0x17b4, 0x17b5,
+ 0x070e, 0x070f,
+ 0x074b, 0x074c,
+ 0x07b2, 0x07bf,
+ 0x07fb, 0x07ff,
+ 0x082e, 0x082f,
+ 0x083f, 0x083f,
+ 0x085c, 0x085d,
+ 0x085f, 0x089f,
+ 0x08a1, 0x08a1,
+ 0x08ad, 0x08e3,
+ 0x08ff, 0x08ff,
+ 0x0978, 0x0978,
+ 0x0980, 0x0980,
+ 0x0984, 0x0984,
+ 0x098d, 0x098e,
+ 0x0991, 0x0992,
+ 0x09a9, 0x09a9,
+ 0x09b1, 0x09b1,
+ 0x09b3, 0x09b5,
+ 0x09ba, 0x09bb,
+ 0x09c5, 0x09c6,
+ 0x09c9, 0x09ca,
+ 0x09cf, 0x09d6,
+ 0x09d8, 0x09db,
+ 0x09de, 0x09de,
+ 0x09e4, 0x09e5,
+ 0x09fc, 0x0a00,
+ 0x0a04, 0x0a04,
+ 0x0a0b, 0x0a0e,
+ 0x0a11, 0x0a12,
+ 0x0a29, 0x0a29,
+ 0x0a31, 0x0a31,
+ 0x0a34, 0x0a34,
+ 0x0a37, 0x0a37,
+ 0x0a3a, 0x0a3b,
+ 0x0a3d, 0x0a3d,
+ 0x0a43, 0x0a46,
+ 0x0a49, 0x0a4a,
+ 0x0a4e, 0x0a50,
+ 0x0a52, 0x0a58,
+ 0x0a5d, 0x0a5d,
+ 0x0a5f, 0x0a65,
+ 0x0a76, 0x0a80,
+ 0x0a84, 0x0a84,
+ 0x0a8e, 0x0a8e,
+ 0x0a92, 0x0a92,
+ 0x0aa9, 0x0aa9,
+ 0x0ab1, 0x0ab1,
+ 0x0ab4, 0x0ab4,
+ 0x0aba, 0x0abb,
+ 0x0ac6, 0x0ac6,
+ 0x0aca, 0x0aca,
+ 0x0ace, 0x0acf,
+ 0x0ad1, 0x0adf,
+ 0x0ae4, 0x0ae5,
+ 0x0af2, 0x0b00,
+ 0x0b04, 0x0b04,
+ 0x0b0d, 0x0b0e,
+ 0x0b11, 0x0b12,
+ 0x0b29, 0x0b29,
+ 0x0b31, 0x0b31,
+ 0x0b34, 0x0b34,
+ 0x0b3a, 0x0b3b,
+ 0x0b45, 0x0b46,
+ 0x0b49, 0x0b4a,
+ 0x0b4e, 0x0b55,
+ 0x0b58, 0x0b5b,
+ 0x0b5e, 0x0b5e,
+ 0x0b64, 0x0b65,
+ 0x0b78, 0x0b81,
+ 0x0b84, 0x0b84,
+ 0x0b8b, 0x0b8d,
+ 0x0b91, 0x0b91,
+ 0x0b96, 0x0b98,
+ 0x0b9b, 0x0b9b,
+ 0x0b9d, 0x0b9d,
+ 0x0ba0, 0x0ba2,
+ 0x0ba5, 0x0ba7,
+ 0x0bab, 0x0bad,
+ 0x0bba, 0x0bbd,
+ 0x0bc3, 0x0bc5,
+ 0x0bc9, 0x0bc9,
+ 0x0bce, 0x0bcf,
+ 0x0bd1, 0x0bd6,
+ 0x0bd8, 0x0be5,
+ 0x0bfb, 0x0c00,
+ 0x0c04, 0x0c04,
+ 0x0c0d, 0x0c0d,
+ 0x0c11, 0x0c11,
+ 0x0c29, 0x0c29,
+ 0x0c34, 0x0c34,
+ 0x0c3a, 0x0c3c,
+ 0x0c45, 0x0c45,
+ 0x0c49, 0x0c49,
+ 0x0c4e, 0x0c54,
+ 0x0c57, 0x0c57,
+ 0x0c5a, 0x0c5f,
+ 0x0c64, 0x0c65,
+ 0x0c70, 0x0c77,
+ 0x0c80, 0x0c81,
+ 0x0c84, 0x0c84,
+ 0x0c8d, 0x0c8d,
+ 0x0c91, 0x0c91,
+ 0x0ca9, 0x0ca9,
+ 0x0cb4, 0x0cb4,
+ 0x0cba, 0x0cbb,
+ 0x0cc5, 0x0cc5,
+ 0x0cc9, 0x0cc9,
+ 0x0cce, 0x0cd4,
+ 0x0cd7, 0x0cdd,
+ 0x0cdf, 0x0cdf,
+ 0x0ce4, 0x0ce5,
+ 0x0cf0, 0x0cf0,
+ 0x0cf3, 0x0d01,
+ 0x0d04, 0x0d04,
+ 0x0d0d, 0x0d0d,
+ 0x0d11, 0x0d11,
+ 0x0d3b, 0x0d3c,
+ 0x0d45, 0x0d45,
+ 0x0d49, 0x0d49,
+ 0x0d4f, 0x0d56,
+ 0x0d58, 0x0d5f,
+ 0x0d64, 0x0d65,
+ 0x0d76, 0x0d78,
+ 0x0d80, 0x0d81,
+ 0x0d84, 0x0d84,
+ 0x0d97, 0x0d99,
+ 0x0db2, 0x0db2,
+ 0x0dbc, 0x0dbc,
+ 0x0dbe, 0x0dbf,
+ 0x0dc7, 0x0dc9,
+ 0x0dcb, 0x0dce,
+ 0x0dd5, 0x0dd5,
+ 0x0dd7, 0x0dd7,
+ 0x0de0, 0x0df1,
+ 0x0df5, 0x0e00,
+ 0x0e3b, 0x0e3e,
+ 0x0e5c, 0x0e80,
+ 0x0e83, 0x0e83,
+ 0x0e85, 0x0e86,
+ 0x0e89, 0x0e89,
+ 0x0e8b, 0x0e8c,
+ 0x0e8e, 0x0e93,
+ 0x0e98, 0x0e98,
+ 0x0ea0, 0x0ea0,
+ 0x0ea4, 0x0ea4,
+ 0x0ea6, 0x0ea6,
+ 0x0ea8, 0x0ea9,
+ 0x0eac, 0x0eac,
+ 0x0eba, 0x0eba,
+ 0x0ebe, 0x0ebf,
+ 0x0ec5, 0x0ec5,
+ 0x0ec7, 0x0ec7,
+ 0x0ece, 0x0ecf,
+ 0x0eda, 0x0edb,
+ 0x0ee0, 0x0eff,
+ 0x0f48, 0x0f48,
+ 0x0f6d, 0x0f70,
+ 0x0f98, 0x0f98,
+ 0x0fbd, 0x0fbd,
+ 0x0fcd, 0x0fcd,
+ 0x0fdb, 0x0fff,
+ 0x10c6, 0x10c6,
+ 0x10c8, 0x10cc,
+ 0x10ce, 0x10cf,
+ 0x1249, 0x1249,
+ 0x124e, 0x124f,
+ 0x1257, 0x1257,
+ 0x1259, 0x1259,
+ 0x125e, 0x125f,
+ 0x1289, 0x1289,
+ 0x128e, 0x128f,
+ 0x12b1, 0x12b1,
+ 0x12b6, 0x12b7,
+ 0x12bf, 0x12bf,
+ 0x12c1, 0x12c1,
+ 0x12c6, 0x12c7,
+ 0x12d7, 0x12d7,
+ 0x1311, 0x1311,
+ 0x1316, 0x1317,
+ 0x135b, 0x135c,
+ 0x137d, 0x137f,
+ 0x139a, 0x139f,
+ 0x13f5, 0x13ff,
+ 0x169d, 0x169f,
+ 0x16f1, 0x16ff,
+ 0x170d, 0x170d,
+ 0x1715, 0x171f,
+ 0x1737, 0x173f,
+ 0x1754, 0x175f,
+ 0x176d, 0x176d,
+ 0x1771, 0x1771,
+ 0x1774, 0x177f,
+ 0x17de, 0x17df,
+ 0x17ea, 0x17ef,
+ 0x17fa, 0x17ff,
+ 0x180f, 0x180f,
+ 0x181a, 0x181f,
+ 0x1878, 0x187f,
+ 0x18ab, 0x18af,
+ 0x18f6, 0x18ff,
+ 0x191d, 0x191f,
+ 0x192c, 0x192f,
+ 0x193c, 0x193f,
+ 0x1941, 0x1943,
+ 0x196e, 0x196f,
+ 0x1975, 0x197f,
+ 0x19ac, 0x19af,
+ 0x19ca, 0x19cf,
+ 0x19db, 0x19dd,
+ 0x1a1c, 0x1a1d,
+ 0x1a5f, 0x1a5f,
+ 0x1a7d, 0x1a7e,
+ 0x1a8a, 0x1a8f,
+ 0x1a9a, 0x1a9f,
+ 0x1aae, 0x1aff,
+ 0x1b4c, 0x1b4f,
+ 0x1b7d, 0x1b7f,
+ 0x1bf4, 0x1bfb,
+ 0x1c38, 0x1c3a,
+ 0x1c4a, 0x1c4c,
+ 0x1c80, 0x1cbf,
+ 0x1cc8, 0x1ccf,
+ 0x1cf7, 0x1cff,
+ 0x1de7, 0x1dfb,
+ 0x1f16, 0x1f17,
+ 0x1f1e, 0x1f1f,
+ 0x1f46, 0x1f47,
+ 0x1f4e, 0x1f4f,
+ 0x1f58, 0x1f58,
+ 0x1f5a, 0x1f5a,
+ 0x1f5c, 0x1f5c,
+ 0x1f5e, 0x1f5e,
+ 0x1f7e, 0x1f7f,
+ 0x1fb5, 0x1fb5,
+ 0x1fc5, 0x1fc5,
+ 0x1fd4, 0x1fd5,
+ 0x1fdc, 0x1fdc,
+ 0x1ff0, 0x1ff1,
+ 0x1ff5, 0x1ff5,
+ 0x1fff, 0x1fff,
0x200b, 0x200f,
0x202a, 0x202e,
- 0x2060, 0x2064,
- 0x206a, 0x206f,
- 0xd800, 0xf8ff,
- 0xfeff, 0xfeff,
- 0xfff9, 0xfffb,
+ 0x2060, 0x206f,
+ 0x2072, 0x2073,
+ 0x208f, 0x208f,
+ 0x209d, 0x209f,
+ 0x20ba, 0x20cf,
+ 0x20f1, 0x20ff,
+ 0x218a, 0x218f,
+ 0x23f4, 0x23ff,
+ 0x2427, 0x243f,
+ 0x244b, 0x245f,
+ 0x2700, 0x2700,
+ 0x2b4d, 0x2b4f,
+ 0x2b5a, 0x2bff,
+ 0x2c2f, 0x2c2f,
+ 0x2c5f, 0x2c5f,
+ 0x2cf4, 0x2cf8,
+ 0x2d26, 0x2d26,
+ 0x2d28, 0x2d2c,
+ 0x2d2e, 0x2d2f,
+ 0x2d68, 0x2d6e,
+ 0x2d71, 0x2d7e,
+ 0x2d97, 0x2d9f,
+ 0x2da7, 0x2da7,
+ 0x2daf, 0x2daf,
+ 0x2db7, 0x2db7,
+ 0x2dbf, 0x2dbf,
+ 0x2dc7, 0x2dc7,
+ 0x2dcf, 0x2dcf,
+ 0x2dd7, 0x2dd7,
+ 0x2ddf, 0x2ddf,
+ 0x2e3c, 0x2e7f,
+ 0x2e9a, 0x2e9a,
+ 0x2ef4, 0x2eff,
+ 0x2fd6, 0x2fef,
+ 0x2ffc, 0x2fff,
+ 0x3040, 0x3040,
+ 0x3097, 0x3098,
+ 0x3100, 0x3104,
+ 0x312e, 0x3130,
+ 0x318f, 0x318f,
+ 0x31bb, 0x31bf,
+ 0x31e4, 0x31ef,
+ 0x321f, 0x321f,
+ 0x32ff, 0x32ff,
+ 0x4db6, 0x4dbf,
+ 0x9fcd, 0x9fff,
+ 0xa48d, 0xa48f,
+ 0xa4c7, 0xa4cf,
+ 0xa62c, 0xa63f,
+ 0xa698, 0xa69e,
+ 0xa6f8, 0xa6ff,
+ 0xa78f, 0xa78f,
+ 0xa794, 0xa79f,
+ 0xa7ab, 0xa7f7,
+ 0xa82c, 0xa82f,
+ 0xa83a, 0xa83f,
+ 0xa878, 0xa87f,
+ 0xa8c5, 0xa8cd,
+ 0xa8da, 0xa8df,
+ 0xa8fc, 0xa8ff,
+ 0xa954, 0xa95e,
+ 0xa97d, 0xa97f,
+ 0xa9ce, 0xa9ce,
+ 0xa9da, 0xa9dd,
+ 0xa9e0, 0xa9ff,
+ 0xaa37, 0xaa3f,
+ 0xaa4e, 0xaa4f,
+ 0xaa5a, 0xaa5b,
+ 0xaa7c, 0xaa7f,
+ 0xaac3, 0xaada,
+ 0xaaf7, 0xab00,
+ 0xab07, 0xab08,
+ 0xab0f, 0xab10,
+ 0xab17, 0xab1f,
+ 0xab27, 0xab27,
+ 0xab2f, 0xabbf,
+ 0xabee, 0xabef,
+ 0xabfa, 0xabff,
+ 0xd7a4, 0xd7af,
+ 0xd7c7, 0xd7ca,
+ 0xd7fc, 0xf8ff,
+ 0xfa6e, 0xfa6f,
+ 0xfada, 0xfaff,
+ 0xfb07, 0xfb12,
+ 0xfb18, 0xfb1c,
+ 0xfb37, 0xfb37,
+ 0xfb3d, 0xfb3d,
+ 0xfb3f, 0xfb3f,
+ 0xfb42, 0xfb42,
+ 0xfb45, 0xfb45,
+ 0xfbc2, 0xfbd2,
+ 0xfd40, 0xfd4f,
+ 0xfd90, 0xfd91,
+ 0xfdc8, 0xfdef,
+ 0xfdfe, 0xfdff,
+ 0xfe1a, 0xfe1f,
+ 0xfe27, 0xfe2f,
+ 0xfe53, 0xfe53,
+ 0xfe67, 0xfe67,
+ 0xfe6c, 0xfe6f,
+ 0xfe75, 0xfe75,
+ 0xfefd, 0xff00,
+ 0xffbf, 0xffc1,
+ 0xffc8, 0xffc9,
+ 0xffd0, 0xffd1,
+ 0xffd8, 0xffd9,
+ 0xffdd, 0xffdf,
+ 0xffe7, 0xffe7,
+ 0xffef, 0xfffb,
+ 0xfffe, 0xffff,
+ 0x1000c, 0x1000c,
+ 0x10027, 0x10027,
+ 0x1003b, 0x1003b,
+ 0x1003e, 0x1003e,
+ 0x1004e, 0x1004f,
+ 0x1005e, 0x1007f,
+ 0x100fb, 0x100ff,
+ 0x10103, 0x10106,
+ 0x10134, 0x10136,
+ 0x1018b, 0x1018f,
+ 0x1019c, 0x101cf,
+ 0x101fe, 0x1027f,
+ 0x1029d, 0x1029f,
+ 0x102d1, 0x102ff,
+ 0x1031f, 0x1031f,
+ 0x10324, 0x1032f,
+ 0x1034b, 0x1037f,
+ 0x1039e, 0x1039e,
+ 0x103c4, 0x103c7,
+ 0x103d6, 0x103ff,
+ 0x1049e, 0x1049f,
+ 0x104aa, 0x107ff,
+ 0x10806, 0x10807,
+ 0x10809, 0x10809,
+ 0x10836, 0x10836,
+ 0x10839, 0x1083b,
+ 0x1083d, 0x1083e,
+ 0x10856, 0x10856,
+ 0x10860, 0x108ff,
+ 0x1091c, 0x1091e,
+ 0x1093a, 0x1093e,
+ 0x10940, 0x1097f,
+ 0x109b8, 0x109bd,
+ 0x109c0, 0x109ff,
+ 0x10a04, 0x10a04,
+ 0x10a07, 0x10a0b,
+ 0x10a14, 0x10a14,
+ 0x10a18, 0x10a18,
+ 0x10a34, 0x10a37,
+ 0x10a3b, 0x10a3e,
+ 0x10a48, 0x10a4f,
+ 0x10a59, 0x10a5f,
+ 0x10a80, 0x10aff,
+ 0x10b36, 0x10b38,
+ 0x10b56, 0x10b57,
+ 0x10b73, 0x10b77,
+ 0x10b80, 0x10bff,
+ 0x10c49, 0x10e5f,
+ 0x10e7f, 0x10fff,
+ 0x1104e, 0x11051,
+ 0x11070, 0x1107f,
0x110bd, 0x110bd,
+ 0x110c2, 0x110cf,
+ 0x110e9, 0x110ef,
+ 0x110fa, 0x110ff,
+ 0x11135, 0x11135,
+ 0x11144, 0x1117f,
+ 0x111c9, 0x111cf,
+ 0x111da, 0x1167f,
+ 0x116b8, 0x116bf,
+ 0x116ca, 0x11fff,
+ 0x1236f, 0x123ff,
+ 0x12463, 0x1246f,
+ 0x12474, 0x12fff,
+ 0x1342f, 0x167ff,
+ 0x16a39, 0x16eff,
+ 0x16f45, 0x16f4f,
+ 0x16f7f, 0x16f8e,
+ 0x16fa0, 0x1afff,
+ 0x1b002, 0x1cfff,
+ 0x1d0f6, 0x1d0ff,
+ 0x1d127, 0x1d128,
0x1d173, 0x1d17a,
- 0xe0001, 0xe0001,
- 0xe0020, 0xe007f,
- 0xf0000, 0xffffd,
- 0x100000, 0x10ffff,
+ 0x1d1de, 0x1d1ff,
+ 0x1d246, 0x1d2ff,
+ 0x1d357, 0x1d35f,
+ 0x1d372, 0x1d3ff,
+ 0x1d455, 0x1d455,
+ 0x1d49d, 0x1d49d,
+ 0x1d4a0, 0x1d4a1,
+ 0x1d4a3, 0x1d4a4,
+ 0x1d4a7, 0x1d4a8,
+ 0x1d4ad, 0x1d4ad,
+ 0x1d4ba, 0x1d4ba,
+ 0x1d4bc, 0x1d4bc,
+ 0x1d4c4, 0x1d4c4,
+ 0x1d506, 0x1d506,
+ 0x1d50b, 0x1d50c,
+ 0x1d515, 0x1d515,
+ 0x1d51d, 0x1d51d,
+ 0x1d53a, 0x1d53a,
+ 0x1d53f, 0x1d53f,
+ 0x1d545, 0x1d545,
+ 0x1d547, 0x1d549,
+ 0x1d551, 0x1d551,
+ 0x1d6a6, 0x1d6a7,
+ 0x1d7cc, 0x1d7cd,
+ 0x1d800, 0x1edff,
+ 0x1ee04, 0x1ee04,
+ 0x1ee20, 0x1ee20,
+ 0x1ee23, 0x1ee23,
+ 0x1ee25, 0x1ee26,
+ 0x1ee28, 0x1ee28,
+ 0x1ee33, 0x1ee33,
+ 0x1ee38, 0x1ee38,
+ 0x1ee3a, 0x1ee3a,
+ 0x1ee3c, 0x1ee41,
+ 0x1ee43, 0x1ee46,
+ 0x1ee48, 0x1ee48,
+ 0x1ee4a, 0x1ee4a,
+ 0x1ee4c, 0x1ee4c,
+ 0x1ee50, 0x1ee50,
+ 0x1ee53, 0x1ee53,
+ 0x1ee55, 0x1ee56,
+ 0x1ee58, 0x1ee58,
+ 0x1ee5a, 0x1ee5a,
+ 0x1ee5c, 0x1ee5c,
+ 0x1ee5e, 0x1ee5e,
+ 0x1ee60, 0x1ee60,
+ 0x1ee63, 0x1ee63,
+ 0x1ee65, 0x1ee66,
+ 0x1ee6b, 0x1ee6b,
+ 0x1ee73, 0x1ee73,
+ 0x1ee78, 0x1ee78,
+ 0x1ee7d, 0x1ee7d,
+ 0x1ee7f, 0x1ee7f,
+ 0x1ee8a, 0x1ee8a,
+ 0x1ee9c, 0x1eea0,
+ 0x1eea4, 0x1eea4,
+ 0x1eeaa, 0x1eeaa,
+ 0x1eebc, 0x1eeef,
+ 0x1eef2, 0x1efff,
+ 0x1f02c, 0x1f02f,
+ 0x1f094, 0x1f09f,
+ 0x1f0af, 0x1f0b0,
+ 0x1f0bf, 0x1f0c0,
+ 0x1f0d0, 0x1f0d0,
+ 0x1f0e0, 0x1f0ff,
+ 0x1f10b, 0x1f10f,
+ 0x1f12f, 0x1f12f,
+ 0x1f16c, 0x1f16f,
+ 0x1f19b, 0x1f1e5,
+ 0x1f203, 0x1f20f,
+ 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,
+ 0x2a6d7, 0x2a6ff,
+ 0x2b735, 0x2b73f,
+ 0x2b81e, 0x2f7ff,
+ 0x2fa1e, 0xe00ff,
+ 0xe01f0, 0x10ffff,
}; /* CR_C */
/* 'Cc': General Category */
-static const OnigCodePoint CR_Cc[] = {
- 2,
- 0x0000, 0x001f,
- 0x007f, 0x009f,
-}; /* CR_Cc */
+#define CR_Cc CR_Cntrl
/* 'Cf': General Category */
static const OnigCodePoint CR_Cf[] = {
- 15,
+ 14,
0x00ad, 0x00ad,
- 0x0600, 0x0603,
+ 0x0600, 0x0604,
0x06dd, 0x06dd,
0x070f, 0x070f,
- 0x17b4, 0x17b5,
0x200b, 0x200f,
0x202a, 0x202e,
0x2060, 0x2064,
@@ -604,7 +5424,7 @@ static const OnigCodePoint CR_Cf[] = {
/* 'Cn': General Category */
static const OnigCodePoint CR_Cn[] = {
- 501,
+ 539,
0x0378, 0x0379,
0x037f, 0x0383,
0x038b, 0x038b,
@@ -614,11 +5434,12 @@ static const OnigCodePoint CR_Cn[] = {
0x0557, 0x0558,
0x0560, 0x0560,
0x0588, 0x0588,
- 0x058b, 0x0590,
+ 0x058b, 0x058e,
+ 0x0590, 0x0590,
0x05c8, 0x05cf,
0x05eb, 0x05ef,
0x05f5, 0x05ff,
- 0x0604, 0x0605,
+ 0x0605, 0x0605,
0x061c, 0x061d,
0x070e, 0x070e,
0x074b, 0x074c,
@@ -627,7 +5448,10 @@ static const OnigCodePoint CR_Cn[] = {
0x082e, 0x082f,
0x083f, 0x083f,
0x085c, 0x085d,
- 0x085f, 0x08ff,
+ 0x085f, 0x089f,
+ 0x08a1, 0x08a1,
+ 0x08ad, 0x08e3,
+ 0x08ff, 0x08ff,
0x0978, 0x0978,
0x0980, 0x0980,
0x0984, 0x0984,
@@ -672,7 +5496,6 @@ static const OnigCodePoint CR_Cn[] = {
0x0ace, 0x0acf,
0x0ad1, 0x0adf,
0x0ae4, 0x0ae5,
- 0x0af0, 0x0af0,
0x0af2, 0x0b00,
0x0b04, 0x0b04,
0x0b0d, 0x0b0e,
@@ -773,15 +5596,16 @@ static const OnigCodePoint CR_Cn[] = {
0x0ec7, 0x0ec7,
0x0ece, 0x0ecf,
0x0eda, 0x0edb,
- 0x0ede, 0x0eff,
+ 0x0ee0, 0x0eff,
0x0f48, 0x0f48,
0x0f6d, 0x0f70,
0x0f98, 0x0f98,
0x0fbd, 0x0fbd,
0x0fcd, 0x0fcd,
0x0fdb, 0x0fff,
- 0x10c6, 0x10cf,
- 0x10fd, 0x10ff,
+ 0x10c6, 0x10c6,
+ 0x10c8, 0x10cc,
+ 0x10ce, 0x10cf,
0x1249, 0x1249,
0x124e, 0x124f,
0x1257, 0x1257,
@@ -835,13 +5659,12 @@ static const OnigCodePoint CR_Cn[] = {
0x1aae, 0x1aff,
0x1b4c, 0x1b4f,
0x1b7d, 0x1b7f,
- 0x1bab, 0x1bad,
- 0x1bba, 0x1bbf,
0x1bf4, 0x1bfb,
0x1c38, 0x1c3a,
0x1c4a, 0x1c4c,
- 0x1c80, 0x1ccf,
- 0x1cf3, 0x1cff,
+ 0x1c80, 0x1cbf,
+ 0x1cc8, 0x1ccf,
+ 0x1cf7, 0x1cff,
0x1de7, 0x1dfb,
0x1f16, 0x1f17,
0x1f1e, 0x1f1f,
@@ -870,15 +5693,15 @@ static const OnigCodePoint CR_Cn[] = {
0x2427, 0x243f,
0x244b, 0x245f,
0x2700, 0x2700,
- 0x27cb, 0x27cb,
- 0x27cd, 0x27cd,
0x2b4d, 0x2b4f,
0x2b5a, 0x2bff,
0x2c2f, 0x2c2f,
0x2c5f, 0x2c5f,
- 0x2cf2, 0x2cf8,
- 0x2d26, 0x2d2f,
- 0x2d66, 0x2d6e,
+ 0x2cf4, 0x2cf8,
+ 0x2d26, 0x2d26,
+ 0x2d28, 0x2d2c,
+ 0x2d2e, 0x2d2f,
+ 0x2d68, 0x2d6e,
0x2d71, 0x2d7e,
0x2d97, 0x2d9f,
0x2da7, 0x2da7,
@@ -889,7 +5712,7 @@ static const OnigCodePoint CR_Cn[] = {
0x2dcf, 0x2dcf,
0x2dd7, 0x2dd7,
0x2ddf, 0x2ddf,
- 0x2e32, 0x2e7f,
+ 0x2e3c, 0x2e7f,
0x2e9a, 0x2e9a,
0x2ef4, 0x2eff,
0x2fd6, 0x2fef,
@@ -904,16 +5727,15 @@ static const OnigCodePoint CR_Cn[] = {
0x321f, 0x321f,
0x32ff, 0x32ff,
0x4db6, 0x4dbf,
- 0x9fcc, 0x9fff,
+ 0x9fcd, 0x9fff,
0xa48d, 0xa48f,
0xa4c7, 0xa4cf,
0xa62c, 0xa63f,
- 0xa674, 0xa67b,
- 0xa698, 0xa69f,
+ 0xa698, 0xa69e,
0xa6f8, 0xa6ff,
0xa78f, 0xa78f,
- 0xa792, 0xa79f,
- 0xa7aa, 0xa7f9,
+ 0xa794, 0xa79f,
+ 0xa7ab, 0xa7f7,
0xa82c, 0xa82f,
0xa83a, 0xa83f,
0xa878, 0xa87f,
@@ -930,7 +5752,7 @@ static const OnigCodePoint CR_Cn[] = {
0xaa5a, 0xaa5b,
0xaa7c, 0xaa7f,
0xaac3, 0xaada,
- 0xaae0, 0xab00,
+ 0xaaf7, 0xab00,
0xab07, 0xab08,
0xab0f, 0xab10,
0xab17, 0xab1f,
@@ -941,7 +5763,6 @@ static const OnigCodePoint CR_Cn[] = {
0xd7a4, 0xd7af,
0xd7c7, 0xd7ca,
0xd7fc, 0xd7ff,
- 0xfa2e, 0xfa2f,
0xfa6e, 0xfa6f,
0xfada, 0xfaff,
0xfb07, 0xfb12,
@@ -1003,7 +5824,9 @@ static const OnigCodePoint CR_Cn[] = {
0x10860, 0x108ff,
0x1091c, 0x1091e,
0x1093a, 0x1093e,
- 0x10940, 0x109ff,
+ 0x10940, 0x1097f,
+ 0x109b8, 0x109bd,
+ 0x109c0, 0x109ff,
0x10a04, 0x10a04,
0x10a07, 0x10a0b,
0x10a14, 0x10a14,
@@ -1021,12 +5844,23 @@ static const OnigCodePoint CR_Cn[] = {
0x10e7f, 0x10fff,
0x1104e, 0x11051,
0x11070, 0x1107f,
- 0x110c2, 0x11fff,
+ 0x110c2, 0x110cf,
+ 0x110e9, 0x110ef,
+ 0x110fa, 0x110ff,
+ 0x11135, 0x11135,
+ 0x11144, 0x1117f,
+ 0x111c9, 0x111cf,
+ 0x111da, 0x1167f,
+ 0x116b8, 0x116bf,
+ 0x116ca, 0x11fff,
0x1236f, 0x123ff,
0x12463, 0x1246f,
0x12474, 0x12fff,
0x1342f, 0x167ff,
- 0x16a39, 0x1afff,
+ 0x16a39, 0x16eff,
+ 0x16f45, 0x16f4f,
+ 0x16f7f, 0x16f8e,
+ 0x16fa0, 0x1afff,
0x1b002, 0x1cfff,
0x1d0f6, 0x1d0ff,
0x1d127, 0x1d128,
@@ -1054,7 +5888,41 @@ static const OnigCodePoint CR_Cn[] = {
0x1d551, 0x1d551,
0x1d6a6, 0x1d6a7,
0x1d7cc, 0x1d7cd,
- 0x1d800, 0x1efff,
+ 0x1d800, 0x1edff,
+ 0x1ee04, 0x1ee04,
+ 0x1ee20, 0x1ee20,
+ 0x1ee23, 0x1ee23,
+ 0x1ee25, 0x1ee26,
+ 0x1ee28, 0x1ee28,
+ 0x1ee33, 0x1ee33,
+ 0x1ee38, 0x1ee38,
+ 0x1ee3a, 0x1ee3a,
+ 0x1ee3c, 0x1ee41,
+ 0x1ee43, 0x1ee46,
+ 0x1ee48, 0x1ee48,
+ 0x1ee4a, 0x1ee4a,
+ 0x1ee4c, 0x1ee4c,
+ 0x1ee50, 0x1ee50,
+ 0x1ee53, 0x1ee53,
+ 0x1ee55, 0x1ee56,
+ 0x1ee58, 0x1ee58,
+ 0x1ee5a, 0x1ee5a,
+ 0x1ee5c, 0x1ee5c,
+ 0x1ee5e, 0x1ee5e,
+ 0x1ee60, 0x1ee60,
+ 0x1ee63, 0x1ee63,
+ 0x1ee65, 0x1ee66,
+ 0x1ee6b, 0x1ee6b,
+ 0x1ee73, 0x1ee73,
+ 0x1ee78, 0x1ee78,
+ 0x1ee7d, 0x1ee7d,
+ 0x1ee7f, 0x1ee7f,
+ 0x1ee8a, 0x1ee8a,
+ 0x1ee9c, 0x1eea0,
+ 0x1eea4, 0x1eea4,
+ 0x1eeaa, 0x1eeaa,
+ 0x1eebc, 0x1eeef,
+ 0x1eef2, 0x1efff,
0x1f02c, 0x1f02f,
0x1f094, 0x1f09f,
0x1f0af, 0x1f0b0,
@@ -1063,7 +5931,7 @@ static const OnigCodePoint CR_Cn[] = {
0x1f0e0, 0x1f0ff,
0x1f10b, 0x1f10f,
0x1f12f, 0x1f12f,
- 0x1f16a, 0x1f16f,
+ 0x1f16c, 0x1f16f,
0x1f19b, 0x1f1e5,
0x1f203, 0x1f20f,
0x1f23b, 0x1f23f,
@@ -1080,19 +5948,9 @@ static const OnigCodePoint CR_Cn[] = {
0x1f441, 0x1f441,
0x1f4f8, 0x1f4f8,
0x1f4fd, 0x1f4ff,
- 0x1f53e, 0x1f54f,
+ 0x1f53e, 0x1f53f,
+ 0x1f544, 0x1f54f,
0x1f568, 0x1f5fa,
- 0x1f600, 0x1f600,
- 0x1f611, 0x1f611,
- 0x1f615, 0x1f615,
- 0x1f617, 0x1f617,
- 0x1f619, 0x1f619,
- 0x1f61b, 0x1f61b,
- 0x1f61f, 0x1f61f,
- 0x1f626, 0x1f627,
- 0x1f62c, 0x1f62c,
- 0x1f62e, 0x1f62f,
- 0x1f634, 0x1f634,
0x1f641, 0x1f644,
0x1f650, 0x1f67f,
0x1f6c6, 0x1f6ff,
@@ -1124,7 +5982,7 @@ static const OnigCodePoint CR_Cs[] = {
/* 'L': Major Category */
static const OnigCodePoint CR_L[] = {
- 435,
+ 486,
0x0041, 0x005a,
0x0061, 0x007a,
0x00aa, 0x00aa,
@@ -1172,6 +6030,8 @@ static const OnigCodePoint CR_L[] = {
0x0824, 0x0824,
0x0828, 0x0828,
0x0840, 0x0858,
+ 0x08a0, 0x08a0,
+ 0x08a2, 0x08ac,
0x0904, 0x0939,
0x093d, 0x093d,
0x0950, 0x0950,
@@ -1277,7 +6137,7 @@ static const OnigCodePoint CR_L[] = {
0x0ebd, 0x0ebd,
0x0ec0, 0x0ec4,
0x0ec6, 0x0ec6,
- 0x0edc, 0x0edd,
+ 0x0edc, 0x0edf,
0x0f00, 0x0f00,
0x0f40, 0x0f47,
0x0f49, 0x0f6c,
@@ -1292,9 +6152,10 @@ static const OnigCodePoint CR_L[] = {
0x1075, 0x1081,
0x108e, 0x108e,
0x10a0, 0x10c5,
+ 0x10c7, 0x10c7,
+ 0x10cd, 0x10cd,
0x10d0, 0x10fa,
- 0x10fc, 0x10fc,
- 0x1100, 0x1248,
+ 0x10fc, 0x1248,
0x124a, 0x124d,
0x1250, 0x1256,
0x1258, 0x1258,
@@ -1341,12 +6202,13 @@ static const OnigCodePoint CR_L[] = {
0x1b45, 0x1b4b,
0x1b83, 0x1ba0,
0x1bae, 0x1baf,
- 0x1bc0, 0x1be5,
+ 0x1bba, 0x1be5,
0x1c00, 0x1c23,
0x1c4d, 0x1c4f,
0x1c5a, 0x1c7d,
0x1ce9, 0x1cec,
0x1cee, 0x1cf1,
+ 0x1cf5, 0x1cf6,
0x1d00, 0x1dbf,
0x1e00, 0x1f15,
0x1f18, 0x1f1d,
@@ -1388,8 +6250,11 @@ static const OnigCodePoint CR_L[] = {
0x2c30, 0x2c5e,
0x2c60, 0x2ce4,
0x2ceb, 0x2cee,
+ 0x2cf2, 0x2cf3,
0x2d00, 0x2d25,
- 0x2d30, 0x2d65,
+ 0x2d27, 0x2d27,
+ 0x2d2d, 0x2d2d,
+ 0x2d30, 0x2d67,
0x2d6f, 0x2d6f,
0x2d80, 0x2d96,
0x2da0, 0x2da6,
@@ -1413,7 +6278,7 @@ static const OnigCodePoint CR_L[] = {
0x31a0, 0x31ba,
0x31f0, 0x31ff,
0x3400, 0x4db5,
- 0x4e00, 0x9fcb,
+ 0x4e00, 0x9fcc,
0xa000, 0xa48c,
0xa4d0, 0xa4fd,
0xa500, 0xa60c,
@@ -1425,9 +6290,9 @@ static const OnigCodePoint CR_L[] = {
0xa717, 0xa71f,
0xa722, 0xa788,
0xa78b, 0xa78e,
- 0xa790, 0xa791,
- 0xa7a0, 0xa7a9,
- 0xa7fa, 0xa801,
+ 0xa790, 0xa793,
+ 0xa7a0, 0xa7aa,
+ 0xa7f8, 0xa801,
0xa803, 0xa805,
0xa807, 0xa80a,
0xa80c, 0xa822,
@@ -1452,6 +6317,8 @@ static const OnigCodePoint CR_L[] = {
0xaac0, 0xaac0,
0xaac2, 0xaac2,
0xaadb, 0xaadd,
+ 0xaae0, 0xaaea,
+ 0xaaf2, 0xaaf4,
0xab01, 0xab06,
0xab09, 0xab0e,
0xab11, 0xab16,
@@ -1461,8 +6328,7 @@ static const OnigCodePoint CR_L[] = {
0xac00, 0xd7a3,
0xd7b0, 0xd7c6,
0xd7cb, 0xd7fb,
- 0xf900, 0xfa2d,
- 0xfa30, 0xfa6d,
+ 0xf900, 0xfa6d,
0xfa70, 0xfad9,
0xfb00, 0xfb06,
0xfb13, 0xfb17,
@@ -1511,6 +6377,8 @@ static const OnigCodePoint CR_L[] = {
0x1083f, 0x10855,
0x10900, 0x10915,
0x10920, 0x10939,
+ 0x10980, 0x109b7,
+ 0x109be, 0x109bf,
0x10a00, 0x10a00,
0x10a10, 0x10a13,
0x10a15, 0x10a17,
@@ -1522,9 +6390,17 @@ static const OnigCodePoint CR_L[] = {
0x10c00, 0x10c48,
0x11003, 0x11037,
0x11083, 0x110af,
+ 0x110d0, 0x110e8,
+ 0x11103, 0x11126,
+ 0x11183, 0x111b2,
+ 0x111c1, 0x111c4,
+ 0x11680, 0x116aa,
0x12000, 0x1236e,
0x13000, 0x1342e,
0x16800, 0x16a38,
+ 0x16f00, 0x16f44,
+ 0x16f50, 0x16f50,
+ 0x16f93, 0x16f9f,
0x1b000, 0x1b001,
0x1d400, 0x1d454,
0x1d456, 0x1d49c,
@@ -1556,19 +6432,168 @@ static const OnigCodePoint CR_L[] = {
0x1d78a, 0x1d7a8,
0x1d7aa, 0x1d7c2,
0x1d7c4, 0x1d7cb,
+ 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,
0x20000, 0x2a6d6,
0x2a700, 0x2b734,
0x2b740, 0x2b81d,
0x2f800, 0x2fa1d,
}; /* CR_L */
+/* 'LC': General Category */
+static const OnigCodePoint CR_LC[] = {
+ 113,
+ 0x0041, 0x005a,
+ 0x0061, 0x007a,
+ 0x00b5, 0x00b5,
+ 0x00c0, 0x00d6,
+ 0x00d8, 0x00f6,
+ 0x00f8, 0x01ba,
+ 0x01bc, 0x01bf,
+ 0x01c4, 0x0293,
+ 0x0295, 0x02af,
+ 0x0370, 0x0373,
+ 0x0376, 0x0377,
+ 0x037b, 0x037d,
+ 0x0386, 0x0386,
+ 0x0388, 0x038a,
+ 0x038c, 0x038c,
+ 0x038e, 0x03a1,
+ 0x03a3, 0x03f5,
+ 0x03f7, 0x0481,
+ 0x048a, 0x0527,
+ 0x0531, 0x0556,
+ 0x0561, 0x0587,
+ 0x10a0, 0x10c5,
+ 0x10c7, 0x10c7,
+ 0x10cd, 0x10cd,
+ 0x1d00, 0x1d2b,
+ 0x1d6b, 0x1d77,
+ 0x1d79, 0x1d9a,
+ 0x1e00, 0x1f15,
+ 0x1f18, 0x1f1d,
+ 0x1f20, 0x1f45,
+ 0x1f48, 0x1f4d,
+ 0x1f50, 0x1f57,
+ 0x1f59, 0x1f59,
+ 0x1f5b, 0x1f5b,
+ 0x1f5d, 0x1f5d,
+ 0x1f5f, 0x1f7d,
+ 0x1f80, 0x1fb4,
+ 0x1fb6, 0x1fbc,
+ 0x1fbe, 0x1fbe,
+ 0x1fc2, 0x1fc4,
+ 0x1fc6, 0x1fcc,
+ 0x1fd0, 0x1fd3,
+ 0x1fd6, 0x1fdb,
+ 0x1fe0, 0x1fec,
+ 0x1ff2, 0x1ff4,
+ 0x1ff6, 0x1ffc,
+ 0x2102, 0x2102,
+ 0x2107, 0x2107,
+ 0x210a, 0x2113,
+ 0x2115, 0x2115,
+ 0x2119, 0x211d,
+ 0x2124, 0x2124,
+ 0x2126, 0x2126,
+ 0x2128, 0x2128,
+ 0x212a, 0x212d,
+ 0x212f, 0x2134,
+ 0x2139, 0x2139,
+ 0x213c, 0x213f,
+ 0x2145, 0x2149,
+ 0x214e, 0x214e,
+ 0x2183, 0x2184,
+ 0x2c00, 0x2c2e,
+ 0x2c30, 0x2c5e,
+ 0x2c60, 0x2c7b,
+ 0x2c7e, 0x2ce4,
+ 0x2ceb, 0x2cee,
+ 0x2cf2, 0x2cf3,
+ 0x2d00, 0x2d25,
+ 0x2d27, 0x2d27,
+ 0x2d2d, 0x2d2d,
+ 0xa640, 0xa66d,
+ 0xa680, 0xa697,
+ 0xa722, 0xa76f,
+ 0xa771, 0xa787,
+ 0xa78b, 0xa78e,
+ 0xa790, 0xa793,
+ 0xa7a0, 0xa7aa,
+ 0xa7fa, 0xa7fa,
+ 0xfb00, 0xfb06,
+ 0xfb13, 0xfb17,
+ 0xff21, 0xff3a,
+ 0xff41, 0xff5a,
+ 0x10400, 0x1044f,
+ 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, 0x1d6c0,
+ 0x1d6c2, 0x1d6da,
+ 0x1d6dc, 0x1d6fa,
+ 0x1d6fc, 0x1d714,
+ 0x1d716, 0x1d734,
+ 0x1d736, 0x1d74e,
+ 0x1d750, 0x1d76e,
+ 0x1d770, 0x1d788,
+ 0x1d78a, 0x1d7a8,
+ 0x1d7aa, 0x1d7c2,
+ 0x1d7c4, 0x1d7cb,
+}; /* CR_LC */
+
/* 'Ll': General Category */
static const OnigCodePoint CR_Ll[] = {
- 609,
+ 611,
0x0061, 0x007a,
- 0x00aa, 0x00aa,
0x00b5, 0x00b5,
- 0x00ba, 0x00ba,
0x00df, 0x00f6,
0x00f8, 0x00ff,
0x0101, 0x0101,
@@ -1834,7 +6859,7 @@ static const OnigCodePoint CR_Ll[] = {
0x0527, 0x0527,
0x0561, 0x0587,
0x1d00, 0x1d2b,
- 0x1d62, 0x1d77,
+ 0x1d6b, 0x1d77,
0x1d79, 0x1d9a,
0x1e01, 0x1e01,
0x1e03, 0x1e03,
@@ -1998,7 +7023,7 @@ static const OnigCodePoint CR_Ll[] = {
0x2c6c, 0x2c6c,
0x2c71, 0x2c71,
0x2c73, 0x2c74,
- 0x2c76, 0x2c7c,
+ 0x2c76, 0x2c7b,
0x2c81, 0x2c81,
0x2c83, 0x2c83,
0x2c85, 0x2c85,
@@ -2051,7 +7076,10 @@ static const OnigCodePoint CR_Ll[] = {
0x2ce3, 0x2ce4,
0x2cec, 0x2cec,
0x2cee, 0x2cee,
+ 0x2cf3, 0x2cf3,
0x2d00, 0x2d25,
+ 0x2d27, 0x2d27,
+ 0x2d2d, 0x2d2d,
0xa641, 0xa641,
0xa643, 0xa643,
0xa645, 0xa645,
@@ -2136,6 +7164,7 @@ static const OnigCodePoint CR_Ll[] = {
0xa78c, 0xa78c,
0xa78e, 0xa78e,
0xa791, 0xa791,
+ 0xa793, 0xa793,
0xa7a1, 0xa7a1,
0xa7a3, 0xa7a3,
0xa7a5, 0xa7a5,
@@ -2178,7 +7207,7 @@ static const OnigCodePoint CR_Ll[] = {
/* 'Lm': General Category */
static const OnigCodePoint CR_Lm[] = {
- 49,
+ 52,
0x02b0, 0x02c1,
0x02c6, 0x02d1,
0x02e0, 0x02e4,
@@ -2202,13 +7231,13 @@ static const OnigCodePoint CR_Lm[] = {
0x1843, 0x1843,
0x1aa7, 0x1aa7,
0x1c78, 0x1c7d,
- 0x1d2c, 0x1d61,
+ 0x1d2c, 0x1d6a,
0x1d78, 0x1d78,
0x1d9b, 0x1dbf,
0x2071, 0x2071,
0x207f, 0x207f,
0x2090, 0x209c,
- 0x2c7d, 0x2c7d,
+ 0x2c7c, 0x2c7d,
0x2d6f, 0x2d6f,
0x2e2f, 0x2e2f,
0x3005, 0x3005,
@@ -2223,16 +7252,21 @@ static const OnigCodePoint CR_Lm[] = {
0xa717, 0xa71f,
0xa770, 0xa770,
0xa788, 0xa788,
+ 0xa7f8, 0xa7f9,
0xa9cf, 0xa9cf,
0xaa70, 0xaa70,
0xaadd, 0xaadd,
+ 0xaaf3, 0xaaf4,
0xff70, 0xff70,
0xff9e, 0xff9f,
+ 0x16f93, 0x16f9f,
}; /* CR_Lm */
/* 'Lo': General Category */
static const OnigCodePoint CR_Lo[] = {
- 323,
+ 371,
+ 0x00aa, 0x00aa,
+ 0x00ba, 0x00ba,
0x01bb, 0x01bb,
0x01c0, 0x01c3,
0x0294, 0x0294,
@@ -2253,6 +7287,8 @@ static const OnigCodePoint CR_Lo[] = {
0x07ca, 0x07ea,
0x0800, 0x0815,
0x0840, 0x0858,
+ 0x08a0, 0x08a0,
+ 0x08a2, 0x08ac,
0x0904, 0x0939,
0x093d, 0x093d,
0x0950, 0x0950,
@@ -2357,7 +7393,7 @@ static const OnigCodePoint CR_Lo[] = {
0x0eb2, 0x0eb3,
0x0ebd, 0x0ebd,
0x0ec0, 0x0ec4,
- 0x0edc, 0x0edd,
+ 0x0edc, 0x0edf,
0x0f00, 0x0f00,
0x0f40, 0x0f47,
0x0f49, 0x0f6c,
@@ -2372,7 +7408,7 @@ static const OnigCodePoint CR_Lo[] = {
0x1075, 0x1081,
0x108e, 0x108e,
0x10d0, 0x10fa,
- 0x1100, 0x1248,
+ 0x10fd, 0x1248,
0x124a, 0x124d,
0x1250, 0x1256,
0x1258, 0x1258,
@@ -2418,14 +7454,15 @@ static const OnigCodePoint CR_Lo[] = {
0x1b45, 0x1b4b,
0x1b83, 0x1ba0,
0x1bae, 0x1baf,
- 0x1bc0, 0x1be5,
+ 0x1bba, 0x1be5,
0x1c00, 0x1c23,
0x1c4d, 0x1c4f,
0x1c5a, 0x1c77,
0x1ce9, 0x1cec,
0x1cee, 0x1cf1,
+ 0x1cf5, 0x1cf6,
0x2135, 0x2138,
- 0x2d30, 0x2d65,
+ 0x2d30, 0x2d67,
0x2d80, 0x2d96,
0x2da0, 0x2da6,
0x2da8, 0x2dae,
@@ -2446,7 +7483,7 @@ static const OnigCodePoint CR_Lo[] = {
0x31a0, 0x31ba,
0x31f0, 0x31ff,
0x3400, 0x4db5,
- 0x4e00, 0x9fcb,
+ 0x4e00, 0x9fcc,
0xa000, 0xa014,
0xa016, 0xa48c,
0xa4d0, 0xa4f7,
@@ -2480,6 +7517,8 @@ static const OnigCodePoint CR_Lo[] = {
0xaac0, 0xaac0,
0xaac2, 0xaac2,
0xaadb, 0xaadc,
+ 0xaae0, 0xaaea,
+ 0xaaf2, 0xaaf2,
0xab01, 0xab06,
0xab09, 0xab0e,
0xab11, 0xab16,
@@ -2489,8 +7528,7 @@ static const OnigCodePoint CR_Lo[] = {
0xac00, 0xd7a3,
0xd7b0, 0xd7c6,
0xd7cb, 0xd7fb,
- 0xf900, 0xfa2d,
- 0xfa30, 0xfa6d,
+ 0xf900, 0xfa6d,
0xfa70, 0xfad9,
0xfb1d, 0xfb1d,
0xfb1f, 0xfb28,
@@ -2537,6 +7575,8 @@ static const OnigCodePoint CR_Lo[] = {
0x1083f, 0x10855,
0x10900, 0x10915,
0x10920, 0x10939,
+ 0x10980, 0x109b7,
+ 0x109be, 0x109bf,
0x10a00, 0x10a00,
0x10a10, 0x10a13,
0x10a15, 0x10a17,
@@ -2548,10 +7588,50 @@ static const OnigCodePoint CR_Lo[] = {
0x10c00, 0x10c48,
0x11003, 0x11037,
0x11083, 0x110af,
+ 0x110d0, 0x110e8,
+ 0x11103, 0x11126,
+ 0x11183, 0x111b2,
+ 0x111c1, 0x111c4,
+ 0x11680, 0x116aa,
0x12000, 0x1236e,
0x13000, 0x1342e,
0x16800, 0x16a38,
+ 0x16f00, 0x16f44,
+ 0x16f50, 0x16f50,
0x1b000, 0x1b001,
+ 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,
0x20000, 0x2a6d6,
0x2a700, 0x2b734,
0x2b740, 0x2b81d,
@@ -2575,7 +7655,7 @@ static const OnigCodePoint CR_Lt[] = {
/* 'Lu': General Category */
static const OnigCodePoint CR_Lu[] = {
- 603,
+ 608,
0x0041, 0x005a,
0x00c0, 0x00d6,
0x00d8, 0x00de,
@@ -2844,6 +7924,8 @@ static const OnigCodePoint CR_Lu[] = {
0x0526, 0x0526,
0x0531, 0x0556,
0x10a0, 0x10c5,
+ 0x10c7, 0x10c7,
+ 0x10cd, 0x10cd,
0x1e00, 0x1e00,
0x1e02, 0x1e02,
0x1e04, 0x1e04,
@@ -3058,6 +8140,7 @@ static const OnigCodePoint CR_Lu[] = {
0x2ce2, 0x2ce2,
0x2ceb, 0x2ceb,
0x2ced, 0x2ced,
+ 0x2cf2, 0x2cf2,
0xa640, 0xa640,
0xa642, 0xa642,
0xa644, 0xa644,
@@ -3141,11 +8224,13 @@ static const OnigCodePoint CR_Lu[] = {
0xa78b, 0xa78b,
0xa78d, 0xa78d,
0xa790, 0xa790,
+ 0xa792, 0xa792,
0xa7a0, 0xa7a0,
0xa7a2, 0xa7a2,
0xa7a4, 0xa7a4,
0xa7a6, 0xa7a6,
0xa7a8, 0xa7a8,
+ 0xa7aa, 0xa7aa,
0xff21, 0xff3a,
0x10400, 0x10427,
0x1d400, 0x1d419,
@@ -3183,7 +8268,7 @@ static const OnigCodePoint CR_Lu[] = {
/* 'M': Major Category */
static const OnigCodePoint CR_M[] = {
- 193,
+ 204,
0x0300, 0x036f,
0x0483, 0x0489,
0x0591, 0x05bd,
@@ -3207,6 +8292,7 @@ static const OnigCodePoint CR_M[] = {
0x0825, 0x0827,
0x0829, 0x082d,
0x0859, 0x085b,
+ 0x08e4, 0x08fe,
0x0900, 0x0903,
0x093a, 0x093c,
0x093e, 0x094f,
@@ -3301,7 +8387,7 @@ static const OnigCodePoint CR_M[] = {
0x1732, 0x1734,
0x1752, 0x1753,
0x1772, 0x1773,
- 0x17b6, 0x17d3,
+ 0x17b4, 0x17d3,
0x17dd, 0x17dd,
0x180b, 0x180d,
0x18a9, 0x18a9,
@@ -3317,13 +8403,13 @@ static const OnigCodePoint CR_M[] = {
0x1b34, 0x1b44,
0x1b6b, 0x1b73,
0x1b80, 0x1b82,
- 0x1ba1, 0x1baa,
+ 0x1ba1, 0x1bad,
0x1be6, 0x1bf3,
0x1c24, 0x1c37,
0x1cd0, 0x1cd2,
0x1cd4, 0x1ce8,
0x1ced, 0x1ced,
- 0x1cf2, 0x1cf2,
+ 0x1cf2, 0x1cf4,
0x1dc0, 0x1de6,
0x1dfc, 0x1dff,
0x20d0, 0x20f0,
@@ -3333,7 +8419,8 @@ static const OnigCodePoint CR_M[] = {
0x302a, 0x302f,
0x3099, 0x309a,
0xa66f, 0xa672,
- 0xa67c, 0xa67d,
+ 0xa674, 0xa67d,
+ 0xa69f, 0xa69f,
0xa6f0, 0xa6f1,
0xa802, 0xa802,
0xa806, 0xa806,
@@ -3355,6 +8442,8 @@ static const OnigCodePoint CR_M[] = {
0xaab7, 0xaab8,
0xaabe, 0xaabf,
0xaac1, 0xaac1,
+ 0xaaeb, 0xaaef,
+ 0xaaf5, 0xaaf6,
0xabe3, 0xabea,
0xabec, 0xabed,
0xfb1e, 0xfb1e,
@@ -3370,6 +8459,13 @@ static const OnigCodePoint CR_M[] = {
0x11038, 0x11046,
0x11080, 0x11082,
0x110b0, 0x110ba,
+ 0x11100, 0x11102,
+ 0x11127, 0x11134,
+ 0x11180, 0x11182,
+ 0x111b3, 0x111c0,
+ 0x116ab, 0x116b7,
+ 0x16f51, 0x16f7e,
+ 0x16f8f, 0x16f92,
0x1d165, 0x1d169,
0x1d16d, 0x1d172,
0x1d17b, 0x1d182,
@@ -3381,7 +8477,7 @@ static const OnigCodePoint CR_M[] = {
/* 'Mc': General Category */
static const OnigCodePoint CR_Mc[] = {
- 113,
+ 126,
0x0903, 0x0903,
0x093b, 0x093b,
0x093e, 0x0940,
@@ -3463,6 +8559,7 @@ static const OnigCodePoint CR_Mc[] = {
0x1ba1, 0x1ba1,
0x1ba6, 0x1ba7,
0x1baa, 0x1baa,
+ 0x1bac, 0x1bad,
0x1be7, 0x1be7,
0x1bea, 0x1bec,
0x1bee, 0x1bee,
@@ -3470,7 +8567,8 @@ static const OnigCodePoint CR_Mc[] = {
0x1c24, 0x1c2b,
0x1c34, 0x1c35,
0x1ce1, 0x1ce1,
- 0x1cf2, 0x1cf2,
+ 0x1cf2, 0x1cf3,
+ 0x302e, 0x302f,
0xa823, 0xa824,
0xa827, 0xa827,
0xa880, 0xa881,
@@ -3484,6 +8582,9 @@ static const OnigCodePoint CR_Mc[] = {
0xaa33, 0xaa34,
0xaa4d, 0xaa4d,
0xaa7b, 0xaa7b,
+ 0xaaeb, 0xaaeb,
+ 0xaaee, 0xaaef,
+ 0xaaf5, 0xaaf5,
0xabe3, 0xabe4,
0xabe6, 0xabe7,
0xabe9, 0xabea,
@@ -3493,6 +8594,14 @@ static const OnigCodePoint CR_Mc[] = {
0x11082, 0x11082,
0x110b0, 0x110b2,
0x110b7, 0x110b8,
+ 0x1112c, 0x1112c,
+ 0x11182, 0x11182,
+ 0x111b3, 0x111b5,
+ 0x111bf, 0x111c0,
+ 0x116ac, 0x116ac,
+ 0x116ae, 0x116af,
+ 0x116b6, 0x116b6,
+ 0x16f51, 0x16f7e,
0x1d165, 0x1d166,
0x1d16d, 0x1d172,
}; /* CR_Mc */
@@ -3508,7 +8617,7 @@ static const OnigCodePoint CR_Me[] = {
/* 'Mn': General Category */
static const OnigCodePoint CR_Mn[] = {
- 203,
+ 220,
0x0300, 0x036f,
0x0483, 0x0487,
0x0591, 0x05bd,
@@ -3532,6 +8641,7 @@ static const OnigCodePoint CR_Mn[] = {
0x0825, 0x0827,
0x0829, 0x082d,
0x0859, 0x085b,
+ 0x08e4, 0x08fe,
0x0900, 0x0902,
0x093a, 0x093a,
0x093c, 0x093c,
@@ -3617,6 +8727,7 @@ static const OnigCodePoint CR_Mn[] = {
0x1732, 0x1734,
0x1752, 0x1753,
0x1772, 0x1773,
+ 0x17b4, 0x17b5,
0x17b7, 0x17bd,
0x17c6, 0x17c6,
0x17c9, 0x17d3,
@@ -3644,6 +8755,7 @@ static const OnigCodePoint CR_Mn[] = {
0x1b80, 0x1b81,
0x1ba2, 0x1ba5,
0x1ba8, 0x1ba9,
+ 0x1bab, 0x1bab,
0x1be6, 0x1be6,
0x1be8, 0x1be9,
0x1bed, 0x1bed,
@@ -3654,6 +8766,7 @@ static const OnigCodePoint CR_Mn[] = {
0x1cd4, 0x1ce0,
0x1ce2, 0x1ce8,
0x1ced, 0x1ced,
+ 0x1cf4, 0x1cf4,
0x1dc0, 0x1de6,
0x1dfc, 0x1dff,
0x20d0, 0x20dc,
@@ -3662,10 +8775,11 @@ static const OnigCodePoint CR_Mn[] = {
0x2cef, 0x2cf1,
0x2d7f, 0x2d7f,
0x2de0, 0x2dff,
- 0x302a, 0x302f,
+ 0x302a, 0x302d,
0x3099, 0x309a,
0xa66f, 0xa66f,
- 0xa67c, 0xa67d,
+ 0xa674, 0xa67d,
+ 0xa69f, 0xa69f,
0xa6f0, 0xa6f1,
0xa802, 0xa802,
0xa806, 0xa806,
@@ -3689,6 +8803,8 @@ static const OnigCodePoint CR_Mn[] = {
0xaab7, 0xaab8,
0xaabe, 0xaabf,
0xaac1, 0xaac1,
+ 0xaaec, 0xaaed,
+ 0xaaf6, 0xaaf6,
0xabe5, 0xabe5,
0xabe8, 0xabe8,
0xabed, 0xabed,
@@ -3706,6 +8822,16 @@ static const OnigCodePoint CR_Mn[] = {
0x11080, 0x11081,
0x110b3, 0x110b6,
0x110b9, 0x110ba,
+ 0x11100, 0x11102,
+ 0x11127, 0x1112b,
+ 0x1112d, 0x11134,
+ 0x11180, 0x11181,
+ 0x111b6, 0x111be,
+ 0x116ab, 0x116ab,
+ 0x116ad, 0x116ad,
+ 0x116b0, 0x116b5,
+ 0x116b7, 0x116b7,
+ 0x16f8f, 0x16f92,
0x1d167, 0x1d169,
0x1d17b, 0x1d182,
0x1d185, 0x1d18b,
@@ -3716,7 +8842,7 @@ static const OnigCodePoint CR_Mn[] = {
/* 'N': Major Category */
static const OnigCodePoint CR_N[] = {
- 83,
+ 88,
0x0030, 0x0039,
0x00b2, 0x00b3,
0x00b9, 0x00b9,
@@ -3768,6 +8894,7 @@ static const OnigCodePoint CR_N[] = {
0x3038, 0x303a,
0x3192, 0x3195,
0x3220, 0x3229,
+ 0x3248, 0x324f,
0x3251, 0x325f,
0x3280, 0x3289,
0x32b1, 0x32bf,
@@ -3796,6 +8923,10 @@ static const OnigCodePoint CR_N[] = {
0x10b78, 0x10b7f,
0x10e60, 0x10e7e,
0x11052, 0x1106f,
+ 0x110f0, 0x110f9,
+ 0x11136, 0x1113f,
+ 0x111d0, 0x111d9,
+ 0x116c0, 0x116c9,
0x12400, 0x12462,
0x1d360, 0x1d371,
0x1d7ce, 0x1d7ff,
@@ -3803,47 +8934,7 @@ static const OnigCodePoint CR_N[] = {
}; /* CR_N */
/* 'Nd': General Category */
-static const OnigCodePoint CR_Nd[] = {
- 38,
- 0x0030, 0x0039,
- 0x0660, 0x0669,
- 0x06f0, 0x06f9,
- 0x07c0, 0x07c9,
- 0x0966, 0x096f,
- 0x09e6, 0x09ef,
- 0x0a66, 0x0a6f,
- 0x0ae6, 0x0aef,
- 0x0b66, 0x0b6f,
- 0x0be6, 0x0bef,
- 0x0c66, 0x0c6f,
- 0x0ce6, 0x0cef,
- 0x0d66, 0x0d6f,
- 0x0e50, 0x0e59,
- 0x0ed0, 0x0ed9,
- 0x0f20, 0x0f29,
- 0x1040, 0x1049,
- 0x1090, 0x1099,
- 0x17e0, 0x17e9,
- 0x1810, 0x1819,
- 0x1946, 0x194f,
- 0x19d0, 0x19d9,
- 0x1a80, 0x1a89,
- 0x1a90, 0x1a99,
- 0x1b50, 0x1b59,
- 0x1bb0, 0x1bb9,
- 0x1c40, 0x1c49,
- 0x1c50, 0x1c59,
- 0xa620, 0xa629,
- 0xa8d0, 0xa8d9,
- 0xa900, 0xa909,
- 0xa9d0, 0xa9d9,
- 0xaa50, 0xaa59,
- 0xabf0, 0xabf9,
- 0xff10, 0xff19,
- 0x104a0, 0x104a9,
- 0x11066, 0x1106f,
- 0x1d7ce, 0x1d7ff,
-}; /* CR_Nd */
+#define CR_Nd CR_Digit
/* 'Nl': General Category */
static const OnigCodePoint CR_Nl[] = {
@@ -3864,7 +8955,7 @@ static const OnigCodePoint CR_Nl[] = {
/* 'No': General Category */
static const OnigCodePoint CR_No[] = {
- 41,
+ 42,
0x00b2, 0x00b3,
0x00b9, 0x00b9,
0x00bc, 0x00be,
@@ -3888,6 +8979,7 @@ static const OnigCodePoint CR_No[] = {
0x2cfd, 0x2cfd,
0x3192, 0x3195,
0x3220, 0x3229,
+ 0x3248, 0x324f,
0x3251, 0x325f,
0x3280, 0x3289,
0x32b1, 0x32bf,
@@ -3909,142 +9001,7 @@ static const OnigCodePoint CR_No[] = {
}; /* CR_No */
/* 'P': Major Category */
-static const OnigCodePoint CR_P[] = {
- 133,
- 0x0021, 0x0023,
- 0x0025, 0x002a,
- 0x002c, 0x002f,
- 0x003a, 0x003b,
- 0x003f, 0x0040,
- 0x005b, 0x005d,
- 0x005f, 0x005f,
- 0x007b, 0x007b,
- 0x007d, 0x007d,
- 0x00a1, 0x00a1,
- 0x00ab, 0x00ab,
- 0x00b7, 0x00b7,
- 0x00bb, 0x00bb,
- 0x00bf, 0x00bf,
- 0x037e, 0x037e,
- 0x0387, 0x0387,
- 0x055a, 0x055f,
- 0x0589, 0x058a,
- 0x05be, 0x05be,
- 0x05c0, 0x05c0,
- 0x05c3, 0x05c3,
- 0x05c6, 0x05c6,
- 0x05f3, 0x05f4,
- 0x0609, 0x060a,
- 0x060c, 0x060d,
- 0x061b, 0x061b,
- 0x061e, 0x061f,
- 0x066a, 0x066d,
- 0x06d4, 0x06d4,
- 0x0700, 0x070d,
- 0x07f7, 0x07f9,
- 0x0830, 0x083e,
- 0x085e, 0x085e,
- 0x0964, 0x0965,
- 0x0970, 0x0970,
- 0x0df4, 0x0df4,
- 0x0e4f, 0x0e4f,
- 0x0e5a, 0x0e5b,
- 0x0f04, 0x0f12,
- 0x0f3a, 0x0f3d,
- 0x0f85, 0x0f85,
- 0x0fd0, 0x0fd4,
- 0x0fd9, 0x0fda,
- 0x104a, 0x104f,
- 0x10fb, 0x10fb,
- 0x1361, 0x1368,
- 0x1400, 0x1400,
- 0x166d, 0x166e,
- 0x169b, 0x169c,
- 0x16eb, 0x16ed,
- 0x1735, 0x1736,
- 0x17d4, 0x17d6,
- 0x17d8, 0x17da,
- 0x1800, 0x180a,
- 0x1944, 0x1945,
- 0x1a1e, 0x1a1f,
- 0x1aa0, 0x1aa6,
- 0x1aa8, 0x1aad,
- 0x1b5a, 0x1b60,
- 0x1bfc, 0x1bff,
- 0x1c3b, 0x1c3f,
- 0x1c7e, 0x1c7f,
- 0x1cd3, 0x1cd3,
- 0x2010, 0x2027,
- 0x2030, 0x2043,
- 0x2045, 0x2051,
- 0x2053, 0x205e,
- 0x207d, 0x207e,
- 0x208d, 0x208e,
- 0x2329, 0x232a,
- 0x2768, 0x2775,
- 0x27c5, 0x27c6,
- 0x27e6, 0x27ef,
- 0x2983, 0x2998,
- 0x29d8, 0x29db,
- 0x29fc, 0x29fd,
- 0x2cf9, 0x2cfc,
- 0x2cfe, 0x2cff,
- 0x2d70, 0x2d70,
- 0x2e00, 0x2e2e,
- 0x2e30, 0x2e31,
- 0x3001, 0x3003,
- 0x3008, 0x3011,
- 0x3014, 0x301f,
- 0x3030, 0x3030,
- 0x303d, 0x303d,
- 0x30a0, 0x30a0,
- 0x30fb, 0x30fb,
- 0xa4fe, 0xa4ff,
- 0xa60d, 0xa60f,
- 0xa673, 0xa673,
- 0xa67e, 0xa67e,
- 0xa6f2, 0xa6f7,
- 0xa874, 0xa877,
- 0xa8ce, 0xa8cf,
- 0xa8f8, 0xa8fa,
- 0xa92e, 0xa92f,
- 0xa95f, 0xa95f,
- 0xa9c1, 0xa9cd,
- 0xa9de, 0xa9df,
- 0xaa5c, 0xaa5f,
- 0xaade, 0xaadf,
- 0xabeb, 0xabeb,
- 0xfd3e, 0xfd3f,
- 0xfe10, 0xfe19,
- 0xfe30, 0xfe52,
- 0xfe54, 0xfe61,
- 0xfe63, 0xfe63,
- 0xfe68, 0xfe68,
- 0xfe6a, 0xfe6b,
- 0xff01, 0xff03,
- 0xff05, 0xff0a,
- 0xff0c, 0xff0f,
- 0xff1a, 0xff1b,
- 0xff1f, 0xff20,
- 0xff3b, 0xff3d,
- 0xff3f, 0xff3f,
- 0xff5b, 0xff5b,
- 0xff5d, 0xff5d,
- 0xff5f, 0xff65,
- 0x10100, 0x10101,
- 0x1039f, 0x1039f,
- 0x103d0, 0x103d0,
- 0x10857, 0x10857,
- 0x1091f, 0x1091f,
- 0x1093f, 0x1093f,
- 0x10a50, 0x10a58,
- 0x10a7f, 0x10a7f,
- 0x10b39, 0x10b3f,
- 0x11047, 0x1104d,
- 0x110bb, 0x110bc,
- 0x110be, 0x110c1,
- 0x12470, 0x12473,
-}; /* CR_P */
+#define CR_P CR_Punct
/* 'Pc': General Category */
static const OnigCodePoint CR_Pc[] = {
@@ -4059,7 +9016,7 @@ static const OnigCodePoint CR_Pc[] = {
/* 'Pd': General Category */
static const OnigCodePoint CR_Pd[] = {
- 15,
+ 16,
0x002d, 0x002d,
0x058a, 0x058a,
0x05be, 0x05be,
@@ -4068,6 +9025,7 @@ static const OnigCodePoint CR_Pd[] = {
0x2010, 0x2015,
0x2e17, 0x2e17,
0x2e1a, 0x2e1a,
+ 0x2e3a, 0x2e3b,
0x301c, 0x301c,
0x3030, 0x3030,
0x30a0, 0x30a0,
@@ -4185,7 +9143,7 @@ static const OnigCodePoint CR_Pi[] = {
/* 'Po': General Category */
static const OnigCodePoint CR_Po[] = {
- 128,
+ 135,
0x0021, 0x0023,
0x0025, 0x0027,
0x002a, 0x002a,
@@ -4195,7 +9153,8 @@ static const OnigCodePoint CR_Po[] = {
0x003f, 0x0040,
0x005c, 0x005c,
0x00a1, 0x00a1,
- 0x00b7, 0x00b7,
+ 0x00a7, 0x00a7,
+ 0x00b6, 0x00b7,
0x00bf, 0x00bf,
0x037e, 0x037e,
0x0387, 0x0387,
@@ -4217,16 +9176,18 @@ static const OnigCodePoint CR_Po[] = {
0x085e, 0x085e,
0x0964, 0x0965,
0x0970, 0x0970,
+ 0x0af0, 0x0af0,
0x0df4, 0x0df4,
0x0e4f, 0x0e4f,
0x0e5a, 0x0e5b,
0x0f04, 0x0f12,
+ 0x0f14, 0x0f14,
0x0f85, 0x0f85,
0x0fd0, 0x0fd4,
0x0fd9, 0x0fda,
0x104a, 0x104f,
0x10fb, 0x10fb,
- 0x1361, 0x1368,
+ 0x1360, 0x1368,
0x166d, 0x166e,
0x16eb, 0x16ed,
0x1735, 0x1736,
@@ -4242,6 +9203,7 @@ static const OnigCodePoint CR_Po[] = {
0x1bfc, 0x1bff,
0x1c3b, 0x1c3f,
0x1c7e, 0x1c7f,
+ 0x1cc0, 0x1cc7,
0x1cd3, 0x1cd3,
0x2016, 0x2017,
0x2020, 0x2027,
@@ -4262,7 +9224,7 @@ static const OnigCodePoint CR_Po[] = {
0x2e1b, 0x2e1b,
0x2e1e, 0x2e1f,
0x2e2a, 0x2e2e,
- 0x2e30, 0x2e31,
+ 0x2e30, 0x2e39,
0x3001, 0x3003,
0x303d, 0x303d,
0x30fb, 0x30fb,
@@ -4280,6 +9242,7 @@ static const OnigCodePoint CR_Po[] = {
0xa9de, 0xa9df,
0xaa5c, 0xaa5f,
0xaade, 0xaadf,
+ 0xaaf0, 0xaaf1,
0xabeb, 0xabeb,
0xfe10, 0xfe16,
0xfe19, 0xfe19,
@@ -4301,7 +9264,7 @@ static const OnigCodePoint CR_Po[] = {
0xff3c, 0xff3c,
0xff61, 0xff61,
0xff64, 0xff65,
- 0x10100, 0x10101,
+ 0x10100, 0x10102,
0x1039f, 0x1039f,
0x103d0, 0x103d0,
0x10857, 0x10857,
@@ -4313,6 +9276,8 @@ static const OnigCodePoint CR_Po[] = {
0x11047, 0x1104d,
0x110bb, 0x110bc,
0x110be, 0x110c1,
+ 0x11140, 0x11143,
+ 0x111c5, 0x111c8,
0x12470, 0x12473,
}; /* CR_Po */
@@ -4395,7 +9360,7 @@ static const OnigCodePoint CR_Ps[] = {
/* 'S': Major Category */
static const OnigCodePoint CR_S[] = {
- 208,
+ 198,
0x0024, 0x0024,
0x002b, 0x002b,
0x003c, 0x003e,
@@ -4403,11 +9368,11 @@ static const OnigCodePoint CR_S[] = {
0x0060, 0x0060,
0x007c, 0x007c,
0x007e, 0x007e,
- 0x00a2, 0x00a9,
+ 0x00a2, 0x00a6,
+ 0x00a8, 0x00a9,
0x00ac, 0x00ac,
0x00ae, 0x00b1,
0x00b4, 0x00b4,
- 0x00b6, 0x00b6,
0x00b8, 0x00b8,
0x00d7, 0x00d7,
0x00f7, 0x00f7,
@@ -4420,6 +9385,7 @@ static const OnigCodePoint CR_S[] = {
0x0384, 0x0385,
0x03f6, 0x03f6,
0x0482, 0x0482,
+ 0x058f, 0x058f,
0x0606, 0x0608,
0x060b, 0x060b,
0x060e, 0x060f,
@@ -4436,7 +9402,8 @@ static const OnigCodePoint CR_S[] = {
0x0d79, 0x0d79,
0x0e3f, 0x0e3f,
0x0f01, 0x0f03,
- 0x0f13, 0x0f17,
+ 0x0f13, 0x0f13,
+ 0x0f15, 0x0f17,
0x0f1a, 0x0f1f,
0x0f34, 0x0f34,
0x0f36, 0x0f36,
@@ -4446,7 +9413,6 @@ static const OnigCodePoint CR_S[] = {
0x0fce, 0x0fcf,
0x0fd5, 0x0fd8,
0x109e, 0x109f,
- 0x1360, 0x1360,
0x1390, 0x1399,
0x17db, 0x17db,
0x1940, 0x1940,
@@ -4486,9 +9452,7 @@ static const OnigCodePoint CR_S[] = {
0x2500, 0x26ff,
0x2701, 0x2767,
0x2794, 0x27c4,
- 0x27c7, 0x27ca,
- 0x27cc, 0x27cc,
- 0x27ce, 0x27e5,
+ 0x27c7, 0x27e5,
0x27f0, 0x2982,
0x2999, 0x29d7,
0x29dc, 0x29fb,
@@ -4509,7 +9473,8 @@ static const OnigCodePoint CR_S[] = {
0x3196, 0x319f,
0x31c0, 0x31e3,
0x3200, 0x321e,
- 0x322a, 0x3250,
+ 0x322a, 0x3247,
+ 0x3250, 0x3250,
0x3260, 0x327f,
0x328a, 0x32b0,
0x32c0, 0x32fe,
@@ -4538,7 +9503,6 @@ static const OnigCodePoint CR_S[] = {
0xffe0, 0xffe6,
0xffe8, 0xffee,
0xfffc, 0xfffd,
- 0x10102, 0x10102,
0x10137, 0x1013f,
0x10179, 0x10189,
0x10190, 0x1019b,
@@ -4563,6 +9527,7 @@ static const OnigCodePoint CR_S[] = {
0x1d789, 0x1d789,
0x1d7a9, 0x1d7a9,
0x1d7c3, 0x1d7c3,
+ 0x1eef0, 0x1eef1,
0x1f000, 0x1f02b,
0x1f030, 0x1f093,
0x1f0a0, 0x1f0ae,
@@ -4570,7 +9535,7 @@ static const OnigCodePoint CR_S[] = {
0x1f0c1, 0x1f0cf,
0x1f0d1, 0x1f0df,
0x1f110, 0x1f12e,
- 0x1f130, 0x1f169,
+ 0x1f130, 0x1f16b,
0x1f170, 0x1f19a,
0x1f1e6, 0x1f202,
0x1f210, 0x1f23a,
@@ -4588,19 +9553,9 @@ static const OnigCodePoint CR_S[] = {
0x1f442, 0x1f4f7,
0x1f4f9, 0x1f4fc,
0x1f500, 0x1f53d,
+ 0x1f540, 0x1f543,
0x1f550, 0x1f567,
- 0x1f5fb, 0x1f5ff,
- 0x1f601, 0x1f610,
- 0x1f612, 0x1f614,
- 0x1f616, 0x1f616,
- 0x1f618, 0x1f618,
- 0x1f61a, 0x1f61a,
- 0x1f61c, 0x1f61e,
- 0x1f620, 0x1f625,
- 0x1f628, 0x1f62b,
- 0x1f62d, 0x1f62d,
- 0x1f630, 0x1f633,
- 0x1f635, 0x1f640,
+ 0x1f5fb, 0x1f640,
0x1f645, 0x1f64f,
0x1f680, 0x1f6c5,
0x1f700, 0x1f773,
@@ -4608,9 +9563,10 @@ static const OnigCodePoint CR_S[] = {
/* 'Sc': General Category */
static const OnigCodePoint CR_Sc[] = {
- 16,
+ 17,
0x0024, 0x0024,
0x00a2, 0x00a5,
+ 0x058f, 0x058f,
0x060b, 0x060b,
0x09f2, 0x09f3,
0x09fb, 0x09fb,
@@ -4661,7 +9617,7 @@ static const OnigCodePoint CR_Sk[] = {
/* 'Sm': General Category */
static const OnigCodePoint CR_Sm[] = {
- 66,
+ 65,
0x002b, 0x002b,
0x003c, 0x003e,
0x007c, 0x007c,
@@ -4699,9 +9655,7 @@ static const OnigCodePoint CR_Sm[] = {
0x25f8, 0x25ff,
0x266f, 0x266f,
0x27c0, 0x27c4,
- 0x27c7, 0x27ca,
- 0x27cc, 0x27cc,
- 0x27ce, 0x27e5,
+ 0x27c7, 0x27e5,
0x27f0, 0x27ff,
0x2900, 0x2982,
0x2999, 0x29d7,
@@ -4728,16 +9682,16 @@ static const OnigCodePoint CR_Sm[] = {
0x1d789, 0x1d789,
0x1d7a9, 0x1d7a9,
0x1d7c3, 0x1d7c3,
+ 0x1eef0, 0x1eef1,
}; /* CR_Sm */
/* 'So': General Category */
static const OnigCodePoint CR_So[] = {
- 164,
- 0x00a6, 0x00a7,
+ 153,
+ 0x00a6, 0x00a6,
0x00a9, 0x00a9,
0x00ae, 0x00ae,
0x00b0, 0x00b0,
- 0x00b6, 0x00b6,
0x0482, 0x0482,
0x060e, 0x060f,
0x06de, 0x06de,
@@ -4751,7 +9705,8 @@ static const OnigCodePoint CR_So[] = {
0x0c7f, 0x0c7f,
0x0d79, 0x0d79,
0x0f01, 0x0f03,
- 0x0f13, 0x0f17,
+ 0x0f13, 0x0f13,
+ 0x0f15, 0x0f17,
0x0f1a, 0x0f1f,
0x0f34, 0x0f34,
0x0f36, 0x0f36,
@@ -4761,7 +9716,6 @@ static const OnigCodePoint CR_So[] = {
0x0fce, 0x0fcf,
0x0fd5, 0x0fd8,
0x109e, 0x109f,
- 0x1360, 0x1360,
0x1390, 0x1399,
0x1940, 0x1940,
0x19de, 0x19ff,
@@ -4825,7 +9779,8 @@ static const OnigCodePoint CR_So[] = {
0x3196, 0x319f,
0x31c0, 0x31e3,
0x3200, 0x321e,
- 0x322a, 0x3250,
+ 0x322a, 0x3247,
+ 0x3250, 0x3250,
0x3260, 0x327f,
0x328a, 0x32b0,
0x32c0, 0x32fe,
@@ -4841,7 +9796,6 @@ static const OnigCodePoint CR_So[] = {
0xffe8, 0xffe8,
0xffed, 0xffee,
0xfffc, 0xfffd,
- 0x10102, 0x10102,
0x10137, 0x1013f,
0x10179, 0x10189,
0x10190, 0x1019b,
@@ -4863,7 +9817,7 @@ static const OnigCodePoint CR_So[] = {
0x1f0c1, 0x1f0cf,
0x1f0d1, 0x1f0df,
0x1f110, 0x1f12e,
- 0x1f130, 0x1f169,
+ 0x1f130, 0x1f16b,
0x1f170, 0x1f19a,
0x1f1e6, 0x1f202,
0x1f210, 0x1f23a,
@@ -4881,19 +9835,9 @@ static const OnigCodePoint CR_So[] = {
0x1f442, 0x1f4f7,
0x1f4f9, 0x1f4fc,
0x1f500, 0x1f53d,
+ 0x1f540, 0x1f543,
0x1f550, 0x1f567,
- 0x1f5fb, 0x1f5ff,
- 0x1f601, 0x1f610,
- 0x1f612, 0x1f614,
- 0x1f616, 0x1f616,
- 0x1f618, 0x1f618,
- 0x1f61a, 0x1f61a,
- 0x1f61c, 0x1f61e,
- 0x1f620, 0x1f625,
- 0x1f628, 0x1f62b,
- 0x1f62d, 0x1f62d,
- 0x1f630, 0x1f633,
- 0x1f635, 0x1f640,
+ 0x1f5fb, 0x1f640,
0x1f645, 0x1f64f,
0x1f680, 0x1f6c5,
0x1f700, 0x1f773,
@@ -4940,7 +9884,7 @@ static const OnigCodePoint CR_Zs[] = {
/* 'Math': Derived Property */
static const OnigCodePoint CR_Math[] = {
- 106,
+ 138,
0x002b, 0x002b,
0x003c, 0x003e,
0x005e, 0x005e,
@@ -5009,9 +9953,7 @@ static const OnigCodePoint CR_Math[] = {
0x2642, 0x2642,
0x2660, 0x2663,
0x266d, 0x266f,
- 0x27c0, 0x27ca,
- 0x27cc, 0x27cc,
- 0x27ce, 0x27ff,
+ 0x27c0, 0x27ff,
0x2900, 0x2aff,
0x2b30, 0x2b44,
0x2b47, 0x2b4c,
@@ -5047,1729 +9989,54 @@ static const OnigCodePoint CR_Math[] = {
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,
}; /* CR_Math */
/* 'Alphabetic': Derived Property */
-static const OnigCodePoint CR_Alphabetic[] = {
- 486,
- 0x0041, 0x005a,
- 0x0061, 0x007a,
- 0x00aa, 0x00aa,
- 0x00b5, 0x00b5,
- 0x00ba, 0x00ba,
- 0x00c0, 0x00d6,
- 0x00d8, 0x00f6,
- 0x00f8, 0x02c1,
- 0x02c6, 0x02d1,
- 0x02e0, 0x02e4,
- 0x02ec, 0x02ec,
- 0x02ee, 0x02ee,
- 0x0345, 0x0345,
- 0x0370, 0x0374,
- 0x0376, 0x0377,
- 0x037a, 0x037d,
- 0x0386, 0x0386,
- 0x0388, 0x038a,
- 0x038c, 0x038c,
- 0x038e, 0x03a1,
- 0x03a3, 0x03f5,
- 0x03f7, 0x0481,
- 0x048a, 0x0527,
- 0x0531, 0x0556,
- 0x0559, 0x0559,
- 0x0561, 0x0587,
- 0x05b0, 0x05bd,
- 0x05bf, 0x05bf,
- 0x05c1, 0x05c2,
- 0x05c4, 0x05c5,
- 0x05c7, 0x05c7,
- 0x05d0, 0x05ea,
- 0x05f0, 0x05f2,
- 0x0610, 0x061a,
- 0x0620, 0x0657,
- 0x0659, 0x065f,
- 0x066e, 0x06d3,
- 0x06d5, 0x06dc,
- 0x06e1, 0x06e8,
- 0x06ed, 0x06ef,
- 0x06fa, 0x06fc,
- 0x06ff, 0x06ff,
- 0x0710, 0x073f,
- 0x074d, 0x07b1,
- 0x07ca, 0x07ea,
- 0x07f4, 0x07f5,
- 0x07fa, 0x07fa,
- 0x0800, 0x0817,
- 0x081a, 0x082c,
- 0x0840, 0x0858,
- 0x0900, 0x093b,
- 0x093d, 0x094c,
- 0x094e, 0x0950,
- 0x0955, 0x0963,
- 0x0971, 0x0977,
- 0x0979, 0x097f,
- 0x0981, 0x0983,
- 0x0985, 0x098c,
- 0x098f, 0x0990,
- 0x0993, 0x09a8,
- 0x09aa, 0x09b0,
- 0x09b2, 0x09b2,
- 0x09b6, 0x09b9,
- 0x09bd, 0x09c4,
- 0x09c7, 0x09c8,
- 0x09cb, 0x09cc,
- 0x09ce, 0x09ce,
- 0x09d7, 0x09d7,
- 0x09dc, 0x09dd,
- 0x09df, 0x09e3,
- 0x09f0, 0x09f1,
- 0x0a01, 0x0a03,
- 0x0a05, 0x0a0a,
- 0x0a0f, 0x0a10,
- 0x0a13, 0x0a28,
- 0x0a2a, 0x0a30,
- 0x0a32, 0x0a33,
- 0x0a35, 0x0a36,
- 0x0a38, 0x0a39,
- 0x0a3e, 0x0a42,
- 0x0a47, 0x0a48,
- 0x0a4b, 0x0a4c,
- 0x0a51, 0x0a51,
- 0x0a59, 0x0a5c,
- 0x0a5e, 0x0a5e,
- 0x0a70, 0x0a75,
- 0x0a81, 0x0a83,
- 0x0a85, 0x0a8d,
- 0x0a8f, 0x0a91,
- 0x0a93, 0x0aa8,
- 0x0aaa, 0x0ab0,
- 0x0ab2, 0x0ab3,
- 0x0ab5, 0x0ab9,
- 0x0abd, 0x0ac5,
- 0x0ac7, 0x0ac9,
- 0x0acb, 0x0acc,
- 0x0ad0, 0x0ad0,
- 0x0ae0, 0x0ae3,
- 0x0b01, 0x0b03,
- 0x0b05, 0x0b0c,
- 0x0b0f, 0x0b10,
- 0x0b13, 0x0b28,
- 0x0b2a, 0x0b30,
- 0x0b32, 0x0b33,
- 0x0b35, 0x0b39,
- 0x0b3d, 0x0b44,
- 0x0b47, 0x0b48,
- 0x0b4b, 0x0b4c,
- 0x0b56, 0x0b57,
- 0x0b5c, 0x0b5d,
- 0x0b5f, 0x0b63,
- 0x0b71, 0x0b71,
- 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, 0x0bcc,
- 0x0bd0, 0x0bd0,
- 0x0bd7, 0x0bd7,
- 0x0c01, 0x0c03,
- 0x0c05, 0x0c0c,
- 0x0c0e, 0x0c10,
- 0x0c12, 0x0c28,
- 0x0c2a, 0x0c33,
- 0x0c35, 0x0c39,
- 0x0c3d, 0x0c44,
- 0x0c46, 0x0c48,
- 0x0c4a, 0x0c4c,
- 0x0c55, 0x0c56,
- 0x0c58, 0x0c59,
- 0x0c60, 0x0c63,
- 0x0c82, 0x0c83,
- 0x0c85, 0x0c8c,
- 0x0c8e, 0x0c90,
- 0x0c92, 0x0ca8,
- 0x0caa, 0x0cb3,
- 0x0cb5, 0x0cb9,
- 0x0cbd, 0x0cc4,
- 0x0cc6, 0x0cc8,
- 0x0cca, 0x0ccc,
- 0x0cd5, 0x0cd6,
- 0x0cde, 0x0cde,
- 0x0ce0, 0x0ce3,
- 0x0cf1, 0x0cf2,
- 0x0d02, 0x0d03,
- 0x0d05, 0x0d0c,
- 0x0d0e, 0x0d10,
- 0x0d12, 0x0d3a,
- 0x0d3d, 0x0d44,
- 0x0d46, 0x0d48,
- 0x0d4a, 0x0d4c,
- 0x0d4e, 0x0d4e,
- 0x0d57, 0x0d57,
- 0x0d60, 0x0d63,
- 0x0d7a, 0x0d7f,
- 0x0d82, 0x0d83,
- 0x0d85, 0x0d96,
- 0x0d9a, 0x0db1,
- 0x0db3, 0x0dbb,
- 0x0dbd, 0x0dbd,
- 0x0dc0, 0x0dc6,
- 0x0dcf, 0x0dd4,
- 0x0dd6, 0x0dd6,
- 0x0dd8, 0x0ddf,
- 0x0df2, 0x0df3,
- 0x0e01, 0x0e3a,
- 0x0e40, 0x0e46,
- 0x0e4d, 0x0e4d,
- 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,
- 0x0ecd, 0x0ecd,
- 0x0edc, 0x0edd,
- 0x0f00, 0x0f00,
- 0x0f40, 0x0f47,
- 0x0f49, 0x0f6c,
- 0x0f71, 0x0f81,
- 0x0f88, 0x0f97,
- 0x0f99, 0x0fbc,
- 0x1000, 0x1036,
- 0x1038, 0x1038,
- 0x103b, 0x103f,
- 0x1050, 0x1062,
- 0x1065, 0x1068,
- 0x106e, 0x1086,
- 0x108e, 0x108e,
- 0x109c, 0x109d,
- 0x10a0, 0x10c5,
- 0x10d0, 0x10fa,
- 0x10fc, 0x10fc,
- 0x1100, 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,
- 0x135f, 0x135f,
- 0x1380, 0x138f,
- 0x13a0, 0x13f4,
- 0x1401, 0x166c,
- 0x166f, 0x167f,
- 0x1681, 0x169a,
- 0x16a0, 0x16ea,
- 0x16ee, 0x16f0,
- 0x1700, 0x170c,
- 0x170e, 0x1713,
- 0x1720, 0x1733,
- 0x1740, 0x1753,
- 0x1760, 0x176c,
- 0x176e, 0x1770,
- 0x1772, 0x1773,
- 0x1780, 0x17b3,
- 0x17b6, 0x17c8,
- 0x17d7, 0x17d7,
- 0x17dc, 0x17dc,
- 0x1820, 0x1877,
- 0x1880, 0x18aa,
- 0x18b0, 0x18f5,
- 0x1900, 0x191c,
- 0x1920, 0x192b,
- 0x1930, 0x1938,
- 0x1950, 0x196d,
- 0x1970, 0x1974,
- 0x1980, 0x19ab,
- 0x19b0, 0x19c9,
- 0x1a00, 0x1a1b,
- 0x1a20, 0x1a5e,
- 0x1a61, 0x1a74,
- 0x1aa7, 0x1aa7,
- 0x1b00, 0x1b33,
- 0x1b35, 0x1b43,
- 0x1b45, 0x1b4b,
- 0x1b80, 0x1ba9,
- 0x1bae, 0x1baf,
- 0x1bc0, 0x1be5,
- 0x1be7, 0x1bf1,
- 0x1c00, 0x1c35,
- 0x1c4d, 0x1c4f,
- 0x1c5a, 0x1c7d,
- 0x1ce9, 0x1cec,
- 0x1cee, 0x1cf2,
- 0x1d00, 0x1dbf,
- 0x1e00, 0x1f15,
- 0x1f18, 0x1f1d,
- 0x1f20, 0x1f45,
- 0x1f48, 0x1f4d,
- 0x1f50, 0x1f57,
- 0x1f59, 0x1f59,
- 0x1f5b, 0x1f5b,
- 0x1f5d, 0x1f5d,
- 0x1f5f, 0x1f7d,
- 0x1f80, 0x1fb4,
- 0x1fb6, 0x1fbc,
- 0x1fbe, 0x1fbe,
- 0x1fc2, 0x1fc4,
- 0x1fc6, 0x1fcc,
- 0x1fd0, 0x1fd3,
- 0x1fd6, 0x1fdb,
- 0x1fe0, 0x1fec,
- 0x1ff2, 0x1ff4,
- 0x1ff6, 0x1ffc,
- 0x2071, 0x2071,
- 0x207f, 0x207f,
- 0x2090, 0x209c,
- 0x2102, 0x2102,
- 0x2107, 0x2107,
- 0x210a, 0x2113,
- 0x2115, 0x2115,
- 0x2119, 0x211d,
- 0x2124, 0x2124,
- 0x2126, 0x2126,
- 0x2128, 0x2128,
- 0x212a, 0x212d,
- 0x212f, 0x2139,
- 0x213c, 0x213f,
- 0x2145, 0x2149,
- 0x214e, 0x214e,
- 0x2160, 0x2188,
- 0x24b6, 0x24e9,
- 0x2c00, 0x2c2e,
- 0x2c30, 0x2c5e,
- 0x2c60, 0x2ce4,
- 0x2ceb, 0x2cee,
- 0x2d00, 0x2d25,
- 0x2d30, 0x2d65,
- 0x2d6f, 0x2d6f,
- 0x2d80, 0x2d96,
- 0x2da0, 0x2da6,
- 0x2da8, 0x2dae,
- 0x2db0, 0x2db6,
- 0x2db8, 0x2dbe,
- 0x2dc0, 0x2dc6,
- 0x2dc8, 0x2dce,
- 0x2dd0, 0x2dd6,
- 0x2dd8, 0x2dde,
- 0x2de0, 0x2dff,
- 0x2e2f, 0x2e2f,
- 0x3005, 0x3007,
- 0x3021, 0x3029,
- 0x3031, 0x3035,
- 0x3038, 0x303c,
- 0x3041, 0x3096,
- 0x309d, 0x309f,
- 0x30a1, 0x30fa,
- 0x30fc, 0x30ff,
- 0x3105, 0x312d,
- 0x3131, 0x318e,
- 0x31a0, 0x31ba,
- 0x31f0, 0x31ff,
- 0x3400, 0x4db5,
- 0x4e00, 0x9fcb,
- 0xa000, 0xa48c,
- 0xa4d0, 0xa4fd,
- 0xa500, 0xa60c,
- 0xa610, 0xa61f,
- 0xa62a, 0xa62b,
- 0xa640, 0xa66e,
- 0xa67f, 0xa697,
- 0xa6a0, 0xa6ef,
- 0xa717, 0xa71f,
- 0xa722, 0xa788,
- 0xa78b, 0xa78e,
- 0xa790, 0xa791,
- 0xa7a0, 0xa7a9,
- 0xa7fa, 0xa801,
- 0xa803, 0xa805,
- 0xa807, 0xa80a,
- 0xa80c, 0xa827,
- 0xa840, 0xa873,
- 0xa880, 0xa8c3,
- 0xa8f2, 0xa8f7,
- 0xa8fb, 0xa8fb,
- 0xa90a, 0xa92a,
- 0xa930, 0xa952,
- 0xa960, 0xa97c,
- 0xa980, 0xa9b2,
- 0xa9b4, 0xa9bf,
- 0xa9cf, 0xa9cf,
- 0xaa00, 0xaa36,
- 0xaa40, 0xaa4d,
- 0xaa60, 0xaa76,
- 0xaa7a, 0xaa7a,
- 0xaa80, 0xaabe,
- 0xaac0, 0xaac0,
- 0xaac2, 0xaac2,
- 0xaadb, 0xaadd,
- 0xab01, 0xab06,
- 0xab09, 0xab0e,
- 0xab11, 0xab16,
- 0xab20, 0xab26,
- 0xab28, 0xab2e,
- 0xabc0, 0xabea,
- 0xac00, 0xd7a3,
- 0xd7b0, 0xd7c6,
- 0xd7cb, 0xd7fb,
- 0xf900, 0xfa2d,
- 0xfa30, 0xfa6d,
- 0xfa70, 0xfad9,
- 0xfb00, 0xfb06,
- 0xfb13, 0xfb17,
- 0xfb1d, 0xfb28,
- 0xfb2a, 0xfb36,
- 0xfb38, 0xfb3c,
- 0xfb3e, 0xfb3e,
- 0xfb40, 0xfb41,
- 0xfb43, 0xfb44,
- 0xfb46, 0xfbb1,
- 0xfbd3, 0xfd3d,
- 0xfd50, 0xfd8f,
- 0xfd92, 0xfdc7,
- 0xfdf0, 0xfdfb,
- 0xfe70, 0xfe74,
- 0xfe76, 0xfefc,
- 0xff21, 0xff3a,
- 0xff41, 0xff5a,
- 0xff66, 0xffbe,
- 0xffc2, 0xffc7,
- 0xffca, 0xffcf,
- 0xffd2, 0xffd7,
- 0xffda, 0xffdc,
- 0x10000, 0x1000b,
- 0x1000d, 0x10026,
- 0x10028, 0x1003a,
- 0x1003c, 0x1003d,
- 0x1003f, 0x1004d,
- 0x10050, 0x1005d,
- 0x10080, 0x100fa,
- 0x10140, 0x10174,
- 0x10280, 0x1029c,
- 0x102a0, 0x102d0,
- 0x10300, 0x1031e,
- 0x10330, 0x1034a,
- 0x10380, 0x1039d,
- 0x103a0, 0x103c3,
- 0x103c8, 0x103cf,
- 0x103d1, 0x103d5,
- 0x10400, 0x1049d,
- 0x10800, 0x10805,
- 0x10808, 0x10808,
- 0x1080a, 0x10835,
- 0x10837, 0x10838,
- 0x1083c, 0x1083c,
- 0x1083f, 0x10855,
- 0x10900, 0x10915,
- 0x10920, 0x10939,
- 0x10a00, 0x10a03,
- 0x10a05, 0x10a06,
- 0x10a0c, 0x10a13,
- 0x10a15, 0x10a17,
- 0x10a19, 0x10a33,
- 0x10a60, 0x10a7c,
- 0x10b00, 0x10b35,
- 0x10b40, 0x10b55,
- 0x10b60, 0x10b72,
- 0x10c00, 0x10c48,
- 0x11000, 0x11045,
- 0x11082, 0x110b8,
- 0x12000, 0x1236e,
- 0x12400, 0x12462,
- 0x13000, 0x1342e,
- 0x16800, 0x16a38,
- 0x1b000, 0x1b001,
- 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, 0x1d6c0,
- 0x1d6c2, 0x1d6da,
- 0x1d6dc, 0x1d6fa,
- 0x1d6fc, 0x1d714,
- 0x1d716, 0x1d734,
- 0x1d736, 0x1d74e,
- 0x1d750, 0x1d76e,
- 0x1d770, 0x1d788,
- 0x1d78a, 0x1d7a8,
- 0x1d7aa, 0x1d7c2,
- 0x1d7c4, 0x1d7cb,
- 0x20000, 0x2a6d6,
- 0x2a700, 0x2b734,
- 0x2b740, 0x2b81d,
- 0x2f800, 0x2fa1d,
-}; /* CR_Alphabetic */
+#define CR_Alphabetic CR_Alpha
/* 'Lowercase': Derived Property */
-static const OnigCodePoint CR_Lowercase[] = {
- 612,
- 0x0061, 0x007a,
- 0x00aa, 0x00aa,
- 0x00b5, 0x00b5,
- 0x00ba, 0x00ba,
- 0x00df, 0x00f6,
- 0x00f8, 0x00ff,
- 0x0101, 0x0101,
- 0x0103, 0x0103,
- 0x0105, 0x0105,
- 0x0107, 0x0107,
- 0x0109, 0x0109,
- 0x010b, 0x010b,
- 0x010d, 0x010d,
- 0x010f, 0x010f,
- 0x0111, 0x0111,
- 0x0113, 0x0113,
- 0x0115, 0x0115,
- 0x0117, 0x0117,
- 0x0119, 0x0119,
- 0x011b, 0x011b,
- 0x011d, 0x011d,
- 0x011f, 0x011f,
- 0x0121, 0x0121,
- 0x0123, 0x0123,
- 0x0125, 0x0125,
- 0x0127, 0x0127,
- 0x0129, 0x0129,
- 0x012b, 0x012b,
- 0x012d, 0x012d,
- 0x012f, 0x012f,
- 0x0131, 0x0131,
- 0x0133, 0x0133,
- 0x0135, 0x0135,
- 0x0137, 0x0138,
- 0x013a, 0x013a,
- 0x013c, 0x013c,
- 0x013e, 0x013e,
- 0x0140, 0x0140,
- 0x0142, 0x0142,
- 0x0144, 0x0144,
- 0x0146, 0x0146,
- 0x0148, 0x0149,
- 0x014b, 0x014b,
- 0x014d, 0x014d,
- 0x014f, 0x014f,
- 0x0151, 0x0151,
- 0x0153, 0x0153,
- 0x0155, 0x0155,
- 0x0157, 0x0157,
- 0x0159, 0x0159,
- 0x015b, 0x015b,
- 0x015d, 0x015d,
- 0x015f, 0x015f,
- 0x0161, 0x0161,
- 0x0163, 0x0163,
- 0x0165, 0x0165,
- 0x0167, 0x0167,
- 0x0169, 0x0169,
- 0x016b, 0x016b,
- 0x016d, 0x016d,
- 0x016f, 0x016f,
- 0x0171, 0x0171,
- 0x0173, 0x0173,
- 0x0175, 0x0175,
- 0x0177, 0x0177,
- 0x017a, 0x017a,
- 0x017c, 0x017c,
- 0x017e, 0x0180,
- 0x0183, 0x0183,
- 0x0185, 0x0185,
- 0x0188, 0x0188,
- 0x018c, 0x018d,
- 0x0192, 0x0192,
- 0x0195, 0x0195,
- 0x0199, 0x019b,
- 0x019e, 0x019e,
- 0x01a1, 0x01a1,
- 0x01a3, 0x01a3,
- 0x01a5, 0x01a5,
- 0x01a8, 0x01a8,
- 0x01aa, 0x01ab,
- 0x01ad, 0x01ad,
- 0x01b0, 0x01b0,
- 0x01b4, 0x01b4,
- 0x01b6, 0x01b6,
- 0x01b9, 0x01ba,
- 0x01bd, 0x01bf,
- 0x01c6, 0x01c6,
- 0x01c9, 0x01c9,
- 0x01cc, 0x01cc,
- 0x01ce, 0x01ce,
- 0x01d0, 0x01d0,
- 0x01d2, 0x01d2,
- 0x01d4, 0x01d4,
- 0x01d6, 0x01d6,
- 0x01d8, 0x01d8,
- 0x01da, 0x01da,
- 0x01dc, 0x01dd,
- 0x01df, 0x01df,
- 0x01e1, 0x01e1,
- 0x01e3, 0x01e3,
- 0x01e5, 0x01e5,
- 0x01e7, 0x01e7,
- 0x01e9, 0x01e9,
- 0x01eb, 0x01eb,
- 0x01ed, 0x01ed,
- 0x01ef, 0x01f0,
- 0x01f3, 0x01f3,
- 0x01f5, 0x01f5,
- 0x01f9, 0x01f9,
- 0x01fb, 0x01fb,
- 0x01fd, 0x01fd,
- 0x01ff, 0x01ff,
- 0x0201, 0x0201,
- 0x0203, 0x0203,
- 0x0205, 0x0205,
- 0x0207, 0x0207,
- 0x0209, 0x0209,
- 0x020b, 0x020b,
- 0x020d, 0x020d,
- 0x020f, 0x020f,
- 0x0211, 0x0211,
- 0x0213, 0x0213,
- 0x0215, 0x0215,
- 0x0217, 0x0217,
- 0x0219, 0x0219,
- 0x021b, 0x021b,
- 0x021d, 0x021d,
- 0x021f, 0x021f,
- 0x0221, 0x0221,
- 0x0223, 0x0223,
- 0x0225, 0x0225,
- 0x0227, 0x0227,
- 0x0229, 0x0229,
- 0x022b, 0x022b,
- 0x022d, 0x022d,
- 0x022f, 0x022f,
- 0x0231, 0x0231,
- 0x0233, 0x0239,
- 0x023c, 0x023c,
- 0x023f, 0x0240,
- 0x0242, 0x0242,
- 0x0247, 0x0247,
- 0x0249, 0x0249,
- 0x024b, 0x024b,
- 0x024d, 0x024d,
- 0x024f, 0x0293,
- 0x0295, 0x02b8,
- 0x02c0, 0x02c1,
- 0x02e0, 0x02e4,
- 0x0345, 0x0345,
- 0x0371, 0x0371,
- 0x0373, 0x0373,
- 0x0377, 0x0377,
- 0x037a, 0x037d,
- 0x0390, 0x0390,
- 0x03ac, 0x03ce,
- 0x03d0, 0x03d1,
- 0x03d5, 0x03d7,
- 0x03d9, 0x03d9,
- 0x03db, 0x03db,
- 0x03dd, 0x03dd,
- 0x03df, 0x03df,
- 0x03e1, 0x03e1,
- 0x03e3, 0x03e3,
- 0x03e5, 0x03e5,
- 0x03e7, 0x03e7,
- 0x03e9, 0x03e9,
- 0x03eb, 0x03eb,
- 0x03ed, 0x03ed,
- 0x03ef, 0x03f3,
- 0x03f5, 0x03f5,
- 0x03f8, 0x03f8,
- 0x03fb, 0x03fc,
- 0x0430, 0x045f,
- 0x0461, 0x0461,
- 0x0463, 0x0463,
- 0x0465, 0x0465,
- 0x0467, 0x0467,
- 0x0469, 0x0469,
- 0x046b, 0x046b,
- 0x046d, 0x046d,
- 0x046f, 0x046f,
- 0x0471, 0x0471,
- 0x0473, 0x0473,
- 0x0475, 0x0475,
- 0x0477, 0x0477,
- 0x0479, 0x0479,
- 0x047b, 0x047b,
- 0x047d, 0x047d,
- 0x047f, 0x047f,
- 0x0481, 0x0481,
- 0x048b, 0x048b,
- 0x048d, 0x048d,
- 0x048f, 0x048f,
- 0x0491, 0x0491,
- 0x0493, 0x0493,
- 0x0495, 0x0495,
- 0x0497, 0x0497,
- 0x0499, 0x0499,
- 0x049b, 0x049b,
- 0x049d, 0x049d,
- 0x049f, 0x049f,
- 0x04a1, 0x04a1,
- 0x04a3, 0x04a3,
- 0x04a5, 0x04a5,
- 0x04a7, 0x04a7,
- 0x04a9, 0x04a9,
- 0x04ab, 0x04ab,
- 0x04ad, 0x04ad,
- 0x04af, 0x04af,
- 0x04b1, 0x04b1,
- 0x04b3, 0x04b3,
- 0x04b5, 0x04b5,
- 0x04b7, 0x04b7,
- 0x04b9, 0x04b9,
- 0x04bb, 0x04bb,
- 0x04bd, 0x04bd,
- 0x04bf, 0x04bf,
- 0x04c2, 0x04c2,
- 0x04c4, 0x04c4,
- 0x04c6, 0x04c6,
- 0x04c8, 0x04c8,
- 0x04ca, 0x04ca,
- 0x04cc, 0x04cc,
- 0x04ce, 0x04cf,
- 0x04d1, 0x04d1,
- 0x04d3, 0x04d3,
- 0x04d5, 0x04d5,
- 0x04d7, 0x04d7,
- 0x04d9, 0x04d9,
- 0x04db, 0x04db,
- 0x04dd, 0x04dd,
- 0x04df, 0x04df,
- 0x04e1, 0x04e1,
- 0x04e3, 0x04e3,
- 0x04e5, 0x04e5,
- 0x04e7, 0x04e7,
- 0x04e9, 0x04e9,
- 0x04eb, 0x04eb,
- 0x04ed, 0x04ed,
- 0x04ef, 0x04ef,
- 0x04f1, 0x04f1,
- 0x04f3, 0x04f3,
- 0x04f5, 0x04f5,
- 0x04f7, 0x04f7,
- 0x04f9, 0x04f9,
- 0x04fb, 0x04fb,
- 0x04fd, 0x04fd,
- 0x04ff, 0x04ff,
- 0x0501, 0x0501,
- 0x0503, 0x0503,
- 0x0505, 0x0505,
- 0x0507, 0x0507,
- 0x0509, 0x0509,
- 0x050b, 0x050b,
- 0x050d, 0x050d,
- 0x050f, 0x050f,
- 0x0511, 0x0511,
- 0x0513, 0x0513,
- 0x0515, 0x0515,
- 0x0517, 0x0517,
- 0x0519, 0x0519,
- 0x051b, 0x051b,
- 0x051d, 0x051d,
- 0x051f, 0x051f,
- 0x0521, 0x0521,
- 0x0523, 0x0523,
- 0x0525, 0x0525,
- 0x0527, 0x0527,
- 0x0561, 0x0587,
- 0x1d00, 0x1dbf,
- 0x1e01, 0x1e01,
- 0x1e03, 0x1e03,
- 0x1e05, 0x1e05,
- 0x1e07, 0x1e07,
- 0x1e09, 0x1e09,
- 0x1e0b, 0x1e0b,
- 0x1e0d, 0x1e0d,
- 0x1e0f, 0x1e0f,
- 0x1e11, 0x1e11,
- 0x1e13, 0x1e13,
- 0x1e15, 0x1e15,
- 0x1e17, 0x1e17,
- 0x1e19, 0x1e19,
- 0x1e1b, 0x1e1b,
- 0x1e1d, 0x1e1d,
- 0x1e1f, 0x1e1f,
- 0x1e21, 0x1e21,
- 0x1e23, 0x1e23,
- 0x1e25, 0x1e25,
- 0x1e27, 0x1e27,
- 0x1e29, 0x1e29,
- 0x1e2b, 0x1e2b,
- 0x1e2d, 0x1e2d,
- 0x1e2f, 0x1e2f,
- 0x1e31, 0x1e31,
- 0x1e33, 0x1e33,
- 0x1e35, 0x1e35,
- 0x1e37, 0x1e37,
- 0x1e39, 0x1e39,
- 0x1e3b, 0x1e3b,
- 0x1e3d, 0x1e3d,
- 0x1e3f, 0x1e3f,
- 0x1e41, 0x1e41,
- 0x1e43, 0x1e43,
- 0x1e45, 0x1e45,
- 0x1e47, 0x1e47,
- 0x1e49, 0x1e49,
- 0x1e4b, 0x1e4b,
- 0x1e4d, 0x1e4d,
- 0x1e4f, 0x1e4f,
- 0x1e51, 0x1e51,
- 0x1e53, 0x1e53,
- 0x1e55, 0x1e55,
- 0x1e57, 0x1e57,
- 0x1e59, 0x1e59,
- 0x1e5b, 0x1e5b,
- 0x1e5d, 0x1e5d,
- 0x1e5f, 0x1e5f,
- 0x1e61, 0x1e61,
- 0x1e63, 0x1e63,
- 0x1e65, 0x1e65,
- 0x1e67, 0x1e67,
- 0x1e69, 0x1e69,
- 0x1e6b, 0x1e6b,
- 0x1e6d, 0x1e6d,
- 0x1e6f, 0x1e6f,
- 0x1e71, 0x1e71,
- 0x1e73, 0x1e73,
- 0x1e75, 0x1e75,
- 0x1e77, 0x1e77,
- 0x1e79, 0x1e79,
- 0x1e7b, 0x1e7b,
- 0x1e7d, 0x1e7d,
- 0x1e7f, 0x1e7f,
- 0x1e81, 0x1e81,
- 0x1e83, 0x1e83,
- 0x1e85, 0x1e85,
- 0x1e87, 0x1e87,
- 0x1e89, 0x1e89,
- 0x1e8b, 0x1e8b,
- 0x1e8d, 0x1e8d,
- 0x1e8f, 0x1e8f,
- 0x1e91, 0x1e91,
- 0x1e93, 0x1e93,
- 0x1e95, 0x1e9d,
- 0x1e9f, 0x1e9f,
- 0x1ea1, 0x1ea1,
- 0x1ea3, 0x1ea3,
- 0x1ea5, 0x1ea5,
- 0x1ea7, 0x1ea7,
- 0x1ea9, 0x1ea9,
- 0x1eab, 0x1eab,
- 0x1ead, 0x1ead,
- 0x1eaf, 0x1eaf,
- 0x1eb1, 0x1eb1,
- 0x1eb3, 0x1eb3,
- 0x1eb5, 0x1eb5,
- 0x1eb7, 0x1eb7,
- 0x1eb9, 0x1eb9,
- 0x1ebb, 0x1ebb,
- 0x1ebd, 0x1ebd,
- 0x1ebf, 0x1ebf,
- 0x1ec1, 0x1ec1,
- 0x1ec3, 0x1ec3,
- 0x1ec5, 0x1ec5,
- 0x1ec7, 0x1ec7,
- 0x1ec9, 0x1ec9,
- 0x1ecb, 0x1ecb,
- 0x1ecd, 0x1ecd,
- 0x1ecf, 0x1ecf,
- 0x1ed1, 0x1ed1,
- 0x1ed3, 0x1ed3,
- 0x1ed5, 0x1ed5,
- 0x1ed7, 0x1ed7,
- 0x1ed9, 0x1ed9,
- 0x1edb, 0x1edb,
- 0x1edd, 0x1edd,
- 0x1edf, 0x1edf,
- 0x1ee1, 0x1ee1,
- 0x1ee3, 0x1ee3,
- 0x1ee5, 0x1ee5,
- 0x1ee7, 0x1ee7,
- 0x1ee9, 0x1ee9,
- 0x1eeb, 0x1eeb,
- 0x1eed, 0x1eed,
- 0x1eef, 0x1eef,
- 0x1ef1, 0x1ef1,
- 0x1ef3, 0x1ef3,
- 0x1ef5, 0x1ef5,
- 0x1ef7, 0x1ef7,
- 0x1ef9, 0x1ef9,
- 0x1efb, 0x1efb,
- 0x1efd, 0x1efd,
- 0x1eff, 0x1f07,
- 0x1f10, 0x1f15,
- 0x1f20, 0x1f27,
- 0x1f30, 0x1f37,
- 0x1f40, 0x1f45,
- 0x1f50, 0x1f57,
- 0x1f60, 0x1f67,
- 0x1f70, 0x1f7d,
- 0x1f80, 0x1f87,
- 0x1f90, 0x1f97,
- 0x1fa0, 0x1fa7,
- 0x1fb0, 0x1fb4,
- 0x1fb6, 0x1fb7,
- 0x1fbe, 0x1fbe,
- 0x1fc2, 0x1fc4,
- 0x1fc6, 0x1fc7,
- 0x1fd0, 0x1fd3,
- 0x1fd6, 0x1fd7,
- 0x1fe0, 0x1fe7,
- 0x1ff2, 0x1ff4,
- 0x1ff6, 0x1ff7,
- 0x2090, 0x2094,
- 0x210a, 0x210a,
- 0x210e, 0x210f,
- 0x2113, 0x2113,
- 0x212f, 0x212f,
- 0x2134, 0x2134,
- 0x2139, 0x2139,
- 0x213c, 0x213d,
- 0x2146, 0x2149,
- 0x214e, 0x214e,
- 0x2170, 0x217f,
- 0x2184, 0x2184,
- 0x24d0, 0x24e9,
- 0x2c30, 0x2c5e,
- 0x2c61, 0x2c61,
- 0x2c65, 0x2c66,
- 0x2c68, 0x2c68,
- 0x2c6a, 0x2c6a,
- 0x2c6c, 0x2c6c,
- 0x2c71, 0x2c71,
- 0x2c73, 0x2c74,
- 0x2c76, 0x2c7d,
- 0x2c81, 0x2c81,
- 0x2c83, 0x2c83,
- 0x2c85, 0x2c85,
- 0x2c87, 0x2c87,
- 0x2c89, 0x2c89,
- 0x2c8b, 0x2c8b,
- 0x2c8d, 0x2c8d,
- 0x2c8f, 0x2c8f,
- 0x2c91, 0x2c91,
- 0x2c93, 0x2c93,
- 0x2c95, 0x2c95,
- 0x2c97, 0x2c97,
- 0x2c99, 0x2c99,
- 0x2c9b, 0x2c9b,
- 0x2c9d, 0x2c9d,
- 0x2c9f, 0x2c9f,
- 0x2ca1, 0x2ca1,
- 0x2ca3, 0x2ca3,
- 0x2ca5, 0x2ca5,
- 0x2ca7, 0x2ca7,
- 0x2ca9, 0x2ca9,
- 0x2cab, 0x2cab,
- 0x2cad, 0x2cad,
- 0x2caf, 0x2caf,
- 0x2cb1, 0x2cb1,
- 0x2cb3, 0x2cb3,
- 0x2cb5, 0x2cb5,
- 0x2cb7, 0x2cb7,
- 0x2cb9, 0x2cb9,
- 0x2cbb, 0x2cbb,
- 0x2cbd, 0x2cbd,
- 0x2cbf, 0x2cbf,
- 0x2cc1, 0x2cc1,
- 0x2cc3, 0x2cc3,
- 0x2cc5, 0x2cc5,
- 0x2cc7, 0x2cc7,
- 0x2cc9, 0x2cc9,
- 0x2ccb, 0x2ccb,
- 0x2ccd, 0x2ccd,
- 0x2ccf, 0x2ccf,
- 0x2cd1, 0x2cd1,
- 0x2cd3, 0x2cd3,
- 0x2cd5, 0x2cd5,
- 0x2cd7, 0x2cd7,
- 0x2cd9, 0x2cd9,
- 0x2cdb, 0x2cdb,
- 0x2cdd, 0x2cdd,
- 0x2cdf, 0x2cdf,
- 0x2ce1, 0x2ce1,
- 0x2ce3, 0x2ce4,
- 0x2cec, 0x2cec,
- 0x2cee, 0x2cee,
- 0x2d00, 0x2d25,
- 0xa641, 0xa641,
- 0xa643, 0xa643,
- 0xa645, 0xa645,
- 0xa647, 0xa647,
- 0xa649, 0xa649,
- 0xa64b, 0xa64b,
- 0xa64d, 0xa64d,
- 0xa64f, 0xa64f,
- 0xa651, 0xa651,
- 0xa653, 0xa653,
- 0xa655, 0xa655,
- 0xa657, 0xa657,
- 0xa659, 0xa659,
- 0xa65b, 0xa65b,
- 0xa65d, 0xa65d,
- 0xa65f, 0xa65f,
- 0xa661, 0xa661,
- 0xa663, 0xa663,
- 0xa665, 0xa665,
- 0xa667, 0xa667,
- 0xa669, 0xa669,
- 0xa66b, 0xa66b,
- 0xa66d, 0xa66d,
- 0xa681, 0xa681,
- 0xa683, 0xa683,
- 0xa685, 0xa685,
- 0xa687, 0xa687,
- 0xa689, 0xa689,
- 0xa68b, 0xa68b,
- 0xa68d, 0xa68d,
- 0xa68f, 0xa68f,
- 0xa691, 0xa691,
- 0xa693, 0xa693,
- 0xa695, 0xa695,
- 0xa697, 0xa697,
- 0xa723, 0xa723,
- 0xa725, 0xa725,
- 0xa727, 0xa727,
- 0xa729, 0xa729,
- 0xa72b, 0xa72b,
- 0xa72d, 0xa72d,
- 0xa72f, 0xa731,
- 0xa733, 0xa733,
- 0xa735, 0xa735,
- 0xa737, 0xa737,
- 0xa739, 0xa739,
- 0xa73b, 0xa73b,
- 0xa73d, 0xa73d,
- 0xa73f, 0xa73f,
- 0xa741, 0xa741,
- 0xa743, 0xa743,
- 0xa745, 0xa745,
- 0xa747, 0xa747,
- 0xa749, 0xa749,
- 0xa74b, 0xa74b,
- 0xa74d, 0xa74d,
- 0xa74f, 0xa74f,
- 0xa751, 0xa751,
- 0xa753, 0xa753,
- 0xa755, 0xa755,
- 0xa757, 0xa757,
- 0xa759, 0xa759,
- 0xa75b, 0xa75b,
- 0xa75d, 0xa75d,
- 0xa75f, 0xa75f,
- 0xa761, 0xa761,
- 0xa763, 0xa763,
- 0xa765, 0xa765,
- 0xa767, 0xa767,
- 0xa769, 0xa769,
- 0xa76b, 0xa76b,
- 0xa76d, 0xa76d,
- 0xa76f, 0xa778,
- 0xa77a, 0xa77a,
- 0xa77c, 0xa77c,
- 0xa77f, 0xa77f,
- 0xa781, 0xa781,
- 0xa783, 0xa783,
- 0xa785, 0xa785,
- 0xa787, 0xa787,
- 0xa78c, 0xa78c,
- 0xa78e, 0xa78e,
- 0xa791, 0xa791,
- 0xa7a1, 0xa7a1,
- 0xa7a3, 0xa7a3,
- 0xa7a5, 0xa7a5,
- 0xa7a7, 0xa7a7,
- 0xa7a9, 0xa7a9,
- 0xa7fa, 0xa7fa,
- 0xfb00, 0xfb06,
- 0xfb13, 0xfb17,
- 0xff41, 0xff5a,
- 0x10428, 0x1044f,
- 0x1d41a, 0x1d433,
- 0x1d44e, 0x1d454,
- 0x1d456, 0x1d467,
- 0x1d482, 0x1d49b,
- 0x1d4b6, 0x1d4b9,
- 0x1d4bb, 0x1d4bb,
- 0x1d4bd, 0x1d4c3,
- 0x1d4c5, 0x1d4cf,
- 0x1d4ea, 0x1d503,
- 0x1d51e, 0x1d537,
- 0x1d552, 0x1d56b,
- 0x1d586, 0x1d59f,
- 0x1d5ba, 0x1d5d3,
- 0x1d5ee, 0x1d607,
- 0x1d622, 0x1d63b,
- 0x1d656, 0x1d66f,
- 0x1d68a, 0x1d6a5,
- 0x1d6c2, 0x1d6da,
- 0x1d6dc, 0x1d6e1,
- 0x1d6fc, 0x1d714,
- 0x1d716, 0x1d71b,
- 0x1d736, 0x1d74e,
- 0x1d750, 0x1d755,
- 0x1d770, 0x1d788,
- 0x1d78a, 0x1d78f,
- 0x1d7aa, 0x1d7c2,
- 0x1d7c4, 0x1d7c9,
- 0x1d7cb, 0x1d7cb,
-}; /* CR_Lowercase */
+#define CR_Lowercase CR_Lower
/* 'Uppercase': Derived Property */
-static const OnigCodePoint CR_Uppercase[] = {
- 605,
- 0x0041, 0x005a,
- 0x00c0, 0x00d6,
- 0x00d8, 0x00de,
- 0x0100, 0x0100,
- 0x0102, 0x0102,
- 0x0104, 0x0104,
- 0x0106, 0x0106,
- 0x0108, 0x0108,
- 0x010a, 0x010a,
- 0x010c, 0x010c,
- 0x010e, 0x010e,
- 0x0110, 0x0110,
- 0x0112, 0x0112,
- 0x0114, 0x0114,
- 0x0116, 0x0116,
- 0x0118, 0x0118,
- 0x011a, 0x011a,
- 0x011c, 0x011c,
- 0x011e, 0x011e,
- 0x0120, 0x0120,
- 0x0122, 0x0122,
- 0x0124, 0x0124,
- 0x0126, 0x0126,
- 0x0128, 0x0128,
- 0x012a, 0x012a,
- 0x012c, 0x012c,
- 0x012e, 0x012e,
- 0x0130, 0x0130,
- 0x0132, 0x0132,
- 0x0134, 0x0134,
- 0x0136, 0x0136,
- 0x0139, 0x0139,
- 0x013b, 0x013b,
- 0x013d, 0x013d,
- 0x013f, 0x013f,
- 0x0141, 0x0141,
- 0x0143, 0x0143,
- 0x0145, 0x0145,
- 0x0147, 0x0147,
- 0x014a, 0x014a,
- 0x014c, 0x014c,
- 0x014e, 0x014e,
- 0x0150, 0x0150,
- 0x0152, 0x0152,
- 0x0154, 0x0154,
- 0x0156, 0x0156,
- 0x0158, 0x0158,
- 0x015a, 0x015a,
- 0x015c, 0x015c,
- 0x015e, 0x015e,
- 0x0160, 0x0160,
- 0x0162, 0x0162,
- 0x0164, 0x0164,
- 0x0166, 0x0166,
- 0x0168, 0x0168,
- 0x016a, 0x016a,
- 0x016c, 0x016c,
- 0x016e, 0x016e,
- 0x0170, 0x0170,
- 0x0172, 0x0172,
- 0x0174, 0x0174,
- 0x0176, 0x0176,
- 0x0178, 0x0179,
- 0x017b, 0x017b,
- 0x017d, 0x017d,
- 0x0181, 0x0182,
- 0x0184, 0x0184,
- 0x0186, 0x0187,
- 0x0189, 0x018b,
- 0x018e, 0x0191,
- 0x0193, 0x0194,
- 0x0196, 0x0198,
- 0x019c, 0x019d,
- 0x019f, 0x01a0,
- 0x01a2, 0x01a2,
- 0x01a4, 0x01a4,
- 0x01a6, 0x01a7,
- 0x01a9, 0x01a9,
- 0x01ac, 0x01ac,
- 0x01ae, 0x01af,
- 0x01b1, 0x01b3,
- 0x01b5, 0x01b5,
- 0x01b7, 0x01b8,
- 0x01bc, 0x01bc,
- 0x01c4, 0x01c4,
- 0x01c7, 0x01c7,
- 0x01ca, 0x01ca,
- 0x01cd, 0x01cd,
- 0x01cf, 0x01cf,
- 0x01d1, 0x01d1,
- 0x01d3, 0x01d3,
- 0x01d5, 0x01d5,
- 0x01d7, 0x01d7,
- 0x01d9, 0x01d9,
- 0x01db, 0x01db,
- 0x01de, 0x01de,
- 0x01e0, 0x01e0,
- 0x01e2, 0x01e2,
- 0x01e4, 0x01e4,
- 0x01e6, 0x01e6,
- 0x01e8, 0x01e8,
- 0x01ea, 0x01ea,
- 0x01ec, 0x01ec,
- 0x01ee, 0x01ee,
- 0x01f1, 0x01f1,
- 0x01f4, 0x01f4,
- 0x01f6, 0x01f8,
- 0x01fa, 0x01fa,
- 0x01fc, 0x01fc,
- 0x01fe, 0x01fe,
- 0x0200, 0x0200,
- 0x0202, 0x0202,
- 0x0204, 0x0204,
- 0x0206, 0x0206,
- 0x0208, 0x0208,
- 0x020a, 0x020a,
- 0x020c, 0x020c,
- 0x020e, 0x020e,
- 0x0210, 0x0210,
- 0x0212, 0x0212,
- 0x0214, 0x0214,
- 0x0216, 0x0216,
- 0x0218, 0x0218,
- 0x021a, 0x021a,
- 0x021c, 0x021c,
- 0x021e, 0x021e,
- 0x0220, 0x0220,
- 0x0222, 0x0222,
- 0x0224, 0x0224,
- 0x0226, 0x0226,
- 0x0228, 0x0228,
- 0x022a, 0x022a,
- 0x022c, 0x022c,
- 0x022e, 0x022e,
- 0x0230, 0x0230,
- 0x0232, 0x0232,
- 0x023a, 0x023b,
- 0x023d, 0x023e,
- 0x0241, 0x0241,
- 0x0243, 0x0246,
- 0x0248, 0x0248,
- 0x024a, 0x024a,
- 0x024c, 0x024c,
- 0x024e, 0x024e,
- 0x0370, 0x0370,
- 0x0372, 0x0372,
- 0x0376, 0x0376,
- 0x0386, 0x0386,
- 0x0388, 0x038a,
- 0x038c, 0x038c,
- 0x038e, 0x038f,
- 0x0391, 0x03a1,
- 0x03a3, 0x03ab,
- 0x03cf, 0x03cf,
- 0x03d2, 0x03d4,
- 0x03d8, 0x03d8,
- 0x03da, 0x03da,
- 0x03dc, 0x03dc,
- 0x03de, 0x03de,
- 0x03e0, 0x03e0,
- 0x03e2, 0x03e2,
- 0x03e4, 0x03e4,
- 0x03e6, 0x03e6,
- 0x03e8, 0x03e8,
- 0x03ea, 0x03ea,
- 0x03ec, 0x03ec,
- 0x03ee, 0x03ee,
- 0x03f4, 0x03f4,
- 0x03f7, 0x03f7,
- 0x03f9, 0x03fa,
- 0x03fd, 0x042f,
- 0x0460, 0x0460,
- 0x0462, 0x0462,
- 0x0464, 0x0464,
- 0x0466, 0x0466,
- 0x0468, 0x0468,
- 0x046a, 0x046a,
- 0x046c, 0x046c,
- 0x046e, 0x046e,
- 0x0470, 0x0470,
- 0x0472, 0x0472,
- 0x0474, 0x0474,
- 0x0476, 0x0476,
- 0x0478, 0x0478,
- 0x047a, 0x047a,
- 0x047c, 0x047c,
- 0x047e, 0x047e,
- 0x0480, 0x0480,
- 0x048a, 0x048a,
- 0x048c, 0x048c,
- 0x048e, 0x048e,
- 0x0490, 0x0490,
- 0x0492, 0x0492,
- 0x0494, 0x0494,
- 0x0496, 0x0496,
- 0x0498, 0x0498,
- 0x049a, 0x049a,
- 0x049c, 0x049c,
- 0x049e, 0x049e,
- 0x04a0, 0x04a0,
- 0x04a2, 0x04a2,
- 0x04a4, 0x04a4,
- 0x04a6, 0x04a6,
- 0x04a8, 0x04a8,
- 0x04aa, 0x04aa,
- 0x04ac, 0x04ac,
- 0x04ae, 0x04ae,
- 0x04b0, 0x04b0,
- 0x04b2, 0x04b2,
- 0x04b4, 0x04b4,
- 0x04b6, 0x04b6,
- 0x04b8, 0x04b8,
- 0x04ba, 0x04ba,
- 0x04bc, 0x04bc,
- 0x04be, 0x04be,
- 0x04c0, 0x04c1,
- 0x04c3, 0x04c3,
- 0x04c5, 0x04c5,
- 0x04c7, 0x04c7,
- 0x04c9, 0x04c9,
- 0x04cb, 0x04cb,
- 0x04cd, 0x04cd,
- 0x04d0, 0x04d0,
- 0x04d2, 0x04d2,
- 0x04d4, 0x04d4,
- 0x04d6, 0x04d6,
- 0x04d8, 0x04d8,
- 0x04da, 0x04da,
- 0x04dc, 0x04dc,
- 0x04de, 0x04de,
- 0x04e0, 0x04e0,
- 0x04e2, 0x04e2,
- 0x04e4, 0x04e4,
- 0x04e6, 0x04e6,
- 0x04e8, 0x04e8,
- 0x04ea, 0x04ea,
- 0x04ec, 0x04ec,
- 0x04ee, 0x04ee,
- 0x04f0, 0x04f0,
- 0x04f2, 0x04f2,
- 0x04f4, 0x04f4,
- 0x04f6, 0x04f6,
- 0x04f8, 0x04f8,
- 0x04fa, 0x04fa,
- 0x04fc, 0x04fc,
- 0x04fe, 0x04fe,
- 0x0500, 0x0500,
- 0x0502, 0x0502,
- 0x0504, 0x0504,
- 0x0506, 0x0506,
- 0x0508, 0x0508,
- 0x050a, 0x050a,
- 0x050c, 0x050c,
- 0x050e, 0x050e,
- 0x0510, 0x0510,
- 0x0512, 0x0512,
- 0x0514, 0x0514,
- 0x0516, 0x0516,
- 0x0518, 0x0518,
- 0x051a, 0x051a,
- 0x051c, 0x051c,
- 0x051e, 0x051e,
- 0x0520, 0x0520,
- 0x0522, 0x0522,
- 0x0524, 0x0524,
- 0x0526, 0x0526,
- 0x0531, 0x0556,
- 0x10a0, 0x10c5,
- 0x1e00, 0x1e00,
- 0x1e02, 0x1e02,
- 0x1e04, 0x1e04,
- 0x1e06, 0x1e06,
- 0x1e08, 0x1e08,
- 0x1e0a, 0x1e0a,
- 0x1e0c, 0x1e0c,
- 0x1e0e, 0x1e0e,
- 0x1e10, 0x1e10,
- 0x1e12, 0x1e12,
- 0x1e14, 0x1e14,
- 0x1e16, 0x1e16,
- 0x1e18, 0x1e18,
- 0x1e1a, 0x1e1a,
- 0x1e1c, 0x1e1c,
- 0x1e1e, 0x1e1e,
- 0x1e20, 0x1e20,
- 0x1e22, 0x1e22,
- 0x1e24, 0x1e24,
- 0x1e26, 0x1e26,
- 0x1e28, 0x1e28,
- 0x1e2a, 0x1e2a,
- 0x1e2c, 0x1e2c,
- 0x1e2e, 0x1e2e,
- 0x1e30, 0x1e30,
- 0x1e32, 0x1e32,
- 0x1e34, 0x1e34,
- 0x1e36, 0x1e36,
- 0x1e38, 0x1e38,
- 0x1e3a, 0x1e3a,
- 0x1e3c, 0x1e3c,
- 0x1e3e, 0x1e3e,
- 0x1e40, 0x1e40,
- 0x1e42, 0x1e42,
- 0x1e44, 0x1e44,
- 0x1e46, 0x1e46,
- 0x1e48, 0x1e48,
- 0x1e4a, 0x1e4a,
- 0x1e4c, 0x1e4c,
- 0x1e4e, 0x1e4e,
- 0x1e50, 0x1e50,
- 0x1e52, 0x1e52,
- 0x1e54, 0x1e54,
- 0x1e56, 0x1e56,
- 0x1e58, 0x1e58,
- 0x1e5a, 0x1e5a,
- 0x1e5c, 0x1e5c,
- 0x1e5e, 0x1e5e,
- 0x1e60, 0x1e60,
- 0x1e62, 0x1e62,
- 0x1e64, 0x1e64,
- 0x1e66, 0x1e66,
- 0x1e68, 0x1e68,
- 0x1e6a, 0x1e6a,
- 0x1e6c, 0x1e6c,
- 0x1e6e, 0x1e6e,
- 0x1e70, 0x1e70,
- 0x1e72, 0x1e72,
- 0x1e74, 0x1e74,
- 0x1e76, 0x1e76,
- 0x1e78, 0x1e78,
- 0x1e7a, 0x1e7a,
- 0x1e7c, 0x1e7c,
- 0x1e7e, 0x1e7e,
- 0x1e80, 0x1e80,
- 0x1e82, 0x1e82,
- 0x1e84, 0x1e84,
- 0x1e86, 0x1e86,
- 0x1e88, 0x1e88,
- 0x1e8a, 0x1e8a,
- 0x1e8c, 0x1e8c,
- 0x1e8e, 0x1e8e,
- 0x1e90, 0x1e90,
- 0x1e92, 0x1e92,
- 0x1e94, 0x1e94,
- 0x1e9e, 0x1e9e,
- 0x1ea0, 0x1ea0,
- 0x1ea2, 0x1ea2,
- 0x1ea4, 0x1ea4,
- 0x1ea6, 0x1ea6,
- 0x1ea8, 0x1ea8,
- 0x1eaa, 0x1eaa,
- 0x1eac, 0x1eac,
- 0x1eae, 0x1eae,
- 0x1eb0, 0x1eb0,
- 0x1eb2, 0x1eb2,
- 0x1eb4, 0x1eb4,
- 0x1eb6, 0x1eb6,
- 0x1eb8, 0x1eb8,
- 0x1eba, 0x1eba,
- 0x1ebc, 0x1ebc,
- 0x1ebe, 0x1ebe,
- 0x1ec0, 0x1ec0,
- 0x1ec2, 0x1ec2,
- 0x1ec4, 0x1ec4,
- 0x1ec6, 0x1ec6,
- 0x1ec8, 0x1ec8,
- 0x1eca, 0x1eca,
- 0x1ecc, 0x1ecc,
- 0x1ece, 0x1ece,
- 0x1ed0, 0x1ed0,
- 0x1ed2, 0x1ed2,
- 0x1ed4, 0x1ed4,
- 0x1ed6, 0x1ed6,
- 0x1ed8, 0x1ed8,
- 0x1eda, 0x1eda,
- 0x1edc, 0x1edc,
- 0x1ede, 0x1ede,
- 0x1ee0, 0x1ee0,
- 0x1ee2, 0x1ee2,
- 0x1ee4, 0x1ee4,
- 0x1ee6, 0x1ee6,
- 0x1ee8, 0x1ee8,
- 0x1eea, 0x1eea,
- 0x1eec, 0x1eec,
- 0x1eee, 0x1eee,
- 0x1ef0, 0x1ef0,
- 0x1ef2, 0x1ef2,
- 0x1ef4, 0x1ef4,
- 0x1ef6, 0x1ef6,
- 0x1ef8, 0x1ef8,
- 0x1efa, 0x1efa,
- 0x1efc, 0x1efc,
- 0x1efe, 0x1efe,
- 0x1f08, 0x1f0f,
- 0x1f18, 0x1f1d,
- 0x1f28, 0x1f2f,
- 0x1f38, 0x1f3f,
- 0x1f48, 0x1f4d,
- 0x1f59, 0x1f59,
- 0x1f5b, 0x1f5b,
- 0x1f5d, 0x1f5d,
- 0x1f5f, 0x1f5f,
- 0x1f68, 0x1f6f,
- 0x1fb8, 0x1fbb,
- 0x1fc8, 0x1fcb,
- 0x1fd8, 0x1fdb,
- 0x1fe8, 0x1fec,
- 0x1ff8, 0x1ffb,
- 0x2102, 0x2102,
- 0x2107, 0x2107,
- 0x210b, 0x210d,
- 0x2110, 0x2112,
- 0x2115, 0x2115,
- 0x2119, 0x211d,
- 0x2124, 0x2124,
- 0x2126, 0x2126,
- 0x2128, 0x2128,
- 0x212a, 0x212d,
- 0x2130, 0x2133,
- 0x213e, 0x213f,
- 0x2145, 0x2145,
- 0x2160, 0x216f,
- 0x2183, 0x2183,
- 0x24b6, 0x24cf,
- 0x2c00, 0x2c2e,
- 0x2c60, 0x2c60,
- 0x2c62, 0x2c64,
- 0x2c67, 0x2c67,
- 0x2c69, 0x2c69,
- 0x2c6b, 0x2c6b,
- 0x2c6d, 0x2c70,
- 0x2c72, 0x2c72,
- 0x2c75, 0x2c75,
- 0x2c7e, 0x2c80,
- 0x2c82, 0x2c82,
- 0x2c84, 0x2c84,
- 0x2c86, 0x2c86,
- 0x2c88, 0x2c88,
- 0x2c8a, 0x2c8a,
- 0x2c8c, 0x2c8c,
- 0x2c8e, 0x2c8e,
- 0x2c90, 0x2c90,
- 0x2c92, 0x2c92,
- 0x2c94, 0x2c94,
- 0x2c96, 0x2c96,
- 0x2c98, 0x2c98,
- 0x2c9a, 0x2c9a,
- 0x2c9c, 0x2c9c,
- 0x2c9e, 0x2c9e,
- 0x2ca0, 0x2ca0,
- 0x2ca2, 0x2ca2,
- 0x2ca4, 0x2ca4,
- 0x2ca6, 0x2ca6,
- 0x2ca8, 0x2ca8,
- 0x2caa, 0x2caa,
- 0x2cac, 0x2cac,
- 0x2cae, 0x2cae,
- 0x2cb0, 0x2cb0,
- 0x2cb2, 0x2cb2,
- 0x2cb4, 0x2cb4,
- 0x2cb6, 0x2cb6,
- 0x2cb8, 0x2cb8,
- 0x2cba, 0x2cba,
- 0x2cbc, 0x2cbc,
- 0x2cbe, 0x2cbe,
- 0x2cc0, 0x2cc0,
- 0x2cc2, 0x2cc2,
- 0x2cc4, 0x2cc4,
- 0x2cc6, 0x2cc6,
- 0x2cc8, 0x2cc8,
- 0x2cca, 0x2cca,
- 0x2ccc, 0x2ccc,
- 0x2cce, 0x2cce,
- 0x2cd0, 0x2cd0,
- 0x2cd2, 0x2cd2,
- 0x2cd4, 0x2cd4,
- 0x2cd6, 0x2cd6,
- 0x2cd8, 0x2cd8,
- 0x2cda, 0x2cda,
- 0x2cdc, 0x2cdc,
- 0x2cde, 0x2cde,
- 0x2ce0, 0x2ce0,
- 0x2ce2, 0x2ce2,
- 0x2ceb, 0x2ceb,
- 0x2ced, 0x2ced,
- 0xa640, 0xa640,
- 0xa642, 0xa642,
- 0xa644, 0xa644,
- 0xa646, 0xa646,
- 0xa648, 0xa648,
- 0xa64a, 0xa64a,
- 0xa64c, 0xa64c,
- 0xa64e, 0xa64e,
- 0xa650, 0xa650,
- 0xa652, 0xa652,
- 0xa654, 0xa654,
- 0xa656, 0xa656,
- 0xa658, 0xa658,
- 0xa65a, 0xa65a,
- 0xa65c, 0xa65c,
- 0xa65e, 0xa65e,
- 0xa660, 0xa660,
- 0xa662, 0xa662,
- 0xa664, 0xa664,
- 0xa666, 0xa666,
- 0xa668, 0xa668,
- 0xa66a, 0xa66a,
- 0xa66c, 0xa66c,
- 0xa680, 0xa680,
- 0xa682, 0xa682,
- 0xa684, 0xa684,
- 0xa686, 0xa686,
- 0xa688, 0xa688,
- 0xa68a, 0xa68a,
- 0xa68c, 0xa68c,
- 0xa68e, 0xa68e,
- 0xa690, 0xa690,
- 0xa692, 0xa692,
- 0xa694, 0xa694,
- 0xa696, 0xa696,
- 0xa722, 0xa722,
- 0xa724, 0xa724,
- 0xa726, 0xa726,
- 0xa728, 0xa728,
- 0xa72a, 0xa72a,
- 0xa72c, 0xa72c,
- 0xa72e, 0xa72e,
- 0xa732, 0xa732,
- 0xa734, 0xa734,
- 0xa736, 0xa736,
- 0xa738, 0xa738,
- 0xa73a, 0xa73a,
- 0xa73c, 0xa73c,
- 0xa73e, 0xa73e,
- 0xa740, 0xa740,
- 0xa742, 0xa742,
- 0xa744, 0xa744,
- 0xa746, 0xa746,
- 0xa748, 0xa748,
- 0xa74a, 0xa74a,
- 0xa74c, 0xa74c,
- 0xa74e, 0xa74e,
- 0xa750, 0xa750,
- 0xa752, 0xa752,
- 0xa754, 0xa754,
- 0xa756, 0xa756,
- 0xa758, 0xa758,
- 0xa75a, 0xa75a,
- 0xa75c, 0xa75c,
- 0xa75e, 0xa75e,
- 0xa760, 0xa760,
- 0xa762, 0xa762,
- 0xa764, 0xa764,
- 0xa766, 0xa766,
- 0xa768, 0xa768,
- 0xa76a, 0xa76a,
- 0xa76c, 0xa76c,
- 0xa76e, 0xa76e,
- 0xa779, 0xa779,
- 0xa77b, 0xa77b,
- 0xa77d, 0xa77e,
- 0xa780, 0xa780,
- 0xa782, 0xa782,
- 0xa784, 0xa784,
- 0xa786, 0xa786,
- 0xa78b, 0xa78b,
- 0xa78d, 0xa78d,
- 0xa790, 0xa790,
- 0xa7a0, 0xa7a0,
- 0xa7a2, 0xa7a2,
- 0xa7a4, 0xa7a4,
- 0xa7a6, 0xa7a6,
- 0xa7a8, 0xa7a8,
- 0xff21, 0xff3a,
- 0x10400, 0x10427,
- 0x1d400, 0x1d419,
- 0x1d434, 0x1d44d,
- 0x1d468, 0x1d481,
- 0x1d49c, 0x1d49c,
- 0x1d49e, 0x1d49f,
- 0x1d4a2, 0x1d4a2,
- 0x1d4a5, 0x1d4a6,
- 0x1d4a9, 0x1d4ac,
- 0x1d4ae, 0x1d4b5,
- 0x1d4d0, 0x1d4e9,
- 0x1d504, 0x1d505,
- 0x1d507, 0x1d50a,
- 0x1d50d, 0x1d514,
- 0x1d516, 0x1d51c,
- 0x1d538, 0x1d539,
- 0x1d53b, 0x1d53e,
- 0x1d540, 0x1d544,
- 0x1d546, 0x1d546,
- 0x1d54a, 0x1d550,
- 0x1d56c, 0x1d585,
- 0x1d5a0, 0x1d5b9,
- 0x1d5d4, 0x1d5ed,
- 0x1d608, 0x1d621,
- 0x1d63c, 0x1d655,
- 0x1d670, 0x1d689,
- 0x1d6a8, 0x1d6c0,
- 0x1d6e2, 0x1d6fa,
- 0x1d71c, 0x1d734,
- 0x1d756, 0x1d76e,
- 0x1d790, 0x1d7a8,
- 0x1d7ca, 0x1d7ca,
-}; /* CR_Uppercase */
+#define CR_Uppercase CR_Upper
/* 'Cased': Derived Property */
static const OnigCodePoint CR_Cased[] = {
- 112,
+ 119,
0x0041, 0x005a,
0x0061, 0x007a,
0x00aa, 0x00aa,
@@ -6797,6 +10064,8 @@ static const OnigCodePoint CR_Cased[] = {
0x0531, 0x0556,
0x0561, 0x0587,
0x10a0, 0x10c5,
+ 0x10c7, 0x10c7,
+ 0x10cd, 0x10cd,
0x1d00, 0x1dbf,
0x1e00, 0x1f15,
0x1f18, 0x1f1d,
@@ -6817,7 +10086,9 @@ static const OnigCodePoint CR_Cased[] = {
0x1fe0, 0x1fec,
0x1ff2, 0x1ff4,
0x1ff6, 0x1ffc,
- 0x2090, 0x2094,
+ 0x2071, 0x2071,
+ 0x207f, 0x207f,
+ 0x2090, 0x209c,
0x2102, 0x2102,
0x2107, 0x2107,
0x210a, 0x2113,
@@ -6839,14 +10110,17 @@ static const OnigCodePoint CR_Cased[] = {
0x2c30, 0x2c5e,
0x2c60, 0x2ce4,
0x2ceb, 0x2cee,
+ 0x2cf2, 0x2cf3,
0x2d00, 0x2d25,
+ 0x2d27, 0x2d27,
+ 0x2d2d, 0x2d2d,
0xa640, 0xa66d,
0xa680, 0xa697,
0xa722, 0xa787,
0xa78b, 0xa78e,
- 0xa790, 0xa791,
- 0xa7a0, 0xa7a9,
- 0xa7fa, 0xa7fa,
+ 0xa790, 0xa793,
+ 0xa7a0, 0xa7aa,
+ 0xa7f8, 0xa7fa,
0xfb00, 0xfb06,
0xfb13, 0xfb17,
0xff21, 0xff3a,
@@ -6886,7 +10160,7 @@ static const OnigCodePoint CR_Cased[] = {
/* 'Case_Ignorable': Derived Property */
static const OnigCodePoint CR_Case_Ignorable[] = {
- 277,
+ 295,
0x0027, 0x0027,
0x002e, 0x002e,
0x003a, 0x003a,
@@ -6910,7 +10184,7 @@ static const OnigCodePoint CR_Case_Ignorable[] = {
0x05c4, 0x05c5,
0x05c7, 0x05c7,
0x05f4, 0x05f4,
- 0x0600, 0x0603,
+ 0x0600, 0x0604,
0x0610, 0x061a,
0x0640, 0x0640,
0x064b, 0x065f,
@@ -6926,6 +10200,7 @@ static const OnigCodePoint CR_Case_Ignorable[] = {
0x07fa, 0x07fa,
0x0816, 0x082d,
0x0859, 0x085b,
+ 0x08e4, 0x08fe,
0x0900, 0x0902,
0x093a, 0x093a,
0x093c, 0x093c,
@@ -7045,6 +10320,7 @@ static const OnigCodePoint CR_Case_Ignorable[] = {
0x1b80, 0x1b81,
0x1ba2, 0x1ba5,
0x1ba8, 0x1ba9,
+ 0x1bab, 0x1bab,
0x1be6, 0x1be6,
0x1be8, 0x1be9,
0x1bed, 0x1bed,
@@ -7056,7 +10332,8 @@ static const OnigCodePoint CR_Case_Ignorable[] = {
0x1cd4, 0x1ce0,
0x1ce2, 0x1ce8,
0x1ced, 0x1ced,
- 0x1d2c, 0x1d61,
+ 0x1cf4, 0x1cf4,
+ 0x1d2c, 0x1d6a,
0x1d78, 0x1d78,
0x1d9b, 0x1de6,
0x1dfc, 0x1dff,
@@ -7077,14 +10354,14 @@ static const OnigCodePoint CR_Case_Ignorable[] = {
0x207f, 0x207f,
0x2090, 0x209c,
0x20d0, 0x20f0,
- 0x2c7d, 0x2c7d,
+ 0x2c7c, 0x2c7d,
0x2cef, 0x2cf1,
0x2d6f, 0x2d6f,
0x2d7f, 0x2d7f,
0x2de0, 0x2dff,
0x2e2f, 0x2e2f,
0x3005, 0x3005,
- 0x302a, 0x302f,
+ 0x302a, 0x302d,
0x3031, 0x3035,
0x303b, 0x303b,
0x3099, 0x309e,
@@ -7093,12 +10370,14 @@ static const OnigCodePoint CR_Case_Ignorable[] = {
0xa4f8, 0xa4fd,
0xa60c, 0xa60c,
0xa66f, 0xa672,
- 0xa67c, 0xa67d,
+ 0xa674, 0xa67d,
0xa67f, 0xa67f,
+ 0xa69f, 0xa69f,
0xa6f0, 0xa6f1,
0xa700, 0xa721,
0xa770, 0xa770,
0xa788, 0xa78a,
+ 0xa7f8, 0xa7f9,
0xa802, 0xa802,
0xa806, 0xa806,
0xa80b, 0xa80b,
@@ -7124,6 +10403,9 @@ static const OnigCodePoint CR_Case_Ignorable[] = {
0xaabe, 0xaabf,
0xaac1, 0xaac1,
0xaadd, 0xaadd,
+ 0xaaec, 0xaaed,
+ 0xaaf3, 0xaaf4,
+ 0xaaf6, 0xaaf6,
0xabe5, 0xabe5,
0xabe8, 0xabe8,
0xabed, 0xabed,
@@ -7156,6 +10438,16 @@ static const OnigCodePoint CR_Case_Ignorable[] = {
0x110b3, 0x110b6,
0x110b9, 0x110ba,
0x110bd, 0x110bd,
+ 0x11100, 0x11102,
+ 0x11127, 0x1112b,
+ 0x1112d, 0x11134,
+ 0x11180, 0x11181,
+ 0x111b6, 0x111be,
+ 0x116ab, 0x116ab,
+ 0x116ad, 0x116ad,
+ 0x116b0, 0x116b5,
+ 0x116b7, 0x116b7,
+ 0x16f8f, 0x16f9f,
0x1d167, 0x1d169,
0x1d173, 0x1d182,
0x1d185, 0x1d18b,
@@ -7168,7 +10460,7 @@ static const OnigCodePoint CR_Case_Ignorable[] = {
/* 'Changes_When_Lowercased': Derived Property */
static const OnigCodePoint CR_Changes_When_Lowercased[] = {
- 566,
+ 571,
0x0041, 0x005a,
0x00c0, 0x00d6,
0x00d8, 0x00de,
@@ -7436,6 +10728,8 @@ static const OnigCodePoint CR_Changes_When_Lowercased[] = {
0x0526, 0x0526,
0x0531, 0x0556,
0x10a0, 0x10c5,
+ 0x10c7, 0x10c7,
+ 0x10cd, 0x10cd,
0x1e00, 0x1e00,
0x1e02, 0x1e02,
0x1e04, 0x1e04,
@@ -7645,6 +10939,7 @@ static const OnigCodePoint CR_Changes_When_Lowercased[] = {
0x2ce2, 0x2ce2,
0x2ceb, 0x2ceb,
0x2ced, 0x2ced,
+ 0x2cf2, 0x2cf2,
0xa640, 0xa640,
0xa642, 0xa642,
0xa644, 0xa644,
@@ -7728,18 +11023,20 @@ static const OnigCodePoint CR_Changes_When_Lowercased[] = {
0xa78b, 0xa78b,
0xa78d, 0xa78d,
0xa790, 0xa790,
+ 0xa792, 0xa792,
0xa7a0, 0xa7a0,
0xa7a2, 0xa7a2,
0xa7a4, 0xa7a4,
0xa7a6, 0xa7a6,
0xa7a8, 0xa7a8,
+ 0xa7aa, 0xa7aa,
0xff21, 0xff3a,
0x10400, 0x10427,
}; /* CR_Changes_When_Lowercased */
/* 'Changes_When_Uppercased': Derived Property */
static const OnigCodePoint CR_Changes_When_Uppercased[] = {
- 582,
+ 586,
0x0061, 0x007a,
0x00b5, 0x00b5,
0x00df, 0x00f6,
@@ -7889,7 +11186,7 @@ static const OnigCodePoint CR_Changes_When_Uppercased[] = {
0x025b, 0x025b,
0x0260, 0x0260,
0x0263, 0x0263,
- 0x0265, 0x0265,
+ 0x0265, 0x0266,
0x0268, 0x0269,
0x026b, 0x026b,
0x026f, 0x026f,
@@ -8230,7 +11527,10 @@ static const OnigCodePoint CR_Changes_When_Uppercased[] = {
0x2ce3, 0x2ce3,
0x2cec, 0x2cec,
0x2cee, 0x2cee,
+ 0x2cf3, 0x2cf3,
0x2d00, 0x2d25,
+ 0x2d27, 0x2d27,
+ 0x2d2d, 0x2d2d,
0xa641, 0xa641,
0xa643, 0xa643,
0xa645, 0xa645,
@@ -8313,6 +11613,7 @@ static const OnigCodePoint CR_Changes_When_Uppercased[] = {
0xa787, 0xa787,
0xa78c, 0xa78c,
0xa791, 0xa791,
+ 0xa793, 0xa793,
0xa7a1, 0xa7a1,
0xa7a3, 0xa7a3,
0xa7a5, 0xa7a5,
@@ -8326,7 +11627,7 @@ static const OnigCodePoint CR_Changes_When_Uppercased[] = {
/* 'Changes_When_Titlecased': Derived Property */
static const OnigCodePoint CR_Changes_When_Titlecased[] = {
- 583,
+ 587,
0x0061, 0x007a,
0x00b5, 0x00b5,
0x00df, 0x00f6,
@@ -8477,7 +11778,7 @@ static const OnigCodePoint CR_Changes_When_Titlecased[] = {
0x025b, 0x025b,
0x0260, 0x0260,
0x0263, 0x0263,
- 0x0265, 0x0265,
+ 0x0265, 0x0266,
0x0268, 0x0269,
0x026b, 0x026b,
0x026f, 0x026f,
@@ -8818,7 +12119,10 @@ static const OnigCodePoint CR_Changes_When_Titlecased[] = {
0x2ce3, 0x2ce3,
0x2cec, 0x2cec,
0x2cee, 0x2cee,
+ 0x2cf3, 0x2cf3,
0x2d00, 0x2d25,
+ 0x2d27, 0x2d27,
+ 0x2d2d, 0x2d2d,
0xa641, 0xa641,
0xa643, 0xa643,
0xa645, 0xa645,
@@ -8901,6 +12205,7 @@ static const OnigCodePoint CR_Changes_When_Titlecased[] = {
0xa787, 0xa787,
0xa78c, 0xa78c,
0xa791, 0xa791,
+ 0xa793, 0xa793,
0xa7a1, 0xa7a1,
0xa7a3, 0xa7a3,
0xa7a5, 0xa7a5,
@@ -8914,7 +12219,7 @@ static const OnigCodePoint CR_Changes_When_Titlecased[] = {
/* 'Changes_When_Casefolded': Derived Property */
static const OnigCodePoint CR_Changes_When_Casefolded[] = {
- 577,
+ 582,
0x0041, 0x005a,
0x00b5, 0x00b5,
0x00c0, 0x00d6,
@@ -9189,6 +12494,8 @@ static const OnigCodePoint CR_Changes_When_Casefolded[] = {
0x0531, 0x0556,
0x0587, 0x0587,
0x10a0, 0x10c5,
+ 0x10c7, 0x10c7,
+ 0x10cd, 0x10cd,
0x1e00, 0x1e00,
0x1e02, 0x1e02,
0x1e04, 0x1e04,
@@ -9400,6 +12707,7 @@ static const OnigCodePoint CR_Changes_When_Casefolded[] = {
0x2ce2, 0x2ce2,
0x2ceb, 0x2ceb,
0x2ced, 0x2ced,
+ 0x2cf2, 0x2cf2,
0xa640, 0xa640,
0xa642, 0xa642,
0xa644, 0xa644,
@@ -9483,11 +12791,13 @@ static const OnigCodePoint CR_Changes_When_Casefolded[] = {
0xa78b, 0xa78b,
0xa78d, 0xa78d,
0xa790, 0xa790,
+ 0xa792, 0xa792,
0xa7a0, 0xa7a0,
0xa7a2, 0xa7a2,
0xa7a4, 0xa7a4,
0xa7a6, 0xa7a6,
0xa7a8, 0xa7a8,
+ 0xa7aa, 0xa7aa,
0xfb00, 0xfb06,
0xfb13, 0xfb17,
0xff21, 0xff3a,
@@ -9496,7 +12806,7 @@ static const OnigCodePoint CR_Changes_When_Casefolded[] = {
/* 'Changes_When_Casemapped': Derived Property */
static const OnigCodePoint CR_Changes_When_Casemapped[] = {
- 99,
+ 104,
0x0041, 0x005a,
0x0061, 0x007a,
0x00b5, 0x00b5,
@@ -9517,7 +12827,7 @@ static const OnigCodePoint CR_Changes_When_Casemapped[] = {
0x025b, 0x025b,
0x0260, 0x0260,
0x0263, 0x0263,
- 0x0265, 0x0265,
+ 0x0265, 0x0266,
0x0268, 0x0269,
0x026b, 0x026b,
0x026f, 0x026f,
@@ -9545,6 +12855,8 @@ static const OnigCodePoint CR_Changes_When_Casemapped[] = {
0x0531, 0x0556,
0x0561, 0x0587,
0x10a0, 0x10c5,
+ 0x10c7, 0x10c7,
+ 0x10cd, 0x10cd,
0x1d79, 0x1d79,
0x1d7d, 0x1d7d,
0x1e00, 0x1e9b,
@@ -9582,15 +12894,18 @@ static const OnigCodePoint CR_Changes_When_Casemapped[] = {
0x2c75, 0x2c76,
0x2c7e, 0x2ce3,
0x2ceb, 0x2cee,
+ 0x2cf2, 0x2cf3,
0x2d00, 0x2d25,
+ 0x2d27, 0x2d27,
+ 0x2d2d, 0x2d2d,
0xa640, 0xa66d,
0xa680, 0xa697,
0xa722, 0xa72f,
0xa732, 0xa76f,
0xa779, 0xa787,
0xa78b, 0xa78d,
- 0xa790, 0xa791,
- 0xa7a0, 0xa7a9,
+ 0xa790, 0xa793,
+ 0xa7a0, 0xa7aa,
0xfb00, 0xfb06,
0xfb13, 0xfb17,
0xff21, 0xff3a,
@@ -9600,7 +12915,7 @@ static const OnigCodePoint CR_Changes_When_Casemapped[] = {
/* 'ID_Start': Derived Property */
static const OnigCodePoint CR_ID_Start[] = {
- 437,
+ 488,
0x0041, 0x005a,
0x0061, 0x007a,
0x00aa, 0x00aa,
@@ -9648,6 +12963,8 @@ static const OnigCodePoint CR_ID_Start[] = {
0x0824, 0x0824,
0x0828, 0x0828,
0x0840, 0x0858,
+ 0x08a0, 0x08a0,
+ 0x08a2, 0x08ac,
0x0904, 0x0939,
0x093d, 0x093d,
0x0950, 0x0950,
@@ -9753,7 +13070,7 @@ static const OnigCodePoint CR_ID_Start[] = {
0x0ebd, 0x0ebd,
0x0ec0, 0x0ec4,
0x0ec6, 0x0ec6,
- 0x0edc, 0x0edd,
+ 0x0edc, 0x0edf,
0x0f00, 0x0f00,
0x0f40, 0x0f47,
0x0f49, 0x0f6c,
@@ -9768,9 +13085,10 @@ static const OnigCodePoint CR_ID_Start[] = {
0x1075, 0x1081,
0x108e, 0x108e,
0x10a0, 0x10c5,
+ 0x10c7, 0x10c7,
+ 0x10cd, 0x10cd,
0x10d0, 0x10fa,
- 0x10fc, 0x10fc,
- 0x1100, 0x1248,
+ 0x10fc, 0x1248,
0x124a, 0x124d,
0x1250, 0x1256,
0x1258, 0x1258,
@@ -9818,12 +13136,13 @@ static const OnigCodePoint CR_ID_Start[] = {
0x1b45, 0x1b4b,
0x1b83, 0x1ba0,
0x1bae, 0x1baf,
- 0x1bc0, 0x1be5,
+ 0x1bba, 0x1be5,
0x1c00, 0x1c23,
0x1c4d, 0x1c4f,
0x1c5a, 0x1c7d,
0x1ce9, 0x1cec,
0x1cee, 0x1cf1,
+ 0x1cf5, 0x1cf6,
0x1d00, 0x1dbf,
0x1e00, 0x1f15,
0x1f18, 0x1f1d,
@@ -9864,8 +13183,11 @@ static const OnigCodePoint CR_ID_Start[] = {
0x2c30, 0x2c5e,
0x2c60, 0x2ce4,
0x2ceb, 0x2cee,
+ 0x2cf2, 0x2cf3,
0x2d00, 0x2d25,
- 0x2d30, 0x2d65,
+ 0x2d27, 0x2d27,
+ 0x2d2d, 0x2d2d,
+ 0x2d30, 0x2d67,
0x2d6f, 0x2d6f,
0x2d80, 0x2d96,
0x2da0, 0x2da6,
@@ -9889,7 +13211,7 @@ static const OnigCodePoint CR_ID_Start[] = {
0x31a0, 0x31ba,
0x31f0, 0x31ff,
0x3400, 0x4db5,
- 0x4e00, 0x9fcb,
+ 0x4e00, 0x9fcc,
0xa000, 0xa48c,
0xa4d0, 0xa4fd,
0xa500, 0xa60c,
@@ -9901,9 +13223,9 @@ static const OnigCodePoint CR_ID_Start[] = {
0xa717, 0xa71f,
0xa722, 0xa788,
0xa78b, 0xa78e,
- 0xa790, 0xa791,
- 0xa7a0, 0xa7a9,
- 0xa7fa, 0xa801,
+ 0xa790, 0xa793,
+ 0xa7a0, 0xa7aa,
+ 0xa7f8, 0xa801,
0xa803, 0xa805,
0xa807, 0xa80a,
0xa80c, 0xa822,
@@ -9928,6 +13250,8 @@ static const OnigCodePoint CR_ID_Start[] = {
0xaac0, 0xaac0,
0xaac2, 0xaac2,
0xaadb, 0xaadd,
+ 0xaae0, 0xaaea,
+ 0xaaf2, 0xaaf4,
0xab01, 0xab06,
0xab09, 0xab0e,
0xab11, 0xab16,
@@ -9937,8 +13261,7 @@ static const OnigCodePoint CR_ID_Start[] = {
0xac00, 0xd7a3,
0xd7b0, 0xd7c6,
0xd7cb, 0xd7fb,
- 0xf900, 0xfa2d,
- 0xfa30, 0xfa6d,
+ 0xf900, 0xfa6d,
0xfa70, 0xfad9,
0xfb00, 0xfb06,
0xfb13, 0xfb17,
@@ -9988,6 +13311,8 @@ static const OnigCodePoint CR_ID_Start[] = {
0x1083f, 0x10855,
0x10900, 0x10915,
0x10920, 0x10939,
+ 0x10980, 0x109b7,
+ 0x109be, 0x109bf,
0x10a00, 0x10a00,
0x10a10, 0x10a13,
0x10a15, 0x10a17,
@@ -9999,10 +13324,18 @@ static const OnigCodePoint CR_ID_Start[] = {
0x10c00, 0x10c48,
0x11003, 0x11037,
0x11083, 0x110af,
+ 0x110d0, 0x110e8,
+ 0x11103, 0x11126,
+ 0x11183, 0x111b2,
+ 0x111c1, 0x111c4,
+ 0x11680, 0x116aa,
0x12000, 0x1236e,
0x12400, 0x12462,
0x13000, 0x1342e,
0x16800, 0x16a38,
+ 0x16f00, 0x16f44,
+ 0x16f50, 0x16f50,
+ 0x16f93, 0x16f9f,
0x1b000, 0x1b001,
0x1d400, 0x1d454,
0x1d456, 0x1d49c,
@@ -10034,6 +13367,39 @@ static const OnigCodePoint CR_ID_Start[] = {
0x1d78a, 0x1d7a8,
0x1d7aa, 0x1d7c2,
0x1d7c4, 0x1d7cb,
+ 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,
0x20000, 0x2a6d6,
0x2a700, 0x2b734,
0x2b740, 0x2b81d,
@@ -10042,7 +13408,7 @@ static const OnigCodePoint CR_ID_Start[] = {
/* 'ID_Continue': Derived Property */
static const OnigCodePoint CR_ID_Continue[] = {
- 514,
+ 564,
0x0030, 0x0039,
0x0041, 0x005a,
0x005f, 0x005f,
@@ -10091,6 +13457,9 @@ static const OnigCodePoint CR_ID_Continue[] = {
0x07fa, 0x07fa,
0x0800, 0x082d,
0x0840, 0x085b,
+ 0x08a0, 0x08a0,
+ 0x08a2, 0x08ac,
+ 0x08e4, 0x08fe,
0x0900, 0x0963,
0x0966, 0x096f,
0x0971, 0x0977,
@@ -10238,7 +13607,7 @@ static const OnigCodePoint CR_ID_Continue[] = {
0x0ec6, 0x0ec6,
0x0ec8, 0x0ecd,
0x0ed0, 0x0ed9,
- 0x0edc, 0x0edd,
+ 0x0edc, 0x0edf,
0x0f00, 0x0f00,
0x0f18, 0x0f19,
0x0f20, 0x0f29,
@@ -10254,9 +13623,10 @@ static const OnigCodePoint CR_ID_Continue[] = {
0x1000, 0x1049,
0x1050, 0x109d,
0x10a0, 0x10c5,
+ 0x10c7, 0x10c7,
+ 0x10cd, 0x10cd,
0x10d0, 0x10fa,
- 0x10fc, 0x10fc,
- 0x1100, 0x1248,
+ 0x10fc, 0x1248,
0x124a, 0x124d,
0x1250, 0x1256,
0x1258, 0x1258,
@@ -10288,8 +13658,7 @@ static const OnigCodePoint CR_ID_Continue[] = {
0x1760, 0x176c,
0x176e, 0x1770,
0x1772, 0x1773,
- 0x1780, 0x17b3,
- 0x17b6, 0x17d3,
+ 0x1780, 0x17d3,
0x17d7, 0x17d7,
0x17dc, 0x17dd,
0x17e0, 0x17e9,
@@ -10315,14 +13684,12 @@ static const OnigCodePoint CR_ID_Continue[] = {
0x1b00, 0x1b4b,
0x1b50, 0x1b59,
0x1b6b, 0x1b73,
- 0x1b80, 0x1baa,
- 0x1bae, 0x1bb9,
- 0x1bc0, 0x1bf3,
+ 0x1b80, 0x1bf3,
0x1c00, 0x1c37,
0x1c40, 0x1c49,
0x1c4d, 0x1c7d,
0x1cd0, 0x1cd2,
- 0x1cd4, 0x1cf2,
+ 0x1cd4, 0x1cf6,
0x1d00, 0x1de6,
0x1dfc, 0x1f15,
0x1f18, 0x1f1d,
@@ -10367,9 +13734,11 @@ static const OnigCodePoint CR_ID_Continue[] = {
0x2c00, 0x2c2e,
0x2c30, 0x2c5e,
0x2c60, 0x2ce4,
- 0x2ceb, 0x2cf1,
+ 0x2ceb, 0x2cf3,
0x2d00, 0x2d25,
- 0x2d30, 0x2d65,
+ 0x2d27, 0x2d27,
+ 0x2d2d, 0x2d2d,
+ 0x2d30, 0x2d67,
0x2d6f, 0x2d6f,
0x2d7f, 0x2d96,
0x2da0, 0x2da6,
@@ -10394,21 +13763,21 @@ static const OnigCodePoint CR_ID_Continue[] = {
0x31a0, 0x31ba,
0x31f0, 0x31ff,
0x3400, 0x4db5,
- 0x4e00, 0x9fcb,
+ 0x4e00, 0x9fcc,
0xa000, 0xa48c,
0xa4d0, 0xa4fd,
0xa500, 0xa60c,
0xa610, 0xa62b,
0xa640, 0xa66f,
- 0xa67c, 0xa67d,
+ 0xa674, 0xa67d,
0xa67f, 0xa697,
- 0xa6a0, 0xa6f1,
+ 0xa69f, 0xa6f1,
0xa717, 0xa71f,
0xa722, 0xa788,
0xa78b, 0xa78e,
- 0xa790, 0xa791,
- 0xa7a0, 0xa7a9,
- 0xa7fa, 0xa827,
+ 0xa790, 0xa793,
+ 0xa7a0, 0xa7aa,
+ 0xa7f8, 0xa827,
0xa840, 0xa873,
0xa880, 0xa8c4,
0xa8d0, 0xa8d9,
@@ -10426,6 +13795,8 @@ static const OnigCodePoint CR_ID_Continue[] = {
0xaa7a, 0xaa7b,
0xaa80, 0xaac2,
0xaadb, 0xaadd,
+ 0xaae0, 0xaaef,
+ 0xaaf2, 0xaaf6,
0xab01, 0xab06,
0xab09, 0xab0e,
0xab11, 0xab16,
@@ -10437,8 +13808,7 @@ static const OnigCodePoint CR_ID_Continue[] = {
0xac00, 0xd7a3,
0xd7b0, 0xd7c6,
0xd7cb, 0xd7fb,
- 0xf900, 0xfa2d,
- 0xfa30, 0xfa6d,
+ 0xf900, 0xfa6d,
0xfa70, 0xfad9,
0xfb00, 0xfb06,
0xfb13, 0xfb17,
@@ -10495,6 +13865,8 @@ static const OnigCodePoint CR_ID_Continue[] = {
0x1083f, 0x10855,
0x10900, 0x10915,
0x10920, 0x10939,
+ 0x10980, 0x109b7,
+ 0x109be, 0x109bf,
0x10a00, 0x10a03,
0x10a05, 0x10a06,
0x10a0c, 0x10a13,
@@ -10510,10 +13882,21 @@ static const OnigCodePoint CR_ID_Continue[] = {
0x11000, 0x11046,
0x11066, 0x1106f,
0x11080, 0x110ba,
+ 0x110d0, 0x110e8,
+ 0x110f0, 0x110f9,
+ 0x11100, 0x11134,
+ 0x11136, 0x1113f,
+ 0x11180, 0x111c4,
+ 0x111d0, 0x111d9,
+ 0x11680, 0x116b7,
+ 0x116c0, 0x116c9,
0x12000, 0x1236e,
0x12400, 0x12462,
0x13000, 0x1342e,
0x16800, 0x16a38,
+ 0x16f00, 0x16f44,
+ 0x16f50, 0x16f7e,
+ 0x16f8f, 0x16f9f,
0x1b000, 0x1b001,
0x1d165, 0x1d169,
0x1d16d, 0x1d172,
@@ -10552,6 +13935,39 @@ static const OnigCodePoint CR_ID_Continue[] = {
0x1d7aa, 0x1d7c2,
0x1d7c4, 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,
0x20000, 0x2a6d6,
0x2a700, 0x2b734,
0x2b740, 0x2b81d,
@@ -10561,7 +13977,7 @@ static const OnigCodePoint CR_ID_Continue[] = {
/* 'XID_Start': Derived Property */
static const OnigCodePoint CR_XID_Start[] = {
- 444,
+ 495,
0x0041, 0x005a,
0x0061, 0x007a,
0x00aa, 0x00aa,
@@ -10609,6 +14025,8 @@ static const OnigCodePoint CR_XID_Start[] = {
0x0824, 0x0824,
0x0828, 0x0828,
0x0840, 0x0858,
+ 0x08a0, 0x08a0,
+ 0x08a2, 0x08ac,
0x0904, 0x0939,
0x093d, 0x093d,
0x0950, 0x0950,
@@ -10714,7 +14132,7 @@ static const OnigCodePoint CR_XID_Start[] = {
0x0ebd, 0x0ebd,
0x0ec0, 0x0ec4,
0x0ec6, 0x0ec6,
- 0x0edc, 0x0edd,
+ 0x0edc, 0x0edf,
0x0f00, 0x0f00,
0x0f40, 0x0f47,
0x0f49, 0x0f6c,
@@ -10729,9 +14147,10 @@ static const OnigCodePoint CR_XID_Start[] = {
0x1075, 0x1081,
0x108e, 0x108e,
0x10a0, 0x10c5,
+ 0x10c7, 0x10c7,
+ 0x10cd, 0x10cd,
0x10d0, 0x10fa,
- 0x10fc, 0x10fc,
- 0x1100, 0x1248,
+ 0x10fc, 0x1248,
0x124a, 0x124d,
0x1250, 0x1256,
0x1258, 0x1258,
@@ -10779,12 +14198,13 @@ static const OnigCodePoint CR_XID_Start[] = {
0x1b45, 0x1b4b,
0x1b83, 0x1ba0,
0x1bae, 0x1baf,
- 0x1bc0, 0x1be5,
+ 0x1bba, 0x1be5,
0x1c00, 0x1c23,
0x1c4d, 0x1c4f,
0x1c5a, 0x1c7d,
0x1ce9, 0x1cec,
0x1cee, 0x1cf1,
+ 0x1cf5, 0x1cf6,
0x1d00, 0x1dbf,
0x1e00, 0x1f15,
0x1f18, 0x1f1d,
@@ -10825,8 +14245,11 @@ static const OnigCodePoint CR_XID_Start[] = {
0x2c30, 0x2c5e,
0x2c60, 0x2ce4,
0x2ceb, 0x2cee,
+ 0x2cf2, 0x2cf3,
0x2d00, 0x2d25,
- 0x2d30, 0x2d65,
+ 0x2d27, 0x2d27,
+ 0x2d2d, 0x2d2d,
+ 0x2d30, 0x2d67,
0x2d6f, 0x2d6f,
0x2d80, 0x2d96,
0x2da0, 0x2da6,
@@ -10850,7 +14273,7 @@ static const OnigCodePoint CR_XID_Start[] = {
0x31a0, 0x31ba,
0x31f0, 0x31ff,
0x3400, 0x4db5,
- 0x4e00, 0x9fcb,
+ 0x4e00, 0x9fcc,
0xa000, 0xa48c,
0xa4d0, 0xa4fd,
0xa500, 0xa60c,
@@ -10862,9 +14285,9 @@ static const OnigCodePoint CR_XID_Start[] = {
0xa717, 0xa71f,
0xa722, 0xa788,
0xa78b, 0xa78e,
- 0xa790, 0xa791,
- 0xa7a0, 0xa7a9,
- 0xa7fa, 0xa801,
+ 0xa790, 0xa793,
+ 0xa7a0, 0xa7aa,
+ 0xa7f8, 0xa801,
0xa803, 0xa805,
0xa807, 0xa80a,
0xa80c, 0xa822,
@@ -10889,6 +14312,8 @@ static const OnigCodePoint CR_XID_Start[] = {
0xaac0, 0xaac0,
0xaac2, 0xaac2,
0xaadb, 0xaadd,
+ 0xaae0, 0xaaea,
+ 0xaaf2, 0xaaf4,
0xab01, 0xab06,
0xab09, 0xab0e,
0xab11, 0xab16,
@@ -10898,8 +14323,7 @@ static const OnigCodePoint CR_XID_Start[] = {
0xac00, 0xd7a3,
0xd7b0, 0xd7c6,
0xd7cb, 0xd7fb,
- 0xf900, 0xfa2d,
- 0xfa30, 0xfa6d,
+ 0xf900, 0xfa6d,
0xfa70, 0xfad9,
0xfb00, 0xfb06,
0xfb13, 0xfb17,
@@ -10956,6 +14380,8 @@ static const OnigCodePoint CR_XID_Start[] = {
0x1083f, 0x10855,
0x10900, 0x10915,
0x10920, 0x10939,
+ 0x10980, 0x109b7,
+ 0x109be, 0x109bf,
0x10a00, 0x10a00,
0x10a10, 0x10a13,
0x10a15, 0x10a17,
@@ -10967,10 +14393,18 @@ static const OnigCodePoint CR_XID_Start[] = {
0x10c00, 0x10c48,
0x11003, 0x11037,
0x11083, 0x110af,
+ 0x110d0, 0x110e8,
+ 0x11103, 0x11126,
+ 0x11183, 0x111b2,
+ 0x111c1, 0x111c4,
+ 0x11680, 0x116aa,
0x12000, 0x1236e,
0x12400, 0x12462,
0x13000, 0x1342e,
0x16800, 0x16a38,
+ 0x16f00, 0x16f44,
+ 0x16f50, 0x16f50,
+ 0x16f93, 0x16f9f,
0x1b000, 0x1b001,
0x1d400, 0x1d454,
0x1d456, 0x1d49c,
@@ -11002,6 +14436,39 @@ static const OnigCodePoint CR_XID_Start[] = {
0x1d78a, 0x1d7a8,
0x1d7aa, 0x1d7c2,
0x1d7c4, 0x1d7cb,
+ 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,
0x20000, 0x2a6d6,
0x2a700, 0x2b734,
0x2b740, 0x2b81d,
@@ -11010,7 +14477,7 @@ static const OnigCodePoint CR_XID_Start[] = {
/* 'XID_Continue': Derived Property */
static const OnigCodePoint CR_XID_Continue[] = {
- 521,
+ 571,
0x0030, 0x0039,
0x0041, 0x005a,
0x005f, 0x005f,
@@ -11059,6 +14526,9 @@ static const OnigCodePoint CR_XID_Continue[] = {
0x07fa, 0x07fa,
0x0800, 0x082d,
0x0840, 0x085b,
+ 0x08a0, 0x08a0,
+ 0x08a2, 0x08ac,
+ 0x08e4, 0x08fe,
0x0900, 0x0963,
0x0966, 0x096f,
0x0971, 0x0977,
@@ -11206,7 +14676,7 @@ static const OnigCodePoint CR_XID_Continue[] = {
0x0ec6, 0x0ec6,
0x0ec8, 0x0ecd,
0x0ed0, 0x0ed9,
- 0x0edc, 0x0edd,
+ 0x0edc, 0x0edf,
0x0f00, 0x0f00,
0x0f18, 0x0f19,
0x0f20, 0x0f29,
@@ -11222,9 +14692,10 @@ static const OnigCodePoint CR_XID_Continue[] = {
0x1000, 0x1049,
0x1050, 0x109d,
0x10a0, 0x10c5,
+ 0x10c7, 0x10c7,
+ 0x10cd, 0x10cd,
0x10d0, 0x10fa,
- 0x10fc, 0x10fc,
- 0x1100, 0x1248,
+ 0x10fc, 0x1248,
0x124a, 0x124d,
0x1250, 0x1256,
0x1258, 0x1258,
@@ -11256,8 +14727,7 @@ static const OnigCodePoint CR_XID_Continue[] = {
0x1760, 0x176c,
0x176e, 0x1770,
0x1772, 0x1773,
- 0x1780, 0x17b3,
- 0x17b6, 0x17d3,
+ 0x1780, 0x17d3,
0x17d7, 0x17d7,
0x17dc, 0x17dd,
0x17e0, 0x17e9,
@@ -11283,14 +14753,12 @@ static const OnigCodePoint CR_XID_Continue[] = {
0x1b00, 0x1b4b,
0x1b50, 0x1b59,
0x1b6b, 0x1b73,
- 0x1b80, 0x1baa,
- 0x1bae, 0x1bb9,
- 0x1bc0, 0x1bf3,
+ 0x1b80, 0x1bf3,
0x1c00, 0x1c37,
0x1c40, 0x1c49,
0x1c4d, 0x1c7d,
0x1cd0, 0x1cd2,
- 0x1cd4, 0x1cf2,
+ 0x1cd4, 0x1cf6,
0x1d00, 0x1de6,
0x1dfc, 0x1f15,
0x1f18, 0x1f1d,
@@ -11335,9 +14803,11 @@ static const OnigCodePoint CR_XID_Continue[] = {
0x2c00, 0x2c2e,
0x2c30, 0x2c5e,
0x2c60, 0x2ce4,
- 0x2ceb, 0x2cf1,
+ 0x2ceb, 0x2cf3,
0x2d00, 0x2d25,
- 0x2d30, 0x2d65,
+ 0x2d27, 0x2d27,
+ 0x2d2d, 0x2d2d,
+ 0x2d30, 0x2d67,
0x2d6f, 0x2d6f,
0x2d7f, 0x2d96,
0x2da0, 0x2da6,
@@ -11363,21 +14833,21 @@ static const OnigCodePoint CR_XID_Continue[] = {
0x31a0, 0x31ba,
0x31f0, 0x31ff,
0x3400, 0x4db5,
- 0x4e00, 0x9fcb,
+ 0x4e00, 0x9fcc,
0xa000, 0xa48c,
0xa4d0, 0xa4fd,
0xa500, 0xa60c,
0xa610, 0xa62b,
0xa640, 0xa66f,
- 0xa67c, 0xa67d,
+ 0xa674, 0xa67d,
0xa67f, 0xa697,
- 0xa6a0, 0xa6f1,
+ 0xa69f, 0xa6f1,
0xa717, 0xa71f,
0xa722, 0xa788,
0xa78b, 0xa78e,
- 0xa790, 0xa791,
- 0xa7a0, 0xa7a9,
- 0xa7fa, 0xa827,
+ 0xa790, 0xa793,
+ 0xa7a0, 0xa7aa,
+ 0xa7f8, 0xa827,
0xa840, 0xa873,
0xa880, 0xa8c4,
0xa8d0, 0xa8d9,
@@ -11395,6 +14865,8 @@ static const OnigCodePoint CR_XID_Continue[] = {
0xaa7a, 0xaa7b,
0xaa80, 0xaac2,
0xaadb, 0xaadd,
+ 0xaae0, 0xaaef,
+ 0xaaf2, 0xaaf6,
0xab01, 0xab06,
0xab09, 0xab0e,
0xab11, 0xab16,
@@ -11406,8 +14878,7 @@ static const OnigCodePoint CR_XID_Continue[] = {
0xac00, 0xd7a3,
0xd7b0, 0xd7c6,
0xd7cb, 0xd7fb,
- 0xf900, 0xfa2d,
- 0xfa30, 0xfa6d,
+ 0xf900, 0xfa6d,
0xfa70, 0xfad9,
0xfb00, 0xfb06,
0xfb13, 0xfb17,
@@ -11470,6 +14941,8 @@ static const OnigCodePoint CR_XID_Continue[] = {
0x1083f, 0x10855,
0x10900, 0x10915,
0x10920, 0x10939,
+ 0x10980, 0x109b7,
+ 0x109be, 0x109bf,
0x10a00, 0x10a03,
0x10a05, 0x10a06,
0x10a0c, 0x10a13,
@@ -11485,10 +14958,21 @@ static const OnigCodePoint CR_XID_Continue[] = {
0x11000, 0x11046,
0x11066, 0x1106f,
0x11080, 0x110ba,
+ 0x110d0, 0x110e8,
+ 0x110f0, 0x110f9,
+ 0x11100, 0x11134,
+ 0x11136, 0x1113f,
+ 0x11180, 0x111c4,
+ 0x111d0, 0x111d9,
+ 0x11680, 0x116b7,
+ 0x116c0, 0x116c9,
0x12000, 0x1236e,
0x12400, 0x12462,
0x13000, 0x1342e,
0x16800, 0x16a38,
+ 0x16f00, 0x16f44,
+ 0x16f50, 0x16f7e,
+ 0x16f8f, 0x16f9f,
0x1b000, 0x1b001,
0x1d165, 0x1d169,
0x1d16d, 0x1d172,
@@ -11527,6 +15011,39 @@ static const OnigCodePoint CR_XID_Continue[] = {
0x1d7aa, 0x1d7c2,
0x1d7c4, 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,
0x20000, 0x2a6d6,
0x2a700, 0x2b734,
0x2b740, 0x2b81d,
@@ -11556,7 +15073,7 @@ static const OnigCodePoint CR_Default_Ignorable_Code_Point[] = {
/* 'Grapheme_Extend': Derived Property */
static const OnigCodePoint CR_Grapheme_Extend[] = {
- 215,
+ 232,
0x0300, 0x036f,
0x0483, 0x0489,
0x0591, 0x05bd,
@@ -11580,6 +15097,7 @@ static const OnigCodePoint CR_Grapheme_Extend[] = {
0x0825, 0x0827,
0x0829, 0x082d,
0x0859, 0x085b,
+ 0x08e4, 0x08fe,
0x0900, 0x0902,
0x093a, 0x093a,
0x093c, 0x093c,
@@ -11675,6 +15193,7 @@ static const OnigCodePoint CR_Grapheme_Extend[] = {
0x1732, 0x1734,
0x1752, 0x1753,
0x1772, 0x1773,
+ 0x17b4, 0x17b5,
0x17b7, 0x17bd,
0x17c6, 0x17c6,
0x17c9, 0x17d3,
@@ -11702,6 +15221,7 @@ static const OnigCodePoint CR_Grapheme_Extend[] = {
0x1b80, 0x1b81,
0x1ba2, 0x1ba5,
0x1ba8, 0x1ba9,
+ 0x1bab, 0x1bab,
0x1be6, 0x1be6,
0x1be8, 0x1be9,
0x1bed, 0x1bed,
@@ -11712,6 +15232,7 @@ static const OnigCodePoint CR_Grapheme_Extend[] = {
0x1cd4, 0x1ce0,
0x1ce2, 0x1ce8,
0x1ced, 0x1ced,
+ 0x1cf4, 0x1cf4,
0x1dc0, 0x1de6,
0x1dfc, 0x1dff,
0x200c, 0x200d,
@@ -11722,7 +15243,8 @@ static const OnigCodePoint CR_Grapheme_Extend[] = {
0x302a, 0x302f,
0x3099, 0x309a,
0xa66f, 0xa672,
- 0xa67c, 0xa67d,
+ 0xa674, 0xa67d,
+ 0xa69f, 0xa69f,
0xa6f0, 0xa6f1,
0xa802, 0xa802,
0xa806, 0xa806,
@@ -11746,6 +15268,8 @@ static const OnigCodePoint CR_Grapheme_Extend[] = {
0xaab7, 0xaab8,
0xaabe, 0xaabf,
0xaac1, 0xaac1,
+ 0xaaec, 0xaaed,
+ 0xaaf6, 0xaaf6,
0xabe5, 0xabe5,
0xabe8, 0xabe8,
0xabed, 0xabed,
@@ -11764,6 +15288,16 @@ static const OnigCodePoint CR_Grapheme_Extend[] = {
0x11080, 0x11081,
0x110b3, 0x110b6,
0x110b9, 0x110ba,
+ 0x11100, 0x11102,
+ 0x11127, 0x1112b,
+ 0x1112d, 0x11134,
+ 0x11180, 0x11181,
+ 0x111b6, 0x111be,
+ 0x116ab, 0x116ab,
+ 0x116ad, 0x116ad,
+ 0x116b0, 0x116b5,
+ 0x116b7, 0x116b7,
+ 0x16f8f, 0x16f92,
0x1d165, 0x1d165,
0x1d167, 0x1d169,
0x1d16e, 0x1d172,
@@ -11776,7 +15310,7 @@ static const OnigCodePoint CR_Grapheme_Extend[] = {
/* 'Grapheme_Base': Derived Property */
static const OnigCodePoint CR_Grapheme_Base[] = {
- 596,
+ 643,
0x0020, 0x007e,
0x00a0, 0x00ac,
0x00ae, 0x02ff,
@@ -11791,6 +15325,7 @@ static const OnigCodePoint CR_Grapheme_Base[] = {
0x0559, 0x055f,
0x0561, 0x0587,
0x0589, 0x058a,
+ 0x058f, 0x058f,
0x05be, 0x05be,
0x05c0, 0x05c0,
0x05c3, 0x05c3,
@@ -11819,6 +15354,8 @@ static const OnigCodePoint CR_Grapheme_Base[] = {
0x0830, 0x083e,
0x0840, 0x0858,
0x085e, 0x085e,
+ 0x08a0, 0x08a0,
+ 0x08a2, 0x08ac,
0x0903, 0x0939,
0x093b, 0x093b,
0x093d, 0x0940,
@@ -11867,8 +15404,7 @@ static const OnigCodePoint CR_Grapheme_Base[] = {
0x0acb, 0x0acc,
0x0ad0, 0x0ad0,
0x0ae0, 0x0ae1,
- 0x0ae6, 0x0aef,
- 0x0af1, 0x0af1,
+ 0x0ae6, 0x0af1,
0x0b02, 0x0b03,
0x0b05, 0x0b0c,
0x0b0f, 0x0b10,
@@ -11968,7 +15504,7 @@ static const OnigCodePoint CR_Grapheme_Base[] = {
0x0ec0, 0x0ec4,
0x0ec6, 0x0ec6,
0x0ed0, 0x0ed9,
- 0x0edc, 0x0edd,
+ 0x0edc, 0x0edf,
0x0f00, 0x0f17,
0x0f1a, 0x0f34,
0x0f36, 0x0f36,
@@ -11993,8 +15529,9 @@ static const OnigCodePoint CR_Grapheme_Base[] = {
0x1087, 0x108c,
0x108e, 0x109c,
0x109e, 0x10c5,
- 0x10d0, 0x10fc,
- 0x1100, 0x1248,
+ 0x10c7, 0x10c7,
+ 0x10cd, 0x10cd,
+ 0x10d0, 0x1248,
0x124a, 0x124d,
0x1250, 0x1256,
0x1258, 0x1258,
@@ -12067,8 +15604,7 @@ static const OnigCodePoint CR_Grapheme_Base[] = {
0x1b82, 0x1ba1,
0x1ba6, 0x1ba7,
0x1baa, 0x1baa,
- 0x1bae, 0x1bb9,
- 0x1bc0, 0x1be5,
+ 0x1bac, 0x1be5,
0x1be7, 0x1be7,
0x1bea, 0x1bec,
0x1bee, 0x1bee,
@@ -12077,10 +15613,12 @@ static const OnigCodePoint CR_Grapheme_Base[] = {
0x1c34, 0x1c35,
0x1c3b, 0x1c49,
0x1c4d, 0x1c7f,
+ 0x1cc0, 0x1cc7,
0x1cd3, 0x1cd3,
0x1ce1, 0x1ce1,
0x1ce9, 0x1cec,
- 0x1cee, 0x1cf2,
+ 0x1cee, 0x1cf3,
+ 0x1cf5, 0x1cf6,
0x1d00, 0x1dbf,
0x1e00, 0x1f15,
0x1f18, 0x1f1d,
@@ -12110,15 +15648,16 @@ static const OnigCodePoint CR_Grapheme_Base[] = {
0x2400, 0x2426,
0x2440, 0x244a,
0x2460, 0x26ff,
- 0x2701, 0x27ca,
- 0x27cc, 0x27cc,
- 0x27ce, 0x2b4c,
+ 0x2701, 0x2b4c,
0x2b50, 0x2b59,
0x2c00, 0x2c2e,
0x2c30, 0x2c5e,
0x2c60, 0x2cee,
+ 0x2cf2, 0x2cf3,
0x2cf9, 0x2d25,
- 0x2d30, 0x2d65,
+ 0x2d27, 0x2d27,
+ 0x2d2d, 0x2d2d,
+ 0x2d30, 0x2d67,
0x2d6f, 0x2d70,
0x2d80, 0x2d96,
0x2da0, 0x2da6,
@@ -12129,7 +15668,7 @@ static const OnigCodePoint CR_Grapheme_Base[] = {
0x2dc8, 0x2dce,
0x2dd0, 0x2dd6,
0x2dd8, 0x2dde,
- 0x2e00, 0x2e31,
+ 0x2e00, 0x2e3b,
0x2e80, 0x2e99,
0x2e9b, 0x2ef3,
0x2f00, 0x2fd5,
@@ -12145,7 +15684,7 @@ static const OnigCodePoint CR_Grapheme_Base[] = {
0x31f0, 0x321e,
0x3220, 0x32fe,
0x3300, 0x4db5,
- 0x4dc0, 0x9fcb,
+ 0x4dc0, 0x9fcc,
0xa000, 0xa48c,
0xa490, 0xa4c6,
0xa4d0, 0xa62b,
@@ -12155,9 +15694,9 @@ static const OnigCodePoint CR_Grapheme_Base[] = {
0xa6a0, 0xa6ef,
0xa6f2, 0xa6f7,
0xa700, 0xa78e,
- 0xa790, 0xa791,
- 0xa7a0, 0xa7a9,
- 0xa7fa, 0xa801,
+ 0xa790, 0xa793,
+ 0xa7a0, 0xa7aa,
+ 0xa7f8, 0xa801,
0xa803, 0xa805,
0xa807, 0xa80a,
0xa80c, 0xa824,
@@ -12191,7 +15730,8 @@ static const OnigCodePoint CR_Grapheme_Base[] = {
0xaab9, 0xaabd,
0xaac0, 0xaac0,
0xaac2, 0xaac2,
- 0xaadb, 0xaadf,
+ 0xaadb, 0xaaeb,
+ 0xaaee, 0xaaf5,
0xab01, 0xab06,
0xab09, 0xab0e,
0xab11, 0xab16,
@@ -12204,8 +15744,7 @@ static const OnigCodePoint CR_Grapheme_Base[] = {
0xac00, 0xd7a3,
0xd7b0, 0xd7c6,
0xd7cb, 0xd7fb,
- 0xf900, 0xfa2d,
- 0xfa30, 0xfa6d,
+ 0xf900, 0xfa6d,
0xfa70, 0xfad9,
0xfb00, 0xfb06,
0xfb13, 0xfb17,
@@ -12267,6 +15806,8 @@ static const OnigCodePoint CR_Grapheme_Base[] = {
0x10900, 0x1091b,
0x1091f, 0x10939,
0x1093f, 0x1093f,
+ 0x10980, 0x109b7,
+ 0x109be, 0x109bf,
0x10a00, 0x10a00,
0x10a10, 0x10a13,
0x10a15, 0x10a17,
@@ -12288,11 +15829,27 @@ static const OnigCodePoint CR_Grapheme_Base[] = {
0x110b7, 0x110b8,
0x110bb, 0x110bc,
0x110be, 0x110c1,
+ 0x110d0, 0x110e8,
+ 0x110f0, 0x110f9,
+ 0x11103, 0x11126,
+ 0x1112c, 0x1112c,
+ 0x11136, 0x11143,
+ 0x11182, 0x111b5,
+ 0x111bf, 0x111c8,
+ 0x111d0, 0x111d9,
+ 0x11680, 0x116aa,
+ 0x116ac, 0x116ac,
+ 0x116ae, 0x116af,
+ 0x116b6, 0x116b6,
+ 0x116c0, 0x116c9,
0x12000, 0x1236e,
0x12400, 0x12462,
0x12470, 0x12473,
0x13000, 0x1342e,
0x16800, 0x16a38,
+ 0x16f00, 0x16f44,
+ 0x16f50, 0x16f7e,
+ 0x16f93, 0x16f9f,
0x1b000, 0x1b001,
0x1d000, 0x1d0f5,
0x1d100, 0x1d126,
@@ -12327,6 +15884,40 @@ static const OnigCodePoint CR_Grapheme_Base[] = {
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,
@@ -12335,7 +15926,7 @@ static const OnigCodePoint CR_Grapheme_Base[] = {
0x1f0d1, 0x1f0df,
0x1f100, 0x1f10a,
0x1f110, 0x1f12e,
- 0x1f130, 0x1f169,
+ 0x1f130, 0x1f16b,
0x1f170, 0x1f19a,
0x1f1e6, 0x1f202,
0x1f210, 0x1f23a,
@@ -12353,19 +15944,9 @@ static const OnigCodePoint CR_Grapheme_Base[] = {
0x1f442, 0x1f4f7,
0x1f4f9, 0x1f4fc,
0x1f500, 0x1f53d,
+ 0x1f540, 0x1f543,
0x1f550, 0x1f567,
- 0x1f5fb, 0x1f5ff,
- 0x1f601, 0x1f610,
- 0x1f612, 0x1f614,
- 0x1f616, 0x1f616,
- 0x1f618, 0x1f618,
- 0x1f61a, 0x1f61a,
- 0x1f61c, 0x1f61e,
- 0x1f620, 0x1f625,
- 0x1f628, 0x1f62b,
- 0x1f62d, 0x1f62d,
- 0x1f630, 0x1f633,
- 0x1f635, 0x1f640,
+ 0x1f5fb, 0x1f640,
0x1f645, 0x1f64f,
0x1f680, 0x1f6c5,
0x1f700, 0x1f773,
@@ -12377,7 +15958,7 @@ static const OnigCodePoint CR_Grapheme_Base[] = {
/* 'Grapheme_Link': Derived Property */
static const OnigCodePoint CR_Grapheme_Link[] = {
- 29,
+ 33,
0x094d, 0x094d,
0x09cd, 0x09cd,
0x0a4d, 0x0a4d,
@@ -12396,22 +15977,26 @@ static const OnigCodePoint CR_Grapheme_Link[] = {
0x17d2, 0x17d2,
0x1a60, 0x1a60,
0x1b44, 0x1b44,
- 0x1baa, 0x1baa,
+ 0x1baa, 0x1bab,
0x1bf2, 0x1bf3,
0x2d7f, 0x2d7f,
0xa806, 0xa806,
0xa8c4, 0xa8c4,
0xa953, 0xa953,
0xa9c0, 0xa9c0,
+ 0xaaf6, 0xaaf6,
0xabed, 0xabed,
0x10a3f, 0x10a3f,
0x11046, 0x11046,
0x110b9, 0x110b9,
+ 0x11133, 0x11134,
+ 0x111c0, 0x111c0,
+ 0x116b6, 0x116b6,
}; /* CR_Grapheme_Link */
/* 'Common': Script */
static const OnigCodePoint CR_Common[] = {
- 169,
+ 157,
0x0000, 0x0040,
0x005b, 0x0060,
0x007b, 0x00a9,
@@ -12434,7 +16019,6 @@ static const OnigCodePoint CR_Common[] = {
0x0660, 0x0669,
0x06dd, 0x06dd,
0x0964, 0x0965,
- 0x0970, 0x0970,
0x0e3f, 0x0e3f,
0x0fd5, 0x0fd8,
0x10fb, 0x10fb,
@@ -12445,7 +16029,8 @@ static const OnigCodePoint CR_Common[] = {
0x1cd3, 0x1cd3,
0x1ce1, 0x1ce1,
0x1ce9, 0x1cec,
- 0x1cee, 0x1cf2,
+ 0x1cee, 0x1cf3,
+ 0x1cf5, 0x1cf6,
0x2000, 0x200b,
0x200e, 0x2064,
0x206a, 0x2070,
@@ -12462,12 +16047,10 @@ static const OnigCodePoint CR_Common[] = {
0x2400, 0x2426,
0x2440, 0x244a,
0x2460, 0x26ff,
- 0x2701, 0x27ca,
- 0x27cc, 0x27cc,
- 0x27ce, 0x27ff,
+ 0x2701, 0x27ff,
0x2900, 0x2b4c,
0x2b50, 0x2b59,
- 0x2e00, 0x2e31,
+ 0x2e00, 0x2e3b,
0x2ff0, 0x2ffb,
0x3000, 0x3004,
0x3006, 0x3006,
@@ -12544,7 +16127,7 @@ static const OnigCodePoint CR_Common[] = {
0x1f0d1, 0x1f0df,
0x1f100, 0x1f10a,
0x1f110, 0x1f12e,
- 0x1f130, 0x1f169,
+ 0x1f130, 0x1f16b,
0x1f170, 0x1f19a,
0x1f1e6, 0x1f1ff,
0x1f201, 0x1f202,
@@ -12563,19 +16146,9 @@ static const OnigCodePoint CR_Common[] = {
0x1f442, 0x1f4f7,
0x1f4f9, 0x1f4fc,
0x1f500, 0x1f53d,
+ 0x1f540, 0x1f543,
0x1f550, 0x1f567,
- 0x1f5fb, 0x1f5ff,
- 0x1f601, 0x1f610,
- 0x1f612, 0x1f614,
- 0x1f616, 0x1f616,
- 0x1f618, 0x1f618,
- 0x1f61a, 0x1f61a,
- 0x1f61c, 0x1f61e,
- 0x1f620, 0x1f625,
- 0x1f628, 0x1f62b,
- 0x1f62d, 0x1f62d,
- 0x1f630, 0x1f633,
- 0x1f635, 0x1f640,
+ 0x1f5fb, 0x1f640,
0x1f645, 0x1f64f,
0x1f680, 0x1f6c5,
0x1f700, 0x1f773,
@@ -12610,9 +16183,9 @@ static const OnigCodePoint CR_Latin[] = {
0x2c60, 0x2c7f,
0xa722, 0xa787,
0xa78b, 0xa78e,
- 0xa790, 0xa791,
- 0xa7a0, 0xa7a9,
- 0xa7fa, 0xa7ff,
+ 0xa790, 0xa793,
+ 0xa7a0, 0xa7aa,
+ 0xa7f8, 0xa7ff,
0xfb00, 0xfb06,
0xff21, 0xff3a,
0xff41, 0xff5a,
@@ -12664,17 +16237,18 @@ static const OnigCodePoint CR_Cyrillic[] = {
0x1d2b, 0x1d2b,
0x1d78, 0x1d78,
0x2de0, 0x2dff,
- 0xa640, 0xa673,
- 0xa67c, 0xa697,
+ 0xa640, 0xa697,
+ 0xa69f, 0xa69f,
}; /* CR_Cyrillic */
/* 'Armenian': Script */
static const OnigCodePoint CR_Armenian[] = {
- 5,
+ 6,
0x0531, 0x0556,
0x0559, 0x055f,
0x0561, 0x0587,
0x058a, 0x058a,
+ 0x058f, 0x058f,
0xfb13, 0xfb17,
}; /* CR_Armenian */
@@ -12694,8 +16268,8 @@ static const OnigCodePoint CR_Hebrew[] = {
/* 'Arabic': Script */
static const OnigCodePoint CR_Arabic[] = {
- 19,
- 0x0600, 0x0603,
+ 56,
+ 0x0600, 0x0604,
0x0606, 0x060b,
0x060d, 0x061a,
0x061e, 0x061e,
@@ -12706,6 +16280,9 @@ static const OnigCodePoint CR_Arabic[] = {
0x0671, 0x06dc,
0x06de, 0x06ff,
0x0750, 0x077f,
+ 0x08a0, 0x08a0,
+ 0x08a2, 0x08ac,
+ 0x08e4, 0x08fe,
0xfb50, 0xfbc1,
0xfbd3, 0xfd3d,
0xfd50, 0xfd8f,
@@ -12714,6 +16291,40 @@ static const OnigCodePoint CR_Arabic[] = {
0xfe70, 0xfe74,
0xfe76, 0xfefc,
0x10e60, 0x10e7e,
+ 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,
}; /* CR_Arabic */
/* 'Syriac': Script */
@@ -12732,11 +16343,10 @@ static const OnigCodePoint CR_Thaana[] = {
/* 'Devanagari': Script */
static const OnigCodePoint CR_Devanagari[] = {
- 6,
+ 5,
0x0900, 0x0950,
0x0953, 0x0963,
- 0x0966, 0x096f,
- 0x0971, 0x0977,
+ 0x0966, 0x0977,
0x0979, 0x097f,
0xa8e0, 0xa8fb,
}; /* CR_Devanagari */
@@ -12783,7 +16393,7 @@ static const OnigCodePoint CR_Gurmukhi[] = {
/* 'Gujarati': Script */
static const OnigCodePoint CR_Gujarati[] = {
- 14,
+ 13,
0x0a81, 0x0a83,
0x0a85, 0x0a8d,
0x0a8f, 0x0a91,
@@ -12796,8 +16406,7 @@ static const OnigCodePoint CR_Gujarati[] = {
0x0acb, 0x0acd,
0x0ad0, 0x0ad0,
0x0ae0, 0x0ae3,
- 0x0ae6, 0x0aef,
- 0x0af1, 0x0af1,
+ 0x0ae6, 0x0af1,
}; /* CR_Gujarati */
/* 'Oriya': Script */
@@ -12937,7 +16546,7 @@ static const OnigCodePoint CR_Lao[] = {
0x0ec6, 0x0ec6,
0x0ec8, 0x0ecd,
0x0ed0, 0x0ed9,
- 0x0edc, 0x0edd,
+ 0x0edc, 0x0edf,
}; /* CR_Lao */
/* 'Tibetan': Script */
@@ -12961,11 +16570,15 @@ static const OnigCodePoint CR_Myanmar[] = {
/* 'Georgian': Script */
static const OnigCodePoint CR_Georgian[] = {
- 4,
+ 8,
0x10a0, 0x10c5,
+ 0x10c7, 0x10c7,
+ 0x10cd, 0x10cd,
0x10d0, 0x10fa,
- 0x10fc, 0x10fc,
+ 0x10fc, 0x10ff,
0x2d00, 0x2d25,
+ 0x2d27, 0x2d27,
+ 0x2d2d, 0x2d2d,
}; /* CR_Georgian */
/* 'Hangul': Script */
@@ -13102,7 +16715,7 @@ static const OnigCodePoint CR_Bopomofo[] = {
/* 'Han': Script */
static const OnigCodePoint CR_Han[] = {
- 16,
+ 15,
0x2e80, 0x2e99,
0x2e9b, 0x2ef3,
0x2f00, 0x2fd5,
@@ -13111,9 +16724,8 @@ static const OnigCodePoint CR_Han[] = {
0x3021, 0x3029,
0x3038, 0x303b,
0x3400, 0x4db5,
- 0x4e00, 0x9fcb,
- 0xf900, 0xfa2d,
- 0xfa30, 0xfa6d,
+ 0x4e00, 0x9fcc,
+ 0xf900, 0xfa6d,
0xfa70, 0xfad9,
0x20000, 0x2a6d6,
0x2a700, 0x2b734,
@@ -13149,7 +16761,7 @@ static const OnigCodePoint CR_Deseret[] = {
/* 'Inherited': Script */
static const OnigCodePoint CR_Inherited[] = {
- 24,
+ 25,
0x0300, 0x036f,
0x0485, 0x0486,
0x064b, 0x0655,
@@ -13160,6 +16772,7 @@ static const OnigCodePoint CR_Inherited[] = {
0x1cd4, 0x1ce0,
0x1ce2, 0x1ce8,
0x1ced, 0x1ced,
+ 0x1cf4, 0x1cf4,
0x1dc0, 0x1de6,
0x1dfc, 0x1dff,
0x200c, 0x200d,
@@ -13280,7 +16893,7 @@ static const OnigCodePoint CR_Buginese[] = {
static const OnigCodePoint CR_Coptic[] = {
3,
0x03e2, 0x03ef,
- 0x2c80, 0x2cf1,
+ 0x2c80, 0x2cf3,
0x2cf9, 0x2cff,
}; /* CR_Coptic */
@@ -13303,7 +16916,7 @@ static const OnigCodePoint CR_Glagolitic[] = {
/* 'Tifinagh': Script */
static const OnigCodePoint CR_Tifinagh[] = {
3,
- 0x2d30, 0x2d65,
+ 0x2d30, 0x2d67,
0x2d6f, 0x2d70,
0x2d7f, 0x2d7f,
}; /* CR_Tifinagh */
@@ -13371,8 +16984,8 @@ static const OnigCodePoint CR_Nko[] = {
/* 'Sundanese': Script */
static const OnigCodePoint CR_Sundanese[] = {
2,
- 0x1b80, 0x1baa,
- 0x1bae, 0x1bb9,
+ 0x1b80, 0x1bbf,
+ 0x1cc0, 0x1cc7,
}; /* CR_Sundanese */
/* 'Lepcha': Script */
@@ -13503,7 +17116,8 @@ static const OnigCodePoint CR_Javanese[] = {
/* 'Meetei_Mayek': Script */
static const OnigCodePoint CR_Meetei_Mayek[] = {
- 2,
+ 3,
+ 0xaae0, 0xaaf6,
0xabc0, 0xabed,
0xabf0, 0xabf9,
}; /* CR_Meetei_Mayek */
@@ -13568,21 +17182,57 @@ static const OnigCodePoint CR_Mandaic[] = {
0x085e, 0x085e,
}; /* CR_Mandaic */
+/* 'Chakma': Script */
+static const OnigCodePoint CR_Chakma[] = {
+ 2,
+ 0x11100, 0x11134,
+ 0x11136, 0x11143,
+}; /* CR_Chakma */
+
+/* 'Meroitic_Cursive': Script */
+static const OnigCodePoint CR_Meroitic_Cursive[] = {
+ 2,
+ 0x109a0, 0x109b7,
+ 0x109be, 0x109bf,
+}; /* CR_Meroitic_Cursive */
+
+/* 'Meroitic_Hieroglyphs': Script */
+static const OnigCodePoint CR_Meroitic_Hieroglyphs[] = {
+ 1,
+ 0x10980, 0x1099f,
+}; /* CR_Meroitic_Hieroglyphs */
+
+/* 'Miao': Script */
+static const OnigCodePoint CR_Miao[] = {
+ 3,
+ 0x16f00, 0x16f44,
+ 0x16f50, 0x16f7e,
+ 0x16f8f, 0x16f9f,
+}; /* CR_Miao */
+
+/* 'Sharada': Script */
+static const OnigCodePoint CR_Sharada[] = {
+ 2,
+ 0x11180, 0x111c8,
+ 0x111d0, 0x111d9,
+}; /* CR_Sharada */
+
+/* 'Sora_Sompeng': Script */
+static const OnigCodePoint CR_Sora_Sompeng[] = {
+ 2,
+ 0x110d0, 0x110e8,
+ 0x110f0, 0x110f9,
+}; /* CR_Sora_Sompeng */
+
+/* 'Takri': Script */
+static const OnigCodePoint CR_Takri[] = {
+ 2,
+ 0x11680, 0x116b7,
+ 0x116c0, 0x116c9,
+}; /* CR_Takri */
+
/* 'White_Space': Binary Property */
-static const OnigCodePoint CR_White_Space[] = {
- 11,
- 0x0009, 0x000d,
- 0x0020, 0x0020,
- 0x0085, 0x0085,
- 0x00a0, 0x00a0,
- 0x1680, 0x1680,
- 0x180e, 0x180e,
- 0x2000, 0x200a,
- 0x2028, 0x2029,
- 0x202f, 0x202f,
- 0x205f, 0x205f,
- 0x3000, 0x3000,
-}; /* CR_White_Space */
+#define CR_White_Space CR_Space
/* 'Bidi_Control': Binary Property */
static const OnigCodePoint CR_Bidi_Control[] = {
@@ -13599,7 +17249,7 @@ static const OnigCodePoint CR_Join_Control[] = {
/* 'Dash': Binary Property */
static const OnigCodePoint CR_Dash[] = {
- 19,
+ 20,
0x002d, 0x002d,
0x058a, 0x058a,
0x05be, 0x05be,
@@ -13612,6 +17262,7 @@ static const OnigCodePoint CR_Dash[] = {
0x2212, 0x2212,
0x2e17, 0x2e17,
0x2e1a, 0x2e1a,
+ 0x2e3a, 0x2e3b,
0x301c, 0x301c,
0x3030, 0x3030,
0x30a0, 0x30a0,
@@ -13655,7 +17306,7 @@ static const OnigCodePoint CR_Quotation_Mark[] = {
/* 'Terminal_Punctuation': Binary Property */
static const OnigCodePoint CR_Terminal_Punctuation[] = {
- 67,
+ 70,
0x0021, 0x0021,
0x002c, 0x002c,
0x002e, 0x002e,
@@ -13705,6 +17356,7 @@ static const OnigCodePoint CR_Terminal_Punctuation[] = {
0xa9c7, 0xa9c9,
0xaa5d, 0xaa5f,
0xaadf, 0xaadf,
+ 0xaaf0, 0xaaf1,
0xabeb, 0xabeb,
0xfe50, 0xfe52,
0xfe54, 0xfe57,
@@ -13722,12 +17374,14 @@ static const OnigCodePoint CR_Terminal_Punctuation[] = {
0x10b3a, 0x10b3f,
0x11047, 0x1104d,
0x110be, 0x110c1,
+ 0x11141, 0x11143,
+ 0x111c5, 0x111c6,
0x12470, 0x12473,
}; /* CR_Terminal_Punctuation */
/* 'Other_Math': Binary Property */
static const OnigCodePoint CR_Other_Math[] = {
- 100,
+ 133,
0x005e, 0x005e,
0x03d0, 0x03d2,
0x03d5, 0x03d5,
@@ -13828,6 +17482,39 @@ static const OnigCodePoint CR_Other_Math[] = {
0x1d7aa, 0x1d7c2,
0x1d7c4, 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,
}; /* CR_Other_Math */
/* 'Hex_Digit': Binary Property */
@@ -13842,16 +17529,11 @@ static const OnigCodePoint CR_Hex_Digit[] = {
}; /* CR_Hex_Digit */
/* 'ASCII_Hex_Digit': Binary Property */
-static const OnigCodePoint CR_ASCII_Hex_Digit[] = {
- 3,
- 0x0030, 0x0039,
- 0x0041, 0x0046,
- 0x0061, 0x0066,
-}; /* CR_ASCII_Hex_Digit */
+#define CR_ASCII_Hex_Digit CR_XDigit
/* 'Other_Alphabetic': Binary Property */
static const OnigCodePoint CR_Other_Alphabetic[] = {
- 145,
+ 158,
0x0345, 0x0345,
0x05b0, 0x05bd,
0x05bf, 0x05bf,
@@ -13873,6 +17555,8 @@ static const OnigCodePoint CR_Other_Alphabetic[] = {
0x081b, 0x0823,
0x0825, 0x0827,
0x0829, 0x082c,
+ 0x08e4, 0x08e9,
+ 0x08f0, 0x08fe,
0x0900, 0x0903,
0x093a, 0x093b,
0x093e, 0x094c,
@@ -13969,11 +17653,14 @@ static const OnigCodePoint CR_Other_Alphabetic[] = {
0x1b35, 0x1b43,
0x1b80, 0x1b82,
0x1ba1, 0x1ba9,
+ 0x1bac, 0x1bad,
0x1be7, 0x1bf1,
0x1c24, 0x1c35,
- 0x1cf2, 0x1cf2,
+ 0x1cf2, 0x1cf3,
0x24b6, 0x24e9,
0x2de0, 0x2dff,
+ 0xa674, 0xa67b,
+ 0xa69f, 0xa69f,
0xa823, 0xa827,
0xa880, 0xa881,
0xa8b4, 0xa8c3,
@@ -13988,6 +17675,8 @@ static const OnigCodePoint CR_Other_Alphabetic[] = {
0xaab2, 0xaab4,
0xaab7, 0xaab8,
0xaabe, 0xaabe,
+ 0xaaeb, 0xaaef,
+ 0xaaf5, 0xaaf5,
0xabe3, 0xabea,
0xfb1e, 0xfb1e,
0x10a01, 0x10a03,
@@ -13997,18 +17686,23 @@ static const OnigCodePoint CR_Other_Alphabetic[] = {
0x11038, 0x11045,
0x11082, 0x11082,
0x110b0, 0x110b8,
+ 0x11100, 0x11102,
+ 0x11127, 0x11132,
+ 0x11180, 0x11182,
+ 0x111b3, 0x111bf,
+ 0x116ab, 0x116b5,
+ 0x16f51, 0x16f7e,
}; /* CR_Other_Alphabetic */
/* 'Ideographic': Binary Property */
static const OnigCodePoint CR_Ideographic[] = {
- 12,
+ 11,
0x3006, 0x3007,
0x3021, 0x3029,
0x3038, 0x303a,
0x3400, 0x4db5,
- 0x4e00, 0x9fcb,
- 0xf900, 0xfa2d,
- 0xfa30, 0xfa6d,
+ 0x4e00, 0x9fcc,
+ 0xf900, 0xfa6d,
0xfa70, 0xfad9,
0x20000, 0x2a6d6,
0x2a700, 0x2b734,
@@ -14018,7 +17712,7 @@ static const OnigCodePoint CR_Ideographic[] = {
/* 'Diacritic': Binary Property */
static const OnigCodePoint CR_Diacritic[] = {
- 117,
+ 125,
0x005e, 0x005e,
0x0060, 0x0060,
0x00a8, 0x00a8,
@@ -14047,6 +17741,7 @@ static const OnigCodePoint CR_Diacritic[] = {
0x07a6, 0x07b0,
0x07eb, 0x07f5,
0x0818, 0x0819,
+ 0x08e4, 0x08fe,
0x093c, 0x093c,
0x094d, 0x094d,
0x0951, 0x0954,
@@ -14089,11 +17784,12 @@ static const OnigCodePoint CR_Diacritic[] = {
0x1b34, 0x1b34,
0x1b44, 0x1b44,
0x1b6b, 0x1b73,
- 0x1baa, 0x1baa,
+ 0x1baa, 0x1bab,
0x1c36, 0x1c37,
0x1c78, 0x1c7d,
0x1cd0, 0x1ce8,
0x1ced, 0x1ced,
+ 0x1cf4, 0x1cf4,
0x1d2c, 0x1d6a,
0x1dc4, 0x1dcf,
0x1dfd, 0x1dff,
@@ -14114,6 +17810,7 @@ static const OnigCodePoint CR_Diacritic[] = {
0xa6f0, 0xa6f1,
0xa717, 0xa721,
0xa788, 0xa788,
+ 0xa7f8, 0xa7f9,
0xa8c4, 0xa8c4,
0xa8e0, 0xa8f1,
0xa92b, 0xa92e,
@@ -14122,6 +17819,7 @@ static const OnigCodePoint CR_Diacritic[] = {
0xa9c0, 0xa9c0,
0xaa7b, 0xaa7b,
0xaabf, 0xaac2,
+ 0xaaf6, 0xaaf6,
0xabec, 0xabed,
0xfb1e, 0xfb1e,
0xfe20, 0xfe26,
@@ -14131,6 +17829,10 @@ static const OnigCodePoint CR_Diacritic[] = {
0xff9e, 0xff9f,
0xffe3, 0xffe3,
0x110b9, 0x110ba,
+ 0x11133, 0x11134,
+ 0x111c0, 0x111c0,
+ 0x116b6, 0x116b7,
+ 0x16f8f, 0x16f9f,
0x1d167, 0x1d169,
0x1d16d, 0x1d172,
0x1d17b, 0x1d182,
@@ -14140,13 +17842,14 @@ static const OnigCodePoint CR_Diacritic[] = {
/* 'Extender': Binary Property */
static const OnigCodePoint CR_Extender[] = {
- 20,
+ 22,
0x00b7, 0x00b7,
0x02d0, 0x02d1,
0x0640, 0x0640,
0x07fa, 0x07fa,
0x0e46, 0x0e46,
0x0ec6, 0x0ec6,
+ 0x180a, 0x180a,
0x1843, 0x1843,
0x1aa7, 0x1aa7,
0x1c36, 0x1c36,
@@ -14160,25 +17863,31 @@ static const OnigCodePoint CR_Extender[] = {
0xa9cf, 0xa9cf,
0xaa70, 0xaa70,
0xaadd, 0xaadd,
+ 0xaaf3, 0xaaf4,
0xff70, 0xff70,
}; /* CR_Extender */
/* 'Other_Lowercase': Binary Property */
static const OnigCodePoint CR_Other_Lowercase[] = {
- 13,
+ 18,
+ 0x00aa, 0x00aa,
+ 0x00ba, 0x00ba,
0x02b0, 0x02b8,
0x02c0, 0x02c1,
0x02e0, 0x02e4,
0x0345, 0x0345,
0x037a, 0x037a,
- 0x1d2c, 0x1d61,
+ 0x1d2c, 0x1d6a,
0x1d78, 0x1d78,
0x1d9b, 0x1dbf,
- 0x2090, 0x2094,
+ 0x2071, 0x2071,
+ 0x207f, 0x207f,
+ 0x2090, 0x209c,
0x2170, 0x217f,
0x24d0, 0x24e9,
- 0x2c7d, 0x2c7d,
+ 0x2c7c, 0x2c7d,
0xa770, 0xa770,
+ 0xa7f8, 0xa7f9,
}; /* CR_Other_Lowercase */
/* 'Other_Uppercase': Binary Property */
@@ -14213,7 +17922,7 @@ static const OnigCodePoint CR_Noncharacter_Code_Point[] = {
/* 'Other_Grapheme_Extend': Binary Property */
static const OnigCodePoint CR_Other_Grapheme_Extend[] = {
- 16,
+ 17,
0x09be, 0x09be,
0x09d7, 0x09d7,
0x0b3e, 0x0b3e,
@@ -14227,6 +17936,7 @@ static const OnigCodePoint CR_Other_Grapheme_Extend[] = {
0x0dcf, 0x0dcf,
0x0ddf, 0x0ddf,
0x200c, 0x200d,
+ 0x302e, 0x302f,
0xff9e, 0xff9f,
0x1d165, 0x1d165,
0x1d16e, 0x1d172,
@@ -14257,7 +17967,7 @@ static const OnigCodePoint CR_Radical[] = {
static const OnigCodePoint CR_Unified_Ideograph[] = {
12,
0x3400, 0x4db5,
- 0x4e00, 0x9fcb,
+ 0x4e00, 0x9fcc,
0xfa0e, 0xfa0f,
0xfa11, 0xfa11,
0xfa13, 0xfa14,
@@ -14272,9 +17982,10 @@ static const OnigCodePoint CR_Unified_Ideograph[] = {
/* 'Other_Default_Ignorable_Code_Point': Binary Property */
static const OnigCodePoint CR_Other_Default_Ignorable_Code_Point[] = {
- 10,
+ 11,
0x034f, 0x034f,
0x115f, 0x1160,
+ 0x17b4, 0x17b5,
0x2065, 0x2069,
0x3164, 0x3164,
0xffa0, 0xffa0,
@@ -14364,7 +18075,7 @@ static const OnigCodePoint CR_Other_ID_Continue[] = {
/* 'STerm': Binary Property */
static const OnigCodePoint CR_STerm[] = {
- 47,
+ 50,
0x0021, 0x0021,
0x002e, 0x002e,
0x003f, 0x003f,
@@ -14402,6 +18113,7 @@ static const OnigCodePoint CR_STerm[] = {
0xa92f, 0xa92f,
0xa9c8, 0xa9c9,
0xaa5d, 0xaa5f,
+ 0xaaf0, 0xaaf1,
0xabeb, 0xabeb,
0xfe52, 0xfe52,
0xfe56, 0xfe57,
@@ -14412,6 +18124,8 @@ static const OnigCodePoint CR_STerm[] = {
0x10a56, 0x10a57,
0x11047, 0x11048,
0x110be, 0x110c1,
+ 0x11141, 0x11143,
+ 0x111c5, 0x111c6,
}; /* CR_STerm */
/* 'Variation_Selector': Binary Property */
@@ -14467,7 +18181,7 @@ static const OnigCodePoint CR_Pattern_Syntax[] = {
/* 'Unknown': Script */
static const OnigCodePoint CR_Unknown[] = {
- 499,
+ 537,
0x0378, 0x0379,
0x037f, 0x0383,
0x038b, 0x038b,
@@ -14477,11 +18191,12 @@ static const OnigCodePoint CR_Unknown[] = {
0x0557, 0x0558,
0x0560, 0x0560,
0x0588, 0x0588,
- 0x058b, 0x0590,
+ 0x058b, 0x058e,
+ 0x0590, 0x0590,
0x05c8, 0x05cf,
0x05eb, 0x05ef,
0x05f5, 0x05ff,
- 0x0604, 0x0605,
+ 0x0605, 0x0605,
0x061c, 0x061d,
0x070e, 0x070e,
0x074b, 0x074c,
@@ -14490,7 +18205,10 @@ static const OnigCodePoint CR_Unknown[] = {
0x082e, 0x082f,
0x083f, 0x083f,
0x085c, 0x085d,
- 0x085f, 0x08ff,
+ 0x085f, 0x089f,
+ 0x08a1, 0x08a1,
+ 0x08ad, 0x08e3,
+ 0x08ff, 0x08ff,
0x0978, 0x0978,
0x0980, 0x0980,
0x0984, 0x0984,
@@ -14535,7 +18253,6 @@ static const OnigCodePoint CR_Unknown[] = {
0x0ace, 0x0acf,
0x0ad1, 0x0adf,
0x0ae4, 0x0ae5,
- 0x0af0, 0x0af0,
0x0af2, 0x0b00,
0x0b04, 0x0b04,
0x0b0d, 0x0b0e,
@@ -14636,15 +18353,16 @@ static const OnigCodePoint CR_Unknown[] = {
0x0ec7, 0x0ec7,
0x0ece, 0x0ecf,
0x0eda, 0x0edb,
- 0x0ede, 0x0eff,
+ 0x0ee0, 0x0eff,
0x0f48, 0x0f48,
0x0f6d, 0x0f70,
0x0f98, 0x0f98,
0x0fbd, 0x0fbd,
0x0fcd, 0x0fcd,
0x0fdb, 0x0fff,
- 0x10c6, 0x10cf,
- 0x10fd, 0x10ff,
+ 0x10c6, 0x10c6,
+ 0x10c8, 0x10cc,
+ 0x10ce, 0x10cf,
0x1249, 0x1249,
0x124e, 0x124f,
0x1257, 0x1257,
@@ -14698,13 +18416,12 @@ static const OnigCodePoint CR_Unknown[] = {
0x1aae, 0x1aff,
0x1b4c, 0x1b4f,
0x1b7d, 0x1b7f,
- 0x1bab, 0x1bad,
- 0x1bba, 0x1bbf,
0x1bf4, 0x1bfb,
0x1c38, 0x1c3a,
0x1c4a, 0x1c4c,
- 0x1c80, 0x1ccf,
- 0x1cf3, 0x1cff,
+ 0x1c80, 0x1cbf,
+ 0x1cc8, 0x1ccf,
+ 0x1cf7, 0x1cff,
0x1de7, 0x1dfb,
0x1f16, 0x1f17,
0x1f1e, 0x1f1f,
@@ -14733,15 +18450,15 @@ static const OnigCodePoint CR_Unknown[] = {
0x2427, 0x243f,
0x244b, 0x245f,
0x2700, 0x2700,
- 0x27cb, 0x27cb,
- 0x27cd, 0x27cd,
0x2b4d, 0x2b4f,
0x2b5a, 0x2bff,
0x2c2f, 0x2c2f,
0x2c5f, 0x2c5f,
- 0x2cf2, 0x2cf8,
- 0x2d26, 0x2d2f,
- 0x2d66, 0x2d6e,
+ 0x2cf4, 0x2cf8,
+ 0x2d26, 0x2d26,
+ 0x2d28, 0x2d2c,
+ 0x2d2e, 0x2d2f,
+ 0x2d68, 0x2d6e,
0x2d71, 0x2d7e,
0x2d97, 0x2d9f,
0x2da7, 0x2da7,
@@ -14752,7 +18469,7 @@ static const OnigCodePoint CR_Unknown[] = {
0x2dcf, 0x2dcf,
0x2dd7, 0x2dd7,
0x2ddf, 0x2ddf,
- 0x2e32, 0x2e7f,
+ 0x2e3c, 0x2e7f,
0x2e9a, 0x2e9a,
0x2ef4, 0x2eff,
0x2fd6, 0x2fef,
@@ -14767,16 +18484,15 @@ static const OnigCodePoint CR_Unknown[] = {
0x321f, 0x321f,
0x32ff, 0x32ff,
0x4db6, 0x4dbf,
- 0x9fcc, 0x9fff,
+ 0x9fcd, 0x9fff,
0xa48d, 0xa48f,
0xa4c7, 0xa4cf,
0xa62c, 0xa63f,
- 0xa674, 0xa67b,
- 0xa698, 0xa69f,
+ 0xa698, 0xa69e,
0xa6f8, 0xa6ff,
0xa78f, 0xa78f,
- 0xa792, 0xa79f,
- 0xa7aa, 0xa7f9,
+ 0xa794, 0xa79f,
+ 0xa7ab, 0xa7f7,
0xa82c, 0xa82f,
0xa83a, 0xa83f,
0xa878, 0xa87f,
@@ -14793,7 +18509,7 @@ static const OnigCodePoint CR_Unknown[] = {
0xaa5a, 0xaa5b,
0xaa7c, 0xaa7f,
0xaac3, 0xaada,
- 0xaae0, 0xab00,
+ 0xaaf7, 0xab00,
0xab07, 0xab08,
0xab0f, 0xab10,
0xab17, 0xab1f,
@@ -14804,7 +18520,6 @@ static const OnigCodePoint CR_Unknown[] = {
0xd7a4, 0xd7af,
0xd7c7, 0xd7ca,
0xd7fc, 0xf8ff,
- 0xfa2e, 0xfa2f,
0xfa6e, 0xfa6f,
0xfada, 0xfaff,
0xfb07, 0xfb12,
@@ -14866,7 +18581,9 @@ static const OnigCodePoint CR_Unknown[] = {
0x10860, 0x108ff,
0x1091c, 0x1091e,
0x1093a, 0x1093e,
- 0x10940, 0x109ff,
+ 0x10940, 0x1097f,
+ 0x109b8, 0x109bd,
+ 0x109c0, 0x109ff,
0x10a04, 0x10a04,
0x10a07, 0x10a0b,
0x10a14, 0x10a14,
@@ -14884,12 +18601,23 @@ static const OnigCodePoint CR_Unknown[] = {
0x10e7f, 0x10fff,
0x1104e, 0x11051,
0x11070, 0x1107f,
- 0x110c2, 0x11fff,
+ 0x110c2, 0x110cf,
+ 0x110e9, 0x110ef,
+ 0x110fa, 0x110ff,
+ 0x11135, 0x11135,
+ 0x11144, 0x1117f,
+ 0x111c9, 0x111cf,
+ 0x111da, 0x1167f,
+ 0x116b8, 0x116bf,
+ 0x116ca, 0x11fff,
0x1236f, 0x123ff,
0x12463, 0x1246f,
0x12474, 0x12fff,
0x1342f, 0x167ff,
- 0x16a39, 0x1afff,
+ 0x16a39, 0x16eff,
+ 0x16f45, 0x16f4f,
+ 0x16f7f, 0x16f8e,
+ 0x16fa0, 0x1afff,
0x1b002, 0x1cfff,
0x1d0f6, 0x1d0ff,
0x1d127, 0x1d128,
@@ -14917,7 +18645,41 @@ static const OnigCodePoint CR_Unknown[] = {
0x1d551, 0x1d551,
0x1d6a6, 0x1d6a7,
0x1d7cc, 0x1d7cd,
- 0x1d800, 0x1efff,
+ 0x1d800, 0x1edff,
+ 0x1ee04, 0x1ee04,
+ 0x1ee20, 0x1ee20,
+ 0x1ee23, 0x1ee23,
+ 0x1ee25, 0x1ee26,
+ 0x1ee28, 0x1ee28,
+ 0x1ee33, 0x1ee33,
+ 0x1ee38, 0x1ee38,
+ 0x1ee3a, 0x1ee3a,
+ 0x1ee3c, 0x1ee41,
+ 0x1ee43, 0x1ee46,
+ 0x1ee48, 0x1ee48,
+ 0x1ee4a, 0x1ee4a,
+ 0x1ee4c, 0x1ee4c,
+ 0x1ee50, 0x1ee50,
+ 0x1ee53, 0x1ee53,
+ 0x1ee55, 0x1ee56,
+ 0x1ee58, 0x1ee58,
+ 0x1ee5a, 0x1ee5a,
+ 0x1ee5c, 0x1ee5c,
+ 0x1ee5e, 0x1ee5e,
+ 0x1ee60, 0x1ee60,
+ 0x1ee63, 0x1ee63,
+ 0x1ee65, 0x1ee66,
+ 0x1ee6b, 0x1ee6b,
+ 0x1ee73, 0x1ee73,
+ 0x1ee78, 0x1ee78,
+ 0x1ee7d, 0x1ee7d,
+ 0x1ee7f, 0x1ee7f,
+ 0x1ee8a, 0x1ee8a,
+ 0x1ee9c, 0x1eea0,
+ 0x1eea4, 0x1eea4,
+ 0x1eeaa, 0x1eeaa,
+ 0x1eebc, 0x1eeef,
+ 0x1eef2, 0x1efff,
0x1f02c, 0x1f02f,
0x1f094, 0x1f09f,
0x1f0af, 0x1f0b0,
@@ -14926,7 +18688,7 @@ static const OnigCodePoint CR_Unknown[] = {
0x1f0e0, 0x1f0ff,
0x1f10b, 0x1f10f,
0x1f12f, 0x1f12f,
- 0x1f16a, 0x1f16f,
+ 0x1f16c, 0x1f16f,
0x1f19b, 0x1f1e5,
0x1f203, 0x1f20f,
0x1f23b, 0x1f23f,
@@ -14943,19 +18705,9 @@ static const OnigCodePoint CR_Unknown[] = {
0x1f441, 0x1f441,
0x1f4f8, 0x1f4f8,
0x1f4fd, 0x1f4ff,
- 0x1f53e, 0x1f54f,
+ 0x1f53e, 0x1f53f,
+ 0x1f544, 0x1f54f,
0x1f568, 0x1f5fa,
- 0x1f600, 0x1f600,
- 0x1f611, 0x1f611,
- 0x1f615, 0x1f615,
- 0x1f617, 0x1f617,
- 0x1f619, 0x1f619,
- 0x1f61b, 0x1f61b,
- 0x1f61f, 0x1f61f,
- 0x1f626, 0x1f627,
- 0x1f62c, 0x1f62c,
- 0x1f62e, 0x1f62f,
- 0x1f634, 0x1f634,
0x1f641, 0x1f644,
0x1f650, 0x1f67f,
0x1f6c6, 0x1f6ff,
@@ -14968,8 +18720,6 @@ static const OnigCodePoint CR_Unknown[] = {
0xe0080, 0xe00ff,
0xe01f0, 0x10ffff,
}; /* CR_Unknown */
-#endif /* USE_UNICODE_PROPERTIES */
-#endif /* USE_UNICODE_PROPERTIES */
/* 'Age_1_1': Derived Age 1.1 */
static const OnigCodePoint CR_Age_1_1[] = {
@@ -19854,554 +23604,10 @@ static const OnigCodePoint CR_Age_6_0[] = {
0xefffe, 0x10ffff,
}; /* CR_Age_6_0 */
-/* 'NEWLINE': [[:NEWLINE:]] */
-static const OnigCodePoint CR_NEWLINE[] = {
- 1,
- 0x000a, 0x000a,
-}; /* CR_NEWLINE */
-
-/* 'Alpha': [[:Alpha:]] */
-#define CR_Alpha CR_Alphabetic
-
-/* 'Blank': [[:Blank:]] */
-static const OnigCodePoint CR_Blank[] = {
- 9,
- 0x0009, 0x0009,
- 0x0020, 0x0020,
- 0x00a0, 0x00a0,
- 0x1680, 0x1680,
- 0x180e, 0x180e,
- 0x2000, 0x200a,
- 0x202f, 0x202f,
- 0x205f, 0x205f,
- 0x3000, 0x3000,
-}; /* CR_Blank */
-
-/* 'Cntrl': [[:Cntrl:]] */
-#define CR_Cntrl CR_Cc
-
-/* 'Digit': [[:Digit:]] */
-#define CR_Digit CR_Nd
-
-/* 'Graph': [[:Graph:]] */
-static const OnigCodePoint CR_Graph[] = {
- 506,
- 0x0021, 0x007e,
- 0x00a1, 0x0377,
- 0x037a, 0x037e,
- 0x0384, 0x038a,
- 0x038c, 0x038c,
- 0x038e, 0x03a1,
- 0x03a3, 0x0527,
- 0x0531, 0x0556,
- 0x0559, 0x055f,
- 0x0561, 0x0587,
- 0x0589, 0x058a,
- 0x0591, 0x05c7,
- 0x05d0, 0x05ea,
- 0x05f0, 0x05f4,
- 0x0600, 0x0603,
- 0x0606, 0x061b,
- 0x061e, 0x070d,
- 0x070f, 0x074a,
- 0x074d, 0x07b1,
- 0x07c0, 0x07fa,
- 0x0800, 0x082d,
- 0x0830, 0x083e,
- 0x0840, 0x085b,
- 0x085e, 0x085e,
- 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, 0x0aef,
- 0x0af1, 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, 0x0edd,
- 0x0f00, 0x0f47,
- 0x0f49, 0x0f6c,
- 0x0f71, 0x0f97,
- 0x0f99, 0x0fbc,
- 0x0fbe, 0x0fcc,
- 0x0fce, 0x0fda,
- 0x1000, 0x10c5,
- 0x10d0, 0x10fc,
- 0x1100, 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, 0x167f,
- 0x1681, 0x169c,
- 0x16a0, 0x16f0,
- 0x1700, 0x170c,
- 0x170e, 0x1714,
- 0x1720, 0x1736,
- 0x1740, 0x1753,
- 0x1760, 0x176c,
- 0x176e, 0x1770,
- 0x1772, 0x1773,
- 0x1780, 0x17dd,
- 0x17e0, 0x17e9,
- 0x17f0, 0x17f9,
- 0x1800, 0x180d,
- 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, 0x1baa,
- 0x1bae, 0x1bb9,
- 0x1bc0, 0x1bf3,
- 0x1bfc, 0x1c37,
- 0x1c3b, 0x1c49,
- 0x1c4d, 0x1c7f,
- 0x1cd0, 0x1cf2,
- 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,
- 0x200b, 0x2027,
- 0x202a, 0x202e,
- 0x2030, 0x205e,
- 0x2060, 0x2064,
- 0x206a, 0x2071,
- 0x2074, 0x208e,
- 0x2090, 0x209c,
- 0x20a0, 0x20b9,
- 0x20d0, 0x20f0,
- 0x2100, 0x2189,
- 0x2190, 0x23f3,
- 0x2400, 0x2426,
- 0x2440, 0x244a,
- 0x2460, 0x26ff,
- 0x2701, 0x27ca,
- 0x27cc, 0x27cc,
- 0x27ce, 0x2b4c,
- 0x2b50, 0x2b59,
- 0x2c00, 0x2c2e,
- 0x2c30, 0x2c5e,
- 0x2c60, 0x2cf1,
- 0x2cf9, 0x2d25,
- 0x2d30, 0x2d65,
- 0x2d6f, 0x2d70,
- 0x2d7f, 0x2d96,
- 0x2da0, 0x2da6,
- 0x2da8, 0x2dae,
- 0x2db0, 0x2db6,
- 0x2db8, 0x2dbe,
- 0x2dc0, 0x2dc6,
- 0x2dc8, 0x2dce,
- 0x2dd0, 0x2dd6,
- 0x2dd8, 0x2dde,
- 0x2de0, 0x2e31,
- 0x2e80, 0x2e99,
- 0x2e9b, 0x2ef3,
- 0x2f00, 0x2fd5,
- 0x2ff0, 0x2ffb,
- 0x3001, 0x303f,
- 0x3041, 0x3096,
- 0x3099, 0x30ff,
- 0x3105, 0x312d,
- 0x3131, 0x318e,
- 0x3190, 0x31ba,
- 0x31c0, 0x31e3,
- 0x31f0, 0x321e,
- 0x3220, 0x32fe,
- 0x3300, 0x4db5,
- 0x4dc0, 0x9fcb,
- 0xa000, 0xa48c,
- 0xa490, 0xa4c6,
- 0xa4d0, 0xa62b,
- 0xa640, 0xa673,
- 0xa67c, 0xa697,
- 0xa6a0, 0xa6f7,
- 0xa700, 0xa78e,
- 0xa790, 0xa791,
- 0xa7a0, 0xa7a9,
- 0xa7fa, 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, 0xaadf,
- 0xab01, 0xab06,
- 0xab09, 0xab0e,
- 0xab11, 0xab16,
- 0xab20, 0xab26,
- 0xab28, 0xab2e,
- 0xabc0, 0xabed,
- 0xabf0, 0xabf9,
- 0xac00, 0xd7a3,
- 0xd7b0, 0xd7c6,
- 0xd7cb, 0xd7fb,
- 0xe000, 0xfa2d,
- 0xfa30, 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,
- 0xfdf0, 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, 0xfffd,
- 0x10000, 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,
- 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,
- 0x12000, 0x1236e,
- 0x12400, 0x12462,
- 0x12470, 0x12473,
- 0x13000, 0x1342e,
- 0x16800, 0x16a38,
- 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,
- 0x1f000, 0x1f02b,
- 0x1f030, 0x1f093,
- 0x1f0a0, 0x1f0ae,
- 0x1f0b1, 0x1f0be,
- 0x1f0c1, 0x1f0cf,
- 0x1f0d1, 0x1f0df,
- 0x1f100, 0x1f10a,
- 0x1f110, 0x1f12e,
- 0x1f130, 0x1f169,
- 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,
- 0x1f550, 0x1f567,
- 0x1f5fb, 0x1f5ff,
- 0x1f601, 0x1f610,
- 0x1f612, 0x1f614,
- 0x1f616, 0x1f616,
- 0x1f618, 0x1f618,
- 0x1f61a, 0x1f61a,
- 0x1f61c, 0x1f61e,
- 0x1f620, 0x1f625,
- 0x1f628, 0x1f62b,
- 0x1f62d, 0x1f62d,
- 0x1f630, 0x1f633,
- 0x1f635, 0x1f640,
- 0x1f645, 0x1f64f,
- 0x1f680, 0x1f6c5,
- 0x1f700, 0x1f773,
- 0x20000, 0x2a6d6,
- 0x2a700, 0x2b734,
- 0x2b740, 0x2b81d,
- 0x2f800, 0x2fa1d,
- 0xe0001, 0xe0001,
- 0xe0020, 0xe007f,
- 0xe0100, 0xe01ef,
- 0xf0000, 0xffffd,
- 0x100000, 0x10fffd,
-}; /* CR_Graph */
-
-/* 'Lower': [[:Lower:]] */
-#define CR_Lower CR_Lowercase
-
-/* 'Print': [[:Print:]] */
-static const OnigCodePoint CR_Print[] = {
- 503,
- 0x0020, 0x007e,
- 0x00a0, 0x0377,
+/* 'Age_6_1': Derived Age 6.1 */
+static const OnigCodePoint CR_Age_6_1[] = {
+ 549,
+ 0x0000, 0x0377,
0x037a, 0x037e,
0x0384, 0x038a,
0x038c, 0x038c,
@@ -20411,10 +23617,11 @@ static const OnigCodePoint CR_Print[] = {
0x0559, 0x055f,
0x0561, 0x0587,
0x0589, 0x058a,
+ 0x058f, 0x058f,
0x0591, 0x05c7,
0x05d0, 0x05ea,
0x05f0, 0x05f4,
- 0x0600, 0x0603,
+ 0x0600, 0x0604,
0x0606, 0x061b,
0x061e, 0x070d,
0x070f, 0x074a,
@@ -20424,6 +23631,9 @@ static const OnigCodePoint CR_Print[] = {
0x0830, 0x083e,
0x0840, 0x085b,
0x085e, 0x085e,
+ 0x08a0, 0x08a0,
+ 0x08a2, 0x08ac,
+ 0x08e4, 0x08fe,
0x0900, 0x0977,
0x0979, 0x097f,
0x0981, 0x0983,
@@ -20468,8 +23678,7 @@ static const OnigCodePoint CR_Print[] = {
0x0acb, 0x0acd,
0x0ad0, 0x0ad0,
0x0ae0, 0x0ae3,
- 0x0ae6, 0x0aef,
- 0x0af1, 0x0af1,
+ 0x0ae6, 0x0af1,
0x0b01, 0x0b03,
0x0b05, 0x0b0c,
0x0b0f, 0x0b10,
@@ -20569,7 +23778,7 @@ static const OnigCodePoint CR_Print[] = {
0x0ec6, 0x0ec6,
0x0ec8, 0x0ecd,
0x0ed0, 0x0ed9,
- 0x0edc, 0x0edd,
+ 0x0edc, 0x0edf,
0x0f00, 0x0f47,
0x0f49, 0x0f6c,
0x0f71, 0x0f97,
@@ -20577,8 +23786,9 @@ static const OnigCodePoint CR_Print[] = {
0x0fbe, 0x0fcc,
0x0fce, 0x0fda,
0x1000, 0x10c5,
- 0x10d0, 0x10fc,
- 0x1100, 0x1248,
+ 0x10c7, 0x10c7,
+ 0x10cd, 0x10cd,
+ 0x10d0, 0x1248,
0x124a, 0x124d,
0x1250, 0x1256,
0x1258, 0x1258,
@@ -20631,13 +23841,12 @@ static const OnigCodePoint CR_Print[] = {
0x1aa0, 0x1aad,
0x1b00, 0x1b4b,
0x1b50, 0x1b7c,
- 0x1b80, 0x1baa,
- 0x1bae, 0x1bb9,
- 0x1bc0, 0x1bf3,
+ 0x1b80, 0x1bf3,
0x1bfc, 0x1c37,
0x1c3b, 0x1c49,
0x1c4d, 0x1c7f,
- 0x1cd0, 0x1cf2,
+ 0x1cc0, 0x1cc7,
+ 0x1cd0, 0x1cf6,
0x1d00, 0x1de6,
0x1dfc, 0x1f15,
0x1f18, 0x1f1d,
@@ -20655,8 +23864,7 @@ static const OnigCodePoint CR_Print[] = {
0x1fdd, 0x1fef,
0x1ff2, 0x1ff4,
0x1ff6, 0x1ffe,
- 0x2000, 0x2027,
- 0x202a, 0x2064,
+ 0x2000, 0x2064,
0x206a, 0x2071,
0x2074, 0x208e,
0x2090, 0x209c,
@@ -20667,15 +23875,15 @@ static const OnigCodePoint CR_Print[] = {
0x2400, 0x2426,
0x2440, 0x244a,
0x2460, 0x26ff,
- 0x2701, 0x27ca,
- 0x27cc, 0x27cc,
- 0x27ce, 0x2b4c,
+ 0x2701, 0x2b4c,
0x2b50, 0x2b59,
0x2c00, 0x2c2e,
0x2c30, 0x2c5e,
- 0x2c60, 0x2cf1,
+ 0x2c60, 0x2cf3,
0x2cf9, 0x2d25,
- 0x2d30, 0x2d65,
+ 0x2d27, 0x2d27,
+ 0x2d2d, 0x2d2d,
+ 0x2d30, 0x2d67,
0x2d6f, 0x2d70,
0x2d7f, 0x2d96,
0x2da0, 0x2da6,
@@ -20686,7 +23894,7 @@ static const OnigCodePoint CR_Print[] = {
0x2dc8, 0x2dce,
0x2dd0, 0x2dd6,
0x2dd8, 0x2dde,
- 0x2de0, 0x2e31,
+ 0x2de0, 0x2e3b,
0x2e80, 0x2e99,
0x2e9b, 0x2ef3,
0x2f00, 0x2fd5,
@@ -20701,17 +23909,16 @@ static const OnigCodePoint CR_Print[] = {
0x31f0, 0x321e,
0x3220, 0x32fe,
0x3300, 0x4db5,
- 0x4dc0, 0x9fcb,
+ 0x4dc0, 0x9fcc,
0xa000, 0xa48c,
0xa490, 0xa4c6,
0xa4d0, 0xa62b,
- 0xa640, 0xa673,
- 0xa67c, 0xa697,
- 0xa6a0, 0xa6f7,
+ 0xa640, 0xa697,
+ 0xa69f, 0xa6f7,
0xa700, 0xa78e,
- 0xa790, 0xa791,
- 0xa7a0, 0xa7a9,
- 0xa7fa, 0xa82b,
+ 0xa790, 0xa793,
+ 0xa7a0, 0xa7aa,
+ 0xa7f8, 0xa82b,
0xa830, 0xa839,
0xa840, 0xa877,
0xa880, 0xa8c4,
@@ -20727,7 +23934,7 @@ static const OnigCodePoint CR_Print[] = {
0xaa50, 0xaa59,
0xaa5c, 0xaa7b,
0xaa80, 0xaac2,
- 0xaadb, 0xaadf,
+ 0xaadb, 0xaaf6,
0xab01, 0xab06,
0xab09, 0xab0e,
0xab11, 0xab16,
@@ -20738,8 +23945,7 @@ static const OnigCodePoint CR_Print[] = {
0xac00, 0xd7a3,
0xd7b0, 0xd7c6,
0xd7cb, 0xd7fb,
- 0xe000, 0xfa2d,
- 0xfa30, 0xfa6d,
+ 0xd800, 0xfa6d,
0xfa70, 0xfad9,
0xfb00, 0xfb06,
0xfb13, 0xfb17,
@@ -20752,7 +23958,7 @@ static const OnigCodePoint CR_Print[] = {
0xfbd3, 0xfd3f,
0xfd50, 0xfd8f,
0xfd92, 0xfdc7,
- 0xfdf0, 0xfdfd,
+ 0xfdd0, 0xfdfd,
0xfe00, 0xfe19,
0xfe20, 0xfe26,
0xfe30, 0xfe52,
@@ -20768,8 +23974,7 @@ static const OnigCodePoint CR_Print[] = {
0xffda, 0xffdc,
0xffe0, 0xffe6,
0xffe8, 0xffee,
- 0xfff9, 0xfffd,
- 0x10000, 0x1000b,
+ 0xfff9, 0x1000b,
0x1000d, 0x10026,
0x10028, 0x1003a,
0x1003c, 0x1003d,
@@ -20801,6 +24006,8 @@ static const OnigCodePoint CR_Print[] = {
0x10900, 0x1091b,
0x1091f, 0x10939,
0x1093f, 0x1093f,
+ 0x10980, 0x109b7,
+ 0x109be, 0x109bf,
0x10a00, 0x10a03,
0x10a05, 0x10a06,
0x10a0c, 0x10a13,
@@ -20819,11 +24026,22 @@ static const OnigCodePoint CR_Print[] = {
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,
@@ -20852,6 +24070,40 @@ static const OnigCodePoint CR_Print[] = {
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,
@@ -20860,7 +24112,7 @@ static const OnigCodePoint CR_Print[] = {
0x1f0d1, 0x1f0df,
0x1f100, 0x1f10a,
0x1f110, 0x1f12e,
- 0x1f130, 0x1f169,
+ 0x1f130, 0x1f16b,
0x1f170, 0x1f19a,
0x1f1e6, 0x1f202,
0x1f210, 0x1f23a,
@@ -20878,1083 +24130,1368 @@ static const OnigCodePoint CR_Print[] = {
0x1f442, 0x1f4f7,
0x1f4f9, 0x1f4fc,
0x1f500, 0x1f53d,
+ 0x1f540, 0x1f543,
0x1f550, 0x1f567,
- 0x1f5fb, 0x1f5ff,
- 0x1f601, 0x1f610,
- 0x1f612, 0x1f614,
- 0x1f616, 0x1f616,
- 0x1f618, 0x1f618,
- 0x1f61a, 0x1f61a,
- 0x1f61c, 0x1f61e,
- 0x1f620, 0x1f625,
- 0x1f628, 0x1f62b,
- 0x1f62d, 0x1f62d,
- 0x1f630, 0x1f633,
- 0x1f635, 0x1f640,
+ 0x1f5fb, 0x1f640,
0x1f645, 0x1f64f,
0x1f680, 0x1f6c5,
0x1f700, 0x1f773,
- 0x20000, 0x2a6d6,
+ 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,
- 0xf0000, 0xffffd,
- 0x100000, 0x10fffd,
-}; /* CR_Print */
+ 0xefffe, 0x10ffff,
+}; /* CR_Age_6_1 */
-/* 'Punct': [[:Punct:]] */
-#define CR_Punct CR_P
+/* 'In_Basic_Latin': Block */
+#define CR_In_Basic_Latin CR_ASCII
-/* 'Space': [[:Space:]] */
-#define CR_Space CR_White_Space
+/* 'In_Latin_1_Supplement': Block */
+static const OnigCodePoint CR_In_Latin_1_Supplement[] = {
+ 1,
+ 0x0080, 0x00ff,
+}; /* CR_In_Latin_1_Supplement */
-/* 'Upper': [[:Upper:]] */
-#define CR_Upper CR_Uppercase
+/* 'In_Latin_Extended_A': Block */
+static const OnigCodePoint CR_In_Latin_Extended_A[] = {
+ 1,
+ 0x0100, 0x017f,
+}; /* CR_In_Latin_Extended_A */
-/* 'XDigit': [[:XDigit:]] */
-#define CR_XDigit CR_ASCII_Hex_Digit
+/* 'In_Latin_Extended_B': Block */
+static const OnigCodePoint CR_In_Latin_Extended_B[] = {
+ 1,
+ 0x0180, 0x024f,
+}; /* CR_In_Latin_Extended_B */
-/* 'Word': [[:Word:]] */
-static const OnigCodePoint CR_Word[] = {
- 514,
- 0x0030, 0x0039,
- 0x0041, 0x005a,
- 0x005f, 0x005f,
- 0x0061, 0x007a,
- 0x00aa, 0x00aa,
- 0x00b5, 0x00b5,
- 0x00ba, 0x00ba,
- 0x00c0, 0x00d6,
- 0x00d8, 0x00f6,
- 0x00f8, 0x02c1,
- 0x02c6, 0x02d1,
- 0x02e0, 0x02e4,
- 0x02ec, 0x02ec,
- 0x02ee, 0x02ee,
- 0x0300, 0x0374,
- 0x0376, 0x0377,
- 0x037a, 0x037d,
- 0x0386, 0x0386,
- 0x0388, 0x038a,
- 0x038c, 0x038c,
- 0x038e, 0x03a1,
- 0x03a3, 0x03f5,
- 0x03f7, 0x0481,
- 0x0483, 0x0527,
- 0x0531, 0x0556,
- 0x0559, 0x0559,
- 0x0561, 0x0587,
- 0x0591, 0x05bd,
- 0x05bf, 0x05bf,
- 0x05c1, 0x05c2,
- 0x05c4, 0x05c5,
- 0x05c7, 0x05c7,
- 0x05d0, 0x05ea,
- 0x05f0, 0x05f2,
- 0x0610, 0x061a,
- 0x0620, 0x0669,
- 0x066e, 0x06d3,
- 0x06d5, 0x06dc,
- 0x06df, 0x06e8,
- 0x06ea, 0x06fc,
- 0x06ff, 0x06ff,
- 0x0710, 0x074a,
- 0x074d, 0x07b1,
- 0x07c0, 0x07f5,
- 0x07fa, 0x07fa,
- 0x0800, 0x082d,
- 0x0840, 0x085b,
- 0x0900, 0x0963,
- 0x0966, 0x096f,
- 0x0971, 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, 0x09f1,
- 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, 0x0aef,
- 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, 0x0b6f,
- 0x0b71, 0x0b71,
- 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, 0x0bef,
- 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,
- 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, 0x0d6f,
- 0x0d7a, 0x0d7f,
- 0x0d82, 0x0d83,
- 0x0d85, 0x0d96,
- 0x0d9a, 0x0db1,
- 0x0db3, 0x0dbb,
- 0x0dbd, 0x0dbd,
- 0x0dc0, 0x0dc6,
- 0x0dca, 0x0dca,
- 0x0dcf, 0x0dd4,
- 0x0dd6, 0x0dd6,
- 0x0dd8, 0x0ddf,
- 0x0df2, 0x0df3,
- 0x0e01, 0x0e3a,
- 0x0e40, 0x0e4e,
- 0x0e50, 0x0e59,
- 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, 0x0edd,
- 0x0f00, 0x0f00,
- 0x0f18, 0x0f19,
- 0x0f20, 0x0f29,
- 0x0f35, 0x0f35,
- 0x0f37, 0x0f37,
- 0x0f39, 0x0f39,
- 0x0f3e, 0x0f47,
- 0x0f49, 0x0f6c,
- 0x0f71, 0x0f84,
- 0x0f86, 0x0f97,
- 0x0f99, 0x0fbc,
- 0x0fc6, 0x0fc6,
- 0x1000, 0x1049,
- 0x1050, 0x109d,
- 0x10a0, 0x10c5,
- 0x10d0, 0x10fa,
- 0x10fc, 0x10fc,
- 0x1100, 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, 0x135f,
- 0x1380, 0x138f,
- 0x13a0, 0x13f4,
- 0x1401, 0x166c,
- 0x166f, 0x167f,
- 0x1681, 0x169a,
- 0x16a0, 0x16ea,
- 0x16ee, 0x16f0,
- 0x1700, 0x170c,
- 0x170e, 0x1714,
- 0x1720, 0x1734,
- 0x1740, 0x1753,
- 0x1760, 0x176c,
- 0x176e, 0x1770,
- 0x1772, 0x1773,
- 0x1780, 0x17b3,
- 0x17b6, 0x17d3,
- 0x17d7, 0x17d7,
- 0x17dc, 0x17dd,
- 0x17e0, 0x17e9,
- 0x180b, 0x180d,
- 0x1810, 0x1819,
- 0x1820, 0x1877,
- 0x1880, 0x18aa,
- 0x18b0, 0x18f5,
- 0x1900, 0x191c,
- 0x1920, 0x192b,
- 0x1930, 0x193b,
- 0x1946, 0x196d,
- 0x1970, 0x1974,
- 0x1980, 0x19ab,
- 0x19b0, 0x19c9,
- 0x19d0, 0x19d9,
- 0x1a00, 0x1a1b,
- 0x1a20, 0x1a5e,
- 0x1a60, 0x1a7c,
- 0x1a7f, 0x1a89,
- 0x1a90, 0x1a99,
- 0x1aa7, 0x1aa7,
- 0x1b00, 0x1b4b,
- 0x1b50, 0x1b59,
- 0x1b6b, 0x1b73,
- 0x1b80, 0x1baa,
- 0x1bae, 0x1bb9,
- 0x1bc0, 0x1bf3,
- 0x1c00, 0x1c37,
- 0x1c40, 0x1c49,
- 0x1c4d, 0x1c7d,
- 0x1cd0, 0x1cd2,
- 0x1cd4, 0x1cf2,
- 0x1d00, 0x1de6,
- 0x1dfc, 0x1f15,
- 0x1f18, 0x1f1d,
- 0x1f20, 0x1f45,
- 0x1f48, 0x1f4d,
- 0x1f50, 0x1f57,
- 0x1f59, 0x1f59,
- 0x1f5b, 0x1f5b,
- 0x1f5d, 0x1f5d,
- 0x1f5f, 0x1f7d,
- 0x1f80, 0x1fb4,
- 0x1fb6, 0x1fbc,
- 0x1fbe, 0x1fbe,
- 0x1fc2, 0x1fc4,
- 0x1fc6, 0x1fcc,
- 0x1fd0, 0x1fd3,
- 0x1fd6, 0x1fdb,
- 0x1fe0, 0x1fec,
- 0x1ff2, 0x1ff4,
- 0x1ff6, 0x1ffc,
- 0x203f, 0x2040,
- 0x2054, 0x2054,
- 0x2071, 0x2071,
- 0x207f, 0x207f,
- 0x2090, 0x209c,
- 0x20d0, 0x20f0,
- 0x2102, 0x2102,
- 0x2107, 0x2107,
- 0x210a, 0x2113,
- 0x2115, 0x2115,
- 0x2119, 0x211d,
- 0x2124, 0x2124,
- 0x2126, 0x2126,
- 0x2128, 0x2128,
- 0x212a, 0x212d,
- 0x212f, 0x2139,
- 0x213c, 0x213f,
- 0x2145, 0x2149,
- 0x214e, 0x214e,
- 0x2160, 0x2188,
- 0x24b6, 0x24e9,
- 0x2c00, 0x2c2e,
- 0x2c30, 0x2c5e,
- 0x2c60, 0x2ce4,
- 0x2ceb, 0x2cf1,
- 0x2d00, 0x2d25,
- 0x2d30, 0x2d65,
- 0x2d6f, 0x2d6f,
- 0x2d7f, 0x2d96,
- 0x2da0, 0x2da6,
- 0x2da8, 0x2dae,
- 0x2db0, 0x2db6,
- 0x2db8, 0x2dbe,
- 0x2dc0, 0x2dc6,
- 0x2dc8, 0x2dce,
- 0x2dd0, 0x2dd6,
- 0x2dd8, 0x2dde,
+/* 'In_IPA_Extensions': Block */
+static const OnigCodePoint CR_In_IPA_Extensions[] = {
+ 1,
+ 0x0250, 0x02af,
+}; /* CR_In_IPA_Extensions */
+
+/* 'In_Spacing_Modifier_Letters': Block */
+static const OnigCodePoint CR_In_Spacing_Modifier_Letters[] = {
+ 1,
+ 0x02b0, 0x02ff,
+}; /* CR_In_Spacing_Modifier_Letters */
+
+/* 'In_Combining_Diacritical_Marks': Block */
+static const OnigCodePoint CR_In_Combining_Diacritical_Marks[] = {
+ 1,
+ 0x0300, 0x036f,
+}; /* CR_In_Combining_Diacritical_Marks */
+
+/* 'In_Greek_and_Coptic': Block */
+static const OnigCodePoint CR_In_Greek_and_Coptic[] = {
+ 1,
+ 0x0370, 0x03ff,
+}; /* CR_In_Greek_and_Coptic */
+
+/* 'In_Cyrillic': Block */
+static const OnigCodePoint CR_In_Cyrillic[] = {
+ 1,
+ 0x0400, 0x04ff,
+}; /* CR_In_Cyrillic */
+
+/* 'In_Cyrillic_Supplement': Block */
+static const OnigCodePoint CR_In_Cyrillic_Supplement[] = {
+ 1,
+ 0x0500, 0x052f,
+}; /* CR_In_Cyrillic_Supplement */
+
+/* 'In_Armenian': Block */
+static const OnigCodePoint CR_In_Armenian[] = {
+ 1,
+ 0x0530, 0x058f,
+}; /* CR_In_Armenian */
+
+/* 'In_Hebrew': Block */
+static const OnigCodePoint CR_In_Hebrew[] = {
+ 1,
+ 0x0590, 0x05ff,
+}; /* CR_In_Hebrew */
+
+/* 'In_Arabic': Block */
+static const OnigCodePoint CR_In_Arabic[] = {
+ 1,
+ 0x0600, 0x06ff,
+}; /* CR_In_Arabic */
+
+/* 'In_Syriac': Block */
+static const OnigCodePoint CR_In_Syriac[] = {
+ 1,
+ 0x0700, 0x074f,
+}; /* CR_In_Syriac */
+
+/* 'In_Arabic_Supplement': Block */
+static const OnigCodePoint CR_In_Arabic_Supplement[] = {
+ 1,
+ 0x0750, 0x077f,
+}; /* CR_In_Arabic_Supplement */
+
+/* 'In_Thaana': Block */
+static const OnigCodePoint CR_In_Thaana[] = {
+ 1,
+ 0x0780, 0x07bf,
+}; /* CR_In_Thaana */
+
+/* 'In_NKo': Block */
+static const OnigCodePoint CR_In_NKo[] = {
+ 1,
+ 0x07c0, 0x07ff,
+}; /* CR_In_NKo */
+
+/* 'In_Samaritan': Block */
+static const OnigCodePoint CR_In_Samaritan[] = {
+ 1,
+ 0x0800, 0x083f,
+}; /* CR_In_Samaritan */
+
+/* 'In_Mandaic': Block */
+static const OnigCodePoint CR_In_Mandaic[] = {
+ 1,
+ 0x0840, 0x085f,
+}; /* CR_In_Mandaic */
+
+/* 'In_Arabic_Extended_A': Block */
+static const OnigCodePoint CR_In_Arabic_Extended_A[] = {
+ 1,
+ 0x08a0, 0x08ff,
+}; /* CR_In_Arabic_Extended_A */
+
+/* 'In_Devanagari': Block */
+static const OnigCodePoint CR_In_Devanagari[] = {
+ 1,
+ 0x0900, 0x097f,
+}; /* CR_In_Devanagari */
+
+/* 'In_Bengali': Block */
+static const OnigCodePoint CR_In_Bengali[] = {
+ 1,
+ 0x0980, 0x09ff,
+}; /* CR_In_Bengali */
+
+/* 'In_Gurmukhi': Block */
+static const OnigCodePoint CR_In_Gurmukhi[] = {
+ 1,
+ 0x0a00, 0x0a7f,
+}; /* CR_In_Gurmukhi */
+
+/* 'In_Gujarati': Block */
+static const OnigCodePoint CR_In_Gujarati[] = {
+ 1,
+ 0x0a80, 0x0aff,
+}; /* CR_In_Gujarati */
+
+/* 'In_Oriya': Block */
+static const OnigCodePoint CR_In_Oriya[] = {
+ 1,
+ 0x0b00, 0x0b7f,
+}; /* CR_In_Oriya */
+
+/* 'In_Tamil': Block */
+static const OnigCodePoint CR_In_Tamil[] = {
+ 1,
+ 0x0b80, 0x0bff,
+}; /* CR_In_Tamil */
+
+/* 'In_Telugu': Block */
+static const OnigCodePoint CR_In_Telugu[] = {
+ 1,
+ 0x0c00, 0x0c7f,
+}; /* CR_In_Telugu */
+
+/* 'In_Kannada': Block */
+static const OnigCodePoint CR_In_Kannada[] = {
+ 1,
+ 0x0c80, 0x0cff,
+}; /* CR_In_Kannada */
+
+/* 'In_Malayalam': Block */
+static const OnigCodePoint CR_In_Malayalam[] = {
+ 1,
+ 0x0d00, 0x0d7f,
+}; /* CR_In_Malayalam */
+
+/* 'In_Sinhala': Block */
+static const OnigCodePoint CR_In_Sinhala[] = {
+ 1,
+ 0x0d80, 0x0dff,
+}; /* CR_In_Sinhala */
+
+/* 'In_Thai': Block */
+static const OnigCodePoint CR_In_Thai[] = {
+ 1,
+ 0x0e00, 0x0e7f,
+}; /* CR_In_Thai */
+
+/* 'In_Lao': Block */
+static const OnigCodePoint CR_In_Lao[] = {
+ 1,
+ 0x0e80, 0x0eff,
+}; /* CR_In_Lao */
+
+/* 'In_Tibetan': Block */
+static const OnigCodePoint CR_In_Tibetan[] = {
+ 1,
+ 0x0f00, 0x0fff,
+}; /* CR_In_Tibetan */
+
+/* 'In_Myanmar': Block */
+static const OnigCodePoint CR_In_Myanmar[] = {
+ 1,
+ 0x1000, 0x109f,
+}; /* CR_In_Myanmar */
+
+/* 'In_Georgian': Block */
+static const OnigCodePoint CR_In_Georgian[] = {
+ 1,
+ 0x10a0, 0x10ff,
+}; /* CR_In_Georgian */
+
+/* 'In_Hangul_Jamo': Block */
+static const OnigCodePoint CR_In_Hangul_Jamo[] = {
+ 1,
+ 0x1100, 0x11ff,
+}; /* CR_In_Hangul_Jamo */
+
+/* 'In_Ethiopic': Block */
+static const OnigCodePoint CR_In_Ethiopic[] = {
+ 1,
+ 0x1200, 0x137f,
+}; /* CR_In_Ethiopic */
+
+/* 'In_Ethiopic_Supplement': Block */
+static const OnigCodePoint CR_In_Ethiopic_Supplement[] = {
+ 1,
+ 0x1380, 0x139f,
+}; /* CR_In_Ethiopic_Supplement */
+
+/* 'In_Cherokee': Block */
+static const OnigCodePoint CR_In_Cherokee[] = {
+ 1,
+ 0x13a0, 0x13ff,
+}; /* CR_In_Cherokee */
+
+/* 'In_Unified_Canadian_Aboriginal_Syllabics': Block */
+static const OnigCodePoint CR_In_Unified_Canadian_Aboriginal_Syllabics[] = {
+ 1,
+ 0x1400, 0x167f,
+}; /* CR_In_Unified_Canadian_Aboriginal_Syllabics */
+
+/* 'In_Ogham': Block */
+static const OnigCodePoint CR_In_Ogham[] = {
+ 1,
+ 0x1680, 0x169f,
+}; /* CR_In_Ogham */
+
+/* 'In_Runic': Block */
+static const OnigCodePoint CR_In_Runic[] = {
+ 1,
+ 0x16a0, 0x16ff,
+}; /* CR_In_Runic */
+
+/* 'In_Tagalog': Block */
+static const OnigCodePoint CR_In_Tagalog[] = {
+ 1,
+ 0x1700, 0x171f,
+}; /* CR_In_Tagalog */
+
+/* 'In_Hanunoo': Block */
+static const OnigCodePoint CR_In_Hanunoo[] = {
+ 1,
+ 0x1720, 0x173f,
+}; /* CR_In_Hanunoo */
+
+/* 'In_Buhid': Block */
+static const OnigCodePoint CR_In_Buhid[] = {
+ 1,
+ 0x1740, 0x175f,
+}; /* CR_In_Buhid */
+
+/* 'In_Tagbanwa': Block */
+static const OnigCodePoint CR_In_Tagbanwa[] = {
+ 1,
+ 0x1760, 0x177f,
+}; /* CR_In_Tagbanwa */
+
+/* 'In_Khmer': Block */
+static const OnigCodePoint CR_In_Khmer[] = {
+ 1,
+ 0x1780, 0x17ff,
+}; /* CR_In_Khmer */
+
+/* 'In_Mongolian': Block */
+static const OnigCodePoint CR_In_Mongolian[] = {
+ 1,
+ 0x1800, 0x18af,
+}; /* CR_In_Mongolian */
+
+/* 'In_Unified_Canadian_Aboriginal_Syllabics_Extended': Block */
+static const OnigCodePoint CR_In_Unified_Canadian_Aboriginal_Syllabics_Extended[] = {
+ 1,
+ 0x18b0, 0x18ff,
+}; /* CR_In_Unified_Canadian_Aboriginal_Syllabics_Extended */
+
+/* 'In_Limbu': Block */
+static const OnigCodePoint CR_In_Limbu[] = {
+ 1,
+ 0x1900, 0x194f,
+}; /* CR_In_Limbu */
+
+/* 'In_Tai_Le': Block */
+static const OnigCodePoint CR_In_Tai_Le[] = {
+ 1,
+ 0x1950, 0x197f,
+}; /* CR_In_Tai_Le */
+
+/* 'In_New_Tai_Lue': Block */
+static const OnigCodePoint CR_In_New_Tai_Lue[] = {
+ 1,
+ 0x1980, 0x19df,
+}; /* CR_In_New_Tai_Lue */
+
+/* 'In_Khmer_Symbols': Block */
+static const OnigCodePoint CR_In_Khmer_Symbols[] = {
+ 1,
+ 0x19e0, 0x19ff,
+}; /* CR_In_Khmer_Symbols */
+
+/* 'In_Buginese': Block */
+static const OnigCodePoint CR_In_Buginese[] = {
+ 1,
+ 0x1a00, 0x1a1f,
+}; /* CR_In_Buginese */
+
+/* 'In_Tai_Tham': Block */
+static const OnigCodePoint CR_In_Tai_Tham[] = {
+ 1,
+ 0x1a20, 0x1aaf,
+}; /* CR_In_Tai_Tham */
+
+/* 'In_Balinese': Block */
+static const OnigCodePoint CR_In_Balinese[] = {
+ 1,
+ 0x1b00, 0x1b7f,
+}; /* CR_In_Balinese */
+
+/* 'In_Sundanese': Block */
+static const OnigCodePoint CR_In_Sundanese[] = {
+ 1,
+ 0x1b80, 0x1bbf,
+}; /* CR_In_Sundanese */
+
+/* 'In_Batak': Block */
+static const OnigCodePoint CR_In_Batak[] = {
+ 1,
+ 0x1bc0, 0x1bff,
+}; /* CR_In_Batak */
+
+/* 'In_Lepcha': Block */
+static const OnigCodePoint CR_In_Lepcha[] = {
+ 1,
+ 0x1c00, 0x1c4f,
+}; /* CR_In_Lepcha */
+
+/* 'In_Ol_Chiki': Block */
+#define CR_In_Ol_Chiki CR_Ol_Chiki
+
+/* 'In_Sundanese_Supplement': Block */
+static const OnigCodePoint CR_In_Sundanese_Supplement[] = {
+ 1,
+ 0x1cc0, 0x1ccf,
+}; /* CR_In_Sundanese_Supplement */
+
+/* 'In_Vedic_Extensions': Block */
+static const OnigCodePoint CR_In_Vedic_Extensions[] = {
+ 1,
+ 0x1cd0, 0x1cff,
+}; /* CR_In_Vedic_Extensions */
+
+/* 'In_Phonetic_Extensions': Block */
+static const OnigCodePoint CR_In_Phonetic_Extensions[] = {
+ 1,
+ 0x1d00, 0x1d7f,
+}; /* CR_In_Phonetic_Extensions */
+
+/* 'In_Phonetic_Extensions_Supplement': Block */
+static const OnigCodePoint CR_In_Phonetic_Extensions_Supplement[] = {
+ 1,
+ 0x1d80, 0x1dbf,
+}; /* CR_In_Phonetic_Extensions_Supplement */
+
+/* 'In_Combining_Diacritical_Marks_Supplement': Block */
+static const OnigCodePoint CR_In_Combining_Diacritical_Marks_Supplement[] = {
+ 1,
+ 0x1dc0, 0x1dff,
+}; /* CR_In_Combining_Diacritical_Marks_Supplement */
+
+/* 'In_Latin_Extended_Additional': Block */
+static const OnigCodePoint CR_In_Latin_Extended_Additional[] = {
+ 1,
+ 0x1e00, 0x1eff,
+}; /* CR_In_Latin_Extended_Additional */
+
+/* 'In_Greek_Extended': Block */
+static const OnigCodePoint CR_In_Greek_Extended[] = {
+ 1,
+ 0x1f00, 0x1fff,
+}; /* CR_In_Greek_Extended */
+
+/* 'In_General_Punctuation': Block */
+static const OnigCodePoint CR_In_General_Punctuation[] = {
+ 1,
+ 0x2000, 0x206f,
+}; /* CR_In_General_Punctuation */
+
+/* 'In_Superscripts_and_Subscripts': Block */
+static const OnigCodePoint CR_In_Superscripts_and_Subscripts[] = {
+ 1,
+ 0x2070, 0x209f,
+}; /* CR_In_Superscripts_and_Subscripts */
+
+/* 'In_Currency_Symbols': Block */
+static const OnigCodePoint CR_In_Currency_Symbols[] = {
+ 1,
+ 0x20a0, 0x20cf,
+}; /* CR_In_Currency_Symbols */
+
+/* 'In_Combining_Diacritical_Marks_for_Symbols': Block */
+static const OnigCodePoint CR_In_Combining_Diacritical_Marks_for_Symbols[] = {
+ 1,
+ 0x20d0, 0x20ff,
+}; /* CR_In_Combining_Diacritical_Marks_for_Symbols */
+
+/* 'In_Letterlike_Symbols': Block */
+static const OnigCodePoint CR_In_Letterlike_Symbols[] = {
+ 1,
+ 0x2100, 0x214f,
+}; /* CR_In_Letterlike_Symbols */
+
+/* 'In_Number_Forms': Block */
+static const OnigCodePoint CR_In_Number_Forms[] = {
+ 1,
+ 0x2150, 0x218f,
+}; /* CR_In_Number_Forms */
+
+/* 'In_Arrows': Block */
+static const OnigCodePoint CR_In_Arrows[] = {
+ 1,
+ 0x2190, 0x21ff,
+}; /* CR_In_Arrows */
+
+/* 'In_Mathematical_Operators': Block */
+static const OnigCodePoint CR_In_Mathematical_Operators[] = {
+ 1,
+ 0x2200, 0x22ff,
+}; /* CR_In_Mathematical_Operators */
+
+/* 'In_Miscellaneous_Technical': Block */
+static const OnigCodePoint CR_In_Miscellaneous_Technical[] = {
+ 1,
+ 0x2300, 0x23ff,
+}; /* CR_In_Miscellaneous_Technical */
+
+/* 'In_Control_Pictures': Block */
+static const OnigCodePoint CR_In_Control_Pictures[] = {
+ 1,
+ 0x2400, 0x243f,
+}; /* CR_In_Control_Pictures */
+
+/* 'In_Optical_Character_Recognition': Block */
+static const OnigCodePoint CR_In_Optical_Character_Recognition[] = {
+ 1,
+ 0x2440, 0x245f,
+}; /* CR_In_Optical_Character_Recognition */
+
+/* 'In_Enclosed_Alphanumerics': Block */
+static const OnigCodePoint CR_In_Enclosed_Alphanumerics[] = {
+ 1,
+ 0x2460, 0x24ff,
+}; /* CR_In_Enclosed_Alphanumerics */
+
+/* 'In_Box_Drawing': Block */
+static const OnigCodePoint CR_In_Box_Drawing[] = {
+ 1,
+ 0x2500, 0x257f,
+}; /* CR_In_Box_Drawing */
+
+/* 'In_Block_Elements': Block */
+static const OnigCodePoint CR_In_Block_Elements[] = {
+ 1,
+ 0x2580, 0x259f,
+}; /* CR_In_Block_Elements */
+
+/* 'In_Geometric_Shapes': Block */
+static const OnigCodePoint CR_In_Geometric_Shapes[] = {
+ 1,
+ 0x25a0, 0x25ff,
+}; /* CR_In_Geometric_Shapes */
+
+/* 'In_Miscellaneous_Symbols': Block */
+static const OnigCodePoint CR_In_Miscellaneous_Symbols[] = {
+ 1,
+ 0x2600, 0x26ff,
+}; /* CR_In_Miscellaneous_Symbols */
+
+/* 'In_Dingbats': Block */
+static const OnigCodePoint CR_In_Dingbats[] = {
+ 1,
+ 0x2700, 0x27bf,
+}; /* CR_In_Dingbats */
+
+/* 'In_Miscellaneous_Mathematical_Symbols_A': Block */
+static const OnigCodePoint CR_In_Miscellaneous_Mathematical_Symbols_A[] = {
+ 1,
+ 0x27c0, 0x27ef,
+}; /* CR_In_Miscellaneous_Mathematical_Symbols_A */
+
+/* 'In_Supplemental_Arrows_A': Block */
+static const OnigCodePoint CR_In_Supplemental_Arrows_A[] = {
+ 1,
+ 0x27f0, 0x27ff,
+}; /* CR_In_Supplemental_Arrows_A */
+
+/* 'In_Braille_Patterns': Block */
+#define CR_In_Braille_Patterns CR_Braille
+
+/* 'In_Supplemental_Arrows_B': Block */
+static const OnigCodePoint CR_In_Supplemental_Arrows_B[] = {
+ 1,
+ 0x2900, 0x297f,
+}; /* CR_In_Supplemental_Arrows_B */
+
+/* 'In_Miscellaneous_Mathematical_Symbols_B': Block */
+static const OnigCodePoint CR_In_Miscellaneous_Mathematical_Symbols_B[] = {
+ 1,
+ 0x2980, 0x29ff,
+}; /* CR_In_Miscellaneous_Mathematical_Symbols_B */
+
+/* 'In_Supplemental_Mathematical_Operators': Block */
+static const OnigCodePoint CR_In_Supplemental_Mathematical_Operators[] = {
+ 1,
+ 0x2a00, 0x2aff,
+}; /* CR_In_Supplemental_Mathematical_Operators */
+
+/* 'In_Miscellaneous_Symbols_and_Arrows': Block */
+static const OnigCodePoint CR_In_Miscellaneous_Symbols_and_Arrows[] = {
+ 1,
+ 0x2b00, 0x2bff,
+}; /* CR_In_Miscellaneous_Symbols_and_Arrows */
+
+/* 'In_Glagolitic': Block */
+static const OnigCodePoint CR_In_Glagolitic[] = {
+ 1,
+ 0x2c00, 0x2c5f,
+}; /* CR_In_Glagolitic */
+
+/* 'In_Latin_Extended_C': Block */
+static const OnigCodePoint CR_In_Latin_Extended_C[] = {
+ 1,
+ 0x2c60, 0x2c7f,
+}; /* CR_In_Latin_Extended_C */
+
+/* 'In_Coptic': Block */
+static const OnigCodePoint CR_In_Coptic[] = {
+ 1,
+ 0x2c80, 0x2cff,
+}; /* CR_In_Coptic */
+
+/* 'In_Georgian_Supplement': Block */
+static const OnigCodePoint CR_In_Georgian_Supplement[] = {
+ 1,
+ 0x2d00, 0x2d2f,
+}; /* CR_In_Georgian_Supplement */
+
+/* 'In_Tifinagh': Block */
+static const OnigCodePoint CR_In_Tifinagh[] = {
+ 1,
+ 0x2d30, 0x2d7f,
+}; /* CR_In_Tifinagh */
+
+/* 'In_Ethiopic_Extended': Block */
+static const OnigCodePoint CR_In_Ethiopic_Extended[] = {
+ 1,
+ 0x2d80, 0x2ddf,
+}; /* CR_In_Ethiopic_Extended */
+
+/* 'In_Cyrillic_Extended_A': Block */
+static const OnigCodePoint CR_In_Cyrillic_Extended_A[] = {
+ 1,
0x2de0, 0x2dff,
- 0x2e2f, 0x2e2f,
- 0x3005, 0x3007,
- 0x3021, 0x302f,
- 0x3031, 0x3035,
- 0x3038, 0x303c,
- 0x3041, 0x3096,
- 0x3099, 0x309a,
- 0x309d, 0x309f,
- 0x30a1, 0x30fa,
- 0x30fc, 0x30ff,
- 0x3105, 0x312d,
- 0x3131, 0x318e,
- 0x31a0, 0x31ba,
+}; /* CR_In_Cyrillic_Extended_A */
+
+/* 'In_Supplemental_Punctuation': Block */
+static const OnigCodePoint CR_In_Supplemental_Punctuation[] = {
+ 1,
+ 0x2e00, 0x2e7f,
+}; /* CR_In_Supplemental_Punctuation */
+
+/* 'In_CJK_Radicals_Supplement': Block */
+static const OnigCodePoint CR_In_CJK_Radicals_Supplement[] = {
+ 1,
+ 0x2e80, 0x2eff,
+}; /* CR_In_CJK_Radicals_Supplement */
+
+/* 'In_Kangxi_Radicals': Block */
+static const OnigCodePoint CR_In_Kangxi_Radicals[] = {
+ 1,
+ 0x2f00, 0x2fdf,
+}; /* CR_In_Kangxi_Radicals */
+
+/* 'In_Ideographic_Description_Characters': Block */
+static const OnigCodePoint CR_In_Ideographic_Description_Characters[] = {
+ 1,
+ 0x2ff0, 0x2fff,
+}; /* CR_In_Ideographic_Description_Characters */
+
+/* 'In_CJK_Symbols_and_Punctuation': Block */
+static const OnigCodePoint CR_In_CJK_Symbols_and_Punctuation[] = {
+ 1,
+ 0x3000, 0x303f,
+}; /* CR_In_CJK_Symbols_and_Punctuation */
+
+/* 'In_Hiragana': Block */
+static const OnigCodePoint CR_In_Hiragana[] = {
+ 1,
+ 0x3040, 0x309f,
+}; /* CR_In_Hiragana */
+
+/* 'In_Katakana': Block */
+static const OnigCodePoint CR_In_Katakana[] = {
+ 1,
+ 0x30a0, 0x30ff,
+}; /* CR_In_Katakana */
+
+/* 'In_Bopomofo': Block */
+static const OnigCodePoint CR_In_Bopomofo[] = {
+ 1,
+ 0x3100, 0x312f,
+}; /* CR_In_Bopomofo */
+
+/* 'In_Hangul_Compatibility_Jamo': Block */
+static const OnigCodePoint CR_In_Hangul_Compatibility_Jamo[] = {
+ 1,
+ 0x3130, 0x318f,
+}; /* CR_In_Hangul_Compatibility_Jamo */
+
+/* 'In_Kanbun': Block */
+static const OnigCodePoint CR_In_Kanbun[] = {
+ 1,
+ 0x3190, 0x319f,
+}; /* CR_In_Kanbun */
+
+/* 'In_Bopomofo_Extended': Block */
+static const OnigCodePoint CR_In_Bopomofo_Extended[] = {
+ 1,
+ 0x31a0, 0x31bf,
+}; /* CR_In_Bopomofo_Extended */
+
+/* 'In_CJK_Strokes': Block */
+static const OnigCodePoint CR_In_CJK_Strokes[] = {
+ 1,
+ 0x31c0, 0x31ef,
+}; /* CR_In_CJK_Strokes */
+
+/* 'In_Katakana_Phonetic_Extensions': Block */
+static const OnigCodePoint CR_In_Katakana_Phonetic_Extensions[] = {
+ 1,
0x31f0, 0x31ff,
- 0x3400, 0x4db5,
- 0x4e00, 0x9fcb,
- 0xa000, 0xa48c,
- 0xa4d0, 0xa4fd,
- 0xa500, 0xa60c,
- 0xa610, 0xa62b,
- 0xa640, 0xa672,
- 0xa67c, 0xa67d,
- 0xa67f, 0xa697,
- 0xa6a0, 0xa6f1,
- 0xa717, 0xa71f,
- 0xa722, 0xa788,
- 0xa78b, 0xa78e,
- 0xa790, 0xa791,
- 0xa7a0, 0xa7a9,
- 0xa7fa, 0xa827,
- 0xa840, 0xa873,
- 0xa880, 0xa8c4,
- 0xa8d0, 0xa8d9,
- 0xa8e0, 0xa8f7,
- 0xa8fb, 0xa8fb,
- 0xa900, 0xa92d,
- 0xa930, 0xa953,
- 0xa960, 0xa97c,
- 0xa980, 0xa9c0,
- 0xa9cf, 0xa9d9,
- 0xaa00, 0xaa36,
- 0xaa40, 0xaa4d,
- 0xaa50, 0xaa59,
- 0xaa60, 0xaa76,
- 0xaa7a, 0xaa7b,
- 0xaa80, 0xaac2,
- 0xaadb, 0xaadd,
- 0xab01, 0xab06,
- 0xab09, 0xab0e,
- 0xab11, 0xab16,
- 0xab20, 0xab26,
- 0xab28, 0xab2e,
- 0xabc0, 0xabea,
- 0xabec, 0xabed,
- 0xabf0, 0xabf9,
- 0xac00, 0xd7a3,
- 0xd7b0, 0xd7c6,
- 0xd7cb, 0xd7fb,
- 0xf900, 0xfa2d,
- 0xfa30, 0xfa6d,
- 0xfa70, 0xfad9,
- 0xfb00, 0xfb06,
- 0xfb13, 0xfb17,
- 0xfb1d, 0xfb28,
- 0xfb2a, 0xfb36,
- 0xfb38, 0xfb3c,
- 0xfb3e, 0xfb3e,
- 0xfb40, 0xfb41,
- 0xfb43, 0xfb44,
- 0xfb46, 0xfbb1,
- 0xfbd3, 0xfd3d,
- 0xfd50, 0xfd8f,
- 0xfd92, 0xfdc7,
- 0xfdf0, 0xfdfb,
+}; /* CR_In_Katakana_Phonetic_Extensions */
+
+/* 'In_Enclosed_CJK_Letters_and_Months': Block */
+static const OnigCodePoint CR_In_Enclosed_CJK_Letters_and_Months[] = {
+ 1,
+ 0x3200, 0x32ff,
+}; /* CR_In_Enclosed_CJK_Letters_and_Months */
+
+/* 'In_CJK_Compatibility': Block */
+static const OnigCodePoint CR_In_CJK_Compatibility[] = {
+ 1,
+ 0x3300, 0x33ff,
+}; /* CR_In_CJK_Compatibility */
+
+/* 'In_CJK_Unified_Ideographs_Extension_A': Block */
+static const OnigCodePoint CR_In_CJK_Unified_Ideographs_Extension_A[] = {
+ 1,
+ 0x3400, 0x4dbf,
+}; /* CR_In_CJK_Unified_Ideographs_Extension_A */
+
+/* 'In_Yijing_Hexagram_Symbols': Block */
+static const OnigCodePoint CR_In_Yijing_Hexagram_Symbols[] = {
+ 1,
+ 0x4dc0, 0x4dff,
+}; /* CR_In_Yijing_Hexagram_Symbols */
+
+/* 'In_CJK_Unified_Ideographs': Block */
+static const OnigCodePoint CR_In_CJK_Unified_Ideographs[] = {
+ 1,
+ 0x4e00, 0x9fff,
+}; /* CR_In_CJK_Unified_Ideographs */
+
+/* 'In_Yi_Syllables': Block */
+static const OnigCodePoint CR_In_Yi_Syllables[] = {
+ 1,
+ 0xa000, 0xa48f,
+}; /* CR_In_Yi_Syllables */
+
+/* 'In_Yi_Radicals': Block */
+static const OnigCodePoint CR_In_Yi_Radicals[] = {
+ 1,
+ 0xa490, 0xa4cf,
+}; /* CR_In_Yi_Radicals */
+
+/* 'In_Lisu': Block */
+#define CR_In_Lisu CR_Lisu
+
+/* 'In_Vai': Block */
+static const OnigCodePoint CR_In_Vai[] = {
+ 1,
+ 0xa500, 0xa63f,
+}; /* CR_In_Vai */
+
+/* 'In_Cyrillic_Extended_B': Block */
+static const OnigCodePoint CR_In_Cyrillic_Extended_B[] = {
+ 1,
+ 0xa640, 0xa69f,
+}; /* CR_In_Cyrillic_Extended_B */
+
+/* 'In_Bamum': Block */
+static const OnigCodePoint CR_In_Bamum[] = {
+ 1,
+ 0xa6a0, 0xa6ff,
+}; /* CR_In_Bamum */
+
+/* 'In_Modifier_Tone_Letters': Block */
+static const OnigCodePoint CR_In_Modifier_Tone_Letters[] = {
+ 1,
+ 0xa700, 0xa71f,
+}; /* CR_In_Modifier_Tone_Letters */
+
+/* 'In_Latin_Extended_D': Block */
+static const OnigCodePoint CR_In_Latin_Extended_D[] = {
+ 1,
+ 0xa720, 0xa7ff,
+}; /* CR_In_Latin_Extended_D */
+
+/* 'In_Syloti_Nagri': Block */
+static const OnigCodePoint CR_In_Syloti_Nagri[] = {
+ 1,
+ 0xa800, 0xa82f,
+}; /* CR_In_Syloti_Nagri */
+
+/* 'In_Common_Indic_Number_Forms': Block */
+static const OnigCodePoint CR_In_Common_Indic_Number_Forms[] = {
+ 1,
+ 0xa830, 0xa83f,
+}; /* CR_In_Common_Indic_Number_Forms */
+
+/* 'In_Phags_pa': Block */
+static const OnigCodePoint CR_In_Phags_pa[] = {
+ 1,
+ 0xa840, 0xa87f,
+}; /* CR_In_Phags_pa */
+
+/* 'In_Saurashtra': Block */
+static const OnigCodePoint CR_In_Saurashtra[] = {
+ 1,
+ 0xa880, 0xa8df,
+}; /* CR_In_Saurashtra */
+
+/* 'In_Devanagari_Extended': Block */
+static const OnigCodePoint CR_In_Devanagari_Extended[] = {
+ 1,
+ 0xa8e0, 0xa8ff,
+}; /* CR_In_Devanagari_Extended */
+
+/* 'In_Kayah_Li': Block */
+#define CR_In_Kayah_Li CR_Kayah_Li
+
+/* 'In_Rejang': Block */
+static const OnigCodePoint CR_In_Rejang[] = {
+ 1,
+ 0xa930, 0xa95f,
+}; /* CR_In_Rejang */
+
+/* 'In_Hangul_Jamo_Extended_A': Block */
+static const OnigCodePoint CR_In_Hangul_Jamo_Extended_A[] = {
+ 1,
+ 0xa960, 0xa97f,
+}; /* CR_In_Hangul_Jamo_Extended_A */
+
+/* 'In_Javanese': Block */
+static const OnigCodePoint CR_In_Javanese[] = {
+ 1,
+ 0xa980, 0xa9df,
+}; /* CR_In_Javanese */
+
+/* 'In_Cham': Block */
+static const OnigCodePoint CR_In_Cham[] = {
+ 1,
+ 0xaa00, 0xaa5f,
+}; /* CR_In_Cham */
+
+/* 'In_Myanmar_Extended_A': Block */
+static const OnigCodePoint CR_In_Myanmar_Extended_A[] = {
+ 1,
+ 0xaa60, 0xaa7f,
+}; /* CR_In_Myanmar_Extended_A */
+
+/* 'In_Tai_Viet': Block */
+static const OnigCodePoint CR_In_Tai_Viet[] = {
+ 1,
+ 0xaa80, 0xaadf,
+}; /* CR_In_Tai_Viet */
+
+/* 'In_Meetei_Mayek_Extensions': Block */
+static const OnigCodePoint CR_In_Meetei_Mayek_Extensions[] = {
+ 1,
+ 0xaae0, 0xaaff,
+}; /* CR_In_Meetei_Mayek_Extensions */
+
+/* 'In_Ethiopic_Extended_A': Block */
+static const OnigCodePoint CR_In_Ethiopic_Extended_A[] = {
+ 1,
+ 0xab00, 0xab2f,
+}; /* CR_In_Ethiopic_Extended_A */
+
+/* 'In_Meetei_Mayek': Block */
+static const OnigCodePoint CR_In_Meetei_Mayek[] = {
+ 1,
+ 0xabc0, 0xabff,
+}; /* CR_In_Meetei_Mayek */
+
+/* 'In_Hangul_Syllables': Block */
+static const OnigCodePoint CR_In_Hangul_Syllables[] = {
+ 1,
+ 0xac00, 0xd7af,
+}; /* CR_In_Hangul_Syllables */
+
+/* 'In_Hangul_Jamo_Extended_B': Block */
+static const OnigCodePoint CR_In_Hangul_Jamo_Extended_B[] = {
+ 1,
+ 0xd7b0, 0xd7ff,
+}; /* CR_In_Hangul_Jamo_Extended_B */
+
+/* 'In_High_Surrogates': Block */
+static const OnigCodePoint CR_In_High_Surrogates[] = {
+ 1,
+ 0xd800, 0xdb7f,
+}; /* CR_In_High_Surrogates */
+
+/* 'In_High_Private_Use_Surrogates': Block */
+static const OnigCodePoint CR_In_High_Private_Use_Surrogates[] = {
+ 1,
+ 0xdb80, 0xdbff,
+}; /* CR_In_High_Private_Use_Surrogates */
+
+/* 'In_Low_Surrogates': Block */
+static const OnigCodePoint CR_In_Low_Surrogates[] = {
+ 1,
+ 0xdc00, 0xdfff,
+}; /* CR_In_Low_Surrogates */
+
+/* 'In_Private_Use_Area': Block */
+static const OnigCodePoint CR_In_Private_Use_Area[] = {
+ 1,
+ 0xe000, 0xf8ff,
+}; /* CR_In_Private_Use_Area */
+
+/* 'In_CJK_Compatibility_Ideographs': Block */
+static const OnigCodePoint CR_In_CJK_Compatibility_Ideographs[] = {
+ 1,
+ 0xf900, 0xfaff,
+}; /* CR_In_CJK_Compatibility_Ideographs */
+
+/* 'In_Alphabetic_Presentation_Forms': Block */
+static const OnigCodePoint CR_In_Alphabetic_Presentation_Forms[] = {
+ 1,
+ 0xfb00, 0xfb4f,
+}; /* CR_In_Alphabetic_Presentation_Forms */
+
+/* 'In_Arabic_Presentation_Forms_A': Block */
+static const OnigCodePoint CR_In_Arabic_Presentation_Forms_A[] = {
+ 1,
+ 0xfb50, 0xfdff,
+}; /* CR_In_Arabic_Presentation_Forms_A */
+
+/* 'In_Variation_Selectors': Block */
+static const OnigCodePoint CR_In_Variation_Selectors[] = {
+ 1,
0xfe00, 0xfe0f,
- 0xfe20, 0xfe26,
- 0xfe33, 0xfe34,
- 0xfe4d, 0xfe4f,
- 0xfe70, 0xfe74,
- 0xfe76, 0xfefc,
- 0xff10, 0xff19,
- 0xff21, 0xff3a,
- 0xff3f, 0xff3f,
- 0xff41, 0xff5a,
- 0xff66, 0xffbe,
- 0xffc2, 0xffc7,
- 0xffca, 0xffcf,
- 0xffd2, 0xffd7,
- 0xffda, 0xffdc,
- 0x10000, 0x1000b,
- 0x1000d, 0x10026,
- 0x10028, 0x1003a,
- 0x1003c, 0x1003d,
- 0x1003f, 0x1004d,
- 0x10050, 0x1005d,
- 0x10080, 0x100fa,
- 0x10140, 0x10174,
- 0x101fd, 0x101fd,
- 0x10280, 0x1029c,
- 0x102a0, 0x102d0,
- 0x10300, 0x1031e,
- 0x10330, 0x1034a,
- 0x10380, 0x1039d,
- 0x103a0, 0x103c3,
- 0x103c8, 0x103cf,
- 0x103d1, 0x103d5,
- 0x10400, 0x1049d,
- 0x104a0, 0x104a9,
- 0x10800, 0x10805,
- 0x10808, 0x10808,
- 0x1080a, 0x10835,
- 0x10837, 0x10838,
- 0x1083c, 0x1083c,
- 0x1083f, 0x10855,
- 0x10900, 0x10915,
- 0x10920, 0x10939,
- 0x10a00, 0x10a03,
- 0x10a05, 0x10a06,
- 0x10a0c, 0x10a13,
- 0x10a15, 0x10a17,
- 0x10a19, 0x10a33,
- 0x10a38, 0x10a3a,
- 0x10a3f, 0x10a3f,
- 0x10a60, 0x10a7c,
- 0x10b00, 0x10b35,
- 0x10b40, 0x10b55,
- 0x10b60, 0x10b72,
- 0x10c00, 0x10c48,
- 0x11000, 0x11046,
- 0x11066, 0x1106f,
- 0x11080, 0x110ba,
- 0x12000, 0x1236e,
- 0x12400, 0x12462,
- 0x13000, 0x1342e,
- 0x16800, 0x16a38,
- 0x1b000, 0x1b001,
- 0x1d165, 0x1d169,
- 0x1d16d, 0x1d172,
- 0x1d17b, 0x1d182,
- 0x1d185, 0x1d18b,
- 0x1d1aa, 0x1d1ad,
- 0x1d242, 0x1d244,
- 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, 0x1d6c0,
- 0x1d6c2, 0x1d6da,
- 0x1d6dc, 0x1d6fa,
- 0x1d6fc, 0x1d714,
- 0x1d716, 0x1d734,
- 0x1d736, 0x1d74e,
- 0x1d750, 0x1d76e,
- 0x1d770, 0x1d788,
- 0x1d78a, 0x1d7a8,
- 0x1d7aa, 0x1d7c2,
- 0x1d7c4, 0x1d7cb,
- 0x1d7ce, 0x1d7ff,
- 0x20000, 0x2a6d6,
- 0x2a700, 0x2b734,
- 0x2b740, 0x2b81d,
- 0x2f800, 0x2fa1d,
+}; /* CR_In_Variation_Selectors */
+
+/* 'In_Vertical_Forms': Block */
+static const OnigCodePoint CR_In_Vertical_Forms[] = {
+ 1,
+ 0xfe10, 0xfe1f,
+}; /* CR_In_Vertical_Forms */
+
+/* 'In_Combining_Half_Marks': Block */
+static const OnigCodePoint CR_In_Combining_Half_Marks[] = {
+ 1,
+ 0xfe20, 0xfe2f,
+}; /* CR_In_Combining_Half_Marks */
+
+/* 'In_CJK_Compatibility_Forms': Block */
+static const OnigCodePoint CR_In_CJK_Compatibility_Forms[] = {
+ 1,
+ 0xfe30, 0xfe4f,
+}; /* CR_In_CJK_Compatibility_Forms */
+
+/* 'In_Small_Form_Variants': Block */
+static const OnigCodePoint CR_In_Small_Form_Variants[] = {
+ 1,
+ 0xfe50, 0xfe6f,
+}; /* CR_In_Small_Form_Variants */
+
+/* 'In_Arabic_Presentation_Forms_B': Block */
+static const OnigCodePoint CR_In_Arabic_Presentation_Forms_B[] = {
+ 1,
+ 0xfe70, 0xfeff,
+}; /* CR_In_Arabic_Presentation_Forms_B */
+
+/* 'In_Halfwidth_and_Fullwidth_Forms': Block */
+static const OnigCodePoint CR_In_Halfwidth_and_Fullwidth_Forms[] = {
+ 1,
+ 0xff00, 0xffef,
+}; /* CR_In_Halfwidth_and_Fullwidth_Forms */
+
+/* 'In_Specials': Block */
+static const OnigCodePoint CR_In_Specials[] = {
+ 1,
+ 0xfff0, 0xffff,
+}; /* CR_In_Specials */
+
+/* 'In_Linear_B_Syllabary': Block */
+static const OnigCodePoint CR_In_Linear_B_Syllabary[] = {
+ 1,
+ 0x10000, 0x1007f,
+}; /* CR_In_Linear_B_Syllabary */
+
+/* 'In_Linear_B_Ideograms': Block */
+static const OnigCodePoint CR_In_Linear_B_Ideograms[] = {
+ 1,
+ 0x10080, 0x100ff,
+}; /* CR_In_Linear_B_Ideograms */
+
+/* 'In_Aegean_Numbers': Block */
+static const OnigCodePoint CR_In_Aegean_Numbers[] = {
+ 1,
+ 0x10100, 0x1013f,
+}; /* CR_In_Aegean_Numbers */
+
+/* 'In_Ancient_Greek_Numbers': Block */
+static const OnigCodePoint CR_In_Ancient_Greek_Numbers[] = {
+ 1,
+ 0x10140, 0x1018f,
+}; /* CR_In_Ancient_Greek_Numbers */
+
+/* 'In_Ancient_Symbols': Block */
+static const OnigCodePoint CR_In_Ancient_Symbols[] = {
+ 1,
+ 0x10190, 0x101cf,
+}; /* CR_In_Ancient_Symbols */
+
+/* 'In_Phaistos_Disc': Block */
+static const OnigCodePoint CR_In_Phaistos_Disc[] = {
+ 1,
+ 0x101d0, 0x101ff,
+}; /* CR_In_Phaistos_Disc */
+
+/* 'In_Lycian': Block */
+static const OnigCodePoint CR_In_Lycian[] = {
+ 1,
+ 0x10280, 0x1029f,
+}; /* CR_In_Lycian */
+
+/* 'In_Carian': Block */
+static const OnigCodePoint CR_In_Carian[] = {
+ 1,
+ 0x102a0, 0x102df,
+}; /* CR_In_Carian */
+
+/* 'In_Old_Italic': Block */
+static const OnigCodePoint CR_In_Old_Italic[] = {
+ 1,
+ 0x10300, 0x1032f,
+}; /* CR_In_Old_Italic */
+
+/* 'In_Gothic': Block */
+static const OnigCodePoint CR_In_Gothic[] = {
+ 1,
+ 0x10330, 0x1034f,
+}; /* CR_In_Gothic */
+
+/* 'In_Ugaritic': Block */
+static const OnigCodePoint CR_In_Ugaritic[] = {
+ 1,
+ 0x10380, 0x1039f,
+}; /* CR_In_Ugaritic */
+
+/* 'In_Old_Persian': Block */
+static const OnigCodePoint CR_In_Old_Persian[] = {
+ 1,
+ 0x103a0, 0x103df,
+}; /* CR_In_Old_Persian */
+
+/* 'In_Deseret': Block */
+#define CR_In_Deseret CR_Deseret
+
+/* 'In_Shavian': Block */
+#define CR_In_Shavian CR_Shavian
+
+/* 'In_Osmanya': Block */
+static const OnigCodePoint CR_In_Osmanya[] = {
+ 1,
+ 0x10480, 0x104af,
+}; /* CR_In_Osmanya */
+
+/* 'In_Cypriot_Syllabary': Block */
+static const OnigCodePoint CR_In_Cypriot_Syllabary[] = {
+ 1,
+ 0x10800, 0x1083f,
+}; /* CR_In_Cypriot_Syllabary */
+
+/* 'In_Imperial_Aramaic': Block */
+static const OnigCodePoint CR_In_Imperial_Aramaic[] = {
+ 1,
+ 0x10840, 0x1085f,
+}; /* CR_In_Imperial_Aramaic */
+
+/* 'In_Phoenician': Block */
+static const OnigCodePoint CR_In_Phoenician[] = {
+ 1,
+ 0x10900, 0x1091f,
+}; /* CR_In_Phoenician */
+
+/* 'In_Lydian': Block */
+static const OnigCodePoint CR_In_Lydian[] = {
+ 1,
+ 0x10920, 0x1093f,
+}; /* CR_In_Lydian */
+
+/* 'In_Meroitic_Hieroglyphs': Block */
+#define CR_In_Meroitic_Hieroglyphs CR_Meroitic_Hieroglyphs
+
+/* 'In_Meroitic_Cursive': Block */
+static const OnigCodePoint CR_In_Meroitic_Cursive[] = {
+ 1,
+ 0x109a0, 0x109ff,
+}; /* CR_In_Meroitic_Cursive */
+
+/* 'In_Kharoshthi': Block */
+static const OnigCodePoint CR_In_Kharoshthi[] = {
+ 1,
+ 0x10a00, 0x10a5f,
+}; /* CR_In_Kharoshthi */
+
+/* 'In_Old_South_Arabian': Block */
+#define CR_In_Old_South_Arabian CR_Old_South_Arabian
+
+/* 'In_Avestan': Block */
+static const OnigCodePoint CR_In_Avestan[] = {
+ 1,
+ 0x10b00, 0x10b3f,
+}; /* CR_In_Avestan */
+
+/* 'In_Inscriptional_Parthian': Block */
+static const OnigCodePoint CR_In_Inscriptional_Parthian[] = {
+ 1,
+ 0x10b40, 0x10b5f,
+}; /* CR_In_Inscriptional_Parthian */
+
+/* 'In_Inscriptional_Pahlavi': Block */
+static const OnigCodePoint CR_In_Inscriptional_Pahlavi[] = {
+ 1,
+ 0x10b60, 0x10b7f,
+}; /* CR_In_Inscriptional_Pahlavi */
+
+/* 'In_Old_Turkic': Block */
+static const OnigCodePoint CR_In_Old_Turkic[] = {
+ 1,
+ 0x10c00, 0x10c4f,
+}; /* CR_In_Old_Turkic */
+
+/* 'In_Rumi_Numeral_Symbols': Block */
+static const OnigCodePoint CR_In_Rumi_Numeral_Symbols[] = {
+ 1,
+ 0x10e60, 0x10e7f,
+}; /* CR_In_Rumi_Numeral_Symbols */
+
+/* 'In_Brahmi': Block */
+static const OnigCodePoint CR_In_Brahmi[] = {
+ 1,
+ 0x11000, 0x1107f,
+}; /* CR_In_Brahmi */
+
+/* 'In_Kaithi': Block */
+static const OnigCodePoint CR_In_Kaithi[] = {
+ 1,
+ 0x11080, 0x110cf,
+}; /* CR_In_Kaithi */
+
+/* 'In_Sora_Sompeng': Block */
+static const OnigCodePoint CR_In_Sora_Sompeng[] = {
+ 1,
+ 0x110d0, 0x110ff,
+}; /* CR_In_Sora_Sompeng */
+
+/* 'In_Chakma': Block */
+static const OnigCodePoint CR_In_Chakma[] = {
+ 1,
+ 0x11100, 0x1114f,
+}; /* CR_In_Chakma */
+
+/* 'In_Sharada': Block */
+static const OnigCodePoint CR_In_Sharada[] = {
+ 1,
+ 0x11180, 0x111df,
+}; /* CR_In_Sharada */
+
+/* 'In_Takri': Block */
+static const OnigCodePoint CR_In_Takri[] = {
+ 1,
+ 0x11680, 0x116cf,
+}; /* CR_In_Takri */
+
+/* 'In_Cuneiform': Block */
+static const OnigCodePoint CR_In_Cuneiform[] = {
+ 1,
+ 0x12000, 0x123ff,
+}; /* CR_In_Cuneiform */
+
+/* 'In_Cuneiform_Numbers_and_Punctuation': Block */
+static const OnigCodePoint CR_In_Cuneiform_Numbers_and_Punctuation[] = {
+ 1,
+ 0x12400, 0x1247f,
+}; /* CR_In_Cuneiform_Numbers_and_Punctuation */
+
+/* 'In_Egyptian_Hieroglyphs': Block */
+static const OnigCodePoint CR_In_Egyptian_Hieroglyphs[] = {
+ 1,
+ 0x13000, 0x1342f,
+}; /* CR_In_Egyptian_Hieroglyphs */
+
+/* 'In_Bamum_Supplement': Block */
+static const OnigCodePoint CR_In_Bamum_Supplement[] = {
+ 1,
+ 0x16800, 0x16a3f,
+}; /* CR_In_Bamum_Supplement */
+
+/* 'In_Miao': Block */
+static const OnigCodePoint CR_In_Miao[] = {
+ 1,
+ 0x16f00, 0x16f9f,
+}; /* CR_In_Miao */
+
+/* 'In_Kana_Supplement': Block */
+static const OnigCodePoint CR_In_Kana_Supplement[] = {
+ 1,
+ 0x1b000, 0x1b0ff,
+}; /* CR_In_Kana_Supplement */
+
+/* 'In_Byzantine_Musical_Symbols': Block */
+static const OnigCodePoint CR_In_Byzantine_Musical_Symbols[] = {
+ 1,
+ 0x1d000, 0x1d0ff,
+}; /* CR_In_Byzantine_Musical_Symbols */
+
+/* 'In_Musical_Symbols': Block */
+static const OnigCodePoint CR_In_Musical_Symbols[] = {
+ 1,
+ 0x1d100, 0x1d1ff,
+}; /* CR_In_Musical_Symbols */
+
+/* 'In_Ancient_Greek_Musical_Notation': Block */
+static const OnigCodePoint CR_In_Ancient_Greek_Musical_Notation[] = {
+ 1,
+ 0x1d200, 0x1d24f,
+}; /* CR_In_Ancient_Greek_Musical_Notation */
+
+/* 'In_Tai_Xuan_Jing_Symbols': Block */
+static const OnigCodePoint CR_In_Tai_Xuan_Jing_Symbols[] = {
+ 1,
+ 0x1d300, 0x1d35f,
+}; /* CR_In_Tai_Xuan_Jing_Symbols */
+
+/* 'In_Counting_Rod_Numerals': Block */
+static const OnigCodePoint CR_In_Counting_Rod_Numerals[] = {
+ 1,
+ 0x1d360, 0x1d37f,
+}; /* CR_In_Counting_Rod_Numerals */
+
+/* 'In_Mathematical_Alphanumeric_Symbols': Block */
+static const OnigCodePoint CR_In_Mathematical_Alphanumeric_Symbols[] = {
+ 1,
+ 0x1d400, 0x1d7ff,
+}; /* CR_In_Mathematical_Alphanumeric_Symbols */
+
+/* 'In_Arabic_Mathematical_Alphabetic_Symbols': Block */
+static const OnigCodePoint CR_In_Arabic_Mathematical_Alphabetic_Symbols[] = {
+ 1,
+ 0x1ee00, 0x1eeff,
+}; /* CR_In_Arabic_Mathematical_Alphabetic_Symbols */
+
+/* 'In_Mahjong_Tiles': Block */
+static const OnigCodePoint CR_In_Mahjong_Tiles[] = {
+ 1,
+ 0x1f000, 0x1f02f,
+}; /* CR_In_Mahjong_Tiles */
+
+/* 'In_Domino_Tiles': Block */
+static const OnigCodePoint CR_In_Domino_Tiles[] = {
+ 1,
+ 0x1f030, 0x1f09f,
+}; /* CR_In_Domino_Tiles */
+
+/* 'In_Playing_Cards': Block */
+static const OnigCodePoint CR_In_Playing_Cards[] = {
+ 1,
+ 0x1f0a0, 0x1f0ff,
+}; /* CR_In_Playing_Cards */
+
+/* 'In_Enclosed_Alphanumeric_Supplement': Block */
+static const OnigCodePoint CR_In_Enclosed_Alphanumeric_Supplement[] = {
+ 1,
+ 0x1f100, 0x1f1ff,
+}; /* CR_In_Enclosed_Alphanumeric_Supplement */
+
+/* 'In_Enclosed_Ideographic_Supplement': Block */
+static const OnigCodePoint CR_In_Enclosed_Ideographic_Supplement[] = {
+ 1,
+ 0x1f200, 0x1f2ff,
+}; /* CR_In_Enclosed_Ideographic_Supplement */
+
+/* 'In_Miscellaneous_Symbols_And_Pictographs': Block */
+static const OnigCodePoint CR_In_Miscellaneous_Symbols_And_Pictographs[] = {
+ 1,
+ 0x1f300, 0x1f5ff,
+}; /* CR_In_Miscellaneous_Symbols_And_Pictographs */
+
+/* 'In_Emoticons': Block */
+static const OnigCodePoint CR_In_Emoticons[] = {
+ 1,
+ 0x1f600, 0x1f64f,
+}; /* CR_In_Emoticons */
+
+/* 'In_Transport_And_Map_Symbols': Block */
+static const OnigCodePoint CR_In_Transport_And_Map_Symbols[] = {
+ 1,
+ 0x1f680, 0x1f6ff,
+}; /* CR_In_Transport_And_Map_Symbols */
+
+/* 'In_Alchemical_Symbols': Block */
+static const OnigCodePoint CR_In_Alchemical_Symbols[] = {
+ 1,
+ 0x1f700, 0x1f77f,
+}; /* CR_In_Alchemical_Symbols */
+
+/* 'In_CJK_Unified_Ideographs_Extension_B': Block */
+static const OnigCodePoint CR_In_CJK_Unified_Ideographs_Extension_B[] = {
+ 1,
+ 0x20000, 0x2a6df,
+}; /* CR_In_CJK_Unified_Ideographs_Extension_B */
+
+/* 'In_CJK_Unified_Ideographs_Extension_C': Block */
+static const OnigCodePoint CR_In_CJK_Unified_Ideographs_Extension_C[] = {
+ 1,
+ 0x2a700, 0x2b73f,
+}; /* CR_In_CJK_Unified_Ideographs_Extension_C */
+
+/* 'In_CJK_Unified_Ideographs_Extension_D': Block */
+static const OnigCodePoint CR_In_CJK_Unified_Ideographs_Extension_D[] = {
+ 1,
+ 0x2b740, 0x2b81f,
+}; /* CR_In_CJK_Unified_Ideographs_Extension_D */
+
+/* 'In_CJK_Compatibility_Ideographs_Supplement': Block */
+static const OnigCodePoint CR_In_CJK_Compatibility_Ideographs_Supplement[] = {
+ 1,
+ 0x2f800, 0x2fa1f,
+}; /* CR_In_CJK_Compatibility_Ideographs_Supplement */
+
+/* 'In_Tags': Block */
+static const OnigCodePoint CR_In_Tags[] = {
+ 1,
+ 0xe0000, 0xe007f,
+}; /* CR_In_Tags */
+
+/* 'In_Variation_Selectors_Supplement': Block */
+static const OnigCodePoint CR_In_Variation_Selectors_Supplement[] = {
+ 1,
0xe0100, 0xe01ef,
-}; /* CR_Word */
+}; /* CR_In_Variation_Selectors_Supplement */
-/* 'Alnum': [[:Alnum:]] */
-static const OnigCodePoint CR_Alnum[] = {
- 509,
- 0x0030, 0x0039,
- 0x0041, 0x005a,
- 0x0061, 0x007a,
- 0x00aa, 0x00aa,
- 0x00b5, 0x00b5,
- 0x00ba, 0x00ba,
- 0x00c0, 0x00d6,
- 0x00d8, 0x00f6,
- 0x00f8, 0x02c1,
- 0x02c6, 0x02d1,
- 0x02e0, 0x02e4,
- 0x02ec, 0x02ec,
- 0x02ee, 0x02ee,
- 0x0345, 0x0345,
- 0x0370, 0x0374,
- 0x0376, 0x0377,
- 0x037a, 0x037d,
- 0x0386, 0x0386,
- 0x0388, 0x038a,
- 0x038c, 0x038c,
- 0x038e, 0x03a1,
- 0x03a3, 0x03f5,
- 0x03f7, 0x0481,
- 0x048a, 0x0527,
- 0x0531, 0x0556,
- 0x0559, 0x0559,
- 0x0561, 0x0587,
- 0x05b0, 0x05bd,
- 0x05bf, 0x05bf,
- 0x05c1, 0x05c2,
- 0x05c4, 0x05c5,
- 0x05c7, 0x05c7,
- 0x05d0, 0x05ea,
- 0x05f0, 0x05f2,
- 0x0610, 0x061a,
- 0x0620, 0x0657,
- 0x0659, 0x0669,
- 0x066e, 0x06d3,
- 0x06d5, 0x06dc,
- 0x06e1, 0x06e8,
- 0x06ed, 0x06fc,
- 0x06ff, 0x06ff,
- 0x0710, 0x073f,
- 0x074d, 0x07b1,
- 0x07c0, 0x07ea,
- 0x07f4, 0x07f5,
- 0x07fa, 0x07fa,
- 0x0800, 0x0817,
- 0x081a, 0x082c,
- 0x0840, 0x0858,
- 0x0900, 0x093b,
- 0x093d, 0x094c,
- 0x094e, 0x0950,
- 0x0955, 0x0963,
- 0x0966, 0x096f,
- 0x0971, 0x0977,
- 0x0979, 0x097f,
- 0x0981, 0x0983,
- 0x0985, 0x098c,
- 0x098f, 0x0990,
- 0x0993, 0x09a8,
- 0x09aa, 0x09b0,
- 0x09b2, 0x09b2,
- 0x09b6, 0x09b9,
- 0x09bd, 0x09c4,
- 0x09c7, 0x09c8,
- 0x09cb, 0x09cc,
- 0x09ce, 0x09ce,
- 0x09d7, 0x09d7,
- 0x09dc, 0x09dd,
- 0x09df, 0x09e3,
- 0x09e6, 0x09f1,
- 0x0a01, 0x0a03,
- 0x0a05, 0x0a0a,
- 0x0a0f, 0x0a10,
- 0x0a13, 0x0a28,
- 0x0a2a, 0x0a30,
- 0x0a32, 0x0a33,
- 0x0a35, 0x0a36,
- 0x0a38, 0x0a39,
- 0x0a3e, 0x0a42,
- 0x0a47, 0x0a48,
- 0x0a4b, 0x0a4c,
- 0x0a51, 0x0a51,
- 0x0a59, 0x0a5c,
- 0x0a5e, 0x0a5e,
- 0x0a66, 0x0a75,
- 0x0a81, 0x0a83,
- 0x0a85, 0x0a8d,
- 0x0a8f, 0x0a91,
- 0x0a93, 0x0aa8,
- 0x0aaa, 0x0ab0,
- 0x0ab2, 0x0ab3,
- 0x0ab5, 0x0ab9,
- 0x0abd, 0x0ac5,
- 0x0ac7, 0x0ac9,
- 0x0acb, 0x0acc,
- 0x0ad0, 0x0ad0,
- 0x0ae0, 0x0ae3,
- 0x0ae6, 0x0aef,
- 0x0b01, 0x0b03,
- 0x0b05, 0x0b0c,
- 0x0b0f, 0x0b10,
- 0x0b13, 0x0b28,
- 0x0b2a, 0x0b30,
- 0x0b32, 0x0b33,
- 0x0b35, 0x0b39,
- 0x0b3d, 0x0b44,
- 0x0b47, 0x0b48,
- 0x0b4b, 0x0b4c,
- 0x0b56, 0x0b57,
- 0x0b5c, 0x0b5d,
- 0x0b5f, 0x0b63,
- 0x0b66, 0x0b6f,
- 0x0b71, 0x0b71,
- 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, 0x0bcc,
- 0x0bd0, 0x0bd0,
- 0x0bd7, 0x0bd7,
- 0x0be6, 0x0bef,
- 0x0c01, 0x0c03,
- 0x0c05, 0x0c0c,
- 0x0c0e, 0x0c10,
- 0x0c12, 0x0c28,
- 0x0c2a, 0x0c33,
- 0x0c35, 0x0c39,
- 0x0c3d, 0x0c44,
- 0x0c46, 0x0c48,
- 0x0c4a, 0x0c4c,
- 0x0c55, 0x0c56,
- 0x0c58, 0x0c59,
- 0x0c60, 0x0c63,
- 0x0c66, 0x0c6f,
- 0x0c82, 0x0c83,
- 0x0c85, 0x0c8c,
- 0x0c8e, 0x0c90,
- 0x0c92, 0x0ca8,
- 0x0caa, 0x0cb3,
- 0x0cb5, 0x0cb9,
- 0x0cbd, 0x0cc4,
- 0x0cc6, 0x0cc8,
- 0x0cca, 0x0ccc,
- 0x0cd5, 0x0cd6,
- 0x0cde, 0x0cde,
- 0x0ce0, 0x0ce3,
- 0x0ce6, 0x0cef,
- 0x0cf1, 0x0cf2,
- 0x0d02, 0x0d03,
- 0x0d05, 0x0d0c,
- 0x0d0e, 0x0d10,
- 0x0d12, 0x0d3a,
- 0x0d3d, 0x0d44,
- 0x0d46, 0x0d48,
- 0x0d4a, 0x0d4c,
- 0x0d4e, 0x0d4e,
- 0x0d57, 0x0d57,
- 0x0d60, 0x0d63,
- 0x0d66, 0x0d6f,
- 0x0d7a, 0x0d7f,
- 0x0d82, 0x0d83,
- 0x0d85, 0x0d96,
- 0x0d9a, 0x0db1,
- 0x0db3, 0x0dbb,
- 0x0dbd, 0x0dbd,
- 0x0dc0, 0x0dc6,
- 0x0dcf, 0x0dd4,
- 0x0dd6, 0x0dd6,
- 0x0dd8, 0x0ddf,
- 0x0df2, 0x0df3,
- 0x0e01, 0x0e3a,
- 0x0e40, 0x0e46,
- 0x0e4d, 0x0e4d,
- 0x0e50, 0x0e59,
- 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,
- 0x0ecd, 0x0ecd,
- 0x0ed0, 0x0ed9,
- 0x0edc, 0x0edd,
- 0x0f00, 0x0f00,
- 0x0f20, 0x0f29,
- 0x0f40, 0x0f47,
- 0x0f49, 0x0f6c,
- 0x0f71, 0x0f81,
- 0x0f88, 0x0f97,
- 0x0f99, 0x0fbc,
- 0x1000, 0x1036,
- 0x1038, 0x1038,
- 0x103b, 0x1049,
- 0x1050, 0x1062,
- 0x1065, 0x1068,
- 0x106e, 0x1086,
- 0x108e, 0x108e,
- 0x1090, 0x1099,
- 0x109c, 0x109d,
- 0x10a0, 0x10c5,
- 0x10d0, 0x10fa,
- 0x10fc, 0x10fc,
- 0x1100, 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,
- 0x135f, 0x135f,
- 0x1380, 0x138f,
- 0x13a0, 0x13f4,
- 0x1401, 0x166c,
- 0x166f, 0x167f,
- 0x1681, 0x169a,
- 0x16a0, 0x16ea,
- 0x16ee, 0x16f0,
- 0x1700, 0x170c,
- 0x170e, 0x1713,
- 0x1720, 0x1733,
- 0x1740, 0x1753,
- 0x1760, 0x176c,
- 0x176e, 0x1770,
- 0x1772, 0x1773,
- 0x1780, 0x17b3,
- 0x17b6, 0x17c8,
- 0x17d7, 0x17d7,
- 0x17dc, 0x17dc,
- 0x17e0, 0x17e9,
- 0x1810, 0x1819,
- 0x1820, 0x1877,
- 0x1880, 0x18aa,
- 0x18b0, 0x18f5,
- 0x1900, 0x191c,
- 0x1920, 0x192b,
- 0x1930, 0x1938,
- 0x1946, 0x196d,
- 0x1970, 0x1974,
- 0x1980, 0x19ab,
- 0x19b0, 0x19c9,
- 0x19d0, 0x19d9,
- 0x1a00, 0x1a1b,
- 0x1a20, 0x1a5e,
- 0x1a61, 0x1a74,
- 0x1a80, 0x1a89,
- 0x1a90, 0x1a99,
- 0x1aa7, 0x1aa7,
- 0x1b00, 0x1b33,
- 0x1b35, 0x1b43,
- 0x1b45, 0x1b4b,
- 0x1b50, 0x1b59,
- 0x1b80, 0x1ba9,
- 0x1bae, 0x1bb9,
- 0x1bc0, 0x1be5,
- 0x1be7, 0x1bf1,
- 0x1c00, 0x1c35,
- 0x1c40, 0x1c49,
- 0x1c4d, 0x1c7d,
- 0x1ce9, 0x1cec,
- 0x1cee, 0x1cf2,
- 0x1d00, 0x1dbf,
- 0x1e00, 0x1f15,
- 0x1f18, 0x1f1d,
- 0x1f20, 0x1f45,
- 0x1f48, 0x1f4d,
- 0x1f50, 0x1f57,
- 0x1f59, 0x1f59,
- 0x1f5b, 0x1f5b,
- 0x1f5d, 0x1f5d,
- 0x1f5f, 0x1f7d,
- 0x1f80, 0x1fb4,
- 0x1fb6, 0x1fbc,
- 0x1fbe, 0x1fbe,
- 0x1fc2, 0x1fc4,
- 0x1fc6, 0x1fcc,
- 0x1fd0, 0x1fd3,
- 0x1fd6, 0x1fdb,
- 0x1fe0, 0x1fec,
- 0x1ff2, 0x1ff4,
- 0x1ff6, 0x1ffc,
- 0x2071, 0x2071,
- 0x207f, 0x207f,
- 0x2090, 0x209c,
- 0x2102, 0x2102,
- 0x2107, 0x2107,
- 0x210a, 0x2113,
- 0x2115, 0x2115,
- 0x2119, 0x211d,
- 0x2124, 0x2124,
- 0x2126, 0x2126,
- 0x2128, 0x2128,
- 0x212a, 0x212d,
- 0x212f, 0x2139,
- 0x213c, 0x213f,
- 0x2145, 0x2149,
- 0x214e, 0x214e,
- 0x2160, 0x2188,
- 0x24b6, 0x24e9,
- 0x2c00, 0x2c2e,
- 0x2c30, 0x2c5e,
- 0x2c60, 0x2ce4,
- 0x2ceb, 0x2cee,
- 0x2d00, 0x2d25,
- 0x2d30, 0x2d65,
- 0x2d6f, 0x2d6f,
- 0x2d80, 0x2d96,
- 0x2da0, 0x2da6,
- 0x2da8, 0x2dae,
- 0x2db0, 0x2db6,
- 0x2db8, 0x2dbe,
- 0x2dc0, 0x2dc6,
- 0x2dc8, 0x2dce,
- 0x2dd0, 0x2dd6,
- 0x2dd8, 0x2dde,
- 0x2de0, 0x2dff,
- 0x2e2f, 0x2e2f,
- 0x3005, 0x3007,
- 0x3021, 0x3029,
- 0x3031, 0x3035,
- 0x3038, 0x303c,
- 0x3041, 0x3096,
- 0x309d, 0x309f,
- 0x30a1, 0x30fa,
- 0x30fc, 0x30ff,
- 0x3105, 0x312d,
- 0x3131, 0x318e,
- 0x31a0, 0x31ba,
- 0x31f0, 0x31ff,
- 0x3400, 0x4db5,
- 0x4e00, 0x9fcb,
- 0xa000, 0xa48c,
- 0xa4d0, 0xa4fd,
- 0xa500, 0xa60c,
- 0xa610, 0xa62b,
- 0xa640, 0xa66e,
- 0xa67f, 0xa697,
- 0xa6a0, 0xa6ef,
- 0xa717, 0xa71f,
- 0xa722, 0xa788,
- 0xa78b, 0xa78e,
- 0xa790, 0xa791,
- 0xa7a0, 0xa7a9,
- 0xa7fa, 0xa801,
- 0xa803, 0xa805,
- 0xa807, 0xa80a,
- 0xa80c, 0xa827,
- 0xa840, 0xa873,
- 0xa880, 0xa8c3,
- 0xa8d0, 0xa8d9,
- 0xa8f2, 0xa8f7,
- 0xa8fb, 0xa8fb,
- 0xa900, 0xa92a,
- 0xa930, 0xa952,
- 0xa960, 0xa97c,
- 0xa980, 0xa9b2,
- 0xa9b4, 0xa9bf,
- 0xa9cf, 0xa9d9,
- 0xaa00, 0xaa36,
- 0xaa40, 0xaa4d,
- 0xaa50, 0xaa59,
- 0xaa60, 0xaa76,
- 0xaa7a, 0xaa7a,
- 0xaa80, 0xaabe,
- 0xaac0, 0xaac0,
- 0xaac2, 0xaac2,
- 0xaadb, 0xaadd,
- 0xab01, 0xab06,
- 0xab09, 0xab0e,
- 0xab11, 0xab16,
- 0xab20, 0xab26,
- 0xab28, 0xab2e,
- 0xabc0, 0xabea,
- 0xabf0, 0xabf9,
- 0xac00, 0xd7a3,
- 0xd7b0, 0xd7c6,
- 0xd7cb, 0xd7fb,
- 0xf900, 0xfa2d,
- 0xfa30, 0xfa6d,
- 0xfa70, 0xfad9,
- 0xfb00, 0xfb06,
- 0xfb13, 0xfb17,
- 0xfb1d, 0xfb28,
- 0xfb2a, 0xfb36,
- 0xfb38, 0xfb3c,
- 0xfb3e, 0xfb3e,
- 0xfb40, 0xfb41,
- 0xfb43, 0xfb44,
- 0xfb46, 0xfbb1,
- 0xfbd3, 0xfd3d,
- 0xfd50, 0xfd8f,
- 0xfd92, 0xfdc7,
- 0xfdf0, 0xfdfb,
- 0xfe70, 0xfe74,
- 0xfe76, 0xfefc,
- 0xff10, 0xff19,
- 0xff21, 0xff3a,
- 0xff41, 0xff5a,
- 0xff66, 0xffbe,
- 0xffc2, 0xffc7,
- 0xffca, 0xffcf,
- 0xffd2, 0xffd7,
- 0xffda, 0xffdc,
- 0x10000, 0x1000b,
- 0x1000d, 0x10026,
- 0x10028, 0x1003a,
- 0x1003c, 0x1003d,
- 0x1003f, 0x1004d,
- 0x10050, 0x1005d,
- 0x10080, 0x100fa,
- 0x10140, 0x10174,
- 0x10280, 0x1029c,
- 0x102a0, 0x102d0,
- 0x10300, 0x1031e,
- 0x10330, 0x1034a,
- 0x10380, 0x1039d,
- 0x103a0, 0x103c3,
- 0x103c8, 0x103cf,
- 0x103d1, 0x103d5,
- 0x10400, 0x1049d,
- 0x104a0, 0x104a9,
- 0x10800, 0x10805,
- 0x10808, 0x10808,
- 0x1080a, 0x10835,
- 0x10837, 0x10838,
- 0x1083c, 0x1083c,
- 0x1083f, 0x10855,
- 0x10900, 0x10915,
- 0x10920, 0x10939,
- 0x10a00, 0x10a03,
- 0x10a05, 0x10a06,
- 0x10a0c, 0x10a13,
- 0x10a15, 0x10a17,
- 0x10a19, 0x10a33,
- 0x10a60, 0x10a7c,
- 0x10b00, 0x10b35,
- 0x10b40, 0x10b55,
- 0x10b60, 0x10b72,
- 0x10c00, 0x10c48,
- 0x11000, 0x11045,
- 0x11066, 0x1106f,
- 0x11082, 0x110b8,
- 0x12000, 0x1236e,
- 0x12400, 0x12462,
- 0x13000, 0x1342e,
- 0x16800, 0x16a38,
- 0x1b000, 0x1b001,
- 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, 0x1d6c0,
- 0x1d6c2, 0x1d6da,
- 0x1d6dc, 0x1d6fa,
- 0x1d6fc, 0x1d714,
- 0x1d716, 0x1d734,
- 0x1d736, 0x1d74e,
- 0x1d750, 0x1d76e,
- 0x1d770, 0x1d788,
- 0x1d78a, 0x1d7a8,
- 0x1d7aa, 0x1d7c2,
- 0x1d7c4, 0x1d7cb,
- 0x1d7ce, 0x1d7ff,
- 0x20000, 0x2a6d6,
- 0x2a700, 0x2b734,
- 0x2b740, 0x2b81d,
- 0x2f800, 0x2fa1d,
-}; /* CR_Alnum */
+/* 'In_Supplementary_Private_Use_Area_A': Block */
+static const OnigCodePoint CR_In_Supplementary_Private_Use_Area_A[] = {
+ 1,
+ 0xf0000, 0xfffff,
+}; /* CR_In_Supplementary_Private_Use_Area_A */
-/* 'ASCII': [[:ASCII:]] */
-static const OnigCodePoint CR_ASCII[] = {
+/* 'In_Supplementary_Private_Use_Area_B': Block */
+static const OnigCodePoint CR_In_Supplementary_Private_Use_Area_B[] = {
1,
- 0x0000, 0x007f,
-}; /* CR_ASCII */
+ 0x100000, 0x10ffff,
+}; /* CR_In_Supplementary_Private_Use_Area_B */
+
+/* 'In_No_Block': Block */
+static const OnigCodePoint CR_In_No_Block[] = {
+ 36,
+ 0x0860, 0x089f,
+ 0x1ab0, 0x1aff,
+ 0x1c80, 0x1cbf,
+ 0x2fe0, 0x2fef,
+ 0xa9e0, 0xa9ff,
+ 0xab30, 0xabbf,
+ 0x10200, 0x1027f,
+ 0x102e0, 0x102ff,
+ 0x10350, 0x1037f,
+ 0x103e0, 0x103ff,
+ 0x104b0, 0x107ff,
+ 0x10860, 0x108ff,
+ 0x10940, 0x1097f,
+ 0x10a80, 0x10aff,
+ 0x10b80, 0x10bff,
+ 0x10c50, 0x10e5f,
+ 0x10e80, 0x10fff,
+ 0x11150, 0x1117f,
+ 0x111e0, 0x1167f,
+ 0x116d0, 0x11fff,
+ 0x12480, 0x12fff,
+ 0x13430, 0x167ff,
+ 0x16a40, 0x16eff,
+ 0x16fa0, 0x1afff,
+ 0x1b100, 0x1cfff,
+ 0x1d250, 0x1d2ff,
+ 0x1d380, 0x1d3ff,
+ 0x1d800, 0x1edff,
+ 0x1ef00, 0x1efff,
+ 0x1f650, 0x1f67f,
+ 0x1f780, 0x1ffff,
+ 0x2a6e0, 0x2a6ff,
+ 0x2b820, 0x2f7ff,
+ 0x2fa20, 0xdffff,
+ 0xe0080, 0xe00ff,
+ 0xe01f0, 0xeffff,
+}; /* CR_In_No_Block */
+#endif /* USE_UNICODE_PROPERTIES */
static const OnigCodePoint* const CodeRanges[] = {
CR_NEWLINE,
@@ -21973,7 +25510,6 @@ static const OnigCodePoint* const CodeRanges[] = {
CR_Alnum,
CR_ASCII,
#ifdef USE_UNICODE_PROPERTIES
-#ifdef USE_UNICODE_PROPERTIES
CR_Any,
CR_Assigned,
CR_C,
@@ -21983,6 +25519,7 @@ static const OnigCodePoint* const CodeRanges[] = {
CR_Co,
CR_Cs,
CR_L,
+ CR_LC,
CR_Ll,
CR_Lm,
CR_Lo,
@@ -22127,6 +25664,13 @@ static const OnigCodePoint* const CodeRanges[] = {
CR_Batak,
CR_Brahmi,
CR_Mandaic,
+ CR_Chakma,
+ CR_Meroitic_Cursive,
+ CR_Meroitic_Hieroglyphs,
+ CR_Miao,
+ CR_Sharada,
+ CR_Sora_Sompeng,
+ CR_Takri,
CR_White_Space,
CR_Bidi_Control,
CR_Join_Control,
@@ -22172,7 +25716,228 @@ static const OnigCodePoint* const CodeRanges[] = {
CR_Age_5_1,
CR_Age_5_2,
CR_Age_6_0,
-#endif /* USE_UNICODE_PROPERTIES */
+ CR_Age_6_1,
+ CR_In_Basic_Latin,
+ CR_In_Latin_1_Supplement,
+ CR_In_Latin_Extended_A,
+ CR_In_Latin_Extended_B,
+ CR_In_IPA_Extensions,
+ CR_In_Spacing_Modifier_Letters,
+ CR_In_Combining_Diacritical_Marks,
+ CR_In_Greek_and_Coptic,
+ CR_In_Cyrillic,
+ CR_In_Cyrillic_Supplement,
+ CR_In_Armenian,
+ CR_In_Hebrew,
+ CR_In_Arabic,
+ CR_In_Syriac,
+ CR_In_Arabic_Supplement,
+ CR_In_Thaana,
+ CR_In_NKo,
+ CR_In_Samaritan,
+ CR_In_Mandaic,
+ CR_In_Arabic_Extended_A,
+ CR_In_Devanagari,
+ CR_In_Bengali,
+ CR_In_Gurmukhi,
+ CR_In_Gujarati,
+ CR_In_Oriya,
+ CR_In_Tamil,
+ CR_In_Telugu,
+ CR_In_Kannada,
+ CR_In_Malayalam,
+ CR_In_Sinhala,
+ CR_In_Thai,
+ CR_In_Lao,
+ CR_In_Tibetan,
+ CR_In_Myanmar,
+ CR_In_Georgian,
+ CR_In_Hangul_Jamo,
+ CR_In_Ethiopic,
+ CR_In_Ethiopic_Supplement,
+ CR_In_Cherokee,
+ CR_In_Unified_Canadian_Aboriginal_Syllabics,
+ CR_In_Ogham,
+ CR_In_Runic,
+ CR_In_Tagalog,
+ CR_In_Hanunoo,
+ CR_In_Buhid,
+ CR_In_Tagbanwa,
+ CR_In_Khmer,
+ CR_In_Mongolian,
+ CR_In_Unified_Canadian_Aboriginal_Syllabics_Extended,
+ CR_In_Limbu,
+ CR_In_Tai_Le,
+ CR_In_New_Tai_Lue,
+ CR_In_Khmer_Symbols,
+ CR_In_Buginese,
+ CR_In_Tai_Tham,
+ CR_In_Balinese,
+ CR_In_Sundanese,
+ CR_In_Batak,
+ CR_In_Lepcha,
+ CR_In_Ol_Chiki,
+ CR_In_Sundanese_Supplement,
+ CR_In_Vedic_Extensions,
+ CR_In_Phonetic_Extensions,
+ CR_In_Phonetic_Extensions_Supplement,
+ CR_In_Combining_Diacritical_Marks_Supplement,
+ CR_In_Latin_Extended_Additional,
+ CR_In_Greek_Extended,
+ CR_In_General_Punctuation,
+ CR_In_Superscripts_and_Subscripts,
+ CR_In_Currency_Symbols,
+ CR_In_Combining_Diacritical_Marks_for_Symbols,
+ CR_In_Letterlike_Symbols,
+ CR_In_Number_Forms,
+ CR_In_Arrows,
+ CR_In_Mathematical_Operators,
+ CR_In_Miscellaneous_Technical,
+ CR_In_Control_Pictures,
+ CR_In_Optical_Character_Recognition,
+ CR_In_Enclosed_Alphanumerics,
+ CR_In_Box_Drawing,
+ CR_In_Block_Elements,
+ CR_In_Geometric_Shapes,
+ CR_In_Miscellaneous_Symbols,
+ CR_In_Dingbats,
+ CR_In_Miscellaneous_Mathematical_Symbols_A,
+ CR_In_Supplemental_Arrows_A,
+ CR_In_Braille_Patterns,
+ CR_In_Supplemental_Arrows_B,
+ CR_In_Miscellaneous_Mathematical_Symbols_B,
+ CR_In_Supplemental_Mathematical_Operators,
+ CR_In_Miscellaneous_Symbols_and_Arrows,
+ CR_In_Glagolitic,
+ CR_In_Latin_Extended_C,
+ CR_In_Coptic,
+ CR_In_Georgian_Supplement,
+ CR_In_Tifinagh,
+ CR_In_Ethiopic_Extended,
+ CR_In_Cyrillic_Extended_A,
+ CR_In_Supplemental_Punctuation,
+ CR_In_CJK_Radicals_Supplement,
+ CR_In_Kangxi_Radicals,
+ CR_In_Ideographic_Description_Characters,
+ CR_In_CJK_Symbols_and_Punctuation,
+ CR_In_Hiragana,
+ CR_In_Katakana,
+ CR_In_Bopomofo,
+ CR_In_Hangul_Compatibility_Jamo,
+ CR_In_Kanbun,
+ CR_In_Bopomofo_Extended,
+ CR_In_CJK_Strokes,
+ CR_In_Katakana_Phonetic_Extensions,
+ CR_In_Enclosed_CJK_Letters_and_Months,
+ CR_In_CJK_Compatibility,
+ CR_In_CJK_Unified_Ideographs_Extension_A,
+ CR_In_Yijing_Hexagram_Symbols,
+ CR_In_CJK_Unified_Ideographs,
+ CR_In_Yi_Syllables,
+ CR_In_Yi_Radicals,
+ CR_In_Lisu,
+ CR_In_Vai,
+ CR_In_Cyrillic_Extended_B,
+ CR_In_Bamum,
+ CR_In_Modifier_Tone_Letters,
+ CR_In_Latin_Extended_D,
+ CR_In_Syloti_Nagri,
+ CR_In_Common_Indic_Number_Forms,
+ CR_In_Phags_pa,
+ CR_In_Saurashtra,
+ CR_In_Devanagari_Extended,
+ CR_In_Kayah_Li,
+ CR_In_Rejang,
+ CR_In_Hangul_Jamo_Extended_A,
+ CR_In_Javanese,
+ CR_In_Cham,
+ CR_In_Myanmar_Extended_A,
+ CR_In_Tai_Viet,
+ CR_In_Meetei_Mayek_Extensions,
+ CR_In_Ethiopic_Extended_A,
+ CR_In_Meetei_Mayek,
+ CR_In_Hangul_Syllables,
+ CR_In_Hangul_Jamo_Extended_B,
+ CR_In_High_Surrogates,
+ CR_In_High_Private_Use_Surrogates,
+ CR_In_Low_Surrogates,
+ CR_In_Private_Use_Area,
+ CR_In_CJK_Compatibility_Ideographs,
+ CR_In_Alphabetic_Presentation_Forms,
+ CR_In_Arabic_Presentation_Forms_A,
+ CR_In_Variation_Selectors,
+ CR_In_Vertical_Forms,
+ CR_In_Combining_Half_Marks,
+ CR_In_CJK_Compatibility_Forms,
+ CR_In_Small_Form_Variants,
+ CR_In_Arabic_Presentation_Forms_B,
+ CR_In_Halfwidth_and_Fullwidth_Forms,
+ CR_In_Specials,
+ CR_In_Linear_B_Syllabary,
+ CR_In_Linear_B_Ideograms,
+ CR_In_Aegean_Numbers,
+ CR_In_Ancient_Greek_Numbers,
+ CR_In_Ancient_Symbols,
+ CR_In_Phaistos_Disc,
+ CR_In_Lycian,
+ CR_In_Carian,
+ CR_In_Old_Italic,
+ CR_In_Gothic,
+ CR_In_Ugaritic,
+ CR_In_Old_Persian,
+ CR_In_Deseret,
+ CR_In_Shavian,
+ CR_In_Osmanya,
+ CR_In_Cypriot_Syllabary,
+ CR_In_Imperial_Aramaic,
+ CR_In_Phoenician,
+ CR_In_Lydian,
+ CR_In_Meroitic_Hieroglyphs,
+ CR_In_Meroitic_Cursive,
+ CR_In_Kharoshthi,
+ CR_In_Old_South_Arabian,
+ CR_In_Avestan,
+ CR_In_Inscriptional_Parthian,
+ CR_In_Inscriptional_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_Sharada,
+ CR_In_Takri,
+ CR_In_Cuneiform,
+ CR_In_Cuneiform_Numbers_and_Punctuation,
+ CR_In_Egyptian_Hieroglyphs,
+ CR_In_Bamum_Supplement,
+ CR_In_Miao,
+ CR_In_Kana_Supplement,
+ 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_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_Emoticons,
+ CR_In_Transport_And_Map_Symbols,
+ CR_In_Alchemical_Symbols,
+ CR_In_CJK_Unified_Ideographs_Extension_B,
+ CR_In_CJK_Unified_Ideographs_Extension_C,
+ CR_In_CJK_Unified_Ideographs_Extension_D,
+ CR_In_CJK_Compatibility_Ideographs_Supplement,
+ CR_In_Tags,
+ CR_In_Variation_Selectors_Supplement,
+ CR_In_Supplementary_Private_Use_Area_A,
+ CR_In_Supplementary_Private_Use_Area_B,
+ CR_In_No_Block,
#endif /* USE_UNICODE_PROPERTIES */
};
struct uniname2ctype_struct {
@@ -22182,19 +25947,19 @@ struct uniname2ctype_struct {
static const struct uniname2ctype_struct *uniname2ctype_p(const char *, unsigned int);
#ifndef USE_UNICODE_PROPERTIES
-#define TOTAL_KEYWORDS 15
+#define TOTAL_KEYWORDS 14
#define MIN_WORD_LENGTH 4
-#define MAX_WORD_LENGTH 7
-#define MIN_HASH_VALUE 7
-#define MAX_HASH_VALUE 21
-/* maximum key range = 15, duplicates = 0 */
+#define MAX_WORD_LENGTH 6
+#define MIN_HASH_VALUE 6
+#define MAX_HASH_VALUE 19
+/* maximum key range = 14, duplicates = 0 */
#else /* USE_UNICODE_PROPERTIES */
-#define TOTAL_KEYWORDS 387
+#define TOTAL_KEYWORDS 625
#define MIN_WORD_LENGTH 1
-#define MAX_WORD_LENGTH 30
+#define MAX_WORD_LENGTH 44
#define MIN_HASH_VALUE 3
-#define MAX_HASH_VALUE 1741
-/* maximum key range = 1739, duplicates = 0 */
+#define MAX_HASH_VALUE 4167
+/* maximum key range = 4165, duplicates = 0 */
#endif /* USE_UNICODE_PROPERTIES */
#ifdef __GNUC__
@@ -22216,33 +25981,33 @@ uniname2ctype_hash (str, len)
#endif /* USE_UNICODE_PROPERTIES */
{
#ifndef USE_UNICODE_PROPERTIES
- 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
- 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
- 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
- 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
- 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
- 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
- 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
- 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
- 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
- 22, 22, 22, 22, 22, 22, 22, 3, 13, 6,
- 4, 22, 22, 11, 22, 1, 22, 22, 10, 22,
- 2, 22, 1, 22, 10, 8, 4, 7, 22, 3,
- 4, 22, 22, 22, 22, 22, 22, 22
+ 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
+ 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
+ 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
+ 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
+ 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
+ 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
+ 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
+ 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
+ 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
+ 20, 20, 20, 20, 20, 20, 20, 3, 11, 5,
+ 4, 20, 20, 9, 20, 1, 20, 20, 10, 20,
+ 2, 20, 1, 20, 1, 7, 4, 6, 20, 1,
+ 4, 20, 20, 20, 20, 20, 20, 20
#else /* USE_UNICODE_PROPERTIES */
- 1742, 1742, 1742, 1742, 1742, 1742, 1742, 1742, 1742, 1742,
- 1742, 1742, 1742, 1742, 1742, 1742, 1742, 1742, 1742, 1742,
- 1742, 1742, 1742, 1742, 1742, 1742, 1742, 1742, 1742, 1742,
- 1742, 1742, 1742, 1742, 1742, 1742, 1742, 1742, 1742, 1742,
- 1742, 1742, 1742, 1742, 1742, 1742, 2, 1742, 9, 1,
- 2, 18, 5, 3, 4, 1742, 1742, 1742, 1742, 1742,
- 1742, 1742, 1742, 1742, 1742, 1742, 1742, 1742, 1742, 1742,
- 1742, 1742, 1742, 1742, 1742, 1742, 1742, 1742, 1742, 1742,
- 1742, 1742, 1742, 1742, 1742, 1742, 1742, 1742, 1742, 1742,
- 1742, 1742, 1742, 1742, 1742, 1742, 1742, 8, 280, 6,
- 96, 67, 362, 294, 38, 9, 63, 517, 2, 213,
- 1, 4, 192, 3, 10, 57, 31, 316, 1, 549,
- 330, 567, 36, 1742, 1742, 1742, 1742, 1742
+ 4168, 4168, 4168, 4168, 4168, 4168, 4168, 4168, 4168, 4168,
+ 4168, 4168, 4168, 4168, 4168, 4168, 4168, 4168, 4168, 4168,
+ 4168, 4168, 4168, 4168, 4168, 4168, 4168, 4168, 4168, 4168,
+ 4168, 4168, 4168, 4168, 4168, 4168, 4168, 4168, 4168, 4168,
+ 4168, 4168, 4168, 4168, 4168, 4168, 1, 4168, 13, 1,
+ 3, 28, 31, 10, 27, 4168, 4168, 4168, 4168, 4168,
+ 4168, 4168, 4168, 4168, 4168, 4168, 4168, 4168, 4168, 4168,
+ 4168, 4168, 4168, 4168, 4168, 4168, 4168, 4168, 4168, 4168,
+ 4168, 4168, 4168, 4168, 4168, 4168, 4168, 4168, 4168, 4168,
+ 4168, 4168, 4168, 4168, 4168, 4168, 4168, 13, 854, 14,
+ 443, 19, 7, 570, 335, 4, 66, 1159, 102, 34,
+ 1, 178, 474, 1, 192, 2, 64, 1117, 491, 264,
+ 256, 1305, 3, 4168, 4168, 4168, 4168, 4168
#endif /* USE_UNICODE_PROPERTIES */
};
#ifndef USE_UNICODE_PROPERTIES
@@ -22290,823 +26055,1298 @@ uniname2ctype_hash (str, len)
struct uniname2ctype_pool_t
{
#ifndef USE_UNICODE_PROPERTIES
+ char uniname2ctype_pool_str6[sizeof("word")];
char uniname2ctype_pool_str7[sizeof("print")];
char uniname2ctype_pool_str8[sizeof("punct")];
char uniname2ctype_pool_str9[sizeof("alpha")];
char uniname2ctype_pool_str10[sizeof("alnum")];
char uniname2ctype_pool_str11[sizeof("xdigit")];
- char uniname2ctype_pool_str12[sizeof("newline")];
- char uniname2ctype_pool_str13[sizeof("upper")];
- char uniname2ctype_pool_str14[sizeof("ascii")];
- char uniname2ctype_pool_str15[sizeof("cntrl")];
- char uniname2ctype_pool_str16[sizeof("space")];
- char uniname2ctype_pool_str17[sizeof("word")];
- char uniname2ctype_pool_str18[sizeof("lower")];
- char uniname2ctype_pool_str19[sizeof("graph")];
- char uniname2ctype_pool_str20[sizeof("digit")];
- char uniname2ctype_pool_str21[sizeof("blank")];
+ char uniname2ctype_pool_str12[sizeof("upper")];
+ char uniname2ctype_pool_str13[sizeof("ascii")];
+ char uniname2ctype_pool_str14[sizeof("cntrl")];
+ char uniname2ctype_pool_str15[sizeof("space")];
+ char uniname2ctype_pool_str16[sizeof("lower")];
+ char uniname2ctype_pool_str17[sizeof("graph")];
+ char uniname2ctype_pool_str18[sizeof("digit")];
+ char uniname2ctype_pool_str19[sizeof("blank")];
#else /* USE_UNICODE_PROPERTIES */
char uniname2ctype_pool_str3[sizeof("n")];
- char uniname2ctype_pool_str5[sizeof("l")];
- char uniname2ctype_pool_str7[sizeof("nl")];
- char uniname2ctype_pool_str8[sizeof("ll")];
- char uniname2ctype_pool_str10[sizeof("cn")];
- char uniname2ctype_pool_str11[sizeof("no")];
- char uniname2ctype_pool_str12[sizeof("lo")];
- char uniname2ctype_pool_str13[sizeof("c")];
- char uniname2ctype_pool_str16[sizeof("co")];
- char uniname2ctype_pool_str20[sizeof("cc")];
- char uniname2ctype_pool_str21[sizeof("lao")];
- char uniname2ctype_pool_str22[sizeof("laoo")];
- char uniname2ctype_pool_str23[sizeof("lana")];
- char uniname2ctype_pool_str26[sizeof("ci")];
- char uniname2ctype_pool_str29[sizeof("qaac")];
- char uniname2ctype_pool_str30[sizeof("vai")];
- char uniname2ctype_pool_str31[sizeof("vaii")];
- char uniname2ctype_pool_str32[sizeof("qaai")];
- char uniname2ctype_pool_str34[sizeof("control")];
- char uniname2ctype_pool_str37[sizeof("cari")];
- char uniname2ctype_pool_str40[sizeof("carian")];
- char uniname2ctype_pool_str42[sizeof("zl")];
- char uniname2ctype_pool_str44[sizeof("oriya")];
- char uniname2ctype_pool_str46[sizeof("latn")];
- char uniname2ctype_pool_str47[sizeof("cntrl")];
- char uniname2ctype_pool_str48[sizeof("latin")];
- char uniname2ctype_pool_str51[sizeof("han")];
- char uniname2ctype_pool_str53[sizeof("arabic")];
- char uniname2ctype_pool_str54[sizeof("ital")];
- char uniname2ctype_pool_str55[sizeof("hano")];
- char uniname2ctype_pool_str60[sizeof("hani")];
- char uniname2ctype_pool_str63[sizeof("hanunoo")];
- char uniname2ctype_pool_str66[sizeof("lt")];
- char uniname2ctype_pool_str67[sizeof("so")];
- char uniname2ctype_pool_str69[sizeof("hira")];
- char uniname2ctype_pool_str70[sizeof("nchar")];
- char uniname2ctype_pool_str71[sizeof("sc")];
- char uniname2ctype_pool_str73[sizeof("z")];
- char uniname2ctype_pool_str74[sizeof("oalpha")];
- char uniname2ctype_pool_str75[sizeof("tavt")];
- char uniname2ctype_pool_str76[sizeof("cans")];
- char uniname2ctype_pool_str84[sizeof("java")];
- char uniname2ctype_pool_str88[sizeof("zinh")];
- char uniname2ctype_pool_str89[sizeof("thaa")];
- char uniname2ctype_pool_str90[sizeof("thai")];
- char uniname2ctype_pool_str91[sizeof("variationselector")];
- char uniname2ctype_pool_str92[sizeof("sinhala")];
- char uniname2ctype_pool_str93[sizeof("joinc")];
- char uniname2ctype_pool_str94[sizeof("ascii")];
- char uniname2ctype_pool_str95[sizeof("initialpunctuation")];
- char uniname2ctype_pool_str98[sizeof("other")];
- char uniname2ctype_pool_str99[sizeof("joincontrol")];
- char uniname2ctype_pool_str100[sizeof("thaana")];
- char uniname2ctype_pool_str101[sizeof("avst")];
- char uniname2ctype_pool_str103[sizeof("olower")];
- char uniname2ctype_pool_str105[sizeof("othernumber")];
- char uniname2ctype_pool_str106[sizeof("otherletter")];
- char uniname2ctype_pool_str109[sizeof("sinh")];
- char uniname2ctype_pool_str112[sizeof("tale")];
- char uniname2ctype_pool_str114[sizeof("connectorpunctuation")];
- char uniname2ctype_pool_str115[sizeof("s")];
- char uniname2ctype_pool_str116[sizeof("di")];
- char uniname2ctype_pool_str117[sizeof("vs")];
- char uniname2ctype_pool_str119[sizeof("oidc")];
- char uniname2ctype_pool_str120[sizeof("idc")];
- char uniname2ctype_pool_str121[sizeof("odi")];
- char uniname2ctype_pool_str122[sizeof("cs")];
- char uniname2ctype_pool_str123[sizeof("avestan")];
- char uniname2ctype_pool_str124[sizeof("dia")];
- char uniname2ctype_pool_str125[sizeof("cher")];
- char uniname2ctype_pool_str126[sizeof("inscriptionalparthian")];
- char uniname2ctype_pool_str128[sizeof("shavian")];
- char uniname2ctype_pool_str137[sizeof("radical")];
- char uniname2ctype_pool_str143[sizeof("loe")];
- char uniname2ctype_pool_str147[sizeof("diacritic")];
- char uniname2ctype_pool_str148[sizeof("zzzz")];
- char uniname2ctype_pool_str149[sizeof("ethi")];
- char uniname2ctype_pool_str151[sizeof("canadianaboriginal")];
- char uniname2ctype_pool_str152[sizeof("zs")];
- char uniname2ctype_pool_str153[sizeof("othersymbol")];
- char uniname2ctype_pool_str156[sizeof("olditalic")];
- char uniname2ctype_pool_str161[sizeof("inscriptionalpahlavi")];
- char uniname2ctype_pool_str162[sizeof("taiviet")];
- char uniname2ctype_pool_str163[sizeof("lineseparator")];
- char uniname2ctype_pool_str166[sizeof("otheridstart")];
- char uniname2ctype_pool_str170[sizeof("oids")];
- char uniname2ctype_pool_str171[sizeof("asciihexdigit")];
- char uniname2ctype_pool_str172[sizeof("inherited")];
- char uniname2ctype_pool_str174[sizeof("otherlowercase")];
- char uniname2ctype_pool_str175[sizeof("terminalpunctuation")];
- char uniname2ctype_pool_str176[sizeof("deva")];
- char uniname2ctype_pool_str179[sizeof("otheralphabetic")];
- char uniname2ctype_pool_str180[sizeof("ideo")];
- char uniname2ctype_pool_str181[sizeof("noncharactercodepoint")];
- char uniname2ctype_pool_str183[sizeof("otheridcontinue")];
- char uniname2ctype_pool_str187[sizeof("taile")];
- char uniname2ctype_pool_str190[sizeof("oldpersian")];
- char uniname2ctype_pool_str192[sizeof("devanagari")];
- char uniname2ctype_pool_str193[sizeof("letter")];
- char uniname2ctype_pool_str195[sizeof("nd")];
- char uniname2ctype_pool_str197[sizeof("idst")];
- char uniname2ctype_pool_str198[sizeof("dsrt")];
- char uniname2ctype_pool_str200[sizeof("titlecaseletter")];
- char uniname2ctype_pool_str202[sizeof("po")];
- char uniname2ctype_pool_str203[sizeof("dash")];
- char uniname2ctype_pool_str206[sizeof("pc")];
- char uniname2ctype_pool_str209[sizeof("letternumber")];
- char uniname2ctype_pool_str212[sizeof("pi")];
- char uniname2ctype_pool_str215[sizeof("javanese")];
- char uniname2ctype_pool_str217[sizeof("mn")];
- char uniname2ctype_pool_str218[sizeof("idstart")];
- char uniname2ctype_pool_str220[sizeof("idcontinue")];
- char uniname2ctype_pool_str222[sizeof("ids")];
- char uniname2ctype_pool_str223[sizeof("alpha")];
- char uniname2ctype_pool_str227[sizeof("mc")];
- char uniname2ctype_pool_str229[sizeof("coptic")];
- char uniname2ctype_pool_str234[sizeof("mongolian")];
- char uniname2ctype_pool_str235[sizeof("common")];
- char uniname2ctype_pool_str236[sizeof("armn")];
- char uniname2ctype_pool_str237[sizeof("copt")];
- char uniname2ctype_pool_str243[sizeof("cprt")];
- char uniname2ctype_pool_str244[sizeof("armi")];
- char uniname2ctype_pool_str245[sizeof("phli")];
- char uniname2ctype_pool_str246[sizeof("prti")];
- char uniname2ctype_pool_str250[sizeof("armenian")];
- char uniname2ctype_pool_str251[sizeof("sd")];
- char uniname2ctype_pool_str252[sizeof("mandaic")];
- char uniname2ctype_pool_str255[sizeof("phoenician")];
- char uniname2ctype_pool_str258[sizeof("taml")];
- char uniname2ctype_pool_str261[sizeof("tamil")];
- char uniname2ctype_pool_str268[sizeof("cased")];
- char uniname2ctype_pool_str269[sizeof("cham")];
- char uniname2ctype_pool_str270[sizeof("idsbinaryoperator")];
- char uniname2ctype_pool_str271[sizeof("lepc")];
- char uniname2ctype_pool_str275[sizeof("otherdefaultignorablecodepoint")];
- char uniname2ctype_pool_str278[sizeof("print")];
- char uniname2ctype_pool_str286[sizeof("osma")];
- char uniname2ctype_pool_str292[sizeof("samr")];
- char uniname2ctype_pool_str294[sizeof("math")];
- char uniname2ctype_pool_str296[sizeof("linb")];
- char uniname2ctype_pool_str297[sizeof("closepunctuation")];
- char uniname2ctype_pool_str301[sizeof("otherpunctuation")];
- char uniname2ctype_pool_str303[sizeof("bali")];
- char uniname2ctype_pool_str306[sizeof("omath")];
- char uniname2ctype_pool_str307[sizeof("samaritan")];
- char uniname2ctype_pool_str308[sizeof("ps")];
- char uniname2ctype_pool_str310[sizeof("arab")];
- char uniname2ctype_pool_str311[sizeof("brai")];
- char uniname2ctype_pool_str314[sizeof("taitham")];
- char uniname2ctype_pool_str317[sizeof("linearb")];
- char uniname2ctype_pool_str321[sizeof("lepcha")];
- char uniname2ctype_pool_str322[sizeof("mand")];
- char uniname2ctype_pool_str324[sizeof("mtei")];
- char uniname2ctype_pool_str325[sizeof("term")];
- char uniname2ctype_pool_str326[sizeof("glagolitic")];
- char uniname2ctype_pool_str327[sizeof("privateuse")];
- char uniname2ctype_pool_str328[sizeof("pe")];
- char uniname2ctype_pool_str335[sizeof("deseret")];
- char uniname2ctype_pool_str340[sizeof("brah")];
- char uniname2ctype_pool_str341[sizeof("runr")];
- char uniname2ctype_pool_str343[sizeof("othermath")];
- char uniname2ctype_pool_str344[sizeof("runic")];
- char uniname2ctype_pool_str345[sizeof("hang")];
- char uniname2ctype_pool_str346[sizeof("ethiopic")];
- char uniname2ctype_pool_str349[sizeof("me")];
- char uniname2ctype_pool_str350[sizeof("patws")];
- char uniname2ctype_pool_str353[sizeof("separator")];
- char uniname2ctype_pool_str355[sizeof("tibt")];
- char uniname2ctype_pool_str356[sizeof("gothic")];
- char uniname2ctype_pool_str358[sizeof("tagbanwa")];
- char uniname2ctype_pool_str359[sizeof("sarb")];
- char uniname2ctype_pool_str361[sizeof("talu")];
- char uniname2ctype_pool_str367[sizeof("tibetan")];
- char uniname2ctype_pool_str371[sizeof("goth")];
- char uniname2ctype_pool_str372[sizeof("rjng")];
- char uniname2ctype_pool_str373[sizeof("hangul")];
- char uniname2ctype_pool_str374[sizeof("bengali")];
- char uniname2ctype_pool_str375[sizeof("hiragana")];
- char uniname2ctype_pool_str376[sizeof("braille")];
- char uniname2ctype_pool_str379[sizeof("geor")];
- char uniname2ctype_pool_str380[sizeof("age=1.1")];
- char uniname2ctype_pool_str381[sizeof("age=2.1")];
- char uniname2ctype_pool_str382[sizeof("age=5.1")];
- char uniname2ctype_pool_str383[sizeof("age=5.2")];
- char uniname2ctype_pool_str384[sizeof("age=4.1")];
- char uniname2ctype_pool_str385[sizeof("p")];
- char uniname2ctype_pool_str386[sizeof("pd")];
- char uniname2ctype_pool_str388[sizeof("lisu")];
- char uniname2ctype_pool_str389[sizeof("age=2.0")];
- char uniname2ctype_pool_str390[sizeof("age=5.0")];
- char uniname2ctype_pool_str391[sizeof("age=6.0")];
- char uniname2ctype_pool_str392[sizeof("age=4.0")];
- char uniname2ctype_pool_str393[sizeof("graph")];
- char uniname2ctype_pool_str395[sizeof("saur")];
- char uniname2ctype_pool_str396[sizeof("space")];
- char uniname2ctype_pool_str397[sizeof("age=3.1")];
- char uniname2ctype_pool_str398[sizeof("age=3.2")];
- char uniname2ctype_pool_str399[sizeof("hebr")];
- char uniname2ctype_pool_str402[sizeof("bidic")];
- char uniname2ctype_pool_str405[sizeof("age=3.0")];
- char uniname2ctype_pool_str408[sizeof("bidicontrol")];
- char uniname2ctype_pool_str413[sizeof("logicalorderexception")];
- char uniname2ctype_pool_str420[sizeof("telu")];
- char uniname2ctype_pool_str422[sizeof("zp")];
- char uniname2ctype_pool_str427[sizeof("m")];
- char uniname2ctype_pool_str430[sizeof("lm")];
- char uniname2ctype_pool_str432[sizeof("idstrinaryoperator")];
- char uniname2ctype_pool_str433[sizeof("balinese")];
- char uniname2ctype_pool_str434[sizeof("uideo")];
- char uniname2ctype_pool_str436[sizeof("spaceseparator")];
- char uniname2ctype_pool_str438[sizeof("grext")];
- char uniname2ctype_pool_str442[sizeof("alnum")];
- char uniname2ctype_pool_str443[sizeof("oldturkic")];
- char uniname2ctype_pool_str445[sizeof("xidc")];
- char uniname2ctype_pool_str446[sizeof("idsb")];
- char uniname2ctype_pool_str447[sizeof("ahex")];
- char uniname2ctype_pool_str452[sizeof("format")];
- char uniname2ctype_pool_str456[sizeof("caseignorable")];
- char uniname2ctype_pool_str457[sizeof("tifinagh")];
- char uniname2ctype_pool_str459[sizeof("sundanese")];
- char uniname2ctype_pool_str462[sizeof("ext")];
- char uniname2ctype_pool_str464[sizeof("saurashtra")];
- char uniname2ctype_pool_str465[sizeof("patternwhitespace")];
- char uniname2ctype_pool_str466[sizeof("digit")];
- char uniname2ctype_pool_str474[sizeof("sund")];
- char uniname2ctype_pool_str480[sizeof("decimalnumber")];
- char uniname2ctype_pool_str484[sizeof("bopo")];
- char uniname2ctype_pool_str485[sizeof("sm")];
- char uniname2ctype_pool_str488[sizeof("otheruppercase")];
- char uniname2ctype_pool_str493[sizeof("ideographic")];
- char uniname2ctype_pool_str496[sizeof("xids")];
- char uniname2ctype_pool_str497[sizeof("unassigned")];
- char uniname2ctype_pool_str502[sizeof("phagspa")];
- char uniname2ctype_pool_str506[sizeof("alphabetic")];
- char uniname2ctype_pool_str508[sizeof("limb")];
- char uniname2ctype_pool_str512[sizeof("xdigit")];
- char uniname2ctype_pool_str513[sizeof("xidstart")];
- char uniname2ctype_pool_str516[sizeof("mong")];
- char uniname2ctype_pool_str518[sizeof("xidcontinue")];
- char uniname2ctype_pool_str521[sizeof("assigned")];
- char uniname2ctype_pool_str523[sizeof("ogam")];
- char uniname2ctype_pool_str529[sizeof("nko")];
- char uniname2ctype_pool_str530[sizeof("nkoo")];
- char uniname2ctype_pool_str533[sizeof("olck")];
- char uniname2ctype_pool_str534[sizeof("deprecated")];
- char uniname2ctype_pool_str535[sizeof("brahmi")];
- char uniname2ctype_pool_str536[sizeof("phag")];
- char uniname2ctype_pool_str538[sizeof("kana")];
- char uniname2ctype_pool_str540[sizeof("kali")];
- char uniname2ctype_pool_str542[sizeof("changeswhenlowercased")];
- char uniname2ctype_pool_str543[sizeof("extender")];
- char uniname2ctype_pool_str550[sizeof("dep")];
- char uniname2ctype_pool_str554[sizeof("olchiki")];
- char uniname2ctype_pool_str562[sizeof("cwl")];
- char uniname2ctype_pool_str563[sizeof("graphemebase")];
- char uniname2ctype_pool_str565[sizeof("phnx")];
- char uniname2ctype_pool_str573[sizeof("orkh")];
- char uniname2ctype_pool_str576[sizeof("punct")];
- char uniname2ctype_pool_str577[sizeof("khar")];
- char uniname2ctype_pool_str580[sizeof("lower")];
- char uniname2ctype_pool_str586[sizeof("sterm")];
- char uniname2ctype_pool_str587[sizeof("yi")];
- char uniname2ctype_pool_str588[sizeof("lyci")];
- char uniname2ctype_pool_str589[sizeof("cyrl")];
- char uniname2ctype_pool_str591[sizeof("lycian")];
- char uniname2ctype_pool_str592[sizeof("finalpunctuation")];
- char uniname2ctype_pool_str593[sizeof("orya")];
- char uniname2ctype_pool_str594[sizeof("graphemeextend")];
- char uniname2ctype_pool_str596[sizeof("kaithi")];
- char uniname2ctype_pool_str597[sizeof("xpeo")];
- char uniname2ctype_pool_str598[sizeof("yiii")];
- char uniname2ctype_pool_str599[sizeof("kthi")];
- char uniname2ctype_pool_str601[sizeof("cyrillic")];
- char uniname2ctype_pool_str602[sizeof("glag")];
- char uniname2ctype_pool_str605[sizeof("oupper")];
- char uniname2ctype_pool_str617[sizeof("tagb")];
- char uniname2ctype_pool_str620[sizeof("cwt")];
- char uniname2ctype_pool_str623[sizeof("number")];
- char uniname2ctype_pool_str625[sizeof("tglg")];
- char uniname2ctype_pool_str626[sizeof("knda")];
- char uniname2ctype_pool_str627[sizeof("lowercaseletter")];
- char uniname2ctype_pool_str628[sizeof("changeswhentitlecased")];
- char uniname2ctype_pool_str629[sizeof("softdotted")];
- char uniname2ctype_pool_str632[sizeof("ugar")];
- char uniname2ctype_pool_str634[sizeof("sylo")];
- char uniname2ctype_pool_str636[sizeof("lu")];
- char uniname2ctype_pool_str640[sizeof("tagalog")];
- char uniname2ctype_pool_str643[sizeof("kharoshthi")];
- char uniname2ctype_pool_str644[sizeof("syrc")];
- char uniname2ctype_pool_str645[sizeof("kannada")];
- char uniname2ctype_pool_str646[sizeof("beng")];
- char uniname2ctype_pool_str647[sizeof("lowercase")];
- char uniname2ctype_pool_str656[sizeof("shaw")];
- char uniname2ctype_pool_str659[sizeof("patternsyntax")];
- char uniname2ctype_pool_str660[sizeof("syriac")];
- char uniname2ctype_pool_str663[sizeof("word")];
- char uniname2ctype_pool_str667[sizeof("imperialaramaic")];
- char uniname2ctype_pool_str672[sizeof("ugaritic")];
- char uniname2ctype_pool_str675[sizeof("enclosingmark")];
- char uniname2ctype_pool_str677[sizeof("georgian")];
- char uniname2ctype_pool_str678[sizeof("lydi")];
- char uniname2ctype_pool_str681[sizeof("lydian")];
- char uniname2ctype_pool_str686[sizeof("sylotinagri")];
- char uniname2ctype_pool_str687[sizeof("gujr")];
- char uniname2ctype_pool_str692[sizeof("tfng")];
- char uniname2ctype_pool_str696[sizeof("currencysymbol")];
- char uniname2ctype_pool_str701[sizeof("newline")];
- char uniname2ctype_pool_str705[sizeof("bopomofo")];
- char uniname2ctype_pool_str706[sizeof("ogrext")];
- char uniname2ctype_pool_str707[sizeof("cherokee")];
- char uniname2ctype_pool_str708[sizeof("gujarati")];
- char uniname2ctype_pool_str710[sizeof("newtailue")];
- char uniname2ctype_pool_str716[sizeof("dashpunctuation")];
- char uniname2ctype_pool_str718[sizeof("oldsoutharabian")];
- char uniname2ctype_pool_str725[sizeof("upper")];
- char uniname2ctype_pool_str732[sizeof("cf")];
- char uniname2ctype_pool_str734[sizeof("buhd")];
- char uniname2ctype_pool_str735[sizeof("rejang")];
- char uniname2ctype_pool_str736[sizeof("othergraphemeextend")];
- char uniname2ctype_pool_str739[sizeof("modifierletter")];
- char uniname2ctype_pool_str745[sizeof("nonspacingmark")];
- char uniname2ctype_pool_str749[sizeof("changeswhencasemapped")];
- char uniname2ctype_pool_str752[sizeof("mark")];
- char uniname2ctype_pool_str757[sizeof("surrogate")];
- char uniname2ctype_pool_str765[sizeof("paragraphseparator")];
- char uniname2ctype_pool_str767[sizeof("ogham")];
- char uniname2ctype_pool_str768[sizeof("hex")];
- char uniname2ctype_pool_str772[sizeof("uppercaseletter")];
- char uniname2ctype_pool_str777[sizeof("hexdigit")];
- char uniname2ctype_pool_str778[sizeof("cwcm")];
- char uniname2ctype_pool_str781[sizeof("grbase")];
- char uniname2ctype_pool_str782[sizeof("khmr")];
- char uniname2ctype_pool_str788[sizeof("unifiedideograph")];
- char uniname2ctype_pool_str792[sizeof("uppercase")];
- char uniname2ctype_pool_str793[sizeof("khmer")];
- char uniname2ctype_pool_str795[sizeof("spacingmark")];
- char uniname2ctype_pool_str797[sizeof("whitespace")];
- char uniname2ctype_pool_str806[sizeof("patsyn")];
- char uniname2ctype_pool_str816[sizeof("cypriot")];
- char uniname2ctype_pool_str818[sizeof("openpunctuation")];
- char uniname2ctype_pool_str821[sizeof("bamu")];
- char uniname2ctype_pool_str831[sizeof("buhid")];
- char uniname2ctype_pool_str840[sizeof("batk")];
- char uniname2ctype_pool_str851[sizeof("symbol")];
- char uniname2ctype_pool_str856[sizeof("changeswhenuppercased")];
- char uniname2ctype_pool_str857[sizeof("osmanya")];
- char uniname2ctype_pool_str861[sizeof("limbu")];
- char uniname2ctype_pool_str868[sizeof("punctuation")];
- char uniname2ctype_pool_str872[sizeof("hyphen")];
- char uniname2ctype_pool_str888[sizeof("mathsymbol")];
- char uniname2ctype_pool_str892[sizeof("grek")];
- char uniname2ctype_pool_str898[sizeof("changeswhencasefolded")];
- char uniname2ctype_pool_str902[sizeof("quotationmark")];
- char uniname2ctype_pool_str903[sizeof("bugi")];
- char uniname2ctype_pool_str916[sizeof("cuneiform")];
- char uniname2ctype_pool_str918[sizeof("pf")];
- char uniname2ctype_pool_str927[sizeof("cwcf")];
- char uniname2ctype_pool_str932[sizeof("bamum")];
- char uniname2ctype_pool_str940[sizeof("guru")];
- char uniname2ctype_pool_str944[sizeof("wspace")];
- char uniname2ctype_pool_str951[sizeof("meeteimayek")];
- char uniname2ctype_pool_str976[sizeof("defaultignorablecodepoint")];
- char uniname2ctype_pool_str980[sizeof("modifiersymbol")];
- char uniname2ctype_pool_str999[sizeof("mlym")];
- char uniname2ctype_pool_str1007[sizeof("mymr")];
- char uniname2ctype_pool_str1020[sizeof("malayalam")];
- char uniname2ctype_pool_str1026[sizeof("myanmar")];
- char uniname2ctype_pool_str1032[sizeof("telugu")];
- char uniname2ctype_pool_str1033[sizeof("buginese")];
- char uniname2ctype_pool_str1037[sizeof("xsux")];
- char uniname2ctype_pool_str1093[sizeof("sk")];
- char uniname2ctype_pool_str1097[sizeof("katakana")];
- char uniname2ctype_pool_str1124[sizeof("egyp")];
- char uniname2ctype_pool_str1146[sizeof("any")];
- char uniname2ctype_pool_str1148[sizeof("kayahli")];
- char uniname2ctype_pool_str1190[sizeof("cwu")];
- char uniname2ctype_pool_str1263[sizeof("qmark")];
- char uniname2ctype_pool_str1329[sizeof("blank")];
- char uniname2ctype_pool_str1347[sizeof("grlink")];
- char uniname2ctype_pool_str1358[sizeof("batak")];
- char uniname2ctype_pool_str1395[sizeof("unknown")];
- char uniname2ctype_pool_str1410[sizeof("greek")];
- char uniname2ctype_pool_str1463[sizeof("graphemelink")];
- char uniname2ctype_pool_str1470[sizeof("gurmukhi")];
- char uniname2ctype_pool_str1556[sizeof("hebrew")];
- char uniname2ctype_pool_str1621[sizeof("egyptianhieroglyphs")];
- char uniname2ctype_pool_str1741[sizeof("zyyy")];
+ char uniname2ctype_pool_str5[sizeof("s")];
+ char uniname2ctype_pool_str7[sizeof("z")];
+ char uniname2ctype_pool_str9[sizeof("zs")];
+ char uniname2ctype_pool_str16[sizeof("zzzz")];
+ char uniname2ctype_pool_str18[sizeof("cn")];
+ char uniname2ctype_pool_str20[sizeof("cs")];
+ char uniname2ctype_pool_str24[sizeof("ci")];
+ char uniname2ctype_pool_str29[sizeof("c")];
+ char uniname2ctype_pool_str30[sizeof("cf")];
+ char uniname2ctype_pool_str32[sizeof("sc")];
+ char uniname2ctype_pool_str34[sizeof("cans")];
+ char uniname2ctype_pool_str35[sizeof("qaai")];
+ char uniname2ctype_pool_str38[sizeof("mn")];
+ char uniname2ctype_pool_str42[sizeof("ascii")];
+ char uniname2ctype_pool_str44[sizeof("cc")];
+ char uniname2ctype_pool_str45[sizeof("qaac")];
+ char uniname2ctype_pool_str49[sizeof("inavestan")];
+ char uniname2ctype_pool_str52[sizeof("inspecials")];
+ char uniname2ctype_pool_str62[sizeof("inipaextensions")];
+ char uniname2ctype_pool_str64[sizeof("mc")];
+ char uniname2ctype_pool_str66[sizeof("insamaritan")];
+ char uniname2ctype_pool_str69[sizeof("m")];
+ char uniname2ctype_pool_str72[sizeof("sm")];
+ char uniname2ctype_pool_str74[sizeof("me")];
+ char uniname2ctype_pool_str82[sizeof("inarmenian")];
+ char uniname2ctype_pool_str84[sizeof("incuneiform")];
+ char uniname2ctype_pool_str86[sizeof("mandaic")];
+ char uniname2ctype_pool_str90[sizeof("inancientsymbols")];
+ char uniname2ctype_pool_str92[sizeof("incuneiformnumbersandpunctuation")];
+ char uniname2ctype_pool_str96[sizeof("inthai")];
+ char uniname2ctype_pool_str99[sizeof("inmusicalsymbols")];
+ char uniname2ctype_pool_str100[sizeof("inmiscellaneoussymbols")];
+ char uniname2ctype_pool_str106[sizeof("incham")];
+ char uniname2ctype_pool_str109[sizeof("inmiscellaneoussymbolsandarrows")];
+ char uniname2ctype_pool_str113[sizeof("initialpunctuation")];
+ char uniname2ctype_pool_str114[sizeof("inmiscellaneoussymbolsandpictographs")];
+ char uniname2ctype_pool_str116[sizeof("inthaana")];
+ char uniname2ctype_pool_str124[sizeof("taile")];
+ char uniname2ctype_pool_str125[sizeof("mtei")];
+ char uniname2ctype_pool_str132[sizeof("lc")];
+ char uniname2ctype_pool_str133[sizeof("lana")];
+ char uniname2ctype_pool_str134[sizeof("inlycian")];
+ char uniname2ctype_pool_str135[sizeof("intransportandmapsymbols")];
+ char uniname2ctype_pool_str136[sizeof("incontrolpictures")];
+ char uniname2ctype_pool_str142[sizeof("sinhala")];
+ char uniname2ctype_pool_str151[sizeof("incommonindicnumberforms")];
+ char uniname2ctype_pool_str156[sizeof("inmiscellaneousmathematicalsymbolsa")];
+ char uniname2ctype_pool_str158[sizeof("sterm")];
+ char uniname2ctype_pool_str167[sizeof("inmyanmarextendeda")];
+ char uniname2ctype_pool_str172[sizeof("lm")];
+ char uniname2ctype_pool_str175[sizeof("taiviet")];
+ char uniname2ctype_pool_str179[sizeof("inlinearbideograms")];
+ char uniname2ctype_pool_str180[sizeof("intaitham")];
+ char uniname2ctype_pool_str184[sizeof("latn")];
+ char uniname2ctype_pool_str186[sizeof("latin")];
+ char uniname2ctype_pool_str187[sizeof("ital")];
+ char uniname2ctype_pool_str189[sizeof("alnum")];
+ char uniname2ctype_pool_str199[sizeof("inmalayalam")];
+ char uniname2ctype_pool_str201[sizeof("intaile")];
+ char uniname2ctype_pool_str202[sizeof("tale")];
+ char uniname2ctype_pool_str205[sizeof("l")];
+ char uniname2ctype_pool_str207[sizeof("nl")];
+ char uniname2ctype_pool_str209[sizeof("zl")];
+ char uniname2ctype_pool_str216[sizeof("intamil")];
+ char uniname2ctype_pool_str217[sizeof("taml")];
+ char uniname2ctype_pool_str218[sizeof("inlatinextendeda")];
+ char uniname2ctype_pool_str220[sizeof("inlatinextendedc")];
+ char uniname2ctype_pool_str223[sizeof("inrunic")];
+ char uniname2ctype_pool_str224[sizeof("incarian")];
+ char uniname2ctype_pool_str225[sizeof("insyriac")];
+ char uniname2ctype_pool_str227[sizeof("cari")];
+ char uniname2ctype_pool_str230[sizeof("inmeeteimayekextensions")];
+ char uniname2ctype_pool_str231[sizeof("osma")];
+ char uniname2ctype_pool_str232[sizeof("lt")];
+ char uniname2ctype_pool_str233[sizeof("miao")];
+ char uniname2ctype_pool_str234[sizeof("insharada")];
+ char uniname2ctype_pool_str239[sizeof("incyrillic")];
+ char uniname2ctype_pool_str240[sizeof("carian")];
+ char uniname2ctype_pool_str244[sizeof("armn")];
+ char uniname2ctype_pool_str245[sizeof("samr")];
+ char uniname2ctype_pool_str247[sizeof("armi")];
+ char uniname2ctype_pool_str248[sizeof("inideographicdescriptioncharacters")];
+ char uniname2ctype_pool_str252[sizeof("inosmanya")];
+ char uniname2ctype_pool_str253[sizeof("armenian")];
+ char uniname2ctype_pool_str254[sizeof("inmyanmar")];
+ char uniname2ctype_pool_str255[sizeof("samaritan")];
+ char uniname2ctype_pool_str256[sizeof("arabic")];
+ char uniname2ctype_pool_str259[sizeof("incherokee")];
+ char uniname2ctype_pool_str261[sizeof("connectorpunctuation")];
+ char uniname2ctype_pool_str263[sizeof("merc")];
+ char uniname2ctype_pool_str264[sizeof("inmiscellaneoustechnical")];
+ char uniname2ctype_pool_str268[sizeof("inenclosedalphanumerics")];
+ char uniname2ctype_pool_str279[sizeof("inemoticons")];
+ char uniname2ctype_pool_str281[sizeof("joinc")];
+ char uniname2ctype_pool_str288[sizeof("cntrl")];
+ char uniname2ctype_pool_str301[sizeof("inenclosedcjklettersandmonths")];
+ char uniname2ctype_pool_str303[sizeof("cwcf")];
+ char uniname2ctype_pool_str304[sizeof("inruminumeralsymbols")];
+ char uniname2ctype_pool_str308[sizeof("ll")];
+ char uniname2ctype_pool_str313[sizeof("term")];
+ char uniname2ctype_pool_str316[sizeof("inlatinextendedadditional")];
+ char uniname2ctype_pool_str320[sizeof("tamil")];
+ char uniname2ctype_pool_str321[sizeof("loe")];
+ char uniname2ctype_pool_str329[sizeof("newtailue")];
+ char uniname2ctype_pool_str330[sizeof("cwcm")];
+ char uniname2ctype_pool_str339[sizeof("inenclosedalphanumericsupplement")];
+ char uniname2ctype_pool_str346[sizeof("sinh")];
+ char uniname2ctype_pool_str347[sizeof("zinh")];
+ char uniname2ctype_pool_str349[sizeof("meroiticcursive")];
+ char uniname2ctype_pool_str353[sizeof("han")];
+ char uniname2ctype_pool_str357[sizeof("hani")];
+ char uniname2ctype_pool_str358[sizeof("inopticalcharacterrecognition")];
+ char uniname2ctype_pool_str359[sizeof("no")];
+ char uniname2ctype_pool_str360[sizeof("so")];
+ char uniname2ctype_pool_str364[sizeof("innewtailue")];
+ char uniname2ctype_pool_str365[sizeof("insinhala")];
+ char uniname2ctype_pool_str367[sizeof("innko")];
+ char uniname2ctype_pool_str372[sizeof("co")];
+ char uniname2ctype_pool_str375[sizeof("shavian")];
+ char uniname2ctype_pool_str378[sizeof("terminalpunctuation")];
+ char uniname2ctype_pool_str386[sizeof("intaixuanjingsymbols")];
+ char uniname2ctype_pool_str387[sizeof("inethiopic")];
+ char uniname2ctype_pool_str389[sizeof("sora")];
+ char uniname2ctype_pool_str398[sizeof("inarrows")];
+ char uniname2ctype_pool_str400[sizeof("cham")];
+ char uniname2ctype_pool_str403[sizeof("inlowsurrogates")];
+ char uniname2ctype_pool_str405[sizeof("oriya")];
+ char uniname2ctype_pool_str406[sizeof("ext")];
+ char uniname2ctype_pool_str409[sizeof("cwt")];
+ char uniname2ctype_pool_str412[sizeof("common")];
+ char uniname2ctype_pool_str414[sizeof("inmiao")];
+ char uniname2ctype_pool_str420[sizeof("thai")];
+ char uniname2ctype_pool_str425[sizeof("intifinagh")];
+ char uniname2ctype_pool_str426[sizeof("ethi")];
+ char uniname2ctype_pool_str427[sizeof("mero")];
+ char uniname2ctype_pool_str428[sizeof("chakma")];
+ char uniname2ctype_pool_str429[sizeof("thaa")];
+ char uniname2ctype_pool_str430[sizeof("inscriptionalparthian")];
+ char uniname2ctype_pool_str432[sizeof("tifinagh")];
+ char uniname2ctype_pool_str436[sizeof("titlecaseletter")];
+ char uniname2ctype_pool_str445[sizeof("thaana")];
+ char uniname2ctype_pool_str449[sizeof("asciihexdigit")];
+ char uniname2ctype_pool_str450[sizeof("math")];
+ char uniname2ctype_pool_str453[sizeof("di")];
+ char uniname2ctype_pool_str454[sizeof("ids")];
+ char uniname2ctype_pool_str460[sizeof("lo")];
+ char uniname2ctype_pool_str468[sizeof("inlao")];
+ char uniname2ctype_pool_str470[sizeof("taitham")];
+ char uniname2ctype_pool_str474[sizeof("lao")];
+ char uniname2ctype_pool_str475[sizeof("laoo")];
+ char uniname2ctype_pool_str476[sizeof("dia")];
+ char uniname2ctype_pool_str478[sizeof("idc")];
+ char uniname2ctype_pool_str480[sizeof("ps")];
+ char uniname2ctype_pool_str481[sizeof("insundanese")];
+ char uniname2ctype_pool_str484[sizeof("pi")];
+ char uniname2ctype_pool_str485[sizeof("cwl")];
+ char uniname2ctype_pool_str490[sizeof("pf")];
+ char uniname2ctype_pool_str495[sizeof("mand")];
+ char uniname2ctype_pool_str496[sizeof("insylotinagri")];
+ char uniname2ctype_pool_str497[sizeof("vs")];
+ char uniname2ctype_pool_str503[sizeof("mongolian")];
+ char uniname2ctype_pool_str504[sizeof("pc")];
+ char uniname2ctype_pool_str506[sizeof("inmandaic")];
+ char uniname2ctype_pool_str509[sizeof("invai")];
+ char uniname2ctype_pool_str511[sizeof("lineseparator")];
+ char uniname2ctype_pool_str514[sizeof("pe")];
+ char uniname2ctype_pool_str515[sizeof("vai")];
+ char uniname2ctype_pool_str516[sizeof("vaii")];
+ char uniname2ctype_pool_str517[sizeof("idst")];
+ char uniname2ctype_pool_str520[sizeof("indominotiles")];
+ char uniname2ctype_pool_str521[sizeof("inshavian")];
+ char uniname2ctype_pool_str522[sizeof("inspacingmodifierletters")];
+ char uniname2ctype_pool_str524[sizeof("format")];
+ char uniname2ctype_pool_str528[sizeof("inphaistosdisc")];
+ char uniname2ctype_pool_str531[sizeof("hano")];
+ char uniname2ctype_pool_str532[sizeof("space")];
+ char uniname2ctype_pool_str542[sizeof("indeseret")];
+ char uniname2ctype_pool_str545[sizeof("inolchiki")];
+ char uniname2ctype_pool_str548[sizeof("hira")];
+ char uniname2ctype_pool_str553[sizeof("joincontrol")];
+ char uniname2ctype_pool_str555[sizeof("idcontinue")];
+ char uniname2ctype_pool_str558[sizeof("inmahjongtiles")];
+ char uniname2ctype_pool_str560[sizeof("patws")];
+ char uniname2ctype_pool_str563[sizeof("inlydian")];
+ char uniname2ctype_pool_str564[sizeof("cher")];
+ char uniname2ctype_pool_str568[sizeof("inhiragana")];
+ char uniname2ctype_pool_str572[sizeof("inogham")];
+ char uniname2ctype_pool_str574[sizeof("avst")];
+ char uniname2ctype_pool_str575[sizeof("inscriptionalpahlavi")];
+ char uniname2ctype_pool_str579[sizeof("incoptic")];
+ char uniname2ctype_pool_str587[sizeof("java")];
+ char uniname2ctype_pool_str589[sizeof("inmathematicalalphanumericsymbols")];
+ char uniname2ctype_pool_str594[sizeof("letter")];
+ char uniname2ctype_pool_str604[sizeof("injavanese")];
+ char uniname2ctype_pool_str608[sizeof("avestan")];
+ char uniname2ctype_pool_str612[sizeof("age=1.1")];
+ char uniname2ctype_pool_str613[sizeof("lepc")];
+ char uniname2ctype_pool_str614[sizeof("age=2.1")];
+ char uniname2ctype_pool_str616[sizeof("inlepcha")];
+ char uniname2ctype_pool_str617[sizeof("javanese")];
+ char uniname2ctype_pool_str618[sizeof("shaw")];
+ char uniname2ctype_pool_str619[sizeof("finalpunctuation")];
+ char uniname2ctype_pool_str620[sizeof("alpha")];
+ char uniname2ctype_pool_str621[sizeof("age=5.1")];
+ char uniname2ctype_pool_str622[sizeof("inmongolian")];
+ char uniname2ctype_pool_str623[sizeof("age=5.2")];
+ char uniname2ctype_pool_str626[sizeof("age=2.0")];
+ char uniname2ctype_pool_str627[sizeof("ahex")];
+ char uniname2ctype_pool_str630[sizeof("ingeneralpunctuation")];
+ char uniname2ctype_pool_str631[sizeof("oids")];
+ char uniname2ctype_pool_str632[sizeof("odi")];
+ char uniname2ctype_pool_str633[sizeof("age=5.0")];
+ char uniname2ctype_pool_str636[sizeof("tavt")];
+ char uniname2ctype_pool_str637[sizeof("intaiviet")];
+ char uniname2ctype_pool_str638[sizeof("age=6.1")];
+ char uniname2ctype_pool_str639[sizeof("age=3.1")];
+ char uniname2ctype_pool_str640[sizeof("insundanesesupplement")];
+ char uniname2ctype_pool_str641[sizeof("age=3.2")];
+ char uniname2ctype_pool_str642[sizeof("age=4.1")];
+ char uniname2ctype_pool_str643[sizeof("oidc")];
+ char uniname2ctype_pool_str646[sizeof("tfng")];
+ char uniname2ctype_pool_str647[sizeof("insmallformvariants")];
+ char uniname2ctype_pool_str648[sizeof("ideo")];
+ char uniname2ctype_pool_str649[sizeof("intags")];
+ char uniname2ctype_pool_str650[sizeof("age=6.0")];
+ char uniname2ctype_pool_str651[sizeof("age=3.0")];
+ char uniname2ctype_pool_str653[sizeof("whitespace")];
+ char uniname2ctype_pool_str654[sizeof("age=4.0")];
+ char uniname2ctype_pool_str655[sizeof("inolditalic")];
+ char uniname2ctype_pool_str660[sizeof("oalpha")];
+ char uniname2ctype_pool_str668[sizeof("ingujarati")];
+ char uniname2ctype_pool_str672[sizeof("control")];
+ char uniname2ctype_pool_str679[sizeof("diacritic")];
+ char uniname2ctype_pool_str682[sizeof("tagbanwa")];
+ char uniname2ctype_pool_str690[sizeof("inphoenician")];
+ char uniname2ctype_pool_str701[sizeof("ininscriptionalparthian")];
+ char uniname2ctype_pool_str703[sizeof("ininscriptionalpahlavi")];
+ char uniname2ctype_pool_str704[sizeof("coptic")];
+ char uniname2ctype_pool_str705[sizeof("dsrt")];
+ char uniname2ctype_pool_str706[sizeof("inmodifiertoneletters")];
+ char uniname2ctype_pool_str709[sizeof("xids")];
+ char uniname2ctype_pool_str713[sizeof("hanunoo")];
+ char uniname2ctype_pool_str715[sizeof("inoldturkic")];
+ char uniname2ctype_pool_str721[sizeof("xidc")];
+ char uniname2ctype_pool_str725[sizeof("idstart")];
+ char uniname2ctype_pool_str729[sizeof("inimperialaramaic")];
+ char uniname2ctype_pool_str730[sizeof("invariationselectors")];
+ char uniname2ctype_pool_str734[sizeof("copt")];
+ char uniname2ctype_pool_str737[sizeof("caseignorable")];
+ char uniname2ctype_pool_str738[sizeof("prti")];
+ char uniname2ctype_pool_str739[sizeof("nchar")];
+ char uniname2ctype_pool_str746[sizeof("deseret")];
+ char uniname2ctype_pool_str747[sizeof("decimalnumber")];
+ char uniname2ctype_pool_str748[sizeof("cprt")];
+ char uniname2ctype_pool_str750[sizeof("inlatin1supplement")];
+ char uniname2ctype_pool_str771[sizeof("imperialaramaic")];
+ char uniname2ctype_pool_str776[sizeof("privateuse")];
+ char uniname2ctype_pool_str777[sizeof("casedletter")];
+ char uniname2ctype_pool_str778[sizeof("lowercase")];
+ char uniname2ctype_pool_str780[sizeof("spaceseparator")];
+ char uniname2ctype_pool_str784[sizeof("radical")];
+ char uniname2ctype_pool_str787[sizeof("mong")];
+ char uniname2ctype_pool_str788[sizeof("canadianaboriginal")];
+ char uniname2ctype_pool_str792[sizeof("letternumber")];
+ char uniname2ctype_pool_str796[sizeof("insorasompeng")];
+ char uniname2ctype_pool_str797[sizeof("dash")];
+ char uniname2ctype_pool_str798[sizeof("wspace")];
+ char uniname2ctype_pool_str799[sizeof("ogam")];
+ char uniname2ctype_pool_str802[sizeof("invariationselectorssupplement")];
+ char uniname2ctype_pool_str803[sizeof("print")];
+ char uniname2ctype_pool_str811[sizeof("otheridcontinue")];
+ char uniname2ctype_pool_str815[sizeof("ingurmukhi")];
+ char uniname2ctype_pool_str818[sizeof("closepunctuation")];
+ char uniname2ctype_pool_str823[sizeof("olditalic")];
+ char uniname2ctype_pool_str824[sizeof("noncharactercodepoint")];
+ char uniname2ctype_pool_str826[sizeof("sharada")];
+ char uniname2ctype_pool_str827[sizeof("ingeometricshapes")];
+ char uniname2ctype_pool_str830[sizeof("otheralphabetic")];
+ char uniname2ctype_pool_str831[sizeof("patternwhitespace")];
+ char uniname2ctype_pool_str832[sizeof("po")];
+ char uniname2ctype_pool_str833[sizeof("rjng")];
+ char uniname2ctype_pool_str835[sizeof("ingreekandcoptic")];
+ char uniname2ctype_pool_str841[sizeof("xdigit")];
+ char uniname2ctype_pool_str850[sizeof("gothic")];
+ char uniname2ctype_pool_str851[sizeof("inoldsoutharabian")];
+ char uniname2ctype_pool_str852[sizeof("xidstart")];
+ char uniname2ctype_pool_str854[sizeof("inrejang")];
+ char uniname2ctype_pool_str860[sizeof("idsbinaryoperator")];
+ char uniname2ctype_pool_str867[sizeof("olower")];
+ char uniname2ctype_pool_str869[sizeof("hex")];
+ char uniname2ctype_pool_str870[sizeof("inenclosedideographicsupplement")];
+ char uniname2ctype_pool_str874[sizeof("inalphabeticpresentationforms")];
+ char uniname2ctype_pool_str879[sizeof("inbasiclatin")];
+ char uniname2ctype_pool_str884[sizeof("othersymbol")];
+ char uniname2ctype_pool_str889[sizeof("nd")];
+ char uniname2ctype_pool_str890[sizeof("sd")];
+ char uniname2ctype_pool_str900[sizeof("omath")];
+ char uniname2ctype_pool_str901[sizeof("separator")];
+ char uniname2ctype_pool_str907[sizeof("inarabic")];
+ char uniname2ctype_pool_str912[sizeof("xidcontinue")];
+ char uniname2ctype_pool_str913[sizeof("otheridstart")];
+ char uniname2ctype_pool_str914[sizeof("grext")];
+ char uniname2ctype_pool_str917[sizeof("otherlowercase")];
+ char uniname2ctype_pool_str919[sizeof("phli")];
+ char uniname2ctype_pool_str920[sizeof("cased")];
+ char uniname2ctype_pool_str923[sizeof("hang")];
+ char uniname2ctype_pool_str931[sizeof("xpeo")];
+ char uniname2ctype_pool_str933[sizeof("lower")];
+ char uniname2ctype_pool_str936[sizeof("modifierletter")];
+ char uniname2ctype_pool_str938[sizeof("inphoneticextensions")];
+ char uniname2ctype_pool_str939[sizeof("inarabicpresentationformsa")];
+ char uniname2ctype_pool_str943[sizeof("innumberforms")];
+ char uniname2ctype_pool_str945[sizeof("oldpersian")];
+ char uniname2ctype_pool_str946[sizeof("incyrillicextendeda")];
+ char uniname2ctype_pool_str947[sizeof("inverticalforms")];
+ char uniname2ctype_pool_str949[sizeof("p")];
+ char uniname2ctype_pool_str950[sizeof("inbyzantinemusicalsymbols")];
+ char uniname2ctype_pool_str951[sizeof("inmathematicaloperators")];
+ char uniname2ctype_pool_str952[sizeof("intibetan")];
+ char uniname2ctype_pool_str953[sizeof("zp")];
+ char uniname2ctype_pool_str956[sizeof("ingeorgian")];
+ char uniname2ctype_pool_str960[sizeof("inbraillepatterns")];
+ char uniname2ctype_pool_str962[sizeof("lepcha")];
+ char uniname2ctype_pool_str963[sizeof("geor")];
+ char uniname2ctype_pool_str964[sizeof("invedicextensions")];
+ char uniname2ctype_pool_str965[sizeof("linb")];
+ char uniname2ctype_pool_str966[sizeof("other")];
+ char uniname2ctype_pool_str970[sizeof("deva")];
+ char uniname2ctype_pool_str972[sizeof("indevanagari")];
+ char uniname2ctype_pool_str973[sizeof("othernumber")];
+ char uniname2ctype_pool_str974[sizeof("bamum")];
+ char uniname2ctype_pool_str976[sizeof("shrd")];
+ char uniname2ctype_pool_str977[sizeof("bali")];
+ char uniname2ctype_pool_str981[sizeof("devanagari")];
+ char uniname2ctype_pool_str983[sizeof("extender")];
+ char uniname2ctype_pool_str988[sizeof("inherited")];
+ char uniname2ctype_pool_str989[sizeof("glagolitic")];
+ char uniname2ctype_pool_str990[sizeof("tibt")];
+ char uniname2ctype_pool_str994[sizeof("inbalinese")];
+ char uniname2ctype_pool_str996[sizeof("ingothic")];
+ char uniname2ctype_pool_str997[sizeof("inmiscellaneousmathematicalsymbolsb")];
+ char uniname2ctype_pool_str998[sizeof("limb")];
+ char uniname2ctype_pool_str1000[sizeof("bengali")];
+ char uniname2ctype_pool_str1003[sizeof("phoenician")];
+ char uniname2ctype_pool_str1004[sizeof("insuperscriptsandsubscripts")];
+ char uniname2ctype_pool_str1006[sizeof("inmeroitichieroglyphs")];
+ char uniname2ctype_pool_str1007[sizeof("tibetan")];
+ char uniname2ctype_pool_str1010[sizeof("inphoneticextensionssupplement")];
+ char uniname2ctype_pool_str1016[sizeof("balinese")];
+ char uniname2ctype_pool_str1021[sizeof("lowercaseletter")];
+ char uniname2ctype_pool_str1031[sizeof("indingbats")];
+ char uniname2ctype_pool_str1035[sizeof("inprivateusearea")];
+ char uniname2ctype_pool_str1039[sizeof("assigned")];
+ char uniname2ctype_pool_str1044[sizeof("patternsyntax")];
+ char uniname2ctype_pool_str1051[sizeof("inhangulsyllables")];
+ char uniname2ctype_pool_str1065[sizeof("sarb")];
+ char uniname2ctype_pool_str1067[sizeof("brai")];
+ char uniname2ctype_pool_str1069[sizeof("insupplementalmathematicaloperators")];
+ char uniname2ctype_pool_str1070[sizeof("phnx")];
+ char uniname2ctype_pool_str1072[sizeof("ingreekextended")];
+ char uniname2ctype_pool_str1074[sizeof("otherletter")];
+ char uniname2ctype_pool_str1076[sizeof("arab")];
+ char uniname2ctype_pool_str1078[sizeof("inlatinextendedd")];
+ char uniname2ctype_pool_str1081[sizeof("word")];
+ char uniname2ctype_pool_str1084[sizeof("inphagspa")];
+ char uniname2ctype_pool_str1087[sizeof("inblockelements")];
+ char uniname2ctype_pool_str1092[sizeof("ethiopic")];
+ char uniname2ctype_pool_str1094[sizeof("inethiopicextendeda")];
+ char uniname2ctype_pool_str1107[sizeof("brahmi")];
+ char uniname2ctype_pool_str1110[sizeof("logicalorderexception")];
+ char uniname2ctype_pool_str1114[sizeof("inoldpersian")];
+ char uniname2ctype_pool_str1129[sizeof("inletterlikesymbols")];
+ char uniname2ctype_pool_str1133[sizeof("sorasompeng")];
+ char uniname2ctype_pool_str1135[sizeof("hiragana")];
+ char uniname2ctype_pool_str1142[sizeof("inhanguljamoextendeda")];
+ char uniname2ctype_pool_str1147[sizeof("othermath")];
+ char uniname2ctype_pool_str1150[sizeof("digit")];
+ char uniname2ctype_pool_str1151[sizeof("goth")];
+ char uniname2ctype_pool_str1156[sizeof("ogham")];
+ char uniname2ctype_pool_str1162[sizeof("sundanese")];
+ char uniname2ctype_pool_str1170[sizeof("saurashtra")];
+ char uniname2ctype_pool_str1173[sizeof("linearb")];
+ char uniname2ctype_pool_str1179[sizeof("graphemebase")];
+ char uniname2ctype_pool_str1185[sizeof("inunifiedcanadianaboriginalsyllabics")];
+ char uniname2ctype_pool_str1186[sizeof("cuneiform")];
+ char uniname2ctype_pool_str1188[sizeof("inkannada")];
+ char uniname2ctype_pool_str1190[sizeof("kana")];
+ char uniname2ctype_pool_str1195[sizeof("inancientgreeknumbers")];
+ char uniname2ctype_pool_str1196[sizeof("incjkstrokes")];
+ char uniname2ctype_pool_str1198[sizeof("inglagolitic")];
+ char uniname2ctype_pool_str1202[sizeof("inancientgreekmusicalnotation")];
+ char uniname2ctype_pool_str1212[sizeof("inchakma")];
+ char uniname2ctype_pool_str1215[sizeof("plrd")];
+ char uniname2ctype_pool_str1219[sizeof("inbrahmi")];
+ char uniname2ctype_pool_str1224[sizeof("cakm")];
+ char uniname2ctype_pool_str1225[sizeof("incjkcompatibilityforms")];
+ char uniname2ctype_pool_str1229[sizeof("lisu")];
+ char uniname2ctype_pool_str1230[sizeof("incjkcompatibilityideographs")];
+ char uniname2ctype_pool_str1231[sizeof("intagalog")];
+ char uniname2ctype_pool_str1244[sizeof("inkaithi")];
+ char uniname2ctype_pool_str1245[sizeof("insupplementalarrowsa")];
+ char uniname2ctype_pool_str1249[sizeof("takri")];
+ char uniname2ctype_pool_str1253[sizeof("ideographic")];
+ char uniname2ctype_pool_str1256[sizeof("hexdigit")];
+ char uniname2ctype_pool_str1259[sizeof("glag")];
+ char uniname2ctype_pool_str1261[sizeof("softdotted")];
+ char uniname2ctype_pool_str1262[sizeof("variationselector")];
+ char uniname2ctype_pool_str1264[sizeof("inkatakana")];
+ char uniname2ctype_pool_str1265[sizeof("meeteimayek")];
+ char uniname2ctype_pool_str1274[sizeof("otherpunctuation")];
+ char uniname2ctype_pool_str1279[sizeof("inhanguljamo")];
+ char uniname2ctype_pool_str1282[sizeof("kali")];
+ char uniname2ctype_pool_str1289[sizeof("braille")];
+ char uniname2ctype_pool_str1298[sizeof("incombininghalfmarks")];
+ char uniname2ctype_pool_str1300[sizeof("talu")];
+ char uniname2ctype_pool_str1302[sizeof("incjkcompatibilityideographssupplement")];
+ char uniname2ctype_pool_str1306[sizeof("telu")];
+ char uniname2ctype_pool_str1307[sizeof("idsb")];
+ char uniname2ctype_pool_str1310[sizeof("tglg")];
+ char uniname2ctype_pool_str1313[sizeof("inmeeteimayek")];
+ char uniname2ctype_pool_str1315[sizeof("yi")];
+ char uniname2ctype_pool_str1318[sizeof("phagspa")];
+ char uniname2ctype_pool_str1321[sizeof("yiii")];
+ char uniname2ctype_pool_str1323[sizeof("inarabicmathematicalalphabeticsymbols")];
+ char uniname2ctype_pool_str1328[sizeof("saur")];
+ char uniname2ctype_pool_str1330[sizeof("ogrext")];
+ char uniname2ctype_pool_str1334[sizeof("bidic")];
+ char uniname2ctype_pool_str1341[sizeof("inkanasupplement")];
+ char uniname2ctype_pool_str1343[sizeof("runic")];
+ char uniname2ctype_pool_str1344[sizeof("inalchemicalsymbols")];
+ char uniname2ctype_pool_str1350[sizeof("georgian")];
+ char uniname2ctype_pool_str1351[sizeof("inugaritic")];
+ char uniname2ctype_pool_str1354[sizeof("insaurashtra")];
+ char uniname2ctype_pool_str1356[sizeof("inhighprivateusesurrogates")];
+ char uniname2ctype_pool_str1362[sizeof("pd")];
+ char uniname2ctype_pool_str1372[sizeof("incountingrodnumerals")];
+ char uniname2ctype_pool_str1377[sizeof("inarabicextendeda")];
+ char uniname2ctype_pool_str1389[sizeof("inkharoshthi")];
+ char uniname2ctype_pool_str1393[sizeof("idstrinaryoperator")];
+ char uniname2ctype_pool_str1396[sizeof("phag")];
+ char uniname2ctype_pool_str1398[sizeof("brah")];
+ char uniname2ctype_pool_str1402[sizeof("mark")];
+ char uniname2ctype_pool_str1404[sizeof("hebr")];
+ char uniname2ctype_pool_str1411[sizeof("inkhmersymbols")];
+ char uniname2ctype_pool_str1413[sizeof("dep")];
+ char uniname2ctype_pool_str1416[sizeof("inkhmer")];
+ char uniname2ctype_pool_str1422[sizeof("deprecated")];
+ char uniname2ctype_pool_str1424[sizeof("rejang")];
+ char uniname2ctype_pool_str1429[sizeof("lyci")];
+ char uniname2ctype_pool_str1431[sizeof("intakri")];
+ char uniname2ctype_pool_str1432[sizeof("takr")];
+ char uniname2ctype_pool_str1435[sizeof("incyrillicsupplement")];
+ char uniname2ctype_pool_str1436[sizeof("changeswhencasefolded")];
+ char uniname2ctype_pool_str1438[sizeof("indevanagariextended")];
+ char uniname2ctype_pool_str1442[sizeof("lycian")];
+ char uniname2ctype_pool_str1443[sizeof("inbengali")];
+ char uniname2ctype_pool_str1448[sizeof("beng")];
+ char uniname2ctype_pool_str1450[sizeof("graph")];
+ char uniname2ctype_pool_str1452[sizeof("inyijinghexagramsymbols")];
+ char uniname2ctype_pool_str1457[sizeof("olck")];
+ char uniname2ctype_pool_str1460[sizeof("inarabicsupplement")];
+ char uniname2ctype_pool_str1462[sizeof("inbuginese")];
+ char uniname2ctype_pool_str1463[sizeof("changeswhencasemapped")];
+ char uniname2ctype_pool_str1468[sizeof("olchiki")];
+ char uniname2ctype_pool_str1478[sizeof("inaegeannumbers")];
+ char uniname2ctype_pool_str1479[sizeof("mlym")];
+ char uniname2ctype_pool_str1480[sizeof("alphabetic")];
+ char uniname2ctype_pool_str1492[sizeof("sylotinagri")];
+ char uniname2ctype_pool_str1498[sizeof("changeswhentitlecased")];
+ char uniname2ctype_pool_str1504[sizeof("tagalog")];
+ char uniname2ctype_pool_str1505[sizeof("tagb")];
+ char uniname2ctype_pool_str1506[sizeof("runr")];
+ char uniname2ctype_pool_str1510[sizeof("malayalam")];
+ char uniname2ctype_pool_str1512[sizeof("inoriya")];
+ char uniname2ctype_pool_str1516[sizeof("intagbanwa")];
+ char uniname2ctype_pool_str1517[sizeof("syrc")];
+ char uniname2ctype_pool_str1519[sizeof("nko")];
+ char uniname2ctype_pool_str1520[sizeof("nkoo")];
+ char uniname2ctype_pool_str1523[sizeof("inethiopicextended")];
+ char uniname2ctype_pool_str1525[sizeof("kaithi")];
+ char uniname2ctype_pool_str1530[sizeof("mathsymbol")];
+ char uniname2ctype_pool_str1531[sizeof("inyiradicals")];
+ char uniname2ctype_pool_str1536[sizeof("insupplementaryprivateuseareaa")];
+ char uniname2ctype_pool_str1540[sizeof("osmanya")];
+ char uniname2ctype_pool_str1546[sizeof("syriac")];
+ char uniname2ctype_pool_str1548[sizeof("otherdefaultignorablecodepoint")];
+ char uniname2ctype_pool_str1561[sizeof("number")];
+ char uniname2ctype_pool_str1565[sizeof("inlinearbsyllabary")];
+ char uniname2ctype_pool_str1566[sizeof("kthi")];
+ char uniname2ctype_pool_str1567[sizeof("sund")];
+ char uniname2ctype_pool_str1569[sizeof("mymr")];
+ char uniname2ctype_pool_str1571[sizeof("incombiningdiacriticalmarks")];
+ char uniname2ctype_pool_str1578[sizeof("enclosingmark")];
+ char uniname2ctype_pool_str1581[sizeof("incombiningdiacriticalmarksforsymbols")];
+ char uniname2ctype_pool_str1583[sizeof("inethiopicsupplement")];
+ char uniname2ctype_pool_str1590[sizeof("unassigned")];
+ char uniname2ctype_pool_str1591[sizeof("sylo")];
+ char uniname2ctype_pool_str1595[sizeof("combiningmark")];
+ char uniname2ctype_pool_str1598[sizeof("myanmar")];
+ char uniname2ctype_pool_str1605[sizeof("graphemeextend")];
+ char uniname2ctype_pool_str1606[sizeof("bidicontrol")];
+ char uniname2ctype_pool_str1609[sizeof("inhalfwidthandfullwidthforms")];
+ char uniname2ctype_pool_str1617[sizeof("cyrl")];
+ char uniname2ctype_pool_str1620[sizeof("knda")];
+ char uniname2ctype_pool_str1634[sizeof("inunifiedcanadianaboriginalsyllabicsextended")];
+ char uniname2ctype_pool_str1635[sizeof("xsux")];
+ char uniname2ctype_pool_str1636[sizeof("modifiersymbol")];
+ char uniname2ctype_pool_str1643[sizeof("incombiningdiacriticalmarkssupplement")];
+ char uniname2ctype_pool_str1645[sizeof("inhanunoo")];
+ char uniname2ctype_pool_str1648[sizeof("inbuhid")];
+ char uniname2ctype_pool_str1649[sizeof("kannada")];
+ char uniname2ctype_pool_str1658[sizeof("inhebrew")];
+ char uniname2ctype_pool_str1662[sizeof("grbase")];
+ char uniname2ctype_pool_str1664[sizeof("spacingmark")];
+ char uniname2ctype_pool_str1670[sizeof("inkatakanaphoneticextensions")];
+ char uniname2ctype_pool_str1676[sizeof("hangul")];
+ char uniname2ctype_pool_str1683[sizeof("incjksymbolsandpunctuation")];
+ char uniname2ctype_pool_str1688[sizeof("bopo")];
+ char uniname2ctype_pool_str1692[sizeof("orya")];
+ char uniname2ctype_pool_str1699[sizeof("inbopomofo")];
+ char uniname2ctype_pool_str1701[sizeof("kharoshthi")];
+ char uniname2ctype_pool_str1703[sizeof("khar")];
+ char uniname2ctype_pool_str1709[sizeof("changeswhenlowercased")];
+ char uniname2ctype_pool_str1724[sizeof("khmr")];
+ char uniname2ctype_pool_str1725[sizeof("punct")];
+ char uniname2ctype_pool_str1729[sizeof("symbol")];
+ char uniname2ctype_pool_str1732[sizeof("cherokee")];
+ char uniname2ctype_pool_str1737[sizeof("cyrillic")];
+ char uniname2ctype_pool_str1759[sizeof("inkangxiradicals")];
+ char uniname2ctype_pool_str1761[sizeof("hebrew")];
+ char uniname2ctype_pool_str1780[sizeof("inarabicpresentationformsb")];
+ char uniname2ctype_pool_str1787[sizeof("incyrillicextendedb")];
+ char uniname2ctype_pool_str1790[sizeof("ugaritic")];
+ char uniname2ctype_pool_str1829[sizeof("incurrencysymbols")];
+ char uniname2ctype_pool_str1831[sizeof("meroitichieroglyphs")];
+ char uniname2ctype_pool_str1835[sizeof("inhighsurrogates")];
+ char uniname2ctype_pool_str1853[sizeof("nonspacingmark")];
+ char uniname2ctype_pool_str1858[sizeof("lydi")];
+ char uniname2ctype_pool_str1864[sizeof("patsyn")];
+ char uniname2ctype_pool_str1868[sizeof("orkh")];
+ char uniname2ctype_pool_str1871[sizeof("lydian")];
+ char uniname2ctype_pool_str1896[sizeof("ugar")];
+ char uniname2ctype_pool_str1899[sizeof("othergraphemeextend")];
+ char uniname2ctype_pool_str1900[sizeof("inlatinextendedb")];
+ char uniname2ctype_pool_str1904[sizeof("bopomofo")];
+ char uniname2ctype_pool_str1917[sizeof("khmer")];
+ char uniname2ctype_pool_str1925[sizeof("uideo")];
+ char uniname2ctype_pool_str1932[sizeof("otheruppercase")];
+ char uniname2ctype_pool_str1944[sizeof("grek")];
+ char uniname2ctype_pool_str1949[sizeof("gujr")];
+ char uniname2ctype_pool_str1970[sizeof("gujarati")];
+ char uniname2ctype_pool_str1983[sizeof("inhanguljamoextendedb")];
+ char uniname2ctype_pool_str1988[sizeof("defaultignorablecodepoint")];
+ char uniname2ctype_pool_str2005[sizeof("inplayingcards")];
+ char uniname2ctype_pool_str2022[sizeof("bamu")];
+ char uniname2ctype_pool_str2028[sizeof("inkanbun")];
+ char uniname2ctype_pool_str2033[sizeof("incjkradicalssupplement")];
+ char uniname2ctype_pool_str2046[sizeof("cypriot")];
+ char uniname2ctype_pool_str2051[sizeof("inbamum")];
+ char uniname2ctype_pool_str2053[sizeof("inmeroiticcursive")];
+ char uniname2ctype_pool_str2055[sizeof("oldturkic")];
+ char uniname2ctype_pool_str2086[sizeof("insupplementalarrowsb")];
+ char uniname2ctype_pool_str2087[sizeof("surrogate")];
+ char uniname2ctype_pool_str2094[sizeof("batk")];
+ char uniname2ctype_pool_str2102[sizeof("inbatak")];
+ char uniname2ctype_pool_str2119[sizeof("inlimbu")];
+ char uniname2ctype_pool_str2123[sizeof("incypriotsyllabary")];
+ char uniname2ctype_pool_str2129[sizeof("dashpunctuation")];
+ char uniname2ctype_pool_str2130[sizeof("innoblock")];
+ char uniname2ctype_pool_str2141[sizeof("hyphen")];
+ char uniname2ctype_pool_str2162[sizeof("insupplementalpunctuation")];
+ char uniname2ctype_pool_str2165[sizeof("ingeorgiansupplement")];
+ char uniname2ctype_pool_str2178[sizeof("oupper")];
+ char uniname2ctype_pool_str2189[sizeof("paragraphseparator")];
+ char uniname2ctype_pool_str2194[sizeof("inbamumsupplement")];
+ char uniname2ctype_pool_str2299[sizeof("uppercase")];
+ char uniname2ctype_pool_str2313[sizeof("currencysymbol")];
+ char uniname2ctype_pool_str2322[sizeof("sk")];
+ char uniname2ctype_pool_str2338[sizeof("lu")];
+ char uniname2ctype_pool_str2342[sizeof("openpunctuation")];
+ char uniname2ctype_pool_str2349[sizeof("inlisu")];
+ char uniname2ctype_pool_str2371[sizeof("qmark")];
+ char uniname2ctype_pool_str2372[sizeof("egyp")];
+ char uniname2ctype_pool_str2377[sizeof("insupplementaryprivateuseareab")];
+ char uniname2ctype_pool_str2379[sizeof("limbu")];
+ char uniname2ctype_pool_str2400[sizeof("inegyptianhieroglyphs")];
+ char uniname2ctype_pool_str2401[sizeof("unifiedideograph")];
+ char uniname2ctype_pool_str2413[sizeof("intelugu")];
+ char uniname2ctype_pool_str2429[sizeof("katakana")];
+ char uniname2ctype_pool_str2442[sizeof("inhangulcompatibilityjamo")];
+ char uniname2ctype_pool_str2454[sizeof("upper")];
+ char uniname2ctype_pool_str2495[sizeof("inkayahli")];
+ char uniname2ctype_pool_str2515[sizeof("cwu")];
+ char uniname2ctype_pool_str2523[sizeof("incjkcompatibility")];
+ char uniname2ctype_pool_str2542[sizeof("uppercaseletter")];
+ char uniname2ctype_pool_str2549[sizeof("bugi")];
+ char uniname2ctype_pool_str2588[sizeof("buginese")];
+ char uniname2ctype_pool_str2627[sizeof("any")];
+ char uniname2ctype_pool_str2651[sizeof("inyisyllables")];
+ char uniname2ctype_pool_str2671[sizeof("inbopomofoextended")];
+ char uniname2ctype_pool_str2710[sizeof("inboxdrawing")];
+ char uniname2ctype_pool_str2724[sizeof("changeswhenuppercased")];
+ char uniname2ctype_pool_str2727[sizeof("unknown")];
+ char uniname2ctype_pool_str2737[sizeof("quotationmark")];
+ char uniname2ctype_pool_str2753[sizeof("buhd")];
+ char uniname2ctype_pool_str2785[sizeof("punctuation")];
+ char uniname2ctype_pool_str2888[sizeof("oldsoutharabian")];
+ char uniname2ctype_pool_str2925[sizeof("kayahli")];
+ char uniname2ctype_pool_str2940[sizeof("incjkunifiedideographs")];
+ char uniname2ctype_pool_str2961[sizeof("incjkunifiedideographsextensiona")];
+ char uniname2ctype_pool_str2962[sizeof("incjkunifiedideographsextensionc")];
+ char uniname2ctype_pool_str2995[sizeof("telugu")];
+ char uniname2ctype_pool_str3000[sizeof("guru")];
+ char uniname2ctype_pool_str3104[sizeof("greek")];
+ char uniname2ctype_pool_str3189[sizeof("grlink")];
+ char uniname2ctype_pool_str3197[sizeof("buhid")];
+ char uniname2ctype_pool_str3254[sizeof("batak")];
+ char uniname2ctype_pool_str3292[sizeof("blank")];
+ char uniname2ctype_pool_str3391[sizeof("incjkunifiedideographsextensiond")];
+ char uniname2ctype_pool_str3459[sizeof("graphemelink")];
+ char uniname2ctype_pool_str3480[sizeof("egyptianhieroglyphs")];
+ char uniname2ctype_pool_str3802[sizeof("incjkunifiedideographsextensionb")];
+ char uniname2ctype_pool_str3922[sizeof("zyyy")];
+ char uniname2ctype_pool_str4167[sizeof("gurmukhi")];
#endif /* USE_UNICODE_PROPERTIES */
};
static const struct uniname2ctype_pool_t uniname2ctype_pool_contents =
{
#ifndef USE_UNICODE_PROPERTIES
+ "word",
"print",
"punct",
+ "alpha",
+ "alnum",
+ "xdigit",
+ "upper",
#else /* USE_UNICODE_PROPERTIES */
"n",
- "l",
- "nl",
- "ll",
+ "s",
+ "z",
+ "zs",
+ "zzzz",
"cn",
- "no",
- "lo",
+ "cs",
+ "ci",
"c",
- "co",
+ "cf",
+ "sc",
+ "cans",
+ "qaai",
+ "mn",
+#endif /* USE_UNICODE_PROPERTIES */
+ "ascii",
+#ifdef USE_UNICODE_PROPERTIES
"cc",
- "lao",
- "laoo",
- "lana",
- "ci",
"qaac",
- "vai",
- "vaii",
- "qaai",
- "control",
+ "inavestan",
+ "inspecials",
+ "inipaextensions",
+ "mc",
+ "insamaritan",
+ "m",
+ "sm",
+ "me",
+ "inarmenian",
+ "incuneiform",
+ "mandaic",
+ "inancientsymbols",
+ "incuneiformnumbersandpunctuation",
+ "inthai",
+ "inmusicalsymbols",
+ "inmiscellaneoussymbols",
+ "incham",
+ "inmiscellaneoussymbolsandarrows",
+ "initialpunctuation",
+ "inmiscellaneoussymbolsandpictographs",
+ "inthaana",
+ "taile",
+ "mtei",
+ "lc",
+ "lana",
+ "inlycian",
+ "intransportandmapsymbols",
+ "incontrolpictures",
+ "sinhala",
+ "incommonindicnumberforms",
+ "inmiscellaneousmathematicalsymbolsa",
+ "sterm",
+ "inmyanmarextendeda",
+ "lm",
+ "taiviet",
+ "inlinearbideograms",
+ "intaitham",
+ "latn",
+ "latin",
+ "ital",
+ "alnum",
+ "inmalayalam",
+ "intaile",
+ "tale",
+ "l",
+ "nl",
+ "zl",
+ "intamil",
+ "taml",
+ "inlatinextendeda",
+ "inlatinextendedc",
+ "inrunic",
+ "incarian",
+ "insyriac",
"cari",
+ "inmeeteimayekextensions",
+ "osma",
+ "lt",
+ "miao",
+ "insharada",
+ "incyrillic",
"carian",
- "zl",
- "oriya",
- "latn",
+ "armn",
+ "samr",
+ "armi",
+ "inideographicdescriptioncharacters",
+ "inosmanya",
+ "armenian",
+ "inmyanmar",
+ "samaritan",
+ "arabic",
+ "incherokee",
+ "connectorpunctuation",
+ "merc",
+ "inmiscellaneoustechnical",
+ "inenclosedalphanumerics",
+ "inemoticons",
+ "joinc",
+#endif /* USE_UNICODE_PROPERTIES */
"cntrl",
- "latin",
+#ifdef USE_UNICODE_PROPERTIES
+ "inenclosedcjklettersandmonths",
+ "cwcf",
+ "inruminumeralsymbols",
+ "ll",
+ "term",
+ "inlatinextendedadditional",
+ "tamil",
+ "loe",
+ "newtailue",
+ "cwcm",
+ "inenclosedalphanumericsupplement",
+ "sinh",
+ "zinh",
+ "meroiticcursive",
"han",
- "arabic",
- "ital",
- "hano",
"hani",
- "hanunoo",
- "lt",
+ "inopticalcharacterrecognition",
+ "no",
"so",
- "hira",
- "nchar",
- "sc",
- "z",
- "oalpha",
- "tavt",
- "cans",
- "java",
- "zinh",
- "thaa",
+ "innewtailue",
+ "insinhala",
+ "innko",
+ "co",
+ "shavian",
+ "terminalpunctuation",
+ "intaixuanjingsymbols",
+ "inethiopic",
+ "sora",
+ "inarrows",
+ "cham",
+ "inlowsurrogates",
+ "oriya",
+ "ext",
+ "cwt",
+ "common",
+ "inmiao",
"thai",
- "variationselector",
- "sinhala",
- "joinc",
- "ascii",
- "initialpunctuation",
- "other",
- "joincontrol",
+ "intifinagh",
+ "ethi",
+ "mero",
+ "chakma",
+ "thaa",
+ "inscriptionalparthian",
+ "tifinagh",
+ "titlecaseletter",
"thaana",
- "avst",
- "olower",
- "othernumber",
- "otherletter",
- "sinh",
- "tale",
- "connectorpunctuation",
- "s",
+ "asciihexdigit",
+ "math",
"di",
- "vs",
- "oidc",
- "idc",
- "odi",
- "cs",
- "avestan",
+ "ids",
+ "lo",
+ "inlao",
+ "taitham",
+ "lao",
+ "laoo",
"dia",
- "cher",
- "inscriptionalparthian",
- "shavian",
- "radical",
- "loe",
- "diacritic",
- "zzzz",
- "ethi",
- "canadianaboriginal",
- "zs",
- "othersymbol",
- "olditalic",
- "inscriptionalpahlavi",
- "taiviet",
+ "idc",
+ "ps",
+ "insundanese",
+ "pi",
+ "cwl",
+ "pf",
+ "mand",
+ "insylotinagri",
+ "vs",
+ "mongolian",
+ "pc",
+ "inmandaic",
+ "invai",
"lineseparator",
- "otheridstart",
- "oids",
- "asciihexdigit",
- "inherited",
- "otherlowercase",
- "terminalpunctuation",
- "deva",
- "otheralphabetic",
- "ideo",
- "noncharactercodepoint",
- "otheridcontinue",
- "taile",
- "oldpersian",
- "devanagari",
- "letter",
- "nd",
+ "pe",
+ "vai",
+ "vaii",
"idst",
- "dsrt",
- "titlecaseletter",
- "po",
- "dash",
- "pc",
- "letternumber",
- "pi",
- "javanese",
- "mn",
- "idstart",
- "idcontinue",
- "ids",
+ "indominotiles",
+ "inshavian",
+ "inspacingmodifierletters",
+ "format",
+ "inphaistosdisc",
+ "hano",
#endif /* USE_UNICODE_PROPERTIES */
- "alpha",
+ "space",
#ifdef USE_UNICODE_PROPERTIES
- "mc",
- "coptic",
- "mongolian",
- "common",
- "armn",
- "copt",
- "cprt",
- "armi",
- "phli",
- "prti",
- "armenian",
- "sd",
- "mandaic",
- "phoenician",
- "taml",
- "tamil",
- "cased",
- "cham",
- "idsbinaryoperator",
- "lepc",
- "otherdefaultignorablecodepoint",
- "print",
- "osma",
- "samr",
- "math",
- "linb",
- "closepunctuation",
- "otherpunctuation",
- "bali",
- "omath",
- "samaritan",
- "ps",
- "arab",
- "brai",
- "taitham",
- "linearb",
- "lepcha",
- "mand",
- "mtei",
- "term",
- "glagolitic",
- "privateuse",
- "pe",
- "deseret",
- "brah",
- "runr",
- "othermath",
- "runic",
- "hang",
- "ethiopic",
- "me",
+ "indeseret",
+ "inolchiki",
+ "hira",
+ "joincontrol",
+ "idcontinue",
+ "inmahjongtiles",
"patws",
- "separator",
- "tibt",
- "gothic",
- "tagbanwa",
- "sarb",
- "talu",
- "tibetan",
- "goth",
- "rjng",
- "hangul",
- "bengali",
- "hiragana",
- "braille",
- "geor",
+ "inlydian",
+ "cher",
+ "inhiragana",
+ "inogham",
+ "avst",
+ "inscriptionalpahlavi",
+ "incoptic",
+ "java",
+ "inmathematicalalphanumericsymbols",
+ "letter",
+ "injavanese",
+ "avestan",
"age=1.1",
+ "lepc",
"age=2.1",
+ "inlepcha",
+ "javanese",
+ "shaw",
+ "finalpunctuation",
+ "alpha",
"age=5.1",
+ "inmongolian",
"age=5.2",
- "age=4.1",
- "p",
- "pd",
- "lisu",
"age=2.0",
+ "ahex",
+ "ingeneralpunctuation",
+ "oids",
+ "odi",
"age=5.0",
- "age=6.0",
- "age=4.0",
- "graph",
- "saur",
- "space",
+ "tavt",
+ "intaiviet",
+ "age=6.1",
"age=3.1",
+ "insundanesesupplement",
"age=3.2",
- "hebr",
- "bidic",
+ "age=4.1",
+ "oidc",
+ "tfng",
+ "insmallformvariants",
+ "ideo",
+ "intags",
+ "age=6.0",
"age=3.0",
- "bidicontrol",
- "logicalorderexception",
- "telu",
- "zp",
- "m",
- "lm",
- "idstrinaryoperator",
- "balinese",
- "uideo",
- "spaceseparator",
- "grext",
-#endif /* USE_UNICODE_PROPERTIES */
- "alnum",
-#ifdef USE_UNICODE_PROPERTIES
- "oldturkic",
+ "whitespace",
+ "age=4.0",
+ "inolditalic",
+ "oalpha",
+ "ingujarati",
+ "control",
+ "diacritic",
+ "tagbanwa",
+ "inphoenician",
+ "ininscriptionalparthian",
+ "ininscriptionalpahlavi",
+ "coptic",
+ "dsrt",
+ "inmodifiertoneletters",
+ "xids",
+ "hanunoo",
+ "inoldturkic",
"xidc",
- "idsb",
- "ahex",
- "format",
+ "idstart",
+ "inimperialaramaic",
+ "invariationselectors",
+ "copt",
"caseignorable",
- "tifinagh",
- "sundanese",
- "ext",
- "saurashtra",
- "patternwhitespace",
- "digit",
- "sund",
+ "prti",
+ "nchar",
+ "deseret",
"decimalnumber",
- "bopo",
- "sm",
- "otheruppercase",
- "ideographic",
- "xids",
- "unassigned",
- "phagspa",
- "alphabetic",
- "limb",
-#endif /* USE_UNICODE_PROPERTIES */
+ "cprt",
+ "inlatin1supplement",
+ "imperialaramaic",
+ "privateuse",
+ "casedletter",
+ "lowercase",
+ "spaceseparator",
+ "radical",
+ "mong",
+ "canadianaboriginal",
+ "letternumber",
+ "insorasompeng",
+ "dash",
+ "wspace",
+ "ogam",
+ "invariationselectorssupplement",
+ "print",
+ "otheridcontinue",
+ "ingurmukhi",
+ "closepunctuation",
+ "olditalic",
+ "noncharactercodepoint",
+ "sharada",
+ "ingeometricshapes",
+ "otheralphabetic",
+ "patternwhitespace",
+ "po",
+ "rjng",
+ "ingreekandcoptic",
"xdigit",
-#ifdef USE_UNICODE_PROPERTIES
+ "gothic",
+ "inoldsoutharabian",
"xidstart",
- "mong",
+ "inrejang",
+ "idsbinaryoperator",
+ "olower",
+ "hex",
+ "inenclosedideographicsupplement",
+ "inalphabeticpresentationforms",
+ "inbasiclatin",
+ "othersymbol",
+ "nd",
+ "sd",
+ "omath",
+ "separator",
+ "inarabic",
"xidcontinue",
+ "otheridstart",
+ "grext",
+ "otherlowercase",
+ "phli",
+ "cased",
+ "hang",
+ "xpeo",
+#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",
+ "tibt",
+ "inbalinese",
+ "ingothic",
+ "inmiscellaneousmathematicalsymbolsb",
+ "limb",
+ "bengali",
+ "phoenician",
+ "insuperscriptsandsubscripts",
+ "inmeroitichieroglyphs",
+ "tibetan",
+ "inphoneticextensionssupplement",
+ "balinese",
+ "lowercaseletter",
+ "indingbats",
+ "inprivateusearea",
"assigned",
- "ogam",
- "nko",
- "nkoo",
- "olck",
- "deprecated",
+ "patternsyntax",
+ "inhangulsyllables",
+ "sarb",
+ "brai",
+ "insupplementalmathematicaloperators",
+ "phnx",
+ "ingreekextended",
+ "otherletter",
+ "arab",
+ "inlatinextendedd",
+ "word",
+ "inphagspa",
+ "inblockelements",
+ "ethiopic",
+ "inethiopicextendeda",
"brahmi",
- "phag",
+ "logicalorderexception",
+ "inoldpersian",
+ "inletterlikesymbols",
+ "sorasompeng",
+ "hiragana",
+ "inhanguljamoextendeda",
+ "othermath",
+#endif /* USE_UNICODE_PROPERTIES */
+ "digit",
+#ifndef USE_UNICODE_PROPERTIES
+ "blank"
+#else /* USE_UNICODE_PROPERTIES */
+ "goth",
+ "ogham",
+ "sundanese",
+ "saurashtra",
+ "linearb",
+ "graphemebase",
+ "inunifiedcanadianaboriginalsyllabics",
+ "cuneiform",
+ "inkannada",
"kana",
+ "inancientgreeknumbers",
+ "incjkstrokes",
+ "inglagolitic",
+ "inancientgreekmusicalnotation",
+ "inchakma",
+ "plrd",
+ "inbrahmi",
+ "cakm",
+ "incjkcompatibilityforms",
+ "lisu",
+ "incjkcompatibilityideographs",
+ "intagalog",
+ "inkaithi",
+ "insupplementalarrowsa",
+ "takri",
+ "ideographic",
+ "hexdigit",
+ "glag",
+ "softdotted",
+ "variationselector",
+ "inkatakana",
+ "meeteimayek",
+ "otherpunctuation",
+ "inhanguljamo",
"kali",
- "changeswhenlowercased",
- "extender",
- "dep",
- "olchiki",
- "cwl",
- "graphemebase",
- "phnx",
- "orkh",
- "punct",
- "khar",
- "lower",
- "sterm",
+ "braille",
+ "incombininghalfmarks",
+ "talu",
+ "incjkcompatibilityideographssupplement",
+ "telu",
+ "idsb",
+ "tglg",
+ "inmeeteimayek",
"yi",
+ "phagspa",
+ "yiii",
+ "inarabicmathematicalalphabeticsymbols",
+ "saur",
+ "ogrext",
+ "bidic",
+ "inkanasupplement",
+ "runic",
+ "inalchemicalsymbols",
+ "georgian",
+ "inugaritic",
+ "insaurashtra",
+ "inhighprivateusesurrogates",
+ "pd",
+ "incountingrodnumerals",
+ "inarabicextendeda",
+ "inkharoshthi",
+ "idstrinaryoperator",
+ "phag",
+ "brah",
+ "mark",
+ "hebr",
+ "inkhmersymbols",
+ "dep",
+ "inkhmer",
+ "deprecated",
+ "rejang",
"lyci",
- "cyrl",
+ "intakri",
+ "takr",
+ "incyrillicsupplement",
+ "changeswhencasefolded",
+ "indevanagariextended",
"lycian",
- "finalpunctuation",
- "orya",
- "graphemeextend",
- "kaithi",
- "xpeo",
- "yiii",
- "kthi",
- "cyrillic",
- "glag",
- "oupper",
- "tagb",
- "cwt",
- "number",
- "tglg",
- "knda",
- "lowercaseletter",
+ "inbengali",
+ "beng",
+ "graph",
+ "inyijinghexagramsymbols",
+ "olck",
+ "inarabicsupplement",
+ "inbuginese",
+ "changeswhencasemapped",
+ "olchiki",
+ "inaegeannumbers",
+ "mlym",
+ "alphabetic",
+ "sylotinagri",
"changeswhentitlecased",
- "softdotted",
- "ugar",
- "sylo",
- "lu",
"tagalog",
- "kharoshthi",
+ "tagb",
+ "runr",
+ "malayalam",
+ "inoriya",
+ "intagbanwa",
"syrc",
- "kannada",
- "beng",
- "lowercase",
- "shaw",
- "patternsyntax",
+ "nko",
+ "nkoo",
+ "inethiopicextended",
+ "kaithi",
+ "mathsymbol",
+ "inyiradicals",
+ "insupplementaryprivateuseareaa",
+ "osmanya",
"syriac",
- "word",
- "imperialaramaic",
- "ugaritic",
+ "otherdefaultignorablecodepoint",
+ "number",
+ "inlinearbsyllabary",
+ "kthi",
+ "sund",
+ "mymr",
+ "incombiningdiacriticalmarks",
"enclosingmark",
- "georgian",
+ "incombiningdiacriticalmarksforsymbols",
+ "inethiopicsupplement",
+ "unassigned",
+ "sylo",
+ "combiningmark",
+ "myanmar",
+ "graphemeextend",
+ "bidicontrol",
+ "inhalfwidthandfullwidthforms",
+ "cyrl",
+ "knda",
+ "inunifiedcanadianaboriginalsyllabicsextended",
+ "xsux",
+ "modifiersymbol",
+ "incombiningdiacriticalmarkssupplement",
+ "inhanunoo",
+ "inbuhid",
+ "kannada",
+ "inhebrew",
+ "grbase",
+ "spacingmark",
+ "inkatakanaphoneticextensions",
+ "hangul",
+ "incjksymbolsandpunctuation",
+ "bopo",
+ "orya",
+ "inbopomofo",
+ "kharoshthi",
+ "khar",
+ "changeswhenlowercased",
+ "khmr",
+ "punct",
+ "symbol",
+ "cherokee",
+ "cyrillic",
+ "inkangxiradicals",
+ "hebrew",
+ "inarabicpresentationformsb",
+ "incyrillicextendedb",
+ "ugaritic",
+ "incurrencysymbols",
+ "meroitichieroglyphs",
+ "inhighsurrogates",
+ "nonspacingmark",
"lydi",
+ "patsyn",
+ "orkh",
"lydian",
- "sylotinagri",
- "gujr",
- "tfng",
- "currencysymbol",
-#endif /* USE_UNICODE_PROPERTIES */
- "newline",
-#ifdef USE_UNICODE_PROPERTIES
+ "ugar",
+ "othergraphemeextend",
+ "inlatinextendedb",
"bopomofo",
- "ogrext",
- "cherokee",
+ "khmer",
+ "uideo",
+ "otheruppercase",
+ "grek",
+ "gujr",
"gujarati",
- "newtailue",
- "dashpunctuation",
- "oldsoutharabian",
-#endif /* USE_UNICODE_PROPERTIES */
- "upper",
-#ifndef USE_UNICODE_PROPERTIES
- "ascii",
- "cntrl",
- "space",
- "word",
- "lower",
- "graph",
- "digit",
- "blank"
-#else /* USE_UNICODE_PROPERTIES */
- "cf",
- "buhd",
- "rejang",
- "othergraphemeextend",
- "modifierletter",
- "nonspacingmark",
- "changeswhencasemapped",
- "mark",
+ "inhanguljamoextendedb",
+ "defaultignorablecodepoint",
+ "inplayingcards",
+ "bamu",
+ "inkanbun",
+ "incjkradicalssupplement",
+ "cypriot",
+ "inbamum",
+ "inmeroiticcursive",
+ "oldturkic",
+ "insupplementalarrowsb",
"surrogate",
+ "batk",
+ "inbatak",
+ "inlimbu",
+ "incypriotsyllabary",
+ "dashpunctuation",
+ "innoblock",
+ "hyphen",
+ "insupplementalpunctuation",
+ "ingeorgiansupplement",
+ "oupper",
"paragraphseparator",
- "ogham",
- "hex",
- "uppercaseletter",
- "hexdigit",
- "cwcm",
- "grbase",
- "khmr",
- "unifiedideograph",
+ "inbamumsupplement",
"uppercase",
- "khmer",
- "spacingmark",
- "whitespace",
- "patsyn",
- "cypriot",
+ "currencysymbol",
+ "sk",
+ "lu",
"openpunctuation",
- "bamu",
- "buhid",
- "batk",
- "symbol",
- "changeswhenuppercased",
- "osmanya",
+ "inlisu",
+ "qmark",
+ "egyp",
+ "insupplementaryprivateuseareab",
"limbu",
- "punctuation",
- "hyphen",
- "mathsymbol",
- "grek",
- "changeswhencasefolded",
- "quotationmark",
+ "inegyptianhieroglyphs",
+ "unifiedideograph",
+ "intelugu",
+ "katakana",
+ "inhangulcompatibilityjamo",
+ "upper",
+ "inkayahli",
+ "cwu",
+ "incjkcompatibility",
+ "uppercaseletter",
"bugi",
- "cuneiform",
- "pf",
- "cwcf",
- "bamum",
- "guru",
- "wspace",
- "meeteimayek",
- "defaultignorablecodepoint",
- "modifiersymbol",
- "mlym",
- "mymr",
- "malayalam",
- "myanmar",
- "telugu",
"buginese",
- "xsux",
- "sk",
- "katakana",
- "egyp",
"any",
+ "inyisyllables",
+ "inbopomofoextended",
+ "inboxdrawing",
+ "changeswhenuppercased",
+ "unknown",
+ "quotationmark",
+ "buhd",
+ "punctuation",
+ "oldsoutharabian",
"kayahli",
- "cwu",
- "qmark",
- "blank",
+ "incjkunifiedideographs",
+ "incjkunifiedideographsextensiona",
+ "incjkunifiedideographsextensionc",
+ "telugu",
+ "guru",
+ "greek",
"grlink",
+ "buhid",
"batak",
- "unknown",
- "greek",
+ "blank",
+ "incjkunifiedideographsextensiond",
"graphemelink",
- "gurmukhi",
- "hebrew",
"egyptianhieroglyphs",
- "zyyy"
+ "incjkunifiedideographsextensionb",
+ "zyyy",
+ "gurmukhi"
#endif /* USE_UNICODE_PROPERTIES */
};
#define uniname2ctype_pool ((const char *) &uniname2ctype_pool_contents)
@@ -23125,681 +27365,1289 @@ uniname2ctype_p (str, len)
{
#ifdef USE_UNICODE_PROPERTIES
{-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str3, 33},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str3, 34},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str5, 23},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str5, 46},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str7, 35},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str8, 24},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str7, 51},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str10, 20},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str11, 36},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str12, 26},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str13, 17},
- {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str16, 21},
+ {(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},
+ {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str18, 20},
+ {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str20, 22},
{-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str20, 18},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str21, 93},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str22, 93},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str23, 150},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str24, 60},
+ {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str29, 17},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str30, 19},
+ {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str32, 47},
+ {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str34, 101},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str35, 114},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str26, 59},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str38, 33},
+ {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str42, 14},
+ {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str44, 18},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str45, 128},
+ {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str49, 401},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str29, 127},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str30, 142},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str31, 142},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str32, 113},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str52, 377},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str62, 226},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str34, 18},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str64, 31},
+ {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str66, 239},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str37, 147},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str69, 30},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str40, 147},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str72, 49},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str42, 51},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str74, 32},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str82, 232},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str44, 86},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str84, 412},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str46, 74},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str47, 3},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str48, 74},
- {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str51, 108},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str86, 168},
+ {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str90, 382},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str53, 79},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str54, 110},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str55, 115},
- {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str60, 108},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str92, 413},
+ {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str96, 252},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str63, 115},
+ {(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_str66, 27},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str67, 49},
- {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str69, 105},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str70, 184},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str71, 46},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str109, 312},
+ {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str113, 43},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str114, 430},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str73, 50},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str74, 178},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str75, 151},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str76, 100},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str116, 237},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str84, 157},
+ {(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},
+ {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str175, 152},
{-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str88, 113},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str89, 81},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str90, 92},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str91, 197},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str92, 91},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str93, 170},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str94, 14},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str95, 42},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str179, 379},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str180, 276},
+ {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str184, 75},
+ {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str186, 75},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str187, 111},
+ {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str189, 13},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str199, 250},
+ {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str201, 272},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str202, 120},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str98, 17},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str99, 170},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str100, 81},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str101, 152},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str205, 23},
+ {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str207, 36},
+ {-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},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str103, 182},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str220, 314},
+ {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str223, 263},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str224, 385},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str225, 235},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str105, 36},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str106, 26},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str227, 148},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str109, 91},
+ {(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},
+ {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str247, 160},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str248, 323},
+ {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str252, 392},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str253, 78},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str254, 255},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str255, 155},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str256, 80},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str112, 119},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str259, 260},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str114, 38},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str115, 45},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str116, 69},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str117, 197},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str261, 39},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str119, 195},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str120, 66},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str121, 190},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str122, 22},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str123, 152},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str124, 180},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str125, 99},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str126, 161},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str263, 170},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str264, 297},
+ {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str268, 300},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str128, 122},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str137, 188},
- {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str143, 193},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str279, 431},
+ {-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},
{-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str147, 180},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str148, 200},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str149, 98},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str301, 333},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str151, 100},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str152, 53},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str153, 49},
- {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str156, 110},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str303, 64},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str304, 405},
+ {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str308, 25},
{-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str161, 162},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str162, 151},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str163, 51},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str313, 182},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str166, 194},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str316, 287},
{-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str170, 194},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str171, 177},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str172, 113},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str320, 88},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str321, 201},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str329, 129},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str330, 65},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str339, 428},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str346, 92},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str347, 114},
+ {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str349, 170},
+ {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str353, 109},
+ {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str357, 109},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str358, 299},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str359, 37},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str360, 50},
+ {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str364, 273},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str365, 251},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str174, 182},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str175, 174},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str176, 82},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str367, 238},
+ {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str372, 21},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str179, 178},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str180, 179},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str181, 184},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str375, 123},
+ {-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},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str183, 195},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str389, 174},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str398, 295},
+ {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str400, 150},
+ {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str403, 365},
+ {-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},
+ {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str412, 74},
+ {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str414, 416},
+ {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str420, 93},
+ {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str425, 317},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str426, 99},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str427, 171},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str428, 169},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str429, 82},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str430, 162},
+ {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str432, 131},
+ {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str436, 28},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str445, 82},
{-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str187, 119},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str449, 185},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str450, 55},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str190, 132},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str453, 70},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str454, 66},
+ {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str460, 27},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str468, 253},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str192, 82},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str193, 23},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str470, 151},
+ {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str474, 94},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str475, 94},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str476, 188},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str195, 34},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str478, 67},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str197, 187},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str198, 112},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str480, 45},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str481, 278},
+ {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_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_str200, 27},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str506, 240},
+ {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str509, 341},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str202, 43},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str203, 171},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str511, 52},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str206, 38},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str514, 41},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str515, 143},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str516, 143},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str517, 195},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str209, 35},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str520, 426},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str521, 391},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str522, 227},
+ {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str524, 19},
+ {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str528, 383},
+ {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str531, 116},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str532, 9},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str542, 390},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str212, 42},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str545, 281},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str215, 157},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str548, 106},
+ {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str553, 178},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str217, 32},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str218, 65},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str555, 67},
+ {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str558, 425},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str220, 66},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str560, 206},
+ {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str563, 396},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str564, 100},
+ {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str568, 325},
+ {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str572, 262},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str222, 65},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str223, 1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str574, 153},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str575, 163},
{-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str227, 30},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str579, 315},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str587, 158},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str229, 127},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str589, 423},
{-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str234, 104},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str235, 73},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str236, 77},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str237, 127},
- {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str243, 124},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str244, 159},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str245, 162},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str246, 161},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str594, 23},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str604, 354},
+ {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str608, 153},
{-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str250, 77},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str251, 192},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str252, 167},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str612, 209},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str613, 141},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str614, 211},
+ {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str616, 280},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str617, 158},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str618, 123},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str619, 42},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str620, 1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str621, 218},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str622, 269},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str623, 219},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str255, 136},
+ {(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_str258, 87},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str630, 289},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str631, 202},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str632, 198},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str633, 217},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str261, 87},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str268, 58},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str269, 149},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str270, 186},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str271, 140},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str636, 152},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str637, 357},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str638, 221},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str639, 213},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str640, 282},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str641, 214},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str642, 216},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str643, 203},
+ {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str646, 131},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str647, 374},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str648, 187},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str649, 438},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str650, 220},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str651, 212},
+ {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str653, 176},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str654, 215},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str655, 386},
+ {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str660, 186},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str668, 245},
{-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str275, 190},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str672, 18},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str679, 188},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str278, 7},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str682, 118},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str286, 123},
- {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str292, 154},
+ {(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_str294, 54},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str701, 402},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str296, 120},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str297, 40},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str703, 403},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str704, 128},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str705, 113},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str706, 344},
+ {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str709, 68},
+ {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str713, 116},
+ {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str715, 404},
+ {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_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_str301, 43},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str729, 394},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str730, 370},
+ {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str734, 128},
+ {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str737, 60},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str738, 162},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str739, 192},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str746, 113},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str747, 35},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str748, 125},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str303, 134},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str750, 223},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str306, 175},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str307, 154},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str308, 44},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str771, 160},
+ {-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},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str310, 79},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str311, 125},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str780, 54},
+ {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str784, 196},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str314, 150},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str787, 105},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str788, 101},
+ {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str792, 36},
+ {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str796, 408},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str797, 179},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str798, 176},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str799, 102},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str317, 120},
+ {(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_str321, 140},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str322, 167},
- {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str324, 158},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str325, 174},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str326, 129},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str327, 21},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str328, 40},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str335, 112},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str815, 244},
+ {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str818, 41},
{-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str340, 166},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str341, 102},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str823, 111},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str824, 192},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str343, 175},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str344, 102},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str345, 97},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str346, 98},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str826, 173},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str827, 303},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str349, 31},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str350, 198},
- {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str353, 50},
- {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str355, 94},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str356, 111},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str830, 186},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str831, 206},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str832, 44},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str833, 146},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str358, 117},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str359, 160},
+ {(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},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str361, 128},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str854, 352},
{-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str367, 94},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str860, 194},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str867, 190},
+ {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str869, 184},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str870, 429},
{-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str371, 111},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str372, 145},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str373, 97},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str374, 83},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str375, 105},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str376, 125},
+ {(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},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str379, 96},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str380, 201},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str381, 203},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str382, 210},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str383, 211},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str384, 208},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str385, 37},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str386, 39},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str917, 190},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str388, 155},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str389, 202},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str390, 209},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str391, 212},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str392, 207},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str393, 5},
- {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str395, 143},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str396, 9},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str397, 205},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str398, 206},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str399, 78},
- {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str402, 169},
+ {(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_str405, 204},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str923, 98},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str931, 133},
+ {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str933, 6},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str408, 169},
- {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str413, 193},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str420, 88},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str936, 26},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str422, 52},
- {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str427, 29},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str938, 284},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str939, 369},
+ {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str943, 294},
+ {-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},
+ {-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},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str430, 25},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str956, 256},
+ {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str960, 308},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str432, 187},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str433, 134},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str434, 189},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str962, 141},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str963, 97},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str964, 283},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str965, 121},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str966, 17},
+ {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str970, 83},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str436, 53},
+ {(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_str438, 70},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str976, 173},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str977, 135},
{-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str442, 13},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str443, 163},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str981, 83},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str445, 68},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str446, 186},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str447, 177},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str983, 189},
{-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str452, 19},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str988, 114},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str989, 130},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str990, 95},
{-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str456, 59},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str457, 130},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str994, 277},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str459, 139},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str996, 387},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str997, 310},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str998, 119},
+ {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1000, 84},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str462, 181},
+ {(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_str464, 143},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str465, 198},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str466, 4},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str474, 139},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1006, 397},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1007, 95},
+ {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1010, 285},
{-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str480, 34},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1016, 135},
+ {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1021, 25},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1031, 305},
{-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str484, 107},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str485, 48},
- {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str488, 183},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1035, 366},
+ {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1039, 16},
{-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str493, 179},
- {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str496, 67},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str497, 20},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1044, 207},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1051, 361},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str502, 137},
- {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str506, 55},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1065, 161},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str508, 118},
- {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str512, 11},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str513, 67},
- {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str516, 104},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1067, 126},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str518, 68},
- {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str521, 16},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1069, 311},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1070, 137},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str523, 101},
- {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str529, 138},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str530, 138},
- {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str533, 141},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str534, 191},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str535, 166},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str536, 137},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1072, 288},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str538, 106},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1074, 27},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str540, 144},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1076, 80},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str542, 60},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str543, 181},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str550, 191},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1078, 345},
+ {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1081, 12},
+ {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1084, 348},
+ {-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},
+ {-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_str554, 141},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str562, 60},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str563, 71},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1107, 167},
+ {-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},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1129, 293},
+ {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1133, 174},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str565, 136},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str573, 163},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1135, 106},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1142, 353},
+ {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1147, 183},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str576, 8},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str577, 133},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1150, 4},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1151, 112},
+ {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1156, 102},
+ {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1162, 140},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1170, 144},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str580, 6},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1173, 121},
+ {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1179, 72},
{-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str586, 196},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str587, 109},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str588, 146},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str589, 76},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1185, 261},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1186, 136},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str591, 146},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str592, 41},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str593, 86},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str594, 70},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1188, 249},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str596, 164},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str597, 132},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str598, 109},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str599, 164},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1190, 107},
+ {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1195, 381},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1196, 331},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str601, 76},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str602, 129},
- {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str605, 183},
+ {(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_str617, 117},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1215, 172},
+ {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1219, 406},
+ {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1224, 169},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1225, 373},
+ {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1229, 156},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1230, 367},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1231, 264},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1244, 407},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1245, 307},
+ {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1249, 175},
+ {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1253, 187},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str620, 62},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1256, 184},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str623, 33},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1259, 130},
+ {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1261, 200},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1262, 205},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str625, 114},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str626, 89},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str627, 24},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str628, 62},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str629, 192},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1264, 326},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1265, 159},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1274, 44},
+ {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1279, 257},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str632, 121},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1282, 145},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1289, 126},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1298, 372},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str634, 131},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1300, 129},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str636, 28},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1302, 437},
{-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str640, 114},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1306, 89},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1307, 194},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str643, 133},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str644, 80},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str645, 89},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str646, 83},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str647, 56},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str656, 122},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1310, 115},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str659, 199},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str660, 80},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1313, 360},
+ {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1315, 110},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str663, 12},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1318, 138},
+ {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1321, 110},
+ {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1323, 424},
+ {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1328, 144},
+ {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1330, 193},
{-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str667, 159},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1334, 177},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1341, 417},
+ {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1343, 103},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1344, 433},
+ {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1350, 97},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1351, 388},
+ {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1354, 349},
+ {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1356, 364},
+ {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1362, 40},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1372, 422},
{-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str672, 121},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1377, 241},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str675, 31},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1389, 399},
+ {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1393, 195},
+ {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1396, 138},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str677, 96},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str678, 148},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1398, 167},
+ {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1402, 30},
+ {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1404, 79},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1411, 274},
+ {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1413, 199},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str681, 148},
- {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str686, 131},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str687, 85},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1416, 268},
+ {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1422, 199},
+ {-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_str692, 130},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1429, 147},
+ {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1431, 411},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1432, 175},
+ {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1435, 231},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1436, 64},
+ {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1438, 350},
{-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str696, 46},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1442, 147},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1443, 243},
{-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str701, 0},
- {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str705, 107},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str706, 185},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str707, 99},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str708, 85},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1448, 84},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str710, 128},
- {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str716, 39},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1450, 5},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str718, 160},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str725, 10},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str732, 19},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1452, 336},
+ {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1457, 142},
+ {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1460, 236},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str734, 116},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str735, 145},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str736, 185},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1462, 275},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1463, 65},
+ {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1468, 142},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1478, 380},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1479, 91},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1480, 56},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str739, 25},
+ {(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_str745, 32},
+ {(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_str749, 64},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1516, 267},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1517, 81},
+ {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1519, 139},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1520, 139},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str752, 29},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1523, 318},
+ {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1525, 165},
{-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str757, 22},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str765, 52},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1530, 49},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1531, 339},
+ {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1536, 440},
+ {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1540, 124},
+ {-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},
+ {-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},
+ {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1571, 228},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1578, 32},
+ {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1581, 292},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str767, 101},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str768, 176},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1583, 259},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_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_str772, 28},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1595, 30},
+ {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1598, 96},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1605, 71},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1606, 177},
+ {-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},
+ {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1620, 90},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str777, 176},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str778, 64},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1634, 270},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1635, 136},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1636, 48},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1643, 286},
+ {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1645, 265},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str781, 71},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str782, 103},
+ {(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_str788, 189},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1670, 332},
+ {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1676, 98},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1683, 324},
+ {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1688, 108},
{-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str792, 57},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str793, 103},
+ {(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_str795, 30},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1701, 134},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str797, 168},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str806, 199},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1703, 134},
+ {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1709, 61},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1724, 104},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1725, 8},
+ {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1729, 46},
+ {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_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_str816, 124},
+ {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1759, 322},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str818, 44},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1761, 79},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1780, 375},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1787, 342},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str821, 156},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1790, 122},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str831, 116},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str840, 165},
{-1}, {-1}, {-1}, {-1}, {-1}, {-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_str1829, 291},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str851, 45},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1831, 171},
+ {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1835, 363},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1853, 33},
{-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str856, 61},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str857, 123},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1858, 149},
+ {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1864, 207},
{-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str861, 118},
+ {(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_str868, 37},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1896, 122},
+ {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1899, 193},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1900, 225},
{-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str872, 172},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1904, 108},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1917, 104},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1925, 197},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str888, 48},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1932, 191},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1944, 76},
+ {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_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_str892, 75},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1983, 362},
+ {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1988, 70},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2005, 427},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(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_str898, 63},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2028, 329},
+ {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2033, 321},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str902, 173},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str903, 126},
+ {(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},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-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_str916, 135},
+ {(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},
+ {(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_str918, 41},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str927, 63},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2141, 180},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2162, 320},
+ {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2165, 316},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2178, 191},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2189, 53},
{-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str932, 156},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str940, 84},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2194, 415},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-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_str2299, 58},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2313, 47},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2322, 48},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2338, 29},
{-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str944, 168},
+ {(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_str951, 158},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2349, 340},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2371, 181},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2372, 154},
+ {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2377, 441},
+ {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2379, 119},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2400, 414},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2401, 197},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2413, 248},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str976, 69},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2429, 107},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str980, 47},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2442, 328},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2454, 10},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str999, 90},
+ {-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_str1007, 95},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2523, 334},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2542, 29},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2549, 127},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2588, 127},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2627, 15},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2651, 338},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2671, 330},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2710, 301},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2724, 62},
+ {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2727, 208},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2737, 181},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2753, 117},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2785, 38},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-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_str1020, 90},
+ {(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_str1026, 95},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2940, 337},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2961, 335},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2962, 435},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1032, 88},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1033, 126},
- {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1037, 135},
+ {(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},
{-1}, {-1}, {-1}, {-1}, {-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_str1093, 47},
- {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1097, 106},
{-1}, {-1}, {-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_str1124, 153},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str3104, 76},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-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_str1146, 15},
+ {(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},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-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_str1148, 144},
+ {(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},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1190, 61},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-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},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1263, 173},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-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_str1329, 2},
+ {(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},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-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_str1347, 72},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1358, 165},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-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_str1395, 200},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1410, 75},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-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}, {-1},
+ {-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, 0},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str13, 10},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str14, 14},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str15, 3},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str16, 9},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str17, 12},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str18, 6},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str19, 5},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str20, 4},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str21, 2}
+ {(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_str1463, 72},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1470, 84},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str3802, 434},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
@@ -23809,17 +28657,15 @@ 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_str1556, 78},
{-1}, {-1}, {-1}, {-1}, {-1}, {-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},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1621, 153},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
@@ -23833,8 +28679,18 @@ uniname2ctype_p (str, len)
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1741, 73}
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str4167, 85}
#endif /* USE_UNICODE_PROPERTIES */
};
diff --git a/enc/unicode/name2ctype.h.blt b/enc/unicode/name2ctype.h.blt
index a45ea59a4b..2e80edf525 100644
--- a/enc/unicode/name2ctype.h.blt
+++ b/enc/unicode/name2ctype.h.blt
@@ -36,7 +36,4273 @@ error "gperf generated tables don't work with this execution character set. Plea
#define long size_t
-#ifdef USE_UNICODE_PROPERTIES
+/* 'NEWLINE': [[:NEWLINE:]] */
+static const OnigCodePoint CR_NEWLINE[] = {
+ 1,
+ 0x000a, 0x000a,
+}; /* CR_NEWLINE */
+
+/* 'Alpha': [[:Alpha:]] */
+static const OnigCodePoint CR_Alpha[] = {
+ 540,
+ 0x0041, 0x005a,
+ 0x0061, 0x007a,
+ 0x00aa, 0x00aa,
+ 0x00b5, 0x00b5,
+ 0x00ba, 0x00ba,
+ 0x00c0, 0x00d6,
+ 0x00d8, 0x00f6,
+ 0x00f8, 0x02c1,
+ 0x02c6, 0x02d1,
+ 0x02e0, 0x02e4,
+ 0x02ec, 0x02ec,
+ 0x02ee, 0x02ee,
+ 0x0345, 0x0345,
+ 0x0370, 0x0374,
+ 0x0376, 0x0377,
+ 0x037a, 0x037d,
+ 0x0386, 0x0386,
+ 0x0388, 0x038a,
+ 0x038c, 0x038c,
+ 0x038e, 0x03a1,
+ 0x03a3, 0x03f5,
+ 0x03f7, 0x0481,
+ 0x048a, 0x0527,
+ 0x0531, 0x0556,
+ 0x0559, 0x0559,
+ 0x0561, 0x0587,
+ 0x05b0, 0x05bd,
+ 0x05bf, 0x05bf,
+ 0x05c1, 0x05c2,
+ 0x05c4, 0x05c5,
+ 0x05c7, 0x05c7,
+ 0x05d0, 0x05ea,
+ 0x05f0, 0x05f2,
+ 0x0610, 0x061a,
+ 0x0620, 0x0657,
+ 0x0659, 0x065f,
+ 0x066e, 0x06d3,
+ 0x06d5, 0x06dc,
+ 0x06e1, 0x06e8,
+ 0x06ed, 0x06ef,
+ 0x06fa, 0x06fc,
+ 0x06ff, 0x06ff,
+ 0x0710, 0x073f,
+ 0x074d, 0x07b1,
+ 0x07ca, 0x07ea,
+ 0x07f4, 0x07f5,
+ 0x07fa, 0x07fa,
+ 0x0800, 0x0817,
+ 0x081a, 0x082c,
+ 0x0840, 0x0858,
+ 0x08a0, 0x08a0,
+ 0x08a2, 0x08ac,
+ 0x08e4, 0x08e9,
+ 0x08f0, 0x08fe,
+ 0x0900, 0x093b,
+ 0x093d, 0x094c,
+ 0x094e, 0x0950,
+ 0x0955, 0x0963,
+ 0x0971, 0x0977,
+ 0x0979, 0x097f,
+ 0x0981, 0x0983,
+ 0x0985, 0x098c,
+ 0x098f, 0x0990,
+ 0x0993, 0x09a8,
+ 0x09aa, 0x09b0,
+ 0x09b2, 0x09b2,
+ 0x09b6, 0x09b9,
+ 0x09bd, 0x09c4,
+ 0x09c7, 0x09c8,
+ 0x09cb, 0x09cc,
+ 0x09ce, 0x09ce,
+ 0x09d7, 0x09d7,
+ 0x09dc, 0x09dd,
+ 0x09df, 0x09e3,
+ 0x09f0, 0x09f1,
+ 0x0a01, 0x0a03,
+ 0x0a05, 0x0a0a,
+ 0x0a0f, 0x0a10,
+ 0x0a13, 0x0a28,
+ 0x0a2a, 0x0a30,
+ 0x0a32, 0x0a33,
+ 0x0a35, 0x0a36,
+ 0x0a38, 0x0a39,
+ 0x0a3e, 0x0a42,
+ 0x0a47, 0x0a48,
+ 0x0a4b, 0x0a4c,
+ 0x0a51, 0x0a51,
+ 0x0a59, 0x0a5c,
+ 0x0a5e, 0x0a5e,
+ 0x0a70, 0x0a75,
+ 0x0a81, 0x0a83,
+ 0x0a85, 0x0a8d,
+ 0x0a8f, 0x0a91,
+ 0x0a93, 0x0aa8,
+ 0x0aaa, 0x0ab0,
+ 0x0ab2, 0x0ab3,
+ 0x0ab5, 0x0ab9,
+ 0x0abd, 0x0ac5,
+ 0x0ac7, 0x0ac9,
+ 0x0acb, 0x0acc,
+ 0x0ad0, 0x0ad0,
+ 0x0ae0, 0x0ae3,
+ 0x0b01, 0x0b03,
+ 0x0b05, 0x0b0c,
+ 0x0b0f, 0x0b10,
+ 0x0b13, 0x0b28,
+ 0x0b2a, 0x0b30,
+ 0x0b32, 0x0b33,
+ 0x0b35, 0x0b39,
+ 0x0b3d, 0x0b44,
+ 0x0b47, 0x0b48,
+ 0x0b4b, 0x0b4c,
+ 0x0b56, 0x0b57,
+ 0x0b5c, 0x0b5d,
+ 0x0b5f, 0x0b63,
+ 0x0b71, 0x0b71,
+ 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, 0x0bcc,
+ 0x0bd0, 0x0bd0,
+ 0x0bd7, 0x0bd7,
+ 0x0c01, 0x0c03,
+ 0x0c05, 0x0c0c,
+ 0x0c0e, 0x0c10,
+ 0x0c12, 0x0c28,
+ 0x0c2a, 0x0c33,
+ 0x0c35, 0x0c39,
+ 0x0c3d, 0x0c44,
+ 0x0c46, 0x0c48,
+ 0x0c4a, 0x0c4c,
+ 0x0c55, 0x0c56,
+ 0x0c58, 0x0c59,
+ 0x0c60, 0x0c63,
+ 0x0c82, 0x0c83,
+ 0x0c85, 0x0c8c,
+ 0x0c8e, 0x0c90,
+ 0x0c92, 0x0ca8,
+ 0x0caa, 0x0cb3,
+ 0x0cb5, 0x0cb9,
+ 0x0cbd, 0x0cc4,
+ 0x0cc6, 0x0cc8,
+ 0x0cca, 0x0ccc,
+ 0x0cd5, 0x0cd6,
+ 0x0cde, 0x0cde,
+ 0x0ce0, 0x0ce3,
+ 0x0cf1, 0x0cf2,
+ 0x0d02, 0x0d03,
+ 0x0d05, 0x0d0c,
+ 0x0d0e, 0x0d10,
+ 0x0d12, 0x0d3a,
+ 0x0d3d, 0x0d44,
+ 0x0d46, 0x0d48,
+ 0x0d4a, 0x0d4c,
+ 0x0d4e, 0x0d4e,
+ 0x0d57, 0x0d57,
+ 0x0d60, 0x0d63,
+ 0x0d7a, 0x0d7f,
+ 0x0d82, 0x0d83,
+ 0x0d85, 0x0d96,
+ 0x0d9a, 0x0db1,
+ 0x0db3, 0x0dbb,
+ 0x0dbd, 0x0dbd,
+ 0x0dc0, 0x0dc6,
+ 0x0dcf, 0x0dd4,
+ 0x0dd6, 0x0dd6,
+ 0x0dd8, 0x0ddf,
+ 0x0df2, 0x0df3,
+ 0x0e01, 0x0e3a,
+ 0x0e40, 0x0e46,
+ 0x0e4d, 0x0e4d,
+ 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,
+ 0x0ecd, 0x0ecd,
+ 0x0edc, 0x0edf,
+ 0x0f00, 0x0f00,
+ 0x0f40, 0x0f47,
+ 0x0f49, 0x0f6c,
+ 0x0f71, 0x0f81,
+ 0x0f88, 0x0f97,
+ 0x0f99, 0x0fbc,
+ 0x1000, 0x1036,
+ 0x1038, 0x1038,
+ 0x103b, 0x103f,
+ 0x1050, 0x1062,
+ 0x1065, 0x1068,
+ 0x106e, 0x1086,
+ 0x108e, 0x108e,
+ 0x109c, 0x109d,
+ 0x10a0, 0x10c5,
+ 0x10c7, 0x10c7,
+ 0x10cd, 0x10cd,
+ 0x10d0, 0x10fa,
+ 0x10fc, 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,
+ 0x135f, 0x135f,
+ 0x1380, 0x138f,
+ 0x13a0, 0x13f4,
+ 0x1401, 0x166c,
+ 0x166f, 0x167f,
+ 0x1681, 0x169a,
+ 0x16a0, 0x16ea,
+ 0x16ee, 0x16f0,
+ 0x1700, 0x170c,
+ 0x170e, 0x1713,
+ 0x1720, 0x1733,
+ 0x1740, 0x1753,
+ 0x1760, 0x176c,
+ 0x176e, 0x1770,
+ 0x1772, 0x1773,
+ 0x1780, 0x17b3,
+ 0x17b6, 0x17c8,
+ 0x17d7, 0x17d7,
+ 0x17dc, 0x17dc,
+ 0x1820, 0x1877,
+ 0x1880, 0x18aa,
+ 0x18b0, 0x18f5,
+ 0x1900, 0x191c,
+ 0x1920, 0x192b,
+ 0x1930, 0x1938,
+ 0x1950, 0x196d,
+ 0x1970, 0x1974,
+ 0x1980, 0x19ab,
+ 0x19b0, 0x19c9,
+ 0x1a00, 0x1a1b,
+ 0x1a20, 0x1a5e,
+ 0x1a61, 0x1a74,
+ 0x1aa7, 0x1aa7,
+ 0x1b00, 0x1b33,
+ 0x1b35, 0x1b43,
+ 0x1b45, 0x1b4b,
+ 0x1b80, 0x1ba9,
+ 0x1bac, 0x1baf,
+ 0x1bba, 0x1be5,
+ 0x1be7, 0x1bf1,
+ 0x1c00, 0x1c35,
+ 0x1c4d, 0x1c4f,
+ 0x1c5a, 0x1c7d,
+ 0x1ce9, 0x1cec,
+ 0x1cee, 0x1cf3,
+ 0x1cf5, 0x1cf6,
+ 0x1d00, 0x1dbf,
+ 0x1e00, 0x1f15,
+ 0x1f18, 0x1f1d,
+ 0x1f20, 0x1f45,
+ 0x1f48, 0x1f4d,
+ 0x1f50, 0x1f57,
+ 0x1f59, 0x1f59,
+ 0x1f5b, 0x1f5b,
+ 0x1f5d, 0x1f5d,
+ 0x1f5f, 0x1f7d,
+ 0x1f80, 0x1fb4,
+ 0x1fb6, 0x1fbc,
+ 0x1fbe, 0x1fbe,
+ 0x1fc2, 0x1fc4,
+ 0x1fc6, 0x1fcc,
+ 0x1fd0, 0x1fd3,
+ 0x1fd6, 0x1fdb,
+ 0x1fe0, 0x1fec,
+ 0x1ff2, 0x1ff4,
+ 0x1ff6, 0x1ffc,
+ 0x2071, 0x2071,
+ 0x207f, 0x207f,
+ 0x2090, 0x209c,
+ 0x2102, 0x2102,
+ 0x2107, 0x2107,
+ 0x210a, 0x2113,
+ 0x2115, 0x2115,
+ 0x2119, 0x211d,
+ 0x2124, 0x2124,
+ 0x2126, 0x2126,
+ 0x2128, 0x2128,
+ 0x212a, 0x212d,
+ 0x212f, 0x2139,
+ 0x213c, 0x213f,
+ 0x2145, 0x2149,
+ 0x214e, 0x214e,
+ 0x2160, 0x2188,
+ 0x24b6, 0x24e9,
+ 0x2c00, 0x2c2e,
+ 0x2c30, 0x2c5e,
+ 0x2c60, 0x2ce4,
+ 0x2ceb, 0x2cee,
+ 0x2cf2, 0x2cf3,
+ 0x2d00, 0x2d25,
+ 0x2d27, 0x2d27,
+ 0x2d2d, 0x2d2d,
+ 0x2d30, 0x2d67,
+ 0x2d6f, 0x2d6f,
+ 0x2d80, 0x2d96,
+ 0x2da0, 0x2da6,
+ 0x2da8, 0x2dae,
+ 0x2db0, 0x2db6,
+ 0x2db8, 0x2dbe,
+ 0x2dc0, 0x2dc6,
+ 0x2dc8, 0x2dce,
+ 0x2dd0, 0x2dd6,
+ 0x2dd8, 0x2dde,
+ 0x2de0, 0x2dff,
+ 0x2e2f, 0x2e2f,
+ 0x3005, 0x3007,
+ 0x3021, 0x3029,
+ 0x3031, 0x3035,
+ 0x3038, 0x303c,
+ 0x3041, 0x3096,
+ 0x309d, 0x309f,
+ 0x30a1, 0x30fa,
+ 0x30fc, 0x30ff,
+ 0x3105, 0x312d,
+ 0x3131, 0x318e,
+ 0x31a0, 0x31ba,
+ 0x31f0, 0x31ff,
+ 0x3400, 0x4db5,
+ 0x4e00, 0x9fcc,
+ 0xa000, 0xa48c,
+ 0xa4d0, 0xa4fd,
+ 0xa500, 0xa60c,
+ 0xa610, 0xa61f,
+ 0xa62a, 0xa62b,
+ 0xa640, 0xa66e,
+ 0xa674, 0xa67b,
+ 0xa67f, 0xa697,
+ 0xa69f, 0xa6ef,
+ 0xa717, 0xa71f,
+ 0xa722, 0xa788,
+ 0xa78b, 0xa78e,
+ 0xa790, 0xa793,
+ 0xa7a0, 0xa7aa,
+ 0xa7f8, 0xa801,
+ 0xa803, 0xa805,
+ 0xa807, 0xa80a,
+ 0xa80c, 0xa827,
+ 0xa840, 0xa873,
+ 0xa880, 0xa8c3,
+ 0xa8f2, 0xa8f7,
+ 0xa8fb, 0xa8fb,
+ 0xa90a, 0xa92a,
+ 0xa930, 0xa952,
+ 0xa960, 0xa97c,
+ 0xa980, 0xa9b2,
+ 0xa9b4, 0xa9bf,
+ 0xa9cf, 0xa9cf,
+ 0xaa00, 0xaa36,
+ 0xaa40, 0xaa4d,
+ 0xaa60, 0xaa76,
+ 0xaa7a, 0xaa7a,
+ 0xaa80, 0xaabe,
+ 0xaac0, 0xaac0,
+ 0xaac2, 0xaac2,
+ 0xaadb, 0xaadd,
+ 0xaae0, 0xaaef,
+ 0xaaf2, 0xaaf5,
+ 0xab01, 0xab06,
+ 0xab09, 0xab0e,
+ 0xab11, 0xab16,
+ 0xab20, 0xab26,
+ 0xab28, 0xab2e,
+ 0xabc0, 0xabea,
+ 0xac00, 0xd7a3,
+ 0xd7b0, 0xd7c6,
+ 0xd7cb, 0xd7fb,
+ 0xf900, 0xfa6d,
+ 0xfa70, 0xfad9,
+ 0xfb00, 0xfb06,
+ 0xfb13, 0xfb17,
+ 0xfb1d, 0xfb28,
+ 0xfb2a, 0xfb36,
+ 0xfb38, 0xfb3c,
+ 0xfb3e, 0xfb3e,
+ 0xfb40, 0xfb41,
+ 0xfb43, 0xfb44,
+ 0xfb46, 0xfbb1,
+ 0xfbd3, 0xfd3d,
+ 0xfd50, 0xfd8f,
+ 0xfd92, 0xfdc7,
+ 0xfdf0, 0xfdfb,
+ 0xfe70, 0xfe74,
+ 0xfe76, 0xfefc,
+ 0xff21, 0xff3a,
+ 0xff41, 0xff5a,
+ 0xff66, 0xffbe,
+ 0xffc2, 0xffc7,
+ 0xffca, 0xffcf,
+ 0xffd2, 0xffd7,
+ 0xffda, 0xffdc,
+ 0x10000, 0x1000b,
+ 0x1000d, 0x10026,
+ 0x10028, 0x1003a,
+ 0x1003c, 0x1003d,
+ 0x1003f, 0x1004d,
+ 0x10050, 0x1005d,
+ 0x10080, 0x100fa,
+ 0x10140, 0x10174,
+ 0x10280, 0x1029c,
+ 0x102a0, 0x102d0,
+ 0x10300, 0x1031e,
+ 0x10330, 0x1034a,
+ 0x10380, 0x1039d,
+ 0x103a0, 0x103c3,
+ 0x103c8, 0x103cf,
+ 0x103d1, 0x103d5,
+ 0x10400, 0x1049d,
+ 0x10800, 0x10805,
+ 0x10808, 0x10808,
+ 0x1080a, 0x10835,
+ 0x10837, 0x10838,
+ 0x1083c, 0x1083c,
+ 0x1083f, 0x10855,
+ 0x10900, 0x10915,
+ 0x10920, 0x10939,
+ 0x10980, 0x109b7,
+ 0x109be, 0x109bf,
+ 0x10a00, 0x10a03,
+ 0x10a05, 0x10a06,
+ 0x10a0c, 0x10a13,
+ 0x10a15, 0x10a17,
+ 0x10a19, 0x10a33,
+ 0x10a60, 0x10a7c,
+ 0x10b00, 0x10b35,
+ 0x10b40, 0x10b55,
+ 0x10b60, 0x10b72,
+ 0x10c00, 0x10c48,
+ 0x11000, 0x11045,
+ 0x11082, 0x110b8,
+ 0x110d0, 0x110e8,
+ 0x11100, 0x11132,
+ 0x11180, 0x111bf,
+ 0x111c1, 0x111c4,
+ 0x11680, 0x116b5,
+ 0x12000, 0x1236e,
+ 0x12400, 0x12462,
+ 0x13000, 0x1342e,
+ 0x16800, 0x16a38,
+ 0x16f00, 0x16f44,
+ 0x16f50, 0x16f7e,
+ 0x16f93, 0x16f9f,
+ 0x1b000, 0x1b001,
+ 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, 0x1d6c0,
+ 0x1d6c2, 0x1d6da,
+ 0x1d6dc, 0x1d6fa,
+ 0x1d6fc, 0x1d714,
+ 0x1d716, 0x1d734,
+ 0x1d736, 0x1d74e,
+ 0x1d750, 0x1d76e,
+ 0x1d770, 0x1d788,
+ 0x1d78a, 0x1d7a8,
+ 0x1d7aa, 0x1d7c2,
+ 0x1d7c4, 0x1d7cb,
+ 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,
+ 0x20000, 0x2a6d6,
+ 0x2a700, 0x2b734,
+ 0x2b740, 0x2b81d,
+ 0x2f800, 0x2fa1d,
+}; /* CR_Alpha */
+
+/* 'Blank': [[:Blank:]] */
+static const OnigCodePoint CR_Blank[] = {
+ 9,
+ 0x0009, 0x0009,
+ 0x0020, 0x0020,
+ 0x00a0, 0x00a0,
+ 0x1680, 0x1680,
+ 0x180e, 0x180e,
+ 0x2000, 0x200a,
+ 0x202f, 0x202f,
+ 0x205f, 0x205f,
+ 0x3000, 0x3000,
+}; /* CR_Blank */
+
+/* 'Cntrl': [[:Cntrl:]] */
+static const OnigCodePoint CR_Cntrl[] = {
+ 2,
+ 0x0000, 0x001f,
+ 0x007f, 0x009f,
+}; /* CR_Cntrl */
+
+/* 'Digit': [[:Digit:]] */
+static const OnigCodePoint CR_Digit[] = {
+ 42,
+ 0x0030, 0x0039,
+ 0x0660, 0x0669,
+ 0x06f0, 0x06f9,
+ 0x07c0, 0x07c9,
+ 0x0966, 0x096f,
+ 0x09e6, 0x09ef,
+ 0x0a66, 0x0a6f,
+ 0x0ae6, 0x0aef,
+ 0x0b66, 0x0b6f,
+ 0x0be6, 0x0bef,
+ 0x0c66, 0x0c6f,
+ 0x0ce6, 0x0cef,
+ 0x0d66, 0x0d6f,
+ 0x0e50, 0x0e59,
+ 0x0ed0, 0x0ed9,
+ 0x0f20, 0x0f29,
+ 0x1040, 0x1049,
+ 0x1090, 0x1099,
+ 0x17e0, 0x17e9,
+ 0x1810, 0x1819,
+ 0x1946, 0x194f,
+ 0x19d0, 0x19d9,
+ 0x1a80, 0x1a89,
+ 0x1a90, 0x1a99,
+ 0x1b50, 0x1b59,
+ 0x1bb0, 0x1bb9,
+ 0x1c40, 0x1c49,
+ 0x1c50, 0x1c59,
+ 0xa620, 0xa629,
+ 0xa8d0, 0xa8d9,
+ 0xa900, 0xa909,
+ 0xa9d0, 0xa9d9,
+ 0xaa50, 0xaa59,
+ 0xabf0, 0xabf9,
+ 0xff10, 0xff19,
+ 0x104a0, 0x104a9,
+ 0x11066, 0x1106f,
+ 0x110f0, 0x110f9,
+ 0x11136, 0x1113f,
+ 0x111d0, 0x111d9,
+ 0x116c0, 0x116c9,
+ 0x1d7ce, 0x1d7ff,
+}; /* CR_Digit */
+
+/* 'Graph': [[:Graph:]] */
+static const OnigCodePoint CR_Graph[] = {
+ 544,
+ 0x0021, 0x007e,
+ 0x00a1, 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, 0x167f,
+ 0x1681, 0x169c,
+ 0x16a0, 0x16f0,
+ 0x1700, 0x170c,
+ 0x170e, 0x1714,
+ 0x1720, 0x1736,
+ 0x1740, 0x1753,
+ 0x1760, 0x176c,
+ 0x176e, 0x1770,
+ 0x1772, 0x1773,
+ 0x1780, 0x17dd,
+ 0x17e0, 0x17e9,
+ 0x17f0, 0x17f9,
+ 0x1800, 0x180d,
+ 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,
+ 0x200b, 0x2027,
+ 0x202a, 0x202e,
+ 0x2030, 0x205e,
+ 0x2060, 0x2064,
+ 0x206a, 0x2071,
+ 0x2074, 0x208e,
+ 0x2090, 0x209c,
+ 0x20a0, 0x20b9,
+ 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,
+ 0x3001, 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,
+ 0xe000, 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,
+ 0xfdf0, 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, 0xfffd,
+ 0x10000, 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,
+ 0x20000, 0x2a6d6,
+ 0x2a700, 0x2b734,
+ 0x2b740, 0x2b81d,
+ 0x2f800, 0x2fa1d,
+ 0xe0001, 0xe0001,
+ 0xe0020, 0xe007f,
+ 0xe0100, 0xe01ef,
+ 0xf0000, 0xffffd,
+ 0x100000, 0x10fffd,
+}; /* CR_Graph */
+
+/* 'Lower': [[:Lower:]] */
+static const OnigCodePoint CR_Lower[] = {
+ 618,
+ 0x0061, 0x007a,
+ 0x00aa, 0x00aa,
+ 0x00b5, 0x00b5,
+ 0x00ba, 0x00ba,
+ 0x00df, 0x00f6,
+ 0x00f8, 0x00ff,
+ 0x0101, 0x0101,
+ 0x0103, 0x0103,
+ 0x0105, 0x0105,
+ 0x0107, 0x0107,
+ 0x0109, 0x0109,
+ 0x010b, 0x010b,
+ 0x010d, 0x010d,
+ 0x010f, 0x010f,
+ 0x0111, 0x0111,
+ 0x0113, 0x0113,
+ 0x0115, 0x0115,
+ 0x0117, 0x0117,
+ 0x0119, 0x0119,
+ 0x011b, 0x011b,
+ 0x011d, 0x011d,
+ 0x011f, 0x011f,
+ 0x0121, 0x0121,
+ 0x0123, 0x0123,
+ 0x0125, 0x0125,
+ 0x0127, 0x0127,
+ 0x0129, 0x0129,
+ 0x012b, 0x012b,
+ 0x012d, 0x012d,
+ 0x012f, 0x012f,
+ 0x0131, 0x0131,
+ 0x0133, 0x0133,
+ 0x0135, 0x0135,
+ 0x0137, 0x0138,
+ 0x013a, 0x013a,
+ 0x013c, 0x013c,
+ 0x013e, 0x013e,
+ 0x0140, 0x0140,
+ 0x0142, 0x0142,
+ 0x0144, 0x0144,
+ 0x0146, 0x0146,
+ 0x0148, 0x0149,
+ 0x014b, 0x014b,
+ 0x014d, 0x014d,
+ 0x014f, 0x014f,
+ 0x0151, 0x0151,
+ 0x0153, 0x0153,
+ 0x0155, 0x0155,
+ 0x0157, 0x0157,
+ 0x0159, 0x0159,
+ 0x015b, 0x015b,
+ 0x015d, 0x015d,
+ 0x015f, 0x015f,
+ 0x0161, 0x0161,
+ 0x0163, 0x0163,
+ 0x0165, 0x0165,
+ 0x0167, 0x0167,
+ 0x0169, 0x0169,
+ 0x016b, 0x016b,
+ 0x016d, 0x016d,
+ 0x016f, 0x016f,
+ 0x0171, 0x0171,
+ 0x0173, 0x0173,
+ 0x0175, 0x0175,
+ 0x0177, 0x0177,
+ 0x017a, 0x017a,
+ 0x017c, 0x017c,
+ 0x017e, 0x0180,
+ 0x0183, 0x0183,
+ 0x0185, 0x0185,
+ 0x0188, 0x0188,
+ 0x018c, 0x018d,
+ 0x0192, 0x0192,
+ 0x0195, 0x0195,
+ 0x0199, 0x019b,
+ 0x019e, 0x019e,
+ 0x01a1, 0x01a1,
+ 0x01a3, 0x01a3,
+ 0x01a5, 0x01a5,
+ 0x01a8, 0x01a8,
+ 0x01aa, 0x01ab,
+ 0x01ad, 0x01ad,
+ 0x01b0, 0x01b0,
+ 0x01b4, 0x01b4,
+ 0x01b6, 0x01b6,
+ 0x01b9, 0x01ba,
+ 0x01bd, 0x01bf,
+ 0x01c6, 0x01c6,
+ 0x01c9, 0x01c9,
+ 0x01cc, 0x01cc,
+ 0x01ce, 0x01ce,
+ 0x01d0, 0x01d0,
+ 0x01d2, 0x01d2,
+ 0x01d4, 0x01d4,
+ 0x01d6, 0x01d6,
+ 0x01d8, 0x01d8,
+ 0x01da, 0x01da,
+ 0x01dc, 0x01dd,
+ 0x01df, 0x01df,
+ 0x01e1, 0x01e1,
+ 0x01e3, 0x01e3,
+ 0x01e5, 0x01e5,
+ 0x01e7, 0x01e7,
+ 0x01e9, 0x01e9,
+ 0x01eb, 0x01eb,
+ 0x01ed, 0x01ed,
+ 0x01ef, 0x01f0,
+ 0x01f3, 0x01f3,
+ 0x01f5, 0x01f5,
+ 0x01f9, 0x01f9,
+ 0x01fb, 0x01fb,
+ 0x01fd, 0x01fd,
+ 0x01ff, 0x01ff,
+ 0x0201, 0x0201,
+ 0x0203, 0x0203,
+ 0x0205, 0x0205,
+ 0x0207, 0x0207,
+ 0x0209, 0x0209,
+ 0x020b, 0x020b,
+ 0x020d, 0x020d,
+ 0x020f, 0x020f,
+ 0x0211, 0x0211,
+ 0x0213, 0x0213,
+ 0x0215, 0x0215,
+ 0x0217, 0x0217,
+ 0x0219, 0x0219,
+ 0x021b, 0x021b,
+ 0x021d, 0x021d,
+ 0x021f, 0x021f,
+ 0x0221, 0x0221,
+ 0x0223, 0x0223,
+ 0x0225, 0x0225,
+ 0x0227, 0x0227,
+ 0x0229, 0x0229,
+ 0x022b, 0x022b,
+ 0x022d, 0x022d,
+ 0x022f, 0x022f,
+ 0x0231, 0x0231,
+ 0x0233, 0x0239,
+ 0x023c, 0x023c,
+ 0x023f, 0x0240,
+ 0x0242, 0x0242,
+ 0x0247, 0x0247,
+ 0x0249, 0x0249,
+ 0x024b, 0x024b,
+ 0x024d, 0x024d,
+ 0x024f, 0x0293,
+ 0x0295, 0x02b8,
+ 0x02c0, 0x02c1,
+ 0x02e0, 0x02e4,
+ 0x0345, 0x0345,
+ 0x0371, 0x0371,
+ 0x0373, 0x0373,
+ 0x0377, 0x0377,
+ 0x037a, 0x037d,
+ 0x0390, 0x0390,
+ 0x03ac, 0x03ce,
+ 0x03d0, 0x03d1,
+ 0x03d5, 0x03d7,
+ 0x03d9, 0x03d9,
+ 0x03db, 0x03db,
+ 0x03dd, 0x03dd,
+ 0x03df, 0x03df,
+ 0x03e1, 0x03e1,
+ 0x03e3, 0x03e3,
+ 0x03e5, 0x03e5,
+ 0x03e7, 0x03e7,
+ 0x03e9, 0x03e9,
+ 0x03eb, 0x03eb,
+ 0x03ed, 0x03ed,
+ 0x03ef, 0x03f3,
+ 0x03f5, 0x03f5,
+ 0x03f8, 0x03f8,
+ 0x03fb, 0x03fc,
+ 0x0430, 0x045f,
+ 0x0461, 0x0461,
+ 0x0463, 0x0463,
+ 0x0465, 0x0465,
+ 0x0467, 0x0467,
+ 0x0469, 0x0469,
+ 0x046b, 0x046b,
+ 0x046d, 0x046d,
+ 0x046f, 0x046f,
+ 0x0471, 0x0471,
+ 0x0473, 0x0473,
+ 0x0475, 0x0475,
+ 0x0477, 0x0477,
+ 0x0479, 0x0479,
+ 0x047b, 0x047b,
+ 0x047d, 0x047d,
+ 0x047f, 0x047f,
+ 0x0481, 0x0481,
+ 0x048b, 0x048b,
+ 0x048d, 0x048d,
+ 0x048f, 0x048f,
+ 0x0491, 0x0491,
+ 0x0493, 0x0493,
+ 0x0495, 0x0495,
+ 0x0497, 0x0497,
+ 0x0499, 0x0499,
+ 0x049b, 0x049b,
+ 0x049d, 0x049d,
+ 0x049f, 0x049f,
+ 0x04a1, 0x04a1,
+ 0x04a3, 0x04a3,
+ 0x04a5, 0x04a5,
+ 0x04a7, 0x04a7,
+ 0x04a9, 0x04a9,
+ 0x04ab, 0x04ab,
+ 0x04ad, 0x04ad,
+ 0x04af, 0x04af,
+ 0x04b1, 0x04b1,
+ 0x04b3, 0x04b3,
+ 0x04b5, 0x04b5,
+ 0x04b7, 0x04b7,
+ 0x04b9, 0x04b9,
+ 0x04bb, 0x04bb,
+ 0x04bd, 0x04bd,
+ 0x04bf, 0x04bf,
+ 0x04c2, 0x04c2,
+ 0x04c4, 0x04c4,
+ 0x04c6, 0x04c6,
+ 0x04c8, 0x04c8,
+ 0x04ca, 0x04ca,
+ 0x04cc, 0x04cc,
+ 0x04ce, 0x04cf,
+ 0x04d1, 0x04d1,
+ 0x04d3, 0x04d3,
+ 0x04d5, 0x04d5,
+ 0x04d7, 0x04d7,
+ 0x04d9, 0x04d9,
+ 0x04db, 0x04db,
+ 0x04dd, 0x04dd,
+ 0x04df, 0x04df,
+ 0x04e1, 0x04e1,
+ 0x04e3, 0x04e3,
+ 0x04e5, 0x04e5,
+ 0x04e7, 0x04e7,
+ 0x04e9, 0x04e9,
+ 0x04eb, 0x04eb,
+ 0x04ed, 0x04ed,
+ 0x04ef, 0x04ef,
+ 0x04f1, 0x04f1,
+ 0x04f3, 0x04f3,
+ 0x04f5, 0x04f5,
+ 0x04f7, 0x04f7,
+ 0x04f9, 0x04f9,
+ 0x04fb, 0x04fb,
+ 0x04fd, 0x04fd,
+ 0x04ff, 0x04ff,
+ 0x0501, 0x0501,
+ 0x0503, 0x0503,
+ 0x0505, 0x0505,
+ 0x0507, 0x0507,
+ 0x0509, 0x0509,
+ 0x050b, 0x050b,
+ 0x050d, 0x050d,
+ 0x050f, 0x050f,
+ 0x0511, 0x0511,
+ 0x0513, 0x0513,
+ 0x0515, 0x0515,
+ 0x0517, 0x0517,
+ 0x0519, 0x0519,
+ 0x051b, 0x051b,
+ 0x051d, 0x051d,
+ 0x051f, 0x051f,
+ 0x0521, 0x0521,
+ 0x0523, 0x0523,
+ 0x0525, 0x0525,
+ 0x0527, 0x0527,
+ 0x0561, 0x0587,
+ 0x1d00, 0x1dbf,
+ 0x1e01, 0x1e01,
+ 0x1e03, 0x1e03,
+ 0x1e05, 0x1e05,
+ 0x1e07, 0x1e07,
+ 0x1e09, 0x1e09,
+ 0x1e0b, 0x1e0b,
+ 0x1e0d, 0x1e0d,
+ 0x1e0f, 0x1e0f,
+ 0x1e11, 0x1e11,
+ 0x1e13, 0x1e13,
+ 0x1e15, 0x1e15,
+ 0x1e17, 0x1e17,
+ 0x1e19, 0x1e19,
+ 0x1e1b, 0x1e1b,
+ 0x1e1d, 0x1e1d,
+ 0x1e1f, 0x1e1f,
+ 0x1e21, 0x1e21,
+ 0x1e23, 0x1e23,
+ 0x1e25, 0x1e25,
+ 0x1e27, 0x1e27,
+ 0x1e29, 0x1e29,
+ 0x1e2b, 0x1e2b,
+ 0x1e2d, 0x1e2d,
+ 0x1e2f, 0x1e2f,
+ 0x1e31, 0x1e31,
+ 0x1e33, 0x1e33,
+ 0x1e35, 0x1e35,
+ 0x1e37, 0x1e37,
+ 0x1e39, 0x1e39,
+ 0x1e3b, 0x1e3b,
+ 0x1e3d, 0x1e3d,
+ 0x1e3f, 0x1e3f,
+ 0x1e41, 0x1e41,
+ 0x1e43, 0x1e43,
+ 0x1e45, 0x1e45,
+ 0x1e47, 0x1e47,
+ 0x1e49, 0x1e49,
+ 0x1e4b, 0x1e4b,
+ 0x1e4d, 0x1e4d,
+ 0x1e4f, 0x1e4f,
+ 0x1e51, 0x1e51,
+ 0x1e53, 0x1e53,
+ 0x1e55, 0x1e55,
+ 0x1e57, 0x1e57,
+ 0x1e59, 0x1e59,
+ 0x1e5b, 0x1e5b,
+ 0x1e5d, 0x1e5d,
+ 0x1e5f, 0x1e5f,
+ 0x1e61, 0x1e61,
+ 0x1e63, 0x1e63,
+ 0x1e65, 0x1e65,
+ 0x1e67, 0x1e67,
+ 0x1e69, 0x1e69,
+ 0x1e6b, 0x1e6b,
+ 0x1e6d, 0x1e6d,
+ 0x1e6f, 0x1e6f,
+ 0x1e71, 0x1e71,
+ 0x1e73, 0x1e73,
+ 0x1e75, 0x1e75,
+ 0x1e77, 0x1e77,
+ 0x1e79, 0x1e79,
+ 0x1e7b, 0x1e7b,
+ 0x1e7d, 0x1e7d,
+ 0x1e7f, 0x1e7f,
+ 0x1e81, 0x1e81,
+ 0x1e83, 0x1e83,
+ 0x1e85, 0x1e85,
+ 0x1e87, 0x1e87,
+ 0x1e89, 0x1e89,
+ 0x1e8b, 0x1e8b,
+ 0x1e8d, 0x1e8d,
+ 0x1e8f, 0x1e8f,
+ 0x1e91, 0x1e91,
+ 0x1e93, 0x1e93,
+ 0x1e95, 0x1e9d,
+ 0x1e9f, 0x1e9f,
+ 0x1ea1, 0x1ea1,
+ 0x1ea3, 0x1ea3,
+ 0x1ea5, 0x1ea5,
+ 0x1ea7, 0x1ea7,
+ 0x1ea9, 0x1ea9,
+ 0x1eab, 0x1eab,
+ 0x1ead, 0x1ead,
+ 0x1eaf, 0x1eaf,
+ 0x1eb1, 0x1eb1,
+ 0x1eb3, 0x1eb3,
+ 0x1eb5, 0x1eb5,
+ 0x1eb7, 0x1eb7,
+ 0x1eb9, 0x1eb9,
+ 0x1ebb, 0x1ebb,
+ 0x1ebd, 0x1ebd,
+ 0x1ebf, 0x1ebf,
+ 0x1ec1, 0x1ec1,
+ 0x1ec3, 0x1ec3,
+ 0x1ec5, 0x1ec5,
+ 0x1ec7, 0x1ec7,
+ 0x1ec9, 0x1ec9,
+ 0x1ecb, 0x1ecb,
+ 0x1ecd, 0x1ecd,
+ 0x1ecf, 0x1ecf,
+ 0x1ed1, 0x1ed1,
+ 0x1ed3, 0x1ed3,
+ 0x1ed5, 0x1ed5,
+ 0x1ed7, 0x1ed7,
+ 0x1ed9, 0x1ed9,
+ 0x1edb, 0x1edb,
+ 0x1edd, 0x1edd,
+ 0x1edf, 0x1edf,
+ 0x1ee1, 0x1ee1,
+ 0x1ee3, 0x1ee3,
+ 0x1ee5, 0x1ee5,
+ 0x1ee7, 0x1ee7,
+ 0x1ee9, 0x1ee9,
+ 0x1eeb, 0x1eeb,
+ 0x1eed, 0x1eed,
+ 0x1eef, 0x1eef,
+ 0x1ef1, 0x1ef1,
+ 0x1ef3, 0x1ef3,
+ 0x1ef5, 0x1ef5,
+ 0x1ef7, 0x1ef7,
+ 0x1ef9, 0x1ef9,
+ 0x1efb, 0x1efb,
+ 0x1efd, 0x1efd,
+ 0x1eff, 0x1f07,
+ 0x1f10, 0x1f15,
+ 0x1f20, 0x1f27,
+ 0x1f30, 0x1f37,
+ 0x1f40, 0x1f45,
+ 0x1f50, 0x1f57,
+ 0x1f60, 0x1f67,
+ 0x1f70, 0x1f7d,
+ 0x1f80, 0x1f87,
+ 0x1f90, 0x1f97,
+ 0x1fa0, 0x1fa7,
+ 0x1fb0, 0x1fb4,
+ 0x1fb6, 0x1fb7,
+ 0x1fbe, 0x1fbe,
+ 0x1fc2, 0x1fc4,
+ 0x1fc6, 0x1fc7,
+ 0x1fd0, 0x1fd3,
+ 0x1fd6, 0x1fd7,
+ 0x1fe0, 0x1fe7,
+ 0x1ff2, 0x1ff4,
+ 0x1ff6, 0x1ff7,
+ 0x2071, 0x2071,
+ 0x207f, 0x207f,
+ 0x2090, 0x209c,
+ 0x210a, 0x210a,
+ 0x210e, 0x210f,
+ 0x2113, 0x2113,
+ 0x212f, 0x212f,
+ 0x2134, 0x2134,
+ 0x2139, 0x2139,
+ 0x213c, 0x213d,
+ 0x2146, 0x2149,
+ 0x214e, 0x214e,
+ 0x2170, 0x217f,
+ 0x2184, 0x2184,
+ 0x24d0, 0x24e9,
+ 0x2c30, 0x2c5e,
+ 0x2c61, 0x2c61,
+ 0x2c65, 0x2c66,
+ 0x2c68, 0x2c68,
+ 0x2c6a, 0x2c6a,
+ 0x2c6c, 0x2c6c,
+ 0x2c71, 0x2c71,
+ 0x2c73, 0x2c74,
+ 0x2c76, 0x2c7d,
+ 0x2c81, 0x2c81,
+ 0x2c83, 0x2c83,
+ 0x2c85, 0x2c85,
+ 0x2c87, 0x2c87,
+ 0x2c89, 0x2c89,
+ 0x2c8b, 0x2c8b,
+ 0x2c8d, 0x2c8d,
+ 0x2c8f, 0x2c8f,
+ 0x2c91, 0x2c91,
+ 0x2c93, 0x2c93,
+ 0x2c95, 0x2c95,
+ 0x2c97, 0x2c97,
+ 0x2c99, 0x2c99,
+ 0x2c9b, 0x2c9b,
+ 0x2c9d, 0x2c9d,
+ 0x2c9f, 0x2c9f,
+ 0x2ca1, 0x2ca1,
+ 0x2ca3, 0x2ca3,
+ 0x2ca5, 0x2ca5,
+ 0x2ca7, 0x2ca7,
+ 0x2ca9, 0x2ca9,
+ 0x2cab, 0x2cab,
+ 0x2cad, 0x2cad,
+ 0x2caf, 0x2caf,
+ 0x2cb1, 0x2cb1,
+ 0x2cb3, 0x2cb3,
+ 0x2cb5, 0x2cb5,
+ 0x2cb7, 0x2cb7,
+ 0x2cb9, 0x2cb9,
+ 0x2cbb, 0x2cbb,
+ 0x2cbd, 0x2cbd,
+ 0x2cbf, 0x2cbf,
+ 0x2cc1, 0x2cc1,
+ 0x2cc3, 0x2cc3,
+ 0x2cc5, 0x2cc5,
+ 0x2cc7, 0x2cc7,
+ 0x2cc9, 0x2cc9,
+ 0x2ccb, 0x2ccb,
+ 0x2ccd, 0x2ccd,
+ 0x2ccf, 0x2ccf,
+ 0x2cd1, 0x2cd1,
+ 0x2cd3, 0x2cd3,
+ 0x2cd5, 0x2cd5,
+ 0x2cd7, 0x2cd7,
+ 0x2cd9, 0x2cd9,
+ 0x2cdb, 0x2cdb,
+ 0x2cdd, 0x2cdd,
+ 0x2cdf, 0x2cdf,
+ 0x2ce1, 0x2ce1,
+ 0x2ce3, 0x2ce4,
+ 0x2cec, 0x2cec,
+ 0x2cee, 0x2cee,
+ 0x2cf3, 0x2cf3,
+ 0x2d00, 0x2d25,
+ 0x2d27, 0x2d27,
+ 0x2d2d, 0x2d2d,
+ 0xa641, 0xa641,
+ 0xa643, 0xa643,
+ 0xa645, 0xa645,
+ 0xa647, 0xa647,
+ 0xa649, 0xa649,
+ 0xa64b, 0xa64b,
+ 0xa64d, 0xa64d,
+ 0xa64f, 0xa64f,
+ 0xa651, 0xa651,
+ 0xa653, 0xa653,
+ 0xa655, 0xa655,
+ 0xa657, 0xa657,
+ 0xa659, 0xa659,
+ 0xa65b, 0xa65b,
+ 0xa65d, 0xa65d,
+ 0xa65f, 0xa65f,
+ 0xa661, 0xa661,
+ 0xa663, 0xa663,
+ 0xa665, 0xa665,
+ 0xa667, 0xa667,
+ 0xa669, 0xa669,
+ 0xa66b, 0xa66b,
+ 0xa66d, 0xa66d,
+ 0xa681, 0xa681,
+ 0xa683, 0xa683,
+ 0xa685, 0xa685,
+ 0xa687, 0xa687,
+ 0xa689, 0xa689,
+ 0xa68b, 0xa68b,
+ 0xa68d, 0xa68d,
+ 0xa68f, 0xa68f,
+ 0xa691, 0xa691,
+ 0xa693, 0xa693,
+ 0xa695, 0xa695,
+ 0xa697, 0xa697,
+ 0xa723, 0xa723,
+ 0xa725, 0xa725,
+ 0xa727, 0xa727,
+ 0xa729, 0xa729,
+ 0xa72b, 0xa72b,
+ 0xa72d, 0xa72d,
+ 0xa72f, 0xa731,
+ 0xa733, 0xa733,
+ 0xa735, 0xa735,
+ 0xa737, 0xa737,
+ 0xa739, 0xa739,
+ 0xa73b, 0xa73b,
+ 0xa73d, 0xa73d,
+ 0xa73f, 0xa73f,
+ 0xa741, 0xa741,
+ 0xa743, 0xa743,
+ 0xa745, 0xa745,
+ 0xa747, 0xa747,
+ 0xa749, 0xa749,
+ 0xa74b, 0xa74b,
+ 0xa74d, 0xa74d,
+ 0xa74f, 0xa74f,
+ 0xa751, 0xa751,
+ 0xa753, 0xa753,
+ 0xa755, 0xa755,
+ 0xa757, 0xa757,
+ 0xa759, 0xa759,
+ 0xa75b, 0xa75b,
+ 0xa75d, 0xa75d,
+ 0xa75f, 0xa75f,
+ 0xa761, 0xa761,
+ 0xa763, 0xa763,
+ 0xa765, 0xa765,
+ 0xa767, 0xa767,
+ 0xa769, 0xa769,
+ 0xa76b, 0xa76b,
+ 0xa76d, 0xa76d,
+ 0xa76f, 0xa778,
+ 0xa77a, 0xa77a,
+ 0xa77c, 0xa77c,
+ 0xa77f, 0xa77f,
+ 0xa781, 0xa781,
+ 0xa783, 0xa783,
+ 0xa785, 0xa785,
+ 0xa787, 0xa787,
+ 0xa78c, 0xa78c,
+ 0xa78e, 0xa78e,
+ 0xa791, 0xa791,
+ 0xa793, 0xa793,
+ 0xa7a1, 0xa7a1,
+ 0xa7a3, 0xa7a3,
+ 0xa7a5, 0xa7a5,
+ 0xa7a7, 0xa7a7,
+ 0xa7a9, 0xa7a9,
+ 0xa7f8, 0xa7fa,
+ 0xfb00, 0xfb06,
+ 0xfb13, 0xfb17,
+ 0xff41, 0xff5a,
+ 0x10428, 0x1044f,
+ 0x1d41a, 0x1d433,
+ 0x1d44e, 0x1d454,
+ 0x1d456, 0x1d467,
+ 0x1d482, 0x1d49b,
+ 0x1d4b6, 0x1d4b9,
+ 0x1d4bb, 0x1d4bb,
+ 0x1d4bd, 0x1d4c3,
+ 0x1d4c5, 0x1d4cf,
+ 0x1d4ea, 0x1d503,
+ 0x1d51e, 0x1d537,
+ 0x1d552, 0x1d56b,
+ 0x1d586, 0x1d59f,
+ 0x1d5ba, 0x1d5d3,
+ 0x1d5ee, 0x1d607,
+ 0x1d622, 0x1d63b,
+ 0x1d656, 0x1d66f,
+ 0x1d68a, 0x1d6a5,
+ 0x1d6c2, 0x1d6da,
+ 0x1d6dc, 0x1d6e1,
+ 0x1d6fc, 0x1d714,
+ 0x1d716, 0x1d71b,
+ 0x1d736, 0x1d74e,
+ 0x1d750, 0x1d755,
+ 0x1d770, 0x1d788,
+ 0x1d78a, 0x1d78f,
+ 0x1d7aa, 0x1d7c2,
+ 0x1d7c4, 0x1d7c9,
+ 0x1d7cb, 0x1d7cb,
+}; /* CR_Lower */
+
+/* 'Print': [[:Print:]] */
+static const OnigCodePoint CR_Print[] = {
+ 541,
+ 0x0020, 0x007e,
+ 0x00a0, 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, 0x2027,
+ 0x202a, 0x2064,
+ 0x206a, 0x2071,
+ 0x2074, 0x208e,
+ 0x2090, 0x209c,
+ 0x20a0, 0x20b9,
+ 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,
+ 0xe000, 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,
+ 0xfdf0, 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, 0xfffd,
+ 0x10000, 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,
+ 0x20000, 0x2a6d6,
+ 0x2a700, 0x2b734,
+ 0x2b740, 0x2b81d,
+ 0x2f800, 0x2fa1d,
+ 0xe0001, 0xe0001,
+ 0xe0020, 0xe007f,
+ 0xe0100, 0xe01ef,
+ 0xf0000, 0xffffd,
+ 0x100000, 0x10fffd,
+}; /* CR_Print */
+
+/* 'Punct': [[:Punct:]] */
+static const OnigCodePoint CR_Punct[] = {
+ 140,
+ 0x0021, 0x0023,
+ 0x0025, 0x002a,
+ 0x002c, 0x002f,
+ 0x003a, 0x003b,
+ 0x003f, 0x0040,
+ 0x005b, 0x005d,
+ 0x005f, 0x005f,
+ 0x007b, 0x007b,
+ 0x007d, 0x007d,
+ 0x00a1, 0x00a1,
+ 0x00a7, 0x00a7,
+ 0x00ab, 0x00ab,
+ 0x00b6, 0x00b7,
+ 0x00bb, 0x00bb,
+ 0x00bf, 0x00bf,
+ 0x037e, 0x037e,
+ 0x0387, 0x0387,
+ 0x055a, 0x055f,
+ 0x0589, 0x058a,
+ 0x05be, 0x05be,
+ 0x05c0, 0x05c0,
+ 0x05c3, 0x05c3,
+ 0x05c6, 0x05c6,
+ 0x05f3, 0x05f4,
+ 0x0609, 0x060a,
+ 0x060c, 0x060d,
+ 0x061b, 0x061b,
+ 0x061e, 0x061f,
+ 0x066a, 0x066d,
+ 0x06d4, 0x06d4,
+ 0x0700, 0x070d,
+ 0x07f7, 0x07f9,
+ 0x0830, 0x083e,
+ 0x085e, 0x085e,
+ 0x0964, 0x0965,
+ 0x0970, 0x0970,
+ 0x0af0, 0x0af0,
+ 0x0df4, 0x0df4,
+ 0x0e4f, 0x0e4f,
+ 0x0e5a, 0x0e5b,
+ 0x0f04, 0x0f12,
+ 0x0f14, 0x0f14,
+ 0x0f3a, 0x0f3d,
+ 0x0f85, 0x0f85,
+ 0x0fd0, 0x0fd4,
+ 0x0fd9, 0x0fda,
+ 0x104a, 0x104f,
+ 0x10fb, 0x10fb,
+ 0x1360, 0x1368,
+ 0x1400, 0x1400,
+ 0x166d, 0x166e,
+ 0x169b, 0x169c,
+ 0x16eb, 0x16ed,
+ 0x1735, 0x1736,
+ 0x17d4, 0x17d6,
+ 0x17d8, 0x17da,
+ 0x1800, 0x180a,
+ 0x1944, 0x1945,
+ 0x1a1e, 0x1a1f,
+ 0x1aa0, 0x1aa6,
+ 0x1aa8, 0x1aad,
+ 0x1b5a, 0x1b60,
+ 0x1bfc, 0x1bff,
+ 0x1c3b, 0x1c3f,
+ 0x1c7e, 0x1c7f,
+ 0x1cc0, 0x1cc7,
+ 0x1cd3, 0x1cd3,
+ 0x2010, 0x2027,
+ 0x2030, 0x2043,
+ 0x2045, 0x2051,
+ 0x2053, 0x205e,
+ 0x207d, 0x207e,
+ 0x208d, 0x208e,
+ 0x2329, 0x232a,
+ 0x2768, 0x2775,
+ 0x27c5, 0x27c6,
+ 0x27e6, 0x27ef,
+ 0x2983, 0x2998,
+ 0x29d8, 0x29db,
+ 0x29fc, 0x29fd,
+ 0x2cf9, 0x2cfc,
+ 0x2cfe, 0x2cff,
+ 0x2d70, 0x2d70,
+ 0x2e00, 0x2e2e,
+ 0x2e30, 0x2e3b,
+ 0x3001, 0x3003,
+ 0x3008, 0x3011,
+ 0x3014, 0x301f,
+ 0x3030, 0x3030,
+ 0x303d, 0x303d,
+ 0x30a0, 0x30a0,
+ 0x30fb, 0x30fb,
+ 0xa4fe, 0xa4ff,
+ 0xa60d, 0xa60f,
+ 0xa673, 0xa673,
+ 0xa67e, 0xa67e,
+ 0xa6f2, 0xa6f7,
+ 0xa874, 0xa877,
+ 0xa8ce, 0xa8cf,
+ 0xa8f8, 0xa8fa,
+ 0xa92e, 0xa92f,
+ 0xa95f, 0xa95f,
+ 0xa9c1, 0xa9cd,
+ 0xa9de, 0xa9df,
+ 0xaa5c, 0xaa5f,
+ 0xaade, 0xaadf,
+ 0xaaf0, 0xaaf1,
+ 0xabeb, 0xabeb,
+ 0xfd3e, 0xfd3f,
+ 0xfe10, 0xfe19,
+ 0xfe30, 0xfe52,
+ 0xfe54, 0xfe61,
+ 0xfe63, 0xfe63,
+ 0xfe68, 0xfe68,
+ 0xfe6a, 0xfe6b,
+ 0xff01, 0xff03,
+ 0xff05, 0xff0a,
+ 0xff0c, 0xff0f,
+ 0xff1a, 0xff1b,
+ 0xff1f, 0xff20,
+ 0xff3b, 0xff3d,
+ 0xff3f, 0xff3f,
+ 0xff5b, 0xff5b,
+ 0xff5d, 0xff5d,
+ 0xff5f, 0xff65,
+ 0x10100, 0x10102,
+ 0x1039f, 0x1039f,
+ 0x103d0, 0x103d0,
+ 0x10857, 0x10857,
+ 0x1091f, 0x1091f,
+ 0x1093f, 0x1093f,
+ 0x10a50, 0x10a58,
+ 0x10a7f, 0x10a7f,
+ 0x10b39, 0x10b3f,
+ 0x11047, 0x1104d,
+ 0x110bb, 0x110bc,
+ 0x110be, 0x110c1,
+ 0x11140, 0x11143,
+ 0x111c5, 0x111c8,
+ 0x12470, 0x12473,
+}; /* CR_Punct */
+
+/* 'Space': [[:Space:]] */
+static const OnigCodePoint CR_Space[] = {
+ 11,
+ 0x0009, 0x000d,
+ 0x0020, 0x0020,
+ 0x0085, 0x0085,
+ 0x00a0, 0x00a0,
+ 0x1680, 0x1680,
+ 0x180e, 0x180e,
+ 0x2000, 0x200a,
+ 0x2028, 0x2029,
+ 0x202f, 0x202f,
+ 0x205f, 0x205f,
+ 0x3000, 0x3000,
+}; /* CR_Space */
+
+/* 'Upper': [[:Upper:]] */
+static const OnigCodePoint CR_Upper[] = {
+ 610,
+ 0x0041, 0x005a,
+ 0x00c0, 0x00d6,
+ 0x00d8, 0x00de,
+ 0x0100, 0x0100,
+ 0x0102, 0x0102,
+ 0x0104, 0x0104,
+ 0x0106, 0x0106,
+ 0x0108, 0x0108,
+ 0x010a, 0x010a,
+ 0x010c, 0x010c,
+ 0x010e, 0x010e,
+ 0x0110, 0x0110,
+ 0x0112, 0x0112,
+ 0x0114, 0x0114,
+ 0x0116, 0x0116,
+ 0x0118, 0x0118,
+ 0x011a, 0x011a,
+ 0x011c, 0x011c,
+ 0x011e, 0x011e,
+ 0x0120, 0x0120,
+ 0x0122, 0x0122,
+ 0x0124, 0x0124,
+ 0x0126, 0x0126,
+ 0x0128, 0x0128,
+ 0x012a, 0x012a,
+ 0x012c, 0x012c,
+ 0x012e, 0x012e,
+ 0x0130, 0x0130,
+ 0x0132, 0x0132,
+ 0x0134, 0x0134,
+ 0x0136, 0x0136,
+ 0x0139, 0x0139,
+ 0x013b, 0x013b,
+ 0x013d, 0x013d,
+ 0x013f, 0x013f,
+ 0x0141, 0x0141,
+ 0x0143, 0x0143,
+ 0x0145, 0x0145,
+ 0x0147, 0x0147,
+ 0x014a, 0x014a,
+ 0x014c, 0x014c,
+ 0x014e, 0x014e,
+ 0x0150, 0x0150,
+ 0x0152, 0x0152,
+ 0x0154, 0x0154,
+ 0x0156, 0x0156,
+ 0x0158, 0x0158,
+ 0x015a, 0x015a,
+ 0x015c, 0x015c,
+ 0x015e, 0x015e,
+ 0x0160, 0x0160,
+ 0x0162, 0x0162,
+ 0x0164, 0x0164,
+ 0x0166, 0x0166,
+ 0x0168, 0x0168,
+ 0x016a, 0x016a,
+ 0x016c, 0x016c,
+ 0x016e, 0x016e,
+ 0x0170, 0x0170,
+ 0x0172, 0x0172,
+ 0x0174, 0x0174,
+ 0x0176, 0x0176,
+ 0x0178, 0x0179,
+ 0x017b, 0x017b,
+ 0x017d, 0x017d,
+ 0x0181, 0x0182,
+ 0x0184, 0x0184,
+ 0x0186, 0x0187,
+ 0x0189, 0x018b,
+ 0x018e, 0x0191,
+ 0x0193, 0x0194,
+ 0x0196, 0x0198,
+ 0x019c, 0x019d,
+ 0x019f, 0x01a0,
+ 0x01a2, 0x01a2,
+ 0x01a4, 0x01a4,
+ 0x01a6, 0x01a7,
+ 0x01a9, 0x01a9,
+ 0x01ac, 0x01ac,
+ 0x01ae, 0x01af,
+ 0x01b1, 0x01b3,
+ 0x01b5, 0x01b5,
+ 0x01b7, 0x01b8,
+ 0x01bc, 0x01bc,
+ 0x01c4, 0x01c4,
+ 0x01c7, 0x01c7,
+ 0x01ca, 0x01ca,
+ 0x01cd, 0x01cd,
+ 0x01cf, 0x01cf,
+ 0x01d1, 0x01d1,
+ 0x01d3, 0x01d3,
+ 0x01d5, 0x01d5,
+ 0x01d7, 0x01d7,
+ 0x01d9, 0x01d9,
+ 0x01db, 0x01db,
+ 0x01de, 0x01de,
+ 0x01e0, 0x01e0,
+ 0x01e2, 0x01e2,
+ 0x01e4, 0x01e4,
+ 0x01e6, 0x01e6,
+ 0x01e8, 0x01e8,
+ 0x01ea, 0x01ea,
+ 0x01ec, 0x01ec,
+ 0x01ee, 0x01ee,
+ 0x01f1, 0x01f1,
+ 0x01f4, 0x01f4,
+ 0x01f6, 0x01f8,
+ 0x01fa, 0x01fa,
+ 0x01fc, 0x01fc,
+ 0x01fe, 0x01fe,
+ 0x0200, 0x0200,
+ 0x0202, 0x0202,
+ 0x0204, 0x0204,
+ 0x0206, 0x0206,
+ 0x0208, 0x0208,
+ 0x020a, 0x020a,
+ 0x020c, 0x020c,
+ 0x020e, 0x020e,
+ 0x0210, 0x0210,
+ 0x0212, 0x0212,
+ 0x0214, 0x0214,
+ 0x0216, 0x0216,
+ 0x0218, 0x0218,
+ 0x021a, 0x021a,
+ 0x021c, 0x021c,
+ 0x021e, 0x021e,
+ 0x0220, 0x0220,
+ 0x0222, 0x0222,
+ 0x0224, 0x0224,
+ 0x0226, 0x0226,
+ 0x0228, 0x0228,
+ 0x022a, 0x022a,
+ 0x022c, 0x022c,
+ 0x022e, 0x022e,
+ 0x0230, 0x0230,
+ 0x0232, 0x0232,
+ 0x023a, 0x023b,
+ 0x023d, 0x023e,
+ 0x0241, 0x0241,
+ 0x0243, 0x0246,
+ 0x0248, 0x0248,
+ 0x024a, 0x024a,
+ 0x024c, 0x024c,
+ 0x024e, 0x024e,
+ 0x0370, 0x0370,
+ 0x0372, 0x0372,
+ 0x0376, 0x0376,
+ 0x0386, 0x0386,
+ 0x0388, 0x038a,
+ 0x038c, 0x038c,
+ 0x038e, 0x038f,
+ 0x0391, 0x03a1,
+ 0x03a3, 0x03ab,
+ 0x03cf, 0x03cf,
+ 0x03d2, 0x03d4,
+ 0x03d8, 0x03d8,
+ 0x03da, 0x03da,
+ 0x03dc, 0x03dc,
+ 0x03de, 0x03de,
+ 0x03e0, 0x03e0,
+ 0x03e2, 0x03e2,
+ 0x03e4, 0x03e4,
+ 0x03e6, 0x03e6,
+ 0x03e8, 0x03e8,
+ 0x03ea, 0x03ea,
+ 0x03ec, 0x03ec,
+ 0x03ee, 0x03ee,
+ 0x03f4, 0x03f4,
+ 0x03f7, 0x03f7,
+ 0x03f9, 0x03fa,
+ 0x03fd, 0x042f,
+ 0x0460, 0x0460,
+ 0x0462, 0x0462,
+ 0x0464, 0x0464,
+ 0x0466, 0x0466,
+ 0x0468, 0x0468,
+ 0x046a, 0x046a,
+ 0x046c, 0x046c,
+ 0x046e, 0x046e,
+ 0x0470, 0x0470,
+ 0x0472, 0x0472,
+ 0x0474, 0x0474,
+ 0x0476, 0x0476,
+ 0x0478, 0x0478,
+ 0x047a, 0x047a,
+ 0x047c, 0x047c,
+ 0x047e, 0x047e,
+ 0x0480, 0x0480,
+ 0x048a, 0x048a,
+ 0x048c, 0x048c,
+ 0x048e, 0x048e,
+ 0x0490, 0x0490,
+ 0x0492, 0x0492,
+ 0x0494, 0x0494,
+ 0x0496, 0x0496,
+ 0x0498, 0x0498,
+ 0x049a, 0x049a,
+ 0x049c, 0x049c,
+ 0x049e, 0x049e,
+ 0x04a0, 0x04a0,
+ 0x04a2, 0x04a2,
+ 0x04a4, 0x04a4,
+ 0x04a6, 0x04a6,
+ 0x04a8, 0x04a8,
+ 0x04aa, 0x04aa,
+ 0x04ac, 0x04ac,
+ 0x04ae, 0x04ae,
+ 0x04b0, 0x04b0,
+ 0x04b2, 0x04b2,
+ 0x04b4, 0x04b4,
+ 0x04b6, 0x04b6,
+ 0x04b8, 0x04b8,
+ 0x04ba, 0x04ba,
+ 0x04bc, 0x04bc,
+ 0x04be, 0x04be,
+ 0x04c0, 0x04c1,
+ 0x04c3, 0x04c3,
+ 0x04c5, 0x04c5,
+ 0x04c7, 0x04c7,
+ 0x04c9, 0x04c9,
+ 0x04cb, 0x04cb,
+ 0x04cd, 0x04cd,
+ 0x04d0, 0x04d0,
+ 0x04d2, 0x04d2,
+ 0x04d4, 0x04d4,
+ 0x04d6, 0x04d6,
+ 0x04d8, 0x04d8,
+ 0x04da, 0x04da,
+ 0x04dc, 0x04dc,
+ 0x04de, 0x04de,
+ 0x04e0, 0x04e0,
+ 0x04e2, 0x04e2,
+ 0x04e4, 0x04e4,
+ 0x04e6, 0x04e6,
+ 0x04e8, 0x04e8,
+ 0x04ea, 0x04ea,
+ 0x04ec, 0x04ec,
+ 0x04ee, 0x04ee,
+ 0x04f0, 0x04f0,
+ 0x04f2, 0x04f2,
+ 0x04f4, 0x04f4,
+ 0x04f6, 0x04f6,
+ 0x04f8, 0x04f8,
+ 0x04fa, 0x04fa,
+ 0x04fc, 0x04fc,
+ 0x04fe, 0x04fe,
+ 0x0500, 0x0500,
+ 0x0502, 0x0502,
+ 0x0504, 0x0504,
+ 0x0506, 0x0506,
+ 0x0508, 0x0508,
+ 0x050a, 0x050a,
+ 0x050c, 0x050c,
+ 0x050e, 0x050e,
+ 0x0510, 0x0510,
+ 0x0512, 0x0512,
+ 0x0514, 0x0514,
+ 0x0516, 0x0516,
+ 0x0518, 0x0518,
+ 0x051a, 0x051a,
+ 0x051c, 0x051c,
+ 0x051e, 0x051e,
+ 0x0520, 0x0520,
+ 0x0522, 0x0522,
+ 0x0524, 0x0524,
+ 0x0526, 0x0526,
+ 0x0531, 0x0556,
+ 0x10a0, 0x10c5,
+ 0x10c7, 0x10c7,
+ 0x10cd, 0x10cd,
+ 0x1e00, 0x1e00,
+ 0x1e02, 0x1e02,
+ 0x1e04, 0x1e04,
+ 0x1e06, 0x1e06,
+ 0x1e08, 0x1e08,
+ 0x1e0a, 0x1e0a,
+ 0x1e0c, 0x1e0c,
+ 0x1e0e, 0x1e0e,
+ 0x1e10, 0x1e10,
+ 0x1e12, 0x1e12,
+ 0x1e14, 0x1e14,
+ 0x1e16, 0x1e16,
+ 0x1e18, 0x1e18,
+ 0x1e1a, 0x1e1a,
+ 0x1e1c, 0x1e1c,
+ 0x1e1e, 0x1e1e,
+ 0x1e20, 0x1e20,
+ 0x1e22, 0x1e22,
+ 0x1e24, 0x1e24,
+ 0x1e26, 0x1e26,
+ 0x1e28, 0x1e28,
+ 0x1e2a, 0x1e2a,
+ 0x1e2c, 0x1e2c,
+ 0x1e2e, 0x1e2e,
+ 0x1e30, 0x1e30,
+ 0x1e32, 0x1e32,
+ 0x1e34, 0x1e34,
+ 0x1e36, 0x1e36,
+ 0x1e38, 0x1e38,
+ 0x1e3a, 0x1e3a,
+ 0x1e3c, 0x1e3c,
+ 0x1e3e, 0x1e3e,
+ 0x1e40, 0x1e40,
+ 0x1e42, 0x1e42,
+ 0x1e44, 0x1e44,
+ 0x1e46, 0x1e46,
+ 0x1e48, 0x1e48,
+ 0x1e4a, 0x1e4a,
+ 0x1e4c, 0x1e4c,
+ 0x1e4e, 0x1e4e,
+ 0x1e50, 0x1e50,
+ 0x1e52, 0x1e52,
+ 0x1e54, 0x1e54,
+ 0x1e56, 0x1e56,
+ 0x1e58, 0x1e58,
+ 0x1e5a, 0x1e5a,
+ 0x1e5c, 0x1e5c,
+ 0x1e5e, 0x1e5e,
+ 0x1e60, 0x1e60,
+ 0x1e62, 0x1e62,
+ 0x1e64, 0x1e64,
+ 0x1e66, 0x1e66,
+ 0x1e68, 0x1e68,
+ 0x1e6a, 0x1e6a,
+ 0x1e6c, 0x1e6c,
+ 0x1e6e, 0x1e6e,
+ 0x1e70, 0x1e70,
+ 0x1e72, 0x1e72,
+ 0x1e74, 0x1e74,
+ 0x1e76, 0x1e76,
+ 0x1e78, 0x1e78,
+ 0x1e7a, 0x1e7a,
+ 0x1e7c, 0x1e7c,
+ 0x1e7e, 0x1e7e,
+ 0x1e80, 0x1e80,
+ 0x1e82, 0x1e82,
+ 0x1e84, 0x1e84,
+ 0x1e86, 0x1e86,
+ 0x1e88, 0x1e88,
+ 0x1e8a, 0x1e8a,
+ 0x1e8c, 0x1e8c,
+ 0x1e8e, 0x1e8e,
+ 0x1e90, 0x1e90,
+ 0x1e92, 0x1e92,
+ 0x1e94, 0x1e94,
+ 0x1e9e, 0x1e9e,
+ 0x1ea0, 0x1ea0,
+ 0x1ea2, 0x1ea2,
+ 0x1ea4, 0x1ea4,
+ 0x1ea6, 0x1ea6,
+ 0x1ea8, 0x1ea8,
+ 0x1eaa, 0x1eaa,
+ 0x1eac, 0x1eac,
+ 0x1eae, 0x1eae,
+ 0x1eb0, 0x1eb0,
+ 0x1eb2, 0x1eb2,
+ 0x1eb4, 0x1eb4,
+ 0x1eb6, 0x1eb6,
+ 0x1eb8, 0x1eb8,
+ 0x1eba, 0x1eba,
+ 0x1ebc, 0x1ebc,
+ 0x1ebe, 0x1ebe,
+ 0x1ec0, 0x1ec0,
+ 0x1ec2, 0x1ec2,
+ 0x1ec4, 0x1ec4,
+ 0x1ec6, 0x1ec6,
+ 0x1ec8, 0x1ec8,
+ 0x1eca, 0x1eca,
+ 0x1ecc, 0x1ecc,
+ 0x1ece, 0x1ece,
+ 0x1ed0, 0x1ed0,
+ 0x1ed2, 0x1ed2,
+ 0x1ed4, 0x1ed4,
+ 0x1ed6, 0x1ed6,
+ 0x1ed8, 0x1ed8,
+ 0x1eda, 0x1eda,
+ 0x1edc, 0x1edc,
+ 0x1ede, 0x1ede,
+ 0x1ee0, 0x1ee0,
+ 0x1ee2, 0x1ee2,
+ 0x1ee4, 0x1ee4,
+ 0x1ee6, 0x1ee6,
+ 0x1ee8, 0x1ee8,
+ 0x1eea, 0x1eea,
+ 0x1eec, 0x1eec,
+ 0x1eee, 0x1eee,
+ 0x1ef0, 0x1ef0,
+ 0x1ef2, 0x1ef2,
+ 0x1ef4, 0x1ef4,
+ 0x1ef6, 0x1ef6,
+ 0x1ef8, 0x1ef8,
+ 0x1efa, 0x1efa,
+ 0x1efc, 0x1efc,
+ 0x1efe, 0x1efe,
+ 0x1f08, 0x1f0f,
+ 0x1f18, 0x1f1d,
+ 0x1f28, 0x1f2f,
+ 0x1f38, 0x1f3f,
+ 0x1f48, 0x1f4d,
+ 0x1f59, 0x1f59,
+ 0x1f5b, 0x1f5b,
+ 0x1f5d, 0x1f5d,
+ 0x1f5f, 0x1f5f,
+ 0x1f68, 0x1f6f,
+ 0x1fb8, 0x1fbb,
+ 0x1fc8, 0x1fcb,
+ 0x1fd8, 0x1fdb,
+ 0x1fe8, 0x1fec,
+ 0x1ff8, 0x1ffb,
+ 0x2102, 0x2102,
+ 0x2107, 0x2107,
+ 0x210b, 0x210d,
+ 0x2110, 0x2112,
+ 0x2115, 0x2115,
+ 0x2119, 0x211d,
+ 0x2124, 0x2124,
+ 0x2126, 0x2126,
+ 0x2128, 0x2128,
+ 0x212a, 0x212d,
+ 0x2130, 0x2133,
+ 0x213e, 0x213f,
+ 0x2145, 0x2145,
+ 0x2160, 0x216f,
+ 0x2183, 0x2183,
+ 0x24b6, 0x24cf,
+ 0x2c00, 0x2c2e,
+ 0x2c60, 0x2c60,
+ 0x2c62, 0x2c64,
+ 0x2c67, 0x2c67,
+ 0x2c69, 0x2c69,
+ 0x2c6b, 0x2c6b,
+ 0x2c6d, 0x2c70,
+ 0x2c72, 0x2c72,
+ 0x2c75, 0x2c75,
+ 0x2c7e, 0x2c80,
+ 0x2c82, 0x2c82,
+ 0x2c84, 0x2c84,
+ 0x2c86, 0x2c86,
+ 0x2c88, 0x2c88,
+ 0x2c8a, 0x2c8a,
+ 0x2c8c, 0x2c8c,
+ 0x2c8e, 0x2c8e,
+ 0x2c90, 0x2c90,
+ 0x2c92, 0x2c92,
+ 0x2c94, 0x2c94,
+ 0x2c96, 0x2c96,
+ 0x2c98, 0x2c98,
+ 0x2c9a, 0x2c9a,
+ 0x2c9c, 0x2c9c,
+ 0x2c9e, 0x2c9e,
+ 0x2ca0, 0x2ca0,
+ 0x2ca2, 0x2ca2,
+ 0x2ca4, 0x2ca4,
+ 0x2ca6, 0x2ca6,
+ 0x2ca8, 0x2ca8,
+ 0x2caa, 0x2caa,
+ 0x2cac, 0x2cac,
+ 0x2cae, 0x2cae,
+ 0x2cb0, 0x2cb0,
+ 0x2cb2, 0x2cb2,
+ 0x2cb4, 0x2cb4,
+ 0x2cb6, 0x2cb6,
+ 0x2cb8, 0x2cb8,
+ 0x2cba, 0x2cba,
+ 0x2cbc, 0x2cbc,
+ 0x2cbe, 0x2cbe,
+ 0x2cc0, 0x2cc0,
+ 0x2cc2, 0x2cc2,
+ 0x2cc4, 0x2cc4,
+ 0x2cc6, 0x2cc6,
+ 0x2cc8, 0x2cc8,
+ 0x2cca, 0x2cca,
+ 0x2ccc, 0x2ccc,
+ 0x2cce, 0x2cce,
+ 0x2cd0, 0x2cd0,
+ 0x2cd2, 0x2cd2,
+ 0x2cd4, 0x2cd4,
+ 0x2cd6, 0x2cd6,
+ 0x2cd8, 0x2cd8,
+ 0x2cda, 0x2cda,
+ 0x2cdc, 0x2cdc,
+ 0x2cde, 0x2cde,
+ 0x2ce0, 0x2ce0,
+ 0x2ce2, 0x2ce2,
+ 0x2ceb, 0x2ceb,
+ 0x2ced, 0x2ced,
+ 0x2cf2, 0x2cf2,
+ 0xa640, 0xa640,
+ 0xa642, 0xa642,
+ 0xa644, 0xa644,
+ 0xa646, 0xa646,
+ 0xa648, 0xa648,
+ 0xa64a, 0xa64a,
+ 0xa64c, 0xa64c,
+ 0xa64e, 0xa64e,
+ 0xa650, 0xa650,
+ 0xa652, 0xa652,
+ 0xa654, 0xa654,
+ 0xa656, 0xa656,
+ 0xa658, 0xa658,
+ 0xa65a, 0xa65a,
+ 0xa65c, 0xa65c,
+ 0xa65e, 0xa65e,
+ 0xa660, 0xa660,
+ 0xa662, 0xa662,
+ 0xa664, 0xa664,
+ 0xa666, 0xa666,
+ 0xa668, 0xa668,
+ 0xa66a, 0xa66a,
+ 0xa66c, 0xa66c,
+ 0xa680, 0xa680,
+ 0xa682, 0xa682,
+ 0xa684, 0xa684,
+ 0xa686, 0xa686,
+ 0xa688, 0xa688,
+ 0xa68a, 0xa68a,
+ 0xa68c, 0xa68c,
+ 0xa68e, 0xa68e,
+ 0xa690, 0xa690,
+ 0xa692, 0xa692,
+ 0xa694, 0xa694,
+ 0xa696, 0xa696,
+ 0xa722, 0xa722,
+ 0xa724, 0xa724,
+ 0xa726, 0xa726,
+ 0xa728, 0xa728,
+ 0xa72a, 0xa72a,
+ 0xa72c, 0xa72c,
+ 0xa72e, 0xa72e,
+ 0xa732, 0xa732,
+ 0xa734, 0xa734,
+ 0xa736, 0xa736,
+ 0xa738, 0xa738,
+ 0xa73a, 0xa73a,
+ 0xa73c, 0xa73c,
+ 0xa73e, 0xa73e,
+ 0xa740, 0xa740,
+ 0xa742, 0xa742,
+ 0xa744, 0xa744,
+ 0xa746, 0xa746,
+ 0xa748, 0xa748,
+ 0xa74a, 0xa74a,
+ 0xa74c, 0xa74c,
+ 0xa74e, 0xa74e,
+ 0xa750, 0xa750,
+ 0xa752, 0xa752,
+ 0xa754, 0xa754,
+ 0xa756, 0xa756,
+ 0xa758, 0xa758,
+ 0xa75a, 0xa75a,
+ 0xa75c, 0xa75c,
+ 0xa75e, 0xa75e,
+ 0xa760, 0xa760,
+ 0xa762, 0xa762,
+ 0xa764, 0xa764,
+ 0xa766, 0xa766,
+ 0xa768, 0xa768,
+ 0xa76a, 0xa76a,
+ 0xa76c, 0xa76c,
+ 0xa76e, 0xa76e,
+ 0xa779, 0xa779,
+ 0xa77b, 0xa77b,
+ 0xa77d, 0xa77e,
+ 0xa780, 0xa780,
+ 0xa782, 0xa782,
+ 0xa784, 0xa784,
+ 0xa786, 0xa786,
+ 0xa78b, 0xa78b,
+ 0xa78d, 0xa78d,
+ 0xa790, 0xa790,
+ 0xa792, 0xa792,
+ 0xa7a0, 0xa7a0,
+ 0xa7a2, 0xa7a2,
+ 0xa7a4, 0xa7a4,
+ 0xa7a6, 0xa7a6,
+ 0xa7a8, 0xa7a8,
+ 0xa7aa, 0xa7aa,
+ 0xff21, 0xff3a,
+ 0x10400, 0x10427,
+ 0x1d400, 0x1d419,
+ 0x1d434, 0x1d44d,
+ 0x1d468, 0x1d481,
+ 0x1d49c, 0x1d49c,
+ 0x1d49e, 0x1d49f,
+ 0x1d4a2, 0x1d4a2,
+ 0x1d4a5, 0x1d4a6,
+ 0x1d4a9, 0x1d4ac,
+ 0x1d4ae, 0x1d4b5,
+ 0x1d4d0, 0x1d4e9,
+ 0x1d504, 0x1d505,
+ 0x1d507, 0x1d50a,
+ 0x1d50d, 0x1d514,
+ 0x1d516, 0x1d51c,
+ 0x1d538, 0x1d539,
+ 0x1d53b, 0x1d53e,
+ 0x1d540, 0x1d544,
+ 0x1d546, 0x1d546,
+ 0x1d54a, 0x1d550,
+ 0x1d56c, 0x1d585,
+ 0x1d5a0, 0x1d5b9,
+ 0x1d5d4, 0x1d5ed,
+ 0x1d608, 0x1d621,
+ 0x1d63c, 0x1d655,
+ 0x1d670, 0x1d689,
+ 0x1d6a8, 0x1d6c0,
+ 0x1d6e2, 0x1d6fa,
+ 0x1d71c, 0x1d734,
+ 0x1d756, 0x1d76e,
+ 0x1d790, 0x1d7a8,
+ 0x1d7ca, 0x1d7ca,
+}; /* CR_Upper */
+
+/* 'XDigit': [[:XDigit:]] */
+static const OnigCodePoint CR_XDigit[] = {
+ 3,
+ 0x0030, 0x0039,
+ 0x0041, 0x0046,
+ 0x0061, 0x0066,
+}; /* CR_XDigit */
+
+/* 'Word': [[:Word:]] */
+static const OnigCodePoint CR_Word[] = {
+ 564,
+ 0x0030, 0x0039,
+ 0x0041, 0x005a,
+ 0x005f, 0x005f,
+ 0x0061, 0x007a,
+ 0x00aa, 0x00aa,
+ 0x00b5, 0x00b5,
+ 0x00ba, 0x00ba,
+ 0x00c0, 0x00d6,
+ 0x00d8, 0x00f6,
+ 0x00f8, 0x02c1,
+ 0x02c6, 0x02d1,
+ 0x02e0, 0x02e4,
+ 0x02ec, 0x02ec,
+ 0x02ee, 0x02ee,
+ 0x0300, 0x0374,
+ 0x0376, 0x0377,
+ 0x037a, 0x037d,
+ 0x0386, 0x0386,
+ 0x0388, 0x038a,
+ 0x038c, 0x038c,
+ 0x038e, 0x03a1,
+ 0x03a3, 0x03f5,
+ 0x03f7, 0x0481,
+ 0x0483, 0x0527,
+ 0x0531, 0x0556,
+ 0x0559, 0x0559,
+ 0x0561, 0x0587,
+ 0x0591, 0x05bd,
+ 0x05bf, 0x05bf,
+ 0x05c1, 0x05c2,
+ 0x05c4, 0x05c5,
+ 0x05c7, 0x05c7,
+ 0x05d0, 0x05ea,
+ 0x05f0, 0x05f2,
+ 0x0610, 0x061a,
+ 0x0620, 0x0669,
+ 0x066e, 0x06d3,
+ 0x06d5, 0x06dc,
+ 0x06df, 0x06e8,
+ 0x06ea, 0x06fc,
+ 0x06ff, 0x06ff,
+ 0x0710, 0x074a,
+ 0x074d, 0x07b1,
+ 0x07c0, 0x07f5,
+ 0x07fa, 0x07fa,
+ 0x0800, 0x082d,
+ 0x0840, 0x085b,
+ 0x08a0, 0x08a0,
+ 0x08a2, 0x08ac,
+ 0x08e4, 0x08fe,
+ 0x0900, 0x0963,
+ 0x0966, 0x096f,
+ 0x0971, 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, 0x09f1,
+ 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, 0x0aef,
+ 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, 0x0b6f,
+ 0x0b71, 0x0b71,
+ 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, 0x0bef,
+ 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,
+ 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, 0x0d6f,
+ 0x0d7a, 0x0d7f,
+ 0x0d82, 0x0d83,
+ 0x0d85, 0x0d96,
+ 0x0d9a, 0x0db1,
+ 0x0db3, 0x0dbb,
+ 0x0dbd, 0x0dbd,
+ 0x0dc0, 0x0dc6,
+ 0x0dca, 0x0dca,
+ 0x0dcf, 0x0dd4,
+ 0x0dd6, 0x0dd6,
+ 0x0dd8, 0x0ddf,
+ 0x0df2, 0x0df3,
+ 0x0e01, 0x0e3a,
+ 0x0e40, 0x0e4e,
+ 0x0e50, 0x0e59,
+ 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, 0x0f00,
+ 0x0f18, 0x0f19,
+ 0x0f20, 0x0f29,
+ 0x0f35, 0x0f35,
+ 0x0f37, 0x0f37,
+ 0x0f39, 0x0f39,
+ 0x0f3e, 0x0f47,
+ 0x0f49, 0x0f6c,
+ 0x0f71, 0x0f84,
+ 0x0f86, 0x0f97,
+ 0x0f99, 0x0fbc,
+ 0x0fc6, 0x0fc6,
+ 0x1000, 0x1049,
+ 0x1050, 0x109d,
+ 0x10a0, 0x10c5,
+ 0x10c7, 0x10c7,
+ 0x10cd, 0x10cd,
+ 0x10d0, 0x10fa,
+ 0x10fc, 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, 0x135f,
+ 0x1380, 0x138f,
+ 0x13a0, 0x13f4,
+ 0x1401, 0x166c,
+ 0x166f, 0x167f,
+ 0x1681, 0x169a,
+ 0x16a0, 0x16ea,
+ 0x16ee, 0x16f0,
+ 0x1700, 0x170c,
+ 0x170e, 0x1714,
+ 0x1720, 0x1734,
+ 0x1740, 0x1753,
+ 0x1760, 0x176c,
+ 0x176e, 0x1770,
+ 0x1772, 0x1773,
+ 0x1780, 0x17d3,
+ 0x17d7, 0x17d7,
+ 0x17dc, 0x17dd,
+ 0x17e0, 0x17e9,
+ 0x180b, 0x180d,
+ 0x1810, 0x1819,
+ 0x1820, 0x1877,
+ 0x1880, 0x18aa,
+ 0x18b0, 0x18f5,
+ 0x1900, 0x191c,
+ 0x1920, 0x192b,
+ 0x1930, 0x193b,
+ 0x1946, 0x196d,
+ 0x1970, 0x1974,
+ 0x1980, 0x19ab,
+ 0x19b0, 0x19c9,
+ 0x19d0, 0x19d9,
+ 0x1a00, 0x1a1b,
+ 0x1a20, 0x1a5e,
+ 0x1a60, 0x1a7c,
+ 0x1a7f, 0x1a89,
+ 0x1a90, 0x1a99,
+ 0x1aa7, 0x1aa7,
+ 0x1b00, 0x1b4b,
+ 0x1b50, 0x1b59,
+ 0x1b6b, 0x1b73,
+ 0x1b80, 0x1bf3,
+ 0x1c00, 0x1c37,
+ 0x1c40, 0x1c49,
+ 0x1c4d, 0x1c7d,
+ 0x1cd0, 0x1cd2,
+ 0x1cd4, 0x1cf6,
+ 0x1d00, 0x1de6,
+ 0x1dfc, 0x1f15,
+ 0x1f18, 0x1f1d,
+ 0x1f20, 0x1f45,
+ 0x1f48, 0x1f4d,
+ 0x1f50, 0x1f57,
+ 0x1f59, 0x1f59,
+ 0x1f5b, 0x1f5b,
+ 0x1f5d, 0x1f5d,
+ 0x1f5f, 0x1f7d,
+ 0x1f80, 0x1fb4,
+ 0x1fb6, 0x1fbc,
+ 0x1fbe, 0x1fbe,
+ 0x1fc2, 0x1fc4,
+ 0x1fc6, 0x1fcc,
+ 0x1fd0, 0x1fd3,
+ 0x1fd6, 0x1fdb,
+ 0x1fe0, 0x1fec,
+ 0x1ff2, 0x1ff4,
+ 0x1ff6, 0x1ffc,
+ 0x203f, 0x2040,
+ 0x2054, 0x2054,
+ 0x2071, 0x2071,
+ 0x207f, 0x207f,
+ 0x2090, 0x209c,
+ 0x20d0, 0x20f0,
+ 0x2102, 0x2102,
+ 0x2107, 0x2107,
+ 0x210a, 0x2113,
+ 0x2115, 0x2115,
+ 0x2119, 0x211d,
+ 0x2124, 0x2124,
+ 0x2126, 0x2126,
+ 0x2128, 0x2128,
+ 0x212a, 0x212d,
+ 0x212f, 0x2139,
+ 0x213c, 0x213f,
+ 0x2145, 0x2149,
+ 0x214e, 0x214e,
+ 0x2160, 0x2188,
+ 0x24b6, 0x24e9,
+ 0x2c00, 0x2c2e,
+ 0x2c30, 0x2c5e,
+ 0x2c60, 0x2ce4,
+ 0x2ceb, 0x2cf3,
+ 0x2d00, 0x2d25,
+ 0x2d27, 0x2d27,
+ 0x2d2d, 0x2d2d,
+ 0x2d30, 0x2d67,
+ 0x2d6f, 0x2d6f,
+ 0x2d7f, 0x2d96,
+ 0x2da0, 0x2da6,
+ 0x2da8, 0x2dae,
+ 0x2db0, 0x2db6,
+ 0x2db8, 0x2dbe,
+ 0x2dc0, 0x2dc6,
+ 0x2dc8, 0x2dce,
+ 0x2dd0, 0x2dd6,
+ 0x2dd8, 0x2dde,
+ 0x2de0, 0x2dff,
+ 0x2e2f, 0x2e2f,
+ 0x3005, 0x3007,
+ 0x3021, 0x302f,
+ 0x3031, 0x3035,
+ 0x3038, 0x303c,
+ 0x3041, 0x3096,
+ 0x3099, 0x309a,
+ 0x309d, 0x309f,
+ 0x30a1, 0x30fa,
+ 0x30fc, 0x30ff,
+ 0x3105, 0x312d,
+ 0x3131, 0x318e,
+ 0x31a0, 0x31ba,
+ 0x31f0, 0x31ff,
+ 0x3400, 0x4db5,
+ 0x4e00, 0x9fcc,
+ 0xa000, 0xa48c,
+ 0xa4d0, 0xa4fd,
+ 0xa500, 0xa60c,
+ 0xa610, 0xa62b,
+ 0xa640, 0xa672,
+ 0xa674, 0xa67d,
+ 0xa67f, 0xa697,
+ 0xa69f, 0xa6f1,
+ 0xa717, 0xa71f,
+ 0xa722, 0xa788,
+ 0xa78b, 0xa78e,
+ 0xa790, 0xa793,
+ 0xa7a0, 0xa7aa,
+ 0xa7f8, 0xa827,
+ 0xa840, 0xa873,
+ 0xa880, 0xa8c4,
+ 0xa8d0, 0xa8d9,
+ 0xa8e0, 0xa8f7,
+ 0xa8fb, 0xa8fb,
+ 0xa900, 0xa92d,
+ 0xa930, 0xa953,
+ 0xa960, 0xa97c,
+ 0xa980, 0xa9c0,
+ 0xa9cf, 0xa9d9,
+ 0xaa00, 0xaa36,
+ 0xaa40, 0xaa4d,
+ 0xaa50, 0xaa59,
+ 0xaa60, 0xaa76,
+ 0xaa7a, 0xaa7b,
+ 0xaa80, 0xaac2,
+ 0xaadb, 0xaadd,
+ 0xaae0, 0xaaef,
+ 0xaaf2, 0xaaf6,
+ 0xab01, 0xab06,
+ 0xab09, 0xab0e,
+ 0xab11, 0xab16,
+ 0xab20, 0xab26,
+ 0xab28, 0xab2e,
+ 0xabc0, 0xabea,
+ 0xabec, 0xabed,
+ 0xabf0, 0xabf9,
+ 0xac00, 0xd7a3,
+ 0xd7b0, 0xd7c6,
+ 0xd7cb, 0xd7fb,
+ 0xf900, 0xfa6d,
+ 0xfa70, 0xfad9,
+ 0xfb00, 0xfb06,
+ 0xfb13, 0xfb17,
+ 0xfb1d, 0xfb28,
+ 0xfb2a, 0xfb36,
+ 0xfb38, 0xfb3c,
+ 0xfb3e, 0xfb3e,
+ 0xfb40, 0xfb41,
+ 0xfb43, 0xfb44,
+ 0xfb46, 0xfbb1,
+ 0xfbd3, 0xfd3d,
+ 0xfd50, 0xfd8f,
+ 0xfd92, 0xfdc7,
+ 0xfdf0, 0xfdfb,
+ 0xfe00, 0xfe0f,
+ 0xfe20, 0xfe26,
+ 0xfe33, 0xfe34,
+ 0xfe4d, 0xfe4f,
+ 0xfe70, 0xfe74,
+ 0xfe76, 0xfefc,
+ 0xff10, 0xff19,
+ 0xff21, 0xff3a,
+ 0xff3f, 0xff3f,
+ 0xff41, 0xff5a,
+ 0xff66, 0xffbe,
+ 0xffc2, 0xffc7,
+ 0xffca, 0xffcf,
+ 0xffd2, 0xffd7,
+ 0xffda, 0xffdc,
+ 0x10000, 0x1000b,
+ 0x1000d, 0x10026,
+ 0x10028, 0x1003a,
+ 0x1003c, 0x1003d,
+ 0x1003f, 0x1004d,
+ 0x10050, 0x1005d,
+ 0x10080, 0x100fa,
+ 0x10140, 0x10174,
+ 0x101fd, 0x101fd,
+ 0x10280, 0x1029c,
+ 0x102a0, 0x102d0,
+ 0x10300, 0x1031e,
+ 0x10330, 0x1034a,
+ 0x10380, 0x1039d,
+ 0x103a0, 0x103c3,
+ 0x103c8, 0x103cf,
+ 0x103d1, 0x103d5,
+ 0x10400, 0x1049d,
+ 0x104a0, 0x104a9,
+ 0x10800, 0x10805,
+ 0x10808, 0x10808,
+ 0x1080a, 0x10835,
+ 0x10837, 0x10838,
+ 0x1083c, 0x1083c,
+ 0x1083f, 0x10855,
+ 0x10900, 0x10915,
+ 0x10920, 0x10939,
+ 0x10980, 0x109b7,
+ 0x109be, 0x109bf,
+ 0x10a00, 0x10a03,
+ 0x10a05, 0x10a06,
+ 0x10a0c, 0x10a13,
+ 0x10a15, 0x10a17,
+ 0x10a19, 0x10a33,
+ 0x10a38, 0x10a3a,
+ 0x10a3f, 0x10a3f,
+ 0x10a60, 0x10a7c,
+ 0x10b00, 0x10b35,
+ 0x10b40, 0x10b55,
+ 0x10b60, 0x10b72,
+ 0x10c00, 0x10c48,
+ 0x11000, 0x11046,
+ 0x11066, 0x1106f,
+ 0x11080, 0x110ba,
+ 0x110d0, 0x110e8,
+ 0x110f0, 0x110f9,
+ 0x11100, 0x11134,
+ 0x11136, 0x1113f,
+ 0x11180, 0x111c4,
+ 0x111d0, 0x111d9,
+ 0x11680, 0x116b7,
+ 0x116c0, 0x116c9,
+ 0x12000, 0x1236e,
+ 0x12400, 0x12462,
+ 0x13000, 0x1342e,
+ 0x16800, 0x16a38,
+ 0x16f00, 0x16f44,
+ 0x16f50, 0x16f7e,
+ 0x16f8f, 0x16f9f,
+ 0x1b000, 0x1b001,
+ 0x1d165, 0x1d169,
+ 0x1d16d, 0x1d172,
+ 0x1d17b, 0x1d182,
+ 0x1d185, 0x1d18b,
+ 0x1d1aa, 0x1d1ad,
+ 0x1d242, 0x1d244,
+ 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, 0x1d6c0,
+ 0x1d6c2, 0x1d6da,
+ 0x1d6dc, 0x1d6fa,
+ 0x1d6fc, 0x1d714,
+ 0x1d716, 0x1d734,
+ 0x1d736, 0x1d74e,
+ 0x1d750, 0x1d76e,
+ 0x1d770, 0x1d788,
+ 0x1d78a, 0x1d7a8,
+ 0x1d7aa, 0x1d7c2,
+ 0x1d7c4, 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,
+ 0x20000, 0x2a6d6,
+ 0x2a700, 0x2b734,
+ 0x2b740, 0x2b81d,
+ 0x2f800, 0x2fa1d,
+ 0xe0100, 0xe01ef,
+}; /* CR_Word */
+
+/* 'Alnum': [[:Alnum:]] */
+static const OnigCodePoint CR_Alnum[] = {
+ 566,
+ 0x0030, 0x0039,
+ 0x0041, 0x005a,
+ 0x0061, 0x007a,
+ 0x00aa, 0x00aa,
+ 0x00b5, 0x00b5,
+ 0x00ba, 0x00ba,
+ 0x00c0, 0x00d6,
+ 0x00d8, 0x00f6,
+ 0x00f8, 0x02c1,
+ 0x02c6, 0x02d1,
+ 0x02e0, 0x02e4,
+ 0x02ec, 0x02ec,
+ 0x02ee, 0x02ee,
+ 0x0345, 0x0345,
+ 0x0370, 0x0374,
+ 0x0376, 0x0377,
+ 0x037a, 0x037d,
+ 0x0386, 0x0386,
+ 0x0388, 0x038a,
+ 0x038c, 0x038c,
+ 0x038e, 0x03a1,
+ 0x03a3, 0x03f5,
+ 0x03f7, 0x0481,
+ 0x048a, 0x0527,
+ 0x0531, 0x0556,
+ 0x0559, 0x0559,
+ 0x0561, 0x0587,
+ 0x05b0, 0x05bd,
+ 0x05bf, 0x05bf,
+ 0x05c1, 0x05c2,
+ 0x05c4, 0x05c5,
+ 0x05c7, 0x05c7,
+ 0x05d0, 0x05ea,
+ 0x05f0, 0x05f2,
+ 0x0610, 0x061a,
+ 0x0620, 0x0657,
+ 0x0659, 0x0669,
+ 0x066e, 0x06d3,
+ 0x06d5, 0x06dc,
+ 0x06e1, 0x06e8,
+ 0x06ed, 0x06fc,
+ 0x06ff, 0x06ff,
+ 0x0710, 0x073f,
+ 0x074d, 0x07b1,
+ 0x07c0, 0x07ea,
+ 0x07f4, 0x07f5,
+ 0x07fa, 0x07fa,
+ 0x0800, 0x0817,
+ 0x081a, 0x082c,
+ 0x0840, 0x0858,
+ 0x08a0, 0x08a0,
+ 0x08a2, 0x08ac,
+ 0x08e4, 0x08e9,
+ 0x08f0, 0x08fe,
+ 0x0900, 0x093b,
+ 0x093d, 0x094c,
+ 0x094e, 0x0950,
+ 0x0955, 0x0963,
+ 0x0966, 0x096f,
+ 0x0971, 0x0977,
+ 0x0979, 0x097f,
+ 0x0981, 0x0983,
+ 0x0985, 0x098c,
+ 0x098f, 0x0990,
+ 0x0993, 0x09a8,
+ 0x09aa, 0x09b0,
+ 0x09b2, 0x09b2,
+ 0x09b6, 0x09b9,
+ 0x09bd, 0x09c4,
+ 0x09c7, 0x09c8,
+ 0x09cb, 0x09cc,
+ 0x09ce, 0x09ce,
+ 0x09d7, 0x09d7,
+ 0x09dc, 0x09dd,
+ 0x09df, 0x09e3,
+ 0x09e6, 0x09f1,
+ 0x0a01, 0x0a03,
+ 0x0a05, 0x0a0a,
+ 0x0a0f, 0x0a10,
+ 0x0a13, 0x0a28,
+ 0x0a2a, 0x0a30,
+ 0x0a32, 0x0a33,
+ 0x0a35, 0x0a36,
+ 0x0a38, 0x0a39,
+ 0x0a3e, 0x0a42,
+ 0x0a47, 0x0a48,
+ 0x0a4b, 0x0a4c,
+ 0x0a51, 0x0a51,
+ 0x0a59, 0x0a5c,
+ 0x0a5e, 0x0a5e,
+ 0x0a66, 0x0a75,
+ 0x0a81, 0x0a83,
+ 0x0a85, 0x0a8d,
+ 0x0a8f, 0x0a91,
+ 0x0a93, 0x0aa8,
+ 0x0aaa, 0x0ab0,
+ 0x0ab2, 0x0ab3,
+ 0x0ab5, 0x0ab9,
+ 0x0abd, 0x0ac5,
+ 0x0ac7, 0x0ac9,
+ 0x0acb, 0x0acc,
+ 0x0ad0, 0x0ad0,
+ 0x0ae0, 0x0ae3,
+ 0x0ae6, 0x0aef,
+ 0x0b01, 0x0b03,
+ 0x0b05, 0x0b0c,
+ 0x0b0f, 0x0b10,
+ 0x0b13, 0x0b28,
+ 0x0b2a, 0x0b30,
+ 0x0b32, 0x0b33,
+ 0x0b35, 0x0b39,
+ 0x0b3d, 0x0b44,
+ 0x0b47, 0x0b48,
+ 0x0b4b, 0x0b4c,
+ 0x0b56, 0x0b57,
+ 0x0b5c, 0x0b5d,
+ 0x0b5f, 0x0b63,
+ 0x0b66, 0x0b6f,
+ 0x0b71, 0x0b71,
+ 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, 0x0bcc,
+ 0x0bd0, 0x0bd0,
+ 0x0bd7, 0x0bd7,
+ 0x0be6, 0x0bef,
+ 0x0c01, 0x0c03,
+ 0x0c05, 0x0c0c,
+ 0x0c0e, 0x0c10,
+ 0x0c12, 0x0c28,
+ 0x0c2a, 0x0c33,
+ 0x0c35, 0x0c39,
+ 0x0c3d, 0x0c44,
+ 0x0c46, 0x0c48,
+ 0x0c4a, 0x0c4c,
+ 0x0c55, 0x0c56,
+ 0x0c58, 0x0c59,
+ 0x0c60, 0x0c63,
+ 0x0c66, 0x0c6f,
+ 0x0c82, 0x0c83,
+ 0x0c85, 0x0c8c,
+ 0x0c8e, 0x0c90,
+ 0x0c92, 0x0ca8,
+ 0x0caa, 0x0cb3,
+ 0x0cb5, 0x0cb9,
+ 0x0cbd, 0x0cc4,
+ 0x0cc6, 0x0cc8,
+ 0x0cca, 0x0ccc,
+ 0x0cd5, 0x0cd6,
+ 0x0cde, 0x0cde,
+ 0x0ce0, 0x0ce3,
+ 0x0ce6, 0x0cef,
+ 0x0cf1, 0x0cf2,
+ 0x0d02, 0x0d03,
+ 0x0d05, 0x0d0c,
+ 0x0d0e, 0x0d10,
+ 0x0d12, 0x0d3a,
+ 0x0d3d, 0x0d44,
+ 0x0d46, 0x0d48,
+ 0x0d4a, 0x0d4c,
+ 0x0d4e, 0x0d4e,
+ 0x0d57, 0x0d57,
+ 0x0d60, 0x0d63,
+ 0x0d66, 0x0d6f,
+ 0x0d7a, 0x0d7f,
+ 0x0d82, 0x0d83,
+ 0x0d85, 0x0d96,
+ 0x0d9a, 0x0db1,
+ 0x0db3, 0x0dbb,
+ 0x0dbd, 0x0dbd,
+ 0x0dc0, 0x0dc6,
+ 0x0dcf, 0x0dd4,
+ 0x0dd6, 0x0dd6,
+ 0x0dd8, 0x0ddf,
+ 0x0df2, 0x0df3,
+ 0x0e01, 0x0e3a,
+ 0x0e40, 0x0e46,
+ 0x0e4d, 0x0e4d,
+ 0x0e50, 0x0e59,
+ 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,
+ 0x0ecd, 0x0ecd,
+ 0x0ed0, 0x0ed9,
+ 0x0edc, 0x0edf,
+ 0x0f00, 0x0f00,
+ 0x0f20, 0x0f29,
+ 0x0f40, 0x0f47,
+ 0x0f49, 0x0f6c,
+ 0x0f71, 0x0f81,
+ 0x0f88, 0x0f97,
+ 0x0f99, 0x0fbc,
+ 0x1000, 0x1036,
+ 0x1038, 0x1038,
+ 0x103b, 0x1049,
+ 0x1050, 0x1062,
+ 0x1065, 0x1068,
+ 0x106e, 0x1086,
+ 0x108e, 0x108e,
+ 0x1090, 0x1099,
+ 0x109c, 0x109d,
+ 0x10a0, 0x10c5,
+ 0x10c7, 0x10c7,
+ 0x10cd, 0x10cd,
+ 0x10d0, 0x10fa,
+ 0x10fc, 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,
+ 0x135f, 0x135f,
+ 0x1380, 0x138f,
+ 0x13a0, 0x13f4,
+ 0x1401, 0x166c,
+ 0x166f, 0x167f,
+ 0x1681, 0x169a,
+ 0x16a0, 0x16ea,
+ 0x16ee, 0x16f0,
+ 0x1700, 0x170c,
+ 0x170e, 0x1713,
+ 0x1720, 0x1733,
+ 0x1740, 0x1753,
+ 0x1760, 0x176c,
+ 0x176e, 0x1770,
+ 0x1772, 0x1773,
+ 0x1780, 0x17b3,
+ 0x17b6, 0x17c8,
+ 0x17d7, 0x17d7,
+ 0x17dc, 0x17dc,
+ 0x17e0, 0x17e9,
+ 0x1810, 0x1819,
+ 0x1820, 0x1877,
+ 0x1880, 0x18aa,
+ 0x18b0, 0x18f5,
+ 0x1900, 0x191c,
+ 0x1920, 0x192b,
+ 0x1930, 0x1938,
+ 0x1946, 0x196d,
+ 0x1970, 0x1974,
+ 0x1980, 0x19ab,
+ 0x19b0, 0x19c9,
+ 0x19d0, 0x19d9,
+ 0x1a00, 0x1a1b,
+ 0x1a20, 0x1a5e,
+ 0x1a61, 0x1a74,
+ 0x1a80, 0x1a89,
+ 0x1a90, 0x1a99,
+ 0x1aa7, 0x1aa7,
+ 0x1b00, 0x1b33,
+ 0x1b35, 0x1b43,
+ 0x1b45, 0x1b4b,
+ 0x1b50, 0x1b59,
+ 0x1b80, 0x1ba9,
+ 0x1bac, 0x1be5,
+ 0x1be7, 0x1bf1,
+ 0x1c00, 0x1c35,
+ 0x1c40, 0x1c49,
+ 0x1c4d, 0x1c7d,
+ 0x1ce9, 0x1cec,
+ 0x1cee, 0x1cf3,
+ 0x1cf5, 0x1cf6,
+ 0x1d00, 0x1dbf,
+ 0x1e00, 0x1f15,
+ 0x1f18, 0x1f1d,
+ 0x1f20, 0x1f45,
+ 0x1f48, 0x1f4d,
+ 0x1f50, 0x1f57,
+ 0x1f59, 0x1f59,
+ 0x1f5b, 0x1f5b,
+ 0x1f5d, 0x1f5d,
+ 0x1f5f, 0x1f7d,
+ 0x1f80, 0x1fb4,
+ 0x1fb6, 0x1fbc,
+ 0x1fbe, 0x1fbe,
+ 0x1fc2, 0x1fc4,
+ 0x1fc6, 0x1fcc,
+ 0x1fd0, 0x1fd3,
+ 0x1fd6, 0x1fdb,
+ 0x1fe0, 0x1fec,
+ 0x1ff2, 0x1ff4,
+ 0x1ff6, 0x1ffc,
+ 0x2071, 0x2071,
+ 0x207f, 0x207f,
+ 0x2090, 0x209c,
+ 0x2102, 0x2102,
+ 0x2107, 0x2107,
+ 0x210a, 0x2113,
+ 0x2115, 0x2115,
+ 0x2119, 0x211d,
+ 0x2124, 0x2124,
+ 0x2126, 0x2126,
+ 0x2128, 0x2128,
+ 0x212a, 0x212d,
+ 0x212f, 0x2139,
+ 0x213c, 0x213f,
+ 0x2145, 0x2149,
+ 0x214e, 0x214e,
+ 0x2160, 0x2188,
+ 0x24b6, 0x24e9,
+ 0x2c00, 0x2c2e,
+ 0x2c30, 0x2c5e,
+ 0x2c60, 0x2ce4,
+ 0x2ceb, 0x2cee,
+ 0x2cf2, 0x2cf3,
+ 0x2d00, 0x2d25,
+ 0x2d27, 0x2d27,
+ 0x2d2d, 0x2d2d,
+ 0x2d30, 0x2d67,
+ 0x2d6f, 0x2d6f,
+ 0x2d80, 0x2d96,
+ 0x2da0, 0x2da6,
+ 0x2da8, 0x2dae,
+ 0x2db0, 0x2db6,
+ 0x2db8, 0x2dbe,
+ 0x2dc0, 0x2dc6,
+ 0x2dc8, 0x2dce,
+ 0x2dd0, 0x2dd6,
+ 0x2dd8, 0x2dde,
+ 0x2de0, 0x2dff,
+ 0x2e2f, 0x2e2f,
+ 0x3005, 0x3007,
+ 0x3021, 0x3029,
+ 0x3031, 0x3035,
+ 0x3038, 0x303c,
+ 0x3041, 0x3096,
+ 0x309d, 0x309f,
+ 0x30a1, 0x30fa,
+ 0x30fc, 0x30ff,
+ 0x3105, 0x312d,
+ 0x3131, 0x318e,
+ 0x31a0, 0x31ba,
+ 0x31f0, 0x31ff,
+ 0x3400, 0x4db5,
+ 0x4e00, 0x9fcc,
+ 0xa000, 0xa48c,
+ 0xa4d0, 0xa4fd,
+ 0xa500, 0xa60c,
+ 0xa610, 0xa62b,
+ 0xa640, 0xa66e,
+ 0xa674, 0xa67b,
+ 0xa67f, 0xa697,
+ 0xa69f, 0xa6ef,
+ 0xa717, 0xa71f,
+ 0xa722, 0xa788,
+ 0xa78b, 0xa78e,
+ 0xa790, 0xa793,
+ 0xa7a0, 0xa7aa,
+ 0xa7f8, 0xa801,
+ 0xa803, 0xa805,
+ 0xa807, 0xa80a,
+ 0xa80c, 0xa827,
+ 0xa840, 0xa873,
+ 0xa880, 0xa8c3,
+ 0xa8d0, 0xa8d9,
+ 0xa8f2, 0xa8f7,
+ 0xa8fb, 0xa8fb,
+ 0xa900, 0xa92a,
+ 0xa930, 0xa952,
+ 0xa960, 0xa97c,
+ 0xa980, 0xa9b2,
+ 0xa9b4, 0xa9bf,
+ 0xa9cf, 0xa9d9,
+ 0xaa00, 0xaa36,
+ 0xaa40, 0xaa4d,
+ 0xaa50, 0xaa59,
+ 0xaa60, 0xaa76,
+ 0xaa7a, 0xaa7a,
+ 0xaa80, 0xaabe,
+ 0xaac0, 0xaac0,
+ 0xaac2, 0xaac2,
+ 0xaadb, 0xaadd,
+ 0xaae0, 0xaaef,
+ 0xaaf2, 0xaaf5,
+ 0xab01, 0xab06,
+ 0xab09, 0xab0e,
+ 0xab11, 0xab16,
+ 0xab20, 0xab26,
+ 0xab28, 0xab2e,
+ 0xabc0, 0xabea,
+ 0xabf0, 0xabf9,
+ 0xac00, 0xd7a3,
+ 0xd7b0, 0xd7c6,
+ 0xd7cb, 0xd7fb,
+ 0xf900, 0xfa6d,
+ 0xfa70, 0xfad9,
+ 0xfb00, 0xfb06,
+ 0xfb13, 0xfb17,
+ 0xfb1d, 0xfb28,
+ 0xfb2a, 0xfb36,
+ 0xfb38, 0xfb3c,
+ 0xfb3e, 0xfb3e,
+ 0xfb40, 0xfb41,
+ 0xfb43, 0xfb44,
+ 0xfb46, 0xfbb1,
+ 0xfbd3, 0xfd3d,
+ 0xfd50, 0xfd8f,
+ 0xfd92, 0xfdc7,
+ 0xfdf0, 0xfdfb,
+ 0xfe70, 0xfe74,
+ 0xfe76, 0xfefc,
+ 0xff10, 0xff19,
+ 0xff21, 0xff3a,
+ 0xff41, 0xff5a,
+ 0xff66, 0xffbe,
+ 0xffc2, 0xffc7,
+ 0xffca, 0xffcf,
+ 0xffd2, 0xffd7,
+ 0xffda, 0xffdc,
+ 0x10000, 0x1000b,
+ 0x1000d, 0x10026,
+ 0x10028, 0x1003a,
+ 0x1003c, 0x1003d,
+ 0x1003f, 0x1004d,
+ 0x10050, 0x1005d,
+ 0x10080, 0x100fa,
+ 0x10140, 0x10174,
+ 0x10280, 0x1029c,
+ 0x102a0, 0x102d0,
+ 0x10300, 0x1031e,
+ 0x10330, 0x1034a,
+ 0x10380, 0x1039d,
+ 0x103a0, 0x103c3,
+ 0x103c8, 0x103cf,
+ 0x103d1, 0x103d5,
+ 0x10400, 0x1049d,
+ 0x104a0, 0x104a9,
+ 0x10800, 0x10805,
+ 0x10808, 0x10808,
+ 0x1080a, 0x10835,
+ 0x10837, 0x10838,
+ 0x1083c, 0x1083c,
+ 0x1083f, 0x10855,
+ 0x10900, 0x10915,
+ 0x10920, 0x10939,
+ 0x10980, 0x109b7,
+ 0x109be, 0x109bf,
+ 0x10a00, 0x10a03,
+ 0x10a05, 0x10a06,
+ 0x10a0c, 0x10a13,
+ 0x10a15, 0x10a17,
+ 0x10a19, 0x10a33,
+ 0x10a60, 0x10a7c,
+ 0x10b00, 0x10b35,
+ 0x10b40, 0x10b55,
+ 0x10b60, 0x10b72,
+ 0x10c00, 0x10c48,
+ 0x11000, 0x11045,
+ 0x11066, 0x1106f,
+ 0x11082, 0x110b8,
+ 0x110d0, 0x110e8,
+ 0x110f0, 0x110f9,
+ 0x11100, 0x11132,
+ 0x11136, 0x1113f,
+ 0x11180, 0x111bf,
+ 0x111c1, 0x111c4,
+ 0x111d0, 0x111d9,
+ 0x11680, 0x116b5,
+ 0x116c0, 0x116c9,
+ 0x12000, 0x1236e,
+ 0x12400, 0x12462,
+ 0x13000, 0x1342e,
+ 0x16800, 0x16a38,
+ 0x16f00, 0x16f44,
+ 0x16f50, 0x16f7e,
+ 0x16f93, 0x16f9f,
+ 0x1b000, 0x1b001,
+ 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, 0x1d6c0,
+ 0x1d6c2, 0x1d6da,
+ 0x1d6dc, 0x1d6fa,
+ 0x1d6fc, 0x1d714,
+ 0x1d716, 0x1d734,
+ 0x1d736, 0x1d74e,
+ 0x1d750, 0x1d76e,
+ 0x1d770, 0x1d788,
+ 0x1d78a, 0x1d7a8,
+ 0x1d7aa, 0x1d7c2,
+ 0x1d7c4, 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,
+ 0x20000, 0x2a6d6,
+ 0x2a700, 0x2b734,
+ 0x2b740, 0x2b81d,
+ 0x2f800, 0x2fa1d,
+}; /* CR_Alnum */
+
+/* 'ASCII': [[:ASCII:]] */
+static const OnigCodePoint CR_ASCII[] = {
+ 1,
+ 0x0000, 0x007f,
+}; /* CR_ASCII */
+
#ifdef USE_UNICODE_PROPERTIES
/* 'Any': - */
static const OnigCodePoint CR_Any[] = {
@@ -46,7 +4312,7 @@ static const OnigCodePoint CR_Any[] = {
/* 'Assigned': - */
static const OnigCodePoint CR_Assigned[] = {
- 501,
+ 539,
0x0000, 0x0377,
0x037a, 0x037e,
0x0384, 0x038a,
@@ -57,10 +4323,11 @@ static const OnigCodePoint CR_Assigned[] = {
0x0559, 0x055f,
0x0561, 0x0587,
0x0589, 0x058a,
+ 0x058f, 0x058f,
0x0591, 0x05c7,
0x05d0, 0x05ea,
0x05f0, 0x05f4,
- 0x0600, 0x0603,
+ 0x0600, 0x0604,
0x0606, 0x061b,
0x061e, 0x070d,
0x070f, 0x074a,
@@ -70,6 +4337,9 @@ static const OnigCodePoint CR_Assigned[] = {
0x0830, 0x083e,
0x0840, 0x085b,
0x085e, 0x085e,
+ 0x08a0, 0x08a0,
+ 0x08a2, 0x08ac,
+ 0x08e4, 0x08fe,
0x0900, 0x0977,
0x0979, 0x097f,
0x0981, 0x0983,
@@ -114,8 +4384,7 @@ static const OnigCodePoint CR_Assigned[] = {
0x0acb, 0x0acd,
0x0ad0, 0x0ad0,
0x0ae0, 0x0ae3,
- 0x0ae6, 0x0aef,
- 0x0af1, 0x0af1,
+ 0x0ae6, 0x0af1,
0x0b01, 0x0b03,
0x0b05, 0x0b0c,
0x0b0f, 0x0b10,
@@ -215,7 +4484,7 @@ static const OnigCodePoint CR_Assigned[] = {
0x0ec6, 0x0ec6,
0x0ec8, 0x0ecd,
0x0ed0, 0x0ed9,
- 0x0edc, 0x0edd,
+ 0x0edc, 0x0edf,
0x0f00, 0x0f47,
0x0f49, 0x0f6c,
0x0f71, 0x0f97,
@@ -223,8 +4492,9 @@ static const OnigCodePoint CR_Assigned[] = {
0x0fbe, 0x0fcc,
0x0fce, 0x0fda,
0x1000, 0x10c5,
- 0x10d0, 0x10fc,
- 0x1100, 0x1248,
+ 0x10c7, 0x10c7,
+ 0x10cd, 0x10cd,
+ 0x10d0, 0x1248,
0x124a, 0x124d,
0x1250, 0x1256,
0x1258, 0x1258,
@@ -277,13 +4547,12 @@ static const OnigCodePoint CR_Assigned[] = {
0x1aa0, 0x1aad,
0x1b00, 0x1b4b,
0x1b50, 0x1b7c,
- 0x1b80, 0x1baa,
- 0x1bae, 0x1bb9,
- 0x1bc0, 0x1bf3,
+ 0x1b80, 0x1bf3,
0x1bfc, 0x1c37,
0x1c3b, 0x1c49,
0x1c4d, 0x1c7f,
- 0x1cd0, 0x1cf2,
+ 0x1cc0, 0x1cc7,
+ 0x1cd0, 0x1cf6,
0x1d00, 0x1de6,
0x1dfc, 0x1f15,
0x1f18, 0x1f1d,
@@ -312,15 +4581,15 @@ static const OnigCodePoint CR_Assigned[] = {
0x2400, 0x2426,
0x2440, 0x244a,
0x2460, 0x26ff,
- 0x2701, 0x27ca,
- 0x27cc, 0x27cc,
- 0x27ce, 0x2b4c,
+ 0x2701, 0x2b4c,
0x2b50, 0x2b59,
0x2c00, 0x2c2e,
0x2c30, 0x2c5e,
- 0x2c60, 0x2cf1,
+ 0x2c60, 0x2cf3,
0x2cf9, 0x2d25,
- 0x2d30, 0x2d65,
+ 0x2d27, 0x2d27,
+ 0x2d2d, 0x2d2d,
+ 0x2d30, 0x2d67,
0x2d6f, 0x2d70,
0x2d7f, 0x2d96,
0x2da0, 0x2da6,
@@ -331,7 +4600,7 @@ static const OnigCodePoint CR_Assigned[] = {
0x2dc8, 0x2dce,
0x2dd0, 0x2dd6,
0x2dd8, 0x2dde,
- 0x2de0, 0x2e31,
+ 0x2de0, 0x2e3b,
0x2e80, 0x2e99,
0x2e9b, 0x2ef3,
0x2f00, 0x2fd5,
@@ -346,17 +4615,16 @@ static const OnigCodePoint CR_Assigned[] = {
0x31f0, 0x321e,
0x3220, 0x32fe,
0x3300, 0x4db5,
- 0x4dc0, 0x9fcb,
+ 0x4dc0, 0x9fcc,
0xa000, 0xa48c,
0xa490, 0xa4c6,
0xa4d0, 0xa62b,
- 0xa640, 0xa673,
- 0xa67c, 0xa697,
- 0xa6a0, 0xa6f7,
+ 0xa640, 0xa697,
+ 0xa69f, 0xa6f7,
0xa700, 0xa78e,
- 0xa790, 0xa791,
- 0xa7a0, 0xa7a9,
- 0xa7fa, 0xa82b,
+ 0xa790, 0xa793,
+ 0xa7a0, 0xa7aa,
+ 0xa7f8, 0xa82b,
0xa830, 0xa839,
0xa840, 0xa877,
0xa880, 0xa8c4,
@@ -372,7 +4640,7 @@ static const OnigCodePoint CR_Assigned[] = {
0xaa50, 0xaa59,
0xaa5c, 0xaa7b,
0xaa80, 0xaac2,
- 0xaadb, 0xaadf,
+ 0xaadb, 0xaaf6,
0xab01, 0xab06,
0xab09, 0xab0e,
0xab11, 0xab16,
@@ -383,8 +4651,7 @@ static const OnigCodePoint CR_Assigned[] = {
0xac00, 0xd7a3,
0xd7b0, 0xd7c6,
0xd7cb, 0xd7fb,
- 0xd800, 0xfa2d,
- 0xfa30, 0xfa6d,
+ 0xd800, 0xfa6d,
0xfa70, 0xfad9,
0xfb00, 0xfb06,
0xfb13, 0xfb17,
@@ -446,6 +4713,8 @@ static const OnigCodePoint CR_Assigned[] = {
0x10900, 0x1091b,
0x1091f, 0x10939,
0x1093f, 0x1093f,
+ 0x10980, 0x109b7,
+ 0x109be, 0x109bf,
0x10a00, 0x10a03,
0x10a05, 0x10a06,
0x10a0c, 0x10a13,
@@ -464,11 +4733,22 @@ static const OnigCodePoint CR_Assigned[] = {
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,
@@ -497,6 +4777,40 @@ static const OnigCodePoint CR_Assigned[] = {
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,
@@ -505,7 +4819,7 @@ static const OnigCodePoint CR_Assigned[] = {
0x1f0d1, 0x1f0df,
0x1f100, 0x1f10a,
0x1f110, 0x1f12e,
- 0x1f130, 0x1f169,
+ 0x1f130, 0x1f16b,
0x1f170, 0x1f19a,
0x1f1e6, 0x1f202,
0x1f210, 0x1f23a,
@@ -523,19 +4837,9 @@ static const OnigCodePoint CR_Assigned[] = {
0x1f442, 0x1f4f7,
0x1f4f9, 0x1f4fc,
0x1f500, 0x1f53d,
+ 0x1f540, 0x1f543,
0x1f550, 0x1f567,
- 0x1f5fb, 0x1f5ff,
- 0x1f601, 0x1f610,
- 0x1f612, 0x1f614,
- 0x1f616, 0x1f616,
- 0x1f618, 0x1f618,
- 0x1f61a, 0x1f61a,
- 0x1f61c, 0x1f61e,
- 0x1f620, 0x1f625,
- 0x1f628, 0x1f62b,
- 0x1f62d, 0x1f62d,
- 0x1f630, 0x1f633,
- 0x1f635, 0x1f640,
+ 0x1f5fb, 0x1f640,
0x1f645, 0x1f64f,
0x1f680, 0x1f6c5,
0x1f700, 0x1f773,
@@ -552,44 +4856,560 @@ static const OnigCodePoint CR_Assigned[] = {
/* 'C': Major Category */
static const OnigCodePoint CR_C[] = {
- 20,
+ 541,
0x0000, 0x001f,
0x007f, 0x009f,
0x00ad, 0x00ad,
- 0x0600, 0x0603,
+ 0x0378, 0x0379,
+ 0x037f, 0x0383,
+ 0x038b, 0x038b,
+ 0x038d, 0x038d,
+ 0x03a2, 0x03a2,
+ 0x0528, 0x0530,
+ 0x0557, 0x0558,
+ 0x0560, 0x0560,
+ 0x0588, 0x0588,
+ 0x058b, 0x058e,
+ 0x0590, 0x0590,
+ 0x05c8, 0x05cf,
+ 0x05eb, 0x05ef,
+ 0x05f5, 0x0605,
+ 0x061c, 0x061d,
0x06dd, 0x06dd,
- 0x070f, 0x070f,
- 0x17b4, 0x17b5,
+ 0x070e, 0x070f,
+ 0x074b, 0x074c,
+ 0x07b2, 0x07bf,
+ 0x07fb, 0x07ff,
+ 0x082e, 0x082f,
+ 0x083f, 0x083f,
+ 0x085c, 0x085d,
+ 0x085f, 0x089f,
+ 0x08a1, 0x08a1,
+ 0x08ad, 0x08e3,
+ 0x08ff, 0x08ff,
+ 0x0978, 0x0978,
+ 0x0980, 0x0980,
+ 0x0984, 0x0984,
+ 0x098d, 0x098e,
+ 0x0991, 0x0992,
+ 0x09a9, 0x09a9,
+ 0x09b1, 0x09b1,
+ 0x09b3, 0x09b5,
+ 0x09ba, 0x09bb,
+ 0x09c5, 0x09c6,
+ 0x09c9, 0x09ca,
+ 0x09cf, 0x09d6,
+ 0x09d8, 0x09db,
+ 0x09de, 0x09de,
+ 0x09e4, 0x09e5,
+ 0x09fc, 0x0a00,
+ 0x0a04, 0x0a04,
+ 0x0a0b, 0x0a0e,
+ 0x0a11, 0x0a12,
+ 0x0a29, 0x0a29,
+ 0x0a31, 0x0a31,
+ 0x0a34, 0x0a34,
+ 0x0a37, 0x0a37,
+ 0x0a3a, 0x0a3b,
+ 0x0a3d, 0x0a3d,
+ 0x0a43, 0x0a46,
+ 0x0a49, 0x0a4a,
+ 0x0a4e, 0x0a50,
+ 0x0a52, 0x0a58,
+ 0x0a5d, 0x0a5d,
+ 0x0a5f, 0x0a65,
+ 0x0a76, 0x0a80,
+ 0x0a84, 0x0a84,
+ 0x0a8e, 0x0a8e,
+ 0x0a92, 0x0a92,
+ 0x0aa9, 0x0aa9,
+ 0x0ab1, 0x0ab1,
+ 0x0ab4, 0x0ab4,
+ 0x0aba, 0x0abb,
+ 0x0ac6, 0x0ac6,
+ 0x0aca, 0x0aca,
+ 0x0ace, 0x0acf,
+ 0x0ad1, 0x0adf,
+ 0x0ae4, 0x0ae5,
+ 0x0af2, 0x0b00,
+ 0x0b04, 0x0b04,
+ 0x0b0d, 0x0b0e,
+ 0x0b11, 0x0b12,
+ 0x0b29, 0x0b29,
+ 0x0b31, 0x0b31,
+ 0x0b34, 0x0b34,
+ 0x0b3a, 0x0b3b,
+ 0x0b45, 0x0b46,
+ 0x0b49, 0x0b4a,
+ 0x0b4e, 0x0b55,
+ 0x0b58, 0x0b5b,
+ 0x0b5e, 0x0b5e,
+ 0x0b64, 0x0b65,
+ 0x0b78, 0x0b81,
+ 0x0b84, 0x0b84,
+ 0x0b8b, 0x0b8d,
+ 0x0b91, 0x0b91,
+ 0x0b96, 0x0b98,
+ 0x0b9b, 0x0b9b,
+ 0x0b9d, 0x0b9d,
+ 0x0ba0, 0x0ba2,
+ 0x0ba5, 0x0ba7,
+ 0x0bab, 0x0bad,
+ 0x0bba, 0x0bbd,
+ 0x0bc3, 0x0bc5,
+ 0x0bc9, 0x0bc9,
+ 0x0bce, 0x0bcf,
+ 0x0bd1, 0x0bd6,
+ 0x0bd8, 0x0be5,
+ 0x0bfb, 0x0c00,
+ 0x0c04, 0x0c04,
+ 0x0c0d, 0x0c0d,
+ 0x0c11, 0x0c11,
+ 0x0c29, 0x0c29,
+ 0x0c34, 0x0c34,
+ 0x0c3a, 0x0c3c,
+ 0x0c45, 0x0c45,
+ 0x0c49, 0x0c49,
+ 0x0c4e, 0x0c54,
+ 0x0c57, 0x0c57,
+ 0x0c5a, 0x0c5f,
+ 0x0c64, 0x0c65,
+ 0x0c70, 0x0c77,
+ 0x0c80, 0x0c81,
+ 0x0c84, 0x0c84,
+ 0x0c8d, 0x0c8d,
+ 0x0c91, 0x0c91,
+ 0x0ca9, 0x0ca9,
+ 0x0cb4, 0x0cb4,
+ 0x0cba, 0x0cbb,
+ 0x0cc5, 0x0cc5,
+ 0x0cc9, 0x0cc9,
+ 0x0cce, 0x0cd4,
+ 0x0cd7, 0x0cdd,
+ 0x0cdf, 0x0cdf,
+ 0x0ce4, 0x0ce5,
+ 0x0cf0, 0x0cf0,
+ 0x0cf3, 0x0d01,
+ 0x0d04, 0x0d04,
+ 0x0d0d, 0x0d0d,
+ 0x0d11, 0x0d11,
+ 0x0d3b, 0x0d3c,
+ 0x0d45, 0x0d45,
+ 0x0d49, 0x0d49,
+ 0x0d4f, 0x0d56,
+ 0x0d58, 0x0d5f,
+ 0x0d64, 0x0d65,
+ 0x0d76, 0x0d78,
+ 0x0d80, 0x0d81,
+ 0x0d84, 0x0d84,
+ 0x0d97, 0x0d99,
+ 0x0db2, 0x0db2,
+ 0x0dbc, 0x0dbc,
+ 0x0dbe, 0x0dbf,
+ 0x0dc7, 0x0dc9,
+ 0x0dcb, 0x0dce,
+ 0x0dd5, 0x0dd5,
+ 0x0dd7, 0x0dd7,
+ 0x0de0, 0x0df1,
+ 0x0df5, 0x0e00,
+ 0x0e3b, 0x0e3e,
+ 0x0e5c, 0x0e80,
+ 0x0e83, 0x0e83,
+ 0x0e85, 0x0e86,
+ 0x0e89, 0x0e89,
+ 0x0e8b, 0x0e8c,
+ 0x0e8e, 0x0e93,
+ 0x0e98, 0x0e98,
+ 0x0ea0, 0x0ea0,
+ 0x0ea4, 0x0ea4,
+ 0x0ea6, 0x0ea6,
+ 0x0ea8, 0x0ea9,
+ 0x0eac, 0x0eac,
+ 0x0eba, 0x0eba,
+ 0x0ebe, 0x0ebf,
+ 0x0ec5, 0x0ec5,
+ 0x0ec7, 0x0ec7,
+ 0x0ece, 0x0ecf,
+ 0x0eda, 0x0edb,
+ 0x0ee0, 0x0eff,
+ 0x0f48, 0x0f48,
+ 0x0f6d, 0x0f70,
+ 0x0f98, 0x0f98,
+ 0x0fbd, 0x0fbd,
+ 0x0fcd, 0x0fcd,
+ 0x0fdb, 0x0fff,
+ 0x10c6, 0x10c6,
+ 0x10c8, 0x10cc,
+ 0x10ce, 0x10cf,
+ 0x1249, 0x1249,
+ 0x124e, 0x124f,
+ 0x1257, 0x1257,
+ 0x1259, 0x1259,
+ 0x125e, 0x125f,
+ 0x1289, 0x1289,
+ 0x128e, 0x128f,
+ 0x12b1, 0x12b1,
+ 0x12b6, 0x12b7,
+ 0x12bf, 0x12bf,
+ 0x12c1, 0x12c1,
+ 0x12c6, 0x12c7,
+ 0x12d7, 0x12d7,
+ 0x1311, 0x1311,
+ 0x1316, 0x1317,
+ 0x135b, 0x135c,
+ 0x137d, 0x137f,
+ 0x139a, 0x139f,
+ 0x13f5, 0x13ff,
+ 0x169d, 0x169f,
+ 0x16f1, 0x16ff,
+ 0x170d, 0x170d,
+ 0x1715, 0x171f,
+ 0x1737, 0x173f,
+ 0x1754, 0x175f,
+ 0x176d, 0x176d,
+ 0x1771, 0x1771,
+ 0x1774, 0x177f,
+ 0x17de, 0x17df,
+ 0x17ea, 0x17ef,
+ 0x17fa, 0x17ff,
+ 0x180f, 0x180f,
+ 0x181a, 0x181f,
+ 0x1878, 0x187f,
+ 0x18ab, 0x18af,
+ 0x18f6, 0x18ff,
+ 0x191d, 0x191f,
+ 0x192c, 0x192f,
+ 0x193c, 0x193f,
+ 0x1941, 0x1943,
+ 0x196e, 0x196f,
+ 0x1975, 0x197f,
+ 0x19ac, 0x19af,
+ 0x19ca, 0x19cf,
+ 0x19db, 0x19dd,
+ 0x1a1c, 0x1a1d,
+ 0x1a5f, 0x1a5f,
+ 0x1a7d, 0x1a7e,
+ 0x1a8a, 0x1a8f,
+ 0x1a9a, 0x1a9f,
+ 0x1aae, 0x1aff,
+ 0x1b4c, 0x1b4f,
+ 0x1b7d, 0x1b7f,
+ 0x1bf4, 0x1bfb,
+ 0x1c38, 0x1c3a,
+ 0x1c4a, 0x1c4c,
+ 0x1c80, 0x1cbf,
+ 0x1cc8, 0x1ccf,
+ 0x1cf7, 0x1cff,
+ 0x1de7, 0x1dfb,
+ 0x1f16, 0x1f17,
+ 0x1f1e, 0x1f1f,
+ 0x1f46, 0x1f47,
+ 0x1f4e, 0x1f4f,
+ 0x1f58, 0x1f58,
+ 0x1f5a, 0x1f5a,
+ 0x1f5c, 0x1f5c,
+ 0x1f5e, 0x1f5e,
+ 0x1f7e, 0x1f7f,
+ 0x1fb5, 0x1fb5,
+ 0x1fc5, 0x1fc5,
+ 0x1fd4, 0x1fd5,
+ 0x1fdc, 0x1fdc,
+ 0x1ff0, 0x1ff1,
+ 0x1ff5, 0x1ff5,
+ 0x1fff, 0x1fff,
0x200b, 0x200f,
0x202a, 0x202e,
- 0x2060, 0x2064,
- 0x206a, 0x206f,
- 0xd800, 0xf8ff,
- 0xfeff, 0xfeff,
- 0xfff9, 0xfffb,
+ 0x2060, 0x206f,
+ 0x2072, 0x2073,
+ 0x208f, 0x208f,
+ 0x209d, 0x209f,
+ 0x20ba, 0x20cf,
+ 0x20f1, 0x20ff,
+ 0x218a, 0x218f,
+ 0x23f4, 0x23ff,
+ 0x2427, 0x243f,
+ 0x244b, 0x245f,
+ 0x2700, 0x2700,
+ 0x2b4d, 0x2b4f,
+ 0x2b5a, 0x2bff,
+ 0x2c2f, 0x2c2f,
+ 0x2c5f, 0x2c5f,
+ 0x2cf4, 0x2cf8,
+ 0x2d26, 0x2d26,
+ 0x2d28, 0x2d2c,
+ 0x2d2e, 0x2d2f,
+ 0x2d68, 0x2d6e,
+ 0x2d71, 0x2d7e,
+ 0x2d97, 0x2d9f,
+ 0x2da7, 0x2da7,
+ 0x2daf, 0x2daf,
+ 0x2db7, 0x2db7,
+ 0x2dbf, 0x2dbf,
+ 0x2dc7, 0x2dc7,
+ 0x2dcf, 0x2dcf,
+ 0x2dd7, 0x2dd7,
+ 0x2ddf, 0x2ddf,
+ 0x2e3c, 0x2e7f,
+ 0x2e9a, 0x2e9a,
+ 0x2ef4, 0x2eff,
+ 0x2fd6, 0x2fef,
+ 0x2ffc, 0x2fff,
+ 0x3040, 0x3040,
+ 0x3097, 0x3098,
+ 0x3100, 0x3104,
+ 0x312e, 0x3130,
+ 0x318f, 0x318f,
+ 0x31bb, 0x31bf,
+ 0x31e4, 0x31ef,
+ 0x321f, 0x321f,
+ 0x32ff, 0x32ff,
+ 0x4db6, 0x4dbf,
+ 0x9fcd, 0x9fff,
+ 0xa48d, 0xa48f,
+ 0xa4c7, 0xa4cf,
+ 0xa62c, 0xa63f,
+ 0xa698, 0xa69e,
+ 0xa6f8, 0xa6ff,
+ 0xa78f, 0xa78f,
+ 0xa794, 0xa79f,
+ 0xa7ab, 0xa7f7,
+ 0xa82c, 0xa82f,
+ 0xa83a, 0xa83f,
+ 0xa878, 0xa87f,
+ 0xa8c5, 0xa8cd,
+ 0xa8da, 0xa8df,
+ 0xa8fc, 0xa8ff,
+ 0xa954, 0xa95e,
+ 0xa97d, 0xa97f,
+ 0xa9ce, 0xa9ce,
+ 0xa9da, 0xa9dd,
+ 0xa9e0, 0xa9ff,
+ 0xaa37, 0xaa3f,
+ 0xaa4e, 0xaa4f,
+ 0xaa5a, 0xaa5b,
+ 0xaa7c, 0xaa7f,
+ 0xaac3, 0xaada,
+ 0xaaf7, 0xab00,
+ 0xab07, 0xab08,
+ 0xab0f, 0xab10,
+ 0xab17, 0xab1f,
+ 0xab27, 0xab27,
+ 0xab2f, 0xabbf,
+ 0xabee, 0xabef,
+ 0xabfa, 0xabff,
+ 0xd7a4, 0xd7af,
+ 0xd7c7, 0xd7ca,
+ 0xd7fc, 0xf8ff,
+ 0xfa6e, 0xfa6f,
+ 0xfada, 0xfaff,
+ 0xfb07, 0xfb12,
+ 0xfb18, 0xfb1c,
+ 0xfb37, 0xfb37,
+ 0xfb3d, 0xfb3d,
+ 0xfb3f, 0xfb3f,
+ 0xfb42, 0xfb42,
+ 0xfb45, 0xfb45,
+ 0xfbc2, 0xfbd2,
+ 0xfd40, 0xfd4f,
+ 0xfd90, 0xfd91,
+ 0xfdc8, 0xfdef,
+ 0xfdfe, 0xfdff,
+ 0xfe1a, 0xfe1f,
+ 0xfe27, 0xfe2f,
+ 0xfe53, 0xfe53,
+ 0xfe67, 0xfe67,
+ 0xfe6c, 0xfe6f,
+ 0xfe75, 0xfe75,
+ 0xfefd, 0xff00,
+ 0xffbf, 0xffc1,
+ 0xffc8, 0xffc9,
+ 0xffd0, 0xffd1,
+ 0xffd8, 0xffd9,
+ 0xffdd, 0xffdf,
+ 0xffe7, 0xffe7,
+ 0xffef, 0xfffb,
+ 0xfffe, 0xffff,
+ 0x1000c, 0x1000c,
+ 0x10027, 0x10027,
+ 0x1003b, 0x1003b,
+ 0x1003e, 0x1003e,
+ 0x1004e, 0x1004f,
+ 0x1005e, 0x1007f,
+ 0x100fb, 0x100ff,
+ 0x10103, 0x10106,
+ 0x10134, 0x10136,
+ 0x1018b, 0x1018f,
+ 0x1019c, 0x101cf,
+ 0x101fe, 0x1027f,
+ 0x1029d, 0x1029f,
+ 0x102d1, 0x102ff,
+ 0x1031f, 0x1031f,
+ 0x10324, 0x1032f,
+ 0x1034b, 0x1037f,
+ 0x1039e, 0x1039e,
+ 0x103c4, 0x103c7,
+ 0x103d6, 0x103ff,
+ 0x1049e, 0x1049f,
+ 0x104aa, 0x107ff,
+ 0x10806, 0x10807,
+ 0x10809, 0x10809,
+ 0x10836, 0x10836,
+ 0x10839, 0x1083b,
+ 0x1083d, 0x1083e,
+ 0x10856, 0x10856,
+ 0x10860, 0x108ff,
+ 0x1091c, 0x1091e,
+ 0x1093a, 0x1093e,
+ 0x10940, 0x1097f,
+ 0x109b8, 0x109bd,
+ 0x109c0, 0x109ff,
+ 0x10a04, 0x10a04,
+ 0x10a07, 0x10a0b,
+ 0x10a14, 0x10a14,
+ 0x10a18, 0x10a18,
+ 0x10a34, 0x10a37,
+ 0x10a3b, 0x10a3e,
+ 0x10a48, 0x10a4f,
+ 0x10a59, 0x10a5f,
+ 0x10a80, 0x10aff,
+ 0x10b36, 0x10b38,
+ 0x10b56, 0x10b57,
+ 0x10b73, 0x10b77,
+ 0x10b80, 0x10bff,
+ 0x10c49, 0x10e5f,
+ 0x10e7f, 0x10fff,
+ 0x1104e, 0x11051,
+ 0x11070, 0x1107f,
0x110bd, 0x110bd,
+ 0x110c2, 0x110cf,
+ 0x110e9, 0x110ef,
+ 0x110fa, 0x110ff,
+ 0x11135, 0x11135,
+ 0x11144, 0x1117f,
+ 0x111c9, 0x111cf,
+ 0x111da, 0x1167f,
+ 0x116b8, 0x116bf,
+ 0x116ca, 0x11fff,
+ 0x1236f, 0x123ff,
+ 0x12463, 0x1246f,
+ 0x12474, 0x12fff,
+ 0x1342f, 0x167ff,
+ 0x16a39, 0x16eff,
+ 0x16f45, 0x16f4f,
+ 0x16f7f, 0x16f8e,
+ 0x16fa0, 0x1afff,
+ 0x1b002, 0x1cfff,
+ 0x1d0f6, 0x1d0ff,
+ 0x1d127, 0x1d128,
0x1d173, 0x1d17a,
- 0xe0001, 0xe0001,
- 0xe0020, 0xe007f,
- 0xf0000, 0xffffd,
- 0x100000, 0x10ffff,
+ 0x1d1de, 0x1d1ff,
+ 0x1d246, 0x1d2ff,
+ 0x1d357, 0x1d35f,
+ 0x1d372, 0x1d3ff,
+ 0x1d455, 0x1d455,
+ 0x1d49d, 0x1d49d,
+ 0x1d4a0, 0x1d4a1,
+ 0x1d4a3, 0x1d4a4,
+ 0x1d4a7, 0x1d4a8,
+ 0x1d4ad, 0x1d4ad,
+ 0x1d4ba, 0x1d4ba,
+ 0x1d4bc, 0x1d4bc,
+ 0x1d4c4, 0x1d4c4,
+ 0x1d506, 0x1d506,
+ 0x1d50b, 0x1d50c,
+ 0x1d515, 0x1d515,
+ 0x1d51d, 0x1d51d,
+ 0x1d53a, 0x1d53a,
+ 0x1d53f, 0x1d53f,
+ 0x1d545, 0x1d545,
+ 0x1d547, 0x1d549,
+ 0x1d551, 0x1d551,
+ 0x1d6a6, 0x1d6a7,
+ 0x1d7cc, 0x1d7cd,
+ 0x1d800, 0x1edff,
+ 0x1ee04, 0x1ee04,
+ 0x1ee20, 0x1ee20,
+ 0x1ee23, 0x1ee23,
+ 0x1ee25, 0x1ee26,
+ 0x1ee28, 0x1ee28,
+ 0x1ee33, 0x1ee33,
+ 0x1ee38, 0x1ee38,
+ 0x1ee3a, 0x1ee3a,
+ 0x1ee3c, 0x1ee41,
+ 0x1ee43, 0x1ee46,
+ 0x1ee48, 0x1ee48,
+ 0x1ee4a, 0x1ee4a,
+ 0x1ee4c, 0x1ee4c,
+ 0x1ee50, 0x1ee50,
+ 0x1ee53, 0x1ee53,
+ 0x1ee55, 0x1ee56,
+ 0x1ee58, 0x1ee58,
+ 0x1ee5a, 0x1ee5a,
+ 0x1ee5c, 0x1ee5c,
+ 0x1ee5e, 0x1ee5e,
+ 0x1ee60, 0x1ee60,
+ 0x1ee63, 0x1ee63,
+ 0x1ee65, 0x1ee66,
+ 0x1ee6b, 0x1ee6b,
+ 0x1ee73, 0x1ee73,
+ 0x1ee78, 0x1ee78,
+ 0x1ee7d, 0x1ee7d,
+ 0x1ee7f, 0x1ee7f,
+ 0x1ee8a, 0x1ee8a,
+ 0x1ee9c, 0x1eea0,
+ 0x1eea4, 0x1eea4,
+ 0x1eeaa, 0x1eeaa,
+ 0x1eebc, 0x1eeef,
+ 0x1eef2, 0x1efff,
+ 0x1f02c, 0x1f02f,
+ 0x1f094, 0x1f09f,
+ 0x1f0af, 0x1f0b0,
+ 0x1f0bf, 0x1f0c0,
+ 0x1f0d0, 0x1f0d0,
+ 0x1f0e0, 0x1f0ff,
+ 0x1f10b, 0x1f10f,
+ 0x1f12f, 0x1f12f,
+ 0x1f16c, 0x1f16f,
+ 0x1f19b, 0x1f1e5,
+ 0x1f203, 0x1f20f,
+ 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,
+ 0x2a6d7, 0x2a6ff,
+ 0x2b735, 0x2b73f,
+ 0x2b81e, 0x2f7ff,
+ 0x2fa1e, 0xe00ff,
+ 0xe01f0, 0x10ffff,
}; /* CR_C */
/* 'Cc': General Category */
-static const OnigCodePoint CR_Cc[] = {
- 2,
- 0x0000, 0x001f,
- 0x007f, 0x009f,
-}; /* CR_Cc */
+#define CR_Cc CR_Cntrl
/* 'Cf': General Category */
static const OnigCodePoint CR_Cf[] = {
- 15,
+ 14,
0x00ad, 0x00ad,
- 0x0600, 0x0603,
+ 0x0600, 0x0604,
0x06dd, 0x06dd,
0x070f, 0x070f,
- 0x17b4, 0x17b5,
0x200b, 0x200f,
0x202a, 0x202e,
0x2060, 0x2064,
@@ -604,7 +5424,7 @@ static const OnigCodePoint CR_Cf[] = {
/* 'Cn': General Category */
static const OnigCodePoint CR_Cn[] = {
- 501,
+ 539,
0x0378, 0x0379,
0x037f, 0x0383,
0x038b, 0x038b,
@@ -614,11 +5434,12 @@ static const OnigCodePoint CR_Cn[] = {
0x0557, 0x0558,
0x0560, 0x0560,
0x0588, 0x0588,
- 0x058b, 0x0590,
+ 0x058b, 0x058e,
+ 0x0590, 0x0590,
0x05c8, 0x05cf,
0x05eb, 0x05ef,
0x05f5, 0x05ff,
- 0x0604, 0x0605,
+ 0x0605, 0x0605,
0x061c, 0x061d,
0x070e, 0x070e,
0x074b, 0x074c,
@@ -627,7 +5448,10 @@ static const OnigCodePoint CR_Cn[] = {
0x082e, 0x082f,
0x083f, 0x083f,
0x085c, 0x085d,
- 0x085f, 0x08ff,
+ 0x085f, 0x089f,
+ 0x08a1, 0x08a1,
+ 0x08ad, 0x08e3,
+ 0x08ff, 0x08ff,
0x0978, 0x0978,
0x0980, 0x0980,
0x0984, 0x0984,
@@ -672,7 +5496,6 @@ static const OnigCodePoint CR_Cn[] = {
0x0ace, 0x0acf,
0x0ad1, 0x0adf,
0x0ae4, 0x0ae5,
- 0x0af0, 0x0af0,
0x0af2, 0x0b00,
0x0b04, 0x0b04,
0x0b0d, 0x0b0e,
@@ -773,15 +5596,16 @@ static const OnigCodePoint CR_Cn[] = {
0x0ec7, 0x0ec7,
0x0ece, 0x0ecf,
0x0eda, 0x0edb,
- 0x0ede, 0x0eff,
+ 0x0ee0, 0x0eff,
0x0f48, 0x0f48,
0x0f6d, 0x0f70,
0x0f98, 0x0f98,
0x0fbd, 0x0fbd,
0x0fcd, 0x0fcd,
0x0fdb, 0x0fff,
- 0x10c6, 0x10cf,
- 0x10fd, 0x10ff,
+ 0x10c6, 0x10c6,
+ 0x10c8, 0x10cc,
+ 0x10ce, 0x10cf,
0x1249, 0x1249,
0x124e, 0x124f,
0x1257, 0x1257,
@@ -835,13 +5659,12 @@ static const OnigCodePoint CR_Cn[] = {
0x1aae, 0x1aff,
0x1b4c, 0x1b4f,
0x1b7d, 0x1b7f,
- 0x1bab, 0x1bad,
- 0x1bba, 0x1bbf,
0x1bf4, 0x1bfb,
0x1c38, 0x1c3a,
0x1c4a, 0x1c4c,
- 0x1c80, 0x1ccf,
- 0x1cf3, 0x1cff,
+ 0x1c80, 0x1cbf,
+ 0x1cc8, 0x1ccf,
+ 0x1cf7, 0x1cff,
0x1de7, 0x1dfb,
0x1f16, 0x1f17,
0x1f1e, 0x1f1f,
@@ -870,15 +5693,15 @@ static const OnigCodePoint CR_Cn[] = {
0x2427, 0x243f,
0x244b, 0x245f,
0x2700, 0x2700,
- 0x27cb, 0x27cb,
- 0x27cd, 0x27cd,
0x2b4d, 0x2b4f,
0x2b5a, 0x2bff,
0x2c2f, 0x2c2f,
0x2c5f, 0x2c5f,
- 0x2cf2, 0x2cf8,
- 0x2d26, 0x2d2f,
- 0x2d66, 0x2d6e,
+ 0x2cf4, 0x2cf8,
+ 0x2d26, 0x2d26,
+ 0x2d28, 0x2d2c,
+ 0x2d2e, 0x2d2f,
+ 0x2d68, 0x2d6e,
0x2d71, 0x2d7e,
0x2d97, 0x2d9f,
0x2da7, 0x2da7,
@@ -889,7 +5712,7 @@ static const OnigCodePoint CR_Cn[] = {
0x2dcf, 0x2dcf,
0x2dd7, 0x2dd7,
0x2ddf, 0x2ddf,
- 0x2e32, 0x2e7f,
+ 0x2e3c, 0x2e7f,
0x2e9a, 0x2e9a,
0x2ef4, 0x2eff,
0x2fd6, 0x2fef,
@@ -904,16 +5727,15 @@ static const OnigCodePoint CR_Cn[] = {
0x321f, 0x321f,
0x32ff, 0x32ff,
0x4db6, 0x4dbf,
- 0x9fcc, 0x9fff,
+ 0x9fcd, 0x9fff,
0xa48d, 0xa48f,
0xa4c7, 0xa4cf,
0xa62c, 0xa63f,
- 0xa674, 0xa67b,
- 0xa698, 0xa69f,
+ 0xa698, 0xa69e,
0xa6f8, 0xa6ff,
0xa78f, 0xa78f,
- 0xa792, 0xa79f,
- 0xa7aa, 0xa7f9,
+ 0xa794, 0xa79f,
+ 0xa7ab, 0xa7f7,
0xa82c, 0xa82f,
0xa83a, 0xa83f,
0xa878, 0xa87f,
@@ -930,7 +5752,7 @@ static const OnigCodePoint CR_Cn[] = {
0xaa5a, 0xaa5b,
0xaa7c, 0xaa7f,
0xaac3, 0xaada,
- 0xaae0, 0xab00,
+ 0xaaf7, 0xab00,
0xab07, 0xab08,
0xab0f, 0xab10,
0xab17, 0xab1f,
@@ -941,7 +5763,6 @@ static const OnigCodePoint CR_Cn[] = {
0xd7a4, 0xd7af,
0xd7c7, 0xd7ca,
0xd7fc, 0xd7ff,
- 0xfa2e, 0xfa2f,
0xfa6e, 0xfa6f,
0xfada, 0xfaff,
0xfb07, 0xfb12,
@@ -1003,7 +5824,9 @@ static const OnigCodePoint CR_Cn[] = {
0x10860, 0x108ff,
0x1091c, 0x1091e,
0x1093a, 0x1093e,
- 0x10940, 0x109ff,
+ 0x10940, 0x1097f,
+ 0x109b8, 0x109bd,
+ 0x109c0, 0x109ff,
0x10a04, 0x10a04,
0x10a07, 0x10a0b,
0x10a14, 0x10a14,
@@ -1021,12 +5844,23 @@ static const OnigCodePoint CR_Cn[] = {
0x10e7f, 0x10fff,
0x1104e, 0x11051,
0x11070, 0x1107f,
- 0x110c2, 0x11fff,
+ 0x110c2, 0x110cf,
+ 0x110e9, 0x110ef,
+ 0x110fa, 0x110ff,
+ 0x11135, 0x11135,
+ 0x11144, 0x1117f,
+ 0x111c9, 0x111cf,
+ 0x111da, 0x1167f,
+ 0x116b8, 0x116bf,
+ 0x116ca, 0x11fff,
0x1236f, 0x123ff,
0x12463, 0x1246f,
0x12474, 0x12fff,
0x1342f, 0x167ff,
- 0x16a39, 0x1afff,
+ 0x16a39, 0x16eff,
+ 0x16f45, 0x16f4f,
+ 0x16f7f, 0x16f8e,
+ 0x16fa0, 0x1afff,
0x1b002, 0x1cfff,
0x1d0f6, 0x1d0ff,
0x1d127, 0x1d128,
@@ -1054,7 +5888,41 @@ static const OnigCodePoint CR_Cn[] = {
0x1d551, 0x1d551,
0x1d6a6, 0x1d6a7,
0x1d7cc, 0x1d7cd,
- 0x1d800, 0x1efff,
+ 0x1d800, 0x1edff,
+ 0x1ee04, 0x1ee04,
+ 0x1ee20, 0x1ee20,
+ 0x1ee23, 0x1ee23,
+ 0x1ee25, 0x1ee26,
+ 0x1ee28, 0x1ee28,
+ 0x1ee33, 0x1ee33,
+ 0x1ee38, 0x1ee38,
+ 0x1ee3a, 0x1ee3a,
+ 0x1ee3c, 0x1ee41,
+ 0x1ee43, 0x1ee46,
+ 0x1ee48, 0x1ee48,
+ 0x1ee4a, 0x1ee4a,
+ 0x1ee4c, 0x1ee4c,
+ 0x1ee50, 0x1ee50,
+ 0x1ee53, 0x1ee53,
+ 0x1ee55, 0x1ee56,
+ 0x1ee58, 0x1ee58,
+ 0x1ee5a, 0x1ee5a,
+ 0x1ee5c, 0x1ee5c,
+ 0x1ee5e, 0x1ee5e,
+ 0x1ee60, 0x1ee60,
+ 0x1ee63, 0x1ee63,
+ 0x1ee65, 0x1ee66,
+ 0x1ee6b, 0x1ee6b,
+ 0x1ee73, 0x1ee73,
+ 0x1ee78, 0x1ee78,
+ 0x1ee7d, 0x1ee7d,
+ 0x1ee7f, 0x1ee7f,
+ 0x1ee8a, 0x1ee8a,
+ 0x1ee9c, 0x1eea0,
+ 0x1eea4, 0x1eea4,
+ 0x1eeaa, 0x1eeaa,
+ 0x1eebc, 0x1eeef,
+ 0x1eef2, 0x1efff,
0x1f02c, 0x1f02f,
0x1f094, 0x1f09f,
0x1f0af, 0x1f0b0,
@@ -1063,7 +5931,7 @@ static const OnigCodePoint CR_Cn[] = {
0x1f0e0, 0x1f0ff,
0x1f10b, 0x1f10f,
0x1f12f, 0x1f12f,
- 0x1f16a, 0x1f16f,
+ 0x1f16c, 0x1f16f,
0x1f19b, 0x1f1e5,
0x1f203, 0x1f20f,
0x1f23b, 0x1f23f,
@@ -1080,19 +5948,9 @@ static const OnigCodePoint CR_Cn[] = {
0x1f441, 0x1f441,
0x1f4f8, 0x1f4f8,
0x1f4fd, 0x1f4ff,
- 0x1f53e, 0x1f54f,
+ 0x1f53e, 0x1f53f,
+ 0x1f544, 0x1f54f,
0x1f568, 0x1f5fa,
- 0x1f600, 0x1f600,
- 0x1f611, 0x1f611,
- 0x1f615, 0x1f615,
- 0x1f617, 0x1f617,
- 0x1f619, 0x1f619,
- 0x1f61b, 0x1f61b,
- 0x1f61f, 0x1f61f,
- 0x1f626, 0x1f627,
- 0x1f62c, 0x1f62c,
- 0x1f62e, 0x1f62f,
- 0x1f634, 0x1f634,
0x1f641, 0x1f644,
0x1f650, 0x1f67f,
0x1f6c6, 0x1f6ff,
@@ -1124,7 +5982,7 @@ static const OnigCodePoint CR_Cs[] = {
/* 'L': Major Category */
static const OnigCodePoint CR_L[] = {
- 435,
+ 486,
0x0041, 0x005a,
0x0061, 0x007a,
0x00aa, 0x00aa,
@@ -1172,6 +6030,8 @@ static const OnigCodePoint CR_L[] = {
0x0824, 0x0824,
0x0828, 0x0828,
0x0840, 0x0858,
+ 0x08a0, 0x08a0,
+ 0x08a2, 0x08ac,
0x0904, 0x0939,
0x093d, 0x093d,
0x0950, 0x0950,
@@ -1277,7 +6137,7 @@ static const OnigCodePoint CR_L[] = {
0x0ebd, 0x0ebd,
0x0ec0, 0x0ec4,
0x0ec6, 0x0ec6,
- 0x0edc, 0x0edd,
+ 0x0edc, 0x0edf,
0x0f00, 0x0f00,
0x0f40, 0x0f47,
0x0f49, 0x0f6c,
@@ -1292,9 +6152,10 @@ static const OnigCodePoint CR_L[] = {
0x1075, 0x1081,
0x108e, 0x108e,
0x10a0, 0x10c5,
+ 0x10c7, 0x10c7,
+ 0x10cd, 0x10cd,
0x10d0, 0x10fa,
- 0x10fc, 0x10fc,
- 0x1100, 0x1248,
+ 0x10fc, 0x1248,
0x124a, 0x124d,
0x1250, 0x1256,
0x1258, 0x1258,
@@ -1341,12 +6202,13 @@ static const OnigCodePoint CR_L[] = {
0x1b45, 0x1b4b,
0x1b83, 0x1ba0,
0x1bae, 0x1baf,
- 0x1bc0, 0x1be5,
+ 0x1bba, 0x1be5,
0x1c00, 0x1c23,
0x1c4d, 0x1c4f,
0x1c5a, 0x1c7d,
0x1ce9, 0x1cec,
0x1cee, 0x1cf1,
+ 0x1cf5, 0x1cf6,
0x1d00, 0x1dbf,
0x1e00, 0x1f15,
0x1f18, 0x1f1d,
@@ -1388,8 +6250,11 @@ static const OnigCodePoint CR_L[] = {
0x2c30, 0x2c5e,
0x2c60, 0x2ce4,
0x2ceb, 0x2cee,
+ 0x2cf2, 0x2cf3,
0x2d00, 0x2d25,
- 0x2d30, 0x2d65,
+ 0x2d27, 0x2d27,
+ 0x2d2d, 0x2d2d,
+ 0x2d30, 0x2d67,
0x2d6f, 0x2d6f,
0x2d80, 0x2d96,
0x2da0, 0x2da6,
@@ -1413,7 +6278,7 @@ static const OnigCodePoint CR_L[] = {
0x31a0, 0x31ba,
0x31f0, 0x31ff,
0x3400, 0x4db5,
- 0x4e00, 0x9fcb,
+ 0x4e00, 0x9fcc,
0xa000, 0xa48c,
0xa4d0, 0xa4fd,
0xa500, 0xa60c,
@@ -1425,9 +6290,9 @@ static const OnigCodePoint CR_L[] = {
0xa717, 0xa71f,
0xa722, 0xa788,
0xa78b, 0xa78e,
- 0xa790, 0xa791,
- 0xa7a0, 0xa7a9,
- 0xa7fa, 0xa801,
+ 0xa790, 0xa793,
+ 0xa7a0, 0xa7aa,
+ 0xa7f8, 0xa801,
0xa803, 0xa805,
0xa807, 0xa80a,
0xa80c, 0xa822,
@@ -1452,6 +6317,8 @@ static const OnigCodePoint CR_L[] = {
0xaac0, 0xaac0,
0xaac2, 0xaac2,
0xaadb, 0xaadd,
+ 0xaae0, 0xaaea,
+ 0xaaf2, 0xaaf4,
0xab01, 0xab06,
0xab09, 0xab0e,
0xab11, 0xab16,
@@ -1461,8 +6328,7 @@ static const OnigCodePoint CR_L[] = {
0xac00, 0xd7a3,
0xd7b0, 0xd7c6,
0xd7cb, 0xd7fb,
- 0xf900, 0xfa2d,
- 0xfa30, 0xfa6d,
+ 0xf900, 0xfa6d,
0xfa70, 0xfad9,
0xfb00, 0xfb06,
0xfb13, 0xfb17,
@@ -1511,6 +6377,8 @@ static const OnigCodePoint CR_L[] = {
0x1083f, 0x10855,
0x10900, 0x10915,
0x10920, 0x10939,
+ 0x10980, 0x109b7,
+ 0x109be, 0x109bf,
0x10a00, 0x10a00,
0x10a10, 0x10a13,
0x10a15, 0x10a17,
@@ -1522,9 +6390,17 @@ static const OnigCodePoint CR_L[] = {
0x10c00, 0x10c48,
0x11003, 0x11037,
0x11083, 0x110af,
+ 0x110d0, 0x110e8,
+ 0x11103, 0x11126,
+ 0x11183, 0x111b2,
+ 0x111c1, 0x111c4,
+ 0x11680, 0x116aa,
0x12000, 0x1236e,
0x13000, 0x1342e,
0x16800, 0x16a38,
+ 0x16f00, 0x16f44,
+ 0x16f50, 0x16f50,
+ 0x16f93, 0x16f9f,
0x1b000, 0x1b001,
0x1d400, 0x1d454,
0x1d456, 0x1d49c,
@@ -1556,19 +6432,168 @@ static const OnigCodePoint CR_L[] = {
0x1d78a, 0x1d7a8,
0x1d7aa, 0x1d7c2,
0x1d7c4, 0x1d7cb,
+ 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,
0x20000, 0x2a6d6,
0x2a700, 0x2b734,
0x2b740, 0x2b81d,
0x2f800, 0x2fa1d,
}; /* CR_L */
+/* 'LC': General Category */
+static const OnigCodePoint CR_LC[] = {
+ 113,
+ 0x0041, 0x005a,
+ 0x0061, 0x007a,
+ 0x00b5, 0x00b5,
+ 0x00c0, 0x00d6,
+ 0x00d8, 0x00f6,
+ 0x00f8, 0x01ba,
+ 0x01bc, 0x01bf,
+ 0x01c4, 0x0293,
+ 0x0295, 0x02af,
+ 0x0370, 0x0373,
+ 0x0376, 0x0377,
+ 0x037b, 0x037d,
+ 0x0386, 0x0386,
+ 0x0388, 0x038a,
+ 0x038c, 0x038c,
+ 0x038e, 0x03a1,
+ 0x03a3, 0x03f5,
+ 0x03f7, 0x0481,
+ 0x048a, 0x0527,
+ 0x0531, 0x0556,
+ 0x0561, 0x0587,
+ 0x10a0, 0x10c5,
+ 0x10c7, 0x10c7,
+ 0x10cd, 0x10cd,
+ 0x1d00, 0x1d2b,
+ 0x1d6b, 0x1d77,
+ 0x1d79, 0x1d9a,
+ 0x1e00, 0x1f15,
+ 0x1f18, 0x1f1d,
+ 0x1f20, 0x1f45,
+ 0x1f48, 0x1f4d,
+ 0x1f50, 0x1f57,
+ 0x1f59, 0x1f59,
+ 0x1f5b, 0x1f5b,
+ 0x1f5d, 0x1f5d,
+ 0x1f5f, 0x1f7d,
+ 0x1f80, 0x1fb4,
+ 0x1fb6, 0x1fbc,
+ 0x1fbe, 0x1fbe,
+ 0x1fc2, 0x1fc4,
+ 0x1fc6, 0x1fcc,
+ 0x1fd0, 0x1fd3,
+ 0x1fd6, 0x1fdb,
+ 0x1fe0, 0x1fec,
+ 0x1ff2, 0x1ff4,
+ 0x1ff6, 0x1ffc,
+ 0x2102, 0x2102,
+ 0x2107, 0x2107,
+ 0x210a, 0x2113,
+ 0x2115, 0x2115,
+ 0x2119, 0x211d,
+ 0x2124, 0x2124,
+ 0x2126, 0x2126,
+ 0x2128, 0x2128,
+ 0x212a, 0x212d,
+ 0x212f, 0x2134,
+ 0x2139, 0x2139,
+ 0x213c, 0x213f,
+ 0x2145, 0x2149,
+ 0x214e, 0x214e,
+ 0x2183, 0x2184,
+ 0x2c00, 0x2c2e,
+ 0x2c30, 0x2c5e,
+ 0x2c60, 0x2c7b,
+ 0x2c7e, 0x2ce4,
+ 0x2ceb, 0x2cee,
+ 0x2cf2, 0x2cf3,
+ 0x2d00, 0x2d25,
+ 0x2d27, 0x2d27,
+ 0x2d2d, 0x2d2d,
+ 0xa640, 0xa66d,
+ 0xa680, 0xa697,
+ 0xa722, 0xa76f,
+ 0xa771, 0xa787,
+ 0xa78b, 0xa78e,
+ 0xa790, 0xa793,
+ 0xa7a0, 0xa7aa,
+ 0xa7fa, 0xa7fa,
+ 0xfb00, 0xfb06,
+ 0xfb13, 0xfb17,
+ 0xff21, 0xff3a,
+ 0xff41, 0xff5a,
+ 0x10400, 0x1044f,
+ 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, 0x1d6c0,
+ 0x1d6c2, 0x1d6da,
+ 0x1d6dc, 0x1d6fa,
+ 0x1d6fc, 0x1d714,
+ 0x1d716, 0x1d734,
+ 0x1d736, 0x1d74e,
+ 0x1d750, 0x1d76e,
+ 0x1d770, 0x1d788,
+ 0x1d78a, 0x1d7a8,
+ 0x1d7aa, 0x1d7c2,
+ 0x1d7c4, 0x1d7cb,
+}; /* CR_LC */
+
/* 'Ll': General Category */
static const OnigCodePoint CR_Ll[] = {
- 609,
+ 611,
0x0061, 0x007a,
- 0x00aa, 0x00aa,
0x00b5, 0x00b5,
- 0x00ba, 0x00ba,
0x00df, 0x00f6,
0x00f8, 0x00ff,
0x0101, 0x0101,
@@ -1834,7 +6859,7 @@ static const OnigCodePoint CR_Ll[] = {
0x0527, 0x0527,
0x0561, 0x0587,
0x1d00, 0x1d2b,
- 0x1d62, 0x1d77,
+ 0x1d6b, 0x1d77,
0x1d79, 0x1d9a,
0x1e01, 0x1e01,
0x1e03, 0x1e03,
@@ -1998,7 +7023,7 @@ static const OnigCodePoint CR_Ll[] = {
0x2c6c, 0x2c6c,
0x2c71, 0x2c71,
0x2c73, 0x2c74,
- 0x2c76, 0x2c7c,
+ 0x2c76, 0x2c7b,
0x2c81, 0x2c81,
0x2c83, 0x2c83,
0x2c85, 0x2c85,
@@ -2051,7 +7076,10 @@ static const OnigCodePoint CR_Ll[] = {
0x2ce3, 0x2ce4,
0x2cec, 0x2cec,
0x2cee, 0x2cee,
+ 0x2cf3, 0x2cf3,
0x2d00, 0x2d25,
+ 0x2d27, 0x2d27,
+ 0x2d2d, 0x2d2d,
0xa641, 0xa641,
0xa643, 0xa643,
0xa645, 0xa645,
@@ -2136,6 +7164,7 @@ static const OnigCodePoint CR_Ll[] = {
0xa78c, 0xa78c,
0xa78e, 0xa78e,
0xa791, 0xa791,
+ 0xa793, 0xa793,
0xa7a1, 0xa7a1,
0xa7a3, 0xa7a3,
0xa7a5, 0xa7a5,
@@ -2178,7 +7207,7 @@ static const OnigCodePoint CR_Ll[] = {
/* 'Lm': General Category */
static const OnigCodePoint CR_Lm[] = {
- 49,
+ 52,
0x02b0, 0x02c1,
0x02c6, 0x02d1,
0x02e0, 0x02e4,
@@ -2202,13 +7231,13 @@ static const OnigCodePoint CR_Lm[] = {
0x1843, 0x1843,
0x1aa7, 0x1aa7,
0x1c78, 0x1c7d,
- 0x1d2c, 0x1d61,
+ 0x1d2c, 0x1d6a,
0x1d78, 0x1d78,
0x1d9b, 0x1dbf,
0x2071, 0x2071,
0x207f, 0x207f,
0x2090, 0x209c,
- 0x2c7d, 0x2c7d,
+ 0x2c7c, 0x2c7d,
0x2d6f, 0x2d6f,
0x2e2f, 0x2e2f,
0x3005, 0x3005,
@@ -2223,16 +7252,21 @@ static const OnigCodePoint CR_Lm[] = {
0xa717, 0xa71f,
0xa770, 0xa770,
0xa788, 0xa788,
+ 0xa7f8, 0xa7f9,
0xa9cf, 0xa9cf,
0xaa70, 0xaa70,
0xaadd, 0xaadd,
+ 0xaaf3, 0xaaf4,
0xff70, 0xff70,
0xff9e, 0xff9f,
+ 0x16f93, 0x16f9f,
}; /* CR_Lm */
/* 'Lo': General Category */
static const OnigCodePoint CR_Lo[] = {
- 323,
+ 371,
+ 0x00aa, 0x00aa,
+ 0x00ba, 0x00ba,
0x01bb, 0x01bb,
0x01c0, 0x01c3,
0x0294, 0x0294,
@@ -2253,6 +7287,8 @@ static const OnigCodePoint CR_Lo[] = {
0x07ca, 0x07ea,
0x0800, 0x0815,
0x0840, 0x0858,
+ 0x08a0, 0x08a0,
+ 0x08a2, 0x08ac,
0x0904, 0x0939,
0x093d, 0x093d,
0x0950, 0x0950,
@@ -2357,7 +7393,7 @@ static const OnigCodePoint CR_Lo[] = {
0x0eb2, 0x0eb3,
0x0ebd, 0x0ebd,
0x0ec0, 0x0ec4,
- 0x0edc, 0x0edd,
+ 0x0edc, 0x0edf,
0x0f00, 0x0f00,
0x0f40, 0x0f47,
0x0f49, 0x0f6c,
@@ -2372,7 +7408,7 @@ static const OnigCodePoint CR_Lo[] = {
0x1075, 0x1081,
0x108e, 0x108e,
0x10d0, 0x10fa,
- 0x1100, 0x1248,
+ 0x10fd, 0x1248,
0x124a, 0x124d,
0x1250, 0x1256,
0x1258, 0x1258,
@@ -2418,14 +7454,15 @@ static const OnigCodePoint CR_Lo[] = {
0x1b45, 0x1b4b,
0x1b83, 0x1ba0,
0x1bae, 0x1baf,
- 0x1bc0, 0x1be5,
+ 0x1bba, 0x1be5,
0x1c00, 0x1c23,
0x1c4d, 0x1c4f,
0x1c5a, 0x1c77,
0x1ce9, 0x1cec,
0x1cee, 0x1cf1,
+ 0x1cf5, 0x1cf6,
0x2135, 0x2138,
- 0x2d30, 0x2d65,
+ 0x2d30, 0x2d67,
0x2d80, 0x2d96,
0x2da0, 0x2da6,
0x2da8, 0x2dae,
@@ -2446,7 +7483,7 @@ static const OnigCodePoint CR_Lo[] = {
0x31a0, 0x31ba,
0x31f0, 0x31ff,
0x3400, 0x4db5,
- 0x4e00, 0x9fcb,
+ 0x4e00, 0x9fcc,
0xa000, 0xa014,
0xa016, 0xa48c,
0xa4d0, 0xa4f7,
@@ -2480,6 +7517,8 @@ static const OnigCodePoint CR_Lo[] = {
0xaac0, 0xaac0,
0xaac2, 0xaac2,
0xaadb, 0xaadc,
+ 0xaae0, 0xaaea,
+ 0xaaf2, 0xaaf2,
0xab01, 0xab06,
0xab09, 0xab0e,
0xab11, 0xab16,
@@ -2489,8 +7528,7 @@ static const OnigCodePoint CR_Lo[] = {
0xac00, 0xd7a3,
0xd7b0, 0xd7c6,
0xd7cb, 0xd7fb,
- 0xf900, 0xfa2d,
- 0xfa30, 0xfa6d,
+ 0xf900, 0xfa6d,
0xfa70, 0xfad9,
0xfb1d, 0xfb1d,
0xfb1f, 0xfb28,
@@ -2537,6 +7575,8 @@ static const OnigCodePoint CR_Lo[] = {
0x1083f, 0x10855,
0x10900, 0x10915,
0x10920, 0x10939,
+ 0x10980, 0x109b7,
+ 0x109be, 0x109bf,
0x10a00, 0x10a00,
0x10a10, 0x10a13,
0x10a15, 0x10a17,
@@ -2548,10 +7588,50 @@ static const OnigCodePoint CR_Lo[] = {
0x10c00, 0x10c48,
0x11003, 0x11037,
0x11083, 0x110af,
+ 0x110d0, 0x110e8,
+ 0x11103, 0x11126,
+ 0x11183, 0x111b2,
+ 0x111c1, 0x111c4,
+ 0x11680, 0x116aa,
0x12000, 0x1236e,
0x13000, 0x1342e,
0x16800, 0x16a38,
+ 0x16f00, 0x16f44,
+ 0x16f50, 0x16f50,
0x1b000, 0x1b001,
+ 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,
0x20000, 0x2a6d6,
0x2a700, 0x2b734,
0x2b740, 0x2b81d,
@@ -2575,7 +7655,7 @@ static const OnigCodePoint CR_Lt[] = {
/* 'Lu': General Category */
static const OnigCodePoint CR_Lu[] = {
- 603,
+ 608,
0x0041, 0x005a,
0x00c0, 0x00d6,
0x00d8, 0x00de,
@@ -2844,6 +7924,8 @@ static const OnigCodePoint CR_Lu[] = {
0x0526, 0x0526,
0x0531, 0x0556,
0x10a0, 0x10c5,
+ 0x10c7, 0x10c7,
+ 0x10cd, 0x10cd,
0x1e00, 0x1e00,
0x1e02, 0x1e02,
0x1e04, 0x1e04,
@@ -3058,6 +8140,7 @@ static const OnigCodePoint CR_Lu[] = {
0x2ce2, 0x2ce2,
0x2ceb, 0x2ceb,
0x2ced, 0x2ced,
+ 0x2cf2, 0x2cf2,
0xa640, 0xa640,
0xa642, 0xa642,
0xa644, 0xa644,
@@ -3141,11 +8224,13 @@ static const OnigCodePoint CR_Lu[] = {
0xa78b, 0xa78b,
0xa78d, 0xa78d,
0xa790, 0xa790,
+ 0xa792, 0xa792,
0xa7a0, 0xa7a0,
0xa7a2, 0xa7a2,
0xa7a4, 0xa7a4,
0xa7a6, 0xa7a6,
0xa7a8, 0xa7a8,
+ 0xa7aa, 0xa7aa,
0xff21, 0xff3a,
0x10400, 0x10427,
0x1d400, 0x1d419,
@@ -3183,7 +8268,7 @@ static const OnigCodePoint CR_Lu[] = {
/* 'M': Major Category */
static const OnigCodePoint CR_M[] = {
- 193,
+ 204,
0x0300, 0x036f,
0x0483, 0x0489,
0x0591, 0x05bd,
@@ -3207,6 +8292,7 @@ static const OnigCodePoint CR_M[] = {
0x0825, 0x0827,
0x0829, 0x082d,
0x0859, 0x085b,
+ 0x08e4, 0x08fe,
0x0900, 0x0903,
0x093a, 0x093c,
0x093e, 0x094f,
@@ -3301,7 +8387,7 @@ static const OnigCodePoint CR_M[] = {
0x1732, 0x1734,
0x1752, 0x1753,
0x1772, 0x1773,
- 0x17b6, 0x17d3,
+ 0x17b4, 0x17d3,
0x17dd, 0x17dd,
0x180b, 0x180d,
0x18a9, 0x18a9,
@@ -3317,13 +8403,13 @@ static const OnigCodePoint CR_M[] = {
0x1b34, 0x1b44,
0x1b6b, 0x1b73,
0x1b80, 0x1b82,
- 0x1ba1, 0x1baa,
+ 0x1ba1, 0x1bad,
0x1be6, 0x1bf3,
0x1c24, 0x1c37,
0x1cd0, 0x1cd2,
0x1cd4, 0x1ce8,
0x1ced, 0x1ced,
- 0x1cf2, 0x1cf2,
+ 0x1cf2, 0x1cf4,
0x1dc0, 0x1de6,
0x1dfc, 0x1dff,
0x20d0, 0x20f0,
@@ -3333,7 +8419,8 @@ static const OnigCodePoint CR_M[] = {
0x302a, 0x302f,
0x3099, 0x309a,
0xa66f, 0xa672,
- 0xa67c, 0xa67d,
+ 0xa674, 0xa67d,
+ 0xa69f, 0xa69f,
0xa6f0, 0xa6f1,
0xa802, 0xa802,
0xa806, 0xa806,
@@ -3355,6 +8442,8 @@ static const OnigCodePoint CR_M[] = {
0xaab7, 0xaab8,
0xaabe, 0xaabf,
0xaac1, 0xaac1,
+ 0xaaeb, 0xaaef,
+ 0xaaf5, 0xaaf6,
0xabe3, 0xabea,
0xabec, 0xabed,
0xfb1e, 0xfb1e,
@@ -3370,6 +8459,13 @@ static const OnigCodePoint CR_M[] = {
0x11038, 0x11046,
0x11080, 0x11082,
0x110b0, 0x110ba,
+ 0x11100, 0x11102,
+ 0x11127, 0x11134,
+ 0x11180, 0x11182,
+ 0x111b3, 0x111c0,
+ 0x116ab, 0x116b7,
+ 0x16f51, 0x16f7e,
+ 0x16f8f, 0x16f92,
0x1d165, 0x1d169,
0x1d16d, 0x1d172,
0x1d17b, 0x1d182,
@@ -3381,7 +8477,7 @@ static const OnigCodePoint CR_M[] = {
/* 'Mc': General Category */
static const OnigCodePoint CR_Mc[] = {
- 113,
+ 126,
0x0903, 0x0903,
0x093b, 0x093b,
0x093e, 0x0940,
@@ -3463,6 +8559,7 @@ static const OnigCodePoint CR_Mc[] = {
0x1ba1, 0x1ba1,
0x1ba6, 0x1ba7,
0x1baa, 0x1baa,
+ 0x1bac, 0x1bad,
0x1be7, 0x1be7,
0x1bea, 0x1bec,
0x1bee, 0x1bee,
@@ -3470,7 +8567,8 @@ static const OnigCodePoint CR_Mc[] = {
0x1c24, 0x1c2b,
0x1c34, 0x1c35,
0x1ce1, 0x1ce1,
- 0x1cf2, 0x1cf2,
+ 0x1cf2, 0x1cf3,
+ 0x302e, 0x302f,
0xa823, 0xa824,
0xa827, 0xa827,
0xa880, 0xa881,
@@ -3484,6 +8582,9 @@ static const OnigCodePoint CR_Mc[] = {
0xaa33, 0xaa34,
0xaa4d, 0xaa4d,
0xaa7b, 0xaa7b,
+ 0xaaeb, 0xaaeb,
+ 0xaaee, 0xaaef,
+ 0xaaf5, 0xaaf5,
0xabe3, 0xabe4,
0xabe6, 0xabe7,
0xabe9, 0xabea,
@@ -3493,6 +8594,14 @@ static const OnigCodePoint CR_Mc[] = {
0x11082, 0x11082,
0x110b0, 0x110b2,
0x110b7, 0x110b8,
+ 0x1112c, 0x1112c,
+ 0x11182, 0x11182,
+ 0x111b3, 0x111b5,
+ 0x111bf, 0x111c0,
+ 0x116ac, 0x116ac,
+ 0x116ae, 0x116af,
+ 0x116b6, 0x116b6,
+ 0x16f51, 0x16f7e,
0x1d165, 0x1d166,
0x1d16d, 0x1d172,
}; /* CR_Mc */
@@ -3508,7 +8617,7 @@ static const OnigCodePoint CR_Me[] = {
/* 'Mn': General Category */
static const OnigCodePoint CR_Mn[] = {
- 203,
+ 220,
0x0300, 0x036f,
0x0483, 0x0487,
0x0591, 0x05bd,
@@ -3532,6 +8641,7 @@ static const OnigCodePoint CR_Mn[] = {
0x0825, 0x0827,
0x0829, 0x082d,
0x0859, 0x085b,
+ 0x08e4, 0x08fe,
0x0900, 0x0902,
0x093a, 0x093a,
0x093c, 0x093c,
@@ -3617,6 +8727,7 @@ static const OnigCodePoint CR_Mn[] = {
0x1732, 0x1734,
0x1752, 0x1753,
0x1772, 0x1773,
+ 0x17b4, 0x17b5,
0x17b7, 0x17bd,
0x17c6, 0x17c6,
0x17c9, 0x17d3,
@@ -3644,6 +8755,7 @@ static const OnigCodePoint CR_Mn[] = {
0x1b80, 0x1b81,
0x1ba2, 0x1ba5,
0x1ba8, 0x1ba9,
+ 0x1bab, 0x1bab,
0x1be6, 0x1be6,
0x1be8, 0x1be9,
0x1bed, 0x1bed,
@@ -3654,6 +8766,7 @@ static const OnigCodePoint CR_Mn[] = {
0x1cd4, 0x1ce0,
0x1ce2, 0x1ce8,
0x1ced, 0x1ced,
+ 0x1cf4, 0x1cf4,
0x1dc0, 0x1de6,
0x1dfc, 0x1dff,
0x20d0, 0x20dc,
@@ -3662,10 +8775,11 @@ static const OnigCodePoint CR_Mn[] = {
0x2cef, 0x2cf1,
0x2d7f, 0x2d7f,
0x2de0, 0x2dff,
- 0x302a, 0x302f,
+ 0x302a, 0x302d,
0x3099, 0x309a,
0xa66f, 0xa66f,
- 0xa67c, 0xa67d,
+ 0xa674, 0xa67d,
+ 0xa69f, 0xa69f,
0xa6f0, 0xa6f1,
0xa802, 0xa802,
0xa806, 0xa806,
@@ -3689,6 +8803,8 @@ static const OnigCodePoint CR_Mn[] = {
0xaab7, 0xaab8,
0xaabe, 0xaabf,
0xaac1, 0xaac1,
+ 0xaaec, 0xaaed,
+ 0xaaf6, 0xaaf6,
0xabe5, 0xabe5,
0xabe8, 0xabe8,
0xabed, 0xabed,
@@ -3706,6 +8822,16 @@ static const OnigCodePoint CR_Mn[] = {
0x11080, 0x11081,
0x110b3, 0x110b6,
0x110b9, 0x110ba,
+ 0x11100, 0x11102,
+ 0x11127, 0x1112b,
+ 0x1112d, 0x11134,
+ 0x11180, 0x11181,
+ 0x111b6, 0x111be,
+ 0x116ab, 0x116ab,
+ 0x116ad, 0x116ad,
+ 0x116b0, 0x116b5,
+ 0x116b7, 0x116b7,
+ 0x16f8f, 0x16f92,
0x1d167, 0x1d169,
0x1d17b, 0x1d182,
0x1d185, 0x1d18b,
@@ -3716,7 +8842,7 @@ static const OnigCodePoint CR_Mn[] = {
/* 'N': Major Category */
static const OnigCodePoint CR_N[] = {
- 83,
+ 88,
0x0030, 0x0039,
0x00b2, 0x00b3,
0x00b9, 0x00b9,
@@ -3768,6 +8894,7 @@ static const OnigCodePoint CR_N[] = {
0x3038, 0x303a,
0x3192, 0x3195,
0x3220, 0x3229,
+ 0x3248, 0x324f,
0x3251, 0x325f,
0x3280, 0x3289,
0x32b1, 0x32bf,
@@ -3796,6 +8923,10 @@ static const OnigCodePoint CR_N[] = {
0x10b78, 0x10b7f,
0x10e60, 0x10e7e,
0x11052, 0x1106f,
+ 0x110f0, 0x110f9,
+ 0x11136, 0x1113f,
+ 0x111d0, 0x111d9,
+ 0x116c0, 0x116c9,
0x12400, 0x12462,
0x1d360, 0x1d371,
0x1d7ce, 0x1d7ff,
@@ -3803,47 +8934,7 @@ static const OnigCodePoint CR_N[] = {
}; /* CR_N */
/* 'Nd': General Category */
-static const OnigCodePoint CR_Nd[] = {
- 38,
- 0x0030, 0x0039,
- 0x0660, 0x0669,
- 0x06f0, 0x06f9,
- 0x07c0, 0x07c9,
- 0x0966, 0x096f,
- 0x09e6, 0x09ef,
- 0x0a66, 0x0a6f,
- 0x0ae6, 0x0aef,
- 0x0b66, 0x0b6f,
- 0x0be6, 0x0bef,
- 0x0c66, 0x0c6f,
- 0x0ce6, 0x0cef,
- 0x0d66, 0x0d6f,
- 0x0e50, 0x0e59,
- 0x0ed0, 0x0ed9,
- 0x0f20, 0x0f29,
- 0x1040, 0x1049,
- 0x1090, 0x1099,
- 0x17e0, 0x17e9,
- 0x1810, 0x1819,
- 0x1946, 0x194f,
- 0x19d0, 0x19d9,
- 0x1a80, 0x1a89,
- 0x1a90, 0x1a99,
- 0x1b50, 0x1b59,
- 0x1bb0, 0x1bb9,
- 0x1c40, 0x1c49,
- 0x1c50, 0x1c59,
- 0xa620, 0xa629,
- 0xa8d0, 0xa8d9,
- 0xa900, 0xa909,
- 0xa9d0, 0xa9d9,
- 0xaa50, 0xaa59,
- 0xabf0, 0xabf9,
- 0xff10, 0xff19,
- 0x104a0, 0x104a9,
- 0x11066, 0x1106f,
- 0x1d7ce, 0x1d7ff,
-}; /* CR_Nd */
+#define CR_Nd CR_Digit
/* 'Nl': General Category */
static const OnigCodePoint CR_Nl[] = {
@@ -3864,7 +8955,7 @@ static const OnigCodePoint CR_Nl[] = {
/* 'No': General Category */
static const OnigCodePoint CR_No[] = {
- 41,
+ 42,
0x00b2, 0x00b3,
0x00b9, 0x00b9,
0x00bc, 0x00be,
@@ -3888,6 +8979,7 @@ static const OnigCodePoint CR_No[] = {
0x2cfd, 0x2cfd,
0x3192, 0x3195,
0x3220, 0x3229,
+ 0x3248, 0x324f,
0x3251, 0x325f,
0x3280, 0x3289,
0x32b1, 0x32bf,
@@ -3909,142 +9001,7 @@ static const OnigCodePoint CR_No[] = {
}; /* CR_No */
/* 'P': Major Category */
-static const OnigCodePoint CR_P[] = {
- 133,
- 0x0021, 0x0023,
- 0x0025, 0x002a,
- 0x002c, 0x002f,
- 0x003a, 0x003b,
- 0x003f, 0x0040,
- 0x005b, 0x005d,
- 0x005f, 0x005f,
- 0x007b, 0x007b,
- 0x007d, 0x007d,
- 0x00a1, 0x00a1,
- 0x00ab, 0x00ab,
- 0x00b7, 0x00b7,
- 0x00bb, 0x00bb,
- 0x00bf, 0x00bf,
- 0x037e, 0x037e,
- 0x0387, 0x0387,
- 0x055a, 0x055f,
- 0x0589, 0x058a,
- 0x05be, 0x05be,
- 0x05c0, 0x05c0,
- 0x05c3, 0x05c3,
- 0x05c6, 0x05c6,
- 0x05f3, 0x05f4,
- 0x0609, 0x060a,
- 0x060c, 0x060d,
- 0x061b, 0x061b,
- 0x061e, 0x061f,
- 0x066a, 0x066d,
- 0x06d4, 0x06d4,
- 0x0700, 0x070d,
- 0x07f7, 0x07f9,
- 0x0830, 0x083e,
- 0x085e, 0x085e,
- 0x0964, 0x0965,
- 0x0970, 0x0970,
- 0x0df4, 0x0df4,
- 0x0e4f, 0x0e4f,
- 0x0e5a, 0x0e5b,
- 0x0f04, 0x0f12,
- 0x0f3a, 0x0f3d,
- 0x0f85, 0x0f85,
- 0x0fd0, 0x0fd4,
- 0x0fd9, 0x0fda,
- 0x104a, 0x104f,
- 0x10fb, 0x10fb,
- 0x1361, 0x1368,
- 0x1400, 0x1400,
- 0x166d, 0x166e,
- 0x169b, 0x169c,
- 0x16eb, 0x16ed,
- 0x1735, 0x1736,
- 0x17d4, 0x17d6,
- 0x17d8, 0x17da,
- 0x1800, 0x180a,
- 0x1944, 0x1945,
- 0x1a1e, 0x1a1f,
- 0x1aa0, 0x1aa6,
- 0x1aa8, 0x1aad,
- 0x1b5a, 0x1b60,
- 0x1bfc, 0x1bff,
- 0x1c3b, 0x1c3f,
- 0x1c7e, 0x1c7f,
- 0x1cd3, 0x1cd3,
- 0x2010, 0x2027,
- 0x2030, 0x2043,
- 0x2045, 0x2051,
- 0x2053, 0x205e,
- 0x207d, 0x207e,
- 0x208d, 0x208e,
- 0x2329, 0x232a,
- 0x2768, 0x2775,
- 0x27c5, 0x27c6,
- 0x27e6, 0x27ef,
- 0x2983, 0x2998,
- 0x29d8, 0x29db,
- 0x29fc, 0x29fd,
- 0x2cf9, 0x2cfc,
- 0x2cfe, 0x2cff,
- 0x2d70, 0x2d70,
- 0x2e00, 0x2e2e,
- 0x2e30, 0x2e31,
- 0x3001, 0x3003,
- 0x3008, 0x3011,
- 0x3014, 0x301f,
- 0x3030, 0x3030,
- 0x303d, 0x303d,
- 0x30a0, 0x30a0,
- 0x30fb, 0x30fb,
- 0xa4fe, 0xa4ff,
- 0xa60d, 0xa60f,
- 0xa673, 0xa673,
- 0xa67e, 0xa67e,
- 0xa6f2, 0xa6f7,
- 0xa874, 0xa877,
- 0xa8ce, 0xa8cf,
- 0xa8f8, 0xa8fa,
- 0xa92e, 0xa92f,
- 0xa95f, 0xa95f,
- 0xa9c1, 0xa9cd,
- 0xa9de, 0xa9df,
- 0xaa5c, 0xaa5f,
- 0xaade, 0xaadf,
- 0xabeb, 0xabeb,
- 0xfd3e, 0xfd3f,
- 0xfe10, 0xfe19,
- 0xfe30, 0xfe52,
- 0xfe54, 0xfe61,
- 0xfe63, 0xfe63,
- 0xfe68, 0xfe68,
- 0xfe6a, 0xfe6b,
- 0xff01, 0xff03,
- 0xff05, 0xff0a,
- 0xff0c, 0xff0f,
- 0xff1a, 0xff1b,
- 0xff1f, 0xff20,
- 0xff3b, 0xff3d,
- 0xff3f, 0xff3f,
- 0xff5b, 0xff5b,
- 0xff5d, 0xff5d,
- 0xff5f, 0xff65,
- 0x10100, 0x10101,
- 0x1039f, 0x1039f,
- 0x103d0, 0x103d0,
- 0x10857, 0x10857,
- 0x1091f, 0x1091f,
- 0x1093f, 0x1093f,
- 0x10a50, 0x10a58,
- 0x10a7f, 0x10a7f,
- 0x10b39, 0x10b3f,
- 0x11047, 0x1104d,
- 0x110bb, 0x110bc,
- 0x110be, 0x110c1,
- 0x12470, 0x12473,
-}; /* CR_P */
+#define CR_P CR_Punct
/* 'Pc': General Category */
static const OnigCodePoint CR_Pc[] = {
@@ -4059,7 +9016,7 @@ static const OnigCodePoint CR_Pc[] = {
/* 'Pd': General Category */
static const OnigCodePoint CR_Pd[] = {
- 15,
+ 16,
0x002d, 0x002d,
0x058a, 0x058a,
0x05be, 0x05be,
@@ -4068,6 +9025,7 @@ static const OnigCodePoint CR_Pd[] = {
0x2010, 0x2015,
0x2e17, 0x2e17,
0x2e1a, 0x2e1a,
+ 0x2e3a, 0x2e3b,
0x301c, 0x301c,
0x3030, 0x3030,
0x30a0, 0x30a0,
@@ -4185,7 +9143,7 @@ static const OnigCodePoint CR_Pi[] = {
/* 'Po': General Category */
static const OnigCodePoint CR_Po[] = {
- 128,
+ 135,
0x0021, 0x0023,
0x0025, 0x0027,
0x002a, 0x002a,
@@ -4195,7 +9153,8 @@ static const OnigCodePoint CR_Po[] = {
0x003f, 0x0040,
0x005c, 0x005c,
0x00a1, 0x00a1,
- 0x00b7, 0x00b7,
+ 0x00a7, 0x00a7,
+ 0x00b6, 0x00b7,
0x00bf, 0x00bf,
0x037e, 0x037e,
0x0387, 0x0387,
@@ -4217,16 +9176,18 @@ static const OnigCodePoint CR_Po[] = {
0x085e, 0x085e,
0x0964, 0x0965,
0x0970, 0x0970,
+ 0x0af0, 0x0af0,
0x0df4, 0x0df4,
0x0e4f, 0x0e4f,
0x0e5a, 0x0e5b,
0x0f04, 0x0f12,
+ 0x0f14, 0x0f14,
0x0f85, 0x0f85,
0x0fd0, 0x0fd4,
0x0fd9, 0x0fda,
0x104a, 0x104f,
0x10fb, 0x10fb,
- 0x1361, 0x1368,
+ 0x1360, 0x1368,
0x166d, 0x166e,
0x16eb, 0x16ed,
0x1735, 0x1736,
@@ -4242,6 +9203,7 @@ static const OnigCodePoint CR_Po[] = {
0x1bfc, 0x1bff,
0x1c3b, 0x1c3f,
0x1c7e, 0x1c7f,
+ 0x1cc0, 0x1cc7,
0x1cd3, 0x1cd3,
0x2016, 0x2017,
0x2020, 0x2027,
@@ -4262,7 +9224,7 @@ static const OnigCodePoint CR_Po[] = {
0x2e1b, 0x2e1b,
0x2e1e, 0x2e1f,
0x2e2a, 0x2e2e,
- 0x2e30, 0x2e31,
+ 0x2e30, 0x2e39,
0x3001, 0x3003,
0x303d, 0x303d,
0x30fb, 0x30fb,
@@ -4280,6 +9242,7 @@ static const OnigCodePoint CR_Po[] = {
0xa9de, 0xa9df,
0xaa5c, 0xaa5f,
0xaade, 0xaadf,
+ 0xaaf0, 0xaaf1,
0xabeb, 0xabeb,
0xfe10, 0xfe16,
0xfe19, 0xfe19,
@@ -4301,7 +9264,7 @@ static const OnigCodePoint CR_Po[] = {
0xff3c, 0xff3c,
0xff61, 0xff61,
0xff64, 0xff65,
- 0x10100, 0x10101,
+ 0x10100, 0x10102,
0x1039f, 0x1039f,
0x103d0, 0x103d0,
0x10857, 0x10857,
@@ -4313,6 +9276,8 @@ static const OnigCodePoint CR_Po[] = {
0x11047, 0x1104d,
0x110bb, 0x110bc,
0x110be, 0x110c1,
+ 0x11140, 0x11143,
+ 0x111c5, 0x111c8,
0x12470, 0x12473,
}; /* CR_Po */
@@ -4395,7 +9360,7 @@ static const OnigCodePoint CR_Ps[] = {
/* 'S': Major Category */
static const OnigCodePoint CR_S[] = {
- 208,
+ 198,
0x0024, 0x0024,
0x002b, 0x002b,
0x003c, 0x003e,
@@ -4403,11 +9368,11 @@ static const OnigCodePoint CR_S[] = {
0x0060, 0x0060,
0x007c, 0x007c,
0x007e, 0x007e,
- 0x00a2, 0x00a9,
+ 0x00a2, 0x00a6,
+ 0x00a8, 0x00a9,
0x00ac, 0x00ac,
0x00ae, 0x00b1,
0x00b4, 0x00b4,
- 0x00b6, 0x00b6,
0x00b8, 0x00b8,
0x00d7, 0x00d7,
0x00f7, 0x00f7,
@@ -4420,6 +9385,7 @@ static const OnigCodePoint CR_S[] = {
0x0384, 0x0385,
0x03f6, 0x03f6,
0x0482, 0x0482,
+ 0x058f, 0x058f,
0x0606, 0x0608,
0x060b, 0x060b,
0x060e, 0x060f,
@@ -4436,7 +9402,8 @@ static const OnigCodePoint CR_S[] = {
0x0d79, 0x0d79,
0x0e3f, 0x0e3f,
0x0f01, 0x0f03,
- 0x0f13, 0x0f17,
+ 0x0f13, 0x0f13,
+ 0x0f15, 0x0f17,
0x0f1a, 0x0f1f,
0x0f34, 0x0f34,
0x0f36, 0x0f36,
@@ -4446,7 +9413,6 @@ static const OnigCodePoint CR_S[] = {
0x0fce, 0x0fcf,
0x0fd5, 0x0fd8,
0x109e, 0x109f,
- 0x1360, 0x1360,
0x1390, 0x1399,
0x17db, 0x17db,
0x1940, 0x1940,
@@ -4486,9 +9452,7 @@ static const OnigCodePoint CR_S[] = {
0x2500, 0x26ff,
0x2701, 0x2767,
0x2794, 0x27c4,
- 0x27c7, 0x27ca,
- 0x27cc, 0x27cc,
- 0x27ce, 0x27e5,
+ 0x27c7, 0x27e5,
0x27f0, 0x2982,
0x2999, 0x29d7,
0x29dc, 0x29fb,
@@ -4509,7 +9473,8 @@ static const OnigCodePoint CR_S[] = {
0x3196, 0x319f,
0x31c0, 0x31e3,
0x3200, 0x321e,
- 0x322a, 0x3250,
+ 0x322a, 0x3247,
+ 0x3250, 0x3250,
0x3260, 0x327f,
0x328a, 0x32b0,
0x32c0, 0x32fe,
@@ -4538,7 +9503,6 @@ static const OnigCodePoint CR_S[] = {
0xffe0, 0xffe6,
0xffe8, 0xffee,
0xfffc, 0xfffd,
- 0x10102, 0x10102,
0x10137, 0x1013f,
0x10179, 0x10189,
0x10190, 0x1019b,
@@ -4563,6 +9527,7 @@ static const OnigCodePoint CR_S[] = {
0x1d789, 0x1d789,
0x1d7a9, 0x1d7a9,
0x1d7c3, 0x1d7c3,
+ 0x1eef0, 0x1eef1,
0x1f000, 0x1f02b,
0x1f030, 0x1f093,
0x1f0a0, 0x1f0ae,
@@ -4570,7 +9535,7 @@ static const OnigCodePoint CR_S[] = {
0x1f0c1, 0x1f0cf,
0x1f0d1, 0x1f0df,
0x1f110, 0x1f12e,
- 0x1f130, 0x1f169,
+ 0x1f130, 0x1f16b,
0x1f170, 0x1f19a,
0x1f1e6, 0x1f202,
0x1f210, 0x1f23a,
@@ -4588,19 +9553,9 @@ static const OnigCodePoint CR_S[] = {
0x1f442, 0x1f4f7,
0x1f4f9, 0x1f4fc,
0x1f500, 0x1f53d,
+ 0x1f540, 0x1f543,
0x1f550, 0x1f567,
- 0x1f5fb, 0x1f5ff,
- 0x1f601, 0x1f610,
- 0x1f612, 0x1f614,
- 0x1f616, 0x1f616,
- 0x1f618, 0x1f618,
- 0x1f61a, 0x1f61a,
- 0x1f61c, 0x1f61e,
- 0x1f620, 0x1f625,
- 0x1f628, 0x1f62b,
- 0x1f62d, 0x1f62d,
- 0x1f630, 0x1f633,
- 0x1f635, 0x1f640,
+ 0x1f5fb, 0x1f640,
0x1f645, 0x1f64f,
0x1f680, 0x1f6c5,
0x1f700, 0x1f773,
@@ -4608,9 +9563,10 @@ static const OnigCodePoint CR_S[] = {
/* 'Sc': General Category */
static const OnigCodePoint CR_Sc[] = {
- 16,
+ 17,
0x0024, 0x0024,
0x00a2, 0x00a5,
+ 0x058f, 0x058f,
0x060b, 0x060b,
0x09f2, 0x09f3,
0x09fb, 0x09fb,
@@ -4661,7 +9617,7 @@ static const OnigCodePoint CR_Sk[] = {
/* 'Sm': General Category */
static const OnigCodePoint CR_Sm[] = {
- 66,
+ 65,
0x002b, 0x002b,
0x003c, 0x003e,
0x007c, 0x007c,
@@ -4699,9 +9655,7 @@ static const OnigCodePoint CR_Sm[] = {
0x25f8, 0x25ff,
0x266f, 0x266f,
0x27c0, 0x27c4,
- 0x27c7, 0x27ca,
- 0x27cc, 0x27cc,
- 0x27ce, 0x27e5,
+ 0x27c7, 0x27e5,
0x27f0, 0x27ff,
0x2900, 0x2982,
0x2999, 0x29d7,
@@ -4728,16 +9682,16 @@ static const OnigCodePoint CR_Sm[] = {
0x1d789, 0x1d789,
0x1d7a9, 0x1d7a9,
0x1d7c3, 0x1d7c3,
+ 0x1eef0, 0x1eef1,
}; /* CR_Sm */
/* 'So': General Category */
static const OnigCodePoint CR_So[] = {
- 164,
- 0x00a6, 0x00a7,
+ 153,
+ 0x00a6, 0x00a6,
0x00a9, 0x00a9,
0x00ae, 0x00ae,
0x00b0, 0x00b0,
- 0x00b6, 0x00b6,
0x0482, 0x0482,
0x060e, 0x060f,
0x06de, 0x06de,
@@ -4751,7 +9705,8 @@ static const OnigCodePoint CR_So[] = {
0x0c7f, 0x0c7f,
0x0d79, 0x0d79,
0x0f01, 0x0f03,
- 0x0f13, 0x0f17,
+ 0x0f13, 0x0f13,
+ 0x0f15, 0x0f17,
0x0f1a, 0x0f1f,
0x0f34, 0x0f34,
0x0f36, 0x0f36,
@@ -4761,7 +9716,6 @@ static const OnigCodePoint CR_So[] = {
0x0fce, 0x0fcf,
0x0fd5, 0x0fd8,
0x109e, 0x109f,
- 0x1360, 0x1360,
0x1390, 0x1399,
0x1940, 0x1940,
0x19de, 0x19ff,
@@ -4825,7 +9779,8 @@ static const OnigCodePoint CR_So[] = {
0x3196, 0x319f,
0x31c0, 0x31e3,
0x3200, 0x321e,
- 0x322a, 0x3250,
+ 0x322a, 0x3247,
+ 0x3250, 0x3250,
0x3260, 0x327f,
0x328a, 0x32b0,
0x32c0, 0x32fe,
@@ -4841,7 +9796,6 @@ static const OnigCodePoint CR_So[] = {
0xffe8, 0xffe8,
0xffed, 0xffee,
0xfffc, 0xfffd,
- 0x10102, 0x10102,
0x10137, 0x1013f,
0x10179, 0x10189,
0x10190, 0x1019b,
@@ -4863,7 +9817,7 @@ static const OnigCodePoint CR_So[] = {
0x1f0c1, 0x1f0cf,
0x1f0d1, 0x1f0df,
0x1f110, 0x1f12e,
- 0x1f130, 0x1f169,
+ 0x1f130, 0x1f16b,
0x1f170, 0x1f19a,
0x1f1e6, 0x1f202,
0x1f210, 0x1f23a,
@@ -4881,19 +9835,9 @@ static const OnigCodePoint CR_So[] = {
0x1f442, 0x1f4f7,
0x1f4f9, 0x1f4fc,
0x1f500, 0x1f53d,
+ 0x1f540, 0x1f543,
0x1f550, 0x1f567,
- 0x1f5fb, 0x1f5ff,
- 0x1f601, 0x1f610,
- 0x1f612, 0x1f614,
- 0x1f616, 0x1f616,
- 0x1f618, 0x1f618,
- 0x1f61a, 0x1f61a,
- 0x1f61c, 0x1f61e,
- 0x1f620, 0x1f625,
- 0x1f628, 0x1f62b,
- 0x1f62d, 0x1f62d,
- 0x1f630, 0x1f633,
- 0x1f635, 0x1f640,
+ 0x1f5fb, 0x1f640,
0x1f645, 0x1f64f,
0x1f680, 0x1f6c5,
0x1f700, 0x1f773,
@@ -4940,7 +9884,7 @@ static const OnigCodePoint CR_Zs[] = {
/* 'Math': Derived Property */
static const OnigCodePoint CR_Math[] = {
- 106,
+ 138,
0x002b, 0x002b,
0x003c, 0x003e,
0x005e, 0x005e,
@@ -5009,9 +9953,7 @@ static const OnigCodePoint CR_Math[] = {
0x2642, 0x2642,
0x2660, 0x2663,
0x266d, 0x266f,
- 0x27c0, 0x27ca,
- 0x27cc, 0x27cc,
- 0x27ce, 0x27ff,
+ 0x27c0, 0x27ff,
0x2900, 0x2aff,
0x2b30, 0x2b44,
0x2b47, 0x2b4c,
@@ -5047,1729 +9989,54 @@ static const OnigCodePoint CR_Math[] = {
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,
}; /* CR_Math */
/* 'Alphabetic': Derived Property */
-static const OnigCodePoint CR_Alphabetic[] = {
- 486,
- 0x0041, 0x005a,
- 0x0061, 0x007a,
- 0x00aa, 0x00aa,
- 0x00b5, 0x00b5,
- 0x00ba, 0x00ba,
- 0x00c0, 0x00d6,
- 0x00d8, 0x00f6,
- 0x00f8, 0x02c1,
- 0x02c6, 0x02d1,
- 0x02e0, 0x02e4,
- 0x02ec, 0x02ec,
- 0x02ee, 0x02ee,
- 0x0345, 0x0345,
- 0x0370, 0x0374,
- 0x0376, 0x0377,
- 0x037a, 0x037d,
- 0x0386, 0x0386,
- 0x0388, 0x038a,
- 0x038c, 0x038c,
- 0x038e, 0x03a1,
- 0x03a3, 0x03f5,
- 0x03f7, 0x0481,
- 0x048a, 0x0527,
- 0x0531, 0x0556,
- 0x0559, 0x0559,
- 0x0561, 0x0587,
- 0x05b0, 0x05bd,
- 0x05bf, 0x05bf,
- 0x05c1, 0x05c2,
- 0x05c4, 0x05c5,
- 0x05c7, 0x05c7,
- 0x05d0, 0x05ea,
- 0x05f0, 0x05f2,
- 0x0610, 0x061a,
- 0x0620, 0x0657,
- 0x0659, 0x065f,
- 0x066e, 0x06d3,
- 0x06d5, 0x06dc,
- 0x06e1, 0x06e8,
- 0x06ed, 0x06ef,
- 0x06fa, 0x06fc,
- 0x06ff, 0x06ff,
- 0x0710, 0x073f,
- 0x074d, 0x07b1,
- 0x07ca, 0x07ea,
- 0x07f4, 0x07f5,
- 0x07fa, 0x07fa,
- 0x0800, 0x0817,
- 0x081a, 0x082c,
- 0x0840, 0x0858,
- 0x0900, 0x093b,
- 0x093d, 0x094c,
- 0x094e, 0x0950,
- 0x0955, 0x0963,
- 0x0971, 0x0977,
- 0x0979, 0x097f,
- 0x0981, 0x0983,
- 0x0985, 0x098c,
- 0x098f, 0x0990,
- 0x0993, 0x09a8,
- 0x09aa, 0x09b0,
- 0x09b2, 0x09b2,
- 0x09b6, 0x09b9,
- 0x09bd, 0x09c4,
- 0x09c7, 0x09c8,
- 0x09cb, 0x09cc,
- 0x09ce, 0x09ce,
- 0x09d7, 0x09d7,
- 0x09dc, 0x09dd,
- 0x09df, 0x09e3,
- 0x09f0, 0x09f1,
- 0x0a01, 0x0a03,
- 0x0a05, 0x0a0a,
- 0x0a0f, 0x0a10,
- 0x0a13, 0x0a28,
- 0x0a2a, 0x0a30,
- 0x0a32, 0x0a33,
- 0x0a35, 0x0a36,
- 0x0a38, 0x0a39,
- 0x0a3e, 0x0a42,
- 0x0a47, 0x0a48,
- 0x0a4b, 0x0a4c,
- 0x0a51, 0x0a51,
- 0x0a59, 0x0a5c,
- 0x0a5e, 0x0a5e,
- 0x0a70, 0x0a75,
- 0x0a81, 0x0a83,
- 0x0a85, 0x0a8d,
- 0x0a8f, 0x0a91,
- 0x0a93, 0x0aa8,
- 0x0aaa, 0x0ab0,
- 0x0ab2, 0x0ab3,
- 0x0ab5, 0x0ab9,
- 0x0abd, 0x0ac5,
- 0x0ac7, 0x0ac9,
- 0x0acb, 0x0acc,
- 0x0ad0, 0x0ad0,
- 0x0ae0, 0x0ae3,
- 0x0b01, 0x0b03,
- 0x0b05, 0x0b0c,
- 0x0b0f, 0x0b10,
- 0x0b13, 0x0b28,
- 0x0b2a, 0x0b30,
- 0x0b32, 0x0b33,
- 0x0b35, 0x0b39,
- 0x0b3d, 0x0b44,
- 0x0b47, 0x0b48,
- 0x0b4b, 0x0b4c,
- 0x0b56, 0x0b57,
- 0x0b5c, 0x0b5d,
- 0x0b5f, 0x0b63,
- 0x0b71, 0x0b71,
- 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, 0x0bcc,
- 0x0bd0, 0x0bd0,
- 0x0bd7, 0x0bd7,
- 0x0c01, 0x0c03,
- 0x0c05, 0x0c0c,
- 0x0c0e, 0x0c10,
- 0x0c12, 0x0c28,
- 0x0c2a, 0x0c33,
- 0x0c35, 0x0c39,
- 0x0c3d, 0x0c44,
- 0x0c46, 0x0c48,
- 0x0c4a, 0x0c4c,
- 0x0c55, 0x0c56,
- 0x0c58, 0x0c59,
- 0x0c60, 0x0c63,
- 0x0c82, 0x0c83,
- 0x0c85, 0x0c8c,
- 0x0c8e, 0x0c90,
- 0x0c92, 0x0ca8,
- 0x0caa, 0x0cb3,
- 0x0cb5, 0x0cb9,
- 0x0cbd, 0x0cc4,
- 0x0cc6, 0x0cc8,
- 0x0cca, 0x0ccc,
- 0x0cd5, 0x0cd6,
- 0x0cde, 0x0cde,
- 0x0ce0, 0x0ce3,
- 0x0cf1, 0x0cf2,
- 0x0d02, 0x0d03,
- 0x0d05, 0x0d0c,
- 0x0d0e, 0x0d10,
- 0x0d12, 0x0d3a,
- 0x0d3d, 0x0d44,
- 0x0d46, 0x0d48,
- 0x0d4a, 0x0d4c,
- 0x0d4e, 0x0d4e,
- 0x0d57, 0x0d57,
- 0x0d60, 0x0d63,
- 0x0d7a, 0x0d7f,
- 0x0d82, 0x0d83,
- 0x0d85, 0x0d96,
- 0x0d9a, 0x0db1,
- 0x0db3, 0x0dbb,
- 0x0dbd, 0x0dbd,
- 0x0dc0, 0x0dc6,
- 0x0dcf, 0x0dd4,
- 0x0dd6, 0x0dd6,
- 0x0dd8, 0x0ddf,
- 0x0df2, 0x0df3,
- 0x0e01, 0x0e3a,
- 0x0e40, 0x0e46,
- 0x0e4d, 0x0e4d,
- 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,
- 0x0ecd, 0x0ecd,
- 0x0edc, 0x0edd,
- 0x0f00, 0x0f00,
- 0x0f40, 0x0f47,
- 0x0f49, 0x0f6c,
- 0x0f71, 0x0f81,
- 0x0f88, 0x0f97,
- 0x0f99, 0x0fbc,
- 0x1000, 0x1036,
- 0x1038, 0x1038,
- 0x103b, 0x103f,
- 0x1050, 0x1062,
- 0x1065, 0x1068,
- 0x106e, 0x1086,
- 0x108e, 0x108e,
- 0x109c, 0x109d,
- 0x10a0, 0x10c5,
- 0x10d0, 0x10fa,
- 0x10fc, 0x10fc,
- 0x1100, 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,
- 0x135f, 0x135f,
- 0x1380, 0x138f,
- 0x13a0, 0x13f4,
- 0x1401, 0x166c,
- 0x166f, 0x167f,
- 0x1681, 0x169a,
- 0x16a0, 0x16ea,
- 0x16ee, 0x16f0,
- 0x1700, 0x170c,
- 0x170e, 0x1713,
- 0x1720, 0x1733,
- 0x1740, 0x1753,
- 0x1760, 0x176c,
- 0x176e, 0x1770,
- 0x1772, 0x1773,
- 0x1780, 0x17b3,
- 0x17b6, 0x17c8,
- 0x17d7, 0x17d7,
- 0x17dc, 0x17dc,
- 0x1820, 0x1877,
- 0x1880, 0x18aa,
- 0x18b0, 0x18f5,
- 0x1900, 0x191c,
- 0x1920, 0x192b,
- 0x1930, 0x1938,
- 0x1950, 0x196d,
- 0x1970, 0x1974,
- 0x1980, 0x19ab,
- 0x19b0, 0x19c9,
- 0x1a00, 0x1a1b,
- 0x1a20, 0x1a5e,
- 0x1a61, 0x1a74,
- 0x1aa7, 0x1aa7,
- 0x1b00, 0x1b33,
- 0x1b35, 0x1b43,
- 0x1b45, 0x1b4b,
- 0x1b80, 0x1ba9,
- 0x1bae, 0x1baf,
- 0x1bc0, 0x1be5,
- 0x1be7, 0x1bf1,
- 0x1c00, 0x1c35,
- 0x1c4d, 0x1c4f,
- 0x1c5a, 0x1c7d,
- 0x1ce9, 0x1cec,
- 0x1cee, 0x1cf2,
- 0x1d00, 0x1dbf,
- 0x1e00, 0x1f15,
- 0x1f18, 0x1f1d,
- 0x1f20, 0x1f45,
- 0x1f48, 0x1f4d,
- 0x1f50, 0x1f57,
- 0x1f59, 0x1f59,
- 0x1f5b, 0x1f5b,
- 0x1f5d, 0x1f5d,
- 0x1f5f, 0x1f7d,
- 0x1f80, 0x1fb4,
- 0x1fb6, 0x1fbc,
- 0x1fbe, 0x1fbe,
- 0x1fc2, 0x1fc4,
- 0x1fc6, 0x1fcc,
- 0x1fd0, 0x1fd3,
- 0x1fd6, 0x1fdb,
- 0x1fe0, 0x1fec,
- 0x1ff2, 0x1ff4,
- 0x1ff6, 0x1ffc,
- 0x2071, 0x2071,
- 0x207f, 0x207f,
- 0x2090, 0x209c,
- 0x2102, 0x2102,
- 0x2107, 0x2107,
- 0x210a, 0x2113,
- 0x2115, 0x2115,
- 0x2119, 0x211d,
- 0x2124, 0x2124,
- 0x2126, 0x2126,
- 0x2128, 0x2128,
- 0x212a, 0x212d,
- 0x212f, 0x2139,
- 0x213c, 0x213f,
- 0x2145, 0x2149,
- 0x214e, 0x214e,
- 0x2160, 0x2188,
- 0x24b6, 0x24e9,
- 0x2c00, 0x2c2e,
- 0x2c30, 0x2c5e,
- 0x2c60, 0x2ce4,
- 0x2ceb, 0x2cee,
- 0x2d00, 0x2d25,
- 0x2d30, 0x2d65,
- 0x2d6f, 0x2d6f,
- 0x2d80, 0x2d96,
- 0x2da0, 0x2da6,
- 0x2da8, 0x2dae,
- 0x2db0, 0x2db6,
- 0x2db8, 0x2dbe,
- 0x2dc0, 0x2dc6,
- 0x2dc8, 0x2dce,
- 0x2dd0, 0x2dd6,
- 0x2dd8, 0x2dde,
- 0x2de0, 0x2dff,
- 0x2e2f, 0x2e2f,
- 0x3005, 0x3007,
- 0x3021, 0x3029,
- 0x3031, 0x3035,
- 0x3038, 0x303c,
- 0x3041, 0x3096,
- 0x309d, 0x309f,
- 0x30a1, 0x30fa,
- 0x30fc, 0x30ff,
- 0x3105, 0x312d,
- 0x3131, 0x318e,
- 0x31a0, 0x31ba,
- 0x31f0, 0x31ff,
- 0x3400, 0x4db5,
- 0x4e00, 0x9fcb,
- 0xa000, 0xa48c,
- 0xa4d0, 0xa4fd,
- 0xa500, 0xa60c,
- 0xa610, 0xa61f,
- 0xa62a, 0xa62b,
- 0xa640, 0xa66e,
- 0xa67f, 0xa697,
- 0xa6a0, 0xa6ef,
- 0xa717, 0xa71f,
- 0xa722, 0xa788,
- 0xa78b, 0xa78e,
- 0xa790, 0xa791,
- 0xa7a0, 0xa7a9,
- 0xa7fa, 0xa801,
- 0xa803, 0xa805,
- 0xa807, 0xa80a,
- 0xa80c, 0xa827,
- 0xa840, 0xa873,
- 0xa880, 0xa8c3,
- 0xa8f2, 0xa8f7,
- 0xa8fb, 0xa8fb,
- 0xa90a, 0xa92a,
- 0xa930, 0xa952,
- 0xa960, 0xa97c,
- 0xa980, 0xa9b2,
- 0xa9b4, 0xa9bf,
- 0xa9cf, 0xa9cf,
- 0xaa00, 0xaa36,
- 0xaa40, 0xaa4d,
- 0xaa60, 0xaa76,
- 0xaa7a, 0xaa7a,
- 0xaa80, 0xaabe,
- 0xaac0, 0xaac0,
- 0xaac2, 0xaac2,
- 0xaadb, 0xaadd,
- 0xab01, 0xab06,
- 0xab09, 0xab0e,
- 0xab11, 0xab16,
- 0xab20, 0xab26,
- 0xab28, 0xab2e,
- 0xabc0, 0xabea,
- 0xac00, 0xd7a3,
- 0xd7b0, 0xd7c6,
- 0xd7cb, 0xd7fb,
- 0xf900, 0xfa2d,
- 0xfa30, 0xfa6d,
- 0xfa70, 0xfad9,
- 0xfb00, 0xfb06,
- 0xfb13, 0xfb17,
- 0xfb1d, 0xfb28,
- 0xfb2a, 0xfb36,
- 0xfb38, 0xfb3c,
- 0xfb3e, 0xfb3e,
- 0xfb40, 0xfb41,
- 0xfb43, 0xfb44,
- 0xfb46, 0xfbb1,
- 0xfbd3, 0xfd3d,
- 0xfd50, 0xfd8f,
- 0xfd92, 0xfdc7,
- 0xfdf0, 0xfdfb,
- 0xfe70, 0xfe74,
- 0xfe76, 0xfefc,
- 0xff21, 0xff3a,
- 0xff41, 0xff5a,
- 0xff66, 0xffbe,
- 0xffc2, 0xffc7,
- 0xffca, 0xffcf,
- 0xffd2, 0xffd7,
- 0xffda, 0xffdc,
- 0x10000, 0x1000b,
- 0x1000d, 0x10026,
- 0x10028, 0x1003a,
- 0x1003c, 0x1003d,
- 0x1003f, 0x1004d,
- 0x10050, 0x1005d,
- 0x10080, 0x100fa,
- 0x10140, 0x10174,
- 0x10280, 0x1029c,
- 0x102a0, 0x102d0,
- 0x10300, 0x1031e,
- 0x10330, 0x1034a,
- 0x10380, 0x1039d,
- 0x103a0, 0x103c3,
- 0x103c8, 0x103cf,
- 0x103d1, 0x103d5,
- 0x10400, 0x1049d,
- 0x10800, 0x10805,
- 0x10808, 0x10808,
- 0x1080a, 0x10835,
- 0x10837, 0x10838,
- 0x1083c, 0x1083c,
- 0x1083f, 0x10855,
- 0x10900, 0x10915,
- 0x10920, 0x10939,
- 0x10a00, 0x10a03,
- 0x10a05, 0x10a06,
- 0x10a0c, 0x10a13,
- 0x10a15, 0x10a17,
- 0x10a19, 0x10a33,
- 0x10a60, 0x10a7c,
- 0x10b00, 0x10b35,
- 0x10b40, 0x10b55,
- 0x10b60, 0x10b72,
- 0x10c00, 0x10c48,
- 0x11000, 0x11045,
- 0x11082, 0x110b8,
- 0x12000, 0x1236e,
- 0x12400, 0x12462,
- 0x13000, 0x1342e,
- 0x16800, 0x16a38,
- 0x1b000, 0x1b001,
- 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, 0x1d6c0,
- 0x1d6c2, 0x1d6da,
- 0x1d6dc, 0x1d6fa,
- 0x1d6fc, 0x1d714,
- 0x1d716, 0x1d734,
- 0x1d736, 0x1d74e,
- 0x1d750, 0x1d76e,
- 0x1d770, 0x1d788,
- 0x1d78a, 0x1d7a8,
- 0x1d7aa, 0x1d7c2,
- 0x1d7c4, 0x1d7cb,
- 0x20000, 0x2a6d6,
- 0x2a700, 0x2b734,
- 0x2b740, 0x2b81d,
- 0x2f800, 0x2fa1d,
-}; /* CR_Alphabetic */
+#define CR_Alphabetic CR_Alpha
/* 'Lowercase': Derived Property */
-static const OnigCodePoint CR_Lowercase[] = {
- 612,
- 0x0061, 0x007a,
- 0x00aa, 0x00aa,
- 0x00b5, 0x00b5,
- 0x00ba, 0x00ba,
- 0x00df, 0x00f6,
- 0x00f8, 0x00ff,
- 0x0101, 0x0101,
- 0x0103, 0x0103,
- 0x0105, 0x0105,
- 0x0107, 0x0107,
- 0x0109, 0x0109,
- 0x010b, 0x010b,
- 0x010d, 0x010d,
- 0x010f, 0x010f,
- 0x0111, 0x0111,
- 0x0113, 0x0113,
- 0x0115, 0x0115,
- 0x0117, 0x0117,
- 0x0119, 0x0119,
- 0x011b, 0x011b,
- 0x011d, 0x011d,
- 0x011f, 0x011f,
- 0x0121, 0x0121,
- 0x0123, 0x0123,
- 0x0125, 0x0125,
- 0x0127, 0x0127,
- 0x0129, 0x0129,
- 0x012b, 0x012b,
- 0x012d, 0x012d,
- 0x012f, 0x012f,
- 0x0131, 0x0131,
- 0x0133, 0x0133,
- 0x0135, 0x0135,
- 0x0137, 0x0138,
- 0x013a, 0x013a,
- 0x013c, 0x013c,
- 0x013e, 0x013e,
- 0x0140, 0x0140,
- 0x0142, 0x0142,
- 0x0144, 0x0144,
- 0x0146, 0x0146,
- 0x0148, 0x0149,
- 0x014b, 0x014b,
- 0x014d, 0x014d,
- 0x014f, 0x014f,
- 0x0151, 0x0151,
- 0x0153, 0x0153,
- 0x0155, 0x0155,
- 0x0157, 0x0157,
- 0x0159, 0x0159,
- 0x015b, 0x015b,
- 0x015d, 0x015d,
- 0x015f, 0x015f,
- 0x0161, 0x0161,
- 0x0163, 0x0163,
- 0x0165, 0x0165,
- 0x0167, 0x0167,
- 0x0169, 0x0169,
- 0x016b, 0x016b,
- 0x016d, 0x016d,
- 0x016f, 0x016f,
- 0x0171, 0x0171,
- 0x0173, 0x0173,
- 0x0175, 0x0175,
- 0x0177, 0x0177,
- 0x017a, 0x017a,
- 0x017c, 0x017c,
- 0x017e, 0x0180,
- 0x0183, 0x0183,
- 0x0185, 0x0185,
- 0x0188, 0x0188,
- 0x018c, 0x018d,
- 0x0192, 0x0192,
- 0x0195, 0x0195,
- 0x0199, 0x019b,
- 0x019e, 0x019e,
- 0x01a1, 0x01a1,
- 0x01a3, 0x01a3,
- 0x01a5, 0x01a5,
- 0x01a8, 0x01a8,
- 0x01aa, 0x01ab,
- 0x01ad, 0x01ad,
- 0x01b0, 0x01b0,
- 0x01b4, 0x01b4,
- 0x01b6, 0x01b6,
- 0x01b9, 0x01ba,
- 0x01bd, 0x01bf,
- 0x01c6, 0x01c6,
- 0x01c9, 0x01c9,
- 0x01cc, 0x01cc,
- 0x01ce, 0x01ce,
- 0x01d0, 0x01d0,
- 0x01d2, 0x01d2,
- 0x01d4, 0x01d4,
- 0x01d6, 0x01d6,
- 0x01d8, 0x01d8,
- 0x01da, 0x01da,
- 0x01dc, 0x01dd,
- 0x01df, 0x01df,
- 0x01e1, 0x01e1,
- 0x01e3, 0x01e3,
- 0x01e5, 0x01e5,
- 0x01e7, 0x01e7,
- 0x01e9, 0x01e9,
- 0x01eb, 0x01eb,
- 0x01ed, 0x01ed,
- 0x01ef, 0x01f0,
- 0x01f3, 0x01f3,
- 0x01f5, 0x01f5,
- 0x01f9, 0x01f9,
- 0x01fb, 0x01fb,
- 0x01fd, 0x01fd,
- 0x01ff, 0x01ff,
- 0x0201, 0x0201,
- 0x0203, 0x0203,
- 0x0205, 0x0205,
- 0x0207, 0x0207,
- 0x0209, 0x0209,
- 0x020b, 0x020b,
- 0x020d, 0x020d,
- 0x020f, 0x020f,
- 0x0211, 0x0211,
- 0x0213, 0x0213,
- 0x0215, 0x0215,
- 0x0217, 0x0217,
- 0x0219, 0x0219,
- 0x021b, 0x021b,
- 0x021d, 0x021d,
- 0x021f, 0x021f,
- 0x0221, 0x0221,
- 0x0223, 0x0223,
- 0x0225, 0x0225,
- 0x0227, 0x0227,
- 0x0229, 0x0229,
- 0x022b, 0x022b,
- 0x022d, 0x022d,
- 0x022f, 0x022f,
- 0x0231, 0x0231,
- 0x0233, 0x0239,
- 0x023c, 0x023c,
- 0x023f, 0x0240,
- 0x0242, 0x0242,
- 0x0247, 0x0247,
- 0x0249, 0x0249,
- 0x024b, 0x024b,
- 0x024d, 0x024d,
- 0x024f, 0x0293,
- 0x0295, 0x02b8,
- 0x02c0, 0x02c1,
- 0x02e0, 0x02e4,
- 0x0345, 0x0345,
- 0x0371, 0x0371,
- 0x0373, 0x0373,
- 0x0377, 0x0377,
- 0x037a, 0x037d,
- 0x0390, 0x0390,
- 0x03ac, 0x03ce,
- 0x03d0, 0x03d1,
- 0x03d5, 0x03d7,
- 0x03d9, 0x03d9,
- 0x03db, 0x03db,
- 0x03dd, 0x03dd,
- 0x03df, 0x03df,
- 0x03e1, 0x03e1,
- 0x03e3, 0x03e3,
- 0x03e5, 0x03e5,
- 0x03e7, 0x03e7,
- 0x03e9, 0x03e9,
- 0x03eb, 0x03eb,
- 0x03ed, 0x03ed,
- 0x03ef, 0x03f3,
- 0x03f5, 0x03f5,
- 0x03f8, 0x03f8,
- 0x03fb, 0x03fc,
- 0x0430, 0x045f,
- 0x0461, 0x0461,
- 0x0463, 0x0463,
- 0x0465, 0x0465,
- 0x0467, 0x0467,
- 0x0469, 0x0469,
- 0x046b, 0x046b,
- 0x046d, 0x046d,
- 0x046f, 0x046f,
- 0x0471, 0x0471,
- 0x0473, 0x0473,
- 0x0475, 0x0475,
- 0x0477, 0x0477,
- 0x0479, 0x0479,
- 0x047b, 0x047b,
- 0x047d, 0x047d,
- 0x047f, 0x047f,
- 0x0481, 0x0481,
- 0x048b, 0x048b,
- 0x048d, 0x048d,
- 0x048f, 0x048f,
- 0x0491, 0x0491,
- 0x0493, 0x0493,
- 0x0495, 0x0495,
- 0x0497, 0x0497,
- 0x0499, 0x0499,
- 0x049b, 0x049b,
- 0x049d, 0x049d,
- 0x049f, 0x049f,
- 0x04a1, 0x04a1,
- 0x04a3, 0x04a3,
- 0x04a5, 0x04a5,
- 0x04a7, 0x04a7,
- 0x04a9, 0x04a9,
- 0x04ab, 0x04ab,
- 0x04ad, 0x04ad,
- 0x04af, 0x04af,
- 0x04b1, 0x04b1,
- 0x04b3, 0x04b3,
- 0x04b5, 0x04b5,
- 0x04b7, 0x04b7,
- 0x04b9, 0x04b9,
- 0x04bb, 0x04bb,
- 0x04bd, 0x04bd,
- 0x04bf, 0x04bf,
- 0x04c2, 0x04c2,
- 0x04c4, 0x04c4,
- 0x04c6, 0x04c6,
- 0x04c8, 0x04c8,
- 0x04ca, 0x04ca,
- 0x04cc, 0x04cc,
- 0x04ce, 0x04cf,
- 0x04d1, 0x04d1,
- 0x04d3, 0x04d3,
- 0x04d5, 0x04d5,
- 0x04d7, 0x04d7,
- 0x04d9, 0x04d9,
- 0x04db, 0x04db,
- 0x04dd, 0x04dd,
- 0x04df, 0x04df,
- 0x04e1, 0x04e1,
- 0x04e3, 0x04e3,
- 0x04e5, 0x04e5,
- 0x04e7, 0x04e7,
- 0x04e9, 0x04e9,
- 0x04eb, 0x04eb,
- 0x04ed, 0x04ed,
- 0x04ef, 0x04ef,
- 0x04f1, 0x04f1,
- 0x04f3, 0x04f3,
- 0x04f5, 0x04f5,
- 0x04f7, 0x04f7,
- 0x04f9, 0x04f9,
- 0x04fb, 0x04fb,
- 0x04fd, 0x04fd,
- 0x04ff, 0x04ff,
- 0x0501, 0x0501,
- 0x0503, 0x0503,
- 0x0505, 0x0505,
- 0x0507, 0x0507,
- 0x0509, 0x0509,
- 0x050b, 0x050b,
- 0x050d, 0x050d,
- 0x050f, 0x050f,
- 0x0511, 0x0511,
- 0x0513, 0x0513,
- 0x0515, 0x0515,
- 0x0517, 0x0517,
- 0x0519, 0x0519,
- 0x051b, 0x051b,
- 0x051d, 0x051d,
- 0x051f, 0x051f,
- 0x0521, 0x0521,
- 0x0523, 0x0523,
- 0x0525, 0x0525,
- 0x0527, 0x0527,
- 0x0561, 0x0587,
- 0x1d00, 0x1dbf,
- 0x1e01, 0x1e01,
- 0x1e03, 0x1e03,
- 0x1e05, 0x1e05,
- 0x1e07, 0x1e07,
- 0x1e09, 0x1e09,
- 0x1e0b, 0x1e0b,
- 0x1e0d, 0x1e0d,
- 0x1e0f, 0x1e0f,
- 0x1e11, 0x1e11,
- 0x1e13, 0x1e13,
- 0x1e15, 0x1e15,
- 0x1e17, 0x1e17,
- 0x1e19, 0x1e19,
- 0x1e1b, 0x1e1b,
- 0x1e1d, 0x1e1d,
- 0x1e1f, 0x1e1f,
- 0x1e21, 0x1e21,
- 0x1e23, 0x1e23,
- 0x1e25, 0x1e25,
- 0x1e27, 0x1e27,
- 0x1e29, 0x1e29,
- 0x1e2b, 0x1e2b,
- 0x1e2d, 0x1e2d,
- 0x1e2f, 0x1e2f,
- 0x1e31, 0x1e31,
- 0x1e33, 0x1e33,
- 0x1e35, 0x1e35,
- 0x1e37, 0x1e37,
- 0x1e39, 0x1e39,
- 0x1e3b, 0x1e3b,
- 0x1e3d, 0x1e3d,
- 0x1e3f, 0x1e3f,
- 0x1e41, 0x1e41,
- 0x1e43, 0x1e43,
- 0x1e45, 0x1e45,
- 0x1e47, 0x1e47,
- 0x1e49, 0x1e49,
- 0x1e4b, 0x1e4b,
- 0x1e4d, 0x1e4d,
- 0x1e4f, 0x1e4f,
- 0x1e51, 0x1e51,
- 0x1e53, 0x1e53,
- 0x1e55, 0x1e55,
- 0x1e57, 0x1e57,
- 0x1e59, 0x1e59,
- 0x1e5b, 0x1e5b,
- 0x1e5d, 0x1e5d,
- 0x1e5f, 0x1e5f,
- 0x1e61, 0x1e61,
- 0x1e63, 0x1e63,
- 0x1e65, 0x1e65,
- 0x1e67, 0x1e67,
- 0x1e69, 0x1e69,
- 0x1e6b, 0x1e6b,
- 0x1e6d, 0x1e6d,
- 0x1e6f, 0x1e6f,
- 0x1e71, 0x1e71,
- 0x1e73, 0x1e73,
- 0x1e75, 0x1e75,
- 0x1e77, 0x1e77,
- 0x1e79, 0x1e79,
- 0x1e7b, 0x1e7b,
- 0x1e7d, 0x1e7d,
- 0x1e7f, 0x1e7f,
- 0x1e81, 0x1e81,
- 0x1e83, 0x1e83,
- 0x1e85, 0x1e85,
- 0x1e87, 0x1e87,
- 0x1e89, 0x1e89,
- 0x1e8b, 0x1e8b,
- 0x1e8d, 0x1e8d,
- 0x1e8f, 0x1e8f,
- 0x1e91, 0x1e91,
- 0x1e93, 0x1e93,
- 0x1e95, 0x1e9d,
- 0x1e9f, 0x1e9f,
- 0x1ea1, 0x1ea1,
- 0x1ea3, 0x1ea3,
- 0x1ea5, 0x1ea5,
- 0x1ea7, 0x1ea7,
- 0x1ea9, 0x1ea9,
- 0x1eab, 0x1eab,
- 0x1ead, 0x1ead,
- 0x1eaf, 0x1eaf,
- 0x1eb1, 0x1eb1,
- 0x1eb3, 0x1eb3,
- 0x1eb5, 0x1eb5,
- 0x1eb7, 0x1eb7,
- 0x1eb9, 0x1eb9,
- 0x1ebb, 0x1ebb,
- 0x1ebd, 0x1ebd,
- 0x1ebf, 0x1ebf,
- 0x1ec1, 0x1ec1,
- 0x1ec3, 0x1ec3,
- 0x1ec5, 0x1ec5,
- 0x1ec7, 0x1ec7,
- 0x1ec9, 0x1ec9,
- 0x1ecb, 0x1ecb,
- 0x1ecd, 0x1ecd,
- 0x1ecf, 0x1ecf,
- 0x1ed1, 0x1ed1,
- 0x1ed3, 0x1ed3,
- 0x1ed5, 0x1ed5,
- 0x1ed7, 0x1ed7,
- 0x1ed9, 0x1ed9,
- 0x1edb, 0x1edb,
- 0x1edd, 0x1edd,
- 0x1edf, 0x1edf,
- 0x1ee1, 0x1ee1,
- 0x1ee3, 0x1ee3,
- 0x1ee5, 0x1ee5,
- 0x1ee7, 0x1ee7,
- 0x1ee9, 0x1ee9,
- 0x1eeb, 0x1eeb,
- 0x1eed, 0x1eed,
- 0x1eef, 0x1eef,
- 0x1ef1, 0x1ef1,
- 0x1ef3, 0x1ef3,
- 0x1ef5, 0x1ef5,
- 0x1ef7, 0x1ef7,
- 0x1ef9, 0x1ef9,
- 0x1efb, 0x1efb,
- 0x1efd, 0x1efd,
- 0x1eff, 0x1f07,
- 0x1f10, 0x1f15,
- 0x1f20, 0x1f27,
- 0x1f30, 0x1f37,
- 0x1f40, 0x1f45,
- 0x1f50, 0x1f57,
- 0x1f60, 0x1f67,
- 0x1f70, 0x1f7d,
- 0x1f80, 0x1f87,
- 0x1f90, 0x1f97,
- 0x1fa0, 0x1fa7,
- 0x1fb0, 0x1fb4,
- 0x1fb6, 0x1fb7,
- 0x1fbe, 0x1fbe,
- 0x1fc2, 0x1fc4,
- 0x1fc6, 0x1fc7,
- 0x1fd0, 0x1fd3,
- 0x1fd6, 0x1fd7,
- 0x1fe0, 0x1fe7,
- 0x1ff2, 0x1ff4,
- 0x1ff6, 0x1ff7,
- 0x2090, 0x2094,
- 0x210a, 0x210a,
- 0x210e, 0x210f,
- 0x2113, 0x2113,
- 0x212f, 0x212f,
- 0x2134, 0x2134,
- 0x2139, 0x2139,
- 0x213c, 0x213d,
- 0x2146, 0x2149,
- 0x214e, 0x214e,
- 0x2170, 0x217f,
- 0x2184, 0x2184,
- 0x24d0, 0x24e9,
- 0x2c30, 0x2c5e,
- 0x2c61, 0x2c61,
- 0x2c65, 0x2c66,
- 0x2c68, 0x2c68,
- 0x2c6a, 0x2c6a,
- 0x2c6c, 0x2c6c,
- 0x2c71, 0x2c71,
- 0x2c73, 0x2c74,
- 0x2c76, 0x2c7d,
- 0x2c81, 0x2c81,
- 0x2c83, 0x2c83,
- 0x2c85, 0x2c85,
- 0x2c87, 0x2c87,
- 0x2c89, 0x2c89,
- 0x2c8b, 0x2c8b,
- 0x2c8d, 0x2c8d,
- 0x2c8f, 0x2c8f,
- 0x2c91, 0x2c91,
- 0x2c93, 0x2c93,
- 0x2c95, 0x2c95,
- 0x2c97, 0x2c97,
- 0x2c99, 0x2c99,
- 0x2c9b, 0x2c9b,
- 0x2c9d, 0x2c9d,
- 0x2c9f, 0x2c9f,
- 0x2ca1, 0x2ca1,
- 0x2ca3, 0x2ca3,
- 0x2ca5, 0x2ca5,
- 0x2ca7, 0x2ca7,
- 0x2ca9, 0x2ca9,
- 0x2cab, 0x2cab,
- 0x2cad, 0x2cad,
- 0x2caf, 0x2caf,
- 0x2cb1, 0x2cb1,
- 0x2cb3, 0x2cb3,
- 0x2cb5, 0x2cb5,
- 0x2cb7, 0x2cb7,
- 0x2cb9, 0x2cb9,
- 0x2cbb, 0x2cbb,
- 0x2cbd, 0x2cbd,
- 0x2cbf, 0x2cbf,
- 0x2cc1, 0x2cc1,
- 0x2cc3, 0x2cc3,
- 0x2cc5, 0x2cc5,
- 0x2cc7, 0x2cc7,
- 0x2cc9, 0x2cc9,
- 0x2ccb, 0x2ccb,
- 0x2ccd, 0x2ccd,
- 0x2ccf, 0x2ccf,
- 0x2cd1, 0x2cd1,
- 0x2cd3, 0x2cd3,
- 0x2cd5, 0x2cd5,
- 0x2cd7, 0x2cd7,
- 0x2cd9, 0x2cd9,
- 0x2cdb, 0x2cdb,
- 0x2cdd, 0x2cdd,
- 0x2cdf, 0x2cdf,
- 0x2ce1, 0x2ce1,
- 0x2ce3, 0x2ce4,
- 0x2cec, 0x2cec,
- 0x2cee, 0x2cee,
- 0x2d00, 0x2d25,
- 0xa641, 0xa641,
- 0xa643, 0xa643,
- 0xa645, 0xa645,
- 0xa647, 0xa647,
- 0xa649, 0xa649,
- 0xa64b, 0xa64b,
- 0xa64d, 0xa64d,
- 0xa64f, 0xa64f,
- 0xa651, 0xa651,
- 0xa653, 0xa653,
- 0xa655, 0xa655,
- 0xa657, 0xa657,
- 0xa659, 0xa659,
- 0xa65b, 0xa65b,
- 0xa65d, 0xa65d,
- 0xa65f, 0xa65f,
- 0xa661, 0xa661,
- 0xa663, 0xa663,
- 0xa665, 0xa665,
- 0xa667, 0xa667,
- 0xa669, 0xa669,
- 0xa66b, 0xa66b,
- 0xa66d, 0xa66d,
- 0xa681, 0xa681,
- 0xa683, 0xa683,
- 0xa685, 0xa685,
- 0xa687, 0xa687,
- 0xa689, 0xa689,
- 0xa68b, 0xa68b,
- 0xa68d, 0xa68d,
- 0xa68f, 0xa68f,
- 0xa691, 0xa691,
- 0xa693, 0xa693,
- 0xa695, 0xa695,
- 0xa697, 0xa697,
- 0xa723, 0xa723,
- 0xa725, 0xa725,
- 0xa727, 0xa727,
- 0xa729, 0xa729,
- 0xa72b, 0xa72b,
- 0xa72d, 0xa72d,
- 0xa72f, 0xa731,
- 0xa733, 0xa733,
- 0xa735, 0xa735,
- 0xa737, 0xa737,
- 0xa739, 0xa739,
- 0xa73b, 0xa73b,
- 0xa73d, 0xa73d,
- 0xa73f, 0xa73f,
- 0xa741, 0xa741,
- 0xa743, 0xa743,
- 0xa745, 0xa745,
- 0xa747, 0xa747,
- 0xa749, 0xa749,
- 0xa74b, 0xa74b,
- 0xa74d, 0xa74d,
- 0xa74f, 0xa74f,
- 0xa751, 0xa751,
- 0xa753, 0xa753,
- 0xa755, 0xa755,
- 0xa757, 0xa757,
- 0xa759, 0xa759,
- 0xa75b, 0xa75b,
- 0xa75d, 0xa75d,
- 0xa75f, 0xa75f,
- 0xa761, 0xa761,
- 0xa763, 0xa763,
- 0xa765, 0xa765,
- 0xa767, 0xa767,
- 0xa769, 0xa769,
- 0xa76b, 0xa76b,
- 0xa76d, 0xa76d,
- 0xa76f, 0xa778,
- 0xa77a, 0xa77a,
- 0xa77c, 0xa77c,
- 0xa77f, 0xa77f,
- 0xa781, 0xa781,
- 0xa783, 0xa783,
- 0xa785, 0xa785,
- 0xa787, 0xa787,
- 0xa78c, 0xa78c,
- 0xa78e, 0xa78e,
- 0xa791, 0xa791,
- 0xa7a1, 0xa7a1,
- 0xa7a3, 0xa7a3,
- 0xa7a5, 0xa7a5,
- 0xa7a7, 0xa7a7,
- 0xa7a9, 0xa7a9,
- 0xa7fa, 0xa7fa,
- 0xfb00, 0xfb06,
- 0xfb13, 0xfb17,
- 0xff41, 0xff5a,
- 0x10428, 0x1044f,
- 0x1d41a, 0x1d433,
- 0x1d44e, 0x1d454,
- 0x1d456, 0x1d467,
- 0x1d482, 0x1d49b,
- 0x1d4b6, 0x1d4b9,
- 0x1d4bb, 0x1d4bb,
- 0x1d4bd, 0x1d4c3,
- 0x1d4c5, 0x1d4cf,
- 0x1d4ea, 0x1d503,
- 0x1d51e, 0x1d537,
- 0x1d552, 0x1d56b,
- 0x1d586, 0x1d59f,
- 0x1d5ba, 0x1d5d3,
- 0x1d5ee, 0x1d607,
- 0x1d622, 0x1d63b,
- 0x1d656, 0x1d66f,
- 0x1d68a, 0x1d6a5,
- 0x1d6c2, 0x1d6da,
- 0x1d6dc, 0x1d6e1,
- 0x1d6fc, 0x1d714,
- 0x1d716, 0x1d71b,
- 0x1d736, 0x1d74e,
- 0x1d750, 0x1d755,
- 0x1d770, 0x1d788,
- 0x1d78a, 0x1d78f,
- 0x1d7aa, 0x1d7c2,
- 0x1d7c4, 0x1d7c9,
- 0x1d7cb, 0x1d7cb,
-}; /* CR_Lowercase */
+#define CR_Lowercase CR_Lower
/* 'Uppercase': Derived Property */
-static const OnigCodePoint CR_Uppercase[] = {
- 605,
- 0x0041, 0x005a,
- 0x00c0, 0x00d6,
- 0x00d8, 0x00de,
- 0x0100, 0x0100,
- 0x0102, 0x0102,
- 0x0104, 0x0104,
- 0x0106, 0x0106,
- 0x0108, 0x0108,
- 0x010a, 0x010a,
- 0x010c, 0x010c,
- 0x010e, 0x010e,
- 0x0110, 0x0110,
- 0x0112, 0x0112,
- 0x0114, 0x0114,
- 0x0116, 0x0116,
- 0x0118, 0x0118,
- 0x011a, 0x011a,
- 0x011c, 0x011c,
- 0x011e, 0x011e,
- 0x0120, 0x0120,
- 0x0122, 0x0122,
- 0x0124, 0x0124,
- 0x0126, 0x0126,
- 0x0128, 0x0128,
- 0x012a, 0x012a,
- 0x012c, 0x012c,
- 0x012e, 0x012e,
- 0x0130, 0x0130,
- 0x0132, 0x0132,
- 0x0134, 0x0134,
- 0x0136, 0x0136,
- 0x0139, 0x0139,
- 0x013b, 0x013b,
- 0x013d, 0x013d,
- 0x013f, 0x013f,
- 0x0141, 0x0141,
- 0x0143, 0x0143,
- 0x0145, 0x0145,
- 0x0147, 0x0147,
- 0x014a, 0x014a,
- 0x014c, 0x014c,
- 0x014e, 0x014e,
- 0x0150, 0x0150,
- 0x0152, 0x0152,
- 0x0154, 0x0154,
- 0x0156, 0x0156,
- 0x0158, 0x0158,
- 0x015a, 0x015a,
- 0x015c, 0x015c,
- 0x015e, 0x015e,
- 0x0160, 0x0160,
- 0x0162, 0x0162,
- 0x0164, 0x0164,
- 0x0166, 0x0166,
- 0x0168, 0x0168,
- 0x016a, 0x016a,
- 0x016c, 0x016c,
- 0x016e, 0x016e,
- 0x0170, 0x0170,
- 0x0172, 0x0172,
- 0x0174, 0x0174,
- 0x0176, 0x0176,
- 0x0178, 0x0179,
- 0x017b, 0x017b,
- 0x017d, 0x017d,
- 0x0181, 0x0182,
- 0x0184, 0x0184,
- 0x0186, 0x0187,
- 0x0189, 0x018b,
- 0x018e, 0x0191,
- 0x0193, 0x0194,
- 0x0196, 0x0198,
- 0x019c, 0x019d,
- 0x019f, 0x01a0,
- 0x01a2, 0x01a2,
- 0x01a4, 0x01a4,
- 0x01a6, 0x01a7,
- 0x01a9, 0x01a9,
- 0x01ac, 0x01ac,
- 0x01ae, 0x01af,
- 0x01b1, 0x01b3,
- 0x01b5, 0x01b5,
- 0x01b7, 0x01b8,
- 0x01bc, 0x01bc,
- 0x01c4, 0x01c4,
- 0x01c7, 0x01c7,
- 0x01ca, 0x01ca,
- 0x01cd, 0x01cd,
- 0x01cf, 0x01cf,
- 0x01d1, 0x01d1,
- 0x01d3, 0x01d3,
- 0x01d5, 0x01d5,
- 0x01d7, 0x01d7,
- 0x01d9, 0x01d9,
- 0x01db, 0x01db,
- 0x01de, 0x01de,
- 0x01e0, 0x01e0,
- 0x01e2, 0x01e2,
- 0x01e4, 0x01e4,
- 0x01e6, 0x01e6,
- 0x01e8, 0x01e8,
- 0x01ea, 0x01ea,
- 0x01ec, 0x01ec,
- 0x01ee, 0x01ee,
- 0x01f1, 0x01f1,
- 0x01f4, 0x01f4,
- 0x01f6, 0x01f8,
- 0x01fa, 0x01fa,
- 0x01fc, 0x01fc,
- 0x01fe, 0x01fe,
- 0x0200, 0x0200,
- 0x0202, 0x0202,
- 0x0204, 0x0204,
- 0x0206, 0x0206,
- 0x0208, 0x0208,
- 0x020a, 0x020a,
- 0x020c, 0x020c,
- 0x020e, 0x020e,
- 0x0210, 0x0210,
- 0x0212, 0x0212,
- 0x0214, 0x0214,
- 0x0216, 0x0216,
- 0x0218, 0x0218,
- 0x021a, 0x021a,
- 0x021c, 0x021c,
- 0x021e, 0x021e,
- 0x0220, 0x0220,
- 0x0222, 0x0222,
- 0x0224, 0x0224,
- 0x0226, 0x0226,
- 0x0228, 0x0228,
- 0x022a, 0x022a,
- 0x022c, 0x022c,
- 0x022e, 0x022e,
- 0x0230, 0x0230,
- 0x0232, 0x0232,
- 0x023a, 0x023b,
- 0x023d, 0x023e,
- 0x0241, 0x0241,
- 0x0243, 0x0246,
- 0x0248, 0x0248,
- 0x024a, 0x024a,
- 0x024c, 0x024c,
- 0x024e, 0x024e,
- 0x0370, 0x0370,
- 0x0372, 0x0372,
- 0x0376, 0x0376,
- 0x0386, 0x0386,
- 0x0388, 0x038a,
- 0x038c, 0x038c,
- 0x038e, 0x038f,
- 0x0391, 0x03a1,
- 0x03a3, 0x03ab,
- 0x03cf, 0x03cf,
- 0x03d2, 0x03d4,
- 0x03d8, 0x03d8,
- 0x03da, 0x03da,
- 0x03dc, 0x03dc,
- 0x03de, 0x03de,
- 0x03e0, 0x03e0,
- 0x03e2, 0x03e2,
- 0x03e4, 0x03e4,
- 0x03e6, 0x03e6,
- 0x03e8, 0x03e8,
- 0x03ea, 0x03ea,
- 0x03ec, 0x03ec,
- 0x03ee, 0x03ee,
- 0x03f4, 0x03f4,
- 0x03f7, 0x03f7,
- 0x03f9, 0x03fa,
- 0x03fd, 0x042f,
- 0x0460, 0x0460,
- 0x0462, 0x0462,
- 0x0464, 0x0464,
- 0x0466, 0x0466,
- 0x0468, 0x0468,
- 0x046a, 0x046a,
- 0x046c, 0x046c,
- 0x046e, 0x046e,
- 0x0470, 0x0470,
- 0x0472, 0x0472,
- 0x0474, 0x0474,
- 0x0476, 0x0476,
- 0x0478, 0x0478,
- 0x047a, 0x047a,
- 0x047c, 0x047c,
- 0x047e, 0x047e,
- 0x0480, 0x0480,
- 0x048a, 0x048a,
- 0x048c, 0x048c,
- 0x048e, 0x048e,
- 0x0490, 0x0490,
- 0x0492, 0x0492,
- 0x0494, 0x0494,
- 0x0496, 0x0496,
- 0x0498, 0x0498,
- 0x049a, 0x049a,
- 0x049c, 0x049c,
- 0x049e, 0x049e,
- 0x04a0, 0x04a0,
- 0x04a2, 0x04a2,
- 0x04a4, 0x04a4,
- 0x04a6, 0x04a6,
- 0x04a8, 0x04a8,
- 0x04aa, 0x04aa,
- 0x04ac, 0x04ac,
- 0x04ae, 0x04ae,
- 0x04b0, 0x04b0,
- 0x04b2, 0x04b2,
- 0x04b4, 0x04b4,
- 0x04b6, 0x04b6,
- 0x04b8, 0x04b8,
- 0x04ba, 0x04ba,
- 0x04bc, 0x04bc,
- 0x04be, 0x04be,
- 0x04c0, 0x04c1,
- 0x04c3, 0x04c3,
- 0x04c5, 0x04c5,
- 0x04c7, 0x04c7,
- 0x04c9, 0x04c9,
- 0x04cb, 0x04cb,
- 0x04cd, 0x04cd,
- 0x04d0, 0x04d0,
- 0x04d2, 0x04d2,
- 0x04d4, 0x04d4,
- 0x04d6, 0x04d6,
- 0x04d8, 0x04d8,
- 0x04da, 0x04da,
- 0x04dc, 0x04dc,
- 0x04de, 0x04de,
- 0x04e0, 0x04e0,
- 0x04e2, 0x04e2,
- 0x04e4, 0x04e4,
- 0x04e6, 0x04e6,
- 0x04e8, 0x04e8,
- 0x04ea, 0x04ea,
- 0x04ec, 0x04ec,
- 0x04ee, 0x04ee,
- 0x04f0, 0x04f0,
- 0x04f2, 0x04f2,
- 0x04f4, 0x04f4,
- 0x04f6, 0x04f6,
- 0x04f8, 0x04f8,
- 0x04fa, 0x04fa,
- 0x04fc, 0x04fc,
- 0x04fe, 0x04fe,
- 0x0500, 0x0500,
- 0x0502, 0x0502,
- 0x0504, 0x0504,
- 0x0506, 0x0506,
- 0x0508, 0x0508,
- 0x050a, 0x050a,
- 0x050c, 0x050c,
- 0x050e, 0x050e,
- 0x0510, 0x0510,
- 0x0512, 0x0512,
- 0x0514, 0x0514,
- 0x0516, 0x0516,
- 0x0518, 0x0518,
- 0x051a, 0x051a,
- 0x051c, 0x051c,
- 0x051e, 0x051e,
- 0x0520, 0x0520,
- 0x0522, 0x0522,
- 0x0524, 0x0524,
- 0x0526, 0x0526,
- 0x0531, 0x0556,
- 0x10a0, 0x10c5,
- 0x1e00, 0x1e00,
- 0x1e02, 0x1e02,
- 0x1e04, 0x1e04,
- 0x1e06, 0x1e06,
- 0x1e08, 0x1e08,
- 0x1e0a, 0x1e0a,
- 0x1e0c, 0x1e0c,
- 0x1e0e, 0x1e0e,
- 0x1e10, 0x1e10,
- 0x1e12, 0x1e12,
- 0x1e14, 0x1e14,
- 0x1e16, 0x1e16,
- 0x1e18, 0x1e18,
- 0x1e1a, 0x1e1a,
- 0x1e1c, 0x1e1c,
- 0x1e1e, 0x1e1e,
- 0x1e20, 0x1e20,
- 0x1e22, 0x1e22,
- 0x1e24, 0x1e24,
- 0x1e26, 0x1e26,
- 0x1e28, 0x1e28,
- 0x1e2a, 0x1e2a,
- 0x1e2c, 0x1e2c,
- 0x1e2e, 0x1e2e,
- 0x1e30, 0x1e30,
- 0x1e32, 0x1e32,
- 0x1e34, 0x1e34,
- 0x1e36, 0x1e36,
- 0x1e38, 0x1e38,
- 0x1e3a, 0x1e3a,
- 0x1e3c, 0x1e3c,
- 0x1e3e, 0x1e3e,
- 0x1e40, 0x1e40,
- 0x1e42, 0x1e42,
- 0x1e44, 0x1e44,
- 0x1e46, 0x1e46,
- 0x1e48, 0x1e48,
- 0x1e4a, 0x1e4a,
- 0x1e4c, 0x1e4c,
- 0x1e4e, 0x1e4e,
- 0x1e50, 0x1e50,
- 0x1e52, 0x1e52,
- 0x1e54, 0x1e54,
- 0x1e56, 0x1e56,
- 0x1e58, 0x1e58,
- 0x1e5a, 0x1e5a,
- 0x1e5c, 0x1e5c,
- 0x1e5e, 0x1e5e,
- 0x1e60, 0x1e60,
- 0x1e62, 0x1e62,
- 0x1e64, 0x1e64,
- 0x1e66, 0x1e66,
- 0x1e68, 0x1e68,
- 0x1e6a, 0x1e6a,
- 0x1e6c, 0x1e6c,
- 0x1e6e, 0x1e6e,
- 0x1e70, 0x1e70,
- 0x1e72, 0x1e72,
- 0x1e74, 0x1e74,
- 0x1e76, 0x1e76,
- 0x1e78, 0x1e78,
- 0x1e7a, 0x1e7a,
- 0x1e7c, 0x1e7c,
- 0x1e7e, 0x1e7e,
- 0x1e80, 0x1e80,
- 0x1e82, 0x1e82,
- 0x1e84, 0x1e84,
- 0x1e86, 0x1e86,
- 0x1e88, 0x1e88,
- 0x1e8a, 0x1e8a,
- 0x1e8c, 0x1e8c,
- 0x1e8e, 0x1e8e,
- 0x1e90, 0x1e90,
- 0x1e92, 0x1e92,
- 0x1e94, 0x1e94,
- 0x1e9e, 0x1e9e,
- 0x1ea0, 0x1ea0,
- 0x1ea2, 0x1ea2,
- 0x1ea4, 0x1ea4,
- 0x1ea6, 0x1ea6,
- 0x1ea8, 0x1ea8,
- 0x1eaa, 0x1eaa,
- 0x1eac, 0x1eac,
- 0x1eae, 0x1eae,
- 0x1eb0, 0x1eb0,
- 0x1eb2, 0x1eb2,
- 0x1eb4, 0x1eb4,
- 0x1eb6, 0x1eb6,
- 0x1eb8, 0x1eb8,
- 0x1eba, 0x1eba,
- 0x1ebc, 0x1ebc,
- 0x1ebe, 0x1ebe,
- 0x1ec0, 0x1ec0,
- 0x1ec2, 0x1ec2,
- 0x1ec4, 0x1ec4,
- 0x1ec6, 0x1ec6,
- 0x1ec8, 0x1ec8,
- 0x1eca, 0x1eca,
- 0x1ecc, 0x1ecc,
- 0x1ece, 0x1ece,
- 0x1ed0, 0x1ed0,
- 0x1ed2, 0x1ed2,
- 0x1ed4, 0x1ed4,
- 0x1ed6, 0x1ed6,
- 0x1ed8, 0x1ed8,
- 0x1eda, 0x1eda,
- 0x1edc, 0x1edc,
- 0x1ede, 0x1ede,
- 0x1ee0, 0x1ee0,
- 0x1ee2, 0x1ee2,
- 0x1ee4, 0x1ee4,
- 0x1ee6, 0x1ee6,
- 0x1ee8, 0x1ee8,
- 0x1eea, 0x1eea,
- 0x1eec, 0x1eec,
- 0x1eee, 0x1eee,
- 0x1ef0, 0x1ef0,
- 0x1ef2, 0x1ef2,
- 0x1ef4, 0x1ef4,
- 0x1ef6, 0x1ef6,
- 0x1ef8, 0x1ef8,
- 0x1efa, 0x1efa,
- 0x1efc, 0x1efc,
- 0x1efe, 0x1efe,
- 0x1f08, 0x1f0f,
- 0x1f18, 0x1f1d,
- 0x1f28, 0x1f2f,
- 0x1f38, 0x1f3f,
- 0x1f48, 0x1f4d,
- 0x1f59, 0x1f59,
- 0x1f5b, 0x1f5b,
- 0x1f5d, 0x1f5d,
- 0x1f5f, 0x1f5f,
- 0x1f68, 0x1f6f,
- 0x1fb8, 0x1fbb,
- 0x1fc8, 0x1fcb,
- 0x1fd8, 0x1fdb,
- 0x1fe8, 0x1fec,
- 0x1ff8, 0x1ffb,
- 0x2102, 0x2102,
- 0x2107, 0x2107,
- 0x210b, 0x210d,
- 0x2110, 0x2112,
- 0x2115, 0x2115,
- 0x2119, 0x211d,
- 0x2124, 0x2124,
- 0x2126, 0x2126,
- 0x2128, 0x2128,
- 0x212a, 0x212d,
- 0x2130, 0x2133,
- 0x213e, 0x213f,
- 0x2145, 0x2145,
- 0x2160, 0x216f,
- 0x2183, 0x2183,
- 0x24b6, 0x24cf,
- 0x2c00, 0x2c2e,
- 0x2c60, 0x2c60,
- 0x2c62, 0x2c64,
- 0x2c67, 0x2c67,
- 0x2c69, 0x2c69,
- 0x2c6b, 0x2c6b,
- 0x2c6d, 0x2c70,
- 0x2c72, 0x2c72,
- 0x2c75, 0x2c75,
- 0x2c7e, 0x2c80,
- 0x2c82, 0x2c82,
- 0x2c84, 0x2c84,
- 0x2c86, 0x2c86,
- 0x2c88, 0x2c88,
- 0x2c8a, 0x2c8a,
- 0x2c8c, 0x2c8c,
- 0x2c8e, 0x2c8e,
- 0x2c90, 0x2c90,
- 0x2c92, 0x2c92,
- 0x2c94, 0x2c94,
- 0x2c96, 0x2c96,
- 0x2c98, 0x2c98,
- 0x2c9a, 0x2c9a,
- 0x2c9c, 0x2c9c,
- 0x2c9e, 0x2c9e,
- 0x2ca0, 0x2ca0,
- 0x2ca2, 0x2ca2,
- 0x2ca4, 0x2ca4,
- 0x2ca6, 0x2ca6,
- 0x2ca8, 0x2ca8,
- 0x2caa, 0x2caa,
- 0x2cac, 0x2cac,
- 0x2cae, 0x2cae,
- 0x2cb0, 0x2cb0,
- 0x2cb2, 0x2cb2,
- 0x2cb4, 0x2cb4,
- 0x2cb6, 0x2cb6,
- 0x2cb8, 0x2cb8,
- 0x2cba, 0x2cba,
- 0x2cbc, 0x2cbc,
- 0x2cbe, 0x2cbe,
- 0x2cc0, 0x2cc0,
- 0x2cc2, 0x2cc2,
- 0x2cc4, 0x2cc4,
- 0x2cc6, 0x2cc6,
- 0x2cc8, 0x2cc8,
- 0x2cca, 0x2cca,
- 0x2ccc, 0x2ccc,
- 0x2cce, 0x2cce,
- 0x2cd0, 0x2cd0,
- 0x2cd2, 0x2cd2,
- 0x2cd4, 0x2cd4,
- 0x2cd6, 0x2cd6,
- 0x2cd8, 0x2cd8,
- 0x2cda, 0x2cda,
- 0x2cdc, 0x2cdc,
- 0x2cde, 0x2cde,
- 0x2ce0, 0x2ce0,
- 0x2ce2, 0x2ce2,
- 0x2ceb, 0x2ceb,
- 0x2ced, 0x2ced,
- 0xa640, 0xa640,
- 0xa642, 0xa642,
- 0xa644, 0xa644,
- 0xa646, 0xa646,
- 0xa648, 0xa648,
- 0xa64a, 0xa64a,
- 0xa64c, 0xa64c,
- 0xa64e, 0xa64e,
- 0xa650, 0xa650,
- 0xa652, 0xa652,
- 0xa654, 0xa654,
- 0xa656, 0xa656,
- 0xa658, 0xa658,
- 0xa65a, 0xa65a,
- 0xa65c, 0xa65c,
- 0xa65e, 0xa65e,
- 0xa660, 0xa660,
- 0xa662, 0xa662,
- 0xa664, 0xa664,
- 0xa666, 0xa666,
- 0xa668, 0xa668,
- 0xa66a, 0xa66a,
- 0xa66c, 0xa66c,
- 0xa680, 0xa680,
- 0xa682, 0xa682,
- 0xa684, 0xa684,
- 0xa686, 0xa686,
- 0xa688, 0xa688,
- 0xa68a, 0xa68a,
- 0xa68c, 0xa68c,
- 0xa68e, 0xa68e,
- 0xa690, 0xa690,
- 0xa692, 0xa692,
- 0xa694, 0xa694,
- 0xa696, 0xa696,
- 0xa722, 0xa722,
- 0xa724, 0xa724,
- 0xa726, 0xa726,
- 0xa728, 0xa728,
- 0xa72a, 0xa72a,
- 0xa72c, 0xa72c,
- 0xa72e, 0xa72e,
- 0xa732, 0xa732,
- 0xa734, 0xa734,
- 0xa736, 0xa736,
- 0xa738, 0xa738,
- 0xa73a, 0xa73a,
- 0xa73c, 0xa73c,
- 0xa73e, 0xa73e,
- 0xa740, 0xa740,
- 0xa742, 0xa742,
- 0xa744, 0xa744,
- 0xa746, 0xa746,
- 0xa748, 0xa748,
- 0xa74a, 0xa74a,
- 0xa74c, 0xa74c,
- 0xa74e, 0xa74e,
- 0xa750, 0xa750,
- 0xa752, 0xa752,
- 0xa754, 0xa754,
- 0xa756, 0xa756,
- 0xa758, 0xa758,
- 0xa75a, 0xa75a,
- 0xa75c, 0xa75c,
- 0xa75e, 0xa75e,
- 0xa760, 0xa760,
- 0xa762, 0xa762,
- 0xa764, 0xa764,
- 0xa766, 0xa766,
- 0xa768, 0xa768,
- 0xa76a, 0xa76a,
- 0xa76c, 0xa76c,
- 0xa76e, 0xa76e,
- 0xa779, 0xa779,
- 0xa77b, 0xa77b,
- 0xa77d, 0xa77e,
- 0xa780, 0xa780,
- 0xa782, 0xa782,
- 0xa784, 0xa784,
- 0xa786, 0xa786,
- 0xa78b, 0xa78b,
- 0xa78d, 0xa78d,
- 0xa790, 0xa790,
- 0xa7a0, 0xa7a0,
- 0xa7a2, 0xa7a2,
- 0xa7a4, 0xa7a4,
- 0xa7a6, 0xa7a6,
- 0xa7a8, 0xa7a8,
- 0xff21, 0xff3a,
- 0x10400, 0x10427,
- 0x1d400, 0x1d419,
- 0x1d434, 0x1d44d,
- 0x1d468, 0x1d481,
- 0x1d49c, 0x1d49c,
- 0x1d49e, 0x1d49f,
- 0x1d4a2, 0x1d4a2,
- 0x1d4a5, 0x1d4a6,
- 0x1d4a9, 0x1d4ac,
- 0x1d4ae, 0x1d4b5,
- 0x1d4d0, 0x1d4e9,
- 0x1d504, 0x1d505,
- 0x1d507, 0x1d50a,
- 0x1d50d, 0x1d514,
- 0x1d516, 0x1d51c,
- 0x1d538, 0x1d539,
- 0x1d53b, 0x1d53e,
- 0x1d540, 0x1d544,
- 0x1d546, 0x1d546,
- 0x1d54a, 0x1d550,
- 0x1d56c, 0x1d585,
- 0x1d5a0, 0x1d5b9,
- 0x1d5d4, 0x1d5ed,
- 0x1d608, 0x1d621,
- 0x1d63c, 0x1d655,
- 0x1d670, 0x1d689,
- 0x1d6a8, 0x1d6c0,
- 0x1d6e2, 0x1d6fa,
- 0x1d71c, 0x1d734,
- 0x1d756, 0x1d76e,
- 0x1d790, 0x1d7a8,
- 0x1d7ca, 0x1d7ca,
-}; /* CR_Uppercase */
+#define CR_Uppercase CR_Upper
/* 'Cased': Derived Property */
static const OnigCodePoint CR_Cased[] = {
- 112,
+ 119,
0x0041, 0x005a,
0x0061, 0x007a,
0x00aa, 0x00aa,
@@ -6797,6 +10064,8 @@ static const OnigCodePoint CR_Cased[] = {
0x0531, 0x0556,
0x0561, 0x0587,
0x10a0, 0x10c5,
+ 0x10c7, 0x10c7,
+ 0x10cd, 0x10cd,
0x1d00, 0x1dbf,
0x1e00, 0x1f15,
0x1f18, 0x1f1d,
@@ -6817,7 +10086,9 @@ static const OnigCodePoint CR_Cased[] = {
0x1fe0, 0x1fec,
0x1ff2, 0x1ff4,
0x1ff6, 0x1ffc,
- 0x2090, 0x2094,
+ 0x2071, 0x2071,
+ 0x207f, 0x207f,
+ 0x2090, 0x209c,
0x2102, 0x2102,
0x2107, 0x2107,
0x210a, 0x2113,
@@ -6839,14 +10110,17 @@ static const OnigCodePoint CR_Cased[] = {
0x2c30, 0x2c5e,
0x2c60, 0x2ce4,
0x2ceb, 0x2cee,
+ 0x2cf2, 0x2cf3,
0x2d00, 0x2d25,
+ 0x2d27, 0x2d27,
+ 0x2d2d, 0x2d2d,
0xa640, 0xa66d,
0xa680, 0xa697,
0xa722, 0xa787,
0xa78b, 0xa78e,
- 0xa790, 0xa791,
- 0xa7a0, 0xa7a9,
- 0xa7fa, 0xa7fa,
+ 0xa790, 0xa793,
+ 0xa7a0, 0xa7aa,
+ 0xa7f8, 0xa7fa,
0xfb00, 0xfb06,
0xfb13, 0xfb17,
0xff21, 0xff3a,
@@ -6886,7 +10160,7 @@ static const OnigCodePoint CR_Cased[] = {
/* 'Case_Ignorable': Derived Property */
static const OnigCodePoint CR_Case_Ignorable[] = {
- 277,
+ 295,
0x0027, 0x0027,
0x002e, 0x002e,
0x003a, 0x003a,
@@ -6910,7 +10184,7 @@ static const OnigCodePoint CR_Case_Ignorable[] = {
0x05c4, 0x05c5,
0x05c7, 0x05c7,
0x05f4, 0x05f4,
- 0x0600, 0x0603,
+ 0x0600, 0x0604,
0x0610, 0x061a,
0x0640, 0x0640,
0x064b, 0x065f,
@@ -6926,6 +10200,7 @@ static const OnigCodePoint CR_Case_Ignorable[] = {
0x07fa, 0x07fa,
0x0816, 0x082d,
0x0859, 0x085b,
+ 0x08e4, 0x08fe,
0x0900, 0x0902,
0x093a, 0x093a,
0x093c, 0x093c,
@@ -7045,6 +10320,7 @@ static const OnigCodePoint CR_Case_Ignorable[] = {
0x1b80, 0x1b81,
0x1ba2, 0x1ba5,
0x1ba8, 0x1ba9,
+ 0x1bab, 0x1bab,
0x1be6, 0x1be6,
0x1be8, 0x1be9,
0x1bed, 0x1bed,
@@ -7056,7 +10332,8 @@ static const OnigCodePoint CR_Case_Ignorable[] = {
0x1cd4, 0x1ce0,
0x1ce2, 0x1ce8,
0x1ced, 0x1ced,
- 0x1d2c, 0x1d61,
+ 0x1cf4, 0x1cf4,
+ 0x1d2c, 0x1d6a,
0x1d78, 0x1d78,
0x1d9b, 0x1de6,
0x1dfc, 0x1dff,
@@ -7077,14 +10354,14 @@ static const OnigCodePoint CR_Case_Ignorable[] = {
0x207f, 0x207f,
0x2090, 0x209c,
0x20d0, 0x20f0,
- 0x2c7d, 0x2c7d,
+ 0x2c7c, 0x2c7d,
0x2cef, 0x2cf1,
0x2d6f, 0x2d6f,
0x2d7f, 0x2d7f,
0x2de0, 0x2dff,
0x2e2f, 0x2e2f,
0x3005, 0x3005,
- 0x302a, 0x302f,
+ 0x302a, 0x302d,
0x3031, 0x3035,
0x303b, 0x303b,
0x3099, 0x309e,
@@ -7093,12 +10370,14 @@ static const OnigCodePoint CR_Case_Ignorable[] = {
0xa4f8, 0xa4fd,
0xa60c, 0xa60c,
0xa66f, 0xa672,
- 0xa67c, 0xa67d,
+ 0xa674, 0xa67d,
0xa67f, 0xa67f,
+ 0xa69f, 0xa69f,
0xa6f0, 0xa6f1,
0xa700, 0xa721,
0xa770, 0xa770,
0xa788, 0xa78a,
+ 0xa7f8, 0xa7f9,
0xa802, 0xa802,
0xa806, 0xa806,
0xa80b, 0xa80b,
@@ -7124,6 +10403,9 @@ static const OnigCodePoint CR_Case_Ignorable[] = {
0xaabe, 0xaabf,
0xaac1, 0xaac1,
0xaadd, 0xaadd,
+ 0xaaec, 0xaaed,
+ 0xaaf3, 0xaaf4,
+ 0xaaf6, 0xaaf6,
0xabe5, 0xabe5,
0xabe8, 0xabe8,
0xabed, 0xabed,
@@ -7156,6 +10438,16 @@ static const OnigCodePoint CR_Case_Ignorable[] = {
0x110b3, 0x110b6,
0x110b9, 0x110ba,
0x110bd, 0x110bd,
+ 0x11100, 0x11102,
+ 0x11127, 0x1112b,
+ 0x1112d, 0x11134,
+ 0x11180, 0x11181,
+ 0x111b6, 0x111be,
+ 0x116ab, 0x116ab,
+ 0x116ad, 0x116ad,
+ 0x116b0, 0x116b5,
+ 0x116b7, 0x116b7,
+ 0x16f8f, 0x16f9f,
0x1d167, 0x1d169,
0x1d173, 0x1d182,
0x1d185, 0x1d18b,
@@ -7168,7 +10460,7 @@ static const OnigCodePoint CR_Case_Ignorable[] = {
/* 'Changes_When_Lowercased': Derived Property */
static const OnigCodePoint CR_Changes_When_Lowercased[] = {
- 566,
+ 571,
0x0041, 0x005a,
0x00c0, 0x00d6,
0x00d8, 0x00de,
@@ -7436,6 +10728,8 @@ static const OnigCodePoint CR_Changes_When_Lowercased[] = {
0x0526, 0x0526,
0x0531, 0x0556,
0x10a0, 0x10c5,
+ 0x10c7, 0x10c7,
+ 0x10cd, 0x10cd,
0x1e00, 0x1e00,
0x1e02, 0x1e02,
0x1e04, 0x1e04,
@@ -7645,6 +10939,7 @@ static const OnigCodePoint CR_Changes_When_Lowercased[] = {
0x2ce2, 0x2ce2,
0x2ceb, 0x2ceb,
0x2ced, 0x2ced,
+ 0x2cf2, 0x2cf2,
0xa640, 0xa640,
0xa642, 0xa642,
0xa644, 0xa644,
@@ -7728,18 +11023,20 @@ static const OnigCodePoint CR_Changes_When_Lowercased[] = {
0xa78b, 0xa78b,
0xa78d, 0xa78d,
0xa790, 0xa790,
+ 0xa792, 0xa792,
0xa7a0, 0xa7a0,
0xa7a2, 0xa7a2,
0xa7a4, 0xa7a4,
0xa7a6, 0xa7a6,
0xa7a8, 0xa7a8,
+ 0xa7aa, 0xa7aa,
0xff21, 0xff3a,
0x10400, 0x10427,
}; /* CR_Changes_When_Lowercased */
/* 'Changes_When_Uppercased': Derived Property */
static const OnigCodePoint CR_Changes_When_Uppercased[] = {
- 582,
+ 586,
0x0061, 0x007a,
0x00b5, 0x00b5,
0x00df, 0x00f6,
@@ -7889,7 +11186,7 @@ static const OnigCodePoint CR_Changes_When_Uppercased[] = {
0x025b, 0x025b,
0x0260, 0x0260,
0x0263, 0x0263,
- 0x0265, 0x0265,
+ 0x0265, 0x0266,
0x0268, 0x0269,
0x026b, 0x026b,
0x026f, 0x026f,
@@ -8230,7 +11527,10 @@ static const OnigCodePoint CR_Changes_When_Uppercased[] = {
0x2ce3, 0x2ce3,
0x2cec, 0x2cec,
0x2cee, 0x2cee,
+ 0x2cf3, 0x2cf3,
0x2d00, 0x2d25,
+ 0x2d27, 0x2d27,
+ 0x2d2d, 0x2d2d,
0xa641, 0xa641,
0xa643, 0xa643,
0xa645, 0xa645,
@@ -8313,6 +11613,7 @@ static const OnigCodePoint CR_Changes_When_Uppercased[] = {
0xa787, 0xa787,
0xa78c, 0xa78c,
0xa791, 0xa791,
+ 0xa793, 0xa793,
0xa7a1, 0xa7a1,
0xa7a3, 0xa7a3,
0xa7a5, 0xa7a5,
@@ -8326,7 +11627,7 @@ static const OnigCodePoint CR_Changes_When_Uppercased[] = {
/* 'Changes_When_Titlecased': Derived Property */
static const OnigCodePoint CR_Changes_When_Titlecased[] = {
- 583,
+ 587,
0x0061, 0x007a,
0x00b5, 0x00b5,
0x00df, 0x00f6,
@@ -8477,7 +11778,7 @@ static const OnigCodePoint CR_Changes_When_Titlecased[] = {
0x025b, 0x025b,
0x0260, 0x0260,
0x0263, 0x0263,
- 0x0265, 0x0265,
+ 0x0265, 0x0266,
0x0268, 0x0269,
0x026b, 0x026b,
0x026f, 0x026f,
@@ -8818,7 +12119,10 @@ static const OnigCodePoint CR_Changes_When_Titlecased[] = {
0x2ce3, 0x2ce3,
0x2cec, 0x2cec,
0x2cee, 0x2cee,
+ 0x2cf3, 0x2cf3,
0x2d00, 0x2d25,
+ 0x2d27, 0x2d27,
+ 0x2d2d, 0x2d2d,
0xa641, 0xa641,
0xa643, 0xa643,
0xa645, 0xa645,
@@ -8901,6 +12205,7 @@ static const OnigCodePoint CR_Changes_When_Titlecased[] = {
0xa787, 0xa787,
0xa78c, 0xa78c,
0xa791, 0xa791,
+ 0xa793, 0xa793,
0xa7a1, 0xa7a1,
0xa7a3, 0xa7a3,
0xa7a5, 0xa7a5,
@@ -8914,7 +12219,7 @@ static const OnigCodePoint CR_Changes_When_Titlecased[] = {
/* 'Changes_When_Casefolded': Derived Property */
static const OnigCodePoint CR_Changes_When_Casefolded[] = {
- 577,
+ 582,
0x0041, 0x005a,
0x00b5, 0x00b5,
0x00c0, 0x00d6,
@@ -9189,6 +12494,8 @@ static const OnigCodePoint CR_Changes_When_Casefolded[] = {
0x0531, 0x0556,
0x0587, 0x0587,
0x10a0, 0x10c5,
+ 0x10c7, 0x10c7,
+ 0x10cd, 0x10cd,
0x1e00, 0x1e00,
0x1e02, 0x1e02,
0x1e04, 0x1e04,
@@ -9400,6 +12707,7 @@ static const OnigCodePoint CR_Changes_When_Casefolded[] = {
0x2ce2, 0x2ce2,
0x2ceb, 0x2ceb,
0x2ced, 0x2ced,
+ 0x2cf2, 0x2cf2,
0xa640, 0xa640,
0xa642, 0xa642,
0xa644, 0xa644,
@@ -9483,11 +12791,13 @@ static const OnigCodePoint CR_Changes_When_Casefolded[] = {
0xa78b, 0xa78b,
0xa78d, 0xa78d,
0xa790, 0xa790,
+ 0xa792, 0xa792,
0xa7a0, 0xa7a0,
0xa7a2, 0xa7a2,
0xa7a4, 0xa7a4,
0xa7a6, 0xa7a6,
0xa7a8, 0xa7a8,
+ 0xa7aa, 0xa7aa,
0xfb00, 0xfb06,
0xfb13, 0xfb17,
0xff21, 0xff3a,
@@ -9496,7 +12806,7 @@ static const OnigCodePoint CR_Changes_When_Casefolded[] = {
/* 'Changes_When_Casemapped': Derived Property */
static const OnigCodePoint CR_Changes_When_Casemapped[] = {
- 99,
+ 104,
0x0041, 0x005a,
0x0061, 0x007a,
0x00b5, 0x00b5,
@@ -9517,7 +12827,7 @@ static const OnigCodePoint CR_Changes_When_Casemapped[] = {
0x025b, 0x025b,
0x0260, 0x0260,
0x0263, 0x0263,
- 0x0265, 0x0265,
+ 0x0265, 0x0266,
0x0268, 0x0269,
0x026b, 0x026b,
0x026f, 0x026f,
@@ -9545,6 +12855,8 @@ static const OnigCodePoint CR_Changes_When_Casemapped[] = {
0x0531, 0x0556,
0x0561, 0x0587,
0x10a0, 0x10c5,
+ 0x10c7, 0x10c7,
+ 0x10cd, 0x10cd,
0x1d79, 0x1d79,
0x1d7d, 0x1d7d,
0x1e00, 0x1e9b,
@@ -9582,15 +12894,18 @@ static const OnigCodePoint CR_Changes_When_Casemapped[] = {
0x2c75, 0x2c76,
0x2c7e, 0x2ce3,
0x2ceb, 0x2cee,
+ 0x2cf2, 0x2cf3,
0x2d00, 0x2d25,
+ 0x2d27, 0x2d27,
+ 0x2d2d, 0x2d2d,
0xa640, 0xa66d,
0xa680, 0xa697,
0xa722, 0xa72f,
0xa732, 0xa76f,
0xa779, 0xa787,
0xa78b, 0xa78d,
- 0xa790, 0xa791,
- 0xa7a0, 0xa7a9,
+ 0xa790, 0xa793,
+ 0xa7a0, 0xa7aa,
0xfb00, 0xfb06,
0xfb13, 0xfb17,
0xff21, 0xff3a,
@@ -9600,7 +12915,7 @@ static const OnigCodePoint CR_Changes_When_Casemapped[] = {
/* 'ID_Start': Derived Property */
static const OnigCodePoint CR_ID_Start[] = {
- 437,
+ 488,
0x0041, 0x005a,
0x0061, 0x007a,
0x00aa, 0x00aa,
@@ -9648,6 +12963,8 @@ static const OnigCodePoint CR_ID_Start[] = {
0x0824, 0x0824,
0x0828, 0x0828,
0x0840, 0x0858,
+ 0x08a0, 0x08a0,
+ 0x08a2, 0x08ac,
0x0904, 0x0939,
0x093d, 0x093d,
0x0950, 0x0950,
@@ -9753,7 +13070,7 @@ static const OnigCodePoint CR_ID_Start[] = {
0x0ebd, 0x0ebd,
0x0ec0, 0x0ec4,
0x0ec6, 0x0ec6,
- 0x0edc, 0x0edd,
+ 0x0edc, 0x0edf,
0x0f00, 0x0f00,
0x0f40, 0x0f47,
0x0f49, 0x0f6c,
@@ -9768,9 +13085,10 @@ static const OnigCodePoint CR_ID_Start[] = {
0x1075, 0x1081,
0x108e, 0x108e,
0x10a0, 0x10c5,
+ 0x10c7, 0x10c7,
+ 0x10cd, 0x10cd,
0x10d0, 0x10fa,
- 0x10fc, 0x10fc,
- 0x1100, 0x1248,
+ 0x10fc, 0x1248,
0x124a, 0x124d,
0x1250, 0x1256,
0x1258, 0x1258,
@@ -9818,12 +13136,13 @@ static const OnigCodePoint CR_ID_Start[] = {
0x1b45, 0x1b4b,
0x1b83, 0x1ba0,
0x1bae, 0x1baf,
- 0x1bc0, 0x1be5,
+ 0x1bba, 0x1be5,
0x1c00, 0x1c23,
0x1c4d, 0x1c4f,
0x1c5a, 0x1c7d,
0x1ce9, 0x1cec,
0x1cee, 0x1cf1,
+ 0x1cf5, 0x1cf6,
0x1d00, 0x1dbf,
0x1e00, 0x1f15,
0x1f18, 0x1f1d,
@@ -9864,8 +13183,11 @@ static const OnigCodePoint CR_ID_Start[] = {
0x2c30, 0x2c5e,
0x2c60, 0x2ce4,
0x2ceb, 0x2cee,
+ 0x2cf2, 0x2cf3,
0x2d00, 0x2d25,
- 0x2d30, 0x2d65,
+ 0x2d27, 0x2d27,
+ 0x2d2d, 0x2d2d,
+ 0x2d30, 0x2d67,
0x2d6f, 0x2d6f,
0x2d80, 0x2d96,
0x2da0, 0x2da6,
@@ -9889,7 +13211,7 @@ static const OnigCodePoint CR_ID_Start[] = {
0x31a0, 0x31ba,
0x31f0, 0x31ff,
0x3400, 0x4db5,
- 0x4e00, 0x9fcb,
+ 0x4e00, 0x9fcc,
0xa000, 0xa48c,
0xa4d0, 0xa4fd,
0xa500, 0xa60c,
@@ -9901,9 +13223,9 @@ static const OnigCodePoint CR_ID_Start[] = {
0xa717, 0xa71f,
0xa722, 0xa788,
0xa78b, 0xa78e,
- 0xa790, 0xa791,
- 0xa7a0, 0xa7a9,
- 0xa7fa, 0xa801,
+ 0xa790, 0xa793,
+ 0xa7a0, 0xa7aa,
+ 0xa7f8, 0xa801,
0xa803, 0xa805,
0xa807, 0xa80a,
0xa80c, 0xa822,
@@ -9928,6 +13250,8 @@ static const OnigCodePoint CR_ID_Start[] = {
0xaac0, 0xaac0,
0xaac2, 0xaac2,
0xaadb, 0xaadd,
+ 0xaae0, 0xaaea,
+ 0xaaf2, 0xaaf4,
0xab01, 0xab06,
0xab09, 0xab0e,
0xab11, 0xab16,
@@ -9937,8 +13261,7 @@ static const OnigCodePoint CR_ID_Start[] = {
0xac00, 0xd7a3,
0xd7b0, 0xd7c6,
0xd7cb, 0xd7fb,
- 0xf900, 0xfa2d,
- 0xfa30, 0xfa6d,
+ 0xf900, 0xfa6d,
0xfa70, 0xfad9,
0xfb00, 0xfb06,
0xfb13, 0xfb17,
@@ -9988,6 +13311,8 @@ static const OnigCodePoint CR_ID_Start[] = {
0x1083f, 0x10855,
0x10900, 0x10915,
0x10920, 0x10939,
+ 0x10980, 0x109b7,
+ 0x109be, 0x109bf,
0x10a00, 0x10a00,
0x10a10, 0x10a13,
0x10a15, 0x10a17,
@@ -9999,10 +13324,18 @@ static const OnigCodePoint CR_ID_Start[] = {
0x10c00, 0x10c48,
0x11003, 0x11037,
0x11083, 0x110af,
+ 0x110d0, 0x110e8,
+ 0x11103, 0x11126,
+ 0x11183, 0x111b2,
+ 0x111c1, 0x111c4,
+ 0x11680, 0x116aa,
0x12000, 0x1236e,
0x12400, 0x12462,
0x13000, 0x1342e,
0x16800, 0x16a38,
+ 0x16f00, 0x16f44,
+ 0x16f50, 0x16f50,
+ 0x16f93, 0x16f9f,
0x1b000, 0x1b001,
0x1d400, 0x1d454,
0x1d456, 0x1d49c,
@@ -10034,6 +13367,39 @@ static const OnigCodePoint CR_ID_Start[] = {
0x1d78a, 0x1d7a8,
0x1d7aa, 0x1d7c2,
0x1d7c4, 0x1d7cb,
+ 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,
0x20000, 0x2a6d6,
0x2a700, 0x2b734,
0x2b740, 0x2b81d,
@@ -10042,7 +13408,7 @@ static const OnigCodePoint CR_ID_Start[] = {
/* 'ID_Continue': Derived Property */
static const OnigCodePoint CR_ID_Continue[] = {
- 514,
+ 564,
0x0030, 0x0039,
0x0041, 0x005a,
0x005f, 0x005f,
@@ -10091,6 +13457,9 @@ static const OnigCodePoint CR_ID_Continue[] = {
0x07fa, 0x07fa,
0x0800, 0x082d,
0x0840, 0x085b,
+ 0x08a0, 0x08a0,
+ 0x08a2, 0x08ac,
+ 0x08e4, 0x08fe,
0x0900, 0x0963,
0x0966, 0x096f,
0x0971, 0x0977,
@@ -10238,7 +13607,7 @@ static const OnigCodePoint CR_ID_Continue[] = {
0x0ec6, 0x0ec6,
0x0ec8, 0x0ecd,
0x0ed0, 0x0ed9,
- 0x0edc, 0x0edd,
+ 0x0edc, 0x0edf,
0x0f00, 0x0f00,
0x0f18, 0x0f19,
0x0f20, 0x0f29,
@@ -10254,9 +13623,10 @@ static const OnigCodePoint CR_ID_Continue[] = {
0x1000, 0x1049,
0x1050, 0x109d,
0x10a0, 0x10c5,
+ 0x10c7, 0x10c7,
+ 0x10cd, 0x10cd,
0x10d0, 0x10fa,
- 0x10fc, 0x10fc,
- 0x1100, 0x1248,
+ 0x10fc, 0x1248,
0x124a, 0x124d,
0x1250, 0x1256,
0x1258, 0x1258,
@@ -10288,8 +13658,7 @@ static const OnigCodePoint CR_ID_Continue[] = {
0x1760, 0x176c,
0x176e, 0x1770,
0x1772, 0x1773,
- 0x1780, 0x17b3,
- 0x17b6, 0x17d3,
+ 0x1780, 0x17d3,
0x17d7, 0x17d7,
0x17dc, 0x17dd,
0x17e0, 0x17e9,
@@ -10315,14 +13684,12 @@ static const OnigCodePoint CR_ID_Continue[] = {
0x1b00, 0x1b4b,
0x1b50, 0x1b59,
0x1b6b, 0x1b73,
- 0x1b80, 0x1baa,
- 0x1bae, 0x1bb9,
- 0x1bc0, 0x1bf3,
+ 0x1b80, 0x1bf3,
0x1c00, 0x1c37,
0x1c40, 0x1c49,
0x1c4d, 0x1c7d,
0x1cd0, 0x1cd2,
- 0x1cd4, 0x1cf2,
+ 0x1cd4, 0x1cf6,
0x1d00, 0x1de6,
0x1dfc, 0x1f15,
0x1f18, 0x1f1d,
@@ -10367,9 +13734,11 @@ static const OnigCodePoint CR_ID_Continue[] = {
0x2c00, 0x2c2e,
0x2c30, 0x2c5e,
0x2c60, 0x2ce4,
- 0x2ceb, 0x2cf1,
+ 0x2ceb, 0x2cf3,
0x2d00, 0x2d25,
- 0x2d30, 0x2d65,
+ 0x2d27, 0x2d27,
+ 0x2d2d, 0x2d2d,
+ 0x2d30, 0x2d67,
0x2d6f, 0x2d6f,
0x2d7f, 0x2d96,
0x2da0, 0x2da6,
@@ -10394,21 +13763,21 @@ static const OnigCodePoint CR_ID_Continue[] = {
0x31a0, 0x31ba,
0x31f0, 0x31ff,
0x3400, 0x4db5,
- 0x4e00, 0x9fcb,
+ 0x4e00, 0x9fcc,
0xa000, 0xa48c,
0xa4d0, 0xa4fd,
0xa500, 0xa60c,
0xa610, 0xa62b,
0xa640, 0xa66f,
- 0xa67c, 0xa67d,
+ 0xa674, 0xa67d,
0xa67f, 0xa697,
- 0xa6a0, 0xa6f1,
+ 0xa69f, 0xa6f1,
0xa717, 0xa71f,
0xa722, 0xa788,
0xa78b, 0xa78e,
- 0xa790, 0xa791,
- 0xa7a0, 0xa7a9,
- 0xa7fa, 0xa827,
+ 0xa790, 0xa793,
+ 0xa7a0, 0xa7aa,
+ 0xa7f8, 0xa827,
0xa840, 0xa873,
0xa880, 0xa8c4,
0xa8d0, 0xa8d9,
@@ -10426,6 +13795,8 @@ static const OnigCodePoint CR_ID_Continue[] = {
0xaa7a, 0xaa7b,
0xaa80, 0xaac2,
0xaadb, 0xaadd,
+ 0xaae0, 0xaaef,
+ 0xaaf2, 0xaaf6,
0xab01, 0xab06,
0xab09, 0xab0e,
0xab11, 0xab16,
@@ -10437,8 +13808,7 @@ static const OnigCodePoint CR_ID_Continue[] = {
0xac00, 0xd7a3,
0xd7b0, 0xd7c6,
0xd7cb, 0xd7fb,
- 0xf900, 0xfa2d,
- 0xfa30, 0xfa6d,
+ 0xf900, 0xfa6d,
0xfa70, 0xfad9,
0xfb00, 0xfb06,
0xfb13, 0xfb17,
@@ -10495,6 +13865,8 @@ static const OnigCodePoint CR_ID_Continue[] = {
0x1083f, 0x10855,
0x10900, 0x10915,
0x10920, 0x10939,
+ 0x10980, 0x109b7,
+ 0x109be, 0x109bf,
0x10a00, 0x10a03,
0x10a05, 0x10a06,
0x10a0c, 0x10a13,
@@ -10510,10 +13882,21 @@ static const OnigCodePoint CR_ID_Continue[] = {
0x11000, 0x11046,
0x11066, 0x1106f,
0x11080, 0x110ba,
+ 0x110d0, 0x110e8,
+ 0x110f0, 0x110f9,
+ 0x11100, 0x11134,
+ 0x11136, 0x1113f,
+ 0x11180, 0x111c4,
+ 0x111d0, 0x111d9,
+ 0x11680, 0x116b7,
+ 0x116c0, 0x116c9,
0x12000, 0x1236e,
0x12400, 0x12462,
0x13000, 0x1342e,
0x16800, 0x16a38,
+ 0x16f00, 0x16f44,
+ 0x16f50, 0x16f7e,
+ 0x16f8f, 0x16f9f,
0x1b000, 0x1b001,
0x1d165, 0x1d169,
0x1d16d, 0x1d172,
@@ -10552,6 +13935,39 @@ static const OnigCodePoint CR_ID_Continue[] = {
0x1d7aa, 0x1d7c2,
0x1d7c4, 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,
0x20000, 0x2a6d6,
0x2a700, 0x2b734,
0x2b740, 0x2b81d,
@@ -10561,7 +13977,7 @@ static const OnigCodePoint CR_ID_Continue[] = {
/* 'XID_Start': Derived Property */
static const OnigCodePoint CR_XID_Start[] = {
- 444,
+ 495,
0x0041, 0x005a,
0x0061, 0x007a,
0x00aa, 0x00aa,
@@ -10609,6 +14025,8 @@ static const OnigCodePoint CR_XID_Start[] = {
0x0824, 0x0824,
0x0828, 0x0828,
0x0840, 0x0858,
+ 0x08a0, 0x08a0,
+ 0x08a2, 0x08ac,
0x0904, 0x0939,
0x093d, 0x093d,
0x0950, 0x0950,
@@ -10714,7 +14132,7 @@ static const OnigCodePoint CR_XID_Start[] = {
0x0ebd, 0x0ebd,
0x0ec0, 0x0ec4,
0x0ec6, 0x0ec6,
- 0x0edc, 0x0edd,
+ 0x0edc, 0x0edf,
0x0f00, 0x0f00,
0x0f40, 0x0f47,
0x0f49, 0x0f6c,
@@ -10729,9 +14147,10 @@ static const OnigCodePoint CR_XID_Start[] = {
0x1075, 0x1081,
0x108e, 0x108e,
0x10a0, 0x10c5,
+ 0x10c7, 0x10c7,
+ 0x10cd, 0x10cd,
0x10d0, 0x10fa,
- 0x10fc, 0x10fc,
- 0x1100, 0x1248,
+ 0x10fc, 0x1248,
0x124a, 0x124d,
0x1250, 0x1256,
0x1258, 0x1258,
@@ -10779,12 +14198,13 @@ static const OnigCodePoint CR_XID_Start[] = {
0x1b45, 0x1b4b,
0x1b83, 0x1ba0,
0x1bae, 0x1baf,
- 0x1bc0, 0x1be5,
+ 0x1bba, 0x1be5,
0x1c00, 0x1c23,
0x1c4d, 0x1c4f,
0x1c5a, 0x1c7d,
0x1ce9, 0x1cec,
0x1cee, 0x1cf1,
+ 0x1cf5, 0x1cf6,
0x1d00, 0x1dbf,
0x1e00, 0x1f15,
0x1f18, 0x1f1d,
@@ -10825,8 +14245,11 @@ static const OnigCodePoint CR_XID_Start[] = {
0x2c30, 0x2c5e,
0x2c60, 0x2ce4,
0x2ceb, 0x2cee,
+ 0x2cf2, 0x2cf3,
0x2d00, 0x2d25,
- 0x2d30, 0x2d65,
+ 0x2d27, 0x2d27,
+ 0x2d2d, 0x2d2d,
+ 0x2d30, 0x2d67,
0x2d6f, 0x2d6f,
0x2d80, 0x2d96,
0x2da0, 0x2da6,
@@ -10850,7 +14273,7 @@ static const OnigCodePoint CR_XID_Start[] = {
0x31a0, 0x31ba,
0x31f0, 0x31ff,
0x3400, 0x4db5,
- 0x4e00, 0x9fcb,
+ 0x4e00, 0x9fcc,
0xa000, 0xa48c,
0xa4d0, 0xa4fd,
0xa500, 0xa60c,
@@ -10862,9 +14285,9 @@ static const OnigCodePoint CR_XID_Start[] = {
0xa717, 0xa71f,
0xa722, 0xa788,
0xa78b, 0xa78e,
- 0xa790, 0xa791,
- 0xa7a0, 0xa7a9,
- 0xa7fa, 0xa801,
+ 0xa790, 0xa793,
+ 0xa7a0, 0xa7aa,
+ 0xa7f8, 0xa801,
0xa803, 0xa805,
0xa807, 0xa80a,
0xa80c, 0xa822,
@@ -10889,6 +14312,8 @@ static const OnigCodePoint CR_XID_Start[] = {
0xaac0, 0xaac0,
0xaac2, 0xaac2,
0xaadb, 0xaadd,
+ 0xaae0, 0xaaea,
+ 0xaaf2, 0xaaf4,
0xab01, 0xab06,
0xab09, 0xab0e,
0xab11, 0xab16,
@@ -10898,8 +14323,7 @@ static const OnigCodePoint CR_XID_Start[] = {
0xac00, 0xd7a3,
0xd7b0, 0xd7c6,
0xd7cb, 0xd7fb,
- 0xf900, 0xfa2d,
- 0xfa30, 0xfa6d,
+ 0xf900, 0xfa6d,
0xfa70, 0xfad9,
0xfb00, 0xfb06,
0xfb13, 0xfb17,
@@ -10956,6 +14380,8 @@ static const OnigCodePoint CR_XID_Start[] = {
0x1083f, 0x10855,
0x10900, 0x10915,
0x10920, 0x10939,
+ 0x10980, 0x109b7,
+ 0x109be, 0x109bf,
0x10a00, 0x10a00,
0x10a10, 0x10a13,
0x10a15, 0x10a17,
@@ -10967,10 +14393,18 @@ static const OnigCodePoint CR_XID_Start[] = {
0x10c00, 0x10c48,
0x11003, 0x11037,
0x11083, 0x110af,
+ 0x110d0, 0x110e8,
+ 0x11103, 0x11126,
+ 0x11183, 0x111b2,
+ 0x111c1, 0x111c4,
+ 0x11680, 0x116aa,
0x12000, 0x1236e,
0x12400, 0x12462,
0x13000, 0x1342e,
0x16800, 0x16a38,
+ 0x16f00, 0x16f44,
+ 0x16f50, 0x16f50,
+ 0x16f93, 0x16f9f,
0x1b000, 0x1b001,
0x1d400, 0x1d454,
0x1d456, 0x1d49c,
@@ -11002,6 +14436,39 @@ static const OnigCodePoint CR_XID_Start[] = {
0x1d78a, 0x1d7a8,
0x1d7aa, 0x1d7c2,
0x1d7c4, 0x1d7cb,
+ 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,
0x20000, 0x2a6d6,
0x2a700, 0x2b734,
0x2b740, 0x2b81d,
@@ -11010,7 +14477,7 @@ static const OnigCodePoint CR_XID_Start[] = {
/* 'XID_Continue': Derived Property */
static const OnigCodePoint CR_XID_Continue[] = {
- 521,
+ 571,
0x0030, 0x0039,
0x0041, 0x005a,
0x005f, 0x005f,
@@ -11059,6 +14526,9 @@ static const OnigCodePoint CR_XID_Continue[] = {
0x07fa, 0x07fa,
0x0800, 0x082d,
0x0840, 0x085b,
+ 0x08a0, 0x08a0,
+ 0x08a2, 0x08ac,
+ 0x08e4, 0x08fe,
0x0900, 0x0963,
0x0966, 0x096f,
0x0971, 0x0977,
@@ -11206,7 +14676,7 @@ static const OnigCodePoint CR_XID_Continue[] = {
0x0ec6, 0x0ec6,
0x0ec8, 0x0ecd,
0x0ed0, 0x0ed9,
- 0x0edc, 0x0edd,
+ 0x0edc, 0x0edf,
0x0f00, 0x0f00,
0x0f18, 0x0f19,
0x0f20, 0x0f29,
@@ -11222,9 +14692,10 @@ static const OnigCodePoint CR_XID_Continue[] = {
0x1000, 0x1049,
0x1050, 0x109d,
0x10a0, 0x10c5,
+ 0x10c7, 0x10c7,
+ 0x10cd, 0x10cd,
0x10d0, 0x10fa,
- 0x10fc, 0x10fc,
- 0x1100, 0x1248,
+ 0x10fc, 0x1248,
0x124a, 0x124d,
0x1250, 0x1256,
0x1258, 0x1258,
@@ -11256,8 +14727,7 @@ static const OnigCodePoint CR_XID_Continue[] = {
0x1760, 0x176c,
0x176e, 0x1770,
0x1772, 0x1773,
- 0x1780, 0x17b3,
- 0x17b6, 0x17d3,
+ 0x1780, 0x17d3,
0x17d7, 0x17d7,
0x17dc, 0x17dd,
0x17e0, 0x17e9,
@@ -11283,14 +14753,12 @@ static const OnigCodePoint CR_XID_Continue[] = {
0x1b00, 0x1b4b,
0x1b50, 0x1b59,
0x1b6b, 0x1b73,
- 0x1b80, 0x1baa,
- 0x1bae, 0x1bb9,
- 0x1bc0, 0x1bf3,
+ 0x1b80, 0x1bf3,
0x1c00, 0x1c37,
0x1c40, 0x1c49,
0x1c4d, 0x1c7d,
0x1cd0, 0x1cd2,
- 0x1cd4, 0x1cf2,
+ 0x1cd4, 0x1cf6,
0x1d00, 0x1de6,
0x1dfc, 0x1f15,
0x1f18, 0x1f1d,
@@ -11335,9 +14803,11 @@ static const OnigCodePoint CR_XID_Continue[] = {
0x2c00, 0x2c2e,
0x2c30, 0x2c5e,
0x2c60, 0x2ce4,
- 0x2ceb, 0x2cf1,
+ 0x2ceb, 0x2cf3,
0x2d00, 0x2d25,
- 0x2d30, 0x2d65,
+ 0x2d27, 0x2d27,
+ 0x2d2d, 0x2d2d,
+ 0x2d30, 0x2d67,
0x2d6f, 0x2d6f,
0x2d7f, 0x2d96,
0x2da0, 0x2da6,
@@ -11363,21 +14833,21 @@ static const OnigCodePoint CR_XID_Continue[] = {
0x31a0, 0x31ba,
0x31f0, 0x31ff,
0x3400, 0x4db5,
- 0x4e00, 0x9fcb,
+ 0x4e00, 0x9fcc,
0xa000, 0xa48c,
0xa4d0, 0xa4fd,
0xa500, 0xa60c,
0xa610, 0xa62b,
0xa640, 0xa66f,
- 0xa67c, 0xa67d,
+ 0xa674, 0xa67d,
0xa67f, 0xa697,
- 0xa6a0, 0xa6f1,
+ 0xa69f, 0xa6f1,
0xa717, 0xa71f,
0xa722, 0xa788,
0xa78b, 0xa78e,
- 0xa790, 0xa791,
- 0xa7a0, 0xa7a9,
- 0xa7fa, 0xa827,
+ 0xa790, 0xa793,
+ 0xa7a0, 0xa7aa,
+ 0xa7f8, 0xa827,
0xa840, 0xa873,
0xa880, 0xa8c4,
0xa8d0, 0xa8d9,
@@ -11395,6 +14865,8 @@ static const OnigCodePoint CR_XID_Continue[] = {
0xaa7a, 0xaa7b,
0xaa80, 0xaac2,
0xaadb, 0xaadd,
+ 0xaae0, 0xaaef,
+ 0xaaf2, 0xaaf6,
0xab01, 0xab06,
0xab09, 0xab0e,
0xab11, 0xab16,
@@ -11406,8 +14878,7 @@ static const OnigCodePoint CR_XID_Continue[] = {
0xac00, 0xd7a3,
0xd7b0, 0xd7c6,
0xd7cb, 0xd7fb,
- 0xf900, 0xfa2d,
- 0xfa30, 0xfa6d,
+ 0xf900, 0xfa6d,
0xfa70, 0xfad9,
0xfb00, 0xfb06,
0xfb13, 0xfb17,
@@ -11470,6 +14941,8 @@ static const OnigCodePoint CR_XID_Continue[] = {
0x1083f, 0x10855,
0x10900, 0x10915,
0x10920, 0x10939,
+ 0x10980, 0x109b7,
+ 0x109be, 0x109bf,
0x10a00, 0x10a03,
0x10a05, 0x10a06,
0x10a0c, 0x10a13,
@@ -11485,10 +14958,21 @@ static const OnigCodePoint CR_XID_Continue[] = {
0x11000, 0x11046,
0x11066, 0x1106f,
0x11080, 0x110ba,
+ 0x110d0, 0x110e8,
+ 0x110f0, 0x110f9,
+ 0x11100, 0x11134,
+ 0x11136, 0x1113f,
+ 0x11180, 0x111c4,
+ 0x111d0, 0x111d9,
+ 0x11680, 0x116b7,
+ 0x116c0, 0x116c9,
0x12000, 0x1236e,
0x12400, 0x12462,
0x13000, 0x1342e,
0x16800, 0x16a38,
+ 0x16f00, 0x16f44,
+ 0x16f50, 0x16f7e,
+ 0x16f8f, 0x16f9f,
0x1b000, 0x1b001,
0x1d165, 0x1d169,
0x1d16d, 0x1d172,
@@ -11527,6 +15011,39 @@ static const OnigCodePoint CR_XID_Continue[] = {
0x1d7aa, 0x1d7c2,
0x1d7c4, 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,
0x20000, 0x2a6d6,
0x2a700, 0x2b734,
0x2b740, 0x2b81d,
@@ -11556,7 +15073,7 @@ static const OnigCodePoint CR_Default_Ignorable_Code_Point[] = {
/* 'Grapheme_Extend': Derived Property */
static const OnigCodePoint CR_Grapheme_Extend[] = {
- 215,
+ 232,
0x0300, 0x036f,
0x0483, 0x0489,
0x0591, 0x05bd,
@@ -11580,6 +15097,7 @@ static const OnigCodePoint CR_Grapheme_Extend[] = {
0x0825, 0x0827,
0x0829, 0x082d,
0x0859, 0x085b,
+ 0x08e4, 0x08fe,
0x0900, 0x0902,
0x093a, 0x093a,
0x093c, 0x093c,
@@ -11675,6 +15193,7 @@ static const OnigCodePoint CR_Grapheme_Extend[] = {
0x1732, 0x1734,
0x1752, 0x1753,
0x1772, 0x1773,
+ 0x17b4, 0x17b5,
0x17b7, 0x17bd,
0x17c6, 0x17c6,
0x17c9, 0x17d3,
@@ -11702,6 +15221,7 @@ static const OnigCodePoint CR_Grapheme_Extend[] = {
0x1b80, 0x1b81,
0x1ba2, 0x1ba5,
0x1ba8, 0x1ba9,
+ 0x1bab, 0x1bab,
0x1be6, 0x1be6,
0x1be8, 0x1be9,
0x1bed, 0x1bed,
@@ -11712,6 +15232,7 @@ static const OnigCodePoint CR_Grapheme_Extend[] = {
0x1cd4, 0x1ce0,
0x1ce2, 0x1ce8,
0x1ced, 0x1ced,
+ 0x1cf4, 0x1cf4,
0x1dc0, 0x1de6,
0x1dfc, 0x1dff,
0x200c, 0x200d,
@@ -11722,7 +15243,8 @@ static const OnigCodePoint CR_Grapheme_Extend[] = {
0x302a, 0x302f,
0x3099, 0x309a,
0xa66f, 0xa672,
- 0xa67c, 0xa67d,
+ 0xa674, 0xa67d,
+ 0xa69f, 0xa69f,
0xa6f0, 0xa6f1,
0xa802, 0xa802,
0xa806, 0xa806,
@@ -11746,6 +15268,8 @@ static const OnigCodePoint CR_Grapheme_Extend[] = {
0xaab7, 0xaab8,
0xaabe, 0xaabf,
0xaac1, 0xaac1,
+ 0xaaec, 0xaaed,
+ 0xaaf6, 0xaaf6,
0xabe5, 0xabe5,
0xabe8, 0xabe8,
0xabed, 0xabed,
@@ -11764,6 +15288,16 @@ static const OnigCodePoint CR_Grapheme_Extend[] = {
0x11080, 0x11081,
0x110b3, 0x110b6,
0x110b9, 0x110ba,
+ 0x11100, 0x11102,
+ 0x11127, 0x1112b,
+ 0x1112d, 0x11134,
+ 0x11180, 0x11181,
+ 0x111b6, 0x111be,
+ 0x116ab, 0x116ab,
+ 0x116ad, 0x116ad,
+ 0x116b0, 0x116b5,
+ 0x116b7, 0x116b7,
+ 0x16f8f, 0x16f92,
0x1d165, 0x1d165,
0x1d167, 0x1d169,
0x1d16e, 0x1d172,
@@ -11776,7 +15310,7 @@ static const OnigCodePoint CR_Grapheme_Extend[] = {
/* 'Grapheme_Base': Derived Property */
static const OnigCodePoint CR_Grapheme_Base[] = {
- 596,
+ 643,
0x0020, 0x007e,
0x00a0, 0x00ac,
0x00ae, 0x02ff,
@@ -11791,6 +15325,7 @@ static const OnigCodePoint CR_Grapheme_Base[] = {
0x0559, 0x055f,
0x0561, 0x0587,
0x0589, 0x058a,
+ 0x058f, 0x058f,
0x05be, 0x05be,
0x05c0, 0x05c0,
0x05c3, 0x05c3,
@@ -11819,6 +15354,8 @@ static const OnigCodePoint CR_Grapheme_Base[] = {
0x0830, 0x083e,
0x0840, 0x0858,
0x085e, 0x085e,
+ 0x08a0, 0x08a0,
+ 0x08a2, 0x08ac,
0x0903, 0x0939,
0x093b, 0x093b,
0x093d, 0x0940,
@@ -11867,8 +15404,7 @@ static const OnigCodePoint CR_Grapheme_Base[] = {
0x0acb, 0x0acc,
0x0ad0, 0x0ad0,
0x0ae0, 0x0ae1,
- 0x0ae6, 0x0aef,
- 0x0af1, 0x0af1,
+ 0x0ae6, 0x0af1,
0x0b02, 0x0b03,
0x0b05, 0x0b0c,
0x0b0f, 0x0b10,
@@ -11968,7 +15504,7 @@ static const OnigCodePoint CR_Grapheme_Base[] = {
0x0ec0, 0x0ec4,
0x0ec6, 0x0ec6,
0x0ed0, 0x0ed9,
- 0x0edc, 0x0edd,
+ 0x0edc, 0x0edf,
0x0f00, 0x0f17,
0x0f1a, 0x0f34,
0x0f36, 0x0f36,
@@ -11993,8 +15529,9 @@ static const OnigCodePoint CR_Grapheme_Base[] = {
0x1087, 0x108c,
0x108e, 0x109c,
0x109e, 0x10c5,
- 0x10d0, 0x10fc,
- 0x1100, 0x1248,
+ 0x10c7, 0x10c7,
+ 0x10cd, 0x10cd,
+ 0x10d0, 0x1248,
0x124a, 0x124d,
0x1250, 0x1256,
0x1258, 0x1258,
@@ -12067,8 +15604,7 @@ static const OnigCodePoint CR_Grapheme_Base[] = {
0x1b82, 0x1ba1,
0x1ba6, 0x1ba7,
0x1baa, 0x1baa,
- 0x1bae, 0x1bb9,
- 0x1bc0, 0x1be5,
+ 0x1bac, 0x1be5,
0x1be7, 0x1be7,
0x1bea, 0x1bec,
0x1bee, 0x1bee,
@@ -12077,10 +15613,12 @@ static const OnigCodePoint CR_Grapheme_Base[] = {
0x1c34, 0x1c35,
0x1c3b, 0x1c49,
0x1c4d, 0x1c7f,
+ 0x1cc0, 0x1cc7,
0x1cd3, 0x1cd3,
0x1ce1, 0x1ce1,
0x1ce9, 0x1cec,
- 0x1cee, 0x1cf2,
+ 0x1cee, 0x1cf3,
+ 0x1cf5, 0x1cf6,
0x1d00, 0x1dbf,
0x1e00, 0x1f15,
0x1f18, 0x1f1d,
@@ -12110,15 +15648,16 @@ static const OnigCodePoint CR_Grapheme_Base[] = {
0x2400, 0x2426,
0x2440, 0x244a,
0x2460, 0x26ff,
- 0x2701, 0x27ca,
- 0x27cc, 0x27cc,
- 0x27ce, 0x2b4c,
+ 0x2701, 0x2b4c,
0x2b50, 0x2b59,
0x2c00, 0x2c2e,
0x2c30, 0x2c5e,
0x2c60, 0x2cee,
+ 0x2cf2, 0x2cf3,
0x2cf9, 0x2d25,
- 0x2d30, 0x2d65,
+ 0x2d27, 0x2d27,
+ 0x2d2d, 0x2d2d,
+ 0x2d30, 0x2d67,
0x2d6f, 0x2d70,
0x2d80, 0x2d96,
0x2da0, 0x2da6,
@@ -12129,7 +15668,7 @@ static const OnigCodePoint CR_Grapheme_Base[] = {
0x2dc8, 0x2dce,
0x2dd0, 0x2dd6,
0x2dd8, 0x2dde,
- 0x2e00, 0x2e31,
+ 0x2e00, 0x2e3b,
0x2e80, 0x2e99,
0x2e9b, 0x2ef3,
0x2f00, 0x2fd5,
@@ -12145,7 +15684,7 @@ static const OnigCodePoint CR_Grapheme_Base[] = {
0x31f0, 0x321e,
0x3220, 0x32fe,
0x3300, 0x4db5,
- 0x4dc0, 0x9fcb,
+ 0x4dc0, 0x9fcc,
0xa000, 0xa48c,
0xa490, 0xa4c6,
0xa4d0, 0xa62b,
@@ -12155,9 +15694,9 @@ static const OnigCodePoint CR_Grapheme_Base[] = {
0xa6a0, 0xa6ef,
0xa6f2, 0xa6f7,
0xa700, 0xa78e,
- 0xa790, 0xa791,
- 0xa7a0, 0xa7a9,
- 0xa7fa, 0xa801,
+ 0xa790, 0xa793,
+ 0xa7a0, 0xa7aa,
+ 0xa7f8, 0xa801,
0xa803, 0xa805,
0xa807, 0xa80a,
0xa80c, 0xa824,
@@ -12191,7 +15730,8 @@ static const OnigCodePoint CR_Grapheme_Base[] = {
0xaab9, 0xaabd,
0xaac0, 0xaac0,
0xaac2, 0xaac2,
- 0xaadb, 0xaadf,
+ 0xaadb, 0xaaeb,
+ 0xaaee, 0xaaf5,
0xab01, 0xab06,
0xab09, 0xab0e,
0xab11, 0xab16,
@@ -12204,8 +15744,7 @@ static const OnigCodePoint CR_Grapheme_Base[] = {
0xac00, 0xd7a3,
0xd7b0, 0xd7c6,
0xd7cb, 0xd7fb,
- 0xf900, 0xfa2d,
- 0xfa30, 0xfa6d,
+ 0xf900, 0xfa6d,
0xfa70, 0xfad9,
0xfb00, 0xfb06,
0xfb13, 0xfb17,
@@ -12267,6 +15806,8 @@ static const OnigCodePoint CR_Grapheme_Base[] = {
0x10900, 0x1091b,
0x1091f, 0x10939,
0x1093f, 0x1093f,
+ 0x10980, 0x109b7,
+ 0x109be, 0x109bf,
0x10a00, 0x10a00,
0x10a10, 0x10a13,
0x10a15, 0x10a17,
@@ -12288,11 +15829,27 @@ static const OnigCodePoint CR_Grapheme_Base[] = {
0x110b7, 0x110b8,
0x110bb, 0x110bc,
0x110be, 0x110c1,
+ 0x110d0, 0x110e8,
+ 0x110f0, 0x110f9,
+ 0x11103, 0x11126,
+ 0x1112c, 0x1112c,
+ 0x11136, 0x11143,
+ 0x11182, 0x111b5,
+ 0x111bf, 0x111c8,
+ 0x111d0, 0x111d9,
+ 0x11680, 0x116aa,
+ 0x116ac, 0x116ac,
+ 0x116ae, 0x116af,
+ 0x116b6, 0x116b6,
+ 0x116c0, 0x116c9,
0x12000, 0x1236e,
0x12400, 0x12462,
0x12470, 0x12473,
0x13000, 0x1342e,
0x16800, 0x16a38,
+ 0x16f00, 0x16f44,
+ 0x16f50, 0x16f7e,
+ 0x16f93, 0x16f9f,
0x1b000, 0x1b001,
0x1d000, 0x1d0f5,
0x1d100, 0x1d126,
@@ -12327,6 +15884,40 @@ static const OnigCodePoint CR_Grapheme_Base[] = {
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,
@@ -12335,7 +15926,7 @@ static const OnigCodePoint CR_Grapheme_Base[] = {
0x1f0d1, 0x1f0df,
0x1f100, 0x1f10a,
0x1f110, 0x1f12e,
- 0x1f130, 0x1f169,
+ 0x1f130, 0x1f16b,
0x1f170, 0x1f19a,
0x1f1e6, 0x1f202,
0x1f210, 0x1f23a,
@@ -12353,19 +15944,9 @@ static const OnigCodePoint CR_Grapheme_Base[] = {
0x1f442, 0x1f4f7,
0x1f4f9, 0x1f4fc,
0x1f500, 0x1f53d,
+ 0x1f540, 0x1f543,
0x1f550, 0x1f567,
- 0x1f5fb, 0x1f5ff,
- 0x1f601, 0x1f610,
- 0x1f612, 0x1f614,
- 0x1f616, 0x1f616,
- 0x1f618, 0x1f618,
- 0x1f61a, 0x1f61a,
- 0x1f61c, 0x1f61e,
- 0x1f620, 0x1f625,
- 0x1f628, 0x1f62b,
- 0x1f62d, 0x1f62d,
- 0x1f630, 0x1f633,
- 0x1f635, 0x1f640,
+ 0x1f5fb, 0x1f640,
0x1f645, 0x1f64f,
0x1f680, 0x1f6c5,
0x1f700, 0x1f773,
@@ -12377,7 +15958,7 @@ static const OnigCodePoint CR_Grapheme_Base[] = {
/* 'Grapheme_Link': Derived Property */
static const OnigCodePoint CR_Grapheme_Link[] = {
- 29,
+ 33,
0x094d, 0x094d,
0x09cd, 0x09cd,
0x0a4d, 0x0a4d,
@@ -12396,22 +15977,26 @@ static const OnigCodePoint CR_Grapheme_Link[] = {
0x17d2, 0x17d2,
0x1a60, 0x1a60,
0x1b44, 0x1b44,
- 0x1baa, 0x1baa,
+ 0x1baa, 0x1bab,
0x1bf2, 0x1bf3,
0x2d7f, 0x2d7f,
0xa806, 0xa806,
0xa8c4, 0xa8c4,
0xa953, 0xa953,
0xa9c0, 0xa9c0,
+ 0xaaf6, 0xaaf6,
0xabed, 0xabed,
0x10a3f, 0x10a3f,
0x11046, 0x11046,
0x110b9, 0x110b9,
+ 0x11133, 0x11134,
+ 0x111c0, 0x111c0,
+ 0x116b6, 0x116b6,
}; /* CR_Grapheme_Link */
/* 'Common': Script */
static const OnigCodePoint CR_Common[] = {
- 169,
+ 157,
0x0000, 0x0040,
0x005b, 0x0060,
0x007b, 0x00a9,
@@ -12434,7 +16019,6 @@ static const OnigCodePoint CR_Common[] = {
0x0660, 0x0669,
0x06dd, 0x06dd,
0x0964, 0x0965,
- 0x0970, 0x0970,
0x0e3f, 0x0e3f,
0x0fd5, 0x0fd8,
0x10fb, 0x10fb,
@@ -12445,7 +16029,8 @@ static const OnigCodePoint CR_Common[] = {
0x1cd3, 0x1cd3,
0x1ce1, 0x1ce1,
0x1ce9, 0x1cec,
- 0x1cee, 0x1cf2,
+ 0x1cee, 0x1cf3,
+ 0x1cf5, 0x1cf6,
0x2000, 0x200b,
0x200e, 0x2064,
0x206a, 0x2070,
@@ -12462,12 +16047,10 @@ static const OnigCodePoint CR_Common[] = {
0x2400, 0x2426,
0x2440, 0x244a,
0x2460, 0x26ff,
- 0x2701, 0x27ca,
- 0x27cc, 0x27cc,
- 0x27ce, 0x27ff,
+ 0x2701, 0x27ff,
0x2900, 0x2b4c,
0x2b50, 0x2b59,
- 0x2e00, 0x2e31,
+ 0x2e00, 0x2e3b,
0x2ff0, 0x2ffb,
0x3000, 0x3004,
0x3006, 0x3006,
@@ -12544,7 +16127,7 @@ static const OnigCodePoint CR_Common[] = {
0x1f0d1, 0x1f0df,
0x1f100, 0x1f10a,
0x1f110, 0x1f12e,
- 0x1f130, 0x1f169,
+ 0x1f130, 0x1f16b,
0x1f170, 0x1f19a,
0x1f1e6, 0x1f1ff,
0x1f201, 0x1f202,
@@ -12563,19 +16146,9 @@ static const OnigCodePoint CR_Common[] = {
0x1f442, 0x1f4f7,
0x1f4f9, 0x1f4fc,
0x1f500, 0x1f53d,
+ 0x1f540, 0x1f543,
0x1f550, 0x1f567,
- 0x1f5fb, 0x1f5ff,
- 0x1f601, 0x1f610,
- 0x1f612, 0x1f614,
- 0x1f616, 0x1f616,
- 0x1f618, 0x1f618,
- 0x1f61a, 0x1f61a,
- 0x1f61c, 0x1f61e,
- 0x1f620, 0x1f625,
- 0x1f628, 0x1f62b,
- 0x1f62d, 0x1f62d,
- 0x1f630, 0x1f633,
- 0x1f635, 0x1f640,
+ 0x1f5fb, 0x1f640,
0x1f645, 0x1f64f,
0x1f680, 0x1f6c5,
0x1f700, 0x1f773,
@@ -12610,9 +16183,9 @@ static const OnigCodePoint CR_Latin[] = {
0x2c60, 0x2c7f,
0xa722, 0xa787,
0xa78b, 0xa78e,
- 0xa790, 0xa791,
- 0xa7a0, 0xa7a9,
- 0xa7fa, 0xa7ff,
+ 0xa790, 0xa793,
+ 0xa7a0, 0xa7aa,
+ 0xa7f8, 0xa7ff,
0xfb00, 0xfb06,
0xff21, 0xff3a,
0xff41, 0xff5a,
@@ -12664,17 +16237,18 @@ static const OnigCodePoint CR_Cyrillic[] = {
0x1d2b, 0x1d2b,
0x1d78, 0x1d78,
0x2de0, 0x2dff,
- 0xa640, 0xa673,
- 0xa67c, 0xa697,
+ 0xa640, 0xa697,
+ 0xa69f, 0xa69f,
}; /* CR_Cyrillic */
/* 'Armenian': Script */
static const OnigCodePoint CR_Armenian[] = {
- 5,
+ 6,
0x0531, 0x0556,
0x0559, 0x055f,
0x0561, 0x0587,
0x058a, 0x058a,
+ 0x058f, 0x058f,
0xfb13, 0xfb17,
}; /* CR_Armenian */
@@ -12694,8 +16268,8 @@ static const OnigCodePoint CR_Hebrew[] = {
/* 'Arabic': Script */
static const OnigCodePoint CR_Arabic[] = {
- 19,
- 0x0600, 0x0603,
+ 56,
+ 0x0600, 0x0604,
0x0606, 0x060b,
0x060d, 0x061a,
0x061e, 0x061e,
@@ -12706,6 +16280,9 @@ static const OnigCodePoint CR_Arabic[] = {
0x0671, 0x06dc,
0x06de, 0x06ff,
0x0750, 0x077f,
+ 0x08a0, 0x08a0,
+ 0x08a2, 0x08ac,
+ 0x08e4, 0x08fe,
0xfb50, 0xfbc1,
0xfbd3, 0xfd3d,
0xfd50, 0xfd8f,
@@ -12714,6 +16291,40 @@ static const OnigCodePoint CR_Arabic[] = {
0xfe70, 0xfe74,
0xfe76, 0xfefc,
0x10e60, 0x10e7e,
+ 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,
}; /* CR_Arabic */
/* 'Syriac': Script */
@@ -12732,11 +16343,10 @@ static const OnigCodePoint CR_Thaana[] = {
/* 'Devanagari': Script */
static const OnigCodePoint CR_Devanagari[] = {
- 6,
+ 5,
0x0900, 0x0950,
0x0953, 0x0963,
- 0x0966, 0x096f,
- 0x0971, 0x0977,
+ 0x0966, 0x0977,
0x0979, 0x097f,
0xa8e0, 0xa8fb,
}; /* CR_Devanagari */
@@ -12783,7 +16393,7 @@ static const OnigCodePoint CR_Gurmukhi[] = {
/* 'Gujarati': Script */
static const OnigCodePoint CR_Gujarati[] = {
- 14,
+ 13,
0x0a81, 0x0a83,
0x0a85, 0x0a8d,
0x0a8f, 0x0a91,
@@ -12796,8 +16406,7 @@ static const OnigCodePoint CR_Gujarati[] = {
0x0acb, 0x0acd,
0x0ad0, 0x0ad0,
0x0ae0, 0x0ae3,
- 0x0ae6, 0x0aef,
- 0x0af1, 0x0af1,
+ 0x0ae6, 0x0af1,
}; /* CR_Gujarati */
/* 'Oriya': Script */
@@ -12937,7 +16546,7 @@ static const OnigCodePoint CR_Lao[] = {
0x0ec6, 0x0ec6,
0x0ec8, 0x0ecd,
0x0ed0, 0x0ed9,
- 0x0edc, 0x0edd,
+ 0x0edc, 0x0edf,
}; /* CR_Lao */
/* 'Tibetan': Script */
@@ -12961,11 +16570,15 @@ static const OnigCodePoint CR_Myanmar[] = {
/* 'Georgian': Script */
static const OnigCodePoint CR_Georgian[] = {
- 4,
+ 8,
0x10a0, 0x10c5,
+ 0x10c7, 0x10c7,
+ 0x10cd, 0x10cd,
0x10d0, 0x10fa,
- 0x10fc, 0x10fc,
+ 0x10fc, 0x10ff,
0x2d00, 0x2d25,
+ 0x2d27, 0x2d27,
+ 0x2d2d, 0x2d2d,
}; /* CR_Georgian */
/* 'Hangul': Script */
@@ -13102,7 +16715,7 @@ static const OnigCodePoint CR_Bopomofo[] = {
/* 'Han': Script */
static const OnigCodePoint CR_Han[] = {
- 16,
+ 15,
0x2e80, 0x2e99,
0x2e9b, 0x2ef3,
0x2f00, 0x2fd5,
@@ -13111,9 +16724,8 @@ static const OnigCodePoint CR_Han[] = {
0x3021, 0x3029,
0x3038, 0x303b,
0x3400, 0x4db5,
- 0x4e00, 0x9fcb,
- 0xf900, 0xfa2d,
- 0xfa30, 0xfa6d,
+ 0x4e00, 0x9fcc,
+ 0xf900, 0xfa6d,
0xfa70, 0xfad9,
0x20000, 0x2a6d6,
0x2a700, 0x2b734,
@@ -13149,7 +16761,7 @@ static const OnigCodePoint CR_Deseret[] = {
/* 'Inherited': Script */
static const OnigCodePoint CR_Inherited[] = {
- 24,
+ 25,
0x0300, 0x036f,
0x0485, 0x0486,
0x064b, 0x0655,
@@ -13160,6 +16772,7 @@ static const OnigCodePoint CR_Inherited[] = {
0x1cd4, 0x1ce0,
0x1ce2, 0x1ce8,
0x1ced, 0x1ced,
+ 0x1cf4, 0x1cf4,
0x1dc0, 0x1de6,
0x1dfc, 0x1dff,
0x200c, 0x200d,
@@ -13280,7 +16893,7 @@ static const OnigCodePoint CR_Buginese[] = {
static const OnigCodePoint CR_Coptic[] = {
3,
0x03e2, 0x03ef,
- 0x2c80, 0x2cf1,
+ 0x2c80, 0x2cf3,
0x2cf9, 0x2cff,
}; /* CR_Coptic */
@@ -13303,7 +16916,7 @@ static const OnigCodePoint CR_Glagolitic[] = {
/* 'Tifinagh': Script */
static const OnigCodePoint CR_Tifinagh[] = {
3,
- 0x2d30, 0x2d65,
+ 0x2d30, 0x2d67,
0x2d6f, 0x2d70,
0x2d7f, 0x2d7f,
}; /* CR_Tifinagh */
@@ -13371,8 +16984,8 @@ static const OnigCodePoint CR_Nko[] = {
/* 'Sundanese': Script */
static const OnigCodePoint CR_Sundanese[] = {
2,
- 0x1b80, 0x1baa,
- 0x1bae, 0x1bb9,
+ 0x1b80, 0x1bbf,
+ 0x1cc0, 0x1cc7,
}; /* CR_Sundanese */
/* 'Lepcha': Script */
@@ -13503,7 +17116,8 @@ static const OnigCodePoint CR_Javanese[] = {
/* 'Meetei_Mayek': Script */
static const OnigCodePoint CR_Meetei_Mayek[] = {
- 2,
+ 3,
+ 0xaae0, 0xaaf6,
0xabc0, 0xabed,
0xabf0, 0xabf9,
}; /* CR_Meetei_Mayek */
@@ -13568,21 +17182,57 @@ static const OnigCodePoint CR_Mandaic[] = {
0x085e, 0x085e,
}; /* CR_Mandaic */
+/* 'Chakma': Script */
+static const OnigCodePoint CR_Chakma[] = {
+ 2,
+ 0x11100, 0x11134,
+ 0x11136, 0x11143,
+}; /* CR_Chakma */
+
+/* 'Meroitic_Cursive': Script */
+static const OnigCodePoint CR_Meroitic_Cursive[] = {
+ 2,
+ 0x109a0, 0x109b7,
+ 0x109be, 0x109bf,
+}; /* CR_Meroitic_Cursive */
+
+/* 'Meroitic_Hieroglyphs': Script */
+static const OnigCodePoint CR_Meroitic_Hieroglyphs[] = {
+ 1,
+ 0x10980, 0x1099f,
+}; /* CR_Meroitic_Hieroglyphs */
+
+/* 'Miao': Script */
+static const OnigCodePoint CR_Miao[] = {
+ 3,
+ 0x16f00, 0x16f44,
+ 0x16f50, 0x16f7e,
+ 0x16f8f, 0x16f9f,
+}; /* CR_Miao */
+
+/* 'Sharada': Script */
+static const OnigCodePoint CR_Sharada[] = {
+ 2,
+ 0x11180, 0x111c8,
+ 0x111d0, 0x111d9,
+}; /* CR_Sharada */
+
+/* 'Sora_Sompeng': Script */
+static const OnigCodePoint CR_Sora_Sompeng[] = {
+ 2,
+ 0x110d0, 0x110e8,
+ 0x110f0, 0x110f9,
+}; /* CR_Sora_Sompeng */
+
+/* 'Takri': Script */
+static const OnigCodePoint CR_Takri[] = {
+ 2,
+ 0x11680, 0x116b7,
+ 0x116c0, 0x116c9,
+}; /* CR_Takri */
+
/* 'White_Space': Binary Property */
-static const OnigCodePoint CR_White_Space[] = {
- 11,
- 0x0009, 0x000d,
- 0x0020, 0x0020,
- 0x0085, 0x0085,
- 0x00a0, 0x00a0,
- 0x1680, 0x1680,
- 0x180e, 0x180e,
- 0x2000, 0x200a,
- 0x2028, 0x2029,
- 0x202f, 0x202f,
- 0x205f, 0x205f,
- 0x3000, 0x3000,
-}; /* CR_White_Space */
+#define CR_White_Space CR_Space
/* 'Bidi_Control': Binary Property */
static const OnigCodePoint CR_Bidi_Control[] = {
@@ -13599,7 +17249,7 @@ static const OnigCodePoint CR_Join_Control[] = {
/* 'Dash': Binary Property */
static const OnigCodePoint CR_Dash[] = {
- 19,
+ 20,
0x002d, 0x002d,
0x058a, 0x058a,
0x05be, 0x05be,
@@ -13612,6 +17262,7 @@ static const OnigCodePoint CR_Dash[] = {
0x2212, 0x2212,
0x2e17, 0x2e17,
0x2e1a, 0x2e1a,
+ 0x2e3a, 0x2e3b,
0x301c, 0x301c,
0x3030, 0x3030,
0x30a0, 0x30a0,
@@ -13655,7 +17306,7 @@ static const OnigCodePoint CR_Quotation_Mark[] = {
/* 'Terminal_Punctuation': Binary Property */
static const OnigCodePoint CR_Terminal_Punctuation[] = {
- 67,
+ 70,
0x0021, 0x0021,
0x002c, 0x002c,
0x002e, 0x002e,
@@ -13705,6 +17356,7 @@ static const OnigCodePoint CR_Terminal_Punctuation[] = {
0xa9c7, 0xa9c9,
0xaa5d, 0xaa5f,
0xaadf, 0xaadf,
+ 0xaaf0, 0xaaf1,
0xabeb, 0xabeb,
0xfe50, 0xfe52,
0xfe54, 0xfe57,
@@ -13722,12 +17374,14 @@ static const OnigCodePoint CR_Terminal_Punctuation[] = {
0x10b3a, 0x10b3f,
0x11047, 0x1104d,
0x110be, 0x110c1,
+ 0x11141, 0x11143,
+ 0x111c5, 0x111c6,
0x12470, 0x12473,
}; /* CR_Terminal_Punctuation */
/* 'Other_Math': Binary Property */
static const OnigCodePoint CR_Other_Math[] = {
- 100,
+ 133,
0x005e, 0x005e,
0x03d0, 0x03d2,
0x03d5, 0x03d5,
@@ -13828,6 +17482,39 @@ static const OnigCodePoint CR_Other_Math[] = {
0x1d7aa, 0x1d7c2,
0x1d7c4, 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,
}; /* CR_Other_Math */
/* 'Hex_Digit': Binary Property */
@@ -13842,16 +17529,11 @@ static const OnigCodePoint CR_Hex_Digit[] = {
}; /* CR_Hex_Digit */
/* 'ASCII_Hex_Digit': Binary Property */
-static const OnigCodePoint CR_ASCII_Hex_Digit[] = {
- 3,
- 0x0030, 0x0039,
- 0x0041, 0x0046,
- 0x0061, 0x0066,
-}; /* CR_ASCII_Hex_Digit */
+#define CR_ASCII_Hex_Digit CR_XDigit
/* 'Other_Alphabetic': Binary Property */
static const OnigCodePoint CR_Other_Alphabetic[] = {
- 145,
+ 158,
0x0345, 0x0345,
0x05b0, 0x05bd,
0x05bf, 0x05bf,
@@ -13873,6 +17555,8 @@ static const OnigCodePoint CR_Other_Alphabetic[] = {
0x081b, 0x0823,
0x0825, 0x0827,
0x0829, 0x082c,
+ 0x08e4, 0x08e9,
+ 0x08f0, 0x08fe,
0x0900, 0x0903,
0x093a, 0x093b,
0x093e, 0x094c,
@@ -13969,11 +17653,14 @@ static const OnigCodePoint CR_Other_Alphabetic[] = {
0x1b35, 0x1b43,
0x1b80, 0x1b82,
0x1ba1, 0x1ba9,
+ 0x1bac, 0x1bad,
0x1be7, 0x1bf1,
0x1c24, 0x1c35,
- 0x1cf2, 0x1cf2,
+ 0x1cf2, 0x1cf3,
0x24b6, 0x24e9,
0x2de0, 0x2dff,
+ 0xa674, 0xa67b,
+ 0xa69f, 0xa69f,
0xa823, 0xa827,
0xa880, 0xa881,
0xa8b4, 0xa8c3,
@@ -13988,6 +17675,8 @@ static const OnigCodePoint CR_Other_Alphabetic[] = {
0xaab2, 0xaab4,
0xaab7, 0xaab8,
0xaabe, 0xaabe,
+ 0xaaeb, 0xaaef,
+ 0xaaf5, 0xaaf5,
0xabe3, 0xabea,
0xfb1e, 0xfb1e,
0x10a01, 0x10a03,
@@ -13997,18 +17686,23 @@ static const OnigCodePoint CR_Other_Alphabetic[] = {
0x11038, 0x11045,
0x11082, 0x11082,
0x110b0, 0x110b8,
+ 0x11100, 0x11102,
+ 0x11127, 0x11132,
+ 0x11180, 0x11182,
+ 0x111b3, 0x111bf,
+ 0x116ab, 0x116b5,
+ 0x16f51, 0x16f7e,
}; /* CR_Other_Alphabetic */
/* 'Ideographic': Binary Property */
static const OnigCodePoint CR_Ideographic[] = {
- 12,
+ 11,
0x3006, 0x3007,
0x3021, 0x3029,
0x3038, 0x303a,
0x3400, 0x4db5,
- 0x4e00, 0x9fcb,
- 0xf900, 0xfa2d,
- 0xfa30, 0xfa6d,
+ 0x4e00, 0x9fcc,
+ 0xf900, 0xfa6d,
0xfa70, 0xfad9,
0x20000, 0x2a6d6,
0x2a700, 0x2b734,
@@ -14018,7 +17712,7 @@ static const OnigCodePoint CR_Ideographic[] = {
/* 'Diacritic': Binary Property */
static const OnigCodePoint CR_Diacritic[] = {
- 117,
+ 125,
0x005e, 0x005e,
0x0060, 0x0060,
0x00a8, 0x00a8,
@@ -14047,6 +17741,7 @@ static const OnigCodePoint CR_Diacritic[] = {
0x07a6, 0x07b0,
0x07eb, 0x07f5,
0x0818, 0x0819,
+ 0x08e4, 0x08fe,
0x093c, 0x093c,
0x094d, 0x094d,
0x0951, 0x0954,
@@ -14089,11 +17784,12 @@ static const OnigCodePoint CR_Diacritic[] = {
0x1b34, 0x1b34,
0x1b44, 0x1b44,
0x1b6b, 0x1b73,
- 0x1baa, 0x1baa,
+ 0x1baa, 0x1bab,
0x1c36, 0x1c37,
0x1c78, 0x1c7d,
0x1cd0, 0x1ce8,
0x1ced, 0x1ced,
+ 0x1cf4, 0x1cf4,
0x1d2c, 0x1d6a,
0x1dc4, 0x1dcf,
0x1dfd, 0x1dff,
@@ -14114,6 +17810,7 @@ static const OnigCodePoint CR_Diacritic[] = {
0xa6f0, 0xa6f1,
0xa717, 0xa721,
0xa788, 0xa788,
+ 0xa7f8, 0xa7f9,
0xa8c4, 0xa8c4,
0xa8e0, 0xa8f1,
0xa92b, 0xa92e,
@@ -14122,6 +17819,7 @@ static const OnigCodePoint CR_Diacritic[] = {
0xa9c0, 0xa9c0,
0xaa7b, 0xaa7b,
0xaabf, 0xaac2,
+ 0xaaf6, 0xaaf6,
0xabec, 0xabed,
0xfb1e, 0xfb1e,
0xfe20, 0xfe26,
@@ -14131,6 +17829,10 @@ static const OnigCodePoint CR_Diacritic[] = {
0xff9e, 0xff9f,
0xffe3, 0xffe3,
0x110b9, 0x110ba,
+ 0x11133, 0x11134,
+ 0x111c0, 0x111c0,
+ 0x116b6, 0x116b7,
+ 0x16f8f, 0x16f9f,
0x1d167, 0x1d169,
0x1d16d, 0x1d172,
0x1d17b, 0x1d182,
@@ -14140,13 +17842,14 @@ static const OnigCodePoint CR_Diacritic[] = {
/* 'Extender': Binary Property */
static const OnigCodePoint CR_Extender[] = {
- 20,
+ 22,
0x00b7, 0x00b7,
0x02d0, 0x02d1,
0x0640, 0x0640,
0x07fa, 0x07fa,
0x0e46, 0x0e46,
0x0ec6, 0x0ec6,
+ 0x180a, 0x180a,
0x1843, 0x1843,
0x1aa7, 0x1aa7,
0x1c36, 0x1c36,
@@ -14160,25 +17863,31 @@ static const OnigCodePoint CR_Extender[] = {
0xa9cf, 0xa9cf,
0xaa70, 0xaa70,
0xaadd, 0xaadd,
+ 0xaaf3, 0xaaf4,
0xff70, 0xff70,
}; /* CR_Extender */
/* 'Other_Lowercase': Binary Property */
static const OnigCodePoint CR_Other_Lowercase[] = {
- 13,
+ 18,
+ 0x00aa, 0x00aa,
+ 0x00ba, 0x00ba,
0x02b0, 0x02b8,
0x02c0, 0x02c1,
0x02e0, 0x02e4,
0x0345, 0x0345,
0x037a, 0x037a,
- 0x1d2c, 0x1d61,
+ 0x1d2c, 0x1d6a,
0x1d78, 0x1d78,
0x1d9b, 0x1dbf,
- 0x2090, 0x2094,
+ 0x2071, 0x2071,
+ 0x207f, 0x207f,
+ 0x2090, 0x209c,
0x2170, 0x217f,
0x24d0, 0x24e9,
- 0x2c7d, 0x2c7d,
+ 0x2c7c, 0x2c7d,
0xa770, 0xa770,
+ 0xa7f8, 0xa7f9,
}; /* CR_Other_Lowercase */
/* 'Other_Uppercase': Binary Property */
@@ -14213,7 +17922,7 @@ static const OnigCodePoint CR_Noncharacter_Code_Point[] = {
/* 'Other_Grapheme_Extend': Binary Property */
static const OnigCodePoint CR_Other_Grapheme_Extend[] = {
- 16,
+ 17,
0x09be, 0x09be,
0x09d7, 0x09d7,
0x0b3e, 0x0b3e,
@@ -14227,6 +17936,7 @@ static const OnigCodePoint CR_Other_Grapheme_Extend[] = {
0x0dcf, 0x0dcf,
0x0ddf, 0x0ddf,
0x200c, 0x200d,
+ 0x302e, 0x302f,
0xff9e, 0xff9f,
0x1d165, 0x1d165,
0x1d16e, 0x1d172,
@@ -14257,7 +17967,7 @@ static const OnigCodePoint CR_Radical[] = {
static const OnigCodePoint CR_Unified_Ideograph[] = {
12,
0x3400, 0x4db5,
- 0x4e00, 0x9fcb,
+ 0x4e00, 0x9fcc,
0xfa0e, 0xfa0f,
0xfa11, 0xfa11,
0xfa13, 0xfa14,
@@ -14272,9 +17982,10 @@ static const OnigCodePoint CR_Unified_Ideograph[] = {
/* 'Other_Default_Ignorable_Code_Point': Binary Property */
static const OnigCodePoint CR_Other_Default_Ignorable_Code_Point[] = {
- 10,
+ 11,
0x034f, 0x034f,
0x115f, 0x1160,
+ 0x17b4, 0x17b5,
0x2065, 0x2069,
0x3164, 0x3164,
0xffa0, 0xffa0,
@@ -14364,7 +18075,7 @@ static const OnigCodePoint CR_Other_ID_Continue[] = {
/* 'STerm': Binary Property */
static const OnigCodePoint CR_STerm[] = {
- 47,
+ 50,
0x0021, 0x0021,
0x002e, 0x002e,
0x003f, 0x003f,
@@ -14402,6 +18113,7 @@ static const OnigCodePoint CR_STerm[] = {
0xa92f, 0xa92f,
0xa9c8, 0xa9c9,
0xaa5d, 0xaa5f,
+ 0xaaf0, 0xaaf1,
0xabeb, 0xabeb,
0xfe52, 0xfe52,
0xfe56, 0xfe57,
@@ -14412,6 +18124,8 @@ static const OnigCodePoint CR_STerm[] = {
0x10a56, 0x10a57,
0x11047, 0x11048,
0x110be, 0x110c1,
+ 0x11141, 0x11143,
+ 0x111c5, 0x111c6,
}; /* CR_STerm */
/* 'Variation_Selector': Binary Property */
@@ -14467,7 +18181,7 @@ static const OnigCodePoint CR_Pattern_Syntax[] = {
/* 'Unknown': Script */
static const OnigCodePoint CR_Unknown[] = {
- 499,
+ 537,
0x0378, 0x0379,
0x037f, 0x0383,
0x038b, 0x038b,
@@ -14477,11 +18191,12 @@ static const OnigCodePoint CR_Unknown[] = {
0x0557, 0x0558,
0x0560, 0x0560,
0x0588, 0x0588,
- 0x058b, 0x0590,
+ 0x058b, 0x058e,
+ 0x0590, 0x0590,
0x05c8, 0x05cf,
0x05eb, 0x05ef,
0x05f5, 0x05ff,
- 0x0604, 0x0605,
+ 0x0605, 0x0605,
0x061c, 0x061d,
0x070e, 0x070e,
0x074b, 0x074c,
@@ -14490,7 +18205,10 @@ static const OnigCodePoint CR_Unknown[] = {
0x082e, 0x082f,
0x083f, 0x083f,
0x085c, 0x085d,
- 0x085f, 0x08ff,
+ 0x085f, 0x089f,
+ 0x08a1, 0x08a1,
+ 0x08ad, 0x08e3,
+ 0x08ff, 0x08ff,
0x0978, 0x0978,
0x0980, 0x0980,
0x0984, 0x0984,
@@ -14535,7 +18253,6 @@ static const OnigCodePoint CR_Unknown[] = {
0x0ace, 0x0acf,
0x0ad1, 0x0adf,
0x0ae4, 0x0ae5,
- 0x0af0, 0x0af0,
0x0af2, 0x0b00,
0x0b04, 0x0b04,
0x0b0d, 0x0b0e,
@@ -14636,15 +18353,16 @@ static const OnigCodePoint CR_Unknown[] = {
0x0ec7, 0x0ec7,
0x0ece, 0x0ecf,
0x0eda, 0x0edb,
- 0x0ede, 0x0eff,
+ 0x0ee0, 0x0eff,
0x0f48, 0x0f48,
0x0f6d, 0x0f70,
0x0f98, 0x0f98,
0x0fbd, 0x0fbd,
0x0fcd, 0x0fcd,
0x0fdb, 0x0fff,
- 0x10c6, 0x10cf,
- 0x10fd, 0x10ff,
+ 0x10c6, 0x10c6,
+ 0x10c8, 0x10cc,
+ 0x10ce, 0x10cf,
0x1249, 0x1249,
0x124e, 0x124f,
0x1257, 0x1257,
@@ -14698,13 +18416,12 @@ static const OnigCodePoint CR_Unknown[] = {
0x1aae, 0x1aff,
0x1b4c, 0x1b4f,
0x1b7d, 0x1b7f,
- 0x1bab, 0x1bad,
- 0x1bba, 0x1bbf,
0x1bf4, 0x1bfb,
0x1c38, 0x1c3a,
0x1c4a, 0x1c4c,
- 0x1c80, 0x1ccf,
- 0x1cf3, 0x1cff,
+ 0x1c80, 0x1cbf,
+ 0x1cc8, 0x1ccf,
+ 0x1cf7, 0x1cff,
0x1de7, 0x1dfb,
0x1f16, 0x1f17,
0x1f1e, 0x1f1f,
@@ -14733,15 +18450,15 @@ static const OnigCodePoint CR_Unknown[] = {
0x2427, 0x243f,
0x244b, 0x245f,
0x2700, 0x2700,
- 0x27cb, 0x27cb,
- 0x27cd, 0x27cd,
0x2b4d, 0x2b4f,
0x2b5a, 0x2bff,
0x2c2f, 0x2c2f,
0x2c5f, 0x2c5f,
- 0x2cf2, 0x2cf8,
- 0x2d26, 0x2d2f,
- 0x2d66, 0x2d6e,
+ 0x2cf4, 0x2cf8,
+ 0x2d26, 0x2d26,
+ 0x2d28, 0x2d2c,
+ 0x2d2e, 0x2d2f,
+ 0x2d68, 0x2d6e,
0x2d71, 0x2d7e,
0x2d97, 0x2d9f,
0x2da7, 0x2da7,
@@ -14752,7 +18469,7 @@ static const OnigCodePoint CR_Unknown[] = {
0x2dcf, 0x2dcf,
0x2dd7, 0x2dd7,
0x2ddf, 0x2ddf,
- 0x2e32, 0x2e7f,
+ 0x2e3c, 0x2e7f,
0x2e9a, 0x2e9a,
0x2ef4, 0x2eff,
0x2fd6, 0x2fef,
@@ -14767,16 +18484,15 @@ static const OnigCodePoint CR_Unknown[] = {
0x321f, 0x321f,
0x32ff, 0x32ff,
0x4db6, 0x4dbf,
- 0x9fcc, 0x9fff,
+ 0x9fcd, 0x9fff,
0xa48d, 0xa48f,
0xa4c7, 0xa4cf,
0xa62c, 0xa63f,
- 0xa674, 0xa67b,
- 0xa698, 0xa69f,
+ 0xa698, 0xa69e,
0xa6f8, 0xa6ff,
0xa78f, 0xa78f,
- 0xa792, 0xa79f,
- 0xa7aa, 0xa7f9,
+ 0xa794, 0xa79f,
+ 0xa7ab, 0xa7f7,
0xa82c, 0xa82f,
0xa83a, 0xa83f,
0xa878, 0xa87f,
@@ -14793,7 +18509,7 @@ static const OnigCodePoint CR_Unknown[] = {
0xaa5a, 0xaa5b,
0xaa7c, 0xaa7f,
0xaac3, 0xaada,
- 0xaae0, 0xab00,
+ 0xaaf7, 0xab00,
0xab07, 0xab08,
0xab0f, 0xab10,
0xab17, 0xab1f,
@@ -14804,7 +18520,6 @@ static const OnigCodePoint CR_Unknown[] = {
0xd7a4, 0xd7af,
0xd7c7, 0xd7ca,
0xd7fc, 0xf8ff,
- 0xfa2e, 0xfa2f,
0xfa6e, 0xfa6f,
0xfada, 0xfaff,
0xfb07, 0xfb12,
@@ -14866,7 +18581,9 @@ static const OnigCodePoint CR_Unknown[] = {
0x10860, 0x108ff,
0x1091c, 0x1091e,
0x1093a, 0x1093e,
- 0x10940, 0x109ff,
+ 0x10940, 0x1097f,
+ 0x109b8, 0x109bd,
+ 0x109c0, 0x109ff,
0x10a04, 0x10a04,
0x10a07, 0x10a0b,
0x10a14, 0x10a14,
@@ -14884,12 +18601,23 @@ static const OnigCodePoint CR_Unknown[] = {
0x10e7f, 0x10fff,
0x1104e, 0x11051,
0x11070, 0x1107f,
- 0x110c2, 0x11fff,
+ 0x110c2, 0x110cf,
+ 0x110e9, 0x110ef,
+ 0x110fa, 0x110ff,
+ 0x11135, 0x11135,
+ 0x11144, 0x1117f,
+ 0x111c9, 0x111cf,
+ 0x111da, 0x1167f,
+ 0x116b8, 0x116bf,
+ 0x116ca, 0x11fff,
0x1236f, 0x123ff,
0x12463, 0x1246f,
0x12474, 0x12fff,
0x1342f, 0x167ff,
- 0x16a39, 0x1afff,
+ 0x16a39, 0x16eff,
+ 0x16f45, 0x16f4f,
+ 0x16f7f, 0x16f8e,
+ 0x16fa0, 0x1afff,
0x1b002, 0x1cfff,
0x1d0f6, 0x1d0ff,
0x1d127, 0x1d128,
@@ -14917,7 +18645,41 @@ static const OnigCodePoint CR_Unknown[] = {
0x1d551, 0x1d551,
0x1d6a6, 0x1d6a7,
0x1d7cc, 0x1d7cd,
- 0x1d800, 0x1efff,
+ 0x1d800, 0x1edff,
+ 0x1ee04, 0x1ee04,
+ 0x1ee20, 0x1ee20,
+ 0x1ee23, 0x1ee23,
+ 0x1ee25, 0x1ee26,
+ 0x1ee28, 0x1ee28,
+ 0x1ee33, 0x1ee33,
+ 0x1ee38, 0x1ee38,
+ 0x1ee3a, 0x1ee3a,
+ 0x1ee3c, 0x1ee41,
+ 0x1ee43, 0x1ee46,
+ 0x1ee48, 0x1ee48,
+ 0x1ee4a, 0x1ee4a,
+ 0x1ee4c, 0x1ee4c,
+ 0x1ee50, 0x1ee50,
+ 0x1ee53, 0x1ee53,
+ 0x1ee55, 0x1ee56,
+ 0x1ee58, 0x1ee58,
+ 0x1ee5a, 0x1ee5a,
+ 0x1ee5c, 0x1ee5c,
+ 0x1ee5e, 0x1ee5e,
+ 0x1ee60, 0x1ee60,
+ 0x1ee63, 0x1ee63,
+ 0x1ee65, 0x1ee66,
+ 0x1ee6b, 0x1ee6b,
+ 0x1ee73, 0x1ee73,
+ 0x1ee78, 0x1ee78,
+ 0x1ee7d, 0x1ee7d,
+ 0x1ee7f, 0x1ee7f,
+ 0x1ee8a, 0x1ee8a,
+ 0x1ee9c, 0x1eea0,
+ 0x1eea4, 0x1eea4,
+ 0x1eeaa, 0x1eeaa,
+ 0x1eebc, 0x1eeef,
+ 0x1eef2, 0x1efff,
0x1f02c, 0x1f02f,
0x1f094, 0x1f09f,
0x1f0af, 0x1f0b0,
@@ -14926,7 +18688,7 @@ static const OnigCodePoint CR_Unknown[] = {
0x1f0e0, 0x1f0ff,
0x1f10b, 0x1f10f,
0x1f12f, 0x1f12f,
- 0x1f16a, 0x1f16f,
+ 0x1f16c, 0x1f16f,
0x1f19b, 0x1f1e5,
0x1f203, 0x1f20f,
0x1f23b, 0x1f23f,
@@ -14943,19 +18705,9 @@ static const OnigCodePoint CR_Unknown[] = {
0x1f441, 0x1f441,
0x1f4f8, 0x1f4f8,
0x1f4fd, 0x1f4ff,
- 0x1f53e, 0x1f54f,
+ 0x1f53e, 0x1f53f,
+ 0x1f544, 0x1f54f,
0x1f568, 0x1f5fa,
- 0x1f600, 0x1f600,
- 0x1f611, 0x1f611,
- 0x1f615, 0x1f615,
- 0x1f617, 0x1f617,
- 0x1f619, 0x1f619,
- 0x1f61b, 0x1f61b,
- 0x1f61f, 0x1f61f,
- 0x1f626, 0x1f627,
- 0x1f62c, 0x1f62c,
- 0x1f62e, 0x1f62f,
- 0x1f634, 0x1f634,
0x1f641, 0x1f644,
0x1f650, 0x1f67f,
0x1f6c6, 0x1f6ff,
@@ -14968,8 +18720,6 @@ static const OnigCodePoint CR_Unknown[] = {
0xe0080, 0xe00ff,
0xe01f0, 0x10ffff,
}; /* CR_Unknown */
-#endif /* USE_UNICODE_PROPERTIES */
-#endif /* USE_UNICODE_PROPERTIES */
/* 'Age_1_1': Derived Age 1.1 */
static const OnigCodePoint CR_Age_1_1[] = {
@@ -19854,554 +23604,10 @@ static const OnigCodePoint CR_Age_6_0[] = {
0xefffe, 0x10ffff,
}; /* CR_Age_6_0 */
-/* 'NEWLINE': [[:NEWLINE:]] */
-static const OnigCodePoint CR_NEWLINE[] = {
- 1,
- 0x000a, 0x000a,
-}; /* CR_NEWLINE */
-
-/* 'Alpha': [[:Alpha:]] */
-#define CR_Alpha CR_Alphabetic
-
-/* 'Blank': [[:Blank:]] */
-static const OnigCodePoint CR_Blank[] = {
- 9,
- 0x0009, 0x0009,
- 0x0020, 0x0020,
- 0x00a0, 0x00a0,
- 0x1680, 0x1680,
- 0x180e, 0x180e,
- 0x2000, 0x200a,
- 0x202f, 0x202f,
- 0x205f, 0x205f,
- 0x3000, 0x3000,
-}; /* CR_Blank */
-
-/* 'Cntrl': [[:Cntrl:]] */
-#define CR_Cntrl CR_Cc
-
-/* 'Digit': [[:Digit:]] */
-#define CR_Digit CR_Nd
-
-/* 'Graph': [[:Graph:]] */
-static const OnigCodePoint CR_Graph[] = {
- 506,
- 0x0021, 0x007e,
- 0x00a1, 0x0377,
- 0x037a, 0x037e,
- 0x0384, 0x038a,
- 0x038c, 0x038c,
- 0x038e, 0x03a1,
- 0x03a3, 0x0527,
- 0x0531, 0x0556,
- 0x0559, 0x055f,
- 0x0561, 0x0587,
- 0x0589, 0x058a,
- 0x0591, 0x05c7,
- 0x05d0, 0x05ea,
- 0x05f0, 0x05f4,
- 0x0600, 0x0603,
- 0x0606, 0x061b,
- 0x061e, 0x070d,
- 0x070f, 0x074a,
- 0x074d, 0x07b1,
- 0x07c0, 0x07fa,
- 0x0800, 0x082d,
- 0x0830, 0x083e,
- 0x0840, 0x085b,
- 0x085e, 0x085e,
- 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, 0x0aef,
- 0x0af1, 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, 0x0edd,
- 0x0f00, 0x0f47,
- 0x0f49, 0x0f6c,
- 0x0f71, 0x0f97,
- 0x0f99, 0x0fbc,
- 0x0fbe, 0x0fcc,
- 0x0fce, 0x0fda,
- 0x1000, 0x10c5,
- 0x10d0, 0x10fc,
- 0x1100, 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, 0x167f,
- 0x1681, 0x169c,
- 0x16a0, 0x16f0,
- 0x1700, 0x170c,
- 0x170e, 0x1714,
- 0x1720, 0x1736,
- 0x1740, 0x1753,
- 0x1760, 0x176c,
- 0x176e, 0x1770,
- 0x1772, 0x1773,
- 0x1780, 0x17dd,
- 0x17e0, 0x17e9,
- 0x17f0, 0x17f9,
- 0x1800, 0x180d,
- 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, 0x1baa,
- 0x1bae, 0x1bb9,
- 0x1bc0, 0x1bf3,
- 0x1bfc, 0x1c37,
- 0x1c3b, 0x1c49,
- 0x1c4d, 0x1c7f,
- 0x1cd0, 0x1cf2,
- 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,
- 0x200b, 0x2027,
- 0x202a, 0x202e,
- 0x2030, 0x205e,
- 0x2060, 0x2064,
- 0x206a, 0x2071,
- 0x2074, 0x208e,
- 0x2090, 0x209c,
- 0x20a0, 0x20b9,
- 0x20d0, 0x20f0,
- 0x2100, 0x2189,
- 0x2190, 0x23f3,
- 0x2400, 0x2426,
- 0x2440, 0x244a,
- 0x2460, 0x26ff,
- 0x2701, 0x27ca,
- 0x27cc, 0x27cc,
- 0x27ce, 0x2b4c,
- 0x2b50, 0x2b59,
- 0x2c00, 0x2c2e,
- 0x2c30, 0x2c5e,
- 0x2c60, 0x2cf1,
- 0x2cf9, 0x2d25,
- 0x2d30, 0x2d65,
- 0x2d6f, 0x2d70,
- 0x2d7f, 0x2d96,
- 0x2da0, 0x2da6,
- 0x2da8, 0x2dae,
- 0x2db0, 0x2db6,
- 0x2db8, 0x2dbe,
- 0x2dc0, 0x2dc6,
- 0x2dc8, 0x2dce,
- 0x2dd0, 0x2dd6,
- 0x2dd8, 0x2dde,
- 0x2de0, 0x2e31,
- 0x2e80, 0x2e99,
- 0x2e9b, 0x2ef3,
- 0x2f00, 0x2fd5,
- 0x2ff0, 0x2ffb,
- 0x3001, 0x303f,
- 0x3041, 0x3096,
- 0x3099, 0x30ff,
- 0x3105, 0x312d,
- 0x3131, 0x318e,
- 0x3190, 0x31ba,
- 0x31c0, 0x31e3,
- 0x31f0, 0x321e,
- 0x3220, 0x32fe,
- 0x3300, 0x4db5,
- 0x4dc0, 0x9fcb,
- 0xa000, 0xa48c,
- 0xa490, 0xa4c6,
- 0xa4d0, 0xa62b,
- 0xa640, 0xa673,
- 0xa67c, 0xa697,
- 0xa6a0, 0xa6f7,
- 0xa700, 0xa78e,
- 0xa790, 0xa791,
- 0xa7a0, 0xa7a9,
- 0xa7fa, 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, 0xaadf,
- 0xab01, 0xab06,
- 0xab09, 0xab0e,
- 0xab11, 0xab16,
- 0xab20, 0xab26,
- 0xab28, 0xab2e,
- 0xabc0, 0xabed,
- 0xabf0, 0xabf9,
- 0xac00, 0xd7a3,
- 0xd7b0, 0xd7c6,
- 0xd7cb, 0xd7fb,
- 0xe000, 0xfa2d,
- 0xfa30, 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,
- 0xfdf0, 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, 0xfffd,
- 0x10000, 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,
- 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,
- 0x12000, 0x1236e,
- 0x12400, 0x12462,
- 0x12470, 0x12473,
- 0x13000, 0x1342e,
- 0x16800, 0x16a38,
- 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,
- 0x1f000, 0x1f02b,
- 0x1f030, 0x1f093,
- 0x1f0a0, 0x1f0ae,
- 0x1f0b1, 0x1f0be,
- 0x1f0c1, 0x1f0cf,
- 0x1f0d1, 0x1f0df,
- 0x1f100, 0x1f10a,
- 0x1f110, 0x1f12e,
- 0x1f130, 0x1f169,
- 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,
- 0x1f550, 0x1f567,
- 0x1f5fb, 0x1f5ff,
- 0x1f601, 0x1f610,
- 0x1f612, 0x1f614,
- 0x1f616, 0x1f616,
- 0x1f618, 0x1f618,
- 0x1f61a, 0x1f61a,
- 0x1f61c, 0x1f61e,
- 0x1f620, 0x1f625,
- 0x1f628, 0x1f62b,
- 0x1f62d, 0x1f62d,
- 0x1f630, 0x1f633,
- 0x1f635, 0x1f640,
- 0x1f645, 0x1f64f,
- 0x1f680, 0x1f6c5,
- 0x1f700, 0x1f773,
- 0x20000, 0x2a6d6,
- 0x2a700, 0x2b734,
- 0x2b740, 0x2b81d,
- 0x2f800, 0x2fa1d,
- 0xe0001, 0xe0001,
- 0xe0020, 0xe007f,
- 0xe0100, 0xe01ef,
- 0xf0000, 0xffffd,
- 0x100000, 0x10fffd,
-}; /* CR_Graph */
-
-/* 'Lower': [[:Lower:]] */
-#define CR_Lower CR_Lowercase
-
-/* 'Print': [[:Print:]] */
-static const OnigCodePoint CR_Print[] = {
- 503,
- 0x0020, 0x007e,
- 0x00a0, 0x0377,
+/* 'Age_6_1': Derived Age 6.1 */
+static const OnigCodePoint CR_Age_6_1[] = {
+ 549,
+ 0x0000, 0x0377,
0x037a, 0x037e,
0x0384, 0x038a,
0x038c, 0x038c,
@@ -20411,10 +23617,11 @@ static const OnigCodePoint CR_Print[] = {
0x0559, 0x055f,
0x0561, 0x0587,
0x0589, 0x058a,
+ 0x058f, 0x058f,
0x0591, 0x05c7,
0x05d0, 0x05ea,
0x05f0, 0x05f4,
- 0x0600, 0x0603,
+ 0x0600, 0x0604,
0x0606, 0x061b,
0x061e, 0x070d,
0x070f, 0x074a,
@@ -20424,6 +23631,9 @@ static const OnigCodePoint CR_Print[] = {
0x0830, 0x083e,
0x0840, 0x085b,
0x085e, 0x085e,
+ 0x08a0, 0x08a0,
+ 0x08a2, 0x08ac,
+ 0x08e4, 0x08fe,
0x0900, 0x0977,
0x0979, 0x097f,
0x0981, 0x0983,
@@ -20468,8 +23678,7 @@ static const OnigCodePoint CR_Print[] = {
0x0acb, 0x0acd,
0x0ad0, 0x0ad0,
0x0ae0, 0x0ae3,
- 0x0ae6, 0x0aef,
- 0x0af1, 0x0af1,
+ 0x0ae6, 0x0af1,
0x0b01, 0x0b03,
0x0b05, 0x0b0c,
0x0b0f, 0x0b10,
@@ -20569,7 +23778,7 @@ static const OnigCodePoint CR_Print[] = {
0x0ec6, 0x0ec6,
0x0ec8, 0x0ecd,
0x0ed0, 0x0ed9,
- 0x0edc, 0x0edd,
+ 0x0edc, 0x0edf,
0x0f00, 0x0f47,
0x0f49, 0x0f6c,
0x0f71, 0x0f97,
@@ -20577,8 +23786,9 @@ static const OnigCodePoint CR_Print[] = {
0x0fbe, 0x0fcc,
0x0fce, 0x0fda,
0x1000, 0x10c5,
- 0x10d0, 0x10fc,
- 0x1100, 0x1248,
+ 0x10c7, 0x10c7,
+ 0x10cd, 0x10cd,
+ 0x10d0, 0x1248,
0x124a, 0x124d,
0x1250, 0x1256,
0x1258, 0x1258,
@@ -20631,13 +23841,12 @@ static const OnigCodePoint CR_Print[] = {
0x1aa0, 0x1aad,
0x1b00, 0x1b4b,
0x1b50, 0x1b7c,
- 0x1b80, 0x1baa,
- 0x1bae, 0x1bb9,
- 0x1bc0, 0x1bf3,
+ 0x1b80, 0x1bf3,
0x1bfc, 0x1c37,
0x1c3b, 0x1c49,
0x1c4d, 0x1c7f,
- 0x1cd0, 0x1cf2,
+ 0x1cc0, 0x1cc7,
+ 0x1cd0, 0x1cf6,
0x1d00, 0x1de6,
0x1dfc, 0x1f15,
0x1f18, 0x1f1d,
@@ -20655,8 +23864,7 @@ static const OnigCodePoint CR_Print[] = {
0x1fdd, 0x1fef,
0x1ff2, 0x1ff4,
0x1ff6, 0x1ffe,
- 0x2000, 0x2027,
- 0x202a, 0x2064,
+ 0x2000, 0x2064,
0x206a, 0x2071,
0x2074, 0x208e,
0x2090, 0x209c,
@@ -20667,15 +23875,15 @@ static const OnigCodePoint CR_Print[] = {
0x2400, 0x2426,
0x2440, 0x244a,
0x2460, 0x26ff,
- 0x2701, 0x27ca,
- 0x27cc, 0x27cc,
- 0x27ce, 0x2b4c,
+ 0x2701, 0x2b4c,
0x2b50, 0x2b59,
0x2c00, 0x2c2e,
0x2c30, 0x2c5e,
- 0x2c60, 0x2cf1,
+ 0x2c60, 0x2cf3,
0x2cf9, 0x2d25,
- 0x2d30, 0x2d65,
+ 0x2d27, 0x2d27,
+ 0x2d2d, 0x2d2d,
+ 0x2d30, 0x2d67,
0x2d6f, 0x2d70,
0x2d7f, 0x2d96,
0x2da0, 0x2da6,
@@ -20686,7 +23894,7 @@ static const OnigCodePoint CR_Print[] = {
0x2dc8, 0x2dce,
0x2dd0, 0x2dd6,
0x2dd8, 0x2dde,
- 0x2de0, 0x2e31,
+ 0x2de0, 0x2e3b,
0x2e80, 0x2e99,
0x2e9b, 0x2ef3,
0x2f00, 0x2fd5,
@@ -20701,17 +23909,16 @@ static const OnigCodePoint CR_Print[] = {
0x31f0, 0x321e,
0x3220, 0x32fe,
0x3300, 0x4db5,
- 0x4dc0, 0x9fcb,
+ 0x4dc0, 0x9fcc,
0xa000, 0xa48c,
0xa490, 0xa4c6,
0xa4d0, 0xa62b,
- 0xa640, 0xa673,
- 0xa67c, 0xa697,
- 0xa6a0, 0xa6f7,
+ 0xa640, 0xa697,
+ 0xa69f, 0xa6f7,
0xa700, 0xa78e,
- 0xa790, 0xa791,
- 0xa7a0, 0xa7a9,
- 0xa7fa, 0xa82b,
+ 0xa790, 0xa793,
+ 0xa7a0, 0xa7aa,
+ 0xa7f8, 0xa82b,
0xa830, 0xa839,
0xa840, 0xa877,
0xa880, 0xa8c4,
@@ -20727,7 +23934,7 @@ static const OnigCodePoint CR_Print[] = {
0xaa50, 0xaa59,
0xaa5c, 0xaa7b,
0xaa80, 0xaac2,
- 0xaadb, 0xaadf,
+ 0xaadb, 0xaaf6,
0xab01, 0xab06,
0xab09, 0xab0e,
0xab11, 0xab16,
@@ -20738,8 +23945,7 @@ static const OnigCodePoint CR_Print[] = {
0xac00, 0xd7a3,
0xd7b0, 0xd7c6,
0xd7cb, 0xd7fb,
- 0xe000, 0xfa2d,
- 0xfa30, 0xfa6d,
+ 0xd800, 0xfa6d,
0xfa70, 0xfad9,
0xfb00, 0xfb06,
0xfb13, 0xfb17,
@@ -20752,7 +23958,7 @@ static const OnigCodePoint CR_Print[] = {
0xfbd3, 0xfd3f,
0xfd50, 0xfd8f,
0xfd92, 0xfdc7,
- 0xfdf0, 0xfdfd,
+ 0xfdd0, 0xfdfd,
0xfe00, 0xfe19,
0xfe20, 0xfe26,
0xfe30, 0xfe52,
@@ -20768,8 +23974,7 @@ static const OnigCodePoint CR_Print[] = {
0xffda, 0xffdc,
0xffe0, 0xffe6,
0xffe8, 0xffee,
- 0xfff9, 0xfffd,
- 0x10000, 0x1000b,
+ 0xfff9, 0x1000b,
0x1000d, 0x10026,
0x10028, 0x1003a,
0x1003c, 0x1003d,
@@ -20801,6 +24006,8 @@ static const OnigCodePoint CR_Print[] = {
0x10900, 0x1091b,
0x1091f, 0x10939,
0x1093f, 0x1093f,
+ 0x10980, 0x109b7,
+ 0x109be, 0x109bf,
0x10a00, 0x10a03,
0x10a05, 0x10a06,
0x10a0c, 0x10a13,
@@ -20819,11 +24026,22 @@ static const OnigCodePoint CR_Print[] = {
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,
@@ -20852,6 +24070,40 @@ static const OnigCodePoint CR_Print[] = {
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,
@@ -20860,7 +24112,7 @@ static const OnigCodePoint CR_Print[] = {
0x1f0d1, 0x1f0df,
0x1f100, 0x1f10a,
0x1f110, 0x1f12e,
- 0x1f130, 0x1f169,
+ 0x1f130, 0x1f16b,
0x1f170, 0x1f19a,
0x1f1e6, 0x1f202,
0x1f210, 0x1f23a,
@@ -20878,1083 +24130,1368 @@ static const OnigCodePoint CR_Print[] = {
0x1f442, 0x1f4f7,
0x1f4f9, 0x1f4fc,
0x1f500, 0x1f53d,
+ 0x1f540, 0x1f543,
0x1f550, 0x1f567,
- 0x1f5fb, 0x1f5ff,
- 0x1f601, 0x1f610,
- 0x1f612, 0x1f614,
- 0x1f616, 0x1f616,
- 0x1f618, 0x1f618,
- 0x1f61a, 0x1f61a,
- 0x1f61c, 0x1f61e,
- 0x1f620, 0x1f625,
- 0x1f628, 0x1f62b,
- 0x1f62d, 0x1f62d,
- 0x1f630, 0x1f633,
- 0x1f635, 0x1f640,
+ 0x1f5fb, 0x1f640,
0x1f645, 0x1f64f,
0x1f680, 0x1f6c5,
0x1f700, 0x1f773,
- 0x20000, 0x2a6d6,
+ 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,
- 0xf0000, 0xffffd,
- 0x100000, 0x10fffd,
-}; /* CR_Print */
+ 0xefffe, 0x10ffff,
+}; /* CR_Age_6_1 */
-/* 'Punct': [[:Punct:]] */
-#define CR_Punct CR_P
+/* 'In_Basic_Latin': Block */
+#define CR_In_Basic_Latin CR_ASCII
-/* 'Space': [[:Space:]] */
-#define CR_Space CR_White_Space
+/* 'In_Latin_1_Supplement': Block */
+static const OnigCodePoint CR_In_Latin_1_Supplement[] = {
+ 1,
+ 0x0080, 0x00ff,
+}; /* CR_In_Latin_1_Supplement */
-/* 'Upper': [[:Upper:]] */
-#define CR_Upper CR_Uppercase
+/* 'In_Latin_Extended_A': Block */
+static const OnigCodePoint CR_In_Latin_Extended_A[] = {
+ 1,
+ 0x0100, 0x017f,
+}; /* CR_In_Latin_Extended_A */
-/* 'XDigit': [[:XDigit:]] */
-#define CR_XDigit CR_ASCII_Hex_Digit
+/* 'In_Latin_Extended_B': Block */
+static const OnigCodePoint CR_In_Latin_Extended_B[] = {
+ 1,
+ 0x0180, 0x024f,
+}; /* CR_In_Latin_Extended_B */
-/* 'Word': [[:Word:]] */
-static const OnigCodePoint CR_Word[] = {
- 514,
- 0x0030, 0x0039,
- 0x0041, 0x005a,
- 0x005f, 0x005f,
- 0x0061, 0x007a,
- 0x00aa, 0x00aa,
- 0x00b5, 0x00b5,
- 0x00ba, 0x00ba,
- 0x00c0, 0x00d6,
- 0x00d8, 0x00f6,
- 0x00f8, 0x02c1,
- 0x02c6, 0x02d1,
- 0x02e0, 0x02e4,
- 0x02ec, 0x02ec,
- 0x02ee, 0x02ee,
- 0x0300, 0x0374,
- 0x0376, 0x0377,
- 0x037a, 0x037d,
- 0x0386, 0x0386,
- 0x0388, 0x038a,
- 0x038c, 0x038c,
- 0x038e, 0x03a1,
- 0x03a3, 0x03f5,
- 0x03f7, 0x0481,
- 0x0483, 0x0527,
- 0x0531, 0x0556,
- 0x0559, 0x0559,
- 0x0561, 0x0587,
- 0x0591, 0x05bd,
- 0x05bf, 0x05bf,
- 0x05c1, 0x05c2,
- 0x05c4, 0x05c5,
- 0x05c7, 0x05c7,
- 0x05d0, 0x05ea,
- 0x05f0, 0x05f2,
- 0x0610, 0x061a,
- 0x0620, 0x0669,
- 0x066e, 0x06d3,
- 0x06d5, 0x06dc,
- 0x06df, 0x06e8,
- 0x06ea, 0x06fc,
- 0x06ff, 0x06ff,
- 0x0710, 0x074a,
- 0x074d, 0x07b1,
- 0x07c0, 0x07f5,
- 0x07fa, 0x07fa,
- 0x0800, 0x082d,
- 0x0840, 0x085b,
- 0x0900, 0x0963,
- 0x0966, 0x096f,
- 0x0971, 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, 0x09f1,
- 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, 0x0aef,
- 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, 0x0b6f,
- 0x0b71, 0x0b71,
- 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, 0x0bef,
- 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,
- 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, 0x0d6f,
- 0x0d7a, 0x0d7f,
- 0x0d82, 0x0d83,
- 0x0d85, 0x0d96,
- 0x0d9a, 0x0db1,
- 0x0db3, 0x0dbb,
- 0x0dbd, 0x0dbd,
- 0x0dc0, 0x0dc6,
- 0x0dca, 0x0dca,
- 0x0dcf, 0x0dd4,
- 0x0dd6, 0x0dd6,
- 0x0dd8, 0x0ddf,
- 0x0df2, 0x0df3,
- 0x0e01, 0x0e3a,
- 0x0e40, 0x0e4e,
- 0x0e50, 0x0e59,
- 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, 0x0edd,
- 0x0f00, 0x0f00,
- 0x0f18, 0x0f19,
- 0x0f20, 0x0f29,
- 0x0f35, 0x0f35,
- 0x0f37, 0x0f37,
- 0x0f39, 0x0f39,
- 0x0f3e, 0x0f47,
- 0x0f49, 0x0f6c,
- 0x0f71, 0x0f84,
- 0x0f86, 0x0f97,
- 0x0f99, 0x0fbc,
- 0x0fc6, 0x0fc6,
- 0x1000, 0x1049,
- 0x1050, 0x109d,
- 0x10a0, 0x10c5,
- 0x10d0, 0x10fa,
- 0x10fc, 0x10fc,
- 0x1100, 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, 0x135f,
- 0x1380, 0x138f,
- 0x13a0, 0x13f4,
- 0x1401, 0x166c,
- 0x166f, 0x167f,
- 0x1681, 0x169a,
- 0x16a0, 0x16ea,
- 0x16ee, 0x16f0,
- 0x1700, 0x170c,
- 0x170e, 0x1714,
- 0x1720, 0x1734,
- 0x1740, 0x1753,
- 0x1760, 0x176c,
- 0x176e, 0x1770,
- 0x1772, 0x1773,
- 0x1780, 0x17b3,
- 0x17b6, 0x17d3,
- 0x17d7, 0x17d7,
- 0x17dc, 0x17dd,
- 0x17e0, 0x17e9,
- 0x180b, 0x180d,
- 0x1810, 0x1819,
- 0x1820, 0x1877,
- 0x1880, 0x18aa,
- 0x18b0, 0x18f5,
- 0x1900, 0x191c,
- 0x1920, 0x192b,
- 0x1930, 0x193b,
- 0x1946, 0x196d,
- 0x1970, 0x1974,
- 0x1980, 0x19ab,
- 0x19b0, 0x19c9,
- 0x19d0, 0x19d9,
- 0x1a00, 0x1a1b,
- 0x1a20, 0x1a5e,
- 0x1a60, 0x1a7c,
- 0x1a7f, 0x1a89,
- 0x1a90, 0x1a99,
- 0x1aa7, 0x1aa7,
- 0x1b00, 0x1b4b,
- 0x1b50, 0x1b59,
- 0x1b6b, 0x1b73,
- 0x1b80, 0x1baa,
- 0x1bae, 0x1bb9,
- 0x1bc0, 0x1bf3,
- 0x1c00, 0x1c37,
- 0x1c40, 0x1c49,
- 0x1c4d, 0x1c7d,
- 0x1cd0, 0x1cd2,
- 0x1cd4, 0x1cf2,
- 0x1d00, 0x1de6,
- 0x1dfc, 0x1f15,
- 0x1f18, 0x1f1d,
- 0x1f20, 0x1f45,
- 0x1f48, 0x1f4d,
- 0x1f50, 0x1f57,
- 0x1f59, 0x1f59,
- 0x1f5b, 0x1f5b,
- 0x1f5d, 0x1f5d,
- 0x1f5f, 0x1f7d,
- 0x1f80, 0x1fb4,
- 0x1fb6, 0x1fbc,
- 0x1fbe, 0x1fbe,
- 0x1fc2, 0x1fc4,
- 0x1fc6, 0x1fcc,
- 0x1fd0, 0x1fd3,
- 0x1fd6, 0x1fdb,
- 0x1fe0, 0x1fec,
- 0x1ff2, 0x1ff4,
- 0x1ff6, 0x1ffc,
- 0x203f, 0x2040,
- 0x2054, 0x2054,
- 0x2071, 0x2071,
- 0x207f, 0x207f,
- 0x2090, 0x209c,
- 0x20d0, 0x20f0,
- 0x2102, 0x2102,
- 0x2107, 0x2107,
- 0x210a, 0x2113,
- 0x2115, 0x2115,
- 0x2119, 0x211d,
- 0x2124, 0x2124,
- 0x2126, 0x2126,
- 0x2128, 0x2128,
- 0x212a, 0x212d,
- 0x212f, 0x2139,
- 0x213c, 0x213f,
- 0x2145, 0x2149,
- 0x214e, 0x214e,
- 0x2160, 0x2188,
- 0x24b6, 0x24e9,
- 0x2c00, 0x2c2e,
- 0x2c30, 0x2c5e,
- 0x2c60, 0x2ce4,
- 0x2ceb, 0x2cf1,
- 0x2d00, 0x2d25,
- 0x2d30, 0x2d65,
- 0x2d6f, 0x2d6f,
- 0x2d7f, 0x2d96,
- 0x2da0, 0x2da6,
- 0x2da8, 0x2dae,
- 0x2db0, 0x2db6,
- 0x2db8, 0x2dbe,
- 0x2dc0, 0x2dc6,
- 0x2dc8, 0x2dce,
- 0x2dd0, 0x2dd6,
- 0x2dd8, 0x2dde,
+/* 'In_IPA_Extensions': Block */
+static const OnigCodePoint CR_In_IPA_Extensions[] = {
+ 1,
+ 0x0250, 0x02af,
+}; /* CR_In_IPA_Extensions */
+
+/* 'In_Spacing_Modifier_Letters': Block */
+static const OnigCodePoint CR_In_Spacing_Modifier_Letters[] = {
+ 1,
+ 0x02b0, 0x02ff,
+}; /* CR_In_Spacing_Modifier_Letters */
+
+/* 'In_Combining_Diacritical_Marks': Block */
+static const OnigCodePoint CR_In_Combining_Diacritical_Marks[] = {
+ 1,
+ 0x0300, 0x036f,
+}; /* CR_In_Combining_Diacritical_Marks */
+
+/* 'In_Greek_and_Coptic': Block */
+static const OnigCodePoint CR_In_Greek_and_Coptic[] = {
+ 1,
+ 0x0370, 0x03ff,
+}; /* CR_In_Greek_and_Coptic */
+
+/* 'In_Cyrillic': Block */
+static const OnigCodePoint CR_In_Cyrillic[] = {
+ 1,
+ 0x0400, 0x04ff,
+}; /* CR_In_Cyrillic */
+
+/* 'In_Cyrillic_Supplement': Block */
+static const OnigCodePoint CR_In_Cyrillic_Supplement[] = {
+ 1,
+ 0x0500, 0x052f,
+}; /* CR_In_Cyrillic_Supplement */
+
+/* 'In_Armenian': Block */
+static const OnigCodePoint CR_In_Armenian[] = {
+ 1,
+ 0x0530, 0x058f,
+}; /* CR_In_Armenian */
+
+/* 'In_Hebrew': Block */
+static const OnigCodePoint CR_In_Hebrew[] = {
+ 1,
+ 0x0590, 0x05ff,
+}; /* CR_In_Hebrew */
+
+/* 'In_Arabic': Block */
+static const OnigCodePoint CR_In_Arabic[] = {
+ 1,
+ 0x0600, 0x06ff,
+}; /* CR_In_Arabic */
+
+/* 'In_Syriac': Block */
+static const OnigCodePoint CR_In_Syriac[] = {
+ 1,
+ 0x0700, 0x074f,
+}; /* CR_In_Syriac */
+
+/* 'In_Arabic_Supplement': Block */
+static const OnigCodePoint CR_In_Arabic_Supplement[] = {
+ 1,
+ 0x0750, 0x077f,
+}; /* CR_In_Arabic_Supplement */
+
+/* 'In_Thaana': Block */
+static const OnigCodePoint CR_In_Thaana[] = {
+ 1,
+ 0x0780, 0x07bf,
+}; /* CR_In_Thaana */
+
+/* 'In_NKo': Block */
+static const OnigCodePoint CR_In_NKo[] = {
+ 1,
+ 0x07c0, 0x07ff,
+}; /* CR_In_NKo */
+
+/* 'In_Samaritan': Block */
+static const OnigCodePoint CR_In_Samaritan[] = {
+ 1,
+ 0x0800, 0x083f,
+}; /* CR_In_Samaritan */
+
+/* 'In_Mandaic': Block */
+static const OnigCodePoint CR_In_Mandaic[] = {
+ 1,
+ 0x0840, 0x085f,
+}; /* CR_In_Mandaic */
+
+/* 'In_Arabic_Extended_A': Block */
+static const OnigCodePoint CR_In_Arabic_Extended_A[] = {
+ 1,
+ 0x08a0, 0x08ff,
+}; /* CR_In_Arabic_Extended_A */
+
+/* 'In_Devanagari': Block */
+static const OnigCodePoint CR_In_Devanagari[] = {
+ 1,
+ 0x0900, 0x097f,
+}; /* CR_In_Devanagari */
+
+/* 'In_Bengali': Block */
+static const OnigCodePoint CR_In_Bengali[] = {
+ 1,
+ 0x0980, 0x09ff,
+}; /* CR_In_Bengali */
+
+/* 'In_Gurmukhi': Block */
+static const OnigCodePoint CR_In_Gurmukhi[] = {
+ 1,
+ 0x0a00, 0x0a7f,
+}; /* CR_In_Gurmukhi */
+
+/* 'In_Gujarati': Block */
+static const OnigCodePoint CR_In_Gujarati[] = {
+ 1,
+ 0x0a80, 0x0aff,
+}; /* CR_In_Gujarati */
+
+/* 'In_Oriya': Block */
+static const OnigCodePoint CR_In_Oriya[] = {
+ 1,
+ 0x0b00, 0x0b7f,
+}; /* CR_In_Oriya */
+
+/* 'In_Tamil': Block */
+static const OnigCodePoint CR_In_Tamil[] = {
+ 1,
+ 0x0b80, 0x0bff,
+}; /* CR_In_Tamil */
+
+/* 'In_Telugu': Block */
+static const OnigCodePoint CR_In_Telugu[] = {
+ 1,
+ 0x0c00, 0x0c7f,
+}; /* CR_In_Telugu */
+
+/* 'In_Kannada': Block */
+static const OnigCodePoint CR_In_Kannada[] = {
+ 1,
+ 0x0c80, 0x0cff,
+}; /* CR_In_Kannada */
+
+/* 'In_Malayalam': Block */
+static const OnigCodePoint CR_In_Malayalam[] = {
+ 1,
+ 0x0d00, 0x0d7f,
+}; /* CR_In_Malayalam */
+
+/* 'In_Sinhala': Block */
+static const OnigCodePoint CR_In_Sinhala[] = {
+ 1,
+ 0x0d80, 0x0dff,
+}; /* CR_In_Sinhala */
+
+/* 'In_Thai': Block */
+static const OnigCodePoint CR_In_Thai[] = {
+ 1,
+ 0x0e00, 0x0e7f,
+}; /* CR_In_Thai */
+
+/* 'In_Lao': Block */
+static const OnigCodePoint CR_In_Lao[] = {
+ 1,
+ 0x0e80, 0x0eff,
+}; /* CR_In_Lao */
+
+/* 'In_Tibetan': Block */
+static const OnigCodePoint CR_In_Tibetan[] = {
+ 1,
+ 0x0f00, 0x0fff,
+}; /* CR_In_Tibetan */
+
+/* 'In_Myanmar': Block */
+static const OnigCodePoint CR_In_Myanmar[] = {
+ 1,
+ 0x1000, 0x109f,
+}; /* CR_In_Myanmar */
+
+/* 'In_Georgian': Block */
+static const OnigCodePoint CR_In_Georgian[] = {
+ 1,
+ 0x10a0, 0x10ff,
+}; /* CR_In_Georgian */
+
+/* 'In_Hangul_Jamo': Block */
+static const OnigCodePoint CR_In_Hangul_Jamo[] = {
+ 1,
+ 0x1100, 0x11ff,
+}; /* CR_In_Hangul_Jamo */
+
+/* 'In_Ethiopic': Block */
+static const OnigCodePoint CR_In_Ethiopic[] = {
+ 1,
+ 0x1200, 0x137f,
+}; /* CR_In_Ethiopic */
+
+/* 'In_Ethiopic_Supplement': Block */
+static const OnigCodePoint CR_In_Ethiopic_Supplement[] = {
+ 1,
+ 0x1380, 0x139f,
+}; /* CR_In_Ethiopic_Supplement */
+
+/* 'In_Cherokee': Block */
+static const OnigCodePoint CR_In_Cherokee[] = {
+ 1,
+ 0x13a0, 0x13ff,
+}; /* CR_In_Cherokee */
+
+/* 'In_Unified_Canadian_Aboriginal_Syllabics': Block */
+static const OnigCodePoint CR_In_Unified_Canadian_Aboriginal_Syllabics[] = {
+ 1,
+ 0x1400, 0x167f,
+}; /* CR_In_Unified_Canadian_Aboriginal_Syllabics */
+
+/* 'In_Ogham': Block */
+static const OnigCodePoint CR_In_Ogham[] = {
+ 1,
+ 0x1680, 0x169f,
+}; /* CR_In_Ogham */
+
+/* 'In_Runic': Block */
+static const OnigCodePoint CR_In_Runic[] = {
+ 1,
+ 0x16a0, 0x16ff,
+}; /* CR_In_Runic */
+
+/* 'In_Tagalog': Block */
+static const OnigCodePoint CR_In_Tagalog[] = {
+ 1,
+ 0x1700, 0x171f,
+}; /* CR_In_Tagalog */
+
+/* 'In_Hanunoo': Block */
+static const OnigCodePoint CR_In_Hanunoo[] = {
+ 1,
+ 0x1720, 0x173f,
+}; /* CR_In_Hanunoo */
+
+/* 'In_Buhid': Block */
+static const OnigCodePoint CR_In_Buhid[] = {
+ 1,
+ 0x1740, 0x175f,
+}; /* CR_In_Buhid */
+
+/* 'In_Tagbanwa': Block */
+static const OnigCodePoint CR_In_Tagbanwa[] = {
+ 1,
+ 0x1760, 0x177f,
+}; /* CR_In_Tagbanwa */
+
+/* 'In_Khmer': Block */
+static const OnigCodePoint CR_In_Khmer[] = {
+ 1,
+ 0x1780, 0x17ff,
+}; /* CR_In_Khmer */
+
+/* 'In_Mongolian': Block */
+static const OnigCodePoint CR_In_Mongolian[] = {
+ 1,
+ 0x1800, 0x18af,
+}; /* CR_In_Mongolian */
+
+/* 'In_Unified_Canadian_Aboriginal_Syllabics_Extended': Block */
+static const OnigCodePoint CR_In_Unified_Canadian_Aboriginal_Syllabics_Extended[] = {
+ 1,
+ 0x18b0, 0x18ff,
+}; /* CR_In_Unified_Canadian_Aboriginal_Syllabics_Extended */
+
+/* 'In_Limbu': Block */
+static const OnigCodePoint CR_In_Limbu[] = {
+ 1,
+ 0x1900, 0x194f,
+}; /* CR_In_Limbu */
+
+/* 'In_Tai_Le': Block */
+static const OnigCodePoint CR_In_Tai_Le[] = {
+ 1,
+ 0x1950, 0x197f,
+}; /* CR_In_Tai_Le */
+
+/* 'In_New_Tai_Lue': Block */
+static const OnigCodePoint CR_In_New_Tai_Lue[] = {
+ 1,
+ 0x1980, 0x19df,
+}; /* CR_In_New_Tai_Lue */
+
+/* 'In_Khmer_Symbols': Block */
+static const OnigCodePoint CR_In_Khmer_Symbols[] = {
+ 1,
+ 0x19e0, 0x19ff,
+}; /* CR_In_Khmer_Symbols */
+
+/* 'In_Buginese': Block */
+static const OnigCodePoint CR_In_Buginese[] = {
+ 1,
+ 0x1a00, 0x1a1f,
+}; /* CR_In_Buginese */
+
+/* 'In_Tai_Tham': Block */
+static const OnigCodePoint CR_In_Tai_Tham[] = {
+ 1,
+ 0x1a20, 0x1aaf,
+}; /* CR_In_Tai_Tham */
+
+/* 'In_Balinese': Block */
+static const OnigCodePoint CR_In_Balinese[] = {
+ 1,
+ 0x1b00, 0x1b7f,
+}; /* CR_In_Balinese */
+
+/* 'In_Sundanese': Block */
+static const OnigCodePoint CR_In_Sundanese[] = {
+ 1,
+ 0x1b80, 0x1bbf,
+}; /* CR_In_Sundanese */
+
+/* 'In_Batak': Block */
+static const OnigCodePoint CR_In_Batak[] = {
+ 1,
+ 0x1bc0, 0x1bff,
+}; /* CR_In_Batak */
+
+/* 'In_Lepcha': Block */
+static const OnigCodePoint CR_In_Lepcha[] = {
+ 1,
+ 0x1c00, 0x1c4f,
+}; /* CR_In_Lepcha */
+
+/* 'In_Ol_Chiki': Block */
+#define CR_In_Ol_Chiki CR_Ol_Chiki
+
+/* 'In_Sundanese_Supplement': Block */
+static const OnigCodePoint CR_In_Sundanese_Supplement[] = {
+ 1,
+ 0x1cc0, 0x1ccf,
+}; /* CR_In_Sundanese_Supplement */
+
+/* 'In_Vedic_Extensions': Block */
+static const OnigCodePoint CR_In_Vedic_Extensions[] = {
+ 1,
+ 0x1cd0, 0x1cff,
+}; /* CR_In_Vedic_Extensions */
+
+/* 'In_Phonetic_Extensions': Block */
+static const OnigCodePoint CR_In_Phonetic_Extensions[] = {
+ 1,
+ 0x1d00, 0x1d7f,
+}; /* CR_In_Phonetic_Extensions */
+
+/* 'In_Phonetic_Extensions_Supplement': Block */
+static const OnigCodePoint CR_In_Phonetic_Extensions_Supplement[] = {
+ 1,
+ 0x1d80, 0x1dbf,
+}; /* CR_In_Phonetic_Extensions_Supplement */
+
+/* 'In_Combining_Diacritical_Marks_Supplement': Block */
+static const OnigCodePoint CR_In_Combining_Diacritical_Marks_Supplement[] = {
+ 1,
+ 0x1dc0, 0x1dff,
+}; /* CR_In_Combining_Diacritical_Marks_Supplement */
+
+/* 'In_Latin_Extended_Additional': Block */
+static const OnigCodePoint CR_In_Latin_Extended_Additional[] = {
+ 1,
+ 0x1e00, 0x1eff,
+}; /* CR_In_Latin_Extended_Additional */
+
+/* 'In_Greek_Extended': Block */
+static const OnigCodePoint CR_In_Greek_Extended[] = {
+ 1,
+ 0x1f00, 0x1fff,
+}; /* CR_In_Greek_Extended */
+
+/* 'In_General_Punctuation': Block */
+static const OnigCodePoint CR_In_General_Punctuation[] = {
+ 1,
+ 0x2000, 0x206f,
+}; /* CR_In_General_Punctuation */
+
+/* 'In_Superscripts_and_Subscripts': Block */
+static const OnigCodePoint CR_In_Superscripts_and_Subscripts[] = {
+ 1,
+ 0x2070, 0x209f,
+}; /* CR_In_Superscripts_and_Subscripts */
+
+/* 'In_Currency_Symbols': Block */
+static const OnigCodePoint CR_In_Currency_Symbols[] = {
+ 1,
+ 0x20a0, 0x20cf,
+}; /* CR_In_Currency_Symbols */
+
+/* 'In_Combining_Diacritical_Marks_for_Symbols': Block */
+static const OnigCodePoint CR_In_Combining_Diacritical_Marks_for_Symbols[] = {
+ 1,
+ 0x20d0, 0x20ff,
+}; /* CR_In_Combining_Diacritical_Marks_for_Symbols */
+
+/* 'In_Letterlike_Symbols': Block */
+static const OnigCodePoint CR_In_Letterlike_Symbols[] = {
+ 1,
+ 0x2100, 0x214f,
+}; /* CR_In_Letterlike_Symbols */
+
+/* 'In_Number_Forms': Block */
+static const OnigCodePoint CR_In_Number_Forms[] = {
+ 1,
+ 0x2150, 0x218f,
+}; /* CR_In_Number_Forms */
+
+/* 'In_Arrows': Block */
+static const OnigCodePoint CR_In_Arrows[] = {
+ 1,
+ 0x2190, 0x21ff,
+}; /* CR_In_Arrows */
+
+/* 'In_Mathematical_Operators': Block */
+static const OnigCodePoint CR_In_Mathematical_Operators[] = {
+ 1,
+ 0x2200, 0x22ff,
+}; /* CR_In_Mathematical_Operators */
+
+/* 'In_Miscellaneous_Technical': Block */
+static const OnigCodePoint CR_In_Miscellaneous_Technical[] = {
+ 1,
+ 0x2300, 0x23ff,
+}; /* CR_In_Miscellaneous_Technical */
+
+/* 'In_Control_Pictures': Block */
+static const OnigCodePoint CR_In_Control_Pictures[] = {
+ 1,
+ 0x2400, 0x243f,
+}; /* CR_In_Control_Pictures */
+
+/* 'In_Optical_Character_Recognition': Block */
+static const OnigCodePoint CR_In_Optical_Character_Recognition[] = {
+ 1,
+ 0x2440, 0x245f,
+}; /* CR_In_Optical_Character_Recognition */
+
+/* 'In_Enclosed_Alphanumerics': Block */
+static const OnigCodePoint CR_In_Enclosed_Alphanumerics[] = {
+ 1,
+ 0x2460, 0x24ff,
+}; /* CR_In_Enclosed_Alphanumerics */
+
+/* 'In_Box_Drawing': Block */
+static const OnigCodePoint CR_In_Box_Drawing[] = {
+ 1,
+ 0x2500, 0x257f,
+}; /* CR_In_Box_Drawing */
+
+/* 'In_Block_Elements': Block */
+static const OnigCodePoint CR_In_Block_Elements[] = {
+ 1,
+ 0x2580, 0x259f,
+}; /* CR_In_Block_Elements */
+
+/* 'In_Geometric_Shapes': Block */
+static const OnigCodePoint CR_In_Geometric_Shapes[] = {
+ 1,
+ 0x25a0, 0x25ff,
+}; /* CR_In_Geometric_Shapes */
+
+/* 'In_Miscellaneous_Symbols': Block */
+static const OnigCodePoint CR_In_Miscellaneous_Symbols[] = {
+ 1,
+ 0x2600, 0x26ff,
+}; /* CR_In_Miscellaneous_Symbols */
+
+/* 'In_Dingbats': Block */
+static const OnigCodePoint CR_In_Dingbats[] = {
+ 1,
+ 0x2700, 0x27bf,
+}; /* CR_In_Dingbats */
+
+/* 'In_Miscellaneous_Mathematical_Symbols_A': Block */
+static const OnigCodePoint CR_In_Miscellaneous_Mathematical_Symbols_A[] = {
+ 1,
+ 0x27c0, 0x27ef,
+}; /* CR_In_Miscellaneous_Mathematical_Symbols_A */
+
+/* 'In_Supplemental_Arrows_A': Block */
+static const OnigCodePoint CR_In_Supplemental_Arrows_A[] = {
+ 1,
+ 0x27f0, 0x27ff,
+}; /* CR_In_Supplemental_Arrows_A */
+
+/* 'In_Braille_Patterns': Block */
+#define CR_In_Braille_Patterns CR_Braille
+
+/* 'In_Supplemental_Arrows_B': Block */
+static const OnigCodePoint CR_In_Supplemental_Arrows_B[] = {
+ 1,
+ 0x2900, 0x297f,
+}; /* CR_In_Supplemental_Arrows_B */
+
+/* 'In_Miscellaneous_Mathematical_Symbols_B': Block */
+static const OnigCodePoint CR_In_Miscellaneous_Mathematical_Symbols_B[] = {
+ 1,
+ 0x2980, 0x29ff,
+}; /* CR_In_Miscellaneous_Mathematical_Symbols_B */
+
+/* 'In_Supplemental_Mathematical_Operators': Block */
+static const OnigCodePoint CR_In_Supplemental_Mathematical_Operators[] = {
+ 1,
+ 0x2a00, 0x2aff,
+}; /* CR_In_Supplemental_Mathematical_Operators */
+
+/* 'In_Miscellaneous_Symbols_and_Arrows': Block */
+static const OnigCodePoint CR_In_Miscellaneous_Symbols_and_Arrows[] = {
+ 1,
+ 0x2b00, 0x2bff,
+}; /* CR_In_Miscellaneous_Symbols_and_Arrows */
+
+/* 'In_Glagolitic': Block */
+static const OnigCodePoint CR_In_Glagolitic[] = {
+ 1,
+ 0x2c00, 0x2c5f,
+}; /* CR_In_Glagolitic */
+
+/* 'In_Latin_Extended_C': Block */
+static const OnigCodePoint CR_In_Latin_Extended_C[] = {
+ 1,
+ 0x2c60, 0x2c7f,
+}; /* CR_In_Latin_Extended_C */
+
+/* 'In_Coptic': Block */
+static const OnigCodePoint CR_In_Coptic[] = {
+ 1,
+ 0x2c80, 0x2cff,
+}; /* CR_In_Coptic */
+
+/* 'In_Georgian_Supplement': Block */
+static const OnigCodePoint CR_In_Georgian_Supplement[] = {
+ 1,
+ 0x2d00, 0x2d2f,
+}; /* CR_In_Georgian_Supplement */
+
+/* 'In_Tifinagh': Block */
+static const OnigCodePoint CR_In_Tifinagh[] = {
+ 1,
+ 0x2d30, 0x2d7f,
+}; /* CR_In_Tifinagh */
+
+/* 'In_Ethiopic_Extended': Block */
+static const OnigCodePoint CR_In_Ethiopic_Extended[] = {
+ 1,
+ 0x2d80, 0x2ddf,
+}; /* CR_In_Ethiopic_Extended */
+
+/* 'In_Cyrillic_Extended_A': Block */
+static const OnigCodePoint CR_In_Cyrillic_Extended_A[] = {
+ 1,
0x2de0, 0x2dff,
- 0x2e2f, 0x2e2f,
- 0x3005, 0x3007,
- 0x3021, 0x302f,
- 0x3031, 0x3035,
- 0x3038, 0x303c,
- 0x3041, 0x3096,
- 0x3099, 0x309a,
- 0x309d, 0x309f,
- 0x30a1, 0x30fa,
- 0x30fc, 0x30ff,
- 0x3105, 0x312d,
- 0x3131, 0x318e,
- 0x31a0, 0x31ba,
+}; /* CR_In_Cyrillic_Extended_A */
+
+/* 'In_Supplemental_Punctuation': Block */
+static const OnigCodePoint CR_In_Supplemental_Punctuation[] = {
+ 1,
+ 0x2e00, 0x2e7f,
+}; /* CR_In_Supplemental_Punctuation */
+
+/* 'In_CJK_Radicals_Supplement': Block */
+static const OnigCodePoint CR_In_CJK_Radicals_Supplement[] = {
+ 1,
+ 0x2e80, 0x2eff,
+}; /* CR_In_CJK_Radicals_Supplement */
+
+/* 'In_Kangxi_Radicals': Block */
+static const OnigCodePoint CR_In_Kangxi_Radicals[] = {
+ 1,
+ 0x2f00, 0x2fdf,
+}; /* CR_In_Kangxi_Radicals */
+
+/* 'In_Ideographic_Description_Characters': Block */
+static const OnigCodePoint CR_In_Ideographic_Description_Characters[] = {
+ 1,
+ 0x2ff0, 0x2fff,
+}; /* CR_In_Ideographic_Description_Characters */
+
+/* 'In_CJK_Symbols_and_Punctuation': Block */
+static const OnigCodePoint CR_In_CJK_Symbols_and_Punctuation[] = {
+ 1,
+ 0x3000, 0x303f,
+}; /* CR_In_CJK_Symbols_and_Punctuation */
+
+/* 'In_Hiragana': Block */
+static const OnigCodePoint CR_In_Hiragana[] = {
+ 1,
+ 0x3040, 0x309f,
+}; /* CR_In_Hiragana */
+
+/* 'In_Katakana': Block */
+static const OnigCodePoint CR_In_Katakana[] = {
+ 1,
+ 0x30a0, 0x30ff,
+}; /* CR_In_Katakana */
+
+/* 'In_Bopomofo': Block */
+static const OnigCodePoint CR_In_Bopomofo[] = {
+ 1,
+ 0x3100, 0x312f,
+}; /* CR_In_Bopomofo */
+
+/* 'In_Hangul_Compatibility_Jamo': Block */
+static const OnigCodePoint CR_In_Hangul_Compatibility_Jamo[] = {
+ 1,
+ 0x3130, 0x318f,
+}; /* CR_In_Hangul_Compatibility_Jamo */
+
+/* 'In_Kanbun': Block */
+static const OnigCodePoint CR_In_Kanbun[] = {
+ 1,
+ 0x3190, 0x319f,
+}; /* CR_In_Kanbun */
+
+/* 'In_Bopomofo_Extended': Block */
+static const OnigCodePoint CR_In_Bopomofo_Extended[] = {
+ 1,
+ 0x31a0, 0x31bf,
+}; /* CR_In_Bopomofo_Extended */
+
+/* 'In_CJK_Strokes': Block */
+static const OnigCodePoint CR_In_CJK_Strokes[] = {
+ 1,
+ 0x31c0, 0x31ef,
+}; /* CR_In_CJK_Strokes */
+
+/* 'In_Katakana_Phonetic_Extensions': Block */
+static const OnigCodePoint CR_In_Katakana_Phonetic_Extensions[] = {
+ 1,
0x31f0, 0x31ff,
- 0x3400, 0x4db5,
- 0x4e00, 0x9fcb,
- 0xa000, 0xa48c,
- 0xa4d0, 0xa4fd,
- 0xa500, 0xa60c,
- 0xa610, 0xa62b,
- 0xa640, 0xa672,
- 0xa67c, 0xa67d,
- 0xa67f, 0xa697,
- 0xa6a0, 0xa6f1,
- 0xa717, 0xa71f,
- 0xa722, 0xa788,
- 0xa78b, 0xa78e,
- 0xa790, 0xa791,
- 0xa7a0, 0xa7a9,
- 0xa7fa, 0xa827,
- 0xa840, 0xa873,
- 0xa880, 0xa8c4,
- 0xa8d0, 0xa8d9,
- 0xa8e0, 0xa8f7,
- 0xa8fb, 0xa8fb,
- 0xa900, 0xa92d,
- 0xa930, 0xa953,
- 0xa960, 0xa97c,
- 0xa980, 0xa9c0,
- 0xa9cf, 0xa9d9,
- 0xaa00, 0xaa36,
- 0xaa40, 0xaa4d,
- 0xaa50, 0xaa59,
- 0xaa60, 0xaa76,
- 0xaa7a, 0xaa7b,
- 0xaa80, 0xaac2,
- 0xaadb, 0xaadd,
- 0xab01, 0xab06,
- 0xab09, 0xab0e,
- 0xab11, 0xab16,
- 0xab20, 0xab26,
- 0xab28, 0xab2e,
- 0xabc0, 0xabea,
- 0xabec, 0xabed,
- 0xabf0, 0xabf9,
- 0xac00, 0xd7a3,
- 0xd7b0, 0xd7c6,
- 0xd7cb, 0xd7fb,
- 0xf900, 0xfa2d,
- 0xfa30, 0xfa6d,
- 0xfa70, 0xfad9,
- 0xfb00, 0xfb06,
- 0xfb13, 0xfb17,
- 0xfb1d, 0xfb28,
- 0xfb2a, 0xfb36,
- 0xfb38, 0xfb3c,
- 0xfb3e, 0xfb3e,
- 0xfb40, 0xfb41,
- 0xfb43, 0xfb44,
- 0xfb46, 0xfbb1,
- 0xfbd3, 0xfd3d,
- 0xfd50, 0xfd8f,
- 0xfd92, 0xfdc7,
- 0xfdf0, 0xfdfb,
+}; /* CR_In_Katakana_Phonetic_Extensions */
+
+/* 'In_Enclosed_CJK_Letters_and_Months': Block */
+static const OnigCodePoint CR_In_Enclosed_CJK_Letters_and_Months[] = {
+ 1,
+ 0x3200, 0x32ff,
+}; /* CR_In_Enclosed_CJK_Letters_and_Months */
+
+/* 'In_CJK_Compatibility': Block */
+static const OnigCodePoint CR_In_CJK_Compatibility[] = {
+ 1,
+ 0x3300, 0x33ff,
+}; /* CR_In_CJK_Compatibility */
+
+/* 'In_CJK_Unified_Ideographs_Extension_A': Block */
+static const OnigCodePoint CR_In_CJK_Unified_Ideographs_Extension_A[] = {
+ 1,
+ 0x3400, 0x4dbf,
+}; /* CR_In_CJK_Unified_Ideographs_Extension_A */
+
+/* 'In_Yijing_Hexagram_Symbols': Block */
+static const OnigCodePoint CR_In_Yijing_Hexagram_Symbols[] = {
+ 1,
+ 0x4dc0, 0x4dff,
+}; /* CR_In_Yijing_Hexagram_Symbols */
+
+/* 'In_CJK_Unified_Ideographs': Block */
+static const OnigCodePoint CR_In_CJK_Unified_Ideographs[] = {
+ 1,
+ 0x4e00, 0x9fff,
+}; /* CR_In_CJK_Unified_Ideographs */
+
+/* 'In_Yi_Syllables': Block */
+static const OnigCodePoint CR_In_Yi_Syllables[] = {
+ 1,
+ 0xa000, 0xa48f,
+}; /* CR_In_Yi_Syllables */
+
+/* 'In_Yi_Radicals': Block */
+static const OnigCodePoint CR_In_Yi_Radicals[] = {
+ 1,
+ 0xa490, 0xa4cf,
+}; /* CR_In_Yi_Radicals */
+
+/* 'In_Lisu': Block */
+#define CR_In_Lisu CR_Lisu
+
+/* 'In_Vai': Block */
+static const OnigCodePoint CR_In_Vai[] = {
+ 1,
+ 0xa500, 0xa63f,
+}; /* CR_In_Vai */
+
+/* 'In_Cyrillic_Extended_B': Block */
+static const OnigCodePoint CR_In_Cyrillic_Extended_B[] = {
+ 1,
+ 0xa640, 0xa69f,
+}; /* CR_In_Cyrillic_Extended_B */
+
+/* 'In_Bamum': Block */
+static const OnigCodePoint CR_In_Bamum[] = {
+ 1,
+ 0xa6a0, 0xa6ff,
+}; /* CR_In_Bamum */
+
+/* 'In_Modifier_Tone_Letters': Block */
+static const OnigCodePoint CR_In_Modifier_Tone_Letters[] = {
+ 1,
+ 0xa700, 0xa71f,
+}; /* CR_In_Modifier_Tone_Letters */
+
+/* 'In_Latin_Extended_D': Block */
+static const OnigCodePoint CR_In_Latin_Extended_D[] = {
+ 1,
+ 0xa720, 0xa7ff,
+}; /* CR_In_Latin_Extended_D */
+
+/* 'In_Syloti_Nagri': Block */
+static const OnigCodePoint CR_In_Syloti_Nagri[] = {
+ 1,
+ 0xa800, 0xa82f,
+}; /* CR_In_Syloti_Nagri */
+
+/* 'In_Common_Indic_Number_Forms': Block */
+static const OnigCodePoint CR_In_Common_Indic_Number_Forms[] = {
+ 1,
+ 0xa830, 0xa83f,
+}; /* CR_In_Common_Indic_Number_Forms */
+
+/* 'In_Phags_pa': Block */
+static const OnigCodePoint CR_In_Phags_pa[] = {
+ 1,
+ 0xa840, 0xa87f,
+}; /* CR_In_Phags_pa */
+
+/* 'In_Saurashtra': Block */
+static const OnigCodePoint CR_In_Saurashtra[] = {
+ 1,
+ 0xa880, 0xa8df,
+}; /* CR_In_Saurashtra */
+
+/* 'In_Devanagari_Extended': Block */
+static const OnigCodePoint CR_In_Devanagari_Extended[] = {
+ 1,
+ 0xa8e0, 0xa8ff,
+}; /* CR_In_Devanagari_Extended */
+
+/* 'In_Kayah_Li': Block */
+#define CR_In_Kayah_Li CR_Kayah_Li
+
+/* 'In_Rejang': Block */
+static const OnigCodePoint CR_In_Rejang[] = {
+ 1,
+ 0xa930, 0xa95f,
+}; /* CR_In_Rejang */
+
+/* 'In_Hangul_Jamo_Extended_A': Block */
+static const OnigCodePoint CR_In_Hangul_Jamo_Extended_A[] = {
+ 1,
+ 0xa960, 0xa97f,
+}; /* CR_In_Hangul_Jamo_Extended_A */
+
+/* 'In_Javanese': Block */
+static const OnigCodePoint CR_In_Javanese[] = {
+ 1,
+ 0xa980, 0xa9df,
+}; /* CR_In_Javanese */
+
+/* 'In_Cham': Block */
+static const OnigCodePoint CR_In_Cham[] = {
+ 1,
+ 0xaa00, 0xaa5f,
+}; /* CR_In_Cham */
+
+/* 'In_Myanmar_Extended_A': Block */
+static const OnigCodePoint CR_In_Myanmar_Extended_A[] = {
+ 1,
+ 0xaa60, 0xaa7f,
+}; /* CR_In_Myanmar_Extended_A */
+
+/* 'In_Tai_Viet': Block */
+static const OnigCodePoint CR_In_Tai_Viet[] = {
+ 1,
+ 0xaa80, 0xaadf,
+}; /* CR_In_Tai_Viet */
+
+/* 'In_Meetei_Mayek_Extensions': Block */
+static const OnigCodePoint CR_In_Meetei_Mayek_Extensions[] = {
+ 1,
+ 0xaae0, 0xaaff,
+}; /* CR_In_Meetei_Mayek_Extensions */
+
+/* 'In_Ethiopic_Extended_A': Block */
+static const OnigCodePoint CR_In_Ethiopic_Extended_A[] = {
+ 1,
+ 0xab00, 0xab2f,
+}; /* CR_In_Ethiopic_Extended_A */
+
+/* 'In_Meetei_Mayek': Block */
+static const OnigCodePoint CR_In_Meetei_Mayek[] = {
+ 1,
+ 0xabc0, 0xabff,
+}; /* CR_In_Meetei_Mayek */
+
+/* 'In_Hangul_Syllables': Block */
+static const OnigCodePoint CR_In_Hangul_Syllables[] = {
+ 1,
+ 0xac00, 0xd7af,
+}; /* CR_In_Hangul_Syllables */
+
+/* 'In_Hangul_Jamo_Extended_B': Block */
+static const OnigCodePoint CR_In_Hangul_Jamo_Extended_B[] = {
+ 1,
+ 0xd7b0, 0xd7ff,
+}; /* CR_In_Hangul_Jamo_Extended_B */
+
+/* 'In_High_Surrogates': Block */
+static const OnigCodePoint CR_In_High_Surrogates[] = {
+ 1,
+ 0xd800, 0xdb7f,
+}; /* CR_In_High_Surrogates */
+
+/* 'In_High_Private_Use_Surrogates': Block */
+static const OnigCodePoint CR_In_High_Private_Use_Surrogates[] = {
+ 1,
+ 0xdb80, 0xdbff,
+}; /* CR_In_High_Private_Use_Surrogates */
+
+/* 'In_Low_Surrogates': Block */
+static const OnigCodePoint CR_In_Low_Surrogates[] = {
+ 1,
+ 0xdc00, 0xdfff,
+}; /* CR_In_Low_Surrogates */
+
+/* 'In_Private_Use_Area': Block */
+static const OnigCodePoint CR_In_Private_Use_Area[] = {
+ 1,
+ 0xe000, 0xf8ff,
+}; /* CR_In_Private_Use_Area */
+
+/* 'In_CJK_Compatibility_Ideographs': Block */
+static const OnigCodePoint CR_In_CJK_Compatibility_Ideographs[] = {
+ 1,
+ 0xf900, 0xfaff,
+}; /* CR_In_CJK_Compatibility_Ideographs */
+
+/* 'In_Alphabetic_Presentation_Forms': Block */
+static const OnigCodePoint CR_In_Alphabetic_Presentation_Forms[] = {
+ 1,
+ 0xfb00, 0xfb4f,
+}; /* CR_In_Alphabetic_Presentation_Forms */
+
+/* 'In_Arabic_Presentation_Forms_A': Block */
+static const OnigCodePoint CR_In_Arabic_Presentation_Forms_A[] = {
+ 1,
+ 0xfb50, 0xfdff,
+}; /* CR_In_Arabic_Presentation_Forms_A */
+
+/* 'In_Variation_Selectors': Block */
+static const OnigCodePoint CR_In_Variation_Selectors[] = {
+ 1,
0xfe00, 0xfe0f,
- 0xfe20, 0xfe26,
- 0xfe33, 0xfe34,
- 0xfe4d, 0xfe4f,
- 0xfe70, 0xfe74,
- 0xfe76, 0xfefc,
- 0xff10, 0xff19,
- 0xff21, 0xff3a,
- 0xff3f, 0xff3f,
- 0xff41, 0xff5a,
- 0xff66, 0xffbe,
- 0xffc2, 0xffc7,
- 0xffca, 0xffcf,
- 0xffd2, 0xffd7,
- 0xffda, 0xffdc,
- 0x10000, 0x1000b,
- 0x1000d, 0x10026,
- 0x10028, 0x1003a,
- 0x1003c, 0x1003d,
- 0x1003f, 0x1004d,
- 0x10050, 0x1005d,
- 0x10080, 0x100fa,
- 0x10140, 0x10174,
- 0x101fd, 0x101fd,
- 0x10280, 0x1029c,
- 0x102a0, 0x102d0,
- 0x10300, 0x1031e,
- 0x10330, 0x1034a,
- 0x10380, 0x1039d,
- 0x103a0, 0x103c3,
- 0x103c8, 0x103cf,
- 0x103d1, 0x103d5,
- 0x10400, 0x1049d,
- 0x104a0, 0x104a9,
- 0x10800, 0x10805,
- 0x10808, 0x10808,
- 0x1080a, 0x10835,
- 0x10837, 0x10838,
- 0x1083c, 0x1083c,
- 0x1083f, 0x10855,
- 0x10900, 0x10915,
- 0x10920, 0x10939,
- 0x10a00, 0x10a03,
- 0x10a05, 0x10a06,
- 0x10a0c, 0x10a13,
- 0x10a15, 0x10a17,
- 0x10a19, 0x10a33,
- 0x10a38, 0x10a3a,
- 0x10a3f, 0x10a3f,
- 0x10a60, 0x10a7c,
- 0x10b00, 0x10b35,
- 0x10b40, 0x10b55,
- 0x10b60, 0x10b72,
- 0x10c00, 0x10c48,
- 0x11000, 0x11046,
- 0x11066, 0x1106f,
- 0x11080, 0x110ba,
- 0x12000, 0x1236e,
- 0x12400, 0x12462,
- 0x13000, 0x1342e,
- 0x16800, 0x16a38,
- 0x1b000, 0x1b001,
- 0x1d165, 0x1d169,
- 0x1d16d, 0x1d172,
- 0x1d17b, 0x1d182,
- 0x1d185, 0x1d18b,
- 0x1d1aa, 0x1d1ad,
- 0x1d242, 0x1d244,
- 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, 0x1d6c0,
- 0x1d6c2, 0x1d6da,
- 0x1d6dc, 0x1d6fa,
- 0x1d6fc, 0x1d714,
- 0x1d716, 0x1d734,
- 0x1d736, 0x1d74e,
- 0x1d750, 0x1d76e,
- 0x1d770, 0x1d788,
- 0x1d78a, 0x1d7a8,
- 0x1d7aa, 0x1d7c2,
- 0x1d7c4, 0x1d7cb,
- 0x1d7ce, 0x1d7ff,
- 0x20000, 0x2a6d6,
- 0x2a700, 0x2b734,
- 0x2b740, 0x2b81d,
- 0x2f800, 0x2fa1d,
+}; /* CR_In_Variation_Selectors */
+
+/* 'In_Vertical_Forms': Block */
+static const OnigCodePoint CR_In_Vertical_Forms[] = {
+ 1,
+ 0xfe10, 0xfe1f,
+}; /* CR_In_Vertical_Forms */
+
+/* 'In_Combining_Half_Marks': Block */
+static const OnigCodePoint CR_In_Combining_Half_Marks[] = {
+ 1,
+ 0xfe20, 0xfe2f,
+}; /* CR_In_Combining_Half_Marks */
+
+/* 'In_CJK_Compatibility_Forms': Block */
+static const OnigCodePoint CR_In_CJK_Compatibility_Forms[] = {
+ 1,
+ 0xfe30, 0xfe4f,
+}; /* CR_In_CJK_Compatibility_Forms */
+
+/* 'In_Small_Form_Variants': Block */
+static const OnigCodePoint CR_In_Small_Form_Variants[] = {
+ 1,
+ 0xfe50, 0xfe6f,
+}; /* CR_In_Small_Form_Variants */
+
+/* 'In_Arabic_Presentation_Forms_B': Block */
+static const OnigCodePoint CR_In_Arabic_Presentation_Forms_B[] = {
+ 1,
+ 0xfe70, 0xfeff,
+}; /* CR_In_Arabic_Presentation_Forms_B */
+
+/* 'In_Halfwidth_and_Fullwidth_Forms': Block */
+static const OnigCodePoint CR_In_Halfwidth_and_Fullwidth_Forms[] = {
+ 1,
+ 0xff00, 0xffef,
+}; /* CR_In_Halfwidth_and_Fullwidth_Forms */
+
+/* 'In_Specials': Block */
+static const OnigCodePoint CR_In_Specials[] = {
+ 1,
+ 0xfff0, 0xffff,
+}; /* CR_In_Specials */
+
+/* 'In_Linear_B_Syllabary': Block */
+static const OnigCodePoint CR_In_Linear_B_Syllabary[] = {
+ 1,
+ 0x10000, 0x1007f,
+}; /* CR_In_Linear_B_Syllabary */
+
+/* 'In_Linear_B_Ideograms': Block */
+static const OnigCodePoint CR_In_Linear_B_Ideograms[] = {
+ 1,
+ 0x10080, 0x100ff,
+}; /* CR_In_Linear_B_Ideograms */
+
+/* 'In_Aegean_Numbers': Block */
+static const OnigCodePoint CR_In_Aegean_Numbers[] = {
+ 1,
+ 0x10100, 0x1013f,
+}; /* CR_In_Aegean_Numbers */
+
+/* 'In_Ancient_Greek_Numbers': Block */
+static const OnigCodePoint CR_In_Ancient_Greek_Numbers[] = {
+ 1,
+ 0x10140, 0x1018f,
+}; /* CR_In_Ancient_Greek_Numbers */
+
+/* 'In_Ancient_Symbols': Block */
+static const OnigCodePoint CR_In_Ancient_Symbols[] = {
+ 1,
+ 0x10190, 0x101cf,
+}; /* CR_In_Ancient_Symbols */
+
+/* 'In_Phaistos_Disc': Block */
+static const OnigCodePoint CR_In_Phaistos_Disc[] = {
+ 1,
+ 0x101d0, 0x101ff,
+}; /* CR_In_Phaistos_Disc */
+
+/* 'In_Lycian': Block */
+static const OnigCodePoint CR_In_Lycian[] = {
+ 1,
+ 0x10280, 0x1029f,
+}; /* CR_In_Lycian */
+
+/* 'In_Carian': Block */
+static const OnigCodePoint CR_In_Carian[] = {
+ 1,
+ 0x102a0, 0x102df,
+}; /* CR_In_Carian */
+
+/* 'In_Old_Italic': Block */
+static const OnigCodePoint CR_In_Old_Italic[] = {
+ 1,
+ 0x10300, 0x1032f,
+}; /* CR_In_Old_Italic */
+
+/* 'In_Gothic': Block */
+static const OnigCodePoint CR_In_Gothic[] = {
+ 1,
+ 0x10330, 0x1034f,
+}; /* CR_In_Gothic */
+
+/* 'In_Ugaritic': Block */
+static const OnigCodePoint CR_In_Ugaritic[] = {
+ 1,
+ 0x10380, 0x1039f,
+}; /* CR_In_Ugaritic */
+
+/* 'In_Old_Persian': Block */
+static const OnigCodePoint CR_In_Old_Persian[] = {
+ 1,
+ 0x103a0, 0x103df,
+}; /* CR_In_Old_Persian */
+
+/* 'In_Deseret': Block */
+#define CR_In_Deseret CR_Deseret
+
+/* 'In_Shavian': Block */
+#define CR_In_Shavian CR_Shavian
+
+/* 'In_Osmanya': Block */
+static const OnigCodePoint CR_In_Osmanya[] = {
+ 1,
+ 0x10480, 0x104af,
+}; /* CR_In_Osmanya */
+
+/* 'In_Cypriot_Syllabary': Block */
+static const OnigCodePoint CR_In_Cypriot_Syllabary[] = {
+ 1,
+ 0x10800, 0x1083f,
+}; /* CR_In_Cypriot_Syllabary */
+
+/* 'In_Imperial_Aramaic': Block */
+static const OnigCodePoint CR_In_Imperial_Aramaic[] = {
+ 1,
+ 0x10840, 0x1085f,
+}; /* CR_In_Imperial_Aramaic */
+
+/* 'In_Phoenician': Block */
+static const OnigCodePoint CR_In_Phoenician[] = {
+ 1,
+ 0x10900, 0x1091f,
+}; /* CR_In_Phoenician */
+
+/* 'In_Lydian': Block */
+static const OnigCodePoint CR_In_Lydian[] = {
+ 1,
+ 0x10920, 0x1093f,
+}; /* CR_In_Lydian */
+
+/* 'In_Meroitic_Hieroglyphs': Block */
+#define CR_In_Meroitic_Hieroglyphs CR_Meroitic_Hieroglyphs
+
+/* 'In_Meroitic_Cursive': Block */
+static const OnigCodePoint CR_In_Meroitic_Cursive[] = {
+ 1,
+ 0x109a0, 0x109ff,
+}; /* CR_In_Meroitic_Cursive */
+
+/* 'In_Kharoshthi': Block */
+static const OnigCodePoint CR_In_Kharoshthi[] = {
+ 1,
+ 0x10a00, 0x10a5f,
+}; /* CR_In_Kharoshthi */
+
+/* 'In_Old_South_Arabian': Block */
+#define CR_In_Old_South_Arabian CR_Old_South_Arabian
+
+/* 'In_Avestan': Block */
+static const OnigCodePoint CR_In_Avestan[] = {
+ 1,
+ 0x10b00, 0x10b3f,
+}; /* CR_In_Avestan */
+
+/* 'In_Inscriptional_Parthian': Block */
+static const OnigCodePoint CR_In_Inscriptional_Parthian[] = {
+ 1,
+ 0x10b40, 0x10b5f,
+}; /* CR_In_Inscriptional_Parthian */
+
+/* 'In_Inscriptional_Pahlavi': Block */
+static const OnigCodePoint CR_In_Inscriptional_Pahlavi[] = {
+ 1,
+ 0x10b60, 0x10b7f,
+}; /* CR_In_Inscriptional_Pahlavi */
+
+/* 'In_Old_Turkic': Block */
+static const OnigCodePoint CR_In_Old_Turkic[] = {
+ 1,
+ 0x10c00, 0x10c4f,
+}; /* CR_In_Old_Turkic */
+
+/* 'In_Rumi_Numeral_Symbols': Block */
+static const OnigCodePoint CR_In_Rumi_Numeral_Symbols[] = {
+ 1,
+ 0x10e60, 0x10e7f,
+}; /* CR_In_Rumi_Numeral_Symbols */
+
+/* 'In_Brahmi': Block */
+static const OnigCodePoint CR_In_Brahmi[] = {
+ 1,
+ 0x11000, 0x1107f,
+}; /* CR_In_Brahmi */
+
+/* 'In_Kaithi': Block */
+static const OnigCodePoint CR_In_Kaithi[] = {
+ 1,
+ 0x11080, 0x110cf,
+}; /* CR_In_Kaithi */
+
+/* 'In_Sora_Sompeng': Block */
+static const OnigCodePoint CR_In_Sora_Sompeng[] = {
+ 1,
+ 0x110d0, 0x110ff,
+}; /* CR_In_Sora_Sompeng */
+
+/* 'In_Chakma': Block */
+static const OnigCodePoint CR_In_Chakma[] = {
+ 1,
+ 0x11100, 0x1114f,
+}; /* CR_In_Chakma */
+
+/* 'In_Sharada': Block */
+static const OnigCodePoint CR_In_Sharada[] = {
+ 1,
+ 0x11180, 0x111df,
+}; /* CR_In_Sharada */
+
+/* 'In_Takri': Block */
+static const OnigCodePoint CR_In_Takri[] = {
+ 1,
+ 0x11680, 0x116cf,
+}; /* CR_In_Takri */
+
+/* 'In_Cuneiform': Block */
+static const OnigCodePoint CR_In_Cuneiform[] = {
+ 1,
+ 0x12000, 0x123ff,
+}; /* CR_In_Cuneiform */
+
+/* 'In_Cuneiform_Numbers_and_Punctuation': Block */
+static const OnigCodePoint CR_In_Cuneiform_Numbers_and_Punctuation[] = {
+ 1,
+ 0x12400, 0x1247f,
+}; /* CR_In_Cuneiform_Numbers_and_Punctuation */
+
+/* 'In_Egyptian_Hieroglyphs': Block */
+static const OnigCodePoint CR_In_Egyptian_Hieroglyphs[] = {
+ 1,
+ 0x13000, 0x1342f,
+}; /* CR_In_Egyptian_Hieroglyphs */
+
+/* 'In_Bamum_Supplement': Block */
+static const OnigCodePoint CR_In_Bamum_Supplement[] = {
+ 1,
+ 0x16800, 0x16a3f,
+}; /* CR_In_Bamum_Supplement */
+
+/* 'In_Miao': Block */
+static const OnigCodePoint CR_In_Miao[] = {
+ 1,
+ 0x16f00, 0x16f9f,
+}; /* CR_In_Miao */
+
+/* 'In_Kana_Supplement': Block */
+static const OnigCodePoint CR_In_Kana_Supplement[] = {
+ 1,
+ 0x1b000, 0x1b0ff,
+}; /* CR_In_Kana_Supplement */
+
+/* 'In_Byzantine_Musical_Symbols': Block */
+static const OnigCodePoint CR_In_Byzantine_Musical_Symbols[] = {
+ 1,
+ 0x1d000, 0x1d0ff,
+}; /* CR_In_Byzantine_Musical_Symbols */
+
+/* 'In_Musical_Symbols': Block */
+static const OnigCodePoint CR_In_Musical_Symbols[] = {
+ 1,
+ 0x1d100, 0x1d1ff,
+}; /* CR_In_Musical_Symbols */
+
+/* 'In_Ancient_Greek_Musical_Notation': Block */
+static const OnigCodePoint CR_In_Ancient_Greek_Musical_Notation[] = {
+ 1,
+ 0x1d200, 0x1d24f,
+}; /* CR_In_Ancient_Greek_Musical_Notation */
+
+/* 'In_Tai_Xuan_Jing_Symbols': Block */
+static const OnigCodePoint CR_In_Tai_Xuan_Jing_Symbols[] = {
+ 1,
+ 0x1d300, 0x1d35f,
+}; /* CR_In_Tai_Xuan_Jing_Symbols */
+
+/* 'In_Counting_Rod_Numerals': Block */
+static const OnigCodePoint CR_In_Counting_Rod_Numerals[] = {
+ 1,
+ 0x1d360, 0x1d37f,
+}; /* CR_In_Counting_Rod_Numerals */
+
+/* 'In_Mathematical_Alphanumeric_Symbols': Block */
+static const OnigCodePoint CR_In_Mathematical_Alphanumeric_Symbols[] = {
+ 1,
+ 0x1d400, 0x1d7ff,
+}; /* CR_In_Mathematical_Alphanumeric_Symbols */
+
+/* 'In_Arabic_Mathematical_Alphabetic_Symbols': Block */
+static const OnigCodePoint CR_In_Arabic_Mathematical_Alphabetic_Symbols[] = {
+ 1,
+ 0x1ee00, 0x1eeff,
+}; /* CR_In_Arabic_Mathematical_Alphabetic_Symbols */
+
+/* 'In_Mahjong_Tiles': Block */
+static const OnigCodePoint CR_In_Mahjong_Tiles[] = {
+ 1,
+ 0x1f000, 0x1f02f,
+}; /* CR_In_Mahjong_Tiles */
+
+/* 'In_Domino_Tiles': Block */
+static const OnigCodePoint CR_In_Domino_Tiles[] = {
+ 1,
+ 0x1f030, 0x1f09f,
+}; /* CR_In_Domino_Tiles */
+
+/* 'In_Playing_Cards': Block */
+static const OnigCodePoint CR_In_Playing_Cards[] = {
+ 1,
+ 0x1f0a0, 0x1f0ff,
+}; /* CR_In_Playing_Cards */
+
+/* 'In_Enclosed_Alphanumeric_Supplement': Block */
+static const OnigCodePoint CR_In_Enclosed_Alphanumeric_Supplement[] = {
+ 1,
+ 0x1f100, 0x1f1ff,
+}; /* CR_In_Enclosed_Alphanumeric_Supplement */
+
+/* 'In_Enclosed_Ideographic_Supplement': Block */
+static const OnigCodePoint CR_In_Enclosed_Ideographic_Supplement[] = {
+ 1,
+ 0x1f200, 0x1f2ff,
+}; /* CR_In_Enclosed_Ideographic_Supplement */
+
+/* 'In_Miscellaneous_Symbols_And_Pictographs': Block */
+static const OnigCodePoint CR_In_Miscellaneous_Symbols_And_Pictographs[] = {
+ 1,
+ 0x1f300, 0x1f5ff,
+}; /* CR_In_Miscellaneous_Symbols_And_Pictographs */
+
+/* 'In_Emoticons': Block */
+static const OnigCodePoint CR_In_Emoticons[] = {
+ 1,
+ 0x1f600, 0x1f64f,
+}; /* CR_In_Emoticons */
+
+/* 'In_Transport_And_Map_Symbols': Block */
+static const OnigCodePoint CR_In_Transport_And_Map_Symbols[] = {
+ 1,
+ 0x1f680, 0x1f6ff,
+}; /* CR_In_Transport_And_Map_Symbols */
+
+/* 'In_Alchemical_Symbols': Block */
+static const OnigCodePoint CR_In_Alchemical_Symbols[] = {
+ 1,
+ 0x1f700, 0x1f77f,
+}; /* CR_In_Alchemical_Symbols */
+
+/* 'In_CJK_Unified_Ideographs_Extension_B': Block */
+static const OnigCodePoint CR_In_CJK_Unified_Ideographs_Extension_B[] = {
+ 1,
+ 0x20000, 0x2a6df,
+}; /* CR_In_CJK_Unified_Ideographs_Extension_B */
+
+/* 'In_CJK_Unified_Ideographs_Extension_C': Block */
+static const OnigCodePoint CR_In_CJK_Unified_Ideographs_Extension_C[] = {
+ 1,
+ 0x2a700, 0x2b73f,
+}; /* CR_In_CJK_Unified_Ideographs_Extension_C */
+
+/* 'In_CJK_Unified_Ideographs_Extension_D': Block */
+static const OnigCodePoint CR_In_CJK_Unified_Ideographs_Extension_D[] = {
+ 1,
+ 0x2b740, 0x2b81f,
+}; /* CR_In_CJK_Unified_Ideographs_Extension_D */
+
+/* 'In_CJK_Compatibility_Ideographs_Supplement': Block */
+static const OnigCodePoint CR_In_CJK_Compatibility_Ideographs_Supplement[] = {
+ 1,
+ 0x2f800, 0x2fa1f,
+}; /* CR_In_CJK_Compatibility_Ideographs_Supplement */
+
+/* 'In_Tags': Block */
+static const OnigCodePoint CR_In_Tags[] = {
+ 1,
+ 0xe0000, 0xe007f,
+}; /* CR_In_Tags */
+
+/* 'In_Variation_Selectors_Supplement': Block */
+static const OnigCodePoint CR_In_Variation_Selectors_Supplement[] = {
+ 1,
0xe0100, 0xe01ef,
-}; /* CR_Word */
+}; /* CR_In_Variation_Selectors_Supplement */
-/* 'Alnum': [[:Alnum:]] */
-static const OnigCodePoint CR_Alnum[] = {
- 509,
- 0x0030, 0x0039,
- 0x0041, 0x005a,
- 0x0061, 0x007a,
- 0x00aa, 0x00aa,
- 0x00b5, 0x00b5,
- 0x00ba, 0x00ba,
- 0x00c0, 0x00d6,
- 0x00d8, 0x00f6,
- 0x00f8, 0x02c1,
- 0x02c6, 0x02d1,
- 0x02e0, 0x02e4,
- 0x02ec, 0x02ec,
- 0x02ee, 0x02ee,
- 0x0345, 0x0345,
- 0x0370, 0x0374,
- 0x0376, 0x0377,
- 0x037a, 0x037d,
- 0x0386, 0x0386,
- 0x0388, 0x038a,
- 0x038c, 0x038c,
- 0x038e, 0x03a1,
- 0x03a3, 0x03f5,
- 0x03f7, 0x0481,
- 0x048a, 0x0527,
- 0x0531, 0x0556,
- 0x0559, 0x0559,
- 0x0561, 0x0587,
- 0x05b0, 0x05bd,
- 0x05bf, 0x05bf,
- 0x05c1, 0x05c2,
- 0x05c4, 0x05c5,
- 0x05c7, 0x05c7,
- 0x05d0, 0x05ea,
- 0x05f0, 0x05f2,
- 0x0610, 0x061a,
- 0x0620, 0x0657,
- 0x0659, 0x0669,
- 0x066e, 0x06d3,
- 0x06d5, 0x06dc,
- 0x06e1, 0x06e8,
- 0x06ed, 0x06fc,
- 0x06ff, 0x06ff,
- 0x0710, 0x073f,
- 0x074d, 0x07b1,
- 0x07c0, 0x07ea,
- 0x07f4, 0x07f5,
- 0x07fa, 0x07fa,
- 0x0800, 0x0817,
- 0x081a, 0x082c,
- 0x0840, 0x0858,
- 0x0900, 0x093b,
- 0x093d, 0x094c,
- 0x094e, 0x0950,
- 0x0955, 0x0963,
- 0x0966, 0x096f,
- 0x0971, 0x0977,
- 0x0979, 0x097f,
- 0x0981, 0x0983,
- 0x0985, 0x098c,
- 0x098f, 0x0990,
- 0x0993, 0x09a8,
- 0x09aa, 0x09b0,
- 0x09b2, 0x09b2,
- 0x09b6, 0x09b9,
- 0x09bd, 0x09c4,
- 0x09c7, 0x09c8,
- 0x09cb, 0x09cc,
- 0x09ce, 0x09ce,
- 0x09d7, 0x09d7,
- 0x09dc, 0x09dd,
- 0x09df, 0x09e3,
- 0x09e6, 0x09f1,
- 0x0a01, 0x0a03,
- 0x0a05, 0x0a0a,
- 0x0a0f, 0x0a10,
- 0x0a13, 0x0a28,
- 0x0a2a, 0x0a30,
- 0x0a32, 0x0a33,
- 0x0a35, 0x0a36,
- 0x0a38, 0x0a39,
- 0x0a3e, 0x0a42,
- 0x0a47, 0x0a48,
- 0x0a4b, 0x0a4c,
- 0x0a51, 0x0a51,
- 0x0a59, 0x0a5c,
- 0x0a5e, 0x0a5e,
- 0x0a66, 0x0a75,
- 0x0a81, 0x0a83,
- 0x0a85, 0x0a8d,
- 0x0a8f, 0x0a91,
- 0x0a93, 0x0aa8,
- 0x0aaa, 0x0ab0,
- 0x0ab2, 0x0ab3,
- 0x0ab5, 0x0ab9,
- 0x0abd, 0x0ac5,
- 0x0ac7, 0x0ac9,
- 0x0acb, 0x0acc,
- 0x0ad0, 0x0ad0,
- 0x0ae0, 0x0ae3,
- 0x0ae6, 0x0aef,
- 0x0b01, 0x0b03,
- 0x0b05, 0x0b0c,
- 0x0b0f, 0x0b10,
- 0x0b13, 0x0b28,
- 0x0b2a, 0x0b30,
- 0x0b32, 0x0b33,
- 0x0b35, 0x0b39,
- 0x0b3d, 0x0b44,
- 0x0b47, 0x0b48,
- 0x0b4b, 0x0b4c,
- 0x0b56, 0x0b57,
- 0x0b5c, 0x0b5d,
- 0x0b5f, 0x0b63,
- 0x0b66, 0x0b6f,
- 0x0b71, 0x0b71,
- 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, 0x0bcc,
- 0x0bd0, 0x0bd0,
- 0x0bd7, 0x0bd7,
- 0x0be6, 0x0bef,
- 0x0c01, 0x0c03,
- 0x0c05, 0x0c0c,
- 0x0c0e, 0x0c10,
- 0x0c12, 0x0c28,
- 0x0c2a, 0x0c33,
- 0x0c35, 0x0c39,
- 0x0c3d, 0x0c44,
- 0x0c46, 0x0c48,
- 0x0c4a, 0x0c4c,
- 0x0c55, 0x0c56,
- 0x0c58, 0x0c59,
- 0x0c60, 0x0c63,
- 0x0c66, 0x0c6f,
- 0x0c82, 0x0c83,
- 0x0c85, 0x0c8c,
- 0x0c8e, 0x0c90,
- 0x0c92, 0x0ca8,
- 0x0caa, 0x0cb3,
- 0x0cb5, 0x0cb9,
- 0x0cbd, 0x0cc4,
- 0x0cc6, 0x0cc8,
- 0x0cca, 0x0ccc,
- 0x0cd5, 0x0cd6,
- 0x0cde, 0x0cde,
- 0x0ce0, 0x0ce3,
- 0x0ce6, 0x0cef,
- 0x0cf1, 0x0cf2,
- 0x0d02, 0x0d03,
- 0x0d05, 0x0d0c,
- 0x0d0e, 0x0d10,
- 0x0d12, 0x0d3a,
- 0x0d3d, 0x0d44,
- 0x0d46, 0x0d48,
- 0x0d4a, 0x0d4c,
- 0x0d4e, 0x0d4e,
- 0x0d57, 0x0d57,
- 0x0d60, 0x0d63,
- 0x0d66, 0x0d6f,
- 0x0d7a, 0x0d7f,
- 0x0d82, 0x0d83,
- 0x0d85, 0x0d96,
- 0x0d9a, 0x0db1,
- 0x0db3, 0x0dbb,
- 0x0dbd, 0x0dbd,
- 0x0dc0, 0x0dc6,
- 0x0dcf, 0x0dd4,
- 0x0dd6, 0x0dd6,
- 0x0dd8, 0x0ddf,
- 0x0df2, 0x0df3,
- 0x0e01, 0x0e3a,
- 0x0e40, 0x0e46,
- 0x0e4d, 0x0e4d,
- 0x0e50, 0x0e59,
- 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,
- 0x0ecd, 0x0ecd,
- 0x0ed0, 0x0ed9,
- 0x0edc, 0x0edd,
- 0x0f00, 0x0f00,
- 0x0f20, 0x0f29,
- 0x0f40, 0x0f47,
- 0x0f49, 0x0f6c,
- 0x0f71, 0x0f81,
- 0x0f88, 0x0f97,
- 0x0f99, 0x0fbc,
- 0x1000, 0x1036,
- 0x1038, 0x1038,
- 0x103b, 0x1049,
- 0x1050, 0x1062,
- 0x1065, 0x1068,
- 0x106e, 0x1086,
- 0x108e, 0x108e,
- 0x1090, 0x1099,
- 0x109c, 0x109d,
- 0x10a0, 0x10c5,
- 0x10d0, 0x10fa,
- 0x10fc, 0x10fc,
- 0x1100, 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,
- 0x135f, 0x135f,
- 0x1380, 0x138f,
- 0x13a0, 0x13f4,
- 0x1401, 0x166c,
- 0x166f, 0x167f,
- 0x1681, 0x169a,
- 0x16a0, 0x16ea,
- 0x16ee, 0x16f0,
- 0x1700, 0x170c,
- 0x170e, 0x1713,
- 0x1720, 0x1733,
- 0x1740, 0x1753,
- 0x1760, 0x176c,
- 0x176e, 0x1770,
- 0x1772, 0x1773,
- 0x1780, 0x17b3,
- 0x17b6, 0x17c8,
- 0x17d7, 0x17d7,
- 0x17dc, 0x17dc,
- 0x17e0, 0x17e9,
- 0x1810, 0x1819,
- 0x1820, 0x1877,
- 0x1880, 0x18aa,
- 0x18b0, 0x18f5,
- 0x1900, 0x191c,
- 0x1920, 0x192b,
- 0x1930, 0x1938,
- 0x1946, 0x196d,
- 0x1970, 0x1974,
- 0x1980, 0x19ab,
- 0x19b0, 0x19c9,
- 0x19d0, 0x19d9,
- 0x1a00, 0x1a1b,
- 0x1a20, 0x1a5e,
- 0x1a61, 0x1a74,
- 0x1a80, 0x1a89,
- 0x1a90, 0x1a99,
- 0x1aa7, 0x1aa7,
- 0x1b00, 0x1b33,
- 0x1b35, 0x1b43,
- 0x1b45, 0x1b4b,
- 0x1b50, 0x1b59,
- 0x1b80, 0x1ba9,
- 0x1bae, 0x1bb9,
- 0x1bc0, 0x1be5,
- 0x1be7, 0x1bf1,
- 0x1c00, 0x1c35,
- 0x1c40, 0x1c49,
- 0x1c4d, 0x1c7d,
- 0x1ce9, 0x1cec,
- 0x1cee, 0x1cf2,
- 0x1d00, 0x1dbf,
- 0x1e00, 0x1f15,
- 0x1f18, 0x1f1d,
- 0x1f20, 0x1f45,
- 0x1f48, 0x1f4d,
- 0x1f50, 0x1f57,
- 0x1f59, 0x1f59,
- 0x1f5b, 0x1f5b,
- 0x1f5d, 0x1f5d,
- 0x1f5f, 0x1f7d,
- 0x1f80, 0x1fb4,
- 0x1fb6, 0x1fbc,
- 0x1fbe, 0x1fbe,
- 0x1fc2, 0x1fc4,
- 0x1fc6, 0x1fcc,
- 0x1fd0, 0x1fd3,
- 0x1fd6, 0x1fdb,
- 0x1fe0, 0x1fec,
- 0x1ff2, 0x1ff4,
- 0x1ff6, 0x1ffc,
- 0x2071, 0x2071,
- 0x207f, 0x207f,
- 0x2090, 0x209c,
- 0x2102, 0x2102,
- 0x2107, 0x2107,
- 0x210a, 0x2113,
- 0x2115, 0x2115,
- 0x2119, 0x211d,
- 0x2124, 0x2124,
- 0x2126, 0x2126,
- 0x2128, 0x2128,
- 0x212a, 0x212d,
- 0x212f, 0x2139,
- 0x213c, 0x213f,
- 0x2145, 0x2149,
- 0x214e, 0x214e,
- 0x2160, 0x2188,
- 0x24b6, 0x24e9,
- 0x2c00, 0x2c2e,
- 0x2c30, 0x2c5e,
- 0x2c60, 0x2ce4,
- 0x2ceb, 0x2cee,
- 0x2d00, 0x2d25,
- 0x2d30, 0x2d65,
- 0x2d6f, 0x2d6f,
- 0x2d80, 0x2d96,
- 0x2da0, 0x2da6,
- 0x2da8, 0x2dae,
- 0x2db0, 0x2db6,
- 0x2db8, 0x2dbe,
- 0x2dc0, 0x2dc6,
- 0x2dc8, 0x2dce,
- 0x2dd0, 0x2dd6,
- 0x2dd8, 0x2dde,
- 0x2de0, 0x2dff,
- 0x2e2f, 0x2e2f,
- 0x3005, 0x3007,
- 0x3021, 0x3029,
- 0x3031, 0x3035,
- 0x3038, 0x303c,
- 0x3041, 0x3096,
- 0x309d, 0x309f,
- 0x30a1, 0x30fa,
- 0x30fc, 0x30ff,
- 0x3105, 0x312d,
- 0x3131, 0x318e,
- 0x31a0, 0x31ba,
- 0x31f0, 0x31ff,
- 0x3400, 0x4db5,
- 0x4e00, 0x9fcb,
- 0xa000, 0xa48c,
- 0xa4d0, 0xa4fd,
- 0xa500, 0xa60c,
- 0xa610, 0xa62b,
- 0xa640, 0xa66e,
- 0xa67f, 0xa697,
- 0xa6a0, 0xa6ef,
- 0xa717, 0xa71f,
- 0xa722, 0xa788,
- 0xa78b, 0xa78e,
- 0xa790, 0xa791,
- 0xa7a0, 0xa7a9,
- 0xa7fa, 0xa801,
- 0xa803, 0xa805,
- 0xa807, 0xa80a,
- 0xa80c, 0xa827,
- 0xa840, 0xa873,
- 0xa880, 0xa8c3,
- 0xa8d0, 0xa8d9,
- 0xa8f2, 0xa8f7,
- 0xa8fb, 0xa8fb,
- 0xa900, 0xa92a,
- 0xa930, 0xa952,
- 0xa960, 0xa97c,
- 0xa980, 0xa9b2,
- 0xa9b4, 0xa9bf,
- 0xa9cf, 0xa9d9,
- 0xaa00, 0xaa36,
- 0xaa40, 0xaa4d,
- 0xaa50, 0xaa59,
- 0xaa60, 0xaa76,
- 0xaa7a, 0xaa7a,
- 0xaa80, 0xaabe,
- 0xaac0, 0xaac0,
- 0xaac2, 0xaac2,
- 0xaadb, 0xaadd,
- 0xab01, 0xab06,
- 0xab09, 0xab0e,
- 0xab11, 0xab16,
- 0xab20, 0xab26,
- 0xab28, 0xab2e,
- 0xabc0, 0xabea,
- 0xabf0, 0xabf9,
- 0xac00, 0xd7a3,
- 0xd7b0, 0xd7c6,
- 0xd7cb, 0xd7fb,
- 0xf900, 0xfa2d,
- 0xfa30, 0xfa6d,
- 0xfa70, 0xfad9,
- 0xfb00, 0xfb06,
- 0xfb13, 0xfb17,
- 0xfb1d, 0xfb28,
- 0xfb2a, 0xfb36,
- 0xfb38, 0xfb3c,
- 0xfb3e, 0xfb3e,
- 0xfb40, 0xfb41,
- 0xfb43, 0xfb44,
- 0xfb46, 0xfbb1,
- 0xfbd3, 0xfd3d,
- 0xfd50, 0xfd8f,
- 0xfd92, 0xfdc7,
- 0xfdf0, 0xfdfb,
- 0xfe70, 0xfe74,
- 0xfe76, 0xfefc,
- 0xff10, 0xff19,
- 0xff21, 0xff3a,
- 0xff41, 0xff5a,
- 0xff66, 0xffbe,
- 0xffc2, 0xffc7,
- 0xffca, 0xffcf,
- 0xffd2, 0xffd7,
- 0xffda, 0xffdc,
- 0x10000, 0x1000b,
- 0x1000d, 0x10026,
- 0x10028, 0x1003a,
- 0x1003c, 0x1003d,
- 0x1003f, 0x1004d,
- 0x10050, 0x1005d,
- 0x10080, 0x100fa,
- 0x10140, 0x10174,
- 0x10280, 0x1029c,
- 0x102a0, 0x102d0,
- 0x10300, 0x1031e,
- 0x10330, 0x1034a,
- 0x10380, 0x1039d,
- 0x103a0, 0x103c3,
- 0x103c8, 0x103cf,
- 0x103d1, 0x103d5,
- 0x10400, 0x1049d,
- 0x104a0, 0x104a9,
- 0x10800, 0x10805,
- 0x10808, 0x10808,
- 0x1080a, 0x10835,
- 0x10837, 0x10838,
- 0x1083c, 0x1083c,
- 0x1083f, 0x10855,
- 0x10900, 0x10915,
- 0x10920, 0x10939,
- 0x10a00, 0x10a03,
- 0x10a05, 0x10a06,
- 0x10a0c, 0x10a13,
- 0x10a15, 0x10a17,
- 0x10a19, 0x10a33,
- 0x10a60, 0x10a7c,
- 0x10b00, 0x10b35,
- 0x10b40, 0x10b55,
- 0x10b60, 0x10b72,
- 0x10c00, 0x10c48,
- 0x11000, 0x11045,
- 0x11066, 0x1106f,
- 0x11082, 0x110b8,
- 0x12000, 0x1236e,
- 0x12400, 0x12462,
- 0x13000, 0x1342e,
- 0x16800, 0x16a38,
- 0x1b000, 0x1b001,
- 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, 0x1d6c0,
- 0x1d6c2, 0x1d6da,
- 0x1d6dc, 0x1d6fa,
- 0x1d6fc, 0x1d714,
- 0x1d716, 0x1d734,
- 0x1d736, 0x1d74e,
- 0x1d750, 0x1d76e,
- 0x1d770, 0x1d788,
- 0x1d78a, 0x1d7a8,
- 0x1d7aa, 0x1d7c2,
- 0x1d7c4, 0x1d7cb,
- 0x1d7ce, 0x1d7ff,
- 0x20000, 0x2a6d6,
- 0x2a700, 0x2b734,
- 0x2b740, 0x2b81d,
- 0x2f800, 0x2fa1d,
-}; /* CR_Alnum */
+/* 'In_Supplementary_Private_Use_Area_A': Block */
+static const OnigCodePoint CR_In_Supplementary_Private_Use_Area_A[] = {
+ 1,
+ 0xf0000, 0xfffff,
+}; /* CR_In_Supplementary_Private_Use_Area_A */
-/* 'ASCII': [[:ASCII:]] */
-static const OnigCodePoint CR_ASCII[] = {
+/* 'In_Supplementary_Private_Use_Area_B': Block */
+static const OnigCodePoint CR_In_Supplementary_Private_Use_Area_B[] = {
1,
- 0x0000, 0x007f,
-}; /* CR_ASCII */
+ 0x100000, 0x10ffff,
+}; /* CR_In_Supplementary_Private_Use_Area_B */
+
+/* 'In_No_Block': Block */
+static const OnigCodePoint CR_In_No_Block[] = {
+ 36,
+ 0x0860, 0x089f,
+ 0x1ab0, 0x1aff,
+ 0x1c80, 0x1cbf,
+ 0x2fe0, 0x2fef,
+ 0xa9e0, 0xa9ff,
+ 0xab30, 0xabbf,
+ 0x10200, 0x1027f,
+ 0x102e0, 0x102ff,
+ 0x10350, 0x1037f,
+ 0x103e0, 0x103ff,
+ 0x104b0, 0x107ff,
+ 0x10860, 0x108ff,
+ 0x10940, 0x1097f,
+ 0x10a80, 0x10aff,
+ 0x10b80, 0x10bff,
+ 0x10c50, 0x10e5f,
+ 0x10e80, 0x10fff,
+ 0x11150, 0x1117f,
+ 0x111e0, 0x1167f,
+ 0x116d0, 0x11fff,
+ 0x12480, 0x12fff,
+ 0x13430, 0x167ff,
+ 0x16a40, 0x16eff,
+ 0x16fa0, 0x1afff,
+ 0x1b100, 0x1cfff,
+ 0x1d250, 0x1d2ff,
+ 0x1d380, 0x1d3ff,
+ 0x1d800, 0x1edff,
+ 0x1ef00, 0x1efff,
+ 0x1f650, 0x1f67f,
+ 0x1f780, 0x1ffff,
+ 0x2a6e0, 0x2a6ff,
+ 0x2b820, 0x2f7ff,
+ 0x2fa20, 0xdffff,
+ 0xe0080, 0xe00ff,
+ 0xe01f0, 0xeffff,
+}; /* CR_In_No_Block */
+#endif /* USE_UNICODE_PROPERTIES */
static const OnigCodePoint* const CodeRanges[] = {
CR_NEWLINE,
@@ -21973,7 +25510,6 @@ static const OnigCodePoint* const CodeRanges[] = {
CR_Alnum,
CR_ASCII,
#ifdef USE_UNICODE_PROPERTIES
-#ifdef USE_UNICODE_PROPERTIES
CR_Any,
CR_Assigned,
CR_C,
@@ -21983,6 +25519,7 @@ static const OnigCodePoint* const CodeRanges[] = {
CR_Co,
CR_Cs,
CR_L,
+ CR_LC,
CR_Ll,
CR_Lm,
CR_Lo,
@@ -22127,6 +25664,13 @@ static const OnigCodePoint* const CodeRanges[] = {
CR_Batak,
CR_Brahmi,
CR_Mandaic,
+ CR_Chakma,
+ CR_Meroitic_Cursive,
+ CR_Meroitic_Hieroglyphs,
+ CR_Miao,
+ CR_Sharada,
+ CR_Sora_Sompeng,
+ CR_Takri,
CR_White_Space,
CR_Bidi_Control,
CR_Join_Control,
@@ -22172,7 +25716,228 @@ static const OnigCodePoint* const CodeRanges[] = {
CR_Age_5_1,
CR_Age_5_2,
CR_Age_6_0,
-#endif /* USE_UNICODE_PROPERTIES */
+ CR_Age_6_1,
+ CR_In_Basic_Latin,
+ CR_In_Latin_1_Supplement,
+ CR_In_Latin_Extended_A,
+ CR_In_Latin_Extended_B,
+ CR_In_IPA_Extensions,
+ CR_In_Spacing_Modifier_Letters,
+ CR_In_Combining_Diacritical_Marks,
+ CR_In_Greek_and_Coptic,
+ CR_In_Cyrillic,
+ CR_In_Cyrillic_Supplement,
+ CR_In_Armenian,
+ CR_In_Hebrew,
+ CR_In_Arabic,
+ CR_In_Syriac,
+ CR_In_Arabic_Supplement,
+ CR_In_Thaana,
+ CR_In_NKo,
+ CR_In_Samaritan,
+ CR_In_Mandaic,
+ CR_In_Arabic_Extended_A,
+ CR_In_Devanagari,
+ CR_In_Bengali,
+ CR_In_Gurmukhi,
+ CR_In_Gujarati,
+ CR_In_Oriya,
+ CR_In_Tamil,
+ CR_In_Telugu,
+ CR_In_Kannada,
+ CR_In_Malayalam,
+ CR_In_Sinhala,
+ CR_In_Thai,
+ CR_In_Lao,
+ CR_In_Tibetan,
+ CR_In_Myanmar,
+ CR_In_Georgian,
+ CR_In_Hangul_Jamo,
+ CR_In_Ethiopic,
+ CR_In_Ethiopic_Supplement,
+ CR_In_Cherokee,
+ CR_In_Unified_Canadian_Aboriginal_Syllabics,
+ CR_In_Ogham,
+ CR_In_Runic,
+ CR_In_Tagalog,
+ CR_In_Hanunoo,
+ CR_In_Buhid,
+ CR_In_Tagbanwa,
+ CR_In_Khmer,
+ CR_In_Mongolian,
+ CR_In_Unified_Canadian_Aboriginal_Syllabics_Extended,
+ CR_In_Limbu,
+ CR_In_Tai_Le,
+ CR_In_New_Tai_Lue,
+ CR_In_Khmer_Symbols,
+ CR_In_Buginese,
+ CR_In_Tai_Tham,
+ CR_In_Balinese,
+ CR_In_Sundanese,
+ CR_In_Batak,
+ CR_In_Lepcha,
+ CR_In_Ol_Chiki,
+ CR_In_Sundanese_Supplement,
+ CR_In_Vedic_Extensions,
+ CR_In_Phonetic_Extensions,
+ CR_In_Phonetic_Extensions_Supplement,
+ CR_In_Combining_Diacritical_Marks_Supplement,
+ CR_In_Latin_Extended_Additional,
+ CR_In_Greek_Extended,
+ CR_In_General_Punctuation,
+ CR_In_Superscripts_and_Subscripts,
+ CR_In_Currency_Symbols,
+ CR_In_Combining_Diacritical_Marks_for_Symbols,
+ CR_In_Letterlike_Symbols,
+ CR_In_Number_Forms,
+ CR_In_Arrows,
+ CR_In_Mathematical_Operators,
+ CR_In_Miscellaneous_Technical,
+ CR_In_Control_Pictures,
+ CR_In_Optical_Character_Recognition,
+ CR_In_Enclosed_Alphanumerics,
+ CR_In_Box_Drawing,
+ CR_In_Block_Elements,
+ CR_In_Geometric_Shapes,
+ CR_In_Miscellaneous_Symbols,
+ CR_In_Dingbats,
+ CR_In_Miscellaneous_Mathematical_Symbols_A,
+ CR_In_Supplemental_Arrows_A,
+ CR_In_Braille_Patterns,
+ CR_In_Supplemental_Arrows_B,
+ CR_In_Miscellaneous_Mathematical_Symbols_B,
+ CR_In_Supplemental_Mathematical_Operators,
+ CR_In_Miscellaneous_Symbols_and_Arrows,
+ CR_In_Glagolitic,
+ CR_In_Latin_Extended_C,
+ CR_In_Coptic,
+ CR_In_Georgian_Supplement,
+ CR_In_Tifinagh,
+ CR_In_Ethiopic_Extended,
+ CR_In_Cyrillic_Extended_A,
+ CR_In_Supplemental_Punctuation,
+ CR_In_CJK_Radicals_Supplement,
+ CR_In_Kangxi_Radicals,
+ CR_In_Ideographic_Description_Characters,
+ CR_In_CJK_Symbols_and_Punctuation,
+ CR_In_Hiragana,
+ CR_In_Katakana,
+ CR_In_Bopomofo,
+ CR_In_Hangul_Compatibility_Jamo,
+ CR_In_Kanbun,
+ CR_In_Bopomofo_Extended,
+ CR_In_CJK_Strokes,
+ CR_In_Katakana_Phonetic_Extensions,
+ CR_In_Enclosed_CJK_Letters_and_Months,
+ CR_In_CJK_Compatibility,
+ CR_In_CJK_Unified_Ideographs_Extension_A,
+ CR_In_Yijing_Hexagram_Symbols,
+ CR_In_CJK_Unified_Ideographs,
+ CR_In_Yi_Syllables,
+ CR_In_Yi_Radicals,
+ CR_In_Lisu,
+ CR_In_Vai,
+ CR_In_Cyrillic_Extended_B,
+ CR_In_Bamum,
+ CR_In_Modifier_Tone_Letters,
+ CR_In_Latin_Extended_D,
+ CR_In_Syloti_Nagri,
+ CR_In_Common_Indic_Number_Forms,
+ CR_In_Phags_pa,
+ CR_In_Saurashtra,
+ CR_In_Devanagari_Extended,
+ CR_In_Kayah_Li,
+ CR_In_Rejang,
+ CR_In_Hangul_Jamo_Extended_A,
+ CR_In_Javanese,
+ CR_In_Cham,
+ CR_In_Myanmar_Extended_A,
+ CR_In_Tai_Viet,
+ CR_In_Meetei_Mayek_Extensions,
+ CR_In_Ethiopic_Extended_A,
+ CR_In_Meetei_Mayek,
+ CR_In_Hangul_Syllables,
+ CR_In_Hangul_Jamo_Extended_B,
+ CR_In_High_Surrogates,
+ CR_In_High_Private_Use_Surrogates,
+ CR_In_Low_Surrogates,
+ CR_In_Private_Use_Area,
+ CR_In_CJK_Compatibility_Ideographs,
+ CR_In_Alphabetic_Presentation_Forms,
+ CR_In_Arabic_Presentation_Forms_A,
+ CR_In_Variation_Selectors,
+ CR_In_Vertical_Forms,
+ CR_In_Combining_Half_Marks,
+ CR_In_CJK_Compatibility_Forms,
+ CR_In_Small_Form_Variants,
+ CR_In_Arabic_Presentation_Forms_B,
+ CR_In_Halfwidth_and_Fullwidth_Forms,
+ CR_In_Specials,
+ CR_In_Linear_B_Syllabary,
+ CR_In_Linear_B_Ideograms,
+ CR_In_Aegean_Numbers,
+ CR_In_Ancient_Greek_Numbers,
+ CR_In_Ancient_Symbols,
+ CR_In_Phaistos_Disc,
+ CR_In_Lycian,
+ CR_In_Carian,
+ CR_In_Old_Italic,
+ CR_In_Gothic,
+ CR_In_Ugaritic,
+ CR_In_Old_Persian,
+ CR_In_Deseret,
+ CR_In_Shavian,
+ CR_In_Osmanya,
+ CR_In_Cypriot_Syllabary,
+ CR_In_Imperial_Aramaic,
+ CR_In_Phoenician,
+ CR_In_Lydian,
+ CR_In_Meroitic_Hieroglyphs,
+ CR_In_Meroitic_Cursive,
+ CR_In_Kharoshthi,
+ CR_In_Old_South_Arabian,
+ CR_In_Avestan,
+ CR_In_Inscriptional_Parthian,
+ CR_In_Inscriptional_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_Sharada,
+ CR_In_Takri,
+ CR_In_Cuneiform,
+ CR_In_Cuneiform_Numbers_and_Punctuation,
+ CR_In_Egyptian_Hieroglyphs,
+ CR_In_Bamum_Supplement,
+ CR_In_Miao,
+ CR_In_Kana_Supplement,
+ 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_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_Emoticons,
+ CR_In_Transport_And_Map_Symbols,
+ CR_In_Alchemical_Symbols,
+ CR_In_CJK_Unified_Ideographs_Extension_B,
+ CR_In_CJK_Unified_Ideographs_Extension_C,
+ CR_In_CJK_Unified_Ideographs_Extension_D,
+ CR_In_CJK_Compatibility_Ideographs_Supplement,
+ CR_In_Tags,
+ CR_In_Variation_Selectors_Supplement,
+ CR_In_Supplementary_Private_Use_Area_A,
+ CR_In_Supplementary_Private_Use_Area_B,
+ CR_In_No_Block,
#endif /* USE_UNICODE_PROPERTIES */
};
struct uniname2ctype_struct {
@@ -22182,19 +25947,19 @@ struct uniname2ctype_struct {
static const struct uniname2ctype_struct *uniname2ctype_p(const char *, unsigned int);
#ifndef USE_UNICODE_PROPERTIES
-#define TOTAL_KEYWORDS 15
+#define TOTAL_KEYWORDS 14
#define MIN_WORD_LENGTH 4
-#define MAX_WORD_LENGTH 7
-#define MIN_HASH_VALUE 7
-#define MAX_HASH_VALUE 21
-/* maximum key range = 15, duplicates = 0 */
+#define MAX_WORD_LENGTH 6
+#define MIN_HASH_VALUE 6
+#define MAX_HASH_VALUE 19
+/* maximum key range = 14, duplicates = 0 */
#else /* USE_UNICODE_PROPERTIES */
-#define TOTAL_KEYWORDS 387
+#define TOTAL_KEYWORDS 625
#define MIN_WORD_LENGTH 1
-#define MAX_WORD_LENGTH 30
+#define MAX_WORD_LENGTH 44
#define MIN_HASH_VALUE 3
-#define MAX_HASH_VALUE 1741
-/* maximum key range = 1739, duplicates = 0 */
+#define MAX_HASH_VALUE 4167
+/* maximum key range = 4165, duplicates = 0 */
#endif /* USE_UNICODE_PROPERTIES */
#ifdef __GNUC__
@@ -22216,33 +25981,33 @@ uniname2ctype_hash (str, len)
#endif /* USE_UNICODE_PROPERTIES */
{
#ifndef USE_UNICODE_PROPERTIES
- 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
- 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
- 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
- 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
- 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
- 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
- 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
- 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
- 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
- 22, 22, 22, 22, 22, 22, 22, 3, 13, 6,
- 4, 22, 22, 11, 22, 1, 22, 22, 10, 22,
- 2, 22, 1, 22, 10, 8, 4, 7, 22, 3,
- 4, 22, 22, 22, 22, 22, 22, 22
+ 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
+ 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
+ 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
+ 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
+ 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
+ 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
+ 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
+ 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
+ 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
+ 20, 20, 20, 20, 20, 20, 20, 3, 11, 5,
+ 4, 20, 20, 9, 20, 1, 20, 20, 10, 20,
+ 2, 20, 1, 20, 1, 7, 4, 6, 20, 1,
+ 4, 20, 20, 20, 20, 20, 20, 20
#else /* USE_UNICODE_PROPERTIES */
- 1742, 1742, 1742, 1742, 1742, 1742, 1742, 1742, 1742, 1742,
- 1742, 1742, 1742, 1742, 1742, 1742, 1742, 1742, 1742, 1742,
- 1742, 1742, 1742, 1742, 1742, 1742, 1742, 1742, 1742, 1742,
- 1742, 1742, 1742, 1742, 1742, 1742, 1742, 1742, 1742, 1742,
- 1742, 1742, 1742, 1742, 1742, 1742, 2, 1742, 9, 1,
- 2, 18, 5, 3, 4, 1742, 1742, 1742, 1742, 1742,
- 1742, 1742, 1742, 1742, 1742, 1742, 1742, 1742, 1742, 1742,
- 1742, 1742, 1742, 1742, 1742, 1742, 1742, 1742, 1742, 1742,
- 1742, 1742, 1742, 1742, 1742, 1742, 1742, 1742, 1742, 1742,
- 1742, 1742, 1742, 1742, 1742, 1742, 1742, 8, 280, 6,
- 96, 67, 362, 294, 38, 9, 63, 517, 2, 213,
- 1, 4, 192, 3, 10, 57, 31, 316, 1, 549,
- 330, 567, 36, 1742, 1742, 1742, 1742, 1742
+ 4168, 4168, 4168, 4168, 4168, 4168, 4168, 4168, 4168, 4168,
+ 4168, 4168, 4168, 4168, 4168, 4168, 4168, 4168, 4168, 4168,
+ 4168, 4168, 4168, 4168, 4168, 4168, 4168, 4168, 4168, 4168,
+ 4168, 4168, 4168, 4168, 4168, 4168, 4168, 4168, 4168, 4168,
+ 4168, 4168, 4168, 4168, 4168, 4168, 1, 4168, 13, 1,
+ 3, 28, 31, 10, 27, 4168, 4168, 4168, 4168, 4168,
+ 4168, 4168, 4168, 4168, 4168, 4168, 4168, 4168, 4168, 4168,
+ 4168, 4168, 4168, 4168, 4168, 4168, 4168, 4168, 4168, 4168,
+ 4168, 4168, 4168, 4168, 4168, 4168, 4168, 4168, 4168, 4168,
+ 4168, 4168, 4168, 4168, 4168, 4168, 4168, 13, 854, 14,
+ 443, 19, 7, 570, 335, 4, 66, 1159, 102, 34,
+ 1, 178, 474, 1, 192, 2, 64, 1117, 491, 264,
+ 256, 1305, 3, 4168, 4168, 4168, 4168, 4168
#endif /* USE_UNICODE_PROPERTIES */
};
#ifndef USE_UNICODE_PROPERTIES
@@ -22290,823 +26055,1298 @@ uniname2ctype_hash (str, len)
struct uniname2ctype_pool_t
{
#ifndef USE_UNICODE_PROPERTIES
+ char uniname2ctype_pool_str6[sizeof("word")];
char uniname2ctype_pool_str7[sizeof("print")];
char uniname2ctype_pool_str8[sizeof("punct")];
char uniname2ctype_pool_str9[sizeof("alpha")];
char uniname2ctype_pool_str10[sizeof("alnum")];
char uniname2ctype_pool_str11[sizeof("xdigit")];
- char uniname2ctype_pool_str12[sizeof("newline")];
- char uniname2ctype_pool_str13[sizeof("upper")];
- char uniname2ctype_pool_str14[sizeof("ascii")];
- char uniname2ctype_pool_str15[sizeof("cntrl")];
- char uniname2ctype_pool_str16[sizeof("space")];
- char uniname2ctype_pool_str17[sizeof("word")];
- char uniname2ctype_pool_str18[sizeof("lower")];
- char uniname2ctype_pool_str19[sizeof("graph")];
- char uniname2ctype_pool_str20[sizeof("digit")];
- char uniname2ctype_pool_str21[sizeof("blank")];
+ char uniname2ctype_pool_str12[sizeof("upper")];
+ char uniname2ctype_pool_str13[sizeof("ascii")];
+ char uniname2ctype_pool_str14[sizeof("cntrl")];
+ char uniname2ctype_pool_str15[sizeof("space")];
+ char uniname2ctype_pool_str16[sizeof("lower")];
+ char uniname2ctype_pool_str17[sizeof("graph")];
+ char uniname2ctype_pool_str18[sizeof("digit")];
+ char uniname2ctype_pool_str19[sizeof("blank")];
#else /* USE_UNICODE_PROPERTIES */
char uniname2ctype_pool_str3[sizeof("n")];
- char uniname2ctype_pool_str5[sizeof("l")];
- char uniname2ctype_pool_str7[sizeof("nl")];
- char uniname2ctype_pool_str8[sizeof("ll")];
- char uniname2ctype_pool_str10[sizeof("cn")];
- char uniname2ctype_pool_str11[sizeof("no")];
- char uniname2ctype_pool_str12[sizeof("lo")];
- char uniname2ctype_pool_str13[sizeof("c")];
- char uniname2ctype_pool_str16[sizeof("co")];
- char uniname2ctype_pool_str20[sizeof("cc")];
- char uniname2ctype_pool_str21[sizeof("lao")];
- char uniname2ctype_pool_str22[sizeof("laoo")];
- char uniname2ctype_pool_str23[sizeof("lana")];
- char uniname2ctype_pool_str26[sizeof("ci")];
- char uniname2ctype_pool_str29[sizeof("qaac")];
- char uniname2ctype_pool_str30[sizeof("vai")];
- char uniname2ctype_pool_str31[sizeof("vaii")];
- char uniname2ctype_pool_str32[sizeof("qaai")];
- char uniname2ctype_pool_str34[sizeof("control")];
- char uniname2ctype_pool_str37[sizeof("cari")];
- char uniname2ctype_pool_str40[sizeof("carian")];
- char uniname2ctype_pool_str42[sizeof("zl")];
- char uniname2ctype_pool_str44[sizeof("oriya")];
- char uniname2ctype_pool_str46[sizeof("latn")];
- char uniname2ctype_pool_str47[sizeof("cntrl")];
- char uniname2ctype_pool_str48[sizeof("latin")];
- char uniname2ctype_pool_str51[sizeof("han")];
- char uniname2ctype_pool_str53[sizeof("arabic")];
- char uniname2ctype_pool_str54[sizeof("ital")];
- char uniname2ctype_pool_str55[sizeof("hano")];
- char uniname2ctype_pool_str60[sizeof("hani")];
- char uniname2ctype_pool_str63[sizeof("hanunoo")];
- char uniname2ctype_pool_str66[sizeof("lt")];
- char uniname2ctype_pool_str67[sizeof("so")];
- char uniname2ctype_pool_str69[sizeof("hira")];
- char uniname2ctype_pool_str70[sizeof("nchar")];
- char uniname2ctype_pool_str71[sizeof("sc")];
- char uniname2ctype_pool_str73[sizeof("z")];
- char uniname2ctype_pool_str74[sizeof("oalpha")];
- char uniname2ctype_pool_str75[sizeof("tavt")];
- char uniname2ctype_pool_str76[sizeof("cans")];
- char uniname2ctype_pool_str84[sizeof("java")];
- char uniname2ctype_pool_str88[sizeof("zinh")];
- char uniname2ctype_pool_str89[sizeof("thaa")];
- char uniname2ctype_pool_str90[sizeof("thai")];
- char uniname2ctype_pool_str91[sizeof("variationselector")];
- char uniname2ctype_pool_str92[sizeof("sinhala")];
- char uniname2ctype_pool_str93[sizeof("joinc")];
- char uniname2ctype_pool_str94[sizeof("ascii")];
- char uniname2ctype_pool_str95[sizeof("initialpunctuation")];
- char uniname2ctype_pool_str98[sizeof("other")];
- char uniname2ctype_pool_str99[sizeof("joincontrol")];
- char uniname2ctype_pool_str100[sizeof("thaana")];
- char uniname2ctype_pool_str101[sizeof("avst")];
- char uniname2ctype_pool_str103[sizeof("olower")];
- char uniname2ctype_pool_str105[sizeof("othernumber")];
- char uniname2ctype_pool_str106[sizeof("otherletter")];
- char uniname2ctype_pool_str109[sizeof("sinh")];
- char uniname2ctype_pool_str112[sizeof("tale")];
- char uniname2ctype_pool_str114[sizeof("connectorpunctuation")];
- char uniname2ctype_pool_str115[sizeof("s")];
- char uniname2ctype_pool_str116[sizeof("di")];
- char uniname2ctype_pool_str117[sizeof("vs")];
- char uniname2ctype_pool_str119[sizeof("oidc")];
- char uniname2ctype_pool_str120[sizeof("idc")];
- char uniname2ctype_pool_str121[sizeof("odi")];
- char uniname2ctype_pool_str122[sizeof("cs")];
- char uniname2ctype_pool_str123[sizeof("avestan")];
- char uniname2ctype_pool_str124[sizeof("dia")];
- char uniname2ctype_pool_str125[sizeof("cher")];
- char uniname2ctype_pool_str126[sizeof("inscriptionalparthian")];
- char uniname2ctype_pool_str128[sizeof("shavian")];
- char uniname2ctype_pool_str137[sizeof("radical")];
- char uniname2ctype_pool_str143[sizeof("loe")];
- char uniname2ctype_pool_str147[sizeof("diacritic")];
- char uniname2ctype_pool_str148[sizeof("zzzz")];
- char uniname2ctype_pool_str149[sizeof("ethi")];
- char uniname2ctype_pool_str151[sizeof("canadianaboriginal")];
- char uniname2ctype_pool_str152[sizeof("zs")];
- char uniname2ctype_pool_str153[sizeof("othersymbol")];
- char uniname2ctype_pool_str156[sizeof("olditalic")];
- char uniname2ctype_pool_str161[sizeof("inscriptionalpahlavi")];
- char uniname2ctype_pool_str162[sizeof("taiviet")];
- char uniname2ctype_pool_str163[sizeof("lineseparator")];
- char uniname2ctype_pool_str166[sizeof("otheridstart")];
- char uniname2ctype_pool_str170[sizeof("oids")];
- char uniname2ctype_pool_str171[sizeof("asciihexdigit")];
- char uniname2ctype_pool_str172[sizeof("inherited")];
- char uniname2ctype_pool_str174[sizeof("otherlowercase")];
- char uniname2ctype_pool_str175[sizeof("terminalpunctuation")];
- char uniname2ctype_pool_str176[sizeof("deva")];
- char uniname2ctype_pool_str179[sizeof("otheralphabetic")];
- char uniname2ctype_pool_str180[sizeof("ideo")];
- char uniname2ctype_pool_str181[sizeof("noncharactercodepoint")];
- char uniname2ctype_pool_str183[sizeof("otheridcontinue")];
- char uniname2ctype_pool_str187[sizeof("taile")];
- char uniname2ctype_pool_str190[sizeof("oldpersian")];
- char uniname2ctype_pool_str192[sizeof("devanagari")];
- char uniname2ctype_pool_str193[sizeof("letter")];
- char uniname2ctype_pool_str195[sizeof("nd")];
- char uniname2ctype_pool_str197[sizeof("idst")];
- char uniname2ctype_pool_str198[sizeof("dsrt")];
- char uniname2ctype_pool_str200[sizeof("titlecaseletter")];
- char uniname2ctype_pool_str202[sizeof("po")];
- char uniname2ctype_pool_str203[sizeof("dash")];
- char uniname2ctype_pool_str206[sizeof("pc")];
- char uniname2ctype_pool_str209[sizeof("letternumber")];
- char uniname2ctype_pool_str212[sizeof("pi")];
- char uniname2ctype_pool_str215[sizeof("javanese")];
- char uniname2ctype_pool_str217[sizeof("mn")];
- char uniname2ctype_pool_str218[sizeof("idstart")];
- char uniname2ctype_pool_str220[sizeof("idcontinue")];
- char uniname2ctype_pool_str222[sizeof("ids")];
- char uniname2ctype_pool_str223[sizeof("alpha")];
- char uniname2ctype_pool_str227[sizeof("mc")];
- char uniname2ctype_pool_str229[sizeof("coptic")];
- char uniname2ctype_pool_str234[sizeof("mongolian")];
- char uniname2ctype_pool_str235[sizeof("common")];
- char uniname2ctype_pool_str236[sizeof("armn")];
- char uniname2ctype_pool_str237[sizeof("copt")];
- char uniname2ctype_pool_str243[sizeof("cprt")];
- char uniname2ctype_pool_str244[sizeof("armi")];
- char uniname2ctype_pool_str245[sizeof("phli")];
- char uniname2ctype_pool_str246[sizeof("prti")];
- char uniname2ctype_pool_str250[sizeof("armenian")];
- char uniname2ctype_pool_str251[sizeof("sd")];
- char uniname2ctype_pool_str252[sizeof("mandaic")];
- char uniname2ctype_pool_str255[sizeof("phoenician")];
- char uniname2ctype_pool_str258[sizeof("taml")];
- char uniname2ctype_pool_str261[sizeof("tamil")];
- char uniname2ctype_pool_str268[sizeof("cased")];
- char uniname2ctype_pool_str269[sizeof("cham")];
- char uniname2ctype_pool_str270[sizeof("idsbinaryoperator")];
- char uniname2ctype_pool_str271[sizeof("lepc")];
- char uniname2ctype_pool_str275[sizeof("otherdefaultignorablecodepoint")];
- char uniname2ctype_pool_str278[sizeof("print")];
- char uniname2ctype_pool_str286[sizeof("osma")];
- char uniname2ctype_pool_str292[sizeof("samr")];
- char uniname2ctype_pool_str294[sizeof("math")];
- char uniname2ctype_pool_str296[sizeof("linb")];
- char uniname2ctype_pool_str297[sizeof("closepunctuation")];
- char uniname2ctype_pool_str301[sizeof("otherpunctuation")];
- char uniname2ctype_pool_str303[sizeof("bali")];
- char uniname2ctype_pool_str306[sizeof("omath")];
- char uniname2ctype_pool_str307[sizeof("samaritan")];
- char uniname2ctype_pool_str308[sizeof("ps")];
- char uniname2ctype_pool_str310[sizeof("arab")];
- char uniname2ctype_pool_str311[sizeof("brai")];
- char uniname2ctype_pool_str314[sizeof("taitham")];
- char uniname2ctype_pool_str317[sizeof("linearb")];
- char uniname2ctype_pool_str321[sizeof("lepcha")];
- char uniname2ctype_pool_str322[sizeof("mand")];
- char uniname2ctype_pool_str324[sizeof("mtei")];
- char uniname2ctype_pool_str325[sizeof("term")];
- char uniname2ctype_pool_str326[sizeof("glagolitic")];
- char uniname2ctype_pool_str327[sizeof("privateuse")];
- char uniname2ctype_pool_str328[sizeof("pe")];
- char uniname2ctype_pool_str335[sizeof("deseret")];
- char uniname2ctype_pool_str340[sizeof("brah")];
- char uniname2ctype_pool_str341[sizeof("runr")];
- char uniname2ctype_pool_str343[sizeof("othermath")];
- char uniname2ctype_pool_str344[sizeof("runic")];
- char uniname2ctype_pool_str345[sizeof("hang")];
- char uniname2ctype_pool_str346[sizeof("ethiopic")];
- char uniname2ctype_pool_str349[sizeof("me")];
- char uniname2ctype_pool_str350[sizeof("patws")];
- char uniname2ctype_pool_str353[sizeof("separator")];
- char uniname2ctype_pool_str355[sizeof("tibt")];
- char uniname2ctype_pool_str356[sizeof("gothic")];
- char uniname2ctype_pool_str358[sizeof("tagbanwa")];
- char uniname2ctype_pool_str359[sizeof("sarb")];
- char uniname2ctype_pool_str361[sizeof("talu")];
- char uniname2ctype_pool_str367[sizeof("tibetan")];
- char uniname2ctype_pool_str371[sizeof("goth")];
- char uniname2ctype_pool_str372[sizeof("rjng")];
- char uniname2ctype_pool_str373[sizeof("hangul")];
- char uniname2ctype_pool_str374[sizeof("bengali")];
- char uniname2ctype_pool_str375[sizeof("hiragana")];
- char uniname2ctype_pool_str376[sizeof("braille")];
- char uniname2ctype_pool_str379[sizeof("geor")];
- char uniname2ctype_pool_str380[sizeof("age=1.1")];
- char uniname2ctype_pool_str381[sizeof("age=2.1")];
- char uniname2ctype_pool_str382[sizeof("age=5.1")];
- char uniname2ctype_pool_str383[sizeof("age=5.2")];
- char uniname2ctype_pool_str384[sizeof("age=4.1")];
- char uniname2ctype_pool_str385[sizeof("p")];
- char uniname2ctype_pool_str386[sizeof("pd")];
- char uniname2ctype_pool_str388[sizeof("lisu")];
- char uniname2ctype_pool_str389[sizeof("age=2.0")];
- char uniname2ctype_pool_str390[sizeof("age=5.0")];
- char uniname2ctype_pool_str391[sizeof("age=6.0")];
- char uniname2ctype_pool_str392[sizeof("age=4.0")];
- char uniname2ctype_pool_str393[sizeof("graph")];
- char uniname2ctype_pool_str395[sizeof("saur")];
- char uniname2ctype_pool_str396[sizeof("space")];
- char uniname2ctype_pool_str397[sizeof("age=3.1")];
- char uniname2ctype_pool_str398[sizeof("age=3.2")];
- char uniname2ctype_pool_str399[sizeof("hebr")];
- char uniname2ctype_pool_str402[sizeof("bidic")];
- char uniname2ctype_pool_str405[sizeof("age=3.0")];
- char uniname2ctype_pool_str408[sizeof("bidicontrol")];
- char uniname2ctype_pool_str413[sizeof("logicalorderexception")];
- char uniname2ctype_pool_str420[sizeof("telu")];
- char uniname2ctype_pool_str422[sizeof("zp")];
- char uniname2ctype_pool_str427[sizeof("m")];
- char uniname2ctype_pool_str430[sizeof("lm")];
- char uniname2ctype_pool_str432[sizeof("idstrinaryoperator")];
- char uniname2ctype_pool_str433[sizeof("balinese")];
- char uniname2ctype_pool_str434[sizeof("uideo")];
- char uniname2ctype_pool_str436[sizeof("spaceseparator")];
- char uniname2ctype_pool_str438[sizeof("grext")];
- char uniname2ctype_pool_str442[sizeof("alnum")];
- char uniname2ctype_pool_str443[sizeof("oldturkic")];
- char uniname2ctype_pool_str445[sizeof("xidc")];
- char uniname2ctype_pool_str446[sizeof("idsb")];
- char uniname2ctype_pool_str447[sizeof("ahex")];
- char uniname2ctype_pool_str452[sizeof("format")];
- char uniname2ctype_pool_str456[sizeof("caseignorable")];
- char uniname2ctype_pool_str457[sizeof("tifinagh")];
- char uniname2ctype_pool_str459[sizeof("sundanese")];
- char uniname2ctype_pool_str462[sizeof("ext")];
- char uniname2ctype_pool_str464[sizeof("saurashtra")];
- char uniname2ctype_pool_str465[sizeof("patternwhitespace")];
- char uniname2ctype_pool_str466[sizeof("digit")];
- char uniname2ctype_pool_str474[sizeof("sund")];
- char uniname2ctype_pool_str480[sizeof("decimalnumber")];
- char uniname2ctype_pool_str484[sizeof("bopo")];
- char uniname2ctype_pool_str485[sizeof("sm")];
- char uniname2ctype_pool_str488[sizeof("otheruppercase")];
- char uniname2ctype_pool_str493[sizeof("ideographic")];
- char uniname2ctype_pool_str496[sizeof("xids")];
- char uniname2ctype_pool_str497[sizeof("unassigned")];
- char uniname2ctype_pool_str502[sizeof("phagspa")];
- char uniname2ctype_pool_str506[sizeof("alphabetic")];
- char uniname2ctype_pool_str508[sizeof("limb")];
- char uniname2ctype_pool_str512[sizeof("xdigit")];
- char uniname2ctype_pool_str513[sizeof("xidstart")];
- char uniname2ctype_pool_str516[sizeof("mong")];
- char uniname2ctype_pool_str518[sizeof("xidcontinue")];
- char uniname2ctype_pool_str521[sizeof("assigned")];
- char uniname2ctype_pool_str523[sizeof("ogam")];
- char uniname2ctype_pool_str529[sizeof("nko")];
- char uniname2ctype_pool_str530[sizeof("nkoo")];
- char uniname2ctype_pool_str533[sizeof("olck")];
- char uniname2ctype_pool_str534[sizeof("deprecated")];
- char uniname2ctype_pool_str535[sizeof("brahmi")];
- char uniname2ctype_pool_str536[sizeof("phag")];
- char uniname2ctype_pool_str538[sizeof("kana")];
- char uniname2ctype_pool_str540[sizeof("kali")];
- char uniname2ctype_pool_str542[sizeof("changeswhenlowercased")];
- char uniname2ctype_pool_str543[sizeof("extender")];
- char uniname2ctype_pool_str550[sizeof("dep")];
- char uniname2ctype_pool_str554[sizeof("olchiki")];
- char uniname2ctype_pool_str562[sizeof("cwl")];
- char uniname2ctype_pool_str563[sizeof("graphemebase")];
- char uniname2ctype_pool_str565[sizeof("phnx")];
- char uniname2ctype_pool_str573[sizeof("orkh")];
- char uniname2ctype_pool_str576[sizeof("punct")];
- char uniname2ctype_pool_str577[sizeof("khar")];
- char uniname2ctype_pool_str580[sizeof("lower")];
- char uniname2ctype_pool_str586[sizeof("sterm")];
- char uniname2ctype_pool_str587[sizeof("yi")];
- char uniname2ctype_pool_str588[sizeof("lyci")];
- char uniname2ctype_pool_str589[sizeof("cyrl")];
- char uniname2ctype_pool_str591[sizeof("lycian")];
- char uniname2ctype_pool_str592[sizeof("finalpunctuation")];
- char uniname2ctype_pool_str593[sizeof("orya")];
- char uniname2ctype_pool_str594[sizeof("graphemeextend")];
- char uniname2ctype_pool_str596[sizeof("kaithi")];
- char uniname2ctype_pool_str597[sizeof("xpeo")];
- char uniname2ctype_pool_str598[sizeof("yiii")];
- char uniname2ctype_pool_str599[sizeof("kthi")];
- char uniname2ctype_pool_str601[sizeof("cyrillic")];
- char uniname2ctype_pool_str602[sizeof("glag")];
- char uniname2ctype_pool_str605[sizeof("oupper")];
- char uniname2ctype_pool_str617[sizeof("tagb")];
- char uniname2ctype_pool_str620[sizeof("cwt")];
- char uniname2ctype_pool_str623[sizeof("number")];
- char uniname2ctype_pool_str625[sizeof("tglg")];
- char uniname2ctype_pool_str626[sizeof("knda")];
- char uniname2ctype_pool_str627[sizeof("lowercaseletter")];
- char uniname2ctype_pool_str628[sizeof("changeswhentitlecased")];
- char uniname2ctype_pool_str629[sizeof("softdotted")];
- char uniname2ctype_pool_str632[sizeof("ugar")];
- char uniname2ctype_pool_str634[sizeof("sylo")];
- char uniname2ctype_pool_str636[sizeof("lu")];
- char uniname2ctype_pool_str640[sizeof("tagalog")];
- char uniname2ctype_pool_str643[sizeof("kharoshthi")];
- char uniname2ctype_pool_str644[sizeof("syrc")];
- char uniname2ctype_pool_str645[sizeof("kannada")];
- char uniname2ctype_pool_str646[sizeof("beng")];
- char uniname2ctype_pool_str647[sizeof("lowercase")];
- char uniname2ctype_pool_str656[sizeof("shaw")];
- char uniname2ctype_pool_str659[sizeof("patternsyntax")];
- char uniname2ctype_pool_str660[sizeof("syriac")];
- char uniname2ctype_pool_str663[sizeof("word")];
- char uniname2ctype_pool_str667[sizeof("imperialaramaic")];
- char uniname2ctype_pool_str672[sizeof("ugaritic")];
- char uniname2ctype_pool_str675[sizeof("enclosingmark")];
- char uniname2ctype_pool_str677[sizeof("georgian")];
- char uniname2ctype_pool_str678[sizeof("lydi")];
- char uniname2ctype_pool_str681[sizeof("lydian")];
- char uniname2ctype_pool_str686[sizeof("sylotinagri")];
- char uniname2ctype_pool_str687[sizeof("gujr")];
- char uniname2ctype_pool_str692[sizeof("tfng")];
- char uniname2ctype_pool_str696[sizeof("currencysymbol")];
- char uniname2ctype_pool_str701[sizeof("newline")];
- char uniname2ctype_pool_str705[sizeof("bopomofo")];
- char uniname2ctype_pool_str706[sizeof("ogrext")];
- char uniname2ctype_pool_str707[sizeof("cherokee")];
- char uniname2ctype_pool_str708[sizeof("gujarati")];
- char uniname2ctype_pool_str710[sizeof("newtailue")];
- char uniname2ctype_pool_str716[sizeof("dashpunctuation")];
- char uniname2ctype_pool_str718[sizeof("oldsoutharabian")];
- char uniname2ctype_pool_str725[sizeof("upper")];
- char uniname2ctype_pool_str732[sizeof("cf")];
- char uniname2ctype_pool_str734[sizeof("buhd")];
- char uniname2ctype_pool_str735[sizeof("rejang")];
- char uniname2ctype_pool_str736[sizeof("othergraphemeextend")];
- char uniname2ctype_pool_str739[sizeof("modifierletter")];
- char uniname2ctype_pool_str745[sizeof("nonspacingmark")];
- char uniname2ctype_pool_str749[sizeof("changeswhencasemapped")];
- char uniname2ctype_pool_str752[sizeof("mark")];
- char uniname2ctype_pool_str757[sizeof("surrogate")];
- char uniname2ctype_pool_str765[sizeof("paragraphseparator")];
- char uniname2ctype_pool_str767[sizeof("ogham")];
- char uniname2ctype_pool_str768[sizeof("hex")];
- char uniname2ctype_pool_str772[sizeof("uppercaseletter")];
- char uniname2ctype_pool_str777[sizeof("hexdigit")];
- char uniname2ctype_pool_str778[sizeof("cwcm")];
- char uniname2ctype_pool_str781[sizeof("grbase")];
- char uniname2ctype_pool_str782[sizeof("khmr")];
- char uniname2ctype_pool_str788[sizeof("unifiedideograph")];
- char uniname2ctype_pool_str792[sizeof("uppercase")];
- char uniname2ctype_pool_str793[sizeof("khmer")];
- char uniname2ctype_pool_str795[sizeof("spacingmark")];
- char uniname2ctype_pool_str797[sizeof("whitespace")];
- char uniname2ctype_pool_str806[sizeof("patsyn")];
- char uniname2ctype_pool_str816[sizeof("cypriot")];
- char uniname2ctype_pool_str818[sizeof("openpunctuation")];
- char uniname2ctype_pool_str821[sizeof("bamu")];
- char uniname2ctype_pool_str831[sizeof("buhid")];
- char uniname2ctype_pool_str840[sizeof("batk")];
- char uniname2ctype_pool_str851[sizeof("symbol")];
- char uniname2ctype_pool_str856[sizeof("changeswhenuppercased")];
- char uniname2ctype_pool_str857[sizeof("osmanya")];
- char uniname2ctype_pool_str861[sizeof("limbu")];
- char uniname2ctype_pool_str868[sizeof("punctuation")];
- char uniname2ctype_pool_str872[sizeof("hyphen")];
- char uniname2ctype_pool_str888[sizeof("mathsymbol")];
- char uniname2ctype_pool_str892[sizeof("grek")];
- char uniname2ctype_pool_str898[sizeof("changeswhencasefolded")];
- char uniname2ctype_pool_str902[sizeof("quotationmark")];
- char uniname2ctype_pool_str903[sizeof("bugi")];
- char uniname2ctype_pool_str916[sizeof("cuneiform")];
- char uniname2ctype_pool_str918[sizeof("pf")];
- char uniname2ctype_pool_str927[sizeof("cwcf")];
- char uniname2ctype_pool_str932[sizeof("bamum")];
- char uniname2ctype_pool_str940[sizeof("guru")];
- char uniname2ctype_pool_str944[sizeof("wspace")];
- char uniname2ctype_pool_str951[sizeof("meeteimayek")];
- char uniname2ctype_pool_str976[sizeof("defaultignorablecodepoint")];
- char uniname2ctype_pool_str980[sizeof("modifiersymbol")];
- char uniname2ctype_pool_str999[sizeof("mlym")];
- char uniname2ctype_pool_str1007[sizeof("mymr")];
- char uniname2ctype_pool_str1020[sizeof("malayalam")];
- char uniname2ctype_pool_str1026[sizeof("myanmar")];
- char uniname2ctype_pool_str1032[sizeof("telugu")];
- char uniname2ctype_pool_str1033[sizeof("buginese")];
- char uniname2ctype_pool_str1037[sizeof("xsux")];
- char uniname2ctype_pool_str1093[sizeof("sk")];
- char uniname2ctype_pool_str1097[sizeof("katakana")];
- char uniname2ctype_pool_str1124[sizeof("egyp")];
- char uniname2ctype_pool_str1146[sizeof("any")];
- char uniname2ctype_pool_str1148[sizeof("kayahli")];
- char uniname2ctype_pool_str1190[sizeof("cwu")];
- char uniname2ctype_pool_str1263[sizeof("qmark")];
- char uniname2ctype_pool_str1329[sizeof("blank")];
- char uniname2ctype_pool_str1347[sizeof("grlink")];
- char uniname2ctype_pool_str1358[sizeof("batak")];
- char uniname2ctype_pool_str1395[sizeof("unknown")];
- char uniname2ctype_pool_str1410[sizeof("greek")];
- char uniname2ctype_pool_str1463[sizeof("graphemelink")];
- char uniname2ctype_pool_str1470[sizeof("gurmukhi")];
- char uniname2ctype_pool_str1556[sizeof("hebrew")];
- char uniname2ctype_pool_str1621[sizeof("egyptianhieroglyphs")];
- char uniname2ctype_pool_str1741[sizeof("zyyy")];
+ char uniname2ctype_pool_str5[sizeof("s")];
+ char uniname2ctype_pool_str7[sizeof("z")];
+ char uniname2ctype_pool_str9[sizeof("zs")];
+ char uniname2ctype_pool_str16[sizeof("zzzz")];
+ char uniname2ctype_pool_str18[sizeof("cn")];
+ char uniname2ctype_pool_str20[sizeof("cs")];
+ char uniname2ctype_pool_str24[sizeof("ci")];
+ char uniname2ctype_pool_str29[sizeof("c")];
+ char uniname2ctype_pool_str30[sizeof("cf")];
+ char uniname2ctype_pool_str32[sizeof("sc")];
+ char uniname2ctype_pool_str34[sizeof("cans")];
+ char uniname2ctype_pool_str35[sizeof("qaai")];
+ char uniname2ctype_pool_str38[sizeof("mn")];
+ char uniname2ctype_pool_str42[sizeof("ascii")];
+ char uniname2ctype_pool_str44[sizeof("cc")];
+ char uniname2ctype_pool_str45[sizeof("qaac")];
+ char uniname2ctype_pool_str49[sizeof("inavestan")];
+ char uniname2ctype_pool_str52[sizeof("inspecials")];
+ char uniname2ctype_pool_str62[sizeof("inipaextensions")];
+ char uniname2ctype_pool_str64[sizeof("mc")];
+ char uniname2ctype_pool_str66[sizeof("insamaritan")];
+ char uniname2ctype_pool_str69[sizeof("m")];
+ char uniname2ctype_pool_str72[sizeof("sm")];
+ char uniname2ctype_pool_str74[sizeof("me")];
+ char uniname2ctype_pool_str82[sizeof("inarmenian")];
+ char uniname2ctype_pool_str84[sizeof("incuneiform")];
+ char uniname2ctype_pool_str86[sizeof("mandaic")];
+ char uniname2ctype_pool_str90[sizeof("inancientsymbols")];
+ char uniname2ctype_pool_str92[sizeof("incuneiformnumbersandpunctuation")];
+ char uniname2ctype_pool_str96[sizeof("inthai")];
+ char uniname2ctype_pool_str99[sizeof("inmusicalsymbols")];
+ char uniname2ctype_pool_str100[sizeof("inmiscellaneoussymbols")];
+ char uniname2ctype_pool_str106[sizeof("incham")];
+ char uniname2ctype_pool_str109[sizeof("inmiscellaneoussymbolsandarrows")];
+ char uniname2ctype_pool_str113[sizeof("initialpunctuation")];
+ char uniname2ctype_pool_str114[sizeof("inmiscellaneoussymbolsandpictographs")];
+ char uniname2ctype_pool_str116[sizeof("inthaana")];
+ char uniname2ctype_pool_str124[sizeof("taile")];
+ char uniname2ctype_pool_str125[sizeof("mtei")];
+ char uniname2ctype_pool_str132[sizeof("lc")];
+ char uniname2ctype_pool_str133[sizeof("lana")];
+ char uniname2ctype_pool_str134[sizeof("inlycian")];
+ char uniname2ctype_pool_str135[sizeof("intransportandmapsymbols")];
+ char uniname2ctype_pool_str136[sizeof("incontrolpictures")];
+ char uniname2ctype_pool_str142[sizeof("sinhala")];
+ char uniname2ctype_pool_str151[sizeof("incommonindicnumberforms")];
+ char uniname2ctype_pool_str156[sizeof("inmiscellaneousmathematicalsymbolsa")];
+ char uniname2ctype_pool_str158[sizeof("sterm")];
+ char uniname2ctype_pool_str167[sizeof("inmyanmarextendeda")];
+ char uniname2ctype_pool_str172[sizeof("lm")];
+ char uniname2ctype_pool_str175[sizeof("taiviet")];
+ char uniname2ctype_pool_str179[sizeof("inlinearbideograms")];
+ char uniname2ctype_pool_str180[sizeof("intaitham")];
+ char uniname2ctype_pool_str184[sizeof("latn")];
+ char uniname2ctype_pool_str186[sizeof("latin")];
+ char uniname2ctype_pool_str187[sizeof("ital")];
+ char uniname2ctype_pool_str189[sizeof("alnum")];
+ char uniname2ctype_pool_str199[sizeof("inmalayalam")];
+ char uniname2ctype_pool_str201[sizeof("intaile")];
+ char uniname2ctype_pool_str202[sizeof("tale")];
+ char uniname2ctype_pool_str205[sizeof("l")];
+ char uniname2ctype_pool_str207[sizeof("nl")];
+ char uniname2ctype_pool_str209[sizeof("zl")];
+ char uniname2ctype_pool_str216[sizeof("intamil")];
+ char uniname2ctype_pool_str217[sizeof("taml")];
+ char uniname2ctype_pool_str218[sizeof("inlatinextendeda")];
+ char uniname2ctype_pool_str220[sizeof("inlatinextendedc")];
+ char uniname2ctype_pool_str223[sizeof("inrunic")];
+ char uniname2ctype_pool_str224[sizeof("incarian")];
+ char uniname2ctype_pool_str225[sizeof("insyriac")];
+ char uniname2ctype_pool_str227[sizeof("cari")];
+ char uniname2ctype_pool_str230[sizeof("inmeeteimayekextensions")];
+ char uniname2ctype_pool_str231[sizeof("osma")];
+ char uniname2ctype_pool_str232[sizeof("lt")];
+ char uniname2ctype_pool_str233[sizeof("miao")];
+ char uniname2ctype_pool_str234[sizeof("insharada")];
+ char uniname2ctype_pool_str239[sizeof("incyrillic")];
+ char uniname2ctype_pool_str240[sizeof("carian")];
+ char uniname2ctype_pool_str244[sizeof("armn")];
+ char uniname2ctype_pool_str245[sizeof("samr")];
+ char uniname2ctype_pool_str247[sizeof("armi")];
+ char uniname2ctype_pool_str248[sizeof("inideographicdescriptioncharacters")];
+ char uniname2ctype_pool_str252[sizeof("inosmanya")];
+ char uniname2ctype_pool_str253[sizeof("armenian")];
+ char uniname2ctype_pool_str254[sizeof("inmyanmar")];
+ char uniname2ctype_pool_str255[sizeof("samaritan")];
+ char uniname2ctype_pool_str256[sizeof("arabic")];
+ char uniname2ctype_pool_str259[sizeof("incherokee")];
+ char uniname2ctype_pool_str261[sizeof("connectorpunctuation")];
+ char uniname2ctype_pool_str263[sizeof("merc")];
+ char uniname2ctype_pool_str264[sizeof("inmiscellaneoustechnical")];
+ char uniname2ctype_pool_str268[sizeof("inenclosedalphanumerics")];
+ char uniname2ctype_pool_str279[sizeof("inemoticons")];
+ char uniname2ctype_pool_str281[sizeof("joinc")];
+ char uniname2ctype_pool_str288[sizeof("cntrl")];
+ char uniname2ctype_pool_str301[sizeof("inenclosedcjklettersandmonths")];
+ char uniname2ctype_pool_str303[sizeof("cwcf")];
+ char uniname2ctype_pool_str304[sizeof("inruminumeralsymbols")];
+ char uniname2ctype_pool_str308[sizeof("ll")];
+ char uniname2ctype_pool_str313[sizeof("term")];
+ char uniname2ctype_pool_str316[sizeof("inlatinextendedadditional")];
+ char uniname2ctype_pool_str320[sizeof("tamil")];
+ char uniname2ctype_pool_str321[sizeof("loe")];
+ char uniname2ctype_pool_str329[sizeof("newtailue")];
+ char uniname2ctype_pool_str330[sizeof("cwcm")];
+ char uniname2ctype_pool_str339[sizeof("inenclosedalphanumericsupplement")];
+ char uniname2ctype_pool_str346[sizeof("sinh")];
+ char uniname2ctype_pool_str347[sizeof("zinh")];
+ char uniname2ctype_pool_str349[sizeof("meroiticcursive")];
+ char uniname2ctype_pool_str353[sizeof("han")];
+ char uniname2ctype_pool_str357[sizeof("hani")];
+ char uniname2ctype_pool_str358[sizeof("inopticalcharacterrecognition")];
+ char uniname2ctype_pool_str359[sizeof("no")];
+ char uniname2ctype_pool_str360[sizeof("so")];
+ char uniname2ctype_pool_str364[sizeof("innewtailue")];
+ char uniname2ctype_pool_str365[sizeof("insinhala")];
+ char uniname2ctype_pool_str367[sizeof("innko")];
+ char uniname2ctype_pool_str372[sizeof("co")];
+ char uniname2ctype_pool_str375[sizeof("shavian")];
+ char uniname2ctype_pool_str378[sizeof("terminalpunctuation")];
+ char uniname2ctype_pool_str386[sizeof("intaixuanjingsymbols")];
+ char uniname2ctype_pool_str387[sizeof("inethiopic")];
+ char uniname2ctype_pool_str389[sizeof("sora")];
+ char uniname2ctype_pool_str398[sizeof("inarrows")];
+ char uniname2ctype_pool_str400[sizeof("cham")];
+ char uniname2ctype_pool_str403[sizeof("inlowsurrogates")];
+ char uniname2ctype_pool_str405[sizeof("oriya")];
+ char uniname2ctype_pool_str406[sizeof("ext")];
+ char uniname2ctype_pool_str409[sizeof("cwt")];
+ char uniname2ctype_pool_str412[sizeof("common")];
+ char uniname2ctype_pool_str414[sizeof("inmiao")];
+ char uniname2ctype_pool_str420[sizeof("thai")];
+ char uniname2ctype_pool_str425[sizeof("intifinagh")];
+ char uniname2ctype_pool_str426[sizeof("ethi")];
+ char uniname2ctype_pool_str427[sizeof("mero")];
+ char uniname2ctype_pool_str428[sizeof("chakma")];
+ char uniname2ctype_pool_str429[sizeof("thaa")];
+ char uniname2ctype_pool_str430[sizeof("inscriptionalparthian")];
+ char uniname2ctype_pool_str432[sizeof("tifinagh")];
+ char uniname2ctype_pool_str436[sizeof("titlecaseletter")];
+ char uniname2ctype_pool_str445[sizeof("thaana")];
+ char uniname2ctype_pool_str449[sizeof("asciihexdigit")];
+ char uniname2ctype_pool_str450[sizeof("math")];
+ char uniname2ctype_pool_str453[sizeof("di")];
+ char uniname2ctype_pool_str454[sizeof("ids")];
+ char uniname2ctype_pool_str460[sizeof("lo")];
+ char uniname2ctype_pool_str468[sizeof("inlao")];
+ char uniname2ctype_pool_str470[sizeof("taitham")];
+ char uniname2ctype_pool_str474[sizeof("lao")];
+ char uniname2ctype_pool_str475[sizeof("laoo")];
+ char uniname2ctype_pool_str476[sizeof("dia")];
+ char uniname2ctype_pool_str478[sizeof("idc")];
+ char uniname2ctype_pool_str480[sizeof("ps")];
+ char uniname2ctype_pool_str481[sizeof("insundanese")];
+ char uniname2ctype_pool_str484[sizeof("pi")];
+ char uniname2ctype_pool_str485[sizeof("cwl")];
+ char uniname2ctype_pool_str490[sizeof("pf")];
+ char uniname2ctype_pool_str495[sizeof("mand")];
+ char uniname2ctype_pool_str496[sizeof("insylotinagri")];
+ char uniname2ctype_pool_str497[sizeof("vs")];
+ char uniname2ctype_pool_str503[sizeof("mongolian")];
+ char uniname2ctype_pool_str504[sizeof("pc")];
+ char uniname2ctype_pool_str506[sizeof("inmandaic")];
+ char uniname2ctype_pool_str509[sizeof("invai")];
+ char uniname2ctype_pool_str511[sizeof("lineseparator")];
+ char uniname2ctype_pool_str514[sizeof("pe")];
+ char uniname2ctype_pool_str515[sizeof("vai")];
+ char uniname2ctype_pool_str516[sizeof("vaii")];
+ char uniname2ctype_pool_str517[sizeof("idst")];
+ char uniname2ctype_pool_str520[sizeof("indominotiles")];
+ char uniname2ctype_pool_str521[sizeof("inshavian")];
+ char uniname2ctype_pool_str522[sizeof("inspacingmodifierletters")];
+ char uniname2ctype_pool_str524[sizeof("format")];
+ char uniname2ctype_pool_str528[sizeof("inphaistosdisc")];
+ char uniname2ctype_pool_str531[sizeof("hano")];
+ char uniname2ctype_pool_str532[sizeof("space")];
+ char uniname2ctype_pool_str542[sizeof("indeseret")];
+ char uniname2ctype_pool_str545[sizeof("inolchiki")];
+ char uniname2ctype_pool_str548[sizeof("hira")];
+ char uniname2ctype_pool_str553[sizeof("joincontrol")];
+ char uniname2ctype_pool_str555[sizeof("idcontinue")];
+ char uniname2ctype_pool_str558[sizeof("inmahjongtiles")];
+ char uniname2ctype_pool_str560[sizeof("patws")];
+ char uniname2ctype_pool_str563[sizeof("inlydian")];
+ char uniname2ctype_pool_str564[sizeof("cher")];
+ char uniname2ctype_pool_str568[sizeof("inhiragana")];
+ char uniname2ctype_pool_str572[sizeof("inogham")];
+ char uniname2ctype_pool_str574[sizeof("avst")];
+ char uniname2ctype_pool_str575[sizeof("inscriptionalpahlavi")];
+ char uniname2ctype_pool_str579[sizeof("incoptic")];
+ char uniname2ctype_pool_str587[sizeof("java")];
+ char uniname2ctype_pool_str589[sizeof("inmathematicalalphanumericsymbols")];
+ char uniname2ctype_pool_str594[sizeof("letter")];
+ char uniname2ctype_pool_str604[sizeof("injavanese")];
+ char uniname2ctype_pool_str608[sizeof("avestan")];
+ char uniname2ctype_pool_str612[sizeof("age=1.1")];
+ char uniname2ctype_pool_str613[sizeof("lepc")];
+ char uniname2ctype_pool_str614[sizeof("age=2.1")];
+ char uniname2ctype_pool_str616[sizeof("inlepcha")];
+ char uniname2ctype_pool_str617[sizeof("javanese")];
+ char uniname2ctype_pool_str618[sizeof("shaw")];
+ char uniname2ctype_pool_str619[sizeof("finalpunctuation")];
+ char uniname2ctype_pool_str620[sizeof("alpha")];
+ char uniname2ctype_pool_str621[sizeof("age=5.1")];
+ char uniname2ctype_pool_str622[sizeof("inmongolian")];
+ char uniname2ctype_pool_str623[sizeof("age=5.2")];
+ char uniname2ctype_pool_str626[sizeof("age=2.0")];
+ char uniname2ctype_pool_str627[sizeof("ahex")];
+ char uniname2ctype_pool_str630[sizeof("ingeneralpunctuation")];
+ char uniname2ctype_pool_str631[sizeof("oids")];
+ char uniname2ctype_pool_str632[sizeof("odi")];
+ char uniname2ctype_pool_str633[sizeof("age=5.0")];
+ char uniname2ctype_pool_str636[sizeof("tavt")];
+ char uniname2ctype_pool_str637[sizeof("intaiviet")];
+ char uniname2ctype_pool_str638[sizeof("age=6.1")];
+ char uniname2ctype_pool_str639[sizeof("age=3.1")];
+ char uniname2ctype_pool_str640[sizeof("insundanesesupplement")];
+ char uniname2ctype_pool_str641[sizeof("age=3.2")];
+ char uniname2ctype_pool_str642[sizeof("age=4.1")];
+ char uniname2ctype_pool_str643[sizeof("oidc")];
+ char uniname2ctype_pool_str646[sizeof("tfng")];
+ char uniname2ctype_pool_str647[sizeof("insmallformvariants")];
+ char uniname2ctype_pool_str648[sizeof("ideo")];
+ char uniname2ctype_pool_str649[sizeof("intags")];
+ char uniname2ctype_pool_str650[sizeof("age=6.0")];
+ char uniname2ctype_pool_str651[sizeof("age=3.0")];
+ char uniname2ctype_pool_str653[sizeof("whitespace")];
+ char uniname2ctype_pool_str654[sizeof("age=4.0")];
+ char uniname2ctype_pool_str655[sizeof("inolditalic")];
+ char uniname2ctype_pool_str660[sizeof("oalpha")];
+ char uniname2ctype_pool_str668[sizeof("ingujarati")];
+ char uniname2ctype_pool_str672[sizeof("control")];
+ char uniname2ctype_pool_str679[sizeof("diacritic")];
+ char uniname2ctype_pool_str682[sizeof("tagbanwa")];
+ char uniname2ctype_pool_str690[sizeof("inphoenician")];
+ char uniname2ctype_pool_str701[sizeof("ininscriptionalparthian")];
+ char uniname2ctype_pool_str703[sizeof("ininscriptionalpahlavi")];
+ char uniname2ctype_pool_str704[sizeof("coptic")];
+ char uniname2ctype_pool_str705[sizeof("dsrt")];
+ char uniname2ctype_pool_str706[sizeof("inmodifiertoneletters")];
+ char uniname2ctype_pool_str709[sizeof("xids")];
+ char uniname2ctype_pool_str713[sizeof("hanunoo")];
+ char uniname2ctype_pool_str715[sizeof("inoldturkic")];
+ char uniname2ctype_pool_str721[sizeof("xidc")];
+ char uniname2ctype_pool_str725[sizeof("idstart")];
+ char uniname2ctype_pool_str729[sizeof("inimperialaramaic")];
+ char uniname2ctype_pool_str730[sizeof("invariationselectors")];
+ char uniname2ctype_pool_str734[sizeof("copt")];
+ char uniname2ctype_pool_str737[sizeof("caseignorable")];
+ char uniname2ctype_pool_str738[sizeof("prti")];
+ char uniname2ctype_pool_str739[sizeof("nchar")];
+ char uniname2ctype_pool_str746[sizeof("deseret")];
+ char uniname2ctype_pool_str747[sizeof("decimalnumber")];
+ char uniname2ctype_pool_str748[sizeof("cprt")];
+ char uniname2ctype_pool_str750[sizeof("inlatin1supplement")];
+ char uniname2ctype_pool_str771[sizeof("imperialaramaic")];
+ char uniname2ctype_pool_str776[sizeof("privateuse")];
+ char uniname2ctype_pool_str777[sizeof("casedletter")];
+ char uniname2ctype_pool_str778[sizeof("lowercase")];
+ char uniname2ctype_pool_str780[sizeof("spaceseparator")];
+ char uniname2ctype_pool_str784[sizeof("radical")];
+ char uniname2ctype_pool_str787[sizeof("mong")];
+ char uniname2ctype_pool_str788[sizeof("canadianaboriginal")];
+ char uniname2ctype_pool_str792[sizeof("letternumber")];
+ char uniname2ctype_pool_str796[sizeof("insorasompeng")];
+ char uniname2ctype_pool_str797[sizeof("dash")];
+ char uniname2ctype_pool_str798[sizeof("wspace")];
+ char uniname2ctype_pool_str799[sizeof("ogam")];
+ char uniname2ctype_pool_str802[sizeof("invariationselectorssupplement")];
+ char uniname2ctype_pool_str803[sizeof("print")];
+ char uniname2ctype_pool_str811[sizeof("otheridcontinue")];
+ char uniname2ctype_pool_str815[sizeof("ingurmukhi")];
+ char uniname2ctype_pool_str818[sizeof("closepunctuation")];
+ char uniname2ctype_pool_str823[sizeof("olditalic")];
+ char uniname2ctype_pool_str824[sizeof("noncharactercodepoint")];
+ char uniname2ctype_pool_str826[sizeof("sharada")];
+ char uniname2ctype_pool_str827[sizeof("ingeometricshapes")];
+ char uniname2ctype_pool_str830[sizeof("otheralphabetic")];
+ char uniname2ctype_pool_str831[sizeof("patternwhitespace")];
+ char uniname2ctype_pool_str832[sizeof("po")];
+ char uniname2ctype_pool_str833[sizeof("rjng")];
+ char uniname2ctype_pool_str835[sizeof("ingreekandcoptic")];
+ char uniname2ctype_pool_str841[sizeof("xdigit")];
+ char uniname2ctype_pool_str850[sizeof("gothic")];
+ char uniname2ctype_pool_str851[sizeof("inoldsoutharabian")];
+ char uniname2ctype_pool_str852[sizeof("xidstart")];
+ char uniname2ctype_pool_str854[sizeof("inrejang")];
+ char uniname2ctype_pool_str860[sizeof("idsbinaryoperator")];
+ char uniname2ctype_pool_str867[sizeof("olower")];
+ char uniname2ctype_pool_str869[sizeof("hex")];
+ char uniname2ctype_pool_str870[sizeof("inenclosedideographicsupplement")];
+ char uniname2ctype_pool_str874[sizeof("inalphabeticpresentationforms")];
+ char uniname2ctype_pool_str879[sizeof("inbasiclatin")];
+ char uniname2ctype_pool_str884[sizeof("othersymbol")];
+ char uniname2ctype_pool_str889[sizeof("nd")];
+ char uniname2ctype_pool_str890[sizeof("sd")];
+ char uniname2ctype_pool_str900[sizeof("omath")];
+ char uniname2ctype_pool_str901[sizeof("separator")];
+ char uniname2ctype_pool_str907[sizeof("inarabic")];
+ char uniname2ctype_pool_str912[sizeof("xidcontinue")];
+ char uniname2ctype_pool_str913[sizeof("otheridstart")];
+ char uniname2ctype_pool_str914[sizeof("grext")];
+ char uniname2ctype_pool_str917[sizeof("otherlowercase")];
+ char uniname2ctype_pool_str919[sizeof("phli")];
+ char uniname2ctype_pool_str920[sizeof("cased")];
+ char uniname2ctype_pool_str923[sizeof("hang")];
+ char uniname2ctype_pool_str931[sizeof("xpeo")];
+ char uniname2ctype_pool_str933[sizeof("lower")];
+ char uniname2ctype_pool_str936[sizeof("modifierletter")];
+ char uniname2ctype_pool_str938[sizeof("inphoneticextensions")];
+ char uniname2ctype_pool_str939[sizeof("inarabicpresentationformsa")];
+ char uniname2ctype_pool_str943[sizeof("innumberforms")];
+ char uniname2ctype_pool_str945[sizeof("oldpersian")];
+ char uniname2ctype_pool_str946[sizeof("incyrillicextendeda")];
+ char uniname2ctype_pool_str947[sizeof("inverticalforms")];
+ char uniname2ctype_pool_str949[sizeof("p")];
+ char uniname2ctype_pool_str950[sizeof("inbyzantinemusicalsymbols")];
+ char uniname2ctype_pool_str951[sizeof("inmathematicaloperators")];
+ char uniname2ctype_pool_str952[sizeof("intibetan")];
+ char uniname2ctype_pool_str953[sizeof("zp")];
+ char uniname2ctype_pool_str956[sizeof("ingeorgian")];
+ char uniname2ctype_pool_str960[sizeof("inbraillepatterns")];
+ char uniname2ctype_pool_str962[sizeof("lepcha")];
+ char uniname2ctype_pool_str963[sizeof("geor")];
+ char uniname2ctype_pool_str964[sizeof("invedicextensions")];
+ char uniname2ctype_pool_str965[sizeof("linb")];
+ char uniname2ctype_pool_str966[sizeof("other")];
+ char uniname2ctype_pool_str970[sizeof("deva")];
+ char uniname2ctype_pool_str972[sizeof("indevanagari")];
+ char uniname2ctype_pool_str973[sizeof("othernumber")];
+ char uniname2ctype_pool_str974[sizeof("bamum")];
+ char uniname2ctype_pool_str976[sizeof("shrd")];
+ char uniname2ctype_pool_str977[sizeof("bali")];
+ char uniname2ctype_pool_str981[sizeof("devanagari")];
+ char uniname2ctype_pool_str983[sizeof("extender")];
+ char uniname2ctype_pool_str988[sizeof("inherited")];
+ char uniname2ctype_pool_str989[sizeof("glagolitic")];
+ char uniname2ctype_pool_str990[sizeof("tibt")];
+ char uniname2ctype_pool_str994[sizeof("inbalinese")];
+ char uniname2ctype_pool_str996[sizeof("ingothic")];
+ char uniname2ctype_pool_str997[sizeof("inmiscellaneousmathematicalsymbolsb")];
+ char uniname2ctype_pool_str998[sizeof("limb")];
+ char uniname2ctype_pool_str1000[sizeof("bengali")];
+ char uniname2ctype_pool_str1003[sizeof("phoenician")];
+ char uniname2ctype_pool_str1004[sizeof("insuperscriptsandsubscripts")];
+ char uniname2ctype_pool_str1006[sizeof("inmeroitichieroglyphs")];
+ char uniname2ctype_pool_str1007[sizeof("tibetan")];
+ char uniname2ctype_pool_str1010[sizeof("inphoneticextensionssupplement")];
+ char uniname2ctype_pool_str1016[sizeof("balinese")];
+ char uniname2ctype_pool_str1021[sizeof("lowercaseletter")];
+ char uniname2ctype_pool_str1031[sizeof("indingbats")];
+ char uniname2ctype_pool_str1035[sizeof("inprivateusearea")];
+ char uniname2ctype_pool_str1039[sizeof("assigned")];
+ char uniname2ctype_pool_str1044[sizeof("patternsyntax")];
+ char uniname2ctype_pool_str1051[sizeof("inhangulsyllables")];
+ char uniname2ctype_pool_str1065[sizeof("sarb")];
+ char uniname2ctype_pool_str1067[sizeof("brai")];
+ char uniname2ctype_pool_str1069[sizeof("insupplementalmathematicaloperators")];
+ char uniname2ctype_pool_str1070[sizeof("phnx")];
+ char uniname2ctype_pool_str1072[sizeof("ingreekextended")];
+ char uniname2ctype_pool_str1074[sizeof("otherletter")];
+ char uniname2ctype_pool_str1076[sizeof("arab")];
+ char uniname2ctype_pool_str1078[sizeof("inlatinextendedd")];
+ char uniname2ctype_pool_str1081[sizeof("word")];
+ char uniname2ctype_pool_str1084[sizeof("inphagspa")];
+ char uniname2ctype_pool_str1087[sizeof("inblockelements")];
+ char uniname2ctype_pool_str1092[sizeof("ethiopic")];
+ char uniname2ctype_pool_str1094[sizeof("inethiopicextendeda")];
+ char uniname2ctype_pool_str1107[sizeof("brahmi")];
+ char uniname2ctype_pool_str1110[sizeof("logicalorderexception")];
+ char uniname2ctype_pool_str1114[sizeof("inoldpersian")];
+ char uniname2ctype_pool_str1129[sizeof("inletterlikesymbols")];
+ char uniname2ctype_pool_str1133[sizeof("sorasompeng")];
+ char uniname2ctype_pool_str1135[sizeof("hiragana")];
+ char uniname2ctype_pool_str1142[sizeof("inhanguljamoextendeda")];
+ char uniname2ctype_pool_str1147[sizeof("othermath")];
+ char uniname2ctype_pool_str1150[sizeof("digit")];
+ char uniname2ctype_pool_str1151[sizeof("goth")];
+ char uniname2ctype_pool_str1156[sizeof("ogham")];
+ char uniname2ctype_pool_str1162[sizeof("sundanese")];
+ char uniname2ctype_pool_str1170[sizeof("saurashtra")];
+ char uniname2ctype_pool_str1173[sizeof("linearb")];
+ char uniname2ctype_pool_str1179[sizeof("graphemebase")];
+ char uniname2ctype_pool_str1185[sizeof("inunifiedcanadianaboriginalsyllabics")];
+ char uniname2ctype_pool_str1186[sizeof("cuneiform")];
+ char uniname2ctype_pool_str1188[sizeof("inkannada")];
+ char uniname2ctype_pool_str1190[sizeof("kana")];
+ char uniname2ctype_pool_str1195[sizeof("inancientgreeknumbers")];
+ char uniname2ctype_pool_str1196[sizeof("incjkstrokes")];
+ char uniname2ctype_pool_str1198[sizeof("inglagolitic")];
+ char uniname2ctype_pool_str1202[sizeof("inancientgreekmusicalnotation")];
+ char uniname2ctype_pool_str1212[sizeof("inchakma")];
+ char uniname2ctype_pool_str1215[sizeof("plrd")];
+ char uniname2ctype_pool_str1219[sizeof("inbrahmi")];
+ char uniname2ctype_pool_str1224[sizeof("cakm")];
+ char uniname2ctype_pool_str1225[sizeof("incjkcompatibilityforms")];
+ char uniname2ctype_pool_str1229[sizeof("lisu")];
+ char uniname2ctype_pool_str1230[sizeof("incjkcompatibilityideographs")];
+ char uniname2ctype_pool_str1231[sizeof("intagalog")];
+ char uniname2ctype_pool_str1244[sizeof("inkaithi")];
+ char uniname2ctype_pool_str1245[sizeof("insupplementalarrowsa")];
+ char uniname2ctype_pool_str1249[sizeof("takri")];
+ char uniname2ctype_pool_str1253[sizeof("ideographic")];
+ char uniname2ctype_pool_str1256[sizeof("hexdigit")];
+ char uniname2ctype_pool_str1259[sizeof("glag")];
+ char uniname2ctype_pool_str1261[sizeof("softdotted")];
+ char uniname2ctype_pool_str1262[sizeof("variationselector")];
+ char uniname2ctype_pool_str1264[sizeof("inkatakana")];
+ char uniname2ctype_pool_str1265[sizeof("meeteimayek")];
+ char uniname2ctype_pool_str1274[sizeof("otherpunctuation")];
+ char uniname2ctype_pool_str1279[sizeof("inhanguljamo")];
+ char uniname2ctype_pool_str1282[sizeof("kali")];
+ char uniname2ctype_pool_str1289[sizeof("braille")];
+ char uniname2ctype_pool_str1298[sizeof("incombininghalfmarks")];
+ char uniname2ctype_pool_str1300[sizeof("talu")];
+ char uniname2ctype_pool_str1302[sizeof("incjkcompatibilityideographssupplement")];
+ char uniname2ctype_pool_str1306[sizeof("telu")];
+ char uniname2ctype_pool_str1307[sizeof("idsb")];
+ char uniname2ctype_pool_str1310[sizeof("tglg")];
+ char uniname2ctype_pool_str1313[sizeof("inmeeteimayek")];
+ char uniname2ctype_pool_str1315[sizeof("yi")];
+ char uniname2ctype_pool_str1318[sizeof("phagspa")];
+ char uniname2ctype_pool_str1321[sizeof("yiii")];
+ char uniname2ctype_pool_str1323[sizeof("inarabicmathematicalalphabeticsymbols")];
+ char uniname2ctype_pool_str1328[sizeof("saur")];
+ char uniname2ctype_pool_str1330[sizeof("ogrext")];
+ char uniname2ctype_pool_str1334[sizeof("bidic")];
+ char uniname2ctype_pool_str1341[sizeof("inkanasupplement")];
+ char uniname2ctype_pool_str1343[sizeof("runic")];
+ char uniname2ctype_pool_str1344[sizeof("inalchemicalsymbols")];
+ char uniname2ctype_pool_str1350[sizeof("georgian")];
+ char uniname2ctype_pool_str1351[sizeof("inugaritic")];
+ char uniname2ctype_pool_str1354[sizeof("insaurashtra")];
+ char uniname2ctype_pool_str1356[sizeof("inhighprivateusesurrogates")];
+ char uniname2ctype_pool_str1362[sizeof("pd")];
+ char uniname2ctype_pool_str1372[sizeof("incountingrodnumerals")];
+ char uniname2ctype_pool_str1377[sizeof("inarabicextendeda")];
+ char uniname2ctype_pool_str1389[sizeof("inkharoshthi")];
+ char uniname2ctype_pool_str1393[sizeof("idstrinaryoperator")];
+ char uniname2ctype_pool_str1396[sizeof("phag")];
+ char uniname2ctype_pool_str1398[sizeof("brah")];
+ char uniname2ctype_pool_str1402[sizeof("mark")];
+ char uniname2ctype_pool_str1404[sizeof("hebr")];
+ char uniname2ctype_pool_str1411[sizeof("inkhmersymbols")];
+ char uniname2ctype_pool_str1413[sizeof("dep")];
+ char uniname2ctype_pool_str1416[sizeof("inkhmer")];
+ char uniname2ctype_pool_str1422[sizeof("deprecated")];
+ char uniname2ctype_pool_str1424[sizeof("rejang")];
+ char uniname2ctype_pool_str1429[sizeof("lyci")];
+ char uniname2ctype_pool_str1431[sizeof("intakri")];
+ char uniname2ctype_pool_str1432[sizeof("takr")];
+ char uniname2ctype_pool_str1435[sizeof("incyrillicsupplement")];
+ char uniname2ctype_pool_str1436[sizeof("changeswhencasefolded")];
+ char uniname2ctype_pool_str1438[sizeof("indevanagariextended")];
+ char uniname2ctype_pool_str1442[sizeof("lycian")];
+ char uniname2ctype_pool_str1443[sizeof("inbengali")];
+ char uniname2ctype_pool_str1448[sizeof("beng")];
+ char uniname2ctype_pool_str1450[sizeof("graph")];
+ char uniname2ctype_pool_str1452[sizeof("inyijinghexagramsymbols")];
+ char uniname2ctype_pool_str1457[sizeof("olck")];
+ char uniname2ctype_pool_str1460[sizeof("inarabicsupplement")];
+ char uniname2ctype_pool_str1462[sizeof("inbuginese")];
+ char uniname2ctype_pool_str1463[sizeof("changeswhencasemapped")];
+ char uniname2ctype_pool_str1468[sizeof("olchiki")];
+ char uniname2ctype_pool_str1478[sizeof("inaegeannumbers")];
+ char uniname2ctype_pool_str1479[sizeof("mlym")];
+ char uniname2ctype_pool_str1480[sizeof("alphabetic")];
+ char uniname2ctype_pool_str1492[sizeof("sylotinagri")];
+ char uniname2ctype_pool_str1498[sizeof("changeswhentitlecased")];
+ char uniname2ctype_pool_str1504[sizeof("tagalog")];
+ char uniname2ctype_pool_str1505[sizeof("tagb")];
+ char uniname2ctype_pool_str1506[sizeof("runr")];
+ char uniname2ctype_pool_str1510[sizeof("malayalam")];
+ char uniname2ctype_pool_str1512[sizeof("inoriya")];
+ char uniname2ctype_pool_str1516[sizeof("intagbanwa")];
+ char uniname2ctype_pool_str1517[sizeof("syrc")];
+ char uniname2ctype_pool_str1519[sizeof("nko")];
+ char uniname2ctype_pool_str1520[sizeof("nkoo")];
+ char uniname2ctype_pool_str1523[sizeof("inethiopicextended")];
+ char uniname2ctype_pool_str1525[sizeof("kaithi")];
+ char uniname2ctype_pool_str1530[sizeof("mathsymbol")];
+ char uniname2ctype_pool_str1531[sizeof("inyiradicals")];
+ char uniname2ctype_pool_str1536[sizeof("insupplementaryprivateuseareaa")];
+ char uniname2ctype_pool_str1540[sizeof("osmanya")];
+ char uniname2ctype_pool_str1546[sizeof("syriac")];
+ char uniname2ctype_pool_str1548[sizeof("otherdefaultignorablecodepoint")];
+ char uniname2ctype_pool_str1561[sizeof("number")];
+ char uniname2ctype_pool_str1565[sizeof("inlinearbsyllabary")];
+ char uniname2ctype_pool_str1566[sizeof("kthi")];
+ char uniname2ctype_pool_str1567[sizeof("sund")];
+ char uniname2ctype_pool_str1569[sizeof("mymr")];
+ char uniname2ctype_pool_str1571[sizeof("incombiningdiacriticalmarks")];
+ char uniname2ctype_pool_str1578[sizeof("enclosingmark")];
+ char uniname2ctype_pool_str1581[sizeof("incombiningdiacriticalmarksforsymbols")];
+ char uniname2ctype_pool_str1583[sizeof("inethiopicsupplement")];
+ char uniname2ctype_pool_str1590[sizeof("unassigned")];
+ char uniname2ctype_pool_str1591[sizeof("sylo")];
+ char uniname2ctype_pool_str1595[sizeof("combiningmark")];
+ char uniname2ctype_pool_str1598[sizeof("myanmar")];
+ char uniname2ctype_pool_str1605[sizeof("graphemeextend")];
+ char uniname2ctype_pool_str1606[sizeof("bidicontrol")];
+ char uniname2ctype_pool_str1609[sizeof("inhalfwidthandfullwidthforms")];
+ char uniname2ctype_pool_str1617[sizeof("cyrl")];
+ char uniname2ctype_pool_str1620[sizeof("knda")];
+ char uniname2ctype_pool_str1634[sizeof("inunifiedcanadianaboriginalsyllabicsextended")];
+ char uniname2ctype_pool_str1635[sizeof("xsux")];
+ char uniname2ctype_pool_str1636[sizeof("modifiersymbol")];
+ char uniname2ctype_pool_str1643[sizeof("incombiningdiacriticalmarkssupplement")];
+ char uniname2ctype_pool_str1645[sizeof("inhanunoo")];
+ char uniname2ctype_pool_str1648[sizeof("inbuhid")];
+ char uniname2ctype_pool_str1649[sizeof("kannada")];
+ char uniname2ctype_pool_str1658[sizeof("inhebrew")];
+ char uniname2ctype_pool_str1662[sizeof("grbase")];
+ char uniname2ctype_pool_str1664[sizeof("spacingmark")];
+ char uniname2ctype_pool_str1670[sizeof("inkatakanaphoneticextensions")];
+ char uniname2ctype_pool_str1676[sizeof("hangul")];
+ char uniname2ctype_pool_str1683[sizeof("incjksymbolsandpunctuation")];
+ char uniname2ctype_pool_str1688[sizeof("bopo")];
+ char uniname2ctype_pool_str1692[sizeof("orya")];
+ char uniname2ctype_pool_str1699[sizeof("inbopomofo")];
+ char uniname2ctype_pool_str1701[sizeof("kharoshthi")];
+ char uniname2ctype_pool_str1703[sizeof("khar")];
+ char uniname2ctype_pool_str1709[sizeof("changeswhenlowercased")];
+ char uniname2ctype_pool_str1724[sizeof("khmr")];
+ char uniname2ctype_pool_str1725[sizeof("punct")];
+ char uniname2ctype_pool_str1729[sizeof("symbol")];
+ char uniname2ctype_pool_str1732[sizeof("cherokee")];
+ char uniname2ctype_pool_str1737[sizeof("cyrillic")];
+ char uniname2ctype_pool_str1759[sizeof("inkangxiradicals")];
+ char uniname2ctype_pool_str1761[sizeof("hebrew")];
+ char uniname2ctype_pool_str1780[sizeof("inarabicpresentationformsb")];
+ char uniname2ctype_pool_str1787[sizeof("incyrillicextendedb")];
+ char uniname2ctype_pool_str1790[sizeof("ugaritic")];
+ char uniname2ctype_pool_str1829[sizeof("incurrencysymbols")];
+ char uniname2ctype_pool_str1831[sizeof("meroitichieroglyphs")];
+ char uniname2ctype_pool_str1835[sizeof("inhighsurrogates")];
+ char uniname2ctype_pool_str1853[sizeof("nonspacingmark")];
+ char uniname2ctype_pool_str1858[sizeof("lydi")];
+ char uniname2ctype_pool_str1864[sizeof("patsyn")];
+ char uniname2ctype_pool_str1868[sizeof("orkh")];
+ char uniname2ctype_pool_str1871[sizeof("lydian")];
+ char uniname2ctype_pool_str1896[sizeof("ugar")];
+ char uniname2ctype_pool_str1899[sizeof("othergraphemeextend")];
+ char uniname2ctype_pool_str1900[sizeof("inlatinextendedb")];
+ char uniname2ctype_pool_str1904[sizeof("bopomofo")];
+ char uniname2ctype_pool_str1917[sizeof("khmer")];
+ char uniname2ctype_pool_str1925[sizeof("uideo")];
+ char uniname2ctype_pool_str1932[sizeof("otheruppercase")];
+ char uniname2ctype_pool_str1944[sizeof("grek")];
+ char uniname2ctype_pool_str1949[sizeof("gujr")];
+ char uniname2ctype_pool_str1970[sizeof("gujarati")];
+ char uniname2ctype_pool_str1983[sizeof("inhanguljamoextendedb")];
+ char uniname2ctype_pool_str1988[sizeof("defaultignorablecodepoint")];
+ char uniname2ctype_pool_str2005[sizeof("inplayingcards")];
+ char uniname2ctype_pool_str2022[sizeof("bamu")];
+ char uniname2ctype_pool_str2028[sizeof("inkanbun")];
+ char uniname2ctype_pool_str2033[sizeof("incjkradicalssupplement")];
+ char uniname2ctype_pool_str2046[sizeof("cypriot")];
+ char uniname2ctype_pool_str2051[sizeof("inbamum")];
+ char uniname2ctype_pool_str2053[sizeof("inmeroiticcursive")];
+ char uniname2ctype_pool_str2055[sizeof("oldturkic")];
+ char uniname2ctype_pool_str2086[sizeof("insupplementalarrowsb")];
+ char uniname2ctype_pool_str2087[sizeof("surrogate")];
+ char uniname2ctype_pool_str2094[sizeof("batk")];
+ char uniname2ctype_pool_str2102[sizeof("inbatak")];
+ char uniname2ctype_pool_str2119[sizeof("inlimbu")];
+ char uniname2ctype_pool_str2123[sizeof("incypriotsyllabary")];
+ char uniname2ctype_pool_str2129[sizeof("dashpunctuation")];
+ char uniname2ctype_pool_str2130[sizeof("innoblock")];
+ char uniname2ctype_pool_str2141[sizeof("hyphen")];
+ char uniname2ctype_pool_str2162[sizeof("insupplementalpunctuation")];
+ char uniname2ctype_pool_str2165[sizeof("ingeorgiansupplement")];
+ char uniname2ctype_pool_str2178[sizeof("oupper")];
+ char uniname2ctype_pool_str2189[sizeof("paragraphseparator")];
+ char uniname2ctype_pool_str2194[sizeof("inbamumsupplement")];
+ char uniname2ctype_pool_str2299[sizeof("uppercase")];
+ char uniname2ctype_pool_str2313[sizeof("currencysymbol")];
+ char uniname2ctype_pool_str2322[sizeof("sk")];
+ char uniname2ctype_pool_str2338[sizeof("lu")];
+ char uniname2ctype_pool_str2342[sizeof("openpunctuation")];
+ char uniname2ctype_pool_str2349[sizeof("inlisu")];
+ char uniname2ctype_pool_str2371[sizeof("qmark")];
+ char uniname2ctype_pool_str2372[sizeof("egyp")];
+ char uniname2ctype_pool_str2377[sizeof("insupplementaryprivateuseareab")];
+ char uniname2ctype_pool_str2379[sizeof("limbu")];
+ char uniname2ctype_pool_str2400[sizeof("inegyptianhieroglyphs")];
+ char uniname2ctype_pool_str2401[sizeof("unifiedideograph")];
+ char uniname2ctype_pool_str2413[sizeof("intelugu")];
+ char uniname2ctype_pool_str2429[sizeof("katakana")];
+ char uniname2ctype_pool_str2442[sizeof("inhangulcompatibilityjamo")];
+ char uniname2ctype_pool_str2454[sizeof("upper")];
+ char uniname2ctype_pool_str2495[sizeof("inkayahli")];
+ char uniname2ctype_pool_str2515[sizeof("cwu")];
+ char uniname2ctype_pool_str2523[sizeof("incjkcompatibility")];
+ char uniname2ctype_pool_str2542[sizeof("uppercaseletter")];
+ char uniname2ctype_pool_str2549[sizeof("bugi")];
+ char uniname2ctype_pool_str2588[sizeof("buginese")];
+ char uniname2ctype_pool_str2627[sizeof("any")];
+ char uniname2ctype_pool_str2651[sizeof("inyisyllables")];
+ char uniname2ctype_pool_str2671[sizeof("inbopomofoextended")];
+ char uniname2ctype_pool_str2710[sizeof("inboxdrawing")];
+ char uniname2ctype_pool_str2724[sizeof("changeswhenuppercased")];
+ char uniname2ctype_pool_str2727[sizeof("unknown")];
+ char uniname2ctype_pool_str2737[sizeof("quotationmark")];
+ char uniname2ctype_pool_str2753[sizeof("buhd")];
+ char uniname2ctype_pool_str2785[sizeof("punctuation")];
+ char uniname2ctype_pool_str2888[sizeof("oldsoutharabian")];
+ char uniname2ctype_pool_str2925[sizeof("kayahli")];
+ char uniname2ctype_pool_str2940[sizeof("incjkunifiedideographs")];
+ char uniname2ctype_pool_str2961[sizeof("incjkunifiedideographsextensiona")];
+ char uniname2ctype_pool_str2962[sizeof("incjkunifiedideographsextensionc")];
+ char uniname2ctype_pool_str2995[sizeof("telugu")];
+ char uniname2ctype_pool_str3000[sizeof("guru")];
+ char uniname2ctype_pool_str3104[sizeof("greek")];
+ char uniname2ctype_pool_str3189[sizeof("grlink")];
+ char uniname2ctype_pool_str3197[sizeof("buhid")];
+ char uniname2ctype_pool_str3254[sizeof("batak")];
+ char uniname2ctype_pool_str3292[sizeof("blank")];
+ char uniname2ctype_pool_str3391[sizeof("incjkunifiedideographsextensiond")];
+ char uniname2ctype_pool_str3459[sizeof("graphemelink")];
+ char uniname2ctype_pool_str3480[sizeof("egyptianhieroglyphs")];
+ char uniname2ctype_pool_str3802[sizeof("incjkunifiedideographsextensionb")];
+ char uniname2ctype_pool_str3922[sizeof("zyyy")];
+ char uniname2ctype_pool_str4167[sizeof("gurmukhi")];
#endif /* USE_UNICODE_PROPERTIES */
};
static const struct uniname2ctype_pool_t uniname2ctype_pool_contents =
{
#ifndef USE_UNICODE_PROPERTIES
+ "word",
"print",
"punct",
+ "alpha",
+ "alnum",
+ "xdigit",
+ "upper",
#else /* USE_UNICODE_PROPERTIES */
"n",
- "l",
- "nl",
- "ll",
+ "s",
+ "z",
+ "zs",
+ "zzzz",
"cn",
- "no",
- "lo",
+ "cs",
+ "ci",
"c",
- "co",
+ "cf",
+ "sc",
+ "cans",
+ "qaai",
+ "mn",
+#endif /* USE_UNICODE_PROPERTIES */
+ "ascii",
+#ifdef USE_UNICODE_PROPERTIES
"cc",
- "lao",
- "laoo",
- "lana",
- "ci",
"qaac",
- "vai",
- "vaii",
- "qaai",
- "control",
+ "inavestan",
+ "inspecials",
+ "inipaextensions",
+ "mc",
+ "insamaritan",
+ "m",
+ "sm",
+ "me",
+ "inarmenian",
+ "incuneiform",
+ "mandaic",
+ "inancientsymbols",
+ "incuneiformnumbersandpunctuation",
+ "inthai",
+ "inmusicalsymbols",
+ "inmiscellaneoussymbols",
+ "incham",
+ "inmiscellaneoussymbolsandarrows",
+ "initialpunctuation",
+ "inmiscellaneoussymbolsandpictographs",
+ "inthaana",
+ "taile",
+ "mtei",
+ "lc",
+ "lana",
+ "inlycian",
+ "intransportandmapsymbols",
+ "incontrolpictures",
+ "sinhala",
+ "incommonindicnumberforms",
+ "inmiscellaneousmathematicalsymbolsa",
+ "sterm",
+ "inmyanmarextendeda",
+ "lm",
+ "taiviet",
+ "inlinearbideograms",
+ "intaitham",
+ "latn",
+ "latin",
+ "ital",
+ "alnum",
+ "inmalayalam",
+ "intaile",
+ "tale",
+ "l",
+ "nl",
+ "zl",
+ "intamil",
+ "taml",
+ "inlatinextendeda",
+ "inlatinextendedc",
+ "inrunic",
+ "incarian",
+ "insyriac",
"cari",
+ "inmeeteimayekextensions",
+ "osma",
+ "lt",
+ "miao",
+ "insharada",
+ "incyrillic",
"carian",
- "zl",
- "oriya",
- "latn",
+ "armn",
+ "samr",
+ "armi",
+ "inideographicdescriptioncharacters",
+ "inosmanya",
+ "armenian",
+ "inmyanmar",
+ "samaritan",
+ "arabic",
+ "incherokee",
+ "connectorpunctuation",
+ "merc",
+ "inmiscellaneoustechnical",
+ "inenclosedalphanumerics",
+ "inemoticons",
+ "joinc",
+#endif /* USE_UNICODE_PROPERTIES */
"cntrl",
- "latin",
+#ifdef USE_UNICODE_PROPERTIES
+ "inenclosedcjklettersandmonths",
+ "cwcf",
+ "inruminumeralsymbols",
+ "ll",
+ "term",
+ "inlatinextendedadditional",
+ "tamil",
+ "loe",
+ "newtailue",
+ "cwcm",
+ "inenclosedalphanumericsupplement",
+ "sinh",
+ "zinh",
+ "meroiticcursive",
"han",
- "arabic",
- "ital",
- "hano",
"hani",
- "hanunoo",
- "lt",
+ "inopticalcharacterrecognition",
+ "no",
"so",
- "hira",
- "nchar",
- "sc",
- "z",
- "oalpha",
- "tavt",
- "cans",
- "java",
- "zinh",
- "thaa",
+ "innewtailue",
+ "insinhala",
+ "innko",
+ "co",
+ "shavian",
+ "terminalpunctuation",
+ "intaixuanjingsymbols",
+ "inethiopic",
+ "sora",
+ "inarrows",
+ "cham",
+ "inlowsurrogates",
+ "oriya",
+ "ext",
+ "cwt",
+ "common",
+ "inmiao",
"thai",
- "variationselector",
- "sinhala",
- "joinc",
- "ascii",
- "initialpunctuation",
- "other",
- "joincontrol",
+ "intifinagh",
+ "ethi",
+ "mero",
+ "chakma",
+ "thaa",
+ "inscriptionalparthian",
+ "tifinagh",
+ "titlecaseletter",
"thaana",
- "avst",
- "olower",
- "othernumber",
- "otherletter",
- "sinh",
- "tale",
- "connectorpunctuation",
- "s",
+ "asciihexdigit",
+ "math",
"di",
- "vs",
- "oidc",
- "idc",
- "odi",
- "cs",
- "avestan",
+ "ids",
+ "lo",
+ "inlao",
+ "taitham",
+ "lao",
+ "laoo",
"dia",
- "cher",
- "inscriptionalparthian",
- "shavian",
- "radical",
- "loe",
- "diacritic",
- "zzzz",
- "ethi",
- "canadianaboriginal",
- "zs",
- "othersymbol",
- "olditalic",
- "inscriptionalpahlavi",
- "taiviet",
+ "idc",
+ "ps",
+ "insundanese",
+ "pi",
+ "cwl",
+ "pf",
+ "mand",
+ "insylotinagri",
+ "vs",
+ "mongolian",
+ "pc",
+ "inmandaic",
+ "invai",
"lineseparator",
- "otheridstart",
- "oids",
- "asciihexdigit",
- "inherited",
- "otherlowercase",
- "terminalpunctuation",
- "deva",
- "otheralphabetic",
- "ideo",
- "noncharactercodepoint",
- "otheridcontinue",
- "taile",
- "oldpersian",
- "devanagari",
- "letter",
- "nd",
+ "pe",
+ "vai",
+ "vaii",
"idst",
- "dsrt",
- "titlecaseletter",
- "po",
- "dash",
- "pc",
- "letternumber",
- "pi",
- "javanese",
- "mn",
- "idstart",
- "idcontinue",
- "ids",
+ "indominotiles",
+ "inshavian",
+ "inspacingmodifierletters",
+ "format",
+ "inphaistosdisc",
+ "hano",
#endif /* USE_UNICODE_PROPERTIES */
- "alpha",
+ "space",
#ifdef USE_UNICODE_PROPERTIES
- "mc",
- "coptic",
- "mongolian",
- "common",
- "armn",
- "copt",
- "cprt",
- "armi",
- "phli",
- "prti",
- "armenian",
- "sd",
- "mandaic",
- "phoenician",
- "taml",
- "tamil",
- "cased",
- "cham",
- "idsbinaryoperator",
- "lepc",
- "otherdefaultignorablecodepoint",
- "print",
- "osma",
- "samr",
- "math",
- "linb",
- "closepunctuation",
- "otherpunctuation",
- "bali",
- "omath",
- "samaritan",
- "ps",
- "arab",
- "brai",
- "taitham",
- "linearb",
- "lepcha",
- "mand",
- "mtei",
- "term",
- "glagolitic",
- "privateuse",
- "pe",
- "deseret",
- "brah",
- "runr",
- "othermath",
- "runic",
- "hang",
- "ethiopic",
- "me",
+ "indeseret",
+ "inolchiki",
+ "hira",
+ "joincontrol",
+ "idcontinue",
+ "inmahjongtiles",
"patws",
- "separator",
- "tibt",
- "gothic",
- "tagbanwa",
- "sarb",
- "talu",
- "tibetan",
- "goth",
- "rjng",
- "hangul",
- "bengali",
- "hiragana",
- "braille",
- "geor",
+ "inlydian",
+ "cher",
+ "inhiragana",
+ "inogham",
+ "avst",
+ "inscriptionalpahlavi",
+ "incoptic",
+ "java",
+ "inmathematicalalphanumericsymbols",
+ "letter",
+ "injavanese",
+ "avestan",
"age=1.1",
+ "lepc",
"age=2.1",
+ "inlepcha",
+ "javanese",
+ "shaw",
+ "finalpunctuation",
+ "alpha",
"age=5.1",
+ "inmongolian",
"age=5.2",
- "age=4.1",
- "p",
- "pd",
- "lisu",
"age=2.0",
+ "ahex",
+ "ingeneralpunctuation",
+ "oids",
+ "odi",
"age=5.0",
- "age=6.0",
- "age=4.0",
- "graph",
- "saur",
- "space",
+ "tavt",
+ "intaiviet",
+ "age=6.1",
"age=3.1",
+ "insundanesesupplement",
"age=3.2",
- "hebr",
- "bidic",
+ "age=4.1",
+ "oidc",
+ "tfng",
+ "insmallformvariants",
+ "ideo",
+ "intags",
+ "age=6.0",
"age=3.0",
- "bidicontrol",
- "logicalorderexception",
- "telu",
- "zp",
- "m",
- "lm",
- "idstrinaryoperator",
- "balinese",
- "uideo",
- "spaceseparator",
- "grext",
-#endif /* USE_UNICODE_PROPERTIES */
- "alnum",
-#ifdef USE_UNICODE_PROPERTIES
- "oldturkic",
+ "whitespace",
+ "age=4.0",
+ "inolditalic",
+ "oalpha",
+ "ingujarati",
+ "control",
+ "diacritic",
+ "tagbanwa",
+ "inphoenician",
+ "ininscriptionalparthian",
+ "ininscriptionalpahlavi",
+ "coptic",
+ "dsrt",
+ "inmodifiertoneletters",
+ "xids",
+ "hanunoo",
+ "inoldturkic",
"xidc",
- "idsb",
- "ahex",
- "format",
+ "idstart",
+ "inimperialaramaic",
+ "invariationselectors",
+ "copt",
"caseignorable",
- "tifinagh",
- "sundanese",
- "ext",
- "saurashtra",
- "patternwhitespace",
- "digit",
- "sund",
+ "prti",
+ "nchar",
+ "deseret",
"decimalnumber",
- "bopo",
- "sm",
- "otheruppercase",
- "ideographic",
- "xids",
- "unassigned",
- "phagspa",
- "alphabetic",
- "limb",
-#endif /* USE_UNICODE_PROPERTIES */
+ "cprt",
+ "inlatin1supplement",
+ "imperialaramaic",
+ "privateuse",
+ "casedletter",
+ "lowercase",
+ "spaceseparator",
+ "radical",
+ "mong",
+ "canadianaboriginal",
+ "letternumber",
+ "insorasompeng",
+ "dash",
+ "wspace",
+ "ogam",
+ "invariationselectorssupplement",
+ "print",
+ "otheridcontinue",
+ "ingurmukhi",
+ "closepunctuation",
+ "olditalic",
+ "noncharactercodepoint",
+ "sharada",
+ "ingeometricshapes",
+ "otheralphabetic",
+ "patternwhitespace",
+ "po",
+ "rjng",
+ "ingreekandcoptic",
"xdigit",
-#ifdef USE_UNICODE_PROPERTIES
+ "gothic",
+ "inoldsoutharabian",
"xidstart",
- "mong",
+ "inrejang",
+ "idsbinaryoperator",
+ "olower",
+ "hex",
+ "inenclosedideographicsupplement",
+ "inalphabeticpresentationforms",
+ "inbasiclatin",
+ "othersymbol",
+ "nd",
+ "sd",
+ "omath",
+ "separator",
+ "inarabic",
"xidcontinue",
+ "otheridstart",
+ "grext",
+ "otherlowercase",
+ "phli",
+ "cased",
+ "hang",
+ "xpeo",
+#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",
+ "tibt",
+ "inbalinese",
+ "ingothic",
+ "inmiscellaneousmathematicalsymbolsb",
+ "limb",
+ "bengali",
+ "phoenician",
+ "insuperscriptsandsubscripts",
+ "inmeroitichieroglyphs",
+ "tibetan",
+ "inphoneticextensionssupplement",
+ "balinese",
+ "lowercaseletter",
+ "indingbats",
+ "inprivateusearea",
"assigned",
- "ogam",
- "nko",
- "nkoo",
- "olck",
- "deprecated",
+ "patternsyntax",
+ "inhangulsyllables",
+ "sarb",
+ "brai",
+ "insupplementalmathematicaloperators",
+ "phnx",
+ "ingreekextended",
+ "otherletter",
+ "arab",
+ "inlatinextendedd",
+ "word",
+ "inphagspa",
+ "inblockelements",
+ "ethiopic",
+ "inethiopicextendeda",
"brahmi",
- "phag",
+ "logicalorderexception",
+ "inoldpersian",
+ "inletterlikesymbols",
+ "sorasompeng",
+ "hiragana",
+ "inhanguljamoextendeda",
+ "othermath",
+#endif /* USE_UNICODE_PROPERTIES */
+ "digit",
+#ifndef USE_UNICODE_PROPERTIES
+ "blank"
+#else /* USE_UNICODE_PROPERTIES */
+ "goth",
+ "ogham",
+ "sundanese",
+ "saurashtra",
+ "linearb",
+ "graphemebase",
+ "inunifiedcanadianaboriginalsyllabics",
+ "cuneiform",
+ "inkannada",
"kana",
+ "inancientgreeknumbers",
+ "incjkstrokes",
+ "inglagolitic",
+ "inancientgreekmusicalnotation",
+ "inchakma",
+ "plrd",
+ "inbrahmi",
+ "cakm",
+ "incjkcompatibilityforms",
+ "lisu",
+ "incjkcompatibilityideographs",
+ "intagalog",
+ "inkaithi",
+ "insupplementalarrowsa",
+ "takri",
+ "ideographic",
+ "hexdigit",
+ "glag",
+ "softdotted",
+ "variationselector",
+ "inkatakana",
+ "meeteimayek",
+ "otherpunctuation",
+ "inhanguljamo",
"kali",
- "changeswhenlowercased",
- "extender",
- "dep",
- "olchiki",
- "cwl",
- "graphemebase",
- "phnx",
- "orkh",
- "punct",
- "khar",
- "lower",
- "sterm",
+ "braille",
+ "incombininghalfmarks",
+ "talu",
+ "incjkcompatibilityideographssupplement",
+ "telu",
+ "idsb",
+ "tglg",
+ "inmeeteimayek",
"yi",
+ "phagspa",
+ "yiii",
+ "inarabicmathematicalalphabeticsymbols",
+ "saur",
+ "ogrext",
+ "bidic",
+ "inkanasupplement",
+ "runic",
+ "inalchemicalsymbols",
+ "georgian",
+ "inugaritic",
+ "insaurashtra",
+ "inhighprivateusesurrogates",
+ "pd",
+ "incountingrodnumerals",
+ "inarabicextendeda",
+ "inkharoshthi",
+ "idstrinaryoperator",
+ "phag",
+ "brah",
+ "mark",
+ "hebr",
+ "inkhmersymbols",
+ "dep",
+ "inkhmer",
+ "deprecated",
+ "rejang",
"lyci",
- "cyrl",
+ "intakri",
+ "takr",
+ "incyrillicsupplement",
+ "changeswhencasefolded",
+ "indevanagariextended",
"lycian",
- "finalpunctuation",
- "orya",
- "graphemeextend",
- "kaithi",
- "xpeo",
- "yiii",
- "kthi",
- "cyrillic",
- "glag",
- "oupper",
- "tagb",
- "cwt",
- "number",
- "tglg",
- "knda",
- "lowercaseletter",
+ "inbengali",
+ "beng",
+ "graph",
+ "inyijinghexagramsymbols",
+ "olck",
+ "inarabicsupplement",
+ "inbuginese",
+ "changeswhencasemapped",
+ "olchiki",
+ "inaegeannumbers",
+ "mlym",
+ "alphabetic",
+ "sylotinagri",
"changeswhentitlecased",
- "softdotted",
- "ugar",
- "sylo",
- "lu",
"tagalog",
- "kharoshthi",
+ "tagb",
+ "runr",
+ "malayalam",
+ "inoriya",
+ "intagbanwa",
"syrc",
- "kannada",
- "beng",
- "lowercase",
- "shaw",
- "patternsyntax",
+ "nko",
+ "nkoo",
+ "inethiopicextended",
+ "kaithi",
+ "mathsymbol",
+ "inyiradicals",
+ "insupplementaryprivateuseareaa",
+ "osmanya",
"syriac",
- "word",
- "imperialaramaic",
- "ugaritic",
+ "otherdefaultignorablecodepoint",
+ "number",
+ "inlinearbsyllabary",
+ "kthi",
+ "sund",
+ "mymr",
+ "incombiningdiacriticalmarks",
"enclosingmark",
- "georgian",
+ "incombiningdiacriticalmarksforsymbols",
+ "inethiopicsupplement",
+ "unassigned",
+ "sylo",
+ "combiningmark",
+ "myanmar",
+ "graphemeextend",
+ "bidicontrol",
+ "inhalfwidthandfullwidthforms",
+ "cyrl",
+ "knda",
+ "inunifiedcanadianaboriginalsyllabicsextended",
+ "xsux",
+ "modifiersymbol",
+ "incombiningdiacriticalmarkssupplement",
+ "inhanunoo",
+ "inbuhid",
+ "kannada",
+ "inhebrew",
+ "grbase",
+ "spacingmark",
+ "inkatakanaphoneticextensions",
+ "hangul",
+ "incjksymbolsandpunctuation",
+ "bopo",
+ "orya",
+ "inbopomofo",
+ "kharoshthi",
+ "khar",
+ "changeswhenlowercased",
+ "khmr",
+ "punct",
+ "symbol",
+ "cherokee",
+ "cyrillic",
+ "inkangxiradicals",
+ "hebrew",
+ "inarabicpresentationformsb",
+ "incyrillicextendedb",
+ "ugaritic",
+ "incurrencysymbols",
+ "meroitichieroglyphs",
+ "inhighsurrogates",
+ "nonspacingmark",
"lydi",
+ "patsyn",
+ "orkh",
"lydian",
- "sylotinagri",
- "gujr",
- "tfng",
- "currencysymbol",
-#endif /* USE_UNICODE_PROPERTIES */
- "newline",
-#ifdef USE_UNICODE_PROPERTIES
+ "ugar",
+ "othergraphemeextend",
+ "inlatinextendedb",
"bopomofo",
- "ogrext",
- "cherokee",
+ "khmer",
+ "uideo",
+ "otheruppercase",
+ "grek",
+ "gujr",
"gujarati",
- "newtailue",
- "dashpunctuation",
- "oldsoutharabian",
-#endif /* USE_UNICODE_PROPERTIES */
- "upper",
-#ifndef USE_UNICODE_PROPERTIES
- "ascii",
- "cntrl",
- "space",
- "word",
- "lower",
- "graph",
- "digit",
- "blank"
-#else /* USE_UNICODE_PROPERTIES */
- "cf",
- "buhd",
- "rejang",
- "othergraphemeextend",
- "modifierletter",
- "nonspacingmark",
- "changeswhencasemapped",
- "mark",
+ "inhanguljamoextendedb",
+ "defaultignorablecodepoint",
+ "inplayingcards",
+ "bamu",
+ "inkanbun",
+ "incjkradicalssupplement",
+ "cypriot",
+ "inbamum",
+ "inmeroiticcursive",
+ "oldturkic",
+ "insupplementalarrowsb",
"surrogate",
+ "batk",
+ "inbatak",
+ "inlimbu",
+ "incypriotsyllabary",
+ "dashpunctuation",
+ "innoblock",
+ "hyphen",
+ "insupplementalpunctuation",
+ "ingeorgiansupplement",
+ "oupper",
"paragraphseparator",
- "ogham",
- "hex",
- "uppercaseletter",
- "hexdigit",
- "cwcm",
- "grbase",
- "khmr",
- "unifiedideograph",
+ "inbamumsupplement",
"uppercase",
- "khmer",
- "spacingmark",
- "whitespace",
- "patsyn",
- "cypriot",
+ "currencysymbol",
+ "sk",
+ "lu",
"openpunctuation",
- "bamu",
- "buhid",
- "batk",
- "symbol",
- "changeswhenuppercased",
- "osmanya",
+ "inlisu",
+ "qmark",
+ "egyp",
+ "insupplementaryprivateuseareab",
"limbu",
- "punctuation",
- "hyphen",
- "mathsymbol",
- "grek",
- "changeswhencasefolded",
- "quotationmark",
+ "inegyptianhieroglyphs",
+ "unifiedideograph",
+ "intelugu",
+ "katakana",
+ "inhangulcompatibilityjamo",
+ "upper",
+ "inkayahli",
+ "cwu",
+ "incjkcompatibility",
+ "uppercaseletter",
"bugi",
- "cuneiform",
- "pf",
- "cwcf",
- "bamum",
- "guru",
- "wspace",
- "meeteimayek",
- "defaultignorablecodepoint",
- "modifiersymbol",
- "mlym",
- "mymr",
- "malayalam",
- "myanmar",
- "telugu",
"buginese",
- "xsux",
- "sk",
- "katakana",
- "egyp",
"any",
+ "inyisyllables",
+ "inbopomofoextended",
+ "inboxdrawing",
+ "changeswhenuppercased",
+ "unknown",
+ "quotationmark",
+ "buhd",
+ "punctuation",
+ "oldsoutharabian",
"kayahli",
- "cwu",
- "qmark",
- "blank",
+ "incjkunifiedideographs",
+ "incjkunifiedideographsextensiona",
+ "incjkunifiedideographsextensionc",
+ "telugu",
+ "guru",
+ "greek",
"grlink",
+ "buhid",
"batak",
- "unknown",
- "greek",
+ "blank",
+ "incjkunifiedideographsextensiond",
"graphemelink",
- "gurmukhi",
- "hebrew",
"egyptianhieroglyphs",
- "zyyy"
+ "incjkunifiedideographsextensionb",
+ "zyyy",
+ "gurmukhi"
#endif /* USE_UNICODE_PROPERTIES */
};
#define uniname2ctype_pool ((const char *) &uniname2ctype_pool_contents)
@@ -23125,681 +27365,1289 @@ uniname2ctype_p (str, len)
{
#ifdef USE_UNICODE_PROPERTIES
{-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str3, 33},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str3, 34},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str5, 23},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str5, 46},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str7, 35},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str8, 24},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str7, 51},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str10, 20},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str11, 36},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str12, 26},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str13, 17},
- {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str16, 21},
+ {(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},
+ {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str18, 20},
+ {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str20, 22},
{-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str20, 18},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str21, 93},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str22, 93},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str23, 150},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str24, 60},
+ {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str29, 17},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str30, 19},
+ {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str32, 47},
+ {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str34, 101},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str35, 114},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str26, 59},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str38, 33},
+ {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str42, 14},
+ {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str44, 18},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str45, 128},
+ {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str49, 401},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str29, 127},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str30, 142},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str31, 142},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str32, 113},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str52, 377},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str62, 226},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str34, 18},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str64, 31},
+ {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str66, 239},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str37, 147},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str69, 30},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str40, 147},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str72, 49},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str42, 51},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str74, 32},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str82, 232},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str44, 86},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str84, 412},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str46, 74},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str47, 3},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str48, 74},
- {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str51, 108},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str86, 168},
+ {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str90, 382},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str53, 79},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str54, 110},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str55, 115},
- {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str60, 108},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str92, 413},
+ {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str96, 252},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str63, 115},
+ {(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_str66, 27},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str67, 49},
- {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str69, 105},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str70, 184},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str71, 46},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str109, 312},
+ {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str113, 43},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str114, 430},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str73, 50},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str74, 178},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str75, 151},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str76, 100},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str116, 237},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str84, 157},
+ {(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},
+ {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str175, 152},
{-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str88, 113},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str89, 81},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str90, 92},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str91, 197},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str92, 91},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str93, 170},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str94, 14},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str95, 42},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str179, 379},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str180, 276},
+ {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str184, 75},
+ {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str186, 75},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str187, 111},
+ {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str189, 13},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str199, 250},
+ {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str201, 272},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str202, 120},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str98, 17},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str99, 170},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str100, 81},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str101, 152},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str205, 23},
+ {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str207, 36},
+ {-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},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str103, 182},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str220, 314},
+ {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str223, 263},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str224, 385},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str225, 235},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str105, 36},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str106, 26},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str227, 148},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str109, 91},
+ {(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},
+ {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str247, 160},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str248, 323},
+ {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str252, 392},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str253, 78},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str254, 255},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str255, 155},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str256, 80},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str112, 119},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str259, 260},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str114, 38},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str115, 45},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str116, 69},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str117, 197},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str261, 39},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str119, 195},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str120, 66},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str121, 190},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str122, 22},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str123, 152},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str124, 180},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str125, 99},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str126, 161},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str263, 170},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str264, 297},
+ {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str268, 300},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str128, 122},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str137, 188},
- {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str143, 193},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str279, 431},
+ {-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},
{-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str147, 180},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str148, 200},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str149, 98},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str301, 333},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str151, 100},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str152, 53},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str153, 49},
- {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str156, 110},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str303, 64},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str304, 405},
+ {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str308, 25},
{-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str161, 162},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str162, 151},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str163, 51},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str313, 182},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str166, 194},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str316, 287},
{-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str170, 194},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str171, 177},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str172, 113},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str320, 88},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str321, 201},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str329, 129},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str330, 65},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str339, 428},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str346, 92},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str347, 114},
+ {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str349, 170},
+ {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str353, 109},
+ {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str357, 109},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str358, 299},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str359, 37},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str360, 50},
+ {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str364, 273},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str365, 251},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str174, 182},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str175, 174},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str176, 82},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str367, 238},
+ {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str372, 21},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str179, 178},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str180, 179},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str181, 184},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str375, 123},
+ {-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},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str183, 195},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str389, 174},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str398, 295},
+ {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str400, 150},
+ {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str403, 365},
+ {-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},
+ {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str412, 74},
+ {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str414, 416},
+ {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str420, 93},
+ {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str425, 317},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str426, 99},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str427, 171},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str428, 169},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str429, 82},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str430, 162},
+ {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str432, 131},
+ {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str436, 28},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str445, 82},
{-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str187, 119},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str449, 185},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str450, 55},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str190, 132},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str453, 70},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str454, 66},
+ {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str460, 27},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str468, 253},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str192, 82},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str193, 23},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str470, 151},
+ {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str474, 94},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str475, 94},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str476, 188},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str195, 34},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str478, 67},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str197, 187},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str198, 112},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str480, 45},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str481, 278},
+ {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_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_str200, 27},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str506, 240},
+ {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str509, 341},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str202, 43},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str203, 171},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str511, 52},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str206, 38},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str514, 41},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str515, 143},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str516, 143},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str517, 195},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str209, 35},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str520, 426},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str521, 391},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str522, 227},
+ {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str524, 19},
+ {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str528, 383},
+ {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str531, 116},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str532, 9},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str542, 390},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str212, 42},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str545, 281},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str215, 157},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str548, 106},
+ {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str553, 178},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str217, 32},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str218, 65},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str555, 67},
+ {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str558, 425},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str220, 66},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str560, 206},
+ {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str563, 396},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str564, 100},
+ {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str568, 325},
+ {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str572, 262},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str222, 65},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str223, 1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str574, 153},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str575, 163},
{-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str227, 30},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str579, 315},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str587, 158},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str229, 127},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str589, 423},
{-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str234, 104},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str235, 73},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str236, 77},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str237, 127},
- {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str243, 124},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str244, 159},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str245, 162},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str246, 161},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str594, 23},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str604, 354},
+ {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str608, 153},
{-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str250, 77},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str251, 192},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str252, 167},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str612, 209},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str613, 141},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str614, 211},
+ {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str616, 280},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str617, 158},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str618, 123},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str619, 42},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str620, 1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str621, 218},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str622, 269},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str623, 219},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str255, 136},
+ {(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_str258, 87},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str630, 289},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str631, 202},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str632, 198},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str633, 217},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str261, 87},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str268, 58},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str269, 149},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str270, 186},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str271, 140},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str636, 152},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str637, 357},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str638, 221},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str639, 213},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str640, 282},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str641, 214},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str642, 216},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str643, 203},
+ {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str646, 131},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str647, 374},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str648, 187},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str649, 438},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str650, 220},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str651, 212},
+ {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str653, 176},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str654, 215},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str655, 386},
+ {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str660, 186},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str668, 245},
{-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str275, 190},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str672, 18},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str679, 188},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str278, 7},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str682, 118},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str286, 123},
- {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str292, 154},
+ {(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_str294, 54},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str701, 402},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str296, 120},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str297, 40},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str703, 403},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str704, 128},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str705, 113},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str706, 344},
+ {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str709, 68},
+ {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str713, 116},
+ {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str715, 404},
+ {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_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_str301, 43},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str729, 394},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str730, 370},
+ {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str734, 128},
+ {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str737, 60},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str738, 162},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str739, 192},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str746, 113},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str747, 35},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str748, 125},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str303, 134},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str750, 223},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str306, 175},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str307, 154},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str308, 44},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str771, 160},
+ {-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},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str310, 79},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str311, 125},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str780, 54},
+ {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str784, 196},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str314, 150},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str787, 105},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str788, 101},
+ {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str792, 36},
+ {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str796, 408},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str797, 179},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str798, 176},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str799, 102},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str317, 120},
+ {(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_str321, 140},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str322, 167},
- {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str324, 158},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str325, 174},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str326, 129},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str327, 21},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str328, 40},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str335, 112},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str815, 244},
+ {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str818, 41},
{-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str340, 166},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str341, 102},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str823, 111},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str824, 192},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str343, 175},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str344, 102},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str345, 97},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str346, 98},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str826, 173},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str827, 303},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str349, 31},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str350, 198},
- {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str353, 50},
- {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str355, 94},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str356, 111},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str830, 186},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str831, 206},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str832, 44},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str833, 146},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str358, 117},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str359, 160},
+ {(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},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str361, 128},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str854, 352},
{-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str367, 94},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str860, 194},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str867, 190},
+ {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str869, 184},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str870, 429},
{-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str371, 111},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str372, 145},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str373, 97},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str374, 83},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str375, 105},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str376, 125},
+ {(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},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str379, 96},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str380, 201},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str381, 203},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str382, 210},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str383, 211},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str384, 208},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str385, 37},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str386, 39},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str917, 190},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str388, 155},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str389, 202},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str390, 209},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str391, 212},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str392, 207},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str393, 5},
- {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str395, 143},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str396, 9},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str397, 205},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str398, 206},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str399, 78},
- {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str402, 169},
+ {(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_str405, 204},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str923, 98},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str931, 133},
+ {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str933, 6},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str408, 169},
- {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str413, 193},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str420, 88},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str936, 26},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str422, 52},
- {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str427, 29},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str938, 284},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str939, 369},
+ {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str943, 294},
+ {-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},
+ {-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},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str430, 25},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str956, 256},
+ {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str960, 308},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str432, 187},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str433, 134},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str434, 189},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str962, 141},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str963, 97},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str964, 283},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str965, 121},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str966, 17},
+ {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str970, 83},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str436, 53},
+ {(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_str438, 70},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str976, 173},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str977, 135},
{-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str442, 13},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str443, 163},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str981, 83},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str445, 68},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str446, 186},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str447, 177},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str983, 189},
{-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str452, 19},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str988, 114},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str989, 130},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str990, 95},
{-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str456, 59},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str457, 130},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str994, 277},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str459, 139},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str996, 387},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str997, 310},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str998, 119},
+ {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1000, 84},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str462, 181},
+ {(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_str464, 143},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str465, 198},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str466, 4},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str474, 139},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1006, 397},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1007, 95},
+ {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1010, 285},
{-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str480, 34},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1016, 135},
+ {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1021, 25},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1031, 305},
{-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str484, 107},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str485, 48},
- {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str488, 183},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1035, 366},
+ {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1039, 16},
{-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str493, 179},
- {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str496, 67},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str497, 20},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1044, 207},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1051, 361},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str502, 137},
- {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str506, 55},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1065, 161},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str508, 118},
- {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str512, 11},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str513, 67},
- {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str516, 104},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1067, 126},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str518, 68},
- {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str521, 16},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1069, 311},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1070, 137},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str523, 101},
- {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str529, 138},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str530, 138},
- {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str533, 141},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str534, 191},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str535, 166},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str536, 137},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1072, 288},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str538, 106},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1074, 27},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str540, 144},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1076, 80},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str542, 60},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str543, 181},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str550, 191},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1078, 345},
+ {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1081, 12},
+ {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1084, 348},
+ {-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},
+ {-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_str554, 141},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str562, 60},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str563, 71},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1107, 167},
+ {-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},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1129, 293},
+ {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1133, 174},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str565, 136},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str573, 163},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1135, 106},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1142, 353},
+ {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1147, 183},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str576, 8},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str577, 133},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1150, 4},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1151, 112},
+ {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1156, 102},
+ {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1162, 140},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1170, 144},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str580, 6},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1173, 121},
+ {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1179, 72},
{-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str586, 196},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str587, 109},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str588, 146},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str589, 76},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1185, 261},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1186, 136},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str591, 146},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str592, 41},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str593, 86},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str594, 70},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1188, 249},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str596, 164},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str597, 132},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str598, 109},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str599, 164},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1190, 107},
+ {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1195, 381},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1196, 331},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str601, 76},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str602, 129},
- {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str605, 183},
+ {(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_str617, 117},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1215, 172},
+ {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1219, 406},
+ {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1224, 169},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1225, 373},
+ {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1229, 156},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1230, 367},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1231, 264},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1244, 407},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1245, 307},
+ {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1249, 175},
+ {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1253, 187},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str620, 62},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1256, 184},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str623, 33},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1259, 130},
+ {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1261, 200},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1262, 205},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str625, 114},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str626, 89},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str627, 24},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str628, 62},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str629, 192},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1264, 326},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1265, 159},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1274, 44},
+ {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1279, 257},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str632, 121},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1282, 145},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1289, 126},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1298, 372},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str634, 131},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1300, 129},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str636, 28},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1302, 437},
{-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str640, 114},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1306, 89},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1307, 194},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str643, 133},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str644, 80},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str645, 89},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str646, 83},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str647, 56},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str656, 122},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1310, 115},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str659, 199},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str660, 80},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1313, 360},
+ {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1315, 110},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str663, 12},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1318, 138},
+ {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1321, 110},
+ {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1323, 424},
+ {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1328, 144},
+ {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1330, 193},
{-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str667, 159},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1334, 177},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1341, 417},
+ {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1343, 103},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1344, 433},
+ {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1350, 97},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1351, 388},
+ {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1354, 349},
+ {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1356, 364},
+ {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1362, 40},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1372, 422},
{-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str672, 121},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1377, 241},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str675, 31},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1389, 399},
+ {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1393, 195},
+ {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1396, 138},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str677, 96},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str678, 148},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1398, 167},
+ {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1402, 30},
+ {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1404, 79},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1411, 274},
+ {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1413, 199},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str681, 148},
- {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str686, 131},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str687, 85},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1416, 268},
+ {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1422, 199},
+ {-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_str692, 130},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1429, 147},
+ {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1431, 411},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1432, 175},
+ {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1435, 231},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1436, 64},
+ {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1438, 350},
{-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str696, 46},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1442, 147},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1443, 243},
{-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str701, 0},
- {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str705, 107},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str706, 185},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str707, 99},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str708, 85},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1448, 84},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str710, 128},
- {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str716, 39},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1450, 5},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str718, 160},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str725, 10},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str732, 19},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1452, 336},
+ {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1457, 142},
+ {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1460, 236},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str734, 116},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str735, 145},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str736, 185},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1462, 275},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1463, 65},
+ {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1468, 142},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1478, 380},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1479, 91},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1480, 56},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str739, 25},
+ {(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_str745, 32},
+ {(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_str749, 64},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1516, 267},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1517, 81},
+ {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1519, 139},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1520, 139},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str752, 29},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1523, 318},
+ {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1525, 165},
{-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str757, 22},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str765, 52},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1530, 49},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1531, 339},
+ {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1536, 440},
+ {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1540, 124},
+ {-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},
+ {-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},
+ {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1571, 228},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1578, 32},
+ {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1581, 292},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str767, 101},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str768, 176},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1583, 259},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_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_str772, 28},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1595, 30},
+ {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1598, 96},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1605, 71},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1606, 177},
+ {-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},
+ {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1620, 90},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str777, 176},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str778, 64},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1634, 270},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1635, 136},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1636, 48},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1643, 286},
+ {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1645, 265},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str781, 71},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str782, 103},
+ {(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_str788, 189},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1670, 332},
+ {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1676, 98},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1683, 324},
+ {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1688, 108},
{-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str792, 57},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str793, 103},
+ {(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_str795, 30},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1701, 134},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str797, 168},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str806, 199},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1703, 134},
+ {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1709, 61},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1724, 104},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1725, 8},
+ {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1729, 46},
+ {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_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_str816, 124},
+ {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1759, 322},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str818, 44},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1761, 79},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1780, 375},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1787, 342},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str821, 156},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1790, 122},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str831, 116},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str840, 165},
{-1}, {-1}, {-1}, {-1}, {-1}, {-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_str1829, 291},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str851, 45},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1831, 171},
+ {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1835, 363},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1853, 33},
{-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str856, 61},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str857, 123},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1858, 149},
+ {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1864, 207},
{-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str861, 118},
+ {(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_str868, 37},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1896, 122},
+ {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1899, 193},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1900, 225},
{-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str872, 172},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1904, 108},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1917, 104},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1925, 197},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str888, 48},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1932, 191},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1944, 76},
+ {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_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_str892, 75},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1983, 362},
+ {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1988, 70},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2005, 427},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(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_str898, 63},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2028, 329},
+ {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2033, 321},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str902, 173},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str903, 126},
+ {(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},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-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_str916, 135},
+ {(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},
+ {(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_str918, 41},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str927, 63},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2141, 180},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2162, 320},
+ {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2165, 316},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2178, 191},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2189, 53},
{-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str932, 156},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str940, 84},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2194, 415},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-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_str2299, 58},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2313, 47},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2322, 48},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2338, 29},
{-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str944, 168},
+ {(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_str951, 158},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2349, 340},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2371, 181},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2372, 154},
+ {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2377, 441},
+ {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2379, 119},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2400, 414},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2401, 197},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2413, 248},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str976, 69},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2429, 107},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str980, 47},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2442, 328},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2454, 10},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str999, 90},
+ {-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_str1007, 95},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2523, 334},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2542, 29},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2549, 127},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2588, 127},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2627, 15},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2651, 338},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2671, 330},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2710, 301},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2724, 62},
+ {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2727, 208},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2737, 181},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2753, 117},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2785, 38},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-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_str1020, 90},
+ {(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_str1026, 95},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2940, 337},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2961, 335},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2962, 435},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1032, 88},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1033, 126},
- {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1037, 135},
+ {(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},
{-1}, {-1}, {-1}, {-1}, {-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_str1093, 47},
- {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1097, 106},
{-1}, {-1}, {-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_str1124, 153},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str3104, 76},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-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_str1146, 15},
+ {(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},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-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_str1148, 144},
+ {(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},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1190, 61},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-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},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1263, 173},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-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_str1329, 2},
+ {(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},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-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_str1347, 72},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1358, 165},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-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_str1395, 200},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1410, 75},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-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}, {-1},
+ {-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, 0},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str13, 10},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str14, 14},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str15, 3},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str16, 9},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str17, 12},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str18, 6},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str19, 5},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str20, 4},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str21, 2}
+ {(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_str1463, 72},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1470, 84},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str3802, 434},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
@@ -23809,17 +28657,15 @@ 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_str1556, 78},
{-1}, {-1}, {-1}, {-1}, {-1}, {-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},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1621, 153},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
@@ -23833,8 +28679,18 @@ uniname2ctype_p (str, len)
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1741, 73}
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str4167, 85}
#endif /* USE_UNICODE_PROPERTIES */
};
diff --git a/enc/unicode/name2ctype.kwd b/enc/unicode/name2ctype.kwd
index 2e27f3f7de..ff94d68b3b 100644
--- a/enc/unicode/name2ctype.kwd
+++ b/enc/unicode/name2ctype.kwd
@@ -1,6 +1,4273 @@
%{
#define long size_t
+/* 'NEWLINE': [[:NEWLINE:]] */
+static const OnigCodePoint CR_NEWLINE[] = {
+ 1,
+ 0x000a, 0x000a,
+}; /* CR_NEWLINE */
+
+/* 'Alpha': [[:Alpha:]] */
+static const OnigCodePoint CR_Alpha[] = {
+ 540,
+ 0x0041, 0x005a,
+ 0x0061, 0x007a,
+ 0x00aa, 0x00aa,
+ 0x00b5, 0x00b5,
+ 0x00ba, 0x00ba,
+ 0x00c0, 0x00d6,
+ 0x00d8, 0x00f6,
+ 0x00f8, 0x02c1,
+ 0x02c6, 0x02d1,
+ 0x02e0, 0x02e4,
+ 0x02ec, 0x02ec,
+ 0x02ee, 0x02ee,
+ 0x0345, 0x0345,
+ 0x0370, 0x0374,
+ 0x0376, 0x0377,
+ 0x037a, 0x037d,
+ 0x0386, 0x0386,
+ 0x0388, 0x038a,
+ 0x038c, 0x038c,
+ 0x038e, 0x03a1,
+ 0x03a3, 0x03f5,
+ 0x03f7, 0x0481,
+ 0x048a, 0x0527,
+ 0x0531, 0x0556,
+ 0x0559, 0x0559,
+ 0x0561, 0x0587,
+ 0x05b0, 0x05bd,
+ 0x05bf, 0x05bf,
+ 0x05c1, 0x05c2,
+ 0x05c4, 0x05c5,
+ 0x05c7, 0x05c7,
+ 0x05d0, 0x05ea,
+ 0x05f0, 0x05f2,
+ 0x0610, 0x061a,
+ 0x0620, 0x0657,
+ 0x0659, 0x065f,
+ 0x066e, 0x06d3,
+ 0x06d5, 0x06dc,
+ 0x06e1, 0x06e8,
+ 0x06ed, 0x06ef,
+ 0x06fa, 0x06fc,
+ 0x06ff, 0x06ff,
+ 0x0710, 0x073f,
+ 0x074d, 0x07b1,
+ 0x07ca, 0x07ea,
+ 0x07f4, 0x07f5,
+ 0x07fa, 0x07fa,
+ 0x0800, 0x0817,
+ 0x081a, 0x082c,
+ 0x0840, 0x0858,
+ 0x08a0, 0x08a0,
+ 0x08a2, 0x08ac,
+ 0x08e4, 0x08e9,
+ 0x08f0, 0x08fe,
+ 0x0900, 0x093b,
+ 0x093d, 0x094c,
+ 0x094e, 0x0950,
+ 0x0955, 0x0963,
+ 0x0971, 0x0977,
+ 0x0979, 0x097f,
+ 0x0981, 0x0983,
+ 0x0985, 0x098c,
+ 0x098f, 0x0990,
+ 0x0993, 0x09a8,
+ 0x09aa, 0x09b0,
+ 0x09b2, 0x09b2,
+ 0x09b6, 0x09b9,
+ 0x09bd, 0x09c4,
+ 0x09c7, 0x09c8,
+ 0x09cb, 0x09cc,
+ 0x09ce, 0x09ce,
+ 0x09d7, 0x09d7,
+ 0x09dc, 0x09dd,
+ 0x09df, 0x09e3,
+ 0x09f0, 0x09f1,
+ 0x0a01, 0x0a03,
+ 0x0a05, 0x0a0a,
+ 0x0a0f, 0x0a10,
+ 0x0a13, 0x0a28,
+ 0x0a2a, 0x0a30,
+ 0x0a32, 0x0a33,
+ 0x0a35, 0x0a36,
+ 0x0a38, 0x0a39,
+ 0x0a3e, 0x0a42,
+ 0x0a47, 0x0a48,
+ 0x0a4b, 0x0a4c,
+ 0x0a51, 0x0a51,
+ 0x0a59, 0x0a5c,
+ 0x0a5e, 0x0a5e,
+ 0x0a70, 0x0a75,
+ 0x0a81, 0x0a83,
+ 0x0a85, 0x0a8d,
+ 0x0a8f, 0x0a91,
+ 0x0a93, 0x0aa8,
+ 0x0aaa, 0x0ab0,
+ 0x0ab2, 0x0ab3,
+ 0x0ab5, 0x0ab9,
+ 0x0abd, 0x0ac5,
+ 0x0ac7, 0x0ac9,
+ 0x0acb, 0x0acc,
+ 0x0ad0, 0x0ad0,
+ 0x0ae0, 0x0ae3,
+ 0x0b01, 0x0b03,
+ 0x0b05, 0x0b0c,
+ 0x0b0f, 0x0b10,
+ 0x0b13, 0x0b28,
+ 0x0b2a, 0x0b30,
+ 0x0b32, 0x0b33,
+ 0x0b35, 0x0b39,
+ 0x0b3d, 0x0b44,
+ 0x0b47, 0x0b48,
+ 0x0b4b, 0x0b4c,
+ 0x0b56, 0x0b57,
+ 0x0b5c, 0x0b5d,
+ 0x0b5f, 0x0b63,
+ 0x0b71, 0x0b71,
+ 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, 0x0bcc,
+ 0x0bd0, 0x0bd0,
+ 0x0bd7, 0x0bd7,
+ 0x0c01, 0x0c03,
+ 0x0c05, 0x0c0c,
+ 0x0c0e, 0x0c10,
+ 0x0c12, 0x0c28,
+ 0x0c2a, 0x0c33,
+ 0x0c35, 0x0c39,
+ 0x0c3d, 0x0c44,
+ 0x0c46, 0x0c48,
+ 0x0c4a, 0x0c4c,
+ 0x0c55, 0x0c56,
+ 0x0c58, 0x0c59,
+ 0x0c60, 0x0c63,
+ 0x0c82, 0x0c83,
+ 0x0c85, 0x0c8c,
+ 0x0c8e, 0x0c90,
+ 0x0c92, 0x0ca8,
+ 0x0caa, 0x0cb3,
+ 0x0cb5, 0x0cb9,
+ 0x0cbd, 0x0cc4,
+ 0x0cc6, 0x0cc8,
+ 0x0cca, 0x0ccc,
+ 0x0cd5, 0x0cd6,
+ 0x0cde, 0x0cde,
+ 0x0ce0, 0x0ce3,
+ 0x0cf1, 0x0cf2,
+ 0x0d02, 0x0d03,
+ 0x0d05, 0x0d0c,
+ 0x0d0e, 0x0d10,
+ 0x0d12, 0x0d3a,
+ 0x0d3d, 0x0d44,
+ 0x0d46, 0x0d48,
+ 0x0d4a, 0x0d4c,
+ 0x0d4e, 0x0d4e,
+ 0x0d57, 0x0d57,
+ 0x0d60, 0x0d63,
+ 0x0d7a, 0x0d7f,
+ 0x0d82, 0x0d83,
+ 0x0d85, 0x0d96,
+ 0x0d9a, 0x0db1,
+ 0x0db3, 0x0dbb,
+ 0x0dbd, 0x0dbd,
+ 0x0dc0, 0x0dc6,
+ 0x0dcf, 0x0dd4,
+ 0x0dd6, 0x0dd6,
+ 0x0dd8, 0x0ddf,
+ 0x0df2, 0x0df3,
+ 0x0e01, 0x0e3a,
+ 0x0e40, 0x0e46,
+ 0x0e4d, 0x0e4d,
+ 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,
+ 0x0ecd, 0x0ecd,
+ 0x0edc, 0x0edf,
+ 0x0f00, 0x0f00,
+ 0x0f40, 0x0f47,
+ 0x0f49, 0x0f6c,
+ 0x0f71, 0x0f81,
+ 0x0f88, 0x0f97,
+ 0x0f99, 0x0fbc,
+ 0x1000, 0x1036,
+ 0x1038, 0x1038,
+ 0x103b, 0x103f,
+ 0x1050, 0x1062,
+ 0x1065, 0x1068,
+ 0x106e, 0x1086,
+ 0x108e, 0x108e,
+ 0x109c, 0x109d,
+ 0x10a0, 0x10c5,
+ 0x10c7, 0x10c7,
+ 0x10cd, 0x10cd,
+ 0x10d0, 0x10fa,
+ 0x10fc, 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,
+ 0x135f, 0x135f,
+ 0x1380, 0x138f,
+ 0x13a0, 0x13f4,
+ 0x1401, 0x166c,
+ 0x166f, 0x167f,
+ 0x1681, 0x169a,
+ 0x16a0, 0x16ea,
+ 0x16ee, 0x16f0,
+ 0x1700, 0x170c,
+ 0x170e, 0x1713,
+ 0x1720, 0x1733,
+ 0x1740, 0x1753,
+ 0x1760, 0x176c,
+ 0x176e, 0x1770,
+ 0x1772, 0x1773,
+ 0x1780, 0x17b3,
+ 0x17b6, 0x17c8,
+ 0x17d7, 0x17d7,
+ 0x17dc, 0x17dc,
+ 0x1820, 0x1877,
+ 0x1880, 0x18aa,
+ 0x18b0, 0x18f5,
+ 0x1900, 0x191c,
+ 0x1920, 0x192b,
+ 0x1930, 0x1938,
+ 0x1950, 0x196d,
+ 0x1970, 0x1974,
+ 0x1980, 0x19ab,
+ 0x19b0, 0x19c9,
+ 0x1a00, 0x1a1b,
+ 0x1a20, 0x1a5e,
+ 0x1a61, 0x1a74,
+ 0x1aa7, 0x1aa7,
+ 0x1b00, 0x1b33,
+ 0x1b35, 0x1b43,
+ 0x1b45, 0x1b4b,
+ 0x1b80, 0x1ba9,
+ 0x1bac, 0x1baf,
+ 0x1bba, 0x1be5,
+ 0x1be7, 0x1bf1,
+ 0x1c00, 0x1c35,
+ 0x1c4d, 0x1c4f,
+ 0x1c5a, 0x1c7d,
+ 0x1ce9, 0x1cec,
+ 0x1cee, 0x1cf3,
+ 0x1cf5, 0x1cf6,
+ 0x1d00, 0x1dbf,
+ 0x1e00, 0x1f15,
+ 0x1f18, 0x1f1d,
+ 0x1f20, 0x1f45,
+ 0x1f48, 0x1f4d,
+ 0x1f50, 0x1f57,
+ 0x1f59, 0x1f59,
+ 0x1f5b, 0x1f5b,
+ 0x1f5d, 0x1f5d,
+ 0x1f5f, 0x1f7d,
+ 0x1f80, 0x1fb4,
+ 0x1fb6, 0x1fbc,
+ 0x1fbe, 0x1fbe,
+ 0x1fc2, 0x1fc4,
+ 0x1fc6, 0x1fcc,
+ 0x1fd0, 0x1fd3,
+ 0x1fd6, 0x1fdb,
+ 0x1fe0, 0x1fec,
+ 0x1ff2, 0x1ff4,
+ 0x1ff6, 0x1ffc,
+ 0x2071, 0x2071,
+ 0x207f, 0x207f,
+ 0x2090, 0x209c,
+ 0x2102, 0x2102,
+ 0x2107, 0x2107,
+ 0x210a, 0x2113,
+ 0x2115, 0x2115,
+ 0x2119, 0x211d,
+ 0x2124, 0x2124,
+ 0x2126, 0x2126,
+ 0x2128, 0x2128,
+ 0x212a, 0x212d,
+ 0x212f, 0x2139,
+ 0x213c, 0x213f,
+ 0x2145, 0x2149,
+ 0x214e, 0x214e,
+ 0x2160, 0x2188,
+ 0x24b6, 0x24e9,
+ 0x2c00, 0x2c2e,
+ 0x2c30, 0x2c5e,
+ 0x2c60, 0x2ce4,
+ 0x2ceb, 0x2cee,
+ 0x2cf2, 0x2cf3,
+ 0x2d00, 0x2d25,
+ 0x2d27, 0x2d27,
+ 0x2d2d, 0x2d2d,
+ 0x2d30, 0x2d67,
+ 0x2d6f, 0x2d6f,
+ 0x2d80, 0x2d96,
+ 0x2da0, 0x2da6,
+ 0x2da8, 0x2dae,
+ 0x2db0, 0x2db6,
+ 0x2db8, 0x2dbe,
+ 0x2dc0, 0x2dc6,
+ 0x2dc8, 0x2dce,
+ 0x2dd0, 0x2dd6,
+ 0x2dd8, 0x2dde,
+ 0x2de0, 0x2dff,
+ 0x2e2f, 0x2e2f,
+ 0x3005, 0x3007,
+ 0x3021, 0x3029,
+ 0x3031, 0x3035,
+ 0x3038, 0x303c,
+ 0x3041, 0x3096,
+ 0x309d, 0x309f,
+ 0x30a1, 0x30fa,
+ 0x30fc, 0x30ff,
+ 0x3105, 0x312d,
+ 0x3131, 0x318e,
+ 0x31a0, 0x31ba,
+ 0x31f0, 0x31ff,
+ 0x3400, 0x4db5,
+ 0x4e00, 0x9fcc,
+ 0xa000, 0xa48c,
+ 0xa4d0, 0xa4fd,
+ 0xa500, 0xa60c,
+ 0xa610, 0xa61f,
+ 0xa62a, 0xa62b,
+ 0xa640, 0xa66e,
+ 0xa674, 0xa67b,
+ 0xa67f, 0xa697,
+ 0xa69f, 0xa6ef,
+ 0xa717, 0xa71f,
+ 0xa722, 0xa788,
+ 0xa78b, 0xa78e,
+ 0xa790, 0xa793,
+ 0xa7a0, 0xa7aa,
+ 0xa7f8, 0xa801,
+ 0xa803, 0xa805,
+ 0xa807, 0xa80a,
+ 0xa80c, 0xa827,
+ 0xa840, 0xa873,
+ 0xa880, 0xa8c3,
+ 0xa8f2, 0xa8f7,
+ 0xa8fb, 0xa8fb,
+ 0xa90a, 0xa92a,
+ 0xa930, 0xa952,
+ 0xa960, 0xa97c,
+ 0xa980, 0xa9b2,
+ 0xa9b4, 0xa9bf,
+ 0xa9cf, 0xa9cf,
+ 0xaa00, 0xaa36,
+ 0xaa40, 0xaa4d,
+ 0xaa60, 0xaa76,
+ 0xaa7a, 0xaa7a,
+ 0xaa80, 0xaabe,
+ 0xaac0, 0xaac0,
+ 0xaac2, 0xaac2,
+ 0xaadb, 0xaadd,
+ 0xaae0, 0xaaef,
+ 0xaaf2, 0xaaf5,
+ 0xab01, 0xab06,
+ 0xab09, 0xab0e,
+ 0xab11, 0xab16,
+ 0xab20, 0xab26,
+ 0xab28, 0xab2e,
+ 0xabc0, 0xabea,
+ 0xac00, 0xd7a3,
+ 0xd7b0, 0xd7c6,
+ 0xd7cb, 0xd7fb,
+ 0xf900, 0xfa6d,
+ 0xfa70, 0xfad9,
+ 0xfb00, 0xfb06,
+ 0xfb13, 0xfb17,
+ 0xfb1d, 0xfb28,
+ 0xfb2a, 0xfb36,
+ 0xfb38, 0xfb3c,
+ 0xfb3e, 0xfb3e,
+ 0xfb40, 0xfb41,
+ 0xfb43, 0xfb44,
+ 0xfb46, 0xfbb1,
+ 0xfbd3, 0xfd3d,
+ 0xfd50, 0xfd8f,
+ 0xfd92, 0xfdc7,
+ 0xfdf0, 0xfdfb,
+ 0xfe70, 0xfe74,
+ 0xfe76, 0xfefc,
+ 0xff21, 0xff3a,
+ 0xff41, 0xff5a,
+ 0xff66, 0xffbe,
+ 0xffc2, 0xffc7,
+ 0xffca, 0xffcf,
+ 0xffd2, 0xffd7,
+ 0xffda, 0xffdc,
+ 0x10000, 0x1000b,
+ 0x1000d, 0x10026,
+ 0x10028, 0x1003a,
+ 0x1003c, 0x1003d,
+ 0x1003f, 0x1004d,
+ 0x10050, 0x1005d,
+ 0x10080, 0x100fa,
+ 0x10140, 0x10174,
+ 0x10280, 0x1029c,
+ 0x102a0, 0x102d0,
+ 0x10300, 0x1031e,
+ 0x10330, 0x1034a,
+ 0x10380, 0x1039d,
+ 0x103a0, 0x103c3,
+ 0x103c8, 0x103cf,
+ 0x103d1, 0x103d5,
+ 0x10400, 0x1049d,
+ 0x10800, 0x10805,
+ 0x10808, 0x10808,
+ 0x1080a, 0x10835,
+ 0x10837, 0x10838,
+ 0x1083c, 0x1083c,
+ 0x1083f, 0x10855,
+ 0x10900, 0x10915,
+ 0x10920, 0x10939,
+ 0x10980, 0x109b7,
+ 0x109be, 0x109bf,
+ 0x10a00, 0x10a03,
+ 0x10a05, 0x10a06,
+ 0x10a0c, 0x10a13,
+ 0x10a15, 0x10a17,
+ 0x10a19, 0x10a33,
+ 0x10a60, 0x10a7c,
+ 0x10b00, 0x10b35,
+ 0x10b40, 0x10b55,
+ 0x10b60, 0x10b72,
+ 0x10c00, 0x10c48,
+ 0x11000, 0x11045,
+ 0x11082, 0x110b8,
+ 0x110d0, 0x110e8,
+ 0x11100, 0x11132,
+ 0x11180, 0x111bf,
+ 0x111c1, 0x111c4,
+ 0x11680, 0x116b5,
+ 0x12000, 0x1236e,
+ 0x12400, 0x12462,
+ 0x13000, 0x1342e,
+ 0x16800, 0x16a38,
+ 0x16f00, 0x16f44,
+ 0x16f50, 0x16f7e,
+ 0x16f93, 0x16f9f,
+ 0x1b000, 0x1b001,
+ 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, 0x1d6c0,
+ 0x1d6c2, 0x1d6da,
+ 0x1d6dc, 0x1d6fa,
+ 0x1d6fc, 0x1d714,
+ 0x1d716, 0x1d734,
+ 0x1d736, 0x1d74e,
+ 0x1d750, 0x1d76e,
+ 0x1d770, 0x1d788,
+ 0x1d78a, 0x1d7a8,
+ 0x1d7aa, 0x1d7c2,
+ 0x1d7c4, 0x1d7cb,
+ 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,
+ 0x20000, 0x2a6d6,
+ 0x2a700, 0x2b734,
+ 0x2b740, 0x2b81d,
+ 0x2f800, 0x2fa1d,
+}; /* CR_Alpha */
+
+/* 'Blank': [[:Blank:]] */
+static const OnigCodePoint CR_Blank[] = {
+ 9,
+ 0x0009, 0x0009,
+ 0x0020, 0x0020,
+ 0x00a0, 0x00a0,
+ 0x1680, 0x1680,
+ 0x180e, 0x180e,
+ 0x2000, 0x200a,
+ 0x202f, 0x202f,
+ 0x205f, 0x205f,
+ 0x3000, 0x3000,
+}; /* CR_Blank */
+
+/* 'Cntrl': [[:Cntrl:]] */
+static const OnigCodePoint CR_Cntrl[] = {
+ 2,
+ 0x0000, 0x001f,
+ 0x007f, 0x009f,
+}; /* CR_Cntrl */
+
+/* 'Digit': [[:Digit:]] */
+static const OnigCodePoint CR_Digit[] = {
+ 42,
+ 0x0030, 0x0039,
+ 0x0660, 0x0669,
+ 0x06f0, 0x06f9,
+ 0x07c0, 0x07c9,
+ 0x0966, 0x096f,
+ 0x09e6, 0x09ef,
+ 0x0a66, 0x0a6f,
+ 0x0ae6, 0x0aef,
+ 0x0b66, 0x0b6f,
+ 0x0be6, 0x0bef,
+ 0x0c66, 0x0c6f,
+ 0x0ce6, 0x0cef,
+ 0x0d66, 0x0d6f,
+ 0x0e50, 0x0e59,
+ 0x0ed0, 0x0ed9,
+ 0x0f20, 0x0f29,
+ 0x1040, 0x1049,
+ 0x1090, 0x1099,
+ 0x17e0, 0x17e9,
+ 0x1810, 0x1819,
+ 0x1946, 0x194f,
+ 0x19d0, 0x19d9,
+ 0x1a80, 0x1a89,
+ 0x1a90, 0x1a99,
+ 0x1b50, 0x1b59,
+ 0x1bb0, 0x1bb9,
+ 0x1c40, 0x1c49,
+ 0x1c50, 0x1c59,
+ 0xa620, 0xa629,
+ 0xa8d0, 0xa8d9,
+ 0xa900, 0xa909,
+ 0xa9d0, 0xa9d9,
+ 0xaa50, 0xaa59,
+ 0xabf0, 0xabf9,
+ 0xff10, 0xff19,
+ 0x104a0, 0x104a9,
+ 0x11066, 0x1106f,
+ 0x110f0, 0x110f9,
+ 0x11136, 0x1113f,
+ 0x111d0, 0x111d9,
+ 0x116c0, 0x116c9,
+ 0x1d7ce, 0x1d7ff,
+}; /* CR_Digit */
+
+/* 'Graph': [[:Graph:]] */
+static const OnigCodePoint CR_Graph[] = {
+ 544,
+ 0x0021, 0x007e,
+ 0x00a1, 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, 0x167f,
+ 0x1681, 0x169c,
+ 0x16a0, 0x16f0,
+ 0x1700, 0x170c,
+ 0x170e, 0x1714,
+ 0x1720, 0x1736,
+ 0x1740, 0x1753,
+ 0x1760, 0x176c,
+ 0x176e, 0x1770,
+ 0x1772, 0x1773,
+ 0x1780, 0x17dd,
+ 0x17e0, 0x17e9,
+ 0x17f0, 0x17f9,
+ 0x1800, 0x180d,
+ 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,
+ 0x200b, 0x2027,
+ 0x202a, 0x202e,
+ 0x2030, 0x205e,
+ 0x2060, 0x2064,
+ 0x206a, 0x2071,
+ 0x2074, 0x208e,
+ 0x2090, 0x209c,
+ 0x20a0, 0x20b9,
+ 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,
+ 0x3001, 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,
+ 0xe000, 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,
+ 0xfdf0, 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, 0xfffd,
+ 0x10000, 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,
+ 0x20000, 0x2a6d6,
+ 0x2a700, 0x2b734,
+ 0x2b740, 0x2b81d,
+ 0x2f800, 0x2fa1d,
+ 0xe0001, 0xe0001,
+ 0xe0020, 0xe007f,
+ 0xe0100, 0xe01ef,
+ 0xf0000, 0xffffd,
+ 0x100000, 0x10fffd,
+}; /* CR_Graph */
+
+/* 'Lower': [[:Lower:]] */
+static const OnigCodePoint CR_Lower[] = {
+ 618,
+ 0x0061, 0x007a,
+ 0x00aa, 0x00aa,
+ 0x00b5, 0x00b5,
+ 0x00ba, 0x00ba,
+ 0x00df, 0x00f6,
+ 0x00f8, 0x00ff,
+ 0x0101, 0x0101,
+ 0x0103, 0x0103,
+ 0x0105, 0x0105,
+ 0x0107, 0x0107,
+ 0x0109, 0x0109,
+ 0x010b, 0x010b,
+ 0x010d, 0x010d,
+ 0x010f, 0x010f,
+ 0x0111, 0x0111,
+ 0x0113, 0x0113,
+ 0x0115, 0x0115,
+ 0x0117, 0x0117,
+ 0x0119, 0x0119,
+ 0x011b, 0x011b,
+ 0x011d, 0x011d,
+ 0x011f, 0x011f,
+ 0x0121, 0x0121,
+ 0x0123, 0x0123,
+ 0x0125, 0x0125,
+ 0x0127, 0x0127,
+ 0x0129, 0x0129,
+ 0x012b, 0x012b,
+ 0x012d, 0x012d,
+ 0x012f, 0x012f,
+ 0x0131, 0x0131,
+ 0x0133, 0x0133,
+ 0x0135, 0x0135,
+ 0x0137, 0x0138,
+ 0x013a, 0x013a,
+ 0x013c, 0x013c,
+ 0x013e, 0x013e,
+ 0x0140, 0x0140,
+ 0x0142, 0x0142,
+ 0x0144, 0x0144,
+ 0x0146, 0x0146,
+ 0x0148, 0x0149,
+ 0x014b, 0x014b,
+ 0x014d, 0x014d,
+ 0x014f, 0x014f,
+ 0x0151, 0x0151,
+ 0x0153, 0x0153,
+ 0x0155, 0x0155,
+ 0x0157, 0x0157,
+ 0x0159, 0x0159,
+ 0x015b, 0x015b,
+ 0x015d, 0x015d,
+ 0x015f, 0x015f,
+ 0x0161, 0x0161,
+ 0x0163, 0x0163,
+ 0x0165, 0x0165,
+ 0x0167, 0x0167,
+ 0x0169, 0x0169,
+ 0x016b, 0x016b,
+ 0x016d, 0x016d,
+ 0x016f, 0x016f,
+ 0x0171, 0x0171,
+ 0x0173, 0x0173,
+ 0x0175, 0x0175,
+ 0x0177, 0x0177,
+ 0x017a, 0x017a,
+ 0x017c, 0x017c,
+ 0x017e, 0x0180,
+ 0x0183, 0x0183,
+ 0x0185, 0x0185,
+ 0x0188, 0x0188,
+ 0x018c, 0x018d,
+ 0x0192, 0x0192,
+ 0x0195, 0x0195,
+ 0x0199, 0x019b,
+ 0x019e, 0x019e,
+ 0x01a1, 0x01a1,
+ 0x01a3, 0x01a3,
+ 0x01a5, 0x01a5,
+ 0x01a8, 0x01a8,
+ 0x01aa, 0x01ab,
+ 0x01ad, 0x01ad,
+ 0x01b0, 0x01b0,
+ 0x01b4, 0x01b4,
+ 0x01b6, 0x01b6,
+ 0x01b9, 0x01ba,
+ 0x01bd, 0x01bf,
+ 0x01c6, 0x01c6,
+ 0x01c9, 0x01c9,
+ 0x01cc, 0x01cc,
+ 0x01ce, 0x01ce,
+ 0x01d0, 0x01d0,
+ 0x01d2, 0x01d2,
+ 0x01d4, 0x01d4,
+ 0x01d6, 0x01d6,
+ 0x01d8, 0x01d8,
+ 0x01da, 0x01da,
+ 0x01dc, 0x01dd,
+ 0x01df, 0x01df,
+ 0x01e1, 0x01e1,
+ 0x01e3, 0x01e3,
+ 0x01e5, 0x01e5,
+ 0x01e7, 0x01e7,
+ 0x01e9, 0x01e9,
+ 0x01eb, 0x01eb,
+ 0x01ed, 0x01ed,
+ 0x01ef, 0x01f0,
+ 0x01f3, 0x01f3,
+ 0x01f5, 0x01f5,
+ 0x01f9, 0x01f9,
+ 0x01fb, 0x01fb,
+ 0x01fd, 0x01fd,
+ 0x01ff, 0x01ff,
+ 0x0201, 0x0201,
+ 0x0203, 0x0203,
+ 0x0205, 0x0205,
+ 0x0207, 0x0207,
+ 0x0209, 0x0209,
+ 0x020b, 0x020b,
+ 0x020d, 0x020d,
+ 0x020f, 0x020f,
+ 0x0211, 0x0211,
+ 0x0213, 0x0213,
+ 0x0215, 0x0215,
+ 0x0217, 0x0217,
+ 0x0219, 0x0219,
+ 0x021b, 0x021b,
+ 0x021d, 0x021d,
+ 0x021f, 0x021f,
+ 0x0221, 0x0221,
+ 0x0223, 0x0223,
+ 0x0225, 0x0225,
+ 0x0227, 0x0227,
+ 0x0229, 0x0229,
+ 0x022b, 0x022b,
+ 0x022d, 0x022d,
+ 0x022f, 0x022f,
+ 0x0231, 0x0231,
+ 0x0233, 0x0239,
+ 0x023c, 0x023c,
+ 0x023f, 0x0240,
+ 0x0242, 0x0242,
+ 0x0247, 0x0247,
+ 0x0249, 0x0249,
+ 0x024b, 0x024b,
+ 0x024d, 0x024d,
+ 0x024f, 0x0293,
+ 0x0295, 0x02b8,
+ 0x02c0, 0x02c1,
+ 0x02e0, 0x02e4,
+ 0x0345, 0x0345,
+ 0x0371, 0x0371,
+ 0x0373, 0x0373,
+ 0x0377, 0x0377,
+ 0x037a, 0x037d,
+ 0x0390, 0x0390,
+ 0x03ac, 0x03ce,
+ 0x03d0, 0x03d1,
+ 0x03d5, 0x03d7,
+ 0x03d9, 0x03d9,
+ 0x03db, 0x03db,
+ 0x03dd, 0x03dd,
+ 0x03df, 0x03df,
+ 0x03e1, 0x03e1,
+ 0x03e3, 0x03e3,
+ 0x03e5, 0x03e5,
+ 0x03e7, 0x03e7,
+ 0x03e9, 0x03e9,
+ 0x03eb, 0x03eb,
+ 0x03ed, 0x03ed,
+ 0x03ef, 0x03f3,
+ 0x03f5, 0x03f5,
+ 0x03f8, 0x03f8,
+ 0x03fb, 0x03fc,
+ 0x0430, 0x045f,
+ 0x0461, 0x0461,
+ 0x0463, 0x0463,
+ 0x0465, 0x0465,
+ 0x0467, 0x0467,
+ 0x0469, 0x0469,
+ 0x046b, 0x046b,
+ 0x046d, 0x046d,
+ 0x046f, 0x046f,
+ 0x0471, 0x0471,
+ 0x0473, 0x0473,
+ 0x0475, 0x0475,
+ 0x0477, 0x0477,
+ 0x0479, 0x0479,
+ 0x047b, 0x047b,
+ 0x047d, 0x047d,
+ 0x047f, 0x047f,
+ 0x0481, 0x0481,
+ 0x048b, 0x048b,
+ 0x048d, 0x048d,
+ 0x048f, 0x048f,
+ 0x0491, 0x0491,
+ 0x0493, 0x0493,
+ 0x0495, 0x0495,
+ 0x0497, 0x0497,
+ 0x0499, 0x0499,
+ 0x049b, 0x049b,
+ 0x049d, 0x049d,
+ 0x049f, 0x049f,
+ 0x04a1, 0x04a1,
+ 0x04a3, 0x04a3,
+ 0x04a5, 0x04a5,
+ 0x04a7, 0x04a7,
+ 0x04a9, 0x04a9,
+ 0x04ab, 0x04ab,
+ 0x04ad, 0x04ad,
+ 0x04af, 0x04af,
+ 0x04b1, 0x04b1,
+ 0x04b3, 0x04b3,
+ 0x04b5, 0x04b5,
+ 0x04b7, 0x04b7,
+ 0x04b9, 0x04b9,
+ 0x04bb, 0x04bb,
+ 0x04bd, 0x04bd,
+ 0x04bf, 0x04bf,
+ 0x04c2, 0x04c2,
+ 0x04c4, 0x04c4,
+ 0x04c6, 0x04c6,
+ 0x04c8, 0x04c8,
+ 0x04ca, 0x04ca,
+ 0x04cc, 0x04cc,
+ 0x04ce, 0x04cf,
+ 0x04d1, 0x04d1,
+ 0x04d3, 0x04d3,
+ 0x04d5, 0x04d5,
+ 0x04d7, 0x04d7,
+ 0x04d9, 0x04d9,
+ 0x04db, 0x04db,
+ 0x04dd, 0x04dd,
+ 0x04df, 0x04df,
+ 0x04e1, 0x04e1,
+ 0x04e3, 0x04e3,
+ 0x04e5, 0x04e5,
+ 0x04e7, 0x04e7,
+ 0x04e9, 0x04e9,
+ 0x04eb, 0x04eb,
+ 0x04ed, 0x04ed,
+ 0x04ef, 0x04ef,
+ 0x04f1, 0x04f1,
+ 0x04f3, 0x04f3,
+ 0x04f5, 0x04f5,
+ 0x04f7, 0x04f7,
+ 0x04f9, 0x04f9,
+ 0x04fb, 0x04fb,
+ 0x04fd, 0x04fd,
+ 0x04ff, 0x04ff,
+ 0x0501, 0x0501,
+ 0x0503, 0x0503,
+ 0x0505, 0x0505,
+ 0x0507, 0x0507,
+ 0x0509, 0x0509,
+ 0x050b, 0x050b,
+ 0x050d, 0x050d,
+ 0x050f, 0x050f,
+ 0x0511, 0x0511,
+ 0x0513, 0x0513,
+ 0x0515, 0x0515,
+ 0x0517, 0x0517,
+ 0x0519, 0x0519,
+ 0x051b, 0x051b,
+ 0x051d, 0x051d,
+ 0x051f, 0x051f,
+ 0x0521, 0x0521,
+ 0x0523, 0x0523,
+ 0x0525, 0x0525,
+ 0x0527, 0x0527,
+ 0x0561, 0x0587,
+ 0x1d00, 0x1dbf,
+ 0x1e01, 0x1e01,
+ 0x1e03, 0x1e03,
+ 0x1e05, 0x1e05,
+ 0x1e07, 0x1e07,
+ 0x1e09, 0x1e09,
+ 0x1e0b, 0x1e0b,
+ 0x1e0d, 0x1e0d,
+ 0x1e0f, 0x1e0f,
+ 0x1e11, 0x1e11,
+ 0x1e13, 0x1e13,
+ 0x1e15, 0x1e15,
+ 0x1e17, 0x1e17,
+ 0x1e19, 0x1e19,
+ 0x1e1b, 0x1e1b,
+ 0x1e1d, 0x1e1d,
+ 0x1e1f, 0x1e1f,
+ 0x1e21, 0x1e21,
+ 0x1e23, 0x1e23,
+ 0x1e25, 0x1e25,
+ 0x1e27, 0x1e27,
+ 0x1e29, 0x1e29,
+ 0x1e2b, 0x1e2b,
+ 0x1e2d, 0x1e2d,
+ 0x1e2f, 0x1e2f,
+ 0x1e31, 0x1e31,
+ 0x1e33, 0x1e33,
+ 0x1e35, 0x1e35,
+ 0x1e37, 0x1e37,
+ 0x1e39, 0x1e39,
+ 0x1e3b, 0x1e3b,
+ 0x1e3d, 0x1e3d,
+ 0x1e3f, 0x1e3f,
+ 0x1e41, 0x1e41,
+ 0x1e43, 0x1e43,
+ 0x1e45, 0x1e45,
+ 0x1e47, 0x1e47,
+ 0x1e49, 0x1e49,
+ 0x1e4b, 0x1e4b,
+ 0x1e4d, 0x1e4d,
+ 0x1e4f, 0x1e4f,
+ 0x1e51, 0x1e51,
+ 0x1e53, 0x1e53,
+ 0x1e55, 0x1e55,
+ 0x1e57, 0x1e57,
+ 0x1e59, 0x1e59,
+ 0x1e5b, 0x1e5b,
+ 0x1e5d, 0x1e5d,
+ 0x1e5f, 0x1e5f,
+ 0x1e61, 0x1e61,
+ 0x1e63, 0x1e63,
+ 0x1e65, 0x1e65,
+ 0x1e67, 0x1e67,
+ 0x1e69, 0x1e69,
+ 0x1e6b, 0x1e6b,
+ 0x1e6d, 0x1e6d,
+ 0x1e6f, 0x1e6f,
+ 0x1e71, 0x1e71,
+ 0x1e73, 0x1e73,
+ 0x1e75, 0x1e75,
+ 0x1e77, 0x1e77,
+ 0x1e79, 0x1e79,
+ 0x1e7b, 0x1e7b,
+ 0x1e7d, 0x1e7d,
+ 0x1e7f, 0x1e7f,
+ 0x1e81, 0x1e81,
+ 0x1e83, 0x1e83,
+ 0x1e85, 0x1e85,
+ 0x1e87, 0x1e87,
+ 0x1e89, 0x1e89,
+ 0x1e8b, 0x1e8b,
+ 0x1e8d, 0x1e8d,
+ 0x1e8f, 0x1e8f,
+ 0x1e91, 0x1e91,
+ 0x1e93, 0x1e93,
+ 0x1e95, 0x1e9d,
+ 0x1e9f, 0x1e9f,
+ 0x1ea1, 0x1ea1,
+ 0x1ea3, 0x1ea3,
+ 0x1ea5, 0x1ea5,
+ 0x1ea7, 0x1ea7,
+ 0x1ea9, 0x1ea9,
+ 0x1eab, 0x1eab,
+ 0x1ead, 0x1ead,
+ 0x1eaf, 0x1eaf,
+ 0x1eb1, 0x1eb1,
+ 0x1eb3, 0x1eb3,
+ 0x1eb5, 0x1eb5,
+ 0x1eb7, 0x1eb7,
+ 0x1eb9, 0x1eb9,
+ 0x1ebb, 0x1ebb,
+ 0x1ebd, 0x1ebd,
+ 0x1ebf, 0x1ebf,
+ 0x1ec1, 0x1ec1,
+ 0x1ec3, 0x1ec3,
+ 0x1ec5, 0x1ec5,
+ 0x1ec7, 0x1ec7,
+ 0x1ec9, 0x1ec9,
+ 0x1ecb, 0x1ecb,
+ 0x1ecd, 0x1ecd,
+ 0x1ecf, 0x1ecf,
+ 0x1ed1, 0x1ed1,
+ 0x1ed3, 0x1ed3,
+ 0x1ed5, 0x1ed5,
+ 0x1ed7, 0x1ed7,
+ 0x1ed9, 0x1ed9,
+ 0x1edb, 0x1edb,
+ 0x1edd, 0x1edd,
+ 0x1edf, 0x1edf,
+ 0x1ee1, 0x1ee1,
+ 0x1ee3, 0x1ee3,
+ 0x1ee5, 0x1ee5,
+ 0x1ee7, 0x1ee7,
+ 0x1ee9, 0x1ee9,
+ 0x1eeb, 0x1eeb,
+ 0x1eed, 0x1eed,
+ 0x1eef, 0x1eef,
+ 0x1ef1, 0x1ef1,
+ 0x1ef3, 0x1ef3,
+ 0x1ef5, 0x1ef5,
+ 0x1ef7, 0x1ef7,
+ 0x1ef9, 0x1ef9,
+ 0x1efb, 0x1efb,
+ 0x1efd, 0x1efd,
+ 0x1eff, 0x1f07,
+ 0x1f10, 0x1f15,
+ 0x1f20, 0x1f27,
+ 0x1f30, 0x1f37,
+ 0x1f40, 0x1f45,
+ 0x1f50, 0x1f57,
+ 0x1f60, 0x1f67,
+ 0x1f70, 0x1f7d,
+ 0x1f80, 0x1f87,
+ 0x1f90, 0x1f97,
+ 0x1fa0, 0x1fa7,
+ 0x1fb0, 0x1fb4,
+ 0x1fb6, 0x1fb7,
+ 0x1fbe, 0x1fbe,
+ 0x1fc2, 0x1fc4,
+ 0x1fc6, 0x1fc7,
+ 0x1fd0, 0x1fd3,
+ 0x1fd6, 0x1fd7,
+ 0x1fe0, 0x1fe7,
+ 0x1ff2, 0x1ff4,
+ 0x1ff6, 0x1ff7,
+ 0x2071, 0x2071,
+ 0x207f, 0x207f,
+ 0x2090, 0x209c,
+ 0x210a, 0x210a,
+ 0x210e, 0x210f,
+ 0x2113, 0x2113,
+ 0x212f, 0x212f,
+ 0x2134, 0x2134,
+ 0x2139, 0x2139,
+ 0x213c, 0x213d,
+ 0x2146, 0x2149,
+ 0x214e, 0x214e,
+ 0x2170, 0x217f,
+ 0x2184, 0x2184,
+ 0x24d0, 0x24e9,
+ 0x2c30, 0x2c5e,
+ 0x2c61, 0x2c61,
+ 0x2c65, 0x2c66,
+ 0x2c68, 0x2c68,
+ 0x2c6a, 0x2c6a,
+ 0x2c6c, 0x2c6c,
+ 0x2c71, 0x2c71,
+ 0x2c73, 0x2c74,
+ 0x2c76, 0x2c7d,
+ 0x2c81, 0x2c81,
+ 0x2c83, 0x2c83,
+ 0x2c85, 0x2c85,
+ 0x2c87, 0x2c87,
+ 0x2c89, 0x2c89,
+ 0x2c8b, 0x2c8b,
+ 0x2c8d, 0x2c8d,
+ 0x2c8f, 0x2c8f,
+ 0x2c91, 0x2c91,
+ 0x2c93, 0x2c93,
+ 0x2c95, 0x2c95,
+ 0x2c97, 0x2c97,
+ 0x2c99, 0x2c99,
+ 0x2c9b, 0x2c9b,
+ 0x2c9d, 0x2c9d,
+ 0x2c9f, 0x2c9f,
+ 0x2ca1, 0x2ca1,
+ 0x2ca3, 0x2ca3,
+ 0x2ca5, 0x2ca5,
+ 0x2ca7, 0x2ca7,
+ 0x2ca9, 0x2ca9,
+ 0x2cab, 0x2cab,
+ 0x2cad, 0x2cad,
+ 0x2caf, 0x2caf,
+ 0x2cb1, 0x2cb1,
+ 0x2cb3, 0x2cb3,
+ 0x2cb5, 0x2cb5,
+ 0x2cb7, 0x2cb7,
+ 0x2cb9, 0x2cb9,
+ 0x2cbb, 0x2cbb,
+ 0x2cbd, 0x2cbd,
+ 0x2cbf, 0x2cbf,
+ 0x2cc1, 0x2cc1,
+ 0x2cc3, 0x2cc3,
+ 0x2cc5, 0x2cc5,
+ 0x2cc7, 0x2cc7,
+ 0x2cc9, 0x2cc9,
+ 0x2ccb, 0x2ccb,
+ 0x2ccd, 0x2ccd,
+ 0x2ccf, 0x2ccf,
+ 0x2cd1, 0x2cd1,
+ 0x2cd3, 0x2cd3,
+ 0x2cd5, 0x2cd5,
+ 0x2cd7, 0x2cd7,
+ 0x2cd9, 0x2cd9,
+ 0x2cdb, 0x2cdb,
+ 0x2cdd, 0x2cdd,
+ 0x2cdf, 0x2cdf,
+ 0x2ce1, 0x2ce1,
+ 0x2ce3, 0x2ce4,
+ 0x2cec, 0x2cec,
+ 0x2cee, 0x2cee,
+ 0x2cf3, 0x2cf3,
+ 0x2d00, 0x2d25,
+ 0x2d27, 0x2d27,
+ 0x2d2d, 0x2d2d,
+ 0xa641, 0xa641,
+ 0xa643, 0xa643,
+ 0xa645, 0xa645,
+ 0xa647, 0xa647,
+ 0xa649, 0xa649,
+ 0xa64b, 0xa64b,
+ 0xa64d, 0xa64d,
+ 0xa64f, 0xa64f,
+ 0xa651, 0xa651,
+ 0xa653, 0xa653,
+ 0xa655, 0xa655,
+ 0xa657, 0xa657,
+ 0xa659, 0xa659,
+ 0xa65b, 0xa65b,
+ 0xa65d, 0xa65d,
+ 0xa65f, 0xa65f,
+ 0xa661, 0xa661,
+ 0xa663, 0xa663,
+ 0xa665, 0xa665,
+ 0xa667, 0xa667,
+ 0xa669, 0xa669,
+ 0xa66b, 0xa66b,
+ 0xa66d, 0xa66d,
+ 0xa681, 0xa681,
+ 0xa683, 0xa683,
+ 0xa685, 0xa685,
+ 0xa687, 0xa687,
+ 0xa689, 0xa689,
+ 0xa68b, 0xa68b,
+ 0xa68d, 0xa68d,
+ 0xa68f, 0xa68f,
+ 0xa691, 0xa691,
+ 0xa693, 0xa693,
+ 0xa695, 0xa695,
+ 0xa697, 0xa697,
+ 0xa723, 0xa723,
+ 0xa725, 0xa725,
+ 0xa727, 0xa727,
+ 0xa729, 0xa729,
+ 0xa72b, 0xa72b,
+ 0xa72d, 0xa72d,
+ 0xa72f, 0xa731,
+ 0xa733, 0xa733,
+ 0xa735, 0xa735,
+ 0xa737, 0xa737,
+ 0xa739, 0xa739,
+ 0xa73b, 0xa73b,
+ 0xa73d, 0xa73d,
+ 0xa73f, 0xa73f,
+ 0xa741, 0xa741,
+ 0xa743, 0xa743,
+ 0xa745, 0xa745,
+ 0xa747, 0xa747,
+ 0xa749, 0xa749,
+ 0xa74b, 0xa74b,
+ 0xa74d, 0xa74d,
+ 0xa74f, 0xa74f,
+ 0xa751, 0xa751,
+ 0xa753, 0xa753,
+ 0xa755, 0xa755,
+ 0xa757, 0xa757,
+ 0xa759, 0xa759,
+ 0xa75b, 0xa75b,
+ 0xa75d, 0xa75d,
+ 0xa75f, 0xa75f,
+ 0xa761, 0xa761,
+ 0xa763, 0xa763,
+ 0xa765, 0xa765,
+ 0xa767, 0xa767,
+ 0xa769, 0xa769,
+ 0xa76b, 0xa76b,
+ 0xa76d, 0xa76d,
+ 0xa76f, 0xa778,
+ 0xa77a, 0xa77a,
+ 0xa77c, 0xa77c,
+ 0xa77f, 0xa77f,
+ 0xa781, 0xa781,
+ 0xa783, 0xa783,
+ 0xa785, 0xa785,
+ 0xa787, 0xa787,
+ 0xa78c, 0xa78c,
+ 0xa78e, 0xa78e,
+ 0xa791, 0xa791,
+ 0xa793, 0xa793,
+ 0xa7a1, 0xa7a1,
+ 0xa7a3, 0xa7a3,
+ 0xa7a5, 0xa7a5,
+ 0xa7a7, 0xa7a7,
+ 0xa7a9, 0xa7a9,
+ 0xa7f8, 0xa7fa,
+ 0xfb00, 0xfb06,
+ 0xfb13, 0xfb17,
+ 0xff41, 0xff5a,
+ 0x10428, 0x1044f,
+ 0x1d41a, 0x1d433,
+ 0x1d44e, 0x1d454,
+ 0x1d456, 0x1d467,
+ 0x1d482, 0x1d49b,
+ 0x1d4b6, 0x1d4b9,
+ 0x1d4bb, 0x1d4bb,
+ 0x1d4bd, 0x1d4c3,
+ 0x1d4c5, 0x1d4cf,
+ 0x1d4ea, 0x1d503,
+ 0x1d51e, 0x1d537,
+ 0x1d552, 0x1d56b,
+ 0x1d586, 0x1d59f,
+ 0x1d5ba, 0x1d5d3,
+ 0x1d5ee, 0x1d607,
+ 0x1d622, 0x1d63b,
+ 0x1d656, 0x1d66f,
+ 0x1d68a, 0x1d6a5,
+ 0x1d6c2, 0x1d6da,
+ 0x1d6dc, 0x1d6e1,
+ 0x1d6fc, 0x1d714,
+ 0x1d716, 0x1d71b,
+ 0x1d736, 0x1d74e,
+ 0x1d750, 0x1d755,
+ 0x1d770, 0x1d788,
+ 0x1d78a, 0x1d78f,
+ 0x1d7aa, 0x1d7c2,
+ 0x1d7c4, 0x1d7c9,
+ 0x1d7cb, 0x1d7cb,
+}; /* CR_Lower */
+
+/* 'Print': [[:Print:]] */
+static const OnigCodePoint CR_Print[] = {
+ 541,
+ 0x0020, 0x007e,
+ 0x00a0, 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, 0x2027,
+ 0x202a, 0x2064,
+ 0x206a, 0x2071,
+ 0x2074, 0x208e,
+ 0x2090, 0x209c,
+ 0x20a0, 0x20b9,
+ 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,
+ 0xe000, 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,
+ 0xfdf0, 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, 0xfffd,
+ 0x10000, 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,
+ 0x20000, 0x2a6d6,
+ 0x2a700, 0x2b734,
+ 0x2b740, 0x2b81d,
+ 0x2f800, 0x2fa1d,
+ 0xe0001, 0xe0001,
+ 0xe0020, 0xe007f,
+ 0xe0100, 0xe01ef,
+ 0xf0000, 0xffffd,
+ 0x100000, 0x10fffd,
+}; /* CR_Print */
+
+/* 'Punct': [[:Punct:]] */
+static const OnigCodePoint CR_Punct[] = {
+ 140,
+ 0x0021, 0x0023,
+ 0x0025, 0x002a,
+ 0x002c, 0x002f,
+ 0x003a, 0x003b,
+ 0x003f, 0x0040,
+ 0x005b, 0x005d,
+ 0x005f, 0x005f,
+ 0x007b, 0x007b,
+ 0x007d, 0x007d,
+ 0x00a1, 0x00a1,
+ 0x00a7, 0x00a7,
+ 0x00ab, 0x00ab,
+ 0x00b6, 0x00b7,
+ 0x00bb, 0x00bb,
+ 0x00bf, 0x00bf,
+ 0x037e, 0x037e,
+ 0x0387, 0x0387,
+ 0x055a, 0x055f,
+ 0x0589, 0x058a,
+ 0x05be, 0x05be,
+ 0x05c0, 0x05c0,
+ 0x05c3, 0x05c3,
+ 0x05c6, 0x05c6,
+ 0x05f3, 0x05f4,
+ 0x0609, 0x060a,
+ 0x060c, 0x060d,
+ 0x061b, 0x061b,
+ 0x061e, 0x061f,
+ 0x066a, 0x066d,
+ 0x06d4, 0x06d4,
+ 0x0700, 0x070d,
+ 0x07f7, 0x07f9,
+ 0x0830, 0x083e,
+ 0x085e, 0x085e,
+ 0x0964, 0x0965,
+ 0x0970, 0x0970,
+ 0x0af0, 0x0af0,
+ 0x0df4, 0x0df4,
+ 0x0e4f, 0x0e4f,
+ 0x0e5a, 0x0e5b,
+ 0x0f04, 0x0f12,
+ 0x0f14, 0x0f14,
+ 0x0f3a, 0x0f3d,
+ 0x0f85, 0x0f85,
+ 0x0fd0, 0x0fd4,
+ 0x0fd9, 0x0fda,
+ 0x104a, 0x104f,
+ 0x10fb, 0x10fb,
+ 0x1360, 0x1368,
+ 0x1400, 0x1400,
+ 0x166d, 0x166e,
+ 0x169b, 0x169c,
+ 0x16eb, 0x16ed,
+ 0x1735, 0x1736,
+ 0x17d4, 0x17d6,
+ 0x17d8, 0x17da,
+ 0x1800, 0x180a,
+ 0x1944, 0x1945,
+ 0x1a1e, 0x1a1f,
+ 0x1aa0, 0x1aa6,
+ 0x1aa8, 0x1aad,
+ 0x1b5a, 0x1b60,
+ 0x1bfc, 0x1bff,
+ 0x1c3b, 0x1c3f,
+ 0x1c7e, 0x1c7f,
+ 0x1cc0, 0x1cc7,
+ 0x1cd3, 0x1cd3,
+ 0x2010, 0x2027,
+ 0x2030, 0x2043,
+ 0x2045, 0x2051,
+ 0x2053, 0x205e,
+ 0x207d, 0x207e,
+ 0x208d, 0x208e,
+ 0x2329, 0x232a,
+ 0x2768, 0x2775,
+ 0x27c5, 0x27c6,
+ 0x27e6, 0x27ef,
+ 0x2983, 0x2998,
+ 0x29d8, 0x29db,
+ 0x29fc, 0x29fd,
+ 0x2cf9, 0x2cfc,
+ 0x2cfe, 0x2cff,
+ 0x2d70, 0x2d70,
+ 0x2e00, 0x2e2e,
+ 0x2e30, 0x2e3b,
+ 0x3001, 0x3003,
+ 0x3008, 0x3011,
+ 0x3014, 0x301f,
+ 0x3030, 0x3030,
+ 0x303d, 0x303d,
+ 0x30a0, 0x30a0,
+ 0x30fb, 0x30fb,
+ 0xa4fe, 0xa4ff,
+ 0xa60d, 0xa60f,
+ 0xa673, 0xa673,
+ 0xa67e, 0xa67e,
+ 0xa6f2, 0xa6f7,
+ 0xa874, 0xa877,
+ 0xa8ce, 0xa8cf,
+ 0xa8f8, 0xa8fa,
+ 0xa92e, 0xa92f,
+ 0xa95f, 0xa95f,
+ 0xa9c1, 0xa9cd,
+ 0xa9de, 0xa9df,
+ 0xaa5c, 0xaa5f,
+ 0xaade, 0xaadf,
+ 0xaaf0, 0xaaf1,
+ 0xabeb, 0xabeb,
+ 0xfd3e, 0xfd3f,
+ 0xfe10, 0xfe19,
+ 0xfe30, 0xfe52,
+ 0xfe54, 0xfe61,
+ 0xfe63, 0xfe63,
+ 0xfe68, 0xfe68,
+ 0xfe6a, 0xfe6b,
+ 0xff01, 0xff03,
+ 0xff05, 0xff0a,
+ 0xff0c, 0xff0f,
+ 0xff1a, 0xff1b,
+ 0xff1f, 0xff20,
+ 0xff3b, 0xff3d,
+ 0xff3f, 0xff3f,
+ 0xff5b, 0xff5b,
+ 0xff5d, 0xff5d,
+ 0xff5f, 0xff65,
+ 0x10100, 0x10102,
+ 0x1039f, 0x1039f,
+ 0x103d0, 0x103d0,
+ 0x10857, 0x10857,
+ 0x1091f, 0x1091f,
+ 0x1093f, 0x1093f,
+ 0x10a50, 0x10a58,
+ 0x10a7f, 0x10a7f,
+ 0x10b39, 0x10b3f,
+ 0x11047, 0x1104d,
+ 0x110bb, 0x110bc,
+ 0x110be, 0x110c1,
+ 0x11140, 0x11143,
+ 0x111c5, 0x111c8,
+ 0x12470, 0x12473,
+}; /* CR_Punct */
+
+/* 'Space': [[:Space:]] */
+static const OnigCodePoint CR_Space[] = {
+ 11,
+ 0x0009, 0x000d,
+ 0x0020, 0x0020,
+ 0x0085, 0x0085,
+ 0x00a0, 0x00a0,
+ 0x1680, 0x1680,
+ 0x180e, 0x180e,
+ 0x2000, 0x200a,
+ 0x2028, 0x2029,
+ 0x202f, 0x202f,
+ 0x205f, 0x205f,
+ 0x3000, 0x3000,
+}; /* CR_Space */
+
+/* 'Upper': [[:Upper:]] */
+static const OnigCodePoint CR_Upper[] = {
+ 610,
+ 0x0041, 0x005a,
+ 0x00c0, 0x00d6,
+ 0x00d8, 0x00de,
+ 0x0100, 0x0100,
+ 0x0102, 0x0102,
+ 0x0104, 0x0104,
+ 0x0106, 0x0106,
+ 0x0108, 0x0108,
+ 0x010a, 0x010a,
+ 0x010c, 0x010c,
+ 0x010e, 0x010e,
+ 0x0110, 0x0110,
+ 0x0112, 0x0112,
+ 0x0114, 0x0114,
+ 0x0116, 0x0116,
+ 0x0118, 0x0118,
+ 0x011a, 0x011a,
+ 0x011c, 0x011c,
+ 0x011e, 0x011e,
+ 0x0120, 0x0120,
+ 0x0122, 0x0122,
+ 0x0124, 0x0124,
+ 0x0126, 0x0126,
+ 0x0128, 0x0128,
+ 0x012a, 0x012a,
+ 0x012c, 0x012c,
+ 0x012e, 0x012e,
+ 0x0130, 0x0130,
+ 0x0132, 0x0132,
+ 0x0134, 0x0134,
+ 0x0136, 0x0136,
+ 0x0139, 0x0139,
+ 0x013b, 0x013b,
+ 0x013d, 0x013d,
+ 0x013f, 0x013f,
+ 0x0141, 0x0141,
+ 0x0143, 0x0143,
+ 0x0145, 0x0145,
+ 0x0147, 0x0147,
+ 0x014a, 0x014a,
+ 0x014c, 0x014c,
+ 0x014e, 0x014e,
+ 0x0150, 0x0150,
+ 0x0152, 0x0152,
+ 0x0154, 0x0154,
+ 0x0156, 0x0156,
+ 0x0158, 0x0158,
+ 0x015a, 0x015a,
+ 0x015c, 0x015c,
+ 0x015e, 0x015e,
+ 0x0160, 0x0160,
+ 0x0162, 0x0162,
+ 0x0164, 0x0164,
+ 0x0166, 0x0166,
+ 0x0168, 0x0168,
+ 0x016a, 0x016a,
+ 0x016c, 0x016c,
+ 0x016e, 0x016e,
+ 0x0170, 0x0170,
+ 0x0172, 0x0172,
+ 0x0174, 0x0174,
+ 0x0176, 0x0176,
+ 0x0178, 0x0179,
+ 0x017b, 0x017b,
+ 0x017d, 0x017d,
+ 0x0181, 0x0182,
+ 0x0184, 0x0184,
+ 0x0186, 0x0187,
+ 0x0189, 0x018b,
+ 0x018e, 0x0191,
+ 0x0193, 0x0194,
+ 0x0196, 0x0198,
+ 0x019c, 0x019d,
+ 0x019f, 0x01a0,
+ 0x01a2, 0x01a2,
+ 0x01a4, 0x01a4,
+ 0x01a6, 0x01a7,
+ 0x01a9, 0x01a9,
+ 0x01ac, 0x01ac,
+ 0x01ae, 0x01af,
+ 0x01b1, 0x01b3,
+ 0x01b5, 0x01b5,
+ 0x01b7, 0x01b8,
+ 0x01bc, 0x01bc,
+ 0x01c4, 0x01c4,
+ 0x01c7, 0x01c7,
+ 0x01ca, 0x01ca,
+ 0x01cd, 0x01cd,
+ 0x01cf, 0x01cf,
+ 0x01d1, 0x01d1,
+ 0x01d3, 0x01d3,
+ 0x01d5, 0x01d5,
+ 0x01d7, 0x01d7,
+ 0x01d9, 0x01d9,
+ 0x01db, 0x01db,
+ 0x01de, 0x01de,
+ 0x01e0, 0x01e0,
+ 0x01e2, 0x01e2,
+ 0x01e4, 0x01e4,
+ 0x01e6, 0x01e6,
+ 0x01e8, 0x01e8,
+ 0x01ea, 0x01ea,
+ 0x01ec, 0x01ec,
+ 0x01ee, 0x01ee,
+ 0x01f1, 0x01f1,
+ 0x01f4, 0x01f4,
+ 0x01f6, 0x01f8,
+ 0x01fa, 0x01fa,
+ 0x01fc, 0x01fc,
+ 0x01fe, 0x01fe,
+ 0x0200, 0x0200,
+ 0x0202, 0x0202,
+ 0x0204, 0x0204,
+ 0x0206, 0x0206,
+ 0x0208, 0x0208,
+ 0x020a, 0x020a,
+ 0x020c, 0x020c,
+ 0x020e, 0x020e,
+ 0x0210, 0x0210,
+ 0x0212, 0x0212,
+ 0x0214, 0x0214,
+ 0x0216, 0x0216,
+ 0x0218, 0x0218,
+ 0x021a, 0x021a,
+ 0x021c, 0x021c,
+ 0x021e, 0x021e,
+ 0x0220, 0x0220,
+ 0x0222, 0x0222,
+ 0x0224, 0x0224,
+ 0x0226, 0x0226,
+ 0x0228, 0x0228,
+ 0x022a, 0x022a,
+ 0x022c, 0x022c,
+ 0x022e, 0x022e,
+ 0x0230, 0x0230,
+ 0x0232, 0x0232,
+ 0x023a, 0x023b,
+ 0x023d, 0x023e,
+ 0x0241, 0x0241,
+ 0x0243, 0x0246,
+ 0x0248, 0x0248,
+ 0x024a, 0x024a,
+ 0x024c, 0x024c,
+ 0x024e, 0x024e,
+ 0x0370, 0x0370,
+ 0x0372, 0x0372,
+ 0x0376, 0x0376,
+ 0x0386, 0x0386,
+ 0x0388, 0x038a,
+ 0x038c, 0x038c,
+ 0x038e, 0x038f,
+ 0x0391, 0x03a1,
+ 0x03a3, 0x03ab,
+ 0x03cf, 0x03cf,
+ 0x03d2, 0x03d4,
+ 0x03d8, 0x03d8,
+ 0x03da, 0x03da,
+ 0x03dc, 0x03dc,
+ 0x03de, 0x03de,
+ 0x03e0, 0x03e0,
+ 0x03e2, 0x03e2,
+ 0x03e4, 0x03e4,
+ 0x03e6, 0x03e6,
+ 0x03e8, 0x03e8,
+ 0x03ea, 0x03ea,
+ 0x03ec, 0x03ec,
+ 0x03ee, 0x03ee,
+ 0x03f4, 0x03f4,
+ 0x03f7, 0x03f7,
+ 0x03f9, 0x03fa,
+ 0x03fd, 0x042f,
+ 0x0460, 0x0460,
+ 0x0462, 0x0462,
+ 0x0464, 0x0464,
+ 0x0466, 0x0466,
+ 0x0468, 0x0468,
+ 0x046a, 0x046a,
+ 0x046c, 0x046c,
+ 0x046e, 0x046e,
+ 0x0470, 0x0470,
+ 0x0472, 0x0472,
+ 0x0474, 0x0474,
+ 0x0476, 0x0476,
+ 0x0478, 0x0478,
+ 0x047a, 0x047a,
+ 0x047c, 0x047c,
+ 0x047e, 0x047e,
+ 0x0480, 0x0480,
+ 0x048a, 0x048a,
+ 0x048c, 0x048c,
+ 0x048e, 0x048e,
+ 0x0490, 0x0490,
+ 0x0492, 0x0492,
+ 0x0494, 0x0494,
+ 0x0496, 0x0496,
+ 0x0498, 0x0498,
+ 0x049a, 0x049a,
+ 0x049c, 0x049c,
+ 0x049e, 0x049e,
+ 0x04a0, 0x04a0,
+ 0x04a2, 0x04a2,
+ 0x04a4, 0x04a4,
+ 0x04a6, 0x04a6,
+ 0x04a8, 0x04a8,
+ 0x04aa, 0x04aa,
+ 0x04ac, 0x04ac,
+ 0x04ae, 0x04ae,
+ 0x04b0, 0x04b0,
+ 0x04b2, 0x04b2,
+ 0x04b4, 0x04b4,
+ 0x04b6, 0x04b6,
+ 0x04b8, 0x04b8,
+ 0x04ba, 0x04ba,
+ 0x04bc, 0x04bc,
+ 0x04be, 0x04be,
+ 0x04c0, 0x04c1,
+ 0x04c3, 0x04c3,
+ 0x04c5, 0x04c5,
+ 0x04c7, 0x04c7,
+ 0x04c9, 0x04c9,
+ 0x04cb, 0x04cb,
+ 0x04cd, 0x04cd,
+ 0x04d0, 0x04d0,
+ 0x04d2, 0x04d2,
+ 0x04d4, 0x04d4,
+ 0x04d6, 0x04d6,
+ 0x04d8, 0x04d8,
+ 0x04da, 0x04da,
+ 0x04dc, 0x04dc,
+ 0x04de, 0x04de,
+ 0x04e0, 0x04e0,
+ 0x04e2, 0x04e2,
+ 0x04e4, 0x04e4,
+ 0x04e6, 0x04e6,
+ 0x04e8, 0x04e8,
+ 0x04ea, 0x04ea,
+ 0x04ec, 0x04ec,
+ 0x04ee, 0x04ee,
+ 0x04f0, 0x04f0,
+ 0x04f2, 0x04f2,
+ 0x04f4, 0x04f4,
+ 0x04f6, 0x04f6,
+ 0x04f8, 0x04f8,
+ 0x04fa, 0x04fa,
+ 0x04fc, 0x04fc,
+ 0x04fe, 0x04fe,
+ 0x0500, 0x0500,
+ 0x0502, 0x0502,
+ 0x0504, 0x0504,
+ 0x0506, 0x0506,
+ 0x0508, 0x0508,
+ 0x050a, 0x050a,
+ 0x050c, 0x050c,
+ 0x050e, 0x050e,
+ 0x0510, 0x0510,
+ 0x0512, 0x0512,
+ 0x0514, 0x0514,
+ 0x0516, 0x0516,
+ 0x0518, 0x0518,
+ 0x051a, 0x051a,
+ 0x051c, 0x051c,
+ 0x051e, 0x051e,
+ 0x0520, 0x0520,
+ 0x0522, 0x0522,
+ 0x0524, 0x0524,
+ 0x0526, 0x0526,
+ 0x0531, 0x0556,
+ 0x10a0, 0x10c5,
+ 0x10c7, 0x10c7,
+ 0x10cd, 0x10cd,
+ 0x1e00, 0x1e00,
+ 0x1e02, 0x1e02,
+ 0x1e04, 0x1e04,
+ 0x1e06, 0x1e06,
+ 0x1e08, 0x1e08,
+ 0x1e0a, 0x1e0a,
+ 0x1e0c, 0x1e0c,
+ 0x1e0e, 0x1e0e,
+ 0x1e10, 0x1e10,
+ 0x1e12, 0x1e12,
+ 0x1e14, 0x1e14,
+ 0x1e16, 0x1e16,
+ 0x1e18, 0x1e18,
+ 0x1e1a, 0x1e1a,
+ 0x1e1c, 0x1e1c,
+ 0x1e1e, 0x1e1e,
+ 0x1e20, 0x1e20,
+ 0x1e22, 0x1e22,
+ 0x1e24, 0x1e24,
+ 0x1e26, 0x1e26,
+ 0x1e28, 0x1e28,
+ 0x1e2a, 0x1e2a,
+ 0x1e2c, 0x1e2c,
+ 0x1e2e, 0x1e2e,
+ 0x1e30, 0x1e30,
+ 0x1e32, 0x1e32,
+ 0x1e34, 0x1e34,
+ 0x1e36, 0x1e36,
+ 0x1e38, 0x1e38,
+ 0x1e3a, 0x1e3a,
+ 0x1e3c, 0x1e3c,
+ 0x1e3e, 0x1e3e,
+ 0x1e40, 0x1e40,
+ 0x1e42, 0x1e42,
+ 0x1e44, 0x1e44,
+ 0x1e46, 0x1e46,
+ 0x1e48, 0x1e48,
+ 0x1e4a, 0x1e4a,
+ 0x1e4c, 0x1e4c,
+ 0x1e4e, 0x1e4e,
+ 0x1e50, 0x1e50,
+ 0x1e52, 0x1e52,
+ 0x1e54, 0x1e54,
+ 0x1e56, 0x1e56,
+ 0x1e58, 0x1e58,
+ 0x1e5a, 0x1e5a,
+ 0x1e5c, 0x1e5c,
+ 0x1e5e, 0x1e5e,
+ 0x1e60, 0x1e60,
+ 0x1e62, 0x1e62,
+ 0x1e64, 0x1e64,
+ 0x1e66, 0x1e66,
+ 0x1e68, 0x1e68,
+ 0x1e6a, 0x1e6a,
+ 0x1e6c, 0x1e6c,
+ 0x1e6e, 0x1e6e,
+ 0x1e70, 0x1e70,
+ 0x1e72, 0x1e72,
+ 0x1e74, 0x1e74,
+ 0x1e76, 0x1e76,
+ 0x1e78, 0x1e78,
+ 0x1e7a, 0x1e7a,
+ 0x1e7c, 0x1e7c,
+ 0x1e7e, 0x1e7e,
+ 0x1e80, 0x1e80,
+ 0x1e82, 0x1e82,
+ 0x1e84, 0x1e84,
+ 0x1e86, 0x1e86,
+ 0x1e88, 0x1e88,
+ 0x1e8a, 0x1e8a,
+ 0x1e8c, 0x1e8c,
+ 0x1e8e, 0x1e8e,
+ 0x1e90, 0x1e90,
+ 0x1e92, 0x1e92,
+ 0x1e94, 0x1e94,
+ 0x1e9e, 0x1e9e,
+ 0x1ea0, 0x1ea0,
+ 0x1ea2, 0x1ea2,
+ 0x1ea4, 0x1ea4,
+ 0x1ea6, 0x1ea6,
+ 0x1ea8, 0x1ea8,
+ 0x1eaa, 0x1eaa,
+ 0x1eac, 0x1eac,
+ 0x1eae, 0x1eae,
+ 0x1eb0, 0x1eb0,
+ 0x1eb2, 0x1eb2,
+ 0x1eb4, 0x1eb4,
+ 0x1eb6, 0x1eb6,
+ 0x1eb8, 0x1eb8,
+ 0x1eba, 0x1eba,
+ 0x1ebc, 0x1ebc,
+ 0x1ebe, 0x1ebe,
+ 0x1ec0, 0x1ec0,
+ 0x1ec2, 0x1ec2,
+ 0x1ec4, 0x1ec4,
+ 0x1ec6, 0x1ec6,
+ 0x1ec8, 0x1ec8,
+ 0x1eca, 0x1eca,
+ 0x1ecc, 0x1ecc,
+ 0x1ece, 0x1ece,
+ 0x1ed0, 0x1ed0,
+ 0x1ed2, 0x1ed2,
+ 0x1ed4, 0x1ed4,
+ 0x1ed6, 0x1ed6,
+ 0x1ed8, 0x1ed8,
+ 0x1eda, 0x1eda,
+ 0x1edc, 0x1edc,
+ 0x1ede, 0x1ede,
+ 0x1ee0, 0x1ee0,
+ 0x1ee2, 0x1ee2,
+ 0x1ee4, 0x1ee4,
+ 0x1ee6, 0x1ee6,
+ 0x1ee8, 0x1ee8,
+ 0x1eea, 0x1eea,
+ 0x1eec, 0x1eec,
+ 0x1eee, 0x1eee,
+ 0x1ef0, 0x1ef0,
+ 0x1ef2, 0x1ef2,
+ 0x1ef4, 0x1ef4,
+ 0x1ef6, 0x1ef6,
+ 0x1ef8, 0x1ef8,
+ 0x1efa, 0x1efa,
+ 0x1efc, 0x1efc,
+ 0x1efe, 0x1efe,
+ 0x1f08, 0x1f0f,
+ 0x1f18, 0x1f1d,
+ 0x1f28, 0x1f2f,
+ 0x1f38, 0x1f3f,
+ 0x1f48, 0x1f4d,
+ 0x1f59, 0x1f59,
+ 0x1f5b, 0x1f5b,
+ 0x1f5d, 0x1f5d,
+ 0x1f5f, 0x1f5f,
+ 0x1f68, 0x1f6f,
+ 0x1fb8, 0x1fbb,
+ 0x1fc8, 0x1fcb,
+ 0x1fd8, 0x1fdb,
+ 0x1fe8, 0x1fec,
+ 0x1ff8, 0x1ffb,
+ 0x2102, 0x2102,
+ 0x2107, 0x2107,
+ 0x210b, 0x210d,
+ 0x2110, 0x2112,
+ 0x2115, 0x2115,
+ 0x2119, 0x211d,
+ 0x2124, 0x2124,
+ 0x2126, 0x2126,
+ 0x2128, 0x2128,
+ 0x212a, 0x212d,
+ 0x2130, 0x2133,
+ 0x213e, 0x213f,
+ 0x2145, 0x2145,
+ 0x2160, 0x216f,
+ 0x2183, 0x2183,
+ 0x24b6, 0x24cf,
+ 0x2c00, 0x2c2e,
+ 0x2c60, 0x2c60,
+ 0x2c62, 0x2c64,
+ 0x2c67, 0x2c67,
+ 0x2c69, 0x2c69,
+ 0x2c6b, 0x2c6b,
+ 0x2c6d, 0x2c70,
+ 0x2c72, 0x2c72,
+ 0x2c75, 0x2c75,
+ 0x2c7e, 0x2c80,
+ 0x2c82, 0x2c82,
+ 0x2c84, 0x2c84,
+ 0x2c86, 0x2c86,
+ 0x2c88, 0x2c88,
+ 0x2c8a, 0x2c8a,
+ 0x2c8c, 0x2c8c,
+ 0x2c8e, 0x2c8e,
+ 0x2c90, 0x2c90,
+ 0x2c92, 0x2c92,
+ 0x2c94, 0x2c94,
+ 0x2c96, 0x2c96,
+ 0x2c98, 0x2c98,
+ 0x2c9a, 0x2c9a,
+ 0x2c9c, 0x2c9c,
+ 0x2c9e, 0x2c9e,
+ 0x2ca0, 0x2ca0,
+ 0x2ca2, 0x2ca2,
+ 0x2ca4, 0x2ca4,
+ 0x2ca6, 0x2ca6,
+ 0x2ca8, 0x2ca8,
+ 0x2caa, 0x2caa,
+ 0x2cac, 0x2cac,
+ 0x2cae, 0x2cae,
+ 0x2cb0, 0x2cb0,
+ 0x2cb2, 0x2cb2,
+ 0x2cb4, 0x2cb4,
+ 0x2cb6, 0x2cb6,
+ 0x2cb8, 0x2cb8,
+ 0x2cba, 0x2cba,
+ 0x2cbc, 0x2cbc,
+ 0x2cbe, 0x2cbe,
+ 0x2cc0, 0x2cc0,
+ 0x2cc2, 0x2cc2,
+ 0x2cc4, 0x2cc4,
+ 0x2cc6, 0x2cc6,
+ 0x2cc8, 0x2cc8,
+ 0x2cca, 0x2cca,
+ 0x2ccc, 0x2ccc,
+ 0x2cce, 0x2cce,
+ 0x2cd0, 0x2cd0,
+ 0x2cd2, 0x2cd2,
+ 0x2cd4, 0x2cd4,
+ 0x2cd6, 0x2cd6,
+ 0x2cd8, 0x2cd8,
+ 0x2cda, 0x2cda,
+ 0x2cdc, 0x2cdc,
+ 0x2cde, 0x2cde,
+ 0x2ce0, 0x2ce0,
+ 0x2ce2, 0x2ce2,
+ 0x2ceb, 0x2ceb,
+ 0x2ced, 0x2ced,
+ 0x2cf2, 0x2cf2,
+ 0xa640, 0xa640,
+ 0xa642, 0xa642,
+ 0xa644, 0xa644,
+ 0xa646, 0xa646,
+ 0xa648, 0xa648,
+ 0xa64a, 0xa64a,
+ 0xa64c, 0xa64c,
+ 0xa64e, 0xa64e,
+ 0xa650, 0xa650,
+ 0xa652, 0xa652,
+ 0xa654, 0xa654,
+ 0xa656, 0xa656,
+ 0xa658, 0xa658,
+ 0xa65a, 0xa65a,
+ 0xa65c, 0xa65c,
+ 0xa65e, 0xa65e,
+ 0xa660, 0xa660,
+ 0xa662, 0xa662,
+ 0xa664, 0xa664,
+ 0xa666, 0xa666,
+ 0xa668, 0xa668,
+ 0xa66a, 0xa66a,
+ 0xa66c, 0xa66c,
+ 0xa680, 0xa680,
+ 0xa682, 0xa682,
+ 0xa684, 0xa684,
+ 0xa686, 0xa686,
+ 0xa688, 0xa688,
+ 0xa68a, 0xa68a,
+ 0xa68c, 0xa68c,
+ 0xa68e, 0xa68e,
+ 0xa690, 0xa690,
+ 0xa692, 0xa692,
+ 0xa694, 0xa694,
+ 0xa696, 0xa696,
+ 0xa722, 0xa722,
+ 0xa724, 0xa724,
+ 0xa726, 0xa726,
+ 0xa728, 0xa728,
+ 0xa72a, 0xa72a,
+ 0xa72c, 0xa72c,
+ 0xa72e, 0xa72e,
+ 0xa732, 0xa732,
+ 0xa734, 0xa734,
+ 0xa736, 0xa736,
+ 0xa738, 0xa738,
+ 0xa73a, 0xa73a,
+ 0xa73c, 0xa73c,
+ 0xa73e, 0xa73e,
+ 0xa740, 0xa740,
+ 0xa742, 0xa742,
+ 0xa744, 0xa744,
+ 0xa746, 0xa746,
+ 0xa748, 0xa748,
+ 0xa74a, 0xa74a,
+ 0xa74c, 0xa74c,
+ 0xa74e, 0xa74e,
+ 0xa750, 0xa750,
+ 0xa752, 0xa752,
+ 0xa754, 0xa754,
+ 0xa756, 0xa756,
+ 0xa758, 0xa758,
+ 0xa75a, 0xa75a,
+ 0xa75c, 0xa75c,
+ 0xa75e, 0xa75e,
+ 0xa760, 0xa760,
+ 0xa762, 0xa762,
+ 0xa764, 0xa764,
+ 0xa766, 0xa766,
+ 0xa768, 0xa768,
+ 0xa76a, 0xa76a,
+ 0xa76c, 0xa76c,
+ 0xa76e, 0xa76e,
+ 0xa779, 0xa779,
+ 0xa77b, 0xa77b,
+ 0xa77d, 0xa77e,
+ 0xa780, 0xa780,
+ 0xa782, 0xa782,
+ 0xa784, 0xa784,
+ 0xa786, 0xa786,
+ 0xa78b, 0xa78b,
+ 0xa78d, 0xa78d,
+ 0xa790, 0xa790,
+ 0xa792, 0xa792,
+ 0xa7a0, 0xa7a0,
+ 0xa7a2, 0xa7a2,
+ 0xa7a4, 0xa7a4,
+ 0xa7a6, 0xa7a6,
+ 0xa7a8, 0xa7a8,
+ 0xa7aa, 0xa7aa,
+ 0xff21, 0xff3a,
+ 0x10400, 0x10427,
+ 0x1d400, 0x1d419,
+ 0x1d434, 0x1d44d,
+ 0x1d468, 0x1d481,
+ 0x1d49c, 0x1d49c,
+ 0x1d49e, 0x1d49f,
+ 0x1d4a2, 0x1d4a2,
+ 0x1d4a5, 0x1d4a6,
+ 0x1d4a9, 0x1d4ac,
+ 0x1d4ae, 0x1d4b5,
+ 0x1d4d0, 0x1d4e9,
+ 0x1d504, 0x1d505,
+ 0x1d507, 0x1d50a,
+ 0x1d50d, 0x1d514,
+ 0x1d516, 0x1d51c,
+ 0x1d538, 0x1d539,
+ 0x1d53b, 0x1d53e,
+ 0x1d540, 0x1d544,
+ 0x1d546, 0x1d546,
+ 0x1d54a, 0x1d550,
+ 0x1d56c, 0x1d585,
+ 0x1d5a0, 0x1d5b9,
+ 0x1d5d4, 0x1d5ed,
+ 0x1d608, 0x1d621,
+ 0x1d63c, 0x1d655,
+ 0x1d670, 0x1d689,
+ 0x1d6a8, 0x1d6c0,
+ 0x1d6e2, 0x1d6fa,
+ 0x1d71c, 0x1d734,
+ 0x1d756, 0x1d76e,
+ 0x1d790, 0x1d7a8,
+ 0x1d7ca, 0x1d7ca,
+}; /* CR_Upper */
+
+/* 'XDigit': [[:XDigit:]] */
+static const OnigCodePoint CR_XDigit[] = {
+ 3,
+ 0x0030, 0x0039,
+ 0x0041, 0x0046,
+ 0x0061, 0x0066,
+}; /* CR_XDigit */
+
+/* 'Word': [[:Word:]] */
+static const OnigCodePoint CR_Word[] = {
+ 564,
+ 0x0030, 0x0039,
+ 0x0041, 0x005a,
+ 0x005f, 0x005f,
+ 0x0061, 0x007a,
+ 0x00aa, 0x00aa,
+ 0x00b5, 0x00b5,
+ 0x00ba, 0x00ba,
+ 0x00c0, 0x00d6,
+ 0x00d8, 0x00f6,
+ 0x00f8, 0x02c1,
+ 0x02c6, 0x02d1,
+ 0x02e0, 0x02e4,
+ 0x02ec, 0x02ec,
+ 0x02ee, 0x02ee,
+ 0x0300, 0x0374,
+ 0x0376, 0x0377,
+ 0x037a, 0x037d,
+ 0x0386, 0x0386,
+ 0x0388, 0x038a,
+ 0x038c, 0x038c,
+ 0x038e, 0x03a1,
+ 0x03a3, 0x03f5,
+ 0x03f7, 0x0481,
+ 0x0483, 0x0527,
+ 0x0531, 0x0556,
+ 0x0559, 0x0559,
+ 0x0561, 0x0587,
+ 0x0591, 0x05bd,
+ 0x05bf, 0x05bf,
+ 0x05c1, 0x05c2,
+ 0x05c4, 0x05c5,
+ 0x05c7, 0x05c7,
+ 0x05d0, 0x05ea,
+ 0x05f0, 0x05f2,
+ 0x0610, 0x061a,
+ 0x0620, 0x0669,
+ 0x066e, 0x06d3,
+ 0x06d5, 0x06dc,
+ 0x06df, 0x06e8,
+ 0x06ea, 0x06fc,
+ 0x06ff, 0x06ff,
+ 0x0710, 0x074a,
+ 0x074d, 0x07b1,
+ 0x07c0, 0x07f5,
+ 0x07fa, 0x07fa,
+ 0x0800, 0x082d,
+ 0x0840, 0x085b,
+ 0x08a0, 0x08a0,
+ 0x08a2, 0x08ac,
+ 0x08e4, 0x08fe,
+ 0x0900, 0x0963,
+ 0x0966, 0x096f,
+ 0x0971, 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, 0x09f1,
+ 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, 0x0aef,
+ 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, 0x0b6f,
+ 0x0b71, 0x0b71,
+ 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, 0x0bef,
+ 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,
+ 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, 0x0d6f,
+ 0x0d7a, 0x0d7f,
+ 0x0d82, 0x0d83,
+ 0x0d85, 0x0d96,
+ 0x0d9a, 0x0db1,
+ 0x0db3, 0x0dbb,
+ 0x0dbd, 0x0dbd,
+ 0x0dc0, 0x0dc6,
+ 0x0dca, 0x0dca,
+ 0x0dcf, 0x0dd4,
+ 0x0dd6, 0x0dd6,
+ 0x0dd8, 0x0ddf,
+ 0x0df2, 0x0df3,
+ 0x0e01, 0x0e3a,
+ 0x0e40, 0x0e4e,
+ 0x0e50, 0x0e59,
+ 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, 0x0f00,
+ 0x0f18, 0x0f19,
+ 0x0f20, 0x0f29,
+ 0x0f35, 0x0f35,
+ 0x0f37, 0x0f37,
+ 0x0f39, 0x0f39,
+ 0x0f3e, 0x0f47,
+ 0x0f49, 0x0f6c,
+ 0x0f71, 0x0f84,
+ 0x0f86, 0x0f97,
+ 0x0f99, 0x0fbc,
+ 0x0fc6, 0x0fc6,
+ 0x1000, 0x1049,
+ 0x1050, 0x109d,
+ 0x10a0, 0x10c5,
+ 0x10c7, 0x10c7,
+ 0x10cd, 0x10cd,
+ 0x10d0, 0x10fa,
+ 0x10fc, 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, 0x135f,
+ 0x1380, 0x138f,
+ 0x13a0, 0x13f4,
+ 0x1401, 0x166c,
+ 0x166f, 0x167f,
+ 0x1681, 0x169a,
+ 0x16a0, 0x16ea,
+ 0x16ee, 0x16f0,
+ 0x1700, 0x170c,
+ 0x170e, 0x1714,
+ 0x1720, 0x1734,
+ 0x1740, 0x1753,
+ 0x1760, 0x176c,
+ 0x176e, 0x1770,
+ 0x1772, 0x1773,
+ 0x1780, 0x17d3,
+ 0x17d7, 0x17d7,
+ 0x17dc, 0x17dd,
+ 0x17e0, 0x17e9,
+ 0x180b, 0x180d,
+ 0x1810, 0x1819,
+ 0x1820, 0x1877,
+ 0x1880, 0x18aa,
+ 0x18b0, 0x18f5,
+ 0x1900, 0x191c,
+ 0x1920, 0x192b,
+ 0x1930, 0x193b,
+ 0x1946, 0x196d,
+ 0x1970, 0x1974,
+ 0x1980, 0x19ab,
+ 0x19b0, 0x19c9,
+ 0x19d0, 0x19d9,
+ 0x1a00, 0x1a1b,
+ 0x1a20, 0x1a5e,
+ 0x1a60, 0x1a7c,
+ 0x1a7f, 0x1a89,
+ 0x1a90, 0x1a99,
+ 0x1aa7, 0x1aa7,
+ 0x1b00, 0x1b4b,
+ 0x1b50, 0x1b59,
+ 0x1b6b, 0x1b73,
+ 0x1b80, 0x1bf3,
+ 0x1c00, 0x1c37,
+ 0x1c40, 0x1c49,
+ 0x1c4d, 0x1c7d,
+ 0x1cd0, 0x1cd2,
+ 0x1cd4, 0x1cf6,
+ 0x1d00, 0x1de6,
+ 0x1dfc, 0x1f15,
+ 0x1f18, 0x1f1d,
+ 0x1f20, 0x1f45,
+ 0x1f48, 0x1f4d,
+ 0x1f50, 0x1f57,
+ 0x1f59, 0x1f59,
+ 0x1f5b, 0x1f5b,
+ 0x1f5d, 0x1f5d,
+ 0x1f5f, 0x1f7d,
+ 0x1f80, 0x1fb4,
+ 0x1fb6, 0x1fbc,
+ 0x1fbe, 0x1fbe,
+ 0x1fc2, 0x1fc4,
+ 0x1fc6, 0x1fcc,
+ 0x1fd0, 0x1fd3,
+ 0x1fd6, 0x1fdb,
+ 0x1fe0, 0x1fec,
+ 0x1ff2, 0x1ff4,
+ 0x1ff6, 0x1ffc,
+ 0x203f, 0x2040,
+ 0x2054, 0x2054,
+ 0x2071, 0x2071,
+ 0x207f, 0x207f,
+ 0x2090, 0x209c,
+ 0x20d0, 0x20f0,
+ 0x2102, 0x2102,
+ 0x2107, 0x2107,
+ 0x210a, 0x2113,
+ 0x2115, 0x2115,
+ 0x2119, 0x211d,
+ 0x2124, 0x2124,
+ 0x2126, 0x2126,
+ 0x2128, 0x2128,
+ 0x212a, 0x212d,
+ 0x212f, 0x2139,
+ 0x213c, 0x213f,
+ 0x2145, 0x2149,
+ 0x214e, 0x214e,
+ 0x2160, 0x2188,
+ 0x24b6, 0x24e9,
+ 0x2c00, 0x2c2e,
+ 0x2c30, 0x2c5e,
+ 0x2c60, 0x2ce4,
+ 0x2ceb, 0x2cf3,
+ 0x2d00, 0x2d25,
+ 0x2d27, 0x2d27,
+ 0x2d2d, 0x2d2d,
+ 0x2d30, 0x2d67,
+ 0x2d6f, 0x2d6f,
+ 0x2d7f, 0x2d96,
+ 0x2da0, 0x2da6,
+ 0x2da8, 0x2dae,
+ 0x2db0, 0x2db6,
+ 0x2db8, 0x2dbe,
+ 0x2dc0, 0x2dc6,
+ 0x2dc8, 0x2dce,
+ 0x2dd0, 0x2dd6,
+ 0x2dd8, 0x2dde,
+ 0x2de0, 0x2dff,
+ 0x2e2f, 0x2e2f,
+ 0x3005, 0x3007,
+ 0x3021, 0x302f,
+ 0x3031, 0x3035,
+ 0x3038, 0x303c,
+ 0x3041, 0x3096,
+ 0x3099, 0x309a,
+ 0x309d, 0x309f,
+ 0x30a1, 0x30fa,
+ 0x30fc, 0x30ff,
+ 0x3105, 0x312d,
+ 0x3131, 0x318e,
+ 0x31a0, 0x31ba,
+ 0x31f0, 0x31ff,
+ 0x3400, 0x4db5,
+ 0x4e00, 0x9fcc,
+ 0xa000, 0xa48c,
+ 0xa4d0, 0xa4fd,
+ 0xa500, 0xa60c,
+ 0xa610, 0xa62b,
+ 0xa640, 0xa672,
+ 0xa674, 0xa67d,
+ 0xa67f, 0xa697,
+ 0xa69f, 0xa6f1,
+ 0xa717, 0xa71f,
+ 0xa722, 0xa788,
+ 0xa78b, 0xa78e,
+ 0xa790, 0xa793,
+ 0xa7a0, 0xa7aa,
+ 0xa7f8, 0xa827,
+ 0xa840, 0xa873,
+ 0xa880, 0xa8c4,
+ 0xa8d0, 0xa8d9,
+ 0xa8e0, 0xa8f7,
+ 0xa8fb, 0xa8fb,
+ 0xa900, 0xa92d,
+ 0xa930, 0xa953,
+ 0xa960, 0xa97c,
+ 0xa980, 0xa9c0,
+ 0xa9cf, 0xa9d9,
+ 0xaa00, 0xaa36,
+ 0xaa40, 0xaa4d,
+ 0xaa50, 0xaa59,
+ 0xaa60, 0xaa76,
+ 0xaa7a, 0xaa7b,
+ 0xaa80, 0xaac2,
+ 0xaadb, 0xaadd,
+ 0xaae0, 0xaaef,
+ 0xaaf2, 0xaaf6,
+ 0xab01, 0xab06,
+ 0xab09, 0xab0e,
+ 0xab11, 0xab16,
+ 0xab20, 0xab26,
+ 0xab28, 0xab2e,
+ 0xabc0, 0xabea,
+ 0xabec, 0xabed,
+ 0xabf0, 0xabf9,
+ 0xac00, 0xd7a3,
+ 0xd7b0, 0xd7c6,
+ 0xd7cb, 0xd7fb,
+ 0xf900, 0xfa6d,
+ 0xfa70, 0xfad9,
+ 0xfb00, 0xfb06,
+ 0xfb13, 0xfb17,
+ 0xfb1d, 0xfb28,
+ 0xfb2a, 0xfb36,
+ 0xfb38, 0xfb3c,
+ 0xfb3e, 0xfb3e,
+ 0xfb40, 0xfb41,
+ 0xfb43, 0xfb44,
+ 0xfb46, 0xfbb1,
+ 0xfbd3, 0xfd3d,
+ 0xfd50, 0xfd8f,
+ 0xfd92, 0xfdc7,
+ 0xfdf0, 0xfdfb,
+ 0xfe00, 0xfe0f,
+ 0xfe20, 0xfe26,
+ 0xfe33, 0xfe34,
+ 0xfe4d, 0xfe4f,
+ 0xfe70, 0xfe74,
+ 0xfe76, 0xfefc,
+ 0xff10, 0xff19,
+ 0xff21, 0xff3a,
+ 0xff3f, 0xff3f,
+ 0xff41, 0xff5a,
+ 0xff66, 0xffbe,
+ 0xffc2, 0xffc7,
+ 0xffca, 0xffcf,
+ 0xffd2, 0xffd7,
+ 0xffda, 0xffdc,
+ 0x10000, 0x1000b,
+ 0x1000d, 0x10026,
+ 0x10028, 0x1003a,
+ 0x1003c, 0x1003d,
+ 0x1003f, 0x1004d,
+ 0x10050, 0x1005d,
+ 0x10080, 0x100fa,
+ 0x10140, 0x10174,
+ 0x101fd, 0x101fd,
+ 0x10280, 0x1029c,
+ 0x102a0, 0x102d0,
+ 0x10300, 0x1031e,
+ 0x10330, 0x1034a,
+ 0x10380, 0x1039d,
+ 0x103a0, 0x103c3,
+ 0x103c8, 0x103cf,
+ 0x103d1, 0x103d5,
+ 0x10400, 0x1049d,
+ 0x104a0, 0x104a9,
+ 0x10800, 0x10805,
+ 0x10808, 0x10808,
+ 0x1080a, 0x10835,
+ 0x10837, 0x10838,
+ 0x1083c, 0x1083c,
+ 0x1083f, 0x10855,
+ 0x10900, 0x10915,
+ 0x10920, 0x10939,
+ 0x10980, 0x109b7,
+ 0x109be, 0x109bf,
+ 0x10a00, 0x10a03,
+ 0x10a05, 0x10a06,
+ 0x10a0c, 0x10a13,
+ 0x10a15, 0x10a17,
+ 0x10a19, 0x10a33,
+ 0x10a38, 0x10a3a,
+ 0x10a3f, 0x10a3f,
+ 0x10a60, 0x10a7c,
+ 0x10b00, 0x10b35,
+ 0x10b40, 0x10b55,
+ 0x10b60, 0x10b72,
+ 0x10c00, 0x10c48,
+ 0x11000, 0x11046,
+ 0x11066, 0x1106f,
+ 0x11080, 0x110ba,
+ 0x110d0, 0x110e8,
+ 0x110f0, 0x110f9,
+ 0x11100, 0x11134,
+ 0x11136, 0x1113f,
+ 0x11180, 0x111c4,
+ 0x111d0, 0x111d9,
+ 0x11680, 0x116b7,
+ 0x116c0, 0x116c9,
+ 0x12000, 0x1236e,
+ 0x12400, 0x12462,
+ 0x13000, 0x1342e,
+ 0x16800, 0x16a38,
+ 0x16f00, 0x16f44,
+ 0x16f50, 0x16f7e,
+ 0x16f8f, 0x16f9f,
+ 0x1b000, 0x1b001,
+ 0x1d165, 0x1d169,
+ 0x1d16d, 0x1d172,
+ 0x1d17b, 0x1d182,
+ 0x1d185, 0x1d18b,
+ 0x1d1aa, 0x1d1ad,
+ 0x1d242, 0x1d244,
+ 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, 0x1d6c0,
+ 0x1d6c2, 0x1d6da,
+ 0x1d6dc, 0x1d6fa,
+ 0x1d6fc, 0x1d714,
+ 0x1d716, 0x1d734,
+ 0x1d736, 0x1d74e,
+ 0x1d750, 0x1d76e,
+ 0x1d770, 0x1d788,
+ 0x1d78a, 0x1d7a8,
+ 0x1d7aa, 0x1d7c2,
+ 0x1d7c4, 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,
+ 0x20000, 0x2a6d6,
+ 0x2a700, 0x2b734,
+ 0x2b740, 0x2b81d,
+ 0x2f800, 0x2fa1d,
+ 0xe0100, 0xe01ef,
+}; /* CR_Word */
+
+/* 'Alnum': [[:Alnum:]] */
+static const OnigCodePoint CR_Alnum[] = {
+ 566,
+ 0x0030, 0x0039,
+ 0x0041, 0x005a,
+ 0x0061, 0x007a,
+ 0x00aa, 0x00aa,
+ 0x00b5, 0x00b5,
+ 0x00ba, 0x00ba,
+ 0x00c0, 0x00d6,
+ 0x00d8, 0x00f6,
+ 0x00f8, 0x02c1,
+ 0x02c6, 0x02d1,
+ 0x02e0, 0x02e4,
+ 0x02ec, 0x02ec,
+ 0x02ee, 0x02ee,
+ 0x0345, 0x0345,
+ 0x0370, 0x0374,
+ 0x0376, 0x0377,
+ 0x037a, 0x037d,
+ 0x0386, 0x0386,
+ 0x0388, 0x038a,
+ 0x038c, 0x038c,
+ 0x038e, 0x03a1,
+ 0x03a3, 0x03f5,
+ 0x03f7, 0x0481,
+ 0x048a, 0x0527,
+ 0x0531, 0x0556,
+ 0x0559, 0x0559,
+ 0x0561, 0x0587,
+ 0x05b0, 0x05bd,
+ 0x05bf, 0x05bf,
+ 0x05c1, 0x05c2,
+ 0x05c4, 0x05c5,
+ 0x05c7, 0x05c7,
+ 0x05d0, 0x05ea,
+ 0x05f0, 0x05f2,
+ 0x0610, 0x061a,
+ 0x0620, 0x0657,
+ 0x0659, 0x0669,
+ 0x066e, 0x06d3,
+ 0x06d5, 0x06dc,
+ 0x06e1, 0x06e8,
+ 0x06ed, 0x06fc,
+ 0x06ff, 0x06ff,
+ 0x0710, 0x073f,
+ 0x074d, 0x07b1,
+ 0x07c0, 0x07ea,
+ 0x07f4, 0x07f5,
+ 0x07fa, 0x07fa,
+ 0x0800, 0x0817,
+ 0x081a, 0x082c,
+ 0x0840, 0x0858,
+ 0x08a0, 0x08a0,
+ 0x08a2, 0x08ac,
+ 0x08e4, 0x08e9,
+ 0x08f0, 0x08fe,
+ 0x0900, 0x093b,
+ 0x093d, 0x094c,
+ 0x094e, 0x0950,
+ 0x0955, 0x0963,
+ 0x0966, 0x096f,
+ 0x0971, 0x0977,
+ 0x0979, 0x097f,
+ 0x0981, 0x0983,
+ 0x0985, 0x098c,
+ 0x098f, 0x0990,
+ 0x0993, 0x09a8,
+ 0x09aa, 0x09b0,
+ 0x09b2, 0x09b2,
+ 0x09b6, 0x09b9,
+ 0x09bd, 0x09c4,
+ 0x09c7, 0x09c8,
+ 0x09cb, 0x09cc,
+ 0x09ce, 0x09ce,
+ 0x09d7, 0x09d7,
+ 0x09dc, 0x09dd,
+ 0x09df, 0x09e3,
+ 0x09e6, 0x09f1,
+ 0x0a01, 0x0a03,
+ 0x0a05, 0x0a0a,
+ 0x0a0f, 0x0a10,
+ 0x0a13, 0x0a28,
+ 0x0a2a, 0x0a30,
+ 0x0a32, 0x0a33,
+ 0x0a35, 0x0a36,
+ 0x0a38, 0x0a39,
+ 0x0a3e, 0x0a42,
+ 0x0a47, 0x0a48,
+ 0x0a4b, 0x0a4c,
+ 0x0a51, 0x0a51,
+ 0x0a59, 0x0a5c,
+ 0x0a5e, 0x0a5e,
+ 0x0a66, 0x0a75,
+ 0x0a81, 0x0a83,
+ 0x0a85, 0x0a8d,
+ 0x0a8f, 0x0a91,
+ 0x0a93, 0x0aa8,
+ 0x0aaa, 0x0ab0,
+ 0x0ab2, 0x0ab3,
+ 0x0ab5, 0x0ab9,
+ 0x0abd, 0x0ac5,
+ 0x0ac7, 0x0ac9,
+ 0x0acb, 0x0acc,
+ 0x0ad0, 0x0ad0,
+ 0x0ae0, 0x0ae3,
+ 0x0ae6, 0x0aef,
+ 0x0b01, 0x0b03,
+ 0x0b05, 0x0b0c,
+ 0x0b0f, 0x0b10,
+ 0x0b13, 0x0b28,
+ 0x0b2a, 0x0b30,
+ 0x0b32, 0x0b33,
+ 0x0b35, 0x0b39,
+ 0x0b3d, 0x0b44,
+ 0x0b47, 0x0b48,
+ 0x0b4b, 0x0b4c,
+ 0x0b56, 0x0b57,
+ 0x0b5c, 0x0b5d,
+ 0x0b5f, 0x0b63,
+ 0x0b66, 0x0b6f,
+ 0x0b71, 0x0b71,
+ 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, 0x0bcc,
+ 0x0bd0, 0x0bd0,
+ 0x0bd7, 0x0bd7,
+ 0x0be6, 0x0bef,
+ 0x0c01, 0x0c03,
+ 0x0c05, 0x0c0c,
+ 0x0c0e, 0x0c10,
+ 0x0c12, 0x0c28,
+ 0x0c2a, 0x0c33,
+ 0x0c35, 0x0c39,
+ 0x0c3d, 0x0c44,
+ 0x0c46, 0x0c48,
+ 0x0c4a, 0x0c4c,
+ 0x0c55, 0x0c56,
+ 0x0c58, 0x0c59,
+ 0x0c60, 0x0c63,
+ 0x0c66, 0x0c6f,
+ 0x0c82, 0x0c83,
+ 0x0c85, 0x0c8c,
+ 0x0c8e, 0x0c90,
+ 0x0c92, 0x0ca8,
+ 0x0caa, 0x0cb3,
+ 0x0cb5, 0x0cb9,
+ 0x0cbd, 0x0cc4,
+ 0x0cc6, 0x0cc8,
+ 0x0cca, 0x0ccc,
+ 0x0cd5, 0x0cd6,
+ 0x0cde, 0x0cde,
+ 0x0ce0, 0x0ce3,
+ 0x0ce6, 0x0cef,
+ 0x0cf1, 0x0cf2,
+ 0x0d02, 0x0d03,
+ 0x0d05, 0x0d0c,
+ 0x0d0e, 0x0d10,
+ 0x0d12, 0x0d3a,
+ 0x0d3d, 0x0d44,
+ 0x0d46, 0x0d48,
+ 0x0d4a, 0x0d4c,
+ 0x0d4e, 0x0d4e,
+ 0x0d57, 0x0d57,
+ 0x0d60, 0x0d63,
+ 0x0d66, 0x0d6f,
+ 0x0d7a, 0x0d7f,
+ 0x0d82, 0x0d83,
+ 0x0d85, 0x0d96,
+ 0x0d9a, 0x0db1,
+ 0x0db3, 0x0dbb,
+ 0x0dbd, 0x0dbd,
+ 0x0dc0, 0x0dc6,
+ 0x0dcf, 0x0dd4,
+ 0x0dd6, 0x0dd6,
+ 0x0dd8, 0x0ddf,
+ 0x0df2, 0x0df3,
+ 0x0e01, 0x0e3a,
+ 0x0e40, 0x0e46,
+ 0x0e4d, 0x0e4d,
+ 0x0e50, 0x0e59,
+ 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,
+ 0x0ecd, 0x0ecd,
+ 0x0ed0, 0x0ed9,
+ 0x0edc, 0x0edf,
+ 0x0f00, 0x0f00,
+ 0x0f20, 0x0f29,
+ 0x0f40, 0x0f47,
+ 0x0f49, 0x0f6c,
+ 0x0f71, 0x0f81,
+ 0x0f88, 0x0f97,
+ 0x0f99, 0x0fbc,
+ 0x1000, 0x1036,
+ 0x1038, 0x1038,
+ 0x103b, 0x1049,
+ 0x1050, 0x1062,
+ 0x1065, 0x1068,
+ 0x106e, 0x1086,
+ 0x108e, 0x108e,
+ 0x1090, 0x1099,
+ 0x109c, 0x109d,
+ 0x10a0, 0x10c5,
+ 0x10c7, 0x10c7,
+ 0x10cd, 0x10cd,
+ 0x10d0, 0x10fa,
+ 0x10fc, 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,
+ 0x135f, 0x135f,
+ 0x1380, 0x138f,
+ 0x13a0, 0x13f4,
+ 0x1401, 0x166c,
+ 0x166f, 0x167f,
+ 0x1681, 0x169a,
+ 0x16a0, 0x16ea,
+ 0x16ee, 0x16f0,
+ 0x1700, 0x170c,
+ 0x170e, 0x1713,
+ 0x1720, 0x1733,
+ 0x1740, 0x1753,
+ 0x1760, 0x176c,
+ 0x176e, 0x1770,
+ 0x1772, 0x1773,
+ 0x1780, 0x17b3,
+ 0x17b6, 0x17c8,
+ 0x17d7, 0x17d7,
+ 0x17dc, 0x17dc,
+ 0x17e0, 0x17e9,
+ 0x1810, 0x1819,
+ 0x1820, 0x1877,
+ 0x1880, 0x18aa,
+ 0x18b0, 0x18f5,
+ 0x1900, 0x191c,
+ 0x1920, 0x192b,
+ 0x1930, 0x1938,
+ 0x1946, 0x196d,
+ 0x1970, 0x1974,
+ 0x1980, 0x19ab,
+ 0x19b0, 0x19c9,
+ 0x19d0, 0x19d9,
+ 0x1a00, 0x1a1b,
+ 0x1a20, 0x1a5e,
+ 0x1a61, 0x1a74,
+ 0x1a80, 0x1a89,
+ 0x1a90, 0x1a99,
+ 0x1aa7, 0x1aa7,
+ 0x1b00, 0x1b33,
+ 0x1b35, 0x1b43,
+ 0x1b45, 0x1b4b,
+ 0x1b50, 0x1b59,
+ 0x1b80, 0x1ba9,
+ 0x1bac, 0x1be5,
+ 0x1be7, 0x1bf1,
+ 0x1c00, 0x1c35,
+ 0x1c40, 0x1c49,
+ 0x1c4d, 0x1c7d,
+ 0x1ce9, 0x1cec,
+ 0x1cee, 0x1cf3,
+ 0x1cf5, 0x1cf6,
+ 0x1d00, 0x1dbf,
+ 0x1e00, 0x1f15,
+ 0x1f18, 0x1f1d,
+ 0x1f20, 0x1f45,
+ 0x1f48, 0x1f4d,
+ 0x1f50, 0x1f57,
+ 0x1f59, 0x1f59,
+ 0x1f5b, 0x1f5b,
+ 0x1f5d, 0x1f5d,
+ 0x1f5f, 0x1f7d,
+ 0x1f80, 0x1fb4,
+ 0x1fb6, 0x1fbc,
+ 0x1fbe, 0x1fbe,
+ 0x1fc2, 0x1fc4,
+ 0x1fc6, 0x1fcc,
+ 0x1fd0, 0x1fd3,
+ 0x1fd6, 0x1fdb,
+ 0x1fe0, 0x1fec,
+ 0x1ff2, 0x1ff4,
+ 0x1ff6, 0x1ffc,
+ 0x2071, 0x2071,
+ 0x207f, 0x207f,
+ 0x2090, 0x209c,
+ 0x2102, 0x2102,
+ 0x2107, 0x2107,
+ 0x210a, 0x2113,
+ 0x2115, 0x2115,
+ 0x2119, 0x211d,
+ 0x2124, 0x2124,
+ 0x2126, 0x2126,
+ 0x2128, 0x2128,
+ 0x212a, 0x212d,
+ 0x212f, 0x2139,
+ 0x213c, 0x213f,
+ 0x2145, 0x2149,
+ 0x214e, 0x214e,
+ 0x2160, 0x2188,
+ 0x24b6, 0x24e9,
+ 0x2c00, 0x2c2e,
+ 0x2c30, 0x2c5e,
+ 0x2c60, 0x2ce4,
+ 0x2ceb, 0x2cee,
+ 0x2cf2, 0x2cf3,
+ 0x2d00, 0x2d25,
+ 0x2d27, 0x2d27,
+ 0x2d2d, 0x2d2d,
+ 0x2d30, 0x2d67,
+ 0x2d6f, 0x2d6f,
+ 0x2d80, 0x2d96,
+ 0x2da0, 0x2da6,
+ 0x2da8, 0x2dae,
+ 0x2db0, 0x2db6,
+ 0x2db8, 0x2dbe,
+ 0x2dc0, 0x2dc6,
+ 0x2dc8, 0x2dce,
+ 0x2dd0, 0x2dd6,
+ 0x2dd8, 0x2dde,
+ 0x2de0, 0x2dff,
+ 0x2e2f, 0x2e2f,
+ 0x3005, 0x3007,
+ 0x3021, 0x3029,
+ 0x3031, 0x3035,
+ 0x3038, 0x303c,
+ 0x3041, 0x3096,
+ 0x309d, 0x309f,
+ 0x30a1, 0x30fa,
+ 0x30fc, 0x30ff,
+ 0x3105, 0x312d,
+ 0x3131, 0x318e,
+ 0x31a0, 0x31ba,
+ 0x31f0, 0x31ff,
+ 0x3400, 0x4db5,
+ 0x4e00, 0x9fcc,
+ 0xa000, 0xa48c,
+ 0xa4d0, 0xa4fd,
+ 0xa500, 0xa60c,
+ 0xa610, 0xa62b,
+ 0xa640, 0xa66e,
+ 0xa674, 0xa67b,
+ 0xa67f, 0xa697,
+ 0xa69f, 0xa6ef,
+ 0xa717, 0xa71f,
+ 0xa722, 0xa788,
+ 0xa78b, 0xa78e,
+ 0xa790, 0xa793,
+ 0xa7a0, 0xa7aa,
+ 0xa7f8, 0xa801,
+ 0xa803, 0xa805,
+ 0xa807, 0xa80a,
+ 0xa80c, 0xa827,
+ 0xa840, 0xa873,
+ 0xa880, 0xa8c3,
+ 0xa8d0, 0xa8d9,
+ 0xa8f2, 0xa8f7,
+ 0xa8fb, 0xa8fb,
+ 0xa900, 0xa92a,
+ 0xa930, 0xa952,
+ 0xa960, 0xa97c,
+ 0xa980, 0xa9b2,
+ 0xa9b4, 0xa9bf,
+ 0xa9cf, 0xa9d9,
+ 0xaa00, 0xaa36,
+ 0xaa40, 0xaa4d,
+ 0xaa50, 0xaa59,
+ 0xaa60, 0xaa76,
+ 0xaa7a, 0xaa7a,
+ 0xaa80, 0xaabe,
+ 0xaac0, 0xaac0,
+ 0xaac2, 0xaac2,
+ 0xaadb, 0xaadd,
+ 0xaae0, 0xaaef,
+ 0xaaf2, 0xaaf5,
+ 0xab01, 0xab06,
+ 0xab09, 0xab0e,
+ 0xab11, 0xab16,
+ 0xab20, 0xab26,
+ 0xab28, 0xab2e,
+ 0xabc0, 0xabea,
+ 0xabf0, 0xabf9,
+ 0xac00, 0xd7a3,
+ 0xd7b0, 0xd7c6,
+ 0xd7cb, 0xd7fb,
+ 0xf900, 0xfa6d,
+ 0xfa70, 0xfad9,
+ 0xfb00, 0xfb06,
+ 0xfb13, 0xfb17,
+ 0xfb1d, 0xfb28,
+ 0xfb2a, 0xfb36,
+ 0xfb38, 0xfb3c,
+ 0xfb3e, 0xfb3e,
+ 0xfb40, 0xfb41,
+ 0xfb43, 0xfb44,
+ 0xfb46, 0xfbb1,
+ 0xfbd3, 0xfd3d,
+ 0xfd50, 0xfd8f,
+ 0xfd92, 0xfdc7,
+ 0xfdf0, 0xfdfb,
+ 0xfe70, 0xfe74,
+ 0xfe76, 0xfefc,
+ 0xff10, 0xff19,
+ 0xff21, 0xff3a,
+ 0xff41, 0xff5a,
+ 0xff66, 0xffbe,
+ 0xffc2, 0xffc7,
+ 0xffca, 0xffcf,
+ 0xffd2, 0xffd7,
+ 0xffda, 0xffdc,
+ 0x10000, 0x1000b,
+ 0x1000d, 0x10026,
+ 0x10028, 0x1003a,
+ 0x1003c, 0x1003d,
+ 0x1003f, 0x1004d,
+ 0x10050, 0x1005d,
+ 0x10080, 0x100fa,
+ 0x10140, 0x10174,
+ 0x10280, 0x1029c,
+ 0x102a0, 0x102d0,
+ 0x10300, 0x1031e,
+ 0x10330, 0x1034a,
+ 0x10380, 0x1039d,
+ 0x103a0, 0x103c3,
+ 0x103c8, 0x103cf,
+ 0x103d1, 0x103d5,
+ 0x10400, 0x1049d,
+ 0x104a0, 0x104a9,
+ 0x10800, 0x10805,
+ 0x10808, 0x10808,
+ 0x1080a, 0x10835,
+ 0x10837, 0x10838,
+ 0x1083c, 0x1083c,
+ 0x1083f, 0x10855,
+ 0x10900, 0x10915,
+ 0x10920, 0x10939,
+ 0x10980, 0x109b7,
+ 0x109be, 0x109bf,
+ 0x10a00, 0x10a03,
+ 0x10a05, 0x10a06,
+ 0x10a0c, 0x10a13,
+ 0x10a15, 0x10a17,
+ 0x10a19, 0x10a33,
+ 0x10a60, 0x10a7c,
+ 0x10b00, 0x10b35,
+ 0x10b40, 0x10b55,
+ 0x10b60, 0x10b72,
+ 0x10c00, 0x10c48,
+ 0x11000, 0x11045,
+ 0x11066, 0x1106f,
+ 0x11082, 0x110b8,
+ 0x110d0, 0x110e8,
+ 0x110f0, 0x110f9,
+ 0x11100, 0x11132,
+ 0x11136, 0x1113f,
+ 0x11180, 0x111bf,
+ 0x111c1, 0x111c4,
+ 0x111d0, 0x111d9,
+ 0x11680, 0x116b5,
+ 0x116c0, 0x116c9,
+ 0x12000, 0x1236e,
+ 0x12400, 0x12462,
+ 0x13000, 0x1342e,
+ 0x16800, 0x16a38,
+ 0x16f00, 0x16f44,
+ 0x16f50, 0x16f7e,
+ 0x16f93, 0x16f9f,
+ 0x1b000, 0x1b001,
+ 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, 0x1d6c0,
+ 0x1d6c2, 0x1d6da,
+ 0x1d6dc, 0x1d6fa,
+ 0x1d6fc, 0x1d714,
+ 0x1d716, 0x1d734,
+ 0x1d736, 0x1d74e,
+ 0x1d750, 0x1d76e,
+ 0x1d770, 0x1d788,
+ 0x1d78a, 0x1d7a8,
+ 0x1d7aa, 0x1d7c2,
+ 0x1d7c4, 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,
+ 0x20000, 0x2a6d6,
+ 0x2a700, 0x2b734,
+ 0x2b740, 0x2b81d,
+ 0x2f800, 0x2fa1d,
+}; /* CR_Alnum */
+
+/* 'ASCII': [[:ASCII:]] */
+static const OnigCodePoint CR_ASCII[] = {
+ 1,
+ 0x0000, 0x007f,
+}; /* CR_ASCII */
+
#ifdef USE_UNICODE_PROPERTIES
/* 'Any': - */
static const OnigCodePoint CR_Any[] = {
@@ -10,7 +4277,7 @@ static const OnigCodePoint CR_Any[] = {
/* 'Assigned': - */
static const OnigCodePoint CR_Assigned[] = {
- 501,
+ 539,
0x0000, 0x0377,
0x037a, 0x037e,
0x0384, 0x038a,
@@ -21,10 +4288,11 @@ static const OnigCodePoint CR_Assigned[] = {
0x0559, 0x055f,
0x0561, 0x0587,
0x0589, 0x058a,
+ 0x058f, 0x058f,
0x0591, 0x05c7,
0x05d0, 0x05ea,
0x05f0, 0x05f4,
- 0x0600, 0x0603,
+ 0x0600, 0x0604,
0x0606, 0x061b,
0x061e, 0x070d,
0x070f, 0x074a,
@@ -34,6 +4302,9 @@ static const OnigCodePoint CR_Assigned[] = {
0x0830, 0x083e,
0x0840, 0x085b,
0x085e, 0x085e,
+ 0x08a0, 0x08a0,
+ 0x08a2, 0x08ac,
+ 0x08e4, 0x08fe,
0x0900, 0x0977,
0x0979, 0x097f,
0x0981, 0x0983,
@@ -78,8 +4349,7 @@ static const OnigCodePoint CR_Assigned[] = {
0x0acb, 0x0acd,
0x0ad0, 0x0ad0,
0x0ae0, 0x0ae3,
- 0x0ae6, 0x0aef,
- 0x0af1, 0x0af1,
+ 0x0ae6, 0x0af1,
0x0b01, 0x0b03,
0x0b05, 0x0b0c,
0x0b0f, 0x0b10,
@@ -179,7 +4449,7 @@ static const OnigCodePoint CR_Assigned[] = {
0x0ec6, 0x0ec6,
0x0ec8, 0x0ecd,
0x0ed0, 0x0ed9,
- 0x0edc, 0x0edd,
+ 0x0edc, 0x0edf,
0x0f00, 0x0f47,
0x0f49, 0x0f6c,
0x0f71, 0x0f97,
@@ -187,8 +4457,9 @@ static const OnigCodePoint CR_Assigned[] = {
0x0fbe, 0x0fcc,
0x0fce, 0x0fda,
0x1000, 0x10c5,
- 0x10d0, 0x10fc,
- 0x1100, 0x1248,
+ 0x10c7, 0x10c7,
+ 0x10cd, 0x10cd,
+ 0x10d0, 0x1248,
0x124a, 0x124d,
0x1250, 0x1256,
0x1258, 0x1258,
@@ -241,13 +4512,12 @@ static const OnigCodePoint CR_Assigned[] = {
0x1aa0, 0x1aad,
0x1b00, 0x1b4b,
0x1b50, 0x1b7c,
- 0x1b80, 0x1baa,
- 0x1bae, 0x1bb9,
- 0x1bc0, 0x1bf3,
+ 0x1b80, 0x1bf3,
0x1bfc, 0x1c37,
0x1c3b, 0x1c49,
0x1c4d, 0x1c7f,
- 0x1cd0, 0x1cf2,
+ 0x1cc0, 0x1cc7,
+ 0x1cd0, 0x1cf6,
0x1d00, 0x1de6,
0x1dfc, 0x1f15,
0x1f18, 0x1f1d,
@@ -276,15 +4546,15 @@ static const OnigCodePoint CR_Assigned[] = {
0x2400, 0x2426,
0x2440, 0x244a,
0x2460, 0x26ff,
- 0x2701, 0x27ca,
- 0x27cc, 0x27cc,
- 0x27ce, 0x2b4c,
+ 0x2701, 0x2b4c,
0x2b50, 0x2b59,
0x2c00, 0x2c2e,
0x2c30, 0x2c5e,
- 0x2c60, 0x2cf1,
+ 0x2c60, 0x2cf3,
0x2cf9, 0x2d25,
- 0x2d30, 0x2d65,
+ 0x2d27, 0x2d27,
+ 0x2d2d, 0x2d2d,
+ 0x2d30, 0x2d67,
0x2d6f, 0x2d70,
0x2d7f, 0x2d96,
0x2da0, 0x2da6,
@@ -295,7 +4565,7 @@ static const OnigCodePoint CR_Assigned[] = {
0x2dc8, 0x2dce,
0x2dd0, 0x2dd6,
0x2dd8, 0x2dde,
- 0x2de0, 0x2e31,
+ 0x2de0, 0x2e3b,
0x2e80, 0x2e99,
0x2e9b, 0x2ef3,
0x2f00, 0x2fd5,
@@ -310,17 +4580,16 @@ static const OnigCodePoint CR_Assigned[] = {
0x31f0, 0x321e,
0x3220, 0x32fe,
0x3300, 0x4db5,
- 0x4dc0, 0x9fcb,
+ 0x4dc0, 0x9fcc,
0xa000, 0xa48c,
0xa490, 0xa4c6,
0xa4d0, 0xa62b,
- 0xa640, 0xa673,
- 0xa67c, 0xa697,
- 0xa6a0, 0xa6f7,
+ 0xa640, 0xa697,
+ 0xa69f, 0xa6f7,
0xa700, 0xa78e,
- 0xa790, 0xa791,
- 0xa7a0, 0xa7a9,
- 0xa7fa, 0xa82b,
+ 0xa790, 0xa793,
+ 0xa7a0, 0xa7aa,
+ 0xa7f8, 0xa82b,
0xa830, 0xa839,
0xa840, 0xa877,
0xa880, 0xa8c4,
@@ -336,7 +4605,7 @@ static const OnigCodePoint CR_Assigned[] = {
0xaa50, 0xaa59,
0xaa5c, 0xaa7b,
0xaa80, 0xaac2,
- 0xaadb, 0xaadf,
+ 0xaadb, 0xaaf6,
0xab01, 0xab06,
0xab09, 0xab0e,
0xab11, 0xab16,
@@ -347,8 +4616,7 @@ static const OnigCodePoint CR_Assigned[] = {
0xac00, 0xd7a3,
0xd7b0, 0xd7c6,
0xd7cb, 0xd7fb,
- 0xd800, 0xfa2d,
- 0xfa30, 0xfa6d,
+ 0xd800, 0xfa6d,
0xfa70, 0xfad9,
0xfb00, 0xfb06,
0xfb13, 0xfb17,
@@ -410,6 +4678,8 @@ static const OnigCodePoint CR_Assigned[] = {
0x10900, 0x1091b,
0x1091f, 0x10939,
0x1093f, 0x1093f,
+ 0x10980, 0x109b7,
+ 0x109be, 0x109bf,
0x10a00, 0x10a03,
0x10a05, 0x10a06,
0x10a0c, 0x10a13,
@@ -428,11 +4698,22 @@ static const OnigCodePoint CR_Assigned[] = {
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,
@@ -461,6 +4742,40 @@ static const OnigCodePoint CR_Assigned[] = {
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,
@@ -469,7 +4784,7 @@ static const OnigCodePoint CR_Assigned[] = {
0x1f0d1, 0x1f0df,
0x1f100, 0x1f10a,
0x1f110, 0x1f12e,
- 0x1f130, 0x1f169,
+ 0x1f130, 0x1f16b,
0x1f170, 0x1f19a,
0x1f1e6, 0x1f202,
0x1f210, 0x1f23a,
@@ -487,19 +4802,9 @@ static const OnigCodePoint CR_Assigned[] = {
0x1f442, 0x1f4f7,
0x1f4f9, 0x1f4fc,
0x1f500, 0x1f53d,
+ 0x1f540, 0x1f543,
0x1f550, 0x1f567,
- 0x1f5fb, 0x1f5ff,
- 0x1f601, 0x1f610,
- 0x1f612, 0x1f614,
- 0x1f616, 0x1f616,
- 0x1f618, 0x1f618,
- 0x1f61a, 0x1f61a,
- 0x1f61c, 0x1f61e,
- 0x1f620, 0x1f625,
- 0x1f628, 0x1f62b,
- 0x1f62d, 0x1f62d,
- 0x1f630, 0x1f633,
- 0x1f635, 0x1f640,
+ 0x1f5fb, 0x1f640,
0x1f645, 0x1f64f,
0x1f680, 0x1f6c5,
0x1f700, 0x1f773,
@@ -516,44 +4821,560 @@ static const OnigCodePoint CR_Assigned[] = {
/* 'C': Major Category */
static const OnigCodePoint CR_C[] = {
- 20,
+ 541,
0x0000, 0x001f,
0x007f, 0x009f,
0x00ad, 0x00ad,
- 0x0600, 0x0603,
+ 0x0378, 0x0379,
+ 0x037f, 0x0383,
+ 0x038b, 0x038b,
+ 0x038d, 0x038d,
+ 0x03a2, 0x03a2,
+ 0x0528, 0x0530,
+ 0x0557, 0x0558,
+ 0x0560, 0x0560,
+ 0x0588, 0x0588,
+ 0x058b, 0x058e,
+ 0x0590, 0x0590,
+ 0x05c8, 0x05cf,
+ 0x05eb, 0x05ef,
+ 0x05f5, 0x0605,
+ 0x061c, 0x061d,
0x06dd, 0x06dd,
- 0x070f, 0x070f,
- 0x17b4, 0x17b5,
+ 0x070e, 0x070f,
+ 0x074b, 0x074c,
+ 0x07b2, 0x07bf,
+ 0x07fb, 0x07ff,
+ 0x082e, 0x082f,
+ 0x083f, 0x083f,
+ 0x085c, 0x085d,
+ 0x085f, 0x089f,
+ 0x08a1, 0x08a1,
+ 0x08ad, 0x08e3,
+ 0x08ff, 0x08ff,
+ 0x0978, 0x0978,
+ 0x0980, 0x0980,
+ 0x0984, 0x0984,
+ 0x098d, 0x098e,
+ 0x0991, 0x0992,
+ 0x09a9, 0x09a9,
+ 0x09b1, 0x09b1,
+ 0x09b3, 0x09b5,
+ 0x09ba, 0x09bb,
+ 0x09c5, 0x09c6,
+ 0x09c9, 0x09ca,
+ 0x09cf, 0x09d6,
+ 0x09d8, 0x09db,
+ 0x09de, 0x09de,
+ 0x09e4, 0x09e5,
+ 0x09fc, 0x0a00,
+ 0x0a04, 0x0a04,
+ 0x0a0b, 0x0a0e,
+ 0x0a11, 0x0a12,
+ 0x0a29, 0x0a29,
+ 0x0a31, 0x0a31,
+ 0x0a34, 0x0a34,
+ 0x0a37, 0x0a37,
+ 0x0a3a, 0x0a3b,
+ 0x0a3d, 0x0a3d,
+ 0x0a43, 0x0a46,
+ 0x0a49, 0x0a4a,
+ 0x0a4e, 0x0a50,
+ 0x0a52, 0x0a58,
+ 0x0a5d, 0x0a5d,
+ 0x0a5f, 0x0a65,
+ 0x0a76, 0x0a80,
+ 0x0a84, 0x0a84,
+ 0x0a8e, 0x0a8e,
+ 0x0a92, 0x0a92,
+ 0x0aa9, 0x0aa9,
+ 0x0ab1, 0x0ab1,
+ 0x0ab4, 0x0ab4,
+ 0x0aba, 0x0abb,
+ 0x0ac6, 0x0ac6,
+ 0x0aca, 0x0aca,
+ 0x0ace, 0x0acf,
+ 0x0ad1, 0x0adf,
+ 0x0ae4, 0x0ae5,
+ 0x0af2, 0x0b00,
+ 0x0b04, 0x0b04,
+ 0x0b0d, 0x0b0e,
+ 0x0b11, 0x0b12,
+ 0x0b29, 0x0b29,
+ 0x0b31, 0x0b31,
+ 0x0b34, 0x0b34,
+ 0x0b3a, 0x0b3b,
+ 0x0b45, 0x0b46,
+ 0x0b49, 0x0b4a,
+ 0x0b4e, 0x0b55,
+ 0x0b58, 0x0b5b,
+ 0x0b5e, 0x0b5e,
+ 0x0b64, 0x0b65,
+ 0x0b78, 0x0b81,
+ 0x0b84, 0x0b84,
+ 0x0b8b, 0x0b8d,
+ 0x0b91, 0x0b91,
+ 0x0b96, 0x0b98,
+ 0x0b9b, 0x0b9b,
+ 0x0b9d, 0x0b9d,
+ 0x0ba0, 0x0ba2,
+ 0x0ba5, 0x0ba7,
+ 0x0bab, 0x0bad,
+ 0x0bba, 0x0bbd,
+ 0x0bc3, 0x0bc5,
+ 0x0bc9, 0x0bc9,
+ 0x0bce, 0x0bcf,
+ 0x0bd1, 0x0bd6,
+ 0x0bd8, 0x0be5,
+ 0x0bfb, 0x0c00,
+ 0x0c04, 0x0c04,
+ 0x0c0d, 0x0c0d,
+ 0x0c11, 0x0c11,
+ 0x0c29, 0x0c29,
+ 0x0c34, 0x0c34,
+ 0x0c3a, 0x0c3c,
+ 0x0c45, 0x0c45,
+ 0x0c49, 0x0c49,
+ 0x0c4e, 0x0c54,
+ 0x0c57, 0x0c57,
+ 0x0c5a, 0x0c5f,
+ 0x0c64, 0x0c65,
+ 0x0c70, 0x0c77,
+ 0x0c80, 0x0c81,
+ 0x0c84, 0x0c84,
+ 0x0c8d, 0x0c8d,
+ 0x0c91, 0x0c91,
+ 0x0ca9, 0x0ca9,
+ 0x0cb4, 0x0cb4,
+ 0x0cba, 0x0cbb,
+ 0x0cc5, 0x0cc5,
+ 0x0cc9, 0x0cc9,
+ 0x0cce, 0x0cd4,
+ 0x0cd7, 0x0cdd,
+ 0x0cdf, 0x0cdf,
+ 0x0ce4, 0x0ce5,
+ 0x0cf0, 0x0cf0,
+ 0x0cf3, 0x0d01,
+ 0x0d04, 0x0d04,
+ 0x0d0d, 0x0d0d,
+ 0x0d11, 0x0d11,
+ 0x0d3b, 0x0d3c,
+ 0x0d45, 0x0d45,
+ 0x0d49, 0x0d49,
+ 0x0d4f, 0x0d56,
+ 0x0d58, 0x0d5f,
+ 0x0d64, 0x0d65,
+ 0x0d76, 0x0d78,
+ 0x0d80, 0x0d81,
+ 0x0d84, 0x0d84,
+ 0x0d97, 0x0d99,
+ 0x0db2, 0x0db2,
+ 0x0dbc, 0x0dbc,
+ 0x0dbe, 0x0dbf,
+ 0x0dc7, 0x0dc9,
+ 0x0dcb, 0x0dce,
+ 0x0dd5, 0x0dd5,
+ 0x0dd7, 0x0dd7,
+ 0x0de0, 0x0df1,
+ 0x0df5, 0x0e00,
+ 0x0e3b, 0x0e3e,
+ 0x0e5c, 0x0e80,
+ 0x0e83, 0x0e83,
+ 0x0e85, 0x0e86,
+ 0x0e89, 0x0e89,
+ 0x0e8b, 0x0e8c,
+ 0x0e8e, 0x0e93,
+ 0x0e98, 0x0e98,
+ 0x0ea0, 0x0ea0,
+ 0x0ea4, 0x0ea4,
+ 0x0ea6, 0x0ea6,
+ 0x0ea8, 0x0ea9,
+ 0x0eac, 0x0eac,
+ 0x0eba, 0x0eba,
+ 0x0ebe, 0x0ebf,
+ 0x0ec5, 0x0ec5,
+ 0x0ec7, 0x0ec7,
+ 0x0ece, 0x0ecf,
+ 0x0eda, 0x0edb,
+ 0x0ee0, 0x0eff,
+ 0x0f48, 0x0f48,
+ 0x0f6d, 0x0f70,
+ 0x0f98, 0x0f98,
+ 0x0fbd, 0x0fbd,
+ 0x0fcd, 0x0fcd,
+ 0x0fdb, 0x0fff,
+ 0x10c6, 0x10c6,
+ 0x10c8, 0x10cc,
+ 0x10ce, 0x10cf,
+ 0x1249, 0x1249,
+ 0x124e, 0x124f,
+ 0x1257, 0x1257,
+ 0x1259, 0x1259,
+ 0x125e, 0x125f,
+ 0x1289, 0x1289,
+ 0x128e, 0x128f,
+ 0x12b1, 0x12b1,
+ 0x12b6, 0x12b7,
+ 0x12bf, 0x12bf,
+ 0x12c1, 0x12c1,
+ 0x12c6, 0x12c7,
+ 0x12d7, 0x12d7,
+ 0x1311, 0x1311,
+ 0x1316, 0x1317,
+ 0x135b, 0x135c,
+ 0x137d, 0x137f,
+ 0x139a, 0x139f,
+ 0x13f5, 0x13ff,
+ 0x169d, 0x169f,
+ 0x16f1, 0x16ff,
+ 0x170d, 0x170d,
+ 0x1715, 0x171f,
+ 0x1737, 0x173f,
+ 0x1754, 0x175f,
+ 0x176d, 0x176d,
+ 0x1771, 0x1771,
+ 0x1774, 0x177f,
+ 0x17de, 0x17df,
+ 0x17ea, 0x17ef,
+ 0x17fa, 0x17ff,
+ 0x180f, 0x180f,
+ 0x181a, 0x181f,
+ 0x1878, 0x187f,
+ 0x18ab, 0x18af,
+ 0x18f6, 0x18ff,
+ 0x191d, 0x191f,
+ 0x192c, 0x192f,
+ 0x193c, 0x193f,
+ 0x1941, 0x1943,
+ 0x196e, 0x196f,
+ 0x1975, 0x197f,
+ 0x19ac, 0x19af,
+ 0x19ca, 0x19cf,
+ 0x19db, 0x19dd,
+ 0x1a1c, 0x1a1d,
+ 0x1a5f, 0x1a5f,
+ 0x1a7d, 0x1a7e,
+ 0x1a8a, 0x1a8f,
+ 0x1a9a, 0x1a9f,
+ 0x1aae, 0x1aff,
+ 0x1b4c, 0x1b4f,
+ 0x1b7d, 0x1b7f,
+ 0x1bf4, 0x1bfb,
+ 0x1c38, 0x1c3a,
+ 0x1c4a, 0x1c4c,
+ 0x1c80, 0x1cbf,
+ 0x1cc8, 0x1ccf,
+ 0x1cf7, 0x1cff,
+ 0x1de7, 0x1dfb,
+ 0x1f16, 0x1f17,
+ 0x1f1e, 0x1f1f,
+ 0x1f46, 0x1f47,
+ 0x1f4e, 0x1f4f,
+ 0x1f58, 0x1f58,
+ 0x1f5a, 0x1f5a,
+ 0x1f5c, 0x1f5c,
+ 0x1f5e, 0x1f5e,
+ 0x1f7e, 0x1f7f,
+ 0x1fb5, 0x1fb5,
+ 0x1fc5, 0x1fc5,
+ 0x1fd4, 0x1fd5,
+ 0x1fdc, 0x1fdc,
+ 0x1ff0, 0x1ff1,
+ 0x1ff5, 0x1ff5,
+ 0x1fff, 0x1fff,
0x200b, 0x200f,
0x202a, 0x202e,
- 0x2060, 0x2064,
- 0x206a, 0x206f,
- 0xd800, 0xf8ff,
- 0xfeff, 0xfeff,
- 0xfff9, 0xfffb,
+ 0x2060, 0x206f,
+ 0x2072, 0x2073,
+ 0x208f, 0x208f,
+ 0x209d, 0x209f,
+ 0x20ba, 0x20cf,
+ 0x20f1, 0x20ff,
+ 0x218a, 0x218f,
+ 0x23f4, 0x23ff,
+ 0x2427, 0x243f,
+ 0x244b, 0x245f,
+ 0x2700, 0x2700,
+ 0x2b4d, 0x2b4f,
+ 0x2b5a, 0x2bff,
+ 0x2c2f, 0x2c2f,
+ 0x2c5f, 0x2c5f,
+ 0x2cf4, 0x2cf8,
+ 0x2d26, 0x2d26,
+ 0x2d28, 0x2d2c,
+ 0x2d2e, 0x2d2f,
+ 0x2d68, 0x2d6e,
+ 0x2d71, 0x2d7e,
+ 0x2d97, 0x2d9f,
+ 0x2da7, 0x2da7,
+ 0x2daf, 0x2daf,
+ 0x2db7, 0x2db7,
+ 0x2dbf, 0x2dbf,
+ 0x2dc7, 0x2dc7,
+ 0x2dcf, 0x2dcf,
+ 0x2dd7, 0x2dd7,
+ 0x2ddf, 0x2ddf,
+ 0x2e3c, 0x2e7f,
+ 0x2e9a, 0x2e9a,
+ 0x2ef4, 0x2eff,
+ 0x2fd6, 0x2fef,
+ 0x2ffc, 0x2fff,
+ 0x3040, 0x3040,
+ 0x3097, 0x3098,
+ 0x3100, 0x3104,
+ 0x312e, 0x3130,
+ 0x318f, 0x318f,
+ 0x31bb, 0x31bf,
+ 0x31e4, 0x31ef,
+ 0x321f, 0x321f,
+ 0x32ff, 0x32ff,
+ 0x4db6, 0x4dbf,
+ 0x9fcd, 0x9fff,
+ 0xa48d, 0xa48f,
+ 0xa4c7, 0xa4cf,
+ 0xa62c, 0xa63f,
+ 0xa698, 0xa69e,
+ 0xa6f8, 0xa6ff,
+ 0xa78f, 0xa78f,
+ 0xa794, 0xa79f,
+ 0xa7ab, 0xa7f7,
+ 0xa82c, 0xa82f,
+ 0xa83a, 0xa83f,
+ 0xa878, 0xa87f,
+ 0xa8c5, 0xa8cd,
+ 0xa8da, 0xa8df,
+ 0xa8fc, 0xa8ff,
+ 0xa954, 0xa95e,
+ 0xa97d, 0xa97f,
+ 0xa9ce, 0xa9ce,
+ 0xa9da, 0xa9dd,
+ 0xa9e0, 0xa9ff,
+ 0xaa37, 0xaa3f,
+ 0xaa4e, 0xaa4f,
+ 0xaa5a, 0xaa5b,
+ 0xaa7c, 0xaa7f,
+ 0xaac3, 0xaada,
+ 0xaaf7, 0xab00,
+ 0xab07, 0xab08,
+ 0xab0f, 0xab10,
+ 0xab17, 0xab1f,
+ 0xab27, 0xab27,
+ 0xab2f, 0xabbf,
+ 0xabee, 0xabef,
+ 0xabfa, 0xabff,
+ 0xd7a4, 0xd7af,
+ 0xd7c7, 0xd7ca,
+ 0xd7fc, 0xf8ff,
+ 0xfa6e, 0xfa6f,
+ 0xfada, 0xfaff,
+ 0xfb07, 0xfb12,
+ 0xfb18, 0xfb1c,
+ 0xfb37, 0xfb37,
+ 0xfb3d, 0xfb3d,
+ 0xfb3f, 0xfb3f,
+ 0xfb42, 0xfb42,
+ 0xfb45, 0xfb45,
+ 0xfbc2, 0xfbd2,
+ 0xfd40, 0xfd4f,
+ 0xfd90, 0xfd91,
+ 0xfdc8, 0xfdef,
+ 0xfdfe, 0xfdff,
+ 0xfe1a, 0xfe1f,
+ 0xfe27, 0xfe2f,
+ 0xfe53, 0xfe53,
+ 0xfe67, 0xfe67,
+ 0xfe6c, 0xfe6f,
+ 0xfe75, 0xfe75,
+ 0xfefd, 0xff00,
+ 0xffbf, 0xffc1,
+ 0xffc8, 0xffc9,
+ 0xffd0, 0xffd1,
+ 0xffd8, 0xffd9,
+ 0xffdd, 0xffdf,
+ 0xffe7, 0xffe7,
+ 0xffef, 0xfffb,
+ 0xfffe, 0xffff,
+ 0x1000c, 0x1000c,
+ 0x10027, 0x10027,
+ 0x1003b, 0x1003b,
+ 0x1003e, 0x1003e,
+ 0x1004e, 0x1004f,
+ 0x1005e, 0x1007f,
+ 0x100fb, 0x100ff,
+ 0x10103, 0x10106,
+ 0x10134, 0x10136,
+ 0x1018b, 0x1018f,
+ 0x1019c, 0x101cf,
+ 0x101fe, 0x1027f,
+ 0x1029d, 0x1029f,
+ 0x102d1, 0x102ff,
+ 0x1031f, 0x1031f,
+ 0x10324, 0x1032f,
+ 0x1034b, 0x1037f,
+ 0x1039e, 0x1039e,
+ 0x103c4, 0x103c7,
+ 0x103d6, 0x103ff,
+ 0x1049e, 0x1049f,
+ 0x104aa, 0x107ff,
+ 0x10806, 0x10807,
+ 0x10809, 0x10809,
+ 0x10836, 0x10836,
+ 0x10839, 0x1083b,
+ 0x1083d, 0x1083e,
+ 0x10856, 0x10856,
+ 0x10860, 0x108ff,
+ 0x1091c, 0x1091e,
+ 0x1093a, 0x1093e,
+ 0x10940, 0x1097f,
+ 0x109b8, 0x109bd,
+ 0x109c0, 0x109ff,
+ 0x10a04, 0x10a04,
+ 0x10a07, 0x10a0b,
+ 0x10a14, 0x10a14,
+ 0x10a18, 0x10a18,
+ 0x10a34, 0x10a37,
+ 0x10a3b, 0x10a3e,
+ 0x10a48, 0x10a4f,
+ 0x10a59, 0x10a5f,
+ 0x10a80, 0x10aff,
+ 0x10b36, 0x10b38,
+ 0x10b56, 0x10b57,
+ 0x10b73, 0x10b77,
+ 0x10b80, 0x10bff,
+ 0x10c49, 0x10e5f,
+ 0x10e7f, 0x10fff,
+ 0x1104e, 0x11051,
+ 0x11070, 0x1107f,
0x110bd, 0x110bd,
+ 0x110c2, 0x110cf,
+ 0x110e9, 0x110ef,
+ 0x110fa, 0x110ff,
+ 0x11135, 0x11135,
+ 0x11144, 0x1117f,
+ 0x111c9, 0x111cf,
+ 0x111da, 0x1167f,
+ 0x116b8, 0x116bf,
+ 0x116ca, 0x11fff,
+ 0x1236f, 0x123ff,
+ 0x12463, 0x1246f,
+ 0x12474, 0x12fff,
+ 0x1342f, 0x167ff,
+ 0x16a39, 0x16eff,
+ 0x16f45, 0x16f4f,
+ 0x16f7f, 0x16f8e,
+ 0x16fa0, 0x1afff,
+ 0x1b002, 0x1cfff,
+ 0x1d0f6, 0x1d0ff,
+ 0x1d127, 0x1d128,
0x1d173, 0x1d17a,
- 0xe0001, 0xe0001,
- 0xe0020, 0xe007f,
- 0xf0000, 0xffffd,
- 0x100000, 0x10ffff,
+ 0x1d1de, 0x1d1ff,
+ 0x1d246, 0x1d2ff,
+ 0x1d357, 0x1d35f,
+ 0x1d372, 0x1d3ff,
+ 0x1d455, 0x1d455,
+ 0x1d49d, 0x1d49d,
+ 0x1d4a0, 0x1d4a1,
+ 0x1d4a3, 0x1d4a4,
+ 0x1d4a7, 0x1d4a8,
+ 0x1d4ad, 0x1d4ad,
+ 0x1d4ba, 0x1d4ba,
+ 0x1d4bc, 0x1d4bc,
+ 0x1d4c4, 0x1d4c4,
+ 0x1d506, 0x1d506,
+ 0x1d50b, 0x1d50c,
+ 0x1d515, 0x1d515,
+ 0x1d51d, 0x1d51d,
+ 0x1d53a, 0x1d53a,
+ 0x1d53f, 0x1d53f,
+ 0x1d545, 0x1d545,
+ 0x1d547, 0x1d549,
+ 0x1d551, 0x1d551,
+ 0x1d6a6, 0x1d6a7,
+ 0x1d7cc, 0x1d7cd,
+ 0x1d800, 0x1edff,
+ 0x1ee04, 0x1ee04,
+ 0x1ee20, 0x1ee20,
+ 0x1ee23, 0x1ee23,
+ 0x1ee25, 0x1ee26,
+ 0x1ee28, 0x1ee28,
+ 0x1ee33, 0x1ee33,
+ 0x1ee38, 0x1ee38,
+ 0x1ee3a, 0x1ee3a,
+ 0x1ee3c, 0x1ee41,
+ 0x1ee43, 0x1ee46,
+ 0x1ee48, 0x1ee48,
+ 0x1ee4a, 0x1ee4a,
+ 0x1ee4c, 0x1ee4c,
+ 0x1ee50, 0x1ee50,
+ 0x1ee53, 0x1ee53,
+ 0x1ee55, 0x1ee56,
+ 0x1ee58, 0x1ee58,
+ 0x1ee5a, 0x1ee5a,
+ 0x1ee5c, 0x1ee5c,
+ 0x1ee5e, 0x1ee5e,
+ 0x1ee60, 0x1ee60,
+ 0x1ee63, 0x1ee63,
+ 0x1ee65, 0x1ee66,
+ 0x1ee6b, 0x1ee6b,
+ 0x1ee73, 0x1ee73,
+ 0x1ee78, 0x1ee78,
+ 0x1ee7d, 0x1ee7d,
+ 0x1ee7f, 0x1ee7f,
+ 0x1ee8a, 0x1ee8a,
+ 0x1ee9c, 0x1eea0,
+ 0x1eea4, 0x1eea4,
+ 0x1eeaa, 0x1eeaa,
+ 0x1eebc, 0x1eeef,
+ 0x1eef2, 0x1efff,
+ 0x1f02c, 0x1f02f,
+ 0x1f094, 0x1f09f,
+ 0x1f0af, 0x1f0b0,
+ 0x1f0bf, 0x1f0c0,
+ 0x1f0d0, 0x1f0d0,
+ 0x1f0e0, 0x1f0ff,
+ 0x1f10b, 0x1f10f,
+ 0x1f12f, 0x1f12f,
+ 0x1f16c, 0x1f16f,
+ 0x1f19b, 0x1f1e5,
+ 0x1f203, 0x1f20f,
+ 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,
+ 0x2a6d7, 0x2a6ff,
+ 0x2b735, 0x2b73f,
+ 0x2b81e, 0x2f7ff,
+ 0x2fa1e, 0xe00ff,
+ 0xe01f0, 0x10ffff,
}; /* CR_C */
/* 'Cc': General Category */
-static const OnigCodePoint CR_Cc[] = {
- 2,
- 0x0000, 0x001f,
- 0x007f, 0x009f,
-}; /* CR_Cc */
+#define CR_Cc CR_Cntrl
/* 'Cf': General Category */
static const OnigCodePoint CR_Cf[] = {
- 15,
+ 14,
0x00ad, 0x00ad,
- 0x0600, 0x0603,
+ 0x0600, 0x0604,
0x06dd, 0x06dd,
0x070f, 0x070f,
- 0x17b4, 0x17b5,
0x200b, 0x200f,
0x202a, 0x202e,
0x2060, 0x2064,
@@ -568,7 +5389,7 @@ static const OnigCodePoint CR_Cf[] = {
/* 'Cn': General Category */
static const OnigCodePoint CR_Cn[] = {
- 501,
+ 539,
0x0378, 0x0379,
0x037f, 0x0383,
0x038b, 0x038b,
@@ -578,11 +5399,12 @@ static const OnigCodePoint CR_Cn[] = {
0x0557, 0x0558,
0x0560, 0x0560,
0x0588, 0x0588,
- 0x058b, 0x0590,
+ 0x058b, 0x058e,
+ 0x0590, 0x0590,
0x05c8, 0x05cf,
0x05eb, 0x05ef,
0x05f5, 0x05ff,
- 0x0604, 0x0605,
+ 0x0605, 0x0605,
0x061c, 0x061d,
0x070e, 0x070e,
0x074b, 0x074c,
@@ -591,7 +5413,10 @@ static const OnigCodePoint CR_Cn[] = {
0x082e, 0x082f,
0x083f, 0x083f,
0x085c, 0x085d,
- 0x085f, 0x08ff,
+ 0x085f, 0x089f,
+ 0x08a1, 0x08a1,
+ 0x08ad, 0x08e3,
+ 0x08ff, 0x08ff,
0x0978, 0x0978,
0x0980, 0x0980,
0x0984, 0x0984,
@@ -636,7 +5461,6 @@ static const OnigCodePoint CR_Cn[] = {
0x0ace, 0x0acf,
0x0ad1, 0x0adf,
0x0ae4, 0x0ae5,
- 0x0af0, 0x0af0,
0x0af2, 0x0b00,
0x0b04, 0x0b04,
0x0b0d, 0x0b0e,
@@ -737,15 +5561,16 @@ static const OnigCodePoint CR_Cn[] = {
0x0ec7, 0x0ec7,
0x0ece, 0x0ecf,
0x0eda, 0x0edb,
- 0x0ede, 0x0eff,
+ 0x0ee0, 0x0eff,
0x0f48, 0x0f48,
0x0f6d, 0x0f70,
0x0f98, 0x0f98,
0x0fbd, 0x0fbd,
0x0fcd, 0x0fcd,
0x0fdb, 0x0fff,
- 0x10c6, 0x10cf,
- 0x10fd, 0x10ff,
+ 0x10c6, 0x10c6,
+ 0x10c8, 0x10cc,
+ 0x10ce, 0x10cf,
0x1249, 0x1249,
0x124e, 0x124f,
0x1257, 0x1257,
@@ -799,13 +5624,12 @@ static const OnigCodePoint CR_Cn[] = {
0x1aae, 0x1aff,
0x1b4c, 0x1b4f,
0x1b7d, 0x1b7f,
- 0x1bab, 0x1bad,
- 0x1bba, 0x1bbf,
0x1bf4, 0x1bfb,
0x1c38, 0x1c3a,
0x1c4a, 0x1c4c,
- 0x1c80, 0x1ccf,
- 0x1cf3, 0x1cff,
+ 0x1c80, 0x1cbf,
+ 0x1cc8, 0x1ccf,
+ 0x1cf7, 0x1cff,
0x1de7, 0x1dfb,
0x1f16, 0x1f17,
0x1f1e, 0x1f1f,
@@ -834,15 +5658,15 @@ static const OnigCodePoint CR_Cn[] = {
0x2427, 0x243f,
0x244b, 0x245f,
0x2700, 0x2700,
- 0x27cb, 0x27cb,
- 0x27cd, 0x27cd,
0x2b4d, 0x2b4f,
0x2b5a, 0x2bff,
0x2c2f, 0x2c2f,
0x2c5f, 0x2c5f,
- 0x2cf2, 0x2cf8,
- 0x2d26, 0x2d2f,
- 0x2d66, 0x2d6e,
+ 0x2cf4, 0x2cf8,
+ 0x2d26, 0x2d26,
+ 0x2d28, 0x2d2c,
+ 0x2d2e, 0x2d2f,
+ 0x2d68, 0x2d6e,
0x2d71, 0x2d7e,
0x2d97, 0x2d9f,
0x2da7, 0x2da7,
@@ -853,7 +5677,7 @@ static const OnigCodePoint CR_Cn[] = {
0x2dcf, 0x2dcf,
0x2dd7, 0x2dd7,
0x2ddf, 0x2ddf,
- 0x2e32, 0x2e7f,
+ 0x2e3c, 0x2e7f,
0x2e9a, 0x2e9a,
0x2ef4, 0x2eff,
0x2fd6, 0x2fef,
@@ -868,16 +5692,15 @@ static const OnigCodePoint CR_Cn[] = {
0x321f, 0x321f,
0x32ff, 0x32ff,
0x4db6, 0x4dbf,
- 0x9fcc, 0x9fff,
+ 0x9fcd, 0x9fff,
0xa48d, 0xa48f,
0xa4c7, 0xa4cf,
0xa62c, 0xa63f,
- 0xa674, 0xa67b,
- 0xa698, 0xa69f,
+ 0xa698, 0xa69e,
0xa6f8, 0xa6ff,
0xa78f, 0xa78f,
- 0xa792, 0xa79f,
- 0xa7aa, 0xa7f9,
+ 0xa794, 0xa79f,
+ 0xa7ab, 0xa7f7,
0xa82c, 0xa82f,
0xa83a, 0xa83f,
0xa878, 0xa87f,
@@ -894,7 +5717,7 @@ static const OnigCodePoint CR_Cn[] = {
0xaa5a, 0xaa5b,
0xaa7c, 0xaa7f,
0xaac3, 0xaada,
- 0xaae0, 0xab00,
+ 0xaaf7, 0xab00,
0xab07, 0xab08,
0xab0f, 0xab10,
0xab17, 0xab1f,
@@ -905,7 +5728,6 @@ static const OnigCodePoint CR_Cn[] = {
0xd7a4, 0xd7af,
0xd7c7, 0xd7ca,
0xd7fc, 0xd7ff,
- 0xfa2e, 0xfa2f,
0xfa6e, 0xfa6f,
0xfada, 0xfaff,
0xfb07, 0xfb12,
@@ -967,7 +5789,9 @@ static const OnigCodePoint CR_Cn[] = {
0x10860, 0x108ff,
0x1091c, 0x1091e,
0x1093a, 0x1093e,
- 0x10940, 0x109ff,
+ 0x10940, 0x1097f,
+ 0x109b8, 0x109bd,
+ 0x109c0, 0x109ff,
0x10a04, 0x10a04,
0x10a07, 0x10a0b,
0x10a14, 0x10a14,
@@ -985,12 +5809,23 @@ static const OnigCodePoint CR_Cn[] = {
0x10e7f, 0x10fff,
0x1104e, 0x11051,
0x11070, 0x1107f,
- 0x110c2, 0x11fff,
+ 0x110c2, 0x110cf,
+ 0x110e9, 0x110ef,
+ 0x110fa, 0x110ff,
+ 0x11135, 0x11135,
+ 0x11144, 0x1117f,
+ 0x111c9, 0x111cf,
+ 0x111da, 0x1167f,
+ 0x116b8, 0x116bf,
+ 0x116ca, 0x11fff,
0x1236f, 0x123ff,
0x12463, 0x1246f,
0x12474, 0x12fff,
0x1342f, 0x167ff,
- 0x16a39, 0x1afff,
+ 0x16a39, 0x16eff,
+ 0x16f45, 0x16f4f,
+ 0x16f7f, 0x16f8e,
+ 0x16fa0, 0x1afff,
0x1b002, 0x1cfff,
0x1d0f6, 0x1d0ff,
0x1d127, 0x1d128,
@@ -1018,7 +5853,41 @@ static const OnigCodePoint CR_Cn[] = {
0x1d551, 0x1d551,
0x1d6a6, 0x1d6a7,
0x1d7cc, 0x1d7cd,
- 0x1d800, 0x1efff,
+ 0x1d800, 0x1edff,
+ 0x1ee04, 0x1ee04,
+ 0x1ee20, 0x1ee20,
+ 0x1ee23, 0x1ee23,
+ 0x1ee25, 0x1ee26,
+ 0x1ee28, 0x1ee28,
+ 0x1ee33, 0x1ee33,
+ 0x1ee38, 0x1ee38,
+ 0x1ee3a, 0x1ee3a,
+ 0x1ee3c, 0x1ee41,
+ 0x1ee43, 0x1ee46,
+ 0x1ee48, 0x1ee48,
+ 0x1ee4a, 0x1ee4a,
+ 0x1ee4c, 0x1ee4c,
+ 0x1ee50, 0x1ee50,
+ 0x1ee53, 0x1ee53,
+ 0x1ee55, 0x1ee56,
+ 0x1ee58, 0x1ee58,
+ 0x1ee5a, 0x1ee5a,
+ 0x1ee5c, 0x1ee5c,
+ 0x1ee5e, 0x1ee5e,
+ 0x1ee60, 0x1ee60,
+ 0x1ee63, 0x1ee63,
+ 0x1ee65, 0x1ee66,
+ 0x1ee6b, 0x1ee6b,
+ 0x1ee73, 0x1ee73,
+ 0x1ee78, 0x1ee78,
+ 0x1ee7d, 0x1ee7d,
+ 0x1ee7f, 0x1ee7f,
+ 0x1ee8a, 0x1ee8a,
+ 0x1ee9c, 0x1eea0,
+ 0x1eea4, 0x1eea4,
+ 0x1eeaa, 0x1eeaa,
+ 0x1eebc, 0x1eeef,
+ 0x1eef2, 0x1efff,
0x1f02c, 0x1f02f,
0x1f094, 0x1f09f,
0x1f0af, 0x1f0b0,
@@ -1027,7 +5896,7 @@ static const OnigCodePoint CR_Cn[] = {
0x1f0e0, 0x1f0ff,
0x1f10b, 0x1f10f,
0x1f12f, 0x1f12f,
- 0x1f16a, 0x1f16f,
+ 0x1f16c, 0x1f16f,
0x1f19b, 0x1f1e5,
0x1f203, 0x1f20f,
0x1f23b, 0x1f23f,
@@ -1044,19 +5913,9 @@ static const OnigCodePoint CR_Cn[] = {
0x1f441, 0x1f441,
0x1f4f8, 0x1f4f8,
0x1f4fd, 0x1f4ff,
- 0x1f53e, 0x1f54f,
+ 0x1f53e, 0x1f53f,
+ 0x1f544, 0x1f54f,
0x1f568, 0x1f5fa,
- 0x1f600, 0x1f600,
- 0x1f611, 0x1f611,
- 0x1f615, 0x1f615,
- 0x1f617, 0x1f617,
- 0x1f619, 0x1f619,
- 0x1f61b, 0x1f61b,
- 0x1f61f, 0x1f61f,
- 0x1f626, 0x1f627,
- 0x1f62c, 0x1f62c,
- 0x1f62e, 0x1f62f,
- 0x1f634, 0x1f634,
0x1f641, 0x1f644,
0x1f650, 0x1f67f,
0x1f6c6, 0x1f6ff,
@@ -1088,7 +5947,7 @@ static const OnigCodePoint CR_Cs[] = {
/* 'L': Major Category */
static const OnigCodePoint CR_L[] = {
- 435,
+ 486,
0x0041, 0x005a,
0x0061, 0x007a,
0x00aa, 0x00aa,
@@ -1136,6 +5995,8 @@ static const OnigCodePoint CR_L[] = {
0x0824, 0x0824,
0x0828, 0x0828,
0x0840, 0x0858,
+ 0x08a0, 0x08a0,
+ 0x08a2, 0x08ac,
0x0904, 0x0939,
0x093d, 0x093d,
0x0950, 0x0950,
@@ -1241,7 +6102,7 @@ static const OnigCodePoint CR_L[] = {
0x0ebd, 0x0ebd,
0x0ec0, 0x0ec4,
0x0ec6, 0x0ec6,
- 0x0edc, 0x0edd,
+ 0x0edc, 0x0edf,
0x0f00, 0x0f00,
0x0f40, 0x0f47,
0x0f49, 0x0f6c,
@@ -1256,9 +6117,10 @@ static const OnigCodePoint CR_L[] = {
0x1075, 0x1081,
0x108e, 0x108e,
0x10a0, 0x10c5,
+ 0x10c7, 0x10c7,
+ 0x10cd, 0x10cd,
0x10d0, 0x10fa,
- 0x10fc, 0x10fc,
- 0x1100, 0x1248,
+ 0x10fc, 0x1248,
0x124a, 0x124d,
0x1250, 0x1256,
0x1258, 0x1258,
@@ -1305,12 +6167,13 @@ static const OnigCodePoint CR_L[] = {
0x1b45, 0x1b4b,
0x1b83, 0x1ba0,
0x1bae, 0x1baf,
- 0x1bc0, 0x1be5,
+ 0x1bba, 0x1be5,
0x1c00, 0x1c23,
0x1c4d, 0x1c4f,
0x1c5a, 0x1c7d,
0x1ce9, 0x1cec,
0x1cee, 0x1cf1,
+ 0x1cf5, 0x1cf6,
0x1d00, 0x1dbf,
0x1e00, 0x1f15,
0x1f18, 0x1f1d,
@@ -1352,8 +6215,11 @@ static const OnigCodePoint CR_L[] = {
0x2c30, 0x2c5e,
0x2c60, 0x2ce4,
0x2ceb, 0x2cee,
+ 0x2cf2, 0x2cf3,
0x2d00, 0x2d25,
- 0x2d30, 0x2d65,
+ 0x2d27, 0x2d27,
+ 0x2d2d, 0x2d2d,
+ 0x2d30, 0x2d67,
0x2d6f, 0x2d6f,
0x2d80, 0x2d96,
0x2da0, 0x2da6,
@@ -1377,7 +6243,7 @@ static const OnigCodePoint CR_L[] = {
0x31a0, 0x31ba,
0x31f0, 0x31ff,
0x3400, 0x4db5,
- 0x4e00, 0x9fcb,
+ 0x4e00, 0x9fcc,
0xa000, 0xa48c,
0xa4d0, 0xa4fd,
0xa500, 0xa60c,
@@ -1389,9 +6255,9 @@ static const OnigCodePoint CR_L[] = {
0xa717, 0xa71f,
0xa722, 0xa788,
0xa78b, 0xa78e,
- 0xa790, 0xa791,
- 0xa7a0, 0xa7a9,
- 0xa7fa, 0xa801,
+ 0xa790, 0xa793,
+ 0xa7a0, 0xa7aa,
+ 0xa7f8, 0xa801,
0xa803, 0xa805,
0xa807, 0xa80a,
0xa80c, 0xa822,
@@ -1416,6 +6282,8 @@ static const OnigCodePoint CR_L[] = {
0xaac0, 0xaac0,
0xaac2, 0xaac2,
0xaadb, 0xaadd,
+ 0xaae0, 0xaaea,
+ 0xaaf2, 0xaaf4,
0xab01, 0xab06,
0xab09, 0xab0e,
0xab11, 0xab16,
@@ -1425,8 +6293,7 @@ static const OnigCodePoint CR_L[] = {
0xac00, 0xd7a3,
0xd7b0, 0xd7c6,
0xd7cb, 0xd7fb,
- 0xf900, 0xfa2d,
- 0xfa30, 0xfa6d,
+ 0xf900, 0xfa6d,
0xfa70, 0xfad9,
0xfb00, 0xfb06,
0xfb13, 0xfb17,
@@ -1475,6 +6342,8 @@ static const OnigCodePoint CR_L[] = {
0x1083f, 0x10855,
0x10900, 0x10915,
0x10920, 0x10939,
+ 0x10980, 0x109b7,
+ 0x109be, 0x109bf,
0x10a00, 0x10a00,
0x10a10, 0x10a13,
0x10a15, 0x10a17,
@@ -1486,9 +6355,17 @@ static const OnigCodePoint CR_L[] = {
0x10c00, 0x10c48,
0x11003, 0x11037,
0x11083, 0x110af,
+ 0x110d0, 0x110e8,
+ 0x11103, 0x11126,
+ 0x11183, 0x111b2,
+ 0x111c1, 0x111c4,
+ 0x11680, 0x116aa,
0x12000, 0x1236e,
0x13000, 0x1342e,
0x16800, 0x16a38,
+ 0x16f00, 0x16f44,
+ 0x16f50, 0x16f50,
+ 0x16f93, 0x16f9f,
0x1b000, 0x1b001,
0x1d400, 0x1d454,
0x1d456, 0x1d49c,
@@ -1520,19 +6397,168 @@ static const OnigCodePoint CR_L[] = {
0x1d78a, 0x1d7a8,
0x1d7aa, 0x1d7c2,
0x1d7c4, 0x1d7cb,
+ 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,
0x20000, 0x2a6d6,
0x2a700, 0x2b734,
0x2b740, 0x2b81d,
0x2f800, 0x2fa1d,
}; /* CR_L */
+/* 'LC': General Category */
+static const OnigCodePoint CR_LC[] = {
+ 113,
+ 0x0041, 0x005a,
+ 0x0061, 0x007a,
+ 0x00b5, 0x00b5,
+ 0x00c0, 0x00d6,
+ 0x00d8, 0x00f6,
+ 0x00f8, 0x01ba,
+ 0x01bc, 0x01bf,
+ 0x01c4, 0x0293,
+ 0x0295, 0x02af,
+ 0x0370, 0x0373,
+ 0x0376, 0x0377,
+ 0x037b, 0x037d,
+ 0x0386, 0x0386,
+ 0x0388, 0x038a,
+ 0x038c, 0x038c,
+ 0x038e, 0x03a1,
+ 0x03a3, 0x03f5,
+ 0x03f7, 0x0481,
+ 0x048a, 0x0527,
+ 0x0531, 0x0556,
+ 0x0561, 0x0587,
+ 0x10a0, 0x10c5,
+ 0x10c7, 0x10c7,
+ 0x10cd, 0x10cd,
+ 0x1d00, 0x1d2b,
+ 0x1d6b, 0x1d77,
+ 0x1d79, 0x1d9a,
+ 0x1e00, 0x1f15,
+ 0x1f18, 0x1f1d,
+ 0x1f20, 0x1f45,
+ 0x1f48, 0x1f4d,
+ 0x1f50, 0x1f57,
+ 0x1f59, 0x1f59,
+ 0x1f5b, 0x1f5b,
+ 0x1f5d, 0x1f5d,
+ 0x1f5f, 0x1f7d,
+ 0x1f80, 0x1fb4,
+ 0x1fb6, 0x1fbc,
+ 0x1fbe, 0x1fbe,
+ 0x1fc2, 0x1fc4,
+ 0x1fc6, 0x1fcc,
+ 0x1fd0, 0x1fd3,
+ 0x1fd6, 0x1fdb,
+ 0x1fe0, 0x1fec,
+ 0x1ff2, 0x1ff4,
+ 0x1ff6, 0x1ffc,
+ 0x2102, 0x2102,
+ 0x2107, 0x2107,
+ 0x210a, 0x2113,
+ 0x2115, 0x2115,
+ 0x2119, 0x211d,
+ 0x2124, 0x2124,
+ 0x2126, 0x2126,
+ 0x2128, 0x2128,
+ 0x212a, 0x212d,
+ 0x212f, 0x2134,
+ 0x2139, 0x2139,
+ 0x213c, 0x213f,
+ 0x2145, 0x2149,
+ 0x214e, 0x214e,
+ 0x2183, 0x2184,
+ 0x2c00, 0x2c2e,
+ 0x2c30, 0x2c5e,
+ 0x2c60, 0x2c7b,
+ 0x2c7e, 0x2ce4,
+ 0x2ceb, 0x2cee,
+ 0x2cf2, 0x2cf3,
+ 0x2d00, 0x2d25,
+ 0x2d27, 0x2d27,
+ 0x2d2d, 0x2d2d,
+ 0xa640, 0xa66d,
+ 0xa680, 0xa697,
+ 0xa722, 0xa76f,
+ 0xa771, 0xa787,
+ 0xa78b, 0xa78e,
+ 0xa790, 0xa793,
+ 0xa7a0, 0xa7aa,
+ 0xa7fa, 0xa7fa,
+ 0xfb00, 0xfb06,
+ 0xfb13, 0xfb17,
+ 0xff21, 0xff3a,
+ 0xff41, 0xff5a,
+ 0x10400, 0x1044f,
+ 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, 0x1d6c0,
+ 0x1d6c2, 0x1d6da,
+ 0x1d6dc, 0x1d6fa,
+ 0x1d6fc, 0x1d714,
+ 0x1d716, 0x1d734,
+ 0x1d736, 0x1d74e,
+ 0x1d750, 0x1d76e,
+ 0x1d770, 0x1d788,
+ 0x1d78a, 0x1d7a8,
+ 0x1d7aa, 0x1d7c2,
+ 0x1d7c4, 0x1d7cb,
+}; /* CR_LC */
+
/* 'Ll': General Category */
static const OnigCodePoint CR_Ll[] = {
- 609,
+ 611,
0x0061, 0x007a,
- 0x00aa, 0x00aa,
0x00b5, 0x00b5,
- 0x00ba, 0x00ba,
0x00df, 0x00f6,
0x00f8, 0x00ff,
0x0101, 0x0101,
@@ -1798,7 +6824,7 @@ static const OnigCodePoint CR_Ll[] = {
0x0527, 0x0527,
0x0561, 0x0587,
0x1d00, 0x1d2b,
- 0x1d62, 0x1d77,
+ 0x1d6b, 0x1d77,
0x1d79, 0x1d9a,
0x1e01, 0x1e01,
0x1e03, 0x1e03,
@@ -1962,7 +6988,7 @@ static const OnigCodePoint CR_Ll[] = {
0x2c6c, 0x2c6c,
0x2c71, 0x2c71,
0x2c73, 0x2c74,
- 0x2c76, 0x2c7c,
+ 0x2c76, 0x2c7b,
0x2c81, 0x2c81,
0x2c83, 0x2c83,
0x2c85, 0x2c85,
@@ -2015,7 +7041,10 @@ static const OnigCodePoint CR_Ll[] = {
0x2ce3, 0x2ce4,
0x2cec, 0x2cec,
0x2cee, 0x2cee,
+ 0x2cf3, 0x2cf3,
0x2d00, 0x2d25,
+ 0x2d27, 0x2d27,
+ 0x2d2d, 0x2d2d,
0xa641, 0xa641,
0xa643, 0xa643,
0xa645, 0xa645,
@@ -2100,6 +7129,7 @@ static const OnigCodePoint CR_Ll[] = {
0xa78c, 0xa78c,
0xa78e, 0xa78e,
0xa791, 0xa791,
+ 0xa793, 0xa793,
0xa7a1, 0xa7a1,
0xa7a3, 0xa7a3,
0xa7a5, 0xa7a5,
@@ -2142,7 +7172,7 @@ static const OnigCodePoint CR_Ll[] = {
/* 'Lm': General Category */
static const OnigCodePoint CR_Lm[] = {
- 49,
+ 52,
0x02b0, 0x02c1,
0x02c6, 0x02d1,
0x02e0, 0x02e4,
@@ -2166,13 +7196,13 @@ static const OnigCodePoint CR_Lm[] = {
0x1843, 0x1843,
0x1aa7, 0x1aa7,
0x1c78, 0x1c7d,
- 0x1d2c, 0x1d61,
+ 0x1d2c, 0x1d6a,
0x1d78, 0x1d78,
0x1d9b, 0x1dbf,
0x2071, 0x2071,
0x207f, 0x207f,
0x2090, 0x209c,
- 0x2c7d, 0x2c7d,
+ 0x2c7c, 0x2c7d,
0x2d6f, 0x2d6f,
0x2e2f, 0x2e2f,
0x3005, 0x3005,
@@ -2187,16 +7217,21 @@ static const OnigCodePoint CR_Lm[] = {
0xa717, 0xa71f,
0xa770, 0xa770,
0xa788, 0xa788,
+ 0xa7f8, 0xa7f9,
0xa9cf, 0xa9cf,
0xaa70, 0xaa70,
0xaadd, 0xaadd,
+ 0xaaf3, 0xaaf4,
0xff70, 0xff70,
0xff9e, 0xff9f,
+ 0x16f93, 0x16f9f,
}; /* CR_Lm */
/* 'Lo': General Category */
static const OnigCodePoint CR_Lo[] = {
- 323,
+ 371,
+ 0x00aa, 0x00aa,
+ 0x00ba, 0x00ba,
0x01bb, 0x01bb,
0x01c0, 0x01c3,
0x0294, 0x0294,
@@ -2217,6 +7252,8 @@ static const OnigCodePoint CR_Lo[] = {
0x07ca, 0x07ea,
0x0800, 0x0815,
0x0840, 0x0858,
+ 0x08a0, 0x08a0,
+ 0x08a2, 0x08ac,
0x0904, 0x0939,
0x093d, 0x093d,
0x0950, 0x0950,
@@ -2321,7 +7358,7 @@ static const OnigCodePoint CR_Lo[] = {
0x0eb2, 0x0eb3,
0x0ebd, 0x0ebd,
0x0ec0, 0x0ec4,
- 0x0edc, 0x0edd,
+ 0x0edc, 0x0edf,
0x0f00, 0x0f00,
0x0f40, 0x0f47,
0x0f49, 0x0f6c,
@@ -2336,7 +7373,7 @@ static const OnigCodePoint CR_Lo[] = {
0x1075, 0x1081,
0x108e, 0x108e,
0x10d0, 0x10fa,
- 0x1100, 0x1248,
+ 0x10fd, 0x1248,
0x124a, 0x124d,
0x1250, 0x1256,
0x1258, 0x1258,
@@ -2382,14 +7419,15 @@ static const OnigCodePoint CR_Lo[] = {
0x1b45, 0x1b4b,
0x1b83, 0x1ba0,
0x1bae, 0x1baf,
- 0x1bc0, 0x1be5,
+ 0x1bba, 0x1be5,
0x1c00, 0x1c23,
0x1c4d, 0x1c4f,
0x1c5a, 0x1c77,
0x1ce9, 0x1cec,
0x1cee, 0x1cf1,
+ 0x1cf5, 0x1cf6,
0x2135, 0x2138,
- 0x2d30, 0x2d65,
+ 0x2d30, 0x2d67,
0x2d80, 0x2d96,
0x2da0, 0x2da6,
0x2da8, 0x2dae,
@@ -2410,7 +7448,7 @@ static const OnigCodePoint CR_Lo[] = {
0x31a0, 0x31ba,
0x31f0, 0x31ff,
0x3400, 0x4db5,
- 0x4e00, 0x9fcb,
+ 0x4e00, 0x9fcc,
0xa000, 0xa014,
0xa016, 0xa48c,
0xa4d0, 0xa4f7,
@@ -2444,6 +7482,8 @@ static const OnigCodePoint CR_Lo[] = {
0xaac0, 0xaac0,
0xaac2, 0xaac2,
0xaadb, 0xaadc,
+ 0xaae0, 0xaaea,
+ 0xaaf2, 0xaaf2,
0xab01, 0xab06,
0xab09, 0xab0e,
0xab11, 0xab16,
@@ -2453,8 +7493,7 @@ static const OnigCodePoint CR_Lo[] = {
0xac00, 0xd7a3,
0xd7b0, 0xd7c6,
0xd7cb, 0xd7fb,
- 0xf900, 0xfa2d,
- 0xfa30, 0xfa6d,
+ 0xf900, 0xfa6d,
0xfa70, 0xfad9,
0xfb1d, 0xfb1d,
0xfb1f, 0xfb28,
@@ -2501,6 +7540,8 @@ static const OnigCodePoint CR_Lo[] = {
0x1083f, 0x10855,
0x10900, 0x10915,
0x10920, 0x10939,
+ 0x10980, 0x109b7,
+ 0x109be, 0x109bf,
0x10a00, 0x10a00,
0x10a10, 0x10a13,
0x10a15, 0x10a17,
@@ -2512,10 +7553,50 @@ static const OnigCodePoint CR_Lo[] = {
0x10c00, 0x10c48,
0x11003, 0x11037,
0x11083, 0x110af,
+ 0x110d0, 0x110e8,
+ 0x11103, 0x11126,
+ 0x11183, 0x111b2,
+ 0x111c1, 0x111c4,
+ 0x11680, 0x116aa,
0x12000, 0x1236e,
0x13000, 0x1342e,
0x16800, 0x16a38,
+ 0x16f00, 0x16f44,
+ 0x16f50, 0x16f50,
0x1b000, 0x1b001,
+ 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,
0x20000, 0x2a6d6,
0x2a700, 0x2b734,
0x2b740, 0x2b81d,
@@ -2539,7 +7620,7 @@ static const OnigCodePoint CR_Lt[] = {
/* 'Lu': General Category */
static const OnigCodePoint CR_Lu[] = {
- 603,
+ 608,
0x0041, 0x005a,
0x00c0, 0x00d6,
0x00d8, 0x00de,
@@ -2808,6 +7889,8 @@ static const OnigCodePoint CR_Lu[] = {
0x0526, 0x0526,
0x0531, 0x0556,
0x10a0, 0x10c5,
+ 0x10c7, 0x10c7,
+ 0x10cd, 0x10cd,
0x1e00, 0x1e00,
0x1e02, 0x1e02,
0x1e04, 0x1e04,
@@ -3022,6 +8105,7 @@ static const OnigCodePoint CR_Lu[] = {
0x2ce2, 0x2ce2,
0x2ceb, 0x2ceb,
0x2ced, 0x2ced,
+ 0x2cf2, 0x2cf2,
0xa640, 0xa640,
0xa642, 0xa642,
0xa644, 0xa644,
@@ -3105,11 +8189,13 @@ static const OnigCodePoint CR_Lu[] = {
0xa78b, 0xa78b,
0xa78d, 0xa78d,
0xa790, 0xa790,
+ 0xa792, 0xa792,
0xa7a0, 0xa7a0,
0xa7a2, 0xa7a2,
0xa7a4, 0xa7a4,
0xa7a6, 0xa7a6,
0xa7a8, 0xa7a8,
+ 0xa7aa, 0xa7aa,
0xff21, 0xff3a,
0x10400, 0x10427,
0x1d400, 0x1d419,
@@ -3147,7 +8233,7 @@ static const OnigCodePoint CR_Lu[] = {
/* 'M': Major Category */
static const OnigCodePoint CR_M[] = {
- 193,
+ 204,
0x0300, 0x036f,
0x0483, 0x0489,
0x0591, 0x05bd,
@@ -3171,6 +8257,7 @@ static const OnigCodePoint CR_M[] = {
0x0825, 0x0827,
0x0829, 0x082d,
0x0859, 0x085b,
+ 0x08e4, 0x08fe,
0x0900, 0x0903,
0x093a, 0x093c,
0x093e, 0x094f,
@@ -3265,7 +8352,7 @@ static const OnigCodePoint CR_M[] = {
0x1732, 0x1734,
0x1752, 0x1753,
0x1772, 0x1773,
- 0x17b6, 0x17d3,
+ 0x17b4, 0x17d3,
0x17dd, 0x17dd,
0x180b, 0x180d,
0x18a9, 0x18a9,
@@ -3281,13 +8368,13 @@ static const OnigCodePoint CR_M[] = {
0x1b34, 0x1b44,
0x1b6b, 0x1b73,
0x1b80, 0x1b82,
- 0x1ba1, 0x1baa,
+ 0x1ba1, 0x1bad,
0x1be6, 0x1bf3,
0x1c24, 0x1c37,
0x1cd0, 0x1cd2,
0x1cd4, 0x1ce8,
0x1ced, 0x1ced,
- 0x1cf2, 0x1cf2,
+ 0x1cf2, 0x1cf4,
0x1dc0, 0x1de6,
0x1dfc, 0x1dff,
0x20d0, 0x20f0,
@@ -3297,7 +8384,8 @@ static const OnigCodePoint CR_M[] = {
0x302a, 0x302f,
0x3099, 0x309a,
0xa66f, 0xa672,
- 0xa67c, 0xa67d,
+ 0xa674, 0xa67d,
+ 0xa69f, 0xa69f,
0xa6f0, 0xa6f1,
0xa802, 0xa802,
0xa806, 0xa806,
@@ -3319,6 +8407,8 @@ static const OnigCodePoint CR_M[] = {
0xaab7, 0xaab8,
0xaabe, 0xaabf,
0xaac1, 0xaac1,
+ 0xaaeb, 0xaaef,
+ 0xaaf5, 0xaaf6,
0xabe3, 0xabea,
0xabec, 0xabed,
0xfb1e, 0xfb1e,
@@ -3334,6 +8424,13 @@ static const OnigCodePoint CR_M[] = {
0x11038, 0x11046,
0x11080, 0x11082,
0x110b0, 0x110ba,
+ 0x11100, 0x11102,
+ 0x11127, 0x11134,
+ 0x11180, 0x11182,
+ 0x111b3, 0x111c0,
+ 0x116ab, 0x116b7,
+ 0x16f51, 0x16f7e,
+ 0x16f8f, 0x16f92,
0x1d165, 0x1d169,
0x1d16d, 0x1d172,
0x1d17b, 0x1d182,
@@ -3345,7 +8442,7 @@ static const OnigCodePoint CR_M[] = {
/* 'Mc': General Category */
static const OnigCodePoint CR_Mc[] = {
- 113,
+ 126,
0x0903, 0x0903,
0x093b, 0x093b,
0x093e, 0x0940,
@@ -3427,6 +8524,7 @@ static const OnigCodePoint CR_Mc[] = {
0x1ba1, 0x1ba1,
0x1ba6, 0x1ba7,
0x1baa, 0x1baa,
+ 0x1bac, 0x1bad,
0x1be7, 0x1be7,
0x1bea, 0x1bec,
0x1bee, 0x1bee,
@@ -3434,7 +8532,8 @@ static const OnigCodePoint CR_Mc[] = {
0x1c24, 0x1c2b,
0x1c34, 0x1c35,
0x1ce1, 0x1ce1,
- 0x1cf2, 0x1cf2,
+ 0x1cf2, 0x1cf3,
+ 0x302e, 0x302f,
0xa823, 0xa824,
0xa827, 0xa827,
0xa880, 0xa881,
@@ -3448,6 +8547,9 @@ static const OnigCodePoint CR_Mc[] = {
0xaa33, 0xaa34,
0xaa4d, 0xaa4d,
0xaa7b, 0xaa7b,
+ 0xaaeb, 0xaaeb,
+ 0xaaee, 0xaaef,
+ 0xaaf5, 0xaaf5,
0xabe3, 0xabe4,
0xabe6, 0xabe7,
0xabe9, 0xabea,
@@ -3457,6 +8559,14 @@ static const OnigCodePoint CR_Mc[] = {
0x11082, 0x11082,
0x110b0, 0x110b2,
0x110b7, 0x110b8,
+ 0x1112c, 0x1112c,
+ 0x11182, 0x11182,
+ 0x111b3, 0x111b5,
+ 0x111bf, 0x111c0,
+ 0x116ac, 0x116ac,
+ 0x116ae, 0x116af,
+ 0x116b6, 0x116b6,
+ 0x16f51, 0x16f7e,
0x1d165, 0x1d166,
0x1d16d, 0x1d172,
}; /* CR_Mc */
@@ -3472,7 +8582,7 @@ static const OnigCodePoint CR_Me[] = {
/* 'Mn': General Category */
static const OnigCodePoint CR_Mn[] = {
- 203,
+ 220,
0x0300, 0x036f,
0x0483, 0x0487,
0x0591, 0x05bd,
@@ -3496,6 +8606,7 @@ static const OnigCodePoint CR_Mn[] = {
0x0825, 0x0827,
0x0829, 0x082d,
0x0859, 0x085b,
+ 0x08e4, 0x08fe,
0x0900, 0x0902,
0x093a, 0x093a,
0x093c, 0x093c,
@@ -3581,6 +8692,7 @@ static const OnigCodePoint CR_Mn[] = {
0x1732, 0x1734,
0x1752, 0x1753,
0x1772, 0x1773,
+ 0x17b4, 0x17b5,
0x17b7, 0x17bd,
0x17c6, 0x17c6,
0x17c9, 0x17d3,
@@ -3608,6 +8720,7 @@ static const OnigCodePoint CR_Mn[] = {
0x1b80, 0x1b81,
0x1ba2, 0x1ba5,
0x1ba8, 0x1ba9,
+ 0x1bab, 0x1bab,
0x1be6, 0x1be6,
0x1be8, 0x1be9,
0x1bed, 0x1bed,
@@ -3618,6 +8731,7 @@ static const OnigCodePoint CR_Mn[] = {
0x1cd4, 0x1ce0,
0x1ce2, 0x1ce8,
0x1ced, 0x1ced,
+ 0x1cf4, 0x1cf4,
0x1dc0, 0x1de6,
0x1dfc, 0x1dff,
0x20d0, 0x20dc,
@@ -3626,10 +8740,11 @@ static const OnigCodePoint CR_Mn[] = {
0x2cef, 0x2cf1,
0x2d7f, 0x2d7f,
0x2de0, 0x2dff,
- 0x302a, 0x302f,
+ 0x302a, 0x302d,
0x3099, 0x309a,
0xa66f, 0xa66f,
- 0xa67c, 0xa67d,
+ 0xa674, 0xa67d,
+ 0xa69f, 0xa69f,
0xa6f0, 0xa6f1,
0xa802, 0xa802,
0xa806, 0xa806,
@@ -3653,6 +8768,8 @@ static const OnigCodePoint CR_Mn[] = {
0xaab7, 0xaab8,
0xaabe, 0xaabf,
0xaac1, 0xaac1,
+ 0xaaec, 0xaaed,
+ 0xaaf6, 0xaaf6,
0xabe5, 0xabe5,
0xabe8, 0xabe8,
0xabed, 0xabed,
@@ -3670,6 +8787,16 @@ static const OnigCodePoint CR_Mn[] = {
0x11080, 0x11081,
0x110b3, 0x110b6,
0x110b9, 0x110ba,
+ 0x11100, 0x11102,
+ 0x11127, 0x1112b,
+ 0x1112d, 0x11134,
+ 0x11180, 0x11181,
+ 0x111b6, 0x111be,
+ 0x116ab, 0x116ab,
+ 0x116ad, 0x116ad,
+ 0x116b0, 0x116b5,
+ 0x116b7, 0x116b7,
+ 0x16f8f, 0x16f92,
0x1d167, 0x1d169,
0x1d17b, 0x1d182,
0x1d185, 0x1d18b,
@@ -3680,7 +8807,7 @@ static const OnigCodePoint CR_Mn[] = {
/* 'N': Major Category */
static const OnigCodePoint CR_N[] = {
- 83,
+ 88,
0x0030, 0x0039,
0x00b2, 0x00b3,
0x00b9, 0x00b9,
@@ -3732,6 +8859,7 @@ static const OnigCodePoint CR_N[] = {
0x3038, 0x303a,
0x3192, 0x3195,
0x3220, 0x3229,
+ 0x3248, 0x324f,
0x3251, 0x325f,
0x3280, 0x3289,
0x32b1, 0x32bf,
@@ -3760,6 +8888,10 @@ static const OnigCodePoint CR_N[] = {
0x10b78, 0x10b7f,
0x10e60, 0x10e7e,
0x11052, 0x1106f,
+ 0x110f0, 0x110f9,
+ 0x11136, 0x1113f,
+ 0x111d0, 0x111d9,
+ 0x116c0, 0x116c9,
0x12400, 0x12462,
0x1d360, 0x1d371,
0x1d7ce, 0x1d7ff,
@@ -3767,47 +8899,7 @@ static const OnigCodePoint CR_N[] = {
}; /* CR_N */
/* 'Nd': General Category */
-static const OnigCodePoint CR_Nd[] = {
- 38,
- 0x0030, 0x0039,
- 0x0660, 0x0669,
- 0x06f0, 0x06f9,
- 0x07c0, 0x07c9,
- 0x0966, 0x096f,
- 0x09e6, 0x09ef,
- 0x0a66, 0x0a6f,
- 0x0ae6, 0x0aef,
- 0x0b66, 0x0b6f,
- 0x0be6, 0x0bef,
- 0x0c66, 0x0c6f,
- 0x0ce6, 0x0cef,
- 0x0d66, 0x0d6f,
- 0x0e50, 0x0e59,
- 0x0ed0, 0x0ed9,
- 0x0f20, 0x0f29,
- 0x1040, 0x1049,
- 0x1090, 0x1099,
- 0x17e0, 0x17e9,
- 0x1810, 0x1819,
- 0x1946, 0x194f,
- 0x19d0, 0x19d9,
- 0x1a80, 0x1a89,
- 0x1a90, 0x1a99,
- 0x1b50, 0x1b59,
- 0x1bb0, 0x1bb9,
- 0x1c40, 0x1c49,
- 0x1c50, 0x1c59,
- 0xa620, 0xa629,
- 0xa8d0, 0xa8d9,
- 0xa900, 0xa909,
- 0xa9d0, 0xa9d9,
- 0xaa50, 0xaa59,
- 0xabf0, 0xabf9,
- 0xff10, 0xff19,
- 0x104a0, 0x104a9,
- 0x11066, 0x1106f,
- 0x1d7ce, 0x1d7ff,
-}; /* CR_Nd */
+#define CR_Nd CR_Digit
/* 'Nl': General Category */
static const OnigCodePoint CR_Nl[] = {
@@ -3828,7 +8920,7 @@ static const OnigCodePoint CR_Nl[] = {
/* 'No': General Category */
static const OnigCodePoint CR_No[] = {
- 41,
+ 42,
0x00b2, 0x00b3,
0x00b9, 0x00b9,
0x00bc, 0x00be,
@@ -3852,6 +8944,7 @@ static const OnigCodePoint CR_No[] = {
0x2cfd, 0x2cfd,
0x3192, 0x3195,
0x3220, 0x3229,
+ 0x3248, 0x324f,
0x3251, 0x325f,
0x3280, 0x3289,
0x32b1, 0x32bf,
@@ -3873,142 +8966,7 @@ static const OnigCodePoint CR_No[] = {
}; /* CR_No */
/* 'P': Major Category */
-static const OnigCodePoint CR_P[] = {
- 133,
- 0x0021, 0x0023,
- 0x0025, 0x002a,
- 0x002c, 0x002f,
- 0x003a, 0x003b,
- 0x003f, 0x0040,
- 0x005b, 0x005d,
- 0x005f, 0x005f,
- 0x007b, 0x007b,
- 0x007d, 0x007d,
- 0x00a1, 0x00a1,
- 0x00ab, 0x00ab,
- 0x00b7, 0x00b7,
- 0x00bb, 0x00bb,
- 0x00bf, 0x00bf,
- 0x037e, 0x037e,
- 0x0387, 0x0387,
- 0x055a, 0x055f,
- 0x0589, 0x058a,
- 0x05be, 0x05be,
- 0x05c0, 0x05c0,
- 0x05c3, 0x05c3,
- 0x05c6, 0x05c6,
- 0x05f3, 0x05f4,
- 0x0609, 0x060a,
- 0x060c, 0x060d,
- 0x061b, 0x061b,
- 0x061e, 0x061f,
- 0x066a, 0x066d,
- 0x06d4, 0x06d4,
- 0x0700, 0x070d,
- 0x07f7, 0x07f9,
- 0x0830, 0x083e,
- 0x085e, 0x085e,
- 0x0964, 0x0965,
- 0x0970, 0x0970,
- 0x0df4, 0x0df4,
- 0x0e4f, 0x0e4f,
- 0x0e5a, 0x0e5b,
- 0x0f04, 0x0f12,
- 0x0f3a, 0x0f3d,
- 0x0f85, 0x0f85,
- 0x0fd0, 0x0fd4,
- 0x0fd9, 0x0fda,
- 0x104a, 0x104f,
- 0x10fb, 0x10fb,
- 0x1361, 0x1368,
- 0x1400, 0x1400,
- 0x166d, 0x166e,
- 0x169b, 0x169c,
- 0x16eb, 0x16ed,
- 0x1735, 0x1736,
- 0x17d4, 0x17d6,
- 0x17d8, 0x17da,
- 0x1800, 0x180a,
- 0x1944, 0x1945,
- 0x1a1e, 0x1a1f,
- 0x1aa0, 0x1aa6,
- 0x1aa8, 0x1aad,
- 0x1b5a, 0x1b60,
- 0x1bfc, 0x1bff,
- 0x1c3b, 0x1c3f,
- 0x1c7e, 0x1c7f,
- 0x1cd3, 0x1cd3,
- 0x2010, 0x2027,
- 0x2030, 0x2043,
- 0x2045, 0x2051,
- 0x2053, 0x205e,
- 0x207d, 0x207e,
- 0x208d, 0x208e,
- 0x2329, 0x232a,
- 0x2768, 0x2775,
- 0x27c5, 0x27c6,
- 0x27e6, 0x27ef,
- 0x2983, 0x2998,
- 0x29d8, 0x29db,
- 0x29fc, 0x29fd,
- 0x2cf9, 0x2cfc,
- 0x2cfe, 0x2cff,
- 0x2d70, 0x2d70,
- 0x2e00, 0x2e2e,
- 0x2e30, 0x2e31,
- 0x3001, 0x3003,
- 0x3008, 0x3011,
- 0x3014, 0x301f,
- 0x3030, 0x3030,
- 0x303d, 0x303d,
- 0x30a0, 0x30a0,
- 0x30fb, 0x30fb,
- 0xa4fe, 0xa4ff,
- 0xa60d, 0xa60f,
- 0xa673, 0xa673,
- 0xa67e, 0xa67e,
- 0xa6f2, 0xa6f7,
- 0xa874, 0xa877,
- 0xa8ce, 0xa8cf,
- 0xa8f8, 0xa8fa,
- 0xa92e, 0xa92f,
- 0xa95f, 0xa95f,
- 0xa9c1, 0xa9cd,
- 0xa9de, 0xa9df,
- 0xaa5c, 0xaa5f,
- 0xaade, 0xaadf,
- 0xabeb, 0xabeb,
- 0xfd3e, 0xfd3f,
- 0xfe10, 0xfe19,
- 0xfe30, 0xfe52,
- 0xfe54, 0xfe61,
- 0xfe63, 0xfe63,
- 0xfe68, 0xfe68,
- 0xfe6a, 0xfe6b,
- 0xff01, 0xff03,
- 0xff05, 0xff0a,
- 0xff0c, 0xff0f,
- 0xff1a, 0xff1b,
- 0xff1f, 0xff20,
- 0xff3b, 0xff3d,
- 0xff3f, 0xff3f,
- 0xff5b, 0xff5b,
- 0xff5d, 0xff5d,
- 0xff5f, 0xff65,
- 0x10100, 0x10101,
- 0x1039f, 0x1039f,
- 0x103d0, 0x103d0,
- 0x10857, 0x10857,
- 0x1091f, 0x1091f,
- 0x1093f, 0x1093f,
- 0x10a50, 0x10a58,
- 0x10a7f, 0x10a7f,
- 0x10b39, 0x10b3f,
- 0x11047, 0x1104d,
- 0x110bb, 0x110bc,
- 0x110be, 0x110c1,
- 0x12470, 0x12473,
-}; /* CR_P */
+#define CR_P CR_Punct
/* 'Pc': General Category */
static const OnigCodePoint CR_Pc[] = {
@@ -4023,7 +8981,7 @@ static const OnigCodePoint CR_Pc[] = {
/* 'Pd': General Category */
static const OnigCodePoint CR_Pd[] = {
- 15,
+ 16,
0x002d, 0x002d,
0x058a, 0x058a,
0x05be, 0x05be,
@@ -4032,6 +8990,7 @@ static const OnigCodePoint CR_Pd[] = {
0x2010, 0x2015,
0x2e17, 0x2e17,
0x2e1a, 0x2e1a,
+ 0x2e3a, 0x2e3b,
0x301c, 0x301c,
0x3030, 0x3030,
0x30a0, 0x30a0,
@@ -4149,7 +9108,7 @@ static const OnigCodePoint CR_Pi[] = {
/* 'Po': General Category */
static const OnigCodePoint CR_Po[] = {
- 128,
+ 135,
0x0021, 0x0023,
0x0025, 0x0027,
0x002a, 0x002a,
@@ -4159,7 +9118,8 @@ static const OnigCodePoint CR_Po[] = {
0x003f, 0x0040,
0x005c, 0x005c,
0x00a1, 0x00a1,
- 0x00b7, 0x00b7,
+ 0x00a7, 0x00a7,
+ 0x00b6, 0x00b7,
0x00bf, 0x00bf,
0x037e, 0x037e,
0x0387, 0x0387,
@@ -4181,16 +9141,18 @@ static const OnigCodePoint CR_Po[] = {
0x085e, 0x085e,
0x0964, 0x0965,
0x0970, 0x0970,
+ 0x0af0, 0x0af0,
0x0df4, 0x0df4,
0x0e4f, 0x0e4f,
0x0e5a, 0x0e5b,
0x0f04, 0x0f12,
+ 0x0f14, 0x0f14,
0x0f85, 0x0f85,
0x0fd0, 0x0fd4,
0x0fd9, 0x0fda,
0x104a, 0x104f,
0x10fb, 0x10fb,
- 0x1361, 0x1368,
+ 0x1360, 0x1368,
0x166d, 0x166e,
0x16eb, 0x16ed,
0x1735, 0x1736,
@@ -4206,6 +9168,7 @@ static const OnigCodePoint CR_Po[] = {
0x1bfc, 0x1bff,
0x1c3b, 0x1c3f,
0x1c7e, 0x1c7f,
+ 0x1cc0, 0x1cc7,
0x1cd3, 0x1cd3,
0x2016, 0x2017,
0x2020, 0x2027,
@@ -4226,7 +9189,7 @@ static const OnigCodePoint CR_Po[] = {
0x2e1b, 0x2e1b,
0x2e1e, 0x2e1f,
0x2e2a, 0x2e2e,
- 0x2e30, 0x2e31,
+ 0x2e30, 0x2e39,
0x3001, 0x3003,
0x303d, 0x303d,
0x30fb, 0x30fb,
@@ -4244,6 +9207,7 @@ static const OnigCodePoint CR_Po[] = {
0xa9de, 0xa9df,
0xaa5c, 0xaa5f,
0xaade, 0xaadf,
+ 0xaaf0, 0xaaf1,
0xabeb, 0xabeb,
0xfe10, 0xfe16,
0xfe19, 0xfe19,
@@ -4265,7 +9229,7 @@ static const OnigCodePoint CR_Po[] = {
0xff3c, 0xff3c,
0xff61, 0xff61,
0xff64, 0xff65,
- 0x10100, 0x10101,
+ 0x10100, 0x10102,
0x1039f, 0x1039f,
0x103d0, 0x103d0,
0x10857, 0x10857,
@@ -4277,6 +9241,8 @@ static const OnigCodePoint CR_Po[] = {
0x11047, 0x1104d,
0x110bb, 0x110bc,
0x110be, 0x110c1,
+ 0x11140, 0x11143,
+ 0x111c5, 0x111c8,
0x12470, 0x12473,
}; /* CR_Po */
@@ -4359,7 +9325,7 @@ static const OnigCodePoint CR_Ps[] = {
/* 'S': Major Category */
static const OnigCodePoint CR_S[] = {
- 208,
+ 198,
0x0024, 0x0024,
0x002b, 0x002b,
0x003c, 0x003e,
@@ -4367,11 +9333,11 @@ static const OnigCodePoint CR_S[] = {
0x0060, 0x0060,
0x007c, 0x007c,
0x007e, 0x007e,
- 0x00a2, 0x00a9,
+ 0x00a2, 0x00a6,
+ 0x00a8, 0x00a9,
0x00ac, 0x00ac,
0x00ae, 0x00b1,
0x00b4, 0x00b4,
- 0x00b6, 0x00b6,
0x00b8, 0x00b8,
0x00d7, 0x00d7,
0x00f7, 0x00f7,
@@ -4384,6 +9350,7 @@ static const OnigCodePoint CR_S[] = {
0x0384, 0x0385,
0x03f6, 0x03f6,
0x0482, 0x0482,
+ 0x058f, 0x058f,
0x0606, 0x0608,
0x060b, 0x060b,
0x060e, 0x060f,
@@ -4400,7 +9367,8 @@ static const OnigCodePoint CR_S[] = {
0x0d79, 0x0d79,
0x0e3f, 0x0e3f,
0x0f01, 0x0f03,
- 0x0f13, 0x0f17,
+ 0x0f13, 0x0f13,
+ 0x0f15, 0x0f17,
0x0f1a, 0x0f1f,
0x0f34, 0x0f34,
0x0f36, 0x0f36,
@@ -4410,7 +9378,6 @@ static const OnigCodePoint CR_S[] = {
0x0fce, 0x0fcf,
0x0fd5, 0x0fd8,
0x109e, 0x109f,
- 0x1360, 0x1360,
0x1390, 0x1399,
0x17db, 0x17db,
0x1940, 0x1940,
@@ -4450,9 +9417,7 @@ static const OnigCodePoint CR_S[] = {
0x2500, 0x26ff,
0x2701, 0x2767,
0x2794, 0x27c4,
- 0x27c7, 0x27ca,
- 0x27cc, 0x27cc,
- 0x27ce, 0x27e5,
+ 0x27c7, 0x27e5,
0x27f0, 0x2982,
0x2999, 0x29d7,
0x29dc, 0x29fb,
@@ -4473,7 +9438,8 @@ static const OnigCodePoint CR_S[] = {
0x3196, 0x319f,
0x31c0, 0x31e3,
0x3200, 0x321e,
- 0x322a, 0x3250,
+ 0x322a, 0x3247,
+ 0x3250, 0x3250,
0x3260, 0x327f,
0x328a, 0x32b0,
0x32c0, 0x32fe,
@@ -4502,7 +9468,6 @@ static const OnigCodePoint CR_S[] = {
0xffe0, 0xffe6,
0xffe8, 0xffee,
0xfffc, 0xfffd,
- 0x10102, 0x10102,
0x10137, 0x1013f,
0x10179, 0x10189,
0x10190, 0x1019b,
@@ -4527,6 +9492,7 @@ static const OnigCodePoint CR_S[] = {
0x1d789, 0x1d789,
0x1d7a9, 0x1d7a9,
0x1d7c3, 0x1d7c3,
+ 0x1eef0, 0x1eef1,
0x1f000, 0x1f02b,
0x1f030, 0x1f093,
0x1f0a0, 0x1f0ae,
@@ -4534,7 +9500,7 @@ static const OnigCodePoint CR_S[] = {
0x1f0c1, 0x1f0cf,
0x1f0d1, 0x1f0df,
0x1f110, 0x1f12e,
- 0x1f130, 0x1f169,
+ 0x1f130, 0x1f16b,
0x1f170, 0x1f19a,
0x1f1e6, 0x1f202,
0x1f210, 0x1f23a,
@@ -4552,19 +9518,9 @@ static const OnigCodePoint CR_S[] = {
0x1f442, 0x1f4f7,
0x1f4f9, 0x1f4fc,
0x1f500, 0x1f53d,
+ 0x1f540, 0x1f543,
0x1f550, 0x1f567,
- 0x1f5fb, 0x1f5ff,
- 0x1f601, 0x1f610,
- 0x1f612, 0x1f614,
- 0x1f616, 0x1f616,
- 0x1f618, 0x1f618,
- 0x1f61a, 0x1f61a,
- 0x1f61c, 0x1f61e,
- 0x1f620, 0x1f625,
- 0x1f628, 0x1f62b,
- 0x1f62d, 0x1f62d,
- 0x1f630, 0x1f633,
- 0x1f635, 0x1f640,
+ 0x1f5fb, 0x1f640,
0x1f645, 0x1f64f,
0x1f680, 0x1f6c5,
0x1f700, 0x1f773,
@@ -4572,9 +9528,10 @@ static const OnigCodePoint CR_S[] = {
/* 'Sc': General Category */
static const OnigCodePoint CR_Sc[] = {
- 16,
+ 17,
0x0024, 0x0024,
0x00a2, 0x00a5,
+ 0x058f, 0x058f,
0x060b, 0x060b,
0x09f2, 0x09f3,
0x09fb, 0x09fb,
@@ -4625,7 +9582,7 @@ static const OnigCodePoint CR_Sk[] = {
/* 'Sm': General Category */
static const OnigCodePoint CR_Sm[] = {
- 66,
+ 65,
0x002b, 0x002b,
0x003c, 0x003e,
0x007c, 0x007c,
@@ -4663,9 +9620,7 @@ static const OnigCodePoint CR_Sm[] = {
0x25f8, 0x25ff,
0x266f, 0x266f,
0x27c0, 0x27c4,
- 0x27c7, 0x27ca,
- 0x27cc, 0x27cc,
- 0x27ce, 0x27e5,
+ 0x27c7, 0x27e5,
0x27f0, 0x27ff,
0x2900, 0x2982,
0x2999, 0x29d7,
@@ -4692,16 +9647,16 @@ static const OnigCodePoint CR_Sm[] = {
0x1d789, 0x1d789,
0x1d7a9, 0x1d7a9,
0x1d7c3, 0x1d7c3,
+ 0x1eef0, 0x1eef1,
}; /* CR_Sm */
/* 'So': General Category */
static const OnigCodePoint CR_So[] = {
- 164,
- 0x00a6, 0x00a7,
+ 153,
+ 0x00a6, 0x00a6,
0x00a9, 0x00a9,
0x00ae, 0x00ae,
0x00b0, 0x00b0,
- 0x00b6, 0x00b6,
0x0482, 0x0482,
0x060e, 0x060f,
0x06de, 0x06de,
@@ -4715,7 +9670,8 @@ static const OnigCodePoint CR_So[] = {
0x0c7f, 0x0c7f,
0x0d79, 0x0d79,
0x0f01, 0x0f03,
- 0x0f13, 0x0f17,
+ 0x0f13, 0x0f13,
+ 0x0f15, 0x0f17,
0x0f1a, 0x0f1f,
0x0f34, 0x0f34,
0x0f36, 0x0f36,
@@ -4725,7 +9681,6 @@ static const OnigCodePoint CR_So[] = {
0x0fce, 0x0fcf,
0x0fd5, 0x0fd8,
0x109e, 0x109f,
- 0x1360, 0x1360,
0x1390, 0x1399,
0x1940, 0x1940,
0x19de, 0x19ff,
@@ -4789,7 +9744,8 @@ static const OnigCodePoint CR_So[] = {
0x3196, 0x319f,
0x31c0, 0x31e3,
0x3200, 0x321e,
- 0x322a, 0x3250,
+ 0x322a, 0x3247,
+ 0x3250, 0x3250,
0x3260, 0x327f,
0x328a, 0x32b0,
0x32c0, 0x32fe,
@@ -4805,7 +9761,6 @@ static const OnigCodePoint CR_So[] = {
0xffe8, 0xffe8,
0xffed, 0xffee,
0xfffc, 0xfffd,
- 0x10102, 0x10102,
0x10137, 0x1013f,
0x10179, 0x10189,
0x10190, 0x1019b,
@@ -4827,7 +9782,7 @@ static const OnigCodePoint CR_So[] = {
0x1f0c1, 0x1f0cf,
0x1f0d1, 0x1f0df,
0x1f110, 0x1f12e,
- 0x1f130, 0x1f169,
+ 0x1f130, 0x1f16b,
0x1f170, 0x1f19a,
0x1f1e6, 0x1f202,
0x1f210, 0x1f23a,
@@ -4845,19 +9800,9 @@ static const OnigCodePoint CR_So[] = {
0x1f442, 0x1f4f7,
0x1f4f9, 0x1f4fc,
0x1f500, 0x1f53d,
+ 0x1f540, 0x1f543,
0x1f550, 0x1f567,
- 0x1f5fb, 0x1f5ff,
- 0x1f601, 0x1f610,
- 0x1f612, 0x1f614,
- 0x1f616, 0x1f616,
- 0x1f618, 0x1f618,
- 0x1f61a, 0x1f61a,
- 0x1f61c, 0x1f61e,
- 0x1f620, 0x1f625,
- 0x1f628, 0x1f62b,
- 0x1f62d, 0x1f62d,
- 0x1f630, 0x1f633,
- 0x1f635, 0x1f640,
+ 0x1f5fb, 0x1f640,
0x1f645, 0x1f64f,
0x1f680, 0x1f6c5,
0x1f700, 0x1f773,
@@ -4904,7 +9849,7 @@ static const OnigCodePoint CR_Zs[] = {
/* 'Math': Derived Property */
static const OnigCodePoint CR_Math[] = {
- 106,
+ 138,
0x002b, 0x002b,
0x003c, 0x003e,
0x005e, 0x005e,
@@ -4973,9 +9918,7 @@ static const OnigCodePoint CR_Math[] = {
0x2642, 0x2642,
0x2660, 0x2663,
0x266d, 0x266f,
- 0x27c0, 0x27ca,
- 0x27cc, 0x27cc,
- 0x27ce, 0x27ff,
+ 0x27c0, 0x27ff,
0x2900, 0x2aff,
0x2b30, 0x2b44,
0x2b47, 0x2b4c,
@@ -5011,1729 +9954,54 @@ static const OnigCodePoint CR_Math[] = {
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,
}; /* CR_Math */
/* 'Alphabetic': Derived Property */
-static const OnigCodePoint CR_Alphabetic[] = {
- 486,
- 0x0041, 0x005a,
- 0x0061, 0x007a,
- 0x00aa, 0x00aa,
- 0x00b5, 0x00b5,
- 0x00ba, 0x00ba,
- 0x00c0, 0x00d6,
- 0x00d8, 0x00f6,
- 0x00f8, 0x02c1,
- 0x02c6, 0x02d1,
- 0x02e0, 0x02e4,
- 0x02ec, 0x02ec,
- 0x02ee, 0x02ee,
- 0x0345, 0x0345,
- 0x0370, 0x0374,
- 0x0376, 0x0377,
- 0x037a, 0x037d,
- 0x0386, 0x0386,
- 0x0388, 0x038a,
- 0x038c, 0x038c,
- 0x038e, 0x03a1,
- 0x03a3, 0x03f5,
- 0x03f7, 0x0481,
- 0x048a, 0x0527,
- 0x0531, 0x0556,
- 0x0559, 0x0559,
- 0x0561, 0x0587,
- 0x05b0, 0x05bd,
- 0x05bf, 0x05bf,
- 0x05c1, 0x05c2,
- 0x05c4, 0x05c5,
- 0x05c7, 0x05c7,
- 0x05d0, 0x05ea,
- 0x05f0, 0x05f2,
- 0x0610, 0x061a,
- 0x0620, 0x0657,
- 0x0659, 0x065f,
- 0x066e, 0x06d3,
- 0x06d5, 0x06dc,
- 0x06e1, 0x06e8,
- 0x06ed, 0x06ef,
- 0x06fa, 0x06fc,
- 0x06ff, 0x06ff,
- 0x0710, 0x073f,
- 0x074d, 0x07b1,
- 0x07ca, 0x07ea,
- 0x07f4, 0x07f5,
- 0x07fa, 0x07fa,
- 0x0800, 0x0817,
- 0x081a, 0x082c,
- 0x0840, 0x0858,
- 0x0900, 0x093b,
- 0x093d, 0x094c,
- 0x094e, 0x0950,
- 0x0955, 0x0963,
- 0x0971, 0x0977,
- 0x0979, 0x097f,
- 0x0981, 0x0983,
- 0x0985, 0x098c,
- 0x098f, 0x0990,
- 0x0993, 0x09a8,
- 0x09aa, 0x09b0,
- 0x09b2, 0x09b2,
- 0x09b6, 0x09b9,
- 0x09bd, 0x09c4,
- 0x09c7, 0x09c8,
- 0x09cb, 0x09cc,
- 0x09ce, 0x09ce,
- 0x09d7, 0x09d7,
- 0x09dc, 0x09dd,
- 0x09df, 0x09e3,
- 0x09f0, 0x09f1,
- 0x0a01, 0x0a03,
- 0x0a05, 0x0a0a,
- 0x0a0f, 0x0a10,
- 0x0a13, 0x0a28,
- 0x0a2a, 0x0a30,
- 0x0a32, 0x0a33,
- 0x0a35, 0x0a36,
- 0x0a38, 0x0a39,
- 0x0a3e, 0x0a42,
- 0x0a47, 0x0a48,
- 0x0a4b, 0x0a4c,
- 0x0a51, 0x0a51,
- 0x0a59, 0x0a5c,
- 0x0a5e, 0x0a5e,
- 0x0a70, 0x0a75,
- 0x0a81, 0x0a83,
- 0x0a85, 0x0a8d,
- 0x0a8f, 0x0a91,
- 0x0a93, 0x0aa8,
- 0x0aaa, 0x0ab0,
- 0x0ab2, 0x0ab3,
- 0x0ab5, 0x0ab9,
- 0x0abd, 0x0ac5,
- 0x0ac7, 0x0ac9,
- 0x0acb, 0x0acc,
- 0x0ad0, 0x0ad0,
- 0x0ae0, 0x0ae3,
- 0x0b01, 0x0b03,
- 0x0b05, 0x0b0c,
- 0x0b0f, 0x0b10,
- 0x0b13, 0x0b28,
- 0x0b2a, 0x0b30,
- 0x0b32, 0x0b33,
- 0x0b35, 0x0b39,
- 0x0b3d, 0x0b44,
- 0x0b47, 0x0b48,
- 0x0b4b, 0x0b4c,
- 0x0b56, 0x0b57,
- 0x0b5c, 0x0b5d,
- 0x0b5f, 0x0b63,
- 0x0b71, 0x0b71,
- 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, 0x0bcc,
- 0x0bd0, 0x0bd0,
- 0x0bd7, 0x0bd7,
- 0x0c01, 0x0c03,
- 0x0c05, 0x0c0c,
- 0x0c0e, 0x0c10,
- 0x0c12, 0x0c28,
- 0x0c2a, 0x0c33,
- 0x0c35, 0x0c39,
- 0x0c3d, 0x0c44,
- 0x0c46, 0x0c48,
- 0x0c4a, 0x0c4c,
- 0x0c55, 0x0c56,
- 0x0c58, 0x0c59,
- 0x0c60, 0x0c63,
- 0x0c82, 0x0c83,
- 0x0c85, 0x0c8c,
- 0x0c8e, 0x0c90,
- 0x0c92, 0x0ca8,
- 0x0caa, 0x0cb3,
- 0x0cb5, 0x0cb9,
- 0x0cbd, 0x0cc4,
- 0x0cc6, 0x0cc8,
- 0x0cca, 0x0ccc,
- 0x0cd5, 0x0cd6,
- 0x0cde, 0x0cde,
- 0x0ce0, 0x0ce3,
- 0x0cf1, 0x0cf2,
- 0x0d02, 0x0d03,
- 0x0d05, 0x0d0c,
- 0x0d0e, 0x0d10,
- 0x0d12, 0x0d3a,
- 0x0d3d, 0x0d44,
- 0x0d46, 0x0d48,
- 0x0d4a, 0x0d4c,
- 0x0d4e, 0x0d4e,
- 0x0d57, 0x0d57,
- 0x0d60, 0x0d63,
- 0x0d7a, 0x0d7f,
- 0x0d82, 0x0d83,
- 0x0d85, 0x0d96,
- 0x0d9a, 0x0db1,
- 0x0db3, 0x0dbb,
- 0x0dbd, 0x0dbd,
- 0x0dc0, 0x0dc6,
- 0x0dcf, 0x0dd4,
- 0x0dd6, 0x0dd6,
- 0x0dd8, 0x0ddf,
- 0x0df2, 0x0df3,
- 0x0e01, 0x0e3a,
- 0x0e40, 0x0e46,
- 0x0e4d, 0x0e4d,
- 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,
- 0x0ecd, 0x0ecd,
- 0x0edc, 0x0edd,
- 0x0f00, 0x0f00,
- 0x0f40, 0x0f47,
- 0x0f49, 0x0f6c,
- 0x0f71, 0x0f81,
- 0x0f88, 0x0f97,
- 0x0f99, 0x0fbc,
- 0x1000, 0x1036,
- 0x1038, 0x1038,
- 0x103b, 0x103f,
- 0x1050, 0x1062,
- 0x1065, 0x1068,
- 0x106e, 0x1086,
- 0x108e, 0x108e,
- 0x109c, 0x109d,
- 0x10a0, 0x10c5,
- 0x10d0, 0x10fa,
- 0x10fc, 0x10fc,
- 0x1100, 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,
- 0x135f, 0x135f,
- 0x1380, 0x138f,
- 0x13a0, 0x13f4,
- 0x1401, 0x166c,
- 0x166f, 0x167f,
- 0x1681, 0x169a,
- 0x16a0, 0x16ea,
- 0x16ee, 0x16f0,
- 0x1700, 0x170c,
- 0x170e, 0x1713,
- 0x1720, 0x1733,
- 0x1740, 0x1753,
- 0x1760, 0x176c,
- 0x176e, 0x1770,
- 0x1772, 0x1773,
- 0x1780, 0x17b3,
- 0x17b6, 0x17c8,
- 0x17d7, 0x17d7,
- 0x17dc, 0x17dc,
- 0x1820, 0x1877,
- 0x1880, 0x18aa,
- 0x18b0, 0x18f5,
- 0x1900, 0x191c,
- 0x1920, 0x192b,
- 0x1930, 0x1938,
- 0x1950, 0x196d,
- 0x1970, 0x1974,
- 0x1980, 0x19ab,
- 0x19b0, 0x19c9,
- 0x1a00, 0x1a1b,
- 0x1a20, 0x1a5e,
- 0x1a61, 0x1a74,
- 0x1aa7, 0x1aa7,
- 0x1b00, 0x1b33,
- 0x1b35, 0x1b43,
- 0x1b45, 0x1b4b,
- 0x1b80, 0x1ba9,
- 0x1bae, 0x1baf,
- 0x1bc0, 0x1be5,
- 0x1be7, 0x1bf1,
- 0x1c00, 0x1c35,
- 0x1c4d, 0x1c4f,
- 0x1c5a, 0x1c7d,
- 0x1ce9, 0x1cec,
- 0x1cee, 0x1cf2,
- 0x1d00, 0x1dbf,
- 0x1e00, 0x1f15,
- 0x1f18, 0x1f1d,
- 0x1f20, 0x1f45,
- 0x1f48, 0x1f4d,
- 0x1f50, 0x1f57,
- 0x1f59, 0x1f59,
- 0x1f5b, 0x1f5b,
- 0x1f5d, 0x1f5d,
- 0x1f5f, 0x1f7d,
- 0x1f80, 0x1fb4,
- 0x1fb6, 0x1fbc,
- 0x1fbe, 0x1fbe,
- 0x1fc2, 0x1fc4,
- 0x1fc6, 0x1fcc,
- 0x1fd0, 0x1fd3,
- 0x1fd6, 0x1fdb,
- 0x1fe0, 0x1fec,
- 0x1ff2, 0x1ff4,
- 0x1ff6, 0x1ffc,
- 0x2071, 0x2071,
- 0x207f, 0x207f,
- 0x2090, 0x209c,
- 0x2102, 0x2102,
- 0x2107, 0x2107,
- 0x210a, 0x2113,
- 0x2115, 0x2115,
- 0x2119, 0x211d,
- 0x2124, 0x2124,
- 0x2126, 0x2126,
- 0x2128, 0x2128,
- 0x212a, 0x212d,
- 0x212f, 0x2139,
- 0x213c, 0x213f,
- 0x2145, 0x2149,
- 0x214e, 0x214e,
- 0x2160, 0x2188,
- 0x24b6, 0x24e9,
- 0x2c00, 0x2c2e,
- 0x2c30, 0x2c5e,
- 0x2c60, 0x2ce4,
- 0x2ceb, 0x2cee,
- 0x2d00, 0x2d25,
- 0x2d30, 0x2d65,
- 0x2d6f, 0x2d6f,
- 0x2d80, 0x2d96,
- 0x2da0, 0x2da6,
- 0x2da8, 0x2dae,
- 0x2db0, 0x2db6,
- 0x2db8, 0x2dbe,
- 0x2dc0, 0x2dc6,
- 0x2dc8, 0x2dce,
- 0x2dd0, 0x2dd6,
- 0x2dd8, 0x2dde,
- 0x2de0, 0x2dff,
- 0x2e2f, 0x2e2f,
- 0x3005, 0x3007,
- 0x3021, 0x3029,
- 0x3031, 0x3035,
- 0x3038, 0x303c,
- 0x3041, 0x3096,
- 0x309d, 0x309f,
- 0x30a1, 0x30fa,
- 0x30fc, 0x30ff,
- 0x3105, 0x312d,
- 0x3131, 0x318e,
- 0x31a0, 0x31ba,
- 0x31f0, 0x31ff,
- 0x3400, 0x4db5,
- 0x4e00, 0x9fcb,
- 0xa000, 0xa48c,
- 0xa4d0, 0xa4fd,
- 0xa500, 0xa60c,
- 0xa610, 0xa61f,
- 0xa62a, 0xa62b,
- 0xa640, 0xa66e,
- 0xa67f, 0xa697,
- 0xa6a0, 0xa6ef,
- 0xa717, 0xa71f,
- 0xa722, 0xa788,
- 0xa78b, 0xa78e,
- 0xa790, 0xa791,
- 0xa7a0, 0xa7a9,
- 0xa7fa, 0xa801,
- 0xa803, 0xa805,
- 0xa807, 0xa80a,
- 0xa80c, 0xa827,
- 0xa840, 0xa873,
- 0xa880, 0xa8c3,
- 0xa8f2, 0xa8f7,
- 0xa8fb, 0xa8fb,
- 0xa90a, 0xa92a,
- 0xa930, 0xa952,
- 0xa960, 0xa97c,
- 0xa980, 0xa9b2,
- 0xa9b4, 0xa9bf,
- 0xa9cf, 0xa9cf,
- 0xaa00, 0xaa36,
- 0xaa40, 0xaa4d,
- 0xaa60, 0xaa76,
- 0xaa7a, 0xaa7a,
- 0xaa80, 0xaabe,
- 0xaac0, 0xaac0,
- 0xaac2, 0xaac2,
- 0xaadb, 0xaadd,
- 0xab01, 0xab06,
- 0xab09, 0xab0e,
- 0xab11, 0xab16,
- 0xab20, 0xab26,
- 0xab28, 0xab2e,
- 0xabc0, 0xabea,
- 0xac00, 0xd7a3,
- 0xd7b0, 0xd7c6,
- 0xd7cb, 0xd7fb,
- 0xf900, 0xfa2d,
- 0xfa30, 0xfa6d,
- 0xfa70, 0xfad9,
- 0xfb00, 0xfb06,
- 0xfb13, 0xfb17,
- 0xfb1d, 0xfb28,
- 0xfb2a, 0xfb36,
- 0xfb38, 0xfb3c,
- 0xfb3e, 0xfb3e,
- 0xfb40, 0xfb41,
- 0xfb43, 0xfb44,
- 0xfb46, 0xfbb1,
- 0xfbd3, 0xfd3d,
- 0xfd50, 0xfd8f,
- 0xfd92, 0xfdc7,
- 0xfdf0, 0xfdfb,
- 0xfe70, 0xfe74,
- 0xfe76, 0xfefc,
- 0xff21, 0xff3a,
- 0xff41, 0xff5a,
- 0xff66, 0xffbe,
- 0xffc2, 0xffc7,
- 0xffca, 0xffcf,
- 0xffd2, 0xffd7,
- 0xffda, 0xffdc,
- 0x10000, 0x1000b,
- 0x1000d, 0x10026,
- 0x10028, 0x1003a,
- 0x1003c, 0x1003d,
- 0x1003f, 0x1004d,
- 0x10050, 0x1005d,
- 0x10080, 0x100fa,
- 0x10140, 0x10174,
- 0x10280, 0x1029c,
- 0x102a0, 0x102d0,
- 0x10300, 0x1031e,
- 0x10330, 0x1034a,
- 0x10380, 0x1039d,
- 0x103a0, 0x103c3,
- 0x103c8, 0x103cf,
- 0x103d1, 0x103d5,
- 0x10400, 0x1049d,
- 0x10800, 0x10805,
- 0x10808, 0x10808,
- 0x1080a, 0x10835,
- 0x10837, 0x10838,
- 0x1083c, 0x1083c,
- 0x1083f, 0x10855,
- 0x10900, 0x10915,
- 0x10920, 0x10939,
- 0x10a00, 0x10a03,
- 0x10a05, 0x10a06,
- 0x10a0c, 0x10a13,
- 0x10a15, 0x10a17,
- 0x10a19, 0x10a33,
- 0x10a60, 0x10a7c,
- 0x10b00, 0x10b35,
- 0x10b40, 0x10b55,
- 0x10b60, 0x10b72,
- 0x10c00, 0x10c48,
- 0x11000, 0x11045,
- 0x11082, 0x110b8,
- 0x12000, 0x1236e,
- 0x12400, 0x12462,
- 0x13000, 0x1342e,
- 0x16800, 0x16a38,
- 0x1b000, 0x1b001,
- 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, 0x1d6c0,
- 0x1d6c2, 0x1d6da,
- 0x1d6dc, 0x1d6fa,
- 0x1d6fc, 0x1d714,
- 0x1d716, 0x1d734,
- 0x1d736, 0x1d74e,
- 0x1d750, 0x1d76e,
- 0x1d770, 0x1d788,
- 0x1d78a, 0x1d7a8,
- 0x1d7aa, 0x1d7c2,
- 0x1d7c4, 0x1d7cb,
- 0x20000, 0x2a6d6,
- 0x2a700, 0x2b734,
- 0x2b740, 0x2b81d,
- 0x2f800, 0x2fa1d,
-}; /* CR_Alphabetic */
+#define CR_Alphabetic CR_Alpha
/* 'Lowercase': Derived Property */
-static const OnigCodePoint CR_Lowercase[] = {
- 612,
- 0x0061, 0x007a,
- 0x00aa, 0x00aa,
- 0x00b5, 0x00b5,
- 0x00ba, 0x00ba,
- 0x00df, 0x00f6,
- 0x00f8, 0x00ff,
- 0x0101, 0x0101,
- 0x0103, 0x0103,
- 0x0105, 0x0105,
- 0x0107, 0x0107,
- 0x0109, 0x0109,
- 0x010b, 0x010b,
- 0x010d, 0x010d,
- 0x010f, 0x010f,
- 0x0111, 0x0111,
- 0x0113, 0x0113,
- 0x0115, 0x0115,
- 0x0117, 0x0117,
- 0x0119, 0x0119,
- 0x011b, 0x011b,
- 0x011d, 0x011d,
- 0x011f, 0x011f,
- 0x0121, 0x0121,
- 0x0123, 0x0123,
- 0x0125, 0x0125,
- 0x0127, 0x0127,
- 0x0129, 0x0129,
- 0x012b, 0x012b,
- 0x012d, 0x012d,
- 0x012f, 0x012f,
- 0x0131, 0x0131,
- 0x0133, 0x0133,
- 0x0135, 0x0135,
- 0x0137, 0x0138,
- 0x013a, 0x013a,
- 0x013c, 0x013c,
- 0x013e, 0x013e,
- 0x0140, 0x0140,
- 0x0142, 0x0142,
- 0x0144, 0x0144,
- 0x0146, 0x0146,
- 0x0148, 0x0149,
- 0x014b, 0x014b,
- 0x014d, 0x014d,
- 0x014f, 0x014f,
- 0x0151, 0x0151,
- 0x0153, 0x0153,
- 0x0155, 0x0155,
- 0x0157, 0x0157,
- 0x0159, 0x0159,
- 0x015b, 0x015b,
- 0x015d, 0x015d,
- 0x015f, 0x015f,
- 0x0161, 0x0161,
- 0x0163, 0x0163,
- 0x0165, 0x0165,
- 0x0167, 0x0167,
- 0x0169, 0x0169,
- 0x016b, 0x016b,
- 0x016d, 0x016d,
- 0x016f, 0x016f,
- 0x0171, 0x0171,
- 0x0173, 0x0173,
- 0x0175, 0x0175,
- 0x0177, 0x0177,
- 0x017a, 0x017a,
- 0x017c, 0x017c,
- 0x017e, 0x0180,
- 0x0183, 0x0183,
- 0x0185, 0x0185,
- 0x0188, 0x0188,
- 0x018c, 0x018d,
- 0x0192, 0x0192,
- 0x0195, 0x0195,
- 0x0199, 0x019b,
- 0x019e, 0x019e,
- 0x01a1, 0x01a1,
- 0x01a3, 0x01a3,
- 0x01a5, 0x01a5,
- 0x01a8, 0x01a8,
- 0x01aa, 0x01ab,
- 0x01ad, 0x01ad,
- 0x01b0, 0x01b0,
- 0x01b4, 0x01b4,
- 0x01b6, 0x01b6,
- 0x01b9, 0x01ba,
- 0x01bd, 0x01bf,
- 0x01c6, 0x01c6,
- 0x01c9, 0x01c9,
- 0x01cc, 0x01cc,
- 0x01ce, 0x01ce,
- 0x01d0, 0x01d0,
- 0x01d2, 0x01d2,
- 0x01d4, 0x01d4,
- 0x01d6, 0x01d6,
- 0x01d8, 0x01d8,
- 0x01da, 0x01da,
- 0x01dc, 0x01dd,
- 0x01df, 0x01df,
- 0x01e1, 0x01e1,
- 0x01e3, 0x01e3,
- 0x01e5, 0x01e5,
- 0x01e7, 0x01e7,
- 0x01e9, 0x01e9,
- 0x01eb, 0x01eb,
- 0x01ed, 0x01ed,
- 0x01ef, 0x01f0,
- 0x01f3, 0x01f3,
- 0x01f5, 0x01f5,
- 0x01f9, 0x01f9,
- 0x01fb, 0x01fb,
- 0x01fd, 0x01fd,
- 0x01ff, 0x01ff,
- 0x0201, 0x0201,
- 0x0203, 0x0203,
- 0x0205, 0x0205,
- 0x0207, 0x0207,
- 0x0209, 0x0209,
- 0x020b, 0x020b,
- 0x020d, 0x020d,
- 0x020f, 0x020f,
- 0x0211, 0x0211,
- 0x0213, 0x0213,
- 0x0215, 0x0215,
- 0x0217, 0x0217,
- 0x0219, 0x0219,
- 0x021b, 0x021b,
- 0x021d, 0x021d,
- 0x021f, 0x021f,
- 0x0221, 0x0221,
- 0x0223, 0x0223,
- 0x0225, 0x0225,
- 0x0227, 0x0227,
- 0x0229, 0x0229,
- 0x022b, 0x022b,
- 0x022d, 0x022d,
- 0x022f, 0x022f,
- 0x0231, 0x0231,
- 0x0233, 0x0239,
- 0x023c, 0x023c,
- 0x023f, 0x0240,
- 0x0242, 0x0242,
- 0x0247, 0x0247,
- 0x0249, 0x0249,
- 0x024b, 0x024b,
- 0x024d, 0x024d,
- 0x024f, 0x0293,
- 0x0295, 0x02b8,
- 0x02c0, 0x02c1,
- 0x02e0, 0x02e4,
- 0x0345, 0x0345,
- 0x0371, 0x0371,
- 0x0373, 0x0373,
- 0x0377, 0x0377,
- 0x037a, 0x037d,
- 0x0390, 0x0390,
- 0x03ac, 0x03ce,
- 0x03d0, 0x03d1,
- 0x03d5, 0x03d7,
- 0x03d9, 0x03d9,
- 0x03db, 0x03db,
- 0x03dd, 0x03dd,
- 0x03df, 0x03df,
- 0x03e1, 0x03e1,
- 0x03e3, 0x03e3,
- 0x03e5, 0x03e5,
- 0x03e7, 0x03e7,
- 0x03e9, 0x03e9,
- 0x03eb, 0x03eb,
- 0x03ed, 0x03ed,
- 0x03ef, 0x03f3,
- 0x03f5, 0x03f5,
- 0x03f8, 0x03f8,
- 0x03fb, 0x03fc,
- 0x0430, 0x045f,
- 0x0461, 0x0461,
- 0x0463, 0x0463,
- 0x0465, 0x0465,
- 0x0467, 0x0467,
- 0x0469, 0x0469,
- 0x046b, 0x046b,
- 0x046d, 0x046d,
- 0x046f, 0x046f,
- 0x0471, 0x0471,
- 0x0473, 0x0473,
- 0x0475, 0x0475,
- 0x0477, 0x0477,
- 0x0479, 0x0479,
- 0x047b, 0x047b,
- 0x047d, 0x047d,
- 0x047f, 0x047f,
- 0x0481, 0x0481,
- 0x048b, 0x048b,
- 0x048d, 0x048d,
- 0x048f, 0x048f,
- 0x0491, 0x0491,
- 0x0493, 0x0493,
- 0x0495, 0x0495,
- 0x0497, 0x0497,
- 0x0499, 0x0499,
- 0x049b, 0x049b,
- 0x049d, 0x049d,
- 0x049f, 0x049f,
- 0x04a1, 0x04a1,
- 0x04a3, 0x04a3,
- 0x04a5, 0x04a5,
- 0x04a7, 0x04a7,
- 0x04a9, 0x04a9,
- 0x04ab, 0x04ab,
- 0x04ad, 0x04ad,
- 0x04af, 0x04af,
- 0x04b1, 0x04b1,
- 0x04b3, 0x04b3,
- 0x04b5, 0x04b5,
- 0x04b7, 0x04b7,
- 0x04b9, 0x04b9,
- 0x04bb, 0x04bb,
- 0x04bd, 0x04bd,
- 0x04bf, 0x04bf,
- 0x04c2, 0x04c2,
- 0x04c4, 0x04c4,
- 0x04c6, 0x04c6,
- 0x04c8, 0x04c8,
- 0x04ca, 0x04ca,
- 0x04cc, 0x04cc,
- 0x04ce, 0x04cf,
- 0x04d1, 0x04d1,
- 0x04d3, 0x04d3,
- 0x04d5, 0x04d5,
- 0x04d7, 0x04d7,
- 0x04d9, 0x04d9,
- 0x04db, 0x04db,
- 0x04dd, 0x04dd,
- 0x04df, 0x04df,
- 0x04e1, 0x04e1,
- 0x04e3, 0x04e3,
- 0x04e5, 0x04e5,
- 0x04e7, 0x04e7,
- 0x04e9, 0x04e9,
- 0x04eb, 0x04eb,
- 0x04ed, 0x04ed,
- 0x04ef, 0x04ef,
- 0x04f1, 0x04f1,
- 0x04f3, 0x04f3,
- 0x04f5, 0x04f5,
- 0x04f7, 0x04f7,
- 0x04f9, 0x04f9,
- 0x04fb, 0x04fb,
- 0x04fd, 0x04fd,
- 0x04ff, 0x04ff,
- 0x0501, 0x0501,
- 0x0503, 0x0503,
- 0x0505, 0x0505,
- 0x0507, 0x0507,
- 0x0509, 0x0509,
- 0x050b, 0x050b,
- 0x050d, 0x050d,
- 0x050f, 0x050f,
- 0x0511, 0x0511,
- 0x0513, 0x0513,
- 0x0515, 0x0515,
- 0x0517, 0x0517,
- 0x0519, 0x0519,
- 0x051b, 0x051b,
- 0x051d, 0x051d,
- 0x051f, 0x051f,
- 0x0521, 0x0521,
- 0x0523, 0x0523,
- 0x0525, 0x0525,
- 0x0527, 0x0527,
- 0x0561, 0x0587,
- 0x1d00, 0x1dbf,
- 0x1e01, 0x1e01,
- 0x1e03, 0x1e03,
- 0x1e05, 0x1e05,
- 0x1e07, 0x1e07,
- 0x1e09, 0x1e09,
- 0x1e0b, 0x1e0b,
- 0x1e0d, 0x1e0d,
- 0x1e0f, 0x1e0f,
- 0x1e11, 0x1e11,
- 0x1e13, 0x1e13,
- 0x1e15, 0x1e15,
- 0x1e17, 0x1e17,
- 0x1e19, 0x1e19,
- 0x1e1b, 0x1e1b,
- 0x1e1d, 0x1e1d,
- 0x1e1f, 0x1e1f,
- 0x1e21, 0x1e21,
- 0x1e23, 0x1e23,
- 0x1e25, 0x1e25,
- 0x1e27, 0x1e27,
- 0x1e29, 0x1e29,
- 0x1e2b, 0x1e2b,
- 0x1e2d, 0x1e2d,
- 0x1e2f, 0x1e2f,
- 0x1e31, 0x1e31,
- 0x1e33, 0x1e33,
- 0x1e35, 0x1e35,
- 0x1e37, 0x1e37,
- 0x1e39, 0x1e39,
- 0x1e3b, 0x1e3b,
- 0x1e3d, 0x1e3d,
- 0x1e3f, 0x1e3f,
- 0x1e41, 0x1e41,
- 0x1e43, 0x1e43,
- 0x1e45, 0x1e45,
- 0x1e47, 0x1e47,
- 0x1e49, 0x1e49,
- 0x1e4b, 0x1e4b,
- 0x1e4d, 0x1e4d,
- 0x1e4f, 0x1e4f,
- 0x1e51, 0x1e51,
- 0x1e53, 0x1e53,
- 0x1e55, 0x1e55,
- 0x1e57, 0x1e57,
- 0x1e59, 0x1e59,
- 0x1e5b, 0x1e5b,
- 0x1e5d, 0x1e5d,
- 0x1e5f, 0x1e5f,
- 0x1e61, 0x1e61,
- 0x1e63, 0x1e63,
- 0x1e65, 0x1e65,
- 0x1e67, 0x1e67,
- 0x1e69, 0x1e69,
- 0x1e6b, 0x1e6b,
- 0x1e6d, 0x1e6d,
- 0x1e6f, 0x1e6f,
- 0x1e71, 0x1e71,
- 0x1e73, 0x1e73,
- 0x1e75, 0x1e75,
- 0x1e77, 0x1e77,
- 0x1e79, 0x1e79,
- 0x1e7b, 0x1e7b,
- 0x1e7d, 0x1e7d,
- 0x1e7f, 0x1e7f,
- 0x1e81, 0x1e81,
- 0x1e83, 0x1e83,
- 0x1e85, 0x1e85,
- 0x1e87, 0x1e87,
- 0x1e89, 0x1e89,
- 0x1e8b, 0x1e8b,
- 0x1e8d, 0x1e8d,
- 0x1e8f, 0x1e8f,
- 0x1e91, 0x1e91,
- 0x1e93, 0x1e93,
- 0x1e95, 0x1e9d,
- 0x1e9f, 0x1e9f,
- 0x1ea1, 0x1ea1,
- 0x1ea3, 0x1ea3,
- 0x1ea5, 0x1ea5,
- 0x1ea7, 0x1ea7,
- 0x1ea9, 0x1ea9,
- 0x1eab, 0x1eab,
- 0x1ead, 0x1ead,
- 0x1eaf, 0x1eaf,
- 0x1eb1, 0x1eb1,
- 0x1eb3, 0x1eb3,
- 0x1eb5, 0x1eb5,
- 0x1eb7, 0x1eb7,
- 0x1eb9, 0x1eb9,
- 0x1ebb, 0x1ebb,
- 0x1ebd, 0x1ebd,
- 0x1ebf, 0x1ebf,
- 0x1ec1, 0x1ec1,
- 0x1ec3, 0x1ec3,
- 0x1ec5, 0x1ec5,
- 0x1ec7, 0x1ec7,
- 0x1ec9, 0x1ec9,
- 0x1ecb, 0x1ecb,
- 0x1ecd, 0x1ecd,
- 0x1ecf, 0x1ecf,
- 0x1ed1, 0x1ed1,
- 0x1ed3, 0x1ed3,
- 0x1ed5, 0x1ed5,
- 0x1ed7, 0x1ed7,
- 0x1ed9, 0x1ed9,
- 0x1edb, 0x1edb,
- 0x1edd, 0x1edd,
- 0x1edf, 0x1edf,
- 0x1ee1, 0x1ee1,
- 0x1ee3, 0x1ee3,
- 0x1ee5, 0x1ee5,
- 0x1ee7, 0x1ee7,
- 0x1ee9, 0x1ee9,
- 0x1eeb, 0x1eeb,
- 0x1eed, 0x1eed,
- 0x1eef, 0x1eef,
- 0x1ef1, 0x1ef1,
- 0x1ef3, 0x1ef3,
- 0x1ef5, 0x1ef5,
- 0x1ef7, 0x1ef7,
- 0x1ef9, 0x1ef9,
- 0x1efb, 0x1efb,
- 0x1efd, 0x1efd,
- 0x1eff, 0x1f07,
- 0x1f10, 0x1f15,
- 0x1f20, 0x1f27,
- 0x1f30, 0x1f37,
- 0x1f40, 0x1f45,
- 0x1f50, 0x1f57,
- 0x1f60, 0x1f67,
- 0x1f70, 0x1f7d,
- 0x1f80, 0x1f87,
- 0x1f90, 0x1f97,
- 0x1fa0, 0x1fa7,
- 0x1fb0, 0x1fb4,
- 0x1fb6, 0x1fb7,
- 0x1fbe, 0x1fbe,
- 0x1fc2, 0x1fc4,
- 0x1fc6, 0x1fc7,
- 0x1fd0, 0x1fd3,
- 0x1fd6, 0x1fd7,
- 0x1fe0, 0x1fe7,
- 0x1ff2, 0x1ff4,
- 0x1ff6, 0x1ff7,
- 0x2090, 0x2094,
- 0x210a, 0x210a,
- 0x210e, 0x210f,
- 0x2113, 0x2113,
- 0x212f, 0x212f,
- 0x2134, 0x2134,
- 0x2139, 0x2139,
- 0x213c, 0x213d,
- 0x2146, 0x2149,
- 0x214e, 0x214e,
- 0x2170, 0x217f,
- 0x2184, 0x2184,
- 0x24d0, 0x24e9,
- 0x2c30, 0x2c5e,
- 0x2c61, 0x2c61,
- 0x2c65, 0x2c66,
- 0x2c68, 0x2c68,
- 0x2c6a, 0x2c6a,
- 0x2c6c, 0x2c6c,
- 0x2c71, 0x2c71,
- 0x2c73, 0x2c74,
- 0x2c76, 0x2c7d,
- 0x2c81, 0x2c81,
- 0x2c83, 0x2c83,
- 0x2c85, 0x2c85,
- 0x2c87, 0x2c87,
- 0x2c89, 0x2c89,
- 0x2c8b, 0x2c8b,
- 0x2c8d, 0x2c8d,
- 0x2c8f, 0x2c8f,
- 0x2c91, 0x2c91,
- 0x2c93, 0x2c93,
- 0x2c95, 0x2c95,
- 0x2c97, 0x2c97,
- 0x2c99, 0x2c99,
- 0x2c9b, 0x2c9b,
- 0x2c9d, 0x2c9d,
- 0x2c9f, 0x2c9f,
- 0x2ca1, 0x2ca1,
- 0x2ca3, 0x2ca3,
- 0x2ca5, 0x2ca5,
- 0x2ca7, 0x2ca7,
- 0x2ca9, 0x2ca9,
- 0x2cab, 0x2cab,
- 0x2cad, 0x2cad,
- 0x2caf, 0x2caf,
- 0x2cb1, 0x2cb1,
- 0x2cb3, 0x2cb3,
- 0x2cb5, 0x2cb5,
- 0x2cb7, 0x2cb7,
- 0x2cb9, 0x2cb9,
- 0x2cbb, 0x2cbb,
- 0x2cbd, 0x2cbd,
- 0x2cbf, 0x2cbf,
- 0x2cc1, 0x2cc1,
- 0x2cc3, 0x2cc3,
- 0x2cc5, 0x2cc5,
- 0x2cc7, 0x2cc7,
- 0x2cc9, 0x2cc9,
- 0x2ccb, 0x2ccb,
- 0x2ccd, 0x2ccd,
- 0x2ccf, 0x2ccf,
- 0x2cd1, 0x2cd1,
- 0x2cd3, 0x2cd3,
- 0x2cd5, 0x2cd5,
- 0x2cd7, 0x2cd7,
- 0x2cd9, 0x2cd9,
- 0x2cdb, 0x2cdb,
- 0x2cdd, 0x2cdd,
- 0x2cdf, 0x2cdf,
- 0x2ce1, 0x2ce1,
- 0x2ce3, 0x2ce4,
- 0x2cec, 0x2cec,
- 0x2cee, 0x2cee,
- 0x2d00, 0x2d25,
- 0xa641, 0xa641,
- 0xa643, 0xa643,
- 0xa645, 0xa645,
- 0xa647, 0xa647,
- 0xa649, 0xa649,
- 0xa64b, 0xa64b,
- 0xa64d, 0xa64d,
- 0xa64f, 0xa64f,
- 0xa651, 0xa651,
- 0xa653, 0xa653,
- 0xa655, 0xa655,
- 0xa657, 0xa657,
- 0xa659, 0xa659,
- 0xa65b, 0xa65b,
- 0xa65d, 0xa65d,
- 0xa65f, 0xa65f,
- 0xa661, 0xa661,
- 0xa663, 0xa663,
- 0xa665, 0xa665,
- 0xa667, 0xa667,
- 0xa669, 0xa669,
- 0xa66b, 0xa66b,
- 0xa66d, 0xa66d,
- 0xa681, 0xa681,
- 0xa683, 0xa683,
- 0xa685, 0xa685,
- 0xa687, 0xa687,
- 0xa689, 0xa689,
- 0xa68b, 0xa68b,
- 0xa68d, 0xa68d,
- 0xa68f, 0xa68f,
- 0xa691, 0xa691,
- 0xa693, 0xa693,
- 0xa695, 0xa695,
- 0xa697, 0xa697,
- 0xa723, 0xa723,
- 0xa725, 0xa725,
- 0xa727, 0xa727,
- 0xa729, 0xa729,
- 0xa72b, 0xa72b,
- 0xa72d, 0xa72d,
- 0xa72f, 0xa731,
- 0xa733, 0xa733,
- 0xa735, 0xa735,
- 0xa737, 0xa737,
- 0xa739, 0xa739,
- 0xa73b, 0xa73b,
- 0xa73d, 0xa73d,
- 0xa73f, 0xa73f,
- 0xa741, 0xa741,
- 0xa743, 0xa743,
- 0xa745, 0xa745,
- 0xa747, 0xa747,
- 0xa749, 0xa749,
- 0xa74b, 0xa74b,
- 0xa74d, 0xa74d,
- 0xa74f, 0xa74f,
- 0xa751, 0xa751,
- 0xa753, 0xa753,
- 0xa755, 0xa755,
- 0xa757, 0xa757,
- 0xa759, 0xa759,
- 0xa75b, 0xa75b,
- 0xa75d, 0xa75d,
- 0xa75f, 0xa75f,
- 0xa761, 0xa761,
- 0xa763, 0xa763,
- 0xa765, 0xa765,
- 0xa767, 0xa767,
- 0xa769, 0xa769,
- 0xa76b, 0xa76b,
- 0xa76d, 0xa76d,
- 0xa76f, 0xa778,
- 0xa77a, 0xa77a,
- 0xa77c, 0xa77c,
- 0xa77f, 0xa77f,
- 0xa781, 0xa781,
- 0xa783, 0xa783,
- 0xa785, 0xa785,
- 0xa787, 0xa787,
- 0xa78c, 0xa78c,
- 0xa78e, 0xa78e,
- 0xa791, 0xa791,
- 0xa7a1, 0xa7a1,
- 0xa7a3, 0xa7a3,
- 0xa7a5, 0xa7a5,
- 0xa7a7, 0xa7a7,
- 0xa7a9, 0xa7a9,
- 0xa7fa, 0xa7fa,
- 0xfb00, 0xfb06,
- 0xfb13, 0xfb17,
- 0xff41, 0xff5a,
- 0x10428, 0x1044f,
- 0x1d41a, 0x1d433,
- 0x1d44e, 0x1d454,
- 0x1d456, 0x1d467,
- 0x1d482, 0x1d49b,
- 0x1d4b6, 0x1d4b9,
- 0x1d4bb, 0x1d4bb,
- 0x1d4bd, 0x1d4c3,
- 0x1d4c5, 0x1d4cf,
- 0x1d4ea, 0x1d503,
- 0x1d51e, 0x1d537,
- 0x1d552, 0x1d56b,
- 0x1d586, 0x1d59f,
- 0x1d5ba, 0x1d5d3,
- 0x1d5ee, 0x1d607,
- 0x1d622, 0x1d63b,
- 0x1d656, 0x1d66f,
- 0x1d68a, 0x1d6a5,
- 0x1d6c2, 0x1d6da,
- 0x1d6dc, 0x1d6e1,
- 0x1d6fc, 0x1d714,
- 0x1d716, 0x1d71b,
- 0x1d736, 0x1d74e,
- 0x1d750, 0x1d755,
- 0x1d770, 0x1d788,
- 0x1d78a, 0x1d78f,
- 0x1d7aa, 0x1d7c2,
- 0x1d7c4, 0x1d7c9,
- 0x1d7cb, 0x1d7cb,
-}; /* CR_Lowercase */
+#define CR_Lowercase CR_Lower
/* 'Uppercase': Derived Property */
-static const OnigCodePoint CR_Uppercase[] = {
- 605,
- 0x0041, 0x005a,
- 0x00c0, 0x00d6,
- 0x00d8, 0x00de,
- 0x0100, 0x0100,
- 0x0102, 0x0102,
- 0x0104, 0x0104,
- 0x0106, 0x0106,
- 0x0108, 0x0108,
- 0x010a, 0x010a,
- 0x010c, 0x010c,
- 0x010e, 0x010e,
- 0x0110, 0x0110,
- 0x0112, 0x0112,
- 0x0114, 0x0114,
- 0x0116, 0x0116,
- 0x0118, 0x0118,
- 0x011a, 0x011a,
- 0x011c, 0x011c,
- 0x011e, 0x011e,
- 0x0120, 0x0120,
- 0x0122, 0x0122,
- 0x0124, 0x0124,
- 0x0126, 0x0126,
- 0x0128, 0x0128,
- 0x012a, 0x012a,
- 0x012c, 0x012c,
- 0x012e, 0x012e,
- 0x0130, 0x0130,
- 0x0132, 0x0132,
- 0x0134, 0x0134,
- 0x0136, 0x0136,
- 0x0139, 0x0139,
- 0x013b, 0x013b,
- 0x013d, 0x013d,
- 0x013f, 0x013f,
- 0x0141, 0x0141,
- 0x0143, 0x0143,
- 0x0145, 0x0145,
- 0x0147, 0x0147,
- 0x014a, 0x014a,
- 0x014c, 0x014c,
- 0x014e, 0x014e,
- 0x0150, 0x0150,
- 0x0152, 0x0152,
- 0x0154, 0x0154,
- 0x0156, 0x0156,
- 0x0158, 0x0158,
- 0x015a, 0x015a,
- 0x015c, 0x015c,
- 0x015e, 0x015e,
- 0x0160, 0x0160,
- 0x0162, 0x0162,
- 0x0164, 0x0164,
- 0x0166, 0x0166,
- 0x0168, 0x0168,
- 0x016a, 0x016a,
- 0x016c, 0x016c,
- 0x016e, 0x016e,
- 0x0170, 0x0170,
- 0x0172, 0x0172,
- 0x0174, 0x0174,
- 0x0176, 0x0176,
- 0x0178, 0x0179,
- 0x017b, 0x017b,
- 0x017d, 0x017d,
- 0x0181, 0x0182,
- 0x0184, 0x0184,
- 0x0186, 0x0187,
- 0x0189, 0x018b,
- 0x018e, 0x0191,
- 0x0193, 0x0194,
- 0x0196, 0x0198,
- 0x019c, 0x019d,
- 0x019f, 0x01a0,
- 0x01a2, 0x01a2,
- 0x01a4, 0x01a4,
- 0x01a6, 0x01a7,
- 0x01a9, 0x01a9,
- 0x01ac, 0x01ac,
- 0x01ae, 0x01af,
- 0x01b1, 0x01b3,
- 0x01b5, 0x01b5,
- 0x01b7, 0x01b8,
- 0x01bc, 0x01bc,
- 0x01c4, 0x01c4,
- 0x01c7, 0x01c7,
- 0x01ca, 0x01ca,
- 0x01cd, 0x01cd,
- 0x01cf, 0x01cf,
- 0x01d1, 0x01d1,
- 0x01d3, 0x01d3,
- 0x01d5, 0x01d5,
- 0x01d7, 0x01d7,
- 0x01d9, 0x01d9,
- 0x01db, 0x01db,
- 0x01de, 0x01de,
- 0x01e0, 0x01e0,
- 0x01e2, 0x01e2,
- 0x01e4, 0x01e4,
- 0x01e6, 0x01e6,
- 0x01e8, 0x01e8,
- 0x01ea, 0x01ea,
- 0x01ec, 0x01ec,
- 0x01ee, 0x01ee,
- 0x01f1, 0x01f1,
- 0x01f4, 0x01f4,
- 0x01f6, 0x01f8,
- 0x01fa, 0x01fa,
- 0x01fc, 0x01fc,
- 0x01fe, 0x01fe,
- 0x0200, 0x0200,
- 0x0202, 0x0202,
- 0x0204, 0x0204,
- 0x0206, 0x0206,
- 0x0208, 0x0208,
- 0x020a, 0x020a,
- 0x020c, 0x020c,
- 0x020e, 0x020e,
- 0x0210, 0x0210,
- 0x0212, 0x0212,
- 0x0214, 0x0214,
- 0x0216, 0x0216,
- 0x0218, 0x0218,
- 0x021a, 0x021a,
- 0x021c, 0x021c,
- 0x021e, 0x021e,
- 0x0220, 0x0220,
- 0x0222, 0x0222,
- 0x0224, 0x0224,
- 0x0226, 0x0226,
- 0x0228, 0x0228,
- 0x022a, 0x022a,
- 0x022c, 0x022c,
- 0x022e, 0x022e,
- 0x0230, 0x0230,
- 0x0232, 0x0232,
- 0x023a, 0x023b,
- 0x023d, 0x023e,
- 0x0241, 0x0241,
- 0x0243, 0x0246,
- 0x0248, 0x0248,
- 0x024a, 0x024a,
- 0x024c, 0x024c,
- 0x024e, 0x024e,
- 0x0370, 0x0370,
- 0x0372, 0x0372,
- 0x0376, 0x0376,
- 0x0386, 0x0386,
- 0x0388, 0x038a,
- 0x038c, 0x038c,
- 0x038e, 0x038f,
- 0x0391, 0x03a1,
- 0x03a3, 0x03ab,
- 0x03cf, 0x03cf,
- 0x03d2, 0x03d4,
- 0x03d8, 0x03d8,
- 0x03da, 0x03da,
- 0x03dc, 0x03dc,
- 0x03de, 0x03de,
- 0x03e0, 0x03e0,
- 0x03e2, 0x03e2,
- 0x03e4, 0x03e4,
- 0x03e6, 0x03e6,
- 0x03e8, 0x03e8,
- 0x03ea, 0x03ea,
- 0x03ec, 0x03ec,
- 0x03ee, 0x03ee,
- 0x03f4, 0x03f4,
- 0x03f7, 0x03f7,
- 0x03f9, 0x03fa,
- 0x03fd, 0x042f,
- 0x0460, 0x0460,
- 0x0462, 0x0462,
- 0x0464, 0x0464,
- 0x0466, 0x0466,
- 0x0468, 0x0468,
- 0x046a, 0x046a,
- 0x046c, 0x046c,
- 0x046e, 0x046e,
- 0x0470, 0x0470,
- 0x0472, 0x0472,
- 0x0474, 0x0474,
- 0x0476, 0x0476,
- 0x0478, 0x0478,
- 0x047a, 0x047a,
- 0x047c, 0x047c,
- 0x047e, 0x047e,
- 0x0480, 0x0480,
- 0x048a, 0x048a,
- 0x048c, 0x048c,
- 0x048e, 0x048e,
- 0x0490, 0x0490,
- 0x0492, 0x0492,
- 0x0494, 0x0494,
- 0x0496, 0x0496,
- 0x0498, 0x0498,
- 0x049a, 0x049a,
- 0x049c, 0x049c,
- 0x049e, 0x049e,
- 0x04a0, 0x04a0,
- 0x04a2, 0x04a2,
- 0x04a4, 0x04a4,
- 0x04a6, 0x04a6,
- 0x04a8, 0x04a8,
- 0x04aa, 0x04aa,
- 0x04ac, 0x04ac,
- 0x04ae, 0x04ae,
- 0x04b0, 0x04b0,
- 0x04b2, 0x04b2,
- 0x04b4, 0x04b4,
- 0x04b6, 0x04b6,
- 0x04b8, 0x04b8,
- 0x04ba, 0x04ba,
- 0x04bc, 0x04bc,
- 0x04be, 0x04be,
- 0x04c0, 0x04c1,
- 0x04c3, 0x04c3,
- 0x04c5, 0x04c5,
- 0x04c7, 0x04c7,
- 0x04c9, 0x04c9,
- 0x04cb, 0x04cb,
- 0x04cd, 0x04cd,
- 0x04d0, 0x04d0,
- 0x04d2, 0x04d2,
- 0x04d4, 0x04d4,
- 0x04d6, 0x04d6,
- 0x04d8, 0x04d8,
- 0x04da, 0x04da,
- 0x04dc, 0x04dc,
- 0x04de, 0x04de,
- 0x04e0, 0x04e0,
- 0x04e2, 0x04e2,
- 0x04e4, 0x04e4,
- 0x04e6, 0x04e6,
- 0x04e8, 0x04e8,
- 0x04ea, 0x04ea,
- 0x04ec, 0x04ec,
- 0x04ee, 0x04ee,
- 0x04f0, 0x04f0,
- 0x04f2, 0x04f2,
- 0x04f4, 0x04f4,
- 0x04f6, 0x04f6,
- 0x04f8, 0x04f8,
- 0x04fa, 0x04fa,
- 0x04fc, 0x04fc,
- 0x04fe, 0x04fe,
- 0x0500, 0x0500,
- 0x0502, 0x0502,
- 0x0504, 0x0504,
- 0x0506, 0x0506,
- 0x0508, 0x0508,
- 0x050a, 0x050a,
- 0x050c, 0x050c,
- 0x050e, 0x050e,
- 0x0510, 0x0510,
- 0x0512, 0x0512,
- 0x0514, 0x0514,
- 0x0516, 0x0516,
- 0x0518, 0x0518,
- 0x051a, 0x051a,
- 0x051c, 0x051c,
- 0x051e, 0x051e,
- 0x0520, 0x0520,
- 0x0522, 0x0522,
- 0x0524, 0x0524,
- 0x0526, 0x0526,
- 0x0531, 0x0556,
- 0x10a0, 0x10c5,
- 0x1e00, 0x1e00,
- 0x1e02, 0x1e02,
- 0x1e04, 0x1e04,
- 0x1e06, 0x1e06,
- 0x1e08, 0x1e08,
- 0x1e0a, 0x1e0a,
- 0x1e0c, 0x1e0c,
- 0x1e0e, 0x1e0e,
- 0x1e10, 0x1e10,
- 0x1e12, 0x1e12,
- 0x1e14, 0x1e14,
- 0x1e16, 0x1e16,
- 0x1e18, 0x1e18,
- 0x1e1a, 0x1e1a,
- 0x1e1c, 0x1e1c,
- 0x1e1e, 0x1e1e,
- 0x1e20, 0x1e20,
- 0x1e22, 0x1e22,
- 0x1e24, 0x1e24,
- 0x1e26, 0x1e26,
- 0x1e28, 0x1e28,
- 0x1e2a, 0x1e2a,
- 0x1e2c, 0x1e2c,
- 0x1e2e, 0x1e2e,
- 0x1e30, 0x1e30,
- 0x1e32, 0x1e32,
- 0x1e34, 0x1e34,
- 0x1e36, 0x1e36,
- 0x1e38, 0x1e38,
- 0x1e3a, 0x1e3a,
- 0x1e3c, 0x1e3c,
- 0x1e3e, 0x1e3e,
- 0x1e40, 0x1e40,
- 0x1e42, 0x1e42,
- 0x1e44, 0x1e44,
- 0x1e46, 0x1e46,
- 0x1e48, 0x1e48,
- 0x1e4a, 0x1e4a,
- 0x1e4c, 0x1e4c,
- 0x1e4e, 0x1e4e,
- 0x1e50, 0x1e50,
- 0x1e52, 0x1e52,
- 0x1e54, 0x1e54,
- 0x1e56, 0x1e56,
- 0x1e58, 0x1e58,
- 0x1e5a, 0x1e5a,
- 0x1e5c, 0x1e5c,
- 0x1e5e, 0x1e5e,
- 0x1e60, 0x1e60,
- 0x1e62, 0x1e62,
- 0x1e64, 0x1e64,
- 0x1e66, 0x1e66,
- 0x1e68, 0x1e68,
- 0x1e6a, 0x1e6a,
- 0x1e6c, 0x1e6c,
- 0x1e6e, 0x1e6e,
- 0x1e70, 0x1e70,
- 0x1e72, 0x1e72,
- 0x1e74, 0x1e74,
- 0x1e76, 0x1e76,
- 0x1e78, 0x1e78,
- 0x1e7a, 0x1e7a,
- 0x1e7c, 0x1e7c,
- 0x1e7e, 0x1e7e,
- 0x1e80, 0x1e80,
- 0x1e82, 0x1e82,
- 0x1e84, 0x1e84,
- 0x1e86, 0x1e86,
- 0x1e88, 0x1e88,
- 0x1e8a, 0x1e8a,
- 0x1e8c, 0x1e8c,
- 0x1e8e, 0x1e8e,
- 0x1e90, 0x1e90,
- 0x1e92, 0x1e92,
- 0x1e94, 0x1e94,
- 0x1e9e, 0x1e9e,
- 0x1ea0, 0x1ea0,
- 0x1ea2, 0x1ea2,
- 0x1ea4, 0x1ea4,
- 0x1ea6, 0x1ea6,
- 0x1ea8, 0x1ea8,
- 0x1eaa, 0x1eaa,
- 0x1eac, 0x1eac,
- 0x1eae, 0x1eae,
- 0x1eb0, 0x1eb0,
- 0x1eb2, 0x1eb2,
- 0x1eb4, 0x1eb4,
- 0x1eb6, 0x1eb6,
- 0x1eb8, 0x1eb8,
- 0x1eba, 0x1eba,
- 0x1ebc, 0x1ebc,
- 0x1ebe, 0x1ebe,
- 0x1ec0, 0x1ec0,
- 0x1ec2, 0x1ec2,
- 0x1ec4, 0x1ec4,
- 0x1ec6, 0x1ec6,
- 0x1ec8, 0x1ec8,
- 0x1eca, 0x1eca,
- 0x1ecc, 0x1ecc,
- 0x1ece, 0x1ece,
- 0x1ed0, 0x1ed0,
- 0x1ed2, 0x1ed2,
- 0x1ed4, 0x1ed4,
- 0x1ed6, 0x1ed6,
- 0x1ed8, 0x1ed8,
- 0x1eda, 0x1eda,
- 0x1edc, 0x1edc,
- 0x1ede, 0x1ede,
- 0x1ee0, 0x1ee0,
- 0x1ee2, 0x1ee2,
- 0x1ee4, 0x1ee4,
- 0x1ee6, 0x1ee6,
- 0x1ee8, 0x1ee8,
- 0x1eea, 0x1eea,
- 0x1eec, 0x1eec,
- 0x1eee, 0x1eee,
- 0x1ef0, 0x1ef0,
- 0x1ef2, 0x1ef2,
- 0x1ef4, 0x1ef4,
- 0x1ef6, 0x1ef6,
- 0x1ef8, 0x1ef8,
- 0x1efa, 0x1efa,
- 0x1efc, 0x1efc,
- 0x1efe, 0x1efe,
- 0x1f08, 0x1f0f,
- 0x1f18, 0x1f1d,
- 0x1f28, 0x1f2f,
- 0x1f38, 0x1f3f,
- 0x1f48, 0x1f4d,
- 0x1f59, 0x1f59,
- 0x1f5b, 0x1f5b,
- 0x1f5d, 0x1f5d,
- 0x1f5f, 0x1f5f,
- 0x1f68, 0x1f6f,
- 0x1fb8, 0x1fbb,
- 0x1fc8, 0x1fcb,
- 0x1fd8, 0x1fdb,
- 0x1fe8, 0x1fec,
- 0x1ff8, 0x1ffb,
- 0x2102, 0x2102,
- 0x2107, 0x2107,
- 0x210b, 0x210d,
- 0x2110, 0x2112,
- 0x2115, 0x2115,
- 0x2119, 0x211d,
- 0x2124, 0x2124,
- 0x2126, 0x2126,
- 0x2128, 0x2128,
- 0x212a, 0x212d,
- 0x2130, 0x2133,
- 0x213e, 0x213f,
- 0x2145, 0x2145,
- 0x2160, 0x216f,
- 0x2183, 0x2183,
- 0x24b6, 0x24cf,
- 0x2c00, 0x2c2e,
- 0x2c60, 0x2c60,
- 0x2c62, 0x2c64,
- 0x2c67, 0x2c67,
- 0x2c69, 0x2c69,
- 0x2c6b, 0x2c6b,
- 0x2c6d, 0x2c70,
- 0x2c72, 0x2c72,
- 0x2c75, 0x2c75,
- 0x2c7e, 0x2c80,
- 0x2c82, 0x2c82,
- 0x2c84, 0x2c84,
- 0x2c86, 0x2c86,
- 0x2c88, 0x2c88,
- 0x2c8a, 0x2c8a,
- 0x2c8c, 0x2c8c,
- 0x2c8e, 0x2c8e,
- 0x2c90, 0x2c90,
- 0x2c92, 0x2c92,
- 0x2c94, 0x2c94,
- 0x2c96, 0x2c96,
- 0x2c98, 0x2c98,
- 0x2c9a, 0x2c9a,
- 0x2c9c, 0x2c9c,
- 0x2c9e, 0x2c9e,
- 0x2ca0, 0x2ca0,
- 0x2ca2, 0x2ca2,
- 0x2ca4, 0x2ca4,
- 0x2ca6, 0x2ca6,
- 0x2ca8, 0x2ca8,
- 0x2caa, 0x2caa,
- 0x2cac, 0x2cac,
- 0x2cae, 0x2cae,
- 0x2cb0, 0x2cb0,
- 0x2cb2, 0x2cb2,
- 0x2cb4, 0x2cb4,
- 0x2cb6, 0x2cb6,
- 0x2cb8, 0x2cb8,
- 0x2cba, 0x2cba,
- 0x2cbc, 0x2cbc,
- 0x2cbe, 0x2cbe,
- 0x2cc0, 0x2cc0,
- 0x2cc2, 0x2cc2,
- 0x2cc4, 0x2cc4,
- 0x2cc6, 0x2cc6,
- 0x2cc8, 0x2cc8,
- 0x2cca, 0x2cca,
- 0x2ccc, 0x2ccc,
- 0x2cce, 0x2cce,
- 0x2cd0, 0x2cd0,
- 0x2cd2, 0x2cd2,
- 0x2cd4, 0x2cd4,
- 0x2cd6, 0x2cd6,
- 0x2cd8, 0x2cd8,
- 0x2cda, 0x2cda,
- 0x2cdc, 0x2cdc,
- 0x2cde, 0x2cde,
- 0x2ce0, 0x2ce0,
- 0x2ce2, 0x2ce2,
- 0x2ceb, 0x2ceb,
- 0x2ced, 0x2ced,
- 0xa640, 0xa640,
- 0xa642, 0xa642,
- 0xa644, 0xa644,
- 0xa646, 0xa646,
- 0xa648, 0xa648,
- 0xa64a, 0xa64a,
- 0xa64c, 0xa64c,
- 0xa64e, 0xa64e,
- 0xa650, 0xa650,
- 0xa652, 0xa652,
- 0xa654, 0xa654,
- 0xa656, 0xa656,
- 0xa658, 0xa658,
- 0xa65a, 0xa65a,
- 0xa65c, 0xa65c,
- 0xa65e, 0xa65e,
- 0xa660, 0xa660,
- 0xa662, 0xa662,
- 0xa664, 0xa664,
- 0xa666, 0xa666,
- 0xa668, 0xa668,
- 0xa66a, 0xa66a,
- 0xa66c, 0xa66c,
- 0xa680, 0xa680,
- 0xa682, 0xa682,
- 0xa684, 0xa684,
- 0xa686, 0xa686,
- 0xa688, 0xa688,
- 0xa68a, 0xa68a,
- 0xa68c, 0xa68c,
- 0xa68e, 0xa68e,
- 0xa690, 0xa690,
- 0xa692, 0xa692,
- 0xa694, 0xa694,
- 0xa696, 0xa696,
- 0xa722, 0xa722,
- 0xa724, 0xa724,
- 0xa726, 0xa726,
- 0xa728, 0xa728,
- 0xa72a, 0xa72a,
- 0xa72c, 0xa72c,
- 0xa72e, 0xa72e,
- 0xa732, 0xa732,
- 0xa734, 0xa734,
- 0xa736, 0xa736,
- 0xa738, 0xa738,
- 0xa73a, 0xa73a,
- 0xa73c, 0xa73c,
- 0xa73e, 0xa73e,
- 0xa740, 0xa740,
- 0xa742, 0xa742,
- 0xa744, 0xa744,
- 0xa746, 0xa746,
- 0xa748, 0xa748,
- 0xa74a, 0xa74a,
- 0xa74c, 0xa74c,
- 0xa74e, 0xa74e,
- 0xa750, 0xa750,
- 0xa752, 0xa752,
- 0xa754, 0xa754,
- 0xa756, 0xa756,
- 0xa758, 0xa758,
- 0xa75a, 0xa75a,
- 0xa75c, 0xa75c,
- 0xa75e, 0xa75e,
- 0xa760, 0xa760,
- 0xa762, 0xa762,
- 0xa764, 0xa764,
- 0xa766, 0xa766,
- 0xa768, 0xa768,
- 0xa76a, 0xa76a,
- 0xa76c, 0xa76c,
- 0xa76e, 0xa76e,
- 0xa779, 0xa779,
- 0xa77b, 0xa77b,
- 0xa77d, 0xa77e,
- 0xa780, 0xa780,
- 0xa782, 0xa782,
- 0xa784, 0xa784,
- 0xa786, 0xa786,
- 0xa78b, 0xa78b,
- 0xa78d, 0xa78d,
- 0xa790, 0xa790,
- 0xa7a0, 0xa7a0,
- 0xa7a2, 0xa7a2,
- 0xa7a4, 0xa7a4,
- 0xa7a6, 0xa7a6,
- 0xa7a8, 0xa7a8,
- 0xff21, 0xff3a,
- 0x10400, 0x10427,
- 0x1d400, 0x1d419,
- 0x1d434, 0x1d44d,
- 0x1d468, 0x1d481,
- 0x1d49c, 0x1d49c,
- 0x1d49e, 0x1d49f,
- 0x1d4a2, 0x1d4a2,
- 0x1d4a5, 0x1d4a6,
- 0x1d4a9, 0x1d4ac,
- 0x1d4ae, 0x1d4b5,
- 0x1d4d0, 0x1d4e9,
- 0x1d504, 0x1d505,
- 0x1d507, 0x1d50a,
- 0x1d50d, 0x1d514,
- 0x1d516, 0x1d51c,
- 0x1d538, 0x1d539,
- 0x1d53b, 0x1d53e,
- 0x1d540, 0x1d544,
- 0x1d546, 0x1d546,
- 0x1d54a, 0x1d550,
- 0x1d56c, 0x1d585,
- 0x1d5a0, 0x1d5b9,
- 0x1d5d4, 0x1d5ed,
- 0x1d608, 0x1d621,
- 0x1d63c, 0x1d655,
- 0x1d670, 0x1d689,
- 0x1d6a8, 0x1d6c0,
- 0x1d6e2, 0x1d6fa,
- 0x1d71c, 0x1d734,
- 0x1d756, 0x1d76e,
- 0x1d790, 0x1d7a8,
- 0x1d7ca, 0x1d7ca,
-}; /* CR_Uppercase */
+#define CR_Uppercase CR_Upper
/* 'Cased': Derived Property */
static const OnigCodePoint CR_Cased[] = {
- 112,
+ 119,
0x0041, 0x005a,
0x0061, 0x007a,
0x00aa, 0x00aa,
@@ -6761,6 +10029,8 @@ static const OnigCodePoint CR_Cased[] = {
0x0531, 0x0556,
0x0561, 0x0587,
0x10a0, 0x10c5,
+ 0x10c7, 0x10c7,
+ 0x10cd, 0x10cd,
0x1d00, 0x1dbf,
0x1e00, 0x1f15,
0x1f18, 0x1f1d,
@@ -6781,7 +10051,9 @@ static const OnigCodePoint CR_Cased[] = {
0x1fe0, 0x1fec,
0x1ff2, 0x1ff4,
0x1ff6, 0x1ffc,
- 0x2090, 0x2094,
+ 0x2071, 0x2071,
+ 0x207f, 0x207f,
+ 0x2090, 0x209c,
0x2102, 0x2102,
0x2107, 0x2107,
0x210a, 0x2113,
@@ -6803,14 +10075,17 @@ static const OnigCodePoint CR_Cased[] = {
0x2c30, 0x2c5e,
0x2c60, 0x2ce4,
0x2ceb, 0x2cee,
+ 0x2cf2, 0x2cf3,
0x2d00, 0x2d25,
+ 0x2d27, 0x2d27,
+ 0x2d2d, 0x2d2d,
0xa640, 0xa66d,
0xa680, 0xa697,
0xa722, 0xa787,
0xa78b, 0xa78e,
- 0xa790, 0xa791,
- 0xa7a0, 0xa7a9,
- 0xa7fa, 0xa7fa,
+ 0xa790, 0xa793,
+ 0xa7a0, 0xa7aa,
+ 0xa7f8, 0xa7fa,
0xfb00, 0xfb06,
0xfb13, 0xfb17,
0xff21, 0xff3a,
@@ -6850,7 +10125,7 @@ static const OnigCodePoint CR_Cased[] = {
/* 'Case_Ignorable': Derived Property */
static const OnigCodePoint CR_Case_Ignorable[] = {
- 277,
+ 295,
0x0027, 0x0027,
0x002e, 0x002e,
0x003a, 0x003a,
@@ -6874,7 +10149,7 @@ static const OnigCodePoint CR_Case_Ignorable[] = {
0x05c4, 0x05c5,
0x05c7, 0x05c7,
0x05f4, 0x05f4,
- 0x0600, 0x0603,
+ 0x0600, 0x0604,
0x0610, 0x061a,
0x0640, 0x0640,
0x064b, 0x065f,
@@ -6890,6 +10165,7 @@ static const OnigCodePoint CR_Case_Ignorable[] = {
0x07fa, 0x07fa,
0x0816, 0x082d,
0x0859, 0x085b,
+ 0x08e4, 0x08fe,
0x0900, 0x0902,
0x093a, 0x093a,
0x093c, 0x093c,
@@ -7009,6 +10285,7 @@ static const OnigCodePoint CR_Case_Ignorable[] = {
0x1b80, 0x1b81,
0x1ba2, 0x1ba5,
0x1ba8, 0x1ba9,
+ 0x1bab, 0x1bab,
0x1be6, 0x1be6,
0x1be8, 0x1be9,
0x1bed, 0x1bed,
@@ -7020,7 +10297,8 @@ static const OnigCodePoint CR_Case_Ignorable[] = {
0x1cd4, 0x1ce0,
0x1ce2, 0x1ce8,
0x1ced, 0x1ced,
- 0x1d2c, 0x1d61,
+ 0x1cf4, 0x1cf4,
+ 0x1d2c, 0x1d6a,
0x1d78, 0x1d78,
0x1d9b, 0x1de6,
0x1dfc, 0x1dff,
@@ -7041,14 +10319,14 @@ static const OnigCodePoint CR_Case_Ignorable[] = {
0x207f, 0x207f,
0x2090, 0x209c,
0x20d0, 0x20f0,
- 0x2c7d, 0x2c7d,
+ 0x2c7c, 0x2c7d,
0x2cef, 0x2cf1,
0x2d6f, 0x2d6f,
0x2d7f, 0x2d7f,
0x2de0, 0x2dff,
0x2e2f, 0x2e2f,
0x3005, 0x3005,
- 0x302a, 0x302f,
+ 0x302a, 0x302d,
0x3031, 0x3035,
0x303b, 0x303b,
0x3099, 0x309e,
@@ -7057,12 +10335,14 @@ static const OnigCodePoint CR_Case_Ignorable[] = {
0xa4f8, 0xa4fd,
0xa60c, 0xa60c,
0xa66f, 0xa672,
- 0xa67c, 0xa67d,
+ 0xa674, 0xa67d,
0xa67f, 0xa67f,
+ 0xa69f, 0xa69f,
0xa6f0, 0xa6f1,
0xa700, 0xa721,
0xa770, 0xa770,
0xa788, 0xa78a,
+ 0xa7f8, 0xa7f9,
0xa802, 0xa802,
0xa806, 0xa806,
0xa80b, 0xa80b,
@@ -7088,6 +10368,9 @@ static const OnigCodePoint CR_Case_Ignorable[] = {
0xaabe, 0xaabf,
0xaac1, 0xaac1,
0xaadd, 0xaadd,
+ 0xaaec, 0xaaed,
+ 0xaaf3, 0xaaf4,
+ 0xaaf6, 0xaaf6,
0xabe5, 0xabe5,
0xabe8, 0xabe8,
0xabed, 0xabed,
@@ -7120,6 +10403,16 @@ static const OnigCodePoint CR_Case_Ignorable[] = {
0x110b3, 0x110b6,
0x110b9, 0x110ba,
0x110bd, 0x110bd,
+ 0x11100, 0x11102,
+ 0x11127, 0x1112b,
+ 0x1112d, 0x11134,
+ 0x11180, 0x11181,
+ 0x111b6, 0x111be,
+ 0x116ab, 0x116ab,
+ 0x116ad, 0x116ad,
+ 0x116b0, 0x116b5,
+ 0x116b7, 0x116b7,
+ 0x16f8f, 0x16f9f,
0x1d167, 0x1d169,
0x1d173, 0x1d182,
0x1d185, 0x1d18b,
@@ -7132,7 +10425,7 @@ static const OnigCodePoint CR_Case_Ignorable[] = {
/* 'Changes_When_Lowercased': Derived Property */
static const OnigCodePoint CR_Changes_When_Lowercased[] = {
- 566,
+ 571,
0x0041, 0x005a,
0x00c0, 0x00d6,
0x00d8, 0x00de,
@@ -7400,6 +10693,8 @@ static const OnigCodePoint CR_Changes_When_Lowercased[] = {
0x0526, 0x0526,
0x0531, 0x0556,
0x10a0, 0x10c5,
+ 0x10c7, 0x10c7,
+ 0x10cd, 0x10cd,
0x1e00, 0x1e00,
0x1e02, 0x1e02,
0x1e04, 0x1e04,
@@ -7609,6 +10904,7 @@ static const OnigCodePoint CR_Changes_When_Lowercased[] = {
0x2ce2, 0x2ce2,
0x2ceb, 0x2ceb,
0x2ced, 0x2ced,
+ 0x2cf2, 0x2cf2,
0xa640, 0xa640,
0xa642, 0xa642,
0xa644, 0xa644,
@@ -7692,18 +10988,20 @@ static const OnigCodePoint CR_Changes_When_Lowercased[] = {
0xa78b, 0xa78b,
0xa78d, 0xa78d,
0xa790, 0xa790,
+ 0xa792, 0xa792,
0xa7a0, 0xa7a0,
0xa7a2, 0xa7a2,
0xa7a4, 0xa7a4,
0xa7a6, 0xa7a6,
0xa7a8, 0xa7a8,
+ 0xa7aa, 0xa7aa,
0xff21, 0xff3a,
0x10400, 0x10427,
}; /* CR_Changes_When_Lowercased */
/* 'Changes_When_Uppercased': Derived Property */
static const OnigCodePoint CR_Changes_When_Uppercased[] = {
- 582,
+ 586,
0x0061, 0x007a,
0x00b5, 0x00b5,
0x00df, 0x00f6,
@@ -7853,7 +11151,7 @@ static const OnigCodePoint CR_Changes_When_Uppercased[] = {
0x025b, 0x025b,
0x0260, 0x0260,
0x0263, 0x0263,
- 0x0265, 0x0265,
+ 0x0265, 0x0266,
0x0268, 0x0269,
0x026b, 0x026b,
0x026f, 0x026f,
@@ -8194,7 +11492,10 @@ static const OnigCodePoint CR_Changes_When_Uppercased[] = {
0x2ce3, 0x2ce3,
0x2cec, 0x2cec,
0x2cee, 0x2cee,
+ 0x2cf3, 0x2cf3,
0x2d00, 0x2d25,
+ 0x2d27, 0x2d27,
+ 0x2d2d, 0x2d2d,
0xa641, 0xa641,
0xa643, 0xa643,
0xa645, 0xa645,
@@ -8277,6 +11578,7 @@ static const OnigCodePoint CR_Changes_When_Uppercased[] = {
0xa787, 0xa787,
0xa78c, 0xa78c,
0xa791, 0xa791,
+ 0xa793, 0xa793,
0xa7a1, 0xa7a1,
0xa7a3, 0xa7a3,
0xa7a5, 0xa7a5,
@@ -8290,7 +11592,7 @@ static const OnigCodePoint CR_Changes_When_Uppercased[] = {
/* 'Changes_When_Titlecased': Derived Property */
static const OnigCodePoint CR_Changes_When_Titlecased[] = {
- 583,
+ 587,
0x0061, 0x007a,
0x00b5, 0x00b5,
0x00df, 0x00f6,
@@ -8441,7 +11743,7 @@ static const OnigCodePoint CR_Changes_When_Titlecased[] = {
0x025b, 0x025b,
0x0260, 0x0260,
0x0263, 0x0263,
- 0x0265, 0x0265,
+ 0x0265, 0x0266,
0x0268, 0x0269,
0x026b, 0x026b,
0x026f, 0x026f,
@@ -8782,7 +12084,10 @@ static const OnigCodePoint CR_Changes_When_Titlecased[] = {
0x2ce3, 0x2ce3,
0x2cec, 0x2cec,
0x2cee, 0x2cee,
+ 0x2cf3, 0x2cf3,
0x2d00, 0x2d25,
+ 0x2d27, 0x2d27,
+ 0x2d2d, 0x2d2d,
0xa641, 0xa641,
0xa643, 0xa643,
0xa645, 0xa645,
@@ -8865,6 +12170,7 @@ static const OnigCodePoint CR_Changes_When_Titlecased[] = {
0xa787, 0xa787,
0xa78c, 0xa78c,
0xa791, 0xa791,
+ 0xa793, 0xa793,
0xa7a1, 0xa7a1,
0xa7a3, 0xa7a3,
0xa7a5, 0xa7a5,
@@ -8878,7 +12184,7 @@ static const OnigCodePoint CR_Changes_When_Titlecased[] = {
/* 'Changes_When_Casefolded': Derived Property */
static const OnigCodePoint CR_Changes_When_Casefolded[] = {
- 577,
+ 582,
0x0041, 0x005a,
0x00b5, 0x00b5,
0x00c0, 0x00d6,
@@ -9153,6 +12459,8 @@ static const OnigCodePoint CR_Changes_When_Casefolded[] = {
0x0531, 0x0556,
0x0587, 0x0587,
0x10a0, 0x10c5,
+ 0x10c7, 0x10c7,
+ 0x10cd, 0x10cd,
0x1e00, 0x1e00,
0x1e02, 0x1e02,
0x1e04, 0x1e04,
@@ -9364,6 +12672,7 @@ static const OnigCodePoint CR_Changes_When_Casefolded[] = {
0x2ce2, 0x2ce2,
0x2ceb, 0x2ceb,
0x2ced, 0x2ced,
+ 0x2cf2, 0x2cf2,
0xa640, 0xa640,
0xa642, 0xa642,
0xa644, 0xa644,
@@ -9447,11 +12756,13 @@ static const OnigCodePoint CR_Changes_When_Casefolded[] = {
0xa78b, 0xa78b,
0xa78d, 0xa78d,
0xa790, 0xa790,
+ 0xa792, 0xa792,
0xa7a0, 0xa7a0,
0xa7a2, 0xa7a2,
0xa7a4, 0xa7a4,
0xa7a6, 0xa7a6,
0xa7a8, 0xa7a8,
+ 0xa7aa, 0xa7aa,
0xfb00, 0xfb06,
0xfb13, 0xfb17,
0xff21, 0xff3a,
@@ -9460,7 +12771,7 @@ static const OnigCodePoint CR_Changes_When_Casefolded[] = {
/* 'Changes_When_Casemapped': Derived Property */
static const OnigCodePoint CR_Changes_When_Casemapped[] = {
- 99,
+ 104,
0x0041, 0x005a,
0x0061, 0x007a,
0x00b5, 0x00b5,
@@ -9481,7 +12792,7 @@ static const OnigCodePoint CR_Changes_When_Casemapped[] = {
0x025b, 0x025b,
0x0260, 0x0260,
0x0263, 0x0263,
- 0x0265, 0x0265,
+ 0x0265, 0x0266,
0x0268, 0x0269,
0x026b, 0x026b,
0x026f, 0x026f,
@@ -9509,6 +12820,8 @@ static const OnigCodePoint CR_Changes_When_Casemapped[] = {
0x0531, 0x0556,
0x0561, 0x0587,
0x10a0, 0x10c5,
+ 0x10c7, 0x10c7,
+ 0x10cd, 0x10cd,
0x1d79, 0x1d79,
0x1d7d, 0x1d7d,
0x1e00, 0x1e9b,
@@ -9546,15 +12859,18 @@ static const OnigCodePoint CR_Changes_When_Casemapped[] = {
0x2c75, 0x2c76,
0x2c7e, 0x2ce3,
0x2ceb, 0x2cee,
+ 0x2cf2, 0x2cf3,
0x2d00, 0x2d25,
+ 0x2d27, 0x2d27,
+ 0x2d2d, 0x2d2d,
0xa640, 0xa66d,
0xa680, 0xa697,
0xa722, 0xa72f,
0xa732, 0xa76f,
0xa779, 0xa787,
0xa78b, 0xa78d,
- 0xa790, 0xa791,
- 0xa7a0, 0xa7a9,
+ 0xa790, 0xa793,
+ 0xa7a0, 0xa7aa,
0xfb00, 0xfb06,
0xfb13, 0xfb17,
0xff21, 0xff3a,
@@ -9564,7 +12880,7 @@ static const OnigCodePoint CR_Changes_When_Casemapped[] = {
/* 'ID_Start': Derived Property */
static const OnigCodePoint CR_ID_Start[] = {
- 437,
+ 488,
0x0041, 0x005a,
0x0061, 0x007a,
0x00aa, 0x00aa,
@@ -9612,6 +12928,8 @@ static const OnigCodePoint CR_ID_Start[] = {
0x0824, 0x0824,
0x0828, 0x0828,
0x0840, 0x0858,
+ 0x08a0, 0x08a0,
+ 0x08a2, 0x08ac,
0x0904, 0x0939,
0x093d, 0x093d,
0x0950, 0x0950,
@@ -9717,7 +13035,7 @@ static const OnigCodePoint CR_ID_Start[] = {
0x0ebd, 0x0ebd,
0x0ec0, 0x0ec4,
0x0ec6, 0x0ec6,
- 0x0edc, 0x0edd,
+ 0x0edc, 0x0edf,
0x0f00, 0x0f00,
0x0f40, 0x0f47,
0x0f49, 0x0f6c,
@@ -9732,9 +13050,10 @@ static const OnigCodePoint CR_ID_Start[] = {
0x1075, 0x1081,
0x108e, 0x108e,
0x10a0, 0x10c5,
+ 0x10c7, 0x10c7,
+ 0x10cd, 0x10cd,
0x10d0, 0x10fa,
- 0x10fc, 0x10fc,
- 0x1100, 0x1248,
+ 0x10fc, 0x1248,
0x124a, 0x124d,
0x1250, 0x1256,
0x1258, 0x1258,
@@ -9782,12 +13101,13 @@ static const OnigCodePoint CR_ID_Start[] = {
0x1b45, 0x1b4b,
0x1b83, 0x1ba0,
0x1bae, 0x1baf,
- 0x1bc0, 0x1be5,
+ 0x1bba, 0x1be5,
0x1c00, 0x1c23,
0x1c4d, 0x1c4f,
0x1c5a, 0x1c7d,
0x1ce9, 0x1cec,
0x1cee, 0x1cf1,
+ 0x1cf5, 0x1cf6,
0x1d00, 0x1dbf,
0x1e00, 0x1f15,
0x1f18, 0x1f1d,
@@ -9828,8 +13148,11 @@ static const OnigCodePoint CR_ID_Start[] = {
0x2c30, 0x2c5e,
0x2c60, 0x2ce4,
0x2ceb, 0x2cee,
+ 0x2cf2, 0x2cf3,
0x2d00, 0x2d25,
- 0x2d30, 0x2d65,
+ 0x2d27, 0x2d27,
+ 0x2d2d, 0x2d2d,
+ 0x2d30, 0x2d67,
0x2d6f, 0x2d6f,
0x2d80, 0x2d96,
0x2da0, 0x2da6,
@@ -9853,7 +13176,7 @@ static const OnigCodePoint CR_ID_Start[] = {
0x31a0, 0x31ba,
0x31f0, 0x31ff,
0x3400, 0x4db5,
- 0x4e00, 0x9fcb,
+ 0x4e00, 0x9fcc,
0xa000, 0xa48c,
0xa4d0, 0xa4fd,
0xa500, 0xa60c,
@@ -9865,9 +13188,9 @@ static const OnigCodePoint CR_ID_Start[] = {
0xa717, 0xa71f,
0xa722, 0xa788,
0xa78b, 0xa78e,
- 0xa790, 0xa791,
- 0xa7a0, 0xa7a9,
- 0xa7fa, 0xa801,
+ 0xa790, 0xa793,
+ 0xa7a0, 0xa7aa,
+ 0xa7f8, 0xa801,
0xa803, 0xa805,
0xa807, 0xa80a,
0xa80c, 0xa822,
@@ -9892,6 +13215,8 @@ static const OnigCodePoint CR_ID_Start[] = {
0xaac0, 0xaac0,
0xaac2, 0xaac2,
0xaadb, 0xaadd,
+ 0xaae0, 0xaaea,
+ 0xaaf2, 0xaaf4,
0xab01, 0xab06,
0xab09, 0xab0e,
0xab11, 0xab16,
@@ -9901,8 +13226,7 @@ static const OnigCodePoint CR_ID_Start[] = {
0xac00, 0xd7a3,
0xd7b0, 0xd7c6,
0xd7cb, 0xd7fb,
- 0xf900, 0xfa2d,
- 0xfa30, 0xfa6d,
+ 0xf900, 0xfa6d,
0xfa70, 0xfad9,
0xfb00, 0xfb06,
0xfb13, 0xfb17,
@@ -9952,6 +13276,8 @@ static const OnigCodePoint CR_ID_Start[] = {
0x1083f, 0x10855,
0x10900, 0x10915,
0x10920, 0x10939,
+ 0x10980, 0x109b7,
+ 0x109be, 0x109bf,
0x10a00, 0x10a00,
0x10a10, 0x10a13,
0x10a15, 0x10a17,
@@ -9963,10 +13289,18 @@ static const OnigCodePoint CR_ID_Start[] = {
0x10c00, 0x10c48,
0x11003, 0x11037,
0x11083, 0x110af,
+ 0x110d0, 0x110e8,
+ 0x11103, 0x11126,
+ 0x11183, 0x111b2,
+ 0x111c1, 0x111c4,
+ 0x11680, 0x116aa,
0x12000, 0x1236e,
0x12400, 0x12462,
0x13000, 0x1342e,
0x16800, 0x16a38,
+ 0x16f00, 0x16f44,
+ 0x16f50, 0x16f50,
+ 0x16f93, 0x16f9f,
0x1b000, 0x1b001,
0x1d400, 0x1d454,
0x1d456, 0x1d49c,
@@ -9998,6 +13332,39 @@ static const OnigCodePoint CR_ID_Start[] = {
0x1d78a, 0x1d7a8,
0x1d7aa, 0x1d7c2,
0x1d7c4, 0x1d7cb,
+ 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,
0x20000, 0x2a6d6,
0x2a700, 0x2b734,
0x2b740, 0x2b81d,
@@ -10006,7 +13373,7 @@ static const OnigCodePoint CR_ID_Start[] = {
/* 'ID_Continue': Derived Property */
static const OnigCodePoint CR_ID_Continue[] = {
- 514,
+ 564,
0x0030, 0x0039,
0x0041, 0x005a,
0x005f, 0x005f,
@@ -10055,6 +13422,9 @@ static const OnigCodePoint CR_ID_Continue[] = {
0x07fa, 0x07fa,
0x0800, 0x082d,
0x0840, 0x085b,
+ 0x08a0, 0x08a0,
+ 0x08a2, 0x08ac,
+ 0x08e4, 0x08fe,
0x0900, 0x0963,
0x0966, 0x096f,
0x0971, 0x0977,
@@ -10202,7 +13572,7 @@ static const OnigCodePoint CR_ID_Continue[] = {
0x0ec6, 0x0ec6,
0x0ec8, 0x0ecd,
0x0ed0, 0x0ed9,
- 0x0edc, 0x0edd,
+ 0x0edc, 0x0edf,
0x0f00, 0x0f00,
0x0f18, 0x0f19,
0x0f20, 0x0f29,
@@ -10218,9 +13588,10 @@ static const OnigCodePoint CR_ID_Continue[] = {
0x1000, 0x1049,
0x1050, 0x109d,
0x10a0, 0x10c5,
+ 0x10c7, 0x10c7,
+ 0x10cd, 0x10cd,
0x10d0, 0x10fa,
- 0x10fc, 0x10fc,
- 0x1100, 0x1248,
+ 0x10fc, 0x1248,
0x124a, 0x124d,
0x1250, 0x1256,
0x1258, 0x1258,
@@ -10252,8 +13623,7 @@ static const OnigCodePoint CR_ID_Continue[] = {
0x1760, 0x176c,
0x176e, 0x1770,
0x1772, 0x1773,
- 0x1780, 0x17b3,
- 0x17b6, 0x17d3,
+ 0x1780, 0x17d3,
0x17d7, 0x17d7,
0x17dc, 0x17dd,
0x17e0, 0x17e9,
@@ -10279,14 +13649,12 @@ static const OnigCodePoint CR_ID_Continue[] = {
0x1b00, 0x1b4b,
0x1b50, 0x1b59,
0x1b6b, 0x1b73,
- 0x1b80, 0x1baa,
- 0x1bae, 0x1bb9,
- 0x1bc0, 0x1bf3,
+ 0x1b80, 0x1bf3,
0x1c00, 0x1c37,
0x1c40, 0x1c49,
0x1c4d, 0x1c7d,
0x1cd0, 0x1cd2,
- 0x1cd4, 0x1cf2,
+ 0x1cd4, 0x1cf6,
0x1d00, 0x1de6,
0x1dfc, 0x1f15,
0x1f18, 0x1f1d,
@@ -10331,9 +13699,11 @@ static const OnigCodePoint CR_ID_Continue[] = {
0x2c00, 0x2c2e,
0x2c30, 0x2c5e,
0x2c60, 0x2ce4,
- 0x2ceb, 0x2cf1,
+ 0x2ceb, 0x2cf3,
0x2d00, 0x2d25,
- 0x2d30, 0x2d65,
+ 0x2d27, 0x2d27,
+ 0x2d2d, 0x2d2d,
+ 0x2d30, 0x2d67,
0x2d6f, 0x2d6f,
0x2d7f, 0x2d96,
0x2da0, 0x2da6,
@@ -10358,21 +13728,21 @@ static const OnigCodePoint CR_ID_Continue[] = {
0x31a0, 0x31ba,
0x31f0, 0x31ff,
0x3400, 0x4db5,
- 0x4e00, 0x9fcb,
+ 0x4e00, 0x9fcc,
0xa000, 0xa48c,
0xa4d0, 0xa4fd,
0xa500, 0xa60c,
0xa610, 0xa62b,
0xa640, 0xa66f,
- 0xa67c, 0xa67d,
+ 0xa674, 0xa67d,
0xa67f, 0xa697,
- 0xa6a0, 0xa6f1,
+ 0xa69f, 0xa6f1,
0xa717, 0xa71f,
0xa722, 0xa788,
0xa78b, 0xa78e,
- 0xa790, 0xa791,
- 0xa7a0, 0xa7a9,
- 0xa7fa, 0xa827,
+ 0xa790, 0xa793,
+ 0xa7a0, 0xa7aa,
+ 0xa7f8, 0xa827,
0xa840, 0xa873,
0xa880, 0xa8c4,
0xa8d0, 0xa8d9,
@@ -10390,6 +13760,8 @@ static const OnigCodePoint CR_ID_Continue[] = {
0xaa7a, 0xaa7b,
0xaa80, 0xaac2,
0xaadb, 0xaadd,
+ 0xaae0, 0xaaef,
+ 0xaaf2, 0xaaf6,
0xab01, 0xab06,
0xab09, 0xab0e,
0xab11, 0xab16,
@@ -10401,8 +13773,7 @@ static const OnigCodePoint CR_ID_Continue[] = {
0xac00, 0xd7a3,
0xd7b0, 0xd7c6,
0xd7cb, 0xd7fb,
- 0xf900, 0xfa2d,
- 0xfa30, 0xfa6d,
+ 0xf900, 0xfa6d,
0xfa70, 0xfad9,
0xfb00, 0xfb06,
0xfb13, 0xfb17,
@@ -10459,6 +13830,8 @@ static const OnigCodePoint CR_ID_Continue[] = {
0x1083f, 0x10855,
0x10900, 0x10915,
0x10920, 0x10939,
+ 0x10980, 0x109b7,
+ 0x109be, 0x109bf,
0x10a00, 0x10a03,
0x10a05, 0x10a06,
0x10a0c, 0x10a13,
@@ -10474,10 +13847,21 @@ static const OnigCodePoint CR_ID_Continue[] = {
0x11000, 0x11046,
0x11066, 0x1106f,
0x11080, 0x110ba,
+ 0x110d0, 0x110e8,
+ 0x110f0, 0x110f9,
+ 0x11100, 0x11134,
+ 0x11136, 0x1113f,
+ 0x11180, 0x111c4,
+ 0x111d0, 0x111d9,
+ 0x11680, 0x116b7,
+ 0x116c0, 0x116c9,
0x12000, 0x1236e,
0x12400, 0x12462,
0x13000, 0x1342e,
0x16800, 0x16a38,
+ 0x16f00, 0x16f44,
+ 0x16f50, 0x16f7e,
+ 0x16f8f, 0x16f9f,
0x1b000, 0x1b001,
0x1d165, 0x1d169,
0x1d16d, 0x1d172,
@@ -10516,6 +13900,39 @@ static const OnigCodePoint CR_ID_Continue[] = {
0x1d7aa, 0x1d7c2,
0x1d7c4, 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,
0x20000, 0x2a6d6,
0x2a700, 0x2b734,
0x2b740, 0x2b81d,
@@ -10525,7 +13942,7 @@ static const OnigCodePoint CR_ID_Continue[] = {
/* 'XID_Start': Derived Property */
static const OnigCodePoint CR_XID_Start[] = {
- 444,
+ 495,
0x0041, 0x005a,
0x0061, 0x007a,
0x00aa, 0x00aa,
@@ -10573,6 +13990,8 @@ static const OnigCodePoint CR_XID_Start[] = {
0x0824, 0x0824,
0x0828, 0x0828,
0x0840, 0x0858,
+ 0x08a0, 0x08a0,
+ 0x08a2, 0x08ac,
0x0904, 0x0939,
0x093d, 0x093d,
0x0950, 0x0950,
@@ -10678,7 +14097,7 @@ static const OnigCodePoint CR_XID_Start[] = {
0x0ebd, 0x0ebd,
0x0ec0, 0x0ec4,
0x0ec6, 0x0ec6,
- 0x0edc, 0x0edd,
+ 0x0edc, 0x0edf,
0x0f00, 0x0f00,
0x0f40, 0x0f47,
0x0f49, 0x0f6c,
@@ -10693,9 +14112,10 @@ static const OnigCodePoint CR_XID_Start[] = {
0x1075, 0x1081,
0x108e, 0x108e,
0x10a0, 0x10c5,
+ 0x10c7, 0x10c7,
+ 0x10cd, 0x10cd,
0x10d0, 0x10fa,
- 0x10fc, 0x10fc,
- 0x1100, 0x1248,
+ 0x10fc, 0x1248,
0x124a, 0x124d,
0x1250, 0x1256,
0x1258, 0x1258,
@@ -10743,12 +14163,13 @@ static const OnigCodePoint CR_XID_Start[] = {
0x1b45, 0x1b4b,
0x1b83, 0x1ba0,
0x1bae, 0x1baf,
- 0x1bc0, 0x1be5,
+ 0x1bba, 0x1be5,
0x1c00, 0x1c23,
0x1c4d, 0x1c4f,
0x1c5a, 0x1c7d,
0x1ce9, 0x1cec,
0x1cee, 0x1cf1,
+ 0x1cf5, 0x1cf6,
0x1d00, 0x1dbf,
0x1e00, 0x1f15,
0x1f18, 0x1f1d,
@@ -10789,8 +14210,11 @@ static const OnigCodePoint CR_XID_Start[] = {
0x2c30, 0x2c5e,
0x2c60, 0x2ce4,
0x2ceb, 0x2cee,
+ 0x2cf2, 0x2cf3,
0x2d00, 0x2d25,
- 0x2d30, 0x2d65,
+ 0x2d27, 0x2d27,
+ 0x2d2d, 0x2d2d,
+ 0x2d30, 0x2d67,
0x2d6f, 0x2d6f,
0x2d80, 0x2d96,
0x2da0, 0x2da6,
@@ -10814,7 +14238,7 @@ static const OnigCodePoint CR_XID_Start[] = {
0x31a0, 0x31ba,
0x31f0, 0x31ff,
0x3400, 0x4db5,
- 0x4e00, 0x9fcb,
+ 0x4e00, 0x9fcc,
0xa000, 0xa48c,
0xa4d0, 0xa4fd,
0xa500, 0xa60c,
@@ -10826,9 +14250,9 @@ static const OnigCodePoint CR_XID_Start[] = {
0xa717, 0xa71f,
0xa722, 0xa788,
0xa78b, 0xa78e,
- 0xa790, 0xa791,
- 0xa7a0, 0xa7a9,
- 0xa7fa, 0xa801,
+ 0xa790, 0xa793,
+ 0xa7a0, 0xa7aa,
+ 0xa7f8, 0xa801,
0xa803, 0xa805,
0xa807, 0xa80a,
0xa80c, 0xa822,
@@ -10853,6 +14277,8 @@ static const OnigCodePoint CR_XID_Start[] = {
0xaac0, 0xaac0,
0xaac2, 0xaac2,
0xaadb, 0xaadd,
+ 0xaae0, 0xaaea,
+ 0xaaf2, 0xaaf4,
0xab01, 0xab06,
0xab09, 0xab0e,
0xab11, 0xab16,
@@ -10862,8 +14288,7 @@ static const OnigCodePoint CR_XID_Start[] = {
0xac00, 0xd7a3,
0xd7b0, 0xd7c6,
0xd7cb, 0xd7fb,
- 0xf900, 0xfa2d,
- 0xfa30, 0xfa6d,
+ 0xf900, 0xfa6d,
0xfa70, 0xfad9,
0xfb00, 0xfb06,
0xfb13, 0xfb17,
@@ -10920,6 +14345,8 @@ static const OnigCodePoint CR_XID_Start[] = {
0x1083f, 0x10855,
0x10900, 0x10915,
0x10920, 0x10939,
+ 0x10980, 0x109b7,
+ 0x109be, 0x109bf,
0x10a00, 0x10a00,
0x10a10, 0x10a13,
0x10a15, 0x10a17,
@@ -10931,10 +14358,18 @@ static const OnigCodePoint CR_XID_Start[] = {
0x10c00, 0x10c48,
0x11003, 0x11037,
0x11083, 0x110af,
+ 0x110d0, 0x110e8,
+ 0x11103, 0x11126,
+ 0x11183, 0x111b2,
+ 0x111c1, 0x111c4,
+ 0x11680, 0x116aa,
0x12000, 0x1236e,
0x12400, 0x12462,
0x13000, 0x1342e,
0x16800, 0x16a38,
+ 0x16f00, 0x16f44,
+ 0x16f50, 0x16f50,
+ 0x16f93, 0x16f9f,
0x1b000, 0x1b001,
0x1d400, 0x1d454,
0x1d456, 0x1d49c,
@@ -10966,6 +14401,39 @@ static const OnigCodePoint CR_XID_Start[] = {
0x1d78a, 0x1d7a8,
0x1d7aa, 0x1d7c2,
0x1d7c4, 0x1d7cb,
+ 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,
0x20000, 0x2a6d6,
0x2a700, 0x2b734,
0x2b740, 0x2b81d,
@@ -10974,7 +14442,7 @@ static const OnigCodePoint CR_XID_Start[] = {
/* 'XID_Continue': Derived Property */
static const OnigCodePoint CR_XID_Continue[] = {
- 521,
+ 571,
0x0030, 0x0039,
0x0041, 0x005a,
0x005f, 0x005f,
@@ -11023,6 +14491,9 @@ static const OnigCodePoint CR_XID_Continue[] = {
0x07fa, 0x07fa,
0x0800, 0x082d,
0x0840, 0x085b,
+ 0x08a0, 0x08a0,
+ 0x08a2, 0x08ac,
+ 0x08e4, 0x08fe,
0x0900, 0x0963,
0x0966, 0x096f,
0x0971, 0x0977,
@@ -11170,7 +14641,7 @@ static const OnigCodePoint CR_XID_Continue[] = {
0x0ec6, 0x0ec6,
0x0ec8, 0x0ecd,
0x0ed0, 0x0ed9,
- 0x0edc, 0x0edd,
+ 0x0edc, 0x0edf,
0x0f00, 0x0f00,
0x0f18, 0x0f19,
0x0f20, 0x0f29,
@@ -11186,9 +14657,10 @@ static const OnigCodePoint CR_XID_Continue[] = {
0x1000, 0x1049,
0x1050, 0x109d,
0x10a0, 0x10c5,
+ 0x10c7, 0x10c7,
+ 0x10cd, 0x10cd,
0x10d0, 0x10fa,
- 0x10fc, 0x10fc,
- 0x1100, 0x1248,
+ 0x10fc, 0x1248,
0x124a, 0x124d,
0x1250, 0x1256,
0x1258, 0x1258,
@@ -11220,8 +14692,7 @@ static const OnigCodePoint CR_XID_Continue[] = {
0x1760, 0x176c,
0x176e, 0x1770,
0x1772, 0x1773,
- 0x1780, 0x17b3,
- 0x17b6, 0x17d3,
+ 0x1780, 0x17d3,
0x17d7, 0x17d7,
0x17dc, 0x17dd,
0x17e0, 0x17e9,
@@ -11247,14 +14718,12 @@ static const OnigCodePoint CR_XID_Continue[] = {
0x1b00, 0x1b4b,
0x1b50, 0x1b59,
0x1b6b, 0x1b73,
- 0x1b80, 0x1baa,
- 0x1bae, 0x1bb9,
- 0x1bc0, 0x1bf3,
+ 0x1b80, 0x1bf3,
0x1c00, 0x1c37,
0x1c40, 0x1c49,
0x1c4d, 0x1c7d,
0x1cd0, 0x1cd2,
- 0x1cd4, 0x1cf2,
+ 0x1cd4, 0x1cf6,
0x1d00, 0x1de6,
0x1dfc, 0x1f15,
0x1f18, 0x1f1d,
@@ -11299,9 +14768,11 @@ static const OnigCodePoint CR_XID_Continue[] = {
0x2c00, 0x2c2e,
0x2c30, 0x2c5e,
0x2c60, 0x2ce4,
- 0x2ceb, 0x2cf1,
+ 0x2ceb, 0x2cf3,
0x2d00, 0x2d25,
- 0x2d30, 0x2d65,
+ 0x2d27, 0x2d27,
+ 0x2d2d, 0x2d2d,
+ 0x2d30, 0x2d67,
0x2d6f, 0x2d6f,
0x2d7f, 0x2d96,
0x2da0, 0x2da6,
@@ -11327,21 +14798,21 @@ static const OnigCodePoint CR_XID_Continue[] = {
0x31a0, 0x31ba,
0x31f0, 0x31ff,
0x3400, 0x4db5,
- 0x4e00, 0x9fcb,
+ 0x4e00, 0x9fcc,
0xa000, 0xa48c,
0xa4d0, 0xa4fd,
0xa500, 0xa60c,
0xa610, 0xa62b,
0xa640, 0xa66f,
- 0xa67c, 0xa67d,
+ 0xa674, 0xa67d,
0xa67f, 0xa697,
- 0xa6a0, 0xa6f1,
+ 0xa69f, 0xa6f1,
0xa717, 0xa71f,
0xa722, 0xa788,
0xa78b, 0xa78e,
- 0xa790, 0xa791,
- 0xa7a0, 0xa7a9,
- 0xa7fa, 0xa827,
+ 0xa790, 0xa793,
+ 0xa7a0, 0xa7aa,
+ 0xa7f8, 0xa827,
0xa840, 0xa873,
0xa880, 0xa8c4,
0xa8d0, 0xa8d9,
@@ -11359,6 +14830,8 @@ static const OnigCodePoint CR_XID_Continue[] = {
0xaa7a, 0xaa7b,
0xaa80, 0xaac2,
0xaadb, 0xaadd,
+ 0xaae0, 0xaaef,
+ 0xaaf2, 0xaaf6,
0xab01, 0xab06,
0xab09, 0xab0e,
0xab11, 0xab16,
@@ -11370,8 +14843,7 @@ static const OnigCodePoint CR_XID_Continue[] = {
0xac00, 0xd7a3,
0xd7b0, 0xd7c6,
0xd7cb, 0xd7fb,
- 0xf900, 0xfa2d,
- 0xfa30, 0xfa6d,
+ 0xf900, 0xfa6d,
0xfa70, 0xfad9,
0xfb00, 0xfb06,
0xfb13, 0xfb17,
@@ -11434,6 +14906,8 @@ static const OnigCodePoint CR_XID_Continue[] = {
0x1083f, 0x10855,
0x10900, 0x10915,
0x10920, 0x10939,
+ 0x10980, 0x109b7,
+ 0x109be, 0x109bf,
0x10a00, 0x10a03,
0x10a05, 0x10a06,
0x10a0c, 0x10a13,
@@ -11449,10 +14923,21 @@ static const OnigCodePoint CR_XID_Continue[] = {
0x11000, 0x11046,
0x11066, 0x1106f,
0x11080, 0x110ba,
+ 0x110d0, 0x110e8,
+ 0x110f0, 0x110f9,
+ 0x11100, 0x11134,
+ 0x11136, 0x1113f,
+ 0x11180, 0x111c4,
+ 0x111d0, 0x111d9,
+ 0x11680, 0x116b7,
+ 0x116c0, 0x116c9,
0x12000, 0x1236e,
0x12400, 0x12462,
0x13000, 0x1342e,
0x16800, 0x16a38,
+ 0x16f00, 0x16f44,
+ 0x16f50, 0x16f7e,
+ 0x16f8f, 0x16f9f,
0x1b000, 0x1b001,
0x1d165, 0x1d169,
0x1d16d, 0x1d172,
@@ -11491,6 +14976,39 @@ static const OnigCodePoint CR_XID_Continue[] = {
0x1d7aa, 0x1d7c2,
0x1d7c4, 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,
0x20000, 0x2a6d6,
0x2a700, 0x2b734,
0x2b740, 0x2b81d,
@@ -11520,7 +15038,7 @@ static const OnigCodePoint CR_Default_Ignorable_Code_Point[] = {
/* 'Grapheme_Extend': Derived Property */
static const OnigCodePoint CR_Grapheme_Extend[] = {
- 215,
+ 232,
0x0300, 0x036f,
0x0483, 0x0489,
0x0591, 0x05bd,
@@ -11544,6 +15062,7 @@ static const OnigCodePoint CR_Grapheme_Extend[] = {
0x0825, 0x0827,
0x0829, 0x082d,
0x0859, 0x085b,
+ 0x08e4, 0x08fe,
0x0900, 0x0902,
0x093a, 0x093a,
0x093c, 0x093c,
@@ -11639,6 +15158,7 @@ static const OnigCodePoint CR_Grapheme_Extend[] = {
0x1732, 0x1734,
0x1752, 0x1753,
0x1772, 0x1773,
+ 0x17b4, 0x17b5,
0x17b7, 0x17bd,
0x17c6, 0x17c6,
0x17c9, 0x17d3,
@@ -11666,6 +15186,7 @@ static const OnigCodePoint CR_Grapheme_Extend[] = {
0x1b80, 0x1b81,
0x1ba2, 0x1ba5,
0x1ba8, 0x1ba9,
+ 0x1bab, 0x1bab,
0x1be6, 0x1be6,
0x1be8, 0x1be9,
0x1bed, 0x1bed,
@@ -11676,6 +15197,7 @@ static const OnigCodePoint CR_Grapheme_Extend[] = {
0x1cd4, 0x1ce0,
0x1ce2, 0x1ce8,
0x1ced, 0x1ced,
+ 0x1cf4, 0x1cf4,
0x1dc0, 0x1de6,
0x1dfc, 0x1dff,
0x200c, 0x200d,
@@ -11686,7 +15208,8 @@ static const OnigCodePoint CR_Grapheme_Extend[] = {
0x302a, 0x302f,
0x3099, 0x309a,
0xa66f, 0xa672,
- 0xa67c, 0xa67d,
+ 0xa674, 0xa67d,
+ 0xa69f, 0xa69f,
0xa6f0, 0xa6f1,
0xa802, 0xa802,
0xa806, 0xa806,
@@ -11710,6 +15233,8 @@ static const OnigCodePoint CR_Grapheme_Extend[] = {
0xaab7, 0xaab8,
0xaabe, 0xaabf,
0xaac1, 0xaac1,
+ 0xaaec, 0xaaed,
+ 0xaaf6, 0xaaf6,
0xabe5, 0xabe5,
0xabe8, 0xabe8,
0xabed, 0xabed,
@@ -11728,6 +15253,16 @@ static const OnigCodePoint CR_Grapheme_Extend[] = {
0x11080, 0x11081,
0x110b3, 0x110b6,
0x110b9, 0x110ba,
+ 0x11100, 0x11102,
+ 0x11127, 0x1112b,
+ 0x1112d, 0x11134,
+ 0x11180, 0x11181,
+ 0x111b6, 0x111be,
+ 0x116ab, 0x116ab,
+ 0x116ad, 0x116ad,
+ 0x116b0, 0x116b5,
+ 0x116b7, 0x116b7,
+ 0x16f8f, 0x16f92,
0x1d165, 0x1d165,
0x1d167, 0x1d169,
0x1d16e, 0x1d172,
@@ -11740,7 +15275,7 @@ static const OnigCodePoint CR_Grapheme_Extend[] = {
/* 'Grapheme_Base': Derived Property */
static const OnigCodePoint CR_Grapheme_Base[] = {
- 596,
+ 643,
0x0020, 0x007e,
0x00a0, 0x00ac,
0x00ae, 0x02ff,
@@ -11755,6 +15290,7 @@ static const OnigCodePoint CR_Grapheme_Base[] = {
0x0559, 0x055f,
0x0561, 0x0587,
0x0589, 0x058a,
+ 0x058f, 0x058f,
0x05be, 0x05be,
0x05c0, 0x05c0,
0x05c3, 0x05c3,
@@ -11783,6 +15319,8 @@ static const OnigCodePoint CR_Grapheme_Base[] = {
0x0830, 0x083e,
0x0840, 0x0858,
0x085e, 0x085e,
+ 0x08a0, 0x08a0,
+ 0x08a2, 0x08ac,
0x0903, 0x0939,
0x093b, 0x093b,
0x093d, 0x0940,
@@ -11831,8 +15369,7 @@ static const OnigCodePoint CR_Grapheme_Base[] = {
0x0acb, 0x0acc,
0x0ad0, 0x0ad0,
0x0ae0, 0x0ae1,
- 0x0ae6, 0x0aef,
- 0x0af1, 0x0af1,
+ 0x0ae6, 0x0af1,
0x0b02, 0x0b03,
0x0b05, 0x0b0c,
0x0b0f, 0x0b10,
@@ -11932,7 +15469,7 @@ static const OnigCodePoint CR_Grapheme_Base[] = {
0x0ec0, 0x0ec4,
0x0ec6, 0x0ec6,
0x0ed0, 0x0ed9,
- 0x0edc, 0x0edd,
+ 0x0edc, 0x0edf,
0x0f00, 0x0f17,
0x0f1a, 0x0f34,
0x0f36, 0x0f36,
@@ -11957,8 +15494,9 @@ static const OnigCodePoint CR_Grapheme_Base[] = {
0x1087, 0x108c,
0x108e, 0x109c,
0x109e, 0x10c5,
- 0x10d0, 0x10fc,
- 0x1100, 0x1248,
+ 0x10c7, 0x10c7,
+ 0x10cd, 0x10cd,
+ 0x10d0, 0x1248,
0x124a, 0x124d,
0x1250, 0x1256,
0x1258, 0x1258,
@@ -12031,8 +15569,7 @@ static const OnigCodePoint CR_Grapheme_Base[] = {
0x1b82, 0x1ba1,
0x1ba6, 0x1ba7,
0x1baa, 0x1baa,
- 0x1bae, 0x1bb9,
- 0x1bc0, 0x1be5,
+ 0x1bac, 0x1be5,
0x1be7, 0x1be7,
0x1bea, 0x1bec,
0x1bee, 0x1bee,
@@ -12041,10 +15578,12 @@ static const OnigCodePoint CR_Grapheme_Base[] = {
0x1c34, 0x1c35,
0x1c3b, 0x1c49,
0x1c4d, 0x1c7f,
+ 0x1cc0, 0x1cc7,
0x1cd3, 0x1cd3,
0x1ce1, 0x1ce1,
0x1ce9, 0x1cec,
- 0x1cee, 0x1cf2,
+ 0x1cee, 0x1cf3,
+ 0x1cf5, 0x1cf6,
0x1d00, 0x1dbf,
0x1e00, 0x1f15,
0x1f18, 0x1f1d,
@@ -12074,15 +15613,16 @@ static const OnigCodePoint CR_Grapheme_Base[] = {
0x2400, 0x2426,
0x2440, 0x244a,
0x2460, 0x26ff,
- 0x2701, 0x27ca,
- 0x27cc, 0x27cc,
- 0x27ce, 0x2b4c,
+ 0x2701, 0x2b4c,
0x2b50, 0x2b59,
0x2c00, 0x2c2e,
0x2c30, 0x2c5e,
0x2c60, 0x2cee,
+ 0x2cf2, 0x2cf3,
0x2cf9, 0x2d25,
- 0x2d30, 0x2d65,
+ 0x2d27, 0x2d27,
+ 0x2d2d, 0x2d2d,
+ 0x2d30, 0x2d67,
0x2d6f, 0x2d70,
0x2d80, 0x2d96,
0x2da0, 0x2da6,
@@ -12093,7 +15633,7 @@ static const OnigCodePoint CR_Grapheme_Base[] = {
0x2dc8, 0x2dce,
0x2dd0, 0x2dd6,
0x2dd8, 0x2dde,
- 0x2e00, 0x2e31,
+ 0x2e00, 0x2e3b,
0x2e80, 0x2e99,
0x2e9b, 0x2ef3,
0x2f00, 0x2fd5,
@@ -12109,7 +15649,7 @@ static const OnigCodePoint CR_Grapheme_Base[] = {
0x31f0, 0x321e,
0x3220, 0x32fe,
0x3300, 0x4db5,
- 0x4dc0, 0x9fcb,
+ 0x4dc0, 0x9fcc,
0xa000, 0xa48c,
0xa490, 0xa4c6,
0xa4d0, 0xa62b,
@@ -12119,9 +15659,9 @@ static const OnigCodePoint CR_Grapheme_Base[] = {
0xa6a0, 0xa6ef,
0xa6f2, 0xa6f7,
0xa700, 0xa78e,
- 0xa790, 0xa791,
- 0xa7a0, 0xa7a9,
- 0xa7fa, 0xa801,
+ 0xa790, 0xa793,
+ 0xa7a0, 0xa7aa,
+ 0xa7f8, 0xa801,
0xa803, 0xa805,
0xa807, 0xa80a,
0xa80c, 0xa824,
@@ -12155,7 +15695,8 @@ static const OnigCodePoint CR_Grapheme_Base[] = {
0xaab9, 0xaabd,
0xaac0, 0xaac0,
0xaac2, 0xaac2,
- 0xaadb, 0xaadf,
+ 0xaadb, 0xaaeb,
+ 0xaaee, 0xaaf5,
0xab01, 0xab06,
0xab09, 0xab0e,
0xab11, 0xab16,
@@ -12168,8 +15709,7 @@ static const OnigCodePoint CR_Grapheme_Base[] = {
0xac00, 0xd7a3,
0xd7b0, 0xd7c6,
0xd7cb, 0xd7fb,
- 0xf900, 0xfa2d,
- 0xfa30, 0xfa6d,
+ 0xf900, 0xfa6d,
0xfa70, 0xfad9,
0xfb00, 0xfb06,
0xfb13, 0xfb17,
@@ -12231,6 +15771,8 @@ static const OnigCodePoint CR_Grapheme_Base[] = {
0x10900, 0x1091b,
0x1091f, 0x10939,
0x1093f, 0x1093f,
+ 0x10980, 0x109b7,
+ 0x109be, 0x109bf,
0x10a00, 0x10a00,
0x10a10, 0x10a13,
0x10a15, 0x10a17,
@@ -12252,11 +15794,27 @@ static const OnigCodePoint CR_Grapheme_Base[] = {
0x110b7, 0x110b8,
0x110bb, 0x110bc,
0x110be, 0x110c1,
+ 0x110d0, 0x110e8,
+ 0x110f0, 0x110f9,
+ 0x11103, 0x11126,
+ 0x1112c, 0x1112c,
+ 0x11136, 0x11143,
+ 0x11182, 0x111b5,
+ 0x111bf, 0x111c8,
+ 0x111d0, 0x111d9,
+ 0x11680, 0x116aa,
+ 0x116ac, 0x116ac,
+ 0x116ae, 0x116af,
+ 0x116b6, 0x116b6,
+ 0x116c0, 0x116c9,
0x12000, 0x1236e,
0x12400, 0x12462,
0x12470, 0x12473,
0x13000, 0x1342e,
0x16800, 0x16a38,
+ 0x16f00, 0x16f44,
+ 0x16f50, 0x16f7e,
+ 0x16f93, 0x16f9f,
0x1b000, 0x1b001,
0x1d000, 0x1d0f5,
0x1d100, 0x1d126,
@@ -12291,6 +15849,40 @@ static const OnigCodePoint CR_Grapheme_Base[] = {
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,
@@ -12299,7 +15891,7 @@ static const OnigCodePoint CR_Grapheme_Base[] = {
0x1f0d1, 0x1f0df,
0x1f100, 0x1f10a,
0x1f110, 0x1f12e,
- 0x1f130, 0x1f169,
+ 0x1f130, 0x1f16b,
0x1f170, 0x1f19a,
0x1f1e6, 0x1f202,
0x1f210, 0x1f23a,
@@ -12317,19 +15909,9 @@ static const OnigCodePoint CR_Grapheme_Base[] = {
0x1f442, 0x1f4f7,
0x1f4f9, 0x1f4fc,
0x1f500, 0x1f53d,
+ 0x1f540, 0x1f543,
0x1f550, 0x1f567,
- 0x1f5fb, 0x1f5ff,
- 0x1f601, 0x1f610,
- 0x1f612, 0x1f614,
- 0x1f616, 0x1f616,
- 0x1f618, 0x1f618,
- 0x1f61a, 0x1f61a,
- 0x1f61c, 0x1f61e,
- 0x1f620, 0x1f625,
- 0x1f628, 0x1f62b,
- 0x1f62d, 0x1f62d,
- 0x1f630, 0x1f633,
- 0x1f635, 0x1f640,
+ 0x1f5fb, 0x1f640,
0x1f645, 0x1f64f,
0x1f680, 0x1f6c5,
0x1f700, 0x1f773,
@@ -12341,7 +15923,7 @@ static const OnigCodePoint CR_Grapheme_Base[] = {
/* 'Grapheme_Link': Derived Property */
static const OnigCodePoint CR_Grapheme_Link[] = {
- 29,
+ 33,
0x094d, 0x094d,
0x09cd, 0x09cd,
0x0a4d, 0x0a4d,
@@ -12360,22 +15942,26 @@ static const OnigCodePoint CR_Grapheme_Link[] = {
0x17d2, 0x17d2,
0x1a60, 0x1a60,
0x1b44, 0x1b44,
- 0x1baa, 0x1baa,
+ 0x1baa, 0x1bab,
0x1bf2, 0x1bf3,
0x2d7f, 0x2d7f,
0xa806, 0xa806,
0xa8c4, 0xa8c4,
0xa953, 0xa953,
0xa9c0, 0xa9c0,
+ 0xaaf6, 0xaaf6,
0xabed, 0xabed,
0x10a3f, 0x10a3f,
0x11046, 0x11046,
0x110b9, 0x110b9,
+ 0x11133, 0x11134,
+ 0x111c0, 0x111c0,
+ 0x116b6, 0x116b6,
}; /* CR_Grapheme_Link */
/* 'Common': Script */
static const OnigCodePoint CR_Common[] = {
- 169,
+ 157,
0x0000, 0x0040,
0x005b, 0x0060,
0x007b, 0x00a9,
@@ -12398,7 +15984,6 @@ static const OnigCodePoint CR_Common[] = {
0x0660, 0x0669,
0x06dd, 0x06dd,
0x0964, 0x0965,
- 0x0970, 0x0970,
0x0e3f, 0x0e3f,
0x0fd5, 0x0fd8,
0x10fb, 0x10fb,
@@ -12409,7 +15994,8 @@ static const OnigCodePoint CR_Common[] = {
0x1cd3, 0x1cd3,
0x1ce1, 0x1ce1,
0x1ce9, 0x1cec,
- 0x1cee, 0x1cf2,
+ 0x1cee, 0x1cf3,
+ 0x1cf5, 0x1cf6,
0x2000, 0x200b,
0x200e, 0x2064,
0x206a, 0x2070,
@@ -12426,12 +16012,10 @@ static const OnigCodePoint CR_Common[] = {
0x2400, 0x2426,
0x2440, 0x244a,
0x2460, 0x26ff,
- 0x2701, 0x27ca,
- 0x27cc, 0x27cc,
- 0x27ce, 0x27ff,
+ 0x2701, 0x27ff,
0x2900, 0x2b4c,
0x2b50, 0x2b59,
- 0x2e00, 0x2e31,
+ 0x2e00, 0x2e3b,
0x2ff0, 0x2ffb,
0x3000, 0x3004,
0x3006, 0x3006,
@@ -12508,7 +16092,7 @@ static const OnigCodePoint CR_Common[] = {
0x1f0d1, 0x1f0df,
0x1f100, 0x1f10a,
0x1f110, 0x1f12e,
- 0x1f130, 0x1f169,
+ 0x1f130, 0x1f16b,
0x1f170, 0x1f19a,
0x1f1e6, 0x1f1ff,
0x1f201, 0x1f202,
@@ -12527,19 +16111,9 @@ static const OnigCodePoint CR_Common[] = {
0x1f442, 0x1f4f7,
0x1f4f9, 0x1f4fc,
0x1f500, 0x1f53d,
+ 0x1f540, 0x1f543,
0x1f550, 0x1f567,
- 0x1f5fb, 0x1f5ff,
- 0x1f601, 0x1f610,
- 0x1f612, 0x1f614,
- 0x1f616, 0x1f616,
- 0x1f618, 0x1f618,
- 0x1f61a, 0x1f61a,
- 0x1f61c, 0x1f61e,
- 0x1f620, 0x1f625,
- 0x1f628, 0x1f62b,
- 0x1f62d, 0x1f62d,
- 0x1f630, 0x1f633,
- 0x1f635, 0x1f640,
+ 0x1f5fb, 0x1f640,
0x1f645, 0x1f64f,
0x1f680, 0x1f6c5,
0x1f700, 0x1f773,
@@ -12574,9 +16148,9 @@ static const OnigCodePoint CR_Latin[] = {
0x2c60, 0x2c7f,
0xa722, 0xa787,
0xa78b, 0xa78e,
- 0xa790, 0xa791,
- 0xa7a0, 0xa7a9,
- 0xa7fa, 0xa7ff,
+ 0xa790, 0xa793,
+ 0xa7a0, 0xa7aa,
+ 0xa7f8, 0xa7ff,
0xfb00, 0xfb06,
0xff21, 0xff3a,
0xff41, 0xff5a,
@@ -12628,17 +16202,18 @@ static const OnigCodePoint CR_Cyrillic[] = {
0x1d2b, 0x1d2b,
0x1d78, 0x1d78,
0x2de0, 0x2dff,
- 0xa640, 0xa673,
- 0xa67c, 0xa697,
+ 0xa640, 0xa697,
+ 0xa69f, 0xa69f,
}; /* CR_Cyrillic */
/* 'Armenian': Script */
static const OnigCodePoint CR_Armenian[] = {
- 5,
+ 6,
0x0531, 0x0556,
0x0559, 0x055f,
0x0561, 0x0587,
0x058a, 0x058a,
+ 0x058f, 0x058f,
0xfb13, 0xfb17,
}; /* CR_Armenian */
@@ -12658,8 +16233,8 @@ static const OnigCodePoint CR_Hebrew[] = {
/* 'Arabic': Script */
static const OnigCodePoint CR_Arabic[] = {
- 19,
- 0x0600, 0x0603,
+ 56,
+ 0x0600, 0x0604,
0x0606, 0x060b,
0x060d, 0x061a,
0x061e, 0x061e,
@@ -12670,6 +16245,9 @@ static const OnigCodePoint CR_Arabic[] = {
0x0671, 0x06dc,
0x06de, 0x06ff,
0x0750, 0x077f,
+ 0x08a0, 0x08a0,
+ 0x08a2, 0x08ac,
+ 0x08e4, 0x08fe,
0xfb50, 0xfbc1,
0xfbd3, 0xfd3d,
0xfd50, 0xfd8f,
@@ -12678,6 +16256,40 @@ static const OnigCodePoint CR_Arabic[] = {
0xfe70, 0xfe74,
0xfe76, 0xfefc,
0x10e60, 0x10e7e,
+ 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,
}; /* CR_Arabic */
/* 'Syriac': Script */
@@ -12696,11 +16308,10 @@ static const OnigCodePoint CR_Thaana[] = {
/* 'Devanagari': Script */
static const OnigCodePoint CR_Devanagari[] = {
- 6,
+ 5,
0x0900, 0x0950,
0x0953, 0x0963,
- 0x0966, 0x096f,
- 0x0971, 0x0977,
+ 0x0966, 0x0977,
0x0979, 0x097f,
0xa8e0, 0xa8fb,
}; /* CR_Devanagari */
@@ -12747,7 +16358,7 @@ static const OnigCodePoint CR_Gurmukhi[] = {
/* 'Gujarati': Script */
static const OnigCodePoint CR_Gujarati[] = {
- 14,
+ 13,
0x0a81, 0x0a83,
0x0a85, 0x0a8d,
0x0a8f, 0x0a91,
@@ -12760,8 +16371,7 @@ static const OnigCodePoint CR_Gujarati[] = {
0x0acb, 0x0acd,
0x0ad0, 0x0ad0,
0x0ae0, 0x0ae3,
- 0x0ae6, 0x0aef,
- 0x0af1, 0x0af1,
+ 0x0ae6, 0x0af1,
}; /* CR_Gujarati */
/* 'Oriya': Script */
@@ -12901,7 +16511,7 @@ static const OnigCodePoint CR_Lao[] = {
0x0ec6, 0x0ec6,
0x0ec8, 0x0ecd,
0x0ed0, 0x0ed9,
- 0x0edc, 0x0edd,
+ 0x0edc, 0x0edf,
}; /* CR_Lao */
/* 'Tibetan': Script */
@@ -12925,11 +16535,15 @@ static const OnigCodePoint CR_Myanmar[] = {
/* 'Georgian': Script */
static const OnigCodePoint CR_Georgian[] = {
- 4,
+ 8,
0x10a0, 0x10c5,
+ 0x10c7, 0x10c7,
+ 0x10cd, 0x10cd,
0x10d0, 0x10fa,
- 0x10fc, 0x10fc,
+ 0x10fc, 0x10ff,
0x2d00, 0x2d25,
+ 0x2d27, 0x2d27,
+ 0x2d2d, 0x2d2d,
}; /* CR_Georgian */
/* 'Hangul': Script */
@@ -13066,7 +16680,7 @@ static const OnigCodePoint CR_Bopomofo[] = {
/* 'Han': Script */
static const OnigCodePoint CR_Han[] = {
- 16,
+ 15,
0x2e80, 0x2e99,
0x2e9b, 0x2ef3,
0x2f00, 0x2fd5,
@@ -13075,9 +16689,8 @@ static const OnigCodePoint CR_Han[] = {
0x3021, 0x3029,
0x3038, 0x303b,
0x3400, 0x4db5,
- 0x4e00, 0x9fcb,
- 0xf900, 0xfa2d,
- 0xfa30, 0xfa6d,
+ 0x4e00, 0x9fcc,
+ 0xf900, 0xfa6d,
0xfa70, 0xfad9,
0x20000, 0x2a6d6,
0x2a700, 0x2b734,
@@ -13113,7 +16726,7 @@ static const OnigCodePoint CR_Deseret[] = {
/* 'Inherited': Script */
static const OnigCodePoint CR_Inherited[] = {
- 24,
+ 25,
0x0300, 0x036f,
0x0485, 0x0486,
0x064b, 0x0655,
@@ -13124,6 +16737,7 @@ static const OnigCodePoint CR_Inherited[] = {
0x1cd4, 0x1ce0,
0x1ce2, 0x1ce8,
0x1ced, 0x1ced,
+ 0x1cf4, 0x1cf4,
0x1dc0, 0x1de6,
0x1dfc, 0x1dff,
0x200c, 0x200d,
@@ -13244,7 +16858,7 @@ static const OnigCodePoint CR_Buginese[] = {
static const OnigCodePoint CR_Coptic[] = {
3,
0x03e2, 0x03ef,
- 0x2c80, 0x2cf1,
+ 0x2c80, 0x2cf3,
0x2cf9, 0x2cff,
}; /* CR_Coptic */
@@ -13267,7 +16881,7 @@ static const OnigCodePoint CR_Glagolitic[] = {
/* 'Tifinagh': Script */
static const OnigCodePoint CR_Tifinagh[] = {
3,
- 0x2d30, 0x2d65,
+ 0x2d30, 0x2d67,
0x2d6f, 0x2d70,
0x2d7f, 0x2d7f,
}; /* CR_Tifinagh */
@@ -13335,8 +16949,8 @@ static const OnigCodePoint CR_Nko[] = {
/* 'Sundanese': Script */
static const OnigCodePoint CR_Sundanese[] = {
2,
- 0x1b80, 0x1baa,
- 0x1bae, 0x1bb9,
+ 0x1b80, 0x1bbf,
+ 0x1cc0, 0x1cc7,
}; /* CR_Sundanese */
/* 'Lepcha': Script */
@@ -13467,7 +17081,8 @@ static const OnigCodePoint CR_Javanese[] = {
/* 'Meetei_Mayek': Script */
static const OnigCodePoint CR_Meetei_Mayek[] = {
- 2,
+ 3,
+ 0xaae0, 0xaaf6,
0xabc0, 0xabed,
0xabf0, 0xabf9,
}; /* CR_Meetei_Mayek */
@@ -13532,21 +17147,57 @@ static const OnigCodePoint CR_Mandaic[] = {
0x085e, 0x085e,
}; /* CR_Mandaic */
+/* 'Chakma': Script */
+static const OnigCodePoint CR_Chakma[] = {
+ 2,
+ 0x11100, 0x11134,
+ 0x11136, 0x11143,
+}; /* CR_Chakma */
+
+/* 'Meroitic_Cursive': Script */
+static const OnigCodePoint CR_Meroitic_Cursive[] = {
+ 2,
+ 0x109a0, 0x109b7,
+ 0x109be, 0x109bf,
+}; /* CR_Meroitic_Cursive */
+
+/* 'Meroitic_Hieroglyphs': Script */
+static const OnigCodePoint CR_Meroitic_Hieroglyphs[] = {
+ 1,
+ 0x10980, 0x1099f,
+}; /* CR_Meroitic_Hieroglyphs */
+
+/* 'Miao': Script */
+static const OnigCodePoint CR_Miao[] = {
+ 3,
+ 0x16f00, 0x16f44,
+ 0x16f50, 0x16f7e,
+ 0x16f8f, 0x16f9f,
+}; /* CR_Miao */
+
+/* 'Sharada': Script */
+static const OnigCodePoint CR_Sharada[] = {
+ 2,
+ 0x11180, 0x111c8,
+ 0x111d0, 0x111d9,
+}; /* CR_Sharada */
+
+/* 'Sora_Sompeng': Script */
+static const OnigCodePoint CR_Sora_Sompeng[] = {
+ 2,
+ 0x110d0, 0x110e8,
+ 0x110f0, 0x110f9,
+}; /* CR_Sora_Sompeng */
+
+/* 'Takri': Script */
+static const OnigCodePoint CR_Takri[] = {
+ 2,
+ 0x11680, 0x116b7,
+ 0x116c0, 0x116c9,
+}; /* CR_Takri */
+
/* 'White_Space': Binary Property */
-static const OnigCodePoint CR_White_Space[] = {
- 11,
- 0x0009, 0x000d,
- 0x0020, 0x0020,
- 0x0085, 0x0085,
- 0x00a0, 0x00a0,
- 0x1680, 0x1680,
- 0x180e, 0x180e,
- 0x2000, 0x200a,
- 0x2028, 0x2029,
- 0x202f, 0x202f,
- 0x205f, 0x205f,
- 0x3000, 0x3000,
-}; /* CR_White_Space */
+#define CR_White_Space CR_Space
/* 'Bidi_Control': Binary Property */
static const OnigCodePoint CR_Bidi_Control[] = {
@@ -13563,7 +17214,7 @@ static const OnigCodePoint CR_Join_Control[] = {
/* 'Dash': Binary Property */
static const OnigCodePoint CR_Dash[] = {
- 19,
+ 20,
0x002d, 0x002d,
0x058a, 0x058a,
0x05be, 0x05be,
@@ -13576,6 +17227,7 @@ static const OnigCodePoint CR_Dash[] = {
0x2212, 0x2212,
0x2e17, 0x2e17,
0x2e1a, 0x2e1a,
+ 0x2e3a, 0x2e3b,
0x301c, 0x301c,
0x3030, 0x3030,
0x30a0, 0x30a0,
@@ -13619,7 +17271,7 @@ static const OnigCodePoint CR_Quotation_Mark[] = {
/* 'Terminal_Punctuation': Binary Property */
static const OnigCodePoint CR_Terminal_Punctuation[] = {
- 67,
+ 70,
0x0021, 0x0021,
0x002c, 0x002c,
0x002e, 0x002e,
@@ -13669,6 +17321,7 @@ static const OnigCodePoint CR_Terminal_Punctuation[] = {
0xa9c7, 0xa9c9,
0xaa5d, 0xaa5f,
0xaadf, 0xaadf,
+ 0xaaf0, 0xaaf1,
0xabeb, 0xabeb,
0xfe50, 0xfe52,
0xfe54, 0xfe57,
@@ -13686,12 +17339,14 @@ static const OnigCodePoint CR_Terminal_Punctuation[] = {
0x10b3a, 0x10b3f,
0x11047, 0x1104d,
0x110be, 0x110c1,
+ 0x11141, 0x11143,
+ 0x111c5, 0x111c6,
0x12470, 0x12473,
}; /* CR_Terminal_Punctuation */
/* 'Other_Math': Binary Property */
static const OnigCodePoint CR_Other_Math[] = {
- 100,
+ 133,
0x005e, 0x005e,
0x03d0, 0x03d2,
0x03d5, 0x03d5,
@@ -13792,6 +17447,39 @@ static const OnigCodePoint CR_Other_Math[] = {
0x1d7aa, 0x1d7c2,
0x1d7c4, 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,
}; /* CR_Other_Math */
/* 'Hex_Digit': Binary Property */
@@ -13806,16 +17494,11 @@ static const OnigCodePoint CR_Hex_Digit[] = {
}; /* CR_Hex_Digit */
/* 'ASCII_Hex_Digit': Binary Property */
-static const OnigCodePoint CR_ASCII_Hex_Digit[] = {
- 3,
- 0x0030, 0x0039,
- 0x0041, 0x0046,
- 0x0061, 0x0066,
-}; /* CR_ASCII_Hex_Digit */
+#define CR_ASCII_Hex_Digit CR_XDigit
/* 'Other_Alphabetic': Binary Property */
static const OnigCodePoint CR_Other_Alphabetic[] = {
- 145,
+ 158,
0x0345, 0x0345,
0x05b0, 0x05bd,
0x05bf, 0x05bf,
@@ -13837,6 +17520,8 @@ static const OnigCodePoint CR_Other_Alphabetic[] = {
0x081b, 0x0823,
0x0825, 0x0827,
0x0829, 0x082c,
+ 0x08e4, 0x08e9,
+ 0x08f0, 0x08fe,
0x0900, 0x0903,
0x093a, 0x093b,
0x093e, 0x094c,
@@ -13933,11 +17618,14 @@ static const OnigCodePoint CR_Other_Alphabetic[] = {
0x1b35, 0x1b43,
0x1b80, 0x1b82,
0x1ba1, 0x1ba9,
+ 0x1bac, 0x1bad,
0x1be7, 0x1bf1,
0x1c24, 0x1c35,
- 0x1cf2, 0x1cf2,
+ 0x1cf2, 0x1cf3,
0x24b6, 0x24e9,
0x2de0, 0x2dff,
+ 0xa674, 0xa67b,
+ 0xa69f, 0xa69f,
0xa823, 0xa827,
0xa880, 0xa881,
0xa8b4, 0xa8c3,
@@ -13952,6 +17640,8 @@ static const OnigCodePoint CR_Other_Alphabetic[] = {
0xaab2, 0xaab4,
0xaab7, 0xaab8,
0xaabe, 0xaabe,
+ 0xaaeb, 0xaaef,
+ 0xaaf5, 0xaaf5,
0xabe3, 0xabea,
0xfb1e, 0xfb1e,
0x10a01, 0x10a03,
@@ -13961,18 +17651,23 @@ static const OnigCodePoint CR_Other_Alphabetic[] = {
0x11038, 0x11045,
0x11082, 0x11082,
0x110b0, 0x110b8,
+ 0x11100, 0x11102,
+ 0x11127, 0x11132,
+ 0x11180, 0x11182,
+ 0x111b3, 0x111bf,
+ 0x116ab, 0x116b5,
+ 0x16f51, 0x16f7e,
}; /* CR_Other_Alphabetic */
/* 'Ideographic': Binary Property */
static const OnigCodePoint CR_Ideographic[] = {
- 12,
+ 11,
0x3006, 0x3007,
0x3021, 0x3029,
0x3038, 0x303a,
0x3400, 0x4db5,
- 0x4e00, 0x9fcb,
- 0xf900, 0xfa2d,
- 0xfa30, 0xfa6d,
+ 0x4e00, 0x9fcc,
+ 0xf900, 0xfa6d,
0xfa70, 0xfad9,
0x20000, 0x2a6d6,
0x2a700, 0x2b734,
@@ -13982,7 +17677,7 @@ static const OnigCodePoint CR_Ideographic[] = {
/* 'Diacritic': Binary Property */
static const OnigCodePoint CR_Diacritic[] = {
- 117,
+ 125,
0x005e, 0x005e,
0x0060, 0x0060,
0x00a8, 0x00a8,
@@ -14011,6 +17706,7 @@ static const OnigCodePoint CR_Diacritic[] = {
0x07a6, 0x07b0,
0x07eb, 0x07f5,
0x0818, 0x0819,
+ 0x08e4, 0x08fe,
0x093c, 0x093c,
0x094d, 0x094d,
0x0951, 0x0954,
@@ -14053,11 +17749,12 @@ static const OnigCodePoint CR_Diacritic[] = {
0x1b34, 0x1b34,
0x1b44, 0x1b44,
0x1b6b, 0x1b73,
- 0x1baa, 0x1baa,
+ 0x1baa, 0x1bab,
0x1c36, 0x1c37,
0x1c78, 0x1c7d,
0x1cd0, 0x1ce8,
0x1ced, 0x1ced,
+ 0x1cf4, 0x1cf4,
0x1d2c, 0x1d6a,
0x1dc4, 0x1dcf,
0x1dfd, 0x1dff,
@@ -14078,6 +17775,7 @@ static const OnigCodePoint CR_Diacritic[] = {
0xa6f0, 0xa6f1,
0xa717, 0xa721,
0xa788, 0xa788,
+ 0xa7f8, 0xa7f9,
0xa8c4, 0xa8c4,
0xa8e0, 0xa8f1,
0xa92b, 0xa92e,
@@ -14086,6 +17784,7 @@ static const OnigCodePoint CR_Diacritic[] = {
0xa9c0, 0xa9c0,
0xaa7b, 0xaa7b,
0xaabf, 0xaac2,
+ 0xaaf6, 0xaaf6,
0xabec, 0xabed,
0xfb1e, 0xfb1e,
0xfe20, 0xfe26,
@@ -14095,6 +17794,10 @@ static const OnigCodePoint CR_Diacritic[] = {
0xff9e, 0xff9f,
0xffe3, 0xffe3,
0x110b9, 0x110ba,
+ 0x11133, 0x11134,
+ 0x111c0, 0x111c0,
+ 0x116b6, 0x116b7,
+ 0x16f8f, 0x16f9f,
0x1d167, 0x1d169,
0x1d16d, 0x1d172,
0x1d17b, 0x1d182,
@@ -14104,13 +17807,14 @@ static const OnigCodePoint CR_Diacritic[] = {
/* 'Extender': Binary Property */
static const OnigCodePoint CR_Extender[] = {
- 20,
+ 22,
0x00b7, 0x00b7,
0x02d0, 0x02d1,
0x0640, 0x0640,
0x07fa, 0x07fa,
0x0e46, 0x0e46,
0x0ec6, 0x0ec6,
+ 0x180a, 0x180a,
0x1843, 0x1843,
0x1aa7, 0x1aa7,
0x1c36, 0x1c36,
@@ -14124,25 +17828,31 @@ static const OnigCodePoint CR_Extender[] = {
0xa9cf, 0xa9cf,
0xaa70, 0xaa70,
0xaadd, 0xaadd,
+ 0xaaf3, 0xaaf4,
0xff70, 0xff70,
}; /* CR_Extender */
/* 'Other_Lowercase': Binary Property */
static const OnigCodePoint CR_Other_Lowercase[] = {
- 13,
+ 18,
+ 0x00aa, 0x00aa,
+ 0x00ba, 0x00ba,
0x02b0, 0x02b8,
0x02c0, 0x02c1,
0x02e0, 0x02e4,
0x0345, 0x0345,
0x037a, 0x037a,
- 0x1d2c, 0x1d61,
+ 0x1d2c, 0x1d6a,
0x1d78, 0x1d78,
0x1d9b, 0x1dbf,
- 0x2090, 0x2094,
+ 0x2071, 0x2071,
+ 0x207f, 0x207f,
+ 0x2090, 0x209c,
0x2170, 0x217f,
0x24d0, 0x24e9,
- 0x2c7d, 0x2c7d,
+ 0x2c7c, 0x2c7d,
0xa770, 0xa770,
+ 0xa7f8, 0xa7f9,
}; /* CR_Other_Lowercase */
/* 'Other_Uppercase': Binary Property */
@@ -14177,7 +17887,7 @@ static const OnigCodePoint CR_Noncharacter_Code_Point[] = {
/* 'Other_Grapheme_Extend': Binary Property */
static const OnigCodePoint CR_Other_Grapheme_Extend[] = {
- 16,
+ 17,
0x09be, 0x09be,
0x09d7, 0x09d7,
0x0b3e, 0x0b3e,
@@ -14191,6 +17901,7 @@ static const OnigCodePoint CR_Other_Grapheme_Extend[] = {
0x0dcf, 0x0dcf,
0x0ddf, 0x0ddf,
0x200c, 0x200d,
+ 0x302e, 0x302f,
0xff9e, 0xff9f,
0x1d165, 0x1d165,
0x1d16e, 0x1d172,
@@ -14221,7 +17932,7 @@ static const OnigCodePoint CR_Radical[] = {
static const OnigCodePoint CR_Unified_Ideograph[] = {
12,
0x3400, 0x4db5,
- 0x4e00, 0x9fcb,
+ 0x4e00, 0x9fcc,
0xfa0e, 0xfa0f,
0xfa11, 0xfa11,
0xfa13, 0xfa14,
@@ -14236,9 +17947,10 @@ static const OnigCodePoint CR_Unified_Ideograph[] = {
/* 'Other_Default_Ignorable_Code_Point': Binary Property */
static const OnigCodePoint CR_Other_Default_Ignorable_Code_Point[] = {
- 10,
+ 11,
0x034f, 0x034f,
0x115f, 0x1160,
+ 0x17b4, 0x17b5,
0x2065, 0x2069,
0x3164, 0x3164,
0xffa0, 0xffa0,
@@ -14328,7 +18040,7 @@ static const OnigCodePoint CR_Other_ID_Continue[] = {
/* 'STerm': Binary Property */
static const OnigCodePoint CR_STerm[] = {
- 47,
+ 50,
0x0021, 0x0021,
0x002e, 0x002e,
0x003f, 0x003f,
@@ -14366,6 +18078,7 @@ static const OnigCodePoint CR_STerm[] = {
0xa92f, 0xa92f,
0xa9c8, 0xa9c9,
0xaa5d, 0xaa5f,
+ 0xaaf0, 0xaaf1,
0xabeb, 0xabeb,
0xfe52, 0xfe52,
0xfe56, 0xfe57,
@@ -14376,6 +18089,8 @@ static const OnigCodePoint CR_STerm[] = {
0x10a56, 0x10a57,
0x11047, 0x11048,
0x110be, 0x110c1,
+ 0x11141, 0x11143,
+ 0x111c5, 0x111c6,
}; /* CR_STerm */
/* 'Variation_Selector': Binary Property */
@@ -14431,7 +18146,7 @@ static const OnigCodePoint CR_Pattern_Syntax[] = {
/* 'Unknown': Script */
static const OnigCodePoint CR_Unknown[] = {
- 499,
+ 537,
0x0378, 0x0379,
0x037f, 0x0383,
0x038b, 0x038b,
@@ -14441,11 +18156,12 @@ static const OnigCodePoint CR_Unknown[] = {
0x0557, 0x0558,
0x0560, 0x0560,
0x0588, 0x0588,
- 0x058b, 0x0590,
+ 0x058b, 0x058e,
+ 0x0590, 0x0590,
0x05c8, 0x05cf,
0x05eb, 0x05ef,
0x05f5, 0x05ff,
- 0x0604, 0x0605,
+ 0x0605, 0x0605,
0x061c, 0x061d,
0x070e, 0x070e,
0x074b, 0x074c,
@@ -14454,7 +18170,10 @@ static const OnigCodePoint CR_Unknown[] = {
0x082e, 0x082f,
0x083f, 0x083f,
0x085c, 0x085d,
- 0x085f, 0x08ff,
+ 0x085f, 0x089f,
+ 0x08a1, 0x08a1,
+ 0x08ad, 0x08e3,
+ 0x08ff, 0x08ff,
0x0978, 0x0978,
0x0980, 0x0980,
0x0984, 0x0984,
@@ -14499,7 +18218,6 @@ static const OnigCodePoint CR_Unknown[] = {
0x0ace, 0x0acf,
0x0ad1, 0x0adf,
0x0ae4, 0x0ae5,
- 0x0af0, 0x0af0,
0x0af2, 0x0b00,
0x0b04, 0x0b04,
0x0b0d, 0x0b0e,
@@ -14600,15 +18318,16 @@ static const OnigCodePoint CR_Unknown[] = {
0x0ec7, 0x0ec7,
0x0ece, 0x0ecf,
0x0eda, 0x0edb,
- 0x0ede, 0x0eff,
+ 0x0ee0, 0x0eff,
0x0f48, 0x0f48,
0x0f6d, 0x0f70,
0x0f98, 0x0f98,
0x0fbd, 0x0fbd,
0x0fcd, 0x0fcd,
0x0fdb, 0x0fff,
- 0x10c6, 0x10cf,
- 0x10fd, 0x10ff,
+ 0x10c6, 0x10c6,
+ 0x10c8, 0x10cc,
+ 0x10ce, 0x10cf,
0x1249, 0x1249,
0x124e, 0x124f,
0x1257, 0x1257,
@@ -14662,13 +18381,12 @@ static const OnigCodePoint CR_Unknown[] = {
0x1aae, 0x1aff,
0x1b4c, 0x1b4f,
0x1b7d, 0x1b7f,
- 0x1bab, 0x1bad,
- 0x1bba, 0x1bbf,
0x1bf4, 0x1bfb,
0x1c38, 0x1c3a,
0x1c4a, 0x1c4c,
- 0x1c80, 0x1ccf,
- 0x1cf3, 0x1cff,
+ 0x1c80, 0x1cbf,
+ 0x1cc8, 0x1ccf,
+ 0x1cf7, 0x1cff,
0x1de7, 0x1dfb,
0x1f16, 0x1f17,
0x1f1e, 0x1f1f,
@@ -14697,15 +18415,15 @@ static const OnigCodePoint CR_Unknown[] = {
0x2427, 0x243f,
0x244b, 0x245f,
0x2700, 0x2700,
- 0x27cb, 0x27cb,
- 0x27cd, 0x27cd,
0x2b4d, 0x2b4f,
0x2b5a, 0x2bff,
0x2c2f, 0x2c2f,
0x2c5f, 0x2c5f,
- 0x2cf2, 0x2cf8,
- 0x2d26, 0x2d2f,
- 0x2d66, 0x2d6e,
+ 0x2cf4, 0x2cf8,
+ 0x2d26, 0x2d26,
+ 0x2d28, 0x2d2c,
+ 0x2d2e, 0x2d2f,
+ 0x2d68, 0x2d6e,
0x2d71, 0x2d7e,
0x2d97, 0x2d9f,
0x2da7, 0x2da7,
@@ -14716,7 +18434,7 @@ static const OnigCodePoint CR_Unknown[] = {
0x2dcf, 0x2dcf,
0x2dd7, 0x2dd7,
0x2ddf, 0x2ddf,
- 0x2e32, 0x2e7f,
+ 0x2e3c, 0x2e7f,
0x2e9a, 0x2e9a,
0x2ef4, 0x2eff,
0x2fd6, 0x2fef,
@@ -14731,16 +18449,15 @@ static const OnigCodePoint CR_Unknown[] = {
0x321f, 0x321f,
0x32ff, 0x32ff,
0x4db6, 0x4dbf,
- 0x9fcc, 0x9fff,
+ 0x9fcd, 0x9fff,
0xa48d, 0xa48f,
0xa4c7, 0xa4cf,
0xa62c, 0xa63f,
- 0xa674, 0xa67b,
- 0xa698, 0xa69f,
+ 0xa698, 0xa69e,
0xa6f8, 0xa6ff,
0xa78f, 0xa78f,
- 0xa792, 0xa79f,
- 0xa7aa, 0xa7f9,
+ 0xa794, 0xa79f,
+ 0xa7ab, 0xa7f7,
0xa82c, 0xa82f,
0xa83a, 0xa83f,
0xa878, 0xa87f,
@@ -14757,7 +18474,7 @@ static const OnigCodePoint CR_Unknown[] = {
0xaa5a, 0xaa5b,
0xaa7c, 0xaa7f,
0xaac3, 0xaada,
- 0xaae0, 0xab00,
+ 0xaaf7, 0xab00,
0xab07, 0xab08,
0xab0f, 0xab10,
0xab17, 0xab1f,
@@ -14768,7 +18485,6 @@ static const OnigCodePoint CR_Unknown[] = {
0xd7a4, 0xd7af,
0xd7c7, 0xd7ca,
0xd7fc, 0xf8ff,
- 0xfa2e, 0xfa2f,
0xfa6e, 0xfa6f,
0xfada, 0xfaff,
0xfb07, 0xfb12,
@@ -14830,7 +18546,9 @@ static const OnigCodePoint CR_Unknown[] = {
0x10860, 0x108ff,
0x1091c, 0x1091e,
0x1093a, 0x1093e,
- 0x10940, 0x109ff,
+ 0x10940, 0x1097f,
+ 0x109b8, 0x109bd,
+ 0x109c0, 0x109ff,
0x10a04, 0x10a04,
0x10a07, 0x10a0b,
0x10a14, 0x10a14,
@@ -14848,12 +18566,23 @@ static const OnigCodePoint CR_Unknown[] = {
0x10e7f, 0x10fff,
0x1104e, 0x11051,
0x11070, 0x1107f,
- 0x110c2, 0x11fff,
+ 0x110c2, 0x110cf,
+ 0x110e9, 0x110ef,
+ 0x110fa, 0x110ff,
+ 0x11135, 0x11135,
+ 0x11144, 0x1117f,
+ 0x111c9, 0x111cf,
+ 0x111da, 0x1167f,
+ 0x116b8, 0x116bf,
+ 0x116ca, 0x11fff,
0x1236f, 0x123ff,
0x12463, 0x1246f,
0x12474, 0x12fff,
0x1342f, 0x167ff,
- 0x16a39, 0x1afff,
+ 0x16a39, 0x16eff,
+ 0x16f45, 0x16f4f,
+ 0x16f7f, 0x16f8e,
+ 0x16fa0, 0x1afff,
0x1b002, 0x1cfff,
0x1d0f6, 0x1d0ff,
0x1d127, 0x1d128,
@@ -14881,7 +18610,41 @@ static const OnigCodePoint CR_Unknown[] = {
0x1d551, 0x1d551,
0x1d6a6, 0x1d6a7,
0x1d7cc, 0x1d7cd,
- 0x1d800, 0x1efff,
+ 0x1d800, 0x1edff,
+ 0x1ee04, 0x1ee04,
+ 0x1ee20, 0x1ee20,
+ 0x1ee23, 0x1ee23,
+ 0x1ee25, 0x1ee26,
+ 0x1ee28, 0x1ee28,
+ 0x1ee33, 0x1ee33,
+ 0x1ee38, 0x1ee38,
+ 0x1ee3a, 0x1ee3a,
+ 0x1ee3c, 0x1ee41,
+ 0x1ee43, 0x1ee46,
+ 0x1ee48, 0x1ee48,
+ 0x1ee4a, 0x1ee4a,
+ 0x1ee4c, 0x1ee4c,
+ 0x1ee50, 0x1ee50,
+ 0x1ee53, 0x1ee53,
+ 0x1ee55, 0x1ee56,
+ 0x1ee58, 0x1ee58,
+ 0x1ee5a, 0x1ee5a,
+ 0x1ee5c, 0x1ee5c,
+ 0x1ee5e, 0x1ee5e,
+ 0x1ee60, 0x1ee60,
+ 0x1ee63, 0x1ee63,
+ 0x1ee65, 0x1ee66,
+ 0x1ee6b, 0x1ee6b,
+ 0x1ee73, 0x1ee73,
+ 0x1ee78, 0x1ee78,
+ 0x1ee7d, 0x1ee7d,
+ 0x1ee7f, 0x1ee7f,
+ 0x1ee8a, 0x1ee8a,
+ 0x1ee9c, 0x1eea0,
+ 0x1eea4, 0x1eea4,
+ 0x1eeaa, 0x1eeaa,
+ 0x1eebc, 0x1eeef,
+ 0x1eef2, 0x1efff,
0x1f02c, 0x1f02f,
0x1f094, 0x1f09f,
0x1f0af, 0x1f0b0,
@@ -14890,7 +18653,7 @@ static const OnigCodePoint CR_Unknown[] = {
0x1f0e0, 0x1f0ff,
0x1f10b, 0x1f10f,
0x1f12f, 0x1f12f,
- 0x1f16a, 0x1f16f,
+ 0x1f16c, 0x1f16f,
0x1f19b, 0x1f1e5,
0x1f203, 0x1f20f,
0x1f23b, 0x1f23f,
@@ -14907,19 +18670,9 @@ static const OnigCodePoint CR_Unknown[] = {
0x1f441, 0x1f441,
0x1f4f8, 0x1f4f8,
0x1f4fd, 0x1f4ff,
- 0x1f53e, 0x1f54f,
+ 0x1f53e, 0x1f53f,
+ 0x1f544, 0x1f54f,
0x1f568, 0x1f5fa,
- 0x1f600, 0x1f600,
- 0x1f611, 0x1f611,
- 0x1f615, 0x1f615,
- 0x1f617, 0x1f617,
- 0x1f619, 0x1f619,
- 0x1f61b, 0x1f61b,
- 0x1f61f, 0x1f61f,
- 0x1f626, 0x1f627,
- 0x1f62c, 0x1f62c,
- 0x1f62e, 0x1f62f,
- 0x1f634, 0x1f634,
0x1f641, 0x1f644,
0x1f650, 0x1f67f,
0x1f6c6, 0x1f6ff,
@@ -14932,7 +18685,6 @@ static const OnigCodePoint CR_Unknown[] = {
0xe0080, 0xe00ff,
0xe01f0, 0x10ffff,
}; /* CR_Unknown */
-#endif /* USE_UNICODE_PROPERTIES */
/* 'Age_1_1': Derived Age 1.1 */
static const OnigCodePoint CR_Age_1_1[] = {
@@ -19817,554 +23569,10 @@ static const OnigCodePoint CR_Age_6_0[] = {
0xefffe, 0x10ffff,
}; /* CR_Age_6_0 */
-/* 'NEWLINE': [[:NEWLINE:]] */
-static const OnigCodePoint CR_NEWLINE[] = {
- 1,
- 0x000a, 0x000a,
-}; /* CR_NEWLINE */
-
-/* 'Alpha': [[:Alpha:]] */
-#define CR_Alpha CR_Alphabetic
-
-/* 'Blank': [[:Blank:]] */
-static const OnigCodePoint CR_Blank[] = {
- 9,
- 0x0009, 0x0009,
- 0x0020, 0x0020,
- 0x00a0, 0x00a0,
- 0x1680, 0x1680,
- 0x180e, 0x180e,
- 0x2000, 0x200a,
- 0x202f, 0x202f,
- 0x205f, 0x205f,
- 0x3000, 0x3000,
-}; /* CR_Blank */
-
-/* 'Cntrl': [[:Cntrl:]] */
-#define CR_Cntrl CR_Cc
-
-/* 'Digit': [[:Digit:]] */
-#define CR_Digit CR_Nd
-
-/* 'Graph': [[:Graph:]] */
-static const OnigCodePoint CR_Graph[] = {
- 506,
- 0x0021, 0x007e,
- 0x00a1, 0x0377,
- 0x037a, 0x037e,
- 0x0384, 0x038a,
- 0x038c, 0x038c,
- 0x038e, 0x03a1,
- 0x03a3, 0x0527,
- 0x0531, 0x0556,
- 0x0559, 0x055f,
- 0x0561, 0x0587,
- 0x0589, 0x058a,
- 0x0591, 0x05c7,
- 0x05d0, 0x05ea,
- 0x05f0, 0x05f4,
- 0x0600, 0x0603,
- 0x0606, 0x061b,
- 0x061e, 0x070d,
- 0x070f, 0x074a,
- 0x074d, 0x07b1,
- 0x07c0, 0x07fa,
- 0x0800, 0x082d,
- 0x0830, 0x083e,
- 0x0840, 0x085b,
- 0x085e, 0x085e,
- 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, 0x0aef,
- 0x0af1, 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, 0x0edd,
- 0x0f00, 0x0f47,
- 0x0f49, 0x0f6c,
- 0x0f71, 0x0f97,
- 0x0f99, 0x0fbc,
- 0x0fbe, 0x0fcc,
- 0x0fce, 0x0fda,
- 0x1000, 0x10c5,
- 0x10d0, 0x10fc,
- 0x1100, 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, 0x167f,
- 0x1681, 0x169c,
- 0x16a0, 0x16f0,
- 0x1700, 0x170c,
- 0x170e, 0x1714,
- 0x1720, 0x1736,
- 0x1740, 0x1753,
- 0x1760, 0x176c,
- 0x176e, 0x1770,
- 0x1772, 0x1773,
- 0x1780, 0x17dd,
- 0x17e0, 0x17e9,
- 0x17f0, 0x17f9,
- 0x1800, 0x180d,
- 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, 0x1baa,
- 0x1bae, 0x1bb9,
- 0x1bc0, 0x1bf3,
- 0x1bfc, 0x1c37,
- 0x1c3b, 0x1c49,
- 0x1c4d, 0x1c7f,
- 0x1cd0, 0x1cf2,
- 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,
- 0x200b, 0x2027,
- 0x202a, 0x202e,
- 0x2030, 0x205e,
- 0x2060, 0x2064,
- 0x206a, 0x2071,
- 0x2074, 0x208e,
- 0x2090, 0x209c,
- 0x20a0, 0x20b9,
- 0x20d0, 0x20f0,
- 0x2100, 0x2189,
- 0x2190, 0x23f3,
- 0x2400, 0x2426,
- 0x2440, 0x244a,
- 0x2460, 0x26ff,
- 0x2701, 0x27ca,
- 0x27cc, 0x27cc,
- 0x27ce, 0x2b4c,
- 0x2b50, 0x2b59,
- 0x2c00, 0x2c2e,
- 0x2c30, 0x2c5e,
- 0x2c60, 0x2cf1,
- 0x2cf9, 0x2d25,
- 0x2d30, 0x2d65,
- 0x2d6f, 0x2d70,
- 0x2d7f, 0x2d96,
- 0x2da0, 0x2da6,
- 0x2da8, 0x2dae,
- 0x2db0, 0x2db6,
- 0x2db8, 0x2dbe,
- 0x2dc0, 0x2dc6,
- 0x2dc8, 0x2dce,
- 0x2dd0, 0x2dd6,
- 0x2dd8, 0x2dde,
- 0x2de0, 0x2e31,
- 0x2e80, 0x2e99,
- 0x2e9b, 0x2ef3,
- 0x2f00, 0x2fd5,
- 0x2ff0, 0x2ffb,
- 0x3001, 0x303f,
- 0x3041, 0x3096,
- 0x3099, 0x30ff,
- 0x3105, 0x312d,
- 0x3131, 0x318e,
- 0x3190, 0x31ba,
- 0x31c0, 0x31e3,
- 0x31f0, 0x321e,
- 0x3220, 0x32fe,
- 0x3300, 0x4db5,
- 0x4dc0, 0x9fcb,
- 0xa000, 0xa48c,
- 0xa490, 0xa4c6,
- 0xa4d0, 0xa62b,
- 0xa640, 0xa673,
- 0xa67c, 0xa697,
- 0xa6a0, 0xa6f7,
- 0xa700, 0xa78e,
- 0xa790, 0xa791,
- 0xa7a0, 0xa7a9,
- 0xa7fa, 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, 0xaadf,
- 0xab01, 0xab06,
- 0xab09, 0xab0e,
- 0xab11, 0xab16,
- 0xab20, 0xab26,
- 0xab28, 0xab2e,
- 0xabc0, 0xabed,
- 0xabf0, 0xabf9,
- 0xac00, 0xd7a3,
- 0xd7b0, 0xd7c6,
- 0xd7cb, 0xd7fb,
- 0xe000, 0xfa2d,
- 0xfa30, 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,
- 0xfdf0, 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, 0xfffd,
- 0x10000, 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,
- 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,
- 0x12000, 0x1236e,
- 0x12400, 0x12462,
- 0x12470, 0x12473,
- 0x13000, 0x1342e,
- 0x16800, 0x16a38,
- 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,
- 0x1f000, 0x1f02b,
- 0x1f030, 0x1f093,
- 0x1f0a0, 0x1f0ae,
- 0x1f0b1, 0x1f0be,
- 0x1f0c1, 0x1f0cf,
- 0x1f0d1, 0x1f0df,
- 0x1f100, 0x1f10a,
- 0x1f110, 0x1f12e,
- 0x1f130, 0x1f169,
- 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,
- 0x1f550, 0x1f567,
- 0x1f5fb, 0x1f5ff,
- 0x1f601, 0x1f610,
- 0x1f612, 0x1f614,
- 0x1f616, 0x1f616,
- 0x1f618, 0x1f618,
- 0x1f61a, 0x1f61a,
- 0x1f61c, 0x1f61e,
- 0x1f620, 0x1f625,
- 0x1f628, 0x1f62b,
- 0x1f62d, 0x1f62d,
- 0x1f630, 0x1f633,
- 0x1f635, 0x1f640,
- 0x1f645, 0x1f64f,
- 0x1f680, 0x1f6c5,
- 0x1f700, 0x1f773,
- 0x20000, 0x2a6d6,
- 0x2a700, 0x2b734,
- 0x2b740, 0x2b81d,
- 0x2f800, 0x2fa1d,
- 0xe0001, 0xe0001,
- 0xe0020, 0xe007f,
- 0xe0100, 0xe01ef,
- 0xf0000, 0xffffd,
- 0x100000, 0x10fffd,
-}; /* CR_Graph */
-
-/* 'Lower': [[:Lower:]] */
-#define CR_Lower CR_Lowercase
-
-/* 'Print': [[:Print:]] */
-static const OnigCodePoint CR_Print[] = {
- 503,
- 0x0020, 0x007e,
- 0x00a0, 0x0377,
+/* 'Age_6_1': Derived Age 6.1 */
+static const OnigCodePoint CR_Age_6_1[] = {
+ 549,
+ 0x0000, 0x0377,
0x037a, 0x037e,
0x0384, 0x038a,
0x038c, 0x038c,
@@ -20374,10 +23582,11 @@ static const OnigCodePoint CR_Print[] = {
0x0559, 0x055f,
0x0561, 0x0587,
0x0589, 0x058a,
+ 0x058f, 0x058f,
0x0591, 0x05c7,
0x05d0, 0x05ea,
0x05f0, 0x05f4,
- 0x0600, 0x0603,
+ 0x0600, 0x0604,
0x0606, 0x061b,
0x061e, 0x070d,
0x070f, 0x074a,
@@ -20387,6 +23596,9 @@ static const OnigCodePoint CR_Print[] = {
0x0830, 0x083e,
0x0840, 0x085b,
0x085e, 0x085e,
+ 0x08a0, 0x08a0,
+ 0x08a2, 0x08ac,
+ 0x08e4, 0x08fe,
0x0900, 0x0977,
0x0979, 0x097f,
0x0981, 0x0983,
@@ -20431,8 +23643,7 @@ static const OnigCodePoint CR_Print[] = {
0x0acb, 0x0acd,
0x0ad0, 0x0ad0,
0x0ae0, 0x0ae3,
- 0x0ae6, 0x0aef,
- 0x0af1, 0x0af1,
+ 0x0ae6, 0x0af1,
0x0b01, 0x0b03,
0x0b05, 0x0b0c,
0x0b0f, 0x0b10,
@@ -20532,7 +23743,7 @@ static const OnigCodePoint CR_Print[] = {
0x0ec6, 0x0ec6,
0x0ec8, 0x0ecd,
0x0ed0, 0x0ed9,
- 0x0edc, 0x0edd,
+ 0x0edc, 0x0edf,
0x0f00, 0x0f47,
0x0f49, 0x0f6c,
0x0f71, 0x0f97,
@@ -20540,8 +23751,9 @@ static const OnigCodePoint CR_Print[] = {
0x0fbe, 0x0fcc,
0x0fce, 0x0fda,
0x1000, 0x10c5,
- 0x10d0, 0x10fc,
- 0x1100, 0x1248,
+ 0x10c7, 0x10c7,
+ 0x10cd, 0x10cd,
+ 0x10d0, 0x1248,
0x124a, 0x124d,
0x1250, 0x1256,
0x1258, 0x1258,
@@ -20594,13 +23806,12 @@ static const OnigCodePoint CR_Print[] = {
0x1aa0, 0x1aad,
0x1b00, 0x1b4b,
0x1b50, 0x1b7c,
- 0x1b80, 0x1baa,
- 0x1bae, 0x1bb9,
- 0x1bc0, 0x1bf3,
+ 0x1b80, 0x1bf3,
0x1bfc, 0x1c37,
0x1c3b, 0x1c49,
0x1c4d, 0x1c7f,
- 0x1cd0, 0x1cf2,
+ 0x1cc0, 0x1cc7,
+ 0x1cd0, 0x1cf6,
0x1d00, 0x1de6,
0x1dfc, 0x1f15,
0x1f18, 0x1f1d,
@@ -20618,8 +23829,7 @@ static const OnigCodePoint CR_Print[] = {
0x1fdd, 0x1fef,
0x1ff2, 0x1ff4,
0x1ff6, 0x1ffe,
- 0x2000, 0x2027,
- 0x202a, 0x2064,
+ 0x2000, 0x2064,
0x206a, 0x2071,
0x2074, 0x208e,
0x2090, 0x209c,
@@ -20630,15 +23840,15 @@ static const OnigCodePoint CR_Print[] = {
0x2400, 0x2426,
0x2440, 0x244a,
0x2460, 0x26ff,
- 0x2701, 0x27ca,
- 0x27cc, 0x27cc,
- 0x27ce, 0x2b4c,
+ 0x2701, 0x2b4c,
0x2b50, 0x2b59,
0x2c00, 0x2c2e,
0x2c30, 0x2c5e,
- 0x2c60, 0x2cf1,
+ 0x2c60, 0x2cf3,
0x2cf9, 0x2d25,
- 0x2d30, 0x2d65,
+ 0x2d27, 0x2d27,
+ 0x2d2d, 0x2d2d,
+ 0x2d30, 0x2d67,
0x2d6f, 0x2d70,
0x2d7f, 0x2d96,
0x2da0, 0x2da6,
@@ -20649,7 +23859,7 @@ static const OnigCodePoint CR_Print[] = {
0x2dc8, 0x2dce,
0x2dd0, 0x2dd6,
0x2dd8, 0x2dde,
- 0x2de0, 0x2e31,
+ 0x2de0, 0x2e3b,
0x2e80, 0x2e99,
0x2e9b, 0x2ef3,
0x2f00, 0x2fd5,
@@ -20664,17 +23874,16 @@ static const OnigCodePoint CR_Print[] = {
0x31f0, 0x321e,
0x3220, 0x32fe,
0x3300, 0x4db5,
- 0x4dc0, 0x9fcb,
+ 0x4dc0, 0x9fcc,
0xa000, 0xa48c,
0xa490, 0xa4c6,
0xa4d0, 0xa62b,
- 0xa640, 0xa673,
- 0xa67c, 0xa697,
- 0xa6a0, 0xa6f7,
+ 0xa640, 0xa697,
+ 0xa69f, 0xa6f7,
0xa700, 0xa78e,
- 0xa790, 0xa791,
- 0xa7a0, 0xa7a9,
- 0xa7fa, 0xa82b,
+ 0xa790, 0xa793,
+ 0xa7a0, 0xa7aa,
+ 0xa7f8, 0xa82b,
0xa830, 0xa839,
0xa840, 0xa877,
0xa880, 0xa8c4,
@@ -20690,7 +23899,7 @@ static const OnigCodePoint CR_Print[] = {
0xaa50, 0xaa59,
0xaa5c, 0xaa7b,
0xaa80, 0xaac2,
- 0xaadb, 0xaadf,
+ 0xaadb, 0xaaf6,
0xab01, 0xab06,
0xab09, 0xab0e,
0xab11, 0xab16,
@@ -20701,8 +23910,7 @@ static const OnigCodePoint CR_Print[] = {
0xac00, 0xd7a3,
0xd7b0, 0xd7c6,
0xd7cb, 0xd7fb,
- 0xe000, 0xfa2d,
- 0xfa30, 0xfa6d,
+ 0xd800, 0xfa6d,
0xfa70, 0xfad9,
0xfb00, 0xfb06,
0xfb13, 0xfb17,
@@ -20715,7 +23923,7 @@ static const OnigCodePoint CR_Print[] = {
0xfbd3, 0xfd3f,
0xfd50, 0xfd8f,
0xfd92, 0xfdc7,
- 0xfdf0, 0xfdfd,
+ 0xfdd0, 0xfdfd,
0xfe00, 0xfe19,
0xfe20, 0xfe26,
0xfe30, 0xfe52,
@@ -20731,8 +23939,7 @@ static const OnigCodePoint CR_Print[] = {
0xffda, 0xffdc,
0xffe0, 0xffe6,
0xffe8, 0xffee,
- 0xfff9, 0xfffd,
- 0x10000, 0x1000b,
+ 0xfff9, 0x1000b,
0x1000d, 0x10026,
0x10028, 0x1003a,
0x1003c, 0x1003d,
@@ -20764,6 +23971,8 @@ static const OnigCodePoint CR_Print[] = {
0x10900, 0x1091b,
0x1091f, 0x10939,
0x1093f, 0x1093f,
+ 0x10980, 0x109b7,
+ 0x109be, 0x109bf,
0x10a00, 0x10a03,
0x10a05, 0x10a06,
0x10a0c, 0x10a13,
@@ -20782,11 +23991,22 @@ static const OnigCodePoint CR_Print[] = {
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,
@@ -20815,6 +24035,40 @@ static const OnigCodePoint CR_Print[] = {
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,
@@ -20823,7 +24077,7 @@ static const OnigCodePoint CR_Print[] = {
0x1f0d1, 0x1f0df,
0x1f100, 0x1f10a,
0x1f110, 0x1f12e,
- 0x1f130, 0x1f169,
+ 0x1f130, 0x1f16b,
0x1f170, 0x1f19a,
0x1f1e6, 0x1f202,
0x1f210, 0x1f23a,
@@ -20841,1083 +24095,1368 @@ static const OnigCodePoint CR_Print[] = {
0x1f442, 0x1f4f7,
0x1f4f9, 0x1f4fc,
0x1f500, 0x1f53d,
+ 0x1f540, 0x1f543,
0x1f550, 0x1f567,
- 0x1f5fb, 0x1f5ff,
- 0x1f601, 0x1f610,
- 0x1f612, 0x1f614,
- 0x1f616, 0x1f616,
- 0x1f618, 0x1f618,
- 0x1f61a, 0x1f61a,
- 0x1f61c, 0x1f61e,
- 0x1f620, 0x1f625,
- 0x1f628, 0x1f62b,
- 0x1f62d, 0x1f62d,
- 0x1f630, 0x1f633,
- 0x1f635, 0x1f640,
+ 0x1f5fb, 0x1f640,
0x1f645, 0x1f64f,
0x1f680, 0x1f6c5,
0x1f700, 0x1f773,
- 0x20000, 0x2a6d6,
+ 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,
- 0xf0000, 0xffffd,
- 0x100000, 0x10fffd,
-}; /* CR_Print */
+ 0xefffe, 0x10ffff,
+}; /* CR_Age_6_1 */
-/* 'Punct': [[:Punct:]] */
-#define CR_Punct CR_P
+/* 'In_Basic_Latin': Block */
+#define CR_In_Basic_Latin CR_ASCII
-/* 'Space': [[:Space:]] */
-#define CR_Space CR_White_Space
+/* 'In_Latin_1_Supplement': Block */
+static const OnigCodePoint CR_In_Latin_1_Supplement[] = {
+ 1,
+ 0x0080, 0x00ff,
+}; /* CR_In_Latin_1_Supplement */
-/* 'Upper': [[:Upper:]] */
-#define CR_Upper CR_Uppercase
+/* 'In_Latin_Extended_A': Block */
+static const OnigCodePoint CR_In_Latin_Extended_A[] = {
+ 1,
+ 0x0100, 0x017f,
+}; /* CR_In_Latin_Extended_A */
-/* 'XDigit': [[:XDigit:]] */
-#define CR_XDigit CR_ASCII_Hex_Digit
+/* 'In_Latin_Extended_B': Block */
+static const OnigCodePoint CR_In_Latin_Extended_B[] = {
+ 1,
+ 0x0180, 0x024f,
+}; /* CR_In_Latin_Extended_B */
-/* 'Word': [[:Word:]] */
-static const OnigCodePoint CR_Word[] = {
- 514,
- 0x0030, 0x0039,
- 0x0041, 0x005a,
- 0x005f, 0x005f,
- 0x0061, 0x007a,
- 0x00aa, 0x00aa,
- 0x00b5, 0x00b5,
- 0x00ba, 0x00ba,
- 0x00c0, 0x00d6,
- 0x00d8, 0x00f6,
- 0x00f8, 0x02c1,
- 0x02c6, 0x02d1,
- 0x02e0, 0x02e4,
- 0x02ec, 0x02ec,
- 0x02ee, 0x02ee,
- 0x0300, 0x0374,
- 0x0376, 0x0377,
- 0x037a, 0x037d,
- 0x0386, 0x0386,
- 0x0388, 0x038a,
- 0x038c, 0x038c,
- 0x038e, 0x03a1,
- 0x03a3, 0x03f5,
- 0x03f7, 0x0481,
- 0x0483, 0x0527,
- 0x0531, 0x0556,
- 0x0559, 0x0559,
- 0x0561, 0x0587,
- 0x0591, 0x05bd,
- 0x05bf, 0x05bf,
- 0x05c1, 0x05c2,
- 0x05c4, 0x05c5,
- 0x05c7, 0x05c7,
- 0x05d0, 0x05ea,
- 0x05f0, 0x05f2,
- 0x0610, 0x061a,
- 0x0620, 0x0669,
- 0x066e, 0x06d3,
- 0x06d5, 0x06dc,
- 0x06df, 0x06e8,
- 0x06ea, 0x06fc,
- 0x06ff, 0x06ff,
- 0x0710, 0x074a,
- 0x074d, 0x07b1,
- 0x07c0, 0x07f5,
- 0x07fa, 0x07fa,
- 0x0800, 0x082d,
- 0x0840, 0x085b,
- 0x0900, 0x0963,
- 0x0966, 0x096f,
- 0x0971, 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, 0x09f1,
- 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, 0x0aef,
- 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, 0x0b6f,
- 0x0b71, 0x0b71,
- 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, 0x0bef,
- 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,
- 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, 0x0d6f,
- 0x0d7a, 0x0d7f,
- 0x0d82, 0x0d83,
- 0x0d85, 0x0d96,
- 0x0d9a, 0x0db1,
- 0x0db3, 0x0dbb,
- 0x0dbd, 0x0dbd,
- 0x0dc0, 0x0dc6,
- 0x0dca, 0x0dca,
- 0x0dcf, 0x0dd4,
- 0x0dd6, 0x0dd6,
- 0x0dd8, 0x0ddf,
- 0x0df2, 0x0df3,
- 0x0e01, 0x0e3a,
- 0x0e40, 0x0e4e,
- 0x0e50, 0x0e59,
- 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, 0x0edd,
- 0x0f00, 0x0f00,
- 0x0f18, 0x0f19,
- 0x0f20, 0x0f29,
- 0x0f35, 0x0f35,
- 0x0f37, 0x0f37,
- 0x0f39, 0x0f39,
- 0x0f3e, 0x0f47,
- 0x0f49, 0x0f6c,
- 0x0f71, 0x0f84,
- 0x0f86, 0x0f97,
- 0x0f99, 0x0fbc,
- 0x0fc6, 0x0fc6,
- 0x1000, 0x1049,
- 0x1050, 0x109d,
- 0x10a0, 0x10c5,
- 0x10d0, 0x10fa,
- 0x10fc, 0x10fc,
- 0x1100, 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, 0x135f,
- 0x1380, 0x138f,
- 0x13a0, 0x13f4,
- 0x1401, 0x166c,
- 0x166f, 0x167f,
- 0x1681, 0x169a,
- 0x16a0, 0x16ea,
- 0x16ee, 0x16f0,
- 0x1700, 0x170c,
- 0x170e, 0x1714,
- 0x1720, 0x1734,
- 0x1740, 0x1753,
- 0x1760, 0x176c,
- 0x176e, 0x1770,
- 0x1772, 0x1773,
- 0x1780, 0x17b3,
- 0x17b6, 0x17d3,
- 0x17d7, 0x17d7,
- 0x17dc, 0x17dd,
- 0x17e0, 0x17e9,
- 0x180b, 0x180d,
- 0x1810, 0x1819,
- 0x1820, 0x1877,
- 0x1880, 0x18aa,
- 0x18b0, 0x18f5,
- 0x1900, 0x191c,
- 0x1920, 0x192b,
- 0x1930, 0x193b,
- 0x1946, 0x196d,
- 0x1970, 0x1974,
- 0x1980, 0x19ab,
- 0x19b0, 0x19c9,
- 0x19d0, 0x19d9,
- 0x1a00, 0x1a1b,
- 0x1a20, 0x1a5e,
- 0x1a60, 0x1a7c,
- 0x1a7f, 0x1a89,
- 0x1a90, 0x1a99,
- 0x1aa7, 0x1aa7,
- 0x1b00, 0x1b4b,
- 0x1b50, 0x1b59,
- 0x1b6b, 0x1b73,
- 0x1b80, 0x1baa,
- 0x1bae, 0x1bb9,
- 0x1bc0, 0x1bf3,
- 0x1c00, 0x1c37,
- 0x1c40, 0x1c49,
- 0x1c4d, 0x1c7d,
- 0x1cd0, 0x1cd2,
- 0x1cd4, 0x1cf2,
- 0x1d00, 0x1de6,
- 0x1dfc, 0x1f15,
- 0x1f18, 0x1f1d,
- 0x1f20, 0x1f45,
- 0x1f48, 0x1f4d,
- 0x1f50, 0x1f57,
- 0x1f59, 0x1f59,
- 0x1f5b, 0x1f5b,
- 0x1f5d, 0x1f5d,
- 0x1f5f, 0x1f7d,
- 0x1f80, 0x1fb4,
- 0x1fb6, 0x1fbc,
- 0x1fbe, 0x1fbe,
- 0x1fc2, 0x1fc4,
- 0x1fc6, 0x1fcc,
- 0x1fd0, 0x1fd3,
- 0x1fd6, 0x1fdb,
- 0x1fe0, 0x1fec,
- 0x1ff2, 0x1ff4,
- 0x1ff6, 0x1ffc,
- 0x203f, 0x2040,
- 0x2054, 0x2054,
- 0x2071, 0x2071,
- 0x207f, 0x207f,
- 0x2090, 0x209c,
- 0x20d0, 0x20f0,
- 0x2102, 0x2102,
- 0x2107, 0x2107,
- 0x210a, 0x2113,
- 0x2115, 0x2115,
- 0x2119, 0x211d,
- 0x2124, 0x2124,
- 0x2126, 0x2126,
- 0x2128, 0x2128,
- 0x212a, 0x212d,
- 0x212f, 0x2139,
- 0x213c, 0x213f,
- 0x2145, 0x2149,
- 0x214e, 0x214e,
- 0x2160, 0x2188,
- 0x24b6, 0x24e9,
- 0x2c00, 0x2c2e,
- 0x2c30, 0x2c5e,
- 0x2c60, 0x2ce4,
- 0x2ceb, 0x2cf1,
- 0x2d00, 0x2d25,
- 0x2d30, 0x2d65,
- 0x2d6f, 0x2d6f,
- 0x2d7f, 0x2d96,
- 0x2da0, 0x2da6,
- 0x2da8, 0x2dae,
- 0x2db0, 0x2db6,
- 0x2db8, 0x2dbe,
- 0x2dc0, 0x2dc6,
- 0x2dc8, 0x2dce,
- 0x2dd0, 0x2dd6,
- 0x2dd8, 0x2dde,
+/* 'In_IPA_Extensions': Block */
+static const OnigCodePoint CR_In_IPA_Extensions[] = {
+ 1,
+ 0x0250, 0x02af,
+}; /* CR_In_IPA_Extensions */
+
+/* 'In_Spacing_Modifier_Letters': Block */
+static const OnigCodePoint CR_In_Spacing_Modifier_Letters[] = {
+ 1,
+ 0x02b0, 0x02ff,
+}; /* CR_In_Spacing_Modifier_Letters */
+
+/* 'In_Combining_Diacritical_Marks': Block */
+static const OnigCodePoint CR_In_Combining_Diacritical_Marks[] = {
+ 1,
+ 0x0300, 0x036f,
+}; /* CR_In_Combining_Diacritical_Marks */
+
+/* 'In_Greek_and_Coptic': Block */
+static const OnigCodePoint CR_In_Greek_and_Coptic[] = {
+ 1,
+ 0x0370, 0x03ff,
+}; /* CR_In_Greek_and_Coptic */
+
+/* 'In_Cyrillic': Block */
+static const OnigCodePoint CR_In_Cyrillic[] = {
+ 1,
+ 0x0400, 0x04ff,
+}; /* CR_In_Cyrillic */
+
+/* 'In_Cyrillic_Supplement': Block */
+static const OnigCodePoint CR_In_Cyrillic_Supplement[] = {
+ 1,
+ 0x0500, 0x052f,
+}; /* CR_In_Cyrillic_Supplement */
+
+/* 'In_Armenian': Block */
+static const OnigCodePoint CR_In_Armenian[] = {
+ 1,
+ 0x0530, 0x058f,
+}; /* CR_In_Armenian */
+
+/* 'In_Hebrew': Block */
+static const OnigCodePoint CR_In_Hebrew[] = {
+ 1,
+ 0x0590, 0x05ff,
+}; /* CR_In_Hebrew */
+
+/* 'In_Arabic': Block */
+static const OnigCodePoint CR_In_Arabic[] = {
+ 1,
+ 0x0600, 0x06ff,
+}; /* CR_In_Arabic */
+
+/* 'In_Syriac': Block */
+static const OnigCodePoint CR_In_Syriac[] = {
+ 1,
+ 0x0700, 0x074f,
+}; /* CR_In_Syriac */
+
+/* 'In_Arabic_Supplement': Block */
+static const OnigCodePoint CR_In_Arabic_Supplement[] = {
+ 1,
+ 0x0750, 0x077f,
+}; /* CR_In_Arabic_Supplement */
+
+/* 'In_Thaana': Block */
+static const OnigCodePoint CR_In_Thaana[] = {
+ 1,
+ 0x0780, 0x07bf,
+}; /* CR_In_Thaana */
+
+/* 'In_NKo': Block */
+static const OnigCodePoint CR_In_NKo[] = {
+ 1,
+ 0x07c0, 0x07ff,
+}; /* CR_In_NKo */
+
+/* 'In_Samaritan': Block */
+static const OnigCodePoint CR_In_Samaritan[] = {
+ 1,
+ 0x0800, 0x083f,
+}; /* CR_In_Samaritan */
+
+/* 'In_Mandaic': Block */
+static const OnigCodePoint CR_In_Mandaic[] = {
+ 1,
+ 0x0840, 0x085f,
+}; /* CR_In_Mandaic */
+
+/* 'In_Arabic_Extended_A': Block */
+static const OnigCodePoint CR_In_Arabic_Extended_A[] = {
+ 1,
+ 0x08a0, 0x08ff,
+}; /* CR_In_Arabic_Extended_A */
+
+/* 'In_Devanagari': Block */
+static const OnigCodePoint CR_In_Devanagari[] = {
+ 1,
+ 0x0900, 0x097f,
+}; /* CR_In_Devanagari */
+
+/* 'In_Bengali': Block */
+static const OnigCodePoint CR_In_Bengali[] = {
+ 1,
+ 0x0980, 0x09ff,
+}; /* CR_In_Bengali */
+
+/* 'In_Gurmukhi': Block */
+static const OnigCodePoint CR_In_Gurmukhi[] = {
+ 1,
+ 0x0a00, 0x0a7f,
+}; /* CR_In_Gurmukhi */
+
+/* 'In_Gujarati': Block */
+static const OnigCodePoint CR_In_Gujarati[] = {
+ 1,
+ 0x0a80, 0x0aff,
+}; /* CR_In_Gujarati */
+
+/* 'In_Oriya': Block */
+static const OnigCodePoint CR_In_Oriya[] = {
+ 1,
+ 0x0b00, 0x0b7f,
+}; /* CR_In_Oriya */
+
+/* 'In_Tamil': Block */
+static const OnigCodePoint CR_In_Tamil[] = {
+ 1,
+ 0x0b80, 0x0bff,
+}; /* CR_In_Tamil */
+
+/* 'In_Telugu': Block */
+static const OnigCodePoint CR_In_Telugu[] = {
+ 1,
+ 0x0c00, 0x0c7f,
+}; /* CR_In_Telugu */
+
+/* 'In_Kannada': Block */
+static const OnigCodePoint CR_In_Kannada[] = {
+ 1,
+ 0x0c80, 0x0cff,
+}; /* CR_In_Kannada */
+
+/* 'In_Malayalam': Block */
+static const OnigCodePoint CR_In_Malayalam[] = {
+ 1,
+ 0x0d00, 0x0d7f,
+}; /* CR_In_Malayalam */
+
+/* 'In_Sinhala': Block */
+static const OnigCodePoint CR_In_Sinhala[] = {
+ 1,
+ 0x0d80, 0x0dff,
+}; /* CR_In_Sinhala */
+
+/* 'In_Thai': Block */
+static const OnigCodePoint CR_In_Thai[] = {
+ 1,
+ 0x0e00, 0x0e7f,
+}; /* CR_In_Thai */
+
+/* 'In_Lao': Block */
+static const OnigCodePoint CR_In_Lao[] = {
+ 1,
+ 0x0e80, 0x0eff,
+}; /* CR_In_Lao */
+
+/* 'In_Tibetan': Block */
+static const OnigCodePoint CR_In_Tibetan[] = {
+ 1,
+ 0x0f00, 0x0fff,
+}; /* CR_In_Tibetan */
+
+/* 'In_Myanmar': Block */
+static const OnigCodePoint CR_In_Myanmar[] = {
+ 1,
+ 0x1000, 0x109f,
+}; /* CR_In_Myanmar */
+
+/* 'In_Georgian': Block */
+static const OnigCodePoint CR_In_Georgian[] = {
+ 1,
+ 0x10a0, 0x10ff,
+}; /* CR_In_Georgian */
+
+/* 'In_Hangul_Jamo': Block */
+static const OnigCodePoint CR_In_Hangul_Jamo[] = {
+ 1,
+ 0x1100, 0x11ff,
+}; /* CR_In_Hangul_Jamo */
+
+/* 'In_Ethiopic': Block */
+static const OnigCodePoint CR_In_Ethiopic[] = {
+ 1,
+ 0x1200, 0x137f,
+}; /* CR_In_Ethiopic */
+
+/* 'In_Ethiopic_Supplement': Block */
+static const OnigCodePoint CR_In_Ethiopic_Supplement[] = {
+ 1,
+ 0x1380, 0x139f,
+}; /* CR_In_Ethiopic_Supplement */
+
+/* 'In_Cherokee': Block */
+static const OnigCodePoint CR_In_Cherokee[] = {
+ 1,
+ 0x13a0, 0x13ff,
+}; /* CR_In_Cherokee */
+
+/* 'In_Unified_Canadian_Aboriginal_Syllabics': Block */
+static const OnigCodePoint CR_In_Unified_Canadian_Aboriginal_Syllabics[] = {
+ 1,
+ 0x1400, 0x167f,
+}; /* CR_In_Unified_Canadian_Aboriginal_Syllabics */
+
+/* 'In_Ogham': Block */
+static const OnigCodePoint CR_In_Ogham[] = {
+ 1,
+ 0x1680, 0x169f,
+}; /* CR_In_Ogham */
+
+/* 'In_Runic': Block */
+static const OnigCodePoint CR_In_Runic[] = {
+ 1,
+ 0x16a0, 0x16ff,
+}; /* CR_In_Runic */
+
+/* 'In_Tagalog': Block */
+static const OnigCodePoint CR_In_Tagalog[] = {
+ 1,
+ 0x1700, 0x171f,
+}; /* CR_In_Tagalog */
+
+/* 'In_Hanunoo': Block */
+static const OnigCodePoint CR_In_Hanunoo[] = {
+ 1,
+ 0x1720, 0x173f,
+}; /* CR_In_Hanunoo */
+
+/* 'In_Buhid': Block */
+static const OnigCodePoint CR_In_Buhid[] = {
+ 1,
+ 0x1740, 0x175f,
+}; /* CR_In_Buhid */
+
+/* 'In_Tagbanwa': Block */
+static const OnigCodePoint CR_In_Tagbanwa[] = {
+ 1,
+ 0x1760, 0x177f,
+}; /* CR_In_Tagbanwa */
+
+/* 'In_Khmer': Block */
+static const OnigCodePoint CR_In_Khmer[] = {
+ 1,
+ 0x1780, 0x17ff,
+}; /* CR_In_Khmer */
+
+/* 'In_Mongolian': Block */
+static const OnigCodePoint CR_In_Mongolian[] = {
+ 1,
+ 0x1800, 0x18af,
+}; /* CR_In_Mongolian */
+
+/* 'In_Unified_Canadian_Aboriginal_Syllabics_Extended': Block */
+static const OnigCodePoint CR_In_Unified_Canadian_Aboriginal_Syllabics_Extended[] = {
+ 1,
+ 0x18b0, 0x18ff,
+}; /* CR_In_Unified_Canadian_Aboriginal_Syllabics_Extended */
+
+/* 'In_Limbu': Block */
+static const OnigCodePoint CR_In_Limbu[] = {
+ 1,
+ 0x1900, 0x194f,
+}; /* CR_In_Limbu */
+
+/* 'In_Tai_Le': Block */
+static const OnigCodePoint CR_In_Tai_Le[] = {
+ 1,
+ 0x1950, 0x197f,
+}; /* CR_In_Tai_Le */
+
+/* 'In_New_Tai_Lue': Block */
+static const OnigCodePoint CR_In_New_Tai_Lue[] = {
+ 1,
+ 0x1980, 0x19df,
+}; /* CR_In_New_Tai_Lue */
+
+/* 'In_Khmer_Symbols': Block */
+static const OnigCodePoint CR_In_Khmer_Symbols[] = {
+ 1,
+ 0x19e0, 0x19ff,
+}; /* CR_In_Khmer_Symbols */
+
+/* 'In_Buginese': Block */
+static const OnigCodePoint CR_In_Buginese[] = {
+ 1,
+ 0x1a00, 0x1a1f,
+}; /* CR_In_Buginese */
+
+/* 'In_Tai_Tham': Block */
+static const OnigCodePoint CR_In_Tai_Tham[] = {
+ 1,
+ 0x1a20, 0x1aaf,
+}; /* CR_In_Tai_Tham */
+
+/* 'In_Balinese': Block */
+static const OnigCodePoint CR_In_Balinese[] = {
+ 1,
+ 0x1b00, 0x1b7f,
+}; /* CR_In_Balinese */
+
+/* 'In_Sundanese': Block */
+static const OnigCodePoint CR_In_Sundanese[] = {
+ 1,
+ 0x1b80, 0x1bbf,
+}; /* CR_In_Sundanese */
+
+/* 'In_Batak': Block */
+static const OnigCodePoint CR_In_Batak[] = {
+ 1,
+ 0x1bc0, 0x1bff,
+}; /* CR_In_Batak */
+
+/* 'In_Lepcha': Block */
+static const OnigCodePoint CR_In_Lepcha[] = {
+ 1,
+ 0x1c00, 0x1c4f,
+}; /* CR_In_Lepcha */
+
+/* 'In_Ol_Chiki': Block */
+#define CR_In_Ol_Chiki CR_Ol_Chiki
+
+/* 'In_Sundanese_Supplement': Block */
+static const OnigCodePoint CR_In_Sundanese_Supplement[] = {
+ 1,
+ 0x1cc0, 0x1ccf,
+}; /* CR_In_Sundanese_Supplement */
+
+/* 'In_Vedic_Extensions': Block */
+static const OnigCodePoint CR_In_Vedic_Extensions[] = {
+ 1,
+ 0x1cd0, 0x1cff,
+}; /* CR_In_Vedic_Extensions */
+
+/* 'In_Phonetic_Extensions': Block */
+static const OnigCodePoint CR_In_Phonetic_Extensions[] = {
+ 1,
+ 0x1d00, 0x1d7f,
+}; /* CR_In_Phonetic_Extensions */
+
+/* 'In_Phonetic_Extensions_Supplement': Block */
+static const OnigCodePoint CR_In_Phonetic_Extensions_Supplement[] = {
+ 1,
+ 0x1d80, 0x1dbf,
+}; /* CR_In_Phonetic_Extensions_Supplement */
+
+/* 'In_Combining_Diacritical_Marks_Supplement': Block */
+static const OnigCodePoint CR_In_Combining_Diacritical_Marks_Supplement[] = {
+ 1,
+ 0x1dc0, 0x1dff,
+}; /* CR_In_Combining_Diacritical_Marks_Supplement */
+
+/* 'In_Latin_Extended_Additional': Block */
+static const OnigCodePoint CR_In_Latin_Extended_Additional[] = {
+ 1,
+ 0x1e00, 0x1eff,
+}; /* CR_In_Latin_Extended_Additional */
+
+/* 'In_Greek_Extended': Block */
+static const OnigCodePoint CR_In_Greek_Extended[] = {
+ 1,
+ 0x1f00, 0x1fff,
+}; /* CR_In_Greek_Extended */
+
+/* 'In_General_Punctuation': Block */
+static const OnigCodePoint CR_In_General_Punctuation[] = {
+ 1,
+ 0x2000, 0x206f,
+}; /* CR_In_General_Punctuation */
+
+/* 'In_Superscripts_and_Subscripts': Block */
+static const OnigCodePoint CR_In_Superscripts_and_Subscripts[] = {
+ 1,
+ 0x2070, 0x209f,
+}; /* CR_In_Superscripts_and_Subscripts */
+
+/* 'In_Currency_Symbols': Block */
+static const OnigCodePoint CR_In_Currency_Symbols[] = {
+ 1,
+ 0x20a0, 0x20cf,
+}; /* CR_In_Currency_Symbols */
+
+/* 'In_Combining_Diacritical_Marks_for_Symbols': Block */
+static const OnigCodePoint CR_In_Combining_Diacritical_Marks_for_Symbols[] = {
+ 1,
+ 0x20d0, 0x20ff,
+}; /* CR_In_Combining_Diacritical_Marks_for_Symbols */
+
+/* 'In_Letterlike_Symbols': Block */
+static const OnigCodePoint CR_In_Letterlike_Symbols[] = {
+ 1,
+ 0x2100, 0x214f,
+}; /* CR_In_Letterlike_Symbols */
+
+/* 'In_Number_Forms': Block */
+static const OnigCodePoint CR_In_Number_Forms[] = {
+ 1,
+ 0x2150, 0x218f,
+}; /* CR_In_Number_Forms */
+
+/* 'In_Arrows': Block */
+static const OnigCodePoint CR_In_Arrows[] = {
+ 1,
+ 0x2190, 0x21ff,
+}; /* CR_In_Arrows */
+
+/* 'In_Mathematical_Operators': Block */
+static const OnigCodePoint CR_In_Mathematical_Operators[] = {
+ 1,
+ 0x2200, 0x22ff,
+}; /* CR_In_Mathematical_Operators */
+
+/* 'In_Miscellaneous_Technical': Block */
+static const OnigCodePoint CR_In_Miscellaneous_Technical[] = {
+ 1,
+ 0x2300, 0x23ff,
+}; /* CR_In_Miscellaneous_Technical */
+
+/* 'In_Control_Pictures': Block */
+static const OnigCodePoint CR_In_Control_Pictures[] = {
+ 1,
+ 0x2400, 0x243f,
+}; /* CR_In_Control_Pictures */
+
+/* 'In_Optical_Character_Recognition': Block */
+static const OnigCodePoint CR_In_Optical_Character_Recognition[] = {
+ 1,
+ 0x2440, 0x245f,
+}; /* CR_In_Optical_Character_Recognition */
+
+/* 'In_Enclosed_Alphanumerics': Block */
+static const OnigCodePoint CR_In_Enclosed_Alphanumerics[] = {
+ 1,
+ 0x2460, 0x24ff,
+}; /* CR_In_Enclosed_Alphanumerics */
+
+/* 'In_Box_Drawing': Block */
+static const OnigCodePoint CR_In_Box_Drawing[] = {
+ 1,
+ 0x2500, 0x257f,
+}; /* CR_In_Box_Drawing */
+
+/* 'In_Block_Elements': Block */
+static const OnigCodePoint CR_In_Block_Elements[] = {
+ 1,
+ 0x2580, 0x259f,
+}; /* CR_In_Block_Elements */
+
+/* 'In_Geometric_Shapes': Block */
+static const OnigCodePoint CR_In_Geometric_Shapes[] = {
+ 1,
+ 0x25a0, 0x25ff,
+}; /* CR_In_Geometric_Shapes */
+
+/* 'In_Miscellaneous_Symbols': Block */
+static const OnigCodePoint CR_In_Miscellaneous_Symbols[] = {
+ 1,
+ 0x2600, 0x26ff,
+}; /* CR_In_Miscellaneous_Symbols */
+
+/* 'In_Dingbats': Block */
+static const OnigCodePoint CR_In_Dingbats[] = {
+ 1,
+ 0x2700, 0x27bf,
+}; /* CR_In_Dingbats */
+
+/* 'In_Miscellaneous_Mathematical_Symbols_A': Block */
+static const OnigCodePoint CR_In_Miscellaneous_Mathematical_Symbols_A[] = {
+ 1,
+ 0x27c0, 0x27ef,
+}; /* CR_In_Miscellaneous_Mathematical_Symbols_A */
+
+/* 'In_Supplemental_Arrows_A': Block */
+static const OnigCodePoint CR_In_Supplemental_Arrows_A[] = {
+ 1,
+ 0x27f0, 0x27ff,
+}; /* CR_In_Supplemental_Arrows_A */
+
+/* 'In_Braille_Patterns': Block */
+#define CR_In_Braille_Patterns CR_Braille
+
+/* 'In_Supplemental_Arrows_B': Block */
+static const OnigCodePoint CR_In_Supplemental_Arrows_B[] = {
+ 1,
+ 0x2900, 0x297f,
+}; /* CR_In_Supplemental_Arrows_B */
+
+/* 'In_Miscellaneous_Mathematical_Symbols_B': Block */
+static const OnigCodePoint CR_In_Miscellaneous_Mathematical_Symbols_B[] = {
+ 1,
+ 0x2980, 0x29ff,
+}; /* CR_In_Miscellaneous_Mathematical_Symbols_B */
+
+/* 'In_Supplemental_Mathematical_Operators': Block */
+static const OnigCodePoint CR_In_Supplemental_Mathematical_Operators[] = {
+ 1,
+ 0x2a00, 0x2aff,
+}; /* CR_In_Supplemental_Mathematical_Operators */
+
+/* 'In_Miscellaneous_Symbols_and_Arrows': Block */
+static const OnigCodePoint CR_In_Miscellaneous_Symbols_and_Arrows[] = {
+ 1,
+ 0x2b00, 0x2bff,
+}; /* CR_In_Miscellaneous_Symbols_and_Arrows */
+
+/* 'In_Glagolitic': Block */
+static const OnigCodePoint CR_In_Glagolitic[] = {
+ 1,
+ 0x2c00, 0x2c5f,
+}; /* CR_In_Glagolitic */
+
+/* 'In_Latin_Extended_C': Block */
+static const OnigCodePoint CR_In_Latin_Extended_C[] = {
+ 1,
+ 0x2c60, 0x2c7f,
+}; /* CR_In_Latin_Extended_C */
+
+/* 'In_Coptic': Block */
+static const OnigCodePoint CR_In_Coptic[] = {
+ 1,
+ 0x2c80, 0x2cff,
+}; /* CR_In_Coptic */
+
+/* 'In_Georgian_Supplement': Block */
+static const OnigCodePoint CR_In_Georgian_Supplement[] = {
+ 1,
+ 0x2d00, 0x2d2f,
+}; /* CR_In_Georgian_Supplement */
+
+/* 'In_Tifinagh': Block */
+static const OnigCodePoint CR_In_Tifinagh[] = {
+ 1,
+ 0x2d30, 0x2d7f,
+}; /* CR_In_Tifinagh */
+
+/* 'In_Ethiopic_Extended': Block */
+static const OnigCodePoint CR_In_Ethiopic_Extended[] = {
+ 1,
+ 0x2d80, 0x2ddf,
+}; /* CR_In_Ethiopic_Extended */
+
+/* 'In_Cyrillic_Extended_A': Block */
+static const OnigCodePoint CR_In_Cyrillic_Extended_A[] = {
+ 1,
0x2de0, 0x2dff,
- 0x2e2f, 0x2e2f,
- 0x3005, 0x3007,
- 0x3021, 0x302f,
- 0x3031, 0x3035,
- 0x3038, 0x303c,
- 0x3041, 0x3096,
- 0x3099, 0x309a,
- 0x309d, 0x309f,
- 0x30a1, 0x30fa,
- 0x30fc, 0x30ff,
- 0x3105, 0x312d,
- 0x3131, 0x318e,
- 0x31a0, 0x31ba,
+}; /* CR_In_Cyrillic_Extended_A */
+
+/* 'In_Supplemental_Punctuation': Block */
+static const OnigCodePoint CR_In_Supplemental_Punctuation[] = {
+ 1,
+ 0x2e00, 0x2e7f,
+}; /* CR_In_Supplemental_Punctuation */
+
+/* 'In_CJK_Radicals_Supplement': Block */
+static const OnigCodePoint CR_In_CJK_Radicals_Supplement[] = {
+ 1,
+ 0x2e80, 0x2eff,
+}; /* CR_In_CJK_Radicals_Supplement */
+
+/* 'In_Kangxi_Radicals': Block */
+static const OnigCodePoint CR_In_Kangxi_Radicals[] = {
+ 1,
+ 0x2f00, 0x2fdf,
+}; /* CR_In_Kangxi_Radicals */
+
+/* 'In_Ideographic_Description_Characters': Block */
+static const OnigCodePoint CR_In_Ideographic_Description_Characters[] = {
+ 1,
+ 0x2ff0, 0x2fff,
+}; /* CR_In_Ideographic_Description_Characters */
+
+/* 'In_CJK_Symbols_and_Punctuation': Block */
+static const OnigCodePoint CR_In_CJK_Symbols_and_Punctuation[] = {
+ 1,
+ 0x3000, 0x303f,
+}; /* CR_In_CJK_Symbols_and_Punctuation */
+
+/* 'In_Hiragana': Block */
+static const OnigCodePoint CR_In_Hiragana[] = {
+ 1,
+ 0x3040, 0x309f,
+}; /* CR_In_Hiragana */
+
+/* 'In_Katakana': Block */
+static const OnigCodePoint CR_In_Katakana[] = {
+ 1,
+ 0x30a0, 0x30ff,
+}; /* CR_In_Katakana */
+
+/* 'In_Bopomofo': Block */
+static const OnigCodePoint CR_In_Bopomofo[] = {
+ 1,
+ 0x3100, 0x312f,
+}; /* CR_In_Bopomofo */
+
+/* 'In_Hangul_Compatibility_Jamo': Block */
+static const OnigCodePoint CR_In_Hangul_Compatibility_Jamo[] = {
+ 1,
+ 0x3130, 0x318f,
+}; /* CR_In_Hangul_Compatibility_Jamo */
+
+/* 'In_Kanbun': Block */
+static const OnigCodePoint CR_In_Kanbun[] = {
+ 1,
+ 0x3190, 0x319f,
+}; /* CR_In_Kanbun */
+
+/* 'In_Bopomofo_Extended': Block */
+static const OnigCodePoint CR_In_Bopomofo_Extended[] = {
+ 1,
+ 0x31a0, 0x31bf,
+}; /* CR_In_Bopomofo_Extended */
+
+/* 'In_CJK_Strokes': Block */
+static const OnigCodePoint CR_In_CJK_Strokes[] = {
+ 1,
+ 0x31c0, 0x31ef,
+}; /* CR_In_CJK_Strokes */
+
+/* 'In_Katakana_Phonetic_Extensions': Block */
+static const OnigCodePoint CR_In_Katakana_Phonetic_Extensions[] = {
+ 1,
0x31f0, 0x31ff,
- 0x3400, 0x4db5,
- 0x4e00, 0x9fcb,
- 0xa000, 0xa48c,
- 0xa4d0, 0xa4fd,
- 0xa500, 0xa60c,
- 0xa610, 0xa62b,
- 0xa640, 0xa672,
- 0xa67c, 0xa67d,
- 0xa67f, 0xa697,
- 0xa6a0, 0xa6f1,
- 0xa717, 0xa71f,
- 0xa722, 0xa788,
- 0xa78b, 0xa78e,
- 0xa790, 0xa791,
- 0xa7a0, 0xa7a9,
- 0xa7fa, 0xa827,
- 0xa840, 0xa873,
- 0xa880, 0xa8c4,
- 0xa8d0, 0xa8d9,
- 0xa8e0, 0xa8f7,
- 0xa8fb, 0xa8fb,
- 0xa900, 0xa92d,
- 0xa930, 0xa953,
- 0xa960, 0xa97c,
- 0xa980, 0xa9c0,
- 0xa9cf, 0xa9d9,
- 0xaa00, 0xaa36,
- 0xaa40, 0xaa4d,
- 0xaa50, 0xaa59,
- 0xaa60, 0xaa76,
- 0xaa7a, 0xaa7b,
- 0xaa80, 0xaac2,
- 0xaadb, 0xaadd,
- 0xab01, 0xab06,
- 0xab09, 0xab0e,
- 0xab11, 0xab16,
- 0xab20, 0xab26,
- 0xab28, 0xab2e,
- 0xabc0, 0xabea,
- 0xabec, 0xabed,
- 0xabf0, 0xabf9,
- 0xac00, 0xd7a3,
- 0xd7b0, 0xd7c6,
- 0xd7cb, 0xd7fb,
- 0xf900, 0xfa2d,
- 0xfa30, 0xfa6d,
- 0xfa70, 0xfad9,
- 0xfb00, 0xfb06,
- 0xfb13, 0xfb17,
- 0xfb1d, 0xfb28,
- 0xfb2a, 0xfb36,
- 0xfb38, 0xfb3c,
- 0xfb3e, 0xfb3e,
- 0xfb40, 0xfb41,
- 0xfb43, 0xfb44,
- 0xfb46, 0xfbb1,
- 0xfbd3, 0xfd3d,
- 0xfd50, 0xfd8f,
- 0xfd92, 0xfdc7,
- 0xfdf0, 0xfdfb,
+}; /* CR_In_Katakana_Phonetic_Extensions */
+
+/* 'In_Enclosed_CJK_Letters_and_Months': Block */
+static const OnigCodePoint CR_In_Enclosed_CJK_Letters_and_Months[] = {
+ 1,
+ 0x3200, 0x32ff,
+}; /* CR_In_Enclosed_CJK_Letters_and_Months */
+
+/* 'In_CJK_Compatibility': Block */
+static const OnigCodePoint CR_In_CJK_Compatibility[] = {
+ 1,
+ 0x3300, 0x33ff,
+}; /* CR_In_CJK_Compatibility */
+
+/* 'In_CJK_Unified_Ideographs_Extension_A': Block */
+static const OnigCodePoint CR_In_CJK_Unified_Ideographs_Extension_A[] = {
+ 1,
+ 0x3400, 0x4dbf,
+}; /* CR_In_CJK_Unified_Ideographs_Extension_A */
+
+/* 'In_Yijing_Hexagram_Symbols': Block */
+static const OnigCodePoint CR_In_Yijing_Hexagram_Symbols[] = {
+ 1,
+ 0x4dc0, 0x4dff,
+}; /* CR_In_Yijing_Hexagram_Symbols */
+
+/* 'In_CJK_Unified_Ideographs': Block */
+static const OnigCodePoint CR_In_CJK_Unified_Ideographs[] = {
+ 1,
+ 0x4e00, 0x9fff,
+}; /* CR_In_CJK_Unified_Ideographs */
+
+/* 'In_Yi_Syllables': Block */
+static const OnigCodePoint CR_In_Yi_Syllables[] = {
+ 1,
+ 0xa000, 0xa48f,
+}; /* CR_In_Yi_Syllables */
+
+/* 'In_Yi_Radicals': Block */
+static const OnigCodePoint CR_In_Yi_Radicals[] = {
+ 1,
+ 0xa490, 0xa4cf,
+}; /* CR_In_Yi_Radicals */
+
+/* 'In_Lisu': Block */
+#define CR_In_Lisu CR_Lisu
+
+/* 'In_Vai': Block */
+static const OnigCodePoint CR_In_Vai[] = {
+ 1,
+ 0xa500, 0xa63f,
+}; /* CR_In_Vai */
+
+/* 'In_Cyrillic_Extended_B': Block */
+static const OnigCodePoint CR_In_Cyrillic_Extended_B[] = {
+ 1,
+ 0xa640, 0xa69f,
+}; /* CR_In_Cyrillic_Extended_B */
+
+/* 'In_Bamum': Block */
+static const OnigCodePoint CR_In_Bamum[] = {
+ 1,
+ 0xa6a0, 0xa6ff,
+}; /* CR_In_Bamum */
+
+/* 'In_Modifier_Tone_Letters': Block */
+static const OnigCodePoint CR_In_Modifier_Tone_Letters[] = {
+ 1,
+ 0xa700, 0xa71f,
+}; /* CR_In_Modifier_Tone_Letters */
+
+/* 'In_Latin_Extended_D': Block */
+static const OnigCodePoint CR_In_Latin_Extended_D[] = {
+ 1,
+ 0xa720, 0xa7ff,
+}; /* CR_In_Latin_Extended_D */
+
+/* 'In_Syloti_Nagri': Block */
+static const OnigCodePoint CR_In_Syloti_Nagri[] = {
+ 1,
+ 0xa800, 0xa82f,
+}; /* CR_In_Syloti_Nagri */
+
+/* 'In_Common_Indic_Number_Forms': Block */
+static const OnigCodePoint CR_In_Common_Indic_Number_Forms[] = {
+ 1,
+ 0xa830, 0xa83f,
+}; /* CR_In_Common_Indic_Number_Forms */
+
+/* 'In_Phags_pa': Block */
+static const OnigCodePoint CR_In_Phags_pa[] = {
+ 1,
+ 0xa840, 0xa87f,
+}; /* CR_In_Phags_pa */
+
+/* 'In_Saurashtra': Block */
+static const OnigCodePoint CR_In_Saurashtra[] = {
+ 1,
+ 0xa880, 0xa8df,
+}; /* CR_In_Saurashtra */
+
+/* 'In_Devanagari_Extended': Block */
+static const OnigCodePoint CR_In_Devanagari_Extended[] = {
+ 1,
+ 0xa8e0, 0xa8ff,
+}; /* CR_In_Devanagari_Extended */
+
+/* 'In_Kayah_Li': Block */
+#define CR_In_Kayah_Li CR_Kayah_Li
+
+/* 'In_Rejang': Block */
+static const OnigCodePoint CR_In_Rejang[] = {
+ 1,
+ 0xa930, 0xa95f,
+}; /* CR_In_Rejang */
+
+/* 'In_Hangul_Jamo_Extended_A': Block */
+static const OnigCodePoint CR_In_Hangul_Jamo_Extended_A[] = {
+ 1,
+ 0xa960, 0xa97f,
+}; /* CR_In_Hangul_Jamo_Extended_A */
+
+/* 'In_Javanese': Block */
+static const OnigCodePoint CR_In_Javanese[] = {
+ 1,
+ 0xa980, 0xa9df,
+}; /* CR_In_Javanese */
+
+/* 'In_Cham': Block */
+static const OnigCodePoint CR_In_Cham[] = {
+ 1,
+ 0xaa00, 0xaa5f,
+}; /* CR_In_Cham */
+
+/* 'In_Myanmar_Extended_A': Block */
+static const OnigCodePoint CR_In_Myanmar_Extended_A[] = {
+ 1,
+ 0xaa60, 0xaa7f,
+}; /* CR_In_Myanmar_Extended_A */
+
+/* 'In_Tai_Viet': Block */
+static const OnigCodePoint CR_In_Tai_Viet[] = {
+ 1,
+ 0xaa80, 0xaadf,
+}; /* CR_In_Tai_Viet */
+
+/* 'In_Meetei_Mayek_Extensions': Block */
+static const OnigCodePoint CR_In_Meetei_Mayek_Extensions[] = {
+ 1,
+ 0xaae0, 0xaaff,
+}; /* CR_In_Meetei_Mayek_Extensions */
+
+/* 'In_Ethiopic_Extended_A': Block */
+static const OnigCodePoint CR_In_Ethiopic_Extended_A[] = {
+ 1,
+ 0xab00, 0xab2f,
+}; /* CR_In_Ethiopic_Extended_A */
+
+/* 'In_Meetei_Mayek': Block */
+static const OnigCodePoint CR_In_Meetei_Mayek[] = {
+ 1,
+ 0xabc0, 0xabff,
+}; /* CR_In_Meetei_Mayek */
+
+/* 'In_Hangul_Syllables': Block */
+static const OnigCodePoint CR_In_Hangul_Syllables[] = {
+ 1,
+ 0xac00, 0xd7af,
+}; /* CR_In_Hangul_Syllables */
+
+/* 'In_Hangul_Jamo_Extended_B': Block */
+static const OnigCodePoint CR_In_Hangul_Jamo_Extended_B[] = {
+ 1,
+ 0xd7b0, 0xd7ff,
+}; /* CR_In_Hangul_Jamo_Extended_B */
+
+/* 'In_High_Surrogates': Block */
+static const OnigCodePoint CR_In_High_Surrogates[] = {
+ 1,
+ 0xd800, 0xdb7f,
+}; /* CR_In_High_Surrogates */
+
+/* 'In_High_Private_Use_Surrogates': Block */
+static const OnigCodePoint CR_In_High_Private_Use_Surrogates[] = {
+ 1,
+ 0xdb80, 0xdbff,
+}; /* CR_In_High_Private_Use_Surrogates */
+
+/* 'In_Low_Surrogates': Block */
+static const OnigCodePoint CR_In_Low_Surrogates[] = {
+ 1,
+ 0xdc00, 0xdfff,
+}; /* CR_In_Low_Surrogates */
+
+/* 'In_Private_Use_Area': Block */
+static const OnigCodePoint CR_In_Private_Use_Area[] = {
+ 1,
+ 0xe000, 0xf8ff,
+}; /* CR_In_Private_Use_Area */
+
+/* 'In_CJK_Compatibility_Ideographs': Block */
+static const OnigCodePoint CR_In_CJK_Compatibility_Ideographs[] = {
+ 1,
+ 0xf900, 0xfaff,
+}; /* CR_In_CJK_Compatibility_Ideographs */
+
+/* 'In_Alphabetic_Presentation_Forms': Block */
+static const OnigCodePoint CR_In_Alphabetic_Presentation_Forms[] = {
+ 1,
+ 0xfb00, 0xfb4f,
+}; /* CR_In_Alphabetic_Presentation_Forms */
+
+/* 'In_Arabic_Presentation_Forms_A': Block */
+static const OnigCodePoint CR_In_Arabic_Presentation_Forms_A[] = {
+ 1,
+ 0xfb50, 0xfdff,
+}; /* CR_In_Arabic_Presentation_Forms_A */
+
+/* 'In_Variation_Selectors': Block */
+static const OnigCodePoint CR_In_Variation_Selectors[] = {
+ 1,
0xfe00, 0xfe0f,
- 0xfe20, 0xfe26,
- 0xfe33, 0xfe34,
- 0xfe4d, 0xfe4f,
- 0xfe70, 0xfe74,
- 0xfe76, 0xfefc,
- 0xff10, 0xff19,
- 0xff21, 0xff3a,
- 0xff3f, 0xff3f,
- 0xff41, 0xff5a,
- 0xff66, 0xffbe,
- 0xffc2, 0xffc7,
- 0xffca, 0xffcf,
- 0xffd2, 0xffd7,
- 0xffda, 0xffdc,
- 0x10000, 0x1000b,
- 0x1000d, 0x10026,
- 0x10028, 0x1003a,
- 0x1003c, 0x1003d,
- 0x1003f, 0x1004d,
- 0x10050, 0x1005d,
- 0x10080, 0x100fa,
- 0x10140, 0x10174,
- 0x101fd, 0x101fd,
- 0x10280, 0x1029c,
- 0x102a0, 0x102d0,
- 0x10300, 0x1031e,
- 0x10330, 0x1034a,
- 0x10380, 0x1039d,
- 0x103a0, 0x103c3,
- 0x103c8, 0x103cf,
- 0x103d1, 0x103d5,
- 0x10400, 0x1049d,
- 0x104a0, 0x104a9,
- 0x10800, 0x10805,
- 0x10808, 0x10808,
- 0x1080a, 0x10835,
- 0x10837, 0x10838,
- 0x1083c, 0x1083c,
- 0x1083f, 0x10855,
- 0x10900, 0x10915,
- 0x10920, 0x10939,
- 0x10a00, 0x10a03,
- 0x10a05, 0x10a06,
- 0x10a0c, 0x10a13,
- 0x10a15, 0x10a17,
- 0x10a19, 0x10a33,
- 0x10a38, 0x10a3a,
- 0x10a3f, 0x10a3f,
- 0x10a60, 0x10a7c,
- 0x10b00, 0x10b35,
- 0x10b40, 0x10b55,
- 0x10b60, 0x10b72,
- 0x10c00, 0x10c48,
- 0x11000, 0x11046,
- 0x11066, 0x1106f,
- 0x11080, 0x110ba,
- 0x12000, 0x1236e,
- 0x12400, 0x12462,
- 0x13000, 0x1342e,
- 0x16800, 0x16a38,
- 0x1b000, 0x1b001,
- 0x1d165, 0x1d169,
- 0x1d16d, 0x1d172,
- 0x1d17b, 0x1d182,
- 0x1d185, 0x1d18b,
- 0x1d1aa, 0x1d1ad,
- 0x1d242, 0x1d244,
- 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, 0x1d6c0,
- 0x1d6c2, 0x1d6da,
- 0x1d6dc, 0x1d6fa,
- 0x1d6fc, 0x1d714,
- 0x1d716, 0x1d734,
- 0x1d736, 0x1d74e,
- 0x1d750, 0x1d76e,
- 0x1d770, 0x1d788,
- 0x1d78a, 0x1d7a8,
- 0x1d7aa, 0x1d7c2,
- 0x1d7c4, 0x1d7cb,
- 0x1d7ce, 0x1d7ff,
- 0x20000, 0x2a6d6,
- 0x2a700, 0x2b734,
- 0x2b740, 0x2b81d,
- 0x2f800, 0x2fa1d,
+}; /* CR_In_Variation_Selectors */
+
+/* 'In_Vertical_Forms': Block */
+static const OnigCodePoint CR_In_Vertical_Forms[] = {
+ 1,
+ 0xfe10, 0xfe1f,
+}; /* CR_In_Vertical_Forms */
+
+/* 'In_Combining_Half_Marks': Block */
+static const OnigCodePoint CR_In_Combining_Half_Marks[] = {
+ 1,
+ 0xfe20, 0xfe2f,
+}; /* CR_In_Combining_Half_Marks */
+
+/* 'In_CJK_Compatibility_Forms': Block */
+static const OnigCodePoint CR_In_CJK_Compatibility_Forms[] = {
+ 1,
+ 0xfe30, 0xfe4f,
+}; /* CR_In_CJK_Compatibility_Forms */
+
+/* 'In_Small_Form_Variants': Block */
+static const OnigCodePoint CR_In_Small_Form_Variants[] = {
+ 1,
+ 0xfe50, 0xfe6f,
+}; /* CR_In_Small_Form_Variants */
+
+/* 'In_Arabic_Presentation_Forms_B': Block */
+static const OnigCodePoint CR_In_Arabic_Presentation_Forms_B[] = {
+ 1,
+ 0xfe70, 0xfeff,
+}; /* CR_In_Arabic_Presentation_Forms_B */
+
+/* 'In_Halfwidth_and_Fullwidth_Forms': Block */
+static const OnigCodePoint CR_In_Halfwidth_and_Fullwidth_Forms[] = {
+ 1,
+ 0xff00, 0xffef,
+}; /* CR_In_Halfwidth_and_Fullwidth_Forms */
+
+/* 'In_Specials': Block */
+static const OnigCodePoint CR_In_Specials[] = {
+ 1,
+ 0xfff0, 0xffff,
+}; /* CR_In_Specials */
+
+/* 'In_Linear_B_Syllabary': Block */
+static const OnigCodePoint CR_In_Linear_B_Syllabary[] = {
+ 1,
+ 0x10000, 0x1007f,
+}; /* CR_In_Linear_B_Syllabary */
+
+/* 'In_Linear_B_Ideograms': Block */
+static const OnigCodePoint CR_In_Linear_B_Ideograms[] = {
+ 1,
+ 0x10080, 0x100ff,
+}; /* CR_In_Linear_B_Ideograms */
+
+/* 'In_Aegean_Numbers': Block */
+static const OnigCodePoint CR_In_Aegean_Numbers[] = {
+ 1,
+ 0x10100, 0x1013f,
+}; /* CR_In_Aegean_Numbers */
+
+/* 'In_Ancient_Greek_Numbers': Block */
+static const OnigCodePoint CR_In_Ancient_Greek_Numbers[] = {
+ 1,
+ 0x10140, 0x1018f,
+}; /* CR_In_Ancient_Greek_Numbers */
+
+/* 'In_Ancient_Symbols': Block */
+static const OnigCodePoint CR_In_Ancient_Symbols[] = {
+ 1,
+ 0x10190, 0x101cf,
+}; /* CR_In_Ancient_Symbols */
+
+/* 'In_Phaistos_Disc': Block */
+static const OnigCodePoint CR_In_Phaistos_Disc[] = {
+ 1,
+ 0x101d0, 0x101ff,
+}; /* CR_In_Phaistos_Disc */
+
+/* 'In_Lycian': Block */
+static const OnigCodePoint CR_In_Lycian[] = {
+ 1,
+ 0x10280, 0x1029f,
+}; /* CR_In_Lycian */
+
+/* 'In_Carian': Block */
+static const OnigCodePoint CR_In_Carian[] = {
+ 1,
+ 0x102a0, 0x102df,
+}; /* CR_In_Carian */
+
+/* 'In_Old_Italic': Block */
+static const OnigCodePoint CR_In_Old_Italic[] = {
+ 1,
+ 0x10300, 0x1032f,
+}; /* CR_In_Old_Italic */
+
+/* 'In_Gothic': Block */
+static const OnigCodePoint CR_In_Gothic[] = {
+ 1,
+ 0x10330, 0x1034f,
+}; /* CR_In_Gothic */
+
+/* 'In_Ugaritic': Block */
+static const OnigCodePoint CR_In_Ugaritic[] = {
+ 1,
+ 0x10380, 0x1039f,
+}; /* CR_In_Ugaritic */
+
+/* 'In_Old_Persian': Block */
+static const OnigCodePoint CR_In_Old_Persian[] = {
+ 1,
+ 0x103a0, 0x103df,
+}; /* CR_In_Old_Persian */
+
+/* 'In_Deseret': Block */
+#define CR_In_Deseret CR_Deseret
+
+/* 'In_Shavian': Block */
+#define CR_In_Shavian CR_Shavian
+
+/* 'In_Osmanya': Block */
+static const OnigCodePoint CR_In_Osmanya[] = {
+ 1,
+ 0x10480, 0x104af,
+}; /* CR_In_Osmanya */
+
+/* 'In_Cypriot_Syllabary': Block */
+static const OnigCodePoint CR_In_Cypriot_Syllabary[] = {
+ 1,
+ 0x10800, 0x1083f,
+}; /* CR_In_Cypriot_Syllabary */
+
+/* 'In_Imperial_Aramaic': Block */
+static const OnigCodePoint CR_In_Imperial_Aramaic[] = {
+ 1,
+ 0x10840, 0x1085f,
+}; /* CR_In_Imperial_Aramaic */
+
+/* 'In_Phoenician': Block */
+static const OnigCodePoint CR_In_Phoenician[] = {
+ 1,
+ 0x10900, 0x1091f,
+}; /* CR_In_Phoenician */
+
+/* 'In_Lydian': Block */
+static const OnigCodePoint CR_In_Lydian[] = {
+ 1,
+ 0x10920, 0x1093f,
+}; /* CR_In_Lydian */
+
+/* 'In_Meroitic_Hieroglyphs': Block */
+#define CR_In_Meroitic_Hieroglyphs CR_Meroitic_Hieroglyphs
+
+/* 'In_Meroitic_Cursive': Block */
+static const OnigCodePoint CR_In_Meroitic_Cursive[] = {
+ 1,
+ 0x109a0, 0x109ff,
+}; /* CR_In_Meroitic_Cursive */
+
+/* 'In_Kharoshthi': Block */
+static const OnigCodePoint CR_In_Kharoshthi[] = {
+ 1,
+ 0x10a00, 0x10a5f,
+}; /* CR_In_Kharoshthi */
+
+/* 'In_Old_South_Arabian': Block */
+#define CR_In_Old_South_Arabian CR_Old_South_Arabian
+
+/* 'In_Avestan': Block */
+static const OnigCodePoint CR_In_Avestan[] = {
+ 1,
+ 0x10b00, 0x10b3f,
+}; /* CR_In_Avestan */
+
+/* 'In_Inscriptional_Parthian': Block */
+static const OnigCodePoint CR_In_Inscriptional_Parthian[] = {
+ 1,
+ 0x10b40, 0x10b5f,
+}; /* CR_In_Inscriptional_Parthian */
+
+/* 'In_Inscriptional_Pahlavi': Block */
+static const OnigCodePoint CR_In_Inscriptional_Pahlavi[] = {
+ 1,
+ 0x10b60, 0x10b7f,
+}; /* CR_In_Inscriptional_Pahlavi */
+
+/* 'In_Old_Turkic': Block */
+static const OnigCodePoint CR_In_Old_Turkic[] = {
+ 1,
+ 0x10c00, 0x10c4f,
+}; /* CR_In_Old_Turkic */
+
+/* 'In_Rumi_Numeral_Symbols': Block */
+static const OnigCodePoint CR_In_Rumi_Numeral_Symbols[] = {
+ 1,
+ 0x10e60, 0x10e7f,
+}; /* CR_In_Rumi_Numeral_Symbols */
+
+/* 'In_Brahmi': Block */
+static const OnigCodePoint CR_In_Brahmi[] = {
+ 1,
+ 0x11000, 0x1107f,
+}; /* CR_In_Brahmi */
+
+/* 'In_Kaithi': Block */
+static const OnigCodePoint CR_In_Kaithi[] = {
+ 1,
+ 0x11080, 0x110cf,
+}; /* CR_In_Kaithi */
+
+/* 'In_Sora_Sompeng': Block */
+static const OnigCodePoint CR_In_Sora_Sompeng[] = {
+ 1,
+ 0x110d0, 0x110ff,
+}; /* CR_In_Sora_Sompeng */
+
+/* 'In_Chakma': Block */
+static const OnigCodePoint CR_In_Chakma[] = {
+ 1,
+ 0x11100, 0x1114f,
+}; /* CR_In_Chakma */
+
+/* 'In_Sharada': Block */
+static const OnigCodePoint CR_In_Sharada[] = {
+ 1,
+ 0x11180, 0x111df,
+}; /* CR_In_Sharada */
+
+/* 'In_Takri': Block */
+static const OnigCodePoint CR_In_Takri[] = {
+ 1,
+ 0x11680, 0x116cf,
+}; /* CR_In_Takri */
+
+/* 'In_Cuneiform': Block */
+static const OnigCodePoint CR_In_Cuneiform[] = {
+ 1,
+ 0x12000, 0x123ff,
+}; /* CR_In_Cuneiform */
+
+/* 'In_Cuneiform_Numbers_and_Punctuation': Block */
+static const OnigCodePoint CR_In_Cuneiform_Numbers_and_Punctuation[] = {
+ 1,
+ 0x12400, 0x1247f,
+}; /* CR_In_Cuneiform_Numbers_and_Punctuation */
+
+/* 'In_Egyptian_Hieroglyphs': Block */
+static const OnigCodePoint CR_In_Egyptian_Hieroglyphs[] = {
+ 1,
+ 0x13000, 0x1342f,
+}; /* CR_In_Egyptian_Hieroglyphs */
+
+/* 'In_Bamum_Supplement': Block */
+static const OnigCodePoint CR_In_Bamum_Supplement[] = {
+ 1,
+ 0x16800, 0x16a3f,
+}; /* CR_In_Bamum_Supplement */
+
+/* 'In_Miao': Block */
+static const OnigCodePoint CR_In_Miao[] = {
+ 1,
+ 0x16f00, 0x16f9f,
+}; /* CR_In_Miao */
+
+/* 'In_Kana_Supplement': Block */
+static const OnigCodePoint CR_In_Kana_Supplement[] = {
+ 1,
+ 0x1b000, 0x1b0ff,
+}; /* CR_In_Kana_Supplement */
+
+/* 'In_Byzantine_Musical_Symbols': Block */
+static const OnigCodePoint CR_In_Byzantine_Musical_Symbols[] = {
+ 1,
+ 0x1d000, 0x1d0ff,
+}; /* CR_In_Byzantine_Musical_Symbols */
+
+/* 'In_Musical_Symbols': Block */
+static const OnigCodePoint CR_In_Musical_Symbols[] = {
+ 1,
+ 0x1d100, 0x1d1ff,
+}; /* CR_In_Musical_Symbols */
+
+/* 'In_Ancient_Greek_Musical_Notation': Block */
+static const OnigCodePoint CR_In_Ancient_Greek_Musical_Notation[] = {
+ 1,
+ 0x1d200, 0x1d24f,
+}; /* CR_In_Ancient_Greek_Musical_Notation */
+
+/* 'In_Tai_Xuan_Jing_Symbols': Block */
+static const OnigCodePoint CR_In_Tai_Xuan_Jing_Symbols[] = {
+ 1,
+ 0x1d300, 0x1d35f,
+}; /* CR_In_Tai_Xuan_Jing_Symbols */
+
+/* 'In_Counting_Rod_Numerals': Block */
+static const OnigCodePoint CR_In_Counting_Rod_Numerals[] = {
+ 1,
+ 0x1d360, 0x1d37f,
+}; /* CR_In_Counting_Rod_Numerals */
+
+/* 'In_Mathematical_Alphanumeric_Symbols': Block */
+static const OnigCodePoint CR_In_Mathematical_Alphanumeric_Symbols[] = {
+ 1,
+ 0x1d400, 0x1d7ff,
+}; /* CR_In_Mathematical_Alphanumeric_Symbols */
+
+/* 'In_Arabic_Mathematical_Alphabetic_Symbols': Block */
+static const OnigCodePoint CR_In_Arabic_Mathematical_Alphabetic_Symbols[] = {
+ 1,
+ 0x1ee00, 0x1eeff,
+}; /* CR_In_Arabic_Mathematical_Alphabetic_Symbols */
+
+/* 'In_Mahjong_Tiles': Block */
+static const OnigCodePoint CR_In_Mahjong_Tiles[] = {
+ 1,
+ 0x1f000, 0x1f02f,
+}; /* CR_In_Mahjong_Tiles */
+
+/* 'In_Domino_Tiles': Block */
+static const OnigCodePoint CR_In_Domino_Tiles[] = {
+ 1,
+ 0x1f030, 0x1f09f,
+}; /* CR_In_Domino_Tiles */
+
+/* 'In_Playing_Cards': Block */
+static const OnigCodePoint CR_In_Playing_Cards[] = {
+ 1,
+ 0x1f0a0, 0x1f0ff,
+}; /* CR_In_Playing_Cards */
+
+/* 'In_Enclosed_Alphanumeric_Supplement': Block */
+static const OnigCodePoint CR_In_Enclosed_Alphanumeric_Supplement[] = {
+ 1,
+ 0x1f100, 0x1f1ff,
+}; /* CR_In_Enclosed_Alphanumeric_Supplement */
+
+/* 'In_Enclosed_Ideographic_Supplement': Block */
+static const OnigCodePoint CR_In_Enclosed_Ideographic_Supplement[] = {
+ 1,
+ 0x1f200, 0x1f2ff,
+}; /* CR_In_Enclosed_Ideographic_Supplement */
+
+/* 'In_Miscellaneous_Symbols_And_Pictographs': Block */
+static const OnigCodePoint CR_In_Miscellaneous_Symbols_And_Pictographs[] = {
+ 1,
+ 0x1f300, 0x1f5ff,
+}; /* CR_In_Miscellaneous_Symbols_And_Pictographs */
+
+/* 'In_Emoticons': Block */
+static const OnigCodePoint CR_In_Emoticons[] = {
+ 1,
+ 0x1f600, 0x1f64f,
+}; /* CR_In_Emoticons */
+
+/* 'In_Transport_And_Map_Symbols': Block */
+static const OnigCodePoint CR_In_Transport_And_Map_Symbols[] = {
+ 1,
+ 0x1f680, 0x1f6ff,
+}; /* CR_In_Transport_And_Map_Symbols */
+
+/* 'In_Alchemical_Symbols': Block */
+static const OnigCodePoint CR_In_Alchemical_Symbols[] = {
+ 1,
+ 0x1f700, 0x1f77f,
+}; /* CR_In_Alchemical_Symbols */
+
+/* 'In_CJK_Unified_Ideographs_Extension_B': Block */
+static const OnigCodePoint CR_In_CJK_Unified_Ideographs_Extension_B[] = {
+ 1,
+ 0x20000, 0x2a6df,
+}; /* CR_In_CJK_Unified_Ideographs_Extension_B */
+
+/* 'In_CJK_Unified_Ideographs_Extension_C': Block */
+static const OnigCodePoint CR_In_CJK_Unified_Ideographs_Extension_C[] = {
+ 1,
+ 0x2a700, 0x2b73f,
+}; /* CR_In_CJK_Unified_Ideographs_Extension_C */
+
+/* 'In_CJK_Unified_Ideographs_Extension_D': Block */
+static const OnigCodePoint CR_In_CJK_Unified_Ideographs_Extension_D[] = {
+ 1,
+ 0x2b740, 0x2b81f,
+}; /* CR_In_CJK_Unified_Ideographs_Extension_D */
+
+/* 'In_CJK_Compatibility_Ideographs_Supplement': Block */
+static const OnigCodePoint CR_In_CJK_Compatibility_Ideographs_Supplement[] = {
+ 1,
+ 0x2f800, 0x2fa1f,
+}; /* CR_In_CJK_Compatibility_Ideographs_Supplement */
+
+/* 'In_Tags': Block */
+static const OnigCodePoint CR_In_Tags[] = {
+ 1,
+ 0xe0000, 0xe007f,
+}; /* CR_In_Tags */
+
+/* 'In_Variation_Selectors_Supplement': Block */
+static const OnigCodePoint CR_In_Variation_Selectors_Supplement[] = {
+ 1,
0xe0100, 0xe01ef,
-}; /* CR_Word */
+}; /* CR_In_Variation_Selectors_Supplement */
-/* 'Alnum': [[:Alnum:]] */
-static const OnigCodePoint CR_Alnum[] = {
- 509,
- 0x0030, 0x0039,
- 0x0041, 0x005a,
- 0x0061, 0x007a,
- 0x00aa, 0x00aa,
- 0x00b5, 0x00b5,
- 0x00ba, 0x00ba,
- 0x00c0, 0x00d6,
- 0x00d8, 0x00f6,
- 0x00f8, 0x02c1,
- 0x02c6, 0x02d1,
- 0x02e0, 0x02e4,
- 0x02ec, 0x02ec,
- 0x02ee, 0x02ee,
- 0x0345, 0x0345,
- 0x0370, 0x0374,
- 0x0376, 0x0377,
- 0x037a, 0x037d,
- 0x0386, 0x0386,
- 0x0388, 0x038a,
- 0x038c, 0x038c,
- 0x038e, 0x03a1,
- 0x03a3, 0x03f5,
- 0x03f7, 0x0481,
- 0x048a, 0x0527,
- 0x0531, 0x0556,
- 0x0559, 0x0559,
- 0x0561, 0x0587,
- 0x05b0, 0x05bd,
- 0x05bf, 0x05bf,
- 0x05c1, 0x05c2,
- 0x05c4, 0x05c5,
- 0x05c7, 0x05c7,
- 0x05d0, 0x05ea,
- 0x05f0, 0x05f2,
- 0x0610, 0x061a,
- 0x0620, 0x0657,
- 0x0659, 0x0669,
- 0x066e, 0x06d3,
- 0x06d5, 0x06dc,
- 0x06e1, 0x06e8,
- 0x06ed, 0x06fc,
- 0x06ff, 0x06ff,
- 0x0710, 0x073f,
- 0x074d, 0x07b1,
- 0x07c0, 0x07ea,
- 0x07f4, 0x07f5,
- 0x07fa, 0x07fa,
- 0x0800, 0x0817,
- 0x081a, 0x082c,
- 0x0840, 0x0858,
- 0x0900, 0x093b,
- 0x093d, 0x094c,
- 0x094e, 0x0950,
- 0x0955, 0x0963,
- 0x0966, 0x096f,
- 0x0971, 0x0977,
- 0x0979, 0x097f,
- 0x0981, 0x0983,
- 0x0985, 0x098c,
- 0x098f, 0x0990,
- 0x0993, 0x09a8,
- 0x09aa, 0x09b0,
- 0x09b2, 0x09b2,
- 0x09b6, 0x09b9,
- 0x09bd, 0x09c4,
- 0x09c7, 0x09c8,
- 0x09cb, 0x09cc,
- 0x09ce, 0x09ce,
- 0x09d7, 0x09d7,
- 0x09dc, 0x09dd,
- 0x09df, 0x09e3,
- 0x09e6, 0x09f1,
- 0x0a01, 0x0a03,
- 0x0a05, 0x0a0a,
- 0x0a0f, 0x0a10,
- 0x0a13, 0x0a28,
- 0x0a2a, 0x0a30,
- 0x0a32, 0x0a33,
- 0x0a35, 0x0a36,
- 0x0a38, 0x0a39,
- 0x0a3e, 0x0a42,
- 0x0a47, 0x0a48,
- 0x0a4b, 0x0a4c,
- 0x0a51, 0x0a51,
- 0x0a59, 0x0a5c,
- 0x0a5e, 0x0a5e,
- 0x0a66, 0x0a75,
- 0x0a81, 0x0a83,
- 0x0a85, 0x0a8d,
- 0x0a8f, 0x0a91,
- 0x0a93, 0x0aa8,
- 0x0aaa, 0x0ab0,
- 0x0ab2, 0x0ab3,
- 0x0ab5, 0x0ab9,
- 0x0abd, 0x0ac5,
- 0x0ac7, 0x0ac9,
- 0x0acb, 0x0acc,
- 0x0ad0, 0x0ad0,
- 0x0ae0, 0x0ae3,
- 0x0ae6, 0x0aef,
- 0x0b01, 0x0b03,
- 0x0b05, 0x0b0c,
- 0x0b0f, 0x0b10,
- 0x0b13, 0x0b28,
- 0x0b2a, 0x0b30,
- 0x0b32, 0x0b33,
- 0x0b35, 0x0b39,
- 0x0b3d, 0x0b44,
- 0x0b47, 0x0b48,
- 0x0b4b, 0x0b4c,
- 0x0b56, 0x0b57,
- 0x0b5c, 0x0b5d,
- 0x0b5f, 0x0b63,
- 0x0b66, 0x0b6f,
- 0x0b71, 0x0b71,
- 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, 0x0bcc,
- 0x0bd0, 0x0bd0,
- 0x0bd7, 0x0bd7,
- 0x0be6, 0x0bef,
- 0x0c01, 0x0c03,
- 0x0c05, 0x0c0c,
- 0x0c0e, 0x0c10,
- 0x0c12, 0x0c28,
- 0x0c2a, 0x0c33,
- 0x0c35, 0x0c39,
- 0x0c3d, 0x0c44,
- 0x0c46, 0x0c48,
- 0x0c4a, 0x0c4c,
- 0x0c55, 0x0c56,
- 0x0c58, 0x0c59,
- 0x0c60, 0x0c63,
- 0x0c66, 0x0c6f,
- 0x0c82, 0x0c83,
- 0x0c85, 0x0c8c,
- 0x0c8e, 0x0c90,
- 0x0c92, 0x0ca8,
- 0x0caa, 0x0cb3,
- 0x0cb5, 0x0cb9,
- 0x0cbd, 0x0cc4,
- 0x0cc6, 0x0cc8,
- 0x0cca, 0x0ccc,
- 0x0cd5, 0x0cd6,
- 0x0cde, 0x0cde,
- 0x0ce0, 0x0ce3,
- 0x0ce6, 0x0cef,
- 0x0cf1, 0x0cf2,
- 0x0d02, 0x0d03,
- 0x0d05, 0x0d0c,
- 0x0d0e, 0x0d10,
- 0x0d12, 0x0d3a,
- 0x0d3d, 0x0d44,
- 0x0d46, 0x0d48,
- 0x0d4a, 0x0d4c,
- 0x0d4e, 0x0d4e,
- 0x0d57, 0x0d57,
- 0x0d60, 0x0d63,
- 0x0d66, 0x0d6f,
- 0x0d7a, 0x0d7f,
- 0x0d82, 0x0d83,
- 0x0d85, 0x0d96,
- 0x0d9a, 0x0db1,
- 0x0db3, 0x0dbb,
- 0x0dbd, 0x0dbd,
- 0x0dc0, 0x0dc6,
- 0x0dcf, 0x0dd4,
- 0x0dd6, 0x0dd6,
- 0x0dd8, 0x0ddf,
- 0x0df2, 0x0df3,
- 0x0e01, 0x0e3a,
- 0x0e40, 0x0e46,
- 0x0e4d, 0x0e4d,
- 0x0e50, 0x0e59,
- 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,
- 0x0ecd, 0x0ecd,
- 0x0ed0, 0x0ed9,
- 0x0edc, 0x0edd,
- 0x0f00, 0x0f00,
- 0x0f20, 0x0f29,
- 0x0f40, 0x0f47,
- 0x0f49, 0x0f6c,
- 0x0f71, 0x0f81,
- 0x0f88, 0x0f97,
- 0x0f99, 0x0fbc,
- 0x1000, 0x1036,
- 0x1038, 0x1038,
- 0x103b, 0x1049,
- 0x1050, 0x1062,
- 0x1065, 0x1068,
- 0x106e, 0x1086,
- 0x108e, 0x108e,
- 0x1090, 0x1099,
- 0x109c, 0x109d,
- 0x10a0, 0x10c5,
- 0x10d0, 0x10fa,
- 0x10fc, 0x10fc,
- 0x1100, 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,
- 0x135f, 0x135f,
- 0x1380, 0x138f,
- 0x13a0, 0x13f4,
- 0x1401, 0x166c,
- 0x166f, 0x167f,
- 0x1681, 0x169a,
- 0x16a0, 0x16ea,
- 0x16ee, 0x16f0,
- 0x1700, 0x170c,
- 0x170e, 0x1713,
- 0x1720, 0x1733,
- 0x1740, 0x1753,
- 0x1760, 0x176c,
- 0x176e, 0x1770,
- 0x1772, 0x1773,
- 0x1780, 0x17b3,
- 0x17b6, 0x17c8,
- 0x17d7, 0x17d7,
- 0x17dc, 0x17dc,
- 0x17e0, 0x17e9,
- 0x1810, 0x1819,
- 0x1820, 0x1877,
- 0x1880, 0x18aa,
- 0x18b0, 0x18f5,
- 0x1900, 0x191c,
- 0x1920, 0x192b,
- 0x1930, 0x1938,
- 0x1946, 0x196d,
- 0x1970, 0x1974,
- 0x1980, 0x19ab,
- 0x19b0, 0x19c9,
- 0x19d0, 0x19d9,
- 0x1a00, 0x1a1b,
- 0x1a20, 0x1a5e,
- 0x1a61, 0x1a74,
- 0x1a80, 0x1a89,
- 0x1a90, 0x1a99,
- 0x1aa7, 0x1aa7,
- 0x1b00, 0x1b33,
- 0x1b35, 0x1b43,
- 0x1b45, 0x1b4b,
- 0x1b50, 0x1b59,
- 0x1b80, 0x1ba9,
- 0x1bae, 0x1bb9,
- 0x1bc0, 0x1be5,
- 0x1be7, 0x1bf1,
- 0x1c00, 0x1c35,
- 0x1c40, 0x1c49,
- 0x1c4d, 0x1c7d,
- 0x1ce9, 0x1cec,
- 0x1cee, 0x1cf2,
- 0x1d00, 0x1dbf,
- 0x1e00, 0x1f15,
- 0x1f18, 0x1f1d,
- 0x1f20, 0x1f45,
- 0x1f48, 0x1f4d,
- 0x1f50, 0x1f57,
- 0x1f59, 0x1f59,
- 0x1f5b, 0x1f5b,
- 0x1f5d, 0x1f5d,
- 0x1f5f, 0x1f7d,
- 0x1f80, 0x1fb4,
- 0x1fb6, 0x1fbc,
- 0x1fbe, 0x1fbe,
- 0x1fc2, 0x1fc4,
- 0x1fc6, 0x1fcc,
- 0x1fd0, 0x1fd3,
- 0x1fd6, 0x1fdb,
- 0x1fe0, 0x1fec,
- 0x1ff2, 0x1ff4,
- 0x1ff6, 0x1ffc,
- 0x2071, 0x2071,
- 0x207f, 0x207f,
- 0x2090, 0x209c,
- 0x2102, 0x2102,
- 0x2107, 0x2107,
- 0x210a, 0x2113,
- 0x2115, 0x2115,
- 0x2119, 0x211d,
- 0x2124, 0x2124,
- 0x2126, 0x2126,
- 0x2128, 0x2128,
- 0x212a, 0x212d,
- 0x212f, 0x2139,
- 0x213c, 0x213f,
- 0x2145, 0x2149,
- 0x214e, 0x214e,
- 0x2160, 0x2188,
- 0x24b6, 0x24e9,
- 0x2c00, 0x2c2e,
- 0x2c30, 0x2c5e,
- 0x2c60, 0x2ce4,
- 0x2ceb, 0x2cee,
- 0x2d00, 0x2d25,
- 0x2d30, 0x2d65,
- 0x2d6f, 0x2d6f,
- 0x2d80, 0x2d96,
- 0x2da0, 0x2da6,
- 0x2da8, 0x2dae,
- 0x2db0, 0x2db6,
- 0x2db8, 0x2dbe,
- 0x2dc0, 0x2dc6,
- 0x2dc8, 0x2dce,
- 0x2dd0, 0x2dd6,
- 0x2dd8, 0x2dde,
- 0x2de0, 0x2dff,
- 0x2e2f, 0x2e2f,
- 0x3005, 0x3007,
- 0x3021, 0x3029,
- 0x3031, 0x3035,
- 0x3038, 0x303c,
- 0x3041, 0x3096,
- 0x309d, 0x309f,
- 0x30a1, 0x30fa,
- 0x30fc, 0x30ff,
- 0x3105, 0x312d,
- 0x3131, 0x318e,
- 0x31a0, 0x31ba,
- 0x31f0, 0x31ff,
- 0x3400, 0x4db5,
- 0x4e00, 0x9fcb,
- 0xa000, 0xa48c,
- 0xa4d0, 0xa4fd,
- 0xa500, 0xa60c,
- 0xa610, 0xa62b,
- 0xa640, 0xa66e,
- 0xa67f, 0xa697,
- 0xa6a0, 0xa6ef,
- 0xa717, 0xa71f,
- 0xa722, 0xa788,
- 0xa78b, 0xa78e,
- 0xa790, 0xa791,
- 0xa7a0, 0xa7a9,
- 0xa7fa, 0xa801,
- 0xa803, 0xa805,
- 0xa807, 0xa80a,
- 0xa80c, 0xa827,
- 0xa840, 0xa873,
- 0xa880, 0xa8c3,
- 0xa8d0, 0xa8d9,
- 0xa8f2, 0xa8f7,
- 0xa8fb, 0xa8fb,
- 0xa900, 0xa92a,
- 0xa930, 0xa952,
- 0xa960, 0xa97c,
- 0xa980, 0xa9b2,
- 0xa9b4, 0xa9bf,
- 0xa9cf, 0xa9d9,
- 0xaa00, 0xaa36,
- 0xaa40, 0xaa4d,
- 0xaa50, 0xaa59,
- 0xaa60, 0xaa76,
- 0xaa7a, 0xaa7a,
- 0xaa80, 0xaabe,
- 0xaac0, 0xaac0,
- 0xaac2, 0xaac2,
- 0xaadb, 0xaadd,
- 0xab01, 0xab06,
- 0xab09, 0xab0e,
- 0xab11, 0xab16,
- 0xab20, 0xab26,
- 0xab28, 0xab2e,
- 0xabc0, 0xabea,
- 0xabf0, 0xabf9,
- 0xac00, 0xd7a3,
- 0xd7b0, 0xd7c6,
- 0xd7cb, 0xd7fb,
- 0xf900, 0xfa2d,
- 0xfa30, 0xfa6d,
- 0xfa70, 0xfad9,
- 0xfb00, 0xfb06,
- 0xfb13, 0xfb17,
- 0xfb1d, 0xfb28,
- 0xfb2a, 0xfb36,
- 0xfb38, 0xfb3c,
- 0xfb3e, 0xfb3e,
- 0xfb40, 0xfb41,
- 0xfb43, 0xfb44,
- 0xfb46, 0xfbb1,
- 0xfbd3, 0xfd3d,
- 0xfd50, 0xfd8f,
- 0xfd92, 0xfdc7,
- 0xfdf0, 0xfdfb,
- 0xfe70, 0xfe74,
- 0xfe76, 0xfefc,
- 0xff10, 0xff19,
- 0xff21, 0xff3a,
- 0xff41, 0xff5a,
- 0xff66, 0xffbe,
- 0xffc2, 0xffc7,
- 0xffca, 0xffcf,
- 0xffd2, 0xffd7,
- 0xffda, 0xffdc,
- 0x10000, 0x1000b,
- 0x1000d, 0x10026,
- 0x10028, 0x1003a,
- 0x1003c, 0x1003d,
- 0x1003f, 0x1004d,
- 0x10050, 0x1005d,
- 0x10080, 0x100fa,
- 0x10140, 0x10174,
- 0x10280, 0x1029c,
- 0x102a0, 0x102d0,
- 0x10300, 0x1031e,
- 0x10330, 0x1034a,
- 0x10380, 0x1039d,
- 0x103a0, 0x103c3,
- 0x103c8, 0x103cf,
- 0x103d1, 0x103d5,
- 0x10400, 0x1049d,
- 0x104a0, 0x104a9,
- 0x10800, 0x10805,
- 0x10808, 0x10808,
- 0x1080a, 0x10835,
- 0x10837, 0x10838,
- 0x1083c, 0x1083c,
- 0x1083f, 0x10855,
- 0x10900, 0x10915,
- 0x10920, 0x10939,
- 0x10a00, 0x10a03,
- 0x10a05, 0x10a06,
- 0x10a0c, 0x10a13,
- 0x10a15, 0x10a17,
- 0x10a19, 0x10a33,
- 0x10a60, 0x10a7c,
- 0x10b00, 0x10b35,
- 0x10b40, 0x10b55,
- 0x10b60, 0x10b72,
- 0x10c00, 0x10c48,
- 0x11000, 0x11045,
- 0x11066, 0x1106f,
- 0x11082, 0x110b8,
- 0x12000, 0x1236e,
- 0x12400, 0x12462,
- 0x13000, 0x1342e,
- 0x16800, 0x16a38,
- 0x1b000, 0x1b001,
- 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, 0x1d6c0,
- 0x1d6c2, 0x1d6da,
- 0x1d6dc, 0x1d6fa,
- 0x1d6fc, 0x1d714,
- 0x1d716, 0x1d734,
- 0x1d736, 0x1d74e,
- 0x1d750, 0x1d76e,
- 0x1d770, 0x1d788,
- 0x1d78a, 0x1d7a8,
- 0x1d7aa, 0x1d7c2,
- 0x1d7c4, 0x1d7cb,
- 0x1d7ce, 0x1d7ff,
- 0x20000, 0x2a6d6,
- 0x2a700, 0x2b734,
- 0x2b740, 0x2b81d,
- 0x2f800, 0x2fa1d,
-}; /* CR_Alnum */
+/* 'In_Supplementary_Private_Use_Area_A': Block */
+static const OnigCodePoint CR_In_Supplementary_Private_Use_Area_A[] = {
+ 1,
+ 0xf0000, 0xfffff,
+}; /* CR_In_Supplementary_Private_Use_Area_A */
-/* 'ASCII': [[:ASCII:]] */
-static const OnigCodePoint CR_ASCII[] = {
+/* 'In_Supplementary_Private_Use_Area_B': Block */
+static const OnigCodePoint CR_In_Supplementary_Private_Use_Area_B[] = {
1,
- 0x0000, 0x007f,
-}; /* CR_ASCII */
+ 0x100000, 0x10ffff,
+}; /* CR_In_Supplementary_Private_Use_Area_B */
+
+/* 'In_No_Block': Block */
+static const OnigCodePoint CR_In_No_Block[] = {
+ 36,
+ 0x0860, 0x089f,
+ 0x1ab0, 0x1aff,
+ 0x1c80, 0x1cbf,
+ 0x2fe0, 0x2fef,
+ 0xa9e0, 0xa9ff,
+ 0xab30, 0xabbf,
+ 0x10200, 0x1027f,
+ 0x102e0, 0x102ff,
+ 0x10350, 0x1037f,
+ 0x103e0, 0x103ff,
+ 0x104b0, 0x107ff,
+ 0x10860, 0x108ff,
+ 0x10940, 0x1097f,
+ 0x10a80, 0x10aff,
+ 0x10b80, 0x10bff,
+ 0x10c50, 0x10e5f,
+ 0x10e80, 0x10fff,
+ 0x11150, 0x1117f,
+ 0x111e0, 0x1167f,
+ 0x116d0, 0x11fff,
+ 0x12480, 0x12fff,
+ 0x13430, 0x167ff,
+ 0x16a40, 0x16eff,
+ 0x16fa0, 0x1afff,
+ 0x1b100, 0x1cfff,
+ 0x1d250, 0x1d2ff,
+ 0x1d380, 0x1d3ff,
+ 0x1d800, 0x1edff,
+ 0x1ef00, 0x1efff,
+ 0x1f650, 0x1f67f,
+ 0x1f780, 0x1ffff,
+ 0x2a6e0, 0x2a6ff,
+ 0x2b820, 0x2f7ff,
+ 0x2fa20, 0xdffff,
+ 0xe0080, 0xe00ff,
+ 0xe01f0, 0xeffff,
+}; /* CR_In_No_Block */
+#endif /* USE_UNICODE_PROPERTIES */
static const OnigCodePoint* const CodeRanges[] = {
CR_NEWLINE,
@@ -21945,6 +25484,7 @@ static const OnigCodePoint* const CodeRanges[] = {
CR_Co,
CR_Cs,
CR_L,
+ CR_LC,
CR_Ll,
CR_Lm,
CR_Lo,
@@ -22089,6 +25629,13 @@ static const OnigCodePoint* const CodeRanges[] = {
CR_Batak,
CR_Brahmi,
CR_Mandaic,
+ CR_Chakma,
+ CR_Meroitic_Cursive,
+ CR_Meroitic_Hieroglyphs,
+ CR_Miao,
+ CR_Sharada,
+ CR_Sora_Sompeng,
+ CR_Takri,
CR_White_Space,
CR_Bidi_Control,
CR_Join_Control,
@@ -22134,6 +25681,228 @@ static const OnigCodePoint* const CodeRanges[] = {
CR_Age_5_1,
CR_Age_5_2,
CR_Age_6_0,
+ CR_Age_6_1,
+ CR_In_Basic_Latin,
+ CR_In_Latin_1_Supplement,
+ CR_In_Latin_Extended_A,
+ CR_In_Latin_Extended_B,
+ CR_In_IPA_Extensions,
+ CR_In_Spacing_Modifier_Letters,
+ CR_In_Combining_Diacritical_Marks,
+ CR_In_Greek_and_Coptic,
+ CR_In_Cyrillic,
+ CR_In_Cyrillic_Supplement,
+ CR_In_Armenian,
+ CR_In_Hebrew,
+ CR_In_Arabic,
+ CR_In_Syriac,
+ CR_In_Arabic_Supplement,
+ CR_In_Thaana,
+ CR_In_NKo,
+ CR_In_Samaritan,
+ CR_In_Mandaic,
+ CR_In_Arabic_Extended_A,
+ CR_In_Devanagari,
+ CR_In_Bengali,
+ CR_In_Gurmukhi,
+ CR_In_Gujarati,
+ CR_In_Oriya,
+ CR_In_Tamil,
+ CR_In_Telugu,
+ CR_In_Kannada,
+ CR_In_Malayalam,
+ CR_In_Sinhala,
+ CR_In_Thai,
+ CR_In_Lao,
+ CR_In_Tibetan,
+ CR_In_Myanmar,
+ CR_In_Georgian,
+ CR_In_Hangul_Jamo,
+ CR_In_Ethiopic,
+ CR_In_Ethiopic_Supplement,
+ CR_In_Cherokee,
+ CR_In_Unified_Canadian_Aboriginal_Syllabics,
+ CR_In_Ogham,
+ CR_In_Runic,
+ CR_In_Tagalog,
+ CR_In_Hanunoo,
+ CR_In_Buhid,
+ CR_In_Tagbanwa,
+ CR_In_Khmer,
+ CR_In_Mongolian,
+ CR_In_Unified_Canadian_Aboriginal_Syllabics_Extended,
+ CR_In_Limbu,
+ CR_In_Tai_Le,
+ CR_In_New_Tai_Lue,
+ CR_In_Khmer_Symbols,
+ CR_In_Buginese,
+ CR_In_Tai_Tham,
+ CR_In_Balinese,
+ CR_In_Sundanese,
+ CR_In_Batak,
+ CR_In_Lepcha,
+ CR_In_Ol_Chiki,
+ CR_In_Sundanese_Supplement,
+ CR_In_Vedic_Extensions,
+ CR_In_Phonetic_Extensions,
+ CR_In_Phonetic_Extensions_Supplement,
+ CR_In_Combining_Diacritical_Marks_Supplement,
+ CR_In_Latin_Extended_Additional,
+ CR_In_Greek_Extended,
+ CR_In_General_Punctuation,
+ CR_In_Superscripts_and_Subscripts,
+ CR_In_Currency_Symbols,
+ CR_In_Combining_Diacritical_Marks_for_Symbols,
+ CR_In_Letterlike_Symbols,
+ CR_In_Number_Forms,
+ CR_In_Arrows,
+ CR_In_Mathematical_Operators,
+ CR_In_Miscellaneous_Technical,
+ CR_In_Control_Pictures,
+ CR_In_Optical_Character_Recognition,
+ CR_In_Enclosed_Alphanumerics,
+ CR_In_Box_Drawing,
+ CR_In_Block_Elements,
+ CR_In_Geometric_Shapes,
+ CR_In_Miscellaneous_Symbols,
+ CR_In_Dingbats,
+ CR_In_Miscellaneous_Mathematical_Symbols_A,
+ CR_In_Supplemental_Arrows_A,
+ CR_In_Braille_Patterns,
+ CR_In_Supplemental_Arrows_B,
+ CR_In_Miscellaneous_Mathematical_Symbols_B,
+ CR_In_Supplemental_Mathematical_Operators,
+ CR_In_Miscellaneous_Symbols_and_Arrows,
+ CR_In_Glagolitic,
+ CR_In_Latin_Extended_C,
+ CR_In_Coptic,
+ CR_In_Georgian_Supplement,
+ CR_In_Tifinagh,
+ CR_In_Ethiopic_Extended,
+ CR_In_Cyrillic_Extended_A,
+ CR_In_Supplemental_Punctuation,
+ CR_In_CJK_Radicals_Supplement,
+ CR_In_Kangxi_Radicals,
+ CR_In_Ideographic_Description_Characters,
+ CR_In_CJK_Symbols_and_Punctuation,
+ CR_In_Hiragana,
+ CR_In_Katakana,
+ CR_In_Bopomofo,
+ CR_In_Hangul_Compatibility_Jamo,
+ CR_In_Kanbun,
+ CR_In_Bopomofo_Extended,
+ CR_In_CJK_Strokes,
+ CR_In_Katakana_Phonetic_Extensions,
+ CR_In_Enclosed_CJK_Letters_and_Months,
+ CR_In_CJK_Compatibility,
+ CR_In_CJK_Unified_Ideographs_Extension_A,
+ CR_In_Yijing_Hexagram_Symbols,
+ CR_In_CJK_Unified_Ideographs,
+ CR_In_Yi_Syllables,
+ CR_In_Yi_Radicals,
+ CR_In_Lisu,
+ CR_In_Vai,
+ CR_In_Cyrillic_Extended_B,
+ CR_In_Bamum,
+ CR_In_Modifier_Tone_Letters,
+ CR_In_Latin_Extended_D,
+ CR_In_Syloti_Nagri,
+ CR_In_Common_Indic_Number_Forms,
+ CR_In_Phags_pa,
+ CR_In_Saurashtra,
+ CR_In_Devanagari_Extended,
+ CR_In_Kayah_Li,
+ CR_In_Rejang,
+ CR_In_Hangul_Jamo_Extended_A,
+ CR_In_Javanese,
+ CR_In_Cham,
+ CR_In_Myanmar_Extended_A,
+ CR_In_Tai_Viet,
+ CR_In_Meetei_Mayek_Extensions,
+ CR_In_Ethiopic_Extended_A,
+ CR_In_Meetei_Mayek,
+ CR_In_Hangul_Syllables,
+ CR_In_Hangul_Jamo_Extended_B,
+ CR_In_High_Surrogates,
+ CR_In_High_Private_Use_Surrogates,
+ CR_In_Low_Surrogates,
+ CR_In_Private_Use_Area,
+ CR_In_CJK_Compatibility_Ideographs,
+ CR_In_Alphabetic_Presentation_Forms,
+ CR_In_Arabic_Presentation_Forms_A,
+ CR_In_Variation_Selectors,
+ CR_In_Vertical_Forms,
+ CR_In_Combining_Half_Marks,
+ CR_In_CJK_Compatibility_Forms,
+ CR_In_Small_Form_Variants,
+ CR_In_Arabic_Presentation_Forms_B,
+ CR_In_Halfwidth_and_Fullwidth_Forms,
+ CR_In_Specials,
+ CR_In_Linear_B_Syllabary,
+ CR_In_Linear_B_Ideograms,
+ CR_In_Aegean_Numbers,
+ CR_In_Ancient_Greek_Numbers,
+ CR_In_Ancient_Symbols,
+ CR_In_Phaistos_Disc,
+ CR_In_Lycian,
+ CR_In_Carian,
+ CR_In_Old_Italic,
+ CR_In_Gothic,
+ CR_In_Ugaritic,
+ CR_In_Old_Persian,
+ CR_In_Deseret,
+ CR_In_Shavian,
+ CR_In_Osmanya,
+ CR_In_Cypriot_Syllabary,
+ CR_In_Imperial_Aramaic,
+ CR_In_Phoenician,
+ CR_In_Lydian,
+ CR_In_Meroitic_Hieroglyphs,
+ CR_In_Meroitic_Cursive,
+ CR_In_Kharoshthi,
+ CR_In_Old_South_Arabian,
+ CR_In_Avestan,
+ CR_In_Inscriptional_Parthian,
+ CR_In_Inscriptional_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_Sharada,
+ CR_In_Takri,
+ CR_In_Cuneiform,
+ CR_In_Cuneiform_Numbers_and_Punctuation,
+ CR_In_Egyptian_Hieroglyphs,
+ CR_In_Bamum_Supplement,
+ CR_In_Miao,
+ CR_In_Kana_Supplement,
+ 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_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_Emoticons,
+ CR_In_Transport_And_Map_Symbols,
+ CR_In_Alchemical_Symbols,
+ CR_In_CJK_Unified_Ideographs_Extension_B,
+ CR_In_CJK_Unified_Ideographs_Extension_C,
+ CR_In_CJK_Unified_Ideographs_Extension_D,
+ CR_In_CJK_Compatibility_Ideographs_Supplement,
+ CR_In_Tags,
+ CR_In_Variation_Selectors_Supplement,
+ CR_In_Supplementary_Private_Use_Area_A,
+ CR_In_Supplementary_Private_Use_Area_B,
+ CR_In_No_Block,
#endif /* USE_UNICODE_PROPERTIES */
};
struct uniname2ctype_struct {
@@ -22144,7 +25913,6 @@ static const struct uniname2ctype_struct *uniname2ctype_p(const char *, unsigned
%}
struct uniname2ctype_struct;
%%
-newline, 0
alpha, 1
blank, 2
cntrl, 3
@@ -22169,225 +25937,233 @@ cn, 20
co, 21
cs, 22
l, 23
-ll, 24
-lm, 25
-lo, 26
-lt, 27
-lu, 28
-m, 29
-mc, 30
-me, 31
-mn, 32
-n, 33
-nd, 34
-nl, 35
-no, 36
-p, 37
-pc, 38
-pd, 39
-pe, 40
-pf, 41
-pi, 42
-po, 43
-ps, 44
-s, 45
-sc, 46
-sk, 47
-sm, 48
-so, 49
-z, 50
-zl, 51
-zp, 52
-zs, 53
-math, 54
-alphabetic, 55
-lowercase, 56
-uppercase, 57
-cased, 58
-caseignorable, 59
-changeswhenlowercased, 60
-changeswhenuppercased, 61
-changeswhentitlecased, 62
-changeswhencasefolded, 63
-changeswhencasemapped, 64
-idstart, 65
-idcontinue, 66
-xidstart, 67
-xidcontinue, 68
-defaultignorablecodepoint, 69
-graphemeextend, 70
-graphemebase, 71
-graphemelink, 72
-common, 73
-latin, 74
-greek, 75
-cyrillic, 76
-armenian, 77
-hebrew, 78
-arabic, 79
-syriac, 80
-thaana, 81
-devanagari, 82
-bengali, 83
-gurmukhi, 84
-gujarati, 85
-oriya, 86
-tamil, 87
-telugu, 88
-kannada, 89
-malayalam, 90
-sinhala, 91
-thai, 92
-lao, 93
-tibetan, 94
-myanmar, 95
-georgian, 96
-hangul, 97
-ethiopic, 98
-cherokee, 99
-canadianaboriginal, 100
-ogham, 101
-runic, 102
-khmer, 103
-mongolian, 104
-hiragana, 105
-katakana, 106
-bopomofo, 107
-han, 108
-yi, 109
-olditalic, 110
-gothic, 111
-deseret, 112
-inherited, 113
-tagalog, 114
-hanunoo, 115
-buhid, 116
-tagbanwa, 117
-limbu, 118
-taile, 119
-linearb, 120
-ugaritic, 121
-shavian, 122
-osmanya, 123
-cypriot, 124
-braille, 125
-buginese, 126
-coptic, 127
-newtailue, 128
-glagolitic, 129
-tifinagh, 130
-sylotinagri, 131
-oldpersian, 132
-kharoshthi, 133
-balinese, 134
-cuneiform, 135
-phoenician, 136
-phagspa, 137
-nko, 138
-sundanese, 139
-lepcha, 140
-olchiki, 141
-vai, 142
-saurashtra, 143
-kayahli, 144
-rejang, 145
-lycian, 146
-carian, 147
-lydian, 148
-cham, 149
-taitham, 150
-taiviet, 151
-avestan, 152
-egyptianhieroglyphs, 153
-samaritan, 154
-lisu, 155
-bamum, 156
-javanese, 157
-meeteimayek, 158
-imperialaramaic, 159
-oldsoutharabian, 160
-inscriptionalparthian, 161
-inscriptionalpahlavi, 162
-oldturkic, 163
-kaithi, 164
-batak, 165
-brahmi, 166
-mandaic, 167
-whitespace, 168
-bidicontrol, 169
-joincontrol, 170
-dash, 171
-hyphen, 172
-quotationmark, 173
-terminalpunctuation, 174
-othermath, 175
-hexdigit, 176
-asciihexdigit, 177
-otheralphabetic, 178
-ideographic, 179
-diacritic, 180
-extender, 181
-otherlowercase, 182
-otheruppercase, 183
-noncharactercodepoint, 184
-othergraphemeextend, 185
-idsbinaryoperator, 186
-idstrinaryoperator, 187
-radical, 188
-unifiedideograph, 189
-otherdefaultignorablecodepoint, 190
-deprecated, 191
-softdotted, 192
-logicalorderexception, 193
-otheridstart, 194
-otheridcontinue, 195
-sterm, 196
-variationselector, 197
-patternwhitespace, 198
-patternsyntax, 199
-unknown, 200
-ahex, 177
-bidic, 169
-ci, 59
-cwcf, 63
-cwcm, 64
-cwl, 60
-cwt, 62
-cwu, 61
-dep, 191
-di, 69
-dia, 180
-ext, 181
-grbase, 71
-grext, 70
-grlink, 72
-hex, 176
-idc, 66
-ideo, 179
-ids, 65
-idsb, 186
-idst, 187
-joinc, 170
-loe, 193
-nchar, 184
-oalpha, 178
-odi, 190
-ogrext, 185
-oidc, 195
-oids, 194
-olower, 182
-omath, 175
-oupper, 183
-patsyn, 199
-patws, 198
-qmark, 173
-sd, 192
-term, 174
-uideo, 189
-vs, 197
-wspace, 168
-xidc, 68
-xids, 67
+lc, 24
+ll, 25
+lm, 26
+lo, 27
+lt, 28
+lu, 29
+m, 30
+mc, 31
+me, 32
+mn, 33
+n, 34
+nd, 35
+nl, 36
+no, 37
+p, 38
+pc, 39
+pd, 40
+pe, 41
+pf, 42
+pi, 43
+po, 44
+ps, 45
+s, 46
+sc, 47
+sk, 48
+sm, 49
+so, 50
+z, 51
+zl, 52
+zp, 53
+zs, 54
+math, 55
+alphabetic, 56
+lowercase, 57
+uppercase, 58
+cased, 59
+caseignorable, 60
+changeswhenlowercased, 61
+changeswhenuppercased, 62
+changeswhentitlecased, 63
+changeswhencasefolded, 64
+changeswhencasemapped, 65
+idstart, 66
+idcontinue, 67
+xidstart, 68
+xidcontinue, 69
+defaultignorablecodepoint, 70
+graphemeextend, 71
+graphemebase, 72
+graphemelink, 73
+common, 74
+latin, 75
+greek, 76
+cyrillic, 77
+armenian, 78
+hebrew, 79
+arabic, 80
+syriac, 81
+thaana, 82
+devanagari, 83
+bengali, 84
+gurmukhi, 85
+gujarati, 86
+oriya, 87
+tamil, 88
+telugu, 89
+kannada, 90
+malayalam, 91
+sinhala, 92
+thai, 93
+lao, 94
+tibetan, 95
+myanmar, 96
+georgian, 97
+hangul, 98
+ethiopic, 99
+cherokee, 100
+canadianaboriginal, 101
+ogham, 102
+runic, 103
+khmer, 104
+mongolian, 105
+hiragana, 106
+katakana, 107
+bopomofo, 108
+han, 109
+yi, 110
+olditalic, 111
+gothic, 112
+deseret, 113
+inherited, 114
+tagalog, 115
+hanunoo, 116
+buhid, 117
+tagbanwa, 118
+limbu, 119
+taile, 120
+linearb, 121
+ugaritic, 122
+shavian, 123
+osmanya, 124
+cypriot, 125
+braille, 126
+buginese, 127
+coptic, 128
+newtailue, 129
+glagolitic, 130
+tifinagh, 131
+sylotinagri, 132
+oldpersian, 133
+kharoshthi, 134
+balinese, 135
+cuneiform, 136
+phoenician, 137
+phagspa, 138
+nko, 139
+sundanese, 140
+lepcha, 141
+olchiki, 142
+vai, 143
+saurashtra, 144
+kayahli, 145
+rejang, 146
+lycian, 147
+carian, 148
+lydian, 149
+cham, 150
+taitham, 151
+taiviet, 152
+avestan, 153
+egyptianhieroglyphs, 154
+samaritan, 155
+lisu, 156
+bamum, 157
+javanese, 158
+meeteimayek, 159
+imperialaramaic, 160
+oldsoutharabian, 161
+inscriptionalparthian, 162
+inscriptionalpahlavi, 163
+oldturkic, 164
+kaithi, 165
+batak, 166
+brahmi, 167
+mandaic, 168
+chakma, 169
+meroiticcursive, 170
+meroitichieroglyphs, 171
+miao, 172
+sharada, 173
+sorasompeng, 174
+takri, 175
+whitespace, 176
+bidicontrol, 177
+joincontrol, 178
+dash, 179
+hyphen, 180
+quotationmark, 181
+terminalpunctuation, 182
+othermath, 183
+hexdigit, 184
+asciihexdigit, 185
+otheralphabetic, 186
+ideographic, 187
+diacritic, 188
+extender, 189
+otherlowercase, 190
+otheruppercase, 191
+noncharactercodepoint, 192
+othergraphemeextend, 193
+idsbinaryoperator, 194
+idstrinaryoperator, 195
+radical, 196
+unifiedideograph, 197
+otherdefaultignorablecodepoint, 198
+deprecated, 199
+softdotted, 200
+logicalorderexception, 201
+otheridstart, 202
+otheridcontinue, 203
+sterm, 204
+variationselector, 205
+patternwhitespace, 206
+patternsyntax, 207
+unknown, 208
+ahex, 185
+bidic, 177
+ci, 60
+cwcf, 64
+cwcm, 65
+cwl, 61
+cwt, 63
+cwu, 62
+dep, 199
+di, 70
+dia, 188
+ext, 189
+grbase, 72
+grext, 71
+grlink, 73
+hex, 184
+idc, 67
+ideo, 187
+ids, 66
+idsb, 194
+idst, 195
+joinc, 178
+loe, 201
+nchar, 192
+oalpha, 186
+odi, 198
+ogrext, 193
+oidc, 203
+oids, 202
+olower, 190
+omath, 183
+oupper, 191
+patsyn, 207
+patws, 206
+qmark, 181
+sd, 200
+term, 182
+uideo, 197
+vs, 205
+wspace, 176
+xidc, 69
+xids, 68
other, 17
control, 18
format, 19
@@ -22395,143 +26171,374 @@ unassigned, 20
privateuse, 21
surrogate, 22
letter, 23
-lowercaseletter, 24
-modifierletter, 25
-otherletter, 26
-titlecaseletter, 27
-uppercaseletter, 28
-mark, 29
-spacingmark, 30
-enclosingmark, 31
-nonspacingmark, 32
-number, 33
-decimalnumber, 34
-letternumber, 35
-othernumber, 36
-punctuation, 37
-connectorpunctuation, 38
-dashpunctuation, 39
-closepunctuation, 40
-finalpunctuation, 41
-initialpunctuation, 42
-otherpunctuation, 43
-openpunctuation, 44
-symbol, 45
-currencysymbol, 46
-modifiersymbol, 47
-mathsymbol, 48
-othersymbol, 49
-separator, 50
-lineseparator, 51
-paragraphseparator, 52
-spaceseparator, 53
-arab, 79
-armi, 159
-armn, 77
-avst, 152
-bali, 134
-bamu, 156
-batk, 165
-beng, 83
-bopo, 107
-brah, 166
-brai, 125
-bugi, 126
-buhd, 116
-cans, 100
-cari, 147
-cher, 99
-copt, 127
-qaac, 127
-cprt, 124
-cyrl, 76
-deva, 82
-dsrt, 112
-egyp, 153
-ethi, 98
-geor, 96
-glag, 129
-goth, 111
-grek, 75
-gujr, 85
-guru, 84
-hang, 97
-hani, 108
-hano, 115
-hebr, 78
-hira, 105
-ital, 110
-java, 157
-kali, 144
-kana, 106
-khar, 133
-khmr, 103
-knda, 89
-kthi, 164
-lana, 150
-laoo, 93
-latn, 74
-lepc, 140
-limb, 118
-linb, 120
-lyci, 146
-lydi, 148
-mand, 167
-mlym, 90
-mong, 104
-mtei, 158
-mymr, 95
-nkoo, 138
-ogam, 101
-olck, 141
-orkh, 163
-orya, 86
-osma, 123
-phag, 137
-phli, 162
-phnx, 136
-prti, 161
-rjng, 145
-runr, 102
-samr, 154
-sarb, 160
-saur, 143
-shaw, 122
-sinh, 91
-sund, 139
-sylo, 131
-syrc, 80
-tagb, 117
-tale, 119
-talu, 128
-taml, 87
-tavt, 151
-telu, 88
-tfng, 130
-tglg, 114
-thaa, 81
-tibt, 94
-ugar, 121
-vaii, 142
-xpeo, 132
-xsux, 135
-yiii, 109
-zinh, 113
-qaai, 113
-zyyy, 73
-zzzz, 200
-age=1.1, 201
-age=2.0, 202
-age=2.1, 203
-age=3.0, 204
-age=3.1, 205
-age=3.2, 206
-age=4.0, 207
-age=4.1, 208
-age=5.0, 209
-age=5.1, 210
-age=5.2, 211
-age=6.0, 212
+casedletter, 24
+lowercaseletter, 25
+modifierletter, 26
+otherletter, 27
+titlecaseletter, 28
+uppercaseletter, 29
+mark, 30
+combiningmark, 30
+spacingmark, 31
+enclosingmark, 32
+nonspacingmark, 33
+number, 34
+decimalnumber, 35
+letternumber, 36
+othernumber, 37
+punctuation, 38
+connectorpunctuation, 39
+dashpunctuation, 40
+closepunctuation, 41
+finalpunctuation, 42
+initialpunctuation, 43
+otherpunctuation, 44
+openpunctuation, 45
+symbol, 46
+currencysymbol, 47
+modifiersymbol, 48
+mathsymbol, 49
+othersymbol, 50
+separator, 51
+lineseparator, 52
+paragraphseparator, 53
+spaceseparator, 54
+arab, 80
+armi, 160
+armn, 78
+avst, 153
+bali, 135
+bamu, 157
+batk, 166
+beng, 84
+bopo, 108
+brah, 167
+brai, 126
+bugi, 127
+buhd, 117
+cakm, 169
+cans, 101
+cari, 148
+cher, 100
+copt, 128
+qaac, 128
+cprt, 125
+cyrl, 77
+deva, 83
+dsrt, 113
+egyp, 154
+ethi, 99
+geor, 97
+glag, 130
+goth, 112
+grek, 76
+gujr, 86
+guru, 85
+hang, 98
+hani, 109
+hano, 116
+hebr, 79
+hira, 106
+ital, 111
+java, 158
+kali, 145
+kana, 107
+khar, 134
+khmr, 104
+knda, 90
+kthi, 165
+lana, 151
+laoo, 94
+latn, 75
+lepc, 141
+limb, 119
+linb, 121
+lyci, 147
+lydi, 149
+mand, 168
+merc, 170
+mero, 171
+mlym, 91
+mong, 105
+mtei, 159
+mymr, 96
+nkoo, 139
+ogam, 102
+olck, 142
+orkh, 164
+orya, 87
+osma, 124
+phag, 138
+phli, 163
+phnx, 137
+plrd, 172
+prti, 162
+rjng, 146
+runr, 103
+samr, 155
+sarb, 161
+saur, 144
+shaw, 123
+shrd, 173
+sinh, 92
+sora, 174
+sund, 140
+sylo, 132
+syrc, 81
+tagb, 118
+takr, 175
+tale, 120
+talu, 129
+taml, 88
+tavt, 152
+telu, 89
+tfng, 131
+tglg, 115
+thaa, 82
+tibt, 95
+ugar, 122
+vaii, 143
+xpeo, 133
+xsux, 136
+yiii, 110
+zinh, 114
+qaai, 114
+zyyy, 74
+zzzz, 208
+age=1.1, 209
+age=2.0, 210
+age=2.1, 211
+age=3.0, 212
+age=3.1, 213
+age=3.2, 214
+age=4.0, 215
+age=4.1, 216
+age=5.0, 217
+age=5.1, 218
+age=5.2, 219
+age=6.0, 220
+age=6.1, 221
+inbasiclatin, 222
+inlatin1supplement, 223
+inlatinextendeda, 224
+inlatinextendedb, 225
+inipaextensions, 226
+inspacingmodifierletters, 227
+incombiningdiacriticalmarks, 228
+ingreekandcoptic, 229
+incyrillic, 230
+incyrillicsupplement, 231
+inarmenian, 232
+inhebrew, 233
+inarabic, 234
+insyriac, 235
+inarabicsupplement, 236
+inthaana, 237
+innko, 238
+insamaritan, 239
+inmandaic, 240
+inarabicextendeda, 241
+indevanagari, 242
+inbengali, 243
+ingurmukhi, 244
+ingujarati, 245
+inoriya, 246
+intamil, 247
+intelugu, 248
+inkannada, 249
+inmalayalam, 250
+insinhala, 251
+inthai, 252
+inlao, 253
+intibetan, 254
+inmyanmar, 255
+ingeorgian, 256
+inhanguljamo, 257
+inethiopic, 258
+inethiopicsupplement, 259
+incherokee, 260
+inunifiedcanadianaboriginalsyllabics, 261
+inogham, 262
+inrunic, 263
+intagalog, 264
+inhanunoo, 265
+inbuhid, 266
+intagbanwa, 267
+inkhmer, 268
+inmongolian, 269
+inunifiedcanadianaboriginalsyllabicsextended, 270
+inlimbu, 271
+intaile, 272
+innewtailue, 273
+inkhmersymbols, 274
+inbuginese, 275
+intaitham, 276
+inbalinese, 277
+insundanese, 278
+inbatak, 279
+inlepcha, 280
+inolchiki, 281
+insundanesesupplement, 282
+invedicextensions, 283
+inphoneticextensions, 284
+inphoneticextensionssupplement, 285
+incombiningdiacriticalmarkssupplement, 286
+inlatinextendedadditional, 287
+ingreekextended, 288
+ingeneralpunctuation, 289
+insuperscriptsandsubscripts, 290
+incurrencysymbols, 291
+incombiningdiacriticalmarksforsymbols, 292
+inletterlikesymbols, 293
+innumberforms, 294
+inarrows, 295
+inmathematicaloperators, 296
+inmiscellaneoustechnical, 297
+incontrolpictures, 298
+inopticalcharacterrecognition, 299
+inenclosedalphanumerics, 300
+inboxdrawing, 301
+inblockelements, 302
+ingeometricshapes, 303
+inmiscellaneoussymbols, 304
+indingbats, 305
+inmiscellaneousmathematicalsymbolsa, 306
+insupplementalarrowsa, 307
+inbraillepatterns, 308
+insupplementalarrowsb, 309
+inmiscellaneousmathematicalsymbolsb, 310
+insupplementalmathematicaloperators, 311
+inmiscellaneoussymbolsandarrows, 312
+inglagolitic, 313
+inlatinextendedc, 314
+incoptic, 315
+ingeorgiansupplement, 316
+intifinagh, 317
+inethiopicextended, 318
+incyrillicextendeda, 319
+insupplementalpunctuation, 320
+incjkradicalssupplement, 321
+inkangxiradicals, 322
+inideographicdescriptioncharacters, 323
+incjksymbolsandpunctuation, 324
+inhiragana, 325
+inkatakana, 326
+inbopomofo, 327
+inhangulcompatibilityjamo, 328
+inkanbun, 329
+inbopomofoextended, 330
+incjkstrokes, 331
+inkatakanaphoneticextensions, 332
+inenclosedcjklettersandmonths, 333
+incjkcompatibility, 334
+incjkunifiedideographsextensiona, 335
+inyijinghexagramsymbols, 336
+incjkunifiedideographs, 337
+inyisyllables, 338
+inyiradicals, 339
+inlisu, 340
+invai, 341
+incyrillicextendedb, 342
+inbamum, 343
+inmodifiertoneletters, 344
+inlatinextendedd, 345
+insylotinagri, 346
+incommonindicnumberforms, 347
+inphagspa, 348
+insaurashtra, 349
+indevanagariextended, 350
+inkayahli, 351
+inrejang, 352
+inhanguljamoextendeda, 353
+injavanese, 354
+incham, 355
+inmyanmarextendeda, 356
+intaiviet, 357
+inmeeteimayekextensions, 358
+inethiopicextendeda, 359
+inmeeteimayek, 360
+inhangulsyllables, 361
+inhanguljamoextendedb, 362
+inhighsurrogates, 363
+inhighprivateusesurrogates, 364
+inlowsurrogates, 365
+inprivateusearea, 366
+incjkcompatibilityideographs, 367
+inalphabeticpresentationforms, 368
+inarabicpresentationformsa, 369
+invariationselectors, 370
+inverticalforms, 371
+incombininghalfmarks, 372
+incjkcompatibilityforms, 373
+insmallformvariants, 374
+inarabicpresentationformsb, 375
+inhalfwidthandfullwidthforms, 376
+inspecials, 377
+inlinearbsyllabary, 378
+inlinearbideograms, 379
+inaegeannumbers, 380
+inancientgreeknumbers, 381
+inancientsymbols, 382
+inphaistosdisc, 383
+inlycian, 384
+incarian, 385
+inolditalic, 386
+ingothic, 387
+inugaritic, 388
+inoldpersian, 389
+indeseret, 390
+inshavian, 391
+inosmanya, 392
+incypriotsyllabary, 393
+inimperialaramaic, 394
+inphoenician, 395
+inlydian, 396
+inmeroitichieroglyphs, 397
+inmeroiticcursive, 398
+inkharoshthi, 399
+inoldsoutharabian, 400
+inavestan, 401
+ininscriptionalparthian, 402
+ininscriptionalpahlavi, 403
+inoldturkic, 404
+inruminumeralsymbols, 405
+inbrahmi, 406
+inkaithi, 407
+insorasompeng, 408
+inchakma, 409
+insharada, 410
+intakri, 411
+incuneiform, 412
+incuneiformnumbersandpunctuation, 413
+inegyptianhieroglyphs, 414
+inbamumsupplement, 415
+inmiao, 416
+inkanasupplement, 417
+inbyzantinemusicalsymbols, 418
+inmusicalsymbols, 419
+inancientgreekmusicalnotation, 420
+intaixuanjingsymbols, 421
+incountingrodnumerals, 422
+inmathematicalalphanumericsymbols, 423
+inarabicmathematicalalphabeticsymbols, 424
+inmahjongtiles, 425
+indominotiles, 426
+inplayingcards, 427
+inenclosedalphanumericsupplement, 428
+inenclosedideographicsupplement, 429
+inmiscellaneoussymbolsandpictographs, 430
+inemoticons, 431
+intransportandmapsymbols, 432
+inalchemicalsymbols, 433
+incjkunifiedideographsextensionb, 434
+incjkunifiedideographsextensionc, 435
+incjkunifiedideographsextensiond, 436
+incjkcompatibilityideographssupplement, 437
+intags, 438
+invariationselectorssupplement, 439
+insupplementaryprivateuseareaa, 440
+insupplementaryprivateuseareab, 441
+innoblock, 442
#endif /* USE_UNICODE_PROPERTIES */
%%
static int
diff --git a/enc/unicode/name2ctype.src b/enc/unicode/name2ctype.src
index 2e27f3f7de..ff94d68b3b 100644
--- a/enc/unicode/name2ctype.src
+++ b/enc/unicode/name2ctype.src
@@ -1,6 +1,4273 @@
%{
#define long size_t
+/* 'NEWLINE': [[:NEWLINE:]] */
+static const OnigCodePoint CR_NEWLINE[] = {
+ 1,
+ 0x000a, 0x000a,
+}; /* CR_NEWLINE */
+
+/* 'Alpha': [[:Alpha:]] */
+static const OnigCodePoint CR_Alpha[] = {
+ 540,
+ 0x0041, 0x005a,
+ 0x0061, 0x007a,
+ 0x00aa, 0x00aa,
+ 0x00b5, 0x00b5,
+ 0x00ba, 0x00ba,
+ 0x00c0, 0x00d6,
+ 0x00d8, 0x00f6,
+ 0x00f8, 0x02c1,
+ 0x02c6, 0x02d1,
+ 0x02e0, 0x02e4,
+ 0x02ec, 0x02ec,
+ 0x02ee, 0x02ee,
+ 0x0345, 0x0345,
+ 0x0370, 0x0374,
+ 0x0376, 0x0377,
+ 0x037a, 0x037d,
+ 0x0386, 0x0386,
+ 0x0388, 0x038a,
+ 0x038c, 0x038c,
+ 0x038e, 0x03a1,
+ 0x03a3, 0x03f5,
+ 0x03f7, 0x0481,
+ 0x048a, 0x0527,
+ 0x0531, 0x0556,
+ 0x0559, 0x0559,
+ 0x0561, 0x0587,
+ 0x05b0, 0x05bd,
+ 0x05bf, 0x05bf,
+ 0x05c1, 0x05c2,
+ 0x05c4, 0x05c5,
+ 0x05c7, 0x05c7,
+ 0x05d0, 0x05ea,
+ 0x05f0, 0x05f2,
+ 0x0610, 0x061a,
+ 0x0620, 0x0657,
+ 0x0659, 0x065f,
+ 0x066e, 0x06d3,
+ 0x06d5, 0x06dc,
+ 0x06e1, 0x06e8,
+ 0x06ed, 0x06ef,
+ 0x06fa, 0x06fc,
+ 0x06ff, 0x06ff,
+ 0x0710, 0x073f,
+ 0x074d, 0x07b1,
+ 0x07ca, 0x07ea,
+ 0x07f4, 0x07f5,
+ 0x07fa, 0x07fa,
+ 0x0800, 0x0817,
+ 0x081a, 0x082c,
+ 0x0840, 0x0858,
+ 0x08a0, 0x08a0,
+ 0x08a2, 0x08ac,
+ 0x08e4, 0x08e9,
+ 0x08f0, 0x08fe,
+ 0x0900, 0x093b,
+ 0x093d, 0x094c,
+ 0x094e, 0x0950,
+ 0x0955, 0x0963,
+ 0x0971, 0x0977,
+ 0x0979, 0x097f,
+ 0x0981, 0x0983,
+ 0x0985, 0x098c,
+ 0x098f, 0x0990,
+ 0x0993, 0x09a8,
+ 0x09aa, 0x09b0,
+ 0x09b2, 0x09b2,
+ 0x09b6, 0x09b9,
+ 0x09bd, 0x09c4,
+ 0x09c7, 0x09c8,
+ 0x09cb, 0x09cc,
+ 0x09ce, 0x09ce,
+ 0x09d7, 0x09d7,
+ 0x09dc, 0x09dd,
+ 0x09df, 0x09e3,
+ 0x09f0, 0x09f1,
+ 0x0a01, 0x0a03,
+ 0x0a05, 0x0a0a,
+ 0x0a0f, 0x0a10,
+ 0x0a13, 0x0a28,
+ 0x0a2a, 0x0a30,
+ 0x0a32, 0x0a33,
+ 0x0a35, 0x0a36,
+ 0x0a38, 0x0a39,
+ 0x0a3e, 0x0a42,
+ 0x0a47, 0x0a48,
+ 0x0a4b, 0x0a4c,
+ 0x0a51, 0x0a51,
+ 0x0a59, 0x0a5c,
+ 0x0a5e, 0x0a5e,
+ 0x0a70, 0x0a75,
+ 0x0a81, 0x0a83,
+ 0x0a85, 0x0a8d,
+ 0x0a8f, 0x0a91,
+ 0x0a93, 0x0aa8,
+ 0x0aaa, 0x0ab0,
+ 0x0ab2, 0x0ab3,
+ 0x0ab5, 0x0ab9,
+ 0x0abd, 0x0ac5,
+ 0x0ac7, 0x0ac9,
+ 0x0acb, 0x0acc,
+ 0x0ad0, 0x0ad0,
+ 0x0ae0, 0x0ae3,
+ 0x0b01, 0x0b03,
+ 0x0b05, 0x0b0c,
+ 0x0b0f, 0x0b10,
+ 0x0b13, 0x0b28,
+ 0x0b2a, 0x0b30,
+ 0x0b32, 0x0b33,
+ 0x0b35, 0x0b39,
+ 0x0b3d, 0x0b44,
+ 0x0b47, 0x0b48,
+ 0x0b4b, 0x0b4c,
+ 0x0b56, 0x0b57,
+ 0x0b5c, 0x0b5d,
+ 0x0b5f, 0x0b63,
+ 0x0b71, 0x0b71,
+ 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, 0x0bcc,
+ 0x0bd0, 0x0bd0,
+ 0x0bd7, 0x0bd7,
+ 0x0c01, 0x0c03,
+ 0x0c05, 0x0c0c,
+ 0x0c0e, 0x0c10,
+ 0x0c12, 0x0c28,
+ 0x0c2a, 0x0c33,
+ 0x0c35, 0x0c39,
+ 0x0c3d, 0x0c44,
+ 0x0c46, 0x0c48,
+ 0x0c4a, 0x0c4c,
+ 0x0c55, 0x0c56,
+ 0x0c58, 0x0c59,
+ 0x0c60, 0x0c63,
+ 0x0c82, 0x0c83,
+ 0x0c85, 0x0c8c,
+ 0x0c8e, 0x0c90,
+ 0x0c92, 0x0ca8,
+ 0x0caa, 0x0cb3,
+ 0x0cb5, 0x0cb9,
+ 0x0cbd, 0x0cc4,
+ 0x0cc6, 0x0cc8,
+ 0x0cca, 0x0ccc,
+ 0x0cd5, 0x0cd6,
+ 0x0cde, 0x0cde,
+ 0x0ce0, 0x0ce3,
+ 0x0cf1, 0x0cf2,
+ 0x0d02, 0x0d03,
+ 0x0d05, 0x0d0c,
+ 0x0d0e, 0x0d10,
+ 0x0d12, 0x0d3a,
+ 0x0d3d, 0x0d44,
+ 0x0d46, 0x0d48,
+ 0x0d4a, 0x0d4c,
+ 0x0d4e, 0x0d4e,
+ 0x0d57, 0x0d57,
+ 0x0d60, 0x0d63,
+ 0x0d7a, 0x0d7f,
+ 0x0d82, 0x0d83,
+ 0x0d85, 0x0d96,
+ 0x0d9a, 0x0db1,
+ 0x0db3, 0x0dbb,
+ 0x0dbd, 0x0dbd,
+ 0x0dc0, 0x0dc6,
+ 0x0dcf, 0x0dd4,
+ 0x0dd6, 0x0dd6,
+ 0x0dd8, 0x0ddf,
+ 0x0df2, 0x0df3,
+ 0x0e01, 0x0e3a,
+ 0x0e40, 0x0e46,
+ 0x0e4d, 0x0e4d,
+ 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,
+ 0x0ecd, 0x0ecd,
+ 0x0edc, 0x0edf,
+ 0x0f00, 0x0f00,
+ 0x0f40, 0x0f47,
+ 0x0f49, 0x0f6c,
+ 0x0f71, 0x0f81,
+ 0x0f88, 0x0f97,
+ 0x0f99, 0x0fbc,
+ 0x1000, 0x1036,
+ 0x1038, 0x1038,
+ 0x103b, 0x103f,
+ 0x1050, 0x1062,
+ 0x1065, 0x1068,
+ 0x106e, 0x1086,
+ 0x108e, 0x108e,
+ 0x109c, 0x109d,
+ 0x10a0, 0x10c5,
+ 0x10c7, 0x10c7,
+ 0x10cd, 0x10cd,
+ 0x10d0, 0x10fa,
+ 0x10fc, 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,
+ 0x135f, 0x135f,
+ 0x1380, 0x138f,
+ 0x13a0, 0x13f4,
+ 0x1401, 0x166c,
+ 0x166f, 0x167f,
+ 0x1681, 0x169a,
+ 0x16a0, 0x16ea,
+ 0x16ee, 0x16f0,
+ 0x1700, 0x170c,
+ 0x170e, 0x1713,
+ 0x1720, 0x1733,
+ 0x1740, 0x1753,
+ 0x1760, 0x176c,
+ 0x176e, 0x1770,
+ 0x1772, 0x1773,
+ 0x1780, 0x17b3,
+ 0x17b6, 0x17c8,
+ 0x17d7, 0x17d7,
+ 0x17dc, 0x17dc,
+ 0x1820, 0x1877,
+ 0x1880, 0x18aa,
+ 0x18b0, 0x18f5,
+ 0x1900, 0x191c,
+ 0x1920, 0x192b,
+ 0x1930, 0x1938,
+ 0x1950, 0x196d,
+ 0x1970, 0x1974,
+ 0x1980, 0x19ab,
+ 0x19b0, 0x19c9,
+ 0x1a00, 0x1a1b,
+ 0x1a20, 0x1a5e,
+ 0x1a61, 0x1a74,
+ 0x1aa7, 0x1aa7,
+ 0x1b00, 0x1b33,
+ 0x1b35, 0x1b43,
+ 0x1b45, 0x1b4b,
+ 0x1b80, 0x1ba9,
+ 0x1bac, 0x1baf,
+ 0x1bba, 0x1be5,
+ 0x1be7, 0x1bf1,
+ 0x1c00, 0x1c35,
+ 0x1c4d, 0x1c4f,
+ 0x1c5a, 0x1c7d,
+ 0x1ce9, 0x1cec,
+ 0x1cee, 0x1cf3,
+ 0x1cf5, 0x1cf6,
+ 0x1d00, 0x1dbf,
+ 0x1e00, 0x1f15,
+ 0x1f18, 0x1f1d,
+ 0x1f20, 0x1f45,
+ 0x1f48, 0x1f4d,
+ 0x1f50, 0x1f57,
+ 0x1f59, 0x1f59,
+ 0x1f5b, 0x1f5b,
+ 0x1f5d, 0x1f5d,
+ 0x1f5f, 0x1f7d,
+ 0x1f80, 0x1fb4,
+ 0x1fb6, 0x1fbc,
+ 0x1fbe, 0x1fbe,
+ 0x1fc2, 0x1fc4,
+ 0x1fc6, 0x1fcc,
+ 0x1fd0, 0x1fd3,
+ 0x1fd6, 0x1fdb,
+ 0x1fe0, 0x1fec,
+ 0x1ff2, 0x1ff4,
+ 0x1ff6, 0x1ffc,
+ 0x2071, 0x2071,
+ 0x207f, 0x207f,
+ 0x2090, 0x209c,
+ 0x2102, 0x2102,
+ 0x2107, 0x2107,
+ 0x210a, 0x2113,
+ 0x2115, 0x2115,
+ 0x2119, 0x211d,
+ 0x2124, 0x2124,
+ 0x2126, 0x2126,
+ 0x2128, 0x2128,
+ 0x212a, 0x212d,
+ 0x212f, 0x2139,
+ 0x213c, 0x213f,
+ 0x2145, 0x2149,
+ 0x214e, 0x214e,
+ 0x2160, 0x2188,
+ 0x24b6, 0x24e9,
+ 0x2c00, 0x2c2e,
+ 0x2c30, 0x2c5e,
+ 0x2c60, 0x2ce4,
+ 0x2ceb, 0x2cee,
+ 0x2cf2, 0x2cf3,
+ 0x2d00, 0x2d25,
+ 0x2d27, 0x2d27,
+ 0x2d2d, 0x2d2d,
+ 0x2d30, 0x2d67,
+ 0x2d6f, 0x2d6f,
+ 0x2d80, 0x2d96,
+ 0x2da0, 0x2da6,
+ 0x2da8, 0x2dae,
+ 0x2db0, 0x2db6,
+ 0x2db8, 0x2dbe,
+ 0x2dc0, 0x2dc6,
+ 0x2dc8, 0x2dce,
+ 0x2dd0, 0x2dd6,
+ 0x2dd8, 0x2dde,
+ 0x2de0, 0x2dff,
+ 0x2e2f, 0x2e2f,
+ 0x3005, 0x3007,
+ 0x3021, 0x3029,
+ 0x3031, 0x3035,
+ 0x3038, 0x303c,
+ 0x3041, 0x3096,
+ 0x309d, 0x309f,
+ 0x30a1, 0x30fa,
+ 0x30fc, 0x30ff,
+ 0x3105, 0x312d,
+ 0x3131, 0x318e,
+ 0x31a0, 0x31ba,
+ 0x31f0, 0x31ff,
+ 0x3400, 0x4db5,
+ 0x4e00, 0x9fcc,
+ 0xa000, 0xa48c,
+ 0xa4d0, 0xa4fd,
+ 0xa500, 0xa60c,
+ 0xa610, 0xa61f,
+ 0xa62a, 0xa62b,
+ 0xa640, 0xa66e,
+ 0xa674, 0xa67b,
+ 0xa67f, 0xa697,
+ 0xa69f, 0xa6ef,
+ 0xa717, 0xa71f,
+ 0xa722, 0xa788,
+ 0xa78b, 0xa78e,
+ 0xa790, 0xa793,
+ 0xa7a0, 0xa7aa,
+ 0xa7f8, 0xa801,
+ 0xa803, 0xa805,
+ 0xa807, 0xa80a,
+ 0xa80c, 0xa827,
+ 0xa840, 0xa873,
+ 0xa880, 0xa8c3,
+ 0xa8f2, 0xa8f7,
+ 0xa8fb, 0xa8fb,
+ 0xa90a, 0xa92a,
+ 0xa930, 0xa952,
+ 0xa960, 0xa97c,
+ 0xa980, 0xa9b2,
+ 0xa9b4, 0xa9bf,
+ 0xa9cf, 0xa9cf,
+ 0xaa00, 0xaa36,
+ 0xaa40, 0xaa4d,
+ 0xaa60, 0xaa76,
+ 0xaa7a, 0xaa7a,
+ 0xaa80, 0xaabe,
+ 0xaac0, 0xaac0,
+ 0xaac2, 0xaac2,
+ 0xaadb, 0xaadd,
+ 0xaae0, 0xaaef,
+ 0xaaf2, 0xaaf5,
+ 0xab01, 0xab06,
+ 0xab09, 0xab0e,
+ 0xab11, 0xab16,
+ 0xab20, 0xab26,
+ 0xab28, 0xab2e,
+ 0xabc0, 0xabea,
+ 0xac00, 0xd7a3,
+ 0xd7b0, 0xd7c6,
+ 0xd7cb, 0xd7fb,
+ 0xf900, 0xfa6d,
+ 0xfa70, 0xfad9,
+ 0xfb00, 0xfb06,
+ 0xfb13, 0xfb17,
+ 0xfb1d, 0xfb28,
+ 0xfb2a, 0xfb36,
+ 0xfb38, 0xfb3c,
+ 0xfb3e, 0xfb3e,
+ 0xfb40, 0xfb41,
+ 0xfb43, 0xfb44,
+ 0xfb46, 0xfbb1,
+ 0xfbd3, 0xfd3d,
+ 0xfd50, 0xfd8f,
+ 0xfd92, 0xfdc7,
+ 0xfdf0, 0xfdfb,
+ 0xfe70, 0xfe74,
+ 0xfe76, 0xfefc,
+ 0xff21, 0xff3a,
+ 0xff41, 0xff5a,
+ 0xff66, 0xffbe,
+ 0xffc2, 0xffc7,
+ 0xffca, 0xffcf,
+ 0xffd2, 0xffd7,
+ 0xffda, 0xffdc,
+ 0x10000, 0x1000b,
+ 0x1000d, 0x10026,
+ 0x10028, 0x1003a,
+ 0x1003c, 0x1003d,
+ 0x1003f, 0x1004d,
+ 0x10050, 0x1005d,
+ 0x10080, 0x100fa,
+ 0x10140, 0x10174,
+ 0x10280, 0x1029c,
+ 0x102a0, 0x102d0,
+ 0x10300, 0x1031e,
+ 0x10330, 0x1034a,
+ 0x10380, 0x1039d,
+ 0x103a0, 0x103c3,
+ 0x103c8, 0x103cf,
+ 0x103d1, 0x103d5,
+ 0x10400, 0x1049d,
+ 0x10800, 0x10805,
+ 0x10808, 0x10808,
+ 0x1080a, 0x10835,
+ 0x10837, 0x10838,
+ 0x1083c, 0x1083c,
+ 0x1083f, 0x10855,
+ 0x10900, 0x10915,
+ 0x10920, 0x10939,
+ 0x10980, 0x109b7,
+ 0x109be, 0x109bf,
+ 0x10a00, 0x10a03,
+ 0x10a05, 0x10a06,
+ 0x10a0c, 0x10a13,
+ 0x10a15, 0x10a17,
+ 0x10a19, 0x10a33,
+ 0x10a60, 0x10a7c,
+ 0x10b00, 0x10b35,
+ 0x10b40, 0x10b55,
+ 0x10b60, 0x10b72,
+ 0x10c00, 0x10c48,
+ 0x11000, 0x11045,
+ 0x11082, 0x110b8,
+ 0x110d0, 0x110e8,
+ 0x11100, 0x11132,
+ 0x11180, 0x111bf,
+ 0x111c1, 0x111c4,
+ 0x11680, 0x116b5,
+ 0x12000, 0x1236e,
+ 0x12400, 0x12462,
+ 0x13000, 0x1342e,
+ 0x16800, 0x16a38,
+ 0x16f00, 0x16f44,
+ 0x16f50, 0x16f7e,
+ 0x16f93, 0x16f9f,
+ 0x1b000, 0x1b001,
+ 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, 0x1d6c0,
+ 0x1d6c2, 0x1d6da,
+ 0x1d6dc, 0x1d6fa,
+ 0x1d6fc, 0x1d714,
+ 0x1d716, 0x1d734,
+ 0x1d736, 0x1d74e,
+ 0x1d750, 0x1d76e,
+ 0x1d770, 0x1d788,
+ 0x1d78a, 0x1d7a8,
+ 0x1d7aa, 0x1d7c2,
+ 0x1d7c4, 0x1d7cb,
+ 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,
+ 0x20000, 0x2a6d6,
+ 0x2a700, 0x2b734,
+ 0x2b740, 0x2b81d,
+ 0x2f800, 0x2fa1d,
+}; /* CR_Alpha */
+
+/* 'Blank': [[:Blank:]] */
+static const OnigCodePoint CR_Blank[] = {
+ 9,
+ 0x0009, 0x0009,
+ 0x0020, 0x0020,
+ 0x00a0, 0x00a0,
+ 0x1680, 0x1680,
+ 0x180e, 0x180e,
+ 0x2000, 0x200a,
+ 0x202f, 0x202f,
+ 0x205f, 0x205f,
+ 0x3000, 0x3000,
+}; /* CR_Blank */
+
+/* 'Cntrl': [[:Cntrl:]] */
+static const OnigCodePoint CR_Cntrl[] = {
+ 2,
+ 0x0000, 0x001f,
+ 0x007f, 0x009f,
+}; /* CR_Cntrl */
+
+/* 'Digit': [[:Digit:]] */
+static const OnigCodePoint CR_Digit[] = {
+ 42,
+ 0x0030, 0x0039,
+ 0x0660, 0x0669,
+ 0x06f0, 0x06f9,
+ 0x07c0, 0x07c9,
+ 0x0966, 0x096f,
+ 0x09e6, 0x09ef,
+ 0x0a66, 0x0a6f,
+ 0x0ae6, 0x0aef,
+ 0x0b66, 0x0b6f,
+ 0x0be6, 0x0bef,
+ 0x0c66, 0x0c6f,
+ 0x0ce6, 0x0cef,
+ 0x0d66, 0x0d6f,
+ 0x0e50, 0x0e59,
+ 0x0ed0, 0x0ed9,
+ 0x0f20, 0x0f29,
+ 0x1040, 0x1049,
+ 0x1090, 0x1099,
+ 0x17e0, 0x17e9,
+ 0x1810, 0x1819,
+ 0x1946, 0x194f,
+ 0x19d0, 0x19d9,
+ 0x1a80, 0x1a89,
+ 0x1a90, 0x1a99,
+ 0x1b50, 0x1b59,
+ 0x1bb0, 0x1bb9,
+ 0x1c40, 0x1c49,
+ 0x1c50, 0x1c59,
+ 0xa620, 0xa629,
+ 0xa8d0, 0xa8d9,
+ 0xa900, 0xa909,
+ 0xa9d0, 0xa9d9,
+ 0xaa50, 0xaa59,
+ 0xabf0, 0xabf9,
+ 0xff10, 0xff19,
+ 0x104a0, 0x104a9,
+ 0x11066, 0x1106f,
+ 0x110f0, 0x110f9,
+ 0x11136, 0x1113f,
+ 0x111d0, 0x111d9,
+ 0x116c0, 0x116c9,
+ 0x1d7ce, 0x1d7ff,
+}; /* CR_Digit */
+
+/* 'Graph': [[:Graph:]] */
+static const OnigCodePoint CR_Graph[] = {
+ 544,
+ 0x0021, 0x007e,
+ 0x00a1, 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, 0x167f,
+ 0x1681, 0x169c,
+ 0x16a0, 0x16f0,
+ 0x1700, 0x170c,
+ 0x170e, 0x1714,
+ 0x1720, 0x1736,
+ 0x1740, 0x1753,
+ 0x1760, 0x176c,
+ 0x176e, 0x1770,
+ 0x1772, 0x1773,
+ 0x1780, 0x17dd,
+ 0x17e0, 0x17e9,
+ 0x17f0, 0x17f9,
+ 0x1800, 0x180d,
+ 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,
+ 0x200b, 0x2027,
+ 0x202a, 0x202e,
+ 0x2030, 0x205e,
+ 0x2060, 0x2064,
+ 0x206a, 0x2071,
+ 0x2074, 0x208e,
+ 0x2090, 0x209c,
+ 0x20a0, 0x20b9,
+ 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,
+ 0x3001, 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,
+ 0xe000, 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,
+ 0xfdf0, 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, 0xfffd,
+ 0x10000, 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,
+ 0x20000, 0x2a6d6,
+ 0x2a700, 0x2b734,
+ 0x2b740, 0x2b81d,
+ 0x2f800, 0x2fa1d,
+ 0xe0001, 0xe0001,
+ 0xe0020, 0xe007f,
+ 0xe0100, 0xe01ef,
+ 0xf0000, 0xffffd,
+ 0x100000, 0x10fffd,
+}; /* CR_Graph */
+
+/* 'Lower': [[:Lower:]] */
+static const OnigCodePoint CR_Lower[] = {
+ 618,
+ 0x0061, 0x007a,
+ 0x00aa, 0x00aa,
+ 0x00b5, 0x00b5,
+ 0x00ba, 0x00ba,
+ 0x00df, 0x00f6,
+ 0x00f8, 0x00ff,
+ 0x0101, 0x0101,
+ 0x0103, 0x0103,
+ 0x0105, 0x0105,
+ 0x0107, 0x0107,
+ 0x0109, 0x0109,
+ 0x010b, 0x010b,
+ 0x010d, 0x010d,
+ 0x010f, 0x010f,
+ 0x0111, 0x0111,
+ 0x0113, 0x0113,
+ 0x0115, 0x0115,
+ 0x0117, 0x0117,
+ 0x0119, 0x0119,
+ 0x011b, 0x011b,
+ 0x011d, 0x011d,
+ 0x011f, 0x011f,
+ 0x0121, 0x0121,
+ 0x0123, 0x0123,
+ 0x0125, 0x0125,
+ 0x0127, 0x0127,
+ 0x0129, 0x0129,
+ 0x012b, 0x012b,
+ 0x012d, 0x012d,
+ 0x012f, 0x012f,
+ 0x0131, 0x0131,
+ 0x0133, 0x0133,
+ 0x0135, 0x0135,
+ 0x0137, 0x0138,
+ 0x013a, 0x013a,
+ 0x013c, 0x013c,
+ 0x013e, 0x013e,
+ 0x0140, 0x0140,
+ 0x0142, 0x0142,
+ 0x0144, 0x0144,
+ 0x0146, 0x0146,
+ 0x0148, 0x0149,
+ 0x014b, 0x014b,
+ 0x014d, 0x014d,
+ 0x014f, 0x014f,
+ 0x0151, 0x0151,
+ 0x0153, 0x0153,
+ 0x0155, 0x0155,
+ 0x0157, 0x0157,
+ 0x0159, 0x0159,
+ 0x015b, 0x015b,
+ 0x015d, 0x015d,
+ 0x015f, 0x015f,
+ 0x0161, 0x0161,
+ 0x0163, 0x0163,
+ 0x0165, 0x0165,
+ 0x0167, 0x0167,
+ 0x0169, 0x0169,
+ 0x016b, 0x016b,
+ 0x016d, 0x016d,
+ 0x016f, 0x016f,
+ 0x0171, 0x0171,
+ 0x0173, 0x0173,
+ 0x0175, 0x0175,
+ 0x0177, 0x0177,
+ 0x017a, 0x017a,
+ 0x017c, 0x017c,
+ 0x017e, 0x0180,
+ 0x0183, 0x0183,
+ 0x0185, 0x0185,
+ 0x0188, 0x0188,
+ 0x018c, 0x018d,
+ 0x0192, 0x0192,
+ 0x0195, 0x0195,
+ 0x0199, 0x019b,
+ 0x019e, 0x019e,
+ 0x01a1, 0x01a1,
+ 0x01a3, 0x01a3,
+ 0x01a5, 0x01a5,
+ 0x01a8, 0x01a8,
+ 0x01aa, 0x01ab,
+ 0x01ad, 0x01ad,
+ 0x01b0, 0x01b0,
+ 0x01b4, 0x01b4,
+ 0x01b6, 0x01b6,
+ 0x01b9, 0x01ba,
+ 0x01bd, 0x01bf,
+ 0x01c6, 0x01c6,
+ 0x01c9, 0x01c9,
+ 0x01cc, 0x01cc,
+ 0x01ce, 0x01ce,
+ 0x01d0, 0x01d0,
+ 0x01d2, 0x01d2,
+ 0x01d4, 0x01d4,
+ 0x01d6, 0x01d6,
+ 0x01d8, 0x01d8,
+ 0x01da, 0x01da,
+ 0x01dc, 0x01dd,
+ 0x01df, 0x01df,
+ 0x01e1, 0x01e1,
+ 0x01e3, 0x01e3,
+ 0x01e5, 0x01e5,
+ 0x01e7, 0x01e7,
+ 0x01e9, 0x01e9,
+ 0x01eb, 0x01eb,
+ 0x01ed, 0x01ed,
+ 0x01ef, 0x01f0,
+ 0x01f3, 0x01f3,
+ 0x01f5, 0x01f5,
+ 0x01f9, 0x01f9,
+ 0x01fb, 0x01fb,
+ 0x01fd, 0x01fd,
+ 0x01ff, 0x01ff,
+ 0x0201, 0x0201,
+ 0x0203, 0x0203,
+ 0x0205, 0x0205,
+ 0x0207, 0x0207,
+ 0x0209, 0x0209,
+ 0x020b, 0x020b,
+ 0x020d, 0x020d,
+ 0x020f, 0x020f,
+ 0x0211, 0x0211,
+ 0x0213, 0x0213,
+ 0x0215, 0x0215,
+ 0x0217, 0x0217,
+ 0x0219, 0x0219,
+ 0x021b, 0x021b,
+ 0x021d, 0x021d,
+ 0x021f, 0x021f,
+ 0x0221, 0x0221,
+ 0x0223, 0x0223,
+ 0x0225, 0x0225,
+ 0x0227, 0x0227,
+ 0x0229, 0x0229,
+ 0x022b, 0x022b,
+ 0x022d, 0x022d,
+ 0x022f, 0x022f,
+ 0x0231, 0x0231,
+ 0x0233, 0x0239,
+ 0x023c, 0x023c,
+ 0x023f, 0x0240,
+ 0x0242, 0x0242,
+ 0x0247, 0x0247,
+ 0x0249, 0x0249,
+ 0x024b, 0x024b,
+ 0x024d, 0x024d,
+ 0x024f, 0x0293,
+ 0x0295, 0x02b8,
+ 0x02c0, 0x02c1,
+ 0x02e0, 0x02e4,
+ 0x0345, 0x0345,
+ 0x0371, 0x0371,
+ 0x0373, 0x0373,
+ 0x0377, 0x0377,
+ 0x037a, 0x037d,
+ 0x0390, 0x0390,
+ 0x03ac, 0x03ce,
+ 0x03d0, 0x03d1,
+ 0x03d5, 0x03d7,
+ 0x03d9, 0x03d9,
+ 0x03db, 0x03db,
+ 0x03dd, 0x03dd,
+ 0x03df, 0x03df,
+ 0x03e1, 0x03e1,
+ 0x03e3, 0x03e3,
+ 0x03e5, 0x03e5,
+ 0x03e7, 0x03e7,
+ 0x03e9, 0x03e9,
+ 0x03eb, 0x03eb,
+ 0x03ed, 0x03ed,
+ 0x03ef, 0x03f3,
+ 0x03f5, 0x03f5,
+ 0x03f8, 0x03f8,
+ 0x03fb, 0x03fc,
+ 0x0430, 0x045f,
+ 0x0461, 0x0461,
+ 0x0463, 0x0463,
+ 0x0465, 0x0465,
+ 0x0467, 0x0467,
+ 0x0469, 0x0469,
+ 0x046b, 0x046b,
+ 0x046d, 0x046d,
+ 0x046f, 0x046f,
+ 0x0471, 0x0471,
+ 0x0473, 0x0473,
+ 0x0475, 0x0475,
+ 0x0477, 0x0477,
+ 0x0479, 0x0479,
+ 0x047b, 0x047b,
+ 0x047d, 0x047d,
+ 0x047f, 0x047f,
+ 0x0481, 0x0481,
+ 0x048b, 0x048b,
+ 0x048d, 0x048d,
+ 0x048f, 0x048f,
+ 0x0491, 0x0491,
+ 0x0493, 0x0493,
+ 0x0495, 0x0495,
+ 0x0497, 0x0497,
+ 0x0499, 0x0499,
+ 0x049b, 0x049b,
+ 0x049d, 0x049d,
+ 0x049f, 0x049f,
+ 0x04a1, 0x04a1,
+ 0x04a3, 0x04a3,
+ 0x04a5, 0x04a5,
+ 0x04a7, 0x04a7,
+ 0x04a9, 0x04a9,
+ 0x04ab, 0x04ab,
+ 0x04ad, 0x04ad,
+ 0x04af, 0x04af,
+ 0x04b1, 0x04b1,
+ 0x04b3, 0x04b3,
+ 0x04b5, 0x04b5,
+ 0x04b7, 0x04b7,
+ 0x04b9, 0x04b9,
+ 0x04bb, 0x04bb,
+ 0x04bd, 0x04bd,
+ 0x04bf, 0x04bf,
+ 0x04c2, 0x04c2,
+ 0x04c4, 0x04c4,
+ 0x04c6, 0x04c6,
+ 0x04c8, 0x04c8,
+ 0x04ca, 0x04ca,
+ 0x04cc, 0x04cc,
+ 0x04ce, 0x04cf,
+ 0x04d1, 0x04d1,
+ 0x04d3, 0x04d3,
+ 0x04d5, 0x04d5,
+ 0x04d7, 0x04d7,
+ 0x04d9, 0x04d9,
+ 0x04db, 0x04db,
+ 0x04dd, 0x04dd,
+ 0x04df, 0x04df,
+ 0x04e1, 0x04e1,
+ 0x04e3, 0x04e3,
+ 0x04e5, 0x04e5,
+ 0x04e7, 0x04e7,
+ 0x04e9, 0x04e9,
+ 0x04eb, 0x04eb,
+ 0x04ed, 0x04ed,
+ 0x04ef, 0x04ef,
+ 0x04f1, 0x04f1,
+ 0x04f3, 0x04f3,
+ 0x04f5, 0x04f5,
+ 0x04f7, 0x04f7,
+ 0x04f9, 0x04f9,
+ 0x04fb, 0x04fb,
+ 0x04fd, 0x04fd,
+ 0x04ff, 0x04ff,
+ 0x0501, 0x0501,
+ 0x0503, 0x0503,
+ 0x0505, 0x0505,
+ 0x0507, 0x0507,
+ 0x0509, 0x0509,
+ 0x050b, 0x050b,
+ 0x050d, 0x050d,
+ 0x050f, 0x050f,
+ 0x0511, 0x0511,
+ 0x0513, 0x0513,
+ 0x0515, 0x0515,
+ 0x0517, 0x0517,
+ 0x0519, 0x0519,
+ 0x051b, 0x051b,
+ 0x051d, 0x051d,
+ 0x051f, 0x051f,
+ 0x0521, 0x0521,
+ 0x0523, 0x0523,
+ 0x0525, 0x0525,
+ 0x0527, 0x0527,
+ 0x0561, 0x0587,
+ 0x1d00, 0x1dbf,
+ 0x1e01, 0x1e01,
+ 0x1e03, 0x1e03,
+ 0x1e05, 0x1e05,
+ 0x1e07, 0x1e07,
+ 0x1e09, 0x1e09,
+ 0x1e0b, 0x1e0b,
+ 0x1e0d, 0x1e0d,
+ 0x1e0f, 0x1e0f,
+ 0x1e11, 0x1e11,
+ 0x1e13, 0x1e13,
+ 0x1e15, 0x1e15,
+ 0x1e17, 0x1e17,
+ 0x1e19, 0x1e19,
+ 0x1e1b, 0x1e1b,
+ 0x1e1d, 0x1e1d,
+ 0x1e1f, 0x1e1f,
+ 0x1e21, 0x1e21,
+ 0x1e23, 0x1e23,
+ 0x1e25, 0x1e25,
+ 0x1e27, 0x1e27,
+ 0x1e29, 0x1e29,
+ 0x1e2b, 0x1e2b,
+ 0x1e2d, 0x1e2d,
+ 0x1e2f, 0x1e2f,
+ 0x1e31, 0x1e31,
+ 0x1e33, 0x1e33,
+ 0x1e35, 0x1e35,
+ 0x1e37, 0x1e37,
+ 0x1e39, 0x1e39,
+ 0x1e3b, 0x1e3b,
+ 0x1e3d, 0x1e3d,
+ 0x1e3f, 0x1e3f,
+ 0x1e41, 0x1e41,
+ 0x1e43, 0x1e43,
+ 0x1e45, 0x1e45,
+ 0x1e47, 0x1e47,
+ 0x1e49, 0x1e49,
+ 0x1e4b, 0x1e4b,
+ 0x1e4d, 0x1e4d,
+ 0x1e4f, 0x1e4f,
+ 0x1e51, 0x1e51,
+ 0x1e53, 0x1e53,
+ 0x1e55, 0x1e55,
+ 0x1e57, 0x1e57,
+ 0x1e59, 0x1e59,
+ 0x1e5b, 0x1e5b,
+ 0x1e5d, 0x1e5d,
+ 0x1e5f, 0x1e5f,
+ 0x1e61, 0x1e61,
+ 0x1e63, 0x1e63,
+ 0x1e65, 0x1e65,
+ 0x1e67, 0x1e67,
+ 0x1e69, 0x1e69,
+ 0x1e6b, 0x1e6b,
+ 0x1e6d, 0x1e6d,
+ 0x1e6f, 0x1e6f,
+ 0x1e71, 0x1e71,
+ 0x1e73, 0x1e73,
+ 0x1e75, 0x1e75,
+ 0x1e77, 0x1e77,
+ 0x1e79, 0x1e79,
+ 0x1e7b, 0x1e7b,
+ 0x1e7d, 0x1e7d,
+ 0x1e7f, 0x1e7f,
+ 0x1e81, 0x1e81,
+ 0x1e83, 0x1e83,
+ 0x1e85, 0x1e85,
+ 0x1e87, 0x1e87,
+ 0x1e89, 0x1e89,
+ 0x1e8b, 0x1e8b,
+ 0x1e8d, 0x1e8d,
+ 0x1e8f, 0x1e8f,
+ 0x1e91, 0x1e91,
+ 0x1e93, 0x1e93,
+ 0x1e95, 0x1e9d,
+ 0x1e9f, 0x1e9f,
+ 0x1ea1, 0x1ea1,
+ 0x1ea3, 0x1ea3,
+ 0x1ea5, 0x1ea5,
+ 0x1ea7, 0x1ea7,
+ 0x1ea9, 0x1ea9,
+ 0x1eab, 0x1eab,
+ 0x1ead, 0x1ead,
+ 0x1eaf, 0x1eaf,
+ 0x1eb1, 0x1eb1,
+ 0x1eb3, 0x1eb3,
+ 0x1eb5, 0x1eb5,
+ 0x1eb7, 0x1eb7,
+ 0x1eb9, 0x1eb9,
+ 0x1ebb, 0x1ebb,
+ 0x1ebd, 0x1ebd,
+ 0x1ebf, 0x1ebf,
+ 0x1ec1, 0x1ec1,
+ 0x1ec3, 0x1ec3,
+ 0x1ec5, 0x1ec5,
+ 0x1ec7, 0x1ec7,
+ 0x1ec9, 0x1ec9,
+ 0x1ecb, 0x1ecb,
+ 0x1ecd, 0x1ecd,
+ 0x1ecf, 0x1ecf,
+ 0x1ed1, 0x1ed1,
+ 0x1ed3, 0x1ed3,
+ 0x1ed5, 0x1ed5,
+ 0x1ed7, 0x1ed7,
+ 0x1ed9, 0x1ed9,
+ 0x1edb, 0x1edb,
+ 0x1edd, 0x1edd,
+ 0x1edf, 0x1edf,
+ 0x1ee1, 0x1ee1,
+ 0x1ee3, 0x1ee3,
+ 0x1ee5, 0x1ee5,
+ 0x1ee7, 0x1ee7,
+ 0x1ee9, 0x1ee9,
+ 0x1eeb, 0x1eeb,
+ 0x1eed, 0x1eed,
+ 0x1eef, 0x1eef,
+ 0x1ef1, 0x1ef1,
+ 0x1ef3, 0x1ef3,
+ 0x1ef5, 0x1ef5,
+ 0x1ef7, 0x1ef7,
+ 0x1ef9, 0x1ef9,
+ 0x1efb, 0x1efb,
+ 0x1efd, 0x1efd,
+ 0x1eff, 0x1f07,
+ 0x1f10, 0x1f15,
+ 0x1f20, 0x1f27,
+ 0x1f30, 0x1f37,
+ 0x1f40, 0x1f45,
+ 0x1f50, 0x1f57,
+ 0x1f60, 0x1f67,
+ 0x1f70, 0x1f7d,
+ 0x1f80, 0x1f87,
+ 0x1f90, 0x1f97,
+ 0x1fa0, 0x1fa7,
+ 0x1fb0, 0x1fb4,
+ 0x1fb6, 0x1fb7,
+ 0x1fbe, 0x1fbe,
+ 0x1fc2, 0x1fc4,
+ 0x1fc6, 0x1fc7,
+ 0x1fd0, 0x1fd3,
+ 0x1fd6, 0x1fd7,
+ 0x1fe0, 0x1fe7,
+ 0x1ff2, 0x1ff4,
+ 0x1ff6, 0x1ff7,
+ 0x2071, 0x2071,
+ 0x207f, 0x207f,
+ 0x2090, 0x209c,
+ 0x210a, 0x210a,
+ 0x210e, 0x210f,
+ 0x2113, 0x2113,
+ 0x212f, 0x212f,
+ 0x2134, 0x2134,
+ 0x2139, 0x2139,
+ 0x213c, 0x213d,
+ 0x2146, 0x2149,
+ 0x214e, 0x214e,
+ 0x2170, 0x217f,
+ 0x2184, 0x2184,
+ 0x24d0, 0x24e9,
+ 0x2c30, 0x2c5e,
+ 0x2c61, 0x2c61,
+ 0x2c65, 0x2c66,
+ 0x2c68, 0x2c68,
+ 0x2c6a, 0x2c6a,
+ 0x2c6c, 0x2c6c,
+ 0x2c71, 0x2c71,
+ 0x2c73, 0x2c74,
+ 0x2c76, 0x2c7d,
+ 0x2c81, 0x2c81,
+ 0x2c83, 0x2c83,
+ 0x2c85, 0x2c85,
+ 0x2c87, 0x2c87,
+ 0x2c89, 0x2c89,
+ 0x2c8b, 0x2c8b,
+ 0x2c8d, 0x2c8d,
+ 0x2c8f, 0x2c8f,
+ 0x2c91, 0x2c91,
+ 0x2c93, 0x2c93,
+ 0x2c95, 0x2c95,
+ 0x2c97, 0x2c97,
+ 0x2c99, 0x2c99,
+ 0x2c9b, 0x2c9b,
+ 0x2c9d, 0x2c9d,
+ 0x2c9f, 0x2c9f,
+ 0x2ca1, 0x2ca1,
+ 0x2ca3, 0x2ca3,
+ 0x2ca5, 0x2ca5,
+ 0x2ca7, 0x2ca7,
+ 0x2ca9, 0x2ca9,
+ 0x2cab, 0x2cab,
+ 0x2cad, 0x2cad,
+ 0x2caf, 0x2caf,
+ 0x2cb1, 0x2cb1,
+ 0x2cb3, 0x2cb3,
+ 0x2cb5, 0x2cb5,
+ 0x2cb7, 0x2cb7,
+ 0x2cb9, 0x2cb9,
+ 0x2cbb, 0x2cbb,
+ 0x2cbd, 0x2cbd,
+ 0x2cbf, 0x2cbf,
+ 0x2cc1, 0x2cc1,
+ 0x2cc3, 0x2cc3,
+ 0x2cc5, 0x2cc5,
+ 0x2cc7, 0x2cc7,
+ 0x2cc9, 0x2cc9,
+ 0x2ccb, 0x2ccb,
+ 0x2ccd, 0x2ccd,
+ 0x2ccf, 0x2ccf,
+ 0x2cd1, 0x2cd1,
+ 0x2cd3, 0x2cd3,
+ 0x2cd5, 0x2cd5,
+ 0x2cd7, 0x2cd7,
+ 0x2cd9, 0x2cd9,
+ 0x2cdb, 0x2cdb,
+ 0x2cdd, 0x2cdd,
+ 0x2cdf, 0x2cdf,
+ 0x2ce1, 0x2ce1,
+ 0x2ce3, 0x2ce4,
+ 0x2cec, 0x2cec,
+ 0x2cee, 0x2cee,
+ 0x2cf3, 0x2cf3,
+ 0x2d00, 0x2d25,
+ 0x2d27, 0x2d27,
+ 0x2d2d, 0x2d2d,
+ 0xa641, 0xa641,
+ 0xa643, 0xa643,
+ 0xa645, 0xa645,
+ 0xa647, 0xa647,
+ 0xa649, 0xa649,
+ 0xa64b, 0xa64b,
+ 0xa64d, 0xa64d,
+ 0xa64f, 0xa64f,
+ 0xa651, 0xa651,
+ 0xa653, 0xa653,
+ 0xa655, 0xa655,
+ 0xa657, 0xa657,
+ 0xa659, 0xa659,
+ 0xa65b, 0xa65b,
+ 0xa65d, 0xa65d,
+ 0xa65f, 0xa65f,
+ 0xa661, 0xa661,
+ 0xa663, 0xa663,
+ 0xa665, 0xa665,
+ 0xa667, 0xa667,
+ 0xa669, 0xa669,
+ 0xa66b, 0xa66b,
+ 0xa66d, 0xa66d,
+ 0xa681, 0xa681,
+ 0xa683, 0xa683,
+ 0xa685, 0xa685,
+ 0xa687, 0xa687,
+ 0xa689, 0xa689,
+ 0xa68b, 0xa68b,
+ 0xa68d, 0xa68d,
+ 0xa68f, 0xa68f,
+ 0xa691, 0xa691,
+ 0xa693, 0xa693,
+ 0xa695, 0xa695,
+ 0xa697, 0xa697,
+ 0xa723, 0xa723,
+ 0xa725, 0xa725,
+ 0xa727, 0xa727,
+ 0xa729, 0xa729,
+ 0xa72b, 0xa72b,
+ 0xa72d, 0xa72d,
+ 0xa72f, 0xa731,
+ 0xa733, 0xa733,
+ 0xa735, 0xa735,
+ 0xa737, 0xa737,
+ 0xa739, 0xa739,
+ 0xa73b, 0xa73b,
+ 0xa73d, 0xa73d,
+ 0xa73f, 0xa73f,
+ 0xa741, 0xa741,
+ 0xa743, 0xa743,
+ 0xa745, 0xa745,
+ 0xa747, 0xa747,
+ 0xa749, 0xa749,
+ 0xa74b, 0xa74b,
+ 0xa74d, 0xa74d,
+ 0xa74f, 0xa74f,
+ 0xa751, 0xa751,
+ 0xa753, 0xa753,
+ 0xa755, 0xa755,
+ 0xa757, 0xa757,
+ 0xa759, 0xa759,
+ 0xa75b, 0xa75b,
+ 0xa75d, 0xa75d,
+ 0xa75f, 0xa75f,
+ 0xa761, 0xa761,
+ 0xa763, 0xa763,
+ 0xa765, 0xa765,
+ 0xa767, 0xa767,
+ 0xa769, 0xa769,
+ 0xa76b, 0xa76b,
+ 0xa76d, 0xa76d,
+ 0xa76f, 0xa778,
+ 0xa77a, 0xa77a,
+ 0xa77c, 0xa77c,
+ 0xa77f, 0xa77f,
+ 0xa781, 0xa781,
+ 0xa783, 0xa783,
+ 0xa785, 0xa785,
+ 0xa787, 0xa787,
+ 0xa78c, 0xa78c,
+ 0xa78e, 0xa78e,
+ 0xa791, 0xa791,
+ 0xa793, 0xa793,
+ 0xa7a1, 0xa7a1,
+ 0xa7a3, 0xa7a3,
+ 0xa7a5, 0xa7a5,
+ 0xa7a7, 0xa7a7,
+ 0xa7a9, 0xa7a9,
+ 0xa7f8, 0xa7fa,
+ 0xfb00, 0xfb06,
+ 0xfb13, 0xfb17,
+ 0xff41, 0xff5a,
+ 0x10428, 0x1044f,
+ 0x1d41a, 0x1d433,
+ 0x1d44e, 0x1d454,
+ 0x1d456, 0x1d467,
+ 0x1d482, 0x1d49b,
+ 0x1d4b6, 0x1d4b9,
+ 0x1d4bb, 0x1d4bb,
+ 0x1d4bd, 0x1d4c3,
+ 0x1d4c5, 0x1d4cf,
+ 0x1d4ea, 0x1d503,
+ 0x1d51e, 0x1d537,
+ 0x1d552, 0x1d56b,
+ 0x1d586, 0x1d59f,
+ 0x1d5ba, 0x1d5d3,
+ 0x1d5ee, 0x1d607,
+ 0x1d622, 0x1d63b,
+ 0x1d656, 0x1d66f,
+ 0x1d68a, 0x1d6a5,
+ 0x1d6c2, 0x1d6da,
+ 0x1d6dc, 0x1d6e1,
+ 0x1d6fc, 0x1d714,
+ 0x1d716, 0x1d71b,
+ 0x1d736, 0x1d74e,
+ 0x1d750, 0x1d755,
+ 0x1d770, 0x1d788,
+ 0x1d78a, 0x1d78f,
+ 0x1d7aa, 0x1d7c2,
+ 0x1d7c4, 0x1d7c9,
+ 0x1d7cb, 0x1d7cb,
+}; /* CR_Lower */
+
+/* 'Print': [[:Print:]] */
+static const OnigCodePoint CR_Print[] = {
+ 541,
+ 0x0020, 0x007e,
+ 0x00a0, 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, 0x2027,
+ 0x202a, 0x2064,
+ 0x206a, 0x2071,
+ 0x2074, 0x208e,
+ 0x2090, 0x209c,
+ 0x20a0, 0x20b9,
+ 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,
+ 0xe000, 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,
+ 0xfdf0, 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, 0xfffd,
+ 0x10000, 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,
+ 0x20000, 0x2a6d6,
+ 0x2a700, 0x2b734,
+ 0x2b740, 0x2b81d,
+ 0x2f800, 0x2fa1d,
+ 0xe0001, 0xe0001,
+ 0xe0020, 0xe007f,
+ 0xe0100, 0xe01ef,
+ 0xf0000, 0xffffd,
+ 0x100000, 0x10fffd,
+}; /* CR_Print */
+
+/* 'Punct': [[:Punct:]] */
+static const OnigCodePoint CR_Punct[] = {
+ 140,
+ 0x0021, 0x0023,
+ 0x0025, 0x002a,
+ 0x002c, 0x002f,
+ 0x003a, 0x003b,
+ 0x003f, 0x0040,
+ 0x005b, 0x005d,
+ 0x005f, 0x005f,
+ 0x007b, 0x007b,
+ 0x007d, 0x007d,
+ 0x00a1, 0x00a1,
+ 0x00a7, 0x00a7,
+ 0x00ab, 0x00ab,
+ 0x00b6, 0x00b7,
+ 0x00bb, 0x00bb,
+ 0x00bf, 0x00bf,
+ 0x037e, 0x037e,
+ 0x0387, 0x0387,
+ 0x055a, 0x055f,
+ 0x0589, 0x058a,
+ 0x05be, 0x05be,
+ 0x05c0, 0x05c0,
+ 0x05c3, 0x05c3,
+ 0x05c6, 0x05c6,
+ 0x05f3, 0x05f4,
+ 0x0609, 0x060a,
+ 0x060c, 0x060d,
+ 0x061b, 0x061b,
+ 0x061e, 0x061f,
+ 0x066a, 0x066d,
+ 0x06d4, 0x06d4,
+ 0x0700, 0x070d,
+ 0x07f7, 0x07f9,
+ 0x0830, 0x083e,
+ 0x085e, 0x085e,
+ 0x0964, 0x0965,
+ 0x0970, 0x0970,
+ 0x0af0, 0x0af0,
+ 0x0df4, 0x0df4,
+ 0x0e4f, 0x0e4f,
+ 0x0e5a, 0x0e5b,
+ 0x0f04, 0x0f12,
+ 0x0f14, 0x0f14,
+ 0x0f3a, 0x0f3d,
+ 0x0f85, 0x0f85,
+ 0x0fd0, 0x0fd4,
+ 0x0fd9, 0x0fda,
+ 0x104a, 0x104f,
+ 0x10fb, 0x10fb,
+ 0x1360, 0x1368,
+ 0x1400, 0x1400,
+ 0x166d, 0x166e,
+ 0x169b, 0x169c,
+ 0x16eb, 0x16ed,
+ 0x1735, 0x1736,
+ 0x17d4, 0x17d6,
+ 0x17d8, 0x17da,
+ 0x1800, 0x180a,
+ 0x1944, 0x1945,
+ 0x1a1e, 0x1a1f,
+ 0x1aa0, 0x1aa6,
+ 0x1aa8, 0x1aad,
+ 0x1b5a, 0x1b60,
+ 0x1bfc, 0x1bff,
+ 0x1c3b, 0x1c3f,
+ 0x1c7e, 0x1c7f,
+ 0x1cc0, 0x1cc7,
+ 0x1cd3, 0x1cd3,
+ 0x2010, 0x2027,
+ 0x2030, 0x2043,
+ 0x2045, 0x2051,
+ 0x2053, 0x205e,
+ 0x207d, 0x207e,
+ 0x208d, 0x208e,
+ 0x2329, 0x232a,
+ 0x2768, 0x2775,
+ 0x27c5, 0x27c6,
+ 0x27e6, 0x27ef,
+ 0x2983, 0x2998,
+ 0x29d8, 0x29db,
+ 0x29fc, 0x29fd,
+ 0x2cf9, 0x2cfc,
+ 0x2cfe, 0x2cff,
+ 0x2d70, 0x2d70,
+ 0x2e00, 0x2e2e,
+ 0x2e30, 0x2e3b,
+ 0x3001, 0x3003,
+ 0x3008, 0x3011,
+ 0x3014, 0x301f,
+ 0x3030, 0x3030,
+ 0x303d, 0x303d,
+ 0x30a0, 0x30a0,
+ 0x30fb, 0x30fb,
+ 0xa4fe, 0xa4ff,
+ 0xa60d, 0xa60f,
+ 0xa673, 0xa673,
+ 0xa67e, 0xa67e,
+ 0xa6f2, 0xa6f7,
+ 0xa874, 0xa877,
+ 0xa8ce, 0xa8cf,
+ 0xa8f8, 0xa8fa,
+ 0xa92e, 0xa92f,
+ 0xa95f, 0xa95f,
+ 0xa9c1, 0xa9cd,
+ 0xa9de, 0xa9df,
+ 0xaa5c, 0xaa5f,
+ 0xaade, 0xaadf,
+ 0xaaf0, 0xaaf1,
+ 0xabeb, 0xabeb,
+ 0xfd3e, 0xfd3f,
+ 0xfe10, 0xfe19,
+ 0xfe30, 0xfe52,
+ 0xfe54, 0xfe61,
+ 0xfe63, 0xfe63,
+ 0xfe68, 0xfe68,
+ 0xfe6a, 0xfe6b,
+ 0xff01, 0xff03,
+ 0xff05, 0xff0a,
+ 0xff0c, 0xff0f,
+ 0xff1a, 0xff1b,
+ 0xff1f, 0xff20,
+ 0xff3b, 0xff3d,
+ 0xff3f, 0xff3f,
+ 0xff5b, 0xff5b,
+ 0xff5d, 0xff5d,
+ 0xff5f, 0xff65,
+ 0x10100, 0x10102,
+ 0x1039f, 0x1039f,
+ 0x103d0, 0x103d0,
+ 0x10857, 0x10857,
+ 0x1091f, 0x1091f,
+ 0x1093f, 0x1093f,
+ 0x10a50, 0x10a58,
+ 0x10a7f, 0x10a7f,
+ 0x10b39, 0x10b3f,
+ 0x11047, 0x1104d,
+ 0x110bb, 0x110bc,
+ 0x110be, 0x110c1,
+ 0x11140, 0x11143,
+ 0x111c5, 0x111c8,
+ 0x12470, 0x12473,
+}; /* CR_Punct */
+
+/* 'Space': [[:Space:]] */
+static const OnigCodePoint CR_Space[] = {
+ 11,
+ 0x0009, 0x000d,
+ 0x0020, 0x0020,
+ 0x0085, 0x0085,
+ 0x00a0, 0x00a0,
+ 0x1680, 0x1680,
+ 0x180e, 0x180e,
+ 0x2000, 0x200a,
+ 0x2028, 0x2029,
+ 0x202f, 0x202f,
+ 0x205f, 0x205f,
+ 0x3000, 0x3000,
+}; /* CR_Space */
+
+/* 'Upper': [[:Upper:]] */
+static const OnigCodePoint CR_Upper[] = {
+ 610,
+ 0x0041, 0x005a,
+ 0x00c0, 0x00d6,
+ 0x00d8, 0x00de,
+ 0x0100, 0x0100,
+ 0x0102, 0x0102,
+ 0x0104, 0x0104,
+ 0x0106, 0x0106,
+ 0x0108, 0x0108,
+ 0x010a, 0x010a,
+ 0x010c, 0x010c,
+ 0x010e, 0x010e,
+ 0x0110, 0x0110,
+ 0x0112, 0x0112,
+ 0x0114, 0x0114,
+ 0x0116, 0x0116,
+ 0x0118, 0x0118,
+ 0x011a, 0x011a,
+ 0x011c, 0x011c,
+ 0x011e, 0x011e,
+ 0x0120, 0x0120,
+ 0x0122, 0x0122,
+ 0x0124, 0x0124,
+ 0x0126, 0x0126,
+ 0x0128, 0x0128,
+ 0x012a, 0x012a,
+ 0x012c, 0x012c,
+ 0x012e, 0x012e,
+ 0x0130, 0x0130,
+ 0x0132, 0x0132,
+ 0x0134, 0x0134,
+ 0x0136, 0x0136,
+ 0x0139, 0x0139,
+ 0x013b, 0x013b,
+ 0x013d, 0x013d,
+ 0x013f, 0x013f,
+ 0x0141, 0x0141,
+ 0x0143, 0x0143,
+ 0x0145, 0x0145,
+ 0x0147, 0x0147,
+ 0x014a, 0x014a,
+ 0x014c, 0x014c,
+ 0x014e, 0x014e,
+ 0x0150, 0x0150,
+ 0x0152, 0x0152,
+ 0x0154, 0x0154,
+ 0x0156, 0x0156,
+ 0x0158, 0x0158,
+ 0x015a, 0x015a,
+ 0x015c, 0x015c,
+ 0x015e, 0x015e,
+ 0x0160, 0x0160,
+ 0x0162, 0x0162,
+ 0x0164, 0x0164,
+ 0x0166, 0x0166,
+ 0x0168, 0x0168,
+ 0x016a, 0x016a,
+ 0x016c, 0x016c,
+ 0x016e, 0x016e,
+ 0x0170, 0x0170,
+ 0x0172, 0x0172,
+ 0x0174, 0x0174,
+ 0x0176, 0x0176,
+ 0x0178, 0x0179,
+ 0x017b, 0x017b,
+ 0x017d, 0x017d,
+ 0x0181, 0x0182,
+ 0x0184, 0x0184,
+ 0x0186, 0x0187,
+ 0x0189, 0x018b,
+ 0x018e, 0x0191,
+ 0x0193, 0x0194,
+ 0x0196, 0x0198,
+ 0x019c, 0x019d,
+ 0x019f, 0x01a0,
+ 0x01a2, 0x01a2,
+ 0x01a4, 0x01a4,
+ 0x01a6, 0x01a7,
+ 0x01a9, 0x01a9,
+ 0x01ac, 0x01ac,
+ 0x01ae, 0x01af,
+ 0x01b1, 0x01b3,
+ 0x01b5, 0x01b5,
+ 0x01b7, 0x01b8,
+ 0x01bc, 0x01bc,
+ 0x01c4, 0x01c4,
+ 0x01c7, 0x01c7,
+ 0x01ca, 0x01ca,
+ 0x01cd, 0x01cd,
+ 0x01cf, 0x01cf,
+ 0x01d1, 0x01d1,
+ 0x01d3, 0x01d3,
+ 0x01d5, 0x01d5,
+ 0x01d7, 0x01d7,
+ 0x01d9, 0x01d9,
+ 0x01db, 0x01db,
+ 0x01de, 0x01de,
+ 0x01e0, 0x01e0,
+ 0x01e2, 0x01e2,
+ 0x01e4, 0x01e4,
+ 0x01e6, 0x01e6,
+ 0x01e8, 0x01e8,
+ 0x01ea, 0x01ea,
+ 0x01ec, 0x01ec,
+ 0x01ee, 0x01ee,
+ 0x01f1, 0x01f1,
+ 0x01f4, 0x01f4,
+ 0x01f6, 0x01f8,
+ 0x01fa, 0x01fa,
+ 0x01fc, 0x01fc,
+ 0x01fe, 0x01fe,
+ 0x0200, 0x0200,
+ 0x0202, 0x0202,
+ 0x0204, 0x0204,
+ 0x0206, 0x0206,
+ 0x0208, 0x0208,
+ 0x020a, 0x020a,
+ 0x020c, 0x020c,
+ 0x020e, 0x020e,
+ 0x0210, 0x0210,
+ 0x0212, 0x0212,
+ 0x0214, 0x0214,
+ 0x0216, 0x0216,
+ 0x0218, 0x0218,
+ 0x021a, 0x021a,
+ 0x021c, 0x021c,
+ 0x021e, 0x021e,
+ 0x0220, 0x0220,
+ 0x0222, 0x0222,
+ 0x0224, 0x0224,
+ 0x0226, 0x0226,
+ 0x0228, 0x0228,
+ 0x022a, 0x022a,
+ 0x022c, 0x022c,
+ 0x022e, 0x022e,
+ 0x0230, 0x0230,
+ 0x0232, 0x0232,
+ 0x023a, 0x023b,
+ 0x023d, 0x023e,
+ 0x0241, 0x0241,
+ 0x0243, 0x0246,
+ 0x0248, 0x0248,
+ 0x024a, 0x024a,
+ 0x024c, 0x024c,
+ 0x024e, 0x024e,
+ 0x0370, 0x0370,
+ 0x0372, 0x0372,
+ 0x0376, 0x0376,
+ 0x0386, 0x0386,
+ 0x0388, 0x038a,
+ 0x038c, 0x038c,
+ 0x038e, 0x038f,
+ 0x0391, 0x03a1,
+ 0x03a3, 0x03ab,
+ 0x03cf, 0x03cf,
+ 0x03d2, 0x03d4,
+ 0x03d8, 0x03d8,
+ 0x03da, 0x03da,
+ 0x03dc, 0x03dc,
+ 0x03de, 0x03de,
+ 0x03e0, 0x03e0,
+ 0x03e2, 0x03e2,
+ 0x03e4, 0x03e4,
+ 0x03e6, 0x03e6,
+ 0x03e8, 0x03e8,
+ 0x03ea, 0x03ea,
+ 0x03ec, 0x03ec,
+ 0x03ee, 0x03ee,
+ 0x03f4, 0x03f4,
+ 0x03f7, 0x03f7,
+ 0x03f9, 0x03fa,
+ 0x03fd, 0x042f,
+ 0x0460, 0x0460,
+ 0x0462, 0x0462,
+ 0x0464, 0x0464,
+ 0x0466, 0x0466,
+ 0x0468, 0x0468,
+ 0x046a, 0x046a,
+ 0x046c, 0x046c,
+ 0x046e, 0x046e,
+ 0x0470, 0x0470,
+ 0x0472, 0x0472,
+ 0x0474, 0x0474,
+ 0x0476, 0x0476,
+ 0x0478, 0x0478,
+ 0x047a, 0x047a,
+ 0x047c, 0x047c,
+ 0x047e, 0x047e,
+ 0x0480, 0x0480,
+ 0x048a, 0x048a,
+ 0x048c, 0x048c,
+ 0x048e, 0x048e,
+ 0x0490, 0x0490,
+ 0x0492, 0x0492,
+ 0x0494, 0x0494,
+ 0x0496, 0x0496,
+ 0x0498, 0x0498,
+ 0x049a, 0x049a,
+ 0x049c, 0x049c,
+ 0x049e, 0x049e,
+ 0x04a0, 0x04a0,
+ 0x04a2, 0x04a2,
+ 0x04a4, 0x04a4,
+ 0x04a6, 0x04a6,
+ 0x04a8, 0x04a8,
+ 0x04aa, 0x04aa,
+ 0x04ac, 0x04ac,
+ 0x04ae, 0x04ae,
+ 0x04b0, 0x04b0,
+ 0x04b2, 0x04b2,
+ 0x04b4, 0x04b4,
+ 0x04b6, 0x04b6,
+ 0x04b8, 0x04b8,
+ 0x04ba, 0x04ba,
+ 0x04bc, 0x04bc,
+ 0x04be, 0x04be,
+ 0x04c0, 0x04c1,
+ 0x04c3, 0x04c3,
+ 0x04c5, 0x04c5,
+ 0x04c7, 0x04c7,
+ 0x04c9, 0x04c9,
+ 0x04cb, 0x04cb,
+ 0x04cd, 0x04cd,
+ 0x04d0, 0x04d0,
+ 0x04d2, 0x04d2,
+ 0x04d4, 0x04d4,
+ 0x04d6, 0x04d6,
+ 0x04d8, 0x04d8,
+ 0x04da, 0x04da,
+ 0x04dc, 0x04dc,
+ 0x04de, 0x04de,
+ 0x04e0, 0x04e0,
+ 0x04e2, 0x04e2,
+ 0x04e4, 0x04e4,
+ 0x04e6, 0x04e6,
+ 0x04e8, 0x04e8,
+ 0x04ea, 0x04ea,
+ 0x04ec, 0x04ec,
+ 0x04ee, 0x04ee,
+ 0x04f0, 0x04f0,
+ 0x04f2, 0x04f2,
+ 0x04f4, 0x04f4,
+ 0x04f6, 0x04f6,
+ 0x04f8, 0x04f8,
+ 0x04fa, 0x04fa,
+ 0x04fc, 0x04fc,
+ 0x04fe, 0x04fe,
+ 0x0500, 0x0500,
+ 0x0502, 0x0502,
+ 0x0504, 0x0504,
+ 0x0506, 0x0506,
+ 0x0508, 0x0508,
+ 0x050a, 0x050a,
+ 0x050c, 0x050c,
+ 0x050e, 0x050e,
+ 0x0510, 0x0510,
+ 0x0512, 0x0512,
+ 0x0514, 0x0514,
+ 0x0516, 0x0516,
+ 0x0518, 0x0518,
+ 0x051a, 0x051a,
+ 0x051c, 0x051c,
+ 0x051e, 0x051e,
+ 0x0520, 0x0520,
+ 0x0522, 0x0522,
+ 0x0524, 0x0524,
+ 0x0526, 0x0526,
+ 0x0531, 0x0556,
+ 0x10a0, 0x10c5,
+ 0x10c7, 0x10c7,
+ 0x10cd, 0x10cd,
+ 0x1e00, 0x1e00,
+ 0x1e02, 0x1e02,
+ 0x1e04, 0x1e04,
+ 0x1e06, 0x1e06,
+ 0x1e08, 0x1e08,
+ 0x1e0a, 0x1e0a,
+ 0x1e0c, 0x1e0c,
+ 0x1e0e, 0x1e0e,
+ 0x1e10, 0x1e10,
+ 0x1e12, 0x1e12,
+ 0x1e14, 0x1e14,
+ 0x1e16, 0x1e16,
+ 0x1e18, 0x1e18,
+ 0x1e1a, 0x1e1a,
+ 0x1e1c, 0x1e1c,
+ 0x1e1e, 0x1e1e,
+ 0x1e20, 0x1e20,
+ 0x1e22, 0x1e22,
+ 0x1e24, 0x1e24,
+ 0x1e26, 0x1e26,
+ 0x1e28, 0x1e28,
+ 0x1e2a, 0x1e2a,
+ 0x1e2c, 0x1e2c,
+ 0x1e2e, 0x1e2e,
+ 0x1e30, 0x1e30,
+ 0x1e32, 0x1e32,
+ 0x1e34, 0x1e34,
+ 0x1e36, 0x1e36,
+ 0x1e38, 0x1e38,
+ 0x1e3a, 0x1e3a,
+ 0x1e3c, 0x1e3c,
+ 0x1e3e, 0x1e3e,
+ 0x1e40, 0x1e40,
+ 0x1e42, 0x1e42,
+ 0x1e44, 0x1e44,
+ 0x1e46, 0x1e46,
+ 0x1e48, 0x1e48,
+ 0x1e4a, 0x1e4a,
+ 0x1e4c, 0x1e4c,
+ 0x1e4e, 0x1e4e,
+ 0x1e50, 0x1e50,
+ 0x1e52, 0x1e52,
+ 0x1e54, 0x1e54,
+ 0x1e56, 0x1e56,
+ 0x1e58, 0x1e58,
+ 0x1e5a, 0x1e5a,
+ 0x1e5c, 0x1e5c,
+ 0x1e5e, 0x1e5e,
+ 0x1e60, 0x1e60,
+ 0x1e62, 0x1e62,
+ 0x1e64, 0x1e64,
+ 0x1e66, 0x1e66,
+ 0x1e68, 0x1e68,
+ 0x1e6a, 0x1e6a,
+ 0x1e6c, 0x1e6c,
+ 0x1e6e, 0x1e6e,
+ 0x1e70, 0x1e70,
+ 0x1e72, 0x1e72,
+ 0x1e74, 0x1e74,
+ 0x1e76, 0x1e76,
+ 0x1e78, 0x1e78,
+ 0x1e7a, 0x1e7a,
+ 0x1e7c, 0x1e7c,
+ 0x1e7e, 0x1e7e,
+ 0x1e80, 0x1e80,
+ 0x1e82, 0x1e82,
+ 0x1e84, 0x1e84,
+ 0x1e86, 0x1e86,
+ 0x1e88, 0x1e88,
+ 0x1e8a, 0x1e8a,
+ 0x1e8c, 0x1e8c,
+ 0x1e8e, 0x1e8e,
+ 0x1e90, 0x1e90,
+ 0x1e92, 0x1e92,
+ 0x1e94, 0x1e94,
+ 0x1e9e, 0x1e9e,
+ 0x1ea0, 0x1ea0,
+ 0x1ea2, 0x1ea2,
+ 0x1ea4, 0x1ea4,
+ 0x1ea6, 0x1ea6,
+ 0x1ea8, 0x1ea8,
+ 0x1eaa, 0x1eaa,
+ 0x1eac, 0x1eac,
+ 0x1eae, 0x1eae,
+ 0x1eb0, 0x1eb0,
+ 0x1eb2, 0x1eb2,
+ 0x1eb4, 0x1eb4,
+ 0x1eb6, 0x1eb6,
+ 0x1eb8, 0x1eb8,
+ 0x1eba, 0x1eba,
+ 0x1ebc, 0x1ebc,
+ 0x1ebe, 0x1ebe,
+ 0x1ec0, 0x1ec0,
+ 0x1ec2, 0x1ec2,
+ 0x1ec4, 0x1ec4,
+ 0x1ec6, 0x1ec6,
+ 0x1ec8, 0x1ec8,
+ 0x1eca, 0x1eca,
+ 0x1ecc, 0x1ecc,
+ 0x1ece, 0x1ece,
+ 0x1ed0, 0x1ed0,
+ 0x1ed2, 0x1ed2,
+ 0x1ed4, 0x1ed4,
+ 0x1ed6, 0x1ed6,
+ 0x1ed8, 0x1ed8,
+ 0x1eda, 0x1eda,
+ 0x1edc, 0x1edc,
+ 0x1ede, 0x1ede,
+ 0x1ee0, 0x1ee0,
+ 0x1ee2, 0x1ee2,
+ 0x1ee4, 0x1ee4,
+ 0x1ee6, 0x1ee6,
+ 0x1ee8, 0x1ee8,
+ 0x1eea, 0x1eea,
+ 0x1eec, 0x1eec,
+ 0x1eee, 0x1eee,
+ 0x1ef0, 0x1ef0,
+ 0x1ef2, 0x1ef2,
+ 0x1ef4, 0x1ef4,
+ 0x1ef6, 0x1ef6,
+ 0x1ef8, 0x1ef8,
+ 0x1efa, 0x1efa,
+ 0x1efc, 0x1efc,
+ 0x1efe, 0x1efe,
+ 0x1f08, 0x1f0f,
+ 0x1f18, 0x1f1d,
+ 0x1f28, 0x1f2f,
+ 0x1f38, 0x1f3f,
+ 0x1f48, 0x1f4d,
+ 0x1f59, 0x1f59,
+ 0x1f5b, 0x1f5b,
+ 0x1f5d, 0x1f5d,
+ 0x1f5f, 0x1f5f,
+ 0x1f68, 0x1f6f,
+ 0x1fb8, 0x1fbb,
+ 0x1fc8, 0x1fcb,
+ 0x1fd8, 0x1fdb,
+ 0x1fe8, 0x1fec,
+ 0x1ff8, 0x1ffb,
+ 0x2102, 0x2102,
+ 0x2107, 0x2107,
+ 0x210b, 0x210d,
+ 0x2110, 0x2112,
+ 0x2115, 0x2115,
+ 0x2119, 0x211d,
+ 0x2124, 0x2124,
+ 0x2126, 0x2126,
+ 0x2128, 0x2128,
+ 0x212a, 0x212d,
+ 0x2130, 0x2133,
+ 0x213e, 0x213f,
+ 0x2145, 0x2145,
+ 0x2160, 0x216f,
+ 0x2183, 0x2183,
+ 0x24b6, 0x24cf,
+ 0x2c00, 0x2c2e,
+ 0x2c60, 0x2c60,
+ 0x2c62, 0x2c64,
+ 0x2c67, 0x2c67,
+ 0x2c69, 0x2c69,
+ 0x2c6b, 0x2c6b,
+ 0x2c6d, 0x2c70,
+ 0x2c72, 0x2c72,
+ 0x2c75, 0x2c75,
+ 0x2c7e, 0x2c80,
+ 0x2c82, 0x2c82,
+ 0x2c84, 0x2c84,
+ 0x2c86, 0x2c86,
+ 0x2c88, 0x2c88,
+ 0x2c8a, 0x2c8a,
+ 0x2c8c, 0x2c8c,
+ 0x2c8e, 0x2c8e,
+ 0x2c90, 0x2c90,
+ 0x2c92, 0x2c92,
+ 0x2c94, 0x2c94,
+ 0x2c96, 0x2c96,
+ 0x2c98, 0x2c98,
+ 0x2c9a, 0x2c9a,
+ 0x2c9c, 0x2c9c,
+ 0x2c9e, 0x2c9e,
+ 0x2ca0, 0x2ca0,
+ 0x2ca2, 0x2ca2,
+ 0x2ca4, 0x2ca4,
+ 0x2ca6, 0x2ca6,
+ 0x2ca8, 0x2ca8,
+ 0x2caa, 0x2caa,
+ 0x2cac, 0x2cac,
+ 0x2cae, 0x2cae,
+ 0x2cb0, 0x2cb0,
+ 0x2cb2, 0x2cb2,
+ 0x2cb4, 0x2cb4,
+ 0x2cb6, 0x2cb6,
+ 0x2cb8, 0x2cb8,
+ 0x2cba, 0x2cba,
+ 0x2cbc, 0x2cbc,
+ 0x2cbe, 0x2cbe,
+ 0x2cc0, 0x2cc0,
+ 0x2cc2, 0x2cc2,
+ 0x2cc4, 0x2cc4,
+ 0x2cc6, 0x2cc6,
+ 0x2cc8, 0x2cc8,
+ 0x2cca, 0x2cca,
+ 0x2ccc, 0x2ccc,
+ 0x2cce, 0x2cce,
+ 0x2cd0, 0x2cd0,
+ 0x2cd2, 0x2cd2,
+ 0x2cd4, 0x2cd4,
+ 0x2cd6, 0x2cd6,
+ 0x2cd8, 0x2cd8,
+ 0x2cda, 0x2cda,
+ 0x2cdc, 0x2cdc,
+ 0x2cde, 0x2cde,
+ 0x2ce0, 0x2ce0,
+ 0x2ce2, 0x2ce2,
+ 0x2ceb, 0x2ceb,
+ 0x2ced, 0x2ced,
+ 0x2cf2, 0x2cf2,
+ 0xa640, 0xa640,
+ 0xa642, 0xa642,
+ 0xa644, 0xa644,
+ 0xa646, 0xa646,
+ 0xa648, 0xa648,
+ 0xa64a, 0xa64a,
+ 0xa64c, 0xa64c,
+ 0xa64e, 0xa64e,
+ 0xa650, 0xa650,
+ 0xa652, 0xa652,
+ 0xa654, 0xa654,
+ 0xa656, 0xa656,
+ 0xa658, 0xa658,
+ 0xa65a, 0xa65a,
+ 0xa65c, 0xa65c,
+ 0xa65e, 0xa65e,
+ 0xa660, 0xa660,
+ 0xa662, 0xa662,
+ 0xa664, 0xa664,
+ 0xa666, 0xa666,
+ 0xa668, 0xa668,
+ 0xa66a, 0xa66a,
+ 0xa66c, 0xa66c,
+ 0xa680, 0xa680,
+ 0xa682, 0xa682,
+ 0xa684, 0xa684,
+ 0xa686, 0xa686,
+ 0xa688, 0xa688,
+ 0xa68a, 0xa68a,
+ 0xa68c, 0xa68c,
+ 0xa68e, 0xa68e,
+ 0xa690, 0xa690,
+ 0xa692, 0xa692,
+ 0xa694, 0xa694,
+ 0xa696, 0xa696,
+ 0xa722, 0xa722,
+ 0xa724, 0xa724,
+ 0xa726, 0xa726,
+ 0xa728, 0xa728,
+ 0xa72a, 0xa72a,
+ 0xa72c, 0xa72c,
+ 0xa72e, 0xa72e,
+ 0xa732, 0xa732,
+ 0xa734, 0xa734,
+ 0xa736, 0xa736,
+ 0xa738, 0xa738,
+ 0xa73a, 0xa73a,
+ 0xa73c, 0xa73c,
+ 0xa73e, 0xa73e,
+ 0xa740, 0xa740,
+ 0xa742, 0xa742,
+ 0xa744, 0xa744,
+ 0xa746, 0xa746,
+ 0xa748, 0xa748,
+ 0xa74a, 0xa74a,
+ 0xa74c, 0xa74c,
+ 0xa74e, 0xa74e,
+ 0xa750, 0xa750,
+ 0xa752, 0xa752,
+ 0xa754, 0xa754,
+ 0xa756, 0xa756,
+ 0xa758, 0xa758,
+ 0xa75a, 0xa75a,
+ 0xa75c, 0xa75c,
+ 0xa75e, 0xa75e,
+ 0xa760, 0xa760,
+ 0xa762, 0xa762,
+ 0xa764, 0xa764,
+ 0xa766, 0xa766,
+ 0xa768, 0xa768,
+ 0xa76a, 0xa76a,
+ 0xa76c, 0xa76c,
+ 0xa76e, 0xa76e,
+ 0xa779, 0xa779,
+ 0xa77b, 0xa77b,
+ 0xa77d, 0xa77e,
+ 0xa780, 0xa780,
+ 0xa782, 0xa782,
+ 0xa784, 0xa784,
+ 0xa786, 0xa786,
+ 0xa78b, 0xa78b,
+ 0xa78d, 0xa78d,
+ 0xa790, 0xa790,
+ 0xa792, 0xa792,
+ 0xa7a0, 0xa7a0,
+ 0xa7a2, 0xa7a2,
+ 0xa7a4, 0xa7a4,
+ 0xa7a6, 0xa7a6,
+ 0xa7a8, 0xa7a8,
+ 0xa7aa, 0xa7aa,
+ 0xff21, 0xff3a,
+ 0x10400, 0x10427,
+ 0x1d400, 0x1d419,
+ 0x1d434, 0x1d44d,
+ 0x1d468, 0x1d481,
+ 0x1d49c, 0x1d49c,
+ 0x1d49e, 0x1d49f,
+ 0x1d4a2, 0x1d4a2,
+ 0x1d4a5, 0x1d4a6,
+ 0x1d4a9, 0x1d4ac,
+ 0x1d4ae, 0x1d4b5,
+ 0x1d4d0, 0x1d4e9,
+ 0x1d504, 0x1d505,
+ 0x1d507, 0x1d50a,
+ 0x1d50d, 0x1d514,
+ 0x1d516, 0x1d51c,
+ 0x1d538, 0x1d539,
+ 0x1d53b, 0x1d53e,
+ 0x1d540, 0x1d544,
+ 0x1d546, 0x1d546,
+ 0x1d54a, 0x1d550,
+ 0x1d56c, 0x1d585,
+ 0x1d5a0, 0x1d5b9,
+ 0x1d5d4, 0x1d5ed,
+ 0x1d608, 0x1d621,
+ 0x1d63c, 0x1d655,
+ 0x1d670, 0x1d689,
+ 0x1d6a8, 0x1d6c0,
+ 0x1d6e2, 0x1d6fa,
+ 0x1d71c, 0x1d734,
+ 0x1d756, 0x1d76e,
+ 0x1d790, 0x1d7a8,
+ 0x1d7ca, 0x1d7ca,
+}; /* CR_Upper */
+
+/* 'XDigit': [[:XDigit:]] */
+static const OnigCodePoint CR_XDigit[] = {
+ 3,
+ 0x0030, 0x0039,
+ 0x0041, 0x0046,
+ 0x0061, 0x0066,
+}; /* CR_XDigit */
+
+/* 'Word': [[:Word:]] */
+static const OnigCodePoint CR_Word[] = {
+ 564,
+ 0x0030, 0x0039,
+ 0x0041, 0x005a,
+ 0x005f, 0x005f,
+ 0x0061, 0x007a,
+ 0x00aa, 0x00aa,
+ 0x00b5, 0x00b5,
+ 0x00ba, 0x00ba,
+ 0x00c0, 0x00d6,
+ 0x00d8, 0x00f6,
+ 0x00f8, 0x02c1,
+ 0x02c6, 0x02d1,
+ 0x02e0, 0x02e4,
+ 0x02ec, 0x02ec,
+ 0x02ee, 0x02ee,
+ 0x0300, 0x0374,
+ 0x0376, 0x0377,
+ 0x037a, 0x037d,
+ 0x0386, 0x0386,
+ 0x0388, 0x038a,
+ 0x038c, 0x038c,
+ 0x038e, 0x03a1,
+ 0x03a3, 0x03f5,
+ 0x03f7, 0x0481,
+ 0x0483, 0x0527,
+ 0x0531, 0x0556,
+ 0x0559, 0x0559,
+ 0x0561, 0x0587,
+ 0x0591, 0x05bd,
+ 0x05bf, 0x05bf,
+ 0x05c1, 0x05c2,
+ 0x05c4, 0x05c5,
+ 0x05c7, 0x05c7,
+ 0x05d0, 0x05ea,
+ 0x05f0, 0x05f2,
+ 0x0610, 0x061a,
+ 0x0620, 0x0669,
+ 0x066e, 0x06d3,
+ 0x06d5, 0x06dc,
+ 0x06df, 0x06e8,
+ 0x06ea, 0x06fc,
+ 0x06ff, 0x06ff,
+ 0x0710, 0x074a,
+ 0x074d, 0x07b1,
+ 0x07c0, 0x07f5,
+ 0x07fa, 0x07fa,
+ 0x0800, 0x082d,
+ 0x0840, 0x085b,
+ 0x08a0, 0x08a0,
+ 0x08a2, 0x08ac,
+ 0x08e4, 0x08fe,
+ 0x0900, 0x0963,
+ 0x0966, 0x096f,
+ 0x0971, 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, 0x09f1,
+ 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, 0x0aef,
+ 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, 0x0b6f,
+ 0x0b71, 0x0b71,
+ 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, 0x0bef,
+ 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,
+ 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, 0x0d6f,
+ 0x0d7a, 0x0d7f,
+ 0x0d82, 0x0d83,
+ 0x0d85, 0x0d96,
+ 0x0d9a, 0x0db1,
+ 0x0db3, 0x0dbb,
+ 0x0dbd, 0x0dbd,
+ 0x0dc0, 0x0dc6,
+ 0x0dca, 0x0dca,
+ 0x0dcf, 0x0dd4,
+ 0x0dd6, 0x0dd6,
+ 0x0dd8, 0x0ddf,
+ 0x0df2, 0x0df3,
+ 0x0e01, 0x0e3a,
+ 0x0e40, 0x0e4e,
+ 0x0e50, 0x0e59,
+ 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, 0x0f00,
+ 0x0f18, 0x0f19,
+ 0x0f20, 0x0f29,
+ 0x0f35, 0x0f35,
+ 0x0f37, 0x0f37,
+ 0x0f39, 0x0f39,
+ 0x0f3e, 0x0f47,
+ 0x0f49, 0x0f6c,
+ 0x0f71, 0x0f84,
+ 0x0f86, 0x0f97,
+ 0x0f99, 0x0fbc,
+ 0x0fc6, 0x0fc6,
+ 0x1000, 0x1049,
+ 0x1050, 0x109d,
+ 0x10a0, 0x10c5,
+ 0x10c7, 0x10c7,
+ 0x10cd, 0x10cd,
+ 0x10d0, 0x10fa,
+ 0x10fc, 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, 0x135f,
+ 0x1380, 0x138f,
+ 0x13a0, 0x13f4,
+ 0x1401, 0x166c,
+ 0x166f, 0x167f,
+ 0x1681, 0x169a,
+ 0x16a0, 0x16ea,
+ 0x16ee, 0x16f0,
+ 0x1700, 0x170c,
+ 0x170e, 0x1714,
+ 0x1720, 0x1734,
+ 0x1740, 0x1753,
+ 0x1760, 0x176c,
+ 0x176e, 0x1770,
+ 0x1772, 0x1773,
+ 0x1780, 0x17d3,
+ 0x17d7, 0x17d7,
+ 0x17dc, 0x17dd,
+ 0x17e0, 0x17e9,
+ 0x180b, 0x180d,
+ 0x1810, 0x1819,
+ 0x1820, 0x1877,
+ 0x1880, 0x18aa,
+ 0x18b0, 0x18f5,
+ 0x1900, 0x191c,
+ 0x1920, 0x192b,
+ 0x1930, 0x193b,
+ 0x1946, 0x196d,
+ 0x1970, 0x1974,
+ 0x1980, 0x19ab,
+ 0x19b0, 0x19c9,
+ 0x19d0, 0x19d9,
+ 0x1a00, 0x1a1b,
+ 0x1a20, 0x1a5e,
+ 0x1a60, 0x1a7c,
+ 0x1a7f, 0x1a89,
+ 0x1a90, 0x1a99,
+ 0x1aa7, 0x1aa7,
+ 0x1b00, 0x1b4b,
+ 0x1b50, 0x1b59,
+ 0x1b6b, 0x1b73,
+ 0x1b80, 0x1bf3,
+ 0x1c00, 0x1c37,
+ 0x1c40, 0x1c49,
+ 0x1c4d, 0x1c7d,
+ 0x1cd0, 0x1cd2,
+ 0x1cd4, 0x1cf6,
+ 0x1d00, 0x1de6,
+ 0x1dfc, 0x1f15,
+ 0x1f18, 0x1f1d,
+ 0x1f20, 0x1f45,
+ 0x1f48, 0x1f4d,
+ 0x1f50, 0x1f57,
+ 0x1f59, 0x1f59,
+ 0x1f5b, 0x1f5b,
+ 0x1f5d, 0x1f5d,
+ 0x1f5f, 0x1f7d,
+ 0x1f80, 0x1fb4,
+ 0x1fb6, 0x1fbc,
+ 0x1fbe, 0x1fbe,
+ 0x1fc2, 0x1fc4,
+ 0x1fc6, 0x1fcc,
+ 0x1fd0, 0x1fd3,
+ 0x1fd6, 0x1fdb,
+ 0x1fe0, 0x1fec,
+ 0x1ff2, 0x1ff4,
+ 0x1ff6, 0x1ffc,
+ 0x203f, 0x2040,
+ 0x2054, 0x2054,
+ 0x2071, 0x2071,
+ 0x207f, 0x207f,
+ 0x2090, 0x209c,
+ 0x20d0, 0x20f0,
+ 0x2102, 0x2102,
+ 0x2107, 0x2107,
+ 0x210a, 0x2113,
+ 0x2115, 0x2115,
+ 0x2119, 0x211d,
+ 0x2124, 0x2124,
+ 0x2126, 0x2126,
+ 0x2128, 0x2128,
+ 0x212a, 0x212d,
+ 0x212f, 0x2139,
+ 0x213c, 0x213f,
+ 0x2145, 0x2149,
+ 0x214e, 0x214e,
+ 0x2160, 0x2188,
+ 0x24b6, 0x24e9,
+ 0x2c00, 0x2c2e,
+ 0x2c30, 0x2c5e,
+ 0x2c60, 0x2ce4,
+ 0x2ceb, 0x2cf3,
+ 0x2d00, 0x2d25,
+ 0x2d27, 0x2d27,
+ 0x2d2d, 0x2d2d,
+ 0x2d30, 0x2d67,
+ 0x2d6f, 0x2d6f,
+ 0x2d7f, 0x2d96,
+ 0x2da0, 0x2da6,
+ 0x2da8, 0x2dae,
+ 0x2db0, 0x2db6,
+ 0x2db8, 0x2dbe,
+ 0x2dc0, 0x2dc6,
+ 0x2dc8, 0x2dce,
+ 0x2dd0, 0x2dd6,
+ 0x2dd8, 0x2dde,
+ 0x2de0, 0x2dff,
+ 0x2e2f, 0x2e2f,
+ 0x3005, 0x3007,
+ 0x3021, 0x302f,
+ 0x3031, 0x3035,
+ 0x3038, 0x303c,
+ 0x3041, 0x3096,
+ 0x3099, 0x309a,
+ 0x309d, 0x309f,
+ 0x30a1, 0x30fa,
+ 0x30fc, 0x30ff,
+ 0x3105, 0x312d,
+ 0x3131, 0x318e,
+ 0x31a0, 0x31ba,
+ 0x31f0, 0x31ff,
+ 0x3400, 0x4db5,
+ 0x4e00, 0x9fcc,
+ 0xa000, 0xa48c,
+ 0xa4d0, 0xa4fd,
+ 0xa500, 0xa60c,
+ 0xa610, 0xa62b,
+ 0xa640, 0xa672,
+ 0xa674, 0xa67d,
+ 0xa67f, 0xa697,
+ 0xa69f, 0xa6f1,
+ 0xa717, 0xa71f,
+ 0xa722, 0xa788,
+ 0xa78b, 0xa78e,
+ 0xa790, 0xa793,
+ 0xa7a0, 0xa7aa,
+ 0xa7f8, 0xa827,
+ 0xa840, 0xa873,
+ 0xa880, 0xa8c4,
+ 0xa8d0, 0xa8d9,
+ 0xa8e0, 0xa8f7,
+ 0xa8fb, 0xa8fb,
+ 0xa900, 0xa92d,
+ 0xa930, 0xa953,
+ 0xa960, 0xa97c,
+ 0xa980, 0xa9c0,
+ 0xa9cf, 0xa9d9,
+ 0xaa00, 0xaa36,
+ 0xaa40, 0xaa4d,
+ 0xaa50, 0xaa59,
+ 0xaa60, 0xaa76,
+ 0xaa7a, 0xaa7b,
+ 0xaa80, 0xaac2,
+ 0xaadb, 0xaadd,
+ 0xaae0, 0xaaef,
+ 0xaaf2, 0xaaf6,
+ 0xab01, 0xab06,
+ 0xab09, 0xab0e,
+ 0xab11, 0xab16,
+ 0xab20, 0xab26,
+ 0xab28, 0xab2e,
+ 0xabc0, 0xabea,
+ 0xabec, 0xabed,
+ 0xabf0, 0xabf9,
+ 0xac00, 0xd7a3,
+ 0xd7b0, 0xd7c6,
+ 0xd7cb, 0xd7fb,
+ 0xf900, 0xfa6d,
+ 0xfa70, 0xfad9,
+ 0xfb00, 0xfb06,
+ 0xfb13, 0xfb17,
+ 0xfb1d, 0xfb28,
+ 0xfb2a, 0xfb36,
+ 0xfb38, 0xfb3c,
+ 0xfb3e, 0xfb3e,
+ 0xfb40, 0xfb41,
+ 0xfb43, 0xfb44,
+ 0xfb46, 0xfbb1,
+ 0xfbd3, 0xfd3d,
+ 0xfd50, 0xfd8f,
+ 0xfd92, 0xfdc7,
+ 0xfdf0, 0xfdfb,
+ 0xfe00, 0xfe0f,
+ 0xfe20, 0xfe26,
+ 0xfe33, 0xfe34,
+ 0xfe4d, 0xfe4f,
+ 0xfe70, 0xfe74,
+ 0xfe76, 0xfefc,
+ 0xff10, 0xff19,
+ 0xff21, 0xff3a,
+ 0xff3f, 0xff3f,
+ 0xff41, 0xff5a,
+ 0xff66, 0xffbe,
+ 0xffc2, 0xffc7,
+ 0xffca, 0xffcf,
+ 0xffd2, 0xffd7,
+ 0xffda, 0xffdc,
+ 0x10000, 0x1000b,
+ 0x1000d, 0x10026,
+ 0x10028, 0x1003a,
+ 0x1003c, 0x1003d,
+ 0x1003f, 0x1004d,
+ 0x10050, 0x1005d,
+ 0x10080, 0x100fa,
+ 0x10140, 0x10174,
+ 0x101fd, 0x101fd,
+ 0x10280, 0x1029c,
+ 0x102a0, 0x102d0,
+ 0x10300, 0x1031e,
+ 0x10330, 0x1034a,
+ 0x10380, 0x1039d,
+ 0x103a0, 0x103c3,
+ 0x103c8, 0x103cf,
+ 0x103d1, 0x103d5,
+ 0x10400, 0x1049d,
+ 0x104a0, 0x104a9,
+ 0x10800, 0x10805,
+ 0x10808, 0x10808,
+ 0x1080a, 0x10835,
+ 0x10837, 0x10838,
+ 0x1083c, 0x1083c,
+ 0x1083f, 0x10855,
+ 0x10900, 0x10915,
+ 0x10920, 0x10939,
+ 0x10980, 0x109b7,
+ 0x109be, 0x109bf,
+ 0x10a00, 0x10a03,
+ 0x10a05, 0x10a06,
+ 0x10a0c, 0x10a13,
+ 0x10a15, 0x10a17,
+ 0x10a19, 0x10a33,
+ 0x10a38, 0x10a3a,
+ 0x10a3f, 0x10a3f,
+ 0x10a60, 0x10a7c,
+ 0x10b00, 0x10b35,
+ 0x10b40, 0x10b55,
+ 0x10b60, 0x10b72,
+ 0x10c00, 0x10c48,
+ 0x11000, 0x11046,
+ 0x11066, 0x1106f,
+ 0x11080, 0x110ba,
+ 0x110d0, 0x110e8,
+ 0x110f0, 0x110f9,
+ 0x11100, 0x11134,
+ 0x11136, 0x1113f,
+ 0x11180, 0x111c4,
+ 0x111d0, 0x111d9,
+ 0x11680, 0x116b7,
+ 0x116c0, 0x116c9,
+ 0x12000, 0x1236e,
+ 0x12400, 0x12462,
+ 0x13000, 0x1342e,
+ 0x16800, 0x16a38,
+ 0x16f00, 0x16f44,
+ 0x16f50, 0x16f7e,
+ 0x16f8f, 0x16f9f,
+ 0x1b000, 0x1b001,
+ 0x1d165, 0x1d169,
+ 0x1d16d, 0x1d172,
+ 0x1d17b, 0x1d182,
+ 0x1d185, 0x1d18b,
+ 0x1d1aa, 0x1d1ad,
+ 0x1d242, 0x1d244,
+ 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, 0x1d6c0,
+ 0x1d6c2, 0x1d6da,
+ 0x1d6dc, 0x1d6fa,
+ 0x1d6fc, 0x1d714,
+ 0x1d716, 0x1d734,
+ 0x1d736, 0x1d74e,
+ 0x1d750, 0x1d76e,
+ 0x1d770, 0x1d788,
+ 0x1d78a, 0x1d7a8,
+ 0x1d7aa, 0x1d7c2,
+ 0x1d7c4, 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,
+ 0x20000, 0x2a6d6,
+ 0x2a700, 0x2b734,
+ 0x2b740, 0x2b81d,
+ 0x2f800, 0x2fa1d,
+ 0xe0100, 0xe01ef,
+}; /* CR_Word */
+
+/* 'Alnum': [[:Alnum:]] */
+static const OnigCodePoint CR_Alnum[] = {
+ 566,
+ 0x0030, 0x0039,
+ 0x0041, 0x005a,
+ 0x0061, 0x007a,
+ 0x00aa, 0x00aa,
+ 0x00b5, 0x00b5,
+ 0x00ba, 0x00ba,
+ 0x00c0, 0x00d6,
+ 0x00d8, 0x00f6,
+ 0x00f8, 0x02c1,
+ 0x02c6, 0x02d1,
+ 0x02e0, 0x02e4,
+ 0x02ec, 0x02ec,
+ 0x02ee, 0x02ee,
+ 0x0345, 0x0345,
+ 0x0370, 0x0374,
+ 0x0376, 0x0377,
+ 0x037a, 0x037d,
+ 0x0386, 0x0386,
+ 0x0388, 0x038a,
+ 0x038c, 0x038c,
+ 0x038e, 0x03a1,
+ 0x03a3, 0x03f5,
+ 0x03f7, 0x0481,
+ 0x048a, 0x0527,
+ 0x0531, 0x0556,
+ 0x0559, 0x0559,
+ 0x0561, 0x0587,
+ 0x05b0, 0x05bd,
+ 0x05bf, 0x05bf,
+ 0x05c1, 0x05c2,
+ 0x05c4, 0x05c5,
+ 0x05c7, 0x05c7,
+ 0x05d0, 0x05ea,
+ 0x05f0, 0x05f2,
+ 0x0610, 0x061a,
+ 0x0620, 0x0657,
+ 0x0659, 0x0669,
+ 0x066e, 0x06d3,
+ 0x06d5, 0x06dc,
+ 0x06e1, 0x06e8,
+ 0x06ed, 0x06fc,
+ 0x06ff, 0x06ff,
+ 0x0710, 0x073f,
+ 0x074d, 0x07b1,
+ 0x07c0, 0x07ea,
+ 0x07f4, 0x07f5,
+ 0x07fa, 0x07fa,
+ 0x0800, 0x0817,
+ 0x081a, 0x082c,
+ 0x0840, 0x0858,
+ 0x08a0, 0x08a0,
+ 0x08a2, 0x08ac,
+ 0x08e4, 0x08e9,
+ 0x08f0, 0x08fe,
+ 0x0900, 0x093b,
+ 0x093d, 0x094c,
+ 0x094e, 0x0950,
+ 0x0955, 0x0963,
+ 0x0966, 0x096f,
+ 0x0971, 0x0977,
+ 0x0979, 0x097f,
+ 0x0981, 0x0983,
+ 0x0985, 0x098c,
+ 0x098f, 0x0990,
+ 0x0993, 0x09a8,
+ 0x09aa, 0x09b0,
+ 0x09b2, 0x09b2,
+ 0x09b6, 0x09b9,
+ 0x09bd, 0x09c4,
+ 0x09c7, 0x09c8,
+ 0x09cb, 0x09cc,
+ 0x09ce, 0x09ce,
+ 0x09d7, 0x09d7,
+ 0x09dc, 0x09dd,
+ 0x09df, 0x09e3,
+ 0x09e6, 0x09f1,
+ 0x0a01, 0x0a03,
+ 0x0a05, 0x0a0a,
+ 0x0a0f, 0x0a10,
+ 0x0a13, 0x0a28,
+ 0x0a2a, 0x0a30,
+ 0x0a32, 0x0a33,
+ 0x0a35, 0x0a36,
+ 0x0a38, 0x0a39,
+ 0x0a3e, 0x0a42,
+ 0x0a47, 0x0a48,
+ 0x0a4b, 0x0a4c,
+ 0x0a51, 0x0a51,
+ 0x0a59, 0x0a5c,
+ 0x0a5e, 0x0a5e,
+ 0x0a66, 0x0a75,
+ 0x0a81, 0x0a83,
+ 0x0a85, 0x0a8d,
+ 0x0a8f, 0x0a91,
+ 0x0a93, 0x0aa8,
+ 0x0aaa, 0x0ab0,
+ 0x0ab2, 0x0ab3,
+ 0x0ab5, 0x0ab9,
+ 0x0abd, 0x0ac5,
+ 0x0ac7, 0x0ac9,
+ 0x0acb, 0x0acc,
+ 0x0ad0, 0x0ad0,
+ 0x0ae0, 0x0ae3,
+ 0x0ae6, 0x0aef,
+ 0x0b01, 0x0b03,
+ 0x0b05, 0x0b0c,
+ 0x0b0f, 0x0b10,
+ 0x0b13, 0x0b28,
+ 0x0b2a, 0x0b30,
+ 0x0b32, 0x0b33,
+ 0x0b35, 0x0b39,
+ 0x0b3d, 0x0b44,
+ 0x0b47, 0x0b48,
+ 0x0b4b, 0x0b4c,
+ 0x0b56, 0x0b57,
+ 0x0b5c, 0x0b5d,
+ 0x0b5f, 0x0b63,
+ 0x0b66, 0x0b6f,
+ 0x0b71, 0x0b71,
+ 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, 0x0bcc,
+ 0x0bd0, 0x0bd0,
+ 0x0bd7, 0x0bd7,
+ 0x0be6, 0x0bef,
+ 0x0c01, 0x0c03,
+ 0x0c05, 0x0c0c,
+ 0x0c0e, 0x0c10,
+ 0x0c12, 0x0c28,
+ 0x0c2a, 0x0c33,
+ 0x0c35, 0x0c39,
+ 0x0c3d, 0x0c44,
+ 0x0c46, 0x0c48,
+ 0x0c4a, 0x0c4c,
+ 0x0c55, 0x0c56,
+ 0x0c58, 0x0c59,
+ 0x0c60, 0x0c63,
+ 0x0c66, 0x0c6f,
+ 0x0c82, 0x0c83,
+ 0x0c85, 0x0c8c,
+ 0x0c8e, 0x0c90,
+ 0x0c92, 0x0ca8,
+ 0x0caa, 0x0cb3,
+ 0x0cb5, 0x0cb9,
+ 0x0cbd, 0x0cc4,
+ 0x0cc6, 0x0cc8,
+ 0x0cca, 0x0ccc,
+ 0x0cd5, 0x0cd6,
+ 0x0cde, 0x0cde,
+ 0x0ce0, 0x0ce3,
+ 0x0ce6, 0x0cef,
+ 0x0cf1, 0x0cf2,
+ 0x0d02, 0x0d03,
+ 0x0d05, 0x0d0c,
+ 0x0d0e, 0x0d10,
+ 0x0d12, 0x0d3a,
+ 0x0d3d, 0x0d44,
+ 0x0d46, 0x0d48,
+ 0x0d4a, 0x0d4c,
+ 0x0d4e, 0x0d4e,
+ 0x0d57, 0x0d57,
+ 0x0d60, 0x0d63,
+ 0x0d66, 0x0d6f,
+ 0x0d7a, 0x0d7f,
+ 0x0d82, 0x0d83,
+ 0x0d85, 0x0d96,
+ 0x0d9a, 0x0db1,
+ 0x0db3, 0x0dbb,
+ 0x0dbd, 0x0dbd,
+ 0x0dc0, 0x0dc6,
+ 0x0dcf, 0x0dd4,
+ 0x0dd6, 0x0dd6,
+ 0x0dd8, 0x0ddf,
+ 0x0df2, 0x0df3,
+ 0x0e01, 0x0e3a,
+ 0x0e40, 0x0e46,
+ 0x0e4d, 0x0e4d,
+ 0x0e50, 0x0e59,
+ 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,
+ 0x0ecd, 0x0ecd,
+ 0x0ed0, 0x0ed9,
+ 0x0edc, 0x0edf,
+ 0x0f00, 0x0f00,
+ 0x0f20, 0x0f29,
+ 0x0f40, 0x0f47,
+ 0x0f49, 0x0f6c,
+ 0x0f71, 0x0f81,
+ 0x0f88, 0x0f97,
+ 0x0f99, 0x0fbc,
+ 0x1000, 0x1036,
+ 0x1038, 0x1038,
+ 0x103b, 0x1049,
+ 0x1050, 0x1062,
+ 0x1065, 0x1068,
+ 0x106e, 0x1086,
+ 0x108e, 0x108e,
+ 0x1090, 0x1099,
+ 0x109c, 0x109d,
+ 0x10a0, 0x10c5,
+ 0x10c7, 0x10c7,
+ 0x10cd, 0x10cd,
+ 0x10d0, 0x10fa,
+ 0x10fc, 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,
+ 0x135f, 0x135f,
+ 0x1380, 0x138f,
+ 0x13a0, 0x13f4,
+ 0x1401, 0x166c,
+ 0x166f, 0x167f,
+ 0x1681, 0x169a,
+ 0x16a0, 0x16ea,
+ 0x16ee, 0x16f0,
+ 0x1700, 0x170c,
+ 0x170e, 0x1713,
+ 0x1720, 0x1733,
+ 0x1740, 0x1753,
+ 0x1760, 0x176c,
+ 0x176e, 0x1770,
+ 0x1772, 0x1773,
+ 0x1780, 0x17b3,
+ 0x17b6, 0x17c8,
+ 0x17d7, 0x17d7,
+ 0x17dc, 0x17dc,
+ 0x17e0, 0x17e9,
+ 0x1810, 0x1819,
+ 0x1820, 0x1877,
+ 0x1880, 0x18aa,
+ 0x18b0, 0x18f5,
+ 0x1900, 0x191c,
+ 0x1920, 0x192b,
+ 0x1930, 0x1938,
+ 0x1946, 0x196d,
+ 0x1970, 0x1974,
+ 0x1980, 0x19ab,
+ 0x19b0, 0x19c9,
+ 0x19d0, 0x19d9,
+ 0x1a00, 0x1a1b,
+ 0x1a20, 0x1a5e,
+ 0x1a61, 0x1a74,
+ 0x1a80, 0x1a89,
+ 0x1a90, 0x1a99,
+ 0x1aa7, 0x1aa7,
+ 0x1b00, 0x1b33,
+ 0x1b35, 0x1b43,
+ 0x1b45, 0x1b4b,
+ 0x1b50, 0x1b59,
+ 0x1b80, 0x1ba9,
+ 0x1bac, 0x1be5,
+ 0x1be7, 0x1bf1,
+ 0x1c00, 0x1c35,
+ 0x1c40, 0x1c49,
+ 0x1c4d, 0x1c7d,
+ 0x1ce9, 0x1cec,
+ 0x1cee, 0x1cf3,
+ 0x1cf5, 0x1cf6,
+ 0x1d00, 0x1dbf,
+ 0x1e00, 0x1f15,
+ 0x1f18, 0x1f1d,
+ 0x1f20, 0x1f45,
+ 0x1f48, 0x1f4d,
+ 0x1f50, 0x1f57,
+ 0x1f59, 0x1f59,
+ 0x1f5b, 0x1f5b,
+ 0x1f5d, 0x1f5d,
+ 0x1f5f, 0x1f7d,
+ 0x1f80, 0x1fb4,
+ 0x1fb6, 0x1fbc,
+ 0x1fbe, 0x1fbe,
+ 0x1fc2, 0x1fc4,
+ 0x1fc6, 0x1fcc,
+ 0x1fd0, 0x1fd3,
+ 0x1fd6, 0x1fdb,
+ 0x1fe0, 0x1fec,
+ 0x1ff2, 0x1ff4,
+ 0x1ff6, 0x1ffc,
+ 0x2071, 0x2071,
+ 0x207f, 0x207f,
+ 0x2090, 0x209c,
+ 0x2102, 0x2102,
+ 0x2107, 0x2107,
+ 0x210a, 0x2113,
+ 0x2115, 0x2115,
+ 0x2119, 0x211d,
+ 0x2124, 0x2124,
+ 0x2126, 0x2126,
+ 0x2128, 0x2128,
+ 0x212a, 0x212d,
+ 0x212f, 0x2139,
+ 0x213c, 0x213f,
+ 0x2145, 0x2149,
+ 0x214e, 0x214e,
+ 0x2160, 0x2188,
+ 0x24b6, 0x24e9,
+ 0x2c00, 0x2c2e,
+ 0x2c30, 0x2c5e,
+ 0x2c60, 0x2ce4,
+ 0x2ceb, 0x2cee,
+ 0x2cf2, 0x2cf3,
+ 0x2d00, 0x2d25,
+ 0x2d27, 0x2d27,
+ 0x2d2d, 0x2d2d,
+ 0x2d30, 0x2d67,
+ 0x2d6f, 0x2d6f,
+ 0x2d80, 0x2d96,
+ 0x2da0, 0x2da6,
+ 0x2da8, 0x2dae,
+ 0x2db0, 0x2db6,
+ 0x2db8, 0x2dbe,
+ 0x2dc0, 0x2dc6,
+ 0x2dc8, 0x2dce,
+ 0x2dd0, 0x2dd6,
+ 0x2dd8, 0x2dde,
+ 0x2de0, 0x2dff,
+ 0x2e2f, 0x2e2f,
+ 0x3005, 0x3007,
+ 0x3021, 0x3029,
+ 0x3031, 0x3035,
+ 0x3038, 0x303c,
+ 0x3041, 0x3096,
+ 0x309d, 0x309f,
+ 0x30a1, 0x30fa,
+ 0x30fc, 0x30ff,
+ 0x3105, 0x312d,
+ 0x3131, 0x318e,
+ 0x31a0, 0x31ba,
+ 0x31f0, 0x31ff,
+ 0x3400, 0x4db5,
+ 0x4e00, 0x9fcc,
+ 0xa000, 0xa48c,
+ 0xa4d0, 0xa4fd,
+ 0xa500, 0xa60c,
+ 0xa610, 0xa62b,
+ 0xa640, 0xa66e,
+ 0xa674, 0xa67b,
+ 0xa67f, 0xa697,
+ 0xa69f, 0xa6ef,
+ 0xa717, 0xa71f,
+ 0xa722, 0xa788,
+ 0xa78b, 0xa78e,
+ 0xa790, 0xa793,
+ 0xa7a0, 0xa7aa,
+ 0xa7f8, 0xa801,
+ 0xa803, 0xa805,
+ 0xa807, 0xa80a,
+ 0xa80c, 0xa827,
+ 0xa840, 0xa873,
+ 0xa880, 0xa8c3,
+ 0xa8d0, 0xa8d9,
+ 0xa8f2, 0xa8f7,
+ 0xa8fb, 0xa8fb,
+ 0xa900, 0xa92a,
+ 0xa930, 0xa952,
+ 0xa960, 0xa97c,
+ 0xa980, 0xa9b2,
+ 0xa9b4, 0xa9bf,
+ 0xa9cf, 0xa9d9,
+ 0xaa00, 0xaa36,
+ 0xaa40, 0xaa4d,
+ 0xaa50, 0xaa59,
+ 0xaa60, 0xaa76,
+ 0xaa7a, 0xaa7a,
+ 0xaa80, 0xaabe,
+ 0xaac0, 0xaac0,
+ 0xaac2, 0xaac2,
+ 0xaadb, 0xaadd,
+ 0xaae0, 0xaaef,
+ 0xaaf2, 0xaaf5,
+ 0xab01, 0xab06,
+ 0xab09, 0xab0e,
+ 0xab11, 0xab16,
+ 0xab20, 0xab26,
+ 0xab28, 0xab2e,
+ 0xabc0, 0xabea,
+ 0xabf0, 0xabf9,
+ 0xac00, 0xd7a3,
+ 0xd7b0, 0xd7c6,
+ 0xd7cb, 0xd7fb,
+ 0xf900, 0xfa6d,
+ 0xfa70, 0xfad9,
+ 0xfb00, 0xfb06,
+ 0xfb13, 0xfb17,
+ 0xfb1d, 0xfb28,
+ 0xfb2a, 0xfb36,
+ 0xfb38, 0xfb3c,
+ 0xfb3e, 0xfb3e,
+ 0xfb40, 0xfb41,
+ 0xfb43, 0xfb44,
+ 0xfb46, 0xfbb1,
+ 0xfbd3, 0xfd3d,
+ 0xfd50, 0xfd8f,
+ 0xfd92, 0xfdc7,
+ 0xfdf0, 0xfdfb,
+ 0xfe70, 0xfe74,
+ 0xfe76, 0xfefc,
+ 0xff10, 0xff19,
+ 0xff21, 0xff3a,
+ 0xff41, 0xff5a,
+ 0xff66, 0xffbe,
+ 0xffc2, 0xffc7,
+ 0xffca, 0xffcf,
+ 0xffd2, 0xffd7,
+ 0xffda, 0xffdc,
+ 0x10000, 0x1000b,
+ 0x1000d, 0x10026,
+ 0x10028, 0x1003a,
+ 0x1003c, 0x1003d,
+ 0x1003f, 0x1004d,
+ 0x10050, 0x1005d,
+ 0x10080, 0x100fa,
+ 0x10140, 0x10174,
+ 0x10280, 0x1029c,
+ 0x102a0, 0x102d0,
+ 0x10300, 0x1031e,
+ 0x10330, 0x1034a,
+ 0x10380, 0x1039d,
+ 0x103a0, 0x103c3,
+ 0x103c8, 0x103cf,
+ 0x103d1, 0x103d5,
+ 0x10400, 0x1049d,
+ 0x104a0, 0x104a9,
+ 0x10800, 0x10805,
+ 0x10808, 0x10808,
+ 0x1080a, 0x10835,
+ 0x10837, 0x10838,
+ 0x1083c, 0x1083c,
+ 0x1083f, 0x10855,
+ 0x10900, 0x10915,
+ 0x10920, 0x10939,
+ 0x10980, 0x109b7,
+ 0x109be, 0x109bf,
+ 0x10a00, 0x10a03,
+ 0x10a05, 0x10a06,
+ 0x10a0c, 0x10a13,
+ 0x10a15, 0x10a17,
+ 0x10a19, 0x10a33,
+ 0x10a60, 0x10a7c,
+ 0x10b00, 0x10b35,
+ 0x10b40, 0x10b55,
+ 0x10b60, 0x10b72,
+ 0x10c00, 0x10c48,
+ 0x11000, 0x11045,
+ 0x11066, 0x1106f,
+ 0x11082, 0x110b8,
+ 0x110d0, 0x110e8,
+ 0x110f0, 0x110f9,
+ 0x11100, 0x11132,
+ 0x11136, 0x1113f,
+ 0x11180, 0x111bf,
+ 0x111c1, 0x111c4,
+ 0x111d0, 0x111d9,
+ 0x11680, 0x116b5,
+ 0x116c0, 0x116c9,
+ 0x12000, 0x1236e,
+ 0x12400, 0x12462,
+ 0x13000, 0x1342e,
+ 0x16800, 0x16a38,
+ 0x16f00, 0x16f44,
+ 0x16f50, 0x16f7e,
+ 0x16f93, 0x16f9f,
+ 0x1b000, 0x1b001,
+ 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, 0x1d6c0,
+ 0x1d6c2, 0x1d6da,
+ 0x1d6dc, 0x1d6fa,
+ 0x1d6fc, 0x1d714,
+ 0x1d716, 0x1d734,
+ 0x1d736, 0x1d74e,
+ 0x1d750, 0x1d76e,
+ 0x1d770, 0x1d788,
+ 0x1d78a, 0x1d7a8,
+ 0x1d7aa, 0x1d7c2,
+ 0x1d7c4, 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,
+ 0x20000, 0x2a6d6,
+ 0x2a700, 0x2b734,
+ 0x2b740, 0x2b81d,
+ 0x2f800, 0x2fa1d,
+}; /* CR_Alnum */
+
+/* 'ASCII': [[:ASCII:]] */
+static const OnigCodePoint CR_ASCII[] = {
+ 1,
+ 0x0000, 0x007f,
+}; /* CR_ASCII */
+
#ifdef USE_UNICODE_PROPERTIES
/* 'Any': - */
static const OnigCodePoint CR_Any[] = {
@@ -10,7 +4277,7 @@ static const OnigCodePoint CR_Any[] = {
/* 'Assigned': - */
static const OnigCodePoint CR_Assigned[] = {
- 501,
+ 539,
0x0000, 0x0377,
0x037a, 0x037e,
0x0384, 0x038a,
@@ -21,10 +4288,11 @@ static const OnigCodePoint CR_Assigned[] = {
0x0559, 0x055f,
0x0561, 0x0587,
0x0589, 0x058a,
+ 0x058f, 0x058f,
0x0591, 0x05c7,
0x05d0, 0x05ea,
0x05f0, 0x05f4,
- 0x0600, 0x0603,
+ 0x0600, 0x0604,
0x0606, 0x061b,
0x061e, 0x070d,
0x070f, 0x074a,
@@ -34,6 +4302,9 @@ static const OnigCodePoint CR_Assigned[] = {
0x0830, 0x083e,
0x0840, 0x085b,
0x085e, 0x085e,
+ 0x08a0, 0x08a0,
+ 0x08a2, 0x08ac,
+ 0x08e4, 0x08fe,
0x0900, 0x0977,
0x0979, 0x097f,
0x0981, 0x0983,
@@ -78,8 +4349,7 @@ static const OnigCodePoint CR_Assigned[] = {
0x0acb, 0x0acd,
0x0ad0, 0x0ad0,
0x0ae0, 0x0ae3,
- 0x0ae6, 0x0aef,
- 0x0af1, 0x0af1,
+ 0x0ae6, 0x0af1,
0x0b01, 0x0b03,
0x0b05, 0x0b0c,
0x0b0f, 0x0b10,
@@ -179,7 +4449,7 @@ static const OnigCodePoint CR_Assigned[] = {
0x0ec6, 0x0ec6,
0x0ec8, 0x0ecd,
0x0ed0, 0x0ed9,
- 0x0edc, 0x0edd,
+ 0x0edc, 0x0edf,
0x0f00, 0x0f47,
0x0f49, 0x0f6c,
0x0f71, 0x0f97,
@@ -187,8 +4457,9 @@ static const OnigCodePoint CR_Assigned[] = {
0x0fbe, 0x0fcc,
0x0fce, 0x0fda,
0x1000, 0x10c5,
- 0x10d0, 0x10fc,
- 0x1100, 0x1248,
+ 0x10c7, 0x10c7,
+ 0x10cd, 0x10cd,
+ 0x10d0, 0x1248,
0x124a, 0x124d,
0x1250, 0x1256,
0x1258, 0x1258,
@@ -241,13 +4512,12 @@ static const OnigCodePoint CR_Assigned[] = {
0x1aa0, 0x1aad,
0x1b00, 0x1b4b,
0x1b50, 0x1b7c,
- 0x1b80, 0x1baa,
- 0x1bae, 0x1bb9,
- 0x1bc0, 0x1bf3,
+ 0x1b80, 0x1bf3,
0x1bfc, 0x1c37,
0x1c3b, 0x1c49,
0x1c4d, 0x1c7f,
- 0x1cd0, 0x1cf2,
+ 0x1cc0, 0x1cc7,
+ 0x1cd0, 0x1cf6,
0x1d00, 0x1de6,
0x1dfc, 0x1f15,
0x1f18, 0x1f1d,
@@ -276,15 +4546,15 @@ static const OnigCodePoint CR_Assigned[] = {
0x2400, 0x2426,
0x2440, 0x244a,
0x2460, 0x26ff,
- 0x2701, 0x27ca,
- 0x27cc, 0x27cc,
- 0x27ce, 0x2b4c,
+ 0x2701, 0x2b4c,
0x2b50, 0x2b59,
0x2c00, 0x2c2e,
0x2c30, 0x2c5e,
- 0x2c60, 0x2cf1,
+ 0x2c60, 0x2cf3,
0x2cf9, 0x2d25,
- 0x2d30, 0x2d65,
+ 0x2d27, 0x2d27,
+ 0x2d2d, 0x2d2d,
+ 0x2d30, 0x2d67,
0x2d6f, 0x2d70,
0x2d7f, 0x2d96,
0x2da0, 0x2da6,
@@ -295,7 +4565,7 @@ static const OnigCodePoint CR_Assigned[] = {
0x2dc8, 0x2dce,
0x2dd0, 0x2dd6,
0x2dd8, 0x2dde,
- 0x2de0, 0x2e31,
+ 0x2de0, 0x2e3b,
0x2e80, 0x2e99,
0x2e9b, 0x2ef3,
0x2f00, 0x2fd5,
@@ -310,17 +4580,16 @@ static const OnigCodePoint CR_Assigned[] = {
0x31f0, 0x321e,
0x3220, 0x32fe,
0x3300, 0x4db5,
- 0x4dc0, 0x9fcb,
+ 0x4dc0, 0x9fcc,
0xa000, 0xa48c,
0xa490, 0xa4c6,
0xa4d0, 0xa62b,
- 0xa640, 0xa673,
- 0xa67c, 0xa697,
- 0xa6a0, 0xa6f7,
+ 0xa640, 0xa697,
+ 0xa69f, 0xa6f7,
0xa700, 0xa78e,
- 0xa790, 0xa791,
- 0xa7a0, 0xa7a9,
- 0xa7fa, 0xa82b,
+ 0xa790, 0xa793,
+ 0xa7a0, 0xa7aa,
+ 0xa7f8, 0xa82b,
0xa830, 0xa839,
0xa840, 0xa877,
0xa880, 0xa8c4,
@@ -336,7 +4605,7 @@ static const OnigCodePoint CR_Assigned[] = {
0xaa50, 0xaa59,
0xaa5c, 0xaa7b,
0xaa80, 0xaac2,
- 0xaadb, 0xaadf,
+ 0xaadb, 0xaaf6,
0xab01, 0xab06,
0xab09, 0xab0e,
0xab11, 0xab16,
@@ -347,8 +4616,7 @@ static const OnigCodePoint CR_Assigned[] = {
0xac00, 0xd7a3,
0xd7b0, 0xd7c6,
0xd7cb, 0xd7fb,
- 0xd800, 0xfa2d,
- 0xfa30, 0xfa6d,
+ 0xd800, 0xfa6d,
0xfa70, 0xfad9,
0xfb00, 0xfb06,
0xfb13, 0xfb17,
@@ -410,6 +4678,8 @@ static const OnigCodePoint CR_Assigned[] = {
0x10900, 0x1091b,
0x1091f, 0x10939,
0x1093f, 0x1093f,
+ 0x10980, 0x109b7,
+ 0x109be, 0x109bf,
0x10a00, 0x10a03,
0x10a05, 0x10a06,
0x10a0c, 0x10a13,
@@ -428,11 +4698,22 @@ static const OnigCodePoint CR_Assigned[] = {
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,
@@ -461,6 +4742,40 @@ static const OnigCodePoint CR_Assigned[] = {
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,
@@ -469,7 +4784,7 @@ static const OnigCodePoint CR_Assigned[] = {
0x1f0d1, 0x1f0df,
0x1f100, 0x1f10a,
0x1f110, 0x1f12e,
- 0x1f130, 0x1f169,
+ 0x1f130, 0x1f16b,
0x1f170, 0x1f19a,
0x1f1e6, 0x1f202,
0x1f210, 0x1f23a,
@@ -487,19 +4802,9 @@ static const OnigCodePoint CR_Assigned[] = {
0x1f442, 0x1f4f7,
0x1f4f9, 0x1f4fc,
0x1f500, 0x1f53d,
+ 0x1f540, 0x1f543,
0x1f550, 0x1f567,
- 0x1f5fb, 0x1f5ff,
- 0x1f601, 0x1f610,
- 0x1f612, 0x1f614,
- 0x1f616, 0x1f616,
- 0x1f618, 0x1f618,
- 0x1f61a, 0x1f61a,
- 0x1f61c, 0x1f61e,
- 0x1f620, 0x1f625,
- 0x1f628, 0x1f62b,
- 0x1f62d, 0x1f62d,
- 0x1f630, 0x1f633,
- 0x1f635, 0x1f640,
+ 0x1f5fb, 0x1f640,
0x1f645, 0x1f64f,
0x1f680, 0x1f6c5,
0x1f700, 0x1f773,
@@ -516,44 +4821,560 @@ static const OnigCodePoint CR_Assigned[] = {
/* 'C': Major Category */
static const OnigCodePoint CR_C[] = {
- 20,
+ 541,
0x0000, 0x001f,
0x007f, 0x009f,
0x00ad, 0x00ad,
- 0x0600, 0x0603,
+ 0x0378, 0x0379,
+ 0x037f, 0x0383,
+ 0x038b, 0x038b,
+ 0x038d, 0x038d,
+ 0x03a2, 0x03a2,
+ 0x0528, 0x0530,
+ 0x0557, 0x0558,
+ 0x0560, 0x0560,
+ 0x0588, 0x0588,
+ 0x058b, 0x058e,
+ 0x0590, 0x0590,
+ 0x05c8, 0x05cf,
+ 0x05eb, 0x05ef,
+ 0x05f5, 0x0605,
+ 0x061c, 0x061d,
0x06dd, 0x06dd,
- 0x070f, 0x070f,
- 0x17b4, 0x17b5,
+ 0x070e, 0x070f,
+ 0x074b, 0x074c,
+ 0x07b2, 0x07bf,
+ 0x07fb, 0x07ff,
+ 0x082e, 0x082f,
+ 0x083f, 0x083f,
+ 0x085c, 0x085d,
+ 0x085f, 0x089f,
+ 0x08a1, 0x08a1,
+ 0x08ad, 0x08e3,
+ 0x08ff, 0x08ff,
+ 0x0978, 0x0978,
+ 0x0980, 0x0980,
+ 0x0984, 0x0984,
+ 0x098d, 0x098e,
+ 0x0991, 0x0992,
+ 0x09a9, 0x09a9,
+ 0x09b1, 0x09b1,
+ 0x09b3, 0x09b5,
+ 0x09ba, 0x09bb,
+ 0x09c5, 0x09c6,
+ 0x09c9, 0x09ca,
+ 0x09cf, 0x09d6,
+ 0x09d8, 0x09db,
+ 0x09de, 0x09de,
+ 0x09e4, 0x09e5,
+ 0x09fc, 0x0a00,
+ 0x0a04, 0x0a04,
+ 0x0a0b, 0x0a0e,
+ 0x0a11, 0x0a12,
+ 0x0a29, 0x0a29,
+ 0x0a31, 0x0a31,
+ 0x0a34, 0x0a34,
+ 0x0a37, 0x0a37,
+ 0x0a3a, 0x0a3b,
+ 0x0a3d, 0x0a3d,
+ 0x0a43, 0x0a46,
+ 0x0a49, 0x0a4a,
+ 0x0a4e, 0x0a50,
+ 0x0a52, 0x0a58,
+ 0x0a5d, 0x0a5d,
+ 0x0a5f, 0x0a65,
+ 0x0a76, 0x0a80,
+ 0x0a84, 0x0a84,
+ 0x0a8e, 0x0a8e,
+ 0x0a92, 0x0a92,
+ 0x0aa9, 0x0aa9,
+ 0x0ab1, 0x0ab1,
+ 0x0ab4, 0x0ab4,
+ 0x0aba, 0x0abb,
+ 0x0ac6, 0x0ac6,
+ 0x0aca, 0x0aca,
+ 0x0ace, 0x0acf,
+ 0x0ad1, 0x0adf,
+ 0x0ae4, 0x0ae5,
+ 0x0af2, 0x0b00,
+ 0x0b04, 0x0b04,
+ 0x0b0d, 0x0b0e,
+ 0x0b11, 0x0b12,
+ 0x0b29, 0x0b29,
+ 0x0b31, 0x0b31,
+ 0x0b34, 0x0b34,
+ 0x0b3a, 0x0b3b,
+ 0x0b45, 0x0b46,
+ 0x0b49, 0x0b4a,
+ 0x0b4e, 0x0b55,
+ 0x0b58, 0x0b5b,
+ 0x0b5e, 0x0b5e,
+ 0x0b64, 0x0b65,
+ 0x0b78, 0x0b81,
+ 0x0b84, 0x0b84,
+ 0x0b8b, 0x0b8d,
+ 0x0b91, 0x0b91,
+ 0x0b96, 0x0b98,
+ 0x0b9b, 0x0b9b,
+ 0x0b9d, 0x0b9d,
+ 0x0ba0, 0x0ba2,
+ 0x0ba5, 0x0ba7,
+ 0x0bab, 0x0bad,
+ 0x0bba, 0x0bbd,
+ 0x0bc3, 0x0bc5,
+ 0x0bc9, 0x0bc9,
+ 0x0bce, 0x0bcf,
+ 0x0bd1, 0x0bd6,
+ 0x0bd8, 0x0be5,
+ 0x0bfb, 0x0c00,
+ 0x0c04, 0x0c04,
+ 0x0c0d, 0x0c0d,
+ 0x0c11, 0x0c11,
+ 0x0c29, 0x0c29,
+ 0x0c34, 0x0c34,
+ 0x0c3a, 0x0c3c,
+ 0x0c45, 0x0c45,
+ 0x0c49, 0x0c49,
+ 0x0c4e, 0x0c54,
+ 0x0c57, 0x0c57,
+ 0x0c5a, 0x0c5f,
+ 0x0c64, 0x0c65,
+ 0x0c70, 0x0c77,
+ 0x0c80, 0x0c81,
+ 0x0c84, 0x0c84,
+ 0x0c8d, 0x0c8d,
+ 0x0c91, 0x0c91,
+ 0x0ca9, 0x0ca9,
+ 0x0cb4, 0x0cb4,
+ 0x0cba, 0x0cbb,
+ 0x0cc5, 0x0cc5,
+ 0x0cc9, 0x0cc9,
+ 0x0cce, 0x0cd4,
+ 0x0cd7, 0x0cdd,
+ 0x0cdf, 0x0cdf,
+ 0x0ce4, 0x0ce5,
+ 0x0cf0, 0x0cf0,
+ 0x0cf3, 0x0d01,
+ 0x0d04, 0x0d04,
+ 0x0d0d, 0x0d0d,
+ 0x0d11, 0x0d11,
+ 0x0d3b, 0x0d3c,
+ 0x0d45, 0x0d45,
+ 0x0d49, 0x0d49,
+ 0x0d4f, 0x0d56,
+ 0x0d58, 0x0d5f,
+ 0x0d64, 0x0d65,
+ 0x0d76, 0x0d78,
+ 0x0d80, 0x0d81,
+ 0x0d84, 0x0d84,
+ 0x0d97, 0x0d99,
+ 0x0db2, 0x0db2,
+ 0x0dbc, 0x0dbc,
+ 0x0dbe, 0x0dbf,
+ 0x0dc7, 0x0dc9,
+ 0x0dcb, 0x0dce,
+ 0x0dd5, 0x0dd5,
+ 0x0dd7, 0x0dd7,
+ 0x0de0, 0x0df1,
+ 0x0df5, 0x0e00,
+ 0x0e3b, 0x0e3e,
+ 0x0e5c, 0x0e80,
+ 0x0e83, 0x0e83,
+ 0x0e85, 0x0e86,
+ 0x0e89, 0x0e89,
+ 0x0e8b, 0x0e8c,
+ 0x0e8e, 0x0e93,
+ 0x0e98, 0x0e98,
+ 0x0ea0, 0x0ea0,
+ 0x0ea4, 0x0ea4,
+ 0x0ea6, 0x0ea6,
+ 0x0ea8, 0x0ea9,
+ 0x0eac, 0x0eac,
+ 0x0eba, 0x0eba,
+ 0x0ebe, 0x0ebf,
+ 0x0ec5, 0x0ec5,
+ 0x0ec7, 0x0ec7,
+ 0x0ece, 0x0ecf,
+ 0x0eda, 0x0edb,
+ 0x0ee0, 0x0eff,
+ 0x0f48, 0x0f48,
+ 0x0f6d, 0x0f70,
+ 0x0f98, 0x0f98,
+ 0x0fbd, 0x0fbd,
+ 0x0fcd, 0x0fcd,
+ 0x0fdb, 0x0fff,
+ 0x10c6, 0x10c6,
+ 0x10c8, 0x10cc,
+ 0x10ce, 0x10cf,
+ 0x1249, 0x1249,
+ 0x124e, 0x124f,
+ 0x1257, 0x1257,
+ 0x1259, 0x1259,
+ 0x125e, 0x125f,
+ 0x1289, 0x1289,
+ 0x128e, 0x128f,
+ 0x12b1, 0x12b1,
+ 0x12b6, 0x12b7,
+ 0x12bf, 0x12bf,
+ 0x12c1, 0x12c1,
+ 0x12c6, 0x12c7,
+ 0x12d7, 0x12d7,
+ 0x1311, 0x1311,
+ 0x1316, 0x1317,
+ 0x135b, 0x135c,
+ 0x137d, 0x137f,
+ 0x139a, 0x139f,
+ 0x13f5, 0x13ff,
+ 0x169d, 0x169f,
+ 0x16f1, 0x16ff,
+ 0x170d, 0x170d,
+ 0x1715, 0x171f,
+ 0x1737, 0x173f,
+ 0x1754, 0x175f,
+ 0x176d, 0x176d,
+ 0x1771, 0x1771,
+ 0x1774, 0x177f,
+ 0x17de, 0x17df,
+ 0x17ea, 0x17ef,
+ 0x17fa, 0x17ff,
+ 0x180f, 0x180f,
+ 0x181a, 0x181f,
+ 0x1878, 0x187f,
+ 0x18ab, 0x18af,
+ 0x18f6, 0x18ff,
+ 0x191d, 0x191f,
+ 0x192c, 0x192f,
+ 0x193c, 0x193f,
+ 0x1941, 0x1943,
+ 0x196e, 0x196f,
+ 0x1975, 0x197f,
+ 0x19ac, 0x19af,
+ 0x19ca, 0x19cf,
+ 0x19db, 0x19dd,
+ 0x1a1c, 0x1a1d,
+ 0x1a5f, 0x1a5f,
+ 0x1a7d, 0x1a7e,
+ 0x1a8a, 0x1a8f,
+ 0x1a9a, 0x1a9f,
+ 0x1aae, 0x1aff,
+ 0x1b4c, 0x1b4f,
+ 0x1b7d, 0x1b7f,
+ 0x1bf4, 0x1bfb,
+ 0x1c38, 0x1c3a,
+ 0x1c4a, 0x1c4c,
+ 0x1c80, 0x1cbf,
+ 0x1cc8, 0x1ccf,
+ 0x1cf7, 0x1cff,
+ 0x1de7, 0x1dfb,
+ 0x1f16, 0x1f17,
+ 0x1f1e, 0x1f1f,
+ 0x1f46, 0x1f47,
+ 0x1f4e, 0x1f4f,
+ 0x1f58, 0x1f58,
+ 0x1f5a, 0x1f5a,
+ 0x1f5c, 0x1f5c,
+ 0x1f5e, 0x1f5e,
+ 0x1f7e, 0x1f7f,
+ 0x1fb5, 0x1fb5,
+ 0x1fc5, 0x1fc5,
+ 0x1fd4, 0x1fd5,
+ 0x1fdc, 0x1fdc,
+ 0x1ff0, 0x1ff1,
+ 0x1ff5, 0x1ff5,
+ 0x1fff, 0x1fff,
0x200b, 0x200f,
0x202a, 0x202e,
- 0x2060, 0x2064,
- 0x206a, 0x206f,
- 0xd800, 0xf8ff,
- 0xfeff, 0xfeff,
- 0xfff9, 0xfffb,
+ 0x2060, 0x206f,
+ 0x2072, 0x2073,
+ 0x208f, 0x208f,
+ 0x209d, 0x209f,
+ 0x20ba, 0x20cf,
+ 0x20f1, 0x20ff,
+ 0x218a, 0x218f,
+ 0x23f4, 0x23ff,
+ 0x2427, 0x243f,
+ 0x244b, 0x245f,
+ 0x2700, 0x2700,
+ 0x2b4d, 0x2b4f,
+ 0x2b5a, 0x2bff,
+ 0x2c2f, 0x2c2f,
+ 0x2c5f, 0x2c5f,
+ 0x2cf4, 0x2cf8,
+ 0x2d26, 0x2d26,
+ 0x2d28, 0x2d2c,
+ 0x2d2e, 0x2d2f,
+ 0x2d68, 0x2d6e,
+ 0x2d71, 0x2d7e,
+ 0x2d97, 0x2d9f,
+ 0x2da7, 0x2da7,
+ 0x2daf, 0x2daf,
+ 0x2db7, 0x2db7,
+ 0x2dbf, 0x2dbf,
+ 0x2dc7, 0x2dc7,
+ 0x2dcf, 0x2dcf,
+ 0x2dd7, 0x2dd7,
+ 0x2ddf, 0x2ddf,
+ 0x2e3c, 0x2e7f,
+ 0x2e9a, 0x2e9a,
+ 0x2ef4, 0x2eff,
+ 0x2fd6, 0x2fef,
+ 0x2ffc, 0x2fff,
+ 0x3040, 0x3040,
+ 0x3097, 0x3098,
+ 0x3100, 0x3104,
+ 0x312e, 0x3130,
+ 0x318f, 0x318f,
+ 0x31bb, 0x31bf,
+ 0x31e4, 0x31ef,
+ 0x321f, 0x321f,
+ 0x32ff, 0x32ff,
+ 0x4db6, 0x4dbf,
+ 0x9fcd, 0x9fff,
+ 0xa48d, 0xa48f,
+ 0xa4c7, 0xa4cf,
+ 0xa62c, 0xa63f,
+ 0xa698, 0xa69e,
+ 0xa6f8, 0xa6ff,
+ 0xa78f, 0xa78f,
+ 0xa794, 0xa79f,
+ 0xa7ab, 0xa7f7,
+ 0xa82c, 0xa82f,
+ 0xa83a, 0xa83f,
+ 0xa878, 0xa87f,
+ 0xa8c5, 0xa8cd,
+ 0xa8da, 0xa8df,
+ 0xa8fc, 0xa8ff,
+ 0xa954, 0xa95e,
+ 0xa97d, 0xa97f,
+ 0xa9ce, 0xa9ce,
+ 0xa9da, 0xa9dd,
+ 0xa9e0, 0xa9ff,
+ 0xaa37, 0xaa3f,
+ 0xaa4e, 0xaa4f,
+ 0xaa5a, 0xaa5b,
+ 0xaa7c, 0xaa7f,
+ 0xaac3, 0xaada,
+ 0xaaf7, 0xab00,
+ 0xab07, 0xab08,
+ 0xab0f, 0xab10,
+ 0xab17, 0xab1f,
+ 0xab27, 0xab27,
+ 0xab2f, 0xabbf,
+ 0xabee, 0xabef,
+ 0xabfa, 0xabff,
+ 0xd7a4, 0xd7af,
+ 0xd7c7, 0xd7ca,
+ 0xd7fc, 0xf8ff,
+ 0xfa6e, 0xfa6f,
+ 0xfada, 0xfaff,
+ 0xfb07, 0xfb12,
+ 0xfb18, 0xfb1c,
+ 0xfb37, 0xfb37,
+ 0xfb3d, 0xfb3d,
+ 0xfb3f, 0xfb3f,
+ 0xfb42, 0xfb42,
+ 0xfb45, 0xfb45,
+ 0xfbc2, 0xfbd2,
+ 0xfd40, 0xfd4f,
+ 0xfd90, 0xfd91,
+ 0xfdc8, 0xfdef,
+ 0xfdfe, 0xfdff,
+ 0xfe1a, 0xfe1f,
+ 0xfe27, 0xfe2f,
+ 0xfe53, 0xfe53,
+ 0xfe67, 0xfe67,
+ 0xfe6c, 0xfe6f,
+ 0xfe75, 0xfe75,
+ 0xfefd, 0xff00,
+ 0xffbf, 0xffc1,
+ 0xffc8, 0xffc9,
+ 0xffd0, 0xffd1,
+ 0xffd8, 0xffd9,
+ 0xffdd, 0xffdf,
+ 0xffe7, 0xffe7,
+ 0xffef, 0xfffb,
+ 0xfffe, 0xffff,
+ 0x1000c, 0x1000c,
+ 0x10027, 0x10027,
+ 0x1003b, 0x1003b,
+ 0x1003e, 0x1003e,
+ 0x1004e, 0x1004f,
+ 0x1005e, 0x1007f,
+ 0x100fb, 0x100ff,
+ 0x10103, 0x10106,
+ 0x10134, 0x10136,
+ 0x1018b, 0x1018f,
+ 0x1019c, 0x101cf,
+ 0x101fe, 0x1027f,
+ 0x1029d, 0x1029f,
+ 0x102d1, 0x102ff,
+ 0x1031f, 0x1031f,
+ 0x10324, 0x1032f,
+ 0x1034b, 0x1037f,
+ 0x1039e, 0x1039e,
+ 0x103c4, 0x103c7,
+ 0x103d6, 0x103ff,
+ 0x1049e, 0x1049f,
+ 0x104aa, 0x107ff,
+ 0x10806, 0x10807,
+ 0x10809, 0x10809,
+ 0x10836, 0x10836,
+ 0x10839, 0x1083b,
+ 0x1083d, 0x1083e,
+ 0x10856, 0x10856,
+ 0x10860, 0x108ff,
+ 0x1091c, 0x1091e,
+ 0x1093a, 0x1093e,
+ 0x10940, 0x1097f,
+ 0x109b8, 0x109bd,
+ 0x109c0, 0x109ff,
+ 0x10a04, 0x10a04,
+ 0x10a07, 0x10a0b,
+ 0x10a14, 0x10a14,
+ 0x10a18, 0x10a18,
+ 0x10a34, 0x10a37,
+ 0x10a3b, 0x10a3e,
+ 0x10a48, 0x10a4f,
+ 0x10a59, 0x10a5f,
+ 0x10a80, 0x10aff,
+ 0x10b36, 0x10b38,
+ 0x10b56, 0x10b57,
+ 0x10b73, 0x10b77,
+ 0x10b80, 0x10bff,
+ 0x10c49, 0x10e5f,
+ 0x10e7f, 0x10fff,
+ 0x1104e, 0x11051,
+ 0x11070, 0x1107f,
0x110bd, 0x110bd,
+ 0x110c2, 0x110cf,
+ 0x110e9, 0x110ef,
+ 0x110fa, 0x110ff,
+ 0x11135, 0x11135,
+ 0x11144, 0x1117f,
+ 0x111c9, 0x111cf,
+ 0x111da, 0x1167f,
+ 0x116b8, 0x116bf,
+ 0x116ca, 0x11fff,
+ 0x1236f, 0x123ff,
+ 0x12463, 0x1246f,
+ 0x12474, 0x12fff,
+ 0x1342f, 0x167ff,
+ 0x16a39, 0x16eff,
+ 0x16f45, 0x16f4f,
+ 0x16f7f, 0x16f8e,
+ 0x16fa0, 0x1afff,
+ 0x1b002, 0x1cfff,
+ 0x1d0f6, 0x1d0ff,
+ 0x1d127, 0x1d128,
0x1d173, 0x1d17a,
- 0xe0001, 0xe0001,
- 0xe0020, 0xe007f,
- 0xf0000, 0xffffd,
- 0x100000, 0x10ffff,
+ 0x1d1de, 0x1d1ff,
+ 0x1d246, 0x1d2ff,
+ 0x1d357, 0x1d35f,
+ 0x1d372, 0x1d3ff,
+ 0x1d455, 0x1d455,
+ 0x1d49d, 0x1d49d,
+ 0x1d4a0, 0x1d4a1,
+ 0x1d4a3, 0x1d4a4,
+ 0x1d4a7, 0x1d4a8,
+ 0x1d4ad, 0x1d4ad,
+ 0x1d4ba, 0x1d4ba,
+ 0x1d4bc, 0x1d4bc,
+ 0x1d4c4, 0x1d4c4,
+ 0x1d506, 0x1d506,
+ 0x1d50b, 0x1d50c,
+ 0x1d515, 0x1d515,
+ 0x1d51d, 0x1d51d,
+ 0x1d53a, 0x1d53a,
+ 0x1d53f, 0x1d53f,
+ 0x1d545, 0x1d545,
+ 0x1d547, 0x1d549,
+ 0x1d551, 0x1d551,
+ 0x1d6a6, 0x1d6a7,
+ 0x1d7cc, 0x1d7cd,
+ 0x1d800, 0x1edff,
+ 0x1ee04, 0x1ee04,
+ 0x1ee20, 0x1ee20,
+ 0x1ee23, 0x1ee23,
+ 0x1ee25, 0x1ee26,
+ 0x1ee28, 0x1ee28,
+ 0x1ee33, 0x1ee33,
+ 0x1ee38, 0x1ee38,
+ 0x1ee3a, 0x1ee3a,
+ 0x1ee3c, 0x1ee41,
+ 0x1ee43, 0x1ee46,
+ 0x1ee48, 0x1ee48,
+ 0x1ee4a, 0x1ee4a,
+ 0x1ee4c, 0x1ee4c,
+ 0x1ee50, 0x1ee50,
+ 0x1ee53, 0x1ee53,
+ 0x1ee55, 0x1ee56,
+ 0x1ee58, 0x1ee58,
+ 0x1ee5a, 0x1ee5a,
+ 0x1ee5c, 0x1ee5c,
+ 0x1ee5e, 0x1ee5e,
+ 0x1ee60, 0x1ee60,
+ 0x1ee63, 0x1ee63,
+ 0x1ee65, 0x1ee66,
+ 0x1ee6b, 0x1ee6b,
+ 0x1ee73, 0x1ee73,
+ 0x1ee78, 0x1ee78,
+ 0x1ee7d, 0x1ee7d,
+ 0x1ee7f, 0x1ee7f,
+ 0x1ee8a, 0x1ee8a,
+ 0x1ee9c, 0x1eea0,
+ 0x1eea4, 0x1eea4,
+ 0x1eeaa, 0x1eeaa,
+ 0x1eebc, 0x1eeef,
+ 0x1eef2, 0x1efff,
+ 0x1f02c, 0x1f02f,
+ 0x1f094, 0x1f09f,
+ 0x1f0af, 0x1f0b0,
+ 0x1f0bf, 0x1f0c0,
+ 0x1f0d0, 0x1f0d0,
+ 0x1f0e0, 0x1f0ff,
+ 0x1f10b, 0x1f10f,
+ 0x1f12f, 0x1f12f,
+ 0x1f16c, 0x1f16f,
+ 0x1f19b, 0x1f1e5,
+ 0x1f203, 0x1f20f,
+ 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,
+ 0x2a6d7, 0x2a6ff,
+ 0x2b735, 0x2b73f,
+ 0x2b81e, 0x2f7ff,
+ 0x2fa1e, 0xe00ff,
+ 0xe01f0, 0x10ffff,
}; /* CR_C */
/* 'Cc': General Category */
-static const OnigCodePoint CR_Cc[] = {
- 2,
- 0x0000, 0x001f,
- 0x007f, 0x009f,
-}; /* CR_Cc */
+#define CR_Cc CR_Cntrl
/* 'Cf': General Category */
static const OnigCodePoint CR_Cf[] = {
- 15,
+ 14,
0x00ad, 0x00ad,
- 0x0600, 0x0603,
+ 0x0600, 0x0604,
0x06dd, 0x06dd,
0x070f, 0x070f,
- 0x17b4, 0x17b5,
0x200b, 0x200f,
0x202a, 0x202e,
0x2060, 0x2064,
@@ -568,7 +5389,7 @@ static const OnigCodePoint CR_Cf[] = {
/* 'Cn': General Category */
static const OnigCodePoint CR_Cn[] = {
- 501,
+ 539,
0x0378, 0x0379,
0x037f, 0x0383,
0x038b, 0x038b,
@@ -578,11 +5399,12 @@ static const OnigCodePoint CR_Cn[] = {
0x0557, 0x0558,
0x0560, 0x0560,
0x0588, 0x0588,
- 0x058b, 0x0590,
+ 0x058b, 0x058e,
+ 0x0590, 0x0590,
0x05c8, 0x05cf,
0x05eb, 0x05ef,
0x05f5, 0x05ff,
- 0x0604, 0x0605,
+ 0x0605, 0x0605,
0x061c, 0x061d,
0x070e, 0x070e,
0x074b, 0x074c,
@@ -591,7 +5413,10 @@ static const OnigCodePoint CR_Cn[] = {
0x082e, 0x082f,
0x083f, 0x083f,
0x085c, 0x085d,
- 0x085f, 0x08ff,
+ 0x085f, 0x089f,
+ 0x08a1, 0x08a1,
+ 0x08ad, 0x08e3,
+ 0x08ff, 0x08ff,
0x0978, 0x0978,
0x0980, 0x0980,
0x0984, 0x0984,
@@ -636,7 +5461,6 @@ static const OnigCodePoint CR_Cn[] = {
0x0ace, 0x0acf,
0x0ad1, 0x0adf,
0x0ae4, 0x0ae5,
- 0x0af0, 0x0af0,
0x0af2, 0x0b00,
0x0b04, 0x0b04,
0x0b0d, 0x0b0e,
@@ -737,15 +5561,16 @@ static const OnigCodePoint CR_Cn[] = {
0x0ec7, 0x0ec7,
0x0ece, 0x0ecf,
0x0eda, 0x0edb,
- 0x0ede, 0x0eff,
+ 0x0ee0, 0x0eff,
0x0f48, 0x0f48,
0x0f6d, 0x0f70,
0x0f98, 0x0f98,
0x0fbd, 0x0fbd,
0x0fcd, 0x0fcd,
0x0fdb, 0x0fff,
- 0x10c6, 0x10cf,
- 0x10fd, 0x10ff,
+ 0x10c6, 0x10c6,
+ 0x10c8, 0x10cc,
+ 0x10ce, 0x10cf,
0x1249, 0x1249,
0x124e, 0x124f,
0x1257, 0x1257,
@@ -799,13 +5624,12 @@ static const OnigCodePoint CR_Cn[] = {
0x1aae, 0x1aff,
0x1b4c, 0x1b4f,
0x1b7d, 0x1b7f,
- 0x1bab, 0x1bad,
- 0x1bba, 0x1bbf,
0x1bf4, 0x1bfb,
0x1c38, 0x1c3a,
0x1c4a, 0x1c4c,
- 0x1c80, 0x1ccf,
- 0x1cf3, 0x1cff,
+ 0x1c80, 0x1cbf,
+ 0x1cc8, 0x1ccf,
+ 0x1cf7, 0x1cff,
0x1de7, 0x1dfb,
0x1f16, 0x1f17,
0x1f1e, 0x1f1f,
@@ -834,15 +5658,15 @@ static const OnigCodePoint CR_Cn[] = {
0x2427, 0x243f,
0x244b, 0x245f,
0x2700, 0x2700,
- 0x27cb, 0x27cb,
- 0x27cd, 0x27cd,
0x2b4d, 0x2b4f,
0x2b5a, 0x2bff,
0x2c2f, 0x2c2f,
0x2c5f, 0x2c5f,
- 0x2cf2, 0x2cf8,
- 0x2d26, 0x2d2f,
- 0x2d66, 0x2d6e,
+ 0x2cf4, 0x2cf8,
+ 0x2d26, 0x2d26,
+ 0x2d28, 0x2d2c,
+ 0x2d2e, 0x2d2f,
+ 0x2d68, 0x2d6e,
0x2d71, 0x2d7e,
0x2d97, 0x2d9f,
0x2da7, 0x2da7,
@@ -853,7 +5677,7 @@ static const OnigCodePoint CR_Cn[] = {
0x2dcf, 0x2dcf,
0x2dd7, 0x2dd7,
0x2ddf, 0x2ddf,
- 0x2e32, 0x2e7f,
+ 0x2e3c, 0x2e7f,
0x2e9a, 0x2e9a,
0x2ef4, 0x2eff,
0x2fd6, 0x2fef,
@@ -868,16 +5692,15 @@ static const OnigCodePoint CR_Cn[] = {
0x321f, 0x321f,
0x32ff, 0x32ff,
0x4db6, 0x4dbf,
- 0x9fcc, 0x9fff,
+ 0x9fcd, 0x9fff,
0xa48d, 0xa48f,
0xa4c7, 0xa4cf,
0xa62c, 0xa63f,
- 0xa674, 0xa67b,
- 0xa698, 0xa69f,
+ 0xa698, 0xa69e,
0xa6f8, 0xa6ff,
0xa78f, 0xa78f,
- 0xa792, 0xa79f,
- 0xa7aa, 0xa7f9,
+ 0xa794, 0xa79f,
+ 0xa7ab, 0xa7f7,
0xa82c, 0xa82f,
0xa83a, 0xa83f,
0xa878, 0xa87f,
@@ -894,7 +5717,7 @@ static const OnigCodePoint CR_Cn[] = {
0xaa5a, 0xaa5b,
0xaa7c, 0xaa7f,
0xaac3, 0xaada,
- 0xaae0, 0xab00,
+ 0xaaf7, 0xab00,
0xab07, 0xab08,
0xab0f, 0xab10,
0xab17, 0xab1f,
@@ -905,7 +5728,6 @@ static const OnigCodePoint CR_Cn[] = {
0xd7a4, 0xd7af,
0xd7c7, 0xd7ca,
0xd7fc, 0xd7ff,
- 0xfa2e, 0xfa2f,
0xfa6e, 0xfa6f,
0xfada, 0xfaff,
0xfb07, 0xfb12,
@@ -967,7 +5789,9 @@ static const OnigCodePoint CR_Cn[] = {
0x10860, 0x108ff,
0x1091c, 0x1091e,
0x1093a, 0x1093e,
- 0x10940, 0x109ff,
+ 0x10940, 0x1097f,
+ 0x109b8, 0x109bd,
+ 0x109c0, 0x109ff,
0x10a04, 0x10a04,
0x10a07, 0x10a0b,
0x10a14, 0x10a14,
@@ -985,12 +5809,23 @@ static const OnigCodePoint CR_Cn[] = {
0x10e7f, 0x10fff,
0x1104e, 0x11051,
0x11070, 0x1107f,
- 0x110c2, 0x11fff,
+ 0x110c2, 0x110cf,
+ 0x110e9, 0x110ef,
+ 0x110fa, 0x110ff,
+ 0x11135, 0x11135,
+ 0x11144, 0x1117f,
+ 0x111c9, 0x111cf,
+ 0x111da, 0x1167f,
+ 0x116b8, 0x116bf,
+ 0x116ca, 0x11fff,
0x1236f, 0x123ff,
0x12463, 0x1246f,
0x12474, 0x12fff,
0x1342f, 0x167ff,
- 0x16a39, 0x1afff,
+ 0x16a39, 0x16eff,
+ 0x16f45, 0x16f4f,
+ 0x16f7f, 0x16f8e,
+ 0x16fa0, 0x1afff,
0x1b002, 0x1cfff,
0x1d0f6, 0x1d0ff,
0x1d127, 0x1d128,
@@ -1018,7 +5853,41 @@ static const OnigCodePoint CR_Cn[] = {
0x1d551, 0x1d551,
0x1d6a6, 0x1d6a7,
0x1d7cc, 0x1d7cd,
- 0x1d800, 0x1efff,
+ 0x1d800, 0x1edff,
+ 0x1ee04, 0x1ee04,
+ 0x1ee20, 0x1ee20,
+ 0x1ee23, 0x1ee23,
+ 0x1ee25, 0x1ee26,
+ 0x1ee28, 0x1ee28,
+ 0x1ee33, 0x1ee33,
+ 0x1ee38, 0x1ee38,
+ 0x1ee3a, 0x1ee3a,
+ 0x1ee3c, 0x1ee41,
+ 0x1ee43, 0x1ee46,
+ 0x1ee48, 0x1ee48,
+ 0x1ee4a, 0x1ee4a,
+ 0x1ee4c, 0x1ee4c,
+ 0x1ee50, 0x1ee50,
+ 0x1ee53, 0x1ee53,
+ 0x1ee55, 0x1ee56,
+ 0x1ee58, 0x1ee58,
+ 0x1ee5a, 0x1ee5a,
+ 0x1ee5c, 0x1ee5c,
+ 0x1ee5e, 0x1ee5e,
+ 0x1ee60, 0x1ee60,
+ 0x1ee63, 0x1ee63,
+ 0x1ee65, 0x1ee66,
+ 0x1ee6b, 0x1ee6b,
+ 0x1ee73, 0x1ee73,
+ 0x1ee78, 0x1ee78,
+ 0x1ee7d, 0x1ee7d,
+ 0x1ee7f, 0x1ee7f,
+ 0x1ee8a, 0x1ee8a,
+ 0x1ee9c, 0x1eea0,
+ 0x1eea4, 0x1eea4,
+ 0x1eeaa, 0x1eeaa,
+ 0x1eebc, 0x1eeef,
+ 0x1eef2, 0x1efff,
0x1f02c, 0x1f02f,
0x1f094, 0x1f09f,
0x1f0af, 0x1f0b0,
@@ -1027,7 +5896,7 @@ static const OnigCodePoint CR_Cn[] = {
0x1f0e0, 0x1f0ff,
0x1f10b, 0x1f10f,
0x1f12f, 0x1f12f,
- 0x1f16a, 0x1f16f,
+ 0x1f16c, 0x1f16f,
0x1f19b, 0x1f1e5,
0x1f203, 0x1f20f,
0x1f23b, 0x1f23f,
@@ -1044,19 +5913,9 @@ static const OnigCodePoint CR_Cn[] = {
0x1f441, 0x1f441,
0x1f4f8, 0x1f4f8,
0x1f4fd, 0x1f4ff,
- 0x1f53e, 0x1f54f,
+ 0x1f53e, 0x1f53f,
+ 0x1f544, 0x1f54f,
0x1f568, 0x1f5fa,
- 0x1f600, 0x1f600,
- 0x1f611, 0x1f611,
- 0x1f615, 0x1f615,
- 0x1f617, 0x1f617,
- 0x1f619, 0x1f619,
- 0x1f61b, 0x1f61b,
- 0x1f61f, 0x1f61f,
- 0x1f626, 0x1f627,
- 0x1f62c, 0x1f62c,
- 0x1f62e, 0x1f62f,
- 0x1f634, 0x1f634,
0x1f641, 0x1f644,
0x1f650, 0x1f67f,
0x1f6c6, 0x1f6ff,
@@ -1088,7 +5947,7 @@ static const OnigCodePoint CR_Cs[] = {
/* 'L': Major Category */
static const OnigCodePoint CR_L[] = {
- 435,
+ 486,
0x0041, 0x005a,
0x0061, 0x007a,
0x00aa, 0x00aa,
@@ -1136,6 +5995,8 @@ static const OnigCodePoint CR_L[] = {
0x0824, 0x0824,
0x0828, 0x0828,
0x0840, 0x0858,
+ 0x08a0, 0x08a0,
+ 0x08a2, 0x08ac,
0x0904, 0x0939,
0x093d, 0x093d,
0x0950, 0x0950,
@@ -1241,7 +6102,7 @@ static const OnigCodePoint CR_L[] = {
0x0ebd, 0x0ebd,
0x0ec0, 0x0ec4,
0x0ec6, 0x0ec6,
- 0x0edc, 0x0edd,
+ 0x0edc, 0x0edf,
0x0f00, 0x0f00,
0x0f40, 0x0f47,
0x0f49, 0x0f6c,
@@ -1256,9 +6117,10 @@ static const OnigCodePoint CR_L[] = {
0x1075, 0x1081,
0x108e, 0x108e,
0x10a0, 0x10c5,
+ 0x10c7, 0x10c7,
+ 0x10cd, 0x10cd,
0x10d0, 0x10fa,
- 0x10fc, 0x10fc,
- 0x1100, 0x1248,
+ 0x10fc, 0x1248,
0x124a, 0x124d,
0x1250, 0x1256,
0x1258, 0x1258,
@@ -1305,12 +6167,13 @@ static const OnigCodePoint CR_L[] = {
0x1b45, 0x1b4b,
0x1b83, 0x1ba0,
0x1bae, 0x1baf,
- 0x1bc0, 0x1be5,
+ 0x1bba, 0x1be5,
0x1c00, 0x1c23,
0x1c4d, 0x1c4f,
0x1c5a, 0x1c7d,
0x1ce9, 0x1cec,
0x1cee, 0x1cf1,
+ 0x1cf5, 0x1cf6,
0x1d00, 0x1dbf,
0x1e00, 0x1f15,
0x1f18, 0x1f1d,
@@ -1352,8 +6215,11 @@ static const OnigCodePoint CR_L[] = {
0x2c30, 0x2c5e,
0x2c60, 0x2ce4,
0x2ceb, 0x2cee,
+ 0x2cf2, 0x2cf3,
0x2d00, 0x2d25,
- 0x2d30, 0x2d65,
+ 0x2d27, 0x2d27,
+ 0x2d2d, 0x2d2d,
+ 0x2d30, 0x2d67,
0x2d6f, 0x2d6f,
0x2d80, 0x2d96,
0x2da0, 0x2da6,
@@ -1377,7 +6243,7 @@ static const OnigCodePoint CR_L[] = {
0x31a0, 0x31ba,
0x31f0, 0x31ff,
0x3400, 0x4db5,
- 0x4e00, 0x9fcb,
+ 0x4e00, 0x9fcc,
0xa000, 0xa48c,
0xa4d0, 0xa4fd,
0xa500, 0xa60c,
@@ -1389,9 +6255,9 @@ static const OnigCodePoint CR_L[] = {
0xa717, 0xa71f,
0xa722, 0xa788,
0xa78b, 0xa78e,
- 0xa790, 0xa791,
- 0xa7a0, 0xa7a9,
- 0xa7fa, 0xa801,
+ 0xa790, 0xa793,
+ 0xa7a0, 0xa7aa,
+ 0xa7f8, 0xa801,
0xa803, 0xa805,
0xa807, 0xa80a,
0xa80c, 0xa822,
@@ -1416,6 +6282,8 @@ static const OnigCodePoint CR_L[] = {
0xaac0, 0xaac0,
0xaac2, 0xaac2,
0xaadb, 0xaadd,
+ 0xaae0, 0xaaea,
+ 0xaaf2, 0xaaf4,
0xab01, 0xab06,
0xab09, 0xab0e,
0xab11, 0xab16,
@@ -1425,8 +6293,7 @@ static const OnigCodePoint CR_L[] = {
0xac00, 0xd7a3,
0xd7b0, 0xd7c6,
0xd7cb, 0xd7fb,
- 0xf900, 0xfa2d,
- 0xfa30, 0xfa6d,
+ 0xf900, 0xfa6d,
0xfa70, 0xfad9,
0xfb00, 0xfb06,
0xfb13, 0xfb17,
@@ -1475,6 +6342,8 @@ static const OnigCodePoint CR_L[] = {
0x1083f, 0x10855,
0x10900, 0x10915,
0x10920, 0x10939,
+ 0x10980, 0x109b7,
+ 0x109be, 0x109bf,
0x10a00, 0x10a00,
0x10a10, 0x10a13,
0x10a15, 0x10a17,
@@ -1486,9 +6355,17 @@ static const OnigCodePoint CR_L[] = {
0x10c00, 0x10c48,
0x11003, 0x11037,
0x11083, 0x110af,
+ 0x110d0, 0x110e8,
+ 0x11103, 0x11126,
+ 0x11183, 0x111b2,
+ 0x111c1, 0x111c4,
+ 0x11680, 0x116aa,
0x12000, 0x1236e,
0x13000, 0x1342e,
0x16800, 0x16a38,
+ 0x16f00, 0x16f44,
+ 0x16f50, 0x16f50,
+ 0x16f93, 0x16f9f,
0x1b000, 0x1b001,
0x1d400, 0x1d454,
0x1d456, 0x1d49c,
@@ -1520,19 +6397,168 @@ static const OnigCodePoint CR_L[] = {
0x1d78a, 0x1d7a8,
0x1d7aa, 0x1d7c2,
0x1d7c4, 0x1d7cb,
+ 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,
0x20000, 0x2a6d6,
0x2a700, 0x2b734,
0x2b740, 0x2b81d,
0x2f800, 0x2fa1d,
}; /* CR_L */
+/* 'LC': General Category */
+static const OnigCodePoint CR_LC[] = {
+ 113,
+ 0x0041, 0x005a,
+ 0x0061, 0x007a,
+ 0x00b5, 0x00b5,
+ 0x00c0, 0x00d6,
+ 0x00d8, 0x00f6,
+ 0x00f8, 0x01ba,
+ 0x01bc, 0x01bf,
+ 0x01c4, 0x0293,
+ 0x0295, 0x02af,
+ 0x0370, 0x0373,
+ 0x0376, 0x0377,
+ 0x037b, 0x037d,
+ 0x0386, 0x0386,
+ 0x0388, 0x038a,
+ 0x038c, 0x038c,
+ 0x038e, 0x03a1,
+ 0x03a3, 0x03f5,
+ 0x03f7, 0x0481,
+ 0x048a, 0x0527,
+ 0x0531, 0x0556,
+ 0x0561, 0x0587,
+ 0x10a0, 0x10c5,
+ 0x10c7, 0x10c7,
+ 0x10cd, 0x10cd,
+ 0x1d00, 0x1d2b,
+ 0x1d6b, 0x1d77,
+ 0x1d79, 0x1d9a,
+ 0x1e00, 0x1f15,
+ 0x1f18, 0x1f1d,
+ 0x1f20, 0x1f45,
+ 0x1f48, 0x1f4d,
+ 0x1f50, 0x1f57,
+ 0x1f59, 0x1f59,
+ 0x1f5b, 0x1f5b,
+ 0x1f5d, 0x1f5d,
+ 0x1f5f, 0x1f7d,
+ 0x1f80, 0x1fb4,
+ 0x1fb6, 0x1fbc,
+ 0x1fbe, 0x1fbe,
+ 0x1fc2, 0x1fc4,
+ 0x1fc6, 0x1fcc,
+ 0x1fd0, 0x1fd3,
+ 0x1fd6, 0x1fdb,
+ 0x1fe0, 0x1fec,
+ 0x1ff2, 0x1ff4,
+ 0x1ff6, 0x1ffc,
+ 0x2102, 0x2102,
+ 0x2107, 0x2107,
+ 0x210a, 0x2113,
+ 0x2115, 0x2115,
+ 0x2119, 0x211d,
+ 0x2124, 0x2124,
+ 0x2126, 0x2126,
+ 0x2128, 0x2128,
+ 0x212a, 0x212d,
+ 0x212f, 0x2134,
+ 0x2139, 0x2139,
+ 0x213c, 0x213f,
+ 0x2145, 0x2149,
+ 0x214e, 0x214e,
+ 0x2183, 0x2184,
+ 0x2c00, 0x2c2e,
+ 0x2c30, 0x2c5e,
+ 0x2c60, 0x2c7b,
+ 0x2c7e, 0x2ce4,
+ 0x2ceb, 0x2cee,
+ 0x2cf2, 0x2cf3,
+ 0x2d00, 0x2d25,
+ 0x2d27, 0x2d27,
+ 0x2d2d, 0x2d2d,
+ 0xa640, 0xa66d,
+ 0xa680, 0xa697,
+ 0xa722, 0xa76f,
+ 0xa771, 0xa787,
+ 0xa78b, 0xa78e,
+ 0xa790, 0xa793,
+ 0xa7a0, 0xa7aa,
+ 0xa7fa, 0xa7fa,
+ 0xfb00, 0xfb06,
+ 0xfb13, 0xfb17,
+ 0xff21, 0xff3a,
+ 0xff41, 0xff5a,
+ 0x10400, 0x1044f,
+ 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, 0x1d6c0,
+ 0x1d6c2, 0x1d6da,
+ 0x1d6dc, 0x1d6fa,
+ 0x1d6fc, 0x1d714,
+ 0x1d716, 0x1d734,
+ 0x1d736, 0x1d74e,
+ 0x1d750, 0x1d76e,
+ 0x1d770, 0x1d788,
+ 0x1d78a, 0x1d7a8,
+ 0x1d7aa, 0x1d7c2,
+ 0x1d7c4, 0x1d7cb,
+}; /* CR_LC */
+
/* 'Ll': General Category */
static const OnigCodePoint CR_Ll[] = {
- 609,
+ 611,
0x0061, 0x007a,
- 0x00aa, 0x00aa,
0x00b5, 0x00b5,
- 0x00ba, 0x00ba,
0x00df, 0x00f6,
0x00f8, 0x00ff,
0x0101, 0x0101,
@@ -1798,7 +6824,7 @@ static const OnigCodePoint CR_Ll[] = {
0x0527, 0x0527,
0x0561, 0x0587,
0x1d00, 0x1d2b,
- 0x1d62, 0x1d77,
+ 0x1d6b, 0x1d77,
0x1d79, 0x1d9a,
0x1e01, 0x1e01,
0x1e03, 0x1e03,
@@ -1962,7 +6988,7 @@ static const OnigCodePoint CR_Ll[] = {
0x2c6c, 0x2c6c,
0x2c71, 0x2c71,
0x2c73, 0x2c74,
- 0x2c76, 0x2c7c,
+ 0x2c76, 0x2c7b,
0x2c81, 0x2c81,
0x2c83, 0x2c83,
0x2c85, 0x2c85,
@@ -2015,7 +7041,10 @@ static const OnigCodePoint CR_Ll[] = {
0x2ce3, 0x2ce4,
0x2cec, 0x2cec,
0x2cee, 0x2cee,
+ 0x2cf3, 0x2cf3,
0x2d00, 0x2d25,
+ 0x2d27, 0x2d27,
+ 0x2d2d, 0x2d2d,
0xa641, 0xa641,
0xa643, 0xa643,
0xa645, 0xa645,
@@ -2100,6 +7129,7 @@ static const OnigCodePoint CR_Ll[] = {
0xa78c, 0xa78c,
0xa78e, 0xa78e,
0xa791, 0xa791,
+ 0xa793, 0xa793,
0xa7a1, 0xa7a1,
0xa7a3, 0xa7a3,
0xa7a5, 0xa7a5,
@@ -2142,7 +7172,7 @@ static const OnigCodePoint CR_Ll[] = {
/* 'Lm': General Category */
static const OnigCodePoint CR_Lm[] = {
- 49,
+ 52,
0x02b0, 0x02c1,
0x02c6, 0x02d1,
0x02e0, 0x02e4,
@@ -2166,13 +7196,13 @@ static const OnigCodePoint CR_Lm[] = {
0x1843, 0x1843,
0x1aa7, 0x1aa7,
0x1c78, 0x1c7d,
- 0x1d2c, 0x1d61,
+ 0x1d2c, 0x1d6a,
0x1d78, 0x1d78,
0x1d9b, 0x1dbf,
0x2071, 0x2071,
0x207f, 0x207f,
0x2090, 0x209c,
- 0x2c7d, 0x2c7d,
+ 0x2c7c, 0x2c7d,
0x2d6f, 0x2d6f,
0x2e2f, 0x2e2f,
0x3005, 0x3005,
@@ -2187,16 +7217,21 @@ static const OnigCodePoint CR_Lm[] = {
0xa717, 0xa71f,
0xa770, 0xa770,
0xa788, 0xa788,
+ 0xa7f8, 0xa7f9,
0xa9cf, 0xa9cf,
0xaa70, 0xaa70,
0xaadd, 0xaadd,
+ 0xaaf3, 0xaaf4,
0xff70, 0xff70,
0xff9e, 0xff9f,
+ 0x16f93, 0x16f9f,
}; /* CR_Lm */
/* 'Lo': General Category */
static const OnigCodePoint CR_Lo[] = {
- 323,
+ 371,
+ 0x00aa, 0x00aa,
+ 0x00ba, 0x00ba,
0x01bb, 0x01bb,
0x01c0, 0x01c3,
0x0294, 0x0294,
@@ -2217,6 +7252,8 @@ static const OnigCodePoint CR_Lo[] = {
0x07ca, 0x07ea,
0x0800, 0x0815,
0x0840, 0x0858,
+ 0x08a0, 0x08a0,
+ 0x08a2, 0x08ac,
0x0904, 0x0939,
0x093d, 0x093d,
0x0950, 0x0950,
@@ -2321,7 +7358,7 @@ static const OnigCodePoint CR_Lo[] = {
0x0eb2, 0x0eb3,
0x0ebd, 0x0ebd,
0x0ec0, 0x0ec4,
- 0x0edc, 0x0edd,
+ 0x0edc, 0x0edf,
0x0f00, 0x0f00,
0x0f40, 0x0f47,
0x0f49, 0x0f6c,
@@ -2336,7 +7373,7 @@ static const OnigCodePoint CR_Lo[] = {
0x1075, 0x1081,
0x108e, 0x108e,
0x10d0, 0x10fa,
- 0x1100, 0x1248,
+ 0x10fd, 0x1248,
0x124a, 0x124d,
0x1250, 0x1256,
0x1258, 0x1258,
@@ -2382,14 +7419,15 @@ static const OnigCodePoint CR_Lo[] = {
0x1b45, 0x1b4b,
0x1b83, 0x1ba0,
0x1bae, 0x1baf,
- 0x1bc0, 0x1be5,
+ 0x1bba, 0x1be5,
0x1c00, 0x1c23,
0x1c4d, 0x1c4f,
0x1c5a, 0x1c77,
0x1ce9, 0x1cec,
0x1cee, 0x1cf1,
+ 0x1cf5, 0x1cf6,
0x2135, 0x2138,
- 0x2d30, 0x2d65,
+ 0x2d30, 0x2d67,
0x2d80, 0x2d96,
0x2da0, 0x2da6,
0x2da8, 0x2dae,
@@ -2410,7 +7448,7 @@ static const OnigCodePoint CR_Lo[] = {
0x31a0, 0x31ba,
0x31f0, 0x31ff,
0x3400, 0x4db5,
- 0x4e00, 0x9fcb,
+ 0x4e00, 0x9fcc,
0xa000, 0xa014,
0xa016, 0xa48c,
0xa4d0, 0xa4f7,
@@ -2444,6 +7482,8 @@ static const OnigCodePoint CR_Lo[] = {
0xaac0, 0xaac0,
0xaac2, 0xaac2,
0xaadb, 0xaadc,
+ 0xaae0, 0xaaea,
+ 0xaaf2, 0xaaf2,
0xab01, 0xab06,
0xab09, 0xab0e,
0xab11, 0xab16,
@@ -2453,8 +7493,7 @@ static const OnigCodePoint CR_Lo[] = {
0xac00, 0xd7a3,
0xd7b0, 0xd7c6,
0xd7cb, 0xd7fb,
- 0xf900, 0xfa2d,
- 0xfa30, 0xfa6d,
+ 0xf900, 0xfa6d,
0xfa70, 0xfad9,
0xfb1d, 0xfb1d,
0xfb1f, 0xfb28,
@@ -2501,6 +7540,8 @@ static const OnigCodePoint CR_Lo[] = {
0x1083f, 0x10855,
0x10900, 0x10915,
0x10920, 0x10939,
+ 0x10980, 0x109b7,
+ 0x109be, 0x109bf,
0x10a00, 0x10a00,
0x10a10, 0x10a13,
0x10a15, 0x10a17,
@@ -2512,10 +7553,50 @@ static const OnigCodePoint CR_Lo[] = {
0x10c00, 0x10c48,
0x11003, 0x11037,
0x11083, 0x110af,
+ 0x110d0, 0x110e8,
+ 0x11103, 0x11126,
+ 0x11183, 0x111b2,
+ 0x111c1, 0x111c4,
+ 0x11680, 0x116aa,
0x12000, 0x1236e,
0x13000, 0x1342e,
0x16800, 0x16a38,
+ 0x16f00, 0x16f44,
+ 0x16f50, 0x16f50,
0x1b000, 0x1b001,
+ 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,
0x20000, 0x2a6d6,
0x2a700, 0x2b734,
0x2b740, 0x2b81d,
@@ -2539,7 +7620,7 @@ static const OnigCodePoint CR_Lt[] = {
/* 'Lu': General Category */
static const OnigCodePoint CR_Lu[] = {
- 603,
+ 608,
0x0041, 0x005a,
0x00c0, 0x00d6,
0x00d8, 0x00de,
@@ -2808,6 +7889,8 @@ static const OnigCodePoint CR_Lu[] = {
0x0526, 0x0526,
0x0531, 0x0556,
0x10a0, 0x10c5,
+ 0x10c7, 0x10c7,
+ 0x10cd, 0x10cd,
0x1e00, 0x1e00,
0x1e02, 0x1e02,
0x1e04, 0x1e04,
@@ -3022,6 +8105,7 @@ static const OnigCodePoint CR_Lu[] = {
0x2ce2, 0x2ce2,
0x2ceb, 0x2ceb,
0x2ced, 0x2ced,
+ 0x2cf2, 0x2cf2,
0xa640, 0xa640,
0xa642, 0xa642,
0xa644, 0xa644,
@@ -3105,11 +8189,13 @@ static const OnigCodePoint CR_Lu[] = {
0xa78b, 0xa78b,
0xa78d, 0xa78d,
0xa790, 0xa790,
+ 0xa792, 0xa792,
0xa7a0, 0xa7a0,
0xa7a2, 0xa7a2,
0xa7a4, 0xa7a4,
0xa7a6, 0xa7a6,
0xa7a8, 0xa7a8,
+ 0xa7aa, 0xa7aa,
0xff21, 0xff3a,
0x10400, 0x10427,
0x1d400, 0x1d419,
@@ -3147,7 +8233,7 @@ static const OnigCodePoint CR_Lu[] = {
/* 'M': Major Category */
static const OnigCodePoint CR_M[] = {
- 193,
+ 204,
0x0300, 0x036f,
0x0483, 0x0489,
0x0591, 0x05bd,
@@ -3171,6 +8257,7 @@ static const OnigCodePoint CR_M[] = {
0x0825, 0x0827,
0x0829, 0x082d,
0x0859, 0x085b,
+ 0x08e4, 0x08fe,
0x0900, 0x0903,
0x093a, 0x093c,
0x093e, 0x094f,
@@ -3265,7 +8352,7 @@ static const OnigCodePoint CR_M[] = {
0x1732, 0x1734,
0x1752, 0x1753,
0x1772, 0x1773,
- 0x17b6, 0x17d3,
+ 0x17b4, 0x17d3,
0x17dd, 0x17dd,
0x180b, 0x180d,
0x18a9, 0x18a9,
@@ -3281,13 +8368,13 @@ static const OnigCodePoint CR_M[] = {
0x1b34, 0x1b44,
0x1b6b, 0x1b73,
0x1b80, 0x1b82,
- 0x1ba1, 0x1baa,
+ 0x1ba1, 0x1bad,
0x1be6, 0x1bf3,
0x1c24, 0x1c37,
0x1cd0, 0x1cd2,
0x1cd4, 0x1ce8,
0x1ced, 0x1ced,
- 0x1cf2, 0x1cf2,
+ 0x1cf2, 0x1cf4,
0x1dc0, 0x1de6,
0x1dfc, 0x1dff,
0x20d0, 0x20f0,
@@ -3297,7 +8384,8 @@ static const OnigCodePoint CR_M[] = {
0x302a, 0x302f,
0x3099, 0x309a,
0xa66f, 0xa672,
- 0xa67c, 0xa67d,
+ 0xa674, 0xa67d,
+ 0xa69f, 0xa69f,
0xa6f0, 0xa6f1,
0xa802, 0xa802,
0xa806, 0xa806,
@@ -3319,6 +8407,8 @@ static const OnigCodePoint CR_M[] = {
0xaab7, 0xaab8,
0xaabe, 0xaabf,
0xaac1, 0xaac1,
+ 0xaaeb, 0xaaef,
+ 0xaaf5, 0xaaf6,
0xabe3, 0xabea,
0xabec, 0xabed,
0xfb1e, 0xfb1e,
@@ -3334,6 +8424,13 @@ static const OnigCodePoint CR_M[] = {
0x11038, 0x11046,
0x11080, 0x11082,
0x110b0, 0x110ba,
+ 0x11100, 0x11102,
+ 0x11127, 0x11134,
+ 0x11180, 0x11182,
+ 0x111b3, 0x111c0,
+ 0x116ab, 0x116b7,
+ 0x16f51, 0x16f7e,
+ 0x16f8f, 0x16f92,
0x1d165, 0x1d169,
0x1d16d, 0x1d172,
0x1d17b, 0x1d182,
@@ -3345,7 +8442,7 @@ static const OnigCodePoint CR_M[] = {
/* 'Mc': General Category */
static const OnigCodePoint CR_Mc[] = {
- 113,
+ 126,
0x0903, 0x0903,
0x093b, 0x093b,
0x093e, 0x0940,
@@ -3427,6 +8524,7 @@ static const OnigCodePoint CR_Mc[] = {
0x1ba1, 0x1ba1,
0x1ba6, 0x1ba7,
0x1baa, 0x1baa,
+ 0x1bac, 0x1bad,
0x1be7, 0x1be7,
0x1bea, 0x1bec,
0x1bee, 0x1bee,
@@ -3434,7 +8532,8 @@ static const OnigCodePoint CR_Mc[] = {
0x1c24, 0x1c2b,
0x1c34, 0x1c35,
0x1ce1, 0x1ce1,
- 0x1cf2, 0x1cf2,
+ 0x1cf2, 0x1cf3,
+ 0x302e, 0x302f,
0xa823, 0xa824,
0xa827, 0xa827,
0xa880, 0xa881,
@@ -3448,6 +8547,9 @@ static const OnigCodePoint CR_Mc[] = {
0xaa33, 0xaa34,
0xaa4d, 0xaa4d,
0xaa7b, 0xaa7b,
+ 0xaaeb, 0xaaeb,
+ 0xaaee, 0xaaef,
+ 0xaaf5, 0xaaf5,
0xabe3, 0xabe4,
0xabe6, 0xabe7,
0xabe9, 0xabea,
@@ -3457,6 +8559,14 @@ static const OnigCodePoint CR_Mc[] = {
0x11082, 0x11082,
0x110b0, 0x110b2,
0x110b7, 0x110b8,
+ 0x1112c, 0x1112c,
+ 0x11182, 0x11182,
+ 0x111b3, 0x111b5,
+ 0x111bf, 0x111c0,
+ 0x116ac, 0x116ac,
+ 0x116ae, 0x116af,
+ 0x116b6, 0x116b6,
+ 0x16f51, 0x16f7e,
0x1d165, 0x1d166,
0x1d16d, 0x1d172,
}; /* CR_Mc */
@@ -3472,7 +8582,7 @@ static const OnigCodePoint CR_Me[] = {
/* 'Mn': General Category */
static const OnigCodePoint CR_Mn[] = {
- 203,
+ 220,
0x0300, 0x036f,
0x0483, 0x0487,
0x0591, 0x05bd,
@@ -3496,6 +8606,7 @@ static const OnigCodePoint CR_Mn[] = {
0x0825, 0x0827,
0x0829, 0x082d,
0x0859, 0x085b,
+ 0x08e4, 0x08fe,
0x0900, 0x0902,
0x093a, 0x093a,
0x093c, 0x093c,
@@ -3581,6 +8692,7 @@ static const OnigCodePoint CR_Mn[] = {
0x1732, 0x1734,
0x1752, 0x1753,
0x1772, 0x1773,
+ 0x17b4, 0x17b5,
0x17b7, 0x17bd,
0x17c6, 0x17c6,
0x17c9, 0x17d3,
@@ -3608,6 +8720,7 @@ static const OnigCodePoint CR_Mn[] = {
0x1b80, 0x1b81,
0x1ba2, 0x1ba5,
0x1ba8, 0x1ba9,
+ 0x1bab, 0x1bab,
0x1be6, 0x1be6,
0x1be8, 0x1be9,
0x1bed, 0x1bed,
@@ -3618,6 +8731,7 @@ static const OnigCodePoint CR_Mn[] = {
0x1cd4, 0x1ce0,
0x1ce2, 0x1ce8,
0x1ced, 0x1ced,
+ 0x1cf4, 0x1cf4,
0x1dc0, 0x1de6,
0x1dfc, 0x1dff,
0x20d0, 0x20dc,
@@ -3626,10 +8740,11 @@ static const OnigCodePoint CR_Mn[] = {
0x2cef, 0x2cf1,
0x2d7f, 0x2d7f,
0x2de0, 0x2dff,
- 0x302a, 0x302f,
+ 0x302a, 0x302d,
0x3099, 0x309a,
0xa66f, 0xa66f,
- 0xa67c, 0xa67d,
+ 0xa674, 0xa67d,
+ 0xa69f, 0xa69f,
0xa6f0, 0xa6f1,
0xa802, 0xa802,
0xa806, 0xa806,
@@ -3653,6 +8768,8 @@ static const OnigCodePoint CR_Mn[] = {
0xaab7, 0xaab8,
0xaabe, 0xaabf,
0xaac1, 0xaac1,
+ 0xaaec, 0xaaed,
+ 0xaaf6, 0xaaf6,
0xabe5, 0xabe5,
0xabe8, 0xabe8,
0xabed, 0xabed,
@@ -3670,6 +8787,16 @@ static const OnigCodePoint CR_Mn[] = {
0x11080, 0x11081,
0x110b3, 0x110b6,
0x110b9, 0x110ba,
+ 0x11100, 0x11102,
+ 0x11127, 0x1112b,
+ 0x1112d, 0x11134,
+ 0x11180, 0x11181,
+ 0x111b6, 0x111be,
+ 0x116ab, 0x116ab,
+ 0x116ad, 0x116ad,
+ 0x116b0, 0x116b5,
+ 0x116b7, 0x116b7,
+ 0x16f8f, 0x16f92,
0x1d167, 0x1d169,
0x1d17b, 0x1d182,
0x1d185, 0x1d18b,
@@ -3680,7 +8807,7 @@ static const OnigCodePoint CR_Mn[] = {
/* 'N': Major Category */
static const OnigCodePoint CR_N[] = {
- 83,
+ 88,
0x0030, 0x0039,
0x00b2, 0x00b3,
0x00b9, 0x00b9,
@@ -3732,6 +8859,7 @@ static const OnigCodePoint CR_N[] = {
0x3038, 0x303a,
0x3192, 0x3195,
0x3220, 0x3229,
+ 0x3248, 0x324f,
0x3251, 0x325f,
0x3280, 0x3289,
0x32b1, 0x32bf,
@@ -3760,6 +8888,10 @@ static const OnigCodePoint CR_N[] = {
0x10b78, 0x10b7f,
0x10e60, 0x10e7e,
0x11052, 0x1106f,
+ 0x110f0, 0x110f9,
+ 0x11136, 0x1113f,
+ 0x111d0, 0x111d9,
+ 0x116c0, 0x116c9,
0x12400, 0x12462,
0x1d360, 0x1d371,
0x1d7ce, 0x1d7ff,
@@ -3767,47 +8899,7 @@ static const OnigCodePoint CR_N[] = {
}; /* CR_N */
/* 'Nd': General Category */
-static const OnigCodePoint CR_Nd[] = {
- 38,
- 0x0030, 0x0039,
- 0x0660, 0x0669,
- 0x06f0, 0x06f9,
- 0x07c0, 0x07c9,
- 0x0966, 0x096f,
- 0x09e6, 0x09ef,
- 0x0a66, 0x0a6f,
- 0x0ae6, 0x0aef,
- 0x0b66, 0x0b6f,
- 0x0be6, 0x0bef,
- 0x0c66, 0x0c6f,
- 0x0ce6, 0x0cef,
- 0x0d66, 0x0d6f,
- 0x0e50, 0x0e59,
- 0x0ed0, 0x0ed9,
- 0x0f20, 0x0f29,
- 0x1040, 0x1049,
- 0x1090, 0x1099,
- 0x17e0, 0x17e9,
- 0x1810, 0x1819,
- 0x1946, 0x194f,
- 0x19d0, 0x19d9,
- 0x1a80, 0x1a89,
- 0x1a90, 0x1a99,
- 0x1b50, 0x1b59,
- 0x1bb0, 0x1bb9,
- 0x1c40, 0x1c49,
- 0x1c50, 0x1c59,
- 0xa620, 0xa629,
- 0xa8d0, 0xa8d9,
- 0xa900, 0xa909,
- 0xa9d0, 0xa9d9,
- 0xaa50, 0xaa59,
- 0xabf0, 0xabf9,
- 0xff10, 0xff19,
- 0x104a0, 0x104a9,
- 0x11066, 0x1106f,
- 0x1d7ce, 0x1d7ff,
-}; /* CR_Nd */
+#define CR_Nd CR_Digit
/* 'Nl': General Category */
static const OnigCodePoint CR_Nl[] = {
@@ -3828,7 +8920,7 @@ static const OnigCodePoint CR_Nl[] = {
/* 'No': General Category */
static const OnigCodePoint CR_No[] = {
- 41,
+ 42,
0x00b2, 0x00b3,
0x00b9, 0x00b9,
0x00bc, 0x00be,
@@ -3852,6 +8944,7 @@ static const OnigCodePoint CR_No[] = {
0x2cfd, 0x2cfd,
0x3192, 0x3195,
0x3220, 0x3229,
+ 0x3248, 0x324f,
0x3251, 0x325f,
0x3280, 0x3289,
0x32b1, 0x32bf,
@@ -3873,142 +8966,7 @@ static const OnigCodePoint CR_No[] = {
}; /* CR_No */
/* 'P': Major Category */
-static const OnigCodePoint CR_P[] = {
- 133,
- 0x0021, 0x0023,
- 0x0025, 0x002a,
- 0x002c, 0x002f,
- 0x003a, 0x003b,
- 0x003f, 0x0040,
- 0x005b, 0x005d,
- 0x005f, 0x005f,
- 0x007b, 0x007b,
- 0x007d, 0x007d,
- 0x00a1, 0x00a1,
- 0x00ab, 0x00ab,
- 0x00b7, 0x00b7,
- 0x00bb, 0x00bb,
- 0x00bf, 0x00bf,
- 0x037e, 0x037e,
- 0x0387, 0x0387,
- 0x055a, 0x055f,
- 0x0589, 0x058a,
- 0x05be, 0x05be,
- 0x05c0, 0x05c0,
- 0x05c3, 0x05c3,
- 0x05c6, 0x05c6,
- 0x05f3, 0x05f4,
- 0x0609, 0x060a,
- 0x060c, 0x060d,
- 0x061b, 0x061b,
- 0x061e, 0x061f,
- 0x066a, 0x066d,
- 0x06d4, 0x06d4,
- 0x0700, 0x070d,
- 0x07f7, 0x07f9,
- 0x0830, 0x083e,
- 0x085e, 0x085e,
- 0x0964, 0x0965,
- 0x0970, 0x0970,
- 0x0df4, 0x0df4,
- 0x0e4f, 0x0e4f,
- 0x0e5a, 0x0e5b,
- 0x0f04, 0x0f12,
- 0x0f3a, 0x0f3d,
- 0x0f85, 0x0f85,
- 0x0fd0, 0x0fd4,
- 0x0fd9, 0x0fda,
- 0x104a, 0x104f,
- 0x10fb, 0x10fb,
- 0x1361, 0x1368,
- 0x1400, 0x1400,
- 0x166d, 0x166e,
- 0x169b, 0x169c,
- 0x16eb, 0x16ed,
- 0x1735, 0x1736,
- 0x17d4, 0x17d6,
- 0x17d8, 0x17da,
- 0x1800, 0x180a,
- 0x1944, 0x1945,
- 0x1a1e, 0x1a1f,
- 0x1aa0, 0x1aa6,
- 0x1aa8, 0x1aad,
- 0x1b5a, 0x1b60,
- 0x1bfc, 0x1bff,
- 0x1c3b, 0x1c3f,
- 0x1c7e, 0x1c7f,
- 0x1cd3, 0x1cd3,
- 0x2010, 0x2027,
- 0x2030, 0x2043,
- 0x2045, 0x2051,
- 0x2053, 0x205e,
- 0x207d, 0x207e,
- 0x208d, 0x208e,
- 0x2329, 0x232a,
- 0x2768, 0x2775,
- 0x27c5, 0x27c6,
- 0x27e6, 0x27ef,
- 0x2983, 0x2998,
- 0x29d8, 0x29db,
- 0x29fc, 0x29fd,
- 0x2cf9, 0x2cfc,
- 0x2cfe, 0x2cff,
- 0x2d70, 0x2d70,
- 0x2e00, 0x2e2e,
- 0x2e30, 0x2e31,
- 0x3001, 0x3003,
- 0x3008, 0x3011,
- 0x3014, 0x301f,
- 0x3030, 0x3030,
- 0x303d, 0x303d,
- 0x30a0, 0x30a0,
- 0x30fb, 0x30fb,
- 0xa4fe, 0xa4ff,
- 0xa60d, 0xa60f,
- 0xa673, 0xa673,
- 0xa67e, 0xa67e,
- 0xa6f2, 0xa6f7,
- 0xa874, 0xa877,
- 0xa8ce, 0xa8cf,
- 0xa8f8, 0xa8fa,
- 0xa92e, 0xa92f,
- 0xa95f, 0xa95f,
- 0xa9c1, 0xa9cd,
- 0xa9de, 0xa9df,
- 0xaa5c, 0xaa5f,
- 0xaade, 0xaadf,
- 0xabeb, 0xabeb,
- 0xfd3e, 0xfd3f,
- 0xfe10, 0xfe19,
- 0xfe30, 0xfe52,
- 0xfe54, 0xfe61,
- 0xfe63, 0xfe63,
- 0xfe68, 0xfe68,
- 0xfe6a, 0xfe6b,
- 0xff01, 0xff03,
- 0xff05, 0xff0a,
- 0xff0c, 0xff0f,
- 0xff1a, 0xff1b,
- 0xff1f, 0xff20,
- 0xff3b, 0xff3d,
- 0xff3f, 0xff3f,
- 0xff5b, 0xff5b,
- 0xff5d, 0xff5d,
- 0xff5f, 0xff65,
- 0x10100, 0x10101,
- 0x1039f, 0x1039f,
- 0x103d0, 0x103d0,
- 0x10857, 0x10857,
- 0x1091f, 0x1091f,
- 0x1093f, 0x1093f,
- 0x10a50, 0x10a58,
- 0x10a7f, 0x10a7f,
- 0x10b39, 0x10b3f,
- 0x11047, 0x1104d,
- 0x110bb, 0x110bc,
- 0x110be, 0x110c1,
- 0x12470, 0x12473,
-}; /* CR_P */
+#define CR_P CR_Punct
/* 'Pc': General Category */
static const OnigCodePoint CR_Pc[] = {
@@ -4023,7 +8981,7 @@ static const OnigCodePoint CR_Pc[] = {
/* 'Pd': General Category */
static const OnigCodePoint CR_Pd[] = {
- 15,
+ 16,
0x002d, 0x002d,
0x058a, 0x058a,
0x05be, 0x05be,
@@ -4032,6 +8990,7 @@ static const OnigCodePoint CR_Pd[] = {
0x2010, 0x2015,
0x2e17, 0x2e17,
0x2e1a, 0x2e1a,
+ 0x2e3a, 0x2e3b,
0x301c, 0x301c,
0x3030, 0x3030,
0x30a0, 0x30a0,
@@ -4149,7 +9108,7 @@ static const OnigCodePoint CR_Pi[] = {
/* 'Po': General Category */
static const OnigCodePoint CR_Po[] = {
- 128,
+ 135,
0x0021, 0x0023,
0x0025, 0x0027,
0x002a, 0x002a,
@@ -4159,7 +9118,8 @@ static const OnigCodePoint CR_Po[] = {
0x003f, 0x0040,
0x005c, 0x005c,
0x00a1, 0x00a1,
- 0x00b7, 0x00b7,
+ 0x00a7, 0x00a7,
+ 0x00b6, 0x00b7,
0x00bf, 0x00bf,
0x037e, 0x037e,
0x0387, 0x0387,
@@ -4181,16 +9141,18 @@ static const OnigCodePoint CR_Po[] = {
0x085e, 0x085e,
0x0964, 0x0965,
0x0970, 0x0970,
+ 0x0af0, 0x0af0,
0x0df4, 0x0df4,
0x0e4f, 0x0e4f,
0x0e5a, 0x0e5b,
0x0f04, 0x0f12,
+ 0x0f14, 0x0f14,
0x0f85, 0x0f85,
0x0fd0, 0x0fd4,
0x0fd9, 0x0fda,
0x104a, 0x104f,
0x10fb, 0x10fb,
- 0x1361, 0x1368,
+ 0x1360, 0x1368,
0x166d, 0x166e,
0x16eb, 0x16ed,
0x1735, 0x1736,
@@ -4206,6 +9168,7 @@ static const OnigCodePoint CR_Po[] = {
0x1bfc, 0x1bff,
0x1c3b, 0x1c3f,
0x1c7e, 0x1c7f,
+ 0x1cc0, 0x1cc7,
0x1cd3, 0x1cd3,
0x2016, 0x2017,
0x2020, 0x2027,
@@ -4226,7 +9189,7 @@ static const OnigCodePoint CR_Po[] = {
0x2e1b, 0x2e1b,
0x2e1e, 0x2e1f,
0x2e2a, 0x2e2e,
- 0x2e30, 0x2e31,
+ 0x2e30, 0x2e39,
0x3001, 0x3003,
0x303d, 0x303d,
0x30fb, 0x30fb,
@@ -4244,6 +9207,7 @@ static const OnigCodePoint CR_Po[] = {
0xa9de, 0xa9df,
0xaa5c, 0xaa5f,
0xaade, 0xaadf,
+ 0xaaf0, 0xaaf1,
0xabeb, 0xabeb,
0xfe10, 0xfe16,
0xfe19, 0xfe19,
@@ -4265,7 +9229,7 @@ static const OnigCodePoint CR_Po[] = {
0xff3c, 0xff3c,
0xff61, 0xff61,
0xff64, 0xff65,
- 0x10100, 0x10101,
+ 0x10100, 0x10102,
0x1039f, 0x1039f,
0x103d0, 0x103d0,
0x10857, 0x10857,
@@ -4277,6 +9241,8 @@ static const OnigCodePoint CR_Po[] = {
0x11047, 0x1104d,
0x110bb, 0x110bc,
0x110be, 0x110c1,
+ 0x11140, 0x11143,
+ 0x111c5, 0x111c8,
0x12470, 0x12473,
}; /* CR_Po */
@@ -4359,7 +9325,7 @@ static const OnigCodePoint CR_Ps[] = {
/* 'S': Major Category */
static const OnigCodePoint CR_S[] = {
- 208,
+ 198,
0x0024, 0x0024,
0x002b, 0x002b,
0x003c, 0x003e,
@@ -4367,11 +9333,11 @@ static const OnigCodePoint CR_S[] = {
0x0060, 0x0060,
0x007c, 0x007c,
0x007e, 0x007e,
- 0x00a2, 0x00a9,
+ 0x00a2, 0x00a6,
+ 0x00a8, 0x00a9,
0x00ac, 0x00ac,
0x00ae, 0x00b1,
0x00b4, 0x00b4,
- 0x00b6, 0x00b6,
0x00b8, 0x00b8,
0x00d7, 0x00d7,
0x00f7, 0x00f7,
@@ -4384,6 +9350,7 @@ static const OnigCodePoint CR_S[] = {
0x0384, 0x0385,
0x03f6, 0x03f6,
0x0482, 0x0482,
+ 0x058f, 0x058f,
0x0606, 0x0608,
0x060b, 0x060b,
0x060e, 0x060f,
@@ -4400,7 +9367,8 @@ static const OnigCodePoint CR_S[] = {
0x0d79, 0x0d79,
0x0e3f, 0x0e3f,
0x0f01, 0x0f03,
- 0x0f13, 0x0f17,
+ 0x0f13, 0x0f13,
+ 0x0f15, 0x0f17,
0x0f1a, 0x0f1f,
0x0f34, 0x0f34,
0x0f36, 0x0f36,
@@ -4410,7 +9378,6 @@ static const OnigCodePoint CR_S[] = {
0x0fce, 0x0fcf,
0x0fd5, 0x0fd8,
0x109e, 0x109f,
- 0x1360, 0x1360,
0x1390, 0x1399,
0x17db, 0x17db,
0x1940, 0x1940,
@@ -4450,9 +9417,7 @@ static const OnigCodePoint CR_S[] = {
0x2500, 0x26ff,
0x2701, 0x2767,
0x2794, 0x27c4,
- 0x27c7, 0x27ca,
- 0x27cc, 0x27cc,
- 0x27ce, 0x27e5,
+ 0x27c7, 0x27e5,
0x27f0, 0x2982,
0x2999, 0x29d7,
0x29dc, 0x29fb,
@@ -4473,7 +9438,8 @@ static const OnigCodePoint CR_S[] = {
0x3196, 0x319f,
0x31c0, 0x31e3,
0x3200, 0x321e,
- 0x322a, 0x3250,
+ 0x322a, 0x3247,
+ 0x3250, 0x3250,
0x3260, 0x327f,
0x328a, 0x32b0,
0x32c0, 0x32fe,
@@ -4502,7 +9468,6 @@ static const OnigCodePoint CR_S[] = {
0xffe0, 0xffe6,
0xffe8, 0xffee,
0xfffc, 0xfffd,
- 0x10102, 0x10102,
0x10137, 0x1013f,
0x10179, 0x10189,
0x10190, 0x1019b,
@@ -4527,6 +9492,7 @@ static const OnigCodePoint CR_S[] = {
0x1d789, 0x1d789,
0x1d7a9, 0x1d7a9,
0x1d7c3, 0x1d7c3,
+ 0x1eef0, 0x1eef1,
0x1f000, 0x1f02b,
0x1f030, 0x1f093,
0x1f0a0, 0x1f0ae,
@@ -4534,7 +9500,7 @@ static const OnigCodePoint CR_S[] = {
0x1f0c1, 0x1f0cf,
0x1f0d1, 0x1f0df,
0x1f110, 0x1f12e,
- 0x1f130, 0x1f169,
+ 0x1f130, 0x1f16b,
0x1f170, 0x1f19a,
0x1f1e6, 0x1f202,
0x1f210, 0x1f23a,
@@ -4552,19 +9518,9 @@ static const OnigCodePoint CR_S[] = {
0x1f442, 0x1f4f7,
0x1f4f9, 0x1f4fc,
0x1f500, 0x1f53d,
+ 0x1f540, 0x1f543,
0x1f550, 0x1f567,
- 0x1f5fb, 0x1f5ff,
- 0x1f601, 0x1f610,
- 0x1f612, 0x1f614,
- 0x1f616, 0x1f616,
- 0x1f618, 0x1f618,
- 0x1f61a, 0x1f61a,
- 0x1f61c, 0x1f61e,
- 0x1f620, 0x1f625,
- 0x1f628, 0x1f62b,
- 0x1f62d, 0x1f62d,
- 0x1f630, 0x1f633,
- 0x1f635, 0x1f640,
+ 0x1f5fb, 0x1f640,
0x1f645, 0x1f64f,
0x1f680, 0x1f6c5,
0x1f700, 0x1f773,
@@ -4572,9 +9528,10 @@ static const OnigCodePoint CR_S[] = {
/* 'Sc': General Category */
static const OnigCodePoint CR_Sc[] = {
- 16,
+ 17,
0x0024, 0x0024,
0x00a2, 0x00a5,
+ 0x058f, 0x058f,
0x060b, 0x060b,
0x09f2, 0x09f3,
0x09fb, 0x09fb,
@@ -4625,7 +9582,7 @@ static const OnigCodePoint CR_Sk[] = {
/* 'Sm': General Category */
static const OnigCodePoint CR_Sm[] = {
- 66,
+ 65,
0x002b, 0x002b,
0x003c, 0x003e,
0x007c, 0x007c,
@@ -4663,9 +9620,7 @@ static const OnigCodePoint CR_Sm[] = {
0x25f8, 0x25ff,
0x266f, 0x266f,
0x27c0, 0x27c4,
- 0x27c7, 0x27ca,
- 0x27cc, 0x27cc,
- 0x27ce, 0x27e5,
+ 0x27c7, 0x27e5,
0x27f0, 0x27ff,
0x2900, 0x2982,
0x2999, 0x29d7,
@@ -4692,16 +9647,16 @@ static const OnigCodePoint CR_Sm[] = {
0x1d789, 0x1d789,
0x1d7a9, 0x1d7a9,
0x1d7c3, 0x1d7c3,
+ 0x1eef0, 0x1eef1,
}; /* CR_Sm */
/* 'So': General Category */
static const OnigCodePoint CR_So[] = {
- 164,
- 0x00a6, 0x00a7,
+ 153,
+ 0x00a6, 0x00a6,
0x00a9, 0x00a9,
0x00ae, 0x00ae,
0x00b0, 0x00b0,
- 0x00b6, 0x00b6,
0x0482, 0x0482,
0x060e, 0x060f,
0x06de, 0x06de,
@@ -4715,7 +9670,8 @@ static const OnigCodePoint CR_So[] = {
0x0c7f, 0x0c7f,
0x0d79, 0x0d79,
0x0f01, 0x0f03,
- 0x0f13, 0x0f17,
+ 0x0f13, 0x0f13,
+ 0x0f15, 0x0f17,
0x0f1a, 0x0f1f,
0x0f34, 0x0f34,
0x0f36, 0x0f36,
@@ -4725,7 +9681,6 @@ static const OnigCodePoint CR_So[] = {
0x0fce, 0x0fcf,
0x0fd5, 0x0fd8,
0x109e, 0x109f,
- 0x1360, 0x1360,
0x1390, 0x1399,
0x1940, 0x1940,
0x19de, 0x19ff,
@@ -4789,7 +9744,8 @@ static const OnigCodePoint CR_So[] = {
0x3196, 0x319f,
0x31c0, 0x31e3,
0x3200, 0x321e,
- 0x322a, 0x3250,
+ 0x322a, 0x3247,
+ 0x3250, 0x3250,
0x3260, 0x327f,
0x328a, 0x32b0,
0x32c0, 0x32fe,
@@ -4805,7 +9761,6 @@ static const OnigCodePoint CR_So[] = {
0xffe8, 0xffe8,
0xffed, 0xffee,
0xfffc, 0xfffd,
- 0x10102, 0x10102,
0x10137, 0x1013f,
0x10179, 0x10189,
0x10190, 0x1019b,
@@ -4827,7 +9782,7 @@ static const OnigCodePoint CR_So[] = {
0x1f0c1, 0x1f0cf,
0x1f0d1, 0x1f0df,
0x1f110, 0x1f12e,
- 0x1f130, 0x1f169,
+ 0x1f130, 0x1f16b,
0x1f170, 0x1f19a,
0x1f1e6, 0x1f202,
0x1f210, 0x1f23a,
@@ -4845,19 +9800,9 @@ static const OnigCodePoint CR_So[] = {
0x1f442, 0x1f4f7,
0x1f4f9, 0x1f4fc,
0x1f500, 0x1f53d,
+ 0x1f540, 0x1f543,
0x1f550, 0x1f567,
- 0x1f5fb, 0x1f5ff,
- 0x1f601, 0x1f610,
- 0x1f612, 0x1f614,
- 0x1f616, 0x1f616,
- 0x1f618, 0x1f618,
- 0x1f61a, 0x1f61a,
- 0x1f61c, 0x1f61e,
- 0x1f620, 0x1f625,
- 0x1f628, 0x1f62b,
- 0x1f62d, 0x1f62d,
- 0x1f630, 0x1f633,
- 0x1f635, 0x1f640,
+ 0x1f5fb, 0x1f640,
0x1f645, 0x1f64f,
0x1f680, 0x1f6c5,
0x1f700, 0x1f773,
@@ -4904,7 +9849,7 @@ static const OnigCodePoint CR_Zs[] = {
/* 'Math': Derived Property */
static const OnigCodePoint CR_Math[] = {
- 106,
+ 138,
0x002b, 0x002b,
0x003c, 0x003e,
0x005e, 0x005e,
@@ -4973,9 +9918,7 @@ static const OnigCodePoint CR_Math[] = {
0x2642, 0x2642,
0x2660, 0x2663,
0x266d, 0x266f,
- 0x27c0, 0x27ca,
- 0x27cc, 0x27cc,
- 0x27ce, 0x27ff,
+ 0x27c0, 0x27ff,
0x2900, 0x2aff,
0x2b30, 0x2b44,
0x2b47, 0x2b4c,
@@ -5011,1729 +9954,54 @@ static const OnigCodePoint CR_Math[] = {
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,
}; /* CR_Math */
/* 'Alphabetic': Derived Property */
-static const OnigCodePoint CR_Alphabetic[] = {
- 486,
- 0x0041, 0x005a,
- 0x0061, 0x007a,
- 0x00aa, 0x00aa,
- 0x00b5, 0x00b5,
- 0x00ba, 0x00ba,
- 0x00c0, 0x00d6,
- 0x00d8, 0x00f6,
- 0x00f8, 0x02c1,
- 0x02c6, 0x02d1,
- 0x02e0, 0x02e4,
- 0x02ec, 0x02ec,
- 0x02ee, 0x02ee,
- 0x0345, 0x0345,
- 0x0370, 0x0374,
- 0x0376, 0x0377,
- 0x037a, 0x037d,
- 0x0386, 0x0386,
- 0x0388, 0x038a,
- 0x038c, 0x038c,
- 0x038e, 0x03a1,
- 0x03a3, 0x03f5,
- 0x03f7, 0x0481,
- 0x048a, 0x0527,
- 0x0531, 0x0556,
- 0x0559, 0x0559,
- 0x0561, 0x0587,
- 0x05b0, 0x05bd,
- 0x05bf, 0x05bf,
- 0x05c1, 0x05c2,
- 0x05c4, 0x05c5,
- 0x05c7, 0x05c7,
- 0x05d0, 0x05ea,
- 0x05f0, 0x05f2,
- 0x0610, 0x061a,
- 0x0620, 0x0657,
- 0x0659, 0x065f,
- 0x066e, 0x06d3,
- 0x06d5, 0x06dc,
- 0x06e1, 0x06e8,
- 0x06ed, 0x06ef,
- 0x06fa, 0x06fc,
- 0x06ff, 0x06ff,
- 0x0710, 0x073f,
- 0x074d, 0x07b1,
- 0x07ca, 0x07ea,
- 0x07f4, 0x07f5,
- 0x07fa, 0x07fa,
- 0x0800, 0x0817,
- 0x081a, 0x082c,
- 0x0840, 0x0858,
- 0x0900, 0x093b,
- 0x093d, 0x094c,
- 0x094e, 0x0950,
- 0x0955, 0x0963,
- 0x0971, 0x0977,
- 0x0979, 0x097f,
- 0x0981, 0x0983,
- 0x0985, 0x098c,
- 0x098f, 0x0990,
- 0x0993, 0x09a8,
- 0x09aa, 0x09b0,
- 0x09b2, 0x09b2,
- 0x09b6, 0x09b9,
- 0x09bd, 0x09c4,
- 0x09c7, 0x09c8,
- 0x09cb, 0x09cc,
- 0x09ce, 0x09ce,
- 0x09d7, 0x09d7,
- 0x09dc, 0x09dd,
- 0x09df, 0x09e3,
- 0x09f0, 0x09f1,
- 0x0a01, 0x0a03,
- 0x0a05, 0x0a0a,
- 0x0a0f, 0x0a10,
- 0x0a13, 0x0a28,
- 0x0a2a, 0x0a30,
- 0x0a32, 0x0a33,
- 0x0a35, 0x0a36,
- 0x0a38, 0x0a39,
- 0x0a3e, 0x0a42,
- 0x0a47, 0x0a48,
- 0x0a4b, 0x0a4c,
- 0x0a51, 0x0a51,
- 0x0a59, 0x0a5c,
- 0x0a5e, 0x0a5e,
- 0x0a70, 0x0a75,
- 0x0a81, 0x0a83,
- 0x0a85, 0x0a8d,
- 0x0a8f, 0x0a91,
- 0x0a93, 0x0aa8,
- 0x0aaa, 0x0ab0,
- 0x0ab2, 0x0ab3,
- 0x0ab5, 0x0ab9,
- 0x0abd, 0x0ac5,
- 0x0ac7, 0x0ac9,
- 0x0acb, 0x0acc,
- 0x0ad0, 0x0ad0,
- 0x0ae0, 0x0ae3,
- 0x0b01, 0x0b03,
- 0x0b05, 0x0b0c,
- 0x0b0f, 0x0b10,
- 0x0b13, 0x0b28,
- 0x0b2a, 0x0b30,
- 0x0b32, 0x0b33,
- 0x0b35, 0x0b39,
- 0x0b3d, 0x0b44,
- 0x0b47, 0x0b48,
- 0x0b4b, 0x0b4c,
- 0x0b56, 0x0b57,
- 0x0b5c, 0x0b5d,
- 0x0b5f, 0x0b63,
- 0x0b71, 0x0b71,
- 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, 0x0bcc,
- 0x0bd0, 0x0bd0,
- 0x0bd7, 0x0bd7,
- 0x0c01, 0x0c03,
- 0x0c05, 0x0c0c,
- 0x0c0e, 0x0c10,
- 0x0c12, 0x0c28,
- 0x0c2a, 0x0c33,
- 0x0c35, 0x0c39,
- 0x0c3d, 0x0c44,
- 0x0c46, 0x0c48,
- 0x0c4a, 0x0c4c,
- 0x0c55, 0x0c56,
- 0x0c58, 0x0c59,
- 0x0c60, 0x0c63,
- 0x0c82, 0x0c83,
- 0x0c85, 0x0c8c,
- 0x0c8e, 0x0c90,
- 0x0c92, 0x0ca8,
- 0x0caa, 0x0cb3,
- 0x0cb5, 0x0cb9,
- 0x0cbd, 0x0cc4,
- 0x0cc6, 0x0cc8,
- 0x0cca, 0x0ccc,
- 0x0cd5, 0x0cd6,
- 0x0cde, 0x0cde,
- 0x0ce0, 0x0ce3,
- 0x0cf1, 0x0cf2,
- 0x0d02, 0x0d03,
- 0x0d05, 0x0d0c,
- 0x0d0e, 0x0d10,
- 0x0d12, 0x0d3a,
- 0x0d3d, 0x0d44,
- 0x0d46, 0x0d48,
- 0x0d4a, 0x0d4c,
- 0x0d4e, 0x0d4e,
- 0x0d57, 0x0d57,
- 0x0d60, 0x0d63,
- 0x0d7a, 0x0d7f,
- 0x0d82, 0x0d83,
- 0x0d85, 0x0d96,
- 0x0d9a, 0x0db1,
- 0x0db3, 0x0dbb,
- 0x0dbd, 0x0dbd,
- 0x0dc0, 0x0dc6,
- 0x0dcf, 0x0dd4,
- 0x0dd6, 0x0dd6,
- 0x0dd8, 0x0ddf,
- 0x0df2, 0x0df3,
- 0x0e01, 0x0e3a,
- 0x0e40, 0x0e46,
- 0x0e4d, 0x0e4d,
- 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,
- 0x0ecd, 0x0ecd,
- 0x0edc, 0x0edd,
- 0x0f00, 0x0f00,
- 0x0f40, 0x0f47,
- 0x0f49, 0x0f6c,
- 0x0f71, 0x0f81,
- 0x0f88, 0x0f97,
- 0x0f99, 0x0fbc,
- 0x1000, 0x1036,
- 0x1038, 0x1038,
- 0x103b, 0x103f,
- 0x1050, 0x1062,
- 0x1065, 0x1068,
- 0x106e, 0x1086,
- 0x108e, 0x108e,
- 0x109c, 0x109d,
- 0x10a0, 0x10c5,
- 0x10d0, 0x10fa,
- 0x10fc, 0x10fc,
- 0x1100, 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,
- 0x135f, 0x135f,
- 0x1380, 0x138f,
- 0x13a0, 0x13f4,
- 0x1401, 0x166c,
- 0x166f, 0x167f,
- 0x1681, 0x169a,
- 0x16a0, 0x16ea,
- 0x16ee, 0x16f0,
- 0x1700, 0x170c,
- 0x170e, 0x1713,
- 0x1720, 0x1733,
- 0x1740, 0x1753,
- 0x1760, 0x176c,
- 0x176e, 0x1770,
- 0x1772, 0x1773,
- 0x1780, 0x17b3,
- 0x17b6, 0x17c8,
- 0x17d7, 0x17d7,
- 0x17dc, 0x17dc,
- 0x1820, 0x1877,
- 0x1880, 0x18aa,
- 0x18b0, 0x18f5,
- 0x1900, 0x191c,
- 0x1920, 0x192b,
- 0x1930, 0x1938,
- 0x1950, 0x196d,
- 0x1970, 0x1974,
- 0x1980, 0x19ab,
- 0x19b0, 0x19c9,
- 0x1a00, 0x1a1b,
- 0x1a20, 0x1a5e,
- 0x1a61, 0x1a74,
- 0x1aa7, 0x1aa7,
- 0x1b00, 0x1b33,
- 0x1b35, 0x1b43,
- 0x1b45, 0x1b4b,
- 0x1b80, 0x1ba9,
- 0x1bae, 0x1baf,
- 0x1bc0, 0x1be5,
- 0x1be7, 0x1bf1,
- 0x1c00, 0x1c35,
- 0x1c4d, 0x1c4f,
- 0x1c5a, 0x1c7d,
- 0x1ce9, 0x1cec,
- 0x1cee, 0x1cf2,
- 0x1d00, 0x1dbf,
- 0x1e00, 0x1f15,
- 0x1f18, 0x1f1d,
- 0x1f20, 0x1f45,
- 0x1f48, 0x1f4d,
- 0x1f50, 0x1f57,
- 0x1f59, 0x1f59,
- 0x1f5b, 0x1f5b,
- 0x1f5d, 0x1f5d,
- 0x1f5f, 0x1f7d,
- 0x1f80, 0x1fb4,
- 0x1fb6, 0x1fbc,
- 0x1fbe, 0x1fbe,
- 0x1fc2, 0x1fc4,
- 0x1fc6, 0x1fcc,
- 0x1fd0, 0x1fd3,
- 0x1fd6, 0x1fdb,
- 0x1fe0, 0x1fec,
- 0x1ff2, 0x1ff4,
- 0x1ff6, 0x1ffc,
- 0x2071, 0x2071,
- 0x207f, 0x207f,
- 0x2090, 0x209c,
- 0x2102, 0x2102,
- 0x2107, 0x2107,
- 0x210a, 0x2113,
- 0x2115, 0x2115,
- 0x2119, 0x211d,
- 0x2124, 0x2124,
- 0x2126, 0x2126,
- 0x2128, 0x2128,
- 0x212a, 0x212d,
- 0x212f, 0x2139,
- 0x213c, 0x213f,
- 0x2145, 0x2149,
- 0x214e, 0x214e,
- 0x2160, 0x2188,
- 0x24b6, 0x24e9,
- 0x2c00, 0x2c2e,
- 0x2c30, 0x2c5e,
- 0x2c60, 0x2ce4,
- 0x2ceb, 0x2cee,
- 0x2d00, 0x2d25,
- 0x2d30, 0x2d65,
- 0x2d6f, 0x2d6f,
- 0x2d80, 0x2d96,
- 0x2da0, 0x2da6,
- 0x2da8, 0x2dae,
- 0x2db0, 0x2db6,
- 0x2db8, 0x2dbe,
- 0x2dc0, 0x2dc6,
- 0x2dc8, 0x2dce,
- 0x2dd0, 0x2dd6,
- 0x2dd8, 0x2dde,
- 0x2de0, 0x2dff,
- 0x2e2f, 0x2e2f,
- 0x3005, 0x3007,
- 0x3021, 0x3029,
- 0x3031, 0x3035,
- 0x3038, 0x303c,
- 0x3041, 0x3096,
- 0x309d, 0x309f,
- 0x30a1, 0x30fa,
- 0x30fc, 0x30ff,
- 0x3105, 0x312d,
- 0x3131, 0x318e,
- 0x31a0, 0x31ba,
- 0x31f0, 0x31ff,
- 0x3400, 0x4db5,
- 0x4e00, 0x9fcb,
- 0xa000, 0xa48c,
- 0xa4d0, 0xa4fd,
- 0xa500, 0xa60c,
- 0xa610, 0xa61f,
- 0xa62a, 0xa62b,
- 0xa640, 0xa66e,
- 0xa67f, 0xa697,
- 0xa6a0, 0xa6ef,
- 0xa717, 0xa71f,
- 0xa722, 0xa788,
- 0xa78b, 0xa78e,
- 0xa790, 0xa791,
- 0xa7a0, 0xa7a9,
- 0xa7fa, 0xa801,
- 0xa803, 0xa805,
- 0xa807, 0xa80a,
- 0xa80c, 0xa827,
- 0xa840, 0xa873,
- 0xa880, 0xa8c3,
- 0xa8f2, 0xa8f7,
- 0xa8fb, 0xa8fb,
- 0xa90a, 0xa92a,
- 0xa930, 0xa952,
- 0xa960, 0xa97c,
- 0xa980, 0xa9b2,
- 0xa9b4, 0xa9bf,
- 0xa9cf, 0xa9cf,
- 0xaa00, 0xaa36,
- 0xaa40, 0xaa4d,
- 0xaa60, 0xaa76,
- 0xaa7a, 0xaa7a,
- 0xaa80, 0xaabe,
- 0xaac0, 0xaac0,
- 0xaac2, 0xaac2,
- 0xaadb, 0xaadd,
- 0xab01, 0xab06,
- 0xab09, 0xab0e,
- 0xab11, 0xab16,
- 0xab20, 0xab26,
- 0xab28, 0xab2e,
- 0xabc0, 0xabea,
- 0xac00, 0xd7a3,
- 0xd7b0, 0xd7c6,
- 0xd7cb, 0xd7fb,
- 0xf900, 0xfa2d,
- 0xfa30, 0xfa6d,
- 0xfa70, 0xfad9,
- 0xfb00, 0xfb06,
- 0xfb13, 0xfb17,
- 0xfb1d, 0xfb28,
- 0xfb2a, 0xfb36,
- 0xfb38, 0xfb3c,
- 0xfb3e, 0xfb3e,
- 0xfb40, 0xfb41,
- 0xfb43, 0xfb44,
- 0xfb46, 0xfbb1,
- 0xfbd3, 0xfd3d,
- 0xfd50, 0xfd8f,
- 0xfd92, 0xfdc7,
- 0xfdf0, 0xfdfb,
- 0xfe70, 0xfe74,
- 0xfe76, 0xfefc,
- 0xff21, 0xff3a,
- 0xff41, 0xff5a,
- 0xff66, 0xffbe,
- 0xffc2, 0xffc7,
- 0xffca, 0xffcf,
- 0xffd2, 0xffd7,
- 0xffda, 0xffdc,
- 0x10000, 0x1000b,
- 0x1000d, 0x10026,
- 0x10028, 0x1003a,
- 0x1003c, 0x1003d,
- 0x1003f, 0x1004d,
- 0x10050, 0x1005d,
- 0x10080, 0x100fa,
- 0x10140, 0x10174,
- 0x10280, 0x1029c,
- 0x102a0, 0x102d0,
- 0x10300, 0x1031e,
- 0x10330, 0x1034a,
- 0x10380, 0x1039d,
- 0x103a0, 0x103c3,
- 0x103c8, 0x103cf,
- 0x103d1, 0x103d5,
- 0x10400, 0x1049d,
- 0x10800, 0x10805,
- 0x10808, 0x10808,
- 0x1080a, 0x10835,
- 0x10837, 0x10838,
- 0x1083c, 0x1083c,
- 0x1083f, 0x10855,
- 0x10900, 0x10915,
- 0x10920, 0x10939,
- 0x10a00, 0x10a03,
- 0x10a05, 0x10a06,
- 0x10a0c, 0x10a13,
- 0x10a15, 0x10a17,
- 0x10a19, 0x10a33,
- 0x10a60, 0x10a7c,
- 0x10b00, 0x10b35,
- 0x10b40, 0x10b55,
- 0x10b60, 0x10b72,
- 0x10c00, 0x10c48,
- 0x11000, 0x11045,
- 0x11082, 0x110b8,
- 0x12000, 0x1236e,
- 0x12400, 0x12462,
- 0x13000, 0x1342e,
- 0x16800, 0x16a38,
- 0x1b000, 0x1b001,
- 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, 0x1d6c0,
- 0x1d6c2, 0x1d6da,
- 0x1d6dc, 0x1d6fa,
- 0x1d6fc, 0x1d714,
- 0x1d716, 0x1d734,
- 0x1d736, 0x1d74e,
- 0x1d750, 0x1d76e,
- 0x1d770, 0x1d788,
- 0x1d78a, 0x1d7a8,
- 0x1d7aa, 0x1d7c2,
- 0x1d7c4, 0x1d7cb,
- 0x20000, 0x2a6d6,
- 0x2a700, 0x2b734,
- 0x2b740, 0x2b81d,
- 0x2f800, 0x2fa1d,
-}; /* CR_Alphabetic */
+#define CR_Alphabetic CR_Alpha
/* 'Lowercase': Derived Property */
-static const OnigCodePoint CR_Lowercase[] = {
- 612,
- 0x0061, 0x007a,
- 0x00aa, 0x00aa,
- 0x00b5, 0x00b5,
- 0x00ba, 0x00ba,
- 0x00df, 0x00f6,
- 0x00f8, 0x00ff,
- 0x0101, 0x0101,
- 0x0103, 0x0103,
- 0x0105, 0x0105,
- 0x0107, 0x0107,
- 0x0109, 0x0109,
- 0x010b, 0x010b,
- 0x010d, 0x010d,
- 0x010f, 0x010f,
- 0x0111, 0x0111,
- 0x0113, 0x0113,
- 0x0115, 0x0115,
- 0x0117, 0x0117,
- 0x0119, 0x0119,
- 0x011b, 0x011b,
- 0x011d, 0x011d,
- 0x011f, 0x011f,
- 0x0121, 0x0121,
- 0x0123, 0x0123,
- 0x0125, 0x0125,
- 0x0127, 0x0127,
- 0x0129, 0x0129,
- 0x012b, 0x012b,
- 0x012d, 0x012d,
- 0x012f, 0x012f,
- 0x0131, 0x0131,
- 0x0133, 0x0133,
- 0x0135, 0x0135,
- 0x0137, 0x0138,
- 0x013a, 0x013a,
- 0x013c, 0x013c,
- 0x013e, 0x013e,
- 0x0140, 0x0140,
- 0x0142, 0x0142,
- 0x0144, 0x0144,
- 0x0146, 0x0146,
- 0x0148, 0x0149,
- 0x014b, 0x014b,
- 0x014d, 0x014d,
- 0x014f, 0x014f,
- 0x0151, 0x0151,
- 0x0153, 0x0153,
- 0x0155, 0x0155,
- 0x0157, 0x0157,
- 0x0159, 0x0159,
- 0x015b, 0x015b,
- 0x015d, 0x015d,
- 0x015f, 0x015f,
- 0x0161, 0x0161,
- 0x0163, 0x0163,
- 0x0165, 0x0165,
- 0x0167, 0x0167,
- 0x0169, 0x0169,
- 0x016b, 0x016b,
- 0x016d, 0x016d,
- 0x016f, 0x016f,
- 0x0171, 0x0171,
- 0x0173, 0x0173,
- 0x0175, 0x0175,
- 0x0177, 0x0177,
- 0x017a, 0x017a,
- 0x017c, 0x017c,
- 0x017e, 0x0180,
- 0x0183, 0x0183,
- 0x0185, 0x0185,
- 0x0188, 0x0188,
- 0x018c, 0x018d,
- 0x0192, 0x0192,
- 0x0195, 0x0195,
- 0x0199, 0x019b,
- 0x019e, 0x019e,
- 0x01a1, 0x01a1,
- 0x01a3, 0x01a3,
- 0x01a5, 0x01a5,
- 0x01a8, 0x01a8,
- 0x01aa, 0x01ab,
- 0x01ad, 0x01ad,
- 0x01b0, 0x01b0,
- 0x01b4, 0x01b4,
- 0x01b6, 0x01b6,
- 0x01b9, 0x01ba,
- 0x01bd, 0x01bf,
- 0x01c6, 0x01c6,
- 0x01c9, 0x01c9,
- 0x01cc, 0x01cc,
- 0x01ce, 0x01ce,
- 0x01d0, 0x01d0,
- 0x01d2, 0x01d2,
- 0x01d4, 0x01d4,
- 0x01d6, 0x01d6,
- 0x01d8, 0x01d8,
- 0x01da, 0x01da,
- 0x01dc, 0x01dd,
- 0x01df, 0x01df,
- 0x01e1, 0x01e1,
- 0x01e3, 0x01e3,
- 0x01e5, 0x01e5,
- 0x01e7, 0x01e7,
- 0x01e9, 0x01e9,
- 0x01eb, 0x01eb,
- 0x01ed, 0x01ed,
- 0x01ef, 0x01f0,
- 0x01f3, 0x01f3,
- 0x01f5, 0x01f5,
- 0x01f9, 0x01f9,
- 0x01fb, 0x01fb,
- 0x01fd, 0x01fd,
- 0x01ff, 0x01ff,
- 0x0201, 0x0201,
- 0x0203, 0x0203,
- 0x0205, 0x0205,
- 0x0207, 0x0207,
- 0x0209, 0x0209,
- 0x020b, 0x020b,
- 0x020d, 0x020d,
- 0x020f, 0x020f,
- 0x0211, 0x0211,
- 0x0213, 0x0213,
- 0x0215, 0x0215,
- 0x0217, 0x0217,
- 0x0219, 0x0219,
- 0x021b, 0x021b,
- 0x021d, 0x021d,
- 0x021f, 0x021f,
- 0x0221, 0x0221,
- 0x0223, 0x0223,
- 0x0225, 0x0225,
- 0x0227, 0x0227,
- 0x0229, 0x0229,
- 0x022b, 0x022b,
- 0x022d, 0x022d,
- 0x022f, 0x022f,
- 0x0231, 0x0231,
- 0x0233, 0x0239,
- 0x023c, 0x023c,
- 0x023f, 0x0240,
- 0x0242, 0x0242,
- 0x0247, 0x0247,
- 0x0249, 0x0249,
- 0x024b, 0x024b,
- 0x024d, 0x024d,
- 0x024f, 0x0293,
- 0x0295, 0x02b8,
- 0x02c0, 0x02c1,
- 0x02e0, 0x02e4,
- 0x0345, 0x0345,
- 0x0371, 0x0371,
- 0x0373, 0x0373,
- 0x0377, 0x0377,
- 0x037a, 0x037d,
- 0x0390, 0x0390,
- 0x03ac, 0x03ce,
- 0x03d0, 0x03d1,
- 0x03d5, 0x03d7,
- 0x03d9, 0x03d9,
- 0x03db, 0x03db,
- 0x03dd, 0x03dd,
- 0x03df, 0x03df,
- 0x03e1, 0x03e1,
- 0x03e3, 0x03e3,
- 0x03e5, 0x03e5,
- 0x03e7, 0x03e7,
- 0x03e9, 0x03e9,
- 0x03eb, 0x03eb,
- 0x03ed, 0x03ed,
- 0x03ef, 0x03f3,
- 0x03f5, 0x03f5,
- 0x03f8, 0x03f8,
- 0x03fb, 0x03fc,
- 0x0430, 0x045f,
- 0x0461, 0x0461,
- 0x0463, 0x0463,
- 0x0465, 0x0465,
- 0x0467, 0x0467,
- 0x0469, 0x0469,
- 0x046b, 0x046b,
- 0x046d, 0x046d,
- 0x046f, 0x046f,
- 0x0471, 0x0471,
- 0x0473, 0x0473,
- 0x0475, 0x0475,
- 0x0477, 0x0477,
- 0x0479, 0x0479,
- 0x047b, 0x047b,
- 0x047d, 0x047d,
- 0x047f, 0x047f,
- 0x0481, 0x0481,
- 0x048b, 0x048b,
- 0x048d, 0x048d,
- 0x048f, 0x048f,
- 0x0491, 0x0491,
- 0x0493, 0x0493,
- 0x0495, 0x0495,
- 0x0497, 0x0497,
- 0x0499, 0x0499,
- 0x049b, 0x049b,
- 0x049d, 0x049d,
- 0x049f, 0x049f,
- 0x04a1, 0x04a1,
- 0x04a3, 0x04a3,
- 0x04a5, 0x04a5,
- 0x04a7, 0x04a7,
- 0x04a9, 0x04a9,
- 0x04ab, 0x04ab,
- 0x04ad, 0x04ad,
- 0x04af, 0x04af,
- 0x04b1, 0x04b1,
- 0x04b3, 0x04b3,
- 0x04b5, 0x04b5,
- 0x04b7, 0x04b7,
- 0x04b9, 0x04b9,
- 0x04bb, 0x04bb,
- 0x04bd, 0x04bd,
- 0x04bf, 0x04bf,
- 0x04c2, 0x04c2,
- 0x04c4, 0x04c4,
- 0x04c6, 0x04c6,
- 0x04c8, 0x04c8,
- 0x04ca, 0x04ca,
- 0x04cc, 0x04cc,
- 0x04ce, 0x04cf,
- 0x04d1, 0x04d1,
- 0x04d3, 0x04d3,
- 0x04d5, 0x04d5,
- 0x04d7, 0x04d7,
- 0x04d9, 0x04d9,
- 0x04db, 0x04db,
- 0x04dd, 0x04dd,
- 0x04df, 0x04df,
- 0x04e1, 0x04e1,
- 0x04e3, 0x04e3,
- 0x04e5, 0x04e5,
- 0x04e7, 0x04e7,
- 0x04e9, 0x04e9,
- 0x04eb, 0x04eb,
- 0x04ed, 0x04ed,
- 0x04ef, 0x04ef,
- 0x04f1, 0x04f1,
- 0x04f3, 0x04f3,
- 0x04f5, 0x04f5,
- 0x04f7, 0x04f7,
- 0x04f9, 0x04f9,
- 0x04fb, 0x04fb,
- 0x04fd, 0x04fd,
- 0x04ff, 0x04ff,
- 0x0501, 0x0501,
- 0x0503, 0x0503,
- 0x0505, 0x0505,
- 0x0507, 0x0507,
- 0x0509, 0x0509,
- 0x050b, 0x050b,
- 0x050d, 0x050d,
- 0x050f, 0x050f,
- 0x0511, 0x0511,
- 0x0513, 0x0513,
- 0x0515, 0x0515,
- 0x0517, 0x0517,
- 0x0519, 0x0519,
- 0x051b, 0x051b,
- 0x051d, 0x051d,
- 0x051f, 0x051f,
- 0x0521, 0x0521,
- 0x0523, 0x0523,
- 0x0525, 0x0525,
- 0x0527, 0x0527,
- 0x0561, 0x0587,
- 0x1d00, 0x1dbf,
- 0x1e01, 0x1e01,
- 0x1e03, 0x1e03,
- 0x1e05, 0x1e05,
- 0x1e07, 0x1e07,
- 0x1e09, 0x1e09,
- 0x1e0b, 0x1e0b,
- 0x1e0d, 0x1e0d,
- 0x1e0f, 0x1e0f,
- 0x1e11, 0x1e11,
- 0x1e13, 0x1e13,
- 0x1e15, 0x1e15,
- 0x1e17, 0x1e17,
- 0x1e19, 0x1e19,
- 0x1e1b, 0x1e1b,
- 0x1e1d, 0x1e1d,
- 0x1e1f, 0x1e1f,
- 0x1e21, 0x1e21,
- 0x1e23, 0x1e23,
- 0x1e25, 0x1e25,
- 0x1e27, 0x1e27,
- 0x1e29, 0x1e29,
- 0x1e2b, 0x1e2b,
- 0x1e2d, 0x1e2d,
- 0x1e2f, 0x1e2f,
- 0x1e31, 0x1e31,
- 0x1e33, 0x1e33,
- 0x1e35, 0x1e35,
- 0x1e37, 0x1e37,
- 0x1e39, 0x1e39,
- 0x1e3b, 0x1e3b,
- 0x1e3d, 0x1e3d,
- 0x1e3f, 0x1e3f,
- 0x1e41, 0x1e41,
- 0x1e43, 0x1e43,
- 0x1e45, 0x1e45,
- 0x1e47, 0x1e47,
- 0x1e49, 0x1e49,
- 0x1e4b, 0x1e4b,
- 0x1e4d, 0x1e4d,
- 0x1e4f, 0x1e4f,
- 0x1e51, 0x1e51,
- 0x1e53, 0x1e53,
- 0x1e55, 0x1e55,
- 0x1e57, 0x1e57,
- 0x1e59, 0x1e59,
- 0x1e5b, 0x1e5b,
- 0x1e5d, 0x1e5d,
- 0x1e5f, 0x1e5f,
- 0x1e61, 0x1e61,
- 0x1e63, 0x1e63,
- 0x1e65, 0x1e65,
- 0x1e67, 0x1e67,
- 0x1e69, 0x1e69,
- 0x1e6b, 0x1e6b,
- 0x1e6d, 0x1e6d,
- 0x1e6f, 0x1e6f,
- 0x1e71, 0x1e71,
- 0x1e73, 0x1e73,
- 0x1e75, 0x1e75,
- 0x1e77, 0x1e77,
- 0x1e79, 0x1e79,
- 0x1e7b, 0x1e7b,
- 0x1e7d, 0x1e7d,
- 0x1e7f, 0x1e7f,
- 0x1e81, 0x1e81,
- 0x1e83, 0x1e83,
- 0x1e85, 0x1e85,
- 0x1e87, 0x1e87,
- 0x1e89, 0x1e89,
- 0x1e8b, 0x1e8b,
- 0x1e8d, 0x1e8d,
- 0x1e8f, 0x1e8f,
- 0x1e91, 0x1e91,
- 0x1e93, 0x1e93,
- 0x1e95, 0x1e9d,
- 0x1e9f, 0x1e9f,
- 0x1ea1, 0x1ea1,
- 0x1ea3, 0x1ea3,
- 0x1ea5, 0x1ea5,
- 0x1ea7, 0x1ea7,
- 0x1ea9, 0x1ea9,
- 0x1eab, 0x1eab,
- 0x1ead, 0x1ead,
- 0x1eaf, 0x1eaf,
- 0x1eb1, 0x1eb1,
- 0x1eb3, 0x1eb3,
- 0x1eb5, 0x1eb5,
- 0x1eb7, 0x1eb7,
- 0x1eb9, 0x1eb9,
- 0x1ebb, 0x1ebb,
- 0x1ebd, 0x1ebd,
- 0x1ebf, 0x1ebf,
- 0x1ec1, 0x1ec1,
- 0x1ec3, 0x1ec3,
- 0x1ec5, 0x1ec5,
- 0x1ec7, 0x1ec7,
- 0x1ec9, 0x1ec9,
- 0x1ecb, 0x1ecb,
- 0x1ecd, 0x1ecd,
- 0x1ecf, 0x1ecf,
- 0x1ed1, 0x1ed1,
- 0x1ed3, 0x1ed3,
- 0x1ed5, 0x1ed5,
- 0x1ed7, 0x1ed7,
- 0x1ed9, 0x1ed9,
- 0x1edb, 0x1edb,
- 0x1edd, 0x1edd,
- 0x1edf, 0x1edf,
- 0x1ee1, 0x1ee1,
- 0x1ee3, 0x1ee3,
- 0x1ee5, 0x1ee5,
- 0x1ee7, 0x1ee7,
- 0x1ee9, 0x1ee9,
- 0x1eeb, 0x1eeb,
- 0x1eed, 0x1eed,
- 0x1eef, 0x1eef,
- 0x1ef1, 0x1ef1,
- 0x1ef3, 0x1ef3,
- 0x1ef5, 0x1ef5,
- 0x1ef7, 0x1ef7,
- 0x1ef9, 0x1ef9,
- 0x1efb, 0x1efb,
- 0x1efd, 0x1efd,
- 0x1eff, 0x1f07,
- 0x1f10, 0x1f15,
- 0x1f20, 0x1f27,
- 0x1f30, 0x1f37,
- 0x1f40, 0x1f45,
- 0x1f50, 0x1f57,
- 0x1f60, 0x1f67,
- 0x1f70, 0x1f7d,
- 0x1f80, 0x1f87,
- 0x1f90, 0x1f97,
- 0x1fa0, 0x1fa7,
- 0x1fb0, 0x1fb4,
- 0x1fb6, 0x1fb7,
- 0x1fbe, 0x1fbe,
- 0x1fc2, 0x1fc4,
- 0x1fc6, 0x1fc7,
- 0x1fd0, 0x1fd3,
- 0x1fd6, 0x1fd7,
- 0x1fe0, 0x1fe7,
- 0x1ff2, 0x1ff4,
- 0x1ff6, 0x1ff7,
- 0x2090, 0x2094,
- 0x210a, 0x210a,
- 0x210e, 0x210f,
- 0x2113, 0x2113,
- 0x212f, 0x212f,
- 0x2134, 0x2134,
- 0x2139, 0x2139,
- 0x213c, 0x213d,
- 0x2146, 0x2149,
- 0x214e, 0x214e,
- 0x2170, 0x217f,
- 0x2184, 0x2184,
- 0x24d0, 0x24e9,
- 0x2c30, 0x2c5e,
- 0x2c61, 0x2c61,
- 0x2c65, 0x2c66,
- 0x2c68, 0x2c68,
- 0x2c6a, 0x2c6a,
- 0x2c6c, 0x2c6c,
- 0x2c71, 0x2c71,
- 0x2c73, 0x2c74,
- 0x2c76, 0x2c7d,
- 0x2c81, 0x2c81,
- 0x2c83, 0x2c83,
- 0x2c85, 0x2c85,
- 0x2c87, 0x2c87,
- 0x2c89, 0x2c89,
- 0x2c8b, 0x2c8b,
- 0x2c8d, 0x2c8d,
- 0x2c8f, 0x2c8f,
- 0x2c91, 0x2c91,
- 0x2c93, 0x2c93,
- 0x2c95, 0x2c95,
- 0x2c97, 0x2c97,
- 0x2c99, 0x2c99,
- 0x2c9b, 0x2c9b,
- 0x2c9d, 0x2c9d,
- 0x2c9f, 0x2c9f,
- 0x2ca1, 0x2ca1,
- 0x2ca3, 0x2ca3,
- 0x2ca5, 0x2ca5,
- 0x2ca7, 0x2ca7,
- 0x2ca9, 0x2ca9,
- 0x2cab, 0x2cab,
- 0x2cad, 0x2cad,
- 0x2caf, 0x2caf,
- 0x2cb1, 0x2cb1,
- 0x2cb3, 0x2cb3,
- 0x2cb5, 0x2cb5,
- 0x2cb7, 0x2cb7,
- 0x2cb9, 0x2cb9,
- 0x2cbb, 0x2cbb,
- 0x2cbd, 0x2cbd,
- 0x2cbf, 0x2cbf,
- 0x2cc1, 0x2cc1,
- 0x2cc3, 0x2cc3,
- 0x2cc5, 0x2cc5,
- 0x2cc7, 0x2cc7,
- 0x2cc9, 0x2cc9,
- 0x2ccb, 0x2ccb,
- 0x2ccd, 0x2ccd,
- 0x2ccf, 0x2ccf,
- 0x2cd1, 0x2cd1,
- 0x2cd3, 0x2cd3,
- 0x2cd5, 0x2cd5,
- 0x2cd7, 0x2cd7,
- 0x2cd9, 0x2cd9,
- 0x2cdb, 0x2cdb,
- 0x2cdd, 0x2cdd,
- 0x2cdf, 0x2cdf,
- 0x2ce1, 0x2ce1,
- 0x2ce3, 0x2ce4,
- 0x2cec, 0x2cec,
- 0x2cee, 0x2cee,
- 0x2d00, 0x2d25,
- 0xa641, 0xa641,
- 0xa643, 0xa643,
- 0xa645, 0xa645,
- 0xa647, 0xa647,
- 0xa649, 0xa649,
- 0xa64b, 0xa64b,
- 0xa64d, 0xa64d,
- 0xa64f, 0xa64f,
- 0xa651, 0xa651,
- 0xa653, 0xa653,
- 0xa655, 0xa655,
- 0xa657, 0xa657,
- 0xa659, 0xa659,
- 0xa65b, 0xa65b,
- 0xa65d, 0xa65d,
- 0xa65f, 0xa65f,
- 0xa661, 0xa661,
- 0xa663, 0xa663,
- 0xa665, 0xa665,
- 0xa667, 0xa667,
- 0xa669, 0xa669,
- 0xa66b, 0xa66b,
- 0xa66d, 0xa66d,
- 0xa681, 0xa681,
- 0xa683, 0xa683,
- 0xa685, 0xa685,
- 0xa687, 0xa687,
- 0xa689, 0xa689,
- 0xa68b, 0xa68b,
- 0xa68d, 0xa68d,
- 0xa68f, 0xa68f,
- 0xa691, 0xa691,
- 0xa693, 0xa693,
- 0xa695, 0xa695,
- 0xa697, 0xa697,
- 0xa723, 0xa723,
- 0xa725, 0xa725,
- 0xa727, 0xa727,
- 0xa729, 0xa729,
- 0xa72b, 0xa72b,
- 0xa72d, 0xa72d,
- 0xa72f, 0xa731,
- 0xa733, 0xa733,
- 0xa735, 0xa735,
- 0xa737, 0xa737,
- 0xa739, 0xa739,
- 0xa73b, 0xa73b,
- 0xa73d, 0xa73d,
- 0xa73f, 0xa73f,
- 0xa741, 0xa741,
- 0xa743, 0xa743,
- 0xa745, 0xa745,
- 0xa747, 0xa747,
- 0xa749, 0xa749,
- 0xa74b, 0xa74b,
- 0xa74d, 0xa74d,
- 0xa74f, 0xa74f,
- 0xa751, 0xa751,
- 0xa753, 0xa753,
- 0xa755, 0xa755,
- 0xa757, 0xa757,
- 0xa759, 0xa759,
- 0xa75b, 0xa75b,
- 0xa75d, 0xa75d,
- 0xa75f, 0xa75f,
- 0xa761, 0xa761,
- 0xa763, 0xa763,
- 0xa765, 0xa765,
- 0xa767, 0xa767,
- 0xa769, 0xa769,
- 0xa76b, 0xa76b,
- 0xa76d, 0xa76d,
- 0xa76f, 0xa778,
- 0xa77a, 0xa77a,
- 0xa77c, 0xa77c,
- 0xa77f, 0xa77f,
- 0xa781, 0xa781,
- 0xa783, 0xa783,
- 0xa785, 0xa785,
- 0xa787, 0xa787,
- 0xa78c, 0xa78c,
- 0xa78e, 0xa78e,
- 0xa791, 0xa791,
- 0xa7a1, 0xa7a1,
- 0xa7a3, 0xa7a3,
- 0xa7a5, 0xa7a5,
- 0xa7a7, 0xa7a7,
- 0xa7a9, 0xa7a9,
- 0xa7fa, 0xa7fa,
- 0xfb00, 0xfb06,
- 0xfb13, 0xfb17,
- 0xff41, 0xff5a,
- 0x10428, 0x1044f,
- 0x1d41a, 0x1d433,
- 0x1d44e, 0x1d454,
- 0x1d456, 0x1d467,
- 0x1d482, 0x1d49b,
- 0x1d4b6, 0x1d4b9,
- 0x1d4bb, 0x1d4bb,
- 0x1d4bd, 0x1d4c3,
- 0x1d4c5, 0x1d4cf,
- 0x1d4ea, 0x1d503,
- 0x1d51e, 0x1d537,
- 0x1d552, 0x1d56b,
- 0x1d586, 0x1d59f,
- 0x1d5ba, 0x1d5d3,
- 0x1d5ee, 0x1d607,
- 0x1d622, 0x1d63b,
- 0x1d656, 0x1d66f,
- 0x1d68a, 0x1d6a5,
- 0x1d6c2, 0x1d6da,
- 0x1d6dc, 0x1d6e1,
- 0x1d6fc, 0x1d714,
- 0x1d716, 0x1d71b,
- 0x1d736, 0x1d74e,
- 0x1d750, 0x1d755,
- 0x1d770, 0x1d788,
- 0x1d78a, 0x1d78f,
- 0x1d7aa, 0x1d7c2,
- 0x1d7c4, 0x1d7c9,
- 0x1d7cb, 0x1d7cb,
-}; /* CR_Lowercase */
+#define CR_Lowercase CR_Lower
/* 'Uppercase': Derived Property */
-static const OnigCodePoint CR_Uppercase[] = {
- 605,
- 0x0041, 0x005a,
- 0x00c0, 0x00d6,
- 0x00d8, 0x00de,
- 0x0100, 0x0100,
- 0x0102, 0x0102,
- 0x0104, 0x0104,
- 0x0106, 0x0106,
- 0x0108, 0x0108,
- 0x010a, 0x010a,
- 0x010c, 0x010c,
- 0x010e, 0x010e,
- 0x0110, 0x0110,
- 0x0112, 0x0112,
- 0x0114, 0x0114,
- 0x0116, 0x0116,
- 0x0118, 0x0118,
- 0x011a, 0x011a,
- 0x011c, 0x011c,
- 0x011e, 0x011e,
- 0x0120, 0x0120,
- 0x0122, 0x0122,
- 0x0124, 0x0124,
- 0x0126, 0x0126,
- 0x0128, 0x0128,
- 0x012a, 0x012a,
- 0x012c, 0x012c,
- 0x012e, 0x012e,
- 0x0130, 0x0130,
- 0x0132, 0x0132,
- 0x0134, 0x0134,
- 0x0136, 0x0136,
- 0x0139, 0x0139,
- 0x013b, 0x013b,
- 0x013d, 0x013d,
- 0x013f, 0x013f,
- 0x0141, 0x0141,
- 0x0143, 0x0143,
- 0x0145, 0x0145,
- 0x0147, 0x0147,
- 0x014a, 0x014a,
- 0x014c, 0x014c,
- 0x014e, 0x014e,
- 0x0150, 0x0150,
- 0x0152, 0x0152,
- 0x0154, 0x0154,
- 0x0156, 0x0156,
- 0x0158, 0x0158,
- 0x015a, 0x015a,
- 0x015c, 0x015c,
- 0x015e, 0x015e,
- 0x0160, 0x0160,
- 0x0162, 0x0162,
- 0x0164, 0x0164,
- 0x0166, 0x0166,
- 0x0168, 0x0168,
- 0x016a, 0x016a,
- 0x016c, 0x016c,
- 0x016e, 0x016e,
- 0x0170, 0x0170,
- 0x0172, 0x0172,
- 0x0174, 0x0174,
- 0x0176, 0x0176,
- 0x0178, 0x0179,
- 0x017b, 0x017b,
- 0x017d, 0x017d,
- 0x0181, 0x0182,
- 0x0184, 0x0184,
- 0x0186, 0x0187,
- 0x0189, 0x018b,
- 0x018e, 0x0191,
- 0x0193, 0x0194,
- 0x0196, 0x0198,
- 0x019c, 0x019d,
- 0x019f, 0x01a0,
- 0x01a2, 0x01a2,
- 0x01a4, 0x01a4,
- 0x01a6, 0x01a7,
- 0x01a9, 0x01a9,
- 0x01ac, 0x01ac,
- 0x01ae, 0x01af,
- 0x01b1, 0x01b3,
- 0x01b5, 0x01b5,
- 0x01b7, 0x01b8,
- 0x01bc, 0x01bc,
- 0x01c4, 0x01c4,
- 0x01c7, 0x01c7,
- 0x01ca, 0x01ca,
- 0x01cd, 0x01cd,
- 0x01cf, 0x01cf,
- 0x01d1, 0x01d1,
- 0x01d3, 0x01d3,
- 0x01d5, 0x01d5,
- 0x01d7, 0x01d7,
- 0x01d9, 0x01d9,
- 0x01db, 0x01db,
- 0x01de, 0x01de,
- 0x01e0, 0x01e0,
- 0x01e2, 0x01e2,
- 0x01e4, 0x01e4,
- 0x01e6, 0x01e6,
- 0x01e8, 0x01e8,
- 0x01ea, 0x01ea,
- 0x01ec, 0x01ec,
- 0x01ee, 0x01ee,
- 0x01f1, 0x01f1,
- 0x01f4, 0x01f4,
- 0x01f6, 0x01f8,
- 0x01fa, 0x01fa,
- 0x01fc, 0x01fc,
- 0x01fe, 0x01fe,
- 0x0200, 0x0200,
- 0x0202, 0x0202,
- 0x0204, 0x0204,
- 0x0206, 0x0206,
- 0x0208, 0x0208,
- 0x020a, 0x020a,
- 0x020c, 0x020c,
- 0x020e, 0x020e,
- 0x0210, 0x0210,
- 0x0212, 0x0212,
- 0x0214, 0x0214,
- 0x0216, 0x0216,
- 0x0218, 0x0218,
- 0x021a, 0x021a,
- 0x021c, 0x021c,
- 0x021e, 0x021e,
- 0x0220, 0x0220,
- 0x0222, 0x0222,
- 0x0224, 0x0224,
- 0x0226, 0x0226,
- 0x0228, 0x0228,
- 0x022a, 0x022a,
- 0x022c, 0x022c,
- 0x022e, 0x022e,
- 0x0230, 0x0230,
- 0x0232, 0x0232,
- 0x023a, 0x023b,
- 0x023d, 0x023e,
- 0x0241, 0x0241,
- 0x0243, 0x0246,
- 0x0248, 0x0248,
- 0x024a, 0x024a,
- 0x024c, 0x024c,
- 0x024e, 0x024e,
- 0x0370, 0x0370,
- 0x0372, 0x0372,
- 0x0376, 0x0376,
- 0x0386, 0x0386,
- 0x0388, 0x038a,
- 0x038c, 0x038c,
- 0x038e, 0x038f,
- 0x0391, 0x03a1,
- 0x03a3, 0x03ab,
- 0x03cf, 0x03cf,
- 0x03d2, 0x03d4,
- 0x03d8, 0x03d8,
- 0x03da, 0x03da,
- 0x03dc, 0x03dc,
- 0x03de, 0x03de,
- 0x03e0, 0x03e0,
- 0x03e2, 0x03e2,
- 0x03e4, 0x03e4,
- 0x03e6, 0x03e6,
- 0x03e8, 0x03e8,
- 0x03ea, 0x03ea,
- 0x03ec, 0x03ec,
- 0x03ee, 0x03ee,
- 0x03f4, 0x03f4,
- 0x03f7, 0x03f7,
- 0x03f9, 0x03fa,
- 0x03fd, 0x042f,
- 0x0460, 0x0460,
- 0x0462, 0x0462,
- 0x0464, 0x0464,
- 0x0466, 0x0466,
- 0x0468, 0x0468,
- 0x046a, 0x046a,
- 0x046c, 0x046c,
- 0x046e, 0x046e,
- 0x0470, 0x0470,
- 0x0472, 0x0472,
- 0x0474, 0x0474,
- 0x0476, 0x0476,
- 0x0478, 0x0478,
- 0x047a, 0x047a,
- 0x047c, 0x047c,
- 0x047e, 0x047e,
- 0x0480, 0x0480,
- 0x048a, 0x048a,
- 0x048c, 0x048c,
- 0x048e, 0x048e,
- 0x0490, 0x0490,
- 0x0492, 0x0492,
- 0x0494, 0x0494,
- 0x0496, 0x0496,
- 0x0498, 0x0498,
- 0x049a, 0x049a,
- 0x049c, 0x049c,
- 0x049e, 0x049e,
- 0x04a0, 0x04a0,
- 0x04a2, 0x04a2,
- 0x04a4, 0x04a4,
- 0x04a6, 0x04a6,
- 0x04a8, 0x04a8,
- 0x04aa, 0x04aa,
- 0x04ac, 0x04ac,
- 0x04ae, 0x04ae,
- 0x04b0, 0x04b0,
- 0x04b2, 0x04b2,
- 0x04b4, 0x04b4,
- 0x04b6, 0x04b6,
- 0x04b8, 0x04b8,
- 0x04ba, 0x04ba,
- 0x04bc, 0x04bc,
- 0x04be, 0x04be,
- 0x04c0, 0x04c1,
- 0x04c3, 0x04c3,
- 0x04c5, 0x04c5,
- 0x04c7, 0x04c7,
- 0x04c9, 0x04c9,
- 0x04cb, 0x04cb,
- 0x04cd, 0x04cd,
- 0x04d0, 0x04d0,
- 0x04d2, 0x04d2,
- 0x04d4, 0x04d4,
- 0x04d6, 0x04d6,
- 0x04d8, 0x04d8,
- 0x04da, 0x04da,
- 0x04dc, 0x04dc,
- 0x04de, 0x04de,
- 0x04e0, 0x04e0,
- 0x04e2, 0x04e2,
- 0x04e4, 0x04e4,
- 0x04e6, 0x04e6,
- 0x04e8, 0x04e8,
- 0x04ea, 0x04ea,
- 0x04ec, 0x04ec,
- 0x04ee, 0x04ee,
- 0x04f0, 0x04f0,
- 0x04f2, 0x04f2,
- 0x04f4, 0x04f4,
- 0x04f6, 0x04f6,
- 0x04f8, 0x04f8,
- 0x04fa, 0x04fa,
- 0x04fc, 0x04fc,
- 0x04fe, 0x04fe,
- 0x0500, 0x0500,
- 0x0502, 0x0502,
- 0x0504, 0x0504,
- 0x0506, 0x0506,
- 0x0508, 0x0508,
- 0x050a, 0x050a,
- 0x050c, 0x050c,
- 0x050e, 0x050e,
- 0x0510, 0x0510,
- 0x0512, 0x0512,
- 0x0514, 0x0514,
- 0x0516, 0x0516,
- 0x0518, 0x0518,
- 0x051a, 0x051a,
- 0x051c, 0x051c,
- 0x051e, 0x051e,
- 0x0520, 0x0520,
- 0x0522, 0x0522,
- 0x0524, 0x0524,
- 0x0526, 0x0526,
- 0x0531, 0x0556,
- 0x10a0, 0x10c5,
- 0x1e00, 0x1e00,
- 0x1e02, 0x1e02,
- 0x1e04, 0x1e04,
- 0x1e06, 0x1e06,
- 0x1e08, 0x1e08,
- 0x1e0a, 0x1e0a,
- 0x1e0c, 0x1e0c,
- 0x1e0e, 0x1e0e,
- 0x1e10, 0x1e10,
- 0x1e12, 0x1e12,
- 0x1e14, 0x1e14,
- 0x1e16, 0x1e16,
- 0x1e18, 0x1e18,
- 0x1e1a, 0x1e1a,
- 0x1e1c, 0x1e1c,
- 0x1e1e, 0x1e1e,
- 0x1e20, 0x1e20,
- 0x1e22, 0x1e22,
- 0x1e24, 0x1e24,
- 0x1e26, 0x1e26,
- 0x1e28, 0x1e28,
- 0x1e2a, 0x1e2a,
- 0x1e2c, 0x1e2c,
- 0x1e2e, 0x1e2e,
- 0x1e30, 0x1e30,
- 0x1e32, 0x1e32,
- 0x1e34, 0x1e34,
- 0x1e36, 0x1e36,
- 0x1e38, 0x1e38,
- 0x1e3a, 0x1e3a,
- 0x1e3c, 0x1e3c,
- 0x1e3e, 0x1e3e,
- 0x1e40, 0x1e40,
- 0x1e42, 0x1e42,
- 0x1e44, 0x1e44,
- 0x1e46, 0x1e46,
- 0x1e48, 0x1e48,
- 0x1e4a, 0x1e4a,
- 0x1e4c, 0x1e4c,
- 0x1e4e, 0x1e4e,
- 0x1e50, 0x1e50,
- 0x1e52, 0x1e52,
- 0x1e54, 0x1e54,
- 0x1e56, 0x1e56,
- 0x1e58, 0x1e58,
- 0x1e5a, 0x1e5a,
- 0x1e5c, 0x1e5c,
- 0x1e5e, 0x1e5e,
- 0x1e60, 0x1e60,
- 0x1e62, 0x1e62,
- 0x1e64, 0x1e64,
- 0x1e66, 0x1e66,
- 0x1e68, 0x1e68,
- 0x1e6a, 0x1e6a,
- 0x1e6c, 0x1e6c,
- 0x1e6e, 0x1e6e,
- 0x1e70, 0x1e70,
- 0x1e72, 0x1e72,
- 0x1e74, 0x1e74,
- 0x1e76, 0x1e76,
- 0x1e78, 0x1e78,
- 0x1e7a, 0x1e7a,
- 0x1e7c, 0x1e7c,
- 0x1e7e, 0x1e7e,
- 0x1e80, 0x1e80,
- 0x1e82, 0x1e82,
- 0x1e84, 0x1e84,
- 0x1e86, 0x1e86,
- 0x1e88, 0x1e88,
- 0x1e8a, 0x1e8a,
- 0x1e8c, 0x1e8c,
- 0x1e8e, 0x1e8e,
- 0x1e90, 0x1e90,
- 0x1e92, 0x1e92,
- 0x1e94, 0x1e94,
- 0x1e9e, 0x1e9e,
- 0x1ea0, 0x1ea0,
- 0x1ea2, 0x1ea2,
- 0x1ea4, 0x1ea4,
- 0x1ea6, 0x1ea6,
- 0x1ea8, 0x1ea8,
- 0x1eaa, 0x1eaa,
- 0x1eac, 0x1eac,
- 0x1eae, 0x1eae,
- 0x1eb0, 0x1eb0,
- 0x1eb2, 0x1eb2,
- 0x1eb4, 0x1eb4,
- 0x1eb6, 0x1eb6,
- 0x1eb8, 0x1eb8,
- 0x1eba, 0x1eba,
- 0x1ebc, 0x1ebc,
- 0x1ebe, 0x1ebe,
- 0x1ec0, 0x1ec0,
- 0x1ec2, 0x1ec2,
- 0x1ec4, 0x1ec4,
- 0x1ec6, 0x1ec6,
- 0x1ec8, 0x1ec8,
- 0x1eca, 0x1eca,
- 0x1ecc, 0x1ecc,
- 0x1ece, 0x1ece,
- 0x1ed0, 0x1ed0,
- 0x1ed2, 0x1ed2,
- 0x1ed4, 0x1ed4,
- 0x1ed6, 0x1ed6,
- 0x1ed8, 0x1ed8,
- 0x1eda, 0x1eda,
- 0x1edc, 0x1edc,
- 0x1ede, 0x1ede,
- 0x1ee0, 0x1ee0,
- 0x1ee2, 0x1ee2,
- 0x1ee4, 0x1ee4,
- 0x1ee6, 0x1ee6,
- 0x1ee8, 0x1ee8,
- 0x1eea, 0x1eea,
- 0x1eec, 0x1eec,
- 0x1eee, 0x1eee,
- 0x1ef0, 0x1ef0,
- 0x1ef2, 0x1ef2,
- 0x1ef4, 0x1ef4,
- 0x1ef6, 0x1ef6,
- 0x1ef8, 0x1ef8,
- 0x1efa, 0x1efa,
- 0x1efc, 0x1efc,
- 0x1efe, 0x1efe,
- 0x1f08, 0x1f0f,
- 0x1f18, 0x1f1d,
- 0x1f28, 0x1f2f,
- 0x1f38, 0x1f3f,
- 0x1f48, 0x1f4d,
- 0x1f59, 0x1f59,
- 0x1f5b, 0x1f5b,
- 0x1f5d, 0x1f5d,
- 0x1f5f, 0x1f5f,
- 0x1f68, 0x1f6f,
- 0x1fb8, 0x1fbb,
- 0x1fc8, 0x1fcb,
- 0x1fd8, 0x1fdb,
- 0x1fe8, 0x1fec,
- 0x1ff8, 0x1ffb,
- 0x2102, 0x2102,
- 0x2107, 0x2107,
- 0x210b, 0x210d,
- 0x2110, 0x2112,
- 0x2115, 0x2115,
- 0x2119, 0x211d,
- 0x2124, 0x2124,
- 0x2126, 0x2126,
- 0x2128, 0x2128,
- 0x212a, 0x212d,
- 0x2130, 0x2133,
- 0x213e, 0x213f,
- 0x2145, 0x2145,
- 0x2160, 0x216f,
- 0x2183, 0x2183,
- 0x24b6, 0x24cf,
- 0x2c00, 0x2c2e,
- 0x2c60, 0x2c60,
- 0x2c62, 0x2c64,
- 0x2c67, 0x2c67,
- 0x2c69, 0x2c69,
- 0x2c6b, 0x2c6b,
- 0x2c6d, 0x2c70,
- 0x2c72, 0x2c72,
- 0x2c75, 0x2c75,
- 0x2c7e, 0x2c80,
- 0x2c82, 0x2c82,
- 0x2c84, 0x2c84,
- 0x2c86, 0x2c86,
- 0x2c88, 0x2c88,
- 0x2c8a, 0x2c8a,
- 0x2c8c, 0x2c8c,
- 0x2c8e, 0x2c8e,
- 0x2c90, 0x2c90,
- 0x2c92, 0x2c92,
- 0x2c94, 0x2c94,
- 0x2c96, 0x2c96,
- 0x2c98, 0x2c98,
- 0x2c9a, 0x2c9a,
- 0x2c9c, 0x2c9c,
- 0x2c9e, 0x2c9e,
- 0x2ca0, 0x2ca0,
- 0x2ca2, 0x2ca2,
- 0x2ca4, 0x2ca4,
- 0x2ca6, 0x2ca6,
- 0x2ca8, 0x2ca8,
- 0x2caa, 0x2caa,
- 0x2cac, 0x2cac,
- 0x2cae, 0x2cae,
- 0x2cb0, 0x2cb0,
- 0x2cb2, 0x2cb2,
- 0x2cb4, 0x2cb4,
- 0x2cb6, 0x2cb6,
- 0x2cb8, 0x2cb8,
- 0x2cba, 0x2cba,
- 0x2cbc, 0x2cbc,
- 0x2cbe, 0x2cbe,
- 0x2cc0, 0x2cc0,
- 0x2cc2, 0x2cc2,
- 0x2cc4, 0x2cc4,
- 0x2cc6, 0x2cc6,
- 0x2cc8, 0x2cc8,
- 0x2cca, 0x2cca,
- 0x2ccc, 0x2ccc,
- 0x2cce, 0x2cce,
- 0x2cd0, 0x2cd0,
- 0x2cd2, 0x2cd2,
- 0x2cd4, 0x2cd4,
- 0x2cd6, 0x2cd6,
- 0x2cd8, 0x2cd8,
- 0x2cda, 0x2cda,
- 0x2cdc, 0x2cdc,
- 0x2cde, 0x2cde,
- 0x2ce0, 0x2ce0,
- 0x2ce2, 0x2ce2,
- 0x2ceb, 0x2ceb,
- 0x2ced, 0x2ced,
- 0xa640, 0xa640,
- 0xa642, 0xa642,
- 0xa644, 0xa644,
- 0xa646, 0xa646,
- 0xa648, 0xa648,
- 0xa64a, 0xa64a,
- 0xa64c, 0xa64c,
- 0xa64e, 0xa64e,
- 0xa650, 0xa650,
- 0xa652, 0xa652,
- 0xa654, 0xa654,
- 0xa656, 0xa656,
- 0xa658, 0xa658,
- 0xa65a, 0xa65a,
- 0xa65c, 0xa65c,
- 0xa65e, 0xa65e,
- 0xa660, 0xa660,
- 0xa662, 0xa662,
- 0xa664, 0xa664,
- 0xa666, 0xa666,
- 0xa668, 0xa668,
- 0xa66a, 0xa66a,
- 0xa66c, 0xa66c,
- 0xa680, 0xa680,
- 0xa682, 0xa682,
- 0xa684, 0xa684,
- 0xa686, 0xa686,
- 0xa688, 0xa688,
- 0xa68a, 0xa68a,
- 0xa68c, 0xa68c,
- 0xa68e, 0xa68e,
- 0xa690, 0xa690,
- 0xa692, 0xa692,
- 0xa694, 0xa694,
- 0xa696, 0xa696,
- 0xa722, 0xa722,
- 0xa724, 0xa724,
- 0xa726, 0xa726,
- 0xa728, 0xa728,
- 0xa72a, 0xa72a,
- 0xa72c, 0xa72c,
- 0xa72e, 0xa72e,
- 0xa732, 0xa732,
- 0xa734, 0xa734,
- 0xa736, 0xa736,
- 0xa738, 0xa738,
- 0xa73a, 0xa73a,
- 0xa73c, 0xa73c,
- 0xa73e, 0xa73e,
- 0xa740, 0xa740,
- 0xa742, 0xa742,
- 0xa744, 0xa744,
- 0xa746, 0xa746,
- 0xa748, 0xa748,
- 0xa74a, 0xa74a,
- 0xa74c, 0xa74c,
- 0xa74e, 0xa74e,
- 0xa750, 0xa750,
- 0xa752, 0xa752,
- 0xa754, 0xa754,
- 0xa756, 0xa756,
- 0xa758, 0xa758,
- 0xa75a, 0xa75a,
- 0xa75c, 0xa75c,
- 0xa75e, 0xa75e,
- 0xa760, 0xa760,
- 0xa762, 0xa762,
- 0xa764, 0xa764,
- 0xa766, 0xa766,
- 0xa768, 0xa768,
- 0xa76a, 0xa76a,
- 0xa76c, 0xa76c,
- 0xa76e, 0xa76e,
- 0xa779, 0xa779,
- 0xa77b, 0xa77b,
- 0xa77d, 0xa77e,
- 0xa780, 0xa780,
- 0xa782, 0xa782,
- 0xa784, 0xa784,
- 0xa786, 0xa786,
- 0xa78b, 0xa78b,
- 0xa78d, 0xa78d,
- 0xa790, 0xa790,
- 0xa7a0, 0xa7a0,
- 0xa7a2, 0xa7a2,
- 0xa7a4, 0xa7a4,
- 0xa7a6, 0xa7a6,
- 0xa7a8, 0xa7a8,
- 0xff21, 0xff3a,
- 0x10400, 0x10427,
- 0x1d400, 0x1d419,
- 0x1d434, 0x1d44d,
- 0x1d468, 0x1d481,
- 0x1d49c, 0x1d49c,
- 0x1d49e, 0x1d49f,
- 0x1d4a2, 0x1d4a2,
- 0x1d4a5, 0x1d4a6,
- 0x1d4a9, 0x1d4ac,
- 0x1d4ae, 0x1d4b5,
- 0x1d4d0, 0x1d4e9,
- 0x1d504, 0x1d505,
- 0x1d507, 0x1d50a,
- 0x1d50d, 0x1d514,
- 0x1d516, 0x1d51c,
- 0x1d538, 0x1d539,
- 0x1d53b, 0x1d53e,
- 0x1d540, 0x1d544,
- 0x1d546, 0x1d546,
- 0x1d54a, 0x1d550,
- 0x1d56c, 0x1d585,
- 0x1d5a0, 0x1d5b9,
- 0x1d5d4, 0x1d5ed,
- 0x1d608, 0x1d621,
- 0x1d63c, 0x1d655,
- 0x1d670, 0x1d689,
- 0x1d6a8, 0x1d6c0,
- 0x1d6e2, 0x1d6fa,
- 0x1d71c, 0x1d734,
- 0x1d756, 0x1d76e,
- 0x1d790, 0x1d7a8,
- 0x1d7ca, 0x1d7ca,
-}; /* CR_Uppercase */
+#define CR_Uppercase CR_Upper
/* 'Cased': Derived Property */
static const OnigCodePoint CR_Cased[] = {
- 112,
+ 119,
0x0041, 0x005a,
0x0061, 0x007a,
0x00aa, 0x00aa,
@@ -6761,6 +10029,8 @@ static const OnigCodePoint CR_Cased[] = {
0x0531, 0x0556,
0x0561, 0x0587,
0x10a0, 0x10c5,
+ 0x10c7, 0x10c7,
+ 0x10cd, 0x10cd,
0x1d00, 0x1dbf,
0x1e00, 0x1f15,
0x1f18, 0x1f1d,
@@ -6781,7 +10051,9 @@ static const OnigCodePoint CR_Cased[] = {
0x1fe0, 0x1fec,
0x1ff2, 0x1ff4,
0x1ff6, 0x1ffc,
- 0x2090, 0x2094,
+ 0x2071, 0x2071,
+ 0x207f, 0x207f,
+ 0x2090, 0x209c,
0x2102, 0x2102,
0x2107, 0x2107,
0x210a, 0x2113,
@@ -6803,14 +10075,17 @@ static const OnigCodePoint CR_Cased[] = {
0x2c30, 0x2c5e,
0x2c60, 0x2ce4,
0x2ceb, 0x2cee,
+ 0x2cf2, 0x2cf3,
0x2d00, 0x2d25,
+ 0x2d27, 0x2d27,
+ 0x2d2d, 0x2d2d,
0xa640, 0xa66d,
0xa680, 0xa697,
0xa722, 0xa787,
0xa78b, 0xa78e,
- 0xa790, 0xa791,
- 0xa7a0, 0xa7a9,
- 0xa7fa, 0xa7fa,
+ 0xa790, 0xa793,
+ 0xa7a0, 0xa7aa,
+ 0xa7f8, 0xa7fa,
0xfb00, 0xfb06,
0xfb13, 0xfb17,
0xff21, 0xff3a,
@@ -6850,7 +10125,7 @@ static const OnigCodePoint CR_Cased[] = {
/* 'Case_Ignorable': Derived Property */
static const OnigCodePoint CR_Case_Ignorable[] = {
- 277,
+ 295,
0x0027, 0x0027,
0x002e, 0x002e,
0x003a, 0x003a,
@@ -6874,7 +10149,7 @@ static const OnigCodePoint CR_Case_Ignorable[] = {
0x05c4, 0x05c5,
0x05c7, 0x05c7,
0x05f4, 0x05f4,
- 0x0600, 0x0603,
+ 0x0600, 0x0604,
0x0610, 0x061a,
0x0640, 0x0640,
0x064b, 0x065f,
@@ -6890,6 +10165,7 @@ static const OnigCodePoint CR_Case_Ignorable[] = {
0x07fa, 0x07fa,
0x0816, 0x082d,
0x0859, 0x085b,
+ 0x08e4, 0x08fe,
0x0900, 0x0902,
0x093a, 0x093a,
0x093c, 0x093c,
@@ -7009,6 +10285,7 @@ static const OnigCodePoint CR_Case_Ignorable[] = {
0x1b80, 0x1b81,
0x1ba2, 0x1ba5,
0x1ba8, 0x1ba9,
+ 0x1bab, 0x1bab,
0x1be6, 0x1be6,
0x1be8, 0x1be9,
0x1bed, 0x1bed,
@@ -7020,7 +10297,8 @@ static const OnigCodePoint CR_Case_Ignorable[] = {
0x1cd4, 0x1ce0,
0x1ce2, 0x1ce8,
0x1ced, 0x1ced,
- 0x1d2c, 0x1d61,
+ 0x1cf4, 0x1cf4,
+ 0x1d2c, 0x1d6a,
0x1d78, 0x1d78,
0x1d9b, 0x1de6,
0x1dfc, 0x1dff,
@@ -7041,14 +10319,14 @@ static const OnigCodePoint CR_Case_Ignorable[] = {
0x207f, 0x207f,
0x2090, 0x209c,
0x20d0, 0x20f0,
- 0x2c7d, 0x2c7d,
+ 0x2c7c, 0x2c7d,
0x2cef, 0x2cf1,
0x2d6f, 0x2d6f,
0x2d7f, 0x2d7f,
0x2de0, 0x2dff,
0x2e2f, 0x2e2f,
0x3005, 0x3005,
- 0x302a, 0x302f,
+ 0x302a, 0x302d,
0x3031, 0x3035,
0x303b, 0x303b,
0x3099, 0x309e,
@@ -7057,12 +10335,14 @@ static const OnigCodePoint CR_Case_Ignorable[] = {
0xa4f8, 0xa4fd,
0xa60c, 0xa60c,
0xa66f, 0xa672,
- 0xa67c, 0xa67d,
+ 0xa674, 0xa67d,
0xa67f, 0xa67f,
+ 0xa69f, 0xa69f,
0xa6f0, 0xa6f1,
0xa700, 0xa721,
0xa770, 0xa770,
0xa788, 0xa78a,
+ 0xa7f8, 0xa7f9,
0xa802, 0xa802,
0xa806, 0xa806,
0xa80b, 0xa80b,
@@ -7088,6 +10368,9 @@ static const OnigCodePoint CR_Case_Ignorable[] = {
0xaabe, 0xaabf,
0xaac1, 0xaac1,
0xaadd, 0xaadd,
+ 0xaaec, 0xaaed,
+ 0xaaf3, 0xaaf4,
+ 0xaaf6, 0xaaf6,
0xabe5, 0xabe5,
0xabe8, 0xabe8,
0xabed, 0xabed,
@@ -7120,6 +10403,16 @@ static const OnigCodePoint CR_Case_Ignorable[] = {
0x110b3, 0x110b6,
0x110b9, 0x110ba,
0x110bd, 0x110bd,
+ 0x11100, 0x11102,
+ 0x11127, 0x1112b,
+ 0x1112d, 0x11134,
+ 0x11180, 0x11181,
+ 0x111b6, 0x111be,
+ 0x116ab, 0x116ab,
+ 0x116ad, 0x116ad,
+ 0x116b0, 0x116b5,
+ 0x116b7, 0x116b7,
+ 0x16f8f, 0x16f9f,
0x1d167, 0x1d169,
0x1d173, 0x1d182,
0x1d185, 0x1d18b,
@@ -7132,7 +10425,7 @@ static const OnigCodePoint CR_Case_Ignorable[] = {
/* 'Changes_When_Lowercased': Derived Property */
static const OnigCodePoint CR_Changes_When_Lowercased[] = {
- 566,
+ 571,
0x0041, 0x005a,
0x00c0, 0x00d6,
0x00d8, 0x00de,
@@ -7400,6 +10693,8 @@ static const OnigCodePoint CR_Changes_When_Lowercased[] = {
0x0526, 0x0526,
0x0531, 0x0556,
0x10a0, 0x10c5,
+ 0x10c7, 0x10c7,
+ 0x10cd, 0x10cd,
0x1e00, 0x1e00,
0x1e02, 0x1e02,
0x1e04, 0x1e04,
@@ -7609,6 +10904,7 @@ static const OnigCodePoint CR_Changes_When_Lowercased[] = {
0x2ce2, 0x2ce2,
0x2ceb, 0x2ceb,
0x2ced, 0x2ced,
+ 0x2cf2, 0x2cf2,
0xa640, 0xa640,
0xa642, 0xa642,
0xa644, 0xa644,
@@ -7692,18 +10988,20 @@ static const OnigCodePoint CR_Changes_When_Lowercased[] = {
0xa78b, 0xa78b,
0xa78d, 0xa78d,
0xa790, 0xa790,
+ 0xa792, 0xa792,
0xa7a0, 0xa7a0,
0xa7a2, 0xa7a2,
0xa7a4, 0xa7a4,
0xa7a6, 0xa7a6,
0xa7a8, 0xa7a8,
+ 0xa7aa, 0xa7aa,
0xff21, 0xff3a,
0x10400, 0x10427,
}; /* CR_Changes_When_Lowercased */
/* 'Changes_When_Uppercased': Derived Property */
static const OnigCodePoint CR_Changes_When_Uppercased[] = {
- 582,
+ 586,
0x0061, 0x007a,
0x00b5, 0x00b5,
0x00df, 0x00f6,
@@ -7853,7 +11151,7 @@ static const OnigCodePoint CR_Changes_When_Uppercased[] = {
0x025b, 0x025b,
0x0260, 0x0260,
0x0263, 0x0263,
- 0x0265, 0x0265,
+ 0x0265, 0x0266,
0x0268, 0x0269,
0x026b, 0x026b,
0x026f, 0x026f,
@@ -8194,7 +11492,10 @@ static const OnigCodePoint CR_Changes_When_Uppercased[] = {
0x2ce3, 0x2ce3,
0x2cec, 0x2cec,
0x2cee, 0x2cee,
+ 0x2cf3, 0x2cf3,
0x2d00, 0x2d25,
+ 0x2d27, 0x2d27,
+ 0x2d2d, 0x2d2d,
0xa641, 0xa641,
0xa643, 0xa643,
0xa645, 0xa645,
@@ -8277,6 +11578,7 @@ static const OnigCodePoint CR_Changes_When_Uppercased[] = {
0xa787, 0xa787,
0xa78c, 0xa78c,
0xa791, 0xa791,
+ 0xa793, 0xa793,
0xa7a1, 0xa7a1,
0xa7a3, 0xa7a3,
0xa7a5, 0xa7a5,
@@ -8290,7 +11592,7 @@ static const OnigCodePoint CR_Changes_When_Uppercased[] = {
/* 'Changes_When_Titlecased': Derived Property */
static const OnigCodePoint CR_Changes_When_Titlecased[] = {
- 583,
+ 587,
0x0061, 0x007a,
0x00b5, 0x00b5,
0x00df, 0x00f6,
@@ -8441,7 +11743,7 @@ static const OnigCodePoint CR_Changes_When_Titlecased[] = {
0x025b, 0x025b,
0x0260, 0x0260,
0x0263, 0x0263,
- 0x0265, 0x0265,
+ 0x0265, 0x0266,
0x0268, 0x0269,
0x026b, 0x026b,
0x026f, 0x026f,
@@ -8782,7 +12084,10 @@ static const OnigCodePoint CR_Changes_When_Titlecased[] = {
0x2ce3, 0x2ce3,
0x2cec, 0x2cec,
0x2cee, 0x2cee,
+ 0x2cf3, 0x2cf3,
0x2d00, 0x2d25,
+ 0x2d27, 0x2d27,
+ 0x2d2d, 0x2d2d,
0xa641, 0xa641,
0xa643, 0xa643,
0xa645, 0xa645,
@@ -8865,6 +12170,7 @@ static const OnigCodePoint CR_Changes_When_Titlecased[] = {
0xa787, 0xa787,
0xa78c, 0xa78c,
0xa791, 0xa791,
+ 0xa793, 0xa793,
0xa7a1, 0xa7a1,
0xa7a3, 0xa7a3,
0xa7a5, 0xa7a5,
@@ -8878,7 +12184,7 @@ static const OnigCodePoint CR_Changes_When_Titlecased[] = {
/* 'Changes_When_Casefolded': Derived Property */
static const OnigCodePoint CR_Changes_When_Casefolded[] = {
- 577,
+ 582,
0x0041, 0x005a,
0x00b5, 0x00b5,
0x00c0, 0x00d6,
@@ -9153,6 +12459,8 @@ static const OnigCodePoint CR_Changes_When_Casefolded[] = {
0x0531, 0x0556,
0x0587, 0x0587,
0x10a0, 0x10c5,
+ 0x10c7, 0x10c7,
+ 0x10cd, 0x10cd,
0x1e00, 0x1e00,
0x1e02, 0x1e02,
0x1e04, 0x1e04,
@@ -9364,6 +12672,7 @@ static const OnigCodePoint CR_Changes_When_Casefolded[] = {
0x2ce2, 0x2ce2,
0x2ceb, 0x2ceb,
0x2ced, 0x2ced,
+ 0x2cf2, 0x2cf2,
0xa640, 0xa640,
0xa642, 0xa642,
0xa644, 0xa644,
@@ -9447,11 +12756,13 @@ static const OnigCodePoint CR_Changes_When_Casefolded[] = {
0xa78b, 0xa78b,
0xa78d, 0xa78d,
0xa790, 0xa790,
+ 0xa792, 0xa792,
0xa7a0, 0xa7a0,
0xa7a2, 0xa7a2,
0xa7a4, 0xa7a4,
0xa7a6, 0xa7a6,
0xa7a8, 0xa7a8,
+ 0xa7aa, 0xa7aa,
0xfb00, 0xfb06,
0xfb13, 0xfb17,
0xff21, 0xff3a,
@@ -9460,7 +12771,7 @@ static const OnigCodePoint CR_Changes_When_Casefolded[] = {
/* 'Changes_When_Casemapped': Derived Property */
static const OnigCodePoint CR_Changes_When_Casemapped[] = {
- 99,
+ 104,
0x0041, 0x005a,
0x0061, 0x007a,
0x00b5, 0x00b5,
@@ -9481,7 +12792,7 @@ static const OnigCodePoint CR_Changes_When_Casemapped[] = {
0x025b, 0x025b,
0x0260, 0x0260,
0x0263, 0x0263,
- 0x0265, 0x0265,
+ 0x0265, 0x0266,
0x0268, 0x0269,
0x026b, 0x026b,
0x026f, 0x026f,
@@ -9509,6 +12820,8 @@ static const OnigCodePoint CR_Changes_When_Casemapped[] = {
0x0531, 0x0556,
0x0561, 0x0587,
0x10a0, 0x10c5,
+ 0x10c7, 0x10c7,
+ 0x10cd, 0x10cd,
0x1d79, 0x1d79,
0x1d7d, 0x1d7d,
0x1e00, 0x1e9b,
@@ -9546,15 +12859,18 @@ static const OnigCodePoint CR_Changes_When_Casemapped[] = {
0x2c75, 0x2c76,
0x2c7e, 0x2ce3,
0x2ceb, 0x2cee,
+ 0x2cf2, 0x2cf3,
0x2d00, 0x2d25,
+ 0x2d27, 0x2d27,
+ 0x2d2d, 0x2d2d,
0xa640, 0xa66d,
0xa680, 0xa697,
0xa722, 0xa72f,
0xa732, 0xa76f,
0xa779, 0xa787,
0xa78b, 0xa78d,
- 0xa790, 0xa791,
- 0xa7a0, 0xa7a9,
+ 0xa790, 0xa793,
+ 0xa7a0, 0xa7aa,
0xfb00, 0xfb06,
0xfb13, 0xfb17,
0xff21, 0xff3a,
@@ -9564,7 +12880,7 @@ static const OnigCodePoint CR_Changes_When_Casemapped[] = {
/* 'ID_Start': Derived Property */
static const OnigCodePoint CR_ID_Start[] = {
- 437,
+ 488,
0x0041, 0x005a,
0x0061, 0x007a,
0x00aa, 0x00aa,
@@ -9612,6 +12928,8 @@ static const OnigCodePoint CR_ID_Start[] = {
0x0824, 0x0824,
0x0828, 0x0828,
0x0840, 0x0858,
+ 0x08a0, 0x08a0,
+ 0x08a2, 0x08ac,
0x0904, 0x0939,
0x093d, 0x093d,
0x0950, 0x0950,
@@ -9717,7 +13035,7 @@ static const OnigCodePoint CR_ID_Start[] = {
0x0ebd, 0x0ebd,
0x0ec0, 0x0ec4,
0x0ec6, 0x0ec6,
- 0x0edc, 0x0edd,
+ 0x0edc, 0x0edf,
0x0f00, 0x0f00,
0x0f40, 0x0f47,
0x0f49, 0x0f6c,
@@ -9732,9 +13050,10 @@ static const OnigCodePoint CR_ID_Start[] = {
0x1075, 0x1081,
0x108e, 0x108e,
0x10a0, 0x10c5,
+ 0x10c7, 0x10c7,
+ 0x10cd, 0x10cd,
0x10d0, 0x10fa,
- 0x10fc, 0x10fc,
- 0x1100, 0x1248,
+ 0x10fc, 0x1248,
0x124a, 0x124d,
0x1250, 0x1256,
0x1258, 0x1258,
@@ -9782,12 +13101,13 @@ static const OnigCodePoint CR_ID_Start[] = {
0x1b45, 0x1b4b,
0x1b83, 0x1ba0,
0x1bae, 0x1baf,
- 0x1bc0, 0x1be5,
+ 0x1bba, 0x1be5,
0x1c00, 0x1c23,
0x1c4d, 0x1c4f,
0x1c5a, 0x1c7d,
0x1ce9, 0x1cec,
0x1cee, 0x1cf1,
+ 0x1cf5, 0x1cf6,
0x1d00, 0x1dbf,
0x1e00, 0x1f15,
0x1f18, 0x1f1d,
@@ -9828,8 +13148,11 @@ static const OnigCodePoint CR_ID_Start[] = {
0x2c30, 0x2c5e,
0x2c60, 0x2ce4,
0x2ceb, 0x2cee,
+ 0x2cf2, 0x2cf3,
0x2d00, 0x2d25,
- 0x2d30, 0x2d65,
+ 0x2d27, 0x2d27,
+ 0x2d2d, 0x2d2d,
+ 0x2d30, 0x2d67,
0x2d6f, 0x2d6f,
0x2d80, 0x2d96,
0x2da0, 0x2da6,
@@ -9853,7 +13176,7 @@ static const OnigCodePoint CR_ID_Start[] = {
0x31a0, 0x31ba,
0x31f0, 0x31ff,
0x3400, 0x4db5,
- 0x4e00, 0x9fcb,
+ 0x4e00, 0x9fcc,
0xa000, 0xa48c,
0xa4d0, 0xa4fd,
0xa500, 0xa60c,
@@ -9865,9 +13188,9 @@ static const OnigCodePoint CR_ID_Start[] = {
0xa717, 0xa71f,
0xa722, 0xa788,
0xa78b, 0xa78e,
- 0xa790, 0xa791,
- 0xa7a0, 0xa7a9,
- 0xa7fa, 0xa801,
+ 0xa790, 0xa793,
+ 0xa7a0, 0xa7aa,
+ 0xa7f8, 0xa801,
0xa803, 0xa805,
0xa807, 0xa80a,
0xa80c, 0xa822,
@@ -9892,6 +13215,8 @@ static const OnigCodePoint CR_ID_Start[] = {
0xaac0, 0xaac0,
0xaac2, 0xaac2,
0xaadb, 0xaadd,
+ 0xaae0, 0xaaea,
+ 0xaaf2, 0xaaf4,
0xab01, 0xab06,
0xab09, 0xab0e,
0xab11, 0xab16,
@@ -9901,8 +13226,7 @@ static const OnigCodePoint CR_ID_Start[] = {
0xac00, 0xd7a3,
0xd7b0, 0xd7c6,
0xd7cb, 0xd7fb,
- 0xf900, 0xfa2d,
- 0xfa30, 0xfa6d,
+ 0xf900, 0xfa6d,
0xfa70, 0xfad9,
0xfb00, 0xfb06,
0xfb13, 0xfb17,
@@ -9952,6 +13276,8 @@ static const OnigCodePoint CR_ID_Start[] = {
0x1083f, 0x10855,
0x10900, 0x10915,
0x10920, 0x10939,
+ 0x10980, 0x109b7,
+ 0x109be, 0x109bf,
0x10a00, 0x10a00,
0x10a10, 0x10a13,
0x10a15, 0x10a17,
@@ -9963,10 +13289,18 @@ static const OnigCodePoint CR_ID_Start[] = {
0x10c00, 0x10c48,
0x11003, 0x11037,
0x11083, 0x110af,
+ 0x110d0, 0x110e8,
+ 0x11103, 0x11126,
+ 0x11183, 0x111b2,
+ 0x111c1, 0x111c4,
+ 0x11680, 0x116aa,
0x12000, 0x1236e,
0x12400, 0x12462,
0x13000, 0x1342e,
0x16800, 0x16a38,
+ 0x16f00, 0x16f44,
+ 0x16f50, 0x16f50,
+ 0x16f93, 0x16f9f,
0x1b000, 0x1b001,
0x1d400, 0x1d454,
0x1d456, 0x1d49c,
@@ -9998,6 +13332,39 @@ static const OnigCodePoint CR_ID_Start[] = {
0x1d78a, 0x1d7a8,
0x1d7aa, 0x1d7c2,
0x1d7c4, 0x1d7cb,
+ 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,
0x20000, 0x2a6d6,
0x2a700, 0x2b734,
0x2b740, 0x2b81d,
@@ -10006,7 +13373,7 @@ static const OnigCodePoint CR_ID_Start[] = {
/* 'ID_Continue': Derived Property */
static const OnigCodePoint CR_ID_Continue[] = {
- 514,
+ 564,
0x0030, 0x0039,
0x0041, 0x005a,
0x005f, 0x005f,
@@ -10055,6 +13422,9 @@ static const OnigCodePoint CR_ID_Continue[] = {
0x07fa, 0x07fa,
0x0800, 0x082d,
0x0840, 0x085b,
+ 0x08a0, 0x08a0,
+ 0x08a2, 0x08ac,
+ 0x08e4, 0x08fe,
0x0900, 0x0963,
0x0966, 0x096f,
0x0971, 0x0977,
@@ -10202,7 +13572,7 @@ static const OnigCodePoint CR_ID_Continue[] = {
0x0ec6, 0x0ec6,
0x0ec8, 0x0ecd,
0x0ed0, 0x0ed9,
- 0x0edc, 0x0edd,
+ 0x0edc, 0x0edf,
0x0f00, 0x0f00,
0x0f18, 0x0f19,
0x0f20, 0x0f29,
@@ -10218,9 +13588,10 @@ static const OnigCodePoint CR_ID_Continue[] = {
0x1000, 0x1049,
0x1050, 0x109d,
0x10a0, 0x10c5,
+ 0x10c7, 0x10c7,
+ 0x10cd, 0x10cd,
0x10d0, 0x10fa,
- 0x10fc, 0x10fc,
- 0x1100, 0x1248,
+ 0x10fc, 0x1248,
0x124a, 0x124d,
0x1250, 0x1256,
0x1258, 0x1258,
@@ -10252,8 +13623,7 @@ static const OnigCodePoint CR_ID_Continue[] = {
0x1760, 0x176c,
0x176e, 0x1770,
0x1772, 0x1773,
- 0x1780, 0x17b3,
- 0x17b6, 0x17d3,
+ 0x1780, 0x17d3,
0x17d7, 0x17d7,
0x17dc, 0x17dd,
0x17e0, 0x17e9,
@@ -10279,14 +13649,12 @@ static const OnigCodePoint CR_ID_Continue[] = {
0x1b00, 0x1b4b,
0x1b50, 0x1b59,
0x1b6b, 0x1b73,
- 0x1b80, 0x1baa,
- 0x1bae, 0x1bb9,
- 0x1bc0, 0x1bf3,
+ 0x1b80, 0x1bf3,
0x1c00, 0x1c37,
0x1c40, 0x1c49,
0x1c4d, 0x1c7d,
0x1cd0, 0x1cd2,
- 0x1cd4, 0x1cf2,
+ 0x1cd4, 0x1cf6,
0x1d00, 0x1de6,
0x1dfc, 0x1f15,
0x1f18, 0x1f1d,
@@ -10331,9 +13699,11 @@ static const OnigCodePoint CR_ID_Continue[] = {
0x2c00, 0x2c2e,
0x2c30, 0x2c5e,
0x2c60, 0x2ce4,
- 0x2ceb, 0x2cf1,
+ 0x2ceb, 0x2cf3,
0x2d00, 0x2d25,
- 0x2d30, 0x2d65,
+ 0x2d27, 0x2d27,
+ 0x2d2d, 0x2d2d,
+ 0x2d30, 0x2d67,
0x2d6f, 0x2d6f,
0x2d7f, 0x2d96,
0x2da0, 0x2da6,
@@ -10358,21 +13728,21 @@ static const OnigCodePoint CR_ID_Continue[] = {
0x31a0, 0x31ba,
0x31f0, 0x31ff,
0x3400, 0x4db5,
- 0x4e00, 0x9fcb,
+ 0x4e00, 0x9fcc,
0xa000, 0xa48c,
0xa4d0, 0xa4fd,
0xa500, 0xa60c,
0xa610, 0xa62b,
0xa640, 0xa66f,
- 0xa67c, 0xa67d,
+ 0xa674, 0xa67d,
0xa67f, 0xa697,
- 0xa6a0, 0xa6f1,
+ 0xa69f, 0xa6f1,
0xa717, 0xa71f,
0xa722, 0xa788,
0xa78b, 0xa78e,
- 0xa790, 0xa791,
- 0xa7a0, 0xa7a9,
- 0xa7fa, 0xa827,
+ 0xa790, 0xa793,
+ 0xa7a0, 0xa7aa,
+ 0xa7f8, 0xa827,
0xa840, 0xa873,
0xa880, 0xa8c4,
0xa8d0, 0xa8d9,
@@ -10390,6 +13760,8 @@ static const OnigCodePoint CR_ID_Continue[] = {
0xaa7a, 0xaa7b,
0xaa80, 0xaac2,
0xaadb, 0xaadd,
+ 0xaae0, 0xaaef,
+ 0xaaf2, 0xaaf6,
0xab01, 0xab06,
0xab09, 0xab0e,
0xab11, 0xab16,
@@ -10401,8 +13773,7 @@ static const OnigCodePoint CR_ID_Continue[] = {
0xac00, 0xd7a3,
0xd7b0, 0xd7c6,
0xd7cb, 0xd7fb,
- 0xf900, 0xfa2d,
- 0xfa30, 0xfa6d,
+ 0xf900, 0xfa6d,
0xfa70, 0xfad9,
0xfb00, 0xfb06,
0xfb13, 0xfb17,
@@ -10459,6 +13830,8 @@ static const OnigCodePoint CR_ID_Continue[] = {
0x1083f, 0x10855,
0x10900, 0x10915,
0x10920, 0x10939,
+ 0x10980, 0x109b7,
+ 0x109be, 0x109bf,
0x10a00, 0x10a03,
0x10a05, 0x10a06,
0x10a0c, 0x10a13,
@@ -10474,10 +13847,21 @@ static const OnigCodePoint CR_ID_Continue[] = {
0x11000, 0x11046,
0x11066, 0x1106f,
0x11080, 0x110ba,
+ 0x110d0, 0x110e8,
+ 0x110f0, 0x110f9,
+ 0x11100, 0x11134,
+ 0x11136, 0x1113f,
+ 0x11180, 0x111c4,
+ 0x111d0, 0x111d9,
+ 0x11680, 0x116b7,
+ 0x116c0, 0x116c9,
0x12000, 0x1236e,
0x12400, 0x12462,
0x13000, 0x1342e,
0x16800, 0x16a38,
+ 0x16f00, 0x16f44,
+ 0x16f50, 0x16f7e,
+ 0x16f8f, 0x16f9f,
0x1b000, 0x1b001,
0x1d165, 0x1d169,
0x1d16d, 0x1d172,
@@ -10516,6 +13900,39 @@ static const OnigCodePoint CR_ID_Continue[] = {
0x1d7aa, 0x1d7c2,
0x1d7c4, 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,
0x20000, 0x2a6d6,
0x2a700, 0x2b734,
0x2b740, 0x2b81d,
@@ -10525,7 +13942,7 @@ static const OnigCodePoint CR_ID_Continue[] = {
/* 'XID_Start': Derived Property */
static const OnigCodePoint CR_XID_Start[] = {
- 444,
+ 495,
0x0041, 0x005a,
0x0061, 0x007a,
0x00aa, 0x00aa,
@@ -10573,6 +13990,8 @@ static const OnigCodePoint CR_XID_Start[] = {
0x0824, 0x0824,
0x0828, 0x0828,
0x0840, 0x0858,
+ 0x08a0, 0x08a0,
+ 0x08a2, 0x08ac,
0x0904, 0x0939,
0x093d, 0x093d,
0x0950, 0x0950,
@@ -10678,7 +14097,7 @@ static const OnigCodePoint CR_XID_Start[] = {
0x0ebd, 0x0ebd,
0x0ec0, 0x0ec4,
0x0ec6, 0x0ec6,
- 0x0edc, 0x0edd,
+ 0x0edc, 0x0edf,
0x0f00, 0x0f00,
0x0f40, 0x0f47,
0x0f49, 0x0f6c,
@@ -10693,9 +14112,10 @@ static const OnigCodePoint CR_XID_Start[] = {
0x1075, 0x1081,
0x108e, 0x108e,
0x10a0, 0x10c5,
+ 0x10c7, 0x10c7,
+ 0x10cd, 0x10cd,
0x10d0, 0x10fa,
- 0x10fc, 0x10fc,
- 0x1100, 0x1248,
+ 0x10fc, 0x1248,
0x124a, 0x124d,
0x1250, 0x1256,
0x1258, 0x1258,
@@ -10743,12 +14163,13 @@ static const OnigCodePoint CR_XID_Start[] = {
0x1b45, 0x1b4b,
0x1b83, 0x1ba0,
0x1bae, 0x1baf,
- 0x1bc0, 0x1be5,
+ 0x1bba, 0x1be5,
0x1c00, 0x1c23,
0x1c4d, 0x1c4f,
0x1c5a, 0x1c7d,
0x1ce9, 0x1cec,
0x1cee, 0x1cf1,
+ 0x1cf5, 0x1cf6,
0x1d00, 0x1dbf,
0x1e00, 0x1f15,
0x1f18, 0x1f1d,
@@ -10789,8 +14210,11 @@ static const OnigCodePoint CR_XID_Start[] = {
0x2c30, 0x2c5e,
0x2c60, 0x2ce4,
0x2ceb, 0x2cee,
+ 0x2cf2, 0x2cf3,
0x2d00, 0x2d25,
- 0x2d30, 0x2d65,
+ 0x2d27, 0x2d27,
+ 0x2d2d, 0x2d2d,
+ 0x2d30, 0x2d67,
0x2d6f, 0x2d6f,
0x2d80, 0x2d96,
0x2da0, 0x2da6,
@@ -10814,7 +14238,7 @@ static const OnigCodePoint CR_XID_Start[] = {
0x31a0, 0x31ba,
0x31f0, 0x31ff,
0x3400, 0x4db5,
- 0x4e00, 0x9fcb,
+ 0x4e00, 0x9fcc,
0xa000, 0xa48c,
0xa4d0, 0xa4fd,
0xa500, 0xa60c,
@@ -10826,9 +14250,9 @@ static const OnigCodePoint CR_XID_Start[] = {
0xa717, 0xa71f,
0xa722, 0xa788,
0xa78b, 0xa78e,
- 0xa790, 0xa791,
- 0xa7a0, 0xa7a9,
- 0xa7fa, 0xa801,
+ 0xa790, 0xa793,
+ 0xa7a0, 0xa7aa,
+ 0xa7f8, 0xa801,
0xa803, 0xa805,
0xa807, 0xa80a,
0xa80c, 0xa822,
@@ -10853,6 +14277,8 @@ static const OnigCodePoint CR_XID_Start[] = {
0xaac0, 0xaac0,
0xaac2, 0xaac2,
0xaadb, 0xaadd,
+ 0xaae0, 0xaaea,
+ 0xaaf2, 0xaaf4,
0xab01, 0xab06,
0xab09, 0xab0e,
0xab11, 0xab16,
@@ -10862,8 +14288,7 @@ static const OnigCodePoint CR_XID_Start[] = {
0xac00, 0xd7a3,
0xd7b0, 0xd7c6,
0xd7cb, 0xd7fb,
- 0xf900, 0xfa2d,
- 0xfa30, 0xfa6d,
+ 0xf900, 0xfa6d,
0xfa70, 0xfad9,
0xfb00, 0xfb06,
0xfb13, 0xfb17,
@@ -10920,6 +14345,8 @@ static const OnigCodePoint CR_XID_Start[] = {
0x1083f, 0x10855,
0x10900, 0x10915,
0x10920, 0x10939,
+ 0x10980, 0x109b7,
+ 0x109be, 0x109bf,
0x10a00, 0x10a00,
0x10a10, 0x10a13,
0x10a15, 0x10a17,
@@ -10931,10 +14358,18 @@ static const OnigCodePoint CR_XID_Start[] = {
0x10c00, 0x10c48,
0x11003, 0x11037,
0x11083, 0x110af,
+ 0x110d0, 0x110e8,
+ 0x11103, 0x11126,
+ 0x11183, 0x111b2,
+ 0x111c1, 0x111c4,
+ 0x11680, 0x116aa,
0x12000, 0x1236e,
0x12400, 0x12462,
0x13000, 0x1342e,
0x16800, 0x16a38,
+ 0x16f00, 0x16f44,
+ 0x16f50, 0x16f50,
+ 0x16f93, 0x16f9f,
0x1b000, 0x1b001,
0x1d400, 0x1d454,
0x1d456, 0x1d49c,
@@ -10966,6 +14401,39 @@ static const OnigCodePoint CR_XID_Start[] = {
0x1d78a, 0x1d7a8,
0x1d7aa, 0x1d7c2,
0x1d7c4, 0x1d7cb,
+ 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,
0x20000, 0x2a6d6,
0x2a700, 0x2b734,
0x2b740, 0x2b81d,
@@ -10974,7 +14442,7 @@ static const OnigCodePoint CR_XID_Start[] = {
/* 'XID_Continue': Derived Property */
static const OnigCodePoint CR_XID_Continue[] = {
- 521,
+ 571,
0x0030, 0x0039,
0x0041, 0x005a,
0x005f, 0x005f,
@@ -11023,6 +14491,9 @@ static const OnigCodePoint CR_XID_Continue[] = {
0x07fa, 0x07fa,
0x0800, 0x082d,
0x0840, 0x085b,
+ 0x08a0, 0x08a0,
+ 0x08a2, 0x08ac,
+ 0x08e4, 0x08fe,
0x0900, 0x0963,
0x0966, 0x096f,
0x0971, 0x0977,
@@ -11170,7 +14641,7 @@ static const OnigCodePoint CR_XID_Continue[] = {
0x0ec6, 0x0ec6,
0x0ec8, 0x0ecd,
0x0ed0, 0x0ed9,
- 0x0edc, 0x0edd,
+ 0x0edc, 0x0edf,
0x0f00, 0x0f00,
0x0f18, 0x0f19,
0x0f20, 0x0f29,
@@ -11186,9 +14657,10 @@ static const OnigCodePoint CR_XID_Continue[] = {
0x1000, 0x1049,
0x1050, 0x109d,
0x10a0, 0x10c5,
+ 0x10c7, 0x10c7,
+ 0x10cd, 0x10cd,
0x10d0, 0x10fa,
- 0x10fc, 0x10fc,
- 0x1100, 0x1248,
+ 0x10fc, 0x1248,
0x124a, 0x124d,
0x1250, 0x1256,
0x1258, 0x1258,
@@ -11220,8 +14692,7 @@ static const OnigCodePoint CR_XID_Continue[] = {
0x1760, 0x176c,
0x176e, 0x1770,
0x1772, 0x1773,
- 0x1780, 0x17b3,
- 0x17b6, 0x17d3,
+ 0x1780, 0x17d3,
0x17d7, 0x17d7,
0x17dc, 0x17dd,
0x17e0, 0x17e9,
@@ -11247,14 +14718,12 @@ static const OnigCodePoint CR_XID_Continue[] = {
0x1b00, 0x1b4b,
0x1b50, 0x1b59,
0x1b6b, 0x1b73,
- 0x1b80, 0x1baa,
- 0x1bae, 0x1bb9,
- 0x1bc0, 0x1bf3,
+ 0x1b80, 0x1bf3,
0x1c00, 0x1c37,
0x1c40, 0x1c49,
0x1c4d, 0x1c7d,
0x1cd0, 0x1cd2,
- 0x1cd4, 0x1cf2,
+ 0x1cd4, 0x1cf6,
0x1d00, 0x1de6,
0x1dfc, 0x1f15,
0x1f18, 0x1f1d,
@@ -11299,9 +14768,11 @@ static const OnigCodePoint CR_XID_Continue[] = {
0x2c00, 0x2c2e,
0x2c30, 0x2c5e,
0x2c60, 0x2ce4,
- 0x2ceb, 0x2cf1,
+ 0x2ceb, 0x2cf3,
0x2d00, 0x2d25,
- 0x2d30, 0x2d65,
+ 0x2d27, 0x2d27,
+ 0x2d2d, 0x2d2d,
+ 0x2d30, 0x2d67,
0x2d6f, 0x2d6f,
0x2d7f, 0x2d96,
0x2da0, 0x2da6,
@@ -11327,21 +14798,21 @@ static const OnigCodePoint CR_XID_Continue[] = {
0x31a0, 0x31ba,
0x31f0, 0x31ff,
0x3400, 0x4db5,
- 0x4e00, 0x9fcb,
+ 0x4e00, 0x9fcc,
0xa000, 0xa48c,
0xa4d0, 0xa4fd,
0xa500, 0xa60c,
0xa610, 0xa62b,
0xa640, 0xa66f,
- 0xa67c, 0xa67d,
+ 0xa674, 0xa67d,
0xa67f, 0xa697,
- 0xa6a0, 0xa6f1,
+ 0xa69f, 0xa6f1,
0xa717, 0xa71f,
0xa722, 0xa788,
0xa78b, 0xa78e,
- 0xa790, 0xa791,
- 0xa7a0, 0xa7a9,
- 0xa7fa, 0xa827,
+ 0xa790, 0xa793,
+ 0xa7a0, 0xa7aa,
+ 0xa7f8, 0xa827,
0xa840, 0xa873,
0xa880, 0xa8c4,
0xa8d0, 0xa8d9,
@@ -11359,6 +14830,8 @@ static const OnigCodePoint CR_XID_Continue[] = {
0xaa7a, 0xaa7b,
0xaa80, 0xaac2,
0xaadb, 0xaadd,
+ 0xaae0, 0xaaef,
+ 0xaaf2, 0xaaf6,
0xab01, 0xab06,
0xab09, 0xab0e,
0xab11, 0xab16,
@@ -11370,8 +14843,7 @@ static const OnigCodePoint CR_XID_Continue[] = {
0xac00, 0xd7a3,
0xd7b0, 0xd7c6,
0xd7cb, 0xd7fb,
- 0xf900, 0xfa2d,
- 0xfa30, 0xfa6d,
+ 0xf900, 0xfa6d,
0xfa70, 0xfad9,
0xfb00, 0xfb06,
0xfb13, 0xfb17,
@@ -11434,6 +14906,8 @@ static const OnigCodePoint CR_XID_Continue[] = {
0x1083f, 0x10855,
0x10900, 0x10915,
0x10920, 0x10939,
+ 0x10980, 0x109b7,
+ 0x109be, 0x109bf,
0x10a00, 0x10a03,
0x10a05, 0x10a06,
0x10a0c, 0x10a13,
@@ -11449,10 +14923,21 @@ static const OnigCodePoint CR_XID_Continue[] = {
0x11000, 0x11046,
0x11066, 0x1106f,
0x11080, 0x110ba,
+ 0x110d0, 0x110e8,
+ 0x110f0, 0x110f9,
+ 0x11100, 0x11134,
+ 0x11136, 0x1113f,
+ 0x11180, 0x111c4,
+ 0x111d0, 0x111d9,
+ 0x11680, 0x116b7,
+ 0x116c0, 0x116c9,
0x12000, 0x1236e,
0x12400, 0x12462,
0x13000, 0x1342e,
0x16800, 0x16a38,
+ 0x16f00, 0x16f44,
+ 0x16f50, 0x16f7e,
+ 0x16f8f, 0x16f9f,
0x1b000, 0x1b001,
0x1d165, 0x1d169,
0x1d16d, 0x1d172,
@@ -11491,6 +14976,39 @@ static const OnigCodePoint CR_XID_Continue[] = {
0x1d7aa, 0x1d7c2,
0x1d7c4, 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,
0x20000, 0x2a6d6,
0x2a700, 0x2b734,
0x2b740, 0x2b81d,
@@ -11520,7 +15038,7 @@ static const OnigCodePoint CR_Default_Ignorable_Code_Point[] = {
/* 'Grapheme_Extend': Derived Property */
static const OnigCodePoint CR_Grapheme_Extend[] = {
- 215,
+ 232,
0x0300, 0x036f,
0x0483, 0x0489,
0x0591, 0x05bd,
@@ -11544,6 +15062,7 @@ static const OnigCodePoint CR_Grapheme_Extend[] = {
0x0825, 0x0827,
0x0829, 0x082d,
0x0859, 0x085b,
+ 0x08e4, 0x08fe,
0x0900, 0x0902,
0x093a, 0x093a,
0x093c, 0x093c,
@@ -11639,6 +15158,7 @@ static const OnigCodePoint CR_Grapheme_Extend[] = {
0x1732, 0x1734,
0x1752, 0x1753,
0x1772, 0x1773,
+ 0x17b4, 0x17b5,
0x17b7, 0x17bd,
0x17c6, 0x17c6,
0x17c9, 0x17d3,
@@ -11666,6 +15186,7 @@ static const OnigCodePoint CR_Grapheme_Extend[] = {
0x1b80, 0x1b81,
0x1ba2, 0x1ba5,
0x1ba8, 0x1ba9,
+ 0x1bab, 0x1bab,
0x1be6, 0x1be6,
0x1be8, 0x1be9,
0x1bed, 0x1bed,
@@ -11676,6 +15197,7 @@ static const OnigCodePoint CR_Grapheme_Extend[] = {
0x1cd4, 0x1ce0,
0x1ce2, 0x1ce8,
0x1ced, 0x1ced,
+ 0x1cf4, 0x1cf4,
0x1dc0, 0x1de6,
0x1dfc, 0x1dff,
0x200c, 0x200d,
@@ -11686,7 +15208,8 @@ static const OnigCodePoint CR_Grapheme_Extend[] = {
0x302a, 0x302f,
0x3099, 0x309a,
0xa66f, 0xa672,
- 0xa67c, 0xa67d,
+ 0xa674, 0xa67d,
+ 0xa69f, 0xa69f,
0xa6f0, 0xa6f1,
0xa802, 0xa802,
0xa806, 0xa806,
@@ -11710,6 +15233,8 @@ static const OnigCodePoint CR_Grapheme_Extend[] = {
0xaab7, 0xaab8,
0xaabe, 0xaabf,
0xaac1, 0xaac1,
+ 0xaaec, 0xaaed,
+ 0xaaf6, 0xaaf6,
0xabe5, 0xabe5,
0xabe8, 0xabe8,
0xabed, 0xabed,
@@ -11728,6 +15253,16 @@ static const OnigCodePoint CR_Grapheme_Extend[] = {
0x11080, 0x11081,
0x110b3, 0x110b6,
0x110b9, 0x110ba,
+ 0x11100, 0x11102,
+ 0x11127, 0x1112b,
+ 0x1112d, 0x11134,
+ 0x11180, 0x11181,
+ 0x111b6, 0x111be,
+ 0x116ab, 0x116ab,
+ 0x116ad, 0x116ad,
+ 0x116b0, 0x116b5,
+ 0x116b7, 0x116b7,
+ 0x16f8f, 0x16f92,
0x1d165, 0x1d165,
0x1d167, 0x1d169,
0x1d16e, 0x1d172,
@@ -11740,7 +15275,7 @@ static const OnigCodePoint CR_Grapheme_Extend[] = {
/* 'Grapheme_Base': Derived Property */
static const OnigCodePoint CR_Grapheme_Base[] = {
- 596,
+ 643,
0x0020, 0x007e,
0x00a0, 0x00ac,
0x00ae, 0x02ff,
@@ -11755,6 +15290,7 @@ static const OnigCodePoint CR_Grapheme_Base[] = {
0x0559, 0x055f,
0x0561, 0x0587,
0x0589, 0x058a,
+ 0x058f, 0x058f,
0x05be, 0x05be,
0x05c0, 0x05c0,
0x05c3, 0x05c3,
@@ -11783,6 +15319,8 @@ static const OnigCodePoint CR_Grapheme_Base[] = {
0x0830, 0x083e,
0x0840, 0x0858,
0x085e, 0x085e,
+ 0x08a0, 0x08a0,
+ 0x08a2, 0x08ac,
0x0903, 0x0939,
0x093b, 0x093b,
0x093d, 0x0940,
@@ -11831,8 +15369,7 @@ static const OnigCodePoint CR_Grapheme_Base[] = {
0x0acb, 0x0acc,
0x0ad0, 0x0ad0,
0x0ae0, 0x0ae1,
- 0x0ae6, 0x0aef,
- 0x0af1, 0x0af1,
+ 0x0ae6, 0x0af1,
0x0b02, 0x0b03,
0x0b05, 0x0b0c,
0x0b0f, 0x0b10,
@@ -11932,7 +15469,7 @@ static const OnigCodePoint CR_Grapheme_Base[] = {
0x0ec0, 0x0ec4,
0x0ec6, 0x0ec6,
0x0ed0, 0x0ed9,
- 0x0edc, 0x0edd,
+ 0x0edc, 0x0edf,
0x0f00, 0x0f17,
0x0f1a, 0x0f34,
0x0f36, 0x0f36,
@@ -11957,8 +15494,9 @@ static const OnigCodePoint CR_Grapheme_Base[] = {
0x1087, 0x108c,
0x108e, 0x109c,
0x109e, 0x10c5,
- 0x10d0, 0x10fc,
- 0x1100, 0x1248,
+ 0x10c7, 0x10c7,
+ 0x10cd, 0x10cd,
+ 0x10d0, 0x1248,
0x124a, 0x124d,
0x1250, 0x1256,
0x1258, 0x1258,
@@ -12031,8 +15569,7 @@ static const OnigCodePoint CR_Grapheme_Base[] = {
0x1b82, 0x1ba1,
0x1ba6, 0x1ba7,
0x1baa, 0x1baa,
- 0x1bae, 0x1bb9,
- 0x1bc0, 0x1be5,
+ 0x1bac, 0x1be5,
0x1be7, 0x1be7,
0x1bea, 0x1bec,
0x1bee, 0x1bee,
@@ -12041,10 +15578,12 @@ static const OnigCodePoint CR_Grapheme_Base[] = {
0x1c34, 0x1c35,
0x1c3b, 0x1c49,
0x1c4d, 0x1c7f,
+ 0x1cc0, 0x1cc7,
0x1cd3, 0x1cd3,
0x1ce1, 0x1ce1,
0x1ce9, 0x1cec,
- 0x1cee, 0x1cf2,
+ 0x1cee, 0x1cf3,
+ 0x1cf5, 0x1cf6,
0x1d00, 0x1dbf,
0x1e00, 0x1f15,
0x1f18, 0x1f1d,
@@ -12074,15 +15613,16 @@ static const OnigCodePoint CR_Grapheme_Base[] = {
0x2400, 0x2426,
0x2440, 0x244a,
0x2460, 0x26ff,
- 0x2701, 0x27ca,
- 0x27cc, 0x27cc,
- 0x27ce, 0x2b4c,
+ 0x2701, 0x2b4c,
0x2b50, 0x2b59,
0x2c00, 0x2c2e,
0x2c30, 0x2c5e,
0x2c60, 0x2cee,
+ 0x2cf2, 0x2cf3,
0x2cf9, 0x2d25,
- 0x2d30, 0x2d65,
+ 0x2d27, 0x2d27,
+ 0x2d2d, 0x2d2d,
+ 0x2d30, 0x2d67,
0x2d6f, 0x2d70,
0x2d80, 0x2d96,
0x2da0, 0x2da6,
@@ -12093,7 +15633,7 @@ static const OnigCodePoint CR_Grapheme_Base[] = {
0x2dc8, 0x2dce,
0x2dd0, 0x2dd6,
0x2dd8, 0x2dde,
- 0x2e00, 0x2e31,
+ 0x2e00, 0x2e3b,
0x2e80, 0x2e99,
0x2e9b, 0x2ef3,
0x2f00, 0x2fd5,
@@ -12109,7 +15649,7 @@ static const OnigCodePoint CR_Grapheme_Base[] = {
0x31f0, 0x321e,
0x3220, 0x32fe,
0x3300, 0x4db5,
- 0x4dc0, 0x9fcb,
+ 0x4dc0, 0x9fcc,
0xa000, 0xa48c,
0xa490, 0xa4c6,
0xa4d0, 0xa62b,
@@ -12119,9 +15659,9 @@ static const OnigCodePoint CR_Grapheme_Base[] = {
0xa6a0, 0xa6ef,
0xa6f2, 0xa6f7,
0xa700, 0xa78e,
- 0xa790, 0xa791,
- 0xa7a0, 0xa7a9,
- 0xa7fa, 0xa801,
+ 0xa790, 0xa793,
+ 0xa7a0, 0xa7aa,
+ 0xa7f8, 0xa801,
0xa803, 0xa805,
0xa807, 0xa80a,
0xa80c, 0xa824,
@@ -12155,7 +15695,8 @@ static const OnigCodePoint CR_Grapheme_Base[] = {
0xaab9, 0xaabd,
0xaac0, 0xaac0,
0xaac2, 0xaac2,
- 0xaadb, 0xaadf,
+ 0xaadb, 0xaaeb,
+ 0xaaee, 0xaaf5,
0xab01, 0xab06,
0xab09, 0xab0e,
0xab11, 0xab16,
@@ -12168,8 +15709,7 @@ static const OnigCodePoint CR_Grapheme_Base[] = {
0xac00, 0xd7a3,
0xd7b0, 0xd7c6,
0xd7cb, 0xd7fb,
- 0xf900, 0xfa2d,
- 0xfa30, 0xfa6d,
+ 0xf900, 0xfa6d,
0xfa70, 0xfad9,
0xfb00, 0xfb06,
0xfb13, 0xfb17,
@@ -12231,6 +15771,8 @@ static const OnigCodePoint CR_Grapheme_Base[] = {
0x10900, 0x1091b,
0x1091f, 0x10939,
0x1093f, 0x1093f,
+ 0x10980, 0x109b7,
+ 0x109be, 0x109bf,
0x10a00, 0x10a00,
0x10a10, 0x10a13,
0x10a15, 0x10a17,
@@ -12252,11 +15794,27 @@ static const OnigCodePoint CR_Grapheme_Base[] = {
0x110b7, 0x110b8,
0x110bb, 0x110bc,
0x110be, 0x110c1,
+ 0x110d0, 0x110e8,
+ 0x110f0, 0x110f9,
+ 0x11103, 0x11126,
+ 0x1112c, 0x1112c,
+ 0x11136, 0x11143,
+ 0x11182, 0x111b5,
+ 0x111bf, 0x111c8,
+ 0x111d0, 0x111d9,
+ 0x11680, 0x116aa,
+ 0x116ac, 0x116ac,
+ 0x116ae, 0x116af,
+ 0x116b6, 0x116b6,
+ 0x116c0, 0x116c9,
0x12000, 0x1236e,
0x12400, 0x12462,
0x12470, 0x12473,
0x13000, 0x1342e,
0x16800, 0x16a38,
+ 0x16f00, 0x16f44,
+ 0x16f50, 0x16f7e,
+ 0x16f93, 0x16f9f,
0x1b000, 0x1b001,
0x1d000, 0x1d0f5,
0x1d100, 0x1d126,
@@ -12291,6 +15849,40 @@ static const OnigCodePoint CR_Grapheme_Base[] = {
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,
@@ -12299,7 +15891,7 @@ static const OnigCodePoint CR_Grapheme_Base[] = {
0x1f0d1, 0x1f0df,
0x1f100, 0x1f10a,
0x1f110, 0x1f12e,
- 0x1f130, 0x1f169,
+ 0x1f130, 0x1f16b,
0x1f170, 0x1f19a,
0x1f1e6, 0x1f202,
0x1f210, 0x1f23a,
@@ -12317,19 +15909,9 @@ static const OnigCodePoint CR_Grapheme_Base[] = {
0x1f442, 0x1f4f7,
0x1f4f9, 0x1f4fc,
0x1f500, 0x1f53d,
+ 0x1f540, 0x1f543,
0x1f550, 0x1f567,
- 0x1f5fb, 0x1f5ff,
- 0x1f601, 0x1f610,
- 0x1f612, 0x1f614,
- 0x1f616, 0x1f616,
- 0x1f618, 0x1f618,
- 0x1f61a, 0x1f61a,
- 0x1f61c, 0x1f61e,
- 0x1f620, 0x1f625,
- 0x1f628, 0x1f62b,
- 0x1f62d, 0x1f62d,
- 0x1f630, 0x1f633,
- 0x1f635, 0x1f640,
+ 0x1f5fb, 0x1f640,
0x1f645, 0x1f64f,
0x1f680, 0x1f6c5,
0x1f700, 0x1f773,
@@ -12341,7 +15923,7 @@ static const OnigCodePoint CR_Grapheme_Base[] = {
/* 'Grapheme_Link': Derived Property */
static const OnigCodePoint CR_Grapheme_Link[] = {
- 29,
+ 33,
0x094d, 0x094d,
0x09cd, 0x09cd,
0x0a4d, 0x0a4d,
@@ -12360,22 +15942,26 @@ static const OnigCodePoint CR_Grapheme_Link[] = {
0x17d2, 0x17d2,
0x1a60, 0x1a60,
0x1b44, 0x1b44,
- 0x1baa, 0x1baa,
+ 0x1baa, 0x1bab,
0x1bf2, 0x1bf3,
0x2d7f, 0x2d7f,
0xa806, 0xa806,
0xa8c4, 0xa8c4,
0xa953, 0xa953,
0xa9c0, 0xa9c0,
+ 0xaaf6, 0xaaf6,
0xabed, 0xabed,
0x10a3f, 0x10a3f,
0x11046, 0x11046,
0x110b9, 0x110b9,
+ 0x11133, 0x11134,
+ 0x111c0, 0x111c0,
+ 0x116b6, 0x116b6,
}; /* CR_Grapheme_Link */
/* 'Common': Script */
static const OnigCodePoint CR_Common[] = {
- 169,
+ 157,
0x0000, 0x0040,
0x005b, 0x0060,
0x007b, 0x00a9,
@@ -12398,7 +15984,6 @@ static const OnigCodePoint CR_Common[] = {
0x0660, 0x0669,
0x06dd, 0x06dd,
0x0964, 0x0965,
- 0x0970, 0x0970,
0x0e3f, 0x0e3f,
0x0fd5, 0x0fd8,
0x10fb, 0x10fb,
@@ -12409,7 +15994,8 @@ static const OnigCodePoint CR_Common[] = {
0x1cd3, 0x1cd3,
0x1ce1, 0x1ce1,
0x1ce9, 0x1cec,
- 0x1cee, 0x1cf2,
+ 0x1cee, 0x1cf3,
+ 0x1cf5, 0x1cf6,
0x2000, 0x200b,
0x200e, 0x2064,
0x206a, 0x2070,
@@ -12426,12 +16012,10 @@ static const OnigCodePoint CR_Common[] = {
0x2400, 0x2426,
0x2440, 0x244a,
0x2460, 0x26ff,
- 0x2701, 0x27ca,
- 0x27cc, 0x27cc,
- 0x27ce, 0x27ff,
+ 0x2701, 0x27ff,
0x2900, 0x2b4c,
0x2b50, 0x2b59,
- 0x2e00, 0x2e31,
+ 0x2e00, 0x2e3b,
0x2ff0, 0x2ffb,
0x3000, 0x3004,
0x3006, 0x3006,
@@ -12508,7 +16092,7 @@ static const OnigCodePoint CR_Common[] = {
0x1f0d1, 0x1f0df,
0x1f100, 0x1f10a,
0x1f110, 0x1f12e,
- 0x1f130, 0x1f169,
+ 0x1f130, 0x1f16b,
0x1f170, 0x1f19a,
0x1f1e6, 0x1f1ff,
0x1f201, 0x1f202,
@@ -12527,19 +16111,9 @@ static const OnigCodePoint CR_Common[] = {
0x1f442, 0x1f4f7,
0x1f4f9, 0x1f4fc,
0x1f500, 0x1f53d,
+ 0x1f540, 0x1f543,
0x1f550, 0x1f567,
- 0x1f5fb, 0x1f5ff,
- 0x1f601, 0x1f610,
- 0x1f612, 0x1f614,
- 0x1f616, 0x1f616,
- 0x1f618, 0x1f618,
- 0x1f61a, 0x1f61a,
- 0x1f61c, 0x1f61e,
- 0x1f620, 0x1f625,
- 0x1f628, 0x1f62b,
- 0x1f62d, 0x1f62d,
- 0x1f630, 0x1f633,
- 0x1f635, 0x1f640,
+ 0x1f5fb, 0x1f640,
0x1f645, 0x1f64f,
0x1f680, 0x1f6c5,
0x1f700, 0x1f773,
@@ -12574,9 +16148,9 @@ static const OnigCodePoint CR_Latin[] = {
0x2c60, 0x2c7f,
0xa722, 0xa787,
0xa78b, 0xa78e,
- 0xa790, 0xa791,
- 0xa7a0, 0xa7a9,
- 0xa7fa, 0xa7ff,
+ 0xa790, 0xa793,
+ 0xa7a0, 0xa7aa,
+ 0xa7f8, 0xa7ff,
0xfb00, 0xfb06,
0xff21, 0xff3a,
0xff41, 0xff5a,
@@ -12628,17 +16202,18 @@ static const OnigCodePoint CR_Cyrillic[] = {
0x1d2b, 0x1d2b,
0x1d78, 0x1d78,
0x2de0, 0x2dff,
- 0xa640, 0xa673,
- 0xa67c, 0xa697,
+ 0xa640, 0xa697,
+ 0xa69f, 0xa69f,
}; /* CR_Cyrillic */
/* 'Armenian': Script */
static const OnigCodePoint CR_Armenian[] = {
- 5,
+ 6,
0x0531, 0x0556,
0x0559, 0x055f,
0x0561, 0x0587,
0x058a, 0x058a,
+ 0x058f, 0x058f,
0xfb13, 0xfb17,
}; /* CR_Armenian */
@@ -12658,8 +16233,8 @@ static const OnigCodePoint CR_Hebrew[] = {
/* 'Arabic': Script */
static const OnigCodePoint CR_Arabic[] = {
- 19,
- 0x0600, 0x0603,
+ 56,
+ 0x0600, 0x0604,
0x0606, 0x060b,
0x060d, 0x061a,
0x061e, 0x061e,
@@ -12670,6 +16245,9 @@ static const OnigCodePoint CR_Arabic[] = {
0x0671, 0x06dc,
0x06de, 0x06ff,
0x0750, 0x077f,
+ 0x08a0, 0x08a0,
+ 0x08a2, 0x08ac,
+ 0x08e4, 0x08fe,
0xfb50, 0xfbc1,
0xfbd3, 0xfd3d,
0xfd50, 0xfd8f,
@@ -12678,6 +16256,40 @@ static const OnigCodePoint CR_Arabic[] = {
0xfe70, 0xfe74,
0xfe76, 0xfefc,
0x10e60, 0x10e7e,
+ 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,
}; /* CR_Arabic */
/* 'Syriac': Script */
@@ -12696,11 +16308,10 @@ static const OnigCodePoint CR_Thaana[] = {
/* 'Devanagari': Script */
static const OnigCodePoint CR_Devanagari[] = {
- 6,
+ 5,
0x0900, 0x0950,
0x0953, 0x0963,
- 0x0966, 0x096f,
- 0x0971, 0x0977,
+ 0x0966, 0x0977,
0x0979, 0x097f,
0xa8e0, 0xa8fb,
}; /* CR_Devanagari */
@@ -12747,7 +16358,7 @@ static const OnigCodePoint CR_Gurmukhi[] = {
/* 'Gujarati': Script */
static const OnigCodePoint CR_Gujarati[] = {
- 14,
+ 13,
0x0a81, 0x0a83,
0x0a85, 0x0a8d,
0x0a8f, 0x0a91,
@@ -12760,8 +16371,7 @@ static const OnigCodePoint CR_Gujarati[] = {
0x0acb, 0x0acd,
0x0ad0, 0x0ad0,
0x0ae0, 0x0ae3,
- 0x0ae6, 0x0aef,
- 0x0af1, 0x0af1,
+ 0x0ae6, 0x0af1,
}; /* CR_Gujarati */
/* 'Oriya': Script */
@@ -12901,7 +16511,7 @@ static const OnigCodePoint CR_Lao[] = {
0x0ec6, 0x0ec6,
0x0ec8, 0x0ecd,
0x0ed0, 0x0ed9,
- 0x0edc, 0x0edd,
+ 0x0edc, 0x0edf,
}; /* CR_Lao */
/* 'Tibetan': Script */
@@ -12925,11 +16535,15 @@ static const OnigCodePoint CR_Myanmar[] = {
/* 'Georgian': Script */
static const OnigCodePoint CR_Georgian[] = {
- 4,
+ 8,
0x10a0, 0x10c5,
+ 0x10c7, 0x10c7,
+ 0x10cd, 0x10cd,
0x10d0, 0x10fa,
- 0x10fc, 0x10fc,
+ 0x10fc, 0x10ff,
0x2d00, 0x2d25,
+ 0x2d27, 0x2d27,
+ 0x2d2d, 0x2d2d,
}; /* CR_Georgian */
/* 'Hangul': Script */
@@ -13066,7 +16680,7 @@ static const OnigCodePoint CR_Bopomofo[] = {
/* 'Han': Script */
static const OnigCodePoint CR_Han[] = {
- 16,
+ 15,
0x2e80, 0x2e99,
0x2e9b, 0x2ef3,
0x2f00, 0x2fd5,
@@ -13075,9 +16689,8 @@ static const OnigCodePoint CR_Han[] = {
0x3021, 0x3029,
0x3038, 0x303b,
0x3400, 0x4db5,
- 0x4e00, 0x9fcb,
- 0xf900, 0xfa2d,
- 0xfa30, 0xfa6d,
+ 0x4e00, 0x9fcc,
+ 0xf900, 0xfa6d,
0xfa70, 0xfad9,
0x20000, 0x2a6d6,
0x2a700, 0x2b734,
@@ -13113,7 +16726,7 @@ static const OnigCodePoint CR_Deseret[] = {
/* 'Inherited': Script */
static const OnigCodePoint CR_Inherited[] = {
- 24,
+ 25,
0x0300, 0x036f,
0x0485, 0x0486,
0x064b, 0x0655,
@@ -13124,6 +16737,7 @@ static const OnigCodePoint CR_Inherited[] = {
0x1cd4, 0x1ce0,
0x1ce2, 0x1ce8,
0x1ced, 0x1ced,
+ 0x1cf4, 0x1cf4,
0x1dc0, 0x1de6,
0x1dfc, 0x1dff,
0x200c, 0x200d,
@@ -13244,7 +16858,7 @@ static const OnigCodePoint CR_Buginese[] = {
static const OnigCodePoint CR_Coptic[] = {
3,
0x03e2, 0x03ef,
- 0x2c80, 0x2cf1,
+ 0x2c80, 0x2cf3,
0x2cf9, 0x2cff,
}; /* CR_Coptic */
@@ -13267,7 +16881,7 @@ static const OnigCodePoint CR_Glagolitic[] = {
/* 'Tifinagh': Script */
static const OnigCodePoint CR_Tifinagh[] = {
3,
- 0x2d30, 0x2d65,
+ 0x2d30, 0x2d67,
0x2d6f, 0x2d70,
0x2d7f, 0x2d7f,
}; /* CR_Tifinagh */
@@ -13335,8 +16949,8 @@ static const OnigCodePoint CR_Nko[] = {
/* 'Sundanese': Script */
static const OnigCodePoint CR_Sundanese[] = {
2,
- 0x1b80, 0x1baa,
- 0x1bae, 0x1bb9,
+ 0x1b80, 0x1bbf,
+ 0x1cc0, 0x1cc7,
}; /* CR_Sundanese */
/* 'Lepcha': Script */
@@ -13467,7 +17081,8 @@ static const OnigCodePoint CR_Javanese[] = {
/* 'Meetei_Mayek': Script */
static const OnigCodePoint CR_Meetei_Mayek[] = {
- 2,
+ 3,
+ 0xaae0, 0xaaf6,
0xabc0, 0xabed,
0xabf0, 0xabf9,
}; /* CR_Meetei_Mayek */
@@ -13532,21 +17147,57 @@ static const OnigCodePoint CR_Mandaic[] = {
0x085e, 0x085e,
}; /* CR_Mandaic */
+/* 'Chakma': Script */
+static const OnigCodePoint CR_Chakma[] = {
+ 2,
+ 0x11100, 0x11134,
+ 0x11136, 0x11143,
+}; /* CR_Chakma */
+
+/* 'Meroitic_Cursive': Script */
+static const OnigCodePoint CR_Meroitic_Cursive[] = {
+ 2,
+ 0x109a0, 0x109b7,
+ 0x109be, 0x109bf,
+}; /* CR_Meroitic_Cursive */
+
+/* 'Meroitic_Hieroglyphs': Script */
+static const OnigCodePoint CR_Meroitic_Hieroglyphs[] = {
+ 1,
+ 0x10980, 0x1099f,
+}; /* CR_Meroitic_Hieroglyphs */
+
+/* 'Miao': Script */
+static const OnigCodePoint CR_Miao[] = {
+ 3,
+ 0x16f00, 0x16f44,
+ 0x16f50, 0x16f7e,
+ 0x16f8f, 0x16f9f,
+}; /* CR_Miao */
+
+/* 'Sharada': Script */
+static const OnigCodePoint CR_Sharada[] = {
+ 2,
+ 0x11180, 0x111c8,
+ 0x111d0, 0x111d9,
+}; /* CR_Sharada */
+
+/* 'Sora_Sompeng': Script */
+static const OnigCodePoint CR_Sora_Sompeng[] = {
+ 2,
+ 0x110d0, 0x110e8,
+ 0x110f0, 0x110f9,
+}; /* CR_Sora_Sompeng */
+
+/* 'Takri': Script */
+static const OnigCodePoint CR_Takri[] = {
+ 2,
+ 0x11680, 0x116b7,
+ 0x116c0, 0x116c9,
+}; /* CR_Takri */
+
/* 'White_Space': Binary Property */
-static const OnigCodePoint CR_White_Space[] = {
- 11,
- 0x0009, 0x000d,
- 0x0020, 0x0020,
- 0x0085, 0x0085,
- 0x00a0, 0x00a0,
- 0x1680, 0x1680,
- 0x180e, 0x180e,
- 0x2000, 0x200a,
- 0x2028, 0x2029,
- 0x202f, 0x202f,
- 0x205f, 0x205f,
- 0x3000, 0x3000,
-}; /* CR_White_Space */
+#define CR_White_Space CR_Space
/* 'Bidi_Control': Binary Property */
static const OnigCodePoint CR_Bidi_Control[] = {
@@ -13563,7 +17214,7 @@ static const OnigCodePoint CR_Join_Control[] = {
/* 'Dash': Binary Property */
static const OnigCodePoint CR_Dash[] = {
- 19,
+ 20,
0x002d, 0x002d,
0x058a, 0x058a,
0x05be, 0x05be,
@@ -13576,6 +17227,7 @@ static const OnigCodePoint CR_Dash[] = {
0x2212, 0x2212,
0x2e17, 0x2e17,
0x2e1a, 0x2e1a,
+ 0x2e3a, 0x2e3b,
0x301c, 0x301c,
0x3030, 0x3030,
0x30a0, 0x30a0,
@@ -13619,7 +17271,7 @@ static const OnigCodePoint CR_Quotation_Mark[] = {
/* 'Terminal_Punctuation': Binary Property */
static const OnigCodePoint CR_Terminal_Punctuation[] = {
- 67,
+ 70,
0x0021, 0x0021,
0x002c, 0x002c,
0x002e, 0x002e,
@@ -13669,6 +17321,7 @@ static const OnigCodePoint CR_Terminal_Punctuation[] = {
0xa9c7, 0xa9c9,
0xaa5d, 0xaa5f,
0xaadf, 0xaadf,
+ 0xaaf0, 0xaaf1,
0xabeb, 0xabeb,
0xfe50, 0xfe52,
0xfe54, 0xfe57,
@@ -13686,12 +17339,14 @@ static const OnigCodePoint CR_Terminal_Punctuation[] = {
0x10b3a, 0x10b3f,
0x11047, 0x1104d,
0x110be, 0x110c1,
+ 0x11141, 0x11143,
+ 0x111c5, 0x111c6,
0x12470, 0x12473,
}; /* CR_Terminal_Punctuation */
/* 'Other_Math': Binary Property */
static const OnigCodePoint CR_Other_Math[] = {
- 100,
+ 133,
0x005e, 0x005e,
0x03d0, 0x03d2,
0x03d5, 0x03d5,
@@ -13792,6 +17447,39 @@ static const OnigCodePoint CR_Other_Math[] = {
0x1d7aa, 0x1d7c2,
0x1d7c4, 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,
}; /* CR_Other_Math */
/* 'Hex_Digit': Binary Property */
@@ -13806,16 +17494,11 @@ static const OnigCodePoint CR_Hex_Digit[] = {
}; /* CR_Hex_Digit */
/* 'ASCII_Hex_Digit': Binary Property */
-static const OnigCodePoint CR_ASCII_Hex_Digit[] = {
- 3,
- 0x0030, 0x0039,
- 0x0041, 0x0046,
- 0x0061, 0x0066,
-}; /* CR_ASCII_Hex_Digit */
+#define CR_ASCII_Hex_Digit CR_XDigit
/* 'Other_Alphabetic': Binary Property */
static const OnigCodePoint CR_Other_Alphabetic[] = {
- 145,
+ 158,
0x0345, 0x0345,
0x05b0, 0x05bd,
0x05bf, 0x05bf,
@@ -13837,6 +17520,8 @@ static const OnigCodePoint CR_Other_Alphabetic[] = {
0x081b, 0x0823,
0x0825, 0x0827,
0x0829, 0x082c,
+ 0x08e4, 0x08e9,
+ 0x08f0, 0x08fe,
0x0900, 0x0903,
0x093a, 0x093b,
0x093e, 0x094c,
@@ -13933,11 +17618,14 @@ static const OnigCodePoint CR_Other_Alphabetic[] = {
0x1b35, 0x1b43,
0x1b80, 0x1b82,
0x1ba1, 0x1ba9,
+ 0x1bac, 0x1bad,
0x1be7, 0x1bf1,
0x1c24, 0x1c35,
- 0x1cf2, 0x1cf2,
+ 0x1cf2, 0x1cf3,
0x24b6, 0x24e9,
0x2de0, 0x2dff,
+ 0xa674, 0xa67b,
+ 0xa69f, 0xa69f,
0xa823, 0xa827,
0xa880, 0xa881,
0xa8b4, 0xa8c3,
@@ -13952,6 +17640,8 @@ static const OnigCodePoint CR_Other_Alphabetic[] = {
0xaab2, 0xaab4,
0xaab7, 0xaab8,
0xaabe, 0xaabe,
+ 0xaaeb, 0xaaef,
+ 0xaaf5, 0xaaf5,
0xabe3, 0xabea,
0xfb1e, 0xfb1e,
0x10a01, 0x10a03,
@@ -13961,18 +17651,23 @@ static const OnigCodePoint CR_Other_Alphabetic[] = {
0x11038, 0x11045,
0x11082, 0x11082,
0x110b0, 0x110b8,
+ 0x11100, 0x11102,
+ 0x11127, 0x11132,
+ 0x11180, 0x11182,
+ 0x111b3, 0x111bf,
+ 0x116ab, 0x116b5,
+ 0x16f51, 0x16f7e,
}; /* CR_Other_Alphabetic */
/* 'Ideographic': Binary Property */
static const OnigCodePoint CR_Ideographic[] = {
- 12,
+ 11,
0x3006, 0x3007,
0x3021, 0x3029,
0x3038, 0x303a,
0x3400, 0x4db5,
- 0x4e00, 0x9fcb,
- 0xf900, 0xfa2d,
- 0xfa30, 0xfa6d,
+ 0x4e00, 0x9fcc,
+ 0xf900, 0xfa6d,
0xfa70, 0xfad9,
0x20000, 0x2a6d6,
0x2a700, 0x2b734,
@@ -13982,7 +17677,7 @@ static const OnigCodePoint CR_Ideographic[] = {
/* 'Diacritic': Binary Property */
static const OnigCodePoint CR_Diacritic[] = {
- 117,
+ 125,
0x005e, 0x005e,
0x0060, 0x0060,
0x00a8, 0x00a8,
@@ -14011,6 +17706,7 @@ static const OnigCodePoint CR_Diacritic[] = {
0x07a6, 0x07b0,
0x07eb, 0x07f5,
0x0818, 0x0819,
+ 0x08e4, 0x08fe,
0x093c, 0x093c,
0x094d, 0x094d,
0x0951, 0x0954,
@@ -14053,11 +17749,12 @@ static const OnigCodePoint CR_Diacritic[] = {
0x1b34, 0x1b34,
0x1b44, 0x1b44,
0x1b6b, 0x1b73,
- 0x1baa, 0x1baa,
+ 0x1baa, 0x1bab,
0x1c36, 0x1c37,
0x1c78, 0x1c7d,
0x1cd0, 0x1ce8,
0x1ced, 0x1ced,
+ 0x1cf4, 0x1cf4,
0x1d2c, 0x1d6a,
0x1dc4, 0x1dcf,
0x1dfd, 0x1dff,
@@ -14078,6 +17775,7 @@ static const OnigCodePoint CR_Diacritic[] = {
0xa6f0, 0xa6f1,
0xa717, 0xa721,
0xa788, 0xa788,
+ 0xa7f8, 0xa7f9,
0xa8c4, 0xa8c4,
0xa8e0, 0xa8f1,
0xa92b, 0xa92e,
@@ -14086,6 +17784,7 @@ static const OnigCodePoint CR_Diacritic[] = {
0xa9c0, 0xa9c0,
0xaa7b, 0xaa7b,
0xaabf, 0xaac2,
+ 0xaaf6, 0xaaf6,
0xabec, 0xabed,
0xfb1e, 0xfb1e,
0xfe20, 0xfe26,
@@ -14095,6 +17794,10 @@ static const OnigCodePoint CR_Diacritic[] = {
0xff9e, 0xff9f,
0xffe3, 0xffe3,
0x110b9, 0x110ba,
+ 0x11133, 0x11134,
+ 0x111c0, 0x111c0,
+ 0x116b6, 0x116b7,
+ 0x16f8f, 0x16f9f,
0x1d167, 0x1d169,
0x1d16d, 0x1d172,
0x1d17b, 0x1d182,
@@ -14104,13 +17807,14 @@ static const OnigCodePoint CR_Diacritic[] = {
/* 'Extender': Binary Property */
static const OnigCodePoint CR_Extender[] = {
- 20,
+ 22,
0x00b7, 0x00b7,
0x02d0, 0x02d1,
0x0640, 0x0640,
0x07fa, 0x07fa,
0x0e46, 0x0e46,
0x0ec6, 0x0ec6,
+ 0x180a, 0x180a,
0x1843, 0x1843,
0x1aa7, 0x1aa7,
0x1c36, 0x1c36,
@@ -14124,25 +17828,31 @@ static const OnigCodePoint CR_Extender[] = {
0xa9cf, 0xa9cf,
0xaa70, 0xaa70,
0xaadd, 0xaadd,
+ 0xaaf3, 0xaaf4,
0xff70, 0xff70,
}; /* CR_Extender */
/* 'Other_Lowercase': Binary Property */
static const OnigCodePoint CR_Other_Lowercase[] = {
- 13,
+ 18,
+ 0x00aa, 0x00aa,
+ 0x00ba, 0x00ba,
0x02b0, 0x02b8,
0x02c0, 0x02c1,
0x02e0, 0x02e4,
0x0345, 0x0345,
0x037a, 0x037a,
- 0x1d2c, 0x1d61,
+ 0x1d2c, 0x1d6a,
0x1d78, 0x1d78,
0x1d9b, 0x1dbf,
- 0x2090, 0x2094,
+ 0x2071, 0x2071,
+ 0x207f, 0x207f,
+ 0x2090, 0x209c,
0x2170, 0x217f,
0x24d0, 0x24e9,
- 0x2c7d, 0x2c7d,
+ 0x2c7c, 0x2c7d,
0xa770, 0xa770,
+ 0xa7f8, 0xa7f9,
}; /* CR_Other_Lowercase */
/* 'Other_Uppercase': Binary Property */
@@ -14177,7 +17887,7 @@ static const OnigCodePoint CR_Noncharacter_Code_Point[] = {
/* 'Other_Grapheme_Extend': Binary Property */
static const OnigCodePoint CR_Other_Grapheme_Extend[] = {
- 16,
+ 17,
0x09be, 0x09be,
0x09d7, 0x09d7,
0x0b3e, 0x0b3e,
@@ -14191,6 +17901,7 @@ static const OnigCodePoint CR_Other_Grapheme_Extend[] = {
0x0dcf, 0x0dcf,
0x0ddf, 0x0ddf,
0x200c, 0x200d,
+ 0x302e, 0x302f,
0xff9e, 0xff9f,
0x1d165, 0x1d165,
0x1d16e, 0x1d172,
@@ -14221,7 +17932,7 @@ static const OnigCodePoint CR_Radical[] = {
static const OnigCodePoint CR_Unified_Ideograph[] = {
12,
0x3400, 0x4db5,
- 0x4e00, 0x9fcb,
+ 0x4e00, 0x9fcc,
0xfa0e, 0xfa0f,
0xfa11, 0xfa11,
0xfa13, 0xfa14,
@@ -14236,9 +17947,10 @@ static const OnigCodePoint CR_Unified_Ideograph[] = {
/* 'Other_Default_Ignorable_Code_Point': Binary Property */
static const OnigCodePoint CR_Other_Default_Ignorable_Code_Point[] = {
- 10,
+ 11,
0x034f, 0x034f,
0x115f, 0x1160,
+ 0x17b4, 0x17b5,
0x2065, 0x2069,
0x3164, 0x3164,
0xffa0, 0xffa0,
@@ -14328,7 +18040,7 @@ static const OnigCodePoint CR_Other_ID_Continue[] = {
/* 'STerm': Binary Property */
static const OnigCodePoint CR_STerm[] = {
- 47,
+ 50,
0x0021, 0x0021,
0x002e, 0x002e,
0x003f, 0x003f,
@@ -14366,6 +18078,7 @@ static const OnigCodePoint CR_STerm[] = {
0xa92f, 0xa92f,
0xa9c8, 0xa9c9,
0xaa5d, 0xaa5f,
+ 0xaaf0, 0xaaf1,
0xabeb, 0xabeb,
0xfe52, 0xfe52,
0xfe56, 0xfe57,
@@ -14376,6 +18089,8 @@ static const OnigCodePoint CR_STerm[] = {
0x10a56, 0x10a57,
0x11047, 0x11048,
0x110be, 0x110c1,
+ 0x11141, 0x11143,
+ 0x111c5, 0x111c6,
}; /* CR_STerm */
/* 'Variation_Selector': Binary Property */
@@ -14431,7 +18146,7 @@ static const OnigCodePoint CR_Pattern_Syntax[] = {
/* 'Unknown': Script */
static const OnigCodePoint CR_Unknown[] = {
- 499,
+ 537,
0x0378, 0x0379,
0x037f, 0x0383,
0x038b, 0x038b,
@@ -14441,11 +18156,12 @@ static const OnigCodePoint CR_Unknown[] = {
0x0557, 0x0558,
0x0560, 0x0560,
0x0588, 0x0588,
- 0x058b, 0x0590,
+ 0x058b, 0x058e,
+ 0x0590, 0x0590,
0x05c8, 0x05cf,
0x05eb, 0x05ef,
0x05f5, 0x05ff,
- 0x0604, 0x0605,
+ 0x0605, 0x0605,
0x061c, 0x061d,
0x070e, 0x070e,
0x074b, 0x074c,
@@ -14454,7 +18170,10 @@ static const OnigCodePoint CR_Unknown[] = {
0x082e, 0x082f,
0x083f, 0x083f,
0x085c, 0x085d,
- 0x085f, 0x08ff,
+ 0x085f, 0x089f,
+ 0x08a1, 0x08a1,
+ 0x08ad, 0x08e3,
+ 0x08ff, 0x08ff,
0x0978, 0x0978,
0x0980, 0x0980,
0x0984, 0x0984,
@@ -14499,7 +18218,6 @@ static const OnigCodePoint CR_Unknown[] = {
0x0ace, 0x0acf,
0x0ad1, 0x0adf,
0x0ae4, 0x0ae5,
- 0x0af0, 0x0af0,
0x0af2, 0x0b00,
0x0b04, 0x0b04,
0x0b0d, 0x0b0e,
@@ -14600,15 +18318,16 @@ static const OnigCodePoint CR_Unknown[] = {
0x0ec7, 0x0ec7,
0x0ece, 0x0ecf,
0x0eda, 0x0edb,
- 0x0ede, 0x0eff,
+ 0x0ee0, 0x0eff,
0x0f48, 0x0f48,
0x0f6d, 0x0f70,
0x0f98, 0x0f98,
0x0fbd, 0x0fbd,
0x0fcd, 0x0fcd,
0x0fdb, 0x0fff,
- 0x10c6, 0x10cf,
- 0x10fd, 0x10ff,
+ 0x10c6, 0x10c6,
+ 0x10c8, 0x10cc,
+ 0x10ce, 0x10cf,
0x1249, 0x1249,
0x124e, 0x124f,
0x1257, 0x1257,
@@ -14662,13 +18381,12 @@ static const OnigCodePoint CR_Unknown[] = {
0x1aae, 0x1aff,
0x1b4c, 0x1b4f,
0x1b7d, 0x1b7f,
- 0x1bab, 0x1bad,
- 0x1bba, 0x1bbf,
0x1bf4, 0x1bfb,
0x1c38, 0x1c3a,
0x1c4a, 0x1c4c,
- 0x1c80, 0x1ccf,
- 0x1cf3, 0x1cff,
+ 0x1c80, 0x1cbf,
+ 0x1cc8, 0x1ccf,
+ 0x1cf7, 0x1cff,
0x1de7, 0x1dfb,
0x1f16, 0x1f17,
0x1f1e, 0x1f1f,
@@ -14697,15 +18415,15 @@ static const OnigCodePoint CR_Unknown[] = {
0x2427, 0x243f,
0x244b, 0x245f,
0x2700, 0x2700,
- 0x27cb, 0x27cb,
- 0x27cd, 0x27cd,
0x2b4d, 0x2b4f,
0x2b5a, 0x2bff,
0x2c2f, 0x2c2f,
0x2c5f, 0x2c5f,
- 0x2cf2, 0x2cf8,
- 0x2d26, 0x2d2f,
- 0x2d66, 0x2d6e,
+ 0x2cf4, 0x2cf8,
+ 0x2d26, 0x2d26,
+ 0x2d28, 0x2d2c,
+ 0x2d2e, 0x2d2f,
+ 0x2d68, 0x2d6e,
0x2d71, 0x2d7e,
0x2d97, 0x2d9f,
0x2da7, 0x2da7,
@@ -14716,7 +18434,7 @@ static const OnigCodePoint CR_Unknown[] = {
0x2dcf, 0x2dcf,
0x2dd7, 0x2dd7,
0x2ddf, 0x2ddf,
- 0x2e32, 0x2e7f,
+ 0x2e3c, 0x2e7f,
0x2e9a, 0x2e9a,
0x2ef4, 0x2eff,
0x2fd6, 0x2fef,
@@ -14731,16 +18449,15 @@ static const OnigCodePoint CR_Unknown[] = {
0x321f, 0x321f,
0x32ff, 0x32ff,
0x4db6, 0x4dbf,
- 0x9fcc, 0x9fff,
+ 0x9fcd, 0x9fff,
0xa48d, 0xa48f,
0xa4c7, 0xa4cf,
0xa62c, 0xa63f,
- 0xa674, 0xa67b,
- 0xa698, 0xa69f,
+ 0xa698, 0xa69e,
0xa6f8, 0xa6ff,
0xa78f, 0xa78f,
- 0xa792, 0xa79f,
- 0xa7aa, 0xa7f9,
+ 0xa794, 0xa79f,
+ 0xa7ab, 0xa7f7,
0xa82c, 0xa82f,
0xa83a, 0xa83f,
0xa878, 0xa87f,
@@ -14757,7 +18474,7 @@ static const OnigCodePoint CR_Unknown[] = {
0xaa5a, 0xaa5b,
0xaa7c, 0xaa7f,
0xaac3, 0xaada,
- 0xaae0, 0xab00,
+ 0xaaf7, 0xab00,
0xab07, 0xab08,
0xab0f, 0xab10,
0xab17, 0xab1f,
@@ -14768,7 +18485,6 @@ static const OnigCodePoint CR_Unknown[] = {
0xd7a4, 0xd7af,
0xd7c7, 0xd7ca,
0xd7fc, 0xf8ff,
- 0xfa2e, 0xfa2f,
0xfa6e, 0xfa6f,
0xfada, 0xfaff,
0xfb07, 0xfb12,
@@ -14830,7 +18546,9 @@ static const OnigCodePoint CR_Unknown[] = {
0x10860, 0x108ff,
0x1091c, 0x1091e,
0x1093a, 0x1093e,
- 0x10940, 0x109ff,
+ 0x10940, 0x1097f,
+ 0x109b8, 0x109bd,
+ 0x109c0, 0x109ff,
0x10a04, 0x10a04,
0x10a07, 0x10a0b,
0x10a14, 0x10a14,
@@ -14848,12 +18566,23 @@ static const OnigCodePoint CR_Unknown[] = {
0x10e7f, 0x10fff,
0x1104e, 0x11051,
0x11070, 0x1107f,
- 0x110c2, 0x11fff,
+ 0x110c2, 0x110cf,
+ 0x110e9, 0x110ef,
+ 0x110fa, 0x110ff,
+ 0x11135, 0x11135,
+ 0x11144, 0x1117f,
+ 0x111c9, 0x111cf,
+ 0x111da, 0x1167f,
+ 0x116b8, 0x116bf,
+ 0x116ca, 0x11fff,
0x1236f, 0x123ff,
0x12463, 0x1246f,
0x12474, 0x12fff,
0x1342f, 0x167ff,
- 0x16a39, 0x1afff,
+ 0x16a39, 0x16eff,
+ 0x16f45, 0x16f4f,
+ 0x16f7f, 0x16f8e,
+ 0x16fa0, 0x1afff,
0x1b002, 0x1cfff,
0x1d0f6, 0x1d0ff,
0x1d127, 0x1d128,
@@ -14881,7 +18610,41 @@ static const OnigCodePoint CR_Unknown[] = {
0x1d551, 0x1d551,
0x1d6a6, 0x1d6a7,
0x1d7cc, 0x1d7cd,
- 0x1d800, 0x1efff,
+ 0x1d800, 0x1edff,
+ 0x1ee04, 0x1ee04,
+ 0x1ee20, 0x1ee20,
+ 0x1ee23, 0x1ee23,
+ 0x1ee25, 0x1ee26,
+ 0x1ee28, 0x1ee28,
+ 0x1ee33, 0x1ee33,
+ 0x1ee38, 0x1ee38,
+ 0x1ee3a, 0x1ee3a,
+ 0x1ee3c, 0x1ee41,
+ 0x1ee43, 0x1ee46,
+ 0x1ee48, 0x1ee48,
+ 0x1ee4a, 0x1ee4a,
+ 0x1ee4c, 0x1ee4c,
+ 0x1ee50, 0x1ee50,
+ 0x1ee53, 0x1ee53,
+ 0x1ee55, 0x1ee56,
+ 0x1ee58, 0x1ee58,
+ 0x1ee5a, 0x1ee5a,
+ 0x1ee5c, 0x1ee5c,
+ 0x1ee5e, 0x1ee5e,
+ 0x1ee60, 0x1ee60,
+ 0x1ee63, 0x1ee63,
+ 0x1ee65, 0x1ee66,
+ 0x1ee6b, 0x1ee6b,
+ 0x1ee73, 0x1ee73,
+ 0x1ee78, 0x1ee78,
+ 0x1ee7d, 0x1ee7d,
+ 0x1ee7f, 0x1ee7f,
+ 0x1ee8a, 0x1ee8a,
+ 0x1ee9c, 0x1eea0,
+ 0x1eea4, 0x1eea4,
+ 0x1eeaa, 0x1eeaa,
+ 0x1eebc, 0x1eeef,
+ 0x1eef2, 0x1efff,
0x1f02c, 0x1f02f,
0x1f094, 0x1f09f,
0x1f0af, 0x1f0b0,
@@ -14890,7 +18653,7 @@ static const OnigCodePoint CR_Unknown[] = {
0x1f0e0, 0x1f0ff,
0x1f10b, 0x1f10f,
0x1f12f, 0x1f12f,
- 0x1f16a, 0x1f16f,
+ 0x1f16c, 0x1f16f,
0x1f19b, 0x1f1e5,
0x1f203, 0x1f20f,
0x1f23b, 0x1f23f,
@@ -14907,19 +18670,9 @@ static const OnigCodePoint CR_Unknown[] = {
0x1f441, 0x1f441,
0x1f4f8, 0x1f4f8,
0x1f4fd, 0x1f4ff,
- 0x1f53e, 0x1f54f,
+ 0x1f53e, 0x1f53f,
+ 0x1f544, 0x1f54f,
0x1f568, 0x1f5fa,
- 0x1f600, 0x1f600,
- 0x1f611, 0x1f611,
- 0x1f615, 0x1f615,
- 0x1f617, 0x1f617,
- 0x1f619, 0x1f619,
- 0x1f61b, 0x1f61b,
- 0x1f61f, 0x1f61f,
- 0x1f626, 0x1f627,
- 0x1f62c, 0x1f62c,
- 0x1f62e, 0x1f62f,
- 0x1f634, 0x1f634,
0x1f641, 0x1f644,
0x1f650, 0x1f67f,
0x1f6c6, 0x1f6ff,
@@ -14932,7 +18685,6 @@ static const OnigCodePoint CR_Unknown[] = {
0xe0080, 0xe00ff,
0xe01f0, 0x10ffff,
}; /* CR_Unknown */
-#endif /* USE_UNICODE_PROPERTIES */
/* 'Age_1_1': Derived Age 1.1 */
static const OnigCodePoint CR_Age_1_1[] = {
@@ -19817,554 +23569,10 @@ static const OnigCodePoint CR_Age_6_0[] = {
0xefffe, 0x10ffff,
}; /* CR_Age_6_0 */
-/* 'NEWLINE': [[:NEWLINE:]] */
-static const OnigCodePoint CR_NEWLINE[] = {
- 1,
- 0x000a, 0x000a,
-}; /* CR_NEWLINE */
-
-/* 'Alpha': [[:Alpha:]] */
-#define CR_Alpha CR_Alphabetic
-
-/* 'Blank': [[:Blank:]] */
-static const OnigCodePoint CR_Blank[] = {
- 9,
- 0x0009, 0x0009,
- 0x0020, 0x0020,
- 0x00a0, 0x00a0,
- 0x1680, 0x1680,
- 0x180e, 0x180e,
- 0x2000, 0x200a,
- 0x202f, 0x202f,
- 0x205f, 0x205f,
- 0x3000, 0x3000,
-}; /* CR_Blank */
-
-/* 'Cntrl': [[:Cntrl:]] */
-#define CR_Cntrl CR_Cc
-
-/* 'Digit': [[:Digit:]] */
-#define CR_Digit CR_Nd
-
-/* 'Graph': [[:Graph:]] */
-static const OnigCodePoint CR_Graph[] = {
- 506,
- 0x0021, 0x007e,
- 0x00a1, 0x0377,
- 0x037a, 0x037e,
- 0x0384, 0x038a,
- 0x038c, 0x038c,
- 0x038e, 0x03a1,
- 0x03a3, 0x0527,
- 0x0531, 0x0556,
- 0x0559, 0x055f,
- 0x0561, 0x0587,
- 0x0589, 0x058a,
- 0x0591, 0x05c7,
- 0x05d0, 0x05ea,
- 0x05f0, 0x05f4,
- 0x0600, 0x0603,
- 0x0606, 0x061b,
- 0x061e, 0x070d,
- 0x070f, 0x074a,
- 0x074d, 0x07b1,
- 0x07c0, 0x07fa,
- 0x0800, 0x082d,
- 0x0830, 0x083e,
- 0x0840, 0x085b,
- 0x085e, 0x085e,
- 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, 0x0aef,
- 0x0af1, 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, 0x0edd,
- 0x0f00, 0x0f47,
- 0x0f49, 0x0f6c,
- 0x0f71, 0x0f97,
- 0x0f99, 0x0fbc,
- 0x0fbe, 0x0fcc,
- 0x0fce, 0x0fda,
- 0x1000, 0x10c5,
- 0x10d0, 0x10fc,
- 0x1100, 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, 0x167f,
- 0x1681, 0x169c,
- 0x16a0, 0x16f0,
- 0x1700, 0x170c,
- 0x170e, 0x1714,
- 0x1720, 0x1736,
- 0x1740, 0x1753,
- 0x1760, 0x176c,
- 0x176e, 0x1770,
- 0x1772, 0x1773,
- 0x1780, 0x17dd,
- 0x17e0, 0x17e9,
- 0x17f0, 0x17f9,
- 0x1800, 0x180d,
- 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, 0x1baa,
- 0x1bae, 0x1bb9,
- 0x1bc0, 0x1bf3,
- 0x1bfc, 0x1c37,
- 0x1c3b, 0x1c49,
- 0x1c4d, 0x1c7f,
- 0x1cd0, 0x1cf2,
- 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,
- 0x200b, 0x2027,
- 0x202a, 0x202e,
- 0x2030, 0x205e,
- 0x2060, 0x2064,
- 0x206a, 0x2071,
- 0x2074, 0x208e,
- 0x2090, 0x209c,
- 0x20a0, 0x20b9,
- 0x20d0, 0x20f0,
- 0x2100, 0x2189,
- 0x2190, 0x23f3,
- 0x2400, 0x2426,
- 0x2440, 0x244a,
- 0x2460, 0x26ff,
- 0x2701, 0x27ca,
- 0x27cc, 0x27cc,
- 0x27ce, 0x2b4c,
- 0x2b50, 0x2b59,
- 0x2c00, 0x2c2e,
- 0x2c30, 0x2c5e,
- 0x2c60, 0x2cf1,
- 0x2cf9, 0x2d25,
- 0x2d30, 0x2d65,
- 0x2d6f, 0x2d70,
- 0x2d7f, 0x2d96,
- 0x2da0, 0x2da6,
- 0x2da8, 0x2dae,
- 0x2db0, 0x2db6,
- 0x2db8, 0x2dbe,
- 0x2dc0, 0x2dc6,
- 0x2dc8, 0x2dce,
- 0x2dd0, 0x2dd6,
- 0x2dd8, 0x2dde,
- 0x2de0, 0x2e31,
- 0x2e80, 0x2e99,
- 0x2e9b, 0x2ef3,
- 0x2f00, 0x2fd5,
- 0x2ff0, 0x2ffb,
- 0x3001, 0x303f,
- 0x3041, 0x3096,
- 0x3099, 0x30ff,
- 0x3105, 0x312d,
- 0x3131, 0x318e,
- 0x3190, 0x31ba,
- 0x31c0, 0x31e3,
- 0x31f0, 0x321e,
- 0x3220, 0x32fe,
- 0x3300, 0x4db5,
- 0x4dc0, 0x9fcb,
- 0xa000, 0xa48c,
- 0xa490, 0xa4c6,
- 0xa4d0, 0xa62b,
- 0xa640, 0xa673,
- 0xa67c, 0xa697,
- 0xa6a0, 0xa6f7,
- 0xa700, 0xa78e,
- 0xa790, 0xa791,
- 0xa7a0, 0xa7a9,
- 0xa7fa, 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, 0xaadf,
- 0xab01, 0xab06,
- 0xab09, 0xab0e,
- 0xab11, 0xab16,
- 0xab20, 0xab26,
- 0xab28, 0xab2e,
- 0xabc0, 0xabed,
- 0xabf0, 0xabf9,
- 0xac00, 0xd7a3,
- 0xd7b0, 0xd7c6,
- 0xd7cb, 0xd7fb,
- 0xe000, 0xfa2d,
- 0xfa30, 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,
- 0xfdf0, 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, 0xfffd,
- 0x10000, 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,
- 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,
- 0x12000, 0x1236e,
- 0x12400, 0x12462,
- 0x12470, 0x12473,
- 0x13000, 0x1342e,
- 0x16800, 0x16a38,
- 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,
- 0x1f000, 0x1f02b,
- 0x1f030, 0x1f093,
- 0x1f0a0, 0x1f0ae,
- 0x1f0b1, 0x1f0be,
- 0x1f0c1, 0x1f0cf,
- 0x1f0d1, 0x1f0df,
- 0x1f100, 0x1f10a,
- 0x1f110, 0x1f12e,
- 0x1f130, 0x1f169,
- 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,
- 0x1f550, 0x1f567,
- 0x1f5fb, 0x1f5ff,
- 0x1f601, 0x1f610,
- 0x1f612, 0x1f614,
- 0x1f616, 0x1f616,
- 0x1f618, 0x1f618,
- 0x1f61a, 0x1f61a,
- 0x1f61c, 0x1f61e,
- 0x1f620, 0x1f625,
- 0x1f628, 0x1f62b,
- 0x1f62d, 0x1f62d,
- 0x1f630, 0x1f633,
- 0x1f635, 0x1f640,
- 0x1f645, 0x1f64f,
- 0x1f680, 0x1f6c5,
- 0x1f700, 0x1f773,
- 0x20000, 0x2a6d6,
- 0x2a700, 0x2b734,
- 0x2b740, 0x2b81d,
- 0x2f800, 0x2fa1d,
- 0xe0001, 0xe0001,
- 0xe0020, 0xe007f,
- 0xe0100, 0xe01ef,
- 0xf0000, 0xffffd,
- 0x100000, 0x10fffd,
-}; /* CR_Graph */
-
-/* 'Lower': [[:Lower:]] */
-#define CR_Lower CR_Lowercase
-
-/* 'Print': [[:Print:]] */
-static const OnigCodePoint CR_Print[] = {
- 503,
- 0x0020, 0x007e,
- 0x00a0, 0x0377,
+/* 'Age_6_1': Derived Age 6.1 */
+static const OnigCodePoint CR_Age_6_1[] = {
+ 549,
+ 0x0000, 0x0377,
0x037a, 0x037e,
0x0384, 0x038a,
0x038c, 0x038c,
@@ -20374,10 +23582,11 @@ static const OnigCodePoint CR_Print[] = {
0x0559, 0x055f,
0x0561, 0x0587,
0x0589, 0x058a,
+ 0x058f, 0x058f,
0x0591, 0x05c7,
0x05d0, 0x05ea,
0x05f0, 0x05f4,
- 0x0600, 0x0603,
+ 0x0600, 0x0604,
0x0606, 0x061b,
0x061e, 0x070d,
0x070f, 0x074a,
@@ -20387,6 +23596,9 @@ static const OnigCodePoint CR_Print[] = {
0x0830, 0x083e,
0x0840, 0x085b,
0x085e, 0x085e,
+ 0x08a0, 0x08a0,
+ 0x08a2, 0x08ac,
+ 0x08e4, 0x08fe,
0x0900, 0x0977,
0x0979, 0x097f,
0x0981, 0x0983,
@@ -20431,8 +23643,7 @@ static const OnigCodePoint CR_Print[] = {
0x0acb, 0x0acd,
0x0ad0, 0x0ad0,
0x0ae0, 0x0ae3,
- 0x0ae6, 0x0aef,
- 0x0af1, 0x0af1,
+ 0x0ae6, 0x0af1,
0x0b01, 0x0b03,
0x0b05, 0x0b0c,
0x0b0f, 0x0b10,
@@ -20532,7 +23743,7 @@ static const OnigCodePoint CR_Print[] = {
0x0ec6, 0x0ec6,
0x0ec8, 0x0ecd,
0x0ed0, 0x0ed9,
- 0x0edc, 0x0edd,
+ 0x0edc, 0x0edf,
0x0f00, 0x0f47,
0x0f49, 0x0f6c,
0x0f71, 0x0f97,
@@ -20540,8 +23751,9 @@ static const OnigCodePoint CR_Print[] = {
0x0fbe, 0x0fcc,
0x0fce, 0x0fda,
0x1000, 0x10c5,
- 0x10d0, 0x10fc,
- 0x1100, 0x1248,
+ 0x10c7, 0x10c7,
+ 0x10cd, 0x10cd,
+ 0x10d0, 0x1248,
0x124a, 0x124d,
0x1250, 0x1256,
0x1258, 0x1258,
@@ -20594,13 +23806,12 @@ static const OnigCodePoint CR_Print[] = {
0x1aa0, 0x1aad,
0x1b00, 0x1b4b,
0x1b50, 0x1b7c,
- 0x1b80, 0x1baa,
- 0x1bae, 0x1bb9,
- 0x1bc0, 0x1bf3,
+ 0x1b80, 0x1bf3,
0x1bfc, 0x1c37,
0x1c3b, 0x1c49,
0x1c4d, 0x1c7f,
- 0x1cd0, 0x1cf2,
+ 0x1cc0, 0x1cc7,
+ 0x1cd0, 0x1cf6,
0x1d00, 0x1de6,
0x1dfc, 0x1f15,
0x1f18, 0x1f1d,
@@ -20618,8 +23829,7 @@ static const OnigCodePoint CR_Print[] = {
0x1fdd, 0x1fef,
0x1ff2, 0x1ff4,
0x1ff6, 0x1ffe,
- 0x2000, 0x2027,
- 0x202a, 0x2064,
+ 0x2000, 0x2064,
0x206a, 0x2071,
0x2074, 0x208e,
0x2090, 0x209c,
@@ -20630,15 +23840,15 @@ static const OnigCodePoint CR_Print[] = {
0x2400, 0x2426,
0x2440, 0x244a,
0x2460, 0x26ff,
- 0x2701, 0x27ca,
- 0x27cc, 0x27cc,
- 0x27ce, 0x2b4c,
+ 0x2701, 0x2b4c,
0x2b50, 0x2b59,
0x2c00, 0x2c2e,
0x2c30, 0x2c5e,
- 0x2c60, 0x2cf1,
+ 0x2c60, 0x2cf3,
0x2cf9, 0x2d25,
- 0x2d30, 0x2d65,
+ 0x2d27, 0x2d27,
+ 0x2d2d, 0x2d2d,
+ 0x2d30, 0x2d67,
0x2d6f, 0x2d70,
0x2d7f, 0x2d96,
0x2da0, 0x2da6,
@@ -20649,7 +23859,7 @@ static const OnigCodePoint CR_Print[] = {
0x2dc8, 0x2dce,
0x2dd0, 0x2dd6,
0x2dd8, 0x2dde,
- 0x2de0, 0x2e31,
+ 0x2de0, 0x2e3b,
0x2e80, 0x2e99,
0x2e9b, 0x2ef3,
0x2f00, 0x2fd5,
@@ -20664,17 +23874,16 @@ static const OnigCodePoint CR_Print[] = {
0x31f0, 0x321e,
0x3220, 0x32fe,
0x3300, 0x4db5,
- 0x4dc0, 0x9fcb,
+ 0x4dc0, 0x9fcc,
0xa000, 0xa48c,
0xa490, 0xa4c6,
0xa4d0, 0xa62b,
- 0xa640, 0xa673,
- 0xa67c, 0xa697,
- 0xa6a0, 0xa6f7,
+ 0xa640, 0xa697,
+ 0xa69f, 0xa6f7,
0xa700, 0xa78e,
- 0xa790, 0xa791,
- 0xa7a0, 0xa7a9,
- 0xa7fa, 0xa82b,
+ 0xa790, 0xa793,
+ 0xa7a0, 0xa7aa,
+ 0xa7f8, 0xa82b,
0xa830, 0xa839,
0xa840, 0xa877,
0xa880, 0xa8c4,
@@ -20690,7 +23899,7 @@ static const OnigCodePoint CR_Print[] = {
0xaa50, 0xaa59,
0xaa5c, 0xaa7b,
0xaa80, 0xaac2,
- 0xaadb, 0xaadf,
+ 0xaadb, 0xaaf6,
0xab01, 0xab06,
0xab09, 0xab0e,
0xab11, 0xab16,
@@ -20701,8 +23910,7 @@ static const OnigCodePoint CR_Print[] = {
0xac00, 0xd7a3,
0xd7b0, 0xd7c6,
0xd7cb, 0xd7fb,
- 0xe000, 0xfa2d,
- 0xfa30, 0xfa6d,
+ 0xd800, 0xfa6d,
0xfa70, 0xfad9,
0xfb00, 0xfb06,
0xfb13, 0xfb17,
@@ -20715,7 +23923,7 @@ static const OnigCodePoint CR_Print[] = {
0xfbd3, 0xfd3f,
0xfd50, 0xfd8f,
0xfd92, 0xfdc7,
- 0xfdf0, 0xfdfd,
+ 0xfdd0, 0xfdfd,
0xfe00, 0xfe19,
0xfe20, 0xfe26,
0xfe30, 0xfe52,
@@ -20731,8 +23939,7 @@ static const OnigCodePoint CR_Print[] = {
0xffda, 0xffdc,
0xffe0, 0xffe6,
0xffe8, 0xffee,
- 0xfff9, 0xfffd,
- 0x10000, 0x1000b,
+ 0xfff9, 0x1000b,
0x1000d, 0x10026,
0x10028, 0x1003a,
0x1003c, 0x1003d,
@@ -20764,6 +23971,8 @@ static const OnigCodePoint CR_Print[] = {
0x10900, 0x1091b,
0x1091f, 0x10939,
0x1093f, 0x1093f,
+ 0x10980, 0x109b7,
+ 0x109be, 0x109bf,
0x10a00, 0x10a03,
0x10a05, 0x10a06,
0x10a0c, 0x10a13,
@@ -20782,11 +23991,22 @@ static const OnigCodePoint CR_Print[] = {
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,
@@ -20815,6 +24035,40 @@ static const OnigCodePoint CR_Print[] = {
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,
@@ -20823,7 +24077,7 @@ static const OnigCodePoint CR_Print[] = {
0x1f0d1, 0x1f0df,
0x1f100, 0x1f10a,
0x1f110, 0x1f12e,
- 0x1f130, 0x1f169,
+ 0x1f130, 0x1f16b,
0x1f170, 0x1f19a,
0x1f1e6, 0x1f202,
0x1f210, 0x1f23a,
@@ -20841,1083 +24095,1368 @@ static const OnigCodePoint CR_Print[] = {
0x1f442, 0x1f4f7,
0x1f4f9, 0x1f4fc,
0x1f500, 0x1f53d,
+ 0x1f540, 0x1f543,
0x1f550, 0x1f567,
- 0x1f5fb, 0x1f5ff,
- 0x1f601, 0x1f610,
- 0x1f612, 0x1f614,
- 0x1f616, 0x1f616,
- 0x1f618, 0x1f618,
- 0x1f61a, 0x1f61a,
- 0x1f61c, 0x1f61e,
- 0x1f620, 0x1f625,
- 0x1f628, 0x1f62b,
- 0x1f62d, 0x1f62d,
- 0x1f630, 0x1f633,
- 0x1f635, 0x1f640,
+ 0x1f5fb, 0x1f640,
0x1f645, 0x1f64f,
0x1f680, 0x1f6c5,
0x1f700, 0x1f773,
- 0x20000, 0x2a6d6,
+ 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,
- 0xf0000, 0xffffd,
- 0x100000, 0x10fffd,
-}; /* CR_Print */
+ 0xefffe, 0x10ffff,
+}; /* CR_Age_6_1 */
-/* 'Punct': [[:Punct:]] */
-#define CR_Punct CR_P
+/* 'In_Basic_Latin': Block */
+#define CR_In_Basic_Latin CR_ASCII
-/* 'Space': [[:Space:]] */
-#define CR_Space CR_White_Space
+/* 'In_Latin_1_Supplement': Block */
+static const OnigCodePoint CR_In_Latin_1_Supplement[] = {
+ 1,
+ 0x0080, 0x00ff,
+}; /* CR_In_Latin_1_Supplement */
-/* 'Upper': [[:Upper:]] */
-#define CR_Upper CR_Uppercase
+/* 'In_Latin_Extended_A': Block */
+static const OnigCodePoint CR_In_Latin_Extended_A[] = {
+ 1,
+ 0x0100, 0x017f,
+}; /* CR_In_Latin_Extended_A */
-/* 'XDigit': [[:XDigit:]] */
-#define CR_XDigit CR_ASCII_Hex_Digit
+/* 'In_Latin_Extended_B': Block */
+static const OnigCodePoint CR_In_Latin_Extended_B[] = {
+ 1,
+ 0x0180, 0x024f,
+}; /* CR_In_Latin_Extended_B */
-/* 'Word': [[:Word:]] */
-static const OnigCodePoint CR_Word[] = {
- 514,
- 0x0030, 0x0039,
- 0x0041, 0x005a,
- 0x005f, 0x005f,
- 0x0061, 0x007a,
- 0x00aa, 0x00aa,
- 0x00b5, 0x00b5,
- 0x00ba, 0x00ba,
- 0x00c0, 0x00d6,
- 0x00d8, 0x00f6,
- 0x00f8, 0x02c1,
- 0x02c6, 0x02d1,
- 0x02e0, 0x02e4,
- 0x02ec, 0x02ec,
- 0x02ee, 0x02ee,
- 0x0300, 0x0374,
- 0x0376, 0x0377,
- 0x037a, 0x037d,
- 0x0386, 0x0386,
- 0x0388, 0x038a,
- 0x038c, 0x038c,
- 0x038e, 0x03a1,
- 0x03a3, 0x03f5,
- 0x03f7, 0x0481,
- 0x0483, 0x0527,
- 0x0531, 0x0556,
- 0x0559, 0x0559,
- 0x0561, 0x0587,
- 0x0591, 0x05bd,
- 0x05bf, 0x05bf,
- 0x05c1, 0x05c2,
- 0x05c4, 0x05c5,
- 0x05c7, 0x05c7,
- 0x05d0, 0x05ea,
- 0x05f0, 0x05f2,
- 0x0610, 0x061a,
- 0x0620, 0x0669,
- 0x066e, 0x06d3,
- 0x06d5, 0x06dc,
- 0x06df, 0x06e8,
- 0x06ea, 0x06fc,
- 0x06ff, 0x06ff,
- 0x0710, 0x074a,
- 0x074d, 0x07b1,
- 0x07c0, 0x07f5,
- 0x07fa, 0x07fa,
- 0x0800, 0x082d,
- 0x0840, 0x085b,
- 0x0900, 0x0963,
- 0x0966, 0x096f,
- 0x0971, 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, 0x09f1,
- 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, 0x0aef,
- 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, 0x0b6f,
- 0x0b71, 0x0b71,
- 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, 0x0bef,
- 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,
- 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, 0x0d6f,
- 0x0d7a, 0x0d7f,
- 0x0d82, 0x0d83,
- 0x0d85, 0x0d96,
- 0x0d9a, 0x0db1,
- 0x0db3, 0x0dbb,
- 0x0dbd, 0x0dbd,
- 0x0dc0, 0x0dc6,
- 0x0dca, 0x0dca,
- 0x0dcf, 0x0dd4,
- 0x0dd6, 0x0dd6,
- 0x0dd8, 0x0ddf,
- 0x0df2, 0x0df3,
- 0x0e01, 0x0e3a,
- 0x0e40, 0x0e4e,
- 0x0e50, 0x0e59,
- 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, 0x0edd,
- 0x0f00, 0x0f00,
- 0x0f18, 0x0f19,
- 0x0f20, 0x0f29,
- 0x0f35, 0x0f35,
- 0x0f37, 0x0f37,
- 0x0f39, 0x0f39,
- 0x0f3e, 0x0f47,
- 0x0f49, 0x0f6c,
- 0x0f71, 0x0f84,
- 0x0f86, 0x0f97,
- 0x0f99, 0x0fbc,
- 0x0fc6, 0x0fc6,
- 0x1000, 0x1049,
- 0x1050, 0x109d,
- 0x10a0, 0x10c5,
- 0x10d0, 0x10fa,
- 0x10fc, 0x10fc,
- 0x1100, 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, 0x135f,
- 0x1380, 0x138f,
- 0x13a0, 0x13f4,
- 0x1401, 0x166c,
- 0x166f, 0x167f,
- 0x1681, 0x169a,
- 0x16a0, 0x16ea,
- 0x16ee, 0x16f0,
- 0x1700, 0x170c,
- 0x170e, 0x1714,
- 0x1720, 0x1734,
- 0x1740, 0x1753,
- 0x1760, 0x176c,
- 0x176e, 0x1770,
- 0x1772, 0x1773,
- 0x1780, 0x17b3,
- 0x17b6, 0x17d3,
- 0x17d7, 0x17d7,
- 0x17dc, 0x17dd,
- 0x17e0, 0x17e9,
- 0x180b, 0x180d,
- 0x1810, 0x1819,
- 0x1820, 0x1877,
- 0x1880, 0x18aa,
- 0x18b0, 0x18f5,
- 0x1900, 0x191c,
- 0x1920, 0x192b,
- 0x1930, 0x193b,
- 0x1946, 0x196d,
- 0x1970, 0x1974,
- 0x1980, 0x19ab,
- 0x19b0, 0x19c9,
- 0x19d0, 0x19d9,
- 0x1a00, 0x1a1b,
- 0x1a20, 0x1a5e,
- 0x1a60, 0x1a7c,
- 0x1a7f, 0x1a89,
- 0x1a90, 0x1a99,
- 0x1aa7, 0x1aa7,
- 0x1b00, 0x1b4b,
- 0x1b50, 0x1b59,
- 0x1b6b, 0x1b73,
- 0x1b80, 0x1baa,
- 0x1bae, 0x1bb9,
- 0x1bc0, 0x1bf3,
- 0x1c00, 0x1c37,
- 0x1c40, 0x1c49,
- 0x1c4d, 0x1c7d,
- 0x1cd0, 0x1cd2,
- 0x1cd4, 0x1cf2,
- 0x1d00, 0x1de6,
- 0x1dfc, 0x1f15,
- 0x1f18, 0x1f1d,
- 0x1f20, 0x1f45,
- 0x1f48, 0x1f4d,
- 0x1f50, 0x1f57,
- 0x1f59, 0x1f59,
- 0x1f5b, 0x1f5b,
- 0x1f5d, 0x1f5d,
- 0x1f5f, 0x1f7d,
- 0x1f80, 0x1fb4,
- 0x1fb6, 0x1fbc,
- 0x1fbe, 0x1fbe,
- 0x1fc2, 0x1fc4,
- 0x1fc6, 0x1fcc,
- 0x1fd0, 0x1fd3,
- 0x1fd6, 0x1fdb,
- 0x1fe0, 0x1fec,
- 0x1ff2, 0x1ff4,
- 0x1ff6, 0x1ffc,
- 0x203f, 0x2040,
- 0x2054, 0x2054,
- 0x2071, 0x2071,
- 0x207f, 0x207f,
- 0x2090, 0x209c,
- 0x20d0, 0x20f0,
- 0x2102, 0x2102,
- 0x2107, 0x2107,
- 0x210a, 0x2113,
- 0x2115, 0x2115,
- 0x2119, 0x211d,
- 0x2124, 0x2124,
- 0x2126, 0x2126,
- 0x2128, 0x2128,
- 0x212a, 0x212d,
- 0x212f, 0x2139,
- 0x213c, 0x213f,
- 0x2145, 0x2149,
- 0x214e, 0x214e,
- 0x2160, 0x2188,
- 0x24b6, 0x24e9,
- 0x2c00, 0x2c2e,
- 0x2c30, 0x2c5e,
- 0x2c60, 0x2ce4,
- 0x2ceb, 0x2cf1,
- 0x2d00, 0x2d25,
- 0x2d30, 0x2d65,
- 0x2d6f, 0x2d6f,
- 0x2d7f, 0x2d96,
- 0x2da0, 0x2da6,
- 0x2da8, 0x2dae,
- 0x2db0, 0x2db6,
- 0x2db8, 0x2dbe,
- 0x2dc0, 0x2dc6,
- 0x2dc8, 0x2dce,
- 0x2dd0, 0x2dd6,
- 0x2dd8, 0x2dde,
+/* 'In_IPA_Extensions': Block */
+static const OnigCodePoint CR_In_IPA_Extensions[] = {
+ 1,
+ 0x0250, 0x02af,
+}; /* CR_In_IPA_Extensions */
+
+/* 'In_Spacing_Modifier_Letters': Block */
+static const OnigCodePoint CR_In_Spacing_Modifier_Letters[] = {
+ 1,
+ 0x02b0, 0x02ff,
+}; /* CR_In_Spacing_Modifier_Letters */
+
+/* 'In_Combining_Diacritical_Marks': Block */
+static const OnigCodePoint CR_In_Combining_Diacritical_Marks[] = {
+ 1,
+ 0x0300, 0x036f,
+}; /* CR_In_Combining_Diacritical_Marks */
+
+/* 'In_Greek_and_Coptic': Block */
+static const OnigCodePoint CR_In_Greek_and_Coptic[] = {
+ 1,
+ 0x0370, 0x03ff,
+}; /* CR_In_Greek_and_Coptic */
+
+/* 'In_Cyrillic': Block */
+static const OnigCodePoint CR_In_Cyrillic[] = {
+ 1,
+ 0x0400, 0x04ff,
+}; /* CR_In_Cyrillic */
+
+/* 'In_Cyrillic_Supplement': Block */
+static const OnigCodePoint CR_In_Cyrillic_Supplement[] = {
+ 1,
+ 0x0500, 0x052f,
+}; /* CR_In_Cyrillic_Supplement */
+
+/* 'In_Armenian': Block */
+static const OnigCodePoint CR_In_Armenian[] = {
+ 1,
+ 0x0530, 0x058f,
+}; /* CR_In_Armenian */
+
+/* 'In_Hebrew': Block */
+static const OnigCodePoint CR_In_Hebrew[] = {
+ 1,
+ 0x0590, 0x05ff,
+}; /* CR_In_Hebrew */
+
+/* 'In_Arabic': Block */
+static const OnigCodePoint CR_In_Arabic[] = {
+ 1,
+ 0x0600, 0x06ff,
+}; /* CR_In_Arabic */
+
+/* 'In_Syriac': Block */
+static const OnigCodePoint CR_In_Syriac[] = {
+ 1,
+ 0x0700, 0x074f,
+}; /* CR_In_Syriac */
+
+/* 'In_Arabic_Supplement': Block */
+static const OnigCodePoint CR_In_Arabic_Supplement[] = {
+ 1,
+ 0x0750, 0x077f,
+}; /* CR_In_Arabic_Supplement */
+
+/* 'In_Thaana': Block */
+static const OnigCodePoint CR_In_Thaana[] = {
+ 1,
+ 0x0780, 0x07bf,
+}; /* CR_In_Thaana */
+
+/* 'In_NKo': Block */
+static const OnigCodePoint CR_In_NKo[] = {
+ 1,
+ 0x07c0, 0x07ff,
+}; /* CR_In_NKo */
+
+/* 'In_Samaritan': Block */
+static const OnigCodePoint CR_In_Samaritan[] = {
+ 1,
+ 0x0800, 0x083f,
+}; /* CR_In_Samaritan */
+
+/* 'In_Mandaic': Block */
+static const OnigCodePoint CR_In_Mandaic[] = {
+ 1,
+ 0x0840, 0x085f,
+}; /* CR_In_Mandaic */
+
+/* 'In_Arabic_Extended_A': Block */
+static const OnigCodePoint CR_In_Arabic_Extended_A[] = {
+ 1,
+ 0x08a0, 0x08ff,
+}; /* CR_In_Arabic_Extended_A */
+
+/* 'In_Devanagari': Block */
+static const OnigCodePoint CR_In_Devanagari[] = {
+ 1,
+ 0x0900, 0x097f,
+}; /* CR_In_Devanagari */
+
+/* 'In_Bengali': Block */
+static const OnigCodePoint CR_In_Bengali[] = {
+ 1,
+ 0x0980, 0x09ff,
+}; /* CR_In_Bengali */
+
+/* 'In_Gurmukhi': Block */
+static const OnigCodePoint CR_In_Gurmukhi[] = {
+ 1,
+ 0x0a00, 0x0a7f,
+}; /* CR_In_Gurmukhi */
+
+/* 'In_Gujarati': Block */
+static const OnigCodePoint CR_In_Gujarati[] = {
+ 1,
+ 0x0a80, 0x0aff,
+}; /* CR_In_Gujarati */
+
+/* 'In_Oriya': Block */
+static const OnigCodePoint CR_In_Oriya[] = {
+ 1,
+ 0x0b00, 0x0b7f,
+}; /* CR_In_Oriya */
+
+/* 'In_Tamil': Block */
+static const OnigCodePoint CR_In_Tamil[] = {
+ 1,
+ 0x0b80, 0x0bff,
+}; /* CR_In_Tamil */
+
+/* 'In_Telugu': Block */
+static const OnigCodePoint CR_In_Telugu[] = {
+ 1,
+ 0x0c00, 0x0c7f,
+}; /* CR_In_Telugu */
+
+/* 'In_Kannada': Block */
+static const OnigCodePoint CR_In_Kannada[] = {
+ 1,
+ 0x0c80, 0x0cff,
+}; /* CR_In_Kannada */
+
+/* 'In_Malayalam': Block */
+static const OnigCodePoint CR_In_Malayalam[] = {
+ 1,
+ 0x0d00, 0x0d7f,
+}; /* CR_In_Malayalam */
+
+/* 'In_Sinhala': Block */
+static const OnigCodePoint CR_In_Sinhala[] = {
+ 1,
+ 0x0d80, 0x0dff,
+}; /* CR_In_Sinhala */
+
+/* 'In_Thai': Block */
+static const OnigCodePoint CR_In_Thai[] = {
+ 1,
+ 0x0e00, 0x0e7f,
+}; /* CR_In_Thai */
+
+/* 'In_Lao': Block */
+static const OnigCodePoint CR_In_Lao[] = {
+ 1,
+ 0x0e80, 0x0eff,
+}; /* CR_In_Lao */
+
+/* 'In_Tibetan': Block */
+static const OnigCodePoint CR_In_Tibetan[] = {
+ 1,
+ 0x0f00, 0x0fff,
+}; /* CR_In_Tibetan */
+
+/* 'In_Myanmar': Block */
+static const OnigCodePoint CR_In_Myanmar[] = {
+ 1,
+ 0x1000, 0x109f,
+}; /* CR_In_Myanmar */
+
+/* 'In_Georgian': Block */
+static const OnigCodePoint CR_In_Georgian[] = {
+ 1,
+ 0x10a0, 0x10ff,
+}; /* CR_In_Georgian */
+
+/* 'In_Hangul_Jamo': Block */
+static const OnigCodePoint CR_In_Hangul_Jamo[] = {
+ 1,
+ 0x1100, 0x11ff,
+}; /* CR_In_Hangul_Jamo */
+
+/* 'In_Ethiopic': Block */
+static const OnigCodePoint CR_In_Ethiopic[] = {
+ 1,
+ 0x1200, 0x137f,
+}; /* CR_In_Ethiopic */
+
+/* 'In_Ethiopic_Supplement': Block */
+static const OnigCodePoint CR_In_Ethiopic_Supplement[] = {
+ 1,
+ 0x1380, 0x139f,
+}; /* CR_In_Ethiopic_Supplement */
+
+/* 'In_Cherokee': Block */
+static const OnigCodePoint CR_In_Cherokee[] = {
+ 1,
+ 0x13a0, 0x13ff,
+}; /* CR_In_Cherokee */
+
+/* 'In_Unified_Canadian_Aboriginal_Syllabics': Block */
+static const OnigCodePoint CR_In_Unified_Canadian_Aboriginal_Syllabics[] = {
+ 1,
+ 0x1400, 0x167f,
+}; /* CR_In_Unified_Canadian_Aboriginal_Syllabics */
+
+/* 'In_Ogham': Block */
+static const OnigCodePoint CR_In_Ogham[] = {
+ 1,
+ 0x1680, 0x169f,
+}; /* CR_In_Ogham */
+
+/* 'In_Runic': Block */
+static const OnigCodePoint CR_In_Runic[] = {
+ 1,
+ 0x16a0, 0x16ff,
+}; /* CR_In_Runic */
+
+/* 'In_Tagalog': Block */
+static const OnigCodePoint CR_In_Tagalog[] = {
+ 1,
+ 0x1700, 0x171f,
+}; /* CR_In_Tagalog */
+
+/* 'In_Hanunoo': Block */
+static const OnigCodePoint CR_In_Hanunoo[] = {
+ 1,
+ 0x1720, 0x173f,
+}; /* CR_In_Hanunoo */
+
+/* 'In_Buhid': Block */
+static const OnigCodePoint CR_In_Buhid[] = {
+ 1,
+ 0x1740, 0x175f,
+}; /* CR_In_Buhid */
+
+/* 'In_Tagbanwa': Block */
+static const OnigCodePoint CR_In_Tagbanwa[] = {
+ 1,
+ 0x1760, 0x177f,
+}; /* CR_In_Tagbanwa */
+
+/* 'In_Khmer': Block */
+static const OnigCodePoint CR_In_Khmer[] = {
+ 1,
+ 0x1780, 0x17ff,
+}; /* CR_In_Khmer */
+
+/* 'In_Mongolian': Block */
+static const OnigCodePoint CR_In_Mongolian[] = {
+ 1,
+ 0x1800, 0x18af,
+}; /* CR_In_Mongolian */
+
+/* 'In_Unified_Canadian_Aboriginal_Syllabics_Extended': Block */
+static const OnigCodePoint CR_In_Unified_Canadian_Aboriginal_Syllabics_Extended[] = {
+ 1,
+ 0x18b0, 0x18ff,
+}; /* CR_In_Unified_Canadian_Aboriginal_Syllabics_Extended */
+
+/* 'In_Limbu': Block */
+static const OnigCodePoint CR_In_Limbu[] = {
+ 1,
+ 0x1900, 0x194f,
+}; /* CR_In_Limbu */
+
+/* 'In_Tai_Le': Block */
+static const OnigCodePoint CR_In_Tai_Le[] = {
+ 1,
+ 0x1950, 0x197f,
+}; /* CR_In_Tai_Le */
+
+/* 'In_New_Tai_Lue': Block */
+static const OnigCodePoint CR_In_New_Tai_Lue[] = {
+ 1,
+ 0x1980, 0x19df,
+}; /* CR_In_New_Tai_Lue */
+
+/* 'In_Khmer_Symbols': Block */
+static const OnigCodePoint CR_In_Khmer_Symbols[] = {
+ 1,
+ 0x19e0, 0x19ff,
+}; /* CR_In_Khmer_Symbols */
+
+/* 'In_Buginese': Block */
+static const OnigCodePoint CR_In_Buginese[] = {
+ 1,
+ 0x1a00, 0x1a1f,
+}; /* CR_In_Buginese */
+
+/* 'In_Tai_Tham': Block */
+static const OnigCodePoint CR_In_Tai_Tham[] = {
+ 1,
+ 0x1a20, 0x1aaf,
+}; /* CR_In_Tai_Tham */
+
+/* 'In_Balinese': Block */
+static const OnigCodePoint CR_In_Balinese[] = {
+ 1,
+ 0x1b00, 0x1b7f,
+}; /* CR_In_Balinese */
+
+/* 'In_Sundanese': Block */
+static const OnigCodePoint CR_In_Sundanese[] = {
+ 1,
+ 0x1b80, 0x1bbf,
+}; /* CR_In_Sundanese */
+
+/* 'In_Batak': Block */
+static const OnigCodePoint CR_In_Batak[] = {
+ 1,
+ 0x1bc0, 0x1bff,
+}; /* CR_In_Batak */
+
+/* 'In_Lepcha': Block */
+static const OnigCodePoint CR_In_Lepcha[] = {
+ 1,
+ 0x1c00, 0x1c4f,
+}; /* CR_In_Lepcha */
+
+/* 'In_Ol_Chiki': Block */
+#define CR_In_Ol_Chiki CR_Ol_Chiki
+
+/* 'In_Sundanese_Supplement': Block */
+static const OnigCodePoint CR_In_Sundanese_Supplement[] = {
+ 1,
+ 0x1cc0, 0x1ccf,
+}; /* CR_In_Sundanese_Supplement */
+
+/* 'In_Vedic_Extensions': Block */
+static const OnigCodePoint CR_In_Vedic_Extensions[] = {
+ 1,
+ 0x1cd0, 0x1cff,
+}; /* CR_In_Vedic_Extensions */
+
+/* 'In_Phonetic_Extensions': Block */
+static const OnigCodePoint CR_In_Phonetic_Extensions[] = {
+ 1,
+ 0x1d00, 0x1d7f,
+}; /* CR_In_Phonetic_Extensions */
+
+/* 'In_Phonetic_Extensions_Supplement': Block */
+static const OnigCodePoint CR_In_Phonetic_Extensions_Supplement[] = {
+ 1,
+ 0x1d80, 0x1dbf,
+}; /* CR_In_Phonetic_Extensions_Supplement */
+
+/* 'In_Combining_Diacritical_Marks_Supplement': Block */
+static const OnigCodePoint CR_In_Combining_Diacritical_Marks_Supplement[] = {
+ 1,
+ 0x1dc0, 0x1dff,
+}; /* CR_In_Combining_Diacritical_Marks_Supplement */
+
+/* 'In_Latin_Extended_Additional': Block */
+static const OnigCodePoint CR_In_Latin_Extended_Additional[] = {
+ 1,
+ 0x1e00, 0x1eff,
+}; /* CR_In_Latin_Extended_Additional */
+
+/* 'In_Greek_Extended': Block */
+static const OnigCodePoint CR_In_Greek_Extended[] = {
+ 1,
+ 0x1f00, 0x1fff,
+}; /* CR_In_Greek_Extended */
+
+/* 'In_General_Punctuation': Block */
+static const OnigCodePoint CR_In_General_Punctuation[] = {
+ 1,
+ 0x2000, 0x206f,
+}; /* CR_In_General_Punctuation */
+
+/* 'In_Superscripts_and_Subscripts': Block */
+static const OnigCodePoint CR_In_Superscripts_and_Subscripts[] = {
+ 1,
+ 0x2070, 0x209f,
+}; /* CR_In_Superscripts_and_Subscripts */
+
+/* 'In_Currency_Symbols': Block */
+static const OnigCodePoint CR_In_Currency_Symbols[] = {
+ 1,
+ 0x20a0, 0x20cf,
+}; /* CR_In_Currency_Symbols */
+
+/* 'In_Combining_Diacritical_Marks_for_Symbols': Block */
+static const OnigCodePoint CR_In_Combining_Diacritical_Marks_for_Symbols[] = {
+ 1,
+ 0x20d0, 0x20ff,
+}; /* CR_In_Combining_Diacritical_Marks_for_Symbols */
+
+/* 'In_Letterlike_Symbols': Block */
+static const OnigCodePoint CR_In_Letterlike_Symbols[] = {
+ 1,
+ 0x2100, 0x214f,
+}; /* CR_In_Letterlike_Symbols */
+
+/* 'In_Number_Forms': Block */
+static const OnigCodePoint CR_In_Number_Forms[] = {
+ 1,
+ 0x2150, 0x218f,
+}; /* CR_In_Number_Forms */
+
+/* 'In_Arrows': Block */
+static const OnigCodePoint CR_In_Arrows[] = {
+ 1,
+ 0x2190, 0x21ff,
+}; /* CR_In_Arrows */
+
+/* 'In_Mathematical_Operators': Block */
+static const OnigCodePoint CR_In_Mathematical_Operators[] = {
+ 1,
+ 0x2200, 0x22ff,
+}; /* CR_In_Mathematical_Operators */
+
+/* 'In_Miscellaneous_Technical': Block */
+static const OnigCodePoint CR_In_Miscellaneous_Technical[] = {
+ 1,
+ 0x2300, 0x23ff,
+}; /* CR_In_Miscellaneous_Technical */
+
+/* 'In_Control_Pictures': Block */
+static const OnigCodePoint CR_In_Control_Pictures[] = {
+ 1,
+ 0x2400, 0x243f,
+}; /* CR_In_Control_Pictures */
+
+/* 'In_Optical_Character_Recognition': Block */
+static const OnigCodePoint CR_In_Optical_Character_Recognition[] = {
+ 1,
+ 0x2440, 0x245f,
+}; /* CR_In_Optical_Character_Recognition */
+
+/* 'In_Enclosed_Alphanumerics': Block */
+static const OnigCodePoint CR_In_Enclosed_Alphanumerics[] = {
+ 1,
+ 0x2460, 0x24ff,
+}; /* CR_In_Enclosed_Alphanumerics */
+
+/* 'In_Box_Drawing': Block */
+static const OnigCodePoint CR_In_Box_Drawing[] = {
+ 1,
+ 0x2500, 0x257f,
+}; /* CR_In_Box_Drawing */
+
+/* 'In_Block_Elements': Block */
+static const OnigCodePoint CR_In_Block_Elements[] = {
+ 1,
+ 0x2580, 0x259f,
+}; /* CR_In_Block_Elements */
+
+/* 'In_Geometric_Shapes': Block */
+static const OnigCodePoint CR_In_Geometric_Shapes[] = {
+ 1,
+ 0x25a0, 0x25ff,
+}; /* CR_In_Geometric_Shapes */
+
+/* 'In_Miscellaneous_Symbols': Block */
+static const OnigCodePoint CR_In_Miscellaneous_Symbols[] = {
+ 1,
+ 0x2600, 0x26ff,
+}; /* CR_In_Miscellaneous_Symbols */
+
+/* 'In_Dingbats': Block */
+static const OnigCodePoint CR_In_Dingbats[] = {
+ 1,
+ 0x2700, 0x27bf,
+}; /* CR_In_Dingbats */
+
+/* 'In_Miscellaneous_Mathematical_Symbols_A': Block */
+static const OnigCodePoint CR_In_Miscellaneous_Mathematical_Symbols_A[] = {
+ 1,
+ 0x27c0, 0x27ef,
+}; /* CR_In_Miscellaneous_Mathematical_Symbols_A */
+
+/* 'In_Supplemental_Arrows_A': Block */
+static const OnigCodePoint CR_In_Supplemental_Arrows_A[] = {
+ 1,
+ 0x27f0, 0x27ff,
+}; /* CR_In_Supplemental_Arrows_A */
+
+/* 'In_Braille_Patterns': Block */
+#define CR_In_Braille_Patterns CR_Braille
+
+/* 'In_Supplemental_Arrows_B': Block */
+static const OnigCodePoint CR_In_Supplemental_Arrows_B[] = {
+ 1,
+ 0x2900, 0x297f,
+}; /* CR_In_Supplemental_Arrows_B */
+
+/* 'In_Miscellaneous_Mathematical_Symbols_B': Block */
+static const OnigCodePoint CR_In_Miscellaneous_Mathematical_Symbols_B[] = {
+ 1,
+ 0x2980, 0x29ff,
+}; /* CR_In_Miscellaneous_Mathematical_Symbols_B */
+
+/* 'In_Supplemental_Mathematical_Operators': Block */
+static const OnigCodePoint CR_In_Supplemental_Mathematical_Operators[] = {
+ 1,
+ 0x2a00, 0x2aff,
+}; /* CR_In_Supplemental_Mathematical_Operators */
+
+/* 'In_Miscellaneous_Symbols_and_Arrows': Block */
+static const OnigCodePoint CR_In_Miscellaneous_Symbols_and_Arrows[] = {
+ 1,
+ 0x2b00, 0x2bff,
+}; /* CR_In_Miscellaneous_Symbols_and_Arrows */
+
+/* 'In_Glagolitic': Block */
+static const OnigCodePoint CR_In_Glagolitic[] = {
+ 1,
+ 0x2c00, 0x2c5f,
+}; /* CR_In_Glagolitic */
+
+/* 'In_Latin_Extended_C': Block */
+static const OnigCodePoint CR_In_Latin_Extended_C[] = {
+ 1,
+ 0x2c60, 0x2c7f,
+}; /* CR_In_Latin_Extended_C */
+
+/* 'In_Coptic': Block */
+static const OnigCodePoint CR_In_Coptic[] = {
+ 1,
+ 0x2c80, 0x2cff,
+}; /* CR_In_Coptic */
+
+/* 'In_Georgian_Supplement': Block */
+static const OnigCodePoint CR_In_Georgian_Supplement[] = {
+ 1,
+ 0x2d00, 0x2d2f,
+}; /* CR_In_Georgian_Supplement */
+
+/* 'In_Tifinagh': Block */
+static const OnigCodePoint CR_In_Tifinagh[] = {
+ 1,
+ 0x2d30, 0x2d7f,
+}; /* CR_In_Tifinagh */
+
+/* 'In_Ethiopic_Extended': Block */
+static const OnigCodePoint CR_In_Ethiopic_Extended[] = {
+ 1,
+ 0x2d80, 0x2ddf,
+}; /* CR_In_Ethiopic_Extended */
+
+/* 'In_Cyrillic_Extended_A': Block */
+static const OnigCodePoint CR_In_Cyrillic_Extended_A[] = {
+ 1,
0x2de0, 0x2dff,
- 0x2e2f, 0x2e2f,
- 0x3005, 0x3007,
- 0x3021, 0x302f,
- 0x3031, 0x3035,
- 0x3038, 0x303c,
- 0x3041, 0x3096,
- 0x3099, 0x309a,
- 0x309d, 0x309f,
- 0x30a1, 0x30fa,
- 0x30fc, 0x30ff,
- 0x3105, 0x312d,
- 0x3131, 0x318e,
- 0x31a0, 0x31ba,
+}; /* CR_In_Cyrillic_Extended_A */
+
+/* 'In_Supplemental_Punctuation': Block */
+static const OnigCodePoint CR_In_Supplemental_Punctuation[] = {
+ 1,
+ 0x2e00, 0x2e7f,
+}; /* CR_In_Supplemental_Punctuation */
+
+/* 'In_CJK_Radicals_Supplement': Block */
+static const OnigCodePoint CR_In_CJK_Radicals_Supplement[] = {
+ 1,
+ 0x2e80, 0x2eff,
+}; /* CR_In_CJK_Radicals_Supplement */
+
+/* 'In_Kangxi_Radicals': Block */
+static const OnigCodePoint CR_In_Kangxi_Radicals[] = {
+ 1,
+ 0x2f00, 0x2fdf,
+}; /* CR_In_Kangxi_Radicals */
+
+/* 'In_Ideographic_Description_Characters': Block */
+static const OnigCodePoint CR_In_Ideographic_Description_Characters[] = {
+ 1,
+ 0x2ff0, 0x2fff,
+}; /* CR_In_Ideographic_Description_Characters */
+
+/* 'In_CJK_Symbols_and_Punctuation': Block */
+static const OnigCodePoint CR_In_CJK_Symbols_and_Punctuation[] = {
+ 1,
+ 0x3000, 0x303f,
+}; /* CR_In_CJK_Symbols_and_Punctuation */
+
+/* 'In_Hiragana': Block */
+static const OnigCodePoint CR_In_Hiragana[] = {
+ 1,
+ 0x3040, 0x309f,
+}; /* CR_In_Hiragana */
+
+/* 'In_Katakana': Block */
+static const OnigCodePoint CR_In_Katakana[] = {
+ 1,
+ 0x30a0, 0x30ff,
+}; /* CR_In_Katakana */
+
+/* 'In_Bopomofo': Block */
+static const OnigCodePoint CR_In_Bopomofo[] = {
+ 1,
+ 0x3100, 0x312f,
+}; /* CR_In_Bopomofo */
+
+/* 'In_Hangul_Compatibility_Jamo': Block */
+static const OnigCodePoint CR_In_Hangul_Compatibility_Jamo[] = {
+ 1,
+ 0x3130, 0x318f,
+}; /* CR_In_Hangul_Compatibility_Jamo */
+
+/* 'In_Kanbun': Block */
+static const OnigCodePoint CR_In_Kanbun[] = {
+ 1,
+ 0x3190, 0x319f,
+}; /* CR_In_Kanbun */
+
+/* 'In_Bopomofo_Extended': Block */
+static const OnigCodePoint CR_In_Bopomofo_Extended[] = {
+ 1,
+ 0x31a0, 0x31bf,
+}; /* CR_In_Bopomofo_Extended */
+
+/* 'In_CJK_Strokes': Block */
+static const OnigCodePoint CR_In_CJK_Strokes[] = {
+ 1,
+ 0x31c0, 0x31ef,
+}; /* CR_In_CJK_Strokes */
+
+/* 'In_Katakana_Phonetic_Extensions': Block */
+static const OnigCodePoint CR_In_Katakana_Phonetic_Extensions[] = {
+ 1,
0x31f0, 0x31ff,
- 0x3400, 0x4db5,
- 0x4e00, 0x9fcb,
- 0xa000, 0xa48c,
- 0xa4d0, 0xa4fd,
- 0xa500, 0xa60c,
- 0xa610, 0xa62b,
- 0xa640, 0xa672,
- 0xa67c, 0xa67d,
- 0xa67f, 0xa697,
- 0xa6a0, 0xa6f1,
- 0xa717, 0xa71f,
- 0xa722, 0xa788,
- 0xa78b, 0xa78e,
- 0xa790, 0xa791,
- 0xa7a0, 0xa7a9,
- 0xa7fa, 0xa827,
- 0xa840, 0xa873,
- 0xa880, 0xa8c4,
- 0xa8d0, 0xa8d9,
- 0xa8e0, 0xa8f7,
- 0xa8fb, 0xa8fb,
- 0xa900, 0xa92d,
- 0xa930, 0xa953,
- 0xa960, 0xa97c,
- 0xa980, 0xa9c0,
- 0xa9cf, 0xa9d9,
- 0xaa00, 0xaa36,
- 0xaa40, 0xaa4d,
- 0xaa50, 0xaa59,
- 0xaa60, 0xaa76,
- 0xaa7a, 0xaa7b,
- 0xaa80, 0xaac2,
- 0xaadb, 0xaadd,
- 0xab01, 0xab06,
- 0xab09, 0xab0e,
- 0xab11, 0xab16,
- 0xab20, 0xab26,
- 0xab28, 0xab2e,
- 0xabc0, 0xabea,
- 0xabec, 0xabed,
- 0xabf0, 0xabf9,
- 0xac00, 0xd7a3,
- 0xd7b0, 0xd7c6,
- 0xd7cb, 0xd7fb,
- 0xf900, 0xfa2d,
- 0xfa30, 0xfa6d,
- 0xfa70, 0xfad9,
- 0xfb00, 0xfb06,
- 0xfb13, 0xfb17,
- 0xfb1d, 0xfb28,
- 0xfb2a, 0xfb36,
- 0xfb38, 0xfb3c,
- 0xfb3e, 0xfb3e,
- 0xfb40, 0xfb41,
- 0xfb43, 0xfb44,
- 0xfb46, 0xfbb1,
- 0xfbd3, 0xfd3d,
- 0xfd50, 0xfd8f,
- 0xfd92, 0xfdc7,
- 0xfdf0, 0xfdfb,
+}; /* CR_In_Katakana_Phonetic_Extensions */
+
+/* 'In_Enclosed_CJK_Letters_and_Months': Block */
+static const OnigCodePoint CR_In_Enclosed_CJK_Letters_and_Months[] = {
+ 1,
+ 0x3200, 0x32ff,
+}; /* CR_In_Enclosed_CJK_Letters_and_Months */
+
+/* 'In_CJK_Compatibility': Block */
+static const OnigCodePoint CR_In_CJK_Compatibility[] = {
+ 1,
+ 0x3300, 0x33ff,
+}; /* CR_In_CJK_Compatibility */
+
+/* 'In_CJK_Unified_Ideographs_Extension_A': Block */
+static const OnigCodePoint CR_In_CJK_Unified_Ideographs_Extension_A[] = {
+ 1,
+ 0x3400, 0x4dbf,
+}; /* CR_In_CJK_Unified_Ideographs_Extension_A */
+
+/* 'In_Yijing_Hexagram_Symbols': Block */
+static const OnigCodePoint CR_In_Yijing_Hexagram_Symbols[] = {
+ 1,
+ 0x4dc0, 0x4dff,
+}; /* CR_In_Yijing_Hexagram_Symbols */
+
+/* 'In_CJK_Unified_Ideographs': Block */
+static const OnigCodePoint CR_In_CJK_Unified_Ideographs[] = {
+ 1,
+ 0x4e00, 0x9fff,
+}; /* CR_In_CJK_Unified_Ideographs */
+
+/* 'In_Yi_Syllables': Block */
+static const OnigCodePoint CR_In_Yi_Syllables[] = {
+ 1,
+ 0xa000, 0xa48f,
+}; /* CR_In_Yi_Syllables */
+
+/* 'In_Yi_Radicals': Block */
+static const OnigCodePoint CR_In_Yi_Radicals[] = {
+ 1,
+ 0xa490, 0xa4cf,
+}; /* CR_In_Yi_Radicals */
+
+/* 'In_Lisu': Block */
+#define CR_In_Lisu CR_Lisu
+
+/* 'In_Vai': Block */
+static const OnigCodePoint CR_In_Vai[] = {
+ 1,
+ 0xa500, 0xa63f,
+}; /* CR_In_Vai */
+
+/* 'In_Cyrillic_Extended_B': Block */
+static const OnigCodePoint CR_In_Cyrillic_Extended_B[] = {
+ 1,
+ 0xa640, 0xa69f,
+}; /* CR_In_Cyrillic_Extended_B */
+
+/* 'In_Bamum': Block */
+static const OnigCodePoint CR_In_Bamum[] = {
+ 1,
+ 0xa6a0, 0xa6ff,
+}; /* CR_In_Bamum */
+
+/* 'In_Modifier_Tone_Letters': Block */
+static const OnigCodePoint CR_In_Modifier_Tone_Letters[] = {
+ 1,
+ 0xa700, 0xa71f,
+}; /* CR_In_Modifier_Tone_Letters */
+
+/* 'In_Latin_Extended_D': Block */
+static const OnigCodePoint CR_In_Latin_Extended_D[] = {
+ 1,
+ 0xa720, 0xa7ff,
+}; /* CR_In_Latin_Extended_D */
+
+/* 'In_Syloti_Nagri': Block */
+static const OnigCodePoint CR_In_Syloti_Nagri[] = {
+ 1,
+ 0xa800, 0xa82f,
+}; /* CR_In_Syloti_Nagri */
+
+/* 'In_Common_Indic_Number_Forms': Block */
+static const OnigCodePoint CR_In_Common_Indic_Number_Forms[] = {
+ 1,
+ 0xa830, 0xa83f,
+}; /* CR_In_Common_Indic_Number_Forms */
+
+/* 'In_Phags_pa': Block */
+static const OnigCodePoint CR_In_Phags_pa[] = {
+ 1,
+ 0xa840, 0xa87f,
+}; /* CR_In_Phags_pa */
+
+/* 'In_Saurashtra': Block */
+static const OnigCodePoint CR_In_Saurashtra[] = {
+ 1,
+ 0xa880, 0xa8df,
+}; /* CR_In_Saurashtra */
+
+/* 'In_Devanagari_Extended': Block */
+static const OnigCodePoint CR_In_Devanagari_Extended[] = {
+ 1,
+ 0xa8e0, 0xa8ff,
+}; /* CR_In_Devanagari_Extended */
+
+/* 'In_Kayah_Li': Block */
+#define CR_In_Kayah_Li CR_Kayah_Li
+
+/* 'In_Rejang': Block */
+static const OnigCodePoint CR_In_Rejang[] = {
+ 1,
+ 0xa930, 0xa95f,
+}; /* CR_In_Rejang */
+
+/* 'In_Hangul_Jamo_Extended_A': Block */
+static const OnigCodePoint CR_In_Hangul_Jamo_Extended_A[] = {
+ 1,
+ 0xa960, 0xa97f,
+}; /* CR_In_Hangul_Jamo_Extended_A */
+
+/* 'In_Javanese': Block */
+static const OnigCodePoint CR_In_Javanese[] = {
+ 1,
+ 0xa980, 0xa9df,
+}; /* CR_In_Javanese */
+
+/* 'In_Cham': Block */
+static const OnigCodePoint CR_In_Cham[] = {
+ 1,
+ 0xaa00, 0xaa5f,
+}; /* CR_In_Cham */
+
+/* 'In_Myanmar_Extended_A': Block */
+static const OnigCodePoint CR_In_Myanmar_Extended_A[] = {
+ 1,
+ 0xaa60, 0xaa7f,
+}; /* CR_In_Myanmar_Extended_A */
+
+/* 'In_Tai_Viet': Block */
+static const OnigCodePoint CR_In_Tai_Viet[] = {
+ 1,
+ 0xaa80, 0xaadf,
+}; /* CR_In_Tai_Viet */
+
+/* 'In_Meetei_Mayek_Extensions': Block */
+static const OnigCodePoint CR_In_Meetei_Mayek_Extensions[] = {
+ 1,
+ 0xaae0, 0xaaff,
+}; /* CR_In_Meetei_Mayek_Extensions */
+
+/* 'In_Ethiopic_Extended_A': Block */
+static const OnigCodePoint CR_In_Ethiopic_Extended_A[] = {
+ 1,
+ 0xab00, 0xab2f,
+}; /* CR_In_Ethiopic_Extended_A */
+
+/* 'In_Meetei_Mayek': Block */
+static const OnigCodePoint CR_In_Meetei_Mayek[] = {
+ 1,
+ 0xabc0, 0xabff,
+}; /* CR_In_Meetei_Mayek */
+
+/* 'In_Hangul_Syllables': Block */
+static const OnigCodePoint CR_In_Hangul_Syllables[] = {
+ 1,
+ 0xac00, 0xd7af,
+}; /* CR_In_Hangul_Syllables */
+
+/* 'In_Hangul_Jamo_Extended_B': Block */
+static const OnigCodePoint CR_In_Hangul_Jamo_Extended_B[] = {
+ 1,
+ 0xd7b0, 0xd7ff,
+}; /* CR_In_Hangul_Jamo_Extended_B */
+
+/* 'In_High_Surrogates': Block */
+static const OnigCodePoint CR_In_High_Surrogates[] = {
+ 1,
+ 0xd800, 0xdb7f,
+}; /* CR_In_High_Surrogates */
+
+/* 'In_High_Private_Use_Surrogates': Block */
+static const OnigCodePoint CR_In_High_Private_Use_Surrogates[] = {
+ 1,
+ 0xdb80, 0xdbff,
+}; /* CR_In_High_Private_Use_Surrogates */
+
+/* 'In_Low_Surrogates': Block */
+static const OnigCodePoint CR_In_Low_Surrogates[] = {
+ 1,
+ 0xdc00, 0xdfff,
+}; /* CR_In_Low_Surrogates */
+
+/* 'In_Private_Use_Area': Block */
+static const OnigCodePoint CR_In_Private_Use_Area[] = {
+ 1,
+ 0xe000, 0xf8ff,
+}; /* CR_In_Private_Use_Area */
+
+/* 'In_CJK_Compatibility_Ideographs': Block */
+static const OnigCodePoint CR_In_CJK_Compatibility_Ideographs[] = {
+ 1,
+ 0xf900, 0xfaff,
+}; /* CR_In_CJK_Compatibility_Ideographs */
+
+/* 'In_Alphabetic_Presentation_Forms': Block */
+static const OnigCodePoint CR_In_Alphabetic_Presentation_Forms[] = {
+ 1,
+ 0xfb00, 0xfb4f,
+}; /* CR_In_Alphabetic_Presentation_Forms */
+
+/* 'In_Arabic_Presentation_Forms_A': Block */
+static const OnigCodePoint CR_In_Arabic_Presentation_Forms_A[] = {
+ 1,
+ 0xfb50, 0xfdff,
+}; /* CR_In_Arabic_Presentation_Forms_A */
+
+/* 'In_Variation_Selectors': Block */
+static const OnigCodePoint CR_In_Variation_Selectors[] = {
+ 1,
0xfe00, 0xfe0f,
- 0xfe20, 0xfe26,
- 0xfe33, 0xfe34,
- 0xfe4d, 0xfe4f,
- 0xfe70, 0xfe74,
- 0xfe76, 0xfefc,
- 0xff10, 0xff19,
- 0xff21, 0xff3a,
- 0xff3f, 0xff3f,
- 0xff41, 0xff5a,
- 0xff66, 0xffbe,
- 0xffc2, 0xffc7,
- 0xffca, 0xffcf,
- 0xffd2, 0xffd7,
- 0xffda, 0xffdc,
- 0x10000, 0x1000b,
- 0x1000d, 0x10026,
- 0x10028, 0x1003a,
- 0x1003c, 0x1003d,
- 0x1003f, 0x1004d,
- 0x10050, 0x1005d,
- 0x10080, 0x100fa,
- 0x10140, 0x10174,
- 0x101fd, 0x101fd,
- 0x10280, 0x1029c,
- 0x102a0, 0x102d0,
- 0x10300, 0x1031e,
- 0x10330, 0x1034a,
- 0x10380, 0x1039d,
- 0x103a0, 0x103c3,
- 0x103c8, 0x103cf,
- 0x103d1, 0x103d5,
- 0x10400, 0x1049d,
- 0x104a0, 0x104a9,
- 0x10800, 0x10805,
- 0x10808, 0x10808,
- 0x1080a, 0x10835,
- 0x10837, 0x10838,
- 0x1083c, 0x1083c,
- 0x1083f, 0x10855,
- 0x10900, 0x10915,
- 0x10920, 0x10939,
- 0x10a00, 0x10a03,
- 0x10a05, 0x10a06,
- 0x10a0c, 0x10a13,
- 0x10a15, 0x10a17,
- 0x10a19, 0x10a33,
- 0x10a38, 0x10a3a,
- 0x10a3f, 0x10a3f,
- 0x10a60, 0x10a7c,
- 0x10b00, 0x10b35,
- 0x10b40, 0x10b55,
- 0x10b60, 0x10b72,
- 0x10c00, 0x10c48,
- 0x11000, 0x11046,
- 0x11066, 0x1106f,
- 0x11080, 0x110ba,
- 0x12000, 0x1236e,
- 0x12400, 0x12462,
- 0x13000, 0x1342e,
- 0x16800, 0x16a38,
- 0x1b000, 0x1b001,
- 0x1d165, 0x1d169,
- 0x1d16d, 0x1d172,
- 0x1d17b, 0x1d182,
- 0x1d185, 0x1d18b,
- 0x1d1aa, 0x1d1ad,
- 0x1d242, 0x1d244,
- 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, 0x1d6c0,
- 0x1d6c2, 0x1d6da,
- 0x1d6dc, 0x1d6fa,
- 0x1d6fc, 0x1d714,
- 0x1d716, 0x1d734,
- 0x1d736, 0x1d74e,
- 0x1d750, 0x1d76e,
- 0x1d770, 0x1d788,
- 0x1d78a, 0x1d7a8,
- 0x1d7aa, 0x1d7c2,
- 0x1d7c4, 0x1d7cb,
- 0x1d7ce, 0x1d7ff,
- 0x20000, 0x2a6d6,
- 0x2a700, 0x2b734,
- 0x2b740, 0x2b81d,
- 0x2f800, 0x2fa1d,
+}; /* CR_In_Variation_Selectors */
+
+/* 'In_Vertical_Forms': Block */
+static const OnigCodePoint CR_In_Vertical_Forms[] = {
+ 1,
+ 0xfe10, 0xfe1f,
+}; /* CR_In_Vertical_Forms */
+
+/* 'In_Combining_Half_Marks': Block */
+static const OnigCodePoint CR_In_Combining_Half_Marks[] = {
+ 1,
+ 0xfe20, 0xfe2f,
+}; /* CR_In_Combining_Half_Marks */
+
+/* 'In_CJK_Compatibility_Forms': Block */
+static const OnigCodePoint CR_In_CJK_Compatibility_Forms[] = {
+ 1,
+ 0xfe30, 0xfe4f,
+}; /* CR_In_CJK_Compatibility_Forms */
+
+/* 'In_Small_Form_Variants': Block */
+static const OnigCodePoint CR_In_Small_Form_Variants[] = {
+ 1,
+ 0xfe50, 0xfe6f,
+}; /* CR_In_Small_Form_Variants */
+
+/* 'In_Arabic_Presentation_Forms_B': Block */
+static const OnigCodePoint CR_In_Arabic_Presentation_Forms_B[] = {
+ 1,
+ 0xfe70, 0xfeff,
+}; /* CR_In_Arabic_Presentation_Forms_B */
+
+/* 'In_Halfwidth_and_Fullwidth_Forms': Block */
+static const OnigCodePoint CR_In_Halfwidth_and_Fullwidth_Forms[] = {
+ 1,
+ 0xff00, 0xffef,
+}; /* CR_In_Halfwidth_and_Fullwidth_Forms */
+
+/* 'In_Specials': Block */
+static const OnigCodePoint CR_In_Specials[] = {
+ 1,
+ 0xfff0, 0xffff,
+}; /* CR_In_Specials */
+
+/* 'In_Linear_B_Syllabary': Block */
+static const OnigCodePoint CR_In_Linear_B_Syllabary[] = {
+ 1,
+ 0x10000, 0x1007f,
+}; /* CR_In_Linear_B_Syllabary */
+
+/* 'In_Linear_B_Ideograms': Block */
+static const OnigCodePoint CR_In_Linear_B_Ideograms[] = {
+ 1,
+ 0x10080, 0x100ff,
+}; /* CR_In_Linear_B_Ideograms */
+
+/* 'In_Aegean_Numbers': Block */
+static const OnigCodePoint CR_In_Aegean_Numbers[] = {
+ 1,
+ 0x10100, 0x1013f,
+}; /* CR_In_Aegean_Numbers */
+
+/* 'In_Ancient_Greek_Numbers': Block */
+static const OnigCodePoint CR_In_Ancient_Greek_Numbers[] = {
+ 1,
+ 0x10140, 0x1018f,
+}; /* CR_In_Ancient_Greek_Numbers */
+
+/* 'In_Ancient_Symbols': Block */
+static const OnigCodePoint CR_In_Ancient_Symbols[] = {
+ 1,
+ 0x10190, 0x101cf,
+}; /* CR_In_Ancient_Symbols */
+
+/* 'In_Phaistos_Disc': Block */
+static const OnigCodePoint CR_In_Phaistos_Disc[] = {
+ 1,
+ 0x101d0, 0x101ff,
+}; /* CR_In_Phaistos_Disc */
+
+/* 'In_Lycian': Block */
+static const OnigCodePoint CR_In_Lycian[] = {
+ 1,
+ 0x10280, 0x1029f,
+}; /* CR_In_Lycian */
+
+/* 'In_Carian': Block */
+static const OnigCodePoint CR_In_Carian[] = {
+ 1,
+ 0x102a0, 0x102df,
+}; /* CR_In_Carian */
+
+/* 'In_Old_Italic': Block */
+static const OnigCodePoint CR_In_Old_Italic[] = {
+ 1,
+ 0x10300, 0x1032f,
+}; /* CR_In_Old_Italic */
+
+/* 'In_Gothic': Block */
+static const OnigCodePoint CR_In_Gothic[] = {
+ 1,
+ 0x10330, 0x1034f,
+}; /* CR_In_Gothic */
+
+/* 'In_Ugaritic': Block */
+static const OnigCodePoint CR_In_Ugaritic[] = {
+ 1,
+ 0x10380, 0x1039f,
+}; /* CR_In_Ugaritic */
+
+/* 'In_Old_Persian': Block */
+static const OnigCodePoint CR_In_Old_Persian[] = {
+ 1,
+ 0x103a0, 0x103df,
+}; /* CR_In_Old_Persian */
+
+/* 'In_Deseret': Block */
+#define CR_In_Deseret CR_Deseret
+
+/* 'In_Shavian': Block */
+#define CR_In_Shavian CR_Shavian
+
+/* 'In_Osmanya': Block */
+static const OnigCodePoint CR_In_Osmanya[] = {
+ 1,
+ 0x10480, 0x104af,
+}; /* CR_In_Osmanya */
+
+/* 'In_Cypriot_Syllabary': Block */
+static const OnigCodePoint CR_In_Cypriot_Syllabary[] = {
+ 1,
+ 0x10800, 0x1083f,
+}; /* CR_In_Cypriot_Syllabary */
+
+/* 'In_Imperial_Aramaic': Block */
+static const OnigCodePoint CR_In_Imperial_Aramaic[] = {
+ 1,
+ 0x10840, 0x1085f,
+}; /* CR_In_Imperial_Aramaic */
+
+/* 'In_Phoenician': Block */
+static const OnigCodePoint CR_In_Phoenician[] = {
+ 1,
+ 0x10900, 0x1091f,
+}; /* CR_In_Phoenician */
+
+/* 'In_Lydian': Block */
+static const OnigCodePoint CR_In_Lydian[] = {
+ 1,
+ 0x10920, 0x1093f,
+}; /* CR_In_Lydian */
+
+/* 'In_Meroitic_Hieroglyphs': Block */
+#define CR_In_Meroitic_Hieroglyphs CR_Meroitic_Hieroglyphs
+
+/* 'In_Meroitic_Cursive': Block */
+static const OnigCodePoint CR_In_Meroitic_Cursive[] = {
+ 1,
+ 0x109a0, 0x109ff,
+}; /* CR_In_Meroitic_Cursive */
+
+/* 'In_Kharoshthi': Block */
+static const OnigCodePoint CR_In_Kharoshthi[] = {
+ 1,
+ 0x10a00, 0x10a5f,
+}; /* CR_In_Kharoshthi */
+
+/* 'In_Old_South_Arabian': Block */
+#define CR_In_Old_South_Arabian CR_Old_South_Arabian
+
+/* 'In_Avestan': Block */
+static const OnigCodePoint CR_In_Avestan[] = {
+ 1,
+ 0x10b00, 0x10b3f,
+}; /* CR_In_Avestan */
+
+/* 'In_Inscriptional_Parthian': Block */
+static const OnigCodePoint CR_In_Inscriptional_Parthian[] = {
+ 1,
+ 0x10b40, 0x10b5f,
+}; /* CR_In_Inscriptional_Parthian */
+
+/* 'In_Inscriptional_Pahlavi': Block */
+static const OnigCodePoint CR_In_Inscriptional_Pahlavi[] = {
+ 1,
+ 0x10b60, 0x10b7f,
+}; /* CR_In_Inscriptional_Pahlavi */
+
+/* 'In_Old_Turkic': Block */
+static const OnigCodePoint CR_In_Old_Turkic[] = {
+ 1,
+ 0x10c00, 0x10c4f,
+}; /* CR_In_Old_Turkic */
+
+/* 'In_Rumi_Numeral_Symbols': Block */
+static const OnigCodePoint CR_In_Rumi_Numeral_Symbols[] = {
+ 1,
+ 0x10e60, 0x10e7f,
+}; /* CR_In_Rumi_Numeral_Symbols */
+
+/* 'In_Brahmi': Block */
+static const OnigCodePoint CR_In_Brahmi[] = {
+ 1,
+ 0x11000, 0x1107f,
+}; /* CR_In_Brahmi */
+
+/* 'In_Kaithi': Block */
+static const OnigCodePoint CR_In_Kaithi[] = {
+ 1,
+ 0x11080, 0x110cf,
+}; /* CR_In_Kaithi */
+
+/* 'In_Sora_Sompeng': Block */
+static const OnigCodePoint CR_In_Sora_Sompeng[] = {
+ 1,
+ 0x110d0, 0x110ff,
+}; /* CR_In_Sora_Sompeng */
+
+/* 'In_Chakma': Block */
+static const OnigCodePoint CR_In_Chakma[] = {
+ 1,
+ 0x11100, 0x1114f,
+}; /* CR_In_Chakma */
+
+/* 'In_Sharada': Block */
+static const OnigCodePoint CR_In_Sharada[] = {
+ 1,
+ 0x11180, 0x111df,
+}; /* CR_In_Sharada */
+
+/* 'In_Takri': Block */
+static const OnigCodePoint CR_In_Takri[] = {
+ 1,
+ 0x11680, 0x116cf,
+}; /* CR_In_Takri */
+
+/* 'In_Cuneiform': Block */
+static const OnigCodePoint CR_In_Cuneiform[] = {
+ 1,
+ 0x12000, 0x123ff,
+}; /* CR_In_Cuneiform */
+
+/* 'In_Cuneiform_Numbers_and_Punctuation': Block */
+static const OnigCodePoint CR_In_Cuneiform_Numbers_and_Punctuation[] = {
+ 1,
+ 0x12400, 0x1247f,
+}; /* CR_In_Cuneiform_Numbers_and_Punctuation */
+
+/* 'In_Egyptian_Hieroglyphs': Block */
+static const OnigCodePoint CR_In_Egyptian_Hieroglyphs[] = {
+ 1,
+ 0x13000, 0x1342f,
+}; /* CR_In_Egyptian_Hieroglyphs */
+
+/* 'In_Bamum_Supplement': Block */
+static const OnigCodePoint CR_In_Bamum_Supplement[] = {
+ 1,
+ 0x16800, 0x16a3f,
+}; /* CR_In_Bamum_Supplement */
+
+/* 'In_Miao': Block */
+static const OnigCodePoint CR_In_Miao[] = {
+ 1,
+ 0x16f00, 0x16f9f,
+}; /* CR_In_Miao */
+
+/* 'In_Kana_Supplement': Block */
+static const OnigCodePoint CR_In_Kana_Supplement[] = {
+ 1,
+ 0x1b000, 0x1b0ff,
+}; /* CR_In_Kana_Supplement */
+
+/* 'In_Byzantine_Musical_Symbols': Block */
+static const OnigCodePoint CR_In_Byzantine_Musical_Symbols[] = {
+ 1,
+ 0x1d000, 0x1d0ff,
+}; /* CR_In_Byzantine_Musical_Symbols */
+
+/* 'In_Musical_Symbols': Block */
+static const OnigCodePoint CR_In_Musical_Symbols[] = {
+ 1,
+ 0x1d100, 0x1d1ff,
+}; /* CR_In_Musical_Symbols */
+
+/* 'In_Ancient_Greek_Musical_Notation': Block */
+static const OnigCodePoint CR_In_Ancient_Greek_Musical_Notation[] = {
+ 1,
+ 0x1d200, 0x1d24f,
+}; /* CR_In_Ancient_Greek_Musical_Notation */
+
+/* 'In_Tai_Xuan_Jing_Symbols': Block */
+static const OnigCodePoint CR_In_Tai_Xuan_Jing_Symbols[] = {
+ 1,
+ 0x1d300, 0x1d35f,
+}; /* CR_In_Tai_Xuan_Jing_Symbols */
+
+/* 'In_Counting_Rod_Numerals': Block */
+static const OnigCodePoint CR_In_Counting_Rod_Numerals[] = {
+ 1,
+ 0x1d360, 0x1d37f,
+}; /* CR_In_Counting_Rod_Numerals */
+
+/* 'In_Mathematical_Alphanumeric_Symbols': Block */
+static const OnigCodePoint CR_In_Mathematical_Alphanumeric_Symbols[] = {
+ 1,
+ 0x1d400, 0x1d7ff,
+}; /* CR_In_Mathematical_Alphanumeric_Symbols */
+
+/* 'In_Arabic_Mathematical_Alphabetic_Symbols': Block */
+static const OnigCodePoint CR_In_Arabic_Mathematical_Alphabetic_Symbols[] = {
+ 1,
+ 0x1ee00, 0x1eeff,
+}; /* CR_In_Arabic_Mathematical_Alphabetic_Symbols */
+
+/* 'In_Mahjong_Tiles': Block */
+static const OnigCodePoint CR_In_Mahjong_Tiles[] = {
+ 1,
+ 0x1f000, 0x1f02f,
+}; /* CR_In_Mahjong_Tiles */
+
+/* 'In_Domino_Tiles': Block */
+static const OnigCodePoint CR_In_Domino_Tiles[] = {
+ 1,
+ 0x1f030, 0x1f09f,
+}; /* CR_In_Domino_Tiles */
+
+/* 'In_Playing_Cards': Block */
+static const OnigCodePoint CR_In_Playing_Cards[] = {
+ 1,
+ 0x1f0a0, 0x1f0ff,
+}; /* CR_In_Playing_Cards */
+
+/* 'In_Enclosed_Alphanumeric_Supplement': Block */
+static const OnigCodePoint CR_In_Enclosed_Alphanumeric_Supplement[] = {
+ 1,
+ 0x1f100, 0x1f1ff,
+}; /* CR_In_Enclosed_Alphanumeric_Supplement */
+
+/* 'In_Enclosed_Ideographic_Supplement': Block */
+static const OnigCodePoint CR_In_Enclosed_Ideographic_Supplement[] = {
+ 1,
+ 0x1f200, 0x1f2ff,
+}; /* CR_In_Enclosed_Ideographic_Supplement */
+
+/* 'In_Miscellaneous_Symbols_And_Pictographs': Block */
+static const OnigCodePoint CR_In_Miscellaneous_Symbols_And_Pictographs[] = {
+ 1,
+ 0x1f300, 0x1f5ff,
+}; /* CR_In_Miscellaneous_Symbols_And_Pictographs */
+
+/* 'In_Emoticons': Block */
+static const OnigCodePoint CR_In_Emoticons[] = {
+ 1,
+ 0x1f600, 0x1f64f,
+}; /* CR_In_Emoticons */
+
+/* 'In_Transport_And_Map_Symbols': Block */
+static const OnigCodePoint CR_In_Transport_And_Map_Symbols[] = {
+ 1,
+ 0x1f680, 0x1f6ff,
+}; /* CR_In_Transport_And_Map_Symbols */
+
+/* 'In_Alchemical_Symbols': Block */
+static const OnigCodePoint CR_In_Alchemical_Symbols[] = {
+ 1,
+ 0x1f700, 0x1f77f,
+}; /* CR_In_Alchemical_Symbols */
+
+/* 'In_CJK_Unified_Ideographs_Extension_B': Block */
+static const OnigCodePoint CR_In_CJK_Unified_Ideographs_Extension_B[] = {
+ 1,
+ 0x20000, 0x2a6df,
+}; /* CR_In_CJK_Unified_Ideographs_Extension_B */
+
+/* 'In_CJK_Unified_Ideographs_Extension_C': Block */
+static const OnigCodePoint CR_In_CJK_Unified_Ideographs_Extension_C[] = {
+ 1,
+ 0x2a700, 0x2b73f,
+}; /* CR_In_CJK_Unified_Ideographs_Extension_C */
+
+/* 'In_CJK_Unified_Ideographs_Extension_D': Block */
+static const OnigCodePoint CR_In_CJK_Unified_Ideographs_Extension_D[] = {
+ 1,
+ 0x2b740, 0x2b81f,
+}; /* CR_In_CJK_Unified_Ideographs_Extension_D */
+
+/* 'In_CJK_Compatibility_Ideographs_Supplement': Block */
+static const OnigCodePoint CR_In_CJK_Compatibility_Ideographs_Supplement[] = {
+ 1,
+ 0x2f800, 0x2fa1f,
+}; /* CR_In_CJK_Compatibility_Ideographs_Supplement */
+
+/* 'In_Tags': Block */
+static const OnigCodePoint CR_In_Tags[] = {
+ 1,
+ 0xe0000, 0xe007f,
+}; /* CR_In_Tags */
+
+/* 'In_Variation_Selectors_Supplement': Block */
+static const OnigCodePoint CR_In_Variation_Selectors_Supplement[] = {
+ 1,
0xe0100, 0xe01ef,
-}; /* CR_Word */
+}; /* CR_In_Variation_Selectors_Supplement */
-/* 'Alnum': [[:Alnum:]] */
-static const OnigCodePoint CR_Alnum[] = {
- 509,
- 0x0030, 0x0039,
- 0x0041, 0x005a,
- 0x0061, 0x007a,
- 0x00aa, 0x00aa,
- 0x00b5, 0x00b5,
- 0x00ba, 0x00ba,
- 0x00c0, 0x00d6,
- 0x00d8, 0x00f6,
- 0x00f8, 0x02c1,
- 0x02c6, 0x02d1,
- 0x02e0, 0x02e4,
- 0x02ec, 0x02ec,
- 0x02ee, 0x02ee,
- 0x0345, 0x0345,
- 0x0370, 0x0374,
- 0x0376, 0x0377,
- 0x037a, 0x037d,
- 0x0386, 0x0386,
- 0x0388, 0x038a,
- 0x038c, 0x038c,
- 0x038e, 0x03a1,
- 0x03a3, 0x03f5,
- 0x03f7, 0x0481,
- 0x048a, 0x0527,
- 0x0531, 0x0556,
- 0x0559, 0x0559,
- 0x0561, 0x0587,
- 0x05b0, 0x05bd,
- 0x05bf, 0x05bf,
- 0x05c1, 0x05c2,
- 0x05c4, 0x05c5,
- 0x05c7, 0x05c7,
- 0x05d0, 0x05ea,
- 0x05f0, 0x05f2,
- 0x0610, 0x061a,
- 0x0620, 0x0657,
- 0x0659, 0x0669,
- 0x066e, 0x06d3,
- 0x06d5, 0x06dc,
- 0x06e1, 0x06e8,
- 0x06ed, 0x06fc,
- 0x06ff, 0x06ff,
- 0x0710, 0x073f,
- 0x074d, 0x07b1,
- 0x07c0, 0x07ea,
- 0x07f4, 0x07f5,
- 0x07fa, 0x07fa,
- 0x0800, 0x0817,
- 0x081a, 0x082c,
- 0x0840, 0x0858,
- 0x0900, 0x093b,
- 0x093d, 0x094c,
- 0x094e, 0x0950,
- 0x0955, 0x0963,
- 0x0966, 0x096f,
- 0x0971, 0x0977,
- 0x0979, 0x097f,
- 0x0981, 0x0983,
- 0x0985, 0x098c,
- 0x098f, 0x0990,
- 0x0993, 0x09a8,
- 0x09aa, 0x09b0,
- 0x09b2, 0x09b2,
- 0x09b6, 0x09b9,
- 0x09bd, 0x09c4,
- 0x09c7, 0x09c8,
- 0x09cb, 0x09cc,
- 0x09ce, 0x09ce,
- 0x09d7, 0x09d7,
- 0x09dc, 0x09dd,
- 0x09df, 0x09e3,
- 0x09e6, 0x09f1,
- 0x0a01, 0x0a03,
- 0x0a05, 0x0a0a,
- 0x0a0f, 0x0a10,
- 0x0a13, 0x0a28,
- 0x0a2a, 0x0a30,
- 0x0a32, 0x0a33,
- 0x0a35, 0x0a36,
- 0x0a38, 0x0a39,
- 0x0a3e, 0x0a42,
- 0x0a47, 0x0a48,
- 0x0a4b, 0x0a4c,
- 0x0a51, 0x0a51,
- 0x0a59, 0x0a5c,
- 0x0a5e, 0x0a5e,
- 0x0a66, 0x0a75,
- 0x0a81, 0x0a83,
- 0x0a85, 0x0a8d,
- 0x0a8f, 0x0a91,
- 0x0a93, 0x0aa8,
- 0x0aaa, 0x0ab0,
- 0x0ab2, 0x0ab3,
- 0x0ab5, 0x0ab9,
- 0x0abd, 0x0ac5,
- 0x0ac7, 0x0ac9,
- 0x0acb, 0x0acc,
- 0x0ad0, 0x0ad0,
- 0x0ae0, 0x0ae3,
- 0x0ae6, 0x0aef,
- 0x0b01, 0x0b03,
- 0x0b05, 0x0b0c,
- 0x0b0f, 0x0b10,
- 0x0b13, 0x0b28,
- 0x0b2a, 0x0b30,
- 0x0b32, 0x0b33,
- 0x0b35, 0x0b39,
- 0x0b3d, 0x0b44,
- 0x0b47, 0x0b48,
- 0x0b4b, 0x0b4c,
- 0x0b56, 0x0b57,
- 0x0b5c, 0x0b5d,
- 0x0b5f, 0x0b63,
- 0x0b66, 0x0b6f,
- 0x0b71, 0x0b71,
- 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, 0x0bcc,
- 0x0bd0, 0x0bd0,
- 0x0bd7, 0x0bd7,
- 0x0be6, 0x0bef,
- 0x0c01, 0x0c03,
- 0x0c05, 0x0c0c,
- 0x0c0e, 0x0c10,
- 0x0c12, 0x0c28,
- 0x0c2a, 0x0c33,
- 0x0c35, 0x0c39,
- 0x0c3d, 0x0c44,
- 0x0c46, 0x0c48,
- 0x0c4a, 0x0c4c,
- 0x0c55, 0x0c56,
- 0x0c58, 0x0c59,
- 0x0c60, 0x0c63,
- 0x0c66, 0x0c6f,
- 0x0c82, 0x0c83,
- 0x0c85, 0x0c8c,
- 0x0c8e, 0x0c90,
- 0x0c92, 0x0ca8,
- 0x0caa, 0x0cb3,
- 0x0cb5, 0x0cb9,
- 0x0cbd, 0x0cc4,
- 0x0cc6, 0x0cc8,
- 0x0cca, 0x0ccc,
- 0x0cd5, 0x0cd6,
- 0x0cde, 0x0cde,
- 0x0ce0, 0x0ce3,
- 0x0ce6, 0x0cef,
- 0x0cf1, 0x0cf2,
- 0x0d02, 0x0d03,
- 0x0d05, 0x0d0c,
- 0x0d0e, 0x0d10,
- 0x0d12, 0x0d3a,
- 0x0d3d, 0x0d44,
- 0x0d46, 0x0d48,
- 0x0d4a, 0x0d4c,
- 0x0d4e, 0x0d4e,
- 0x0d57, 0x0d57,
- 0x0d60, 0x0d63,
- 0x0d66, 0x0d6f,
- 0x0d7a, 0x0d7f,
- 0x0d82, 0x0d83,
- 0x0d85, 0x0d96,
- 0x0d9a, 0x0db1,
- 0x0db3, 0x0dbb,
- 0x0dbd, 0x0dbd,
- 0x0dc0, 0x0dc6,
- 0x0dcf, 0x0dd4,
- 0x0dd6, 0x0dd6,
- 0x0dd8, 0x0ddf,
- 0x0df2, 0x0df3,
- 0x0e01, 0x0e3a,
- 0x0e40, 0x0e46,
- 0x0e4d, 0x0e4d,
- 0x0e50, 0x0e59,
- 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,
- 0x0ecd, 0x0ecd,
- 0x0ed0, 0x0ed9,
- 0x0edc, 0x0edd,
- 0x0f00, 0x0f00,
- 0x0f20, 0x0f29,
- 0x0f40, 0x0f47,
- 0x0f49, 0x0f6c,
- 0x0f71, 0x0f81,
- 0x0f88, 0x0f97,
- 0x0f99, 0x0fbc,
- 0x1000, 0x1036,
- 0x1038, 0x1038,
- 0x103b, 0x1049,
- 0x1050, 0x1062,
- 0x1065, 0x1068,
- 0x106e, 0x1086,
- 0x108e, 0x108e,
- 0x1090, 0x1099,
- 0x109c, 0x109d,
- 0x10a0, 0x10c5,
- 0x10d0, 0x10fa,
- 0x10fc, 0x10fc,
- 0x1100, 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,
- 0x135f, 0x135f,
- 0x1380, 0x138f,
- 0x13a0, 0x13f4,
- 0x1401, 0x166c,
- 0x166f, 0x167f,
- 0x1681, 0x169a,
- 0x16a0, 0x16ea,
- 0x16ee, 0x16f0,
- 0x1700, 0x170c,
- 0x170e, 0x1713,
- 0x1720, 0x1733,
- 0x1740, 0x1753,
- 0x1760, 0x176c,
- 0x176e, 0x1770,
- 0x1772, 0x1773,
- 0x1780, 0x17b3,
- 0x17b6, 0x17c8,
- 0x17d7, 0x17d7,
- 0x17dc, 0x17dc,
- 0x17e0, 0x17e9,
- 0x1810, 0x1819,
- 0x1820, 0x1877,
- 0x1880, 0x18aa,
- 0x18b0, 0x18f5,
- 0x1900, 0x191c,
- 0x1920, 0x192b,
- 0x1930, 0x1938,
- 0x1946, 0x196d,
- 0x1970, 0x1974,
- 0x1980, 0x19ab,
- 0x19b0, 0x19c9,
- 0x19d0, 0x19d9,
- 0x1a00, 0x1a1b,
- 0x1a20, 0x1a5e,
- 0x1a61, 0x1a74,
- 0x1a80, 0x1a89,
- 0x1a90, 0x1a99,
- 0x1aa7, 0x1aa7,
- 0x1b00, 0x1b33,
- 0x1b35, 0x1b43,
- 0x1b45, 0x1b4b,
- 0x1b50, 0x1b59,
- 0x1b80, 0x1ba9,
- 0x1bae, 0x1bb9,
- 0x1bc0, 0x1be5,
- 0x1be7, 0x1bf1,
- 0x1c00, 0x1c35,
- 0x1c40, 0x1c49,
- 0x1c4d, 0x1c7d,
- 0x1ce9, 0x1cec,
- 0x1cee, 0x1cf2,
- 0x1d00, 0x1dbf,
- 0x1e00, 0x1f15,
- 0x1f18, 0x1f1d,
- 0x1f20, 0x1f45,
- 0x1f48, 0x1f4d,
- 0x1f50, 0x1f57,
- 0x1f59, 0x1f59,
- 0x1f5b, 0x1f5b,
- 0x1f5d, 0x1f5d,
- 0x1f5f, 0x1f7d,
- 0x1f80, 0x1fb4,
- 0x1fb6, 0x1fbc,
- 0x1fbe, 0x1fbe,
- 0x1fc2, 0x1fc4,
- 0x1fc6, 0x1fcc,
- 0x1fd0, 0x1fd3,
- 0x1fd6, 0x1fdb,
- 0x1fe0, 0x1fec,
- 0x1ff2, 0x1ff4,
- 0x1ff6, 0x1ffc,
- 0x2071, 0x2071,
- 0x207f, 0x207f,
- 0x2090, 0x209c,
- 0x2102, 0x2102,
- 0x2107, 0x2107,
- 0x210a, 0x2113,
- 0x2115, 0x2115,
- 0x2119, 0x211d,
- 0x2124, 0x2124,
- 0x2126, 0x2126,
- 0x2128, 0x2128,
- 0x212a, 0x212d,
- 0x212f, 0x2139,
- 0x213c, 0x213f,
- 0x2145, 0x2149,
- 0x214e, 0x214e,
- 0x2160, 0x2188,
- 0x24b6, 0x24e9,
- 0x2c00, 0x2c2e,
- 0x2c30, 0x2c5e,
- 0x2c60, 0x2ce4,
- 0x2ceb, 0x2cee,
- 0x2d00, 0x2d25,
- 0x2d30, 0x2d65,
- 0x2d6f, 0x2d6f,
- 0x2d80, 0x2d96,
- 0x2da0, 0x2da6,
- 0x2da8, 0x2dae,
- 0x2db0, 0x2db6,
- 0x2db8, 0x2dbe,
- 0x2dc0, 0x2dc6,
- 0x2dc8, 0x2dce,
- 0x2dd0, 0x2dd6,
- 0x2dd8, 0x2dde,
- 0x2de0, 0x2dff,
- 0x2e2f, 0x2e2f,
- 0x3005, 0x3007,
- 0x3021, 0x3029,
- 0x3031, 0x3035,
- 0x3038, 0x303c,
- 0x3041, 0x3096,
- 0x309d, 0x309f,
- 0x30a1, 0x30fa,
- 0x30fc, 0x30ff,
- 0x3105, 0x312d,
- 0x3131, 0x318e,
- 0x31a0, 0x31ba,
- 0x31f0, 0x31ff,
- 0x3400, 0x4db5,
- 0x4e00, 0x9fcb,
- 0xa000, 0xa48c,
- 0xa4d0, 0xa4fd,
- 0xa500, 0xa60c,
- 0xa610, 0xa62b,
- 0xa640, 0xa66e,
- 0xa67f, 0xa697,
- 0xa6a0, 0xa6ef,
- 0xa717, 0xa71f,
- 0xa722, 0xa788,
- 0xa78b, 0xa78e,
- 0xa790, 0xa791,
- 0xa7a0, 0xa7a9,
- 0xa7fa, 0xa801,
- 0xa803, 0xa805,
- 0xa807, 0xa80a,
- 0xa80c, 0xa827,
- 0xa840, 0xa873,
- 0xa880, 0xa8c3,
- 0xa8d0, 0xa8d9,
- 0xa8f2, 0xa8f7,
- 0xa8fb, 0xa8fb,
- 0xa900, 0xa92a,
- 0xa930, 0xa952,
- 0xa960, 0xa97c,
- 0xa980, 0xa9b2,
- 0xa9b4, 0xa9bf,
- 0xa9cf, 0xa9d9,
- 0xaa00, 0xaa36,
- 0xaa40, 0xaa4d,
- 0xaa50, 0xaa59,
- 0xaa60, 0xaa76,
- 0xaa7a, 0xaa7a,
- 0xaa80, 0xaabe,
- 0xaac0, 0xaac0,
- 0xaac2, 0xaac2,
- 0xaadb, 0xaadd,
- 0xab01, 0xab06,
- 0xab09, 0xab0e,
- 0xab11, 0xab16,
- 0xab20, 0xab26,
- 0xab28, 0xab2e,
- 0xabc0, 0xabea,
- 0xabf0, 0xabf9,
- 0xac00, 0xd7a3,
- 0xd7b0, 0xd7c6,
- 0xd7cb, 0xd7fb,
- 0xf900, 0xfa2d,
- 0xfa30, 0xfa6d,
- 0xfa70, 0xfad9,
- 0xfb00, 0xfb06,
- 0xfb13, 0xfb17,
- 0xfb1d, 0xfb28,
- 0xfb2a, 0xfb36,
- 0xfb38, 0xfb3c,
- 0xfb3e, 0xfb3e,
- 0xfb40, 0xfb41,
- 0xfb43, 0xfb44,
- 0xfb46, 0xfbb1,
- 0xfbd3, 0xfd3d,
- 0xfd50, 0xfd8f,
- 0xfd92, 0xfdc7,
- 0xfdf0, 0xfdfb,
- 0xfe70, 0xfe74,
- 0xfe76, 0xfefc,
- 0xff10, 0xff19,
- 0xff21, 0xff3a,
- 0xff41, 0xff5a,
- 0xff66, 0xffbe,
- 0xffc2, 0xffc7,
- 0xffca, 0xffcf,
- 0xffd2, 0xffd7,
- 0xffda, 0xffdc,
- 0x10000, 0x1000b,
- 0x1000d, 0x10026,
- 0x10028, 0x1003a,
- 0x1003c, 0x1003d,
- 0x1003f, 0x1004d,
- 0x10050, 0x1005d,
- 0x10080, 0x100fa,
- 0x10140, 0x10174,
- 0x10280, 0x1029c,
- 0x102a0, 0x102d0,
- 0x10300, 0x1031e,
- 0x10330, 0x1034a,
- 0x10380, 0x1039d,
- 0x103a0, 0x103c3,
- 0x103c8, 0x103cf,
- 0x103d1, 0x103d5,
- 0x10400, 0x1049d,
- 0x104a0, 0x104a9,
- 0x10800, 0x10805,
- 0x10808, 0x10808,
- 0x1080a, 0x10835,
- 0x10837, 0x10838,
- 0x1083c, 0x1083c,
- 0x1083f, 0x10855,
- 0x10900, 0x10915,
- 0x10920, 0x10939,
- 0x10a00, 0x10a03,
- 0x10a05, 0x10a06,
- 0x10a0c, 0x10a13,
- 0x10a15, 0x10a17,
- 0x10a19, 0x10a33,
- 0x10a60, 0x10a7c,
- 0x10b00, 0x10b35,
- 0x10b40, 0x10b55,
- 0x10b60, 0x10b72,
- 0x10c00, 0x10c48,
- 0x11000, 0x11045,
- 0x11066, 0x1106f,
- 0x11082, 0x110b8,
- 0x12000, 0x1236e,
- 0x12400, 0x12462,
- 0x13000, 0x1342e,
- 0x16800, 0x16a38,
- 0x1b000, 0x1b001,
- 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, 0x1d6c0,
- 0x1d6c2, 0x1d6da,
- 0x1d6dc, 0x1d6fa,
- 0x1d6fc, 0x1d714,
- 0x1d716, 0x1d734,
- 0x1d736, 0x1d74e,
- 0x1d750, 0x1d76e,
- 0x1d770, 0x1d788,
- 0x1d78a, 0x1d7a8,
- 0x1d7aa, 0x1d7c2,
- 0x1d7c4, 0x1d7cb,
- 0x1d7ce, 0x1d7ff,
- 0x20000, 0x2a6d6,
- 0x2a700, 0x2b734,
- 0x2b740, 0x2b81d,
- 0x2f800, 0x2fa1d,
-}; /* CR_Alnum */
+/* 'In_Supplementary_Private_Use_Area_A': Block */
+static const OnigCodePoint CR_In_Supplementary_Private_Use_Area_A[] = {
+ 1,
+ 0xf0000, 0xfffff,
+}; /* CR_In_Supplementary_Private_Use_Area_A */
-/* 'ASCII': [[:ASCII:]] */
-static const OnigCodePoint CR_ASCII[] = {
+/* 'In_Supplementary_Private_Use_Area_B': Block */
+static const OnigCodePoint CR_In_Supplementary_Private_Use_Area_B[] = {
1,
- 0x0000, 0x007f,
-}; /* CR_ASCII */
+ 0x100000, 0x10ffff,
+}; /* CR_In_Supplementary_Private_Use_Area_B */
+
+/* 'In_No_Block': Block */
+static const OnigCodePoint CR_In_No_Block[] = {
+ 36,
+ 0x0860, 0x089f,
+ 0x1ab0, 0x1aff,
+ 0x1c80, 0x1cbf,
+ 0x2fe0, 0x2fef,
+ 0xa9e0, 0xa9ff,
+ 0xab30, 0xabbf,
+ 0x10200, 0x1027f,
+ 0x102e0, 0x102ff,
+ 0x10350, 0x1037f,
+ 0x103e0, 0x103ff,
+ 0x104b0, 0x107ff,
+ 0x10860, 0x108ff,
+ 0x10940, 0x1097f,
+ 0x10a80, 0x10aff,
+ 0x10b80, 0x10bff,
+ 0x10c50, 0x10e5f,
+ 0x10e80, 0x10fff,
+ 0x11150, 0x1117f,
+ 0x111e0, 0x1167f,
+ 0x116d0, 0x11fff,
+ 0x12480, 0x12fff,
+ 0x13430, 0x167ff,
+ 0x16a40, 0x16eff,
+ 0x16fa0, 0x1afff,
+ 0x1b100, 0x1cfff,
+ 0x1d250, 0x1d2ff,
+ 0x1d380, 0x1d3ff,
+ 0x1d800, 0x1edff,
+ 0x1ef00, 0x1efff,
+ 0x1f650, 0x1f67f,
+ 0x1f780, 0x1ffff,
+ 0x2a6e0, 0x2a6ff,
+ 0x2b820, 0x2f7ff,
+ 0x2fa20, 0xdffff,
+ 0xe0080, 0xe00ff,
+ 0xe01f0, 0xeffff,
+}; /* CR_In_No_Block */
+#endif /* USE_UNICODE_PROPERTIES */
static const OnigCodePoint* const CodeRanges[] = {
CR_NEWLINE,
@@ -21945,6 +25484,7 @@ static const OnigCodePoint* const CodeRanges[] = {
CR_Co,
CR_Cs,
CR_L,
+ CR_LC,
CR_Ll,
CR_Lm,
CR_Lo,
@@ -22089,6 +25629,13 @@ static const OnigCodePoint* const CodeRanges[] = {
CR_Batak,
CR_Brahmi,
CR_Mandaic,
+ CR_Chakma,
+ CR_Meroitic_Cursive,
+ CR_Meroitic_Hieroglyphs,
+ CR_Miao,
+ CR_Sharada,
+ CR_Sora_Sompeng,
+ CR_Takri,
CR_White_Space,
CR_Bidi_Control,
CR_Join_Control,
@@ -22134,6 +25681,228 @@ static const OnigCodePoint* const CodeRanges[] = {
CR_Age_5_1,
CR_Age_5_2,
CR_Age_6_0,
+ CR_Age_6_1,
+ CR_In_Basic_Latin,
+ CR_In_Latin_1_Supplement,
+ CR_In_Latin_Extended_A,
+ CR_In_Latin_Extended_B,
+ CR_In_IPA_Extensions,
+ CR_In_Spacing_Modifier_Letters,
+ CR_In_Combining_Diacritical_Marks,
+ CR_In_Greek_and_Coptic,
+ CR_In_Cyrillic,
+ CR_In_Cyrillic_Supplement,
+ CR_In_Armenian,
+ CR_In_Hebrew,
+ CR_In_Arabic,
+ CR_In_Syriac,
+ CR_In_Arabic_Supplement,
+ CR_In_Thaana,
+ CR_In_NKo,
+ CR_In_Samaritan,
+ CR_In_Mandaic,
+ CR_In_Arabic_Extended_A,
+ CR_In_Devanagari,
+ CR_In_Bengali,
+ CR_In_Gurmukhi,
+ CR_In_Gujarati,
+ CR_In_Oriya,
+ CR_In_Tamil,
+ CR_In_Telugu,
+ CR_In_Kannada,
+ CR_In_Malayalam,
+ CR_In_Sinhala,
+ CR_In_Thai,
+ CR_In_Lao,
+ CR_In_Tibetan,
+ CR_In_Myanmar,
+ CR_In_Georgian,
+ CR_In_Hangul_Jamo,
+ CR_In_Ethiopic,
+ CR_In_Ethiopic_Supplement,
+ CR_In_Cherokee,
+ CR_In_Unified_Canadian_Aboriginal_Syllabics,
+ CR_In_Ogham,
+ CR_In_Runic,
+ CR_In_Tagalog,
+ CR_In_Hanunoo,
+ CR_In_Buhid,
+ CR_In_Tagbanwa,
+ CR_In_Khmer,
+ CR_In_Mongolian,
+ CR_In_Unified_Canadian_Aboriginal_Syllabics_Extended,
+ CR_In_Limbu,
+ CR_In_Tai_Le,
+ CR_In_New_Tai_Lue,
+ CR_In_Khmer_Symbols,
+ CR_In_Buginese,
+ CR_In_Tai_Tham,
+ CR_In_Balinese,
+ CR_In_Sundanese,
+ CR_In_Batak,
+ CR_In_Lepcha,
+ CR_In_Ol_Chiki,
+ CR_In_Sundanese_Supplement,
+ CR_In_Vedic_Extensions,
+ CR_In_Phonetic_Extensions,
+ CR_In_Phonetic_Extensions_Supplement,
+ CR_In_Combining_Diacritical_Marks_Supplement,
+ CR_In_Latin_Extended_Additional,
+ CR_In_Greek_Extended,
+ CR_In_General_Punctuation,
+ CR_In_Superscripts_and_Subscripts,
+ CR_In_Currency_Symbols,
+ CR_In_Combining_Diacritical_Marks_for_Symbols,
+ CR_In_Letterlike_Symbols,
+ CR_In_Number_Forms,
+ CR_In_Arrows,
+ CR_In_Mathematical_Operators,
+ CR_In_Miscellaneous_Technical,
+ CR_In_Control_Pictures,
+ CR_In_Optical_Character_Recognition,
+ CR_In_Enclosed_Alphanumerics,
+ CR_In_Box_Drawing,
+ CR_In_Block_Elements,
+ CR_In_Geometric_Shapes,
+ CR_In_Miscellaneous_Symbols,
+ CR_In_Dingbats,
+ CR_In_Miscellaneous_Mathematical_Symbols_A,
+ CR_In_Supplemental_Arrows_A,
+ CR_In_Braille_Patterns,
+ CR_In_Supplemental_Arrows_B,
+ CR_In_Miscellaneous_Mathematical_Symbols_B,
+ CR_In_Supplemental_Mathematical_Operators,
+ CR_In_Miscellaneous_Symbols_and_Arrows,
+ CR_In_Glagolitic,
+ CR_In_Latin_Extended_C,
+ CR_In_Coptic,
+ CR_In_Georgian_Supplement,
+ CR_In_Tifinagh,
+ CR_In_Ethiopic_Extended,
+ CR_In_Cyrillic_Extended_A,
+ CR_In_Supplemental_Punctuation,
+ CR_In_CJK_Radicals_Supplement,
+ CR_In_Kangxi_Radicals,
+ CR_In_Ideographic_Description_Characters,
+ CR_In_CJK_Symbols_and_Punctuation,
+ CR_In_Hiragana,
+ CR_In_Katakana,
+ CR_In_Bopomofo,
+ CR_In_Hangul_Compatibility_Jamo,
+ CR_In_Kanbun,
+ CR_In_Bopomofo_Extended,
+ CR_In_CJK_Strokes,
+ CR_In_Katakana_Phonetic_Extensions,
+ CR_In_Enclosed_CJK_Letters_and_Months,
+ CR_In_CJK_Compatibility,
+ CR_In_CJK_Unified_Ideographs_Extension_A,
+ CR_In_Yijing_Hexagram_Symbols,
+ CR_In_CJK_Unified_Ideographs,
+ CR_In_Yi_Syllables,
+ CR_In_Yi_Radicals,
+ CR_In_Lisu,
+ CR_In_Vai,
+ CR_In_Cyrillic_Extended_B,
+ CR_In_Bamum,
+ CR_In_Modifier_Tone_Letters,
+ CR_In_Latin_Extended_D,
+ CR_In_Syloti_Nagri,
+ CR_In_Common_Indic_Number_Forms,
+ CR_In_Phags_pa,
+ CR_In_Saurashtra,
+ CR_In_Devanagari_Extended,
+ CR_In_Kayah_Li,
+ CR_In_Rejang,
+ CR_In_Hangul_Jamo_Extended_A,
+ CR_In_Javanese,
+ CR_In_Cham,
+ CR_In_Myanmar_Extended_A,
+ CR_In_Tai_Viet,
+ CR_In_Meetei_Mayek_Extensions,
+ CR_In_Ethiopic_Extended_A,
+ CR_In_Meetei_Mayek,
+ CR_In_Hangul_Syllables,
+ CR_In_Hangul_Jamo_Extended_B,
+ CR_In_High_Surrogates,
+ CR_In_High_Private_Use_Surrogates,
+ CR_In_Low_Surrogates,
+ CR_In_Private_Use_Area,
+ CR_In_CJK_Compatibility_Ideographs,
+ CR_In_Alphabetic_Presentation_Forms,
+ CR_In_Arabic_Presentation_Forms_A,
+ CR_In_Variation_Selectors,
+ CR_In_Vertical_Forms,
+ CR_In_Combining_Half_Marks,
+ CR_In_CJK_Compatibility_Forms,
+ CR_In_Small_Form_Variants,
+ CR_In_Arabic_Presentation_Forms_B,
+ CR_In_Halfwidth_and_Fullwidth_Forms,
+ CR_In_Specials,
+ CR_In_Linear_B_Syllabary,
+ CR_In_Linear_B_Ideograms,
+ CR_In_Aegean_Numbers,
+ CR_In_Ancient_Greek_Numbers,
+ CR_In_Ancient_Symbols,
+ CR_In_Phaistos_Disc,
+ CR_In_Lycian,
+ CR_In_Carian,
+ CR_In_Old_Italic,
+ CR_In_Gothic,
+ CR_In_Ugaritic,
+ CR_In_Old_Persian,
+ CR_In_Deseret,
+ CR_In_Shavian,
+ CR_In_Osmanya,
+ CR_In_Cypriot_Syllabary,
+ CR_In_Imperial_Aramaic,
+ CR_In_Phoenician,
+ CR_In_Lydian,
+ CR_In_Meroitic_Hieroglyphs,
+ CR_In_Meroitic_Cursive,
+ CR_In_Kharoshthi,
+ CR_In_Old_South_Arabian,
+ CR_In_Avestan,
+ CR_In_Inscriptional_Parthian,
+ CR_In_Inscriptional_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_Sharada,
+ CR_In_Takri,
+ CR_In_Cuneiform,
+ CR_In_Cuneiform_Numbers_and_Punctuation,
+ CR_In_Egyptian_Hieroglyphs,
+ CR_In_Bamum_Supplement,
+ CR_In_Miao,
+ CR_In_Kana_Supplement,
+ 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_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_Emoticons,
+ CR_In_Transport_And_Map_Symbols,
+ CR_In_Alchemical_Symbols,
+ CR_In_CJK_Unified_Ideographs_Extension_B,
+ CR_In_CJK_Unified_Ideographs_Extension_C,
+ CR_In_CJK_Unified_Ideographs_Extension_D,
+ CR_In_CJK_Compatibility_Ideographs_Supplement,
+ CR_In_Tags,
+ CR_In_Variation_Selectors_Supplement,
+ CR_In_Supplementary_Private_Use_Area_A,
+ CR_In_Supplementary_Private_Use_Area_B,
+ CR_In_No_Block,
#endif /* USE_UNICODE_PROPERTIES */
};
struct uniname2ctype_struct {
@@ -22144,7 +25913,6 @@ static const struct uniname2ctype_struct *uniname2ctype_p(const char *, unsigned
%}
struct uniname2ctype_struct;
%%
-newline, 0
alpha, 1
blank, 2
cntrl, 3
@@ -22169,225 +25937,233 @@ cn, 20
co, 21
cs, 22
l, 23
-ll, 24
-lm, 25
-lo, 26
-lt, 27
-lu, 28
-m, 29
-mc, 30
-me, 31
-mn, 32
-n, 33
-nd, 34
-nl, 35
-no, 36
-p, 37
-pc, 38
-pd, 39
-pe, 40
-pf, 41
-pi, 42
-po, 43
-ps, 44
-s, 45
-sc, 46
-sk, 47
-sm, 48
-so, 49
-z, 50
-zl, 51
-zp, 52
-zs, 53
-math, 54
-alphabetic, 55
-lowercase, 56
-uppercase, 57
-cased, 58
-caseignorable, 59
-changeswhenlowercased, 60
-changeswhenuppercased, 61
-changeswhentitlecased, 62
-changeswhencasefolded, 63
-changeswhencasemapped, 64
-idstart, 65
-idcontinue, 66
-xidstart, 67
-xidcontinue, 68
-defaultignorablecodepoint, 69
-graphemeextend, 70
-graphemebase, 71
-graphemelink, 72
-common, 73
-latin, 74
-greek, 75
-cyrillic, 76
-armenian, 77
-hebrew, 78
-arabic, 79
-syriac, 80
-thaana, 81
-devanagari, 82
-bengali, 83
-gurmukhi, 84
-gujarati, 85
-oriya, 86
-tamil, 87
-telugu, 88
-kannada, 89
-malayalam, 90
-sinhala, 91
-thai, 92
-lao, 93
-tibetan, 94
-myanmar, 95
-georgian, 96
-hangul, 97
-ethiopic, 98
-cherokee, 99
-canadianaboriginal, 100
-ogham, 101
-runic, 102
-khmer, 103
-mongolian, 104
-hiragana, 105
-katakana, 106
-bopomofo, 107
-han, 108
-yi, 109
-olditalic, 110
-gothic, 111
-deseret, 112
-inherited, 113
-tagalog, 114
-hanunoo, 115
-buhid, 116
-tagbanwa, 117
-limbu, 118
-taile, 119
-linearb, 120
-ugaritic, 121
-shavian, 122
-osmanya, 123
-cypriot, 124
-braille, 125
-buginese, 126
-coptic, 127
-newtailue, 128
-glagolitic, 129
-tifinagh, 130
-sylotinagri, 131
-oldpersian, 132
-kharoshthi, 133
-balinese, 134
-cuneiform, 135
-phoenician, 136
-phagspa, 137
-nko, 138
-sundanese, 139
-lepcha, 140
-olchiki, 141
-vai, 142
-saurashtra, 143
-kayahli, 144
-rejang, 145
-lycian, 146
-carian, 147
-lydian, 148
-cham, 149
-taitham, 150
-taiviet, 151
-avestan, 152
-egyptianhieroglyphs, 153
-samaritan, 154
-lisu, 155
-bamum, 156
-javanese, 157
-meeteimayek, 158
-imperialaramaic, 159
-oldsoutharabian, 160
-inscriptionalparthian, 161
-inscriptionalpahlavi, 162
-oldturkic, 163
-kaithi, 164
-batak, 165
-brahmi, 166
-mandaic, 167
-whitespace, 168
-bidicontrol, 169
-joincontrol, 170
-dash, 171
-hyphen, 172
-quotationmark, 173
-terminalpunctuation, 174
-othermath, 175
-hexdigit, 176
-asciihexdigit, 177
-otheralphabetic, 178
-ideographic, 179
-diacritic, 180
-extender, 181
-otherlowercase, 182
-otheruppercase, 183
-noncharactercodepoint, 184
-othergraphemeextend, 185
-idsbinaryoperator, 186
-idstrinaryoperator, 187
-radical, 188
-unifiedideograph, 189
-otherdefaultignorablecodepoint, 190
-deprecated, 191
-softdotted, 192
-logicalorderexception, 193
-otheridstart, 194
-otheridcontinue, 195
-sterm, 196
-variationselector, 197
-patternwhitespace, 198
-patternsyntax, 199
-unknown, 200
-ahex, 177
-bidic, 169
-ci, 59
-cwcf, 63
-cwcm, 64
-cwl, 60
-cwt, 62
-cwu, 61
-dep, 191
-di, 69
-dia, 180
-ext, 181
-grbase, 71
-grext, 70
-grlink, 72
-hex, 176
-idc, 66
-ideo, 179
-ids, 65
-idsb, 186
-idst, 187
-joinc, 170
-loe, 193
-nchar, 184
-oalpha, 178
-odi, 190
-ogrext, 185
-oidc, 195
-oids, 194
-olower, 182
-omath, 175
-oupper, 183
-patsyn, 199
-patws, 198
-qmark, 173
-sd, 192
-term, 174
-uideo, 189
-vs, 197
-wspace, 168
-xidc, 68
-xids, 67
+lc, 24
+ll, 25
+lm, 26
+lo, 27
+lt, 28
+lu, 29
+m, 30
+mc, 31
+me, 32
+mn, 33
+n, 34
+nd, 35
+nl, 36
+no, 37
+p, 38
+pc, 39
+pd, 40
+pe, 41
+pf, 42
+pi, 43
+po, 44
+ps, 45
+s, 46
+sc, 47
+sk, 48
+sm, 49
+so, 50
+z, 51
+zl, 52
+zp, 53
+zs, 54
+math, 55
+alphabetic, 56
+lowercase, 57
+uppercase, 58
+cased, 59
+caseignorable, 60
+changeswhenlowercased, 61
+changeswhenuppercased, 62
+changeswhentitlecased, 63
+changeswhencasefolded, 64
+changeswhencasemapped, 65
+idstart, 66
+idcontinue, 67
+xidstart, 68
+xidcontinue, 69
+defaultignorablecodepoint, 70
+graphemeextend, 71
+graphemebase, 72
+graphemelink, 73
+common, 74
+latin, 75
+greek, 76
+cyrillic, 77
+armenian, 78
+hebrew, 79
+arabic, 80
+syriac, 81
+thaana, 82
+devanagari, 83
+bengali, 84
+gurmukhi, 85
+gujarati, 86
+oriya, 87
+tamil, 88
+telugu, 89
+kannada, 90
+malayalam, 91
+sinhala, 92
+thai, 93
+lao, 94
+tibetan, 95
+myanmar, 96
+georgian, 97
+hangul, 98
+ethiopic, 99
+cherokee, 100
+canadianaboriginal, 101
+ogham, 102
+runic, 103
+khmer, 104
+mongolian, 105
+hiragana, 106
+katakana, 107
+bopomofo, 108
+han, 109
+yi, 110
+olditalic, 111
+gothic, 112
+deseret, 113
+inherited, 114
+tagalog, 115
+hanunoo, 116
+buhid, 117
+tagbanwa, 118
+limbu, 119
+taile, 120
+linearb, 121
+ugaritic, 122
+shavian, 123
+osmanya, 124
+cypriot, 125
+braille, 126
+buginese, 127
+coptic, 128
+newtailue, 129
+glagolitic, 130
+tifinagh, 131
+sylotinagri, 132
+oldpersian, 133
+kharoshthi, 134
+balinese, 135
+cuneiform, 136
+phoenician, 137
+phagspa, 138
+nko, 139
+sundanese, 140
+lepcha, 141
+olchiki, 142
+vai, 143
+saurashtra, 144
+kayahli, 145
+rejang, 146
+lycian, 147
+carian, 148
+lydian, 149
+cham, 150
+taitham, 151
+taiviet, 152
+avestan, 153
+egyptianhieroglyphs, 154
+samaritan, 155
+lisu, 156
+bamum, 157
+javanese, 158
+meeteimayek, 159
+imperialaramaic, 160
+oldsoutharabian, 161
+inscriptionalparthian, 162
+inscriptionalpahlavi, 163
+oldturkic, 164
+kaithi, 165
+batak, 166
+brahmi, 167
+mandaic, 168
+chakma, 169
+meroiticcursive, 170
+meroitichieroglyphs, 171
+miao, 172
+sharada, 173
+sorasompeng, 174
+takri, 175
+whitespace, 176
+bidicontrol, 177
+joincontrol, 178
+dash, 179
+hyphen, 180
+quotationmark, 181
+terminalpunctuation, 182
+othermath, 183
+hexdigit, 184
+asciihexdigit, 185
+otheralphabetic, 186
+ideographic, 187
+diacritic, 188
+extender, 189
+otherlowercase, 190
+otheruppercase, 191
+noncharactercodepoint, 192
+othergraphemeextend, 193
+idsbinaryoperator, 194
+idstrinaryoperator, 195
+radical, 196
+unifiedideograph, 197
+otherdefaultignorablecodepoint, 198
+deprecated, 199
+softdotted, 200
+logicalorderexception, 201
+otheridstart, 202
+otheridcontinue, 203
+sterm, 204
+variationselector, 205
+patternwhitespace, 206
+patternsyntax, 207
+unknown, 208
+ahex, 185
+bidic, 177
+ci, 60
+cwcf, 64
+cwcm, 65
+cwl, 61
+cwt, 63
+cwu, 62
+dep, 199
+di, 70
+dia, 188
+ext, 189
+grbase, 72
+grext, 71
+grlink, 73
+hex, 184
+idc, 67
+ideo, 187
+ids, 66
+idsb, 194
+idst, 195
+joinc, 178
+loe, 201
+nchar, 192
+oalpha, 186
+odi, 198
+ogrext, 193
+oidc, 203
+oids, 202
+olower, 190
+omath, 183
+oupper, 191
+patsyn, 207
+patws, 206
+qmark, 181
+sd, 200
+term, 182
+uideo, 197
+vs, 205
+wspace, 176
+xidc, 69
+xids, 68
other, 17
control, 18
format, 19
@@ -22395,143 +26171,374 @@ unassigned, 20
privateuse, 21
surrogate, 22
letter, 23
-lowercaseletter, 24
-modifierletter, 25
-otherletter, 26
-titlecaseletter, 27
-uppercaseletter, 28
-mark, 29
-spacingmark, 30
-enclosingmark, 31
-nonspacingmark, 32
-number, 33
-decimalnumber, 34
-letternumber, 35
-othernumber, 36
-punctuation, 37
-connectorpunctuation, 38
-dashpunctuation, 39
-closepunctuation, 40
-finalpunctuation, 41
-initialpunctuation, 42
-otherpunctuation, 43
-openpunctuation, 44
-symbol, 45
-currencysymbol, 46
-modifiersymbol, 47
-mathsymbol, 48
-othersymbol, 49
-separator, 50
-lineseparator, 51
-paragraphseparator, 52
-spaceseparator, 53
-arab, 79
-armi, 159
-armn, 77
-avst, 152
-bali, 134
-bamu, 156
-batk, 165
-beng, 83
-bopo, 107
-brah, 166
-brai, 125
-bugi, 126
-buhd, 116
-cans, 100
-cari, 147
-cher, 99
-copt, 127
-qaac, 127
-cprt, 124
-cyrl, 76
-deva, 82
-dsrt, 112
-egyp, 153
-ethi, 98
-geor, 96
-glag, 129
-goth, 111
-grek, 75
-gujr, 85
-guru, 84
-hang, 97
-hani, 108
-hano, 115
-hebr, 78
-hira, 105
-ital, 110
-java, 157
-kali, 144
-kana, 106
-khar, 133
-khmr, 103
-knda, 89
-kthi, 164
-lana, 150
-laoo, 93
-latn, 74
-lepc, 140
-limb, 118
-linb, 120
-lyci, 146
-lydi, 148
-mand, 167
-mlym, 90
-mong, 104
-mtei, 158
-mymr, 95
-nkoo, 138
-ogam, 101
-olck, 141
-orkh, 163
-orya, 86
-osma, 123
-phag, 137
-phli, 162
-phnx, 136
-prti, 161
-rjng, 145
-runr, 102
-samr, 154
-sarb, 160
-saur, 143
-shaw, 122
-sinh, 91
-sund, 139
-sylo, 131
-syrc, 80
-tagb, 117
-tale, 119
-talu, 128
-taml, 87
-tavt, 151
-telu, 88
-tfng, 130
-tglg, 114
-thaa, 81
-tibt, 94
-ugar, 121
-vaii, 142
-xpeo, 132
-xsux, 135
-yiii, 109
-zinh, 113
-qaai, 113
-zyyy, 73
-zzzz, 200
-age=1.1, 201
-age=2.0, 202
-age=2.1, 203
-age=3.0, 204
-age=3.1, 205
-age=3.2, 206
-age=4.0, 207
-age=4.1, 208
-age=5.0, 209
-age=5.1, 210
-age=5.2, 211
-age=6.0, 212
+casedletter, 24
+lowercaseletter, 25
+modifierletter, 26
+otherletter, 27
+titlecaseletter, 28
+uppercaseletter, 29
+mark, 30
+combiningmark, 30
+spacingmark, 31
+enclosingmark, 32
+nonspacingmark, 33
+number, 34
+decimalnumber, 35
+letternumber, 36
+othernumber, 37
+punctuation, 38
+connectorpunctuation, 39
+dashpunctuation, 40
+closepunctuation, 41
+finalpunctuation, 42
+initialpunctuation, 43
+otherpunctuation, 44
+openpunctuation, 45
+symbol, 46
+currencysymbol, 47
+modifiersymbol, 48
+mathsymbol, 49
+othersymbol, 50
+separator, 51
+lineseparator, 52
+paragraphseparator, 53
+spaceseparator, 54
+arab, 80
+armi, 160
+armn, 78
+avst, 153
+bali, 135
+bamu, 157
+batk, 166
+beng, 84
+bopo, 108
+brah, 167
+brai, 126
+bugi, 127
+buhd, 117
+cakm, 169
+cans, 101
+cari, 148
+cher, 100
+copt, 128
+qaac, 128
+cprt, 125
+cyrl, 77
+deva, 83
+dsrt, 113
+egyp, 154
+ethi, 99
+geor, 97
+glag, 130
+goth, 112
+grek, 76
+gujr, 86
+guru, 85
+hang, 98
+hani, 109
+hano, 116
+hebr, 79
+hira, 106
+ital, 111
+java, 158
+kali, 145
+kana, 107
+khar, 134
+khmr, 104
+knda, 90
+kthi, 165
+lana, 151
+laoo, 94
+latn, 75
+lepc, 141
+limb, 119
+linb, 121
+lyci, 147
+lydi, 149
+mand, 168
+merc, 170
+mero, 171
+mlym, 91
+mong, 105
+mtei, 159
+mymr, 96
+nkoo, 139
+ogam, 102
+olck, 142
+orkh, 164
+orya, 87
+osma, 124
+phag, 138
+phli, 163
+phnx, 137
+plrd, 172
+prti, 162
+rjng, 146
+runr, 103
+samr, 155
+sarb, 161
+saur, 144
+shaw, 123
+shrd, 173
+sinh, 92
+sora, 174
+sund, 140
+sylo, 132
+syrc, 81
+tagb, 118
+takr, 175
+tale, 120
+talu, 129
+taml, 88
+tavt, 152
+telu, 89
+tfng, 131
+tglg, 115
+thaa, 82
+tibt, 95
+ugar, 122
+vaii, 143
+xpeo, 133
+xsux, 136
+yiii, 110
+zinh, 114
+qaai, 114
+zyyy, 74
+zzzz, 208
+age=1.1, 209
+age=2.0, 210
+age=2.1, 211
+age=3.0, 212
+age=3.1, 213
+age=3.2, 214
+age=4.0, 215
+age=4.1, 216
+age=5.0, 217
+age=5.1, 218
+age=5.2, 219
+age=6.0, 220
+age=6.1, 221
+inbasiclatin, 222
+inlatin1supplement, 223
+inlatinextendeda, 224
+inlatinextendedb, 225
+inipaextensions, 226
+inspacingmodifierletters, 227
+incombiningdiacriticalmarks, 228
+ingreekandcoptic, 229
+incyrillic, 230
+incyrillicsupplement, 231
+inarmenian, 232
+inhebrew, 233
+inarabic, 234
+insyriac, 235
+inarabicsupplement, 236
+inthaana, 237
+innko, 238
+insamaritan, 239
+inmandaic, 240
+inarabicextendeda, 241
+indevanagari, 242
+inbengali, 243
+ingurmukhi, 244
+ingujarati, 245
+inoriya, 246
+intamil, 247
+intelugu, 248
+inkannada, 249
+inmalayalam, 250
+insinhala, 251
+inthai, 252
+inlao, 253
+intibetan, 254
+inmyanmar, 255
+ingeorgian, 256
+inhanguljamo, 257
+inethiopic, 258
+inethiopicsupplement, 259
+incherokee, 260
+inunifiedcanadianaboriginalsyllabics, 261
+inogham, 262
+inrunic, 263
+intagalog, 264
+inhanunoo, 265
+inbuhid, 266
+intagbanwa, 267
+inkhmer, 268
+inmongolian, 269
+inunifiedcanadianaboriginalsyllabicsextended, 270
+inlimbu, 271
+intaile, 272
+innewtailue, 273
+inkhmersymbols, 274
+inbuginese, 275
+intaitham, 276
+inbalinese, 277
+insundanese, 278
+inbatak, 279
+inlepcha, 280
+inolchiki, 281
+insundanesesupplement, 282
+invedicextensions, 283
+inphoneticextensions, 284
+inphoneticextensionssupplement, 285
+incombiningdiacriticalmarkssupplement, 286
+inlatinextendedadditional, 287
+ingreekextended, 288
+ingeneralpunctuation, 289
+insuperscriptsandsubscripts, 290
+incurrencysymbols, 291
+incombiningdiacriticalmarksforsymbols, 292
+inletterlikesymbols, 293
+innumberforms, 294
+inarrows, 295
+inmathematicaloperators, 296
+inmiscellaneoustechnical, 297
+incontrolpictures, 298
+inopticalcharacterrecognition, 299
+inenclosedalphanumerics, 300
+inboxdrawing, 301
+inblockelements, 302
+ingeometricshapes, 303
+inmiscellaneoussymbols, 304
+indingbats, 305
+inmiscellaneousmathematicalsymbolsa, 306
+insupplementalarrowsa, 307
+inbraillepatterns, 308
+insupplementalarrowsb, 309
+inmiscellaneousmathematicalsymbolsb, 310
+insupplementalmathematicaloperators, 311
+inmiscellaneoussymbolsandarrows, 312
+inglagolitic, 313
+inlatinextendedc, 314
+incoptic, 315
+ingeorgiansupplement, 316
+intifinagh, 317
+inethiopicextended, 318
+incyrillicextendeda, 319
+insupplementalpunctuation, 320
+incjkradicalssupplement, 321
+inkangxiradicals, 322
+inideographicdescriptioncharacters, 323
+incjksymbolsandpunctuation, 324
+inhiragana, 325
+inkatakana, 326
+inbopomofo, 327
+inhangulcompatibilityjamo, 328
+inkanbun, 329
+inbopomofoextended, 330
+incjkstrokes, 331
+inkatakanaphoneticextensions, 332
+inenclosedcjklettersandmonths, 333
+incjkcompatibility, 334
+incjkunifiedideographsextensiona, 335
+inyijinghexagramsymbols, 336
+incjkunifiedideographs, 337
+inyisyllables, 338
+inyiradicals, 339
+inlisu, 340
+invai, 341
+incyrillicextendedb, 342
+inbamum, 343
+inmodifiertoneletters, 344
+inlatinextendedd, 345
+insylotinagri, 346
+incommonindicnumberforms, 347
+inphagspa, 348
+insaurashtra, 349
+indevanagariextended, 350
+inkayahli, 351
+inrejang, 352
+inhanguljamoextendeda, 353
+injavanese, 354
+incham, 355
+inmyanmarextendeda, 356
+intaiviet, 357
+inmeeteimayekextensions, 358
+inethiopicextendeda, 359
+inmeeteimayek, 360
+inhangulsyllables, 361
+inhanguljamoextendedb, 362
+inhighsurrogates, 363
+inhighprivateusesurrogates, 364
+inlowsurrogates, 365
+inprivateusearea, 366
+incjkcompatibilityideographs, 367
+inalphabeticpresentationforms, 368
+inarabicpresentationformsa, 369
+invariationselectors, 370
+inverticalforms, 371
+incombininghalfmarks, 372
+incjkcompatibilityforms, 373
+insmallformvariants, 374
+inarabicpresentationformsb, 375
+inhalfwidthandfullwidthforms, 376
+inspecials, 377
+inlinearbsyllabary, 378
+inlinearbideograms, 379
+inaegeannumbers, 380
+inancientgreeknumbers, 381
+inancientsymbols, 382
+inphaistosdisc, 383
+inlycian, 384
+incarian, 385
+inolditalic, 386
+ingothic, 387
+inugaritic, 388
+inoldpersian, 389
+indeseret, 390
+inshavian, 391
+inosmanya, 392
+incypriotsyllabary, 393
+inimperialaramaic, 394
+inphoenician, 395
+inlydian, 396
+inmeroitichieroglyphs, 397
+inmeroiticcursive, 398
+inkharoshthi, 399
+inoldsoutharabian, 400
+inavestan, 401
+ininscriptionalparthian, 402
+ininscriptionalpahlavi, 403
+inoldturkic, 404
+inruminumeralsymbols, 405
+inbrahmi, 406
+inkaithi, 407
+insorasompeng, 408
+inchakma, 409
+insharada, 410
+intakri, 411
+incuneiform, 412
+incuneiformnumbersandpunctuation, 413
+inegyptianhieroglyphs, 414
+inbamumsupplement, 415
+inmiao, 416
+inkanasupplement, 417
+inbyzantinemusicalsymbols, 418
+inmusicalsymbols, 419
+inancientgreekmusicalnotation, 420
+intaixuanjingsymbols, 421
+incountingrodnumerals, 422
+inmathematicalalphanumericsymbols, 423
+inarabicmathematicalalphabeticsymbols, 424
+inmahjongtiles, 425
+indominotiles, 426
+inplayingcards, 427
+inenclosedalphanumericsupplement, 428
+inenclosedideographicsupplement, 429
+inmiscellaneoussymbolsandpictographs, 430
+inemoticons, 431
+intransportandmapsymbols, 432
+inalchemicalsymbols, 433
+incjkunifiedideographsextensionb, 434
+incjkunifiedideographsextensionc, 435
+incjkunifiedideographsextensiond, 436
+incjkcompatibilityideographssupplement, 437
+intags, 438
+invariationselectorssupplement, 439
+insupplementaryprivateuseareaa, 440
+insupplementaryprivateuseareab, 441
+innoblock, 442
#endif /* USE_UNICODE_PROPERTIES */
%%
static int
diff --git a/enc/us_ascii.c b/enc/us_ascii.c
index 2e96dd3846..1b47778391 100644
--- a/enc/us_ascii.c
+++ b/enc/us_ascii.c
@@ -24,7 +24,9 @@ OnigEncodingDefine(us_ascii, US_ASCII) = {
onigenc_ascii_is_code_ctype,
onigenc_not_support_get_ctype_code_range,
onigenc_single_byte_left_adjust_char_head,
- onigenc_always_true_is_allowed_reverse_match
+ onigenc_always_true_is_allowed_reverse_match,
+ 0,
+ ONIGENC_FLAG_NONE,
};
ENC_ALIAS("ASCII", "US-ASCII")
ENC_ALIAS("ANSI_X3.4-1968", "US-ASCII")
diff --git a/enc/utf_16_32.h b/enc/utf_16_32.h
index b028a1a12e..da58d1b23c 100644
--- a/enc/utf_16_32.h
+++ b/enc/utf_16_32.h
@@ -1,4 +1,5 @@
#include "regenc.h"
/* dummy for unsupported, statefull encoding */
-ENC_DUMMY("UTF-16");
-ENC_DUMMY("UTF-32");
+#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 1e33c2ec7d..8b25d473a7 100644
--- a/enc/utf_16be.c
+++ b/enc/utf_16be.c
@@ -88,11 +88,8 @@ utf16be_is_mbc_newline(const UChar* p, const UChar* end,
if (*(p+1) == 0x0a && *p == 0x00)
return 1;
#ifdef USE_UNICODE_ALL_LINE_TERMINATORS
- if ((
-#ifndef USE_CRNL_AS_LINE_TERMINATOR
- *(p+1) == 0x0d ||
-#endif
- *(p+1) == 0x85) && *p == 0x00)
+ if ((*(p+1) == 0x0b || *(p+1) == 0x0c || *(p+1) == 0x0d || *(p+1) == 0x85)
+ && *p == 0x00)
return 1;
if (*p == 0x20 && (*(p+1) == 0x29 || *(p+1) == 0x28))
return 1;
@@ -252,6 +249,8 @@ OnigEncodingDefine(utf_16be, UTF_16BE) = {
onigenc_unicode_is_code_ctype,
onigenc_utf16_32_get_ctype_code_range,
utf16be_left_adjust_char_head,
- onigenc_always_false_is_allowed_reverse_match
+ onigenc_always_false_is_allowed_reverse_match,
+ 0,
+ ONIGENC_FLAG_UNICODE,
};
ENC_ALIAS("UCS-2BE", "UTF-16BE")
diff --git a/enc/utf_16le.c b/enc/utf_16le.c
index e972cb95f0..8feb7ad769 100644
--- a/enc/utf_16le.c
+++ b/enc/utf_16le.c
@@ -81,11 +81,8 @@ utf16le_is_mbc_newline(const UChar* p, const UChar* end,
if (*p == 0x0a && *(p+1) == 0x00)
return 1;
#ifdef USE_UNICODE_ALL_LINE_TERMINATORS
- if ((
-#ifndef USE_CRNL_AS_LINE_TERMINATOR
- *p == 0x0d ||
-#endif
- *p == 0x85) && *(p+1) == 0x00)
+ if ((*p == 0x0b || *p == 0x0c || *p == 0x0d || *p == 0x85)
+ && *(p+1) == 0x00)
return 1;
if (*(p+1) == 0x20 && (*p == 0x29 || *p == 0x28))
return 1;
@@ -245,5 +242,7 @@ OnigEncodingDefine(utf_16le, UTF_16LE) = {
onigenc_unicode_is_code_ctype,
onigenc_utf16_32_get_ctype_code_range,
utf16le_left_adjust_char_head,
- onigenc_always_false_is_allowed_reverse_match
+ onigenc_always_false_is_allowed_reverse_match,
+ 0,
+ ONIGENC_FLAG_UNICODE,
};
diff --git a/enc/utf_32be.c b/enc/utf_32be.c
index 2671448d44..43c07e2e8f 100644
--- a/enc/utf_32be.c
+++ b/enc/utf_32be.c
@@ -44,11 +44,7 @@ utf32be_is_mbc_newline(const UChar* p, const UChar* end,
if (*(p+3) == 0x0a && *(p+2) == 0 && *(p+1) == 0 && *p == 0)
return 1;
#ifdef USE_UNICODE_ALL_LINE_TERMINATORS
- if ((
-#ifndef USE_CRNL_AS_LINE_TERMINATOR
- *(p+3) == 0x0d ||
-#endif
- *(p+3) == 0x85)
+ if ((*(p+3) == 0x0b || *(p+3) == 0x0c || *(p+3) == 0x0d || *(p+3) == 0x85)
&& *(p+2) == 0 && *(p+1) == 0 && *p == 0x00)
return 1;
if (*(p+2) == 0x20 && (*(p+3) == 0x29 || *(p+3) == 0x28)
@@ -159,7 +155,7 @@ utf32be_left_adjust_char_head(const UChar* start, const UChar* s, const UChar* e
if (s <= start) return (UChar* )s;
- rem = (s - start) % 4;
+ rem = (int )((s - start) % 4);
return (UChar* )(s - rem);
}
@@ -189,7 +185,9 @@ OnigEncodingDefine(utf_32be, UTF_32BE) = {
onigenc_unicode_is_code_ctype,
onigenc_utf16_32_get_ctype_code_range,
utf32be_left_adjust_char_head,
- onigenc_always_false_is_allowed_reverse_match
+ onigenc_always_false_is_allowed_reverse_match,
+ 0,
+ ONIGENC_FLAG_UNICODE,
};
ENC_ALIAS("UCS-4BE", "UTF-32BE")
diff --git a/enc/utf_32le.c b/enc/utf_32le.c
index aa448200c6..31693eed05 100644
--- a/enc/utf_32le.c
+++ b/enc/utf_32le.c
@@ -44,11 +44,7 @@ utf32le_is_mbc_newline(const UChar* p, const UChar* end,
if (*p == 0x0a && *(p+1) == 0 && *(p+2) == 0 && *(p+3) == 0)
return 1;
#ifdef USE_UNICODE_ALL_LINE_TERMINATORS
- if ((
-#ifndef USE_CRNL_AS_LINE_TERMINATOR
- *p == 0x0d ||
-#endif
- *p == 0x85)
+ if ((*p == 0x0b ||*p == 0x0c ||*p == 0x0d || *p == 0x85)
&& *(p+1) == 0x00 && (p+2) == 0x00 && *(p+3) == 0x00)
return 1;
if (*(p+1) == 0x20 && (*p == 0x29 || *p == 0x28)
@@ -159,7 +155,7 @@ utf32le_left_adjust_char_head(const UChar* start, const UChar* s, const UChar* e
if (s <= start) return (UChar* )s;
- rem = (s - start) % 4;
+ rem = (int )((s - start) % 4);
return (UChar* )(s - rem);
}
@@ -189,6 +185,8 @@ OnigEncodingDefine(utf_32le, UTF_32LE) = {
onigenc_unicode_is_code_ctype,
onigenc_utf16_32_get_ctype_code_range,
utf32le_left_adjust_char_head,
- onigenc_always_false_is_allowed_reverse_match
+ onigenc_always_false_is_allowed_reverse_match,
+ 0,
+ ONIGENC_FLAG_UNICODE,
};
ENC_ALIAS("UCS-4LE", "UTF-32LE")
diff --git a/enc/utf_8.c b/enc/utf_8.c
index 83f8701205..dae1f3a1bc 100644
--- a/enc/utf_8.c
+++ b/enc/utf_8.c
@@ -248,9 +248,7 @@ is_mbc_newline(const UChar* p, const UChar* end, OnigEncoding enc)
if (*p == 0x0a) return 1;
#ifdef USE_UNICODE_ALL_LINE_TERMINATORS
-#ifndef USE_CRNL_AS_LINE_TERMINATOR
- if (*p == 0x0d) return 1;
-#endif
+ if (*p == 0x0b || *p == 0x0c || *p == 0x0d) return 1;
if (p + 1 < end) {
if (*(p+1) == 0x85 && *p == 0xc2) /* U+0085 */
return 1;
@@ -272,7 +270,7 @@ mbc_to_code(const UChar* p, const UChar* end, OnigEncoding enc)
int c, len;
OnigCodePoint n;
- len = enclen(enc, p, end);
+ len = mbc_enc_len(p, end, enc);
c = *p++;
if (len > 1) {
len--;
@@ -363,7 +361,7 @@ code_to_mbc(OnigCodePoint code, UChar *buf, OnigEncoding enc ARG_UNUSED)
}
*p++ = UTF8_TRAIL0(code);
- return (int)(p - buf);
+ return (int )(p - buf);
}
}
@@ -440,7 +438,9 @@ OnigEncodingDefine(utf_8, UTF_8) = {
onigenc_unicode_is_code_ctype,
get_ctype_code_range,
left_adjust_char_head,
- onigenc_always_true_is_allowed_reverse_match
+ onigenc_always_true_is_allowed_reverse_match,
+ 0,
+ ONIGENC_FLAG_UNICODE,
};
ENC_ALIAS("CP65001", "UTF-8")
diff --git a/enc/windows_1251.c b/enc/windows_1251.c
index 1cb4da4960..73060962c3 100644
--- a/enc/windows_1251.c
+++ b/enc/windows_1251.c
@@ -196,7 +196,9 @@ OnigEncodingDefine(windows_1251, Windows_1251) = {
cp1251_is_code_ctype,
onigenc_not_support_get_ctype_code_range,
onigenc_single_byte_left_adjust_char_head,
- onigenc_always_true_is_allowed_reverse_match
+ onigenc_always_true_is_allowed_reverse_match,
+ 0,
+ ONIGENC_FLAG_NONE,
};
/*
* Name: windows-1251
diff --git a/enc/windows_31j.c b/enc/windows_31j.c
new file mode 100644
index 0000000000..c4193819d4
--- /dev/null
+++ b/enc/windows_31j.c
@@ -0,0 +1,80 @@
+/**********************************************************************
+ cp932.c - Onigmo (Oniguruma-mod) (regular expression library)
+**********************************************************************/
+/*-
+ * Copyright (c) 2002-2009 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
+ * Copyright (c) 2011 K.Takata <kentkt AT csc DOT jp>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * 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.
+ */
+
+#define ENC_CP932
+#include "shift_jis.c"
+
+OnigEncodingDefine(windows_31j, Windows_31J) = {
+ mbc_enc_len,
+ "Windows-31J", /* name */
+ 2, /* max byte length */
+ 1, /* min byte length */
+ onigenc_is_mbc_newline_0x0a,
+ mbc_to_code,
+ code_to_mbclen,
+ code_to_mbc,
+ mbc_case_fold,
+ apply_all_case_fold,
+ get_case_fold_codes_by_str,
+ property_name_to_ctype,
+ is_code_ctype,
+ get_ctype_code_range,
+ left_adjust_char_head,
+ is_allowed_reverse_match,
+ 0,
+ ONIGENC_FLAG_NONE,
+};
+/*
+ * Name: Windows-31J
+ * MIBenum: 2024
+ * Link: http://www.iana.org/assignments/character-sets
+ * Link: http://www.microsoft.com/globaldev/reference/dbcs/932.mspx
+ * Link: http://ja.wikipedia.org/wiki/Windows-31J
+ * Link: http://source.icu-project.org/repos/icu/data/trunk/charset/data/ucm/windows-932-2000.ucm
+ *
+ * Windows Standard Character Set and its mapping to Unicode by Microsoft.
+ * Since 1.9.3, SJIS is the alias of Windows-31J because its character
+ * set is usually this one even if its mapping may differ.
+ */
+ENC_ALIAS("CP932", "Windows-31J")
+ENC_ALIAS("csWindows31J", "Windows-31J") /* IANA. IE6 don't accept Windows-31J but csWindows31J. */
+ENC_ALIAS("SJIS", "Windows-31J")
+
+/*
+ * Name: PCK
+ * Link: http://download.oracle.com/docs/cd/E19253-01/819-0606/x-2chn0/index.html
+ * Link: http://download.oracle.com/docs/cd/E19253-01/819-0606/appb-pckwarn-1/index.html
+ *
+ * Solaris's SJIS variant. Its set is Windows Standard Character Set; it
+ * consists JIS X 0201 Latin (US-ASCII), JIS X 0201 Katakana, JIS X 0208, NEC
+ * special characters, NEC-selected IBM extended characters, and IBM extended
+ * characters. Solaris's iconv seems to use SJIS-open.
+ */
+ENC_ALIAS("PCK", "Windows-31J")
diff --git a/encoding.c b/encoding.c
index b8c5f6d357..fa6e5afaa7 100644
--- a/encoding.c
+++ b/encoding.c
@@ -14,24 +14,22 @@
#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
+
#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);
int rb_encdb_alias(const char *alias, const char *orig);
+void rb_encdb_set_unicode(int index);
#pragma GCC visibility pop
#endif
@@ -73,9 +71,11 @@ 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)
@@ -124,21 +124,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) != index) {
+ 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
@@ -159,8 +185,9 @@ rb_to_encoding_index(VALUE enc)
return rb_enc_find_index(StringValueCStr(enc));
}
-static rb_encoding *
-to_encoding(VALUE enc)
+/* Returns encoding index or UNSPECIFIED_ENCODING */
+static int
+str_find_encindex(VALUE enc)
{
int idx;
@@ -169,17 +196,40 @@ to_encoding(VALUE enc)
rb_raise(rb_eArgError, "invalid name encoding (non ASCII)");
}
idx = rb_enc_find_index(StringValueCStr(enc));
+ return idx;
+}
+
+static int
+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 rb_enc_from_index(idx);
+ return idx;
+}
+
+static rb_encoding *
+str_to_encoding(VALUE enc)
+{
+ return rb_enc_from_index(str_to_encindex(enc));
}
rb_encoding *
rb_to_encoding(VALUE enc)
{
if (enc_check_encoding(enc) >= 0) return RDATA(enc)->data;
- return to_encoding(enc);
+ return str_to_encoding(enc);
+}
+
+rb_encoding *
+rb_find_encoding(VALUE enc)
+{
+ int idx;
+ if (enc_check_encoding(enc) >= 0) return RDATA(enc)->data;
+ idx = str_find_encindex(enc);
+ if (idx < 0) return NULL;
+ return rb_enc_from_index(idx);
}
void
@@ -314,6 +364,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(enc);
+ return index;
+}
+
int
rb_enc_replicate(const char *name, rb_encoding *encoding)
{
@@ -408,7 +470,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;
}
/*
@@ -424,7 +486,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;
}
/*
@@ -433,8 +495,13 @@ enc_ascii_compatible_p(VALUE enc)
int
rb_enc_unicode_p(rb_encoding *enc)
{
- const char *name = rb_enc_name(enc);
- return name[0] == 'U' && name[1] == 'T' && name[2] == 'F' && name[4] != '7';
+ return ONIGENC_IS_UNICODE(enc);
+}
+
+static st_data_t
+enc_dup_name(st_data_t name)
+{
+ return (st_data_t)strdup((const char *)name);
}
/*
@@ -445,7 +512,7 @@ static int
enc_alias_internal(const char *alias, int idx)
{
return st_insert2(enc_table.names, (st_data_t)alias, (st_data_t)idx,
- (st_data_t(*)(st_data_t))strdup);
+ enc_dup_name);
}
static int
@@ -483,12 +550,11 @@ rb_encdb_alias(const char *alias, const char *orig)
return enc_alias(alias, idx);
}
-enum {
- ENCINDEX_ASCII,
- ENCINDEX_UTF_8,
- ENCINDEX_US_ASCII,
- ENCINDEX_BUILTIN_MAX
-};
+void
+rb_encdb_set_unicode(int index)
+{
+ rb_enc_from_index(index)->flags |= ONIGENC_FLAG_UNICODE;
+}
extern rb_encoding OnigEncodingUTF_8;
extern rb_encoding OnigEncodingUS_ASCII;
@@ -505,6 +571,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;
}
@@ -546,23 +624,25 @@ load_encoding(const char *name)
VALUE enclib = rb_sprintf("enc/%s.so", name);
VALUE verbose = ruby_verbose;
VALUE debug = ruby_debug;
+ VALUE errinfo;
VALUE loaded;
char *s = RSTRING_PTR(enclib) + 4, *e = RSTRING_END(enclib) - 3;
int idx;
while (s < e) {
if (!ISALNUM(*s)) *s = '_';
- else if (ISUPPER(*s)) *s = TOLOWER(*s);
+ 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;
+ errinfo = rb_errinfo();
loaded = rb_protect(require_enc, enclib, 0);
ruby_verbose = verbose;
ruby_debug = debug;
- rb_set_errinfo(Qnil);
+ rb_set_errinfo(errinfo);
if (NIL_P(loaded)) return -1;
if ((idx = rb_enc_registered(name)) < 0) return -1;
if (enc_autoload_p(enc_table.list[idx].enc)) return -1;
@@ -583,8 +663,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);
+ enc->ruby_encoding_index = i;
}
else {
i = load_encoding(rb_enc_name(enc));
@@ -592,6 +673,7 @@ enc_autoload(rb_encoding *enc)
return i;
}
+/* Return encoding index or UNSPECIFIED_ENCODING from encoding name */
int
rb_enc_find_index(const char *name)
{
@@ -702,23 +784,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;
}
@@ -830,11 +923,11 @@ rb_enc_copy(VALUE obj1, VALUE obj2)
VALUE
rb_obj_encoding(VALUE obj)
{
- rb_encoding *enc = rb_enc_get(obj);
- if (!enc) {
+ int idx = rb_enc_get_index(obj);
+ if (idx < 0) {
rb_raise(rb_eTypeError, "unknown encoding");
}
- return rb_enc_from_encoding(enc);
+ return rb_enc_from_encoding_index(idx);
}
int
@@ -897,12 +990,11 @@ rb_enc_codepoint_len(const char *p, const char *e, int *len_p, rb_encoding *enc)
if (e <= p)
rb_raise(rb_eArgError, "empty string");
r = rb_enc_precise_mbclen(p, e, enc);
- if (MBCLEN_CHARFOUND_P(r)) {
- if (len_p) *len_p = MBCLEN_CHARFOUND_LEN(r);
- return rb_enc_mbc_to_codepoint(p, e, enc);
- }
- else
+ if (!MBCLEN_CHARFOUND_P(r)) {
rb_raise(rb_eArgError, "invalid byte sequence in %s", rb_enc_name(enc));
+ }
+ if (len_p) *len_p = MBCLEN_CHARFOUND_LEN(r);
+ return rb_enc_mbc_to_codepoint(p, e, enc);
}
#undef rb_enc_codepoint
@@ -922,6 +1014,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)
{
@@ -946,16 +1045,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.
*
@@ -1052,7 +1160,12 @@ enc_list(VALUE klass)
static VALUE
enc_find(VALUE klass, VALUE enc)
{
- return rb_enc_from_encoding(rb_to_encoding(enc));
+ int idx;
+ if (is_obj_encoding(enc))
+ return enc;
+ idx = str_to_encindex(enc);
+ if (idx == UNSPECIFIED_ENCODING) return Qnil;
+ return rb_enc_from_encoding_index(idx);
}
/*
@@ -1158,11 +1271,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;
}
@@ -1173,31 +1292,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;
}
@@ -1214,6 +1314,8 @@ struct default_encoding {
static struct default_encoding default_external = {0};
+extern int Init_enc_set_filesystem_encoding(void);
+
static int
enc_set_default_encoding(struct default_encoding *def, VALUE encoding, const char *name)
{
@@ -1236,7 +1338,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;
}
@@ -1309,7 +1411,7 @@ rb_enc_set_default_external(VALUE encoding)
*
* Sets default external encoding. You should not set
* Encoding::default_external in ruby code as strings created before changing
- * the value may have a different encoding from strings created after thevalue
+ * the value may have a different encoding from strings created after the value
* was changed., instead you should use <tt>ruby -E</tt> to invoke ruby with
* the correct default_external.
*
@@ -1433,29 +1535,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 *nl_langinfo_codeset(void);
- const char *codeset = nl_langinfo_codeset();
- char cp[sizeof(int) * 3 + 4];
- 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)
@@ -1587,6 +1667,206 @@ rb_enc_aliases(VALUE klass)
return aliases[0];
}
+/*
+ * An Encoding instance represents a character encoding usable in Ruby. It is
+ * defined as a constant under the Encoding namespace. It has a name and
+ * optionally, aliases:
+ *
+ * Encoding::ISO_8859_1.name
+ * #=> #<Encoding:ISO-8859-1>
+ *
+ * Encoding::ISO_8859_1.names
+ * #=> ["ISO-8859-1", "ISO8859-1"]
+ *
+ * Ruby methods dealing with encodings return or accept Encoding instances as
+ * arguments (when a method accepts an Encoding instance as an argument, it
+ * can be passed an Encoding name or alias instead).
+ *
+ * "some string".encoding
+ * #=> #<Encoding:UTF-8>
+ *
+ * string = "some string".encode(Encoding::ISO_8859_1)
+ * #=> "some string"
+ * string.encoding
+ * #=> #<Encoding:ISO-8859-1>
+ *
+ * "some string".encode "ISO-8859-1"
+ * #=> "some string"
+ *
+ * <code>Encoding::ASCII_8BIT</code> is a special encoding that is usually
+ * used for a byte string, not a character string. But as the name insists,
+ * its characters in the range of ASCII are considered as ASCII characters.
+ * This is useful when you use ASCII-8BIT characters with other ASCII
+ * compatible characters.
+ *
+ * == Changing an encoding
+ *
+ * The associated Encoding of a String can be changed in two different ways.
+ *
+ * First, it is possible to set the Encoding of a string to a new Encoding
+ * without changing the internal byte representation of the string, with
+ * String#force_encoding. This is how you can tell Ruby the correct encoding
+ * of a string.
+ *
+ * string
+ * #=> "R\xC3\xA9sum\xC3\xA9"
+ * string.encoding
+ * #=> #<Encoding:ISO-8859-1>
+ * string.force_encoding(Encoding::UTF_8)
+ * #=> "R\u00E9sum\u00E9"
+ *
+ * Second, it is possible to transcode a string, i.e. translate its internal
+ * byte representation to another encoding. Its associated encoding is also
+ * set to the other encoding. See String#encode for the various forms of
+ * transcoding, and the Encoding::Converter class for additional control over
+ * the transcoding process.
+ *
+ * string
+ * #=> "R\u00E9sum\u00E9"
+ * string.encoding
+ * #=> #<Encoding:UTF-8>
+ * string = string.encode!(Encoding::ISO_8859_1)
+ * #=> "R\xE9sum\xE9"
+ * string.encoding
+ * #=> #<Encoding::ISO-8859-1>
+ *
+ * == Script encoding
+ *
+ * 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::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
+ * by a colon, space and the Encoding name or alias:
+ *
+ * # encoding: UTF-8
+ *
+ * "some string".encoding
+ * #=> #<Encoding:UTF-8>
+ *
+ * The <code>__ENCODING__</code> keyword returns the script encoding of the file
+ * which the keyword is written:
+ *
+ * # encoding: ISO-8859-1
+ *
+ * __ENCODING__
+ * #=> #<Encoding:ISO-8859-1>
+ *
+ * <code>ruby -K</code> will change the default locale encoding, but this is
+ * not recommended. Ruby source files should declare its script encoding by a
+ * magic comment even when they only depend on US-ASCII strings or regular
+ * expressions.
+ *
+ * == Locale encoding
+ *
+ * The default encoding of the environment. Usually derived from locale.
+ *
+ * see Encoding.locale_charmap, Encoding.find('locale')
+ *
+ * == Filesystem encoding
+ *
+ * The default encoding of strings from the filesystem of the environment.
+ * This is used for strings of file names or paths.
+ *
+ * see Encoding.find('filesystem')
+ *
+ * == External encoding
+ *
+ * Each IO object has an external encoding which indicates the encoding that
+ * Ruby will use to read its data. By default Ruby sets the external encoding
+ * of an IO object to the default external encoding. The default external
+ * encoding is set by locale encoding or the interpreter <code>-E</code> option.
+ * Encoding.default_external returns the current value of the external
+ * encoding.
+ *
+ * ENV["LANG"]
+ * #=> "UTF-8"
+ * Encoding.default_external
+ * #=> #<Encoding:UTF-8>
+ *
+ * $ ruby -E ISO-8859-1 -e "p Encoding.default_external"
+ * #<Encoding:ISO-8859-1>
+ *
+ * $ LANG=C ruby -e 'p Encoding.default_external'
+ * #<Encoding:US-ASCII>
+ *
+ * The default external encoding may also be set through
+ * Encoding.default_external=, but you should not do this as strings created
+ * before and after the change will have inconsistent encodings. Instead use
+ * <code>ruby -E</code> to invoke ruby with the correct external encoding.
+ *
+ * When you know that the actual encoding of the data of an IO object is not
+ * the default external encoding, you can reset its external encoding with
+ * IO#set_encoding or set it at IO object creation (see IO.new options).
+ *
+ * == Internal encoding
+ *
+ * To process the data of an IO object which has an encoding different
+ * from its external encoding, you can set its internal encoding. Ruby will use
+ * this internal encoding to transcode the data when it is read from the IO
+ * object.
+ *
+ * Conversely, when data is written to the IO object it is transcoded from the
+ * internal encoding to the external encoding of the IO object.
+ *
+ * The internal encoding of an IO object can be set with
+ * IO#set_encoding or at IO object creation (see IO.new options).
+ *
+ * The internal encoding is optional and when not set, the Ruby default
+ * internal encoding is used. If not explicitly set this default internal
+ * encoding is +nil+ meaning that by default, no transcoding occurs.
+ *
+ * The default internal encoding can be set with the interpreter option
+ * <code>-E</code>. Encoding.default_internal returns the current internal
+ * encoding.
+ *
+ * $ ruby -e 'p Encoding.default_internal'
+ * nil
+ *
+ * $ ruby -E ISO-8859-1:UTF-8 -e "p [Encoding.default_external, \
+ * Encoding.default_internal]"
+ * [#<Encoding:ISO-8859-1>, #<Encoding:UTF-8>]
+ *
+ * The default internal encoding may also be set through
+ * Encoding.default_internal=, but you should not do this as strings created
+ * before and after the change will have inconsistent encodings. Instead use
+ * <code>ruby -E</code> to invoke ruby with the correct internal encoding.
+ *
+ * == IO encoding example
+ *
+ * In the following example a UTF-8 encoded string "R\u00E9sum\u00E9" is transcoded for
+ * output to ISO-8859-1 encoding, then read back in and transcoded to UTF-8:
+ *
+ * string = "R\u00E9sum\u00E9"
+ *
+ * open("transcoded.txt", "w:ISO-8859-1") do |io|
+ * io.write(string)
+ * end
+ *
+ * puts "raw text:"
+ * p File.binread("transcoded.txt")
+ * puts
+ *
+ * open("transcoded.txt", "r:ISO-8859-1:UTF-8") do |io|
+ * puts "transcoded text:"
+ * p io.read
+ * end
+ *
+ * While writing the file, the internal encoding is not specified as it is
+ * only necessary for reading. While reading the file both the internal and
+ * external encoding must be specified to obtain the correct result.
+ *
+ * $ ruby t.rb
+ * raw text:
+ * "R\xE9sum\xE9"
+ *
+ * transcoded text:
+ * "R\u00E9sum\u00E9"
+ *
+ */
+
void
Init_Encoding(void)
{
@@ -1621,7 +1901,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);
@@ -1660,3 +1940,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 de954c938f..ce7d22434b 100644
--- a/enum.c
+++ b/enum.c
@@ -13,15 +13,24 @@
#include "ruby/util.h"
#include "node.h"
#include "id.h"
+#include "internal.h"
+
+VALUE rb_f_send(int argc, VALUE *argv, VALUE recv);
VALUE rb_mEnumerable;
+
static ID id_next;
+static ID id_div;
+static ID id_call;
+static ID id_size;
+
#define id_each idEach
#define id_eqq idEqq
#define id_cmp idCmp
+#define id_lshift idLTLT
-static VALUE
-enum_values_pack(int argc, VALUE *argv)
+VALUE
+rb_enum_values_pack(int argc, VALUE *argv)
{
if (argc == 0) return Qnil;
if (argc == 1) return argv[0];
@@ -29,7 +38,7 @@ enum_values_pack(int argc, VALUE *argv)
}
#define ENUM_WANT_SVALUE() do { \
- i = enum_values_pack(argc, argv); \
+ i = rb_enum_values_pack(argc, argv); \
} while (0)
#define enum_yield rb_yield_values2
@@ -37,11 +46,11 @@ enum_values_pack(int argc, VALUE *argv)
static VALUE
grep_i(VALUE i, VALUE args, int argc, VALUE *argv)
{
- VALUE *arg = (VALUE *)args;
+ NODE *memo = RNODE(args);
ENUM_WANT_SVALUE();
- if (RTEST(rb_funcall(arg[0], id_eqq, 1, i))) {
- rb_ary_push(arg[1], i);
+ if (RTEST(rb_funcall(memo->u1.value, id_eqq, 1, i))) {
+ rb_ary_push(memo->u2.value, i);
}
return Qnil;
}
@@ -49,19 +58,19 @@ grep_i(VALUE i, VALUE args, int argc, VALUE *argv)
static VALUE
grep_iter_i(VALUE i, VALUE args, int argc, VALUE *argv)
{
- VALUE *arg = (VALUE *)args;
+ NODE *memo = RNODE(args);
ENUM_WANT_SVALUE();
- if (RTEST(rb_funcall(arg[0], id_eqq, 1, i))) {
- rb_ary_push(arg[1], rb_yield(i));
+ if (RTEST(rb_funcall(memo->u1.value, id_eqq, 1, i))) {
+ rb_ary_push(memo->u2.value, rb_yield(i));
}
return Qnil;
}
/*
* call-seq:
- * enum.grep(pattern) -> array
- * enum.grep(pattern) {| obj | block } -> array
+ * enum.grep(pattern) -> array
+ * enum.grep(pattern) { |obj| block } -> array
*
* Returns an array of every element in <i>enum</i> for which
* <code>Pattern === element</code>. If the optional <em>block</em> is
@@ -71,7 +80,7 @@ grep_iter_i(VALUE i, VALUE args, int argc, VALUE *argv)
* (1..100).grep 38..44 #=> [38, 39, 40, 41, 42, 43, 44]
* c = IO.constants
* c.grep(/SEEK/) #=> [:SEEK_SET, :SEEK_CUR, :SEEK_END]
- * res = c.grep(/SEEK/) {|v| IO.const_get(v) }
+ * res = c.grep(/SEEK/) { |v| IO.const_get(v) }
* res #=> [0, 1, 2]
*
*/
@@ -80,12 +89,9 @@ static VALUE
enum_grep(VALUE obj, VALUE pat)
{
VALUE ary = rb_ary_new();
- VALUE arg[2];
-
- arg[0] = pat;
- arg[1] = ary;
+ NODE *memo = NEW_MEMO(pat, ary, 0);
- rb_block_call(obj, id_each, 0, 0, rb_block_given_p() ? grep_iter_i : grep_i, (VALUE)arg);
+ rb_block_call(obj, id_each, 0, 0, rb_block_given_p() ? grep_iter_i : grep_i, (VALUE)memo);
return ary;
}
@@ -93,12 +99,12 @@ enum_grep(VALUE obj, VALUE pat)
static VALUE
count_i(VALUE i, VALUE memop, int argc, VALUE *argv)
{
- VALUE *memo = (VALUE*)memop;
+ NODE *memo = RNODE(memop);
ENUM_WANT_SVALUE();
- if (rb_equal(i, memo[1])) {
- memo[0]++;
+ if (rb_equal(i, memo->u1.value)) {
+ memo->u3.cnt++;
}
return Qnil;
}
@@ -106,10 +112,10 @@ count_i(VALUE i, VALUE memop, int argc, VALUE *argv)
static VALUE
count_iter_i(VALUE i, VALUE memop, int argc, VALUE *argv)
{
- VALUE *memo = (VALUE*)memop;
+ NODE *memo = RNODE(memop);
if (RTEST(enum_yield(argc, argv))) {
- memo[0]++;
+ memo->u3.cnt++;
}
return Qnil;
}
@@ -117,35 +123,35 @@ count_iter_i(VALUE i, VALUE memop, int argc, VALUE *argv)
static VALUE
count_all_i(VALUE i, VALUE memop, int argc, VALUE *argv)
{
- VALUE *memo = (VALUE*)memop;
+ NODE *memo = RNODE(memop);
- memo[0]++;
+ memo->u3.cnt++;
return Qnil;
}
/*
* call-seq:
- * enum.count -> int
- * enum.count(item) -> int
- * enum.count {| obj | block } -> int
+ * enum.count -> int
+ * enum.count(item) -> int
+ * enum.count { |obj| block } -> int
*
- * Returns the number of items in <i>enum</i>, where #size is called
- * if it responds to it, otherwise the items are counted through
- * enumeration. If an argument is given, counts the number of items
- * in <i>enum</i>, for which equals to <i>item</i>. If a block is
- * given, counts the number of elements yielding a true value.
+ * Returns the number of items in +enum+ through enumeration.
+ * If an argument is given, the number of items in +enum+ that
+ * are equal to +item+ are counted. If a block is given, it
+ * counts the number of elements yielding a true value.
*
* ary = [1, 2, 4, 2]
- * ary.count #=> 4
- * ary.count(2) #=> 2
- * ary.count{|x|x%2==0} #=> 3
+ * ary.count #=> 4
+ * ary.count(2) #=> 2
+ * ary.count{ |x| x%2==0 } #=> 3
*
*/
static VALUE
enum_count(int argc, VALUE *argv, VALUE obj)
{
- VALUE memo[2]; /* [count, condition value] */
+ VALUE item = Qnil;
+ NODE *memo;
rb_block_call_func *func;
if (argc == 0) {
@@ -157,25 +163,27 @@ enum_count(int argc, VALUE *argv, VALUE obj)
}
}
else {
- rb_scan_args(argc, argv, "1", &memo[1]);
+ rb_scan_args(argc, argv, "1", &item);
if (rb_block_given_p()) {
rb_warn("given block not used");
}
func = count_i;
}
- memo[0] = 0;
- rb_block_call(obj, id_each, 0, 0, func, (VALUE)&memo);
- return INT2NUM(memo[0]);
+ memo = NEW_MEMO(item, 0, 0);
+ rb_block_call(obj, id_each, 0, 0, func, (VALUE)memo);
+ return INT2NUM(memo->u3.cnt);
}
static VALUE
-find_i(VALUE i, VALUE *memo, int argc, VALUE *argv)
+find_i(VALUE i, VALUE memop, int argc, VALUE *argv)
{
ENUM_WANT_SVALUE();
if (RTEST(rb_yield(i))) {
- *memo = i;
+ NODE *memo = RNODE(memop);
+ memo->u1.value = i;
+ memo->u3.cnt = 1;
rb_iter_break();
}
return Qnil;
@@ -183,10 +191,10 @@ find_i(VALUE i, VALUE *memo, int argc, VALUE *argv)
/*
* call-seq:
- * enum.detect(ifnone = nil) {| obj | block } -> obj or nil
- * enum.find(ifnone = nil) {| obj | block } -> obj or nil
- * enum.detect(ifnone = nil) -> an_enumerator
- * enum.find(ifnone = nil) -> an_enumerator
+ * enum.detect(ifnone = nil) { |obj| block } -> obj or nil
+ * enum.find(ifnone = nil) { |obj| block } -> obj or nil
+ * enum.detect(ifnone = nil) -> an_enumerator
+ * enum.find(ifnone = nil) -> an_enumerator
*
* Passes each entry in <i>enum</i> to <em>block</em>. Returns the
* first for which <em>block</em> is not false. If no
@@ -195,25 +203,26 @@ find_i(VALUE i, VALUE *memo, 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).detect { |i| i % 5 == 0 and i % 7 == 0 } #=> 35
*
*/
static VALUE
enum_find(int argc, VALUE *argv, VALUE obj)
{
- VALUE memo = Qundef;
+ NODE *memo;
VALUE if_none;
rb_scan_args(argc, argv, "01", &if_none);
RETURN_ENUMERATOR(obj, argc, argv);
- rb_block_call(obj, id_each, 0, 0, find_i, (VALUE)&memo);
- if (memo != Qundef) {
- return memo;
+ memo = NEW_MEMO(Qundef, 0, 0);
+ rb_block_call(obj, id_each, 0, 0, find_i, (VALUE)memo);
+ if (memo->u3.cnt) {
+ return memo->u1.value;
}
if (!NIL_P(if_none)) {
- return rb_funcall(if_none, rb_intern("call"), 0, 0);
+ return rb_funcall(if_none, id_call, 0, 0);
}
return Qnil;
}
@@ -221,36 +230,36 @@ enum_find(int argc, VALUE *argv, VALUE obj)
static VALUE
find_index_i(VALUE i, VALUE memop, int argc, VALUE *argv)
{
- VALUE *memo = (VALUE*)memop;
+ NODE *memo = RNODE(memop);
ENUM_WANT_SVALUE();
- if (rb_equal(i, memo[2])) {
- memo[0] = UINT2NUM(memo[1]);
+ if (rb_equal(i, memo->u2.value)) {
+ memo->u1.value = UINT2NUM(memo->u3.cnt);
rb_iter_break();
}
- memo[1]++;
+ memo->u3.cnt++;
return Qnil;
}
static VALUE
find_index_iter_i(VALUE i, VALUE memop, int argc, VALUE *argv)
{
- VALUE *memo = (VALUE*)memop;
+ NODE *memo = RNODE(memop);
if (RTEST(enum_yield(argc, argv))) {
- memo[0] = UINT2NUM(memo[1]);
+ memo->u1.value = UINT2NUM(memo->u3.cnt);
rb_iter_break();
}
- memo[1]++;
+ memo->u3.cnt++;
return Qnil;
}
/*
* call-seq:
- * enum.find_index(value) -> int or nil
- * enum.find_index {| obj | block } -> int or nil
- * enum.find_index -> an_enumerator
+ * enum.find_index(value) -> int or nil
+ * enum.find_index { |obj| block } -> int or nil
+ * enum.find_index -> an_enumerator
*
* Compares each entry in <i>enum</i> with <em>value</em> or passes
* to <em>block</em>. Returns the index for the first for which the
@@ -259,8 +268,8 @@ find_index_iter_i(VALUE i, VALUE memop, int argc, VALUE *argv)
*
* If neither block nor argument is given, an enumerator is returned instead.
*
- * (1..10).find_index {|i| i % 5 == 0 and i % 7 == 0 } #=> nil
- * (1..100).find_index {|i| i % 5 == 0 and i % 7 == 0 } #=> 34
+ * (1..10).find_index { |i| i % 5 == 0 and i % 7 == 0 } #=> nil
+ * (1..100).find_index { |i| i % 5 == 0 and i % 7 == 0 } #=> 34
* (1..100).find_index(50) #=> 49
*
*/
@@ -268,7 +277,8 @@ find_index_iter_i(VALUE i, VALUE memop, int argc, VALUE *argv)
static VALUE
enum_find_index(int argc, VALUE *argv, VALUE obj)
{
- VALUE memo[3]; /* [return value, current index, condition value] */
+ NODE *memo; /* [return value, current index, ] */
+ VALUE condition_value = Qnil;
rb_block_call_func *func;
if (argc == 0) {
@@ -276,17 +286,16 @@ enum_find_index(int argc, VALUE *argv, VALUE obj)
func = find_index_iter_i;
}
else {
- rb_scan_args(argc, argv, "1", &memo[2]);
+ rb_scan_args(argc, argv, "1", &condition_value);
if (rb_block_given_p()) {
rb_warn("given block not used");
}
func = find_index_i;
}
- memo[0] = Qnil;
- memo[1] = 0;
+ memo = NEW_MEMO(Qnil, condition_value, 0);
rb_block_call(obj, id_each, 0, 0, func, (VALUE)memo);
- return memo[0];
+ return memo->u1.value;
}
static VALUE
@@ -300,22 +309,32 @@ find_all_i(VALUE i, VALUE ary, int argc, VALUE *argv)
return Qnil;
}
+static VALUE
+enum_size(VALUE self, VALUE args, VALUE eobj)
+{
+ VALUE r;
+ r = rb_check_funcall(self, id_size, 0, 0);
+ return (r == Qundef) ? Qnil : r;
+}
+
/*
* call-seq:
- * enum.find_all {| obj | block } -> array
- * enum.select {| obj | block } -> array
- * enum.find_all -> an_enumerator
- * enum.select -> an_enumerator
+ * enum.find_all { |obj| block } -> array
+ * enum.select { |obj| block } -> array
+ * enum.find_all -> an_enumerator
+ * enum.select -> an_enumerator
*
- * Returns an array containing all elements of <i>enum</i> for which
- * <em>block</em> is not <code>false</code> (see also
- * <code>Enumerable#reject</code>).
+ * Returns an array containing all elements of +enum+
+ * for which the given +block+ returns a true value.
*
- * If no block is given, an enumerator is returned instead.
+ * If no block is given, an Enumerator is returned instead.
*
*
- * (1..10).find_all {|i| i % 3 == 0 } #=> [3, 6, 9]
+ * (1..10).find_all { |i| i % 3 == 0 } #=> [3, 6, 9]
*
+ * [1,2,3,4,5].select { |num| num.even? } #=> [2, 4]
+ *
+ * See also Enumerable#reject.
*/
static VALUE
@@ -323,7 +342,7 @@ enum_find_all(VALUE obj)
{
VALUE ary;
- RETURN_ENUMERATOR(obj, 0, 0);
+ RETURN_SIZED_ENUMERATOR(obj, 0, 0, enum_size);
ary = rb_ary_new();
rb_block_call(obj, id_each, 0, 0, find_all_i, ary);
@@ -344,16 +363,19 @@ reject_i(VALUE i, VALUE ary, int argc, VALUE *argv)
/*
* call-seq:
- * enum.reject {| obj | block } -> array
- * enum.reject -> an_enumerator
+ * enum.reject { |obj| block } -> array
+ * enum.reject -> an_enumerator
*
- * Returns an array for all elements of <i>enum</i> for which
- * <em>block</em> is false (see also <code>Enumerable#find_all</code>).
+ * Returns an array for all elements of +enum+ for which the given
+ * +block+ returns false.
*
- * If no block is given, an enumerator is returned instead.
+ * If no block is given, an Enumerator is returned instead.
+ *
+ * (1..10).reject { |i| i % 3 == 0 } #=> [1, 2, 4, 5, 7, 8, 10]
*
- * (1..10).reject {|i| i % 3 == 0 } #=> [1, 2, 4, 5, 7, 8, 10]
+ * [1, 2, 3, 4, 5].reject { |num| num.even? } #=> [1, 3, 5]
*
+ * See also Enumerable#find_all.
*/
static VALUE
@@ -361,7 +383,7 @@ enum_reject(VALUE obj)
{
VALUE ary;
- RETURN_ENUMERATOR(obj, 0, 0);
+ RETURN_SIZED_ENUMERATOR(obj, 0, 0, enum_size);
ary = rb_ary_new();
rb_block_call(obj, id_each, 0, 0, reject_i, ary);
@@ -381,24 +403,24 @@ static VALUE
collect_all(VALUE i, VALUE ary, int argc, VALUE *argv)
{
rb_thread_check_ints();
- rb_ary_push(ary, enum_values_pack(argc, argv));
+ rb_ary_push(ary, rb_enum_values_pack(argc, argv));
return Qnil;
}
/*
* call-seq:
- * enum.collect {| obj | block } -> array
- * enum.map {| obj | block } -> array
- * enum.collect -> an_enumerator
- * enum.map -> an_enumerator
+ * enum.collect { |obj| block } -> array
+ * enum.map { |obj| block } -> array
+ * enum.collect -> an_enumerator
+ * enum.map -> an_enumerator
*
* Returns a new array with the results of running <em>block</em> once
* for every element in <i>enum</i>.
*
* If no block is given, an enumerator is returned instead.
*
- * (1..4).collect {|i| i*i } #=> [1, 4, 9, 16]
+ * (1..4).collect { |i| i*i } #=> [1, 4, 9, 16]
* (1..4).collect { "cat" } #=> ["cat", "cat", "cat", "cat"]
*
*/
@@ -408,7 +430,7 @@ enum_collect(VALUE obj)
{
VALUE ary;
- RETURN_ENUMERATOR(obj, 0, 0);
+ RETURN_SIZED_ENUMERATOR(obj, 0, 0, enum_size);
ary = rb_ary_new();
rb_block_call(obj, id_each, 0, 0, collect_i, ary);
@@ -435,17 +457,18 @@ flat_map_i(VALUE i, VALUE ary, int argc, VALUE *argv)
/*
* call-seq:
- * enum.flat_map {| obj | block } -> array
- * enum.collect_concat {| obj | block } -> array
- * enum.flat_map -> an_enumerator
- * enum.collect_concat -> an_enumerator
+ * enum.flat_map { |obj| block } -> array
+ * enum.collect_concat { |obj| block } -> array
+ * enum.flat_map -> an_enumerator
+ * enum.collect_concat -> an_enumerator
*
* Returns a new array with the concatenated results of running
* <em>block</em> once for every element in <i>enum</i>.
*
* If no block is given, an enumerator is returned instead.
*
- * [[1,2],[3,4]].flat_map {|i| i } #=> [1, 2, 3, 4]
+ * [1, 2, 3, 4].flat_map { |e| [e, -e] } #=> [1, -1, 2, -2, 3, -3, 4, -4]
+ * [[1, 2], [3, 4]].flat_map { |e| e + [100] } #=> [1, 2, 100, 3, 4, 100]
*
*/
@@ -454,7 +477,7 @@ enum_flat_map(VALUE obj)
{
VALUE ary;
- RETURN_ENUMERATOR(obj, 0, 0);
+ RETURN_SIZED_ENUMERATOR(obj, 0, 0, enum_size);
ary = rb_ary_new();
rb_block_call(obj, id_each, 0, 0, flat_map_i, ary);
@@ -464,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)
@@ -484,17 +510,51 @@ enum_to_a(int argc, VALUE *argv, VALUE obj)
}
static VALUE
+enum_to_h_i(VALUE i, VALUE hash, int argc, VALUE *argv)
+{
+ ENUM_WANT_SVALUE();
+ rb_thread_check_ints();
+ i = rb_check_array_type(i);
+ if (!NIL_P(i) && RARRAY_LEN(i) == 2) {
+ rb_hash_aset(hash, RARRAY_AREF(i, 0), RARRAY_AREF(i, 1));
+ }
+ 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. Elements other than pairs of
+ * values are ignored.
+ *
+ * %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(VALUE i, VALUE p, int argc, VALUE *argv)
{
- VALUE *memo = (VALUE *)p;
+ NODE *memo = RNODE(p);
ENUM_WANT_SVALUE();
- if (memo[0] == Qundef) {
- memo[0] = i;
+ if (memo->u2.argc == 0) {
+ memo->u2.argc = 1;
+ memo->u1.value = i;
}
else {
- memo[0] = rb_yield_values(2, memo[0], i);
+ memo->u1.value = rb_yield_values(2, memo->u1.value, i);
}
return Qnil;
}
@@ -502,15 +562,23 @@ inject_i(VALUE i, VALUE p, int argc, VALUE *argv)
static VALUE
inject_op_i(VALUE i, VALUE p, int argc, VALUE *argv)
{
- VALUE *memo = (VALUE *)p;
+ NODE *memo = RNODE(p);
+ VALUE name;
ENUM_WANT_SVALUE();
- if (memo[0] == Qundef) {
- memo[0] = i;
+ if (memo->u2.argc == 0) {
+ 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[0] = rb_funcall(memo[0], (ID)memo[1], 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;
}
@@ -519,12 +587,12 @@ inject_op_i(VALUE i, VALUE p, int argc, VALUE *argv)
* call-seq:
* enum.inject(initial, sym) -> obj
* enum.inject(sym) -> obj
- * enum.inject(initial) {| memo, obj | block } -> obj
- * enum.inject {| memo, obj | block } -> obj
+ * enum.inject(initial) { |memo, obj| block } -> obj
+ * enum.inject { |memo, obj| block } -> obj
* enum.reduce(initial, sym) -> obj
* enum.reduce(sym) -> obj
- * enum.reduce(initial) {| memo, obj | block } -> obj
- * enum.reduce {| memo, obj | block } -> obj
+ * enum.reduce(initial) { |memo, obj| block } -> obj
+ * enum.reduce { |memo, obj| block } -> obj
*
* Combines all elements of <i>enum</i> by applying a binary
* operation, specified by a block or a symbol that names a
@@ -539,75 +607,81 @@ inject_op_i(VALUE i, VALUE p, int argc, VALUE *argv)
* return value for the method.
*
* If you do not explicitly specify an <i>initial</i> value for <i>memo</i>,
- * then uses the first element of collection is used as the initial value
+ * then the first element of collection is used as the initial value
* of <i>memo</i>.
*
- * Examples:
*
* # Sum some numbers
- * (5..10).reduce(:+) #=> 45
+ * (5..10).reduce(:+) #=> 45
* # Same using a block and inject
- * (5..10).inject {|sum, n| sum + n } #=> 45
+ * (5..10).inject { |sum, n| sum + n } #=> 45
* # Multiply some numbers
- * (5..10).reduce(1, :*) #=> 151200
+ * (5..10).reduce(1, :*) #=> 151200
* # Same using a block
- * (5..10).inject(1) {|product, n| product * n } #=> 151200
+ * (5..10).inject(1) { |product, n| product * n } #=> 151200
* # find the longest word
- * longest = %w{ cat sheep bear }.inject do |memo,word|
+ * longest = %w{ cat sheep bear }.inject do |memo, word|
* memo.length > word.length ? memo : word
* end
- * longest #=> "sheep"
+ * longest #=> "sheep"
*
*/
static VALUE
enum_inject(int argc, VALUE *argv, VALUE obj)
{
- VALUE memo[2];
+ NODE *memo;
+ VALUE init, op;
VALUE (*iter)(VALUE, VALUE, int, VALUE*) = inject_i;
+ ID id;
- switch (rb_scan_args(argc, argv, "02", &memo[0], &memo[1])) {
+ switch (rb_scan_args(argc, argv, "02", &init, &op)) {
case 0:
- memo[0] = Qundef;
break;
case 1:
if (rb_block_given_p()) {
break;
}
- memo[1] = (VALUE)rb_to_id(memo[0]);
- memo[0] = Qundef;
+ id = rb_check_id(&init);
+ op = id ? ID2SYM(id) : init;
+ argc = 0;
+ init = Qnil;
iter = inject_op_i;
break;
case 2:
if (rb_block_given_p()) {
rb_warning("given block not used");
}
- memo[1] = (VALUE)rb_to_id(memo[1]);
+ id = rb_check_id(&op);
+ if (id) op = ID2SYM(id);
iter = inject_op_i;
break;
}
+ memo = NEW_MEMO(init, argc, op);
rb_block_call(obj, id_each, 0, 0, iter, (VALUE)memo);
- if (memo[0] == Qundef) return Qnil;
- return memo[0];
+ return memo->u1.value;
}
static VALUE
-partition_i(VALUE i, VALUE *ary, int argc, VALUE *argv)
+partition_i(VALUE i, VALUE arys, int argc, VALUE *argv)
{
+ NODE *memo = RNODE(arys);
+ VALUE ary;
ENUM_WANT_SVALUE();
if (RTEST(rb_yield(i))) {
- rb_ary_push(ary[0], i);
+ ary = memo->u1.value;
}
else {
- rb_ary_push(ary[1], i);
+ ary = memo->u2.value;
}
+ rb_ary_push(ary, i);
return Qnil;
}
/*
* call-seq:
- * enum.partition {| obj | block } -> [ true_array, false_array ]
- * enum.partition -> an_enumerator
+ * enum.partition { |obj| block } -> [ true_array, false_array ]
+ * enum.partition -> an_enumerator
*
* Returns two arrays, the first containing the elements of
* <i>enum</i> for which the block evaluates to true, the second
@@ -615,22 +689,21 @@ partition_i(VALUE i, VALUE *ary, int argc, VALUE *argv)
*
* If no block is given, an enumerator is returned instead.
*
- * (1..6).partition {|v| v.even? } #=> [[2, 4, 6], [1, 3, 5]]
+ * (1..6).partition { |v| v.even? } #=> [[2, 4, 6], [1, 3, 5]]
*
*/
static VALUE
enum_partition(VALUE obj)
{
- VALUE ary[2];
+ NODE *memo;
- RETURN_ENUMERATOR(obj, 0, 0);
+ RETURN_SIZED_ENUMERATOR(obj, 0, 0, enum_size);
- ary[0] = rb_ary_new();
- ary[1] = rb_ary_new();
- rb_block_call(obj, id_each, 0, 0, partition_i, (VALUE)ary);
+ memo = NEW_MEMO(rb_ary_new(), rb_ary_new(), 0);
+ rb_block_call(obj, id_each, 0, 0, partition_i, (VALUE)memo);
- return rb_assoc_new(ary[0], ary[1]);
+ return rb_assoc_new(memo->u1.value, memo->u2.value);
}
static VALUE
@@ -643,7 +716,7 @@ group_by_i(VALUE i, VALUE hash, int argc, VALUE *argv)
group = rb_yield(i);
values = rb_hash_aref(hash, group);
- if (NIL_P(values)) {
+ if (!RB_TYPE_P(values, T_ARRAY)) {
values = rb_ary_new3(1, i);
rb_hash_aset(hash, group, values);
}
@@ -655,16 +728,16 @@ group_by_i(VALUE i, VALUE hash, int argc, VALUE *argv)
/*
* call-seq:
- * enum.group_by {| obj | block } -> a_hash
- * enum.group_by -> an_enumerator
+ * enum.group_by { |obj| block } -> a_hash
+ * enum.group_by -> an_enumerator
*
- * Returns a hash, which keys are evaluated result from the
- * block, and values are arrays of elements in <i>enum</i>
- * corresponding to the key.
+ * Groups the collection by result of the block. Returns a hash where the
+ * keys are the evaluated result from the block and the values are
+ * arrays of elements in the collection that correspond to the key.
*
- * If no block is given, an enumerator is returned instead.
+ * If no block is given an enumerator is returned.
*
- * (1..6).group_by {|i| i%3} #=> {0=>[3, 6], 1=>[1, 4], 2=>[2, 5]}
+ * (1..6).group_by { |i| i%3 } #=> {0=>[3, 6], 1=>[1, 4], 2=>[2, 5]}
*
*/
@@ -673,7 +746,7 @@ enum_group_by(VALUE obj)
{
VALUE hash;
- RETURN_ENUMERATOR(obj, 0, 0);
+ RETURN_SIZED_ENUMERATOR(obj, 0, 0, enum_size);
hash = rb_hash_new();
rb_block_call(obj, id_each, 0, 0, group_by_i, hash);
@@ -683,27 +756,19 @@ enum_group_by(VALUE obj)
}
static VALUE
-first_i(VALUE i, VALUE *params, int argc, VALUE *argv)
+first_i(VALUE i, VALUE params, int argc, VALUE *argv)
{
+ NODE *memo = RNODE(params);
ENUM_WANT_SVALUE();
- if (NIL_P(params[1])) {
- params[1] = i;
- rb_iter_break();
- }
- else {
- long n = params[0];
+ memo->u1.value = i;
+ rb_iter_break();
- rb_ary_push(params[1], i);
- n--;
- if (n <= 0) {
- rb_iter_break();
- }
- params[0] = n;
- }
- return Qnil;
+ UNREACHABLE;
}
+static VALUE enum_take(VALUE obj, VALUE n);
+
/*
* call-seq:
* enum.first -> obj or nil
@@ -723,33 +788,23 @@ first_i(VALUE i, VALUE *params, int argc, VALUE *argv)
static VALUE
enum_first(int argc, VALUE *argv, VALUE obj)
{
- VALUE n, params[2];
-
- if (argc == 0) {
- params[0] = params[1] = Qnil;
+ NODE *memo;
+ rb_check_arity(argc, 0, 1);
+ if (argc > 0) {
+ return enum_take(obj, argv[0]);
}
else {
- long len;
-
- rb_scan_args(argc, argv, "01", &n);
- len = NUM2LONG(n);
- if (len == 0) return rb_ary_new2(0);
- if (len < 0) {
- rb_raise(rb_eArgError, "negative length");
- }
- params[0] = len;
- params[1] = rb_ary_new2(len);
+ memo = NEW_MEMO(Qnil, 0, 0);
+ rb_block_call(obj, id_each, 0, 0, first_i, (VALUE)memo);
+ return memo->u1.value;
}
- rb_block_call(obj, id_each, 0, 0, first_i, (VALUE)params);
-
- return params[1];
}
/*
* call-seq:
- * enum.sort -> array
- * enum.sort {| a, b | block } -> array
+ * enum.sort -> array
+ * enum.sort { |a, b| block } -> array
*
* Returns an array containing the items in <i>enum</i> sorted,
* either according to their own <code><=></code> method, or by using
@@ -759,8 +814,8 @@ enum_first(int argc, VALUE *argv, VALUE obj)
* built-in Schwartzian Transform, useful when key computation or
* comparison is expensive.
*
- * %w(rhea kea flea).sort #=> ["flea", "kea", "rhea"]
- * (1..10).sort {|a,b| b <=> a} #=> [10, 9, 8, 7, 6, 5, 4, 3, 2, 1]
+ * %w(rhea kea flea).sort #=> ["flea", "kea", "rhea"]
+ * (1..10).sort { |a, b| b <=> a } #=> [10, 9, 8, 7, 6, 5, 4, 3, 2, 1]
*/
static VALUE
@@ -773,13 +828,13 @@ enum_sort(VALUE obj)
struct sort_by_data {
VALUE ary;
VALUE buf;
- int n;
+ long n;
};
static VALUE
sort_by_i(VALUE i, VALUE _data, int argc, VALUE *argv)
{
- struct sort_by_data *data = (struct sort_by_data *)_data;
+ struct sort_by_data *data = (struct sort_by_data *)&RNODE(_data)->u1;
VALUE ary = data->ary;
VALUE v;
@@ -794,8 +849,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);
@@ -823,29 +878,29 @@ sort_by_cmp(const void *ap, const void *bp, void *data)
/*
* call-seq:
- * enum.sort_by {| obj | block } -> array
- * enum.sort_by -> an_enumerator
+ * enum.sort_by { |obj| block } -> array
+ * enum.sort_by -> an_enumerator
*
* Sorts <i>enum</i> using a set of keys generated by mapping the
* values in <i>enum</i> through the given block.
*
* If no block is given, an enumerator is returned instead.
*
- * %w{ apple pear fig }.sort_by {|word| word.length}
+ * %w{apple pear fig}.sort_by { |word| word.length}
* #=> ["fig", "pear", "apple"]
*
* The current implementation of <code>sort_by</code> generates an
* array of tuples containing the original collection element and the
* mapped value. This makes <code>sort_by</code> fairly expensive when
- * the keysets are simple
+ * the keysets are simple.
*
* require 'benchmark'
*
- * a = (1..100000).map {rand(100000)}
+ * a = (1..100000).map { rand(100000) }
*
* Benchmark.bm(10) do |b|
* b.report("Sort") { a.sort }
- * b.report("Sort by") { a.sort_by {|a| a} }
+ * b.report("Sort by") { a.sort_by { |a| a } }
* end
*
* <em>produces:</em>
@@ -859,7 +914,7 @@ sort_by_cmp(const void *ap, const void *bp, void *data)
* using the basic <code>sort</code> method.
*
* files = Dir["*"]
- * sorted = files.sort {|a,b| File.new(a).mtime <=> File.new(b).mtime}
+ * sorted = files.sort { |a, b| File.new(a).mtime <=> File.new(b).mtime }
* sorted #=> ["mon", "tues", "wed", "thurs"]
*
* This sort is inefficient: it generates two new <code>File</code>
@@ -868,7 +923,7 @@ sort_by_cmp(const void *ap, const void *bp, void *data)
* times directly.
*
* files = Dir["*"]
- * sorted = files.sort { |a,b|
+ * sorted = files.sort { |a, b|
* test(?M, a) <=> test(?M, b)
* }
* sorted #=> ["mon", "tues", "wed", "thurs"]
@@ -888,48 +943,56 @@ sort_by_cmp(const void *ap, const void *bp, void *data)
*
* This is exactly what <code>sort_by</code> does internally.
*
- * sorted = Dir["*"].sort_by {|f| test(?M, f)}
+ * sorted = Dir["*"].sort_by { |f| test(?M, f) }
* sorted #=> ["mon", "tues", "wed", "thurs"]
*/
static VALUE
enum_sort_by(VALUE obj)
{
- VALUE ary;
+ VALUE ary, buf;
+ NODE *memo;
long i;
- struct sort_by_data data;
+ struct sort_by_data *data;
- RETURN_ENUMERATOR(obj, 0, 0);
+ RETURN_SIZED_ENUMERATOR(obj, 0, 0, enum_size);
- if (TYPE(obj) == T_ARRAY && RARRAY_LEN(obj) <= LONG_MAX/2) {
+ if (RB_TYPE_P(obj, T_ARRAY) && RARRAY_LEN(obj) <= LONG_MAX/2) {
ary = rb_ary_new2(RARRAY_LEN(obj)*2);
}
else {
ary = rb_ary_new();
}
- RBASIC(ary)->klass = 0;
- data.ary = ary;
- data.buf = rb_ary_tmp_new(SORT_BY_BUFSIZE*2);
- data.n = 0;
- rb_ary_store(data.buf, SORT_BY_BUFSIZE*2-1, Qnil);
- rb_block_call(obj, id_each, 0, 0, sort_by_i, (VALUE)&data);
- if (data.n) {
- rb_ary_resize(data.buf, data.n*2);
- rb_ary_concat(ary, data.buf);
+ 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);
+ OBJ_INFECT(memo, obj);
+ data = (struct sort_by_data *)&memo->u1;
+ data->ary = ary;
+ data->buf = buf;
+ data->n = 0;
+ rb_block_call(obj, id_each, 0, 0, sort_by_i, (VALUE)memo);
+ ary = data->ary;
+ buf = data->buf;
+ if (data->n) {
+ rb_ary_resize(buf, data->n*2);
+ 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;
- OBJ_INFECT(ary, obj);
+ RBASIC_SET_CLASS_RAW(ary, rb_cArray);
+ OBJ_INFECT(ary, memo);
return ary;
}
@@ -937,27 +1000,27 @@ enum_sort_by(VALUE obj)
#define ENUMFUNC(name) rb_block_given_p() ? name##_iter_i : name##_i
#define DEFINE_ENUMFUNCS(name) \
-static VALUE enum_##name##_func(VALUE result, VALUE *memo); \
+static VALUE enum_##name##_func(VALUE result, NODE *memo); \
\
static VALUE \
-name##_i(VALUE i, VALUE *memo, int argc, VALUE *argv) \
+name##_i(VALUE i, VALUE memo, int argc, VALUE *argv) \
{ \
- return enum_##name##_func(enum_values_pack(argc, argv), 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(VALUE i, VALUE memo, int argc, VALUE *argv) \
{ \
- return enum_##name##_func(enum_yield(argc, argv), memo); \
+ return enum_##name##_func(enum_yield(argc, argv), RNODE(memo)); \
} \
\
static VALUE \
-enum_##name##_func(VALUE result, VALUE *memo)
+enum_##name##_func(VALUE result, NODE *memo)
DEFINE_ENUMFUNCS(all)
{
if (!RTEST(result)) {
- *memo = Qfalse;
+ memo->u1.value = Qfalse;
rb_iter_break();
}
return Qnil;
@@ -965,34 +1028,33 @@ DEFINE_ENUMFUNCS(all)
/*
* call-seq:
- * enum.all? [{|obj| block } ] -> true or false
+ * enum.all? [{ |obj| block } ] -> true or false
*
* Passes each element of the collection to the given block. The method
* returns <code>true</code> if the block never returns
* <code>false</code> or <code>nil</code>. If the block is not given,
- * Ruby adds an implicit block of <code>{|obj| obj}</code> (that is
- * <code>all?</code> will return <code>true</code> only if none of the
- * collection members are <code>false</code> or <code>nil</code>.)
+ * Ruby adds an implicit block of <code>{ |obj| obj }</code> which will
+ * cause #all? to return +true+ when none of the collection members are
+ * +false+ or +nil+.
*
- * %w{ant bear cat}.all? {|word| word.length >= 3} #=> true
- * %w{ant bear cat}.all? {|word| word.length >= 4} #=> false
- * [ nil, true, 99 ].all? #=> false
+ * %w[ant bear cat].all? { |word| word.length >= 3 } #=> true
+ * %w[ant bear cat].all? { |word| word.length >= 4 } #=> false
+ * [nil, true, 99].all? #=> false
*
*/
static VALUE
enum_all(VALUE obj)
{
- VALUE result = Qtrue;
-
- rb_block_call(obj, id_each, 0, 0, ENUMFUNC(all), (VALUE)&result);
- return result;
+ NODE *memo = NEW_MEMO(Qtrue, 0, 0);
+ rb_block_call(obj, id_each, 0, 0, ENUMFUNC(all), (VALUE)memo);
+ return memo->u1.value;
}
DEFINE_ENUMFUNCS(any)
{
if (RTEST(result)) {
- *memo = Qtrue;
+ memo->u1.value = Qtrue;
rb_iter_break();
}
return Qnil;
@@ -1000,39 +1062,37 @@ DEFINE_ENUMFUNCS(any)
/*
* call-seq:
- * enum.any? [{|obj| block } ] -> true or false
+ * enum.any? [{ |obj| block }] -> true or false
*
* Passes each element of the collection to the given block. The method
* returns <code>true</code> if the block ever returns a value other
* than <code>false</code> or <code>nil</code>. If the block is not
- * given, Ruby adds an implicit block of <code>{|obj| obj}</code> (that
- * is <code>any?</code> will return <code>true</code> if at least one
- * of the collection members is not <code>false</code> or
- * <code>nil</code>.
+ * given, Ruby adds an implicit block of <code>{ |obj| obj }</code> that
+ * will cause #any? to return +true+ if at least one of the collection
+ * members is not +false+ or +nil+.
*
- * %w{ant bear cat}.any? {|word| word.length >= 3} #=> true
- * %w{ant bear cat}.any? {|word| word.length >= 4} #=> true
- * [ nil, true, 99 ].any? #=> true
+ * %w[ant bear cat].any? { |word| word.length >= 3 } #=> true
+ * %w[ant bear cat].any? { |word| word.length >= 4 } #=> true
+ * [nil, true, 99].any? #=> true
*
*/
static VALUE
enum_any(VALUE obj)
{
- VALUE result = Qfalse;
-
- rb_block_call(obj, id_each, 0, 0, ENUMFUNC(any), (VALUE)&result);
- return result;
+ NODE *memo = NEW_MEMO(Qfalse, 0, 0);
+ rb_block_call(obj, id_each, 0, 0, ENUMFUNC(any), (VALUE)memo);
+ return memo->u1.value;
}
DEFINE_ENUMFUNCS(one)
{
if (RTEST(result)) {
- if (*memo == Qundef) {
- *memo = Qtrue;
+ if (memo->u1.value == Qundef) {
+ memo->u1.value = Qtrue;
}
- else if (*memo == Qtrue) {
- *memo = Qfalse;
+ else if (memo->u1.value == Qtrue) {
+ memo->u1.value = Qfalse;
rb_iter_break();
}
}
@@ -1041,7 +1101,7 @@ DEFINE_ENUMFUNCS(one)
/*
* call-seq:
- * enum.one? [{|obj| block }] -> true or false
+ * enum.one? [{ |obj| block }] -> true or false
*
* Passes each element of the collection to the given block. The method
* returns <code>true</code> if the block returns <code>true</code>
@@ -1049,20 +1109,22 @@ DEFINE_ENUMFUNCS(one)
* <code>true</code> only if exactly one of the collection members is
* true.
*
- * %w{ant bear cat}.one? {|word| word.length == 4} #=> true
- * %w{ant bear cat}.one? {|word| word.length > 4} #=> false
- * %w{ant bear cat}.one? {|word| word.length < 4} #=> false
- * [ nil, true, 99 ].one? #=> false
- * [ nil, true, false ].one? #=> true
+ * %w{ant bear cat}.one? { |word| word.length == 4 } #=> true
+ * %w{ant bear cat}.one? { |word| word.length > 4 } #=> false
+ * %w{ant bear cat}.one? { |word| word.length < 4 } #=> false
+ * [ nil, true, 99 ].one? #=> false
+ * [ nil, true, false ].one? #=> true
*
*/
static VALUE
enum_one(VALUE obj)
{
- VALUE result = Qundef;
+ NODE *memo = NEW_MEMO(Qundef, 0, 0);
+ VALUE result;
- rb_block_call(obj, id_each, 0, 0, ENUMFUNC(one), (VALUE)&result);
+ rb_block_call(obj, id_each, 0, 0, ENUMFUNC(one), (VALUE)memo);
+ result = memo->u1.value;
if (result == Qundef) return Qfalse;
return result;
}
@@ -1070,7 +1132,7 @@ enum_one(VALUE obj)
DEFINE_ENUMFUNCS(none)
{
if (RTEST(result)) {
- *memo = Qfalse;
+ memo->u1.value = Qfalse;
rb_iter_break();
}
return Qnil;
@@ -1078,61 +1140,62 @@ DEFINE_ENUMFUNCS(none)
/*
* call-seq:
- * enum.none? [{|obj| block }] -> true or false
+ * enum.none? [{ |obj| block }] -> true or false
*
* Passes each element of the collection to the given block. The method
* returns <code>true</code> if the block never returns <code>true</code>
* for all elements. If the block is not given, <code>none?</code> will return
* <code>true</code> only if none of the collection members is true.
*
- * %w{ant bear cat}.none? {|word| word.length == 5} #=> true
- * %w{ant bear cat}.none? {|word| word.length >= 4} #=> false
- * [].none? #=> true
- * [nil].none? #=> true
- * [nil,false].none? #=> true
+ * %w{ant bear cat}.none? { |word| word.length == 5 } #=> true
+ * %w{ant bear cat}.none? { |word| word.length >= 4 } #=> false
+ * [].none? #=> true
+ * [nil].none? #=> true
+ * [nil, false].none? #=> true
*/
static VALUE
enum_none(VALUE obj)
{
- VALUE result = Qtrue;
-
- rb_block_call(obj, id_each, 0, 0, ENUMFUNC(none), (VALUE)&result);
- return result;
+ NODE *memo = NEW_MEMO(Qtrue, 0, 0);
+ rb_block_call(obj, id_each, 0, 0, ENUMFUNC(none), (VALUE)memo);
+ return memo->u1.value;
}
static VALUE
-min_i(VALUE i, VALUE *memo, int argc, VALUE *argv)
+min_i(VALUE i, VALUE args, int argc, VALUE *argv)
{
VALUE cmp;
+ NODE *memo = RNODE(args);
ENUM_WANT_SVALUE();
- if (*memo == Qundef) {
- *memo = i;
+ if (memo->u1.value == Qundef) {
+ memo->u1.value = i;
}
else {
- cmp = rb_funcall(i, id_cmp, 1, *memo);
- if (rb_cmpint(cmp, i, *memo) < 0) {
- *memo = i;
+ cmp = rb_funcall(i, id_cmp, 1, memo->u1.value);
+ if (rb_cmpint(cmp, i, memo->u1.value) < 0) {
+ memo->u1.value = i;
}
}
return Qnil;
}
static VALUE
-min_ii(VALUE i, VALUE *memo, int argc, VALUE *argv)
+min_ii(VALUE i, VALUE args, int argc, VALUE *argv)
{
VALUE cmp;
+ NODE *memo = RNODE(args);
ENUM_WANT_SVALUE();
- if (*memo == Qundef) {
- *memo = i;
+ if (memo->u1.value == Qundef) {
+ memo->u1.value = i;
}
else {
- cmp = rb_yield_values(2, i, *memo);
- if (rb_cmpint(cmp, i, *memo) < 0) {
- *memo = i;
+ cmp = rb_yield_values(2, i, memo->u1.value);
+ if (rb_cmpint(cmp, i, memo->u1.value) < 0) {
+ memo->u1.value = i;
}
}
return Qnil;
@@ -1141,66 +1204,70 @@ min_ii(VALUE i, VALUE *memo, int argc, VALUE *argv)
/*
* call-seq:
- * enum.min -> obj
- * enum.min {| a,b | block } -> obj
+ * enum.min -> obj
+ * enum.min { |a, b| block } -> obj
*
* Returns the object in <i>enum</i> with the minimum value. The
* first form assumes all objects implement <code>Comparable</code>;
* the second uses the block to return <em>a <=> b</em>.
*
* a = %w(albatross dog horse)
- * a.min #=> "albatross"
- * a.min {|a,b| a.length <=> b.length } #=> "dog"
+ * a.min #=> "albatross"
+ * a.min { |a, b| a.length <=> b.length } #=> "dog"
*/
static VALUE
enum_min(VALUE obj)
{
- VALUE result = Qundef;
+ NODE *memo = NEW_MEMO(Qundef, 0, 0);
+ VALUE result;
if (rb_block_given_p()) {
- rb_block_call(obj, id_each, 0, 0, min_ii, (VALUE)&result);
+ rb_block_call(obj, id_each, 0, 0, min_ii, (VALUE)memo);
}
else {
- rb_block_call(obj, id_each, 0, 0, min_i, (VALUE)&result);
+ rb_block_call(obj, id_each, 0, 0, min_i, (VALUE)memo);
}
+ result = memo->u1.value;
if (result == Qundef) return Qnil;
return result;
}
static VALUE
-max_i(VALUE i, VALUE *memo, int argc, VALUE *argv)
+max_i(VALUE i, VALUE args, int argc, VALUE *argv)
{
+ NODE *memo = RNODE(args);
VALUE cmp;
ENUM_WANT_SVALUE();
- if (*memo == Qundef) {
- *memo = i;
+ if (memo->u1.value == Qundef) {
+ memo->u1.value = i;
}
else {
- cmp = rb_funcall(i, id_cmp, 1, *memo);
- if (rb_cmpint(cmp, i, *memo) > 0) {
- *memo = i;
+ cmp = rb_funcall(i, id_cmp, 1, memo->u1.value);
+ if (rb_cmpint(cmp, i, memo->u1.value) > 0) {
+ memo->u1.value = i;
}
}
return Qnil;
}
static VALUE
-max_ii(VALUE i, VALUE *memo, int argc, VALUE *argv)
+max_ii(VALUE i, VALUE args, int argc, VALUE *argv)
{
+ NODE *memo = RNODE(args);
VALUE cmp;
ENUM_WANT_SVALUE();
- if (*memo == Qundef) {
- *memo = i;
+ if (memo->u1.value == Qundef) {
+ memo->u1.value = i;
}
else {
- cmp = rb_yield_values(2, i, *memo);
- if (rb_cmpint(cmp, i, *memo) > 0) {
- *memo = i;
+ cmp = rb_yield_values(2, i, memo->u1.value);
+ if (rb_cmpint(cmp, i, memo->u1.value) > 0) {
+ memo->u1.value = i;
}
}
return Qnil;
@@ -1208,29 +1275,31 @@ max_ii(VALUE i, VALUE *memo, int argc, VALUE *argv)
/*
* call-seq:
- * enum.max -> obj
- * enum.max {|a,b| block } -> obj
+ * enum.max -> obj
+ * enum.max { |a, b| block } -> obj
*
* Returns the object in _enum_ with the maximum value. The
* first form assumes all objects implement <code>Comparable</code>;
* the second uses the block to return <em>a <=> b</em>.
*
* a = %w(albatross dog horse)
- * a.max #=> "horse"
- * a.max {|a,b| a.length <=> b.length } #=> "albatross"
+ * a.max #=> "horse"
+ * a.max { |a, b| a.length <=> b.length } #=> "albatross"
*/
static VALUE
enum_max(VALUE obj)
{
- VALUE result = Qundef;
+ NODE *memo = NEW_MEMO(Qundef, 0, 0);
+ VALUE result;
if (rb_block_given_p()) {
- rb_block_call(obj, id_each, 0, 0, max_ii, (VALUE)&result);
+ rb_block_call(obj, id_each, 0, 0, max_ii, (VALUE)memo);
}
else {
- rb_block_call(obj, id_each, 0, 0, max_i, (VALUE)&result);
+ rb_block_call(obj, id_each, 0, 0, max_i, (VALUE)memo);
}
+ result = memo->u1.value;
if (result == Qundef) return Qnil;
return result;
}
@@ -1241,6 +1310,8 @@ struct minmax_t {
VALUE last;
};
+STATIC_ASSERT(minmax_t, sizeof(struct minmax_t) <= sizeof(NODE) - offsetof(NODE, u1));
+
static void
minmax_i_update(VALUE i, VALUE j, struct minmax_t *memo)
{
@@ -1265,7 +1336,7 @@ minmax_i_update(VALUE i, VALUE j, struct minmax_t *memo)
static VALUE
minmax_i(VALUE i, VALUE _memo, int argc, VALUE *argv)
{
- struct minmax_t *memo = (struct minmax_t *)_memo;
+ struct minmax_t *memo = (struct minmax_t *)&RNODE(_memo)->u1.value;
int n;
VALUE j;
@@ -1317,7 +1388,7 @@ minmax_ii_update(VALUE i, VALUE j, struct minmax_t *memo)
static VALUE
minmax_ii(VALUE i, VALUE _memo, int argc, VALUE *argv)
{
- struct minmax_t *memo = (struct minmax_t *)_memo;
+ struct minmax_t *memo = (struct minmax_t *)&RNODE(_memo)->u1.value;
int n;
VALUE j;
@@ -1347,8 +1418,8 @@ minmax_ii(VALUE i, VALUE _memo, int argc, VALUE *argv)
/*
* call-seq:
- * enum.minmax -> [min,max]
- * enum.minmax {|a,b| block } -> [min,max]
+ * enum.minmax -> [min, max]
+ * enum.minmax { |a, b| block } -> [min, max]
*
* Returns two elements array which contains the minimum and the
* maximum value in the enumerable. The first form assumes all
@@ -1357,57 +1428,59 @@ minmax_ii(VALUE i, VALUE _memo, int argc, VALUE *argv)
*
* a = %w(albatross dog horse)
* a.minmax #=> ["albatross", "horse"]
- * a.minmax {|a,b| a.length <=> b.length } #=> ["dog", "albatross"]
+ * a.minmax { |a, b| a.length <=> b.length } #=> ["dog", "albatross"]
*/
static VALUE
enum_minmax(VALUE obj)
{
- struct minmax_t memo;
+ NODE *memo = NEW_MEMO(Qundef, Qundef, Qundef);
+ struct minmax_t *m = (struct minmax_t *)&memo->u1.value;
VALUE ary = rb_ary_new3(2, Qnil, Qnil);
- memo.min = Qundef;
- memo.last = Qundef;
+ m->min = Qundef;
+ m->last = Qundef;
if (rb_block_given_p()) {
- rb_block_call(obj, id_each, 0, 0, minmax_ii, (VALUE)&memo);
- if (memo.last != Qundef)
- minmax_ii_update(memo.last, memo.last, &memo);
+ rb_block_call(obj, id_each, 0, 0, minmax_ii, (VALUE)memo);
+ if (m->last != Qundef)
+ minmax_ii_update(m->last, m->last, m);
}
else {
- rb_block_call(obj, id_each, 0, 0, minmax_i, (VALUE)&memo);
- if (memo.last != Qundef)
- minmax_i_update(memo.last, memo.last, &memo);
+ rb_block_call(obj, id_each, 0, 0, minmax_i, (VALUE)memo);
+ if (m->last != Qundef)
+ minmax_i_update(m->last, m->last, m);
}
- if (memo.min != Qundef) {
- rb_ary_store(ary, 0, memo.min);
- rb_ary_store(ary, 1, memo.max);
+ if (m->min != Qundef) {
+ rb_ary_store(ary, 0, m->min);
+ rb_ary_store(ary, 1, m->max);
}
return ary;
}
static VALUE
-min_by_i(VALUE i, VALUE *memo, int argc, VALUE *argv)
+min_by_i(VALUE i, VALUE args, int argc, VALUE *argv)
{
+ NODE *memo = RNODE(args);
VALUE v;
ENUM_WANT_SVALUE();
v = rb_yield(i);
- if (memo[0] == Qundef) {
- memo[0] = v;
- memo[1] = i;
+ if (memo->u1.value == Qundef) {
+ memo->u1.value = v;
+ memo->u2.value = i;
}
- else if (rb_cmpint(rb_funcall(v, id_cmp, 1, memo[0]), v, memo[0]) < 0) {
- memo[0] = v;
- memo[1] = i;
+ else if (rb_cmpint(rb_funcall(v, id_cmp, 1, memo->u1.value), v, memo->u1.value) < 0) {
+ memo->u1.value = v;
+ memo->u2.value = i;
}
return Qnil;
}
/*
* call-seq:
- * enum.min_by {|obj| block } -> obj
- * enum.min_by -> an_enumerator
+ * enum.min_by { |obj| block } -> obj
+ * enum.min_by -> an_enumerator
*
* Returns the object in <i>enum</i> that gives the minimum
* value from the given block.
@@ -1415,45 +1488,45 @@ min_by_i(VALUE i, VALUE *memo, int argc, VALUE *argv)
* If no block is given, an enumerator is returned instead.
*
* a = %w(albatross dog horse)
- * a.min_by {|x| x.length } #=> "dog"
+ * a.min_by { |x| x.length } #=> "dog"
*/
static VALUE
enum_min_by(VALUE obj)
{
- VALUE memo[2];
+ NODE *memo;
- RETURN_ENUMERATOR(obj, 0, 0);
+ RETURN_SIZED_ENUMERATOR(obj, 0, 0, enum_size);
- memo[0] = Qundef;
- memo[1] = Qnil;
+ memo = NEW_MEMO(Qundef, Qnil, 0);
rb_block_call(obj, id_each, 0, 0, min_by_i, (VALUE)memo);
- return memo[1];
+ return memo->u2.value;
}
static VALUE
-max_by_i(VALUE i, VALUE *memo, int argc, VALUE *argv)
+max_by_i(VALUE i, VALUE args, int argc, VALUE *argv)
{
+ NODE *memo = RNODE(args);
VALUE v;
ENUM_WANT_SVALUE();
v = rb_yield(i);
- if (memo[0] == Qundef) {
- memo[0] = v;
- memo[1] = i;
+ if (memo->u1.value == Qundef) {
+ memo->u1.value = v;
+ memo->u2.value = i;
}
- else if (rb_cmpint(rb_funcall(v, id_cmp, 1, memo[0]), v, memo[0]) > 0) {
- memo[0] = v;
- memo[1] = i;
+ else if (rb_cmpint(rb_funcall(v, id_cmp, 1, memo->u1.value), v, memo->u1.value) > 0) {
+ memo->u1.value = v;
+ memo->u2.value = i;
}
return Qnil;
}
/*
* call-seq:
- * enum.max_by {|obj| block } -> obj
- * enum.max_by -> an_enumerator
+ * enum.max_by { |obj| block } -> obj
+ * enum.max_by -> an_enumerator
*
* Returns the object in <i>enum</i> that gives the maximum
* value from the given block.
@@ -1461,20 +1534,19 @@ max_by_i(VALUE i, VALUE *memo, int argc, VALUE *argv)
* If no block is given, an enumerator is returned instead.
*
* a = %w(albatross dog horse)
- * a.max_by {|x| x.length } #=> "albatross"
+ * a.max_by { |x| x.length } #=> "albatross"
*/
static VALUE
enum_max_by(VALUE obj)
{
- VALUE memo[2];
+ NODE *memo;
- RETURN_ENUMERATOR(obj, 0, 0);
+ RETURN_SIZED_ENUMERATOR(obj, 0, 0, enum_size);
- memo[0] = Qundef;
- memo[1] = Qnil;
+ memo = NEW_MEMO(Qundef, Qnil, 0);
rb_block_call(obj, id_each, 0, 0, max_by_i, (VALUE)memo);
- return memo[1];
+ return memo->u2.value;
}
struct minmax_by_t {
@@ -1510,7 +1582,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)
{
- struct minmax_by_t *memo = (struct minmax_by_t *)_memo;
+ struct minmax_by_t *memo = MEMO_FOR(struct minmax_by_t, _memo);
VALUE vi, vj, j;
int n;
@@ -1549,43 +1621,47 @@ minmax_by_i(VALUE i, VALUE _memo, int argc, VALUE *argv)
/*
* call-seq:
- * enum.minmax_by {|obj| block } -> [min, max]
- * enum.minmax_by -> an_enumerator
+ * enum.minmax_by { |obj| block } -> [min, max]
+ * enum.minmax_by -> an_enumerator
*
- * Returns two elements array array containing the objects in
- * <i>enum</i> that gives the minimum and maximum values respectively
+ * Returns a two element array containing the objects in
+ * <i>enum</i> that correspond to the minimum and maximum values respectively
* from the given block.
*
* If no block is given, an enumerator is returned instead.
*
* a = %w(albatross dog horse)
- * a.minmax_by {|x| x.length } #=> ["dog", "albatross"]
+ * a.minmax_by { |x| x.length } #=> ["dog", "albatross"]
*/
static VALUE
enum_minmax_by(VALUE obj)
{
- struct minmax_by_t memo;
+ VALUE memo;
+ struct minmax_by_t *m = NEW_MEMO_FOR(struct minmax_by_t, memo);
- RETURN_ENUMERATOR(obj, 0, 0);
+ RETURN_SIZED_ENUMERATOR(obj, 0, 0, enum_size);
- memo.min_bv = Qundef;
- memo.max_bv = Qundef;
- memo.min = Qnil;
- memo.max = Qnil;
- memo.last_bv = Qundef;
- memo.last = Qundef;
- rb_block_call(obj, id_each, 0, 0, minmax_by_i, (VALUE)&memo);
- if (memo.last_bv != Qundef)
- minmax_by_i_update(memo.last_bv, memo.last_bv, memo.last, memo.last, &memo);
- return rb_assoc_new(memo.min, memo.max);
+ m->min_bv = Qundef;
+ m->max_bv = Qundef;
+ m->min = Qnil;
+ m->max = Qnil;
+ m->last_bv = Qundef;
+ m->last = Qundef;
+ rb_block_call(obj, id_each, 0, 0, minmax_by_i, memo);
+ if (m->last_bv != Qundef)
+ minmax_by_i_update(m->last_bv, m->last_bv, m->last, m->last, m);
+ m = MEMO_FOR(struct minmax_by_t, memo);
+ return rb_assoc_new(m->min, m->max);
}
static VALUE
-member_i(VALUE iter, VALUE *memo, int argc, VALUE *argv)
+member_i(VALUE iter, VALUE args, int argc, VALUE *argv)
{
- if (rb_equal(enum_values_pack(argc, argv), memo[0])) {
- memo[1] = Qtrue;
+ NODE *memo = RNODE(args);
+
+ if (rb_equal(rb_enum_values_pack(argc, argv), memo->u1.value)) {
+ memo->u2.value = Qtrue;
rb_iter_break();
}
return Qnil;
@@ -1607,26 +1683,24 @@ member_i(VALUE iter, VALUE *memo, int argc, VALUE *argv)
static VALUE
enum_member(VALUE obj, VALUE val)
{
- VALUE memo[2];
+ NODE *memo = NEW_MEMO(val, Qfalse, 0);
- memo[0] = val;
- memo[1] = Qfalse;
rb_block_call(obj, id_each, 0, 0, member_i, (VALUE)memo);
- return memo[1];
+ return memo->u2.value;
}
static VALUE
each_with_index_i(VALUE i, VALUE memo, int argc, VALUE *argv)
{
- long n = (*(VALUE *)memo)++;
+ long n = RNODE(memo)->u3.cnt++;
- return rb_yield_values(2, enum_values_pack(argc, argv), INT2NUM(n));
+ return rb_yield_values(2, rb_enum_values_pack(argc, argv), INT2NUM(n));
}
/*
* call-seq:
- * enum.each_with_index(*args) {|obj, i| block } -> enum
- * enum.each_with_index(*args) -> an_enumerator
+ * enum.each_with_index(*args) { |obj, i| block } -> enum
+ * enum.each_with_index(*args) -> an_enumerator
*
* Calls <em>block</em> with two arguments, the item and its index,
* for each item in <i>enum</i>. Given arguments are passed through
@@ -1635,7 +1709,7 @@ each_with_index_i(VALUE i, VALUE memo, int argc, VALUE *argv)
* If no block is given, an enumerator is returned instead.
*
* hash = Hash.new
- * %w(cat dog wombat).each_with_index {|item, index|
+ * %w(cat dog wombat).each_with_index { |item, index|
* hash[item] = index
* }
* hash #=> {"cat"=>0, "dog"=>1, "wombat"=>2}
@@ -1645,26 +1719,26 @@ each_with_index_i(VALUE i, VALUE memo, int argc, VALUE *argv)
static VALUE
enum_each_with_index(int argc, VALUE *argv, VALUE obj)
{
- long memo;
+ NODE *memo;
- RETURN_ENUMERATOR(obj, argc, argv);
+ RETURN_SIZED_ENUMERATOR(obj, argc, argv, enum_size);
- memo = 0;
- rb_block_call(obj, id_each, argc, argv, each_with_index_i, (VALUE)&memo);
+ memo = NEW_MEMO(0, 0, 0);
+ rb_block_call(obj, id_each, argc, argv, each_with_index_i, (VALUE)memo);
return obj;
}
/*
* call-seq:
- * enum.reverse_each(*args) {|item| block } -> enum
- * enum.reverse_each(*args) -> an_enumerator
+ * enum.reverse_each(*args) { |item| block } -> enum
+ * enum.reverse_each(*args) -> an_enumerator
*
* Builds a temporary array and traverses that array in reverse order.
*
* If no block is given, an enumerator is returned instead.
*
- * (1..3).reverse_each {|v| p v }
+ * (1..3).reverse_each { |v| p v }
*
* produces:
*
@@ -1679,12 +1753,12 @@ enum_reverse_each(int argc, VALUE *argv, VALUE obj)
VALUE ary;
long i;
- RETURN_ENUMERATOR(obj, argc, argv);
+ RETURN_SIZED_ENUMERATOR(obj, argc, argv, enum_size);
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;
@@ -1701,8 +1775,8 @@ each_val_i(VALUE i, VALUE p, int argc, VALUE *argv)
/*
* call-seq:
- * enum.each_entry {|obj| block} -> enum
- * enum.each_entry -> an_enumerator
+ * enum.each_entry { |obj| block } -> enum
+ * enum.each_entry -> an_enumerator
*
* Calls <i>block</i> once for each element in +self+, passing that
* element as a parameter, converting multiple values from yield to an
@@ -1714,11 +1788,11 @@ each_val_i(VALUE i, VALUE p, int argc, VALUE *argv)
* include Enumerable
* def each
* yield 1
- * yield 1,2
+ * yield 1, 2
* yield
* end
* end
- * Foo.new.each_entry{|o| p o }
+ * Foo.new.each_entry{ |o| p o }
*
* produces:
*
@@ -1731,39 +1805,53 @@ each_val_i(VALUE i, VALUE p, int argc, VALUE *argv)
static VALUE
enum_each_entry(int argc, VALUE *argv, VALUE obj)
{
- RETURN_ENUMERATOR(obj, argc, argv);
+ RETURN_SIZED_ENUMERATOR(obj, argc, argv, enum_size);
rb_block_call(obj, id_each, argc, argv, each_val_i, 0);
return obj;
}
static VALUE
-each_slice_i(VALUE i, VALUE *memo, int argc, VALUE *argv)
+each_slice_i(VALUE i, VALUE m, int argc, VALUE *argv)
{
- VALUE ary = memo[0];
+ NODE *memo = RNODE(m);
+ VALUE ary = memo->u1.value;
VALUE v = Qnil;
- long size = (long)memo[1];
+ long size = memo->u3.cnt;
ENUM_WANT_SVALUE();
rb_ary_push(ary, i);
if (RARRAY_LEN(ary) == size) {
v = rb_yield(ary);
- memo[0] = rb_ary_new2(size);
+ memo->u1.value = rb_ary_new2(size);
}
return v;
}
+static VALUE
+enum_each_slice_size(VALUE obj, VALUE args, VALUE eobj)
+{
+ VALUE n, size;
+ long slice_size = NUM2LONG(RARRAY_AREF(args, 0));
+ if (slice_size <= 0) rb_raise(rb_eArgError, "invalid slice size");
+
+ size = enum_size(obj, 0, 0);
+ if (size == Qnil) return Qnil;
+
+ n = rb_funcall(size, '+', 1, LONG2NUM(slice_size-1));
+ return rb_funcall(n, id_div, 1, LONG2FIX(slice_size));
+}
+
/*
* call-seq:
- * enum.each_slice(n) {...} -> nil
- * enum.each_slice(n) -> an_enumerator
+ * enum.each_slice(n) { ... } -> nil
+ * enum.each_slice(n) -> an_enumerator
*
* Iterates the given block for each slice of <n> elements. If no
* block is given, returns an enumerator.
*
- * e.g.:
- * (1..10).each_slice(3) {|a| p a}
+ * (1..10).each_slice(3) { |a| p a }
* # outputs below
* [1, 2, 3]
* [4, 5, 6]
@@ -1775,27 +1863,27 @@ static VALUE
enum_each_slice(VALUE obj, VALUE n)
{
long size = NUM2LONG(n);
- VALUE args[2], ary;
+ VALUE ary;
+ NODE *memo;
if (size <= 0) rb_raise(rb_eArgError, "invalid slice size");
- RETURN_ENUMERATOR(obj, 1, &n);
- args[0] = rb_ary_new2(size);
- args[1] = (VALUE)size;
-
- rb_block_call(obj, id_each, 0, 0, each_slice_i, (VALUE)args);
-
- ary = args[0];
+ RETURN_SIZED_ENUMERATOR(obj, 1, &n, enum_each_slice_size);
+ ary = rb_ary_new2(size);
+ memo = NEW_MEMO(ary, 0, 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);
return Qnil;
}
static VALUE
-each_cons_i(VALUE i, VALUE *memo, int argc, VALUE *argv)
+each_cons_i(VALUE i, VALUE args, int argc, VALUE *argv)
{
- VALUE ary = memo[0];
+ NODE *memo = RNODE(args);
+ VALUE ary = memo->u1.value;
VALUE v = Qnil;
- long size = (long)memo[1];
+ long size = memo->u3.cnt;
ENUM_WANT_SVALUE();
if (RARRAY_LEN(ary) == size) {
@@ -1808,16 +1896,30 @@ each_cons_i(VALUE i, VALUE *memo, int argc, VALUE *argv)
return v;
}
+static VALUE
+enum_each_cons_size(VALUE obj, VALUE args, VALUE eobj)
+{
+ VALUE n, size;
+ long cons_size = NUM2LONG(RARRAY_AREF(args, 0));
+ if (cons_size <= 0) rb_raise(rb_eArgError, "invalid size");
+
+ size = enum_size(obj, 0, 0);
+ if (size == Qnil) return Qnil;
+
+ n = rb_funcall(size, '+', 1, LONG2NUM(1 - cons_size));
+ return (rb_cmpint(rb_funcall(n, id_cmp, 1, LONG2FIX(0)), n, LONG2FIX(0)) == -1) ? LONG2FIX(0) : n;
+}
+
/*
* call-seq:
- * enum.each_cons(n) {...} -> nil
+ * enum.each_cons(n) { ... } -> nil
* enum.each_cons(n) -> an_enumerator
*
* Iterates the given block for each array of consecutive <n>
* elements. If no block is given, returns an enumerator.
*
* e.g.:
- * (1..10).each_cons(3) {|a| p a}
+ * (1..10).each_cons(3) { |a| p a }
* # outputs below
* [1, 2, 3]
* [2, 3, 4]
@@ -1833,14 +1935,12 @@ static VALUE
enum_each_cons(VALUE obj, VALUE n)
{
long size = NUM2LONG(n);
- VALUE args[2];
+ NODE *memo;
if (size <= 0) rb_raise(rb_eArgError, "invalid size");
- RETURN_ENUMERATOR(obj, 1, &n);
- args[0] = rb_ary_new2(size);
- args[1] = (VALUE)size;
-
- rb_block_call(obj, id_each, 0, 0, each_cons_i, (VALUE)args);
+ RETURN_SIZED_ENUMERATOR(obj, 1, &n, enum_each_cons_size);
+ memo = NEW_MEMO(rb_ary_new2(size), 0, size);
+ rb_block_call(obj, id_each, 0, 0, each_cons_i, (VALUE)memo);
return Qnil;
}
@@ -1854,23 +1954,22 @@ each_with_object_i(VALUE i, VALUE memo, int argc, VALUE *argv)
/*
* call-seq:
- * enum.each_with_object(obj) {|(*args), memo_obj| ... } -> obj
- * enum.each_with_object(obj) -> an_enumerator
+ * enum.each_with_object(obj) { |(*args), memo_obj| ... } -> obj
+ * enum.each_with_object(obj) -> an_enumerator
*
* Iterates the given block for each element with an arbitrary
* object given, and returns the initially given object.
*
* If no block is given, returns an enumerator.
*
- * e.g.:
- * evens = (1..10).each_with_object([]) {|i, a| a << i*2 }
+ * evens = (1..10).each_with_object([]) { |i, a| a << i*2 }
* #=> [2, 4, 6, 8, 10, 12, 14, 16, 18, 20]
*
*/
static VALUE
enum_each_with_object(VALUE obj, VALUE memo)
{
- RETURN_ENUMERATOR(obj, 1, &memo);
+ RETURN_SIZED_ENUMERATOR(obj, 1, &memo, enum_size);
rb_block_call(obj, id_each, 0, 0, each_with_object_i, memo);
@@ -1887,15 +1986,15 @@ zip_ary(VALUE val, NODE *memo, int argc, VALUE *argv)
int i;
tmp = rb_ary_new2(RARRAY_LEN(args) + 1);
- rb_ary_store(tmp, 0, enum_values_pack(argc, argv));
+ 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)) {
@@ -1928,18 +2027,18 @@ zip_i(VALUE val, NODE *memo, int argc, VALUE *argv)
int i;
tmp = rb_ary_new2(RARRAY_LEN(args) + 1);
- rb_ary_store(tmp, 0, enum_values_pack(argc, argv));
+ 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];
- rb_rescue2(call_next, (VALUE)v, call_stop, (VALUE)v, rb_eStopIteration, 0);
+ 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]);
@@ -1956,8 +2055,8 @@ zip_i(VALUE val, NODE *memo, int argc, VALUE *argv)
/*
* call-seq:
- * enum.zip(arg, ...) -> an_array_of_array
- * enum.zip(arg, ...) {|arr| block } -> nil
+ * enum.zip(arg, ...) -> an_array_of_array
+ * enum.zip(arg, ...) { |arr| block } -> nil
*
* Takes one element from <i>enum</i> and merges corresponding
* elements from each <i>args</i>. This generates a sequence of
@@ -1971,9 +2070,9 @@ zip_i(VALUE val, NODE *memo, int argc, VALUE *argv)
* a = [ 4, 5, 6 ]
* b = [ 7, 8, 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]]
+ * [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]]
*
*/
@@ -1999,6 +2098,10 @@ enum_zip(int argc, VALUE *argv, VALUE obj)
if (!allary) {
CONST_ID(conv, "to_enum");
for (i=0; i<argc; i++) {
+ if (!rb_respond_to(argv[i], id_each)) {
+ rb_raise(rb_eTypeError, "wrong argument type %s (must respond to :each)",
+ rb_obj_classname(argv[i]));
+ }
argv[i] = rb_funcall(argv[i], conv, 1, ID2SYM(id_each));
}
}
@@ -2013,10 +2116,11 @@ enum_zip(int argc, VALUE *argv, VALUE obj)
}
static VALUE
-take_i(VALUE i, VALUE *arg, int argc, VALUE *argv)
+take_i(VALUE i, VALUE args, int argc, VALUE *argv)
{
- rb_ary_push(arg[0], enum_values_pack(argc, argv));
- if (--arg[1] == 0) rb_iter_break();
+ NODE *memo = RNODE(args);
+ rb_ary_push(memo->u1.value, rb_enum_values_pack(argc, argv));
+ if (--memo->u3.cnt == 0) rb_iter_break();
return Qnil;
}
@@ -2034,7 +2138,8 @@ take_i(VALUE i, VALUE *arg, int argc, VALUE *argv)
static VALUE
enum_take(VALUE obj, VALUE n)
{
- VALUE args[2];
+ NODE *memo;
+ VALUE result;
long len = NUM2LONG(n);
if (len < 0) {
@@ -2042,25 +2147,25 @@ enum_take(VALUE obj, VALUE n)
}
if (len == 0) return rb_ary_new2(0);
- args[0] = rb_ary_new();
- args[1] = len;
- rb_block_call(obj, id_each, 0, 0, take_i, (VALUE)args);
- return args[0];
+ result = rb_ary_new2(len);
+ memo = NEW_MEMO(result, 0, len);
+ rb_block_call(obj, id_each, 0, 0, take_i, (VALUE)memo);
+ return result;
}
static VALUE
-take_while_i(VALUE i, VALUE *ary, int argc, VALUE *argv)
+take_while_i(VALUE i, VALUE ary, int argc, VALUE *argv)
{
if (!RTEST(enum_yield(argc, argv))) rb_iter_break();
- rb_ary_push(*ary, enum_values_pack(argc, argv));
+ rb_ary_push(ary, rb_enum_values_pack(argc, argv));
return Qnil;
}
/*
* call-seq:
- * enum.take_while {|arr| block } -> array
- * enum.take_while -> an_enumerator
+ * enum.take_while { |arr| block } -> array
+ * enum.take_while -> an_enumerator
*
* Passes elements to the block until the block returns +nil+ or +false+,
* then stops iterating and returns an array of all prior elements.
@@ -2068,7 +2173,7 @@ take_while_i(VALUE i, VALUE *ary, int argc, VALUE *argv)
* If no block is given, an enumerator is returned instead.
*
* a = [1, 2, 3, 4, 5, 0]
- * a.take_while {|i| i < 3 } #=> [1, 2]
+ * a.take_while { |i| i < 3 } #=> [1, 2]
*
*/
@@ -2079,18 +2184,19 @@ enum_take_while(VALUE obj)
RETURN_ENUMERATOR(obj, 0, 0);
ary = rb_ary_new();
- rb_block_call(obj, id_each, 0, 0, take_while_i, (VALUE)&ary);
+ rb_block_call(obj, id_each, 0, 0, take_while_i, ary);
return ary;
}
static VALUE
-drop_i(VALUE i, VALUE *arg, int argc, VALUE *argv)
+drop_i(VALUE i, VALUE args, int argc, VALUE *argv)
{
- if (arg[1] == 0) {
- rb_ary_push(arg[0], enum_values_pack(argc, argv));
+ NODE *memo = RNODE(args);
+ if (memo->u3.cnt == 0) {
+ rb_ary_push(memo->u1.value, rb_enum_values_pack(argc, argv));
}
else {
- arg[1]--;
+ memo->u3.cnt--;
}
return Qnil;
}
@@ -2110,37 +2216,39 @@ drop_i(VALUE i, VALUE *arg, int argc, VALUE *argv)
static VALUE
enum_drop(VALUE obj, VALUE n)
{
- VALUE args[2];
+ VALUE result;
+ NODE *memo;
long len = NUM2LONG(n);
if (len < 0) {
rb_raise(rb_eArgError, "attempt to drop negative size");
}
- args[1] = len;
- args[0] = rb_ary_new();
- rb_block_call(obj, id_each, 0, 0, drop_i, (VALUE)args);
- return args[0];
+ result = rb_ary_new();
+ memo = NEW_MEMO(result, 0, len);
+ rb_block_call(obj, id_each, 0, 0, drop_i, (VALUE)memo);
+ return result;
}
static VALUE
-drop_while_i(VALUE i, VALUE *args, int argc, VALUE *argv)
+drop_while_i(VALUE i, VALUE args, int argc, VALUE *argv)
{
+ NODE *memo = RNODE(args);
ENUM_WANT_SVALUE();
- if (!args[1] && !RTEST(rb_yield(i))) {
- args[1] = Qtrue;
+ if (!memo->u3.state && !RTEST(rb_yield(i))) {
+ memo->u3.state = TRUE;
}
- if (args[1]) {
- rb_ary_push(args[0], i);
+ if (memo->u3.state) {
+ rb_ary_push(memo->u1.value, i);
}
return Qnil;
}
/*
* call-seq:
- * enum.drop_while {|arr| block } -> array
+ * enum.drop_while { |arr| block } -> array
* enum.drop_while -> an_enumerator
*
* Drops elements up to, but not including, the first element for
@@ -2150,20 +2258,21 @@ drop_while_i(VALUE i, VALUE *args, int argc, VALUE *argv)
* If no block is given, an enumerator is returned instead.
*
* a = [1, 2, 3, 4, 5, 0]
- * a.drop_while {|i| i < 3 } #=> [3, 4, 5, 0]
+ * a.drop_while { |i| i < 3 } #=> [3, 4, 5, 0]
*
*/
static VALUE
enum_drop_while(VALUE obj)
{
- VALUE args[2];
+ VALUE result;
+ NODE *memo;
RETURN_ENUMERATOR(obj, 0, 0);
- args[0] = rb_ary_new();
- args[1] = Qfalse;
- rb_block_call(obj, id_each, 0, 0, drop_while_i, (VALUE)args);
- return args[0];
+ result = rb_ary_new();
+ memo = NEW_MEMO(result, 0, FALSE);
+ rb_block_call(obj, id_each, 0, 0, drop_while_i, (VALUE)memo);
+ return result;
}
static VALUE
@@ -2176,9 +2285,27 @@ cycle_i(VALUE i, VALUE ary, int argc, VALUE *argv)
return Qnil;
}
+static VALUE
+enum_cycle_size(VALUE self, VALUE args, VALUE eobj)
+{
+ long mul;
+ VALUE n = Qnil;
+ VALUE size = enum_size(self, args, 0);
+
+ if (size == Qnil) return Qnil;
+
+ if (args && (RARRAY_LEN(args) > 0)) {
+ n = RARRAY_AREF(args, 0);
+ }
+ if (n == Qnil) return DBL2NUM(INFINITY);
+ mul = NUM2LONG(n);
+ if (mul <= 0) return INT2FIX(0);
+ return rb_funcall(size, '*', 1, LONG2FIX(mul));
+}
+
/*
* call-seq:
- * enum.cycle(n=nil) {|obj| block } -> nil
+ * enum.cycle(n=nil) { |obj| block } -> nil
* enum.cycle(n=nil) -> an_enumerator
*
* Calls <i>block</i> for each element of <i>enum</i> repeatedly _n_
@@ -2192,8 +2319,8 @@ cycle_i(VALUE i, VALUE ary, int argc, VALUE *argv)
* If no block is given, an enumerator is returned instead.
*
* a = ["a", "b", "c"]
- * a.cycle {|x| puts x } # print, a, b, c, a, b, c,.. forever.
- * a.cycle(2) {|x| puts x } # print, a, b, c, a, b, c.
+ * a.cycle { |x| puts x } # print, a, b, c, a, b, c,.. forever.
+ * a.cycle(2) { |x| puts x } # print, a, b, c, a, b, c.
*
*/
@@ -2206,7 +2333,7 @@ enum_cycle(int argc, VALUE *argv, VALUE obj)
rb_scan_args(argc, argv, "01", &nv);
- RETURN_ENUMERATOR(obj, argc, argv);
+ RETURN_SIZED_ENUMERATOR(obj, argc, argv, enum_cycle_size);
if (NIL_P(nv)) {
n = -1;
}
@@ -2215,13 +2342,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;
@@ -2238,7 +2365,7 @@ struct chunk_arg {
static VALUE
chunk_ii(VALUE i, VALUE _argp, int argc, VALUE *argv)
{
- struct chunk_arg *argp = (struct chunk_arg *)_argp;
+ struct chunk_arg *argp = MEMO_FOR(struct chunk_arg, _argp);
VALUE v;
VALUE alone = ID2SYM(rb_intern("_alone"));
VALUE separator = ID2SYM(rb_intern("_separator"));
@@ -2246,25 +2373,25 @@ chunk_ii(VALUE i, VALUE _argp, int argc, VALUE *argv)
ENUM_WANT_SVALUE();
if (NIL_P(argp->state))
- v = rb_funcall(argp->categorize, rb_intern("call"), 1, i);
+ v = rb_funcall(argp->categorize, id_call, 1, i);
else
- v = rb_funcall(argp->categorize, rb_intern("call"), 2, i, argp->state);
+ v = rb_funcall(argp->categorize, id_call, 2, i, argp->state);
if (v == alone) {
if (!NIL_P(argp->prev_value)) {
- rb_funcall(argp->yielder, rb_intern("<<"), 1, rb_assoc_new(argp->prev_value, argp->prev_elts));
+ rb_funcall(argp->yielder, id_lshift, 1, rb_assoc_new(argp->prev_value, argp->prev_elts));
argp->prev_value = argp->prev_elts = Qnil;
}
- rb_funcall(argp->yielder, rb_intern("<<"), 1, rb_assoc_new(v, rb_ary_new3(1, i)));
+ rb_funcall(argp->yielder, id_lshift, 1, rb_assoc_new(v, rb_ary_new3(1, i)));
}
else if (NIL_P(v) || v == separator) {
if (!NIL_P(argp->prev_value)) {
- rb_funcall(argp->yielder, rb_intern("<<"), 1, rb_assoc_new(argp->prev_value, argp->prev_elts));
+ rb_funcall(argp->yielder, id_lshift, 1, rb_assoc_new(argp->prev_value, argp->prev_elts));
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");
+ rb_raise(rb_eRuntimeError, "symbols beginning with an underscore are reserved");
}
else {
if (NIL_P(argp->prev_value)) {
@@ -2276,7 +2403,7 @@ chunk_ii(VALUE i, VALUE _argp, int argc, VALUE *argv)
rb_ary_push(argp->prev_elts, i);
}
else {
- rb_funcall(argp->yielder, rb_intern("<<"), 1, rb_assoc_new(argp->prev_value, argp->prev_elts));
+ rb_funcall(argp->yielder, id_lshift, 1, rb_assoc_new(argp->prev_value, argp->prev_elts));
argp->prev_value = v;
argp->prev_elts = rb_ary_new3(1, i);
}
@@ -2289,44 +2416,42 @@ static VALUE
chunk_i(VALUE yielder, VALUE enumerator, int argc, VALUE *argv)
{
VALUE enumerable;
- struct chunk_arg arg;
+ VALUE arg;
+ struct chunk_arg *memo = NEW_MEMO_FOR(struct chunk_arg, arg);
enumerable = rb_ivar_get(enumerator, rb_intern("chunk_enumerable"));
- arg.categorize = rb_ivar_get(enumerator, rb_intern("chunk_categorize"));
- arg.state = rb_ivar_get(enumerator, rb_intern("chunk_initial_state"));
- arg.prev_value = Qnil;
- arg.prev_elts = Qnil;
- arg.yielder = yielder;
-
- if (!NIL_P(arg.state))
- arg.state = rb_obj_dup(arg.state);
-
- rb_block_call(enumerable, id_each, 0, 0, chunk_ii, (VALUE)&arg);
- if (!NIL_P(arg.prev_elts))
- rb_funcall(arg.yielder, rb_intern("<<"), 1, rb_assoc_new(arg.prev_value, arg.prev_elts));
+ memo->categorize = rb_ivar_get(enumerator, rb_intern("chunk_categorize"));
+ memo->state = rb_ivar_get(enumerator, rb_intern("chunk_initial_state"));
+ memo->prev_value = Qnil;
+ memo->prev_elts = Qnil;
+ memo->yielder = yielder;
+
+ if (!NIL_P(memo->state))
+ memo->state = rb_obj_dup(memo->state);
+
+ rb_block_call(enumerable, id_each, 0, 0, chunk_ii, arg);
+ memo = MEMO_FOR(struct chunk_arg, arg);
+ if (!NIL_P(memo->prev_elts))
+ rb_funcall(memo->yielder, id_lshift, 1, rb_assoc_new(memo->prev_value, memo->prev_elts));
return Qnil;
}
/*
* call-seq:
- * enum.chunk {|elt| ... } -> an_enumerator
- * enum.chunk(initial_state) {|elt, state| ... } -> an_enumerator
- *
- * Creates an enumerator for each chunked elements.
- * The consecutive elements which have same block value are chunked.
+ * enum.chunk { |elt| ... } -> an_enumerator
+ * enum.chunk(initial_state) { |elt, state| ... } -> an_enumerator
*
- * The result enumerator yields the block value and an array of chunked elements.
- * So "each" method can be called as follows.
+ * Enumerates over the items, chunking them together based on the return
+ * value of the block.
*
- * enum.chunk {|elt| key }.each {|key, ary| ... }
- * enum.chunk(initial_state) {|elt, state| key }.each {|key, ary| ... }
+ * Consecutive elements which return the same block value are chunked together.
*
* For example, consecutive even numbers and odd numbers can be
- * splitted as follows.
+ * chunked as follows.
*
- * [3,1,4,1,5,9,2,6,5,3,5].chunk {|n|
+ * [3, 1, 4, 1, 5, 9, 2, 6, 5, 3, 5].chunk { |n|
* n.even?
- * }.each {|even, ary|
+ * }.each { |even, ary|
* p [even, ary]
* }
* #=> [false, [3, 1]]
@@ -2338,8 +2463,8 @@ chunk_i(VALUE yielder, VALUE enumerator, int argc, VALUE *argv)
* This method is especially useful for sorted series of elements.
* The following example counts words for each initial letter.
*
- * open("/usr/share/dict/words", "r:iso-8859-1") {|f|
- * f.chunk {|line| line.ord }.each {|ch, lines| p [ch.chr, lines.length] }
+ * open("/usr/share/dict/words", "r:iso-8859-1") { |f|
+ * f.chunk { |line| line.ord }.each { |ch, lines| p [ch.chr, lines.length] }
* }
* #=> ["\n", 1]
* # ["A", 1327]
@@ -2348,19 +2473,24 @@ chunk_i(VALUE yielder, VALUE enumerator, int argc, VALUE *argv)
* # ["D", 791]
* # ...
*
- * The following key values has special meaning:
- * - nil and :_separator specifies that the elements are dropped.
- * - :_alone specifies that the element should be chunked as a singleton.
- * Other symbols which begins an underscore are reserved.
+ * The following key values have special meaning:
+ * - +nil+ and +:_separator+ specifies that the elements should be dropped.
+ * - +:_alone+ specifies that the element should be chunked by itself.
*
- * nil and :_separator can be used to ignore some elements.
- * For example, the sequence of hyphens in svn log can be eliminated as follows.
+ * Any other symbols that begin with an underscore will raise an error:
+ *
+ * items.chunk { |item| :_underscore }
+ * #=> RuntimeError: symbols beginning with an underscore are reserved
+ *
+ * +nil+ and +:_separator+ can be used to ignore some elements.
+ *
+ * For example, the sequence of hyphens in svn log can be eliminated as follows:
*
* sep = "-"*72 + "\n"
- * IO.popen("svn log README") {|f|
- * f.chunk {|line|
+ * IO.popen("svn log README") { |f|
+ * f.chunk { |line|
* line != sep || nil
- * }.each {|_, lines|
+ * }.each { |_, lines|
* pp lines
* }
* }
@@ -2374,34 +2504,30 @@ chunk_i(VALUE yielder, VALUE enumerator, int argc, VALUE *argv)
* # "\n"]
* # ...
*
- * paragraphs separated by empty lines can be parsed as follows.
+ * Paragraphs separated by empty lines can be parsed as follows:
*
- * File.foreach("README").chunk {|line|
+ * File.foreach("README").chunk { |line|
* /\A\s*\z/ !~ line || nil
- * }.each {|_, lines|
+ * }.each { |_, lines|
* pp lines
* }
*
- * :_alone can be used to pass through bunch of elements.
- * For example, sort consecutive lines formed as Foo#bar and
- * pass other lines, chunk can be used as follows.
+ * +:_alone+ can be used to force items into their own chunk.
+ * For example, you can put lines that contain a URL by themselves,
+ * and chunk the rest of the lines together, like this:
*
- * pat = /\A[A-Z][A-Za-z0-9_]+\#/
- * open(filename) {|f|
- * f.chunk {|line| pat =~ line ? $& : :_alone }.each {|key, lines|
- * if key != :_alone
- * print lines.sort.join('')
- * else
- * print lines.join('')
- * end
+ * pattern = /http/
+ * open(filename) { |f|
+ * f.chunk { |line| line =~ pattern ? :_alone : true }.each { |key, lines|
+ * pp lines
* }
* }
*
* If the block needs to maintain state over multiple elements,
- * _initial_state_ argument can be used.
- * If non-nil value is given,
- * it is duplicated for each "each" method invocation of the enumerator.
- * The duplicated object is passed to 2nd argument of the block for "chunk" method.
+ * an +initial_state+ argument can be used.
+ * If a non-nil value is given,
+ * a reference to it is passed as the 2nd argument of the block for the
+ * +chunk+ method, so state-changes to it persist across block calls.
*
*/
static VALUE
@@ -2410,7 +2536,7 @@ enum_chunk(int argc, VALUE *argv, VALUE enumerable)
VALUE initial_state;
VALUE enumerator;
- if(!rb_block_given_p())
+ if (!rb_block_given_p())
rb_raise(rb_eArgError, "no block given");
rb_scan_args(argc, argv, "01", &initial_state);
@@ -2418,7 +2544,7 @@ enum_chunk(int argc, VALUE *argv, VALUE enumerable)
rb_ivar_set(enumerator, rb_intern("chunk_enumerable"), enumerable);
rb_ivar_set(enumerator, rb_intern("chunk_categorize"), rb_block_proc());
rb_ivar_set(enumerator, rb_intern("chunk_initial_state"), initial_state);
- rb_block_call(enumerator, rb_intern("initialize"), 0, 0, chunk_i, enumerator);
+ rb_block_call(enumerator, idInitialize, 0, 0, chunk_i, enumerator);
return enumerator;
}
@@ -2434,7 +2560,7 @@ struct slicebefore_arg {
static VALUE
slicebefore_ii(VALUE i, VALUE _argp, int argc, VALUE *argv)
{
- struct slicebefore_arg *argp = (struct slicebefore_arg *)_argp;
+ struct slicebefore_arg *argp = MEMO_FOR(struct slicebefore_arg, _argp);
VALUE header_p;
ENUM_WANT_SVALUE();
@@ -2442,12 +2568,12 @@ slicebefore_ii(VALUE i, VALUE _argp, int argc, VALUE *argv)
if (!NIL_P(argp->sep_pat))
header_p = rb_funcall(argp->sep_pat, id_eqq, 1, i);
else if (NIL_P(argp->state))
- header_p = rb_funcall(argp->sep_pred, rb_intern("call"), 1, i);
+ header_p = rb_funcall(argp->sep_pred, id_call, 1, i);
else
- header_p = rb_funcall(argp->sep_pred, rb_intern("call"), 2, i, argp->state);
+ header_p = rb_funcall(argp->sep_pred, id_call, 2, i, argp->state);
if (RTEST(header_p)) {
if (!NIL_P(argp->prev_elts))
- rb_funcall(argp->yielder, rb_intern("<<"), 1, argp->prev_elts);
+ rb_funcall(argp->yielder, id_lshift, 1, argp->prev_elts);
argp->prev_elts = rb_ary_new3(1, i);
}
else {
@@ -2464,69 +2590,71 @@ static VALUE
slicebefore_i(VALUE yielder, VALUE enumerator, int argc, VALUE *argv)
{
VALUE enumerable;
- struct slicebefore_arg arg;
+ VALUE arg;
+ struct slicebefore_arg *memo = NEW_MEMO_FOR(struct slicebefore_arg, arg);
enumerable = rb_ivar_get(enumerator, rb_intern("slicebefore_enumerable"));
- arg.sep_pred = rb_attr_get(enumerator, rb_intern("slicebefore_sep_pred"));
- arg.sep_pat = NIL_P(arg.sep_pred) ? rb_ivar_get(enumerator, rb_intern("slicebefore_sep_pat")) : Qnil;
- arg.state = rb_ivar_get(enumerator, rb_intern("slicebefore_initial_state"));
- arg.prev_elts = Qnil;
- arg.yielder = yielder;
-
- if (!NIL_P(arg.state))
- arg.state = rb_obj_dup(arg.state);
-
- rb_block_call(enumerable, id_each, 0, 0, slicebefore_ii, (VALUE)&arg);
- if (!NIL_P(arg.prev_elts))
- rb_funcall(arg.yielder, rb_intern("<<"), 1, arg.prev_elts);
+ memo->sep_pred = rb_attr_get(enumerator, rb_intern("slicebefore_sep_pred"));
+ memo->sep_pat = NIL_P(memo->sep_pred) ? rb_ivar_get(enumerator, rb_intern("slicebefore_sep_pat")) : Qnil;
+ memo->state = rb_attr_get(enumerator, rb_intern("slicebefore_initial_state"));
+ memo->prev_elts = Qnil;
+ memo->yielder = yielder;
+
+ if (!NIL_P(memo->state))
+ memo->state = rb_obj_dup(memo->state);
+
+ rb_block_call(enumerable, id_each, 0, 0, slicebefore_ii, arg);
+ memo = MEMO_FOR(struct slicebefore_arg, arg);
+ if (!NIL_P(memo->prev_elts))
+ rb_funcall(memo->yielder, id_lshift, 1, memo->prev_elts);
return Qnil;
}
/*
* call-seq:
- * enum.slice_before(pattern) -> an_enumerator
- * enum.slice_before {|elt| bool } -> an_enumerator
- * enum.slice_before(initial_state) {|elt, state| bool } -> an_enumerator
+ * enum.slice_before(pattern) -> an_enumerator
+ * enum.slice_before { |elt| bool } -> an_enumerator
+ * enum.slice_before(initial_state) { |elt, state| bool } -> an_enumerator
*
* Creates an enumerator for each chunked elements.
* The beginnings of chunks are defined by _pattern_ and the block.
- * If _pattern_ === _elt_ returns true or
- * the block returns true for the element,
- * the element is beginning of a chunk.
- *
- * The === and block is called from the first element to the last element
- * of _enum_.
- * The result for the first element is ignored.
- *
- * The result enumerator yields the chunked elements as an array for +each+
- * method.
- * +each+ method can be called as follows.
+
+ * If <code>_pattern_ === _elt_</code> returns <code>true</code> or the block
+ * returns <code>true</code> for the element, the element is beginning of a
+ * chunk.
+
+ * The <code>===</code> and _block_ is called from the first element to the last
+ * element of _enum_. The result for the first element is ignored.
+
+ * The result enumerator yields the chunked elements as an array.
+ * So +each+ method can be called as follows:
*
- * enum.slice_before(pattern).each {|ary| ... }
- * enum.slice_before {|elt| bool }.each {|ary| ... }
- * enum.slice_before(initial_state) {|elt, state| bool }.each {|ary| ... }
+ * enum.slice_before(pattern).each { |ary| ... }
+ * enum.slice_before { |elt| bool }.each { |ary| ... }
+ * enum.slice_before(initial_state) { |elt, state| bool }.each { |ary| ... }
*
- * Other methods of Enumerator class and Enumerable module,
+ * Other methods of the Enumerator class and Enumerable module,
* such as map, etc., are also usable.
*
* For example, iteration over ChangeLog entries can be implemented as
- * follows.
+ * follows:
*
* # iterate over ChangeLog entries.
- * open("ChangeLog") {|f|
- * f.slice_before(/\A\S/).each {|e| pp e}
+ * open("ChangeLog") { |f|
+ * f.slice_before(/\A\S/).each { |e| pp e }
* }
*
* # same as above. block is used instead of pattern argument.
- * open("ChangeLog") {|f|
- * f.slice_before {|line| /\A\S/ === line }.each {|e| pp e}
+ * open("ChangeLog") { |f|
+ * f.slice_before { |line| /\A\S/ === line }.each { |e| pp e }
* }
*
- * "svn proplist -R" produces multiline output for each file.
- * They can be chunked as follows:
*
- * IO.popen([{"LC_ALL"=>"C"}, "svn", "proplist", "-R"]) {|f|
- * f.lines.slice_before(/\AProp/).each {|lines| p lines }
+ * "svn proplist -R" produces multiline output for each file.
+ * They can be chunked as follows:
+ *
+ * IO.popen([{"LC_ALL"=>"C"}, "svn", "proplist", "-R"]) { |f|
+ * f.lines.slice_before(/\AProp/).each { |lines| p lines }
* }
* #=> ["Properties on '.':\n", " svn:ignore\n", " svk:merge\n"]
* # ["Properties on 'goruby.c':\n", " svn:eol-style\n"]
@@ -2539,30 +2667,29 @@ slicebefore_i(VALUE yielder, VALUE enumerator, int argc, VALUE *argv)
* For example, three or more consecutive increasing numbers can be squashed
* as follows:
*
- * a = [0,2,3,4,6,7,9]
+ * a = [0, 2, 3, 4, 6, 7, 9]
* prev = a[0]
- * p a.slice_before {|e|
+ * p a.slice_before { |e|
* prev, prev2 = e, prev
* prev2 + 1 != e
- * }.map {|es|
+ * }.map { |es|
* es.length <= 2 ? es.join(",") : "#{es.first}-#{es.last}"
* }.join(",")
* #=> "0,2-4,6,7,9"
*
* However local variables are not appropriate to maintain state
* if the result enumerator is used twice or more.
- * In such case, the last state of the 1st +each+ is used in 2nd +each+.
- * _initial_state_ argument can be used to avoid this problem.
+ * In such a case, the last state of the 1st +each+ is used in the 2nd +each+.
+ * The _initial_state_ argument can be used to avoid this problem.
* If non-nil value is given as _initial_state_,
- * it is duplicated for each "each" method invocation of the enumerator.
+ * it is duplicated for each +each+ method invocation of the enumerator.
* The duplicated object is passed to 2nd argument of the block for
* +slice_before+ method.
*
- * # word wrapping.
- * # this assumes all characters have same width.
+ * # Word wrapping. This assumes all characters have same width.
* def wordwrap(words, maxwidth)
* # if cols is a local variable, 2nd "each" may start with non-zero cols.
- * words.slice_before(cols: 0) {|w, h|
+ * words.slice_before(cols: 0) { |w, h|
* h[:cols] += 1 if h[:cols] != 0
* h[:cols] += w.length
* if maxwidth < h[:cols]
@@ -2576,7 +2703,7 @@ slicebefore_i(VALUE yielder, VALUE enumerator, int argc, VALUE *argv)
* text = (1..20).to_a.join(" ")
* enum = wordwrap(text.split(/\s+/), 10)
* puts "-"*10
- * enum.each {|ws| puts ws.join(" ") }
+ * enum.each { |ws| puts ws.join(" ") }
* puts "-"*10
* #=> ----------
* # 1 2 3 4 5
@@ -2587,20 +2714,20 @@ slicebefore_i(VALUE yielder, VALUE enumerator, int argc, VALUE *argv)
* # 20
* # ----------
*
- * mbox contains series of mails which start with Unix From line.
- * So each mail can be extracted by slice before Unix From line.
+ * mbox contains series of mails which start with Unix From line.
+ * So each mail can be extracted by slice before Unix From line.
*
* # parse mbox
- * open("mbox") {|f|
- * f.slice_before {|line|
+ * open("mbox") { |f|
+ * f.slice_before { |line|
* line.start_with? "From "
- * }.each {|mail|
+ * }.each { |mail|
* unix_from = mail.shift
* i = mail.index("\n")
* header = mail[0...i]
* body = mail[(i+1)..-1]
* body.pop if body.last == "\n"
- * fields = header.slice_before {|line| !" \t".include?(line[0]) }.to_a
+ * fields = header.slice_before { |line| !" \t".include?(line[0]) }.to_a
* p unix_from
* pp fields
* pp body
@@ -2608,12 +2735,12 @@ slicebefore_i(VALUE yielder, VALUE enumerator, int argc, VALUE *argv)
* }
*
* # split mails in mbox (slice before Unix From line after an empty line)
- * open("mbox") {|f|
- * f.slice_before(emp: true) {|line,h|
+ * open("mbox") { |f|
+ * f.slice_before(emp: true) { |line, h|
* prevemp = h[:emp]
* h[:emp] = line == "\n"
* prevemp && line.start_with?("From ")
- * }.each {|mail|
+ * }.each { |mail|
* mail.pop if mail.last == "\n"
* pp mail
* }
@@ -2639,7 +2766,7 @@ enum_slice_before(int argc, VALUE *argv, VALUE enumerable)
rb_ivar_set(enumerator, rb_intern("slicebefore_sep_pat"), sep_pat);
}
rb_ivar_set(enumerator, rb_intern("slicebefore_enumerable"), enumerable);
- rb_block_call(enumerator, rb_intern("initialize"), 0, 0, slicebefore_i, enumerator);
+ rb_block_call(enumerator, idInitialize, 0, 0, slicebefore_i, enumerator);
return enumerator;
}
@@ -2664,6 +2791,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);
@@ -2712,4 +2840,7 @@ Init_Enumerable(void)
rb_define_method(rb_mEnumerable, "slice_before", enum_slice_before, -1);
id_next = rb_intern("next");
+ id_call = rb_intern("call");
+ id_size = rb_intern("size");
+ id_div = rb_intern("div");
}
diff --git a/enumerator.c b/enumerator.c
index 09ef298396..a3022ce3bb 100644
--- a/enumerator.c
+++ b/enumerator.c
@@ -13,6 +13,8 @@
************************************************/
#include "ruby/ruby.h"
+#include "node.h"
+#include "internal.h"
/*
* Document-class: Enumerator
@@ -30,17 +32,22 @@
*
* enumerator = %w(one two three).each
* puts enumerator.class # => Enumerator
- * enumerator.each_with_object("foo") do |item,obj|
+ *
+ * enumerator.each_with_object("foo") do |item, obj|
* puts "#{obj}: #{item}"
* end
+ *
* # foo: one
* # foo: two
* # foo: three
+ *
* enum_with_obj = enumerator.each_with_object("foo")
* puts enum_with_obj.class # => Enumerator
- * enum_with_obj.each do |item,obj|
- * puts "#{obj: #{item}"
+ *
+ * enum_with_obj.each do |item, obj|
+ * puts "#{obj}: #{item}"
* end
+ *
* # foo: one
* # foo: two
* # foo: three
@@ -49,7 +56,7 @@
* can map a list's elements to strings containing the index
* and the element as a string via:
*
- * puts %w[foo bar baz].map.with_index {|w,i| "#{i}:#{w}" }
+ * puts %w[foo bar baz].map.with_index { |w, i| "#{i}:#{w}" }
* # => ["0:foo", "1:bar", "2:baz"]
*
* An Enumerator can also be used as an external iterator.
@@ -96,8 +103,10 @@
*
*/
VALUE rb_cEnumerator;
-static ID id_rewind, id_each;
-static VALUE sym_each;
+VALUE rb_cLazy;
+static ID id_rewind, id_each, id_new, id_initialize, id_yield, id_call, id_size, id_to_enum;
+static ID id_eqq, id_next, id_result, id_lazy, id_receiver, id_arguments, id_memo, id_method, id_force;
+static VALUE sym_each, sym_cycle;
VALUE rb_eStopIteration;
@@ -110,6 +119,8 @@ struct enumerator {
VALUE lookahead;
VALUE feedvalue;
VALUE stop_exc;
+ VALUE size;
+ rb_enumerator_size_func *size_fn;
};
static VALUE rb_cGenerator, rb_cYielder;
@@ -139,6 +150,7 @@ enumerator_mark(void *p)
rb_gc_mark(ptr->lookahead);
rb_gc_mark(ptr->feedvalue);
rb_gc_mark(ptr->stop_exc);
+ rb_gc_mark(ptr->size);
}
#define enumerator_free RUBY_TYPED_DEFAULT_FREE
@@ -156,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 *
@@ -172,18 +185,18 @@ enumerator_ptr(VALUE obj)
/*
* call-seq:
- * obj.to_enum(method = :each, *args)
- * obj.enum_for(method = :each, *args)
+ * obj.to_enum(method = :each, *args) -> enum
+ * obj.enum_for(method = :each, *args) -> enum
+ * obj.to_enum(method = :each, *args) {|*args| block} -> enum
+ * obj.enum_for(method = :each, *args){|*args| block} -> enum
*
- * Creates a new Enumerator which will enumerate by on calling +method+ on
- * +obj+.
+ * Creates a new Enumerator which will enumerate by calling +method+ on
+ * +obj+, passing +args+ if any.
*
- * +method+:: the method to call on +obj+ to generate the enumeration
- * +args+:: arguments that will be passed in +method+ <i>in addition</i>
- * to the item itself. Note that the number of args
- * must not exceed the number expected by +method+
+ * If a block is given, it will be used to calculate the size of
+ * the enumerator without the need to iterate it (see Enumerator#size).
*
- * === Example
+ * === Examples
*
* str = "xyz"
*
@@ -197,17 +210,48 @@ enumerator_ptr(VALUE obj)
* a = [1, 2, 3]
* some_method(a.to_enum)
*
+ * It is typical to call to_enum when defining methods for
+ * a generic Enumerable, in case no block is passed.
+ *
+ * Here is such an example, with parameter passing and a sizing block:
+ *
+ * module Enumerable
+ * # a generic method to repeat the values of any enumerable
+ * def repeat(n)
+ * raise ArgumentError, "#{n} is negative!" if n < 0
+ * unless block_given?
+ * return to_enum(__method__, n) do # __method__ is :repeat here
+ * sz = size # Call size and multiply by n...
+ * sz * n if sz # but return nil if size itself is nil
+ * end
+ * end
+ * each do |*val|
+ * n.times { yield *val }
+ * end
+ * end
+ * end
+ *
+ * %i[hello world].repeat(2) { |w| puts w }
+ * # => Prints 'hello', 'hello', 'world', 'world'
+ * enum = (1..14).repeat(3)
+ * # => returns an Enumerator when called without a block
+ * enum.first(4) # => [1, 1, 1, 2]
+ * enum.size # => 42
*/
static VALUE
obj_to_enum(int argc, VALUE *argv, VALUE obj)
{
- VALUE meth = sym_each;
+ VALUE enumerator, meth = sym_each;
if (argc > 0) {
--argc;
meth = *argv++;
}
- return rb_enumeratorize(obj, meth, argc, argv);
+ enumerator = rb_enumeratorize_with_size(obj, meth, argc, argv, 0);
+ if (rb_block_given_p()) {
+ enumerator_ptr(enumerator)->size = rb_block_proc();
+ }
+ return enumerator;
}
static VALUE
@@ -223,10 +267,11 @@ enumerator_allocate(VALUE klass)
}
static VALUE
-enumerator_init(VALUE enum_obj, VALUE obj, VALUE meth, int argc, VALUE *argv)
+enumerator_init(VALUE enum_obj, VALUE obj, VALUE meth, int argc, 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) {
@@ -241,13 +286,15 @@ enumerator_init(VALUE enum_obj, VALUE obj, VALUE meth, int argc, VALUE *argv)
ptr->lookahead = Qundef;
ptr->feedvalue = Qundef;
ptr->stop_exc = Qfalse;
+ ptr->size = size;
+ ptr->size_fn = size_fn;
return enum_obj;
}
/*
* call-seq:
- * Enumerator.new { |yielder| ... }
+ * Enumerator.new(size = nil) { |yielder| ... }
* Enumerator.new(obj, method = :each, *args)
*
* Creates a new Enumerator object, which can be used as an
@@ -267,6 +314,10 @@ enumerator_init(VALUE enum_obj, VALUE obj, VALUE meth, int argc, VALUE *argv)
*
* p fib.take(10) # => [1, 1, 2, 3, 5, 8, 13, 21, 34, 55]
*
+ * The optional parameter can be used to specify how to calculate the size
+ * in a lazy fashion (see Enumerator#size). It can either be a value or
+ * a callable object.
+ *
* In the second, deprecated, form, a generated Enumerator iterates over the
* given object using the given method with the given arguments passed.
*
@@ -283,14 +334,25 @@ static VALUE
enumerator_initialize(int argc, VALUE *argv, VALUE obj)
{
VALUE recv, meth = sym_each;
+ VALUE size = Qnil;
- if (argc == 0) {
- if (!rb_block_given_p())
- rb_raise(rb_eArgError, "wrong number of argument (0 for 1+)");
-
+ if (rb_block_given_p()) {
+ rb_check_arity(argc, 0, 1);
recv = generator_init(generator_allocate(rb_cGenerator), rb_block_proc());
+ if (argc) {
+ 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 {
+ size = rb_to_int(argv[0]);
+ }
+ argc = 0;
+ }
}
else {
+ rb_check_arity(argc, 1, UNLIMITED_ARGUMENTS);
+ rb_warn("Enumerator.new without a block is deprecated; use Object#to_enum");
recv = *argv++;
if (--argc) {
meth = *argv++;
@@ -298,7 +360,7 @@ enumerator_initialize(int argc, VALUE *argv, VALUE obj)
}
}
- return enumerator_init(obj, recv, meth, argc, argv);
+ return enumerator_init(obj, recv, meth, argc, argv, 0, size);
}
/* :nodoc: */
@@ -307,6 +369,7 @@ enumerator_init_copy(VALUE obj, VALUE orig)
{
struct enumerator *ptr0, *ptr1;
+ if (!OBJ_INIT_COPY(obj, orig)) return obj;
ptr0 = enumerator_ptr(orig);
if (ptr0->fib) {
/* Fibers cannot be copied */
@@ -325,14 +388,34 @@ enumerator_init_copy(VALUE obj, VALUE orig)
ptr1->fib = 0;
ptr1->lookahead = Qundef;
ptr1->feedvalue = Qundef;
+ ptr1->size = ptr0->size;
+ ptr1->size_fn = ptr0->size_fn;
return obj;
}
+/*
+ * For backwards compatibility; use rb_enumeratorize_with_size
+ */
VALUE
rb_enumeratorize(VALUE obj, VALUE meth, int argc, VALUE *argv)
{
- return enumerator_init(enumerator_allocate(rb_cEnumerator), obj, meth, argc, 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, rb_enumerator_size_func *size_fn);
+
+VALUE
+rb_enumeratorize_with_size(VALUE obj, VALUE meth, int argc, VALUE *argv, rb_enumerator_size_func *size_fn)
+{
+ /* Similar effect as calling obj.to_enum, i.e. dispatching to either
+ Kernel#to_enum vs Lazy#to_enum */
+ if (RTEST(rb_obj_is_kind_of(obj, rb_cLazy)))
+ 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);
}
static VALUE
@@ -352,15 +435,59 @@ enumerator_block_call(VALUE obj, rb_block_call_func *func, VALUE 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
+ *
+ * def obj.each_arg(a, b=:b, *rest)
+ * yield a
+ * yield b
+ * yield rest
+ * :method_returned
+ * end
*
- * Iterates over the block according to how this Enumerable was constructed.
- * If no block is given, returns self.
+ * 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
-enumerator_each(VALUE obj)
+enumerator_each(int argc, VALUE *argv, VALUE obj)
{
+ if (argc > 0) {
+ 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);
+ }
+ else {
+ args = rb_ary_new4(argc, argv);
+ }
+ e->args = args;
+ }
if (!rb_block_given_p()) return obj;
return enumerator_block_call(obj, 0, obj);
}
@@ -368,11 +495,9 @@ enumerator_each(VALUE obj)
static VALUE
enumerator_with_index_i(VALUE val, VALUE m, int argc, VALUE *argv)
{
- VALUE idx;
VALUE *memo = (VALUE *)m;
-
- idx = INT2FIX(*memo);
- ++*memo;
+ VALUE idx = *memo;
+ *memo = rb_int_succ(idx);
if (argc <= 1)
return rb_yield_values(2, val, idx);
@@ -380,6 +505,15 @@ enumerator_with_index_i(VALUE val, VALUE m, int argc, VALUE *argv)
return rb_yield_values(2, rb_ary_new4(argc, argv), idx);
}
+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| ... }
@@ -398,8 +532,11 @@ enumerator_with_index(int argc, VALUE *argv, VALUE obj)
VALUE memo;
rb_scan_args(argc, argv, "01", &memo);
- RETURN_ENUMERATOR(obj, argc, argv);
- memo = NIL_P(memo) ? 0 : (VALUE)NUM2LONG(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)&memo);
}
@@ -430,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)
*
@@ -458,7 +597,7 @@ enumerator_with_object_i(VALUE val, VALUE memo, int argc, VALUE *argv)
static VALUE
enumerator_with_object(VALUE obj, VALUE memo)
{
- RETURN_ENUMERATOR(obj, 1, &memo);
+ RETURN_SIZED_ENUMERATOR(obj, 1, &memo, enumerator_enum_size);
enumerator_block_call(obj, enumerator_with_object_i, memo);
return memo;
@@ -487,7 +626,7 @@ next_i(VALUE curr, VALUE obj)
result = rb_block_call(obj, id_each, 0, 0, next_ii, obj);
e->stop_exc = rb_exc_new2(rb_eStopIteration, "iteration reached an end");
- rb_ivar_set(e->stop_exc, rb_intern("result"), result);
+ rb_ivar_set(e->stop_exc, id_result, result);
return rb_fiber_yield(1, &nil);
}
@@ -590,7 +729,7 @@ enumerator_next_values(VALUE obj)
static VALUE
ary2sv(VALUE args, int dup)
{
- if (TYPE(args) != T_ARRAY)
+ if (!RB_TYPE_P(args, T_ARRAY))
return args;
switch (RARRAY_LEN(args)) {
@@ -598,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)
@@ -720,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
@@ -775,60 +932,79 @@ 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, str;
- 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;
}
- eobj = e->obj;
-
- tainted = OBJ_TAINTED(eobj);
- untrusted = OBJ_UNTRUSTED(eobj);
+ eobj = rb_attr_get(obj, id_receiver);
+ if (NIL_P(eobj)) {
+ eobj = e->obj;
+ }
/* (1..100).each_cons(2) => "#<Enumerator: 1..100:each_cons(2)>" */
- str = rb_sprintf("#<%s: ", cname);
- rb_str_concat(str, rb_inspect(eobj));
- rb_str_buf_cat2(str, ":");
- rb_str_buf_cat2(str, rb_id2name(e->meth));
+ str = rb_sprintf("#<%"PRIsVALUE": %+"PRIsVALUE, rb_class_path(cname), eobj);
+ append_method(obj, str, e->meth, e->args);
- if (e->args) {
- long argc = RARRAY_LEN(e->args);
- VALUE *argv = RARRAY_PTR(e->args);
+ rb_str_buf_cat2(str, ">");
+
+ return str;
+}
- rb_str_buf_cat2(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 (method != Qfalse) {
+ ID mid = default_method;
+ if (!NIL_P(method)) {
+ Check_Type(method, T_SYMBOL);
+ mid = SYM2ID(method);
+ }
+ rb_str_buf_cat2(str, ":");
+ rb_str_buf_append(str, rb_id2str(mid));
+ }
+
+ eargs = rb_attr_get(obj, id_arguments);
+ if (NIL_P(eargs)) {
+ eargs = default_args;
+ }
+ if (eargs != Qfalse) {
+ long argc = RARRAY_LEN(eargs);
+ const VALUE *argv = RARRAY_CONST_PTR(eargs); /* WB: no new reference */
- while (argc--) {
- VALUE arg = *argv++;
+ if (argc > 0) {
+ rb_str_buf_cat2(str, "(");
- rb_str_concat(str, rb_inspect(arg));
- rb_str_buf_cat2(str, argc > 0 ? ", " : ")");
+ while (argc--) {
+ VALUE arg = *argv++;
- if (OBJ_TAINTED(arg)) tainted = TRUE;
- if (OBJ_UNTRUSTED(arg)) untrusted = TRUE;
+ rb_str_append(str, rb_inspect(arg));
+ rb_str_buf_cat2(str, argc > 0 ? ", " : ")");
+ OBJ_INFECT(str, arg);
+ }
}
}
- rb_str_buf_cat2(str, ">");
-
- if (tainted) OBJ_TAINT(str);
- if (untrusted) OBJ_UNTRUST(str);
return str;
}
@@ -846,6 +1022,37 @@ enumerator_inspect(VALUE obj)
}
/*
+ * call-seq:
+ * e.size -> int, Float::INFINITY or nil
+ *
+ * Returns the size of the enumerator, or +nil+ if it can't be calculated lazily.
+ *
+ * (1..100).to_a.permutation(4).size # => 94109400
+ * loop.size # => Float::INFINITY
+ * (1..100).drop_while.size # => nil
+ */
+
+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 (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;
+}
+
+/*
* Yielder
*/
static void
@@ -870,6 +1077,7 @@ static const rb_data_type_t yielder_data_type = {
yielder_free,
yielder_memsize,
},
+ NULL, NULL, RUBY_TYPED_FREE_IMMEDIATELY
};
static struct yielder *
@@ -975,6 +1183,7 @@ static const rb_data_type_t generator_data_type = {
generator_free,
generator_memsize,
},
+ NULL, NULL, RUBY_TYPED_FREE_IMMEDIATELY
};
static struct generator *
@@ -1007,6 +1216,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) {
@@ -1028,7 +1238,8 @@ generator_initialize(int argc, VALUE *argv, VALUE obj)
rb_need_block();
proc = rb_block_proc();
- } else {
+ }
+ else {
rb_scan_args(argc, argv, "1", &proc);
if (!rb_obj_is_proc(proc))
@@ -1050,6 +1261,8 @@ generator_init_copy(VALUE obj, VALUE orig)
{
struct generator *ptr0, *ptr1;
+ if (!OBJ_INIT_COPY(obj, orig)) return obj;
+
ptr0 = generator_ptr(orig);
TypedData_Get_Struct(obj, struct generator, &generator_data_type, ptr1);
@@ -1065,14 +1278,661 @@ generator_init_copy(VALUE obj, VALUE orig)
/* :nodoc: */
static VALUE
-generator_each(VALUE obj)
+generator_each(int argc, VALUE *argv, VALUE obj)
{
struct generator *ptr = generator_ptr(obj);
- VALUE yielder;
+ VALUE args = rb_ary_new2(argc + 1);
+
+ rb_ary_push(args, yielder_new());
+ if (argc > 0) {
+ rb_ary_cat(args, argv, argc);
+ }
+
+ return rb_proc_call(ptr->proc, args);
+}
+
+/* Lazy Enumerator methods */
+static VALUE
+enum_size(VALUE self)
+{
+ VALUE r = rb_check_funcall(self, id_size, 0, 0);
+ return (r == Qundef) ? Qnil : r;
+}
+
+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));
+}
+
+static VALUE
+lazy_receiver_size(VALUE generator, VALUE args, VALUE lazy)
+{
+ return lazy_size(lazy);
+}
+
+static VALUE
+lazy_init_iterator(VALUE val, VALUE m, int argc, VALUE *argv)
+{
+ VALUE result;
+ if (argc == 1) {
+ VALUE args[2];
+ args[0] = m;
+ args[1] = val;
+ result = rb_yield_values2(2, args);
+ }
+ else {
+ VALUE args;
+ int len = rb_long2int((long)argc + 1);
+
+ args = rb_ary_tmp_new(len);
+ rb_ary_push(args, m);
+ if (argc > 0) {
+ rb_ary_cat(args, argv, argc);
+ }
+ result = rb_yield_values2(len, RARRAY_CONST_PTR(args));
+ RB_GC_GUARD(args);
+ }
+ if (result == Qundef) rb_iter_break();
+ return Qnil;
+}
+
+static VALUE
+lazy_init_block_i(VALUE val, VALUE m, int argc, VALUE *argv)
+{
+ rb_block_call(m, id_each, argc-1, argv+1, lazy_init_iterator, val);
+ return Qnil;
+}
+
+/*
+ * call-seq:
+ * Lazy.new(obj, size=nil) { |yielder, *values| ... }
+ *
+ * Creates a new Lazy enumerator. When the enumerator is actually enumerated
+ * (e.g. by calling #force), +obj+ will be enumerated and each value passed
+ * to the given block. The block can yield values back using +yielder+.
+ * For example, to create a method +filter_map+ in both lazy and
+ * non-lazy fashions:
+ *
+ * module Enumerable
+ * def filter_map(&block)
+ * map(&block).compact
+ * end
+ * end
+ *
+ * class Enumerator::Lazy
+ * def filter_map
+ * Lazy.new(self) do |yielder, *values|
+ * result = yield *values
+ * yielder << result if result
+ * end
+ * end
+ * end
+ *
+ * (1..Float::INFINITY).lazy.filter_map{|i| i*i if i.even?}.first(5)
+ * # => [4, 16, 36, 64, 100]
+ */
+static VALUE
+lazy_initialize(int argc, VALUE *argv, VALUE self)
+{
+ VALUE obj, size = Qnil;
+ VALUE generator;
+
+ rb_check_arity(argc, 1, 2);
+ if (!rb_block_given_p()) {
+ rb_raise(rb_eArgError, "tried to call lazy new without a block");
+ }
+ obj = argv[0];
+ if (argc > 1) {
+ size = argv[1];
+ }
+ generator = generator_allocate(rb_cGenerator);
+ rb_block_call(generator, id_initialize, 0, 0, lazy_init_block_i, obj);
+ enumerator_init(self, generator, sym_each, 0, 0, 0, size);
+ rb_ivar_set(self, id_receiver, obj);
+
+ return self;
+}
+
+static VALUE
+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);
+ rb_ivar_set(lazy, id_method, ID2SYM(id));
+ if (NIL_P(args)) {
+ /* Qfalse indicates that the arguments are empty */
+ rb_ivar_set(lazy, id_arguments, Qfalse);
+ }
+ else {
+ rb_ivar_set(lazy, id_arguments, args);
+ }
+ e->size_fn = size_fn;
+ return lazy;
+}
+
+/*
+ * call-seq:
+ * e.lazy -> lazy_enumerator
+ *
+ * Returns a lazy enumerator, whose methods map/collect,
+ * flat_map/collect_concat, select/find_all, reject, grep, zip, take,
+ * take_while, drop, and drop_while enumerate values only on an
+ * as-needed basis. However, if a block is given to zip, values
+ * are enumerated immediately.
+ *
+ * === Example
+ *
+ * The following program finds pythagorean triples:
+ *
+ * def pythagorean_triples
+ * (1..Float::INFINITY).lazy.flat_map {|z|
+ * (1..z).flat_map {|x|
+ * (x..z).select {|y|
+ * x**2 + y**2 == z**2
+ * }.map {|y|
+ * [x, y, z]
+ * }
+ * }
+ * }
+ * end
+ * # show first ten pythagorean triples
+ * p pythagorean_triples.take(10).force # take is lazy, so force is needed
+ * p pythagorean_triples.first(10) # first is eager
+ * # show pythagorean triples less than 100
+ * p pythagorean_triples.take_while { |*, z| z < 100 }.force
+ */
+static VALUE
+enumerable_lazy(VALUE obj)
+{
+ 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, rb_enumerator_size_func *size_fn)
+{
+ return enumerator_init(enumerator_allocate(rb_cLazy),
+ obj, meth, argc, argv, size_fn, Qnil);
+}
+
+/*
+ * call-seq:
+ * lzy.to_enum(method = :each, *args) -> lazy_enum
+ * lzy.enum_for(method = :each, *args) -> lazy_enum
+ * lzy.to_enum(method = :each, *args) {|*args| block} -> lazy_enum
+ * lzy.enum_for(method = :each, *args){|*args| block} -> lazy_enum
+ *
+ * Similar to Kernel#to_enum, except it returns a lazy enumerator.
+ * This makes it easy to define Enumerable methods that will
+ * naturally remain lazy if called from a lazy enumerator.
+ *
+ * For example, continuing from the example in Kernel#to_enum:
+ *
+ * # See Kernel#to_enum for the definition of repeat
+ * r = 1..Float::INFINITY
+ * r.repeat(2).first(5) # => [1, 1, 2, 2, 3]
+ * r.repeat(2).class # => Enumerator
+ * r.repeat(2).map{|n| n ** 2}.first(5) # => endless loop!
+ * # works naturally on lazy enumerator:
+ * r.lazy.repeat(2).class # => Enumerator::Lazy
+ * r.lazy.repeat(2).map{|n| n ** 2}.first(5) # => [1, 1, 4, 4, 9]
+ */
+
+static VALUE
+lazy_to_enum(int argc, VALUE *argv, VALUE self)
+{
+ VALUE lazy, meth = sym_each;
+
+ if (argc > 0) {
+ --argc;
+ meth = *argv++;
+ }
+ lazy = lazy_to_enum_i(self, meth, argc, argv, 0);
+ if (rb_block_given_p()) {
+ enumerator_ptr(lazy)->size = rb_block_proc();
+ }
+ return lazy;
+}
+
+static VALUE
+lazy_map_func(VALUE val, VALUE m, int argc, VALUE *argv)
+{
+ VALUE result = rb_yield_values2(argc - 1, &argv[1]);
+
+ rb_funcall(argv[0], id_yield, 1, result);
+ return Qnil;
+}
+
+static VALUE
+lazy_map(VALUE obj)
+{
+ if (!rb_block_given_p()) {
+ rb_raise(rb_eArgError, "tried to call lazy map without a block");
+ }
+
+ return lazy_set_method(rb_block_call(rb_cLazy, id_new, 1, &obj,
+ lazy_map_func, 0),
+ Qnil, lazy_receiver_size);
+}
+
+static VALUE
+lazy_flat_map_i(VALUE i, VALUE yielder, int argc, VALUE *argv)
+{
+ return rb_funcall2(yielder, id_yield, argc, argv);
+}
+
+static VALUE
+lazy_flat_map_each(VALUE obj, VALUE yielder)
+{
+ rb_block_call(obj, id_each, 0, 0, lazy_flat_map_i, yielder);
+ return Qnil;
+}
- yielder = yielder_new();
+static VALUE
+lazy_flat_map_to_ary(VALUE obj, VALUE yielder)
+{
+ VALUE ary = rb_check_array_type(obj);
+ if (NIL_P(ary)) {
+ rb_funcall(yielder, id_yield, 1, obj);
+ }
+ else {
+ long i;
+ for (i = 0; i < RARRAY_LEN(ary); i++) {
+ rb_funcall(yielder, id_yield, 1, RARRAY_AREF(ary, i));
+ }
+ }
+ return Qnil;
+}
- return rb_proc_call(ptr->proc, rb_ary_new3(1, yielder));
+static VALUE
+lazy_flat_map_func(VALUE val, VALUE m, int argc, VALUE *argv)
+{
+ VALUE result = rb_yield_values2(argc - 1, &argv[1]);
+ if (RB_TYPE_P(result, T_ARRAY)) {
+ long i;
+ for (i = 0; i < RARRAY_LEN(result); i++) {
+ rb_funcall(argv[0], id_yield, 1, RARRAY_AREF(result, i));
+ }
+ }
+ else {
+ if (rb_respond_to(result, id_force) && rb_respond_to(result, id_each)) {
+ lazy_flat_map_each(result, argv[0]);
+ }
+ else {
+ lazy_flat_map_to_ary(result, argv[0]);
+ }
+ }
+ return Qnil;
+}
+
+/*
+ * 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
+ * <i>block</i> once for every element in <i>lazy</i>.
+ *
+ * ["foo", "bar"].lazy.flat_map {|i| i.each_char.lazy}.force
+ * #=> ["f", "o", "o", "b", "a", "r"]
+ *
+ * A value <i>x</i> returned by <i>block</i> is decomposed if either of
+ * the following conditions is true:
+ *
+ * a) <i>x</i> responds to both each and force, which means that
+ * <i>x</i> is a lazy enumerator.
+ * b) <i>x</i> is an array or responds to to_ary.
+ *
+ * Otherwise, <i>x</i> is contained as-is in the return value.
+ *
+ * [{a:1}, {b:2}].lazy.flat_map {|i| i}.force
+ * #=> [{:a=>1}, {:b=>2}]
+ */
+static VALUE
+lazy_flat_map(VALUE obj)
+{
+ if (!rb_block_given_p()) {
+ rb_raise(rb_eArgError, "tried to call lazy flat_map without a block");
+ }
+
+ return lazy_set_method(rb_block_call(rb_cLazy, id_new, 1, &obj,
+ lazy_flat_map_func, 0),
+ Qnil, 0);
+}
+
+static VALUE
+lazy_select_func(VALUE val, VALUE m, int argc, VALUE *argv)
+{
+ VALUE element = rb_enum_values_pack(argc - 1, argv + 1);
+
+ if (RTEST(rb_yield(element))) {
+ return rb_funcall(argv[0], id_yield, 1, element);
+ }
+ return Qnil;
+}
+
+static VALUE
+lazy_select(VALUE obj)
+{
+ if (!rb_block_given_p()) {
+ rb_raise(rb_eArgError, "tried to call lazy select without a block");
+ }
+
+ return lazy_set_method(rb_block_call(rb_cLazy, id_new, 1, &obj,
+ lazy_select_func, 0),
+ Qnil, 0);
+}
+
+static VALUE
+lazy_reject_func(VALUE val, VALUE m, int argc, VALUE *argv)
+{
+ VALUE element = rb_enum_values_pack(argc - 1, argv + 1);
+
+ if (!RTEST(rb_yield(element))) {
+ return rb_funcall(argv[0], id_yield, 1, element);
+ }
+ return Qnil;
+}
+
+static VALUE
+lazy_reject(VALUE obj)
+{
+ if (!rb_block_given_p()) {
+ rb_raise(rb_eArgError, "tried to call lazy reject without a block");
+ }
+
+ return lazy_set_method(rb_block_call(rb_cLazy, id_new, 1, &obj,
+ lazy_reject_func, 0),
+ Qnil, 0);
+}
+
+static VALUE
+lazy_grep_func(VALUE val, VALUE m, int argc, VALUE *argv)
+{
+ VALUE i = rb_enum_values_pack(argc - 1, argv + 1);
+ VALUE result = rb_funcall(m, id_eqq, 1, i);
+
+ if (RTEST(result)) {
+ rb_funcall(argv[0], id_yield, 1, i);
+ }
+ return Qnil;
+}
+
+static VALUE
+lazy_grep_iter(VALUE val, VALUE m, int argc, VALUE *argv)
+{
+ VALUE i = rb_enum_values_pack(argc - 1, argv + 1);
+ VALUE result = rb_funcall(m, id_eqq, 1, i);
+
+ if (RTEST(result)) {
+ rb_funcall(argv[0], id_yield, 1, rb_yield(i));
+ }
+ return Qnil;
+}
+
+static VALUE
+lazy_grep(VALUE obj, VALUE pattern)
+{
+ return lazy_set_method(rb_block_call(rb_cLazy, id_new, 1, &obj,
+ rb_block_given_p() ?
+ lazy_grep_iter : lazy_grep_func,
+ pattern),
+ rb_ary_new3(1, pattern), 0);
+}
+
+static VALUE
+call_next(VALUE obj)
+{
+ return rb_funcall(obj, id_next, 0);
+}
+
+static VALUE
+next_stopped(VALUE obj)
+{
+ return Qnil;
+}
+
+static VALUE
+lazy_zip_arrays_func(VALUE val, VALUE arrays, int argc, VALUE *argv)
+{
+ VALUE yielder, ary, memo;
+ long i, count;
+
+ yielder = argv[0];
+ memo = rb_attr_get(yielder, id_memo);
+ count = NIL_P(memo) ? 0 : NUM2LONG(memo);
+
+ 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_AREF(arrays, i), count));
+ }
+ rb_funcall(yielder, id_yield, 1, ary);
+ rb_ivar_set(yielder, id_memo, LONG2NUM(++count));
+ return Qnil;
+}
+
+static VALUE
+lazy_zip_func(VALUE val, VALUE zip_args, int argc, VALUE *argv)
+{
+ VALUE yielder, ary, arg, v;
+ long i;
+
+ yielder = argv[0];
+ arg = rb_attr_get(yielder, id_memo);
+ 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_AREF(zip_args, i), id_to_enum, 0));
+ }
+ rb_ivar_set(yielder, id_memo, arg);
+ }
+
+ ary = rb_ary_new2(RARRAY_LEN(arg) + 1);
+ v = Qnil;
+ if (--argc > 0) {
+ ++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_AREF(arg, i), next_stopped, 0,
+ rb_eStopIteration, (VALUE)0);
+ rb_ary_push(ary, v);
+ }
+ rb_funcall(yielder, id_yield, 1, ary);
+ return Qnil;
+}
+
+static VALUE
+lazy_zip(int argc, VALUE *argv, VALUE obj)
+{
+ VALUE ary, v;
+ long i;
+ rb_block_call_func *func = lazy_zip_arrays_func;
+
+ if (rb_block_given_p()) {
+ return rb_call_super(argc, argv);
+ }
+
+ ary = rb_ary_new2(argc);
+ for (i = 0; i < argc; i++) {
+ v = rb_check_array_type(argv[i]);
+ if (NIL_P(v)) {
+ for (; i < argc; i++) {
+ if (!rb_respond_to(argv[i], id_each)) {
+ rb_raise(rb_eTypeError, "wrong argument type %s (must respond to :each)",
+ rb_obj_classname(argv[i]));
+ }
+ }
+ ary = rb_ary_new4(argc, argv);
+ func = lazy_zip_func;
+ break;
+ }
+ rb_ary_push(ary, v);
+ }
+
+ return lazy_set_method(rb_block_call(rb_cLazy, id_new, 1, &obj,
+ func, ary),
+ ary, lazy_receiver_size);
+}
+
+static VALUE
+lazy_take_func(VALUE val, VALUE args, int argc, VALUE *argv)
+{
+ long remain;
+ VALUE memo = rb_attr_get(argv[0], id_memo);
+ if (NIL_P(memo)) {
+ memo = args;
+ }
+
+ rb_funcall2(argv[0], id_yield, argc - 1, argv + 1);
+ if ((remain = NUM2LONG(memo)-1) == 0) {
+ return Qundef;
+ }
+ else {
+ rb_ivar_set(argv[0], id_memo, LONG2NUM(remain));
+ return Qnil;
+ }
+}
+
+static VALUE
+lazy_take_size(VALUE generator, VALUE args, VALUE lazy)
+{
+ VALUE receiver = lazy_size(lazy);
+ 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);
+}
+
+static VALUE
+lazy_take(VALUE obj, VALUE n)
+{
+ long len = NUM2LONG(n);
+ VALUE lazy;
+
+ if (len < 0) {
+ rb_raise(rb_eArgError, "attempt to take negative size");
+ }
+ if (len == 0) {
+ VALUE len = INT2FIX(0);
+ lazy = lazy_to_enum_i(obj, sym_cycle, 1, &len, 0);
+ }
+ else {
+ lazy = rb_block_call(rb_cLazy, id_new, 1, &obj,
+ lazy_take_func, n);
+ }
+ return lazy_set_method(lazy, rb_ary_new3(1, n), lazy_take_size);
+}
+
+static VALUE
+lazy_take_while_func(VALUE val, VALUE args, int argc, VALUE *argv)
+{
+ VALUE result = rb_yield_values2(argc - 1, &argv[1]);
+ if (!RTEST(result)) return Qundef;
+ rb_funcall2(argv[0], id_yield, argc - 1, argv + 1);
+ return Qnil;
+}
+
+static VALUE
+lazy_take_while(VALUE obj)
+{
+ if (!rb_block_given_p()) {
+ rb_raise(rb_eArgError, "tried to call lazy take_while without a block");
+ }
+ return lazy_set_method(rb_block_call(rb_cLazy, id_new, 1, &obj,
+ lazy_take_while_func, 0),
+ Qnil, 0);
+}
+
+static VALUE
+lazy_drop_size(VALUE generator, VALUE args, VALUE lazy)
+{
+ long len = NUM2LONG(RARRAY_AREF(rb_ivar_get(lazy, id_arguments), 0));
+ VALUE receiver = lazy_size(lazy);
+ if (NIL_P(receiver))
+ return receiver;
+ if (FIXNUM_P(receiver)) {
+ len = FIX2LONG(receiver) - len;
+ return LONG2FIX(len < 0 ? 0 : len);
+ }
+ return rb_funcall(receiver, '-', 1, LONG2NUM(len));
+}
+
+static VALUE
+lazy_drop_func(VALUE val, VALUE args, int argc, VALUE *argv)
+{
+ long remain;
+ VALUE memo = rb_attr_get(argv[0], id_memo);
+ if (NIL_P(memo)) {
+ memo = args;
+ }
+ if ((remain = NUM2LONG(memo)) == 0) {
+ rb_funcall2(argv[0], id_yield, argc - 1, argv + 1);
+ }
+ else {
+ rb_ivar_set(argv[0], id_memo, LONG2NUM(--remain));
+ }
+ return Qnil;
+}
+
+static VALUE
+lazy_drop(VALUE obj, VALUE n)
+{
+ long len = NUM2LONG(n);
+
+ if (len < 0) {
+ rb_raise(rb_eArgError, "attempt to drop negative size");
+ }
+ return lazy_set_method(rb_block_call(rb_cLazy, id_new, 1, &obj,
+ lazy_drop_func, n),
+ rb_ary_new3(1, n), lazy_drop_size);
+}
+
+static VALUE
+lazy_drop_while_func(VALUE val, VALUE args, int argc, VALUE *argv)
+{
+ VALUE memo = rb_attr_get(argv[0], id_memo);
+ if (NIL_P(memo) && !RTEST(rb_yield_values2(argc - 1, &argv[1]))) {
+ rb_ivar_set(argv[0], id_memo, memo = Qtrue);
+ }
+ if (memo == Qtrue) {
+ rb_funcall2(argv[0], id_yield, argc - 1, argv + 1);
+ }
+ return Qnil;
+}
+
+static VALUE
+lazy_drop_while(VALUE obj)
+{
+ if (!rb_block_given_p()) {
+ rb_raise(rb_eArgError, "tried to call lazy drop_while without a block");
+ }
+ return lazy_set_method(rb_block_call(rb_cLazy, id_new, 1, &obj,
+ lazy_drop_while_func, 0),
+ Qnil, 0);
+}
+
+static VALUE
+lazy_super(int argc, VALUE *argv, VALUE lazy)
+{
+ return enumerable_lazy(rb_call_super(argc, argv));
+}
+
+static VALUE
+lazy_lazy(VALUE obj)
+{
+ return obj;
}
/*
@@ -1121,14 +1981,15 @@ generator_each(VALUE obj)
* end
*
*/
+
static VALUE
stop_result(VALUE self)
{
- return rb_attr_get(self, rb_intern("result"));
+ return rb_attr_get(self, id_result);
}
void
-Init_Enumerator(void)
+InitVM_Enumerator(void)
{
rb_define_method(rb_mKernel, "to_enum", obj_to_enum, -1);
rb_define_method(rb_mKernel, "enum_for", obj_to_enum, -1);
@@ -1139,7 +2000,7 @@ Init_Enumerator(void)
rb_define_alloc_func(rb_cEnumerator, enumerator_allocate);
rb_define_method(rb_cEnumerator, "initialize", enumerator_initialize, -1);
rb_define_method(rb_cEnumerator, "initialize_copy", enumerator_init_copy, 1);
- rb_define_method(rb_cEnumerator, "each", enumerator_each, 0);
+ rb_define_method(rb_cEnumerator, "each", enumerator_each, -1);
rb_define_method(rb_cEnumerator, "each_with_index", enumerator_each_with_index, 0);
rb_define_method(rb_cEnumerator, "each_with_object", enumerator_with_object, 1);
rb_define_method(rb_cEnumerator, "with_index", enumerator_with_index, -1);
@@ -1151,6 +2012,32 @@ Init_Enumerator(void)
rb_define_method(rb_cEnumerator, "feed", enumerator_feed, 1);
rb_define_method(rb_cEnumerator, "rewind", enumerator_rewind, 0);
rb_define_method(rb_cEnumerator, "inspect", enumerator_inspect, 0);
+ rb_define_method(rb_cEnumerator, "size", enumerator_size, 0);
+
+ /* Lazy */
+ rb_cLazy = rb_define_class_under(rb_cEnumerator, "Lazy", rb_cEnumerator);
+ rb_define_method(rb_mEnumerable, "lazy", enumerable_lazy, 0);
+ rb_define_method(rb_cLazy, "initialize", lazy_initialize, -1);
+ rb_define_method(rb_cLazy, "to_enum", lazy_to_enum, -1);
+ rb_define_method(rb_cLazy, "enum_for", lazy_to_enum, -1);
+ rb_define_method(rb_cLazy, "map", lazy_map, 0);
+ rb_define_method(rb_cLazy, "collect", lazy_map, 0);
+ rb_define_method(rb_cLazy, "flat_map", lazy_flat_map, 0);
+ rb_define_method(rb_cLazy, "collect_concat", lazy_flat_map, 0);
+ rb_define_method(rb_cLazy, "select", lazy_select, 0);
+ rb_define_method(rb_cLazy, "find_all", lazy_select, 0);
+ rb_define_method(rb_cLazy, "reject", lazy_reject, 0);
+ rb_define_method(rb_cLazy, "grep", lazy_grep, 1);
+ rb_define_method(rb_cLazy, "zip", lazy_zip, -1);
+ rb_define_method(rb_cLazy, "take", lazy_take, 1);
+ rb_define_method(rb_cLazy, "take_while", lazy_take_while, 0);
+ rb_define_method(rb_cLazy, "drop", lazy_drop, 1);
+ rb_define_method(rb_cLazy, "drop_while", lazy_drop_while, 0);
+ 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_alias(rb_cLazy, "force", "to_a");
rb_eStopIteration = rb_define_class("StopIteration", rb_eIndexError);
rb_define_method(rb_eStopIteration, "result", stop_result, 0);
@@ -1161,7 +2048,7 @@ Init_Enumerator(void)
rb_define_alloc_func(rb_cGenerator, generator_allocate);
rb_define_method(rb_cGenerator, "initialize", generator_initialize, -1);
rb_define_method(rb_cGenerator, "initialize_copy", generator_init_copy, 1);
- rb_define_method(rb_cGenerator, "each", generator_each, 0);
+ rb_define_method(rb_cGenerator, "each", generator_each, -1);
/* Yielder */
rb_cYielder = rb_define_class_under(rb_cEnumerator, "Yielder", rb_cObject);
@@ -1170,9 +2057,31 @@ Init_Enumerator(void)
rb_define_method(rb_cYielder, "yield", yielder_yield, -2);
rb_define_method(rb_cYielder, "<<", yielder_yield_push, -2);
+ rb_provide("enumerator.so"); /* for backward compatibility */
+}
+
+void
+Init_Enumerator(void)
+{
id_rewind = rb_intern("rewind");
id_each = rb_intern("each");
+ id_call = rb_intern("call");
+ id_size = rb_intern("size");
+ id_yield = rb_intern("yield");
+ id_new = rb_intern("new");
+ id_initialize = rb_intern("initialize");
+ id_next = rb_intern("next");
+ id_result = rb_intern("result");
+ id_lazy = rb_intern("lazy");
+ id_eqq = rb_intern("===");
+ id_receiver = rb_intern("receiver");
+ id_arguments = rb_intern("arguments");
+ id_memo = rb_intern("memo");
+ id_method = rb_intern("method");
+ id_force = rb_intern("force");
+ id_to_enum = rb_intern("to_enum");
sym_each = ID2SYM(id_each);
+ sym_cycle = ID2SYM(rb_intern("cycle"));
- rb_provide("enumerator.so"); /* for backward compatibility */
+ InitVM(Enumerator);
}
diff --git a/error.c b/error.c
index 2d71ededad..ac7b632751 100644
--- a/error.c
+++ b/error.c
@@ -37,6 +37,10 @@
#define WEXITSTATUS(status) (status)
#endif
+VALUE rb_eEAGAIN;
+VALUE rb_eEWOULDBLOCK;
+VALUE rb_eEINPROGRESS;
+
extern const char ruby_description[];
#define REPORTBUG_MSG \
@@ -71,96 +75,110 @@ err_position_0(char *buf, long len, const char *file, int line)
}
}
-static int
-err_position(char *buf, long len)
-{
- return err_position_0(buf, len, rb_sourcefile(), rb_sourceline());
-}
-
-static void
-err_snprintf(char *buf, long len, const char *fmt, va_list args)
+static VALUE
+compile_snprintf(rb_encoding *enc, const char *pre, const char *file, int line, const char *fmt, va_list args)
{
- long n;
+ VALUE str = rb_enc_str_new(0, 0, enc);
- n = err_position(buf, len);
- if (len > n) {
- vsnprintf((char*)buf+n, len-n, fmt, args);
+ if (file) {
+ rb_str_cat2(str, file);
+ if (line) rb_str_catf(str, ":%d", line);
+ rb_str_cat2(str, ": ");
}
+ if (pre) rb_str_cat2(str, pre);
+ rb_str_vcatf(str, fmt, args);
+ return str;
}
static void
-compile_snprintf(char *buf, long len, const char *file, int line, const char *fmt, va_list args)
+compile_err_append(VALUE mesg)
{
- long n;
+ rb_thread_t *th = GET_THREAD();
+ VALUE err = th->errinfo;
+ rb_block_t *prev_base_block = th->base_block;
+ th->base_block = 0;
+ /* base_block should be zero while normal Ruby execution */
+ /* after this line, any Ruby code *can* run */
- n = err_position_0(buf, len, file, line);
- if (len > n) {
- vsnprintf((char*)buf+n, len-n, fmt, args);
+ if (th->mild_compile_error) {
+ if (RTEST(err)) {
+ VALUE str = rb_obj_as_string(err);
+
+ rb_str_cat2(str, "\n");
+ rb_str_append(str, mesg);
+ mesg = str;
+ }
+ err = rb_exc_new3(rb_eSyntaxError, mesg);
+ th->errinfo = err;
+ }
+ else {
+ if (!RTEST(err)) {
+ err = rb_exc_new2(rb_eSyntaxError, "compile error");
+ th->errinfo = err;
+ }
+ rb_str_cat2(mesg, "\n");
+ rb_write_error_str(mesg);
}
-}
-static void err_append(const char*, rb_encoding *);
+ /* returned to the parser world */
+ th->base_block = prev_base_block;
+}
void
rb_compile_error_with_enc(const char *file, int line, void *enc, const char *fmt, ...)
{
va_list args;
- char buf[BUFSIZ];
+ VALUE str;
va_start(args, fmt);
- compile_snprintf(buf, BUFSIZ, file, line, fmt, args);
+ str = compile_snprintf(enc, NULL, file, line, fmt, args);
va_end(args);
- err_append(buf, (rb_encoding *)enc);
+ compile_err_append(str);
}
void
rb_compile_error(const char *file, int line, const char *fmt, ...)
{
va_list args;
- char buf[BUFSIZ];
+ VALUE str;
va_start(args, fmt);
- compile_snprintf(buf, BUFSIZ, file, line, fmt, args);
+ str = compile_snprintf(NULL, NULL, file, line, fmt, args);
va_end(args);
- err_append(buf, NULL);
+ compile_err_append(str);
}
void
rb_compile_error_append(const char *fmt, ...)
{
va_list args;
- char buf[BUFSIZ];
+ VALUE str;
va_start(args, fmt);
- vsnprintf(buf, BUFSIZ, fmt, args);
+ str = rb_vsprintf(fmt, args);
va_end(args);
- err_append(buf, NULL);
+ compile_err_append(str);
}
static void
compile_warn_print(const char *file, int line, const char *fmt, va_list args)
{
- char buf[BUFSIZ];
- int len;
+ VALUE str;
- compile_snprintf(buf, BUFSIZ, file, line, fmt, args);
- len = (int)strlen(buf);
- buf[len++] = '\n';
- rb_write_error2(buf, len);
+ str = compile_snprintf(NULL, "warning: ", file, line, fmt, args);
+ rb_str_cat2(str, "\n");
+ rb_write_error_str(str);
}
void
rb_compile_warn(const char *file, int line, const char *fmt, ...)
{
- char buf[BUFSIZ];
va_list args;
if (NIL_P(ruby_verbose)) return;
- snprintf(buf, BUFSIZ, "warning: %s", fmt);
-
va_start(args, fmt);
- compile_warn_print(file, line, buf, args);
+ compile_warn_print(file, line, fmt, args);
va_end(args);
}
@@ -168,42 +186,43 @@ rb_compile_warn(const char *file, int line, const char *fmt, ...)
void
rb_compile_warning(const char *file, int line, const char *fmt, ...)
{
- char buf[BUFSIZ];
va_list args;
if (!RTEST(ruby_verbose)) return;
- snprintf(buf, BUFSIZ, "warning: %s", fmt);
-
va_start(args, fmt);
- compile_warn_print(file, line, buf, args);
+ compile_warn_print(file, line, fmt, args);
va_end(args);
}
static void
warn_print(const char *fmt, va_list args)
{
- char buf[BUFSIZ];
- int len;
+ VALUE str = rb_str_new(0, 0);
+ VALUE file = rb_sourcefilename();
+
+ if (!NIL_P(file)) {
+ int line = rb_sourceline();
+ str = rb_str_append(str, file);
+ if (line) rb_str_catf(str, ":%d", line);
+ rb_str_cat2(str, ": ");
+ }
- err_snprintf(buf, BUFSIZ, fmt, args);
- len = (int)strlen(buf);
- buf[len++] = '\n';
- rb_write_error2(buf, len);
+ rb_str_cat2(str, "warning: ");
+ rb_str_vcatf(str, fmt, args);
+ rb_str_cat2(str, "\n");
+ rb_write_error_str(str);
}
void
rb_warn(const char *fmt, ...)
{
- char buf[BUFSIZ];
va_list args;
if (NIL_P(ruby_verbose)) return;
- snprintf(buf, BUFSIZ, "warning: %s", fmt);
-
va_start(args, fmt);
- warn_print(buf, args);
+ warn_print(fmt, args);
va_end(args);
}
@@ -211,52 +230,90 @@ rb_warn(const char *fmt, ...)
void
rb_warning(const char *fmt, ...)
{
- char buf[BUFSIZ];
va_list args;
if (!RTEST(ruby_verbose)) return;
- snprintf(buf, BUFSIZ, "warning: %s", fmt);
-
va_start(args, fmt);
- warn_print(buf, args);
+ warn_print(fmt, args);
va_end(args);
}
/*
* call-seq:
- * warn(msg) -> nil
+ * warn(msg, ...) -> nil
*
- * Display the given message (followed by a newline) on STDERR unless
- * warnings are disabled (for example with the <code>-W0</code> flag).
+ * Displays each of the given messages followed by a record separator on
+ * STDERR unless warnings have been disabled (for example with the
+ * <code>-W0</code> flag).
+ *
+ * warn("warning 1", "warning 2")
+ *
+ * <em>produces:</em>
+ *
+ * warning 1
+ * warning 2
*/
static VALUE
-rb_warn_m(VALUE self, VALUE mesg)
+rb_warn_m(int argc, VALUE *argv, VALUE exc)
{
- if (!NIL_P(ruby_verbose)) {
- rb_io_write(rb_stderr, mesg);
- rb_io_write(rb_stderr, rb_default_rs);
+ if (!NIL_P(ruby_verbose) && argc > 0) {
+ rb_io_puts(argc, argv, rb_stderr);
}
return Qnil;
}
+#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)
+{
+ 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;
+}
+
static void
report_bug(const char *file, int line, const char *fmt, va_list args)
{
- char buf[BUFSIZ];
+ /* SIGSEGV handler might have a very small stack. Thus we need to use it carefully. */
+ char buf[256];
FILE *out = stderr;
- int len = err_position_0(buf, BUFSIZ, file, line);
+ int len = err_position_0(buf, 256, file, line);
if ((ssize_t)fwrite(buf, 1, len, out) == (ssize_t)len ||
(ssize_t)fwrite(buf, 1, len, (out = stdout)) == (ssize_t)len) {
fputs("[BUG] ", out);
- vfprintf(out, fmt, args);
- fprintf(out, "\n%s\n\n", ruby_description);
+ vsnprintf(buf, 256, fmt, args);
+ fputs(buf, out);
+ snprintf(buf, 256, "\n%s\n\n", ruby_description);
+ fputs(buf, out);
rb_vm_bugreport();
+ /* 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);
}
}
@@ -277,7 +334,7 @@ rb_bug(const char *fmt, ...)
report_bug(file, line, fmt, args);
va_end(args);
-#if defined(_WIN32) && defined(RT_VER) && RT_VER >= 80
+#if defined(_WIN32) && defined(RUBY_MSVCRT_VERSION) && RUBY_MSVCRT_VERSION >= 80
_set_abort_behavior( 0, _CALL_REPORTFAULT);
#endif
@@ -341,41 +398,79 @@ rb_compile_bug(const char *file, int line, const char *fmt, ...)
abort();
}
-static const struct types {
- int type;
- const char *name;
-} builtin_types[] = {
- {T_NIL, "nil"},
- {T_OBJECT, "Object"},
- {T_CLASS, "Class"},
- {T_ICLASS, "iClass"}, /* internal use: mixed-in module holder */
- {T_MODULE, "Module"},
- {T_FLOAT, "Float"},
- {T_STRING, "String"},
- {T_REGEXP, "Regexp"},
- {T_ARRAY, "Array"},
- {T_FIXNUM, "Fixnum"},
- {T_HASH, "Hash"},
- {T_STRUCT, "Struct"},
- {T_BIGNUM, "Bignum"},
- {T_FILE, "File"},
- {T_RATIONAL,"Rational"},
- {T_COMPLEX, "Complex"},
- {T_TRUE, "true"},
- {T_FALSE, "false"},
- {T_SYMBOL, "Symbol"}, /* :symbol */
- {T_DATA, "Data"}, /* internal use: wrapped C pointers */
- {T_MATCH, "MatchData"}, /* data of $~ */
- {T_NODE, "Node"}, /* internal use: syntax tree node */
- {T_UNDEF, "undef"}, /* internal use: #undef; should not happen */
+static const char builtin_types[][10] = {
+ "", /* 0x00, */
+ "Object",
+ "Class",
+ "Module",
+ "Float",
+ "String",
+ "Regexp",
+ "Array",
+ "Hash",
+ "Struct",
+ "Bignum",
+ "File",
+ "Data", /* internal use: wrapped C pointers */
+ "MatchData", /* data of $~ */
+ "Complex",
+ "Rational",
+ "", /* 0x10 */
+ "nil",
+ "true",
+ "false",
+ "Symbol", /* :symbol */
+ "Fixnum",
+ "", /* 0x16 */
+ "", /* 0x17 */
+ "", /* 0x18 */
+ "", /* 0x19 */
+ "", /* 0x1a */
+ "undef", /* internal use: #undef; should not happen */
+ "Node", /* internal use: syntax tree node */
+ "iClass", /* internal use: mixed-in module holder */
};
+const char *
+rb_builtin_type_name(int t)
+{
+ const char *name;
+ if ((unsigned int)t >= numberof(builtin_types)) return 0;
+ name = builtin_types[t];
+ if (*name) return name;
+ return 0;
+}
+
+#define builtin_class_name rb_builtin_class_name
+const char *
+rb_builtin_class_name(VALUE x)
+{
+ const char *etype;
+
+ if (NIL_P(x)) {
+ etype = "nil";
+ }
+ else if (FIXNUM_P(x)) {
+ etype = "Fixnum";
+ }
+ else if (SYMBOL_P(x)) {
+ etype = "Symbol";
+ }
+ else if (RB_TYPE_P(x, T_TRUE)) {
+ etype = "true";
+ }
+ else if (RB_TYPE_P(x, T_FALSE)) {
+ etype = "false";
+ }
+ else {
+ etype = rb_obj_classname(x);
+ }
+ return etype;
+}
+
void
rb_check_type(VALUE x, int t)
{
- const struct types *type = builtin_types;
- const struct types *const typeend = builtin_types +
- sizeof(builtin_types) / sizeof(builtin_types[0]);
int xt;
if (x == Qundef) {
@@ -384,30 +479,10 @@ rb_check_type(VALUE x, int t)
xt = TYPE(x);
if (xt != t || (xt == T_DATA && RTYPEDDATA_P(x))) {
- while (type < typeend) {
- if (type->type == t) {
- const char *etype;
-
- if (NIL_P(x)) {
- etype = "nil";
- }
- else if (FIXNUM_P(x)) {
- etype = "Fixnum";
- }
- else if (SYMBOL_P(x)) {
- etype = "Symbol";
- }
- else if (rb_special_const_p(x)) {
- x = rb_obj_as_string(x);
- etype = StringValuePtr(x);
- }
- else {
- etype = rb_obj_classname(x);
- }
- rb_raise(rb_eTypeError, "wrong argument type %s (expected %s)",
- etype, type->name);
- }
- type++;
+ const char *tname = rb_builtin_type_name(t);
+ if (tname) {
+ rb_raise(rb_eTypeError, "wrong argument type %s (expected %s)",
+ builtin_class_name(x), tname);
}
if (xt > T_MASK && xt <= 0x3f) {
rb_fatal("unknown type 0x%x (0x%x given, probably comes from extension library for ruby 1.8)", t, xt);
@@ -429,7 +504,7 @@ rb_typeddata_inherited_p(const rb_data_type_t *child, const rb_data_type_t *pare
int
rb_typeddata_is_kind_of(VALUE obj, const rb_data_type_t *data_type)
{
- if (SPECIAL_CONST_P(obj) || BUILTIN_TYPE(obj) != T_DATA ||
+ if (!RB_TYPE_P(obj, T_DATA) ||
!RTYPEDDATA_P(obj) || !rb_typeddata_inherited_p(RTYPEDDATA_TYPE(obj), data_type)) {
return 0;
}
@@ -442,8 +517,9 @@ rb_check_typeddata(VALUE obj, const rb_data_type_t *data_type)
const char *etype;
static const char mesg[] = "wrong argument type %s (expected %s)";
- if (SPECIAL_CONST_P(obj) || BUILTIN_TYPE(obj) != T_DATA) {
- Check_Type(obj, T_DATA);
+ if (!RB_TYPE_P(obj, T_DATA)) {
+ etype = builtin_class_name(obj);
+ rb_raise(rb_eTypeError, mesg, etype, data_type->wrap_struct_name);
}
if (!RTYPEDDATA_P(obj)) {
etype = rb_obj_classname(obj);
@@ -486,7 +562,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)
@@ -495,13 +571,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);
@@ -565,11 +641,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);
}
/*
@@ -592,7 +666,7 @@ exc_message(VALUE exc)
* call-seq:
* exception.inspect -> string
*
- * Return this exception's class name an message
+ * Return this exception's class name and message
*/
static VALUE
@@ -649,9 +723,17 @@ static VALUE
exc_backtrace(VALUE exc)
{
ID bt;
+ VALUE obj;
CONST_ID(bt, "bt");
- return rb_attr_get(exc, bt);
+ obj = rb_attr_get(exc, bt);
+
+ if (rb_backtrace_p(obj)) {
+ obj = rb_backtrace_to_str_ary(obj);
+ /* rb_iv_set(exc, "bt", obj); */
+ }
+
+ return obj;
}
VALUE
@@ -661,14 +743,14 @@ rb_check_backtrace(VALUE bt)
static const char err[] = "backtrace must be Array of String";
if (!NIL_P(bt)) {
- int t = TYPE(bt);
-
- if (t == T_STRING) return rb_ary_new3(1, bt);
- if (t != T_ARRAY) {
+ if (RB_TYPE_P(bt, T_STRING)) return rb_ary_new3(1, bt);
+ if (rb_backtrace_p(bt)) return bt;
+ if (!RB_TYPE_P(bt, T_ARRAY)) {
rb_raise(rb_eTypeError, err);
}
for (i=0;i<RARRAY_LEN(bt);i++) {
- if (TYPE(RARRAY_PTR(bt)[i]) != T_STRING) {
+ VALUE e = RARRAY_AREF(bt, i);
+ if (!RB_TYPE_P(e, T_STRING)) {
rb_raise(rb_eTypeError, err);
}
}
@@ -678,11 +760,11 @@ rb_check_backtrace(VALUE bt)
/*
* call-seq:
- * exc.set_backtrace(array) -> array
+ * exc.set_backtrace(backtrace) -> array
*
- * Sets the backtrace information associated with <i>exc</i>. The
- * argument must be an array of <code>String</code> objects in the
- * format described in <code>Exception#backtrace</code>.
+ * Sets the backtrace information associated with +exc+. The +backtrace+ must
+ * be an array of String objects or a single String in the format described
+ * in Exception#backtrace.
*
*/
@@ -692,6 +774,28 @@ exc_set_backtrace(VALUE exc, VALUE bt)
return rb_iv_set(exc, "bt", rb_check_backtrace(bt));
}
+VALUE
+rb_exc_set_backtrace(VALUE exc, VALUE bt)
+{
+ return exc_set_backtrace(exc, bt);
+}
+
+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)
+{
+ ID id_exception;
+ CONST_ID(id_exception, "exception");
+ return rb_check_funcall(obj, id_exception, 0, 0);
+}
+
/*
* call-seq:
* exc == obj -> true or false
@@ -711,10 +815,17 @@ exc_equal(VALUE exc, VALUE obj)
CONST_ID(id_mesg, "mesg");
if (rb_obj_class(exc) != rb_obj_class(obj)) {
+ int status = 0;
ID id_message, id_backtrace;
CONST_ID(id_message, "message");
CONST_ID(id_backtrace, "backtrace");
+ obj = rb_protect(try_convert_to_exception, obj, &status);
+ if (status || obj == Qundef) {
+ rb_set_errinfo(Qnil);
+ return Qfalse;
+ }
+ if (rb_obj_class(exc) != rb_obj_class(obj)) return Qfalse;
mesg = rb_check_funcall(obj, id_message, 0, 0);
if (mesg == Qundef) return Qfalse;
backtrace = rb_check_funcall(obj, id_backtrace, 0, 0);
@@ -734,18 +845,52 @@ exc_equal(VALUE exc, VALUE obj)
/*
* call-seq:
- * SystemExit.new(status=0) -> system_exit
- *
- * Create a new +SystemExit+ exception with the given status.
+ * SystemExit.new -> system_exit
+ * SystemExit.new(status) -> system_exit
+ * SystemExit.new(status, msg) -> system_exit
+ * SystemExit.new(msg) -> system_exit
+ *
+ * Create a new +SystemExit+ exception with the given status and message.
+ * Status is true, false, or an integer.
+ * If status is not given, true is used.
*/
static VALUE
exit_initialize(int argc, VALUE *argv, VALUE exc)
{
- VALUE status = INT2FIX(EXIT_SUCCESS);
- if (argc > 0 && FIXNUM_P(argv[0])) {
- status = *argv++;
- --argc;
+ VALUE status;
+ if (argc > 0) {
+ status = *argv;
+
+ switch (status) {
+ case Qtrue:
+ status = INT2FIX(EXIT_SUCCESS);
+ ++argv;
+ --argc;
+ break;
+ case Qfalse:
+ status = INT2FIX(EXIT_FAILURE);
+ ++argv;
+ --argc;
+ break;
+ default:
+ status = rb_check_to_int(status);
+ if (NIL_P(status)) {
+ status = INT2FIX(EXIT_SUCCESS);
+ }
+ else {
+#if EXIT_SUCCESS != 0
+ if (status == INT2FIX(0))
+ status = INT2FIX(EXIT_SUCCESS);
+#endif
+ ++argv;
+ --argc;
+ }
+ break;
+ }
+ }
+ else {
+ status = INT2FIX(EXIT_SUCCESS);
}
rb_call_super(argc, argv);
rb_iv_set(exc, "status", status);
@@ -804,6 +949,21 @@ rb_name_error(ID id, const char *fmt, ...)
rb_exc_raise(exc);
}
+void
+rb_name_error_str(VALUE str, const char *fmt, ...)
+{
+ VALUE exc, argv[2];
+ va_list args;
+
+ va_start(args, fmt);
+ argv[0] = rb_vsprintf(fmt, args);
+ va_end(args);
+
+ argv[1] = str;
+ exc = rb_class_new_instance(2, argv, rb_eNameError);
+ rb_exc_raise(exc);
+}
+
/*
* call-seq:
* NameError.new(msg [, name]) -> name_error
@@ -839,24 +999,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
@@ -899,6 +1041,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: */
@@ -953,14 +1096,14 @@ name_err_mesg_to_str(VALUE obj)
int state = 0;
obj = ptr[1];
- switch (TYPE(obj)) {
- case T_NIL:
+ switch (obj) {
+ case Qnil:
desc = "nil";
break;
- case T_TRUE:
+ case Qtrue:
desc = "true";
break;
- case T_FALSE:
+ case Qfalse:
desc = "false";
break;
default:
@@ -976,7 +1119,7 @@ name_err_mesg_to_str(VALUE obj)
if (desc && desc[0] != '#') {
d = d ? rb_str_dup(d) : rb_str_new2(desc);
rb_str_cat2(d, ":");
- rb_str_cat2(d, rb_obj_classname(obj));
+ rb_str_append(d, rb_class_name(CLASS_OF(obj)));
}
args[0] = mesg;
args[1] = ptr[2];
@@ -988,6 +1131,13 @@ name_err_mesg_to_str(VALUE obj)
/* :nodoc: */
static VALUE
+name_err_mesg_dump(VALUE obj, VALUE limit)
+{
+ return name_err_mesg_to_str(obj);
+}
+
+/* :nodoc: */
+static VALUE
name_err_mesg_load(VALUE klass, VALUE str)
{
return str;
@@ -1010,9 +1160,9 @@ nometh_err_args(VALUE self)
void
rb_invalid_str(const char *str, const char *type)
{
- volatile VALUE s = rb_str_inspect(rb_str_new2(str));
+ VALUE s = rb_str_new2(str);
- rb_raise(rb_eArgError, "invalid value for %s: %s", type, RSTRING_PTR(s));
+ rb_raise(rb_eArgError, "invalid value for %s: %+"PRIsVALUE, type, s);
}
/*
@@ -1055,6 +1205,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);
}
@@ -1096,26 +1264,26 @@ 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;
}
if (!NIL_P(error) && st_lookup(syserr_tbl, NUM2LONG(error), &data)) {
klass = (VALUE)data;
/* change class */
- if (TYPE(self) != T_OBJECT) { /* insurance to avoid type crash */
+ 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));
@@ -1125,8 +1293,10 @@ syserr_initialize(int argc, VALUE *argv, VALUE self)
VALUE str = StringValue(mesg);
rb_encoding *me = rb_enc_get(mesg);
- mesg = rb_sprintf("%s - %.*s", err,
- (int)RSTRING_LEN(str), RSTRING_PTR(str));
+ 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. */
@@ -1222,6 +1392,7 @@ syserr_eqq(VALUE self, VALUE exc)
*
* begin
* Process.kill('HUP',Process.pid)
+ * sleep # wait for receiver to handle signal sent by Process.kill
* rescue SignalException => e
* puts "received Exception #{e}"
* end
@@ -1263,7 +1434,7 @@ syserr_eqq(VALUE self, VALUE exc)
*
* <em>raises the exception:</em>
*
- * TypeError: can't convert String into Integer
+ * TypeError: no implicit conversion of String into Integer
*
*/
@@ -1436,14 +1607,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
*/
/*
@@ -1494,14 +1665,76 @@ syserr_eqq(VALUE self, VALUE exc)
*/
/*
- * Descendants of class <code>Exception</code> are used to communicate
- * between <code>raise</code> methods and <code>rescue</code>
- * statements in <code>begin/end</code> blocks. <code>Exception</code>
- * objects carry information about the exception---its type (the
- * exception's class name), an optional descriptive string, and
- * optional traceback information. Programs may subclass
- * <code>Exception</code>, or more typically <code>StandardError</code>
- * to provide custom classes and add additional information.
+ * Descendants of class Exception are used to communicate between
+ * Kernel#raise and +rescue+ statements in <code>begin ... end</code> blocks.
+ * Exception objects carry information about the exception -- its type (the
+ * exception's class name), an optional descriptive string, and optional
+ * traceback information. Exception subclasses may add additional
+ * information like NameError#name.
+ *
+ * Programs may make subclasses of Exception, typically of StandardError or
+ * RuntimeError, to provide custom classes and add additional information.
+ * See the subclass list below for defaults for +raise+ and +rescue+.
+ *
+ * When an exception has been raised but not yet handled (in +rescue+,
+ * +ensure+, +at_exit+ and +END+ blocks) the global variable <code>$!</code>
+ * will contain the current exception and <code>$@</code> contains the
+ * current exception's backtrace.
+ *
+ * It is recommended that a library should have one subclass of StandardError
+ * or RuntimeError and have specific exception types inherit from it. This
+ * allows the user to rescue a generic exception type to catch all exceptions
+ * the library may raise even if future versions of the library add new
+ * exception subclasses.
+ *
+ * For example:
+ *
+ * class MyLibrary
+ * class Error < RuntimeError
+ * end
+ *
+ * class WidgetError < Error
+ * end
+ *
+ * class FrobError < Error
+ * end
+ *
+ * end
+ *
+ * To handle both WidgetError and FrobError the library user can rescue
+ * MyLibrary::Error.
+ *
+ * The built-in subclasses of Exception are:
+ *
+ * * NoMemoryError
+ * * ScriptError
+ * * LoadError
+ * * NotImplementedError
+ * * SyntaxError
+ * * SignalException
+ * * Interrupt
+ * * StandardError -- default for +rescue+
+ * * ArgumentError
+ * * IndexError
+ * * StopIteration
+ * * IOError
+ * * EOFError
+ * * LocalJumpError
+ * * NameError
+ * * NoMethodError
+ * * RangeError
+ * * FloatDomainError
+ * * RegexpError
+ * * RuntimeError -- default for +raise+
+ * * SecurityError
+ * * SystemCallError
+ * * Errno::*
+ * * SystemStackError
+ * * ThreadError
+ * * TypeError
+ * * ZeroDivisionError
+ * * SystemExit
+ * * fatal -- impossible to rescue
*/
void
@@ -1517,6 +1750,7 @@ Init_Exception(void)
rb_define_method(rb_eException, "inspect", exc_inspect, 0);
rb_define_method(rb_eException, "backtrace", exc_backtrace, 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);
@@ -1536,18 +1770,21 @@ Init_Exception(void)
rb_eScriptError = rb_define_class("ScriptError", rb_eException);
rb_eSyntaxError = rb_define_class("SyntaxError", rb_eScriptError);
+
rb_eLoadError = rb_define_class("LoadError", rb_eScriptError);
+ /* the path failed to load */
+ rb_attr(rb_eLoadError, rb_intern("path"), 1, 0, Qfalse);
+
rb_eNotImpError = rb_define_class("NotImplementedError", rb_eScriptError);
rb_eNameError = rb_define_class("NameError", rb_eStandardError);
rb_define_method(rb_eNameError, "initialize", name_err_initialize, -1);
rb_define_method(rb_eNameError, "name", name_err_name, 0);
- rb_define_method(rb_eNameError, "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);
rb_define_method(rb_cNameErrorMesg, "to_str", name_err_mesg_to_str, 0);
- rb_define_method(rb_cNameErrorMesg, "_dump", name_err_mesg_to_str, 1);
+ rb_define_method(rb_cNameErrorMesg, "_dump", name_err_mesg_dump, 1);
rb_define_singleton_method(rb_cNameErrorMesg, "_load", name_err_mesg_load, 1);
rb_eNoMethodError = rb_define_class("NoMethodError", rb_eNameError);
rb_define_method(rb_eNoMethodError, "initialize", nometh_err_initialize, -1);
@@ -1567,7 +1804,20 @@ Init_Exception(void)
rb_mErrno = rb_define_module("Errno");
- rb_define_global_function("warn", rb_warn_m, 1);
+ rb_define_global_function("warn", rb_warn_m, -1);
+}
+
+void
+rb_enc_raise(rb_encoding *enc, VALUE exc, const char *fmt, ...)
+{
+ va_list args;
+ VALUE mesg;
+
+ va_start(args, fmt);
+ mesg = rb_enc_vsprintf(enc, fmt, args);
+ va_end(args);
+
+ rb_exc_raise(rb_exc_new3(exc, mesg));
}
void
@@ -1582,6 +1832,16 @@ rb_raise(VALUE exc, const char *fmt, ...)
rb_exc_raise(rb_exc_new3(exc, mesg));
}
+NORETURN(static void raise_loaderror(VALUE path, VALUE mesg));
+
+static void
+raise_loaderror(VALUE path, VALUE mesg)
+{
+ VALUE err = rb_exc_new3(rb_eLoadError, mesg);
+ rb_ivar_set(err, rb_intern("@path"), path);
+ rb_exc_raise(err);
+}
+
void
rb_loaderror(const char *fmt, ...)
{
@@ -1591,7 +1851,19 @@ rb_loaderror(const char *fmt, ...)
va_start(args, fmt);
mesg = rb_enc_vsprintf(rb_locale_encoding(), fmt, args);
va_end(args);
- rb_exc_raise(rb_exc_new3(rb_eLoadError, mesg));
+ raise_loaderror(Qnil, mesg);
+}
+
+void
+rb_loaderror_with_path(VALUE path, const char *fmt, ...)
+{
+ va_list args;
+ VALUE mesg;
+
+ va_start(args, fmt);
+ mesg = rb_enc_vsprintf(rb_locale_encoding(), fmt, args);
+ va_end(args);
+ raise_loaderror(path, mesg);
}
void
@@ -1679,6 +1951,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)
{
@@ -1732,9 +2032,12 @@ rb_sys_warning(const char *fmt, ...)
}
void
-rb_load_fail(const char *path)
+rb_load_fail(VALUE path, const char *err)
{
- rb_loaderror("%s -- %s", strerror(errno), path);
+ VALUE mesg = rb_str_buf_new_cstr(err);
+ rb_str_cat2(mesg, " -- ");
+ rb_str_append(mesg, path); /* should be ASCII compatible */
+ raise_loaderror(path, mesg);
}
void
@@ -1751,6 +2054,31 @@ rb_check_frozen(VALUE obj)
}
void
+rb_error_untrusted(VALUE obj)
+{
+}
+
+#undef rb_check_trusted
+void
+rb_check_trusted(VALUE obj)
+{
+}
+
+void
+rb_check_copyable(VALUE obj, VALUE orig)
+{
+ if (!FL_ABLE(obj)) return;
+ rb_check_frozen_internal(obj);
+ if (!FL_ABLE(orig)) return;
+ 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);
+ }
+ }
+}
+
+void
Init_syserr(void)
{
rb_eNOERROR = set_syserr(0, "NOERROR");
@@ -1760,33 +2088,3 @@ Init_syserr(void)
#undef defined_error
#undef undefined_error
}
-
-static void
-err_append(const char *s, rb_encoding *enc)
-{
- rb_thread_t *th = GET_THREAD();
- VALUE err = th->errinfo;
-
- if (th->mild_compile_error) {
- if (!RTEST(err)) {
- err = rb_exc_new3(rb_eSyntaxError,
- rb_enc_str_new(s, strlen(s), enc));
- th->errinfo = err;
- }
- else {
- VALUE str = rb_obj_as_string(err);
-
- rb_str_cat2(str, "\n");
- rb_str_cat2(str, s);
- th->errinfo = rb_exc_new3(rb_eSyntaxError, str);
- }
- }
- else {
- if (!RTEST(err)) {
- err = rb_exc_new2(rb_eSyntaxError, "compile error");
- th->errinfo = err;
- }
- rb_write_error(s);
- rb_write_error("\n");
- }
-}
diff --git a/eval.c b/eval.c
index 9ceb833d37..15b0db2ce8 100644
--- a/eval.c
+++ b/eval.c
@@ -18,11 +18,12 @@
#include "ruby/encoding.h"
#include "internal.h"
#include "vm_core.h"
-
-#define numberof(array) (int)(sizeof(array) / sizeof((array)[0]))
+#include "probes_helper.h"
NORETURN(void rb_raise_jump(VALUE));
+NODE *rb_vm_get_cref(const rb_iseq_t *, const VALUE *);
+
VALUE rb_eLocalJumpError;
VALUE rb_eSysStackError;
@@ -31,16 +32,22 @@ VALUE rb_eSysStackError;
#include "eval_error.c"
#include "eval_jump.c"
-/* initialize ruby */
+#define CLASS_OR_MODULE_P(obj) \
+ (!SPECIAL_CONST_P(obj) && \
+ (BUILTIN_TYPE(obj) == T_CLASS || BUILTIN_TYPE(obj) == T_MODULE))
-void
-ruby_init(void)
+/* Initializes the Ruby VM and builtin libraries.
+ * @retval 0 if succeeded.
+ * @retval non-zero an error occurred.
+ */
+int
+ruby_setup(void)
{
static int initialized = 0;
int state;
if (initialized)
- return;
+ return 0;
initialized = 1;
ruby_init_stack((void *)&state);
@@ -51,16 +58,37 @@ ruby_init(void)
if ((state = EXEC_TAG()) == 0) {
rb_call_inits();
ruby_prog_init();
+ GET_VM()->running = 1;
}
POP_TAG();
+ return state;
+}
+
+/* Calls ruby_setup() and check error.
+ *
+ * Prints errors and calls exit(3) if an error occurred.
+ */
+void
+ruby_init(void)
+{
+ int state = ruby_setup();
if (state) {
error_print();
exit(EXIT_FAILURE);
}
- GET_VM()->running = 1;
}
+/*! Processes command line arguments and compiles the Ruby source to execute.
+ *
+ * This function does:
+ * \li Processes the given command line flags and arguments for ruby(1)
+ * \li 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
+ *
+ * @return an opaque pointer to the compiled source or an internal special value.
+ * @sa ruby_executable_node().
+ */
void *
ruby_options(int argc, char **argv)
{
@@ -101,6 +129,13 @@ ruby_finalize_1(void)
rb_gc_call_finalizer_at_exit();
}
+/** Runs the VM finalization processes.
+ *
+ * <code>END{}</code> and procs registered by <code>Kernel.#at_exit</code> are
+ * executed here. See the Ruby language spec for more details.
+ *
+ * @note This function is allowed to raise an exception if an error occurred.
+ */
void
ruby_finalize(void)
{
@@ -108,6 +143,16 @@ ruby_finalize(void)
ruby_finalize_1();
}
+/** Destructs the VM.
+ *
+ * Runs the VM finalization processes as well as ruby_finalize(), and frees
+ * resources used by the VM.
+ *
+ * @param ex Default value to the return value.
+ * @return If an error occurred returns a non-zero. If otherwise, returns the
+ * given ex.
+ * @note This function does not raise any exception.
+ */
int
ruby_cleanup(volatile int ex)
{
@@ -120,7 +165,7 @@ ruby_cleanup(volatile int ex)
rb_threadptr_check_signal(th);
PUSH_TAG();
if ((state = EXEC_TAG()) == 0) {
- SAVE_ROOT_JMPBUF(th, { RUBY_VM_CHECK_INTS(); });
+ SAVE_ROOT_JMPBUF(th, { RUBY_VM_CHECK_INTS(th); });
}
POP_TAG();
@@ -134,6 +179,9 @@ ruby_cleanup(volatile int ex)
}
POP_TAG();
+ /* protect from Thread#raise */
+ th->status = THREAD_KILLED;
+
errs[0] = th->errinfo;
PUSH_TAG();
if ((state = EXEC_TAG()) == 0) {
@@ -169,7 +217,7 @@ ruby_cleanup(volatile int ex)
if (!RTEST(err)) continue;
/* th->errinfo contains a NODE while break'ing */
- if (TYPE(err) == T_NODE) continue;
+ if (RB_TYPE_P(err, T_NODE)) continue;
if (rb_obj_is_kind_of(err, rb_eSystemExit)) {
ex = sysexit_status(err);
@@ -210,12 +258,25 @@ ruby_exec_internal(void *n)
return state;
}
+/*! Calls ruby_cleanup() and exits the process */
void
ruby_stop(int ex)
{
exit(ruby_cleanup(ex));
}
+/*! Checks the return value of ruby_options().
+ * @param n return value of ruby_options().
+ * @param status pointer to the exit status of this process.
+ *
+ * ruby_options() sometimes returns a special value to indicate this process
+ * should immediately exit. This function checks if the case. Also stores the
+ * exit status that the caller have to pass to exit(3) into
+ * <code>*status</code>.
+ *
+ * @retval non-zero if the given opaque pointer is actually a compiled source.
+ * @retval 0 if the given value is such a special value.
+ */
int
ruby_executable_node(void *n, int *status)
{
@@ -233,6 +294,10 @@ ruby_executable_node(void *n, int *status)
return FALSE;
}
+/*! Runs the given compiled source and exits this process.
+ * @retval 0 if successfully run the source
+ * @retval non-zero if an error occurred.
+*/
int
ruby_run_node(void *n)
{
@@ -244,6 +309,7 @@ ruby_run_node(void *n)
return ruby_cleanup(ruby_exec_node(n));
}
+/*! Runs the given compiled source */
int
ruby_exec_node(void *n)
{
@@ -338,13 +404,17 @@ 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)) {
+ const char *desc;
+
if (FL_TEST(klass, FL_SINGLETON))
desc = "object";
else {
- switch (TYPE(klass)) {
+ switch (BUILTIN_TYPE(klass)) {
case T_MODULE:
case T_ICLASS:
desc = "module";
@@ -352,6 +422,8 @@ rb_frozen_class_p(VALUE klass)
case T_CLASS:
desc = "class";
break;
+ default:
+ goto noclass;
}
}
rb_error_frozen(desc);
@@ -359,6 +431,34 @@ rb_frozen_class_p(VALUE klass)
}
NORETURN(static void rb_longjmp(int, volatile VALUE));
+static VALUE get_errinfo(void);
+static VALUE get_thread_errinfo(rb_thread_t *th);
+
+static VALUE
+exc_setup_cause(VALUE exc, VALUE cause)
+{
+ ID id_cause;
+ CONST_ID(id_cause, "cause");
+
+#if SUPPORT_JOKE
+ if (NIL_P(cause)) {
+ ID id_true_cause;
+ 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 void
setup_exception(rb_thread_t *th, int tag, volatile VALUE mesg)
@@ -375,6 +475,7 @@ setup_exception(rb_thread_t *th, int tag, volatile VALUE mesg)
if (NIL_P(mesg)) {
mesg = rb_exc_new(rb_eRuntimeError, 0, 0);
}
+ exc_setup_cause(mesg, get_thread_errinfo(th));
file = rb_sourcefile();
if (file) line = rb_sourceline();
@@ -387,7 +488,7 @@ setup_exception(rb_thread_t *th, int tag, volatile VALUE mesg)
else {
at = get_backtrace(mesg);
if (NIL_P(at)) {
- at = rb_make_backtrace();
+ at = rb_vm_backtrace_object();
if (OBJ_FROZEN(mesg)) {
mesg = rb_obj_dup(mesg);
}
@@ -407,19 +508,16 @@ setup_exception(rb_thread_t *th, int tag, volatile VALUE mesg)
if ((status = EXEC_TAG()) == 0) {
RB_GC_GUARD(e) = rb_obj_as_string(e);
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 `%s' at %s:%d - %"PRIsVALUE"\n",
+ rb_obj_classname(th->errinfo), 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 `%s' at %s - %"PRIsVALUE"\n",
+ rb_obj_classname(th->errinfo), file, e);
}
else {
- warn_printf("Exception `%s' - %s\n",
- rb_obj_classname(th->errinfo),
- RSTRING_PTR(e));
+ warn_printf("Exception `%s' - %"PRIsVALUE"\n",
+ rb_obj_classname(th->errinfo), e);
}
}
POP_TAG();
@@ -438,10 +536,13 @@ setup_exception(rb_thread_t *th, int tag, volatile VALUE mesg)
JUMP_TAG(TAG_FATAL);
}
- rb_trap_restore_mask();
-
if (tag != TAG_FATAL) {
- EXEC_EVENT_HOOK(th, RUBY_EVENT_RAISE, th->cfp->self, 0, 0);
+ if (RUBY_DTRACE_RAISE_ENABLED()) {
+ RUBY_DTRACE_RAISE(rb_obj_classname(th->errinfo),
+ rb_sourcefile(),
+ rb_sourceline());
+ }
+ EXEC_EVENT_HOOK(th, RUBY_EVENT_RAISE, th->cfp->self, 0, 0, mesg);
}
}
@@ -480,8 +581,6 @@ rb_interrupt(void)
rb_raise(rb_eInterrupt, "%s", "");
}
-static VALUE get_errinfo(void);
-
/*
* call-seq:
* raise
@@ -518,13 +617,14 @@ rb_f_raise(int argc, VALUE *argv)
}
}
rb_raise_jump(rb_make_exception(argc, argv));
- return Qnil; /* not reached */
+
+ UNREACHABLE;
}
static VALUE
make_exception(int argc, VALUE *argv, int isstr)
{
- VALUE mesg;
+ VALUE mesg, exc;
ID exception;
int n;
@@ -533,10 +633,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;
@@ -547,17 +648,18 @@ 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 (exc == sysstack_error) 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");
}
break;
default:
- rb_raise(rb_eArgError, "wrong number of arguments (%d for 0..3)", argc);
+ rb_check_arity(argc, 0, 3);
break;
}
if (argc > 0) {
@@ -589,7 +691,7 @@ rb_raise_jump(VALUE mesg)
setup_exception(th, TAG_RAISE, mesg);
- EXEC_EVENT_HOOK(th, RUBY_EVENT_C_RETURN, self, mid, klass);
+ EXEC_EVENT_HOOK(th, RUBY_EVENT_C_RETURN, self, mid, klass, Qnil);
rb_thread_raised_clear(th);
JUMP_TAG(TAG_RAISE);
}
@@ -605,8 +707,7 @@ rb_block_given_p(void)
{
rb_thread_t *th = GET_THREAD();
- if ((th->cfp->lfp[0] & 0x02) == 0 &&
- GC_GUARDED_PTR_REF(th->cfp->lfp[0])) {
+ if (rb_vm_control_frame_block_ptr(th->cfp)) {
return TRUE;
}
else {
@@ -641,8 +742,8 @@ rb_rescue2(VALUE (* b_proc) (ANYARGS), VALUE data1,
volatile VALUE e_info = th->errinfo;
va_list args;
- PUSH_TAG();
- if ((state = EXEC_TAG()) == 0) {
+ TH_PUSH_TAG(th);
+ if ((state = TH_EXEC_TAG()) == 0) {
retry_entry:
result = (*b_proc) (data1);
}
@@ -685,7 +786,7 @@ rb_rescue2(VALUE (* b_proc) (ANYARGS), VALUE data1,
}
}
}
- POP_TAG();
+ TH_POP_TAG();
if (state)
JUMP_TAG(state);
@@ -704,7 +805,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;
@@ -712,23 +813,22 @@ rb_protect(VALUE (* proc) (VALUE), VALUE data, int * state)
protect_tag.prev = th->protect_tag;
- PUSH_TAG();
+ TH_PUSH_TAG(th);
th->protect_tag = &protect_tag;
MEMCPY(&org_jmpbuf, &(th)->root_jmpbuf, rb_jmpbuf_t, 1);
- if ((status = EXEC_TAG()) == 0) {
+ if ((status = TH_EXEC_TAG()) == 0) {
SAVE_ROOT_JMPBUF(th, result = (*proc) (data));
}
+ else {
+ th->cfp = cfp;
+ }
MEMCPY(&(th)->root_jmpbuf, &org_jmpbuf, rb_jmpbuf_t, 1);
th->protect_tag = protect_tag.prev;
- POP_TAG();
+ TH_POP_TAG();
if (state) {
*state = status;
}
- if (status != 0) {
- th->cfp = cfp;
- return Qnil;
- }
return result;
}
@@ -738,7 +838,14 @@ rb_ensure(VALUE (*b_proc)(ANYARGS), VALUE data1, VALUE (*e_proc)(ANYARGS), VALUE
{
int state;
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);
@@ -746,7 +853,10 @@ rb_ensure(VALUE (*b_proc)(ANYARGS), VALUE data1, VALUE (*e_proc)(ANYARGS), VALUE
POP_TAG();
/* TODO: fix me */
/* retval = prot_tag ? prot_tag->retval : Qnil; */ /* save retval */
- (*e_proc) (data2);
+ errinfo = th->errinfo;
+ th->ensure_list=ensure_list.next;
+ (*ensure_list.entry.e_proc)(ensure_list.entry.data2);
+ th->errinfo = errinfo;
if (state)
JUMP_TAG(state);
return result;
@@ -779,7 +889,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) {
@@ -797,6 +907,36 @@ frame_func_id(rb_control_frame_t *cfp)
return 0;
}
+static ID
+frame_called_id(rb_control_frame_t *cfp)
+{
+ const rb_method_entry_t *me_local;
+ rb_iseq_t *iseq = cfp->iseq;
+ if (cfp->me) {
+ return cfp->me->called_id;
+ }
+ while (iseq) {
+ if (RUBY_VM_IFUNC_P(iseq)) {
+ NODE *ifunc = (NODE *)iseq;
+ if (ifunc->nd_aid) return ifunc->nd_aid;
+ return idIFUNC;
+ }
+ me_local = method_entry_of_iseq(cfp, iseq);
+ if (me_local) {
+ cfp->me = me_local;
+ return me_local->called_id;
+ }
+ if (iseq->defined_method_id) {
+ return iseq->defined_method_id;
+ }
+ if (iseq->local_iseq == iseq) {
+ break;
+ }
+ iseq = iseq->parent_iseq;
+ }
+ return 0;
+}
+
ID
rb_frame_this_func(void)
{
@@ -806,18 +946,33 @@ rb_frame_this_func(void)
ID
rb_frame_callee(void)
{
- return frame_func_id(GET_THREAD()->cfp);
+ return frame_called_id(GET_THREAD()->cfp);
}
-static ID
-rb_frame_caller(void)
+static rb_control_frame_t *
+previous_frame(rb_thread_t *th)
{
- rb_thread_t *th = GET_THREAD();
rb_control_frame_t *prev_cfp = RUBY_VM_PREVIOUS_CONTROL_FRAME(th->cfp);
/* check if prev_cfp can be accessible */
if ((void *)(th->stack + th->stack_size) == (void *)(prev_cfp)) {
return 0;
}
+ return prev_cfp;
+}
+
+static ID
+prev_frame_callee(void)
+{
+ rb_control_frame_t *prev_cfp = previous_frame(GET_THREAD());
+ if (!prev_cfp) return 0;
+ return frame_called_id(prev_cfp);
+}
+
+static ID
+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);
}
@@ -843,13 +998,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);
@@ -867,16 +1017,288 @@ static VALUE
rb_mod_include(int argc, VALUE *argv, VALUE module)
{
int i;
+ ID id_append_features, id_included;
+
+ CONST_ID(id_append_features, "append_features");
+ CONST_ID(id_included, "included");
+
+ for (i = 0; i < argc; i++)
+ Check_Type(argv[i], T_MODULE);
+ while (argc--) {
+ rb_funcall(argv[argc], id_append_features, 1, module);
+ rb_funcall(argv[argc], id_included, 1, module);
+ }
+ return module;
+}
+
+/*
+ * call-seq:
+ * prepend_features(mod) -> mod
+ *
+ * When this module is prepended in another, Ruby calls
+ * <code>prepend_features</code> in this module, passing it the
+ * receiving module in _mod_. Ruby's default implementation is
+ * to overlay the constants, methods, and module variables of this module
+ * to _mod_ if this module has not already been added to
+ * _mod_ or one of its ancestors. See also <code>Module#prepend</code>.
+ */
+
+static VALUE
+rb_mod_prepend_features(VALUE module, VALUE prepend)
+{
+ if (!CLASS_OR_MODULE_P(prepend)) {
+ Check_Type(prepend, T_CLASS);
+ }
+ rb_prepend_module(prepend, module);
+
+ return module;
+}
+
+/*
+ * call-seq:
+ * prepend(module, ...) -> self
+ *
+ * Invokes <code>Module.prepend_features</code> on each parameter in reverse order.
+ */
+
+static VALUE
+rb_mod_prepend(int argc, VALUE *argv, VALUE module)
+{
+ int i;
+ ID id_prepend_features, id_prepended;
+ CONST_ID(id_prepend_features, "prepend_features");
+ CONST_ID(id_prepended, "prepended");
for (i = 0; i < argc; i++)
Check_Type(argv[i], T_MODULE);
while (argc--) {
- rb_funcall(argv[argc], rb_intern("append_features"), 1, module);
- rb_funcall(argv[argc], rb_intern("included"), 1, module);
+ rb_funcall(argv[argc], id_prepend_features, 1, module);
+ rb_funcall(argv[argc], id_prepended, 1, module);
}
return module;
}
+static VALUE
+hidden_identity_hash_new()
+{
+ VALUE hash = rb_hash_new();
+
+ rb_funcall(hash, rb_intern("compare_by_identity"), 0);
+ RBASIC_CLEAR_CLASS(hash); /* hide from ObjectSpace */
+ return hash;
+}
+
+void
+rb_using_refinement(NODE *cref, VALUE klass, VALUE module)
+{
+ VALUE iclass, c, superclass = klass;
+
+ Check_Type(klass, T_CLASS);
+ Check_Type(module, T_MODULE);
+ if (NIL_P(cref->nd_refinements)) {
+ 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);
+ cref->flags &= ~NODE_FL_CREF_OMOD_SHARED;
+ }
+ if (!NIL_P(c = rb_hash_lookup(cref->nd_refinements, klass))) {
+ superclass = c;
+ while (c && RB_TYPE_P(c, T_ICLASS)) {
+ if (RBASIC(c)->klass == module) {
+ /* already used refinement */
+ return;
+ }
+ c = RCLASS_SUPER(c);
+ }
+ }
+ }
+ FL_SET(module, RMODULE_IS_OVERLAID);
+ c = iclass = rb_include_class_new(module, superclass);
+ RCLASS_REFINED_CLASS(c) = klass;
+
+ RCLASS_M_TBL(OBJ_WB_UNPROTECT(c)) = RCLASS_M_TBL(OBJ_WB_UNPROTECT(module));
+
+ module = RCLASS_SUPER(module);
+ while (module && module != klass) {
+ FL_SET(module, RMODULE_IS_OVERLAID);
+ c = RCLASS_SET_SUPER(c, rb_include_class_new(module, RCLASS_SUPER(c)));
+ RCLASS_REFINED_CLASS(c) = klass;
+ module = RCLASS_SUPER(module);
+ }
+ rb_hash_aset(cref->nd_refinements, klass, iclass);
+}
+
+static int
+using_refinement(VALUE klass, VALUE module, VALUE arg)
+{
+ NODE *cref = (NODE *) arg;
+
+ rb_using_refinement(cref, klass, module);
+ return ST_CONTINUE;
+}
+
+static void
+using_module_recursive(NODE *cref, VALUE klass)
+{
+ ID id_refinements;
+ VALUE super, module, refinements;
+
+ 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);
+}
+
+void
+rb_using_module(NODE *cref, VALUE module)
+{
+ Check_Type(module, T_MODULE);
+ using_module_recursive(cref, module);
+}
+
+VALUE
+rb_refinement_module_get_refined_class(VALUE module)
+{
+ ID id_refined_class;
+
+ CONST_ID(id_refined_class, "__refined_class__");
+ return rb_attr_get(module, id_refined_class);
+}
+
+static void
+add_activated_refinement(VALUE activated_refinements,
+ VALUE klass, VALUE refinement)
+{
+ VALUE iclass, c, superclass = klass;
+
+ if (!NIL_P(c = rb_hash_lookup(activated_refinements, klass))) {
+ superclass = c;
+ while (c && RB_TYPE_P(c, T_ICLASS)) {
+ if (RBASIC(c)->klass == refinement) {
+ /* already used refinement */
+ return;
+ }
+ c = RCLASS_SUPER(c);
+ }
+ }
+ FL_SET(refinement, RMODULE_IS_OVERLAID);
+ c = iclass = rb_include_class_new(refinement, superclass);
+ RCLASS_REFINED_CLASS(c) = klass;
+ refinement = RCLASS_SUPER(refinement);
+ while (refinement) {
+ FL_SET(refinement, RMODULE_IS_OVERLAID);
+ c = RCLASS_SET_SUPER(c, rb_include_class_new(refinement, RCLASS_SUPER(c)));
+ RCLASS_REFINED_CLASS(c) = klass;
+ refinement = RCLASS_SUPER(refinement);
+ }
+ rb_hash_aset(activated_refinements, klass, iclass);
+}
+
+VALUE rb_yield_refine_block(VALUE refinement, VALUE refinements);
+
+/*
+ * call-seq:
+ * refine(klass) { block } -> module
+ *
+ * Refine <i>klass</i> in the receiver.
+ *
+ * Returns an overlaid module.
+ */
+
+static VALUE
+rb_mod_refine(VALUE module, VALUE klass)
+{
+ VALUE refinement;
+ ID id_refinements, id_activated_refinements,
+ id_refined_class, id_defined_at;
+ VALUE refinements, activated_refinements;
+ rb_thread_t *th = GET_THREAD();
+ rb_block_t *block = rb_vm_control_frame_block_ptr(th->cfp);
+
+ if (!block) {
+ rb_raise(rb_eArgError, "no block given");
+ }
+ if (block->proc) {
+ rb_raise(rb_eArgError,
+ "can't pass a Proc as a block to Module#refine");
+ }
+ Check_Type(klass, T_CLASS);
+ CONST_ID(id_refinements, "__refinements__");
+ refinements = rb_attr_get(module, id_refinements);
+ if (NIL_P(refinements)) {
+ refinements = hidden_identity_hash_new();
+ rb_ivar_set(module, id_refinements, refinements);
+ }
+ CONST_ID(id_activated_refinements, "__activated_refinements__");
+ activated_refinements = rb_attr_get(module, id_activated_refinements);
+ if (NIL_P(activated_refinements)) {
+ activated_refinements = hidden_identity_hash_new();
+ rb_ivar_set(module, id_activated_refinements,
+ activated_refinements);
+ }
+ refinement = rb_hash_lookup(refinements, klass);
+ if (NIL_P(refinement)) {
+ refinement = rb_module_new();
+ 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);
+ CONST_ID(id_defined_at, "__defined_at__");
+ rb_ivar_set(refinement, id_defined_at, module);
+ rb_hash_aset(refinements, klass, refinement);
+ add_activated_refinement(activated_refinements, klass, refinement);
+ }
+ rb_yield_refine_block(refinement, activated_refinements);
+ 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");
+ }
+ Check_Type(module, T_MODULE);
+ rb_using_module(cref, module);
+ rb_clear_method_cache_by_class(rb_cObject);
+ return self;
+}
+
void
rb_obj_call_init(VALUE obj, int argc, VALUE *argv)
{
@@ -953,15 +1375,17 @@ static VALUE
rb_obj_extend(int argc, VALUE *argv, VALUE obj)
{
int i;
+ ID id_extend_object, id_extended;
- if (argc == 0) {
- rb_raise(rb_eArgError, "wrong number of arguments (at least 1)");
- }
+ CONST_ID(id_extend_object, "extend_object");
+ CONST_ID(id_extended, "extended");
+
+ rb_check_arity(argc, 1, UNLIMITED_ARGUMENTS);
for (i = 0; i < argc; i++)
Check_Type(argv[i], T_MODULE);
while (argc--) {
- rb_funcall(argv[argc], rb_intern("extend_object"), 1, obj);
- rb_funcall(argv[argc], rb_intern("extended"), 1, obj);
+ rb_funcall(argv[argc], id_extend_object, 1, obj);
+ rb_funcall(argv[argc], id_extended, 1, obj);
}
return obj;
}
@@ -980,15 +1404,37 @@ 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");
+ rb_warning("main.include in the wrapped load is effective only in wrapper module");
return rb_mod_include(argc, argv, th->top_wrapper);
}
return rb_mod_include(argc, argv, rb_cObject);
}
+/*
+ * call-seq:
+ * using(module) -> self
+ *
+ * Import class refinements from <i>module</i> into the scope where
+ * <code>using</code> is called.
+ */
+
+static VALUE
+top_using(VALUE self, VALUE module)
+{
+ NODE *cref = rb_vm_cref();
+ rb_control_frame_t *prev_cfp = previous_frame(GET_THREAD());
+
+ if (cref->nd_next || (prev_cfp && prev_cfp->me)) {
+ rb_raise(rb_eRuntimeError,
+ "main.using is permitted only at toplevel");
+ }
+ Check_Type(module, T_MODULE);
+ rb_using_module(cref, module);
+ rb_clear_method_cache_by_class(rb_cObject);
+ return self;
+}
+
static VALUE *
errinfo_place(rb_thread_t *th)
{
@@ -998,12 +1444,12 @@ errinfo_place(rb_thread_t *th)
while (RUBY_VM_VALID_CONTROL_FRAME_P(cfp, end_cfp)) {
if (RUBY_VM_NORMAL_ISEQ_P(cfp->iseq)) {
if (cfp->iseq->type == ISEQ_TYPE_RESCUE) {
- return &cfp->dfp[-2];
+ return &cfp->ep[-2];
}
else if (cfp->iseq->type == ISEQ_TYPE_ENSURE &&
- TYPE(cfp->dfp[-2]) != T_NODE &&
- !FIXNUM_P(cfp->dfp[-2])) {
- return &cfp->dfp[-2];
+ !RB_TYPE_P(cfp->ep[-2], T_NODE) &&
+ !FIXNUM_P(cfp->ep[-2])) {
+ return &cfp->ep[-2];
}
}
cfp = RUBY_VM_PREVIOUS_CONTROL_FRAME(cfp);
@@ -1101,9 +1547,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>.
*
*/
@@ -1111,7 +1557,29 @@ 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);
+ }
+ else {
+ return Qnil;
+ }
+}
+
+/*
+ * 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 = prev_frame_callee(); /* need *callee* ID */
if (fname) {
return ID2SYM(fname);
@@ -1121,6 +1589,27 @@ rb_f_method_name(void)
}
}
+/*
+ * call-seq:
+ * __dir__ -> string
+ *
+ * Returns the canonicalized absolute path of the directory of the file from
+ * which this method is called. It means symlinks in the path is resolved.
+ * If <code>__FILE__</code> is <code>nil</code>, it returns <code>nil</code>.
+ * The return value equals to <code>File.dirname(File.realpath(__FILE__))</code>.
+ *
+ */
+static VALUE
+f_current_dirname(void)
+{
+ VALUE base = rb_current_realfilepath();
+ if (NIL_P(base)) {
+ return Qnil;
+ }
+ base = rb_file_dirname(base);
+ return base;
+}
+
void
Init_eval(void)
{
@@ -1133,11 +1622,18 @@ Init_eval(void)
rb_define_global_function("global_variables", rb_f_global_variables, 0); /* in variable.c */
rb_define_global_function("__method__", rb_f_method_name, 0);
- rb_define_global_function("__callee__", rb_f_method_name, 0);
+ 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, "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");
@@ -1147,7 +1643,10 @@ Init_eval(void)
rb_define_singleton_method(rb_cModule, "nesting", rb_mod_nesting, 0);
rb_define_singleton_method(rb_cModule, "constants", rb_mod_s_constants, -1);
- rb_define_singleton_method(rb_vm_top_self(), "include", top_include, -1);
+ rb_define_private_method(rb_singleton_class(rb_vm_top_self()),
+ "include", top_include, -1);
+ rb_define_private_method(rb_singleton_class(rb_vm_top_self()),
+ "using", top_using, 1);
rb_define_method(rb_mKernel, "extend", rb_obj_extend, -1);
diff --git a/eval_error.c b/eval_error.c
index fd06adf92d..2ce661204c 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);
@@ -55,20 +57,33 @@ rb_get_backtrace(VALUE info)
return get_backtrace(info);
}
+VALUE rb_exc_set_backtrace(VALUE exc, VALUE bt);
+
static void
set_backtrace(VALUE info, VALUE bt)
{
+ ID set_backtrace = rb_intern("set_backtrace");
+
+ if (rb_backtrace_p(bt)) {
+ if (rb_method_basic_definition_p(CLASS_OF(info), set_backtrace)) {
+ rb_exc_set_backtrace(info, bt);
+ return;
+ }
+ else {
+ bt = rb_backtrace_to_str_ary(bt);
+ }
+ }
rb_funcall(info, rb_intern("set_backtrace"), 1, 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;
@@ -76,15 +91,19 @@ error_print(void)
return;
rb_thread_raised_clear(th);
- PUSH_TAG();
- if (EXEC_TAG() == 0) {
+ TH_PUSH_TAG(th);
+ if (TH_EXEC_TAG() == 0) {
errat = get_backtrace(errinfo);
}
- else {
+ else if (errat == Qundef) {
errat = Qnil;
}
- if (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();
@@ -99,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 (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 (EXEC_TAG())
- goto error;
if (eclass == rb_eRuntimeError && elen == 0) {
warn_print(": unhandled exception\n");
}
@@ -130,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 {
@@ -147,7 +165,7 @@ 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) {
@@ -160,7 +178,6 @@ error_print(void)
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)
@@ -168,8 +185,9 @@ error_print(void)
#define TRACE_TAIL 5
for (i = 1; i < len; i++) {
- if (TYPE(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",
@@ -179,7 +197,8 @@ error_print(void)
}
}
error:
- POP_TAG();
+ TH_POP_TAG();
+ th->errinfo = errinfo;
rb_thread_raised_set(th, raised_flag);
}
@@ -200,10 +219,19 @@ 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 `%s' for %s `%s'", v,
- rb_id2name(id),
- (TYPE(klass) == T_MODULE) ? "module" : "class",
- rb_class2name(klass));
+ rb_name_error(id, "undefined%s method `%"PRIsVALUE"' for %s `%"PRIsVALUE"'", v,
+ QUOTE_ID(id),
+ (RB_TYPE_P(klass, T_MODULE)) ? "module" : "class",
+ rb_class_name(klass));
+}
+
+void
+rb_print_undef_str(VALUE klass, VALUE name)
+{
+ rb_name_error_str(name, "undefined method `%"PRIsVALUE"' for %s `%"PRIsVALUE"'",
+ QUOTE(name),
+ (RB_TYPE_P(klass, T_MODULE)) ? "module" : "class",
+ rb_class_name(klass));
}
static int
diff --git a/eval_intern.h b/eval_intern.h
index 483e711c34..a0ecb5086b 100644
--- a/eval_intern.h
+++ b/eval_intern.h
@@ -5,7 +5,7 @@
#include "vm_core.h"
#define PASS_PASSED_BLOCK_TH(th) do { \
- (th)->passed_block = GC_GUARDED_PTR_REF((rb_block_t *)(th)->cfp->lfp[0]); \
+ (th)->passed_block = rb_vm_control_frame_block_ptr(th->cfp); \
(th)->cfp->flag |= VM_FRAME_FLAG_PASSED; \
} while (0)
@@ -28,29 +28,12 @@
#include <setjmp.h>
#ifdef __APPLE__
-#include <crt_externs.h>
-#endif
-
-/* Make alloca work the best possible way. */
-#ifdef __GNUC__
-# ifndef atarist
-# ifndef alloca
-# define alloca __builtin_alloca
-# endif
-# endif /* atarist */
-#else
-# ifdef HAVE_ALLOCA_H
-# include <alloca.h>
+# ifdef HAVE_CRT_EXTERNS_H
+# include <crt_externs.h>
# else
-# ifdef _AIX
-#pragma alloca
-# else
-# ifndef alloca /* predefined by HP cc +Olibcalls */
-void *alloca();
-# endif
-# endif /* AIX */
-# endif /* HAVE_ALLOCA_H */
-#endif /* __GNUC__ */
+# include "missing/crt_externs.h"
+# endif
+#endif
#ifndef HAVE_STRING_H
char *strrchr(const char *, const char);
@@ -100,9 +83,28 @@ 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 */ \
+ }
+#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(); \
@@ -112,8 +114,7 @@ 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; \
@@ -122,17 +123,42 @@ extern int select_large_fdset(int, fd_set *, fd_set *, fd_set *, struct timeval
#define TH_POP_TAG2() \
_th->tag = _tag.prev
+#define TH_PUSH_TAG2() (_th->tag = &_tag, 0)
+
+#define TH_TMPPOP_TAG() TH_POP_TAG2()
+
+#define TH_REPUSH_TAG() TH_PUSH_TAG2()
+
#define PUSH_TAG() TH_PUSH_TAG(GET_THREAD())
#define POP_TAG() TH_POP_TAG()
-#define TH_EXEC_TAG() ruby_setjmp(_th->tag->buf)
+/* 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)
+{
+ ruby_longjmp(th->tag->buf, (th->state = st));
+}
+
+/*
+ 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(_th) : TH_PUSH_TAG2())
#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))
@@ -174,12 +200,6 @@ enum ruby_tag_type {
#define SCOPE_CHECK(f) (rb_vm_cref()->nd_visi == (f))
#define SCOPE_SET(f) (rb_vm_cref()->nd_visi = (f))
-#define CHECK_STACK_OVERFLOW(cfp, margin) do \
- if ((VALUE *)((char *)(((VALUE *)(cfp)->sp) + (margin)) + sizeof(rb_control_frame_t)) >= ((VALUE *)(cfp))) { \
- rb_exc_raise(sysstack_error); \
- } \
-while (0)
-
void rb_thread_cleanup(void);
void rb_thread_wait_other_threads(void);
@@ -198,11 +218,14 @@ int rb_threadptr_reset_raised(rb_thread_t *th);
VALUE rb_f_eval(int argc, VALUE *argv, VALUE self);
VALUE rb_make_exception(int argc, VALUE *argv);
+NORETURN(void rb_method_name_error(VALUE, VALUE));
+
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_vm_localjump_error(const char *,VALUE, int));
-NORETURN(void rb_vm_jump_tag_but_local_jump(int, VALUE));
+NORETURN(void rb_vm_jump_tag_but_local_jump(int));
NORETURN(void rb_raise_method_missing(rb_thread_t *th, int argc, VALUE *argv,
VALUE obj, int call_status));
@@ -213,10 +236,13 @@ void rb_vm_set_progname(VALUE filename);
void rb_thread_terminate_all(void);
VALUE rb_vm_top_self();
VALUE rb_vm_cbase(void);
-void rb_trap_restore_mask(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 f3a1f78a3f..30094e9176 100644
--- a/eval_jump.c
+++ b/eval_jump.c
@@ -93,48 +93,44 @@ 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();
- 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);
- }
+ volatile VALUE errinfo = th->errinfo;
- 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);
+ PUSH_TAG();
+ if ((status = EXEC_TAG()) == 0) {
+ again:
+ exec_end_procs_chain(&ephemeral_end_procs);
+ exec_end_procs_chain(&end_procs);
}
+ else {
+ 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..2f7c272744
--- /dev/null
+++ b/ext/-test-/bignum/bigzero.c
@@ -0,0 +1,26 @@
+#include "ruby.h"
+
+static VALUE
+bug_big_zero(VALUE self, VALUE length)
+{
+ long len = NUM2ULONG(length);
+ VALUE z = rb_big_new(len, 1);
+ MEMZERO(RBIGNUM_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(RBIGNUM_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..03023196e6
--- /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 : RBIGNUM_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 : RBIGNUM_NEGATIVE_P(val);
+ int nlz_bits;
+ size_t size = rb_absint_size(val, &nlz_bits);
+ if (nlz_bits == 0 && !(neg && rb_absint_singlebit_p(val)))
+ 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..758465b567
--- /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_BDIGITS", INT2NUM(SIZEOF_BDIGITS));
+ rb_define_const(rb_cBignum, "BITSPERDIG", INT2NUM(SIZEOF_BDIGITS * CHAR_BIT));
+ rb_define_method(rb_cInteger, "big_mul_normal", mul_normal, 1);
+ rb_define_method(rb_cInteger, "big_sq_fast", sq_fast, 0);
+ rb_define_method(rb_cInteger, "big_mul_balance", mul_balance, 1);
+ 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-5832/bug.c b/ext/-test-/bug-5832/bug.c
new file mode 100644
index 0000000000..67be5844b6
--- /dev/null
+++ b/ext/-test-/bug-5832/bug.c
@@ -0,0 +1,14 @@
+#include <ruby.h>
+
+static VALUE
+bug_funcall_callback(VALUE self, VALUE obj)
+{
+ return rb_funcall(obj, rb_intern("callback"), 0);
+}
+
+void
+Init_bug(void)
+{
+ VALUE mBug = rb_define_module("Bug");
+ rb_define_module_function(mBug, "funcall_callback", bug_funcall_callback, 1);
+}
diff --git a/ext/-test-/bug-5832/extconf.rb b/ext/-test-/bug-5832/extconf.rb
new file mode 100644
index 0000000000..55a4b7d93f
--- /dev/null
+++ b/ext/-test-/bug-5832/extconf.rb
@@ -0,0 +1 @@
+create_makefile("-test-/bug-5832/bug")
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/extconf.rb b/ext/-test-/debug/extconf.rb
new file mode 100644
index 0000000000..8f7922e1a6
--- /dev/null
+++ b/ext/-test-/debug/extconf.rb
@@ -0,0 +1,6 @@
+$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-/debug")
diff --git a/ext/-test-/debug/init.c b/ext/-test-/debug/init.c
new file mode 100644
index 0000000000..fe3979cbc5
--- /dev/null
+++ b/ext/-test-/debug/init.c
@@ -0,0 +1,11 @@
+#include "ruby.h"
+
+#define init(n) {void Init_##n(VALUE klass); Init_##n(klass);}
+
+void
+Init_debug(void)
+{
+ VALUE mBug = rb_define_module("Bug");
+ VALUE klass = rb_define_module_under(mBug, "Debug");
+ TEST_INIT_FUNCS(init);
+}
diff --git a/ext/-test-/debug/inspector.c b/ext/-test-/debug/inspector.c
new file mode 100644
index 0000000000..f0c58e59f9
--- /dev/null
+++ b/ext/-test-/debug/inspector.c
@@ -0,0 +1,32 @@
+#include "ruby/ruby.h"
+#include "ruby/debug.h"
+
+static VALUE
+callback(const rb_debug_inspector_t *dbg_context, void *data)
+{
+ VALUE locs = rb_debug_inspector_backtrace_locations(dbg_context);
+ long i, len = RARRAY_LEN(locs);
+ VALUE binds = rb_ary_new();
+ for (i = 0; i < len; ++i) {
+ VALUE entry = rb_ary_new();
+ rb_ary_push(binds, entry);
+ rb_ary_push(entry, rb_debug_inspector_frame_self_get(dbg_context, i));
+ rb_ary_push(entry, rb_debug_inspector_frame_binding_get(dbg_context, i));
+ rb_ary_push(entry, rb_debug_inspector_frame_class_get(dbg_context, i));
+ rb_ary_push(entry, rb_debug_inspector_frame_iseq_get(dbg_context, i));
+ rb_ary_push(entry, rb_ary_entry(locs, i));
+ }
+ return binds;
+}
+
+static VALUE
+debug_inspector(VALUE self)
+{
+ return rb_debug_inspector_open(callback, NULL);
+}
+
+void
+Init_inspector(VALUE klass)
+{
+ rb_define_module_function(klass, "inspector", debug_inspector, 0);
+}
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/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-/exception/enc_raise.c b/ext/-test-/exception/enc_raise.c
new file mode 100644
index 0000000000..dc8a42cf3f
--- /dev/null
+++ b/ext/-test-/exception/enc_raise.c
@@ -0,0 +1,15 @@
+#include <ruby.h>
+#include <ruby/encoding.h>
+
+static VALUE
+enc_raise(VALUE exc, VALUE encoding, VALUE mesg)
+{
+ rb_enc_raise(rb_to_encoding(encoding), exc, "%s", StringValueCStr(mesg));
+ UNREACHABLE;
+}
+
+void
+Init_enc_raise(VALUE klass)
+{
+ rb_define_module_function(klass, "enc_raise", enc_raise, 2);
+}
diff --git a/ext/-test-/exception/ensured.c b/ext/-test-/exception/ensured.c
new file mode 100644
index 0000000000..365e1f4f79
--- /dev/null
+++ b/ext/-test-/exception/ensured.c
@@ -0,0 +1,25 @@
+#include <ruby.h>
+
+static VALUE
+begin(VALUE object)
+{
+ return rb_funcall(object, rb_intern("try_method"), 0);
+}
+
+static VALUE
+ensure(VALUE object)
+{
+ return rb_funcall(object, rb_intern("ensured_method"), 0);
+}
+
+static VALUE
+ensured(VALUE module, VALUE object)
+{
+ return rb_ensure(begin, object, ensure, object);
+}
+
+void
+Init_ensured(VALUE klass)
+{
+ rb_define_module_function(klass, "ensured", ensured, 1);
+}
diff --git a/ext/-test-/exception/extconf.rb b/ext/-test-/exception/extconf.rb
new file mode 100644
index 0000000000..0faf6d53ed
--- /dev/null
+++ b/ext/-test-/exception/extconf.rb
@@ -0,0 +1,6 @@
+$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-/exception")
diff --git a/ext/-test-/exception/init.c b/ext/-test-/exception/init.c
new file mode 100644
index 0000000000..853bb68f79
--- /dev/null
+++ b/ext/-test-/exception/init.c
@@ -0,0 +1,11 @@
+#include "ruby.h"
+
+#define init(n) {void Init_##n(VALUE klass); Init_##n(klass);}
+
+void
+Init_exception(void)
+{
+ VALUE mBug = rb_define_module("Bug");
+ VALUE klass = rb_define_class_under(mBug, "Exception", rb_eStandardError);
+ TEST_INIT_FUNCS(init);
+}
diff --git a/ext/-test-/fatal/extconf.rb b/ext/-test-/fatal/extconf.rb
new file mode 100644
index 0000000000..e0cfeb2095
--- /dev/null
+++ b/ext/-test-/fatal/extconf.rb
@@ -0,0 +1 @@
+create_makefile("-test-/fatal/rb_fatal")
diff --git a/ext/-test-/fatal/rb_fatal.c b/ext/-test-/fatal/rb_fatal.c
new file mode 100644
index 0000000000..71aef4658a
--- /dev/null
+++ b/ext/-test-/fatal/rb_fatal.c
@@ -0,0 +1,19 @@
+#include <ruby.h>
+
+static VALUE
+ruby_fatal(VALUE obj, VALUE msg)
+{
+ const char *cmsg = NULL;
+
+ (void)obj;
+
+ cmsg = RSTRING_PTR(msg);
+ rb_fatal("%s", cmsg);
+ return 0; /* never reached */
+}
+
+void
+Init_rb_fatal(void)
+{
+ rb_define_method(rb_mKernel, "rb_fatal", ruby_fatal, 1);
+}
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/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-/iter/break.c b/ext/-test-/iter/break.c
new file mode 100644
index 0000000000..56ba7e7ffd
--- /dev/null
+++ b/ext/-test-/iter/break.c
@@ -0,0 +1,25 @@
+#include <ruby.h>
+
+static VALUE
+iter_break(VALUE self)
+{
+ rb_iter_break();
+
+ UNREACHABLE;
+}
+
+static VALUE
+iter_break_value(VALUE self, VALUE val)
+{
+ rb_iter_break_value(val);
+
+ UNREACHABLE;
+}
+
+void
+Init_break(void)
+{
+ VALUE breakable = rb_define_module_under(rb_define_module("Bug"), "Breakable");
+ rb_define_module_function(breakable, "iter_break", iter_break, 0);
+ rb_define_module_function(breakable, "iter_break_value", iter_break_value, 1);
+}
diff --git a/ext/-test-/iter/extconf.rb b/ext/-test-/iter/extconf.rb
new file mode 100644
index 0000000000..695b5e9f6d
--- /dev/null
+++ b/ext/-test-/iter/extconf.rb
@@ -0,0 +1 @@
+create_makefile("-test-/iter/break")
diff --git a/ext/-test-/marshal/compat/extconf.rb b/ext/-test-/marshal/compat/extconf.rb
new file mode 100644
index 0000000000..bb11ebfb8c
--- /dev/null
+++ b/ext/-test-/marshal/compat/extconf.rb
@@ -0,0 +1 @@
+create_makefile("-test-/marshal/compat")
diff --git a/ext/-test-/marshal/compat/usrcompat.c b/ext/-test-/marshal/compat/usrcompat.c
new file mode 100644
index 0000000000..f812df5631
--- /dev/null
+++ b/ext/-test-/marshal/compat/usrcompat.c
@@ -0,0 +1,32 @@
+#include <ruby.h>
+
+static VALUE
+usr_dumper(VALUE self)
+{
+ return self;
+}
+
+static VALUE
+usr_loader(VALUE self, VALUE m)
+{
+ VALUE val = rb_ivar_get(m, rb_intern("@value"));
+ *(int *)DATA_PTR(self) = NUM2INT(val);
+ return self;
+}
+
+static VALUE
+compat_mload(VALUE self, VALUE data)
+{
+ rb_ivar_set(self, rb_intern("@value"), data);
+ return self;
+}
+
+void
+Init_compat(void)
+{
+ VALUE newclass = rb_path2class("Bug::Marshal::UsrMarshal");
+ VALUE oldclass = rb_define_class_under(newclass, "compat", rb_cObject);
+
+ rb_define_method(oldclass, "marshal_load", compat_mload, 1);
+ rb_marshal_define_compat(newclass, oldclass, usr_dumper, usr_loader);
+}
diff --git a/ext/-test-/marshal/usr/extconf.rb b/ext/-test-/marshal/usr/extconf.rb
new file mode 100644
index 0000000000..c662b23dd5
--- /dev/null
+++ b/ext/-test-/marshal/usr/extconf.rb
@@ -0,0 +1 @@
+create_makefile("-test-/marshal/usr")
diff --git a/ext/-test-/marshal/usr/usrmarshal.c b/ext/-test-/marshal/usr/usrmarshal.c
new file mode 100644
index 0000000000..b30bd52c13
--- /dev/null
+++ b/ext/-test-/marshal/usr/usrmarshal.c
@@ -0,0 +1,35 @@
+#include <ruby.h>
+
+static VALUE
+usr_alloc(VALUE klass)
+{
+ int *p;
+ return Data_Make_Struct(klass, int, 0, RUBY_DEFAULT_FREE, p);
+}
+
+static VALUE
+usr_init(VALUE self, VALUE val)
+{
+ *(int *)DATA_PTR(self) = NUM2INT(val);
+ return self;
+}
+
+static VALUE
+usr_value(VALUE self)
+{
+ int val = *(int *)DATA_PTR(self);
+ return INT2NUM(val);
+}
+
+void
+Init_usr(void)
+{
+ VALUE mMarshal = rb_define_module_under(rb_define_module("Bug"), "Marshal");
+ VALUE newclass = rb_define_class_under(mMarshal, "UsrMarshal", rb_cObject);
+
+ rb_define_alloc_func(newclass, usr_alloc);
+ rb_define_method(newclass, "initialize", usr_init, 1);
+ rb_define_method(newclass, "value", usr_value, 0);
+ rb_define_method(newclass, "marshal_load", usr_init, 1);
+ rb_define_method(newclass, "marshal_dump", usr_value, 0);
+}
diff --git a/ext/-test-/method/arity.c b/ext/-test-/method/arity.c
new file mode 100644
index 0000000000..239b9f7f10
--- /dev/null
+++ b/ext/-test-/method/arity.c
@@ -0,0 +1,22 @@
+#include "ruby.h"
+
+static VALUE
+obj_method_arity(VALUE self, VALUE obj, VALUE mid)
+{
+ int arity = rb_obj_method_arity(obj, rb_check_id(&mid));
+ return INT2FIX(arity);
+}
+
+static VALUE
+mod_method_arity(VALUE self, VALUE mod, VALUE mid)
+{
+ int arity = rb_mod_method_arity(mod, rb_check_id(&mid));
+ return INT2FIX(arity);
+}
+
+void
+Init_arity(VALUE mod)
+{
+ rb_define_module_function(mod, "obj_method_arity", obj_method_arity, 2);
+ rb_define_module_function(mod, "mod_method_arity", mod_method_arity, 2);
+}
diff --git a/ext/-test-/method/extconf.rb b/ext/-test-/method/extconf.rb
new file mode 100644
index 0000000000..658b7af1f1
--- /dev/null
+++ b/ext/-test-/method/extconf.rb
@@ -0,0 +1,6 @@
+$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-/method")
diff --git a/ext/-test-/method/init.c b/ext/-test-/method/init.c
new file mode 100644
index 0000000000..cea2346240
--- /dev/null
+++ b/ext/-test-/method/init.c
@@ -0,0 +1,11 @@
+#include "ruby.h"
+
+#define init(n) {void Init_##n(VALUE klass); Init_##n(klass);}
+
+void
+Init_method(void)
+{
+ VALUE mBug = rb_define_module("Bug");
+ VALUE klass = rb_define_module_under(mBug, "Method");
+ TEST_INIT_FUNCS(init);
+}
diff --git a/ext/-test-/num2int/extconf.rb b/ext/-test-/num2int/extconf.rb
new file mode 100644
index 0000000000..2bc820e480
--- /dev/null
+++ b/ext/-test-/num2int/extconf.rb
@@ -0,0 +1 @@
+create_makefile("-test-/num2int/num2int")
diff --git a/ext/-test-/num2int/num2int.c b/ext/-test-/num2int/num2int.c
new file mode 100644
index 0000000000..3aec3ccf3b
--- /dev/null
+++ b/ext/-test-/num2int/num2int.c
@@ -0,0 +1,136 @@
+#include <ruby.h>
+
+static VALUE
+test_num2short(VALUE obj, VALUE num)
+{
+ char buf[128];
+ sprintf(buf, "%d", NUM2SHORT(num));
+ return rb_str_new_cstr(buf);
+}
+
+static VALUE
+test_num2ushort(VALUE obj, VALUE num)
+{
+ char buf[128];
+ sprintf(buf, "%u", NUM2USHORT(num));
+ return rb_str_new_cstr(buf);
+}
+
+static VALUE
+test_num2int(VALUE obj, VALUE num)
+{
+ char buf[128];
+ sprintf(buf, "%d", NUM2INT(num));
+ return rb_str_new_cstr(buf);
+}
+
+static VALUE
+test_num2uint(VALUE obj, VALUE num)
+{
+ char buf[128];
+ sprintf(buf, "%u", NUM2UINT(num));
+ return rb_str_new_cstr(buf);
+}
+
+static VALUE
+test_num2long(VALUE obj, VALUE num)
+{
+ char buf[128];
+ sprintf(buf, "%ld", NUM2LONG(num));
+ return rb_str_new_cstr(buf);
+}
+
+static VALUE
+test_num2ulong(VALUE obj, VALUE num)
+{
+ char buf[128];
+ sprintf(buf, "%lu", NUM2ULONG(num));
+ return rb_str_new_cstr(buf);
+}
+
+#ifdef HAVE_LONG_LONG
+static VALUE
+test_num2ll(VALUE obj, VALUE num)
+{
+ char buf[128];
+ sprintf(buf, "%"PRI_LL_PREFIX"d", NUM2LL(num));
+ return rb_str_new_cstr(buf);
+}
+
+static VALUE
+test_num2ull(VALUE obj, VALUE num)
+{
+ char buf[128];
+ sprintf(buf, "%"PRI_LL_PREFIX"u", NUM2ULL(num));
+ 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 mNum2int = rb_define_module("Num2int");
+
+ rb_define_module_function(mNum2int, "NUM2SHORT", test_num2short, 1);
+ rb_define_module_function(mNum2int, "NUM2USHORT", test_num2ushort, 1);
+
+ rb_define_module_function(mNum2int, "NUM2INT", test_num2int, 1);
+ rb_define_module_function(mNum2int, "NUM2UINT", test_num2uint, 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_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
index a2bc836e1f..e786dc71d2 100644
--- a/ext/-test-/old_thread_select/depend
+++ b/ext/-test-/old_thread_select/depend
@@ -1,2 +1,4 @@
-old_thread_select.o: $(top_srcdir)/thread.c \
- $(hdrdir)/ruby/ruby.h $(hdrdir)/ruby/io.h
+$(OBJS): $(HDRS) $(ruby_headers) \
+ $(hdrdir)/ruby/io.h \
+ $(hdrdir)/ruby/encoding.h \
+ $(hdrdir)/ruby/oniguruma.h
diff --git a/ext/-test-/old_thread_select/extconf.rb b/ext/-test-/old_thread_select/extconf.rb
index 8b410218fa..730d9ec901 100644
--- a/ext/-test-/old_thread_select/extconf.rb
+++ b/ext/-test-/old_thread_select/extconf.rb
@@ -1 +1,4 @@
+$warnflags = "-Wno-deprecated-declarations"
+$warnflags = "" unless try_compile("", $warnflags)
+
create_makefile("-test-/old_thread_select/old_thread_select")
diff --git a/ext/-test-/path_to_class/extconf.rb b/ext/-test-/path_to_class/extconf.rb
new file mode 100644
index 0000000000..e1072b1443
--- /dev/null
+++ b/ext/-test-/path_to_class/extconf.rb
@@ -0,0 +1,6 @@
+$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-/path_to_class/path_to_class")
diff --git a/ext/-test-/path_to_class/path_to_class.c b/ext/-test-/path_to_class/path_to_class.c
new file mode 100644
index 0000000000..c8c2831b09
--- /dev/null
+++ b/ext/-test-/path_to_class/path_to_class.c
@@ -0,0 +1,15 @@
+#include "ruby.h"
+
+static VALUE
+path_to_class(VALUE klass, VALUE path)
+{
+ return rb_path_to_class(path);
+}
+
+void
+Init_path_to_class(void)
+{
+ VALUE klass = rb_path2class("Test_PathToClass");
+
+ rb_define_singleton_method(klass, "path_to_class", path_to_class, 1);
+}
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/extconf.rb b/ext/-test-/printf/extconf.rb
new file mode 100644
index 0000000000..7b96da0c85
--- /dev/null
+++ b/ext/-test-/printf/extconf.rb
@@ -0,0 +1 @@
+create_makefile("-test-/printf")
diff --git a/ext/-test-/printf/printf.c b/ext/-test-/printf/printf.c
new file mode 100644
index 0000000000..fd60b0f593
--- /dev/null
+++ b/ext/-test-/printf/printf.c
@@ -0,0 +1,100 @@
+#include <ruby.h>
+#include <ruby/encoding.h>
+
+static VALUE
+printf_test_i(VALUE self, VALUE obj)
+{
+ char buf[256];
+ snprintf(buf, sizeof(buf), "<%"PRIsVALUE">", obj);
+ return rb_usascii_str_new2(buf);
+}
+
+static VALUE
+printf_test_s(VALUE self, VALUE obj)
+{
+ return rb_enc_sprintf(rb_usascii_encoding(), "<%"PRIsVALUE">", obj);
+}
+
+static VALUE
+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;
+ char format[sizeof(int) * 6 + 8], *p = format, cnv;
+ int n;
+
+ rb_scan_args(argc, argv, "2:", &type, &num, &opt);
+ Check_Type(type, T_STRING);
+ if (RSTRING_LEN(type) != 1) rb_raise(rb_eArgError, "wrong length(%ld)", RSTRING_LEN(type));
+ switch (cnv = RSTRING_PTR(type)[0]) {
+ case 'd': case 'x': case 'o': case 'X': break;
+ default: rb_raise(rb_eArgError, "wrong conversion(%c)", cnv);
+ }
+ n = NUM2INT(num);
+ *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';
+ return rb_assoc_new(rb_enc_sprintf(rb_usascii_encoding(), format, n),
+ rb_usascii_str_new_cstr(format));
+}
+
+void
+Init_printf(void)
+{
+ VALUE m = rb_define_module_under(rb_define_module("Bug"), "Printf");
+ rb_define_singleton_method(m, "i", printf_test_i, 1);
+ rb_define_singleton_method(m, "s", printf_test_s, 1);
+ rb_define_singleton_method(m, "v", printf_test_v, 1);
+ rb_define_singleton_method(m, "q", printf_test_q, 1);
+ 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-/st/numhash/numhash.c b/ext/-test-/st/numhash/numhash.c
index e186cd43d9..d4dbd1a0ce 100644
--- a/ext/-test-/st/numhash/numhash.c
+++ b/ext/-test-/st/numhash/numhash.c
@@ -42,10 +42,9 @@ numhash_aset(VALUE self, VALUE key, VALUE data)
}
static int
-numhash_i(st_data_t key, st_data_t value, st_data_t arg, int error)
+numhash_i(st_data_t key, st_data_t value, st_data_t arg)
{
VALUE ret;
- if (key == 0 && value == 0 && error == 1) rb_raise(rb_eRuntimeError, "numhash modified");
ret = rb_yield_values(3, (VALUE)key, (VALUE)value, (VALUE)arg);
if (ret == Qtrue) return ST_CHECK;
return ST_CONTINUE;
@@ -54,7 +53,55 @@ numhash_i(st_data_t key, st_data_t value, st_data_t arg, int error)
static VALUE
numhash_each(VALUE self)
{
- return st_foreach((st_table *)DATA_PTR(self), numhash_i, self) ? Qtrue : Qfalse;
+ st_table *table = DATA_PTR(self);
+ st_data_t data = (st_data_t)self;
+ return st_foreach_check(table, numhash_i, data, data) ? Qtrue : Qfalse;
+}
+
+static int
+update_func(st_data_t *key, st_data_t *value, st_data_t arg, int existing)
+{
+ VALUE ret = rb_yield_values(existing ? 2 : 1, (VALUE)*key, (VALUE)*value);
+ switch (ret) {
+ case Qfalse:
+ return ST_STOP;
+ case Qnil:
+ return ST_DELETE;
+ default:
+ *value = ret;
+ return ST_CONTINUE;
+ }
+}
+
+static VALUE
+numhash_update(VALUE self, VALUE key)
+{
+ if (st_update((st_table *)DATA_PTR(self), (st_data_t)key, update_func, 0))
+ return Qtrue;
+ else
+ return Qfalse;
+}
+
+#if SIZEOF_LONG == SIZEOF_VOIDP
+# define ST2NUM(x) ULONG2NUM(x)
+#elif SIZEOF_LONG_LONG == SIZEOF_VOIDP
+# define ST2NUM(x) ULL2NUM(x)
+#endif
+
+static VALUE
+numhash_size(VALUE self)
+{
+ return ST2NUM(((st_table *)DATA_PTR(self))->num_entries);
+}
+
+static VALUE
+numhash_delete_safe(VALUE self, VALUE key)
+{
+ st_data_t val, k = (st_data_t)key;
+ if (st_delete_safe((st_table *)DATA_PTR(self), &k, &val, (st_data_t)self)) {
+ return val;
+ }
+ return Qnil;
}
void
@@ -66,4 +113,8 @@ Init_numhash(void)
rb_define_method(st, "[]", numhash_aref, 1);
rb_define_method(st, "[]=", numhash_aset, 2);
rb_define_method(st, "each", numhash_each, 0);
+ rb_define_method(st, "update", numhash_update, 1);
+ rb_define_method(st, "size", numhash_size, 0);
+ rb_define_method(st, "delete_safe", numhash_delete_safe, 1);
}
+
diff --git a/ext/-test-/st/update/extconf.rb b/ext/-test-/st/update/extconf.rb
new file mode 100644
index 0000000000..96dbae43ab
--- /dev/null
+++ b/ext/-test-/st/update/extconf.rb
@@ -0,0 +1 @@
+create_makefile("-test-/st/update")
diff --git a/ext/-test-/st/update/update.c b/ext/-test-/st/update/update.c
new file mode 100644
index 0000000000..979ad3e334
--- /dev/null
+++ b/ext/-test-/st/update/update.c
@@ -0,0 +1,34 @@
+#include <ruby.h>
+#include <ruby/st.h>
+
+static int
+update_func(st_data_t *key, st_data_t *value, st_data_t arg, int existing)
+{
+ VALUE ret = rb_yield_values(existing ? 2 : 1, (VALUE)*key, (VALUE)*value);
+ switch (ret) {
+ case Qfalse:
+ return ST_STOP;
+ case Qnil:
+ return ST_DELETE;
+ default:
+ *value = ret;
+ return ST_CONTINUE;
+ }
+}
+
+static VALUE
+test_st_update(VALUE self, VALUE key)
+{
+ if (st_update(RHASH_TBL(self), (st_data_t)key, update_func, 0))
+ return Qtrue;
+ else
+ return Qfalse;
+}
+
+void
+Init_update(void)
+{
+ VALUE st = rb_define_class_under(rb_define_module("Bug"), "StTable", rb_cHash);
+ rb_define_method(st, "st_update", test_st_update, 1);
+}
+
diff --git a/ext/-test-/string/coderange.c b/ext/-test-/string/coderange.c
new file mode 100644
index 0000000000..2f1e6a06a8
--- /dev/null
+++ b/ext/-test-/string/coderange.c
@@ -0,0 +1,30 @@
+#include "ruby/ruby.h"
+#include "ruby/encoding.h"
+
+static VALUE sym_7bit, sym_valid, sym_unknown, sym_broken;
+static VALUE
+str_coderange(VALUE str)
+{
+ switch (ENC_CODERANGE(str)) {
+ case ENC_CODERANGE_7BIT:
+ return sym_7bit;
+ case ENC_CODERANGE_VALID:
+ return sym_valid;
+ case ENC_CODERANGE_UNKNOWN:
+ return sym_unknown;
+ case ENC_CODERANGE_BROKEN:
+ return sym_broken;
+ }
+ rb_bug("wrong condition of coderange");
+ UNREACHABLE;
+}
+
+void
+Init_coderange(VALUE klass)
+{
+ sym_7bit = ID2SYM(rb_intern("7bit"));
+ sym_valid = ID2SYM(rb_intern("valid"));
+ sym_unknown = ID2SYM(rb_intern("unknown"));
+ sym_broken = ID2SYM(rb_intern("broken"));
+ rb_define_method(klass, "coderange", str_coderange, 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/enc_str_buf_cat.c b/ext/-test-/string/enc_str_buf_cat.c
new file mode 100644
index 0000000000..5d583c65dc
--- /dev/null
+++ b/ext/-test-/string/enc_str_buf_cat.c
@@ -0,0 +1,14 @@
+#include "ruby/ruby.h"
+#include "ruby/encoding.h"
+
+static VALUE
+enc_str_buf_cat(VALUE str, VALUE str2)
+{
+ return rb_enc_str_buf_cat(str, RSTRING_PTR(str2), RSTRING_LEN(str2), rb_enc_get(str2));
+}
+
+void
+Init_enc_str_buf_cat(VALUE klass)
+{
+ rb_define_method(klass, "enc_str_buf_cat", enc_str_buf_cat, 1);
+}
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-/string/qsort.c b/ext/-test-/string/qsort.c
new file mode 100644
index 0000000000..0b34936d38
--- /dev/null
+++ b/ext/-test-/string/qsort.c
@@ -0,0 +1,61 @@
+#include "ruby.h"
+#include "ruby/util.h"
+#include "ruby/encoding.h"
+
+struct sort_data {
+ rb_encoding *enc;
+ long elsize;
+};
+
+static int
+cmp_1(const void *ap, const void *bp, void *dummy)
+{
+ struct sort_data *d = dummy;
+ VALUE a = rb_enc_str_new(ap, d->elsize, d->enc);
+ VALUE b = rb_enc_str_new(bp, d->elsize, d->enc);
+ VALUE retval = rb_yield_values(2, a, b);
+ return rb_cmpint(retval, a, b);
+}
+
+static int
+cmp_2(const void *ap, const void *bp, void *dummy)
+{
+ int a = *(const unsigned char *)ap;
+ int b = *(const unsigned char *)bp;
+ return a - b;
+}
+
+static VALUE
+bug_str_qsort_bang(int argc, VALUE *argv, VALUE str)
+{
+ VALUE beg, len, size;
+ long l, b = 0, n, s = 1;
+ struct sort_data d;
+
+ rb_scan_args(argc, argv, "03", &beg, &len, &size);
+ l = RSTRING_LEN(str);
+ if (!NIL_P(beg) && (b = NUM2INT(beg)) < 0 && (b += l) < 0) {
+ rb_raise(rb_eArgError, "out of bounds");
+ }
+ if (!NIL_P(size) && (s = NUM2INT(size)) < 0) {
+ rb_raise(rb_eArgError, "negative size");
+ }
+ if (NIL_P(len) ||
+ (((n = NUM2INT(len)) < 0) ?
+ (rb_raise(rb_eArgError, "negative length"), 0) :
+ (b + n * s > l))) {
+ n = (l - b) / s;
+ }
+ rb_str_modify(str);
+ d.enc = rb_enc_get(str);
+ d.elsize = s;
+ ruby_qsort(RSTRING_PTR(str) + b, n, s,
+ rb_block_given_p() ? cmp_1 : cmp_2, &d);
+ return str;
+}
+
+void
+Init_qsort(VALUE klass)
+{
+ rb_define_method(klass, "qsort!", bug_str_qsort_bang, -1);
+}
diff --git a/ext/-test-/symbol/extconf.rb b/ext/-test-/symbol/extconf.rb
new file mode 100644
index 0000000000..0b7c3876fa
--- /dev/null
+++ b/ext/-test-/symbol/extconf.rb
@@ -0,0 +1,6 @@
+$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-/symbol")
diff --git a/ext/-test-/symbol/init.c b/ext/-test-/symbol/init.c
new file mode 100644
index 0000000000..e740345f2a
--- /dev/null
+++ b/ext/-test-/symbol/init.c
@@ -0,0 +1,11 @@
+#include "ruby.h"
+
+#define init(n) {void Init_##n(VALUE klass); Init_##n(klass);}
+
+void
+Init_symbol(void)
+{
+ VALUE mBug = rb_define_module("Bug");
+ VALUE klass = rb_define_class_under(mBug, "Symbol", rb_cSymbol);
+ TEST_INIT_FUNCS(init);
+}
diff --git a/ext/-test-/symbol/intern.c b/ext/-test-/symbol/intern.c
new file mode 100644
index 0000000000..6ae86a6104
--- /dev/null
+++ b/ext/-test-/symbol/intern.c
@@ -0,0 +1,14 @@
+#include "ruby.h"
+
+static VALUE
+bug_sym_interned_p(VALUE self, VALUE name)
+{
+ ID id = rb_check_id(&name);
+ return id ? Qtrue : Qfalse;
+}
+
+void
+Init_intern(VALUE klass)
+{
+ rb_define_singleton_method(klass, "interned?", bug_sym_interned_p, 1);
+}
diff --git a/ext/-test-/symbol/type.c b/ext/-test-/symbol/type.c
new file mode 100644
index 0000000000..e0b2fff2f9
--- /dev/null
+++ b/ext/-test-/symbol/type.c
@@ -0,0 +1,43 @@
+#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);
+}
+
+void
+Init_type(VALUE klass)
+{
+ FOREACH_ID_TYPES(declare_symbol_type_p);
+ rb_define_singleton_method(klass, "attrset", bug_sym_attrset, 1);
+}
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/tracepoint.c b/ext/-test-/tracepoint/tracepoint.c
new file mode 100644
index 0000000000..a974c2c611
--- /dev/null
+++ b/ext/-test-/tracepoint/tracepoint.c
@@ -0,0 +1,77 @@
+#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_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:
+ {
+ track->gc_end_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,
+ tracepoint_track_objspace_events_i, &track);
+ VALUE result = rb_ary_new();
+
+ rb_tracepoint_enable(tpval);
+ rb_yield(Qundef);
+ rb_tracepoint_disable(tpval);
+
+ rb_ary_push(result, SIZET2NUM(track.newobj_count));
+ rb_ary_push(result, SIZET2NUM(track.free_count));
+ rb_ary_push(result, SIZET2NUM(track.gc_start_count));
+ rb_ary_push(result, SIZET2NUM(track.gc_end_count));
+ rb_ary_cat(result, track.objects, track.objects_count);
+
+ return result;
+}
+
+void
+Init_tracepoint(void)
+{
+ VALUE mBug = rb_define_module("Bug");
+ rb_define_module_function(mBug, "tracepoint_track_objspace_events", tracepoint_track_objspace_events, 0);
+}
diff --git a/ext/-test-/typeddata/extconf.rb b/ext/-test-/typeddata/extconf.rb
new file mode 100644
index 0000000000..02e3e41c8b
--- /dev/null
+++ b/ext/-test-/typeddata/extconf.rb
@@ -0,0 +1 @@
+create_makefile("-test-/typeddata/typeddata")
diff --git a/ext/-test-/typeddata/typeddata.c b/ext/-test-/typeddata/typeddata.c
new file mode 100644
index 0000000000..1c5d677713
--- /dev/null
+++ b/ext/-test-/typeddata/typeddata.c
@@ -0,0 +1,20 @@
+#include <ruby.h>
+
+static const rb_data_type_t test_data = {
+ "typed_data",
+};
+
+static VALUE
+test_check(VALUE self, VALUE obj)
+{
+ rb_check_typeddata(obj, &test_data);
+ return obj;
+}
+
+void
+Init_typeddata(void)
+{
+ VALUE mBug = rb_define_module("Bug");
+ VALUE klass = rb_define_class_under(mBug, "TypedData", rb_cData);
+ rb_define_singleton_method(klass, "check", test_check, 1);
+}
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/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/.document b/ext/.document
index c51b8a7b63..4a8e06e498 100644
--- a/ext/.document
+++ b/ext/.document
@@ -2,6 +2,7 @@
bigdecimal/bigdecimal.c
bigdecimal/lib
+continuation/continuation.c
coverage/coverage.c
curses/curses.c
date/date_core.c
@@ -21,13 +22,16 @@ dl/lib
dl/win32/lib
etc/etc.c
fcntl/fcntl.c
+fiber/fiber.c
fiddle/closure.c
fiddle/conversions.c
fiddle/fiddle.c
fiddle/function.c
+fiddle/pointer.c
+fiddle/handle.c
fiddle/lib
+fiddle/win32/lib
gdbm/gdbm.c
-iconv/iconv.c
io/console/console.c
io/nonblock/nonblock.c
io/wait/lib
@@ -35,12 +39,16 @@ io/wait/wait.c
json/ext/generator/generator.c
json/ext/parser/parser.c
json/lib
+mathn/complex/complex.c
+mathn/rational/rational.c
nkf/lib
nkf/nkf.c
objspace/objspace.c
+objspace/object_tracing.c
openssl/lib
openssl/ossl.c
openssl/ossl_asn1.c
+openssl/ossl_bio.c
openssl/ossl_bn.c
openssl/ossl_cipher.c
openssl/ossl_config.c
@@ -79,7 +87,9 @@ psych/to_ruby.c
psych/yaml_tree.c
pty/lib
pty/pty.c
+racc/cparse/cparse.c
readline/readline.c
+refinement/refinement.c
ripper/lib
ripper/ripper.c
sdbm/init.c
diff --git a/ext/Setup b/ext/Setup
index b0f29b9f7b..6870035e45 100644
--- a/ext/Setup
+++ b/ext/Setup
@@ -13,7 +13,6 @@
#etc
#fcntl
#gdbm
-#iconv
#io/wait
#nkf
#openssl
@@ -25,7 +24,6 @@
#socket
#stringio
#strscan
-#syck
#syslog
#tk
#win32ole
diff --git a/ext/Setup.atheos b/ext/Setup.atheos
index 6e0b8ae5a6..c4028ef1f2 100644
--- a/ext/Setup.atheos
+++ b/ext/Setup.atheos
@@ -14,7 +14,6 @@ enumerator
etc
fcntl
gdbm
-iconv
io/wait
nkf
#openssl
@@ -26,7 +25,6 @@ sdbm
socket
stringio
strscan
-syck
syslog
#tk
#win32ole
diff --git a/ext/Setup.emx b/ext/Setup.emx
index fade917e92..bd46a55ecb 100644
--- a/ext/Setup.emx
+++ b/ext/Setup.emx
@@ -1,3 +1,5 @@
+# OS/2 environment w/ Autoconf 2.1x for EMX
+option platform os2-emx
option nodynamic
#Win32API
@@ -14,7 +16,6 @@ enumerator
etc
fcntl
#gdbm
-#iconv
#io/wait
nkf
#openssl
@@ -26,7 +27,6 @@ racc/cparse
socket
stringio
strscan
-#syck
#syslog
#tk
#win32ole
diff --git a/ext/Setup.nacl b/ext/Setup.nacl
new file mode 100644
index 0000000000..3e7f469f92
--- /dev/null
+++ b/ext/Setup.nacl
@@ -0,0 +1,49 @@
+# #option nodynamic
+#
+# #Win32API
+# bigdecimal
+# continuation
+# coverage
+# #curses
+# date
+# #dbm
+# digest/bubblebabble
+# digest
+# digest/md5
+# digest/rmd160
+# digest/sha1
+# digest/sha2
+# dl
+# dl/callback
+# #dl/win32
+# etc
+# fcntl
+# fiber
+# #fiddle
+# #gdbm
+# #iconv
+# io/console
+# io/nonblock
+# io/wait
+# #json
+# json/generator
+# json/parser
+# mathn/complex
+# mathn/rational
+# nkf
+# objspace
+# #openssl
+# pathname
+# #psych
+# #pty
+# racc/cparse
+# #readline
+# ripper
+# #sdbm
+# #socket
+# stringio
+# strscan
+# #syslog
+# #tk
+# #tk/tkutil
+# #zlib
diff --git a/ext/Setup.nt b/ext/Setup.nt
index c8574ba70a..fe3feaad18 100644
--- a/ext/Setup.nt
+++ b/ext/Setup.nt
@@ -1,3 +1,4 @@
+#option platform cygwin|mingw|mswin
#option nodynamic
Win32API
@@ -14,7 +15,6 @@ enumerator
etc
fcntl
#gdbm
-#iconv
#io/wait
nkf
#openssl
@@ -26,7 +26,6 @@ sdbm
socket
stringio
strscan
-syck
#syslog
#tk
win32ole
diff --git a/ext/bigdecimal/README b/ext/bigdecimal/README
index ae65b014cf..7a4362826c 100644
--- a/ext/bigdecimal/README
+++ b/ext/bigdecimal/README
@@ -51,10 +51,10 @@ You can redistribute it and/or modify it under either the terms of the GPL
* The Author
-Feel free to send comments and bug reports to the author. Here is the
-author's latest mail address:
+Feel free to send comments and bug reports to the ruby-core team.
- shigeo@tinyforest.gr.jp
+ http://bugs.ruby-lang.org
-------------------------------------------------------
created at: Thu Dec 22 1999
+updated at: Wed Sep 28 2011
diff --git a/ext/bigdecimal/bigdecimal.c b/ext/bigdecimal/bigdecimal.c
index 14f80b1929..f630c0a167 100644
--- a/ext/bigdecimal/bigdecimal.c
+++ b/ext/bigdecimal/bigdecimal.c
@@ -38,6 +38,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;
@@ -60,7 +70,7 @@ static ID id_to_r;
static ID id_eq;
/* MACRO's to guard objects from GC by keeping them in stack */
-#define ENTER(n) volatile VALUE vStack[n];int iStack=0
+#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);}
@@ -76,23 +86,9 @@ static ID id_eq;
#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))))
+# define RBIGNUM_ZERO_P(x) rb_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)
@@ -109,9 +105,6 @@ bigzero_p(VALUE x)
/*
* Returns the BigDecimal version number.
- *
- * Ruby 1.8.0 returns 1.0.0.
- * Ruby 1.8.1 thru 1.8.3 return 1.0.1.
*/
static VALUE
BigDecimal_version(VALUE self)
@@ -131,7 +124,7 @@ static unsigned short VpGetException(void);
static void VpSetException(unsigned short f);
static void VpInternalRound(Real *c, size_t ixDigit, BDIGIT vPrev, BDIGIT v);
static int VpLimitRound(Real *c, size_t ixDigit);
-static Real *VpDup(Real const* const x);
+static Real *VpCopy(Real *pv, Real const* const x);
/*
* **** BigDecimal part ****
@@ -152,7 +145,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
@@ -164,12 +160,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;
}
@@ -182,14 +180,13 @@ cannot_be_coerced_into_BigDecimal(VALUE exc_class, VALUE v)
VALUE str;
if (rb_special_const_p(v)) {
- str = rb_str_cat2(rb_str_dup(rb_inspect(v)),
- " can't be coerced into BigDecimal");
+ str = rb_inspect(v);
}
else {
- str = rb_str_cat2(rb_str_dup(rb_class_name(rb_obj_class(v))),
- " can't be coerced into BigDecimal");
+ str = rb_class_name(rb_obj_class(v));
}
+ str = rb_str_cat2(rb_str_dup(str), " can't be coerced into BigDecimal");
rb_exc_raise(rb_exc_new3(exc_class, str));
}
@@ -204,11 +201,10 @@ GetVpValueWithPrec(VALUE v, long prec, int must)
VALUE orig = Qundef;
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;
+ if (prec > DBL_DIG+1) goto SomeOneMayDoIt;
v = rb_funcall(v, id_to_r, 0);
goto again;
case T_RATIONAL:
@@ -307,12 +303,20 @@ 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;
}
+/*
+ * call-seq: hash
+ *
+ * Creates a hash for this BigDecimal.
+ *
+ * Two BigDecimals with equal sign,
+ * fractional part and exponent have the same hash.
+ */
static VALUE
BigDecimal_hash(VALUE self)
{
@@ -320,7 +324,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) {
@@ -330,6 +334,18 @@ BigDecimal_hash(VALUE self)
return INT2FIX(hash);
}
+/*
+ * call-seq: _dump
+ *
+ * Method used to provide marshalling support.
+ *
+ * inf = BigDecimal.new('Infinity')
+ * => #<BigDecimal:1e16fa8,'Infinity',9(9)>
+ * BigDecimal._load(inf._dump)
+ * => #<BigDecimal:1df8dc8,'Infinity',9(9)>
+ *
+ * See the Marshal module.
+ */
static VALUE
BigDecimal_dump(int argc, VALUE *argv, VALUE self)
{
@@ -340,8 +356,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);
@@ -364,16 +380,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);
}
@@ -434,10 +452,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:
@@ -458,40 +476,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 */
@@ -513,16 +530,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;
}
@@ -534,7 +551,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;
}
@@ -555,14 +572,15 @@ VpCreateRbObject(size_t mx, const char *str)
return pv;
}
+#define VpAllocReal(prec) (Real *)VpMemAlloc(offsetof(Real, frac) + (prec) * sizeof(BDIGIT))
+#define VpReallocReal(ptr, prec) (Real *)VpMemRealloc((ptr), offsetof(Real, frac) + (prec) * sizeof(BDIGIT))
+
static Real *
-VpDup(Real const* const x)
+VpCopy(Real *pv, Real const* const x)
{
- Real *pv;
-
assert(x != NULL);
- pv = VpMemAlloc(sizeof(Real) + x->MaxPrec * sizeof(BDIGIT));
+ pv = VpReallocReal(pv, x->MaxPrec);
pv->MaxPrec = x->MaxPrec;
pv->Prec = x->Prec;
pv->exponent = x->exponent;
@@ -570,9 +588,6 @@ VpDup(Real const* const x)
pv->flag = x->flag;
MEMCPY(pv->frac, x->frac, BDIGIT, pv->MaxPrec);
- pv->obj = TypedData_Wrap_Struct(
- rb_obj_class(x->obj), &BigDecimal_data_type, pv);
-
return pv;
}
@@ -580,20 +595,20 @@ VpDup(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;
}
@@ -601,21 +616,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);
}
}
@@ -632,14 +649,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);
@@ -656,12 +673,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;
}
}
@@ -688,25 +707,27 @@ 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;
d = strtod(buf, 0);
- if (errno == ERANGE)
- goto overflow;
+ if (errno == ERANGE) {
+ if (d == 0.0) goto underflow;
+ if (fabs(d) >= HUGE_VAL) goto overflow;
+ }
return rb_float_new(d);
overflow:
VpException(VP_EXCEPTION_OVERFLOW, "BigDecimal to Float conversion", 0);
- if (d > 0.0)
+ if (p->sign >= 0)
return rb_float_new(VpGetDoublePosInf());
else
return rb_float_new(VpGetDoubleNegInf());
underflow:
VpException(VP_EXCEPTION_UNDERFLOW, "BigDecimal to Float conversion", 0);
- if (d > 0.0)
+ if (p->sign >= 0)
return rb_float_new(0.0);
else
return rb_float_new(-0.0);
@@ -722,7 +743,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);
@@ -741,7 +762,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,13 +806,25 @@ BigDecimal_coerce(VALUE self, VALUE other)
return obj;
}
+/*
+ * call-seq: +@
+ *
+ * Return self.
+ *
+ * e.g.
+ * b = +a # b == a
+ */
static VALUE
BigDecimal_uplus(VALUE self)
{
return self;
}
- /* call-seq:
+ /*
+ * Document-method: BigDecimal#add
+ * Document-method: BigDecimal#+
+ *
+ * call-seq:
* add(value, digits)
*
* Add the specified value.
@@ -800,7 +833,9 @@ BigDecimal_uplus(VALUE self)
* c = a.add(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.
+ * 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_add(VALUE self, VALUE r)
@@ -817,7 +852,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,'+');
@@ -844,15 +879,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)
@@ -861,7 +902,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);
}
@@ -872,23 +913,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);
}
@@ -899,7 +942,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;
@@ -907,7 +950,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:
@@ -959,23 +1002,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:
@@ -983,13 +1026,15 @@ BigDecimalCmp(VALUE self, VALUE r,char op)
}
rb_bug("Undefined operation in BigDecimalCmp()");
+
+ UNREACHABLE;
}
/* Returns True if the value is zero. */
static VALUE
BigDecimal_zero(VALUE self)
{
- Real *a = GetVpValue(self,1);
+ Real *a = GetVpValue(self, 1);
return VpIsZero(a) ? Qtrue : Qfalse;
}
@@ -997,7 +1042,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;
}
@@ -1029,8 +1074,9 @@ BigDecimal_eq(VALUE self, VALUE r)
/* call-seq:
* a < b
*
- * Returns true if a is less than b. Values may be coerced to perform the
- * comparison (see ==, coerce).
+ * Returns true if a is less than b.
+ *
+ * Values may be coerced to perform the comparison (see ==, BigDecimal#coerce).
*/
static VALUE
BigDecimal_lt(VALUE self, VALUE r)
@@ -1041,8 +1087,9 @@ BigDecimal_lt(VALUE self, VALUE r)
/* call-seq:
* a <= b
*
- * Returns true if a is less than or equal to b. Values may be coerced to
- * perform the comparison (see ==, coerce).
+ * Returns true if a is less than or equal to b.
+ *
+ * Values may be coerced to perform the comparison (see ==, BigDecimal#coerce).
*/
static VALUE
BigDecimal_le(VALUE self, VALUE r)
@@ -1053,8 +1100,9 @@ BigDecimal_le(VALUE self, VALUE r)
/* call-seq:
* a > b
*
- * Returns true if a is greater than b. Values may be coerced to
- * perform the comparison (see ==, coerce).
+ * Returns true if a is greater than b.
+ *
+ * Values may be coerced to perform the comparison (see ==, BigDecimal#coerce).
*/
static VALUE
BigDecimal_gt(VALUE self, VALUE r)
@@ -1065,8 +1113,9 @@ BigDecimal_gt(VALUE self, VALUE r)
/* call-seq:
* a >= b
*
- * Returns true if a is greater than or equal to b. Values may be coerced to
- * perform the comparison (see ==, coerce)
+ * Returns true if a is greater than or equal to b.
+ *
+ * Values may be coerced to perform the comparison (see ==, BigDecimal#coerce)
*/
static VALUE
BigDecimal_ge(VALUE self, VALUE r)
@@ -1074,19 +1123,30 @@ BigDecimal_ge(VALUE self, VALUE r)
return BigDecimalCmp(self, r, 'G');
}
+/*
+ * call-seq: -@
+ *
+ * Return the negation of self.
+ *
+ * e.g.
+ * b = -a
+ * b == a * -1
+ */
static VALUE
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);
}
- /* call-seq:
- * mult(value, digits)
+ /*
+ * Document-method: BigDecimal#mult
+ *
+ * call-seq: mult(value, digits)
*
* Multiply by the specified value.
*
@@ -1094,7 +1154,9 @@ BigDecimal_neg(VALUE self)
* c = a.mult(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.
+ * 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_mult(VALUE self, VALUE r)
@@ -1103,7 +1165,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);
}
@@ -1114,11 +1176,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);
}
@@ -1131,28 +1193,28 @@ 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);
+ 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"));
+ 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:
@@ -1164,13 +1226,15 @@ BigDecimal_divide(Real **c, Real **res, Real **div, VALUE self, VALUE r)
* e.g.
* c = a.div(b,n)
*
- * digits:: If specified and less than the number of significant digits of the result, the result is rounded to that number of digits, according to BigDecimal.mode.
+ * 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.
*
* If digits is 0, the result is the same as the / operator. If not, the
* result is an integer BigDecimal, by analogy with Float#div.
*
- * The alias quo is provided since div(value, 0) is the same as computing
- * the quotient; see divmod.
+ * The alias quo is provided since <code>div(value, 0)</code> is the same as
+ * computing the quotient; see BigDecimal#divmod.
*/
static VALUE
BigDecimal_div(VALUE self, VALUE r)
@@ -1179,15 +1243,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);
}
@@ -1204,7 +1268,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);
}
@@ -1212,65 +1276,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;
@@ -1280,19 +1344,21 @@ NaN:
* a % b
* a.modulo(b)
*
- * Returns the modulus from dividing by b. See divmod.
+ * Returns the modulus from dividing by b.
+ *
+ * See BigDecimal#divmod.
*/
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
@@ -1300,10 +1366,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);
}
@@ -1311,34 +1377,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.
@@ -1349,9 +1415,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);
}
@@ -1378,48 +1444,51 @@ 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));
}
return DoSomeOne(self,r,rb_intern("divmod"));
}
+/*
+ * See BigDecimal#quo
+ */
static VALUE
BigDecimal_div2(int argc, VALUE *argv, VALUE self)
{
ENTER(5);
VALUE b,n;
- int na = rb_scan_args(argc,argv,"11",&b,&n);
- if(na==1) { /* div in Float sense */
- Real *div=NULL;
- Real *mod;
- if(BigDecimal_DoDivmod(self,b,&div,&mod)) {
- return BigDecimal_to_i(ToValue(div));
- }
- return DoSomeOne(self,b,rb_intern("div"));
+ 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 = 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);
+ }
}
}
@@ -1427,19 +1496,32 @@ 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)
{
@@ -1448,15 +1530,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)
{
@@ -1465,12 +1548,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);
}
}
@@ -1487,9 +1570,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);
@@ -1500,7 +1583,7 @@ BigDecimal_abs(VALUE self)
*
* Returns the square root of the value.
*
- * If n is specified, returns at least that many significant digits.
+ * Result has at least n significant digits.
*/
static VALUE
BigDecimal_sqrt(VALUE self, VALUE nFig)
@@ -1509,12 +1592,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);
}
@@ -1528,10 +1611,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);
}
@@ -1540,9 +1623,8 @@ BigDecimal_fix(VALUE self)
*
* Round to the nearest 1 (by default), returning the result as a BigDecimal.
*
- * BigDecimal('3.14159').round -> 3
- *
- * BigDecimal('8.7').round -> 9
+ * BigDecimal('3.14159').round #=> 3
+ * BigDecimal('8.7').round #=> 9
*
* If n is specified and positive, the fractional part of the result has no
* more than that many digits.
@@ -1550,9 +1632,8 @@ BigDecimal_fix(VALUE self)
* If n is specified and negative, at least that many digits to the left of the
* decimal point will be 0 in the result.
*
- * BigDecimal('3.14159').round(3) -> 3.142
- *
- * BigDecimal('13345.234').round(-2) -> 13300.0
+ * BigDecimal('3.14159').round(3) #=> 3.142
+ * BigDecimal('13345.234').round(-2) #=> 13300.0
*
* The value of the optional mode argument can be used to determine how
* rounding is performed; see BigDecimal.mode.
@@ -1570,26 +1651,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));
}
@@ -1601,9 +1684,8 @@ BigDecimal_round(int argc, VALUE *argv, VALUE self)
*
* Truncate to the nearest 1, returning the result as a BigDecimal.
*
- * BigDecimal('3.14159').truncate -> 3
- *
- * BigDecimal('8.7').truncate -> 8
+ * BigDecimal('3.14159').truncate #=> 3
+ * BigDecimal('8.7').truncate #=> 8
*
* If n is specified and positive, the fractional part of the result has no
* more than that many digits.
@@ -1611,9 +1693,8 @@ BigDecimal_round(int argc, VALUE *argv, VALUE self)
* If n is specified and negative, at least that many digits to the left of the
* decimal point will be 0 in the result.
*
- * BigDecimal('3.14159').truncate(3) -> 3.141
- *
- * BigDecimal('13345.234').truncate(-2) -> 13300.0
+ * BigDecimal('3.14159').truncate(3) #=> 3.141
+ * BigDecimal('13345.234').truncate(-2) #=> 13300.0
*/
static VALUE
BigDecimal_truncate(int argc, VALUE *argv, VALUE self)
@@ -1624,18 +1705,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));
}
@@ -1651,9 +1733,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);
}
@@ -1663,9 +1745,8 @@ BigDecimal_frac(VALUE self)
*
* Return the largest integer less than or equal to the value, as a BigDecimal.
*
- * BigDecimal('3.14159').floor -> 3
- *
- * BigDecimal('-9.1').floor -> -10
+ * BigDecimal('3.14159').floor #=> 3
+ * BigDecimal('-9.1').floor #=> -10
*
* If n is specified and positive, the fractional part of the result has no
* more than that many digits.
@@ -1673,9 +1754,8 @@ BigDecimal_frac(VALUE self)
* If n is specified and negative, at least that
* many digits to the left of the decimal point will be 0 in the result.
*
- * BigDecimal('3.14159').floor(3) -> 3.141
- *
- * BigDecimal('13345.234').floor(-2) -> 13300.0
+ * BigDecimal('3.14159').floor(3) #=> 3.141
+ * BigDecimal('13345.234').floor(-2) #=> 13300.0
*/
static VALUE
BigDecimal_floor(int argc, VALUE *argv, VALUE self)
@@ -1686,18 +1766,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
@@ -1712,9 +1793,8 @@ BigDecimal_floor(int argc, VALUE *argv, VALUE self)
*
* Return the smallest integer greater than or equal to the value, as a BigDecimal.
*
- * BigDecimal('3.14159').ceil -> 4
- *
- * BigDecimal('-9.1').ceil -> -9
+ * BigDecimal('3.14159').ceil #=> 4
+ * BigDecimal('-9.1').ceil #=> -9
*
* If n is specified and positive, the fractional part of the result has no
* more than that many digits.
@@ -1722,9 +1802,8 @@ BigDecimal_floor(int argc, VALUE *argv, VALUE self)
* If n is specified and negative, at least that
* many digits to the left of the decimal point will be 0 in the result.
*
- * BigDecimal('3.14159').ceil(3) -> 3.142
- *
- * BigDecimal('13345.234').ceil(-2) -> 13400.0
+ * BigDecimal('3.14159').ceil(3) #=> 3.142
+ * BigDecimal('13345.234').ceil(-2) #=> 13400.0
*/
static VALUE
BigDecimal_ceil(int argc, VALUE *argv, VALUE self)
@@ -1735,18 +1814,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));
}
@@ -1777,11 +1856,14 @@ BigDecimal_ceil(int argc, VALUE *argv, VALUE self)
*
* Examples:
*
- * BigDecimal.new('-123.45678901234567890').to_s('5F') -> '-123.45678 90123 45678 9'
+ * BigDecimal.new('-123.45678901234567890').to_s('5F')
+ * #=> '-123.45678 90123 45678 9'
*
- * BigDecimal.new('123.45678901234567890').to_s('+8F') -> '+123.45678901 23456789'
+ * BigDecimal.new('123.45678901234567890').to_s('+8F')
+ * #=> '+123.45678901 23456789'
*
- * BigDecimal.new('123.45678901234567890').to_s(' F') -> ' 123.4567890123456789'
+ * BigDecimal.new('123.45678901234567890').to_s(' F')
+ * #=> ' 123.4567890123456789'
*/
static VALUE
BigDecimal_to_s(int argc, VALUE *argv, VALUE self)
@@ -1796,9 +1878,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);
@@ -1820,7 +1902,7 @@ BigDecimal_to_s(int argc, VALUE *argv, VALUE self)
}
break;
}
- mc = mc * 10 + ch - '0';
+ mc = mc*10 + ch - '0';
}
}
else {
@@ -1883,21 +1965,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));
@@ -1937,13 +2019,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);
@@ -2037,7 +2119,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;
@@ -2050,6 +2136,7 @@ static VALUE
rmpd_power_by_big_decimal(Real const* x, Real const* exp, ssize_t const n)
{
VALUE log_x, multiplied, y;
+ volatile VALUE obj = exp->obj;
if (VpIsZero(exp)) {
return ToValue(VpCreateRbObject(n, "1"));
@@ -2058,6 +2145,7 @@ rmpd_power_by_big_decimal(Real const* x, Real const* exp, ssize_t const n)
log_x = BigMath_log(x->obj, SSIZET2NUM(n+1));
multiplied = BigDecimal_mult2(exp->obj, log_x, SSIZET2NUM(n+1));
y = BigMath_exp(multiplied, SSIZET2NUM(n));
+ RB_GC_GUARD(obj);
return y;
}
@@ -2066,7 +2154,9 @@ rmpd_power_by_big_decimal(Real const* x, Real const* exp, ssize_t const n)
* power(n)
* power(n, prec)
*
- * Returns the value raised to the power of n. Note that n must be an Integer.
+ * Returns the value raised to the power of n.
+ *
+ * Note that n must be an Integer.
*
* Also available as the operator **
*/
@@ -2104,7 +2194,12 @@ 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);
@@ -2277,24 +2372,27 @@ retry:
int_exp = FIX2INT(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);
}
/* call-seq:
* big_decimal ** exp -> big_decimal
*
- * It is a synonym of big_decimal.power(exp).
+ * It is a synonym of BigDecimal#power(exp).
*/
static VALUE
BigDecimal_power_op(VALUE self, VALUE exp)
@@ -2302,6 +2400,14 @@ BigDecimal_power_op(VALUE self, VALUE exp)
return BigDecimal_power(1, &exp, self);
}
+static VALUE
+BigDecimal_s_allocate(VALUE klass)
+{
+ return VpNewRbClass(0, NULL, klass)->obj;
+}
+
+static Real *BigDecimal_new(int argc, VALUE *argv);
+
/* call-seq:
* new(initial, digits)
*
@@ -2309,6 +2415,7 @@ BigDecimal_power_op(VALUE self, VALUE exp)
*
* initial:: The initial value, as an Integer, a Float, a Rational,
* a BigDecimal, or a String.
+ *
* If it is a String, spaces are ignored and unrecognized characters
* terminate the value.
*
@@ -2320,10 +2427,40 @@ BigDecimal_power_op(VALUE self, VALUE exp)
* larger than the specified number.
*/
static VALUE
-BigDecimal_new(int argc, VALUE *argv, VALUE self)
+BigDecimal_initialize(int argc, VALUE *argv, VALUE self)
+{
+ Real *pv = rb_check_typeddata(self, &BigDecimal_data_type);
+ Real *x = BigDecimal_new(argc, argv);
+
+ if (ToValue(x)) {
+ pv = VpCopy(pv, x);
+ }
+ else {
+ VpFree(pv);
+ pv = x;
+ }
+ DATA_PTR(self) = pv;
+ pv->obj = self;
+ return self;
+}
+
+/* :nodoc:
+ *
+ * private method to dup and clone the provided BigDecimal +other+
+ */
+static VALUE
+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);
+ return self;
+}
+
+static Real *
+BigDecimal_new(int argc, VALUE *argv)
{
- ENTER(5);
- Real *pv;
size_t mf;
VALUE nFig;
VALUE iniValue;
@@ -2338,15 +2475,14 @@ BigDecimal_new(int argc, VALUE *argv, VALUE self)
switch (TYPE(iniValue)) {
case T_DATA:
if (is_kind_of_BigDecimal(iniValue)) {
- pv = VpDup(DATA_PTR(iniValue));
- return ToValue(pv);
+ return DATA_PTR(iniValue);
}
break;
case T_FIXNUM:
/* fall through */
case T_BIGNUM:
- return ToValue(GetVpValue(iniValue, 1));
+ return GetVpValue(iniValue, 1);
case T_FLOAT:
if (mf > DBL_DIG+1) {
@@ -2355,25 +2491,29 @@ BigDecimal_new(int argc, VALUE *argv, VALUE self)
/* fall through */
case T_RATIONAL:
if (NIL_P(nFig)) {
- rb_raise(rb_eArgError, "can't omit precision for a Rational.");
+ rb_raise(rb_eArgError,
+ "can't omit precision for a %s.",
+ rb_class2name(CLASS_OF(iniValue)));
}
- return ToValue(GetVpValueWithPrec(iniValue, mf, 1));
+ return GetVpValueWithPrec(iniValue, mf, 1);
case T_STRING:
/* fall through */
default:
break;
}
- SafeStringValue(iniValue);
- GUARD_OBJ(pv, VpNewRbClass(mf, RSTRING_PTR(iniValue),self));
-
- return ToValue(pv);
+ StringValueCStr(iniValue);
+ return VpAlloc(mf, RSTRING_PTR(iniValue));
}
+/* See also BigDecimal::new */
static VALUE
BigDecimal_global_new(int argc, VALUE *argv, VALUE self)
{
- return BigDecimal_new(argc, argv, rb_cBigDecimal);
+ Real *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;
}
/* call-seq:
@@ -2394,15 +2534,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;
}
@@ -2418,20 +2558,35 @@ 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 { ... }
+/*
+ * call-seq: BigDecimal.save_exception_mode { ... }
+ *
+ * Execute the provided block, but preserve the exception mode
+ *
+ * BigDecimal.save_exception_mode do
+ * BigDecimal.mode(BigDecimal::EXCEPTION_OVERFLOW, false)
+ * BigDecimal.mode(BigDecimal::EXCEPTION_NaN, false)
+ *
+ * BigDecimal.new(BigDecimal('Infinity'))
+ * BigDecimal.new(BigDecimal('-Infinity'))
+ * BigDecimal(BigDecimal.new('NaN'))
+ * end
+ *
+ * For use with the BigDecimal::EXCEPTION_*
+ *
+ * See BigDecimal.mode
*/
static VALUE
BigDecimal_save_exception_mode(VALUE self)
@@ -2444,8 +2599,19 @@ BigDecimal_save_exception_mode(VALUE self)
return ret;
}
-/* call-seq:
- * BigDecimal.save_rounding_mode { ... }
+/*
+ * call-seq: BigDecimal.save_rounding_mode { ... }
+ *
+ * Execute the provided block, but preserve the rounding mode
+ *
+ * BigDecimal.save_rounding_mode do
+ * BigDecimal.mode(BigDecimal::ROUND_MODE, :up)
+ * puts BigDecimal.mode(BigDecimal::ROUND_MODE)
+ * end
+ *
+ * For use with the BigDecimal::ROUND_*
+ *
+ * See BigDecimal.mode
*/
static VALUE
BigDecimal_save_rounding_mode(VALUE self)
@@ -2458,8 +2624,19 @@ BigDecimal_save_rounding_mode(VALUE self)
return ret;
}
-/* call-seq:
- * BigDecimal.save_limit { ... }
+/*
+ * call-seq: BigDecimal.save_limit { ... }
+ *
+ * Execute the provided block, but preserve the precision limit
+ *
+ * BigDecimal.limit(100)
+ * puts BigDecimal.limit
+ * BigDecimal.save_limit do
+ * BigDecimal.limit(200)
+ * puts BigDecimal.limit
+ * end
+ * puts BigDecimal.limit
+ *
*/
static VALUE
BigDecimal_save_limit(VALUE self)
@@ -2473,14 +2650,14 @@ 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 infinite, 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)
@@ -2502,18 +2679,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);
@@ -2534,27 +2711,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);
}
- RB_GC_GUARD(vx->obj);
+ x = vx->obj;
n = prec + rmpd_double_figures();
negative = VpGetSign(vx) < 0;
@@ -2562,18 +2739,21 @@ 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"));
+ x1 = one;
+ y = one;
+ d = y;
+ z = one;
+ i = 0;
while (!VpIsZero((Real*)DATA_PTR(d))) {
VALUE argv[2];
SIGNED_VALUE const ey = VpExponent10(DATA_PTR(y));
SIGNED_VALUE const ed = VpExponent10(DATA_PTR(d));
ssize_t m = n - vabs(ey - ed);
+
+ rb_thread_check_ints();
+
if (m <= 0) {
break;
}
@@ -2600,19 +2780,26 @@ BigMath_s_exp(VALUE klass, VALUE x, VALUE vprec)
vprec = SSIZET2NUM(prec - VpExponent10(DATA_PTR(y)));
return BigDecimal_round(1, &vprec, y);
}
+
+ RB_GC_GUARD(one);
+ RB_GC_GUARD(x);
+ RB_GC_GUARD(x1);
+ RB_GC_GUARD(y);
+ RB_GC_GUARD(d);
+ RB_GC_GUARD(z);
}
/* call-seq:
- * 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 infinite, 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)
@@ -2719,7 +2906,7 @@ get_vp_value:
expo = VpExponent10(vx);
if (expo < 0 || expo >= 3) {
char buf[16];
- snprintf(buf, 16, "1E%ld", -expo);
+ snprintf(buf, 16, "1E%"PRIdVALUE, -expo);
x = BigDecimal_mult2(x, ToValue(VpCreateRbObject(1, buf)), vn);
}
else {
@@ -2767,19 +2954,13 @@ 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.
+ *
* For example:
*
- * 42**13 -> 1265437718438866624512
+ * 42**13 #=> 1265437718438866624512
*
* BigDecimal provides similar support for very large or very accurate floating
* point numbers.
@@ -2787,86 +2968,101 @@ get_vp_value:
* Decimal arithmetic is also useful for general calculation, because it
* provides the correct answers people expect--whereas normal binary floating
* point arithmetic often introduces subtle errors because of the conversion
- * between base 10 and base 2. For example, try:
+ * between base 10 and base 2.
+ *
+ * For example, try:
*
* sum = 0
- * for i in (1..10000)
+ * 10_000.times do
* sum = sum + 0.0001
* end
- * print sum
+ * print sum #=> 0.9999999999999062
*
* and contrast with the output from:
*
* require 'bigdecimal'
*
* sum = BigDecimal.new("0")
- * for i in (1..10000)
+ * 10_000.times do
* sum = sum + BigDecimal.new("0.0001")
* end
- * print sum
+ * print sum #=> 0.1E1
*
* Similarly:
*
- * (BigDecimal.new("1.2") - BigDecimal("1.0")) == BigDecimal("0.2") -> true
+ * (BigDecimal.new("1.2") - BigDecimal("1.0")) == BigDecimal("0.2") #=> true
*
- * (1.2 - 1.0) == 0.2 -> false
+ * (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
- * 'Infinity', '+Infinity' and '-Infinity' (case-sensitive)
+ * <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
+ * When a computation results in an undefined value, the special value +NaN+
* (for 'not a number') is returned.
*
* Example:
*
- * BigDecimal.new("0.0") / BigDecimal.new("0.0") -> NaN
- *
- * You can also create undefined values. NaN is never considered to be the
- * same as any other value, even NaN itself:
+ * BigDecimal.new("0.0") / BigDecimal.new("0.0") #=> NaN
*
- * n = BigDecimal.new('NaN')
+ * You can also create undefined values.
*
- * n == 0.0 -> nil
+ * NaN is never considered to be the same as any other value, even NaN itself:
*
- * n == n -> nil
+ * n = BigDecimal.new('NaN')
+ * 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
* be returned.
*
* If the value which is too small to be represented is negative, a BigDecimal
- * value of negative zero is returned. If the value is positive, a value of
- * positive zero is returned.
+ * value of negative zero is returned.
+ *
+ * BigDecimal.new("1.0") / BigDecimal.new("-Infinity") #=> -0.0
*
- * BigDecimal.new("1.0") / BigDecimal.new("-Infinity") -> -0.0
+ * If the value is positive, a value of positive zero is returned.
*
- * BigDecimal.new("1.0") / BigDecimal.new("Infinity") -> 0.0
+ * BigDecimal.new("1.0") / BigDecimal.new("Infinity") #=> 0.0
*
* (See BigDecimal.mode for how to specify limits of precision.)
*
- * Note that -0.0 and 0.0 are considered to be the same for the purposes of
+ * Note that +-0.0+ and +0.0+ are considered to be the same for the purposes of
* comparison.
*
* 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)
@@ -2881,13 +3077,13 @@ 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 */
rb_define_global_function("BigDecimal", BigDecimal_global_new, -1);
/* Class methods */
- rb_define_singleton_method(rb_cBigDecimal, "new", BigDecimal_new, -1);
rb_define_singleton_method(rb_cBigDecimal, "mode", BigDecimal_mode, -1);
rb_define_singleton_method(rb_cBigDecimal, "limit", BigDecimal_limit, -1);
rb_define_singleton_method(rb_cBigDecimal, "double_fig", BigDecimal_double_fig, 0);
@@ -2915,100 +3111,104 @@ 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. */
rb_define_const(rb_cBigDecimal, "INFINITY", BigDecimal_global_new(1, &arg, rb_cBigDecimal));
arg = rb_str_new2("NaN");
+ /* 'Not a Number' value. */
rb_define_const(rb_cBigDecimal, "NAN", BigDecimal_global_new(1, &arg, rb_cBigDecimal));
/* instance methods */
+ rb_define_method(rb_cBigDecimal, "initialize", BigDecimal_initialize, -1);
+ rb_define_method(rb_cBigDecimal, "initialize_copy", BigDecimal_initialize_copy, 1);
rb_define_method(rb_cBigDecimal, "precs", BigDecimal_prec, 0);
rb_define_method(rb_cBigDecimal, "add", BigDecimal_add2, 2);
@@ -3063,7 +3263,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);
@@ -3101,7 +3300,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 */
@@ -3118,7 +3317,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 *
@@ -3126,7 +3325,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
@@ -3135,21 +3334,31 @@ VpMemAlloc(size_t mb)
return p;
}
+ 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);
+ }
+ return p;
+}
+
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 */
}
}
@@ -3320,7 +3529,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;
}
@@ -3328,7 +3537,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;
}
@@ -3336,7 +3545,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;
}
@@ -3344,7 +3553,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;
}
@@ -3360,39 +3569,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 */
@@ -3400,91 +3596,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);
}
/*
@@ -3500,26 +3695,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;
}
@@ -3529,7 +3724,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
@@ -3556,13 +3751,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 */
@@ -3582,28 +3777,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);
}
/*
@@ -3623,80 +3825,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 = (Real *) VpMemAlloc(sizeof(Real) + mx * sizeof(BDIGIT));
- /* 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 = (Real *) VpMemAlloc(sizeof(Real) + sizeof(BDIGIT));
- 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 = (Real *) VpMemAlloc(sizeof(Real) + sizeof(BDIGIT));
- 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 = (Real *) VpMemAlloc(sizeof(Real) + sizeof(BDIGIT));
- 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[] */
@@ -3706,52 +3912,52 @@ 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 = (Real *) VpMemAlloc(sizeof(Real) + mx * sizeof(BDIGIT));
+ vp = VpAllocReal(mx);
/* xmalloc() alway returns(or throw interruption) */
vp->MaxPrec = mx; /* set max precision */
VpSetZero(vp, sign);
@@ -3776,37 +3982,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;
}
/*
@@ -3823,83 +4031,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:
@@ -3910,31 +4122,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;
}
/*
@@ -3955,9 +4169,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 */
@@ -3965,55 +4179,58 @@ 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;
- }
+ 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;
+ }
}
/* 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:
@@ -4023,8 +4240,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;
@@ -4046,9 +4263,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 */
@@ -4056,66 +4273,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 + 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;
+ }
}
/* 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:
@@ -4124,8 +4345,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;
@@ -4151,82 +4372,86 @@ VpSetPTR(Real *a, Real *b, Real *c, size_t *a_pos, size_t *b_pos, size_t *c_pos,
size_t left_word, right_word, word_shift;
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;
+ *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;
}
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
@@ -4245,39 +4470,39 @@ VpMult(Real *c, Real *a, Real *b)
{
size_t MxIndA, MxIndB, MxIndAB, MxIndC;
size_t ind_c, i, ii, nc;
- size_t ind_as, ind_ae, ind_bs, ind_be;
+ size_t ind_as, ind_ae, ind_bs;
BDIGIT carry;
BDIGIT_DBL s;
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;
@@ -4285,81 +4510,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;
- ind_be = MxIndB - nc;
- } else if(nc <= MxIndA) { /* The middle rectangular of the Fig. */
- ind_as = MxIndA - nc;
- ind_ae = MxIndA -(nc - MxIndB);
- ind_bs = MxIndB;
- ind_be = 0;
- } else if(nc > MxIndA) { /* The right triangle of the Fig. */
- ind_as = 0;
- ind_ae = MxIndAB - nc - 1;
- ind_bs = MxIndB -(nc - MxIndA);
- ind_be = 0;
- }
+ 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;
@@ -4368,7 +4594,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;
@@ -4379,33 +4605,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;
@@ -4416,25 +4642,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;
}
/* */
@@ -4442,141 +4669,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
@@ -4589,17 +4819,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));
@@ -4624,79 +4854,81 @@ 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;
@@ -4713,94 +4945,97 @@ Exit:
* Note: % must must not appear more than once
* a ... VP variable to be printed
*/
-VP_EXPORT int
+ VP_EXPORT int
VPrint(FILE *fp, const char *cntl_chr, Real *a)
{
size_t i, j, nc, nd, ZeroSup;
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.");
+ 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 >= 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++;
}
return (int)nc;
}
@@ -4812,22 +5047,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] = ' ';
+ }
}
}
@@ -4842,8 +5077,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;
}
@@ -4854,75 +5089,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;
}
@@ -4947,30 +5185,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
@@ -4982,49 +5222,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);
}
/*
@@ -5042,7 +5283,6 @@ VP_EXPORT int
VpCtoV(Real *a, const char *int_chr, size_t ni, const char *frac, size_t nf, const char *exp_chr, size_t ne)
{
size_t i, j, ind_a, ma, mi, me;
- size_t loc;
SIGNED_VALUE e, es, eb, ef;
int sign, signe, exponent_overflow;
@@ -5055,40 +5295,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. */
@@ -5101,14 +5352,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;
@@ -5127,34 +5378,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;
+ }
}
- loc = 1;
/* 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;
@@ -5164,12 +5414,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;
}
@@ -5196,55 +5446,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;
@@ -5261,57 +5511,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;
@@ -5329,51 +5580,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;
@@ -5388,44 +5640,44 @@ VpSqrt(Real *y, Real *x)
{
Real *f = NULL;
Real *r = NULL;
- size_t y_prec, f_prec;
+ size_t y_prec;
SIGNED_VALUE n, e;
SIGNED_VALUE prec;
ssize_t nr;
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");
nr = 0;
y_prec = y->MaxPrec;
- f_prec = f->MaxPrec;
prec = x->exponent - (ssize_t)y_prec;
if (x->exponent > 0)
@@ -5437,8 +5689,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;
@@ -5448,22 +5700,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;
@@ -5471,13 +5721,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;
@@ -5496,9 +5746,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? */
@@ -5513,8 +5763,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;
@@ -5527,7 +5777,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
@@ -5536,20 +5786,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);
@@ -5560,15 +5815,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;
@@ -5581,31 +5836,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_DOWN:
+ case VP_ROUND_HALF_UP:
+ if (v>=5) ++div;
+ break;
+ 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) {
@@ -5623,32 +5878,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;
}
@@ -5662,10 +5919,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
@@ -5673,17 +5930,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);
}
@@ -5701,27 +5958,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;
@@ -5745,16 +6002,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;
}
@@ -5767,18 +6025,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 */
@@ -5786,22 +6044,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;
@@ -5818,55 +6076,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 */
@@ -5877,28 +6137,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);
@@ -5920,25 +6180,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 c8bd0aef18..7131c21b3b 100644
--- a/ext/bigdecimal/bigdecimal.gemspec
+++ b/ext/bigdecimal/bigdecimal.gemspec
@@ -1,14 +1,15 @@
# -*- ruby -*-
-_VERSION = "1.1.0"
+_VERSION = "1.2.2"
Gem::Specification.new do |s|
s.name = "bigdecimal"
s.version = _VERSION
- s.date = "2011-07-30"
+ s.date = "2012-02-19"
s.summary = "Arbitrary-precision decimal floating-point number library."
+ s.homepage = "http://www.ruby-lang.org"
s.email = "mrkn@mrkn.jp"
s.description = "This library provides arbitrary-precision decimal floating-point number class."
- s.authors = ["Kenta Murata", "Shigeo Kobayashi"]
+ s.authors = ["Kenta Murata", "Zachary Scott", "Shigeo Kobayashi"]
s.require_path = %[.]
s.files = %w[
bigdecimal.gemspec
@@ -17,11 +18,10 @@ Gem::Specification.new do |s|
README
depend extconf.rb
lib/bigdecimal/jacobian.rb
- lib/bigdecimal/lcdcmp.rb
+ lib/bigdecimal/ludcmp.rb
lib/bigdecimal/math.rb
lib/bigdecimal/newton.rb
lib/bigdecimal/util.rb
- lib/bigdecimal/version.rb
sample/linear.rb
sample/nlsolve.rb
sample/pi.rb
diff --git a/ext/bigdecimal/bigdecimal.h b/ext/bigdecimal/bigdecimal.h
index d6a3f337c6..e7a8bccee7 100644
--- a/ext/bigdecimal/bigdecimal.h
+++ b/ext/bigdecimal/bigdecimal.h
@@ -19,8 +19,42 @@
#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
+} /* satisfy cc-mode */
+#endif
#endif
#ifndef HAVE_LABS
@@ -94,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)
@@ -120,6 +154,12 @@ extern VALUE rb_cBigDecimal;
#define VP_SIGN_POSITIVE_INFINITE 3 /* Positive infinite number */
#define VP_SIGN_NEGATIVE_INFINITE -3 /* Negative infinite number */
+#ifdef __GNUC__
+#define FLEXIBLE_ARRAY_SIZE 0
+#else
+#define FLEXIBLE_ARRAY_SIZE 1
+#endif
+
/*
* VP representation
* r = 0.xxxxxxxxx *BASE**exponent
@@ -144,7 +184,7 @@ typedef struct {
* -3 : Negative infinite number
*/
short flag; /* Not used in vp_routines,space for user. */
- BDIGIT frac[1]; /* Pointer to array of fraction part. */
+ BDIGIT frac[FLEXIBLE_ARRAY_SIZE]; /* Array of fraction part. */
} Real;
/*
@@ -191,6 +231,7 @@ VP_EXPORT int VpIsNegDoubleZero(double v);
VP_EXPORT size_t VpNumOfChars(Real *vp,const char *pszFmt);
VP_EXPORT size_t VpInit(BDIGIT BaseVal);
VP_EXPORT void *VpMemAlloc(size_t mb);
+VP_EXPORT void *VpMemRealloc(void *ptr, size_t mb);
VP_EXPORT void VpFree(Real *pv);
VP_EXPORT Real *VpAlloc(size_t mx, const char *szVal);
VP_EXPORT size_t VpAsgn(Real *c, Real *a, int isw);
@@ -273,6 +314,9 @@ VP_EXPORT int VPrint(FILE *fp,const char *cntl_chr,Real *a);
#endif /* BIGDECIMAL_DEBUG */
#if defined(__cplusplus)
+#if 0
+{ /* satisfy cc-mode */
+#endif
} /* extern "C" { */
#endif
#endif /* RUBY_BIG_DECIMAL_H */
diff --git a/ext/bigdecimal/bigdecimal_en.html b/ext/bigdecimal/bigdecimal_en.html
deleted file mode 100644
index afaf8eca86..0000000000
--- a/ext/bigdecimal/bigdecimal_en.html
+++ /dev/null
@@ -1,792 +0,0 @@
-<HTML>
-<HEAD>
-<META HTTP-EQUIV="Content-Type" CONTENT="text/html">
-<style type="text/css"><!--
-body { color: #3f0f0f; background: #fefeff; margin-left: 2em; margin-right: 2em;}
-h1 { color: #ffffff; background-color: #3939AD; border-color: #FF00FF; width: 100%; border-style: solid;
- border-top-width: 0.1em; border-bottom-width: 0.1em; border-right: none; border-left: none;
- padding: 0.1em; font-weight: bold; font-size: 160%; text-align: center;}
-h2 { color: #00007f; background-color: #e7e7ff; border-color: #000094; width: 100%; border-style: solid; border-le ft: none; border-right: none; border-top-width: 0.1em; border-bottom-width: 0.1em; padding: 0.1em;
- font-weight: bold; font-size: 110%;
-}
-h3 { color: #00007f; padding: 0.2em; font-size: 110%;}
-h4, h5 { color: #000000; padding: 0.2em; font-size: 100%;}
-table { margin-top: 0.2em; margin-bottom: 0.2em; margin-left: 2em; margin-right: 2em;}
-caption { color: #7f0000; font-weight: bold;}
-th { background: #e7e7ff; padding-left: 0.2em; padding-right: 0.2em;}
-td { background: #f3f7ff; padding-left: 0.2em; padding-right: 0.2em;}
-code { color: #0000df;}
-dt { margin-top: 0.2em;}
-li { margin-top: 0.2em;}
-pre
-{ BACKGROUND-COLOR: #d0d0d0; BORDER-BOTTOM: medium none; BORDER-LEFT: medium none;
- BORDER-RIGHT: medium none; BORDER-TOP: medium none; LINE-HEIGHT: 100%; MARGIN: 12px 12px 12px 12px;
- PADDING-BOTTOM: 12px; PADDING-LEFT: 12px; PADDING-RIGHT: 12px; PADDING-TOP: 12px;
- WHITE-SPACE: pre; WIDTH: 100%
-}
---></style>
-
-<TITLE>BigDecimal:An extension library for Ruby</TITLE>
-</HEAD>
-<BODY BGCOLOR=#FFFFE0>
-<H1>BigDecimal(Variable Precision Floating Library for Ruby)</H1>
-<DIV align="right"><A HREF="./bigdecimal_ja.html">Japanese</A></DIV><BR>
-BigDecimal is an extension library for the Ruby interpreter.
-Using BigDecimal class, you can obtain any number of significant digits in computation.
-For the details about Ruby see:<BR>
-<UL>
-<LI><A HREF="http://www.ruby-lang.org/en/">http://www.ruby-lang.org/en/</A>:Official Ruby page(English).</LI>
-<LI><A HREF="http://kahori.com/ruby/ring/">http://kahori.com/ruby/ring/</A>:Mutually linked pages relating to Ruby(Japanese).
-</LI>
-</UL>
-NOTE:<BR>
- 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. For the details,see COPYING and README included in this
- distribution.
-<BR>
-<hr>
-
-<H2>Contents</H2>
-<UL>
-<LI><A HREF="#INTRO">Introduction</LI>
-<LI><A HREF="#SPEC">Usage and methods</A></LI>
-<LI><A HREF="#UNDEF">Infinity,NaN,Zero</A></LI>
-<LI><A HREF="#STRUCT">Internal structure</A></LI>
-<LI><A HREF="#BASE">Binary or decimal number representation</A></LI>
-<LI><A HREF="#PREC">Resulting number of significant digits</A></LI>
-</UL>
-<HR>
-
-<A NAME="#INTRO">
-<H2>Introduction</H2>
-Ruby already has builtin (variable length integer number) class Bignum. Using Bignum class,you can obtain
- any integer value in magnitude. But, variable length decimal number class is not yet built in.
-This is why I made variable length floating class BigDecimal.
-Feel free to send any comments or bug reports to me.
-<A HREF="mailto:shigeo@tinyforest.gr.jp">shigeo@tinyforest.gr.jp</A>
-I will try(but can't promise) to fix bugs reported.
-<hr>
-<H2>Installation</H2>
-The Ruby latest version can be downloaded from <A HREF="http://www.ruby-lang.org/en/">Official Ruby page</A>.
-Once decompress the downloaded Ruby archive,follow the normal installation procedures according to the
-documents included.
-
-<A NAME="#SPEC">
-<H2>Usage and methods</H2>
-Suppose you already know Ruby programming,
-to create BigDecimal objects,the program would like:<BR>
-
-<CODE><PRE>
- require 'bigdecimal'
- a=BigDecimal::new("0.123456789123456789")
- b=BigDecimal("123456.78912345678",40)
- c=a+b
-</PRE></CODE>
-
-<H3>List of methods</H3>
-In 32 bits integer system,every 4 digits(in decimal) are computed simultaneously.
-This means the number of significant digits in BigDecimal is always a multiple of 4.
-<P>
-Some more methods are available in Ruby code (not C code).
-Functions such as sin,cos ...,are in math.rb in bigdecimal directory.
-To use them,require math.rb as:
-<CODE><PRE>
-require "bigdecimal/math.rb"
-</PRE></CODE>
-For details,see the math.rb code and comments.
-Other utility methods are in util.rb.
-To use util.rb, require it as:
-<CODE><PRE>
-require "bigdecimal/util.rb"
-</PRE></CODE>
-For details,see the util.rb code.
-
-<H4><U>Class methods</U></H4>
-<UL>
-<LI><B>new</B></LI><BLOCKQUOTE>
-"new" method creates a new BigDecimal object.<BR>
-a=BigDecimal::new(s[,n]) or<BR>
-a=BigDecimal(s[,n]) or<BR>
-where:<BR>
-s: Initial value string. Spaces will be ignored. Any unrecognizable character for
-representing initial value terminates the string.<BR>
-n: Maximum number of significant digits of a. n must be a Fixnum object.
-If n is omitted or is equal to 0,then the maximum number of significant digits of a is determined from the length of s.
-Actual number of digits handled in computations are usually greater than n.<BR>
-n is useful when performing divisions like
-<CODE><PRE>
-BigDecimal("1") / BigDecimal("3") # => 0.3333333333 33E0
-BigDecimal("1",10) / BigDecimal("3",10) # => 0.3333333333 3333333333 33333333E0
-</PRE></CODE>
-but the resulting digits obtained may differ in future version.
-</BLOCKQUOTE>
-
-<LI><B>mode</B></LI><BLOCKQUOTE>
-f = BigDecimal.mode(s[,v])<BR>
-mode method controls BigDecimal computation. If the second argument is not given or is nil,then the value
-of current setting is returned.
-Following usage are defined.<BR>
-<P><B>[EXCEPTION control]</B><P>
-Actions when computation results NaN or Infinity can be defined as follows.
-<P>
-<BLOCKQUOTE>
-f = BigDecimal::mode(BigDecimal::EXCEPTION_NaN,flag)<BR>
-f = BigDecimal::mode(BigDecimal::EXCEPTION_INFINITY,flag)<BR>
-f = BigDecimal::mode(BigDecimal::EXCEPTION_UNDERFLOW,flag)<BR>
-f = BigDecimal::mode(BigDecimal::EXCEPTION_OVERFLOW,flag)<BR>
-f = BigDecimal::mode(BigDecimal::EXCEPTION_ZERODIVIDE,flag)<BR>
-f = BigDecimal::mode(BigDecimal::EXCEPTION_ALL,flag)<BR>
-</BLOCKQUOTE>
-EXCEPTION_NaN controls the execution when computation results to NaN.<BR>
-EXCEPTION_INFINITY controls the execution when computation results to Infinity.<BR>
-EXCEPTION_UNDERFLOW controls the execution when computation underflows.<BR>
-EXCEPTION_OVERFLOW controls the execution when computation overflows.<BR>
-EXCEPTION_ZERODIVIDE controls the execution when zero-division occurs.<BR>
-EXCEPTION_ALL controls the execution when any defined exception occurs.<BR>
-If the flag is true,then the relating exception is thrown.<BR>
-No exception is thrown when the flag is false(default) and computation
-continues with the result:<BR>
-<BLOCKQUOTE>
-EXCEPTION_NaN results to NaN<BR>
-EXCEPTION_INFINITY results to +Infinity or -Infinity<BR>
-EXCEPTION_UNDERFLOW results to 0.<BR>
-EXCEPTION_OVERFLOW results to +Infinity or -Infinity<BR>
-EXCEPTION_ZERODIVIDE results to +Infinity or -Infinity<BR>
-</BLOCKQUOTE>
-EXCEPTION_INFINITY,EXCEPTION_OVERFLOW, and EXCEPTION_ZERODIVIDE are
- currently the same.<BR>
-The return value of mode method is the value set.<BR>
-If nil is specified for the second argument,then current setting is returned.<BR>
-Suppose the return value of the mode method is f,then
- f &amp; BigDecimal::EXCEPTION_NaN !=0 means EXCEPTION_NaN is set to on.
-<P>
-<B>[ROUND error control]</B><P>
-Rounding operation can be controlled as:
-<BLOCKQUOTE>
-f = BigDecimal::mode(BigDecimal::ROUND_MODE,flag)
-</BLOCKQUOTE>
-where flag must be one of:
-<TABLE>
-
-<TR><TD>ROUND_UP</TD><TD>round away from zero.</TD></TR>
-<TR><TD>ROUND_DOWN</TD><TD>round towards zero(truncate).</TD></TR>
-<TR><TD>ROUND_HALF_UP</TD><TD>round up if the digit &gt;= 5 otherwise truncated(default).</TD></TR>
-<TR><TD>ROUND_HALF_DOWN</TD><TD>round up if the digit &gt;= 6 otherwise truncated.</TD></TR>
-<TR><TD>ROUND_HALF_EVEN</TD><TD>round towards the even neighbor(Banker's rounding).
-<TR><TD>ROUND_CEILING</TD><TD>round towards positive infinity(ceil).</TD></TR>
-<TR><TD>ROUND_FLOOR</TD><TD>round towards negative infinity(floor).</TD></TR>
-</TABLE>
-New rounding mode is returned. If nil is specified for the second argument,then current setting is returned.<BR>
-The digit location for rounding operation can not be specified by this mode method,
-use truncate/round/ceil/floor/add/sub/mult/div methods for each instance instead.
-</BLOCKQUOTE>
-
-<LI><B>limit[(n)]</B></LI><BLOCKQUOTE>
-Limits the maximum digits that the newly created BigDecimal objects can hold never exceed n.
-This means the rounding operation specified by BigDecimal.mode is
-performed if necessary.
-limit returns the value before set if n is nil or is not specified.
-Zero,the default value,means no upper limit.<BR>
-The limit has no more priority than instance methods such as truncate,round,ceil,floor,add,sub,mult,and div. <BR>
-mf = BigDecimal::limit(n)<BR>
-</BLOCKQUOTE>
-
-<LI><B>double_fig</B></LI><BLOCKQUOTE>
-double_fig is a class method which returns the number of digits
-the Float class can have.
-<CODE><PRE>
- p BigDecimal::double_fig # ==> 20 (depends on the CPU etc.)
-</PRE></CODE>
-The equivalent C programs which calculates the value of
-double_fig is:
-<CODE><PRE>
- double v = 1.0;
- int double_fig = 0;
- while(v + 1.0 > 1.0) {
- ++double_fig;
- v /= 10;
- }
-</PRE></CODE>
-</BLOCKQUOTE>
-
-<LI><B>BASE</B></LI><BLOCKQUOTE>
-Base value used in the BigDecimal calculation.
-On 32 bits integer system,the value of BASE is 10000.<BR>
-b = BigDecimal::BASE<BR>
-</BLOCKQUOTE>
-</UL>
-
-<H4><U>Instance methods</U></H4>
-<UL>
-<LI><B>+</B></LI><BLOCKQUOTE>
-addition(c = a + b)<BR>
-For the resulting number of significant digits of c,see <A HREF="#PREC">Resulting number of significant digits</A>.
-
-</BLOCKQUOTE>
-<LI><B>-</B></LI><BLOCKQUOTE>
-subtraction (c = a - b) or negation (c = -a)<BR>
-For the resulting number of significant digits of c,see <A HREF="#PREC">Resulting number of significant digits</A>.
-
-</BLOCKQUOTE>
-<LI><B>*</B></LI><BLOCKQUOTE>
-multiplication(c = a * b)<BR>
-For the resulting number of significant digits of c,see <A HREF="#PREC">Resulting number of significant digits</A>.
-
-</BLOCKQUOTE>
-<LI><B>/</B></LI><BLOCKQUOTE>
-division(c = a / b)<BR>
-For the resulting number of significant digits of c,see <A HREF="#PREC">Resulting number of significant digits</A>.
-</BLOCKQUOTE>
-
-<LI><B>add(b,n)</B></LI><BLOCKQUOTE>
-c = a.add(b,n)<BR>
-c = a.add(b,n) performs c = a + b.<BR>
-If n is less than the actual significant digits of a + b,
-then c is rounded properly according to the BigDecimal.limit.<BR>
-If n is zero,then the result is the same as +'s.
-</BLOCKQUOTE>
-<LI><B>sub(b,n)</B></LI><BLOCKQUOTE>
-c = a.sub(b,n)<BR>
-c = a.sub(b,n) performs c = a - b.<BR>
-If n is less than the actual significant digits of a - b,
-then c is rounded properly according to the BigDecimal.limit.<BR>
-If n is zero,then the result is the same as -'s.
-
-</BLOCKQUOTE>
-<LI><B>mult(b,n)</B></LI><BLOCKQUOTE>
-c = a.mult(b,n)<BR>
-c = a.mult(b,n) performs c = a * b.<BR>
-If n is less than the actual significant digits of a * b,
-then c is rounded properly according to the BigDecimal.limit.<BR>
-If n is zero,then the result is the same as *'s.
-
-</BLOCKQUOTE>
-<LI><B>div(b[,n])</B></LI><BLOCKQUOTE>
-c = a.div(b,n)<BR>
-c = a.div(b,n) performs c = a / b.<BR>
-If n is less than the actual significant digits of a / b,
-then c is rounded properly according to the BigDecimal.limit.<BR>
-If n is zero,then the result is the same as /'s.
-If n is not given,then the result will be an integer(BigDecimal) like Float#div.
-</BLOCKQUOTE>
-
-<LI><B>fix</B></LI><BLOCKQUOTE>
-c = a.fix<BR>
-returns integer part of a.<BR>
-
-</BLOCKQUOTE>
-<LI><B>frac</B></LI><BLOCKQUOTE>
-c = a.frac<BR>
-returns fraction part of a.<BR>
-
-</BLOCKQUOTE>
-<LI><B>floor[(n)]</B></LI><BLOCKQUOTE>
-c = a.floor<BR>
-returns the maximum integer value (in BigDecimal) which is less than or equal to a.
-<CODE><PRE>
- c = BigDecimal("1.23456").floor # ==> 1
- c = BigDecimal("-1.23456").floor # ==> -2
-</PRE></CODE>
-
-As shown in the following example,an optional integer argument (n) specifying the position
-of the target digit can be given.<BR>
-If n> 0,then the (n+1)th digit counted from the decimal point in fraction part is processed(resulting number of fraction part digits is less than or equal to n).<BR>
-If n<0,then the n-th digit counted from the decimal point in integer part is processed(at least n 0's are placed from the decimal point to left).
-<CODE><PRE>
- c = BigDecimal("1.23456").floor(4) # ==> 1.2345
- c = BigDecimal("15.23456").floor(-1) # ==> 10.0
-</PRE></CODE>
-
-</BLOCKQUOTE>
-<LI><B>ceil[(n)]</B></LI><BLOCKQUOTE>
-c = a.ceil<BR>
-returns the minimum integer value (in BigDecimal) which is greater than or equal to a.
-<CODE><PRE>
- c = BigDecimal("1.23456").ceil # ==> 2
- c = BigDecimal("-1.23456").ceil # ==> -1
-</PRE></CODE>
-
-As shown in the following example,an optional integer argument (n) specifying the position
-of the target digit can be given.<BR>
-If n>0,then the (n+1)th digit counted from the decimal point in fraction part is processed(resulting number of fraction part digits is less than or equal to n).<BR>
-If n<0,then the n-th digit counted from the decimal point in integer part is processed(at least n 0's are placed from the decimal point to left).
-<CODE><PRE>
- c = BigDecimal("1.23456").ceil(4) # ==> 1.2346
- c = BigDecimal("15.23456").ceil(-1) # ==> 20.0
-</PRE></CODE>
-
-</BLOCKQUOTE>
-<LI><B>round[(n[,b])]</B></LI><BLOCKQUOTE>
-c = a.round<BR>
-round a to the nearest 1(default)Ã…D<BR>
-<CODE><PRE>
- c = BigDecimal("1.23456").round # ==> 1
- c = BigDecimal("-1.23456").round # ==> -1
-</PRE></CODE>
-The rounding operation changes according to BigDecimal::mode(BigDecimal::ROUND_MODE,flag) if specified.
-
-As shown in the following example,an optional integer argument (n) specifying the position
-of the target digit can be given.<BR>
-If n>0,then the (n+1)th digit counted from the decimal point in fraction part is processed(resulting number of fraction part digits is less than or equal to n).<BR>
-If n<0,then the n-th digit counted from the decimal point in integer part is processed(at least n 0's are placed from the decimal point to left).
-<CODE><PRE>
-c = BigDecimal::new("1.23456").round(4) # ==> 1.2346
-c = BigDecimal::new("15.23456").round(-1) # ==> 20.0
-</PRE></CODE>
-
-Rounding operation can be specified by setting the second optional argument b with the valid ROUND_MODE.<BR>
-<CODE><PRE>
-c = BigDecimal::new("1.23456").round(3,BigDecimal::ROUND_HALF_EVEN) # ==> 1.234
-c = BigDecimal::new("1.23356").round(3,BigDecimal::ROUND_HALF_EVEN) # ==> 1.234
-</PRE></CODE>
-
-</BLOCKQUOTE>
-<LI><B>truncate[(n)]</B></LI><BLOCKQUOTE>
-c = a.truncate<BR>
-truncate a to the nearest 1Ã…D<BR>
-As shown in the following example,an optional integer argument (n) specifying the position
-of the target digit can be given.<BR>
-If n>0,then the (n+1)th digit counted from the decimal point in fraction part is processed(resulting number of fraction part digits is less than or equal to n).<BR>
-If n<0,then the n-th digit counted from the decimal point in integer part is processed(at least n 0's are placed from the decimal point to left).
-
-<CODE><PRE>
-c = BigDecimal::new("1.23456").truncate(4) # ==> 1.2345
-c = BigDecimal::new("15.23456").truncate(-1) # ==> 10.0
-</PRE></CODE>
-</BLOCKQUOTE>
-<LI><B>abs</B></LI><BLOCKQUOTE>
-c = a.abs<BR>
-returns an absolute value of a.<BR>
-
-</BLOCKQUOTE>
-<LI><B>to_i</B></LI><BLOCKQUOTE>
-changes a to an integer.<BR>
-i = a.to_i<BR>
-i becomes to Fixnum or Bignum.
-If a is Infinity or NaN,then i becomes to nil.
-
-</BLOCKQUOTE>
-<LI><B>to_s[(n)]</B></LI><BLOCKQUOTE>
-converts to string(default results look like "0.xxxxxEn").
-<CODE><PRE>
-BigDecimal("1.23456").to_s # ==> "0.123456E1"
-</PRE></CODE>
-If n(>0) is given,then a space is inserted to each of two parts divided by the decimal point
-after every n digits for readability.
-<CODE><PRE>
-BigDecimal("0.1234567890123456789").to_s(10) # ==> "0.1234567890 123456789E0"
-</PRE></CODE>
-n can be a string representing a positive integer number.
-<CODE><PRE>
-BigDecimal("0.1234567890123456789").to_s("10") # ==> "0.1234567890 123456789E0"
-</PRE></CODE>
-If the first character is '+'(or ' '),then '+'(or ' ') will be set before value string
-when the value is positive.
-<CODE><PRE>
-BigDecimal("0.1234567890123456789").to_s(" 10") # ==> " 0.1234567890 123456789E0"
-BigDecimal("0.1234567890123456789").to_s("+10") # ==> "+0.1234567890 123456789E0"
-BigDecimal("-0.1234567890123456789").to_s("10") # ==> "-0.1234567890 123456789E0"
-</PRE></CODE>
-
-At the end of the string,'E'(or 'e') or 'F'(or 'f') can be specified to change
-number representation.
-<CODE><PRE>
-BigDecimal("1234567890.123456789").to_s("E") # ==> "0.1234567890123456789E10"
-BigDecimal("1234567890.123456789").to_s("F") # ==> "1234567890.123456789"
-BigDecimal("1234567890.123456789").to_s("5E") # ==> "0.12345 67890 12345 6789E10"
-BigDecimal("1234567890.123456789").to_s("5F") # ==> "12345 67890.12345 6789"
-</PRE></CODE>
-
-</BLOCKQUOTE>
-<LI><B>exponent</B></LI><BLOCKQUOTE>
-returns an integer holding exponent value of a.<BR>
-n = a.exponent <BR>
-means a = 0.xxxxxxx*10**n.
-</BLOCKQUOTE>
-
-<LI><B>precs</B></LI><BLOCKQUOTE>
-n,m = a.precs <BR>
-precs returns number of significant digits (n) and maximum number of
-significant digits (m) of a.
-</BLOCKQUOTE>
-
-<LI><B>to_f</B></LI><BLOCKQUOTE>
-Creates a new Float object having (nearly) the same value.
-Use split method if you want to convert by yourself.
-</BLOCKQUOTE>
-
-</BLOCKQUOTE>
-<LI><B>sign</B></LI><BLOCKQUOTE>
-n = a.sign <BR>
-returns positive value if a &gt; 0,negative value if a &lt; 0,
-otherwise zero if a == 0.<BR>
-where the value of n means that a is:<BR>
-n = BigDecimal::SIGN_NaN(0) : a is NaN<BR>
-n = BigDecimal::SIGN_POSITIVE_ZERO(1) : a is +0<BR>
-n = BigDecimal::SIGN_NEGATIVE_ZERO(-1) : a is -0<BR>
-n = BigDecimal::SIGN_POSITIVE_FINITE(2) : a is positive<BR>
-n = BigDecimal::SIGN_NEGATIVE_FINITE(-2) : a is negative<BR>
-n = BigDecimal::SIGN_POSITIVE_INFINITE(3) : a is +Infinity<BR>
-n = BigDecimal::SIGN_NEGATIVE_INFINITE(-3) : a is -Infinity<BR>
-The value in () is the actual value,see (<A HREF="#STRUCT">Internal structure</A>.<BR>
-
-</BLOCKQUOTE>
-<LI><B>nan?</B></LI><BLOCKQUOTE>
-a.nan? returns True when a is NaN.
-
-</BLOCKQUOTE>
-<LI><B>infinite?</B></LI><BLOCKQUOTE>
-a.infinite? returns 1 when a is Infinity, -1 when a is -Infinity, nil otherwise.
-
-</BLOCKQUOTE>
-<LI><B>finite?</B></LI><BLOCKQUOTE>
-a.finite? returns true when a is neither Infinity nor NaN.
-</BLOCKQUOTE>
-
-<LI><B>zero?</B></LI><BLOCKQUOTE>
-c = a.zero?<BR>
-returns true if a is equal to 0,otherwise returns false<BR>
-</BLOCKQUOTE>
-<LI><B>nonzero?</B></LI><BLOCKQUOTE>
-c = a.nonzero?<BR>
-returns nil if a is 0,otherwise returns a itself.<BR>
-</BLOCKQUOTE>
-
-<LI><B>split</B></LI><BLOCKQUOTE>
-decomposes a BigDecimal value to 4 parts.
-All 4 parts are returned as an array.<BR>
-Parts consist of a sign(0 when the value is NaN,+1 for positive and
- -1 for negative value), a string representing fraction part,base value(always 10 currently),and an integer(Fixnum) for exponent respectively.
-a=BigDecimal::new("3.14159265")<BR>
-f,x,y,z = a.split<BR>
-where f=+1,x="314159265",y=10 and z=1<BR>
-therefore,you can translate BigDecimal value to Float as:<BR>
-s = "0."+x<BR>
-b = f*(s.to_f)*(y**z)<BR>
-
-</BLOCKQUOTE>
-<LI><B>inspect</B></LI><BLOCKQUOTE>
-is used for debugging output.<BR>
-p a=BigDecimal::new("3.14",10)<BR>
-should produce output like "#&lt;0x112344:'0.314E1',4(12)%gt;".
-where "0x112344" is the address,
-'0.314E1' is the value,4 is the number of the significant digits,
-and 12 is the maximum number of the significant digits
-the object can hold.
-</BLOCKQUOTE>
-
-<LI><B>sqrt</B></LI><BLOCKQUOTE>
-c = a.sqrt(n)<BR>
-computes square root value of a with significant digit number n at least.<BR>
-</BLOCKQUOTE>
-
-<LI><B>**</B></LI><BLOCKQUOTE>
-c = a ** n<BR>
-returns the value of a powered by n.
-n must be an integer.<BR>
-
-</BLOCKQUOTE>
-<LI><B>power</B></LI><BLOCKQUOTE>
-The same as ** method.<BR>
-c = a.power(n)<BR>
-returns the value of a powered by n(c=a**n).
-n must be an integer.<BR>
-</BLOCKQUOTE>
-
-<LI><B>divmod,quo,modulo,%,remainder</B></LI><BLOCKQUOTE>
-See,corresponding methods in Float class.
-</BLOCKQUOTE>
-
-</BLOCKQUOTE>
-<LI><B>&lt;=&gt;</B></LI><BLOCKQUOTE>
-c = a &lt;=&gt; b <BR>
-returns 0 if a==b,1 if a &gt b,and returns -1 if a &lt b.<BR>
-</BLOCKQUOTE>
-</UL>
-
-Following methods need no explanation.<BR>
-<UL>
-<LI>==</LI>
-<LI>===</LI>
-same as ==,used in case statement.
-<LI>!=</LI>
-<LI>&lt;</LI>
-<LI>&lt;=</LI>
-<LI>&gt;</LI>
-<LI>&gt;=</LI>
-</UL>
-
-<HR>
-<H3>About 'coerce'</H3>
-<B>For the binary operation like A op B:</B>
-<DL>
-<DT> 1.Both A and B are BigDecimal objects</DT>
-<DD> A op B is normally performed.</DD>
-<DT> 2.A is the BigDecimal object but B is other than BigDecimal object</DT>
-<DD> Operation is performed,after B is translated to corresponding BigDecimal object(because BigDecimal supports coerce method).</DD>
-<DT> 3.A is not the BigDecimal object but B is BigDecimal object</DT>
-<DD>If A has coerce method,then B will translate A to corresponding
-BigDecimal object and the operation is performed,otherwise an error occures.</DD>
-</DL>
-
-String is not translated to BigDecimal in default.
-Uncomment /* #define ENABLE_NUMERIC_STRING */ in bigdecimal.c, compile and install
-again if you want to enable string to BigDecimal conversion.
-Translation stops without error at the character representing non digit.
-For instance,"10XX" is translated to 10,"XXXX" is translated to 0.<BR>
-String representing zero or infinity such as "Infinity","+Infinity","-Infinity",and "NaN" can also be translated to BigDecimal unless false is specified by mode method.<BR>
-
-BigDecimal class supports coerce method(for the details about coerce method,see Ruby documentations). This means the most binary operation can be performed if the BigDecimal object is at the left hand side of the operation.<BR><BR>
-
- For example:
-<CODE><PRE>
- a = BigDecimal.E(20)
- c = a * "0.123456789123456789123456789" # A String is changed to BigDecimal object.
-</PRE></CODE>
-is performed normally.<BR>
- But,because String does not have coerce method,the following example can not be performed.<BR>
-
-<CODE><PRE>
- a = BigDecimal.E(20)
- c = "0.123456789123456789123456789" * a # ERROR
-</PRE></CODE>
-
-If you actually have any inconvenience about the error above.
-You can define a new class derived from String class,
-and define coerce method within the new class.<BR>
-
-<hr>
-<A NAME="#UNDEF">
-<H2>Infinity,Not a Number(NaN),Zero</H2>
-Infinite numbers and NaN can be represented by string writing "+Infinity"(or "Infinity"),"-Infinity",and "NaN" respectively in your program.
-Infinite numbers can be obtained by 1.0/0.0(=Infinity) or -1.0/0.0(=-Infinity).
-<BR><BR>
-NaN(Not a number) can be obtained by undefined computation like 0.0/0.0
-or Infinity-Infinity.
-Any computation including NaN results to NaN.
-Comparisons with NaN never become true,including comparison with NaN itself.
-<BR><BR>
-Zero has two different variations as +0.0 and -0.0.
-But,still, +0.0==-0.0 is true.
-<BR><BR>
-Computation results including Infinity,NaN,+0.0 or -0.0 become complicated.
-Run following program and confirm the results.
-Send me any incorrect result if you find.
-
-<CODE><PRE>
- require "bigdecimal"
- aa = %w(1 -1 +0.0 -0.0 +Infinity -Infinity NaN)
- ba = %w(1 -1 +0.0 -0.0 +Infinity -Infinity NaN)
- opa = %w(+ - * / <=> > >= < == != <=)
- for a in aa
- for b in ba
- for op in opa
- x = BigDecimal::new(a)
- y = BigDecimal::new(b)
- eval("ans= x #{op} y;print a,' ',op,' ',b,' ==> ',ans.to_s,\"\n\"")
- end
- end
- end
-</PRE></CODE>
-<hr>
-
-<A NAME="#STRUCT">
-<H2>Internal structure</H2>
-BigDecimal number is defined by the structure Real in BigDecimal.h.
-Digits representing a float number are kept in the array frac[] defined in the structure.
-In the program,any floating number(BigDecimal number) is represented as:<BR>
- <BigDecimal number> = 0.xxxxxxxxx*BASE**n<BR><BR>
-where 'x' is any digit representing mantissa(kept in the array frac[]),
-BASE is base value(=10000 in 32 bit integer system),
-and n is the exponent value.<BR>
-Larger BASE value enables smaller size of the array frac[],and increases computation speed.
-The value of BASE is defined ind VpInit(). In 32 bit integer system, this value is
-10000. In 64 bit integer system, the value is 1000000000.
-When BASE is 10000,an element of the array frac[] can have value of from 0 to 9999.
-(up to 4 digits).<BR>
-The structure Real is defined in bigdecimal.h as:<BR>
-<CODE><PRE>
- typedef struct {
- VALUE obj; /* Back pointer(VALUE) for Ruby object. */
- unsigned long MaxPrec; /* The size of the array frac[] */
- unsigned long Prec; /* Current size of frac[] actually used. */
- short sign; /* Attribute of the value. */
- /* ==0 : NaN */
- /* 1 : +0 */
- /* -1 : -0 */
- /* 2 : Positive number */
- /* -2 : Negative number */
- /* 3 : +Infinity */
- /* -3 : -Infinity */
- unsigned short flag; /* Control flag */
- int exponent; /* Exponent value(0.xxxx*BASE**exponent) */
- unsigned long frac[1]; /* An array holding mantissa(Variable) */
- } Real;
-</CODE></PRE>
-The decimal value 1234.56784321 is represented as(BASE=10000):<BR>
-<PRE>
- 0.1234 5678 4321*(10000)**1
-</PRE>
-where frac[0]=1234,frac[1]=5678,frac[2]=4321,
-Prec=3,sign=2,exponent=1. MaxPrec can be any value greater than or equal to
-Prec.
-<hr>
-
-<A NAME="#BASE">
-<H2>Binary or decimal number representation</H2>
-I adopted decimal number representation for BigDecimal implementation.
-Of cource,binary number representation is common on the most computers.
-
-<H3>Advantages using decimal representation</H3>
-The reason why I adopted decimal number representation for BigDecimal is:<BR>
-<DL>
-<DT>Easy for debugging
-<DD>The floating number 1234.56784321 can be easily represented as:<BR>
- frac[0]=1234,frac[1]=5678,frac[2]=4321,exponent=1,and sign=2.
-<DT>Exact representation
-<DD>Following program can add all numbers(in decimal) in a file
- without any error(no round operation).<BR>
-
-<CODE><PRE>
- file = File::open(....,"r")
- s = BigDecimal::new("0")
- while line = file.gets
- s = s + line
- end
-</PRE></CODE>
-
-If the internal representation is binary,translation from decimal to
-binary is required and the translation error is inevitable.
-For example, 0.1 can not exactly be represented in binary.<BR>
-0.1 => b1*2**(-1)+b1*2**(-2)+b3*2**(-3)+b4*2**(-4)....<BR>
-where b1=0,b2=0,b3=0,b4=1...<BR>
-bn(n=1,2,3,...) is infinite series of digit with value of 0 or 1,
-and rounding operation is necessary but where we should round the series ?
-Of course, exact "0.1" is printed if the rounding operation is properly done,
-<DT>Significant digit we can have is automatically determined
-<DD>In binary representation,0.1 can not be represented in finite series of digit.
-
-But we only need one element(frac[0]=1) in decimal representation.
-This means that we can always determine the size of the array frac[] in Real
-structure.
-</DL>
-
-<H3>Disadvantage of decimal representation</H3>
-Because most computers have no internal decimal representation.
-Once you use BigDecimal,you need to keep using it without
-considering computation cost if exact computation is required.
-
-<H4>Which is the first input?</H4>
-Because most people uses decimal notation for numeric data representation,
-BigDecimal can handle numeric data without loss of translation error.
-<hr>
-
-<A NAME="#PREC">
-<H2>Resulting number of significant digits</H2>
-For the fundamental arithmetics such as addition,subtraction,
-multiplication,and division,I prepared 2 group of methods<BR>
-
-<H3>1. +,-,*,/</H3>
-For the operation + - * /,you can not specify the resulting
-number of significant digits.<BR>
-Resulting number of significant digits are defined as:<BR>
-1.1 For *,resulting number of significant digits is the sum of the
-significant digits of both side of the operator. For / ,resulting number of significant digits is the sum of the
-maximum significant digits of both side of the operator.<BR>
-1.2 For + and -,resulting number of significant digits is determined so that
- no round operation is needed. <br>
-For example, c has more than 100 significant digits if c is computed as:<BR>
-c = 0.1+0.1*10**(-100)<br>
-<BR>
-As +,-,and * are always exact(no round operation is performed unless BigDecimal.limit is specified),
-which means more memory is required to keep computation results.
-But,the division such as c=1.0/3.0 will always be rounded.<BR>
-
-<H3>2. add,sub,mult,div</H3>
-The length of the significant digits obtained from +,-,*,/
-is always defined by that of right and left side of the operator.
-To specify the length of the significant digits by your self,
-use methos add,sub,mult,div.
-<CODE><PRE>
- BigDecimal("2").div(3,12) # 2.0/3.0 => 0.6666666666 67E0
-</PRE></CODE>
-</BLOCKQUOTE>
-
-<H3>3. truncate,round,ceil,floor</H3>
-Using these methods,you can specify rounding location relatively from
-decimal point.
-<CODE><PRE>
- BigDecimal("6.66666666666666").round(12) # => 0.6666666666 667E1
-</PRE></CODE>
-</BLOCKQUOTE>
-
-
-<H3>4. Example</H3>
-Following example compute the ratio of the circumference of a circle to
-its diameter(pi=3.14159265358979....) using J.Machin's formula.
-<BR><BR>
-<CODE><PRE>
-#!/usr/local/bin/ruby
-
-require "bigdecimal"
-#
-# Calculates 3.1415.... (the number of times that a circle's diameter
-# will fit around the circle) using J. Machin's formula.
-#
-def big_pi(sig) # sig: Number of significant figures
- exp = -sig
- pi = BigDecimal::new("0")
- two = BigDecimal::new("2")
- m25 = BigDecimal::new("-0.04")
- m57121 = BigDecimal::new("-57121")
-
- u = BigDecimal::new("1")
- k = BigDecimal::new("1")
- w = BigDecimal::new("1")
- t = BigDecimal::new("-80")
- while (u.nonzero? && u.exponent >= exp)
- t = t*m25
- u = t.div(k,sig)
- pi = pi + u
- k = k+two
- end
-
- u = BigDecimal::new("1")
- k = BigDecimal::new("1")
- w = BigDecimal::new("1")
- t = BigDecimal::new("956")
- while (u.nonzero? && u.exponent >= exp )
- t = t.div(m57121,sig)
- u = t.div(k,sig)
- pi = pi + u
- k = k+two
- end
- pi
-end
-
-if $0 == __FILE__
- if ARGV.size == 1
- print "PI("+ARGV[0]+"):\n"
- p big_pi(ARGV[0].to_i)
- else
- print "TRY: ruby pi.rb 1000 \n"
- end
-end
-
-</PRE></CODE>
-<HR>
-<FONT size=2>
-<I>
-<A HREF="http://www.tinyforest.gr.jp">
-Shigeo Kobayashi
-</A>
-(E-Mail:<A HREF="mailto:shigeo@tinyforest.gr.jp">&lt;shigeo@tinyforest.gr.jp&gt;</U></A>)
-</I>
-</FONT>
-</TD>
-</TR>
-</TABLE>
-</BODY>
-</HTML>
diff --git a/ext/bigdecimal/bigdecimal_ja.html b/ext/bigdecimal/bigdecimal_ja.html
deleted file mode 100644
index cc44d61917..0000000000
--- a/ext/bigdecimal/bigdecimal_ja.html
+++ /dev/null
@@ -1,799 +0,0 @@
-<!-- saved from url=(0022)http://internet.e-mail -->
-<HTML>
-<HEAD>
-<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=Shift_JIS">
-<style type="text/css"><!--
-body { color: #3f0f0f; background: #fefeff; margin-left: 2em; margin-right: 2em;}
-h1 { color: #ffffff; background-color: #3939AD; border-color: #FF00FF; width: 100%;
- border-style: solid; border-top-width: 0.1em; border-bottom-width: 0.1em; border-right: none;
- border-left: none; padding: 0.1em; font-weight: bold; font-size: 160%; text-align: center;
-}
-h2 { color: #00007f; background-color: #e7e7ff; border-color: #000094; width: 100%;
- border-style: solid; border-left: none; border-right: none; border-top-width: 0.1em; border-bottom-width: 0.1em;
- padding: 0.1em;
- font-weight: bold; font-size: 110%;
-}
-h3 { color: #00007f; padding: 0.2em; font-size: 110%;}
-h4, h5 { color: #000000; padding: 0.2em; font-size: 100%;}
-table { margin-top: 0.2em; margin-bottom: 0.2em; margin-left: 2em; margin-right: 2em;}
-caption { color: #7f0000; font-weight: bold;}
-th { background: #e7e7ff; padding-left: 0.2em; padding-right: 0.2em;}
-td { background: #f3f7ff; padding-left: 0.2em; padding-right: 0.2em;}
-code { color: #0000df;}
-dt { margin-top: 0.2em;}
-li { margin-top: 0.2em;}
-pre
-{ BACKGROUND-COLOR: #d0d0d0; BORDER-BOTTOM: medium none; BORDER-LEFT: medium none;
- BORDER-RIGHT: medium none; BORDER-TOP: medium none; LINE-HEIGHT: 100%; MARGIN: 12px 12px 12px 12px;
- PADDING-BOTTOM: 12px; PADDING-LEFT: 12px; PADDING-RIGHT: 12px; PADDING-TOP: 12px;
- WHITE-SPACE: pre; WIDTH: 100%
-}
---></style>
-
-<TITLE>BigDecimal:An extension library for Ruby</TITLE>
-</HEAD>
-<BODY BGCOLOR=#FFFFE0>
-<H1>BigDecimal(‰Â•Ï’·•‚“®­”“_‰‰ŽZ—pŠg’£ƒ‰ƒCƒuƒ‰ƒŠ)</H1>
-<DIV align="right"><A HREF="./bigdecimal_en.html">English</A></DIV><BR>
-BigDecimal ‚̓IƒuƒWƒFƒNƒgŽwŒü‚Ì‹­—͂ȃXƒNƒŠƒvƒgŒ¾Œê‚Å‚ ‚é Ruby ‚ɉ•ϒ·•‚“®¬”“_
-ŒvŽZ‹@”\‚ð’ljÁ‚·‚邽‚߂̊g’£ƒ‰ƒCƒuƒ‰ƒŠ‚Å‚·B
-Ruby ‚ɂ‚¢‚Ä‚ÌÚ‚µ‚¢“à—e‚͈ȉº‚ÌURL‚ðŽQÆ‚µ‚Ä‚­‚¾‚³‚¢B
-<UL>
-<LI><A HREF="http://www.ruby-lang.org/ja/">http://www.ruby-lang.org/ja/</A>FRubyŒöŽ®ƒy[ƒW</LI>
-<LI><A HREF="http://kahori.com/ruby/ring/">http://kahori.com/ruby/ring/</A>FRuby‚ÉŠÖ‚·‚éƒy[ƒW‚ð’H‚ê‚Ü‚·</LI>
-</UL>
-<hr>
-<H2>–ÚŽŸ</H2>
-<UL>
-<LI><A HREF="#INTRO">‚Í‚¶‚ß‚É</LI>
-<LI><A HREF="#SPEC">Žg—p•û–@‚ƃƒ\ƒbƒh‚̈ꗗ</A></LI>
-<LI><A HREF="#UNDEF">–³ŒÀA”ñ”Aƒ[ƒ‚̈µ‚¢</A></LI>
-<LI><A HREF="#STRUCT">“à•”\‘¢</A></LI>
-<LI><A HREF="#BASE">2i‚Æ10i</A></LI>
-<LI><A HREF="#PREC">ŒvŽZ¸“x‚ɂ‚¢‚Ä</A></LI>
-</UL>
-
-<HR>
-<A NAME="#INTRO">
-<H2>‚Í‚¶‚ß‚É</H2>
-Ruby ‚É‚Í Bignum ‚Æ‚¢‚¤ƒNƒ‰ƒX‚ª‚ ‚èA”•SŒ…‚Ì®”‚Å‚àŒvŽZ‚·‚邱‚Æ‚ª‚Å‚«‚Ü‚·B
-‚½‚¾A”CˆÓŒ…‚Ì•‚“®­”“_‰‰ŽZ—pƒNƒ‰ƒX‚ª–³‚¢‚悤‚Å‚·B‚»‚±‚ÅA
-”CˆÓŒ…‚Ì•‚“®­”“_‰‰ŽZ—pŠg’£ƒ‰ƒCƒuƒ‰ƒŠ BigDecimal ‚ð쬂µ‚Ü‚µ‚½B
-•s‹ï‡‚╌¾E’ñˆÄ‚ª‚ ‚éꇂǂµ‚Ç‚µA
-<A HREF="mailto:shigeo@tinyforest.gr.jp">shigeo@tinyforest.gr.jp</A>
-‚܂ł¨’m‚点‚­‚¾‚³‚¢B•s‹ï‡‚𒼂·‹C‚͑傢‚É‚ ‚è‚Ü‚·B‚½‚¾AŽžŠÔ‚Ȃǂ̊֌W‚Å–ñ‘©
-‚͂ł«‚Ü‚¹‚ñB‚Ü‚½AŒ‹‰Ê‚ɂ‚¢‚Ä‚à•ÛØ‚Å‚«‚é‚à‚̂ł͂ ‚è‚Ü‚¹‚ñB
-—\‚ßA‚²—¹³‚­‚¾‚³‚¢B
-<BR><BR>
-‚±‚̃vƒƒOƒ‰ƒ€‚ÍAŽ©—R‚É”z•zE‰ü•Ï‚µ‚Ä\‚¢‚Ü‚¹‚ñB‚½‚¾‚µA’˜ìŒ ‚Í•úŠü‚µ‚Ä‚¢‚Ü‚¹‚ñB
-”z•zE‰ü•Ï“™‚ÌŒ —˜‚Í Ruby ‚Ì‚»‚ê‚É€‚¶‚Ü‚·BÚ‚µ‚­‚Í README ‚ð“Ç‚ñ‚Å‚­‚¾‚³‚¢B
-
-<hr>
-<H2>ƒCƒ“ƒXƒg[ƒ‹‚ɂ‚¢‚Ä</H2>
-BigDecimal ‚ðŠÜ‚Þ Ruby ‚ÌÅV”Å‚Í<A HREF="http://www.ruby-lang.org/ja/">RubyŒöŽ®ƒy[ƒW</A>‚©‚çƒ_ƒEƒ“ƒ[ƒh‚Å‚«‚Ü‚·B
-ƒ_ƒEƒ“ƒ[ƒh‚µ‚½ÅV”Å‚ð‰ð“€‚µ‚½‚çA’Êí‚̃Cƒ“ƒXƒg[ƒ‹Žè‡‚ðŽÀs‚µ‚ĉº‚³‚¢B
-Ruby ‚ª³‚µ‚­ƒCƒ“ƒXƒg[ƒ‹‚³‚ê‚ê‚ÎA“¯Žž‚É BigDecimal ‚à—˜—p‚Å‚«‚邿‚¤‚ɂȂé‚Í‚¸‚Å‚·B
-ƒ\[ƒXƒtƒ@ƒCƒ‹‚Í
-bigdecimal.c,bigdecimal.h
-‚Ì‚QŒÂ‚݂̂ł·B<BR>
-
-<hr>
-<A NAME="#SPEC">
-<H2>Žg—p•û–@‚ƃƒ\ƒbƒh‚̈ꗗ</H2>
-uRuby‚ÍŠù‚É‘‚¯‚év‚Æ‚¢‚¤‘O’ñ‚ÅA
-<CODE><PRE>
-require 'bigdecimal'
-a=BigDecimal::new("0.123456789123456789")
-b=BigDecimal("123456.78912345678",40)
-c=a+b
-</PRE></CODE>
-<br>
-‚Æ‚¢‚¤‚悤‚ÈŠ´‚¶‚ÅŽg—p‚µ‚Ü‚·B
-
-<H3>ƒƒ\ƒbƒhˆê——</H3>
-ˆÈ‰º‚̃ƒ\ƒbƒh‚ª—˜—p‰Â”\‚Å‚·B
-u—LŒøŒ…”v‚Æ‚Í BigDecimal ‚ª¸“x‚ð•ÛØ‚·‚錅”‚Å‚·B
-‚Ò‚Á‚½‚è‚ł͂ ‚è‚Ü‚¹‚ñAŽáб‚Ì—]—T‚ðŽ‚Á‚ÄŒvŽZ‚³‚ê‚Ü‚·B
-‚Ü‚½A—Ⴆ‚΂R‚Qƒrƒbƒg‚̃VƒXƒeƒ€‚ł͂P‚Oi‚Å‚SŒ…–ˆ‚ÉŒvŽZ‚µ‚Ü‚·B]‚Á‚ÄAŒ»ó‚Å‚ÍA
-“à•”‚Ìu—LŒøŒ…”v‚Í‚S‚Ì”{”‚ƂȂÁ‚Ä‚¢‚Ü‚·B
-<P>
-ˆÈ‰º‚̃ƒ\ƒbƒhˆÈŠO‚É‚àA(C ‚ł͂Ȃ¢) Ruby ƒ\[ƒX‚ÌŒ`‚Å
-’ñ‹Ÿ‚³‚ê‚Ä‚¢‚é‚à‚Ì‚à‚ ‚è‚Ü‚·B—Ⴆ‚ÎA
-<CODE><PRE>
-require "bigdecimal/math.rb"
-</PRE></CODE>
-‚Æ‚·‚邱‚Æ‚ÅAsin ‚â cos ‚Æ‚¢‚Á‚½ŠÖ”‚ªŽg—p‚Å‚«‚邿‚¤‚ɂȂè‚Ü‚·B
-Žg—p•û–@‚È‚ÇAÚ×‚Í math.rb ‚Ì“à—e‚ðŽQÆ‚µ‚ĉº‚³‚¢B
-
-‚»‚Ì‘¼AFloat ‚Æ‚Ì‘ŠŒÝ•ÏŠ·‚Ȃǂ̃ƒ\ƒbƒh‚ª util.rb ‚ŃTƒ|[ƒg‚³‚ê‚Ä‚¢‚Ü‚·B
-—˜—p‚·‚é‚É‚Í
-<CODE><PRE>
-require "bigdecimal/util.rb"
-</PRE></CODE>
-‚̂悤‚É‚µ‚Ü‚·BÚ×‚Í util.rb ‚Ì“à—e‚ðŽQÆ‚µ‚ĉº‚³‚¢B
-
-<H4><U>ƒNƒ‰ƒXƒƒ\ƒbƒh</U></H4>
-<UL>
-<LI><B>new</B></LI><BLOCKQUOTE>
-V‚µ‚¢ BigDecimal ƒIƒuƒWƒFƒNƒg‚𶬂µ‚Ü‚·B<BR>
-a=BigDecimal::new(s[,n]) ‚Ü‚½‚Í<BR>
-a=BigDecimal(s[,n])<BR>
-s ‚Í”Žš‚ð•\Œ»‚·‚鉊ú’l‚ð•¶Žš—ñ‚ÅŽw’肵‚Ü‚·B
-ƒXƒy[ƒX‚Í–³Ž‹‚³‚ê‚Ü‚·B‚Ü‚½A”»’f‚Å‚«‚È‚¢•¶Žš‚ªoŒ»‚µ‚½Žž“_‚Å
-•¶Žš—ñ‚ÍI—¹‚µ‚½‚à‚̂Ƃ݂Ȃ³‚ê‚Ü‚·B
-n ‚Í•K—v‚È—LŒøŒ…”ia ‚ÌÅ‘å—LŒøŒ…”j‚ð®”‚ÅŽw’肵‚Ü‚·B
-n ‚ª 0 ‚Ü‚½‚ÍÈ—ª‚³‚ꂽ‚Æ‚«‚ÍAn ‚Ì’l‚Í s ‚Ì—LŒøŒ…”‚Ƃ݂Ȃ³‚ê‚Ü‚·B
-s ‚Ì—LŒøŒ…”‚æ‚è n ‚ª¬‚³‚¢‚Æ‚«‚à n=0 ‚̂Ƃ«‚Æ“¯‚¶‚Å‚·B
-a ‚ÌÅ‘å—LŒøŒ…”‚Í n ‚æ‚èŽáб‘å‚¢’l‚ªÌ—p‚³‚ê‚Ü‚·B
-Å‘å—LŒøŒ…”‚͈ȉº‚̂悤‚ÈŠ„‚èŽZ‚ðŽÀs‚·‚邯‚«“™‚ɈӖ¡‚ðŽ‚¿‚Ü‚·B
-<CODE><PRE>
-BigDecimal("1") / BigDecimal("3") # => 0.3333333333 33E0
-BigDecimal("1",10) / BigDecimal("3",10) # => 0.3333333333 3333333333 33333333E0
-</PRE></CODE>
-‚½‚¾‚µAŒÂX‚̉‰ŽZ‚É‚¨‚¯‚éÅ‘å—LŒøŒ…” n ‚ÌŽæ‚舵‚¢‚Í«—ˆ‚̃o[ƒWƒ‡ƒ“‚Å
-Žáб•ÏX‚³‚ê‚é‰Â”\«‚ª‚ ‚è‚Ü‚·B
-</BLOCKQUOTE>
-
-<LI><B>mode</B></LI><BLOCKQUOTE>
-f = BigDecimal.mode(s[,v])<BR>
-BigDecimal‚ÌŽÀsŒ‹‰Ê‚ð§Œä‚µ‚Ü‚·B‘æ‚Qˆø”‚ðÈ—ªA‚Ü‚½‚Í nil ‚ðŽw’è‚·‚邯
-Œ»ó‚ÌÝ’è’l‚ª–ß‚è‚Ü‚·B<BR>
-ˆÈ‰º‚ÌŽg—p•û–@‚ª’è‹`‚³‚ê‚Ä‚¢‚Ü‚·B
-<P>
-<B>[—áŠOˆ—]</B><P>
-ŒvŽZŒ‹‰Ê‚ª”ñ”(NaN)‚âƒ[ƒ‚É‚æ‚霎Z‚ɂȂÁ‚½‚Æ‚«‚̈—‚ð’è‹`‚·‚邱‚Æ‚ª‚Å‚«‚Ü‚·B
-<BLOCKQUOTE>
-f = BigDecimal::mode(BigDecimal::EXCEPTION_NaN,flag)<BR>
-f = BigDecimal::mode(BigDecimal::EXCEPTION_INFINITY,flag)<BR>
-f = BigDecimal::mode(BigDecimal::EXCEPTION_UNDERFLOW,flag)<BR>
-f = BigDecimal::mode(BigDecimal::EXCEPTION_OVERFLOW,flag)<BR>
-f = BigDecimal::mode(BigDecimal::EXCEPTION_ZERODIVIDE,flag)<BR>
-f = BigDecimal::mode(BigDecimal::EXCEPTION_ALL,flag)<BR>
-</BLOCKQUOTE>
-
-EXCEPTION_NaN ‚ÍŒ‹‰Ê‚ª NaN ‚ɂȂÁ‚½‚Æ‚«‚ÌŽw’è‚Å‚·B<BR>
-EXCEPTION_INFINITY ‚ÍŒ‹‰Ê‚ª–³ŒÀ‘å(}Infinity)‚ɂȂÁ‚½‚Æ‚«‚ÌŽw’è‚Å‚·B<BR>
-EXCEPTION_UNDERFLOW ‚ÍŽw”•”‚ªƒAƒ“ƒ_[ƒtƒ[‚·‚邯‚«‚ÌŽw’è‚Å‚·B<BR>
-EXCEPTION_OVERFLOW ‚ÍŽw”•”‚ªƒI[ƒo[ƒtƒ[‚·‚邯‚«‚ÌŽw’è‚Å‚·B<BR>
-EXCEPTION_ZERODIVIDE ‚̓[ƒ‚É‚æ‚銄‚èŽZ‚ðŽÀs‚µ‚½‚Æ‚«‚ÌŽw’è‚Å‚·B<BR>
-EXCEPTION_ALL ‚ÍA‰Â”\‚È‘S‚Ăɑ΂µ‚Ĉꊇ‚µ‚ÄÝ’è‚·‚邯‚«‚ÉŽg—p‚µ‚Ü‚·B<BR><BR>
-
-flag ‚ª true ‚̂Ƃ«‚ÍAŽw’肵‚½ó‘ԂɂȂÁ‚½‚Æ‚«‚É—áŠO‚ð”­s‚·‚邿‚¤‚ɂȂè‚Ü‚·B<BR>
-flag ‚ª falseiƒfƒtƒHƒ‹ƒgj‚È‚çA—áŠO‚Í”­s‚³‚ê‚Ü‚¹‚ñBŒvŽZŒ‹‰Ê‚͈ȉº‚̂悤‚ɂȂè‚Ü‚·B<BR>
-<BLOCKQUOTE>
-EXCEPTION_NaN ‚̂Ƃ«A”ñ”(NaN)<BR>
-EXCEPTION_INFINITY ‚̂Ƃ«A–³ŒÀ(+ or -Infinity)<BR>
-EXCEPTION_UNDERFLOW ‚̂Ƃ«Aƒ[ƒ<BR>
-EXCEPTION_OVERFLOW ‚̂Ƃ«A+Infinity ‚© -Infinity<BR>
-EXCEPTION_ZERODIVIDE ‚̂Ƃ«A+Infinity ‚© -Infinity<BR>
-</BLOCKQUOTE>
-EXCEPTION_INFINITYAEXCEPTION_OVERFLOWAEXCEPTION_ZERODIVIDE
-‚Í¡‚̂Ƃ±‚듯‚¶‚Å‚·B<BR>
-–ß‚è’l‚ÍAÝ’èŒã‚Ì’l‚Å‚·Bu’lv‚̈Ӗ¡‚ÍA—Ⴆ‚Î
-BigDecimal::EXCEPTION_NaN‚Æu’lv‚Ì & ‚ª ƒ[ƒˆÈŠO‚È‚ç‚Î
-EXCEPTION_NaN‚ªÝ’肳‚ê‚Ä‚¢‚邯‚¢‚¤ˆÓ–¡‚Å‚·B
-
-<P>
-<B>[ŠÛ‚߈—Žw’è]</B><P>
-ŒvŽZ“r’†‚ÌŠÛ‚ß‘€ì‚ÌŽw’肪‚Å‚«‚Ü‚·B
-<BLOCKQUOTE>
-f = BigDecimal::mode(BigDecimal::ROUND_MODE,flag)
-</BLOCKQUOTE>
-‚ÌŒ`Ž®‚ÅŽw’肵‚Ü‚·B<BR>
-‚±‚±‚ÅAflag ‚͈ȉº(ЇŒÊ“à‚͑Ήž‚·‚éƒCƒ“ƒXƒ^ƒ“ƒXƒƒ\ƒbƒh)‚̈ê‚‚ðŽw’肵‚Ü‚·B
-<TABLE>
-<TR><TD>ROUND_UP</TD><TD>‘S‚ÄØ‚èã‚°‚Ü‚·B</TD></TR>
-<TR><TD>ROUND_DOWN</TD><TD>‘S‚ÄØ‚èŽÌ‚Ă܂·(truncate)B</TD></TR>
-<TR><TD>ROUND_HALF_UP</TD><TD>ŽlŽÌŒÜ“ü‚µ‚Ü‚·(ƒfƒtƒHƒ‹ƒg)B</TD></TR>
-<TR><TD>ROUND_HALF_DOWN</TD><TD>ŒÜŽÌ˜Z“ü‚µ‚Ü‚·B</TD></TR>
-<TR><TD>ROUND_HALF_EVEN</TD><TD>ŽlŽÌ˜Z“ü‚µ‚Ü‚·B‚T‚ÌŽž‚ÍãˆÊ‚PŒ…‚ªŠï”‚ÌŽž‚̂݌J‚èã‚°‚Ü‚·(Banker's rounding)B</TD></TR>
-<TR><TD>ROUND_CEILING</TD><TD>”’l‚̑傫‚¢•û‚ÉŒJ‚èã‚°‚Ü‚·(ceil)B</TD></TR>
-<TR><TD>ROUND_FLOOR</TD><TD>”’l‚̬‚³‚¢•û‚ÉŒJ‚艺‚°‚Ü‚·(floor)B</TD></TR>
-
-</TABLE>
-–ß‚è’l‚ÍŽw’èŒã‚Ì flag ‚Ì’l‚Å‚·B
-‘æ‚Qˆø”‚É nil ‚ðŽw’è‚·‚邯AŒ»ó‚ÌÝ’è’l‚ª•Ô‚è‚Ü‚·B
-mode ƒƒ\ƒbƒh‚ł͊ۂߑ€ì‚̈ʒu‚ðƒ†[ƒU‚ªŽw’è‚·‚邱‚Ƃ͂ł«‚Ü‚¹‚ñB
-ŠÛ‚ß‘€ì‚ƈʒu‚ðŽ©•ª‚ŧŒä‚µ‚½‚¢ê‡‚Í BigDecimal::limit ‚â truncate/round/ceil/floorA
-add/sub/mult/div ‚Æ‚¢‚Á‚½ƒCƒ“ƒXƒ^ƒ“ƒXƒƒ\ƒbƒh‚ðŽg—p‚µ‚ĉº‚³‚¢B
-</BLOCKQUOTE>
-<LI><B>limit([n])</B></LI><BLOCKQUOTE>
-¶¬‚³‚ê‚éBigDecimalƒIƒuƒWƒFƒNƒg‚Ìő包”‚ðnŒ…‚ɧŒÀ‚µ‚Ü‚·B
-–ß‚è’l‚ÍÝ’è‚·‚é‘O‚Ì’l‚Å‚·BÝ’è’l‚̃fƒtƒHƒ‹ƒg’l‚Í‚O‚ÅAŒ…”–³§ŒÀ‚Æ‚¢‚¤ˆÓ–¡‚Å‚·B
-n ‚ðŽw’肵‚È‚¢A‚Ü‚½‚Í n ‚ª nil ‚ÌꇂÍAŒ»ó‚Ìő包”‚ª•Ô‚è‚Ü‚·B<BR>
-ŒvŽZ‚ð‘±s‚·‚éŠÔ‚ÉA”Žš‚ÌŒ…”‚ª–³§ŒÀ‚É‘‚¦‚Ä‚µ‚Ü‚¤‚悤‚Èê‡
- limit ‚Å—\‚ߌ…”‚ð§ŒÀ‚Å‚«‚Ü‚·B‚±‚Ìê‡ BigDecimal.mode ‚ÅŽw’肳‚ꂽ
-ŠÛ‚߈—‚ªŽÀs‚³‚ê‚Ü‚·B
-‚½‚¾‚µAƒCƒ“ƒXƒ^ƒ“ƒXƒƒ\ƒbƒh (truncate/round/ceil/floor/add/sub/mult/div) ‚Ì
-Œ…”§ŒÀ‚Í limit ‚æ‚è—D悳‚ê‚Ü‚·B<BR>
-mf = BigDecimal::limit(n)<BR>
-</BLOCKQUOTE>
-
-<LI><B>double_fig</B></LI><BLOCKQUOTE>
-Ruby ‚Ì Float ƒNƒ‰ƒX‚ª•ÛŽ‚Å‚«‚é—LŒø”Žš‚Ì”‚ð•Ô‚µ‚Ü‚·B
-<CODE><PRE>
- p BigDecimal::double_fig # ==> 20 (depends on the CPU etc.)
-</PRE></CODE>
-double_fig‚͈ȉº‚Ì C ƒvƒƒOƒ‰ƒ€‚ÌŒ‹‰Ê‚Æ“¯‚¶‚Å‚·B
-<CODE><PRE>
- double v = 1.0;
- int double_fig = 0;
- while(v + 1.0 > 1.0) {
- ++double_fig;
- v /= 10;
- }
-</PRE></CODE>
-</BLOCKQUOTE>
-
-<LI><B>BASE</B></LI><BLOCKQUOTE>
-“à•”‚ÅŽg—p‚³‚ê‚éŠî”‚Ì’l‚Å‚·B®”‚ª 32 ƒrƒbƒg‚̈—Œn‚Å‚Í10000‚Å‚·B<BR>
-b = BigDecimal::BASE<BR>
-</BLOCKQUOTE>
-</UL>
-
-<H4><U>ƒCƒ“ƒXƒ^ƒ“ƒXƒƒ\ƒbƒh</U></H4>
-<UL>
-<LI><B>+</B></LI><BLOCKQUOTE>
-‰ÁŽZic = a + bj<BR>
-c ‚̸“x‚ɂ‚¢‚Ä‚Íu<A HREF="#PREC">ŒvŽZ¸“x‚ɂ‚¢‚Ä</A>v‚ðŽQÆ‚µ‚Ä‚­‚¾‚³‚¢B
-</BLOCKQUOTE>
-
-<LI><B>-</B></LI><BLOCKQUOTE>
-Œ¸ŽZic = a - bjA‚Ü‚½‚Í•„†”½“]ic = -aj<BR>
-c ‚̸“x‚ɂ‚¢‚Ä‚Íu<A HREF="#PREC">ŒvŽZ¸“x‚ɂ‚¢‚Ä</A>v‚ðŽQÆ‚µ‚Ä‚­‚¾‚³‚¢B
-
-</BLOCKQUOTE>
-<LI><B>*</B></LI><BLOCKQUOTE>
-æŽZ(c = a * b)<BR>
-c‚̸“x‚Í(a‚̸“x)+(b‚̸“x)’ö“x‚Å‚·B<br>
-Ú‚µ‚­‚Íu<A HREF="#PREC">ŒvŽZ¸“x‚ɂ‚¢‚Ä</A>v‚ðŽQÆ‚µ‚Ä‚­‚¾‚³‚¢B
-
-</BLOCKQUOTE>
-<LI><B>/</B></LI><BLOCKQUOTE>
-œŽZ(c = a / b)<BR>
-c ‚̸“x‚ɂ‚¢‚Ä‚Íu<A HREF="#PREC">ŒvŽZ¸“x‚ɂ‚¢‚Ä</A>v‚ðŽQÆ‚µ‚Ä‚­‚¾‚³‚¢B
-
-</BLOCKQUOTE>
-
-<LI><B>add(b,n)</B></LI><BLOCKQUOTE>
-ˆÈ‰º‚̂悤‚ÉŽg—p‚µ‚Ü‚·B<BR>
-c = a.add(b,n)<BR>
-c = a + b ‚ðÅ‘å‚Å n Œ…‚܂ŌvŽZ‚µ‚Ü‚·B<BR>
-a + b ‚̸“x‚ª n ‚æ‚è‘å‚«‚¢‚Æ‚«‚Í BigDecimal.mode ‚ÅŽw’肳‚ꂽ•û–@‚ÅŠÛ‚ß‚ç‚ê‚Ü‚·B<BR>
-n ‚ªƒ[ƒ‚È‚ç + ‚Æ“¯‚¶‚Å‚·B
-</BLOCKQUOTE>
-<LI><B>sub(b,n)</B></LI><BLOCKQUOTE>
-ˆÈ‰º‚̂悤‚ÉŽg—p‚µ‚Ü‚·B<BR>
-c = a.sub(b,n)<BR>
-c = a - b ‚ðÅ‘å‚Å n Œ…‚܂ŌvŽZ‚µ‚Ü‚·B<BR>
-a - b ‚̸“x‚ª n ‚æ‚è‘å‚«‚¢‚Æ‚«‚Í BigDecimal.mode ‚ÅŽw’肳‚ꂽ•û–@‚ÅŠÛ‚ß‚ç‚ê‚Ü‚·B<BR>
-n ‚ªƒ[ƒ‚È‚ç - ‚Æ“¯‚¶‚Å‚·B
-
-</BLOCKQUOTE>
-<LI><B>mult(b,n)</B></LI><BLOCKQUOTE>
-ˆÈ‰º‚̂悤‚ÉŽg—p‚µ‚Ü‚·B<BR>
-c = a.mult(b,n)<BR>
-c = a * b ‚ðÅ‘å‚Å n Œ…‚܂ŌvŽZ‚µ‚Ü‚·B<BR>
-a * b ‚̸“x‚ª n ‚æ‚è‘å‚«‚¢‚Æ‚«‚Í BigDecimal.mode ‚ÅŽw’肳‚ꂽ•û–@‚ÅŠÛ‚ß‚ç‚ê‚Ü‚·B<BR>
-n ‚ªƒ[ƒ‚È‚ç * ‚Æ“¯‚¶‚Å‚·B
-
-</BLOCKQUOTE>
-<LI><B>div(b[,n])</B></LI><BLOCKQUOTE>
-ˆÈ‰º‚̂悤‚ÉŽg—p‚µ‚Ü‚·B<BR>
-c = a.div(b,n)<BR>
-c = a / b ‚ðÅ‘å‚Å n Œ…‚܂ŌvŽZ‚µ‚Ü‚·B
-a / b ‚̸“x‚ª n ‚æ‚è‘å‚«‚¢‚Æ‚«‚Í BigDecimal.mode ‚ÅŽw’肳‚ꂽ•û–@‚ÅŠÛ‚ß‚ç‚ê‚Ü‚·B<BR>
-n ‚ªƒ[ƒ‚È‚ç / ‚Æ“¯‚¶‚Å‚·B<BR>
-n ‚ªÈ—ª‚³‚ꂽ‚Æ‚«‚Í Float#div ‚Æ“¯—l‚ÉŒ‹‰Ê‚ª®”(BigDecimal)‚ɂȂè‚Ü‚·B
-</BLOCKQUOTE>
-
-<LI><B>fix</B></LI><BLOCKQUOTE>
-a ‚̬”“_ˆÈ‰º‚ÌØ‚èŽÌ‚ÄB<BR>
-c = a.fix
-</BLOCKQUOTE>
-<LI><B>frac</B></LI><BLOCKQUOTE>
-a ‚Ì®”•”•ª‚ÌØ‚èŽÌ‚ÄB<BR>
-c = a.frac
-</BLOCKQUOTE>
-
-<LI><B>floor[(n)]</B></LI><BLOCKQUOTE>
-c = a.floor<BR>
-a ˆÈ‰º‚Ìő宔iBigDecimal ’lj‚ð•Ô‚µ‚Ü‚·B
-<CODE><PRE>
-c = BigDecimal("1.23456").floor # ==> 1
-c = BigDecimal("-1.23456").floor # ==> -2
-</PRE></CODE>
-ˆÈ‰º‚̂悤‚Ɉø” n ‚ð—^‚¦‚邱‚Æ‚à‚Å‚«‚Ü‚·B<BR>
-n>=0 ‚È‚çA¬”“_ˆÈ‰º n+1 ˆÊ‚Ì”Žš‚ð‘€ì‚µ‚Ü‚·(­”“_ˆÈ‰º‚ðAÅ‘å n Œ…‚É‚µ‚Ü‚·)B<BR>
-n ‚ª•‰‚̂Ƃ«‚ͬ”“_ˆÈã n Œ…–Ú‚ð‘€ì‚µ‚Ü‚·(¬”“_ˆÊ’u‚©‚ç¶‚É­‚È‚­‚Æ‚à n ŒÂ‚Ì 0 ‚ª•À‚т܂·)B<BR>
-<CODE><PRE>
- c = BigDecimal("1.23456").floor(4) # ==> 1.2345
- c = BigDecimal("15.23456").floor(-1) # ==> 10.0
-</PRE></CODE>
-
-</BLOCKQUOTE>
-<LI><B>ceil[(n)]</B></LI><BLOCKQUOTE>
-c = a.ceil<BR>
-a ˆÈã‚Ì®”‚Ì‚¤‚¿Ałଂ³‚¢®”‚ðŒvŽZ‚µA‚»‚Ì’liBigDecimal ’lj‚ð•Ô‚µ‚Ü‚·B
-<CODE><PRE>
-c = BigDecimal("1.23456").ceil # ==> 2
-c = BigDecimal("-1.23456").ceil # ==> -1
-</PRE></CODE>
-
-ˆÈ‰º‚̂悤‚Ɉø”‚ð—^‚¦‚ÄA¬”“_ˆÈ‰º n+1 ˆÊ‚Ì”Žš‚ð‘€ì‚·‚邱‚Æ‚à‚Å‚«‚Ü‚·B<BR>
-n>=0 ‚È‚çA¬”“_ˆÈ‰º n+1 ˆÊ‚Ì”Žš‚ð‘€ì‚µ‚Ü‚·(­”“_ˆÈ‰º‚ðAÅ‘å n Œ…‚É‚µ‚Ü‚·)B<BR>
- n ‚ª•‰‚̂Ƃ«‚ͬ”“_ˆÈã n Œ…–Ú‚ð‚ð‘€ì‚µ‚Ü‚·(¬”“_ˆÊ’u‚©‚ç¶‚É­‚È‚­‚Æ‚à n ŒÂ‚Ì 0 ‚ª•À‚т܂·)B<BR>
-<CODE><PRE>
- c = BigDecimal("1.23456").ceil(4) # ==> 1.2346
- c = BigDecimal("15.23456").ceil(-1) # ==> 20.0
-</PRE></CODE>
-
-</BLOCKQUOTE>
-<LI><B>round[(n[,b])]</B></LI><BLOCKQUOTE>
-c = a.round<BR>
-
-ƒNƒ‰ƒXƒƒ\ƒbƒh BigDecimal::mode(BigDecimal::ROUND_MODE,flag) ‚ÅŽw’肵‚½
-ROUND_MODE ‚É]‚Á‚ÄŠÛ‚ß‘€ì‚ðŽÀs‚µ‚Ü‚·B
-BigDecimal::mode(BigDecimal::ROUND_MODE,flag) ‚ʼn½‚àŽw’肹‚¸A‚©‚ÂAˆø”
-‚ðŽw’肵‚È‚¢ê‡‚Íu¬”“_ˆÈ‰º‘æˆêˆÊ‚Ì”‚ðŽlŽÌŒÜ“ü‚µ‚Ä®”iBigDecimal ’ljv‚É‚µ‚Ü‚·B<BR>
-<CODE><PRE>
- c = BigDecimal("1.23456").round # ==> 1
- c = BigDecimal("-1.23456").round # ==> -1
-</PRE></CODE>
-
-ˆÈ‰º‚̂悤‚Ɉø”‚ð—^‚¦‚ÄA¬”“_ˆÈ‰º n+1 ˆÊ‚Ì”Žš‚ð‘€ì‚·‚邱‚Æ‚à‚Å‚«‚Ü‚·B<BR>
-n ‚ª³‚ÌŽž‚ÍA¬”“_ˆÈ‰º n+1 ˆÊ‚Ì”Žš‚ðŠÛ‚߂܂·(­”“_ˆÈ‰º‚ðAÅ‘å n Œ…‚É‚µ‚Ü‚·)B<BR>
-n ‚ª•‰‚̂Ƃ«‚ͬ”“_ˆÈã n Œ…–Ú‚ðŠÛ‚߂܂·(¬”“_ˆÊ’u‚©‚ç¶‚É­‚È‚­‚Æ‚à n ŒÂ‚Ì 0 ‚ª•À‚т܂·)B
-<CODE><PRE>
-c = BigDecimal("1.23456").round(4) # ==> 1.2346
-c = BigDecimal("15.23456").round(-1) # ==> 20.0
-</PRE></CODE>
-‚Q”Ԗڂ̈ø”‚ðŽw’è‚·‚邯ABigDecimal#mode ‚ÌŽw’è‚𖳎‹‚µ‚ÄAŽw’肳‚ꂽ•û–@‚Å
-ŠÛ‚ß‘€ì‚ðŽÀs‚µ‚Ü‚·B
-<CODE><PRE>
-c = BigDecimal("1.23456").round(3,BigDecimal::ROUND_HALF_EVEN) # ==> 1.234
-c = BigDecimal("1.23356").round(3,BigDecimal::ROUND_HALF_EVEN) # ==> 1.234
-</PRE></CODE>
-
-</BLOCKQUOTE>
-<LI><B>truncate</B></LI><BLOCKQUOTE>
-c = a.truncate<BR>
-¬”“_ˆÈ‰º‚Ì”‚ðØ‚èŽÌ‚ĂĮ”iBigDecimal ’lj‚É‚µ‚Ü‚·B<BR>
-ˆÈ‰º‚̂悤‚Ɉø”‚ð—^‚¦‚ÄA¬”“_ˆÈ‰º n+1 ˆÊ‚Ì”Žš‚ð‘€ì‚·‚邱‚Æ‚à‚Å‚«‚Ü‚·B<BR>
-n ‚ª³‚ÌŽž‚ÍA¬”“_ˆÈ‰º n+1 ˆÊ‚Ì”Žš‚ðØ‚èŽÌ‚Ă܂·(­”“_ˆÈ‰º‚ðAÅ‘å n Œ…‚É‚µ‚Ü‚·)B
-n ‚ª•‰‚̂Ƃ«‚ͬ”“_ˆÈã n Œ…–Ú‚ð‚ð‘€ì‚µ‚Ü‚·(¬”“_ˆÊ’u‚©‚ç¶‚É­‚È‚­‚Æ‚à n ŒÂ‚Ì 0 ‚ª•À‚т܂·)B<BR>
-<CODE><PRE>
-c = BigDecimal("1.23456").truncate(4) # ==> 1.2345
-c = BigDecimal("15.23456").truncate(-1) # ==> 10.0
-</PRE></CODE>
-</BLOCKQUOTE>
-
-</BLOCKQUOTE>
-<LI><B>abs</B></LI><BLOCKQUOTE>
-‚‚Ìâ‘Î’l<BR>
-c = a.abs<BR>
-
-</BLOCKQUOTE>
-<LI><B>to_i</B></LI><BLOCKQUOTE>
-­”“_ˆÈ‰º‚ðØ‚èŽÌ‚ĂĮ”‚ɕϊ·‚µ‚Ü‚·B<BR>
-i = a.to_i<BR>
-i ‚Í’l‚ɉž‚¶‚Ä Fixnum ‚© Bignum ‚ɂȂè‚Ü‚·B
-a ‚ª Infinity ‚â NaN ‚̂Ƃ«Ai ‚Í nil ‚ɂȂè‚Ü‚·B
-</BLOCKQUOTE>
-<LI><B>to_f</B></LI><BLOCKQUOTE>
-Float ƒIƒuƒWƒFƒNƒg‚ɕϊ·‚µ‚Ü‚·B
-‚æ‚è‚«‚ßׂ©‚¢’l‚ª•K—v‚È‚ç‚Î split ƒƒ\ƒbƒh‚ð—˜—p‚µ‚Ä
-‚­‚¾‚³‚¢B
-</BLOCKQUOTE>
-<LI><B>to_s[(n)]</B></LI><BLOCKQUOTE>
-•¶Žš—ñ‚ɕϊ·‚µ‚Ü‚·(ƒfƒtƒHƒ‹ƒg‚Í "0.xxxxxEn" ‚ÌŒ`‚ɂȂè‚Ü‚·jB
-<CODE><PRE>
-BigDecimal("1.23456").to_s # ==> "0.123456E1"
-</PRE></CODE>
-ˆø” n ‚ɳ‚Ì®”‚ªŽw’肳‚ꂽ‚Æ‚«‚ÍA­”“_‚Å•ª‚¯‚ç‚ê‚鶉E•”•ª‚ðA‚»‚ꂼ‚ê n Œ…–ˆ
-‚É‹ó”’‚Å‹æØ‚è‚Ü‚·B
-<CODE><PRE>
-BigDecimal("0.1234567890123456789").to_s(10) # ==> "0.1234567890 123456789E0"
-</PRE></CODE>
-ˆø” n ‚ɳ‚Ì®”‚ð•\‚·•¶Žš—ñ‚ðŽw’è‚·‚邱‚Æ‚à‚Å‚«‚Ü‚·B
-<CODE><PRE>
-BigDecimal("0.1234567890123456789").to_s("10") # ==> "0.1234567890 123456789E0"
-</PRE></CODE>
-•¶Žš—ñ‚Ìʼn‚É '+'i‚Ü‚½‚Í ' 'j‚ð•t‚¯‚邯A’l‚ª³‚Ìê‡A擪‚É '+'i‚Ü‚½‚Í ' 'j‚ª•t‚«‚Ü‚·
-i•‰‚ÌꇂÍAí‚É '-' ‚ª•t‚«‚Ü‚·BjB
-<CODE><PRE>
-BigDecimal("0.1234567890123456789").to_s(" 10") # ==> " 0.1234567890 123456789E0"
-BigDecimal("0.1234567890123456789").to_s("+10") # ==> "+0.1234567890 123456789E0"
-BigDecimal("-0.1234567890123456789").to_s("10") # ==> "-0.1234567890 123456789E0"
-</PRE></CODE>
-
-‚³‚ç‚É•¶Žš—ñ‚ÌÅŒã‚É E(‚Ü‚½‚Í e) ‚© F(‚Ü‚½‚Í f) ‚ðŽw’è‚·‚邱‚Æ‚ÅAˆÈ‰º‚̂悤‚É
-•\ަŒ`Ž®‚ð•ÏX‚·‚邱‚Æ‚ª‚Å‚«‚Ü‚·B
-<CODE><PRE>
-BigDecimal("1234567890.123456789").to_s("E") # ==> "0.1234567890123456789E10"
-BigDecimal("1234567890.123456789").to_s("F") # ==> "1234567890.123456789"
-BigDecimal("1234567890.123456789").to_s("5E") # ==> "0.12345 67890 12345 6789E10"
-BigDecimal("1234567890.123456789").to_s("5F") # ==> "12345 67890.12345 6789"
-</PRE></CODE>
-
-</BLOCKQUOTE>
-<LI><B>exponent</B></LI><BLOCKQUOTE>
-Žw”•”‚ð®”’l‚ŕԂµ‚Ü‚·B
-n = a.exponent <BR>
-‚Í a ‚Ì’l‚ª 0.xxxxxxx*10**n ‚ðˆÓ–¡‚µ‚Ü‚·B
-</BLOCKQUOTE>
-
-<LI><B>precs</B></LI><BLOCKQUOTE>
-n,m = a.precs<BR>
-a ‚Ì—LŒø”Žš (n) ‚ÆÅ‘å—LŒø”Žš (m) ‚Ì”z—ñ‚ð•Ô‚µ‚Ü‚·B
-
-</BLOCKQUOTE>
-
-<LI><B>sign</B></LI><BLOCKQUOTE>
-’l‚ª³(sign &gt; 0)A•‰(sign &lt; 0)A‚»‚Ì‘¼(sigh==0)‚Å‚ ‚é‚©‚Ìî•ñ‚ð•Ô‚µ‚Ü‚·B
-n = a.sign <BR>
-‚Æ‚µ‚½‚Æ‚« n ‚Ì’l‚Í a ‚ªˆÈ‰º‚̂Ƃ«‚ðˆÓ–¡‚µ‚Ü‚·B<BR>
-() ‚Ì’†‚Ì”Žš‚ÍAŽÀÛ‚Ì’l‚Å‚·(<A HREF="#STRUCT">u“à•”\‘¢v</A>‚ðŽQÆ)B<BR>
-n = BigDecimal::SIGN_NaN(0) : a ‚Í NaN<BR>
-n = BigDecimal::SIGN_POSITIVE_ZERO(1) : a ‚Í +0<BR>
-n = BigDecimal::SIGN_NEGATIVE_ZERO(-1) : a ‚Í -0<BR>
-n = BigDecimal::SIGN_POSITIVE_FINITE(2) : a ‚ͳ‚Ì’l<BR>
-n = BigDecimal::SIGN_NEGATIVE_FINITE(-2) : a ‚Í•‰‚Ì’l<BR>
-n = BigDecimal::SIGN_POSITIVE_INFINITE(3) : a ‚Í+Infinity<BR>
-n = BigDecimal::SIGN_NEGATIVE_INFINITE(-3) : a ‚Í-Infinity<BR>
-
-</BLOCKQUOTE>
-<LI><B>nan?</B></LI><BLOCKQUOTE>
-a.nan? ‚Í a ‚ªNaN‚̂Ƃ«^‚ð•Ô‚µ‚Ü‚·B
-</BLOCKQUOTE>
-<LI><B>infinite?</B></LI><BLOCKQUOTE>
-a.infinite? ‚Í a ‚ª+‡‚̂Ƃ« 1 A-‡‚̂Ƃ«‚Í -1A‚»‚êˆÈŠO‚̂Ƃ«‚Í nil ‚ð•Ô‚µ‚Ü‚·B
-</BLOCKQUOTE>
-<LI><B>finite?</B></LI><BLOCKQUOTE>
-a.finite? ‚Í a ‚ª‡‚Ü‚½‚Í NaN ‚łȂ¢‚Æ‚«^‚ð•Ô‚µ‚Ü‚·B
-</BLOCKQUOTE>
-
-<LI><B>zero?</B></LI><BLOCKQUOTE>
-a ‚ª 0 ‚È‚ç true ‚ɂȂè‚Ü‚·B<BR>
-c = a.zero?
-</BLOCKQUOTE>
-<LI><B>nonzero?</B></LI><BLOCKQUOTE>
-a ‚ª 0 ‚È‚ç nilA0 ˆÈŠO‚È‚ç a ‚»‚Ì‚à‚Ì‚ª•Ô‚è‚Ü‚·B<BR>
-c = a.nonzero?
-
-</BLOCKQUOTE>
-<LI><B>split</B></LI><BLOCKQUOTE>
-BigDecimal ’l‚ð 0.xxxxxxx*10**n ‚Æ•\Œ»‚µ‚½‚Æ‚«‚ÉA•„†iNaN‚̂Ƃ«‚Í
-0A‚»‚êˆÈŠO‚Í+1‚©-1‚ɂȂè‚Ü‚·jA
-‰¼”•”•ª‚Ì•¶Žš—ñi"xxxxxxx"j‚ÆAŠî”i10jAX‚ÉŽw” n ‚ð”z—ñ‚Å
-•Ô‚µ‚Ü‚·B<BR>
-a=BigDecimal::new("3.14159265")<BR>
-f,x,y,z = a.split<BR>
-‚Æ‚·‚邯Af=+1Ax="314159265"Ay=10Az=1‚ɂȂè‚Ü‚·B<BR>
-]‚Á‚ÄA<BR>
-s = "0."+x<BR>
-b = f*(s.to_f)*(y**z)<BR>
-‚Å Float ‚ɕϊ·‚·‚邱‚Æ‚ª‚Å‚«‚Ü‚·B
-</BLOCKQUOTE>
-<LI><B>inspect</B></LI><BLOCKQUOTE>
-ƒfƒoƒbƒOo—͂Ɏg—p‚³‚ê‚Ü‚·B<BR>
-p a=BigDecimal::new("3.14",10)<BR>
-‚Æ‚·‚邯A[0x112344:'0.314E1',4(12)]‚̂悤‚Éo—Í‚³‚ê‚Ü‚·B
-ʼn‚Ì16i”‚̓IƒuƒWƒFƒNƒg‚̃AƒhƒŒƒXAŽŸ‚Ì '0.314E1' ‚Í’lA
-ŽŸ‚Ì4‚ÍŒ»Ý‚Ì—LŒøŒ…”(•\ަ‚æ‚èŽáб‘å‚«‚¢‚±‚Æ‚ª‚ ‚è‚Ü‚·)A
-ÅŒã‚̓IƒuƒWƒFƒNƒg‚ªŽæ‚蓾‚éő包”‚ɂȂè‚Ü‚·B
-</BLOCKQUOTE>
-<LI><B>**</B></LI><BLOCKQUOTE>
-a ‚Ì n æ‚ðŒvŽZ‚µ‚Ü‚·B‚Ž‚Í®”B<BR>
-c = a ** n<BR>
-Œ‹‰Ê‚Æ‚µ‚Ä c ‚Ì—LŒøŒ…‚Í a ‚Ì n ”{ˆÈã‚ɂȂé‚̂ŒˆÓB
-</BLOCKQUOTE>
-<LI><B>power</B></LI><BLOCKQUOTE>
-** ‚Æ“¯‚¶‚ÅAa ‚Ì n æ‚ðŒvŽZ‚µ‚Ü‚·B‚Ž‚Í®”B<BR>
-c = a.power(n)<BR>
-Œ‹‰Ê‚Æ‚µ‚Ä c ‚Ì—LŒøŒ…‚Í a ‚Ì n ”{ˆÈã‚ɂȂé‚̂ŒˆÓB
-</BLOCKQUOTE>
-<LI><B>sqrt</B></LI><BLOCKQUOTE>
-a‚Ì—LŒøŒ… n Œ…‚Ì•½•ûªin ‚Ì•½•ûª‚ł͂ ‚è‚Ü‚¹‚ñj‚ð
-ƒjƒ…[ƒgƒ“–@‚ÅŒvŽZ‚µ‚Ü‚·B<BR>
-c = a.sqrt(n)<BR>
-</BLOCKQUOTE>
-
-<LI><B>divmod,quo,modulo,%,remainder</B></LI><BLOCKQUOTE>
-Úׂ͑Ήž‚·‚é Float ‚ÌŠeƒƒ\ƒbƒh‚ðŽQÆ‚µ‚ĉº‚³‚¢B
-</BLOCKQUOTE>
-
-<LI><B>&lt=&gt</B></LI><BLOCKQUOTE>
-a==b ‚È‚ç 0Aa &gt b ‚È‚ç 1Aa &lt b ‚È‚ç -1 ‚ɂȂè‚Ü‚·B<BR>
-c = a &lt=&gt b
-</BLOCKQUOTE>
-</UL>
-Œã‚ÍA“Ç‚ñ‚ÅŽš‚Ì”@‚­‚Å‚·B<BR>
-<UL>
-<LI><B>==</B></LI>
-<LI><B>===</B></LI>
-u==v‚Æ“¯‚¶‚Å‚·‚ª case •¶‚ÅŽg—p‚³‚ê‚Ü‚·B
-<LI><B>!=</B></LI>
-<LI><B>&lt</B></LI>
-<LI><B>&lt=</B></LI>
-<LI><B>&gt</B></LI>
-<LI><B>&gt=</B></LI>
-</UL>
-
-<H3>coerce‚ɂ‚¢‚Ä</H3>
-BigDecimal ƒIƒuƒWƒFƒNƒg‚ªŽZp‰‰ŽZŽq‚̶‚É‚ ‚邯‚«‚ÍABigDecimal ƒIƒuƒWƒFƒNƒg‚ª
-‰E‚É‚ ‚éƒIƒuƒWƒFƒNƒg‚ð(•K—v‚È‚ç) BigDecimal ‚ɕϊ·‚µ‚Ä‚©‚çŒvŽZ‚µ‚Ü‚·B
-]‚Á‚ÄABigDecimal ƒIƒuƒWƒFƒNƒgˆÈŠO‚Å‚à”’l‚ðˆÓ–¡‚·‚é‚à‚̂Ȃç‰E‚É’u‚¯‚Î
-‰‰ŽZ‚͉”\‚Å‚·B<BR>
-‚½‚¾‚µA•¶Žš—ñ‚Íi’Êíj”’l‚ÉŽ©“®•ÏŠ·‚·‚邱‚Ƃ͂ł«‚Ü‚¹‚ñB
-•¶Žš—ñ‚ð”’l‚ÉŽ©“®•ÏŠ·‚µ‚½‚¢ê‡‚Í bigfloat.c ‚Ì
-u/* #define ENABLE_NUMERIC_STRING */v‚̃Rƒƒ“ƒg‚ðŠO‚µ‚Ä‚©‚çA
-ăRƒ“ƒpƒCƒ‹AăCƒ“ƒXƒg[ƒ‹‚·‚é•K—v‚ª‚ ‚è‚Ü‚·B
-•¶Žš—ñ‚Å”’l‚ð—^‚¦‚éꇂ͒ˆÓ‚ª•K—v‚Å‚·B”’l‚ɕϊ·‚Å‚«‚È‚¢•¶Žš‚ª‚ ‚邯A
-’P‚ɕϊ·‚ðŽ~‚߂邾‚¯‚ŃGƒ‰[‚ɂ͂Ȃè‚Ü‚¹‚ñB"10XX"‚È‚ç‚P‚OA"XXXX"‚Í‚O
-‚ƈµ‚í‚ê‚Ü‚·B<BR>
-<CODE><PRE>
- a = BigDecimal.E(20)
- c = a * "0.123456789123456789123456789" # •¶Žš‚ð BigDecimal ‚ɕϊ·‚µ‚Ä‚©‚çŒvŽZ
-</PRE></CODE>
-–³ŒÀ‘å‚â”ñ”‚ð•\‚·•¶Žš‚Æ‚µ‚ÄA"Infinity"A"+Infinity"A"-Infinity"A"NaN"
-‚àŽg—p‚Å‚«‚Ü‚·(‘å•¶ŽšE¬•¶Žš‚ð‹æ•Ê‚µ‚Ü‚·)B‚½‚¾‚µAmode ƒƒ\ƒbƒh‚Å false ‚ð
-Žw’肵‚½ê‡‚Í—áŠO‚ª”­¶‚µ‚Ü‚·B
-<BR>
-‚Ü‚½ABigDecimalƒNƒ‰ƒX‚Í coerceiRuby–{ŽQÆj‚ðƒTƒ|[ƒg‚µ‚Ä‚¢‚Ü‚·B
-]‚Á‚ÄABigDecimal ƒIƒuƒWƒFƒNƒg‚ª‰E‚É‚ ‚éꇂà‘å’ï‚Í‘åä•v‚Å‚·B
-‚½‚¾AŒ»Ý‚Ì Ruby ƒCƒ“ƒ^ƒvƒŠƒ^‚ÌŽd—lãA•¶Žš—ñ‚ª¶‚É‚ ‚邯ŒvŽZ‚Å‚«‚Ü‚¹‚ñB<BR>
-<CODE><PRE>
- a = BigDecimal.E(20)
- c = "0.123456789123456789123456789" * a # ƒGƒ‰[
-</PRE></CODE>
-•K—v«‚ª‚ ‚邯‚ÍŽv‚¢‚Ü‚¹‚ñ‚ªA‚Ç‚¤‚µ‚Ä‚à‚ÆŒ¾‚¤l‚Í
- String ƒIƒuƒWƒFƒNƒg‚ðŒp³‚µ‚½V‚½‚ȃNƒ‰ƒX‚ð쬂µ‚Ä‚©‚çA
-‚»‚̃Nƒ‰ƒX‚Å coerce ‚ðƒTƒ|[ƒg‚µ‚Ä‚­‚¾‚³‚¢B
-
-<hr>
-<A NAME="#UNDEF">
-<H2>–³ŒÀA”ñ”Aƒ[ƒ‚̈µ‚¢</H2>
-u–³ŒÀv‚Ƃ͕\Œ»‚Å‚«‚È‚¢‚­‚ç‚¢‘å‚«‚È”‚Å‚·B“Á•ʂɈµ‚¤‚½‚ß‚É
- +Infinityi³‚Ì–³ŒÀ‘åj‚â -Infinityi•‰‚Ì–³ŒÀ‘åj‚Æ‚¢‚¤
-‚悤‚É•\‹L‚³‚ê‚Ü‚·B
-–³ŒÀ‚Í 1.0/0.0 ‚̂悤‚Ƀ[ƒ‚ÅŠ„‚邿‚¤‚ÈŒvŽZ‚ð‚µ‚½‚Æ‚«‚ɶ¬‚³‚ê‚Ü‚·B
-<BR><BR>
-u”ñ”v‚Í 0.0/0.0 ‚â Infinity-Infinity “™‚ÌŒ‹‰Ê‚ª’è‹`‚Å‚«‚È‚¢
-ŒvŽZ‚ð‚µ‚½‚Æ‚«‚ɶ¬‚³‚ê‚Ü‚·B”ñ”‚Í NaNiNot a Numberj‚Æ•\‹L‚³‚ê‚Ü‚·B
-NaN ‚ðŠÜ‚ÞŒvŽZ‚Í‘S‚Ä NaN ‚ɂȂè‚Ü‚·B‚Ü‚½ NaN ‚ÍŽ©•ª‚àŠÜ‚ß‚ÄA‚Ç‚ñ‚È”
-‚Æ‚àˆê’v‚µ‚Ü‚¹‚ñB
-<BR><BR>
-ƒ[ƒ‚Í +0.0 ‚Æ -0.0 ‚ª‘¶Ý‚µ‚Ü‚·B‚½‚¾‚µA+0.0==-0.0 ‚Í true ‚Å‚·B
-<BR><BR>
-InfinityANaNA +0.0 ‚Æ -0.0 “™‚ðŠÜ‚ñ‚¾ŒvŽZŒ‹‰Ê‚Í‘g‚݇‚킹‚É
-‚æ‚è•¡ŽG‚Å‚·B‹»–¡‚Ì‚ ‚él‚ÍAˆÈ‰º‚̃vƒƒOƒ‰ƒ€‚ðŽÀs‚µ‚ÄŒ‹‰Ê‚ð
-Šm”F‚µ‚Ä‚­‚¾‚³‚¢iŒ‹‰Ê‚ɂ‚¢‚ÄA‹^–â‚âŠÔˆá‚¢‚ð”­Œ©‚³‚ꂽ•û‚Í
-‚¨’m‚点Šè‚¢‚Ü‚·jB
-
-<PRE>
-<CODE>
-require "bigdecimal"
-
-aa = %w(1 -1 +0.0 -0.0 +Infinity -Infinity NaN)
-ba = %w(1 -1 +0.0 -0.0 +Infinity -Infinity NaN)
-opa = %w(+ - * / <=> > >= < == != <=)
-
-for a in aa
- for b in ba
- for op in opa
- x = BigDecimal::new(a)
- y = BigDecimal::new(b)
- eval("ans= x #{op} y;print a,' ',op,' ',b,' ==> ',ans.to_s,\"\n\"")
- end
- end
-end
-</CODE>
-</PRE>
-
-<hr>
-<A NAME="#STRUCT">
-<H2>“à•”\‘¢</H2>
-BigDecimal“à•”‚Å•‚“®¬”“_‚Í\‘¢‘Ì(Real)‚Å•\Œ»‚³‚ê‚Ü‚·B
-‚»‚Ì‚¤‚¿‰¼”•”‚Í unsigned long ‚Ì”z—ñ(ˆÈ‰º‚Ì\‘¢‘Ì—v‘ffrac)‚ÅŠÇ—‚³‚ê‚Ü‚·B
-ŠT”O“I‚É‚ÍAˆÈ‰º‚̂悤‚ɂȂè‚Ü‚·B<BR><BR>
- <•‚“®¬”“_”> = 0.xxxxxxxxx*BASE**n<BR><BR>
-‚±‚±‚ÅAx‚͉¼”•”‚ð•\‚·”ŽšABASE‚ÍŠî”i‚P‚Oi‚È‚ç‚P‚OjAn‚ÍŽw”•”‚ð•\‚·
-®”’l‚Å‚·BBASE‚ª‘å‚«‚¢‚Ù‚ÇA‘å‚«‚È”’l‚ª•\Œ»‚Å‚«‚Ü‚·B‚‚܂èA”z—ñ‚̃TƒCƒY‚ð
-­‚È‚­‚Å‚«‚Ü‚·BBASE‚͑傫‚¢‚Ù‚Ç“s‡‚ª‚æ‚¢‚킯‚Å‚·‚ªAƒfƒoƒbƒO‚Ì‚â‚è‚â‚·‚³‚Ȃǂð
-l—¶‚µ‚ÄA10000‚ɂȂÁ‚Ä‚¢‚Ü‚·iBASE‚ÍVpInit()ŠÖ”‚ÅŽ©“®“I‚ÉŒvŽZ‚µ‚Ü‚·jB
-‚±‚ê‚ÍA32ƒrƒbƒg®”‚Ìꇂł·B64ƒrƒbƒg®”‚Ìꇂ͂à‚Á‚Ƒ傫‚È’l‚ɂȂè‚Ü‚·B
-Žc”O‚È‚ª‚çA64ƒrƒbƒg®”‚ł̃eƒXƒg‚͂܂¾‚â‚Á‚Ä‚¢‚Ü‚¹‚ñi‚à‚µA‚â‚ç‚ꂽ•û‚ª‚¢‚ê‚Î
-Œ‹‰Ê‚ð‹³‚¦‚Ä‚¢‚½‚¾‚¯‚ê‚΂ ‚肪‚½‚¢‚Å‚·jB
-BASE‚ª10000‚̂Ƃ«‚ÍAˆÈ‰º‚̉¼”•”‚Ì”z—ñ(frac)‚ÌŠe—v‘f‚É‚ÍÅ‘å‚Å‚SŒ…‚Ì
-”Žš‚ªŠi”[‚³‚ê‚Ü‚·B<BR><BR>
-•‚“®¬”“_\‘¢‘Ì(Real)‚͈ȉº‚̂悤‚ɂȂÁ‚Ä‚¢‚Ü‚·B
-<BR>
-<CODE><PRE>
- typedef struct {
- unsigned long MaxPrec; // ő帓x(frac[]‚Ì”z—ñƒTƒCƒY)
- unsigned long Prec; // ¸“x(frac[]‚ÌŽg—pƒTƒCƒY)
- short sign; // ˆÈ‰º‚̂悤‚É•„†“™‚Ìó‘Ô‚ð’è‹`‚µ‚Ü‚·B
- // ==0 : NaN
- // 1 : +0
- // -1 : -0
- // 2 : ³‚Ì’l
- // -2 : •‰‚Ì’l
- // 3 : +Infinity
- // -3 : -Infinity
- unsigned short flag; // ŠeŽí‚̧Œäƒtƒ‰ƒbƒO
- int exponent; // Žw”•”‚Ì’l(‰¼”•”*BASE**exponent)
- unsigned long frac[1]; // ‰¼”•”‚Ì”z—ñ(‰Â•Ï)
- } Real;
-</CODE></PRE>
-—Ⴆ‚Î 1234.56784321 ‚Æ‚¢‚¤”Žš‚Í(BASE=10000‚È‚ç)<BR>
-<PRE>
- 0.1234 5678 4321*(10000)**1
-</PRE>
-‚Å‚·‚©‚ç frac[0]=1234Afrac[1]=5678Afrac[2]=4321A
-Prec=3Asign=2Aexponent=1 ‚ƂȂè‚Ü‚·BMaxPrec‚Í
-Prec ‚æ‚è‘å‚«‚¯‚ê‚΂¢‚­‚Â‚Å‚à‚©‚Ü‚¢‚Ü‚¹‚ñBflag ‚Ì
-Žg—p•û–@‚ÍŽÀ‘•‚Ɉˑ¶‚µ‚Ä“à•”‚ÅŽg—p‚³‚ê‚Ü‚·B
-
-<hr>
-<A NAME="#BASE">
-<H2>2i‚Æ10i</H2>
-BigDecimal ‚Í <•‚“®¬”“_”> = 0.xxxxxxxxx*10**n ‚Æ‚¢‚¤10iŒ`Ž®‚Å”’l‚ð•ÛŽ‚µ‚Ü‚·B
-‚µ‚©‚µAŒvŽZ‹@‚Ì•‚“®¬”“_”‚Ì“à•”•\Œ»‚ÍAŒ¾‚¤‚܂łà‚È‚­ <•‚“®¬”“_”> = 0.bbbbbbbb*2**n ‚Æ‚¢‚¤
-2iŒ`Ž®‚ª•’ʂł·(x ‚Í 0 ‚©‚ç 9 ‚Ü‚ÅAb ‚Í 0 ‚© 1 ‚Ì”Žš)B
-BigDecimal ‚ª‚È‚º10i‚Ì“à•”•\Œ»Œ`Ž®‚ðÌ—p‚µ‚½‚Ì‚©‚ðˆÈ‰º‚Éà–¾‚µ‚Ü‚·B
-<H4>10i‚̃ƒŠƒbƒg</H4>
-<DL>
-<DT>ƒfƒoƒbƒO‚Ì‚µ‚â‚·‚³
-<DD>‚Ü‚¸AƒvƒƒOƒ‰ƒ€ì¬‚ªŠy‚Å‚·Bfrac[0]=1234Afrac[1]=5678Afrac[2]=4321A
-exponent=1Asign=2 ‚Ȃ甒l‚ª 1234.56784321 ‚Å‚ ‚é‚̂͌©‚ê‚Î’¼‚®‚É•ª‚©‚è‚Ü‚·B
-
-<DT>10i•\‹L‚³‚ꂽ”’l‚È‚çŠmŽÀ‚É“à•”•\Œ»‚ɕϊ·‚Å‚«‚é
-<DD>—Ⴆ‚ÎAˆÈ‰º‚̂悤‚ȃvƒƒOƒ‰ƒ€‚Í‘S‚­Œë·–³‚µ‚Å
-ŒvŽZ‚·‚邱‚Æ‚ª‚Å‚«‚Ü‚·BˆÈ‰º‚Ì—á‚ÍAˆês‚Ɉê‚‚̔’l
-‚ª‘‚¢‚Ä‚ ‚éƒtƒ@ƒCƒ‹ file ‚̇Œv”’l‚ð‹‚ß‚é‚à‚̂ł·B
-<CODE><PRE>
- file = File::open(....,"r")
- s = BigDecimal::new("0")
- while line = file.gets
- s = s + line
- end
-</PRE></CODE>
-‚±‚Ì—á‚ð2i”‚Å‚â‚邯Œë·‚ª“ü‚螂މ”\«‚ª‚ ‚è‚Ü‚·B
-—Ⴆ‚Î 0.1 ‚ð2i‚Å•\Œ»‚·‚邯 0.1 = b1*2**(-1)+b1*2**(-2)+b3*2**(-3)+b4*2**(-4)....
-‚Æ–³ŒÀ‚É‘±‚¢‚Ä‚µ‚Ü‚¢‚Ü‚·(b1=0,b2=0,b3=0,b4=1...)B‚±‚±‚Å bn(n=1,2,3,...) ‚Í
-2i‚ð•\Œ»‚·‚é 0 ‚© 1 ‚Ì”Žš—ñ‚Å‚·B]‚Á‚ÄA‚Ç‚±‚©‚őł¿Ø‚é•K—v‚ª‚ ‚è‚Ü‚·B
-‚±‚±‚ŕϊ·Œë·‚ª“ü‚è‚Ü‚·B‚à‚¿‚ë‚ñA‚±‚ê‚ðÄ“x10i•\‹L‚É‚µ‚Ĉóü‚·‚邿‚¤‚È
-ꇂ͓K؂Ȋۂߑ€ìiŽlŽÌŒÜ“üj‚É‚æ‚Á‚ÄÄ‚Ñ "0.1" ‚Æ•\ަ‚³‚ê‚Ü‚·B‚µ‚©‚µA
-“à•”‚łͳŠm‚È 0.1 ‚ł͂ ‚è‚Ü‚¹‚ñB
-
-<DT>—LŒøŒ…”‚Í—LŒÀ‚Å‚ ‚éi‚‚܂莩“®Œˆ’è‚Å‚«‚éj
-<DD>0.1 ‚ð•\Œ»‚·‚邽‚߂̗̈æ‚Í‚½‚Á‚½ˆê‚‚̔z—ñ—v‘fi frac[0]=1 j‚Åς݂܂·B
-”z—ñ—v‘f‚Ì”‚Í10i”’l‚©‚玩“®“I‚ÉŒˆ’è‚Å‚«‚Ü‚·B‚±‚ê‚ÍA‰Â•Ï’·•‚“®¬”“_‰‰ŽZ‚Å‚Í
-‘厖‚È‚±‚Ƃł·B‹t‚É 0.1 ‚ð2i•\Œ»‚µ‚½‚Æ‚«‚É‚Í2i‚Ì—LŒøŒ…‚ð‚¢‚­‚‚ɂ·‚é‚Ì‚© 0.1 ‚ð
-Œ©‚½‚¾‚¯‚ł͌ˆ’è‚Å‚«‚Ü‚¹‚ñB
-</DL>
-
-<H3>10i‚̃fƒƒŠƒbƒg</H3>
-ŽÀ‚Í¡‚܂ł̃ƒŠƒbƒg‚ÍA‚»‚̂܂܃fƒƒŠƒbƒg‚É‚à‚È‚è‚Ü‚·B
-‚»‚à‚»‚àA10i‚ð2i‚ɕϊ·‚·‚邿‚¤‚È‘€ì‚͕ϊ·Œë·
-‚𔺂¤ê‡‚ð‰ñ”ð‚·‚é‚±‚Ƃ͂ł«‚Ü‚¹‚ñB
-‘åŠT‚̃Rƒ“ƒsƒ…[ƒ^‚Í10i‚Ì“à•”•\Œ»‚ðŽ‚Á‚Ä‚¢‚È‚¢‚Ì‚ÅA
-BigDecimal ‚ð—˜—p‚µ‚Č뷖³‚µ‚ÌŒvŽZ‚ð‚·‚éꇂÍAŒvŽZ‘¬“x
-‚𖳎‹‚µ‚Ä‚àÅŒã‚܂ŠBigDecimal ‚ðŽg—p‘±‚¯‚é•K—v‚ª‚ ‚è‚Ü‚·B
-
-<H3>ʼn‚͉½‚©H</H3>
-Ž©•ª‚ÅŒvŽZ‚·‚邯‚«‚ɂ킴‚í‚´2i”‚ðŽg‚¤l‚͋ɂ߂Ă܂ê‚Å‚·B
-ŒvŽZ‹@‚Ƀf[ƒ^‚ð“ü—Í‚·‚邯‚«‚à‚Ù‚Æ‚ñ‚Ç‚Ìê‡A
-10i”‚Å“ü—Í‚µ‚Ü‚·B‚»‚ÌŒ‹‰ÊAdouble “™‚ÌŒvŽZ‹@“à•”
-•\Œ»‚Íʼn‚©‚çŒë·‚ª“ü‚Á‚Ä‚¢‚éꇂª‚ ‚è‚Ü‚·B
-BigDecimal ‚̓†[ƒU“ü—Í‚ðŒë·–³‚µ‚ÅŽæ‚螂ނ±‚Æ‚ª‚Å‚«‚Ü‚·B
-ƒfƒoƒbƒO‚ª‚µ‚â‚·‚¢‚Ì‚ÆAƒf[ƒ^“ǂ݂±‚ÝŽž‚Ɍ뷂ª“ü‚ç‚È‚¢
-‚Æ‚¢‚¤‚Ì‚ªŽÀۂ̃ƒŠƒbƒg‚Å‚·B
-
-<hr>
-<A NAME="#PREC">
-<H2>ŒvŽZ¸“x‚ɂ‚¢‚Ä</H2>
-c = a op b ‚Æ‚¢‚¤ŒvŽZ(op ‚Í + - * /)‚ð‚µ‚½‚Æ‚«‚Ì“®ì‚Í
-ˆÈ‰º‚̂悤‚ɂȂè‚Ü‚·B<BR><BR>
-‚PDæŽZ‚Í(a ‚Ì—LŒøŒ…”)+(b ‚Ì—LŒøŒ…”)A
-œŽZ‚Í(a ‚ÌÅ‘å—LŒøŒ…”)+(b ‚ÌÅ‘å—LŒøŒ…”)•ª‚Ìő包”iŽÀÛ‚ÍA—]—T‚ðŽ‚Á‚ÄA
-‚à‚¤­‚µ‘å‚«‚­‚È‚è‚Ü‚·j‚ðŽ‚Â•Ï” c ‚ðV‚½‚ɶ¬‚µ‚Ü‚·B
-‰ÁŒ¸ŽZ‚ÌꇂÍAŒë·‚ªo‚È‚¢‚¾‚¯‚̸“x‚ðŽ‚Â c ‚𶬂µ‚Ü‚·B—Ⴆ‚Î
- c = 0.1+0.1*10**(-100) ‚̂悤‚Èê‡Ac ‚̸“x‚Í‚P‚O‚OŒ…ˆÈã‚̸“x‚ð
-Ž‚Â‚æ‚¤‚ɂȂè‚Ü‚·B
-<BR><BR>
-‚QDŽŸ‚É c = a op b ‚ÌŒvŽZ‚ðŽÀs‚µ‚Ü‚·B<BR><BR>
-‚±‚̂悤‚ÉA‰ÁŒ¸ŽZ‚ÆæŽZ‚Å‚Ì c ‚Í•K‚¸uŒë·‚ªo‚È‚¢v‚¾‚¯‚̸“x‚ð
-Ž‚Á‚ͬ‚³‚ê‚Ü‚·(BigDecimal.limit ‚ðŽw’肵‚È‚¢ê‡)B
-œŽZ‚Í(a ‚ÌÅ‘å—LŒøŒ…”)+(b ‚ÌÅ‘å—LŒøŒ…”)•ª‚Ìő包”
-‚ðŽ‚Â c ‚ª¶¬‚³‚ê‚Ü‚·‚ªAc = 1.0/3.0 ‚̂悤‚ÈŒvŽZ‚Å–¾‚ç‚©‚Ȃ悤‚ÉA
- c ‚Ìő帓x‚ð’´‚¦‚邯‚±‚ë‚ÅŒvŽZ‚ª‘Å‚¿Ø‚ç‚ê‚éꇂª‚ ‚è‚Ü‚·B<BR><BR>
-‚¢‚¸‚ê‚É‚¹‚æAc ‚Ìő帓x‚Í a ‚â b ‚æ‚è‘å‚«‚­‚È‚è‚Ü‚·‚̂Šc ‚ª•K—v‚Æ‚·‚é
-ƒƒ‚ƒŠ[—̈æ‚͑傫‚­‚Ȃ邱‚ƂɒˆÓ‚µ‚ĉº‚³‚¢B
-<BR><BR>
-’ˆÓFu+,-,*,/v‚ł͌‹‰Ê‚̸“xi—LŒøŒ…”j‚ðŽ©•ª‚ÅŽw’è‚Å‚«‚Ü‚¹‚ñB
-¸“x‚ðƒRƒ“ƒgƒ[ƒ‹‚µ‚½‚¢ê‡‚ÍAˆÈ‰º‚̃Cƒ“ƒXƒ^ƒ“ƒXƒƒ\ƒbƒh‚ðŽg—p‚µ‚Ü‚·B<BR>
-<UL>
-<LI>add,sub,mult,div</LI><BLOCKQUOTE>
-‚±‚ê‚ç‚̃ƒ\ƒbƒh‚Íæ“ª(Ŷ)‚Ì”Žš‚©‚ç‚ÌŒ…”‚ðŽw’è‚Å‚«‚Ü‚·B
-<CODE><PRE>
- BigDecimal("2").div(3,12) # 2.0/3.0 => 0.6666666666 67E0
-</PRE></CODE>
-</BLOCKQUOTE>
-<LI>truncate,round,ceil,floor</LI><BLOCKQUOTE>
-‚±‚ê‚ç‚̃ƒ\ƒbƒh‚ͬ”“_‚©‚ç‚Ì‘Š‘ÎˆÊ’u‚ðŽw’肵‚ÄŒ…”‚ðŒˆ’è‚µ‚Ü‚·B
-<CODE><PRE>
- BigDecimal("6.66666666666666").round(12) # => 0.6666666666 667E1
-</PRE></CODE>
-</BLOCKQUOTE>
-</UL>
-<H3>Ž©•ª‚Ÿ“x‚ðƒRƒ“ƒgƒ[ƒ‹‚µ‚½‚¢ê‡</H3>
-Ž©•ª‚Ÿ“x(—LŒøŒ…”)‚ðƒRƒ“ƒgƒ[ƒ‹‚µ‚½‚¢ê‡‚Í addAsubAmultAdiv “™‚̃ƒ\ƒbƒh
-‚ªŽg—p‚Å‚«‚Ü‚·B
-ˆÈ‰º‚̉~Žü—¦‚ðŒvŽZ‚·‚éƒvƒƒOƒ‰ƒ€—á‚̂悤‚ÉA
-‹‚߂錅”‚ÍŽ©•ª‚ÅŽw’è‚·‚邱‚Æ‚ª‚Å‚«‚Ü‚·B
-<BR><BR>
-<CODE><PRE>
-#!/usr/local/bin/ruby
-
-require "bigdecimal"
-#
-# Calculates 3.1415.... (the number of times that a circle's diameter
-# will fit around the circle) using J. Machin's formula.
-#
-def big_pi(sig) # sig: Number of significant figures
- exp = -sig
- pi = BigDecimal::new("0")
- two = BigDecimal::new("2")
- m25 = BigDecimal::new("-0.04")
- m57121 = BigDecimal::new("-57121")
-
- u = BigDecimal::new("1")
- k = BigDecimal::new("1")
- w = BigDecimal::new("1")
- t = BigDecimal::new("-80")
- while (u.nonzero? && u.exponent >= exp)
- t = t*m25
- u = t.div(k,sig)
- pi = pi + u
- k = k+two
- end
-
- u = BigDecimal::new("1")
- k = BigDecimal::new("1")
- w = BigDecimal::new("1")
- t = BigDecimal::new("956")
- while (u.nonzero? && u.exponent >= exp )
- t = t.div(m57121,sig)
- u = t.div(k,sig)
- pi = pi + u
- k = k+two
- end
- pi
-end
-
-if $0 == __FILE__
- if ARGV.size == 1
- print "PI("+ARGV[0]+"):\n"
- p big_pi(ARGV[0].to_i)
- else
- print "TRY: ruby pi.rb 1000 \n"
- end
-end
-
-</PRE></CODE>
-<HR>
-<FONT size=2>
-<I>
-<A HREF="http://www.tinyforest.gr.jp">
-¬—Ñ –ΗY
-</A>
-(E-Mail:<A HREF="mailto:shigeo@tinyforest.gr.jp">&ltshigeo@tinyforest.gr.jp&gt</U></A>)
-</I>
-</FONT>
-</TD>
-</TR>
-</TABLE>
-</BODY>
-</HTML>
diff --git a/ext/bigdecimal/depend b/ext/bigdecimal/depend
index 402cae95dd..a68128478c 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)
diff --git a/ext/bigdecimal/lib/bigdecimal/jacobian.rb b/ext/bigdecimal/lib/bigdecimal/jacobian.rb
index 8ab836259a..eb9b1c9fc5 100644
--- a/ext/bigdecimal/lib/bigdecimal/jacobian.rb
+++ b/ext/bigdecimal/lib/bigdecimal/jacobian.rb
@@ -11,7 +11,7 @@
#
# f.zero:: returns 0.0
# f.one:: returns 1.0
-# f.two:: returns 1.0
+# f.two:: returns 2.0
# f.ten:: returns 10.0
#
# f.eps:: returns the convergence criterion (epsilon value) used to determine whether two values are considered equal. If |a-b| < epsilon, the two values are considered equal.
@@ -51,9 +51,9 @@ 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 = []
- if(nRetry>100) then
+ nRetry += 1
+ if nRetry > 100
raise "Singular Jacobian matrix. No change at x[" + i.to_s + "]"
end
dx = dx*f.two
diff --git a/ext/bigdecimal/lib/bigdecimal/math.rb b/ext/bigdecimal/lib/bigdecimal/math.rb
index 03c59bfccb..4504ccb2b0 100644
--- a/ext/bigdecimal/lib/bigdecimal/math.rb
+++ b/ext/bigdecimal/lib/bigdecimal/math.rb
@@ -7,7 +7,6 @@ require 'bigdecimal'
# sin (x, prec)
# cos (x, prec)
# atan(x, prec) Note: |x|<1, x=0.9999 may not converge.
-# log (x, prec)
# PI (prec)
# E (prec) == exp(1.0,prec)
#
@@ -21,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.14142135623730950488016887242096975E1"
+ #
+ 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?
@@ -78,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?
@@ -114,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?
@@ -145,7 +170,15 @@ 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
n = prec + BigDecimal.double_fig
@@ -160,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
@@ -172,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
@@ -184,8 +215,15 @@ 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
diff --git a/ext/bigdecimal/lib/bigdecimal/newton.rb b/ext/bigdecimal/lib/bigdecimal/newton.rb
index 96defc3c06..db1a5ad99e 100644
--- a/ext/bigdecimal/lib/bigdecimal/newton.rb
+++ b/ext/bigdecimal/lib/bigdecimal/newton.rb
@@ -18,7 +18,7 @@ require "bigdecimal/jacobian"
#
# f.zero:: returns 0.0
# f.one:: returns 1.0
-# f.two:: returns 1.0
+# f.two:: returns 2.0
# f.ten:: returns 10.0
#
# f.eps:: returns the convergence criterion (epsilon value) used to determine whether two values are considered equal. If |a-b| < epsilon, the two values are considered equal.
@@ -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 b4b02b191d..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,9 +19,13 @@ 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(precision=nil) -> bigdecimal
+ # flt.to_d -> bigdecimal
#
# Convert +flt+ to a BigDecimal and return it.
#
@@ -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,27 +98,28 @@ 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(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.
- # If a negative precision is given, raise ArgumentError.
- # The zero precision and implicit precision is deprecated.
+ # 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=0)
- if precision < 0
+ def to_d(precision)
+ if precision <= 0
raise ArgumentError, "negative precision"
- elsif precision == 0
- warn "zero and implicit precision is deprecated."
- precision = BigDecimal.double_fig*2+1
end
num = self.numerator
BigDecimal(num).div(self.denominator, precision)
diff --git a/ext/bigdecimal/sample/linear.rb b/ext/bigdecimal/sample/linear.rb
index 88a62ffa71..93d558b539 100644
--- a/ext/bigdecimal/sample/linear.rb
+++ b/ext/bigdecimal/sample/linear.rb
@@ -10,6 +10,7 @@
# ruby linear.rb [input file solved]
#
+# :stopdoc:
require "bigdecimal"
require "bigdecimal/ludcmp"
diff --git a/ext/bigdecimal/sample/nlsolve.rb b/ext/bigdecimal/sample/nlsolve.rb
index 7f729e6aaa..692a5023cc 100644
--- a/ext/bigdecimal/sample/nlsolve.rb
+++ b/ext/bigdecimal/sample/nlsolve.rb
@@ -9,7 +9,7 @@ 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")
diff --git a/ext/coverage/coverage.c b/ext/coverage/coverage.c
index 529fac256a..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);
}
@@ -71,11 +71,13 @@ rb_coverage_result(VALUE klass)
*
* = Usage
*
- * (1) require "coverage.so"
- * (2) do Coverage.start
- * (3) require or load Ruby source file
- * (4) Coverage.result will return a hash that contains filename as key and
- * coverage array as value.
+ * 1. require "coverage.so"
+ * 2. do Coverage.start
+ * 3. require or load Ruby source file
+ * 4. Coverage.result will return a hash that contains filename as key and
+ * coverage array as value. A coverage array gives, for each line, the
+ * number of line execution by the interpreter. A +nil+ value means
+ * coverage is disabled for this line (lines like +else+ and +end+).
*
* = Example
*
diff --git a/ext/coverage/depend b/ext/coverage/depend
new file mode 100644
index 0000000000..1227a5c9ae
--- /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)/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
index ff0c64e258..22b6823ff1 100644
--- a/ext/curses/curses.c
+++ b/ext/curses/curses.c
@@ -12,12 +12,13 @@
* maintainers:
* - Takaaki Tateishi (ttate@kt.jaist.ac.jp)
*
- * doumentation:
+ * documentation:
* - Vincent Batts (vbatts@hashbangbash.com)
*/
#include "ruby.h"
#include "ruby/io.h"
+#include "ruby/thread.h"
#if defined(HAVE_NCURSES_H)
# include <ncurses.h>
@@ -57,12 +58,23 @@
# define USE_MOUSE 1
#endif
-#define NUM2CH NUM2CHR
-#define CH2FIX CHR2FIX
+#if CHTYPE_IS_ULONG
+# define NUM2CH NUM2ULONG
+# define CH2NUM ULONG2NUM
+#else
+# if CHTYPE_IS_UINT
+# define NUM2CH NUM2UINT
+# define CH2NUM UINT2NUM
+# else
+# define NUM2CH NUM2CHR
+# define CH2NUM CHR2FIX
+# endif
+#endif
static VALUE mCurses;
static VALUE mKey;
static VALUE cWindow;
+static VALUE cPad;
#ifdef USE_MOUSE
static VALUE cMouseEvent;
#endif
@@ -86,18 +98,34 @@ no_window(void)
#define GetWINDOW(obj, winp) do {\
if (!OBJ_TAINTED(obj) && rb_safe_level() >= 4)\
rb_raise(rb_eSecurityError, "Insecure: operation on untainted window");\
- Data_Get_Struct((obj), struct windata, (winp));\
+ TypedData_Get_Struct((obj), struct windata, &windata_type, (winp));\
if ((winp)->window == 0) no_window();\
} while (0)
static void
-free_window(struct windata *winp)
+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)
{
@@ -109,7 +137,7 @@ prep_window(VALUE class, WINDOW *window)
}
obj = rb_obj_alloc(class);
- Data_Get_Struct(obj, struct windata, winp);
+ TypedData_Get_Struct(obj, struct windata, &windata_type, winp);
winp->window = window;
return obj;
@@ -127,7 +155,6 @@ prep_window(VALUE class, WINDOW *window)
static VALUE
curses_init_screen(void)
{
- rb_secure(4);
if (rb_stdscr) return rb_stdscr;
initscr();
if (stdscr == 0) {
@@ -447,7 +474,7 @@ curses_beep(VALUE obj)
/*
* Document-method: Curses.flash
*
- * Flashs the screen, for visual alarm on the terminal, if possible;
+ * Flashes the screen, for visual alarm on the terminal, if possible;
* otherwise it sounds the alert.
*
* see also Curses.beep
@@ -564,7 +591,7 @@ static VALUE
curses_inch(VALUE obj)
{
curses_stdscr();
- return CH2FIX(inch());
+ return CH2NUM(inch());
}
/*
@@ -617,12 +644,12 @@ curses_addstr(VALUE obj, VALUE str)
return Qnil;
}
-static VALUE
+static void *
getch_func(void *arg)
{
int *ip = (int *)arg;
*ip = getch();
- return Qnil;
+ return 0;
}
/*
@@ -639,7 +666,7 @@ curses_getch(VALUE obj)
int c;
curses_stdscr();
- rb_thread_blocking_region(getch_func, (void *)&c, RUBY_UBF_IO, 0);
+ 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;
@@ -652,7 +679,7 @@ curses_getch(VALUE obj)
/* This should be big enough.. I hope */
#define GETSTR_BUF_SIZE 1024
-static VALUE
+static void *
getstr_func(void *arg)
{
char *rtn = (char *)arg;
@@ -661,13 +688,13 @@ getstr_func(void *arg)
#else
getstr(rtn);
#endif
- return Qnil;
+ return 0;
}
/*
* Document-method: Curses.getstr
*
- * This is equivalent to a series f Curses::Window.getch calls
+ * This is equivalent to a series of Curses::Window.getch calls
*
*/
static VALUE
@@ -676,7 +703,7 @@ curses_getstr(VALUE obj)
char rtn[GETSTR_BUF_SIZE];
curses_stdscr();
- rb_thread_blocking_region(getstr_func, (void *)rtn, RUBY_UBF_IO, 0);
+ rb_thread_call_without_gvl(getstr_func, rtn, RUBY_UBF_IO, 0);
return rb_locale_str_new_cstr(rtn);
}
@@ -1093,8 +1120,8 @@ curses_init_pair(VALUE obj, VALUE pair, VALUE f, VALUE b)
* * 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
+ * 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.
@@ -1111,7 +1138,7 @@ curses_init_color(VALUE obj, VALUE color, VALUE r, VALUE g, VALUE b)
/*
* Document-method: Curses.has_colors?
*
- * Returns +true+ or +false+ depending on whether the terminal has color capbilities.
+ * Returns +true+ or +false+ depending on whether the terminal has color capabilities.
*/
static VALUE
curses_has_colors(VALUE obj)
@@ -1222,7 +1249,7 @@ static VALUE
curses_pair_number(VALUE obj, VALUE attrs)
{
curses_stdscr();
- return INT2FIX(PAIR_NUMBER(NUM2INT(attrs)));
+ return INT2FIX(PAIR_NUMBER(NUM2LONG(attrs)));
}
#endif /* USE_COLOR */
@@ -1240,17 +1267,33 @@ no_mevent(void)
#define GetMOUSE(obj, data) do {\
if (!OBJ_TAINTED(obj) && rb_safe_level() >= 4)\
rb_raise(rb_eSecurityError, "Insecure: operation on untainted mouse");\
- Data_Get_Struct((obj), struct mousedata, (data));\
+ TypedData_Get_Struct((obj), struct mousedata, &mousedata_type, (data));\
if ((data)->mevent == 0) no_mevent();\
} while (0)
static void
-curses_mousedata_free(struct mousedata *mdata)
+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
*
@@ -1258,7 +1301,8 @@ curses_mousedata_free(struct mousedata *mdata)
*
* 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
+ * See the BUTTON*, ALL_MOUSE_EVENTS and REPORT_MOUSE_POSITION constants,
+ * to examine the mask of the event
*/
static VALUE
curses_getmouse(VALUE obj)
@@ -1267,8 +1311,8 @@ curses_getmouse(VALUE obj)
VALUE val;
curses_stdscr();
- val = Data_Make_Struct(cMouseEvent,struct mousedata,
- 0,curses_mousedata_free,mdata);
+ val = TypedData_Make_Struct(cMouseEvent,struct mousedata,
+ &mousedata_type,mdata);
mdata->mevent = (MEVENT*)xmalloc(sizeof(MEVENT));
return (getmouse(mdata->mevent) == OK) ? val : Qnil;
}
@@ -1362,7 +1406,7 @@ 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
+ * 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)
@@ -1437,15 +1481,16 @@ window_s_allocate(VALUE class)
{
struct windata *winp;
- return Data_Make_Struct(class, struct windata, 0, free_window, 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.
+ * Construct a new Curses::Window with constraints of
+ * +height+ lines, +width+ columns, begin at +top+ line, and begin +left+ most
+ * column.
*
* A new window using full screen is called as
* Curses::Window.new(0,0,0,0)
@@ -1457,9 +1502,8 @@ window_initialize(VALUE obj, VALUE h, VALUE w, VALUE top, VALUE left)
struct windata *winp;
WINDOW *window;
- rb_secure(4);
curses_init_screen();
- Data_Get_Struct(obj, struct windata, winp);
+ 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);
@@ -1472,8 +1516,9 @@ window_initialize(VALUE obj, VALUE h, VALUE w, VALUE top, VALUE left)
* 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.
+ * Construct a new sub-window with constraints of
+ * +height+ lines, +width+ columns, begin at +top+ line, and begin +left+ most
+ * column.
*
*/
static VALUE
@@ -1623,13 +1668,13 @@ window_setpos(VALUE obj, VALUE y, VALUE x)
/*
* Document-method: Curses::Window.cury
*
- * A getter for the current line (Y coord) of the window
+ * A getter for the current line (Y coordinate) of the window
*/
static VALUE
window_cury(VALUE obj)
{
struct windata *winp;
- int x, y;
+ int RB_UNUSED_VAR(x), y;
GetWINDOW(obj, winp);
getyx(winp->window, y, x);
@@ -1639,13 +1684,13 @@ window_cury(VALUE obj)
/*
* Document-method: Curses::Window.curx
*
- * A getter for the current column (X coord) of the window
+ * A getter for the current column (X coordinate) of the window
*/
static VALUE
window_curx(VALUE obj)
{
struct windata *winp;
- int x, y;
+ int x, RB_UNUSED_VAR(y);
GetWINDOW(obj, winp);
getyx(winp->window, y, x);
@@ -1703,41 +1748,41 @@ window_maxx(VALUE obj)
/*
* Document-method: Curses::Window.begy
*
- * A getter for the beginning line (Y coord) of the window
+ * A getter for the beginning line (Y coordinate) of the window
*/
static VALUE
window_begy(VALUE obj)
{
struct windata *winp;
- int x, y;
+ int RB_UNUSED_VAR(x), y;
GetWINDOW(obj, winp);
#ifdef getbegyx
getbegyx(winp->window, y, x);
- return INT2FIX(y);
#else
- return INT2FIX(winp->window->_begy);
+ y = winp->window->_begy;
#endif
+ return INT2FIX(y);
}
/*
* Document-method: Curses::Window.begx
*
- * A getter for the beginning column (X coord) of the window
+ * A getter for the beginning column (X coordinate) of the window
*/
static VALUE
window_begx(VALUE obj)
{
struct windata *winp;
- int x, y;
+ int x, RB_UNUSED_VAR(y);
GetWINDOW(obj, winp);
#ifdef getbegyx
getbegyx(winp->window, y, x);
- return INT2FIX(x);
#else
- return INT2FIX(winp->window->_begx);
+ x = winp->window->_begx;
#endif
+ return INT2FIX(x);
}
/*
@@ -1833,14 +1878,15 @@ window_inch(VALUE obj)
struct windata *winp;
GetWINDOW(obj, winp);
- return CH2FIX(winch(winp->window));
+ return CH2NUM(winch(winp->window));
}
/*
* Document-method: Curses::Window.addch
* call-seq: addch(ch)
*
- * Add a character +ch+, with attributes, to the window, then advance the cursor.
+ * Add a character +ch+, with attributes, to the window, then advance the
+ * cursor.
*
* see also the system manual for curs_addch(3)
*/
@@ -1916,12 +1962,12 @@ struct wgetch_arg {
int c;
};
-static VALUE
+static void *
wgetch_func(void *_arg)
{
struct wgetch_arg *arg = (struct wgetch_arg *)_arg;
arg->c = wgetch(arg->win);
- return Qnil;
+ return 0;
}
/*
@@ -1941,7 +1987,7 @@ window_getch(VALUE obj)
GetWINDOW(obj, winp);
arg.win = winp->window;
- rb_thread_blocking_region(wgetch_func, (void *)&arg, RUBY_UBF_IO, 0);
+ 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)) {
@@ -1957,7 +2003,7 @@ struct wgetstr_arg {
char rtn[GETSTR_BUF_SIZE];
};
-static VALUE
+static void *
wgetstr_func(void *_arg)
{
struct wgetstr_arg *arg = (struct wgetstr_arg *)_arg;
@@ -1966,13 +2012,13 @@ wgetstr_func(void *_arg)
#else
wgetstr(arg->win, arg->rtn);
#endif
- return Qnil;
+ return 0;
}
/*
* Document-method: Curses::Window.getstr
*
- * This is equivalent to a series f Curses::Window.getch calls
+ * This is equivalent to a series of Curses::Window.getch calls
*
*/
static VALUE
@@ -1983,7 +2029,7 @@ window_getstr(VALUE obj)
GetWINDOW(obj, winp);
arg.win = winp->window;
- rb_thread_blocking_region(wgetstr_func, (void *)&arg, RUBY_UBF_IO, 0);
+ rb_thread_call_without_gvl(wgetstr_func, (void *)&arg, RUBY_UBF_IO, 0);
return rb_locale_str_new_cstr(arg.rtn);
}
@@ -2077,7 +2123,8 @@ window_scrollok(VALUE obj, VALUE bf)
*
* 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.
+ * If insert/delete line cannot be used, curses redraws the changed portions of
+ * all lines.
*
*/
static VALUE
@@ -2100,7 +2147,7 @@ window_idlok(VALUE obj, VALUE bf)
*
* 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
+ * scroll one line in the direction of the first line. Only the text of the
* window is scrolled.
*
*/
@@ -2318,7 +2365,7 @@ window_bkgd(VALUE obj, VALUE ch)
/*
* Document-method: Curses::Window.getbkgd
*
- * Returns an Interer (+ch+) for the character property in the current window.
+ * Returns an Integer (+ch+) for the character property in the current window.
*/
static VALUE
window_getbkgd(VALUE obj)
@@ -2328,7 +2375,7 @@ window_getbkgd(VALUE obj)
struct windata *winp;
GetWINDOW(obj,winp);
- return (c = getbkgd(winp->window) != ERR) ? CH2FIX(c) : Qnil;
+ return (c = getbkgd(winp->window) != ERR) ? CH2NUM(c) : Qnil;
#else
return Qnil;
#endif
@@ -2373,9 +2420,9 @@ window_resize(VALUE obj, VALUE lin, VALUE col)
*
* 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+),
+ * 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
+ * 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.
@@ -2406,11 +2453,14 @@ window_keypad(VALUE obj, VALUE val)
#ifdef HAVE_NODELAY
/*
* Document-method: Curses::Window.nodelay
- * call-seq: nodelay(bool)
+ * call-seq:
+ * window.nodelay = bool
*
- * Causes Curses::Window.getch to be a non-blocking call. If no input is ready, getch returns ERR.
+ * When in no-delay mode Curses::Window#getch is a non-blocking call. If no
+ * input is ready #getch returns ERR.
*
- * If disabled (+bool+ is +false+), Curses::Window.getch waits until a key is pressed.
+ * When in delay mode (+bool+ is +false+ which is the default),
+ * Curses::Window#getch blocks until a key is pressed.
*
*/
static VALUE
@@ -2437,9 +2487,12 @@ window_nodelay(VALUE obj, VALUE val)
* 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.
+ * - 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
@@ -2455,6 +2508,136 @@ window_timeout(VALUE obj, VALUE delay)
#define window_timeout rb_f_notimplement
#endif
+/*--------------------------- class Pad ----------------------------*/
+
+#ifdef HAVE_NEWPAD
+/*
+ * Document-method: Curses::Pad.new
+ *
+ * call-seq:
+ * new(height, width)
+ *
+ * Construct a new Curses::Pad with constraints of +height+ lines, +width+
+ * columns
+ *
+ */
+static VALUE
+pad_initialize(VALUE obj, VALUE h, VALUE w)
+{
+ struct windata *padp;
+ WINDOW *window;
+
+ curses_init_screen();
+ TypedData_Get_Struct(obj, struct windata, &windata_type, padp);
+ if (padp->window) delwin(padp->window);
+ window = newpad(NUM2INT(h), NUM2INT(w));
+ wclear(window);
+ padp->window = window;
+
+ return obj;
+}
+
+#if 1
+#define pad_subpad window_subwin
+#else
+/*
+ * Document-method: Curses::Pad.subpad
+ * call-seq:
+ * subpad(height, width, begin_x, begin_y)
+ *
+ * Construct a new subpad with constraints of +height+ lines, +width+ columns,
+ * begin at +begin_x+ line, and +begin_y+ columns on the pad.
+ *
+ */
+static VALUE
+pad_subpad(VALUE obj, VALUE height, VALUE width, VALUE begin_x, VALUE begin_y)
+{
+ struct windata *padp;
+ WINDOW *subpad;
+ VALUE pad;
+ int h, w, x, y;
+
+ h = NUM2INT(height);
+ w = NUM2INT(width);
+ x = NUM2INT(begin_x);
+ y = NUM2INT(begin_y);
+ GetWINDOW(obj, padp);
+ subpad = subwin(padp->window, h, w, x, y);
+ pad = prep_window(rb_obj_class(obj), subpad);
+
+ return pad;
+}
+#endif
+
+/*
+ * Document-method: Curses::Pad.refresh
+ *
+ * call-seq:
+ * pad.refresh(pad_minrow, pad_mincol, screen_minrow, screen_mincol, screen_maxrow, screen_maxcol)
+ *
+ * Refreshes the pad. +pad_minrow+ and pad_mincol+ define the upper-left
+ * corner of the rectangle to be displayed. +screen_minrow+, +screen_mincol+,
+ * +screen_maxrow+, +screen_maxcol+ define the edges of the rectangle to be
+ * displayed on the screen.
+ *
+ */
+static VALUE
+pad_refresh(VALUE obj, VALUE pminrow, VALUE pmincol, VALUE sminrow,
+ VALUE smincol, VALUE smaxrow, VALUE smaxcol)
+{
+ struct windata *padp;
+ int pmr, pmc, smr, smc, sxr, sxc;
+
+ pmr = NUM2INT(pminrow);
+ pmc = NUM2INT(pmincol);
+ smr = NUM2INT(sminrow);
+ smc = NUM2INT(smincol);
+ sxr = NUM2INT(smaxrow);
+ sxc = NUM2INT(smaxcol);
+
+ GetWINDOW(obj, padp);
+ prefresh(padp->window, pmr, pmc, smr, smc, sxr, sxc);
+
+ return Qnil;
+}
+
+/*
+ * Document-method: Curses::Pad.noutrefresh
+ *
+ * call-seq:
+ * pad.noutrefresh(pad_minrow, pad_mincol, screen_minrow, screen_mincol, screen_maxrow, screen_maxcol)
+ *
+ * Refreshes the pad. +pad_minrow+ and pad_mincol+ define the upper-left
+ * corner of the rectangle to be displayed. +screen_minrow+, +screen_mincol+,
+ * +screen_maxrow+, +screen_maxcol+ define the edges of the rectangle to be
+ * displayed on the screen.
+ *
+ */
+static VALUE
+pad_noutrefresh(VALUE obj, VALUE pminrow, VALUE pmincol, VALUE sminrow,
+ VALUE smincol, VALUE smaxrow, VALUE smaxcol)
+{
+ struct windata *padp;
+ int pmr, pmc, smr, smc, sxr, sxc;
+
+ pmr = NUM2INT(pminrow);
+ pmc = NUM2INT(pmincol);
+ smr = NUM2INT(sminrow);
+ smc = NUM2INT(smincol);
+ sxr = NUM2INT(smaxrow);
+ sxc = NUM2INT(smaxcol);
+
+ GetWINDOW(obj, padp);
+#ifdef HAVE_DOUPDATE
+ pnoutrefresh(padp->window, pmr, pmc, smr, smc, sxr, sxc);
+#else
+ prefresh(padp->window, pmr, pmc, smr, smc, sxr, sxc);
+#endif
+
+ return Qnil;
+}
+#endif /* HAVE_NEWPAD */
+
/*------------------------- Initialization -------------------------*/
/*
@@ -2478,11 +2661,11 @@ window_timeout(VALUE obj, VALUE delay)
* == Examples
*
* * hello.rb
- * :include: hello.rb
+ * :include: sample/curses/hello.rb
*
*
* * rain.rb
- * :include: rain.rb
+ * :include: sample/curses/rain.rb
*
*
*/
@@ -2515,7 +2698,7 @@ Init_curses(void)
* == Example
*
* * mouse.rb
- * :include: mouse.rb
+ * :include: sample/curses/mouse.rb
*
*/
cMouseEvent = rb_define_class_under(mCurses,"MouseEvent",rb_cObject);
@@ -2547,7 +2730,7 @@ Init_curses(void)
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_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);
@@ -2604,6 +2787,32 @@ Init_curses(void)
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
*
@@ -2620,10 +2829,14 @@ Init_curses(void)
* Curses.init_screen()
*
* my_str = "LOOK! PONIES!"
- * win = Curses::Window.new( 8, (my_str.length + 10),
- * (Curses.lines - 8) / 2,
+ * bwin = Curses::Window.new( 10, (my_str.length + 10),
+ * (Curses.lines - 10) / 2,
* (Curses.cols - (my_str.length + 10)) / 2 )
- * win.box("|", "-")
+ * bwin.box("\\", "/")
+ * bwin.refresh
+ * win = bwin.subwin( 6, my_str.length + 6,
+ * (Curses.lines - 6) / 2,
+ * (Curses.cols - (my_str.length + 6)) / 2 )
* win.setpos(2,3)
* win.addstr(my_str)
* # or even
@@ -2686,6 +2899,26 @@ Init_curses(void)
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
@@ -3363,10 +3596,10 @@ Init_curses(void)
#endif
#ifdef KEY_SR
/* Document-const: KEY_SR
- * Scroll 1 line backware (reverse)
+ * Scroll 1 line backward (reverse)
*/
/* Document-const: SR
- * Scroll 1 line backware (reverse)
+ * Scroll 1 line backward (reverse)
*/
rb_curses_define_const(KEY_SR);
rb_define_const(mKey, "SR", INT2NUM(KEY_SR));
diff --git a/ext/curses/depend b/ext/curses/depend
index ecb79e512d..9d47df2a8d 100644
--- a/ext/curses/depend
+++ b/ext/curses/depend
@@ -1 +1,5 @@
-curses.o: curses.c $(hdrdir)/ruby.h $(topdir)/config.h $(hdrdir)/defines.h
+$(OBJS): $(HDRS) $(ruby_headers) \
+ $(hdrdir)/ruby/io.h \
+ $(hdrdir)/ruby/encoding.h \
+ $(hdrdir)/ruby/oniguruma.h \
+ $(hdrdir)/ruby/thread.h
diff --git a/ext/curses/extconf.rb b/ext/curses/extconf.rb
index a1a1613aa7..a95b49ffea 100644
--- a/ext/curses/extconf.rb
+++ b/ext/curses/extconf.rb
@@ -1,36 +1,141 @@
require 'mkmf'
+def have_all(*args) # :nodoc:
+ old_libs = $libs.dup
+ old_defs = $defs.dup
+ result = []
+ begin
+ args.each {|arg|
+ r = arg.call(*result)
+ if !r
+ return nil
+ end
+ result << r
+ }
+ result
+ ensure
+ if result.length != args.length
+ $libs = old_libs
+ $defs = old_defs
+ end
+ end
+end
+
dir_config('curses')
dir_config('ncurses')
dir_config('termcap')
-make=false
-headers = []
-
have_library("mytinfo", "tgetent") if /bow/ =~ RUBY_PLATFORM
have_library("tinfo", "tgetent") or have_library("termcap", "tgetent")
-if have_header(*curses=%w"ncurses.h") and (have_library("ncursesw", "initscr") or have_library("ncurses", "initscr"))
- make=true
-elsif have_header(*curses=%w"ncurses/curses.h") and have_library("ncurses", "initscr")
- make=true
-elsif have_header(*curses=%w"curses_colr/curses.h") and have_library("cur_colr", "initscr")
- curses.unshift("varargs.h")
- make=true
-elsif have_header(*curses=%w"curses.h") and (have_library("curses", "initscr") || have_library("pdcurses", "initscr"))
- make=true
-end
-if make
- 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)
+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)
+ if try_static_assert("sizeof(char*)>sizeof(int)",
+ %w[stdio.h stdlib.h]+curses,
+ flag)
$defs << flag
end
have_var("ESCDELAY", curses)
have_var("TABSIZE", curses)
have_var("COLORS", curses)
have_var("COLOR_PAIRS", curses)
+
+ # SVR4 curses has a (undocumented) variable char *curses_version.
+ # ncurses and PDcurses has a function char *curses_version().
+ # Note that the original BSD curses doesn't provide version information.
+ #
+ # configure option:
+ # --with-curses-version=function for SVR4
+ # --with-curses-version=variable for ncurses and PDcurses
+ # (not given) automatically determined
+
+ case with_curses_version = with_config("curses-version")
+ when "function"
+ $defs << '-DHAVE_FUNC_CURSES_VERSION'
+ when "variable"
+ $defs << '-DHAVE_VAR_CURSES_VERSION'
+ when nil
+ func_test_program = cpp_include(curses) + <<-"End"
+ int main(int argc, char *argv[])
+ {
+ curses_version();
+ return EXIT_SUCCESS;
+ }
+ End
+ var_test_program = cpp_include(curses) + <<-"End"
+ extern char *curses_version;
+ int main(int argc, char *argv[])
+ {
+ int i = 0;
+ for (i = 0; i < 100; i++) {
+ if (curses_version[i] == 0)
+ return 0 < i ? EXIT_SUCCESS : EXIT_FAILURE;
+ if (curses_version[i] & 0x80)
+ return EXIT_FAILURE;
+ }
+ return EXIT_FAILURE;
+ }
+ End
+ try = method(CROSS_COMPILING ? :try_link : :try_run)
+ function_p = checking_for(checking_message('function curses_version', curses)) { try[func_test_program] }
+ variable_p = checking_for(checking_message('variable curses_version', curses)) { try[var_test_program] }
+ if function_p and variable_p
+ if [header, library].grep(/ncurses|pdcurses|xcurses/i)
+ variable_p = false
+ else
+ warn "found curses_version but cannot determin whether it is a"
+ warn "function or a variable, so assume a variable in old SVR4"
+ warn "ncurses."
+ function_p = false
+ end
+ end
+ $defs << '-DHAVE_FUNC_CURSES_VERSION' if function_p
+ $defs << '-DHAVE_VAR_CURSES_VERSION' if variable_p
+ else
+ warn "unexpeted value for --with-curses-version: #{with_curses_version}"
+ end
+
+ for type in ["long", "int"]
+ if try_static_assert("sizeof(chtype) == sizeof(unsigned #{type})",
+ %w[stdio.h stdlib.h]+curses)
+ $defs << "-DCHTYPE_IS_U#{type.upcase}"
+ break
+ end
+ end
+
create_makefile("curses")
end
diff --git a/ext/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 36f0f84de2..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 1 .. 15 # SIGHUP .. SIGTERM
- 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/date/date_core.c b/ext/date/date_core.c
index 4048d1345d..176c76ef0c 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, 2011
+ date_core.c: Coded by Tadayoshi Funaba 2010-2013
*/
#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>
@@ -218,13 +221,10 @@ f_negative_p(VALUE x)
#include <float.h>
#endif
-#if defined(FLT_RADIX) && defined(FLT_MANT_DIG)
-#if FLT_RADIX == 2 && FLT_MANT_DIG > 22
-#define USE_FLOAT
-#define sg_cast float
+#if defined(FLT_RADIX) && defined(FLT_MANT_DIG) && FLT_RADIX == 2 && FLT_MANT_DIG > 22
+#define date_sg_t float
#else
-#define sg_cast double
-#endif
+#define date_sg_t double
#endif
/* A set of nth, jd, df and sf denote ajd + 1/2. Each ajd begin at
@@ -240,11 +240,7 @@ struct SimpleDateData
/* df is zero */
/* sf is zero */
/* of is zero */
-#ifndef USE_FLOAT
- double sg; /* 2298874..2426355 or -/+oo */
-#else
- float sg; /* at most 22 bits */
-#endif
+ date_sg_t sg; /* 2298874..2426355 or -/+oo -- at most 22 bits */
/* decoded as utc=local */
int year; /* truncated */
#ifndef USE_PACK
@@ -267,11 +263,7 @@ struct ComplexDateData
int df; /* as utc, in secs */
VALUE sf; /* in nano secs */
int of; /* in secs */
-#ifndef USE_FLOAT
- double sg; /* 2298874..2426355 or -/+oo */
-#else
- float sg; /* at most 22 bits */
-#endif
+ date_sg_t sg; /* 2298874..2426355 or -/+oo -- at most 22 bits */
/* decoded as local */
int year; /* truncated */
#ifndef USE_PACK
@@ -325,7 +317,7 @@ canon(VALUE x)
{\
(x)->nth = canon(_nth);\
(x)->jd = _jd;\
- (x)->sg = (sg_cast)(_sg);\
+ (x)->sg = (date_sg_t)(_sg);\
(x)->year = _year;\
(x)->mon = _mon;\
(x)->mday = _mday;\
@@ -336,7 +328,7 @@ canon(VALUE x)
{\
(x)->nth = canon(_nth);\
(x)->jd = _jd;\
- (x)->sg = (sg_cast)(_sg);\
+ (x)->sg = (date_sg_t)(_sg);\
(x)->year = _year;\
(x)->pc = PACK2(_mon, _mday);\
(x)->flags = _flags;\
@@ -352,7 +344,7 @@ _year, _mon, _mday, _hour, _min, _sec, _flags) \
(x)->df = _df;\
(x)->sf = canon(_sf);\
(x)->of = _of;\
- (x)->sg = (sg_cast)(_sg);\
+ (x)->sg = (date_sg_t)(_sg);\
(x)->year = _year;\
(x)->mon = _mon;\
(x)->mday = _mday;\
@@ -370,7 +362,7 @@ _year, _mon, _mday, _hour, _min, _sec, _flags) \
(x)->df = _df;\
(x)->sf = canon(_sf);\
(x)->of = _of;\
- (x)->sg = (sg_cast)(_sg);\
+ (x)->sg = (date_sg_t)(_sg);\
(x)->year = _year;\
(x)->pc = PACK5(_mon, _mday, _hour, _min, _sec);\
(x)->flags = _flags;\
@@ -385,7 +377,7 @@ _year, _mon, _mday, _hour, _min, _sec, _flags) \
(x)->df = 0;\
(x)->sf = INT2FIX(0);\
(x)->of = 0;\
- (x)->sg = (sg_cast)((y)->sg);\
+ (x)->sg = (date_sg_t)((y)->sg);\
(x)->year = (y)->year;\
(x)->mon = (y)->mon;\
(x)->mday = (y)->mday;\
@@ -402,7 +394,7 @@ _year, _mon, _mday, _hour, _min, _sec, _flags) \
(x)->df = 0;\
(x)->sf = INT2FIX(0);\
(x)->of = 0;\
- (x)->sg = (sg_cast)((y)->sg);\
+ (x)->sg = (date_sg_t)((y)->sg);\
(x)->year = (y)->year;\
(x)->pc = PACK5(EX_MON((y)->pc), EX_MDAY((y)->pc), 0, 0, 0);\
(x)->flags = (y)->flags;\
@@ -414,7 +406,7 @@ _year, _mon, _mday, _hour, _min, _sec, _flags) \
{\
(x)->nth = (y)->nth;\
(x)->jd = (y)->jd;\
- (x)->sg = (sg_cast)((y)->sg);\
+ (x)->sg = (date_sg_t)((y)->sg);\
(x)->year = (y)->year;\
(x)->mon = (y)->mon;\
(x)->mday = (y)->mday;\
@@ -425,7 +417,7 @@ _year, _mon, _mday, _hour, _min, _sec, _flags) \
{\
(x)->nth = (y)->nth;\
(x)->jd = (y)->jd;\
- (x)->sg = (sg_cast)((y)->sg);\
+ (x)->sg = (date_sg_t)((y)->sg);\
(x)->year = (y)->year;\
(x)->pc = PACK2(EX_MON((y)->pc), EX_MDAY((y)->pc));\
(x)->flags = (y)->flags;\
@@ -690,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
@@ -991,8 +983,14 @@ safe_mul_p(VALUE x, long m)
if (!FIXNUM_P(x))
return 0;
ix = FIX2LONG(x);
- if (ix >= (FIXNUM_MAX / m))
- return 0;
+ if (ix < 0) {
+ if (ix <= (FIXNUM_MIN / m))
+ return 0;
+ }
+ else {
+ if (ix >= (FIXNUM_MAX / m))
+ return 0;
+ }
return 1;
}
@@ -1109,6 +1107,28 @@ m_virtual_sg(union DateData *x)
return c_virtual_sg(x);
}
+#define canonicalize_jd(_nth, _jd) \
+{\
+ if (_jd < 0) {\
+ _nth = f_sub(_nth, INT2FIX(1));\
+ _jd += CM_PERIOD;\
+ }\
+ if (_jd >= CM_PERIOD) {\
+ _nth = f_add(_nth, INT2FIX(1));\
+ _jd -= CM_PERIOD;\
+ }\
+}
+
+inline static void
+canonicalize_s_jd(union DateData *x)
+{
+ int j = x->s.jd;
+ assert(have_jd_p(x));
+ canonicalize_jd(x->s.nth, x->s.jd);
+ if (x->s.jd != j)
+ x->flags &= ~HAVE_CIVIL;
+}
+
inline static void
get_s_jd(union DateData *x)
{
@@ -1194,6 +1214,16 @@ get_c_time(union DateData *x)
}
inline static void
+canonicalize_c_jd(union DateData *x)
+{
+ int j = x->c.jd;
+ assert(have_jd_p(x));
+ canonicalize_jd(x->c.nth, x->c.jd);
+ if (x->c.jd != j)
+ x->flags &= ~HAVE_CIVIL;
+}
+
+inline static void
get_c_jd(union DateData *x)
{
assert(complex_dat_p(x));
@@ -1366,6 +1396,19 @@ guess_style(VALUE y, double sg) /* -/+oo or zero */
return style;
}
+inline static void
+m_canonicalize_jd(union DateData *x)
+{
+ if (simple_dat_p(x)) {
+ get_s_jd(x);
+ canonicalize_s_jd(x);
+ }
+ else {
+ get_c_jd(x);
+ canonicalize_c_jd(x);
+ }
+}
+
inline static VALUE
m_nth(union DateData *x)
{
@@ -1972,7 +2015,7 @@ civil_to_jd(VALUE y, int m, int d, double sg,
*ry = FIX2INT(y);
else {
VALUE nth2;
- decode_year(y, ns ? -1 : +1, &nth2, ry);
+ decode_year(y, *ns ? -1 : +1, &nth2, ry);
}
}
else {
@@ -2007,7 +2050,7 @@ ordinal_to_jd(VALUE y, int d, double sg,
*ry = FIX2INT(y);
else {
VALUE nth2;
- decode_year(y, ns ? -1 : +1, &nth2, ry);
+ decode_year(y, *ns ? -1 : +1, &nth2, ry);
}
}
else {
@@ -2042,7 +2085,7 @@ commercial_to_jd(VALUE y, int w, int d, double sg,
*ry = FIX2INT(y);
else {
VALUE nth2;
- decode_year(y, ns ? -1 : +1, &nth2, ry);
+ decode_year(y, *ns ? -1 : +1, &nth2, ry);
}
}
else {
@@ -2077,7 +2120,7 @@ weeknum_to_jd(VALUE y, int w, int d, int f, double sg,
*ry = FIX2INT(y);
else {
VALUE nth2;
- decode_year(y, ns ? -1 : +1, &nth2, ry);
+ decode_year(y, *ns ? -1 : +1, &nth2, ry);
}
}
else {
@@ -2112,7 +2155,7 @@ nth_kday_to_jd(VALUE y, int m, int n, int k, double sg,
*ry = FIX2INT(y);
else {
VALUE nth2;
- decode_year(y, ns ? -1 : +1, &nth2, ry);
+ decode_year(y, *ns ? -1 : +1, &nth2, ry);
}
}
else {
@@ -2151,7 +2194,7 @@ valid_ordinal_p(VALUE y, int d, double sg,
*ry = FIX2INT(y);
else {
VALUE nth2;
- decode_year(y, ns ? -1 : +1, &nth2, ry);
+ decode_year(y, *ns ? -1 : +1, &nth2, ry);
}
}
else {
@@ -2190,7 +2233,7 @@ valid_civil_p(VALUE y, int m, int d, double sg,
*ry = FIX2INT(y);
else {
VALUE nth2;
- decode_year(y, ns ? -1 : +1, &nth2, ry);
+ decode_year(y, *ns ? -1 : +1, &nth2, ry);
}
}
else {
@@ -2226,7 +2269,7 @@ valid_commercial_p(VALUE y, int w, int d, double sg,
*ry = FIX2INT(y);
else {
VALUE nth2;
- decode_year(y, ns ? -1 : +1, &nth2, ry);
+ decode_year(y, *ns ? -1 : +1, &nth2, ry);
}
}
else {
@@ -2256,7 +2299,7 @@ valid_weeknum_p(VALUE y, int w, int d, int f, double sg,
*ry = FIX2INT(y);
else {
VALUE nth2;
- decode_year(y, ns ? -1 : +1, &nth2, ry);
+ decode_year(y, *ns ? -1 : +1, &nth2, ry);
}
}
else {
@@ -2287,7 +2330,7 @@ valid_nth_kday_p(VALUE y, int m, int n, int k, double sg,
*ry = FIX2INT(y);
else {
VALUE nth2;
- decode_year(y, ns ? -1 : +1, &nth2, ry);
+ decode_year(y, *ns ? -1 : +1, &nth2, ry);
}
}
else {
@@ -2431,8 +2474,6 @@ date_s__valid_jd_p(int argc, VALUE *argv, VALUE klass)
*
* Just returns true. It's nonsense, but is for symmetry.
*
- * For example:
- *
* Date.valid_jd?(2451944) #=> true
*
* See also jd.
@@ -2521,8 +2562,6 @@ date_s__valid_civil_p(int argc, VALUE *argv, VALUE klass)
*
* Returns true if the given calendar date is valid, and false if not.
*
- * For example:
- *
* Date.valid_date?(2001,2,3) #=> true
* Date.valid_date?(2001,2,29) #=> false
*
@@ -2604,8 +2643,6 @@ date_s__valid_ordinal_p(int argc, VALUE *argv, VALUE klass)
*
* Returns true if the given ordinal date is valid, and false if not.
*
- * For example:
- *
* Date.valid_ordinal?(2001,34) #=> true
* Date.valid_ordinal?(2001,366) #=> false
*
@@ -2688,8 +2725,6 @@ date_s__valid_commercial_p(int argc, VALUE *argv, VALUE klass)
*
* Returns true if the given week date is valid, and false if not.
*
- * For example:
- *
* Date.valid_commercial?(2001,5,6) #=> true
* Date.valid_commercial?(2001,5,8) #=> false
*
@@ -2875,8 +2910,6 @@ date_s_zone_to_diff(VALUE klass, VALUE str)
* Returns true if the given year is a leap year of the proleptic
* Julian calendar.
*
- * For example:
- *
* Date.julian_leap?(1900) #=> true
* Date.julian_leap?(1901) #=> false
*/
@@ -2898,8 +2931,6 @@ date_s_julian_leap_p(VALUE klass, VALUE y)
* Returns true if the given year is a leap year of the proleptic
* Gregorian calendar.
*
- * For example:
- *
* Date.gregorian_leap?(1900) #=> false
* Date.gregorian_leap?(2000) #=> true
*/
@@ -3227,8 +3258,6 @@ static VALUE d_lite_plus(VALUE, VALUE);
* Creates a date object denoting the given chronological Julian day
* number.
*
- * For example:
- *
* Date.jd(2451944) #=> #<Date: 2001-02-03 ...>
* Date.jd(2451945) #=> #<Date: 2001-02-04 ...>
* Date.jd(0) #=> #<Date: -4712-01-01 ...>
@@ -3279,8 +3308,6 @@ date_s_jd(int argc, VALUE *argv, VALUE klass)
* relative day from the end of year when negative). It should not be
* zero.
*
- * For example:
- *
* Date.ordinal(2001) #=> #<Date: 2001-01-01 ...>
* Date.ordinal(2001,34) #=> #<Date: 2001-02-03 ...>
* Date.ordinal(2001,-1) #=> #<Date: 2001-12-31 ...>
@@ -3349,8 +3376,6 @@ date_s_ordinal(int argc, VALUE *argv, VALUE klass)
* Gregorian calendar) and Date::JULIAN (the proleptic Julian
* calendar) can be specified as a day of calendar reform.
*
- * For example:
- *
* Date.new(2001) #=> #<Date: 2001-01-01 ...>
* Date.new(2001,2,3) #=> #<Date: 2001-02-03 ...>
* Date.new(2001,2,-1) #=> #<Date: 2001-02-28 ...>
@@ -3428,8 +3453,6 @@ date_s_civil(int argc, VALUE *argv, VALUE klass)
* number (as a relative week/day from the end of year/week when
* negative). They should not be zero.
*
- * For example:
- *
* Date.commercial(2001) #=> #<Date: 2001-01-01 ...>
* Date.commercial(2002) #=> #<Date: 2001-12-31 ...>
* Date.commercial(2001,5,6) #=> #<Date: 2001-02-03 ...>
@@ -3608,8 +3631,6 @@ static void set_sg(union DateData *, double);
* call-seq:
* Date.today([start=Date::ITALY]) -> date
*
- * For example:
- *
* Date.today #=> #<Date: 2011-06-11 ..>
*
* Creates a date object denoting the present day.
@@ -4205,9 +4226,8 @@ date_s__strptime_internal(int argc, VALUE *argv, VALUE klass,
* Date._strptime(string[, format='%F']) -> hash
*
* Parses the given representation of date and time with the given
- * template, and returns a hash of parsed elements.
- *
- * For example:
+ * template, and returns a hash of parsed elements. _strptime does
+ * not support specification of flags and width unlike strftime.
*
* Date._strptime('2001-02-03', '%Y-%m-%d')
* #=> {:year=>2001, :mon=>2, :mday=>3}
@@ -4225,9 +4245,8 @@ date_s__strptime(int argc, VALUE *argv, VALUE klass)
* Date.strptime([string='-4712-01-01'[, format='%F'[, start=ITALY]]]) -> date
*
* Parses the given representation of date and time with the given
- * template, and creates a date object.
- *
- * For example:
+ * template, and creates a date object. strptime does not support
+ * specification of flags and width unlike strftime.
*
* Date.strptime('2001-02-03', '%Y-%m-%d') #=> #<Date: 2001-02-03 ...>
* Date.strptime('03-02-2001', '%d-%m-%Y') #=> #<Date: 2001-02-03 ...>
@@ -4300,14 +4319,13 @@ date_s__parse_internal(int argc, VALUE *argv, VALUE klass)
* Date._parse(string[, comp=true]) -> hash
*
* Parses the given representation of date and time, and returns a
- * hash of parsed elements.
+ * hash of parsed elements. This method does not function as a
+ * validator.
*
* If the optional second argument is true and the detected year is in
* the range "00" to "99", considers the year a 2-digit form and makes
* it full.
*
- * For example:
- *
* Date._parse('2001-02-03') #=> {:year=>2001, :mon=>2, :mday=>3}
*/
static VALUE
@@ -4321,14 +4339,12 @@ date_s__parse(int argc, VALUE *argv, VALUE klass)
* Date.parse(string='-4712-01-01'[, comp=true[, start=ITALY]]) -> date
*
* Parses the given representation of date and time, and creates a
- * date object.
+ * date object. This method does not function as a validator.
*
* If the optional second argument is true and the detected year is in
* the range "00" to "99", considers the year a 2-digit form and makes
* it full.
*
- * For example:
- *
* Date.parse('2001-02-03') #=> #<Date: 2001-02-03 ...>
* Date.parse('20010203') #=> #<Date: 2001-02-03 ...>
* Date.parse('3rd Feb 2001') #=> #<Date: 2001-02-03 ...>
@@ -4385,8 +4401,6 @@ date_s__iso8601(VALUE klass, VALUE str)
* Creates a new Date object by parsing from a string according to
* some typical ISO 8601 formats.
*
- * For example:
- *
* Date.iso8601('2001-02-03') #=> #<Date: 2001-02-03 ...>
* Date.iso8601('20010203') #=> #<Date: 2001-02-03 ...>
* Date.iso8601('2001-W05-6') #=> #<Date: 2001-02-03 ...>
@@ -4430,8 +4444,6 @@ date_s__rfc3339(VALUE klass, VALUE str)
* Creates a new Date object by parsing from a string according to
* some typical RFC 3339 formats.
*
- * For example:
- *
* Date.rfc3339('2001-02-03T04:05:06+07:00') #=> #<Date: 2001-02-03 ...>
*/
static VALUE
@@ -4473,8 +4485,6 @@ date_s__xmlschema(VALUE klass, VALUE str)
* Creates a new Date object by parsing from a string according to
* some typical XML Schema formats.
*
- * For example:
- *
* Date.xmlschema('2001-02-03') #=> #<Date: 2001-02-03 ...>
*/
static VALUE
@@ -4518,8 +4528,6 @@ date_s__rfc2822(VALUE klass, VALUE str)
* Creates a new Date object by parsing from a string according to
* some typical RFC 2822 formats.
*
- * For example:
- *
* Date.rfc2822('Sat, 3 Feb 2001 00:00:00 +0000')
* #=> #<Date: 2001-02-03 ...>
*/
@@ -4562,11 +4570,8 @@ date_s__httpdate(VALUE klass, VALUE str)
* Creates a new Date object by parsing from a string according to
* some RFC 2616 format.
*
- * For example:
- *
* Date.httpdate('Sat, 03 Feb 2001 00:00:00 GMT')
* #=> #<Date: 2001-02-03 ...>
- *
*/
static VALUE
date_s_httpdate(int argc, VALUE *argv, VALUE klass)
@@ -4607,8 +4612,6 @@ date_s__jisx0301(VALUE klass, VALUE str)
* Creates a new Date object by parsing from a string according to
* some typical JIS X 0301 formats.
*
- * For example:
- *
* Date.jisx0301('H13.02.03') #=> #<Date: 2001-02-03 ...>
*/
static VALUE
@@ -4694,6 +4697,9 @@ d_lite_initialize(int argc, VALUE *argv, VALUE self)
int df, of;
double sg;
+ rb_check_frozen(self);
+ rb_check_trusted(self);
+
rb_scan_args(argc, argv, "05", &vjd, &vdf, &vsf, &vof, &vsg);
jd = INT2FIX(0);
@@ -4747,6 +4753,9 @@ d_lite_initialize(int argc, VALUE *argv, VALUE self)
static VALUE
d_lite_initialize_copy(VALUE copy, VALUE date)
{
+ rb_check_frozen(copy);
+ rb_check_trusted(copy);
+
if (copy == date)
return copy;
{
@@ -4794,8 +4803,6 @@ d_lite_fill(VALUE self)
* Returns the astronomical Julian day number. This is a fractional
* number, which is not adjusted by the offset.
*
- * For example:
- *
* DateTime.new(2001,2,3,4,5,6,'+7').ajd #=> (11769328217/4800)
* DateTime.new(2001,2,2,14,5,6,'-7').ajd #=> (11769328217/4800)
*/
@@ -4813,8 +4820,6 @@ d_lite_ajd(VALUE self)
* Returns the astronomical modified Julian day number. This is
* a fractional number, which is not adjusted by the offset.
*
- * For example:
- *
* DateTime.new(2001,2,3,4,5,6,'+7').amjd #=> (249325817/4800)
* DateTime.new(2001,2,2,14,5,6,'-7').amjd #=> (249325817/4800)
*/
@@ -4832,8 +4837,6 @@ d_lite_amjd(VALUE self)
* Returns the Julian day number. This is a whole number, which is
* adjusted by the offset as the local time.
*
- * For example:
- *
* DateTime.new(2001,2,3,4,5,6,'+7').jd #=> 2451944
* DateTime.new(2001,2,3,4,5,6,'-7').jd #=> 2451944
*/
@@ -4851,8 +4854,6 @@ d_lite_jd(VALUE self)
* Returns the modified Julian day number. This is a whole number,
* which is adjusted by the offset as the local time.
*
- * For example:
- *
* DateTime.new(2001,2,3,4,5,6,'+7').mjd #=> 51943
* DateTime.new(2001,2,3,4,5,6,'-7').mjd #=> 51943
*/
@@ -4870,8 +4871,6 @@ d_lite_mjd(VALUE self)
* Returns the Lilian day number. This is a whole number, which is
* adjusted by the offset as the local time.
*
- * For example:
- *
* Date.new(2001,2,3).ld #=> 152784
*/
static VALUE
@@ -4887,8 +4886,6 @@ d_lite_ld(VALUE self)
*
* Returns the year.
*
- * For example:
- *
* Date.new(2001,2,3).year #=> 2001
* (Date.new(1,1,1) - 1).year #=> 0
*/
@@ -4905,8 +4902,6 @@ d_lite_year(VALUE self)
*
* Returns the day of the year (1-366).
*
- * For example:
- *
* Date.new(2001,2,3).yday #=> 34
*/
static VALUE
@@ -4923,8 +4918,6 @@ d_lite_yday(VALUE self)
*
* Returns the month (1-12).
*
- * For example:
- *
* Date.new(2001,2,3).mon #=> 2
*/
static VALUE
@@ -4941,8 +4934,6 @@ d_lite_mon(VALUE self)
*
* Returns the day of the month (1-31).
*
- * For example:
- *
* Date.new(2001,2,3).mday #=> 3
*/
static VALUE
@@ -4958,8 +4949,6 @@ d_lite_mday(VALUE self)
*
* Returns the fractional part of the day.
*
- * For example:
- *
* DateTime.new(2001,2,3,12).day_fraction #=> (1/2)
*/
static VALUE
@@ -4977,8 +4966,6 @@ d_lite_day_fraction(VALUE self)
*
* Returns the calendar week based year.
*
- * For example:
- *
* Date.new(2001,2,3).cwyear #=> 2001
* Date.new(2000,1,1).cwyear #=> 1999
*/
@@ -4995,8 +4982,6 @@ d_lite_cwyear(VALUE self)
*
* Returns the calendar week number (1-53).
*
- * For example:
- *
* Date.new(2001,2,3).cweek #=> 5
*/
static VALUE
@@ -5012,8 +4997,6 @@ d_lite_cweek(VALUE self)
*
* Returns the day of calendar week (1-7, Monday is 1).
*
- * For example:
- *
* Date.new(2001,2,3).cwday #=> 6
*/
static VALUE
@@ -5045,8 +5028,6 @@ d_lite_wnum1(VALUE self)
*
* Returns the day of week (0-6, Sunday is zero).
*
- * For example:
- *
* Date.new(2001,2,3).wday #=> 6
*/
static VALUE
@@ -5173,8 +5154,6 @@ d_lite_nth_kday_p(VALUE self, VALUE n, VALUE k)
*
* Returns the hour (0-23).
*
- * For example:
- *
* DateTime.new(2001,2,3,4,5,6).hour #=> 4
*/
static VALUE
@@ -5191,8 +5170,6 @@ d_lite_hour(VALUE self)
*
* Returns the minute (0-59).
*
- * For example:
- *
* DateTime.new(2001,2,3,4,5,6).min #=> 5
*/
static VALUE
@@ -5209,8 +5186,6 @@ d_lite_min(VALUE self)
*
* Returns the second (0-59).
*
- * For example:
- *
* DateTime.new(2001,2,3,4,5,6).sec #=> 6
*/
static VALUE
@@ -5227,8 +5202,6 @@ d_lite_sec(VALUE self)
*
* Returns the fractional part of the second.
*
- * For example:
- *
* DateTime.new(2001,2,3,4,5,6.5).sec_fraction #=> (1/2)
*/
static VALUE
@@ -5244,8 +5217,6 @@ d_lite_sec_fraction(VALUE self)
*
* Returns the offset.
*
- * For example:
- *
* DateTime.parse('04pm+0730').offset #=> (5/16)
*/
static VALUE
@@ -5261,8 +5232,6 @@ d_lite_offset(VALUE self)
*
* Returns the timezone.
*
- * For example:
- *
* DateTime.parse('04pm+0730').zone #=> "+07:30"
*/
static VALUE
@@ -5278,8 +5247,6 @@ d_lite_zone(VALUE self)
*
* Retruns true if the date is before the day of calendar reform.
*
- * For example:
- *
* Date.new(1582,10,15).julian? #=> false
* (Date.new(1582,10,15) - 1).julian? #=> true
*/
@@ -5296,8 +5263,6 @@ d_lite_julian_p(VALUE self)
*
* Retunrs true if the date is on or after the day of calendar reform.
*
- * For example:
- *
* Date.new(1582,10,15).gregorian? #=> true
* (Date.new(1582,10,15) - 1).gregorian? #=> false
*/
@@ -5314,8 +5279,6 @@ d_lite_gregorian_p(VALUE self)
*
* Returns true if the year is a leap year.
*
- * For example:
- *
* Date.new(2000).leap? #=> true
* Date.new(2001).leap? #=> false
*/
@@ -5340,8 +5303,6 @@ d_lite_leap_p(VALUE self)
*
* Returns the Julian day number denoting the day of calendar reform.
*
- * For example:
- *
* Date.new(2001,2,3).start #=> 2299161.0
* Date.new(2001,2,3,Date::GREGORIAN).start #=> -Infinity
*/
@@ -5386,12 +5347,12 @@ set_sg(union DateData *x, double sg)
if (simple_dat_p(x)) {
get_s_jd(x);
clear_civil(x);
- x->s.sg = (sg_cast)sg;
+ x->s.sg = (date_sg_t)sg;
} else {
get_c_jd(x);
get_c_df(x);
clear_civil(x);
- x->c.sg = (sg_cast)sg;
+ x->c.sg = (date_sg_t)sg;
}
}
@@ -5412,8 +5373,6 @@ dup_obj_with_new_start(VALUE obj, double sg)
*
* Duplicates self and resets its the day of calendar reform.
*
- * For example:
- *
* d = Date.new(1582,10,15)
* d.new_start(Date::JULIAN) #=> #<Date: 1582-10-05 ...>
*/
@@ -5507,8 +5466,6 @@ dup_obj_with_new_offset(VALUE obj, int of)
*
* Duplicates self and resets its offset.
*
- * For example:
- *
* d = DateTime.new(2001,2,3,4,5,6,'-02:00')
* #=> #<DateTime: 2001-02-03T04:05:06-02:00 ...>
* d.new_offset('+09:00') #=> #<DateTime: 2001-02-03T15:05:06+09:00 ...>
@@ -5536,8 +5493,6 @@ d_lite_new_offset(int argc, VALUE *argv, VALUE self)
* should be a numeric value. If the other is flonum, assumes its
* precision is at most nanosecond.
*
- * For example:
- *
* Date.new(2001,2,3) + 1 #=> #<Date: 2001-02-04 ...>
* DateTime.new(2001,2,3) + Rational(1,2)
* #=> #<DateTime: 2001-02-03T12:00:00+00:00 ...>
@@ -5569,15 +5524,7 @@ d_lite_plus(VALUE self, VALUE other)
jd = m_jd(dat);
else {
jd = m_jd(dat) + (int)t;
-
- if (jd < 0) {
- nth = f_sub(nth, INT2FIX(1));
- jd += CM_PERIOD;
- }
- else if (jd >= CM_PERIOD) {
- nth = f_add(nth, INT2FIX(1));
- jd -= CM_PERIOD;
- }
+ canonicalize_jd(nth, jd);
}
if (simple_dat_p(dat))
@@ -5630,14 +5577,7 @@ d_lite_plus(VALUE self, VALUE other)
jd = m_jd(dat);
else {
jd = m_jd(dat) + jd;
- if (jd < 0) {
- nth = f_sub(nth, INT2FIX(1));
- jd += CM_PERIOD;
- }
- else if (jd >= CM_PERIOD) {
- nth = f_add(nth, INT2FIX(1));
- jd -= CM_PERIOD;
- }
+ canonicalize_jd(nth, jd);
}
if (f_zero_p(nth))
@@ -5744,14 +5684,7 @@ d_lite_plus(VALUE self, VALUE other)
jd = m_jd(dat);
else {
jd = m_jd(dat) + jd;
- if (jd < 0) {
- nth = f_sub(nth, INT2FIX(1));
- jd += CM_PERIOD;
- }
- else if (jd >= CM_PERIOD) {
- nth = f_add(nth, INT2FIX(1));
- jd -= CM_PERIOD;
- }
+ canonicalize_jd(nth, jd);
}
if (f_zero_p(nth))
@@ -5854,14 +5787,7 @@ d_lite_plus(VALUE self, VALUE other)
jd = m_jd(dat);
else {
jd = m_jd(dat) + jd;
- if (jd < 0) {
- nth = f_sub(nth, INT2FIX(1));
- jd += CM_PERIOD;
- }
- else if (jd >= CM_PERIOD) {
- nth = f_add(nth, INT2FIX(1));
- jd -= CM_PERIOD;
- }
+ canonicalize_jd(nth, jd);
}
if (f_zero_p(nth))
@@ -5905,15 +5831,7 @@ minus_dd(VALUE self, VALUE other)
d = m_jd(adat) - m_jd(bdat);
df = m_df(adat) - m_df(bdat);
sf = f_sub(m_sf(adat), m_sf(bdat));
-
- if (d < 0) {
- n = f_sub(n, INT2FIX(1));
- d += CM_PERIOD;
- }
- else if (d >= CM_PERIOD) {
- n = f_add(n, INT2FIX(1));
- d -= CM_PERIOD;
- }
+ canonicalize_jd(n, d);
if (df < 0) {
d -= 1;
@@ -5960,8 +5878,6 @@ minus_dd(VALUE self, VALUE other)
* pointing other days before self. If the other is flonum, assumes
* its precision is at most nanosecond.
*
- * For example:
- *
* Date.new(2001,2,3) - 1 #=> #<Date: 2001-02-02 ...>
* DateTime.new(2001,2,3) - Rational(1,2)
* #=> #<DateTime: 2001-02-02T12:00:00+00:00 ...>
@@ -6027,6 +5943,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.
@@ -6044,8 +5961,6 @@ d_lite_next(VALUE self)
* Returns a date object pointing n months after self. The n should
* be a numeric value.
*
- * For example:
- *
* Date.new(2001,2,3) >> 1 #=> #<Date: 2001-03-03 ...>
* Date.new(2001,1,31) >> 1 #=> #<Date: 2001-02-28 ...>
* Date.new(2001,2,3) >> -2 #=> #<Date: 2000-12-03 ...>
@@ -6096,8 +6011,6 @@ d_lite_rshift(VALUE self, VALUE other)
* Returns a date object pointing n months before self. The n should
* be a numeric value.
*
- * For example:
- *
* Date.new(2001,2,3) << 1 #=> #<Date: 2001-01-03 ...>
* Date.new(2001,1,31) << 11 #=> #<Date: 2000-02-29 ...>
* Date.new(2001,2,3) << -1 #=> #<Date: 2001-03-03 ...>
@@ -6186,8 +6099,6 @@ static VALUE d_lite_cmp(VALUE, VALUE);
* Iterates evaluation of the given block, which takes a date object.
* The limit should be a date object.
*
- * For example:
- *
* Date.new(2001).step(Date.new(2001,-1,-1)).select{|d| d.sunday?}.size
* #=> 52
*/
@@ -6299,6 +6210,8 @@ cmp_dd(VALUE self, VALUE other)
int a_jd, b_jd,
a_df, b_df;
+ 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)) {
@@ -6351,8 +6264,6 @@ cmp_dd(VALUE self, VALUE other)
* should be a date object or a numeric value as an astronomical
* Julian day number.
*
- * For example:
- *
* Date.new(2001,2,3) <=> Date.new(2001,2,4) #=> -1
* Date.new(2001,2,3) <=> Date.new(2001,2,3) #=> 0
* Date.new(2001,2,3) <=> Date.new(2001,2,2) #=> 1
@@ -6374,11 +6285,12 @@ 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;
+ 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)) {
@@ -6401,74 +6313,6 @@ d_lite_cmp(VALUE self, VALUE other)
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
-
- 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);
- }
- else {
- return INT2FIX(1);
- }
- }
}
}
@@ -6490,8 +6334,6 @@ equal_gen(VALUE self, VALUE other)
*
* Returns true if they are the same day.
*
- * For example:
- *
* Date.new(2001,2,3) === Date.new(2001,2,3)
* #=> true
* Date.new(2001,2,3) === Date.new(2001,2,4)
@@ -6515,11 +6357,12 @@ 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;
+ m_canonicalize_jd(adat);
+ m_canonicalize_jd(bdat);
a_nth = m_nth(adat);
b_nth = m_nth(bdat);
a_jd = m_local_jd(adat);
@@ -6529,45 +6372,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
-
- 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;
- }
}
}
@@ -6607,8 +6411,6 @@ static VALUE strftimev(const char *, VALUE,
* Returns a string in an ISO 8601 format (This method doesn't use the
* expanded representations).
*
- * For example:
- *
* Date.new(2001,2,3).to_s #=> "2001-02-03"
*/
static VALUE
@@ -6711,13 +6513,10 @@ mk_inspect(union DateData *x, const char *klass, const char *to_s)
*
* Returns the value as a string for inspection.
*
- * For example:
- *
* Date.new(2001,2,3).inspect
* #=> "#<Date: 2001-02-03 ((2451944j,0s,0n),+0s,2299161j)>"
* DateTime.new(2001,2,3,4,5,6,'-7').inspect
* #=> "#<DateTime: 2001-02-03T04:05:06-07:00 ((2451944j,39906s,0n),-25200s,2299161j)>"
- *
*/
static VALUE
d_lite_inspect(VALUE self)
@@ -6805,10 +6604,10 @@ tmx_m_msecs(union DateData *x)
return s;
}
-static VALUE
+static int
tmx_m_of(union DateData *x)
{
- return INT2FIX(m_of(x));
+ return m_of(x);
}
static char *
@@ -6834,7 +6633,7 @@ static struct tmx_funcs tmx_funcs = {
(VALUE (*)(void *))m_sf_in_sec,
(VALUE (*)(void *))tmx_m_secs,
(VALUE (*)(void *))tmx_m_msecs,
- (VALUE (*)(void *))tmx_m_of,
+ (int (*)(void *))tmx_m_of,
(char *(*)(void *))tmx_m_zone
};
@@ -6925,12 +6724,11 @@ date_strftime_internal(int argc, VALUE *argv, VALUE self,
* 0 use zeros for padding.
* ^ upcase the result string.
* # change case.
- * : use colons for %z.
*
* The minimum field width specifies the minimum width.
*
- * The modifier is "E" and "O".
- * They are ignored.
+ * The modifiers are "E", "O", ":", "::" and ":::".
+ * "E" and "O" are ignored. No effect to result currently.
*
* Format directives:
*
@@ -6969,10 +6767,10 @@ date_strftime_internal(int argc, VALUE *argv, VALUE self,
*
* %L - Millisecond of the second (000..999)
* %N - Fractional seconds digits, default is 9 digits (nanosecond)
- * %3N millisecond (3 digits)
- * %6N microsecond (6 digits)
- * %9N nanosecond (9 digits)
- * %12N picosecond (12 digits)
+ * %3N millisecond (3 digits) %15N femtosecond (15 digits)
+ * %6N microsecond (6 digits) %18N attosecond (18 digits)
+ * %9N nanosecond (9 digits) %21N zeptosecond (21 digits)
+ * %12N picosecond (12 digits) %24N yoctosecond (24 digits)
*
* Time zone:
* %z - Time zone as hour and minute offset from UTC (e.g. +0900)
@@ -6980,7 +6778,7 @@ date_strftime_internal(int argc, VALUE *argv, VALUE self,
* %::z - hour, minute and second offset from UTC (e.g. +09:00:00)
* %:::z - hour, minute and second offset from UTC
* (e.g. +09, +09:30, +09:30:30)
- * %Z - Time zone abbreviation name
+ * %Z - Time zone abbreviation name or something similar information.
*
* Weekday:
* %A - The full weekday name (``Sunday'')
@@ -7006,7 +6804,7 @@ date_strftime_internal(int argc, VALUE *argv, VALUE self,
*
* Seconds since the Unix Epoch:
* %s - Number of seconds since 1970-01-01 00:00:00 UTC.
- * %Q - Number of microseconds since 1970-01-01 00:00:00 UTC.
+ * %Q - Number of milliseconds since 1970-01-01 00:00:00 UTC.
*
* Literal string:
* %n - Newline character (\n)
@@ -7202,8 +7000,6 @@ jisx0301_date(VALUE jd, VALUE y)
*
* Returns a string in a JIS X 0301 format.
*
- * For example:
- *
* Date.new(2001,2,3).jisx0301 #=> "H13.02.03"
*/
static VALUE
@@ -7269,19 +7065,33 @@ d_lite_marshal_load(VALUE self, VALUE a)
{
get_d1(self);
+ rb_check_frozen(self);
+ rb_check_trusted(self);
+
if (TYPE(a) != T_ARRAY)
rb_raise(rb_eTypeError, "expected an array");
switch (RARRAY_LEN(a)) {
- case 3:
+ case 2: /* 1.6.x */
+ case 3: /* 1.8.x, 1.9.2 */
{
VALUE ajd, of, sg, nth, sf;
int jd, df, rof;
double rsg;
- ajd = RARRAY_PTR(a)[0];
- of = RARRAY_PTR(a)[1];
- sg = RARRAY_PTR(a)[2];
+
+ if (RARRAY_LEN(a) == 2) {
+ ajd = f_sub(RARRAY_PTR(a)[0], half_days_in_day);
+ of = INT2FIX(0);
+ sg = RARRAY_PTR(a)[1];
+ if (!k_numeric_p(sg))
+ sg = DBL2NUM(RTEST(sg) ? GREGORIAN : JULIAN);
+ }
+ else {
+ ajd = RARRAY_PTR(a)[0];
+ of = RARRAY_PTR(a)[1];
+ sg = RARRAY_PTR(a)[2];
+ }
old_to_new(ajd, of, sg,
&nth, &jd, &df, &sf, &rof, &rsg);
@@ -7337,6 +7147,16 @@ d_lite_marshal_load(VALUE self, VALUE a)
return self;
}
+/* :nodoc: */
+static VALUE
+date_s__load(VALUE klass, VALUE s)
+{
+ VALUE a, obj;
+
+ a = rb_marshal_load(s);
+ obj = d_lite_s_alloc(klass);
+ return d_lite_marshal_load(obj, a);
+}
/* datetime */
@@ -7347,8 +7167,6 @@ d_lite_marshal_load(VALUE self, VALUE a)
* Creates a datetime object denoting the given chronological Julian
* day number.
*
- * For example:
- *
* DateTime.jd(2451944) #=> #<DateTime: 2001-02-03T00:00:00+00:00 ...>
* DateTime.jd(2451945) #=> #<DateTime: 2001-02-04T00:00:00+00:00 ...>
* DateTime.jd(Rational('0.5'))
@@ -7416,8 +7234,6 @@ datetime_s_jd(int argc, VALUE *argv, VALUE klass)
*
* Creates a date-time object denoting the given ordinal date.
*
- * For example:
- *
* DateTime.ordinal(2001,34) #=> #<DateTime: 2001-02-03T00:00:00+00:00 ...>
* DateTime.ordinal(2001,34,4,5,6,'+7')
* #=> #<DateTime: 2001-02-03T04:05:06+07:00 ...>
@@ -7494,8 +7310,6 @@ datetime_s_ordinal(int argc, VALUE *argv, VALUE klass)
*
* Creates a date-time object denoting the given calendar date.
*
- * For example:
- *
* DateTime.new(2001,2,3) #=> #<DateTime: 2001-02-03T00:00:00+00:00 ...>
* DateTime.new(2001,2,3,4,5,6,'+7')
* #=> #<DateTime: 2001-02-03T04:05:06+07:00 ...>
@@ -7594,8 +7408,6 @@ datetime_s_civil(int argc, VALUE *argv, VALUE klass)
*
* Creates a date-time object denoting the given week date.
*
- * For example:
- *
* DateTime.commercial(2001) #=> #<DateTime: 2001-01-01T00:00:00+00:00 ...>
* DateTime.commercial(2002) #=> #<DateTime: 2001-12-31T00:00:00+00:00 ...>
* DateTime.commercial(2001,5,6,4,5,6,'+7')
@@ -7813,8 +7625,6 @@ datetime_s_nth_kday(int argc, VALUE *argv, VALUE klass)
*
* Creates a date-time object denoting the present time.
*
- * For example:
- *
* DateTime.now #=> #<DateTime: 2011-06-11T21:20:44+09:00 ...>
*/
static VALUE
@@ -7950,7 +7760,7 @@ dt_new_by_frags(VALUE klass, VALUE hash, VALUE sg)
set_hash("min", INT2FIX(0));
if (NIL_P(ref_hash("sec")))
set_hash("sec", INT2FIX(0));
- else if (f_gt_p(ref_hash("sec"), INT2FIX(59)))
+ else if (f_eqeq_p(ref_hash("sec"), INT2FIX(60)))
set_hash("sec", INT2FIX(59));
}
else {
@@ -8013,7 +7823,8 @@ dt_new_by_frags(VALUE klass, VALUE hash, VALUE sg)
* DateTime._strptime(string[, format='%FT%T%z']) -> hash
*
* Parses the given representation of date and time with the given
- * template, and returns a hash of parsed elements.
+ * template, and returns a hash of parsed elements. _strptime does
+ * not support specification of flags and width unlike strftime.
*
* See also strptime(3) and strftime.
*/
@@ -8028,9 +7839,8 @@ datetime_s__strptime(int argc, VALUE *argv, VALUE klass)
* DateTime.strptime([string='-4712-01-01T00:00:00+00:00'[, format='%FT%T%z'[ ,start=ITALY]]]) -> datetime
*
* Parses the given representation of date and time with the given
- * template, and creates a date object.
- *
- * For example:
+ * template, and creates a date object. strptime does not support
+ * specification of flags and width unlike strftime.
*
* DateTime.strptime('2001-02-03T04:05:06+07:00', '%Y-%m-%dT%H:%M:%S%z')
* #=> #<DateTime: 2001-02-03T04:05:06+07:00 ...>
@@ -8082,13 +7892,11 @@ datetime_s_strptime(int argc, VALUE *argv, VALUE klass)
* DateTime.parse(string='-4712-01-01T00:00:00+00:00'[, comp=true[, start=ITALY]]) -> datetime
*
* Parses the given representation of date and time, and creates a
- * date object.
+ * date object. This method does not function as a validator.
*
* If the optional second argument is true and the detected year is in
* the range "00" to "99", makes it full.
*
- * For example:
- *
* DateTime.parse('2001-02-03T04:05:06+07:00')
* #=> #<DateTime: 2001-02-03T04:05:06+07:00 ...>
* DateTime.parse('20010203T040506+0700')
@@ -8129,8 +7937,6 @@ datetime_s_parse(int argc, VALUE *argv, VALUE klass)
* Creates a new Date object by parsing from a string according to
* some typical ISO 8601 formats.
*
- * For example:
- *
* DateTime.iso8601('2001-02-03T04:05:06+07:00')
* #=> #<DateTime: 2001-02-03T04:05:06+07:00 ...>
* DateTime.iso8601('20010203T040506+0700')
@@ -8165,8 +7971,6 @@ datetime_s_iso8601(int argc, VALUE *argv, VALUE klass)
* Creates a new Date object by parsing from a string according to
* some typical RFC 3339 formats.
*
- * For example:
- *
* DateTime.rfc3339('2001-02-03T04:05:06+07:00')
* #=> #<DateTime: 2001-02-03T04:05:06+07:00 ...>
*/
@@ -8197,8 +8001,6 @@ datetime_s_rfc3339(int argc, VALUE *argv, VALUE klass)
* Creates a new Date object by parsing from a string according to
* some typical XML Schema formats.
*
- * For example:
- *
* DateTime.xmlschema('2001-02-03T04:05:06+07:00')
* #=> #<DateTime: 2001-02-03T04:05:06+07:00 ...>
*/
@@ -8230,8 +8032,6 @@ datetime_s_xmlschema(int argc, VALUE *argv, VALUE klass)
* Creates a new Date object by parsing from a string according to
* some typical RFC 2822 formats.
*
- * For example:
- *
* DateTime.rfc2822('Sat, 3 Feb 2001 04:05:06 +0700')
* #=> #<DateTime: 2001-02-03T04:05:06+07:00 ...>
*/
@@ -8262,8 +8062,6 @@ datetime_s_rfc2822(int argc, VALUE *argv, VALUE klass)
* Creates a new Date object by parsing from a string according to
* some RFC 2616 format.
*
- * For example:
- *
* DateTime.httpdate('Sat, 03 Feb 2001 04:05:06 GMT')
* #=> #<DateTime: 2001-02-03T04:05:06+00:00 ...>
*/
@@ -8294,8 +8092,6 @@ datetime_s_httpdate(int argc, VALUE *argv, VALUE klass)
* Creates a new Date object by parsing from a string according to
* some typical JIS X 0301 formats.
*
- * For example:
- *
* DateTime.jisx0301('H13.02.03T04:05:06+07:00')
* #=> #<DateTime: 2001-02-03T04:05:06+07:00 ...>
*/
@@ -8326,8 +8122,6 @@ datetime_s_jisx0301(int argc, VALUE *argv, VALUE klass)
* Returns a string in an ISO 8601 format (This method doesn't use the
* expanded representations).
*
- * For example:
- *
* DateTime.new(2001,2,3,4,5,6,'-7').to_s
* #=> "2001-02-03T04:05:06-07:00"
*/
@@ -8404,10 +8198,10 @@ dt_lite_to_s(VALUE self)
*
* %L - Millisecond of the second (000..999)
* %N - Fractional seconds digits, default is 9 digits (nanosecond)
- * %3N millisecond (3 digits)
- * %6N microsecond (6 digits)
- * %9N nanosecond (9 digits)
- * %12N picosecond (12 digits)
+ * %3N millisecond (3 digits) %15N femtosecond (15 digits)
+ * %6N microsecond (6 digits) %18N attosecond (18 digits)
+ * %9N nanosecond (9 digits) %21N zeptosecond (21 digits)
+ * %12N picosecond (12 digits) %24N yoctosecond (24 digits)
*
* Time zone:
* %z - Time zone as hour and minute offset from UTC (e.g. +0900)
@@ -8415,7 +8209,7 @@ dt_lite_to_s(VALUE self)
* %::z - hour, minute and second offset from UTC (e.g. +09:00:00)
* %:::z - hour, minute and second offset from UTC
* (e.g. +09, +09:30, +09:30:30)
- * %Z - Time zone abbreviation name
+ * %Z - Time zone abbreviation name or something similar information.
*
* Weekday:
* %A - The full weekday name (``Sunday'')
@@ -8441,7 +8235,7 @@ dt_lite_to_s(VALUE self)
*
* Seconds since the Unix Epoch:
* %s - Number of seconds since 1970-01-01 00:00:00 UTC.
- * %Q - Number of microseconds since 1970-01-01 00:00:00 UTC.
+ * %Q - Number of milliseconds since 1970-01-01 00:00:00 UTC.
*
* Literal string:
* %n - Newline character (\n)
@@ -8526,6 +8320,7 @@ iso8601_timediv(VALUE self, VALUE n)
{
VALUE fmt;
+ n = to_integer(n);
fmt = rb_usascii_str_new2("T%H:%M:%S");
if (f_gt_p(n, INT2FIX(0))) {
VALUE argv[3];
@@ -8551,8 +8346,6 @@ iso8601_timediv(VALUE self, VALUE n)
* This method is equivalent to strftime('%FT%T'). The optional
* argument n is length of fractional seconds.
*
- * For example:
- *
* DateTime.parse('2001-02-03T04:05:06.123456789+07:00').iso8601(9)
* #=> "2001-02-03T04:05:06.123456789+07:00"
*/
@@ -8577,8 +8370,6 @@ dt_lite_iso8601(int argc, VALUE *argv, VALUE self)
* This method is equivalent to strftime('%FT%T'). The optional
* argument n is length of fractional seconds.
*
- * For example:
- *
* DateTime.parse('2001-02-03T04:05:06.123456789+07:00').rfc3339(9)
* #=> "2001-02-03T04:05:06.123456789+07:00"
*/
@@ -8595,8 +8386,6 @@ dt_lite_rfc3339(int argc, VALUE *argv, VALUE self)
* Returns a string in a JIS X 0301 format. The optional argument n
* is length of fractional seconds.
*
- * For example:
- *
* DateTime.parse('2001-02-03T04:05:06.123456789+07:00').jisx0301(9)
* #=> "H13.02.03T04:05:06.123456789+07:00"
*/
@@ -8637,7 +8426,7 @@ dt_lite_jisx0301(int argc, VALUE *argv, VALUE self)
static VALUE
time_to_time(VALUE self)
{
- return rb_funcall(self, rb_intern("getlocal"), 0);
+ return f_getlocal(self);
}
/*
@@ -9400,11 +9189,11 @@ Init_date_core(void)
* zero (equals to UTC).
*
* DateTime.new(2001,2,3,4,5,6,Rational(3,24))
- * #=> #<DateTime: 2001-02-03T03:04:05+03:00 ...>
+ * #=> #<DateTime: 2001-02-03T04:05:06+03:00 ...>
* also accepts string form.
*
* DateTime.new(2001,2,3,4,5,6,'+03:00')
- * #=> #<DateTime: 2001-02-03T03:04:05+03:00 ...>
+ * #=> #<DateTime: 2001-02-03T04:05:06+03:00 ...>
*
* An optional argument the day of calendar reform (start) denotes
* a Julian day number, which should be 2298874 to 2426355 or
@@ -9432,23 +9221,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));
@@ -9672,6 +9461,7 @@ Init_date_core(void)
#endif
rb_define_method(cDate, "marshal_dump", d_lite_marshal_dump, 0);
rb_define_method(cDate, "marshal_load", d_lite_marshal_load, 1);
+ rb_define_singleton_method(cDate, "_load", date_s__load, 1);
/* datetime */
diff --git a/ext/date/date_parse.c b/ext/date/date_parse.c
index 903163003c..29dbb239bb 100644
--- a/ext/date/date_parse.c
+++ b/ext/date/date_parse.c
@@ -7,6 +7,8 @@
#include "ruby/re.h"
#include <ctype.h>
+/* #define TIGHT_PARSER */
+
#define sizeof_array(o) (sizeof o / sizeof o[0])
#define f_negate(x) rb_funcall(x, rb_intern("-@"), 0)
@@ -54,6 +56,14 @@ static const char *abbr_months[] = {
#define issign(c) ((c) == '-' || (c) == '+')
#define asp_string() rb_str_new(" ", 1)
+#ifdef TIGHT_PARSER
+#define asuba_string() rb_str_new("\001", 1)
+#define asubb_string() rb_str_new("\002", 1)
+#define asubw_string() rb_str_new("\027", 1)
+#define asubt_string() rb_str_new("\024", 1)
+#endif
+
+#define DECDIGIT "0123456789"
static void
s3e(VALUE hash, VALUE y, VALUE m, VALUE d, int bc)
@@ -89,12 +99,12 @@ s3e(VALUE hash, VALUE y, VALUE m, VALUE d, int bc)
size_t l;
s = RSTRING_PTR(y);
- while (!issign(*s) && !isdigit(*s))
+ while (!issign((unsigned char)*s) && !isdigit((unsigned char)*s))
s++;
bp = s;
- if (issign(*s))
+ if (issign((unsigned char)*s))
s++;
- l = strspn(s, "0123456789");
+ l = strspn(s, DECDIGIT);
ep = s + l;
if (*ep) {
y = d;
@@ -138,7 +148,7 @@ s3e(VALUE hash, VALUE y, VALUE m, VALUE d, int bc)
VALUE iy;
s = RSTRING_PTR(y);
- while (!issign(*s) && !isdigit(*s))
+ while (!issign((unsigned char)*s) && !isdigit((unsigned char)*s))
s++;
bp = s;
if (issign(*s)) {
@@ -147,7 +157,7 @@ s3e(VALUE hash, VALUE y, VALUE m, VALUE d, int bc)
}
if (sign)
c = Qfalse;
- l = strspn(s, "0123456789");
+ l = strspn(s, DECDIGIT);
ep = s + l;
if (l > 2)
c = Qfalse;
@@ -159,21 +169,22 @@ s3e(VALUE hash, VALUE y, VALUE m, VALUE d, int bc)
buf[ep - bp] = '\0';
iy = cstr2num(buf);
}
- if (bc)
- iy = f_add(f_negate(iy), INT2FIX(1));
set_hash("year", iy);
}
+ if (bc)
+ set_hash("_bc", Qtrue);
+
if (!NIL_P(m)) {
const char *s, *bp, *ep;
size_t l;
VALUE im;
s = RSTRING_PTR(m);
- while (!isdigit(*s))
+ while (!isdigit((unsigned char)*s))
s++;
bp = s;
- l = strspn(s, "0123456789");
+ l = strspn(s, DECDIGIT);
ep = s + l;
{
char *buf;
@@ -192,10 +203,10 @@ s3e(VALUE hash, VALUE y, VALUE m, VALUE d, int bc)
VALUE id;
s = RSTRING_PTR(d);
- while (!isdigit(*s))
+ while (!isdigit((unsigned char)*s))
s++;
bp = s;
- l = strspn(s, "0123456789");
+ l = strspn(s, DECDIGIT);
ep = s + l;
{
char *buf;
@@ -217,6 +228,23 @@ s3e(VALUE hash, VALUE y, VALUE m, VALUE d, int bc)
#define ABBR_DAYS "sun|mon|tue|wed|thu|fri|sat"
#define ABBR_MONTHS "jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec"
+#ifdef TIGHT_PARSER
+#define VALID_DAYS "(?:" DAYS ")" "|(?:tues|wednes|thurs|thur|" ABBR_DAYS ")\\.?"
+#define VALID_MONTHS "(?:" MONTHS ")" "|(?:sept|" ABBR_MONTHS ")\\.?"
+#define DOTLESS_VALID_MONTHS "(?:" MONTHS ")" "|(?:sept|" ABBR_MONTHS ")"
+#define BOS "\\A\\s*"
+#define FPA "\\001"
+#define FPB "\\002"
+#define FPW "\\027"
+#define FPT "\\024"
+#define FPW_COM "\\s*(?:" FPW "\\s*,?)?\\s*"
+#define FPT_COM "\\s*(?:" FPT "\\s*,?)?\\s*"
+#define COM_FPW "\\s*(?:,?\\s*" FPW ")?\\s*"
+#define COM_FPT "\\s*(?:,?\\s*(?:@|\\b[aA][tT]\\b)?\\s*" FPT ")?\\s*"
+#define TEE_FPT "\\s*(?:[tT]?" FPT ")?"
+#define EOS "\\s*\\z"
+#endif
+
static VALUE
regcomp(const char *source, long len, int opt)
{
@@ -256,13 +284,8 @@ match(VALUE str, VALUE pat, VALUE hash, int (*cb)(VALUE, VALUE))
return 1;
}
-#define SUBS(s,p,c) \
-{ \
- return subs(s, p, hash, c); \
-}
-
static int
-subs(VALUE str, VALUE pat, VALUE hash, int (*cb)(VALUE, VALUE))
+subx(VALUE str, VALUE rep, VALUE pat, VALUE hash, int (*cb)(VALUE, VALUE))
{
VALUE m;
@@ -276,13 +299,40 @@ subs(VALUE str, VALUE pat, VALUE hash, int (*cb)(VALUE, VALUE))
be = f_begin(m, INT2FIX(0));
en = f_end(m, INT2FIX(0));
- f_aset2(str, be, LONG2NUM(NUM2LONG(en) - NUM2LONG(be)), asp_string());
+ f_aset2(str, be, LONG2NUM(NUM2LONG(en) - NUM2LONG(be)), rep);
(*cb)(m, hash);
}
return 1;
}
+#define SUBS(s,p,c) \
+{ \
+ return subx(s, asp_string(), p, hash, c); \
+}
+
+#ifdef TIGHT_PARSER
+#define SUBA(s,p,c) \
+{ \
+ return subx(s, asuba_string(), p, hash, c); \
+}
+
+#define SUBB(s,p,c) \
+{ \
+ return subx(s, asubb_string(), p, hash, c); \
+}
+
+#define SUBW(s,p,c) \
+{ \
+ return subx(s, asubw_string(), p, hash, c); \
+}
+
+#define SUBT(s,p,c) \
+{ \
+ return subx(s, asubt_string(), p, hash, c); \
+}
+#endif
+
struct zone {
const char *name;
int offset;
@@ -381,14 +431,14 @@ date_zone_to_diff(VALUE str)
dest = d = ALLOCA_N(char, l + 1);
for (i = 0; i < l; i++) {
- if (isspace(s[i]) || s[i] == '\0') {
+ if (isspace((unsigned char)s[i]) || s[i] == '\0') {
if (!sp)
*d++ = ' ';
sp = 1;
}
else {
- if (isalpha(s[i]))
- *d++ = tolower(s[i]);
+ if (isalpha((unsigned char)s[i]))
+ *d++ = tolower((unsigned char)s[i]);
else
*d++ = s[i];
sp = 0;
@@ -519,7 +569,7 @@ date_zone_to_diff(VALUE str)
if (cl >= 3)
min = rb_str_new(&cs[1], 2);
if (cl >= 5)
- min = rb_str_new(&cs[3], 2);
+ sec = rb_str_new(&cs[3], 2);
}
else {
if (cl >= 2)
@@ -593,11 +643,21 @@ parse_day_cb(VALUE m, VALUE hash)
static int
parse_day(VALUE str, VALUE hash)
{
- static const char pat_source[] = "\\b(" ABBR_DAYS ")[^-\\d\\s]*";
+ static const char pat_source[] =
+#ifndef TIGHT_PARSER
+ "\\b(" ABBR_DAYS ")[^-/\\d\\s]*"
+#else
+ "(" VALID_DAYS ")"
+#endif
+ ;
static VALUE pat = Qnil;
REGCOMP_I(pat);
+#ifndef TIGHT_PARSER
SUBS(str, pat, parse_day_cb);
+#else
+ SUBW(str, pat, parse_day_cb);
+#endif
}
static int
@@ -684,7 +744,11 @@ parse_time(VALUE str, VALUE hash)
"(?:"
"\\d+\\s*:\\s*\\d+"
"(?:"
+#ifndef TIGHT_PARSER
"\\s*:\\s*\\d+(?:[,.]\\d*)?"
+#else
+ "\\s*:\\s*\\d+(?:[,.]\\d+)?"
+#endif
")?"
"|"
"\\d+\\s*h(?:\\s*\\d+m?(?:\\s*\\d+s?)?)?"
@@ -709,12 +773,115 @@ parse_time(VALUE str, VALUE hash)
static VALUE pat = Qnil;
REGCOMP_I(pat);
+#ifndef TIGHT_PARSER
SUBS(str, pat, parse_time_cb);
+#else
+ SUBT(str, pat, parse_time_cb);
+#endif
+}
+
+#ifdef TIGHT_PARSER
+static int
+parse_era1_cb(VALUE m, VALUE hash)
+{
+ return 1;
+}
+
+static int
+parse_era1(VALUE str, VALUE hash)
+{
+ static const char pat_source[] =
+ "(a(?:d|\\.d\\.))";
+ static VALUE pat = Qnil;
+
+ REGCOMP_I(pat);
+ SUBA(str, pat, parse_era1_cb);
+}
+
+static int
+parse_era2_cb(VALUE m, VALUE hash)
+{
+ VALUE b;
+
+ b = rb_reg_nth_match(1, m);
+ if (*RSTRING_PTR(b) == 'B' ||
+ *RSTRING_PTR(b) == 'b')
+ set_hash("_bc", Qtrue);
+ return 1;
+}
+
+static int
+parse_era2(VALUE str, VALUE hash)
+{
+ static const char pat_source[] =
+ "(c(?:e|\\.e\\.)|b(?:ce|\\.c\\.e\\.)|b(?:c|\\.c\\.))";
+ static VALUE pat = Qnil;
+
+ REGCOMP_I(pat);
+ SUBB(str, pat, parse_era2_cb);
+}
+
+static int
+parse_era(VALUE str, VALUE hash)
+{
+ if (parse_era1(str, hash)) /* pre */
+ goto ok;
+ if (parse_era2(str, hash)) /* post */
+ goto ok;
+ return 0;
+ ok:
+ return 1;
+}
+#endif
+
+#ifdef TIGHT_PARSER
+static int
+check_year_width(VALUE y)
+{
+ char *s;
+ size_t l;
+
+ s = RSTRING_PTR(y);
+ l = strcspn(s, DECDIGIT);
+ s += l;
+ l = strspn(s, DECDIGIT);
+ if (l != 2)
+ return 0;
+ return 1;
+}
+
+static int
+check_apost(VALUE a, VALUE b, VALUE c)
+{
+ int f = 0;
+
+ if (!NIL_P(a) && *RSTRING_PTR(a) == '\'') {
+ if (!check_year_width(a))
+ return 0;
+ f++;
+ }
+ if (!NIL_P(b) && *RSTRING_PTR(b) == '\'') {
+ if (!check_year_width(b))
+ return 0;
+ if (!NIL_P(c))
+ return 0;
+ f++;
+ }
+ if (!NIL_P(c) && *RSTRING_PTR(c) == '\'') {
+ if (!check_year_width(c))
+ return 0;
+ f++;
+ }
+ if (f > 1)
+ return 0;
+ return 1;
}
+#endif
static int
parse_eu_cb(VALUE m, VALUE hash)
{
+#ifndef TIGHT_PARSER
VALUE y, mon, d, b;
d = rb_reg_nth_match(1, m);
@@ -727,6 +894,20 @@ parse_eu_cb(VALUE m, VALUE hash)
s3e(hash, y, mon, d, !NIL_P(b) &&
(*RSTRING_PTR(b) == 'B' ||
*RSTRING_PTR(b) == 'b'));
+#else
+ VALUE y, mon, d;
+
+ d = rb_reg_nth_match(1, m);
+ mon = rb_reg_nth_match(2, m);
+ y = rb_reg_nth_match(3, m);
+
+ if (!check_apost(d, mon, y))
+ return 0;
+
+ mon = INT2FIX(mon_num(mon));
+
+ s3e(hash, y, mon, d, 0);
+#endif
return 1;
}
@@ -734,15 +915,40 @@ static int
parse_eu(VALUE str, VALUE hash)
{
static const char pat_source[] =
- "'?(\\d+)[^-\\d\\s]*"
+#ifdef TIGHT_PARSER
+ BOS
+ FPW_COM FPT_COM
+#endif
+#ifndef TIGHT_PARSER
+ "('?\\d+)[^-\\d\\s]*"
+#else
+ "(\\d+)(?:(?:st|nd|rd|th)\\b)?"
+#endif
"\\s*"
+#ifndef TIGHT_PARSER
"(" ABBR_MONTHS ")[^-\\d\\s']*"
+#else
+ "(" VALID_MONTHS ")"
+#endif
"(?:"
"\\s*"
+#ifndef TIGHT_PARSER
"(c(?:e|\\.e\\.)|b(?:ce|\\.c\\.e\\.)|a(?:d|\\.d\\.)|b(?:c|\\.c\\.))?"
"\\s*"
"('?-?\\d+(?:(?:st|nd|rd|th)\\b)?)"
- ")?";
+#else
+ "(?:" FPA ")?"
+ "\\s*"
+ "([-']?\\d+)"
+ "\\s*"
+ "(?:" FPA "|" FPB ")?"
+#endif
+ ")?"
+#ifdef TIGHT_PARSER
+ COM_FPT COM_FPW
+ EOS
+#endif
+ ;
static VALUE pat = Qnil;
REGCOMP_I(pat);
@@ -752,10 +958,12 @@ parse_eu(VALUE str, VALUE hash)
static int
parse_us_cb(VALUE m, VALUE hash)
{
+#ifndef TIGHT_PARSER
VALUE y, mon, d, b;
mon = rb_reg_nth_match(1, m);
d = rb_reg_nth_match(2, m);
+
b = rb_reg_nth_match(3, m);
y = rb_reg_nth_match(4, m);
@@ -764,6 +972,20 @@ parse_us_cb(VALUE m, VALUE hash)
s3e(hash, y, mon, d, !NIL_P(b) &&
(*RSTRING_PTR(b) == 'B' ||
*RSTRING_PTR(b) == 'b'));
+#else
+ VALUE y, mon, d;
+
+ mon = rb_reg_nth_match(1, m);
+ d = rb_reg_nth_match(2, m);
+ y = rb_reg_nth_match(3, m);
+
+ if (!check_apost(mon, d, y))
+ return 0;
+
+ mon = INT2FIX(mon_num(mon));
+
+ s3e(hash, y, mon, d, 0);
+#endif
return 1;
}
@@ -771,15 +993,42 @@ static int
parse_us(VALUE str, VALUE hash)
{
static const char pat_source[] =
+#ifdef TIGHT_PARSER
+ BOS
+ FPW_COM FPT_COM
+#endif
+#ifndef TIGHT_PARSER
"\\b(" ABBR_MONTHS ")[^-\\d\\s']*"
+#else
+ "\\b(" VALID_MONTHS ")"
+#endif
"\\s*"
+#ifndef TIGHT_PARSER
"('?\\d+)[^-\\d\\s']*"
+#else
+ "('?\\d+)(?:(?:st|nd|rd|th)\\b)?"
+ COM_FPT
+#endif
"(?:"
+ "\\s*,?"
"\\s*"
+#ifndef TIGHT_PARSER
"(c(?:e|\\.e\\.)|b(?:ce|\\.c\\.e\\.)|a(?:d|\\.d\\.)|b(?:c|\\.c\\.))?"
"\\s*"
"('?-?\\d+)"
- ")?";
+#else
+ "(?:" FPA ")?"
+ "\\s*"
+ "([-']?\\d+)"
+ "\\s*"
+ "(?:" FPA "|" FPB ")?"
+#endif
+ ")?"
+#ifdef TIGHT_PARSER
+ COM_FPT COM_FPW
+ EOS
+#endif
+ ;
static VALUE pat = Qnil;
REGCOMP_I(pat);
@@ -795,6 +1044,11 @@ parse_iso_cb(VALUE m, VALUE hash)
mon = rb_reg_nth_match(2, m);
d = rb_reg_nth_match(3, m);
+#ifdef TIGHT_PARSER
+ if (!check_apost(y, mon, d))
+ return 0;
+#endif
+
s3e(hash, y, mon, d, 0);
return 1;
}
@@ -802,7 +1056,17 @@ parse_iso_cb(VALUE m, VALUE hash)
static int
parse_iso(VALUE str, VALUE hash)
{
- static const char pat_source[] = "('?[-+]?\\d+)-(\\d+)-('?-?\\d+)";
+ static const char pat_source[] =
+#ifndef TIGHT_PARSER
+ "('?[-+]?\\d+)-(\\d+)-('?-?\\d+)"
+#else
+ BOS
+ FPW_COM FPT_COM
+ "([-+']?\\d+)-(\\d+)-([-']?\\d+)"
+ TEE_FPT COM_FPW
+ EOS
+#endif
+ ;
static VALUE pat = Qnil;
REGCOMP_0(pat);
@@ -831,7 +1095,16 @@ static int
parse_iso21(VALUE str, VALUE hash)
{
static const char pat_source[] =
- "\\b(\\d{2}|\\d{4})?-?w(\\d{2})(?:-?(\\d))?\\b";
+#ifndef TIGHT_PARSER
+ "\\b(\\d{2}|\\d{4})?-?w(\\d{2})(?:-?(\\d))?\\b"
+#else
+ BOS
+ FPW_COM FPT_COM
+ "(\\d{2}|\\d{4})?-?w(\\d{2})(?:-?(\\d))?"
+ TEE_FPT COM_FPW
+ EOS
+#endif
+ ;
static VALUE pat = Qnil;
REGCOMP_I(pat);
@@ -851,7 +1124,17 @@ parse_iso22_cb(VALUE m, VALUE hash)
static int
parse_iso22(VALUE str, VALUE hash)
{
- static const char pat_source[] = "-w-(\\d)\\b";
+ static const char pat_source[] =
+#ifndef TIGHT_PARSER
+ "-w-(\\d)\\b"
+#else
+ BOS
+ FPW_COM FPT_COM
+ "-w-(\\d)"
+ TEE_FPT COM_FPW
+ EOS
+#endif
+ ;
static VALUE pat = Qnil;
REGCOMP_I(pat);
@@ -876,7 +1159,17 @@ parse_iso23_cb(VALUE m, VALUE hash)
static int
parse_iso23(VALUE str, VALUE hash)
{
- static const char pat_source[] = "--(\\d{2})?-(\\d{2})\\b";
+ static const char pat_source[] =
+#ifndef TIGHT_PARSER
+ "--(\\d{2})?-(\\d{2})\\b"
+#else
+ BOS
+ FPW_COM FPT_COM
+ "--(\\d{2})?-(\\d{2})"
+ TEE_FPT COM_FPW
+ EOS
+#endif
+ ;
static VALUE pat = Qnil;
REGCOMP_0(pat);
@@ -901,7 +1194,17 @@ parse_iso24_cb(VALUE m, VALUE hash)
static int
parse_iso24(VALUE str, VALUE hash)
{
- static const char pat_source[] = "--(\\d{2})(\\d{2})?\\b";
+ static const char pat_source[] =
+#ifndef TIGHT_PARSER
+ "--(\\d{2})(\\d{2})?\\b"
+#else
+ BOS
+ FPW_COM FPT_COM
+ "--(\\d{2})(\\d{2})?"
+ TEE_FPT COM_FPW
+ EOS
+#endif
+ ;
static VALUE pat = Qnil;
REGCOMP_0(pat);
@@ -925,9 +1228,29 @@ parse_iso25_cb(VALUE m, VALUE hash)
static int
parse_iso25(VALUE str, VALUE hash)
{
- static const char pat0_source[] = "[,.](\\d{2}|\\d{4})-\\d{3}\\b";
+ static const char pat0_source[] =
+#ifndef TIGHT_PARSER
+ "[,.](\\d{2}|\\d{4})-\\d{3}\\b"
+#else
+ BOS
+ FPW_COM FPT_COM
+ "[,.](\\d{2}|\\d{4})-\\d{3}"
+ TEE_FPT COM_FPW
+ EOS
+#endif
+ ;
static VALUE pat0 = Qnil;
- static const char pat_source[] = "\\b(\\d{2}|\\d{4})-(\\d{3})\\b";
+ static const char pat_source[] =
+#ifndef TIGHT_PARSER
+ "\\b(\\d{2}|\\d{4})-(\\d{3})\\b"
+#else
+ BOS
+ FPW_COM FPT_COM
+ "(\\d{2}|\\d{4})-(\\d{3})"
+ TEE_FPT COM_FPW
+ EOS
+#endif
+ ;
static VALUE pat = Qnil;
REGCOMP_0(pat0);
@@ -951,9 +1274,29 @@ parse_iso26_cb(VALUE m, VALUE hash)
static int
parse_iso26(VALUE str, VALUE hash)
{
- static const char pat0_source[] = "\\d-\\d{3}\\b";
+ static const char pat0_source[] =
+#ifndef TIGHT_PARSER
+ "\\d-\\d{3}\\b"
+#else
+ BOS
+ FPW_COM FPT_COM
+ "\\d-\\d{3}"
+ TEE_FPT COM_FPW
+ EOS
+#endif
+ ;
static VALUE pat0 = Qnil;
- static const char pat_source[] = "\\b-(\\d{3})\\b";
+ static const char pat_source[] =
+#ifndef TIGHT_PARSER
+ "\\b-(\\d{3})\\b"
+#else
+ BOS
+ FPW_COM FPT_COM
+ "-(\\d{3})"
+ TEE_FPT COM_FPW
+ EOS
+#endif
+ ;
static VALUE pat = Qnil;
REGCOMP_0(pat0);
@@ -1023,7 +1366,17 @@ parse_jis_cb(VALUE m, VALUE hash)
static int
parse_jis(VALUE str, VALUE hash)
{
- static const char pat_source[] = "\\b([mtsh])(\\d+)\\.(\\d+)\\.(\\d+)";
+ static const char pat_source[] =
+#ifndef TIGHT_PARSER
+ "\\b([mtsh])(\\d+)\\.(\\d+)\\.(\\d+)"
+#else
+ BOS
+ FPW_COM FPT_COM
+ "([mtsh])(\\d+)\\.(\\d+)\\.(\\d+)"
+ TEE_FPT COM_FPW
+ EOS
+#endif
+ ;
static VALUE pat = Qnil;
REGCOMP_I(pat);
@@ -1039,6 +1392,11 @@ parse_vms11_cb(VALUE m, VALUE hash)
mon = rb_reg_nth_match(2, m);
y = rb_reg_nth_match(3, m);
+#ifdef TIGHT_PARSER
+ if (!check_apost(d, mon, y))
+ return 0;
+#endif
+
mon = INT2FIX(mon_num(mon));
s3e(hash, y, mon, d, 0);
@@ -1049,8 +1407,18 @@ static int
parse_vms11(VALUE str, VALUE hash)
{
static const char pat_source[] =
- "('?-?\\d+)-(" ABBR_MONTHS ")[^-]*"
- "-('?-?\\d+)";
+#ifndef TIGHT_PARSER
+ "('?-?\\d+)-(" ABBR_MONTHS ")[^-/.]*"
+ "-('?-?\\d+)"
+#else
+ BOS
+ FPW_COM FPT_COM
+ "([-']?\\d+)-(" DOTLESS_VALID_MONTHS ")"
+ "-([-']?\\d+)"
+ COM_FPT COM_FPW
+ EOS
+#endif
+ ;
static VALUE pat = Qnil;
REGCOMP_I(pat);
@@ -1066,6 +1434,11 @@ parse_vms12_cb(VALUE m, VALUE hash)
d = rb_reg_nth_match(2, m);
y = rb_reg_nth_match(3, m);
+#ifdef TIGHT_PARSER
+ if (!check_apost(mon, d, y))
+ return 0;
+#endif
+
mon = INT2FIX(mon_num(mon));
s3e(hash, y, mon, d, 0);
@@ -1076,8 +1449,18 @@ static int
parse_vms12(VALUE str, VALUE hash)
{
static const char pat_source[] =
- "\\b(" ABBR_MONTHS ")[^-]*"
- "-('?-?\\d+)(?:-('?-?\\d+))?";
+#ifndef TIGHT_PARSER
+ "\\b(" ABBR_MONTHS ")[^-/.]*"
+ "-('?-?\\d+)(?:-('?-?\\d+))?"
+#else
+ BOS
+ FPW_COM FPT_COM
+ "(" DOTLESS_VALID_MONTHS ")"
+ "-([-']?\\d+)(?:-([-']?\\d+))?"
+ COM_FPT COM_FPW
+ EOS
+#endif
+ ;
static VALUE pat = Qnil;
REGCOMP_I(pat);
@@ -1106,6 +1489,11 @@ parse_sla_cb(VALUE m, VALUE hash)
mon = rb_reg_nth_match(2, m);
d = rb_reg_nth_match(3, m);
+#ifdef TIGHT_PARSER
+ if (!check_apost(y, mon, d))
+ return 0;
+#endif
+
s3e(hash, y, mon, d, 0);
return 1;
}
@@ -1114,13 +1502,92 @@ static int
parse_sla(VALUE str, VALUE hash)
{
static const char pat_source[] =
- "('?-?\\d+)/\\s*('?\\d+)(?:\\D\\s*('?-?\\d+))?";
+#ifndef TIGHT_PARSER
+ "('?-?\\d+)/\\s*('?\\d+)(?:\\D\\s*('?-?\\d+))?"
+#else
+ BOS
+ FPW_COM FPT_COM
+ "([-']?\\d+)/\\s*('?\\d+)(?:(?:[-/]|\\s+)\\s*([-']?\\d+))?"
+ COM_FPT COM_FPW
+ EOS
+#endif
+ ;
static VALUE pat = Qnil;
REGCOMP_I(pat);
SUBS(str, pat, parse_sla_cb);
}
+#ifdef TIGHT_PARSER
+static int
+parse_sla2_cb(VALUE m, VALUE hash)
+{
+ VALUE y, mon, d;
+
+ d = rb_reg_nth_match(1, m);
+ mon = rb_reg_nth_match(2, m);
+ y = rb_reg_nth_match(3, m);
+
+ if (!check_apost(d, mon, y))
+ return 0;
+
+ mon = INT2FIX(mon_num(mon));
+
+ s3e(hash, y, mon, d, 0);
+ return 1;
+}
+
+static int
+parse_sla2(VALUE str, VALUE hash)
+{
+ static const char pat_source[] =
+ BOS
+ FPW_COM FPT_COM
+ "([-']?\\d+)/\\s*(" DOTLESS_VALID_MONTHS ")(?:(?:[-/]|\\s+)\\s*([-']?\\d+))?"
+ COM_FPT COM_FPW
+ EOS
+ ;
+ static VALUE pat = Qnil;
+
+ REGCOMP_I(pat);
+ SUBS(str, pat, parse_sla2_cb);
+}
+
+static int
+parse_sla3_cb(VALUE m, VALUE hash)
+{
+ VALUE y, mon, d;
+
+ mon = rb_reg_nth_match(1, m);
+ d = rb_reg_nth_match(2, m);
+ y = rb_reg_nth_match(3, m);
+
+ if (!check_apost(mon, d, y))
+ return 0;
+
+ mon = INT2FIX(mon_num(mon));
+
+ s3e(hash, y, mon, d, 0);
+ return 1;
+}
+
+static int
+parse_sla3(VALUE str, VALUE hash)
+{
+ static const char pat_source[] =
+ BOS
+ FPW_COM FPT_COM
+ "(" DOTLESS_VALID_MONTHS ")/\\s*([-']?\\d+)(?:(?:[-/]|\\s+)\\s*([-']?\\d+))?"
+ COM_FPT COM_FPW
+ EOS
+ ;
+ static VALUE pat = Qnil;
+
+ REGCOMP_I(pat);
+ SUBS(str, pat, parse_sla3_cb);
+}
+#endif
+
static int
parse_dot_cb(VALUE m, VALUE hash)
{
@@ -1130,6 +1597,11 @@ parse_dot_cb(VALUE m, VALUE hash)
mon = rb_reg_nth_match(2, m);
d = rb_reg_nth_match(3, m);
+#ifdef TIGHT_PARSER
+ if (!check_apost(y, mon, d))
+ return 0;
+#endif
+
s3e(hash, y, mon, d, 0);
return 1;
}
@@ -1138,13 +1610,92 @@ static int
parse_dot(VALUE str, VALUE hash)
{
static const char pat_source[] =
- "('?-?\\d+)\\.\\s*('?\\d+)\\.\\s*('?-?\\d+)";
+#ifndef TIGHT_PARSER
+ "('?-?\\d+)\\.\\s*('?\\d+)\\.\\s*('?-?\\d+)"
+#else
+ BOS
+ FPW_COM FPT_COM
+ "([-']?\\d+)\\.\\s*(\\d+)\\.\\s*([-']?\\d+)"
+ COM_FPT COM_FPW
+ EOS
+#endif
+ ;
static VALUE pat = Qnil;
REGCOMP_I(pat);
SUBS(str, pat, parse_dot_cb);
}
+#ifdef TIGHT_PARSER
+static int
+parse_dot2_cb(VALUE m, VALUE hash)
+{
+ VALUE y, mon, d;
+
+ d = rb_reg_nth_match(1, m);
+ mon = rb_reg_nth_match(2, m);
+ y = rb_reg_nth_match(3, m);
+
+ if (!check_apost(d, mon, y))
+ return 0;
+
+ mon = INT2FIX(mon_num(mon));
+
+ s3e(hash, y, mon, d, 0);
+ return 1;
+}
+
+static int
+parse_dot2(VALUE str, VALUE hash)
+{
+ static const char pat_source[] =
+ BOS
+ FPW_COM FPT_COM
+ "([-']?\\d+)\\.\\s*(" DOTLESS_VALID_MONTHS ")(?:(?:[./])\\s*([-']?\\d+))?"
+ COM_FPT COM_FPW
+ EOS
+ ;
+ static VALUE pat = Qnil;
+
+ REGCOMP_I(pat);
+ SUBS(str, pat, parse_dot2_cb);
+}
+
+static int
+parse_dot3_cb(VALUE m, VALUE hash)
+{
+ VALUE y, mon, d;
+
+ mon = rb_reg_nth_match(1, m);
+ d = rb_reg_nth_match(2, m);
+ y = rb_reg_nth_match(3, m);
+
+ if (!check_apost(mon, d, y))
+ return 0;
+
+ mon = INT2FIX(mon_num(mon));
+
+ s3e(hash, y, mon, d, 0);
+ return 1;
+}
+
+static int
+parse_dot3(VALUE str, VALUE hash)
+{
+ static const char pat_source[] =
+ BOS
+ FPW_COM FPT_COM
+ "(" DOTLESS_VALID_MONTHS ")\\.\\s*([-']?\\d+)(?:(?:[./])\\s*([-']?\\d+))?"
+ COM_FPT COM_FPW
+ EOS
+ ;
+ static VALUE pat = Qnil;
+
+ REGCOMP_I(pat);
+ SUBS(str, pat, parse_dot3_cb);
+}
+#endif
+
static int
parse_year_cb(VALUE m, VALUE hash)
{
@@ -1158,7 +1709,17 @@ parse_year_cb(VALUE m, VALUE hash)
static int
parse_year(VALUE str, VALUE hash)
{
- static const char pat_source[] = "'(\\d+)\\b";
+ static const char pat_source[] =
+#ifndef TIGHT_PARSER
+ "'(\\d+)\\b"
+#else
+ BOS
+ FPW_COM FPT_COM
+ "'(\\d+)"
+ COM_FPT COM_FPW
+ EOS
+#endif
+ ;
static VALUE pat = Qnil;
REGCOMP_0(pat);
@@ -1178,7 +1739,17 @@ parse_mon_cb(VALUE m, VALUE hash)
static int
parse_mon(VALUE str, VALUE hash)
{
- static const char pat_source[] = "\\b(" ABBR_MONTHS ")\\S*";
+ static const char pat_source[] =
+#ifndef TIGHT_PARSER
+ "\\b(" ABBR_MONTHS ")\\S*"
+#else
+ BOS
+ FPW_COM FPT_COM
+ "(" VALID_MONTHS ")"
+ COM_FPT COM_FPW
+ EOS
+#endif
+ ;
static VALUE pat = Qnil;
REGCOMP_I(pat);
@@ -1198,7 +1769,17 @@ parse_mday_cb(VALUE m, VALUE hash)
static int
parse_mday(VALUE str, VALUE hash)
{
- static const char pat_source[] = "(\\d+)(st|nd|rd|th)\\b";
+ static const char pat_source[] =
+#ifndef TIGHT_PARSER
+ "(\\d+)(st|nd|rd|th)\\b"
+#else
+ BOS
+ FPW_COM FPT_COM
+ "(\\d+)(st|nd|rd|th)"
+ COM_FPT COM_FPW
+ EOS
+#endif
+ ;
static VALUE pat = Qnil;
REGCOMP_I(pat);
@@ -1413,7 +1994,7 @@ parse_ddd_cb(VALUE m, VALUE hash)
s3 = s1;
zone = rb_str_new2(s3);
set_hash("zone", zone);
- if (isdigit(*s1))
+ if (isdigit((unsigned char)*s1))
*--s1 = '+';
set_hash("offset", date_zone_to_diff(rb_str_new2(s1)));
}
@@ -1427,6 +2008,9 @@ static int
parse_ddd(VALUE str, VALUE hash)
{
static const char pat_source[] =
+#ifdef TIGHT_PARSER
+ BOS
+#endif
"([-+]?)(\\d{2,14})"
"(?:"
"\\s*"
@@ -1443,22 +2027,22 @@ parse_ddd(VALUE str, VALUE hash)
"|"
"\\[[-+]?\\d[^\\]]*\\]"
")"
- ")?";
+ ")?"
+#ifdef TIGHT_PARSER
+ EOS
+#endif
+ ;
static VALUE pat = Qnil;
REGCOMP_I(pat);
SUBS(str, pat, parse_ddd_cb);
}
+#ifndef TIGHT_PARSER
static int
parse_bc_cb(VALUE m, VALUE hash)
{
- VALUE y;
-
- y = ref_hash("year");
- if (!NIL_P(y))
- set_hash("year", f_add(f_negate(y), INT2FIX(1)));
-
+ set_hash("_bc", Qtrue);
return 1;
}
@@ -1505,6 +2089,57 @@ parse_frag(VALUE str, VALUE hash)
REGCOMP_I(pat);
SUBS(str, pat, parse_frag_cb);
}
+#endif
+
+#ifdef TIGHT_PARSER
+static int
+parse_dummy_cb(VALUE m, VALUE hash)
+{
+ return 1;
+}
+
+static int
+parse_wday_only(VALUE str, VALUE hash)
+{
+ static const char pat_source[] = "\\A\\s*" FPW "\\s*\\z";
+ static VALUE pat = Qnil;
+
+ REGCOMP_0(pat);
+ SUBS(str, pat, parse_dummy_cb);
+}
+
+static int
+parse_time_only(VALUE str, VALUE hash)
+{
+ static const char pat_source[] = "\\A\\s*" FPT "\\s*\\z";
+ static VALUE pat = Qnil;
+
+ REGCOMP_0(pat);
+ SUBS(str, pat, parse_dummy_cb);
+}
+
+static int
+parse_wday_and_time(VALUE str, VALUE hash)
+{
+ static const char pat_source[] = "\\A\\s*(" FPW "\\s+" FPT "|" FPT "\\s+" FPW ")\\s*\\z";
+ static VALUE pat = Qnil;
+
+ REGCOMP_0(pat);
+ SUBS(str, pat, parse_dummy_cb);
+}
+
+static unsigned
+have_invalid_char_p(VALUE s)
+{
+ long i;
+
+ for (i = 0; i < RSTRING_LEN(s); i++)
+ if (iscntrl((unsigned char)RSTRING_PTR(s)[i]) &&
+ !isspace((unsigned char)RSTRING_PTR(s)[i]))
+ return 1;
+ return 0;
+}
+#endif
#define HAVE_ALPHA (1<<0)
#define HAVE_DIGIT (1<<1)
@@ -1520,9 +2155,9 @@ check_class(VALUE s)
flags = 0;
for (i = 0; i < RSTRING_LEN(s); i++) {
- if (isalpha(RSTRING_PTR(s)[i]))
+ if (isalpha((unsigned char)RSTRING_PTR(s)[i]))
flags |= HAVE_ALPHA;
- if (isdigit(RSTRING_PTR(s)[i]))
+ if (isdigit((unsigned char)RSTRING_PTR(s)[i]))
flags |= HAVE_DIGIT;
if (RSTRING_PTR(s)[i] == '-')
flags |= HAVE_DASH;
@@ -1536,16 +2171,31 @@ check_class(VALUE s)
#define HAVE_ELEM_P(x) ((check_class(str) & (x)) == (x))
+#ifdef TIGHT_PARSER
+#define PARSER_ERROR return rb_hash_new()
+#endif
+
VALUE
date__parse(VALUE str, VALUE comp)
{
VALUE backref, hash;
+#ifdef TIGHT_PARSER
+ if (have_invalid_char_p(str))
+ PARSER_ERROR;
+#endif
+
backref = rb_backref_get();
rb_match_busy(backref);
{
- static const char pat_source[] = "[^-+',./:@[:alnum:]\\[\\]]+";
+ static const char pat_source[] =
+#ifndef TIGHT_PARSER
+ "[^-+',./:@[:alnum:]\\[\\]]+"
+#else
+ "[^[:graph:]]+"
+#endif
+ ;
static VALUE pat = Qnil;
REGCOMP_0(pat);
@@ -1561,12 +2211,17 @@ date__parse(VALUE str, VALUE comp)
if (HAVE_ELEM_P(HAVE_DIGIT))
parse_time(str, hash);
- if (HAVE_ELEM_P(HAVE_ALPHA|HAVE_DIGIT))
+#ifdef TIGHT_PARSER
+ if (HAVE_ELEM_P(HAVE_ALPHA))
+ parse_era(str, hash);
+#endif
+
+ if (HAVE_ELEM_P(HAVE_ALPHA|HAVE_DIGIT)) {
if (parse_eu(str, hash))
goto ok;
- if (HAVE_ELEM_P(HAVE_ALPHA|HAVE_DIGIT))
if (parse_us(str, hash))
goto ok;
+ }
if (HAVE_ELEM_P(HAVE_DIGIT|HAVE_DASH))
if (parse_iso(str, hash))
goto ok;
@@ -1579,9 +2234,25 @@ date__parse(VALUE str, VALUE comp)
if (HAVE_ELEM_P(HAVE_DIGIT|HAVE_SLASH))
if (parse_sla(str, hash))
goto ok;
+#ifdef TIGHT_PARSER
+ if (HAVE_ELEM_P(HAVE_ALPHA|HAVE_DIGIT|HAVE_SLASH)) {
+ if (parse_sla2(str, hash))
+ goto ok;
+ if (parse_sla3(str, hash))
+ goto ok;
+ }
+#endif
if (HAVE_ELEM_P(HAVE_DIGIT|HAVE_DOT))
if (parse_dot(str, hash))
goto ok;
+#ifdef TIGHT_PARSER
+ if (HAVE_ELEM_P(HAVE_ALPHA|HAVE_DIGIT|HAVE_DOT)) {
+ if (parse_dot2(str, hash))
+ goto ok;
+ if (parse_dot3(str, hash))
+ goto ok;
+ }
+#endif
if (HAVE_ELEM_P(HAVE_DIGIT))
if (parse_iso2(str, hash))
goto ok;
@@ -1598,13 +2269,41 @@ date__parse(VALUE str, VALUE comp)
if (parse_ddd(str, hash))
goto ok;
+#ifdef TIGHT_PARSER
+ if (parse_wday_only(str, hash))
+ goto ok;
+ if (parse_time_only(str, hash))
+ goto ok;
+ if (parse_wday_and_time(str, hash))
+ goto ok;
+
+ PARSER_ERROR; /* not found */
+#endif
+
ok:
+#ifndef TIGHT_PARSER
if (HAVE_ELEM_P(HAVE_ALPHA))
parse_bc(str, hash);
if (HAVE_ELEM_P(HAVE_DIGIT))
parse_frag(str, hash);
+#endif
{
+ if (RTEST(ref_hash("_bc"))) {
+ VALUE y;
+
+ y = ref_hash("cwyear");
+ if (!NIL_P(y)) {
+ y = f_add(f_negate(y), INT2FIX(1));
+ set_hash("cwyear", y);
+ }
+ y = ref_hash("year");
+ if (!NIL_P(y)) {
+ y = f_add(f_negate(y), INT2FIX(1));
+ set_hash("year", y);
+ }
+ }
+
if (RTEST(ref_hash("_comp"))) {
VALUE y;
@@ -1625,8 +2324,10 @@ date__parse(VALUE str, VALUE comp)
set_hash("year", f_add(y, INT2FIX(2000)));
}
}
+
}
+ del_hash("_bc");
del_hash("_comp");
{
@@ -1875,7 +2576,7 @@ static int
iso8601_ext_time(VALUE str, VALUE hash)
{
static const char pat_source[] =
- "\\A\\s*(?:(\\d{2}):(\\d{2})(?::(\\d{2})(?:[,.](\\d+))?)?"
+ "\\A\\s*(\\d{2}):(\\d{2})(?::(\\d{2})(?:[,.](\\d+))?"
"(z|[-+]\\d{2}(:?\\d{2})?)?)?\\s*\\z";
static VALUE pat = Qnil;
@@ -1887,7 +2588,7 @@ static int
iso8601_bas_time(VALUE str, VALUE hash)
{
static const char pat_source[] =
- "\\A\\s*(?:(\\d{2})(\\d{2})(?:(\\d{2})(?:[,.](\\d+))?)?"
+ "\\A\\s*(\\d{2})(\\d{2})(?:(\\d{2})(?:[,.](\\d+))?"
"(z|[-+]\\d{2}(\\d{2})?)?)?\\s*\\z";
static VALUE pat = Qnil;
@@ -2147,7 +2848,9 @@ rfc2822_cb(VALUE m, VALUE hash)
s[i] = rb_reg_nth_match(i, m);
}
- set_hash("wday", INT2FIX(day_num(s[1])));
+ if (!NIL_P(s[1])) {
+ set_hash("wday", INT2FIX(day_num(s[1])));
+ }
set_hash("mday", str2num(s[2]));
set_hash("mon", INT2FIX(mon_num(s[3])));
y = str2num(s[4]);
diff --git a/ext/date/date_strftime.c b/ext/date/date_strftime.c
index 71e1bd7f00..20931a3124 100644
--- a/ext/date/date_strftime.c
+++ b/ext/date/date_strftime.c
@@ -1,164 +1,24 @@
-/* -*- c-file-style: "linux" -*- */
-
/*
- * strftime.c
- *
- * Public-domain implementation of ANSI C library routine.
- *
- * It's written in old-style C for maximal portability.
- * However, since I'm used to prototypes, I've included them too.
- *
- * If you want stuff in the System V ascftime routine, add the SYSV_EXT define.
- * For extensions from SunOS, add SUNOS_EXT.
- * For stuff needed to implement the P1003.2 date command, add POSIX2_DATE.
- * For VMS dates, add VMS_EXT.
- * For a an RFC822 time format, add MAILHEADER_EXT.
- * For ISO week years, add ISO_DATE_EXT.
- * For complete POSIX semantics, add POSIX_SEMANTICS.
- *
- * The code for %c, %x, and %X now follows the 1003.2 specification for
- * the POSIX locale.
- * This version ignores LOCALE information.
- * It also doesn't worry about multi-byte characters.
- * So there.
- *
- * This file is also shipped with GAWK (GNU Awk), gawk specific bits of
- * code are included if GAWK is defined.
- *
- * Arnold Robbins
- * January, February, March, 1991
- * Updated March, April 1992
- * Updated April, 1993
- * Updated February, 1994
- * Updated May, 1994
- * Updated January, 1995
- * Updated September, 1995
- * Updated January, 1996
- *
- * Fixes from ado@elsie.nci.nih.gov
- * February 1991, May 1992
- * Fixes from Tor Lillqvist tml@tik.vtt.fi
- * May, 1993
- * Further fixes from ado@elsie.nci.nih.gov
- * February 1994
- * %z code from chip@chinacat.unicom.com
- * Applied September 1995
- * %V code fixed (again) and %G, %g added,
- * January 1996
+ date_strftime.c: based on a public-domain implementation of ANSI C
+ library routine strftime, which is originally written by Arnold
+ Robbins.
*/
#include "ruby/ruby.h"
#include "date_tmx.h"
-#ifndef GAWK
-#include <stdio.h>
-#include <ctype.h>
+#include <stdlib.h>
#include <string.h>
-#include <time.h>
-#include <sys/types.h>
+#include <ctype.h>
#include <errno.h>
-#endif
-#if defined(TM_IN_SYS_TIME) || !defined(GAWK)
-#include <sys/types.h>
-#if HAVE_SYS_TIME_H
-#include <sys/time.h>
-#endif
-#endif
-#include <math.h>
-
-/* defaults: season to taste */
-#define SYSV_EXT 1 /* stuff in System V ascftime routine */
-#define SUNOS_EXT 1 /* stuff in SunOS strftime routine */
-#define POSIX2_DATE 1 /* stuff in Posix 1003.2 date command */
-#define VMS_EXT 1 /* include %v for VMS date format */
-#define MAILHEADER_EXT 1 /* add %z for HHMM format */
-#define ISO_DATE_EXT 1 /* %G and %g for year of ISO week */
-
-#if defined(ISO_DATE_EXT)
-#if ! defined(POSIX2_DATE)
-#define POSIX2_DATE 1
-#endif
-#endif
-#if defined(POSIX2_DATE)
-#if ! defined(SYSV_EXT)
-#define SYSV_EXT 1
-#endif
-#if ! defined(SUNOS_EXT)
-#define SUNOS_EXT 1
-#endif
-#endif
-
-#if defined(POSIX2_DATE)
-#define adddecl(stuff) stuff
-#else
-#define adddecl(stuff)
+#if defined(HAVE_SYS_TIME_H)
+#include <sys/time.h>
#endif
#undef strchr /* avoid AIX weirdness */
-#if 0
-#if !defined __STDC__ && !defined _WIN32
-#define const /**/
-static int weeknumber();
-adddecl(static int iso8601wknum();)
-static int weeknumber_v();
-adddecl(static int iso8601wknum_v();)
-#else
-static int weeknumber(const struct tm *timeptr, int firstweekday);
-adddecl(static int iso8601wknum(const struct tm *timeptr);)
-static int weeknumber_v(const struct tmx *tmx, int firstweekday);
-adddecl(static int iso8601wknum_v(const struct tmx *tmx);)
-#endif
-#endif
-
-#ifdef STDC_HEADERS
-#include <stdlib.h>
-#include <string.h>
-#else
-extern void *malloc();
-extern void *realloc();
-extern char *getenv();
-extern char *strchr();
-#endif
-
-#define range(low, item, hi) max((low), min((item), (hi)))
-
-#undef min /* just in case */
-
-/* min --- return minimum of two numbers */
-
-#ifndef __STDC__
-static inline int
-min(a, b)
-int a, b;
-#else
-static inline int
-min(int a, int b)
-#endif
-{
- return (a < b ? a : b);
-}
-
-#undef max /* also, just in case */
-
-/* max --- return maximum of two numbers */
-
-#ifndef __STDC__
-static inline int
-max(a, b)
-int a, b;
-#else
-static inline int
-max(int a, int b)
-#endif
-{
- return (a > b ? a : b);
-}
-
-#ifdef NO_STRING_LITERAL_CONCATENATION
-#error No string literal concatenation
-#endif
+#define range(low, item, hi) (item)
#define add(x,y) (rb_funcall((x), '+', 1, (y)))
#define sub(x,y) (rb_funcall((x), '-', 1, (y)))
@@ -167,989 +27,607 @@ max(int a, int b)
#define div(x,y) (rb_funcall((x), rb_intern("div"), 1, (y)))
#define mod(x,y) (rb_funcall((x), '%', 1, (y)))
+static void
+upcase(char *s, size_t i)
+{
+ do {
+ if (ISLOWER(*s))
+ *s = TOUPPER(*s);
+ } while (s++, --i);
+}
+
+static void
+downcase(char *s, size_t i)
+{
+ do {
+ if (ISUPPER(*s))
+ *s = TOLOWER(*s);
+ } while (s++, --i);
+}
+
/* strftime --- produce formatted time */
static size_t
date_strftime_with_tmx(char *s, size_t maxsize, const char *format,
const struct tmx *tmx)
{
- char *endp = s + maxsize;
- char *start = s;
- const char *sp, *tp;
- auto char tbuf[100];
- long off;
- ptrdiff_t i;
- int w;
- int precision, flags, colons;
- char padding;
- enum {LEFT, CHCASE, LOWER, UPPER, LOCALE_O, LOCALE_E};
+ char *endp = s + maxsize;
+ char *start = s;
+ const char *sp, *tp;
+ auto char tbuf[100];
+ ptrdiff_t i;
+ int v, w;
+ size_t colons;
+ int precision, flags;
+ char padding;
+ /* LOCALE_[OE] and COLONS are actually modifiers, not flags */
+ enum {LEFT, CHCASE, LOWER, UPPER, LOCALE_O, LOCALE_E, COLONS};
#define BIT_OF(n) (1U<<(n))
- /* various tables, useful in North America */
- static const char days_l[][10] = {
- "Sunday", "Monday", "Tuesday", "Wednesday",
- "Thursday", "Friday", "Saturday",
- };
- static const char months_l[][10] = {
- "January", "February", "March", "April",
- "May", "June", "July", "August", "September",
- "October", "November", "December",
- };
- static const char ampm[][3] = { "AM", "PM", };
-
- if (s == NULL || format == NULL || tmx == NULL || maxsize == 0)
- return 0;
-
- /* quick check if we even need to bother */
- if (strchr(format, '%') == NULL && strlen(format) + 1 >= maxsize) {
- err:
- errno = ERANGE;
- return 0;
- }
-
- for (; *format && s < endp - 1; format++) {
-#define FLAG_FOUND() do { \
- if (precision > 0 || flags & (BIT_OF(LOCALE_E)|BIT_OF(LOCALE_O))) \
- goto unknown; \
- } while (0)
+ /* various tables for locale C */
+ static const char days_l[][10] = {
+ "Sunday", "Monday", "Tuesday", "Wednesday",
+ "Thursday", "Friday", "Saturday",
+ };
+ static const char months_l[][10] = {
+ "January", "February", "March", "April",
+ "May", "June", "July", "August", "September",
+ "October", "November", "December",
+ };
+ static const char ampm[][3] = { "AM", "PM", };
+
+ if (s == NULL || format == NULL || tmx == NULL || maxsize == 0)
+ return 0;
+
+ /* quick check if we even need to bother */
+ if (strchr(format, '%') == NULL && strlen(format) + 1 >= maxsize) {
+ err:
+ errno = ERANGE;
+ return 0;
+ }
+
+ for (; *format && s < endp - 1; format++) {
+#define FLAG_FOUND() do { \
+ if (precision > 0 || flags & (BIT_OF(LOCALE_E) | BIT_OF(LOCALE_O) | BIT_OF(COLONS))) \
+ goto unknown; \
+ } while (0)
#define NEEDS(n) do if (s >= endp || (n) >= endp - s - 1) goto err; while (0)
-#define FILL_PADDING(i) do { \
- if (!(flags & BIT_OF(LEFT)) && precision > (i)) { \
- NEEDS(precision); \
- memset(s, padding ? padding : ' ', precision - (i)); \
- s += precision - (i); \
- } \
- else { \
- NEEDS(i); \
- } \
-} while (0);
-#define FMT(def_pad, def_prec, fmt, val) \
- do { \
- int l; \
- if (precision <= 0) precision = (def_prec); \
- if (flags & BIT_OF(LEFT)) precision = 1; \
- l = snprintf(s, endp - s, \
- ((padding == '0' || (!padding && (def_pad) == '0')) ? "%0*"fmt : "%*"fmt), \
- precision, (val)); \
- if (l < 0) goto err; \
- s += l; \
- } while (0)
-#define STRFTIME(fmt) \
- do { \
- i = date_strftime_with_tmx(s, endp - s, (fmt), tmx); \
- if (!i) return 0; \
- if (precision > i) {\
- if (start + maxsize < s + precision) { \
- errno = ERANGE; \
- return 0; \
- } \
- memmove(s + precision - i, s, i);\
- memset(s, padding ? padding : ' ', precision - i); \
- s += precision; \
- }\
- else s += i; \
- } while (0)
-#define FMTV(def_pad, def_prec, fmt, val) \
- do { \
- VALUE tmp = (val); \
- if (FIXNUM_P(tmp)) { \
- FMT((def_pad), (def_prec), "l"fmt, FIX2LONG(tmp)); \
- } \
- else { \
- VALUE args[2], result; \
- size_t l; \
- if (precision <= 0) precision = (def_prec); \
- if (flags & BIT_OF(LEFT)) precision = 1; \
- args[0] = INT2FIX(precision); \
- args[1] = (val); \
- if (padding == '0' || (!padding && (def_pad) == '0')) \
- result = rb_str_format(2, args, rb_str_new2("%0*"fmt)); \
- else \
- result = rb_str_format(2, args, rb_str_new2("%*"fmt)); \
- l = strlcpy(s, StringValueCStr(result), endp-s); \
- if ((size_t)(endp-s) <= l) \
- goto err; \
- s += l; \
- } \
- } while (0)
-
- if (*format != '%') {
- *s++ = *format;
- continue;
+#define FILL_PADDING(i) do { \
+ if (!(flags & BIT_OF(LEFT)) && precision > (i)) { \
+ NEEDS(precision); \
+ memset(s, padding ? padding : ' ', precision - (i)); \
+ s += precision - (i); \
+ } \
+ else { \
+ NEEDS(i); \
+ } \
+ } while (0);
+#define FMT(def_pad, def_prec, fmt, val) \
+ do { \
+ int l; \
+ if (precision <= 0) precision = (def_prec); \
+ if (flags & BIT_OF(LEFT)) precision = 1; \
+ l = snprintf(s, endp - s, \
+ ((padding == '0' || (!padding && (def_pad) == '0')) ? \
+ "%0*"fmt : "%*"fmt), \
+ precision, (val)); \
+ if (l < 0) goto err; \
+ s += l; \
+ } while (0)
+#define STRFTIME(fmt) \
+ do { \
+ i = date_strftime_with_tmx(s, endp - s, (fmt), tmx); \
+ if (!i) return 0; \
+ if (flags & BIT_OF(UPPER)) \
+ upcase(s, i); \
+ if (!(flags & BIT_OF(LEFT)) && precision > i) { \
+ if (start + maxsize < s + precision) { \
+ errno = ERANGE; \
+ return 0; \
+ } \
+ memmove(s + precision - i, s, i); \
+ memset(s, padding ? padding : ' ', precision - i); \
+ s += precision; \
+ } \
+ else s += i; \
+ } while (0)
+#define FMTV(def_pad, def_prec, fmt, val) \
+ do { \
+ VALUE tmp = (val); \
+ if (FIXNUM_P(tmp)) { \
+ FMT((def_pad), (def_prec), "l"fmt, FIX2LONG(tmp)); \
+ } \
+ else { \
+ VALUE args[2], result; \
+ size_t l; \
+ if (precision <= 0) precision = (def_prec); \
+ if (flags & BIT_OF(LEFT)) precision = 1; \
+ args[0] = INT2FIX(precision); \
+ args[1] = (val); \
+ if (padding == '0' || (!padding && (def_pad) == '0')) \
+ result = rb_str_format(2, args, rb_str_new2("%0*"fmt)); \
+ else \
+ result = rb_str_format(2, args, rb_str_new2("%*"fmt)); \
+ l = strlcpy(s, StringValueCStr(result), endp - s); \
+ if ((size_t)(endp - s) <= l) \
+ goto err; \
+ s += l; \
+ } \
+ } while (0)
+
+ if (*format != '%') {
+ *s++ = *format;
+ continue;
+ }
+ tp = tbuf;
+ sp = format;
+ precision = -1;
+ flags = 0;
+ padding = 0;
+ colons = 0;
+ again:
+ switch (*++format) {
+ case '\0':
+ format--;
+ goto unknown;
+
+ case 'A': /* full weekday name */
+ case 'a': /* abbreviated weekday name */
+ if (flags & BIT_OF(CHCASE)) {
+ flags &= ~(BIT_OF(LOWER) | BIT_OF(CHCASE));
+ flags |= BIT_OF(UPPER);
+ }
+ {
+ int wday = tmx_wday;
+ if (wday < 0 || wday > 6)
+ i = 1, tp = "?";
+ else {
+ if (*format == 'A')
+ i = strlen(tp = days_l[wday]);
+ else
+ i = 3, tp = days_l[wday];
}
- tp = tbuf;
- sp = format;
- precision = -1;
- flags = 0;
- padding = 0;
- colons = 0;
- again:
- switch (*++format) {
- case '\0':
- format--;
- goto unknown;
-
- case '%':
- FILL_PADDING(1);
- *s++ = '%';
- continue;
-
- case 'a': /* abbreviated weekday name */
- if (flags & BIT_OF(CHCASE)) {
- flags &= ~(BIT_OF(LOWER)|BIT_OF(CHCASE));
- flags |= BIT_OF(UPPER);
- }
- {
- int wday = tmx_wday;
- if (wday < 0 || wday > 6)
- i = 1, tp = "?";
- else
- i = 3, tp = days_l[wday];
- }
- break;
-
- case 'A': /* full weekday name */
- if (flags & BIT_OF(CHCASE)) {
- flags &= ~(BIT_OF(LOWER)|BIT_OF(CHCASE));
- flags |= BIT_OF(UPPER);
- }
- {
- int wday = tmx_wday;
- if (wday < 0 || wday > 6)
- i = 1, tp = "?";
- else
- i = strlen(tp = days_l[wday]);
- }
- break;
-
-#ifdef SYSV_EXT
- case 'h': /* abbreviated month name */
-#endif
- case 'b': /* abbreviated month name */
- if (flags & BIT_OF(CHCASE)) {
- flags &= ~(BIT_OF(LOWER)|BIT_OF(CHCASE));
- flags |= BIT_OF(UPPER);
- }
- {
- int mon = tmx_mon;
- if (mon < 1 || mon > 12)
- i = 1, tp = "?";
- else
- i = 3, tp = months_l[mon-1];
- }
- break;
-
- case 'B': /* full month name */
- if (flags & BIT_OF(CHCASE)) {
- flags &= ~(BIT_OF(LOWER)|BIT_OF(CHCASE));
- flags |= BIT_OF(UPPER);
- }
- {
- int mon = tmx_mon;
- if (mon < 1 || mon > 12)
- i = 1, tp = "?";
- else
- i = strlen(tp = months_l[mon-1]);
- }
- break;
-
- case 'c': /* appropriate date and time representation */
- STRFTIME("%a %b %e %H:%M:%S %Y");
- continue;
-
- case 'd': /* day of the month, 01 - 31 */
- i = range(1, tmx_mday, 31);
- FMT('0', 2, "d", (int)i);
- continue;
-
- case 'H': /* hour, 24-hour clock, 00 - 23 */
- i = range(0, tmx_hour, 23);
- FMT('0', 2, "d", (int)i);
- continue;
-
- case 'I': /* hour, 12-hour clock, 01 - 12 */
- i = range(0, tmx_hour, 23);
- if (i == 0)
- i = 12;
- else if (i > 12)
- i -= 12;
- FMT('0', 2, "d", (int)i);
- continue;
-
- case 'j': /* day of the year, 001 - 366 */
- FMT('0', 3, "d", tmx_yday);
- continue;
-
- case 'm': /* month, 01 - 12 */
- i = range(1, tmx_mon, 12);
- FMT('0', 2, "d", (int)i);
- continue;
-
- case 'M': /* minute, 00 - 59 */
- i = range(0, tmx_min, 59);
- FMT('0', 2, "d", (int)i);
- continue;
-
- case 'p': /* AM or PM based on 12-hour clock */
- case 'P': /* am or pm based on 12-hour clock */
- if ((*format == 'p' && (flags & BIT_OF(CHCASE))) ||
- (*format == 'P' && !(flags & (BIT_OF(CHCASE)|BIT_OF(UPPER))))) {
- flags &= ~(BIT_OF(UPPER)|BIT_OF(CHCASE));
- flags |= BIT_OF(LOWER);
- }
- i = range(0, tmx_hour, 23);
- if (i < 12)
- tp = ampm[0];
- else
- tp = ampm[1];
- i = 2;
- break;
-
- case 's':
- FMTV('0', 1, "d", tmx_secs);
- continue;
-
- case 'Q':
- FMTV('0', 1, "d", tmx_msecs);
- continue;
-
- case 'S': /* second, 00 - 59 */
- i = range(0, tmx_sec, 59);
- FMT('0', 2, "d", (int)i);
- continue;
-
- case 'U': /* week of year, Sunday is first day of week */
- FMT('0', 2, "d", tmx_wnum0);
- continue;
-
- case 'w': /* weekday, Sunday == 0, 0 - 6 */
- i = range(0, tmx_wday, 6);
- FMT('0', 1, "d", (int)i);
- continue;
-
- case 'W': /* week of year, Monday is first day of week */
- FMT('0', 2, "d", tmx_wnum1);
- continue;
-
- case 'x': /* appropriate date representation */
- STRFTIME("%m/%d/%y");
- continue;
-
- case 'X': /* appropriate time representation */
- STRFTIME("%H:%M:%S");
- continue;
-
- case 'y': /* year without a century, 00 - 99 */
- i = NUM2INT(mod(tmx_year, INT2FIX(100)));
- FMT('0', 2, "d", (int)i);
- continue;
-
- case 'Y': /* year with century */
- {
- VALUE year = tmx_year;
- if (FIXNUM_P(year)) {
- long y = FIX2LONG(year);
- FMT('0', 0 <= y ? 4 : 5, "ld", y);
- }
- else {
- FMTV('0', 4, "d", year);
- }
- }
- continue;
-
-#ifdef MAILHEADER_EXT
- case 'z': /* time zone offset east of GMT e.g. -0600 */
- {
- long aoff;
- int hl, hw;
-
- off = NUM2LONG(rb_funcall(tmx_offset, rb_intern("round"), 0));
-
- aoff = off;
- if (aoff < 0)
- aoff = -off;
-
- if ((aoff / 3600) < 10)
- hl = 1;
- else
- hl = 2;
- hw = 2;
- if (flags & BIT_OF(LEFT) && hl == 1)
- hw = 1;
-
- switch (colons) {
- case 0: /* %z -> +hhmm */
- precision = precision <= (3 + hw) ? hw : precision-3;
- NEEDS(precision + 3);
- break;
-
- case 1: /* %:z -> +hh:mm */
- precision = precision <= (4 + hw) ? hw : precision-4;
- NEEDS(precision + 4);
- break;
-
- case 2: /* %::z -> +hh:mm:ss */
- precision = precision <= (7 + hw) ? hw : precision-7;
- NEEDS(precision + 7);
- break;
-
- case 3: /* %:::z -> +hh[:mm[:ss]] */
- {
- if (aoff % 3600 == 0) {
- precision = precision <= (1 + hw) ? hw : precision-1;
- NEEDS(precision + 3);
- }
- else if (aoff % 60 == 0) {
- precision = precision <= (4 + hw) ? hw : precision-4;
- NEEDS(precision + 4);
- }
- else {
- precision = precision <= (7 + hw) ? hw : precision-7;
- NEEDS(precision + 7);
- }
- }
- break;
-
- default:
- format--;
- goto unknown;
- }
- if (padding == ' ' && precision > hl) {
- i = snprintf(s, endp - s, "%*s", precision - hl, "");
- precision = hl;
- if (i < 0) goto err;
- s += i;
- }
- if (off < 0) {
- off = -off;
- *s++ = '-';
- } else {
- *s++ = '+';
- }
- i = snprintf(s, endp - s, "%.*ld", precision, off / 3600);
- if (i < 0) goto err;
- s += i;
- off = off % 3600;
- if (colons == 3 && off == 0)
- continue;
- if (1 <= colons)
- *s++ = ':';
- i = snprintf(s, endp - s, "%02d", (int)(off / 60));
- if (i < 0) goto err;
- s += i;
- off = off % 60;
- if (colons == 3 && off == 0)
- continue;
- if (2 <= colons) {
- *s++ = ':';
- i = snprintf(s, endp - s, "%02d", (int)off);
- if (i < 0) goto err;
- s += i;
- }
- }
- continue;
-#endif /* MAILHEADER_EXT */
-
- case 'Z': /* time zone name or abbreviation */
- if (flags & BIT_OF(CHCASE)) {
- flags &= ~(BIT_OF(UPPER)|BIT_OF(CHCASE));
- flags |= BIT_OF(LOWER);
- }
- {
- char *zone = tmx_zone;
- if (zone == NULL)
- tp = "";
- else
- tp = zone;
- i = strlen(tp);
- }
- break;
-
-#ifdef SYSV_EXT
- case 'n': /* same as \n */
- FILL_PADDING(1);
- *s++ = '\n';
- continue;
-
- case 't': /* same as \t */
- FILL_PADDING(1);
- *s++ = '\t';
- continue;
-
- case 'D': /* date as %m/%d/%y */
- STRFTIME("%m/%d/%y");
- continue;
-
- case 'e': /* day of month, blank padded */
- FMT(' ', 2, "d", range(1, tmx_mday, 31));
- continue;
-
- case 'r': /* time as %I:%M:%S %p */
- STRFTIME("%I:%M:%S %p");
- continue;
-
- case 'R': /* time as %H:%M */
- STRFTIME("%H:%M");
- continue;
-
- case 'T': /* time as %H:%M:%S */
- STRFTIME("%H:%M:%S");
- continue;
-#endif
-
-#ifdef SUNOS_EXT
- case 'k': /* hour, 24-hour clock, blank pad */
- i = range(0, tmx_hour, 23);
- FMT(' ', 2, "d", (int)i);
- continue;
-
- case 'l': /* hour, 12-hour clock, 1 - 12, blank pad */
- i = range(0, tmx_hour, 23);
- if (i == 0)
- i = 12;
- else if (i > 12)
- i -= 12;
- FMT(' ', 2, "d", (int)i);
- continue;
-#endif
-
-#ifdef VMS_EXT
- case 'v': /* date as dd-bbb-YYYY */
- STRFTIME("%e-%b-%Y");
- continue;
-#endif
-
-#ifdef POSIX2_DATE
- case 'C':
- FMTV('0', 2, "d", div(tmx_year, INT2FIX(100)));
- continue;
-
- case 'E':
- /* POSIX locale extensions, ignored for now */
- flags |= BIT_OF(LOCALE_E);
- if (*(format + 1) && strchr("cCxXyY", *(format + 1)))
- goto again;
- goto unknown;
- case 'O':
- /* POSIX locale extensions, ignored for now */
- flags |= BIT_OF(LOCALE_O);
- if (*(format + 1) && strchr("deHImMSuUVwWy",
- *(format + 1)))
- goto again;
- goto unknown;
- case 'V': /* week of year according ISO 8601 */
- FMT('0', 2, "d", tmx_cweek);
- continue;
-
- case 'u':
- /* ISO 8601: Weekday as a decimal number [1 (Monday) - 7] */
- FMT('0', 1, "d", tmx_cwday);
- continue;
-#endif /* POSIX2_DATE */
-
-#ifdef ISO_DATE_EXT
- case 'g': /* year of ISO week without a century */
- i = NUM2INT(mod(tmx_cwyear, INT2FIX(100)));
- FMT('0', 2, "d", (int)i);
- continue;
-
- case 'G': /* year of ISO week with century */
- {
- VALUE year = tmx_cwyear;
- if (FIXNUM_P(year)) {
- long y = FIX2LONG(year);
- FMT('0', 0 <= y ? 4 : 5, "ld", y);
- }
- else {
- FMTV('0', 4, "d", year);
- }
- continue;
+ }
+ break;
+
+ case 'B': /* full month name */
+ case 'b': /* abbreviated month name */
+ case 'h': /* same as %b */
+ if (flags & BIT_OF(CHCASE)) {
+ flags &= ~(BIT_OF(LOWER) | BIT_OF(CHCASE));
+ flags |= BIT_OF(UPPER);
+ }
+ {
+ int mon = tmx_mon;
+ if (mon < 1 || mon > 12)
+ i = 1, tp = "?";
+ else {
+ if (*format == 'B')
+ i = strlen(tp = months_l[mon - 1]);
+ else
+ i = 3, tp = months_l[mon - 1];
+ }
+ }
+ break;
+
+ case 'C': /* century (year/100) */
+ FMTV('0', 2, "d", div(tmx_year, INT2FIX(100)));
+ continue;
+
+ case 'c': /* appropriate date and time representation */
+ STRFTIME("%a %b %e %H:%M:%S %Y");
+ continue;
+
+ case 'D':
+ STRFTIME("%m/%d/%y");
+ continue;
+
+ case 'd': /* day of the month, 01 - 31 */
+ case 'e': /* day of month, blank padded */
+ v = range(1, tmx_mday, 31);
+ FMT((*format == 'd') ? '0' : ' ', 2, "d", v);
+ continue;
+
+ case 'F':
+ STRFTIME("%Y-%m-%d");
+ continue;
+
+ case 'G': /* year of ISO week with century */
+ case 'Y': /* year with century */
+ {
+ VALUE year = (*format == 'G') ? tmx_cwyear : tmx_year;
+ if (FIXNUM_P(year)) {
+ long y = FIX2LONG(year);
+ FMT('0', 0 <= y ? 4 : 5, "ld", y);
+ }
+ else {
+ FMTV('0', 4, "d", year);
+ }
+ }
+ continue;
+
+ case 'g': /* year of ISO week without a century */
+ case 'y': /* year without a century */
+ v = NUM2INT(mod((*format == 'g') ? tmx_cwyear : tmx_year, INT2FIX(100)));
+ FMT('0', 2, "d", v);
+ continue;
+
+ case 'H': /* hour, 24-hour clock, 00 - 23 */
+ case 'k': /* hour, 24-hour clock, blank pad */
+ v = range(0, tmx_hour, 23);
+ FMT((*format == 'H') ? '0' : ' ', 2, "d", v);
+ continue;
+
+ case 'I': /* hour, 12-hour clock, 01 - 12 */
+ case 'l': /* hour, 12-hour clock, 1 - 12, blank pad */
+ v = range(0, tmx_hour, 23);
+ if (v == 0)
+ v = 12;
+ else if (v > 12)
+ v -= 12;
+ FMT((*format == 'I') ? '0' : ' ', 2, "d", v);
+ continue;
+
+ case 'j': /* day of the year, 001 - 366 */
+ v = range(1, tmx_yday, 366);
+ FMT('0', 3, "d", v);
+ continue;
+
+ case 'L': /* millisecond */
+ case 'N': /* nanosecond */
+ if (*format == 'L')
+ w = 3;
+ else
+ w = 9;
+ if (precision <= 0)
+ precision = w;
+ NEEDS(precision);
+
+ {
+ VALUE subsec = tmx_sec_fraction;
+ int ww;
+ long n;
+
+ ww = precision;
+ while (9 <= ww) {
+ subsec = mul(subsec, INT2FIX(1000000000));
+ ww -= 9;
+ }
+ n = 1;
+ for (; 0 < ww; ww--)
+ n *= 10;
+ if (n != 1)
+ subsec = mul(subsec, INT2FIX(n));
+ subsec = div(subsec, INT2FIX(1));
+
+ if (FIXNUM_P(subsec)) {
+ (void)snprintf(s, endp - s, "%0*ld",
+ precision, FIX2LONG(subsec));
+ s += precision;
+ }
+ else {
+ VALUE args[2], result;
+ args[0] = INT2FIX(precision);
+ args[1] = subsec;
+ result = rb_str_format(2, args, rb_str_new2("%0*d"));
+ (void)strlcpy(s, StringValueCStr(result), endp - s);
+ s += precision;
+ }
+ }
+ continue;
+
+ case 'M': /* minute, 00 - 59 */
+ v = range(0, tmx_min, 59);
+ FMT('0', 2, "d", v);
+ continue;
+
+ case 'm': /* month, 01 - 12 */
+ v = range(1, tmx_mon, 12);
+ FMT('0', 2, "d", v);
+ continue;
+
+ case 'n': /* same as \n */
+ FILL_PADDING(1);
+ *s++ = '\n';
+ continue;
+
+ case 't': /* same as \t */
+ FILL_PADDING(1);
+ *s++ = '\t';
+ continue;
+
+ case 'P': /* am or pm based on 12-hour clock */
+ case 'p': /* AM or PM based on 12-hour clock */
+ if ((*format == 'p' && (flags & BIT_OF(CHCASE))) ||
+ (*format == 'P' && !(flags & (BIT_OF(CHCASE) | BIT_OF(UPPER))))) {
+ flags &= ~(BIT_OF(UPPER) | BIT_OF(CHCASE));
+ flags |= BIT_OF(LOWER);
+ }
+ v = range(0, tmx_hour, 23);
+ if (v < 12)
+ tp = ampm[0];
+ else
+ tp = ampm[1];
+ i = 2;
+ break;
+
+ case 'Q': /* milliseconds since Unix epoch */
+ FMTV('0', 1, "d", tmx_msecs);
+ continue;
+
+ case 'R':
+ STRFTIME("%H:%M");
+ continue;
+
+ case 'r':
+ STRFTIME("%I:%M:%S %p");
+ continue;
+
+ case 'S': /* second, 00 - 59 */
+ v = range(0, tmx_sec, 59);
+ FMT('0', 2, "d", v);
+ continue;
+
+ case 's': /* seconds since Unix epoch */
+ FMTV('0', 1, "d", tmx_secs);
+ continue;
+
+ case 'T':
+ STRFTIME("%H:%M:%S");
+ continue;
+
+ case 'U': /* week of year, Sunday is first day of week */
+ case 'W': /* week of year, Monday is first day of week */
+ v = range(0, (*format == 'U') ? tmx_wnum0 : tmx_wnum1, 53);
+ FMT('0', 2, "d", v);
+ continue;
+
+ case 'u': /* weekday, Monday == 1, 1 - 7 */
+ v = range(1, tmx_cwday, 7);
+ FMT('0', 1, "d", v);
+ continue;
+
+ case 'V': /* week of year according ISO 8601 */
+ v = range(1, tmx_cweek, 53);
+ FMT('0', 2, "d", v);
+ continue;
+
+ case 'v':
+ STRFTIME("%e-%b-%Y");
+ continue;
+
+ case 'w': /* weekday, Sunday == 0, 0 - 6 */
+ v = range(0, tmx_wday, 6);
+ FMT('0', 1, "d", v);
+ continue;
+
+ case 'X': /* appropriate time representation */
+ STRFTIME("%H:%M:%S");
+ continue;
+
+ case 'x': /* appropriate date representation */
+ STRFTIME("%m/%d/%y");
+ continue;
+
+ case 'Z': /* time zone name or abbreviation */
+ if (flags & BIT_OF(CHCASE)) {
+ flags &= ~(BIT_OF(UPPER) | BIT_OF(CHCASE));
+ flags |= BIT_OF(LOWER);
+ }
+ {
+ char *zone = tmx_zone;
+ if (zone == NULL)
+ tp = "";
+ else
+ tp = zone;
+ i = strlen(tp);
+ }
+ break;
+
+ case 'z': /* offset from UTC */
+ {
+ long off, aoff;
+ int hl, hw;
+
+ off = tmx_offset;
+ aoff = off;
+ if (aoff < 0)
+ aoff = -off;
+
+ if ((aoff / 3600) < 10)
+ hl = 1;
+ else
+ hl = 2;
+ hw = 2;
+ if (flags & BIT_OF(LEFT) && hl == 1)
+ hw = 1;
+
+ switch (colons) {
+ case 0: /* %z -> +hhmm */
+ precision = precision <= (3 + hw) ? hw : precision - 3;
+ NEEDS(precision + 3);
+ break;
+
+ case 1: /* %:z -> +hh:mm */
+ precision = precision <= (4 + hw) ? hw : precision - 4;
+ NEEDS(precision + 4);
+ break;
+
+ case 2: /* %::z -> +hh:mm:ss */
+ precision = precision <= (7 + hw) ? hw : precision - 7;
+ NEEDS(precision + 7);
+ break;
+
+ case 3: /* %:::z -> +hh[:mm[:ss]] */
+ {
+ if (aoff % 3600 == 0) {
+ precision = precision <= (1 + hw) ?
+ hw : precision - 1;
+ NEEDS(precision + 3);
}
-
-#endif /* ISO_DATE_EXT */
-
- case 'L':
- w = 3;
- goto subsec;
-
- case 'N':
- /*
- * fractional second digits. default is 9 digits
- * (nanosecond).
- *
- * %3N millisecond (3 digits)
- * %6N microsecond (6 digits)
- * %9N nanosecond (9 digits)
- */
- w = 9;
- subsec:
- if (precision <= 0) {
- precision = w;
- }
- NEEDS(precision);
-
- {
- VALUE subsec = tmx_sec_fraction;
- int ww;
- long n;
-
- ww = precision;
- while (9 <= ww) {
- subsec = mul(subsec, INT2FIX(1000000000));
- ww -= 9;
- }
- n = 1;
- for (; 0 < ww; ww--)
- n *= 10;
- if (n != 1)
- subsec = mul(subsec, INT2FIX(n));
- subsec = div(subsec, INT2FIX(1));
-
- if (FIXNUM_P(subsec)) {
- (void)snprintf(s, endp - s, "%0*ld", precision, FIX2LONG(subsec));
- s += precision;
- }
- else {
- VALUE args[2], result;
- args[0] = INT2FIX(precision);
- args[1] = subsec;
- result = rb_str_format(2, args, rb_str_new2("%0*d"));
- (void)strlcpy(s, StringValueCStr(result), endp-s);
- s += precision;
- }
+ else if (aoff % 60 == 0) {
+ precision = precision <= (4 + hw) ?
+ hw : precision - 4;
+ NEEDS(precision + 4);
}
- continue;
-
- case 'F': /* Equivalent to %Y-%m-%d */
- STRFTIME("%Y-%m-%d");
- continue;
- case '+':
- STRFTIME("%a %b %e %H:%M:%S %Z %Y");
- continue;
-
- case '-':
- FLAG_FOUND();
- flags |= BIT_OF(LEFT);
- padding = precision = 0;
- goto again;
-
- case '^':
- FLAG_FOUND();
- flags |= BIT_OF(UPPER);
- goto again;
-
- case '#':
- FLAG_FOUND();
- flags |= BIT_OF(CHCASE);
- goto again;
-
- case '_':
- FLAG_FOUND();
- padding = ' ';
- goto again;
-
- case ':':
- colons++;
- goto again;
-
- case '0':
- padding = '0';
- case '1': case '2': case '3': case '4':
- case '5': case '6': case '7': case '8': case '9':
- {
- char *e;
- precision = (int)strtoul(format, &e, 10);
- format = e - 1;
- goto again;
+ else {
+ precision = precision <= (7 + hw) ?
+ hw : precision - 7;
+ NEEDS(precision + 7);
}
+ }
+ break;
- default:
- unknown:
- i = format - sp + 1;
- tp = sp;
- precision = -1;
- flags = 0;
- padding = 0;
- colons = 0;
- break;
+ default:
+ format--;
+ goto unknown;
}
- if (i) {
- FILL_PADDING(i);
- memcpy(s, tp, i);
- switch (flags & (BIT_OF(UPPER)|BIT_OF(LOWER))) {
- case BIT_OF(UPPER):
- do {
- if (ISLOWER(*s)) *s = TOUPPER(*s);
- } while (s++, --i);
- break;
- case BIT_OF(LOWER):
- do {
- if (ISUPPER(*s)) *s = TOLOWER(*s);
- } while (s++, --i);
- break;
- default:
- s += i;
- break;
- }
+ if (padding == ' ' && precision > hl) {
+ i = snprintf(s, endp - s, "%*s", precision - hl, "");
+ precision = hl;
+ if (i < 0) goto err;
+ s += i;
+ }
+ if (off < 0) {
+ off = -off;
+ *s++ = '-';
+ } else {
+ *s++ = '+';
+ }
+ i = snprintf(s, endp - s, "%.*ld", precision, off / 3600);
+ if (i < 0) goto err;
+ s += i;
+ off = off % 3600;
+ if (colons == 3 && off == 0)
+ continue;
+ if (1 <= colons)
+ *s++ = ':';
+ i = snprintf(s, endp - s, "%02d", (int)(off / 60));
+ if (i < 0) goto err;
+ s += i;
+ off = off % 60;
+ if (colons == 3 && off == 0)
+ continue;
+ if (2 <= colons) {
+ *s++ = ':';
+ i = snprintf(s, endp - s, "%02d", (int)off);
+ if (i < 0) goto err;
+ s += i;
}
+ }
+ continue;
+
+ case '+':
+ STRFTIME("%a %b %e %H:%M:%S %Z %Y");
+ continue;
+
+ case 'E':
+ /* POSIX locale extensions, ignored for now */
+ flags |= BIT_OF(LOCALE_E);
+ if (*(format + 1) && strchr("cCxXyY", *(format + 1)))
+ goto again;
+ goto unknown;
+ case 'O':
+ /* POSIX locale extensions, ignored for now */
+ flags |= BIT_OF(LOCALE_O);
+ if (*(format + 1) && strchr("deHkIlmMSuUVwWy", *(format + 1)))
+ goto again;
+ goto unknown;
+
+ case ':':
+ flags |= BIT_OF(COLONS);
+ {
+ size_t l = strspn(format, ":");
+ format += l;
+ if (*format == 'z') {
+ colons = l;
+ format--;
+ goto again;
+ }
+ format -= l;
+ }
+ goto unknown;
+
+ case '_':
+ FLAG_FOUND();
+ padding = ' ';
+ goto again;
+
+ case '-':
+ FLAG_FOUND();
+ flags |= BIT_OF(LEFT);
+ goto again;
+
+ case '^':
+ FLAG_FOUND();
+ flags |= BIT_OF(UPPER);
+ goto again;
+
+ case '#':
+ FLAG_FOUND();
+ flags |= BIT_OF(CHCASE);
+ goto again;
+
+ case '0':
+ FLAG_FOUND();
+ padding = '0';
+ case '1': case '2': case '3': case '4':
+ case '5': case '6': case '7': case '8': case '9':
+ {
+ char *e;
+ precision = (int)strtoul(format, &e, 10);
+ format = e - 1;
+ goto again;
+ }
+
+ case '%':
+ FILL_PADDING(1);
+ *s++ = '%';
+ continue;
+
+ default:
+ unknown:
+ i = format - sp + 1;
+ tp = sp;
+ precision = -1;
+ flags = 0;
+ padding = 0;
+ colons = 0;
+ break;
}
- if (s >= endp) {
- goto err;
+ if (i) {
+ FILL_PADDING(i);
+ memcpy(s, tp, i);
+ switch (flags & (BIT_OF(UPPER) | BIT_OF(LOWER))) {
+ case BIT_OF(UPPER):
+ upcase(s, i);
+ break;
+ case BIT_OF(LOWER):
+ downcase(s, i);
+ break;
+ }
+ s += i;
}
- if (*format == '\0') {
- *s = '\0';
- return (s - start);
- } else
- return 0;
+ }
+ if (s >= endp) {
+ goto err;
+ }
+ if (*format == '\0') {
+ *s = '\0';
+ return (s - start);
+ }
+ return 0;
}
size_t
date_strftime(char *s, size_t maxsize, const char *format,
const struct tmx *tmx)
{
- return date_strftime_with_tmx(s, maxsize, format, tmx);
-}
-
-#if 0
-/* isleap --- is a year a leap year? */
-
-#ifndef __STDC__
-static int
-isleap(year)
-long year;
-#else
-static int
-isleap(long year)
-#endif
-{
- return ((year % 4 == 0 && year % 100 != 0) || year % 400 == 0);
-}
-
-static void
-tmx2tm_noyear(const struct tmx *tmx, struct tm *result)
-{
- struct tm tm;
-
- /* for isleap() in iso8601wknum. +100 is -1900 (mod 400). */
- tm.tm_year = FIX2INT(mod(tmx_year, INT2FIX(400))) + 100;
-
- tm.tm_mon = tmx_mon-1;
- tm.tm_mday = tmx_mday;
- tm.tm_hour = tmx_hour;
- tm.tm_min = tmx_min;
- tm.tm_sec = tmx_sec;
- tm.tm_wday = tmx_wday;
- tm.tm_yday = tmx_yday-1;
- tm.tm_isdst = 0;
-#if defined(HAVE_STRUCT_TM_TM_GMTOFF)
- tm.tm_gmtoff = NUM2LONG(tmx_offset);
-#endif
-#if defined(HAVE_TM_ZONE)
- tm.tm_zone = (char *)tmx_zone;
-#endif
- *result = tm;
-}
-
-#ifdef POSIX2_DATE
-/* iso8601wknum --- compute week number according to ISO 8601 */
-
-#ifndef __STDC__
-static int
-iso8601wknum(timeptr)
-const struct tm *timeptr;
-#else
-static int
-iso8601wknum(const struct tm *timeptr)
-#endif
-{
- /*
- * From 1003.2:
- * If the week (Monday to Sunday) containing January 1
- * has four or more days in the new year, then it is week 1;
- * otherwise it is the highest numbered week of the previous
- * year (52 or 53), and the next week is week 1.
- *
- * ADR: This means if Jan 1 was Monday through Thursday,
- * it was week 1, otherwise week 52 or 53.
- *
- * XPG4 erroneously included POSIX.2 rationale text in the
- * main body of the standard. Thus it requires week 53.
- */
-
- int weeknum, jan1day;
-
- /* get week number, Monday as first day of the week */
- weeknum = weeknumber(timeptr, 1);
-
- /*
- * With thanks and tip of the hatlo to tml@tik.vtt.fi
- *
- * What day of the week does January 1 fall on?
- * We know that
- * (timeptr->tm_yday - jan1.tm_yday) MOD 7 ==
- * (timeptr->tm_wday - jan1.tm_wday) MOD 7
- * and that
- * jan1.tm_yday == 0
- * and that
- * timeptr->tm_wday MOD 7 == timeptr->tm_wday
- * from which it follows that. . .
- */
- jan1day = timeptr->tm_wday - (timeptr->tm_yday % 7);
- if (jan1day < 0)
- jan1day += 7;
-
- /*
- * If Jan 1 was a Monday through Thursday, it was in
- * week 1. Otherwise it was last year's highest week, which is
- * this year's week 0.
- *
- * What does that mean?
- * If Jan 1 was Monday, the week number is exactly right, it can
- * never be 0.
- * If it was Tuesday through Thursday, the weeknumber is one
- * less than it should be, so we add one.
- * Otherwise, Friday, Saturday or Sunday, the week number is
- * OK, but if it is 0, it needs to be 52 or 53.
- */
- switch (jan1day) {
- case 1: /* Monday */
- break;
- case 2: /* Tuesday */
- case 3: /* Wednesday */
- case 4: /* Thursday */
- weeknum++;
- break;
- case 5: /* Friday */
- case 6: /* Saturday */
- case 0: /* Sunday */
- if (weeknum == 0) {
-#ifdef USE_BROKEN_XPG4
- /* XPG4 (as of March 1994) says 53 unconditionally */
- weeknum = 53;
-#else
- /* get week number of last week of last year */
- struct tm dec31ly; /* 12/31 last year */
- dec31ly = *timeptr;
- dec31ly.tm_year--;
- dec31ly.tm_mon = 11;
- dec31ly.tm_mday = 31;
- dec31ly.tm_wday = (jan1day == 0) ? 6 : jan1day - 1;
- dec31ly.tm_yday = 364 + isleap(dec31ly.tm_year + 1900L);
- weeknum = iso8601wknum(& dec31ly);
-#endif
- }
- break;
- }
-
- if (timeptr->tm_mon == 11) {
- /*
- * The last week of the year
- * can be in week 1 of next year.
- * Sigh.
- *
- * This can only happen if
- * M T W
- * 29 30 31
- * 30 31
- * 31
- */
- int wday, mday;
-
- wday = timeptr->tm_wday;
- mday = timeptr->tm_mday;
- if ( (wday == 1 && (mday >= 29 && mday <= 31))
- || (wday == 2 && (mday == 30 || mday == 31))
- || (wday == 3 && mday == 31))
- weeknum = 1;
- }
-
- return weeknum;
-}
-
-static int
-iso8601wknum_v(const struct tmx *tmx)
-{
- struct tm tm;
- tmx2tm_noyear(tmx, &tm);
- return iso8601wknum(&tm);
+ return date_strftime_with_tmx(s, maxsize, format, tmx);
}
-#endif
-
-/* weeknumber --- figure how many weeks into the year */
-
-/* With thanks and tip of the hatlo to ado@elsie.nci.nih.gov */
-
-#ifndef __STDC__
-static int
-weeknumber(timeptr, firstweekday)
-const struct tm *timeptr;
-int firstweekday;
-#else
-static int
-weeknumber(const struct tm *timeptr, int firstweekday)
-#endif
-{
- int wday = timeptr->tm_wday;
- int ret;
-
- if (firstweekday == 1) {
- if (wday == 0) /* sunday */
- wday = 6;
- else
- wday--;
- }
- ret = ((timeptr->tm_yday + 7 - wday) / 7);
- if (ret < 0)
- ret = 0;
- return ret;
-}
-
-static int
-weeknumber_v(const struct tmx *tmx, int firstweekday)
-{
- struct tm tm;
- tmx2tm_noyear(tmx, &tm);
- return weeknumber(&tm, firstweekday);
-}
-#endif
-
-#if 0
-/* ADR --- I'm loathe to mess with ado's code ... */
-
-Date: Wed, 24 Apr 91 20:54:08 MDT
-From: Michal Jaegermann <audfax!emory!vm.ucs.UAlberta.CA!NTOMCZAK>
-To: arnold@audiofax.com
-
-Hi Arnold,
-in a process of fixing of strftime() in libraries on Atari ST I grabbed
-some pieces of code from your own strftime. When doing that it came
-to mind that your weeknumber() function compiles a little bit nicer
-in the following form:
-/*
- * firstweekday is 0 if starting in Sunday, non-zero if in Monday
- */
-{
- return (timeptr->tm_yday - timeptr->tm_wday +
- (firstweekday ? (timeptr->tm_wday ? 8 : 1) : 7)) / 7;
-}
-How nicer it depends on a compiler, of course, but always a tiny bit.
-
- Cheers,
- Michal
- ntomczak@vm.ucs.ualberta.ca
-#endif
-
-#ifdef TEST_STRFTIME
-
/*
- * NAME:
- * tst
- *
- * SYNOPSIS:
- * tst
- *
- * DESCRIPTION:
- * "tst" is a test driver for the function "strftime".
- *
- * OPTIONS:
- * None.
- *
- * AUTHOR:
- * Karl Vogel
- * Control Data Systems, Inc.
- * vogelke@c-17igp.wpafb.af.mil
- *
- * BUGS:
- * None noticed yet.
- *
- * COMPILE:
- * cc -o tst -DTEST_STRFTIME strftime.c
- */
-
-/* ADR: I reformatted this to my liking, and deleted some unneeded code. */
-
-#ifndef NULL
-#include <stdio.h>
-#endif
-#include <time.h>
-#include <sys/time.h>
-#include <string.h>
-
-#define MAXTIME 132
-
-/*
- * Array of time formats.
- */
-
-static char *array[] =
-{
- "(%%A) full weekday name, var length (Sunday..Saturday) %A",
- "(%%B) full month name, var length (January..December) %B",
- "(%%C) Century %C",
- "(%%D) date (%%m/%%d/%%y) %D",
- "(%%E) Locale extensions (ignored) %E",
- "(%%H) hour (24-hour clock, 00..23) %H",
- "(%%I) hour (12-hour clock, 01..12) %I",
- "(%%M) minute (00..59) %M",
- "(%%O) Locale extensions (ignored) %O",
- "(%%R) time, 24-hour (%%H:%%M) %R",
- "(%%S) second (00..60) %S",
- "(%%T) time, 24-hour (%%H:%%M:%%S) %T",
- "(%%U) week of year, Sunday as first day of week (00..53) %U",
- "(%%V) week of year according to ISO 8601 %V",
- "(%%W) week of year, Monday as first day of week (00..53) %W",
- "(%%X) appropriate locale time representation (%H:%M:%S) %X",
- "(%%Y) year with century (1970...) %Y",
- "(%%Z) timezone (EDT), or blank if timezone not determinable %Z",
- "(%%a) locale's abbreviated weekday name (Sun..Sat) %a",
- "(%%b) locale's abbreviated month name (Jan..Dec) %b",
- "(%%c) full date (Sat Nov 4 12:02:33 1989)%n%t%t%t %c",
- "(%%d) day of the month (01..31) %d",
- "(%%e) day of the month, blank-padded ( 1..31) %e",
- "(%%h) should be same as (%%b) %h",
- "(%%j) day of the year (001..366) %j",
- "(%%k) hour, 24-hour clock, blank pad ( 0..23) %k",
- "(%%l) hour, 12-hour clock, blank pad ( 1..12) %l",
- "(%%m) month (01..12) %m",
- "(%%p) locale's AM or PM based on 12-hour clock %p",
- "(%%r) time, 12-hour (same as %%I:%%M:%%S %%p) %r",
- "(%%u) ISO 8601: Weekday as decimal number [1 (Monday) - 7] %u",
- "(%%v) VMS date (dd-bbb-YYYY) %v",
- "(%%w) day of week (0..6, Sunday == 0) %w",
- "(%%x) appropriate locale date representation %x",
- "(%%y) last two digits of year (00..99) %y",
- "(%%z) timezone offset east of GMT as HHMM (e.g. -0500) %z",
- (char *) NULL
-};
-
-/* main routine. */
-
-int
-main(argc, argv)
-int argc;
-char **argv;
-{
- char *next;
- char string[MAXTIME];
-
- int k;
- int length;
-
- struct tm *tm;
-
- time_t clock;
-
- /* Call the function. */
-
- clock = time(NULL);
- tm = localtime(&clock);
-
- for (k = 0; next = array[k]; k++) {
- length = strftime(string, MAXTIME, next, tm);
- printf("%s\n", string);
- }
-
- exit(0);
-}
-#endif /* TEST_STRFTIME */
+Local variables:
+c-file-style: "ruby"
+End:
+*/
diff --git a/ext/date/date_strptime.c b/ext/date/date_strptime.c
index eaec8e716b..c6a5969172 100644
--- a/ext/date/date_strptime.c
+++ b/ext/date/date_strptime.c
@@ -58,14 +58,15 @@ static const char *extz_pats[] = {
static int
num_pattern_p(const char *s)
{
- if (isdigit(*s))
+ if (isdigit((unsigned char)*s))
return 1;
if (*s == '%') {
s++;
if (*s == 'E' || *s == 'O')
s++;
if (*s &&
- (strchr("CDdeFGgHIjkLlMmNQRrSsTUuVvWwXxYy", *s) || isdigit(*s)))
+ (strchr("CDdeFGgHIjkLlMmNQRrSsTUuVvWwXxYy", *s) ||
+ isdigit((unsigned char)*s)))
return 1;
}
return 0;
@@ -624,7 +625,7 @@ date__strptime_internal(const char *str, size_t slen,
case '\v':
case '\f':
case '\r':
- while (isspace(str[si]))
+ while (isspace((unsigned char)str[si]))
si++;
fi++;
break;
diff --git a/ext/date/date_tmx.h b/ext/date/date_tmx.h
index 0e56c9b4f0..ed06501228 100644
--- a/ext/date/date_tmx.h
+++ b/ext/date/date_tmx.h
@@ -18,7 +18,7 @@ struct tmx_funcs {
VALUE (*sec_fraction)(void *dat);
VALUE (*secs)(void *dat);
VALUE (*msecs)(void *dat);
- VALUE (*offset)(void *dat);
+ int (*offset)(void *dat);
char *(*zone)(void *dat);
};
struct tmx {
diff --git a/ext/date/depend b/ext/date/depend
index 7e5d62e79d..3a13fcc9a9 100644
--- a/ext/date/depend
+++ b/ext/date/depend
@@ -1,2 +1,7 @@
-date_core.o: date_tmx.h
+$(OBJS): $(ruby_headers)
+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/dbm/dbm.c b/ext/dbm/dbm.c
index 3c65d1f5bc..c77897ece5 100644
--- a/ext/dbm/dbm.c
+++ b/ext/dbm/dbm.c
@@ -21,6 +21,15 @@
#include <fcntl.h>
#include <errno.h>
+#define DSIZE_TYPE TYPEOF_DATUM_DSIZE
+#if SIZEOF_DATUM_DSIZE > SIZEOF_INT
+# define RSTRING_DSIZE(s) RSTRING_LEN(s)
+# define TOO_LONG(n) 0
+#else
+# define RSTRING_DSIZE(s) RSTRING_LENINT(s)
+# define TOO_LONG(n) ((long)(+(DSIZE_TYPE)(n)) != (n))
+#endif
+
static VALUE rb_cDBM, rb_eDBMError;
#define RUBY_DBM_RW_BIT 0x20000000
@@ -137,26 +146,67 @@ fdbm_initialize(int argc, VALUE *argv, VALUE obj)
FilePathValue(file);
+ /*
+ * Note:
+ * gdbm 1.10 works with O_CLOEXEC. gdbm 1.9.1 silently ignore it.
+ */
+#ifndef O_CLOEXEC
+# define O_CLOEXEC 0
+#endif
+
if (flags & RUBY_DBM_RW_BIT) {
flags &= ~RUBY_DBM_RW_BIT;
- dbm = dbm_open(RSTRING_PTR(file), flags, mode);
+ dbm = dbm_open(RSTRING_PTR(file), flags|O_CLOEXEC, mode);
}
else {
dbm = 0;
if (mode >= 0) {
- dbm = dbm_open(RSTRING_PTR(file), O_RDWR|O_CREAT, mode);
+ dbm = dbm_open(RSTRING_PTR(file), O_RDWR|O_CREAT|O_CLOEXEC, mode);
}
if (!dbm) {
- dbm = dbm_open(RSTRING_PTR(file), O_RDWR, 0);
+ dbm = dbm_open(RSTRING_PTR(file), O_RDWR|O_CLOEXEC, 0);
}
if (!dbm) {
- dbm = dbm_open(RSTRING_PTR(file), O_RDONLY, 0);
+ dbm = dbm_open(RSTRING_PTR(file), O_RDONLY|O_CLOEXEC, 0);
}
}
+ if (dbm) {
+ /*
+ * History of dbm_pagfno() and dbm_dirfno() in ndbm and its compatibles.
+ * (dbm_pagfno() and dbm_dirfno() is not standardized.)
+ *
+ * 1986: 4.3BSD provides ndbm.
+ * It provides dbm_pagfno() and dbm_dirfno() as macros.
+ * 1991: gdbm-1.5 provides them as functions.
+ * They returns a same descriptor.
+ * (Earlier releases may have the functions too.)
+ * 1991: Net/2 provides Berkeley DB.
+ * It doesn't provide dbm_pagfno() and dbm_dirfno().
+ * 1992: 4.4BSD Alpha provides Berkeley DB with dbm_dirfno() as a function.
+ * dbm_pagfno() is a macro as DBM_PAGFNO_NOT_AVAILABLE.
+ * 1997: Berkeley DB 2.0 is released by Sleepycat Software, Inc.
+ * It defines dbm_pagfno() and dbm_dirfno() as macros.
+ * 2011: gdbm-1.9 creates a separate dir file.
+ * dbm_pagfno() and dbm_dirfno() returns different descriptors.
+ */
+#if defined(HAVE_DBM_PAGFNO)
+ rb_fd_fix_cloexec(dbm_pagfno(dbm));
+#endif
+#if defined(HAVE_DBM_DIRFNO)
+ rb_fd_fix_cloexec(dbm_dirfno(dbm));
+#endif
+
+#if defined(RUBYDBM_DB_HEADER) && defined(HAVE_TYPE_DBC)
+ /* Disable Berkeley DB error messages such as:
+ * DB->put: attempt to modify a read-only database */
+ ((DBC*)dbm)->dbp->set_errfile(((DBC*)dbm)->dbp, NULL);
+#endif
+ }
+
if (!dbm) {
if (mode == -1) return Qnil;
- rb_sys_fail(RSTRING_PTR(file));
+ rb_sys_fail_str(file);
}
dbmp = ALLOC(struct dbmdata);
@@ -197,14 +247,18 @@ fdbm_fetch(VALUE obj, VALUE keystr, VALUE ifnone)
datum key, value;
struct dbmdata *dbmp;
DBM *dbm;
+ long len;
ExportStringValue(keystr);
+ len = RSTRING_LEN(keystr);
+ if (TOO_LONG(len)) goto not_found;
key.dptr = RSTRING_PTR(keystr);
- key.dsize = (int)RSTRING_LEN(keystr);
+ key.dsize = (DSIZE_TYPE)len;
GetDBM2(obj, dbmp, dbm);
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));
return ifnone;
@@ -258,15 +312,18 @@ fdbm_key(VALUE obj, VALUE valstr)
datum key, val;
struct dbmdata *dbmp;
DBM *dbm;
+ long len;
ExportStringValue(valstr);
+ len = RSTRING_LEN(valstr);
+ if (TOO_LONG(len)) return Qnil;
val.dptr = RSTRING_PTR(valstr);
- val.dsize = (int)RSTRING_LEN(valstr);
+ val.dsize = (DSIZE_TYPE)len;
GetDBM2(obj, dbmp, dbm);
for (key = dbm_firstkey(dbm); key.dptr; key = dbm_nextkey(dbm)) {
val = dbm_fetch(dbm, key);
- if ((long)val.dsize == (int)RSTRING_LEN(valstr) &&
+ if ((long)val.dsize == RSTRING_LEN(valstr) &&
memcmp(val.dptr, RSTRING_PTR(valstr), val.dsize) == 0) {
return rb_tainted_str_new(key.dptr, key.dsize);
}
@@ -335,7 +392,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");
}
@@ -352,16 +408,20 @@ fdbm_delete(VALUE obj, VALUE keystr)
struct dbmdata *dbmp;
DBM *dbm;
VALUE valstr;
+ long len;
fdbm_modify(obj);
ExportStringValue(keystr);
+ len = RSTRING_LEN(keystr);
+ if (TOO_LONG(len)) goto not_found;
key.dptr = RSTRING_PTR(keystr);
- key.dsize = (int)RSTRING_LEN(keystr);
+ key.dsize = (DSIZE_TYPE)len;
GetDBM2(obj, dbmp, dbm);
value = dbm_fetch(dbm, key);
if (value.dptr == 0) {
+ not_found:
if (rb_block_given_p()) return rb_yield(keystr);
return Qnil;
}
@@ -424,7 +484,7 @@ fdbm_delete_if(VALUE obj)
struct dbmdata *dbmp;
DBM *dbm;
VALUE keystr, valstr;
- VALUE ret, ary = rb_ary_new();
+ VALUE ret, ary = rb_ary_tmp_new(0);
int i, status = 0;
long n;
@@ -436,6 +496,7 @@ fdbm_delete_if(VALUE obj)
for (key = dbm_firstkey(dbm); key.dptr; key = dbm_nextkey(dbm)) {
val = dbm_fetch(dbm, key);
keystr = rb_tainted_str_new(key.dptr, key.dsize);
+ OBJ_FREEZE(keystr);
valstr = rb_tainted_str_new(val.dptr, val.dsize);
ret = rb_protect(rb_yield, rb_assoc_new(rb_str_dup(keystr), valstr), &status);
if (status != 0) break;
@@ -445,15 +506,15 @@ fdbm_delete_if(VALUE obj)
for (i = 0; i < RARRAY_LEN(ary); i++) {
keystr = RARRAY_PTR(ary)[i];
- ExportStringValue(keystr);
key.dptr = RSTRING_PTR(keystr);
- key.dsize = (int)RSTRING_LEN(keystr);
+ key.dsize = (DSIZE_TYPE)RSTRING_LEN(keystr);
if (dbm_delete(dbm, key)) {
rb_raise(rb_eDBMError, "dbm_delete failed");
}
}
if (status) rb_jump_tag(status);
if (n > 0) dbmp->di_size = n - RARRAY_LEN(ary);
+ rb_ary_clear(ary);
return obj;
}
@@ -574,17 +635,15 @@ fdbm_store(VALUE obj, VALUE keystr, VALUE valstr)
valstr = rb_obj_as_string(valstr);
key.dptr = RSTRING_PTR(keystr);
- key.dsize = (int)RSTRING_LEN(keystr);
+ key.dsize = RSTRING_DSIZE(keystr);
val.dptr = RSTRING_PTR(valstr);
- val.dsize = (int)RSTRING_LEN(valstr);
+ val.dsize = RSTRING_DSIZE(valstr);
GetDBM2(obj, dbmp, dbm);
dbmp->di_size = -1;
if (dbm_store(dbm, key, val, DBM_REPLACE)) {
-#ifdef HAVE_DBM_CLEARERR
dbm_clearerr(dbm);
-#endif
if (errno == EPERM) rb_sys_fail(0);
rb_raise(rb_eDBMError, "dbm_store failed");
}
@@ -595,6 +654,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.
*/
@@ -629,21 +689,20 @@ fdbm_empty_p(VALUE obj)
datum key;
struct dbmdata *dbmp;
DBM *dbm;
- int i = 0;
GetDBM2(obj, dbmp, dbm);
if (dbmp->di_size < 0) {
dbm = dbmp->di_dbm;
for (key = dbm_firstkey(dbm); key.dptr; key = dbm_nextkey(dbm)) {
- i++;
+ return Qfalse;
}
}
else {
- i = (int)dbmp->di_size;
+ if (dbmp->di_size)
+ return Qfalse;
}
- if (i == 0) return Qtrue;
- return Qfalse;
+ return Qtrue;
}
/*
@@ -773,7 +832,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.
*/
@@ -783,10 +845,13 @@ fdbm_has_key(VALUE obj, VALUE keystr)
datum key, val;
struct dbmdata *dbmp;
DBM *dbm;
+ long len;
ExportStringValue(keystr);
+ len = RSTRING_LEN(keystr);
+ if (TOO_LONG(len)) return Qfalse;
key.dptr = RSTRING_PTR(keystr);
- key.dsize = (int)RSTRING_LEN(keystr);
+ key.dsize = (DSIZE_TYPE)len;
GetDBM2(obj, dbmp, dbm);
val = dbm_fetch(dbm, key);
@@ -797,6 +862,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.
@@ -807,15 +873,18 @@ fdbm_has_value(VALUE obj, VALUE valstr)
datum key, val;
struct dbmdata *dbmp;
DBM *dbm;
+ long len;
ExportStringValue(valstr);
+ len = RSTRING_LEN(valstr);
+ if (TOO_LONG(len)) return Qfalse;
val.dptr = RSTRING_PTR(valstr);
- val.dsize = (int)RSTRING_LEN(valstr);
+ val.dsize = (DSIZE_TYPE)len;
GetDBM2(obj, dbmp, dbm);
for (key = dbm_firstkey(dbm); key.dptr; key = dbm_nextkey(dbm)) {
val = dbm_fetch(dbm, key);
- if (val.dsize == (int)RSTRING_LEN(valstr) &&
+ if ((DSIZE_TYPE)val.dsize == (DSIZE_TYPE)RSTRING_LEN(valstr) &&
memcmp(val.dptr, RSTRING_PTR(valstr), val.dsize) == 0)
return Qtrue;
}
@@ -888,8 +957,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.
@@ -907,7 +975,7 @@ fdbm_reject(VALUE obj)
* - {Berkeley DB}[http://en.wikipedia.org/wiki/Berkeley_DB] versions
* 1 thru 5, also known as BDB and Sleepycat DB, now owned by Oracle
* Corporation.
- * - Berkeley DB 1.x, still found in FreeBSD and OpenBSD.
+ * - Berkeley DB 1.x, still found in 4.4BSD derivatives (FreeBSD, OpenBSD, etc).
* - {gdbm}[http://www.gnu.org/software/gdbm/], the GNU implementation of dbm.
* - {qdbm}[http://fallabs.com/qdbm/index.html], another open source
* reimplementation of dbm.
@@ -915,7 +983,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:
*
@@ -940,10 +1008,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'
@@ -988,9 +1056,9 @@ Init_dbm(void)
rb_define_method(rb_cDBM, "reject!", fdbm_delete_if, 0);
rb_define_method(rb_cDBM, "reject", fdbm_reject, 0);
rb_define_method(rb_cDBM, "clear", fdbm_clear, 0);
- rb_define_method(rb_cDBM,"invert", fdbm_invert, 0);
- rb_define_method(rb_cDBM,"update", fdbm_update, 1);
- rb_define_method(rb_cDBM,"replace", fdbm_replace, 1);
+ rb_define_method(rb_cDBM, "invert", fdbm_invert, 0);
+ rb_define_method(rb_cDBM, "update", fdbm_update, 1);
+ rb_define_method(rb_cDBM, "replace", fdbm_replace, 1);
rb_define_method(rb_cDBM, "include?", fdbm_has_key, 1);
rb_define_method(rb_cDBM, "has_key?", fdbm_has_key, 1);
@@ -1019,24 +1087,50 @@ Init_dbm(void)
*/
rb_define_const(rb_cDBM, "NEWDB", INT2FIX(O_RDWR|O_CREAT|O_TRUNC|RUBY_DBM_RW_BIT));
-#if defined(HAVE_DB_VERSION)
- /* The version of the dbm library, if using Berkeley DB */
- rb_define_const(rb_cDBM, "VERSION", rb_str_new2(db_version(NULL, NULL, NULL)));
-#elif defined(HAVE_GDBM_VERSION)
- /* since gdbm 1.9 */
- rb_define_const(rb_cDBM, "VERSION", rb_str_new2(gdbm_version));
-#elif defined(HAVE_LIBVAR_GDBM_VERSION)
- /* ndbm.h doesn't declare gdbm_version until gdbm 1.8.3.
- * See extconf.rb for more information. */
{
- RUBY_EXTERN char *gdbm_version;
- rb_define_const(rb_cDBM, "VERSION", rb_str_new2(gdbm_version));
- }
-#elif defined(HAVE_DPVERSION)
- rb_define_const(rb_cDBM, "VERSION", rb_sprintf("QDBM %s", dpversion));
-#elif defined(_DB_H_)
- rb_define_const(rb_cDBM, "VERSION", rb_str_new2("Berkeley DB (unknown)"));
+ VALUE version;
+#if defined(_DBM_IOERR)
+ version = rb_str_new2("ndbm (4.3BSD)");
+#elif defined(RUBYDBM_GDBM_HEADER)
+# if defined(HAVE_DECLARED_LIBVAR_GDBM_VERSION)
+ /* since gdbm 1.9 */
+ version = rb_str_new2(gdbm_version);
+# elif defined(HAVE_UNDECLARED_LIBVAR_GDBM_VERSION)
+ /* ndbm.h doesn't declare gdbm_version until gdbm 1.8.3.
+ * See extconf.rb for more information. */
+ RUBY_EXTERN char *gdbm_version;
+ version = rb_str_new2(gdbm_version);
+# else
+ version = rb_str_new2("GDBM (unknown)");
+# endif
+#elif defined(RUBYDBM_DB_HEADER)
+# if defined(HAVE_DB_VERSION)
+ /* The version of the dbm library, if using Berkeley DB */
+ version = rb_str_new2(db_version(NULL, NULL, NULL));
+# else
+ version = rb_str_new2("Berkeley DB (unknown)");
+# endif
+#elif defined(_RELIC_H)
+# if defined(HAVE_DPVERSION)
+ version = rb_sprintf("QDBM %s", dpversion);
+# else
+ version = rb_str_new2("QDBM (unknown)");
+# endif
#else
- rb_define_const(rb_cDBM, "VERSION", rb_str_new2("unknown"));
+ version = rb_str_new2("ndbm (unknown)");
#endif
+ /*
+ * Identifies ndbm library version.
+ *
+ * Examples:
+ *
+ * - "ndbm (4.3BSD)"
+ * - "Berkeley DB 4.8.30: (April 9, 2010)"
+ * - "Berkeley DB (unknown)" (4.4BSD, maybe)
+ * - "GDBM version 1.8.3. 10/15/2002 (built Jul 1 2011 12:32:45)"
+ * - "QDBM 1.8.78"
+ *
+ */
+ rb_define_const(rb_cDBM, "VERSION", version);
+ }
}
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 bedd1131f0..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")
@@ -5,21 +22,20 @@ dir_config("dbm")
if dblib = with_config("dbm-type", nil)
dblib = dblib.split(/[ ,]+/)
else
- dblib = %w(libc db db2 db1 db5 db4 db3 dbm gdbm gdbm_compat qdbm)
+ dblib = %w(libc db db2 db1 db5 db4 db3 gdbm_compat gdbm qdbm)
end
headers = {
- "libc" => ["ndbm.h"], # 4.4BSD libc contains Berkeley DB 1.
+ "libc" => ["ndbm.h"], # 4.3BSD original ndbm, Berkeley DB 1 in 4.4BSD libc.
"db" => ["db.h"],
"db1" => ["db1/ndbm.h", "db1.h", "ndbm.h"],
"db2" => ["db2/db.h", "db2.h", "db.h"],
"db3" => ["db3/db.h", "db3.h", "db.h"],
"db4" => ["db4/db.h", "db4.h", "db.h"],
"db5" => ["db5/db.h", "db5.h", "db.h"],
- "dbm" => ["ndbm.h"], # traditional ndbm (4.3BSD)
- "gdbm" => ["gdbm-ndbm.h", "ndbm.h", "gdbm/ndbm.h"], # gdbm until 1.8.0
- "gdbm_compat" => ["gdbm-ndbm.h", "ndbm.h", "gdbm/ndbm.h"], # gdbm since 1.8.1
- "qdbm" => ["relic.h", "qdbm/relic.h"],
+ "gdbm_compat" => ["gdbm-ndbm.h", "gdbm/ndbm.h", "ndbm.h"], # GDBM since 1.8.1
+ "gdbm" => ["gdbm-ndbm.h", "gdbm/ndbm.h", "ndbm.h"], # GDBM until 1.8.0
+ "qdbm" => ["qdbm/relic.h", "relic.h"],
}
class << headers
@@ -40,184 +56,35 @@ def headers.db_check(db, hdr)
result
end
-# BEGIN BACKPORTED FROM 2.0
-class String
- # Wraps a string in escaped quotes if it contains whitespace.
- def quote
- /\s/ =~ self ? "\"#{self}\"" : "#{self}"
- end
-
- # Generates a string used as cpp macro name.
- def tr_cpp
- strip.upcase.tr_s("^A-Z0-9_*", "_").tr_s("*", "P")
- end
-
- def funcall_style
- /\)\z/ =~ self ? dup : "#{self}()"
- end
-
- def sans_arguments
- self[/\A[^()]+/]
+def have_declared_libvar(var, headers = nil, opt = "", &b)
+ checking_for checking_message([*var].compact.join(' '), headers, opt) do
+ try_declared_libvar(var, headers, opt, &b)
end
end
- def rm_f(*files)
- opt = (Hash === files.last ? [files.pop] : [])
- FileUtils.rm_f(Dir[*files.flatten], *opt)
- end
-
- def try_func(func, libs, headers = nil, opt = "", &b)
- headers = cpp_include(headers)
- case func
- when /^&/
- decltype = proc {|x|"const volatile void *#{x}"}
- when /\)$/
- call = func
- else
- call = "#{func}()"
- decltype = proc {|x| "void ((*#{x})())"}
- end
- if opt and !opt.empty?
- [[:to_str], [:join, " "], [:to_s]].each do |meth, *args|
- if opt.respond_to?(meth)
- break opt = opt.send(meth, *args)
- end
- end
- opt = "#{opt} #{libs}"
- else
- opt = libs
- end
- decltype && try_link(<<"SRC", opt, &b) or
-#{headers}
-/*top*/
-#{MAIN_DOES_NOTHING}
-extern int t(void);
-int t(void) { #{decltype["volatile p"]}; p = (#{decltype[]})#{func}; return 0; }
-SRC
- call && try_link(<<"SRC", opt, &b)
-#{headers}
-/*top*/
-#{MAIN_DOES_NOTHING}
-extern int t(void);
-int t(void) { #{call}; return 0; }
-SRC
- end
-
- def try_var(var, headers = nil, opt = "", &b)
- headers = cpp_include(headers)
- try_compile(<<"SRC", opt, &b)
-#{headers}
+def try_declared_libvar(var, headers = nil, opt = "", &b)
+ if try_link(<<"SRC", opt, &b)
+#{cpp_include(headers)}
/*top*/
-#{MAIN_DOES_NOTHING}
-extern int t(void);
-int t(void) { const volatile void *volatile p; p = &(&#{var})[0]; return 0; }
+int main(int argc, char *argv[]) {
+ void *conftest_var = &#{var};
+ return 0;
+}
SRC
+ $defs.push(format("-DHAVE_DECLARED_LIBVAR_%s", var.tr_cpp))
+ true
+ else
+ false
end
+end
- def have_library(lib, func = nil, headers = nil, opt = "", &b)
- func = "main" if !func or func.empty?
- lib = with_config(lib+'lib', lib)
- checking_for checking_message(func.funcall_style, LIBARG%lib, opt) do
- if COMMON_LIBS.include?(lib)
- true
- else
- libs = append_library($libs, lib)
- if try_func(func, libs, headers, opt, &b)
- $libs = libs
- true
- else
- false
- end
- end
- end
- end
-
- def have_func(func, headers = nil, opt = "", &b)
- checking_for checking_message(func.funcall_style, headers, opt) do
- if try_func(func, $libs, headers, opt, &b)
- $defs << "-DHAVE_#{func.sans_arguments.tr_cpp}"
- true
- else
- false
- end
- end
- end
-
- def have_var(var, headers = nil, opt = "", &b)
- checking_for checking_message(var, headers, opt) do
- if try_var(var, headers, opt, &b)
- $defs.push(format("-DHAVE_%s", var.tr_cpp))
- true
- else
- false
- end
- end
- end
-
- def try_cpp(src, opt="", *opts, &b)
- try_do(src, cpp_command(CPPOUTFILE, opt), *opts, &b)
- ensure
- rm_f "conftest*"
- end
-
- alias :try_header :try_cpp
-
- def have_header(header, preheaders = nil, opt = "", &b)
- checking_for header do
- if try_header(cpp_include(preheaders)+cpp_include(header), opt, &b)
- $defs.push(format("-DHAVE_%s", header.tr_cpp))
- true
- else
- false
- end
- end
- end
-
- def convertible_int(type, headers = nil, opts = nil, &b)
- type, macname = *type
- checking_for("convertible type of #{type}", STRING_OR_FAILED_FORMAT) do
- if UNIVERSAL_INTS.include?(type)
- type
- else
- typedef, member, prelude = typedef_expr(type, headers, &b)
- if member
- prelude << "static rbcv_typedef_ rbcv_var;"
- compat = UNIVERSAL_INTS.find {|t|
- try_static_assert("sizeof(rbcv_var.#{member}) == sizeof(#{t})", [prelude], opts, &b)
- }
- else
- next unless signed = try_signedness(typedef, member, [prelude])
- u = "unsigned " if signed > 0
- prelude << "extern rbcv_typedef_ foo();"
- compat = UNIVERSAL_INTS.find {|t|
- try_compile([prelude, "extern #{u}#{t} foo();"].join("\n"), opts, :werror=>true, &b)
- }
- end
- if compat
- macname ||= type.sub(/_(?=t\z)/, '').tr_cpp
- conv = (compat == "long long" ? "LL" : compat.upcase)
- compat = "#{u}#{compat}"
- typename = type.tr_cpp
- $defs.push(format("-DSIZEOF_%s=SIZEOF_%s", typename, compat.tr_cpp))
- $defs.push(format("-DTYPEOF_%s=%s", typename, compat.quote))
- $defs.push(format("-DPRI_%s_PREFIX=PRI_%s_PREFIX", macname, conv))
- conv = (u ? "U" : "") + conv
- $defs.push(format("-D%s2NUM=%s2NUM", macname, conv))
- $defs.push(format("-DNUM2%s=NUM2%s", macname, conv))
- compat
- end
- end
- end
- end
-# END BACKPORTED FROM 2.0
-
-def have_libvar(var, headers = nil, opt = "", &b)
+def have_undeclared_libvar(var, headers = nil, opt = "", &b)
checking_for checking_message([*var].compact.join(' '), headers, opt) do
- try_libvar(var, headers, opt, &b)
+ try_undeclared_libvar(var, headers, opt, &b)
end
end
-def try_libvar(var, headers = nil, opt = "", &b)
+def try_undeclared_libvar(var, headers = nil, opt = "", &b)
var, type = *var
if try_link(<<"SRC", opt, &b)
#{cpp_include(headers)}
@@ -229,7 +96,26 @@ int main(int argc, char *argv[]) {
return 0;
}
SRC
- $defs.push(format("-DHAVE_LIBVAR_%s", var.tr_cpp))
+ $defs.push(format("-DHAVE_UNDECLARED_LIBVAR_%s", var.tr_cpp))
+ true
+ else
+ false
+ end
+end
+
+def have_empty_macro_dbm_clearerr(headers = nil, opt = "", &b)
+ checking_for checking_message('empty macro of dbm_clearerr(foobarbaz)',
+ headers, opt) do
+ try_toplevel('dbm_clearerr(foobarbaz)', headers, opt, &b)
+ end
+end
+
+def try_toplevel(src, headers = nil, opt = "", &b)
+ if try_compile(<<"SRC", opt, &b)
+#{cpp_include(headers)}
+/*top*/
+#{src}
+SRC
true
else
false
@@ -238,6 +124,9 @@ end
def headers.db_check2(db, hdr)
+ $defs.push(%{-DRUBYDBM_DBM_HEADER='"#{hdr}"'})
+ $defs.push(%{-DRUBYDBM_DBM_TYPE='"#{db}"'})
+
hsearch = nil
case db
@@ -247,33 +136,129 @@ def headers.db_check2(db, hdr)
have_library("gdbm") or return false
end
- if have_type("DBM", hdr, hsearch) and
- (db == 'libc' ? have_func('dbm_open("", 0, 0)', hdr, hsearch) :
- have_library(db, 'dbm_open("", 0, 0)', hdr, hsearch)) and
- have_func('dbm_clearerr((DBM *)0)', hdr, hsearch) and
- (/\Adb\d?\z/ =~ db || db == 'libc' || !have_macro('_DB_H_', hdr, hsearch)) # _DB_H_ should not be defined except Berkeley DB.
- case db
- when /\Adb\d?\z/
- have_func('db_version((int *)0, (int *)0, (int *)0)', hdr, hsearch)
- when /\Agdbm/
- have_var("gdbm_version", hdr, hsearch)
- # gdbm_version is not declared by ndbm.h until gdbm 1.8.3.
- # We can't include ndbm.h and gdbm.h because they both define datum type.
- # ndbm.h includes gdbm.h and gdbm_version is declared since gdbm 1.9.
- have_libvar(["gdbm_version", "char *"], hdr, hsearch)
- when /\Aqdbm\z/
- have_var("dpversion", hdr, hsearch)
+ if !have_type("DBM", hdr, hsearch)
+ return false
+ end
+
+ # 'libc' means ndbm is provided by libc.
+ # 4.3BSD original ndbm is contained in libc.
+ # 4.4BSD (and its derivatives such as NetBSD) contains Berkeley DB 1 in libc.
+ if !(db == 'libc' ? have_func('dbm_open("", 0, 0)', hdr, hsearch) :
+ have_library(db, 'dbm_open("", 0, 0)', hdr, hsearch))
+ return false
+ end
+
+ # Skip a mismatch of Berkeley DB's ndbm.h and old GDBM library.
+ #
+ # dbm_clearerr() should be available for any ndbm implementation.
+ # It is available since the original (4.3BSD) ndbm and standardized by POSIX.
+ #
+ # However "can't resolve symbol 'dbm_clearerr'" problem may be caused by
+ # header/library mismatch: Berkeley DB ndbm.h and GDBM library until 1.8.3.
+ # GDBM (until 1.8.3) provides dbm_clearerr() as a empty macro in the header
+ # and the library don't provide dbm_clearerr().
+ # Berkeley DB provides dbm_clearerr() as a usual function.
+ # So Berkeley DB header with GDBM library causes the problem.
+ #
+ if !have_func('dbm_clearerr((DBM *)0)', hdr, hsearch)
+ return false
+ end
+
+ # Berkeley DB's ndbm.h (since 1.85 at least) defines DBM_SUFFIX.
+ # Note that _DB_H_ is not defined on Mac OS X because
+ # it uses Berkeley DB 1 but ndbm.h doesn't include db.h.
+ have_db_header = have_macro('DBM_SUFFIX', hdr, hsearch)
+
+ # Old GDBM's ndbm.h, until 1.8.3, defines dbm_clearerr as a macro which
+ # expands to no tokens.
+ have_gdbm_header1 = have_empty_macro_dbm_clearerr(hdr, hsearch)
+
+ # Recent GDBM's ndbm.h, since 1.9, includes gdbm.h and it defines _GDBM_H_.
+ # ndbm compatibility layer of GDBM is provided by libgdbm (until 1.8.0)
+ # and libgdbm_compat (since 1.8.1).
+ have_gdbm_header2 = have_macro('_GDBM_H_', hdr, hsearch)
+
+ # 4.3BSD's ndbm.h defines _DBM_IOERR.
+ # The original ndbm is provided by libc in 4.3BSD.
+ have_ndbm_header = have_macro('_DBM_IOERR', hdr, hsearch)
+
+ # GDBM provides ndbm functions in libgdbm_compat since GDBM 1.8.1.
+ # GDBM's ndbm.h defines _GDBM_H_ since GDBM 1.9.
+ # If _GDBM_H_ is defined, 'gdbm_compat' is required and reject 'gdbm'.
+ if have_gdbm_header2 && db == 'gdbm'
+ return false
+ end
+
+ if have_db_header
+ $defs.push('-DRUBYDBM_DB_HEADER')
+ end
+
+ have_gdbm_header = have_gdbm_header1 | have_gdbm_header2
+ if have_gdbm_header
+ $defs.push('-DRUBYDBM_GDBM_HEADER')
+ end
+
+ # ndbm.h is provided by the original (4.3BSD) ndbm,
+ # Berkeley DB 1 in libc of 4.4BSD and
+ # ndbm compatibility layer of GDBM.
+ # So, try to check header/library mismatch.
+ #
+ # Several (possibly historical) distributions provides libndbm.
+ # It may be Berkeley DB, GDBM or 4.3BSD ndbm.
+ # So mismatch check is not performed for that.
+ # Note that libndbm is searched only when --with-dbm-type=ndbm is
+ # given for configure.
+ #
+ if hdr == 'ndbm.h' && db != 'libc' && db != 'ndbm'
+ if /\Adb\d?\z/ !~ db && have_db_header
+ return false
end
- if hsearch
- $defs << hsearch
- @defs = hsearch
+
+ if /\Agdbm/ !~ db && have_gdbm_header
+ return false
+ end
+
+ if have_ndbm_header
+ return false
end
- $defs << '-DDBM_HDR="<'+hdr+'>"'
- @found << hdr
- true
- else
- false
end
+
+ # Berkeley DB
+ have_func('db_version((int *)0, (int *)0, (int *)0)', hdr, hsearch)
+
+ # GDBM
+ have_gdbm_version = have_declared_libvar("gdbm_version", hdr, hsearch)
+ # gdbm_version is available since very old version (GDBM 1.5 at least).
+ # However it is not declared by ndbm.h until GDBM 1.8.3.
+ # We can't include both ndbm.h and gdbm.h because they both define datum type.
+ # ndbm.h includes gdbm.h and gdbm_version is declared since GDBM 1.9.
+ have_gdbm_version |= have_undeclared_libvar(["gdbm_version", "char *"], hdr, hsearch)
+
+ # QDBM
+ have_var("dpversion", hdr, hsearch)
+
+ # detect mismatch between GDBM header and other library.
+ # If GDBM header is included, GDBM library should be linked.
+ if have_gdbm_header && !have_gdbm_version
+ return false
+ end
+
+ # DBC type is required to disable error messages by Berkeley DB 2 or later.
+ if have_db_header
+ have_type("DBC", hdr, hsearch)
+ end
+
+ if hsearch
+ $defs << hsearch
+ @defs = hsearch
+ end
+ $defs << '-DDBM_HDR="<'+hdr+'>"'
+ @found << hdr
+
+ puts "header: #{hdr}"
+ puts "library: #{db}"
+
+ true
end
if dblib.any? {|db| headers.fetch(db, ["ndbm.h"]).any? {|hdr| headers.db_check(db, hdr) } }
@@ -284,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 956f47ff78..527d0ed1fe 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
@@ -99,7 +115,7 @@ hexencode_str_new(VALUE str_digest)
rb_raise(rb_eRuntimeError, "digest string too long");
}
- str = rb_str_new(0, digest_len * 2);
+ str = rb_usascii_str_new(0, digest_len * 2);
for (i = 0, p = RSTRING_PTR(str); i < digest_len; i++) {
unsigned char byte = digest[i];
@@ -154,6 +170,8 @@ static VALUE
rb_digest_instance_update(VALUE self, VALUE str)
{
rb_digest_instance_method_unimpl(self, "update");
+
+ UNREACHABLE;
}
/*
@@ -172,6 +190,8 @@ static VALUE
rb_digest_instance_finish(VALUE self)
{
rb_digest_instance_method_unimpl(self, "finish");
+
+ UNREACHABLE;
}
/*
@@ -186,6 +206,8 @@ static VALUE
rb_digest_instance_reset(VALUE self)
{
rb_digest_instance_method_unimpl(self, "reset");
+
+ UNREACHABLE;
}
/*
@@ -409,6 +431,8 @@ static VALUE
rb_digest_instance_block_length(VALUE self)
{
rb_digest_instance_method_unimpl(self, "block_length");
+
+ UNREACHABLE;
}
/*
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
index 470b0226d4..3883badc45 100644
--- a/ext/digest/lib/digest/hmac.rb
+++ b/ext/digest/lib/digest/hmac.rb
@@ -41,7 +41,7 @@ module Digest
# hmac.update(buf)
# end
#
- # puts hmac.bubblebabble
+ # puts hmac.hexdigest
#
class HMAC < Digest::Class
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/extconf.rb b/ext/digest/md5/extconf.rb
index 006aa2ee36..5a57fd3eea 100644
--- a/ext/digest/md5/extconf.rb
+++ b/ext/digest/md5/extconf.rb
@@ -1,3 +1,4 @@
+# -*- coding: us-ascii -*-
# $RoughId: extconf.rb,v 1.3 2001/08/14 19:54:51 knu Exp $
# $Id$
@@ -10,9 +11,10 @@ $objs = [ "md5init.#{$OBJEXT}" ]
dir_config("openssl")
pkg_config("openssl")
+require File.expand_path('../../../openssl/deprecation', __FILE__)
if !with_config("bundled-md5") &&
- have_library("crypto") && have_header("openssl/md5.h")
+ have_library("crypto") && OpenSSL.check_func("MD5_Transform", "openssl/md5.h")
$objs << "md5ossl.#{$OBJEXT}"
else
diff --git a/ext/digest/md5/md5.c b/ext/digest/md5/md5.c
index 518f8239ed..8d7d33c5a6 100644
--- a/ext/digest/md5/md5.c
+++ b/ext/digest/md5/md5.c
@@ -368,7 +368,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. */
diff --git a/ext/digest/md5/md5init.c b/ext/digest/md5/md5init.c
index d1229b5c6e..3591782f6e 100644
--- a/ext/digest/md5/md5init.c
+++ b/ext/digest/md5/md5init.c
@@ -30,6 +30,9 @@ Init_md5()
rb_require("digest");
+#if 0
+ mDigest = rb_define_module("Digest"); /* let rdoc know */
+#endif
mDigest = rb_path2class("Digest");
cDigest_Base = rb_path2class("Digest::Base");
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/extconf.rb b/ext/digest/rmd160/extconf.rb
index 0805b719c3..d487d6da80 100644
--- a/ext/digest/rmd160/extconf.rb
+++ b/ext/digest/rmd160/extconf.rb
@@ -1,3 +1,4 @@
+# -*- coding: us-ascii -*-
# $RoughId: extconf.rb,v 1.3 2001/08/14 19:54:51 knu Exp $
# $Id$
@@ -10,9 +11,10 @@ $objs = [ "rmd160init.#{$OBJEXT}" ]
dir_config("openssl")
pkg_config("openssl")
+require File.expand_path('../../../openssl/deprecation', __FILE__)
if !with_config("bundled-rmd160") &&
- have_library("crypto") && have_header("openssl/ripemd.h")
+ have_library("crypto") && OpenSSL.check_func("RMD160_Transform", "openssl/ripemd.h")
$objs << "rmd160ossl.#{$OBJEXT}"
else
$objs << "rmd160.#{$OBJEXT}"
diff --git a/ext/digest/rmd160/rmd160.c b/ext/digest/rmd160/rmd160.c
index 88918728cd..bac77833b1 100644
--- a/ext/digest/rmd160/rmd160.c
+++ b/ext/digest/rmd160/rmd160.c
@@ -362,16 +362,20 @@ RMD160_Update(RMD160_CTX *context, const uint8_t *data, size_t nbytes)
_DIAGASSERT(data != NULL);
/* update length[] */
+#if SIZEOF_SIZE_T * CHAR_BIT > 32
+ context->length[1] += (uint32_t)((context->length[0] + nbytes) >> 32);
+#else
if (context->length[0] + nbytes < context->length[0])
context->length[1]++; /* overflow to msb of length */
- context->length[0] += nbytes;
+#endif
+ context->length[0] += (uint32_t)nbytes;
(void)memset(X, 0, sizeof(X));
if ( context->buflen + nbytes < 64 )
{
(void)memcpy(context->bbuffer + context->buflen, data, nbytes);
- context->buflen += nbytes;
+ context->buflen += (uint32_t)nbytes;
}
else
{
@@ -401,7 +405,7 @@ RMD160_Update(RMD160_CTX *context, const uint8_t *data, size_t nbytes)
/*
* Put last bytes from data into context's buffer
*/
- context->buflen = nbytes & 63;
+ context->buflen = (uint32_t)nbytes & 63;
memcpy(context->bbuffer, data + (64 * i) + ofs, context->buflen);
}
}
diff --git a/ext/digest/rmd160/rmd160init.c b/ext/digest/rmd160/rmd160init.c
index 0839f1b820..c214ca9f33 100644
--- a/ext/digest/rmd160/rmd160init.c
+++ b/ext/digest/rmd160/rmd160init.c
@@ -30,6 +30,9 @@ Init_rmd160()
rb_require("digest");
+#if 0
+ mDigest = rb_define_module("Digest"); /* let rdoc know */
+#endif
mDigest = rb_path2class("Digest");
cDigest_Base = rb_path2class("Digest::Base");
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/extconf.rb b/ext/digest/sha1/extconf.rb
index e55965d980..d7e52fe731 100644
--- a/ext/digest/sha1/extconf.rb
+++ b/ext/digest/sha1/extconf.rb
@@ -1,3 +1,4 @@
+# -*- coding: us-ascii -*-
# $RoughId: extconf.rb,v 1.3 2001/08/14 19:54:51 knu Exp $
# $Id$
@@ -10,9 +11,10 @@ $objs = [ "sha1init.#{$OBJEXT}" ]
dir_config("openssl")
pkg_config("openssl")
+require File.expand_path('../../../openssl/deprecation', __FILE__)
if !with_config("bundled-sha1") &&
- have_library("crypto") && have_header("openssl/sha.h")
+ have_library("crypto") && OpenSSL.check_func("SHA1_Transform", "openssl/sha.h")
$objs << "sha1ossl.#{$OBJEXT}"
else
$objs << "sha1.#{$OBJEXT}"
diff --git a/ext/digest/sha1/sha1init.c b/ext/digest/sha1/sha1init.c
index 06e7378950..d52eef58b3 100644
--- a/ext/digest/sha1/sha1init.c
+++ b/ext/digest/sha1/sha1init.c
@@ -30,6 +30,9 @@ Init_sha1()
rb_require("digest");
+#if 0
+ mDigest = rb_define_module("Digest"); /* let rdoc know */
+#endif
mDigest = rb_path2class("Digest");
cDigest_Base = rb_path2class("Digest::Base");
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/extconf.rb b/ext/digest/sha2/extconf.rb
index 025f1bac64..5ab2d35af5 100644
--- a/ext/digest/sha2/extconf.rb
+++ b/ext/digest/sha2/extconf.rb
@@ -1,3 +1,4 @@
+# -*- coding: us-ascii -*-
# $RoughId: extconf.rb,v 1.4 2001/08/14 19:54:51 knu Exp $
# $Id$
@@ -10,10 +11,11 @@ $objs = [ "sha2init.#{$OBJEXT}" ]
dir_config("openssl")
pkg_config("openssl")
+require File.expand_path('../../../openssl/deprecation', __FILE__)
if !with_config("bundled-sha2") &&
have_library("crypto") &&
- %w[SHA256 SHA512].all? {|d| have_func("#{d}_Transform", "openssl/sha.h")} &&
+ %w[SHA256 SHA512].all? {|d| OpenSSL.check_func("#{d}_Transform", "openssl/sha.h")} &&
%w[SHA256 SHA512].all? {|d| have_type("#{d}_CTX", "openssl/sha.h")}
$objs << "sha2ossl.#{$OBJEXT}"
$defs << "-DSHA2_USE_OPENSSL"
diff --git a/ext/digest/sha2/lib/sha2.rb b/ext/digest/sha2/lib/sha2.rb
index 3c5bf0c863..58d12e9b09 100644
--- a/ext/digest/sha2/lib/sha2.rb
+++ b/ext/digest/sha2/lib/sha2.rb
@@ -68,11 +68,11 @@ module Digest
#
# Returns the block length of the digest in bytes.
#
- # Digest::SHA256.new.digest_length * 8
+ # Digest::SHA256.new.block_length * 8
# # => 512
- # Digest::SHA384.new.digest_length * 8
+ # Digest::SHA384.new.block_length * 8
# # => 1024
- # Digest::SHA512.new.digest_length * 8
+ # Digest::SHA512.new.block_length * 8
# # => 1024
def block_length
@sha2.block_length
diff --git a/ext/digest/sha2/sha2.c b/ext/digest/sha2/sha2.c
index 0566b93cb7..3457790eea 100644
--- a/ext/digest/sha2/sha2.c
+++ b/ext/digest/sha2/sha2.c
@@ -138,7 +138,7 @@ typedef u_int64_t sha2_word64; /* Exactly 8 bytes */
#define REVERSE32(w,x) { \
sha2_word32 tmp = (w); \
tmp = (tmp >> 16) | (tmp << 16); \
- (x) = ((tmp & 0xff00ff00UL) >> 8) | ((tmp & 0x00ff00ffUL) << 8); \
+ (x) = ((tmp & (sha2_word32)0xff00ff00UL) >> 8) | ((tmp & (sha2_word32)0x00ff00ffUL) << 8); \
}
#define REVERSE64(w,x) { \
sha2_word64 tmp = (w); \
@@ -613,7 +613,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);
@@ -633,7 +634,7 @@ void SHA256_Final(sha2_byte digest[], SHA256_CTX* context) {
}
/* Clean up state data: */
- MEMSET_BZERO(context, sizeof(context));
+ MEMSET_BZERO(context, sizeof(*context));
usedspace = 0;
}
@@ -653,7 +654,7 @@ char *SHA256_End(SHA256_CTX* context, char buffer[]) {
}
*buffer = (char)0;
} else {
- MEMSET_BZERO(context, sizeof(context));
+ MEMSET_BZERO(context, sizeof(*context));
}
MEMSET_BZERO(digest, SHA256_DIGEST_LENGTH);
return buffer;
@@ -930,8 +931,10 @@ 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);
@@ -963,7 +966,7 @@ void SHA512_Final(sha2_byte digest[], SHA512_CTX* context) {
}
/* Zero out state data */
- MEMSET_BZERO(context, sizeof(context));
+ MEMSET_BZERO(context, sizeof(*context));
}
char *SHA512_End(SHA512_CTX* context, char buffer[]) {
@@ -982,7 +985,7 @@ char *SHA512_End(SHA512_CTX* context, char buffer[]) {
}
*buffer = (char)0;
} else {
- MEMSET_BZERO(context, sizeof(context));
+ MEMSET_BZERO(context, sizeof(*context));
}
MEMSET_BZERO(digest, SHA512_DIGEST_LENGTH);
return buffer;
@@ -1037,7 +1040,7 @@ void SHA384_Final(sha2_byte digest[], SHA384_CTX* context) {
}
/* Zero out state data */
- MEMSET_BZERO(context, sizeof(context));
+ MEMSET_BZERO(context, sizeof(*context));
}
char *SHA384_End(SHA384_CTX* context, char buffer[]) {
@@ -1056,7 +1059,7 @@ char *SHA384_End(SHA384_CTX* context, char buffer[]) {
}
*buffer = (char)0;
} else {
- MEMSET_BZERO(context, sizeof(context));
+ MEMSET_BZERO(context, sizeof(*context));
}
MEMSET_BZERO(digest, SHA384_DIGEST_LENGTH);
return buffer;
diff --git a/ext/digest/sha2/sha2ossl.c b/ext/digest/sha2/sha2ossl.c
index 86824e72f4..34353be8b8 100644
--- a/ext/digest/sha2/sha2ossl.c
+++ b/ext/digest/sha2/sha2ossl.c
@@ -4,7 +4,9 @@
#define SHA_Finish(bit) \
void SHA##bit##_Finish(SHA##bit##_CTX *ctx, char *buf) \
{ SHA##bit##_Final((unsigned char *)buf, ctx);}
+#ifndef __DragonFly__
#define SHA384_Final SHA512_Final
+#endif
SHA_Finish(256)
SHA_Finish(384)
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/mkcallback.rb b/ext/dl/callback/mkcallback.rb
index d14072a932..e94a196247 100644
--- a/ext/dl/callback/mkcallback.rb
+++ b/ext/dl/callback/mkcallback.rb
@@ -121,28 +121,24 @@ def foreach_proc_entry
end
def gencallback(ty, calltype, proc_entry, argc, n)
- <<-EOS
+ dltype = DLTYPE[ty]
+ ret = dltype[:conv]
+ src = <<-EOS
#{calltype == STDCALL ? "\n#ifdef FUNC_STDCALL" : ""}
-static #{DLTYPE[ty][:type]}
-FUNC_#{calltype.upcase}(#{func_name(ty,argc,n,calltype)})(#{(0...argc).collect{|i| "DLSTACK_TYPE stack" + i.to_s}.join(", ")})
+static #{dltype[:type]}
+FUNC_#{calltype.upcase}(#{func_name(ty,argc,n,calltype)})(#{(0...argc).collect{|i| "DLSTACK_TYPE stack#{i}"}.join(", ")})
{
- VALUE ret, cb#{argc > 0 ? ", args[#{argc}]" : ""};
+ VALUE #{ret ? "ret, " : ""}cb#{argc > 0 ? ", args[#{argc}]" : ""};
#{
- sizeof_voidp = [""].pack('p').size
- sizeof_long = [0].pack('l!').size
(0...argc).collect{|i|
- if sizeof_voidp == sizeof_long
- " args[%d] = LONG2NUM(stack%d);" % [i,i]
- elsif sizeof_voidp == 8 # should get sizeof_long_long...
- " args[%d] = LL2NUM(stack%d);" % [i,i]
- else
- raise "unknown size of void*"
- end
- }.join("\n")
+ "\n args[#{i}] = PTR2NUM(stack#{i});"
+ }.join("")
}
cb = rb_ary_entry(rb_ary_entry(#{proc_entry}, #{ty}), #{(n * DLSTACK_SIZE) + argc});
- ret = rb_funcall2(cb, rb_dl_cb_call, #{argc}, #{argc > 0 ? 'args' : 'NULL'});
- return #{DLTYPE[ty][:conv] ? DLTYPE[ty][:conv] % "ret" : ""};
+ #{ret ? "ret = " : ""}rb_funcall2(cb, rb_dl_cb_call, #{argc}, #{argc > 0 ? 'args' : 'NULL'});
+ EOS
+ src << " return #{ret % "ret"};\n" if ret
+ src << <<-EOS
}
#{calltype == STDCALL ? "#endif\n" : ""}
EOS
diff --git a/ext/dl/cfunc.c b/ext/dl/cfunc.c
index 8edf102210..1f4958bbdc 100644
--- a/ext/dl/cfunc.c
+++ b/ext/dl/cfunc.c
@@ -2,7 +2,8 @@
* $Id$
*/
-#include <ruby.h>
+#include <ruby/ruby.h>
+#include <ruby/util.h>
#include <errno.h>
#include "dl.h"
@@ -85,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;
@@ -284,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
@@ -343,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);
@@ -366,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);
@@ -636,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 89dcb942c0..9e59139fc9 100644
--- a/ext/dl/cptr.c
+++ b/ext/dl/cptr.c
@@ -63,27 +63,17 @@ static const rb_data_type_t dlptr_data_type = {
{dlptr_mark, dlptr_free, dlptr_memsize,},
};
-void
-dlptr_init(VALUE val)
-{
- struct ptr_data *data;
-
- TypedData_Get_Struct(val, struct ptr_data, &dlptr_data_type, data);
- OBJ_TAINT(val);
-}
-
VALUE
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;
data->size = size;
- dlptr_init(val);
+ OBJ_TAINT(val);
return val;
}
@@ -99,7 +89,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);
@@ -131,7 +120,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;
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 e0617047ec..23f5d7fe6e 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)
*
*/
@@ -17,6 +17,53 @@ VALUE rb_eDLTypeError;
ID rbdl_id_cdecl;
ID rbdl_id_stdcall;
+#ifndef DLTYPE_SSIZE_T
+# if SIZEOF_SIZE_T == SIZEOF_INT
+# define DLTYPE_SSIZE_T DLTYPE_INT
+# elif SIZEOF_SIZE_T == SIZEOF_LONG
+# define DLTYPE_SSIZE_T DLTYPE_LONG
+# elif defined HAVE_LONG_LONG && SIZEOF_SIZE_T == SIZEOF_LONG_LONG
+# define DLTYPE_SSIZE_T DLTYPE_LONG_LONG
+# endif
+#endif
+#define DLTYPE_SIZE_T (-1*SIGNEDNESS_OF_SIZE_T*DLTYPE_SSIZE_T)
+
+#ifndef DLTYPE_PTRDIFF_T
+# if SIZEOF_PTRDIFF_T == SIZEOF_INT
+# define DLTYPE_PTRDIFF_T DLTYPE_INT
+# elif SIZEOF_PTRDIFF_T == SIZEOF_LONG
+# define DLTYPE_PTRDIFF_T DLTYPE_LONG
+# elif defined HAVE_LONG_LONG && SIZEOF_PTRDIFF_T == SIZEOF_LONG_LONG
+# define DLTYPE_PTRDIFF_T DLTYPE_LONG_LONG
+# endif
+#endif
+
+#ifndef DLTYPE_INTPTR_T
+# if SIZEOF_INTPTR_T == SIZEOF_INT
+# define DLTYPE_INTPTR_T DLTYPE_INT
+# elif SIZEOF_INTPTR_T == SIZEOF_LONG
+# define DLTYPE_INTPTR_T DLTYPE_LONG
+# elif defined HAVE_LONG_LONG && SIZEOF_INTPTR_T == SIZEOF_LONG_LONG
+# define DLTYPE_INTPTR_T DLTYPE_LONG_LONG
+# endif
+#endif
+#define DLTYPE_UINTPTR_T (-DLTYPE_INTPTR_T)
+
+/*
+ * call-seq: DL.dlopen(so_lib)
+ *
+ * An interface to the dynamic linking loader
+ *
+ * This is a shortcut to DL::Handle.new and takes the same arguments.
+ *
+ * Example:
+ *
+ * libc_so = "/lib64/libc.so.6"
+ * => "/lib64/libc.so.6"
+ *
+ * libc = DL.dlopen(libc_so)
+ * => #<DL::Handle:0x00000000e05b00>
+ */
VALUE
rb_dl_dlopen(int argc, VALUE argv[], VALUE self)
{
@@ -24,7 +71,7 @@ rb_dl_dlopen(int argc, VALUE argv[], VALUE self)
}
/*
- * call-seq: DL.malloc
+ * call-seq: DL.malloc(size)
*
* Allocate +size+ bytes of memory and return the integer memory address
* for the allocated memory.
@@ -34,7 +81,6 @@ rb_dl_malloc(VALUE self, VALUE size)
{
void *ptr;
- rb_secure(4);
ptr = (void*)ruby_xmalloc(NUM2INT(size));
return PTR2NUM(ptr);
}
@@ -51,7 +97,6 @@ rb_dl_realloc(VALUE self, VALUE addr, VALUE size)
{
void *ptr = NUM2PTR(addr);
- rb_secure(4);
ptr = (void*)ruby_xrealloc(ptr, NUM2INT(size));
return PTR2NUM(ptr);
}
@@ -66,18 +111,45 @@ rb_dl_free(VALUE self, VALUE addr)
{
void *ptr = NUM2PTR(addr);
- rb_secure(4);
ruby_xfree(ptr);
return Qnil;
}
+/*
+ * call-seq: DL.dlunwrap(addr)
+ *
+ * Returns the hexadecimal representation of a memory pointer address +addr+
+ *
+ * Example:
+ *
+ * lib = DL.dlopen('/lib64/libc-2.15.so')
+ * => #<DL::Handle:0x00000001342460>
+ *
+ * lib['strcpy'].to_s(16)
+ * => "7f59de6dd240"
+ *
+ * DL.dlunwrap(DL.dlwrap(lib['strcpy'].to_s(16)))
+ * => "7f59de6dd240"
+ */
VALUE
rb_dl_ptr2value(VALUE self, VALUE addr)
{
- rb_secure(4);
return (VALUE)NUM2PTR(addr);
}
+/*
+ * call-seq: DL.dlwrap(val)
+ *
+ * Returns a memory pointer of a function's hexadecimal address location +val+
+ *
+ * Example:
+ *
+ * lib = DL.dlopen('/lib64/libc-2.15.so')
+ * => #<DL::Handle:0x00000001342460>
+ *
+ * DL.dlwrap(lib['strcpy'].to_s(16))
+ * => 25522520
+ */
VALUE
rb_dl_value2ptr(VALUE self, VALUE val)
{
@@ -271,106 +343,196 @@ Init_dl(void)
*/
rb_define_const(rb_mDL, "TYPE_DOUBLE", INT2NUM(DLTYPE_DOUBLE));
+ /* Document-const: TYPE_SIZE_T
+ *
+ * DL::CFunc type - size_t
+ */
+ rb_define_const(rb_mDL, "TYPE_SIZE_T", INT2NUM(DLTYPE_SIZE_T));
+
+ /* Document-const: TYPE_SSIZE_T
+ *
+ * DL::CFunc type - ssize_t
+ */
+ rb_define_const(rb_mDL, "TYPE_SSIZE_T", INT2NUM(DLTYPE_SSIZE_T));
+
+ /* Document-const: TYPE_PTRDIFF_T
+ *
+ * DL::CFunc type - ptrdiff_t
+ */
+ rb_define_const(rb_mDL, "TYPE_PTRDIFF_T", INT2NUM(DLTYPE_PTRDIFF_T));
+
+ /* Document-const: TYPE_INTPTR_T
+ *
+ * DL::CFunc type - intptr_t
+ */
+ rb_define_const(rb_mDL, "TYPE_INTPTR_T", INT2NUM(DLTYPE_INTPTR_T));
+
+ /* Document-const: TYPE_UINTPTR_T
+ *
+ * DL::CFunc type - uintptr_t
+ */
+ rb_define_const(rb_mDL, "TYPE_UINTPTR_T", INT2NUM(DLTYPE_UINTPTR_T));
+
/* Document-const: ALIGN_VOIDP
*
- * The Offset of a struct void* and a void*
+ * The alignment size of a void*
*/
rb_define_const(rb_mDL, "ALIGN_VOIDP", INT2NUM(ALIGN_VOIDP));
/* Document-const: ALIGN_CHAR
*
- * The Offset of a struct char and a char
+ * The alignment size of a char
*/
rb_define_const(rb_mDL, "ALIGN_CHAR", INT2NUM(ALIGN_CHAR));
/* Document-const: ALIGN_SHORT
*
- * The Offset of a struct short and a short
+ * The alignment size of a short
*/
rb_define_const(rb_mDL, "ALIGN_SHORT", INT2NUM(ALIGN_SHORT));
/* Document-const: ALIGN_INT
*
- * The Offset of a struct int and a int
+ * The alignment size of an int
*/
rb_define_const(rb_mDL, "ALIGN_INT", INT2NUM(ALIGN_INT));
/* Document-const: ALIGN_LONG
*
- * The Offset of a struct long and a long
+ * The alignment size of a long
*/
rb_define_const(rb_mDL, "ALIGN_LONG", INT2NUM(ALIGN_LONG));
#if HAVE_LONG_LONG
/* Document-const: ALIGN_LONG_LONG
*
- * The Offset of a struct long long and a long long
+ * The alignment size of a long long
*/
rb_define_const(rb_mDL, "ALIGN_LONG_LONG", INT2NUM(ALIGN_LONG_LONG));
#endif
/* Document-const: ALIGN_FLOAT
*
- * The Offset of a struct float and a float
+ * The alignment size of a float
*/
rb_define_const(rb_mDL, "ALIGN_FLOAT", INT2NUM(ALIGN_FLOAT));
/* Document-const: ALIGN_DOUBLE
*
- * The Offset of a struct double and a double
+ * The alignment size of a double
*/
rb_define_const(rb_mDL, "ALIGN_DOUBLE",INT2NUM(ALIGN_DOUBLE));
+ /* Document-const: ALIGN_SIZE_T
+ *
+ * The alignment size of a size_t
+ */
+ rb_define_const(rb_mDL, "ALIGN_SIZE_T", INT2NUM(ALIGN_OF(size_t)));
+
+ /* Document-const: ALIGN_SSIZE_T
+ *
+ * The alignment size of a ssize_t
+ */
+ rb_define_const(rb_mDL, "ALIGN_SSIZE_T", INT2NUM(ALIGN_OF(size_t))); /* same as size_t */
+
+ /* Document-const: ALIGN_PTRDIFF_T
+ *
+ * The alignment size of a ptrdiff_t
+ */
+ rb_define_const(rb_mDL, "ALIGN_PTRDIFF_T", INT2NUM(ALIGN_OF(ptrdiff_t)));
+
+ /* Document-const: ALIGN_INTPTR_T
+ *
+ * The alignment size of a intptr_t
+ */
+ rb_define_const(rb_mDL, "ALIGN_INTPTR_T", INT2NUM(ALIGN_OF(intptr_t)));
+
+ /* Document-const: ALIGN_UINTPTR_T
+ *
+ * The alignment size of a uintptr_t
+ */
+ rb_define_const(rb_mDL, "ALIGN_UINTPTR_T", INT2NUM(ALIGN_OF(uintptr_t)));
+
/* Document-const: SIZEOF_VOIDP
*
- * OS Dependent - sizeof(void*)
+ * size of a void*
*/
rb_define_const(rb_mDL, "SIZEOF_VOIDP", INT2NUM(sizeof(void*)));
/* Document-const: SIZEOF_CHAR
*
- * OS Dependent - sizeof(char)
+ * size of a char
*/
rb_define_const(rb_mDL, "SIZEOF_CHAR", INT2NUM(sizeof(char)));
/* Document-const: SIZEOF_SHORT
*
- * OS Dependent - sizeof(short)
+ * size of a short
*/
rb_define_const(rb_mDL, "SIZEOF_SHORT", INT2NUM(sizeof(short)));
/* Document-const: SIZEOF_INT
*
- * OS Dependent - sizeof(int)
+ * size of an int
*/
rb_define_const(rb_mDL, "SIZEOF_INT", INT2NUM(sizeof(int)));
/* Document-const: SIZEOF_LONG
*
- * OS Dependent - sizeof(long)
+ * size of a long
*/
rb_define_const(rb_mDL, "SIZEOF_LONG", INT2NUM(sizeof(long)));
#if HAVE_LONG_LONG
/* Document-const: SIZEOF_LONG_LONG
*
- * OS Dependent - sizeof(long long)
+ * size of a long long
*/
rb_define_const(rb_mDL, "SIZEOF_LONG_LONG", INT2NUM(sizeof(LONG_LONG)));
#endif
/* Document-const: SIZEOF_FLOAT
*
- * OS Dependent - sizeof(float)
+ * size of a float
*/
rb_define_const(rb_mDL, "SIZEOF_FLOAT", INT2NUM(sizeof(float)));
/* Document-const: SIZEOF_DOUBLE
*
- * OS Dependent - sizeof(double)
+ * size of a double
*/
rb_define_const(rb_mDL, "SIZEOF_DOUBLE",INT2NUM(sizeof(double)));
+ /* Document-const: SIZEOF_SIZE_T
+ *
+ * size of a size_t
+ */
+ rb_define_const(rb_mDL, "SIZEOF_SIZE_T", INT2NUM(sizeof(size_t)));
+
+ /* Document-const: SIZEOF_SSIZE_T
+ *
+ * size of a ssize_t
+ */
+ rb_define_const(rb_mDL, "SIZEOF_SSIZE_T", INT2NUM(sizeof(size_t))); /* same as size_t */
+
+ /* Document-const: SIZEOF_PTRDIFF_T
+ *
+ * size of a ptrdiff_t
+ */
+ rb_define_const(rb_mDL, "SIZEOF_PTRDIFF_T", INT2NUM(sizeof(ptrdiff_t)));
+
+ /* Document-const: SIZEOF_INTPTR_T
+ *
+ * size of a intptr_t
+ */
+ rb_define_const(rb_mDL, "SIZEOF_INTPTR_T", INT2NUM(sizeof(intptr_t)));
+
+ /* Document-const: SIZEOF_UINTPTR_T
+ *
+ * size of a uintptr_t
+ */
+ rb_define_const(rb_mDL, "SIZEOF_UINTPTR_T", INT2NUM(sizeof(uintptr_t)));
+
rb_define_module_function(rb_mDL, "dlwrap", rb_dl_value2ptr, 1);
rb_define_module_function(rb_mDL, "dlunwrap", rb_dl_ptr2value, 1);
diff --git a/ext/dl/dl.h b/ext/dl/dl.h
index 90e2131ee2..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
@@ -134,30 +134,21 @@ extern VALUE rb_cDLSymbol;
extern VALUE rb_eDLError;
extern VALUE rb_eDLTypeError;
-typedef struct { char c; void *x; } s_voidp;
-typedef struct { char c; short x; } s_short;
-typedef struct { char c; int x; } s_int;
-typedef struct { char c; long x; } s_long;
-typedef struct { char c; float x; } s_float;
-typedef struct { char c; double x; } s_double;
-#if HAVE_LONG_LONG
-typedef struct { char c; LONG_LONG x; } s_long_long;
-#endif
+#define ALIGN_OF(type) offsetof(struct {char align_c; type align_x;}, align_x)
-#define ALIGN_VOIDP (sizeof(s_voidp) - sizeof(void *))
-#define ALIGN_SHORT (sizeof(s_short) - sizeof(short))
-#define ALIGN_CHAR (1)
-#define ALIGN_INT (sizeof(s_int) - sizeof(int))
-#define ALIGN_LONG (sizeof(s_long) - sizeof(long))
+#define ALIGN_VOIDP ALIGN_OF(void*)
+#define ALIGN_SHORT ALIGN_OF(short)
+#define ALIGN_CHAR ALIGN_OF(char)
+#define ALIGN_INT ALIGN_OF(int)
+#define ALIGN_LONG ALIGN_OF(long)
#if HAVE_LONG_LONG
-#define ALIGN_LONG_LONG (sizeof(s_long_long) - sizeof(LONG_LONG))
+#define ALIGN_LONG_LONG ALIGN_OF(LONG_LONG)
#endif
-#define ALIGN_FLOAT (sizeof(s_float) - sizeof(float))
-#define ALIGN_DOUBLE (sizeof(s_double) - sizeof(double))
+#define ALIGN_FLOAT ALIGN_OF(float)
+#define ALIGN_DOUBLE ALIGN_OF(double)
-#define DLALIGN(ptr,offset,align) {\
- while( (((unsigned long)((char *)(ptr) + (offset))) % (align)) != 0 ) (offset)++;\
-}
+#define DLALIGN(ptr,offset,align) \
+ ((offset) += ((align) - ((uintptr_t)((char *)(ptr) + (offset))) % (align)) % (align))
#define DLTYPE_VOID 0
diff --git a/ext/dl/extconf.rb b/ext/dl/extconf.rb
index 8317ac35ad..4ef46f85fb 100644
--- a/ext/dl/extconf.rb
+++ b/ext/dl/extconf.rb
@@ -1,7 +1,8 @@
require 'mkmf'
if RbConfig::CONFIG['GCC'] == 'yes'
- $CFLAGS << " -fno-defer-pop -fno-omit-frame-pointer"
+ (have_macro("__clang__") ? $LDFLAGS : $CFLAGS) << " -fno-defer-pop"
+ $CFLAGS << " -fno-omit-frame-pointer"
end
$INSTALLFILES = [
@@ -24,6 +25,19 @@ else
end
if check
+ config = File.read(RbConfig.expand(File.join($arch_hdrdir, "ruby/config.h")))
+ types = {"SIZE_T"=>"SSIZE_T", "PTRDIFF_T"=>nil, "INTPTR_T"=>nil}
+ types.each do |type, signed|
+ if /^\#define\s+SIZEOF_#{type}\s+(SIZEOF_(.+)|\d+)/ =~ config
+ if size = $2 and size != 'VOIDP'
+ size = types.fetch(size) {size}
+ $defs << format("-DDLTYPE_%s=DLTYPE_%s", signed||type, size)
+ end
+ if signed
+ check_signedness(type.downcase, "stddef.h")
+ end
+ end
+ end
$defs << %[-DRUBY_VERSION=\\"#{RUBY_VERSION}\\"]
create_makefile("dl")
end
diff --git a/ext/dl/handle.c b/ext/dl/handle.c
index 2037ab5760..ef182e816f 100644
--- a/ext/dl/handle.c
+++ b/ext/dl/handle.c
@@ -78,6 +78,8 @@ rb_dlhandle_close(VALUE self)
return INT2NUM(ret);
}
rb_raise(rb_eDLError, "dlclose() called too many times");
+
+ UNREACHABLE;
}
VALUE
diff --git a/ext/dl/lib/dl.rb b/ext/dl/lib/dl.rb
index 80d46b685a..8e615ae718 100644
--- a/ext/dl/lib/dl.rb
+++ b/ext/dl/lib/dl.rb
@@ -5,7 +5,10 @@ begin
rescue LoadError
end
+warn "DL is deprecated, please use Fiddle"
+
module DL
+ # Returns true if DL is using Fiddle, the libffi wrapper.
def self.fiddle?
Object.const_defined?(:Fiddle)
end
diff --git a/ext/dl/lib/dl/cparser.rb b/ext/dl/lib/dl/cparser.rb
index 210f953471..e70e0f1dc1 100644
--- a/ext/dl/lib/dl/cparser.rb
+++ b/ext/dl/lib/dl/cparser.rb
@@ -1,5 +1,13 @@
module DL
+ # Methods for parsing C struct and C prototype signatures.
module CParser
+ # Parses a C struct's members
+ #
+ # Example:
+ #
+ # parse_struct_signature(['int i', 'char c'])
+ # => [[DL::TYPE_INT, DL::TYPE_CHAR], ["i", "c"]]
+ #
def parse_struct_signature(signature, tymap=nil)
if( signature.is_a?(String) )
signature = signature.split(/\s*,\s*/)
@@ -35,6 +43,16 @@ module DL
return tys, mems
end
+ # Parses a C prototype signature
+ #
+ # Example:
+ #
+ # include DL::CParser
+ # => Object
+ #
+ # parse_signature('double sum(double, double)')
+ # => ["sum", DL::TYPE_DOUBLE, [DL::TYPE_DOUBLE, DL::TYPE_DOUBLE]]
+ #
def parse_signature(signature, tymap=nil)
tymap ||= {}
signature = signature.gsub(/\s+/, " ").strip
@@ -56,6 +74,25 @@ module DL
end
end
+ # Given a String of C type +ty+, return the corresponding DL constant.
+ #
+ # +ty+ can also accept an Array of C type Strings, and will returned in a
+ # corresponding Array.
+ #
+ # If Hash +tymap+ is provided, +ty+ is expected to be the key, and the
+ # value will be the C type to be looked up.
+ #
+ # Example:
+ #
+ # parse_ctype('int')
+ # => DL::TYPE_INT
+ #
+ # parse_ctype('double')
+ # => DL::TYPE_DOUBLE
+ #
+ # parse_ctype('unsigned char')
+ # => -DL::TYPE_CHAR
+ #
def parse_ctype(ty, tymap=nil)
tymap ||= {}
case ty
@@ -95,6 +132,16 @@ module DL
return TYPE_FLOAT
when "double"
return TYPE_DOUBLE
+ when "size_t"
+ return TYPE_SIZE_T
+ when "ssize_t"
+ return TYPE_SSIZE_T
+ when "ptrdiff_t"
+ return TYPE_PTRDIFF_T
+ when "intptr_t"
+ return TYPE_INTPTR_T
+ when "uintptr_t"
+ return TYPE_UINTPTR_T
when /\*/, /\[\s*\]/
return TYPE_VOIDP
else
diff --git a/ext/dl/lib/dl/func.rb b/ext/dl/lib/dl/func.rb
index 9a984ed2b7..543711f651 100644
--- a/ext/dl/lib/dl/func.rb
+++ b/ext/dl/lib/dl/func.rb
@@ -15,7 +15,7 @@ module DL
# :stopdoc:
CALL_TYPE_TO_ABI = Hash.new { |h, k|
raise RuntimeError, "unsupported call type: #{k}"
- }.merge({ :stdcall =>
+ }.merge({ :stdcall =>
(Fiddle::Function::STDCALL rescue Fiddle::Function::DEFAULT),
:cdecl => Fiddle::Function::DEFAULT,
nil => Fiddle::Function::DEFAULT
@@ -132,6 +132,9 @@ module DL
if( !block )
raise(RuntimeError, "block must be given.")
end
+ unless block.lambda?
+ block = Class.new(self.class){define_method(:call, block); def initialize(obj); obj.instance_variables.each{|s| instance_variable_set(s, obj.instance_variable_get(s))}; end}.new(self).method(:call)
+ end
if( @cfunc.ptr == 0 )
cb = Proc.new{|*args|
ary = @stack.unpack(args)
diff --git a/ext/dl/lib/dl/import.rb b/ext/dl/lib/dl/import.rb
index a4fa406178..6f157ccf28 100644
--- a/ext/dl/lib/dl/import.rb
+++ b/ext/dl/lib/dl/import.rb
@@ -79,6 +79,7 @@ module DL
end
def sizeof(ty)
+ @type_alias ||= nil
case ty
when String
ty = parse_ctype(ty, @type_alias).abs()
@@ -128,6 +129,7 @@ module DL
private :parse_bind_options
def extern(signature, *opts)
+ @type_alias ||= nil
symname, ctype, argtype = parse_signature(signature, @type_alias)
opt = parse_bind_options(opts)
f = import_function(symname, ctype, argtype, opt[:call_type])
@@ -150,6 +152,7 @@ module DL
end
def bind(signature, *opts, &blk)
+ @type_alias ||= nil
name, ctype, argtype = parse_signature(signature, @type_alias)
h = parse_bind_options(opts)
case h[:callback_type]
@@ -179,12 +182,20 @@ module DL
f
end
+ # Creates a class to wrap the C struct described by +signature+.
+ #
+ # MyStruct = struct ['int i', 'char c']
def struct(signature)
+ @type_alias ||= nil
tys, mems = parse_struct_signature(signature, @type_alias)
DL::CStructBuilder.create(CStruct, tys, mems)
end
+ # Creates a class to wrap the C union described by +signature+.
+ #
+ # MyUnion = union ['int i', 'char c']
def union(signature)
+ @type_alias ||= nil
tys, mems = parse_struct_signature(signature, @type_alias)
DL::CStructBuilder.create(CUnion, tys, mems)
end
@@ -210,7 +221,8 @@ module DL
end
def handler
- @handler or raise "call dlload before importing symbols and functions"
+ defined?(@handler) or raise "call dlload before importing symbols and functions"
+ @handler
end
def import_symbol(name)
diff --git a/ext/dl/lib/dl/struct.rb b/ext/dl/lib/dl/struct.rb
index b8becca6b6..e2d91a6d14 100644
--- a/ext/dl/lib/dl/struct.rb
+++ b/ext/dl/lib/dl/struct.rb
@@ -1,20 +1,52 @@
require 'dl'
+require 'dl/value'
require 'dl/pack.rb'
module DL
+ # C struct shell
class CStruct
+ # accessor to DL::CStructEntity
def CStruct.entity_class()
CStructEntity
end
end
+ # C union shell
class CUnion
+ # accessor to DL::CUnionEntity
def CUnion.entity_class()
CUnionEntity
end
end
+ # Used to construct C classes (CUnion, CStruct, etc)
+ #
+ # DL::Importer#struct and DL::Importer#union wrap this functionality in an
+ # easy-to-use manner.
module CStructBuilder
+ # Construct a new class given a C:
+ # * class +klass+ (CUnion, CStruct, or other that provide an
+ # #entity_class)
+ # * +types+ (DL:TYPE_INT, DL::TYPE_SIZE_T, etc., see the C types
+ # constants)
+ # * corresponding +members+
+ #
+ # DL::Importer#struct and DL::Importer#union wrap this functionality in an
+ # easy-to-use manner.
+ #
+ # Example:
+ #
+ # require 'dl/struct'
+ # require 'dl/cparser'
+ #
+ # include DL::CParser
+ #
+ # types, members = parse_struct_signature(['int i','char c'])
+ #
+ # MyStruct = DL::CStructBuilder.create(CUnion, types, members)
+ #
+ # obj = MyStruct.allocate
+ #
def create(klass, types, members)
new_class = Class.new(klass){
define_method(:initialize){|addr|
@@ -43,75 +75,76 @@ module DL
module_function :create
end
- class CStructEntity < CPtr
+ # A C struct wrapper
+ class CStructEntity < (DL.fiddle? ? Fiddle::Pointer : CPtr)
include PackInfo
include ValueUtil
+ # Allocates a C struct the +types+ provided. The C function +func+ is
+ # called when the instance is garbage collected.
def CStructEntity.malloc(types, func = nil)
addr = DL.malloc(CStructEntity.size(types))
CStructEntity.new(addr, types, func)
end
+ # Given +types+, returns the offset for the packed sizes of those types
+ #
+ # DL::CStructEntity.size([DL::TYPE_DOUBLE, DL::TYPE_INT, DL::TYPE_CHAR,
+ # DL::TYPE_VOIDP])
+ # => 24
def CStructEntity.size(types)
offset = 0
- max_align = 0
- types.each_with_index{|t,i|
- orig_offset = offset
- if( t.is_a?(Array) )
- align = PackInfo::ALIGN_MAP[t[0]]
- offset = PackInfo.align(orig_offset, align)
- size = offset - orig_offset
- offset += (PackInfo::SIZE_MAP[t[0]] * t[1])
- else
- align = PackInfo::ALIGN_MAP[t]
- offset = PackInfo.align(orig_offset, align)
- size = offset - orig_offset
- offset += PackInfo::SIZE_MAP[t]
- end
- if (max_align < align)
- max_align = align
- end
- }
- offset = PackInfo.align(offset, max_align)
- offset
+
+ max_align = types.map { |type, count = 1|
+ last_offset = offset
+
+ align = PackInfo::ALIGN_MAP[type]
+ offset = PackInfo.align(last_offset, align) +
+ (PackInfo::SIZE_MAP[type] * count)
+
+ align
+ }.max
+
+ PackInfo.align(offset, max_align)
end
+ # Wraps the C pointer +addr+ as a C struct with the given +types+. The C
+ # function +func+ is called when the instance is garbage collected.
+ #
+ # See also DL::CPtr.new
def initialize(addr, types, func = nil)
set_ctypes(types)
super(addr, @size, func)
end
+ # Set the names of the +members+ in this C struct
def assign_names(members)
@members = members
end
+ # Given +types+, calculate the offsets and sizes for the types in the
+ # struct.
def set_ctypes(types)
@ctypes = types
@offset = []
offset = 0
- max_align = 0
- types.each_with_index{|t,i|
+
+ max_align = types.map { |type, count = 1|
orig_offset = offset
- if( t.is_a?(Array) )
- align = ALIGN_MAP[t[0]]
- else
- align = ALIGN_MAP[t]
- end
+ align = ALIGN_MAP[type]
offset = PackInfo.align(orig_offset, align)
- @offset[i] = offset
- if( t.is_a?(Array) )
- offset += (SIZE_MAP[t[0]] * t[1])
- else
- offset += SIZE_MAP[t]
- end
- if (max_align < align)
- max_align = align
- end
- }
- offset = PackInfo.align(offset, max_align)
- @size = offset
+
+ @offset << offset
+
+ offset += (SIZE_MAP[type] * count)
+
+ align
+ }.max
+
+ @size = PackInfo.align(offset, max_align)
end
+ # Fetch struct member +name+
def [](name)
idx = @members.index(name)
if( idx.nil? )
@@ -145,6 +178,7 @@ module DL
end
end
+ # Set struct member +name+, to value +val+
def []=(name, val)
idx = @members.index(name)
if( idx.nil? )
@@ -164,48 +198,38 @@ module DL
end
end
- def to_s()
+ def to_s() # :nodoc:
super(@size)
end
end
+ # A C union wrapper
class CUnionEntity < CStructEntity
include PackInfo
+ # Allocates a C union the +types+ provided. The C function +func+ is
+ # called when the instance is garbage collected.
def CUnionEntity.malloc(types, func=nil)
addr = DL.malloc(CUnionEntity.size(types))
CUnionEntity.new(addr, types, func)
end
+ # Given +types+, returns the size needed for the union.
+ #
+ # DL::CUnionEntity.size([DL::TYPE_DOUBLE, DL::TYPE_INT, DL::TYPE_CHAR,
+ # DL::TYPE_VOIDP])
+ # => 8
def CUnionEntity.size(types)
- size = 0
- types.each_with_index{|t,i|
- if( t.is_a?(Array) )
- tsize = PackInfo::SIZE_MAP[t[0]] * t[1]
- else
- tsize = PackInfo::SIZE_MAP[t]
- end
- if( tsize > size )
- size = tsize
- end
- }
+ types.map { |type, count = 1|
+ PackInfo::SIZE_MAP[type] * count
+ }.max
end
+ # Given +types+, calculate the necessary offset and for each union member
def set_ctypes(types)
@ctypes = types
- @offset = []
- @size = 0
- types.each_with_index{|t,i|
- @offset[i] = 0
- if( t.is_a?(Array) )
- size = SIZE_MAP[t[0]] * t[1]
- else
- size = SIZE_MAP[t]
- end
- if( size > @size )
- @size = size
- end
- }
+ @offset = Array.new(types.length, 0)
+ @size = self.class.size types
end
end
end
diff --git a/ext/dl/lib/dl/types.rb b/ext/dl/lib/dl/types.rb
index 3dfa40807a..d5724e407b 100644
--- a/ext/dl/lib/dl/types.rb
+++ b/ext/dl/lib/dl/types.rb
@@ -40,11 +40,7 @@ module DL
typealias "UINT", "unsigned int"
typealias "ULONG", "unsigned long"
typealias "UCHAR", "unsigned char"
- if [nil].pack('p').bytesize == 8
- typealias "HANDLE", "unsigned long long"
- else
- typealias "HANDLE", "unsigned long"
- end
+ typealias "HANDLE", "uintptr_t"
typealias "PHANDLE", "void*"
typealias "PVOID", "void*"
typealias "LPCSTR", "char*"
diff --git a/ext/dl/lib/dl/value.rb b/ext/dl/lib/dl/value.rb
index e99e3cf3bf..147d9d120a 100644
--- a/ext/dl/lib/dl/value.rb
+++ b/ext/dl/lib/dl/value.rb
@@ -46,6 +46,8 @@ module DL
end
def wrap_arg(arg, ty, funcs = [], &block)
+ require 'dl/func'
+
funcs ||= []
case arg
when nil
diff --git a/ext/dl/win32/extconf.rb b/ext/dl/win32/extconf.rb
deleted file mode 100644
index a72ca49c06..0000000000
--- a/ext/dl/win32/extconf.rb
+++ /dev/null
@@ -1,3 +0,0 @@
-if compiled?('dl') and $mswin||$bccwin||$mingw||$cygwin
- create_makefile('win32')
-end
diff --git a/ext/etc/depend b/ext/etc/depend
index f2c04f5879..2db89d969c 100644
--- a/ext/etc/depend
+++ b/ext/etc/depend
@@ -1 +1,3 @@
-etc.o : etc.c $(hdrdir)/ruby.h $(topdir)/config.h $(hdrdir)/defines.h
+etc.o : etc.c $(HDRS) $(ruby_headers) \
+ $(hdrdir)/ruby/encoding.h \
+ $(hdrdir)/ruby/oniguruma.h
diff --git a/ext/etc/etc.c b/ext/etc/etc.c
index 2bd2e30747..18d425a8bf 100644
--- a/ext/etc/etc.c
+++ b/ext/etc/etc.c
@@ -40,9 +40,17 @@ char *getenv();
#endif
char *getlogin();
-/* Returns the short user name of the currently logged in user.
- * Unfortunately, it is often rather easy to fool getlogin().
- * Avoid getlogin() for security-related purposes.
+/* call-seq:
+ * getlogin -> String
+ *
+ * Returns the short user name of the currently logged in user.
+ * Unfortunately, it is often rather easy to fool ::getlogin.
+ *
+ * Avoid ::getlogin for security-related purposes.
+ *
+ * If ::getlogin fails, try ::getpwuid.
+ *
+ * See the unix manpage for <code>getpwuid(3)</code> for more detail.
*
* e.g.
* Etc.getlogin -> 'guest'
@@ -52,7 +60,6 @@ etc_getlogin(VALUE obj)
{
char *login;
- rb_secure(4);
#ifdef HAVE_GETLOGIN
login = getlogin();
if (!login) login = getenv("USER");
@@ -72,6 +79,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
@@ -80,33 +101,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*/
@@ -114,14 +135,22 @@ setup_passwd(struct passwd *pwd)
}
#endif
-/* Returns the /etc/passwd information for the user with specified integer
- * user id (uid).
+/* call-seq:
+ * getpwuid(uid) -> Passwd
+ *
+ * Returns the /etc/passwd information for the user with the given integer +uid+.
+ *
+ * The information is returned as a Passwd struct.
+ *
+ * If +uid+ is omitted, the value from <code>Passwd[:uid]</code> is returned
+ * instead.
*
- * The information is returned as a Struct::Passwd; see getpwent above for
- * details.
+ * See the unix manpage for <code>getpwuid(3)</code> for more detail.
*
- * e.g. * Etc.getpwuid(0) -> #<struct Struct::Passwd name="root",
- * passwd="x", uid=0, gid=0, gecos="root",dir="/root", shell="/bin/bash">
+ * === Example:
+ *
+ * Etc.getpwuid(0)
+ * #=> #<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)
@@ -131,7 +160,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);
}
@@ -146,13 +174,20 @@ etc_getpwuid(int argc, VALUE *argv, VALUE obj)
#endif
}
-/* Returns the /etc/passwd information for the user with specified login name.
+/* call-seq:
+ * getpwnam(name) -> Passwd
+ *
+ * Returns the /etc/passwd information for the user with specified login
+ * +name+.
+ *
+ * The information is returned as a Passwd struct.
*
- * The information is returned as a Struct::Passwd; see getpwent above for
- * details.
+ * See the unix manpage for <code>getpwnam(3)</code> for more detail.
*
- * e.g. * Etc.getpwnam('root') -> #<struct Struct::Passwd name="root",
- * passwd="x", uid=0, gid=0, gecos="root",dir="/root", shell="/bin/bash">
+ * === Example:
+ *
+ * Etc.getpwnam('root')
+ * #=> #<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)
@@ -162,7 +197,7 @@ etc_getpwnam(VALUE obj, VALUE nam)
SafeStringValue(nam);
pwd = getpwnam(RSTRING_PTR(nam));
- if (pwd == 0) rb_raise(rb_eArgError, "can't find user for %s", RSTRING_PTR(nam));
+ if (pwd == 0) rb_raise(rb_eArgError, "can't find user for %"PRIsVALUE, nam);
return setup_passwd(pwd);
#else
return Qnil;
@@ -174,6 +209,7 @@ static int passwd_blocking = 0;
static VALUE
passwd_ensure(void)
{
+ endpwent();
passwd_blocking = (int)Qfalse;
return Qnil;
}
@@ -187,7 +223,6 @@ passwd_iterate(void)
while (pw = getpwent()) {
rb_yield(setup_passwd(pw));
}
- endpwent();
return Qnil;
}
@@ -202,11 +237,16 @@ each_passwd(void)
}
#endif
-/* Provides a convenient Ruby iterator which executes a block for each entry
+/* call-seq:
+ * Etc.passwd { |struct| block } -> Passwd
+ * Etc.passwd -> Passwd
+ *
+ * Provides a convenient Ruby iterator which executes a block for each entry
* in the /etc/passwd file.
*
- * The code block is passed an Struct::Passwd struct; see getpwent above for
- * details.
+ * The code block is passed an Passwd struct.
+ *
+ * See ::getpwent above for details.
*
* Example:
*
@@ -223,7 +263,6 @@ etc_passwd(VALUE obj)
#ifdef HAVE_GETPWENT
struct passwd *pw;
- rb_secure(4);
if (rb_block_given_p()) {
each_passwd();
}
@@ -234,11 +273,17 @@ etc_passwd(VALUE obj)
return Qnil;
}
-/* Iterates for each entry in the /etc/passwd file if a block is given.
- * If no block is given, returns the enumerator.
+/* call-seq:
+ * Etc::Passwd.each { |struct| block } -> Passwd
+ * Etc::Passwd.each -> Enumerator
*
- * The code block is passed an Struct::Passwd struct; see getpwent above for
- * details.
+ * Iterates for each entry in the /etc/passwd file if a block is given.
+ *
+ * If no block is given, returns the Enumerator.
+ *
+ * The code block is passed an Passwd struct.
+ *
+ * See ::getpwent above for details.
*
* Example:
*
@@ -263,7 +308,7 @@ etc_each_passwd(VALUE obj)
}
/* Resets the process of reading the /etc/passwd file, so that the next call
- * to getpwent will return the first entry again.
+ * to ::getpwent will return the first entry again.
*/
static VALUE
etc_setpwent(VALUE obj)
@@ -275,7 +320,7 @@ etc_setpwent(VALUE obj)
}
/* Ends the process of scanning through the /etc/passwd file begun with
- * getpwent, and closes the file.
+ * ::getpwent, and closes the file.
*/
static VALUE
etc_endpwent(VALUE obj)
@@ -286,31 +331,16 @@ etc_endpwent(VALUE obj)
return Qnil;
}
-/* Returns an entry from the /etc/passwd file. The first time it is called it
- * opens the file and returns the first entry; each successive call returns
- * the next entry, or nil if the end of the file has been reached.
- *
- * To close the file when processing is complete, call endpwent.
- *
- * Each entry is returned as a Struct::Passwd:
- *
- * - Passwd#name contains the short login name of the user as a String.
- *
- * - Passwd#passwd contains the encrypted password of the user as a String.
- * an 'x' is returned if shadow passwords are in use. An '*' is returned
- * if the user cannot log in using a password.
- *
- * - Passwd#uid contains the integer user ID (uid) of the user.
+/* Returns an entry from the /etc/passwd file.
*
- * - Passwd#gid contains the integer group ID (gid) of the user's primary group.
+ * The first time it is called it opens the file and returns the first entry;
+ * each successive call returns the next entry, or +nil+ if the end of the file
+ * has been reached.
*
- * - Passwd#gecos 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.
+ * To close the file when processing is complete, call ::endpwent.
*
- * - Passwd#dir contains the path to the home directory of the user as a String.
+ * Each entry is returned as a Passwd struct.
*
- * - Passwd#shell contains the path to the login shell of the user as a String.
*/
static VALUE
etc_getpwent(VALUE obj)
@@ -335,12 +365,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),
@@ -348,14 +378,20 @@ setup_group(struct group *grp)
}
#endif
-/* Returns information about the group with specified integer group id (gid),
+/* call-seq:
+ * getgrgid(group_id) -> Group
+ *
+ * Returns information about the group with specified integer +group_id+,
* as found in /etc/group.
*
- * The information is returned as a Struct::Group; see getgrent above for
- * details.
+ * The information is returned as a Group struct.
+ *
+ * See the unix manpage for <code>getgrgid(3)</code> for more detail.
+ *
+ * === Example:
*
- * e.g. Etc.getgrgid(100) -> #<struct Struct::Group name="users", passwd="x",
- * gid=100, mem=["meta", "root"]>
+ * Etc.getgrgid(100)
+ * #=> #<struct Etc::Group name="users", passwd="x", gid=100, mem=["meta", "root"]>
*
*/
static VALUE
@@ -366,7 +402,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);
}
@@ -381,14 +416,20 @@ etc_getgrgid(int argc, VALUE *argv, VALUE obj)
#endif
}
-/* Returns information about the group with specified String name, as found
- * in /etc/group.
+/* call-seq:
+ * getgrnam(name) -> Group
+ *
+ * Returns information about the group with specified +name+, as found in
+ * /etc/group.
+ *
+ * The information is returned as a Group struct.
*
- * The information is returned as a Struct::Group; see getgrent above for
- * details.
+ * See the unix manpage for <code>getgrnam(3)</code> for more detail.
*
- * e.g. Etc.getgrnam('users') -> #<struct Struct::Group name="users",
- * passwd="x", gid=100, mem=["meta", "root"]>
+ * === Example:
+ *
+ * Etc.getgrnam('users')
+ * #=> #<struct Etc::Group name="users", passwd="x", gid=100, mem=["meta", "root"]>
*
*/
static VALUE
@@ -397,10 +438,9 @@ 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 %s", RSTRING_PTR(nam));
+ if (grp == 0) rb_raise(rb_eArgError, "can't find group for %"PRIsVALUE, nam);
return setup_group(grp);
#else
return Qnil;
@@ -412,10 +452,12 @@ static int group_blocking = 0;
static VALUE
group_ensure(void)
{
+ endgrent();
group_blocking = (int)Qfalse;
return Qnil;
}
+
static VALUE
group_iterate(void)
{
@@ -425,7 +467,6 @@ group_iterate(void)
while (pw = getgrent()) {
rb_yield(setup_group(pw));
}
- endgrent();
return Qnil;
}
@@ -443,8 +484,9 @@ each_group(void)
/* Provides a convenient Ruby iterator which executes a block for each entry
* in the /etc/group file.
*
- * The code block is passed an Struct::Group struct; see getgrent above for
- * details.
+ * The code block is passed an Group struct.
+ *
+ * See ::getgrent above for details.
*
* Example:
*
@@ -461,7 +503,6 @@ etc_group(VALUE obj)
#ifdef HAVE_GETGRENT
struct group *grp;
- rb_secure(4);
if (rb_block_given_p()) {
each_group();
}
@@ -473,11 +514,15 @@ etc_group(VALUE obj)
}
#ifdef HAVE_GETGRENT
-/* Iterates for each entry in the /etc/group file if a block is given.
- * If no block is given, returns the enumerator.
+/* call-seq:
+ * Etc::Group.each { |group| block } -> obj
+ * Etc::Group.each -> Enumerator
+ *
+ * Iterates for each entry in the /etc/group file if a block is given.
*
- * The code block is passed an Struct::Group struct; see getpwent above for
- * details.
+ * If no block is given, returns the Enumerator.
+ *
+ * The code block is passed a Group struct.
*
* Example:
*
@@ -501,7 +546,7 @@ etc_each_group(VALUE obj)
#endif
/* Resets the process of reading the /etc/group file, so that the next call
- * to getgrent will return the first entry again.
+ * to ::getgrent will return the first entry again.
*/
static VALUE
etc_setgrent(VALUE obj)
@@ -513,7 +558,7 @@ etc_setgrent(VALUE obj)
}
/* Ends the process of scanning through the /etc/group file begun by
- * getgrent, and closes the file.
+ * ::getgrent, and closes the file.
*/
static VALUE
etc_endgrent(VALUE obj)
@@ -524,25 +569,15 @@ etc_endgrent(VALUE obj)
return Qnil;
}
-/* Returns an entry from the /etc/group file. The first time it is called it
- * opens the file and returns the first entry; each successive call returns
- * the next entry, or nil if the end of the file has been reached.
- *
- * To close the file when processing is complete, call endgrent.
+/* Returns an entry from the /etc/group file.
*
- * Each entry is returned as a Struct::Group:
+ * The first time it is called it opens the file and returns the first entry;
+ * each successive call returns the next entry, or +nil+ if the end of the file
+ * has been reached.
*
- * - Group#name contains the name of the group as a String.
+ * To close the file when processing is complete, call ::endgrent.
*
- * - Group#passwd contains the encrypted password as a String. An 'x' is
- * returned if password access to the group is not available; an empty
- * string is returned if no password is needed to obtain membership of
- * the group.
- *
- * - Group#gid contains the group's numeric ID as an integer.
- *
- * - Group#mem is an Array of Strings containing the short login names of the
- * members of the group.
+ * Each entry is returned as a Group struct
*/
static VALUE
etc_getgrent(VALUE obj)
@@ -567,6 +602,10 @@ VALUE rb_w32_conv_from_wchar(const WCHAR *wstr, rb_encoding *enc);
/*
* Returns system configuration directory.
+ *
+ * This is typically "/etc", but is modified by the prefix used when Ruby was
+ * compiled. For example, if Ruby is built and installed in /usr/local, returns
+ * "/usr/local/etc".
*/
static VALUE
etc_sysconfdir(VALUE obj)
@@ -579,7 +618,7 @@ etc_sysconfdir(VALUE obj)
}
/*
- * Returns system temporary directory.
+ * Returns system temporary directory; typically "/tmp".
*/
static VALUE
etc_systmpdir(void)
@@ -593,14 +632,35 @@ 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;
}
/*
- * The etc module provides access to information from the running OS.
+ * The Etc module provides access to information typically stored in
+ * files in the /etc directory on Unix systems.
+ *
+ * The information accessible consists of the information found in the
+ * /etc/passwd and /etc/group files, plus information about the system's
+ * temporary directory (/tmp) and configuration directory (/etc).
*
- * Documented by mathew <meta@pobox.com>.
+ * The Etc module provides a more reliable way to access information about
+ * the logged in user than environment variables such as +$USER+.
+ *
+ * == Example:
+ *
+ * require 'etc'
+ *
+ * login = Etc.getlogin
+ * info = Etc.getpwnam(login)
+ * username = info.gecos.split(/,/).first
+ * puts "Hello #{username}, I see your login name is #{login}"
+ *
+ * Note that the methods provided by this module are not always secure.
+ * It should be used for informational purposes, and not for security.
+ *
+ * All operations defined in this module are class methods, so that you can
+ * include the Etc module into your class.
*/
void
Init_etc(void)
@@ -626,43 +686,115 @@ Init_etc(void)
rb_define_module_function(mEtc, "sysconfdir", etc_sysconfdir, 0);
rb_define_module_function(mEtc, "systmpdir", etc_systmpdir, 0);
- sPasswd = rb_struct_define("Passwd",
- "name", "passwd", "uid", "gid",
-#ifdef HAVE_ST_PW_GECOS
- "gecos",
-#endif
- "dir", "shell",
-#ifdef HAVE_ST_PW_CHANGE
- "change",
-#endif
-#ifdef HAVE_ST_PW_QUOTA
- "quota",
-#endif
-#ifdef HAVE_ST_PW_AGE
- "age",
-#endif
-#ifdef HAVE_ST_PW_CLASS
- "uclass",
-#endif
-#ifdef HAVE_ST_PW_COMMENT
- "comment",
-#endif
-#ifdef HAVE_ST_PW_EXPIRE
- "expire",
-#endif
- NULL);
+ 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_STRUCT_PASSWD_PW_CHANGE
+ "change",
+#endif
+#ifdef HAVE_STRUCT_PASSWD_PW_QUOTA
+ "quota",
+#endif
+#ifdef HAVE_STRUCT_PASSWD_PW_AGE
+ "age",
+#endif
+#ifdef HAVE_STRUCT_PASSWD_PW_CLASS
+ "uclass",
+#endif
+#ifdef HAVE_STRUCT_PASSWD_PW_COMMENT
+ "comment",
+#endif
+#ifdef HAVE_STRUCT_PASSWD_PW_EXPIRE
+ "expire",
+#endif
+ NULL);
+#if 0
+ /* Define-const: Passwd
+ *
+ * Passwd is a Struct that contains the following members:
+ *
+ * name::
+ * contains the short login name of the user as a String.
+ * passwd::
+ * contains the encrypted password of the user as a String.
+ * an 'x' is returned if shadow passwords are in use. An '*' is returned
+ * if the user cannot log in using a password.
+ * uid::
+ * contains the integer user ID (uid) of the user.
+ * gid::
+ * contains the integer group ID (gid) of the user's primary group.
+ * dir::
+ * contains the path to the home directory of the user as a String.
+ * shell::
+ * contains the path to the login shell of the user as a String.
+ *
+ * === The following members below are optional, and must be compiled with special flags:
+ *
+ * gecos::
+ * 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_STRUCT_PASSWD_PW_GECOS+
+ * change::
+ * password change time(integer) must be compiled with +HAVE_STRUCT_PASSWD_PW_CHANGE+
+ * quota::
+ * quota value(integer) must be compiled with +HAVE_STRUCT_PASSWD_PW_QUOTA+
+ * age::
+ * password age(integer) must be compiled with +HAVE_STRUCT_PASSWD_PW_AGE+
+ * class::
+ * user access class(string) must be compiled with +HAVE_STRUCT_PASSWD_PW_CLASS+
+ * comment::
+ * comment(string) must be compiled with +HAVE_STRUCT_PASSWD_PW_COMMENT+
+ * 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",
-#endif
- "gid", "mem", NULL);
-
+ sGroup = rb_struct_define_under(mEtc, "Group", "name",
+#ifdef HAVE_STRUCT_GROUP_GR_PASSWD
+ "passwd",
+#endif
+ "gid", "mem", NULL);
+
+#if 0
+ /* Define-const: Group
+ *
+ * Group is a Struct that is only available when compiled with +HAVE_GETGRENT+.
+ *
+ * The struct contains the following members:
+ *
+ * name::
+ * contains the name of the group as a String.
+ * passwd::
+ * contains the encrypted password as a String. An 'x' is
+ * returned if password access to the group is not available; an empty
+ * string is returned if no password is needed to obtain membership of
+ * the group.
+ *
+ * Must be compiled with +HAVE_STRUCT_GROUP_GR_PASSWD+.
+ * gid::
+ * contains the group's numeric ID as an integer.
+ * mem::
+ * is an Array of Strings containing the short login names of the
+ * 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/extmk.rb b/ext/extmk.rb
index de6e037854..ef9afa0676 100755
--- a/ext/extmk.rb
+++ b/ext/extmk.rb
@@ -1,6 +1,7 @@
#! /usr/local/bin/ruby
-# -*- ruby -*-
+# -*- mode: ruby; coding: us-ascii -*-
+# :stopdoc:
$extension = nil
$extstatic = nil
$force_static = nil
@@ -10,7 +11,7 @@ $dryrun = false
$clean = nil
$nodynamic = nil
$extinit = nil
-$extobjs = nil
+$extobjs = []
$extflags = ""
$extlibs = nil
$extpath = nil
@@ -26,6 +27,8 @@ alias $0 $progname
$extlist = []
$compiled = {}
+DUMMY_SIGNATURE = "***DUMMY MAKEFILE***"
+
srcdir = File.dirname(File.dirname(__FILE__))
unless defined?(CROSS_COMPILING) and CROSS_COMPILING
$:.replace([File.expand_path("lib", srcdir), Dir.pwd])
@@ -40,13 +43,30 @@ $" << "mkmf.rb"
load File.expand_path("lib/mkmf.rb", srcdir)
require 'optparse/shellwords'
+if defined?(File::NULL)
+ @null = File::NULL
+elsif !File.chardev?(@null = "/dev/null")
+ @null = "nul"
+end
+
def sysquote(x)
@quote ||= /os2/ =~ (CROSS_COMPILING || RUBY_PLATFORM)
@quote ? x.quote : x
end
def verbose?
- $mflags.defined?("Q") != "@"
+ $mflags.defined?("V") == "1"
+end
+
+def system(*args)
+ if verbose?
+ if args.size == 1
+ puts args
+ else
+ puts Shellwords.join(args)
+ end
+ end
+ super
end
def extract_makefile(makefile, keep = true)
@@ -73,6 +93,11 @@ def extract_makefile(makefile, keep = true)
end
return false
end
+ srcs = Dir[File.join($srcdir, "*.{#{SRC_EXT.join(%q{,})}}")].map {|fn| File.basename(fn)}.sort
+ if !srcs.empty?
+ old_srcs = m[/^ORIG_SRCS[ \t]*=[ \t](.*)/, 1] or return false
+ old_srcs.split.sort == srcs or return false
+ end
$target = target
$extconf_h = m[/^RUBY_EXTCONF_H[ \t]*=[ \t]*(\S+)/, 1]
if $static.nil?
@@ -80,7 +105,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)}$/, "")
@@ -95,7 +122,7 @@ def extract_makefile(makefile, keep = true)
end
def extmake(target)
- unless $configure_only
+ unless $configure_only || verbose?
print "#{$message} #{target}\n"
$stdout.flush
end
@@ -120,6 +147,8 @@ def extmake(target)
$srcs = []
$compiled[target] = false
makefile = "./Makefile"
+ static = $static
+ $static = nil if noinstall = File.fnmatch?("-*", target)
ok = File.exist?(makefile)
unless $ignore
rbconfig0 = RbConfig::CONFIG
@@ -142,7 +171,7 @@ def extmake(target)
remove_const(:MAKEFILE_CONFIG)
const_set(:MAKEFILE_CONFIG, mkconfig)
}
- Object.class_eval {
+ MakeMakefile.class_eval {
remove_const(:CONFIG)
const_set(:CONFIG, mkconfig)
}
@@ -152,28 +181,28 @@ def extmake(target)
old_objs = $objs
old_cleanfiles = $distcleanfiles
conf = ["#{$srcdir}/makefile.rb", "#{$srcdir}/extconf.rb"].find {|f| File.exist?(f)}
- if (($extconf_h && !File.exist?($extconf_h)) ||
+ if (!ok || ($extconf_h && !File.exist?($extconf_h)) ||
!(t = modified?(makefile, MTIMES)) ||
[conf, "#{$srcdir}/depend"].any? {|f| modified?(f, [t])})
then
ok = false
if $configure_only
- print "#{$message} #{target}\n"
+ if verbose?
+ print "#{conf}\n" if conf
+ else
+ print "#{$message} #{target}\n"
+ end
$stdout.flush
end
init_mkmf
Logging::logfile 'mkmf.log'
rm_f makefile
if conf
- unless verbose?
- stdout, $stdout = $stdout, File.open(File::NULL, "a")
- else
- stdout = $stdout
- end
- begin
+ Logging.open do
+ unless verbose?
+ $stderr.reopen($stdout.reopen(@null))
+ end
load $0 = conf
- ensure
- $stdout = stdout
end
else
create_makefile(target)
@@ -187,22 +216,30 @@ def extmake(target)
ok = false
ensure
rm_f "conftest*"
- config = $0
$0 = $PROGRAM_NAME
end
end
+ ok &&= File.open(makefile){|f| !f.gets[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
+ open(makefile, "wb") do |f|
+ f.puts "# " + DUMMY_SIGNATURE
f.print(*dummy_makefile(CONFIG["srcdir"]))
end
mess = "Failed to configure #{target}. It will not be installed.\n"
if error
- mess.prepend(error.to_s + "\n")
+ mess = "#{error}\n#{mess}"
end
- Logging::message(mess)
+ Logging::message(mess) if Logging.log_opened?
print(mess)
$stdout.flush
return true
@@ -211,9 +248,9 @@ def extmake(target)
unless $destdir.to_s.empty? or $mflags.defined?("DESTDIR")
args += [sysquote("DESTDIR=" + relative_from($destdir, "../"+prefix))]
end
- if $static
+ if $static and ok and !$objs.empty? and !noinstall
args += ["static"] unless $clean
- $extlist.push [$static, $target, File.basename($target), $preload]
+ $extlist.push [$static, target, $target, $preload]
end
FileUtils.rm_f(old_cleanfiles - $distcleanfiles)
FileUtils.rm_f(old_objs - $objs)
@@ -232,12 +269,13 @@ def extmake(target)
$extlibs ||= []
$extpath ||= []
unless $mswin
- $extflags = ($extflags.split | $DLDFLAGS.split | $LDFLAGS.split).join(" ")
+ $extflags = split_libs($extflags, $DLDFLAGS, $LDFLAGS).uniq.join(" ")
end
- $extlibs = merge_libs($extlibs, $libs.split, $LOCAL_LIBS.split)
+ $extlibs = merge_libs($extlibs, split_libs($libs), split_libs($LOCAL_LIBS))
$extpath |= $LIBPATH
end
ensure
+ Logging::log_close
unless $ignore
RbConfig.module_eval {
remove_const(:CONFIG)
@@ -245,7 +283,7 @@ def extmake(target)
remove_const(:MAKEFILE_CONFIG)
const_set(:MAKEFILE_CONFIG, mkconfig0)
}
- Object.class_eval {
+ MakeMakefile.class_eval {
remove_const(:CONFIG)
const_set(:CONFIG, mkconfig0)
}
@@ -253,6 +291,7 @@ def extmake(target)
$top_srcdir = top_srcdir
$topdir = topdir
$hdrdir = hdrdir
+ $static = static
Dir.chdir dir
end
begin
@@ -429,7 +468,7 @@ end unless $extstatic
ext_prefix = "#{$top_srcdir}/ext"
exts = $static_ext.sort_by {|t, i| i}.collect {|t, i| t}
withes, withouts = %w[--with --without].collect {|w|
- if not (w = %w[-extensions -ext].collect {|o|arg_config(w+o)}).any?
+ if !(w = %w[-extensions -ext].collect {|o|arg_config(w+o)}).any?
nil
elsif (w = w.grep(String)).empty?
proc {true}
@@ -472,7 +511,7 @@ Dir::chdir('ext')
hdrdir = $hdrdir
$hdrdir = ($top_srcdir = relative_from(srcdir, $topdir = "..")) + "/include"
exts.each do |d|
- $static = $force_static ? $static_ext[target] : nil
+ $static = $force_static ? true : $static_ext[target]
if $ignore or !$nodynamic or $static
extmake(d) or abort
@@ -508,7 +547,7 @@ if $ignore
end
$extinit ||= ""
-$extobjs ||= ""
+$extobjs ||= []
$extpath ||= []
$extflags ||= ""
$extlibs ||= []
@@ -517,39 +556,36 @@ unless $extlist.empty?
list = $extlist.dup
built = []
while e = list.shift
- s,t,i,r = 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
- f = format("%s/%s.%s", t, i, $LIBEXT)
- if File.exist?(f)
- $extinit << " init(Init_#{i}, \"#{t}.so\");\n"
- $extobjs << "ext/#{f} "
- built << t
- end
+ base = File.basename(feature)
+ $extinit << " init(Init_#{base}, \"#{feature}.so\");\n"
+ $extobjs << format("ext/%s/%s.%s", target, base, $LIBEXT)
+ built << target
end
src = %{\
-#include "ruby.h"
+#include "ruby/ruby.h"
#define init(func, name) { \\
- extern void func _((void)); \\
+ extern void func(void); \\
ruby_init_ext(name, func); \\
}
-void ruby_init_ext _((const char *name, void (*init)(void)));
+void ruby_init_ext(const char *name, void (*init)(void));
-void Init_ext _((void))\n{\n#$extinit}
+void Init_ext(void)\n{\n#$extinit}
}
if !modified?(extinit.c, MTIMES) || IO.read(extinit.c) != src
open(extinit.c, "w") {|fe| fe.print src}
end
- $extobjs = "ext/#{extinit.o} #{$extobjs}"
if RUBY_PLATFORM =~ /beos/
$extflags.delete("-L/usr/local/lib")
end
@@ -558,7 +594,6 @@ void Init_ext _((void))\n{\n#$extinit}
conf = [
['LIBRUBY_SO_UPDATE', '$(LIBRUBY_EXTS)'],
['SETUP', $setup],
- [enable_config("shared", $enable_shared) ? 'DLDOBJS' : 'EXTOBJS', $extobjs],
['EXTLIBS', $extlibs.join(' ')], ['EXTLDFLAGS', $extflags]
].map {|n, v|
"#{n}=#{v}" if v and !(v = v.strip).empty?
@@ -610,32 +645,56 @@ if $configure_only and $command_output
mf.puts "MFLAGS = -$(MAKEFLAGS)" if $nmake
mf.puts
- mf.print "extensions ="
- w = 12
- exts.each do |d|
- if d.size + w > 70
- mf.print " \\\n\t "
- w = 12
+ def mf.macro(name, values, max = 70)
+ print name, " ="
+ w = w0 = name.size + 2
+ h = " \\\n" + "\t" * (w / 8) + " " * (w % 8)
+ values.each do |s|
+ if s.size + w > max
+ print h
+ w = w0
+ end
+ print " ", s
+ w += s.size + 1
end
- mf.print " #{d}"
- w += d.size + 1
+ puts
end
+
+ mf.macro "extensions", exts
+ 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 |target|
- mf.puts "#{target}: $(extensions:/.=/#{target})"
+ targets.each do |tgt|
+ mf.puts "#{tgt}: $(extensions:/.=/#{tgt})"
end
mf.puts
- mf.puts "all: #{rubies.join(' ')}"
- mf.puts "#{rubies.join(' ')}: $(extensions:/.=/all)"
- rubies.each do |target|
- mf.puts "#{target}:\n\t$(Q)$(MAKE) $(MFLAGS) $@"
+ mf.puts "clean:\n\t-$(Q)$(RM) ext/extinit.#{$OBJEXT}"
+ mf.puts "distclean:\n\t-$(Q)$(RM) ext/extinit.c"
+ mf.puts
+ mf.puts "#{rubies.join(' ')}: $(extensions:/.=/#{$force_static ? 'static' : 'all'})"
+ submake = "$(Q)$(MAKE) $(MFLAGS) $(SUBMAKEOPTS)"
+ mf.puts "all static:\n\t#{submake} #{rubies.join(' ')}\n"
+ rubies.each do |tgt|
+ mf.puts "#{tgt}:\n\t#{submake} $@"
end
mf.puts
- exec = config_string("exec") {|s| s + " "}
- targets.each do |target|
+ exec = config_string("exec") {|str| str + " "}
+ targets.each do |tgt|
exts.each do |d|
- mf.puts "#{d[0..-2]}#{target}:\n\t$(Q)cd $(@D) && #{exec}$(MAKE) $(MFLAGS) $(@F)"
+ mf.puts "#{d[0..-2]}#{tgt}:\n\t$(Q)cd $(@D) && #{exec}$(MAKE) $(MFLAGS) V=$(V) $(@F)"
end
end
end
@@ -665,6 +724,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/fcntl/fcntl.c b/ext/fcntl/fcntl.c
index b0992f30d8..3538d94948 100644
--- a/ext/fcntl/fcntl.c
+++ b/ext/fcntl/fcntl.c
@@ -14,12 +14,6 @@
fcntl - load the C fcntl.h defines
-= SYNOPSIS
-
- require "fcntl"
- m = s.fcntl(Fcntl::F_GETFL, 0)
- f.fcntl(Fcntl::F_SETFL, Fcntl::O_NONBLOCK|m)
-
= DESCRIPTION
This module is just a translation of the C <fcntl.h> file.
@@ -37,151 +31,215 @@ pack up your own arguments to pass as args for locking functions, etc.
/* Fcntl loads the constants defined in the system's <fcntl.h> C header
* file, and used with both the fcntl(2) and open(2) POSIX system calls.
*
- * Copyright (C) 1997-2001 Yukihiro Matsumoto
- *
- * Documented by mathew <meta@pobox.com>
- *
- * = Usage
- *
- * To perform a fcntl(2) operation, use IO::fcntl in the core classes.
+ * To perform a fcntl(2) operation, use IO::fcntl.
*
* To perform an open(2) operation, use IO::sysopen.
*
- * The set of operations and constants available depends upon specific OS
- * platform. Some values listed below may not be supported on your system.
- *
- * The constants supported by Ruby for use with IO::fcntl are:
- *
- * - F_DUPFD - duplicate a close-on-exec file handle to a non-close-on-exec
- * file handle.
- *
- * - F_GETFD - read the close-on-exec flag of a file handle.
- *
- * - F_SETFD - set the close-on-exec flag of a file handle.
- *
- * - FD_CLOEXEC - the value of the close-on-exec flag.
- *
- * - F_GETFL - get file descriptor flags.
- *
- * - F_SETFL - set file descriptor flags.
- *
- * - O_APPEND, O_NONBLOCK, etc (see below) - file descriptor flag
- * values for the above.
- *
- * - F_GETLK - determine whether a given region of a file is locked.
- *
- * - F_SETLK - acquire a lock on a region of a file.
- *
- * - F_SETLKW - acquire a lock on a region of a file, waiting if necessary.
+ * The set of operations and constants available depends upon specific
+ * operating system. Some values listed below may not be supported on your
+ * system.
*
- * - F_RDLCK, F_WRLCK, F_UNLCK - types of lock for the above.
+ * See your fcntl(2) man page for complete details.
*
- * The constants supported by Ruby for use with IO::sysopen are:
- *
- * - O_APPEND - open file in append mode.
- *
- * - O_NOCTTY - open tty without it becoming controlling tty.
- *
- * - O_CREAT - create file if it doesn't exist.
- *
- * - O_EXCL - used with O_CREAT, fail if file exists.
- *
- * - O_TRUNC - truncate file on open.
- *
- * - O_NONBLOCK / O_NDELAY - open in non-blocking mode.
- *
- * - O_RDONLY - open read-only.
- *
- * - O_WRONLY - open write-only.
- *
- * - O_RDWR - open read-write.
- *
- * - O_ACCMODE - mask to extract read/write flags.
- *
- * Example:
+ * Open /tmp/tempfile as a write-only file that is created if it doesn't
+ * exist:
*
* require 'fcntl'
*
- * fd = IO::sysopen('/tmp/tempfile',
- * Fcntl::O_WRONLY | Fcntl::O_EXCL | Fcntl::O_CREAT)
+ * fd = IO.sysopen('/tmp/tempfile',
+ * Fcntl::O_WRONLY | Fcntl::O_EXCL | Fcntl::O_CREAT)
* f = IO.open(fd)
* f.syswrite("TEMP DATA")
* f.close
*
+ * Get the flags on file +s+:
+ *
+ * m = s.fcntl(Fcntl::F_GETFL, 0)
+ *
+ * Set the non-blocking flag on +f+ in addition to the existing flags in +m+.
+ *
+ * f.fcntl(Fcntl::F_SETFL, Fcntl::O_NONBLOCK|m)
+ *
*/
void
Init_fcntl()
{
VALUE mFcntl = rb_define_module("Fcntl");
#ifdef F_DUPFD
+ /* Document-const: F_DUPFD
+ *
+ * Duplicate a file descriptor to the mimimum unused file descriptor
+ * greater than or equal to the argument.
+ *
+ * The close-on-exec flag of the duplicated file descriptor is set.
+ * (Ruby uses F_DUPFD_CLOEXEC internally if available to avoid race
+ * condition. F_SETFD is used if F_DUPFD_CLOEXEC is not available.)
+ */
rb_define_const(mFcntl, "F_DUPFD", INT2NUM(F_DUPFD));
#endif
#ifdef F_GETFD
+ /* Document-const: F_GETFD
+ *
+ * Read the close-on-exec flag of a file descriptor.
+ */
rb_define_const(mFcntl, "F_GETFD", INT2NUM(F_GETFD));
#endif
#ifdef F_GETLK
+ /* Document-const: F_GETLK
+ *
+ * Determine whether a given region of a file is locked. This uses one of
+ * the F_*LK flags.
+ */
rb_define_const(mFcntl, "F_GETLK", INT2NUM(F_GETLK));
#endif
#ifdef F_SETFD
+ /* Document-const: F_SETFD
+ *
+ * Set the close-on-exec flag of a file descriptor.
+ */
rb_define_const(mFcntl, "F_SETFD", INT2NUM(F_SETFD));
#endif
#ifdef F_GETFL
+ /* Document-const: F_GETFL
+ *
+ * Get the file descriptor flags. This will be one or more of the O_*
+ * flags.
+ */
rb_define_const(mFcntl, "F_GETFL", INT2NUM(F_GETFL));
#endif
#ifdef F_SETFL
+ /* Document-const: F_SETFL
+ *
+ * Set the file descriptor flags. This will be one or more of the O_*
+ * flags.
+ */
rb_define_const(mFcntl, "F_SETFL", INT2NUM(F_SETFL));
#endif
#ifdef F_SETLK
+ /* Document-const: F_SETLK
+ *
+ * Acquire a lock on a region of a file. This uses one of the F_*LCK
+ * flags.
+ */
rb_define_const(mFcntl, "F_SETLK", INT2NUM(F_SETLK));
#endif
#ifdef F_SETLKW
+ /* Document-const: F_SETLKW
+ *
+ * Acquire a lock on a region of a file, waiting if necessary. This uses
+ * one of the F_*LCK flags
+ */
rb_define_const(mFcntl, "F_SETLKW", INT2NUM(F_SETLKW));
#endif
#ifdef FD_CLOEXEC
+ /* Document-const: FD_CLOEXEC
+ *
+ * the value of the close-on-exec flag.
+ */
rb_define_const(mFcntl, "FD_CLOEXEC", INT2NUM(FD_CLOEXEC));
#endif
#ifdef F_RDLCK
+ /* Document-const: F_RDLCK
+ *
+ * Read lock for a region of a file
+ */
rb_define_const(mFcntl, "F_RDLCK", INT2NUM(F_RDLCK));
#endif
#ifdef F_UNLCK
+ /* Document-const: F_UNLCK
+ *
+ * Remove lock for a region of a file
+ */
rb_define_const(mFcntl, "F_UNLCK", INT2NUM(F_UNLCK));
#endif
#ifdef F_WRLCK
+ /* Document-const: F_WRLCK
+ *
+ * Write lock for a region of a file
+ */
rb_define_const(mFcntl, "F_WRLCK", INT2NUM(F_WRLCK));
#endif
#ifdef O_CREAT
+ /* Document-const: O_CREAT
+ *
+ * Create the file if it doesn't exist
+ */
rb_define_const(mFcntl, "O_CREAT", INT2NUM(O_CREAT));
#endif
#ifdef O_EXCL
+ /* Document-const: O_EXCL
+ *
+ * Used with O_CREAT, fail if the file exists
+ */
rb_define_const(mFcntl, "O_EXCL", INT2NUM(O_EXCL));
#endif
#ifdef O_NOCTTY
+ /* Document-const: O_NOCTTY
+ *
+ * Open TTY without it becoming the controlling TTY
+ */
rb_define_const(mFcntl, "O_NOCTTY", INT2NUM(O_NOCTTY));
#endif
#ifdef O_TRUNC
+ /* Document-const: O_TRUNC
+ *
+ * Truncate the file on open
+ */
rb_define_const(mFcntl, "O_TRUNC", INT2NUM(O_TRUNC));
#endif
#ifdef O_APPEND
+ /* Document-const: O_APPEND
+ *
+ * Open the file in append mode
+ */
rb_define_const(mFcntl, "O_APPEND", INT2NUM(O_APPEND));
#endif
#ifdef O_NONBLOCK
+ /* Document-const: O_NONBLOCK
+ *
+ * Open the file in non-blocking mode
+ */
rb_define_const(mFcntl, "O_NONBLOCK", INT2NUM(O_NONBLOCK));
#endif
#ifdef O_NDELAY
+ /* Document-const: O_NDELAY
+ *
+ * Open the file in non-blocking mode
+ */
rb_define_const(mFcntl, "O_NDELAY", INT2NUM(O_NDELAY));
#endif
#ifdef O_RDONLY
+ /* Document-const: O_RDONLY
+ *
+ * Open the file in read-only mode
+ */
rb_define_const(mFcntl, "O_RDONLY", INT2NUM(O_RDONLY));
#endif
#ifdef O_RDWR
+ /* Document-const: O_RDWR
+ *
+ * Open the file in read-write mode
+ */
rb_define_const(mFcntl, "O_RDWR", INT2NUM(O_RDWR));
#endif
#ifdef O_WRONLY
+ /* Document-const: O_WRONLY
+ *
+ * Open the file in write-only mode.
+ */
rb_define_const(mFcntl, "O_WRONLY", INT2NUM(O_WRONLY));
#endif
#ifdef O_ACCMODE
+ /* Document-const: O_ACCMODE
+ *
+ * Mask to extract the read/write flags
+ */
rb_define_const(mFcntl, "O_ACCMODE", INT2FIX(O_ACCMODE));
#else
+ /* Document-const: O_ACCMODE
+ *
+ * Mask to extract the read/write flags
+ */
rb_define_const(mFcntl, "O_ACCMODE", INT2FIX(O_RDONLY | O_WRONLY | O_RDWR));
#endif
}
diff --git a/ext/fiddle/closure.c b/ext/fiddle/closure.c
index 21796660c4..121a08ea19 100644
--- a/ext/fiddle/closure.c
+++ b/ext/fiddle/closure.c
@@ -10,15 +10,21 @@ 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));
@@ -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,16 @@ 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;
- mprotect(pcl, sizeof(pcl), PROT_READ | PROT_EXEC);
+ i = mprotect(pcl, sizeof(pcl), PROT_READ | PROT_EXEC);
+ if (i) {
+ rb_sys_fail("mprotect");
+ }
#endif
if (FFI_OK != result)
@@ -271,11 +280,11 @@ Init_fiddle_closure()
* 10
* end
* }.new(Fiddle::TYPE_INT, [])
- * => #<#<Class:0x0000000150d308>:0x0000000150d240>
+ * #=> #<#<Class:0x0000000150d308>:0x0000000150d240>
* func = Fiddle::Function.new(closure, [], Fiddle::TYPE_INT)
- * => #<Fiddle::Function:0x00000001516e58>
+ * #=> #<Fiddle::Function:0x00000001516e58>
* func.call
- * => 10
+ * #=> 10
*/
cFiddleClosure = rb_define_class_under(mFiddle, "Closure", rb_cObject);
@@ -289,7 +298,7 @@ Init_fiddle_closure()
* Construct a new Closure object.
*
* * +ret+ is the C type to be returned
- * * +args+ are passed the callback
+ * * +args+ is an Array of arguments, passed to the callback function
* * +abi+ is the abi of the closure
*
* If there is an error in preparing the ffi_cif or ffi_prep_closure,
diff --git a/ext/fiddle/conversions.c b/ext/fiddle/conversions.c
index f2c1511778..d40ddc1f38 100644
--- a/ext/fiddle/conversions.c
+++ b/ext/fiddle/conversions.c
@@ -134,6 +134,8 @@ generic_to_value(VALUE rettype, fiddle_generic retval)
default:
rb_raise(rb_eRuntimeError, "unknown type %d", type);
}
+
+ UNREACHABLE;
}
/* vim: set noet sw=4 sts=4 */
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..2190aa907f 100644
--- a/ext/fiddle/extconf.rb
+++ b/ext/fiddle/extconf.rb
@@ -5,6 +5,11 @@ 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.
+ $defs.push(%{-DRUBY_LIBFFI_MODVERSION=#{ '%d%03d%03d' % ver.split('.') }})
+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 83c0bb5e1e..7a7c708245 100644
--- a/ext/fiddle/fiddle.c
+++ b/ext/fiddle/fiddle.c
@@ -1,6 +1,129 @@
#include <fiddle.h>
VALUE mFiddle;
+VALUE rb_eFiddleError;
+
+#ifndef TYPE_SSIZE_T
+# if SIZEOF_SIZE_T == SIZEOF_INT
+# define TYPE_SSIZE_T TYPE_INT
+# elif SIZEOF_SIZE_T == SIZEOF_LONG
+# define TYPE_SSIZE_T TYPE_LONG
+# elif defined HAVE_LONG_LONG && SIZEOF_SIZE_T == SIZEOF_LONG_LONG
+# define TYPE_SSIZE_T TYPE_LONG_LONG
+# endif
+#endif
+#define TYPE_SIZE_T (-1*SIGNEDNESS_OF_SIZE_T*TYPE_SSIZE_T)
+
+#ifndef TYPE_PTRDIFF_T
+# if SIZEOF_PTRDIFF_T == SIZEOF_INT
+# define TYPE_PTRDIFF_T TYPE_INT
+# elif SIZEOF_PTRDIFF_T == SIZEOF_LONG
+# define TYPE_PTRDIFF_T TYPE_LONG
+# elif defined HAVE_LONG_LONG && SIZEOF_PTRDIFF_T == SIZEOF_LONG_LONG
+# define TYPE_PTRDIFF_T TYPE_LONG_LONG
+# endif
+#endif
+
+#ifndef TYPE_INTPTR_T
+# if SIZEOF_INTPTR_T == SIZEOF_INT
+# define TYPE_INTPTR_T TYPE_INT
+# elif SIZEOF_INTPTR_T == SIZEOF_LONG
+# define TYPE_INTPTR_T TYPE_LONG
+# elif defined HAVE_LONG_LONG && SIZEOF_INTPTR_T == SIZEOF_LONG_LONG
+# define TYPE_INTPTR_T TYPE_LONG_LONG
+# endif
+#endif
+#define TYPE_UINTPTR_T (-TYPE_INTPTR_T)
+
+void Init_fiddle_pointer(void);
+
+/*
+ * call-seq: Fiddle.malloc(size)
+ *
+ * Allocate +size+ bytes of memory and return the integer memory address
+ * for the allocated memory.
+ */
+static VALUE
+rb_fiddle_malloc(VALUE self, VALUE size)
+{
+ void *ptr;
+
+ ptr = (void*)ruby_xmalloc(NUM2INT(size));
+ return PTR2NUM(ptr);
+}
+
+/*
+ * call-seq: Fiddle.realloc(addr, size)
+ *
+ * Change the size of the memory allocated at the memory location +addr+ to
+ * +size+ bytes. Returns the memory address of the reallocated memory, which
+ * may be different than the address passed in.
+ */
+static VALUE
+rb_fiddle_realloc(VALUE self, VALUE addr, VALUE size)
+{
+ void *ptr = NUM2PTR(addr);
+
+ ptr = (void*)ruby_xrealloc(ptr, NUM2INT(size));
+ return PTR2NUM(ptr);
+}
+
+/*
+ * call-seq: Fiddle.free(addr)
+ *
+ * Free the memory at address +addr+
+ */
+VALUE
+rb_fiddle_free(VALUE self, VALUE addr)
+{
+ void *ptr = NUM2PTR(addr);
+
+ ruby_xfree(ptr);
+ return Qnil;
+}
+
+/*
+ * call-seq: Fiddle.dlunwrap(addr)
+ *
+ * Returns the hexadecimal representation of a memory pointer address +addr+
+ *
+ * Example:
+ *
+ * lib = Fiddle.dlopen('/lib64/libc-2.15.so')
+ * => #<Fiddle::Handle:0x00000001342460>
+ *
+ * lib['strcpy'].to_s(16)
+ * => "7f59de6dd240"
+ *
+ * Fiddle.dlunwrap(Fiddle.dlwrap(lib['strcpy'].to_s(16)))
+ * => "7f59de6dd240"
+ */
+VALUE
+rb_fiddle_ptr2value(VALUE self, VALUE addr)
+{
+ return (VALUE)NUM2PTR(addr);
+}
+
+/*
+ * call-seq: Fiddle.dlwrap(val)
+ *
+ * Returns a memory pointer of a function's hexadecimal address location +val+
+ *
+ * Example:
+ *
+ * lib = Fiddle.dlopen('/lib64/libc-2.15.so')
+ * => #<Fiddle::Handle:0x00000001342460>
+ *
+ * Fiddle.dlwrap(lib['strcpy'].to_s(16))
+ * => 25522520
+ */
+static VALUE
+rb_fiddle_value2ptr(VALUE self, VALUE val)
+{
+ return PTR2NUM((void*)val);
+}
+
+void Init_fiddle_handle(void);
void
Init_fiddle(void)
@@ -8,13 +131,45 @@ Init_fiddle(void)
/*
* Document-module: Fiddle
*
+ * A libffi wrapper for Ruby.
+ *
* == Description
*
- * A libffi wrapper.
+ * Fiddle is an extension to translate a foreign function interface (FFI)
+ * with ruby.
+ *
+ * It wraps {libffi}[http://sourceware.org/libffi/], a popular C library
+ * which provides a portable interface that allows code written in one
+ * language to call code written in another language.
+ *
+ * == Example
+ *
+ * Here we will use Fiddle::Function to wrap {floor(3) from
+ * libm}[http://linux.die.net/man/3/floor]
+ *
+ * require 'fiddle'
+ *
+ * libm = Fiddle.dlopen('/lib/libm.so.6')
+ *
+ * floor = Fiddle::Function.new(
+ * libm['floor'],
+ * [Fiddle::TYPE_DOUBLE],
+ * Fiddle::TYPE_DOUBLE
+ * )
+ *
+ * puts floor.call(3.14159) #=> 3.0
+ *
*
*/
mFiddle = rb_define_module("Fiddle");
+ /*
+ * Document-class: Fiddle::DLError
+ *
+ * standard dynamic load exception
+ */
+ rb_eFiddleError = rb_define_class_under(mFiddle, "DLError", rb_eStandardError);
+
/* Document-const: TYPE_VOID
*
* C type - void
@@ -71,6 +226,116 @@ Init_fiddle(void)
*/
rb_define_const(mFiddle, "TYPE_DOUBLE", INT2NUM(TYPE_DOUBLE));
+ /* Document-const: TYPE_SIZE_T
+ *
+ * C type - size_t
+ */
+ rb_define_const(mFiddle, "TYPE_SIZE_T", INT2NUM(TYPE_SIZE_T));
+
+ /* Document-const: TYPE_SSIZE_T
+ *
+ * C type - ssize_t
+ */
+ rb_define_const(mFiddle, "TYPE_SSIZE_T", INT2NUM(TYPE_SSIZE_T));
+
+ /* Document-const: TYPE_PTRDIFF_T
+ *
+ * C type - ptrdiff_t
+ */
+ rb_define_const(mFiddle, "TYPE_PTRDIFF_T", INT2NUM(TYPE_PTRDIFF_T));
+
+ /* Document-const: TYPE_INTPTR_T
+ *
+ * C type - intptr_t
+ */
+ rb_define_const(mFiddle, "TYPE_INTPTR_T", INT2NUM(TYPE_INTPTR_T));
+
+ /* Document-const: TYPE_UINTPTR_T
+ *
+ * C type - uintptr_t
+ */
+ rb_define_const(mFiddle, "TYPE_UINTPTR_T", INT2NUM(TYPE_UINTPTR_T));
+
+ /* Document-const: ALIGN_VOIDP
+ *
+ * The alignment size of a void*
+ */
+ rb_define_const(mFiddle, "ALIGN_VOIDP", INT2NUM(ALIGN_VOIDP));
+
+ /* Document-const: ALIGN_CHAR
+ *
+ * The alignment size of a char
+ */
+ rb_define_const(mFiddle, "ALIGN_CHAR", INT2NUM(ALIGN_CHAR));
+
+ /* Document-const: ALIGN_SHORT
+ *
+ * The alignment size of a short
+ */
+ rb_define_const(mFiddle, "ALIGN_SHORT", INT2NUM(ALIGN_SHORT));
+
+ /* Document-const: ALIGN_INT
+ *
+ * The alignment size of an int
+ */
+ rb_define_const(mFiddle, "ALIGN_INT", INT2NUM(ALIGN_INT));
+
+ /* Document-const: ALIGN_LONG
+ *
+ * The alignment size of a long
+ */
+ rb_define_const(mFiddle, "ALIGN_LONG", INT2NUM(ALIGN_LONG));
+
+#if HAVE_LONG_LONG
+ /* Document-const: ALIGN_LONG_LONG
+ *
+ * The alignment size of a long long
+ */
+ rb_define_const(mFiddle, "ALIGN_LONG_LONG", INT2NUM(ALIGN_LONG_LONG));
+#endif
+
+ /* Document-const: ALIGN_FLOAT
+ *
+ * The alignment size of a float
+ */
+ rb_define_const(mFiddle, "ALIGN_FLOAT", INT2NUM(ALIGN_FLOAT));
+
+ /* Document-const: ALIGN_DOUBLE
+ *
+ * The alignment size of a double
+ */
+ rb_define_const(mFiddle, "ALIGN_DOUBLE",INT2NUM(ALIGN_DOUBLE));
+
+ /* Document-const: ALIGN_SIZE_T
+ *
+ * The alignment size of a size_t
+ */
+ rb_define_const(mFiddle, "ALIGN_SIZE_T", INT2NUM(ALIGN_OF(size_t)));
+
+ /* Document-const: ALIGN_SSIZE_T
+ *
+ * The alignment size of a ssize_t
+ */
+ rb_define_const(mFiddle, "ALIGN_SSIZE_T", INT2NUM(ALIGN_OF(size_t))); /* same as size_t */
+
+ /* Document-const: ALIGN_PTRDIFF_T
+ *
+ * The alignment size of a ptrdiff_t
+ */
+ rb_define_const(mFiddle, "ALIGN_PTRDIFF_T", INT2NUM(ALIGN_OF(ptrdiff_t)));
+
+ /* Document-const: ALIGN_INTPTR_T
+ *
+ * The alignment size of a intptr_t
+ */
+ rb_define_const(mFiddle, "ALIGN_INTPTR_T", INT2NUM(ALIGN_OF(intptr_t)));
+
+ /* Document-const: ALIGN_UINTPTR_T
+ *
+ * The alignment size of a uintptr_t
+ */
+ rb_define_const(mFiddle, "ALIGN_UINTPTR_T", INT2NUM(ALIGN_OF(uintptr_t)));
+
/* Document-const: WINDOWS
*
* Returns a boolean regarding whether the host is WIN32
@@ -81,7 +346,109 @@ Init_fiddle(void)
rb_define_const(mFiddle, "WINDOWS", Qfalse);
#endif
+ /* Document-const: SIZEOF_VOIDP
+ *
+ * size of a void*
+ */
+ rb_define_const(mFiddle, "SIZEOF_VOIDP", INT2NUM(sizeof(void*)));
+
+ /* Document-const: SIZEOF_CHAR
+ *
+ * size of a char
+ */
+ rb_define_const(mFiddle, "SIZEOF_CHAR", INT2NUM(sizeof(char)));
+
+ /* Document-const: SIZEOF_SHORT
+ *
+ * size of a short
+ */
+ rb_define_const(mFiddle, "SIZEOF_SHORT", INT2NUM(sizeof(short)));
+
+ /* Document-const: SIZEOF_INT
+ *
+ * size of an int
+ */
+ rb_define_const(mFiddle, "SIZEOF_INT", INT2NUM(sizeof(int)));
+
+ /* Document-const: SIZEOF_LONG
+ *
+ * size of a long
+ */
+ rb_define_const(mFiddle, "SIZEOF_LONG", INT2NUM(sizeof(long)));
+
+#if HAVE_LONG_LONG
+ /* Document-const: SIZEOF_LONG_LONG
+ *
+ * size of a long long
+ */
+ rb_define_const(mFiddle, "SIZEOF_LONG_LONG", INT2NUM(sizeof(LONG_LONG)));
+#endif
+
+ /* Document-const: SIZEOF_FLOAT
+ *
+ * size of a float
+ */
+ rb_define_const(mFiddle, "SIZEOF_FLOAT", INT2NUM(sizeof(float)));
+
+ /* Document-const: SIZEOF_DOUBLE
+ *
+ * size of a double
+ */
+ rb_define_const(mFiddle, "SIZEOF_DOUBLE",INT2NUM(sizeof(double)));
+
+ /* Document-const: SIZEOF_SIZE_T
+ *
+ * size of a size_t
+ */
+ rb_define_const(mFiddle, "SIZEOF_SIZE_T", INT2NUM(sizeof(size_t)));
+
+ /* Document-const: SIZEOF_SSIZE_T
+ *
+ * size of a ssize_t
+ */
+ rb_define_const(mFiddle, "SIZEOF_SSIZE_T", INT2NUM(sizeof(size_t))); /* same as size_t */
+
+ /* Document-const: SIZEOF_PTRDIFF_T
+ *
+ * size of a ptrdiff_t
+ */
+ rb_define_const(mFiddle, "SIZEOF_PTRDIFF_T", INT2NUM(sizeof(ptrdiff_t)));
+
+ /* Document-const: SIZEOF_INTPTR_T
+ *
+ * size of a intptr_t
+ */
+ rb_define_const(mFiddle, "SIZEOF_INTPTR_T", INT2NUM(sizeof(intptr_t)));
+
+ /* Document-const: SIZEOF_UINTPTR_T
+ *
+ * size of a uintptr_t
+ */
+ rb_define_const(mFiddle, "SIZEOF_UINTPTR_T", INT2NUM(sizeof(uintptr_t)));
+
+ /* Document-const: RUBY_FREE
+ *
+ * Address of the ruby_xfree() function
+ */
+ rb_define_const(mFiddle, "RUBY_FREE", PTR2NUM(ruby_xfree));
+
+ /* Document-const: BUILD_RUBY_PLATFORM
+ *
+ * Platform built against (i.e. "x86_64-linux", etc.)
+ *
+ * See also RUBY_PLATFORM
+ */
+ rb_define_const(mFiddle, "BUILD_RUBY_PLATFORM", rb_str_new2(RUBY_PLATFORM));
+
+ rb_define_module_function(mFiddle, "dlwrap", rb_fiddle_value2ptr, 1);
+ rb_define_module_function(mFiddle, "dlunwrap", rb_fiddle_ptr2value, 1);
+ rb_define_module_function(mFiddle, "malloc", rb_fiddle_malloc, 1);
+ rb_define_module_function(mFiddle, "realloc", rb_fiddle_realloc, 2);
+ rb_define_module_function(mFiddle, "free", rb_fiddle_free, 1);
+
Init_fiddle_function();
Init_fiddle_closure();
+ Init_fiddle_handle();
+ Init_fiddle_pointer();
}
/* vim: set noet sws=4 sw=4: */
diff --git a/ext/fiddle/fiddle.h b/ext/fiddle/fiddle.h
index 3a829fe433..b37c37bc65 100644
--- a/ext/fiddle/fiddle.h
+++ b/ext/fiddle/fiddle.h
@@ -12,6 +12,30 @@
#include <sys/mman.h>
#endif
+#if defined(HAVE_DLFCN_H)
+# include <dlfcn.h>
+# /* some stranger systems may not define all of these */
+#ifndef RTLD_LAZY
+#define RTLD_LAZY 0
+#endif
+#ifndef RTLD_GLOBAL
+#define RTLD_GLOBAL 0
+#endif
+#ifndef RTLD_NOW
+#define RTLD_NOW 0
+#endif
+#else
+# if defined(_WIN32)
+# include <windows.h>
+# define dlopen(name,flag) ((void*)LoadLibrary(name))
+# define dlerror() strerror(rb_w32_map_errno(GetLastError()))
+# define dlsym(handle,name) ((void*)GetProcAddress((handle),(name)))
+# define RTLD_LAZY -1
+# define RTLD_NOW -1
+# define RTLD_GLOBAL -1
+# endif
+#endif
+
#ifdef USE_HEADER_HACKS
#include <ffi/ffi.h>
#else
@@ -97,7 +121,23 @@
#define TYPE_FLOAT 7
#define TYPE_DOUBLE 8
+#define ALIGN_OF(type) offsetof(struct {char align_c; type align_x;}, align_x)
+
+#define ALIGN_VOIDP ALIGN_OF(void*)
+#define ALIGN_SHORT ALIGN_OF(short)
+#define ALIGN_CHAR ALIGN_OF(char)
+#define ALIGN_INT ALIGN_OF(int)
+#define ALIGN_LONG ALIGN_OF(long)
+#if HAVE_LONG_LONG
+#define ALIGN_LONG_LONG ALIGN_OF(LONG_LONG)
+#endif
+#define ALIGN_FLOAT ALIGN_OF(float)
+#define ALIGN_DOUBLE ALIGN_OF(double)
+
extern VALUE mFiddle;
+extern VALUE rb_eFiddleError;
+
+VALUE rb_fiddle_new_function(VALUE address, VALUE arg_types, VALUE ret_type);
#endif
/* vim: set noet sws=4 sw=4: */
diff --git a/ext/fiddle/function.c b/ext/fiddle/function.c
index 52f7695eb7..4a5a5892a6 100644
--- a/ext/fiddle/function.c
+++ b/ext/fiddle/function.c
@@ -38,16 +38,39 @@ allocate(VALUE klass)
return TypedData_Make_Struct(klass, ffi_cif, &function_data_type, cif);
}
+VALUE
+rb_fiddle_new_function(VALUE address, VALUE arg_types, VALUE ret_type)
+{
+ VALUE argv[3];
+
+ argv[0] = address;
+ argv[1] = arg_types;
+ argv[2] = ret_type;
+
+ return rb_class_new_instance(3, argv, cFiddleFunction);
+}
+
+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;
+}
+
static VALUE
initialize(int argc, VALUE argv[], VALUE self)
{
ffi_cif * cif;
ffi_type **arg_types;
ffi_status result;
- VALUE ptr, args, ret_type, abi;
+ VALUE ptr, args, ret_type, abi, kwds;
int i;
- rb_scan_args(argc, argv, "31", &ptr, &args, &ret_type, &abi);
+ rb_scan_args(argc, argv, "31:", &ptr, &args, &ret_type, &abi, &kwds);
if(NIL_P(abi)) abi = INT2NUM(FFI_DEFAULT_ABI);
Check_Type(args, T_ARRAY);
@@ -57,6 +80,8 @@ initialize(int argc, VALUE argv[], VALUE self)
rb_iv_set(self, "@return_type", ret_type);
rb_iv_set(self, "@abi", abi);
+ if (!NIL_P(kwds)) rb_hash_foreach(kwds, parse_keyword_arg_i, self);
+
TypedData_Get_Struct(self, ffi_cif, &function_data_type, cif);
arg_types = xcalloc(RARRAY_LEN(args) + 1, sizeof(ffi_type *));
@@ -119,9 +144,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);
}
@@ -158,25 +183,28 @@ Init_fiddle_function(void)
*
* === 'strcpy'
*
- * @libc = DL.dlopen "/lib/libc.so.6"
- * => #<DL::Handle:0x00000001d7a8d8>
- * f = Fiddle::Function.new(@libc['strcpy'], [TYPE_VOIDP, TYPE_VOIDP], TYPE_VOIDP)
- * => #<Fiddle::Function:0x00000001d8ee00>
+ * @libc = Fiddle.dlopen "/lib/libc.so.6"
+ * #=> #<Fiddle::Handle:0x00000001d7a8d8>
+ * f = Fiddle::Function.new(
+ * @libc['strcpy'],
+ * [Fiddle::TYPE_VOIDP, Fiddle::TYPE_VOIDP],
+ * Fiddle::TYPE_VOIDP)
+ * #=> #<Fiddle::Function:0x00000001d8ee00>
* buff = "000"
- * => "000"
+ * #=> "000"
* str = f.call(buff, "123")
- * => #<DL::CPtr:0x00000001d0c380 ptr=0x000000018a21b8 size=0 free=0x00000000000000>
+ * #=> #<Fiddle::Pointer:0x00000001d0c380 ptr=0x000000018a21b8 size=0 free=0x00000000000000>
* str.to_s
* => "123"
*
* === ABI check
*
* @libc = DL.dlopen "/lib/libc.so.6"
- * => #<DL::Handle:0x00000001d7a8d8>
+ * #=> #<Fiddle::Handle:0x00000001d7a8d8>
* f = Fiddle::Function.new(@libc['strcpy'], [TYPE_VOIDP, TYPE_VOIDP], TYPE_VOIDP)
- * => #<Fiddle::Function:0x00000001d8ee00>
+ * #=> #<Fiddle::Function:0x00000001d8ee00>
* f.abi == Fiddle::Function::DEFAULT
- * => true
+ * #=> true
*/
cFiddleFunction = rb_define_class_under(mFiddle, "Function", rb_cObject);
@@ -215,7 +243,7 @@ Init_fiddle_function(void)
* call-seq: new(ptr, args, ret_type, abi = DEFAULT)
*
* Constructs a Function object.
- * * +ptr+ is a referenced function, of a DL::Handle
+ * * +ptr+ is a referenced function, of a Fiddle::Handle
* * +args+ is an Array of arguments, passed to the +ptr+ function
* * +ret_type+ is the return type of the function
* * +abi+ is the ABI of the function
diff --git a/ext/fiddle/handle.c b/ext/fiddle/handle.c
new file mode 100644
index 0000000000..330dbafe67
--- /dev/null
+++ b/ext/fiddle/handle.c
@@ -0,0 +1,477 @@
+#include <ruby.h>
+#include <fiddle.h>
+
+VALUE rb_cHandle;
+
+struct dl_handle {
+ void *ptr;
+ int open;
+ int enable_close;
+};
+
+#ifdef _WIN32
+# ifndef _WIN32_WCE
+static void *
+w32_coredll(void)
+{
+ MEMORY_BASIC_INFORMATION m;
+ memset(&m, 0, sizeof(m));
+ if( !VirtualQuery(_errno, &m, sizeof(m)) ) return NULL;
+ return m.AllocationBase;
+}
+# endif
+
+static int
+w32_dlclose(void *ptr)
+{
+# ifndef _WIN32_WCE
+ if( ptr == w32_coredll() ) return 0;
+# endif
+ if( FreeLibrary((HMODULE)ptr) ) return 0;
+ return errno = rb_w32_map_errno(GetLastError());
+}
+#define dlclose(ptr) w32_dlclose(ptr)
+#endif
+
+static void
+fiddle_handle_free(void *ptr)
+{
+ struct dl_handle *fiddle_handle = ptr;
+ if( fiddle_handle->ptr && fiddle_handle->open && fiddle_handle->enable_close ){
+ dlclose(fiddle_handle->ptr);
+ }
+}
+
+static size_t
+fiddle_handle_memsize(const void *ptr)
+{
+ return ptr ? sizeof(struct dl_handle) : 0;
+}
+
+static const rb_data_type_t fiddle_handle_data_type = {
+ "fiddle/handle",
+ {0, fiddle_handle_free, fiddle_handle_memsize,},
+};
+
+/*
+ * call-seq: close
+ *
+ * Close this handle.
+ *
+ * Calling close more than once will raise a Fiddle::DLError exception.
+ */
+static VALUE
+rb_fiddle_handle_close(VALUE self)
+{
+ struct dl_handle *fiddle_handle;
+
+ TypedData_Get_Struct(self, struct dl_handle, &fiddle_handle_data_type, fiddle_handle);
+ if(fiddle_handle->open) {
+ int ret = dlclose(fiddle_handle->ptr);
+ fiddle_handle->open = 0;
+
+ /* Check dlclose for successful return value */
+ if(ret) {
+#if defined(HAVE_DLERROR)
+ rb_raise(rb_eFiddleError, "%s", dlerror());
+#else
+ rb_raise(rb_eFiddleError, "could not close handle");
+#endif
+ }
+ return INT2NUM(ret);
+ }
+ rb_raise(rb_eFiddleError, "dlclose() called too many times");
+
+ UNREACHABLE;
+}
+
+static VALUE
+rb_fiddle_handle_s_allocate(VALUE klass)
+{
+ VALUE obj;
+ struct dl_handle *fiddle_handle;
+
+ obj = TypedData_Make_Struct(rb_cHandle, struct dl_handle, &fiddle_handle_data_type, fiddle_handle);
+ fiddle_handle->ptr = 0;
+ fiddle_handle->open = 0;
+ fiddle_handle->enable_close = 0;
+
+ return obj;
+}
+
+static VALUE
+predefined_fiddle_handle(void *handle)
+{
+ VALUE obj = rb_fiddle_handle_s_allocate(rb_cHandle);
+ struct dl_handle *fiddle_handle = DATA_PTR(obj);
+
+ fiddle_handle->ptr = handle;
+ fiddle_handle->open = 1;
+ OBJ_FREEZE(obj);
+ return obj;
+}
+
+/*
+ * call-seq:
+ * new(library = nil, flags = Fiddle::RTLD_LAZY | Fiddle::RTLD_GLOBAL)
+ *
+ * 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)
+{
+ void *ptr;
+ struct dl_handle *fiddle_handle;
+ VALUE lib, flag;
+ char *clib;
+ int cflag;
+ const char *err;
+
+ switch( rb_scan_args(argc, argv, "02", &lib, &flag) ){
+ case 0:
+ clib = NULL;
+ cflag = RTLD_LAZY | RTLD_GLOBAL;
+ break;
+ case 1:
+ clib = NIL_P(lib) ? NULL : StringValuePtr(lib);
+ cflag = RTLD_LAZY | RTLD_GLOBAL;
+ break;
+ case 2:
+ clib = NIL_P(lib) ? NULL : StringValuePtr(lib);
+ cflag = NUM2INT(flag);
+ break;
+ default:
+ rb_bug("rb_fiddle_handle_new");
+ }
+
+ rb_secure(2);
+
+#if defined(_WIN32)
+ if( !clib ){
+ HANDLE rb_libruby_handle(void);
+ ptr = rb_libruby_handle();
+ }
+ else if( STRCASECMP(clib, "libc") == 0
+# ifdef RUBY_COREDLL
+ || STRCASECMP(clib, RUBY_COREDLL) == 0
+ || STRCASECMP(clib, RUBY_COREDLL".dll") == 0
+# endif
+ ){
+# ifdef _WIN32_WCE
+ ptr = dlopen("coredll.dll", cflag);
+# else
+ ptr = w32_coredll();
+# endif
+ }
+ else
+#endif
+ ptr = dlopen(clib, cflag);
+#if defined(HAVE_DLERROR)
+ if( !ptr && (err = dlerror()) ){
+ rb_raise(rb_eFiddleError, "%s", err);
+ }
+#else
+ if( !ptr ){
+ err = dlerror();
+ rb_raise(rb_eFiddleError, "%s", err);
+ }
+#endif
+ TypedData_Get_Struct(self, struct dl_handle, &fiddle_handle_data_type, fiddle_handle);
+ if( fiddle_handle->ptr && fiddle_handle->open && fiddle_handle->enable_close ){
+ dlclose(fiddle_handle->ptr);
+ }
+ fiddle_handle->ptr = ptr;
+ fiddle_handle->open = 1;
+ fiddle_handle->enable_close = 0;
+
+ if( rb_block_given_p() ){
+ rb_ensure(rb_yield, self, rb_fiddle_handle_close, self);
+ }
+
+ return Qnil;
+}
+
+/*
+ * call-seq: enable_close
+ *
+ * Enable a call to dlclose() when this handle is garbage collected.
+ */
+static VALUE
+rb_fiddle_handle_enable_close(VALUE self)
+{
+ struct dl_handle *fiddle_handle;
+
+ TypedData_Get_Struct(self, struct dl_handle, &fiddle_handle_data_type, fiddle_handle);
+ fiddle_handle->enable_close = 1;
+ return Qnil;
+}
+
+/*
+ * call-seq: disable_close
+ *
+ * Disable a call to dlclose() when this handle is garbage collected.
+ */
+static VALUE
+rb_fiddle_handle_disable_close(VALUE self)
+{
+ struct dl_handle *fiddle_handle;
+
+ TypedData_Get_Struct(self, struct dl_handle, &fiddle_handle_data_type, fiddle_handle);
+ fiddle_handle->enable_close = 0;
+ return Qnil;
+}
+
+/*
+ * call-seq: close_enabled?
+ *
+ * Returns +true+ if dlclose() will be called when this handle is garbage collected.
+ *
+ * See man(3) dlclose() for more info.
+ */
+static VALUE
+rb_fiddle_handle_close_enabled_p(VALUE self)
+{
+ struct dl_handle *fiddle_handle;
+
+ TypedData_Get_Struct(self, struct dl_handle, &fiddle_handle_data_type, fiddle_handle);
+
+ if(fiddle_handle->enable_close) return Qtrue;
+ return Qfalse;
+}
+
+/*
+ * call-seq: to_i
+ *
+ * Returns the memory address for this handle.
+ */
+static VALUE
+rb_fiddle_handle_to_i(VALUE self)
+{
+ struct dl_handle *fiddle_handle;
+
+ TypedData_Get_Struct(self, struct dl_handle, &fiddle_handle_data_type, fiddle_handle);
+ return PTR2NUM(fiddle_handle);
+}
+
+static VALUE fiddle_handle_sym(void *handle, const char *symbol);
+
+/*
+ * Document-method: sym
+ *
+ * call-seq: sym(name)
+ *
+ * Get the address as an Integer for the function named +name+.
+ */
+static VALUE
+rb_fiddle_handle_sym(VALUE self, VALUE sym)
+{
+ struct dl_handle *fiddle_handle;
+
+ TypedData_Get_Struct(self, struct dl_handle, &fiddle_handle_data_type, fiddle_handle);
+ if( ! fiddle_handle->open ){
+ rb_raise(rb_eFiddleError, "closed handle");
+ }
+
+ return fiddle_handle_sym(fiddle_handle->ptr, StringValueCStr(sym));
+}
+
+#ifndef RTLD_NEXT
+#define RTLD_NEXT NULL
+#endif
+#ifndef RTLD_DEFAULT
+#define RTLD_DEFAULT NULL
+#endif
+
+/*
+ * Document-method: sym
+ *
+ * call-seq: sym(name)
+ *
+ * Get the address as an Integer for the function named +name+. The function
+ * is searched via dlsym on RTLD_NEXT.
+ *
+ * See man(3) dlsym() for more info.
+ */
+static VALUE
+rb_fiddle_handle_s_sym(VALUE self, VALUE sym)
+{
+ return fiddle_handle_sym(RTLD_NEXT, StringValueCStr(sym));
+}
+
+static VALUE
+fiddle_handle_sym(void *handle, const char *name)
+{
+#if defined(HAVE_DLERROR)
+ const char *err;
+# define CHECK_DLERROR if( err = dlerror() ){ func = 0; }
+#else
+# define CHECK_DLERROR
+#endif
+ void (*func)();
+
+ rb_secure(2);
+#ifdef HAVE_DLERROR
+ dlerror();
+#endif
+ func = (void (*)())(VALUE)dlsym(handle, name);
+ CHECK_DLERROR;
+#if defined(FUNC_STDCALL)
+ if( !func ){
+ int i;
+ int len = (int)strlen(name);
+ char *name_n;
+#if defined(__CYGWIN__) || defined(_WIN32) || defined(__MINGW32__)
+ {
+ char *name_a = (char*)xmalloc(len+2);
+ strcpy(name_a, name);
+ name_n = name_a;
+ name_a[len] = 'A';
+ name_a[len+1] = '\0';
+ func = dlsym(handle, name_a);
+ CHECK_DLERROR;
+ if( func ) goto found;
+ name_n = xrealloc(name_a, len+6);
+ }
+#else
+ name_n = (char*)xmalloc(len+6);
+#endif
+ memcpy(name_n, name, len);
+ name_n[len++] = '@';
+ for( i = 0; i < 256; i += 4 ){
+ sprintf(name_n + len, "%d", i);
+ func = dlsym(handle, name_n);
+ CHECK_DLERROR;
+ if( func ) break;
+ }
+ if( func ) goto found;
+ name_n[len-1] = 'A';
+ name_n[len++] = '@';
+ for( i = 0; i < 256; i += 4 ){
+ sprintf(name_n + len, "%d", i);
+ func = dlsym(handle, name_n);
+ CHECK_DLERROR;
+ if( func ) break;
+ }
+ found:
+ xfree(name_n);
+ }
+#endif
+ if( !func ){
+ rb_raise(rb_eFiddleError, "unknown symbol \"%s\"", name);
+ }
+
+ return PTR2NUM(func);
+}
+
+void
+Init_fiddle_handle(void)
+{
+ /*
+ * Document-class: Fiddle::Handle
+ *
+ * The Fiddle::Handle is the manner to access the dynamic library
+ *
+ * == Example
+ *
+ * === Setup
+ *
+ * libc_so = "/lib64/libc.so.6"
+ * => "/lib64/libc.so.6"
+ * @handle = Fiddle::Handle.new(libc_so)
+ * => #<Fiddle::Handle:0x00000000d69ef8>
+ *
+ * === Setup, with flags
+ *
+ * libc_so = "/lib64/libc.so.6"
+ * => "/lib64/libc.so.6"
+ * @handle = Fiddle::Handle.new(libc_so, Fiddle::RTLD_LAZY | Fiddle::RTLD_GLOBAL)
+ * => #<Fiddle::Handle:0x00000000d69ef8>
+ *
+ * See RTLD_LAZY and RTLD_GLOBAL
+ *
+ * === Addresses to symbols
+ *
+ * strcpy_addr = @handle['strcpy']
+ * => 140062278451968
+ *
+ * or
+ *
+ * strcpy_addr = @handle.sym('strcpy')
+ * => 140062278451968
+ *
+ */
+ rb_cHandle = rb_define_class_under(mFiddle, "Handle", rb_cObject);
+ rb_define_alloc_func(rb_cHandle, rb_fiddle_handle_s_allocate);
+ rb_define_singleton_method(rb_cHandle, "sym", rb_fiddle_handle_s_sym, 1);
+ rb_define_singleton_method(rb_cHandle, "[]", rb_fiddle_handle_s_sym, 1);
+
+ /* Document-const: NEXT
+ *
+ * A predefined pseudo-handle of RTLD_NEXT
+ *
+ * Which will find the next occurrence of a function in the search order
+ * after the current library.
+ */
+ rb_define_const(rb_cHandle, "NEXT", predefined_fiddle_handle(RTLD_NEXT));
+
+ /* Document-const: DEFAULT
+ *
+ * A predefined pseudo-handle of RTLD_DEFAULT
+ *
+ * Which will find the first occurrence of the desired symbol using the
+ * default library search order
+ */
+ rb_define_const(rb_cHandle, "DEFAULT", predefined_fiddle_handle(RTLD_DEFAULT));
+
+ /* Document-const: RTLD_GLOBAL
+ *
+ * rtld Fiddle::Handle flag.
+ *
+ * The symbols defined by this library will be made available for symbol
+ * resolution of subsequently loaded libraries.
+ */
+ rb_define_const(rb_cHandle, "RTLD_GLOBAL", INT2NUM(RTLD_GLOBAL));
+
+ /* Document-const: RTLD_LAZY
+ *
+ * rtld Fiddle::Handle flag.
+ *
+ * Perform lazy binding. Only resolve symbols as the code that references
+ * them is executed. If the symbol is never referenced, then it is never
+ * resolved. (Lazy binding is only performed for function references;
+ * references to variables are always immediately bound when the library
+ * is loaded.)
+ */
+ rb_define_const(rb_cHandle, "RTLD_LAZY", INT2NUM(RTLD_LAZY));
+
+ /* Document-const: RTLD_NOW
+ *
+ * rtld Fiddle::Handle flag.
+ *
+ * If this value is specified or the environment variable LD_BIND_NOW is
+ * set to a nonempty string, all undefined symbols in the library are
+ * resolved before Fiddle.dlopen returns. If this cannot be done an error
+ * is returned.
+ */
+ rb_define_const(rb_cHandle, "RTLD_NOW", INT2NUM(RTLD_NOW));
+
+ rb_define_method(rb_cHandle, "initialize", rb_fiddle_handle_initialize, -1);
+ rb_define_method(rb_cHandle, "to_i", rb_fiddle_handle_to_i, 0);
+ rb_define_method(rb_cHandle, "close", rb_fiddle_handle_close, 0);
+ rb_define_method(rb_cHandle, "sym", rb_fiddle_handle_sym, 1);
+ rb_define_method(rb_cHandle, "[]", rb_fiddle_handle_sym, 1);
+ rb_define_method(rb_cHandle, "disable_close", rb_fiddle_handle_disable_close, 0);
+ rb_define_method(rb_cHandle, "enable_close", rb_fiddle_handle_enable_close, 0);
+ rb_define_method(rb_cHandle, "close_enabled?", rb_fiddle_handle_close_enabled_p, 0);
+}
+
+/* vim: set noet sws=4 sw=4: */
diff --git a/ext/fiddle/lib/fiddle.rb b/ext/fiddle/lib/fiddle.rb
index 7d55a1f7ad..ae6e299637 100644
--- a/ext/fiddle/lib/fiddle.rb
+++ b/ext/fiddle/lib/fiddle.rb
@@ -1,13 +1,8 @@
require 'fiddle.so'
require 'fiddle/function'
require 'fiddle/closure'
-require 'dl' unless Object.const_defined?(:DL)
module Fiddle
-
- # A reference to DL::CPtr
- Pointer = DL::CPtr
-
if WINDOWS
# Returns the last win32 +Error+ of the current executing +Thread+ or nil
# if none
@@ -31,4 +26,30 @@ module Fiddle
Thread.current[:__DL2_LAST_ERROR__] = error
Thread.current[:__FIDDLE_LAST_ERROR__] = error
end
+
+ # call-seq: dlopen(library) => Fiddle::Handle
+ #
+ # 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
+ end
+ module_function :dlopen
+
+ # Add constants for backwards compat
+
+ RTLD_GLOBAL = Handle::RTLD_GLOBAL # :nodoc:
+ RTLD_LAZY = Handle::RTLD_LAZY # :nodoc:
+ RTLD_NOW = Handle::RTLD_NOW # :nodoc:
end
diff --git a/ext/fiddle/lib/fiddle/cparser.rb b/ext/fiddle/lib/fiddle/cparser.rb
new file mode 100644
index 0000000000..43fb184a12
--- /dev/null
+++ b/ext/fiddle/lib/fiddle/cparser.rb
@@ -0,0 +1,176 @@
+module Fiddle
+ # A mixin that provides methods for parsing C struct and prototype signatures.
+ #
+ # == Example
+ # require 'fiddle/import'
+ #
+ # include Fiddle::CParser
+ # #=> Object
+ #
+ # parse_ctype('int increment(int)')
+ # #=> ["increment", Fiddle::TYPE_INT, [Fiddle::TYPE_INT]]
+ #
+ module CParser
+ # Parses a C struct's members
+ #
+ # Example:
+ #
+ # include Fiddle::CParser
+ # #=> Object
+ #
+ # parse_struct_signature(['int i', 'char c'])
+ # #=> [[Fiddle::TYPE_INT, Fiddle::TYPE_CHAR], ["i", "c"]]
+ #
+ def parse_struct_signature(signature, tymap=nil)
+ if( signature.is_a?(String) )
+ signature = signature.split(/\s*,\s*/)
+ end
+ mems = []
+ tys = []
+ signature.each{|msig|
+ tks = msig.split(/\s+(\*)?/)
+ ty = tks[0..-2].join(" ")
+ member = tks[-1]
+
+ case ty
+ when /\[(\d+)\]/
+ n = $1.to_i
+ ty.gsub!(/\s*\[\d+\]/,"")
+ ty = [ty, n]
+ when /\[\]/
+ ty.gsub!(/\s*\[\]/, "*")
+ end
+
+ case member
+ when /\[(\d+)\]/
+ ty = [ty, $1.to_i]
+ member.gsub!(/\s*\[\d+\]/,"")
+ when /\[\]/
+ ty = ty + "*"
+ member.gsub!(/\s*\[\]/, "")
+ end
+
+ mems.push(member)
+ tys.push(parse_ctype(ty,tymap))
+ }
+ return tys, mems
+ end
+
+ # Parses a C prototype signature
+ #
+ # If Hash +tymap+ is provided, the return value and the arguments from the
+ # +signature+ are expected to be keys, and the value will be the C type to
+ # be looked up.
+ #
+ # Example:
+ #
+ # include Fiddle::CParser
+ # #=> Object
+ #
+ # parse_signature('double sum(double, double)')
+ # #=> ["sum", Fiddle::TYPE_DOUBLE, [Fiddle::TYPE_DOUBLE, Fiddle::TYPE_DOUBLE]]
+ #
+ def parse_signature(signature, tymap=nil)
+ tymap ||= {}
+ signature = signature.gsub(/\s+/, " ").strip
+ case signature
+ when /^([\w@\*\s]+)\(([\w\*\s\,\[\]]*)\)$/
+ ret = $1
+ (args = $2).strip!
+ ret = ret.split(/\s+/)
+ args = args.split(/\s*,\s*/)
+ func = ret.pop
+ if( func =~ /^\*/ )
+ func.gsub!(/^\*+/,"")
+ ret.push("*")
+ end
+ ret = ret.join(" ")
+ return [func, parse_ctype(ret, tymap), args.collect{|arg| parse_ctype(arg, tymap)}]
+ else
+ raise(RuntimeError,"can't parse the function prototype: #{signature}")
+ end
+ end
+
+ # Given a String of C type +ty+, returns the corresponding Fiddle constant.
+ #
+ # +ty+ can also accept an Array of C type Strings, and will be returned in
+ # a corresponding Array.
+ #
+ # If Hash +tymap+ is provided, +ty+ is expected to be the key, and the
+ # value will be the C type to be looked up.
+ #
+ # Example:
+ #
+ # include Fiddle::CParser
+ # #=> Object
+ #
+ # parse_ctype('int')
+ # #=> Fiddle::TYPE_INT
+ #
+ # parse_ctype('double')
+ # #=> Fiddle::TYPE_DOUBLE
+ #
+ # parse_ctype('unsigned char')
+ # #=> -Fiddle::TYPE_CHAR
+ #
+ def parse_ctype(ty, tymap=nil)
+ tymap ||= {}
+ case ty
+ when Array
+ return [parse_ctype(ty[0], tymap), ty[1]]
+ when "void"
+ return TYPE_VOID
+ when "char"
+ return TYPE_CHAR
+ when "unsigned char"
+ return -TYPE_CHAR
+ when "short"
+ return TYPE_SHORT
+ when "unsigned short"
+ return -TYPE_SHORT
+ when "int"
+ return TYPE_INT
+ when "unsigned int", 'uint'
+ return -TYPE_INT
+ when "long"
+ return TYPE_LONG
+ when "unsigned long"
+ return -TYPE_LONG
+ when "long long"
+ if( defined?(TYPE_LONG_LONG) )
+ return TYPE_LONG_LONG
+ else
+ raise(RuntimeError, "unsupported type: #{ty}")
+ end
+ when "unsigned long long"
+ if( defined?(TYPE_LONG_LONG) )
+ return -TYPE_LONG_LONG
+ else
+ raise(RuntimeError, "unsupported type: #{ty}")
+ end
+ when "float"
+ return TYPE_FLOAT
+ when "double"
+ return TYPE_DOUBLE
+ when "size_t"
+ return TYPE_SIZE_T
+ when "ssize_t"
+ return TYPE_SSIZE_T
+ when "ptrdiff_t"
+ return TYPE_PTRDIFF_T
+ when "intptr_t"
+ return TYPE_INTPTR_T
+ when "uintptr_t"
+ return TYPE_UINTPTR_T
+ when /\*/, /\[\s*\]/
+ return TYPE_VOIDP
+ else
+ if( tymap[ty] )
+ return parse_ctype(tymap[ty], tymap)
+ else
+ raise(DLError, "unknown type: #{ty}")
+ end
+ end
+ end
+ end
+end
diff --git a/ext/fiddle/lib/fiddle/function.rb b/ext/fiddle/lib/fiddle/function.rb
index 1657682498..ab7496e944 100644
--- a/ext/fiddle/lib/fiddle/function.rb
+++ b/ext/fiddle/lib/fiddle/function.rb
@@ -2,5 +2,16 @@ module Fiddle
class Function
# The ABI of the Function.
attr_reader :abi
+
+ # The address of this function
+ attr_reader :ptr
+
+ # The name of this function
+ attr_reader :name
+
+ # The integer memory location of this function
+ def to_i
+ ptr.to_i
+ end
end
end
diff --git a/ext/fiddle/lib/fiddle/import.rb b/ext/fiddle/lib/fiddle/import.rb
new file mode 100644
index 0000000000..8b948e8f23
--- /dev/null
+++ b/ext/fiddle/lib/fiddle/import.rb
@@ -0,0 +1,314 @@
+require 'fiddle'
+require 'fiddle/struct'
+require 'fiddle/cparser'
+
+module Fiddle
+
+ # Used internally by Fiddle::Importer
+ class CompositeHandler
+ # Create a new handler with the open +handlers+
+ #
+ # Used internally by Fiddle::Importer.dlload
+ def initialize(handlers)
+ @handlers = handlers
+ end
+
+ # Array of the currently loaded libraries.
+ def handlers()
+ @handlers
+ end
+
+ # Returns the address as an Integer from any handlers with the function
+ # named +symbol+.
+ #
+ # Raises a DLError if the handle is closed.
+ def sym(symbol)
+ @handlers.each{|handle|
+ if( handle )
+ begin
+ addr = handle.sym(symbol)
+ return addr
+ rescue DLError
+ end
+ end
+ }
+ return nil
+ end
+
+ # See Fiddle::CompositeHandler.sym
+ def [](symbol)
+ sym(symbol)
+ end
+ end
+
+ # A DSL that provides the means to dynamically load libraries and build
+ # modules around them including calling extern functions within the C
+ # library that has been loaded.
+ #
+ # == Example
+ #
+ # require 'fiddle'
+ # require 'fiddle/import'
+ #
+ # module LibSum
+ # extend Fiddle::Importer
+ # dlload './libsum.so'
+ # extern 'double sum(double*, int)'
+ # extern 'double split(double)'
+ # end
+ #
+ module Importer
+ include Fiddle
+ include CParser
+ 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 using Fiddle.dlopen
+ #
+ # Raises a DLError if the library cannot be loaded.
+ #
+ # See Fiddle.dlopen
+ def dlload(*libs)
+ handles = libs.collect{|lib|
+ case lib
+ when nil
+ nil
+ when Handle
+ lib
+ when Importer
+ lib.handlers
+ else
+ begin
+ Fiddle.dlopen(lib)
+ rescue DLError
+ raise(DLError, "can't load #{lib}")
+ end
+ end
+ }.flatten()
+ @handler = CompositeHandler.new(handles)
+ @func_map = {}
+ @type_alias = {}
+ end
+
+ # Sets the type alias for +alias_type+ as +orig_type+
+ def typealias(alias_type, orig_type)
+ @type_alias[alias_type] = orig_type
+ end
+
+ # Returns the sizeof +ty+, using Fiddle::Importer.parse_ctype to determine
+ # the C type and the appropriate Fiddle constant.
+ def sizeof(ty)
+ case ty
+ when String
+ ty = parse_ctype(ty, @type_alias).abs()
+ case ty
+ when TYPE_CHAR
+ return SIZEOF_CHAR
+ when TYPE_SHORT
+ return SIZEOF_SHORT
+ when TYPE_INT
+ return SIZEOF_INT
+ when TYPE_LONG
+ return SIZEOF_LONG
+ when TYPE_LONG_LONG
+ return SIZEOF_LONG_LON
+ when TYPE_FLOAT
+ return SIZEOF_FLOAT
+ when TYPE_DOUBLE
+ return SIZEOF_DOUBLE
+ when TYPE_VOIDP
+ return SIZEOF_VOIDP
+ else
+ raise(DLError, "unknown type: #{ty}")
+ end
+ when Class
+ if( ty.instance_methods().include?(:to_ptr) )
+ return ty.size()
+ end
+ end
+ return Pointer[ty].size()
+ end
+
+ def parse_bind_options(opts)
+ h = {}
+ while( opt = opts.shift() )
+ case opt
+ when :stdcall, :cdecl
+ h[:call_type] = opt
+ when :carried, :temp, :temporal, :bind
+ h[:callback_type] = opt
+ h[:carrier] = opts.shift()
+ else
+ h[opt] = true
+ end
+ end
+ h
+ end
+ private :parse_bind_options
+
+ # :stopdoc:
+ CALL_TYPE_TO_ABI = Hash.new { |h, k|
+ raise RuntimeError, "unsupported call type: #{k}"
+ }.merge({ :stdcall => (Function::STDCALL rescue Function::DEFAULT),
+ :cdecl => Function::DEFAULT,
+ nil => Function::DEFAULT
+ }).freeze
+ private_constant :CALL_TYPE_TO_ABI
+ # :startdoc:
+
+ # Creates a global method from the given C +signature+.
+ def extern(signature, *opts)
+ symname, ctype, argtype = parse_signature(signature, @type_alias)
+ opt = parse_bind_options(opts)
+ f = import_function(symname, ctype, argtype, opt[:call_type])
+ name = symname.gsub(/@.+/,'')
+ @func_map[name] = f
+ # define_method(name){|*args,&block| f.call(*args,&block)}
+ begin
+ /^(.+?):(\d+)/ =~ caller.first
+ file, line = $1, $2.to_i
+ rescue
+ file, line = __FILE__, __LINE__+3
+ end
+ module_eval(<<-EOS, file, line)
+ def #{name}(*args, &block)
+ @func_map['#{name}'].call(*args,&block)
+ end
+ EOS
+ module_function(name)
+ f
+ end
+
+ # Creates a global method from the given C +signature+ using the given
+ # +opts+ as bind parameters with the given block.
+ def bind(signature, *opts, &blk)
+ name, ctype, argtype = parse_signature(signature, @type_alias)
+ h = parse_bind_options(opts)
+ case h[:callback_type]
+ when :bind, nil
+ f = bind_function(name, ctype, argtype, h[:call_type], &blk)
+ else
+ raise(RuntimeError, "unknown callback type: #{h[:callback_type]}")
+ end
+ @func_map[name] = f
+ #define_method(name){|*args,&block| f.call(*args,&block)}
+ begin
+ /^(.+?):(\d+)/ =~ caller.first
+ file, line = $1, $2.to_i
+ rescue
+ file, line = __FILE__, __LINE__+3
+ end
+ module_eval(<<-EOS, file, line)
+ def #{name}(*args,&block)
+ @func_map['#{name}'].call(*args,&block)
+ end
+ EOS
+ module_function(name)
+ f
+ end
+
+ # Creates a class to wrap the C struct described by +signature+.
+ #
+ # MyStruct = struct ['int i', 'char c']
+ def struct(signature)
+ tys, mems = parse_struct_signature(signature, @type_alias)
+ Fiddle::CStructBuilder.create(CStruct, tys, mems)
+ end
+
+ # Creates a class to wrap the C union described by +signature+.
+ #
+ # MyUnion = union ['int i', 'char c']
+ def union(signature)
+ tys, mems = parse_struct_signature(signature, @type_alias)
+ Fiddle::CStructBuilder.create(CUnion, tys, mems)
+ end
+
+ # Returns the function mapped to +name+, that was created by either
+ # Fiddle::Importer.extern or Fiddle::Importer.bind
+ def [](name)
+ @func_map[name]
+ end
+
+ # Creates a class to wrap the C struct with the value +ty+
+ #
+ # See also Fiddle::Importer.struct
+ def create_value(ty, val=nil)
+ s = struct([ty + " value"])
+ ptr = s.malloc()
+ if( val )
+ ptr.value = val
+ end
+ return ptr
+ end
+ alias value create_value
+
+ # Returns a new instance of the C struct with the value +ty+ at the +addr+
+ # address.
+ def import_value(ty, addr)
+ s = struct([ty + " value"])
+ ptr = s.new(addr)
+ return ptr
+ end
+
+
+ # The Fiddle::CompositeHandler instance
+ #
+ # Will raise an error if no handlers are open.
+ def handler
+ @handler or raise "call dlload before importing symbols and functions"
+ end
+
+ # Returns a new Fiddle::Pointer instance at the memory address of the given
+ # +name+ symbol.
+ #
+ # Raises a DLError if the +name+ doesn't exist.
+ #
+ # See Fiddle::CompositeHandler.sym and Fiddle::Handle.sym
+ def import_symbol(name)
+ addr = handler.sym(name)
+ if( !addr )
+ raise(DLError, "cannot find the symbol: #{name}")
+ end
+ Pointer.new(addr)
+ end
+
+ # Returns a new Fiddle::Function instance at the memory address of the given
+ # +name+ function.
+ #
+ # Raises a DLError if the +name+ doesn't exist.
+ #
+ # * +argtype+ is an Array of arguments, passed to the +name+ function.
+ # * +ctype+ is the return type of the function
+ # * +call_type+ is the ABI of the function
+ #
+ # See also Fiddle:Function.new
+ #
+ # See Fiddle::CompositeHandler.sym and Fiddle::Handler.sym
+ def import_function(name, ctype, argtype, call_type = nil)
+ addr = handler.sym(name)
+ if( !addr )
+ raise(DLError, "cannot find the function: #{name}()")
+ end
+ Function.new(addr, argtype, ctype, CALL_TYPE_TO_ABI[call_type],
+ name: name)
+ end
+
+ # Returns a new closure wrapper for the +name+ function.
+ #
+ # * +ctype+ is the return type of the function
+ # * +argtype+ is an Array of arguments, passed to the callback function
+ # * +call_type+ is the abi of the closure
+ # * +block+ is passed to the callback
+ #
+ # See Fiddle::Closure
+ def bind_function(name, ctype, argtype, call_type = nil, &block)
+ abi = CALL_TYPE_TO_ABI[call_type]
+ closure = Class.new(Fiddle::Closure) {
+ define_method(:call, block)
+ }.new(ctype, argtype, abi)
+
+ Function.new(closure, argtype, ctype, abi, name: name)
+ end
+ end
+end
diff --git a/ext/fiddle/lib/fiddle/pack.rb b/ext/fiddle/lib/fiddle/pack.rb
new file mode 100644
index 0000000000..e4e9542cc0
--- /dev/null
+++ b/ext/fiddle/lib/fiddle/pack.rb
@@ -0,0 +1,128 @@
+require 'fiddle'
+
+module Fiddle
+ module PackInfo # :nodoc: all
+ ALIGN_MAP = {
+ TYPE_VOIDP => ALIGN_VOIDP,
+ TYPE_CHAR => ALIGN_CHAR,
+ TYPE_SHORT => ALIGN_SHORT,
+ TYPE_INT => ALIGN_INT,
+ TYPE_LONG => ALIGN_LONG,
+ TYPE_FLOAT => ALIGN_FLOAT,
+ TYPE_DOUBLE => ALIGN_DOUBLE,
+ -TYPE_CHAR => ALIGN_CHAR,
+ -TYPE_SHORT => ALIGN_SHORT,
+ -TYPE_INT => ALIGN_INT,
+ -TYPE_LONG => ALIGN_LONG,
+ }
+
+ PACK_MAP = {
+ TYPE_VOIDP => ((SIZEOF_VOIDP == SIZEOF_LONG_LONG) ? "q" : "l!"),
+ TYPE_CHAR => "c",
+ TYPE_SHORT => "s!",
+ TYPE_INT => "i!",
+ TYPE_LONG => "l!",
+ TYPE_FLOAT => "f",
+ TYPE_DOUBLE => "d",
+ -TYPE_CHAR => "c",
+ -TYPE_SHORT => "s!",
+ -TYPE_INT => "i!",
+ -TYPE_LONG => "l!",
+ }
+
+ SIZE_MAP = {
+ TYPE_VOIDP => SIZEOF_VOIDP,
+ TYPE_CHAR => SIZEOF_CHAR,
+ TYPE_SHORT => SIZEOF_SHORT,
+ TYPE_INT => SIZEOF_INT,
+ TYPE_LONG => SIZEOF_LONG,
+ TYPE_FLOAT => SIZEOF_FLOAT,
+ TYPE_DOUBLE => SIZEOF_DOUBLE,
+ -TYPE_CHAR => SIZEOF_CHAR,
+ -TYPE_SHORT => SIZEOF_SHORT,
+ -TYPE_INT => SIZEOF_INT,
+ -TYPE_LONG => SIZEOF_LONG,
+ }
+ if defined?(TYPE_LONG_LONG)
+ ALIGN_MAP[TYPE_LONG_LONG] = ALIGN_MAP[-TYPE_LONG_LONG] = ALIGN_LONG_LONG
+ PACK_MAP[TYPE_LONG_LONG] = PACK_MAP[-TYPE_LONG_LONG] = "q"
+ SIZE_MAP[TYPE_LONG_LONG] = SIZE_MAP[-TYPE_LONG_LONG] = SIZEOF_LONG_LONG
+ end
+
+ def align(addr, align)
+ d = addr % align
+ if( d == 0 )
+ addr
+ else
+ addr + (align - d)
+ end
+ end
+ module_function :align
+ end
+
+ class Packer # :nodoc: all
+ include PackInfo
+
+ def self.[](*types)
+ new(types)
+ end
+
+ def initialize(types)
+ parse_types(types)
+ end
+
+ def size()
+ @size
+ end
+
+ def pack(ary)
+ case SIZEOF_VOIDP
+ when SIZEOF_LONG
+ ary.pack(@template)
+ when SIZEOF_LONG_LONG
+ ary.pack(@template)
+ else
+ raise(RuntimeError, "sizeof(void*)?")
+ end
+ end
+
+ def unpack(ary)
+ case SIZEOF_VOIDP
+ when SIZEOF_LONG
+ ary.join().unpack(@template)
+ when SIZEOF_LONG_LONG
+ ary.join().unpack(@template)
+ else
+ raise(RuntimeError, "sizeof(void*)?")
+ end
+ end
+
+ private
+
+ def parse_types(types)
+ @template = ""
+ addr = 0
+ types.each{|t|
+ orig_addr = addr
+ if( t.is_a?(Array) )
+ addr = align(orig_addr, ALIGN_MAP[TYPE_VOIDP])
+ else
+ addr = align(orig_addr, ALIGN_MAP[t])
+ end
+ d = addr - orig_addr
+ if( d > 0 )
+ @template << "x#{d}"
+ end
+ if( t.is_a?(Array) )
+ @template << (PACK_MAP[t[0]] * t[1])
+ addr += (SIZE_MAP[t[0]] * t[1])
+ else
+ @template << PACK_MAP[t]
+ addr += SIZE_MAP[t]
+ end
+ }
+ addr = align(addr, ALIGN_MAP[TYPE_VOIDP])
+ @size = addr
+ end
+ end
+end
diff --git a/ext/fiddle/lib/fiddle/struct.rb b/ext/fiddle/lib/fiddle/struct.rb
new file mode 100644
index 0000000000..695a4d2247
--- /dev/null
+++ b/ext/fiddle/lib/fiddle/struct.rb
@@ -0,0 +1,243 @@
+require 'fiddle'
+require 'fiddle/value'
+require 'fiddle/pack'
+
+module Fiddle
+ # C struct shell
+ class CStruct
+ # accessor to Fiddle::CStructEntity
+ def CStruct.entity_class
+ CStructEntity
+ end
+ end
+
+ # C union shell
+ class CUnion
+ # accessor to Fiddle::CUnionEntity
+ def CUnion.entity_class
+ CUnionEntity
+ end
+ end
+
+ # Used to construct C classes (CUnion, CStruct, etc)
+ #
+ # Fiddle::Importer#struct and Fiddle::Importer#union wrap this functionality in an
+ # easy-to-use manner.
+ module CStructBuilder
+ # Construct a new class given a C:
+ # * class +klass+ (CUnion, CStruct, or other that provide an
+ # #entity_class)
+ # * +types+ (Fiddle::TYPE_INT, Fiddle::TYPE_SIZE_T, etc., see the C types
+ # constants)
+ # * corresponding +members+
+ #
+ # Fiddle::Importer#struct and Fiddle::Importer#union wrap this functionality in an
+ # easy-to-use manner.
+ #
+ # Example:
+ #
+ # require 'fiddle/struct'
+ # require 'fiddle/cparser'
+ #
+ # include Fiddle::CParser
+ #
+ # types, members = parse_struct_signature(['int i','char c'])
+ #
+ # MyStruct = Fiddle::CStructBuilder.create(Fiddle::CUnion, types, members)
+ #
+ # obj = MyStruct.allocate
+ #
+ def create(klass, types, members)
+ new_class = Class.new(klass){
+ define_method(:initialize){|addr|
+ @entity = klass.entity_class.new(addr, types)
+ @entity.assign_names(members)
+ }
+ define_method(:to_ptr){ @entity }
+ define_method(:to_i){ @entity.to_i }
+ members.each{|name|
+ define_method(name){ @entity[name] }
+ define_method(name + "="){|val| @entity[name] = val }
+ }
+ }
+ size = klass.entity_class.size(types)
+ new_class.module_eval(<<-EOS, __FILE__, __LINE__+1)
+ def new_class.size()
+ #{size}
+ end
+ def new_class.malloc()
+ addr = Fiddle.malloc(#{size})
+ new(addr)
+ end
+ EOS
+ return new_class
+ end
+ module_function :create
+ end
+
+ # A C struct wrapper
+ class CStructEntity < Fiddle::Pointer
+ include PackInfo
+ include ValueUtil
+
+ # Allocates a C struct with the +types+ provided.
+ #
+ # When the instance is garbage collected, the C function +func+ is called.
+ def CStructEntity.malloc(types, func = nil)
+ addr = Fiddle.malloc(CStructEntity.size(types))
+ CStructEntity.new(addr, types, func)
+ end
+
+ # Returns the offset for the packed sizes for the given +types+.
+ #
+ # Fiddle::CStructEntity.size(
+ # [ Fiddle::TYPE_DOUBLE,
+ # Fiddle::TYPE_INT,
+ # Fiddle::TYPE_CHAR,
+ # Fiddle::TYPE_VOIDP ]) #=> 24
+ def CStructEntity.size(types)
+ offset = 0
+
+ max_align = types.map { |type, count = 1|
+ last_offset = offset
+
+ align = PackInfo::ALIGN_MAP[type]
+ offset = PackInfo.align(last_offset, align) +
+ (PackInfo::SIZE_MAP[type] * count)
+
+ align
+ }.max
+
+ PackInfo.align(offset, max_align)
+ end
+
+ # Wraps the C pointer +addr+ as a C struct with the given +types+.
+ #
+ # When the instance is garbage collected, the C function +func+ is called.
+ #
+ # See also Fiddle::Pointer.new
+ def initialize(addr, types, func = nil)
+ set_ctypes(types)
+ super(addr, @size, func)
+ end
+
+ # Set the names of the +members+ in this C struct
+ def assign_names(members)
+ @members = members
+ end
+
+ # Calculates the offsets and sizes for the given +types+ in the struct.
+ def set_ctypes(types)
+ @ctypes = types
+ @offset = []
+ offset = 0
+
+ max_align = types.map { |type, count = 1|
+ orig_offset = offset
+ align = ALIGN_MAP[type]
+ offset = PackInfo.align(orig_offset, align)
+
+ @offset << offset
+
+ offset += (SIZE_MAP[type] * count)
+
+ align
+ }.max
+
+ @size = PackInfo.align(offset, max_align)
+ end
+
+ # Fetch struct member +name+
+ def [](name)
+ idx = @members.index(name)
+ if( idx.nil? )
+ raise(ArgumentError, "no such member: #{name}")
+ end
+ ty = @ctypes[idx]
+ if( ty.is_a?(Array) )
+ r = super(@offset[idx], SIZE_MAP[ty[0]] * ty[1])
+ else
+ r = super(@offset[idx], SIZE_MAP[ty.abs])
+ end
+ packer = Packer.new([ty])
+ val = packer.unpack([r])
+ case ty
+ when Array
+ case ty[0]
+ when TYPE_VOIDP
+ val = val.collect{|v| Pointer.new(v)}
+ end
+ when TYPE_VOIDP
+ val = Pointer.new(val[0])
+ else
+ val = val[0]
+ end
+ if( ty.is_a?(Integer) && (ty < 0) )
+ return unsigned_value(val, ty)
+ elsif( ty.is_a?(Array) && (ty[0] < 0) )
+ return val.collect{|v| unsigned_value(v,ty[0])}
+ else
+ return val
+ end
+ end
+
+ # Set struct member +name+, to value +val+
+ def []=(name, val)
+ idx = @members.index(name)
+ if( idx.nil? )
+ raise(ArgumentError, "no such member: #{name}")
+ end
+ ty = @ctypes[idx]
+ packer = Packer.new([ty])
+ val = wrap_arg(val, ty, [])
+ buff = packer.pack([val].flatten())
+ super(@offset[idx], buff.size, buff)
+ if( ty.is_a?(Integer) && (ty < 0) )
+ return unsigned_value(val, ty)
+ elsif( ty.is_a?(Array) && (ty[0] < 0) )
+ return val.collect{|v| unsigned_value(v,ty[0])}
+ else
+ return val
+ end
+ end
+
+ def to_s() # :nodoc:
+ super(@size)
+ end
+ end
+
+ # A C union wrapper
+ class CUnionEntity < CStructEntity
+ include PackInfo
+
+ # Allocates a C union the +types+ provided.
+ #
+ # When the instance is garbage collected, the C function +func+ is called.
+ def CUnionEntity.malloc(types, func=nil)
+ addr = Fiddle.malloc(CUnionEntity.size(types))
+ CUnionEntity.new(addr, types, func)
+ end
+
+ # Returns the size needed for the union with the given +types+.
+ #
+ # Fiddle::CUnionEntity.size(
+ # [ Fiddle::TYPE_DOUBLE,
+ # Fiddle::TYPE_INT,
+ # Fiddle::TYPE_CHAR,
+ # Fiddle::TYPE_VOIDP ]) #=> 8
+ def CUnionEntity.size(types)
+ types.map { |type, count = 1|
+ PackInfo::SIZE_MAP[type] * count
+ }.max
+ end
+
+ # Calculate the necessary offset and for each union member with the given
+ # +types+
+ def set_ctypes(types)
+ @ctypes = types
+ @offset = Array.new(types.length, 0)
+ @size = self.class.size types
+ end
+ end
+end
+
diff --git a/ext/fiddle/lib/fiddle/types.rb b/ext/fiddle/lib/fiddle/types.rb
new file mode 100644
index 0000000000..02c1d25a37
--- /dev/null
+++ b/ext/fiddle/lib/fiddle/types.rb
@@ -0,0 +1,71 @@
+module Fiddle
+ # Adds Windows type aliases to the including class for use with
+ # Fiddle::Importer.
+ #
+ # The aliases added are:
+ # * ATOM
+ # * BOOL
+ # * BYTE
+ # * DWORD
+ # * DWORD32
+ # * DWORD64
+ # * HANDLE
+ # * HDC
+ # * HINSTANCE
+ # * HWND
+ # * LPCSTR
+ # * LPSTR
+ # * PBYTE
+ # * PDWORD
+ # * PHANDLE
+ # * PVOID
+ # * PWORD
+ # * UCHAR
+ # * UINT
+ # * ULONG
+ # * WORD
+ module Win32Types
+ def included(m) # :nodoc:
+ m.module_eval{
+ typealias "DWORD", "unsigned long"
+ typealias "PDWORD", "unsigned long *"
+ typealias "DWORD32", "unsigned long"
+ typealias "DWORD64", "unsigned long long"
+ typealias "WORD", "unsigned short"
+ typealias "PWORD", "unsigned short *"
+ typealias "BOOL", "int"
+ typealias "ATOM", "int"
+ typealias "BYTE", "unsigned char"
+ typealias "PBYTE", "unsigned char *"
+ typealias "UINT", "unsigned int"
+ typealias "ULONG", "unsigned long"
+ typealias "UCHAR", "unsigned char"
+ typealias "HANDLE", "uintptr_t"
+ typealias "PHANDLE", "void*"
+ typealias "PVOID", "void*"
+ typealias "LPCSTR", "char*"
+ typealias "LPSTR", "char*"
+ typealias "HINSTANCE", "unsigned int"
+ typealias "HDC", "unsigned int"
+ typealias "HWND", "unsigned int"
+ }
+ end
+ module_function :included
+ end
+
+ # Adds basic type aliases to the including class for use with Fiddle::Importer.
+ #
+ # The aliases added are +uint+ and +u_int+ (<tt>unsigned int</tt>) and
+ # +ulong+ and +u_long+ (<tt>unsigned long</tt>)
+ module BasicTypes
+ def included(m) # :nodoc:
+ m.module_eval{
+ typealias "uint", "unsigned int"
+ typealias "u_int", "unsigned int"
+ typealias "ulong", "unsigned long"
+ typealias "u_long", "unsigned long"
+ }
+ end
+ module_function :included
+ end
+end
diff --git a/ext/fiddle/lib/fiddle/value.rb b/ext/fiddle/lib/fiddle/value.rb
new file mode 100644
index 0000000000..8d71e47ce6
--- /dev/null
+++ b/ext/fiddle/lib/fiddle/value.rb
@@ -0,0 +1,112 @@
+require 'fiddle'
+
+module Fiddle
+ module ValueUtil #:nodoc: all
+ def unsigned_value(val, ty)
+ case ty.abs
+ when TYPE_CHAR
+ [val].pack("c").unpack("C")[0]
+ when TYPE_SHORT
+ [val].pack("s!").unpack("S!")[0]
+ when TYPE_INT
+ [val].pack("i!").unpack("I!")[0]
+ when TYPE_LONG
+ [val].pack("l!").unpack("L!")[0]
+ when TYPE_LONG_LONG
+ [val].pack("q").unpack("Q")[0]
+ else
+ val
+ end
+ end
+
+ def signed_value(val, ty)
+ case ty.abs
+ when TYPE_CHAR
+ [val].pack("C").unpack("c")[0]
+ when TYPE_SHORT
+ [val].pack("S!").unpack("s!")[0]
+ when TYPE_INT
+ [val].pack("I!").unpack("i!")[0]
+ when TYPE_LONG
+ [val].pack("L!").unpack("l!")[0]
+ when TYPE_LONG_LONG
+ [val].pack("Q").unpack("q")[0]
+ else
+ val
+ end
+ end
+
+ def wrap_args(args, tys, funcs, &block)
+ result = []
+ tys ||= []
+ args.each_with_index{|arg, idx|
+ result.push(wrap_arg(arg, tys[idx], funcs, &block))
+ }
+ result
+ end
+
+ def wrap_arg(arg, ty, funcs = [], &block)
+ funcs ||= []
+ case arg
+ when nil
+ return 0
+ when Pointer
+ return arg.to_i
+ when IO
+ case ty
+ when TYPE_VOIDP
+ return Pointer[arg].to_i
+ else
+ return arg.to_i
+ end
+ when Function
+ if( block )
+ arg.bind_at_call(&block)
+ funcs.push(arg)
+ elsif !arg.bound?
+ raise(RuntimeError, "block must be given.")
+ end
+ return arg.to_i
+ when String
+ if( ty.is_a?(Array) )
+ return arg.unpack('C*')
+ else
+ case SIZEOF_VOIDP
+ when SIZEOF_LONG
+ return [arg].pack("p").unpack("l!")[0]
+ when SIZEOF_LONG_LONG
+ return [arg].pack("p").unpack("q")[0]
+ else
+ raise(RuntimeError, "sizeof(void*)?")
+ end
+ end
+ when Float, Integer
+ return arg
+ when Array
+ if( ty.is_a?(Array) ) # used only by struct
+ case ty[0]
+ when TYPE_VOIDP
+ return arg.collect{|v| Integer(v)}
+ when TYPE_CHAR
+ if( arg.is_a?(String) )
+ return val.unpack('C*')
+ end
+ end
+ return arg
+ else
+ return arg
+ end
+ else
+ if( arg.respond_to?(:to_ptr) )
+ return arg.to_ptr.to_i
+ else
+ begin
+ return Integer(arg)
+ rescue
+ raise(ArgumentError, "unknown argument type: #{arg.class}")
+ end
+ end
+ end
+ end
+ end
+end
diff --git a/ext/fiddle/pointer.c b/ext/fiddle/pointer.c
new file mode 100644
index 0000000000..4f4842fc33
--- /dev/null
+++ b/ext/fiddle/pointer.c
@@ -0,0 +1,713 @@
+/* -*- C -*-
+ * $Id$
+ */
+
+#include <ruby/ruby.h>
+#include <ruby/io.h>
+#include <ctype.h>
+#include <fiddle.h>
+
+VALUE rb_cPointer;
+
+typedef void (*freefunc_t)(void*);
+
+struct ptr_data {
+ void *ptr;
+ long size;
+ freefunc_t free;
+ VALUE wrap[2];
+};
+
+#define RPTR_DATA(obj) ((struct ptr_data *)(DATA_PTR(obj)))
+
+static inline freefunc_t
+get_freefunc(VALUE func, volatile VALUE *wrap)
+{
+ VALUE addrnum;
+ if (NIL_P(func)) {
+ *wrap = 0;
+ return NULL;
+ }
+ addrnum = rb_Integer(func);
+ *wrap = (addrnum != func) ? func : 0;
+ return (freefunc_t)(VALUE)NUM2PTR(addrnum);
+}
+
+static ID id_to_ptr;
+
+static void
+fiddle_ptr_mark(void *ptr)
+{
+ struct ptr_data *data = ptr;
+ if (data->wrap[0]) {
+ rb_gc_mark(data->wrap[0]);
+ }
+ if (data->wrap[1]) {
+ rb_gc_mark(data->wrap[1]);
+ }
+}
+
+static void
+fiddle_ptr_free(void *ptr)
+{
+ struct ptr_data *data = ptr;
+ if (data->ptr) {
+ if (data->free) {
+ (*(data->free))(data->ptr);
+ }
+ }
+}
+
+static size_t
+fiddle_ptr_memsize(const void *ptr)
+{
+ const struct ptr_data *data = ptr;
+ return data ? sizeof(*data) + data->size : 0;
+}
+
+static const rb_data_type_t fiddle_ptr_data_type = {
+ "fiddle/pointer",
+ {fiddle_ptr_mark, fiddle_ptr_free, fiddle_ptr_memsize,},
+};
+
+static VALUE
+rb_fiddle_ptr_new2(VALUE klass, void *ptr, long size, freefunc_t func)
+{
+ struct ptr_data *data;
+ VALUE val;
+
+ val = TypedData_Make_Struct(klass, struct ptr_data, &fiddle_ptr_data_type, data);
+ data->ptr = ptr;
+ data->free = func;
+ data->size = size;
+ OBJ_TAINT(val);
+
+ return val;
+}
+
+static VALUE
+rb_fiddle_ptr_new(void *ptr, long size, freefunc_t func)
+{
+ return rb_fiddle_ptr_new2(rb_cPointer, ptr, size, func);
+}
+
+static VALUE
+rb_fiddle_ptr_malloc(long size, freefunc_t func)
+{
+ void *ptr;
+
+ ptr = ruby_xmalloc((size_t)size);
+ memset(ptr,0,(size_t)size);
+ return rb_fiddle_ptr_new(ptr, size, func);
+}
+
+static void *
+rb_fiddle_ptr2cptr(VALUE val)
+{
+ struct ptr_data *data;
+ void *ptr;
+
+ if (rb_obj_is_kind_of(val, rb_cPointer)) {
+ TypedData_Get_Struct(val, struct ptr_data, &fiddle_ptr_data_type, data);
+ ptr = data->ptr;
+ }
+ else if (val == Qnil) {
+ ptr = NULL;
+ }
+ else{
+ rb_raise(rb_eTypeError, "Fiddle::Pointer was expected");
+ }
+
+ return ptr;
+}
+
+static VALUE
+rb_fiddle_ptr_s_allocate(VALUE klass)
+{
+ VALUE obj;
+ struct ptr_data *data;
+
+ obj = TypedData_Make_Struct(klass, struct ptr_data, &fiddle_ptr_data_type, data);
+ data->ptr = 0;
+ data->size = 0;
+ data->free = 0;
+
+ return obj;
+}
+
+/*
+ * call-seq:
+ * Fiddle::Pointer.new(address) => fiddle_cptr
+ * new(address, size) => fiddle_cptr
+ * new(address, size, freefunc) => fiddle_cptr
+ *
+ * Create a new pointer to +address+ with an optional +size+ and +freefunc+.
+ *
+ * +freefunc+ will be called when the instance is garbage collected.
+ */
+static VALUE
+rb_fiddle_ptr_initialize(int argc, VALUE argv[], VALUE self)
+{
+ VALUE ptr, sym, size, wrap = 0, funcwrap = 0;
+ struct ptr_data *data;
+ void *p = NULL;
+ freefunc_t f = NULL;
+ long s = 0;
+
+ if (rb_scan_args(argc, argv, "12", &ptr, &size, &sym) >= 1) {
+ VALUE addrnum = rb_Integer(ptr);
+ if (addrnum != ptr) wrap = ptr;
+ p = NUM2PTR(addrnum);
+ }
+ if (argc >= 2) {
+ s = NUM2LONG(size);
+ }
+ if (argc >= 3) {
+ f = get_freefunc(sym, &funcwrap);
+ }
+
+ if (p) {
+ TypedData_Get_Struct(self, struct ptr_data, &fiddle_ptr_data_type, data);
+ if (data->ptr && data->free) {
+ /* Free previous memory. Use of inappropriate initialize may cause SEGV. */
+ (*(data->free))(data->ptr);
+ }
+ data->wrap[0] = wrap;
+ data->wrap[1] = funcwrap;
+ data->ptr = p;
+ data->size = s;
+ data->free = f;
+ }
+
+ return Qnil;
+}
+
+/*
+ * call-seq:
+ *
+ * Fiddle::Pointer.malloc(size, freefunc = nil) => fiddle pointer instance
+ *
+ * Allocate +size+ bytes of memory and associate it with an optional
+ * +freefunc+ that will be called when the pointer is garbage collected.
+ *
+ * +freefunc+ must be an address pointing to a function or an instance of
+ * Fiddle::Function
+ */
+static VALUE
+rb_fiddle_ptr_s_malloc(int argc, VALUE argv[], VALUE klass)
+{
+ VALUE size, sym, obj, wrap = 0;
+ long s;
+ freefunc_t f;
+
+ switch (rb_scan_args(argc, argv, "11", &size, &sym)) {
+ case 1:
+ s = NUM2LONG(size);
+ f = NULL;
+ break;
+ case 2:
+ s = NUM2LONG(size);
+ f = get_freefunc(sym, &wrap);
+ break;
+ default:
+ rb_bug("rb_fiddle_ptr_s_malloc");
+ }
+
+ obj = rb_fiddle_ptr_malloc(s,f);
+ if (wrap) RPTR_DATA(obj)->wrap[1] = wrap;
+
+ return obj;
+}
+
+/*
+ * call-seq: to_i
+ *
+ * Returns the integer memory location of this pointer.
+ */
+static VALUE
+rb_fiddle_ptr_to_i(VALUE self)
+{
+ struct ptr_data *data;
+
+ TypedData_Get_Struct(self, struct ptr_data, &fiddle_ptr_data_type, data);
+ return PTR2NUM(data->ptr);
+}
+
+/*
+ * call-seq: to_value
+ *
+ * Cast this pointer to a ruby object.
+ */
+static VALUE
+rb_fiddle_ptr_to_value(VALUE self)
+{
+ struct ptr_data *data;
+ TypedData_Get_Struct(self, struct ptr_data, &fiddle_ptr_data_type, data);
+ return (VALUE)(data->ptr);
+}
+
+/*
+ * call-seq: ptr
+ *
+ * Returns a new Fiddle::Pointer instance that is a dereferenced pointer for
+ * this pointer.
+ *
+ * Analogous to the star operator in C.
+ */
+static VALUE
+rb_fiddle_ptr_ptr(VALUE self)
+{
+ struct ptr_data *data;
+
+ TypedData_Get_Struct(self, struct ptr_data, &fiddle_ptr_data_type, data);
+ return rb_fiddle_ptr_new(*((void**)(data->ptr)),0,0);
+}
+
+/*
+ * call-seq: ref
+ *
+ * Returns a new Fiddle::Pointer instance that is a reference pointer for this
+ * pointer.
+ *
+ * Analogous to the ampersand operator in C.
+ */
+static VALUE
+rb_fiddle_ptr_ref(VALUE self)
+{
+ struct ptr_data *data;
+
+ TypedData_Get_Struct(self, struct ptr_data, &fiddle_ptr_data_type, data);
+ return rb_fiddle_ptr_new(&(data->ptr),0,0);
+}
+
+/*
+ * call-seq: null?
+ *
+ * Returns +true+ if this is a null pointer.
+ */
+static VALUE
+rb_fiddle_ptr_null_p(VALUE self)
+{
+ struct ptr_data *data;
+
+ TypedData_Get_Struct(self, struct ptr_data, &fiddle_ptr_data_type, data);
+ return data->ptr ? Qfalse : Qtrue;
+}
+
+/*
+ * call-seq: free=(function)
+ *
+ * Set the free function for this pointer to +function+ in the given
+ * Fiddle::Function.
+ */
+static VALUE
+rb_fiddle_ptr_free_set(VALUE self, VALUE val)
+{
+ struct ptr_data *data;
+
+ TypedData_Get_Struct(self, struct ptr_data, &fiddle_ptr_data_type, data);
+ data->free = get_freefunc(val, &data->wrap[1]);
+
+ return Qnil;
+}
+
+/*
+ * call-seq: free => Fiddle::Function
+ *
+ * Get the free function for this pointer.
+ *
+ * Returns a new instance of Fiddle::Function.
+ *
+ * See Fiddle::Function.new
+ */
+static VALUE
+rb_fiddle_ptr_free_get(VALUE self)
+{
+ struct ptr_data *pdata;
+ VALUE address;
+ VALUE arg_types;
+ VALUE ret_type;
+
+ TypedData_Get_Struct(self, struct ptr_data, &fiddle_ptr_data_type, pdata);
+
+ if (!pdata->free)
+ return Qnil;
+
+ address = PTR2NUM(pdata->free);
+ ret_type = INT2NUM(TYPE_VOID);
+ arg_types = rb_ary_new();
+ rb_ary_push(arg_types, INT2NUM(TYPE_VOIDP));
+
+ return rb_fiddle_new_function(address, arg_types, ret_type);
+}
+
+/*
+ * call-seq:
+ *
+ * ptr.to_s => string
+ * ptr.to_s(len) => string
+ *
+ * Returns the pointer contents as a string.
+ *
+ * When called with no arguments, this method will return the contents until
+ * the first NULL byte.
+ *
+ * When called with +len+, a string of +len+ bytes will be returned.
+ *
+ * See to_str
+ */
+static VALUE
+rb_fiddle_ptr_to_s(int argc, VALUE argv[], VALUE self)
+{
+ struct ptr_data *data;
+ VALUE arg1, val;
+ int len;
+
+ TypedData_Get_Struct(self, struct ptr_data, &fiddle_ptr_data_type, data);
+ switch (rb_scan_args(argc, argv, "01", &arg1)) {
+ case 0:
+ val = rb_tainted_str_new2((char*)(data->ptr));
+ break;
+ case 1:
+ len = NUM2INT(arg1);
+ val = rb_tainted_str_new((char*)(data->ptr), len);
+ break;
+ default:
+ rb_bug("rb_fiddle_ptr_to_s");
+ }
+
+ return val;
+}
+
+/*
+ * call-seq:
+ *
+ * ptr.to_str => string
+ * ptr.to_str(len) => string
+ *
+ * Returns the pointer contents as a string.
+ *
+ * When called with no arguments, this method will return the contents with the
+ * length of this pointer's +size+.
+ *
+ * When called with +len+, a string of +len+ bytes will be returned.
+ *
+ * See to_s
+ */
+static VALUE
+rb_fiddle_ptr_to_str(int argc, VALUE argv[], VALUE self)
+{
+ struct ptr_data *data;
+ VALUE arg1, val;
+ int len;
+
+ TypedData_Get_Struct(self, struct ptr_data, &fiddle_ptr_data_type, data);
+ switch (rb_scan_args(argc, argv, "01", &arg1)) {
+ case 0:
+ val = rb_tainted_str_new((char*)(data->ptr),data->size);
+ break;
+ case 1:
+ len = NUM2INT(arg1);
+ val = rb_tainted_str_new((char*)(data->ptr), len);
+ break;
+ default:
+ rb_bug("rb_fiddle_ptr_to_str");
+ }
+
+ return val;
+}
+
+/*
+ * call-seq: inspect
+ *
+ * Returns a string formatted with an easily readable representation of the
+ * internal state of the pointer.
+ */
+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);
+}
+
+/*
+ * call-seq:
+ * ptr == other => true or false
+ * ptr.eql?(other) => true or false
+ *
+ * Returns true if +other+ wraps the same pointer, otherwise returns
+ * false.
+ */
+static VALUE
+rb_fiddle_ptr_eql(VALUE self, VALUE other)
+{
+ void *ptr1, *ptr2;
+
+ if(!rb_obj_is_kind_of(other, rb_cPointer)) return Qfalse;
+
+ ptr1 = rb_fiddle_ptr2cptr(self);
+ ptr2 = rb_fiddle_ptr2cptr(other);
+
+ return ptr1 == ptr2 ? Qtrue : Qfalse;
+}
+
+/*
+ * call-seq:
+ * ptr <=> other => -1, 0, 1, or nil
+ *
+ * Returns -1 if less than, 0 if equal to, 1 if greater than +other+.
+ *
+ * Returns nil if +ptr+ cannot be compared to +other+.
+ */
+static VALUE
+rb_fiddle_ptr_cmp(VALUE self, VALUE other)
+{
+ void *ptr1, *ptr2;
+ SIGNED_VALUE diff;
+
+ if(!rb_obj_is_kind_of(other, rb_cPointer)) return Qnil;
+
+ ptr1 = rb_fiddle_ptr2cptr(self);
+ ptr2 = rb_fiddle_ptr2cptr(other);
+ diff = (SIGNED_VALUE)ptr1 - (SIGNED_VALUE)ptr2;
+ if (!diff) return INT2FIX(0);
+ return diff > 0 ? INT2NUM(1) : INT2NUM(-1);
+}
+
+/*
+ * call-seq:
+ * ptr + n => new cptr
+ *
+ * Returns a new pointer instance that has been advanced +n+ bytes.
+ */
+static VALUE
+rb_fiddle_ptr_plus(VALUE self, VALUE other)
+{
+ void *ptr;
+ long num, size;
+
+ ptr = rb_fiddle_ptr2cptr(self);
+ size = RPTR_DATA(self)->size;
+ num = NUM2LONG(other);
+ return rb_fiddle_ptr_new((char *)ptr + num, size - num, 0);
+}
+
+/*
+ * call-seq:
+ * ptr - n => new cptr
+ *
+ * Returns a new pointer instance that has been moved back +n+ bytes.
+ */
+static VALUE
+rb_fiddle_ptr_minus(VALUE self, VALUE other)
+{
+ void *ptr;
+ long num, size;
+
+ ptr = rb_fiddle_ptr2cptr(self);
+ size = RPTR_DATA(self)->size;
+ num = NUM2LONG(other);
+ return rb_fiddle_ptr_new((char *)ptr - num, size + num, 0);
+}
+
+/*
+ * call-seq:
+ * ptr[index] -> an_integer
+ * ptr[start, length] -> a_string
+ *
+ * Returns integer stored at _index_.
+ *
+ * If _start_ and _length_ are given, a string containing the bytes from
+ * _start_ of _length_ will be returned.
+ */
+static VALUE
+rb_fiddle_ptr_aref(int argc, VALUE argv[], VALUE self)
+{
+ VALUE arg0, arg1;
+ VALUE retval = Qnil;
+ size_t offset, len;
+ struct ptr_data *data;
+
+ TypedData_Get_Struct(self, struct ptr_data, &fiddle_ptr_data_type, data);
+ if (!data->ptr) rb_raise(rb_eFiddleError, "NULL pointer dereference");
+ switch( rb_scan_args(argc, argv, "11", &arg0, &arg1) ){
+ case 1:
+ offset = NUM2ULONG(arg0);
+ retval = INT2NUM(*((char *)data->ptr + offset));
+ break;
+ case 2:
+ offset = NUM2ULONG(arg0);
+ len = NUM2ULONG(arg1);
+ retval = rb_tainted_str_new((char *)data->ptr + offset, len);
+ break;
+ default:
+ rb_bug("rb_fiddle_ptr_aref()");
+ }
+ return retval;
+}
+
+/*
+ * call-seq:
+ * ptr[index] = int -> int
+ * ptr[start, length] = string or cptr or addr -> string or dl_cptr or addr
+ *
+ * Set the value at +index+ to +int+.
+ *
+ * Or, set the memory at +start+ until +length+ with the contents of +string+,
+ * the memory from +dl_cptr+, or the memory pointed at by the memory address
+ * +addr+.
+ */
+static VALUE
+rb_fiddle_ptr_aset(int argc, VALUE argv[], VALUE self)
+{
+ VALUE arg0, arg1, arg2;
+ VALUE retval = Qnil;
+ size_t offset, len;
+ void *mem;
+ struct ptr_data *data;
+
+ TypedData_Get_Struct(self, struct ptr_data, &fiddle_ptr_data_type, data);
+ if (!data->ptr) rb_raise(rb_eFiddleError, "NULL pointer dereference");
+ switch( rb_scan_args(argc, argv, "21", &arg0, &arg1, &arg2) ){
+ case 2:
+ offset = NUM2ULONG(arg0);
+ ((char*)data->ptr)[offset] = NUM2UINT(arg1);
+ retval = arg1;
+ break;
+ case 3:
+ offset = NUM2ULONG(arg0);
+ len = NUM2ULONG(arg1);
+ if (RB_TYPE_P(arg2, T_STRING)) {
+ mem = StringValuePtr(arg2);
+ }
+ else if( rb_obj_is_kind_of(arg2, rb_cPointer) ){
+ mem = rb_fiddle_ptr2cptr(arg2);
+ }
+ else{
+ mem = NUM2PTR(arg2);
+ }
+ memcpy((char *)data->ptr + offset, mem, len);
+ retval = arg2;
+ break;
+ default:
+ rb_bug("rb_fiddle_ptr_aset()");
+ }
+ return retval;
+}
+
+/*
+ * call-seq: size=(size)
+ *
+ * Set the size of this pointer to +size+
+ */
+static VALUE
+rb_fiddle_ptr_size_set(VALUE self, VALUE size)
+{
+ RPTR_DATA(self)->size = NUM2LONG(size);
+ return size;
+}
+
+/*
+ * call-seq: size
+ *
+ * Get the size of this pointer.
+ */
+static VALUE
+rb_fiddle_ptr_size_get(VALUE self)
+{
+ return LONG2NUM(RPTR_DATA(self)->size);
+}
+
+/*
+ * call-seq:
+ * Fiddle::Pointer[val] => cptr
+ * to_ptr(val) => cptr
+ *
+ * Get the underlying pointer for ruby object +val+ and return it as a
+ * Fiddle::Pointer object.
+ */
+static VALUE
+rb_fiddle_ptr_s_to_ptr(VALUE self, VALUE val)
+{
+ VALUE ptr, wrap = val, vptr;
+
+ if (RTEST(rb_obj_is_kind_of(val, rb_cIO))){
+ rb_io_t *fptr;
+ FILE *fp;
+ GetOpenFile(val, fptr);
+ fp = rb_io_stdio_file(fptr);
+ ptr = rb_fiddle_ptr_new(fp, 0, NULL);
+ }
+ else if (RTEST(rb_obj_is_kind_of(val, rb_cString))){
+ char *str = StringValuePtr(val);
+ ptr = rb_fiddle_ptr_new(str, RSTRING_LEN(val), NULL);
+ }
+ else if ((vptr = rb_check_funcall(val, id_to_ptr, 0, 0)) != Qundef){
+ if (rb_obj_is_kind_of(vptr, rb_cPointer)){
+ ptr = vptr;
+ wrap = 0;
+ }
+ else{
+ rb_raise(rb_eFiddleError, "to_ptr should return a Fiddle::Pointer object");
+ }
+ }
+ else{
+ VALUE num = rb_Integer(val);
+ if (num == val) wrap = 0;
+ ptr = rb_fiddle_ptr_new(NUM2PTR(num), 0, NULL);
+ }
+ OBJ_INFECT(ptr, val);
+ if (wrap) RPTR_DATA(ptr)->wrap[0] = wrap;
+ return ptr;
+}
+
+void
+Init_fiddle_pointer(void)
+{
+ id_to_ptr = rb_intern("to_ptr");
+
+ /* Document-class: Fiddle::Pointer
+ *
+ * Fiddle::Pointer is a class to handle C pointers
+ *
+ */
+ rb_cPointer = rb_define_class_under(mFiddle, "Pointer", rb_cObject);
+ rb_define_alloc_func(rb_cPointer, rb_fiddle_ptr_s_allocate);
+ rb_define_singleton_method(rb_cPointer, "malloc", rb_fiddle_ptr_s_malloc, -1);
+ rb_define_singleton_method(rb_cPointer, "to_ptr", rb_fiddle_ptr_s_to_ptr, 1);
+ rb_define_singleton_method(rb_cPointer, "[]", rb_fiddle_ptr_s_to_ptr, 1);
+ rb_define_method(rb_cPointer, "initialize", rb_fiddle_ptr_initialize, -1);
+ rb_define_method(rb_cPointer, "free=", rb_fiddle_ptr_free_set, 1);
+ rb_define_method(rb_cPointer, "free", rb_fiddle_ptr_free_get, 0);
+ rb_define_method(rb_cPointer, "to_i", rb_fiddle_ptr_to_i, 0);
+ rb_define_method(rb_cPointer, "to_int", rb_fiddle_ptr_to_i, 0);
+ rb_define_method(rb_cPointer, "to_value", rb_fiddle_ptr_to_value, 0);
+ rb_define_method(rb_cPointer, "ptr", rb_fiddle_ptr_ptr, 0);
+ rb_define_method(rb_cPointer, "+@", rb_fiddle_ptr_ptr, 0);
+ rb_define_method(rb_cPointer, "ref", rb_fiddle_ptr_ref, 0);
+ rb_define_method(rb_cPointer, "-@", rb_fiddle_ptr_ref, 0);
+ rb_define_method(rb_cPointer, "null?", rb_fiddle_ptr_null_p, 0);
+ rb_define_method(rb_cPointer, "to_s", rb_fiddle_ptr_to_s, -1);
+ rb_define_method(rb_cPointer, "to_str", rb_fiddle_ptr_to_str, -1);
+ rb_define_method(rb_cPointer, "inspect", rb_fiddle_ptr_inspect, 0);
+ rb_define_method(rb_cPointer, "<=>", rb_fiddle_ptr_cmp, 1);
+ rb_define_method(rb_cPointer, "==", rb_fiddle_ptr_eql, 1);
+ rb_define_method(rb_cPointer, "eql?", rb_fiddle_ptr_eql, 1);
+ rb_define_method(rb_cPointer, "+", rb_fiddle_ptr_plus, 1);
+ rb_define_method(rb_cPointer, "-", rb_fiddle_ptr_minus, 1);
+ rb_define_method(rb_cPointer, "[]", rb_fiddle_ptr_aref, -1);
+ rb_define_method(rb_cPointer, "[]=", rb_fiddle_ptr_aset, -1);
+ rb_define_method(rb_cPointer, "size", rb_fiddle_ptr_size_get, 0);
+ rb_define_method(rb_cPointer, "size=", rb_fiddle_ptr_size_set, 1);
+
+ /* Document-const: NULL
+ *
+ * A NULL pointer
+ */
+ rb_define_const(mFiddle, "NULL", rb_fiddle_ptr_new(0, 0, 0));
+}
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 6f0c14d664..ff0a6524bf 100644
--- a/ext/gdbm/gdbm.c
+++ b/ext/gdbm/gdbm.c
@@ -73,12 +73,18 @@
*/
static VALUE rb_cGDBM, rb_eGDBMError, rb_eGDBMFatalError;
+#if SIZEOF_LONG > SIZEOF_INT
+#define TOO_LONG(n) ((long)(+(int)(n)) != (long)(n))
+#else
+#define TOO_LONG(n) 0
+#endif
+
#define RUBY_GDBM_RW_BIT 0x20000000
#define MY_BLOCK_SIZE (2048)
#define MY_FATAL_FUNC rb_gdbm_fatal
static void
-rb_gdbm_fatal(char *msg)
+rb_gdbm_fatal(const char *msg)
{
rb_raise(rb_eGDBMFatalError, "%s", msg);
}
@@ -204,6 +210,11 @@ fgdbm_initialize(int argc, VALUE *argv, VALUE obj)
SafeStringValue(file);
+#ifdef GDBM_CLOEXEC
+ /* GDBM_CLOEXEC is available since gdbm 1.10. */
+ flags |= GDBM_CLOEXEC;
+#endif
+
if (flags & RUBY_GDBM_RW_BIT) {
flags &= ~RUBY_GDBM_RW_BIT;
dbm = gdbm_open(RSTRING_PTR(file), MY_BLOCK_SIZE,
@@ -222,13 +233,17 @@ fgdbm_initialize(int argc, VALUE *argv, VALUE obj)
GDBM_READER|flags, 0, MY_FATAL_FUNC);
}
+ if (dbm) {
+ rb_fd_fix_cloexec(gdbm_fdesc(dbm));
+ }
+
if (!dbm) {
if (mode == -1) return Qnil;
if (gdbm_errno == GDBM_FILE_OPEN_ERROR ||
gdbm_errno == GDBM_CANT_BE_READER ||
gdbm_errno == GDBM_CANT_BE_WRITER)
- rb_sys_fail(RSTRING_PTR(file));
+ rb_sys_fail_str(file);
else
rb_raise(rb_eGDBMError, "%s", gdbm_strerror(gdbm_errno));
}
@@ -297,10 +312,13 @@ static VALUE
rb_gdbm_fetch2(GDBM_FILE dbm, VALUE keystr)
{
datum key;
+ long len;
StringValue(keystr);
+ len = RSTRING_LEN(keystr);
+ if (TOO_LONG(len)) return Qnil;
key.dptr = RSTRING_PTR(keystr);
- key.dsize = (int)RSTRING_LEN(keystr);
+ key.dsize = (int)len;
return rb_gdbm_fetch(dbm, key);
}
@@ -336,9 +354,12 @@ rb_gdbm_nextkey(GDBM_FILE dbm, VALUE keystr)
{
datum key, key2;
VALUE str;
+ long len;
+ len = RSTRING_LEN(keystr);
+ if (TOO_LONG(len)) return Qnil;
key.dptr = RSTRING_PTR(keystr);
- key.dsize = (int)RSTRING_LEN(keystr);
+ key.dsize = (int)len;
key2 = gdbm_nextkey(dbm, key);
if (key2.dptr == 0)
return Qnil;
@@ -485,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");
}
@@ -495,11 +515,14 @@ rb_gdbm_delete(VALUE obj, VALUE keystr)
datum key;
struct dbmdata *dbmp;
GDBM_FILE dbm;
+ long len;
rb_gdbm_modify(obj);
StringValue(keystr);
+ len = RSTRING_LEN(keystr);
+ if (TOO_LONG(len)) return Qnil;
key.dptr = RSTRING_PTR(keystr);
- key.dsize = (int)RSTRING_LEN(keystr);
+ key.dsize = (int)len;
GetDBM2(obj, dbmp, dbm);
if (!gdbm_exists(dbm, key)) {
@@ -570,7 +593,7 @@ fgdbm_delete_if(VALUE obj)
struct dbmdata *dbmp;
GDBM_FILE dbm;
VALUE keystr, valstr;
- VALUE ret, ary = rb_ary_new();
+ VALUE ret, ary = rb_ary_tmp_new(0);
int i, status = 0, n;
rb_gdbm_modify(obj);
@@ -581,8 +604,9 @@ fgdbm_delete_if(VALUE obj)
for (keystr = rb_gdbm_firstkey(dbm); RTEST(keystr);
keystr = rb_gdbm_nextkey(dbm, keystr)) {
+ OBJ_FREEZE(keystr);
valstr = rb_gdbm_fetch2(dbm, keystr);
- ret = rb_protect(rb_yield, rb_assoc_new(keystr, valstr), &status);
+ ret = rb_protect(rb_yield, rb_assoc_new(rb_str_dup(keystr), valstr), &status);
if (status != 0) break;
if (RTEST(ret)) rb_ary_push(ary, keystr);
GetDBM2(obj, dbmp, dbm);
@@ -592,6 +616,7 @@ fgdbm_delete_if(VALUE obj)
rb_gdbm_delete(obj, RARRAY_PTR(ary)[i]);
if (status) rb_jump_tag(status);
if (n > 0) dbmp->di_size = n - (int)RARRAY_LEN(ary);
+ rb_ary_clear(ary);
return obj;
}
@@ -683,10 +708,10 @@ fgdbm_store(VALUE obj, VALUE keystr, VALUE valstr)
StringValue(valstr);
key.dptr = RSTRING_PTR(keystr);
- key.dsize = (int)RSTRING_LEN(keystr);
+ key.dsize = RSTRING_LENINT(keystr);
val.dptr = RSTRING_PTR(valstr);
- val.dsize = (int)RSTRING_LEN(valstr);
+ val.dsize = RSTRING_LENINT(valstr);
GetDBM2(obj, dbmp, dbm);
dbmp->di_size = -1;
@@ -927,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.
@@ -939,10 +966,13 @@ fgdbm_has_key(VALUE obj, VALUE keystr)
datum key;
struct dbmdata *dbmp;
GDBM_FILE dbm;
+ long len;
StringValue(keystr);
+ len = RSTRING_LENINT(keystr);
+ if (TOO_LONG(len)) return Qfalse;
key.dptr = RSTRING_PTR(keystr);
- key.dsize = (int)RSTRING_LEN(keystr);
+ key.dsize = (int)len;
GetDBM2(obj, dbmp, dbm);
if (gdbm_exists(dbm, key))
@@ -1023,6 +1053,7 @@ fgdbm_reorganize(VALUE obj)
rb_gdbm_modify(obj);
GetDBM2(obj, dbmp, dbm);
gdbm_reorganize(dbm);
+ rb_fd_fix_cloexec(gdbm_fdesc(dbm));
return obj;
}
diff --git a/ext/iconv/charset_alias.rb b/ext/iconv/charset_alias.rb
deleted file mode 100644
index cd567a8e2e..0000000000
--- a/ext/iconv/charset_alias.rb
+++ /dev/null
@@ -1,104 +0,0 @@
-#! /usr/bin/ruby
-# :stopdoc:
-require 'rbconfig'
-require 'optparse'
-
-# http://www.ctan.org/get/macros/texinfo/texinfo/gnulib/lib/config.charset
-# Tue, 25 Dec 2007 00:00:00 GMT
-
-OS = RbConfig::CONFIG["target_os"]
-SHELL = RbConfig::CONFIG['SHELL']
-
-class Hash::Ordered < Hash
- def [](key)
- val = super and val.last
- end
- def []=(key, val)
- ary = fetch(key) {return super(key, [self.size, key, val])} and
- ary << val
- end
- def sort
- values.sort.collect {|i, *rest| rest}
- end
- def each(&block)
- sort.each(&block)
- end
-end
-
-def charset_alias(config_charset, mapfile, target = OS)
- map = Hash::Ordered.new
- comments = []
- open(config_charset) do |input|
- input.find {|line| /^case "\$os" in/ =~ line} or break
- input.find {|line|
- /^\s*([-\w\*]+(?:\s*\|\s*[-\w\*]+)*)(?=\))/ =~ line and
- $&.split('|').any? {|pattern| File.fnmatch?(pattern.strip, target)}
- } or break
- input.find do |line|
- case line
- when /^\s*echo "(?:\$\w+\.)?([-\w*]+)\s+([-\w]+)"/
- sys, can = $1, $2
- can.downcase!
- map[can] = sys
- false
- when /^\s*;;/
- true
- else
- false
- end
- end
- end
- case target
- when /linux|-gnu/
- # map.delete('ascii')
- when /cygwin|os2-emx/
- # get rid of tilde/yen problem.
- map['shift_jis'] = 'cp932'
- end
- st = Hash.new(0)
- map = map.sort.collect do |can, *sys|
- if sys.grep(/^en_us(?=.|$)/i) {break true} == true
- noen = %r"^(?!en_us)\w+_\w+#{Regexp.new($')}$"i #"
- sys.reject! {|s| noen =~ s}
- end
- sys = sys.first
- st[sys] += 1
- [can, sys]
- end
- st.delete_if {|sys, i| i == 1}.empty?
- st.keys.each {|sys| st[sys] = nil}
- st.default = nil
- writer = proc do |f|
- f.puts("require 'iconv.so'")
- f.puts
- f.puts(comments)
- f.puts("class Iconv")
- i = 0
- map.each do |can, sys|
- if s = st[sys]
- sys = s
- elsif st.key?(sys)
- sys = (st[sys] = "sys#{i+=1}") + " = '#{sys}'.freeze"
- else
- sys = "'#{sys}'.freeze"
- end
- f.puts(" charset_map['#{can}'] = #{sys}")
- end
- f.puts("end")
- end
- if mapfile
- open(mapfile, "w", &writer)
- else
- writer[STDOUT]
- end
-end
-
-target = OS
-opt = nil
-ARGV.options do |opt2|
- opt = opt2
- opt.banner << " config.status map.rb"
- opt.on("--target OS") {|t| target = t}
- opt.parse! and (1..2) === ARGV.size
-end or abort opt.to_s
-charset_alias(ARGV[0], ARGV[1], target)
diff --git a/ext/iconv/depend b/ext/iconv/depend
deleted file mode 100644
index ac555596ce..0000000000
--- a/ext/iconv/depend
+++ /dev/null
@@ -1,2 +0,0 @@
-iconv.o: iconv.c $(hdrdir)/ruby.h $(topdir)/config.h $(hdrdir)/defines.h \
- $(hdrdir)/st.h $(hdrdir)/intern.h $(hdrdir)/encoding.h
diff --git a/ext/iconv/extconf.rb b/ext/iconv/extconf.rb
deleted file mode 100644
index c4a57c80d6..0000000000
--- a/ext/iconv/extconf.rb
+++ /dev/null
@@ -1,54 +0,0 @@
-require 'mkmf'
-
-dir_config("iconv")
-
-conf = File.exist?(File.join($srcdir, "config.charset"))
-conf = with_config("config-charset", enable_config("config-charset", conf))
-
-if have_func("iconv", "iconv.h") or
- have_library("iconv", "iconv", "iconv.h")
- check_signedness("size_t")
- if checking_for("const of iconv() 2nd argument") do
- create_tmpsrc(cpp_include("iconv.h") + "---> iconv(cd,0,0,0,0) <---")
- src = xpopen(cpp_command("")) {|f|f.read}
- if !(func = src[/^--->\s*(\w+).*\s*<---/, 1])
- Logging::message "iconv function name not found"
- false
- elsif !(second = src[%r"\b#{func}\s*\(.*?,(.*?),.*?\)\s*;"m, 1])
- Logging::message "prototype for #{func}() not found"
- false
- else
- Logging::message $&+"\n"
- /\bconst\b/ =~ second
- end
- end
- $defs.push('-DICONV_INPTR_CONST')
- end
- have_func("iconvlist", "iconv.h")
- have_func("__iconv_free_list", "iconv.h")
- if conf
- prefix = '$(srcdir)'
- prefix = $nmake ? "{#{prefix}}" : "#{prefix}/"
- if $extout
- wrapper = "$(RUBYARCHDIR)/iconv.rb"
- else
- wrapper = "./iconv.rb"
- $INSTALLFILES = [[wrapper, "$(RUBYARCHDIR)"]]
- end
- if String === conf
- require 'uri'
- scheme = URI.parse(conf).scheme
- else
- conf = "$(srcdir)/config.charset"
- end
- $cleanfiles << wrapper
- end
- create_makefile("iconv")
- if conf
- open("Makefile", "a") do |mf|
- mf.print("\nall: #{wrapper}\n\n#{wrapper}: #{prefix}charset_alias.rb")
- mf.print(" ", conf) unless scheme
- mf.print("\n\t$(RUBY) $(srcdir)/charset_alias.rb #{conf} $@\n")
- end
- end
-end
diff --git a/ext/iconv/iconv.c b/ext/iconv/iconv.c
deleted file mode 100644
index 531745c38d..0000000000
--- a/ext/iconv/iconv.c
+++ /dev/null
@@ -1,1256 +0,0 @@
-/* -*- mode:c; c-file-style:"ruby" -*- */
-/**********************************************************************
-
- iconv.c -
-
- $Author$
- created at: Wed Dec 1 20:28:09 JST 1999
-
- All the files in this distribution are covered under the Ruby's
- license (see the file COPYING).
-
- Documentation by Yukihiro Matsumoto and Gavin Sinclair.
-
-**********************************************************************/
-
-#include "ruby/ruby.h"
-#include <errno.h>
-#include <iconv.h>
-#include <assert.h>
-#include "ruby/st.h"
-#include "ruby/encoding.h"
-
-/*
- * Document-class: Iconv
- *
- * == Summary
- *
- * Ruby extension for charset conversion.
- *
- * == Abstract
- *
- * Iconv is a wrapper class for the UNIX 95 <tt>iconv()</tt> function family,
- * which translates string between various encoding systems.
- *
- * See Open Group's on-line documents for more details.
- * * <tt>iconv.h</tt>: http://www.opengroup.org/onlinepubs/007908799/xsh/iconv.h.html
- * * <tt>iconv_open()</tt>: http://www.opengroup.org/onlinepubs/007908799/xsh/iconv_open.html
- * * <tt>iconv()</tt>: http://www.opengroup.org/onlinepubs/007908799/xsh/iconv.html
- * * <tt>iconv_close()</tt>: http://www.opengroup.org/onlinepubs/007908799/xsh/iconv_close.html
- *
- * Which coding systems are available is platform-dependent.
- *
- * == Examples
- *
- * 1. Simple conversion between two charsets.
- *
- * converted_text = Iconv.conv('iso-8859-15', 'utf-8', text)
- *
- * 2. Instantiate a new Iconv and use method Iconv#iconv.
- *
- * cd = Iconv.new(to, from)
- * begin
- * input.each { |s| output << cd.iconv(s) }
- * output << cd.iconv(nil) # Don't forget this!
- * ensure
- * cd.close
- * end
- *
- * 3. Invoke Iconv.open with a block.
- *
- * Iconv.open(to, from) do |cd|
- * input.each { |s| output << cd.iconv(s) }
- * output << cd.iconv(nil)
- * end
- *
- * 4. Shorthand for (3).
- *
- * Iconv.iconv(to, from, *input.to_a)
- *
- * == Attentions
- *
- * Even if some extentions of implementation dependent are useful,
- * DON'T USE those extentions in libraries and scripts to widely distribute.
- * If you want to use those feature, use String#encode.
- */
-
-/* Invalid value for iconv_t is -1 but 0 for VALUE, I hope VALUE is
- big enough to keep iconv_t */
-#define VALUE2ICONV(v) ((iconv_t)((VALUE)(v) ^ -1))
-#define ICONV2VALUE(c) ((VALUE)(c) ^ -1)
-
-struct iconv_env_t
-{
- iconv_t cd;
- int argc;
- VALUE *argv;
- VALUE ret;
- int toidx;
- VALUE (*append)_((VALUE, VALUE));
-};
-
-struct rb_iconv_opt_t
-{
- VALUE transliterate;
- VALUE discard_ilseq;
-};
-
-static ID id_transliterate, id_discard_ilseq;
-
-static VALUE rb_eIconvInvalidEncoding;
-static VALUE rb_eIconvFailure;
-static VALUE rb_eIconvIllegalSeq;
-static VALUE rb_eIconvInvalidChar;
-static VALUE rb_eIconvOutOfRange;
-static VALUE rb_eIconvBrokenLibrary;
-
-static ID rb_success, rb_failed;
-static VALUE iconv_fail _((VALUE error, VALUE success, VALUE failed, struct iconv_env_t* env, const char *mesg));
-static VALUE iconv_fail_retry _((VALUE error, VALUE success, VALUE failed, struct iconv_env_t* env, const char *mesg));
-static VALUE iconv_failure_initialize _((VALUE error, VALUE mesg, VALUE success, VALUE failed));
-static VALUE iconv_failure_success _((VALUE self));
-static VALUE iconv_failure_failed _((VALUE self));
-
-static iconv_t iconv_create _((VALUE to, VALUE from, struct rb_iconv_opt_t *opt, int *idx));
-static void iconv_dfree _((void *cd));
-static VALUE iconv_free _((VALUE cd));
-static VALUE iconv_try _((iconv_t cd, const char **inptr, size_t *inlen, char **outptr, size_t *outlen));
-static VALUE rb_str_derive _((VALUE str, const char* ptr, long len));
-static VALUE iconv_convert _((iconv_t cd, VALUE str, long start, long length, int toidx,
- struct iconv_env_t* env));
-static VALUE iconv_s_allocate _((VALUE klass));
-static VALUE iconv_initialize _((int argc, VALUE *argv, VALUE self));
-static VALUE iconv_s_open _((int argc, VALUE *argv, VALUE self));
-static VALUE iconv_s_convert _((struct iconv_env_t* env));
-static VALUE iconv_s_iconv _((int argc, VALUE *argv, VALUE self));
-static VALUE iconv_init_state _((VALUE cd));
-static VALUE iconv_finish _((VALUE self));
-static VALUE iconv_iconv _((int argc, VALUE *argv, VALUE self));
-static VALUE iconv_conv _((int argc, VALUE *argv, VALUE self));
-
-static VALUE charset_map;
-
-/*
- * Document-method: charset_map
- * call-seq: Iconv.charset_map
- *
- * Returns the map from canonical name to system dependent name.
- */
-static VALUE
-charset_map_get(void)
-{
- return charset_map;
-}
-
-static VALUE
-strip_glibc_option(VALUE *code)
-{
- VALUE val = StringValue(*code);
- const char *ptr = RSTRING_PTR(val), *pend = RSTRING_END(val);
- const char *slash = memchr(ptr, '/', pend - ptr);
-
- if (slash && slash < pend - 1 && slash[1] == '/') {
- VALUE opt = rb_str_subseq(val, slash - ptr, pend - slash);
- val = rb_str_subseq(val, 0, slash - ptr);
- *code = val;
- return opt;
- }
- return 0;
-}
-
-static char *
-map_charset(VALUE *code)
-{
- VALUE val = StringValue(*code);
-
- if (RHASH_SIZE(charset_map)) {
- st_data_t data;
- VALUE key = rb_funcall2(val, rb_intern("downcase"), 0, 0);
- StringValuePtr(key);
- if (st_lookup(RHASH_TBL(charset_map), key, &data)) {
- *code = (VALUE)data;
- }
- }
- return StringValuePtr(*code);
-}
-
-NORETURN(static void rb_iconv_sys_fail(const char *s));
-static void
-rb_iconv_sys_fail(const char *s)
-{
- if (errno == 0) {
- rb_exc_raise(iconv_fail(rb_eIconvBrokenLibrary, Qnil, Qnil, NULL, s));
- }
- rb_sys_fail(s);
-}
-
-#define rb_sys_fail(s) rb_iconv_sys_fail(s)
-
-static iconv_t
-iconv_create(VALUE to, VALUE from, struct rb_iconv_opt_t *opt, int *idx)
-{
- VALUE toopt = strip_glibc_option(&to);
- VALUE fromopt = strip_glibc_option(&from);
- VALUE toenc = 0, fromenc = 0;
- const char* tocode = map_charset(&to);
- const char* fromcode = map_charset(&from);
- iconv_t cd;
- int retry = 0;
-
- *idx = rb_enc_find_index(tocode);
-
- if (toopt) {
- toenc = rb_str_plus(to, toopt);
- tocode = RSTRING_PTR(toenc);
- }
- if (fromopt) {
- fromenc = rb_str_plus(from, fromopt);
- fromcode = RSTRING_PTR(fromenc);
- }
- while ((cd = iconv_open(tocode, fromcode)) == (iconv_t)-1) {
- int inval = 0;
- switch (errno) {
- case EMFILE:
- case ENFILE:
- case ENOMEM:
- if (!retry++) {
- rb_gc();
- continue;
- }
- break;
- case EINVAL:
- retry = 0;
- inval = 1;
- if (toenc) {
- tocode = RSTRING_PTR(to);
- rb_str_resize(toenc, 0);
- toenc = 0;
- continue;
- }
- if (fromenc) {
- fromcode = RSTRING_PTR(from);
- rb_str_resize(fromenc, 0);
- fromenc = 0;
- continue;
- }
- break;
- }
- {
- const char *s = inval ? "invalid encoding " : "iconv";
- volatile VALUE msg = rb_str_new(0, strlen(s) + RSTRING_LEN(to) +
- RSTRING_LEN(from) + 8);
-
- sprintf(RSTRING_PTR(msg), "%s(\"%s\", \"%s\")",
- s, RSTRING_PTR(to), RSTRING_PTR(from));
- s = RSTRING_PTR(msg);
- rb_str_set_len(msg, strlen(s));
- if (!inval) rb_sys_fail(s);
- rb_exc_raise(iconv_fail(rb_eIconvInvalidEncoding, Qnil,
- rb_ary_new3(2, to, from), NULL, s));
- }
- }
-
- if (toopt || fromopt) {
- if (toopt && fromopt && RTEST(rb_str_equal(toopt, fromopt))) {
- fromopt = 0;
- }
- if (toopt && fromopt) {
- rb_warning("encoding option isn't portable: %s, %s",
- RSTRING_PTR(toopt) + 2, RSTRING_PTR(fromopt) + 2);
- }
- else {
- rb_warning("encoding option isn't portable: %s",
- (toopt ? RSTRING_PTR(toopt) : RSTRING_PTR(fromopt)) + 2);
- }
- }
-
- if (opt) {
-#ifdef ICONV_SET_TRANSLITERATE
- if (opt->transliterate != Qundef) {
- int flag = RTEST(opt->transliterate);
- rb_warning("encoding option isn't portable: transliterate");
- if (iconvctl(cd, ICONV_SET_TRANSLITERATE, (void *)&flag))
- rb_sys_fail("ICONV_SET_TRANSLITERATE");
- }
-#endif
-#ifdef ICONV_SET_DISCARD_ILSEQ
- if (opt->discard_ilseq != Qundef) {
- int flag = RTEST(opt->discard_ilseq);
- rb_warning("encoding option isn't portable: discard_ilseq");
- if (iconvctl(cd, ICONV_SET_DISCARD_ILSEQ, (void *)&flag))
- rb_sys_fail("ICONV_SET_DISCARD_ILSEQ");
- }
-#endif
- }
-
- return cd;
-}
-
-static void
-iconv_dfree(void *cd)
-{
- iconv_close(VALUE2ICONV(cd));
-}
-
-#define ICONV_FREE iconv_dfree
-
-static VALUE
-iconv_free(VALUE cd)
-{
- if (cd && iconv_close(VALUE2ICONV(cd)) == -1)
- rb_sys_fail("iconv_close");
- return Qnil;
-}
-
-static VALUE
-check_iconv(VALUE obj)
-{
- Check_Type(obj, T_DATA);
- if (RDATA(obj)->dfree != ICONV_FREE) {
- rb_raise(rb_eArgError, "Iconv expected (%s)", rb_class2name(CLASS_OF(obj)));
- }
- return (VALUE)DATA_PTR(obj);
-}
-
-static VALUE
-iconv_try(iconv_t cd, const char **inptr, size_t *inlen, char **outptr, size_t *outlen)
-{
-#ifdef ICONV_INPTR_CONST
-#define ICONV_INPTR_CAST
-#else
-#define ICONV_INPTR_CAST (char **)
-#endif
- size_t ret;
-
- errno = 0;
- ret = iconv(cd, ICONV_INPTR_CAST inptr, inlen, outptr, outlen);
- if (ret == (size_t)-1) {
- if (!*inlen)
- return Qfalse;
- switch (errno) {
- case E2BIG:
- /* try the left in next loop */
- break;
- case EILSEQ:
- return rb_eIconvIllegalSeq;
- case EINVAL:
- return rb_eIconvInvalidChar;
- case 0:
- return rb_eIconvBrokenLibrary;
- default:
- rb_sys_fail("iconv");
- }
- }
- else if (*inlen > 0) {
- /* something goes wrong */
- return rb_eIconvIllegalSeq;
- }
- else if (ret) {
- return Qnil; /* conversion */
- }
- return Qfalse;
-}
-
-#define FAILED_MAXLEN 16
-
-static VALUE
-iconv_failure_initialize(VALUE error, VALUE mesg, VALUE success, VALUE failed)
-{
- rb_call_super(1, &mesg);
- rb_ivar_set(error, rb_success, success);
- rb_ivar_set(error, rb_failed, failed);
- return error;
-}
-
-static VALUE
-iconv_fail(VALUE error, VALUE success, VALUE failed, struct iconv_env_t* env, const char *mesg)
-{
- VALUE args[3];
-
- if (mesg && *mesg) {
- args[0] = rb_str_new2(mesg);
- }
- else if (TYPE(failed) != T_STRING || RSTRING_LEN(failed) < FAILED_MAXLEN) {
- args[0] = rb_inspect(failed);
- }
- else {
- args[0] = rb_inspect(rb_str_substr(failed, 0, FAILED_MAXLEN));
- rb_str_cat2(args[0], "...");
- }
- args[1] = success;
- args[2] = failed;
- if (env) {
- args[1] = env->append(rb_obj_dup(env->ret), success);
- if (env->argc > 0) {
- *(env->argv) = failed;
- args[2] = rb_ary_new4(env->argc, env->argv);
- }
- }
- return rb_class_new_instance(3, args, error);
-}
-
-static VALUE
-iconv_fail_retry(VALUE error, VALUE success, VALUE failed, struct iconv_env_t* env, const char *mesg)
-{
- error = iconv_fail(error, success, failed, env, mesg);
- if (!rb_block_given_p()) rb_exc_raise(error);
- rb_set_errinfo(error);
- return rb_yield(failed);
-}
-
-static VALUE
-rb_str_derive(VALUE str, const char* ptr, long len)
-{
- VALUE ret;
-
- if (NIL_P(str))
- return rb_str_new(ptr, len);
- if (RSTRING_PTR(str) + RSTRING_LEN(str) == ptr + len)
- ret = rb_str_subseq(str, ptr - RSTRING_PTR(str), len);
- else
- ret = rb_str_new(ptr, len);
- OBJ_INFECT(ret, str);
- return ret;
-}
-
-static VALUE
-iconv_convert(iconv_t cd, VALUE str, long start, long length, int toidx, struct iconv_env_t* env)
-{
- VALUE ret = Qfalse;
- VALUE error = Qfalse;
- VALUE rescue;
- const char *inptr, *instart;
- size_t inlen;
- /* I believe ONE CHARACTER never exceed this. */
- char buffer[BUFSIZ];
- char *outptr;
- size_t outlen;
-
- if (cd == (iconv_t)-1)
- rb_raise(rb_eArgError, "closed iconv");
-
- if (NIL_P(str)) {
- /* Reset output pointer or something. */
- inptr = "";
- inlen = 0;
- outptr = buffer;
- outlen = sizeof(buffer);
- error = iconv_try(cd, &inptr, &inlen, &outptr, &outlen);
- if (RTEST(error)) {
- unsigned int i;
- rescue = iconv_fail_retry(error, Qnil, Qnil, env, 0);
- if (TYPE(rescue) == T_ARRAY) {
- str = RARRAY_LEN(rescue) > 0 ? RARRAY_PTR(rescue)[0] : Qnil;
- }
- if (FIXNUM_P(str) && (i = FIX2INT(str)) <= 0xff) {
- char c = i;
- str = rb_str_new(&c, 1);
- }
- else if (!NIL_P(str)) {
- StringValue(str);
- }
- }
-
- inptr = NULL;
- length = 0;
- }
- else {
- long slen;
-
- StringValue(str);
- slen = RSTRING_LEN(str);
- inptr = RSTRING_PTR(str);
-
- inptr += start;
- if (length < 0 || length > start + slen)
- length = slen - start;
- }
- instart = inptr;
- inlen = length;
-
- do {
- char errmsg[50];
- const char *tmpstart = inptr;
- outptr = buffer;
- outlen = sizeof(buffer);
-
- errmsg[0] = 0;
- error = iconv_try(cd, &inptr, &inlen, &outptr, &outlen);
-
- if (
-#if SIGNEDNESS_OF_SIZE_T < 0
- 0 <= outlen &&
-#endif
- outlen <= sizeof(buffer)) {
- outlen = sizeof(buffer) - outlen;
- if (NIL_P(error) || /* something converted */
- outlen > (size_t)(inptr - tmpstart) || /* input can't contain output */
- (outlen < (size_t)(inptr - tmpstart) && inlen > 0) || /* something skipped */
- memcmp(buffer, tmpstart, outlen)) /* something differs */
- {
- if (NIL_P(str)) {
- ret = rb_str_new(buffer, outlen);
- if (toidx >= 0) rb_enc_associate_index(ret, toidx);
- }
- else {
- if (ret) {
- ret = rb_str_buf_cat(ret, instart, tmpstart - instart);
- }
- else {
- ret = rb_str_new(instart, tmpstart - instart);
- if (toidx >= 0) rb_enc_associate_index(ret, toidx);
- OBJ_INFECT(ret, str);
- }
- ret = rb_str_buf_cat(ret, buffer, outlen);
- instart = inptr;
- }
- }
- else if (!inlen) {
- inptr = tmpstart + outlen;
- }
- }
- else {
- /* Some iconv() have a bug, return *outlen out of range */
- sprintf(errmsg, "bug?(output length = %ld)", (long)(sizeof(buffer) - outlen));
- error = rb_eIconvOutOfRange;
- }
-
- if (RTEST(error)) {
- long len = 0;
-
- if (!ret) {
- ret = rb_str_derive(str, instart, inptr - instart);
- if (toidx >= 0) rb_enc_associate_index(ret, toidx);
- }
- else if (inptr > instart) {
- rb_str_cat(ret, instart, inptr - instart);
- }
- str = rb_str_derive(str, inptr, inlen);
- rescue = iconv_fail_retry(error, ret, str, env, errmsg);
- if (TYPE(rescue) == T_ARRAY) {
- if ((len = RARRAY_LEN(rescue)) > 0)
- rb_str_concat(ret, RARRAY_PTR(rescue)[0]);
- if (len > 1 && !NIL_P(str = RARRAY_PTR(rescue)[1])) {
- StringValue(str);
- inlen = length = RSTRING_LEN(str);
- instart = inptr = RSTRING_PTR(str);
- continue;
- }
- }
- else if (!NIL_P(rescue)) {
- rb_str_concat(ret, rescue);
- }
- break;
- }
- } while (inlen > 0);
-
- if (!ret) {
- ret = rb_str_derive(str, instart, inptr - instart);
- if (toidx >= 0) rb_enc_associate_index(ret, toidx);
- }
- else if (inptr > instart) {
- rb_str_cat(ret, instart, inptr - instart);
- }
- return ret;
-}
-
-static VALUE
-iconv_s_allocate(VALUE klass)
-{
- return Data_Wrap_Struct(klass, 0, ICONV_FREE, 0);
-}
-
-static VALUE
-get_iconv_opt_i(VALUE i, VALUE arg)
-{
- struct rb_iconv_opt_t *opt = (struct rb_iconv_opt_t *)arg;
- VALUE name, val;
-
- (void)opt;
- i = rb_Array(i);
- name = rb_ary_entry(i, 0);
- val = rb_ary_entry(i, 1);
- do {
- if (SYMBOL_P(name)) {
- ID id = SYM2ID(name);
- if (id == id_transliterate) {
-#ifdef ICONV_SET_TRANSLITERATE
- opt->transliterate = val;
-#else
- rb_notimplement();
-#endif
- break;
- }
- if (id == id_discard_ilseq) {
-#ifdef ICONV_SET_DISCARD_ILSEQ
- opt->discard_ilseq = val;
-#else
- rb_notimplement();
-#endif
- break;
- }
- }
- else {
- const char *s = StringValueCStr(name);
- if (strcmp(s, "transliterate") == 0) {
-#ifdef ICONV_SET_TRANSLITERATE
- opt->transliterate = val;
-#else
- rb_notimplement();
-#endif
- break;
- }
- if (strcmp(s, "discard_ilseq") == 0) {
-#ifdef ICONV_SET_DISCARD_ILSEQ
- opt->discard_ilseq = val;
-#else
- rb_notimplement();
-#endif
- break;
- }
- }
- name = rb_inspect(name);
- rb_raise(rb_eArgError, "unknown option - %s", StringValueCStr(name));
- } while (0);
- return Qnil;
-}
-
-static void
-get_iconv_opt(struct rb_iconv_opt_t *opt, VALUE options)
-{
- opt->transliterate = Qundef;
- opt->discard_ilseq = Qundef;
- if (!NIL_P(options)) {
- rb_block_call(options, rb_intern("each"), 0, 0, get_iconv_opt_i, (VALUE)opt);
- }
-}
-
-#define iconv_ctl(self, func, val) (\
- iconvctl(VALUE2ICONV(check_iconv(self)), func, (void *)&(val)) ? \
- rb_sys_fail(#func) : (void)0)
-
-/*
- * Document-method: new
- * call-seq: Iconv.new(to, from, [options])
- *
- * Creates new code converter from a coding-system designated with +from+
- * to another one designated with +to+.
- *
- * === Parameters
- *
- * +to+:: encoding name for destination
- * +from+:: encoding name for source
- * +options+:: options for converter
- *
- * === Exceptions
- *
- * TypeError:: if +to+ or +from+ aren't String
- * InvalidEncoding:: if designated converter couldn't find out
- * SystemCallError:: if <tt>iconv_open(3)</tt> fails
- */
-static VALUE
-iconv_initialize(int argc, VALUE *argv, VALUE self)
-{
- VALUE to, from, options;
- struct rb_iconv_opt_t opt;
- int idx;
-
- rb_scan_args(argc, argv, "21", &to, &from, &options);
- get_iconv_opt(&opt, options);
- iconv_free(check_iconv(self));
- DATA_PTR(self) = NULL;
- DATA_PTR(self) = (void *)ICONV2VALUE(iconv_create(to, from, &opt, &idx));
- if (idx >= 0) ENCODING_SET(self, idx);
- return self;
-}
-
-/*
- * Document-method: open
- * call-seq: Iconv.open(to, from) { |iconv| ... }
- *
- * Equivalent to Iconv.new except that when it is called with a block, it
- * yields with the new instance and closes it, and returns the result which
- * returned from the block.
- */
-static VALUE
-iconv_s_open(int argc, VALUE *argv, VALUE self)
-{
- VALUE to, from, options, cd;
- struct rb_iconv_opt_t opt;
- int idx;
-
- rb_scan_args(argc, argv, "21", &to, &from, &options);
- get_iconv_opt(&opt, options);
- cd = ICONV2VALUE(iconv_create(to, from, &opt, &idx));
-
- self = Data_Wrap_Struct(self, NULL, ICONV_FREE, (void *)cd);
- if (idx >= 0) ENCODING_SET(self, idx);
-
- if (rb_block_given_p()) {
- return rb_ensure(rb_yield, self, (VALUE(*)())iconv_finish, self);
- }
- else {
- return self;
- }
-}
-
-static VALUE
-iconv_s_convert(struct iconv_env_t* env)
-{
- VALUE last = 0;
-
- for (; env->argc > 0; --env->argc, ++env->argv) {
- VALUE s = iconv_convert(env->cd, last = *(env->argv),
- 0, -1, env->toidx, env);
- env->append(env->ret, s);
- }
-
- if (!NIL_P(last)) {
- VALUE s = iconv_convert(env->cd, Qnil, 0, 0, env->toidx, env);
- if (RSTRING_LEN(s))
- env->append(env->ret, s);
- }
-
- return env->ret;
-}
-
-/*
- * Document-method: Iconv::iconv
- * call-seq: Iconv.iconv(to, from, *strs)
- *
- * Shorthand for
- * Iconv.open(to, from) { |cd|
- * (strs + [nil]).collect { |s| cd.iconv(s) }
- * }
- *
- * === Parameters
- *
- * <tt>to, from</tt>:: see Iconv.new
- * <tt>strs</tt>:: strings to be converted
- *
- * === Exceptions
- *
- * Exceptions thrown by Iconv.new, Iconv.open and Iconv#iconv.
- */
-static VALUE
-iconv_s_iconv(int argc, VALUE *argv, VALUE self)
-{
- struct iconv_env_t arg;
-
- if (argc < 2) /* needs `to' and `from' arguments at least */
- rb_raise(rb_eArgError, "wrong number of arguments (%d for %d)", argc, 2);
-
- arg.argc = argc -= 2;
- arg.argv = argv + 2;
- arg.append = rb_ary_push;
- arg.ret = rb_ary_new2(argc);
- arg.cd = iconv_create(argv[0], argv[1], NULL, &arg.toidx);
- return rb_ensure(iconv_s_convert, (VALUE)&arg, iconv_free, ICONV2VALUE(arg.cd));
-}
-
-/*
- * Document-method: Iconv::conv
- * call-seq: Iconv.conv(to, from, str)
- *
- * Shorthand for
- * Iconv.iconv(to, from, str).join
- * See Iconv.iconv.
- */
-static VALUE
-iconv_s_conv(VALUE self, VALUE to, VALUE from, VALUE str)
-{
- struct iconv_env_t arg;
-
- arg.argc = 1;
- arg.argv = &str;
- arg.append = rb_str_append;
- arg.ret = rb_str_new(0, 0);
- arg.cd = iconv_create(to, from, NULL, &arg.toidx);
- return rb_ensure(iconv_s_convert, (VALUE)&arg, iconv_free, ICONV2VALUE(arg.cd));
-}
-
-/*
- * Document-method: list
- * call-seq: Iconv.list {|*aliases| ... }
- *
- * Iterates each alias sets.
- */
-
-#ifdef HAVE_ICONVLIST
-struct iconv_name_list
-{
- unsigned int namescount;
- const char *const *names;
- VALUE array;
-};
-
-static VALUE
-list_iconv_i(VALUE ptr)
-{
- struct iconv_name_list *p = (struct iconv_name_list *)ptr;
- unsigned int i, namescount = p->namescount;
- const char *const *names = p->names;
- VALUE ary = rb_ary_new2(namescount);
-
- for (i = 0; i < namescount; i++) {
- rb_ary_push(ary, rb_str_new2(names[i]));
- }
- if (p->array) {
- return rb_ary_push(p->array, ary);
- }
- return rb_yield(ary);
-}
-
-static int
-list_iconv(unsigned int namescount, const char *const *names, void *data)
-{
- int *state = data;
- struct iconv_name_list list;
-
- list.namescount = namescount;
- list.names = names;
- list.array = ((VALUE *)data)[1];
- rb_protect(list_iconv_i, (VALUE)&list, state);
- return *state;
-}
-#endif
-
-#if defined(HAVE_ICONVLIST) || defined(HAVE___ICONV_FREE_LIST)
-static VALUE
-iconv_s_list(void)
-{
-#ifdef HAVE_ICONVLIST
- int state;
- VALUE args[2];
-
- args[1] = rb_block_given_p() ? 0 : rb_ary_new();
- iconvlist(list_iconv, args);
- state = *(int *)args;
- if (state) rb_jump_tag(state);
- if (args[1]) return args[1];
-#elif defined(HAVE___ICONV_FREE_LIST)
- char **list;
- size_t sz, i;
- VALUE ary;
-
- if (__iconv_get_list(&list, &sz)) return Qnil;
-
- ary = rb_ary_new2(sz);
- for (i = 0; i < sz; i++) {
- rb_ary_push(ary, rb_str_new2(list[i]));
- }
- __iconv_free_list(list, sz);
-
- if (!rb_block_given_p())
- return ary;
- for (i = 0; i < RARRAY_LEN(ary); i++) {
- rb_yield(RARRAY_PTR(ary)[i]);
- }
-#endif
- return Qnil;
-}
-#else
-#define iconv_s_list rb_f_notimplement
-#endif
-
-/*
- * Document-method: close
- *
- * Finishes conversion.
- *
- * After calling this, calling Iconv#iconv will cause an exception, but
- * multiple calls of #close are guaranteed to end successfully.
- *
- * Returns a string containing the byte sequence to change the output buffer to
- * its initial shift state.
- */
-static VALUE
-iconv_init_state(VALUE self)
-{
- iconv_t cd = VALUE2ICONV((VALUE)DATA_PTR(self));
- DATA_PTR(self) = NULL;
- return iconv_convert(cd, Qnil, 0, 0, ENCODING_GET(self), NULL);
-}
-
-static VALUE
-iconv_finish(VALUE self)
-{
- VALUE cd = check_iconv(self);
-
- if (!cd) return Qnil;
- return rb_ensure(iconv_init_state, self, iconv_free, cd);
-}
-
-/*
- * Document-method: Iconv#iconv
- * call-seq: iconv(str, start=0, length=-1)
- *
- * Converts string and returns the result.
- * * If +str+ is a String, converts <tt>str[start, length]</tt> and returns the converted string.
- * * If +str+ is +nil+, places converter itself into initial shift state and
- * just returns a string containing the byte sequence to change the output
- * buffer to its initial shift state.
- * * Otherwise, raises an exception.
- *
- * === Parameters
- *
- * str:: string to be converted, or nil
- * start:: starting offset
- * length:: conversion length; nil or -1 means whole the string from start
- *
- * === Exceptions
- *
- * * IconvIllegalSequence
- * * IconvInvalidCharacter
- * * IconvOutOfRange
- *
- * === Examples
- *
- * See the Iconv documentation.
- */
-static VALUE
-iconv_iconv(int argc, VALUE *argv, VALUE self)
-{
- VALUE str, n1, n2;
- VALUE cd = check_iconv(self);
- long start = 0, length = 0, slen = 0;
-
- rb_scan_args(argc, argv, "12", &str, &n1, &n2);
- if (!NIL_P(str)) {
- VALUE n = rb_str_length(StringValue(str));
- slen = NUM2LONG(n);
- }
- if (argc != 2 || !RTEST(rb_range_beg_len(n1, &start, &length, slen, 0))) {
- if (NIL_P(n1) || ((start = NUM2LONG(n1)) < 0 ? (start += slen) >= 0 : start < slen)) {
- length = NIL_P(n2) ? -1 : NUM2LONG(n2);
- }
- }
- if (start > 0 || length > 0) {
- rb_encoding *enc = rb_enc_get(str);
- const char *s = RSTRING_PTR(str), *e = s + RSTRING_LEN(str);
- const char *ps = s;
- if (start > 0) {
- start = (ps = rb_enc_nth(s, e, start, enc)) - s;
- }
- if (length > 0) {
- length = rb_enc_nth(ps, e, length, enc) - ps;
- }
- }
-
- return iconv_convert(VALUE2ICONV(cd), str, start, length, ENCODING_GET(self), NULL);
-}
-
-/*
- * Document-method: conv
- * call-seq: conv(str...)
- *
- * Equivalent to
- *
- * iconv(nil, str..., nil).join
- */
-static VALUE
-iconv_conv(int argc, VALUE *argv, VALUE self)
-{
- iconv_t cd = VALUE2ICONV(check_iconv(self));
- VALUE str, s;
- int toidx = ENCODING_GET(self);
-
- str = iconv_convert(cd, Qnil, 0, 0, toidx, NULL);
- if (argc > 0) {
- do {
- s = iconv_convert(cd, *argv++, 0, -1, toidx, NULL);
- if (RSTRING_LEN(s))
- rb_str_buf_append(str, s);
- } while (--argc);
- s = iconv_convert(cd, Qnil, 0, 0, toidx, NULL);
- if (RSTRING_LEN(s))
- rb_str_buf_append(str, s);
- }
-
- return str;
-}
-
-#ifdef ICONV_TRIVIALP
-/*
- * Document-method: trivial?
- * call-seq: trivial?
- *
- * Returns trivial flag.
- */
-static VALUE
-iconv_trivialp(VALUE self)
-{
- int trivial = 0;
- iconv_ctl(self, ICONV_TRIVIALP, trivial);
- if (trivial) return Qtrue;
- return Qfalse;
-}
-#else
-#define iconv_trivialp rb_f_notimplement
-#endif
-
-#ifdef ICONV_GET_TRANSLITERATE
-/*
- * Document-method: transliterate?
- * call-seq: transliterate?
- *
- * Returns transliterate flag.
- */
-static VALUE
-iconv_get_transliterate(VALUE self)
-{
- int trans = 0;
- iconv_ctl(self, ICONV_GET_TRANSLITERATE, trans);
- if (trans) return Qtrue;
- return Qfalse;
-}
-#else
-#define iconv_get_transliterate rb_f_notimplement
-#endif
-
-#ifdef ICONV_SET_TRANSLITERATE
-/*
- * Document-method: transliterate=
- * call-seq: cd.transliterate = flag
- *
- * Sets transliterate flag.
- */
-static VALUE
-iconv_set_transliterate(VALUE self, VALUE transliterate)
-{
- int trans = RTEST(transliterate);
- iconv_ctl(self, ICONV_SET_TRANSLITERATE, trans);
- return self;
-}
-#else
-#define iconv_set_transliterate rb_f_notimplement
-#endif
-
-#ifdef ICONV_GET_DISCARD_ILSEQ
-/*
- * Document-method: discard_ilseq?
- * call-seq: discard_ilseq?
- *
- * Returns discard_ilseq flag.
- */
-static VALUE
-iconv_get_discard_ilseq(VALUE self)
-{
- int dis = 0;
- iconv_ctl(self, ICONV_GET_DISCARD_ILSEQ, dis);
- if (dis) return Qtrue;
- return Qfalse;
-}
-#else
-#define iconv_get_discard_ilseq rb_f_notimplement
-#endif
-
-#ifdef ICONV_SET_DISCARD_ILSEQ
-/*
- * Document-method: discard_ilseq=
- * call-seq: cd.discard_ilseq = flag
- *
- * Sets discard_ilseq flag.
- */
-static VALUE
-iconv_set_discard_ilseq(VALUE self, VALUE discard_ilseq)
-{
- int dis = RTEST(discard_ilseq);
- iconv_ctl(self, ICONV_SET_DISCARD_ILSEQ, dis);
- return self;
-}
-#else
-#define iconv_set_discard_ilseq rb_f_notimplement
-#endif
-
-/*
- * Document-method: ctlmethods
- * call-seq: Iconv.ctlmethods => array
- *
- * Returns available iconvctl() method list.
- */
-static VALUE
-iconv_s_ctlmethods(VALUE klass)
-{
- VALUE ary = rb_ary_new();
-#ifdef ICONV_TRIVIALP
- rb_ary_push(ary, ID2SYM(rb_intern("trivial?")));
-#endif
-#ifdef ICONV_GET_TRANSLITERATE
- rb_ary_push(ary, ID2SYM(rb_intern("transliterate?")));
-#endif
-#ifdef ICONV_SET_TRANSLITERATE
- rb_ary_push(ary, ID2SYM(rb_intern("transliterate=")));
-#endif
-#ifdef ICONV_GET_DISCARD_ILSEQ
- rb_ary_push(ary, ID2SYM(rb_intern("discard_ilseq?")));
-#endif
-#ifdef ICONV_SET_DISCARD_ILSEQ
- rb_ary_push(ary, ID2SYM(rb_intern("discard_ilseq=")));
-#endif
- return ary;
-}
-
-/*
- * Document-class: Iconv::Failure
- *
- * Base attributes for Iconv exceptions.
- */
-
-/*
- * Document-method: success
- * call-seq: success
- *
- * Returns string(s) translated successfully until the exception occurred.
- * * In the case of failure occurred within Iconv.iconv, returned
- * value is an array of strings translated successfully preceding
- * failure and the last element is string on the way.
- */
-static VALUE
-iconv_failure_success(VALUE self)
-{
- return rb_attr_get(self, rb_success);
-}
-
-/*
- * Document-method: failed
- * call-seq: failed
- *
- * Returns substring of the original string passed to Iconv that starts at the
- * character caused the exception.
- */
-static VALUE
-iconv_failure_failed(VALUE self)
-{
- return rb_attr_get(self, rb_failed);
-}
-
-/*
- * Document-method: inspect
- * call-seq: inspect
- *
- * Returns inspected string like as: #<_class_: _success_, _failed_>
- */
-static VALUE
-iconv_failure_inspect(VALUE self)
-{
- const char *cname = rb_class2name(CLASS_OF(self));
- VALUE success = rb_attr_get(self, rb_success);
- VALUE failed = rb_attr_get(self, rb_failed);
- VALUE str = rb_str_buf_cat2(rb_str_new2("#<"), cname);
- str = rb_str_buf_cat(str, ": ", 2);
- str = rb_str_buf_append(str, rb_inspect(success));
- str = rb_str_buf_cat(str, ", ", 2);
- str = rb_str_buf_append(str, rb_inspect(failed));
- return rb_str_buf_cat(str, ">", 1);
-}
-
-/*
- * Document-class: Iconv::InvalidEncoding
- *
- * Requested coding-system is not available on this system.
- */
-
-/*
- * Document-class: Iconv::IllegalSequence
- *
- * Input conversion stopped due to an input byte that does not belong to
- * the input codeset, or the output codeset does not contain the
- * character.
- */
-
-/*
- * Document-class: Iconv::InvalidCharacter
- *
- * Input conversion stopped due to an incomplete character or shift
- * sequence at the end of the input buffer.
- */
-
-/*
- * Document-class: Iconv::OutOfRange
- *
- * Iconv library internal error. Must not occur.
- */
-
-/*
- * Document-class: Iconv::BrokenLibrary
- *
- * Detected a bug of underlying iconv(3) libray.
- * * returns an error without setting errno properly
- */
-
-static void
-warn_deprecated(void)
-{
- static const char message[] =
- ": iconv will be deprecated in the future, use String#encode instead.\n";
- VALUE msg = Qnil, caller = rb_make_backtrace();
- long i;
-
- for (i = 1; i < RARRAY_LEN(caller); ++i) {
- VALUE s = RARRAY_PTR(caller)[i];
- if (strncmp(RSTRING_PTR(s), "<internal:", 10) != 0) {
- msg = s;
- break;
- }
- }
- if (NIL_P(msg)) {
- msg = rb_str_new_cstr(message + 2);
- }
- else {
- rb_str_cat(msg, message, sizeof(message) - 1);
- }
- rb_io_puts(1, &msg, rb_stderr);
-}
-
-void
-Init_iconv(void)
-{
- VALUE rb_cIconv = rb_define_class("Iconv", rb_cData);
-
- if (!NIL_P(ruby_verbose)) {
- warn_deprecated();
- }
- rb_define_alloc_func(rb_cIconv, iconv_s_allocate);
- rb_define_singleton_method(rb_cIconv, "open", iconv_s_open, -1);
- rb_define_singleton_method(rb_cIconv, "iconv", iconv_s_iconv, -1);
- rb_define_singleton_method(rb_cIconv, "conv", iconv_s_conv, 3);
- rb_define_singleton_method(rb_cIconv, "list", iconv_s_list, 0);
- rb_define_singleton_method(rb_cIconv, "ctlmethods", iconv_s_ctlmethods, 0);
- rb_define_method(rb_cIconv, "initialize", iconv_initialize, -1);
- rb_define_method(rb_cIconv, "close", iconv_finish, 0);
- rb_define_method(rb_cIconv, "iconv", iconv_iconv, -1);
- rb_define_method(rb_cIconv, "conv", iconv_conv, -1);
- rb_define_method(rb_cIconv, "trivial?", iconv_trivialp, 0);
- rb_define_method(rb_cIconv, "transliterate?", iconv_get_transliterate, 0);
- rb_define_method(rb_cIconv, "transliterate=", iconv_set_transliterate, 1);
- rb_define_method(rb_cIconv, "discard_ilseq?", iconv_get_discard_ilseq, 0);
- rb_define_method(rb_cIconv, "discard_ilseq=", iconv_set_discard_ilseq, 1);
-
- rb_eIconvFailure = rb_define_module_under(rb_cIconv, "Failure");
- rb_define_method(rb_eIconvFailure, "initialize", iconv_failure_initialize, 3);
- rb_define_method(rb_eIconvFailure, "success", iconv_failure_success, 0);
- rb_define_method(rb_eIconvFailure, "failed", iconv_failure_failed, 0);
- rb_define_method(rb_eIconvFailure, "inspect", iconv_failure_inspect, 0);
-
- rb_eIconvInvalidEncoding = rb_define_class_under(rb_cIconv, "InvalidEncoding", rb_eArgError);
- rb_eIconvIllegalSeq = rb_define_class_under(rb_cIconv, "IllegalSequence", rb_eArgError);
- rb_eIconvInvalidChar = rb_define_class_under(rb_cIconv, "InvalidCharacter", rb_eArgError);
- rb_eIconvOutOfRange = rb_define_class_under(rb_cIconv, "OutOfRange", rb_eRuntimeError);
- rb_eIconvBrokenLibrary = rb_define_class_under(rb_cIconv, "BrokenLibrary", rb_eRuntimeError);
- rb_include_module(rb_eIconvInvalidEncoding, rb_eIconvFailure);
- rb_include_module(rb_eIconvIllegalSeq, rb_eIconvFailure);
- rb_include_module(rb_eIconvInvalidChar, rb_eIconvFailure);
- rb_include_module(rb_eIconvOutOfRange, rb_eIconvFailure);
- rb_include_module(rb_eIconvBrokenLibrary, rb_eIconvFailure);
-
- rb_success = rb_intern("success");
- rb_failed = rb_intern("failed");
- id_transliterate = rb_intern("transliterate");
- id_discard_ilseq = rb_intern("discard_ilseq");
-
- rb_gc_register_address(&charset_map);
- charset_map = rb_hash_new();
- rb_define_singleton_method(rb_cIconv, "charset_map", charset_map_get, 0);
-}
-
diff --git a/ext/iconv/mkwrapper.rb b/ext/iconv/mkwrapper.rb
deleted file mode 100644
index 44d5fcf194..0000000000
--- a/ext/iconv/mkwrapper.rb
+++ /dev/null
@@ -1,53 +0,0 @@
-#! /usr/bin/ruby
-require 'rbconfig'
-require 'optparse'
-
-# http://www.ctan.org/get/macros/texinfo/texinfo/gnulib/lib/config.charset
-# Tue, 25 Dec 2007 00:00:00 GMT
-
-HEADER = <<SRC
-require 'iconv.so'
-
-class Iconv
- case RUBY_PLATFORM
-SRC
-
-def charset_alias(config_charset, mapfile = nil)
- found = nil
- src = [HEADER]
- open(config_charset) do |input|
- input.find {|line| /^case "\$os" in/ =~ line} or return
- input.each do |line|
- case line
- when /^\s*([-\w\*]+(?:\s*\|\s*[-\w\*]+)*)(?=\))/
- (s = " when ") << $&.split('|').collect {|targ|
- targ.strip!
- tail = targ.chomp!("*") ? '' : '\z'
- head = targ.slice!(/\A\*/) ? '' : '\A'
- targ.gsub!(/\*/, '.*')
- "/#{head}#{targ}#{tail}/"
- }.join(", ")
- src << s
- found = {}
- when /^\s*echo "(?:\$\w+\.)?([-\w*]+)\s+([-\w]+)"/
- sys, can = $1, $2
- can.downcase!
- unless found[can] or (/\Aen_(?!US\z)/ =~ sys && /\ACP437\z/i =~ can)
- found[can] = true
- src << " charset_map['#{can}'] = '#{sys}'.freeze"
- end
- when /^\s*;;/
- found = nil
- end
- end
- end
- src << " end" << "end"
- if mapfile
- open(mapfile, "wb") {|f| f.puts(*src)}
- else
- puts(*src)
- end
-end
-
-(1..2) === ARGV.size or abort "usage: #{$0} config_charset [mapfile]"
-charset_alias(*ARGV)
diff --git a/ext/io/console/console.c b/ext/io/console/console.c
index efad30c1ca..f3379ffd8d 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,17 +107,35 @@ 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")));
- VALUE v10 = INT2FIX(10);
+ /* default values by `stty raw` */
+ opts->vmin = 1;
+ opts->vtime = 0;
if (!NIL_P(vmin)) {
- vmin = rb_funcall3(vmin, '*', 1, &v10);
opts->vmin = NUM2INT(vmin);
optp = opts;
}
if (!NIL_P(vtime)) {
+ VALUE v10 = INT2FIX(10);
vtime = rb_funcall3(vtime, '*', 1, &v10);
opts->vtime = NUM2INT(vtime);
optp = opts;
@@ -586,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;
}
@@ -608,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;
}
@@ -659,7 +685,7 @@ console_dev(VALUE klass)
if (klass == rb_cIO) klass = rb_cFile;
if (rb_const_defined(klass, id_console)) {
con = rb_const_get(klass, id_console);
- if (TYPE(con) == T_FILE) {
+ if (RB_TYPE_P(con, T_FILE)) {
if ((fptr = RFILE(con)->fptr) && GetReadFD(fptr) != -1)
return con;
}
@@ -684,14 +710,14 @@ console_dev(VALUE klass)
int fd;
#ifdef CONSOLE_DEVICE_FOR_WRITING
- fd = open(CONSOLE_DEVICE_FOR_WRITING, O_WRONLY);
+ fd = rb_cloexec_open(CONSOLE_DEVICE_FOR_WRITING, O_WRONLY, 0);
if (fd < 0) return Qnil;
rb_update_max_fd(fd);
args[1] = INT2FIX(O_WRONLY);
args[0] = INT2NUM(fd);
out = rb_class_new_instance(2, args, klass);
#endif
- fd = open(CONSOLE_DEVICE_FOR_READING, O_RDWR);
+ fd = rb_cloexec_open(CONSOLE_DEVICE_FOR_READING, O_RDWR, 0);
if (fd < 0) {
#ifdef CONSOLE_DEVICE_FOR_WRITING
rb_io_close(out);
@@ -703,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
@@ -721,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)
{
@@ -756,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 2d34a41336..f71e1b9b8f 100644
--- a/ext/io/console/io-console.gemspec
+++ b/ext/io/console/io-console.gemspec
@@ -1,15 +1,21 @@
# -*- ruby -*-
-_VERSION = "0.3"
+_VERSION = "0.4.2"
+date = %w$Date:: $[1]
Gem::Specification.new do |s|
s.name = "io-console"
s.version = _VERSION
- s.date = "2011-06-24"
+ s.date = date
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 34e832b122..d8bb55fc47 100644
--- a/ext/io/wait/wait.c
+++ b/ext/io/wait/wait.c
@@ -14,6 +14,9 @@
#include "ruby/io.h"
#include <sys/types.h>
+#if defined(HAVE_UNISTD_H) && (defined(__sun))
+#include <unistd.h>
+#endif
#if defined(HAVE_SYS_IOCTL_H)
#include <sys/ioctl.h>
#endif
@@ -37,7 +40,8 @@
#endif
static VALUE io_ready_p _((VALUE io));
-static VALUE io_wait _((int argc, VALUE *argv, VALUE io));
+static VALUE io_wait_readable _((int argc, VALUE *argv, VALUE io));
+static VALUE io_wait_writable _((int argc, VALUE *argv, VALUE io));
void Init_wait _((void));
/*
@@ -92,13 +96,15 @@ 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.
*/
static VALUE
-io_wait(int argc, VALUE *argv, VALUE io)
+io_wait_readable(int argc, VALUE *argv, VALUE io)
{
rb_io_t *fptr;
int i;
@@ -130,6 +136,43 @@ io_wait(int argc, VALUE *argv, VALUE io)
}
/*
+ * call-seq:
+ * io.wait_writable -> IO
+ * io.wait_writable(timeout) -> IO or nil
+ *
+ * Waits until IO writable is available or times out and returns self or
+ * nil when EOF is reached.
+ */
+static VALUE
+io_wait_writable(int argc, VALUE *argv, VALUE io)
+{
+ rb_io_t *fptr;
+ int i;
+ VALUE timeout;
+ struct timeval timerec;
+ struct timeval *tv;
+
+ GetOpenFile(io, fptr);
+ rb_io_check_writable(fptr);
+ rb_scan_args(argc, argv, "01", &timeout);
+ if (NIL_P(timeout)) {
+ tv = NULL;
+ }
+ else {
+ timerec = rb_time_interval(timeout);
+ tv = &timerec;
+ }
+
+ i = rb_wait_for_single_fd(fptr->fd, RB_WAITFD_OUT, tv);
+ if (i < 0)
+ rb_sys_fail(0);
+ rb_io_check_closed(fptr);
+ if (i & RB_WAITFD_OUT)
+ return io;
+ return Qnil;
+}
+
+/*
* IO wait methods
*/
@@ -138,5 +181,7 @@ Init_wait()
{
rb_define_method(rb_cIO, "nread", io_nread, 0);
rb_define_method(rb_cIO, "ready?", io_ready_p, 0);
- rb_define_method(rb_cIO, "wait", io_wait, -1);
+ rb_define_method(rb_cIO, "wait", io_wait_readable, -1);
+ rb_define_method(rb_cIO, "wait_readable", io_wait_readable, -1);
+ rb_define_method(rb_cIO, "wait_writable", io_wait_writable, -1);
}
diff --git a/ext/json/fbuffer/fbuffer.h b/ext/json/fbuffer/fbuffer.h
new file mode 100644
index 0000000000..af74187566
--- /dev/null
+++ b/ext/json/fbuffer/fbuffer.h
@@ -0,0 +1,181 @@
+
+#ifndef _FBUFFER_H_
+#define _FBUFFER_H_
+
+#include "ruby.h"
+
+#ifndef RHASH_SIZE
+#define RHASH_SIZE(hsh) (RHASH(hsh)->tbl->num_entries)
+#endif
+
+#ifndef RFLOAT_VALUE
+#define RFLOAT_VALUE(val) (RFLOAT(val)->value)
+#endif
+
+#ifndef RARRAY_PTR
+#define RARRAY_PTR(ARRAY) RARRAY(ARRAY)->ptr
+#endif
+#ifndef RARRAY_LEN
+#define RARRAY_LEN(ARRAY) RARRAY(ARRAY)->len
+#endif
+#ifndef RSTRING_PTR
+#define RSTRING_PTR(string) RSTRING(string)->ptr
+#endif
+#ifndef RSTRING_LEN
+#define RSTRING_LEN(string) RSTRING(string)->len
+#endif
+
+#ifdef HAVE_RUBY_ENCODING_H
+#include "ruby/encoding.h"
+#define FORCE_UTF8(obj) rb_enc_associate((obj), rb_utf8_encoding())
+#else
+#define FORCE_UTF8(obj)
+#endif
+
+/* We don't need to guard objects for rbx, so let's do nothing at all. */
+#ifndef RB_GC_GUARD
+#define RB_GC_GUARD(object)
+#endif
+
+typedef struct FBufferStruct {
+ unsigned long initial_length;
+ char *ptr;
+ unsigned long len;
+ unsigned long capa;
+} FBuffer;
+
+#define FBUFFER_INITIAL_LENGTH_DEFAULT 1024
+
+#define FBUFFER_PTR(fb) (fb->ptr)
+#define FBUFFER_LEN(fb) (fb->len)
+#define FBUFFER_CAPA(fb) (fb->capa)
+#define FBUFFER_PAIR(fb) FBUFFER_PTR(fb), FBUFFER_LEN(fb)
+
+static FBuffer *fbuffer_alloc(unsigned long initial_length);
+static void fbuffer_free(FBuffer *fb);
+static void fbuffer_clear(FBuffer *fb);
+static void fbuffer_append(FBuffer *fb, const char *newstr, unsigned long len);
+#ifdef JSON_GENERATOR
+static void fbuffer_append_long(FBuffer *fb, long number);
+#endif
+static void fbuffer_append_char(FBuffer *fb, char newchr);
+#ifdef JSON_GENERATOR
+static FBuffer *fbuffer_dup(FBuffer *fb);
+static VALUE fbuffer_to_s(FBuffer *fb);
+#endif
+
+static FBuffer *fbuffer_alloc(unsigned long initial_length)
+{
+ FBuffer *fb;
+ if (initial_length <= 0) initial_length = FBUFFER_INITIAL_LENGTH_DEFAULT;
+ fb = ALLOC(FBuffer);
+ memset((void *) fb, 0, sizeof(FBuffer));
+ fb->initial_length = initial_length;
+ return fb;
+}
+
+static void fbuffer_free(FBuffer *fb)
+{
+ if (fb->ptr) ruby_xfree(fb->ptr);
+ ruby_xfree(fb);
+}
+
+static void fbuffer_clear(FBuffer *fb)
+{
+ fb->len = 0;
+}
+
+static void fbuffer_inc_capa(FBuffer *fb, unsigned long requested)
+{
+ unsigned long required;
+
+ if (!fb->ptr) {
+ fb->ptr = ALLOC_N(char, fb->initial_length);
+ fb->capa = fb->initial_length;
+ }
+
+ for (required = fb->capa; requested > required - fb->len; required <<= 1);
+
+ if (required > fb->capa) {
+ REALLOC_N(fb->ptr, char, required);
+ fb->capa = required;
+ }
+}
+
+static void fbuffer_append(FBuffer *fb, const char *newstr, unsigned long len)
+{
+ if (len > 0) {
+ fbuffer_inc_capa(fb, len);
+ MEMCPY(fb->ptr + fb->len, newstr, char, len);
+ fb->len += len;
+ }
+}
+
+#ifdef JSON_GENERATOR
+static void fbuffer_append_str(FBuffer *fb, VALUE str)
+{
+ const char *newstr = StringValuePtr(str);
+ unsigned long len = RSTRING_LEN(str);
+
+ RB_GC_GUARD(str);
+
+ fbuffer_append(fb, newstr, len);
+}
+#endif
+
+static void fbuffer_append_char(FBuffer *fb, char newchr)
+{
+ fbuffer_inc_capa(fb, 1);
+ *(fb->ptr + fb->len) = newchr;
+ fb->len++;
+}
+
+#ifdef JSON_GENERATOR
+static void freverse(char *start, char *end)
+{
+ char c;
+
+ while (end > start) {
+ c = *end, *end-- = *start, *start++ = c;
+ }
+}
+
+static long fltoa(long number, char *buf)
+{
+ static char digits[] = "0123456789";
+ long sign = number;
+ char* tmp = buf;
+
+ if (sign < 0) number = -number;
+ do *tmp++ = digits[number % 10]; while (number /= 10);
+ if (sign < 0) *tmp++ = '-';
+ freverse(buf, tmp - 1);
+ return tmp - buf;
+}
+
+static void fbuffer_append_long(FBuffer *fb, long number)
+{
+ char buf[20];
+ unsigned long len = fltoa(number, buf);
+ fbuffer_append(fb, buf, len);
+}
+
+static FBuffer *fbuffer_dup(FBuffer *fb)
+{
+ unsigned long len = fb->len;
+ FBuffer *result;
+
+ result = fbuffer_alloc(len);
+ fbuffer_append(result, FBUFFER_PAIR(fb));
+ return result;
+}
+
+static VALUE fbuffer_to_s(FBuffer *fb)
+{
+ VALUE result = rb_str_new(FBUFFER_PAIR(fb));
+ fbuffer_free(fb);
+ FORCE_UTF8(result);
+ return result;
+}
+#endif
+#endif
diff --git a/ext/json/generator/depend b/ext/json/generator/depend
index bb76ad6400..1a042a2501 100644
--- a/ext/json/generator/depend
+++ b/ext/json/generator/depend
@@ -1 +1 @@
-generator.o: generator.c generator.h
+generator.o: generator.c generator.h $(srcdir)/../fbuffer/fbuffer.h
diff --git a/ext/json/generator/extconf.rb b/ext/json/generator/extconf.rb
index b94f71e8b3..8627c5f4bd 100644
--- a/ext/json/generator/extconf.rb
+++ b/ext/json/generator/extconf.rb
@@ -1,10 +1,4 @@
require 'mkmf'
-require 'rbconfig'
-if RUBY_VERSION < "1.9"
- have_header("re.h")
-else
- have_header("ruby/re.h")
- have_header("ruby/encoding.h")
-end
+$defs << "-DJSON_GENERATOR"
create_makefile 'json/ext/generator'
diff --git a/ext/json/generator/generator.c b/ext/json/generator/generator.c
index 9ad037cd40..ed7bb82887 100644
--- a/ext/json/generator/generator.c
+++ b/ext/json/generator/generator.c
@@ -1,3 +1,4 @@
+#include "../fbuffer/fbuffer.h"
#include "generator.h"
#ifdef HAVE_RUBY_ENCODING_H
@@ -14,7 +15,8 @@ static VALUE mJSON, mExt, mGenerator, cState, mGeneratorMethods, mObject,
static ID i_to_s, i_to_json, i_new, i_indent, i_space, i_space_before,
i_object_nl, i_array_nl, i_max_nesting, i_allow_nan, i_ascii_only,
i_quirks_mode, i_pack, i_unpack, i_create_id, i_extend, i_key_p,
- i_aref, i_send, i_respond_to_p, i_match, i_keys, i_depth, i_dup;
+ i_aref, i_send, i_respond_to_p, i_match, i_keys, i_depth,
+ i_buffer_initial_length, i_dup;
/*
* Copyright 2001-2004 Unicode, Inc.
@@ -112,7 +114,7 @@ static void unicode_escape(char *buf, UTF16 character)
}
/* Escapes the UTF16 character and stores the result in the buffer buf, then
- * the buffer buf Ñ–s appended to the FBuffer buffer. */
+ * the buffer buf is appended to the FBuffer buffer. */
static void unicode_escape_to_buffer(FBuffer *buffer, char buf[6], UTF16
character)
{
@@ -271,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;
}
@@ -292,123 +305,6 @@ static char *fstrndup(const char *ptr, unsigned long len) {
return result;
}
-/* fbuffer implementation */
-
-static FBuffer *fbuffer_alloc()
-{
- FBuffer *fb = ALLOC(FBuffer);
- memset((void *) fb, 0, sizeof(FBuffer));
- fb->initial_length = FBUFFER_INITIAL_LENGTH;
- return fb;
-}
-
-static FBuffer *fbuffer_alloc_with_length(unsigned long initial_length)
-{
- FBuffer *fb;
- assert(initial_length > 0);
- fb = ALLOC(FBuffer);
- memset((void *) fb, 0, sizeof(FBuffer));
- fb->initial_length = initial_length;
- return fb;
-}
-
-static void fbuffer_free(FBuffer *fb)
-{
- if (fb->ptr) ruby_xfree(fb->ptr);
- ruby_xfree(fb);
-}
-
-static void fbuffer_clear(FBuffer *fb)
-{
- fb->len = 0;
-}
-
-static void fbuffer_inc_capa(FBuffer *fb, unsigned long requested)
-{
- unsigned long required;
-
- if (!fb->ptr) {
- fb->ptr = ALLOC_N(char, fb->initial_length);
- fb->capa = fb->initial_length;
- }
-
- for (required = fb->capa; requested > required - fb->len; required <<= 1);
-
- if (required > fb->capa) {
- REALLOC_N(fb->ptr, char, required);
- fb->capa = required;
- }
-}
-
-static void fbuffer_append(FBuffer *fb, const char *newstr, unsigned long len)
-{
- if (len > 0) {
- fbuffer_inc_capa(fb, len);
- MEMCPY(fb->ptr + fb->len, newstr, char, len);
- fb->len += len;
- }
-}
-
-static void fbuffer_append_str(FBuffer *fb, VALUE str)
-{
- const char *newstr = StringValuePtr(str);
- unsigned long len = RSTRING_LEN(str);
-
- RB_GC_GUARD(str);
-
- fbuffer_append(fb, newstr, len);
-}
-
-static void fbuffer_append_char(FBuffer *fb, char newchr)
-{
- fbuffer_inc_capa(fb, 1);
- *(fb->ptr + fb->len) = newchr;
- fb->len++;
-}
-
-static void freverse(char *start, char *end)
-{
- char c;
-
- while (end > start) {
- c = *end, *end-- = *start, *start++ = c;
- }
-}
-
-static long fltoa(long number, char *buf)
-{
- static char digits[] = "0123456789";
- long sign = number;
- char* tmp = buf;
-
- if (sign < 0) number = -number;
- do *tmp++ = digits[number % 10]; while (number /= 10);
- if (sign < 0) *tmp++ = '-';
- freverse(buf, tmp - 1);
- return tmp - buf;
-}
-
-static void fbuffer_append_long(FBuffer *fb, long number)
-{
- char buf[20];
- unsigned long len = fltoa(number, buf);
- fbuffer_append(fb, buf, len);
-}
-
-static FBuffer *fbuffer_dup(FBuffer *fb)
-{
- unsigned long len = fb->len;
- FBuffer *result;
-
- if (len > 0) {
- result = fbuffer_alloc_with_length(len);
- fbuffer_append(result, FBUFFER_PAIR(fb));
- } else {
- result = fbuffer_alloc();
- }
- return result;
-}
-
/*
* Document-module: JSON::Ext::Generator
*
@@ -626,18 +522,15 @@ 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)) {
unsigned long len;
Check_Type(tmp, T_STRING);
len = RSTRING_LEN(tmp);
- state->indent = fstrndup(RSTRING_PTR(tmp), len);
+ state->indent = fstrndup(RSTRING_PTR(tmp), len + 1);
state->indent_len = len;
}
tmp = rb_hash_aref(opts, ID2SYM(i_space));
@@ -645,7 +538,7 @@ static VALUE cState_configure(VALUE self, VALUE opts)
unsigned long len;
Check_Type(tmp, T_STRING);
len = RSTRING_LEN(tmp);
- state->space = fstrndup(RSTRING_PTR(tmp), len);
+ state->space = fstrndup(RSTRING_PTR(tmp), len + 1);
state->space_len = len;
}
tmp = rb_hash_aref(opts, ID2SYM(i_space_before));
@@ -653,7 +546,7 @@ static VALUE cState_configure(VALUE self, VALUE opts)
unsigned long len;
Check_Type(tmp, T_STRING);
len = RSTRING_LEN(tmp);
- state->space_before = fstrndup(RSTRING_PTR(tmp), len);
+ state->space_before = fstrndup(RSTRING_PTR(tmp), len + 1);
state->space_before_len = len;
}
tmp = rb_hash_aref(opts, ID2SYM(i_array_nl));
@@ -661,7 +554,7 @@ static VALUE cState_configure(VALUE self, VALUE opts)
unsigned long len;
Check_Type(tmp, T_STRING);
len = RSTRING_LEN(tmp);
- state->array_nl = fstrndup(RSTRING_PTR(tmp), len);
+ state->array_nl = fstrndup(RSTRING_PTR(tmp), len + 1);
state->array_nl_len = len;
}
tmp = rb_hash_aref(opts, ID2SYM(i_object_nl));
@@ -669,11 +562,11 @@ static VALUE cState_configure(VALUE self, VALUE opts)
unsigned long len;
Check_Type(tmp, T_STRING);
len = RSTRING_LEN(tmp);
- state->object_nl = fstrndup(RSTRING_PTR(tmp), len);
+ state->object_nl = fstrndup(RSTRING_PTR(tmp), len + 1);
state->object_nl_len = len;
}
tmp = ID2SYM(i_max_nesting);
- state->max_nesting = 19;
+ state->max_nesting = 100;
if (option_given_p(opts, tmp)) {
VALUE max_nesting = rb_hash_aref(opts, tmp);
if (RTEST(max_nesting)) {
@@ -694,6 +587,16 @@ static VALUE cState_configure(VALUE self, VALUE opts)
state->depth = 0;
}
}
+ tmp = ID2SYM(i_buffer_initial_length);
+ if (option_given_p(opts, tmp)) {
+ VALUE buffer_initial_length = rb_hash_aref(opts, tmp);
+ if (RTEST(buffer_initial_length)) {
+ long initial_length;
+ Check_Type(buffer_initial_length, T_FIXNUM);
+ initial_length = FIX2LONG(buffer_initial_length);
+ if (initial_length > 0) state->buffer_initial_length = initial_length;
+ }
+ }
tmp = rb_hash_aref(opts, ID2SYM(i_allow_nan));
state->allow_nan = RTEST(tmp);
tmp = rb_hash_aref(opts, ID2SYM(i_ascii_only));
@@ -703,6 +606,18 @@ static VALUE cState_configure(VALUE self, VALUE opts)
return self;
}
+static void set_state_ivars(VALUE hash, VALUE state)
+{
+ VALUE ivars = rb_obj_instance_variables(state);
+ int i = 0;
+ for (i = 0; i < RARRAY_LEN(ivars); i++) {
+ VALUE key = rb_funcall(rb_ary_entry(ivars, i), i_to_s, 0);
+ long key_len = RSTRING_LEN(key);
+ VALUE value = rb_iv_get(state, StringValueCStr(key));
+ rb_hash_aset(hash, rb_str_intern(rb_str_substr(key, 1, key_len - 1)), value);
+ }
+}
+
/*
* call-seq: to_h
*
@@ -713,6 +628,7 @@ static VALUE cState_to_h(VALUE self)
{
VALUE result = rb_hash_new();
GET_STATE(self);
+ set_state_ivars(result, self);
rb_hash_aset(result, ID2SYM(i_indent), rb_str_new(state->indent, state->indent_len));
rb_hash_aset(result, ID2SYM(i_space), rb_str_new(state->space, state->space_len));
rb_hash_aset(result, ID2SYM(i_space_before), rb_str_new(state->space_before, state->space_before_len));
@@ -723,6 +639,7 @@ static VALUE cState_to_h(VALUE self)
rb_hash_aset(result, ID2SYM(i_quirks_mode), state->quirks_mode ? Qtrue : Qfalse);
rb_hash_aset(result, ID2SYM(i_max_nesting), LONG2FIX(state->max_nesting));
rb_hash_aset(result, ID2SYM(i_depth), LONG2FIX(state->depth));
+ rb_hash_aset(result, ID2SYM(i_buffer_initial_length), LONG2FIX(state->buffer_initial_length));
return result;
}
@@ -733,14 +650,33 @@ static VALUE cState_to_h(VALUE self)
*/
static VALUE cState_aref(VALUE self, VALUE name)
{
- GET_STATE(self);
+ name = rb_funcall(name, i_to_s, 0);
if (RTEST(rb_funcall(self, i_respond_to_p, 1, name))) {
return rb_funcall(self, i_send, 1, name);
} else {
- return Qnil;
+ return rb_ivar_get(self, rb_intern_str(rb_str_concat(rb_str_new2("@"), name)));
}
}
+/*
+* call-seq: []=(name, value)
+*
+* Set the attribute name to value.
+*/
+static VALUE cState_aset(VALUE self, VALUE name, VALUE value)
+{
+ VALUE name_writer;
+
+ name = rb_funcall(name, i_to_s, 0);
+ name_writer = rb_str_cat2(rb_str_dup(name), "=");
+ if (RTEST(rb_funcall(self, i_respond_to_p, 1, name_writer))) {
+ return rb_funcall(self, i_send, 2, name_writer, value);
+ } else {
+ rb_ivar_set(self, rb_intern_str(rb_str_concat(rb_str_new2("@"), name)), value);
+ }
+ return Qnil;
+}
+
static void generate_json_object(FBuffer *buffer, VALUE Vstate, JSON_Generator_State *state, VALUE obj)
{
char *object_nl = state->object_nl;
@@ -920,19 +856,20 @@ static void generate_json(FBuffer *buffer, VALUE Vstate, JSON_Generator_State *s
static FBuffer *cState_prepare_buffer(VALUE self)
{
- FBuffer *buffer = fbuffer_alloc();
+ FBuffer *buffer;
GET_STATE(self);
+ buffer = fbuffer_alloc(state->buffer_initial_length);
if (state->object_delim) {
fbuffer_clear(state->object_delim);
} else {
- state->object_delim = fbuffer_alloc_with_length(16);
+ state->object_delim = fbuffer_alloc(16);
}
fbuffer_append_char(state->object_delim, ',');
if (state->object_delim2) {
fbuffer_clear(state->object_delim2);
} else {
- state->object_delim2 = fbuffer_alloc_with_length(16);
+ state->object_delim2 = fbuffer_alloc(16);
}
fbuffer_append_char(state->object_delim2, ':');
if (state->space) fbuffer_append(state->object_delim2, state->space, state->space_len);
@@ -940,21 +877,13 @@ static FBuffer *cState_prepare_buffer(VALUE self)
if (state->array_delim) {
fbuffer_clear(state->array_delim);
} else {
- state->array_delim = fbuffer_alloc_with_length(16);
+ state->array_delim = fbuffer_alloc(16);
}
fbuffer_append_char(state->array_delim, ',');
if (state->array_nl) fbuffer_append(state->array_delim, state->array_nl, state->array_nl_len);
return buffer;
}
-static VALUE fbuffer_to_s(FBuffer *fb)
-{
- VALUE result = rb_str_new(FBUFFER_PAIR(fb));
- fbuffer_free(fb);
- FORCE_UTF8(result);
- return result;
-}
-
static VALUE cState_partial_generate(VALUE self, VALUE obj)
{
FBuffer *buffer = cState_prepare_buffer(self);
@@ -964,6 +893,21 @@ static VALUE cState_partial_generate(VALUE self, VALUE obj)
}
/*
+ * This function returns true if string is either a JSON array or JSON object.
+ * It might suffer from false positives, e. g. syntactically incorrect JSON in
+ * the string or certain UTF-8 characters on the right hand side.
+ */
+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((unsigned char)*p); p++);
+ for (; q > p && isspace((unsigned char)*q); q--);
+ return (*p == '[' && *q == ']') || (*p == '{' && *q == '}');
+}
+
+/*
* call-seq: generate(obj)
*
* Generates a valid JSON document from object +obj+ and returns the
@@ -973,15 +917,9 @@ static VALUE cState_partial_generate(VALUE self, VALUE obj)
static VALUE cState_generate(VALUE self, VALUE obj)
{
VALUE result = cState_partial_generate(self, obj);
- VALUE re, args[2];
GET_STATE(self);
- if (!state->quirks_mode) {
- args[0] = rb_str_new2("\\A\\s*(?:\\[.*\\]|\\{.*\\})\\s*\\Z");
- args[1] = CRegexp_MULTILINE;
- re = rb_class_new_instance(2, args, rb_cRegexp);
- if (NIL_P(rb_funcall(re, i_match, 1, result))) {
- rb_raise(eGeneratorError, "only generation of JSON objects or arrays allowed");
- }
+ if (!state->quirks_mode && !isArrayOrObject(result)) {
+ rb_raise(eGeneratorError, "only generation of JSON objects or arrays allowed");
}
return result;
}
@@ -1003,12 +941,15 @@ static VALUE cState_generate(VALUE self, VALUE obj)
* encountered. This options defaults to false.
* * *quirks_mode*: Enables quirks_mode for parser, that is for example
* generating single JSON values instead of documents is possible.
+ * * *buffer_initial_length*: sets the initial length of the generator's
+ * internal buffer.
*/
static VALUE cState_initialize(int argc, VALUE *argv, VALUE self)
{
VALUE opts;
GET_STATE(self);
- state->max_nesting = 19;
+ state->max_nesting = 100;
+ state->buffer_initial_length = FBUFFER_INITIAL_LENGTH_DEFAULT;
rb_scan_args(argc, argv, "01", &opts);
if (!NIL_P(opts)) cState_configure(self, opts);
return self;
@@ -1069,7 +1010,7 @@ static VALUE cState_from_state_s(VALUE self, VALUE opts)
static VALUE cState_indent(VALUE self)
{
GET_STATE(self);
- return state->indent ? rb_str_new2(state->indent) : rb_str_new2("");
+ return state->indent ? rb_str_new(state->indent, state->indent_len) : rb_str_new2("");
}
/*
@@ -1106,7 +1047,7 @@ static VALUE cState_indent_set(VALUE self, VALUE indent)
static VALUE cState_space(VALUE self)
{
GET_STATE(self);
- return state->space ? rb_str_new2(state->space) : rb_str_new2("");
+ return state->space ? rb_str_new(state->space, state->space_len) : rb_str_new2("");
}
/*
@@ -1143,7 +1084,7 @@ static VALUE cState_space_set(VALUE self, VALUE space)
static VALUE cState_space_before(VALUE self)
{
GET_STATE(self);
- return state->space_before ? rb_str_new2(state->space_before) : rb_str_new2("");
+ return state->space_before ? rb_str_new(state->space_before, state->space_before_len) : rb_str_new2("");
}
/*
@@ -1180,7 +1121,7 @@ static VALUE cState_space_before_set(VALUE self, VALUE space_before)
static VALUE cState_object_nl(VALUE self)
{
GET_STATE(self);
- return state->object_nl ? rb_str_new2(state->object_nl) : rb_str_new2("");
+ return state->object_nl ? rb_str_new(state->object_nl, state->object_nl_len) : rb_str_new2("");
}
/*
@@ -1216,7 +1157,7 @@ static VALUE cState_object_nl_set(VALUE self, VALUE object_nl)
static VALUE cState_array_nl(VALUE self)
{
GET_STATE(self);
- return state->array_nl ? rb_str_new2(state->array_nl) : rb_str_new2("");
+ return state->array_nl ? rb_str_new(state->array_nl, state->array_nl_len) : rb_str_new2("");
}
/*
@@ -1349,7 +1290,37 @@ static VALUE cState_depth_set(VALUE self, VALUE depth)
{
GET_STATE(self);
Check_Type(depth, T_FIXNUM);
- return state->depth = FIX2LONG(depth);
+ state->depth = FIX2LONG(depth);
+ return Qnil;
+}
+
+/*
+ * call-seq: buffer_initial_length
+ *
+ * This integer returns the current inital length of the buffer.
+ */
+static VALUE cState_buffer_initial_length(VALUE self)
+{
+ GET_STATE(self);
+ return LONG2FIX(state->buffer_initial_length);
+}
+
+/*
+ * call-seq: buffer_initial_length=(length)
+ *
+ * This sets the initial length of the buffer to +length+, if +length+ > 0,
+ * otherwise its value isn't changed.
+ */
+static VALUE cState_buffer_initial_length_set(VALUE self, VALUE buffer_initial_length)
+{
+ long initial_length;
+ GET_STATE(self);
+ Check_Type(buffer_initial_length, T_FIXNUM);
+ initial_length = FIX2LONG(buffer_initial_length);
+ if (initial_length > 0) {
+ state->buffer_initial_length = initial_length;
+ }
+ return Qnil;
}
/*
@@ -1391,10 +1362,14 @@ void Init_generator()
rb_define_method(cState, "quirks_mode=", cState_quirks_mode_set, 1);
rb_define_method(cState, "depth", cState_depth, 0);
rb_define_method(cState, "depth=", cState_depth_set, 1);
+ rb_define_method(cState, "buffer_initial_length", cState_buffer_initial_length, 0);
+ rb_define_method(cState, "buffer_initial_length=", cState_buffer_initial_length_set, 1);
rb_define_method(cState, "configure", cState_configure, 1);
rb_define_alias(cState, "merge", "configure");
rb_define_method(cState, "to_h", cState_to_h, 0);
+ rb_define_alias(cState, "to_hash", "to_h");
rb_define_method(cState, "[]", cState_aref, 1);
+ rb_define_method(cState, "[]=", cState_aset, 2);
rb_define_method(cState, "generate", cState_generate, 1);
mGeneratorMethods = rb_define_module_under(mGenerator, "GeneratorMethods");
@@ -1438,6 +1413,7 @@ void Init_generator()
i_ascii_only = rb_intern("ascii_only");
i_quirks_mode = rb_intern("quirks_mode");
i_depth = rb_intern("depth");
+ i_buffer_initial_length = rb_intern("buffer_initial_length");
i_pack = rb_intern("pack");
i_unpack = rb_intern("unpack");
i_create_id = rb_intern("create_id");
diff --git a/ext/json/generator/generator.h b/ext/json/generator/generator.h
index f882ea004b..b58cc4bc2f 100644
--- a/ext/json/generator/generator.h
+++ b/ext/json/generator/generator.h
@@ -2,80 +2,26 @@
#define _GENERATOR_H_
#include <string.h>
-#include <assert.h>
#include <math.h>
+#include <ctype.h>
#include "ruby.h"
-#if HAVE_RUBY_RE_H
+#ifdef HAVE_RUBY_RE_H
#include "ruby/re.h"
-#endif
-
-#if HAVE_RE_H
-#include "re.h"
-#endif
-
-#ifdef HAVE_RUBY_ENCODING_H
-#include "ruby/encoding.h"
-#define FORCE_UTF8(obj) rb_enc_associate((obj), rb_utf8_encoding())
#else
-#define FORCE_UTF8(obj)
-#endif
-
-#define option_given_p(opts, key) RTEST(rb_funcall(opts, i_key_p, 1, key))
-
-#ifndef RHASH_SIZE
-#define RHASH_SIZE(hsh) (RHASH(hsh)->tbl->num_entries)
-#endif
-
-#ifndef RFLOAT_VALUE
-#define RFLOAT_VALUE(val) (RFLOAT(val)->value)
+#include "re.h"
#endif
-#ifndef RARRAY_PTR
-#define RARRAY_PTR(ARRAY) RARRAY(ARRAY)->ptr
-#endif
-#ifndef RARRAY_LEN
-#define RARRAY_LEN(ARRAY) RARRAY(ARRAY)->len
-#endif
-#ifndef RSTRING_PTR
-#define RSTRING_PTR(string) RSTRING(string)->ptr
-#endif
-#ifndef RSTRING_LEN
-#define RSTRING_LEN(string) RSTRING(string)->len
+#ifndef rb_intern_str
+#define rb_intern_str(string) SYM2ID(rb_str_intern(string))
#endif
-/* We don't need to guard objects for rbx, so let's do nothing at all. */
-#ifndef RB_GC_GUARD
-#define RB_GC_GUARD(object)
+#ifndef rb_obj_instance_variables
+#define rb_obj_instance_variables(object) rb_funcall(object, rb_intern("instance_variables"), 0)
#endif
-/* fbuffer implementation */
-
-typedef struct FBufferStruct {
- unsigned long initial_length;
- char *ptr;
- unsigned long len;
- unsigned long capa;
-} FBuffer;
-
-#define FBUFFER_INITIAL_LENGTH 4096
-
-#define FBUFFER_PTR(fb) (fb->ptr)
-#define FBUFFER_LEN(fb) (fb->len)
-#define FBUFFER_CAPA(fb) (fb->capa)
-#define FBUFFER_PAIR(fb) FBUFFER_PTR(fb), FBUFFER_LEN(fb)
-
-static char *fstrndup(const char *ptr, unsigned long len);
-static FBuffer *fbuffer_alloc();
-static FBuffer *fbuffer_alloc_with_length(unsigned long initial_length);
-static void fbuffer_free(FBuffer *fb);
-static void fbuffer_clear(FBuffer *fb);
-static void fbuffer_append(FBuffer *fb, const char *newstr, unsigned long len);
-static void fbuffer_append_long(FBuffer *fb, long number);
-static void fbuffer_append_char(FBuffer *fb, char newchr);
-static FBuffer *fbuffer_dup(FBuffer *fb);
-static VALUE fbuffer_to_s(FBuffer *fb);
+#define option_given_p(opts, key) RTEST(rb_funcall(opts, i_key_p, 1, key))
/* unicode defintions */
@@ -106,6 +52,7 @@ static void unicode_escape(char *buf, UTF16 character);
static void unicode_escape_to_buffer(FBuffer *buffer, char buf[6], UTF16 character);
static void convert_UTF8_to_JSON_ASCII(FBuffer *buffer, VALUE string);
static void convert_UTF8_to_JSON(FBuffer *buffer, VALUE string);
+static char *fstrndup(const char *ptr, unsigned long len);
/* ruby api and some helpers */
@@ -128,6 +75,7 @@ typedef struct JSON_Generator_StateStruct {
char ascii_only;
char quirks_mode;
long depth;
+ long buffer_initial_length;
} JSON_Generator_State;
#define GET_STATE(self) \
diff --git a/ext/json/lib/json.rb b/ext/json/lib/json.rb
index 00fe4cae84..24aa385c91 100644
--- a/ext/json/lib/json.rb
+++ b/ext/json/lib/json.rb
@@ -1,3 +1,5 @@
+require 'json/common'
+
##
# = JavaScript Object Notation (JSON)
#
@@ -49,8 +51,6 @@
#
# 1.to_json => "1"
#
-
-require 'json/common'
module JSON
require 'json/version'
diff --git a/ext/json/lib/json/add/bigdecimal.rb b/ext/json/lib/json/add/bigdecimal.rb
new file mode 100644
index 0000000000..0ef69f12e0
--- /dev/null
+++ b/ext/json/lib/json/add/bigdecimal.rb
@@ -0,0 +1,28 @@
+unless defined?(::JSON::JSON_LOADED) and ::JSON::JSON_LOADED
+ require 'json'
+end
+defined?(::BigDecimal) or require 'bigdecimal'
+
+class BigDecimal
+ # Import a JSON Marshalled object.
+ #
+ # method used for JSON marshalling support.
+ def self.json_create(object)
+ BigDecimal._load object['b']
+ end
+
+ # Marshal the object to JSON.
+ #
+ # method used for JSON marshalling support.
+ def as_json(*)
+ {
+ JSON.create_id => self.class.name,
+ 'b' => _dump,
+ }
+ end
+
+ # return the JSON value
+ def to_json(*)
+ as_json.to_json
+ end
+end
diff --git a/ext/json/lib/json/add/core.rb b/ext/json/lib/json/add/core.rb
index 01b8e0412b..77d9dc0b20 100644
--- a/ext/json/lib/json/add/core.rb
+++ b/ext/json/lib/json/add/core.rb
@@ -1,246 +1,11 @@
-# This file contains implementations of ruby core's custom objects for
+# This file requires the implementations of ruby core's custom objects for
# serialisation/deserialisation.
-unless defined?(::JSON::JSON_LOADED) and ::JSON::JSON_LOADED
- require 'json'
-end
-require 'date'
-
-# Symbol serialization/deserialization
-class Symbol
- # Returns a hash, that will be turned into a JSON object and represent this
- # object.
- def as_json(*)
- {
- JSON.create_id => self.class.name,
- 's' => to_s,
- }
- end
-
- # Stores class name (Symbol) with String representation of Symbol as a JSON string.
- def to_json(*a)
- as_json.to_json(*a)
- end
-
- # Deserializes JSON string by converting the <tt>string</tt> value stored in the object to a Symbol
- def self.json_create(o)
- o['s'].to_sym
- end
-end
-
-# Time serialization/deserialization
-class Time
-
- # Deserializes JSON string by converting time since epoch to Time
- def self.json_create(object)
- if usec = object.delete('u') # used to be tv_usec -> tv_nsec
- object['n'] = usec * 1000
- end
- if instance_methods.include?(:tv_nsec)
- at(object['s'], Rational(object['n'], 1000))
- else
- at(object['s'], object['n'] / 1000)
- end
- end
-
- # Returns a hash, that will be turned into a JSON object and represent this
- # object.
- def as_json(*)
- nanoseconds = [ tv_usec * 1000 ]
- respond_to?(:tv_nsec) and nanoseconds << tv_nsec
- nanoseconds = nanoseconds.max
- {
- JSON.create_id => self.class.name,
- 's' => tv_sec,
- 'n' => nanoseconds,
- }
- end
-
- # Stores class name (Time) with number of seconds since epoch and number of
- # microseconds for Time as JSON string
- def to_json(*args)
- as_json.to_json(*args)
- end
-end
-
-# Date serialization/deserialization
-class Date
-
- # Deserializes JSON string by converting Julian year <tt>y</tt>, month
- # <tt>m</tt>, day <tt>d</tt> and Day of Calendar Reform <tt>sg</tt> to Date.
- def self.json_create(object)
- civil(*object.values_at('y', 'm', 'd', 'sg'))
- end
-
- alias start sg unless method_defined?(:start)
-
- # Returns a hash, that will be turned into a JSON object and represent this
- # object.
- def as_json(*)
- {
- JSON.create_id => self.class.name,
- 'y' => year,
- 'm' => month,
- 'd' => day,
- 'sg' => start,
- }
- end
-
- # Stores class name (Date) with Julian year <tt>y</tt>, month <tt>m</tt>, day
- # <tt>d</tt> and Day of Calendar Reform <tt>sg</tt> as JSON string
- def to_json(*args)
- as_json.to_json(*args)
- end
-end
-
-# DateTime serialization/deserialization
-class DateTime
-
- # Deserializes JSON string by converting year <tt>y</tt>, month <tt>m</tt>,
- # day <tt>d</tt>, hour <tt>H</tt>, minute <tt>M</tt>, second <tt>S</tt>,
- # offset <tt>of</tt> and Day of Calendar Reform <tt>sg</tt> to DateTime.
- def self.json_create(object)
- args = object.values_at('y', 'm', 'd', 'H', 'M', 'S')
- of_a, of_b = object['of'].split('/')
- if of_b and of_b != '0'
- args << Rational(of_a.to_i, of_b.to_i)
- else
- args << of_a
- end
- args << object['sg']
- civil(*args)
- end
-
- alias start sg unless method_defined?(:start)
-
- # Returns a hash, that will be turned into a JSON object and represent this
- # object.
- def as_json(*)
- {
- JSON.create_id => self.class.name,
- 'y' => year,
- 'm' => month,
- 'd' => day,
- 'H' => hour,
- 'M' => min,
- 'S' => sec,
- 'of' => offset.to_s,
- 'sg' => start,
- }
- end
-
- # Stores class name (DateTime) with Julian year <tt>y</tt>, month <tt>m</tt>,
- # day <tt>d</tt>, hour <tt>H</tt>, minute <tt>M</tt>, second <tt>S</tt>,
- # offset <tt>of</tt> and Day of Calendar Reform <tt>sg</tt> as JSON string
- def to_json(*args)
- as_json.to_json(*args)
- end
-end
-
-# Range serialization/deserialization
-class Range
-
- # Deserializes JSON string by constructing new Range object with arguments
- # <tt>a</tt> serialized by <tt>to_json</tt>.
- def self.json_create(object)
- new(*object['a'])
- end
-
- # Returns a hash, that will be turned into a JSON object and represent this
- # object.
- def as_json(*)
- {
- JSON.create_id => self.class.name,
- 'a' => [ first, last, exclude_end? ]
- }
- end
-
- # Stores class name (Range) with JSON array of arguments <tt>a</tt> which
- # include <tt>first</tt> (integer), <tt>last</tt> (integer), and
- # <tt>exclude_end?</tt> (boolean) as JSON string.
- def to_json(*args)
- as_json.to_json(*args)
- end
-end
-
-# Struct serialization/deserialization
-class Struct
-
- # Deserializes JSON string by constructing new Struct object with values
- # <tt>v</tt> serialized by <tt>to_json</tt>.
- def self.json_create(object)
- new(*object['v'])
- end
-
- # Returns a hash, that will be turned into a JSON object and represent this
- # object.
- def as_json(*)
- klass = self.class.name
- klass.to_s.empty? and raise JSON::JSONError, "Only named structs are supported!"
- {
- JSON.create_id => klass,
- 'v' => values,
- }
- end
-
- # Stores class name (Struct) with Struct values <tt>v</tt> as a JSON string.
- # Only named structs are supported.
- def to_json(*args)
- as_json.to_json(*args)
- end
-end
-
-# Exception serialization/deserialization
-class Exception
-
- # Deserializes JSON string by constructing new Exception object with message
- # <tt>m</tt> and backtrace <tt>b</tt> serialized with <tt>to_json</tt>
- def self.json_create(object)
- result = new(object['m'])
- result.set_backtrace object['b']
- result
- end
-
- # Returns a hash, that will be turned into a JSON object and represent this
- # object.
- def as_json(*)
- {
- JSON.create_id => self.class.name,
- 'm' => message,
- 'b' => backtrace,
- }
- end
-
- # Stores class name (Exception) with message <tt>m</tt> and backtrace array
- # <tt>b</tt> as JSON string
- def to_json(*args)
- as_json.to_json(*args)
- end
-end
-
-# Regexp serialization/deserialization
-class Regexp
-
- # Deserializes JSON string by constructing new Regexp object with source
- # <tt>s</tt> (Regexp or String) and options <tt>o</tt> serialized by
- # <tt>to_json</tt>
- def self.json_create(object)
- new(object['s'], object['o'])
- end
-
- # Returns a hash, that will be turned into a JSON object and represent this
- # object.
- def as_json(*)
- {
- JSON.create_id => self.class.name,
- 'o' => options,
- 's' => source,
- }
- end
-
- # Stores class name (Regexp) with options <tt>o</tt> and source <tt>s</tt>
- # (Regexp or String) as JSON string
- def to_json(*)
- as_json.to_json
- end
-end
+require 'json/add/date'
+require 'json/add/date_time'
+require 'json/add/exception'
+require 'json/add/range'
+require 'json/add/regexp'
+require 'json/add/struct'
+require 'json/add/symbol'
+require 'json/add/time'
diff --git a/ext/json/lib/json/add/date.rb b/ext/json/lib/json/add/date.rb
new file mode 100644
index 0000000000..4288237db1
--- /dev/null
+++ b/ext/json/lib/json/add/date.rb
@@ -0,0 +1,34 @@
+unless defined?(::JSON::JSON_LOADED) and ::JSON::JSON_LOADED
+ require 'json'
+end
+require 'date'
+
+# Date serialization/deserialization
+class Date
+
+ # Deserializes JSON string by converting Julian year <tt>y</tt>, month
+ # <tt>m</tt>, day <tt>d</tt> and Day of Calendar Reform <tt>sg</tt> to Date.
+ def self.json_create(object)
+ civil(*object.values_at('y', 'm', 'd', 'sg'))
+ end
+
+ alias start sg unless method_defined?(:start)
+
+ # Returns a hash, that will be turned into a JSON object and represent this
+ # object.
+ def as_json(*)
+ {
+ JSON.create_id => self.class.name,
+ 'y' => year,
+ 'm' => month,
+ 'd' => day,
+ 'sg' => start,
+ }
+ end
+
+ # Stores class name (Date) with Julian year <tt>y</tt>, month <tt>m</tt>, day
+ # <tt>d</tt> and Day of Calendar Reform <tt>sg</tt> as JSON string
+ def to_json(*args)
+ as_json.to_json(*args)
+ end
+end
diff --git a/ext/json/lib/json/add/date_time.rb b/ext/json/lib/json/add/date_time.rb
new file mode 100644
index 0000000000..5ea42ea656
--- /dev/null
+++ b/ext/json/lib/json/add/date_time.rb
@@ -0,0 +1,50 @@
+unless defined?(::JSON::JSON_LOADED) and ::JSON::JSON_LOADED
+ require 'json'
+end
+require 'date'
+
+# DateTime serialization/deserialization
+class DateTime
+
+ # Deserializes JSON string by converting year <tt>y</tt>, month <tt>m</tt>,
+ # day <tt>d</tt>, hour <tt>H</tt>, minute <tt>M</tt>, second <tt>S</tt>,
+ # offset <tt>of</tt> and Day of Calendar Reform <tt>sg</tt> to DateTime.
+ def self.json_create(object)
+ args = object.values_at('y', 'm', 'd', 'H', 'M', 'S')
+ of_a, of_b = object['of'].split('/')
+ if of_b and of_b != '0'
+ args << Rational(of_a.to_i, of_b.to_i)
+ else
+ args << of_a
+ end
+ args << object['sg']
+ civil(*args)
+ end
+
+ alias start sg unless method_defined?(:start)
+
+ # Returns a hash, that will be turned into a JSON object and represent this
+ # object.
+ def as_json(*)
+ {
+ JSON.create_id => self.class.name,
+ 'y' => year,
+ 'm' => month,
+ 'd' => day,
+ 'H' => hour,
+ 'M' => min,
+ 'S' => sec,
+ 'of' => offset.to_s,
+ 'sg' => start,
+ }
+ end
+
+ # Stores class name (DateTime) with Julian year <tt>y</tt>, month <tt>m</tt>,
+ # day <tt>d</tt>, hour <tt>H</tt>, minute <tt>M</tt>, second <tt>S</tt>,
+ # offset <tt>of</tt> and Day of Calendar Reform <tt>sg</tt> as JSON string
+ def to_json(*args)
+ as_json.to_json(*args)
+ end
+end
+
+
diff --git a/ext/json/lib/json/add/exception.rb b/ext/json/lib/json/add/exception.rb
new file mode 100644
index 0000000000..e6ad257abf
--- /dev/null
+++ b/ext/json/lib/json/add/exception.rb
@@ -0,0 +1,31 @@
+unless defined?(::JSON::JSON_LOADED) and ::JSON::JSON_LOADED
+ require 'json'
+end
+
+# Exception serialization/deserialization
+class Exception
+
+ # Deserializes JSON string by constructing new Exception object with message
+ # <tt>m</tt> and backtrace <tt>b</tt> serialized with <tt>to_json</tt>
+ def self.json_create(object)
+ result = new(object['m'])
+ result.set_backtrace object['b']
+ result
+ end
+
+ # Returns a hash, that will be turned into a JSON object and represent this
+ # object.
+ def as_json(*)
+ {
+ JSON.create_id => self.class.name,
+ 'm' => message,
+ 'b' => backtrace,
+ }
+ end
+
+ # Stores class name (Exception) with message <tt>m</tt> and backtrace array
+ # <tt>b</tt> as JSON string
+ def to_json(*args)
+ as_json.to_json(*args)
+ end
+end
diff --git a/ext/json/lib/json/add/ostruct.rb b/ext/json/lib/json/add/ostruct.rb
new file mode 100644
index 0000000000..da81e107a7
--- /dev/null
+++ b/ext/json/lib/json/add/ostruct.rb
@@ -0,0 +1,31 @@
+unless defined?(::JSON::JSON_LOADED) and ::JSON::JSON_LOADED
+ require 'json'
+end
+require 'ostruct'
+
+# OpenStruct serialization/deserialization
+class OpenStruct
+
+ # Deserializes JSON string by constructing new Struct object with values
+ # <tt>v</tt> serialized by <tt>to_json</tt>.
+ def self.json_create(object)
+ new(object['t'] || object[:t])
+ end
+
+ # Returns a hash, that will be turned into a JSON object and represent this
+ # object.
+ def as_json(*)
+ klass = self.class.name
+ klass.to_s.empty? and raise JSON::JSONError, "Only named structs are supported!"
+ {
+ JSON.create_id => klass,
+ 't' => table,
+ }
+ end
+
+ # Stores class name (OpenStruct) with this struct's values <tt>v</tt> as a
+ # JSON string.
+ def to_json(*args)
+ as_json.to_json(*args)
+ end
+end
diff --git a/ext/json/lib/json/add/range.rb b/ext/json/lib/json/add/range.rb
new file mode 100644
index 0000000000..e61e553cdb
--- /dev/null
+++ b/ext/json/lib/json/add/range.rb
@@ -0,0 +1,29 @@
+unless defined?(::JSON::JSON_LOADED) and ::JSON::JSON_LOADED
+ require 'json'
+end
+
+# Range serialization/deserialization
+class Range
+
+ # Deserializes JSON string by constructing new Range object with arguments
+ # <tt>a</tt> serialized by <tt>to_json</tt>.
+ def self.json_create(object)
+ new(*object['a'])
+ end
+
+ # Returns a hash, that will be turned into a JSON object and represent this
+ # object.
+ def as_json(*)
+ {
+ JSON.create_id => self.class.name,
+ 'a' => [ first, last, exclude_end? ]
+ }
+ end
+
+ # Stores class name (Range) with JSON array of arguments <tt>a</tt> which
+ # include <tt>first</tt> (integer), <tt>last</tt> (integer), and
+ # <tt>exclude_end?</tt> (boolean) as JSON string.
+ def to_json(*args)
+ as_json.to_json(*args)
+ end
+end
diff --git a/ext/json/lib/json/add/regexp.rb b/ext/json/lib/json/add/regexp.rb
new file mode 100644
index 0000000000..2fcbb6fb14
--- /dev/null
+++ b/ext/json/lib/json/add/regexp.rb
@@ -0,0 +1,30 @@
+unless defined?(::JSON::JSON_LOADED) and ::JSON::JSON_LOADED
+ require 'json'
+end
+
+# Regexp serialization/deserialization
+class Regexp
+
+ # Deserializes JSON string by constructing new Regexp object with source
+ # <tt>s</tt> (Regexp or String) and options <tt>o</tt> serialized by
+ # <tt>to_json</tt>
+ def self.json_create(object)
+ new(object['s'], object['o'])
+ end
+
+ # Returns a hash, that will be turned into a JSON object and represent this
+ # object.
+ def as_json(*)
+ {
+ JSON.create_id => self.class.name,
+ 'o' => options,
+ 's' => source,
+ }
+ end
+
+ # Stores class name (Regexp) with options <tt>o</tt> and source <tt>s</tt>
+ # (Regexp or String) as JSON string
+ def to_json(*)
+ as_json.to_json
+ end
+end
diff --git a/ext/json/lib/json/add/struct.rb b/ext/json/lib/json/add/struct.rb
new file mode 100644
index 0000000000..6847cde99b
--- /dev/null
+++ b/ext/json/lib/json/add/struct.rb
@@ -0,0 +1,30 @@
+unless defined?(::JSON::JSON_LOADED) and ::JSON::JSON_LOADED
+ require 'json'
+end
+
+# Struct serialization/deserialization
+class Struct
+
+ # Deserializes JSON string by constructing new Struct object with values
+ # <tt>v</tt> serialized by <tt>to_json</tt>.
+ def self.json_create(object)
+ new(*object['v'])
+ end
+
+ # Returns a hash, that will be turned into a JSON object and represent this
+ # object.
+ def as_json(*)
+ klass = self.class.name
+ klass.to_s.empty? and raise JSON::JSONError, "Only named structs are supported!"
+ {
+ JSON.create_id => klass,
+ 'v' => values,
+ }
+ end
+
+ # Stores class name (Struct) with Struct values <tt>v</tt> as a JSON string.
+ # Only named structs are supported.
+ def to_json(*args)
+ as_json.to_json(*args)
+ end
+end
diff --git a/ext/json/lib/json/add/symbol.rb b/ext/json/lib/json/add/symbol.rb
new file mode 100644
index 0000000000..03dc9a56a5
--- /dev/null
+++ b/ext/json/lib/json/add/symbol.rb
@@ -0,0 +1,25 @@
+unless defined?(::JSON::JSON_LOADED) and ::JSON::JSON_LOADED
+ require 'json'
+end
+
+# Symbol serialization/deserialization
+class Symbol
+ # Returns a hash, that will be turned into a JSON object and represent this
+ # object.
+ def as_json(*)
+ {
+ JSON.create_id => self.class.name,
+ 's' => to_s,
+ }
+ end
+
+ # Stores class name (Symbol) with String representation of Symbol as a JSON string.
+ def to_json(*a)
+ as_json.to_json(*a)
+ end
+
+ # Deserializes JSON string by converting the <tt>string</tt> value stored in the object to a Symbol
+ def self.json_create(o)
+ o['s'].to_sym
+ end
+end
diff --git a/ext/json/lib/json/add/time.rb b/ext/json/lib/json/add/time.rb
new file mode 100644
index 0000000000..338209d899
--- /dev/null
+++ b/ext/json/lib/json/add/time.rb
@@ -0,0 +1,38 @@
+unless defined?(::JSON::JSON_LOADED) and ::JSON::JSON_LOADED
+ require 'json'
+end
+
+# Time serialization/deserialization
+class Time
+
+ # Deserializes JSON string by converting time since epoch to Time
+ def self.json_create(object)
+ if usec = object.delete('u') # used to be tv_usec -> tv_nsec
+ object['n'] = usec * 1000
+ end
+ if instance_methods.include?(:tv_nsec)
+ at(object['s'], Rational(object['n'], 1000))
+ else
+ at(object['s'], object['n'] / 1000)
+ end
+ end
+
+ # Returns a hash, that will be turned into a JSON object and represent this
+ # object.
+ def as_json(*)
+ nanoseconds = [ tv_usec * 1000 ]
+ respond_to?(:tv_nsec) and nanoseconds << tv_nsec
+ nanoseconds = nanoseconds.max
+ {
+ JSON.create_id => self.class.name,
+ 's' => tv_sec,
+ 'n' => nanoseconds,
+ }
+ end
+
+ # Stores class name (Time) with number of seconds since epoch and number of
+ # microseconds for Time as JSON string
+ def to_json(*args)
+ as_json.to_json(*args)
+ end
+end
diff --git a/ext/json/lib/json/common.rb b/ext/json/lib/json/common.rb
index 9ad1fab545..e24f637f61 100644
--- a/ext/json/lib/json/common.rb
+++ b/ext/json/lib/json/common.rb
@@ -1,4 +1,5 @@
require 'json/version'
+require 'json/generic_object'
module JSON
class << self
@@ -102,7 +103,13 @@ module JSON
MinusInfinity = -Infinity
# The base exception for JSON errors.
- class JSONError < StandardError; end
+ class JSONError < StandardError
+ def self.wrap(exception)
+ obj = new("Wrapped(#{exception.class}): #{exception.message.inspect}")
+ obj.set_backtrace exception.backtrace
+ obj
+ end
+ end
# This exception is raised if a parser error occurs.
class ParserError < JSONError; end
@@ -132,7 +139,7 @@ module JSON
# keys:
# * *max_nesting*: The maximum depth of nesting allowed in the parsed data
# structures. Disable depth checking with :max_nesting => false. It defaults
- # to 19.
+ # to 100.
# * *allow_nan*: If set to true, allow NaN, Infinity and -Infinity in
# defiance of RFC 4627 to be parsed by the Parser. This option defaults
# to false.
@@ -141,7 +148,7 @@ module JSON
# the default.
# * *create_additions*: If set to false, the Parser doesn't create
# additions even if a matching class and create_id was found. This option
- # defaults to false.
+ # defaults to true.
# * *object_class*: Defaults to Hash
# * *array_class*: Defaults to Array
def parse(source, opts = {})
@@ -162,7 +169,7 @@ module JSON
# to true.
# * *create_additions*: If set to false, the Parser doesn't create
# additions even if a matching class and create_id was found. This option
- # defaults to false.
+ # defaults to true.
def parse!(source, opts = {})
opts = {
:max_nesting => false,
@@ -192,7 +199,7 @@ module JSON
# encountered. This options defaults to false.
# * *max_nesting*: The maximum depth of nesting allowed in the data
# structures from which JSON is to be generated. Disable depth checking
- # with :max_nesting => false, it defaults to 19.
+ # with :max_nesting => false, it defaults to 100.
#
# See also the fast_generate for the fastest creation method with the least
# amount of sanity checks, and the pretty_generate method for some
@@ -284,28 +291,46 @@ module JSON
module_function :pretty_unparse
# :startdoc:
+ class << self
+ # The global default options for the JSON.load method:
+ # :max_nesting: false
+ # :allow_nan: true
+ # :quirks_mode: true
+ attr_accessor :load_default_options
+ end
+ self.load_default_options = {
+ :max_nesting => false,
+ :allow_nan => true,
+ :quirks_mode => true,
+ :create_additions => true,
+ }
+
# Load a ruby data structure from a JSON _source_ and return it. A source can
# either be a string-like object, an IO-like object, or an object responding
# to the read method. If _proc_ was given, it will be called with any nested
# Ruby object as an argument recursively in depth first order. To modify the
# default options pass in the optional _options_ argument as well.
#
+ # BEWARE: This method is meant to serialise data from trusted user input,
+ # like from your own database server or clients under your control, it could
+ # be dangerous to allow untrusted users to pass JSON sources into it. The
+ # default options for the parser can be changed via the load_default_options
+ # method.
+ #
# This method is part of the implementation of the load/dump interface of
# Marshal and YAML.
def load(source, proc = nil, options = {})
- load_default_options = {
- :max_nesting => false,
- :allow_nan => true,
- :create_additions => false
- }
opts = load_default_options.merge options
if source.respond_to? :to_str
source = source.to_str
elsif source.respond_to? :to_io
source = source.to_io.read
- else
+ elsif source.respond_to?(:read)
source = source.read
end
+ if opts[:quirks_mode] && (source.nil? || source.empty?)
+ source = 'null'
+ end
result = parse(source, opts)
recurse_proc(result, &proc) if proc
result
@@ -328,6 +353,19 @@ module JSON
alias restore load
module_function :restore
+ class << self
+ # The global default options for the JSON.dump method:
+ # :max_nesting: false
+ # :allow_nan: true
+ # :quirks_mode: true
+ attr_accessor :dump_default_options
+ end
+ self.dump_default_options = {
+ :max_nesting => false,
+ :allow_nan => true,
+ :quirks_mode => true,
+ }
+
# Dumps _obj_ as a JSON string, i.e. calls generate on the object and returns
# the result.
#
@@ -338,6 +376,9 @@ module JSON
# exception is raised. This argument is similar (but not exactly the
# same!) to the _limit_ argument in Marshal.dump.
#
+ # The default options for the generator can be changed via the
+ # dump_default_options method.
+ #
# This method is part of the implementation of the load/dump interface of
# Marshal and YAML.
def dump(obj, anIO = nil, limit = nil)
@@ -348,8 +389,9 @@ module JSON
anIO = nil
end
end
- limit ||= 0
- result = generate(obj, :allow_nan => true, :max_nesting => limit)
+ opts = JSON.dump_default_options
+ limit and opts.update(:max_nesting => limit)
+ result = generate(obj, opts)
if anIO
anIO.write result
anIO
diff --git a/ext/json/lib/json/ext.rb b/ext/json/lib/json/ext.rb
index 7264a857fa..c5f813181d 100644
--- a/ext/json/lib/json/ext.rb
+++ b/ext/json/lib/json/ext.rb
@@ -1,3 +1,9 @@
+if ENV['SIMPLECOV_COVERAGE'].to_i == 1
+ require 'simplecov'
+ SimpleCov.start do
+ add_filter "/tests/"
+ end
+end
require 'json/common'
module JSON
diff --git a/ext/json/lib/json/generic_object.rb b/ext/json/lib/json/generic_object.rb
new file mode 100644
index 0000000000..8b8fd53bef
--- /dev/null
+++ b/ext/json/lib/json/generic_object.rb
@@ -0,0 +1,70 @@
+require 'ostruct'
+
+module JSON
+ class GenericObject < OpenStruct
+ class << self
+ alias [] new
+
+ def json_creatable?
+ @json_creatable
+ end
+
+ attr_writer :json_creatable
+
+ def json_create(data)
+ data = data.dup
+ data.delete JSON.create_id
+ self[data]
+ end
+
+ def from_hash(object)
+ case
+ when object.respond_to?(:to_hash)
+ result = new
+ object.to_hash.each do |key, value|
+ result[key] = from_hash(value)
+ end
+ result
+ when object.respond_to?(:to_ary)
+ object.to_ary.map { |a| from_hash(a) }
+ else
+ 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
+
+ def to_hash
+ table
+ end
+
+ def [](name)
+ table[name.to_sym]
+ end
+
+ def []=(name, value)
+ __send__ "#{name}=", value
+ end
+
+ def |(other)
+ self.class[other.to_hash.merge(to_hash)]
+ end
+
+ def as_json(*)
+ { JSON.create_id => self.class.name }.merge to_hash
+ end
+
+ def to_json(*a)
+ as_json.to_json(*a)
+ end
+ end
+end
diff --git a/ext/json/lib/json/version.rb b/ext/json/lib/json/version.rb
index baacdc9124..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.5.5'
+ 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 5eaf6dd040..498ffa964c 100644
--- a/ext/json/parser/depend
+++ b/ext/json/parser/depend
@@ -1 +1 @@
-parser.o: parser.c parser.h
+parser.o: parser.c parser.h $(srcdir)/../fbuffer/fbuffer.h
diff --git a/ext/json/parser/extconf.rb b/ext/json/parser/extconf.rb
index 4a10dd2ed6..ae4f861c79 100644
--- a/ext/json/parser/extconf.rb
+++ b/ext/json/parser/extconf.rb
@@ -1,10 +1,3 @@
require 'mkmf'
-require 'rbconfig'
-if RUBY_VERSION < "1.9"
- have_header("re.h")
-else
- have_header("ruby/re.h")
- have_header("ruby/encoding.h")
-end
create_makefile 'json/ext/parser'
diff --git a/ext/json/parser/parser.c b/ext/json/parser/parser.c
index 8a321a8839..df89f2c58b 100644
--- a/ext/json/parser/parser.c
+++ b/ext/json/parser/parser.c
@@ -1,5 +1,6 @@
#line 1 "parser.rl"
+#include "../fbuffer/fbuffer.h"
#include "parser.h"
/* unicode */
@@ -83,11 +84,11 @@ static ID i_json_creatable_p, i_json_create, i_create_id, i_create_additions,
i_match_string, i_aset, i_aref, i_leftshift;
-#line 109 "parser.rl"
+#line 110 "parser.rl"
-#line 91 "parser.c"
+#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;
@@ -95,7 +96,7 @@ static const int JSON_object_error = 0;
static const int JSON_object_en_main = 1;
-#line 150 "parser.rl"
+#line 151 "parser.rl"
static char *JSON_parse_object(JSON_Parser *json, char *p, char *pe, VALUE *result)
@@ -111,14 +112,14 @@ static char *JSON_parse_object(JSON_Parser *json, char *p, char *pe, VALUE *resu
*result = NIL_P(object_class) ? rb_hash_new() : rb_class_new_instance(0, 0, object_class);
-#line 115 "parser.c"
+#line 116 "parser.c"
{
cs = JSON_object_start;
}
-#line 165 "parser.rl"
+#line 166 "parser.rl"
-#line 122 "parser.c"
+#line 123 "parser.c"
{
if ( p == pe )
goto _test_eof;
@@ -146,7 +147,7 @@ case 2:
goto st2;
goto st0;
tr2:
-#line 132 "parser.rl"
+#line 133 "parser.rl"
{
char *np;
json->parsing_name = 1;
@@ -159,7 +160,7 @@ st3:
if ( ++p == pe )
goto _test_eof3;
case 3:
-#line 163 "parser.c"
+#line 164 "parser.c"
switch( (*p) ) {
case 13: goto st3;
case 32: goto st3;
@@ -226,7 +227,7 @@ case 8:
goto st8;
goto st0;
tr11:
-#line 117 "parser.rl"
+#line 118 "parser.rl"
{
VALUE v = Qnil;
char *np = JSON_parse_value(json, p, pe, &v);
@@ -246,7 +247,7 @@ st9:
if ( ++p == pe )
goto _test_eof9;
case 9:
-#line 250 "parser.c"
+#line 251 "parser.c"
switch( (*p) ) {
case 13: goto st9;
case 32: goto st9;
@@ -335,14 +336,14 @@ case 18:
goto st9;
goto st18;
tr4:
-#line 140 "parser.rl"
+#line 141 "parser.rl"
{ p--; {p++; cs = 27; goto _out;} }
goto st27;
st27:
if ( ++p == pe )
goto _test_eof27;
case 27:
-#line 346 "parser.c"
+#line 347 "parser.c"
goto st0;
st19:
if ( ++p == pe )
@@ -440,16 +441,16 @@ case 26:
_out: {}
}
-#line 166 "parser.rl"
+#line 167 "parser.rl"
if (cs >= JSON_object_first_final) {
if (json->create_additions) {
- VALUE klassname;
+ VALUE klassname;
if (NIL_P(json->object_class)) {
- klassname = rb_hash_aref(*result, json->create_id);
- } else {
- klassname = rb_funcall(*result, i_aref, 1, json->create_id);
- }
+ klassname = rb_hash_aref(*result, json->create_id);
+ } else {
+ klassname = rb_funcall(*result, i_aref, 1, json->create_id);
+ }
if (!NIL_P(klassname)) {
VALUE klass = rb_funcall(mJSON, i_deep_const_get, 1, klassname);
if (RTEST(rb_funcall(klass, i_json_creatable_p, 0))) {
@@ -465,7 +466,7 @@ case 26:
-#line 464 "parser.c"
+#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;
@@ -473,7 +474,7 @@ static const int JSON_value_error = 0;
static const int JSON_value_en_main = 1;
-#line 265 "parser.rl"
+#line 271 "parser.rl"
static char *JSON_parse_value(JSON_Parser *json, char *p, char *pe, VALUE *result)
@@ -481,14 +482,14 @@ static char *JSON_parse_value(JSON_Parser *json, char *p, char *pe, VALUE *resul
int cs = EVIL;
-#line 480 "parser.c"
+#line 486 "parser.c"
{
cs = JSON_value_start;
}
-#line 272 "parser.rl"
+#line 278 "parser.rl"
-#line 487 "parser.c"
+#line 493 "parser.c"
{
if ( p == pe )
goto _test_eof;
@@ -513,14 +514,14 @@ st0:
cs = 0;
goto _out;
tr0:
-#line 213 "parser.rl"
+#line 219 "parser.rl"
{
char *np = JSON_parse_string(json, p, pe, result);
if (np == NULL) { p--; {p++; cs = 21; goto _out;} } else {p = (( np))-1;}
}
goto st21;
tr2:
-#line 218 "parser.rl"
+#line 224 "parser.rl"
{
char *np;
if(pe > p + 9 - json->quirks_mode && !strncmp(MinusInfinity, p, 9)) {
@@ -540,7 +541,7 @@ tr2:
}
goto st21;
tr5:
-#line 236 "parser.rl"
+#line 242 "parser.rl"
{
char *np;
json->current_nesting++;
@@ -550,7 +551,7 @@ tr5:
}
goto st21;
tr9:
-#line 244 "parser.rl"
+#line 250 "parser.rl"
{
char *np;
json->current_nesting++;
@@ -560,7 +561,7 @@ tr9:
}
goto st21;
tr16:
-#line 206 "parser.rl"
+#line 212 "parser.rl"
{
if (json->allow_nan) {
*result = CInfinity;
@@ -570,7 +571,7 @@ tr16:
}
goto st21;
tr18:
-#line 199 "parser.rl"
+#line 205 "parser.rl"
{
if (json->allow_nan) {
*result = CNaN;
@@ -580,19 +581,19 @@ tr18:
}
goto st21;
tr22:
-#line 193 "parser.rl"
+#line 199 "parser.rl"
{
*result = Qfalse;
}
goto st21;
tr25:
-#line 190 "parser.rl"
+#line 196 "parser.rl"
{
*result = Qnil;
}
goto st21;
tr28:
-#line 196 "parser.rl"
+#line 202 "parser.rl"
{
*result = Qtrue;
}
@@ -601,9 +602,9 @@ st21:
if ( ++p == pe )
goto _test_eof21;
case 21:
-#line 252 "parser.rl"
+#line 258 "parser.rl"
{ p--; {p++; cs = 21; goto _out;} }
-#line 602 "parser.c"
+#line 608 "parser.c"
goto st0;
st2:
if ( ++p == pe )
@@ -764,7 +765,7 @@ case 20:
_out: {}
}
-#line 273 "parser.rl"
+#line 279 "parser.rl"
if (cs >= JSON_value_first_final) {
return p;
@@ -774,7 +775,7 @@ case 20:
}
-#line 773 "parser.c"
+#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;
@@ -782,7 +783,7 @@ static const int JSON_integer_error = 0;
static const int JSON_integer_en_main = 1;
-#line 289 "parser.rl"
+#line 295 "parser.rl"
static char *JSON_parse_integer(JSON_Parser *json, char *p, char *pe, VALUE *result)
@@ -790,15 +791,15 @@ static char *JSON_parse_integer(JSON_Parser *json, char *p, char *pe, VALUE *res
int cs = EVIL;
-#line 789 "parser.c"
+#line 795 "parser.c"
{
cs = JSON_integer_start;
}
-#line 296 "parser.rl"
+#line 302 "parser.rl"
json->memo = p;
-#line 797 "parser.c"
+#line 803 "parser.c"
{
if ( p == pe )
goto _test_eof;
@@ -832,14 +833,14 @@ case 3:
goto st0;
goto tr4;
tr4:
-#line 286 "parser.rl"
+#line 292 "parser.rl"
{ p--; {p++; cs = 4; goto _out;} }
goto st4;
st4:
if ( ++p == pe )
goto _test_eof4;
case 4:
-#line 838 "parser.c"
+#line 844 "parser.c"
goto st0;
st5:
if ( ++p == pe )
@@ -858,11 +859,14 @@ case 5:
_out: {}
}
-#line 298 "parser.rl"
+#line 304 "parser.rl"
if (cs >= JSON_integer_first_final) {
long len = p - json->memo;
- *result = rb_Integer(rb_str_new(json->memo, len));
+ fbuffer_clear(json->fbuffer);
+ fbuffer_append(json->fbuffer, json->memo, len);
+ fbuffer_append_char(json->fbuffer, '\0');
+ *result = rb_cstr2inum(FBUFFER_PTR(json->fbuffer), 10);
return p + 1;
} else {
return NULL;
@@ -870,7 +874,7 @@ case 5:
}
-#line 869 "parser.c"
+#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;
@@ -878,7 +882,7 @@ static const int JSON_float_error = 0;
static const int JSON_float_en_main = 1;
-#line 320 "parser.rl"
+#line 329 "parser.rl"
static char *JSON_parse_float(JSON_Parser *json, char *p, char *pe, VALUE *result)
@@ -886,15 +890,15 @@ static char *JSON_parse_float(JSON_Parser *json, char *p, char *pe, VALUE *resul
int cs = EVIL;
-#line 885 "parser.c"
+#line 894 "parser.c"
{
cs = JSON_float_start;
}
-#line 327 "parser.rl"
+#line 336 "parser.rl"
json->memo = p;
-#line 893 "parser.c"
+#line 902 "parser.c"
{
if ( p == pe )
goto _test_eof;
@@ -952,14 +956,14 @@ case 8:
goto st0;
goto tr9;
tr9:
-#line 314 "parser.rl"
+#line 323 "parser.rl"
{ p--; {p++; cs = 9; goto _out;} }
goto st9;
st9:
if ( ++p == pe )
goto _test_eof9;
case 9:
-#line 958 "parser.c"
+#line 967 "parser.c"
goto st0;
st5:
if ( ++p == pe )
@@ -1020,11 +1024,14 @@ case 7:
_out: {}
}
-#line 329 "parser.rl"
+#line 338 "parser.rl"
if (cs >= JSON_float_first_final) {
long len = p - json->memo;
- *result = rb_Float(rb_str_new(json->memo, len));
+ fbuffer_clear(json->fbuffer);
+ fbuffer_append(json->fbuffer, json->memo, len);
+ fbuffer_append_char(json->fbuffer, '\0');
+ *result = rb_float_new(rb_cstr_to_dbl(FBUFFER_PTR(json->fbuffer), 1));
return p + 1;
} else {
return NULL;
@@ -1033,7 +1040,7 @@ case 7:
-#line 1032 "parser.c"
+#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;
@@ -1041,7 +1048,7 @@ static const int JSON_array_error = 0;
static const int JSON_array_en_main = 1;
-#line 369 "parser.rl"
+#line 381 "parser.rl"
static char *JSON_parse_array(JSON_Parser *json, char *p, char *pe, VALUE *result)
@@ -1055,14 +1062,14 @@ static char *JSON_parse_array(JSON_Parser *json, char *p, char *pe, VALUE *resul
*result = NIL_P(array_class) ? rb_ary_new() : rb_class_new_instance(0, 0, array_class);
-#line 1054 "parser.c"
+#line 1066 "parser.c"
{
cs = JSON_array_start;
}
-#line 382 "parser.rl"
+#line 394 "parser.rl"
-#line 1061 "parser.c"
+#line 1073 "parser.c"
{
if ( p == pe )
goto _test_eof;
@@ -1101,7 +1108,7 @@ case 2:
goto st2;
goto st0;
tr2:
-#line 346 "parser.rl"
+#line 358 "parser.rl"
{
VALUE v = Qnil;
char *np = JSON_parse_value(json, p, pe, &v);
@@ -1121,7 +1128,7 @@ st3:
if ( ++p == pe )
goto _test_eof3;
case 3:
-#line 1120 "parser.c"
+#line 1132 "parser.c"
switch( (*p) ) {
case 13: goto st3;
case 32: goto st3;
@@ -1221,14 +1228,14 @@ case 12:
goto st3;
goto st12;
tr4:
-#line 361 "parser.rl"
+#line 373 "parser.rl"
{ p--; {p++; cs = 17; goto _out;} }
goto st17;
st17:
if ( ++p == pe )
goto _test_eof17;
case 17:
-#line 1227 "parser.c"
+#line 1239 "parser.c"
goto st0;
st13:
if ( ++p == pe )
@@ -1284,7 +1291,7 @@ case 16:
_out: {}
}
-#line 383 "parser.rl"
+#line 395 "parser.rl"
if(cs >= JSON_array_first_final) {
return p + 1;
@@ -1365,7 +1372,7 @@ static VALUE json_string_unescape(VALUE result, char *string, char *stringEnd)
}
-#line 1364 "parser.c"
+#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;
@@ -1373,7 +1380,7 @@ static const int JSON_string_error = 0;
static const int JSON_string_en_main = 1;
-#line 482 "parser.rl"
+#line 494 "parser.rl"
static int
@@ -1395,15 +1402,15 @@ static char *JSON_parse_string(JSON_Parser *json, char *p, char *pe, VALUE *resu
*result = rb_str_buf_new(0);
-#line 1394 "parser.c"
+#line 1406 "parser.c"
{
cs = JSON_string_start;
}
-#line 503 "parser.rl"
+#line 515 "parser.rl"
json->memo = p;
-#line 1402 "parser.c"
+#line 1414 "parser.c"
{
if ( p == pe )
goto _test_eof;
@@ -1428,7 +1435,7 @@ case 2:
goto st0;
goto st2;
tr2:
-#line 468 "parser.rl"
+#line 480 "parser.rl"
{
*result = json_string_unescape(*result, json->memo + 1, p);
if (NIL_P(*result)) {
@@ -1439,14 +1446,14 @@ tr2:
{p = (( p + 1))-1;}
}
}
-#line 479 "parser.rl"
+#line 491 "parser.rl"
{ p--; {p++; cs = 8; goto _out;} }
goto st8;
st8:
if ( ++p == pe )
goto _test_eof8;
case 8:
-#line 1445 "parser.c"
+#line 1457 "parser.c"
goto st0;
st3:
if ( ++p == pe )
@@ -1522,7 +1529,7 @@ case 7:
_out: {}
}
-#line 505 "parser.rl"
+#line 517 "parser.rl"
if (json->create_additions && RTEST(match_string = json->match_string)) {
VALUE klass;
@@ -1611,7 +1618,7 @@ static VALUE convert_encoding(VALUE source)
* _opts_ can have the following keys:
* * *max_nesting*: The maximum depth of nesting allowed in the parsed data
* structures. Disable depth checking with :max_nesting => false|nil|0, it
- * defaults to 19.
+ * defaults to 100.
* * *allow_nan*: If set to true, allow NaN, Infinity and -Infinity in
* defiance of RFC 4627 to be parsed by the Parser. This option defaults to
* false.
@@ -1623,9 +1630,6 @@ static VALUE convert_encoding(VALUE source)
* defaults to true.
* * *object_class*: Defaults to Hash
* * *array_class*: Defaults to Array
- * * *quirks_mode*: Enables quirks_mode for parser, that is for example
- * parsing single JSON values instead of documents is possible.
- *
*/
static VALUE cParser_initialize(int argc, VALUE *argv, VALUE self)
{
@@ -1651,7 +1655,7 @@ static VALUE cParser_initialize(int argc, VALUE *argv, VALUE self)
json->max_nesting = 0;
}
} else {
- json->max_nesting = 19;
+ json->max_nesting = 100;
}
tmp = ID2SYM(i_allow_nan);
if (option_given_p(opts, tmp)) {
@@ -1705,17 +1709,19 @@ static VALUE cParser_initialize(int argc, VALUE *argv, VALUE self)
}
}
} else {
- json->max_nesting = 19;
+ json->max_nesting = 100;
json->allow_nan = 0;
json->create_additions = 1;
json->create_id = rb_funcall(mJSON, i_create_id, 0);
json->object_class = Qnil;
json->array_class = Qnil;
}
+ source = rb_convert_type(source, T_STRING, "String", "to_str");
if (!json->quirks_mode) {
source = convert_encoding(StringValue(source));
}
json->current_nesting = 0;
+ StringValue(source);
json->len = RSTRING_LEN(source);
json->source = RSTRING_PTR(source);;
json->Vsource = source;
@@ -1723,7 +1729,7 @@ static VALUE cParser_initialize(int argc, VALUE *argv, VALUE self)
}
-#line 1722 "parser.c"
+#line 1733 "parser.c"
static const int JSON_start = 1;
static const int JSON_first_final = 10;
static const int JSON_error = 0;
@@ -1731,7 +1737,7 @@ static const int JSON_error = 0;
static const int JSON_en_main = 1;
-#line 729 "parser.rl"
+#line 740 "parser.rl"
static VALUE cParser_parse_strict(VALUE self)
@@ -1742,16 +1748,16 @@ static VALUE cParser_parse_strict(VALUE self)
GET_PARSER;
-#line 1741 "parser.c"
+#line 1752 "parser.c"
{
cs = JSON_start;
}
-#line 739 "parser.rl"
+#line 750 "parser.rl"
p = json->source;
pe = p + json->len;
-#line 1750 "parser.c"
+#line 1761 "parser.c"
{
if ( p == pe )
goto _test_eof;
@@ -1807,7 +1813,7 @@ case 5:
goto st1;
goto st5;
tr3:
-#line 718 "parser.rl"
+#line 729 "parser.rl"
{
char *np;
json->current_nesting = 1;
@@ -1816,7 +1822,7 @@ tr3:
}
goto st10;
tr4:
-#line 711 "parser.rl"
+#line 722 "parser.rl"
{
char *np;
json->current_nesting = 1;
@@ -1828,7 +1834,7 @@ st10:
if ( ++p == pe )
goto _test_eof10;
case 10:
-#line 1827 "parser.c"
+#line 1838 "parser.c"
switch( (*p) ) {
case 13: goto st10;
case 32: goto st10;
@@ -1885,7 +1891,7 @@ case 9:
_out: {}
}
-#line 742 "parser.rl"
+#line 753 "parser.rl"
if (cs >= JSON_first_final && p == pe) {
return result;
@@ -1897,7 +1903,7 @@ case 9:
-#line 1896 "parser.c"
+#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;
@@ -1905,7 +1911,7 @@ static const int JSON_quirks_mode_error = 0;
static const int JSON_quirks_mode_en_main = 1;
-#line 767 "parser.rl"
+#line 778 "parser.rl"
static VALUE cParser_parse_quirks_mode(VALUE self)
@@ -1916,16 +1922,16 @@ static VALUE cParser_parse_quirks_mode(VALUE self)
GET_PARSER;
-#line 1915 "parser.c"
+#line 1926 "parser.c"
{
cs = JSON_quirks_mode_start;
}
-#line 777 "parser.rl"
+#line 788 "parser.rl"
p = json->source;
pe = p + json->len;
-#line 1924 "parser.c"
+#line 1935 "parser.c"
{
if ( p == pe )
goto _test_eof;
@@ -1959,7 +1965,7 @@ st0:
cs = 0;
goto _out;
tr2:
-#line 759 "parser.rl"
+#line 770 "parser.rl"
{
char *np = JSON_parse_value(json, p, pe, &result);
if (np == NULL) { p--; {p++; cs = 10; goto _out;} } else {p = (( np))-1;}
@@ -1969,7 +1975,7 @@ st10:
if ( ++p == pe )
goto _test_eof10;
case 10:
-#line 1968 "parser.c"
+#line 1979 "parser.c"
switch( (*p) ) {
case 13: goto st10;
case 32: goto st10;
@@ -2058,7 +2064,7 @@ case 9:
_out: {}
}
-#line 780 "parser.rl"
+#line 791 "parser.rl"
if (cs >= JSON_quirks_mode_first_final && p == pe) {
return result;
@@ -2090,6 +2096,7 @@ static JSON_Parser *JSON_allocate()
{
JSON_Parser *json = ALLOC(JSON_Parser);
MEMZERO(json, JSON_Parser, 1);
+ json->fbuffer = fbuffer_alloc(0);
return json;
}
@@ -2104,6 +2111,7 @@ static void JSON_mark(JSON_Parser *json)
static void JSON_free(JSON_Parser *json)
{
+ fbuffer_free(json->fbuffer);
ruby_xfree(json);
}
diff --git a/ext/json/parser/parser.h b/ext/json/parser/parser.h
index fc73810dd6..b192064c09 100644
--- a/ext/json/parser/parser.h
+++ b/ext/json/parser/parser.h
@@ -3,16 +3,10 @@
#include "ruby.h"
-#if HAVE_RE_H
+#ifndef HAVE_RUBY_RE_H
#include "re.h"
#endif
-#ifdef HAVE_RUBY_ENCODING_H
-#include "ruby/encoding.h"
-#define FORCE_UTF8(obj) ((obj) = rb_enc_associate(rb_str_dup(obj), rb_utf8_encoding()))
-#else
-#define FORCE_UTF8(obj)
-#endif
#ifdef HAVE_RUBY_ST_H
#include "ruby/st.h"
#else
@@ -49,6 +43,7 @@ typedef struct JSON_ParserStruct {
VALUE array_class;
int create_additions;
VALUE match_string;
+ FBuffer *fbuffer;
} JSON_Parser;
#define GET_PARSER \
diff --git a/ext/json/parser/parser.rl b/ext/json/parser/parser.rl
index fe6427a649..ab8d318173 100644
--- a/ext/json/parser/parser.rl
+++ b/ext/json/parser/parser.rl
@@ -1,3 +1,4 @@
+#include "../fbuffer/fbuffer.h"
#include "parser.h"
/* unicode */
@@ -166,12 +167,12 @@ static char *JSON_parse_object(JSON_Parser *json, char *p, char *pe, VALUE *resu
if (cs >= JSON_object_first_final) {
if (json->create_additions) {
- VALUE klassname;
+ VALUE klassname;
if (NIL_P(json->object_class)) {
- klassname = rb_hash_aref(*result, json->create_id);
- } else {
- klassname = rb_funcall(*result, i_aref, 1, json->create_id);
- }
+ klassname = rb_hash_aref(*result, json->create_id);
+ } else {
+ klassname = rb_funcall(*result, i_aref, 1, json->create_id);
+ }
if (!NIL_P(klassname)) {
VALUE klass = rb_funcall(mJSON, i_deep_const_get, 1, klassname);
if (RTEST(rb_funcall(klass, i_json_creatable_p, 0))) {
@@ -303,7 +304,10 @@ static char *JSON_parse_integer(JSON_Parser *json, char *p, char *pe, VALUE *res
if (cs >= JSON_integer_first_final) {
long len = p - json->memo;
- *result = rb_Integer(rb_str_new(json->memo, len));
+ fbuffer_clear(json->fbuffer);
+ fbuffer_append(json->fbuffer, json->memo, len);
+ fbuffer_append_char(json->fbuffer, '\0');
+ *result = rb_cstr2inum(FBUFFER_PTR(json->fbuffer), 10);
return p + 1;
} else {
return NULL;
@@ -334,7 +338,10 @@ static char *JSON_parse_float(JSON_Parser *json, char *p, char *pe, VALUE *resul
if (cs >= JSON_float_first_final) {
long len = p - json->memo;
- *result = rb_Float(rb_str_new(json->memo, len));
+ fbuffer_clear(json->fbuffer);
+ fbuffer_append(json->fbuffer, json->memo, len);
+ fbuffer_append_char(json->fbuffer, '\0');
+ *result = rb_float_new(rb_cstr_to_dbl(FBUFFER_PTR(json->fbuffer), 1));
return p + 1;
} else {
return NULL;
@@ -595,7 +602,7 @@ static VALUE convert_encoding(VALUE source)
* _opts_ can have the following keys:
* * *max_nesting*: The maximum depth of nesting allowed in the parsed data
* structures. Disable depth checking with :max_nesting => false|nil|0, it
- * defaults to 19.
+ * defaults to 100.
* * *allow_nan*: If set to true, allow NaN, Infinity and -Infinity in
* defiance of RFC 4627 to be parsed by the Parser. This option defaults to
* false.
@@ -607,9 +614,6 @@ static VALUE convert_encoding(VALUE source)
* defaults to true.
* * *object_class*: Defaults to Hash
* * *array_class*: Defaults to Array
- * * *quirks_mode*: Enables quirks_mode for parser, that is for example
- * parsing single JSON values instead of documents is possible.
- *
*/
static VALUE cParser_initialize(int argc, VALUE *argv, VALUE self)
{
@@ -635,7 +639,7 @@ static VALUE cParser_initialize(int argc, VALUE *argv, VALUE self)
json->max_nesting = 0;
}
} else {
- json->max_nesting = 19;
+ json->max_nesting = 100;
}
tmp = ID2SYM(i_allow_nan);
if (option_given_p(opts, tmp)) {
@@ -689,17 +693,19 @@ static VALUE cParser_initialize(int argc, VALUE *argv, VALUE self)
}
}
} else {
- json->max_nesting = 19;
+ json->max_nesting = 100;
json->allow_nan = 0;
json->create_additions = 1;
json->create_id = rb_funcall(mJSON, i_create_id, 0);
json->object_class = Qnil;
json->array_class = Qnil;
}
+ source = rb_convert_type(source, T_STRING, "String", "to_str");
if (!json->quirks_mode) {
source = convert_encoding(StringValue(source));
}
json->current_nesting = 0;
+ StringValue(source);
json->len = RSTRING_LEN(source);
json->source = RSTRING_PTR(source);;
json->Vsource = source;
@@ -813,6 +819,7 @@ static JSON_Parser *JSON_allocate()
{
JSON_Parser *json = ALLOC(JSON_Parser);
MEMZERO(json, JSON_Parser, 1);
+ json->fbuffer = fbuffer_alloc(0);
return json;
}
@@ -827,6 +834,7 @@ static void JSON_mark(JSON_Parser *json)
static void JSON_free(JSON_Parser *json)
{
+ fbuffer_free(json->fbuffer);
ruby_xfree(json);
}
diff --git a/ext/nkf/depend b/ext/nkf/depend
index 0ed8fea8d2..f368cd51d7 100644
--- a/ext/nkf/depend
+++ b/ext/nkf/depend
@@ -1 +1,6 @@
-nkf.o : nkf.c $(hdrdir)/ruby.h $(topdir)/config.h $(hdrdir)/defines.h $(srcdir)/nkf-utf8/nkf.c $(srcdir)/nkf-utf8/utf8tbl.c $(srcdir)/nkf-utf8/config.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 0382f30938..ca3e438220 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
@@ -20,11 +20,11 @@
*
* 3. This notice may not be removed or altered from any source distribution.
*/
-#define NKF_VERSION "2.1.2"
-#define NKF_RELEASE_DATE "2011-09-08"
+#define NKF_VERSION "2.1.3"
+#define NKF_RELEASE_DATE "2013-11-22"
#define COPY_RIGHT \
"Copyright (C) 1987, FUJITSU LTD. (I.Ichikawa).\n" \
- "Copyright (C) 1996-2011, The nkf Project."
+ "Copyright (C) 1996-2013, The nkf Project."
#include "config.h"
#include "nkf.h"
@@ -356,6 +356,7 @@ static int no_cp932ext_f = FALSE;
/* ignore ZERO WIDTH NO-BREAK SPACE */
static int no_best_fit_chars_f = FALSE;
static int input_endian = ENDIAN_BIG;
+static int input_bom_f = FALSE;
static nkf_char unicode_subchar = '?'; /* the regular substitution character */
static void (*encode_fallback)(nkf_char c) = NULL;
static void w_status(struct input_code *, nkf_char);
@@ -430,6 +431,8 @@ static nkf_char (*i_uungetc)(nkf_char c ,FILE *f) = std_ungetc;
#define nkf_char_unicode_bmp_p(c) ((c & VALUE_MASK) <= UNICODE_BMP_MAX)
#define nkf_char_unicode_value_p(c) ((c & VALUE_MASK) <= UNICODE_MAX)
+#define UTF16_TO_UTF32(lead, trail) (((lead) << 10) + (trail) - NKF_INT32_C(0x35FDC00))
+
#ifdef NUMCHAR_OPTION
static int numchar_f = FALSE;
static nkf_char (*i_ngetc)(FILE *) = std_getc; /* input of ugetc */
@@ -506,7 +509,7 @@ static int fold_margin = FOLD_MARGIN;
/* process default */
static nkf_char
-no_connection2(nkf_char c2, nkf_char c1, nkf_char c0)
+no_connection2(ARG_UNUSED nkf_char c2, ARG_UNUSED nkf_char c1, ARG_UNUSED nkf_char c0)
{
fprintf(stderr,"nkf internal module connection failure.\n");
exit(EXIT_FAILURE);
@@ -620,6 +623,27 @@ static const unsigned char ev[]= {
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00};
+/* X0201 kana to X0213 conversion table for han-daguten */
+/* 90-9F A0-DF */
+static const unsigned char ev_x0213[]= {
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x25,0x77,0x25,0x78,
+ 0x25,0x79,0x25,0x7a,0x25,0x7b,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x25,0x7c,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x25,0x7d,0x00,0x00,
+ 0x25,0x7e,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00};
+
/* X0208 kigou conversion table */
/* 0x8140 - 0x819e */
@@ -1287,6 +1311,7 @@ set_input_encoding(nkf_encoding *enc)
x0213_f = TRUE;
#ifdef SHIFTJIS_CP932
cp51932_f = FALSE;
+ if (cp932inv_f == TRUE) cp932inv_f = FALSE;
#endif
break;
case EUC_JISX0213:
@@ -1357,6 +1382,7 @@ set_output_encoding(nkf_encoding *enc)
#endif
break;
case ISO_2022_JP_3:
+ case ISO_2022_JP_2004:
x0212_f = TRUE;
x0213_f = TRUE;
#ifdef SHIFTJIS_CP932
@@ -1540,13 +1566,26 @@ x0212_unshift(nkf_char c)
}
#endif /* X0212_ENABLE */
+static int
+is_x0213_2_in_x0212(nkf_char c1)
+{
+ static const char x0213_2_table[] =
+ {0, 1, 0, 1, 1, 1, 0, 0, 1, 0, 0, 0, 1, 1, 1, 1};
+ int ku = c1 - 0x20;
+ if (ku <= 15)
+ return x0213_2_table[ku]; /* 1, 3-5, 8, 12-15 */
+ if (78 <= ku && ku <= 94)
+ return 1;
+ return 0;
+}
+
static nkf_char
e2s_conv(nkf_char c2, nkf_char c1, nkf_char *p2, nkf_char *p1)
{
nkf_char ndx;
if (is_eucg3(c2)){
ndx = c2 & 0x7f;
- if (x0213_f){
+ if (x0213_f && is_x0213_2_in_x0212(ndx)){
if((0x21 <= ndx && ndx <= 0x2F)){
if (p2) *p2 = ((ndx - 1) >> 1) + 0xec - ndx / 8 * 3;
if (p1) *p1 = c1 + ((ndx & 1) ? ((c1 < 0x60) ? 0x1f : 0x20) : 0x7e);
@@ -1592,7 +1631,7 @@ s2e_conv(nkf_char c2, nkf_char c1, nkf_char *p2, nkf_char *p1)
static const char shift_jisx0213_s1a3_table[5][2] ={ { 1, 8}, { 3, 4}, { 5,12}, {13,14}, {15, 0} };
if (0xFC < c1) return 1;
#ifdef SHIFTJIS_CP932
- if (!cp932inv_f && is_ibmext_in_sjis(c2)){
+ if (!cp932inv_f && !x0213_f && is_ibmext_in_sjis(c2)){
val = shiftjis_cp932[c2 - CP932_TABLE_BEGIN][c1 - 0x40];
if (val){
c2 = val >> 8;
@@ -1695,7 +1734,7 @@ nkf_utf8_to_unicode(nkf_char c1, nkf_char c2, nkf_char c3, nkf_char c4)
/* single byte */
wc = c1;
}
- else if (c1 <= 0xC3) {
+ else if (c1 <= 0xC1) {
/* trail byte or invalid */
return -1;
}
@@ -1835,6 +1874,7 @@ unicode_to_jis_common(nkf_char c2, nkf_char c1, nkf_char c0, nkf_char *p2, nkf_c
ms_ucs_map_f == UCS_MAP_CP932 ? utf8_to_euc_2bytes_932 :
ms_ucs_map_f == UCS_MAP_MS ? utf8_to_euc_2bytes_ms :
ms_ucs_map_f == UCS_MAP_CP10001 ? utf8_to_euc_2bytes_mac :
+ x0213_f ? utf8_to_euc_2bytes_x0213 :
utf8_to_euc_2bytes;
ret = unicode_to_jis_common2(c2, c1, pp, sizeof_utf8_to_euc_2bytes, p2, p1);
}else if(c0 < 0xF0){
@@ -1902,6 +1942,7 @@ unicode_to_jis_common(nkf_char c2, nkf_char c1, nkf_char c0, nkf_char *p2, nkf_c
ms_ucs_map_f == UCS_MAP_CP932 ? utf8_to_euc_3bytes_932 :
ms_ucs_map_f == UCS_MAP_MS ? utf8_to_euc_3bytes_ms :
ms_ucs_map_f == UCS_MAP_CP10001 ? utf8_to_euc_3bytes_mac :
+ x0213_f ? utf8_to_euc_3bytes_x0213 :
utf8_to_euc_3bytes;
ret = unicode_to_jis_common2(c1, c0, ppp[c2 - 0xE0], sizeof_utf8_to_euc_C2, p2, p1);
}else return -1;
@@ -1919,6 +1960,15 @@ unicode_to_jis_common(nkf_char c2, nkf_char c1, nkf_char c0, nkf_char *p2, nkf_c
}
#ifdef UTF8_OUTPUT_ENABLE
+#define X0213_SURROGATE_FIND(tbl, size, euc) do { \
+ int i; \
+ for (i = 0; i < size; i++) \
+ if (tbl[i][0] == euc) { \
+ low = tbl[i][2]; \
+ break; \
+ } \
+ } while (0)
+
static nkf_char
e2w_conv(nkf_char c2, nkf_char c1)
{
@@ -1941,7 +1991,9 @@ e2w_conv(nkf_char c2, nkf_char c1)
}
c2 = (c2&0x7f) - 0x21;
if (0<=c2 && c2<sizeof_euc_to_utf8_2bytes)
- p = x0212_to_utf8_2bytes[c2];
+ p =
+ x0213_f ? x0212_to_utf8_2bytes_x0213[c2] :
+ x0212_to_utf8_2bytes[c2];
else
return 0;
#endif
@@ -1950,6 +2002,7 @@ e2w_conv(nkf_char c2, nkf_char c1)
c2 = (c2&0x7f) - 0x21;
if (0<=c2 && c2<sizeof_euc_to_utf8_2bytes)
p =
+ x0213_f ? euc_to_utf8_2bytes_x0213[c2] :
ms_ucs_map_f == UCS_MAP_ASCII ? euc_to_utf8_2bytes[c2] :
ms_ucs_map_f == UCS_MAP_CP10001 ? euc_to_utf8_2bytes_mac[c2] :
euc_to_utf8_2bytes_ms[c2];
@@ -1958,8 +2011,39 @@ e2w_conv(nkf_char c2, nkf_char c1)
}
if (!p) return 0;
c1 = (c1 & 0x7f) - 0x21;
- if (0<=c1 && c1<sizeof_euc_to_utf8_1byte)
- return p[c1];
+ if (0<=c1 && c1<sizeof_euc_to_utf8_1byte) {
+ nkf_char val = p[c1];
+ if (x0213_f && 0xD800<=val && val<=0xDBFF) {
+ nkf_char euc = (c2+0x21)<<8 | (c1+0x21);
+ nkf_char low = 0;
+ if (p==x0212_to_utf8_2bytes_x0213[c2]) {
+ X0213_SURROGATE_FIND(x0213_2_surrogate_table, sizeof_x0213_2_surrogate_table, euc);
+ } else {
+ X0213_SURROGATE_FIND(x0213_1_surrogate_table, sizeof_x0213_1_surrogate_table, euc);
+ }
+ if (!low) return 0;
+ return UTF16_TO_UTF32(val, low);
+ } else {
+ return val;
+ }
+ }
+ return 0;
+}
+
+static nkf_char
+e2w_combining(nkf_char comb, nkf_char c2, nkf_char c1)
+{
+ nkf_char euc;
+ int i;
+ for (i = 0; i < sizeof_x0213_combining_chars; i++)
+ if (x0213_combining_chars[i] == comb)
+ break;
+ if (i >= sizeof_x0213_combining_chars)
+ return 0;
+ euc = (c2&0x7f)<<8 | (c1&0x7f);
+ for (i = 0; i < sizeof_x0213_combining_table; i++)
+ if (x0213_combining_table[i][0] == euc)
+ return x0213_combining_table[i][1];
return 0;
}
#endif
@@ -2006,6 +2090,25 @@ w16e_conv(nkf_char val, nkf_char *p2, nkf_char *p1)
}
}
else {
+ int i;
+ if (x0213_f) {
+ c1 = (val >> 10) + NKF_INT32_C(0xD7C0); /* high surrogate */
+ c2 = (val & 0x3FF) + NKF_INT32_C(0xDC00); /* low surrogate */
+ for (i = 0; i < sizeof_x0213_1_surrogate_table; i++)
+ if (x0213_1_surrogate_table[i][1] == c1 && x0213_1_surrogate_table[i][2] == c2) {
+ val = x0213_1_surrogate_table[i][0];
+ *p2 = val >> 8;
+ *p1 = val & 0xFF;
+ return 0;
+ }
+ for (i = 0; i < sizeof_x0213_2_surrogate_table; i++)
+ if (x0213_2_surrogate_table[i][1] == c1 && x0213_2_surrogate_table[i][2] == c2) {
+ val = x0213_2_surrogate_table[i][0];
+ *p2 = PREFIX_EUCG3 | (val >> 8);
+ *p1 = val & 0xFF;
+ return 0;
+ }
+ }
*p2 = 0;
*p1 = nkf_char_unicode_new(val);
}
@@ -2078,7 +2181,7 @@ e_iconv(nkf_char c2, nkf_char c1, nkf_char c0)
}
static nkf_char
-s_iconv(nkf_char c2, nkf_char c1, nkf_char c0)
+s_iconv(ARG_UNUSED nkf_char c2, nkf_char c1, ARG_UNUSED nkf_char c0)
{
if (c2 == JIS_X_0201_1976_K || (0xA1 <= c2 && c2 <= 0xDF)) {
if (iso2022jp_f && !x0201_f) {
@@ -2101,6 +2204,30 @@ s_iconv(nkf_char c2, nkf_char c1, nkf_char c0)
return 0;
}
+static int
+x0213_wait_combining_p(nkf_char wc)
+{
+ int i;
+ for (i = 0; i < sizeof_x0213_combining_table; i++) {
+ if (x0213_combining_table[i][1] == wc) {
+ return TRUE;
+ }
+ }
+ return FALSE;
+}
+
+static int
+x0213_combining_p(nkf_char wc)
+{
+ int i;
+ for (i = 0; i < sizeof_x0213_combining_chars; i++) {
+ if (x0213_combining_chars[i] == wc) {
+ return TRUE;
+ }
+ }
+ return FALSE;
+}
+
static nkf_char
w_iconv(nkf_char c1, nkf_char c2, nkf_char c3)
{
@@ -2168,6 +2295,8 @@ w_iconv(nkf_char c1, nkf_char c2, nkf_char c3)
c2 = nkf_char_unicode_new(nkf_utf8_to_unicode(c1, c2, c3, c4));
c1 = 0;
} else {
+ if (x0213_f && x0213_wait_combining_p(nkf_utf8_to_unicode(c1, c2, c3, c4)))
+ return -3;
ret = w2e_conv(c1, c2, c3, &c1, &c2);
}
if (ret == 0){
@@ -2176,9 +2305,22 @@ w_iconv(nkf_char c1, nkf_char c2, nkf_char c3)
return ret;
}
+static nkf_char
+w_iconv_nocombine(nkf_char c1, nkf_char c2, nkf_char c3)
+{
+ /* continue from the line below 'return -3;' in w_iconv() */
+ nkf_char ret = w2e_conv(c1, c2, c3, &c1, &c2);
+ if (ret == 0){
+ (*oconv)(c1, c2);
+ }
+ return ret;
+}
+
#define NKF_ICONV_INVALID_CODE_RANGE -13
+#define NKF_ICONV_WAIT_COMBINING_CHAR -14
+#define NKF_ICONV_NOT_COMBINED -15
static size_t
-unicode_iconv(nkf_char wc)
+unicode_iconv(nkf_char wc, int nocombine)
{
nkf_char c1, c2;
int ret = 0;
@@ -2190,6 +2332,8 @@ unicode_iconv(nkf_char wc)
/* unpaired surrogate */
return NKF_ICONV_INVALID_CODE_RANGE;
}else if (wc < 0xFFFF) {
+ if (!nocombine && x0213_f && x0213_wait_combining_p(wc))
+ return NKF_ICONV_WAIT_COMBINING_CHAR;
ret = w16e_conv(wc, &c2, &c1);
if (ret) return ret;
}else if (wc < 0x10FFFF) {
@@ -2202,9 +2346,50 @@ unicode_iconv(nkf_char wc)
return 0;
}
+static nkf_char
+unicode_iconv_combine(nkf_char wc, nkf_char wc2)
+{
+ nkf_char c1, c2;
+ int i;
+
+ if (wc2 < 0x80) {
+ return NKF_ICONV_NOT_COMBINED;
+ }else if ((wc2>>11) == 27) {
+ /* unpaired surrogate */
+ return NKF_ICONV_INVALID_CODE_RANGE;
+ }else if (wc2 < 0xFFFF) {
+ if (!x0213_combining_p(wc2))
+ return NKF_ICONV_NOT_COMBINED;
+ for (i = 0; i < sizeof_x0213_combining_table; i++) {
+ if (x0213_combining_table[i][1] == wc &&
+ x0213_combining_table[i][2] == wc2) {
+ c2 = x0213_combining_table[i][0] >> 8;
+ c1 = x0213_combining_table[i][0] & 0x7f;
+ (*oconv)(c2, c1);
+ return 0;
+ }
+ }
+ }else if (wc2 < 0x10FFFF) {
+ return NKF_ICONV_NOT_COMBINED;
+ } else {
+ return NKF_ICONV_INVALID_CODE_RANGE;
+ }
+ return NKF_ICONV_NOT_COMBINED;
+}
+
+static nkf_char
+w_iconv_combine(nkf_char c1, nkf_char c2, nkf_char c3, nkf_char c4, nkf_char c5, nkf_char c6)
+{
+ nkf_char wc, wc2;
+ wc = nkf_utf8_to_unicode(c1, c2, c3, 0);
+ wc2 = nkf_utf8_to_unicode(c4, c5, c6, 0);
+ if (wc2 < 0)
+ return wc2;
+ return unicode_iconv_combine(wc, wc2);
+}
+
#define NKF_ICONV_NEED_ONE_MORE_BYTE (size_t)-1
#define NKF_ICONV_NEED_TWO_MORE_BYTES (size_t)-2
-#define UTF16_TO_UTF32(lead, trail) (((lead) << 10) + (trail) - NKF_INT32_C(0x35FDC00))
static size_t
nkf_iconv_utf_16(nkf_char c1, nkf_char c2, nkf_char c3, nkf_char c4)
{
@@ -2233,33 +2418,63 @@ nkf_iconv_utf_16(nkf_char c1, nkf_char c2, nkf_char c3, nkf_char c4)
}
}
- return (*unicode_iconv)(wc);
+ return (*unicode_iconv)(wc, FALSE);
+}
+
+static size_t
+nkf_iconv_utf_16_combine(nkf_char c1, nkf_char c2, nkf_char c3, nkf_char c4)
+{
+ nkf_char wc, wc2;
+
+ if (input_endian == ENDIAN_BIG) {
+ if (0xD8 <= c3 && c3 <= 0xDB) {
+ return NKF_ICONV_NOT_COMBINED;
+ } else {
+ wc = c1 << 8 | c2;
+ wc2 = c3 << 8 | c4;
+ }
+ } else {
+ if (0xD8 <= c2 && c2 <= 0xDB) {
+ return NKF_ICONV_NOT_COMBINED;
+ } else {
+ wc = c2 << 8 | c1;
+ wc2 = c4 << 8 | c3;
+ }
+ }
+
+ return unicode_iconv_combine(wc, wc2);
+}
+
+static size_t
+nkf_iconv_utf_16_nocombine(nkf_char c1, nkf_char c2)
+{
+ nkf_char wc;
+ if (input_endian == ENDIAN_BIG)
+ wc = c1 << 8 | c2;
+ else
+ wc = c2 << 8 | c1;
+ return (*unicode_iconv)(wc, TRUE);
}
static nkf_char
-w_iconv16(nkf_char c2, nkf_char c1, nkf_char c0)
+w_iconv16(nkf_char c2, nkf_char c1, ARG_UNUSED nkf_char c0)
{
(*oconv)(c2, c1);
return 16; /* different from w_iconv32 */
}
static nkf_char
-w_iconv32(nkf_char c2, nkf_char c1, nkf_char c0)
+w_iconv32(nkf_char c2, nkf_char c1, ARG_UNUSED nkf_char c0)
{
(*oconv)(c2, c1);
return 32; /* different from w_iconv16 */
}
-static size_t
-nkf_iconv_utf_32(nkf_char c1, nkf_char c2, nkf_char c3, nkf_char c4)
+static nkf_char
+utf32_to_nkf_char(nkf_char c1, nkf_char c2, nkf_char c3, nkf_char c4)
{
nkf_char wc;
- if (c1 == EOF) {
- (*oconv)(EOF, 0);
- return 0;
- }
-
switch(input_endian){
case ENDIAN_BIG:
wc = c2 << 16 | c3 << 8 | c4;
@@ -2276,8 +2491,48 @@ nkf_iconv_utf_32(nkf_char c1, nkf_char c2, nkf_char c3, nkf_char c4)
default:
return NKF_ICONV_INVALID_CODE_RANGE;
}
+ return wc;
+}
+
+static size_t
+nkf_iconv_utf_32(nkf_char c1, nkf_char c2, nkf_char c3, nkf_char c4)
+{
+ nkf_char wc;
+
+ if (c1 == EOF) {
+ (*oconv)(EOF, 0);
+ return 0;
+ }
+
+ wc = utf32_to_nkf_char(c1, c2, c3, c4);
+ if (wc < 0)
+ return wc;
- return (*unicode_iconv)(wc);
+ return (*unicode_iconv)(wc, FALSE);
+}
+
+static nkf_char
+nkf_iconv_utf_32_combine(nkf_char c1, nkf_char c2, nkf_char c3, nkf_char c4, nkf_char c5, nkf_char c6, nkf_char c7, nkf_char c8)
+{
+ nkf_char wc, wc2;
+
+ wc = utf32_to_nkf_char(c1, c2, c3, c4);
+ if (wc < 0)
+ return wc;
+ wc2 = utf32_to_nkf_char(c5, c6, c7, c8);
+ if (wc2 < 0)
+ return wc2;
+
+ return unicode_iconv_combine(wc, wc2);
+}
+
+static size_t
+nkf_iconv_utf_32_nocombine(nkf_char c1, nkf_char c2, nkf_char c3, nkf_char c4)
+{
+ nkf_char wc;
+
+ wc = utf32_to_nkf_char(c1, c2, c3, c4);
+ return (*unicode_iconv)(wc, TRUE);
}
#endif
@@ -2532,11 +2787,19 @@ s_oconv(nkf_char c2, nkf_char c1)
}
#ifdef UTF8_OUTPUT_ENABLE
+#define OUTPUT_UTF8(val) do { \
+ nkf_unicode_to_utf8(val, &c1, &c2, &c3, &c4); \
+ (*o_putc)(c1); \
+ if (c2) (*o_putc)(c2); \
+ if (c3) (*o_putc)(c3); \
+ if (c4) (*o_putc)(c4); \
+ } while (0)
+
static void
w_oconv(nkf_char c2, nkf_char c1)
{
nkf_char c3, c4;
- nkf_char val;
+ nkf_char val, val2;
if (output_bom_f) {
output_bom_f = FALSE;
@@ -2552,11 +2815,7 @@ w_oconv(nkf_char c2, nkf_char c1)
if (c2 == 0 && nkf_char_unicode_p(c1)){
val = c1 & VALUE_MASK;
- nkf_unicode_to_utf8(val, &c1, &c2, &c3, &c4);
- (*o_putc)(c1);
- if (c2) (*o_putc)(c2);
- if (c3) (*o_putc)(c3);
- if (c4) (*o_putc)(c4);
+ OUTPUT_UTF8(val);
return;
}
@@ -2565,27 +2824,46 @@ w_oconv(nkf_char c2, nkf_char c1)
} else {
val = e2w_conv(c2, c1);
if (val){
- nkf_unicode_to_utf8(val, &c1, &c2, &c3, &c4);
- (*o_putc)(c1);
- if (c2) (*o_putc)(c2);
- if (c3) (*o_putc)(c3);
- if (c4) (*o_putc)(c4);
+ val2 = e2w_combining(val, c2, c1);
+ if (val2)
+ OUTPUT_UTF8(val2);
+ OUTPUT_UTF8(val);
}
}
}
+#define OUTPUT_UTF16_BYTES(c1, c2) do { \
+ if (output_endian == ENDIAN_LITTLE){ \
+ (*o_putc)(c1); \
+ (*o_putc)(c2); \
+ }else{ \
+ (*o_putc)(c2); \
+ (*o_putc)(c1); \
+ } \
+ } while (0)
+
+#define OUTPUT_UTF16(val) do { \
+ if (nkf_char_unicode_bmp_p(val)) { \
+ c2 = (val >> 8) & 0xff; \
+ c1 = val & 0xff; \
+ OUTPUT_UTF16_BYTES(c1, c2); \
+ } else { \
+ val &= VALUE_MASK; \
+ if (val <= UNICODE_MAX) { \
+ c2 = (val >> 10) + NKF_INT32_C(0xD7C0); /* high surrogate */ \
+ c1 = (val & 0x3FF) + NKF_INT32_C(0xDC00); /* low surrogate */ \
+ OUTPUT_UTF16_BYTES(c2 & 0xff, (c2 >> 8) & 0xff); \
+ OUTPUT_UTF16_BYTES(c1 & 0xff, (c1 >> 8) & 0xff); \
+ } \
+ } \
+ } while (0)
+
static void
w_oconv16(nkf_char c2, nkf_char c1)
{
if (output_bom_f) {
output_bom_f = FALSE;
- if (output_endian == ENDIAN_LITTLE){
- (*o_putc)(0xFF);
- (*o_putc)(0xFE);
- }else{
- (*o_putc)(0xFE);
- (*o_putc)(0xFF);
- }
+ OUTPUT_UTF16_BYTES(0xFF, 0xFE);
}
if (c2 == EOF) {
@@ -2594,43 +2872,33 @@ w_oconv16(nkf_char c2, nkf_char c1)
}
if (c2 == 0 && nkf_char_unicode_p(c1)) {
- if (nkf_char_unicode_bmp_p(c1)) {
- c2 = (c1 >> 8) & 0xff;
- c1 &= 0xff;
- } else {
- c1 &= VALUE_MASK;
- if (c1 <= UNICODE_MAX) {
- c2 = (c1 >> 10) + NKF_INT32_C(0xD7C0); /* high surrogate */
- c1 = (c1 & 0x3FF) + NKF_INT32_C(0xDC00); /* low surrogate */
- if (output_endian == ENDIAN_LITTLE){
- (*o_putc)(c2 & 0xff);
- (*o_putc)((c2 >> 8) & 0xff);
- (*o_putc)(c1 & 0xff);
- (*o_putc)((c1 >> 8) & 0xff);
- }else{
- (*o_putc)((c2 >> 8) & 0xff);
- (*o_putc)(c2 & 0xff);
- (*o_putc)((c1 >> 8) & 0xff);
- (*o_putc)(c1 & 0xff);
- }
- }
- return;
- }
+ OUTPUT_UTF16(c1);
} else if (c2) {
- nkf_char val = e2w_conv(c2, c1);
- c2 = (val >> 8) & 0xff;
- c1 = val & 0xff;
+ nkf_char val, val2;
+ val = e2w_conv(c2, c1);
if (!val) return;
- }
-
- if (output_endian == ENDIAN_LITTLE){
- (*o_putc)(c1);
- (*o_putc)(c2);
- }else{
- (*o_putc)(c2);
- (*o_putc)(c1);
- }
-}
+ val2 = e2w_combining(val, c2, c1);
+ if (val2)
+ OUTPUT_UTF16(val2);
+ OUTPUT_UTF16(val);
+ } else {
+ OUTPUT_UTF16_BYTES(c1, c2);
+ }
+}
+
+#define OUTPUT_UTF32(c) do { \
+ if (output_endian == ENDIAN_LITTLE){ \
+ (*o_putc)( (c) & 0xFF); \
+ (*o_putc)(((c) >> 8) & 0xFF); \
+ (*o_putc)(((c) >> 16) & 0xFF); \
+ (*o_putc)(0); \
+ }else{ \
+ (*o_putc)(0); \
+ (*o_putc)(((c) >> 16) & 0xFF); \
+ (*o_putc)(((c) >> 8) & 0xFF); \
+ (*o_putc)( (c) & 0xFF); \
+ } \
+ } while (0)
static void
w_oconv32(nkf_char c2, nkf_char c1)
@@ -2660,20 +2928,15 @@ w_oconv32(nkf_char c2, nkf_char c1)
} else if (c2 == 0 && nkf_char_unicode_p(c1)) {
c1 &= VALUE_MASK;
} else if (c2) {
- c1 = e2w_conv(c2, c1);
- if (!c1) return;
- }
- if (output_endian == ENDIAN_LITTLE){
- (*o_putc)( c1 & 0xFF);
- (*o_putc)((c1 >> 8) & 0xFF);
- (*o_putc)((c1 >> 16) & 0xFF);
- (*o_putc)(0);
- }else{
- (*o_putc)(0);
- (*o_putc)((c1 >> 16) & 0xFF);
- (*o_putc)((c1 >> 8) & 0xFF);
- (*o_putc)( c1 & 0xFF);
+ nkf_char val, val2;
+ val = e2w_conv(c2, c1);
+ if (!val) return;
+ val2 = e2w_combining(val, c2, c1);
+ if (val2)
+ OUTPUT_UTF32(val2);
+ c1 = val;
}
+ OUTPUT_UTF32(c1);
}
#endif
@@ -2682,7 +2945,8 @@ w_oconv32(nkf_char c2, nkf_char c1)
#define SCORE_DEPEND (SCORE_KANA << 1) /* MD Characters */
#define SCORE_CP932 (SCORE_DEPEND << 1) /* IBM extended characters */
#define SCORE_X0212 (SCORE_CP932 << 1) /* JIS X 0212 */
-#define SCORE_NO_EXIST (SCORE_X0212 << 1) /* Undefined Characters */
+#define SCORE_X0213 (SCORE_X0212 << 1) /* JIS X 0213 */
+#define SCORE_NO_EXIST (SCORE_X0213 << 1) /* Undefined Characters */
#define SCORE_iMIME (SCORE_NO_EXIST << 1) /* MIME selected */
#define SCORE_ERROR (SCORE_iMIME << 1) /* Error */
@@ -2692,14 +2956,35 @@ static const nkf_char score_table_A0[] = {
0, 0, 0, 0,
0, 0, 0, 0,
0, SCORE_DEPEND, SCORE_DEPEND, SCORE_DEPEND,
- SCORE_DEPEND, SCORE_DEPEND, SCORE_DEPEND, SCORE_NO_EXIST,
+ SCORE_DEPEND, SCORE_DEPEND, SCORE_DEPEND, SCORE_X0213,
};
static const nkf_char score_table_F0[] = {
SCORE_L2, SCORE_L2, SCORE_L2, SCORE_L2,
- SCORE_L2, SCORE_DEPEND, SCORE_NO_EXIST, SCORE_NO_EXIST,
+ SCORE_L2, SCORE_DEPEND, SCORE_X0213, SCORE_X0213,
SCORE_DEPEND, SCORE_DEPEND, SCORE_CP932, SCORE_CP932,
- SCORE_CP932, SCORE_NO_EXIST, SCORE_NO_EXIST, SCORE_ERROR,
+ SCORE_CP932, SCORE_X0213, SCORE_X0213, SCORE_ERROR,
+};
+
+static const nkf_char score_table_8FA0[] = {
+ 0, SCORE_X0213, SCORE_X0212, SCORE_X0213,
+ SCORE_X0213, SCORE_X0213, SCORE_X0212, SCORE_X0212,
+ SCORE_X0213, SCORE_X0212, SCORE_X0212, SCORE_X0212,
+ SCORE_X0213, SCORE_X0213, SCORE_X0213, SCORE_X0213,
+};
+
+static const nkf_char score_table_8FE0[] = {
+ SCORE_X0212, SCORE_X0212, SCORE_X0212, SCORE_X0212,
+ SCORE_X0212, SCORE_X0212, SCORE_X0212, SCORE_X0212,
+ SCORE_X0212, SCORE_X0212, SCORE_X0212, SCORE_X0212,
+ SCORE_X0212, SCORE_X0212, SCORE_X0213, SCORE_X0213,
+};
+
+static const nkf_char score_table_8FF0[] = {
+ SCORE_X0213, SCORE_X0213, SCORE_X0213, SCORE_X0212,
+ SCORE_X0212, SCORE_X0213, SCORE_X0213, SCORE_X0213,
+ SCORE_X0213, SCORE_X0213, SCORE_X0213, SCORE_X0213,
+ SCORE_X0213, SCORE_X0213, SCORE_X0213, SCORE_X0213,
};
static void
@@ -2722,15 +3007,21 @@ static void
code_score(struct input_code *ptr)
{
nkf_char c2 = ptr->buf[0];
-#ifdef UTF8_OUTPUT_ENABLE
nkf_char c1 = ptr->buf[1];
-#endif
if (c2 < 0){
set_code_score(ptr, SCORE_ERROR);
}else if (c2 == SS2){
set_code_score(ptr, SCORE_KANA);
}else if (c2 == 0x8f){
- set_code_score(ptr, SCORE_X0212);
+ if ((c1 & 0x70) == 0x20){
+ set_code_score(ptr, score_table_8FA0[c1 & 0x0f]);
+ }else if ((c1 & 0x70) == 0x60){
+ set_code_score(ptr, score_table_8FE0[c1 & 0x0f]);
+ }else if ((c1 & 0x70) == 0x70){
+ set_code_score(ptr, score_table_8FF0[c1 & 0x0f]);
+ }else{
+ set_code_score(ptr, SCORE_X0212);
+ }
#ifdef UTF8_OUTPUT_ENABLE
}else if (!e2w_conv(c2, c1)){
set_code_score(ptr, SCORE_NO_EXIST);
@@ -3046,7 +3337,7 @@ std_getc(FILE *f)
#endif /*WIN32DLL*/
static nkf_char
-std_ungetc(nkf_char c, FILE *f)
+std_ungetc(nkf_char c, ARG_UNUSED FILE *f)
{
nkf_buf_push(nkf_state->std_gc_buf, c);
return c;
@@ -3077,6 +3368,7 @@ h_conv(FILE *f, nkf_char c1, nkf_char c2)
{
int ret;
int hold_index;
+ int fromhold_count;
nkf_char c3, c4;
/** it must NOT be in the kanji shifte sequence */
@@ -3138,8 +3430,10 @@ h_conv(FILE *f, nkf_char c1, nkf_char c2)
(*iconv)(JIS_X_0201_1976_K, c1, 0);
continue;
}
+ fromhold_count = 1;
if (hold_index < hold_count){
c2 = hold_buf[hold_index++];
+ fromhold_count++;
}else{
c2 = (*i_getc)(f);
if (c2 == EOF){
@@ -3168,17 +3462,105 @@ h_conv(FILE *f, nkf_char c1, nkf_char c2)
code_status(c4);
(*iconv)(c1, c2, (c3<<8)|c4);
break;
+ case -3:
+ /* 4 bytes UTF-8 (check combining character) */
+ if (hold_index < hold_count){
+ c3 = hold_buf[hold_index++];
+ fromhold_count++;
+ } else if ((c3 = (*i_getc)(f)) == EOF) {
+ w_iconv_nocombine(c1, c2, 0);
+ break;
+ }
+ if (hold_index < hold_count){
+ c4 = hold_buf[hold_index++];
+ fromhold_count++;
+ } else if ((c4 = (*i_getc)(f)) == EOF) {
+ w_iconv_nocombine(c1, c2, 0);
+ if (fromhold_count <= 2)
+ (*i_ungetc)(c3,f);
+ else
+ hold_index--;
+ continue;
+ }
+ if (w_iconv_combine(c1, c2, 0, c3, c4, 0)) {
+ w_iconv_nocombine(c1, c2, 0);
+ if (fromhold_count <= 2) {
+ (*i_ungetc)(c4,f);
+ (*i_ungetc)(c3,f);
+ } else if (fromhold_count == 3) {
+ (*i_ungetc)(c4,f);
+ hold_index--;
+ } else {
+ hold_index -= 2;
+ }
+ }
+ break;
case -1:
/* 3 bytes EUC or UTF-8 */
if (hold_index < hold_count){
c3 = hold_buf[hold_index++];
+ fromhold_count++;
} else if ((c3 = (*i_getc)(f)) == EOF) {
ret = EOF;
break;
} else {
code_status(c3);
}
- (*iconv)(c1, c2, c3);
+ if ((*iconv)(c1, c2, c3) == -3) {
+ /* 6 bytes UTF-8 (check combining character) */
+ nkf_char c5, c6;
+ if (hold_index < hold_count){
+ c4 = hold_buf[hold_index++];
+ fromhold_count++;
+ } else if ((c4 = (*i_getc)(f)) == EOF) {
+ w_iconv_nocombine(c1, c2, c3);
+ continue;
+ }
+ if (hold_index < hold_count){
+ c5 = hold_buf[hold_index++];
+ fromhold_count++;
+ } else if ((c5 = (*i_getc)(f)) == EOF) {
+ w_iconv_nocombine(c1, c2, c3);
+ if (fromhold_count == 4)
+ hold_index--;
+ else
+ (*i_ungetc)(c4,f);
+ continue;
+ }
+ if (hold_index < hold_count){
+ c6 = hold_buf[hold_index++];
+ fromhold_count++;
+ } else if ((c6 = (*i_getc)(f)) == EOF) {
+ w_iconv_nocombine(c1, c2, c3);
+ if (fromhold_count == 5) {
+ hold_index -= 2;
+ } else if (fromhold_count == 4) {
+ hold_index--;
+ (*i_ungetc)(c5,f);
+ } else {
+ (*i_ungetc)(c5,f);
+ (*i_ungetc)(c4,f);
+ }
+ continue;
+ }
+ if (w_iconv_combine(c1, c2, c3, c4, c5, c6)) {
+ w_iconv_nocombine(c1, c2, c3);
+ if (fromhold_count == 6) {
+ hold_index -= 3;
+ } else if (fromhold_count == 5) {
+ hold_index -= 2;
+ (*i_ungetc)(c6,f);
+ } else if (fromhold_count == 4) {
+ hold_index--;
+ (*i_ungetc)(c6,f);
+ (*i_ungetc)(c5,f);
+ } else {
+ (*i_ungetc)(c6,f);
+ (*i_ungetc)(c5,f);
+ (*i_ungetc)(c4,f);
+ }
+ }
+ }
break;
}
if (c3 == EOF) break;
@@ -3202,6 +3584,7 @@ check_bom(FILE *f)
set_iconv(TRUE, w_iconv32);
}
if (iconv == w_iconv32) {
+ input_bom_f = TRUE;
input_endian = ENDIAN_BIG;
return;
}
@@ -3232,6 +3615,7 @@ check_bom(FILE *f)
set_iconv(TRUE, w_iconv);
}
if (iconv == w_iconv) {
+ input_bom_f = TRUE;
return;
}
(*i_ungetc)(0xBF,f);
@@ -3260,6 +3644,7 @@ check_bom(FILE *f)
}
if (iconv == w_iconv16) {
input_endian = ENDIAN_BIG;
+ input_bom_f = TRUE;
return;
}
(*i_ungetc)(0xFF,f);
@@ -3275,6 +3660,7 @@ check_bom(FILE *f)
}
if (iconv == w_iconv32) {
input_endian = ENDIAN_LITTLE;
+ input_bom_f = TRUE;
return;
}
(*i_ungetc)(0x00,f);
@@ -3286,6 +3672,7 @@ check_bom(FILE *f)
}
if (iconv == w_iconv16) {
input_endian = ENDIAN_LITTLE;
+ input_bom_f = TRUE;
return;
}
(*i_ungetc)(0xFE,f);
@@ -3338,7 +3725,7 @@ broken_getc(FILE *f)
}
static nkf_char
-broken_ungetc(nkf_char c, FILE *f)
+broken_ungetc(nkf_char c, ARG_UNUSED FILE *f)
{
if (nkf_buf_length(nkf_state->broken_buf) < 2)
nkf_buf_push(nkf_state->broken_buf, c);
@@ -3494,7 +3881,7 @@ fold_conv(nkf_char c2, nkf_char c1)
f_prev = c1;
if (c2 || c2 == JIS_X_0201_1976_K)
f_prev |= 0x80; /* this is Japanese */
- f_line += char_size(c2,c1);
+ f_line += c2 == JIS_X_0201_1976_K ? 1: char_size(c2,c1);
if (f_line<=fold_len) { /* normal case */
fold_state = 1;
} else {
@@ -3613,13 +4000,17 @@ z_conv(nkf_char c2, nkf_char c1)
z_prev2 = 0;
(*o_zconv)(ev[(z_prev1-SP)*2], ev[(z_prev1-SP)*2+1]);
return;
+ } else if (x0213_f && c1 == (0xdf&0x7f) && ev_x0213[(z_prev1-SP)*2]) { /* $BH>ByE@(B */
+ z_prev2 = 0;
+ (*o_zconv)(ev_x0213[(z_prev1-SP)*2], ev_x0213[(z_prev1-SP)*2+1]);
+ return;
}
}
z_prev2 = 0;
(*o_zconv)(cv[(z_prev1-SP)*2], cv[(z_prev1-SP)*2+1]);
}
if (c2 == JIS_X_0201_1976_K) {
- if (dv[(c1-SP)*2] || ev[(c1-SP)*2]) {
+ if (dv[(c1-SP)*2] || ev[(c1-SP)*2] || (x0213_f && ev_x0213[(c1-SP)*2])) {
/* wait for $BByE@(B or $BH>ByE@(B */
z_prev1 = c1;
z_prev2 = c2;
@@ -3727,8 +4118,8 @@ z_conv(nkf_char c2, nkf_char c1)
0x4D00, 0x4D5E, 0x4D5F, 0x4E00, 0x4E5E, 0x4E5F, 0x4F00, 0x5000,
0x5100, 0x5200, 0x5300, 0x2C00, 0x5400, 0x2D00, 0x5500, 0x2E00,
0x5600, 0x5700, 0x5800, 0x5900, 0x5A00, 0x5B00, 0x0000, 0x5C00,
- 0x0000, 0x0000, 0x2600, 0x5D00, 0x335E, 0x0000, 0x0000, 0x0000,
- 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000
+ 0x0000, 0x0000, 0x2600, 0x5D00, 0x335E, 0x0000, 0x0000, 0x365F,
+ 0x375F, 0x385F, 0x395F, 0x3A5F, 0x3E5F, 0x425F, 0x445F, 0x0000
};
if (fullwidth_to_halfwidth[c1-0x20]){
c2 = fullwidth_to_halfwidth[c1-0x20];
@@ -3738,6 +4129,10 @@ z_conv(nkf_char c2, nkf_char c1)
}
return;
}
+ } else if (c2 == 0 && nkf_char_unicode_p(c1) &&
+ ((c1&VALUE_MASK) == 0x3099 || (c1&VALUE_MASK) == 0x309A)) { /* $B9g@.MQByE@!&H>ByE@(B */
+ (*o_zconv)(JIS_X_0201_1976_K, 0x5E + (c1&VALUE_MASK) - 0x3099);
+ return;
}
}
(*o_zconv)(c2,c1);
@@ -3926,7 +4321,7 @@ mime_input_buf_unshift(nkf_char c)
}
static nkf_char
-mime_ungetc(nkf_char c, FILE *f)
+mime_ungetc(nkf_char c, ARG_UNUSED FILE *f)
{
mime_input_buf_unshift(c);
return c;
@@ -4071,7 +4466,7 @@ mime_begin_strict(FILE *f)
static nkf_char
mime_begin(FILE *f)
{
- nkf_char c1;
+ nkf_char c1 = 0;
int i,k;
/* In NONSTRICT mode, only =? is checked. In case of failure, we */
@@ -4127,7 +4522,7 @@ mime_begin(FILE *f)
#ifdef CHECK_OPTION
static void
-no_putc(nkf_char c)
+no_putc(ARG_UNUSED nkf_char c)
{
;
}
@@ -4164,7 +4559,9 @@ get_guessed_code(void)
if (p->score & (SCORE_DEPEND|SCORE_CP932))
input_codename = "CP932";
} else if (strcmp(input_codename, "EUC-JP") == 0) {
- if (p->score & (SCORE_X0212))
+ if (p->score & SCORE_X0213)
+ input_codename = "EUC-JIS-2004";
+ else if (p->score & (SCORE_X0212))
input_codename = "EUCJP-MS";
else if (p->score & (SCORE_DEPEND|SCORE_CP932))
input_codename = "CP51932";
@@ -4190,8 +4587,13 @@ print_guessed_code(char *filename)
if (guess_f == 1) {
printf("%s\n", input_codename);
} else {
- printf("%s%s\n",
+ printf("%s%s%s%s\n",
input_codename,
+ iconv != w_iconv16 && iconv != w_iconv32 ? "" :
+ input_endian == ENDIAN_LITTLE ? " LE" :
+ input_endian == ENDIAN_BIG ? " BE" :
+ "[BUG]",
+ input_bom_f ? " (BOM)" : "",
input_eol == CR ? " (CR)" :
input_eol == LF ? " (LF)" :
input_eol == CRLF ? " (CRLF)" :
@@ -5456,17 +5858,45 @@ kanji_convert(FILE *f)
(c2 = (*i_getc)(f)) != EOF &&
(c3 = (*i_getc)(f)) != EOF &&
(c4 = (*i_getc)(f)) != EOF) {
- nkf_iconv_utf_32(c1, c2, c3, c4);
+ nkf_char c5, c6, c7, c8;
+ if (nkf_iconv_utf_32(c1, c2, c3, c4) == (size_t)NKF_ICONV_WAIT_COMBINING_CHAR) {
+ if ((c5 = (*i_getc)(f)) != EOF &&
+ (c6 = (*i_getc)(f)) != EOF &&
+ (c7 = (*i_getc)(f)) != EOF &&
+ (c8 = (*i_getc)(f)) != EOF) {
+ if (nkf_iconv_utf_32_combine(c1, c2, c3, c4, c5, c6, c7, c8)) {
+ (*i_ungetc)(c8, f);
+ (*i_ungetc)(c7, f);
+ (*i_ungetc)(c6, f);
+ (*i_ungetc)(c5, f);
+ nkf_iconv_utf_32_nocombine(c1, c2, c3, c4);
+ }
+ } else {
+ nkf_iconv_utf_32_nocombine(c1, c2, c3, c4);
+ }
+ }
}
goto finished;
}
else if (iconv == w_iconv16) {
while ((c1 = (*i_getc)(f)) != EOF &&
(c2 = (*i_getc)(f)) != EOF) {
- if (nkf_iconv_utf_16(c1, c2, 0, 0) == NKF_ICONV_NEED_TWO_MORE_BYTES &&
+ size_t ret = nkf_iconv_utf_16(c1, c2, 0, 0);
+ if (ret == NKF_ICONV_NEED_TWO_MORE_BYTES &&
(c3 = (*i_getc)(f)) != EOF &&
(c4 = (*i_getc)(f)) != EOF) {
nkf_iconv_utf_16(c1, c2, c3, c4);
+ } else if (ret == (size_t)NKF_ICONV_WAIT_COMBINING_CHAR) {
+ if ((c3 = (*i_getc)(f)) != EOF &&
+ (c4 = (*i_getc)(f)) != EOF) {
+ if (nkf_iconv_utf_16_combine(c1, c2, c3, c4)) {
+ (*i_ungetc)(c4, f);
+ (*i_ungetc)(c3, f);
+ nkf_iconv_utf_16_nocombine(c1, c2);
+ }
+ } else {
+ nkf_iconv_utf_16_nocombine(c1, c2);
+ }
}
}
goto finished;
@@ -5480,7 +5910,7 @@ kanji_convert(FILE *f)
code_status(c1);
if (c2) {
/* second byte */
- if (c2 > DEL) {
+ if (c2 > ((input_encoding && nkf_enc_cp5022x_p(input_encoding)) ? 0x92 : DEL)) {
/* in case of 8th bit is on */
if (!estab_f&&!mime_decode_mode) {
/* in case of not established yet */
@@ -5672,6 +6102,7 @@ kanji_convert(FILE *f)
else if (c1 == 'I') {
/* JIS X 0201 Katakana */
set_input_mode(JIS_X_0201_1976_K);
+ shift_mode = 1;
SKIP;
}
else if (c1 == 'B' || c1 == 'J' || c1 == 'H') {
@@ -5719,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 */
@@ -5758,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) {
@@ -5813,11 +6246,52 @@ kanji_convert(FILE *f)
}
}
break;
+ case -3:
+ /* 4 bytes UTF-8 (check combining character) */
+ if ((c3 = (*i_getc)(f)) != EOF) {
+ if ((c4 = (*i_getc)(f)) != EOF) {
+ if (w_iconv_combine(c2, c1, 0, c3, c4, 0)) {
+ (*i_ungetc)(c4, f);
+ (*i_ungetc)(c3, f);
+ w_iconv_nocombine(c2, c1, 0);
+ }
+ } else {
+ (*i_ungetc)(c3, f);
+ w_iconv_nocombine(c2, c1, 0);
+ }
+ } else {
+ w_iconv_nocombine(c2, c1, 0);
+ }
+ break;
case -1:
/* 3 bytes EUC or UTF-8 */
if ((c3 = (*i_getc)(f)) != EOF) {
code_status(c3);
- (*iconv)(c2, c1, c3);
+ if ((*iconv)(c2, c1, c3) == -3) {
+ /* 6 bytes UTF-8 (check combining character) */
+ nkf_char c5, c6;
+ if ((c4 = (*i_getc)(f)) != EOF) {
+ if ((c5 = (*i_getc)(f)) != EOF) {
+ if ((c6 = (*i_getc)(f)) != EOF) {
+ if (w_iconv_combine(c2, c1, c3, c4, c5, c6)) {
+ (*i_ungetc)(c6, f);
+ (*i_ungetc)(c5, f);
+ (*i_ungetc)(c4, f);
+ w_iconv_nocombine(c2, c1, c3);
+ }
+ } else {
+ (*i_ungetc)(c5, f);
+ (*i_ungetc)(c4, f);
+ w_iconv_nocombine(c2, c1, c3);
+ }
+ } else {
+ (*i_ungetc)(c4, f);
+ w_iconv_nocombine(c2, c1, c3);
+ }
+ } else {
+ w_iconv_nocombine(c2, c1, c3);
+ }
+ }
}
break;
}
diff --git a/ext/nkf/nkf-utf8/nkf.h b/ext/nkf/nkf-utf8/nkf.h
index dd479a0f87..cd3037601b 100644
--- a/ext/nkf/nkf-utf8/nkf.h
+++ b/ext/nkf/nkf-utf8/nkf.h
@@ -2,10 +2,10 @@
*
* nkf.h - Header file for nkf
*
- * $Id$
*/
#ifndef NKF_H
+#define NKF_H
/* Wrapper of configurations */
@@ -17,21 +17,9 @@
#endif
#if DEFAULT_NEWLINE == 0x0D0A
-#define PUT_NEWLINE(func) do {\
- func(0x0D);\
- func(0x0A);\
-} while (0)
-#define OCONV_NEWLINE(func) do {\
- func(0, 0x0D);\
- func(0, 0x0A);\
-} while (0)
#elif DEFAULT_NEWLINE == 0x0D
-#define PUT_NEWLINE(func) func(0x0D)
-#define OCONV_NEWLINE(func) func(0, 0x0D)
#else
#define DEFAULT_NEWLINE 0x0A
-#define PUT_NEWLINE(func) func(0x0A)
-#define OCONV_NEWLINE(func) func(0, 0x0A)
#endif
#ifdef HELP_OUTPUT_STDERR
#define HELP_OUTPUT stderr
@@ -94,7 +82,7 @@ void setbinmode(FILE *fp)
#define setbinmode(fp) setmode(fileno(fp), O_BINARY)
#endif
#else /* UNIX */
-#define setbinmode(fp)
+#define setbinmode(fp) (void)(fp)
#endif
#ifdef _IOFBF /* SysV and MSDOS, Windows */
@@ -164,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
@@ -185,6 +174,14 @@ void setbinmode(FILE *fp)
#define FALSE 0
#define TRUE 1
+#ifndef ARG_UNUSED
+#if defined(__GNUC__)
+# define ARG_UNUSED __attribute__ ((unused))
+#else
+# define ARG_UNUSED
+#endif
+#endif
+
#ifdef WIN32DLL
#include "nkf32.h"
#endif
diff --git a/ext/nkf/nkf-utf8/utf8tbl.c b/ext/nkf/nkf-utf8/utf8tbl.c
index 10eec60c5d..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"
@@ -68,6 +67,20 @@ static const unsigned short euc_to_utf8_A2_ms[] = {
0, 0, 0x212B, 0x2030, 0x266F, 0x266D, 0x266A, 0x2020,
0x2021, 0x00B6, 0, 0, 0, 0, 0x25EF,
};
+static const unsigned short euc_to_utf8_A2_x0213[] = {
+ 0x25C6, 0x25A1, 0x25A0, 0x25B3, 0x25B2, 0x25BD, 0x25BC,
+ 0x203B, 0x3012, 0x2192, 0x2190, 0x2191, 0x2193, 0x3013, 0xFF07,
+ 0xFF02, 0xFF0D, 0xFF5E, 0x3033, 0x3034, 0x3035, 0x303B, 0x303C,
+ 0x30FF, 0x309F, 0x2208, 0x220B, 0x2286, 0x2287, 0x2282, 0x2283,
+ 0x222A, 0x2229, 0x2284, 0x2285, 0x228A, 0x228B, 0x2209, 0x2205,
+ 0x2305, 0x2306, 0x2227, 0x2228, 0x00AC, 0x21D2, 0x21D4, 0x2200,
+ 0x2203, 0x2295, 0x2296, 0x2297, 0x2225, 0x2226, 0xFF5F, 0xFF60,
+ 0x3018, 0x3019, 0x3016, 0x3017, 0x2220, 0x22A5, 0x2312, 0x2202,
+ 0x2207, 0x2261, 0x2252, 0x226A, 0x226B, 0x221A, 0x223D, 0x221D,
+ 0x2235, 0x222B, 0x222C, 0x2262, 0x2243, 0x2245, 0x2248, 0x2276,
+ 0x2277, 0x2194, 0x212B, 0x2030, 0x266F, 0x266D, 0x266A, 0x2020,
+ 0x2021, 0x00B6, 0x266E, 0x266B, 0x266C, 0x2669, 0x25EF,
+};
static const unsigned short euc_to_utf8_A3[] = {
0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
@@ -82,6 +95,20 @@ static const unsigned short euc_to_utf8_A3[] = {
0xFF50, 0xFF51, 0xFF52, 0xFF53, 0xFF54, 0xFF55, 0xFF56, 0xFF57,
0xFF58, 0xFF59, 0xFF5A, 0, 0, 0, 0,
};
+static const unsigned short euc_to_utf8_A3_x0213[] = {
+ 0x25B7, 0x25B6, 0x25C1, 0x25C0, 0x2197, 0x2198, 0x2196,
+ 0x2199, 0x21C4, 0x21E8, 0x21E6, 0x21E7, 0x21E9, 0x2934, 0x2935,
+ 0xFF10, 0xFF11, 0xFF12, 0xFF13, 0xFF14, 0xFF15, 0xFF16, 0xFF17,
+ 0xFF18, 0xFF19, 0x29BF, 0x25C9, 0x303D, 0xFE46, 0xFE45, 0x25E6,
+ 0x2022, 0xFF21, 0xFF22, 0xFF23, 0xFF24, 0xFF25, 0xFF26, 0xFF27,
+ 0xFF28, 0xFF29, 0xFF2A, 0xFF2B, 0xFF2C, 0xFF2D, 0xFF2E, 0xFF2F,
+ 0xFF30, 0xFF31, 0xFF32, 0xFF33, 0xFF34, 0xFF35, 0xFF36, 0xFF37,
+ 0xFF38, 0xFF39, 0xFF3A, 0x2213, 0x2135, 0x210F, 0x33CB, 0x2113,
+ 0x2127, 0xFF41, 0xFF42, 0xFF43, 0xFF44, 0xFF45, 0xFF46, 0xFF47,
+ 0xFF48, 0xFF49, 0xFF4A, 0xFF4B, 0xFF4C, 0xFF4D, 0xFF4E, 0xFF4F,
+ 0xFF50, 0xFF51, 0xFF52, 0xFF53, 0xFF54, 0xFF55, 0xFF56, 0xFF57,
+ 0xFF58, 0xFF59, 0xFF5A, 0x30A0, 0x2013, 0x29FA, 0x29FB,
+};
static const unsigned short euc_to_utf8_A4[] = {
0x3041, 0x3042, 0x3043, 0x3044, 0x3045, 0x3046, 0x3047,
0x3048, 0x3049, 0x304A, 0x304B, 0x304C, 0x304D, 0x304E, 0x304F,
@@ -96,6 +123,20 @@ static const unsigned short euc_to_utf8_A4[] = {
0x3090, 0x3091, 0x3092, 0x3093, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0,
};
+static const unsigned short euc_to_utf8_A4_x0213[] = {
+ 0x3041, 0x3042, 0x3043, 0x3044, 0x3045, 0x3046, 0x3047,
+ 0x3048, 0x3049, 0x304A, 0x304B, 0x304C, 0x304D, 0x304E, 0x304F,
+ 0x3050, 0x3051, 0x3052, 0x3053, 0x3054, 0x3055, 0x3056, 0x3057,
+ 0x3058, 0x3059, 0x305A, 0x305B, 0x305C, 0x305D, 0x305E, 0x305F,
+ 0x3060, 0x3061, 0x3062, 0x3063, 0x3064, 0x3065, 0x3066, 0x3067,
+ 0x3068, 0x3069, 0x306A, 0x306B, 0x306C, 0x306D, 0x306E, 0x306F,
+ 0x3070, 0x3071, 0x3072, 0x3073, 0x3074, 0x3075, 0x3076, 0x3077,
+ 0x3078, 0x3079, 0x307A, 0x307B, 0x307C, 0x307D, 0x307E, 0x307F,
+ 0x3080, 0x3081, 0x3082, 0x3083, 0x3084, 0x3085, 0x3086, 0x3087,
+ 0x3088, 0x3089, 0x308A, 0x308B, 0x308C, 0x308D, 0x308E, 0x308F,
+ 0x3090, 0x3091, 0x3092, 0x3093, 0x3094, 0x3095, 0x3096, /*0x304B*/ 0x309A,
+ /*0x304D*/ 0x309A, /*0x304F*/ 0x309A, /*0x3051*/ 0x309A, /*0x3053*/ 0x309A, 0, 0, 0,
+};
static const unsigned short euc_to_utf8_A5[] = {
0x30A1, 0x30A2, 0x30A3, 0x30A4, 0x30A5, 0x30A6, 0x30A7,
0x30A8, 0x30A9, 0x30AA, 0x30AB, 0x30AC, 0x30AD, 0x30AE, 0x30AF,
@@ -110,6 +151,20 @@ static const unsigned short euc_to_utf8_A5[] = {
0x30F0, 0x30F1, 0x30F2, 0x30F3, 0x30F4, 0x30F5, 0x30F6, 0,
0, 0, 0, 0, 0, 0, 0,
};
+static const unsigned short euc_to_utf8_A5_x0213[] = {
+ 0x30A1, 0x30A2, 0x30A3, 0x30A4, 0x30A5, 0x30A6, 0x30A7,
+ 0x30A8, 0x30A9, 0x30AA, 0x30AB, 0x30AC, 0x30AD, 0x30AE, 0x30AF,
+ 0x30B0, 0x30B1, 0x30B2, 0x30B3, 0x30B4, 0x30B5, 0x30B6, 0x30B7,
+ 0x30B8, 0x30B9, 0x30BA, 0x30BB, 0x30BC, 0x30BD, 0x30BE, 0x30BF,
+ 0x30C0, 0x30C1, 0x30C2, 0x30C3, 0x30C4, 0x30C5, 0x30C6, 0x30C7,
+ 0x30C8, 0x30C9, 0x30CA, 0x30CB, 0x30CC, 0x30CD, 0x30CE, 0x30CF,
+ 0x30D0, 0x30D1, 0x30D2, 0x30D3, 0x30D4, 0x30D5, 0x30D6, 0x30D7,
+ 0x30D8, 0x30D9, 0x30DA, 0x30DB, 0x30DC, 0x30DD, 0x30DE, 0x30DF,
+ 0x30E0, 0x30E1, 0x30E2, 0x30E3, 0x30E4, 0x30E5, 0x30E6, 0x30E7,
+ 0x30E8, 0x30E9, 0x30EA, 0x30EB, 0x30EC, 0x30ED, 0x30EE, 0x30EF,
+ 0x30F0, 0x30F1, 0x30F2, 0x30F3, 0x30F4, 0x30F5, 0x30F6, /*0x30AB*/ 0x309A,
+ /*0x30AD*/ 0x309A, /*0x30AF*/ 0x309A, /*0x30B1*/ 0x309A, /*0x30B3*/ 0x309A, /*0x30BB*/ 0x309A, /*0x30C4*/ 0x309A, /*0x30C8*/ 0x309A,
+};
static const unsigned short euc_to_utf8_A6[] = {
0x0391, 0x0392, 0x0393, 0x0394, 0x0395, 0x0396, 0x0397,
0x0398, 0x0399, 0x039A, 0x039B, 0x039C, 0x039D, 0x039E, 0x039F,
@@ -124,6 +179,20 @@ static const unsigned short euc_to_utf8_A6[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0,
};
+static const unsigned short euc_to_utf8_A6_x0213[] = {
+ 0x0391, 0x0392, 0x0393, 0x0394, 0x0395, 0x0396, 0x0397,
+ 0x0398, 0x0399, 0x039A, 0x039B, 0x039C, 0x039D, 0x039E, 0x039F,
+ 0x03A0, 0x03A1, 0x03A3, 0x03A4, 0x03A5, 0x03A6, 0x03A7, 0x03A8,
+ 0x03A9, 0x2664, 0x2660, 0x2662, 0x2666, 0x2661, 0x2665, 0x2667,
+ 0x2663, 0x03B1, 0x03B2, 0x03B3, 0x03B4, 0x03B5, 0x03B6, 0x03B7,
+ 0x03B8, 0x03B9, 0x03BA, 0x03BB, 0x03BC, 0x03BD, 0x03BE, 0x03BF,
+ 0x03C0, 0x03C1, 0x03C3, 0x03C4, 0x03C5, 0x03C6, 0x03C7, 0x03C8,
+ 0x03C9, 0x03C2, 0x24F5, 0x24F6, 0x24F7, 0x24F8, 0x24F9, 0x24FA,
+ 0x24FB, 0x24FC, 0x24FD, 0x24FE, 0x2616, 0x2617, 0x3020, 0x260E,
+ 0x2600, 0x2601, 0x2602, 0x2603, 0x2668, 0x25B1, 0x31F0, 0x31F1,
+ 0x31F2, 0x31F3, 0x31F4, 0x31F5, 0x31F6, 0x31F7, 0x31F8, 0x31F9,
+ /*0x31F7*/ 0x309A, 0x31FA, 0x31FB, 0x31FC, 0x31FD, 0x31FE, 0x31FF,
+};
static const unsigned short euc_to_utf8_A7[] = {
0x0410, 0x0411, 0x0412, 0x0413, 0x0414, 0x0415, 0x0401,
0x0416, 0x0417, 0x0418, 0x0419, 0x041A, 0x041B, 0x041C, 0x041D,
@@ -138,6 +207,20 @@ static const unsigned short euc_to_utf8_A7[] = {
0x044E, 0x044F, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0,
};
+static const unsigned short euc_to_utf8_A7_x0213[] = {
+ 0x0410, 0x0411, 0x0412, 0x0413, 0x0414, 0x0415, 0x0401,
+ 0x0416, 0x0417, 0x0418, 0x0419, 0x041A, 0x041B, 0x041C, 0x041D,
+ 0x041E, 0x041F, 0x0420, 0x0421, 0x0422, 0x0423, 0x0424, 0x0425,
+ 0x0426, 0x0427, 0x0428, 0x0429, 0x042A, 0x042B, 0x042C, 0x042D,
+ 0x042E, 0x042F, 0x23BE, 0x23BF, 0x23C0, 0x23C1, 0x23C2, 0x23C3,
+ 0x23C4, 0x23C5, 0x23C6, 0x23C7, 0x23C8, 0x23C9, 0x23CA, 0x23CB,
+ 0x23CC, 0x0430, 0x0431, 0x0432, 0x0433, 0x0434, 0x0435, 0x0451,
+ 0x0436, 0x0437, 0x0438, 0x0439, 0x043A, 0x043B, 0x043C, 0x043D,
+ 0x043E, 0x043F, 0x0440, 0x0441, 0x0442, 0x0443, 0x0444, 0x0445,
+ 0x0446, 0x0447, 0x0448, 0x0449, 0x044A, 0x044B, 0x044C, 0x044D,
+ 0x044E, 0x044F, 0x30F7, 0x30F8, 0x30F9, 0x30FA, 0x22DA, 0x22DB,
+ 0x2153, 0x2154, 0x2155, 0x2713, 0x2318, 0x2423, 0x23CE,
+};
static const unsigned short euc_to_utf8_A8[] = {
0x2500, 0x2502, 0x250C, 0x2510, 0x2518, 0x2514, 0x251C,
0x252C, 0x2524, 0x2534, 0x253C, 0x2501, 0x2503, 0x250F, 0x2513,
@@ -152,6 +235,20 @@ static const unsigned short euc_to_utf8_A8[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0,
};
+static const unsigned short euc_to_utf8_A8_x0213[] = {
+ 0x2500, 0x2502, 0x250C, 0x2510, 0x2518, 0x2514, 0x251C,
+ 0x252C, 0x2524, 0x2534, 0x253C, 0x2501, 0x2503, 0x250F, 0x2513,
+ 0x251B, 0x2517, 0x2523, 0x2533, 0x252B, 0x253B, 0x254B, 0x2520,
+ 0x252F, 0x2528, 0x2537, 0x253F, 0x251D, 0x2530, 0x2525, 0x2538,
+ 0x2542, 0x3251, 0x3252, 0x3253, 0x3254, 0x3255, 0x3256, 0x3257,
+ 0x3258, 0x3259, 0x325A, 0x325B, 0x325C, 0x325D, 0x325E, 0x325F,
+ 0x32B1, 0x32B2, 0x32B3, 0x32B4, 0x32B5, 0x32B6, 0x32B7, 0x32B8,
+ 0x32B9, 0x32BA, 0x32BB, 0x32BC, 0x32BD, 0x32BE, 0x32BF, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0x25D0,
+ 0x25D1, 0x25D2, 0x25D3, 0x203C, 0x2047, 0x2048, 0x2049, 0x01CD,
+ 0x01CE, 0x01D0, 0x1E3E, 0x1E3F, 0x01F8, 0x01F9, 0x01D1, 0x01D2,
+ 0x01D4, 0x01D6, 0x01D8, 0x01DA, 0x01DC, 0, 0,
+};
static const unsigned short euc_to_utf8_A9[] = {
0x2460, 0x2461, 0x2462, 0x2463, 0x2464, 0x2465, 0x2466,
0x2467, 0x2468, 0x2469, 0x246A, 0x246B, 0x246C, 0x246D, 0x246E,
@@ -166,6 +263,20 @@ static const unsigned short euc_to_utf8_A9[] = {
0, 0, 0x2488, 0x2489, 0x248A, 0x248B, 0x248C, 0x248D,
0x248E, 0x248F, 0x2490, 0, 0, 0, 0,
};
+static const unsigned short euc_to_utf8_A9_x0213[] = {
+ 0x20AC, 0x00A0, 0x00A1, 0x00A4, 0x00A6, 0x00A9, 0x00AA,
+ 0x00AB, 0x00AD, 0x00AE, 0x00AF, 0x00B2, 0x00B3, 0x00B7, 0x00B8,
+ 0x00B9, 0x00BA, 0x00BB, 0x00BC, 0x00BD, 0x00BE, 0x00BF, 0x00C0,
+ 0x00C1, 0x00C2, 0x00C3, 0x00C4, 0x00C5, 0x00C6, 0x00C7, 0x00C8,
+ 0x00C9, 0x00CA, 0x00CB, 0x00CC, 0x00CD, 0x00CE, 0x00CF, 0x00D0,
+ 0x00D1, 0x00D2, 0x00D3, 0x00D4, 0x00D5, 0x00D6, 0x00D8, 0x00D9,
+ 0x00DA, 0x00DB, 0x00DC, 0x00DD, 0x00DE, 0x00DF, 0x00E0, 0x00E1,
+ 0x00E2, 0x00E3, 0x00E4, 0x00E5, 0x00E6, 0x00E7, 0x00E8, 0x00E9,
+ 0x00EA, 0x00EB, 0x00EC, 0x00ED, 0x00EE, 0x00EF, 0x00F0, 0x00F1,
+ 0x00F2, 0x00F3, 0x00F4, 0x00F5, 0x00F6, 0x00F8, 0x00F9, 0x00FA,
+ 0x00FB, 0x00FC, 0x00FD, 0x00FE, 0x00FF, 0x0100, 0x012A, 0x016A,
+ 0x0112, 0x014C, 0x0101, 0x012B, 0x016B, 0x0113, 0x014D,
+};
static const unsigned short euc_to_utf8_AA[] = {
0x2160, 0x2161, 0x2162, 0x2163, 0x2164, 0x2165, 0x2166,
0x2167, 0x2168, 0x2169, 0x216A, 0x216B, 0, 0, 0,
@@ -180,6 +291,20 @@ static const unsigned short euc_to_utf8_AA[] = {
0x24AF, 0x24B0, 0x24B1, 0x24B2, 0x24B3, 0x24B4, 0x24B5, 0,
0, 0, 0, 0, 0, 0, 0,
};
+static const unsigned short euc_to_utf8_AA_x0213[] = {
+ 0x0104, 0x02D8, 0x0141, 0x013D, 0x015A, 0x0160, 0x015E,
+ 0x0164, 0x0179, 0x017D, 0x017B, 0x0105, 0x02DB, 0x0142, 0x013E,
+ 0x015B, 0x02C7, 0x0161, 0x015F, 0x0165, 0x017A, 0x02DD, 0x017E,
+ 0x017C, 0x0154, 0x0102, 0x0139, 0x0106, 0x010C, 0x0118, 0x011A,
+ 0x010E, 0x0143, 0x0147, 0x0150, 0x0158, 0x016E, 0x0170, 0x0162,
+ 0x0155, 0x0103, 0x013A, 0x0107, 0x010D, 0x0119, 0x011B, 0x010F,
+ 0x0111, 0x0144, 0x0148, 0x0151, 0x0159, 0x016F, 0x0171, 0x0163,
+ 0x02D9, 0x0108, 0x011C, 0x0124, 0x0134, 0x015C, 0x016C, 0x0109,
+ 0x011D, 0x0125, 0x0135, 0x015D, 0x016D, 0x0271, 0x028B, 0x027E,
+ 0x0283, 0x0292, 0x026C, 0x026E, 0x0279, 0x0288, 0x0256, 0x0273,
+ 0x027D, 0x0282, 0x0290, 0x027B, 0x026D, 0x025F, 0x0272, 0x029D,
+ 0x028E, 0x0261, 0x014B, 0x0270, 0x0281, 0x0127, 0x0295,
+};
static const unsigned short euc_to_utf8_AB[] = {
0x339C, 0x339F, 0x339D, 0x33A0, 0x33A4, 0, 0x33A1,
0x33A5, 0x339E, 0x33A2, 0x338E, 0, 0x338F, 0x33C4, 0x3396,
@@ -194,6 +319,20 @@ static const unsigned short euc_to_utf8_AB[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0x2116, 0x33CD, 0x2121, 0,
};
+static const unsigned short euc_to_utf8_AB_x0213[] = {
+ 0x0294, 0x0266, 0x0298, 0x01C2, 0x0253, 0x0257, 0x0284,
+ 0x0260, 0x0193, 0x0153, 0x0152, 0x0268, 0x0289, 0x0258, 0x0275,
+ 0x0259, 0x025C, 0x025E, 0x0250, 0x026F, 0x028A, 0x0264, 0x028C,
+ 0x0254, 0x0251, 0x0252, 0x028D, 0x0265, 0x02A2, 0x02A1, 0x0255,
+ 0x0291, 0x027A, 0x0267, 0x025A, /*0x00E6*/ 0x0300, 0x01FD, 0x1F70, 0x1F71,
+ /*0x0254*/ 0x0300, /*0x0254*/ 0x0301, /*0x028C*/ 0x0300, /*0x028C*/ 0x0301, /*0x0259*/ 0x0300, /*0x0259*/ 0x0301, /*0x025A*/ 0x0300, /*0x025A*/ 0x0301,
+ 0x1F72, 0x1F73, 0x0361, 0x02C8, 0x02CC, 0x02D0, 0x02D1, 0x0306,
+ 0x203F, 0x030B, /*0*/ 0x0301, 0x0304, /*0*/ 0x0300, 0x030F, 0x030C, 0x0302,
+ /*0*/ 0x02E5, 0x02E6, 0x02E7, 0x02E8, /*0*/ 0x02E9, /*0x02E9*/ 0x02E5, /*0x02E5*/ 0x02E9, 0x0325,
+ 0x032C, 0x0339, 0x031C, 0x031F, 0x0320, 0x0308, 0x033D, 0x0329,
+ 0x032F, 0x02DE, 0x0324, 0x0330, 0x033C, 0x0334, 0x031D, 0x031E,
+ 0x0318, 0x0319, 0x032A, 0x033A, 0x033B, 0x0303, 0x031A,
+};
static const unsigned short euc_to_utf8_AC[] = {
0x2664, 0x2667, 0x2661, 0x2662, 0x2660, 0x2663, 0x2665,
0x2666, 0, 0, 0, 0, 0, 0, 0,
@@ -222,6 +361,20 @@ static const unsigned short euc_to_utf8_AC_mac[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0,
};
+static const unsigned short euc_to_utf8_AC_x0213[] = {
+ 0x2776, 0x2777, 0x2778, 0x2779, 0x277A, 0x277B, 0x277C,
+ 0x277D, 0x277E, 0x277F, 0x24EB, 0x24EC, 0x24ED, 0x24EE, 0x24EF,
+ 0x24F0, 0x24F1, 0x24F2, 0x24F3, 0x24F4, 0x2170, 0x2171, 0x2172,
+ 0x2173, 0x2174, 0x2175, 0x2176, 0x2177, 0x2178, 0x2179, 0x217A,
+ 0x217B, 0x24D0, 0x24D1, 0x24D2, 0x24D3, 0x24D4, 0x24D5, 0x24D6,
+ 0x24D7, 0x24D8, 0x24D9, 0x24DA, 0x24DB, 0x24DC, 0x24DD, 0x24DE,
+ 0x24DF, 0x24E0, 0x24E1, 0x24E2, 0x24E3, 0x24E4, 0x24E5, 0x24E6,
+ 0x24E7, 0x24E8, 0x24E9, 0x32D0, 0x32D1, 0x32D2, 0x32D3, 0x32D4,
+ 0x32D5, 0x32D6, 0x32D7, 0x32D8, 0x32D9, 0x32DA, 0x32DB, 0x32DC,
+ 0x32DD, 0x32DE, 0x32DF, 0x32E0, 0x32E1, 0x32E2, 0x32E3, 0x32FA,
+ 0x32E9, 0x32E5, 0x32ED, 0x32EC, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0x2051, 0x2042,
+};
static const unsigned short euc_to_utf8_AD[] = {
0x2460, 0x2461, 0x2462, 0x2463, 0x2464, 0x2465, 0x2466,
0x2467, 0x2468, 0x2469, 0x246A, 0x246B, 0x246C, 0x246D, 0x246E,
@@ -250,6 +403,20 @@ static const unsigned short euc_to_utf8_AD_mac[] = {
0x2252, 0x5927, 0x5C0F, 0x32A4, 0x32A5, 0x32A6, 0x32A7, 0x32A8,
0x533B, 0x8CA1, 0x512A, 0x52B4, 0x5370, 0x63A7, 0x79D8,
};
+static const unsigned short euc_to_utf8_AD_x0213[] = {
+ 0x2460, 0x2461, 0x2462, 0x2463, 0x2464, 0x2465, 0x2466,
+ 0x2467, 0x2468, 0x2469, 0x246A, 0x246B, 0x246C, 0x246D, 0x246E,
+ 0x246F, 0x2470, 0x2471, 0x2472, 0x2473, 0x2160, 0x2161, 0x2162,
+ 0x2163, 0x2164, 0x2165, 0x2166, 0x2167, 0x2168, 0x2169, 0x216A,
+ 0x3349, 0x3314, 0x3322, 0x334D, 0x3318, 0x3327, 0x3303, 0x3336,
+ 0x3351, 0x3357, 0x330D, 0x3326, 0x3323, 0x332B, 0x334A, 0x333B,
+ 0x339C, 0x339D, 0x339E, 0x338E, 0x338F, 0x33C4, 0x33A1, 0x216B,
+ 0, 0, 0, 0, 0, 0, 0, 0x337B,
+ 0x301D, 0x301F, 0x2116, 0x33CD, 0x2121, 0x32A4, 0x32A5, 0x32A6,
+ 0x32A7, 0x32A8, 0x3231, 0x3232, 0x3239, 0x337E, 0x337D, 0x337C,
+ 0x2252, 0x2261, 0x222B, 0x222E, 0x2211, 0x221A, 0x22A5, 0x2220,
+ 0x221F, 0x22BF, 0x2235, 0x2229, 0x222A, 0x2756, 0x261E,
+};
static const unsigned short euc_to_utf8_AE[] = {
0x3349, 0x3322, 0x334D, 0x3314, 0x3316, 0x3305, 0x3333,
0x334E, 0x3303, 0x3336, 0x3318, 0x3315, 0x3327, 0x3351, 0x334A,
@@ -264,6 +431,20 @@ static const unsigned short euc_to_utf8_AE[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0x337F, 0, 0,
};
+static const unsigned short euc_to_utf8_AE_x0213[] = {
+ 0x4FF1, 0xD840 /*0xDC0B*/, 0x3402, 0x4E28, 0x4E2F, 0x4E30, 0x4E8D,
+ 0x4EE1, 0x4EFD, 0x4EFF, 0x4F03, 0x4F0B, 0x4F60, 0x4F48, 0x4F49,
+ 0x4F56, 0x4F5F, 0x4F6A, 0x4F6C, 0x4F7E, 0x4F8A, 0x4F94, 0x4F97,
+ 0xFA30, 0x4FC9, 0x4FE0, 0x5001, 0x5002, 0x500E, 0x5018, 0x5027,
+ 0x502E, 0x5040, 0x503B, 0x5041, 0x5094, 0x50CC, 0x50F2, 0x50D0,
+ 0x50E6, 0xFA31, 0x5106, 0x5103, 0x510B, 0x511E, 0x5135, 0x514A,
+ 0xFA32, 0x5155, 0x5157, 0x34B5, 0x519D, 0x51C3, 0x51CA, 0x51DE,
+ 0x51E2, 0x51EE, 0x5201, 0x34DB, 0x5213, 0x5215, 0x5249, 0x5257,
+ 0x5261, 0x5293, 0x52C8, 0xFA33, 0x52CC, 0x52D0, 0x52D6, 0x52DB,
+ 0xFA34, 0x52F0, 0x52FB, 0x5300, 0x5307, 0x531C, 0xFA35, 0x5361,
+ 0x5363, 0x537D, 0x5393, 0x539D, 0x53B2, 0x5412, 0x5427, 0x544D,
+ 0x549C, 0x546B, 0x5474, 0x547F, 0x5488, 0x5496, 0x54A1,
+};
static const unsigned short euc_to_utf8_AF[] = {
0x222E, 0x221F, 0x22BF, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
@@ -278,6 +459,20 @@ static const unsigned short euc_to_utf8_AF[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0,
};
+static const unsigned short euc_to_utf8_AF_x0213[] = {
+ 0x54A9, 0x54C6, 0x54FF, 0x550E, 0x552B, 0x5535, 0x5550,
+ 0x555E, 0x5581, 0x5586, 0x558E, 0xFA36, 0x55AD, 0x55CE, 0xFA37,
+ 0x5608, 0x560E, 0x563B, 0x5649, 0x5676, 0x5666, 0xFA38, 0x566F,
+ 0x5671, 0x5672, 0x5699, 0x569E, 0x56A9, 0x56AC, 0x56B3, 0x56C9,
+ 0x56CA, 0x570A, 0xD844 /*0xDE3D*/, 0x5721, 0x572F, 0x5733, 0x5734, 0x5770,
+ 0x5777, 0x577C, 0x579C, 0xFA0F, 0xD844 /*0xDF1B*/, 0x57B8, 0x57C7, 0x57C8,
+ 0x57CF, 0x57E4, 0x57ED, 0x57F5, 0x57F6, 0x57FF, 0x5809, 0xFA10,
+ 0x5861, 0x5864, 0xFA39, 0x587C, 0x5889, 0x589E, 0xFA3A, 0x58A9,
+ 0xD845 /*0xDC6E*/, 0x58D2, 0x58CE, 0x58D4, 0x58DA, 0x58E0, 0x58E9, 0x590C,
+ 0x8641, 0x595D, 0x596D, 0x598B, 0x5992, 0x59A4, 0x59C3, 0x59D2,
+ 0x59DD, 0x5A13, 0x5A23, 0x5A67, 0x5A6D, 0x5A77, 0x5A7E, 0x5A84,
+ 0x5A9E, 0x5AA7, 0x5AC4, 0xD846 /*0xDCBD*/, 0x5B19, 0x5B25, 0x525D,
+};
static const unsigned short euc_to_utf8_B0[] = {
0x4E9C, 0x5516, 0x5A03, 0x963F, 0x54C0, 0x611B, 0x6328,
0x59F6, 0x9022, 0x8475, 0x831C, 0x7A50, 0x60AA, 0x63E1, 0x6E25,
@@ -726,6 +921,20 @@ static const unsigned short euc_to_utf8_CF[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0,
};
+static const unsigned short euc_to_utf8_CF_x0213[] = {
+ 0x84EE, 0x9023, 0x932C, 0x5442, 0x9B6F, 0x6AD3, 0x7089,
+ 0x8CC2, 0x8DEF, 0x9732, 0x52B4, 0x5A41, 0x5ECA, 0x5F04, 0x6717,
+ 0x697C, 0x6994, 0x6D6A, 0x6F0F, 0x7262, 0x72FC, 0x7BED, 0x8001,
+ 0x807E, 0x874B, 0x90CE, 0x516D, 0x9E93, 0x7984, 0x808B, 0x9332,
+ 0x8AD6, 0x502D, 0x548C, 0x8A71, 0x6B6A, 0x8CC4, 0x8107, 0x60D1,
+ 0x67A0, 0x9DF2, 0x4E99, 0x4E98, 0x9C10, 0x8A6B, 0x85C1, 0x8568,
+ 0x6900, 0x6E7E, 0x7897, 0x8155, 0xD842 /*0xDF9F*/, 0x5B41, 0x5B56, 0x5B7D,
+ 0x5B93, 0x5BD8, 0x5BEC, 0x5C12, 0x5C1E, 0x5C23, 0x5C2B, 0x378D,
+ 0x5C62, 0xFA3B, 0xFA3C, 0xD845 /*0xDEB4*/, 0x5C7A, 0x5C8F, 0x5C9F, 0x5CA3,
+ 0x5CAA, 0x5CBA, 0x5CCB, 0x5CD0, 0x5CD2, 0x5CF4, 0xD847 /*0xDE34*/, 0x37E2,
+ 0x5D0D, 0x5D27, 0xFA11, 0x5D46, 0x5D47, 0x5D53, 0x5D4A, 0x5D6D,
+ 0x5D81, 0x5DA0, 0x5DA4, 0x5DA7, 0x5DB8, 0x5DCB, 0x541E,
+};
static const unsigned short euc_to_utf8_D0[] = {
0x5F0C, 0x4E10, 0x4E15, 0x4E2A, 0x4E31, 0x4E36, 0x4E3C,
0x4E3F, 0x4E42, 0x4E56, 0x4E58, 0x4E82, 0x4E85, 0x8C6B, 0x4E8A,
@@ -1244,6 +1453,20 @@ static const unsigned short euc_to_utf8_F4[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0,
};
+static const unsigned short euc_to_utf8_F4_x0213[] = {
+ 0x582F, 0x69C7, 0x9059, 0x7464, 0x51DC, 0x7199, 0x5653,
+ 0x5DE2, 0x5E14, 0x5E18, 0x5E58, 0x5E5E, 0x5EBE, 0xF928, 0x5ECB,
+ 0x5EF9, 0x5F00, 0x5F02, 0x5F07, 0x5F1D, 0x5F23, 0x5F34, 0x5F36,
+ 0x5F3D, 0x5F40, 0x5F45, 0x5F54, 0x5F58, 0x5F64, 0x5F67, 0x5F7D,
+ 0x5F89, 0x5F9C, 0x5FA7, 0x5FAF, 0x5FB5, 0x5FB7, 0x5FC9, 0x5FDE,
+ 0x5FE1, 0x5FE9, 0x600D, 0x6014, 0x6018, 0x6033, 0x6035, 0x6047,
+ 0xFA3D, 0x609D, 0x609E, 0x60CB, 0x60D4, 0x60D5, 0x60DD, 0x60F8,
+ 0x611C, 0x612B, 0x6130, 0x6137, 0xFA3E, 0x618D, 0xFA3F, 0x61BC,
+ 0x61B9, 0xFA40, 0x6222, 0x623E, 0x6243, 0x6256, 0x625A, 0x626F,
+ 0x6285, 0x62C4, 0x62D6, 0x62FC, 0x630A, 0x6318, 0x6339, 0x6343,
+ 0x6365, 0x637C, 0x63E5, 0x63ED, 0x63F5, 0x6410, 0x6414, 0x6422,
+ 0x6479, 0x6451, 0x6460, 0x646D, 0x64CE, 0x64BE, 0x64BF,
+};
static const unsigned short euc_to_utf8_F5[] = {
0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
@@ -1258,6 +1481,62 @@ static const unsigned short euc_to_utf8_F5[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0,
};
+static const unsigned short euc_to_utf8_F5_x0213[] = {
+ 0x64C4, 0x64CA, 0x64D0, 0x64F7, 0x64FB, 0x6522, 0x6529,
+ 0xFA41, 0x6567, 0x659D, 0xFA42, 0x6600, 0x6609, 0x6615, 0x661E,
+ 0x663A, 0x6622, 0x6624, 0x662B, 0x6630, 0x6631, 0x6633, 0x66FB,
+ 0x6648, 0x664C, 0xD84C /*0xDDC4*/, 0x6659, 0x665A, 0x6661, 0x6665, 0x6673,
+ 0x6677, 0x6678, 0x668D, 0xFA43, 0x66A0, 0x66B2, 0x66BB, 0x66C6,
+ 0x66C8, 0x3B22, 0x66DB, 0x66E8, 0x66FA, 0x6713, 0xF929, 0x6733,
+ 0x6766, 0x6747, 0x6748, 0x677B, 0x6781, 0x6793, 0x6798, 0x679B,
+ 0x67BB, 0x67F9, 0x67C0, 0x67D7, 0x67FC, 0x6801, 0x6852, 0x681D,
+ 0x682C, 0x6831, 0x685B, 0x6872, 0x6875, 0xFA44, 0x68A3, 0x68A5,
+ 0x68B2, 0x68C8, 0x68D0, 0x68E8, 0x68ED, 0x68F0, 0x68F1, 0x68FC,
+ 0x690A, 0x6949, 0xD84D /*0xDDC4*/, 0x6935, 0x6942, 0x6957, 0x6963, 0x6964,
+ 0x6968, 0x6980, 0xFA14, 0x69A5, 0x69AD, 0x69CF, 0x3BB6,
+};
+static const unsigned short euc_to_utf8_F6_x0213[] = {
+ 0x3BC3, 0x69E2, 0x69E9, 0x69EA, 0x69F5, 0x69F6, 0x6A0F,
+ 0x6A15, 0xD84D /*0xDF3F*/, 0x6A3B, 0x6A3E, 0x6A45, 0x6A50, 0x6A56, 0x6A5B,
+ 0x6A6B, 0x6A73, 0xD84D /*0xDF63*/, 0x6A89, 0x6A94, 0x6A9D, 0x6A9E, 0x6AA5,
+ 0x6AE4, 0x6AE7, 0x3C0F, 0xF91D, 0x6B1B, 0x6B1E, 0x6B2C, 0x6B35,
+ 0x6B46, 0x6B56, 0x6B60, 0x6B65, 0x6B67, 0x6B77, 0x6B82, 0x6BA9,
+ 0x6BAD, 0xF970, 0x6BCF, 0x6BD6, 0x6BD7, 0x6BFF, 0x6C05, 0x6C10,
+ 0x6C33, 0x6C59, 0x6C5C, 0x6CAA, 0x6C74, 0x6C76, 0x6C85, 0x6C86,
+ 0x6C98, 0x6C9C, 0x6CFB, 0x6CC6, 0x6CD4, 0x6CE0, 0x6CEB, 0x6CEE,
+ 0xD84F /*0xDCFE*/, 0x6D04, 0x6D0E, 0x6D2E, 0x6D31, 0x6D39, 0x6D3F, 0x6D58,
+ 0x6D65, 0xFA45, 0x6D82, 0x6D87, 0x6D89, 0x6D94, 0x6DAA, 0x6DAC,
+ 0x6DBF, 0x6DC4, 0x6DD6, 0x6DDA, 0x6DDB, 0x6DDD, 0x6DFC, 0xFA46,
+ 0x6E34, 0x6E44, 0x6E5C, 0x6E5E, 0x6EAB, 0x6EB1, 0x6EC1,
+};
+static const unsigned short euc_to_utf8_F7_x0213[] = {
+ 0x6EC7, 0x6ECE, 0x6F10, 0x6F1A, 0xFA47, 0x6F2A, 0x6F2F,
+ 0x6F33, 0x6F51, 0x6F59, 0x6F5E, 0x6F61, 0x6F62, 0x6F7E, 0x6F88,
+ 0x6F8C, 0x6F8D, 0x6F94, 0x6FA0, 0x6FA7, 0x6FB6, 0x6FBC, 0x6FC7,
+ 0x6FCA, 0x6FF9, 0x6FF0, 0x6FF5, 0x7005, 0x7006, 0x7028, 0x704A,
+ 0x705D, 0x705E, 0x704E, 0x7064, 0x7075, 0x7085, 0x70A4, 0x70AB,
+ 0x70B7, 0x70D4, 0x70D8, 0x70E4, 0x710F, 0x712B, 0x711E, 0x7120,
+ 0x712E, 0x7130, 0x7146, 0x7147, 0x7151, 0xFA48, 0x7152, 0x715C,
+ 0x7160, 0x7168, 0xFA15, 0x7185, 0x7187, 0x7192, 0x71C1, 0x71BA,
+ 0x71C4, 0x71FE, 0x7200, 0x7215, 0x7255, 0x7256, 0x3E3F, 0x728D,
+ 0x729B, 0x72BE, 0x72C0, 0x72FB, 0xD851 /*0xDFF1*/, 0x7327, 0x7328, 0xFA16,
+ 0x7350, 0x7366, 0x737C, 0x7395, 0x739F, 0x73A0, 0x73A2, 0x73A6,
+ 0x73AB, 0x73C9, 0x73CF, 0x73D6, 0x73D9, 0x73E3, 0x73E9,
+};
+static const unsigned short euc_to_utf8_F8_x0213[] = {
+ 0x7407, 0x740A, 0x741A, 0x741B, 0xFA4A, 0x7426, 0x7428,
+ 0x742A, 0x742B, 0x742C, 0x742E, 0x742F, 0x7430, 0x7444, 0x7446,
+ 0x7447, 0x744B, 0x7457, 0x7462, 0x746B, 0x746D, 0x7486, 0x7487,
+ 0x7489, 0x7498, 0x749C, 0x749F, 0x74A3, 0x7490, 0x74A6, 0x74A8,
+ 0x74A9, 0x74B5, 0x74BF, 0x74C8, 0x74C9, 0x74DA, 0x74FF, 0x7501,
+ 0x7517, 0x752F, 0x756F, 0x7579, 0x7592, 0x3F72, 0x75CE, 0x75E4,
+ 0x7600, 0x7602, 0x7608, 0x7615, 0x7616, 0x7619, 0x761E, 0x762D,
+ 0x7635, 0x7643, 0x764B, 0x7664, 0x7665, 0x766D, 0x766F, 0x7671,
+ 0x7681, 0x769B, 0x769D, 0x769E, 0x76A6, 0x76AA, 0x76B6, 0x76C5,
+ 0x76CC, 0x76CE, 0x76D4, 0x76E6, 0x76F1, 0x76FC, 0x770A, 0x7719,
+ 0x7734, 0x7736, 0x7746, 0x774D, 0x774E, 0x775C, 0x775F, 0x7762,
+ 0x777A, 0x7780, 0x7794, 0x77AA, 0x77E0, 0x782D, 0xD855 /*0xDC8E*/,
+};
static const unsigned short euc_to_utf8_F9[] = {
0x7E8A, 0x891C, 0x9348, 0x9288, 0x84DC, 0x4FC9, 0x70BB,
0x6631, 0x68C8, 0x92F9, 0x66FB, 0x5F45, 0x4E28, 0x4EE1, 0x4EFC,
@@ -1272,6 +1551,20 @@ static const unsigned short euc_to_utf8_F9[] = {
0x5CA6, 0x5CBA, 0x5CF5, 0x5D27, 0x5D53, 0xFA11, 0x5D42, 0x5D6D,
0x5DB8, 0x5DB9, 0x5DD0, 0x5F21, 0x5F34, 0x5F67, 0x5FB7,
};
+static const unsigned short euc_to_utf8_F9_x0213[] = {
+ 0x7843, 0x784E, 0x784F, 0x7851, 0x7868, 0x786E, 0xFA4B,
+ 0x78B0, 0xD855 /*0xDD0E*/, 0x78AD, 0x78E4, 0x78F2, 0x7900, 0x78F7, 0x791C,
+ 0x792E, 0x7931, 0x7934, 0xFA4C, 0xFA4D, 0x7945, 0x7946, 0xFA4E,
+ 0xFA4F, 0xFA50, 0x795C, 0xFA51, 0xFA19, 0xFA1A, 0x7979, 0xFA52,
+ 0xFA53, 0xFA1B, 0x7998, 0x79B1, 0x79B8, 0x79C8, 0x79CA, 0xD855 /*0xDF71*/,
+ 0x79D4, 0x79DE, 0x79EB, 0x79ED, 0x7A03, 0xFA54, 0x7A39, 0x7A5D,
+ 0x7A6D, 0xFA55, 0x7A85, 0x7AA0, 0xD856 /*0xDDC4*/, 0x7AB3, 0x7ABB, 0x7ACE,
+ 0x7AEB, 0x7AFD, 0x7B12, 0x7B2D, 0x7B3B, 0x7B47, 0x7B4E, 0x7B60,
+ 0x7B6D, 0x7B6F, 0x7B72, 0x7B9E, 0xFA56, 0x7BD7, 0x7BD9, 0x7C01,
+ 0x7C31, 0x7C1E, 0x7C20, 0x7C33, 0x7C36, 0x4264, 0xD857 /*0xDDA1*/, 0x7C59,
+ 0x7C6D, 0x7C79, 0x7C8F, 0x7C94, 0x7CA0, 0x7CBC, 0x7CD5, 0x7CD9,
+ 0x7CDD, 0x7D07, 0x7D08, 0x7D13, 0x7D1D, 0x7D23, 0x7D31,
+};
static const unsigned short euc_to_utf8_FA[] = {
0x5FDE, 0x605D, 0x6085, 0x608A, 0x60DE, 0x60D5, 0x6120,
0x60F2, 0x6111, 0x6137, 0x6130, 0x6198, 0x6213, 0x62A6, 0x63F5,
@@ -1286,6 +1579,20 @@ static const unsigned short euc_to_utf8_FA[] = {
0x6FF5, 0x7005, 0x7007, 0x7028, 0x7085, 0x70AB, 0x710F, 0x7104,
0x715C, 0x7146, 0x7147, 0xFA15, 0x71C1, 0x71FE, 0x72B1,
};
+static const unsigned short euc_to_utf8_FA_x0213[] = {
+ 0x7D41, 0x7D48, 0x7D53, 0x7D5C, 0x7D7A, 0x7D83, 0x7D8B,
+ 0x7DA0, 0x7DA6, 0x7DC2, 0x7DCC, 0x7DD6, 0x7DE3, 0xFA57, 0x7E28,
+ 0x7E08, 0x7E11, 0x7E15, 0xFA59, 0x7E47, 0x7E52, 0x7E61, 0x7E8A,
+ 0x7E8D, 0x7F47, 0xFA5A, 0x7F91, 0x7F97, 0x7FBF, 0x7FCE, 0x7FDB,
+ 0x7FDF, 0x7FEC, 0x7FEE, 0x7FFA, 0xFA5B, 0x8014, 0x8026, 0x8035,
+ 0x8037, 0x803C, 0x80CA, 0x80D7, 0x80E0, 0x80F3, 0x8118, 0x814A,
+ 0x8160, 0x8167, 0x8168, 0x816D, 0x81BB, 0x81CA, 0x81CF, 0x81D7,
+ 0xFA5C, 0x4453, 0x445B, 0x8260, 0x8274, 0xD85A /*0xDEFF*/, 0x828E, 0x82A1,
+ 0x82A3, 0x82A4, 0x82A9, 0x82AE, 0x82B7, 0x82BE, 0x82BF, 0x82C6,
+ 0x82D5, 0x82FD, 0x82FE, 0x8300, 0x8301, 0x8362, 0x8322, 0x832D,
+ 0x833A, 0x8343, 0x8347, 0x8351, 0x8355, 0x837D, 0x8386, 0x8392,
+ 0x8398, 0x83A7, 0x83A9, 0x83BF, 0x83C0, 0x83C7, 0x83CF,
+};
static const unsigned short euc_to_utf8_FB[] = {
0x72BE, 0x7324, 0xFA16, 0x7377, 0x73BD, 0x73C9, 0x73D6,
0x73E3, 0x73D2, 0x7407, 0x73F5, 0x7426, 0x742A, 0x7429, 0x742E,
@@ -1300,6 +1607,20 @@ static const unsigned short euc_to_utf8_FB[] = {
0x8B7F, 0x8CF0, 0x8CF4, 0x8D12, 0x8D76, 0xFA23, 0x8ECF, 0xFA24,
0xFA25, 0x9067, 0x90DE, 0xFA26, 0x9115, 0x9127, 0x91DA,
};
+static const unsigned short euc_to_utf8_FB_x0213[] = {
+ 0x83D1, 0x83E1, 0x83EA, 0x8401, 0x8406, 0x840A, 0xFA5F,
+ 0x8448, 0x845F, 0x8470, 0x8473, 0x8485, 0x849E, 0x84AF, 0x84B4,
+ 0x84BA, 0x84C0, 0x84C2, 0xD85B /*0xDE40*/, 0x8532, 0x851E, 0x8523, 0x852F,
+ 0x8559, 0x8564, 0xFA1F, 0x85AD, 0x857A, 0x858C, 0x858F, 0x85A2,
+ 0x85B0, 0x85CB, 0x85CE, 0x85ED, 0x8612, 0x85FF, 0x8604, 0x8605,
+ 0x8610, 0xD85C /*0xDCF4*/, 0x8618, 0x8629, 0x8638, 0x8657, 0x865B, 0xF936,
+ 0x8662, 0x459D, 0x866C, 0x8675, 0x8698, 0x86B8, 0x86FA, 0x86FC,
+ 0x86FD, 0x870B, 0x8771, 0x8787, 0x8788, 0x87AC, 0x87AD, 0x87B5,
+ 0x45EA, 0x87D6, 0x87EC, 0x8806, 0x880A, 0x8810, 0x8814, 0x881F,
+ 0x8898, 0x88AA, 0x88CA, 0x88CE, 0xD85D /*0xDE84*/, 0x88F5, 0x891C, 0xFA60,
+ 0x8918, 0x8919, 0x891A, 0x8927, 0x8930, 0x8932, 0x8939, 0x8940,
+ 0x8994, 0xFA61, 0x89D4, 0x89E5, 0x89F6, 0x8A12, 0x8A15,
+};
static const unsigned short euc_to_utf8_FC[] = {
0x91D7, 0x91DE, 0x91ED, 0x91EE, 0x91E4, 0x91E5, 0x9206,
0x9210, 0x920A, 0x923A, 0x9240, 0x923C, 0x924E, 0x9259, 0x9251,
@@ -1330,6 +1651,413 @@ static const unsigned short euc_to_utf8_FC_ms[] = {
0, 0x2170, 0x2171, 0x2172, 0x2173, 0x2174, 0x2175, 0x2176,
0x2177, 0x2178, 0x2179, 0xFFE2, 0xFFE4, 0xFF07, 0xFF02,
};
+static const unsigned short euc_to_utf8_FC_x0213[] = {
+ 0x8A22, 0x8A37, 0x8A47, 0x8A4E, 0x8A5D, 0x8A61, 0x8A75,
+ 0x8A79, 0x8AA7, 0x8AD0, 0x8ADF, 0x8AF4, 0x8AF6, 0xFA22, 0xFA62,
+ 0xFA63, 0x8B46, 0x8B54, 0x8B59, 0x8B69, 0x8B9D, 0x8C49, 0x8C68,
+ 0xFA64, 0x8CE1, 0x8CF4, 0x8CF8, 0x8CFE, 0xFA65, 0x8D12, 0x8D1B,
+ 0x8DAF, 0x8DCE, 0x8DD1, 0x8DD7, 0x8E20, 0x8E23, 0x8E3D, 0x8E70,
+ 0x8E7B, 0xD860 /*0xDE77*/, 0x8EC0, 0x4844, 0x8EFA, 0x8F1E, 0x8F2D, 0x8F36,
+ 0x8F54, 0xD860 /*0xDFCD*/, 0x8FA6, 0x8FB5, 0x8FE4, 0x8FE8, 0x8FEE, 0x9008,
+ 0x902D, 0xFA67, 0x9088, 0x9095, 0x9097, 0x9099, 0x909B, 0x90A2,
+ 0x90B3, 0x90BE, 0x90C4, 0x90C5, 0x90C7, 0x90D7, 0x90DD, 0x90DE,
+ 0x90EF, 0x90F4, 0xFA26, 0x9114, 0x9115, 0x9116, 0x9122, 0x9123,
+ 0x9127, 0x912F, 0x9131, 0x9134, 0x913D, 0x9148, 0x915B, 0x9183,
+ 0x919E, 0x91AC, 0x91B1, 0x91BC, 0x91D7, 0x91FB, 0x91E4,
+};
+static const unsigned short euc_to_utf8_FD_x0213[] = {
+ 0x91E5, 0x91ED, 0x91F1, 0x9207, 0x9210, 0x9238, 0x9239,
+ 0x923A, 0x923C, 0x9240, 0x9243, 0x924F, 0x9278, 0x9288, 0x92C2,
+ 0x92CB, 0x92CC, 0x92D3, 0x92E0, 0x92FF, 0x9304, 0x931F, 0x9321,
+ 0x9325, 0x9348, 0x9349, 0x934A, 0x9364, 0x9365, 0x936A, 0x9370,
+ 0x939B, 0x93A3, 0x93BA, 0x93C6, 0x93DE, 0x93DF, 0x9404, 0x93FD,
+ 0x9433, 0x944A, 0x9463, 0x946B, 0x9471, 0x9472, 0x958E, 0x959F,
+ 0x95A6, 0x95A9, 0x95AC, 0x95B6, 0x95BD, 0x95CB, 0x95D0, 0x95D3,
+ 0x49B0, 0x95DA, 0x95DE, 0x9658, 0x9684, 0xF9DC, 0x969D, 0x96A4,
+ 0x96A5, 0x96D2, 0x96DE, 0xFA68, 0x96E9, 0x96EF, 0x9733, 0x973B,
+ 0x974D, 0x974E, 0x974F, 0x975A, 0x976E, 0x9773, 0x9795, 0x97AE,
+ 0x97BA, 0x97C1, 0x97C9, 0x97DE, 0x97DB, 0x97F4, 0xFA69, 0x980A,
+ 0x981E, 0x982B, 0x9830, 0xFA6A, 0x9852, 0x9853, 0x9856,
+};
+static const unsigned short euc_to_utf8_FE_x0213[] = {
+ 0x9857, 0x9859, 0x985A, 0xF9D0, 0x9865, 0x986C, 0x98BA,
+ 0x98C8, 0x98E7, 0x9958, 0x999E, 0x9A02, 0x9A03, 0x9A24, 0x9A2D,
+ 0x9A2E, 0x9A38, 0x9A4A, 0x9A4E, 0x9A52, 0x9AB6, 0x9AC1, 0x9AC3,
+ 0x9ACE, 0x9AD6, 0x9AF9, 0x9B02, 0x9B08, 0x9B20, 0x4C17, 0x9B2D,
+ 0x9B5E, 0x9B79, 0x9B66, 0x9B72, 0x9B75, 0x9B84, 0x9B8A, 0x9B8F,
+ 0x9B9E, 0x9BA7, 0x9BC1, 0x9BCE, 0x9BE5, 0x9BF8, 0x9BFD, 0x9C00,
+ 0x9C23, 0x9C41, 0x9C4F, 0x9C50, 0x9C53, 0x9C63, 0x9C65, 0x9C77,
+ 0x9D1D, 0x9D1E, 0x9D43, 0x9D47, 0x9D52, 0x9D63, 0x9D70, 0x9D7C,
+ 0x9D8A, 0x9D96, 0x9DC0, 0x9DAC, 0x9DBC, 0x9DD7, 0xD868 /*0xDD90*/, 0x9DE7,
+ 0x9E07, 0x9E15, 0x9E7C, 0x9E9E, 0x9EA4, 0x9EAC, 0x9EAF, 0x9EB4,
+ 0x9EB5, 0x9EC3, 0x9ED1, 0x9F10, 0x9F39, 0x9F57, 0x9F90, 0x9F94,
+ 0x9F97, 0x9FA2, 0x59F8, 0x5C5B, 0x5E77, 0x7626, 0x7E6B,
+};
+
+static const unsigned short euc_to_utf8_8FA1_x0213[] = {
+ 0xD840 /*0xDC89*/, 0x4E02, 0x4E0F, 0x4E12, 0x4E29, 0x4E2B, 0x4E2E,
+ 0x4E40, 0x4E47, 0x4E48, 0xD840 /*0xDCA2*/, 0x4E51, 0x3406, 0xD840 /*0xDCA4*/, 0x4E5A,
+ 0x4E69, 0x4E9D, 0x342C, 0x342E, 0x4EB9, 0x4EBB, 0xD840 /*0xDDA2*/, 0x4EBC,
+ 0x4EC3, 0x4EC8, 0x4ED0, 0x4EEB, 0x4EDA, 0x4EF1, 0x4EF5, 0x4F00,
+ 0x4F16, 0x4F64, 0x4F37, 0x4F3E, 0x4F54, 0x4F58, 0xD840 /*0xDE13*/, 0x4F77,
+ 0x4F78, 0x4F7A, 0x4F7D, 0x4F82, 0x4F85, 0x4F92, 0x4F9A, 0x4FE6,
+ 0x4FB2, 0x4FBE, 0x4FC5, 0x4FCB, 0x4FCF, 0x4FD2, 0x346A, 0x4FF2,
+ 0x5000, 0x5010, 0x5013, 0x501C, 0x501E, 0x5022, 0x3468, 0x5042,
+ 0x5046, 0x504E, 0x5053, 0x5057, 0x5063, 0x5066, 0x506A, 0x5070,
+ 0x50A3, 0x5088, 0x5092, 0x5093, 0x5095, 0x5096, 0x509C, 0x50AA,
+ 0xD840 /*0xDF2B*/, 0x50B1, 0x50BA, 0x50BB, 0x50C4, 0x50C7, 0x50F3, 0xD840 /*0xDF81*/,
+ 0x50CE, 0xD840 /*0xDF71*/, 0x50D4, 0x50D9, 0x50E1, 0x50E9, 0x3492,
+};
+static const unsigned short euc_to_utf8_8FA3_x0213[] = {
+ 0x5108, 0xD840 /*0xDFF9*/, 0x5117, 0x511B, 0xD841 /*0xDC4A*/, 0x5160, 0xD841 /*0xDD09*/,
+ 0x5173, 0x5183, 0x518B, 0x34BC, 0x5198, 0x51A3, 0x51AD, 0x34C7,
+ 0x51BC, 0xD841 /*0xDDD6*/, 0xD841 /*0xDE28*/, 0x51F3, 0x51F4, 0x5202, 0x5212, 0x5216,
+ 0xD841 /*0xDF4F*/, 0x5255, 0x525C, 0x526C, 0x5277, 0x5284, 0x5282, 0xD842 /*0xDC07*/,
+ 0x5298, 0xD842 /*0xDC3A*/, 0x52A4, 0x52A6, 0x52AF, 0x52BA, 0x52BB, 0x52CA,
+ 0x351F, 0x52D1, 0xD842 /*0xDCB9*/, 0x52F7, 0x530A, 0x530B, 0x5324, 0x5335,
+ 0x533E, 0x5342, 0xD842 /*0xDD7C*/, 0xD842 /*0xDD9D*/, 0x5367, 0x536C, 0x537A, 0x53A4,
+ 0x53B4, 0xD842 /*0xDED3*/, 0x53B7, 0x53C0, 0xD842 /*0xDF1D*/, 0x355D, 0x355E, 0x53D5,
+ 0x53DA, 0x3563, 0x53F4, 0x53F5, 0x5455, 0x5424, 0x5428, 0x356E,
+ 0x5443, 0x5462, 0x5466, 0x546C, 0x548A, 0x548D, 0x5495, 0x54A0,
+ 0x54A6, 0x54AD, 0x54AE, 0x54B7, 0x54BA, 0x54BF, 0x54C3, 0xD843 /*0xDD45*/,
+ 0x54EC, 0x54EF, 0x54F1, 0x54F3, 0x5500, 0x5501, 0x5509,
+};
+static const unsigned short euc_to_utf8_8FA4_x0213[] = {
+ 0x553C, 0x5541, 0x35A6, 0x5547, 0x554A, 0x35A8, 0x5560,
+ 0x5561, 0x5564, 0xD843 /*0xDDE1*/, 0x557D, 0x5582, 0x5588, 0x5591, 0x35C5,
+ 0x55D2, 0xD843 /*0xDE95*/, 0xD843 /*0xDE6D*/, 0x55BF, 0x55C9, 0x55CC, 0x55D1, 0x55DD,
+ 0x35DA, 0x55E2, 0xD843 /*0xDE64*/, 0x55E9, 0x5628, 0xD843 /*0xDF5F*/, 0x5607, 0x5610,
+ 0x5630, 0x5637, 0x35F4, 0x563D, 0x563F, 0x5640, 0x5647, 0x565E,
+ 0x5660, 0x566D, 0x3605, 0x5688, 0x568C, 0x5695, 0x569A, 0x569D,
+ 0x56A8, 0x56AD, 0x56B2, 0x56C5, 0x56CD, 0x56DF, 0x56E8, 0x56F6,
+ 0x56F7, 0xD844 /*0xDE01*/, 0x5715, 0x5723, 0xD844 /*0xDE55*/, 0x5729, 0xD844 /*0xDE7B*/, 0x5745,
+ 0x5746, 0x574C, 0x574D, 0xD844 /*0xDE74*/, 0x5768, 0x576F, 0x5773, 0x5774,
+ 0x5775, 0x577B, 0xD844 /*0xDEE4*/, 0xD844 /*0xDED7*/, 0x57AC, 0x579A, 0x579D, 0x579E,
+ 0x57A8, 0x57D7, 0xD844 /*0xDEFD*/, 0x57CC, 0xD844 /*0xDF36*/, 0xD844 /*0xDF44*/, 0x57DE, 0x57E6,
+ 0x57F0, 0x364A, 0x57F8, 0x57FB, 0x57FD, 0x5804, 0x581E,
+};
+static const unsigned short euc_to_utf8_8FA5_x0213[] = {
+ 0x5820, 0x5827, 0x5832, 0x5839, 0xD844 /*0xDFC4*/, 0x5849, 0x584C,
+ 0x5867, 0x588A, 0x588B, 0x588D, 0x588F, 0x5890, 0x5894, 0x589D,
+ 0x58AA, 0x58B1, 0xD845 /*0xDC6D*/, 0x58C3, 0x58CD, 0x58E2, 0x58F3, 0x58F4,
+ 0x5905, 0x5906, 0x590B, 0x590D, 0x5914, 0x5924, 0xD845 /*0xDDD7*/, 0x3691,
+ 0x593D, 0x3699, 0x5946, 0x3696, 0xD85B /*0xDC29*/, 0x595B, 0x595F, 0xD845 /*0xDE47*/,
+ 0x5975, 0x5976, 0x597C, 0x599F, 0x59AE, 0x59BC, 0x59C8, 0x59CD,
+ 0x59DE, 0x59E3, 0x59E4, 0x59E7, 0x59EE, 0xD845 /*0xDF06*/, 0xD845 /*0xDF42*/, 0x36CF,
+ 0x5A0C, 0x5A0D, 0x5A17, 0x5A27, 0x5A2D, 0x5A55, 0x5A65, 0x5A7A,
+ 0x5A8B, 0x5A9C, 0x5A9F, 0x5AA0, 0x5AA2, 0x5AB1, 0x5AB3, 0x5AB5,
+ 0x5ABA, 0x5ABF, 0x5ADA, 0x5ADC, 0x5AE0, 0x5AE5, 0x5AF0, 0x5AEE,
+ 0x5AF5, 0x5B00, 0x5B08, 0x5B17, 0x5B34, 0x5B2D, 0x5B4C, 0x5B52,
+ 0x5B68, 0x5B6F, 0x5B7C, 0x5B7F, 0x5B81, 0x5B84, 0xD846 /*0xDDC3*/,
+};
+static const unsigned short euc_to_utf8_8FA8_x0213[] = {
+ 0x5B96, 0x5BAC, 0x3761, 0x5BC0, 0x3762, 0x5BCE, 0x5BD6,
+ 0x376C, 0x376B, 0x5BF1, 0x5BFD, 0x3775, 0x5C03, 0x5C29, 0x5C30,
+ 0xD847 /*0xDC56*/, 0x5C5F, 0x5C63, 0x5C67, 0x5C68, 0x5C69, 0x5C70, 0xD847 /*0xDD2D*/,
+ 0xD847 /*0xDD45*/, 0x5C7C, 0xD847 /*0xDD78*/, 0xD847 /*0xDD62*/, 0x5C88, 0x5C8A, 0x37C1, 0xD847 /*0xDDA1*/,
+ 0xD847 /*0xDD9C*/, 0x5CA0, 0x5CA2, 0x5CA6, 0x5CA7, 0xD847 /*0xDD92*/, 0x5CAD, 0x5CB5,
+ 0xD847 /*0xDDB7*/, 0x5CC9, 0xD847 /*0xDDE0*/, 0xD847 /*0xDE33*/, 0x5D06, 0x5D10, 0x5D2B, 0x5D1D,
+ 0x5D20, 0x5D24, 0x5D26, 0x5D31, 0x5D39, 0x5D42, 0x37E8, 0x5D61,
+ 0x5D6A, 0x37F4, 0x5D70, 0xD847 /*0xDF1E*/, 0x37FD, 0x5D88, 0x3800, 0x5D92,
+ 0x5D94, 0x5D97, 0x5D99, 0x5DB0, 0x5DB2, 0x5DB4, 0xD847 /*0xDF76*/, 0x5DB9,
+ 0x5DD1, 0x5DD7, 0x5DD8, 0x5DE0, 0xD847 /*0xDFFA*/, 0x5DE4, 0x5DE9, 0x382F,
+ 0x5E00, 0x3836, 0x5E12, 0x5E15, 0x3840, 0x5E1F, 0x5E2E, 0x5E3E,
+ 0x5E49, 0x385C, 0x5E56, 0x3861, 0x5E6B, 0x5E6C, 0x5E6D,
+};
+static const unsigned short euc_to_utf8_8FAC_x0213[] = {
+ 0x5E6E, 0xD848 /*0xDD7B*/, 0x5EA5, 0x5EAA, 0x5EAC, 0x5EB9, 0x5EBF,
+ 0x5EC6, 0x5ED2, 0x5ED9, 0xD848 /*0xDF1E*/, 0x5EFD, 0x5F08, 0x5F0E, 0x5F1C,
+ 0xD848 /*0xDFAD*/, 0x5F1E, 0x5F47, 0x5F63, 0x5F72, 0x5F7E, 0x5F8F, 0x5FA2,
+ 0x5FA4, 0x5FB8, 0x5FC4, 0x38FA, 0x5FC7, 0x5FCB, 0x5FD2, 0x5FD3,
+ 0x5FD4, 0x5FE2, 0x5FEE, 0x5FEF, 0x5FF3, 0x5FFC, 0x3917, 0x6017,
+ 0x6022, 0x6024, 0x391A, 0x604C, 0x607F, 0x608A, 0x6095, 0x60A8,
+ 0xD849 /*0xDEF3*/, 0x60B0, 0x60B1, 0x60BE, 0x60C8, 0x60D9, 0x60DB, 0x60EE,
+ 0x60F2, 0x60F5, 0x6110, 0x6112, 0x6113, 0x6119, 0x611E, 0x613A,
+ 0x396F, 0x6141, 0x6146, 0x6160, 0x617C, 0xD84A /*0xDC5B*/, 0x6192, 0x6193,
+ 0x6197, 0x6198, 0x61A5, 0x61A8, 0x61AD, 0xD84A /*0xDCAB*/, 0x61D5, 0x61DD,
+ 0x61DF, 0x61F5, 0xD84A /*0xDD8F*/, 0x6215, 0x6223, 0x6229, 0x6246, 0x624C,
+ 0x6251, 0x6252, 0x6261, 0x6264, 0x627B, 0x626D, 0x6273,
+};
+static const unsigned short euc_to_utf8_8FAD_x0213[] = {
+ 0x6299, 0x62A6, 0x62D5, 0xD84A /*0xDEB8*/, 0x62FD, 0x6303, 0x630D,
+ 0x6310, 0xD84A /*0xDF4F*/, 0xD84A /*0xDF50*/, 0x6332, 0x6335, 0x633B, 0x633C, 0x6341,
+ 0x6344, 0x634E, 0xD84A /*0xDF46*/, 0x6359, 0xD84B /*0xDC1D*/, 0xD84A /*0xDFA6*/, 0x636C, 0x6384,
+ 0x6399, 0xD84B /*0xDC24*/, 0x6394, 0x63BD, 0x63F7, 0x63D4, 0x63D5, 0x63DC,
+ 0x63E0, 0x63EB, 0x63EC, 0x63F2, 0x6409, 0x641E, 0x6425, 0x6429,
+ 0x642F, 0x645A, 0x645B, 0x645D, 0x6473, 0x647D, 0x6487, 0x6491,
+ 0x649D, 0x649F, 0x64CB, 0x64CC, 0x64D5, 0x64D7, 0xD84B /*0xDDE1*/, 0x64E4,
+ 0x64E5, 0x64FF, 0x6504, 0x3A6E, 0x650F, 0x6514, 0x6516, 0x3A73,
+ 0x651E, 0x6532, 0x6544, 0x6554, 0x656B, 0x657A, 0x6581, 0x6584,
+ 0x6585, 0x658A, 0x65B2, 0x65B5, 0x65B8, 0x65BF, 0x65C2, 0x65C9,
+ 0x65D4, 0x3AD6, 0x65F2, 0x65F9, 0x65FC, 0x6604, 0x6608, 0x6621,
+ 0x662A, 0x6645, 0x6651, 0x664E, 0x3AEA, 0xD84C /*0xDDC3*/, 0x6657,
+};
+static const unsigned short euc_to_utf8_8FAE_x0213[] = {
+ 0x665B, 0x6663, 0xD84C /*0xDDF5*/, 0xD84C /*0xDDB6*/, 0x666A, 0x666B, 0x666C,
+ 0x666D, 0x667B, 0x6680, 0x6690, 0x6692, 0x6699, 0x3B0E, 0x66AD,
+ 0x66B1, 0x66B5, 0x3B1A, 0x66BF, 0x3B1C, 0x66EC, 0x3AD7, 0x6701,
+ 0x6705, 0x6712, 0xD84C /*0xDF72*/, 0x6719, 0xD84C /*0xDFD3*/, 0xD84C /*0xDFD2*/, 0x674C, 0x674D,
+ 0x6754, 0x675D, 0xD84C /*0xDFD0*/, 0xD84C /*0xDFE4*/, 0xD84C /*0xDFD5*/, 0x6774, 0x6776, 0xD84C /*0xDFDA*/,
+ 0x6792, 0xD84C /*0xDFDF*/, 0x8363, 0x6810, 0x67B0, 0x67B2, 0x67C3, 0x67C8,
+ 0x67D2, 0x67D9, 0x67DB, 0x67F0, 0x67F7, 0xD84D /*0xDC4A*/, 0xD84D /*0xDC51*/, 0xD84D /*0xDC4B*/,
+ 0x6818, 0x681F, 0x682D, 0xD84D /*0xDC65*/, 0x6833, 0x683B, 0x683E, 0x6844,
+ 0x6845, 0x6849, 0x684C, 0x6855, 0x6857, 0x3B77, 0x686B, 0x686E,
+ 0x687A, 0x687C, 0x6882, 0x6890, 0x6896, 0x3B6D, 0x6898, 0x6899,
+ 0x689A, 0x689C, 0x68AA, 0x68AB, 0x68B4, 0x68BB, 0x68FB, 0xD84D /*0xDCE4*/,
+ 0xD84D /*0xDD5A*/, 0xFA13, 0x68C3, 0x68C5, 0x68CC, 0x68CF, 0x68D6,
+};
+static const unsigned short euc_to_utf8_8FAF_x0213[] = {
+ 0x68D9, 0x68E4, 0x68E5, 0x68EC, 0x68F7, 0x6903, 0x6907,
+ 0x3B87, 0x3B88, 0xD84D /*0xDD94*/, 0x693B, 0x3B8D, 0x6946, 0x6969, 0x696C,
+ 0x6972, 0x697A, 0x697F, 0x6992, 0x3BA4, 0x6996, 0x6998, 0x69A6,
+ 0x69B0, 0x69B7, 0x69BA, 0x69BC, 0x69C0, 0x69D1, 0x69D6, 0xD84D /*0xDE39*/,
+ 0xD84D /*0xDE47*/, 0x6A30, 0xD84D /*0xDE38*/, 0xD84D /*0xDE3A*/, 0x69E3, 0x69EE, 0x69EF, 0x69F3,
+ 0x3BCD, 0x69F4, 0x69FE, 0x6A11, 0x6A1A, 0x6A1D, 0xD84D /*0xDF1C*/, 0x6A32,
+ 0x6A33, 0x6A34, 0x6A3F, 0x6A46, 0x6A49, 0x6A7A, 0x6A4E, 0x6A52,
+ 0x6A64, 0xD84D /*0xDF0C*/, 0x6A7E, 0x6A83, 0x6A8B, 0x3BF0, 0x6A91, 0x6A9F,
+ 0x6AA1, 0xD84D /*0xDF64*/, 0x6AAB, 0x6ABD, 0x6AC6, 0x6AD4, 0x6AD0, 0x6ADC,
+ 0x6ADD, 0xD84D /*0xDFFF*/, 0xD84D /*0xDFE7*/, 0x6AEC, 0x6AF1, 0x6AF2, 0x6AF3, 0x6AFD,
+ 0xD84E /*0xDC24*/, 0x6B0B, 0x6B0F, 0x6B10, 0x6B11, 0xD84E /*0xDC3D*/, 0x6B17, 0x3C26,
+ 0x6B2F, 0x6B4A, 0x6B58, 0x6B6C, 0x6B75, 0x6B7A, 0x6B81,
+};
+static const unsigned short euc_to_utf8_8FEE_x0213[] = {
+ 0x6B9B, 0x6BAE, 0xD84E /*0xDE98*/, 0x6BBD, 0x6BBE, 0x6BC7, 0x6BC8,
+ 0x6BC9, 0x6BDA, 0x6BE6, 0x6BE7, 0x6BEE, 0x6BF1, 0x6C02, 0x6C0A,
+ 0x6C0E, 0x6C35, 0x6C36, 0x6C3A, 0xD84F /*0xDC7F*/, 0x6C3F, 0x6C4D, 0x6C5B,
+ 0x6C6D, 0x6C84, 0x6C89, 0x3CC3, 0x6C94, 0x6C95, 0x6C97, 0x6CAD,
+ 0x6CC2, 0x6CD0, 0x3CD2, 0x6CD6, 0x6CDA, 0x6CDC, 0x6CE9, 0x6CEC,
+ 0x6CED, 0xD84F /*0xDD00*/, 0x6D00, 0x6D0A, 0x6D24, 0x6D26, 0x6D27, 0x6C67,
+ 0x6D2F, 0x6D3C, 0x6D5B, 0x6D5E, 0x6D60, 0x6D70, 0x6D80, 0x6D81,
+ 0x6D8A, 0x6D8D, 0x6D91, 0x6D98, 0xD84F /*0xDD40*/, 0x6E17, 0xD84F /*0xDDFA*/, 0xD84F /*0xDDF9*/,
+ 0xD84F /*0xDDD3*/, 0x6DAB, 0x6DAE, 0x6DB4, 0x6DC2, 0x6D34, 0x6DC8, 0x6DCE,
+ 0x6DCF, 0x6DD0, 0x6DDF, 0x6DE9, 0x6DF6, 0x6E36, 0x6E1E, 0x6E22,
+ 0x6E27, 0x3D11, 0x6E32, 0x6E3C, 0x6E48, 0x6E49, 0x6E4B, 0x6E4C,
+ 0x6E4F, 0x6E51, 0x6E53, 0x6E54, 0x6E57, 0x6E63, 0x3D1E,
+};
+static const unsigned short euc_to_utf8_8FEF_x0213[] = {
+ 0x6E93, 0x6EA7, 0x6EB4, 0x6EBF, 0x6EC3, 0x6ECA, 0x6ED9,
+ 0x6F35, 0x6EEB, 0x6EF9, 0x6EFB, 0x6F0A, 0x6F0C, 0x6F18, 0x6F25,
+ 0x6F36, 0x6F3C, 0xD84F /*0xDF7E*/, 0x6F52, 0x6F57, 0x6F5A, 0x6F60, 0x6F68,
+ 0x6F98, 0x6F7D, 0x6F90, 0x6F96, 0x6FBE, 0x6F9F, 0x6FA5, 0x6FAF,
+ 0x3D64, 0x6FB5, 0x6FC8, 0x6FC9, 0x6FDA, 0x6FDE, 0x6FE9, 0xD850 /*0xDC96*/,
+ 0x6FFC, 0x7000, 0x7007, 0x700A, 0x7023, 0xD850 /*0xDD03*/, 0x7039, 0x703A,
+ 0x703C, 0x7043, 0x7047, 0x704B, 0x3D9A, 0x7054, 0x7065, 0x7069,
+ 0x706C, 0x706E, 0x7076, 0x707E, 0x7081, 0x7086, 0x7095, 0x7097,
+ 0x70BB, 0xD850 /*0xDDC6*/, 0x709F, 0x70B1, 0xD850 /*0xDDFE*/, 0x70EC, 0x70CA, 0x70D1,
+ 0x70D3, 0x70DC, 0x7103, 0x7104, 0x7106, 0x7107, 0x7108, 0x710C,
+ 0x3DC0, 0x712F, 0x7131, 0x7150, 0x714A, 0x7153, 0x715E, 0x3DD4,
+ 0x7196, 0x7180, 0x719B, 0x71A0, 0x71A2, 0x71AE, 0x71AF,
+};
+static const unsigned short euc_to_utf8_8FF0_x0213[] = {
+ 0x71B3, 0xD850 /*0xDFBC*/, 0x71CB, 0x71D3, 0x71D9, 0x71DC, 0x7207,
+ 0x3E05, 0xFA49, 0x722B, 0x7234, 0x7238, 0x7239, 0x4E2C, 0x7242,
+ 0x7253, 0x7257, 0x7263, 0xD851 /*0xDE29*/, 0x726E, 0x726F, 0x7278, 0x727F,
+ 0x728E, 0xD851 /*0xDEA5*/, 0x72AD, 0x72AE, 0x72B0, 0x72B1, 0x72C1, 0x3E60,
+ 0x72CC, 0x3E66, 0x3E68, 0x72F3, 0x72FA, 0x7307, 0x7312, 0x7318,
+ 0x7319, 0x3E83, 0x7339, 0x732C, 0x7331, 0x7333, 0x733D, 0x7352,
+ 0x3E94, 0x736B, 0x736C, 0xD852 /*0xDC96*/, 0x736E, 0x736F, 0x7371, 0x7377,
+ 0x7381, 0x7385, 0x738A, 0x7394, 0x7398, 0x739C, 0x739E, 0x73A5,
+ 0x73A8, 0x73B5, 0x73B7, 0x73B9, 0x73BC, 0x73BF, 0x73C5, 0x73CB,
+ 0x73E1, 0x73E7, 0x73F9, 0x7413, 0x73FA, 0x7401, 0x7424, 0x7431,
+ 0x7439, 0x7453, 0x7440, 0x7443, 0x744D, 0x7452, 0x745D, 0x7471,
+ 0x7481, 0x7485, 0x7488, 0xD852 /*0xDE4D*/, 0x7492, 0x7497, 0x7499,
+};
+static const unsigned short euc_to_utf8_8FF1_x0213[] = {
+ 0x74A0, 0x74A1, 0x74A5, 0x74AA, 0x74AB, 0x74B9, 0x74BB,
+ 0x74BA, 0x74D6, 0x74D8, 0x74DE, 0x74EF, 0x74EB, 0xD852 /*0xDF56*/, 0x74FA,
+ 0xD852 /*0xDF6F*/, 0x7520, 0x7524, 0x752A, 0x3F57, 0xD853 /*0xDC16*/, 0x753D, 0x753E,
+ 0x7540, 0x7548, 0x754E, 0x7550, 0x7552, 0x756C, 0x7572, 0x7571,
+ 0x757A, 0x757D, 0x757E, 0x7581, 0xD853 /*0xDD14*/, 0x758C, 0x3F75, 0x75A2,
+ 0x3F77, 0x75B0, 0x75B7, 0x75BF, 0x75C0, 0x75C6, 0x75CF, 0x75D3,
+ 0x75DD, 0x75DF, 0x75E0, 0x75E7, 0x75EC, 0x75EE, 0x75F1, 0x75F9,
+ 0x7603, 0x7618, 0x7607, 0x760F, 0x3FAE, 0xD853 /*0xDE0E*/, 0x7613, 0x761B,
+ 0x761C, 0xD853 /*0xDE37*/, 0x7625, 0x7628, 0x763C, 0x7633, 0xD853 /*0xDE6A*/, 0x3FC9,
+ 0x7641, 0xD853 /*0xDE8B*/, 0x7649, 0x7655, 0x3FD7, 0x766E, 0x7695, 0x769C,
+ 0x76A1, 0x76A0, 0x76A7, 0x76A8, 0x76AF, 0xD854 /*0xDC4A*/, 0x76C9, 0xD854 /*0xDC55*/,
+ 0x76E8, 0x76EC, 0xD854 /*0xDD22*/, 0x7717, 0x771A, 0x772D, 0x7735,
+};
+static const unsigned short euc_to_utf8_8FF2_x0213[] = {
+ 0xD854 /*0xDDA9*/, 0x4039, 0xD854 /*0xDDE5*/, 0xD854 /*0xDDCD*/, 0x7758, 0x7760, 0x776A,
+ 0xD854 /*0xDE1E*/, 0x7772, 0x777C, 0x777D, 0xD854 /*0xDE4C*/, 0x4058, 0x779A, 0x779F,
+ 0x77A2, 0x77A4, 0x77A9, 0x77DE, 0x77DF, 0x77E4, 0x77E6, 0x77EA,
+ 0x77EC, 0x4093, 0x77F0, 0x77F4, 0x77FB, 0xD855 /*0xDC2E*/, 0x7805, 0x7806,
+ 0x7809, 0x780D, 0x7819, 0x7821, 0x782C, 0x7847, 0x7864, 0x786A,
+ 0xD855 /*0xDCD9*/, 0x788A, 0x7894, 0x78A4, 0x789D, 0x789E, 0x789F, 0x78BB,
+ 0x78C8, 0x78CC, 0x78CE, 0x78D5, 0x78E0, 0x78E1, 0x78E6, 0x78F9,
+ 0x78FA, 0x78FB, 0x78FE, 0xD855 /*0xDDA7*/, 0x7910, 0x791B, 0x7930, 0x7925,
+ 0x793B, 0x794A, 0x7958, 0x795B, 0x4105, 0x7967, 0x7972, 0x7994,
+ 0x7995, 0x7996, 0x799B, 0x79A1, 0x79A9, 0x79B4, 0x79BB, 0x79C2,
+ 0x79C7, 0x79CC, 0x79CD, 0x79D6, 0x4148, 0xD855 /*0xDFA9*/, 0xD855 /*0xDFB4*/, 0x414F,
+ 0x7A0A, 0x7A11, 0x7A15, 0x7A1B, 0x7A1E, 0x4163, 0x7A2D,
+};
+static const unsigned short euc_to_utf8_8FF3_x0213[] = {
+ 0x7A38, 0x7A47, 0x7A4C, 0x7A56, 0x7A59, 0x7A5C, 0x7A5F,
+ 0x7A60, 0x7A67, 0x7A6A, 0x7A75, 0x7A78, 0x7A82, 0x7A8A, 0x7A90,
+ 0x7AA3, 0x7AAC, 0xD856 /*0xDDD4*/, 0x41B4, 0x7AB9, 0x7ABC, 0x7ABE, 0x41BF,
+ 0x7ACC, 0x7AD1, 0x7AE7, 0x7AE8, 0x7AF4, 0xD856 /*0xDEE4*/, 0xD856 /*0xDEE3*/, 0x7B07,
+ 0xD856 /*0xDEF1*/, 0x7B3D, 0x7B27, 0x7B2A, 0x7B2E, 0x7B2F, 0x7B31, 0x41E6,
+ 0x41F3, 0x7B7F, 0x7B41, 0x41EE, 0x7B55, 0x7B79, 0x7B64, 0x7B66,
+ 0x7B69, 0x7B73, 0xD856 /*0xDFB2*/, 0x4207, 0x7B90, 0x7B91, 0x7B9B, 0x420E,
+ 0x7BAF, 0x7BB5, 0x7BBC, 0x7BC5, 0x7BCA, 0xD857 /*0xDC4B*/, 0xD857 /*0xDC64*/, 0x7BD4,
+ 0x7BD6, 0x7BDA, 0x7BEA, 0x7BF0, 0x7C03, 0x7C0B, 0x7C0E, 0x7C0F,
+ 0x7C26, 0x7C45, 0x7C4A, 0x7C51, 0x7C57, 0x7C5E, 0x7C61, 0x7C69,
+ 0x7C6E, 0x7C6F, 0x7C70, 0xD857 /*0xDE2E*/, 0xD857 /*0xDE56*/, 0xD857 /*0xDE65*/, 0x7CA6, 0xD857 /*0xDE62*/,
+ 0x7CB6, 0x7CB7, 0x7CBF, 0xD857 /*0xDED8*/, 0x7CC4, 0xD857 /*0xDEC2*/, 0x7CC8,
+};
+static const unsigned short euc_to_utf8_8FF4_x0213[] = {
+ 0x7CCD, 0xD857 /*0xDEE8*/, 0x7CD7, 0xD857 /*0xDF23*/, 0x7CE6, 0x7CEB, 0xD857 /*0xDF5C*/,
+ 0x7CF5, 0x7D03, 0x7D09, 0x42C6, 0x7D12, 0x7D1E, 0xD857 /*0xDFE0*/, 0xD857 /*0xDFD4*/,
+ 0x7D3D, 0x7D3E, 0x7D40, 0x7D47, 0xD858 /*0xDC0C*/, 0xD857 /*0xDFFB*/, 0x42D6, 0x7D59,
+ 0x7D5A, 0x7D6A, 0x7D70, 0x42DD, 0x7D7F, 0xD858 /*0xDC17*/, 0x7D86, 0x7D88,
+ 0x7D8C, 0x7D97, 0xD858 /*0xDC60*/, 0x7D9D, 0x7DA7, 0x7DAA, 0x7DB6, 0x7DB7,
+ 0x7DC0, 0x7DD7, 0x7DD9, 0x7DE6, 0x7DF1, 0x7DF9, 0x4302, 0xD858 /*0xDCED*/,
+ 0xFA58, 0x7E10, 0x7E17, 0x7E1D, 0x7E20, 0x7E27, 0x7E2C, 0x7E45,
+ 0x7E73, 0x7E75, 0x7E7E, 0x7E86, 0x7E87, 0x432B, 0x7E91, 0x7E98,
+ 0x7E9A, 0x4343, 0x7F3C, 0x7F3B, 0x7F3E, 0x7F43, 0x7F44, 0x7F4F,
+ 0x34C1, 0xD858 /*0xDE70*/, 0x7F52, 0xD858 /*0xDE86*/, 0x7F61, 0x7F63, 0x7F64, 0x7F6D,
+ 0x7F7D, 0x7F7E, 0xD858 /*0xDF4C*/, 0x7F90, 0x517B, 0xD84F /*0xDD0E*/, 0x7F96, 0x7F9C,
+ 0x7FAD, 0xD859 /*0xDC02*/, 0x7FC3, 0x7FCF, 0x7FE3, 0x7FE5, 0x7FEF,
+};
+static const unsigned short euc_to_utf8_8FF5_x0213[] = {
+ 0x7FF2, 0x8002, 0x800A, 0x8008, 0x800E, 0x8011, 0x8016,
+ 0x8024, 0x802C, 0x8030, 0x8043, 0x8066, 0x8071, 0x8075, 0x807B,
+ 0x8099, 0x809C, 0x80A4, 0x80A7, 0x80B8, 0xD859 /*0xDE7E*/, 0x80C5, 0x80D5,
+ 0x80D8, 0x80E6, 0xD859 /*0xDEB0*/, 0x810D, 0x80F5, 0x80FB, 0x43EE, 0x8135,
+ 0x8116, 0x811E, 0x43F0, 0x8124, 0x8127, 0x812C, 0xD859 /*0xDF1D*/, 0x813D,
+ 0x4408, 0x8169, 0x4417, 0x8181, 0x441C, 0x8184, 0x8185, 0x4422,
+ 0x8198, 0x81B2, 0x81C1, 0x81C3, 0x81D6, 0x81DB, 0xD85A /*0xDCDD*/, 0x81E4,
+ 0xD85A /*0xDCEA*/, 0x81EC, 0xD85A /*0xDD51*/, 0x81FD, 0x81FF, 0xD85A /*0xDD6F*/, 0x8204, 0xD85A /*0xDDDD*/,
+ 0x8219, 0x8221, 0x8222, 0xD85A /*0xDE1E*/, 0x8232, 0x8234, 0x823C, 0x8246,
+ 0x8249, 0x8245, 0xD85A /*0xDE58*/, 0x824B, 0x4476, 0x824F, 0x447A, 0x8257,
+ 0xD85A /*0xDE8C*/, 0x825C, 0x8263, 0xD85A /*0xDEB7*/, 0xFA5D, 0xFA5E, 0x8279, 0x4491,
+ 0x827D, 0x827F, 0x8283, 0x828A, 0x8293, 0x82A7, 0x82A8,
+};
+static const unsigned short euc_to_utf8_8FF6_x0213[] = {
+ 0x82B2, 0x82B4, 0x82BA, 0x82BC, 0x82E2, 0x82E8, 0x82F7,
+ 0x8307, 0x8308, 0x830C, 0x8354, 0x831B, 0x831D, 0x8330, 0x833C,
+ 0x8344, 0x8357, 0x44BE, 0x837F, 0x44D4, 0x44B3, 0x838D, 0x8394,
+ 0x8395, 0x839B, 0x839D, 0x83C9, 0x83D0, 0x83D4, 0x83DD, 0x83E5,
+ 0x83F9, 0x840F, 0x8411, 0x8415, 0xD85B /*0xDC73*/, 0x8417, 0x8439, 0x844A,
+ 0x844F, 0x8451, 0x8452, 0x8459, 0x845A, 0x845C, 0xD85B /*0xDCDD*/, 0x8465,
+ 0x8476, 0x8478, 0x847C, 0x8481, 0x450D, 0x84DC, 0x8497, 0x84A6,
+ 0x84BE, 0x4508, 0x84CE, 0x84CF, 0x84D3, 0xD85B /*0xDE65*/, 0x84E7, 0x84EA,
+ 0x84EF, 0x84F0, 0x84F1, 0x84FA, 0x84FD, 0x850C, 0x851B, 0x8524,
+ 0x8525, 0x852B, 0x8534, 0x854F, 0x856F, 0x4525, 0x4543, 0x853E,
+ 0x8551, 0x8553, 0x855E, 0x8561, 0x8562, 0xD85B /*0xDF94*/, 0x857B, 0x857D,
+ 0x857F, 0x8581, 0x8586, 0x8593, 0x859D, 0x859F, 0xD85B /*0xDFF8*/,
+};
+static const unsigned short euc_to_utf8_8FF7_x0213[] = {
+ 0xD85B /*0xDFF6*/, 0xD85B /*0xDFF7*/, 0x85B7, 0x85BC, 0x85C7, 0x85CA, 0x85D8,
+ 0x85D9, 0x85DF, 0x85E1, 0x85E6, 0x85F6, 0x8600, 0x8611, 0x861E,
+ 0x8621, 0x8624, 0x8627, 0xD85C /*0xDD0D*/, 0x8639, 0x863C, 0xD85C /*0xDD39*/, 0x8640,
+ 0xFA20, 0x8653, 0x8656, 0x866F, 0x8677, 0x867A, 0x8687, 0x8689,
+ 0x868D, 0x8691, 0x869C, 0x869D, 0x86A8, 0xFA21, 0x86B1, 0x86B3,
+ 0x86C1, 0x86C3, 0x86D1, 0x86D5, 0x86D7, 0x86E3, 0x86E6, 0x45B8,
+ 0x8705, 0x8707, 0x870E, 0x8710, 0x8713, 0x8719, 0x871F, 0x8721,
+ 0x8723, 0x8731, 0x873A, 0x873E, 0x8740, 0x8743, 0x8751, 0x8758,
+ 0x8764, 0x8765, 0x8772, 0x877C, 0xD85C /*0xDFDB*/, 0xD85C /*0xDFDA*/, 0x87A7, 0x8789,
+ 0x878B, 0x8793, 0x87A0, 0xD85C /*0xDFFE*/, 0x45E5, 0x87BE, 0xD85D /*0xDC10*/, 0x87C1,
+ 0x87CE, 0x87F5, 0x87DF, 0xD85D /*0xDC49*/, 0x87E3, 0x87E5, 0x87E6, 0x87EA,
+ 0x87EB, 0x87ED, 0x8801, 0x8803, 0x880B, 0x8813, 0x8828,
+};
+static const unsigned short euc_to_utf8_8FF8_x0213[] = {
+ 0x882E, 0x8832, 0x883C, 0x460F, 0x884A, 0x8858, 0x885F,
+ 0x8864, 0xD85D /*0xDE15*/, 0xD85D /*0xDE14*/, 0x8869, 0xD85D /*0xDE31*/, 0x886F, 0x88A0, 0x88BC,
+ 0x88BD, 0x88BE, 0x88C0, 0x88D2, 0xD85D /*0xDE93*/, 0x88D1, 0x88D3, 0x88DB,
+ 0x88F0, 0x88F1, 0x4641, 0x8901, 0xD85D /*0xDF0E*/, 0x8937, 0xD85D /*0xDF23*/, 0x8942,
+ 0x8945, 0x8949, 0xD85D /*0xDF52*/, 0x4665, 0x8962, 0x8980, 0x8989, 0x8990,
+ 0x899F, 0x89B0, 0x89B7, 0x89D6, 0x89D8, 0x89EB, 0x46A1, 0x89F1,
+ 0x89F3, 0x89FD, 0x89FF, 0x46AF, 0x8A11, 0x8A14, 0xD85E /*0xDD85*/, 0x8A21,
+ 0x8A35, 0x8A3E, 0x8A45, 0x8A4D, 0x8A58, 0x8AAE, 0x8A90, 0x8AB7,
+ 0x8ABE, 0x8AD7, 0x8AFC, 0xD85E /*0xDE84*/, 0x8B0A, 0x8B05, 0x8B0D, 0x8B1C,
+ 0x8B1F, 0x8B2D, 0x8B43, 0x470C, 0x8B51, 0x8B5E, 0x8B76, 0x8B7F,
+ 0x8B81, 0x8B8B, 0x8B94, 0x8B95, 0x8B9C, 0x8B9E, 0x8C39, 0xD85E /*0xDFB3*/,
+ 0x8C3D, 0xD85E /*0xDFBE*/, 0xD85E /*0xDFC7*/, 0x8C45, 0x8C47, 0x8C4F, 0x8C54,
+};
+static const unsigned short euc_to_utf8_8FF9_x0213[] = {
+ 0x8C57, 0x8C69, 0x8C6D, 0x8C73, 0xD85F /*0xDCB8*/, 0x8C93, 0x8C92,
+ 0x8C99, 0x4764, 0x8C9B, 0x8CA4, 0x8CD6, 0x8CD5, 0x8CD9, 0xD85F /*0xDDA0*/,
+ 0x8CF0, 0x8CF1, 0xD85F /*0xDE10*/, 0x8D09, 0x8D0E, 0x8D6C, 0x8D84, 0x8D95,
+ 0x8DA6, 0xD85F /*0xDFB7*/, 0x8DC6, 0x8DC8, 0x8DD9, 0x8DEC, 0x8E0C, 0x47FD,
+ 0x8DFD, 0x8E06, 0xD860 /*0xDC8A*/, 0x8E14, 0x8E16, 0x8E21, 0x8E22, 0x8E27,
+ 0xD860 /*0xDCBB*/, 0x4816, 0x8E36, 0x8E39, 0x8E4B, 0x8E54, 0x8E62, 0x8E6C,
+ 0x8E6D, 0x8E6F, 0x8E98, 0x8E9E, 0x8EAE, 0x8EB3, 0x8EB5, 0x8EB6,
+ 0x8EBB, 0xD860 /*0xDE82*/, 0x8ED1, 0x8ED4, 0x484E, 0x8EF9, 0xD860 /*0xDEF3*/, 0x8F00,
+ 0x8F08, 0x8F17, 0x8F2B, 0x8F40, 0x8F4A, 0x8F58, 0xD861 /*0xDC0C*/, 0x8FA4,
+ 0x8FB4, 0xFA66, 0x8FB6, 0xD861 /*0xDC55*/, 0x8FC1, 0x8FC6, 0xFA24, 0x8FCA,
+ 0x8FCD, 0x8FD3, 0x8FD5, 0x8FE0, 0x8FF1, 0x8FF5, 0x8FFB, 0x9002,
+ 0x900C, 0x9037, 0xD861 /*0xDD6B*/, 0x9043, 0x9044, 0x905D, 0xD861 /*0xDDC8*/,
+};
+static const unsigned short euc_to_utf8_8FFA_x0213[] = {
+ 0xD861 /*0xDDC9*/, 0x9085, 0x908C, 0x9090, 0x961D, 0x90A1, 0x48B5,
+ 0x90B0, 0x90B6, 0x90C3, 0x90C8, 0xD861 /*0xDED7*/, 0x90DC, 0x90DF, 0xD861 /*0xDEFA*/,
+ 0x90F6, 0x90F2, 0x9100, 0x90EB, 0x90FE, 0x90FF, 0x9104, 0x9106,
+ 0x9118, 0x911C, 0x911E, 0x9137, 0x9139, 0x913A, 0x9146, 0x9147,
+ 0x9157, 0x9159, 0x9161, 0x9164, 0x9174, 0x9179, 0x9185, 0x918E,
+ 0x91A8, 0x91AE, 0x91B3, 0x91B6, 0x91C3, 0x91C4, 0x91DA, 0xD862 /*0xDD49*/,
+ 0xD862 /*0xDD46*/, 0x91EC, 0x91EE, 0x9201, 0x920A, 0x9216, 0x9217, 0xD862 /*0xDD6B*/,
+ 0x9233, 0x9242, 0x9247, 0x924A, 0x924E, 0x9251, 0x9256, 0x9259,
+ 0x9260, 0x9261, 0x9265, 0x9267, 0x9268, 0xD862 /*0xDD87*/, 0xD862 /*0xDD88*/, 0x927C,
+ 0x927D, 0x927F, 0x9289, 0x928D, 0x9297, 0x9299, 0x929F, 0x92A7,
+ 0x92AB, 0xD862 /*0xDDBA*/, 0xD862 /*0xDDBB*/, 0x92B2, 0x92BF, 0x92C0, 0x92C6, 0x92CE,
+ 0x92D0, 0x92D7, 0x92D9, 0x92E5, 0x92E7, 0x9311, 0xD862 /*0xDE1E*/,
+};
+static const unsigned short euc_to_utf8_8FFB_x0213[] = {
+ 0xD862 /*0xDE29*/, 0x92F7, 0x92F9, 0x92FB, 0x9302, 0x930D, 0x9315,
+ 0x931D, 0x931E, 0x9327, 0x9329, 0xD862 /*0xDE71*/, 0xD862 /*0xDE43*/, 0x9347, 0x9351,
+ 0x9357, 0x935A, 0x936B, 0x9371, 0x9373, 0x93A1, 0xD862 /*0xDE99*/, 0xD862 /*0xDECD*/,
+ 0x9388, 0x938B, 0x938F, 0x939E, 0x93F5, 0xD862 /*0xDEE4*/, 0xD862 /*0xDEDD*/, 0x93F1,
+ 0x93C1, 0x93C7, 0x93DC, 0x93E2, 0x93E7, 0x9409, 0x940F, 0x9416,
+ 0x9417, 0x93FB, 0x9432, 0x9434, 0x943B, 0x9445, 0xD862 /*0xDFC1*/, 0xD862 /*0xDFEF*/,
+ 0x946D, 0x946F, 0x9578, 0x9579, 0x9586, 0x958C, 0x958D, 0xD863 /*0xDD10*/,
+ 0x95AB, 0x95B4, 0xD863 /*0xDD71*/, 0x95C8, 0xD863 /*0xDDFB*/, 0xD863 /*0xDE1F*/, 0x962C, 0x9633,
+ 0x9634, 0xD863 /*0xDE36*/, 0x963C, 0x9641, 0x9661, 0xD863 /*0xDE89*/, 0x9682, 0xD863 /*0xDEEB*/,
+ 0x969A, 0xD863 /*0xDF32*/, 0x49E7, 0x96A9, 0x96AF, 0x96B3, 0x96BA, 0x96BD,
+ 0x49FA, 0xD863 /*0xDFF8*/, 0x96D8, 0x96DA, 0x96DD, 0x4A04, 0x9714, 0x9723,
+ 0x4A29, 0x9736, 0x9741, 0x9747, 0x9755, 0x9757, 0x975B,
+};
+static const unsigned short euc_to_utf8_8FFC_x0213[] = {
+ 0x976A, 0xD864 /*0xDEA0*/, 0xD864 /*0xDEB1*/, 0x9796, 0x979A, 0x979E, 0x97A2,
+ 0x97B1, 0x97B2, 0x97BE, 0x97CC, 0x97D1, 0x97D4, 0x97D8, 0x97D9,
+ 0x97E1, 0x97F1, 0x9804, 0x980D, 0x980E, 0x9814, 0x9816, 0x4ABC,
+ 0xD865 /*0xDC90*/, 0x9823, 0x9832, 0x9833, 0x9825, 0x9847, 0x9866, 0x98AB,
+ 0x98AD, 0x98B0, 0xD865 /*0xDDCF*/, 0x98B7, 0x98B8, 0x98BB, 0x98BC, 0x98BF,
+ 0x98C2, 0x98C7, 0x98CB, 0x98E0, 0xD865 /*0xDE7F*/, 0x98E1, 0x98E3, 0x98E5,
+ 0x98EA, 0x98F0, 0x98F1, 0x98F3, 0x9908, 0x4B3B, 0xD865 /*0xDEF0*/, 0x9916,
+ 0x9917, 0xD865 /*0xDF19*/, 0x991A, 0x991B, 0x991C, 0xD865 /*0xDF50*/, 0x9931, 0x9932,
+ 0x9933, 0x993A, 0x993B, 0x993C, 0x9940, 0x9941, 0x9946, 0x994D,
+ 0x994E, 0x995C, 0x995F, 0x9960, 0x99A3, 0x99A6, 0x99B9, 0x99BD,
+ 0x99BF, 0x99C3, 0x99C9, 0x99D4, 0x99D9, 0x99DE, 0xD866 /*0xDCC6*/, 0x99F0,
+ 0x99F9, 0x99FC, 0x9A0A, 0x9A11, 0x9A16, 0x9A1A, 0x9A20,
+};
+static const unsigned short euc_to_utf8_8FFD_x0213[] = {
+ 0x9A31, 0x9A36, 0x9A44, 0x9A4C, 0x9A58, 0x4BC2, 0x9AAF,
+ 0x4BCA, 0x9AB7, 0x4BD2, 0x9AB9, 0xD866 /*0xDE72*/, 0x9AC6, 0x9AD0, 0x9AD2,
+ 0x9AD5, 0x4BE8, 0x9ADC, 0x9AE0, 0x9AE5, 0x9AE9, 0x9B03, 0x9B0C,
+ 0x9B10, 0x9B12, 0x9B16, 0x9B1C, 0x9B2B, 0x9B33, 0x9B3D, 0x4C20,
+ 0x9B4B, 0x9B63, 0x9B65, 0x9B6B, 0x9B6C, 0x9B73, 0x9B76, 0x9B77,
+ 0x9BA6, 0x9BAC, 0x9BB1, 0xD867 /*0xDDDB*/, 0xD867 /*0xDE3D*/, 0x9BB2, 0x9BB8, 0x9BBE,
+ 0x9BC7, 0x9BF3, 0x9BD8, 0x9BDD, 0x9BE7, 0x9BEA, 0x9BEB, 0x9BEF,
+ 0x9BEE, 0xD867 /*0xDE15*/, 0x9BFA, 0xD867 /*0xDE8A*/, 0x9BF7, 0xD867 /*0xDE49*/, 0x9C16, 0x9C18,
+ 0x9C19, 0x9C1A, 0x9C1D, 0x9C22, 0x9C27, 0x9C29, 0x9C2A, 0xD867 /*0xDEC4*/,
+ 0x9C31, 0x9C36, 0x9C37, 0x9C45, 0x9C5C, 0xD867 /*0xDEE9*/, 0x9C49, 0x9C4A,
+ 0xD867 /*0xDEDB*/, 0x9C54, 0x9C58, 0x9C5B, 0x9C5D, 0x9C5F, 0x9C69, 0x9C6A,
+ 0x9C6B, 0x9C6D, 0x9C6E, 0x9C70, 0x9C72, 0x9C75, 0x9C7A,
+};
+static const unsigned short euc_to_utf8_8FFE_x0213[] = {
+ 0x9CE6, 0x9CF2, 0x9D0B, 0x9D02, 0xD867 /*0xDFCE*/, 0x9D11, 0x9D17,
+ 0x9D18, 0xD868 /*0xDC2F*/, 0x4CC4, 0xD868 /*0xDC1A*/, 0x9D32, 0x4CD1, 0x9D42, 0x9D4A,
+ 0x9D5F, 0x9D62, 0xD868 /*0xDCF9*/, 0x9D69, 0x9D6B, 0xD868 /*0xDC82*/, 0x9D73, 0x9D76,
+ 0x9D77, 0x9D7E, 0x9D84, 0x9D8D, 0x9D99, 0x9DA1, 0x9DBF, 0x9DB5,
+ 0x9DB9, 0x9DBD, 0x9DC3, 0x9DC7, 0x9DC9, 0x9DD6, 0x9DDA, 0x9DDF,
+ 0x9DE0, 0x9DE3, 0x9DF4, 0x4D07, 0x9E0A, 0x9E02, 0x9E0D, 0x9E19,
+ 0x9E1C, 0x9E1D, 0x9E7B, 0xD848 /*0xDE18*/, 0x9E80, 0x9E85, 0x9E9B, 0x9EA8,
+ 0xD868 /*0xDF8C*/, 0x9EBD, 0xD869 /*0xDC37*/, 0x9EDF, 0x9EE7, 0x9EEE, 0x9EFF, 0x9F02,
+ 0x4D77, 0x9F03, 0x9F17, 0x9F19, 0x9F2F, 0x9F37, 0x9F3A, 0x9F3D,
+ 0x9F41, 0x9F45, 0x9F46, 0x9F53, 0x9F55, 0x9F58, 0xD869 /*0xDDF1*/, 0x9F5D,
+ 0xD869 /*0xDE02*/, 0x9F69, 0xD869 /*0xDE1A*/, 0x9F6D, 0x9F70, 0x9F75, 0xD869 /*0xDEB2*/, 0,
+ 0, 0, 0, 0, 0, 0, 0,
+};
#ifdef X0212_ENABLE
static const unsigned short euc_to_utf8_8FA2[] = {
@@ -2408,6 +3136,32 @@ const unsigned short *const euc_to_utf8_2bytes_mac[] = {
0, euc_to_utf8_F9, euc_to_utf8_FA, euc_to_utf8_FB,
euc_to_utf8_FC_ms, 0, 0,
};
+const unsigned short *const euc_to_utf8_2bytes_x0213[] = {
+ euc_to_utf8_A1, euc_to_utf8_A2_x0213, euc_to_utf8_A3_x0213,
+ euc_to_utf8_A4_x0213, euc_to_utf8_A5_x0213, euc_to_utf8_A6_x0213, euc_to_utf8_A7_x0213,
+ euc_to_utf8_A8_x0213, euc_to_utf8_A9_x0213, euc_to_utf8_AA_x0213, euc_to_utf8_AB_x0213,
+ euc_to_utf8_AC_x0213, euc_to_utf8_AD_x0213, euc_to_utf8_AE_x0213, euc_to_utf8_AF_x0213,
+ euc_to_utf8_B0, euc_to_utf8_B1, euc_to_utf8_B2, euc_to_utf8_B3,
+ euc_to_utf8_B4, euc_to_utf8_B5, euc_to_utf8_B6, euc_to_utf8_B7,
+ euc_to_utf8_B8, euc_to_utf8_B9, euc_to_utf8_BA, euc_to_utf8_BB,
+ euc_to_utf8_BC, euc_to_utf8_BD, euc_to_utf8_BE, euc_to_utf8_BF,
+ euc_to_utf8_C0, euc_to_utf8_C1, euc_to_utf8_C2, euc_to_utf8_C3,
+ euc_to_utf8_C4, euc_to_utf8_C5, euc_to_utf8_C6, euc_to_utf8_C7,
+ euc_to_utf8_C8, euc_to_utf8_C9, euc_to_utf8_CA, euc_to_utf8_CB,
+ euc_to_utf8_CC, euc_to_utf8_CD, euc_to_utf8_CE, euc_to_utf8_CF_x0213,
+ euc_to_utf8_D0, euc_to_utf8_D1, euc_to_utf8_D2, euc_to_utf8_D3,
+ euc_to_utf8_D4, euc_to_utf8_D5, euc_to_utf8_D6, euc_to_utf8_D7,
+ euc_to_utf8_D8, euc_to_utf8_D9, euc_to_utf8_DA, euc_to_utf8_DB,
+ euc_to_utf8_DC, euc_to_utf8_DD, euc_to_utf8_DE, euc_to_utf8_DF,
+ euc_to_utf8_E0, euc_to_utf8_E1, euc_to_utf8_E2, euc_to_utf8_E3,
+ euc_to_utf8_E4, euc_to_utf8_E5, euc_to_utf8_E6, euc_to_utf8_E7,
+ euc_to_utf8_E8, euc_to_utf8_E9, euc_to_utf8_EA, euc_to_utf8_EB,
+ euc_to_utf8_EC, euc_to_utf8_ED, euc_to_utf8_EE, euc_to_utf8_EF,
+ euc_to_utf8_F0, euc_to_utf8_F1, euc_to_utf8_F2, euc_to_utf8_F3,
+ euc_to_utf8_F4_x0213, euc_to_utf8_F5_x0213, euc_to_utf8_F6_x0213, euc_to_utf8_F7_x0213,
+ euc_to_utf8_F8_x0213, euc_to_utf8_F9_x0213, euc_to_utf8_FA_x0213, euc_to_utf8_FB_x0213,
+ euc_to_utf8_FC_x0213, euc_to_utf8_FD_x0213, euc_to_utf8_FE_x0213,
+};
#ifdef X0212_ENABLE
const unsigned short *const x0212_to_utf8_2bytes[] = {
@@ -2435,7 +3189,371 @@ const unsigned short *const x0212_to_utf8_2bytes[] = {
euc_to_utf8_8FF4, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0,};
+
+const unsigned short *const x0212_to_utf8_2bytes_x0213[] = {
+ euc_to_utf8_8FA1_x0213, euc_to_utf8_8FA2, euc_to_utf8_8FA3_x0213,
+ euc_to_utf8_8FA4_x0213, euc_to_utf8_8FA5_x0213, euc_to_utf8_8FA6, euc_to_utf8_8FA7,
+ euc_to_utf8_8FA8_x0213, euc_to_utf8_8FA9, euc_to_utf8_8FAA, euc_to_utf8_8FAB,
+ euc_to_utf8_8FAC_x0213, euc_to_utf8_8FAD_x0213, euc_to_utf8_8FAE_x0213, euc_to_utf8_8FAF_x0213,
+ euc_to_utf8_8FB0, euc_to_utf8_8FB1, euc_to_utf8_8FB2, euc_to_utf8_8FB3,
+ euc_to_utf8_8FB4, euc_to_utf8_8FB5, euc_to_utf8_8FB6, euc_to_utf8_8FB7,
+ euc_to_utf8_8FB8, euc_to_utf8_8FB9, euc_to_utf8_8FBA, euc_to_utf8_8FBB,
+ euc_to_utf8_8FBC, euc_to_utf8_8FBD, euc_to_utf8_8FBE, euc_to_utf8_8FBF,
+ euc_to_utf8_8FC0, euc_to_utf8_8FC1, euc_to_utf8_8FC2, euc_to_utf8_8FC3,
+ euc_to_utf8_8FC4, euc_to_utf8_8FC5, euc_to_utf8_8FC6, euc_to_utf8_8FC7,
+ euc_to_utf8_8FC8, euc_to_utf8_8FC9, euc_to_utf8_8FCA, euc_to_utf8_8FCB,
+ euc_to_utf8_8FCC, euc_to_utf8_8FCD, euc_to_utf8_8FCE, euc_to_utf8_8FCF,
+ euc_to_utf8_8FD0, euc_to_utf8_8FD1, euc_to_utf8_8FD2, euc_to_utf8_8FD3,
+ euc_to_utf8_8FD4, euc_to_utf8_8FD5, euc_to_utf8_8FD6, euc_to_utf8_8FD7,
+ euc_to_utf8_8FD8, euc_to_utf8_8FD9, euc_to_utf8_8FDA, euc_to_utf8_8FDB,
+ euc_to_utf8_8FDC, euc_to_utf8_8FDD, euc_to_utf8_8FDE, euc_to_utf8_8FDF,
+ euc_to_utf8_8FE0, euc_to_utf8_8FE1, euc_to_utf8_8FE2, euc_to_utf8_8FE3,
+ euc_to_utf8_8FE4, euc_to_utf8_8FE5, euc_to_utf8_8FE6, euc_to_utf8_8FE7,
+ euc_to_utf8_8FE8, euc_to_utf8_8FE9, euc_to_utf8_8FEA, euc_to_utf8_8FEB,
+ euc_to_utf8_8FEC, euc_to_utf8_8FED, euc_to_utf8_8FEE_x0213, euc_to_utf8_8FEF_x0213,
+ euc_to_utf8_8FF0_x0213, euc_to_utf8_8FF1_x0213, euc_to_utf8_8FF2_x0213, euc_to_utf8_8FF3_x0213,
+ euc_to_utf8_8FF4_x0213, euc_to_utf8_8FF5_x0213, euc_to_utf8_8FF6_x0213, euc_to_utf8_8FF7_x0213,
+ euc_to_utf8_8FF8_x0213, euc_to_utf8_8FF9_x0213, euc_to_utf8_8FFA_x0213, euc_to_utf8_8FFB_x0213,
+ euc_to_utf8_8FFC_x0213, euc_to_utf8_8FFD_x0213, euc_to_utf8_8FFE_x0213,};
#endif /* X0212_ENABLE */
+
+const unsigned short x0213_combining_chars[sizeof_x0213_combining_chars] = {
+ 0x309A, 0x0300, 0x0301, 0x02E5, 0x02E9,
+};
+const unsigned short x0213_combining_table[sizeof_x0213_combining_table][3] = {
+ {0x2477, 0x304B, 0x309A},
+ {0x2478, 0x304D, 0x309A},
+ {0x2479, 0x304F, 0x309A},
+ {0x247A, 0x3051, 0x309A},
+ {0x247B, 0x3053, 0x309A},
+ {0x2577, 0x30AB, 0x309A},
+ {0x2578, 0x30AD, 0x309A},
+ {0x2579, 0x30AF, 0x309A},
+ {0x257A, 0x30B1, 0x309A},
+ {0x257B, 0x30B3, 0x309A},
+ {0x257C, 0x30BB, 0x309A},
+ {0x257D, 0x30C4, 0x309A},
+ {0x257E, 0x30C8, 0x309A},
+ {0x2678, 0x31F7, 0x309A},
+ {0x2B44, 0x00E6, 0x0300},
+ {0x2B48, 0x0254, 0x0300},
+ {0x2B49, 0x0254, 0x0301},
+ {0x2B4A, 0x028C, 0x0300},
+ {0x2B4B, 0x028C, 0x0301},
+ {0x2B4C, 0x0259, 0x0300},
+ {0x2B4D, 0x0259, 0x0301},
+ {0x2B4E, 0x025A, 0x0300},
+ {0x2B4F, 0x025A, 0x0301},
+ {0x2B65, 0x02E9, 0x02E5},
+ {0x2B66, 0x02E5, 0x02E9},
+};
+const unsigned short x0213_1_surrogate_table[sizeof_x0213_1_surrogate_table][3] = {
+ {0x2E22, 0xD840, 0xDC0B},
+ {0x2F42, 0xD844, 0xDE3D},
+ {0x2F4C, 0xD844, 0xDF1B},
+ {0x2F60, 0xD845, 0xDC6E},
+ {0x2F7B, 0xD846, 0xDCBD},
+ {0x4F54, 0xD842, 0xDF9F},
+ {0x4F63, 0xD845, 0xDEB4},
+ {0x4F6E, 0xD847, 0xDE34},
+ {0x753A, 0xD84C, 0xDDC4},
+ {0x7572, 0xD84D, 0xDDC4},
+ {0x7629, 0xD84D, 0xDF3F},
+ {0x7632, 0xD84D, 0xDF63},
+ {0x7660, 0xD84F, 0xDCFE},
+ {0x776C, 0xD851, 0xDFF1},
+ {0x787E, 0xD855, 0xDC8E},
+ {0x7929, 0xD855, 0xDD0E},
+ {0x7947, 0xD855, 0xDF71},
+ {0x7954, 0xD856, 0xDDC4},
+ {0x796E, 0xD857, 0xDDA1},
+ {0x7A5D, 0xD85A, 0xDEFF},
+ {0x7B33, 0xD85B, 0xDE40},
+ {0x7B49, 0xD85C, 0xDCF4},
+ {0x7B6C, 0xD85D, 0xDE84},
+ {0x7C49, 0xD860, 0xDE77},
+ {0x7C51, 0xD860, 0xDFCD},
+ {0x7E66, 0xD868, 0xDD90},
+};
+const unsigned short x0213_2_surrogate_table[sizeof_x0213_2_surrogate_table][3] = {
+ {0x2121, 0xD840, 0xDC89},
+ {0x212B, 0xD840, 0xDCA2},
+ {0x212E, 0xD840, 0xDCA4},
+ {0x2136, 0xD840, 0xDDA2},
+ {0x2146, 0xD840, 0xDE13},
+ {0x2170, 0xD840, 0xDF2B},
+ {0x2177, 0xD840, 0xDF81},
+ {0x2179, 0xD840, 0xDF71},
+ {0x2322, 0xD840, 0xDFF9},
+ {0x2325, 0xD841, 0xDC4A},
+ {0x2327, 0xD841, 0xDD09},
+ {0x2331, 0xD841, 0xDDD6},
+ {0x2332, 0xD841, 0xDE28},
+ {0x2338, 0xD841, 0xDF4F},
+ {0x233F, 0xD842, 0xDC07},
+ {0x2341, 0xD842, 0xDC3A},
+ {0x234A, 0xD842, 0xDCB9},
+ {0x2352, 0xD842, 0xDD7C},
+ {0x2353, 0xD842, 0xDD9D},
+ {0x2359, 0xD842, 0xDED3},
+ {0x235C, 0xD842, 0xDF1D},
+ {0x2377, 0xD843, 0xDD45},
+ {0x242A, 0xD843, 0xDDE1},
+ {0x2431, 0xD843, 0xDE95},
+ {0x2432, 0xD843, 0xDE6D},
+ {0x243A, 0xD843, 0xDE64},
+ {0x243D, 0xD843, 0xDF5F},
+ {0x2459, 0xD844, 0xDE01},
+ {0x245C, 0xD844, 0xDE55},
+ {0x245E, 0xD844, 0xDE7B},
+ {0x2463, 0xD844, 0xDE74},
+ {0x246A, 0xD844, 0xDEE4},
+ {0x246B, 0xD844, 0xDED7},
+ {0x2472, 0xD844, 0xDEFD},
+ {0x2474, 0xD844, 0xDF36},
+ {0x2475, 0xD844, 0xDF44},
+ {0x2525, 0xD844, 0xDFC4},
+ {0x2532, 0xD845, 0xDC6D},
+ {0x253E, 0xD845, 0xDDD7},
+ {0x2544, 0xD85B, 0xDC29},
+ {0x2547, 0xD845, 0xDE47},
+ {0x2555, 0xD845, 0xDF06},
+ {0x2556, 0xD845, 0xDF42},
+ {0x257E, 0xD846, 0xDDC3},
+ {0x2830, 0xD847, 0xDC56},
+ {0x2837, 0xD847, 0xDD2D},
+ {0x2838, 0xD847, 0xDD45},
+ {0x283A, 0xD847, 0xDD78},
+ {0x283B, 0xD847, 0xDD62},
+ {0x283F, 0xD847, 0xDDA1},
+ {0x2840, 0xD847, 0xDD9C},
+ {0x2845, 0xD847, 0xDD92},
+ {0x2848, 0xD847, 0xDDB7},
+ {0x284A, 0xD847, 0xDDE0},
+ {0x284B, 0xD847, 0xDE33},
+ {0x285B, 0xD847, 0xDF1E},
+ {0x2866, 0xD847, 0xDF76},
+ {0x286C, 0xD847, 0xDFFA},
+ {0x2C22, 0xD848, 0xDD7B},
+ {0x2C2B, 0xD848, 0xDF1E},
+ {0x2C30, 0xD848, 0xDFAD},
+ {0x2C50, 0xD849, 0xDEF3},
+ {0x2C65, 0xD84A, 0xDC5B},
+ {0x2C6D, 0xD84A, 0xDCAB},
+ {0x2C72, 0xD84A, 0xDD8F},
+ {0x2D24, 0xD84A, 0xDEB8},
+ {0x2D29, 0xD84A, 0xDF4F},
+ {0x2D2A, 0xD84A, 0xDF50},
+ {0x2D32, 0xD84A, 0xDF46},
+ {0x2D34, 0xD84B, 0xDC1D},
+ {0x2D35, 0xD84A, 0xDFA6},
+ {0x2D39, 0xD84B, 0xDC24},
+ {0x2D56, 0xD84B, 0xDDE1},
+ {0x2D7D, 0xD84C, 0xDDC3},
+ {0x2E23, 0xD84C, 0xDDF5},
+ {0x2E24, 0xD84C, 0xDDB6},
+ {0x2E3A, 0xD84C, 0xDF72},
+ {0x2E3C, 0xD84C, 0xDFD3},
+ {0x2E3D, 0xD84C, 0xDFD2},
+ {0x2E42, 0xD84C, 0xDFD0},
+ {0x2E43, 0xD84C, 0xDFE4},
+ {0x2E44, 0xD84C, 0xDFD5},
+ {0x2E47, 0xD84C, 0xDFDA},
+ {0x2E49, 0xD84C, 0xDFDF},
+ {0x2E55, 0xD84D, 0xDC4A},
+ {0x2E56, 0xD84D, 0xDC51},
+ {0x2E57, 0xD84D, 0xDC4B},
+ {0x2E5B, 0xD84D, 0xDC65},
+ {0x2E77, 0xD84D, 0xDCE4},
+ {0x2E78, 0xD84D, 0xDD5A},
+ {0x2F2A, 0xD84D, 0xDD94},
+ {0x2F3F, 0xD84D, 0xDE39},
+ {0x2F40, 0xD84D, 0xDE47},
+ {0x2F42, 0xD84D, 0xDE38},
+ {0x2F43, 0xD84D, 0xDE3A},
+ {0x2F4E, 0xD84D, 0xDF1C},
+ {0x2F59, 0xD84D, 0xDF0C},
+ {0x2F61, 0xD84D, 0xDF64},
+ {0x2F69, 0xD84D, 0xDFFF},
+ {0x2F6A, 0xD84D, 0xDFE7},
+ {0x2F70, 0xD84E, 0xDC24},
+ {0x2F75, 0xD84E, 0xDC3D},
+ {0x6E23, 0xD84E, 0xDE98},
+ {0x6E34, 0xD84F, 0xDC7F},
+ {0x6E49, 0xD84F, 0xDD00},
+ {0x6E5C, 0xD84F, 0xDD40},
+ {0x6E5E, 0xD84F, 0xDDFA},
+ {0x6E5F, 0xD84F, 0xDDF9},
+ {0x6E60, 0xD84F, 0xDDD3},
+ {0x6F32, 0xD84F, 0xDF7E},
+ {0x6F47, 0xD850, 0xDC96},
+ {0x6F4D, 0xD850, 0xDD03},
+ {0x6F61, 0xD850, 0xDDC6},
+ {0x6F64, 0xD850, 0xDDFE},
+ {0x7022, 0xD850, 0xDFBC},
+ {0x7033, 0xD851, 0xDE29},
+ {0x7039, 0xD851, 0xDEA5},
+ {0x7053, 0xD852, 0xDC96},
+ {0x707B, 0xD852, 0xDE4D},
+ {0x712E, 0xD852, 0xDF56},
+ {0x7130, 0xD852, 0xDF6F},
+ {0x7135, 0xD853, 0xDC16},
+ {0x7144, 0xD853, 0xDD14},
+ {0x715D, 0xD853, 0xDE0E},
+ {0x7161, 0xD853, 0xDE37},
+ {0x7166, 0xD853, 0xDE6A},
+ {0x7169, 0xD853, 0xDE8B},
+ {0x7175, 0xD854, 0xDC4A},
+ {0x7177, 0xD854, 0xDC55},
+ {0x717A, 0xD854, 0xDD22},
+ {0x7221, 0xD854, 0xDDA9},
+ {0x7223, 0xD854, 0xDDE5},
+ {0x7224, 0xD854, 0xDDCD},
+ {0x7228, 0xD854, 0xDE1E},
+ {0x722C, 0xD854, 0xDE4C},
+ {0x723D, 0xD855, 0xDC2E},
+ {0x7248, 0xD855, 0xDCD9},
+ {0x725B, 0xD855, 0xDDA7},
+ {0x7275, 0xD855, 0xDFA9},
+ {0x7276, 0xD855, 0xDFB4},
+ {0x7332, 0xD856, 0xDDD4},
+ {0x733D, 0xD856, 0xDEE4},
+ {0x733E, 0xD856, 0xDEE3},
+ {0x7340, 0xD856, 0xDEF1},
+ {0x7352, 0xD856, 0xDFB2},
+ {0x735D, 0xD857, 0xDC4B},
+ {0x735E, 0xD857, 0xDC64},
+ {0x7373, 0xD857, 0xDE2E},
+ {0x7374, 0xD857, 0xDE56},
+ {0x7375, 0xD857, 0xDE65},
+ {0x7377, 0xD857, 0xDE62},
+ {0x737B, 0xD857, 0xDED8},
+ {0x737D, 0xD857, 0xDEC2},
+ {0x7422, 0xD857, 0xDEE8},
+ {0x7424, 0xD857, 0xDF23},
+ {0x7427, 0xD857, 0xDF5C},
+ {0x742E, 0xD857, 0xDFE0},
+ {0x742F, 0xD857, 0xDFD4},
+ {0x7434, 0xD858, 0xDC0C},
+ {0x7435, 0xD857, 0xDFFB},
+ {0x743D, 0xD858, 0xDC17},
+ {0x7442, 0xD858, 0xDC60},
+ {0x744F, 0xD858, 0xDCED},
+ {0x7469, 0xD858, 0xDE70},
+ {0x746B, 0xD858, 0xDE86},
+ {0x7472, 0xD858, 0xDF4C},
+ {0x7475, 0xD84F, 0xDD0E},
+ {0x7479, 0xD859, 0xDC02},
+ {0x7535, 0xD859, 0xDE7E},
+ {0x753A, 0xD859, 0xDEB0},
+ {0x7546, 0xD859, 0xDF1D},
+ {0x7556, 0xD85A, 0xDCDD},
+ {0x7558, 0xD85A, 0xDCEA},
+ {0x755A, 0xD85A, 0xDD51},
+ {0x755D, 0xD85A, 0xDD6F},
+ {0x755F, 0xD85A, 0xDDDD},
+ {0x7563, 0xD85A, 0xDE1E},
+ {0x756A, 0xD85A, 0xDE58},
+ {0x7570, 0xD85A, 0xDE8C},
+ {0x7573, 0xD85A, 0xDEB7},
+ {0x7644, 0xD85B, 0xDC73},
+ {0x764E, 0xD85B, 0xDCDD},
+ {0x765D, 0xD85B, 0xDE65},
+ {0x7675, 0xD85B, 0xDF94},
+ {0x767E, 0xD85B, 0xDFF8},
+ {0x7721, 0xD85B, 0xDFF6},
+ {0x7722, 0xD85B, 0xDFF7},
+ {0x7733, 0xD85C, 0xDD0D},
+ {0x7736, 0xD85C, 0xDD39},
+ {0x7764, 0xD85C, 0xDFDB},
+ {0x7765, 0xD85C, 0xDFDA},
+ {0x776B, 0xD85C, 0xDFFE},
+ {0x776E, 0xD85D, 0xDC10},
+ {0x7773, 0xD85D, 0xDC49},
+ {0x7829, 0xD85D, 0xDE15},
+ {0x782A, 0xD85D, 0xDE14},
+ {0x782C, 0xD85D, 0xDE31},
+ {0x7834, 0xD85D, 0xDE93},
+ {0x783C, 0xD85D, 0xDF0E},
+ {0x783E, 0xD85D, 0xDF23},
+ {0x7842, 0xD85D, 0xDF52},
+ {0x7856, 0xD85E, 0xDD85},
+ {0x7863, 0xD85E, 0xDE84},
+ {0x7877, 0xD85E, 0xDFB3},
+ {0x7879, 0xD85E, 0xDFBE},
+ {0x787A, 0xD85E, 0xDFC7},
+ {0x7925, 0xD85F, 0xDCB8},
+ {0x792F, 0xD85F, 0xDDA0},
+ {0x7932, 0xD85F, 0xDE10},
+ {0x7939, 0xD85F, 0xDFB7},
+ {0x7942, 0xD860, 0xDC8A},
+ {0x7948, 0xD860, 0xDCBB},
+ {0x7959, 0xD860, 0xDE82},
+ {0x795E, 0xD860, 0xDEF3},
+ {0x7966, 0xD861, 0xDC0C},
+ {0x796B, 0xD861, 0xDC55},
+ {0x797A, 0xD861, 0xDD6B},
+ {0x797E, 0xD861, 0xDDC8},
+ {0x7A21, 0xD861, 0xDDC9},
+ {0x7A2C, 0xD861, 0xDED7},
+ {0x7A2F, 0xD861, 0xDEFA},
+ {0x7A4F, 0xD862, 0xDD49},
+ {0x7A50, 0xD862, 0xDD46},
+ {0x7A57, 0xD862, 0xDD6B},
+ {0x7A65, 0xD862, 0xDD87},
+ {0x7A66, 0xD862, 0xDD88},
+ {0x7A71, 0xD862, 0xDDBA},
+ {0x7A72, 0xD862, 0xDDBB},
+ {0x7A7E, 0xD862, 0xDE1E},
+ {0x7B21, 0xD862, 0xDE29},
+ {0x7B2C, 0xD862, 0xDE71},
+ {0x7B2D, 0xD862, 0xDE43},
+ {0x7B36, 0xD862, 0xDE99},
+ {0x7B37, 0xD862, 0xDECD},
+ {0x7B3D, 0xD862, 0xDEE4},
+ {0x7B3E, 0xD862, 0xDEDD},
+ {0x7B4E, 0xD862, 0xDFC1},
+ {0x7B4F, 0xD862, 0xDFEF},
+ {0x7B57, 0xD863, 0xDD10},
+ {0x7B5A, 0xD863, 0xDD71},
+ {0x7B5C, 0xD863, 0xDDFB},
+ {0x7B5D, 0xD863, 0xDE1F},
+ {0x7B61, 0xD863, 0xDE36},
+ {0x7B65, 0xD863, 0xDE89},
+ {0x7B67, 0xD863, 0xDEEB},
+ {0x7B69, 0xD863, 0xDF32},
+ {0x7B71, 0xD863, 0xDFF8},
+ {0x7C22, 0xD864, 0xDEA0},
+ {0x7C23, 0xD864, 0xDEB1},
+ {0x7C38, 0xD865, 0xDC90},
+ {0x7C42, 0xD865, 0xDDCF},
+ {0x7C4C, 0xD865, 0xDE7F},
+ {0x7C56, 0xD865, 0xDEF0},
+ {0x7C59, 0xD865, 0xDF19},
+ {0x7C5D, 0xD865, 0xDF50},
+ {0x7C76, 0xD866, 0xDCC6},
+ {0x7D2C, 0xD866, 0xDE72},
+ {0x7D4B, 0xD867, 0xDDDB},
+ {0x7D4C, 0xD867, 0xDE3D},
+ {0x7D59, 0xD867, 0xDE15},
+ {0x7D5B, 0xD867, 0xDE8A},
+ {0x7D5D, 0xD867, 0xDE49},
+ {0x7D67, 0xD867, 0xDEC4},
+ {0x7D6D, 0xD867, 0xDEE9},
+ {0x7D70, 0xD867, 0xDEDB},
+ {0x7E25, 0xD867, 0xDFCE},
+ {0x7E29, 0xD868, 0xDC2F},
+ {0x7E2B, 0xD868, 0xDC1A},
+ {0x7E32, 0xD868, 0xDCF9},
+ {0x7E35, 0xD868, 0xDC82},
+ {0x7E53, 0xD848, 0xDE18},
+ {0x7E58, 0xD868, 0xDF8C},
+ {0x7E5A, 0xD869, 0xDC37},
+ {0x7E6E, 0xD869, 0xDDF1},
+ {0x7E70, 0xD869, 0xDE02},
+ {0x7E72, 0xD869, 0xDE1A},
+ {0x7E76, 0xD869, 0xDEB2},
+};
#endif /* UTF8_OUTPUT_ENABLE */
#ifdef UTF8_INPUT_ENABLE
@@ -2479,6 +3597,16 @@ static const unsigned short utf8_to_euc_C2_932[] = {
0x216B, 0x215E, 0x32, 0x33, 0x212D, 0x264C, 0x2279, 0x2126,
0x2124, 0x31, 0x6F, 0x2264, 0, 0, 0, 0,
};
+static const unsigned short utf8_to_euc_C2_x0213[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0x2922, 0x2923, 0x2171, 0x2172, 0x2924, 0x216F, 0x2925, 0x2178,
+ 0x212F, 0x2926, 0x2927, 0x2928, 0x224C, 0x2929, 0x292A, 0x292B,
+ 0x216B, 0x215E, 0x292C, 0x292D, 0x212D, 0, 0x2279, 0x292E,
+ 0x292F, 0x2930, 0x2931, 0x2932, 0x2933, 0x2934, 0x2935, 0x2936,
+};
static const unsigned short utf8_to_euc_C3[] = {
0xAA22, 0xAA21, 0xAA24, 0xAA2A, 0xAA23, 0xAA29, 0xA921, 0xAA2E,
0xAA32, 0xAA31, 0xAA34, 0xAA33, 0xAA40, 0xAA3F, 0xAA42, 0xAA41,
@@ -2499,6 +3627,16 @@ static const unsigned short utf8_to_euc_C3_932[] = {
0x64, 0x6E, 0x6F, 0x6F, 0x6F, 0x6F, 0x6F, 0x2160,
0x6F, 0x75, 0x75, 0x75, 0x75, 0x79, 0x74, 0x79,
};
+static const unsigned short utf8_to_euc_C3_x0213[] = {
+ 0x2937, 0x2938, 0x2939, 0x293A, 0x293B, 0x293C, 0x293D, 0x293E,
+ 0x293F, 0x2940, 0x2941, 0x2942, 0x2943, 0x2944, 0x2945, 0x2946,
+ 0x2947, 0x2948, 0x2949, 0x294A, 0x294B, 0x294C, 0x294D, 0x215F,
+ 0x294E, 0x294F, 0x2950, 0x2951, 0x2952, 0x2953, 0x2954, 0x2955,
+ 0x2956, 0x2957, 0x2958, 0x2959, 0x295A, 0x295B, 0x295C, 0x295D,
+ 0x295E, 0x295F, 0x2960, 0x2961, 0x2962, 0x2963, 0x2964, 0x2965,
+ 0x2966, 0x2967, 0x2968, 0x2969, 0x296A, 0x296B, 0x296C, 0x2160,
+ 0x296D, 0x296E, 0x296F, 0x2970, 0x2971, 0x2972, 0x2973, 0x2974,
+};
static const unsigned short utf8_to_euc_C4[] = {
0xAA27, 0xAB27, 0xAA25, 0xAB25, 0xAA28, 0xAB28, 0xAA2B, 0xAB2B,
0xAA2C, 0xAB2C, 0xAA2F, 0xAB2F, 0xAA2D, 0xAB2D, 0xAA30, 0xAB30,
@@ -2509,6 +3647,16 @@ static const unsigned short utf8_to_euc_C4[] = {
0xAA44, 0xA945, 0xA926, 0xA946, 0xAA48, 0xAB48, 0xAA49, 0xAB49,
0xA947, 0xAA4A, 0xAB4A, 0xAA4C, 0xAB4C, 0xAA4B, 0xAB4B, 0xA929,
};
+static const unsigned short utf8_to_euc_C4_x0213[] = {
+ 0x2975, 0x297A, 0x2A3A, 0x2A49, 0x2A21, 0x2A2C, 0x2A3C, 0x2A4B,
+ 0x2A59, 0x2A5F, 0xAA2F, 0xAB2F, 0x2A3D, 0x2A4C, 0x2A40, 0x2A4F,
+ 0xA922, 0x2A50, 0x2978, 0x297D, 0, 0, 0xAA36, 0xAB36,
+ 0x2A3E, 0x2A4D, 0x2A3F, 0x2A4E, 0x2A5A, 0x2A60, 0xAA3B, 0xAB3B,
+ 0xAA3D, 0xAB3D, 0xAA3C, 0, 0x2A5B, 0x2A61, 0xA924, 0x2A7D,
+ 0xAA47, 0xAB47, 0x2976, 0x297B, 0, 0, 0xAA46, 0xAB46,
+ 0xAA44, 0xA945, 0xA926, 0xA946, 0x2A5C, 0x2A62, 0xAA49, 0xAB49,
+ 0xA947, 0x2A3B, 0x2A4A, 0xAA4C, 0xAB4C, 0x2A24, 0x2A2F, 0xA929,
+};
static const unsigned short utf8_to_euc_C5[] = {
0xA949, 0xA928, 0xA948, 0xAA4D, 0xAB4D, 0xAA4F, 0xAB4F, 0xAA4E,
0xAB4E, 0xA94A, 0xA92B, 0xA94B, 0xAA57, 0xAB57, 0, 0,
@@ -2519,6 +3667,26 @@ static const unsigned short utf8_to_euc_C5[] = {
0xAA68, 0xAB68, 0xAA6A, 0xAB6A, 0xAA71, 0xAB71, 0xAA74, 0xAB74,
0xAA73, 0xAA75, 0xAB75, 0xAA77, 0xAB77, 0xAA76, 0xAB76, 0,
};
+static const unsigned short utf8_to_euc_C5_x0213[] = {
+ 0xA949, 0x2A23, 0x2A2E, 0x2A41, 0x2A51, 0xAA4F, 0xAB4F, 0x2A42,
+ 0x2A52, 0xA94A, 0xA92B, 0x2A7A, 0x2979, 0x297E, 0, 0,
+ 0x2A43, 0x2A53, 0x2B2B, 0x2B2A, 0x2A39, 0x2A48, 0xAA5B, 0xAB5B,
+ 0x2A44, 0x2A54, 0x2A25, 0x2A30, 0x2A5D, 0x2A63, 0x2A27, 0x2A33,
+ 0x2A26, 0x2A32, 0x2A47, 0x2A57, 0x2A28, 0x2A34, 0xA92F, 0xA94F,
+ 0xAA6C, 0xAB6C, 0x2977, 0x297C, 0x2A5E, 0x2A64, 0x2A45, 0x2A55,
+ 0x2A46, 0x2A56, 0xAA6A, 0xAB6A, 0xAA71, 0xAB71, 0xAA74, 0xAB74,
+ 0xAA73, 0x2A29, 0x2A35, 0x2A2B, 0x2A38, 0x2A2A, 0x2A37, 0,
+};
+static const unsigned short utf8_to_euc_C6_x0213[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0x2B29, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+};
static const unsigned short utf8_to_euc_C7[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0xAA26, 0xAB26, 0xAA43,
@@ -2529,6 +3697,36 @@ static const unsigned short utf8_to_euc_C7[] = {
0, 0, 0, 0, 0, 0xAB39, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
};
+static const unsigned short utf8_to_euc_C7_x0213[] = {
+ 0, 0, 0x2B24, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0x286F, 0x2870, 0xAA43,
+ 0x2871, 0x2876, 0x2877, 0xAA67, 0x2878, 0xAA70, 0x2879, 0xAA6D,
+ 0x287A, 0xAA6F, 0x287B, 0xAA6E, 0x287C, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0xAB39, 0, 0,
+ 0x2874, 0x2875, 0, 0, 0, 0x2B45, 0, 0,
+};
+static const unsigned short utf8_to_euc_C9_x0213[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0x2B33, 0x2B39, 0x2B3A, 0x2B25, 0x2B38, 0x2B3F, 0x2A6E, 0x2B26,
+ 0x2B2E, 0x2B30, 0x2B43, 0, 0x2B31, 0, 0x2B32, 0x2A75,
+ 0x2B28, 0x2A79, 0, 0, 0x2B36, 0x2B3C, 0x2B22, 0x2B42,
+ 0x2B2C, 0, 0, 0, 0x2A6A, 0x2A74, 0x2A6B, 0x2B34,
+ 0x2A7B, 0x2A65, 0x2A76, 0x2A6F, 0, 0x2B2F, 0, 0,
+ 0, 0x2A6C, 0x2B41, 0x2A73, 0, 0x2A70, 0x2A67, 0,
+};
+static const unsigned short utf8_to_euc_CA_x0213[] = {
+ 0, 0x2A7C, 0x2A71, 0x2A68, 0x2B27, 0, 0, 0,
+ 0x2A6D, 0x2B2D, 0x2B35, 0x2A66, 0x2B37, 0x2B3B, 0x2A78, 0,
+ 0x2A72, 0x2B40, 0x2A69, 0, 0x2B21, 0x2A7E, 0, 0,
+ 0x2B23, 0, 0, 0, 0, 0x2A77, 0, 0,
+ 0, 0x2B3E, 0x2B3D, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+};
static const unsigned short utf8_to_euc_CB[] = {
0, 0, 0, 0, 0, 0, 0, 0xA230,
0, 0, 0, 0, 0, 0, 0, 0,
@@ -2539,6 +3737,36 @@ static const unsigned short utf8_to_euc_CB[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
};
+static const unsigned short utf8_to_euc_CB_x0213[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0x2A31,
+ 0x2B53, 0, 0, 0, 0x2B54, 0, 0, 0,
+ 0x2B55, 0x2B56, 0, 0, 0, 0, 0, 0,
+ 0x2A22, 0x2A58, 0xA236, 0x2A2D, 0, 0x2A36, 0x2B71, 0,
+ 0, 0, 0, 0, 0, 0x2B60, 0x2B61, 0x2B62,
+ 0x2B63, 0x2B64, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+};
+static const unsigned short utf8_to_euc_CC_x0213[] = {
+ 0x2B5C, 0x2B5A, 0x2B5F, 0x2B7D, 0x2B5B, 0, 0x2B57, 0,
+ 0x2B6D, 0, 0, 0x2B59, 0x2B5E, 0, 0, 0x2B5D,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0x2B78, 0x2B79, 0x2B7E, 0, 0x2B6A, 0x2B76, 0x2B77, 0x2B6B,
+ 0x2B6C, 0, 0, 0, 0x2B72, 0x2B67, 0, 0,
+ 0, 0x2B6F, 0x2B7A, 0, 0x2B68, 0, 0, 0x2B70,
+ 0x2B73, 0, 0, 0, 0x2B75, 0, 0, 0,
+ 0, 0x2B69, 0x2B7B, 0x2B7C, 0x2B74, 0x2B6E, 0, 0,
+};
+static const unsigned short utf8_to_euc_CD_x0213[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0x2B52, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+};
static const unsigned short utf8_to_euc_CE[] = {
0, 0, 0, 0, 0xA238, 0xA239, 0xA661, 0,
0xA662, 0xA663, 0xA664, 0, 0xA667, 0, 0xA669, 0xA66C,
@@ -2559,6 +3787,16 @@ static const unsigned short utf8_to_euc_CF[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
};
+static const unsigned short utf8_to_euc_CF_x0213[] = {
+ 0x2650, 0x2651, 0x2659, 0x2652, 0x2653, 0x2654, 0x2655, 0x2656,
+ 0x2657, 0x2658, 0xA675, 0xA67A, 0xA677, 0xA679, 0xA67C, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+};
static const unsigned short utf8_to_euc_D0[] = {
0, 0x2727, 0xA742, 0xA743, 0xA744, 0xA745, 0xA746, 0xA747,
0xA748, 0xA749, 0xA74A, 0xA74B, 0xA74C, 0, 0xA74D, 0xA74E,
@@ -2579,6 +3817,26 @@ static const unsigned short utf8_to_euc_D1[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
};
+static const unsigned short utf8_to_euc_E1B8_x0213[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0x2872, 0x2873,
+};
+static const unsigned short utf8_to_euc_E1BD_x0213[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0x2B46, 0x2B47, 0x2B50, 0x2B51, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+};
static const unsigned short utf8_to_euc_E280[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
@@ -2609,6 +3867,36 @@ static const unsigned short utf8_to_euc_E280_932[] = {
0x2273, 0, 0x216C, 0x216D, 0, 0, 0, 0,
0, 0, 0, 0x2228, 0, 0, 0, 0,
};
+static const unsigned short utf8_to_euc_E280_x0213[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0x213E, 0, 0, 0x237C, 0x213D, 0x213D, 0x2142, 0,
+ 0x2146, 0x2147, 0, 0, 0x2148, 0x2149, 0, 0,
+ 0x2277, 0x2278, 0x2340, 0, 0, 0x2145, 0x2144, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0x2273, 0, 0x216C, 0x216D, 0, 0, 0, 0,
+ 0, 0, 0, 0x2228, 0x286B, 0, 0x2131, 0x2B58,
+};
+static const unsigned short utf8_to_euc_E281_x0213[] = {
+ 0, 0, 0x2C7E, 0, 0, 0, 0, 0x286C,
+ 0x286D, 0x286E, 0, 0, 0, 0, 0, 0,
+ 0, 0x2C7D, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+};
+static const unsigned short utf8_to_euc_E282_x0213[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0x2921, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+};
static const unsigned short utf8_to_euc_E284[] = {
0, 0, 0, 0x216E, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
@@ -2629,6 +3917,16 @@ static const unsigned short utf8_to_euc_E284_mac[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
};
+static const unsigned short utf8_to_euc_E284_x0213[] = {
+ 0, 0, 0, 0x216E, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0x235D,
+ 0, 0, 0, 0x235F, 0, 0, 0x2D62, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0x2D64, 0xA26F, 0, 0, 0, 0, 0x2360,
+ 0, 0, 0, 0x2272, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0x235C, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+};
static const unsigned short utf8_to_euc_E285[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
@@ -2649,6 +3947,16 @@ static const unsigned short utf8_to_euc_E285_mac[] = {
0x2A35, 0x2A36, 0x2A37, 0x2A38, 0x2A39, 0x2A3A, 0x2A3B, 0x2A3C,
0x2A3D, 0x2A3E, 0, 0, 0, 0, 0, 0,
};
+static const unsigned short utf8_to_euc_E285_x0213[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0x2778, 0x2779, 0x277A, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0x2D35, 0x2D36, 0x2D37, 0x2D38, 0x2D39, 0x2D3A, 0x2D3B, 0x2D3C,
+ 0x2D3D, 0x2D3E, 0x2D3F, 0x2D57, 0, 0, 0, 0,
+ 0x2C35, 0x2C36, 0x2C37, 0x2C38, 0x2C39, 0x2C3A, 0x2C3B, 0x2C3C,
+ 0x2C3D, 0x2C3E, 0x2C3F, 0x2C40, 0, 0, 0, 0,
+};
static const unsigned short utf8_to_euc_E286[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
@@ -2659,6 +3967,16 @@ static const unsigned short utf8_to_euc_E286[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
};
+static const unsigned short utf8_to_euc_E286_x0213[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0x222B, 0x222C, 0x222A, 0x222D, 0x2271, 0, 0x2327, 0x2325,
+ 0x2326, 0x2328, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+};
static const unsigned short utf8_to_euc_E287[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
@@ -2669,6 +3987,16 @@ static const unsigned short utf8_to_euc_E287[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
};
+static const unsigned short utf8_to_euc_E287_x0213[] = {
+ 0, 0, 0, 0, 0x2329, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0x224D, 0, 0x224E, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0x232B, 0x232C,
+ 0x232A, 0x232D, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+};
static const unsigned short utf8_to_euc_E288[] = {
0x224F, 0, 0x225F, 0x2250, 0, 0, 0, 0x2260,
0x223A, 0, 0, 0x223B, 0, 0, 0, 0,
@@ -2699,6 +4027,16 @@ static const unsigned short utf8_to_euc_E288_mac[] = {
0, 0, 0, 0, 0x2168, 0x2268, 0, 0,
0, 0, 0, 0, 0, 0x2266, 0, 0,
};
+static const unsigned short utf8_to_euc_E288_x0213[] = {
+ 0x224F, 0, 0x225F, 0x2250, 0, 0x2247, 0, 0x2260,
+ 0x223A, 0x2246, 0, 0x223B, 0, 0, 0, 0,
+ 0, 0x2D74, 0x215D, 0x235B, 0, 0, 0, 0,
+ 0, 0, 0x2265, 0, 0, 0x2267, 0x2167, 0x2D78,
+ 0x225C, 0, 0, 0, 0, 0x2254, 0x2255, 0x224A,
+ 0x224B, 0x2241, 0x2240, 0x2269, 0x226A, 0, 0x2D73, 0,
+ 0, 0, 0, 0, 0x2168, 0x2268, 0, 0,
+ 0, 0, 0, 0, 0, 0x2266, 0, 0,
+};
static const unsigned short utf8_to_euc_E289[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
@@ -2709,6 +4047,16 @@ static const unsigned short utf8_to_euc_E289[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
};
+static const unsigned short utf8_to_euc_E289_x0213[] = {
+ 0, 0, 0, 0x226C, 0, 0x226D, 0, 0,
+ 0x226E, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0x2262, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0x2162, 0x2261, 0x226B, 0, 0, 0, 0x2165, 0x2166,
+ 0, 0, 0x2263, 0x2264, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0x226F, 0x2270,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+};
static const unsigned short utf8_to_euc_E28A[] = {
0, 0, 0x223E, 0x223F, 0, 0, 0x223C, 0x223D,
0, 0, 0, 0, 0, 0, 0, 0,
@@ -2729,6 +4077,26 @@ static const unsigned short utf8_to_euc_E28A_mac[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0x2F23,
};
+static const unsigned short utf8_to_euc_E28A_x0213[] = {
+ 0, 0, 0x223E, 0x223F, 0x2242, 0x2243, 0x223C, 0x223D,
+ 0, 0, 0x2244, 0x2245, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0x2251, 0x2252, 0x2253,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0x225D, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0x2D79,
+};
+static const unsigned short utf8_to_euc_E28B_x0213[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0x2776, 0x2777, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+};
static const unsigned short utf8_to_euc_E28C[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
@@ -2739,6 +4107,46 @@ static const unsigned short utf8_to_euc_E28C[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
};
+static const unsigned short utf8_to_euc_E28C_x0213[] = {
+ 0, 0, 0, 0, 0, 0x2248, 0x2249, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0x225E, 0, 0, 0, 0, 0,
+ 0x277C, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+};
+static const unsigned short utf8_to_euc_E28E_x0213[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0x2742, 0x2743,
+};
+static const unsigned short utf8_to_euc_E28F_x0213[] = {
+ 0x2744, 0x2745, 0x2746, 0x2747, 0x2748, 0x2749, 0x274A, 0x274B,
+ 0x274C, 0x274D, 0x274E, 0x274F, 0x2750, 0, 0x277E, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+};
+static const unsigned short utf8_to_euc_E290_x0213[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0x277D, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+};
static const unsigned short utf8_to_euc_E291[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
@@ -2759,6 +4167,16 @@ static const unsigned short utf8_to_euc_E291_mac[] = {
0x2931, 0x2932, 0x2933, 0x2934, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
};
+static const unsigned short utf8_to_euc_E293_x0213[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0x2C41, 0x2C42, 0x2C43, 0x2C44, 0x2C45, 0x2C46, 0x2C47, 0x2C48,
+ 0x2C49, 0x2C4A, 0x2C4B, 0x2C4C, 0x2C4D, 0x2C4E, 0x2C4F, 0x2C50,
+ 0x2C51, 0x2C52, 0x2C53, 0x2C54, 0x2C55, 0x2C56, 0x2C57, 0x2C58,
+ 0x2C59, 0x2C5A, 0, 0x2C2B, 0x2C2C, 0x2C2D, 0x2C2E, 0x2C2F,
+ 0x2C30, 0x2C31, 0x2C32, 0x2C33, 0x2C34, 0x265A, 0x265B, 0x265C,
+ 0x265D, 0x265E, 0x265F, 0x2660, 0x2661, 0x2662, 0x2663, 0,
+};
static const unsigned short utf8_to_euc_E294[] = {
0x2821, 0x282C, 0x2822, 0x282D, 0, 0, 0, 0,
0, 0, 0, 0, 0x2823, 0, 0, 0x282E,
@@ -2789,6 +4207,16 @@ static const unsigned short utf8_to_euc_E296[] = {
0, 0, 0x2225, 0x2224, 0, 0, 0, 0,
0, 0, 0, 0, 0x2227, 0x2226, 0, 0,
};
+static const unsigned short utf8_to_euc_E296_x0213[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0x2223, 0x2222, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0x266D, 0x2225, 0x2224, 0, 0, 0x2322, 0x2321,
+ 0, 0, 0, 0, 0x2227, 0x2226, 0, 0,
+};
static const unsigned short utf8_to_euc_E297[] = {
0, 0, 0, 0, 0, 0, 0x2221, 0x217E,
0, 0, 0, 0x217B, 0, 0, 0x217D, 0x217C,
@@ -2799,6 +4227,16 @@ static const unsigned short utf8_to_euc_E297[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
};
+static const unsigned short utf8_to_euc_E297_x0213[] = {
+ 0x2324, 0x2323, 0, 0, 0, 0, 0x2221, 0x217E,
+ 0, 0x233B, 0, 0x217B, 0, 0, 0x217D, 0x217C,
+ 0x2867, 0x2868, 0x2869, 0x286A, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0x233F, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0x227E,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+};
static const unsigned short utf8_to_euc_E298[] = {
0, 0, 0, 0, 0, 0x217A, 0x2179, 0,
0, 0, 0, 0, 0, 0, 0, 0,
@@ -2809,6 +4247,16 @@ static const unsigned short utf8_to_euc_E298[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
};
+static const unsigned short utf8_to_euc_E298_x0213[] = {
+ 0x2668, 0x2669, 0x266A, 0x266B, 0, 0x217A, 0x2179, 0,
+ 0, 0, 0, 0, 0, 0, 0x2667, 0,
+ 0, 0, 0, 0, 0, 0, 0x2664, 0x2665,
+ 0, 0, 0, 0, 0, 0, 0x2D7E, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+};
static const unsigned short utf8_to_euc_E299[] = {
0x216A, 0, 0x2169, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
@@ -2819,6 +4267,66 @@ static const unsigned short utf8_to_euc_E299[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
};
+static const unsigned short utf8_to_euc_E299_x0213[] = {
+ 0x216A, 0, 0x2169, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0x263A, 0x263D, 0x263B, 0x2640, 0x2639, 0x263E, 0x263C, 0x263F,
+ 0x266C, 0x227D, 0x2276, 0x227B, 0x227C, 0x2275, 0x227A, 0x2274,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+};
+static const unsigned short utf8_to_euc_E29C_x0213[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0x277B, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+};
+static const unsigned short utf8_to_euc_E29D_x0213[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0x2D7D, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0x2C21, 0x2C22,
+ 0x2C23, 0x2C24, 0x2C25, 0x2C26, 0x2C27, 0x2C28, 0x2C29, 0x2C2A,
+};
+static const unsigned short utf8_to_euc_E2A4_x0213[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0x232E, 0x232F, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+};
+static const unsigned short utf8_to_euc_E2A6_x0213[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0x233A,
+};
+static const unsigned short utf8_to_euc_E2A7_x0213[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0x237D, 0x237E, 0, 0, 0, 0,
+};
static const unsigned short utf8_to_euc_E380[] = {
0x2121, 0x2122, 0x2123, 0x2137, 0, 0x2139, 0x213A, 0x213B,
0x2152, 0x2153, 0x2154, 0x2155, 0x2156, 0x2157, 0x2158, 0x2159,
@@ -2839,6 +4347,16 @@ static const unsigned short utf8_to_euc_E380_932[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
};
+static const unsigned short utf8_to_euc_E380_x0213[] = {
+ 0x2121, 0x2122, 0x2123, 0x2137, 0, 0x2139, 0x213A, 0x213B,
+ 0x2152, 0x2153, 0x2154, 0x2155, 0x2156, 0x2157, 0x2158, 0x2159,
+ 0x215A, 0x215B, 0x2229, 0x222E, 0x214C, 0x214D, 0x225A, 0x225B,
+ 0x2258, 0x2259, 0, 0, 0x2141, 0x2D60, 0, 0x2D61,
+ 0x2666, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0x2233, 0x2234, 0x2235, 0, 0,
+ 0, 0, 0, 0x2236, 0x2237, 0x233C, 0, 0,
+};
static const unsigned short utf8_to_euc_E381[] = {
0, 0x2421, 0x2422, 0x2423, 0x2424, 0x2425, 0x2426, 0x2427,
0x2428, 0x2429, 0x242A, 0x242B, 0x242C, 0x242D, 0x242E, 0x242F,
@@ -2869,6 +4387,16 @@ static const unsigned short utf8_to_euc_E382_932[] = {
0x2530, 0x2531, 0x2532, 0x2533, 0x2534, 0x2535, 0x2536, 0x2537,
0x2538, 0x2539, 0x253A, 0x253B, 0x253C, 0x253D, 0x253E, 0x253F,
};
+static const unsigned short utf8_to_euc_E382_x0213[] = {
+ 0x2460, 0x2461, 0x2462, 0x2463, 0x2464, 0x2465, 0x2466, 0x2467,
+ 0x2468, 0x2469, 0x246A, 0x246B, 0x246C, 0x246D, 0x246E, 0x246F,
+ 0x2470, 0x2471, 0x2472, 0x2473, 0x2474, 0x2475, 0x2476, 0,
+ 0, 0, 0, 0x212B, 0x212C, 0x2135, 0x2136, 0x2239,
+ 0x237B, 0x2521, 0x2522, 0x2523, 0x2524, 0x2525, 0x2526, 0x2527,
+ 0x2528, 0x2529, 0x252A, 0x252B, 0x252C, 0x252D, 0x252E, 0x252F,
+ 0x2530, 0x2531, 0x2532, 0x2533, 0x2534, 0x2535, 0x2536, 0x2537,
+ 0x2538, 0x2539, 0x253A, 0x253B, 0x253C, 0x253D, 0x253E, 0x253F,
+};
static const unsigned short utf8_to_euc_E383[] = {
0x2540, 0x2541, 0x2542, 0x2543, 0x2544, 0x2545, 0x2546, 0x2547,
0x2548, 0x2549, 0x254A, 0x254B, 0x254C, 0x254D, 0x254E, 0x254F,
@@ -2879,6 +4407,26 @@ static const unsigned short utf8_to_euc_E383[] = {
0x2570, 0x2571, 0x2572, 0x2573, 0x2574, 0x2575, 0x2576, 0,
0, 0, 0, 0x2126, 0x213C, 0x2133, 0x2134, 0,
};
+static const unsigned short utf8_to_euc_E383_x0213[] = {
+ 0x2540, 0x2541, 0x2542, 0x2543, 0x2544, 0x2545, 0x2546, 0x2547,
+ 0x2548, 0x2549, 0x254A, 0x254B, 0x254C, 0x254D, 0x254E, 0x254F,
+ 0x2550, 0x2551, 0x2552, 0x2553, 0x2554, 0x2555, 0x2556, 0x2557,
+ 0x2558, 0x2559, 0x255A, 0x255B, 0x255C, 0x255D, 0x255E, 0x255F,
+ 0x2560, 0x2561, 0x2562, 0x2563, 0x2564, 0x2565, 0x2566, 0x2567,
+ 0x2568, 0x2569, 0x256A, 0x256B, 0x256C, 0x256D, 0x256E, 0x256F,
+ 0x2570, 0x2571, 0x2572, 0x2573, 0x2574, 0x2575, 0x2576, 0x2772,
+ 0x2773, 0x2774, 0x2775, 0x2126, 0x213C, 0x2133, 0x2134, 0x2238,
+};
+static const unsigned short utf8_to_euc_E387_x0213[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0x266E, 0x266F, 0x2670, 0x2671, 0x2672, 0x2673, 0x2674, 0x2675,
+ 0x2676, 0x2677, 0x2679, 0x267A, 0x267B, 0x267C, 0x267D, 0x267E,
+};
static const unsigned short utf8_to_euc_E388[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
@@ -2899,6 +4447,16 @@ static const unsigned short utf8_to_euc_E388_mac[] = {
0, 0x2D2E, 0x2D31, 0, 0, 0, 0, 0,
0, 0x2D2C, 0, 0, 0, 0, 0, 0,
};
+static const unsigned short utf8_to_euc_E389_x0213[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0x2841, 0x2842, 0x2843, 0x2844, 0x2845, 0x2846, 0x2847,
+ 0x2848, 0x2849, 0x284A, 0x284B, 0x284C, 0x284D, 0x284E, 0x284F,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+};
static const unsigned short utf8_to_euc_E38A[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
@@ -2919,6 +4477,26 @@ static const unsigned short utf8_to_euc_E38A_mac[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
};
+static const unsigned short utf8_to_euc_E38A_x0213[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0x2D65, 0x2D66, 0x2D67, 0x2D68,
+ 0x2D69, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0x2850, 0x2851, 0x2852, 0x2853, 0x2854, 0x2855, 0x2856,
+ 0x2857, 0x2858, 0x2859, 0x285A, 0x285B, 0x285C, 0x285D, 0x285E,
+};
+static const unsigned short utf8_to_euc_E38B_x0213[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0x2C5B, 0x2C5C, 0x2C5D, 0x2C5E, 0x2C5F, 0x2C60, 0x2C61, 0x2C62,
+ 0x2C63, 0x2C64, 0x2C65, 0x2C66, 0x2C67, 0x2C68, 0x2C69, 0x2C6A,
+ 0x2C6B, 0x2C6C, 0x2C6D, 0x2C6E, 0, 0x2C71, 0, 0,
+ 0, 0x2C70, 0, 0, 0x2C73, 0x2C72, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0x2C6F, 0, 0, 0, 0, 0,
+};
static const unsigned short utf8_to_euc_E38C[] = {
0, 0, 0, 0x2D46, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0x2D4A, 0, 0,
@@ -2999,6 +4577,796 @@ static const unsigned short utf8_to_euc_E38F_mac[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
};
+static const unsigned short utf8_to_euc_E38F_x0213[] = {
+ 0, 0, 0, 0, 0x2D55, 0, 0, 0,
+ 0, 0, 0, 0x235E, 0, 0x2D63, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+};
+static const unsigned short utf8_to_euc_E390_x0213[] = {
+ 0, 0, 0x2E23, 0, 0, 0, 0xA12D, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0xA132, 0, 0xA133, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+};
+static const unsigned short utf8_to_euc_E391_x0213[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0xA15E, 0, 0xA156, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+};
+static const unsigned short utf8_to_euc_E392_x0213[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0xA17E, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0x2E53, 0, 0,
+ 0, 0, 0, 0, 0xA32B, 0, 0, 0,
+};
+static const unsigned short utf8_to_euc_E393_x0213[] = {
+ 0, 0xF468, 0, 0, 0, 0, 0, 0xA32F,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0x2E5B, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+};
+static const unsigned short utf8_to_euc_E394_x0213[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0xA348,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+};
+static const unsigned short utf8_to_euc_E395_x0213[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0xA35D, 0xA35E, 0,
+ 0, 0, 0, 0xA361, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0xA367, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+};
+static const unsigned short utf8_to_euc_E396_x0213[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0xA423, 0,
+ 0xA426, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+};
+static const unsigned short utf8_to_euc_E397_x0213[] = {
+ 0, 0, 0, 0, 0, 0xA42F, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0xA438, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0xA442, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+};
+static const unsigned short utf8_to_euc_E398_x0213[] = {
+ 0, 0, 0, 0, 0, 0xA44A, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+};
+static const unsigned short utf8_to_euc_E399_x0213[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0xA479, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+};
+static const unsigned short utf8_to_euc_E39A_x0213[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0xA53F, 0, 0, 0, 0, 0xA543, 0,
+ 0, 0xA541, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+};
+static const unsigned short utf8_to_euc_E39B_x0213[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0xA557,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+};
+static const unsigned short utf8_to_euc_E39D_x0213[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0xA823, 0xA825, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0xA829, 0xA828, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0xA82C, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+};
+static const unsigned short utf8_to_euc_E39E_x0213[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0x4F5F, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+};
+static const unsigned short utf8_to_euc_E39F_x0213[] = {
+ 0, 0xA83E, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0x4F6F, 0, 0, 0, 0, 0,
+ 0xA856, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0xA859, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0xA85C, 0, 0,
+};
+static const unsigned short utf8_to_euc_E3A0_x0213[] = {
+ 0xA85E, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0xA86F,
+ 0, 0, 0, 0, 0, 0, 0xA871, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+};
+static const unsigned short utf8_to_euc_E3A1_x0213[] = {
+ 0xA874, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0xA879, 0, 0, 0,
+ 0, 0xA87B, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+};
+static const unsigned short utf8_to_euc_E3A3_x0213[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0xAC3B, 0, 0, 0, 0, 0,
+};
+static const unsigned short utf8_to_euc_E3A4_x0213[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0xAC46,
+ 0, 0, 0xAC4A, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+};
+static const unsigned short utf8_to_euc_E3A5_x0213[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0xAC60,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+};
+static const unsigned short utf8_to_euc_E3A9_x0213[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0xAD5B, 0,
+ 0, 0, 0, 0xAD5F, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+};
+static const unsigned short utf8_to_euc_E3AB_x0213[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0xAD71, 0xAE36,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0xAD7C, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+};
+static const unsigned short utf8_to_euc_E3AC_x0213[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0xAE2E, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0xAE32, 0, 0xAE34, 0, 0, 0,
+ 0, 0, 0x7549, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+};
+static const unsigned short utf8_to_euc_E3AD_x0213[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0xAE6D, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0xAE65,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+};
+static const unsigned short utf8_to_euc_E3AE_x0213[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0xAF28,
+ 0xAF29, 0, 0, 0, 0, 0xAF2C, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0xAF34, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0x757E, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+};
+static const unsigned short utf8_to_euc_E3AF_x0213[] = {
+ 0, 0, 0, 0x7621, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0xAF48, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0xAF5D, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+};
+static const unsigned short utf8_to_euc_E3B0_x0213[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0x763A,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0xAF77, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+};
+static const unsigned short utf8_to_euc_E3B3_x0213[] = {
+ 0, 0, 0, 0xEE3B, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0xEE42, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+};
+static const unsigned short utf8_to_euc_E3B4_x0213[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0xEE71, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0xEE7E, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+};
+static const unsigned short utf8_to_euc_E3B5_x0213[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0xEF40, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+};
+static const unsigned short utf8_to_euc_E3B6_x0213[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0xEF54, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+};
+static const unsigned short utf8_to_euc_E3B7_x0213[] = {
+ 0xEF70, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0xEF77, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+};
+static const unsigned short utf8_to_euc_E3B8_x0213[] = {
+ 0, 0, 0, 0, 0, 0xF028, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0x7766,
+};
+static const unsigned short utf8_to_euc_E3B9_x0213[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0xF03F, 0, 0, 0, 0, 0, 0xF041, 0,
+ 0xF042, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+};
+static const unsigned short utf8_to_euc_E3BA_x0213[] = {
+ 0, 0, 0, 0xF049, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0xF050, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+};
+static const unsigned short utf8_to_euc_E3BD_x0213[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0xF134,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0x784D, 0, 0, 0xF146, 0, 0xF148,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+};
+static const unsigned short utf8_to_euc_E3BE_x0213[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0xF15C, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+};
+static const unsigned short utf8_to_euc_E3BF_x0213[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0xF167, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0xF16C,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+};
+static const unsigned short utf8_to_euc_E480_x0213[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0xF222, 0, 0, 0, 0, 0, 0,
+};
+static const unsigned short utf8_to_euc_E481_x0213[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0xF22D, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+};
+static const unsigned short utf8_to_euc_E482_x0213[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0xF239, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+};
+static const unsigned short utf8_to_euc_E484_x0213[] = {
+ 0, 0, 0, 0, 0, 0xF264, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+};
+static const unsigned short utf8_to_euc_E485_x0213[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0xF274, 0, 0, 0, 0, 0, 0, 0xF277,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0xF27D, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+};
+static const unsigned short utf8_to_euc_E486_x0213[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0xF333, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0xF337,
+};
+static const unsigned short utf8_to_euc_E487_x0213[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0xF347, 0,
+ 0, 0, 0, 0, 0, 0, 0xF34B, 0,
+ 0, 0, 0, 0xF348, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+};
+static const unsigned short utf8_to_euc_E488_x0213[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0xF353,
+ 0, 0, 0, 0, 0, 0, 0xF357, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+};
+static const unsigned short utf8_to_euc_E489_x0213[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0x796D, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+};
+static const unsigned short utf8_to_euc_E48B_x0213[] = {
+ 0, 0, 0, 0, 0, 0, 0xF42B, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0xF436, 0,
+ 0, 0, 0, 0, 0, 0xF43B, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+};
+static const unsigned short utf8_to_euc_E48C_x0213[] = {
+ 0, 0, 0xF44E, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0xF45D, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+};
+static const unsigned short utf8_to_euc_E48D_x0213[] = {
+ 0, 0, 0, 0xF461, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+};
+static const unsigned short utf8_to_euc_E48F_x0213[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0xF53E, 0,
+ 0xF542, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+};
+static const unsigned short utf8_to_euc_E490_x0213[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0xF548, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0xF54A,
+ 0, 0, 0, 0, 0xF54C, 0, 0, 0,
+ 0, 0, 0xF54F, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+};
+static const unsigned short utf8_to_euc_E491_x0213[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0x7A59, 0, 0, 0, 0,
+ 0, 0, 0, 0x7A5A, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0xF56C, 0,
+ 0, 0, 0xF56E, 0, 0, 0, 0, 0,
+};
+static const unsigned short utf8_to_euc_E492_x0213[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0xF577, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0xF635, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0xF632, 0,
+};
+static const unsigned short utf8_to_euc_E493_x0213[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0xF634, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+};
+static const unsigned short utf8_to_euc_E494_x0213[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0xF659, 0, 0, 0, 0, 0xF654, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0xF66D, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+};
+static const unsigned short utf8_to_euc_E495_x0213[] = {
+ 0, 0, 0, 0xF66E, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+};
+static const unsigned short utf8_to_euc_E496_x0213[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0x7B51, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0xF74F, 0, 0, 0, 0, 0, 0, 0,
+};
+static const unsigned short utf8_to_euc_E497_x0213[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0xF76C, 0, 0,
+ 0, 0, 0x7B60, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+};
+static const unsigned short utf8_to_euc_E498_x0213[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0xF824,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+};
+static const unsigned short utf8_to_euc_E499_x0213[] = {
+ 0, 0xF83A, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0xF843, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+};
+static const unsigned short utf8_to_euc_E49A_x0213[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0xF84E, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0xF853,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+};
+static const unsigned short utf8_to_euc_E49C_x0213[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0xF86B, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+};
+static const unsigned short utf8_to_euc_E49D_x0213[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0xF929, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+};
+static const unsigned short utf8_to_euc_E49F_x0213[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0xF93F, 0, 0,
+};
+static const unsigned short utf8_to_euc_E4A0_x0213[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0xF949, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+};
+static const unsigned short utf8_to_euc_E4A1_x0213[] = {
+ 0, 0, 0, 0, 0x7C4B, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0xF95C, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+};
+static const unsigned short utf8_to_euc_E4A2_x0213[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0xFA27, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+};
+static const unsigned short utf8_to_euc_E4A6_x0213[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0x7D58, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+};
+static const unsigned short utf8_to_euc_E4A7_x0213[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0xFB6A,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0xFB70, 0, 0, 0, 0, 0,
+};
+static const unsigned short utf8_to_euc_E4A8_x0213[] = {
+ 0, 0, 0, 0, 0xFB75, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0xFB78, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+};
+static const unsigned short utf8_to_euc_E4AA_x0213[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0xFC37, 0, 0, 0,
+};
+static const unsigned short utf8_to_euc_E4AC_x0213[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0xFC55, 0, 0, 0, 0,
+};
+static const unsigned short utf8_to_euc_E4AF_x0213[] = {
+ 0, 0, 0xFD26, 0, 0, 0, 0, 0,
+ 0, 0, 0xFD28, 0, 0, 0, 0, 0,
+ 0, 0, 0xFD2A, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0xFD31, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+};
+static const unsigned short utf8_to_euc_E4B0_x0213[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0x7E3E,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0xFD3F, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+};
+static const unsigned short utf8_to_euc_E4B3_x0213[] = {
+ 0, 0, 0, 0, 0xFE2A, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0xFE2D, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+};
+static const unsigned short utf8_to_euc_E4B4_x0213[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0xFE4B,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+};
+static const unsigned short utf8_to_euc_E4B5_x0213[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0xFE60,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+};
static const unsigned short utf8_to_euc_E4B8[] = {
0x306C, 0x437A, 0xB021, 0x3C37, 0xB022, 0xB023, 0, 0x4B7C,
0x3E66, 0x3B30, 0x3E65, 0x323C, 0xB024, 0x4954, 0x4D3F, 0,
@@ -3009,6 +5377,16 @@ static const unsigned short utf8_to_euc_E4B8[] = {
0xB02D, 0x5025, 0x367A, 0, 0, 0xB02E, 0x5026, 0,
0x345D, 0x4330, 0, 0x3C67, 0x5027, 0, 0, 0x5028,
};
+static const unsigned short utf8_to_euc_E4B8_x0213[] = {
+ 0x306C, 0x437A, 0xA122, 0x3C37, 0xB022, 0xB023, 0, 0x4B7C,
+ 0x3E66, 0x3B30, 0x3E65, 0x323C, 0xB024, 0x4954, 0x4D3F, 0xA123,
+ 0x5022, 0x312F, 0xA124, 0, 0x336E, 0x5023, 0x4024, 0x5242,
+ 0x3556, 0x4A3A, 0, 0, 0, 0, 0x3E67, 0xB026,
+ 0, 0x4E3E, 0, 0xB027, 0xB028, 0, 0x4A42, 0,
+ 0x2E24, 0xA125, 0x5024, 0xA126, 0xF02E, 0x4366, 0xA127, 0x2E25,
+ 0x2E26, 0x5025, 0x367A, 0, 0, 0xB02E, 0x5026, 0,
+ 0x345D, 0x4330, 0, 0x3C67, 0x5027, 0, 0, 0x5028,
+};
static const unsigned short utf8_to_euc_E4B9[] = {
0xB02F, 0xB030, 0x5029, 0x4735, 0xB031, 0x3557, 0, 0xB032,
0, 0, 0, 0x4737, 0, 0x4663, 0x3843, 0x4B33,
@@ -3019,6 +5397,16 @@ static const unsigned short utf8_to_euc_E4B9[] = {
0, 0x4D70, 0, 0x467D, 0xB039, 0xB03A, 0, 0,
0, 0xB03B, 0, 0, 0, 0, 0x3425, 0xB03C,
};
+static const unsigned short utf8_to_euc_E4B9_x0213[] = {
+ 0xA128, 0xB030, 0x5029, 0x4735, 0xB031, 0x3557, 0, 0xA129,
+ 0xA12A, 0, 0, 0x4737, 0, 0x4663, 0x3843, 0x4B33,
+ 0, 0xA12C, 0, 0, 0, 0x6949, 0x502A, 0x3E68,
+ 0x502B, 0x3235, 0xA12F, 0, 0xB035, 0x3665, 0x3870, 0x4C69,
+ 0, 0, 0x5626, 0xB036, 0, 0, 0, 0,
+ 0xB037, 0xA130, 0, 0, 0, 0, 0, 0,
+ 0, 0x4D70, 0, 0x467D, 0xB039, 0xB03A, 0, 0,
+ 0, 0xB03B, 0, 0, 0, 0, 0x3425, 0xB03C,
+};
static const unsigned short utf8_to_euc_E4BA[] = {
0x3535, 0, 0x502C, 0, 0, 0x502D, 0x4E3B, 0,
0x4D3D, 0x4168, 0x502F, 0x3B76, 0x4673, 0xB03D, 0x5032, 0,
@@ -3029,6 +5417,16 @@ static const unsigned short utf8_to_euc_E4BA[] = {
0x5037, 0, 0, 0x5038, 0, 0, 0x5039, 0,
0, 0xB042, 0x3F4D, 0, 0, 0, 0, 0,
};
+static const unsigned short utf8_to_euc_E4BA_x0213[] = {
+ 0x3535, 0, 0x502C, 0, 0, 0x502D, 0x4E3B, 0,
+ 0x4D3D, 0x4168, 0x502F, 0x3B76, 0x4673, 0x2E27, 0x5032, 0,
+ 0, 0x313E, 0x385F, 0, 0x385E, 0x3066, 0xB03E, 0xB03F,
+ 0x4F4B, 0x4F4A, 0, 0x3A33, 0x3021, 0xA131, 0x5033, 0x5034,
+ 0x5035, 0x4B34, 0x5036, 0, 0x3872, 0x3067, 0x4B72, 0,
+ 0x357C, 0, 0, 0x357D, 0x357E, 0x4462, 0x4E3C, 0xB041,
+ 0x5037, 0, 0, 0x5038, 0, 0, 0x5039, 0,
+ 0, 0xA134, 0x3F4D, 0xA135, 0xA137, 0, 0, 0,
+};
static const unsigned short utf8_to_euc_E4BB[] = {
0x3D3A, 0x3F4E, 0x503E, 0xB043, 0x503C, 0, 0x503D, 0x3558,
0, 0, 0x3A23, 0x3270, 0, 0x503B, 0x503A, 0x4A29,
@@ -3039,6 +5437,16 @@ static const unsigned short utf8_to_euc_E4BB[] = {
0x3644, 0xB04C, 0x4367, 0xB04D, 0, 0xB04E, 0x376F, 0x5043,
0, 0, 0, 0x4724, 0xF42F, 0xB04F, 0xB050, 0xB051,
};
+static const unsigned short utf8_to_euc_E4BB_x0213[] = {
+ 0x3D3A, 0x3F4E, 0x503E, 0xA138, 0x503C, 0, 0x503D, 0x3558,
+ 0xA139, 0, 0x3A23, 0x3270, 0, 0x503B, 0x503A, 0x4A29,
+ 0xA13A, 0, 0, 0, 0x3B46, 0x3B45, 0x423E, 0x503F,
+ 0x4955, 0x4067, 0xA13C, 0xB046, 0, 0x2138, 0x5040, 0x5042,
+ 0xB047, 0x2E28, 0xB049, 0x4265, 0x4E61, 0x304A, 0, 0,
+ 0xB04A, 0, 0, 0xA13B, 0, 0x5041, 0x323E, 0xB04B,
+ 0x3644, 0xA13D, 0x4367, 0xB04D, 0, 0xA13E, 0x376F, 0x5043,
+ 0, 0, 0, 0x4724, 0xF42F, 0x2E29, 0xB050, 0x2E2A,
+};
static const unsigned short utf8_to_euc_E4BC[] = {
0xB052, 0x346B, 0xB053, 0xB054, 0, 0, 0, 0,
0xB055, 0x5044, 0x304B, 0xB056, 0xB057, 0x3860, 0x346C, 0x497A,
@@ -3049,6 +5457,16 @@ static const unsigned short utf8_to_euc_E4BC[] = {
0x5046, 0xB05E, 0, 0xB060, 0x483C, 0xB061, 0x4E62, 0xB062,
0x3F2D, 0xB063, 0x3B47, 0xB064, 0x3B77, 0x3240, 0xB065, 0,
};
+static const unsigned short utf8_to_euc_E4BC_x0213[] = {
+ 0xA13F, 0x346B, 0xB053, 0x2E2B, 0, 0, 0, 0,
+ 0xB055, 0x5044, 0x304B, 0x2E2C, 0xB057, 0x3860, 0x346C, 0x497A,
+ 0x4832, 0x3559, 0xB058, 0, 0, 0xB059, 0xA140, 0xB05B,
+ 0, 0xB05C, 0x3271, 0, 0x5067, 0x4541, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0xB05D, 0x476C,
+ 0x5046, 0xB05E, 0, 0xB060, 0x483C, 0xB061, 0x4E62, 0xA142,
+ 0x3F2D, 0xB063, 0x3B47, 0xB064, 0x3B77, 0x3240, 0xA143, 0,
+};
static const unsigned short utf8_to_euc_E4BD[] = {
0xB066, 0, 0xB067, 0x4451, 0, 0, 0x4322, 0x504A,
0xB068, 0xB069, 0, 0xB06A, 0xB06B, 0x304C, 0x4463, 0x3D3B,
@@ -3059,6 +5477,16 @@ static const unsigned short utf8_to_euc_E4BD[] = {
0x5051, 0xB075, 0, 0x3242, 0, 0x4A3B, 0x504B, 0xB076,
0xB077, 0xB078, 0xB079, 0x504F, 0x3873, 0xB07A, 0xB07B, 0x3B48,
};
+static const unsigned short utf8_to_euc_E4BD_x0213[] = {
+ 0xB066, 0, 0xB067, 0x4451, 0, 0, 0x4322, 0x504A,
+ 0x2E2E, 0x2E2F, 0, 0xB06A, 0xB06B, 0x304C, 0x4463, 0x3D3B,
+ 0x3A34, 0x4D24, 0xB06C, 0x424E, 0xA144, 0x323F, 0x2E30, 0x5049,
+ 0xA145, 0x4D3E, 0x5045, 0x5047, 0x3A6E, 0x5048, 0x5524, 0x2E31,
+ 0x2E2D, 0, 0, 0xB071, 0xA141, 0, 0, 0,
+ 0, 0x5050, 0x2E32, 0, 0x2E33, 0, 0xB074, 0x5053,
+ 0x5051, 0xB075, 0, 0x3242, 0, 0x4A3B, 0x504B, 0xA147,
+ 0xA148, 0xB078, 0xA149, 0x504F, 0x3873, 0xA14A, 0x2E34, 0x3B48,
+};
static const unsigned short utf8_to_euc_E4BE[] = {
0, 0xB07C, 0xB07D, 0x3426, 0xB07E, 0xB121, 0x5054, 0,
0x504C, 0xB122, 0xB123, 0x4E63, 0xB124, 0x3B78, 0xB125, 0x504D,
@@ -3069,6 +5497,16 @@ static const unsigned short utf8_to_euc_E4BE[] = {
0, 0, 0xB12F, 0, 0, 0x3F2F, 0x4E37, 0xB130,
0, 0xB131, 0, 0xB132, 0xB133, 0xB134, 0xB135, 0x4A58,
};
+static const unsigned short utf8_to_euc_E4BE_x0213[] = {
+ 0, 0xB07C, 0xA14B, 0x3426, 0xB07E, 0xA14C, 0x5054, 0,
+ 0x504C, 0xB122, 0x2E35, 0x4E63, 0xB124, 0x3B78, 0xB125, 0x504D,
+ 0xB126, 0x5052, 0xA14D, 0xB128, 0x2E36, 0, 0x5055, 0x2E37,
+ 0x504E, 0xB12B, 0xA14E, 0x3621, 0, 0x304D, 0xB12D, 0xB12E,
+ 0x3622, 0x3241, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0x5525, 0, 0x4B79, 0x496E, 0x3874,
+ 0, 0, 0xA150, 0, 0, 0x3F2F, 0x4E37, 0xB130,
+ 0, 0xB131, 0, 0xB132, 0xB133, 0xB134, 0xA151, 0x4A58,
+};
static const unsigned short utf8_to_euc_E4BF[] = {
0xB136, 0xB137, 0x3738, 0x4225, 0x3264, 0xB138, 0xB139, 0,
0xB13A, 0xB13B, 0x3D53, 0xB13C, 0xB13D, 0xB13E, 0x5059, 0xB13F,
@@ -3079,6 +5517,16 @@ static const unsigned short utf8_to_euc_E4BF[] = {
0xB144, 0, 0xB145, 0x4750, 0, 0x4936, 0x5068, 0,
0x4A70, 0, 0x3236, 0, 0xB146, 0xB147, 0x506C, 0xB148,
};
+static const unsigned short utf8_to_euc_E4BF_x0213[] = {
+ 0xB136, 0xB137, 0x3738, 0x4225, 0x3264, 0xA152, 0xB139, 0,
+ 0xB13A, 0x2E39, 0x3D53, 0xA153, 0xB13D, 0xB13E, 0x5059, 0xA154,
+ 0x505E, 0x505C, 0xA155, 0, 0x5057, 0, 0, 0x422F,
+ 0x505A, 0, 0x505D, 0x505B, 0xB141, 0x4A5D, 0, 0x5058,
+ 0x2E3A, 0x3F2E, 0xB143, 0x4B73, 0x505F, 0x5060, 0xA14F, 0,
+ 0, 0, 0, 0, 0, 0, 0x3D24, 0x506D,
+ 0xB144, 0x2E21, 0xA157, 0x4750, 0, 0x4936, 0x5068, 0,
+ 0x4A70, 0, 0x3236, 0, 0xB146, 0xB147, 0x506C, 0xB148,
+};
static const unsigned short utf8_to_euc_E580[] = {
0xB149, 0xB14A, 0, 0, 0xB14B, 0x5066, 0x506F, 0xB14C,
0, 0x4152, 0xB14D, 0x3844, 0xB14E, 0x475C, 0xB14F, 0x6047,
@@ -3089,6 +5537,16 @@ static const unsigned short utf8_to_euc_E580[] = {
0xB15B, 0, 0xB15C, 0xB15D, 0, 0xB15E, 0x3666, 0,
0, 0x3770, 0, 0xB176, 0, 0, 0, 0,
};
+static const unsigned short utf8_to_euc_E580_x0213[] = {
+ 0xA158, 0x2E3B, 0x2E3C, 0, 0xB14B, 0x5066, 0x506F, 0xB14C,
+ 0, 0x4152, 0xB14D, 0x3844, 0xB14E, 0x475C, 0x2E3D, 0x6047,
+ 0xA159, 0x506E, 0x455D, 0xA15A, 0x5063, 0, 0x3876, 0xB152,
+ 0x2E3E, 0x3875, 0x5061, 0xB154, 0xA15B, 0xB156, 0xA15C, 0x3C5A,
+ 0, 0x5069, 0xA15D, 0x4A6F, 0x434D, 0x5065, 0x3771, 0x2E3F,
+ 0x5062, 0x506A, 0x5064, 0x4E51, 0x506B, 0x4F41, 0x2E40, 0,
+ 0xB15B, 0, 0xB15C, 0xB15D, 0, 0xB15E, 0x3666, 0,
+ 0, 0x3770, 0, 0x2E42, 0, 0, 0, 0,
+};
static const unsigned short utf8_to_euc_E581[] = {
0xB15F, 0xB160, 0xB161, 0x5070, 0, 0xB162, 0xB163, 0x5071,
0x5075, 0x304E, 0xB164, 0, 0xB165, 0, 0xB166, 0x4A50,
@@ -3099,6 +5557,16 @@ static const unsigned short utf8_to_euc_E581[] = {
0xB174, 0xB175, 0x3C45, 0, 0x4226, 0x4465, 0x3676, 0,
0x5079, 0, 0, 0, 0, 0x3536, 0, 0,
};
+static const unsigned short utf8_to_euc_E581_x0213[] = {
+ 0x2E41, 0x2E43, 0xA15F, 0x5070, 0, 0xB162, 0xA160, 0x5071,
+ 0x5075, 0x304E, 0xB164, 0, 0xB165, 0, 0xA161, 0x4A50,
+ 0x5074, 0xB167, 0xB168, 0xA162, 0, 0x5073, 0x5077, 0xA163,
+ 0, 0xB16B, 0x5076, 0, 0x4464, 0, 0, 0xB16C,
+ 0xB16D, 0, 0xB16E, 0xA164, 0, 0x3772, 0xA165, 0xB171,
+ 0, 0, 0xA166, 0, 0x5078, 0xB173, 0, 0,
+ 0xA167, 0xB175, 0x3C45, 0, 0x4226, 0x4465, 0x3676, 0,
+ 0x5079, 0, 0, 0, 0, 0x3536, 0, 0,
+};
static const unsigned short utf8_to_euc_E582[] = {
0x507A, 0xB177, 0, 0xB178, 0xB179, 0x507C, 0xB17A, 0,
0, 0, 0xB17B, 0, 0, 0x4B35, 0xB17C, 0xB17D,
@@ -3109,6 +5577,16 @@ static const unsigned short utf8_to_euc_E582[] = {
0xB22E, 0, 0x507E, 0x5123, 0x507D, 0x3A44, 0, 0x3D7D,
0, 0xB22F, 0xB230, 0, 0, 0xB231, 0x3739, 0,
};
+static const unsigned short utf8_to_euc_E582_x0213[] = {
+ 0x507A, 0xB177, 0, 0xB178, 0xB179, 0x507C, 0xB17A, 0,
+ 0xA169, 0, 0xB17B, 0, 0, 0x4B35, 0xB17C, 0xB17D,
+ 0xB17E, 0x3766, 0xA16A, 0xA16B, 0x2E44, 0xA16C, 0xA16D, 0,
+ 0x3B31, 0x4877, 0x507B, 0xB225, 0xA16E, 0, 0xB227, 0xB228,
+ 0xB229, 0xB22A, 0xB22B, 0xA168, 0, 0, 0, 0,
+ 0, 0, 0xA16F, 0, 0x3A45, 0x4D43, 0, 0xB22D,
+ 0xB22E, 0xA171, 0x507E, 0x5123, 0x507D, 0x3A44, 0, 0x3D7D,
+ 0, 0xB22F, 0xA172, 0xA173, 0, 0xB231, 0x3739, 0,
+};
static const unsigned short utf8_to_euc_E583[] = {
0xB232, 0, 0x5124, 0xB233, 0xB234, 0x364F, 0, 0xB235,
0, 0x5121, 0x5122, 0, 0xB236, 0x462F, 0xB237, 0x417C,
@@ -3119,6 +5597,16 @@ static const unsigned short utf8_to_euc_E583[] = {
0, 0xB245, 0xB251, 0, 0xF430, 0x512C, 0xB246, 0,
0, 0x512B, 0xB247, 0x4A48, 0, 0, 0xB248, 0,
};
+static const unsigned short utf8_to_euc_E583_x0213[] = {
+ 0xB232, 0, 0x5124, 0xB233, 0xA174, 0x364F, 0, 0xA175,
+ 0, 0x5121, 0x5122, 0, 0x2E45, 0x462F, 0xA178, 0x417C,
+ 0x2E47, 0x3623, 0, 0xB239, 0xA17A, 0x4B4D, 0x5125, 0,
+ 0xB23B, 0xA17B, 0x4E3D, 0, 0xB23C, 0xB23D, 0x5126, 0xB23E,
+ 0, 0xA17C, 0xB23F, 0x5129, 0xB240, 0x5127, 0x2E48, 0x414E,
+ 0xB242, 0xA17D, 0, 0, 0, 0x5128, 0x512A, 0xB244,
+ 0, 0xB245, 0x2E46, 0xA176, 0xF430, 0x512C, 0xB246, 0,
+ 0, 0x512B, 0xB247, 0x4A48, 0, 0, 0xB248, 0,
+};
static const unsigned short utf8_to_euc_E584[] = {
0x3537, 0x512E, 0x512F, 0xB249, 0x322F, 0, 0xB24A, 0xB24B,
0xB24C, 0x512D, 0, 0xB24D, 0xB24E, 0xB24F, 0xB250, 0,
@@ -3129,6 +5617,16 @@ static const unsigned short utf8_to_euc_E584[] = {
0, 0xB25F, 0x4C59, 0xB260, 0xB261, 0xB262, 0, 0x5136,
0xB263, 0xB264, 0x5135, 0x5138, 0x5137, 0, 0, 0x5139,
};
+static const unsigned short utf8_to_euc_E584_x0213[] = {
+ 0x3537, 0x512E, 0x512F, 0x2E4B, 0x322F, 0, 0x2E4A, 0xB24B,
+ 0xA321, 0x512D, 0, 0x2E4C, 0xB24E, 0xB24F, 0xB250, 0,
+ 0xB252, 0, 0x3C74, 0, 0x5132, 0x5131, 0x5130, 0xA323,
+ 0x5056, 0xB254, 0x5133, 0xA324, 0xB256, 0xB257, 0x2E4D, 0x3D7E,
+ 0, 0x5134, 0, 0xB259, 0, 0, 0, 0xB25A,
+ 0xB25B, 0, 0x4D25, 0, 0xB25C, 0xB25D, 0, 0xB25E,
+ 0, 0xB25F, 0x4C59, 0xB260, 0xB261, 0x2E4E, 0, 0x5136,
+ 0xB263, 0xB264, 0x5135, 0x5138, 0x5137, 0, 0, 0x5139,
+};
static const unsigned short utf8_to_euc_E585[] = {
0x513A, 0x3074, 0xB265, 0x3835, 0x373B, 0x3D3C, 0x437B, 0x3624,
0x4068, 0x3877, 0xB266, 0x396E, 0x513C, 0x4C48, 0x4546, 0xB267,
@@ -3139,6 +5637,16 @@ static const unsigned short utf8_to_euc_E585[] = {
0, 0x3626, 0, 0, 0, 0x4A3C, 0x4236, 0x3671,
0x4535, 0, 0, 0, 0x3773, 0, 0xB26F, 0,
};
+static const unsigned short utf8_to_euc_E585_x0213[] = {
+ 0x513A, 0x3074, 0xB265, 0x3835, 0x373B, 0x3D3C, 0x437B, 0x3624,
+ 0x4068, 0x3877, 0x2E4F, 0x396E, 0x513C, 0x4C48, 0x4546, 0xB267,
+ 0x3B79, 0, 0x513B, 0xB268, 0x513D, 0x2E51, 0, 0x2E52,
+ 0xB26B, 0, 0x455E, 0, 0x3375, 0, 0, 0xB26C,
+ 0xA326, 0, 0x513E, 0, 0xB26D, 0x467E, 0xB26E, 0,
+ 0x4134, 0x5140, 0x5141, 0x482C, 0x3878, 0x4F3B, 0x5142, 0,
+ 0, 0x3626, 0, 0xA328, 0, 0x4A3C, 0x4236, 0x3671,
+ 0x4535, 0, 0, 0xF474, 0x3773, 0, 0xB26F, 0,
+};
static const unsigned short utf8_to_euc_E586[] = {
0x5143, 0, 0x5144, 0xB270, 0xB271, 0x4662, 0x315F, 0,
0, 0x5147, 0x3A7D, 0xB272, 0x5146, 0x3A46, 0xB273, 0x5148,
@@ -3149,6 +5657,16 @@ static const unsigned short utf8_to_euc_E586[] = {
0x5156, 0x5154, 0x5155, 0x5153, 0x3A63, 0x5157, 0x4C6A, 0x4E64,
0xB279, 0, 0xB27A, 0, 0xB27B, 0x5158, 0xB27C, 0xB27D,
};
+static const unsigned short utf8_to_euc_E586_x0213[] = {
+ 0x5143, 0, 0x5144, 0xA329, 0xB271, 0x4662, 0x315F, 0,
+ 0, 0x5147, 0x3A7D, 0xA32A, 0x5146, 0x3A46, 0xB273, 0x5148,
+ 0x666E, 0x5149, 0x4B41, 0x514A, 0, 0x514B, 0x514C, 0x3E69,
+ 0xA32C, 0x3C4C, 0, 0, 0, 0x2E54, 0, 0,
+ 0x3427, 0xB276, 0x514F, 0xA32D, 0x514D, 0x4C3D, 0x514E, 0,
+ 0x495A, 0x5150, 0x5151, 0x5152, 0x455F, 0xA32E, 0, 0,
+ 0x5156, 0x5154, 0x5155, 0x5153, 0x3A63, 0x5157, 0x4C6A, 0x4E64,
+ 0xB279, 0, 0xB27A, 0, 0xA330, 0x5158, 0xB27C, 0xB27D,
+};
static const unsigned short utf8_to_euc_E587[] = {
0, 0, 0xB27E, 0, 0x4028, 0x5159, 0x3D5A, 0,
0xB321, 0x515A, 0, 0x437C, 0x4E3F, 0x4560, 0, 0xB322,
@@ -3159,6 +5677,16 @@ static const unsigned short utf8_to_euc_E587[] = {
0x5160, 0x332E, 0xB32C, 0xB32D, 0xB32E, 0x5161, 0x3627, 0xB32F,
0x464C, 0x317A, 0x3D50, 0, 0, 0x4821, 0x5162, 0,
};
+static const unsigned short utf8_to_euc_E587_x0213[] = {
+ 0, 0, 0xB27E, 0x2E55, 0x4028, 0x5159, 0x3D5A, 0,
+ 0xB321, 0x515A, 0x2E56, 0x437C, 0x4E3F, 0x4560, 0, 0xB322,
+ 0, 0xB323, 0xB324, 0xB325, 0, 0xB326, 0x5245, 0,
+ 0xB327, 0, 0, 0x515B, 0x7425, 0x3645, 0x2E57, 0,
+ 0x515C, 0x4B5E, 0x2E58, 0, 0, 0xB32A, 0x3D68, 0x427C,
+ 0, 0x515E, 0x4664, 0, 0xF431, 0x515F, 0x2E59, 0,
+ 0x5160, 0x332E, 0xB32C, 0xA333, 0xA334, 0x5161, 0x3627, 0xB32F,
+ 0x464C, 0x317A, 0x3D50, 0, 0, 0x4821, 0x5162, 0,
+};
static const unsigned short utf8_to_euc_E588[] = {
0x4561, 0xB330, 0xB331, 0x3F4F, 0x5163, 0xB332, 0x4A2C, 0x405A,
0x3422, 0, 0x3429, 0x5164, 0, 0, 0x5166, 0,
@@ -3169,6 +5697,16 @@ static const unsigned short utf8_to_euc_E588[] = {
0x457E, 0xB33A, 0xB33B, 0x516A, 0, 0xB33C, 0x4029, 0x3A7E,
0x3774, 0x516B, 0x3B49, 0x396F, 0xB33D, 0, 0, 0,
};
+static const unsigned short utf8_to_euc_E588_x0213[] = {
+ 0x4561, 0x2E5A, 0xA335, 0x3F4F, 0x5163, 0xB332, 0x4A2C, 0x405A,
+ 0x3422, 0, 0x3429, 0x5164, 0, 0, 0x5166, 0,
+ 0, 0x373A, 0xA336, 0x2E5C, 0x5165, 0x2E5D, 0xA337, 0x4E73,
+ 0xB337, 0, 0, 0, 0, 0x3D69, 0, 0,
+ 0, 0, 0xB338, 0, 0x483D, 0x4A4C, 0, 0x5167,
+ 0xB339, 0x4D78, 0x5168, 0, 0, 0, 0x5169, 0,
+ 0x457E, 0xB33A, 0xB33B, 0x516A, 0, 0xB33C, 0x4029, 0x3A7E,
+ 0x3774, 0x516B, 0x3B49, 0x396F, 0xB33D, 0, 0, 0,
+};
static const unsigned short utf8_to_euc_E589[] = {
0, 0, 0, 0x4466, 0x516D, 0xB33E, 0, 0x4227,
0, 0xB33F, 0x3A6F, 0x516E, 0x516F, 0x4130, 0, 0x516C,
@@ -3179,6 +5717,16 @@ static const unsigned short utf8_to_euc_E589[] = {
0x3E6A, 0x517B, 0x3364, 0x5175, 0x5173, 0x414F, 0, 0xB34A,
0xB34B, 0xB34C, 0, 0, 0, 0x5177, 0, 0x5176,
};
+static const unsigned short utf8_to_euc_E589_x0213[] = {
+ 0, 0, 0, 0x4466, 0x516D, 0xB33E, 0, 0x4227,
+ 0, 0x2E5E, 0x3A6F, 0x516E, 0x516F, 0x4130, 0, 0x516C,
+ 0, 0, 0, 0, 0x5171, 0xA339, 0x4B36, 0x2E5F,
+ 0xB342, 0, 0xB343, 0x3964, 0xA33A, 0x2F7E, 0x5170, 0xB345,
+ 0xB346, 0x2E60, 0, 0x3775, 0x3A5E, 0x476D, 0xB348, 0,
+ 0, 0x5174, 0x5172, 0, 0xA33B, 0, 0xB349, 0x497B,
+ 0x3E6A, 0x517B, 0x3364, 0x5175, 0x5173, 0x414F, 0, 0xA33C,
+ 0xB34B, 0xB34C, 0, 0, 0, 0x5177, 0, 0x5176,
+};
static const unsigned short utf8_to_euc_E58A[] = {
0xB34D, 0, 0xB34E, 0x3344, 0, 0xB34F, 0, 0x3760,
0x517C, 0x4E2D, 0xB350, 0, 0xB351, 0x5178, 0, 0,
@@ -3189,6 +5737,16 @@ static const unsigned short utf8_to_euc_E58A[] = {
0xB35E, 0x4E65, 0, 0, 0x4F2B, 0x5225, 0xB35F, 0xB360,
0xB361, 0x387A, 0xB362, 0xB363, 0x5224, 0xB364, 0x332F, 0,
};
+static const unsigned short utf8_to_euc_E58A_x0213[] = {
+ 0xB34D, 0, 0xA33E, 0x3344, 0xA33D, 0xB34F, 0, 0x3760,
+ 0x517C, 0x4E2D, 0xB350, 0, 0xB351, 0x5178, 0, 0,
+ 0, 0x517D, 0x517A, 0x2E61, 0x5179, 0xB353, 0xB354, 0xB355,
+ 0xA340, 0, 0xB357, 0x4E4F, 0xB358, 0, 0, 0x3879,
+ 0x3243, 0, 0, 0x4E74, 0xA342, 0xB35A, 0xA343, 0xB35C,
+ 0, 0x3D75, 0x4558, 0x3965, 0x5222, 0x5223, 0, 0xA344,
+ 0xB35E, 0x4E65, 0, 0, 0x4F2B, 0x5225, 0xB35F, 0xB360,
+ 0xB361, 0x387A, 0xA345, 0xA346, 0x5224, 0xB364, 0x332F, 0,
+};
static const unsigned short utf8_to_euc_E58B[] = {
0xB365, 0x5226, 0, 0x4B56, 0xB366, 0x443C, 0xB367, 0x4D26,
0xB368, 0x4A59, 0, 0, 0xB369, 0x5227, 0, 0xB36A,
@@ -3199,6 +5757,16 @@ static const unsigned short utf8_to_euc_E58B[] = {
0xB376, 0xB377, 0x372E, 0x522E, 0xB378, 0x522F, 0xB379, 0xB37A,
0x5230, 0x5231, 0x3C5B, 0, 0, 0, 0x387B, 0x4C5E,
};
+static const unsigned short utf8_to_euc_E58B_x0213[] = {
+ 0xB365, 0x5226, 0, 0x4B56, 0xB366, 0x443C, 0xB367, 0x4D26,
+ 0x2E62, 0x4A59, 0xA347, 0, 0x2E64, 0x5227, 0, 0xB36A,
+ 0x2E65, 0xA349, 0x7055, 0, 0xB36C, 0x4630, 0x2E66, 0x5228,
+ 0x342A, 0x4C33, 0, 0x2E67, 0xB36F, 0x3E21, 0x5229, 0x4A67,
+ 0x522D, 0xB370, 0x402A, 0x522A, 0x3650, 0xB371, 0x522B, 0x342B,
+ 0xB372, 0xB373, 0xB374, 0, 0xB375, 0, 0, 0,
+ 0x2E69, 0xB377, 0x372E, 0x522E, 0xB378, 0x522F, 0xB379, 0xA34B,
+ 0x5230, 0x5231, 0x3C5B, 0x2E6A, 0, 0, 0x387B, 0x4C5E,
+};
static const unsigned short utf8_to_euc_E58C[] = {
0xB37B, 0x4C68, 0x4677, 0xB37C, 0, 0x4A71, 0x5232, 0xF432,
0x5233, 0, 0xB37D, 0xB37E, 0xB421, 0x5235, 0, 0x5237,
@@ -3209,6 +5777,16 @@ static const unsigned short utf8_to_euc_E58C[] = {
0xB430, 0x523C, 0xB431, 0x523D, 0, 0xB432, 0, 0,
0x523E, 0x4924, 0x3668, 0x3065, 0xB433, 0xB434, 0xB435, 0x463F,
};
+static const unsigned short utf8_to_euc_E58C_x0213[] = {
+ 0x2E6B, 0x4C68, 0x4677, 0xB37C, 0, 0x4A71, 0x5232, 0x2E6C,
+ 0x5233, 0, 0xA34C, 0xA34D, 0xB421, 0x5235, 0, 0x5237,
+ 0x5236, 0xB422, 0, 0xB423, 0, 0x5238, 0x323D, 0x4B4C,
+ 0xB424, 0x3A7C, 0x5239, 0xB425, 0x2E6D, 0x4159, 0xB427, 0xB428,
+ 0x3E22, 0x3629, 0, 0x523A, 0xA34E, 0xB429, 0, 0xB42A,
+ 0xB42B, 0xB42C, 0x485B, 0xB42D, 0xB42E, 0xB42F, 0, 0x523B,
+ 0xB430, 0x523C, 0xB431, 0x523D, 0, 0xA34F, 0, 0,
+ 0x523E, 0x4924, 0x3668, 0x3065, 0xB433, 0xB434, 0xA350, 0x463F,
+};
static const unsigned short utf8_to_euc_E58D[] = {
0x523F, 0x3D3D, 0xB436, 0x4069, 0, 0x5241, 0x5240, 0x3E23,
0x3861, 0x5243, 0x483E, 0xB438, 0xB437, 0x5244, 0, 0,
@@ -3219,6 +5797,16 @@ static const unsigned short utf8_to_euc_E58D[] = {
0x3075, 0x346D, 0xB440, 0x4228, 0x3551, 0x4D71, 0, 0x524B,
0x3237, 0xB441, 0, 0x524A, 0, 0, 0xB442, 0x362A,
};
+static const unsigned short utf8_to_euc_E58D_x0213[] = {
+ 0x523F, 0x3D3D, 0xA351, 0x4069, 0, 0x5241, 0x5240, 0x3E23,
+ 0x3861, 0x5243, 0x483E, 0xB438, 0xB437, 0x5244, 0, 0,
+ 0, 0x485C, 0x4234, 0x426E, 0x3628, 0, 0, 0x466E,
+ 0x4331, 0xB439, 0x476E, 0xB43A, 0x4B4E, 0, 0x5246, 0,
+ 0x406A, 0x2E6F, 0, 0x2E70, 0, 0xB43D, 0x3735, 0xA354,
+ 0, 0x5247, 0, 0, 0xA355, 0xB43F, 0x5248, 0x312C,
+ 0x3075, 0x346D, 0xB440, 0x4228, 0x3551, 0x4D71, 0, 0x524B,
+ 0x3237, 0xB441, 0xA356, 0x524A, 0, 0x2E71, 0xB442, 0x362A,
+};
static const unsigned short utf8_to_euc_E58E[] = {
0, 0, 0x524C, 0xB443, 0x4C71, 0, 0, 0xB444,
0xB445, 0, 0, 0, 0, 0, 0xB446, 0,
@@ -3229,6 +5817,16 @@ static const unsigned short utf8_to_euc_E58E[] = {
0x5252, 0, 0xB450, 0x3837, 0xB451, 0xB452, 0x5253, 0xB453,
0xB454, 0, 0xB455, 0x356E, 0, 0xB456, 0, 0,
};
+static const unsigned short utf8_to_euc_E58E_x0213[] = {
+ 0, 0, 0x524C, 0xB443, 0x4C71, 0, 0, 0xB444,
+ 0xB445, 0, 0, 0, 0, 0, 0xB446, 0,
+ 0, 0, 0, 0x2E72, 0xB448, 0, 0x524D, 0,
+ 0x4E52, 0xB449, 0x387C, 0, 0, 0x2E73, 0, 0x3836,
+ 0x524E, 0xB44B, 0, 0, 0xA357, 0x5250, 0x524F, 0,
+ 0x3F5F, 0x3139, 0xB44D, 0xB44E, 0, 0x315E, 0x5251, 0xB44F,
+ 0x5252, 0, 0x2E74, 0x3837, 0xA358, 0xB452, 0x5253, 0xA35A,
+ 0xB454, 0, 0xB455, 0x356E, 0, 0xB456, 0, 0,
+};
static const unsigned short utf8_to_euc_E58F[] = {
0xB457, 0, 0x3B32, 0x5254, 0, 0xB458, 0, 0,
0x4B74, 0x3A35, 0x355A, 0x4D27, 0x4150, 0x483F, 0x3C7D, 0xB459,
@@ -3239,6 +5837,16 @@ static const unsigned short utf8_to_euc_E58F[] = {
0x4266, 0x3C38, 0x3B4B, 0x3126, 0, 0xB463, 0x3370, 0x3966,
0x3B4A, 0, 0x525D, 0, 0, 0, 0, 0,
};
+static const unsigned short utf8_to_euc_E58F_x0213[] = {
+ 0xA35B, 0, 0x3B32, 0x5254, 0, 0xB458, 0, 0,
+ 0x4B74, 0x3A35, 0x355A, 0x4D27, 0x4150, 0x483F, 0x3C7D, 0xB459,
+ 0, 0, 0xB45A, 0xB45B, 0x3D47, 0xA35F, 0x3C68, 0x3C75,
+ 0, 0x3D76, 0xA360, 0x4840, 0, 0xB45E, 0xB45F, 0x5257,
+ 0xB460, 0x3143, 0x4151, 0x387D, 0x3845, 0x3667, 0xB461, 0xB462,
+ 0x525B, 0x4321, 0x427E, 0x362B, 0x3E24, 0x525C, 0x525A, 0x3244,
+ 0x4266, 0x3C38, 0x3B4B, 0x3126, 0xA362, 0xA363, 0x3370, 0x3966,
+ 0x3B4A, 0, 0x525D, 0, 0, 0, 0, 0,
+};
static const unsigned short utf8_to_euc_E590[] = {
0, 0x525E, 0xB464, 0x3549, 0x3346, 0, 0, 0,
0x3967, 0x3548, 0x445F, 0x3125, 0x4631, 0x4C3E, 0x3921, 0x4D79,
@@ -3249,6 +5857,16 @@ static const unsigned short utf8_to_euc_E590[] = {
0, 0xB46C, 0, 0, 0xB46D, 0xB46E, 0x5265, 0,
0x355B, 0x3F61, 0, 0x4A2D, 0x5263, 0x525F, 0x3863, 0,
};
+static const unsigned short utf8_to_euc_E590_x0213[] = {
+ 0, 0x525E, 0xB464, 0x3549, 0x3346, 0, 0, 0,
+ 0x3967, 0x3548, 0x445F, 0x3125, 0x4631, 0x4C3E, 0x3921, 0x4D79,
+ 0x4547, 0x387E, 0x2E75, 0xB465, 0, 0, 0, 0,
+ 0, 0, 0xB466, 0x372F, 0, 0x5267, 0x4F7E, 0x3663,
+ 0x4B4A, 0xB467, 0, 0, 0xA365, 0, 0x485D, 0x2E76,
+ 0xA366, 0x5266, 0xB46A, 0x345E, 0x5261, 0x5262, 0x5264, 0xB46B,
+ 0, 0xB46C, 0, 0, 0xB46D, 0xB46E, 0x5265, 0,
+ 0x355B, 0x3F61, 0, 0x4A2D, 0x5263, 0x525F, 0x3863, 0,
+};
static const unsigned short utf8_to_euc_E591[] = {
0x5260, 0, 0x4F24, 0xB46F, 0xB470, 0, 0x4A72, 0xB471,
0x4468, 0x3862, 0x3970, 0, 0, 0xB472, 0x5268, 0xB473,
@@ -3259,6 +5877,16 @@ static const unsigned short utf8_to_euc_E591[] = {
0x526F, 0x526D, 0, 0x4C23, 0xB47D, 0x526A, 0x5273, 0x526E,
0, 0, 0, 0x5271, 0x3846, 0x4C3F, 0, 0xB47E,
};
+static const unsigned short utf8_to_euc_E591_x0213[] = {
+ 0x5260, 0, 0x4F24, 0xA368, 0xB470, 0, 0x4A72, 0xB471,
+ 0x4468, 0x3862, 0x3970, 0, 0, 0x2E77, 0x5268, 0xB473,
+ 0, 0x465D, 0, 0, 0, 0xA364, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0xB474, 0x526C,
+ 0, 0, 0xA369, 0, 0xB476, 0, 0xA36A, 0xB478,
+ 0x3C7E, 0xB479, 0x3C76, 0x2E79, 0xA36B, 0xB47B, 0xB47C, 0,
+ 0x526F, 0x526D, 0, 0x4C23, 0x2E7A, 0x526A, 0x5273, 0x526E,
+ 0, 0, 0, 0x5271, 0x3846, 0x4C3F, 0, 0x2E7B,
+};
static const unsigned short utf8_to_euc_E592[] = {
0x5272, 0xB521, 0, 0xB522, 0x5274, 0xB523, 0x5276, 0,
0xB524, 0xB525, 0xF435, 0x3A70, 0x4F42, 0xB526, 0x526B, 0x5269,
@@ -3269,6 +5897,16 @@ static const unsigned short utf8_to_euc_E592[] = {
0, 0xB533, 0x3A69, 0x3331, 0, 0, 0, 0xB534,
0x5279, 0xB535, 0xB536, 0xB537, 0x5325, 0x3076, 0x5324, 0xB538,
};
+static const unsigned short utf8_to_euc_E592_x0213[] = {
+ 0x5272, 0xB521, 0, 0xB522, 0x5274, 0xB523, 0x5276, 0,
+ 0x2E7C, 0xB525, 0xA36C, 0x3A70, 0x4F42, 0xA36D, 0x526B, 0x5269,
+ 0x5275, 0xB527, 0x5270, 0, 0, 0xA36E, 0x2E7D, 0,
+ 0, 0, 0, 0, 0x2E78, 0, 0, 0xB52B,
+ 0xA36F, 0x2E7E, 0x5278, 0, 0x5323, 0x527A, 0xA370, 0xB52E,
+ 0x527E, 0x2F21, 0xB530, 0x5321, 0x527B, 0xA371, 0xA372, 0x533E,
+ 0, 0xB533, 0x3A69, 0x3331, 0, 0, 0, 0xA373,
+ 0x5279, 0xB535, 0xA374, 0xB537, 0x5325, 0x3076, 0x5324, 0xA375,
+};
static const unsigned short utf8_to_euc_E593[] = {
0x3025, 0x494A, 0x5322, 0, 0x527C, 0, 0xB539, 0x5277,
0x527D, 0x3A48, 0xB53A, 0, 0, 0xB53B, 0xB53C, 0,
@@ -3279,6 +5917,16 @@ static const unsigned short utf8_to_euc_E593[] = {
0, 0, 0x452F, 0, 0, 0, 0xB541, 0,
0, 0, 0x532E, 0, 0xB542, 0x532B, 0xB543, 0xB544,
};
+static const unsigned short utf8_to_euc_E593_x0213[] = {
+ 0x3025, 0x494A, 0x5322, 0xA376, 0x527C, 0, 0x2F22, 0x5277,
+ 0x527D, 0x3A48, 0xB53A, 0, 0, 0xB53B, 0xB53C, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0x5326, 0, 0, 0, 0, 0, 0, 0,
+ 0xB53D, 0x3077, 0x532F, 0, 0, 0x5327, 0x5328, 0,
+ 0x3E25, 0x4B69, 0xB53E, 0, 0xA378, 0x532D, 0x532C, 0xA379,
+ 0, 0xA37A, 0x452F, 0xA37B, 0, 0, 0xB541, 0,
+ 0, 0, 0x532E, 0, 0xB542, 0x532B, 0xB543, 0x2F23,
+};
static const unsigned short utf8_to_euc_E594[] = {
0xB545, 0xB546, 0, 0, 0x3134, 0xB547, 0x3A36, 0x3F30,
0xB548, 0xB549, 0, 0, 0xB54A, 0xB54B, 0xB54C, 0x5329,
@@ -3289,6 +5937,16 @@ static const unsigned short utf8_to_euc_E594[] = {
0, 0x3E27, 0xB550, 0x533A, 0, 0xB551, 0xB552, 0,
0x5339, 0x5330, 0, 0xB553, 0xB554, 0xB555, 0x4243, 0,
};
+static const unsigned short utf8_to_euc_E594_x0213[] = {
+ 0xA37C, 0xA37D, 0, 0, 0x3134, 0xB547, 0x3A36, 0x3F30,
+ 0xB548, 0xA37E, 0, 0, 0xB54A, 0xB54B, 0x2F24, 0x5329,
+ 0x4562, 0, 0, 0, 0x532A, 0xB54D, 0x3022, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0xB54E, 0x2F25, 0, 0, 0x5334, 0x4D23,
+ 0, 0x3E27, 0xB550, 0x533A, 0, 0x2F26, 0xB552, 0,
+ 0x5339, 0x5330, 0, 0xB553, 0xA421, 0xB555, 0x4243, 0,
+};
static const unsigned short utf8_to_euc_E595[] = {
0x5331, 0xB556, 0, 0, 0x426F, 0x5336, 0x3E26, 0xB557,
0, 0xB558, 0xB559, 0, 0x5333, 0xB55A, 0, 0x4C64,
@@ -3299,6 +5957,16 @@ static const unsigned short utf8_to_euc_E595[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0x5341, 0x5346, 0, 0x5342, 0xB565,
};
+static const unsigned short utf8_to_euc_E595_x0213[] = {
+ 0x5331, 0xA422, 0, 0, 0x426F, 0x5336, 0x3E26, 0xA424,
+ 0, 0xB558, 0xA425, 0, 0x5333, 0xB55A, 0, 0x4C64,
+ 0x2F27, 0xB55C, 0, 0x373C, 0, 0, 0x5337, 0x5338,
+ 0xB55D, 0, 0xB55E, 0xB55F, 0x5335, 0x533B, 0x2F28, 0,
+ 0xA427, 0xA428, 0, 0x5332, 0xA429, 0, 0xB564, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0x5341, 0x5346, 0xA42B, 0x5342, 0xB565,
+};
static const unsigned short utf8_to_euc_E596[] = {
0x533D, 0xB566, 0xB567, 0x5347, 0x4131, 0, 0xB568, 0x5349,
0xB569, 0x3922, 0x533F, 0x437D, 0, 0, 0xB56A, 0xB56B,
@@ -3309,6 +5977,16 @@ static const unsigned short utf8_to_euc_E596[] = {
0x3674, 0, 0xB574, 0, 0, 0, 0x3144, 0,
0, 0, 0, 0, 0, 0, 0, 0xB575,
};
+static const unsigned short utf8_to_euc_E596_x0213[] = {
+ 0x533D, 0x2F29, 0xA42C, 0x5347, 0x4131, 0, 0x2F2A, 0x5349,
+ 0xA42D, 0x3922, 0x533F, 0x437D, 0, 0, 0x2F2B, 0xB56B,
+ 0, 0xA42E, 0xB56D, 0xB56E, 0xB56F, 0, 0, 0xB570,
+ 0x5343, 0x533C, 0x342D, 0, 0x346E, 0x3365, 0x5344, 0x5340,
+ 0, 0, 0, 0xB571, 0xB572, 0, 0, 0x3776,
+ 0x534A, 0x5348, 0x4153, 0x354A, 0x362C, 0x2F2D, 0x5345, 0,
+ 0x3674, 0, 0xB574, 0, 0, 0, 0x3144, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0xA433,
+};
static const unsigned short utf8_to_euc_E597[] = {
0, 0xB576, 0, 0xB577, 0x534E, 0x534C, 0xB578, 0x5427,
0, 0xB579, 0, 0xB57A, 0xB57B, 0, 0xB57C, 0,
@@ -3319,6 +5997,16 @@ static const unsigned short utf8_to_euc_E597[] = {
0, 0, 0, 0, 0, 0, 0xB628, 0x5353,
0, 0x5358, 0, 0, 0, 0x5356, 0x5355, 0xB629,
};
+static const unsigned short utf8_to_euc_E597_x0213[] = {
+ 0, 0xB576, 0, 0xB577, 0x534E, 0x534C, 0xB578, 0x5427,
+ 0, 0xA434, 0, 0xB57A, 0xA435, 0, 0x2F2E, 0,
+ 0, 0xA436, 0xA430, 0xB621, 0x5351, 0, 0, 0xB622,
+ 0xB623, 0, 0x534B, 0xB624, 0x534F, 0xA437, 0xB625, 0x534D,
+ 0, 0, 0xA439, 0x3B4C, 0x5350, 0, 0, 0,
+ 0, 0xA43B, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0xB628, 0x5353,
+ 0, 0x5358, 0, 0, 0, 0x5356, 0x5355, 0xB629,
+};
static const unsigned short utf8_to_euc_E598[] = {
0, 0, 0, 0, 0, 0xB62A, 0x4332, 0,
0xB62B, 0x3245, 0xB62C, 0, 0, 0xB62D, 0xB62E, 0xB62F,
@@ -3329,6 +6017,16 @@ static const unsigned short utf8_to_euc_E598[] = {
0xB635, 0x3E7C, 0x535E, 0xB636, 0x535C, 0xB637, 0x535D, 0xB638,
0x535F, 0xB639, 0, 0xB63A, 0xB63B, 0xB63C, 0, 0xB63D,
};
+static const unsigned short utf8_to_euc_E598_x0213[] = {
+ 0, 0, 0, 0, 0, 0xB62A, 0x4332, 0xA43E,
+ 0x2F30, 0x3245, 0xB62C, 0, 0, 0xB62D, 0x2F31, 0xB62F,
+ 0xA43F, 0xB631, 0xB632, 0, 0x5352, 0, 0x5354, 0x3E28,
+ 0x3133, 0xB633, 0, 0x5357, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0xA43C, 0x325E, 0, 0, 0xB634, 0, 0, 0x5362,
+ 0xA440, 0x3E7C, 0x535E, 0xB636, 0x535C, 0xB637, 0x535D, 0xA441,
+ 0x535F, 0xB639, 0, 0x2F32, 0xB63B, 0xA443, 0, 0xA444,
+};
static const unsigned short utf8_to_euc_E599[] = {
0xB63E, 0xB63F, 0x313D, 0xB640, 0xB641, 0, 0xB642, 0,
0, 0xB643, 0, 0xB644, 0x4139, 0xB645, 0x5359, 0xB646,
@@ -3339,6 +6037,16 @@ static const unsigned short utf8_to_euc_E599[] = {
0, 0xB651, 0xB652, 0, 0x4A2E, 0xB653, 0, 0,
0x4655, 0, 0x4838, 0, 0, 0, 0, 0,
};
+static const unsigned short utf8_to_euc_E599_x0213[] = {
+ 0xA445, 0xB63F, 0x313D, 0xB640, 0xB641, 0, 0xB642, 0xA446,
+ 0, 0x2F33, 0, 0xB644, 0x4139, 0xB645, 0x5359, 0xB646,
+ 0x535A, 0, 0, 0x7427, 0xB647, 0, 0, 0,
+ 0, 0, 0, 0x337A, 0, 0, 0xA447, 0,
+ 0xA448, 0xB64A, 0xB64B, 0xB64C, 0x5361, 0, 0x2F35, 0,
+ 0x346F, 0xB64E, 0x5364, 0x5360, 0x5363, 0xA449, 0, 0x2F37,
+ 0, 0x2F38, 0x2F39, 0, 0x4A2E, 0xB653, 0x2F34, 0,
+ 0x4655, 0, 0x4838, 0, 0, 0, 0, 0,
+};
static const unsigned short utf8_to_euc_E59A[] = {
0x5366, 0, 0, 0, 0xB654, 0xB655, 0x5365, 0x3345,
0xB656, 0, 0x5367, 0xB657, 0xB658, 0, 0, 0x536A,
@@ -3349,6 +6057,16 @@ static const unsigned short utf8_to_euc_E59A[] = {
0, 0xB666, 0, 0xB667, 0x536E, 0, 0x536D, 0xB668,
0, 0, 0, 0, 0x5370, 0, 0xB669, 0,
};
+static const unsigned short utf8_to_euc_E59A_x0213[] = {
+ 0x5366, 0, 0, 0, 0xB654, 0xB655, 0x5365, 0x3345,
+ 0xA44B, 0, 0x5367, 0xB657, 0xA44C, 0, 0, 0x536A,
+ 0, 0, 0, 0, 0x5369, 0xA44D, 0, 0,
+ 0, 0x2F3A, 0xA44E, 0, 0, 0xA44F, 0x2F3B, 0xB65E,
+ 0x5368, 0, 0x4739, 0, 0, 0x536B, 0xB65F, 0xB660,
+ 0xA450, 0x2F3C, 0, 0xB663, 0x2F3D, 0xA451, 0x536C, 0,
+ 0, 0xB666, 0xA452, 0x2F3E, 0x536E, 0, 0x536D, 0xB668,
+ 0, 0, 0, 0, 0x5370, 0, 0xB669, 0,
+};
static const unsigned short utf8_to_euc_E59B[] = {
0x5373, 0x5371, 0x536F, 0x5372, 0, 0xB66A, 0, 0,
0x5374, 0xB66B, 0xB66C, 0xB66D, 0xB670, 0xB671, 0x5375, 0xB66E,
@@ -3359,6 +6077,16 @@ static const unsigned short utf8_to_euc_E59B[] = {
0x3A24, 0xB67C, 0x304F, 0x3F5E, 0, 0, 0xB721, 0xB722,
0, 0x537A, 0x3847, 0, 0, 0x3971, 0, 0x537C,
};
+static const unsigned short utf8_to_euc_E59B_x0213[] = {
+ 0x5373, 0x5371, 0x536F, 0x5372, 0, 0xA453, 0, 0,
+ 0x5374, 0x2F3F, 0x2F40, 0xB66D, 0xB670, 0xA454, 0x5375, 0xB66E,
+ 0xB66F, 0x5376, 0, 0x5377, 0, 0, 0, 0x5378,
+ 0x5145, 0xB672, 0x3C7C, 0x3B4D, 0xB673, 0xB674, 0x3273, 0xA455,
+ 0x3078, 0xB676, 0, 0x4344, 0xB677, 0xB678, 0xB679, 0xB67A,
+ 0xA456, 0, 0, 0xB67D, 0, 0xB67E, 0x5379, 0,
+ 0x3A24, 0xB67C, 0x304F, 0x3F5E, 0, 0, 0xA457, 0xA458,
+ 0, 0x537A, 0x3847, 0, 0, 0x3971, 0, 0x537C,
+};
static const unsigned short utf8_to_euc_E59C[] = {
0x537B, 0xB723, 0xB724, 0x4A60, 0x537D, 0, 0, 0xB725,
0x5421, 0x537E, 0xB726, 0x5422, 0xB727, 0x5423, 0, 0x3777,
@@ -3369,6 +6097,16 @@ static const unsigned short utf8_to_euc_E59C[] = {
0x434F, 0, 0, 0xB737, 0xB738, 0, 0, 0x542A,
0x542B, 0, 0, 0x542D, 0, 0xB739, 0xB73A, 0xB73B,
};
+static const unsigned short utf8_to_euc_E59C_x0213[] = {
+ 0x537B, 0xB723, 0xB724, 0x4A60, 0x537D, 0, 0, 0xB725,
+ 0x5421, 0x537E, 0x2F41, 0x5422, 0xB727, 0x5423, 0, 0x3777,
+ 0, 0xB728, 0x3160, 0x5424, 0, 0xA45A, 0x5426, 0,
+ 0x5425, 0, 0xB72A, 0xB72B, 0x5428, 0xB72C, 0, 0x455A,
+ 0xB72D, 0x2F43, 0xB72E, 0xA45B, 0xB730, 0xB731, 0x5429, 0x3035,
+ 0x3A5F, 0xA45D, 0xB733, 0, 0xB734, 0x373D, 0xB735, 0x2F44,
+ 0x434F, 0, 0, 0x2F45, 0x2F46, 0, 0, 0x542A,
+ 0x542B, 0, 0, 0x542D, 0, 0xB739, 0xB73A, 0xB73B,
+};
static const unsigned short utf8_to_euc_E59D[] = {
0x542E, 0, 0x3A64, 0, 0, 0xB73C, 0xB73D, 0x3651,
0, 0, 0x4B37, 0, 0xB73E, 0xB73F, 0x542C, 0x542F,
@@ -3379,6 +6117,16 @@ static const unsigned short utf8_to_euc_E59D[] = {
0xB749, 0xB74A, 0, 0xB74B, 0xB74C, 0xB74D, 0, 0xB74E,
0, 0xB74F, 0xB750, 0xB751, 0xB752, 0, 0xB753, 0x5434,
};
+static const unsigned short utf8_to_euc_E59D_x0213[] = {
+ 0x542E, 0, 0x3A64, 0, 0, 0xA45F, 0xA460, 0x3651,
+ 0, 0, 0x4B37, 0, 0xA461, 0xA462, 0x542C, 0x542F,
+ 0x3A41, 0x3923, 0xB740, 0, 0, 0, 0, 0,
+ 0, 0xF436, 0, 0, 0, 0, 0, 0,
+ 0, 0x5433, 0xB741, 0, 0x3A25, 0xB742, 0x4333, 0xB743,
+ 0xA464, 0x5430, 0x445A, 0xB745, 0, 0xB746, 0xB747, 0xA465,
+ 0x2F47, 0xB74A, 0, 0xA466, 0xA467, 0xA468, 0, 0x2F48,
+ 0, 0xB74F, 0xB750, 0xA469, 0x2F49, 0, 0xB753, 0x5434,
+};
static const unsigned short utf8_to_euc_E59E[] = {
0, 0xB754, 0x3F62, 0xB755, 0, 0, 0, 0,
0x5432, 0x5435, 0, 0x373F, 0xB756, 0, 0, 0,
@@ -3389,6 +6137,16 @@ static const unsigned short utf8_to_euc_E59E[] = {
0x543B, 0, 0, 0x5438, 0, 0, 0, 0,
0xB765, 0, 0, 0, 0, 0xB766, 0, 0,
};
+static const unsigned short utf8_to_euc_E59E_x0213[] = {
+ 0, 0xB754, 0x3F62, 0xB755, 0, 0, 0, 0,
+ 0x5432, 0x5435, 0, 0x373F, 0xB756, 0, 0, 0,
+ 0, 0, 0, 0x5436, 0xB757, 0xB760, 0, 0xB758,
+ 0, 0xB759, 0xA46D, 0, 0x2F4A, 0xA46E, 0xA46F, 0xB75E,
+ 0x5437, 0xB75F, 0x3924, 0x3340, 0x5439, 0, 0, 0xB761,
+ 0xA470, 0xB763, 0x543A, 0, 0xA46C, 0, 0, 0,
+ 0x543B, 0, 0, 0x5438, 0, 0, 0, 0,
+ 0x2F4D, 0, 0, 0, 0, 0xB766, 0, 0,
+};
static const unsigned short utf8_to_euc_E59F[] = {
0x5431, 0, 0, 0x543C, 0, 0, 0x543D, 0xB767,
0xB768, 0, 0, 0x4B64, 0xB769, 0, 0x3E6B, 0xB76A,
@@ -3399,6 +6157,16 @@ static const unsigned short utf8_to_euc_E59F[] = {
0xB773, 0, 0, 0, 0x3E7D, 0xB774, 0xB775, 0x3C39,
0xB776, 0x475D, 0x3470, 0, 0x3A6B, 0xB777, 0xB778, 0xB779,
};
+static const unsigned short utf8_to_euc_E59F_x0213[] = {
+ 0x5431, 0, 0, 0x543C, 0, 0, 0x543D, 0x2F4E,
+ 0x2F4F, 0, 0, 0x4B64, 0xA473, 0, 0x3E6B, 0x2F50,
+ 0, 0, 0x543F, 0x5440, 0x543E, 0xB76B, 0x5442, 0xA471,
+ 0, 0, 0, 0, 0x4738, 0xB76C, 0xA476, 0x3068,
+ 0x4956, 0xB77E, 0, 0x5443, 0x2F51, 0, 0xA477, 0xB770,
+ 0, 0xB771, 0, 0, 0, 0x2F52, 0, 0,
+ 0xA478, 0, 0, 0, 0x3E7D, 0x2F53, 0x2F54, 0x3C39,
+ 0xA47A, 0x475D, 0x3470, 0xA47B, 0x3A6B, 0xA47C, 0xB778, 0x2F55,
+};
static const unsigned short utf8_to_euc_E5A0[] = {
0x4B59, 0, 0x4632, 0xB77A, 0xB77B, 0x3778, 0x424F, 0,
0xB77C, 0xB77D, 0x5441, 0x5444, 0xB821, 0xB822, 0, 0,
@@ -3409,6 +6177,16 @@ static const unsigned short utf8_to_euc_E5A0[] = {
0x3161, 0x4A73, 0xB82A, 0, 0x3E6C, 0x4548, 0, 0,
0, 0xB82B, 0x3A66, 0, 0, 0x544E, 0, 0xB82C,
};
+static const unsigned short utf8_to_euc_E5A0_x0213[] = {
+ 0x4B59, 0, 0x4632, 0xB77A, 0xA47D, 0x3778, 0x424F, 0,
+ 0xB77C, 0x2F56, 0x5441, 0x5444, 0xB821, 0xB822, 0, 0,
+ 0, 0, 0, 0, 0, 0x4244, 0, 0,
+ 0, 0x5445, 0, 0xB823, 0, 0x5446, 0xA47E, 0xB825,
+ 0xA521, 0x5448, 0, 0, 0x4469, 0, 0xB827, 0xA522,
+ 0, 0, 0x342E, 0, 0, 0xB829, 0, 0x7421,
+ 0x3161, 0x4A73, 0xA523, 0, 0x3E6C, 0x4548, 0, 0,
+ 0, 0xA524, 0x3A66, 0, 0, 0x544E, 0, 0xB82C,
+};
static const unsigned short utf8_to_euc_E5A1[] = {
0x4A3D, 0x4E5D, 0, 0, 0, 0, 0, 0,
0, 0xB82D, 0x3274, 0x544A, 0xB82E, 0xB82F, 0, 0xB830,
@@ -3419,6 +6197,16 @@ static const unsigned short utf8_to_euc_E5A1[] = {
0x544B, 0, 0x5447, 0, 0, 0x3F50, 0, 0,
0xB838, 0x544F, 0, 0, 0xB839, 0, 0x3D4E, 0xB83A,
};
+static const unsigned short utf8_to_euc_E5A1_x0213[] = {
+ 0x4A3D, 0x4E5D, 0, 0, 0, 0, 0, 0,
+ 0, 0xA526, 0x3274, 0x544A, 0xA527, 0xB82F, 0, 0xB830,
+ 0xB831, 0x413A, 0x544D, 0, 0x4563, 0xB832, 0, 0x4549,
+ 0x4564, 0x4839, 0x444D, 0, 0, 0, 0x3A49, 0xB833,
+ 0, 0x2F58, 0x5449, 0, 0x2F59, 0, 0, 0xA528,
+ 0xB837, 0x3176, 0, 0x4536, 0, 0, 0, 0,
+ 0x544B, 0, 0x5447, 0, 0, 0x3F50, 0, 0,
+ 0xB838, 0x544F, 0, 0, 0x2F5B, 0, 0x3D4E, 0xB83A,
+};
static const unsigned short utf8_to_euc_E5A2[] = {
0xB83B, 0xB83C, 0, 0x362D, 0, 0x5450, 0, 0xB83D,
0xB83E, 0xB83F, 0xB840, 0, 0xB841, 0xB842, 0, 0xB843,
@@ -3429,6 +6217,16 @@ static const unsigned short utf8_to_euc_E5A2[] = {
0, 0xB84D, 0xB84E, 0x4A2F, 0, 0, 0, 0,
0x5457, 0x5451, 0x5454, 0x5456, 0xB850, 0, 0x3A26, 0,
};
+static const unsigned short utf8_to_euc_E5A2_x0213[] = {
+ 0xB83B, 0xB83C, 0, 0x362D, 0, 0x5450, 0, 0xB83D,
+ 0xB83E, 0x2F5C, 0xA529, 0xA52A, 0xB841, 0xA52B, 0, 0xA52C,
+ 0xA52D, 0, 0, 0x4A68, 0xA52E, 0, 0xB846, 0x417D,
+ 0, 0, 0, 0, 0x4446, 0xA52F, 0x2F5D, 0x5452,
+ 0xB848, 0xB849, 0xB84A, 0, 0, 0, 0xB84B, 0,
+ 0x4B4F, 0x2F5F, 0xA530, 0x5453, 0, 0, 0x5458, 0,
+ 0, 0xA531, 0xB84E, 0x4A2F, 0, 0, 0, 0,
+ 0x5457, 0x5451, 0x5454, 0x5456, 0xB850, 0, 0x3A26, 0,
+};
static const unsigned short utf8_to_euc_E5A3[] = {
0, 0x4A49, 0xB851, 0, 0xB84F, 0x5459, 0, 0x4345,
0xB852, 0, 0x3275, 0, 0x3E6D, 0xB853, 0xB854, 0,
@@ -3439,6 +6237,16 @@ static const unsigned short utf8_to_euc_E5A3[] = {
0x403C, 0x306D, 0x4764, 0xB85E, 0, 0, 0, 0x445B,
0, 0x5465, 0x5464, 0x5466, 0x5467, 0x5468, 0, 0,
};
+static const unsigned short utf8_to_euc_E5A3_x0213[] = {
+ 0, 0x4A49, 0xB851, 0xA533, 0xB84F, 0x5459, 0, 0x4345,
+ 0xB852, 0, 0x3275, 0, 0x3E6D, 0xA534, 0x2F62, 0,
+ 0xB855, 0x545B, 0x2F61, 0x545A, 0x2F63, 0x3968, 0xB858, 0x545C,
+ 0x545E, 0x545D, 0x2F64, 0, 0x5460, 0xB85A, 0x5455, 0x5462,
+ 0x2F65, 0xB85B, 0xA535, 0, 0x5461, 0x545F, 0, 0,
+ 0, 0x2F66, 0, 0x3B4E, 0x3F51, 0, 0x4154, 0x5463,
+ 0x403C, 0x306D, 0x4764, 0xA536, 0xA537, 0, 0, 0x445B,
+ 0, 0x5465, 0x5464, 0x5466, 0x5467, 0x5468, 0, 0,
+};
static const unsigned short utf8_to_euc_E5A4[] = {
0, 0, 0x5469, 0, 0, 0xB85F, 0xB860, 0,
0, 0x4A51, 0x546A, 0xB861, 0xB862, 0, 0, 0x3246,
@@ -3449,6 +6257,16 @@ static const unsigned short utf8_to_euc_E5A4[] = {
0xB86D, 0x3C3A, 0x5471, 0xB86E, 0, 0xB86F, 0xB870, 0x3050,
0x5472, 0, 0, 0, 0, 0, 0x5473, 0xB871,
};
+static const unsigned short utf8_to_euc_E5A4_x0213[] = {
+ 0, 0, 0x5469, 0, 0, 0xA538, 0xA539, 0,
+ 0, 0x4A51, 0x546A, 0xA53A, 0x2F67, 0xA53B, 0, 0x3246,
+ 0x546B, 0, 0xB863, 0xB864, 0xA53C, 0x4D3C, 0x3330, 0,
+ 0x5249, 0x3D48, 0x423F, 0x546C, 0x4C6B, 0xB867, 0, 0,
+ 0, 0xB868, 0x4C34, 0xB869, 0xA53D, 0x546E, 0, 0x4267,
+ 0xB86B, 0x4537, 0x4240, 0x4957, 0x546F, 0x5470, 0x317B, 0xB86C,
+ 0xB86D, 0x3C3A, 0x5471, 0xB86E, 0, 0xB86F, 0xB870, 0x3050,
+ 0x5472, 0, 0, 0, 0, 0xA540, 0x5473, 0xB871,
+};
static const unsigned short utf8_to_euc_E5A5[] = {
0, 0, 0, 0xB872, 0x3162, 0, 0xB873, 0x3471,
0x4660, 0x4A74, 0, 0, 0, 0, 0x5477, 0x4155,
@@ -3459,6 +6277,16 @@ static const unsigned short utf8_to_euc_E5A5[] = {
0, 0, 0xB922, 0x3D77, 0x455B, 0xB923, 0xB924, 0,
0x5521, 0xB925, 0, 0xB926, 0xB927, 0x3925, 0, 0,
};
+static const unsigned short utf8_to_euc_E5A5_x0213[] = {
+ 0, 0, 0, 0xB872, 0x3162, 0, 0xA542, 0x3471,
+ 0x4660, 0x4A74, 0, 0, 0, 0, 0x5477, 0x4155,
+ 0x5476, 0x3740, 0xB874, 0xB875, 0x4B5B, 0x5475, 0, 0x4565,
+ 0x5479, 0xB876, 0x5478, 0xA545, 0, 0x2F69, 0xB879, 0xA546,
+ 0x547B, 0xB87B, 0x547A, 0xB87C, 0, 0x317C, 0, 0x547C,
+ 0x3E29, 0x547E, 0x4325, 0xB87D, 0x547D, 0x2F6A, 0x4A33, 0xB921,
+ 0, 0, 0xB922, 0x3D77, 0x455B, 0xA548, 0xA549, 0,
+ 0x5521, 0xB925, 0, 0xB926, 0xA54A, 0x3925, 0, 0,
+};
static const unsigned short utf8_to_euc_E5A6[] = {
0, 0x5522, 0x4721, 0x485E, 0x4C51, 0, 0, 0,
0, 0, 0x4725, 0xB928, 0xB929, 0x552B, 0xB92A, 0,
@@ -3469,6 +6297,16 @@ static const unsigned short utf8_to_euc_E5A6[] = {
0xB934, 0, 0x5527, 0xB935, 0, 0, 0, 0xB936,
0, 0x4B65, 0xB937, 0x3A4A, 0xB938, 0, 0x3E2A, 0,
};
+static const unsigned short utf8_to_euc_E5A6_x0213[] = {
+ 0, 0x5522, 0x4721, 0x485E, 0x4C51, 0, 0, 0,
+ 0, 0, 0x4725, 0x2F6B, 0xB929, 0x552B, 0xB92A, 0,
+ 0, 0, 0x2F6C, 0x3538, 0, 0xB92C, 0x4D45, 0xB92D,
+ 0, 0x4C2F, 0, 0x562C, 0, 0x5523, 0, 0xA54B,
+ 0, 0, 0, 0x5526, 0x2F6D, 0x4245, 0, 0xB930,
+ 0x4B38, 0, 0, 0, 0x454A, 0xB931, 0xA54C, 0xB933,
+ 0xB934, 0, 0x5527, 0xB935, 0, 0, 0, 0xB936,
+ 0, 0x4B65, 0xB937, 0x3A4A, 0xA54D, 0, 0x3E2A, 0,
+};
static const unsigned short utf8_to_euc_E5A7[] = {
0, 0xB939, 0, 0xB93A, 0xB93B, 0, 0x5528, 0,
0xB93C, 0x3B50, 0xB93D, 0x3B4F, 0, 0xB93E, 0, 0,
@@ -3479,6 +6317,16 @@ static const unsigned short utf8_to_euc_E5A7[] = {
0, 0xB948, 0xB949, 0, 0xB94A, 0, 0x3028, 0xB94B,
0, 0, 0, 0x3079, 0, 0, 0, 0x3B51,
};
+static const unsigned short utf8_to_euc_E5A7_x0213[] = {
+ 0, 0xB939, 0, 0x2F6E, 0xB93B, 0, 0x5528, 0,
+ 0xA54E, 0x3B50, 0xB93D, 0x3B4F, 0, 0xA54F, 0, 0,
+ 0x3039, 0x3848, 0x2F6F, 0x402B, 0x3051, 0, 0, 0,
+ 0, 0x552C, 0x552D, 0, 0x552A, 0x2F70, 0xA550, 0xB942,
+ 0, 0, 0, 0xA551, 0xA552, 0x3138, 0x342F, 0xA553,
+ 0x5529, 0, 0x4C45, 0x4931, 0, 0, 0xA554, 0xB947,
+ 0, 0xB948, 0xB949, 0, 0xB94A, 0, 0x3028, 0xB94B,
+ 0x7E7A, 0, 0, 0x3079, 0, 0, 0, 0x3B51,
+};
static const unsigned short utf8_to_euc_E5A8[] = {
0xB94C, 0x3052, 0, 0x3023, 0xB94D, 0, 0, 0,
0, 0x5532, 0, 0, 0xB94E, 0xB94F, 0xB950, 0,
@@ -3489,6 +6337,16 @@ static const unsigned short utf8_to_euc_E5A8[] = {
0xB95A, 0, 0, 0, 0, 0x5537, 0x5538, 0,
0, 0, 0, 0, 0x3E2B, 0, 0, 0,
};
+static const unsigned short utf8_to_euc_E5A8_x0213[] = {
+ 0xB94C, 0x3052, 0, 0x3023, 0xB94D, 0, 0, 0,
+ 0, 0x5532, 0, 0, 0xA558, 0xA559, 0xB950, 0,
+ 0, 0x5530, 0xB951, 0x2F71, 0, 0, 0, 0xA55A,
+ 0x4C3C, 0, 0x5533, 0, 0x5531, 0, 0xB953, 0x552F,
+ 0x3F31, 0, 0, 0x2F72, 0xB955, 0x552E, 0, 0xA55B,
+ 0xB957, 0x4A5A, 0xB958, 0, 0, 0xA55C, 0, 0x3864,
+ 0xB95A, 0, 0, 0, 0, 0x5537, 0x5538, 0,
+ 0, 0, 0, 0, 0x3E2B, 0, 0, 0,
+};
static const unsigned short utf8_to_euc_E5A9[] = {
0x5534, 0x4F2C, 0, 0, 0xB95B, 0xB95C, 0x474C, 0xB95D,
0xB95E, 0x5536, 0, 0, 0xB95F, 0, 0, 0,
@@ -3499,6 +6357,16 @@ static const unsigned short utf8_to_euc_E5A9[] = {
0, 0, 0, 0, 0, 0, 0, 0xB967,
0, 0, 0xB968, 0xB969, 0, 0, 0xB96A, 0x4C3B,
};
+static const unsigned short utf8_to_euc_E5A9_x0213[] = {
+ 0x5534, 0x4F2C, 0, 0, 0xB95B, 0xB95C, 0x474C, 0xB95D,
+ 0xB95E, 0x5536, 0, 0, 0xB95F, 0, 0, 0,
+ 0xB960, 0, 0, 0, 0, 0xA55D, 0, 0,
+ 0, 0, 0x3A27, 0, 0, 0, 0xB962, 0,
+ 0, 0, 0x5539, 0xB963, 0, 0xA55E, 0x4958, 0x2F73,
+ 0, 0, 0x553A, 0, 0x5535, 0x2F74, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0x2F75,
+ 0, 0, 0xA55F, 0xB969, 0, 0, 0x2F76, 0x4C3B,
+};
static const unsigned short utf8_to_euc_E5AA[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0xB96B, 0, 0, 0, 0,
@@ -3509,6 +6377,16 @@ static const unsigned short utf8_to_euc_E5AA[] = {
0, 0xB977, 0xB978, 0xB979, 0, 0xB97A, 0, 0,
0xB97B, 0, 0xB97C, 0xB97D, 0x553C, 0x5540, 0x553D, 0xB97E,
};
+static const unsigned short utf8_to_euc_E5AA_x0213[] = {
+ 0, 0, 0, 0, 0x2F77, 0, 0, 0,
+ 0, 0, 0, 0xA560, 0, 0, 0, 0,
+ 0xB96C, 0, 0x475E, 0xB96D, 0, 0, 0xB96E, 0,
+ 0, 0xB96F, 0x553B, 0x4932, 0xA561, 0, 0x2F78, 0xA562,
+ 0xA563, 0, 0xA564, 0, 0, 0, 0, 0x2F79,
+ 0, 0, 0, 0, 0xB976, 0, 0, 0,
+ 0, 0xA565, 0xB978, 0xA566, 0, 0xA567, 0, 0,
+ 0xB97B, 0, 0xA568, 0xB97D, 0x553C, 0x5540, 0x553D, 0xA569,
+};
static const unsigned short utf8_to_euc_E5AB[] = {
0, 0x3247, 0x553F, 0, 0xBA21, 0, 0xBA22, 0,
0xBA23, 0x3C3B, 0, 0x553E, 0x3779, 0, 0, 0xBA24,
@@ -3519,6 +6397,16 @@ static const unsigned short utf8_to_euc_E5AB[] = {
0, 0, 0, 0, 0, 0xBA2B, 0xBA2C, 0,
0, 0, 0x5546, 0x5547, 0, 0xBA2D, 0, 0,
};
+static const unsigned short utf8_to_euc_E5AB_x0213[] = {
+ 0, 0x3247, 0x553F, 0, 0x2F7A, 0, 0xBA22, 0,
+ 0xBA23, 0x3C3B, 0, 0x553E, 0x3779, 0, 0, 0xBA24,
+ 0x554C, 0, 0, 0, 0, 0, 0x5545, 0x5542,
+ 0, 0, 0xA56A, 0, 0xA56B, 0, 0, 0,
+ 0xA56C, 0x4364, 0, 0x5541, 0, 0xA56D, 0x5543, 0,
+ 0, 0x5544, 0xBA29, 0, 0, 0, 0xA56F, 0,
+ 0xA56E, 0, 0, 0, 0, 0xA570, 0xBA2C, 0,
+ 0, 0, 0x5546, 0x5547, 0, 0xBA2D, 0, 0,
+};
static const unsigned short utf8_to_euc_E5AC[] = {
0xBA2E, 0xBA2F, 0, 0, 0, 0, 0, 0,
0xBA30, 0x3472, 0, 0x5549, 0x5548, 0, 0, 0,
@@ -3529,6 +6417,16 @@ static const unsigned short utf8_to_euc_E5AC[] = {
0x3145, 0, 0x554B, 0, 0xBA32, 0, 0x554E, 0,
0xBA39, 0, 0, 0, 0, 0, 0x554F, 0,
};
+static const unsigned short utf8_to_euc_E5AC_x0213[] = {
+ 0xA571, 0xBA2F, 0, 0, 0, 0, 0, 0,
+ 0xA572, 0x3472, 0, 0x5549, 0x5548, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0x554A, 0xA573,
+ 0, 0x2F7C, 0, 0xBA34, 0, 0xBA35, 0, 0,
+ 0, 0xBA36, 0x3E6E, 0, 0, 0x2F7D, 0, 0,
+ 0, 0, 0x554D, 0, 0x445C, 0xA575, 0, 0,
+ 0x3145, 0, 0x554B, 0, 0xA574, 0, 0x554E, 0,
+ 0xBA39, 0, 0, 0, 0, 0, 0x554F, 0,
+};
static const unsigned short utf8_to_euc_E5AD[] = {
0x5552, 0xBA3A, 0, 0x5550, 0, 0x5551, 0, 0,
0, 0, 0, 0xBA3B, 0xBA3C, 0, 0, 0,
@@ -3539,6 +6437,16 @@ static const unsigned short utf8_to_euc_E5AD[] = {
0x5559, 0x5623, 0, 0x555A, 0, 0x555B, 0, 0,
0x555C, 0, 0x555E, 0, 0xBA43, 0xBA44, 0xBA45, 0xBA46,
};
+static const unsigned short utf8_to_euc_E5AD_x0213[] = {
+ 0x5552, 0x4F55, 0, 0x5550, 0, 0x5551, 0, 0,
+ 0, 0, 0, 0xBA3B, 0xA576, 0, 0, 0,
+ 0x3B52, 0x5553, 0xA577, 0, 0x3926, 0x5554, 0x4F56, 0x3B7A,
+ 0x4238, 0, 0x5555, 0x5556, 0x3B5A, 0x3927, 0xBA3F, 0x4C52,
+ 0, 0, 0, 0x3528, 0x3849, 0x5557, 0x3358, 0,
+ 0xA578, 0x5558, 0, 0x4239, 0, 0, 0xBA41, 0xA579,
+ 0x5559, 0x5623, 0, 0x555A, 0, 0x555B, 0, 0,
+ 0x555C, 0, 0x555E, 0, 0xA57A, 0x4F57, 0xBA45, 0xA57B,
+};
static const unsigned short utf8_to_euc_E5AE[] = {
0x555F, 0xBA47, 0, 0x5560, 0xBA48, 0x4270, 0xBA49, 0x3127,
0x3C69, 0x3042, 0xBA4A, 0x4157, 0x3430, 0x3C35, 0xBA4B, 0x3928,
@@ -3549,6 +6457,16 @@ static const unsigned short utf8_to_euc_E5AE[] = {
0x3A4B, 0xBA56, 0xBA57, 0x3332, 0x3163, 0x3E2C, 0x3248, 0xBA58,
0x5562, 0x4D46, 0xBA59, 0, 0xBA5A, 0, 0, 0x3D49,
};
+static const unsigned short utf8_to_euc_E5AE_x0213[] = {
+ 0x555F, 0xA57C, 0, 0x5560, 0xA57D, 0x4270, 0xBA49, 0x3127,
+ 0x3C69, 0x3042, 0xBA4A, 0x4157, 0x3430, 0x3C35, 0xBA4B, 0x3928,
+ 0xBA4C, 0xBA4D, 0, 0x4F58, 0xBA4F, 0x4566, 0xA821, 0x3D21,
+ 0x3431, 0x4368, 0x446A, 0x3038, 0x3539, 0x4A75, 0, 0x3C42,
+ 0, 0, 0x3552, 0x406B, 0x3C3C, 0x4D28, 0x5561, 0,
+ 0xBA51, 0xBA52, 0, 0, 0xA822, 0xBA54, 0x355C, 0xBA55,
+ 0x3A4B, 0xBA56, 0xBA57, 0x3332, 0x3163, 0x3E2C, 0x3248, 0xBA58,
+ 0x5562, 0x4D46, 0xBA59, 0, 0xBA5A, 0, 0, 0x3D49,
+};
static const unsigned short utf8_to_euc_E5AF[] = {
0xBA5B, 0xBA5C, 0x3C64, 0x5563, 0x3473, 0x4652, 0x4C29, 0x5564,
0, 0x5565, 0, 0, 0x4959, 0xBA5D, 0, 0xBA5E,
@@ -3559,6 +6477,16 @@ static const unsigned short utf8_to_euc_E5AF[] = {
0x556E, 0xBA66, 0, 0x5570, 0xBA67, 0x437E, 0x556F, 0,
0x4023, 0, 0x3B7B, 0, 0, 0xBA68, 0x4250, 0x3C77,
};
+static const unsigned short utf8_to_euc_E5AF_x0213[] = {
+ 0xA824, 0xBA5C, 0x3C64, 0x5563, 0x3473, 0x4652, 0x4C29, 0x5564,
+ 0, 0x5565, 0, 0, 0x4959, 0xBA5D, 0xA826, 0xBA5E,
+ 0x5567, 0, 0x3428, 0x3677, 0x5566, 0, 0xA827, 0xBA60,
+ 0x4F59, 0xBA62, 0xBA63, 0x3432, 0, 0x3F32, 0x556B, 0x3B21,
+ 0xBA64, 0x3249, 0x556A, 0, 0x5568, 0x556C, 0x5569, 0x472B,
+ 0x5C4D, 0x3F33, 0, 0x556D, 0x4F5A, 0, 0x4E40, 0xBA65,
+ 0x556E, 0xA82A, 0, 0x5570, 0xBA67, 0x437E, 0x556F, 0,
+ 0x4023, 0, 0x3B7B, 0, 0, 0xA82B, 0x4250, 0x3C77,
+};
static const unsigned short utf8_to_euc_E5B0[] = {
0, 0x4975, 0x406C, 0, 0x3C4D, 0x5571, 0x3E2D, 0x5572,
0x5573, 0x3053, 0x423A, 0x3F52, 0xBA69, 0x5574, 0x4633, 0x3E2E,
@@ -3569,6 +6497,16 @@ static const unsigned short utf8_to_euc_E5B0[] = {
0xBA73, 0x3D22, 0xBA74, 0, 0, 0xBA75, 0xBA76, 0,
0x5579, 0x557A, 0x3C5C, 0x3F2C, 0x4674, 0x3F54, 0x4878, 0x4722,
};
+static const unsigned short utf8_to_euc_E5B0_x0213[] = {
+ 0, 0x4975, 0x406C, 0xA82D, 0x3C4D, 0x5571, 0x3E2D, 0x5572,
+ 0x5573, 0x3053, 0x423A, 0x3F52, 0xBA69, 0x5574, 0x4633, 0x3E2E,
+ 0, 0x3E2F, 0x4F5B, 0x5575, 0, 0, 0x406D, 0xBA6A,
+ 0, 0, 0x3E30, 0, 0, 0, 0x4F5C, 0xBA6C,
+ 0x5576, 0, 0x5577, 0x4F5D, 0x4C60, 0, 0xBA6E, 0,
+ 0x5578, 0xA82E, 0, 0x4F5E, 0xBA71, 0x3646, 0xBA72, 0,
+ 0xA82F, 0x3D22, 0xBA74, 0, 0, 0xBA75, 0xBA76, 0,
+ 0x5579, 0x557A, 0x3C5C, 0x3F2C, 0x4674, 0x3F54, 0x4878, 0x4722,
+};
static const unsigned short utf8_to_euc_E5B1[] = {
0x3649, 0x557B, 0, 0, 0, 0x356F, 0x557C, 0,
0x367E, 0, 0x464F, 0x3230, 0, 0x3B53, 0x557D, 0x5622,
@@ -3579,6 +6517,16 @@ static const unsigned short utf8_to_euc_E5B1[] = {
0xBB22, 0x3B33, 0, 0, 0xBB23, 0xBB24, 0x5627, 0,
0, 0x5628, 0xBB25, 0xBB26, 0xBB27, 0xBB28, 0, 0,
};
+static const unsigned short utf8_to_euc_E5B1_x0213[] = {
+ 0x3649, 0x557B, 0, 0, 0, 0x356F, 0x557C, 0,
+ 0x367E, 0, 0x464F, 0x3230, 0, 0x3B53, 0x557D, 0x5622,
+ 0x5621, 0x367D, 0, 0x557E, 0, 0x4538, 0, 0,
+ 0, 0xBA77, 0xBA78, 0x7E7B, 0xBA79, 0, 0x4230, 0xA831,
+ 0x454B, 0x3C48, 0x4F60, 0xA832, 0x4158, 0x4D7A, 0, 0xA833,
+ 0xA834, 0xA835, 0, 0, 0x5624, 0xBB21, 0x5625, 0x4656,
+ 0xA836, 0x3B33, 0, 0, 0xBB23, 0xBB24, 0x5627, 0,
+ 0, 0x5628, 0x4F64, 0xBB26, 0xA839, 0xBB28, 0, 0,
+};
static const unsigned short utf8_to_euc_E5B2[] = {
0, 0, 0, 0, 0, 0, 0, 0xBB29,
0xBB2A, 0, 0xBB2B, 0, 0x5629, 0, 0, 0xBB2C,
@@ -3589,6 +6537,16 @@ static const unsigned short utf8_to_euc_E5B2[] = {
0, 0x4252, 0xBB35, 0x3359, 0xBB36, 0xBB37, 0x562F, 0x5631,
0x345F, 0, 0xBB38, 0x562E, 0x5630, 0, 0x5633, 0,
};
+static const unsigned short utf8_to_euc_E5B2_x0213[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0xBB29,
+ 0xA83C, 0, 0xA83D, 0, 0x5629, 0, 0, 0x4F65,
+ 0x3474, 0x562A, 0xBB2D, 0, 0x562B, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0xBB2E, 0, 0x4F66,
+ 0xA841, 0x322C, 0xA842, 0x4F67, 0, 0, 0xA843, 0xA844,
+ 0x413B, 0x3464, 0x4F68, 0x562D, 0x4C28, 0xA846, 0, 0,
+ 0, 0x4252, 0xBB35, 0x3359, 0xBB36, 0xA847, 0x562F, 0x5631,
+ 0x345F, 0, 0x4F69, 0x562E, 0x5630, 0, 0x5633, 0,
+};
static const unsigned short utf8_to_euc_E5B3[] = {
0, 0, 0, 0, 0, 0x5632, 0, 0x5634,
0, 0xBB39, 0, 0xBB3A, 0, 0, 0, 0,
@@ -3599,6 +6557,16 @@ static const unsigned short utf8_to_euc_E5B3[] = {
0x4A76, 0xBB3F, 0xBB40, 0, 0xBB41, 0xF43B, 0x4567, 0,
0, 0, 0x5638, 0x3D54, 0, 0x5637, 0, 0,
};
+static const unsigned short utf8_to_euc_E5B3_x0213[] = {
+ 0, 0, 0, 0, 0, 0x5632, 0, 0x5634,
+ 0, 0xA849, 0, 0x4F6A, 0, 0, 0, 0,
+ 0x4F6B, 0, 0x4F6C, 0, 0, 0, 0, 0xBB3D,
+ 0, 0x5635, 0, 0, 0, 0xBB3C, 0, 0,
+ 0x463D, 0x362E, 0, 0, 0, 0, 0, 0,
+ 0x3265, 0x5636, 0x563B, 0, 0, 0x5639, 0xBB3E, 0x4A77,
+ 0x4A76, 0xBB3F, 0xBB40, 0, 0x4F6D, 0xF43B, 0x4567, 0,
+ 0, 0, 0x5638, 0x3D54, 0, 0x5637, 0, 0,
+};
static const unsigned short utf8_to_euc_E5B4[] = {
0, 0xBB42, 0, 0, 0, 0, 0xBB43, 0x3F72,
0, 0, 0, 0x563C, 0, 0xBB44, 0x3A6A, 0,
@@ -3609,6 +6577,16 @@ static const unsigned short utf8_to_euc_E5B4[] = {
0, 0xBB4B, 0, 0, 0xBB4C, 0, 0, 0,
0, 0xBB4D, 0, 0, 0, 0xBB4E, 0, 0xBB4F,
};
+static const unsigned short utf8_to_euc_E5B4_x0213[] = {
+ 0, 0xBB42, 0, 0, 0, 0, 0xA84C, 0x3F72,
+ 0, 0, 0, 0x563C, 0, 0x4F70, 0x3A6A, 0,
+ 0xA84D, 0x5642, 0xBB45, 0, 0x5643, 0x563D, 0x3333, 0x563E,
+ 0x5647, 0x5646, 0x5645, 0x5641, 0, 0xA84F, 0, 0x5640,
+ 0xA850, 0, 0x5644, 0xBB47, 0xA851, 0, 0xA852, 0x4F71,
+ 0, 0x4A78, 0, 0xA84E, 0, 0, 0, 0,
+ 0, 0xA853, 0, 0, 0xBB4C, 0, 0, 0,
+ 0, 0xA854, 0, 0, 0, 0xBB4E, 0, 0xBB4F,
+};
static const unsigned short utf8_to_euc_E5B5[] = {
0, 0, 0xBB50, 0xBB51, 0, 0, 0xBB52, 0,
0xBB53, 0, 0xBB57, 0x564B, 0x5648, 0, 0x564A, 0,
@@ -3619,6 +6597,16 @@ static const unsigned short utf8_to_euc_E5B5[] = {
0xBB5F, 0, 0, 0x564D, 0, 0, 0x564E, 0,
0, 0xBB60, 0xBB61, 0, 0, 0, 0xBB62, 0xBB63,
};
+static const unsigned short utf8_to_euc_E5B5_x0213[] = {
+ 0, 0, 0xA855, 0xBB51, 0, 0, 0x4F73, 0x4F74,
+ 0xBB53, 0, 0x4F76, 0x564B, 0x5648, 0, 0x564A, 0,
+ 0x4D72, 0xBB55, 0x5649, 0x4F75, 0, 0xBB54, 0, 0,
+ 0, 0xBB56, 0, 0, 0x563F, 0, 0, 0xBB58,
+ 0xBB59, 0xA857, 0xBB5B, 0, 0xBB5C, 0, 0, 0,
+ 0, 0x3F73, 0xA858, 0, 0x564C, 0x4F77, 0, 0x3A37,
+ 0xA85A, 0, 0, 0x564D, 0, 0, 0x564E, 0,
+ 0, 0xBB60, 0xBB61, 0, 0, 0, 0xBB62, 0xBB63,
+};
static const unsigned short utf8_to_euc_E5B6[] = {
0, 0xBB64, 0x5651, 0xBB65, 0x5650, 0, 0, 0x564F,
0xBB66, 0, 0xBB67, 0x4568, 0x563A, 0, 0, 0,
@@ -3629,6 +6617,16 @@ static const unsigned short utf8_to_euc_E5B6[] = {
0xBB72, 0, 0xE674, 0, 0xBB73, 0, 0, 0x5658,
0xBB74, 0xBB75, 0x4E66, 0, 0x5659, 0x5656, 0, 0,
};
+static const unsigned short utf8_to_euc_E5B6_x0213[] = {
+ 0, 0x4F78, 0x5651, 0xBB65, 0x5650, 0, 0, 0x564F,
+ 0xA85D, 0, 0xBB67, 0x4568, 0x563A, 0, 0, 0,
+ 0x5657, 0, 0xA85F, 0xBB69, 0xA860, 0xBB6B, 0, 0xA861,
+ 0, 0xA862, 0, 0xBB6D, 0, 0x5653, 0, 0xBB6E,
+ 0x4F79, 0, 0x5652, 0, 0x4F7A, 0, 0, 0x4F7B,
+ 0, 0, 0, 0xBB71, 0x5654, 0, 0x5655, 0,
+ 0xA863, 0, 0xA864, 0, 0xA865, 0, 0, 0x5658,
+ 0x4F7C, 0xA867, 0x4E66, 0, 0x5659, 0x5656, 0, 0,
+};
static const unsigned short utf8_to_euc_E5B7[] = {
0, 0, 0, 0xBB76, 0, 0, 0, 0xBB77,
0, 0x565A, 0, 0xBB78, 0x3460, 0x565B, 0xBB7A, 0,
@@ -3639,6 +6637,16 @@ static const unsigned short utf8_to_euc_E5B7[] = {
0, 0x384A, 0x5661, 0x4C26, 0x4743, 0x5662, 0, 0x392B,
0xBC22, 0xBC23, 0, 0x342C, 0, 0x4327, 0x3652, 0,
};
+static const unsigned short utf8_to_euc_E5B7_x0213[] = {
+ 0, 0, 0, 0xBB76, 0, 0, 0, 0xBB77,
+ 0, 0x565A, 0, 0x4F7D, 0x3460, 0x565B, 0xBB7A, 0,
+ 0xBB79, 0xA868, 0x565D, 0x565C, 0, 0, 0x565E, 0xA869,
+ 0xA86A, 0xBB7C, 0, 0x565F, 0, 0x406E, 0x3D23, 0,
+ 0xA86B, 0x3D64, 0x7428, 0x4163, 0xA86D, 0x3929, 0x3A38, 0x392A,
+ 0x3570, 0xA86E, 0, 0x5660, 0, 0, 0x3A39, 0,
+ 0, 0x384A, 0x5661, 0x4C26, 0x4743, 0x5662, 0, 0x392B,
+ 0xBC22, 0xBC23, 0, 0x342C, 0, 0x4327, 0x3652, 0,
+};
static const unsigned short utf8_to_euc_E5B8[] = {
0xBC24, 0, 0x3B54, 0x495B, 0, 0, 0x4841, 0xBC25,
0, 0, 0, 0x5663, 0x3475, 0xBC26, 0, 0,
@@ -3649,6 +6657,16 @@ static const unsigned short utf8_to_euc_E5B8[] = {
0x3522, 0, 0xBC2F, 0x4422, 0, 0xBC30, 0x5668, 0x5669,
0x3E6F, 0, 0, 0, 0, 0x4B39, 0xBC31, 0,
};
+static const unsigned short utf8_to_euc_E5B8_x0213[] = {
+ 0xA870, 0, 0x3B54, 0x495B, 0, 0, 0x4841, 0xBC25,
+ 0, 0, 0, 0x5663, 0x3475, 0xBC26, 0, 0,
+ 0, 0x5666, 0xA872, 0, 0x7429, 0xA873, 0x4421, 0,
+ 0x742A, 0x5665, 0x5664, 0x5667, 0, 0x446B, 0, 0xA875,
+ 0xBC2C, 0, 0, 0, 0, 0x3F63, 0, 0,
+ 0xBC2E, 0, 0, 0x3B55, 0, 0x404A, 0xA876, 0x4253,
+ 0x3522, 0, 0xBC2F, 0x4422, 0, 0xBC30, 0x5668, 0x5669,
+ 0x3E6F, 0, 0, 0, 0, 0x4B39, 0xA877, 0,
+};
static const unsigned short utf8_to_euc_E5B9[] = {
0x566C, 0, 0, 0x566B, 0x566A, 0x497D, 0, 0x5673,
0, 0xBC34, 0, 0xBC32, 0x4B5A, 0, 0x566D, 0,
@@ -3659,6 +6677,16 @@ static const unsigned short utf8_to_euc_E5B9[] = {
0xBC41, 0, 0x3433, 0x4A3F, 0x472F, 0x5674, 0x5675, 0,
0x392C, 0x3434, 0x5676, 0x3838, 0x4D44, 0x4D29, 0x3476, 0x5678,
};
+static const unsigned short utf8_to_euc_E5B9_x0213[] = {
+ 0x566C, 0, 0, 0x566B, 0x566A, 0x497D, 0, 0x5673,
+ 0, 0xA878, 0, 0xBC32, 0x4B5A, 0, 0x566D, 0,
+ 0xBC33, 0xBC35, 0, 0, 0x566F, 0x4B6B, 0xA87A, 0x566E,
+ 0x742B, 0, 0, 0xBC38, 0xBC39, 0, 0x742C, 0x5670,
+ 0, 0x4828, 0x5671, 0x4A3E, 0x5672, 0, 0, 0,
+ 0xBC3B, 0, 0xBC3C, 0xA87C, 0xA87D, 0xA87E, 0xAC21, 0,
+ 0xBC41, 0, 0x3433, 0x4A3F, 0x472F, 0x5674, 0x5675, 0x7E7C,
+ 0x392C, 0x3434, 0x5676, 0x3838, 0x4D44, 0x4D29, 0x3476, 0x5678,
+};
static const unsigned short utf8_to_euc_E5BA[] = {
0xBC42, 0x4423, 0, 0x392D, 0x3E31, 0, 0, 0x485F,
0, 0, 0x3E32, 0xBC43, 0, 0, 0xBC44, 0x3D78,
@@ -3669,6 +6697,16 @@ static const unsigned short utf8_to_euc_E5BA[] = {
0, 0xBC4B, 0, 0xBC4C, 0, 0x3043, 0x3D6E, 0x392F,
0x4D47, 0, 0, 0, 0, 0xBC4D, 0xBC4E, 0xBC4F,
};
+static const unsigned short utf8_to_euc_E5BA_x0213[] = {
+ 0xBC42, 0x4423, 0, 0x392D, 0x3E31, 0, 0, 0x485F,
+ 0, 0, 0x3E32, 0xBC43, 0, 0, 0xBC44, 0x3D78,
+ 0, 0, 0, 0, 0, 0x446C, 0x4A79, 0x4539,
+ 0, 0, 0x392E, 0, 0x495C, 0, 0, 0,
+ 0x5679, 0, 0xBC45, 0, 0xBC46, 0xAC23, 0x4559, 0x3A42,
+ 0xBC48, 0, 0xAC24, 0x384B, 0xAC25, 0x446D, 0, 0,
+ 0, 0xBC4B, 0, 0xBC4C, 0, 0x3043, 0x3D6E, 0x392F,
+ 0x4D47, 0xAC26, 0, 0, 0, 0xBC4D, 0x742D, 0xAC27,
+};
static const unsigned short utf8_to_euc_E5BB[] = {
0, 0x567A, 0x567B, 0x4751, 0, 0, 0xBC50, 0,
0x567C, 0x4E77, 0x4F2D, 0xBC52, 0xBC51, 0, 0xBC53, 0x567E,
@@ -3679,6 +6717,16 @@ static const unsigned short utf8_to_euc_E5BB[] = {
0x572D, 0x572B, 0, 0x572C, 0x572E, 0, 0x3164, 0x446E,
0x572F, 0, 0x377A, 0x3276, 0x4736, 0, 0x5730, 0x467B,
};
+static const unsigned short utf8_to_euc_E5BB_x0213[] = {
+ 0, 0x567A, 0x567B, 0x4751, 0, 0, 0xAC28, 0,
+ 0x567C, 0x4E77, 0x4F2D, 0x742F, 0xBC51, 0, 0xBC53, 0x567E,
+ 0x567D, 0xBC54, 0xAC29, 0x3347, 0xBC56, 0xBC57, 0x5721, 0,
+ 0, 0xAC2A, 0x5724, 0x5725, 0xBC58, 0x5723, 0xBC59, 0x4940,
+ 0x3E33, 0x5727, 0x5726, 0x5722, 0, 0xBC5A, 0, 0,
+ 0x5728, 0x5729, 0, 0xBC5B, 0x572A, 0, 0, 0,
+ 0x572D, 0x572B, 0, 0x572C, 0x572E, 0, 0x3164, 0x446E,
+ 0x572F, 0x7430, 0x377A, 0x3276, 0x4736, 0xAC2C, 0x5730, 0x467B,
+};
static const unsigned short utf8_to_euc_E5BC[] = {
0, 0x4A5B, 0xBC5C, 0x5731, 0x4F2E, 0, 0xBC5D, 0xBC5E,
0xBC5F, 0x5732, 0x4A40, 0x5735, 0x5021, 0x5031, 0xBC60, 0x3C30,
@@ -3689,6 +6737,16 @@ static const unsigned short utf8_to_euc_E5BC[] = {
0xBC6C, 0x3C65, 0, 0, 0xBC6D, 0x4425, 0xBC6E, 0x362F,
0x573A, 0, 0, 0xBC6F, 0x492B, 0xBC70, 0x4346, 0xBC71,
};
+static const unsigned short utf8_to_euc_E5BC_x0213[] = {
+ 0x7431, 0x4A5B, 0x7432, 0x5731, 0x4F2E, 0, 0xBC5D, 0x7433,
+ 0xAC2D, 0x5732, 0x4A40, 0x5735, 0x5021, 0x5031, 0xAC2E, 0x3C30,
+ 0x4675, 0x5736, 0, 0x355D, 0x4424, 0x307A, 0x5737, 0x4A26,
+ 0x3930, 0xBC61, 0, 0x4350, 0xAC2F, 0x7434, 0xAC31, 0x446F,
+ 0, 0xBC64, 0xBC65, 0x7435, 0xBC67, 0x4C6F, 0x3839, 0x384C,
+ 0xBC68, 0x5738, 0, 0xBC69, 0xBC6A, 0x5739, 0xBC6B, 0x573F,
+ 0xBC6C, 0x3C65, 0, 0, 0x7436, 0x4425, 0x7437, 0x362F,
+ 0x573A, 0, 0, 0xBC6F, 0x492B, 0x7438, 0x4346, 0xBC71,
+};
static const unsigned short utf8_to_euc_E5BD[] = {
0xBC72, 0x573B, 0, 0, 0xBC73, 0xBC74, 0, 0xBC75,
0x573C, 0, 0x3630, 0, 0x573D, 0xBC76, 0x573E, 0,
@@ -3699,6 +6757,16 @@ static const unsigned short utf8_to_euc_E5BD[] = {
0x3E34, 0x3146, 0xBD22, 0x5746, 0xBD23, 0xBD24, 0, 0x5747,
0xBD25, 0x4C72, 0xBD26, 0, 0x4860, 0xBD27, 0xBD28, 0x574A,
};
+static const unsigned short utf8_to_euc_E5BD_x0213[] = {
+ 0x7439, 0x573B, 0, 0, 0xBC73, 0x743A, 0, 0xAC32,
+ 0x573C, 0, 0x3630, 0, 0x573D, 0xBC76, 0x573E, 0,
+ 0xBC77, 0x5740, 0, 0x4576, 0x743B, 0, 0x5741, 0x5742,
+ 0x743C, 0x5743, 0, 0xBC7A, 0x5734, 0x5733, 0, 0,
+ 0xBC7B, 0x5744, 0x3741, 0xAC33, 0x743D, 0, 0x4927, 0x743E,
+ 0, 0x3A4C, 0x4937, 0x4426, 0x494B, 0x5745, 0, 0xBD21,
+ 0x3E34, 0x3146, 0xAC34, 0x5746, 0xBD23, 0xBD24, 0, 0x5747,
+ 0xBD25, 0x4C72, 0xBD26, 0, 0x4860, 0x743F, 0xAC35, 0x574A,
+};
static const unsigned short utf8_to_euc_E5BE[] = {
0x317D, 0x402C, 0x5749, 0x5748, 0x3742, 0x4254, 0, 0x574E,
0x574C, 0xBD29, 0x574B, 0x4E27, 0x3865, 0xBD2A, 0, 0xBD2B,
@@ -3709,6 +6777,16 @@ static const unsigned short utf8_to_euc_E5BE[] = {
0xBD35, 0xBD36, 0, 0x4641, 0x4427, 0, 0, 0xF43E,
0xBD37, 0x4530, 0, 0, 0x5755, 0x352B, 0, 0,
};
+static const unsigned short utf8_to_euc_E5BE_x0213[] = {
+ 0x317D, 0x402C, 0x5749, 0x5748, 0x3742, 0x4254, 0, 0x574E,
+ 0x574C, 0x7440, 0x574B, 0x4E27, 0x3865, 0xBD2A, 0, 0xAC36,
+ 0x3D79, 0x574D, 0x454C, 0x3D3E, 0, 0, 0xBD2C, 0x4640,
+ 0x5751, 0x5750, 0, 0, 0x7441, 0xBD2E, 0x574F, 0,
+ 0x5752, 0x3866, 0xAC37, 0, 0xAC38, 0, 0, 0x7442,
+ 0x5753, 0x497C, 0x3D5B, 0xBD31, 0xBD33, 0x5754, 0x4879, 0x7443,
+ 0xBD35, 0xBD36, 0, 0x4641, 0x4427, 0x7444, 0, 0x7445,
+ 0xAC39, 0x4530, 0, 0, 0x5755, 0x352B, 0, 0,
+};
static const unsigned short utf8_to_euc_E5BF[] = {
0, 0, 0, 0x3F34, 0xBD38, 0x492C, 0, 0xBD39,
0xBD3A, 0xBD3B, 0, 0xBD3C, 0x3477, 0x4726, 0, 0,
@@ -3719,6 +6797,16 @@ static const unsigned short utf8_to_euc_E5BF[] = {
0x582D, 0x575A, 0xBD4C, 0xBD4D, 0, 0x4730, 0xBD4E, 0,
0x5759, 0, 0xBD4F, 0x5757, 0xBD50, 0x397A, 0, 0x575D,
};
+static const unsigned short utf8_to_euc_E5BF_x0213[] = {
+ 0, 0, 0, 0x3F34, 0xAC3A, 0x492C, 0, 0xAC3C,
+ 0xBD3A, 0x7446, 0, 0xAC3D, 0x3477, 0x4726, 0, 0,
+ 0xBD3D, 0xBD3E, 0xAC3E, 0xAC3F, 0xAC40, 0, 0x5756, 0x3B56,
+ 0x4B3A, 0x4B3B, 0, 0, 0x317E, 0x575B, 0x7447, 0,
+ 0x4369, 0x7448, 0xAC41, 0, 0x5758, 0, 0, 0,
+ 0xBD45, 0x7449, 0xBD47, 0x3277, 0xBD48, 0xBD49, 0xAC42, 0xAC43,
+ 0x582D, 0x575A, 0xBD4C, 0xAC44, 0, 0x4730, 0xBD4E, 0,
+ 0x5759, 0, 0xBD4F, 0x5757, 0xAC45, 0x397A, 0, 0x575D,
+};
static const unsigned short utf8_to_euc_E680[] = {
0, 0, 0, 0, 0, 0, 0, 0xBD51,
0, 0, 0xBD52, 0, 0, 0xBD53, 0x5763, 0x5769,
@@ -3729,6 +6817,16 @@ static const unsigned short utf8_to_euc_E680[] = {
0, 0x5764, 0, 0xBD5C, 0, 0xBD5D, 0, 0,
0, 0, 0x576A, 0, 0, 0, 0, 0,
};
+static const unsigned short utf8_to_euc_E680_x0213[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0xBD51,
+ 0, 0, 0xBD52, 0, 0, 0x744A, 0x5763, 0x5769,
+ 0x5761, 0, 0x455C, 0xBD54, 0x744B, 0x5766, 0x495D, 0xAC47,
+ 0x744C, 0x5760, 0xBD58, 0x5765, 0x4E67, 0x3B57, 0, 0xBD59,
+ 0x4255, 0x575E, 0xAC48, 0, 0xAC49, 0x355E, 0x5768, 0x402D,
+ 0x3165, 0x5762, 0x3278, 0x5767, 0, 0xBD5B, 0, 0x3631,
+ 0, 0x5764, 0, 0x744D, 0, 0x744E, 0, 0,
+ 0, 0, 0x576A, 0, 0, 0, 0, 0,
+};
static const unsigned short utf8_to_euc_E681[] = {
0xBD5E, 0x576C, 0x5776, 0x5774, 0, 0, 0x5771, 0xBD5F,
0xBD60, 0xBD61, 0x5770, 0x4E78, 0xBD62, 0x5772, 0, 0,
@@ -3739,6 +6837,16 @@ static const unsigned short utf8_to_euc_E681[] = {
0x3366, 0xBD6A, 0, 0, 0, 0x3743, 0, 0x576E,
0, 0, 0, 0, 0, 0, 0xBD6B, 0xBD6C,
};
+static const unsigned short utf8_to_euc_E681_x0213[] = {
+ 0xBD5E, 0x576C, 0x5776, 0x5774, 0, 0, 0x5771, 0x744F,
+ 0xBD60, 0xBD61, 0x5770, 0x4E78, 0xAC4B, 0x5772, 0, 0,
+ 0x3632, 0xBD63, 0x3931, 0, 0xBD64, 0x3D7A, 0xBD65, 0xBD66,
+ 0, 0x5779, 0x576B, 0, 0, 0xBD67, 0, 0x576F,
+ 0x575F, 0xBD68, 0x327A, 0x5773, 0x5775, 0x4351, 0, 0xBD69,
+ 0x3A28, 0x3238, 0x576D, 0x5778, 0x5777, 0x3633, 0, 0x4229,
+ 0x3366, 0xBD6A, 0, 0, 0, 0x3743, 0, 0x576E,
+ 0, 0, 0, 0, 0, 0, 0xBD6B, 0xAC4C,
+};
static const unsigned short utf8_to_euc_E682[] = {
0, 0x577A, 0xBD6D, 0x577D, 0x5821, 0xF43F, 0xBD6E, 0,
0xBD6F, 0x3C3D, 0xBD70, 0x5827, 0x4470, 0x577B, 0xBD71, 0,
@@ -3749,6 +6857,16 @@ static const unsigned short utf8_to_euc_E682[] = {
0xBD7C, 0xBD7D, 0x4861, 0x575C, 0x582C, 0x5830, 0x4C65, 0xBD7E,
0x5829, 0, 0, 0xBE21, 0x4569, 0x582E, 0xBE22, 0,
};
+static const unsigned short utf8_to_euc_E682_x0213[] = {
+ 0, 0x577A, 0xBD6D, 0x577D, 0x5821, 0xF43F, 0xBD6E, 0,
+ 0xBD6F, 0x3C3D, 0xAC4D, 0x5827, 0x4470, 0x577B, 0xBD71, 0,
+ 0, 0xBD72, 0x5825, 0xBD73, 0x3279, 0xAC4E, 0x5823, 0x5824,
+ 0xBD75, 0, 0x577E, 0x5822, 0, 0x7451, 0x7452, 0x3867,
+ 0x4D2A, 0, 0xBD78, 0x3435, 0xBD79, 0xBD7A, 0x3159, 0x5826,
+ 0xAC4F, 0x473A, 0x302D, 0, 0, 0, 0, 0,
+ 0xAC51, 0xAC52, 0x4861, 0x575C, 0x582C, 0x5830, 0x4C65, 0xBD7E,
+ 0x5829, 0, 0, 0xBE21, 0x4569, 0x582E, 0xAC53, 0,
+};
static const unsigned short utf8_to_euc_E683[] = {
0, 0, 0xBE23, 0, 0xBE24, 0x3E70, 0x582F, 0x4657,
0xBE25, 0xBE26, 0xBE27, 0xBE28, 0, 0, 0xBE29, 0xBE2A,
@@ -3759,6 +6877,16 @@ static const unsigned short utf8_to_euc_E683[] = {
0x4246, 0x583D, 0xBE33, 0x415B, 0x5838, 0xBE34, 0x5835, 0x5836,
0xBE35, 0x3C66, 0x5839, 0x583C, 0xBE36, 0xBE37, 0, 0,
};
+static const unsigned short utf8_to_euc_E683_x0213[] = {
+ 0, 0, 0xBE23, 0, 0xBE24, 0x3E70, 0x582F, 0x4657,
+ 0xAC54, 0xBE26, 0xBE27, 0x7453, 0, 0, 0xBE29, 0xBE2A,
+ 0, 0x4F47, 0, 0x582B, 0x7454, 0x7455, 0, 0,
+ 0x5831, 0xAC55, 0x397B, 0xAC56, 0x404B, 0x7456, 0xBE30, 0x3054,
+ 0x582A, 0x5828, 0xBE31, 0x415A, 0, 0xBE32, 0, 0x577C,
+ 0x3B34, 0, 0, 0, 0, 0, 0xAC57, 0,
+ 0x4246, 0x583D, 0xAC58, 0x415B, 0x5838, 0xAC59, 0x5835, 0x5836,
+ 0x7457, 0x3C66, 0x5839, 0x583C, 0xBE36, 0xBE37, 0, 0,
+};
static const unsigned short utf8_to_euc_E684[] = {
0x5837, 0x3D25, 0xBE38, 0x583A, 0, 0, 0x5834, 0xBE39,
0x4C7C, 0x4C7B, 0xBE3A, 0, 0xBE3B, 0x583E, 0x583F, 0x3055,
@@ -3769,6 +6897,16 @@ static const unsigned short utf8_to_euc_E684[] = {
0xBE49, 0xBE4A, 0, 0, 0x5848, 0xBE4B, 0xBE4C, 0xBE4D,
0, 0xBE4E, 0, 0, 0x5846, 0x5849, 0x5841, 0x5845,
};
+static const unsigned short utf8_to_euc_E684_x0213[] = {
+ 0x5837, 0x3D25, 0xBE38, 0x583A, 0, 0, 0x5834, 0xBE39,
+ 0x4C7C, 0x4C7B, 0xBE3A, 0, 0xBE3B, 0x583E, 0x583F, 0x3055,
+ 0xAC5A, 0xBE3D, 0xAC5B, 0xAC5C, 0xBE40, 0x5833, 0xBE41, 0xBE42,
+ 0, 0xAC5D, 0x3672, 0x3026, 0x7458, 0, 0xAC5E, 0x3436,
+ 0xF440, 0x583B, 0xBE46, 0, 0, 0, 0, 0x5843,
+ 0x5842, 0, 0xBE47, 0x7459, 0x5847, 0, 0, 0,
+ 0x745A, 0xBE4A, 0, 0, 0x5848, 0xBE4B, 0xBE4C, 0x745B,
+ 0, 0xBE4E, 0xAC5F, 0, 0x5846, 0x5849, 0x5841, 0x5845,
+};
static const unsigned short utf8_to_euc_E685[] = {
0, 0xBE4F, 0x584A, 0, 0x584B, 0xBE50, 0xBE51, 0x5840,
0x3B7C, 0xBE52, 0x5844, 0x4256, 0x3932, 0x5832, 0x3F35, 0,
@@ -3779,6 +6917,16 @@ static const unsigned short utf8_to_euc_E685[] = {
0x3056, 0x5855, 0xBE56, 0x584C, 0x5852, 0x5859, 0x3744, 0x584D,
0xBE57, 0, 0, 0xBE58, 0xBE59, 0, 0x4D5D, 0xBE5A,
};
+static const unsigned short utf8_to_euc_E685_x0213[] = {
+ 0, 0xAC61, 0x584A, 0, 0x584B, 0xBE50, 0xAC62, 0x5840,
+ 0x3B7C, 0xBE52, 0x5844, 0x4256, 0x3932, 0x5832, 0x3F35, 0,
+ 0, 0, 0, 0x5858, 0, 0x4A69, 0, 0,
+ 0x584E, 0x584F, 0x5850, 0, 0, 0x5857, 0xBE53, 0x5856,
+ 0xAC63, 0, 0x4B7D, 0x3437, 0, 0x5854, 0, 0x3745,
+ 0x3334, 0, 0, 0x5851, 0xBE55, 0, 0x4E38, 0x5853,
+ 0x3056, 0x5855, 0xBE56, 0x584C, 0x5852, 0x5859, 0x3744, 0x584D,
+ 0xBE57, 0, 0, 0xBE58, 0xAC64, 0, 0x4D5D, 0xBE5A,
+};
static const unsigned short utf8_to_euc_E686[] = {
0xBE5B, 0xBE5C, 0x4D2B, 0xBE5D, 0xBE5E, 0, 0, 0x585C,
0, 0, 0x5860, 0xBE5F, 0, 0xBE60, 0x417E, 0,
@@ -3789,6 +6937,16 @@ static const unsigned short utf8_to_euc_E686[] = {
0, 0, 0x377B, 0, 0, 0, 0x3231, 0,
0xBE6D, 0xBE6E, 0x586B, 0, 0xBE6F, 0, 0x3438, 0,
};
+static const unsigned short utf8_to_euc_E686_x0213[] = {
+ 0xBE5B, 0xBE5C, 0x4D2B, 0xBE5D, 0xBE5E, 0, 0, 0x585C,
+ 0, 0, 0x5860, 0xBE5F, 0, 0x745D, 0x417E, 0,
+ 0x4E79, 0x5861, 0xAC66, 0xAC67, 0x585E, 0, 0x585B, 0xAC68,
+ 0xAC69, 0x585A, 0x585F, 0, 0xBE65, 0xBE66, 0, 0xBE67,
+ 0xBE68, 0, 0, 0, 0x4A30, 0xAC6A, 0, 0x4634,
+ 0xAC6B, 0x3746, 0xBE6B, 0x5862, 0x585D, 0xAC6C, 0x5863, 0,
+ 0, 0, 0x377B, 0, 0, 0, 0x3231, 0,
+ 0xBE6D, 0x7460, 0x586B, 0, 0x745F, 0, 0x3438, 0,
+};
static const unsigned short utf8_to_euc_E687[] = {
0xBE70, 0xBE71, 0xBE72, 0x5869, 0, 0, 0x586A, 0x3A29,
0x5868, 0x5866, 0x5865, 0x586C, 0x5864, 0x586E, 0xBE73, 0xBE74,
@@ -3799,6 +6957,16 @@ static const unsigned short utf8_to_euc_E687[] = {
0, 0, 0x4428, 0, 0x5873, 0, 0x5871, 0x5867,
0x377C, 0, 0x5872, 0, 0x5876, 0x5875, 0x5877, 0x5874,
};
+static const unsigned short utf8_to_euc_E687_x0213[] = {
+ 0xBE70, 0xBE71, 0xBE72, 0x5869, 0, 0, 0x586A, 0x3A29,
+ 0x5868, 0x5866, 0x5865, 0x586C, 0x5864, 0x586E, 0xBE73, 0xBE74,
+ 0x327B, 0, 0, 0, 0, 0xAC6E, 0, 0,
+ 0, 0, 0, 0, 0xBE76, 0xAC6F, 0xBE78, 0xAC70,
+ 0, 0xBE7A, 0xBE7B, 0x5870, 0, 0xBE7E, 0x586F, 0xBE7C,
+ 0, 0xBE7D, 0, 0, 0xBF21, 0xBF22, 0, 0xBF23,
+ 0, 0, 0x4428, 0, 0x5873, 0xAC71, 0x5871, 0x5867,
+ 0x377C, 0, 0x5872, 0, 0x5876, 0x5875, 0x5877, 0x5874,
+};
static const unsigned short utf8_to_euc_E688[] = {
0x5878, 0xBF24, 0, 0xBF25, 0xBF26, 0, 0, 0xBF27,
0x5879, 0x587A, 0x4A6A, 0, 0x587C, 0x587B, 0x3D3F, 0,
@@ -3809,6 +6977,16 @@ static const unsigned short utf8_to_euc_E688[] = {
0x5925, 0, 0x5926, 0x5927, 0x4257, 0, 0, 0,
0x384D, 0xBF31, 0, 0x4C61, 0, 0xBF32, 0, 0x4B3C,
};
+static const unsigned short utf8_to_euc_E688_x0213[] = {
+ 0x5878, 0xBF24, 0, 0xBF25, 0xBF26, 0, 0, 0xBF27,
+ 0x5879, 0x587A, 0x4A6A, 0, 0x587C, 0x587B, 0x3D3F, 0,
+ 0x402E, 0x3266, 0x327C, 0xBF28, 0x587D, 0xAC73, 0x303F, 0,
+ 0, 0, 0x404C, 0x587E, 0xBF2A, 0x6C43, 0x5921, 0x3761,
+ 0xBF2B, 0x5922, 0x7462, 0xAC74, 0, 0, 0x406F, 0xBF2E,
+ 0, 0xAC75, 0x5923, 0xBF30, 0, 0, 0x5924, 0x353A,
+ 0x5925, 0, 0x5926, 0x5927, 0x4257, 0, 0, 0,
+ 0x384D, 0xBF31, 0, 0x4C61, 0, 0xBF32, 0x7463, 0x4B3C,
+};
static const unsigned short utf8_to_euc_E689[] = {
0x3D6A, 0x5928, 0xBF33, 0xBF34, 0xBF35, 0, 0xBF36, 0x4070,
0x6E3D, 0x4862, 0, 0x3C6A, 0xBF37, 0x3A4D, 0x5929, 0,
@@ -3819,6 +6997,16 @@ static const unsigned short utf8_to_euc_E689[] = {
0, 0x3037, 0, 0xBF42, 0, 0, 0x495E, 0,
0, 0x4863, 0xBF43, 0, 0x592F, 0xBF44, 0x5932, 0x3E35,
};
+static const unsigned short utf8_to_euc_E689_x0213[] = {
+ 0x3D6A, 0x5928, 0xBF33, 0x7464, 0xBF35, 0, 0xAC76, 0x4070,
+ 0x6E3D, 0x4862, 0, 0x3C6A, 0xAC77, 0x3A4D, 0x5929, 0,
+ 0xBF38, 0xAC78, 0xAC79, 0x4247, 0xBF3B, 0x4A27, 0x7465, 0,
+ 0x4271, 0, 0x7466, 0x592C, 0xBF3E, 0, 0x592A, 0,
+ 0x592D, 0xAC7A, 0, 0x592B, 0xAC7B, 0, 0, 0,
+ 0x592E, 0, 0, 0, 0, 0xAC7D, 0x4A31, 0x7467,
+ 0, 0x3037, 0, 0xAC7E, 0, 0, 0x495E, 0,
+ 0, 0x4863, 0xBF43, 0xAC7C, 0x592F, 0xBF44, 0x5932, 0x3E35,
+};
static const unsigned short utf8_to_euc_E68A[] = {
0x353B, 0, 0x5930, 0x5937, 0x3E36, 0, 0, 0,
0, 0x5931, 0x4744, 0, 0, 0xBF45, 0xBF46, 0xBF47,
@@ -3829,6 +7017,16 @@ static const unsigned short utf8_to_euc_E68A[] = {
0, 0x4A7A, 0, 0xBF4B, 0, 0x4471, 0xBF4C, 0xBF4D,
0, 0x4B75, 0xBF4E, 0x593B, 0x3221, 0x436A, 0xBF4F, 0xBF50,
};
+static const unsigned short utf8_to_euc_E68A_x0213[] = {
+ 0x353B, 0, 0x5930, 0x5937, 0x3E36, 0x7468, 0, 0,
+ 0, 0x5931, 0x4744, 0, 0, 0xBF45, 0xBF46, 0xBF47,
+ 0xBF48, 0x4D5E, 0x5933, 0x5934, 0x5938, 0x456A, 0x5935, 0x3933,
+ 0x405E, 0xAD21, 0, 0x5946, 0x4834, 0, 0x4272, 0,
+ 0, 0, 0, 0, 0, 0, 0xAD22, 0,
+ 0xBF4A, 0, 0, 0x4864, 0x5A2D, 0, 0, 0,
+ 0, 0x4A7A, 0, 0xBF4B, 0, 0x4471, 0xBF4C, 0xBF4D,
+ 0, 0x4B75, 0xBF4E, 0x593B, 0x3221, 0x436A, 0xBF4F, 0xBF50,
+};
static const unsigned short utf8_to_euc_E68B[] = {
0, 0, 0x5944, 0, 0xBF51, 0x4334, 0x593E, 0x5945,
0x5940, 0x5947, 0x5943, 0, 0x5942, 0x476F, 0xBF52, 0x593C,
@@ -3839,6 +7037,16 @@ static const unsigned short utf8_to_euc_E68B[] = {
0, 0x594A, 0xBF57, 0x377D, 0xBF58, 0x594F, 0x3B22, 0x3969,
0, 0, 0, 0, 0xBF59, 0xBF5A, 0x3D26, 0x593D,
};
+static const unsigned short utf8_to_euc_E68B_x0213[] = {
+ 0, 0, 0x5944, 0, 0x7469, 0x4334, 0x593E, 0x5945,
+ 0x5940, 0x5947, 0x5943, 0, 0x5942, 0x476F, 0xBF52, 0x593C,
+ 0x327D, 0x593A, 0x3571, 0x4273, 0x5936, 0xAD23, 0x746A, 0x5939,
+ 0x3934, 0x405B, 0xBF55, 0x3E37, 0x5941, 0x4752, 0, 0,
+ 0x3572, 0x3348, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0xBF56, 0, 0x3367, 0x3F21, 0x5949, 0x594E,
+ 0, 0x594A, 0xBF57, 0x377D, 0xBF58, 0x594F, 0x3B22, 0x3969,
+ 0, 0, 0, 0, 0x746B, 0xAD25, 0x3D26, 0x593D,
+};
static const unsigned short utf8_to_euc_E68C[] = {
0, 0x3B7D, 0x594C, 0xBF5B, 0xBF5C, 0, 0, 0x3B58,
0x594D, 0x3044, 0xBF5D, 0xBF5E, 0x5948, 0xBF5F, 0, 0,
@@ -3849,6 +7057,16 @@ static const unsigned short utf8_to_euc_E68C[] = {
0, 0, 0, 0, 0, 0xBF67, 0xBF68, 0,
0, 0xBF69, 0x4472, 0, 0xBF6A, 0x4854, 0x5951, 0x415E,
};
+static const unsigned short utf8_to_euc_E68C_x0213[] = {
+ 0, 0x3B7D, 0x594C, 0xAD26, 0xBF5C, 0, 0, 0x3B58,
+ 0x594D, 0x3044, 0x746C, 0xBF5E, 0x5948, 0xAD27, 0, 0,
+ 0xAD28, 0x4429, 0, 0xBF61, 0, 0, 0xBF62, 0,
+ 0x746D, 0x3573, 0, 0, 0, 0, 0, 0x3634,
+ 0, 0, 0, 0, 0, 0, 0, 0x594B,
+ 0x3027, 0xBF64, 0xBF65, 0x3A43, 0, 0xBF66, 0, 0x3F36,
+ 0, 0, 0xAD2B, 0, 0, 0xAD2C, 0xBF68, 0,
+ 0, 0x746E, 0x4472, 0xAD2D, 0xAD2E, 0x4854, 0x5951, 0x415E,
+};
static const unsigned short utf8_to_euc_E68D[] = {
0, 0xBF6B, 0xBF6C, 0xBF6D, 0xBF6E, 0, 0xBF6F, 0,
0, 0x422A, 0xBF70, 0xBF71, 0x3B2B, 0x5952, 0xBF72, 0x5954,
@@ -3859,6 +7077,16 @@ static const unsigned short utf8_to_euc_E68D[] = {
0, 0xBF7C, 0x377E, 0, 0xBF7D, 0xBF7E, 0x5959, 0x3E39,
0xC021, 0, 0x4668, 0x4731, 0xC022, 0xC023, 0, 0xC024,
};
+static const unsigned short utf8_to_euc_E68D_x0213[] = {
+ 0, 0xAD2F, 0xBF6C, 0x746F, 0xAD30, 0, 0xBF6F, 0,
+ 0, 0x422A, 0xBF70, 0xBF71, 0x3B2B, 0x5952, 0xAD31, 0x5954,
+ 0x5950, 0, 0xBF73, 0xBF74, 0xBF75, 0x4A61, 0, 0x443D,
+ 0xBF76, 0xAD33, 0, 0xBF77, 0x415C, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0x7470, 0xBF79, 0x4A7B,
+ 0x3C4E, 0x5960, 0, 0x595F, 0xAD36, 0xBF7B, 0x3F78, 0,
+ 0, 0xBF7C, 0x377E, 0, 0xBF7D, 0xBF7E, 0x5959, 0x3E39,
+ 0xC021, 0, 0x4668, 0x4731, 0x7471, 0xC023, 0, 0xC024,
+};
static const unsigned short utf8_to_euc_E68E[] = {
0x5957, 0, 0xC025, 0x415D, 0xC026, 0, 0, 0xC027,
0x3C78, 0x595C, 0xC028, 0, 0x3E38, 0, 0x5956, 0x595B,
@@ -3869,6 +7097,16 @@ static const unsigned short utf8_to_euc_E68E[] = {
0, 0, 0x3747, 0, 0x444F, 0x595E, 0, 0,
0, 0, 0, 0x415F, 0, 0xC034, 0x5961, 0,
};
+static const unsigned short utf8_to_euc_E68E_x0213[] = {
+ 0x5957, 0, 0xC025, 0x415D, 0xAD37, 0, 0, 0xC027,
+ 0x3C78, 0x595C, 0xC028, 0, 0x3E38, 0, 0x5956, 0x595B,
+ 0xC029, 0, 0x4753, 0, 0xAD3A, 0xC02B, 0x5955, 0,
+ 0x3721, 0xAD38, 0xC02D, 0x335D, 0, 0, 0xC02E, 0x595D,
+ 0x4E2B, 0x3A4E, 0x4335, 0x595A, 0xC02F, 0x405C, 0xC030, 0x3935,
+ 0x3F64, 0x3166, 0x413C, 0x5958, 0x3545, 0xC031, 0xC032, 0xC033,
+ 0, 0, 0x3747, 0, 0x444F, 0x595E, 0, 0,
+ 0, 0, 0, 0x415F, 0, 0xAD3B, 0x5961, 0,
+};
static const unsigned short utf8_to_euc_E68F[] = {
0x5963, 0xC035, 0, 0x4237, 0x5969, 0xC036, 0x5964, 0,
0xC037, 0x5966, 0, 0, 0, 0, 0xC038, 0x4941,
@@ -3879,6 +7117,16 @@ static const unsigned short utf8_to_euc_E68F[] = {
0, 0, 0xC042, 0xC043, 0x3167, 0xC044, 0x5968, 0,
0xC045, 0xC046, 0x4D49, 0, 0, 0, 0, 0,
};
+static const unsigned short utf8_to_euc_E68F_x0213[] = {
+ 0x5963, 0xC035, 0, 0x4237, 0x5969, 0xC036, 0x5964, 0,
+ 0xC037, 0x5966, 0, 0, 0, 0, 0xC038, 0x4941,
+ 0x4473, 0xC039, 0x5967, 0xC03A, 0xAD3D, 0xAD3E, 0x4D2C, 0,
+ 0, 0, 0x4D48, 0x3439, 0xAD3F, 0, 0, 0,
+ 0xAD40, 0x302E, 0, 0x5965, 0, 0x7472, 0, 0,
+ 0, 0x5962, 0xC040, 0xAD41, 0xAD42, 0x7473, 0x3478, 0,
+ 0, 0, 0xAD43, 0xC043, 0x3167, 0x7474, 0x5968, 0xAD3C,
+ 0xC045, 0xC046, 0x4D49, 0, 0, 0, 0, 0,
+};
static const unsigned short utf8_to_euc_E690[] = {
0, 0, 0, 0, 0, 0, 0x596C, 0,
0, 0xC047, 0xC048, 0, 0, 0x423B, 0, 0x5973,
@@ -3889,6 +7137,16 @@ static const unsigned short utf8_to_euc_E690[] = {
0xC055, 0, 0, 0, 0x596B, 0xC056, 0x596F, 0,
0, 0, 0x3748, 0, 0, 0xC057, 0x3A71, 0xC058,
};
+static const unsigned short utf8_to_euc_E690_x0213[] = {
+ 0, 0, 0, 0, 0, 0, 0x596C, 0,
+ 0, 0xAD44, 0xC048, 0, 0, 0x423B, 0, 0x5973,
+ 0x7475, 0, 0xC04A, 0x596D, 0x7476, 0, 0x596A, 0x5971,
+ 0xC04C, 0, 0, 0, 0x5953, 0, 0xAD45, 0,
+ 0xC04E, 0, 0x7477, 0, 0xC050, 0xAD46, 0x596E, 0,
+ 0x5972, 0xAD47, 0xC053, 0, 0x4842, 0x456B, 0, 0xAD48,
+ 0xC055, 0, 0, 0, 0x596B, 0xC056, 0x596F, 0,
+ 0, 0, 0x3748, 0, 0, 0xC057, 0x3A71, 0xC058,
+};
static const unsigned short utf8_to_euc_E691[] = {
0, 0, 0x405D, 0, 0, 0, 0, 0,
0, 0, 0, 0xC059, 0, 0, 0x5977, 0xC05A,
@@ -3899,6 +7157,16 @@ static const unsigned short utf8_to_euc_E691[] = {
0, 0, 0, 0xC068, 0xC069, 0, 0x5976, 0,
0x4C4E, 0, 0x4022, 0xC06A, 0, 0xC06B, 0, 0,
};
+static const unsigned short utf8_to_euc_E691_x0213[] = {
+ 0, 0, 0x405D, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0xC059, 0, 0, 0x5977, 0xC05A,
+ 0, 0x7479, 0xC05C, 0xC05D, 0xC05E, 0, 0, 0,
+ 0x4526, 0, 0xAD49, 0xAD4A, 0xC061, 0xAD4B, 0, 0xC063,
+ 0x747A, 0xC065, 0, 0xC066, 0, 0, 0, 0x5974,
+ 0, 0x4B60, 0, 0, 0, 0x747B, 0, 0x5975,
+ 0, 0, 0, 0xAD4C, 0xC069, 0, 0x5976, 0,
+ 0x4C4E, 0x7478, 0x4022, 0xC06A, 0, 0xAD4D, 0, 0,
+};
static const unsigned short utf8_to_euc_E692[] = {
0, 0, 0, 0x3762, 0, 0xC06C, 0, 0xC06D,
0x597D, 0, 0, 0, 0, 0, 0, 0xC06E,
@@ -3909,6 +7177,16 @@ static const unsigned short utf8_to_euc_E692[] = {
0x4071, 0, 0x4B50, 0xC07B, 0, 0, 0, 0,
0, 0x3349, 0, 0x5A25, 0x597E, 0xC07C, 0xC07D, 0xC07E,
};
+static const unsigned short utf8_to_euc_E692_x0213[] = {
+ 0, 0, 0, 0x3762, 0, 0xC06C, 0, 0xAD4E,
+ 0x597D, 0, 0, 0, 0, 0, 0, 0xC06E,
+ 0xC06F, 0xAD4F, 0x3B35, 0x597A, 0, 0x5979, 0, 0,
+ 0xC071, 0xC072, 0x4732, 0xC073, 0, 0xAD50, 0x4635, 0xAD51,
+ 0, 0xC076, 0, 0xC077, 0x4531, 0x597B, 0xC078, 0,
+ 0xC079, 0x597C, 0, 0x496F, 0xC07A, 0x4745, 0x3B23, 0,
+ 0x4071, 0, 0x4B50, 0xC07B, 0, 0, 0, 0,
+ 0, 0x3349, 0, 0x5A25, 0x597E, 0xC07C, 0x747D, 0x747E,
+};
static const unsigned short utf8_to_euc_E693[] = {
0, 0x4D4A, 0x5A27, 0, 0xC121, 0x5A23, 0, 0x5A24,
0, 0xC122, 0xC123, 0xC124, 0xC125, 0x4160, 0xC126, 0,
@@ -3919,6 +7197,16 @@ static const unsigned short utf8_to_euc_E693[] = {
0xC130, 0x5A28, 0x5A33, 0, 0x5A32, 0xC131, 0x5A31, 0xC132,
0, 0, 0x5A34, 0xC133, 0, 0x5A36, 0x3E71, 0xC134,
};
+static const unsigned short utf8_to_euc_E693_x0213[] = {
+ 0, 0x4D4A, 0x5A27, 0, 0x7521, 0x5A23, 0, 0x5A24,
+ 0, 0xC122, 0x7522, 0xAD52, 0xAD53, 0x4160, 0x747C, 0,
+ 0x7523, 0xC128, 0x5A22, 0, 0x593F, 0xAD54, 0, 0xAD55,
+ 0x5A26, 0, 0x5A21, 0, 0, 0, 0, 0,
+ 0x5A2B, 0x5A2C, 0x4527, 0x5A2E, 0xAD57, 0xAD58, 0x3B24, 0x5A29,
+ 0, 0xC12D, 0xC12E, 0, 0x353C, 0xC12F, 0, 0x5A2F,
+ 0xC130, 0x5A28, 0x5A33, 0, 0x5A32, 0xC131, 0x5A31, 0x7524,
+ 0, 0, 0x5A34, 0x7525, 0, 0x5A36, 0x3E71, 0xAD59,
+};
static const unsigned short utf8_to_euc_E694[] = {
0x5A35, 0xC135, 0, 0, 0xC136, 0x5A39, 0, 0,
0xC137, 0xC138, 0xC139, 0, 0, 0, 0, 0xC13A,
@@ -3929,6 +7217,16 @@ static const unsigned short utf8_to_euc_E694[] = {
0, 0xC146, 0, 0, 0x5A3D, 0x5A3E, 0x5A40, 0x5A3F,
0x5A41, 0x327E, 0xC147, 0x3936, 0xC148, 0xC149, 0x4A7C, 0x402F,
};
+static const unsigned short utf8_to_euc_E694_x0213[] = {
+ 0x5A35, 0xC135, 0, 0, 0xAD5A, 0x5A39, 0, 0,
+ 0xC137, 0xC138, 0xC139, 0, 0, 0, 0, 0xAD5C,
+ 0, 0, 0, 0xC13B, 0xAD5D, 0, 0xAD5E, 0,
+ 0x5A37, 0xC13E, 0, 0xC13F, 0x5A38, 0x5970, 0xAD60, 0xC141,
+ 0, 0, 0x7526, 0x5A3B, 0x5A3A, 0, 0xC143, 0,
+ 0, 0x7527, 0x5978, 0x5A3C, 0x5A30, 0, 0xC145, 0x3B59,
+ 0, 0xC146, 0xAD61, 0, 0x5A3D, 0x5A3E, 0x5A40, 0x5A3F,
+ 0x5A41, 0x327E, 0xC147, 0x3936, 0xC148, 0xC149, 0x4A7C, 0x402F,
+};
static const unsigned short utf8_to_euc_E695[] = {
0, 0, 0, 0xC14A, 0, 0x384E, 0, 0xC14B,
0x5A43, 0xC14C, 0, 0, 0, 0x5A46, 0xF441, 0x4952,
@@ -3939,6 +7237,16 @@ static const unsigned short utf8_to_euc_E695[] = {
0x3F74, 0, 0x5A4A, 0, 0x4030, 0x4528, 0, 0x495F,
0x5A4B, 0, 0xC154, 0, 0, 0xC155, 0, 0,
};
+static const unsigned short utf8_to_euc_E695_x0213[] = {
+ 0, 0, 0, 0xC14A, 0xAD62, 0x384E, 0, 0xC14B,
+ 0x5A43, 0xC14C, 0, 0, 0, 0x5A46, 0xF441, 0x4952,
+ 0xC14D, 0x355F, 0xC14E, 0, 0xAD63, 0x5A45, 0x5A44, 0x4754,
+ 0x5A47, 0x3635, 0, 0, 0, 0x5A49, 0x5A48, 0xC150,
+ 0xC151, 0, 0x343A, 0x3B36, 0, 0, 0x4658, 0x7529,
+ 0, 0, 0, 0xAD64, 0x3749, 0, 0, 0,
+ 0x3F74, 0, 0x5A4A, 0, 0x4030, 0x4528, 0, 0x495F,
+ 0x5A4B, 0, 0xAD65, 0, 0, 0xC155, 0, 0,
+};
static const unsigned short utf8_to_euc_E696[] = {
0, 0xC156, 0x5A4C, 0x5A4D, 0, 0xC157, 0, 0x4A38,
0x555D, 0x4046, 0xC158, 0, 0x494C, 0, 0x3A58, 0,
@@ -3949,6 +7257,16 @@ static const unsigned short utf8_to_euc_E696[] = {
0x3F37, 0, 0xC161, 0xC162, 0xC163, 0, 0, 0x5A52,
0, 0x4A7D, 0, 0, 0x3177, 0x3B5C, 0, 0xC164,
};
+static const unsigned short utf8_to_euc_E696_x0213[] = {
+ 0, 0xAD66, 0x5A4C, 0x5A4D, 0xAD67, 0xAD68, 0, 0x4A38,
+ 0x555D, 0x4046, 0xAD69, 0, 0x494C, 0, 0x3A58, 0,
+ 0x4865, 0x4843, 0xC159, 0, 0, 0xC15A, 0, 0x454D,
+ 0xC15B, 0x4E41, 0, 0x5A4F, 0x3C50, 0x752A, 0, 0x5A50,
+ 0xC15D, 0x3036, 0, 0xC15E, 0x3654, 0x404D, 0xC15F, 0x4960,
+ 0, 0, 0, 0x5A51, 0x3B42, 0x4347, 0xC160, 0x3B5B,
+ 0x3F37, 0, 0xAD6A, 0xC162, 0xC163, 0xAD6B, 0, 0x5A52,
+ 0xAD6C, 0x4A7D, 0, 0, 0x3177, 0x3B5C, 0, 0xAD6D,
+};
static const unsigned short utf8_to_euc_E697[] = {
0, 0x5A55, 0xC165, 0x5A53, 0x5A56, 0x4E39, 0x5A54, 0,
0xC166, 0xC167, 0, 0x407B, 0x5A57, 0, 0xC168, 0x4232,
@@ -3959,6 +7277,16 @@ static const unsigned short utf8_to_euc_E697[] = {
0xC16E, 0x5A5D, 0xC16F, 0, 0xC170, 0xC171, 0, 0,
0, 0xC172, 0x3222, 0x5A61, 0, 0, 0xC173, 0xC174,
};
+static const unsigned short utf8_to_euc_E697_x0213[] = {
+ 0, 0x5A55, 0xAD6E, 0x5A53, 0x5A56, 0x4E39, 0x5A54, 0,
+ 0xC166, 0xAD6F, 0, 0x407B, 0x5A57, 0, 0xC168, 0x4232,
+ 0xC169, 0, 0x5A58, 0, 0xAD70, 0, 0xC16B, 0x347A,
+ 0xC16C, 0x5A5A, 0, 0x5A59, 0, 0, 0, 0xC16D,
+ 0x5A5B, 0x5A5C, 0x347B, 0, 0, 0x467C, 0x4336, 0x356C,
+ 0x3B5D, 0x4161, 0, 0, 0x3D5C, 0x3030, 0, 0,
+ 0xC16E, 0x5A5D, 0xAD72, 0, 0xC170, 0xC171, 0, 0,
+ 0, 0xAD73, 0x3222, 0x5A61, 0xAD74, 0, 0xC173, 0xC174,
+};
static const unsigned short utf8_to_euc_E698[] = {
0xC175, 0, 0x3937, 0x5A60, 0xC176, 0, 0x3A2B, 0x3E3A,
0xC177, 0xC178, 0x5A5F, 0, 0x3E3B, 0xC179, 0x4C40, 0x3A2A,
@@ -3969,6 +7297,16 @@ static const unsigned short utf8_to_euc_E698[] = {
0xC22C, 0xC22D, 0, 0xC22E, 0x5A65, 0x5A63, 0x5A64, 0xC230,
0, 0xC22F, 0, 0xF442, 0x436B, 0, 0, 0x5B26,
};
+static const unsigned short utf8_to_euc_E698_x0213[] = {
+ 0x752C, 0, 0x3937, 0x5A60, 0xAD75, 0, 0x3A2B, 0x3E3A,
+ 0xAD76, 0x752D, 0x5A5F, 0, 0x3E3B, 0xC179, 0x4C40, 0x3A2A,
+ 0, 0xC17A, 0xC17B, 0x3057, 0x404E, 0x752E, 0xC17D, 0,
+ 0, 0, 0, 0, 0x5A66, 0xC17E, 0x752F, 0x4031,
+ 0x3147, 0xAD77, 0x7531, 0xC224, 0x7532, 0x3D55, 0xC226, 0x4B66,
+ 0x3A72, 0xC227, 0xAD78, 0x7533, 0xC22A, 0x3E3C, 0xC22B, 0x4027,
+ 0x7534, 0x7535, 0, 0x7536, 0x5A65, 0x5A63, 0x5A64, 0xC230,
+ 0, 0xC22F, 0x7530, 0xF442, 0x436B, 0, 0, 0x5B26,
+};
static const unsigned short utf8_to_euc_E699[] = {
0xC231, 0x5A6A, 0x3B7E, 0x3938, 0x5A68, 0xC232, 0xC233, 0,
0, 0x5A69, 0xC234, 0x3F38, 0xC235, 0, 0xC237, 0x5A67,
@@ -3979,6 +7317,16 @@ static const unsigned short utf8_to_euc_E699[] = {
0x5A72, 0, 0, 0xC244, 0x4032, 0xC245, 0x3E3D, 0xC247,
0xC248, 0xC249, 0x4352, 0xC24A, 0xC24C, 0, 0xC243, 0xC246,
};
+static const unsigned short utf8_to_euc_E699_x0213[] = {
+ 0xC231, 0x5A6A, 0x3B7E, 0x3938, 0x5A68, 0xAD79, 0xC233, 0,
+ 0x7538, 0x5A69, 0xC234, 0x3F38, 0x7539, 0, 0xAD7B, 0x5A67,
+ 0, 0xAD7A, 0x3B2F, 0, 0, 0, 0, 0xAD7E,
+ 0xC239, 0x753B, 0x753C, 0xAE21, 0xC23C, 0x5A6C, 0x5A6B, 0x5A70,
+ 0xC23D, 0x753D, 0x5A71, 0xAE22, 0x5A6D, 0x753E, 0x3322, 0x5A6E,
+ 0x5A6F, 0x4855, 0xAE25, 0xAE26, 0xAE27, 0xAE28, 0x4961, 0x374A,
+ 0x5A72, 0, 0, 0x753F, 0x4032, 0xC245, 0x3E3D, 0x7540,
+ 0x7541, 0xC249, 0x4352, 0xAE29, 0xC24C, 0, 0xC243, 0xC246,
+};
static const unsigned short utf8_to_euc_E69A[] = {
0xC24B, 0x3647, 0, 0x5A73, 0x5A77, 0, 0, 0x324B,
0x5A74, 0x5A76, 0, 0xC24D, 0xC24E, 0xC24F, 0x5A75, 0,
@@ -3989,6 +7337,16 @@ static const unsigned short utf8_to_euc_E69A[] = {
0, 0xC25A, 0xC25B, 0, 0x4B3D, 0xC25C, 0, 0,
0x5B22, 0x5A7B, 0, 0xC25D, 0x5A7E, 0, 0x5A7D, 0xC25E,
};
+static const unsigned short utf8_to_euc_E69A_x0213[] = {
+ 0xAE2A, 0x3647, 0, 0x5A73, 0x5A77, 0, 0, 0x324B,
+ 0x5A74, 0x5A76, 0, 0xC24D, 0xC24E, 0x7542, 0x5A75, 0,
+ 0xAE2B, 0x3D6B, 0xAE2C, 0, 0, 0, 0x4348, 0x3045,
+ 0x5A78, 0xAE2D, 0xC253, 0xC254, 0xC255, 0x5A79, 0, 0xC256,
+ 0x7544, 0, 0x442A, 0, 0xC258, 0, 0x4E71, 0,
+ 0, 0, 0, 0x3B43, 0, 0xAE2F, 0x4A6B, 0,
+ 0, 0xAE30, 0x7545, 0, 0x4B3D, 0xAE31, 0, 0,
+ 0x5B22, 0x5A7B, 0, 0x7546, 0x5A7E, 0, 0x5A7D, 0xAE33,
+};
static const unsigned short utf8_to_euc_E69B[] = {
0xC25F, 0x5A7A, 0xC260, 0xC261, 0x5B21, 0, 0, 0x465E,
0xC262, 0x5A7C, 0, 0, 0xC263, 0, 0xC264, 0xC265,
@@ -3999,6 +7357,16 @@ static const unsigned short utf8_to_euc_E69B[] = {
0x5B29, 0, 0x364A, 0x3148, 0x3939, 0x5B2A, 0, 0x5B2B,
0x3D71, 0x4162, 0xC26D, 0xC23F, 0x5258, 0x413E, 0x413D, 0x4258,
};
+static const unsigned short utf8_to_euc_E69B_x0213[] = {
+ 0xC25F, 0x5A7A, 0xC260, 0xC261, 0x5B21, 0, 0x7547, 0x465E,
+ 0x7548, 0x5A7C, 0, 0, 0xC263, 0, 0xC264, 0xC265,
+ 0, 0, 0, 0, 0xC266, 0, 0x5B23, 0,
+ 0, 0x3D6C, 0x5B24, 0x754A, 0x4D4B, 0x4778, 0, 0xC268,
+ 0x5B25, 0, 0, 0, 0, 0, 0x5B27, 0,
+ 0x754B, 0x5B28, 0, 0xC26A, 0xAE35, 0, 0xC26C, 0,
+ 0x5B29, 0, 0x364A, 0x3148, 0x3939, 0x5B2A, 0, 0x5B2B,
+ 0x3D71, 0x4162, 0x754C, 0x7537, 0x5258, 0x413E, 0x413D, 0x4258,
+};
static const unsigned short utf8_to_euc_E69C[] = {
0x3A47, 0, 0, 0x5072, 0, 0xC26E, 0, 0xC26F,
0x376E, 0x4D2D, 0, 0x4A7E, 0, 0x497E, 0xC270, 0x5B2C,
@@ -4009,6 +7377,16 @@ static const unsigned short utf8_to_euc_E69C[] = {
0, 0x3C6B, 0, 0xC276, 0x4B51, 0, 0x5B34, 0x5B37,
0x5B36, 0, 0x3479, 0, 0, 0x3560, 0xC277, 0x5B33,
};
+static const unsigned short utf8_to_euc_E69C_x0213[] = {
+ 0x3A47, 0xAE37, 0, 0x5072, 0, 0xAE38, 0, 0xC26F,
+ 0x376E, 0x4D2D, 0, 0x4A7E, 0, 0x497E, 0xC270, 0x5B2C,
+ 0, 0, 0xAE39, 0x754D, 0x3A73, 0x443F, 0x5B2D, 0x4F2F,
+ 0, 0xAE3B, 0, 0x4B3E, 0xC273, 0x442B, 0x5B2E, 0x347C,
+ 0xC274, 0, 0xC275, 0, 0, 0, 0x5B2F, 0x5B30,
+ 0x4C5A, 0, 0x4C24, 0x4B76, 0x4B5C, 0x3B25, 0x5B32, 0,
+ 0, 0x3C6B, 0, 0x754F, 0x4B51, 0, 0x5B34, 0x5B37,
+ 0x5B36, 0, 0x3479, 0, 0, 0x3560, 0xC277, 0x5B33,
+};
static const unsigned short utf8_to_euc_E69D[] = {
0, 0x5B35, 0, 0, 0, 0xC278, 0x5B38, 0xC279,
0xC27A, 0x3F79, 0, 0, 0xC27B, 0, 0x4D7B, 0x3049,
@@ -4019,6 +7397,16 @@ static const unsigned short utf8_to_euc_E69D[] = {
0x5B3F, 0x456C, 0x5A5E, 0x5A62, 0xC324, 0x354F, 0xC325, 0x4747,
0, 0, 0, 0xC326, 0x5B41, 0, 0x3E3E, 0x4844,
};
+static const unsigned short utf8_to_euc_E69D_x0213[] = {
+ 0, 0x5B35, 0, 0, 0, 0xC278, 0x5B38, 0x7551,
+ 0x7552, 0x3F79, 0, 0, 0xAE3E, 0xAE3F, 0x4D7B, 0x3049,
+ 0x3A60, 0x423C, 0, 0x3C5D, 0xAE40, 0xC27D, 0x3E73, 0,
+ 0, 0x5B3B, 0, 0, 0x454E, 0xAE41, 0x5B39, 0x422B,
+ 0x5B3A, 0x3E72, 0x4C5D, 0x5B3C, 0x5B3D, 0x4D68, 0x7550, 0,
+ 0, 0, 0x5B42, 0, 0xC322, 0x393A, 0xC323, 0x4755,
+ 0x5B3F, 0x456C, 0x5A5E, 0x5A62, 0xAE45, 0x354F, 0xAE46, 0x4747,
+ 0, 0, 0, 0x7553, 0x5B41, 0, 0x3E3E, 0x4844,
+};
static const unsigned short utf8_to_euc_E69E[] = {
0, 0xC327, 0, 0, 0xC328, 0x5B47, 0, 0x487A,
0, 0x5B3E, 0, 0x5B44, 0x5B43, 0, 0xC329, 0xC32A,
@@ -4029,6 +7417,16 @@ static const unsigned short utf8_to_euc_E69E[] = {
0xC331, 0xC332, 0xC333, 0x5B4C, 0x5B4A, 0xC334, 0x324D, 0x5B48,
0x5B4E, 0x5B54, 0, 0xC335, 0xC336, 0xC337, 0, 0,
};
+static const unsigned short utf8_to_euc_E69E_x0213[] = {
+ 0, 0x7554, 0, 0, 0xC328, 0x5B47, 0, 0x487A,
+ 0, 0x5B3E, 0, 0x5B44, 0x5B43, 0, 0xC329, 0xC32A,
+ 0x404F, 0xC32B, 0xAE48, 0x7555, 0, 0x4B6D, 0xC32D, 0x4E53,
+ 0x7556, 0xC32F, 0x4B67, 0x7557, 0x324C, 0x3B5E, 0, 0,
+ 0x4F48, 0x5B46, 0x3F75, 0, 0, 0, 0x5B45, 0,
+ 0, 0x5B40, 0, 0, 0, 0, 0, 0x384F,
+ 0xAE4C, 0xC332, 0xAE4D, 0x5B4C, 0x5B4A, 0xC334, 0x324D, 0x5B48,
+ 0x5B4E, 0x5B54, 0, 0x7558, 0xC336, 0xC337, 0, 0,
+};
static const unsigned short utf8_to_euc_E69F[] = {
0xC339, 0x4248, 0xC33A, 0xC33B, 0x4A41, 0xC33C, 0x5B56, 0,
0xC33D, 0xC33E, 0x4922, 0, 0, 0, 0x5B55, 0x4770,
@@ -4039,6 +7437,16 @@ static const unsigned short utf8_to_euc_E69F[] = {
0xC345, 0x436C, 0xC346, 0x4C78, 0x3C46, 0x3A74, 0xC347, 0xC348,
0, 0xC338, 0, 0x3A3A, 0, 0, 0x4B6F, 0x3341,
};
+static const unsigned short utf8_to_euc_E69F_x0213[] = {
+ 0x755A, 0x4248, 0xC33A, 0xAE4E, 0x4A41, 0xC33C, 0x5B56, 0,
+ 0xAE4F, 0xC33E, 0x4922, 0, 0, 0, 0x5B55, 0x4770,
+ 0x4B3F, 0x343B, 0xAE50, 0x4077, 0x3D40, 0, 0, 0x755B,
+ 0x4453, 0xAE51, 0x4D2E, 0xAE52, 0xC342, 0x5B51, 0x5B50, 0,
+ 0, 0xC343, 0x5B52, 0, 0x5B4F, 0, 0xC344, 0x5B57,
+ 0, 0x5B4D, 0, 0, 0x5B4B, 0, 0x5B53, 0x5B49,
+ 0xAE53, 0x436C, 0xC346, 0x4C78, 0x3C46, 0x3A74, 0xC347, 0xAE54,
+ 0, 0x7559, 0, 0x3A3A, 0x755C, 0, 0x4B6F, 0x3341,
+};
static const unsigned short utf8_to_euc_E6A0[] = {
0, 0xF446, 0x444E, 0x464A, 0x3149, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
@@ -4049,6 +7457,16 @@ static const unsigned short utf8_to_euc_E6A0[] = {
0xC353, 0xC354, 0x5B5E, 0xC355, 0x4073, 0, 0, 0,
0x334B, 0x3A2C, 0, 0xC356, 0x334A, 0x3A4F, 0, 0xC357,
};
+static const unsigned short utf8_to_euc_E6A0_x0213[] = {
+ 0, 0x755D, 0x444E, 0x464A, 0x3149, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0xAE4B, 0, 0, 0x4072, 0xC34A, 0, 0x4034, 0x372A,
+ 0xAE58, 0xC34B, 0, 0, 0, 0x755F, 0x5B59, 0xAE59,
+ 0, 0x393B, 0x337C, 0, 0, 0, 0, 0xC34F,
+ 0xC34E, 0x5B5B, 0x3374, 0x5B61, 0x7560, 0xAE5A, 0, 0xC352,
+ 0xC353, 0x7561, 0x5B5E, 0xAE5C, 0x4073, 0, 0, 0,
+ 0x334B, 0x3A2C, 0, 0xAE5D, 0x334A, 0x3A4F, 0xAE5E, 0xC357,
+};
static const unsigned short utf8_to_euc_E6A1[] = {
0x5B5C, 0x3765, 0x374B, 0x456D, 0xC358, 0xC359, 0x5B5A, 0,
0x3046, 0, 0xC35A, 0, 0xC35B, 0x5B5D, 0x5B5F, 0,
@@ -4059,6 +7477,16 @@ static const unsigned short utf8_to_euc_E6A1[] = {
0xC363, 0xC364, 0xC365, 0, 0x5B6F, 0xC366, 0x3233, 0x5B64,
0, 0xC367, 0xC368, 0xC369, 0xC36A, 0, 0x5B75, 0x5B65,
};
+static const unsigned short utf8_to_euc_E6A1_x0213[] = {
+ 0x5B5C, 0x3765, 0x374B, 0x456D, 0xAE5F, 0xAE60, 0x5B5A, 0,
+ 0x3046, 0xAE61, 0xC35A, 0, 0xAE62, 0x5B5D, 0x5B5F, 0,
+ 0x364D, 0x372C, 0x755E, 0x343C, 0x354B, 0xAE63, 0, 0xAE64,
+ 0xC35E, 0x5B62, 0, 0x7562, 0x3A79, 0x4B71, 0, 0x3B37,
+ 0, 0, 0, 0x5B63, 0, 0, 0, 0x4930,
+ 0, 0, 0, 0xAE66, 0, 0, 0xAE67, 0xC362,
+ 0xC363, 0xC364, 0x7563, 0, 0x5B6F, 0x7564, 0x3233, 0x5B64,
+ 0, 0xC367, 0xAE68, 0xC369, 0xAE69, 0, 0x5B75, 0x5B65,
+};
static const unsigned short utf8_to_euc_E6A2[] = {
0, 0x4E42, 0xC36B, 0x5B6C, 0xC36C, 0x475F, 0xC36D, 0,
0xC36E, 0, 0, 0, 0, 0x5B74, 0, 0x5B67,
@@ -4069,6 +7497,16 @@ static const unsigned short utf8_to_euc_E6A2[] = {
0x3323, 0x3A2D, 0xC379, 0x5B60, 0, 0x5B70, 0x3361, 0,
0, 0x5B6E, 0x5B72, 0xC37A, 0x456E, 0, 0, 0,
};
+static const unsigned short utf8_to_euc_E6A2_x0213[] = {
+ 0, 0x4E42, 0xAE6A, 0x5B6C, 0xC36C, 0x475F, 0xC36D, 0,
+ 0xC36E, 0, 0, 0, 0, 0x5B74, 0, 0x5B67,
+ 0xAE6B, 0, 0, 0x3034, 0x5B69, 0, 0xAE6C, 0x393C,
+ 0xAE6E, 0xAE6F, 0xAE70, 0x5B6B, 0xAE71, 0x5B6A, 0, 0x5B66,
+ 0x5B71, 0xC373, 0x3E3F, 0x7566, 0, 0x7567, 0x546D, 0x3868,
+ 0x4D7C, 0xC376, 0xAE72, 0xAE73, 0, 0x5B68, 0xC378, 0x4474,
+ 0x3323, 0x3A2D, 0x7568, 0x5B60, 0xAE74, 0x5B70, 0x3361, 0,
+ 0, 0x5B6E, 0x5B72, 0xAE75, 0x456E, 0, 0, 0,
+};
static const unsigned short utf8_to_euc_E6A3[] = {
0, 0, 0, 0, 0x347E, 0xC37B, 0x5C32, 0,
0xC37C, 0x4C49, 0x5B77, 0x347D, 0xC37D, 0x5B7E, 0, 0xC37E,
@@ -4079,6 +7517,16 @@ static const unsigned short utf8_to_euc_E6A3[] = {
0xC42E, 0xC42F, 0x4033, 0, 0, 0xC430, 0xC431, 0,
0, 0x5C2A, 0x343D, 0xC432, 0xC433, 0xC434, 0, 0,
};
+static const unsigned short utf8_to_euc_E6A3_x0213[] = {
+ 0, 0, 0, 0xAE7A, 0x347E, 0xAE7B, 0x5C32, 0,
+ 0x7569, 0x4C49, 0x5B77, 0x347D, 0xAE7C, 0x5B7E, 0, 0xAE7D,
+ 0x756A, 0xC422, 0x4B40, 0xC423, 0x5C21, 0x5C23, 0xAE7E, 0x5C27,
+ 0x5B79, 0xAF21, 0x432A, 0, 0xC426, 0xC427, 0, 0x456F,
+ 0x5C2B, 0x5B7C, 0, 0x5C28, 0xAF22, 0xAF23, 0, 0x5C22,
+ 0x756B, 0, 0xC42A, 0xC42B, 0xAF24, 0x756C, 0x3F39, 0x5C2C,
+ 0x756D, 0x756E, 0x4033, 0, 0, 0xC430, 0xC431, 0xAF25,
+ 0, 0x5C2A, 0x343D, 0xAE76, 0x756F, 0xC434, 0, 0,
+};
static const unsigned short utf8_to_euc_E6A4[] = {
0x4F50, 0x5B76, 0, 0, 0x5C26, 0x3058, 0xC435, 0,
0x5B78, 0xC436, 0xC437, 0x4C3A, 0x5B7D, 0x3F22, 0x4447, 0x5B73,
@@ -4089,6 +7537,16 @@ static const unsigned short utf8_to_euc_E6A4[] = {
0x5C3F, 0xC43D, 0, 0xC43E, 0x464E, 0xC43F, 0x5C24, 0,
0xC440, 0x5C3B, 0, 0xC441, 0, 0x5C3D, 0, 0x4458,
};
+static const unsigned short utf8_to_euc_E6A4_x0213[] = {
+ 0x4F50, 0x5B76, 0, 0xAF26, 0x5C26, 0x3058, 0xC435, 0xAF27,
+ 0x5B78, 0xC436, 0x7570, 0x4C3A, 0x5B7D, 0x3F22, 0x4447, 0x5B73,
+ 0xC438, 0xC439, 0x5C25, 0xC43A, 0, 0, 0xC43B, 0xC43C,
+ 0, 0x3F7A, 0x5C2F, 0x3371, 0x3821, 0, 0, 0,
+ 0, 0x5C31, 0x5B7A, 0x5C30, 0, 0x5C29, 0x5B7B, 0,
+ 0x5C2D, 0, 0x5C2E, 0, 0, 0, 0, 0,
+ 0x5C3F, 0xC43D, 0, 0xC43E, 0x464E, 0x7573, 0x5C24, 0,
+ 0xC440, 0x5C3B, 0, 0xAF2B, 0, 0x5C3D, 0, 0x4458,
+};
static const unsigned short utf8_to_euc_E6A5[] = {
0, 0, 0xC442, 0, 0, 0xC443, 0, 0,
0, 0xC444, 0x4D4C, 0, 0, 0, 0xC445, 0,
@@ -4099,6 +7557,16 @@ static const unsigned short utf8_to_euc_E6A5[] = {
0xC44F, 0xC450, 0xC451, 0x4760, 0x5C3C, 0x364B, 0, 0x5C34,
0x5C36, 0x5C33, 0xC452, 0xC453, 0x4F30, 0x335A, 0x5C39, 0xC454,
};
+static const unsigned short utf8_to_euc_E6A5_x0213[] = {
+ 0, 0, 0x7574, 0, 0, 0xC443, 0xAF2D, 0,
+ 0, 0x7571, 0x4D4C, 0, 0, 0, 0xC445, 0,
+ 0, 0, 0, 0x4976, 0x5C38, 0x424A, 0, 0x7575,
+ 0, 0x5C3E, 0x413F, 0xC447, 0x5C35, 0x5C42, 0x5C41, 0,
+ 0x466F, 0x5C40, 0x466A, 0x7576, 0x7577, 0xC44A, 0xC44B, 0,
+ 0x7578, 0xAF2E, 0x5C44, 0x5C37, 0xAF2F, 0x3648, 0x5C3A, 0x3D5D,
+ 0xC44F, 0xC450, 0xAF30, 0x4760, 0x5C3C, 0x364B, 0, 0x5C34,
+ 0x5C36, 0x5C33, 0xAF31, 0xC453, 0x4F30, 0x335A, 0x5C39, 0xAF32,
+};
static const unsigned short utf8_to_euc_E6A6[] = {
0xC455, 0x5C43, 0x3335, 0, 0, 0, 0, 0,
0, 0, 0x3A67, 0, 0, 0xC456, 0x315D, 0,
@@ -4109,6 +7577,16 @@ static const unsigned short utf8_to_euc_E6A6[] = {
0, 0x5C63, 0x5C45, 0, 0x5C58, 0, 0, 0xC461,
0xC462, 0, 0xC463, 0x5C50, 0xC464, 0, 0x5C4B, 0x5C48,
};
+static const unsigned short utf8_to_euc_E6A6_x0213[] = {
+ 0x7579, 0x5C43, 0x3335, 0, 0, 0, 0, 0,
+ 0, 0, 0x3A67, 0, 0, 0xC456, 0x315D, 0,
+ 0, 0x5C54, 0xAF33, 0, 0x4F31, 0x5C57, 0xAF35, 0,
+ 0xAF36, 0, 0, 0x3F3A, 0x5C56, 0, 0, 0,
+ 0x5C55, 0xC45A, 0, 0, 0, 0x757B, 0xAF37, 0x5C52,
+ 0xC45D, 0, 0, 0xC45E, 0, 0x757C, 0x5C46, 0xC460,
+ 0xAF38, 0x5C63, 0x5C45, 0, 0x5C58, 0, 0, 0xAF39,
+ 0xC462, 0, 0xAF3A, 0x5C50, 0xAF3B, 0, 0x5C4B, 0x5C48,
+};
static const unsigned short utf8_to_euc_E6A7[] = {
0, 0x5C49, 0, 0x5C51, 0, 0xC465, 0, 0x7422,
0xC466, 0, 0x5C4E, 0x393D, 0x4448, 0x4164, 0x5C4C, 0,
@@ -4119,6 +7597,16 @@ static const unsigned short utf8_to_euc_E6A7[] = {
0, 0xC46E, 0x5C60, 0xC46F, 0, 0xC470, 0, 0,
0, 0x5C5F, 0, 0x4450, 0, 0x4165, 0xC471, 0x5C5D,
};
+static const unsigned short utf8_to_euc_E6A7_x0213[] = {
+ 0xAF3C, 0x5C49, 0, 0x5C51, 0, 0xC465, 0, 0x7422,
+ 0xC466, 0, 0x5C4E, 0x393D, 0x4448, 0x4164, 0x5C4C, 0x757D,
+ 0x5C47, 0xAF3D, 0, 0x5C4A, 0, 0, 0xAF3E, 0xC469,
+ 0x4D4D, 0x4B6A, 0, 0, 0, 0x5C4F, 0x5C59, 0,
+ 0, 0, 0x7622, 0xAF44, 0, 0xC46B, 0, 0x5C61,
+ 0x5C5A, 0x7623, 0x7624, 0x5C67, 0, 0x5C65, 0xAF45, 0xAF46,
+ 0, 0xC46E, 0x5C60, 0xAF47, 0xAF49, 0x7625, 0x7626, 0,
+ 0, 0x5C5F, 0, 0x4450, 0, 0x4165, 0xAF4A, 0x5C5D,
+};
static const unsigned short utf8_to_euc_E6A8[] = {
0xC472, 0xC473, 0x5C5B, 0xC474, 0, 0x5C62, 0, 0,
0, 0, 0x5C68, 0x4875, 0x5C6E, 0, 0, 0xC475,
@@ -4129,6 +7617,16 @@ static const unsigned short utf8_to_euc_E6A8[] = {
0xC47D, 0, 0xC47E, 0, 0xC521, 0x3E41, 0x5C70, 0xC522,
0x5C77, 0x3C79, 0x3372, 0xC523, 0, 0x432E, 0xC524, 0xC525,
};
+static const unsigned short utf8_to_euc_E6A8_x0213[] = {
+ 0xC472, 0xC473, 0x5C5B, 0xC474, 0, 0x5C62, 0, 0,
+ 0, 0, 0x5C68, 0x4875, 0x5C6E, 0, 0, 0x7627,
+ 0, 0xAF4B, 0x5C69, 0x5C6C, 0x5C66, 0x7628, 0, 0x4374,
+ 0, 0x4938, 0xAF4C, 0x5C5C, 0, 0xAF4D, 0x5C64, 0x3E40,
+ 0xC47A, 0x4C4F, 0x5C78, 0x5C6B, 0xC47B, 0, 0, 0,
+ 0xC47C, 0x3822, 0x3223, 0x335F, 0, 0, 0x5C53, 0,
+ 0xAF41, 0, 0xAF4F, 0xAF50, 0xAF51, 0x3E41, 0x5C70, 0xC522,
+ 0x5C77, 0x3C79, 0x3372, 0x762A, 0, 0x432E, 0x762B, 0xAF52,
+};
static const unsigned short utf8_to_euc_E6A9[] = {
0, 0, 0, 0, 0x5C6D, 0xC526, 0xC527, 0x5C72,
0x5C76, 0xC528, 0xC529, 0x3636, 0, 0, 0xC52A, 0,
@@ -4139,6 +7637,16 @@ static const unsigned short utf8_to_euc_E6A9[] = {
0, 0xC534, 0x5C6F, 0xC535, 0, 0, 0, 0,
0x5C71, 0, 0, 0, 0, 0, 0xC536, 0x3360,
};
+static const unsigned short utf8_to_euc_E6A9_x0213[] = {
+ 0, 0, 0, 0, 0x5C6D, 0x762C, 0xAF53, 0x5C72,
+ 0x5C76, 0xAF54, 0xC529, 0x3636, 0, 0, 0xAF56, 0,
+ 0x762D, 0xC52C, 0xAF57, 0, 0, 0xC52E, 0x762E, 0,
+ 0x354C, 0x5C74, 0, 0x762F, 0, 0, 0, 0x3521,
+ 0, 0x464B, 0x5C73, 0, 0xAF58, 0, 0x5C75, 0xC532,
+ 0, 0, 0xC533, 0x7630, 0, 0, 0, 0,
+ 0, 0xC534, 0x5C6F, 0x7631, 0, 0, 0, 0,
+ 0x5C71, 0, 0xAF55, 0, 0, 0, 0xAF5A, 0x3360,
+};
static const unsigned short utf8_to_euc_E6AA[] = {
0x4349, 0xC537, 0, 0xC538, 0x5C7C, 0, 0xC539, 0xC53A,
0, 0xC53B, 0, 0xC53C, 0, 0x5C7A, 0x3869, 0,
@@ -4149,6 +7657,16 @@ static const unsigned short utf8_to_euc_E6AA[] = {
0xC545, 0xC546, 0, 0x5D27, 0xC547, 0, 0, 0,
0x5D26, 0, 0, 0x5D23, 0, 0xC548, 0xC549, 0xC54A,
};
+static const unsigned short utf8_to_euc_E6AA_x0213[] = {
+ 0x4349, 0xC537, 0, 0xAF5B, 0x5C7C, 0, 0xC539, 0xC53A,
+ 0, 0x7633, 0, 0xAF5C, 0, 0x5C7A, 0x3869, 0,
+ 0x5C79, 0xAF5E, 0, 0, 0x7634, 0, 0, 0x5D21,
+ 0, 0, 0, 0xC53E, 0x5B58, 0x7635, 0x7636, 0xAF5F,
+ 0x5C7B, 0xAF60, 0x5C7D, 0x5C7E, 0, 0x7637, 0, 0,
+ 0, 0, 0x5D2C, 0xAF62, 0x5D28, 0, 0x5B6D, 0xC544,
+ 0xC545, 0xC546, 0, 0x5D27, 0xC547, 0, 0, 0,
+ 0x5D26, 0, 0, 0x5D23, 0, 0xAF63, 0xC549, 0xC54A,
+};
static const unsigned short utf8_to_euc_E6AB[] = {
0, 0x5C6A, 0x5D25, 0x5D24, 0, 0, 0xC54B, 0,
0xC54D, 0xC54C, 0, 0, 0xC54E, 0, 0, 0,
@@ -4159,6 +7677,16 @@ static const unsigned short utf8_to_euc_E6AB[] = {
0xC558, 0xC559, 0xC55A, 0, 0, 0, 0, 0,
0, 0, 0x5D32, 0x5D2F, 0xC55B, 0xC55C, 0, 0,
};
+static const unsigned short utf8_to_euc_E6AB_x0213[] = {
+ 0, 0x5C6A, 0x5D25, 0x5D24, 0, 0, 0xAF64, 0,
+ 0xC54D, 0xC54C, 0, 0, 0xC54E, 0, 0, 0,
+ 0xAF66, 0x5D2A, 0, 0x4F26, 0xAF65, 0xC551, 0xC552, 0,
+ 0, 0, 0x5D2D, 0x367B, 0xAF67, 0xAF68, 0x5D29, 0x5D2B,
+ 0, 0, 0xF44A, 0, 0x7638, 0, 0, 0x7639,
+ 0x4827, 0, 0x5D2E, 0, 0xAF6B, 0, 0, 0,
+ 0xC558, 0xAF6C, 0xAF6D, 0xAF6E, 0, 0, 0, 0,
+ 0, 0, 0x5D32, 0x5D2F, 0xC55B, 0xAF6F, 0, 0,
+};
static const unsigned short utf8_to_euc_E6AC[] = {
0, 0, 0xC55D, 0xC55E, 0x4D73, 0x5D30, 0xC55F, 0xC560,
0, 0xC561, 0x5C5E, 0, 0, 0, 0, 0xC562,
@@ -4169,6 +7697,16 @@ static const unsigned short utf8_to_euc_E6AC[] = {
0, 0, 0x4D5F, 0, 0, 0xC56D, 0xC56E, 0x5D38,
0x5D37, 0x5D3A, 0x353D, 0xC56F, 0, 0x3656, 0x343E, 0xC570,
};
+static const unsigned short utf8_to_euc_E6AC_x0213[] = {
+ 0, 0, 0xC55D, 0xC55E, 0x4D73, 0x5D30, 0xC55F, 0xC560,
+ 0, 0xC561, 0x5C5E, 0xAF71, 0, 0, 0, 0xAF72,
+ 0xAF73, 0xAF74, 0x5D33, 0, 0, 0, 0x5D34, 0xAF76,
+ 0, 0, 0, 0x763C, 0, 0x3135, 0x763D, 0x5D36,
+ 0x3767, 0x3C21, 0, 0x3655, 0xC568, 0, 0, 0x3224,
+ 0xC569, 0, 0, 0xC56A, 0x763E, 0, 0, 0xAF78,
+ 0, 0, 0x4D5F, 0, 0, 0x763F, 0xC56E, 0x5D38,
+ 0x5D37, 0x5D3A, 0x353D, 0xC56F, 0, 0x3656, 0x343E, 0xC570,
+};
static const unsigned short utf8_to_euc_E6AD[] = {
0, 0, 0, 0x5D3D, 0, 0, 0xC571, 0x5D3C,
0, 0x5D3E, 0xC572, 0, 0x324E, 0xC573, 0x4337, 0,
@@ -4179,6 +7717,16 @@ static const unsigned short utf8_to_euc_E6AD[] = {
0xC57C, 0, 0, 0x3A50, 0x4E72, 0xC57D, 0, 0,
0x5D45, 0x5D46, 0, 0x3B60, 0, 0xC57E, 0xC621, 0x5D47,
};
+static const unsigned short utf8_to_euc_E6AD_x0213[] = {
+ 0, 0, 0, 0x5D3D, 0, 0, 0x7640, 0x5D3C,
+ 0, 0x5D3E, 0xAF79, 0, 0x324E, 0xC573, 0x4337, 0,
+ 0x5D3F, 0, 0xC574, 0x343F, 0x5D41, 0, 0x7641, 0,
+ 0xAF7A, 0x5D40, 0, 0x5D42, 0, 0xC577, 0, 0x5D43,
+ 0x7642, 0x5D44, 0x3B5F, 0x4035, 0x3A21, 0x7643, 0x4970, 0x7644,
+ 0, 0x4A62, 0x4F44, 0xC57A, 0xAF7B, 0, 0xC57B, 0x3B75,
+ 0xC57C, 0, 0, 0x3A50, 0x4E72, 0xAF7C, 0, 0x7645,
+ 0x5D45, 0x5D46, 0xAF7D, 0x3B60, 0, 0xC57E, 0xC621, 0x5D47,
+};
static const unsigned short utf8_to_euc_E6AE[] = {
0x5D48, 0, 0xC622, 0x5D4A, 0x5D49, 0xC623, 0x4B58, 0,
0, 0x3D5E, 0x3C6C, 0x3B44, 0, 0x5D4B, 0, 0,
@@ -4189,6 +7737,16 @@ static const unsigned short utf8_to_euc_E6AE[] = {
0xC62F, 0x5D54, 0x5D53, 0x5D55, 0x3225, 0x434A, 0, 0x5D56,
0xC630, 0xC631, 0x3B26, 0x334C, 0x5D57, 0xC632, 0xC633, 0x4542,
};
+static const unsigned short utf8_to_euc_E6AE_x0213[] = {
+ 0x5D48, 0xAF7E, 0x7646, 0x5D4A, 0x5D49, 0xC623, 0x4B58, 0,
+ 0, 0x3D5E, 0x3C6C, 0x3B44, 0, 0x5D4B, 0, 0,
+ 0, 0, 0, 0, 0, 0x5D4D, 0x3F23, 0xC624,
+ 0x5D4C, 0, 0, 0xEE21, 0, 0, 0x5D4E, 0xC626,
+ 0xC627, 0, 0xC628, 0xC629, 0x5D4F, 0, 0, 0,
+ 0xC62A, 0x7647, 0x5D50, 0x5D51, 0xC62C, 0x7648, 0xEE22, 0x5D52,
+ 0xC62F, 0x5D54, 0x5D53, 0x5D55, 0x3225, 0x434A, 0, 0x5D56,
+ 0xC630, 0xC631, 0x3B26, 0x334C, 0x5D57, 0xEE24, 0xEE25, 0x4542,
+};
static const unsigned short utf8_to_euc_E6AF[] = {
0x544C, 0, 0, 0xC634, 0xC635, 0x3523, 0x5D58, 0,
0, 0xC636, 0, 0x5D59, 0xC637, 0x4A6C, 0x4B68, 0,
@@ -4199,6 +7757,16 @@ static const unsigned short utf8_to_euc_E6AF[] = {
0, 0xC63F, 0, 0x5D5E, 0, 0, 0, 0xC640,
0, 0xC641, 0, 0, 0, 0, 0, 0xC642,
};
+static const unsigned short utf8_to_euc_E6AF_x0213[] = {
+ 0x544C, 0, 0, 0xC634, 0xC635, 0x3523, 0x5D58, 0xEE26,
+ 0xEE27, 0xEE28, 0, 0x5D59, 0xC637, 0x4A6C, 0x4B68, 0x764A,
+ 0, 0, 0x4647, 0x5D5A, 0x4866, 0, 0x764B, 0x764C,
+ 0x487B, 0, 0xEE29, 0x4C53, 0, 0, 0, 0x5D5B,
+ 0, 0xC63A, 0, 0xC63B, 0, 0, 0xEE2A, 0xEE2B,
+ 0, 0, 0, 0x5D5D, 0x5D5C, 0, 0xEE2C, 0x5D5F,
+ 0, 0xEE2D, 0, 0x5D5E, 0, 0, 0, 0xC640,
+ 0, 0xC641, 0, 0, 0, 0, 0, 0x764D,
+};
static const unsigned short utf8_to_euc_E6B0[] = {
0, 0, 0xC643, 0, 0xC644, 0xC645, 0, 0,
0x5D61, 0xC646, 0, 0, 0, 0xC647, 0xC648, 0x3B61,
@@ -4209,6 +7777,16 @@ static const unsigned short utf8_to_euc_E6B0[] = {
0, 0, 0, 0xC652, 0x3F65, 0xC653, 0xC654, 0x4939,
0x314A, 0, 0xC655, 0xC656, 0, 0, 0x4845, 0xC657,
};
+static const unsigned short utf8_to_euc_E6B0_x0213[] = {
+ 0, 0, 0xEE2E, 0, 0xC644, 0x764E, 0, 0,
+ 0x5D61, 0xC646, 0xEE2F, 0, 0, 0xC647, 0xEE30, 0x3B61,
+ 0x764F, 0x4C31, 0xC64A, 0x5D62, 0x5D63, 0, 0, 0x3524,
+ 0, 0xC64B, 0, 0x5D64, 0, 0, 0, 0xC64C,
+ 0, 0, 0, 0x5D66, 0x5D65, 0, 0xC64D, 0xC64E,
+ 0xC64F, 0, 0, 0, 0xC650, 0, 0xC651, 0,
+ 0, 0, 0, 0x7650, 0x3F65, 0xEE31, 0xEE32, 0x4939,
+ 0x314A, 0, 0xEE33, 0xC656, 0, 0, 0x4845, 0xEE35,
+};
static const unsigned short utf8_to_euc_E6B1[] = {
0x4475, 0x3D41, 0x3561, 0, 0, 0, 0, 0,
0, 0, 0xC658, 0xC659, 0, 0xC65A, 0x4846, 0xC65B,
@@ -4219,6 +7797,16 @@ static const unsigned short utf8_to_euc_E6B1[] = {
0x4241, 0, 0x3562, 0x5D72, 0xC664, 0, 0xC665, 0,
0xC666, 0xC667, 0x3768, 0xC668, 0, 0x3525, 0x5D70, 0,
};
+static const unsigned short utf8_to_euc_E6B1_x0213[] = {
+ 0x4475, 0x3D41, 0x3561, 0, 0, 0, 0, 0,
+ 0, 0, 0xC658, 0xC659, 0, 0xEE36, 0x4846, 0xC65B,
+ 0x3C2E, 0, 0xC65C, 0, 0xC65D, 0x5D68, 0, 0x3440,
+ 0, 0x7651, 0x3178, 0xEE37, 0x7652, 0x4672, 0x5D67, 0x393E,
+ 0x4353, 0, 0x5D69, 0, 0, 0, 0, 0xEE4F,
+ 0x5D71, 0, 0x5D6A, 0xC661, 0, 0xEE38, 0, 0xC663,
+ 0x4241, 0, 0x3562, 0x5D72, 0x7654, 0, 0x7655, 0,
+ 0xC666, 0xC667, 0x3768, 0xC668, 0, 0x3525, 0x5D70, 0,
+};
static const unsigned short utf8_to_euc_E6B2[] = {
0, 0x5D6E, 0x5D6B, 0x4D60, 0, 0xC669, 0xC66A, 0xC66B,
0x4440, 0xC66C, 0, 0, 0x4659, 0x5D6C, 0, 0,
@@ -4229,6 +7817,16 @@ static const unsigned short utf8_to_euc_E6B2[] = {
0xC673, 0x5D7D, 0xC674, 0x324F, 0xC675, 0, 0, 0,
0x4A28, 0x4C7D, 0x5E21, 0x3C23, 0x3E42, 0x5D78, 0x5D7E, 0x3168,
};
+static const unsigned short utf8_to_euc_E6B2_x0213[] = {
+ 0, 0x5D6E, 0x5D6B, 0x4D60, 0xEE39, 0x7656, 0x7657, 0xC66B,
+ 0x4440, 0xEE3A, 0, 0, 0x4659, 0x5D6C, 0, 0,
+ 0x5D74, 0, 0x5D73, 0x3723, 0xEE3C, 0xEE3D, 0x322D, 0xEE3E,
+ 0x7658, 0x3A3B, 0x5D6D, 0x5D6F, 0x7659, 0, 0, 0xC672,
+ 0, 0x4B57, 0x4274, 0, 0, 0, 0, 0,
+ 0, 0, 0x7653, 0x4B77, 0, 0xEE3F, 0x5D7C, 0,
+ 0xC673, 0x5D7D, 0xC674, 0x324F, 0xC675, 0, 0, 0,
+ 0x4A28, 0x4C7D, 0x5E21, 0x3C23, 0x3E42, 0x5D78, 0x5D7E, 0x3168,
+};
static const unsigned short utf8_to_euc_E6B3[] = {
0, 0x3637, 0xC676, 0, 0x5D75, 0x5D7A, 0xC677, 0,
0, 0x4074, 0x4771, 0, 0x4867, 0xC678, 0, 0xC679,
@@ -4239,6 +7837,16 @@ static const unsigned short utf8_to_euc_E6B3[] = {
0x4259, 0x5D76, 0xC729, 0x314B, 0xC72A, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
};
+static const unsigned short utf8_to_euc_E6B3_x0213[] = {
+ 0, 0x3637, 0xEE40, 0, 0x5D75, 0x5D7A, 0x765B, 0,
+ 0, 0x4074, 0x4771, 0, 0x4867, 0xC678, 0, 0xC679,
+ 0xEE41, 0xC67B, 0xC67C, 0x5D77, 0x765C, 0x4B21, 0xEE43, 0x5D79,
+ 0, 0x5E24, 0xEE44, 0x5E22, 0xEE45, 0x5D7B, 0, 0,
+ 0x765D, 0x4B22, 0x4748, 0x3563, 0, 0x4525, 0, 0xC724,
+ 0x436D, 0xEE46, 0x5E25, 0x765E, 0xEE47, 0xEE48, 0x765F, 0x5E23,
+ 0x4259, 0x5D76, 0xC729, 0x314B, 0xC72A, 0, 0, 0,
+ 0, 0, 0, 0x765A, 0, 0, 0, 0,
+};
static const unsigned short utf8_to_euc_E6B4[] = {
0, 0, 0, 0, 0xC72B, 0, 0, 0xC72C,
0, 0, 0xC72D, 0x4D4E, 0x5E30, 0, 0xC72E, 0xC72F,
@@ -4249,6 +7857,16 @@ static const unsigned short utf8_to_euc_E6B4[] = {
0, 0xC739, 0x3D27, 0x5E2E, 0, 0x5E2D, 0x5E28, 0,
0x5E2B, 0xC73A, 0, 0x3368, 0xC73B, 0x5E2A, 0x4749, 0xC73C,
};
+static const unsigned short utf8_to_euc_E6B4_x0213[] = {
+ 0xEE4A, 0, 0, 0, 0x7661, 0, 0, 0xC72C,
+ 0, 0, 0xEE4B, 0x4D4E, 0x5E30, 0, 0x7662, 0xC72F,
+ 0, 0xC730, 0x5E2F, 0xC731, 0, 0, 0, 0x4076,
+ 0, 0x5E2C, 0xC732, 0x4D6C, 0, 0, 0x4636, 0x5E26,
+ 0, 0, 0, 0, 0xEE4C, 0x4445, 0xEE4D, 0xEE4E,
+ 0xC735, 0x314C, 0x393F, 0x5E29, 0, 0, 0x7663, 0xEE50,
+ 0, 0x7664, 0x3D27, 0x5E2E, 0xEE65, 0x5E2D, 0x5E28, 0,
+ 0x5E2B, 0x7665, 0, 0x3368, 0xEE51, 0x5E2A, 0x4749, 0x7666,
+};
static const unsigned short utf8_to_euc_E6B5[] = {
0, 0x4E2E, 0, 0, 0x3E74, 0x4075, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
@@ -4259,6 +7877,16 @@ static const unsigned short utf8_to_euc_E6B5[] = {
0xC744, 0, 0, 0, 0x4D61, 0, 0, 0x3324,
0x3F3B, 0x5E35, 0, 0, 0xC745, 0, 0, 0,
};
+static const unsigned short utf8_to_euc_E6B5_x0213[] = {
+ 0, 0x4E2E, 0, 0, 0x3E74, 0x4075, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0xC73D,
+ 0x7667, 0x5E36, 0x5E34, 0xEE52, 0x494D, 0, 0xEE53, 0xC73F,
+ 0xEE54, 0xC740, 0, 0x5E31, 0x5E33, 0x7668, 0x313A, 0xC742,
+ 0, 0x3940, 0x4F32, 0, 0x333D, 0, 0x4962, 0xC743,
+ 0xEE55, 0, 0, 0, 0x4D61, 0, 0, 0x3324,
+ 0x3F3B, 0x5E35, 0, 0, 0xC745, 0, 0, 0,
+};
static const unsigned short utf8_to_euc_E6B6[] = {
0, 0, 0xC746, 0, 0, 0x5E3A, 0, 0xC747,
0x3E43, 0, 0, 0, 0x4D30, 0, 0x5E37, 0,
@@ -4269,6 +7897,16 @@ static const unsigned short utf8_to_euc_E6B6[] = {
0, 0, 0x3155, 0, 0xC750, 0x5E3E, 0, 0xC751,
0x5E41, 0xC752, 0, 0, 0x4E43, 0xC753, 0, 0xC754,
};
+static const unsigned short utf8_to_euc_E6B6_x0213[] = {
+ 0xEE56, 0xEE57, 0x766A, 0, 0, 0x5E3A, 0, 0x766B,
+ 0x3E43, 0x766C, 0xEE58, 0, 0x4D30, 0xEE59, 0x5E37, 0,
+ 0, 0xEE5A, 0xC749, 0x5E32, 0x766D, 0x5E38, 0xC74B, 0xC74C,
+ 0xEE5B, 0x4E5E, 0, 0x4573, 0x4642, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0x766E, 0xEE61, 0x766F, 0, 0xEE62, 0x3336,
+ 0, 0, 0x3155, 0, 0xEE63, 0x5E3E, 0, 0xC751,
+ 0x5E41, 0xC752, 0, 0, 0x4E43, 0xC753, 0, 0x7670,
+};
static const unsigned short utf8_to_euc_E6B7[] = {
0x4D64, 0, 0, 0, 0xC755, 0x5E48, 0x5E42, 0x5E3F,
0xC756, 0, 0xC757, 0x4E54, 0x5E45, 0, 0xC758, 0xC759,
@@ -4279,6 +7917,16 @@ static const unsigned short utf8_to_euc_E6B7[] = {
0xC763, 0x3F3C, 0xF44C, 0x3D5F, 0xC764, 0x4A25, 0xC765, 0x3A2E,
0xF44B, 0x5E3B, 0x5E49, 0x453A, 0xC766, 0, 0, 0,
};
+static const unsigned short utf8_to_euc_E6B7_x0213[] = {
+ 0x4D64, 0, 0xEE64, 0, 0x7671, 0x5E48, 0x5E42, 0x5E3F,
+ 0xEE66, 0, 0xC757, 0x4E54, 0x5E45, 0, 0xEE67, 0xEE68,
+ 0xEE69, 0x3D4A, 0x5E47, 0, 0, 0x5E4C, 0x7672, 0,
+ 0x4571, 0x5E4A, 0x7673, 0x7674, 0, 0x7675, 0x5E44, 0xEE6A,
+ 0xC75E, 0x4338, 0xC75F, 0, 0x5E4B, 0xC760, 0x5E40, 0,
+ 0x5E46, 0xEE6B, 0x5E4D, 0x307C, 0x5E43, 0, 0x5E4E, 0xC762,
+ 0xC763, 0x3F3C, 0xF44C, 0x3D5F, 0xC764, 0x4A25, 0xEE6C, 0x3A2E,
+ 0xF44B, 0x5E3B, 0x5E49, 0x453A, 0x7676, 0, 0, 0,
+};
static const unsigned short utf8_to_euc_E6B8[] = {
0xC767, 0, 0, 0, 0xC768, 0x4036, 0, 0x3369,
0x3A51, 0x3E44, 0x5E3D, 0x3D42, 0, 0, 0, 0,
@@ -4289,6 +7937,16 @@ static const unsigned short utf8_to_euc_E6B8[] = {
0, 0, 0xC76C, 0, 0, 0, 0xC76D, 0,
0x5E62, 0xC76E, 0x5E5D, 0xC76F, 0xC770, 0, 0x5E55, 0,
};
+static const unsigned short utf8_to_euc_E6B8_x0213[] = {
+ 0xC767, 0, 0, 0, 0xC768, 0x4036, 0, 0x3369,
+ 0x3A51, 0x3E44, 0x5E3D, 0x3D42, 0, 0, 0, 0,
+ 0, 0, 0, 0x374C, 0, 0x5E3C, 0, 0xEE5D,
+ 0, 0x5E52, 0x3D6D, 0x383A, 0, 0x5E61, 0xEE6E, 0x5E5B,
+ 0x3574, 0x454F, 0xEE6F, 0x5E56, 0x5E5F, 0x302F, 0x3132, 0xEE70,
+ 0, 0x3239, 0, 0x5E58, 0x422C, 0x5E4F, 0x5E51, 0x3941,
+ 0, 0, 0xEE72, 0, 0x7678, 0, 0xEE6D, 0,
+ 0x5E62, 0xC76E, 0x5E5D, 0xC76F, 0xEE73, 0, 0x5E55, 0,
+};
static const unsigned short utf8_to_euc_E6B9[] = {
0, 0, 0, 0x5E5C, 0xC771, 0xC772, 0, 0,
0xC773, 0xC774, 0x4C2B, 0xC775, 0, 0x5E5A, 0x5E5E, 0xC776,
@@ -4299,6 +7957,16 @@ static const unsigned short utf8_to_euc_E6B9[] = {
0, 0, 0x5E53, 0xC824, 0, 0, 0x5E59, 0,
0, 0, 0, 0xC825, 0, 0xC826, 0x4F51, 0x3C3E,
};
+static const unsigned short utf8_to_euc_E6B9_x0213[] = {
+ 0, 0, 0, 0x5E5C, 0x7679, 0xC772, 0, 0,
+ 0xEE74, 0xEE75, 0x4C2B, 0xEE76, 0xEE77, 0x5E5A, 0x5E5E, 0xEE78,
+ 0, 0xEE79, 0xC778, 0xEE7A, 0xEE7B, 0, 0x3850, 0xEE7C,
+ 0x3E45, 0, 0, 0x4339, 0x767A, 0xC77D, 0x767B, 0x5E54,
+ 0, 0, 0xC821, 0xEE7D, 0, 0, 0, 0x4D2F,
+ 0xC823, 0, 0, 0x5E57, 0, 0, 0x5E50, 0x4572,
+ 0, 0, 0x5E53, 0xC824, 0, 0, 0x5E59, 0,
+ 0, 0, 0, 0xC825, 0, 0xC826, 0x4F51, 0x3C3E,
+};
static const unsigned short utf8_to_euc_E6BA[] = {
0x4B7E, 0, 0x5E63, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0x482E, 0xC827, 0, 0x5E6F,
@@ -4309,6 +7977,16 @@ static const unsigned short utf8_to_euc_E6BA[] = {
0, 0xC82E, 0x5E6C, 0xC82F, 0, 0, 0x4D4F, 0x5E67,
0, 0, 0x452E, 0xC830, 0, 0x5E69, 0, 0xC831,
};
+static const unsigned short utf8_to_euc_E6BA_x0213[] = {
+ 0x4B7E, 0, 0x5E63, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0x482E, 0xC827, 0, 0x5E6F,
+ 0x383B, 0, 0, 0xEF21, 0, 0, 0x3D60, 0,
+ 0x5E65, 0xC829, 0, 0, 0x4E2F, 0x3942, 0, 0x5E72,
+ 0xC82A, 0, 0x306E, 0, 0, 0x5E70, 0, 0xEF22,
+ 0, 0, 0x5E64, 0x767C, 0, 0xC82C, 0xC82D, 0x5E6A,
+ 0, 0x767D, 0x5E6C, 0xC82F, 0xEF23, 0, 0x4D4F, 0x5E67,
+ 0, 0, 0x452E, 0xC830, 0, 0x5E69, 0, 0xEF24,
+};
static const unsigned short utf8_to_euc_E6BB[] = {
0xC832, 0xC833, 0x5E71, 0xC834, 0x5E6B, 0x4C47, 0, 0xC835,
0xC836, 0x5E66, 0xC837, 0x3C22, 0x5E7E, 0xC838, 0xC839, 0xC83A,
@@ -4319,6 +7997,16 @@ static const unsigned short utf8_to_euc_E6BB[] = {
0, 0, 0x5E7A, 0, 0x4529, 0, 0, 0x5F23,
0x5E77, 0xC83E, 0, 0xC83F, 0, 0xC840, 0x5E78, 0x5E60,
};
+static const unsigned short utf8_to_euc_E6BB_x0213[] = {
+ 0xC832, 0x767E, 0x5E71, 0xEF25, 0x5E6B, 0x4C47, 0, 0x7721,
+ 0xC836, 0x5E66, 0xEF26, 0x3C22, 0x5E7E, 0xC838, 0x7722, 0xC83A,
+ 0, 0x336A, 0, 0x5E68, 0x5E6D, 0x5E6E, 0, 0,
+ 0, 0xEF27, 0, 0, 0, 0x426C, 0x425A, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0xEF29, 0x5E76, 0xC83C, 0xC83D, 0x5E7C,
+ 0, 0, 0x5E7A, 0, 0x4529, 0, 0, 0x5F23,
+ 0x5E77, 0xEF2A, 0, 0xEF2B, 0, 0xC840, 0x5E78, 0x5E60,
+};
static const unsigned short utf8_to_euc_E6BC[] = {
0, 0x3579, 0x493A, 0, 0xC841, 0, 0x3C3F, 0,
0xC842, 0x3977, 0xC843, 0, 0xC844, 0xC845, 0, 0x4F33,
@@ -4329,6 +8017,16 @@ static const unsigned short utf8_to_euc_E6BC[] = {
0xC84E, 0x5E7B, 0x5E7D, 0xC84F, 0, 0, 0xC850, 0,
0x4132, 0, 0, 0xC851, 0xC852, 0, 0x5F21, 0x5E79,
};
+static const unsigned short utf8_to_euc_E6BC_x0213[] = {
+ 0, 0x3579, 0x493A, 0, 0xC841, 0, 0x3C3F, 0,
+ 0xC842, 0x3977, 0xEF2C, 0, 0xEF2D, 0xC845, 0, 0x4F33,
+ 0x7723, 0x5E74, 0, 0x5F22, 0x3169, 0x4166, 0xC846, 0,
+ 0xEF2E, 0, 0x7724, 0xC849, 0, 0, 0, 0,
+ 0x4779, 0, 0x3441, 0x4E7A, 0, 0xEF2F, 0xC84A, 0,
+ 0, 0xC84B, 0x7726, 0x4C21, 0x4452, 0xC853, 0, 0x7727,
+ 0xC84E, 0x5E7B, 0x5E7D, 0x7728, 0, 0xEF28, 0xEF30, 0,
+ 0x4132, 0, 0, 0xC851, 0xEF31, 0, 0x5F21, 0x5E79,
+};
static const unsigned short utf8_to_euc_E6BD[] = {
0, 0x5E73, 0, 0, 0, 0x3443, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0xC854,
@@ -4339,6 +8037,16 @@ static const unsigned short utf8_to_euc_E6BD[] = {
0x4459, 0, 0, 0, 0x5F4C, 0, 0, 0,
0x5F26, 0, 0x5F25, 0, 0x5F2E, 0xC861, 0xC862, 0,
};
+static const unsigned short utf8_to_euc_E6BD_x0213[] = {
+ 0, 0x5E73, 0, 0, 0, 0x3443, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0xC854,
+ 0, 0x7729, 0xEF33, 0xC857, 0x3769, 0, 0, 0xEF34,
+ 0x5F2F, 0x772A, 0xEF35, 0x5F2A, 0x4078, 0xC85B, 0x772B, 0x3363,
+ 0xEF36, 0x772C, 0x772D, 0, 0x3D61, 0, 0x5F33, 0,
+ 0xEF37, 0, 0, 0, 0xC860, 0x5F2C, 0x442C, 0x5F29,
+ 0x4459, 0, 0, 0, 0x5F4C, 0, 0, 0,
+ 0x5F26, 0, 0x5F25, 0, 0x5F2E, 0xEF39, 0x772E, 0,
+};
static const unsigned short utf8_to_euc_E6BE[] = {
0x5F28, 0x5F27, 0x5F2D, 0xC863, 0x4021, 0, 0x5F24, 0xC864,
0xC865, 0, 0, 0xC866, 0xC867, 0xC868, 0x5F30, 0,
@@ -4349,6 +8057,16 @@ static const unsigned short utf8_to_euc_E6BE[] = {
0xC877, 0x4543, 0, 0x5F34, 0, 0xC878, 0xC879, 0,
0, 0x5F38, 0, 0, 0xC87A, 0, 0, 0,
};
+static const unsigned short utf8_to_euc_E6BE_x0213[] = {
+ 0x5F28, 0x5F27, 0x5F2D, 0xC863, 0x4021, 0, 0x5F24, 0xC864,
+ 0x772F, 0, 0, 0xC866, 0x7730, 0x7731, 0x5F30, 0,
+ 0xEF3A, 0x5F31, 0xC86A, 0xC86B, 0x7732, 0, 0xEF3B, 0x3442,
+ 0xEF38, 0, 0xC86E, 0, 0, 0, 0, 0xEF3D,
+ 0x7733, 0x5F36, 0, 0x5F35, 0x5F37, 0xEF3E, 0xC872, 0x7734,
+ 0xC874, 0, 0x5F3A, 0, 0, 0, 0xC875, 0xEF3F,
+ 0xC877, 0x4543, 0, 0x5F34, 0, 0xEF41, 0x7735, 0,
+ 0, 0x5F38, 0, 0, 0x7736, 0, 0xEF3C, 0,
+};
static const unsigned short utf8_to_euc_E6BF[] = {
0x3763, 0x4279, 0x5F32, 0x473B, 0, 0xC87B, 0x5F39, 0xC87C,
0xC87D, 0, 0xC87E, 0, 0, 0, 0, 0,
@@ -4359,6 +8077,16 @@ static const unsigned short utf8_to_euc_E6BF[] = {
0xC925, 0x5F40, 0, 0x5F2B, 0, 0xC926, 0x6F69, 0,
0, 0xC927, 0x5F45, 0, 0xC928, 0xC929, 0x5F49, 0,
};
+static const unsigned short utf8_to_euc_E6BF_x0213[] = {
+ 0x3763, 0x4279, 0x5F32, 0x473B, 0, 0xC87B, 0x5F39, 0x7737,
+ 0xEF42, 0xEF43, 0x7738, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0x5F3E, 0x5F3C, 0, 0,
+ 0x5F3F, 0, 0xEF44, 0x5F42, 0, 0, 0xEF45, 0x5F3B,
+ 0x396A, 0x4728, 0, 0, 0x5E39, 0, 0, 0,
+ 0xC923, 0xEF46, 0, 0x4D74, 0x5F3D, 0, 0x5F41, 0x4275,
+ 0x773A, 0x5F40, 0, 0x5F2B, 0, 0x773B, 0x6F69, 0,
+ 0, 0x7739, 0x5F45, 0, 0xEF48, 0xC929, 0x5F49, 0,
+};
static const unsigned short utf8_to_euc_E780[] = {
0xC92A, 0x5F47, 0, 0, 0, 0xC92B, 0xC92C, 0xC92D,
0, 0x5F43, 0, 0x5F44, 0, 0xC92E, 0, 0x5F48,
@@ -4369,6 +8097,16 @@ static const unsigned short utf8_to_euc_E780[] = {
0x5F50, 0, 0x5F52, 0, 0xC933, 0, 0, 0xC934,
0, 0xC935, 0, 0, 0xC936, 0, 0x5F51, 0,
};
+static const unsigned short utf8_to_euc_E780_x0213[] = {
+ 0xEF49, 0x5F47, 0, 0, 0, 0x773C, 0x773D, 0xEF4A,
+ 0, 0x5F43, 0xEF4B, 0x5F44, 0, 0xC92E, 0, 0x5F48,
+ 0, 0x5F46, 0, 0, 0, 0x494E, 0, 0xC92F,
+ 0x5F4E, 0, 0x5F4B, 0x5F4A, 0, 0x5F4D, 0x4654, 0x5F4F,
+ 0xC930, 0, 0, 0xEF4C, 0, 0, 0x4375, 0x426D,
+ 0x773E, 0, 0, 0, 0x4025, 0, 0, 0xC932,
+ 0x5F50, 0, 0x5F52, 0, 0xC933, 0, 0, 0xC934,
+ 0, 0xEF4E, 0xEF4F, 0, 0xEF50, 0, 0x5F51, 0,
+};
static const unsigned short utf8_to_euc_E781[] = {
0, 0, 0, 0xC937, 0xC938, 0, 0, 0,
0xC939, 0xC93A, 0xC93B, 0xC93C, 0x5E75, 0, 0xC941, 0,
@@ -4379,6 +8117,16 @@ static const unsigned short utf8_to_euc_E781[] = {
0x3325, 0, 0, 0, 0, 0xC946, 0xC947, 0,
0x3564, 0, 0, 0, 0x3C5E, 0x3A52, 0xC948, 0,
};
+static const unsigned short utf8_to_euc_E781_x0213[] = {
+ 0, 0, 0, 0xEF51, 0xC938, 0, 0, 0xEF52,
+ 0xC939, 0xC93A, 0x773F, 0xEF53, 0x5E75, 0, 0x7742, 0,
+ 0, 0x5F53, 0, 0, 0xEF55, 0xC93E, 0, 0,
+ 0x4667, 0, 0, 0, 0, 0x7740, 0x7741, 0,
+ 0, 0, 0, 0x5F54, 0x7743, 0xEF56, 0, 0,
+ 0, 0xEF57, 0, 0x3250, 0xEF58, 0, 0xEF59, 0x4574,
+ 0x3325, 0, 0, 0, 0, 0x7744, 0xEF5A, 0,
+ 0x3564, 0, 0, 0, 0x3C5E, 0x3A52, 0xEF5B, 0,
+};
static const unsigned short utf8_to_euc_E782[] = {
0, 0xC949, 0, 0, 0, 0xC94A, 0xC94B, 0,
0, 0x4F27, 0x3F66, 0, 0, 0, 0x316A, 0,
@@ -4389,6 +8137,16 @@ static const unsigned short utf8_to_euc_E782[] = {
0xC954, 0xC955, 0, 0x5F5B, 0xC956, 0, 0, 0xC957,
0x5F5A, 0x4540, 0x3059, 0xF42E, 0, 0, 0, 0,
};
+static const unsigned short utf8_to_euc_E782_x0213[] = {
+ 0, 0xEF5C, 0, 0, 0, 0x7745, 0xEF5D, 0,
+ 0, 0x4F27, 0x3F66, 0, 0, 0, 0x316A, 0,
+ 0, 0, 0x5F56, 0, 0xC94C, 0xEF5E, 0xC94E, 0xEF5F,
+ 0xC950, 0x5F55, 0, 0xC951, 0, 0, 0, 0xEF62,
+ 0, 0, 0, 0, 0x7746, 0, 0, 0,
+ 0, 0, 0, 0x7747, 0x5F59, 0x433A, 0x5F5C, 0x5F57,
+ 0xC954, 0xEF63, 0, 0x5F5B, 0xC956, 0, 0, 0x7748,
+ 0x5F5A, 0x4540, 0x3059, 0xEF60, 0, 0, 0, 0,
+};
static const unsigned short utf8_to_euc_E783[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0x4E75, 0, 0xC958, 0x5F5E, 0, 0, 0, 0x3128,
@@ -4399,6 +8157,16 @@ static const unsigned short utf8_to_euc_E783[] = {
0, 0x5F58, 0, 0, 0, 0, 0, 0,
0, 0x4B23, 0xC961, 0, 0, 0x5F62, 0, 0,
};
+static const unsigned short utf8_to_euc_E783_x0213[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0x4E75, 0, 0xEF66, 0x5F5E, 0, 0, 0, 0x3128,
+ 0, 0xEF67, 0, 0xEF68, 0x7749, 0xC95C, 0xC95D, 0,
+ 0x774A, 0x5F60, 0, 0, 0xEF69, 0x5F5F, 0, 0x5F5D,
+ 0, 0, 0, 0, 0x774B, 0, 0, 0,
+ 0, 0, 0, 0, 0xEF65, 0, 0, 0,
+ 0, 0x5F58, 0, 0, 0, 0, 0, 0,
+ 0, 0x4B23, 0xC961, 0, 0, 0x5F62, 0, 0,
+};
static const unsigned short utf8_to_euc_E784[] = {
0, 0, 0, 0xC962, 0xC963, 0xC964, 0xC965, 0xC966,
0, 0x5F61, 0, 0xC967, 0xC968, 0, 0, 0xC969,
@@ -4409,6 +8177,16 @@ static const unsigned short utf8_to_euc_E784[] = {
0xC96F, 0xC970, 0, 0, 0, 0, 0x4133, 0,
0xC971, 0, 0, 0, 0x3E46, 0, 0, 0,
};
+static const unsigned short utf8_to_euc_E784_x0213[] = {
+ 0, 0, 0, 0xEF6A, 0xEF6B, 0xC964, 0xEF6C, 0xEF6D,
+ 0xEF6E, 0x5F61, 0, 0xC967, 0xEF6F, 0, 0, 0x774C,
+ 0, 0, 0, 0, 0x316B, 0, 0, 0,
+ 0, 0x5F64, 0x4A32, 0, 0x5F63, 0, 0x774E, 0,
+ 0x774F, 0x4C35, 0, 0, 0, 0, 0x3E47, 0,
+ 0, 0, 0, 0x774D, 0, 0xC96D, 0x7750, 0xEF71,
+ 0x7751, 0xEF72, 0, 0, 0, 0, 0x4133, 0,
+ 0xC971, 0, 0, 0, 0x3E46, 0, 0, 0,
+};
static const unsigned short utf8_to_euc_E785[] = {
0, 0xC972, 0, 0, 0, 0xC973, 0xC974, 0xC975,
0, 0x4E7B, 0xC976, 0xC977, 0x5F6A, 0, 0x4079, 0,
@@ -4419,6 +8197,16 @@ static const unsigned short utf8_to_euc_E785[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0xCA22, 0, 0, 0, 0x407A, 0, 0,
};
+static const unsigned short utf8_to_euc_E785_x0213[] = {
+ 0, 0xC972, 0, 0, 0, 0xC973, 0x7752, 0x7753,
+ 0, 0x4E7B, 0xEF74, 0xC977, 0x5F6A, 0, 0x4079, 0,
+ 0xEF73, 0x7754, 0x7756, 0xEF75, 0, 0x5F66, 0x5F6B, 0xC97A,
+ 0, 0x316C, 0xC97B, 0, 0x7757, 0, 0xEF76, 0,
+ 0x7758, 0, 0x5F69, 0, 0x4761, 0x5F65, 0x5F68, 0x3E48,
+ 0x7759, 0x4851, 0, 0, 0x5F6C, 0, 0x3C51, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0xCA22, 0, 0, 0, 0x407A, 0, 0,
+};
static const unsigned short utf8_to_euc_E786[] = {
0xCA23, 0, 0, 0, 0x5F6F, 0xCA24, 0, 0xCA25,
0x5F67, 0, 0x3727, 0, 0xCA26, 0, 0, 0x5F6D,
@@ -4429,6 +8217,16 @@ static const unsigned short utf8_to_euc_E786[] = {
0xCA2D, 0x472E, 0xCA2E, 0xCA2F, 0, 0, 0, 0,
0, 0x5F74, 0xCA30, 0, 0, 0, 0x5F75, 0xCA31,
};
+static const unsigned short utf8_to_euc_E786_x0213[] = {
+ 0xEF79, 0, 0, 0, 0x5F6F, 0x775B, 0, 0x775C,
+ 0x5F67, 0, 0x3727, 0, 0xCA26, 0, 0, 0x5F6D,
+ 0, 0, 0x775D, 0, 0x4D50, 0x5F70, 0xEF78, 0,
+ 0, 0x7426, 0xCA28, 0xEF7A, 0, 0, 0, 0x3D4F,
+ 0xEF7B, 0, 0xEF7C, 0, 0, 0, 0, 0,
+ 0x5F71, 0, 0, 0, 0x5F72, 0, 0xEF7D, 0xEF7E,
+ 0xCA2D, 0x472E, 0xCA2E, 0xF021, 0, 0, 0, 0,
+ 0, 0x5F74, 0x775F, 0, 0, 0, 0x5F75, 0xCA31,
+};
static const unsigned short utf8_to_euc_E787[] = {
0xCA32, 0xCA33, 0, 0x4733, 0xCA34, 0, 0, 0,
0x4575, 0x5F77, 0, 0xCA35, 0xCA36, 0, 0x5F79, 0,
@@ -4439,6 +8237,16 @@ static const unsigned short utf8_to_euc_E787[] = {
0, 0, 0, 0, 0, 0x5F7D, 0, 0,
0xCA3C, 0x6021, 0, 0x5F6E, 0x5F7E, 0, 0xCA3D, 0x6022,
};
+static const unsigned short utf8_to_euc_E787_x0213[] = {
+ 0xCA32, 0x775E, 0, 0x4733, 0x7760, 0, 0, 0,
+ 0x4575, 0x5F77, 0, 0xF023, 0xCA36, 0, 0x5F79, 0,
+ 0x4E55, 0, 0x5F76, 0xF024, 0x5F78, 0x316D, 0xCA38, 0x5F73,
+ 0, 0xF025, 0xCA3A, 0, 0xF026, 0, 0, 0x535B,
+ 0x5F7A, 0, 0, 0, 0, 0x4167, 0x3B38, 0x5F7C,
+ 0, 0, 0, 0, 0x5F7B, 0x3F24, 0x5259, 0,
+ 0, 0, 0, 0, 0, 0x5F7D, 0, 0,
+ 0xCA3C, 0x6021, 0, 0x5F6E, 0x5F7E, 0, 0x7761, 0x6022,
+};
static const unsigned short utf8_to_euc_E788[] = {
0xCA3E, 0, 0, 0, 0, 0, 0x477A, 0xCA3F,
0xCA40, 0xCA41, 0, 0, 0, 0x6023, 0, 0,
@@ -4449,6 +8257,16 @@ static const unsigned short utf8_to_euc_E788[] = {
0x6029, 0, 0x602A, 0, 0xCA4A, 0x3C5F, 0x4963, 0,
0xCA4B, 0xCA4C, 0x4C6C, 0x602B, 0x602C, 0x4156, 0x3C24, 0x602D,
};
+static const unsigned short utf8_to_euc_E788_x0213[] = {
+ 0x7762, 0, 0, 0, 0, 0, 0x477A, 0xF027,
+ 0xCA40, 0xCA41, 0, 0, 0, 0x6023, 0, 0,
+ 0x6024, 0, 0, 0xCA42, 0, 0x7763, 0, 0xCA43,
+ 0, 0, 0xCA44, 0x6025, 0, 0xCA45, 0, 0xCA46,
+ 0, 0, 0, 0, 0xCA47, 0, 0, 0,
+ 0x6026, 0, 0x445E, 0xF02A, 0x6028, 0x6027, 0, 0xCA49,
+ 0x6029, 0, 0x602A, 0, 0xF02B, 0x3C5F, 0x4963, 0,
+ 0xF02C, 0xF02D, 0x4C6C, 0x602B, 0x602C, 0x4156, 0x3C24, 0x602D,
+};
static const unsigned short utf8_to_euc_E789[] = {
0x602E, 0xCA4D, 0xCA4E, 0xCA4F, 0, 0xCA50, 0x602F, 0x4A52,
0x4847, 0, 0, 0x6030, 0x4757, 0, 0xCA51, 0xCA52,
@@ -4459,6 +8277,16 @@ static const unsigned short utf8_to_euc_E789[] = {
0, 0xCA60, 0x4037, 0, 0x6032, 0, 0, 0xCA61,
0xCA62, 0x4643, 0, 0xCA63, 0xCA64, 0x3823, 0x6033, 0xCA65,
};
+static const unsigned short utf8_to_euc_E789_x0213[] = {
+ 0x602E, 0xCA4D, 0xF02F, 0xCA4F, 0, 0xCA50, 0x602F, 0x4A52,
+ 0x4847, 0, 0, 0x6030, 0x4757, 0, 0xCA51, 0xCA52,
+ 0xCA53, 0, 0x442D, 0xF030, 0, 0x7764, 0x7765, 0xF031,
+ 0x6031, 0x3267, 0xCA57, 0x356D, 0xCA58, 0x4C46, 0xCA59, 0x4C36,
+ 0xCA5A, 0x3234, 0x4F34, 0xF032, 0, 0, 0, 0x4B52,
+ 0xCA5C, 0x4A2A, 0, 0xCA5D, 0, 0, 0xF034, 0xF035,
+ 0, 0xCA60, 0x4037, 0, 0x6032, 0, 0, 0xCA61,
+ 0xF036, 0x4643, 0, 0xCA63, 0xCA64, 0x3823, 0x6033, 0xF037,
+};
static const unsigned short utf8_to_euc_E78A[] = {
0x3A54, 0x6035, 0x6034, 0, 0xCA66, 0, 0, 0x6036,
0, 0xCA67, 0, 0, 0, 0xCA68, 0xCA69, 0,
@@ -4469,6 +8297,16 @@ static const unsigned short utf8_to_euc_E78A[] = {
0, 0xCA6F, 0x603C, 0, 0xCA70, 0, 0x3E75, 0,
0, 0x603B, 0, 0, 0, 0, 0xCA71, 0,
};
+static const unsigned short utf8_to_euc_E78A_x0213[] = {
+ 0x3A54, 0x6035, 0x6034, 0, 0xCA66, 0, 0, 0x6036,
+ 0, 0xCA67, 0, 0, 0, 0x7767, 0xF038, 0,
+ 0, 0, 0x6037, 0xCA6A, 0, 0, 0x6038, 0,
+ 0, 0, 0, 0x7768, 0, 0, 0, 0,
+ 0x353E, 0, 0x6039, 0, 0, 0, 0, 0x603A,
+ 0xCA6C, 0, 0, 0, 0x3824, 0xF03A, 0xF03B, 0x4848,
+ 0xF03C, 0xF03D, 0x603C, 0, 0xCA70, 0, 0x3E75, 0,
+ 0, 0x603B, 0, 0, 0, 0, 0x7769, 0,
+};
static const unsigned short utf8_to_euc_E78B[] = {
0, 0xCA72, 0x3638, 0x603D, 0x603F, 0, 0x603E, 0xCA73,
0, 0xCA74, 0, 0, 0xCA75, 0, 0x6040, 0,
@@ -4479,6 +8317,16 @@ static const unsigned short utf8_to_euc_E78B[] = {
0, 0, 0, 0xCA7B, 0xCA7C, 0, 0, 0x6046,
0x432C, 0x6045, 0xCA7D, 0xCA7E, 0x4F35, 0x4762, 0xCB21, 0,
};
+static const unsigned short utf8_to_euc_E78B_x0213[] = {
+ 0x776A, 0xF03E, 0x3638, 0x603D, 0x603F, 0, 0x603E, 0xCA73,
+ 0, 0xCA74, 0, 0, 0xF040, 0, 0x6040, 0,
+ 0x3851, 0, 0x6041, 0, 0, 0xCA76, 0xCA77, 0x3669,
+ 0xCA78, 0x4140, 0, 0x397D, 0, 0, 0, 0xCA79,
+ 0x6043, 0x6044, 0x6042, 0, 0, 0xCA7A, 0, 0,
+ 0, 0x3C6D, 0, 0, 0x4648, 0x3639, 0, 0,
+ 0, 0, 0, 0xF043, 0xCA7C, 0, 0, 0x6046,
+ 0x432C, 0x6045, 0xF044, 0x776B, 0x4F35, 0x4762, 0xCB21, 0,
+};
static const unsigned short utf8_to_euc_E78C[] = {
0, 0, 0xCB22, 0, 0xCB23, 0xCB24, 0, 0xCB25,
0, 0, 0x6049, 0xCB26, 0, 0xCB27, 0, 0,
@@ -4489,6 +8337,16 @@ static const unsigned short utf8_to_euc_E78C[] = {
0, 0xCB32, 0xCB33, 0, 0x604D, 0xCB34, 0x4D31, 0x4D32,
0, 0, 0xCB35, 0xCB36, 0, 0xCB37, 0x6051, 0x316E,
};
+static const unsigned short utf8_to_euc_E78C_x0213[] = {
+ 0, 0, 0xCB22, 0, 0xCB23, 0xCB24, 0, 0xF045,
+ 0, 0, 0x6049, 0xCB26, 0, 0xCB27, 0, 0,
+ 0, 0, 0xF046, 0xCB29, 0, 0, 0x604B, 0x6048,
+ 0xF047, 0xF048, 0, 0x4C54, 0x604A, 0x604C, 0xCB2C, 0x4E44,
+ 0, 0, 0xCB2D, 0, 0xCB2E, 0x6050, 0, 0x776D,
+ 0x776E, 0x604F, 0x4376, 0x472D, 0xF04B, 0, 0x3825, 0x604E,
+ 0, 0xF04C, 0xCB33, 0xF04D, 0x604D, 0xCB34, 0x4D31, 0x4D32,
+ 0, 0xF04A, 0xCB35, 0xCB36, 0, 0xF04E, 0x6051, 0x316E,
+};
static const unsigned short utf8_to_euc_E78D[] = {
0, 0, 0, 0xCB38, 0x3976, 0x3B62, 0, 0,
0, 0, 0, 0, 0, 0xCB39, 0x6052, 0x6053,
@@ -4499,6 +8357,16 @@ static const unsigned short utf8_to_euc_E78D[] = {
0x6058, 0xCB49, 0x334D, 0, 0, 0x605A, 0, 0xCB4A,
0x6059, 0xCB4B, 0x605C, 0x605B, 0xCB4C, 0, 0, 0,
};
+static const unsigned short utf8_to_euc_E78D_x0213[] = {
+ 0, 0, 0, 0xCB38, 0x3976, 0x3B62, 0, 0,
+ 0, 0, 0, 0, 0, 0xCB39, 0x6052, 0x6053,
+ 0x7770, 0, 0xF04F, 0, 0, 0, 0xCB3C, 0x6055,
+ 0xCB3D, 0, 0, 0, 0, 0xCB3E, 0xCB3F, 0xCB40,
+ 0xCB41, 0, 0, 0x3D43, 0, 0, 0x7771, 0xCB43,
+ 0x6057, 0xCB44, 0x6056, 0xF051, 0xF052, 0, 0xF054, 0xF055,
+ 0x6058, 0xF056, 0x334D, 0, 0, 0x605A, 0, 0xF057,
+ 0x6059, 0xCB4B, 0x605C, 0x605B, 0x7772, 0, 0, 0,
+};
static const unsigned short utf8_to_euc_E78E[] = {
0xCB4D, 0xCB4E, 0, 0xCB4F, 0x383C, 0xCB50, 0xCB51, 0x4E28,
0, 0x364C, 0, 0x3226, 0, 0, 0xCB52, 0,
@@ -4509,6 +8377,16 @@ static const unsigned short utf8_to_euc_E78E[] = {
0, 0, 0x4E68, 0x605E, 0, 0xCB62, 0, 0xCB63,
0, 0xCB64, 0, 0x6060, 0xCB65, 0xCB66, 0, 0xCB67,
};
+static const unsigned short utf8_to_euc_E78E_x0213[] = {
+ 0xCB4D, 0xF058, 0, 0xCB4F, 0x383C, 0xF059, 0xCB51, 0x4E28,
+ 0, 0x364C, 0xF05A, 0x3226, 0, 0, 0xCB52, 0,
+ 0xCB53, 0, 0, 0xCB54, 0xF05B, 0x7773, 0x366A, 0xCB56,
+ 0xF05C, 0, 0, 0, 0xF05D, 0, 0xF05E, 0x7774,
+ 0x7775, 0, 0x7776, 0, 0, 0xF05F, 0x7777, 0,
+ 0xF060, 0x3461, 0xCB5F, 0x7778, 0, 0xCB61, 0, 0,
+ 0, 0, 0x4E68, 0x605E, 0, 0xF061, 0, 0xF062,
+ 0, 0xF063, 0, 0x6060, 0xF064, 0xCB66, 0, 0xF065,
+};
static const unsigned short utf8_to_euc_E78F[] = {
0x6061, 0, 0x3251, 0, 0, 0xCB68, 0xCB69, 0,
0x605D, 0xCB6A, 0x3B39, 0xCB6B, 0xCB6C, 0x4441, 0x605F, 0xCB6D,
@@ -4519,6 +8397,16 @@ static const unsigned short utf8_to_euc_E78F[] = {
0, 0x607E, 0, 0, 0xCB78, 0xCB79, 0, 0xCB7A,
0x6069, 0xCB7B, 0xCB7C, 0xCB7D, 0, 0xCB7E, 0x383D, 0xCC21,
};
+static const unsigned short utf8_to_euc_E78F_x0213[] = {
+ 0x6061, 0, 0x3251, 0, 0, 0xF066, 0xCB69, 0,
+ 0x605D, 0x7779, 0x3B39, 0xF067, 0xCB6C, 0x4441, 0x605F, 0x777A,
+ 0, 0, 0xCB6E, 0xCB6F, 0, 0, 0x777B, 0,
+ 0, 0x777C, 0, 0, 0, 0xCB72, 0x6064, 0,
+ 0x3C6E, 0xF068, 0, 0x777D, 0, 0x6062, 0xCB75, 0xF069,
+ 0, 0x777E, 0x373E, 0, 0, 0x4849, 0x6063, 0,
+ 0, 0x607E, 0, 0, 0xCB78, 0xCB79, 0, 0xCB7A,
+ 0x6069, 0xF06A, 0xF06C, 0xCB7D, 0, 0xCB7E, 0x383D, 0xCC21,
+};
static const unsigned short utf8_to_euc_E790[] = {
0xCC22, 0xCC23, 0, 0x3565, 0xCC24, 0x6066, 0x4D7D, 0xCC25,
0, 0x4E30, 0xCC26, 0, 0, 0, 0, 0,
@@ -4529,6 +8417,16 @@ static const unsigned short utf8_to_euc_E790[] = {
0xCC34, 0xCC35, 0x606A, 0x4E56, 0x3657, 0x487C, 0x474A, 0,
0, 0xCC36, 0x606B, 0, 0, 0, 0, 0x606D,
};
+static const unsigned short utf8_to_euc_E790_x0213[] = {
+ 0xCC22, 0xF06D, 0, 0x3565, 0xCC24, 0x6066, 0x4D7D, 0x7821,
+ 0, 0x4E30, 0x7822, 0, 0, 0, 0, 0,
+ 0, 0xCC27, 0, 0xF06B, 0, 0, 0, 0,
+ 0, 0, 0x7823, 0x7824, 0, 0, 0, 0,
+ 0, 0, 0x4276, 0, 0xF06E, 0x6068, 0x7826, 0,
+ 0x7827, 0xCC2D, 0x7828, 0x7829, 0x782A, 0xCC31, 0x782B, 0x782C,
+ 0x782D, 0xF06F, 0x606A, 0x4E56, 0x3657, 0x487C, 0x474A, 0,
+ 0, 0xF070, 0x606B, 0, 0, 0, 0, 0x606D,
+};
static const unsigned short utf8_to_euc_E791[] = {
0xCC37, 0x6070, 0, 0xCC38, 0xCC39, 0, 0xCC3A, 0xCC3B,
0, 0, 0, 0xCC3C, 0, 0xCC3D, 0, 0,
@@ -4539,6 +8437,16 @@ static const unsigned short utf8_to_euc_E791[] = {
0x6073, 0xCC49, 0xCC4A, 0x3A3C, 0, 0, 0x6076, 0,
0, 0, 0, 0, 0, 0, 0x6077, 0,
};
+static const unsigned short utf8_to_euc_E791_x0213[] = {
+ 0xF072, 0x6070, 0, 0xF073, 0x782E, 0, 0x782F, 0x7830,
+ 0, 0, 0, 0x7831, 0, 0xF074, 0, 0,
+ 0, 0xCC3E, 0xF075, 0xF071, 0, 0x606C, 0, 0x7832,
+ 0, 0x606F, 0x386A, 0x314D, 0x6071, 0xF076, 0x3F70, 0x606E,
+ 0x4E5C, 0, 0x7833, 0x6074, 0x7424, 0, 0xCC43, 0xCC44,
+ 0xCC45, 0x6072, 0x6075, 0x7834, 0, 0x7835, 0xCC48, 0x6067,
+ 0x6073, 0xF077, 0xCC4A, 0x3A3C, 0, 0, 0x6076, 0,
+ 0, 0, 0, 0, 0, 0, 0x6077, 0,
+};
static const unsigned short utf8_to_euc_E792[] = {
0xCC4B, 0xCC4C, 0, 0x4D7E, 0, 0xCC4D, 0xCC4E, 0xCC4F,
0, 0xCC50, 0, 0x6078, 0, 0, 0, 0xCC51,
@@ -4549,6 +8457,16 @@ static const unsigned short utf8_to_euc_E792[] = {
0x3444, 0xCC64, 0xCC65, 0, 0, 0xCC66, 0, 0,
0, 0xCC67, 0, 0xCC68, 0, 0x3C25, 0, 0xCC69,
};
+static const unsigned short utf8_to_euc_E792_x0213[] = {
+ 0xCC4B, 0xF078, 0, 0x4D7E, 0, 0xF079, 0x7836, 0x7837,
+ 0xF07A, 0x7838, 0, 0x6078, 0, 0, 0, 0xCC51,
+ 0x783D, 0xCC53, 0xF07C, 0, 0, 0, 0, 0xF07D,
+ 0x7839, 0xF07E, 0xCC57, 0, 0x783A, 0, 0x6079, 0x783B,
+ 0xF121, 0xF122, 0x6065, 0x783C, 0, 0xF123, 0x783E, 0x607A,
+ 0x783F, 0x7840, 0xF124, 0xF125, 0, 0, 0xCC62, 0xCC63,
+ 0x3444, 0xCC64, 0xCC65, 0, 0, 0x7841, 0, 0,
+ 0, 0xF126, 0xF128, 0xF127, 0, 0x3C25, 0, 0x7842,
+};
static const unsigned short utf8_to_euc_E793[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0xCC6A, 0xCC6B, 0x607B, 0, 0xCC6C, 0, 0, 0x607C,
@@ -4559,6 +8477,16 @@ static const unsigned short utf8_to_euc_E793[] = {
0x6127, 0x6128, 0x6126, 0, 0xCC79, 0, 0x4953, 0x612A,
0x6129, 0, 0xCC7A, 0xCC7B, 0xCC7C, 0, 0, 0xCC7D,
};
+static const unsigned short utf8_to_euc_E793_x0213[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0x7843, 0x7844, 0x607B, 0, 0xCC6C, 0, 0, 0x607C,
+ 0xCC6D, 0, 0, 0xCC6E, 0x607D, 0, 0xF129, 0,
+ 0xF12A, 0, 0x7845, 0xCC71, 0x313B, 0, 0xF12B, 0xCC73,
+ 0x6121, 0, 0x493B, 0x6122, 0xCC74, 0, 0x3424, 0x6123,
+ 0xCC75, 0x6124, 0xCC76, 0xF12D, 0, 0, 0x6125, 0xF12C,
+ 0x6127, 0x6128, 0x6126, 0, 0xCC79, 0, 0x4953, 0x612A,
+ 0x6129, 0, 0xF12F, 0xCC7B, 0xCC7C, 0, 0, 0x7846,
+};
static const unsigned short utf8_to_euc_E794[] = {
0, 0xF450, 0, 0x612C, 0x612B, 0x612D, 0xCC7E, 0,
0, 0, 0, 0, 0x612E, 0x6130, 0x612F, 0,
@@ -4569,6 +8497,16 @@ static const unsigned short utf8_to_euc_E794[] = {
0x4544, 0x4D33, 0x3943, 0x3F3D, 0, 0, 0xCD2B, 0x434B,
0x5234, 0xCD2C, 0x442E, 0x3268, 0x6136, 0xCD2D, 0xCD2E, 0xCD2F,
};
+static const unsigned short utf8_to_euc_E794_x0213[] = {
+ 0, 0x7847, 0, 0x612C, 0x612B, 0x612D, 0xCC7E, 0,
+ 0, 0, 0, 0, 0x612E, 0x6130, 0x612F, 0,
+ 0, 0x3979, 0xCD21, 0x6132, 0, 0x6131, 0xCD22, 0x7848,
+ 0x3445, 0, 0x3F53, 0, 0x453C, 0, 0x6133, 0x4038,
+ 0xF131, 0xCD25, 0, 0x3B3A, 0xF132, 0x3179, 0x6134, 0xCD27,
+ 0x4D51, 0xCD28, 0xF133, 0x4A63, 0x6135, 0, 0, 0x7849,
+ 0x4544, 0x4D33, 0x3943, 0x3F3D, 0, 0, 0xCD2B, 0x434B,
+ 0x5234, 0xCD2C, 0x442E, 0x3268, 0x6136, 0xF136, 0xF137, 0xCD2F,
+};
static const unsigned short utf8_to_euc_E795[] = {
0xCD30, 0, 0, 0xCD31, 0x6137, 0, 0x613C, 0xCD32,
0xCD33, 0x613A, 0x6139, 0x5A42, 0x3326, 0x6138, 0xCD34, 0x305A,
@@ -4579,6 +8517,16 @@ static const unsigned short utf8_to_euc_E795[] = {
0x305B, 0xCD3C, 0, 0x3E76, 0x6147, 0, 0x6144, 0x466D,
0x6143, 0xCD3D, 0xCD3E, 0xCD3F, 0xCD40, 0xCD41, 0xCD42, 0x3526,
};
+static const unsigned short utf8_to_euc_E795_x0213[] = {
+ 0xF138, 0, 0, 0xCD31, 0x6137, 0, 0x613C, 0xCD32,
+ 0xF139, 0x613A, 0x6139, 0x5A42, 0x3326, 0x6138, 0xF13A, 0x305A,
+ 0xF13B, 0x482A, 0xF13C, 0, 0x484A, 0, 0, 0xCD37,
+ 0, 0x4E31, 0x613D, 0x613B, 0x435C, 0x4026, 0xCD38, 0xCD39,
+ 0x482B, 0xCD3A, 0x492D, 0, 0x613F, 0x4E2C, 0x374D, 0x6140,
+ 0, 0x613E, 0x4856, 0x6141, 0xF13D, 0x6142, 0, 0x784A,
+ 0x305B, 0xF13F, 0xF13E, 0x3E76, 0x6147, 0, 0x6144, 0x466D,
+ 0x6143, 0x784B, 0xF140, 0xCD3F, 0xCD40, 0xF141, 0xF142, 0x3526,
+};
static const unsigned short utf8_to_euc_E796[] = {
0, 0xCD43, 0x614A, 0, 0, 0xCD44, 0x6145, 0x6146,
0, 0x6149, 0x6148, 0x4925, 0, 0, 0x4142, 0x4141,
@@ -4589,6 +8537,16 @@ static const unsigned short utf8_to_euc_E796[] = {
0, 0x6157, 0x4868, 0x6151, 0xCD4D, 0x6153, 0, 0,
0x6155, 0x3F3E, 0xCD4E, 0, 0x6156, 0x6154, 0x3C40, 0xCD4F,
};
+static const unsigned short utf8_to_euc_E796_x0213[] = {
+ 0, 0xF143, 0x614A, 0, 0, 0xCD44, 0x6145, 0x6146,
+ 0, 0x6149, 0x6148, 0x4925, 0xF145, 0, 0x4142, 0x4141,
+ 0xCD45, 0x353F, 0x784C, 0xCD47, 0x614B, 0xCD48, 0, 0,
+ 0, 0xCD49, 0x614C, 0, 0xCD4A, 0x614D, 0, 0,
+ 0, 0, 0xF147, 0x614F, 0xCD4C, 0x614E, 0, 0,
+ 0, 0, 0, 0x3156, 0, 0, 0, 0,
+ 0xF149, 0x6157, 0x4868, 0x6151, 0xCD4D, 0x6153, 0, 0xF14A,
+ 0x6155, 0x3F3E, 0xCD4E, 0, 0x6156, 0x6154, 0x3C40, 0xF14B,
+};
static const unsigned short utf8_to_euc_E797[] = {
0xCD50, 0xCD51, 0x6150, 0x6152, 0xCD52, 0x4942, 0xCD53, 0x3E49,
0, 0, 0x6159, 0, 0xCD54, 0x6158, 0xCD55, 0xCD56,
@@ -4599,6 +8557,16 @@ static const unsigned short utf8_to_euc_E797[] = {
0x6162, 0xCD61, 0x6164, 0x6165, 0x4354, 0, 0, 0,
0, 0xCD62, 0x6163, 0, 0x6160, 0, 0x615E, 0x615F,
};
+static const unsigned short utf8_to_euc_E797_x0213[] = {
+ 0xF14C, 0xCD51, 0x6150, 0x6152, 0xCD52, 0x4942, 0xF14D, 0x3E49,
+ 0, 0, 0x6159, 0, 0xCD54, 0x6158, 0x784E, 0xF14E,
+ 0, 0, 0x615A, 0xF14F, 0x3C26, 0x3A2F, 0, 0xCD57,
+ 0x4577, 0x615B, 0, 0x444B, 0xCD58, 0xF150, 0x615D, 0xF151,
+ 0xF152, 0xCD5B, 0x4E21, 0x615C, 0x784F, 0, 0, 0xF153,
+ 0, 0x4169, 0, 0, 0xF154, 0, 0xF155, 0xCD60,
+ 0x6162, 0xF156, 0x6164, 0x6165, 0x4354, 0, 0, 0,
+ 0, 0xF157, 0x6163, 0, 0x6160, 0, 0x615E, 0x615F,
+};
static const unsigned short utf8_to_euc_E798[] = {
0xCD63, 0x6161, 0xCD64, 0xCD65, 0xCD66, 0, 0, 0xCD67,
0xCD68, 0x6168, 0xCD69, 0x6166, 0xCD6A, 0x6167, 0, 0xCD6B,
@@ -4609,6 +8577,16 @@ static const unsigned short utf8_to_euc_E798[] = {
0x6170, 0, 0xCD7A, 0xCD7B, 0x616F, 0xCD7C, 0, 0,
0xCD7D, 0xCD7E, 0xCE21, 0x6171, 0xCE22, 0, 0, 0,
};
+static const unsigned short utf8_to_euc_E798_x0213[] = {
+ 0x7850, 0x6161, 0x7851, 0xF158, 0xCD66, 0, 0, 0xF15A,
+ 0x7852, 0x6168, 0xCD69, 0x6166, 0xCD6A, 0x6167, 0, 0xF15B,
+ 0, 0, 0xCD6C, 0xF15E, 0, 0x7853, 0x7854, 0,
+ 0xF159, 0x7855, 0, 0xF15F, 0xF160, 0xCD73, 0x7856, 0x6169,
+ 0x616B, 0x616C, 0x616D, 0xCD75, 0x616E, 0xF162, 0x7E7D, 0x616A,
+ 0xF163, 0xCD78, 0, 0, 0, 0x7857, 0, 0,
+ 0x6170, 0, 0xCD7A, 0xF165, 0x616F, 0x7858, 0, 0,
+ 0xCD7D, 0xCD7E, 0xCE21, 0x6171, 0xF164, 0, 0, 0,
+};
static const unsigned short utf8_to_euc_E799[] = {
0xCE24, 0xCE25, 0x4E45, 0xCE26, 0xCE27, 0xCE28, 0x6174, 0x6172,
0x6173, 0xCE29, 0xCE23, 0xCE2A, 0x3462, 0, 0, 0,
@@ -4619,6 +8597,16 @@ static const unsigned short utf8_to_euc_E799[] = {
0x617E, 0xCE33, 0x6221, 0, 0xCE34, 0, 0x6222, 0,
0x6223, 0, 0x482F, 0x4550, 0x6224, 0x4772, 0x4934, 0,
};
+static const unsigned short utf8_to_euc_E799_x0213[] = {
+ 0xCE24, 0xF168, 0x4E45, 0x7859, 0xCE27, 0xCE28, 0x6174, 0x6172,
+ 0x6173, 0xF16A, 0xCE23, 0x785A, 0x3462, 0, 0, 0,
+ 0, 0, 0x4C7E, 0, 0, 0xF16B, 0x4A4A, 0,
+ 0x6176, 0xCE2C, 0, 0, 0x6175, 0, 0, 0xCE2D,
+ 0, 0x6177, 0x6178, 0, 0x785B, 0x785C, 0, 0x617C,
+ 0x6179, 0x617A, 0x617B, 0, 0x617D, 0x785D, 0xF16D, 0x785E,
+ 0x617E, 0x785F, 0x6221, 0, 0xCE34, 0, 0x6222, 0,
+ 0x6223, 0, 0x482F, 0x4550, 0x6224, 0x4772, 0x4934, 0,
+};
static const unsigned short utf8_to_euc_E79A[] = {
0x6225, 0xCE35, 0xF451, 0x6226, 0x452A, 0xCE36, 0x3327, 0x3944,
0x6227, 0, 0, 0x6228, 0xCE37, 0xCE38, 0x6229, 0,
@@ -4629,6 +8617,16 @@ static const unsigned short utf8_to_euc_E79A[] = {
0x622E, 0, 0, 0, 0x622F, 0, 0, 0x7369,
0x6230, 0x6231, 0x6232, 0, 0, 0xCE48, 0, 0x3B2E,
};
+static const unsigned short utf8_to_euc_E79A_x0213[] = {
+ 0x6225, 0x7860, 0xF451, 0x6226, 0x452A, 0xCE36, 0x3327, 0x3944,
+ 0x6227, 0, 0, 0x6228, 0xCE37, 0xCE38, 0x6229, 0,
+ 0x3B29, 0, 0, 0x622B, 0, 0xF16E, 0x622A, 0,
+ 0, 0x622C, 0x622D, 0x7861, 0xF16F, 0x7862, 0x7863, 0xCE3D,
+ 0xF171, 0xF170, 0xCE3F, 0xCE40, 0xCE41, 0xCE42, 0x7864, 0xF172,
+ 0xF173, 0, 0x7865, 0, 0, 0xCE47, 0x4869, 0xF174,
+ 0x622E, 0, 0, 0, 0x622F, 0, 0x7866, 0x7369,
+ 0x6230, 0x6231, 0x6232, 0, 0, 0xCE48, 0, 0x3B2E,
+};
static const unsigned short utf8_to_euc_E79B[] = {
0, 0xCE49, 0x6233, 0x4756, 0, 0xCE4A, 0x4B5F, 0,
0x314E, 0xCE4B, 0x3157, 0xCE4C, 0xCE4D, 0x6234, 0xCE4E, 0,
@@ -4639,6 +8637,16 @@ static const unsigned short utf8_to_euc_E79B[] = {
0xCE55, 0xCE56, 0x4C55, 0, 0x443E, 0, 0xCE57, 0,
0x416A, 0xCE58, 0, 0x623D, 0xCE59, 0, 0x3D62, 0,
};
+static const unsigned short utf8_to_euc_E79B_x0213[] = {
+ 0, 0xCE49, 0x6233, 0x4756, 0, 0x7867, 0x4B5F, 0,
+ 0x314E, 0xF176, 0x3157, 0xCE4C, 0x7868, 0x6234, 0x7869, 0,
+ 0, 0, 0x6236, 0, 0x786A, 0, 0x6235, 0x4570,
+ 0, 0xCE50, 0, 0x4039, 0x5D39, 0, 0x6237, 0x4C41,
+ 0xCE51, 0x6238, 0, 0x3446, 0x4857, 0x6239, 0x786B, 0x623A,
+ 0xF178, 0, 0x623B, 0, 0xF179, 0, 0x4C5C, 0,
+ 0xCE55, 0x786C, 0x4C55, 0, 0x443E, 0, 0xCE57, 0,
+ 0x416A, 0xCE58, 0, 0x623D, 0x786D, 0, 0x3D62, 0,
+};
static const unsigned short utf8_to_euc_E79C[] = {
0xCE5A, 0x3E4A, 0, 0, 0x6240, 0, 0xCE5B, 0x623F,
0x623E, 0x487D, 0xCE5C, 0x3447, 0x3829, 0, 0xCE5D, 0,
@@ -4649,6 +8657,16 @@ static const unsigned short utf8_to_euc_E79C[] = {
0, 0, 0, 0, 0xCE6A, 0xCE6B, 0xCE6C, 0x6247,
0x6248, 0xCE6D, 0x442F, 0, 0x3463, 0xCE6E, 0xCE6F, 0,
};
+static const unsigned short utf8_to_euc_E79C_x0213[] = {
+ 0xCE5A, 0x3E4A, 0, 0, 0x6240, 0, 0xCE5B, 0x623F,
+ 0x623E, 0x487D, 0x786E, 0x3447, 0x3829, 0, 0xCE5D, 0,
+ 0, 0, 0xCE5E, 0, 0xCE5F, 0xCE60, 0, 0xF17B,
+ 0, 0x786F, 0xF17C, 0x6246, 0xCE64, 0, 0x6243, 0x3F3F,
+ 0x4C32, 0, 0xCE65, 0, 0x6242, 0x6244, 0x6245, 0,
+ 0xCE66, 0x6241, 0, 0, 0, 0xF17D, 0xCE68, 0xCE69,
+ 0, 0, 0, 0, 0x7870, 0xF17E, 0x7871, 0x6247,
+ 0x6248, 0xCE6D, 0x442F, 0, 0x3463, 0xCE6E, 0xCE6F, 0,
+};
static const unsigned short utf8_to_euc_E79D[] = {
0x4365, 0, 0xCE70, 0, 0, 0xCE71, 0xCE72, 0x6249,
0, 0, 0xCE73, 0, 0, 0xCE74, 0xCE75, 0xCE76,
@@ -4659,6 +8677,16 @@ static const unsigned short utf8_to_euc_E79D[] = {
0xCF25, 0, 0xCF26, 0xCF27, 0xCF28, 0, 0, 0,
0, 0x6251, 0xCF29, 0, 0, 0xCF2A, 0x6250, 0x624F,
};
+static const unsigned short utf8_to_euc_E79D_x0213[] = {
+ 0x4365, 0, 0xCE70, 0, 0, 0xCE71, 0x7872, 0x6249,
+ 0, 0, 0xCE73, 0, 0, 0x7873, 0x7874, 0xCE76,
+ 0, 0, 0xCE77, 0, 0, 0, 0xCE78, 0xCE79,
+ 0xF225, 0, 0x624A, 0x624D, 0x7875, 0, 0xCE7B, 0x7876,
+ 0xF226, 0x3F67, 0x7877, 0x4644, 0xCF21, 0x624E, 0x4B53, 0xCF22,
+ 0x624B, 0, 0xF227, 0x624C, 0xCF24, 0, 0, 0,
+ 0xCF25, 0, 0xF229, 0xCF27, 0xCF28, 0, 0, 0,
+ 0, 0x6251, 0x7878, 0, 0xF22A, 0xF22B, 0x6250, 0x624F,
+};
static const unsigned short utf8_to_euc_E79E[] = {
0xCF2B, 0, 0, 0, 0xCF2C, 0, 0, 0,
0, 0, 0, 0x6253, 0xCF2D, 0xCF2E, 0x6252, 0,
@@ -4669,6 +8697,16 @@ static const unsigned short utf8_to_euc_E79E[] = {
0x6257, 0xCF39, 0, 0x4637, 0, 0xCF3A, 0x6258, 0,
0, 0x6259, 0, 0x625D, 0x625B, 0x625C, 0xCF3B, 0x625A,
};
+static const unsigned short utf8_to_euc_E79E_x0213[] = {
+ 0x7879, 0, 0, 0, 0xCF2C, 0, 0, 0,
+ 0, 0, 0, 0x6253, 0xCF2D, 0xCF2E, 0x6252, 0,
+ 0, 0x6254, 0, 0, 0x787A, 0xCF30, 0xCF31, 0,
+ 0, 0, 0xF22E, 0, 0, 0, 0x6256, 0xF22F,
+ 0x6255, 0, 0xF230, 0, 0xF231, 0x4A4D, 0, 0xCF35,
+ 0, 0xF232, 0x787B, 0, 0x3D56, 0x4E46, 0xCF37, 0xCF38,
+ 0x6257, 0xCF39, 0, 0x4637, 0, 0xCF3A, 0x6258, 0,
+ 0, 0x6259, 0, 0x625D, 0x625B, 0x625C, 0xCF3B, 0x625A,
+};
static const unsigned short utf8_to_euc_E79F[] = {
0, 0, 0, 0xCF3C, 0, 0, 0, 0x625E,
0, 0xCF3D, 0, 0, 0, 0x625F, 0, 0,
@@ -4679,6 +8717,16 @@ static const unsigned short utf8_to_euc_E79F[] = {
0xCF49, 0xCF4A, 0, 0x4050, 0xCF4B, 0, 0, 0,
0xCF4C, 0, 0, 0xCF4D, 0x6265, 0, 0, 0,
};
+static const unsigned short utf8_to_euc_E79F_x0213[] = {
+ 0, 0, 0, 0xCF3C, 0, 0, 0, 0x625E,
+ 0, 0xCF3D, 0, 0, 0, 0x625F, 0, 0,
+ 0, 0xCF3E, 0xCF3F, 0, 0, 0xCF40, 0, 0x6260,
+ 0, 0xCF41, 0x6261, 0x4C37, 0x6262, 0, 0xF233, 0xF234,
+ 0x787C, 0, 0x4C70, 0x6263, 0xF235, 0x434E, 0xF236, 0x476A,
+ 0, 0x366B, 0xF237, 0, 0xF238, 0x433B, 0x6264, 0x363A,
+ 0xF23A, 0xCF4A, 0, 0x4050, 0xF23B, 0, 0, 0,
+ 0xCF4C, 0, 0, 0xF23C, 0x6265, 0, 0, 0,
+};
static const unsigned short utf8_to_euc_E7A0[] = {
0, 0, 0x3A3D, 0, 0, 0xCF4E, 0xCF4F, 0,
0, 0xCF50, 0, 0, 0x6266, 0xCF51, 0xCF52, 0,
@@ -4689,6 +8737,16 @@ static const unsigned short utf8_to_euc_E7A0[] = {
0xCF5A, 0, 0x4B24, 0, 0x474B, 0xCF5B, 0, 0xCF5C,
0, 0, 0x4557, 0, 0, 0, 0, 0x395C,
};
+static const unsigned short utf8_to_euc_E7A0_x0213[] = {
+ 0, 0, 0x3A3D, 0, 0, 0xF23E, 0xF23F, 0,
+ 0, 0xF240, 0, 0, 0x6266, 0xF241, 0xCF52, 0,
+ 0, 0xCF53, 0x6267, 0, 0x3826, 0x3A55, 0, 0,
+ 0, 0xF242, 0, 0, 0, 0xCF54, 0, 0,
+ 0x6269, 0xF243, 0xCF56, 0xCF57, 0, 0x4556, 0x3A56, 0x354E,
+ 0, 0, 0, 0, 0xF244, 0x787D, 0xCF59, 0,
+ 0xCF5A, 0, 0x4B24, 0, 0x474B, 0xCF5B, 0, 0xCF5C,
+ 0, 0, 0x4557, 0, 0, 0, 0, 0x395C,
+};
static const unsigned short utf8_to_euc_E7A1[] = {
0, 0, 0, 0xCF5D, 0xCF5E, 0x626B, 0, 0xCF5F,
0xCF60, 0, 0, 0, 0xCF61, 0, 0xCF62, 0,
@@ -4699,6 +8757,16 @@ static const unsigned short utf8_to_euc_E7A1[] = {
0, 0, 0x4823, 0, 0x626D, 0, 0, 0,
0, 0, 0xCF6D, 0, 0x626F, 0, 0xCF6E, 0,
};
+static const unsigned short utf8_to_euc_E7A1_x0213[] = {
+ 0, 0, 0, 0x7921, 0xCF5E, 0x626B, 0, 0xF245,
+ 0xCF60, 0, 0, 0, 0xCF61, 0, 0x7922, 0x7923,
+ 0, 0x7924, 0xCF63, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0xCF64, 0x3E4B, 0xCF65, 0,
+ 0xCF66, 0xCF67, 0, 0xCF68, 0xF246, 0, 0, 0,
+ 0x7925, 0, 0xF247, 0x4E32, 0x3945, 0, 0x7926, 0x3827,
+ 0, 0, 0x4823, 0, 0x626D, 0, 0, 0,
+ 0, 0, 0xCF6D, 0, 0x626F, 0, 0xCF6E, 0,
+};
static const unsigned short utf8_to_euc_E7A2[] = {
0, 0x386B, 0, 0, 0, 0, 0x626E, 0x4476,
0, 0, 0xCF6F, 0, 0x6271, 0x3337, 0x626C, 0xCF70,
@@ -4709,6 +8777,16 @@ static const unsigned short utf8_to_euc_E7A2[] = {
0xCF7B, 0xCF7C, 0xCF7D, 0xCF7E, 0, 0x6273, 0, 0,
0, 0, 0x334E, 0xD021, 0x627B, 0xD022, 0x627A, 0xD023,
};
+static const unsigned short utf8_to_euc_E7A2_x0213[] = {
+ 0, 0x386B, 0, 0, 0, 0, 0x626E, 0x4476,
+ 0, 0, 0xF249, 0, 0x6271, 0x3337, 0x626C, 0xCF70,
+ 0, 0x486A, 0, 0x3130, 0xF24A, 0x3A6C, 0, 0x4F52,
+ 0xCF72, 0, 0x6270, 0, 0, 0xF24C, 0xF24D, 0xF24E,
+ 0, 0xCF73, 0, 0x6272, 0xF24B, 0, 0, 0x4A4B,
+ 0xCF78, 0x4059, 0x6274, 0, 0xCF79, 0x792A, 0, 0x6275,
+ 0x7928, 0xCF7C, 0xCF7D, 0xCF7E, 0, 0x6273, 0, 0,
+ 0, 0, 0x334E, 0xF24F, 0x627B, 0xD022, 0x627A, 0xD023,
+};
static const unsigned short utf8_to_euc_E7A3[] = {
0, 0x3C27, 0, 0, 0, 0x627C, 0x6277, 0xD024,
0xD025, 0xD026, 0x627D, 0x6278, 0xD027, 0, 0xD028, 0,
@@ -4719,6 +8797,16 @@ static const unsigned short utf8_to_euc_E7A3[] = {
0, 0, 0xD034, 0xD035, 0x6324, 0, 0xD037, 0xD038,
0, 0, 0xD039, 0xD03A, 0, 0x6323, 0, 0xD03B,
};
+static const unsigned short utf8_to_euc_E7A3_x0213[] = {
+ 0, 0x3C27, 0, 0, 0, 0x627C, 0x6277, 0xD024,
+ 0xF250, 0xD026, 0x627D, 0x6278, 0xF251, 0, 0xF252, 0,
+ 0x4858, 0x6276, 0xD029, 0xD02A, 0x6279, 0xF253, 0xD02C, 0,
+ 0, 0, 0x6322, 0xD02E, 0, 0, 0, 0xD02F,
+ 0xF254, 0xF255, 0, 0, 0x792B, 0, 0xF256, 0x6321,
+ 0x4B61, 0, 0xD033, 0, 0x627E, 0, 0, 0x306B,
+ 0, 0, 0x792C, 0xD035, 0x6324, 0, 0xD037, 0x792E,
+ 0, 0xF257, 0xF258, 0xF259, 0, 0x6323, 0xF25A, 0xD03B,
+};
static const unsigned short utf8_to_euc_E7A4[] = {
0xD036, 0x3E4C, 0, 0, 0, 0, 0xD03C, 0x6325,
0, 0, 0, 0, 0xD03D, 0, 0x4143, 0,
@@ -4729,6 +8817,16 @@ static const unsigned short utf8_to_euc_E7A4[] = {
0xF454, 0xD048, 0, 0, 0xD049, 0xD04A, 0, 0,
0, 0, 0x3C28, 0xD04B, 0x4E69, 0xD04C, 0x3C52, 0xD04D,
};
+static const unsigned short utf8_to_euc_E7A4_x0213[] = {
+ 0x792D, 0x3E4C, 0, 0, 0, 0, 0xD03C, 0x6325,
+ 0, 0, 0, 0, 0xD03D, 0, 0x4143, 0,
+ 0xF25C, 0x6327, 0x6326, 0, 0, 0, 0, 0,
+ 0, 0x6328, 0xD03F, 0xF25D, 0x792F, 0, 0xD041, 0xD042,
+ 0xD043, 0, 0, 0, 0, 0xF25F, 0x6268, 0xD045,
+ 0, 0xD046, 0x626A, 0x632A, 0x6329, 0xD047, 0x7930, 0,
+ 0xF25E, 0x7931, 0, 0, 0x7932, 0xD04A, 0, 0,
+ 0, 0, 0x3C28, 0xF260, 0x4E69, 0xD04C, 0x3C52, 0xD04D,
+};
static const unsigned short utf8_to_euc_E7A5[] = {
0x632B, 0x3737, 0, 0, 0xD04E, 0xD04F, 0xD050, 0x3540,
0x3527, 0x3B63, 0xD051, 0xD052, 0, 0, 0, 0xD053,
@@ -4739,6 +8837,16 @@ static const unsigned short utf8_to_euc_E7A5[] = {
0, 0, 0xD05C, 0, 0, 0, 0, 0x4578,
0, 0xD05D, 0x6332, 0xD05E, 0xD05F, 0, 0xD060, 0x6333,
};
+static const unsigned short utf8_to_euc_E7A5_x0213[] = {
+ 0x632B, 0x3737, 0, 0, 0xD04E, 0x7935, 0x7936, 0x3540,
+ 0x3527, 0x3B63, 0xF261, 0xD052, 0, 0, 0, 0xD053,
+ 0x4D34, 0xD054, 0, 0x6331, 0xD055, 0x6330, 0x4144, 0x632D,
+ 0xF262, 0, 0x632F, 0xF263, 0x793A, 0x3D4B, 0x3F40, 0x632E,
+ 0x632C, 0, 0x472A, 0, 0, 0x3E4D, 0, 0xF265,
+ 0x493C, 0xD05A, 0, 0xD05B, 0, 0x3A57, 0, 0,
+ 0, 0, 0xF266, 0, 0, 0, 0, 0x4578,
+ 0, 0x793E, 0x6332, 0xD05E, 0xD05F, 0, 0xD060, 0x6333,
+};
static const unsigned short utf8_to_euc_E7A6[] = {
0x6349, 0x3658, 0, 0, 0x4F3D, 0x4135, 0, 0,
0, 0, 0x6334, 0xD061, 0xD062, 0x3252, 0x4477, 0x4A21,
@@ -4749,6 +8857,16 @@ static const unsigned short utf8_to_euc_E7A6[] = {
0x4729, 0xD070, 0, 0x633A, 0xD071, 0, 0, 0,
0xD072, 0x633B, 0x633C, 0xD073, 0, 0x3659, 0x3253, 0x4645,
};
+static const unsigned short utf8_to_euc_E7A6_x0213[] = {
+ 0x6349, 0x3658, 0, 0, 0x4F3D, 0x4135, 0, 0,
+ 0, 0, 0x6334, 0xD061, 0xD062, 0x3252, 0x4477, 0x4A21,
+ 0, 0xD063, 0, 0xD064, 0xF267, 0xF268, 0xF269, 0,
+ 0x7942, 0, 0, 0xF26A, 0xD06A, 0x6335, 0, 0,
+ 0, 0xF26B, 0, 0, 0, 0, 0x357A, 0x6336,
+ 0xD06C, 0xF26C, 0x6338, 0xD06E, 0, 0, 0x6339, 0xD06F,
+ 0x4729, 0x7943, 0, 0x633A, 0xF26D, 0, 0, 0,
+ 0x7944, 0x633B, 0x633C, 0xF26E, 0, 0x3659, 0x3253, 0x4645,
+};
static const unsigned short utf8_to_euc_E7A7[] = {
0x3D28, 0x3B64, 0xD074, 0, 0xD075, 0, 0, 0xD076,
0xD077, 0x633D, 0xD078, 0x3D29, 0, 0, 0, 0xD079,
@@ -4759,6 +8877,16 @@ static const unsigned short utf8_to_euc_E7A7[] = {
0x3E4E, 0xD127, 0, 0, 0, 0, 0, 0,
0xD128, 0, 0, 0x305C, 0xD129, 0, 0, 0,
};
+static const unsigned short utf8_to_euc_E7A7_x0213[] = {
+ 0x3D28, 0x3B64, 0xF26F, 0, 0xD075, 0, 0, 0xF270,
+ 0x7945, 0x633D, 0x7946, 0x3D29, 0xF271, 0xF272, 0, 0xD079,
+ 0, 0x324A, 0x4943, 0, 0x7948, 0x633E, 0xF273, 0,
+ 0x486B, 0, 0xD07C, 0, 0, 0xD07D, 0x7949, 0x4145,
+ 0xD121, 0x6341, 0xD122, 0x6342, 0x4769, 0xD123, 0x3F41, 0x633F,
+ 0, 0x4361, 0xD124, 0x794A, 0x6340, 0x794B, 0, 0,
+ 0x3E4E, 0xD127, 0, 0, 0, 0, 0, 0,
+ 0xD128, 0, 0, 0x305C, 0xD129, 0, 0, 0,
+};
static const unsigned short utf8_to_euc_E7A8[] = {
0x3529, 0, 0xD12A, 0xD12B, 0, 0, 0, 0xD12C,
0x6343, 0xD12D, 0xD12E, 0x4478, 0xD12F, 0x6344, 0x4047, 0,
@@ -4769,6 +8897,16 @@ static const unsigned short utf8_to_euc_E7A8[] = {
0xD139, 0x634A, 0x3070, 0, 0xD13A, 0xD13B, 0, 0x634D,
0xD13C, 0xD13D, 0xD13E, 0x634B, 0x3254, 0x374E, 0x634C, 0x3946,
};
+static const unsigned short utf8_to_euc_E7A8_x0213[] = {
+ 0x3529, 0, 0xD12A, 0x794C, 0, 0, 0, 0xD12C,
+ 0x6343, 0xD12D, 0xF278, 0x4478, 0xD12F, 0x6344, 0x4047, 0,
+ 0, 0xF279, 0, 0, 0x4C2D, 0xF27A, 0, 0x4923,
+ 0x6345, 0x6346, 0x4355, 0xF27B, 0x4E47, 0, 0xF27C, 0x6348,
+ 0x6347, 0xD134, 0, 0, 0, 0, 0, 0xD135,
+ 0, 0, 0, 0xD136, 0, 0xF27E, 0x3C6F, 0xD138,
+ 0xD139, 0x634A, 0x3070, 0, 0xD13A, 0xD13B, 0, 0x634D,
+ 0xF321, 0x794E, 0xD13E, 0x634B, 0x3254, 0x374E, 0x634C, 0x3946,
+};
static const unsigned short utf8_to_euc_E7A9[] = {
0x3972, 0, 0x4A66, 0x634E, 0xD13F, 0xD140, 0x4B54, 0xD141,
0xD142, 0x6350, 0, 0, 0xD143, 0x4051, 0x314F, 0x323A,
@@ -4779,6 +8917,16 @@ static const unsigned short utf8_to_euc_E7A9[] = {
0x6355, 0, 0, 0, 0x376A, 0xD14F, 0x3566, 0,
0xD150, 0x6356, 0x3675, 0, 0, 0x6357, 0xD151, 0x407C,
};
+static const unsigned short utf8_to_euc_E7A9_x0213[] = {
+ 0x3972, 0, 0x4A66, 0x634E, 0xD13F, 0xD140, 0x4B54, 0xF322,
+ 0xD142, 0x6350, 0, 0, 0xF323, 0x4051, 0x314F, 0x323A,
+ 0x302C, 0, 0, 0, 0, 0xD144, 0xF324, 0x634F,
+ 0, 0xF325, 0, 0, 0xF326, 0x794F, 0, 0xF327,
+ 0xF328, 0x6351, 0x6352, 0x3E77, 0, 0xD14B, 0, 0xF329,
+ 0, 0x6353, 0xF32A, 0x334F, 0, 0x7950, 0, 0,
+ 0x6355, 0, 0, 0, 0x376A, 0xF32B, 0x3566, 0,
+ 0xF32C, 0x6356, 0x3675, 0, 0, 0x6357, 0xD151, 0x407C,
+};
static const unsigned short utf8_to_euc_E7AA[] = {
0xD152, 0x464D, 0xD153, 0x4060, 0x3A75, 0xD154, 0xD155, 0,
0x6358, 0, 0xD156, 0xD157, 0, 0, 0, 0,
@@ -4789,6 +8937,16 @@ static const unsigned short utf8_to_euc_E7AA[] = {
0x635F, 0, 0, 0xD15F, 0, 0xD160, 0x6360, 0,
0, 0xD161, 0x312E, 0xD162, 0xD163, 0, 0, 0x6363,
};
+static const unsigned short utf8_to_euc_E7AA_x0213[] = {
+ 0xD152, 0x464D, 0xF32D, 0x4060, 0x3A75, 0x7952, 0xD155, 0,
+ 0x6358, 0, 0xF32E, 0xD157, 0, 0, 0, 0,
+ 0xF32F, 0xD159, 0x4362, 0x416B, 0xD15A, 0x635A, 0x635C, 0x6359,
+ 0x635B, 0, 0, 0, 0, 0, 0xD15B, 0x3722,
+ 0x7953, 0, 0, 0xF330, 0, 0, 0, 0,
+ 0, 0x635D, 0x3726, 0, 0xF331, 0, 0x3567, 0x4D52,
+ 0x635F, 0, 0, 0x7955, 0, 0xD160, 0x6360, 0,
+ 0, 0xF334, 0x312E, 0x7956, 0xF335, 0, 0xF336, 0x6363,
+};
static const unsigned short utf8_to_euc_E7AB[] = {
0, 0, 0, 0x3376, 0x6362, 0x6361, 0xD164, 0x6365,
0x635E, 0xD165, 0x6366, 0x4E29, 0xD166, 0x6367, 0xD167, 0x6368,
@@ -4799,6 +8957,16 @@ static const unsigned short utf8_to_euc_E7AB[] = {
0x6372, 0xD16E, 0, 0, 0xD16F, 0, 0x3625, 0,
0x513F, 0x435D, 0x3C33, 0xD170, 0, 0xD171, 0xD172, 0x3448,
};
+static const unsigned short utf8_to_euc_E7AB_x0213[] = {
+ 0, 0, 0, 0x3376, 0x6362, 0x6361, 0xD164, 0x6365,
+ 0x635E, 0xD165, 0x6366, 0x4E29, 0xF338, 0x6367, 0x7957, 0x6368,
+ 0, 0xF339, 0x5474, 0x636A, 0, 0x6369, 0, 0,
+ 0, 0x636B, 0x636C, 0xD169, 0x4E35, 0x636D, 0, 0x706F,
+ 0x3E4F, 0x636E, 0x636F, 0x3D57, 0, 0x4638, 0x6370, 0xF33A,
+ 0xF33B, 0xD16B, 0x4328, 0x7958, 0xD16D, 0x6371, 0, 0x433C,
+ 0x6372, 0xD16E, 0, 0, 0xF33C, 0, 0x3625, 0,
+ 0x513F, 0x435D, 0x3C33, 0xD170, 0, 0x7959, 0xD172, 0x3448,
+};
static const unsigned short utf8_to_euc_E7AC[] = {
0, 0, 0x6373, 0, 0x6422, 0, 0x6376, 0xD173,
0x3568, 0, 0x6375, 0x6424, 0, 0, 0, 0x6374,
@@ -4809,6 +8977,16 @@ static const unsigned short utf8_to_euc_E7AC[] = {
0xD17E, 0xD221, 0, 0x6377, 0xD222, 0x637B, 0x637D, 0,
0, 0x3A7B, 0, 0, 0, 0xD223, 0, 0xD224,
};
+static const unsigned short utf8_to_euc_E7AC_x0213[] = {
+ 0, 0, 0x6373, 0, 0x6422, 0, 0x6376, 0xF33F,
+ 0x3568, 0, 0x6375, 0x6424, 0, 0, 0, 0x6374,
+ 0, 0x3E50, 0x795A, 0, 0xD174, 0, 0, 0,
+ 0x6378, 0x6379, 0, 0x452B, 0, 0, 0x637A, 0xD175,
+ 0x335E, 0, 0, 0xD176, 0, 0x3F5A, 0x4964, 0xF342,
+ 0x637C, 0xD178, 0xF343, 0xD17A, 0x4268, 0x795B, 0xF344, 0xF345,
+ 0xD17E, 0xF346, 0, 0x6377, 0xD222, 0x637B, 0x637D, 0,
+ 0, 0x3A7B, 0, 0x795C, 0, 0xF341, 0, 0xD224,
+};
static const unsigned short utf8_to_euc_E7AD[] = {
0xD225, 0xD226, 0, 0, 0, 0x6426, 0x492E, 0xD227,
0x4826, 0x4579, 0, 0x365A, 0x6425, 0x6423, 0xD228, 0x4835,
@@ -4819,6 +8997,16 @@ static const unsigned short utf8_to_euc_E7AD[] = {
0x642B, 0x642C, 0xD231, 0xD232, 0x6429, 0x6427, 0, 0xD233,
0, 0, 0x6421, 0, 0, 0, 0, 0,
};
+static const unsigned short utf8_to_euc_E7AD_x0213[] = {
+ 0xD225, 0xF34A, 0, 0, 0, 0x6426, 0x492E, 0x795D,
+ 0x4826, 0x4579, 0, 0x365A, 0x6425, 0x6423, 0x795E, 0x4835,
+ 0x637E, 0x435E, 0x457B, 0, 0x457A, 0xF34C, 0x3A76, 0,
+ 0, 0, 0, 0, 0, 0x6438, 0, 0,
+ 0x795F, 0, 0, 0, 0xF34E, 0x6428, 0xF34F, 0x642A,
+ 0, 0xF350, 0xD22E, 0, 0x642D, 0x7960, 0x642E, 0x7961,
+ 0x642B, 0x642C, 0x7962, 0xF351, 0x6429, 0x6427, 0, 0xD233,
+ 0, 0xF34D, 0x6421, 0, 0, 0, 0, 0xF349,
+};
static const unsigned short utf8_to_euc_E7AE[] = {
0, 0, 0, 0, 0xD234, 0, 0x4A4F, 0x3255,
0, 0xD235, 0, 0x6435, 0, 0x6432, 0xD236, 0x6437,
@@ -4829,6 +9017,16 @@ static const unsigned short utf8_to_euc_E7AE[] = {
0xD240, 0x4822, 0xD241, 0, 0x643E, 0xD242, 0xD243, 0,
0x4824, 0, 0xD244, 0xD245, 0xD246, 0xD247, 0, 0,
};
+static const unsigned short utf8_to_euc_E7AE_x0213[] = {
+ 0, 0, 0, 0, 0xD234, 0, 0x4A4F, 0x3255,
+ 0, 0xD235, 0, 0x6435, 0, 0x6432, 0xD236, 0x6437,
+ 0xF354, 0xF355, 0x6436, 0, 0x4773, 0x4C27, 0xD239, 0x3B3B,
+ 0x6430, 0x6439, 0x6434, 0xF356, 0x6433, 0x642F, 0x7963, 0x6431,
+ 0xD23C, 0x3449, 0, 0, 0, 0xD23D, 0, 0,
+ 0, 0, 0x433D, 0, 0xD23E, 0x407D, 0, 0xF358,
+ 0xD240, 0x4822, 0xD241, 0, 0x643E, 0xF359, 0xD243, 0,
+ 0x4824, 0, 0xD244, 0xD245, 0xF35A, 0xD247, 0, 0,
+};
static const unsigned short utf8_to_euc_E7AF[] = {
0x4061, 0x643B, 0xD248, 0, 0x484F, 0xD249, 0x643F, 0x4A53,
0xD24A, 0x435B, 0xD24B, 0x643A, 0x643C, 0, 0, 0x643D,
@@ -4839,6 +9037,16 @@ static const unsigned short utf8_to_euc_E7AF[] = {
0, 0, 0xD254, 0x644A, 0xD255, 0xD256, 0x644E, 0x644B,
0xD257, 0xD258, 0xD259, 0, 0xD25A, 0, 0xD25B, 0,
};
+static const unsigned short utf8_to_euc_E7AF_x0213[] = {
+ 0x4061, 0x643B, 0xD248, 0, 0x484F, 0xF35B, 0x643F, 0x4A53,
+ 0xD24A, 0x435B, 0xF35C, 0x643A, 0x643C, 0, 0, 0x643D,
+ 0, 0, 0, 0, 0xF35F, 0, 0xF360, 0x7965,
+ 0, 0x7966, 0xF361, 0xD251, 0, 0x6440, 0, 0,
+ 0x3C44, 0, 0, 0, 0x4646, 0x6445, 0x6444, 0,
+ 0xD252, 0x6441, 0xF362, 0, 0, 0x4F36, 0, 0,
+ 0xF363, 0, 0xD254, 0x644A, 0xD255, 0xD256, 0x644E, 0x644B,
+ 0xD257, 0xD258, 0xD259, 0, 0xD25A, 0, 0xD25B, 0,
+};
static const unsigned short utf8_to_euc_E7B0[] = {
0x6447, 0xD25C, 0xD25D, 0xD25E, 0xD25F, 0, 0xD260, 0x6448,
0, 0xD261, 0, 0xD262, 0xD263, 0x644D, 0xD264, 0xD265,
@@ -4849,6 +9057,16 @@ static const unsigned short utf8_to_euc_E7B0[] = {
0, 0xD26D, 0, 0xD26E, 0xD26F, 0, 0xD270, 0x6453,
0x4876, 0xD271, 0xD272, 0, 0, 0x6455, 0x4E7C, 0x4A6D,
};
+static const unsigned short utf8_to_euc_E7B0_x0213[] = {
+ 0x6447, 0x7967, 0xD25D, 0xF364, 0xD25F, 0, 0xD260, 0x6448,
+ 0, 0xD261, 0, 0xF365, 0xD263, 0x644D, 0xF366, 0xF367,
+ 0, 0x6442, 0x5255, 0x6449, 0x6443, 0, 0, 0x644C,
+ 0, 0xD266, 0, 0xD267, 0, 0, 0x7969, 0x6452,
+ 0x796A, 0x344A, 0, 0x644F, 0, 0xD269, 0xF368, 0x6450,
+ 0xD26B, 0, 0x6451, 0x6454, 0xD26C, 0, 0, 0,
+ 0, 0x7968, 0, 0x796B, 0xD26F, 0, 0x796C, 0x6453,
+ 0x4876, 0xD271, 0xD272, 0, 0, 0x6455, 0x4E7C, 0x4A6D,
+};
static const unsigned short utf8_to_euc_E7B1[] = {
0x645A, 0, 0, 0x6457, 0, 0, 0xD273, 0,
0, 0, 0xD274, 0, 0x6456, 0x4052, 0, 0x6459,
@@ -4859,6 +9077,16 @@ static const unsigned short utf8_to_euc_E7B1[] = {
0xD327, 0, 0xD328, 0x4A46, 0, 0x6462, 0, 0,
0, 0xD329, 0, 0, 0xD32A, 0xD32B, 0x4C62, 0,
};
+static const unsigned short utf8_to_euc_E7B1_x0213[] = {
+ 0x645A, 0, 0, 0x6457, 0, 0xF369, 0xD273, 0,
+ 0, 0, 0xF36A, 0, 0x6456, 0x4052, 0, 0x6459,
+ 0x645B, 0xF36B, 0xD277, 0xD278, 0x6458, 0xD275, 0x645F, 0xF36C,
+ 0x645C, 0x796F, 0xD27A, 0xD27B, 0xD27C, 0xD27D, 0xF36D, 0x645D,
+ 0x6446, 0xF36E, 0, 0xD322, 0x645E, 0x6460, 0, 0xD323,
+ 0, 0xF36F, 0, 0, 0x6461, 0x7970, 0xF370, 0xF371,
+ 0xF372, 0, 0xD328, 0x4A46, 0, 0x6462, 0, 0,
+ 0, 0x7971, 0, 0, 0xD32A, 0xD32B, 0x4C62, 0,
+};
static const unsigned short utf8_to_euc_E7B2[] = {
0, 0x364E, 0x3729, 0x6463, 0, 0, 0xD32C, 0xD32D,
0, 0x4A34, 0, 0x3F68, 0, 0x4C30, 0, 0xD32E,
@@ -4869,6 +9097,16 @@ static const unsigned short utf8_to_euc_E7B2[] = {
0xD333, 0x646D, 0x646C, 0x646B, 0, 0, 0xD334, 0xD335,
0, 0x646F, 0xD336, 0xD337, 0xD338, 0x6470, 0x403A, 0xD339,
};
+static const unsigned short utf8_to_euc_E7B2_x0213[] = {
+ 0, 0x364E, 0x3729, 0x6463, 0, 0, 0xD32C, 0xD32D,
+ 0, 0x4A34, 0, 0x3F68, 0, 0x4C30, 0, 0x7972,
+ 0x6464, 0, 0x4E33, 0, 0x7973, 0x4774, 0, 0x4146,
+ 0x4734, 0, 0, 0x3D4D, 0, 0, 0xD330, 0x3040,
+ 0x7974, 0x6469, 0x6467, 0, 0x6465, 0x3421, 0xF376, 0x3E51,
+ 0x646A, 0, 0, 0x6468, 0, 0x6466, 0x646E, 0,
+ 0xD333, 0x646D, 0x646C, 0x646B, 0, 0, 0xF378, 0xF379,
+ 0, 0x646F, 0xD336, 0xD337, 0x7975, 0x6470, 0x403A, 0xF37A,
+};
static const unsigned short utf8_to_euc_E7B3[] = {
0x6471, 0, 0x6473, 0, 0xD33A, 0x6472, 0, 0xD33B,
0xD33C, 0xD33D, 0x3852, 0, 0, 0xD33E, 0x4138, 0xD33F,
@@ -4879,6 +9117,16 @@ static const unsigned short utf8_to_euc_E7B3[] = {
0, 0, 0x647A, 0, 0x647B, 0xD34A, 0x647C, 0,
0x3B65, 0, 0x647D, 0x374F, 0, 0, 0x356A, 0,
};
+static const unsigned short utf8_to_euc_E7B3_x0213[] = {
+ 0x6471, 0, 0x6473, 0, 0xF37C, 0x6472, 0, 0xD33B,
+ 0xF37E, 0xD33D, 0x3852, 0, 0, 0xF421, 0x4138, 0xD33F,
+ 0, 0, 0x6475, 0xD340, 0xD341, 0x7976, 0x457C, 0xF423,
+ 0x6474, 0x7977, 0xD345, 0, 0x6476, 0x7978, 0x4A35, 0x416C,
+ 0x3947, 0, 0x6477, 0, 0, 0, 0xF425, 0x4E48,
+ 0, 0xD348, 0, 0xF426, 0, 0, 0, 0x6479,
+ 0, 0, 0x647A, 0, 0x647B, 0xF428, 0x647C, 0,
+ 0x3B65, 0, 0x647D, 0x374F, 0, 0, 0x356A, 0,
+};
static const unsigned short utf8_to_euc_E7B4[] = {
0x352A, 0, 0x6521, 0xD34B, 0x4C73, 0x3948, 0x647E, 0xD34C,
0xD34D, 0xD34E, 0x6524, 0x4C66, 0, 0x473C, 0, 0xD34F,
@@ -4889,6 +9137,16 @@ static const unsigned short utf8_to_euc_E7B4[] = {
0x3A59, 0xD35A, 0x6528, 0x3F42, 0, 0x652A, 0, 0,
0, 0x3E52, 0x3A30, 0, 0xD35B, 0xD35C, 0xD35D, 0x6529,
};
+static const unsigned short utf8_to_euc_E7B4_x0213[] = {
+ 0x352A, 0, 0x6521, 0xF429, 0x4C73, 0x3948, 0x647E, 0x7979,
+ 0x797A, 0xF42A, 0x6524, 0x4C66, 0, 0x473C, 0, 0xD34F,
+ 0x4933, 0xD350, 0xF42C, 0x797B, 0x3D63, 0x6523, 0xD353, 0x3C53,
+ 0x3949, 0x3B66, 0x3569, 0x4A36, 0x6522, 0x797C, 0xF42D, 0,
+ 0x4147, 0x4B42, 0x3A77, 0x797D, 0, 0, 0xD357, 0,
+ 0, 0, 0xD358, 0x3B67, 0x445D, 0xD359, 0x6527, 0x4E5F,
+ 0x3A59, 0x797E, 0x6528, 0x3F42, 0, 0x652A, 0, 0,
+ 0, 0x3E52, 0x3A30, 0, 0xD35B, 0xF430, 0xF431, 0x6529,
+};
static const unsigned short utf8_to_euc_E7B5[] = {
0xD35E, 0xD35F, 0x3D2A, 0x383E, 0x4148, 0x6525, 0x652B, 0xD360,
0xD361, 0, 0, 0x6526, 0x3750, 0xD362, 0x652E, 0x6532,
@@ -4899,6 +9157,16 @@ static const unsigned short utf8_to_euc_E7B5[] = {
0xD36D, 0x457D, 0x652F, 0x652C, 0, 0x3328, 0x4064, 0,
0xD36E, 0x3828, 0xD36F, 0xD370, 0, 0x6538, 0, 0xD371,
};
+static const unsigned short utf8_to_euc_E7B5_x0213[] = {
+ 0xF432, 0x7A21, 0x3D2A, 0x383E, 0x4148, 0x6525, 0x652B, 0xF433,
+ 0x7A22, 0, 0, 0x6526, 0x3750, 0xD362, 0x652E, 0x6532,
+ 0x376B, 0xD363, 0, 0x7A23, 0, 0, 0x652D, 0xD365,
+ 0, 0xF437, 0xF438, 0x6536, 0x7A24, 0xD369, 0x394A, 0,
+ 0, 0x4D6D, 0x303C, 0x6533, 0, 0xD36A, 0x356B, 0xD36B,
+ 0x6530, 0, 0xF439, 0, 0, 0, 0x6531, 0,
+ 0xF43A, 0x457D, 0x652F, 0x652C, 0, 0x3328, 0x4064, 0,
+ 0xD36E, 0x3828, 0x7A25, 0xD370, 0, 0x6538, 0, 0xF43C,
+};
static const unsigned short utf8_to_euc_E7B6[] = {
0, 0xD372, 0xD373, 0xD374, 0, 0xD375, 0xD376, 0,
0xD377, 0x6535, 0, 0xD378, 0xD379, 0xD37A, 0, 0x6537,
@@ -4909,6 +9177,16 @@ static const unsigned short utf8_to_euc_E7B6[] = {
0x6547, 0x394B, 0x4C56, 0xD425, 0x4456, 0x653D, 0xD426, 0xD427,
0x6545, 0xD428, 0x653A, 0x433E, 0, 0x653F, 0x303D, 0x4C4A,
};
+static const unsigned short utf8_to_euc_E7B6_x0213[] = {
+ 0, 0xD372, 0xD373, 0x7A26, 0, 0xD375, 0xF43E, 0,
+ 0xF43F, 0x6535, 0, 0x7A27, 0xF440, 0xD37A, 0, 0x6537,
+ 0, 0xD37B, 0, 0x6534, 0, 0, 0xD37C, 0xF441,
+ 0, 0x3751, 0x4233, 0x6539, 0x416E, 0xF443, 0xD421, 0x6546,
+ 0x7A28, 0, 0x6542, 0x653C, 0, 0, 0x7A29, 0xF444,
+ 0, 0, 0xF445, 0x6540, 0x3C7A, 0x305D, 0x653B, 0x6543,
+ 0x6547, 0x394B, 0x4C56, 0xD425, 0x4456, 0x653D, 0xF446, 0xF447,
+ 0x6545, 0xD428, 0x653A, 0x433E, 0, 0x653F, 0x303D, 0x4C4A,
+};
static const unsigned short utf8_to_euc_E7B7[] = {
0, 0, 0xD429, 0xD42A, 0xD42B, 0xD42C, 0xD42D, 0x653E,
0, 0, 0x365B, 0x486C, 0xD42E, 0xD42F, 0xD430, 0x416D,
@@ -4919,6 +9197,16 @@ static const unsigned short utf8_to_euc_E7B7[] = {
0, 0xD43A, 0x654D, 0, 0x4E7D, 0xD43B, 0xD43C, 0,
0, 0xD43D, 0xD43E, 0x654C, 0, 0, 0, 0,
};
+static const unsigned short utf8_to_euc_E7B7_x0213[] = {
+ 0xF448, 0, 0x7A2A, 0xD42A, 0xD42B, 0xD42C, 0xD42D, 0x653E,
+ 0, 0, 0x365B, 0x486C, 0x7A2B, 0xD42F, 0xD430, 0x416D,
+ 0, 0x4E50, 0x3D6F, 0, 0, 0x656E, 0x7A2C, 0xF449,
+ 0x6548, 0xF44A, 0x407E, 0, 0x6544, 0x6549, 0x654B, 0,
+ 0x4479, 0x654E, 0xD434, 0x7A2D, 0x654A, 0xD435, 0xF44B, 0,
+ 0x4A54, 0x344B, 0xD437, 0xD438, 0x4C4B, 0xD439, 0, 0x305E,
+ 0, 0xF44C, 0x654D, 0, 0x4E7D, 0xD43B, 0xD43C, 0,
+ 0, 0xF44D, 0xD43E, 0x654C, 0, 0, 0, 0,
+};
static const unsigned short utf8_to_euc_E7B8[] = {
0xD433, 0x316F, 0, 0, 0x466C, 0x654F, 0, 0,
0xD43F, 0x6556, 0x6550, 0x6557, 0, 0, 0, 0,
@@ -4929,6 +9217,16 @@ static const unsigned short utf8_to_euc_E7B8[] = {
0, 0x6554, 0x6560, 0xD44C, 0, 0x655C, 0xD44D, 0x655F,
0, 0x655D, 0x6561, 0x655B, 0, 0x6541, 0x4053, 0xD44E,
};
+static const unsigned short utf8_to_euc_E7B8_x0213[] = {
+ 0xD433, 0x316F, 0, 0, 0x466C, 0x654F, 0, 0,
+ 0x7A30, 0x6556, 0x6550, 0x6557, 0, 0, 0, 0,
+ 0xF451, 0x7A31, 0x6553, 0, 0, 0x7A32, 0, 0xF452,
+ 0, 0, 0, 0x477B, 0xD444, 0xF453, 0x3C4A, 0x6555,
+ 0xF454, 0x6552, 0x6558, 0x6551, 0, 0, 0x3D44, 0xF455,
+ 0x7A2F, 0, 0, 0x4B25, 0xF456, 0xD44A, 0x3D4C, 0xD44B,
+ 0, 0x6554, 0x6560, 0xD44C, 0, 0x655C, 0xD44D, 0x655F,
+ 0, 0x655D, 0x6561, 0x655B, 0, 0x6541, 0x4053, 0xD44E,
+};
static const unsigned short utf8_to_euc_E7B9[] = {
0, 0x484B, 0, 0x655E, 0xD44F, 0xD450, 0x6559, 0xD451,
0, 0, 0x4121, 0x3752, 0, 0x3D2B, 0xD452, 0,
@@ -4939,6 +9237,16 @@ static const unsigned short utf8_to_euc_E7B9[] = {
0x372B, 0, 0, 0xD45D, 0, 0, 0, 0,
0xD45E, 0x6568, 0, 0x656C, 0x656B, 0x656F, 0xD45F, 0x6571,
};
+static const unsigned short utf8_to_euc_E7B9_x0213[] = {
+ 0, 0x484B, 0, 0x655E, 0xD44F, 0xF457, 0x6559, 0x7A34,
+ 0, 0, 0x4121, 0x3752, 0, 0x3D2B, 0xD452, 0,
+ 0xD453, 0, 0x7A35, 0, 0x3F25, 0x4136, 0x6564, 0,
+ 0xD455, 0x6566, 0x6567, 0, 0, 0x6563, 0x6565, 0xD456,
+ 0, 0x7A36, 0xD458, 0, 0, 0xD459, 0x655A, 0x6562,
+ 0, 0x656A, 0x6569, 0x7E7E, 0, 0x4B7A, 0xD45B, 0xD45C,
+ 0x372B, 0, 0, 0xF458, 0, 0xF459, 0, 0,
+ 0xD45E, 0x6568, 0, 0x656C, 0x656B, 0x656F, 0xF45A, 0x6571,
+};
static const unsigned short utf8_to_euc_E7BA[] = {
0, 0xD460, 0x3B3C, 0x656D, 0, 0, 0xD461, 0xD462,
0x6572, 0x6573, 0xD463, 0, 0x6574, 0xD464, 0x657A, 0x453B,
@@ -4949,6 +9257,16 @@ static const unsigned short utf8_to_euc_E7BA[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
};
+static const unsigned short utf8_to_euc_E7BA_x0213[] = {
+ 0, 0xD460, 0x3B3C, 0x656D, 0, 0, 0xF45B, 0xF45C,
+ 0x6572, 0x6573, 0x7A37, 0, 0x6574, 0x7A38, 0x657A, 0x453B,
+ 0x6576, 0xF45E, 0x6575, 0x6577, 0x6578, 0xD466, 0x6579, 0,
+ 0xF45F, 0, 0xF460, 0x657B, 0x657C, 0xD469, 0xD46A, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+};
static const unsigned short utf8_to_euc_E7BC[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
@@ -4959,6 +9277,16 @@ static const unsigned short utf8_to_euc_E7BC[] = {
0, 0, 0, 0, 0, 0, 0x344C, 0,
0x657D, 0, 0x657E, 0xD46C, 0xD46B, 0xD46D, 0xD46E, 0xD46F,
};
+static const unsigned short utf8_to_euc_E7BC_x0213[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0x344C, 0,
+ 0x657D, 0, 0x657E, 0xF463, 0xF462, 0xD46D, 0xF464, 0xD46F,
+};
static const unsigned short utf8_to_euc_E7BD[] = {
0, 0, 0, 0xD470, 0xD471, 0x6621, 0, 0xD472,
0, 0, 0, 0, 0x6622, 0x6623, 0x6624, 0xD473,
@@ -4969,6 +9297,16 @@ static const unsigned short utf8_to_euc_E7BD[] = {
0x4833, 0xD521, 0x3D70, 0, 0, 0x474D, 0, 0x486D,
0x662F, 0x586D, 0, 0, 0, 0xD522, 0xD523, 0xD524,
};
+static const unsigned short utf8_to_euc_E7BD_x0213[] = {
+ 0, 0, 0, 0xF465, 0xF466, 0x6621, 0, 0x7A39,
+ 0, 0, 0, 0, 0x6622, 0x6623, 0x6624, 0xF467,
+ 0x6625, 0x6626, 0xF46A, 0xD475, 0x6628, 0x6627, 0, 0,
+ 0x6629, 0, 0, 0xD476, 0xD477, 0xD478, 0, 0x662A,
+ 0x662B, 0xF46C, 0, 0xF46D, 0xF46E, 0xD47C, 0xD47D, 0x662E,
+ 0x662C, 0x662D, 0x3A61, 0x3753, 0, 0xF46F, 0x4356, 0,
+ 0x4833, 0xD521, 0x3D70, 0, 0, 0x474D, 0, 0x486D,
+ 0x662F, 0x586D, 0, 0, 0, 0xF470, 0xF471, 0xD524,
+};
static const unsigned short utf8_to_euc_E7BE[] = {
0xD525, 0, 0x6630, 0x6632, 0, 0x4D65, 0x6631, 0x6634,
0x6633, 0, 0x4D53, 0xD526, 0x6635, 0xD527, 0x487E, 0xD528,
@@ -4979,6 +9317,16 @@ static const unsigned short utf8_to_euc_E7BE[] = {
0, 0, 0x663C, 0, 0xD533, 0, 0x663F, 0,
0x6640, 0x663D, 0, 0, 0xD534, 0x3129, 0, 0xD535,
};
+static const unsigned short utf8_to_euc_E7BE_x0213[] = {
+ 0xD525, 0, 0x6630, 0x6632, 0, 0x4D65, 0x6631, 0x6634,
+ 0x6633, 0, 0x4D53, 0xD526, 0x6635, 0xD527, 0x487E, 0xD528,
+ 0xF473, 0x7A3B, 0, 0, 0x6636, 0, 0xF476, 0x7A3C,
+ 0, 0, 0x6639, 0, 0xF477, 0x6638, 0x6637, 0,
+ 0, 0xD52E, 0xD52F, 0x663A, 0x3732, 0, 0xD530, 0,
+ 0x4122, 0x3541, 0xD531, 0, 0, 0xF478, 0x663E, 0x663B,
+ 0, 0, 0x663C, 0, 0xD533, 0, 0x663F, 0,
+ 0x6640, 0x663D, 0, 0, 0xD534, 0x3129, 0, 0x7A3D,
+};
static const unsigned short utf8_to_euc_E7BF[] = {
0xD536, 0x3227, 0, 0xD537, 0, 0x6642, 0x6643, 0,
0xD538, 0, 0x6644, 0, 0x4D62, 0, 0xD539, 0xD53A,
@@ -4989,6 +9337,16 @@ static const unsigned short utf8_to_euc_E7BF[] = {
0x344D, 0, 0xD543, 0x664A, 0, 0, 0, 0,
0, 0x664B, 0xD544, 0x4B5D, 0x4D63, 0xD545, 0xD546, 0xD547,
};
+static const unsigned short utf8_to_euc_E7BF_x0213[] = {
+ 0xD536, 0x3227, 0, 0xF47A, 0, 0x6642, 0x6643, 0,
+ 0xD538, 0, 0x6644, 0, 0x4D62, 0, 0x7A3E, 0xF47B,
+ 0, 0, 0x3D2C, 0, 0x6646, 0x6645, 0, 0,
+ 0, 0, 0, 0x7A3F, 0, 0, 0, 0x7A40,
+ 0x3F69, 0x6647, 0, 0xF47C, 0, 0xF47D, 0x6648, 0,
+ 0xD53F, 0x6649, 0, 0x3465, 0x7A41, 0, 0x7A42, 0xF47E,
+ 0x344D, 0, 0xF521, 0x664A, 0, 0, 0, 0,
+ 0, 0x664B, 0x7A43, 0x4B5D, 0x4D63, 0xD545, 0xD546, 0xD547,
+};
static const unsigned short utf8_to_euc_E880[] = {
0x4D54, 0x4F37, 0, 0x394D, 0x664E, 0x3C54, 0x664D, 0xD548,
0xD549, 0, 0xD54A, 0x664F, 0x3C29, 0xD54B, 0xD54C, 0xD54D,
@@ -4999,6 +9357,16 @@ static const unsigned short utf8_to_euc_E880[] = {
0xD55A, 0, 0, 0x3C2A, 0xD55B, 0xD55C, 0x4C6D, 0xD55D,
0, 0xD55E, 0xD55F, 0x6657, 0xD560, 0x433F, 0xD561, 0x6656,
};
+static const unsigned short utf8_to_euc_E880_x0213[] = {
+ 0x4D54, 0x4F37, 0xF522, 0x394D, 0x664E, 0x3C54, 0x664D, 0xD548,
+ 0xF524, 0, 0xF523, 0x664F, 0x3C29, 0xD54B, 0xF525, 0xD54D,
+ 0x4251, 0xF526, 0x6650, 0xD54F, 0x7A45, 0x394C, 0xF527, 0x4C57,
+ 0x6651, 0x6652, 0, 0, 0x6653, 0xD552, 0xD553, 0xD554,
+ 0xD555, 0x6654, 0, 0, 0xF528, 0, 0x7A46, 0,
+ 0x6655, 0, 0, 0, 0xF529, 0, 0xD559, 0,
+ 0xF52A, 0, 0, 0x3C2A, 0xD55B, 0x7A47, 0x4C6D, 0x7A48,
+ 0, 0xD55E, 0xD55F, 0x6657, 0x7A49, 0x433F, 0xD561, 0x6656,
+};
static const unsigned short utf8_to_euc_E881[] = {
0xD562, 0, 0, 0, 0xD563, 0, 0x6659, 0,
0, 0, 0x6658, 0, 0, 0, 0, 0,
@@ -5009,6 +9377,16 @@ static const unsigned short utf8_to_euc_E881[] = {
0x6662, 0xD568, 0x6661, 0x6660, 0x4430, 0xD569, 0x6663, 0x3F26,
0, 0x6664, 0, 0, 0, 0x6665, 0x4F38, 0x6666,
};
+static const unsigned short utf8_to_euc_E881_x0213[] = {
+ 0xD562, 0, 0, 0xF52B, 0xD563, 0, 0x6659, 0,
+ 0, 0, 0x6658, 0, 0, 0, 0, 0,
+ 0, 0, 0x665A, 0, 0, 0, 0x403B, 0,
+ 0x665B, 0, 0x665C, 0, 0, 0, 0x4A39, 0x665D,
+ 0xD564, 0x416F, 0x665E, 0, 0xD565, 0, 0xF52C, 0,
+ 0x665F, 0, 0, 0, 0, 0xD567, 0, 0x4E7E,
+ 0x6662, 0xF52D, 0x6661, 0x6660, 0x4430, 0xF52E, 0x6663, 0x3F26,
+ 0, 0x6664, 0, 0xF52F, 0, 0x6665, 0x4F38, 0x6666,
+};
static const unsigned short utf8_to_euc_E882[] = {
0, 0xD56A, 0, 0, 0x6667, 0x6669, 0x6668, 0x4825,
0xD56B, 0x4679, 0, 0x4F3E, 0x4829, 0, 0xD56C, 0,
@@ -5019,6 +9397,16 @@ static const unsigned short utf8_to_euc_E882[] = {
0, 0x394F, 0x3069, 0, 0x3A68, 0, 0, 0,
0xD572, 0xD573, 0x4759, 0, 0, 0, 0, 0,
};
+static const unsigned short utf8_to_euc_E882_x0213[] = {
+ 0, 0xD56A, 0, 0, 0x6667, 0x6669, 0x6668, 0x4825,
+ 0xD56B, 0x4679, 0, 0x4F3E, 0x4829, 0, 0xD56C, 0,
+ 0, 0, 0, 0x666B, 0, 0, 0x3E53, 0,
+ 0x492A, 0xF530, 0x666C, 0x666A, 0xF531, 0x344E, 0xD56E, 0,
+ 0, 0x3854, 0x3B68, 0, 0xF532, 0x486E, 0xD56F, 0xF533,
+ 0, 0x382A, 0x4B43, 0xD571, 0x666F, 0x666D, 0, 0x394E,
+ 0, 0x394F, 0x3069, 0, 0x3A68, 0, 0, 0,
+ 0xF534, 0xD573, 0x4759, 0, 0, 0, 0, 0,
+};
static const unsigned short utf8_to_euc_E883[] = {
0, 0, 0, 0x305F, 0x6674, 0, 0x4340, 0,
0xD574, 0, 0, 0, 0x4758, 0xD575, 0x425B, 0xD576,
@@ -5029,6 +9417,16 @@ static const unsigned short utf8_to_euc_E883[] = {
0xD621, 0x6679, 0xD622, 0xD623, 0x4639, 0, 0xD624, 0,
0x363B, 0xD625, 0xD626, 0, 0x6726, 0x473D, 0xD627, 0,
};
+static const unsigned short utf8_to_euc_E883_x0213[] = {
+ 0, 0, 0, 0x305F, 0x6674, 0xF536, 0x4340, 0,
+ 0xD574, 0, 0x7A4A, 0, 0x4758, 0xD575, 0x425B, 0xD576,
+ 0, 0, 0xD577, 0, 0xD578, 0xF537, 0x6676, 0x7A4B,
+ 0xF538, 0x6672, 0x6675, 0x6670, 0, 0x6673, 0x4B26, 0,
+ 0x7A4C, 0x3855, 0, 0, 0x307D, 0x6671, 0xF539, 0,
+ 0, 0, 0, 0, 0, 0xD57D, 0xD57E, 0x6678,
+ 0xD621, 0x6679, 0xD622, 0x7A4D, 0x4639, 0xF53C, 0xD624, 0,
+ 0x363B, 0xD625, 0xD626, 0xF53D, 0x6726, 0x473D, 0xD627, 0,
+};
static const unsigned short utf8_to_euc_E884[] = {
0, 0, 0x3B69, 0xD628, 0, 0x363C, 0x4048, 0x4F46,
0x4C2E, 0x6677, 0x4054, 0xD629, 0, 0, 0, 0,
@@ -5039,6 +9437,16 @@ static const unsigned short utf8_to_euc_E884[] = {
0xD633, 0x4326, 0, 0x473E, 0, 0xD634, 0, 0,
0, 0x4431, 0xD635, 0, 0xD636, 0, 0x6723, 0,
};
+static const unsigned short utf8_to_euc_E884_x0213[] = {
+ 0, 0, 0x3B69, 0xD628, 0, 0x363C, 0x4048, 0x4F46,
+ 0x4C2E, 0x6677, 0x4054, 0xD629, 0, 0xF53B, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0xF540, 0xD62B,
+ 0x7A4E, 0, 0x3553, 0x667A, 0xD62D, 0, 0xF541, 0,
+ 0xD62F, 0, 0, 0x667C, 0xF543, 0, 0, 0xF544,
+ 0, 0x667B, 0, 0, 0xF545, 0, 0, 0x667D,
+ 0xD633, 0x4326, 0, 0x473E, 0, 0xF53F, 0, 0,
+ 0, 0x4431, 0xD635, 0, 0xD636, 0xF547, 0x6723, 0,
+};
static const unsigned short utf8_to_euc_E885[] = {
0, 0, 0, 0, 0, 0xD637, 0x6722, 0xD638,
0, 0, 0xD639, 0x667E, 0xD63A, 0, 0x3F55, 0,
@@ -5049,6 +9457,16 @@ static const unsigned short utf8_to_euc_E885[] = {
0x3978, 0x6727, 0, 0, 0x672B, 0, 0, 0xD644,
0x4432, 0x4A22, 0x4123, 0, 0, 0, 0, 0x425C,
};
+static const unsigned short utf8_to_euc_E885_x0213[] = {
+ 0, 0, 0, 0, 0, 0xD637, 0x6722, 0xD638,
+ 0, 0, 0x7A4F, 0x667E, 0xD63A, 0, 0x3F55, 0,
+ 0x4965, 0x6725, 0xD63B, 0x6724, 0x3950, 0x4F53, 0, 0xD63C,
+ 0, 0, 0, 0, 0, 0, 0, 0x6735,
+ 0x7A50, 0xD63E, 0, 0, 0, 0x6729, 0x672A, 0x7A51,
+ 0x7A52, 0xF549, 0, 0x3C70, 0, 0x7A53, 0x6728, 0xD643,
+ 0x3978, 0x6727, 0, 0, 0x672B, 0, 0, 0xD644,
+ 0x4432, 0x4A22, 0x4123, 0, 0, 0, 0, 0x425C,
+};
static const unsigned short utf8_to_euc_E886[] = {
0x672F, 0xD645, 0x6730, 0x672C, 0xD647, 0xD648, 0xD649, 0,
0x672D, 0, 0x672E, 0xD64A, 0, 0, 0xD64B, 0x3951,
@@ -5059,6 +9477,16 @@ static const unsigned short utf8_to_euc_E886[] = {
0x6738, 0, 0xD652, 0x4137, 0xD653, 0x6739, 0, 0,
0x673B, 0, 0x673F, 0xD654, 0, 0x673C, 0x673A, 0x473F,
};
+static const unsigned short utf8_to_euc_E886_x0213[] = {
+ 0x672F, 0xF54B, 0x6730, 0x672C, 0xF54D, 0xF54E, 0xD649, 0,
+ 0x672D, 0, 0x672E, 0xD64A, 0, 0, 0xD64B, 0x3951,
+ 0xD646, 0, 0, 0x6736, 0, 0x6732, 0xD64C, 0,
+ 0xF550, 0, 0x4966, 0xD64E, 0x4B6C, 0x4928, 0xD64F, 0,
+ 0x6731, 0, 0xD650, 0x6734, 0x6733, 0, 0, 0,
+ 0x4B44, 0x6737, 0, 0, 0, 0, 0xD651, 0,
+ 0x6738, 0, 0xF551, 0x4137, 0xD653, 0x6739, 0, 0,
+ 0x673B, 0, 0x673F, 0x7A54, 0, 0x673C, 0x673A, 0x473F,
+};
static const unsigned short utf8_to_euc_E887[] = {
0x673D, 0, 0x673E, 0xD656, 0, 0xD657, 0x3232, 0,
0x6745, 0x6740, 0xD658, 0xD655, 0, 0x6741, 0xD659, 0xD65A,
@@ -5069,6 +9497,16 @@ static const unsigned short utf8_to_euc_E887[] = {
0xD664, 0xD665, 0xD666, 0x3B6A, 0x4357, 0xD667, 0xD668, 0,
0xD669, 0xD66A, 0x674A, 0x674B, 0x3131, 0xD66B, 0x674C, 0xD66C,
};
+static const unsigned short utf8_to_euc_E887_x0213[] = {
+ 0x673D, 0xF552, 0x673E, 0xF553, 0, 0xD657, 0x3232, 0,
+ 0x6745, 0x6740, 0x7A55, 0xD655, 0, 0x6741, 0xD659, 0x7A56,
+ 0, 0x6742, 0, 0x4221, 0, 0xD65B, 0xF554, 0x7A57,
+ 0x6744, 0x6743, 0x6746, 0xF555, 0, 0xD65E, 0xD65F, 0x6747,
+ 0x6748, 0xD660, 0, 0x3F43, 0xF557, 0x3269, 0, 0x6749,
+ 0x4E57, 0, 0x3C2B, 0xD662, 0xF559, 0x3D2D, 0, 0,
+ 0xD664, 0xD665, 0xD666, 0x3B6A, 0x4357, 0xD667, 0xD668, 0,
+ 0xD669, 0xD66A, 0x674A, 0x674B, 0x3131, 0xF55B, 0x674C, 0xF55C,
+};
static const unsigned short utf8_to_euc_E888[] = {
0xD66D, 0x674D, 0x674E, 0xD66E, 0, 0x674F, 0, 0x6750,
0x363D, 0x5A2A, 0x6751, 0, 0x4065, 0x6752, 0x3C4B, 0xD66F,
@@ -5079,6 +9517,16 @@ static const unsigned short utf8_to_euc_E888[] = {
0, 0, 0xD678, 0x6758, 0xD679, 0x4249, 0x4775, 0x383F,
0x6757, 0x4125, 0xD67A, 0, 0, 0, 0, 0,
};
+static const unsigned short utf8_to_euc_E888_x0213[] = {
+ 0xD66D, 0x674D, 0x674E, 0xD66E, 0xF55E, 0x674F, 0, 0x6750,
+ 0x363D, 0x5A2A, 0x6751, 0, 0x4065, 0x6752, 0x3C4B, 0xD66F,
+ 0x6753, 0, 0x5030, 0xD670, 0xD671, 0, 0x6754, 0x4A5E,
+ 0x345C, 0xF560, 0xD673, 0x4124, 0x3D58, 0xD674, 0x4971, 0x3D2E,
+ 0, 0xF561, 0xF562, 0, 0, 0, 0, 0,
+ 0xD677, 0x6755, 0x3952, 0x6756, 0x484C, 0, 0x6764, 0,
+ 0, 0, 0xF564, 0x6758, 0xF565, 0x4249, 0x4775, 0x383F,
+ 0x6757, 0x4125, 0xD67A, 0, 0xF566, 0, 0, 0,
+};
static const unsigned short utf8_to_euc_E889[] = {
0x6759, 0, 0, 0xD67B, 0xD67C, 0xD67D, 0xD67E, 0x447A,
0, 0, 0, 0xD721, 0, 0, 0xD722, 0xD723,
@@ -5089,6 +9537,16 @@ static const unsigned short utf8_to_euc_E889[] = {
0, 0x6765, 0x3F27, 0, 0xD72B, 0, 0x3170, 0x6766,
0x6767, 0, 0, 0xD72C, 0, 0xD72D, 0x6768, 0xD72E,
};
+static const unsigned short utf8_to_euc_E889_x0213[] = {
+ 0x6759, 0, 0, 0xD67B, 0xD67C, 0xF569, 0xF567, 0x447A,
+ 0, 0xF568, 0, 0xF56B, 0, 0, 0xD722, 0xF56D,
+ 0, 0xD724, 0, 0, 0, 0, 0xD725, 0xF56F,
+ 0x675B, 0x675A, 0x675D, 0, 0xF571, 0x675C, 0, 0x675E,
+ 0x7A5B, 0, 0x6760, 0xF572, 0x675F, 0, 0x344F, 0xD729,
+ 0x6761, 0, 0x6762, 0x6763, 0, 0xD72A, 0x3A31, 0x4E49,
+ 0, 0x6765, 0x3F27, 0, 0x7A5C, 0, 0x3170, 0x6766,
+ 0x6767, 0xF576, 0, 0xD72C, 0, 0xF578, 0x6768, 0xF579,
+};
static const unsigned short utf8_to_euc_E88A[] = {
0xD72F, 0xD730, 0, 0xD731, 0xD732, 0, 0, 0xD733,
0, 0xD734, 0xD735, 0x3072, 0, 0x6769, 0xD736, 0,
@@ -5099,6 +9557,16 @@ static const unsigned short utf8_to_euc_E88A[] = {
0xD746, 0x3256, 0xD747, 0x4B27, 0xD748, 0, 0, 0xD749,
0x375D, 0x365C, 0xD74A, 0x676D, 0xD74B, 0x326A, 0xD74C, 0xD74D,
};
+static const unsigned short utf8_to_euc_E88A_x0213[] = {
+ 0xD72F, 0xD730, 0, 0xF57A, 0xD732, 0, 0, 0xD733,
+ 0, 0xD734, 0xF57B, 0x3072, 0, 0x6769, 0x7A5E, 0,
+ 0, 0xD737, 0x676A, 0xF57C, 0xD738, 0, 0xD739, 0,
+ 0xD73A, 0x4967, 0xD73B, 0xD73C, 0, 0x3C47, 0, 0x676C,
+ 0xD73D, 0x7A5F, 0, 0x7A60, 0x7A61, 0x3329, 0x3032, 0xF57D,
+ 0xF57E, 0x7A62, 0xD744, 0x676B, 0x676E, 0x474E, 0x7A63, 0x3F44,
+ 0xD746, 0x3256, 0xF621, 0x4B27, 0xF622, 0, 0, 0x7A64,
+ 0x375D, 0x365C, 0xF623, 0x676D, 0xF624, 0x326A, 0x7A65, 0x7A66,
+};
static const unsigned short utf8_to_euc_E88B[] = {
0, 0, 0, 0, 0, 0x3423, 0xD74E, 0,
0, 0, 0, 0, 0, 0, 0, 0,
@@ -5109,6 +9577,16 @@ static const unsigned short utf8_to_euc_E88B[] = {
0, 0x3151, 0, 0x6774, 0x6773, 0, 0xD759, 0xD75A,
0, 0x6779, 0x6775, 0x6778, 0, 0xD75B, 0xD75C, 0,
};
+static const unsigned short utf8_to_euc_E88B_x0213[] = {
+ 0, 0, 0, 0, 0, 0x3423, 0x7A67, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0xD74F, 0x3171, 0x6772, 0x4E6A, 0x425D, 0x7A68, 0, 0x4944,
+ 0, 0x677E, 0xD751, 0x3257, 0x677C, 0, 0x677A, 0x6771,
+ 0xD752, 0x676F, 0xF625, 0x6770, 0xD754, 0x3C63, 0x366C, 0x4377,
+ 0xF626, 0, 0xD756, 0x4651, 0, 0xD757, 0, 0xD758,
+ 0, 0x3151, 0, 0x6774, 0x6773, 0, 0xD759, 0xF627,
+ 0, 0x6779, 0x6775, 0x6778, 0, 0x7A69, 0x7A6A, 0,
+};
static const unsigned short utf8_to_euc_E88C[] = {
0xD75D, 0xD75E, 0x4C50, 0x6777, 0x3258, 0x337D, 0x677B, 0xD75F,
0xD760, 0x677D, 0xD761, 0xD762, 0, 0, 0x3754, 0,
@@ -5119,6 +9597,16 @@ static const unsigned short utf8_to_euc_E88C[] = {
0xD76D, 0x6825, 0x6824, 0xD76E, 0x6822, 0x6821, 0x4363, 0xD76F,
0x427B, 0x6827, 0xD770, 0, 0xD771, 0xD772, 0, 0,
};
+static const unsigned short utf8_to_euc_E88C_x0213[] = {
+ 0x7A6B, 0x7A6C, 0x4C50, 0x6777, 0x3258, 0x337D, 0x677B, 0xF628,
+ 0xF629, 0x677D, 0xD761, 0xD762, 0xF62A, 0, 0x3754, 0,
+ 0, 0, 0, 0, 0, 0, 0x6823, 0x682C,
+ 0x682D, 0, 0, 0xF62C, 0x302B, 0xF62D, 0xD766, 0xD767,
+ 0, 0xD768, 0x7A6E, 0x6834, 0, 0, 0, 0,
+ 0x3071, 0, 0, 0x682B, 0xD76A, 0x7A6F, 0xD76C, 0x682A,
+ 0xF62E, 0x6825, 0x6824, 0xD76E, 0x6822, 0x6821, 0x4363, 0xD76F,
+ 0x427B, 0x6827, 0x7A70, 0, 0xF62F, 0xD772, 0, 0,
+};
static const unsigned short utf8_to_euc_E88D[] = {
0x6826, 0, 0xD773, 0xD774, 0xD775, 0x6829, 0, 0xD776,
0, 0x4170, 0x3755, 0, 0, 0xD777, 0xD778, 0x3141,
@@ -5129,6 +9617,16 @@ static const unsigned short utf8_to_euc_E88D[] = {
0xD77D, 0, 0, 0x683A, 0, 0x683B, 0, 0x3259,
0xD77E, 0, 0, 0x322E, 0x6838, 0xD821, 0, 0xD822,
};
+static const unsigned short utf8_to_euc_E88D_x0213[] = {
+ 0x6826, 0, 0xD773, 0x7A71, 0xF630, 0x6829, 0, 0x7A72,
+ 0, 0x4170, 0x3755, 0, 0, 0xD777, 0xD778, 0x3141,
+ 0x6828, 0x7A73, 0x3953, 0xD83E, 0xF62B, 0x7A74, 0xD77B, 0xF631,
+ 0x4171, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0x7A6D, 0xAE4A, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0xD77D, 0, 0, 0x683A, 0, 0x683B, 0, 0x3259,
+ 0xD77E, 0, 0, 0x322E, 0x6838, 0x7A75, 0, 0xF633,
+};
static const unsigned short utf8_to_euc_E88E[] = {
0xD823, 0, 0xD824, 0, 0xD825, 0x682E, 0xD826, 0x6836,
0, 0x683D, 0x6837, 0, 0, 0xD827, 0x6835, 0,
@@ -5139,6 +9637,16 @@ static const unsigned short utf8_to_euc_E88E[] = {
0, 0x4D69, 0, 0, 0, 0x6839, 0, 0,
0, 0, 0, 0, 0, 0x684F, 0xD834, 0xD835,
};
+static const unsigned short utf8_to_euc_E88E_x0213[] = {
+ 0xD823, 0, 0xD824, 0, 0xD825, 0x682E, 0x7A76, 0x6836,
+ 0, 0x683D, 0x6837, 0, 0, 0xF636, 0x6835, 0,
+ 0, 0, 0x7A77, 0x6776, 0xF637, 0xF638, 0x6833, 0,
+ 0x7A78, 0xD82C, 0x682F, 0xF639, 0xD82E, 0xF63A, 0x3450, 0x6831,
+ 0x683C, 0, 0x6832, 0, 0, 0, 0xD830, 0x7A79,
+ 0x683E, 0x7A7A, 0x6830, 0x477C, 0xD833, 0xD84C, 0, 0,
+ 0, 0x4D69, 0, 0, 0, 0x6839, 0, 0,
+ 0, 0, 0, 0, 0, 0x684F, 0xD834, 0x7A7B,
+};
static const unsigned short utf8_to_euc_E88F[] = {
0xD836, 0x6847, 0, 0, 0, 0x3F7B, 0, 0xD837,
0, 0xD838, 0x3546, 0, 0x365D, 0, 0x6842, 0xD839,
@@ -5149,6 +9657,16 @@ static const unsigned short utf8_to_euc_E88F[] = {
0x3856, 0x4929, 0x684B, 0, 0x683F, 0, 0xD841, 0x6848,
0xD842, 0xD843, 0, 0x6852, 0xD844, 0x6843, 0, 0,
};
+static const unsigned short utf8_to_euc_E88F_x0213[] = {
+ 0x7A7C, 0x6847, 0, 0, 0, 0x3F7B, 0, 0x7A7D,
+ 0, 0xF63B, 0x3546, 0, 0x365D, 0, 0x6842, 0x7A7E,
+ 0xF63C, 0x7B21, 0, 0x325B, 0xF63D, 0, 0x3E54, 0,
+ 0x6845, 0, 0, 0, 0x3A5A, 0xF63E, 0, 0x4551,
+ 0x684A, 0x7B22, 0, 0, 0, 0xF63F, 0, 0,
+ 0xD83F, 0x4A6E, 0x7B23, 0x6841, 0, 0, 0, 0x325A,
+ 0x3856, 0x4929, 0x684B, 0, 0x683F, 0, 0xD841, 0x6848,
+ 0xD842, 0xF640, 0, 0x6852, 0xD844, 0x6843, 0, 0,
+};
static const unsigned short utf8_to_euc_E890[] = {
0, 0xD845, 0, 0x6844, 0x463A, 0, 0xD846, 0x6849,
0, 0, 0xD847, 0x6846, 0x4B28, 0x684C, 0x3060, 0xD848,
@@ -5159,6 +9677,16 @@ static const unsigned short utf8_to_euc_E890[] = {
0, 0x337E, 0, 0, 0, 0x6862, 0, 0,
0x6850, 0xD84E, 0, 0, 0x6855, 0x4D6E, 0, 0,
};
+static const unsigned short utf8_to_euc_E890_x0213[] = {
+ 0, 0x7B24, 0, 0x6844, 0x463A, 0, 0x7B25, 0x6849,
+ 0, 0, 0x7B26, 0x6846, 0x4B28, 0x684C, 0x3060, 0xF641,
+ 0, 0xF642, 0, 0x6840, 0, 0xF643, 0, 0xF645,
+ 0, 0xD84B, 0, 0, 0, 0, 0, 0,
+ 0x684E, 0, 0x684D, 0, 0, 0, 0, 0,
+ 0, 0x476B, 0x6854, 0, 0x685F, 0, 0, 0xD84D,
+ 0, 0x337E, 0, 0, 0, 0x6862, 0, 0,
+ 0x6850, 0xF646, 0, 0, 0x6855, 0x4D6E, 0, 0,
+};
static const unsigned short utf8_to_euc_E891[] = {
0, 0, 0, 0, 0, 0xD84F, 0x685E, 0xD850,
0xD851, 0x4D55, 0xD852, 0, 0, 0xD853, 0x4E2A, 0xD854,
@@ -5169,6 +9697,16 @@ static const unsigned short utf8_to_euc_E891[] = {
0xD861, 0x472C, 0, 0xD862, 0xD863, 0x302A, 0xD864, 0x6858,
0xD865, 0x6861, 0x4978, 0, 0xD866, 0xD867, 0, 0,
};
+static const unsigned short utf8_to_euc_E891_x0213[] = {
+ 0, 0, 0, 0, 0, 0xD84F, 0x685E, 0xD850,
+ 0x7B28, 0x4D55, 0xF647, 0, 0, 0xD853, 0x4E2A, 0xF648,
+ 0, 0xF649, 0xF64A, 0, 0, 0, 0xD857, 0x4378,
+ 0xD858, 0xF64B, 0xF64C, 0x336B, 0xF64D, 0, 0, 0x7B29,
+ 0xD85C, 0x4972, 0x6864, 0x4621, 0xD85D, 0xF64F, 0x3031, 0xD85F,
+ 0, 0x685D, 0xD860, 0x6859, 0x4172, 0x6853, 0x685B, 0x6860,
+ 0x7B2A, 0x472C, 0, 0x7B2B, 0xD863, 0x302A, 0xF650, 0x6858,
+ 0xF651, 0x6861, 0x4978, 0, 0xF652, 0xD867, 0, 0,
+};
static const unsigned short utf8_to_euc_E892[] = {
0, 0xD868, 0x685C, 0, 0x6857, 0xD869, 0, 0,
0, 0, 0, 0x3E55, 0, 0, 0, 0,
@@ -5179,6 +9717,16 @@ static const unsigned short utf8_to_euc_E892[] = {
0, 0xD873, 0x3377, 0, 0xD874, 0, 0, 0,
0x3E78, 0x6865, 0xD875, 0x686A, 0x4173, 0xD876, 0xD877, 0x6866,
};
+static const unsigned short utf8_to_euc_E892_x0213[] = {
+ 0, 0xF653, 0x685C, 0, 0x6857, 0x7B2C, 0, 0,
+ 0, 0, 0, 0x3E55, 0, 0, 0, 0,
+ 0x3D2F, 0, 0xD86A, 0xD86B, 0x3C2C, 0xD86C, 0, 0xF656,
+ 0, 0x4C58, 0, 0, 0x4947, 0, 0x7B2D, 0x6867,
+ 0, 0x6870, 0, 0, 0, 0, 0xF657, 0,
+ 0xD86F, 0xD870, 0xD871, 0, 0, 0x685A, 0, 0x7B2E,
+ 0, 0xD873, 0x3377, 0, 0x7B2F, 0, 0, 0,
+ 0x3E78, 0x6865, 0x7B30, 0x686A, 0x4173, 0xD876, 0xF658, 0x6866,
+};
static const unsigned short utf8_to_euc_E893[] = {
0xD878, 0x686D, 0xD879, 0, 0x435F, 0, 0x686E, 0xD87A,
0xD87B, 0x4D56, 0x6863, 0x3338, 0xD87C, 0x6869, 0, 0xD87D,
@@ -5189,6 +9737,16 @@ static const unsigned short utf8_to_euc_E893[] = {
0xD925, 0xD926, 0xD927, 0, 0x6873, 0, 0, 0xD928,
0, 0, 0xD92A, 0xD92B, 0x687A, 0xD92C, 0, 0x6872,
};
+static const unsigned short utf8_to_euc_E893_x0213[] = {
+ 0x7B31, 0x686D, 0x7B32, 0, 0x435F, 0, 0x686E, 0xD87A,
+ 0xD87B, 0x4D56, 0x6863, 0x3338, 0xD87C, 0x6869, 0xF65A, 0xF65B,
+ 0x686C, 0x4C2C, 0, 0xF65C, 0, 0, 0x686F, 0,
+ 0, 0x6868, 0x686B, 0, 0xF655, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0xF65E,
+ 0, 0, 0xF65F, 0, 0x4B29, 0, 0x4F21, 0xF660,
+ 0xF661, 0xF662, 0xD927, 0, 0x6873, 0, 0, 0xD928,
+ 0, 0, 0xF663, 0xD92B, 0x687A, 0xF664, 0, 0x6872,
+};
static const unsigned short utf8_to_euc_E894[] = {
0x3C43, 0, 0xD92D, 0xD92E, 0, 0, 0x6851, 0xD92F,
0, 0, 0, 0, 0xD930, 0, 0xD931, 0,
@@ -5199,6 +9757,16 @@ static const unsigned short utf8_to_euc_E894[] = {
0, 0, 0xD929, 0xD93D, 0xD93E, 0x4222, 0xD93F, 0,
0, 0, 0, 0, 0, 0x4A43, 0, 0xD940,
};
+static const unsigned short utf8_to_euc_E894_x0213[] = {
+ 0x3C43, 0, 0xD92D, 0xD92E, 0, 0, 0x6851, 0xD92F,
+ 0, 0, 0, 0, 0xF665, 0, 0xD931, 0,
+ 0xD932, 0x4A4E, 0, 0x4C22, 0x6879, 0x6878, 0, 0x6874,
+ 0x6875, 0, 0x3136, 0xF666, 0xD933, 0, 0x7B35, 0x6877,
+ 0, 0x6871, 0xD935, 0x7B36, 0xF667, 0xF668, 0x4455, 0xD939,
+ 0, 0, 0xD93A, 0xF669, 0x6876, 0x307E, 0, 0x7B37,
+ 0, 0, 0x7B34, 0xD93D, 0xF66A, 0x4222, 0xD93F, 0,
+ 0, 0, 0, 0, 0, 0x4A43, 0xF66F, 0xD940,
+};
static const unsigned short utf8_to_euc_E895[] = {
0x687B, 0x6921, 0, 0x4859, 0, 0, 0xD941, 0,
0x687E, 0x3E56, 0x3C49, 0x6923, 0, 0, 0x363E, 0xD942,
@@ -5209,6 +9777,16 @@ static const unsigned short utf8_to_euc_E895[] = {
0, 0, 0, 0, 0, 0, 0, 0x6931,
0, 0xD953, 0xD954, 0xD955, 0, 0xD956, 0x6932, 0xD957,
};
+static const unsigned short utf8_to_euc_E895_x0213[] = {
+ 0x687B, 0x6921, 0, 0x4859, 0, 0, 0xD941, 0,
+ 0x687E, 0x3E56, 0x3C49, 0x6923, 0, 0, 0x363E, 0xF66B,
+ 0xD943, 0xF670, 0xD945, 0xF671, 0, 0x6924, 0xD947, 0x4979,
+ 0x687D, 0x7B38, 0x6856, 0, 0xD949, 0xD94A, 0xF672, 0xD94C,
+ 0xD94D, 0xF673, 0xF674, 0x687C, 0x7B39, 0, 0, 0,
+ 0x4F4F, 0x4622, 0x4973, 0xD951, 0, 0x692B, 0, 0xF66C,
+ 0, 0, 0, 0, 0, 0, 0, 0x6931,
+ 0, 0xD953, 0x7B3C, 0xF676, 0, 0xF677, 0x6932, 0xF678,
+};
static const unsigned short utf8_to_euc_E896[] = {
0x6925, 0xD958, 0, 0, 0x4776, 0xD959, 0xD95A, 0x692F,
0x6927, 0xD95B, 0x6929, 0xD95C, 0xD95D, 0, 0, 0xD95E,
@@ -5219,6 +9797,16 @@ static const unsigned short utf8_to_euc_E896[] = {
0xF461, 0, 0, 0, 0xD967, 0, 0xD968, 0xD969,
0xD96A, 0x6937, 0x6935, 0, 0xD96B, 0xD96C, 0xD96D, 0xD96E,
};
+static const unsigned short utf8_to_euc_E896_x0213[] = {
+ 0x6925, 0xF679, 0, 0, 0x4776, 0xD959, 0xF67A, 0x692F,
+ 0x6927, 0xD95B, 0x6929, 0xD95C, 0x7B3D, 0, 0, 0x7B3E,
+ 0x6933, 0x6928, 0, 0xF67B, 0x692C, 0, 0, 0x3172,
+ 0xD960, 0x4665, 0, 0x692D, 0x6930, 0xF67C, 0, 0xF67D,
+ 0xD963, 0, 0x7B3F, 0, 0x6926, 0xD965, 0x4126, 0xD966,
+ 0x692A, 0x3B27, 0x3F45, 0x3730, 0x4C74, 0x7B3B, 0x4C79, 0x3D72,
+ 0x7B40, 0, 0, 0, 0xD967, 0, 0xD968, 0xF723,
+ 0xD96A, 0x6937, 0x6935, 0, 0xF724, 0xD96C, 0xD96D, 0xD96E,
+};
static const unsigned short utf8_to_euc_E897[] = {
0, 0x4F4E, 0xD96F, 0, 0, 0, 0, 0xD970,
0, 0x6934, 0xD971, 0xD972, 0, 0x4D75, 0xD973, 0x6936,
@@ -5229,6 +9817,16 @@ static const unsigned short utf8_to_euc_E897[] = {
0, 0, 0, 0xD97C, 0, 0, 0xD97D, 0x3D73,
0, 0x693D, 0x6942, 0x4174, 0xD97E, 0, 0x6941, 0xDA21,
};
+static const unsigned short utf8_to_euc_E897_x0213[] = {
+ 0, 0x4F4E, 0xD96F, 0, 0, 0, 0, 0xF725,
+ 0, 0x6934, 0xF726, 0x7B41, 0, 0x4D75, 0x7B42, 0x6936,
+ 0x6938, 0, 0, 0, 0, 0x6939, 0, 0,
+ 0xF727, 0xF728, 0xD976, 0, 0x693C, 0x693A, 0, 0xF729,
+ 0xD978, 0xF72A, 0, 0, 0x4623, 0x693B, 0xF72B, 0,
+ 0xD97A, 0x484D, 0x692E, 0, 0, 0x7B43, 0, 0,
+ 0, 0, 0, 0xD97C, 0, 0, 0xF72C, 0x3D73,
+ 0, 0x693D, 0x6942, 0x4174, 0xD97E, 0, 0x6941, 0x7B45,
+};
static const unsigned short utf8_to_euc_E898[] = {
0xDA22, 0, 0x6922, 0, 0xDA23, 0xDA24, 0x6943, 0x4149,
0, 0, 0x693E, 0x6940, 0, 0xDA25, 0xDA26, 0,
@@ -5239,6 +9837,16 @@ static const unsigned short utf8_to_euc_E898[] = {
0x6946, 0, 0, 0, 0, 0, 0xDA31, 0,
0xDA32, 0, 0xDA33, 0, 0xDA34, 0xDA35, 0, 0x6947,
};
+static const unsigned short utf8_to_euc_E898_x0213[] = {
+ 0xF72D, 0, 0x6922, 0, 0x7B46, 0x7B47, 0x6943, 0x4149,
+ 0, 0, 0x693E, 0x6940, 0, 0xDA25, 0xDA26, 0,
+ 0x7B48, 0xF72E, 0x7B44, 0x693F, 0, 0, 0x5D31, 0x5D22,
+ 0x7B4A, 0xDA2B, 0x6945, 0xDA2C, 0, 0, 0xF72F, 0,
+ 0, 0xF730, 0x6944, 0, 0xF731, 0, 0, 0xF732,
+ 0, 0x7B4B, 0, 0, 0, 0x4D76, 0, 0x623C,
+ 0x6946, 0, 0, 0, 0, 0, 0xDA31, 0,
+ 0x7B4C, 0xF734, 0xDA33, 0, 0xF735, 0xDA35, 0, 0x6947,
+};
static const unsigned short utf8_to_euc_E899[] = {
0xDA36, 0xB866, 0xDA37, 0, 0, 0, 0xDA38, 0,
0, 0, 0, 0, 0, 0x6948, 0x3857, 0,
@@ -5249,6 +9857,16 @@ static const unsigned short utf8_to_euc_E899[] = {
0, 0x694D, 0, 0, 0, 0xDA48, 0xDA49, 0xDA4A,
0, 0x467A, 0xDA4B, 0x303A, 0, 0, 0, 0,
};
+static const unsigned short utf8_to_euc_E899_x0213[] = {
+ 0xF737, 0x2F68, 0xDA37, 0, 0, 0, 0xDA38, 0,
+ 0, 0, 0, 0, 0, 0x6948, 0x3857, 0,
+ 0x3554, 0, 0xDA39, 0xF739, 0x694A, 0x515D, 0xF73A, 0x7B4D,
+ 0xDA3D, 0xDA3E, 0x3575, 0x7B4E, 0x4E3A, 0xDA3F, 0x3673, 0x694B,
+ 0xDA40, 0xDA41, 0x7B50, 0xDA43, 0xDA44, 0, 0, 0x694C,
+ 0, 0xDA45, 0, 0x436E, 0x7B52, 0, 0, 0xF73B,
+ 0, 0x694D, 0, 0, 0, 0x7B53, 0xDA49, 0xF73C,
+ 0, 0x467A, 0xF73D, 0x303A, 0, 0, 0, 0,
+};
static const unsigned short utf8_to_euc_E89A[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0xDA6D, 0, 0x3263, 0x6952, 0x6953, 0xDA4C, 0, 0,
@@ -5259,6 +9877,16 @@ static const unsigned short utf8_to_euc_E89A[] = {
0x6958, 0xDA57, 0, 0xDA58, 0xDA59, 0xDA5A, 0x6954, 0xDA5B,
0xDA5C, 0xDA5D, 0, 0, 0, 0, 0, 0xDA5E,
};
+static const unsigned short utf8_to_euc_E89A_x0213[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0xF73E,
+ 0xDA6D, 0xF73F, 0x3263, 0x6952, 0x6953, 0xF740, 0, 0,
+ 0, 0xF741, 0, 0x694E, 0, 0x3B3D, 0xDA4E, 0,
+ 0x7B54, 0, 0xDA50, 0, 0xF742, 0xF743, 0, 0,
+ 0, 0xDA52, 0, 0x694F, 0x4742, 0, 0xDA53, 0xDA54,
+ 0xF744, 0x6950, 0x6951, 0x695B, 0, 0xDA56, 0, 0x6955,
+ 0x6958, 0xF746, 0, 0xF747, 0xDA59, 0xDA5A, 0x6954, 0xDA5B,
+ 0x7B55, 0xDA5D, 0, 0, 0, 0, 0, 0xDA5E,
+};
static const unsigned short utf8_to_euc_E89B[] = {
0xDA5F, 0xDA60, 0, 0xDA61, 0x6956, 0xDA62, 0x6957, 0x3C58,
0, 0x6959, 0, 0x4341, 0, 0x3756, 0x3342, 0,
@@ -5269,6 +9897,16 @@ static const unsigned short utf8_to_euc_E89B[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0x427D, 0x696C, 0xDA6E, 0x6968, 0xDA6F, 0xDA70, 0x326B, 0,
};
+static const unsigned short utf8_to_euc_E89B_x0213[] = {
+ 0xDA5F, 0xF748, 0, 0xF749, 0x6956, 0xDA62, 0x6957, 0x3C58,
+ 0, 0x6959, 0, 0x4341, 0, 0x3756, 0x3342, 0,
+ 0, 0xF74A, 0xDA64, 0, 0x695C, 0xF74B, 0, 0xF74C,
+ 0, 0x333F, 0xDA67, 0x6961, 0xDA68, 0, 0x695D, 0x6960,
+ 0xDA69, 0, 0, 0xF74D, 0x483A, 0xDA6B, 0xF74E, 0xDA6C,
+ 0, 0x695E, 0, 0, 0x695F, 0x4948, 0x485A, 0x6962,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0x427D, 0x696C, 0x7B56, 0x6968, 0x7B57, 0x7B58, 0x326B, 0,
+};
static const unsigned short utf8_to_euc_E89C[] = {
0x6966, 0, 0x4B2A, 0x6967, 0xDA71, 0xDA72, 0x6964, 0xDA73,
0x6965, 0x696A, 0x696D, 0xDA74, 0, 0x696B, 0xDA75, 0xDA76,
@@ -5279,6 +9917,16 @@ static const unsigned short utf8_to_euc_E89C[] = {
0, 0xDB24, 0xDB25, 0, 0x696E, 0, 0, 0x6970,
0, 0xDB26, 0xDB27, 0x6971, 0xDB28, 0xDB29, 0xDB2A, 0x696F,
};
+static const unsigned short utf8_to_euc_E89C_x0213[] = {
+ 0x6966, 0, 0x4B2A, 0x6967, 0xDA71, 0xF750, 0x6964, 0xF751,
+ 0x6965, 0x696A, 0x696D, 0x7B59, 0, 0x696B, 0xF752, 0xDA76,
+ 0xF753, 0x6969, 0x6963, 0xF754, 0xDA79, 0, 0, 0,
+ 0x4358, 0xF755, 0x6974, 0, 0x4C2A, 0, 0xDA7B, 0xF756,
+ 0, 0xF757, 0, 0xF758, 0, 0x6972, 0, 0,
+ 0xDB21, 0x6973, 0, 0, 0, 0, 0xDB22, 0xDB23,
+ 0, 0xF759, 0xDB25, 0, 0x696E, 0, 0, 0x6970,
+ 0, 0xDB26, 0xF75A, 0x6971, 0xDB28, 0xDB29, 0xF75B, 0x696F,
+};
static const unsigned short utf8_to_euc_E89D[] = {
0xDB2B, 0, 0, 0xDB2C, 0, 0xDB2D, 0, 0,
0, 0x4066, 0, 0x4F39, 0x6978, 0xDB2E, 0x6979, 0,
@@ -5289,6 +9937,16 @@ static const unsigned short utf8_to_euc_E89D[] = {
0, 0xDB35, 0xDB36, 0, 0x697A, 0, 0x4433, 0,
0x6977, 0, 0, 0xDB37, 0, 0, 0, 0x4768,
};
+static const unsigned short utf8_to_euc_E89D_x0213[] = {
+ 0xF75C, 0, 0, 0xF75D, 0, 0xDB2D, 0, 0,
+ 0, 0x4066, 0, 0x4F39, 0x6978, 0xDB2E, 0x6979, 0,
+ 0, 0xF75E, 0, 0x6A21, 0, 0x3F2A, 0, 0x697B,
+ 0xF75F, 0x697E, 0, 0, 0, 0xDB30, 0, 0x6976,
+ 0x6975, 0xDB31, 0, 0x6A22, 0xF760, 0xF761, 0x325C, 0,
+ 0x697C, 0, 0x6A23, 0, 0, 0, 0x697D, 0xDB34,
+ 0, 0x7B5A, 0xF762, 0, 0x697A, 0, 0x4433, 0,
+ 0x6977, 0, 0, 0xDB37, 0xF763, 0, 0, 0x4768,
+};
static const unsigned short utf8_to_euc_E89E[] = {
0, 0, 0x6A27, 0xDB38, 0xDB39, 0xDB3A, 0xDB3B, 0xDB3C,
0xDB3D, 0xDB3E, 0, 0xDB3F, 0xDB40, 0x4D3B, 0, 0,
@@ -5299,6 +9957,16 @@ static const unsigned short utf8_to_euc_E89E[] = {
0, 0xDB4E, 0, 0x6A30, 0, 0xDB4F, 0, 0,
0, 0, 0x4D66, 0x6A33, 0, 0x6A2A, 0xDB50, 0xDB51,
};
+static const unsigned short utf8_to_euc_E89E_x0213[] = {
+ 0, 0, 0x6A27, 0xDB38, 0xDB39, 0xDB3A, 0xDB3B, 0x7B5B,
+ 0x7B5C, 0xF767, 0, 0xF768, 0xDB40, 0x4D3B, 0, 0,
+ 0xDB41, 0, 0, 0xF769, 0, 0xDB43, 0, 0xDB44,
+ 0xDB45, 0xDB46, 0, 0, 0, 0, 0xDB47, 0x6A26,
+ 0xF76A, 0, 0x6A25, 0xDB49, 0, 0, 0, 0xF766,
+ 0, 0, 0, 0x6A2E, 0x7B5D, 0x7B5E, 0xDB4D, 0x6A28,
+ 0, 0xDB4E, 0, 0x6A30, 0, 0x7B5F, 0, 0,
+ 0, 0, 0x4D66, 0x6A33, 0, 0x6A2A, 0xF76D, 0xDB51,
+};
static const unsigned short utf8_to_euc_E89F[] = {
0x6A2B, 0xDB52, 0, 0, 0x6A2F, 0, 0x6A32, 0x6A31,
0xDB53, 0xDB54, 0xDB55, 0x6A29, 0, 0, 0xDB56, 0,
@@ -5309,6 +9977,16 @@ static const unsigned short utf8_to_euc_E89F[] = {
0, 0xDB63, 0x6A35, 0xDB64, 0, 0, 0x6A3A, 0x6A3B,
0xDB65, 0x332A, 0xDB66, 0x3542, 0, 0, 0x6A39, 0xDB67,
};
+static const unsigned short utf8_to_euc_E89F_x0213[] = {
+ 0x6A2B, 0xF76F, 0, 0, 0x6A2F, 0, 0x6A32, 0x6A31,
+ 0xDB53, 0xDB54, 0xDB55, 0x6A29, 0, 0, 0xF770, 0,
+ 0x6A2C, 0, 0x6A3D, 0, 0, 0xDB57, 0x7B61, 0,
+ 0, 0xDB59, 0xDB5A, 0, 0xDB5B, 0, 0, 0xF772,
+ 0x6A36, 0, 0xDB5D, 0xF774, 0xDB5F, 0xF775, 0xF776, 0,
+ 0, 0, 0xF777, 0xF778, 0x7B62, 0xF779, 0, 0x6A34,
+ 0, 0xDB63, 0x6A35, 0xDB64, 0, 0xF771, 0x6A3A, 0x6A3B,
+ 0xDB65, 0x332A, 0xDB66, 0x3542, 0, 0, 0x6A39, 0xDB67,
+};
static const unsigned short utf8_to_euc_E8A0[] = {
0, 0xDB68, 0, 0xDB69, 0, 0x6A24, 0xDB6A, 0xF464,
0, 0xDB6B, 0xDB6C, 0xDB6D, 0, 0x6A38, 0x6A3C, 0x6A37,
@@ -5319,6 +9997,16 @@ static const unsigned short utf8_to_euc_E8A0[] = {
0xDB7C, 0x6A43, 0xDB7D, 0, 0, 0xDB7E, 0x6A44, 0,
0, 0x6A45, 0xDC21, 0x6A47, 0xDC22, 0, 0, 0,
};
+static const unsigned short utf8_to_euc_E8A0_x0213[] = {
+ 0, 0xF77A, 0, 0xF77B, 0, 0x6A24, 0x7B63, 0xF464,
+ 0, 0xDB6B, 0x7B64, 0xF77C, 0, 0x6A38, 0x6A3C, 0x6A37,
+ 0x7B65, 0x6A3E, 0xDB70, 0xF77D, 0x7B66, 0x6A40, 0x6A3F, 0,
+ 0xDB73, 0xDB6F, 0xDB74, 0xDB75, 0xDB76, 0, 0xDB77, 0x7B67,
+ 0, 0x6A42, 0x6A41, 0x695A, 0, 0, 0, 0x6A46,
+ 0xF77E, 0, 0, 0, 0, 0xDB7A, 0xF821, 0,
+ 0xDB7C, 0x6A43, 0xF822, 0, 0, 0xDB7E, 0x6A44, 0,
+ 0, 0x6A45, 0xDC21, 0x6A47, 0xF823, 0, 0, 0,
+};
static const unsigned short utf8_to_euc_E8A1[] = {
0x376C, 0xDC23, 0x6A49, 0xDC24, 0x6A48, 0xDC25, 0x3D30, 0,
0xDC26, 0xDC27, 0xDC28, 0xDC29, 0x3954, 0x5E27, 0xDC2A, 0,
@@ -5329,6 +10017,16 @@ static const unsigned short utf8_to_euc_E8A1[] = {
0x3F6A, 0xDC35, 0x6A55, 0, 0, 0x6A52, 0, 0x436F,
0, 0xDC36, 0, 0xDC37, 0, 0x6A53, 0x6A50, 0x365E,
};
+static const unsigned short utf8_to_euc_E8A1_x0213[] = {
+ 0x376C, 0xDC23, 0x6A49, 0xDC24, 0x6A48, 0xDC25, 0x3D30, 0,
+ 0xDC26, 0xDC27, 0xF825, 0xDC29, 0x3954, 0x5E27, 0xDC2A, 0,
+ 0, 0xDC2B, 0x6A4A, 0x3D51, 0, 0xDC2C, 0xDC2D, 0x3339,
+ 0xF826, 0x6A4B, 0xDC2F, 0x3152, 0xDC30, 0x3E57, 0x6A4C, 0xF827,
+ 0xDC32, 0x3955, 0x6A4D, 0x3061, 0xF828, 0, 0, 0,
+ 0x493D, 0xF82B, 0, 0x6A4E, 0, 0, 0, 0xF82D,
+ 0x3F6A, 0xDC35, 0x6A55, 0, 0, 0x6A52, 0, 0x436F,
+ 0, 0xDC36, 0, 0xDC37, 0, 0x6A53, 0x6A50, 0x365E,
+};
static const unsigned short utf8_to_euc_E8A2[] = {
0xDC38, 0x6A4F, 0x6A56, 0, 0, 0, 0, 0,
0x3736, 0, 0, 0x425E, 0, 0x6A5C, 0, 0,
@@ -5339,6 +10037,16 @@ static const unsigned short utf8_to_euc_E8A2[] = {
0x6A5E, 0x6A60, 0, 0, 0x3853, 0x6A54, 0, 0x3041,
0, 0, 0xDC41, 0, 0, 0xDC42, 0xDC43, 0x6A5F,
};
+static const unsigned short utf8_to_euc_E8A2_x0213[] = {
+ 0xDC38, 0x6A4F, 0x6A56, 0, 0, 0, 0, 0,
+ 0x3736, 0, 0, 0x425E, 0, 0x6A5C, 0, 0,
+ 0, 0, 0x6A58, 0, 0, 0, 0x4235, 0x6A57,
+ 0x7B68, 0x6A5A, 0xDC3A, 0xDC3B, 0xDC3C, 0, 0x6A51, 0xDC3D,
+ 0xF82E, 0, 0x6A5B, 0, 0x6A5D, 0, 0, 0,
+ 0xDC3F, 0, 0x7B69, 0x486F, 0, 0, 0x6A59, 0,
+ 0x6A5E, 0x6A60, 0, 0, 0x3853, 0x6A54, 0, 0x3041,
+ 0, 0, 0xDC41, 0, 0xF82F, 0xF830, 0xF831, 0x6A5F,
+};
static const unsigned short utf8_to_euc_E8A3[] = {
0xDC44, 0x3A5B, 0x4E76, 0x6A61, 0x6A62, 0x4175, 0, 0,
0, 0, 0xDC45, 0xDC46, 0xDC47, 0xDC48, 0xDC49, 0x4E22,
@@ -5349,6 +10057,16 @@ static const unsigned short utf8_to_euc_E8A3[] = {
0xDC51, 0xDC52, 0x6A6C, 0x3E58, 0x6A6A, 0xDC53, 0, 0xDC54,
0x4D67, 0x6A67, 0, 0, 0x6A69, 0x403D, 0x3F7E, 0,
};
+static const unsigned short utf8_to_euc_E8A3_x0213[] = {
+ 0xF832, 0x3A5B, 0x4E76, 0x6A61, 0x6A62, 0x4175, 0, 0,
+ 0, 0, 0x7B6A, 0xDC46, 0xDC47, 0xDC48, 0x7B6B, 0x4E22,
+ 0, 0xF835, 0xF833, 0xF836, 0x6A63, 0x4D35, 0, 0,
+ 0x6A64, 0x6A65, 0, 0xF837, 0x4A64, 0x6A66, 0xDC4E, 0x3A40,
+ 0, 0x4E23, 0, 0, 0, 0, 0, 0xDC4F,
+ 0x6A6B, 0, 0, 0, 0, 0, 0, 0xDC50,
+ 0xF838, 0xF839, 0x6A6C, 0x3E58, 0x6A6A, 0x7B6D, 0, 0xDC54,
+ 0x4D67, 0x6A67, 0, 0, 0x6A69, 0x403D, 0x3F7E, 0,
+};
static const unsigned short utf8_to_euc_E8A4[] = {
0, 0xDC55, 0x6A68, 0, 0x6A6D, 0, 0xDC56, 0x4A23,
0, 0, 0x6A6F, 0, 0x6A6E, 0xDC57, 0xDC58, 0xDC59,
@@ -5359,6 +10077,16 @@ static const unsigned short utf8_to_euc_E8A4[] = {
0xDC64, 0xDC65, 0xDC66, 0, 0, 0xDC67, 0x6A79, 0,
0x6A7A, 0xDC68, 0xDC69, 0x6A78, 0, 0, 0xDC6A, 0,
};
+static const unsigned short utf8_to_euc_E8A4_x0213[] = {
+ 0, 0xF83B, 0x6A68, 0, 0x6A6D, 0, 0xDC56, 0x4A23,
+ 0, 0, 0x6A6F, 0, 0x6A6E, 0xDC57, 0xDC58, 0xDC59,
+ 0x336C, 0, 0x4B2B, 0x6A70, 0, 0xDC5A, 0xDC5B, 0,
+ 0x7B70, 0x7B71, 0x7B72, 0, 0x7B6E, 0x6A7C, 0x6A72, 0,
+ 0xDC60, 0, 0, 0, 0, 0x6A73, 0xDC61, 0x7B73,
+ 0xDC63, 0, 0x6A74, 0x6A75, 0, 0, 0, 0,
+ 0x7B74, 0xDC65, 0x7B75, 0, 0, 0xDC67, 0x6A79, 0xF83D,
+ 0x6A7A, 0x7B76, 0xDC69, 0x6A78, 0, 0, 0xDC6A, 0,
+};
static const unsigned short utf8_to_euc_E8A5[] = {
0xDC6B, 0x6A76, 0xDC6C, 0x6A71, 0x6A77, 0xDC6D, 0xDC6E, 0,
0, 0xDC6F, 0, 0, 0x6A7B, 0x7037, 0, 0xDC70,
@@ -5369,6 +10097,16 @@ static const unsigned short utf8_to_euc_E8A5[] = {
0xDC7B, 0, 0x3D31, 0xDC7C, 0x6B26, 0xDC7D, 0, 0x6B27,
0, 0, 0xDC7E, 0xDD21, 0xDD22, 0xDD23, 0x6B28, 0x403E,
};
+static const unsigned short utf8_to_euc_E8A5_x0213[] = {
+ 0x7B77, 0x6A76, 0xF83F, 0x6A71, 0x6A77, 0xF840, 0xDC6E, 0,
+ 0, 0xF841, 0, 0, 0x6A7B, 0x7037, 0, 0xDC70,
+ 0, 0, 0xDC71, 0, 0, 0, 0x3228, 0xDC72,
+ 0, 0, 0xDC73, 0xDC74, 0xDC75, 0, 0x6A7E, 0x365F,
+ 0x6A7D, 0xDC76, 0xF844, 0xDC78, 0x6B22, 0, 0x6B21, 0,
+ 0, 0, 0x6B24, 0xDC79, 0, 0x6B23, 0xDC7A, 0x6B25,
+ 0xDC7B, 0, 0x3D31, 0xDC7C, 0x6B26, 0xDC7D, 0, 0x6B27,
+ 0, 0, 0xDC7E, 0xDD21, 0xDD22, 0xDD23, 0x6B28, 0x403E,
+};
static const unsigned short utf8_to_euc_E8A6[] = {
0, 0x4D57, 0, 0x6B29, 0, 0, 0x4A24, 0x4746,
0x6B2A, 0xDD24, 0x6B2B, 0x382B, 0, 0xDD25, 0, 0x352C,
@@ -5379,6 +10117,16 @@ static const unsigned short utf8_to_euc_E8A6[] = {
0xDD2E, 0, 0x6B33, 0x3451, 0xDD2F, 0xDD30, 0xDD31, 0xDD32,
0, 0, 0x6B34, 0, 0xDD33, 0x6B35, 0, 0x6B36,
};
+static const unsigned short utf8_to_euc_E8A6_x0213[] = {
+ 0xF845, 0x4D57, 0, 0x6B29, 0, 0, 0x4A24, 0x4746,
+ 0x6B2A, 0xF846, 0x6B2B, 0x382B, 0, 0xDD25, 0, 0x352C,
+ 0xF847, 0, 0, 0x6B2C, 0x7B78, 0xDD28, 0x3B6B, 0x4741,
+ 0x6B2D, 0, 0x3350, 0xDD29, 0xDD2A, 0, 0, 0xF848,
+ 0xDD2C, 0x6B2E, 0, 0, 0, 0xDD2D, 0x6B30, 0x4D77,
+ 0, 0x6B2F, 0x3F46, 0, 0x6B31, 0, 0, 0x6B32,
+ 0xF849, 0, 0x6B33, 0x3451, 0xDD2F, 0xDD30, 0xDD31, 0xF84A,
+ 0, 0, 0x6B34, 0, 0xDD33, 0x6B35, 0, 0x6B36,
+};
static const unsigned short utf8_to_euc_E8A7[] = {
0x6B37, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
@@ -5389,6 +10137,16 @@ static const unsigned short utf8_to_euc_E8A7[] = {
0, 0xDD3D, 0, 0xDD3E, 0x6B3C, 0, 0xDD3F, 0,
0x6B3D, 0xDD40, 0, 0, 0, 0xDD41, 0, 0xDD42,
};
+static const unsigned short utf8_to_euc_E8A7_x0213[] = {
+ 0x6B37, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0x3351, 0, 0x7B7A, 0xDD35, 0xF84B, 0xDD37,
+ 0xF84C, 0, 0x6B38, 0, 0x6B39, 0x6B3A, 0, 0,
+ 0, 0, 0, 0x3272, 0, 0x7B7B, 0x3F28, 0x6B3B,
+ 0, 0xDD3A, 0, 0xF84D, 0, 0xDD3C, 0, 0,
+ 0, 0xF84F, 0, 0xF850, 0x6B3C, 0, 0x7B7C, 0,
+ 0x6B3D, 0xDD40, 0, 0, 0, 0xF851, 0, 0xF852,
+};
static const unsigned short utf8_to_euc_E8A8[] = {
0x3840, 0, 0x447B, 0x6B3E, 0xDD43, 0xDD44, 0, 0xDD45,
0x3757, 0, 0x3F56, 0, 0x6B41, 0, 0x4624, 0xDD46,
@@ -5399,6 +10157,16 @@ static const unsigned short utf8_to_euc_E8A8[] = {
0, 0x3576, 0, 0x4C75, 0x414A, 0xDD53, 0x6B45, 0xDD54,
0, 0, 0x3F47, 0x4370, 0x3E5A, 0xDD55, 0xDD56, 0,
};
+static const unsigned short utf8_to_euc_E8A8_x0213[] = {
+ 0x3840, 0, 0x447B, 0x6B3E, 0xDD43, 0xDD44, 0, 0xDD45,
+ 0x3757, 0, 0x3F56, 0, 0x6B41, 0, 0x4624, 0xDD46,
+ 0x6B40, 0xF854, 0x7B7D, 0x3731, 0xF855, 0x7B7E, 0x6B3F, 0x4277,
+ 0x352D, 0, 0, 0x6B42, 0, 0x6B43, 0xDD4B, 0x3E59,
+ 0xDD4C, 0xF857, 0x7C21, 0x376D, 0xDD4E, 0x6B44, 0xDD4F, 0,
+ 0, 0, 0x4B2C, 0xDD50, 0xDD51, 0x405F, 0, 0xDD52,
+ 0, 0x3576, 0, 0x4C75, 0x414A, 0xF858, 0x6B45, 0x7C22,
+ 0, 0, 0x3F47, 0x4370, 0x3E5A, 0xDD55, 0xF859, 0,
+};
static const unsigned short utf8_to_euc_E8A9[] = {
0xDD57, 0x6B46, 0, 0xDD58, 0, 0xDD59, 0x6B49, 0xDD5A,
0x6B4A, 0xDD5B, 0, 0, 0, 0xDD5C, 0xDD5D, 0,
@@ -5409,6 +10177,16 @@ static const unsigned short utf8_to_euc_E8A9[] = {
0x354D, 0x4F43, 0x333A, 0x3E5C, 0, 0xDD67, 0xDD68, 0xDD69,
0, 0xDD6A, 0xDD6B, 0xDD6C, 0x6B4B, 0, 0xDD6D, 0xDD6E,
};
+static const unsigned short utf8_to_euc_E8A9_x0213[] = {
+ 0xDD57, 0x6B46, 0, 0xDD58, 0, 0xF85A, 0x6B49, 0x7C23,
+ 0x6B4A, 0xDD5B, 0, 0, 0, 0xF85B, 0x7C24, 0,
+ 0x3A3E, 0x4242, 0x6B48, 0xDD5E, 0x3E5B, 0x493E, 0xDD5F, 0xDD60,
+ 0xF85C, 0, 0, 0x6B47, 0xDD62, 0x7C25, 0x3B6C, 0,
+ 0x3153, 0x7C26, 0x6B4E, 0x3758, 0, 0xDD65, 0x3B6E, 0xDD66,
+ 0, 0x3B6D, 0, 0x4F4D, 0x6B4D, 0x6B4C, 0x4127, 0,
+ 0x354D, 0x4F43, 0x333A, 0x3E5C, 0, 0x7C27, 0xDD68, 0xDD69,
+ 0, 0x7C28, 0xDD6B, 0xDD6C, 0x6B4B, 0, 0xDD6D, 0xDD6E,
+};
static const unsigned short utf8_to_euc_E8AA[] = {
0xDD6F, 0, 0x6B50, 0xDD70, 0x6B51, 0x6B4F, 0xDD71, 0x3858,
0, 0x4D40, 0, 0xDD72, 0x3B6F, 0x4727, 0, 0xDD73,
@@ -5419,6 +10197,16 @@ static const unsigned short utf8_to_euc_E8AA[] = {
0x432F, 0, 0x325D, 0xDD7E, 0, 0, 0xDE21, 0xDE22,
0, 0x4870, 0, 0xDE23, 0x3543, 0, 0xDE24, 0x4434,
};
+static const unsigned short utf8_to_euc_E8AA_x0213[] = {
+ 0xDD6F, 0, 0x6B50, 0xDD70, 0x6B51, 0x6B4F, 0xDD71, 0x3858,
+ 0, 0x4D40, 0, 0xDD72, 0x3B6F, 0x4727, 0, 0xDD73,
+ 0xF85E, 0x6B54, 0xDD75, 0x4040, 0, 0x4342, 0xDD76, 0xDD77,
+ 0x4D36, 0xDD78, 0x6B57, 0, 0, 0, 0x386C, 0xDD79,
+ 0x403F, 0x6B53, 0, 0x6B58, 0x386D, 0x6B55, 0x6B56, 0x7C29,
+ 0x6B52, 0xDD7B, 0, 0, 0x4062, 0x4649, 0xF85D, 0xDD7D,
+ 0x432F, 0, 0x325D, 0xDD7E, 0, 0, 0xDE21, 0xF85F,
+ 0, 0x4870, 0, 0xDE23, 0x3543, 0, 0xF860, 0x4434,
+};
static const unsigned short utf8_to_euc_E8AB[] = {
0, 0, 0x6B5B, 0xDE25, 0x6B59, 0, 0xDE26, 0x434C,
0xDE27, 0xDE28, 0xDE29, 0x4041, 0x3452, 0x6B5A, 0, 0x3F5B,
@@ -5429,6 +10217,16 @@ static const unsigned short utf8_to_euc_E8AB[] = {
0xDE32, 0x6B61, 0, 0x6B5E, 0xDE33, 0xDE34, 0xDE35, 0x6B65,
0x3D74, 0, 0x3841, 0, 0xDE36, 0, 0x427A, 0xDE37,
};
+static const unsigned short utf8_to_euc_E8AB_x0213[] = {
+ 0, 0, 0x6B5B, 0xDE25, 0x6B59, 0, 0xDE26, 0x434C,
+ 0xDE27, 0xDE28, 0xDE29, 0x4041, 0x3452, 0x6B5A, 0, 0x3F5B,
+ 0x7C2A, 0xDE2A, 0x4E4A, 0xDE2B, 0xDE2C, 0xDE2D, 0x4F40, 0xF861,
+ 0, 0, 0x6B5C, 0x6B67, 0x4435, 0xDE2F, 0x6B66, 0x7C2B,
+ 0x6B63, 0x6B6B, 0x6B64, 0, 0x6B60, 0, 0x447C, 0x6B5F,
+ 0, 0, 0, 0x6B5D, 0xDE31, 0x4D21, 0x3B70, 0,
+ 0xDE32, 0x6B61, 0, 0x6B5E, 0x7C2C, 0xDE34, 0x7C2D, 0x6B65,
+ 0x3D74, 0, 0x3841, 0, 0xF862, 0, 0x427A, 0xDE37,
+};
static const unsigned short utf8_to_euc_E8AC[] = {
0x4B45, 0x315A, 0x3062, 0, 0x4625, 0xDE38, 0xDE39, 0x6B69,
0, 0, 0xDE3F, 0xDE3A, 0x6B68, 0, 0x4666, 0,
@@ -5439,6 +10237,16 @@ static const unsigned short utf8_to_euc_E8AC[] = {
0xDE41, 0, 0, 0x6B70, 0, 0, 0, 0xDE42,
0, 0x3660, 0, 0, 0xDE43, 0, 0x6B74, 0,
};
+static const unsigned short utf8_to_euc_E8AC_x0213[] = {
+ 0x4B45, 0x315A, 0x3062, 0, 0x4625, 0xF865, 0xDE39, 0x6B69,
+ 0, 0, 0xF864, 0xDE3A, 0x6B68, 0xF866, 0x4666, 0,
+ 0x6B6D, 0xDE3B, 0, 0, 0x6B62, 0, 0x6B6C, 0x6B6E,
+ 0, 0x382C, 0x6B6A, 0x3956, 0xF867, 0x3C55, 0xDE3D, 0xF868,
+ 0x6B6F, 0x4D58, 0, 0, 0, 0, 0x6B72, 0,
+ 0x6B75, 0, 0, 0x6B73, 0x4935, 0xF869, 0, 0,
+ 0xDE41, 0, 0, 0x6B70, 0, 0, 0, 0xDE42,
+ 0, 0x3660, 0, 0, 0xDE43, 0, 0x6B74, 0,
+};
static const unsigned short utf8_to_euc_E8AD[] = {
0, 0x6B76, 0xDE44, 0xDE45, 0xDE46, 0xDE47, 0xDE48, 0,
0xDE49, 0x6B7A, 0, 0, 0x6B77, 0xDE4E, 0x6B79, 0x6B78,
@@ -5449,6 +10257,16 @@ static const unsigned short utf8_to_euc_E8AD[] = {
0x3544, 0x6641, 0x3E79, 0, 0x6C24, 0, 0xDE52, 0x386E,
0xDE53, 0xDE54, 0, 0, 0xDE55, 0x6C25, 0xDE56, 0xF466,
};
+static const unsigned short utf8_to_euc_E8AD_x0213[] = {
+ 0, 0x6B76, 0xDE44, 0xF86A, 0xDE46, 0xDE47, 0x7C31, 0,
+ 0xDE49, 0x6B7A, 0, 0, 0x6B77, 0xDE4E, 0x6B79, 0x6B78,
+ 0, 0xF86C, 0xDE4A, 0xDE4B, 0x7C32, 0, 0x6B7B, 0,
+ 0x3C31, 0x7C33, 0x6B7D, 0x6B7C, 0x4968, 0, 0xF86D, 0x6C21,
+ 0, 0, 0, 0xDE50, 0, 0, 0x3759, 0,
+ 0, 0x7C34, 0, 0x6B7E, 0x6C22, 0xDE51, 0, 0x6C23,
+ 0x3544, 0x6641, 0x3E79, 0, 0x6C24, 0, 0xF86E, 0x386E,
+ 0xDE53, 0xDE54, 0, 0, 0xDE55, 0x6C25, 0xDE56, 0xF86F,
+};
static const unsigned short utf8_to_euc_E8AE[] = {
0x6C26, 0xDE57, 0, 0x3B3E, 0xDE58, 0xDE59, 0, 0,
0, 0, 0x5A4E, 0xDE5A, 0x6C27, 0xDE5B, 0x6C28, 0xDE5C,
@@ -5459,6 +10277,16 @@ static const unsigned short utf8_to_euc_E8AE[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
};
+static const unsigned short utf8_to_euc_E8AE_x0213[] = {
+ 0x6C26, 0xF870, 0, 0x3B3E, 0xDE58, 0xDE59, 0, 0,
+ 0, 0, 0x5A4E, 0xF871, 0x6C27, 0xDE5B, 0x6C28, 0xDE5C,
+ 0x3D32, 0, 0x6C29, 0x6C2A, 0xF872, 0xF873, 0x6C2B, 0,
+ 0, 0x6C2C, 0x6C2D, 0, 0xF874, 0x7C35, 0xF875, 0xDE61,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+};
static const unsigned short utf8_to_euc_E8B0[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
@@ -5469,6 +10297,16 @@ static const unsigned short utf8_to_euc_E8B0[] = {
0, 0, 0, 0, 0, 0, 0, 0x432B,
0xDE62, 0xDE63, 0x6C2E, 0, 0, 0xDE64, 0xDE65, 0x6C30,
};
+static const unsigned short utf8_to_euc_E8B0_x0213[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0x432B,
+ 0xDE62, 0xF876, 0x6C2E, 0, 0, 0xF878, 0xDE65, 0x6C30,
+};
static const unsigned short utf8_to_euc_E8B1[] = {
0, 0x6C2F, 0, 0, 0, 0xDE66, 0x4626, 0xDE67,
0x6C31, 0xDE68, 0x4B2D, 0xDE69, 0x6C32, 0, 0x6C33, 0xDE6A,
@@ -5479,6 +10317,16 @@ static const unsigned short utf8_to_euc_E8B1[] = {
0, 0, 0, 0xDE79, 0, 0xDE7A, 0xDE7B, 0,
0x6C38, 0x493F, 0x6C39, 0xDE7C, 0x6C41, 0, 0xDE7D, 0,
};
+static const unsigned short utf8_to_euc_E8B1_x0213[] = {
+ 0, 0x6C2F, 0, 0, 0, 0xF87B, 0x4626, 0xF87C,
+ 0x6C31, 0x7C36, 0x4B2D, 0xDE69, 0x6C32, 0, 0x6C33, 0xF87D,
+ 0x6C34, 0xDE6B, 0, 0xDE6C, 0xF87E, 0x6C35, 0, 0xF921,
+ 0xDE6F, 0xDE72, 0x465A, 0xDE70, 0, 0xDE71, 0, 0,
+ 0, 0x3E5D, 0x6C36, 0xDE73, 0xDE74, 0, 0xDE75, 0,
+ 0x7C37, 0xF922, 0x396B, 0x502E, 0x6C37, 0xF923, 0, 0,
+ 0, 0, 0, 0xF924, 0, 0xDE7A, 0xDE7B, 0,
+ 0x6C38, 0x493F, 0x6C39, 0xDE7C, 0x6C41, 0, 0xDE7D, 0,
+};
static const unsigned short utf8_to_euc_E8B2[] = {
0, 0, 0x6C3A, 0, 0, 0x6C3C, 0xDE7E, 0xDF21,
0, 0x6C3B, 0x6C3D, 0xDF22, 0x4B46, 0x6C3E, 0x6C3F, 0,
@@ -5489,6 +10337,16 @@ static const unsigned short utf8_to_euc_E8B2[] = {
0x4C63, 0, 0x6C47, 0x6C48, 0x352E, 0, 0x6C4A, 0x4763,
0x425F, 0xDF2A, 0xDF2B, 0x4871, 0x453D, 0x6C46, 0, 0x4B47,
};
+static const unsigned short utf8_to_euc_E8B2_x0213[] = {
+ 0, 0, 0x6C3A, 0, 0, 0x6C3C, 0xDE7E, 0xDF21,
+ 0, 0x6C3B, 0x6C3D, 0xDF22, 0x4B46, 0x6C3E, 0x6C3F, 0,
+ 0xDF23, 0, 0xF927, 0xF926, 0x6C40, 0, 0, 0,
+ 0x6C42, 0xF928, 0, 0xF92A, 0xDF28, 0x332D, 0x4467, 0,
+ 0x4969, 0x3A62, 0x3957, 0, 0xF92B, 0, 0, 0x494F,
+ 0x325F, 0x484E, 0x6C45, 0x3453, 0x4055, 0x6C44, 0x6C49, 0x4379,
+ 0x4C63, 0, 0x6C47, 0x6C48, 0x352E, 0, 0x6C4A, 0x4763,
+ 0x425F, 0xDF2A, 0xDF2B, 0x4871, 0x453D, 0x6C46, 0, 0x4B47,
+};
static const unsigned short utf8_to_euc_E8B3[] = {
0x326C, 0x6C4C, 0x4F28, 0x4442, 0x4F45, 0xDF2C, 0xDF2D, 0x3B71,
0x6C4B, 0xDF2E, 0x4231, 0xDF2F, 0, 0x6C5C, 0x4128, 0xDF30,
@@ -5499,6 +10357,16 @@ static const unsigned short utf8_to_euc_E8B3[] = {
0xDF39, 0, 0xDF3A, 0, 0xF467, 0xDF3B, 0, 0xDF3C,
0xDF3D, 0, 0x6C51, 0x6C52, 0x3958, 0x6C50, 0xDF3E, 0xDF3F,
};
+static const unsigned short utf8_to_euc_E8B3_x0213[] = {
+ 0x326C, 0x6C4C, 0x4F28, 0x4442, 0x4F45, 0xDF2C, 0xDF2D, 0x3B71,
+ 0x6C4B, 0xDF2E, 0x4231, 0xDF2F, 0, 0x6C5C, 0x4128, 0xDF30,
+ 0, 0x4678, 0, 0x4950, 0, 0xF92D, 0xF92C, 0,
+ 0, 0xF92E, 0x6C4F, 0x3B3F, 0x3B72, 0xDF34, 0x3E5E, 0,
+ 0x4765, 0x7C39, 0x382D, 0x6C4E, 0x6C4D, 0, 0x496A, 0,
+ 0xDF36, 0, 0x3C41, 0, 0xDF37, 0x4552, 0, 0xDF38,
+ 0xF930, 0xF931, 0xDF3A, 0, 0x7C3A, 0xDF3B, 0, 0xDF3C,
+ 0x7C3B, 0, 0x6C51, 0x6C52, 0x3958, 0x6C50, 0x7C3C, 0xDF3F,
+};
static const unsigned short utf8_to_euc_E8B4[] = {
0, 0xDF40, 0, 0xDF41, 0x6C53, 0x6C54, 0, 0x6C56,
0x4223, 0xDF42, 0x6C55, 0x3466, 0, 0x6C58, 0, 0x6C57,
@@ -5509,6 +10377,16 @@ static const unsigned short utf8_to_euc_E8B4[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
};
+static const unsigned short utf8_to_euc_E8B4_x0213[] = {
+ 0, 0xDF40, 0, 0xDF41, 0x6C53, 0x6C54, 0, 0x6C56,
+ 0x4223, 0xF933, 0x6C55, 0x3466, 0, 0x6C58, 0xF934, 0x6C57,
+ 0x6C59, 0, 0x7C3E, 0x6C5B, 0x6C5D, 0, 0x6C5E, 0xDF44,
+ 0, 0, 0, 0x7C3F, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+};
static const unsigned short utf8_to_euc_E8B5[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
@@ -5519,6 +10397,16 @@ static const unsigned short utf8_to_euc_E8B5[] = {
0x4176, 0x6C61, 0, 0x6C62, 0x496B, 0, 0xF468, 0x352F,
0, 0, 0, 0, 0, 0, 0, 0xDF4A,
};
+static const unsigned short utf8_to_euc_E8B5_x0213[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0x4056, 0xDF46, 0x3C4F, 0x6C5F,
+ 0, 0xDF47, 0, 0x3352, 0xF935, 0x6C60, 0xDF49, 0,
+ 0x4176, 0x6C61, 0, 0x6C62, 0x496B, 0, 0xF468, 0x352F,
+ 0, 0, 0, 0, 0, 0, 0, 0xDF4A,
+};
static const unsigned short utf8_to_euc_E8B6[] = {
0, 0x6C63, 0xDF4B, 0, 0xDF4C, 0x4436, 0, 0,
0xDF4D, 0, 0x315B, 0, 0, 0xDF4E, 0, 0,
@@ -5529,6 +10417,16 @@ static const unsigned short utf8_to_euc_E8B6[] = {
0, 0, 0xDF59, 0x422D, 0, 0xDF5A, 0, 0xDF5B,
0, 0xDF5C, 0x6C67, 0xDF5D, 0xDF6F, 0, 0x6C66, 0,
};
+static const unsigned short utf8_to_euc_E8B6_x0213[] = {
+ 0, 0x6C63, 0xDF4B, 0, 0xF936, 0x4436, 0, 0,
+ 0xDF4D, 0, 0x315B, 0, 0, 0xDF4E, 0, 0,
+ 0xDF4F, 0xDF50, 0, 0, 0, 0xF937, 0, 0,
+ 0, 0x6C64, 0, 0, 0, 0, 0xDF52, 0xDF53,
+ 0xDF54, 0, 0, 0x3C71, 0, 0, 0xF938, 0,
+ 0x3F76, 0, 0, 0xDF56, 0xDF57, 0, 0, 0x7C40,
+ 0, 0, 0xDF59, 0x422D, 0, 0xDF5A, 0, 0xDF5B,
+ 0, 0xDF5C, 0x6C67, 0xDF5D, 0xDF6F, 0, 0x6C66, 0,
+};
static const unsigned short utf8_to_euc_E8B7[] = {
0xDF5E, 0, 0x6C65, 0, 0, 0xDF5F, 0xDF60, 0xDF61,
0xDF62, 0, 0xDF63, 0x6C6D, 0x6C6B, 0, 0xDF64, 0x6C68,
@@ -5539,6 +10437,16 @@ static const unsigned short utf8_to_euc_E8B7[] = {
0xDF6E, 0xDF70, 0xDF71, 0x4437, 0xDF72, 0x4129, 0, 0,
0, 0, 0, 0, 0x6C72, 0xDF73, 0, 0x6C75,
};
+static const unsigned short utf8_to_euc_E8B7_x0213[] = {
+ 0xDF5E, 0, 0x6C65, 0, 0, 0xDF5F, 0xF93A, 0xDF61,
+ 0xF93B, 0, 0xDF63, 0x6C6D, 0x6C6B, 0, 0x7C41, 0x6C68,
+ 0, 0x7C42, 0, 0, 0xDF66, 0xDF67, 0x6C6A, 0x7C43,
+ 0, 0xF93C, 0x6C69, 0x6C6C, 0, 0x3577, 0, 0x6C70,
+ 0, 0x4057, 0, 0x6C71, 0xDF6A, 0xDF6B, 0, 0xDF6C,
+ 0x3859, 0, 0x6C6E, 0x6C6F, 0xF93D, 0, 0, 0x4F29,
+ 0xDF6E, 0xDF70, 0xDF71, 0x4437, 0xDF72, 0x4129, 0, 0,
+ 0, 0, 0, 0, 0x6C72, 0xF940, 0, 0x6C75,
+};
static const unsigned short utf8_to_euc_E8B8[] = {
0, 0xDF74, 0, 0, 0xDF75, 0xDF76, 0xDF77, 0,
0x6C73, 0x6C74, 0x4D59, 0xDF78, 0, 0, 0, 0x4627,
@@ -5549,6 +10457,16 @@ static const unsigned short utf8_to_euc_E8B8[] = {
0x6C7C, 0xE024, 0, 0xE025, 0x6C7D, 0x6C7B, 0xE026, 0xE027,
0xE028, 0xE029, 0, 0, 0, 0xE02A, 0, 0,
};
+static const unsigned short utf8_to_euc_E8B8_x0213[] = {
+ 0, 0xDF74, 0, 0, 0xDF75, 0xDF76, 0xF941, 0,
+ 0x6C73, 0x6C74, 0x4D59, 0xDF78, 0xF93E, 0, 0, 0x4627,
+ 0x6C78, 0xDF79, 0, 0, 0xF943, 0, 0xF944, 0,
+ 0, 0, 0, 0, 0, 0x6C76, 0x6C77, 0x6C79,
+ 0x7C44, 0xF945, 0xF946, 0x7C45, 0, 0, 0xE022, 0xF947,
+ 0, 0, 0x6D29, 0, 0, 0, 0, 0,
+ 0x6C7C, 0xE024, 0, 0xE025, 0x6C7D, 0x6C7B, 0xF94A, 0xE027,
+ 0xE028, 0xF94B, 0, 0, 0, 0x7C46, 0, 0,
+};
static const unsigned short utf8_to_euc_E8B9[] = {
0xE02B, 0xE02C, 0x6C7A, 0, 0x447D, 0, 0, 0x6D21,
0x6D25, 0x6D22, 0x6C7E, 0xE02D, 0x6D23, 0xE02E, 0xE02F, 0xE030,
@@ -5559,6 +10477,16 @@ static const unsigned short utf8_to_euc_E8B9[] = {
0xE03C, 0xE03D, 0x6D2D, 0, 0x3D33, 0, 0x6D2C, 0,
0, 0xE03E, 0xE03F, 0xE040, 0x6D2E, 0, 0, 0,
};
+static const unsigned short utf8_to_euc_E8B9_x0213[] = {
+ 0xE02B, 0xE02C, 0x6C7A, 0, 0x447D, 0, 0, 0x6D21,
+ 0x6D25, 0x6D22, 0x6C7E, 0xF94C, 0x6D23, 0xE02E, 0xE02F, 0xE030,
+ 0x6D24, 0, 0, 0, 0xF94D, 0x6D2B, 0, 0,
+ 0, 0x6D26, 0, 0xE032, 0xE033, 0xE034, 0xE035, 0x4058,
+ 0x6D28, 0xE036, 0xF94E, 0x6D2A, 0x6D27, 0, 0, 0,
+ 0, 0xE038, 0, 0, 0xF94F, 0xF950, 0, 0xF951,
+ 0x7C47, 0xE03D, 0x6D2D, 0, 0x3D33, 0, 0x6D2C, 0,
+ 0, 0xE03E, 0xE03F, 0x7C48, 0x6D2E, 0, 0, 0,
+};
static const unsigned short utf8_to_euc_E8BA[] = {
0, 0x6D2F, 0xE041, 0xE042, 0x6D32, 0x6D31, 0, 0x6D30,
0, 0xE043, 0x6D34, 0x6D33, 0, 0x4C76, 0, 0,
@@ -5569,6 +10497,16 @@ static const unsigned short utf8_to_euc_E8BA[] = {
0x6D3C, 0x6D3E, 0, 0xE050, 0, 0xE051, 0, 0,
0, 0, 0xE052, 0xE053, 0, 0, 0x6D3F, 0,
};
+static const unsigned short utf8_to_euc_E8BA_x0213[] = {
+ 0, 0x6D2F, 0xE041, 0xE042, 0x6D32, 0x6D31, 0, 0x6D30,
+ 0, 0xE043, 0x6D34, 0x6D33, 0, 0x4C76, 0, 0,
+ 0xE044, 0x6D36, 0xE045, 0x6D35, 0x6D37, 0xE046, 0, 0,
+ 0xF952, 0x6D38, 0xE047, 0xE048, 0, 0xE049, 0xF953, 0,
+ 0, 0x6D3A, 0xE04B, 0, 0, 0, 0, 0xE04C,
+ 0, 0xE04D, 0x6D39, 0x3F48, 0x6D3B, 0xE04E, 0xF954, 0x366D,
+ 0x6D3C, 0x6D3E, 0, 0xF955, 0, 0xF956, 0xF957, 0,
+ 0, 0, 0xE052, 0xF958, 0, 0, 0x6D3F, 0,
+};
static const unsigned short utf8_to_euc_E8BB[] = {
0xE054, 0xE055, 0, 0xE056, 0xE057, 0x6D40, 0x6D3D, 0xE058,
0x6D41, 0, 0x3C56, 0x6D42, 0x3530, 0x3733, 0, 0xE059,
@@ -5579,6 +10517,16 @@ static const unsigned short utf8_to_euc_E8BB[] = {
0xE05F, 0xE060, 0, 0, 0, 0, 0, 0xE061,
0x3C34, 0xE062, 0xE063, 0x6D46, 0x6D45, 0x375A, 0x6D48, 0,
};
+static const unsigned short utf8_to_euc_E8BB_x0213[] = {
+ 0x7C4A, 0xE055, 0, 0xE056, 0xE057, 0x6D40, 0x6D3D, 0xE058,
+ 0x6D41, 0, 0x3C56, 0x6D42, 0x3530, 0x3733, 0, 0xE059,
+ 0, 0xF95A, 0x382E, 0, 0xF95B, 0, 0, 0,
+ 0, 0, 0, 0x6D43, 0xE05C, 0, 0, 0x4670,
+ 0, 0, 0x453E, 0x6D44, 0, 0, 0, 0,
+ 0xE05D, 0, 0, 0x6D47, 0, 0xE064, 0xE05E, 0,
+ 0xE05F, 0xE060, 0, 0, 0, 0, 0, 0xE061,
+ 0x3C34, 0xF95D, 0x7C4C, 0x6D46, 0x6D45, 0x375A, 0x6D48, 0,
+};
static const unsigned short utf8_to_euc_E8BC[] = {
0xE065, 0, 0xE066, 0x3353, 0, 0x6D4A, 0, 0xE067,
0xE068, 0x3A5C, 0x6D49, 0, 0x6D52, 0, 0, 0xE069,
@@ -5589,6 +10537,16 @@ static const unsigned short utf8_to_euc_E8BC[] = {
0, 0, 0, 0x6D54, 0xE078, 0xE079, 0xE07A, 0xE07B,
0x4D22, 0x6D56, 0xE07C, 0x6D55, 0, 0, 0x6D59, 0x4D41,
};
+static const unsigned short utf8_to_euc_E8BC_x0213[] = {
+ 0xF95F, 0, 0xE066, 0x3353, 0, 0x6D4A, 0, 0xE067,
+ 0xF960, 0x3A5C, 0x6D49, 0, 0x6D52, 0, 0, 0xE069,
+ 0xE06A, 0, 0x6D4C, 0x6D4E, 0x4A65, 0x6D4B, 0xE06B, 0xF961,
+ 0xE06D, 0x6D4D, 0, 0x6D51, 0x6D4F, 0x3531, 0x7C4D, 0x6D50,
+ 0xE06F, 0xE070, 0, 0xE071, 0, 0xE072, 0x6D53, 0xE073,
+ 0xE074, 0x475A, 0x4E58, 0xF962, 0xE075, 0x7C4E, 0xE077, 0x3D34,
+ 0, 0, 0, 0x6D54, 0xE078, 0xE079, 0x7C4F, 0xE07B,
+ 0x4D22, 0x6D56, 0xE07C, 0x6D55, 0, 0, 0x6D59, 0x4D41,
+};
static const unsigned short utf8_to_euc_E8BD[] = {
0xE07D, 0xE07E, 0x6D58, 0xE121, 0x336D, 0x6D57, 0x6D5C, 0xE122,
0, 0x6D5B, 0, 0, 0x6D5A, 0x4532, 0x6D5D, 0xE123,
@@ -5599,6 +10557,16 @@ static const unsigned short utf8_to_euc_E8BD[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
};
+static const unsigned short utf8_to_euc_E8BD_x0213[] = {
+ 0xF963, 0xE07E, 0x6D58, 0xE121, 0x336D, 0x6D57, 0x6D5C, 0xE122,
+ 0, 0x6D5B, 0xF964, 0, 0x6D5A, 0x4532, 0x6D5D, 0xE123,
+ 0, 0xE124, 0xE125, 0xE126, 0x7C50, 0xE128, 0, 0x6D5E,
+ 0xF965, 0, 0, 0, 0x6D5F, 0xE12A, 0xE12B, 0x396C,
+ 0, 0x3725, 0x6D60, 0x6D61, 0x6D62, 0xE12C, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+};
static const unsigned short utf8_to_euc_E8BE[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
@@ -5609,6 +10577,16 @@ static const unsigned short utf8_to_euc_E8BE[] = {
0x4324, 0x3F2B, 0x4740, 0, 0, 0xE133, 0xE134, 0x6D68,
0xE135, 0, 0x4A55, 0x4454, 0x397E, 0, 0xE136, 0x4329,
};
+static const unsigned short utf8_to_euc_E8BE_x0213[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0x3F49, 0x6D63, 0xE12D, 0x3C2D, 0x6D64,
+ 0xE12E, 0xE12F, 0, 0x6D65, 0xF967, 0xE131, 0x7C52, 0x5221,
+ 0x517E, 0, 0, 0, 0, 0x6D66, 0x6570, 0x6D67,
+ 0x4324, 0x3F2B, 0x4740, 0, 0xF968, 0x7C53, 0xF96A, 0x6D68,
+ 0xE135, 0, 0x4A55, 0x4454, 0x397E, 0, 0xE136, 0x4329,
+};
static const unsigned short utf8_to_euc_E8BF[] = {
0xE137, 0xE138, 0x312A, 0, 0x4B78, 0x3F57, 0xE139, 0,
0, 0, 0xE13A, 0xE13B, 0, 0xE13C, 0x375E, 0,
@@ -5619,6 +10597,16 @@ static const unsigned short utf8_to_euc_E8BF[] = {
0x3D52, 0xE146, 0, 0, 0x6D6F, 0xE147, 0xE148, 0x4C42,
0x6D7E, 0x6D71, 0x6D72, 0xE149, 0, 0x4449, 0xE14A, 0,
};
+static const unsigned short utf8_to_euc_E8BF_x0213[] = {
+ 0xE137, 0xF96C, 0x312A, 0, 0x4B78, 0x3F57, 0xF96D, 0,
+ 0, 0, 0xF96F, 0xE13B, 0, 0xF970, 0x375E, 0,
+ 0xE13D, 0x3661, 0xE13E, 0xF971, 0x4A56, 0xF972, 0, 0,
+ 0, 0, 0x6D69, 0, 0, 0, 0, 0,
+ 0xF973, 0, 0x6D6B, 0xE142, 0x7C54, 0x6D6A, 0x3260, 0,
+ 0x7C55, 0x4676, 0x6D6C, 0x4777, 0, 0x4533, 0x7C56, 0x6D6D,
+ 0x3D52, 0xF974, 0, 0, 0x6D6F, 0xF975, 0xE148, 0x4C42,
+ 0x6D7E, 0x6D71, 0x6D72, 0xF976, 0, 0x4449, 0xE14A, 0,
+};
static const unsigned short utf8_to_euc_E980[] = {
0x4260, 0x4177, 0xE14B, 0x4628, 0xE14C, 0x6D70, 0x3555, 0,
0xE14D, 0, 0, 0x6D79, 0xE14E, 0x6D76, 0x6E25, 0x4629,
@@ -5629,6 +10617,16 @@ static const unsigned short utf8_to_euc_E980[] = {
0, 0x3D35, 0x3F4A, 0xE157, 0xE158, 0x6D7C, 0x6D7B, 0xE159,
0x306F, 0x6D7D, 0, 0, 0x492F, 0, 0x6E27, 0xE15A,
};
+static const unsigned short utf8_to_euc_E980_x0213[] = {
+ 0x4260, 0x4177, 0xF977, 0x4628, 0xE14C, 0x6D70, 0x3555, 0,
+ 0x7C57, 0, 0, 0x6D79, 0xF978, 0x6D76, 0x6E25, 0x4629,
+ 0x4360, 0x6D73, 0, 0x447E, 0x4553, 0x6D74, 0x6D78, 0x3F60,
+ 0xE14F, 0x4767, 0x444C, 0xE150, 0, 0x4042, 0x6D77, 0x422E,
+ 0x4224, 0x6D75, 0x3029, 0x4F22, 0, 0, 0, 0x6D7A,
+ 0xE151, 0xE152, 0xE154, 0, 0xE155, 0x7C58, 0x4261, 0xE153,
+ 0, 0x3D35, 0x3F4A, 0xE157, 0xE158, 0x6D7C, 0x6D7B, 0xF979,
+ 0x306F, 0x6D7D, 0, 0, 0x492F, 0, 0x6E27, 0xE15A,
+};
static const unsigned short utf8_to_euc_E981[] = {
0, 0x465B, 0x3F6B, 0xE15B, 0xE15C, 0x4359, 0, 0x3678,
0, 0x6E26, 0x4D37, 0x313F, 0xE15D, 0x4A57, 0x3261, 0x6E21,
@@ -5639,6 +10637,16 @@ static const unsigned short utf8_to_euc_E981[] = {
0xE164, 0, 0x6E2F, 0, 0xE165, 0x3D65, 0x6E2D, 0x412B,
0x412A, 0xE166, 0x3064, 0, 0x4E4B, 0x6E31, 0, 0x4872,
};
+static const unsigned short utf8_to_euc_E981_x0213[] = {
+ 0, 0x465B, 0x3F6B, 0xF97B, 0xF97C, 0x4359, 0, 0x3678,
+ 0, 0x6E26, 0x4D37, 0x313F, 0xE15D, 0x4A57, 0x3261, 0x6E21,
+ 0x6E22, 0x6E23, 0x6E24, 0x463B, 0x4323, 0x3063, 0x6E28, 0,
+ 0x6E29, 0x7423, 0, 0xE15E, 0x423D, 0xF97D, 0x6E2A, 0,
+ 0x3173, 0x414C, 0xE160, 0x382F, 0, 0x4D5A, 0xE161, 0xE162,
+ 0x6E2B, 0x452C, 0, 0, 0xE163, 0x4178, 0x3C57, 0x6E2C,
+ 0xE164, 0, 0x6E2F, 0, 0xE165, 0x3D65, 0x6E2D, 0x412B,
+ 0x412A, 0xE166, 0x3064, 0, 0x4E4B, 0x6E31, 0, 0x4872,
+};
static const unsigned short utf8_to_euc_E982[] = {
0x6E33, 0x6E32, 0x6E30, 0x6364, 0x3454, 0xE167, 0, 0x6D6E,
0xE168, 0x6E35, 0x6E34, 0xE169, 0xE16A, 0, 0xE16B, 0x6E36,
@@ -5649,6 +10657,16 @@ static const unsigned short utf8_to_euc_E982[] = {
0xE176, 0x6E39, 0xE177, 0xE178, 0xE179, 0x6E3A, 0xE17A, 0,
0x4521, 0, 0, 0, 0, 0xE17B, 0xE17D, 0,
};
+static const unsigned short utf8_to_euc_E982_x0213[] = {
+ 0x6E33, 0x6E32, 0x6E30, 0x6364, 0x3454, 0xFA22, 0, 0x6D6E,
+ 0x7C5A, 0x6E35, 0x6E34, 0xE169, 0xFA23, 0, 0xE16B, 0x6E36,
+ 0xFA24, 0x4D38, 0, 0, 0, 0x7C5B, 0, 0x7C5C,
+ 0xE16F, 0x7C5D, 0, 0x7C5E, 0, 0, 0, 0,
+ 0xE172, 0xFA26, 0x7C5F, 0x4661, 0, 0xE175, 0x4B2E, 0,
+ 0x6E37, 0, 0x3C59, 0, 0, 0, 0, 0x6E38,
+ 0xFA28, 0x6E39, 0xE177, 0x7C60, 0xE179, 0x6E3A, 0xFA29, 0,
+ 0x4521, 0, 0, 0, 0, 0xE17B, 0x7C61, 0,
+};
static const unsigned short utf8_to_euc_E983[] = {
0, 0x306A, 0, 0xE17E, 0xE221, 0xE222, 0, 0xE223,
0xE224, 0, 0x3959, 0, 0xE17C, 0, 0x4F3A, 0,
@@ -5659,6 +10677,16 @@ static const unsigned short utf8_to_euc_E983[] = {
0xE231, 0, 0, 0, 0xE232, 0x4D39, 0xE22E, 0x363F,
0, 0, 0, 0, 0, 0x4554, 0xE233, 0xE234,
};
+static const unsigned short utf8_to_euc_E983_x0213[] = {
+ 0, 0x306A, 0, 0xFA2A, 0x7C62, 0x7C63, 0, 0x7C64,
+ 0xFA2B, 0, 0x3959, 0, 0xE17C, 0, 0x4F3A, 0,
+ 0, 0, 0xE22D, 0, 0, 0xE225, 0, 0x7C65,
+ 0xE227, 0xE228, 0, 0x6E3E, 0xFA2D, 0x7C66, 0x7C67, 0xFA2E,
+ 0, 0x3734, 0x6E3B, 0, 0x6E3C, 0xE22C, 0, 0,
+ 0x4974, 0, 0, 0xFA33, 0, 0x3354, 0, 0x7C68,
+ 0xE231, 0, 0xFA31, 0, 0x7C69, 0x4D39, 0xFA30, 0x363F,
+ 0, 0, 0, 0, 0, 0x4554, 0xFA34, 0xFA35,
+};
static const unsigned short utf8_to_euc_E984[] = {
0xE235, 0, 0x6E3F, 0, 0xE236, 0xE237, 0xE238, 0,
0xE239, 0, 0, 0, 0, 0xE23A, 0, 0,
@@ -5669,6 +10697,16 @@ static const unsigned short utf8_to_euc_E984[] = {
0x6E43, 0xE24B, 0x6E42, 0, 0xE24C, 0, 0xE24D, 0xE24E,
0, 0xE24F, 0xE250, 0, 0xE251, 0xE252, 0, 0,
};
+static const unsigned short utf8_to_euc_E984_x0213[] = {
+ 0xFA32, 0, 0x6E3F, 0, 0xFA36, 0xE237, 0xFA37, 0,
+ 0xE239, 0, 0, 0, 0, 0xE23A, 0, 0,
+ 0xE23B, 0, 0x6E40, 0, 0x7C6B, 0x7C6C, 0x7C6D, 0xE23E,
+ 0xFA38, 0x6E41, 0xE240, 0, 0xFA39, 0, 0xFA3A, 0,
+ 0xE243, 0, 0x7C6E, 0x7C6F, 0, 0xE244, 0, 0x7C70,
+ 0, 0xE248, 0, 0, 0, 0x4522, 0xE249, 0x7C71,
+ 0x6E43, 0x7C72, 0x6E42, 0, 0x7C73, 0, 0xE24D, 0xFA3B,
+ 0, 0xFA3C, 0xFA3D, 0, 0xE251, 0x7C74, 0, 0,
+};
static const unsigned short utf8_to_euc_E985[] = {
0, 0, 0, 0xE253, 0, 0, 0, 0xE254,
0xE255, 0x4653, 0x6E44, 0x3D36, 0x3C60, 0x475B, 0x4371, 0xE256,
@@ -5679,6 +10717,16 @@ static const unsigned short utf8_to_euc_E985[] = {
0, 0, 0x6E4B, 0x6E4A, 0xE260, 0x395A, 0, 0x3973,
0x3B40, 0xE261, 0xE262, 0xE263, 0, 0, 0, 0,
};
+static const unsigned short utf8_to_euc_E985_x0213[] = {
+ 0, 0, 0, 0xE253, 0, 0, 0xFA3E, 0xFA3F,
+ 0x7C75, 0x4653, 0x6E44, 0x3D36, 0x3C60, 0x475B, 0x4371, 0xE256,
+ 0, 0, 0x3C72, 0xE257, 0x3F6C, 0, 0x6E45, 0xFA40,
+ 0x6E46, 0xFA41, 0xE25A, 0x7C76, 0, 0, 0, 0,
+ 0, 0xFA42, 0x3F5D, 0x6E47, 0xFA43, 0x6E48, 0, 0xE25E,
+ 0, 0x6E49, 0x4D6F, 0, 0x3D37, 0xE25F, 0, 0,
+ 0, 0, 0x6E4B, 0x6E4A, 0xFA44, 0x395A, 0, 0x3973,
+ 0x3B40, 0xFA45, 0xE262, 0xE263, 0, 0, 0, 0,
+};
static const unsigned short utf8_to_euc_E986[] = {
0, 0xE264, 0x6E4E, 0xE265, 0, 0xE266, 0xE267, 0x3D66,
0, 0x6E4D, 0xE268, 0x6E4C, 0, 0x4269, 0xE269, 0,
@@ -5689,6 +10737,16 @@ static const unsigned short utf8_to_euc_E986[] = {
0xE276, 0xE277, 0xE278, 0xE279, 0x6E54, 0x6E53, 0xE27A, 0,
0x3E7A, 0, 0x6E55, 0xE27B, 0xE27C, 0xE27D, 0, 0xE27E,
};
+static const unsigned short utf8_to_euc_E986_x0213[] = {
+ 0, 0xE264, 0x6E4E, 0x7C77, 0, 0xFA46, 0xE267, 0x3D66,
+ 0, 0x6E4D, 0xE268, 0x6E4C, 0, 0x4269, 0xFA47, 0,
+ 0x386F, 0xE26A, 0x4043, 0xE26B, 0xE26C, 0xE26D, 0, 0x4830,
+ 0xE26E, 0, 0, 0, 0x3D39, 0, 0x7C78, 0,
+ 0, 0xE270, 0x6E4F, 0, 0x3E5F, 0, 0xE271, 0,
+ 0xFA48, 0, 0x6E52, 0x6E50, 0x7C79, 0xE274, 0xFA49, 0x6E51,
+ 0xE276, 0x7C7A, 0xE278, 0xFA4A, 0x6E54, 0x6E53, 0xFA4B, 0,
+ 0x3E7A, 0, 0x6E55, 0xE27B, 0x7C7B, 0xE27D, 0, 0xE27E,
+};
static const unsigned short utf8_to_euc_E987[] = {
0x6E56, 0x6E57, 0xE321, 0xE322, 0, 0xE323, 0x4850, 0x3A53,
0x3C61, 0x6E58, 0, 0x6E59, 0x4E24, 0x3D45, 0x4C6E, 0x4E4C,
@@ -5699,6 +10757,16 @@ static const unsigned short utf8_to_euc_E987[] = {
0xE332, 0xE333, 0, 0, 0, 0x6E60, 0x6E61, 0xE334,
0, 0xE335, 0, 0xE336, 0x6E5F, 0xE337, 0, 0x6E63,
};
+static const unsigned short utf8_to_euc_E987_x0213[] = {
+ 0x6E56, 0x6E57, 0xE321, 0xFA4C, 0xFA4D, 0xE323, 0x4850, 0x3A53,
+ 0x3C61, 0x6E58, 0, 0x6E59, 0x4E24, 0x3D45, 0x4C6E, 0x4E4C,
+ 0x6E5A, 0x3662, 0, 0xE324, 0xE325, 0, 0x6E5B, 0x7C7C,
+ 0x4523, 0xE327, 0xFA4E, 0x6E5E, 0x3378, 0x3F4B, 0xE329, 0x6E5C,
+ 0, 0x6E5D, 0, 0x4460, 0x7C7E, 0x7D21, 0x4B55, 0x367C,
+ 0, 0xE32C, 0xE32D, 0, 0xFA51, 0x7D22, 0xFA52, 0xE331,
+ 0xE332, 0x7D23, 0, 0, 0, 0x6E60, 0x6E61, 0xE334,
+ 0, 0xE335, 0, 0x7C7D, 0x6E5F, 0xE337, 0, 0x6E63,
+};
static const unsigned short utf8_to_euc_E988[] = {
0xE338, 0xE339, 0, 0, 0xE33A, 0xE33B, 0xE33C, 0xE33D,
0, 0xE33E, 0xE33F, 0, 0xE340, 0x465F, 0x3343, 0,
@@ -5709,6 +10777,16 @@ static const unsigned short utf8_to_euc_E988[] = {
0xE34F, 0, 0, 0xE350, 0x4E6B, 0xE351, 0xE352, 0x385A,
0xE353, 0xE354, 0xE355, 0, 0xE356, 0, 0xE357, 0x6E6F,
};
+static const unsigned short utf8_to_euc_E988_x0213[] = {
+ 0xE338, 0xFA53, 0, 0, 0xE33A, 0xE33B, 0xE33C, 0x7D24,
+ 0, 0xE33E, 0xFA54, 0, 0xE340, 0x465F, 0x3343, 0,
+ 0x7D25, 0x6E67, 0xE342, 0xE343, 0x6E64, 0x6E66, 0xFA55, 0xFA56,
+ 0xE345, 0, 0, 0, 0xE346, 0xE347, 0x6E62, 0,
+ 0, 0, 0, 0xE348, 0xE349, 0xE34A, 0xE34B, 0,
+ 0xE34C, 0x6F4F, 0, 0, 0x6E65, 0, 0xE34D, 0xE34E,
+ 0xE34F, 0, 0, 0xFA58, 0x4E6B, 0xE351, 0xE352, 0x385A,
+ 0x7D26, 0x7D27, 0x7D28, 0, 0x7D29, 0, 0xE357, 0x6E6F,
+};
static const unsigned short utf8_to_euc_E989[] = {
0xE358, 0, 0xE359, 0xE35A, 0x4534, 0x6E6A, 0xE35B, 0xE35C,
0x6E6D, 0x6E6B, 0xE35D, 0x6E70, 0, 0xE35E, 0xE35F, 0xE360,
@@ -5719,6 +10797,16 @@ static const unsigned short utf8_to_euc_E989[] = {
0xE36E, 0x395B, 0, 0, 0, 0xE36F, 0xE370, 0xE371,
0xE372, 0xE373, 0, 0xE374, 0xE375, 0xE376, 0x4B48, 0xE377,
};
+static const unsigned short utf8_to_euc_E989_x0213[] = {
+ 0x7D2A, 0, 0xFA59, 0x7D2B, 0x4534, 0x6E6A, 0xE35B, 0xFA5A,
+ 0x6E6D, 0x6E6B, 0xFA5B, 0x6E70, 0, 0xE35E, 0xFA5C, 0x7D2C,
+ 0x6E71, 0xFA5D, 0, 0, 0, 0, 0xFA5E, 0x6E69,
+ 0xE362, 0xFA5F, 0x6E76, 0x3174, 0xE364, 0xE365, 0x6E68, 0,
+ 0xFA60, 0xFA61, 0x482D, 0, 0x6E6C, 0xFA62, 0x3E60, 0xFA63,
+ 0xFA64, 0xE36B, 0, 0, 0, 0, 0xE36C, 0xE36D,
+ 0xE36E, 0x395B, 0, 0, 0, 0xE36F, 0xE370, 0xE371,
+ 0x7D2D, 0xE373, 0, 0xE374, 0xFA67, 0xFA68, 0x4B48, 0xFA69,
+};
static const unsigned short utf8_to_euc_E98A[] = {
0x3664, 0, 0, 0x3D46, 0, 0x463C, 0, 0,
0xE378, 0xE379, 0xE37A, 0, 0, 0xE37B, 0xE37C, 0,
@@ -5729,6 +10817,16 @@ static const unsigned short utf8_to_euc_E98A[] = {
0, 0, 0xE42A, 0, 0, 0, 0xE42B, 0x6E79,
0xE42C, 0x6E78, 0xE42D, 0xE42E, 0xE42F, 0xE430, 0, 0xE431,
};
+static const unsigned short utf8_to_euc_E98A_x0213[] = {
+ 0x3664, 0, 0, 0x3D46, 0, 0x463C, 0, 0,
+ 0x7D2E, 0xFA6A, 0xE37A, 0, 0, 0xFA6B, 0xE37C, 0,
+ 0, 0x412D, 0xE37D, 0x6E74, 0, 0x6E6E, 0x6E73, 0xFA6C,
+ 0x4C43, 0xFA6D, 0x4438, 0x6E75, 0x6E72, 0, 0, 0xFA6E,
+ 0xE423, 0, 0, 0, 0xE424, 0xE425, 0, 0xFA6F,
+ 0xE427, 0, 0, 0xFA70, 0, 0x412C, 0, 0xE429,
+ 0, 0, 0xFA73, 0, 0, 0, 0xE42B, 0x6E79,
+ 0xE42C, 0x6E78, 0xE42D, 0xE42E, 0xE42F, 0xE430, 0, 0xFA74,
+};
static const unsigned short utf8_to_euc_E98B[] = {
0xE432, 0xE433, 0xE434, 0xE435, 0, 0xE436, 0xE437, 0xE438,
0xE439, 0, 0, 0xE43A, 0xE43B, 0xE43C, 0xE43D, 0x6E77,
@@ -5739,6 +10837,16 @@ static const unsigned short utf8_to_euc_E98B[] = {
0xE44F, 0, 0x4946, 0x4372, 0, 0, 0, 0,
0x3578, 0xE450, 0x6E7C, 0xE451, 0x395D, 0, 0, 0xE452,
};
+static const unsigned short utf8_to_euc_E98B_x0213[] = {
+ 0xFA75, 0xE433, 0x7D2F, 0xE435, 0, 0xE436, 0xFA76, 0xE438,
+ 0xE439, 0, 0, 0x7D30, 0x7D31, 0xE43C, 0xFA77, 0x6E77,
+ 0xFA78, 0, 0x4B2F, 0x7D32, 0, 0xE440, 0, 0xFA79,
+ 0xE442, 0xFA7A, 0, 0, 0xE444, 0xE445, 0, 0xE446,
+ 0x7D33, 0xE448, 0, 0xE449, 0x3D7B, 0xFA7B, 0, 0xFA7C,
+ 0xE44C, 0x6E7A, 0x4A5F, 0, 0xE44D, 0x3154, 0xE44E, 0,
+ 0xE44F, 0, 0x4946, 0x4372, 0, 0, 0, 0xFB22,
+ 0x3578, 0xFB23, 0x6E7C, 0xFB24, 0x395D, 0, 0, 0x7D34,
+};
static const unsigned short utf8_to_euc_E98C[] = {
0xE453, 0, 0xE454, 0, 0, 0, 0x3B2C, 0,
0xE455, 0, 0, 0, 0, 0xE456, 0, 0x6E7B,
@@ -5749,6 +10857,16 @@ static const unsigned short utf8_to_euc_E98C[] = {
0, 0, 0x4F3F, 0xE464, 0xE465, 0x6F26, 0xE466, 0xE467,
0, 0, 0x6F25, 0x6F27, 0, 0, 0, 0,
};
+static const unsigned short utf8_to_euc_E98C_x0213[] = {
+ 0xE453, 0, 0xFB25, 0, 0x7D35, 0, 0x3B2C, 0,
+ 0xE455, 0, 0, 0, 0, 0xFB26, 0, 0x6E7B,
+ 0x3F6D, 0xFA7D, 0, 0, 0xE458, 0xFB27, 0, 0,
+ 0x3F6E, 0x6F21, 0x6F23, 0, 0xE45A, 0xFB28, 0xFB29, 0x7D36,
+ 0x3E7B, 0x7D37, 0x6F22, 0x6F24, 0xE45F, 0x7D38, 0x3653, 0xFB2A,
+ 0x4945, 0xFB2B, 0xE463, 0x3C62, 0x4F23, 0, 0x6E7E, 0x3A78,
+ 0, 0, 0x4F3F, 0xE464, 0xE465, 0x6F26, 0xE466, 0xE467,
+ 0, 0, 0x6F25, 0x6F27, 0, 0, 0, 0,
+};
static const unsigned short utf8_to_euc_E98D[] = {
0, 0, 0, 0, 0x6E7D, 0, 0, 0xE468,
0xE469, 0xE46A, 0, 0x4669, 0, 0x4555, 0, 0,
@@ -5759,6 +10877,16 @@ static const unsigned short utf8_to_euc_E98D[] = {
0xE47A, 0xE47B, 0, 0xE47C, 0xE47D, 0x3830, 0xE47E, 0,
0, 0, 0xE521, 0, 0x6F2A, 0xE522, 0x3E61, 0xE523,
};
+static const unsigned short utf8_to_euc_E98D_x0213[] = {
+ 0, 0, 0, 0, 0x6E7D, 0, 0, 0xFB2E,
+ 0x7D39, 0x7D3A, 0x7D3B, 0x4669, 0, 0x4555, 0, 0,
+ 0xE46B, 0xFB2F, 0xE46D, 0, 0x4457, 0xE46E, 0x6F2C, 0xFB30,
+ 0xE470, 0, 0xFB31, 0x4343, 0x6F28, 0, 0xE472, 0,
+ 0x6F29, 0, 0, 0, 0x7D3C, 0x7D3D, 0, 0xE475,
+ 0, 0xE476, 0x7D3E, 0xFB32, 0x372D, 0xE478, 0x6F2B, 0xE479,
+ 0x7D3F, 0xFB33, 0, 0xFB34, 0xE47D, 0x3830, 0xE47E, 0,
+ 0, 0, 0xE521, 0, 0x6F2A, 0xE522, 0x3E61, 0xE523,
+};
static const unsigned short utf8_to_euc_E98E[] = {
0xE524, 0xE525, 0xE526, 0, 0, 0, 0, 0,
0xE527, 0, 0xE528, 0xE529, 0x3379, 0xE52A, 0, 0xE52B,
@@ -5769,6 +10897,16 @@ static const unsigned short utf8_to_euc_E98E[] = {
0x6F2D, 0, 0, 0, 0xE537, 0xE538, 0xE539, 0,
0, 0x6F31, 0xE53A, 0, 0, 0, 0, 0,
};
+static const unsigned short utf8_to_euc_E98E_x0213[] = {
+ 0xE524, 0xE525, 0xE526, 0, 0, 0, 0, 0,
+ 0xFB38, 0, 0xE528, 0xFB39, 0x3379, 0xE52A, 0, 0xFB3A,
+ 0, 0, 0xE52C, 0, 0x6F30, 0xE52D, 0x3A3F, 0x4179,
+ 0xE52E, 0, 0x444A, 0x7D40, 0, 0, 0xFB3B, 0,
+ 0, 0xFB35, 0, 0x7D41, 0xE533, 0, 0xE534, 0x333B,
+ 0xE535, 0xE53B, 0, 0xE536, 0x6F2E, 0x6F2F, 0x4443, 0,
+ 0x6F2D, 0, 0, 0, 0xE537, 0xE538, 0xE539, 0,
+ 0, 0x6F31, 0x7D42, 0, 0, 0, 0, 0,
+};
static const unsigned short utf8_to_euc_E98F[] = {
0, 0xE53C, 0, 0x6F37, 0xE53D, 0xE53E, 0xE53F, 0xE540,
0x6F3A, 0xE541, 0xE542, 0xE543, 0xE544, 0xE545, 0, 0,
@@ -5779,6 +10917,16 @@ static const unsigned short utf8_to_euc_E98F[] = {
0, 0, 0, 0, 0, 0, 0, 0xE54F,
0xE550, 0xE54E, 0xE551, 0xE552, 0, 0xE553, 0, 0,
};
+static const unsigned short utf8_to_euc_E98F_x0213[] = {
+ 0, 0xFB40, 0, 0x6F37, 0xE53D, 0xE53E, 0x7D43, 0xFB41,
+ 0x6F3A, 0xE541, 0xE542, 0xE543, 0xE544, 0xE545, 0, 0,
+ 0x6F39, 0x452D, 0, 0xE546, 0, 0, 0x6F32, 0x6F33,
+ 0x6F36, 0xE547, 0, 0, 0xFB42, 0x6F38, 0x7D44, 0x7D45,
+ 0, 0x3640, 0xFB43, 0, 0x6F3B, 0x6F35, 0xE54C, 0xFB44,
+ 0x6F34, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0xFB3F, 0, 0, 0, 0xFB3C, 0, 0xE54F,
+ 0xE550, 0xE54E, 0xE551, 0xFB49, 0, 0x7D47, 0, 0,
+};
static const unsigned short utf8_to_euc_E990[] = {
0, 0xE554, 0xE555, 0x6F3F, 0xE556, 0, 0, 0x6F40,
0xE557, 0xE558, 0, 0, 0, 0xE559, 0xE55A, 0xE55B,
@@ -5789,6 +10937,16 @@ static const unsigned short utf8_to_euc_E990[] = {
0, 0xE562, 0xE563, 0xE564, 0xE565, 0x6F44, 0x6F42, 0,
0x4278, 0, 0x6F46, 0xE566, 0, 0xE568, 0, 0xE567,
};
+static const unsigned short utf8_to_euc_E990_x0213[] = {
+ 0, 0xE554, 0xE555, 0x6F3F, 0x7D46, 0, 0, 0x6F40,
+ 0xE557, 0xFB45, 0, 0, 0, 0xE559, 0xE55A, 0xFB46,
+ 0x6F41, 0, 0, 0x6F3E, 0x6F3D, 0xE55C, 0xFB47, 0xFB48,
+ 0x3E62, 0x462A, 0x6F3C, 0, 0, 0, 0, 0xE55F,
+ 0, 0x6F45, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0x6F43, 0, 0, 0xE560, 0xE561,
+ 0, 0xE562, 0xFB4A, 0x7D48, 0xFB4B, 0x6F44, 0x6F42, 0,
+ 0x4278, 0, 0x6F46, 0xFB4C, 0, 0xE568, 0, 0xE567,
+};
static const unsigned short utf8_to_euc_E991[] = {
0, 0x6F47, 0, 0xE569, 0x6F49, 0xE56A, 0, 0,
0xE56B, 0, 0xE56C, 0, 0xE56D, 0, 0, 0,
@@ -5799,6 +10957,16 @@ static const unsigned short utf8_to_euc_E991[] = {
0x6F50, 0xE579, 0xE57A, 0, 0, 0x6F51, 0, 0x6F52,
0, 0, 0, 0, 0x6F55, 0x6F53, 0x6F56, 0x6F58,
};
+static const unsigned short utf8_to_euc_E991_x0213[] = {
+ 0, 0x6F47, 0, 0xE569, 0x6F49, 0xFB4D, 0, 0,
+ 0xE56B, 0, 0x7D49, 0, 0xE56D, 0, 0, 0,
+ 0, 0x3455, 0x6F48, 0x4C7A, 0, 0xE56E, 0, 0,
+ 0, 0xE56F, 0x6F54, 0x6F4A, 0xE570, 0, 0x6F4D, 0xE571,
+ 0x6F4B, 0xE572, 0x6F4C, 0x7D4A, 0, 0, 0, 0,
+ 0xE574, 0, 0x6F4E, 0x7D4B, 0, 0xFB50, 0xE577, 0xFB51,
+ 0x6F50, 0x7D4C, 0x7D4D, 0, 0, 0x6F51, 0, 0x6F52,
+ 0, 0, 0, 0, 0x6F55, 0x6F53, 0x6F56, 0x6F58,
+};
static const unsigned short utf8_to_euc_E992[] = {
0, 0x6F57, 0, 0xE57C, 0xE57B, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
@@ -5819,6 +10987,16 @@ static const unsigned short utf8_to_euc_E995[] = {
0, 0, 0, 0, 0, 0, 0, 0x4439,
0xE57D, 0xE57E, 0, 0, 0, 0, 0xE621, 0,
};
+static const unsigned short utf8_to_euc_E995_x0213[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0x4439,
+ 0xFB52, 0xFB53, 0, 0, 0, 0, 0xE621, 0,
+};
static const unsigned short utf8_to_euc_E996[] = {
0x4C67, 0, 0x6F59, 0x412E, 0xE622, 0, 0, 0x6F5A,
0xE623, 0x4A44, 0x6F5B, 0x332B, 0xE624, 0xE625, 0xE626, 0x313C,
@@ -5829,6 +11007,16 @@ static const unsigned short utf8_to_euc_E996[] = {
0, 0, 0x315C, 0, 0xE62F, 0, 0xE630, 0,
0, 0x6F66, 0xE631, 0x6F65, 0x6F64, 0xE632, 0x6F67, 0xE633,
};
+static const unsigned short utf8_to_euc_E996_x0213[] = {
+ 0x4C67, 0, 0x6F59, 0x412E, 0xE622, 0, 0xFB54, 0x6F5A,
+ 0xE623, 0x4A44, 0x6F5B, 0x332B, 0xFB55, 0xFB56, 0x7D4E, 0x313C,
+ 0, 0x3457, 0xF471, 0x3456, 0x6F5C, 0, 0x6F5D, 0,
+ 0x6F5E, 0x6F5F, 0, 0, 0, 0xE627, 0xE628, 0x7D4F,
+ 0x6F60, 0xE62A, 0x3458, 0x3355, 0x395E, 0x4836, 0x7D50, 0x6F62,
+ 0x6F61, 0x7D51, 0, 0xFB58, 0x7D52, 0x6F63, 0, 0,
+ 0, 0, 0x315C, 0, 0xFB59, 0, 0x7D53, 0,
+ 0, 0x6F66, 0xE631, 0x6F65, 0x6F64, 0x7D54, 0x6F67, 0xE633,
+};
static const unsigned short utf8_to_euc_E997[] = {
0, 0, 0, 0x6F6A, 0, 0, 0xE634, 0x3047,
0xE635, 0xE636, 0x6F68, 0xE637, 0x6F6C, 0x6F6B, 0, 0,
@@ -5839,6 +11027,16 @@ static const unsigned short utf8_to_euc_E997[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
};
+static const unsigned short utf8_to_euc_E997_x0213[] = {
+ 0, 0, 0, 0x6F6A, 0, 0, 0xE634, 0x3047,
+ 0xFB5B, 0xE636, 0x6F68, 0x7D55, 0x6F6C, 0x6F6B, 0, 0,
+ 0x7D56, 0xE639, 0xE63A, 0x7D57, 0x6F6E, 0x6F6D, 0x6F6F, 0,
+ 0x462E, 0xE63C, 0x7D59, 0, 0x6F70, 0xE63E, 0x7D5A, 0xE640,
+ 0xE641, 0x6F71, 0x6F73, 0, 0xE642, 0x6F72, 0xE643, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+};
static const unsigned short utf8_to_euc_E998[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
@@ -5849,6 +11047,16 @@ static const unsigned short utf8_to_euc_E998[] = {
0, 0xE64B, 0x4B49, 0xE64C, 0, 0, 0, 0xE64D,
0xE64E, 0xE64F, 0xE650, 0x414B, 0xE651, 0xE652, 0, 0x3024,
};
+static const unsigned short utf8_to_euc_E998_x0213[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0x496C, 0xFA25, 0xE645, 0,
+ 0, 0x6F74, 0xE646, 0, 0xE647, 0xE648, 0xE649, 0,
+ 0x6F75, 0, 0x3A65, 0, 0xFB5E, 0, 0x6F76, 0x6F77,
+ 0, 0xE64B, 0x4B49, 0xFB5F, 0xFB60, 0, 0, 0xE64D,
+ 0xE64E, 0xE64F, 0xE650, 0x414B, 0xFB62, 0xE652, 0, 0x3024,
+};
static const unsigned short utf8_to_euc_E999[] = {
0x424B, 0xE653, 0x6F78, 0, 0x496D, 0, 0, 0,
0, 0, 0, 0x6F7B, 0x6F79, 0x395F, 0, 0x6F7A,
@@ -5859,6 +11067,16 @@ static const unsigned short utf8_to_euc_E999[] = {
0x3122, 0, 0x7024, 0x4444, 0xE65B, 0x4E4D, 0x462B, 0x6F7C,
0x4E26, 0, 0x3831, 0xE65C, 0xE65D, 0x4D5B, 0xE65E, 0xE65F,
};
+static const unsigned short utf8_to_euc_E999_x0213[] = {
+ 0x424B, 0xFB63, 0x6F78, 0, 0x496D, 0, 0, 0,
+ 0, 0, 0, 0x6F7B, 0x6F79, 0x395F, 0, 0x6F7A,
+ 0x3842, 0, 0xE654, 0, 0xE655, 0, 0xE656, 0xE657,
+ 0x7D5B, 0, 0, 0x4A45, 0x6F7D, 0x7021, 0x6F7E, 0x7022,
+ 0, 0xFB64, 0x3121, 0x3F58, 0x3D7C, 0x3459, 0x7023, 0,
+ 0, 0, 0x4766, 0, 0x7025, 0, 0xE65A, 0,
+ 0x3122, 0, 0x7024, 0x4444, 0xE65B, 0x4E4D, 0x462B, 0x6F7C,
+ 0x4E26, 0, 0x3831, 0xE65C, 0xE65D, 0x4D5B, 0xE65E, 0xE65F,
+};
static const unsigned short utf8_to_euc_E99A[] = {
0, 0xE660, 0xE661, 0xE662, 0xE663, 0x3679, 0x4E34, 0,
0x3728, 0xE664, 0x4262, 0x6721, 0, 0x7026, 0x332C, 0x3F6F,
@@ -5869,6 +11087,16 @@ static const unsigned short utf8_to_euc_E99A[] = {
0x702E, 0x702C, 0x702D, 0xE670, 0x702F, 0, 0x7030, 0x4E6C,
0x7031, 0x7032, 0xE671, 0x4049, 0x483B, 0, 0, 0,
};
+static const unsigned short utf8_to_euc_E99A_x0213[] = {
+ 0, 0xE660, 0xFB66, 0xE662, 0x7D5C, 0x3679, 0x4E34, 0,
+ 0x3728, 0xE664, 0x4262, 0x6721, 0, 0x7026, 0x332C, 0x3F6F,
+ 0, 0xE665, 0, 0, 0x3356, 0x7028, 0xE666, 0x7029,
+ 0x7027, 0x3764, 0xFB68, 0x3A5D, 0x3E63, 0x7D5E, 0, 0xE669,
+ 0x3123, 0, 0, 0x4E59, 0x7D5F, 0x7D60, 0xE66C, 0x702B,
+ 0x6E2E, 0xFB6B, 0x702A, 0, 0, 0, 0xE66E, 0xFB6C,
+ 0x702E, 0x702C, 0x702D, 0xFB6D, 0x702F, 0, 0x7030, 0x4E6C,
+ 0x7031, 0x7032, 0xFB6E, 0x4049, 0x483B, 0xFB6F, 0, 0,
+};
static const unsigned short utf8_to_euc_E99B[] = {
0x3F7D, 0x3467, 0, 0, 0x4D3A, 0x326D, 0x3D38, 0x385B,
0, 0x7035, 0xE672, 0x7034, 0x3B73, 0x7036, 0x7033, 0,
@@ -5879,6 +11107,16 @@ static const unsigned short utf8_to_euc_E99B[] = {
0x4A37, 0xE67C, 0x3140, 0, 0, 0, 0x4E6D, 0x4D6B,
0, 0x703B, 0xE67D, 0x4545, 0, 0, 0, 0,
};
+static const unsigned short utf8_to_euc_E99B_x0213[] = {
+ 0x3F7D, 0x3467, 0, 0, 0x4D3A, 0x326D, 0x3D38, 0x385B,
+ 0, 0x7035, 0xE672, 0x7034, 0x3B73, 0x7036, 0x7033, 0,
+ 0, 0x3B28, 0x7D61, 0, 0, 0x703A, 0x6A2D, 0,
+ 0xFB72, 0x5256, 0xFB73, 0x3F77, 0x7038, 0xFB74, 0x7D62, 0xE679,
+ 0, 0, 0x4E25, 0x4671, 0, 0, 0, 0,
+ 0x312B, 0x7D64, 0x4063, 0x3C36, 0, 0, 0, 0x7D65,
+ 0x4A37, 0xE67C, 0x3140, 0, 0, 0, 0x4E6D, 0x4D6B,
+ 0, 0x703B, 0xE67D, 0x4545, 0, 0, 0, 0,
+};
static const unsigned short utf8_to_euc_E99C[] = {
0x3C7B, 0, 0xE67E, 0xE721, 0x703C, 0xE722, 0x703D, 0x3F4C,
0x703E, 0xE723, 0x4E6E, 0, 0, 0x7039, 0x7040, 0x7042,
@@ -5889,6 +11127,16 @@ static const unsigned short utf8_to_euc_E99C[] = {
0x7047, 0xE72B, 0x4F2A, 0xE72C, 0, 0, 0, 0,
0x5B31, 0x7048, 0, 0xF474, 0, 0x7049, 0x704A, 0,
};
+static const unsigned short utf8_to_euc_E99C_x0213[] = {
+ 0x3C7B, 0, 0xE67E, 0xE721, 0x703C, 0xE722, 0x703D, 0x3F4C,
+ 0x703E, 0xE723, 0x4E6E, 0, 0, 0x7039, 0x7040, 0x7042,
+ 0, 0x7041, 0, 0x703F, 0xFB76, 0, 0x7043, 0,
+ 0, 0x7044, 0xE724, 0xE725, 0x417A, 0xE726, 0x3262, 0,
+ 0, 0xE727, 0xE728, 0xFB77, 0x7045, 0, 0, 0x4C38,
+ 0xE72A, 0, 0x7046, 0, 0, 0, 0, 0,
+ 0x7047, 0xE72B, 0x4F2A, 0x7D66, 0, 0, 0xFB79, 0,
+ 0x5B31, 0x7048, 0, 0x7D67, 0, 0x7049, 0x704A, 0,
+};
static const unsigned short utf8_to_euc_E99D[] = {
0, 0xE72D, 0x704E, 0xE72E, 0x704B, 0, 0x704C, 0,
0x704D, 0x704F, 0xE72F, 0, 0, 0xF475, 0xE730, 0xE731,
@@ -5899,6 +11147,16 @@ static const unsigned short utf8_to_euc_E99D[] = {
0, 0x7057, 0, 0xE73B, 0x3724, 0, 0xE73C, 0xE73D,
0xE73E, 0x7058, 0x705C, 0xE73F, 0x705A, 0xE740, 0, 0xE741,
};
+static const unsigned short utf8_to_euc_E99D_x0213[] = {
+ 0, 0xFB7A, 0x704E, 0xE72E, 0x704B, 0, 0x704C, 0xFB7B,
+ 0x704D, 0x704F, 0xE72F, 0, 0, 0x7D68, 0x7D69, 0x7D6A,
+ 0, 0xF476, 0x4044, 0, 0, 0xFB7C, 0x4C77, 0xFB7D,
+ 0xE734, 0x4045, 0x7D6B, 0xFB7E, 0x7050, 0, 0x4873, 0,
+ 0x7051, 0x7353, 0x4C4C, 0xE737, 0x7052, 0, 0x7053, 0xE738,
+ 0x7054, 0x3357, 0xFC21, 0x7056, 0, 0x3F59, 0x7D6C, 0,
+ 0, 0x7057, 0, 0x7D6D, 0x3724, 0, 0xE73C, 0xE73D,
+ 0xE73E, 0x7058, 0x705C, 0xE73F, 0x705A, 0xE740, 0, 0xE741,
+};
static const unsigned short utf8_to_euc_E99E[] = {
0xE742, 0x705B, 0, 0, 0x3373, 0x7059, 0x705D, 0,
0, 0xE743, 0, 0x705E, 0, 0x3048, 0, 0x705F,
@@ -5909,6 +11167,16 @@ static const unsigned short utf8_to_euc_E99E[] = {
0, 0xE74E, 0xE74F, 0x7065, 0x7066, 0xE750, 0xE751, 0,
0xE752, 0xE753, 0xE754, 0, 0xE755, 0, 0xE756, 0xE757,
};
+static const unsigned short utf8_to_euc_E99E_x0213[] = {
+ 0xE742, 0x705B, 0, 0, 0x3373, 0x7059, 0x705D, 0,
+ 0, 0xE743, 0, 0x705E, 0, 0x3048, 0, 0x705F,
+ 0x7060, 0, 0, 0, 0, 0x7D6E, 0xFC24, 0xE746,
+ 0x3E64, 0xE747, 0xFC25, 0, 0x7061, 0, 0xFC26, 0xE74A,
+ 0x3547, 0, 0xFC27, 0x7064, 0, 0, 0x7063, 0,
+ 0x7062, 0, 0, 0x6B71, 0xE74C, 0x4A5C, 0x7D6F, 0,
+ 0, 0xFC28, 0xFC29, 0x7065, 0x7066, 0xE750, 0xE751, 0,
+ 0xE752, 0xE753, 0x7D70, 0, 0xE755, 0, 0xFC2A, 0xE757,
+};
static const unsigned short utf8_to_euc_E99F[] = {
0, 0xE758, 0, 0x7067, 0xE759, 0xE75A, 0x7068, 0xE75B,
0x7069, 0xE75C, 0xE75D, 0x706A, 0xE75E, 0xE75F, 0xE760, 0,
@@ -5919,6 +11187,16 @@ static const unsigned short utf8_to_euc_E99F[] = {
0, 0xE76E, 0x706E, 0x323B, 0xE76F, 0x7071, 0x7070, 0xE770,
0xE771, 0, 0xE772, 0x3124, 0, 0, 0, 0x3641,
};
+static const unsigned short utf8_to_euc_E99F_x0213[] = {
+ 0, 0x7D71, 0, 0x7067, 0xE759, 0xE75A, 0x7068, 0xE75B,
+ 0x7069, 0x7D72, 0xE75D, 0x706A, 0xFC2B, 0xE75F, 0xE760, 0,
+ 0xE761, 0xFC2C, 0, 0x345A, 0xFC2D, 0, 0, 0xE764,
+ 0xFC2E, 0xFC2F, 0, 0x7D74, 0x706B, 0xE767, 0x7D73, 0,
+ 0xE769, 0xFC30, 0, 0, 0xE76C, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0x706C, 0x4723, 0xE76D,
+ 0, 0xFC31, 0x706E, 0x323B, 0x7D75, 0x7071, 0x7070, 0xE770,
+ 0xE771, 0, 0xE772, 0x3124, 0, 0, 0, 0x3641,
+};
static const unsigned short utf8_to_euc_E9A0[] = {
0, 0x4A47, 0x443A, 0x3A22, 0, 0x3960, 0x3D67, 0xE773,
0x3F5C, 0, 0xE774, 0, 0x7073, 0xE776, 0xE777, 0x7072,
@@ -5929,6 +11207,16 @@ static const unsigned short utf8_to_euc_E9A0[] = {
0xE824, 0, 0xE825, 0xE826, 0x3150, 0xE827, 0, 0x7077,
0x7074, 0, 0, 0x4951, 0x4D6A, 0x7078, 0xE829, 0,
};
+static const unsigned short utf8_to_euc_E9A0_x0213[] = {
+ 0, 0x4A47, 0x443A, 0x3A22, 0xFC32, 0x3960, 0x3D67, 0xE773,
+ 0x3F5C, 0, 0x7D77, 0, 0x7073, 0xFC33, 0xFC34, 0x7072,
+ 0x4D42, 0x3468, 0x4852, 0x465C, 0xFC35, 0, 0xFC36, 0x3F7C,
+ 0x4E4E, 0xE775, 0x375B, 0, 0xE77A, 0, 0x7D78, 0,
+ 0xE77C, 0x7076, 0, 0xFC39, 0x7075, 0xFC3C, 0xE77E, 0,
+ 0, 0, 0, 0x7D79, 0x4B4B, 0x462C, 0xE822, 0xE823,
+ 0x7D7A, 0, 0xFC3A, 0xFC3B, 0x3150, 0xE827, 0, 0x7077,
+ 0x7074, 0, 0, 0x4951, 0x4D6A, 0x7078, 0xE829, 0,
+};
static const unsigned short utf8_to_euc_E9A1[] = {
0, 0, 0, 0, 0xE82A, 0, 0x7079, 0xE82B,
0, 0, 0xE82C, 0x707B, 0x426A, 0x335B, 0x335C, 0x707A,
@@ -5939,6 +11227,16 @@ static const unsigned short utf8_to_euc_E9A1[] = {
0x707E, 0x7121, 0, 0x7123, 0x7122, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
};
+static const unsigned short utf8_to_euc_E9A1_x0213[] = {
+ 0, 0, 0, 0, 0xE82A, 0, 0x7079, 0xFC3D,
+ 0, 0, 0xE82C, 0x707B, 0x426A, 0x335B, 0x335C, 0x707A,
+ 0, 0xE82D, 0x7D7C, 0x7D7D, 0x3469, 0x3832, 0x7D7E, 0x7E21,
+ 0x346A, 0x7E22, 0x7E23, 0x453F, 0, 0, 0x4E60, 0,
+ 0, 0, 0xE834, 0xE835, 0, 0x7E25, 0xFC3E, 0x385C,
+ 0, 0, 0xE838, 0x707C, 0x7E26, 0, 0, 0x707D,
+ 0x707E, 0x7121, 0, 0x7123, 0x7122, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+};
static const unsigned short utf8_to_euc_E9A2[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
@@ -5949,6 +11247,16 @@ static const unsigned short utf8_to_euc_E9A2[] = {
0xE83D, 0x7126, 0, 0, 0xE83E, 0, 0x7127, 0xE83F,
0xE840, 0, 0xE841, 0xE842, 0, 0, 0, 0xE843,
};
+static const unsigned short utf8_to_euc_E9A2_x0213[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0x4977, 0, 0x7124, 0xFC3F, 0, 0xFC40, 0xE83C, 0x7125,
+ 0xFC41, 0x7126, 0, 0, 0xE83E, 0, 0x7127, 0xFC43,
+ 0xFC44, 0, 0x7E27, 0xFC45, 0xFC46, 0, 0, 0xFC47,
+};
static const unsigned short utf8_to_euc_E9A3[] = {
0, 0, 0xE844, 0x7129, 0x7128, 0xE845, 0x712A, 0,
0xE846, 0, 0, 0, 0xE847, 0, 0, 0,
@@ -5959,6 +11267,16 @@ static const unsigned short utf8_to_euc_E9A3[] = {
0, 0, 0x307B, 0xE84E, 0x303B, 0, 0xE84F, 0,
0, 0, 0, 0, 0x3B74, 0x4B30, 0x3E7E, 0,
};
+static const unsigned short utf8_to_euc_E9A3_x0213[] = {
+ 0, 0, 0xFC48, 0x7129, 0x7128, 0xE845, 0x712A, 0xFC49,
+ 0x7E28, 0, 0, 0xFC4A, 0xE847, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0x4874, 0x664C, 0, 0, 0x3F29,
+ 0xFC4B, 0xFC4D, 0x3532, 0xFC4E, 0, 0xFC4F, 0xE84B, 0x7E29,
+ 0, 0x712B, 0xFC50, 0x712C, 0, 0x522C, 0x5D3B, 0x4853,
+ 0xFC51, 0xFC52, 0x307B, 0xFC53, 0x303B, 0, 0xE84F, 0,
+ 0, 0, 0, 0, 0x3B74, 0x4B30, 0x3E7E, 0,
+};
static const unsigned short utf8_to_euc_E9A4[] = {
0, 0, 0xE850, 0x712D, 0, 0x4C5F, 0, 0xE851,
0xE852, 0x712E, 0x4D5C, 0, 0x3142, 0, 0, 0,
@@ -5969,6 +11287,16 @@ static const unsigned short utf8_to_euc_E9A4[] = {
0, 0xE85F, 0xE860, 0xE861, 0xE862, 0xE863, 0, 0,
0, 0xE864, 0xE865, 0xE866, 0xE867, 0x7139, 0x713A, 0,
};
+static const unsigned short utf8_to_euc_E9A4_x0213[] = {
+ 0, 0, 0xE850, 0x712D, 0, 0x4C5F, 0, 0xE851,
+ 0xFC54, 0x712E, 0x4D5C, 0, 0x3142, 0, 0, 0,
+ 0x3B41, 0xE853, 0x712F, 0x326E, 0x7130, 0xE854, 0xFC57, 0xFC58,
+ 0x7131, 0, 0xFC5A, 0xFC5B, 0xFC5C, 0x7133, 0x7134, 0xE85A,
+ 0x7136, 0x7132, 0xE85B, 0, 0x7135, 0, 0xE85C, 0xE85D,
+ 0x345B, 0, 0, 0xE85E, 0x7137, 0, 0x7138, 0,
+ 0, 0xFC5E, 0xFC5F, 0xFC60, 0xE862, 0xE863, 0, 0,
+ 0, 0xE864, 0xFC61, 0xFC62, 0xFC63, 0x7139, 0x713A, 0,
+};
static const unsigned short utf8_to_euc_E9A5[] = {
0xE868, 0xE869, 0x713B, 0, 0, 0x713D, 0xE86A, 0xE86B,
0xE86C, 0x713C, 0, 0x713F, 0x7142, 0xE86D, 0xE86E, 0,
@@ -5979,6 +11307,16 @@ static const unsigned short utf8_to_euc_E9A5[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
};
+static const unsigned short utf8_to_euc_E9A5_x0213[] = {
+ 0xFC64, 0xFC65, 0x713B, 0, 0, 0x713D, 0xFC66, 0xE86B,
+ 0xE86C, 0x713C, 0, 0x713F, 0x7142, 0xFC67, 0xFC68, 0,
+ 0x713E, 0x7140, 0x7141, 0, 0xE86F, 0x7143, 0, 0x3642,
+ 0x7E2A, 0xE871, 0, 0xE872, 0xFC69, 0, 0xE874, 0xFC6A,
+ 0xFC6B, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+};
static const unsigned short utf8_to_euc_E9A6[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
@@ -5989,6 +11327,16 @@ static const unsigned short utf8_to_euc_E9A6[] = {
0xE87B, 0xE87C, 0xE87D, 0x435A, 0x466B, 0xE87E, 0, 0,
0, 0xE921, 0xE922, 0, 0x7149, 0xE923, 0, 0xE924,
};
+static const unsigned short utf8_to_euc_E9A6_x0213[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0x3C73, 0x7144,
+ 0x7145, 0x3961, 0, 0xE877, 0, 0xE878, 0x7E2B, 0xE879,
+ 0, 0, 0, 0xFC6C, 0, 0x7146, 0xFC6D, 0,
+ 0x333E, 0, 0, 0, 0x474F, 0x7147, 0x7148, 0,
+ 0xE87B, 0xE87C, 0xE87D, 0x435A, 0x466B, 0xE87E, 0, 0,
+ 0, 0xFC6E, 0xE922, 0, 0x7149, 0xFC6F, 0, 0xFC70,
+};
static const unsigned short utf8_to_euc_E9A7[] = {
0, 0x477D, 0, 0xE925, 0x424C, 0x3158, 0x366E, 0,
0x366F, 0xE926, 0, 0, 0, 0, 0, 0,
@@ -5999,6 +11347,16 @@ static const unsigned short utf8_to_euc_E9A7[] = {
0xE931, 0x7151, 0x7152, 0, 0xE932, 0xE933, 0, 0,
0x7154, 0xE934, 0, 0x7153, 0, 0xE935, 0xE936, 0x3D59,
};
+static const unsigned short utf8_to_euc_E9A7_x0213[] = {
+ 0, 0x477D, 0, 0xFC71, 0x424C, 0x3158, 0x366E, 0,
+ 0x366F, 0xFC72, 0, 0, 0, 0, 0, 0,
+ 0x4373, 0x714E, 0x3670, 0xE927, 0xFC73, 0x326F, 0, 0,
+ 0x714D, 0xFC74, 0xE92A, 0x714B, 0xE92B, 0x714C, 0xFC75, 0x714A,
+ 0, 0, 0x7158, 0, 0, 0, 0, 0xE92D,
+ 0, 0, 0xE92E, 0xE92F, 0xE930, 0x714F, 0x7150, 0,
+ 0xFC77, 0x7151, 0x7152, 0, 0xE932, 0xE933, 0, 0,
+ 0x7154, 0xFC78, 0, 0x7153, 0xFC79, 0xE935, 0xE936, 0x3D59,
+};
static const unsigned short utf8_to_euc_E9A8[] = {
0, 0x7155, 0xE937, 0xE938, 0xE939, 0x7157, 0, 0,
0, 0, 0, 0xE93A, 0xE93B, 0, 0x3533, 0x7156,
@@ -6009,6 +11367,16 @@ static const unsigned short utf8_to_euc_E9A8[] = {
0x462D, 0, 0, 0xE947, 0, 0xE948, 0xE949, 0x715B,
0xE94A, 0, 0, 0, 0, 0, 0x7160, 0,
};
+static const unsigned short utf8_to_euc_E9A8_x0213[] = {
+ 0, 0x7155, 0x7E2C, 0x7E2D, 0xE939, 0x7157, 0, 0,
+ 0, 0, 0xFC7A, 0xE93A, 0xE93B, 0, 0x3533, 0x7156,
+ 0xE93C, 0xFC7B, 0x417B, 0x3833, 0, 0, 0xFC7C, 0,
+ 0, 0x7159, 0xFC7D, 0, 0, 0, 0xE93F, 0,
+ 0xFC7E, 0, 0xE941, 0xE942, 0x7E2E, 0, 0, 0xE944,
+ 0x424D, 0, 0, 0x715A, 0, 0x7E2F, 0x7E30, 0,
+ 0x462D, 0xFD21, 0, 0xE947, 0, 0xE948, 0xFD22, 0x715B,
+ 0x7E31, 0, 0, 0, 0, 0, 0x7160, 0,
+};
static const unsigned short utf8_to_euc_E9A9[] = {
0x715E, 0xE94C, 0x715D, 0x715F, 0xE94D, 0x715C, 0, 0xE94B,
0, 0, 0xE94E, 0xE94F, 0xE950, 0x7162, 0xE951, 0,
@@ -6019,6 +11387,16 @@ static const unsigned short utf8_to_euc_E9A9[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
};
+static const unsigned short utf8_to_euc_E9A9_x0213[] = {
+ 0x715E, 0xE94C, 0x715D, 0x715F, 0xFD23, 0x715C, 0, 0xE94B,
+ 0, 0, 0x7E32, 0xE94F, 0xFD24, 0x7162, 0x7E33, 0,
+ 0, 0xE952, 0x7E34, 0, 0xE953, 0x7161, 0xE954, 0x7164,
+ 0xFD25, 0, 0x3643, 0x7163, 0, 0xE955, 0, 0x7165,
+ 0, 0, 0x7166, 0, 0x7168, 0x7167, 0, 0,
+ 0, 0x7169, 0x716B, 0x716A, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+};
static const unsigned short utf8_to_euc_E9AA[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
@@ -6029,6 +11407,16 @@ static const unsigned short utf8_to_euc_E9AA[] = {
0x716D, 0, 0xE95A, 0, 0xE95B, 0xE95C, 0xE95D, 0,
0x333C, 0xE95E, 0, 0xE95F, 0x716E, 0, 0xE960, 0xE961,
};
+static const unsigned short utf8_to_euc_E9AA_x0213[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0x397C, 0, 0xE956, 0, 0xE957, 0x716C, 0xE958, 0xFD27,
+ 0x716D, 0, 0xE95A, 0, 0xE95B, 0xE95C, 0x7E35, 0xFD29,
+ 0x333C, 0xFD2B, 0, 0xE95F, 0x716E, 0, 0xE960, 0xE961,
+};
static const unsigned short utf8_to_euc_E9AB[] = {
0x716F, 0xE962, 0, 0xE963, 0x3F71, 0, 0xE964, 0,
0xE965, 0, 0, 0, 0, 0, 0xE966, 0x7170,
@@ -6039,6 +11427,16 @@ static const unsigned short utf8_to_euc_E9AB[] = {
0, 0x717D, 0xE974, 0xE975, 0x717C, 0xE976, 0, 0x717E,
0, 0xE977, 0xE978, 0x7221, 0, 0xE979, 0, 0xE97A,
};
+static const unsigned short utf8_to_euc_E9AB_x0213[] = {
+ 0x716F, 0x7E36, 0, 0x7E37, 0x3F71, 0, 0xFD2D, 0,
+ 0xE965, 0, 0, 0, 0, 0, 0x7E38, 0x7170,
+ 0xFD2E, 0x7171, 0xFD2F, 0x7172, 0x7173, 0xFD30, 0x7E39, 0xE96B,
+ 0x3962, 0xF47B, 0, 0xE96C, 0xFD32, 0, 0x7174, 0x7175,
+ 0xFD33, 0, 0x7176, 0x7177, 0xE96F, 0xFD34, 0x7178, 0xE971,
+ 0, 0xFD35, 0x4831, 0x717A, 0xE973, 0x4926, 0x717B, 0x7179,
+ 0, 0x717D, 0xE974, 0xE975, 0x717C, 0xE976, 0, 0x717E,
+ 0, 0x7E3A, 0xE978, 0x7221, 0, 0xE979, 0, 0xE97A,
+};
static const unsigned short utf8_to_euc_E9AC[] = {
0xE97B, 0xE97C, 0xE97D, 0xE97E, 0xEA21, 0xEA22, 0x7222, 0,
0xEA23, 0xEA24, 0, 0xEA25, 0xEA26, 0xEA27, 0xEA28, 0,
@@ -6049,6 +11447,16 @@ static const unsigned short utf8_to_euc_E9AC[] = {
0, 0x5D35, 0x722F, 0xEA33, 0xEA34, 0xEA35, 0, 0xEA36,
0, 0xEA37, 0xEA38, 0x6478, 0x3534, 0xEA39, 0, 0,
};
+static const unsigned short utf8_to_euc_E9AC_x0213[] = {
+ 0xE97B, 0xE97C, 0x7E3B, 0xFD36, 0xEA21, 0xEA22, 0x7222, 0,
+ 0x7E3C, 0xEA24, 0, 0xEA25, 0xFD37, 0xEA27, 0xEA28, 0,
+ 0xFD38, 0, 0xFD39, 0, 0, 0, 0xFD3A, 0,
+ 0x7223, 0xEA2C, 0x7224, 0xEA2D, 0xFD3B, 0, 0, 0x7225,
+ 0x7E3D, 0, 0x7226, 0x7227, 0, 0x7228, 0xEA30, 0x7229,
+ 0x722A, 0x722B, 0x722C, 0xFD3C, 0, 0x7E3F, 0x722D, 0x722E,
+ 0, 0x5D35, 0x722F, 0xFD3D, 0xEA34, 0xEA35, 0, 0xEA36,
+ 0, 0xEA37, 0xEA38, 0x6478, 0x3534, 0xFD3E, 0, 0,
+};
static const unsigned short utf8_to_euc_E9AD[] = {
0, 0x3321, 0x3A32, 0x7231, 0x7230, 0x4C25, 0, 0,
0xEA3A, 0, 0, 0xEA3B, 0xEA3C, 0x7233, 0x7234, 0x7232,
@@ -6059,6 +11467,16 @@ static const unsigned short utf8_to_euc_E9AD[] = {
0, 0, 0xF47C, 0xEA4C, 0x7237, 0xEA4D, 0, 0xEA4E,
0xEA4F, 0xEA50, 0, 0, 0, 0, 0, 0xEA51,
};
+static const unsigned short utf8_to_euc_E9AD_x0213[] = {
+ 0, 0x3321, 0x3A32, 0x7231, 0x7230, 0x4C25, 0, 0,
+ 0xEA3A, 0, 0, 0xFD40, 0xEA3C, 0x7233, 0x7234, 0x7232,
+ 0, 0x7235, 0, 0, 0x4B62, 0xEA3D, 0xEA3E, 0xEA3F,
+ 0x7236, 0, 0x357B, 0xEA40, 0, 0, 0x7E40, 0,
+ 0, 0xEA42, 0, 0xFD41, 0, 0xFD42, 0x7E42, 0,
+ 0xEA46, 0, 0xEA47, 0xFD43, 0xFD44, 0xEA4A, 0xEA4B, 0x4F25,
+ 0, 0, 0x7E43, 0xFD45, 0x7237, 0x7E44, 0xFD46, 0xFD47,
+ 0xEA4F, 0x7E41, 0, 0, 0, 0, 0, 0xEA51,
+};
static const unsigned short utf8_to_euc_E9AE[] = {
0xEA52, 0, 0, 0x7239, 0xEA53, 0xEA54, 0xEA55, 0xEA56,
0, 0xEA57, 0xEA58, 0xEA59, 0, 0xEA5A, 0x303E, 0xEA5B,
@@ -6069,6 +11487,16 @@ static const unsigned short utf8_to_euc_E9AE[] = {
0xEA65, 0xEA66, 0xEA67, 0, 0x7240, 0, 0, 0xEA68,
0xEA69, 0x7243, 0, 0xEA6A, 0xEA6B, 0, 0xEA6C, 0xEA6D,
};
+static const unsigned short utf8_to_euc_E9AE_x0213[] = {
+ 0xEA52, 0, 0, 0x7239, 0x7E45, 0xEA54, 0xEA55, 0xEA56,
+ 0, 0xEA57, 0x7E46, 0xEA59, 0, 0xEA5A, 0x303E, 0x7E47,
+ 0xEA5C, 0x723A, 0x4A2B, 0x7238, 0xEA5D, 0, 0x723B, 0x723C,
+ 0, 0, 0xEA5E, 0, 0, 0xEA5F, 0x7E48, 0x723D,
+ 0x723E, 0, 0, 0, 0, 0, 0xFD48, 0x7E49,
+ 0x723F, 0xEA63, 0x4B6E, 0x3B2D, 0xFD49, 0x3A7A, 0x412F, 0,
+ 0xEA65, 0xFD4A, 0xFD4D, 0, 0x7240, 0, 0, 0xEA68,
+ 0xFD4E, 0x7243, 0, 0xEA6A, 0xEA6B, 0, 0xFD4F, 0xEA6D,
+};
static const unsigned short utf8_to_euc_E9AF[] = {
0x7241, 0xEA6E, 0, 0, 0, 0, 0x7244, 0xEA6F,
0xEA70, 0x3871, 0x7242, 0, 0, 0, 0xEA71, 0x7245,
@@ -6079,6 +11507,16 @@ static const unsigned short utf8_to_euc_E9AF[] = {
0x7250, 0x724F, 0x724E, 0xEA7C, 0, 0x3033, 0, 0xEA7D,
0xEA7E, 0xEB21, 0xEB22, 0, 0, 0xEB23, 0, 0xEB24,
};
+static const unsigned short utf8_to_euc_E9AF_x0213[] = {
+ 0x7241, 0x7E4A, 0, 0, 0, 0, 0x7244, 0xFD50,
+ 0xEA70, 0x3871, 0x7242, 0, 0, 0, 0x7E4B, 0x7245,
+ 0xEA72, 0x7246, 0x7247, 0, 0x724B, 0, 0x3B2A, 0xEA73,
+ 0xFD52, 0, 0, 0x4264, 0, 0xFD53, 0, 0xEA76,
+ 0, 0x724C, 0x7249, 0x7248, 0x724A, 0x7E4C, 0, 0xFD54,
+ 0x375F, 0, 0xFD55, 0xFD56, 0, 0, 0xFD58, 0xFD57,
+ 0x7250, 0x724F, 0x724E, 0xFD51, 0, 0x3033, 0, 0xFD5C,
+ 0x7E4D, 0xEB21, 0xFD5A, 0, 0, 0x7E4E, 0, 0xEB24,
+};
static const unsigned short utf8_to_euc_E9B0[] = {
0xEB25, 0, 0xEB26, 0, 0x725A, 0, 0x7256, 0,
0x7257, 0x7253, 0x7259, 0xEB27, 0x7255, 0x3362, 0, 0xEB28,
@@ -6089,6 +11527,16 @@ static const unsigned short utf8_to_euc_E9B0[] = {
0x7260, 0xEB37, 0x7262, 0, 0, 0xEB38, 0xEB39, 0xEB3A,
0, 0x336F, 0x724D, 0x3137, 0, 0xEB3B, 0x7264, 0,
};
+static const unsigned short utf8_to_euc_E9B0_x0213[] = {
+ 0x7E4F, 0, 0xEB26, 0, 0x725A, 0, 0x7256, 0,
+ 0x7257, 0x7253, 0x7259, 0xEB27, 0x7255, 0x3362, 0, 0xEB28,
+ 0x4F4C, 0xEB29, 0x7258, 0x7254, 0x7252, 0x7251, 0xFD5E, 0,
+ 0xFD5F, 0xFD60, 0xFD61, 0x725C, 0xEB2E, 0xFD62, 0xEB2F, 0,
+ 0, 0x725F, 0xFD63, 0x7E50, 0x725E, 0x725D, 0xEB32, 0xFD64,
+ 0xEB34, 0xFD65, 0xFD66, 0, 0, 0x4949, 0x725B, 0x3073,
+ 0x7260, 0xFD68, 0x7262, 0, 0, 0xEB38, 0xFD69, 0xFD6A,
+ 0, 0x336F, 0x724D, 0x3137, 0, 0xEB3B, 0x7264, 0,
+};
static const unsigned short utf8_to_euc_E9B1[] = {
0, 0xEB3C, 0, 0xEB3D, 0xEB3E, 0xEB3F, 0x7263, 0x7261,
0x432D, 0xEB40, 0xEB41, 0, 0, 0, 0xEB42, 0xEB43,
@@ -6099,6 +11547,16 @@ static const unsigned short utf8_to_euc_E9B1[] = {
0xEB54, 0, 0xEB55, 0, 0, 0xEB56, 0x7268, 0xEB57,
0x7269, 0, 0, 0xEB58, 0, 0, 0, 0,
};
+static const unsigned short utf8_to_euc_E9B1_x0213[] = {
+ 0, 0x7E51, 0, 0xEB3D, 0xEB3E, 0xFD6B, 0x7263, 0x7261,
+ 0x432D, 0xFD6E, 0xFD6F, 0, 0, 0, 0xEB42, 0x7E52,
+ 0x7E53, 0, 0x4B70, 0x7E54, 0xFD71, 0, 0xEB47, 0x4E5A,
+ 0xFD72, 0, 0x7265, 0xFD73, 0xFD6C, 0xFD74, 0xEB4B, 0xFD75,
+ 0x7266, 0, 0, 0x7E55, 0, 0x7E56, 0, 0x7267,
+ 0xEB52, 0xFD76, 0xFD77, 0xFD78, 0, 0xFD79, 0xFD7A, 0,
+ 0xFD7B, 0, 0xFD7C, 0, 0, 0xFD7D, 0x7268, 0x7E57,
+ 0x7269, 0, 0xFD7E, 0xEB58, 0, 0, 0, 0,
+};
static const unsigned short utf8_to_euc_E9B3[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
@@ -6109,6 +11567,16 @@ static const unsigned short utf8_to_euc_E9B3[] = {
0x726C, 0, 0xEB5A, 0x4B31, 0x4C44, 0, 0x4650, 0xEB5B,
0, 0xEB5C, 0, 0, 0, 0, 0, 0,
};
+static const unsigned short utf8_to_euc_E9B3_x0213[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0x443B, 0xFE21, 0x726A,
+ 0, 0x4837, 0, 0x726F, 0x726B, 0, 0, 0,
+ 0x726C, 0, 0xFE22, 0x4B31, 0x4C44, 0, 0x4650, 0xEB5B,
+ 0, 0xEB5C, 0, 0, 0, 0, 0, 0,
+};
static const unsigned short utf8_to_euc_E9B4[] = {
0, 0, 0xEB5E, 0x7270, 0, 0, 0x7271, 0x463E,
0x726E, 0x726D, 0, 0xEB5D, 0, 0, 0x322A, 0,
@@ -6119,6 +11587,16 @@ static const unsigned short utf8_to_euc_E9B4[] = {
0xEB66, 0, 0xEB67, 0xEB68, 0xEB69, 0, 0, 0,
0, 0, 0xEB6A, 0x3963, 0xEB6B, 0xEB6D, 0x727C, 0x727B,
};
+static const unsigned short utf8_to_euc_E9B4_x0213[] = {
+ 0, 0, 0xFE24, 0x7270, 0, 0, 0x7271, 0x463E,
+ 0x726E, 0x726D, 0, 0xFE23, 0, 0, 0x322A, 0,
+ 0, 0xFE26, 0x7279, 0, 0, 0x7278, 0, 0xFE27,
+ 0xFE28, 0, 0, 0x3175, 0xEB62, 0x7E58, 0x7E59, 0x7276,
+ 0, 0, 0, 0x7275, 0, 0, 0x7273, 0,
+ 0x337B, 0, 0x7272, 0x3C32, 0x3229, 0, 0, 0xEB65,
+ 0xEB66, 0, 0xFE2C, 0xEB68, 0xEB69, 0, 0, 0,
+ 0, 0, 0xEB6A, 0x3963, 0xEB6B, 0xEB6D, 0x727C, 0x727B,
+};
static const unsigned short utf8_to_euc_E9B5[] = {
0, 0x727A, 0xEB6E, 0xEB6F, 0x7277, 0xEB6C, 0x727D, 0xEB70,
0x727E, 0, 0xEB71, 0, 0, 0, 0, 0,
@@ -6129,6 +11607,16 @@ static const unsigned short utf8_to_euc_E9B5[] = {
0xEB7B, 0, 0x7327, 0, 0, 0, 0xEB7C, 0xEB7D,
0, 0, 0x732C, 0xEB7E, 0xEC21, 0, 0xEC22, 0,
};
+static const unsigned short utf8_to_euc_E9B5_x0213[] = {
+ 0, 0x727A, 0xFE2E, 0x7E5A, 0x7277, 0xEB6C, 0x727D, 0x7E5B,
+ 0x727E, 0, 0xFE2F, 0, 0, 0, 0, 0,
+ 0x7325, 0x7324, 0x7E5C, 0xEB72, 0xEB73, 0, 0, 0,
+ 0, 0x7326, 0, 0, 0x312D, 0x7321, 0x7322, 0xFE30,
+ 0x3974, 0x4C39, 0xFE31, 0x7E5D, 0x7323, 0xEB77, 0, 0,
+ 0, 0xFE33, 0xEB79, 0xFE34, 0x4B32, 0, 0, 0x732B,
+ 0x7E5E, 0, 0x7327, 0xFE36, 0, 0, 0xFE37, 0xFE38,
+ 0, 0, 0x732C, 0xEB7E, 0x7E5F, 0, 0xFE39, 0,
+};
static const unsigned short utf8_to_euc_E9B6[] = {
0, 0, 0, 0xEC23, 0xEC24, 0, 0xEC25, 0x7329,
0, 0x7328, 0xEC26, 0, 0, 0xEC27, 0xEC28, 0x375C,
@@ -6139,6 +11627,16 @@ static const unsigned short utf8_to_euc_E9B6[] = {
0, 0xEC33, 0x7330, 0, 0x4461, 0xEC34, 0, 0,
0x7334, 0xEC35, 0x7335, 0x7333, 0xEC36, 0, 0, 0xEC37,
};
+static const unsigned short utf8_to_euc_E9B6_x0213[] = {
+ 0, 0, 0, 0xEC23, 0xFE3A, 0, 0xEC25, 0x7329,
+ 0, 0x7328, 0x7E60, 0, 0, 0xFE3B, 0xEC28, 0x375C,
+ 0, 0, 0xEC29, 0xEC2A, 0, 0xEC2B, 0x7E61, 0xEC2D,
+ 0xEC2E, 0xFE3C, 0x732D, 0, 0, 0, 0, 0,
+ 0, 0xFE3D, 0, 0, 0x732E, 0, 0, 0,
+ 0, 0x732F, 0xEC30, 0x732A, 0x7E63, 0, 0xEC32, 0x7274,
+ 0, 0xEC33, 0x7330, 0, 0x4461, 0xFE3F, 0, 0,
+ 0x7334, 0xFE40, 0x7335, 0x7333, 0x7E64, 0xFE41, 0, 0xFE3E,
+};
static const unsigned short utf8_to_euc_E9B7[] = {
0, 0x7332, 0x7338, 0xEC38, 0x7331, 0, 0x7336, 0xEC39,
0, 0xEC3A, 0xEC3B, 0, 0, 0, 0, 0x7337,
@@ -6149,6 +11647,16 @@ static const unsigned short utf8_to_euc_E9B7[] = {
0xEC49, 0, 0x4F49, 0xEC4A, 0xEC4B, 0, 0, 0,
0x733B, 0x426B, 0x3A6D, 0, 0, 0x733F, 0xEC4C, 0,
};
+static const unsigned short utf8_to_euc_E9B7_x0213[] = {
+ 0x7E62, 0x7332, 0x7338, 0xFE42, 0x7331, 0, 0x7336, 0xFE43,
+ 0, 0xFE44, 0xEC3B, 0, 0, 0, 0, 0x7337,
+ 0, 0, 0, 0x733A, 0xEC3C, 0xEC3D, 0xFE45, 0x7E65,
+ 0, 0x7339, 0xFE46, 0, 0, 0, 0xEC41, 0xFE47,
+ 0xFE48, 0, 0, 0xFE49, 0, 0xEC44, 0x733C, 0x7E67,
+ 0, 0xEC46, 0, 0xEC47, 0, 0x733D, 0xEC48, 0x733E,
+ 0xEC49, 0, 0x4F49, 0xEC4A, 0xFE4A, 0, 0, 0,
+ 0x733B, 0x426B, 0x3A6D, 0, 0, 0x733F, 0xEC4C, 0,
+};
static const unsigned short utf8_to_euc_E9B8[] = {
0, 0, 0xEC4E, 0, 0, 0, 0, 0xEC4F,
0, 0, 0xEC4D, 0, 0, 0, 0xEC50, 0,
@@ -6159,6 +11667,16 @@ static const unsigned short utf8_to_euc_E9B8[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
};
+static const unsigned short utf8_to_euc_E9B8_x0213[] = {
+ 0, 0, 0xFE4D, 0, 0, 0, 0, 0x7E68,
+ 0, 0, 0xFE4C, 0, 0, 0xFE4E, 0xEC50, 0,
+ 0xEC51, 0xEC52, 0xEC53, 0, 0, 0x7E69, 0xEC55, 0,
+ 0, 0xFE4F, 0x7340, 0x7341, 0xFE50, 0xFE51, 0x7342, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+};
static const unsigned short utf8_to_euc_E9B9[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
@@ -6169,6 +11687,16 @@ static const unsigned short utf8_to_euc_E9B9[] = {
0, 0, 0, 0, 0, 0x7343, 0, 0,
0x3834, 0x7344, 0xEC59, 0xEC5A, 0xEC5B, 0x7345, 0, 0x3C2F,
};
+static const unsigned short utf8_to_euc_E9B9_x0213[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0x7343, 0, 0,
+ 0x3834, 0x7344, 0xEC59, 0xFE52, 0x7E6A, 0x7345, 0, 0x3C2F,
+};
static const unsigned short utf8_to_euc_E9BA[] = {
0xEC5C, 0x7346, 0xEC5D, 0xEC5E, 0xEC5F, 0xEC60, 0, 0xEC61,
0x7347, 0, 0, 0x7348, 0x7349, 0, 0xEC62, 0xEC63,
@@ -6179,6 +11707,16 @@ static const unsigned short utf8_to_euc_E9BA[] = {
0xEC6D, 0, 0, 0xEC6E, 0xEC6F, 0xEC70, 0, 0,
0x7350, 0x396D, 0x4C4D, 0x4B63, 0x5677, 0, 0x5D60, 0x4B7B,
};
+static const unsigned short utf8_to_euc_E9BA_x0213[] = {
+ 0xFE54, 0x7346, 0xEC5D, 0xEC5E, 0xEC5F, 0xFE55, 0, 0xEC61,
+ 0x7347, 0, 0, 0x7348, 0x7349, 0, 0xEC62, 0xEC63,
+ 0, 0x734C, 0x734A, 0x4F3C, 0, 0x734B, 0xEC64, 0x4E6F,
+ 0xEC65, 0, 0, 0xFE56, 0, 0x734D, 0x7E6B, 0x4E5B,
+ 0, 0, 0, 0, 0x7E6C, 0x734E, 0x477E, 0,
+ 0xFE57, 0x734F, 0x7351, 0, 0x7E6D, 0x7352, 0xEC6B, 0x7E6E,
+ 0xEC6D, 0, 0, 0xEC6E, 0x7E6F, 0x7E70, 0, 0,
+ 0x7350, 0x396D, 0x4C4D, 0x4B63, 0x5677, 0xFE59, 0x5D60, 0x4B7B,
+};
static const unsigned short utf8_to_euc_E9BB[] = {
0, 0, 0, 0, 0x322B, 0, 0xEC71, 0,
0xEC72, 0, 0, 0xEC73, 0x7354, 0x3550, 0x7355, 0x7356,
@@ -6189,6 +11727,16 @@ static const unsigned short utf8_to_euc_E9BB[] = {
0xEC7B, 0xEC7C, 0xEC7D, 0, 0x7360, 0xEC7E, 0x7361, 0x7362,
0xED21, 0x7363, 0, 0x7364, 0x7365, 0x7366, 0, 0xED22,
};
+static const unsigned short utf8_to_euc_E9BB_x0213[] = {
+ 0, 0, 0, 0x7E71, 0x322B, 0, 0xEC71, 0,
+ 0xEC72, 0, 0, 0xEC73, 0x7354, 0x3550, 0x7355, 0x7356,
+ 0x7357, 0x7E72, 0x3975, 0, 0x7358, 0xEC74, 0, 0,
+ 0x6054, 0x4C5B, 0, 0x4263, 0x7359, 0x735B, 0x735A, 0xFE5B,
+ 0x735C, 0, 0, 0, 0xEC76, 0x735D, 0, 0xFE5C,
+ 0x735E, 0, 0, 0, 0xEC78, 0xEC79, 0xFE5D, 0x735F,
+ 0xEC7B, 0xEC7C, 0xEC7D, 0, 0x7360, 0xEC7E, 0x7361, 0x7362,
+ 0xED21, 0x7363, 0, 0x7364, 0x7365, 0x7366, 0, 0xFE5E,
+};
static const unsigned short utf8_to_euc_E9BC[] = {
0, 0, 0xED23, 0xED24, 0, 0, 0, 0x7367,
0x7368, 0xED25, 0, 0, 0, 0, 0x4524, 0xED26,
@@ -6199,6 +11747,16 @@ static const unsigned short utf8_to_euc_E9BC[] = {
0, 0xED36, 0xED37, 0, 0xED38, 0, 0, 0xED39,
0, 0xED3A, 0xED3B, 0x4921, 0xED3C, 0xED3D, 0x736D, 0xED3E,
};
+static const unsigned short utf8_to_euc_E9BC_x0213[] = {
+ 0, 0, 0xFE5F, 0xFE61, 0, 0, 0, 0x7367,
+ 0x7368, 0xED25, 0, 0, 0, 0, 0x4524, 0xED26,
+ 0x7E73, 0xED28, 0xED29, 0x385D, 0xED2A, 0x736A, 0xED2B, 0xFE62,
+ 0, 0xFE63, 0xED2E, 0xED2F, 0, 0, 0, 0xED30,
+ 0x414D, 0x736B, 0xED31, 0, 0, 0, 0xED32, 0,
+ 0, 0, 0xED33, 0xED34, 0x736C, 0, 0, 0xFE64,
+ 0, 0xED36, 0xED37, 0, 0xED38, 0, 0, 0xFE65,
+ 0, 0x7E74, 0xFE66, 0x4921, 0xED3C, 0xFE67, 0x736D, 0xED3E,
+};
static const unsigned short utf8_to_euc_E9BD[] = {
0, 0xED3F, 0, 0xED40, 0xED41, 0xED42, 0xED43, 0xED44,
0, 0, 0x736E, 0x6337, 0, 0, 0x6C5A, 0x706D,
@@ -6209,6 +11767,16 @@ static const unsigned short utf8_to_euc_E9BD[] = {
0xED52, 0xED53, 0x737A, 0xED54, 0, 0xED55, 0x737B, 0x7379,
0, 0, 0xED56, 0, 0, 0xED57, 0, 0,
};
+static const unsigned short utf8_to_euc_E9BD_x0213[] = {
+ 0, 0xFE68, 0, 0xED40, 0xED41, 0xFE69, 0xFE6A, 0xED44,
+ 0, 0, 0x736E, 0x6337, 0, 0, 0x6C5A, 0x706D,
+ 0, 0, 0x736F, 0xFE6B, 0x7370, 0xFE6C, 0xED47, 0x7E75,
+ 0xFE6D, 0, 0xED4A, 0, 0, 0xFE6F, 0xED4C, 0x7372,
+ 0x7373, 0x7374, 0x4E70, 0x7371, 0, 0, 0x7375, 0x7376,
+ 0xED4D, 0xFE71, 0x7378, 0, 0x7377, 0xFE73, 0xED50, 0xED51,
+ 0xFE74, 0xED53, 0x737A, 0xED54, 0, 0xFE75, 0x737B, 0x7379,
+ 0, 0, 0xED56, 0, 0, 0xED57, 0, 0,
+};
static const unsigned short utf8_to_euc_E9BE[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0x4E36, 0, 0xED58,
@@ -6219,6 +11787,16 @@ static const unsigned short utf8_to_euc_E9BE[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
};
+static const unsigned short utf8_to_euc_E9BE_x0213[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0x4E36, 0, 0xED58,
+ 0x7E76, 0xED5A, 0xED5B, 0, 0x7E77, 0x737C, 0xED5D, 0x7E78,
+ 0, 0, 0, 0, 0x737D, 0x6354, 0xED5F, 0,
+ 0x737E, 0xED60, 0x7E79, 0xED62, 0, 0xED63, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+};
static const unsigned short utf8_to_euc_EFA4[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
@@ -6229,6 +11807,26 @@ static const unsigned short utf8_to_euc_EFA4[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
};
+static const unsigned short utf8_to_euc_EFA4_x0213[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0x763B, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0x742E, 0x754E, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0x7B4F, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+};
+static const unsigned short utf8_to_euc_EFA5_x0213[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0x7649, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+};
static const unsigned short utf8_to_euc_EFA7[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
@@ -6239,6 +11837,16 @@ static const unsigned short utf8_to_euc_EFA7[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
};
+static const unsigned short utf8_to_euc_EFA7_x0213[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0x7E24, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0x7D5D, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+};
static const unsigned short utf8_to_euc_EFA8[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0xF434, 0xF437,
@@ -6249,6 +11857,36 @@ static const unsigned short utf8_to_euc_EFA8[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
};
+static const unsigned short utf8_to_euc_EFA8_x0213[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0xF434, 0x2F4B,
+ 0x2F57, 0x4F72, 0xF444, 0xAE79, 0x757A, 0x775A, 0x776F, 0xF453,
+ 0xF455, 0x793C, 0x793D, 0x7941, 0xF45A, 0xF45B, 0xF45E, 0x7B3A,
+ 0xF738, 0xF745, 0x7C2E, 0xF469, 0xF96E, 0xF46B, 0x7C6A, 0xF46F,
+ 0xF470, 0xF473, 0xF477, 0xF478, 0xF479, 0xF47D, 0, 0,
+ 0x2E38, 0x2E49, 0x2E50, 0x2E63, 0x2E68, 0x2E6E, 0x2F2C, 0x2F2F,
+ 0x2F36, 0x2F5A, 0x2F5E, 0x4F61, 0x4F62, 0x7450, 0x745C, 0x745E,
+};
+static const unsigned short utf8_to_euc_EFA9_x0213[] = {
+ 0x7461, 0x7528, 0x752B, 0x7543, 0x7565, 0x7669, 0x7677, 0x7725,
+ 0x7755, 0xF029, 0x7825, 0x7927, 0x7933, 0x7934, 0x7937, 0x7938,
+ 0x7939, 0x793B, 0x793F, 0x7940, 0x794D, 0x7951, 0x7964, 0x7A2E,
+ 0xF450, 0x7A33, 0x7A3A, 0x7A44, 0x7A58, 0xF574, 0xF575, 0x7B27,
+ 0x7B6F, 0x7B79, 0x7C2F, 0x7C30, 0x7C38, 0x7C3D, 0xF969, 0x7C59,
+ 0x7D63, 0x7D76, 0x7D7B, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+};
+static const unsigned short utf8_to_euc_EFB9_x0213[] = {
+ 0, 0, 0, 0, 0, 0x233E, 0x233D, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+};
static const unsigned short utf8_to_euc_EFBC[] = {
0, 0x212A, 0xF42A, 0x2174, 0x2170, 0x2173, 0x2175, 0xF429,
0x214A, 0x214B, 0x2176, 0x215C, 0x2124, 0x215D, 0x2125, 0x213F,
@@ -6259,6 +11897,16 @@ static const unsigned short utf8_to_euc_EFBC[] = {
0x2350, 0x2351, 0x2352, 0x2353, 0x2354, 0x2355, 0x2356, 0x2357,
0x2358, 0x2359, 0x235A, 0x214E, 0x2140, 0x214F, 0x2130, 0x2132,
};
+static const unsigned short utf8_to_euc_EFBC_x0213[] = {
+ 0, 0x212A, 0x2230, 0x2174, 0x2170, 0x2173, 0x2175, 0x222F,
+ 0x214A, 0x214B, 0x2176, 0x215C, 0x2124, 0x2231, 0x2125, 0x213F,
+ 0x2330, 0x2331, 0x2332, 0x2333, 0x2334, 0x2335, 0x2336, 0x2337,
+ 0x2338, 0x2339, 0x2127, 0x2128, 0x2163, 0x2161, 0x2164, 0x2129,
+ 0x2177, 0x2341, 0x2342, 0x2343, 0x2344, 0x2345, 0x2346, 0x2347,
+ 0x2348, 0x2349, 0x234A, 0x234B, 0x234C, 0x234D, 0x234E, 0x234F,
+ 0x2350, 0x2351, 0x2352, 0x2353, 0x2354, 0x2355, 0x2356, 0x2357,
+ 0x2358, 0x2359, 0x235A, 0x214E, 0x2140, 0x214F, 0x2130, 0x2132,
+};
static const unsigned short utf8_to_euc_EFBD[] = {
0x212E, 0x2361, 0x2362, 0x2363, 0x2364, 0x2365, 0x2366, 0x2367,
0x2368, 0x2369, 0x236A, 0x236B, 0x236C, 0x236D, 0x236E, 0x236F,
@@ -6279,6 +11927,16 @@ static const unsigned short utf8_to_euc_EFBD_ms[] = {
0x0E30, 0x0E31, 0x0E32, 0x0E33, 0x0E34, 0x0E35, 0x0E36, 0x0E37,
0x0E38, 0x0E39, 0x0E3A, 0x0E3B, 0x0E3C, 0x0E3D, 0x0E3E, 0x0E3F,
};
+static const unsigned short utf8_to_euc_EFBD_x0213[] = {
+ 0x212E, 0x2361, 0x2362, 0x2363, 0x2364, 0x2365, 0x2366, 0x2367,
+ 0x2368, 0x2369, 0x236A, 0x236B, 0x236C, 0x236D, 0x236E, 0x236F,
+ 0x2370, 0x2371, 0x2372, 0x2373, 0x2374, 0x2375, 0x2376, 0x2377,
+ 0x2378, 0x2379, 0x237A, 0x2150, 0x2143, 0x2151, 0x2232, 0x2256,
+ 0x2257, 0x0E21, 0x0E22, 0x0E23, 0x0E24, 0x0E25, 0x0E26, 0x0E27,
+ 0x0E28, 0x0E29, 0x0E2A, 0x0E2B, 0x0E2C, 0x0E2D, 0x0E2E, 0x0E2F,
+ 0x0E30, 0x0E31, 0x0E32, 0x0E33, 0x0E34, 0x0E35, 0x0E36, 0x0E37,
+ 0x0E38, 0x0E39, 0x0E3A, 0x0E3B, 0x0E3C, 0x0E3D, 0x0E3E, 0x0E3F,
+};
static const unsigned short utf8_to_euc_EFBE[] = {
0x0E40, 0x0E41, 0x0E42, 0x0E43, 0x0E44, 0x0E45, 0x0E46, 0x0E47,
0x0E48, 0x0E49, 0x0E4A, 0x0E4B, 0x0E4C, 0x0E4D, 0x0E4E, 0x0E4F,
@@ -6299,6 +11957,24 @@ static const unsigned short utf8_to_euc_EFBF[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
};
+static const unsigned short *const utf8_to_euc_E1_x0213[] = {
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ utf8_to_euc_E1B8_x0213, 0, 0, 0,
+ 0, utf8_to_euc_E1BD_x0213, 0, 0,
+};
static const unsigned short *const utf8_to_euc_E2[] = {
utf8_to_euc_E280, 0, 0, 0,
utf8_to_euc_E284, utf8_to_euc_E285, utf8_to_euc_E286, utf8_to_euc_E287,
@@ -6371,6 +12047,24 @@ static const unsigned short *const utf8_to_euc_E2_mac[] = {
0, 0, 0, 0,
0, 0, 0, 0,
};
+static const unsigned short *const utf8_to_euc_E2_x0213[] = {
+ utf8_to_euc_E280_x0213, utf8_to_euc_E281_x0213, utf8_to_euc_E282_x0213, 0,
+ utf8_to_euc_E284_x0213, utf8_to_euc_E285_x0213, utf8_to_euc_E286_x0213, utf8_to_euc_E287_x0213,
+ utf8_to_euc_E288_x0213, utf8_to_euc_E289_x0213, utf8_to_euc_E28A_x0213, utf8_to_euc_E28B_x0213,
+ utf8_to_euc_E28C_x0213, 0, utf8_to_euc_E28E_x0213, utf8_to_euc_E28F_x0213,
+ utf8_to_euc_E290_x0213, utf8_to_euc_E291, 0, utf8_to_euc_E293_x0213,
+ utf8_to_euc_E294, utf8_to_euc_E295, utf8_to_euc_E296_x0213, utf8_to_euc_E297_x0213,
+ utf8_to_euc_E298_x0213, utf8_to_euc_E299_x0213, 0, 0,
+ utf8_to_euc_E29C_x0213, utf8_to_euc_E29D_x0213, 0, 0,
+ 0, 0, 0, 0,
+ utf8_to_euc_E2A4_x0213, 0, utf8_to_euc_E2A6_x0213, utf8_to_euc_E2A7_x0213,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+};
static const unsigned short *const utf8_to_euc_E3[] = {
utf8_to_euc_E380, utf8_to_euc_E381, utf8_to_euc_E382, utf8_to_euc_E383,
0, 0, 0, 0,
@@ -6425,6 +12119,24 @@ static const unsigned short *const utf8_to_euc_E3_mac[] = {
0, 0, 0, 0,
0, 0, 0, 0,
};
+static const unsigned short *const utf8_to_euc_E3_x0213[] = {
+ utf8_to_euc_E380_x0213, utf8_to_euc_E381, utf8_to_euc_E382_x0213, utf8_to_euc_E383_x0213,
+ 0, 0, 0, utf8_to_euc_E387_x0213,
+ utf8_to_euc_E388, utf8_to_euc_E389_x0213, utf8_to_euc_E38A_x0213, utf8_to_euc_E38B_x0213,
+ utf8_to_euc_E38C, utf8_to_euc_E38D, utf8_to_euc_E38E, utf8_to_euc_E38F_x0213,
+ utf8_to_euc_E390_x0213, utf8_to_euc_E391_x0213, utf8_to_euc_E392_x0213, utf8_to_euc_E393_x0213,
+ utf8_to_euc_E394_x0213, utf8_to_euc_E395_x0213, utf8_to_euc_E396_x0213, utf8_to_euc_E397_x0213,
+ utf8_to_euc_E398_x0213, utf8_to_euc_E399_x0213, utf8_to_euc_E39A_x0213, utf8_to_euc_E39B_x0213,
+ 0, utf8_to_euc_E39D_x0213, utf8_to_euc_E39E_x0213, utf8_to_euc_E39F_x0213,
+ utf8_to_euc_E3A0_x0213, utf8_to_euc_E3A1_x0213, 0, utf8_to_euc_E3A3_x0213,
+ utf8_to_euc_E3A4_x0213, utf8_to_euc_E3A5_x0213, 0, 0,
+ 0, utf8_to_euc_E3A9_x0213, 0, utf8_to_euc_E3AB_x0213,
+ utf8_to_euc_E3AC_x0213, utf8_to_euc_E3AD_x0213, utf8_to_euc_E3AE_x0213, utf8_to_euc_E3AF_x0213,
+ utf8_to_euc_E3B0_x0213, 0, 0, utf8_to_euc_E3B3_x0213,
+ utf8_to_euc_E3B4_x0213, utf8_to_euc_E3B5_x0213, utf8_to_euc_E3B6_x0213, utf8_to_euc_E3B7_x0213,
+ utf8_to_euc_E3B8_x0213, utf8_to_euc_E3B9_x0213, utf8_to_euc_E3BA_x0213, 0,
+ 0, utf8_to_euc_E3BD_x0213, utf8_to_euc_E3BE_x0213, utf8_to_euc_E3BF_x0213,
+};
static const unsigned short *const utf8_to_euc_E4[] = {
0, 0, 0, 0,
0, 0, 0, 0,
@@ -6443,6 +12155,24 @@ static const unsigned short *const utf8_to_euc_E4[] = {
utf8_to_euc_E4B8, utf8_to_euc_E4B9, utf8_to_euc_E4BA, utf8_to_euc_E4BB,
utf8_to_euc_E4BC, utf8_to_euc_E4BD, utf8_to_euc_E4BE, utf8_to_euc_E4BF,
};
+static const unsigned short *const utf8_to_euc_E4_x0213[] = {
+ utf8_to_euc_E480_x0213, utf8_to_euc_E481_x0213, utf8_to_euc_E482_x0213, 0,
+ utf8_to_euc_E484_x0213, utf8_to_euc_E485_x0213, utf8_to_euc_E486_x0213, utf8_to_euc_E487_x0213,
+ utf8_to_euc_E488_x0213, utf8_to_euc_E489_x0213, 0, utf8_to_euc_E48B_x0213,
+ utf8_to_euc_E48C_x0213, utf8_to_euc_E48D_x0213, 0, utf8_to_euc_E48F_x0213,
+ utf8_to_euc_E490_x0213, utf8_to_euc_E491_x0213, utf8_to_euc_E492_x0213, utf8_to_euc_E493_x0213,
+ utf8_to_euc_E494_x0213, utf8_to_euc_E495_x0213, utf8_to_euc_E496_x0213, utf8_to_euc_E497_x0213,
+ utf8_to_euc_E498_x0213, utf8_to_euc_E499_x0213, utf8_to_euc_E49A_x0213, 0,
+ utf8_to_euc_E49C_x0213, utf8_to_euc_E49D_x0213, 0, utf8_to_euc_E49F_x0213,
+ utf8_to_euc_E4A0_x0213, utf8_to_euc_E4A1_x0213, utf8_to_euc_E4A2_x0213, 0,
+ 0, 0, utf8_to_euc_E4A6_x0213, utf8_to_euc_E4A7_x0213,
+ utf8_to_euc_E4A8_x0213, 0, utf8_to_euc_E4AA_x0213, 0,
+ utf8_to_euc_E4AC_x0213, 0, 0, utf8_to_euc_E4AF_x0213,
+ utf8_to_euc_E4B0_x0213, 0, 0, utf8_to_euc_E4B3_x0213,
+ utf8_to_euc_E4B4_x0213, utf8_to_euc_E4B5_x0213, 0, 0,
+ utf8_to_euc_E4B8_x0213, utf8_to_euc_E4B9_x0213, utf8_to_euc_E4BA_x0213, utf8_to_euc_E4BB_x0213,
+ utf8_to_euc_E4BC_x0213, utf8_to_euc_E4BD_x0213, utf8_to_euc_E4BE_x0213, utf8_to_euc_E4BF_x0213,
+};
static const unsigned short *const utf8_to_euc_E5[] = {
utf8_to_euc_E580, utf8_to_euc_E581, utf8_to_euc_E582, utf8_to_euc_E583,
utf8_to_euc_E584, utf8_to_euc_E585, utf8_to_euc_E586, utf8_to_euc_E587,
@@ -6461,6 +12191,24 @@ static const unsigned short *const utf8_to_euc_E5[] = {
utf8_to_euc_E5B8, utf8_to_euc_E5B9, utf8_to_euc_E5BA, utf8_to_euc_E5BB,
utf8_to_euc_E5BC, utf8_to_euc_E5BD, utf8_to_euc_E5BE, utf8_to_euc_E5BF,
};
+static const unsigned short *const utf8_to_euc_E5_x0213[] = {
+ utf8_to_euc_E580_x0213, utf8_to_euc_E581_x0213, utf8_to_euc_E582_x0213, utf8_to_euc_E583_x0213,
+ utf8_to_euc_E584_x0213, utf8_to_euc_E585_x0213, utf8_to_euc_E586_x0213, utf8_to_euc_E587_x0213,
+ utf8_to_euc_E588_x0213, utf8_to_euc_E589_x0213, utf8_to_euc_E58A_x0213, utf8_to_euc_E58B_x0213,
+ utf8_to_euc_E58C_x0213, utf8_to_euc_E58D_x0213, utf8_to_euc_E58E_x0213, utf8_to_euc_E58F_x0213,
+ utf8_to_euc_E590_x0213, utf8_to_euc_E591_x0213, utf8_to_euc_E592_x0213, utf8_to_euc_E593_x0213,
+ utf8_to_euc_E594_x0213, utf8_to_euc_E595_x0213, utf8_to_euc_E596_x0213, utf8_to_euc_E597_x0213,
+ utf8_to_euc_E598_x0213, utf8_to_euc_E599_x0213, utf8_to_euc_E59A_x0213, utf8_to_euc_E59B_x0213,
+ utf8_to_euc_E59C_x0213, utf8_to_euc_E59D_x0213, utf8_to_euc_E59E_x0213, utf8_to_euc_E59F_x0213,
+ utf8_to_euc_E5A0_x0213, utf8_to_euc_E5A1_x0213, utf8_to_euc_E5A2_x0213, utf8_to_euc_E5A3_x0213,
+ utf8_to_euc_E5A4_x0213, utf8_to_euc_E5A5_x0213, utf8_to_euc_E5A6_x0213, utf8_to_euc_E5A7_x0213,
+ utf8_to_euc_E5A8_x0213, utf8_to_euc_E5A9_x0213, utf8_to_euc_E5AA_x0213, utf8_to_euc_E5AB_x0213,
+ utf8_to_euc_E5AC_x0213, utf8_to_euc_E5AD_x0213, utf8_to_euc_E5AE_x0213, utf8_to_euc_E5AF_x0213,
+ utf8_to_euc_E5B0_x0213, utf8_to_euc_E5B1_x0213, utf8_to_euc_E5B2_x0213, utf8_to_euc_E5B3_x0213,
+ utf8_to_euc_E5B4_x0213, utf8_to_euc_E5B5_x0213, utf8_to_euc_E5B6_x0213, utf8_to_euc_E5B7_x0213,
+ utf8_to_euc_E5B8_x0213, utf8_to_euc_E5B9_x0213, utf8_to_euc_E5BA_x0213, utf8_to_euc_E5BB_x0213,
+ utf8_to_euc_E5BC_x0213, utf8_to_euc_E5BD_x0213, utf8_to_euc_E5BE_x0213, utf8_to_euc_E5BF_x0213,
+};
static const unsigned short *const utf8_to_euc_E6[] = {
utf8_to_euc_E680, utf8_to_euc_E681, utf8_to_euc_E682, utf8_to_euc_E683,
utf8_to_euc_E684, utf8_to_euc_E685, utf8_to_euc_E686, utf8_to_euc_E687,
@@ -6479,6 +12227,24 @@ static const unsigned short *const utf8_to_euc_E6[] = {
utf8_to_euc_E6B8, utf8_to_euc_E6B9, utf8_to_euc_E6BA, utf8_to_euc_E6BB,
utf8_to_euc_E6BC, utf8_to_euc_E6BD, utf8_to_euc_E6BE, utf8_to_euc_E6BF,
};
+static const unsigned short *const utf8_to_euc_E6_x0213[] = {
+ utf8_to_euc_E680_x0213, utf8_to_euc_E681_x0213, utf8_to_euc_E682_x0213, utf8_to_euc_E683_x0213,
+ utf8_to_euc_E684_x0213, utf8_to_euc_E685_x0213, utf8_to_euc_E686_x0213, utf8_to_euc_E687_x0213,
+ utf8_to_euc_E688_x0213, utf8_to_euc_E689_x0213, utf8_to_euc_E68A_x0213, utf8_to_euc_E68B_x0213,
+ utf8_to_euc_E68C_x0213, utf8_to_euc_E68D_x0213, utf8_to_euc_E68E_x0213, utf8_to_euc_E68F_x0213,
+ utf8_to_euc_E690_x0213, utf8_to_euc_E691_x0213, utf8_to_euc_E692_x0213, utf8_to_euc_E693_x0213,
+ utf8_to_euc_E694_x0213, utf8_to_euc_E695_x0213, utf8_to_euc_E696_x0213, utf8_to_euc_E697_x0213,
+ utf8_to_euc_E698_x0213, utf8_to_euc_E699_x0213, utf8_to_euc_E69A_x0213, utf8_to_euc_E69B_x0213,
+ utf8_to_euc_E69C_x0213, utf8_to_euc_E69D_x0213, utf8_to_euc_E69E_x0213, utf8_to_euc_E69F_x0213,
+ utf8_to_euc_E6A0_x0213, utf8_to_euc_E6A1_x0213, utf8_to_euc_E6A2_x0213, utf8_to_euc_E6A3_x0213,
+ utf8_to_euc_E6A4_x0213, utf8_to_euc_E6A5_x0213, utf8_to_euc_E6A6_x0213, utf8_to_euc_E6A7_x0213,
+ utf8_to_euc_E6A8_x0213, utf8_to_euc_E6A9_x0213, utf8_to_euc_E6AA_x0213, utf8_to_euc_E6AB_x0213,
+ utf8_to_euc_E6AC_x0213, utf8_to_euc_E6AD_x0213, utf8_to_euc_E6AE_x0213, utf8_to_euc_E6AF_x0213,
+ utf8_to_euc_E6B0_x0213, utf8_to_euc_E6B1_x0213, utf8_to_euc_E6B2_x0213, utf8_to_euc_E6B3_x0213,
+ utf8_to_euc_E6B4_x0213, utf8_to_euc_E6B5_x0213, utf8_to_euc_E6B6_x0213, utf8_to_euc_E6B7_x0213,
+ utf8_to_euc_E6B8_x0213, utf8_to_euc_E6B9_x0213, utf8_to_euc_E6BA_x0213, utf8_to_euc_E6BB_x0213,
+ utf8_to_euc_E6BC_x0213, utf8_to_euc_E6BD_x0213, utf8_to_euc_E6BE_x0213, utf8_to_euc_E6BF_x0213,
+};
static const unsigned short *const utf8_to_euc_E7[] = {
utf8_to_euc_E780, utf8_to_euc_E781, utf8_to_euc_E782, utf8_to_euc_E783,
utf8_to_euc_E784, utf8_to_euc_E785, utf8_to_euc_E786, utf8_to_euc_E787,
@@ -6497,6 +12263,24 @@ static const unsigned short *const utf8_to_euc_E7[] = {
utf8_to_euc_E7B8, utf8_to_euc_E7B9, utf8_to_euc_E7BA, 0,
utf8_to_euc_E7BC, utf8_to_euc_E7BD, utf8_to_euc_E7BE, utf8_to_euc_E7BF,
};
+static const unsigned short *const utf8_to_euc_E7_x0213[] = {
+ utf8_to_euc_E780_x0213, utf8_to_euc_E781_x0213, utf8_to_euc_E782_x0213, utf8_to_euc_E783_x0213,
+ utf8_to_euc_E784_x0213, utf8_to_euc_E785_x0213, utf8_to_euc_E786_x0213, utf8_to_euc_E787_x0213,
+ utf8_to_euc_E788_x0213, utf8_to_euc_E789_x0213, utf8_to_euc_E78A_x0213, utf8_to_euc_E78B_x0213,
+ utf8_to_euc_E78C_x0213, utf8_to_euc_E78D_x0213, utf8_to_euc_E78E_x0213, utf8_to_euc_E78F_x0213,
+ utf8_to_euc_E790_x0213, utf8_to_euc_E791_x0213, utf8_to_euc_E792_x0213, utf8_to_euc_E793_x0213,
+ utf8_to_euc_E794_x0213, utf8_to_euc_E795_x0213, utf8_to_euc_E796_x0213, utf8_to_euc_E797_x0213,
+ utf8_to_euc_E798_x0213, utf8_to_euc_E799_x0213, utf8_to_euc_E79A_x0213, utf8_to_euc_E79B_x0213,
+ utf8_to_euc_E79C_x0213, utf8_to_euc_E79D_x0213, utf8_to_euc_E79E_x0213, utf8_to_euc_E79F_x0213,
+ utf8_to_euc_E7A0_x0213, utf8_to_euc_E7A1_x0213, utf8_to_euc_E7A2_x0213, utf8_to_euc_E7A3_x0213,
+ utf8_to_euc_E7A4_x0213, utf8_to_euc_E7A5_x0213, utf8_to_euc_E7A6_x0213, utf8_to_euc_E7A7_x0213,
+ utf8_to_euc_E7A8_x0213, utf8_to_euc_E7A9_x0213, utf8_to_euc_E7AA_x0213, utf8_to_euc_E7AB_x0213,
+ utf8_to_euc_E7AC_x0213, utf8_to_euc_E7AD_x0213, utf8_to_euc_E7AE_x0213, utf8_to_euc_E7AF_x0213,
+ utf8_to_euc_E7B0_x0213, utf8_to_euc_E7B1_x0213, utf8_to_euc_E7B2_x0213, utf8_to_euc_E7B3_x0213,
+ utf8_to_euc_E7B4_x0213, utf8_to_euc_E7B5_x0213, utf8_to_euc_E7B6_x0213, utf8_to_euc_E7B7_x0213,
+ utf8_to_euc_E7B8_x0213, utf8_to_euc_E7B9_x0213, utf8_to_euc_E7BA_x0213, 0,
+ utf8_to_euc_E7BC_x0213, utf8_to_euc_E7BD_x0213, utf8_to_euc_E7BE_x0213, utf8_to_euc_E7BF_x0213,
+};
static const unsigned short *const utf8_to_euc_E8[] = {
utf8_to_euc_E880, utf8_to_euc_E881, utf8_to_euc_E882, utf8_to_euc_E883,
utf8_to_euc_E884, utf8_to_euc_E885, utf8_to_euc_E886, utf8_to_euc_E887,
@@ -6515,6 +12299,24 @@ static const unsigned short *const utf8_to_euc_E8[] = {
utf8_to_euc_E8B8, utf8_to_euc_E8B9, utf8_to_euc_E8BA, utf8_to_euc_E8BB,
utf8_to_euc_E8BC, utf8_to_euc_E8BD, utf8_to_euc_E8BE, utf8_to_euc_E8BF,
};
+static const unsigned short *const utf8_to_euc_E8_x0213[] = {
+ utf8_to_euc_E880_x0213, utf8_to_euc_E881_x0213, utf8_to_euc_E882_x0213, utf8_to_euc_E883_x0213,
+ utf8_to_euc_E884_x0213, utf8_to_euc_E885_x0213, utf8_to_euc_E886_x0213, utf8_to_euc_E887_x0213,
+ utf8_to_euc_E888_x0213, utf8_to_euc_E889_x0213, utf8_to_euc_E88A_x0213, utf8_to_euc_E88B_x0213,
+ utf8_to_euc_E88C_x0213, utf8_to_euc_E88D_x0213, utf8_to_euc_E88E_x0213, utf8_to_euc_E88F_x0213,
+ utf8_to_euc_E890_x0213, utf8_to_euc_E891_x0213, utf8_to_euc_E892_x0213, utf8_to_euc_E893_x0213,
+ utf8_to_euc_E894_x0213, utf8_to_euc_E895_x0213, utf8_to_euc_E896_x0213, utf8_to_euc_E897_x0213,
+ utf8_to_euc_E898_x0213, utf8_to_euc_E899_x0213, utf8_to_euc_E89A_x0213, utf8_to_euc_E89B_x0213,
+ utf8_to_euc_E89C_x0213, utf8_to_euc_E89D_x0213, utf8_to_euc_E89E_x0213, utf8_to_euc_E89F_x0213,
+ utf8_to_euc_E8A0_x0213, utf8_to_euc_E8A1_x0213, utf8_to_euc_E8A2_x0213, utf8_to_euc_E8A3_x0213,
+ utf8_to_euc_E8A4_x0213, utf8_to_euc_E8A5_x0213, utf8_to_euc_E8A6_x0213, utf8_to_euc_E8A7_x0213,
+ utf8_to_euc_E8A8_x0213, utf8_to_euc_E8A9_x0213, utf8_to_euc_E8AA_x0213, utf8_to_euc_E8AB_x0213,
+ utf8_to_euc_E8AC_x0213, utf8_to_euc_E8AD_x0213, utf8_to_euc_E8AE_x0213, 0,
+ utf8_to_euc_E8B0_x0213, utf8_to_euc_E8B1_x0213, utf8_to_euc_E8B2_x0213, utf8_to_euc_E8B3_x0213,
+ utf8_to_euc_E8B4_x0213, utf8_to_euc_E8B5_x0213, utf8_to_euc_E8B6_x0213, utf8_to_euc_E8B7_x0213,
+ utf8_to_euc_E8B8_x0213, utf8_to_euc_E8B9_x0213, utf8_to_euc_E8BA_x0213, utf8_to_euc_E8BB_x0213,
+ utf8_to_euc_E8BC_x0213, utf8_to_euc_E8BD_x0213, utf8_to_euc_E8BE_x0213, utf8_to_euc_E8BF_x0213,
+};
static const unsigned short *const utf8_to_euc_E9[] = {
utf8_to_euc_E980, utf8_to_euc_E981, utf8_to_euc_E982, utf8_to_euc_E983,
utf8_to_euc_E984, utf8_to_euc_E985, utf8_to_euc_E986, utf8_to_euc_E987,
@@ -6533,6 +12335,24 @@ static const unsigned short *const utf8_to_euc_E9[] = {
utf8_to_euc_E9B8, utf8_to_euc_E9B9, utf8_to_euc_E9BA, utf8_to_euc_E9BB,
utf8_to_euc_E9BC, utf8_to_euc_E9BD, utf8_to_euc_E9BE, 0,
};
+static const unsigned short *const utf8_to_euc_E9_x0213[] = {
+ utf8_to_euc_E980_x0213, utf8_to_euc_E981_x0213, utf8_to_euc_E982_x0213, utf8_to_euc_E983_x0213,
+ utf8_to_euc_E984_x0213, utf8_to_euc_E985_x0213, utf8_to_euc_E986_x0213, utf8_to_euc_E987_x0213,
+ utf8_to_euc_E988_x0213, utf8_to_euc_E989_x0213, utf8_to_euc_E98A_x0213, utf8_to_euc_E98B_x0213,
+ utf8_to_euc_E98C_x0213, utf8_to_euc_E98D_x0213, utf8_to_euc_E98E_x0213, utf8_to_euc_E98F_x0213,
+ utf8_to_euc_E990_x0213, utf8_to_euc_E991_x0213, utf8_to_euc_E992, 0,
+ 0, utf8_to_euc_E995_x0213, utf8_to_euc_E996_x0213, utf8_to_euc_E997_x0213,
+ utf8_to_euc_E998_x0213, utf8_to_euc_E999_x0213, utf8_to_euc_E99A_x0213, utf8_to_euc_E99B_x0213,
+ utf8_to_euc_E99C_x0213, utf8_to_euc_E99D_x0213, utf8_to_euc_E99E_x0213, utf8_to_euc_E99F_x0213,
+ utf8_to_euc_E9A0_x0213, utf8_to_euc_E9A1_x0213, utf8_to_euc_E9A2_x0213, utf8_to_euc_E9A3_x0213,
+ utf8_to_euc_E9A4_x0213, utf8_to_euc_E9A5_x0213, utf8_to_euc_E9A6_x0213, utf8_to_euc_E9A7_x0213,
+ utf8_to_euc_E9A8_x0213, utf8_to_euc_E9A9_x0213, utf8_to_euc_E9AA_x0213, utf8_to_euc_E9AB_x0213,
+ utf8_to_euc_E9AC_x0213, utf8_to_euc_E9AD_x0213, utf8_to_euc_E9AE_x0213, utf8_to_euc_E9AF_x0213,
+ utf8_to_euc_E9B0_x0213, utf8_to_euc_E9B1_x0213, 0, utf8_to_euc_E9B3_x0213,
+ utf8_to_euc_E9B4_x0213, utf8_to_euc_E9B5_x0213, utf8_to_euc_E9B6_x0213, utf8_to_euc_E9B7_x0213,
+ utf8_to_euc_E9B8_x0213, utf8_to_euc_E9B9_x0213, utf8_to_euc_E9BA_x0213, utf8_to_euc_E9BB_x0213,
+ utf8_to_euc_E9BC_x0213, utf8_to_euc_E9BD_x0213, utf8_to_euc_E9BE_x0213, 0,
+};
static const unsigned short *const utf8_to_euc_EF[] = {
0, 0, 0, 0,
0, 0, 0, 0,
@@ -6569,6 +12389,24 @@ static const unsigned short *const utf8_to_euc_EF_ms[] = {
0, 0, 0, 0,
utf8_to_euc_EFBC, utf8_to_euc_EFBD_ms, utf8_to_euc_EFBE, utf8_to_euc_EFBF,
};
+static const unsigned short *const utf8_to_euc_EF_x0213[] = {
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ utf8_to_euc_EFA4_x0213, utf8_to_euc_EFA5_x0213, 0, utf8_to_euc_EFA7_x0213,
+ utf8_to_euc_EFA8_x0213, utf8_to_euc_EFA9_x0213, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, utf8_to_euc_EFB9_x0213, 0, 0,
+ utf8_to_euc_EFBC_x0213, utf8_to_euc_EFBD_x0213, utf8_to_euc_EFBE, utf8_to_euc_EFBF,
+};
const unsigned short *const utf8_to_euc_2bytes[] = {
0, 0, 0, 0,
0, 0, 0, 0,
@@ -6689,6 +12527,36 @@ const unsigned short *const utf8_to_euc_2bytes_mac[] = {
0, 0, 0, 0,
0, 0, 0, 0,
};
+const unsigned short *const utf8_to_euc_2bytes_x0213[] = {
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, utf8_to_euc_C2_x0213, utf8_to_euc_C3_x0213,
+ utf8_to_euc_C4_x0213, utf8_to_euc_C5_x0213, utf8_to_euc_C6_x0213, utf8_to_euc_C7_x0213,
+ 0, utf8_to_euc_C9_x0213, utf8_to_euc_CA_x0213, utf8_to_euc_CB_x0213,
+ utf8_to_euc_CC_x0213, utf8_to_euc_CD_x0213, utf8_to_euc_CE, utf8_to_euc_CF_x0213,
+ utf8_to_euc_D0, utf8_to_euc_D1, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+};
const unsigned short *const *const utf8_to_euc_3bytes[] = {
0, 0, utf8_to_euc_E2, utf8_to_euc_E3,
utf8_to_euc_E4, utf8_to_euc_E5, utf8_to_euc_E6, utf8_to_euc_E7,
@@ -6713,6 +12581,12 @@ const unsigned short *const *const utf8_to_euc_3bytes_mac[] = {
utf8_to_euc_E8, utf8_to_euc_E9, 0, 0,
0, 0, 0, utf8_to_euc_EF_ms,
};
+const unsigned short *const *const utf8_to_euc_3bytes_x0213[] = {
+ 0, utf8_to_euc_E1_x0213, utf8_to_euc_E2_x0213, utf8_to_euc_E3_x0213,
+ utf8_to_euc_E4_x0213, utf8_to_euc_E5_x0213, utf8_to_euc_E6_x0213, utf8_to_euc_E7_x0213,
+ utf8_to_euc_E8_x0213, utf8_to_euc_E9_x0213, 0, 0,
+ 0, 0, 0, utf8_to_euc_EF_x0213,
+};
#ifdef UNICODE_NORMALIZATION
diff --git a/ext/nkf/nkf-utf8/utf8tbl.h b/ext/nkf/nkf-utf8/utf8tbl.h
index c3d7709ef7..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$
*/
#ifndef _UTF8TBL_H_
@@ -14,7 +13,17 @@ extern const unsigned short euc_to_utf8_1byte[];
extern const unsigned short *const euc_to_utf8_2bytes[];
extern const unsigned short *const euc_to_utf8_2bytes_ms[];
extern const unsigned short *const euc_to_utf8_2bytes_mac[];
+extern const unsigned short *const euc_to_utf8_2bytes_x0213[];
extern const unsigned short *const x0212_to_utf8_2bytes[];
+extern const unsigned short *const x0212_to_utf8_2bytes_x0213[];
+#define sizeof_x0213_combining_chars 5
+#define sizeof_x0213_combining_table 25
+#define sizeof_x0213_1_surrogate_table 26
+#define sizeof_x0213_2_surrogate_table 277
+extern const unsigned short x0213_combining_chars[sizeof_x0213_combining_chars];
+extern const unsigned short x0213_combining_table[sizeof_x0213_combining_table][3];
+extern const unsigned short x0213_1_surrogate_table[sizeof_x0213_1_surrogate_table][3];
+extern const unsigned short x0213_2_surrogate_table[sizeof_x0213_2_surrogate_table][3];
#endif /* UTF8_OUTPUT_ENABLE */
#ifdef UTF8_INPUT_ENABLE
@@ -26,10 +35,12 @@ extern const unsigned short *const utf8_to_euc_2bytes[];
extern const unsigned short *const utf8_to_euc_2bytes_ms[];
extern const unsigned short *const utf8_to_euc_2bytes_932[];
extern const unsigned short *const utf8_to_euc_2bytes_mac[];
+extern const unsigned short *const utf8_to_euc_2bytes_x0213[];
extern const unsigned short *const *const utf8_to_euc_3bytes[];
extern const unsigned short *const *const utf8_to_euc_3bytes_ms[];
extern const unsigned short *const *const utf8_to_euc_3bytes_932[];
extern const unsigned short *const *const utf8_to_euc_3bytes_mac[];
+extern const unsigned short *const *const utf8_to_euc_3bytes_x0213[];
#endif /* UTF8_INPUT_ENABLE */
#ifdef UNICODE_NORMALIZATION
diff --git a/ext/nkf/nkf.c b/ext/nkf/nkf.c
index 05fd36de64..2f36866ac4 100644
--- a/ext/nkf/nkf.c
+++ b/ext/nkf/nkf.c
@@ -135,7 +135,7 @@ int nkf_split_options(const char *arg)
static VALUE
rb_nkf_convert(VALUE obj, VALUE opt, VALUE src)
{
- volatile VALUE tmp;
+ VALUE tmp;
reinit();
StringValue(opt);
nkf_split_options(RSTRING_PTR(opt));
@@ -156,23 +156,28 @@ rb_nkf_convert(VALUE obj, VALUE opt, VALUE src)
StringValue(src);
input = (unsigned char *)RSTRING_PTR(src);
i_len = RSTRING_LENINT(src);
- tmp = result = rb_str_new(0, i_len*3 + 10);
+ tmp = rb_str_new(0, i_len*3 + 10);
output_ctr = 0;
- output = (unsigned char *)RSTRING_PTR(result);
- o_len = RSTRING_LENINT(result);
+ output = (unsigned char *)RSTRING_PTR(tmp);
+ o_len = RSTRING_LENINT(tmp);
*output = '\0';
+ /* use _result_ begin*/
+ result = tmp;
kanji_convert(NULL);
- rb_str_set_len(result, output_ctr);
- OBJ_INFECT(result, src);
+ result = Qnil;
+ /* use _result_ end */
+
+ rb_str_set_len(tmp, output_ctr);
+ OBJ_INFECT(tmp, src);
if (mimeout_f)
- rb_enc_associate(result, rb_usascii_encoding());
+ rb_enc_associate(tmp, rb_usascii_encoding());
else
- rb_enc_associate(result, rb_nkf_enc_get(nkf_enc_name(output_encoding)));
+ rb_enc_associate(tmp, rb_nkf_enc_get(nkf_enc_name(output_encoding)));
- return result;
+ return tmp;
}
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/gc_hook.c b/ext/objspace/gc_hook.c
new file mode 100644
index 0000000000..cf3dc0cc9d
--- /dev/null
+++ b/ext/objspace/gc_hook.c
@@ -0,0 +1,103 @@
+/**********************************************************************
+
+ gc_hook.c - GC hook mechanism/ObjectSpace extender for MRI.
+
+ $Author$
+ created at: Tue May 28 01:34:25 2013
+
+ NOTE: This extension library is not expected to exist except C Ruby.
+ NOTE: This feature is an example usage of internal event tracing APIs.
+
+ All the files in this distribution are covered under the Ruby's
+ license (see the file COPYING).
+
+**********************************************************************/
+
+#include "ruby/ruby.h"
+#include "ruby/debug.h"
+
+static int invoking; /* TODO: should not be global variable */
+
+static VALUE
+invoke_proc_ensure(void *dmy)
+{
+ invoking = 0;
+ return Qnil;
+}
+
+static VALUE
+invoke_proc_begin(VALUE proc)
+{
+ return rb_proc_call(proc, rb_ary_new());
+}
+
+static void
+invoke_proc(void *data)
+{
+ VALUE proc = (VALUE)data;
+ invoking += 1;
+ rb_ensure(invoke_proc_begin, proc, invoke_proc_ensure, 0);
+}
+
+static void
+gc_start_end_i(VALUE tpval, void *data)
+{
+ if (0) {
+ rb_trace_arg_t *tparg = rb_tracearg_from_tracepoint(tpval);
+ fprintf(stderr, "trace: %s\n", rb_tracearg_event_flag(tparg) == RUBY_INTERNAL_EVENT_GC_START ? "gc_start" : "gc_end");
+ }
+
+ if (invoking == 0) {
+ rb_postponed_job_register(0, invoke_proc, data);
+ }
+}
+
+static VALUE
+set_gc_hook(VALUE rb_mObjSpace, VALUE proc, rb_event_flag_t event, const char *tp_str, const char *proc_str)
+{
+ VALUE tpval;
+ ID tp_key = rb_intern(tp_str);
+ ID proc_key = rb_intern(proc_str);
+
+ /* disable previous keys */
+ if (rb_ivar_defined(rb_mObjSpace, tp_key) != 0 &&
+ RTEST(tpval = rb_ivar_get(rb_mObjSpace, tp_key))) {
+ rb_tracepoint_disable(tpval);
+ rb_ivar_set(rb_mObjSpace, tp_key, Qnil);
+ rb_ivar_set(rb_mObjSpace, proc_key, Qnil);
+ }
+
+ if (RTEST(proc)) {
+ if (!rb_obj_is_proc(proc)) {
+ rb_raise(rb_eTypeError, "trace_func needs to be Proc");
+ }
+
+ tpval = rb_tracepoint_new(0, event, gc_start_end_i, (void *)proc);
+ rb_ivar_set(rb_mObjSpace, tp_key, tpval);
+ rb_ivar_set(rb_mObjSpace, proc_key, proc); /* GC guard */
+ rb_tracepoint_enable(tpval);
+ }
+
+ return proc;
+}
+
+static VALUE
+set_after_gc_start(VALUE rb_mObjSpace, VALUE proc)
+{
+ return set_gc_hook(rb_mObjSpace, proc, RUBY_INTERNAL_EVENT_GC_START,
+ "__set_after_gc_start_tpval__", "__set_after_gc_start_proc__");
+}
+
+static VALUE
+set_after_gc_end(VALUE rb_mObjSpace, VALUE proc)
+{
+ return set_gc_hook(rb_mObjSpace, proc, RUBY_INTERNAL_EVENT_GC_END,
+ "__set_after_gc_end_tpval__", "__set_after_gc_end_proc__");
+}
+
+void
+Init_gc_hook(VALUE rb_mObjSpace)
+{
+ rb_define_module_function(rb_mObjSpace, "after_gc_start_hook=", set_after_gc_start, 1);
+ rb_define_module_function(rb_mObjSpace, "after_gc_end_hook=", set_after_gc_end, 1);
+}
diff --git a/ext/objspace/object_tracing.c b/ext/objspace/object_tracing.c
new file mode 100644
index 0000000000..2475623410
--- /dev/null
+++ b/ext/objspace/object_tracing.c
@@ -0,0 +1,490 @@
+/**********************************************************************
+
+ 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) ? rb_class_path(klass) : Qnil;
+ const char *class_path_cstr = RTEST(class_path) ? make_unique_str(arg->str_table, RSTRING_PTR(class_path), RSTRING_LEN(class_path)) : 0;
+
+ if (st_lookup(arg->object_table, (st_data_t)obj, (st_data_t *)&info)) {
+ 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_registerd = 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)) fprintf(out, " (%s)", rb_id2name(SYM2ID(info->mid)));
+ 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_registerd == 0) {
+ object_allocations_reporter_registerd = 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 fd08158676..f9fa833c99 100644
--- a/ext/objspace/objspace.c
+++ b/ext/objspace/objspace.c
@@ -5,171 +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:
- 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 += sizeof(struct re_registers); /* TODO: 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 {
@@ -196,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);
}
}
}
@@ -210,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_objects{|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
@@ -262,12 +130,49 @@ 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;
}
+static VALUE
+type2sym(enum ruby_value_type i)
+{
+ VALUE type;
+ switch (i) {
+#define CASE_TYPE(t) case t: type = ID2SYM(rb_intern(#t)); break;
+ CASE_TYPE(T_NONE);
+ CASE_TYPE(T_OBJECT);
+ CASE_TYPE(T_CLASS);
+ CASE_TYPE(T_MODULE);
+ CASE_TYPE(T_FLOAT);
+ CASE_TYPE(T_STRING);
+ CASE_TYPE(T_REGEXP);
+ CASE_TYPE(T_ARRAY);
+ CASE_TYPE(T_HASH);
+ CASE_TYPE(T_STRUCT);
+ CASE_TYPE(T_BIGNUM);
+ CASE_TYPE(T_FILE);
+ CASE_TYPE(T_DATA);
+ CASE_TYPE(T_MATCH);
+ CASE_TYPE(T_COMPLEX);
+ CASE_TYPE(T_RATIONAL);
+ CASE_TYPE(T_NIL);
+ CASE_TYPE(T_TRUE);
+ CASE_TYPE(T_FALSE);
+ CASE_TYPE(T_SYMBOL);
+ CASE_TYPE(T_FIXNUM);
+ CASE_TYPE(T_UNDEF);
+ CASE_TYPE(T_NODE);
+ CASE_TYPE(T_ICLASS);
+ CASE_TYPE(T_ZOMBIE);
+#undef CASE_TYPE
+ default: rb_bug("type2sym: unknown type (%d)", i);
+ }
+ return type;
+}
+
/*
* call-seq:
* ObjectSpace.count_objects_size([result_hash]) -> hash
@@ -288,7 +193,7 @@ cos_i(void *vstart, void *vend, size_t stride, void *data)
* 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
@@ -296,11 +201,11 @@ count_objects_size(int argc, VALUE *argv, VALUE os)
{
size_t counts[T_MASK+1];
size_t total = 0;
- size_t i;
+ enum ruby_value_type i;
VALUE hash;
if (rb_scan_args(argc, argv, "01", &hash) == 1) {
- if (TYPE(hash) != T_HASH)
+ if (!RB_TYPE_P(hash, T_HASH))
rb_raise(rb_eTypeError, "non-hash given");
}
@@ -319,37 +224,7 @@ count_objects_size(int argc, VALUE *argv, VALUE os)
for (i = 0; i <= T_MASK; i++) {
if (counts[i]) {
- VALUE type;
- switch (i) {
-#define COUNT_TYPE(t) case t: type = ID2SYM(rb_intern(#t)); break;
- COUNT_TYPE(T_NONE);
- COUNT_TYPE(T_OBJECT);
- COUNT_TYPE(T_CLASS);
- COUNT_TYPE(T_MODULE);
- COUNT_TYPE(T_FLOAT);
- COUNT_TYPE(T_STRING);
- COUNT_TYPE(T_REGEXP);
- COUNT_TYPE(T_ARRAY);
- COUNT_TYPE(T_HASH);
- COUNT_TYPE(T_STRUCT);
- COUNT_TYPE(T_BIGNUM);
- COUNT_TYPE(T_FILE);
- COUNT_TYPE(T_DATA);
- COUNT_TYPE(T_MATCH);
- COUNT_TYPE(T_COMPLEX);
- COUNT_TYPE(T_RATIONAL);
- COUNT_TYPE(T_NIL);
- COUNT_TYPE(T_TRUE);
- COUNT_TYPE(T_FALSE);
- COUNT_TYPE(T_SYMBOL);
- COUNT_TYPE(T_FIXNUM);
- COUNT_TYPE(T_UNDEF);
- COUNT_TYPE(T_NODE);
- COUNT_TYPE(T_ICLASS);
- COUNT_TYPE(T_ZOMBIE);
-#undef COUNT_TYPE
- default: type = INT2NUM(i); break;
- }
+ VALUE type = type2sym(i);
total += counts[i];
rb_hash_aset(hash, type, SIZET2NUM(counts[i]));
}
@@ -380,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
@@ -404,7 +280,7 @@ count_nodes(int argc, VALUE *argv, VALUE os)
VALUE hash;
if (rb_scan_args(argc, argv, "01", &hash) == 1) {
- if (TYPE(hash) != T_HASH)
+ if (!RB_TYPE_P(hash, T_HASH))
rb_raise(rb_eTypeError, "non-hash given");
}
@@ -460,6 +336,7 @@ count_nodes(int argc, VALUE *argv, VALUE os)
COUNT_NODE(NODE_OP_ASGN2);
COUNT_NODE(NODE_OP_ASGN_AND);
COUNT_NODE(NODE_OP_ASGN_OR);
+ COUNT_NODE(NODE_OP_CDECL);
COUNT_NODE(NODE_CALL);
COUNT_NODE(NODE_FCALL);
COUNT_NODE(NODE_VCALL);
@@ -493,6 +370,7 @@ count_nodes(int argc, VALUE *argv, VALUE os)
COUNT_NODE(NODE_ARGS);
COUNT_NODE(NODE_ARGS_AUX);
COUNT_NODE(NODE_OPT_ARG);
+ COUNT_NODE(NODE_KW_ARG);
COUNT_NODE(NODE_POSTARG);
COUNT_NODE(NODE_ARGSCAT);
COUNT_NODE(NODE_ARGSPUSH);
@@ -510,6 +388,7 @@ count_nodes(int argc, VALUE *argv, VALUE os)
COUNT_NODE(NODE_SCLASS);
COUNT_NODE(NODE_COLON2);
COUNT_NODE(NODE_COLON3);
+ COUNT_NODE(NODE_CREF);
COUNT_NODE(NODE_DOT2);
COUNT_NODE(NODE_DOT3);
COUNT_NODE(NODE_FLIP2);
@@ -529,7 +408,6 @@ count_nodes(int argc, VALUE *argv, VALUE os)
COUNT_NODE(NODE_ATTRASGN);
COUNT_NODE(NODE_PRELUDE);
COUNT_NODE(NODE_LAMBDA);
- COUNT_NODE(NODE_OPTBLOCK);
#undef COUNT_NODE
default: node = INT2FIX(i);
}
@@ -575,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
@@ -609,7 +487,7 @@ count_tdata_objects(int argc, VALUE *argv, VALUE self)
VALUE hash;
if (rb_scan_args(argc, argv, "01", &hash) == 1) {
- if (TYPE(hash) != T_HASH)
+ if (!RB_TYPE_P(hash, T_HASH))
rb_raise(rb_eTypeError, "non-hash given");
}
@@ -625,26 +503,271 @@ count_tdata_objects(int argc, VALUE *argv, VALUE self)
return hash;
}
-/* objspace library extends ObjectSpace module and add several
+static void
+iow_mark(void *ptr)
+{
+ rb_gc_mark((VALUE)ptr);
+}
+
+static size_t
+iow_size(const void *ptr)
+{
+ VALUE obj = (VALUE)ptr;
+ 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;
+
+static VALUE
+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)
+{
+ VALUE obj = (VALUE)DATA_PTR(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)));
+}
+
+/* Returns the Object#object_id of the internal object. */
+static VALUE
+iow_internal_object_id(VALUE self)
+{
+ VALUE obj = (VALUE)DATA_PTR(self);
+ return rb_obj_id(obj);
+}
+
+struct rof_data {
+ st_table *refs;
+ VALUE internals;
+};
+
+static void
+reachable_object_from_i(VALUE obj, void *data_ptr)
+{
+ struct rof_data *data = (struct rof_data *)data_ptr;
+ VALUE key = obj;
+ VALUE val = obj;
+
+ if (rb_objspace_markable_object_p(obj)) {
+ if (rb_objspace_internal_object_p(obj)) {
+ val = iow_newobj(obj);
+ rb_ary_push(data->internals, val);
+ }
+ st_insert(data->refs, key, val);
+ }
+}
+
+static int
+collect_values(st_data_t key, st_data_t value, st_data_t data)
+{
+ VALUE ary = (VALUE)data;
+ rb_ary_push(ary, (VALUE)value);
+ return ST_CONTINUE;
+}
+
+/*
+ * call-seq:
+ * ObjectSpace.reachable_objects_from(obj) -> array or nil
+ *
+ * [MRI specific feature] Return all reachable objects from `obj'.
+ *
+ * This method returns all reachable objects from `obj'.
+ *
+ * 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' 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 only expected to work except with C Ruby.
+ *
+ * Example:
+ * ObjectSpace.reachable_objects_from(['a', 'b', 'c'])
+ * #=> [Array, 'a', 'b', 'c']
+ *
+ * ObjectSpace.reachable_objects_from(['a', 'a', 'a'])
+ * #=> [Array, 'a', 'a', 'a'] # all 'a' strings have different object id
+ *
+ * ObjectSpace.reachable_objects_from([v = 'a', v, v])
+ * #=> [Array, 'a']
+ *
+ * ObjectSpace.reachable_objects_from(1)
+ * #=> nil # 1 is not markable (heap managed) object
+ *
+ */
+
+static VALUE
+reachable_objects_from(VALUE self, VALUE obj)
+{
+ if (rb_objspace_markable_object_p(obj)) {
+ VALUE ret = rb_ary_new();
+ struct rof_data data;
+
+ if (rb_typeddata_is_kind_of(obj, &iow_data_type)) {
+ obj = (VALUE)DATA_PTR(obj);
+ }
+
+ data.refs = st_init_numtable();
+ data.internals = rb_ary_new();
+
+ rb_objspace_reachable_objects_from(obj, reachable_object_from_i, &data);
+
+ st_foreach(data.refs, collect_values, (st_data_t)ret);
+ return ret;
+ }
+ else {
+ return Qnil;
+ }
+}
+
+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();
+ 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)) {
+ 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_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_gc_hook(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);
+ rb_define_module_function(rb_mObjSpace, "memsize_of_all", memsize_of_all_m, -1);
rb_define_module_function(rb_mObjSpace, "count_objects_size", count_objects_size, -1);
rb_define_module_function(rb_mObjSpace, "count_nodes", count_nodes, -1);
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_gc_hook(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..df1395d07a
--- /dev/null
+++ b/ext/objspace/objspace_dump.c
@@ -0,0 +1,409 @@
+/**********************************************************************
+
+ 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"
+
+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);
+ fflush(dc->stream);
+ }
+ 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:
+ 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;
+
+ 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 (STR_ASSOC_P(obj))
+ dump_append(dc, ", \"associated\":true");
+ if (is_broken_string(obj))
+ dump_append(dc, ", \"broken\":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_NOCAPA_P(obj) && (long)rb_str_capacity(obj) != RSTRING_LEN(obj))
+ dump_append(dc, ", \"capacity\":%ld", rb_str_capacity(obj));
+
+ if (is_ascii_string(obj)) {
+ dump_append(dc, ", \"value\":");
+ dump_append_string_value(dc, obj);
+ }
+ }
+
+ if (!ENCODING_IS_ASCII8BIT(obj))
+ dump_append(dc, ", \"encoding\":\"%s\"", rb_enc_name(rb_enc_from_index(ENCODING_GET(obj))));
+ 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;
+ 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))
+ dump_append(dc, ", \"method\":\"%s\"", rb_id2name(SYM2ID(ainfo->mid)));
+ dump_append(dc, ", \"generation\":%zu", ainfo->generation);
+ }
+
+ if ((memsize = rb_obj_memsize_of(obj)) > 0)
+ dump_append(dc, ", \"memsize\":%zu", memsize);
+
+ 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) # => "/tmp/rubyobj000000"
+ * 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]) # => "/tmp/rubyheap000000"
+ * ObjectSpace.dump_all(output: :stdout) # => nil
+ * ObjectSpace.dump_all(output: :string) # => "{...}\n{...}\n..."
+ *
+ * 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"));
+}
diff --git a/ext/openssl/depend b/ext/openssl/depend
new file mode 100644
index 0000000000..7991159f2e
--- /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: $(top_srcdir)/thread_native.h $(top_srcdir)/thread_$(THREAD_MODEL).h
diff --git a/ext/openssl/deprecation.rb b/ext/openssl/deprecation.rb
new file mode 100644
index 0000000000..39ebfa0d37
--- /dev/null
+++ b/ext/openssl/deprecation.rb
@@ -0,0 +1,21 @@
+module OpenSSL
+ def self.deprecated_warning_flag
+ unless flag = (@deprecated_warning_flag ||= nil)
+ if try_compile("", flag = "-Werror=deprecated-declarations")
+ if with_config("broken-apple-openssl")
+ flag = "-Wno-deprecated-declarations"
+ end
+ $warnflags << " #{flag}"
+ else
+ flag = ""
+ end
+ @deprecated_warning_flag = flag
+ end
+ flag
+ end
+
+ def self.check_func(func, header)
+ have_func(func, header, deprecated_warning_flag) and
+ have_header(header, nil, deprecated_warning_flag)
+ end
+end
diff --git a/ext/openssl/extconf.rb b/ext/openssl/extconf.rb
index 2206fcab5b..e272cba092 100644
--- a/ext/openssl/extconf.rb
+++ b/ext/openssl/extconf.rb
@@ -1,3 +1,4 @@
+# -*- coding: us-ascii -*-
=begin
= $RCSfile$ -- Generator for Makefile
@@ -15,30 +16,27 @@
=end
require "mkmf"
+require File.expand_path('../deprecation', __FILE__)
dir_config("openssl")
dir_config("kerberos")
-message "=== OpenSSL for Ruby configurator ===\n"
+Logging::message "=== OpenSSL for Ruby configurator ===\n"
##
-# Adds -Wall -DOSSL_DEBUG for compilation and some more targets when GCC is used
+# Adds -DOSSL_DEBUG for compilation and some more targets when GCC is used
# To turn it on, use: --with-debug or --enable-debug
#
if with_config("debug") or enable_config("debug")
$defs.push("-DOSSL_DEBUG") unless $defs.include? "-DOSSL_DEBUG"
-
- if CONFIG['GCC'] == 'yes'
- $CPPFLAGS += " -Wall" unless $CPPFLAGS.split.include? "-Wall"
- end
end
-message "=== Checking for system dependent stuff... ===\n"
+Logging::message "=== Checking for system dependent stuff... ===\n"
have_library("nsl", "t_open")
have_library("socket", "socket")
have_header("assert.h")
-message "=== Checking for required stuff... ===\n"
+Logging::message "=== Checking for required stuff... ===\n"
if $mingw
have_library("wsock32")
have_library("gdi32")
@@ -51,8 +49,8 @@ unless result
result &&= %w[crypto libeay32].any? {|lib| have_library(lib, "OpenSSL_add_all_digests")}
result &&= %w[ssl ssleay32].any? {|lib| have_library(lib, "SSL_library_init")}
unless result
- message "=== Checking for required stuff failed. ===\n"
- message "Makefile wasn't created. Fix the errors above.\n"
+ Logging::message "=== Checking for required stuff failed. ===\n"
+ Logging::message "Makefile wasn't created. Fix the errors above.\n"
exit 1
end
end
@@ -60,10 +58,11 @@ end
unless have_header("openssl/conf_api.h")
raise "OpenSSL 0.9.6 or later required."
end
+unless OpenSSL.check_func("SSL_library_init()", "openssl/ssl.h")
+ raise "Ignore OpenSSL broken by Apple.\nPlease use another openssl. (e.g. using `configure --with-openssl-dir=/path/to/openssl')"
+end
-%w"rb_str_set_len rb_block_call".each {|func| have_func(func, "ruby.h")}
-
-message "=== Checking for OpenSSL features... ===\n"
+Logging::message "=== Checking for OpenSSL features... ===\n"
have_func("ERR_peek_last_error")
have_func("ASN1_put_eoc")
have_func("BN_mod_add")
@@ -104,6 +103,13 @@ have_func("OPENSSL_cleanse")
have_func("SSLv2_method")
have_func("SSLv2_server_method")
have_func("SSLv2_client_method")
+have_func("TLSv1_1_method")
+have_func("TLSv1_1_server_method")
+have_func("TLSv1_1_client_method")
+have_func("TLSv1_2_method")
+have_func("TLSv1_2_server_method")
+have_func("TLSv1_2_client_method")
+have_macro("OPENSSL_NPN_NEGOTIATED", ['openssl/ssl.h']) && $defs.push("-DHAVE_OPENSSL_NPN_NEGOTIATED")
unless have_func("SSL_set_tlsext_host_name", ['openssl/ssl.h'])
have_macro("SSL_set_tlsext_host_name", ['openssl/ssl.h']) && $defs.push("-DHAVE_SSL_SET_TLSEXT_HOST_NAME")
end
@@ -114,6 +120,7 @@ if have_header("openssl/engine.h")
have_func("ENGINE_get_digest")
have_func("ENGINE_get_cipher")
have_func("ENGINE_cleanup")
+ have_func("ENGINE_load_dynamic")
have_func("ENGINE_load_4758cca")
have_func("ENGINE_load_aep")
have_func("ENGINE_load_atalla")
@@ -122,18 +129,32 @@ if have_header("openssl/engine.h")
have_func("ENGINE_load_nuron")
have_func("ENGINE_load_sureware")
have_func("ENGINE_load_ubsec")
+ have_func("ENGINE_load_padlock")
+ have_func("ENGINE_load_capi")
+ have_func("ENGINE_load_gmp")
+ have_func("ENGINE_load_gost")
+ have_func("ENGINE_load_cryptodev")
+ have_func("ENGINE_load_aesni")
end
+have_func("DH_generate_parameters_ex")
+have_func("DSA_generate_parameters_ex")
+have_func("RSA_generate_key_ex")
if checking_for('OpenSSL version is 0.9.7 or later') {
try_static_assert('OPENSSL_VERSION_NUMBER >= 0x00907000L', 'openssl/opensslv.h')
}
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")
+have_macro("OPENSSL_FIPS", ['openssl/opensslconf.h']) && $defs.push("-DHAVE_OPENSSL_FIPS")
+have_macro("EVP_CTRL_GCM_GET_TAG", ['openssl/evp.h']) && $defs.push("-DHAVE_AUTHENTICATED_ENCRYPTION")
-message "=== Checking done. ===\n"
+Logging::message "=== Checking done. ===\n"
create_header
-create_makefile("openssl")
-message "Done.\n"
+create_makefile("openssl") {|conf|
+ conf << "THREAD_MODEL = #{CONFIG["THREAD_MODEL"]}\n"
+}
+Logging::message "Done.\n"
diff --git a/ext/openssl/lib/openssl.rb b/ext/openssl/lib/openssl.rb
index 3cff8d9c10..19a4382d0d 100644
--- a/ext/openssl/lib/openssl.rb
+++ b/ext/openssl/lib/openssl.rb
@@ -20,6 +20,5 @@ require 'openssl/bn'
require 'openssl/cipher'
require 'openssl/config'
require 'openssl/digest'
-require 'openssl/ssl-internal'
-require 'openssl/x509-internal'
-
+require 'openssl/x509'
+require 'openssl/ssl'
diff --git a/ext/openssl/lib/openssl/bn.rb b/ext/openssl/lib/openssl/bn.rb
index b2fca163f1..0e19c20d34 100644
--- a/ext/openssl/lib/openssl/bn.rb
+++ b/ext/openssl/lib/openssl/bn.rb
@@ -3,16 +3,16 @@
# $RCSfile$
#
# = Ruby-space definitions that completes C-space funcs for BN
-#
+#
# = Info
# 'OpenSSL for Ruby 2' project
# Copyright (C) 2002 Michal Rokos <m.rokos@sh.cvut.cz>
# All rights reserved.
-#
+#
# = Licence
# This program is licenced under the same licence as Ruby.
# (See the file 'LICENCE'.)
-#
+#
# = Version
# $Id$
#
@@ -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..85cf8af31c 100644
--- a/ext/openssl/lib/openssl/buffering.rb
+++ b/ext/openssl/lib/openssl/buffering.rb
@@ -1,4 +1,4 @@
-=begin
+<<EOL
= $RCSfile$ -- Buffering mix-in module.
= Info
@@ -12,12 +12,15 @@
= Version
$Id$
-=end
+EOL
##
# 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 +37,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 +168,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 +178,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 +377,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/cipher.rb b/ext/openssl/lib/openssl/cipher.rb
index eb146fb552..b3340ff52a 100644
--- a/ext/openssl/lib/openssl/cipher.rb
+++ b/ext/openssl/lib/openssl/cipher.rb
@@ -3,16 +3,16 @@
# $RCSfile$
#
# = Ruby-space predefined Cipher subclasses
-#
+#
# = Info
# 'OpenSSL for Ruby 2' project
# Copyright (C) 2002 Michal Rokos <m.rokos@sh.cvut.cz>
# All rights reserved.
-#
+#
# = Licence
# This program is licenced under the same licence as Ruby.
# (See the file 'LICENCE'.)
-#
+#
# = Version
# $Id$
#
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 b47007165c..80b58af5da 100644
--- a/ext/openssl/lib/openssl/digest.rb
+++ b/ext/openssl/lib/openssl/digest.rb
@@ -3,16 +3,16 @@
# $RCSfile$
#
# = Ruby-space predefined Digest subclasses
-#
+#
# = Info
# 'OpenSSL for Ruby 2' project
# Copyright (C) 2002 Michal Rokos <m.rokos@sh.cvut.cz>
# All rights reserved.
-#
+#
# = Licence
# This program is licenced under the same licence as Ruby.
# (See the file 'LICENCE'.)
-#
+#
# = Version
# $Id$
#
@@ -31,7 +31,7 @@ module OpenSSL
#
# === Examples
#
- # OpenSSL::Digest.digest("SHA256, "abc")
+ # OpenSSL::Digest.digest("SHA256", "abc")
#
# which is equivalent to:
#
@@ -59,8 +59,13 @@ module OpenSSL
const_set(name, klass)
}
- # This class is only provided for backwards compatibility. Use OpenSSL::Digest in the future.
- class Digest < Digest
+ # This class is only provided for backwards compatibility.
+ #
+ # Use OpenSSL::Digest in the future.
+ class Digest < Digest # :nodoc:
+ # Deprecated.
+ #
+ # See OpenSSL::Digest.new
def initialize(*args)
# add warning
super(*args)
@@ -68,5 +73,22 @@ module OpenSSL
end
end # Digest
+
+ # Returns a Digest subclass by +name+.
+ #
+ # require 'openssl'
+ #
+ # OpenSSL::Digest("MD5")
+ # # => OpenSSL::Digest::MD5
+ #
+ # Digest("Foo")
+ # # => NameError: wrong constant name Foo
+
+ def Digest(name)
+ OpenSSL::Digest.const_get(name)
+ end
+
+ module_function :Digest
+
end # OpenSSL
diff --git a/ext/openssl/lib/openssl/ssl-internal.rb b/ext/openssl/lib/openssl/ssl-internal.rb
deleted file mode 100644
index c70b5b8f6b..0000000000
--- a/ext/openssl/lib/openssl/ssl-internal.rb
+++ /dev/null
@@ -1,177 +0,0 @@
-=begin
-= $RCSfile$ -- Ruby-space definitions that completes C-space funcs for SSL
-
-= Info
- 'OpenSSL for Ruby 2' project
- Copyright (C) 2001 GOTOU YUUZOU <gotoyuzo@notwork.org>
- All rights reserved.
-
-= Licence
- This program is licenced under the same licence as Ruby.
- (See the file 'LICENCE'.)
-
-= Version
- $Id$
-=end
-
-require "openssl/buffering"
-require "fcntl"
-
-module OpenSSL
- module SSL
- class SSLContext
- DEFAULT_PARAMS = {
- :ssl_version => "SSLv23",
- :verify_mode => OpenSSL::SSL::VERIFY_PEER,
- :ciphers => "ALL:!ADH:!EXPORT:!SSLv2:RC4+RSA:+HIGH:+MEDIUM:+LOW",
- :options => OpenSSL::SSL::OP_ALL,
- }
-
- DEFAULT_CERT_STORE = OpenSSL::X509::Store.new
- DEFAULT_CERT_STORE.set_default_paths
- if defined?(OpenSSL::X509::V_FLAG_CRL_CHECK_ALL)
- DEFAULT_CERT_STORE.flags = OpenSSL::X509::V_FLAG_CRL_CHECK_ALL
- end
-
- def set_params(params={})
- params = DEFAULT_PARAMS.merge(params)
- params.each{|name, value| self.__send__("#{name}=", value) }
- if self.verify_mode != OpenSSL::SSL::VERIFY_NONE
- unless self.ca_file or self.ca_path or self.cert_store
- self.cert_store = DEFAULT_CERT_STORE
- end
- end
- return params
- end
- end
-
- module SocketForwarder
- def addr
- to_io.addr
- end
-
- def peeraddr
- to_io.peeraddr
- end
-
- def setsockopt(level, optname, optval)
- to_io.setsockopt(level, optname, optval)
- end
-
- def getsockopt(level, optname)
- to_io.getsockopt(level, optname)
- end
-
- def fcntl(*args)
- to_io.fcntl(*args)
- end
-
- def closed?
- to_io.closed?
- end
-
- def do_not_reverse_lookup=(flag)
- to_io.do_not_reverse_lookup = flag
- end
- end
-
- module Nonblock
- def initialize(*args)
- flag = File::NONBLOCK
- flag |= @io.fcntl(Fcntl::F_GETFL) if defined?(Fcntl::F_GETFL)
- @io.fcntl(Fcntl::F_SETFL, flag)
- super
- end
- end
-
- def verify_certificate_identity(cert, hostname)
- should_verify_common_name = true
- cert.extensions.each{|ext|
- next if ext.oid != "subjectAltName"
- ext.value.split(/,\s+/).each{|general_name|
- if /\ADNS:(.*)/ =~ general_name
- should_verify_common_name = false
- reg = Regexp.escape($1).gsub(/\\\*/, "[^.]+")
- return true if /\A#{reg}\z/i =~ hostname
- elsif /\AIP Address:(.*)/ =~ general_name
- should_verify_common_name = false
- return true if $1 == hostname
- end
- }
- }
- if should_verify_common_name
- cert.subject.to_a.each{|oid, value|
- if oid == "CN"
- reg = Regexp.escape(value).gsub(/\\\*/, "[^.]+")
- return true if /\A#{reg}\z/i =~ hostname
- end
- }
- end
- return false
- end
- module_function :verify_certificate_identity
-
- class SSLSocket
- include Buffering
- include SocketForwarder
- include Nonblock
-
- def post_connection_check(hostname)
- unless OpenSSL::SSL.verify_certificate_identity(peer_cert, hostname)
- raise SSLError, "hostname does not match the server certificate"
- end
- return true
- end
-
- def session
- SSL::Session.new(self)
- rescue SSL::Session::SessionError
- nil
- end
- end
-
- class SSLServer
- include SocketForwarder
- attr_accessor :start_immediately
-
- def initialize(svr, ctx)
- @svr = svr
- @ctx = ctx
- unless ctx.session_id_context
- session_id = OpenSSL::Digest::MD5.hexdigest($0)
- @ctx.session_id_context = session_id
- end
- @start_immediately = true
- end
-
- def to_io
- @svr
- end
-
- def listen(backlog=5)
- @svr.listen(backlog)
- end
-
- def shutdown(how=Socket::SHUT_RDWR)
- @svr.shutdown(how)
- end
-
- def accept
- 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
- raise ex
- end
- end
-
- def close
- @svr.close
- end
- end
- end
-end
diff --git a/ext/openssl/lib/openssl/ssl.rb b/ext/openssl/lib/openssl/ssl.rb
index 15f42d6091..014e1137bc 100644
--- a/ext/openssl/lib/openssl/ssl.rb
+++ b/ext/openssl/lib/openssl/ssl.rb
@@ -1,2 +1,208 @@
-warn 'deprecated openssl/ssl use: require "openssl" instead of "openssl/ssl"'
-require 'openssl'
+=begin
+= $RCSfile$ -- Ruby-space definitions that completes C-space funcs for SSL
+
+= Info
+ 'OpenSSL for Ruby 2' project
+ Copyright (C) 2001 GOTOU YUUZOU <gotoyuzo@notwork.org>
+ All rights reserved.
+
+= Licence
+ This program is licenced under the same licence as Ruby.
+ (See the file 'LICENCE'.)
+
+= Version
+ $Id$
+=end
+
+require "openssl/buffering"
+require "fcntl"
+
+module OpenSSL
+ module SSL
+ class SSLContext
+ 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,
+ }
+
+ DEFAULT_CERT_STORE = OpenSSL::X509::Store.new
+ DEFAULT_CERT_STORE.set_default_paths
+ if defined?(OpenSSL::X509::V_FLAG_CRL_CHECK_ALL)
+ DEFAULT_CERT_STORE.flags = OpenSSL::X509::V_FLAG_CRL_CHECK_ALL
+ end
+
+ ##
+ # Sets the parameters for this SSL context to the values in +params+.
+ # The keys in +params+ must be assignment methods on SSLContext.
+ #
+ # If the verify_mode is not VERIFY_NONE and ca_file, ca_path and
+ # cert_store are not set then the system default certificate store is
+ # used.
+
+ def set_params(params={})
+ params = DEFAULT_PARAMS.merge(params)
+ params.each{|name, value| self.__send__("#{name}=", value) }
+ if self.verify_mode != OpenSSL::SSL::VERIFY_NONE
+ unless self.ca_file or self.ca_path or self.cert_store
+ self.cert_store = DEFAULT_CERT_STORE
+ end
+ end
+ return params
+ end
+ end
+
+ module SocketForwarder
+ def addr
+ to_io.addr
+ end
+
+ def peeraddr
+ to_io.peeraddr
+ end
+
+ def setsockopt(level, optname, optval)
+ to_io.setsockopt(level, optname, optval)
+ end
+
+ def getsockopt(level, optname)
+ to_io.getsockopt(level, optname)
+ end
+
+ def fcntl(*args)
+ to_io.fcntl(*args)
+ end
+
+ def closed?
+ to_io.closed?
+ end
+
+ def do_not_reverse_lookup=(flag)
+ to_io.do_not_reverse_lookup = flag
+ end
+ end
+
+ module Nonblock
+ def initialize(*args)
+ flag = File::NONBLOCK
+ flag |= @io.fcntl(Fcntl::F_GETFL) if defined?(Fcntl::F_GETFL)
+ @io.fcntl(Fcntl::F_SETFL, flag)
+ super
+ end
+ end
+
+ def verify_certificate_identity(cert, hostname)
+ should_verify_common_name = true
+ cert.extensions.each{|ext|
+ next if ext.oid != "subjectAltName"
+ ostr = OpenSSL::ASN1.decode(ext.to_der).value.last
+ sequence = OpenSSL::ASN1.decode(ostr.value)
+ sequence.value.each{|san|
+ case san.tag
+ when 2 # dNSName in GeneralName (RFC5280)
+ should_verify_common_name = false
+ reg = Regexp.escape(san.value).gsub(/\\\*/, "[^.]+")
+ return true if /\A#{reg}\z/i =~ hostname
+ when 7 # iPAddress in GeneralName (RFC5280)
+ should_verify_common_name = false
+ # follows GENERAL_NAME_print() in x509v3/v3_alt.c
+ if san.value.size == 4
+ return true if san.value.unpack('C*').join('.') == hostname
+ elsif san.value.size == 16
+ return true if san.value.unpack('n*').map { |e| sprintf("%X", e) }.join(':') == hostname
+ end
+ end
+ }
+ }
+ if should_verify_common_name
+ cert.subject.to_a.each{|oid, value|
+ if oid == "CN"
+ reg = Regexp.escape(value).gsub(/\\\*/, "[^.]+")
+ return true if /\A#{reg}\z/i =~ hostname
+ end
+ }
+ end
+ return false
+ end
+ module_function :verify_certificate_identity
+
+ class SSLSocket
+ include Buffering
+ include SocketForwarder
+ include Nonblock
+
+ def post_connection_check(hostname)
+ unless OpenSSL::SSL.verify_certificate_identity(peer_cert, hostname)
+ raise SSLError, "hostname \"#{hostname}\" does not match the server certificate"
+ end
+ return true
+ end
+
+ def session
+ SSL::Session.new(self)
+ rescue SSL::Session::SessionError
+ nil
+ 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
+ unless ctx.session_id_context
+ # see #6137 - session id may not exceed 32 bytes
+ prng = ::Random.new($0.hash)
+ session_id = prng.bytes(16).unpack('H*')[0]
+ @ctx.session_id_context = session_id
+ end
+ @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
+ begin
+ ssl = OpenSSL::SSL::SSLSocket.new(sock, @ctx)
+ ssl.sync_close = true
+ ssl.accept if @start_immediately
+ ssl
+ rescue SSLError => ex
+ sock.close
+ raise ex
+ end
+ end
+
+ # See IO#close for details.
+ def close
+ @svr.close
+ end
+ end
+ end
+end
diff --git a/ext/openssl/lib/openssl/x509-internal.rb b/ext/openssl/lib/openssl/x509-internal.rb
deleted file mode 100644
index 47e3a6f876..0000000000
--- a/ext/openssl/lib/openssl/x509-internal.rb
+++ /dev/null
@@ -1,158 +0,0 @@
-=begin
-= $RCSfile$ -- Ruby-space definitions that completes C-space funcs for X509 and subclasses
-
-= Info
- 'OpenSSL for Ruby 2' project
- Copyright (C) 2002 Michal Rokos <m.rokos@sh.cvut.cz>
- All rights reserved.
-
-= Licence
- This program is licenced under the same licence as Ruby.
- (See the file 'LICENCE'.)
-
-= Version
- $Id$
-=end
-
-module OpenSSL
- module X509
- class ExtensionFactory
- def create_extension(*arg)
- if arg.size > 1
- create_ext(*arg)
- else
- send("create_ext_from_"+arg[0].class.name.downcase, arg[0])
- end
- end
-
- def create_ext_from_array(ary)
- raise ExtensionError, "unexpected array form" if ary.size > 3
- create_ext(ary[0], ary[1], ary[2])
- end
-
- def create_ext_from_string(str) # "oid = critical, value"
- oid, value = str.split(/=/, 2)
- oid.strip!
- value.strip!
- create_ext(oid, value)
- end
-
- def create_ext_from_hash(hash)
- create_ext(hash["oid"], hash["value"], hash["critical"])
- end
- end
-
- class Extension
- def to_s # "oid = critical, value"
- str = self.oid
- str << " = "
- str << "critical, " if self.critical?
- str << self.value.gsub(/\n/, ", ")
- end
-
- def to_h # {"oid"=>sn|ln, "value"=>value, "critical"=>true|false}
- {"oid"=>self.oid,"value"=>self.value,"critical"=>self.critical?}
- end
-
- def to_a
- [ self.oid, self.value, self.critical? ]
- end
- end
-
- class Name
- module RFC2253DN
- Special = ',=+<>#;'
- HexChar = /[0-9a-fA-F]/
- HexPair = /#{HexChar}#{HexChar}/
- HexString = /#{HexPair}+/
- Pair = /\\(?:[#{Special}]|\\|"|#{HexPair})/
- StringChar = /[^#{Special}\\"]/
- QuoteChar = /[^\\"]/
- AttributeType = /[a-zA-Z][0-9a-zA-Z]*|[0-9]+(?:\.[0-9]+)*/
- AttributeValue = /
- (?!["#])((?:#{StringChar}|#{Pair})*)|
- \#(#{HexString})|
- "((?:#{QuoteChar}|#{Pair})*)"
- /x
- TypeAndValue = /\A(#{AttributeType})=#{AttributeValue}/
-
- module_function
-
- def expand_pair(str)
- return nil unless str
- return str.gsub(Pair){
- pair = $&
- case pair.size
- when 2 then pair[1,1]
- when 3 then Integer("0x#{pair[1,2]}").chr
- else raise OpenSSL::X509::NameError, "invalid pair: #{str}"
- end
- }
- end
-
- def expand_hexstring(str)
- return nil unless str
- der = str.gsub(HexPair){$&.to_i(16).chr }
- a1 = OpenSSL::ASN1.decode(der)
- return a1.value, a1.tag
- end
-
- def expand_value(str1, str2, str3)
- value = expand_pair(str1)
- value, tag = expand_hexstring(str2) unless value
- value = expand_pair(str3) unless value
- return value, tag
- end
-
- def scan(dn)
- str = dn
- ary = []
- while true
- if md = TypeAndValue.match(str)
- remain = md.post_match
- type = md[1]
- value, tag = expand_value(md[2], md[3], md[4]) rescue nil
- if value
- type_and_value = [type, value]
- type_and_value.push(tag) if tag
- ary.unshift(type_and_value)
- if remain.length > 2 && remain[0] == ?,
- str = remain[1..-1]
- next
- elsif remain.length > 2 && remain[0] == ?+
- raise OpenSSL::X509::NameError,
- "multi-valued RDN is not supported: #{dn}"
- elsif remain.empty?
- break
- end
- end
- end
- msg_dn = dn[0, dn.length - str.length] + " =>" + str
- raise OpenSSL::X509::NameError, "malformed RDN: #{msg_dn}"
- end
- return ary
- end
- end
-
- class << self
- def parse_rfc2253(str, template=OBJECT_TYPE_TEMPLATE)
- ary = OpenSSL::X509::Name::RFC2253DN.scan(str)
- self.new(ary, template)
- end
-
- def parse_openssl(str, template=OBJECT_TYPE_TEMPLATE)
- ary = str.scan(/\s*([^\/,]+)\s*/).collect{|i| i[0].split("=", 2) }
- self.new(ary, template)
- end
-
- alias parse parse_openssl
- end
- end
-
- class StoreContext
- def cleanup
- warn "(#{caller.first}) OpenSSL::X509::StoreContext#cleanup is deprecated with no replacement" if $VERBOSE
- end
- end
- end
-end
diff --git a/ext/openssl/lib/openssl/x509.rb b/ext/openssl/lib/openssl/x509.rb
index f1777cdf06..31a4381db4 100644
--- a/ext/openssl/lib/openssl/x509.rb
+++ b/ext/openssl/lib/openssl/x509.rb
@@ -1,2 +1,162 @@
-warn 'deprecated openssl/x509 use: require "openssl" instead of "openssl/x509"'
-require 'openssl'
+#--
+#
+# $RCSfile$
+#
+# = Ruby-space definitions that completes C-space funcs for X509 and subclasses
+#
+# = Info
+# 'OpenSSL for Ruby 2' project
+# Copyright (C) 2002 Michal Rokos <m.rokos@sh.cvut.cz>
+# All rights reserved.
+#
+# = Licence
+# This program is licenced under the same licence as Ruby.
+# (See the file 'LICENCE'.)
+#
+# = Version
+# $Id$
+#
+#++
+
+module OpenSSL
+ module X509
+ class ExtensionFactory
+ def create_extension(*arg)
+ if arg.size > 1
+ create_ext(*arg)
+ else
+ send("create_ext_from_"+arg[0].class.name.downcase, arg[0])
+ end
+ end
+
+ def create_ext_from_array(ary)
+ raise ExtensionError, "unexpected array form" if ary.size > 3
+ create_ext(ary[0], ary[1], ary[2])
+ end
+
+ def create_ext_from_string(str) # "oid = critical, value"
+ oid, value = str.split(/=/, 2)
+ oid.strip!
+ value.strip!
+ create_ext(oid, value)
+ end
+
+ def create_ext_from_hash(hash)
+ create_ext(hash["oid"], hash["value"], hash["critical"])
+ end
+ end
+
+ class Extension
+ def to_s # "oid = critical, value"
+ str = self.oid
+ str << " = "
+ str << "critical, " if self.critical?
+ str << self.value.gsub(/\n/, ", ")
+ end
+
+ def to_h # {"oid"=>sn|ln, "value"=>value, "critical"=>true|false}
+ {"oid"=>self.oid,"value"=>self.value,"critical"=>self.critical?}
+ end
+
+ def to_a
+ [ self.oid, self.value, self.critical? ]
+ end
+ end
+
+ class Name
+ module RFC2253DN
+ Special = ',=+<>#;'
+ HexChar = /[0-9a-fA-F]/
+ HexPair = /#{HexChar}#{HexChar}/
+ HexString = /#{HexPair}+/
+ Pair = /\\(?:[#{Special}]|\\|"|#{HexPair})/
+ StringChar = /[^#{Special}\\"]/
+ QuoteChar = /[^\\"]/
+ AttributeType = /[a-zA-Z][0-9a-zA-Z]*|[0-9]+(?:\.[0-9]+)*/
+ AttributeValue = /
+ (?!["#])((?:#{StringChar}|#{Pair})*)|
+ \#(#{HexString})|
+ "((?:#{QuoteChar}|#{Pair})*)"
+ /x
+ TypeAndValue = /\A(#{AttributeType})=#{AttributeValue}/
+
+ module_function
+
+ def expand_pair(str)
+ return nil unless str
+ return str.gsub(Pair){
+ pair = $&
+ case pair.size
+ when 2 then pair[1,1]
+ when 3 then Integer("0x#{pair[1,2]}").chr
+ else raise OpenSSL::X509::NameError, "invalid pair: #{str}"
+ end
+ }
+ end
+
+ def expand_hexstring(str)
+ return nil unless str
+ der = str.gsub(HexPair){$&.to_i(16).chr }
+ a1 = OpenSSL::ASN1.decode(der)
+ return a1.value, a1.tag
+ end
+
+ def expand_value(str1, str2, str3)
+ value = expand_pair(str1)
+ value, tag = expand_hexstring(str2) unless value
+ value = expand_pair(str3) unless value
+ return value, tag
+ end
+
+ def scan(dn)
+ str = dn
+ ary = []
+ while true
+ if md = TypeAndValue.match(str)
+ remain = md.post_match
+ type = md[1]
+ value, tag = expand_value(md[2], md[3], md[4]) rescue nil
+ if value
+ type_and_value = [type, value]
+ type_and_value.push(tag) if tag
+ ary.unshift(type_and_value)
+ if remain.length > 2 && remain[0] == ?,
+ str = remain[1..-1]
+ next
+ elsif remain.length > 2 && remain[0] == ?+
+ raise OpenSSL::X509::NameError,
+ "multi-valued RDN is not supported: #{dn}"
+ elsif remain.empty?
+ break
+ end
+ end
+ end
+ msg_dn = dn[0, dn.length - str.length] + " =>" + str
+ raise OpenSSL::X509::NameError, "malformed RDN: #{msg_dn}"
+ end
+ return ary
+ end
+ end
+
+ class << self
+ def parse_rfc2253(str, template=OBJECT_TYPE_TEMPLATE)
+ ary = OpenSSL::X509::Name::RFC2253DN.scan(str)
+ self.new(ary, template)
+ end
+
+ def parse_openssl(str, template=OBJECT_TYPE_TEMPLATE)
+ ary = str.scan(/\s*([^\/,]+)\s*/).collect{|i| i[0].split("=", 2) }
+ self.new(ary, template)
+ end
+
+ alias parse parse_openssl
+ end
+ end
+
+ class StoreContext
+ def cleanup
+ warn "(#{caller.first}) OpenSSL::X509::StoreContext#cleanup is deprecated with no replacement" if $VERBOSE
+ end
+ end
+ end
+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 f3410b64e8..43ccf4c3fd 100644
--- a/ext/openssl/ossl.c
+++ b/ext/openssl/ossl.c
@@ -175,7 +175,11 @@ ossl_pem_passwd_cb(char *buf, int max_len, int flag, void *pwd)
*/
rflag = flag ? Qtrue : Qfalse;
pass = rb_protect(ossl_pem_passwd_cb0, rflag, &status);
- if (status) return -1; /* exception was raised. */
+ if (status) {
+ /* ignore an exception raised. */
+ rb_set_errinfo(Qnil);
+ return -1;
+ }
len = RSTRING_LENINT(pass);
if (len < 4) { /* 4 is OpenSSL hardcoded limit */
rb_warning("password must be longer than 4 bytes");
@@ -216,18 +220,23 @@ ossl_verify_cb(int ok, X509_STORE_CTX *ctx)
if ((void*)proc == 0)
return ok;
if (!NIL_P(proc)) {
+ ret = Qfalse;
rctx = rb_protect((VALUE(*)(VALUE))ossl_x509stctx_new,
(VALUE)ctx, &state);
- ret = Qfalse;
- if (!state) {
+ if (state) {
+ rb_set_errinfo(Qnil);
+ rb_warn("StoreContext initialization failure");
+ }
+ else {
args.proc = proc;
args.preverify_ok = ok ? Qtrue : Qfalse;
args.store_ctx = rctx;
ret = rb_protect((VALUE(*)(VALUE))ossl_call_verify_cb_proc, (VALUE)&args, &state);
- ossl_x509stctx_clear_ptr(rctx);
if (state) {
+ rb_set_errinfo(Qnil);
rb_warn("exception in verify_callback is ignored");
}
+ ossl_x509stctx_clear_ptr(rctx);
}
if (ret == Qtrue) {
X509_STORE_CTX_set_error(ctx, X509_V_OK);
@@ -416,6 +425,128 @@ ossl_debug_set(VALUE self, VALUE val)
}
/*
+ * call-seq:
+ * OpenSSL.fips_mode = boolean -> boolean
+ *
+ * Turns FIPS mode on or off. Turning on FIPS mode will obviously only have an
+ * effect for FIPS-capable installations of the OpenSSL library. Trying to do
+ * so otherwise will result in an error.
+ *
+ * === Examples
+ *
+ * OpenSSL.fips_mode = true # turn FIPS mode on
+ * OpenSSL.fips_mode = false # and off again
+ */
+static VALUE
+ossl_fips_mode_set(VALUE self, VALUE enabled)
+{
+
+#ifdef HAVE_OPENSSL_FIPS
+ if (RTEST(enabled)) {
+ int mode = FIPS_mode();
+ if(!mode && !FIPS_mode_set(1)) /* turning on twice leads to an error */
+ ossl_raise(eOSSLError, "Turning on FIPS mode failed");
+ } else {
+ if(!FIPS_mode_set(0)) /* turning off twice is OK */
+ ossl_raise(eOSSLError, "Turning off FIPS mode failed");
+ }
+ return enabled;
+#else
+ if (RTEST(enabled))
+ ossl_raise(eOSSLError, "This version of OpenSSL does not support FIPS mode");
+ return enabled;
+#endif
+}
+
+/**
+ * Stores locks needed for OpenSSL thread safety
+ */
+#include "../../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.
*
@@ -446,7 +577,7 @@ ossl_debug_set(VALUE self, VALUE val)
* ahold of the key may use it unless it is encrypted. In order to securely
* export a key you may export it with a pass phrase.
*
- * cipher = OpenSSL::Cipher::Cipher.new 'AES-128-CBC'
+ * cipher = OpenSSL::Cipher.new 'AES-128-CBC'
* pass_phrase = 'my secure pass phrase goes here'
*
* key_secure = key.export cipher, pass_phrase
@@ -480,35 +611,126 @@ ossl_debug_set(VALUE self, VALUE val)
*
* == RSA Encryption
*
- * RSA provides ecryption and decryption using the public and private keys.
+ * RSA provides encryption and decryption using the public and private keys.
* You can use a variety of padding methods depending upon the intended use of
* encrypted data.
*
+ * === Encryption & Decryption
+ *
+ * Asymmetric public/private key encryption is slow and victim to attack in
+ * cases where it is used without padding or directly to encrypt larger chunks
+ * of data. Typical use cases for RSA encryption involve "wrapping" a symmetric
+ * key with the public key of the recipient who would "unwrap" that symmetric
+ * key again using their private key.
+ * The following illustrates a simplified example of such a key transport
+ * scheme. It shouldn't be used in practice, though, standardized protocols
+ * should always be preferred.
+ *
+ * wrapped_key = key.public_encrypt key
+ *
+ * A symmetric key encrypted with the public key can only be decrypted with
+ * the corresponding private key of the recipient.
+ *
+ * original_key = key.private_decrypt wrapped_key
+ *
+ * By default PKCS#1 padding will be used, but it is also possible to use
+ * other forms of padding, see PKey::RSA for further details.
+ *
+ * === Signatures
+ *
+ * Using "private_encrypt" to encrypt some data with the private key is
+ * equivalent to applying a digital signature to the data. A verifying
+ * party may validate the signature by comparing the result of decrypting
+ * the signature with "public_decrypt" to the original data. However,
+ * OpenSSL::PKey already has methods "sign" and "verify" that handle
+ * digital signatures in a standardized way - "private_encrypt" and
+ * "public_decrypt" shouldn't be used in practice.
+ *
+ * To sign a document, a cryptographically secure hash of the document is
+ * computed first, which is then signed using the private key.
+ *
+ * digest = OpenSSL::Digest::SHA256.new
+ * signature = key.sign digest, document
+ *
+ * To validate the signature, again a hash of the document is computed and
+ * the signature is decrypted using the public key. The result is then
+ * compared to the hash just computed, if they are equal the signature was
+ * valid.
+ *
+ * digest = OpenSSL::Digest::SHA256.new
+ * if key.verify digest, signature, document
+ * puts 'Valid'
+ * else
+ * puts 'Invalid'
+ * end
+ *
+ * == PBKDF2 Password-based Encryption
+ *
+ * If supported by the underlying OpenSSL version used, Password-based
+ * Encryption should use the features of PKCS5. If not supported or if
+ * required by legacy applications, the older, less secure methods specified
+ * in RFC 2898 are also supported (see below).
+ *
+ * PKCS5 supports PBKDF2 as it was specified in PKCS#5
+ * v2.0[http://www.rsa.com/rsalabs/node.asp?id=2127]. It still uses a
+ * password, a salt, and additionally a number of iterations that will
+ * slow the key derivation process down. The slower this is, the more work
+ * it requires being able to brute-force the resulting key.
+ *
* === Encryption
*
- * Documents encrypted with the public key can only be decrypted with the
- * private key.
+ * The strategy is to first instantiate a Cipher for encryption, and
+ * then to generate a random IV plus a key derived from the password
+ * using PBKDF2. PKCS #5 v2.0 recommends at least 8 bytes for the salt,
+ * the number of iterations largely depends on the hardware being used.
+ *
+ * cipher = OpenSSL::Cipher.new 'AES-128-CBC'
+ * cipher.encrypt
+ * iv = cipher.random_iv
+ *
+ * pwd = 'some hopefully not to easily guessable password'
+ * salt = OpenSSL::Random.random_bytes 16
+ * iter = 20000
+ * key_len = cipher.key_len
+ * digest = OpenSSL::Digest::SHA256.new
*
- * public_encrypted = key.public_encrypt 'top secret document'
+ * key = OpenSSL::PKCS5.pbkdf2_hmac(pwd, salt, iter, key_len, digest)
+ * cipher.key = key
*
- * Documents encrypted with the private key can only be decrypted with the
- * public key.
+ * Now encrypt the data:
*
- * private_encrypted = key.private_encrypt 'public release document'
+ * encrypted = cipher.update document
+ * encrypted << cipher.final
*
* === Decryption
*
- * Use the opposite key type do decrypt the document
+ * Use the same steps as before to derive the symmetric AES key, this time
+ * setting the Cipher up for decryption.
*
- * top_secret = key.public_decrypt public_encrypted
+ * cipher = OpenSSL::Cipher.new 'AES-128-CBC'
+ * cipher.decrypt
+ * cipher.iv = iv # the one generated with #random_iv
*
- * public_release = key.private_decrypt private_encrypted
+ * pwd = 'some hopefully not to easily guessable password'
+ * salt = ... # the one generated above
+ * iter = 20000
+ * key_len = cipher.key_len
+ * digest = OpenSSL::Digest::SHA256.new
+ *
+ * key = OpenSSL::PKCS5.pbkdf2_hmac(pwd, salt, iter, key_len, digest)
+ * cipher.key = key
+ *
+ * Now decrypt the data:
+ *
+ * decrypted = cipher.update encrypted
+ * decrypted << cipher.final
*
* == PKCS #5 Password-based Encryption
*
* PKCS #5 is a password-based encryption standard documented at
* RFC2898[http://www.ietf.org/rfc/rfc2898.txt]. It allows a short password or
- * passphrase to be used to create a secure encryption key.
+ * passphrase to be used to create a secure encryption key. If possible, PBKDF2
+ * as described above should be used if the circumstances allow it.
*
* PKCS #5 uses a Cipher, a pass phrase and a salt to generate an encryption
* key.
@@ -520,7 +742,7 @@ ossl_debug_set(VALUE self, VALUE val)
*
* First set up the cipher for encryption
*
- * encrypter = OpenSSL::Cipher::Cipher.new 'AES-128-CBC'
+ * encrypter = OpenSSL::Cipher.new 'AES-128-CBC'
* encrypter.encrypt
* encrypter.pkcs5_keyivgen pass_phrase, salt
*
@@ -533,7 +755,7 @@ ossl_debug_set(VALUE self, VALUE val)
*
* Use a new Cipher instance set up for decryption
*
- * decrypter = OpenSSL::Cipher::Cipher.new 'AES-128-CBC'
+ * decrypter = OpenSSL::Cipher.new 'AES-128-CBC'
* decrypter.decrypt
* decrypter.pkcs5_keyivgen pass_phrase, salt
*
@@ -567,10 +789,18 @@ ossl_debug_set(VALUE self, VALUE val)
*
* extension_factory = OpenSSL::X509::ExtensionFactory.new nil, cert
*
- * extension_factory.create_extension 'basicConstraints', 'CA:FALSE'
- * extension_factory.create_extension 'keyUsage',
- * 'keyEncipherment,dataEncipherment,digitalSignature'
- * extension_factory.create_extension 'subjectKeyIdentifier', 'hash'
+ * cert.add_extension \
+ * extension_factory.create_extension('basicConstraints', 'CA:FALSE', true)
+ *
+ * cert.add_extension \
+ * extension_factory.create_extension(
+ * 'keyUsage', 'keyEncipherment,dataEncipherment,digitalSignature')
+ *
+ * cert.add_extension \
+ * extension_factory.create_extension('subjectKeyIdentifier', 'hash')
+ *
+ * The list of supported extensions (and in some cases their possible values)
+ * can be derived from the "objects.h" file in the OpenSSL source code.
*
* === Signing a Certificate
*
@@ -614,7 +844,7 @@ ossl_debug_set(VALUE self, VALUE val)
* 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
@@ -638,16 +868,20 @@ ossl_debug_set(VALUE self, VALUE val)
* extension_factory.subject_certificate = ca_cert
* extension_factory.issuer_certificate = ca_cert
*
- * extension_factory.create_extension 'subjectKeyIdentifier', 'hash'
+ * ca_cert.add_extension \
+ * extension_factory.create_extension('subjectKeyIdentifier', 'hash')
*
* This extension indicates the CA's key may be used as a CA.
*
- * extension_factory.create_extension 'basicConstraints', 'CA:TRUE', true
+ * ca_cert.add_extension \
+ * extension_factory.create_extension('basicConstraints', 'CA:TRUE', true)
*
* This extension indicates the CA's key may be used to verify signatures on
* both certificates and certificate revocations.
*
- * extension_factory.create_extension 'keyUsage', 'cRLSign,keyCertSign', true
+ * ca_cert.add_extension \
+ * extension_factory.create_extension(
+ * 'keyUsage', 'cRLSign,keyCertSign', true)
*
* Root CA certificates are self-signed.
*
@@ -703,10 +937,15 @@ ossl_debug_set(VALUE self, VALUE val)
* extension_factory.subject_certificate = csr_cert
* extension_factory.issuer_certificate = ca_cert
*
- * extension_factory.create_extension 'basicConstraints', 'CA:FALSE'
- * extension_factory.create_extension 'keyUsage',
- * 'keyEncipherment,dataEncipherment,digitalSignature'
- * extension_factory.create_extension 'subjectKeyIdentifier', 'hash'
+ * csr_cert.add_extension \
+ * extension_factory.create_extension('basicConstraints', 'CA:FALSE')
+ *
+ * csr_cert.add_extension \
+ * extension_factory.create_extension(
+ * 'keyUsage', 'keyEncipherment,dataEncipherment,digitalSignature')
+ *
+ * csr_cert.add_extension \
+ * extension_factory.create_extension('subjectKeyIdentifier', 'hash')
*
* csr_cert.sign ca_key, OpenSSL::Digest::SHA1.new
*
@@ -826,6 +1065,7 @@ Init_openssl()
* Init main module
*/
mOSSL = rb_define_module("OpenSSL");
+ rb_global_variable(&mOSSL);
/*
* OpenSSL ruby extension version
@@ -836,6 +1076,7 @@ Init_openssl()
* Version of OpenSSL the ruby OpenSSL extension was built with
*/
rb_define_const(mOSSL, "OPENSSL_VERSION", rb_str_new2(OPENSSL_VERSION_TEXT));
+
/*
* Version number of OpenSSL the ruby OpenSSL extension was built with
* (base 16)
@@ -843,10 +1084,21 @@ Init_openssl()
rb_define_const(mOSSL, "OPENSSL_VERSION_NUMBER", INT2NUM(OPENSSL_VERSION_NUMBER));
/*
+ * Boolean indicating whether OpenSSL is FIPS-enabled or not
+ */
+#ifdef HAVE_OPENSSL_FIPS
+ rb_define_const(mOSSL, "OPENSSL_FIPS", Qtrue);
+#else
+ rb_define_const(mOSSL, "OPENSSL_FIPS", Qfalse);
+#endif
+ rb_define_module_function(mOSSL, "fips_mode=", ossl_fips_mode_set, 1);
+
+ /*
* Generic error,
* 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
@@ -858,6 +1110,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);
@@ -867,6 +1121,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 97095f7d6f..96d0ade11e 100644
--- a/ext/openssl/ossl.h
+++ b/ext/openssl/ossl.h
@@ -30,6 +30,7 @@ extern "C" {
#endif
#include <ruby.h>
#include <ruby/io.h>
+#include <ruby/thread.h>
/*
* Check the OpenSSL version
@@ -65,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
@@ -74,6 +75,11 @@ extern "C" {
# include <openssl/ocsp.h>
#endif
+/* OpenSSL requires passwords for PEM-encoded files to be at least four
+ * characters long
+ */
+#define OSSL_MIN_PWD_LEN 4
+
/*
* Common Module
*/
diff --git a/ext/openssl/ossl_asn1.c b/ext/openssl/ossl_asn1.c
index 210ae5ca8b..8aa8422b84 100644
--- a/ext/openssl/ossl_asn1.c
+++ b/ext/openssl/ossl_asn1.c
@@ -33,15 +33,22 @@ asn1time_to_time(ASN1_TIME *time)
{
struct tm tm;
VALUE argv[6];
+ int count;
if (!time || !time->data) return Qnil;
memset(&tm, 0, sizeof(struct tm));
switch (time->type) {
case V_ASN1_UTCTIME:
- if (sscanf((const char *)time->data, "%2d%2d%2d%2d%2d%2dZ", &tm.tm_year, &tm.tm_mon,
- &tm.tm_mday, &tm.tm_hour, &tm.tm_min, &tm.tm_sec) != 6) {
- ossl_raise(rb_eTypeError, "bad UTCTIME format");
+ count = sscanf((const char *)time->data, "%2d%2d%2d%2d%2d%2dZ",
+ &tm.tm_year, &tm.tm_mon, &tm.tm_mday, &tm.tm_hour, &tm.tm_min,
+ &tm.tm_sec);
+
+ if (count == 5) {
+ tm.tm_sec = 0;
+ } else if (count != 6) {
+ ossl_raise(rb_eTypeError, "bad UTCTIME format: \"%s\"",
+ time->data);
}
if (tm.tm_year < 69) {
tm.tm_year += 2000;
@@ -150,8 +157,8 @@ ASN1_INTEGER *
num_to_asn1integer(VALUE obj, ASN1_INTEGER *ai)
{
BIGNUM *bn;
-
- if (NIL_P(obj))
+
+ if (NIL_P(obj))
ossl_raise(rb_eTypeError, "Can't convert nil into Integer");
bn = GetBNPtr(obj);
@@ -339,7 +346,7 @@ obj_to_asn1derstr(VALUE obj)
* DER to Ruby converters
*/
static VALUE
-decode_bool(unsigned char* der, int length)
+decode_bool(unsigned char* der, long length)
{
int val;
const unsigned char *p;
@@ -352,7 +359,7 @@ decode_bool(unsigned char* der, int length)
}
static VALUE
-decode_int(unsigned char* der, int length)
+decode_int(unsigned char* der, long length)
{
ASN1_INTEGER *ai;
const unsigned char *p;
@@ -371,7 +378,7 @@ decode_int(unsigned char* der, int length)
}
static VALUE
-decode_bstr(unsigned char* der, int length, long *unused_bits)
+decode_bstr(unsigned char* der, long length, long *unused_bits)
{
ASN1_BIT_STRING *bstr;
const unsigned char *p;
@@ -392,7 +399,7 @@ decode_bstr(unsigned char* der, int length, long *unused_bits)
}
static VALUE
-decode_enum(unsigned char* der, int length)
+decode_enum(unsigned char* der, long length)
{
ASN1_ENUMERATED *ai;
const unsigned char *p;
@@ -411,7 +418,7 @@ decode_enum(unsigned char* der, int length)
}
static VALUE
-decode_null(unsigned char* der, int length)
+decode_null(unsigned char* der, long length)
{
ASN1_NULL *null;
const unsigned char *p;
@@ -425,7 +432,7 @@ decode_null(unsigned char* der, int length)
}
static VALUE
-decode_obj(unsigned char* der, int length)
+decode_obj(unsigned char* der, long length)
{
ASN1_OBJECT *obj;
const unsigned char *p;
@@ -454,7 +461,7 @@ decode_obj(unsigned char* der, int length)
}
static VALUE
-decode_time(unsigned char* der, int length)
+decode_time(unsigned char* der, long length)
{
ASN1_TIME *time;
const unsigned char *p;
@@ -473,7 +480,7 @@ decode_time(unsigned char* der, int length)
}
static VALUE
-decode_eoc(unsigned char *der, int length)
+decode_eoc(unsigned char *der, long length)
{
if (length != 2 || !(der[0] == 0x00 && der[1] == 0x00))
ossl_raise(eASN1Error, NULL);
@@ -785,7 +792,7 @@ ossl_asn1data_to_der(VALUE self)
}
static VALUE
-int_ossl_asn1_decode0_prim(unsigned char **pp, long length, int hlen, int tag,
+int_ossl_asn1_decode0_prim(unsigned char **pp, long length, long hlen, int tag,
VALUE tc, long *num_read)
{
VALUE value, asn1data;
@@ -930,8 +937,8 @@ ossl_asn1_decode0(unsigned char **pp, long length, long *offset, int depth,
{
unsigned char *start, *p;
const unsigned char *p0;
- long len = 0, inner_read = 0, off = *offset;
- int hlen, tag, tc, j;
+ long len = 0, inner_read = 0, off = *offset, hlen;
+ int tag, tc, j;
VALUE asn1data, tag_class;
p = *pp;
@@ -1351,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)
{
@@ -1364,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)
{
@@ -1377,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)
{
@@ -1390,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)
{
@@ -1771,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 recieved 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>.
@@ -1909,6 +1951,14 @@ 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
rb_define_singleton_method(cASN1ObjectId, "register", ossl_asn1obj_s_register, 3);
rb_define_method(cASN1ObjectId, "sn", ossl_asn1obj_get_sn, 0);
rb_define_method(cASN1ObjectId, "ln", ossl_asn1obj_get_ln, 0);
diff --git a/ext/openssl/ossl_bio.c b/ext/openssl/ossl_bio.c
index ed7c0a71a5..a11c08c1a3 100644
--- a/ext/openssl/ossl_bio.c
+++ b/ext/openssl/ossl_bio.c
@@ -25,7 +25,7 @@ ossl_obj2bio(VALUE obj)
GetOpenFile(obj, fptr);
rb_io_check_readable(fptr);
- if ((fd = dup(FPTR_TO_FD(fptr))) < 0){
+ if ((fd = rb_cloexec_dup(FPTR_TO_FD(fptr))) < 0){
rb_sys_fail(0);
}
rb_update_max_fd(fd);
diff --git a/ext/openssl/ossl_bn.c b/ext/openssl/ossl_bn.c
index 5d690af52d..05473635ae 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
*/
@@ -119,11 +120,52 @@ ossl_bn_initialize(int argc, VALUE *argv, VALUE self)
if (rb_scan_args(argc, argv, "11", &str, &bs) == 2) {
base = NUM2INT(bs);
}
- StringValue(str);
- GetBN(self, bn);
+
+ 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)) {
+ int i, j, len = RBIGNUM_LENINT(str);
+ BDIGIT *ds = RBIGNUM_DIGITS(str);
+ VALUE buf;
+ unsigned char *bin = (unsigned char*)ALLOCV_N(BDIGIT, buf, len);
+
+ for (i = 0; len > i; i++) {
+ BDIGIT v = ds[i];
+ for (j = SIZEOF_BDIGITS - 1; 0 <= j; j--) {
+ bin[(len-1-i)*SIZEOF_BDIGITS+j] = v&0xff;
+ v >>= 8;
+ }
+ }
+
+ GetBN(self, bn);
+ if (!BN_bin2bn(bin, (int)SIZEOF_BDIGITS*len, bn)) {
+ ALLOCV_END(buf);
+ ossl_raise(eBNError, NULL);
+ }
+ ALLOCV_END(buf);
+ if (!RBIGNUM_SIGN(str)) BN_set_negative(bn, 1);
+ return self;
+ }
if (RTEST(rb_obj_is_kind_of(str, cBN))) {
BIGNUM *other;
+ GetBN(self, bn);
GetBN(str, other); /* Safe - we checked kind_of? above */
if (!BN_copy(bn, other)) {
ossl_raise(eBNError, NULL);
@@ -131,6 +173,8 @@ ossl_bn_initialize(int argc, VALUE *argv, VALUE self)
return self;
}
+ StringValue(str);
+ GetBN(self, bn);
switch (base) {
case 0:
if (!BN_mpi2bn((unsigned char *)RSTRING_PTR(str), RSTRING_LENINT(str), bn)) {
@@ -224,10 +268,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 26851515cd..03374372ad 100644
--- a/ext/openssl/ossl_cipher.c
+++ b/ext/openssl/ossl_cipher.c
@@ -329,7 +329,6 @@ ossl_cipher_pkcs5_keyivgen(int argc, VALUE *argv, VALUE self)
return Qnil;
}
-
/*
* call-seq:
* cipher.update(data [, buffer]) -> string or buffer
@@ -379,10 +378,15 @@ ossl_cipher_update(int argc, VALUE *argv, VALUE self)
* call-seq:
* cipher.final -> string
*
- * Returns the remaining data held in the cipher object. Further calls to
- * Cipher#update or Cipher#final will return garbage.
+ * Returns the remaining data held in the cipher object. Further calls to
+ * Cipher#update or Cipher#final will return garbage. This call should always
+ * be made as the last call of an encryption or decryption operation, after
+ * after having fed the entire plaintext or ciphertext to the Cipher instance.
*
- * See EVP_CipherFinal_ex for further information.
+ * If an authenticated cipher was used, a CipherError is raised if the tag
+ * could not be authenticated successfully. Only call this method after
+ * setting the authentication tag and passing the entire contents of the
+ * ciphertext into the cipher.
*/
static VALUE
ossl_cipher_final(VALUE self)
@@ -478,6 +482,175 @@ ossl_cipher_set_iv(VALUE self, VALUE iv)
return iv;
}
+#ifdef HAVE_AUTHENTICATED_ENCRYPTION
+/*
+ * call-seq:
+ * cipher.auth_data = string -> string
+ *
+ * Sets the cipher's additional authenticated data. This field must be
+ * set when using AEAD cipher modes such as GCM or CCM. If no associated
+ * data shall be used, this method must *still* be called with a value of "".
+ * The contents of this field should be non-sensitive data which will be
+ * added to the ciphertext to generate the authentication tag which validates
+ * the contents of the ciphertext.
+ *
+ * The AAD must be set prior to encryption or decryption. In encryption mode,
+ * it must be set after calling Cipher#encrypt and setting Cipher#key= and
+ * Cipher#iv=. When decrypting, the authenticated data must be set after key,
+ * iv and especially *after* the authentication tag has been set. I.e. set it
+ * only after calling Cipher#decrypt, Cipher#key=, Cipher#iv= and
+ * Cipher#auth_tag= first.
+ */
+static VALUE
+ossl_cipher_set_auth_data(VALUE self, VALUE data)
+{
+ EVP_CIPHER_CTX *ctx;
+ unsigned char *in;
+ int in_len;
+ int out_len;
+
+ StringValue(data);
+
+ in = (unsigned char *) RSTRING_PTR(data);
+ in_len = RSTRING_LENINT(data);
+
+ GetCipher(self, ctx);
+
+ if (!EVP_CipherUpdate(ctx, NULL, &out_len, in, in_len))
+ ossl_raise(eCipherError, "couldn't set additional authenticated data");
+
+ return data;
+}
+
+#define ossl_is_gcm(nid) (nid) == NID_aes_128_gcm || \
+ (nid) == NID_aes_192_gcm || \
+ (nid) == NID_aes_256_gcm
+
+static VALUE
+ossl_get_gcm_auth_tag(EVP_CIPHER_CTX *ctx, int len)
+{
+ unsigned char *tag;
+ VALUE ret;
+
+ tag = ALLOC_N(unsigned char, len);
+
+ if (!EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_GCM_GET_TAG, len, tag))
+ ossl_raise(eCipherError, "retrieving the authentication tag failed");
+
+ ret = rb_str_new((const char *) tag, len);
+ xfree(tag);
+ return ret;
+}
+
+/*
+ * call-seq:
+ * cipher.auth_tag([ tag_len ] -> string
+ *
+ * Gets the authentication tag generated by Authenticated Encryption Cipher
+ * modes (GCM for example). This tag may be stored along with the ciphertext,
+ * then set on the decryption cipher to authenticate the contents of the
+ * ciphertext against changes. If the optional integer parameter +tag_len+ is
+ * given, the returned tag will be +tag_len+ bytes long. If the parameter is
+ * omitted, the maximum length of 16 bytes will be returned. For maximum
+ * security, the default of 16 bytes should be chosen.
+ *
+ * The tag may only be retrieved after calling Cipher#final.
+ */
+static VALUE
+ossl_cipher_get_auth_tag(int argc, VALUE *argv, VALUE self)
+{
+ VALUE vtag_len;
+ EVP_CIPHER_CTX *ctx;
+ int nid, tag_len;
+
+ if (rb_scan_args(argc, argv, "01", &vtag_len) == 0) {
+ tag_len = 16;
+ } else {
+ tag_len = NUM2INT(vtag_len);
+ }
+
+ GetCipher(self, ctx);
+ nid = EVP_CIPHER_CTX_nid(ctx);
+
+ if (ossl_is_gcm(nid)) {
+ return ossl_get_gcm_auth_tag(ctx, tag_len);
+ } else {
+ ossl_raise(eCipherError, "authentication tag not supported by this cipher");
+ return Qnil; /* dummy */
+ }
+}
+
+static inline void
+ossl_set_gcm_auth_tag(EVP_CIPHER_CTX *ctx, unsigned char *tag, int tag_len)
+{
+ if (!EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_GCM_SET_TAG, tag_len, tag))
+ ossl_raise(eCipherError, "unable to set GCM tag");
+}
+
+/*
+ * call-seq:
+ * cipher.auth_tag = string -> string
+ *
+ * Sets the authentication tag to verify the contents of the
+ * ciphertext. The tag must be set after calling Cipher#decrypt,
+ * Cipher#key= and Cipher#iv=, but before assigning the associated
+ * authenticated data using Cipher#auth_data= and of course, before
+ * decrypting any of the ciphertext. After all decryption is
+ * performed, the tag is verified automatically in the call to
+ * Cipher#final.
+ */
+static VALUE
+ossl_cipher_set_auth_tag(VALUE self, VALUE vtag)
+{
+ EVP_CIPHER_CTX *ctx;
+ int nid;
+ unsigned char *tag;
+ int tag_len;
+
+ StringValue(vtag);
+ tag = (unsigned char *) RSTRING_PTR(vtag);
+ tag_len = RSTRING_LENINT(vtag);
+
+ GetCipher(self, ctx);
+ nid = EVP_CIPHER_CTX_nid(ctx);
+
+ if (ossl_is_gcm(nid)) {
+ ossl_set_gcm_auth_tag(ctx, tag, tag_len);
+ } else {
+ ossl_raise(eCipherError, "authentication tag not supported by this cipher");
+ }
+
+ return vtag;
+}
+
+/*
+ * call-seq:
+ * cipher.authenticated? -> boolean
+ *
+ * Indicated whether this Cipher instance uses an Authenticated Encryption
+ * mode.
+ */
+static VALUE
+ossl_cipher_is_authenticated(VALUE self)
+{
+ EVP_CIPHER_CTX *ctx;
+ int nid;
+
+ GetCipher(self, ctx);
+ nid = EVP_CIPHER_CTX_nid(ctx);
+
+ if (ossl_is_gcm(nid)) {
+ return Qtrue;
+ } else {
+ return Qfalse;
+ }
+}
+#else
+#define ossl_cipher_set_auth_data rb_f_notimplement
+#define ossl_cipher_get_auth_tag rb_f_notimplement
+#define ossl_cipher_set_auth_tag rb_f_notimplement
+#define ossl_cipher_is_authenticated rb_f_notimplement
+#endif
/*
* call-seq:
@@ -728,6 +901,45 @@ Init_ossl_cipher(void)
*
* puts data == plain #=> true
*
+ * === Authenticated Encryption and Associated Data (AEAD)
+ *
+ * If the OpenSSL version used supports it, an Authenticated Encryption
+ * mode (such as GCM or CCM) should always be preferred over any
+ * unauthenticated mode. Currently, OpenSSL supports AE only in combination
+ * with Associated Data (AEAD) where additional associated data is included
+ * in the encryption process to compute a tag at the end of the encryption.
+ * This tag will also be used in the decryption process and by verifying
+ * its validity, the authenticity of a given ciphertext is established.
+ *
+ * This is superior to unauthenticated modes in that it allows to detect
+ * if somebody effectively changed the ciphertext after it had been
+ * encrypted. This prevents malicious modifications of the ciphertext that
+ * could otherwise be exploited to modify ciphertexts in ways beneficial to
+ * potential attackers.
+ *
+ * If no associated data is needed for encryption and later decryption,
+ * the OpenSSL library still requires a value to be set - "" may be used in
+ * case none is available. An example using the GCM (Galois Counter Mode):
+ *
+ * cipher = OpenSSL::Cipher::AES.new(128, :GCM)
+ * cipher.encrypt
+ * key = cipher.random_key
+ * iv = cipher.random_iv
+ * cipher.auth_data = ""
+ *
+ * encrypted = cipher.update(data) + cipher.final
+ * tag = cipher.auth_tag
+ *
+ * decipher = OpenSSL::Cipher::AES.new(128, :GCM)
+ * decipher.decrypt
+ * decipher.key = key
+ * decipher.iv = iv
+ * decipher.auth_tag = tag
+ * decipher.auth_data = ""
+ *
+ * plain = decipher.update(encrypted) + decipher.final
+ *
+ * puts data == plain #=> true
*/
cCipher = rb_define_class_under(mOSSL, "Cipher", rb_cObject);
eCipherError = rb_define_class_under(cCipher, "CipherError", eOSSLError);
@@ -744,6 +956,10 @@ Init_ossl_cipher(void)
rb_define_method(cCipher, "final", ossl_cipher_final, 0);
rb_define_method(cCipher, "name", ossl_cipher_name, 0);
rb_define_method(cCipher, "key=", ossl_cipher_set_key, 1);
+ rb_define_method(cCipher, "auth_data=", ossl_cipher_set_auth_data, 1);
+ rb_define_method(cCipher, "auth_tag=", ossl_cipher_set_auth_tag, 1);
+ rb_define_method(cCipher, "auth_tag", ossl_cipher_get_auth_tag, -1);
+ rb_define_method(cCipher, "authenticated?", ossl_cipher_is_authenticated, 0);
rb_define_method(cCipher, "key_len=", ossl_cipher_set_key_length, 1);
rb_define_method(cCipher, "key_len", ossl_cipher_key_length, 0);
rb_define_method(cCipher, "iv=", ossl_cipher_set_iv, 1);
diff --git a/ext/openssl/ossl_config.c b/ext/openssl/ossl_config.c
index e700833076..0f25a19e50 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 formating,
+ * 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_engine.c b/ext/openssl/ossl_engine.c
index a7d1e315fd..da1a3c7a74 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)
{
@@ -64,29 +86,47 @@ ossl_engine_s_load(int argc, VALUE *argv, VALUE klass)
#if HAVE_ENGINE_LOAD_DYNAMIC
OSSL_ENGINE_LOAD_IF_MATCH(dynamic);
#endif
-#if HAVE_ENGINE_LOAD_CSWIFT
- OSSL_ENGINE_LOAD_IF_MATCH(cswift);
+#if HAVE_ENGINE_LOAD_4758CCA
+ OSSL_ENGINE_LOAD_IF_MATCH(4758cca);
#endif
-#if HAVE_ENGINE_LOAD_CHIL
- OSSL_ENGINE_LOAD_IF_MATCH(chil);
+#if HAVE_ENGINE_LOAD_AEP
+ OSSL_ENGINE_LOAD_IF_MATCH(aep);
#endif
#if HAVE_ENGINE_LOAD_ATALLA
OSSL_ENGINE_LOAD_IF_MATCH(atalla);
#endif
+#if HAVE_ENGINE_LOAD_CHIL
+ OSSL_ENGINE_LOAD_IF_MATCH(chil);
+#endif
+#if HAVE_ENGINE_LOAD_CSWIFT
+ OSSL_ENGINE_LOAD_IF_MATCH(cswift);
+#endif
#if HAVE_ENGINE_LOAD_NURON
OSSL_ENGINE_LOAD_IF_MATCH(nuron);
#endif
+#if HAVE_ENGINE_LOAD_SUREWARE
+ OSSL_ENGINE_LOAD_IF_MATCH(sureware);
+#endif
#if HAVE_ENGINE_LOAD_UBSEC
OSSL_ENGINE_LOAD_IF_MATCH(ubsec);
#endif
-#if HAVE_ENGINE_LOAD_AEP
- OSSL_ENGINE_LOAD_IF_MATCH(aep);
+#if HAVE_ENGINE_LOAD_PADLOCK
+ OSSL_ENGINE_LOAD_IF_MATCH(padlock);
#endif
-#if HAVE_ENGINE_LOAD_SUREWARE
- OSSL_ENGINE_LOAD_IF_MATCH(sureware);
+#if HAVE_ENGINE_LOAD_CAPI
+ OSSL_ENGINE_LOAD_IF_MATCH(capi);
#endif
-#if HAVE_ENGINE_LOAD_4758CCA
- OSSL_ENGINE_LOAD_IF_MATCH(4758cca);
+#if HAVE_ENGINE_LOAD_GMP
+ OSSL_ENGINE_LOAD_IF_MATCH(gmp);
+#endif
+#if HAVE_ENGINE_LOAD_GOST
+ OSSL_ENGINE_LOAD_IF_MATCH(gost);
+#endif
+#if HAVE_ENGINE_LOAD_CRYPTODEV
+ OSSL_ENGINE_LOAD_IF_MATCH(cryptodev);
+#endif
+#if HAVE_ENGINE_LOAD_AESNI
+ OSSL_ENGINE_LOAD_IF_MATCH(aesni);
#endif
#endif
#ifdef HAVE_ENGINE_LOAD_OPENBSD_DEV_CRYPTO
@@ -98,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)
{
@@ -107,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)
{
@@ -126,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)
{
@@ -161,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)
{
@@ -169,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)
{
@@ -177,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)
{
@@ -189,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)
{
@@ -212,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)
{
@@ -234,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)
{
@@ -258,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)
{
@@ -280,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)
{
@@ -292,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)
{
@@ -322,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)
{
@@ -344,6 +516,10 @@ ossl_engine_get_cmds(VALUE self)
return ary;
}
+/* Document-method: OpenSSL::Engine#inspect
+ *
+ * Pretty print this engine
+ */
static VALUE
ossl_engine_inspect(VALUE self)
{
diff --git a/ext/openssl/ossl_hmac.c b/ext/openssl/ossl_hmac.c
index 5220c9e73d..0bba44d783 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
diff --git a/ext/openssl/ossl_ns_spki.c b/ext/openssl/ossl_ns_spki.c
index bf828cbb83..b80984cfee 100644
--- a/ext/openssl/ossl_ns_spki.c
+++ b/ext/openssl/ossl_ns_spki.c
@@ -51,6 +51,13 @@ ossl_spki_alloc(VALUE klass)
return obj;
}
+/*
+ * call-seq:
+ * SPKI.new([request]) => spki
+ *
+ * === Parameters
+ * * +request+ - optional raw request, either in PEM or DER format.
+ */
static VALUE
ossl_spki_initialize(int argc, VALUE *argv, VALUE self)
{
@@ -75,6 +82,12 @@ ossl_spki_initialize(int argc, VALUE *argv, VALUE self)
return self;
}
+/*
+ * call-seq:
+ * spki.to_der => DER-encoded string
+ *
+ * Returns the DER encoding of this SPKI.
+ */
static VALUE
ossl_spki_to_der(VALUE self)
{
@@ -95,6 +108,12 @@ ossl_spki_to_der(VALUE self)
return str;
}
+/*
+ * call-seq:
+ * spki.to_pem => PEM-encoded string
+ *
+ * Returns the PEM encoding of this SPKI.
+ */
static VALUE
ossl_spki_to_pem(VALUE self)
{
@@ -111,6 +130,13 @@ ossl_spki_to_pem(VALUE self)
return str;
}
+/*
+ * call-seq:
+ * spki.to_text => string
+ *
+ * Returns a textual representation of this SPKI, useful for debugging
+ * purposes.
+ */
static VALUE
ossl_spki_print(VALUE self)
{
@@ -134,6 +160,13 @@ ossl_spki_print(VALUE self)
return str;
}
+/*
+ * call-seq:
+ * spki.public_key => pkey
+ *
+ * Returns the public key associated with the SPKI, an instance of
+ * OpenSSL::PKey.
+ */
static VALUE
ossl_spki_get_public_key(VALUE self)
{
@@ -148,6 +181,17 @@ ossl_spki_get_public_key(VALUE self)
return ossl_pkey_new(pkey); /* NO DUP - OK */
}
+/*
+ * call-seq:
+ * spki.public_key = pub => pkey
+ *
+ * === Parameters
+ * * +pub+ - the public key to be set for this instance
+ *
+ * Sets the public key to be associated with the SPKI, an instance of
+ * OpenSSL::PKey. This should be the public key corresponding to the
+ * private key used for signing the SPKI.
+ */
static VALUE
ossl_spki_set_public_key(VALUE self, VALUE key)
{
@@ -161,6 +205,12 @@ ossl_spki_set_public_key(VALUE self, VALUE key)
return key;
}
+/*
+ * call-seq:
+ * spki.challenge => string
+ *
+ * Returns the challenge string associated with this SPKI.
+ */
static VALUE
ossl_spki_get_challenge(VALUE self)
{
@@ -176,6 +226,16 @@ ossl_spki_get_challenge(VALUE self)
spki->spkac->challenge->length);
}
+/*
+ * call-seq:
+ * spki.challenge = str => string
+ *
+ * === Parameters
+ * * +str+ - the challenge string to be set for this instance
+ *
+ * Sets the challenge to be associated with the SPKI. May be used by the
+ * server, e.g. to prevent replay.
+ */
static VALUE
ossl_spki_set_challenge(VALUE self, VALUE str)
{
@@ -191,6 +251,19 @@ ossl_spki_set_challenge(VALUE self, VALUE str)
return str;
}
+/*
+ * call-seq:
+ * spki.sign(key, digest) => spki
+ *
+ * === Parameters
+ * * +key+ - the private key to be used for signing this instance
+ * * +digest+ - the digest to be used for signing this instance
+ *
+ * To sign an SPKI, the private key corresponding to the public key set
+ * for this instance should be used, in addition to a digest algorithm in
+ * the form of an OpenSSL::Digest. The private key should be an instance of
+ * OpenSSL::PKey.
+ */
static VALUE
ossl_spki_sign(VALUE self, VALUE key, VALUE digest)
{
@@ -209,7 +282,14 @@ ossl_spki_sign(VALUE self, VALUE key, VALUE digest)
}
/*
- * Checks that cert signature is made with PRIVversion of this PUBLIC 'key'
+ * call-seq:
+ * spki.verify(key) => boolean
+ *
+ * === Parameters
+ * * +key+ - the public key to be used for verifying the SPKI signature
+ *
+ * Returns +true+ if the signature is valid, +false+ otherwise. To verify an
+ * SPKI, the public key contained within the SPKI should be used.
*/
static VALUE
ossl_spki_verify(VALUE self, VALUE key)
@@ -228,12 +308,64 @@ ossl_spki_verify(VALUE self, VALUE key)
return Qnil; /* dummy */
}
-/*
- * NETSCAPE_SPKI init
+/* Document-class: OpenSSL::Netscape::SPKI
+ *
+ * A Simple Public Key Infrastructure implementation (pronounced "spookey").
+ * The structure is defined as
+ * PublicKeyAndChallenge ::= SEQUENCE {
+ * spki SubjectPublicKeyInfo,
+ * challenge IA5STRING
+ * }
+ *
+ * SignedPublicKeyAndChallenge ::= SEQUENCE {
+ * publicKeyAndChallenge PublicKeyAndChallenge,
+ * signatureAlgorithm AlgorithmIdentifier,
+ * signature BIT STRING
+ * }
+ * where the definitions of SubjectPublicKeyInfo and AlgorithmIdentifier can
+ * be found in RFC5280. SPKI is typically used in browsers for generating
+ * a public/private key pair and a subsequent certificate request, using
+ * the HTML <keygen> element.
+ *
+ * == Examples
+ *
+ * === Creating an SPKI
+ * key = OpenSSL::PKey::RSA.new 2048
+ * spki = OpenSSL::Netscape::SPKI.new
+ * spki.challenge = "RandomChallenge"
+ * spki.public_key = key.public_key
+ * spki.sign(key, OpenSSL::Digest::SHA256.new)
+ * #send a request containing this to a server generating a certificate
+ * === Verifiying an SPKI request
+ * request = #...
+ * spki = OpenSSL::Netscape::SPKI.new request
+ * unless spki.verify(spki.public_key)
+ * # signature is invalid
+ * end
+ * #proceed
*/
+
+/* Document-module: OpenSSL::Netscape
+ *
+ * OpenSSL::Netscape is a namespace for SPKI (Simple Public Key
+ * Infrastructure) which implements Signed Public Key and Challenge.
+ * See {RFC 2692}[http://tools.ietf.org/html/rfc2692] and {RFC
+ * 2693}[http://tools.ietf.org/html/rfc2692] for details.
+ */
+
+/* Document-class: OpenSSL::Netscape::SPKIError
+ *
+ * Generic Exception class that is raised if an error occurs during an
+ * operation on an instance of OpenSSL::Netscape::SPKI.
+ */
+
void
Init_ossl_ns_spki()
{
+#if 0
+ mOSSL = rb_define_module("OpenSSL"); /* let rdoc know about mOSSL */
+#endif
+
mNetscape = rb_define_module_under(mOSSL, "Netscape");
eSPKIError = rb_define_class_under(mNetscape, "SPKIError", eOSSLError);
diff --git a/ext/openssl/ossl_ocsp.c b/ext/openssl/ossl_ocsp.c
index e82c2d859a..4e2e8394a4 100644
--- a/ext/openssl/ossl_ocsp.c
+++ b/ext/openssl/ossl_ocsp.c
@@ -149,7 +149,7 @@ ossl_ocspreq_add_nonce(int argc, VALUE *argv, VALUE self)
* 2: nonces both absent.
* 3: nonce present in response only.
* 0: nonces both present and not equal.
- * -1: nonce in request only.
+ * -1: nonce in request only.
*
* For most responders clients can check return > 0.
* If responder doesn't handle nonces return != 0 may be
diff --git a/ext/openssl/ossl_pkcs5.c b/ext/openssl/ossl_pkcs5.c
index d3eaf2d073..3b615e4828 100644
--- a/ext/openssl/ossl_pkcs5.c
+++ b/ext/openssl/ossl_pkcs5.c
@@ -14,12 +14,12 @@ VALUE ePKCS5;
*
* === Parameters
* * +pass+ - string
- * * +salt+ - string
- * * +iter+ - integer - should be greater than 1000. 2000 is better.
+ * * +salt+ - string - should be at least 8 bytes long.
+ * * +iter+ - integer - should be greater than 1000. 20000 is better.
* * +keylen+ - integer
* * +digest+ - a string or OpenSSL::Digest object.
*
- * Available in OpenSSL 0.9.9?.
+ * Available in OpenSSL 0.9.4.
*
* Digests other than SHA1 may not be supported by other cryptography libraries.
*/
@@ -36,8 +36,8 @@ ossl_pkcs5_pbkdf2_hmac(VALUE self, VALUE pass, VALUE salt, VALUE iter, VALUE key
str = rb_str_new(0, len);
- if (PKCS5_PBKDF2_HMAC(RSTRING_PTR(pass), RSTRING_LEN(pass),
- (unsigned char *)RSTRING_PTR(salt), RSTRING_LEN(salt),
+ if (PKCS5_PBKDF2_HMAC(RSTRING_PTR(pass), RSTRING_LENINT(pass),
+ (unsigned char *)RSTRING_PTR(salt), RSTRING_LENINT(salt),
NUM2INT(iter), md, len,
(unsigned char *)RSTRING_PTR(str)) != 1)
ossl_raise(ePKCS5, "PKCS5_PBKDF2_HMAC");
@@ -56,11 +56,11 @@ ossl_pkcs5_pbkdf2_hmac(VALUE self, VALUE pass, VALUE salt, VALUE iter, VALUE key
*
* === Parameters
* * +pass+ - string
- * * +salt+ - string
- * * +iter+ - integer - should be greater than 1000. 2000 is better.
+ * * +salt+ - string - should be at least 8 bytes long.
+ * * +iter+ - integer - should be greater than 1000. 20000 is better.
* * +keylen+ - integer
*
- * This method is available almost any version OpenSSL.
+ * This method is available in almost any version of OpenSSL.
*
* Conforms to rfc2898.
*/
@@ -93,7 +93,95 @@ Init_ossl_pkcs5()
* Password-based Encryption
*
*/
+
+ #if 0
+ mOSSL = rb_define_module("OpenSSL"); /* let rdoc know about mOSSL */
+ #endif
+
+ /* Document-class: OpenSSL::PKCS5
+ *
+ * Provides password-based encryption functionality based on PKCS#5.
+ * Typically used for securely deriving arbitrary length symmetric keys
+ * to be used with an OpenSSL::Cipher from passwords. Another use case
+ * is for storing passwords: Due to the ability to tweak the effort of
+ * computation by increasing the iteration count, computation can be
+ * slowed down artificially in order to render possible attacks infeasible.
+ *
+ * PKCS5 offers support for PBKDF2 with an OpenSSL::Digest::SHA1-based
+ * HMAC, or an arbitrary Digest if the underlying version of OpenSSL
+ * already supports it (>= 0.9.4).
+ *
+ * === Parameters
+ * ==== Password
+ * Typically an arbitrary String that represents the password to be used
+ * for deriving a key.
+ * ==== Salt
+ * Prevents attacks based on dictionaries of common passwords. It is a
+ * public value that can be safely stored along with the password (e.g.
+ * if PBKDF2 is used for password storage). For maximum security, a fresh,
+ * random salt should be generated for each stored password. According
+ * to PKCS#5, a salt should be at least 8 bytes long.
+ * ==== Iteration Count
+ * Allows to tweak the length that the actual computation will take. The
+ * larger the iteration count, the longer it will take.
+ * ==== Key Length
+ * Specifies the length in bytes of the output that will be generated.
+ * Typically, the key length should be larger than or equal to the output
+ * length of the underlying digest function, otherwise an attacker could
+ * simply try to brute-force the key. According to PKCS#5, security is
+ * limited by the output length of the underlying digest function, i.e.
+ * security is not improved if a key length strictly larger than the
+ * digest output length is chosen. Therefore, when using PKCS5 for
+ * password storage, it suffices to store values equal to the digest
+ * output length, nothing is gained by storing larger values.
+ *
+ * == Examples
+ * === Generating a 128 bit key for a Cipher (e.g. AES)
+ * pass = "secret"
+ * salt = OpenSSL::Random.random_bytes(16)
+ * iter = 20000
+ * key_len = 16
+ * key = OpenSSL::PKCS5.pbkdf2_hmac_sha1(pass, salt, iter, key_len)
+ *
+ * === Storing Passwords
+ * pass = "secret"
+ * salt = OpenSSL::Random.random_bytes(16) #store this with the generated value
+ * iter = 20000
+ * digest = OpenSSL::Digest::SHA256.new
+ * len = digest.digest_length
+ * #the final value to be stored
+ * value = OpenSSL::PKCS5.pbkdf2_hmac(pass, salt, iter, len, digest)
+ *
+ * === Important Note on Checking Passwords
+ * When comparing passwords provided by the user with previously stored
+ * values, a common mistake made is comparing the two values using "==".
+ * Typically, "==" short-circuits on evaluation, and is therefore
+ * vulnerable to timing attacks. The proper way is to use a method that
+ * always takes the same amount of time when comparing two values, thus
+ * not leaking any information to potential attackers. To compare two
+ * values, the following could be used:
+ * def eql_time_cmp(a, b)
+ * unless a.length == b.length
+ * return false
+ * end
+ * cmp = b.bytes.to_a
+ * result = 0
+ * a.bytes.each_with_index {|c,i|
+ * result |= c ^ cmp[i]
+ * }
+ * result == 0
+ * end
+ * Please note that the premature return in case of differing lengths
+ * typically does not leak valuable information - when using PKCS#5, the
+ * length of the values to be compared is of fixed size.
+ */
+
mPKCS5 = rb_define_module_under(mOSSL, "PKCS5");
+ /* Document-class: OpenSSL::PKCS5::PKCS5Error
+ *
+ * Generic Exception class that is raised if an error occurs during a
+ * computation.
+ */
ePKCS5 = rb_define_class_under(mPKCS5, "PKCS5Error", eOSSLError);
rb_define_module_function(mPKCS5, "pbkdf2_hmac", ossl_pkcs5_pbkdf2_hmac, 5);
diff --git a/ext/openssl/ossl_pkey.c b/ext/openssl/ossl_pkey.c
index f785e66c00..0004d9d9b5 100644
--- a/ext/openssl/ossl_pkey.c
+++ b/ext/openssl/ossl_pkey.c
@@ -33,6 +33,42 @@ ossl_generate_cb(int p, int n, void *arg)
rb_yield(ary);
}
+#if HAVE_BN_GENCB
+/* OpenSSL 2nd version of GN generation callback */
+int
+ossl_generate_cb_2(int p, int n, BN_GENCB *cb)
+{
+ VALUE ary;
+ struct ossl_generate_cb_arg *arg;
+ int state;
+
+ arg = (struct ossl_generate_cb_arg *)cb->arg;
+ if (arg->yield) {
+ ary = rb_ary_new2(2);
+ rb_ary_store(ary, 0, INT2NUM(p));
+ rb_ary_store(ary, 1, INT2NUM(n));
+
+ /*
+ * can be break by raising exception or 'break'
+ */
+ rb_protect(rb_yield, ary, &state);
+ if (state) {
+ arg->stop = 1;
+ arg->state = state;
+ }
+ }
+ if (arg->stop) return 0;
+ return 1;
+}
+
+void
+ossl_generate_cb_stop(void *ptr)
+{
+ struct ossl_generate_cb_arg *arg = (struct ossl_generate_cb_arg *)ptr;
+ arg->stop = 1;
+}
+#endif
+
/*
* Public
*/
@@ -62,7 +98,8 @@ ossl_pkey_new(EVP_PKEY *pkey)
default:
ossl_raise(ePKeyError, "unsupported key type");
}
- return Qnil; /* not reached */
+
+ UNREACHABLE;
}
VALUE
@@ -75,6 +112,7 @@ ossl_pkey_new_from_file(VALUE filename)
if (!(fp = fopen(RSTRING_PTR(filename), "r"))) {
ossl_raise(ePKeyError, "%s", strerror(errno));
}
+ rb_fd_fix_cloexec(fileno(fp));
pkey = PEM_read_PrivateKey(fp, NULL, ossl_pem_passwd_cb, NULL);
fclose(fp);
diff --git a/ext/openssl/ossl_pkey.h b/ext/openssl/ossl_pkey.h
index 5e3329d326..686e956ee5 100644
--- a/ext/openssl/ossl_pkey.h
+++ b/ext/openssl/ossl_pkey.h
@@ -39,6 +39,16 @@ extern ID id_private_q;
} while (0)
void ossl_generate_cb(int, int, void *);
+#define HAVE_BN_GENCB defined(HAVE_RSA_GENERATE_KEY_EX) || defined(HAVE_DH_GENERATE_PARAMETERS_EX) || defined(HAVE_DSA_GENERATE_PARAMETERS_EX)
+#if HAVE_BN_GENCB
+struct ossl_generate_cb_arg {
+ int yield;
+ int stop;
+ int state;
+};
+int ossl_generate_cb_2(int p, int n, BN_GENCB *cb);
+void ossl_generate_cb_stop(void *ptr);
+#endif
VALUE ossl_pkey_new(EVP_PKEY *);
VALUE ossl_pkey_new_from_file(VALUE);
diff --git a/ext/openssl/ossl_pkey_dh.c b/ext/openssl/ossl_pkey_dh.c
index 748d9c82fd..a6ae0063f5 100644
--- a/ext/openssl/ossl_pkey_dh.c
+++ b/ext/openssl/ossl_pkey_dh.c
@@ -81,20 +81,67 @@ ossl_dh_new(EVP_PKEY *pkey)
/*
* Private
*/
+#if defined(HAVE_DH_GENERATE_PARAMETERS_EX) && HAVE_BN_GENCB
+struct dh_blocking_gen_arg {
+ DH *dh;
+ int size;
+ int gen;
+ BN_GENCB *cb;
+ int result;
+};
+
+static void *
+dh_blocking_gen(void *arg)
+{
+ struct dh_blocking_gen_arg *gen = (struct dh_blocking_gen_arg *)arg;
+ gen->result = DH_generate_parameters_ex(gen->dh, gen->size, gen->gen, gen->cb);
+ return 0;
+}
+#endif
+
static DH *
dh_generate(int size, int gen)
{
- DH *dh;
+#if defined(HAVE_DH_GENERATE_PARAMETERS_EX) && HAVE_BN_GENCB
+ BN_GENCB cb;
+ struct ossl_generate_cb_arg cb_arg;
+ struct dh_blocking_gen_arg gen_arg;
+ DH *dh = DH_new();
- dh = DH_generate_parameters(size, gen,
- rb_block_given_p() ? ossl_generate_cb : NULL,
- NULL);
if (!dh) return 0;
- if (!DH_generate_key(dh)) {
+ memset(&cb_arg, 0, sizeof(struct ossl_generate_cb_arg));
+ if (rb_block_given_p())
+ cb_arg.yield = 1;
+ BN_GENCB_set(&cb, ossl_generate_cb_2, &cb_arg);
+ gen_arg.dh = dh;
+ gen_arg.size = size;
+ gen_arg.gen = gen;
+ gen_arg.cb = &cb;
+ if (cb_arg.yield == 1) {
+ /* we cannot release GVL when callback proc is supplied */
+ dh_blocking_gen(&gen_arg);
+ } else {
+ /* there's a chance to unblock */
+ rb_thread_call_without_gvl(dh_blocking_gen, &gen_arg, ossl_generate_cb_stop, &cb_arg);
+ }
+
+ if (!gen_arg.result) {
DH_free(dh);
+ if (cb_arg.state) rb_jump_tag(cb_arg.state);
return 0;
}
+#else
+ DH *dh;
+
+ dh = DH_generate_parameters(size, gen, rb_block_given_p() ? ossl_generate_cb : NULL, NULL);
+ if (!dh) return 0;
+#endif
+
+ if (!DH_generate_key(dh)) {
+ DH_free(dh);
+ return 0;
+ }
return dh;
}
@@ -231,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
@@ -381,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
diff --git a/ext/openssl/ossl_pkey_dsa.c b/ext/openssl/ossl_pkey_dsa.c
index 6b10e8fdf8..823b9b66e5 100644
--- a/ext/openssl/ossl_pkey_dsa.c
+++ b/ext/openssl/ossl_pkey_dsa.c
@@ -75,9 +75,69 @@ ossl_dsa_new(EVP_PKEY *pkey)
/*
* Private
*/
+#if defined(HAVE_DSA_GENERATE_PARAMETERS_EX) && HAVE_BN_GENCB
+struct dsa_blocking_gen_arg {
+ DSA *dsa;
+ int size;
+ unsigned char* seed;
+ int seed_len;
+ int *counter;
+ unsigned long *h;
+ BN_GENCB *cb;
+ int result;
+};
+
+static void *
+dsa_blocking_gen(void *arg)
+{
+ struct dsa_blocking_gen_arg *gen = (struct dsa_blocking_gen_arg *)arg;
+ gen->result = DSA_generate_parameters_ex(gen->dsa, gen->size, gen->seed, gen->seed_len, gen->counter, gen->h, gen->cb);
+ return 0;
+}
+#endif
+
static DSA *
dsa_generate(int size)
{
+#if defined(HAVE_DSA_GENERATE_PARAMETERS_EX) && HAVE_BN_GENCB
+ BN_GENCB cb;
+ struct ossl_generate_cb_arg cb_arg;
+ struct dsa_blocking_gen_arg gen_arg;
+ DSA *dsa = DSA_new();
+ unsigned char seed[20];
+ int seed_len = 20, counter;
+ unsigned long h;
+
+ if (!dsa) return 0;
+ if (!RAND_bytes(seed, seed_len)) {
+ DSA_free(dsa);
+ return 0;
+ }
+
+ memset(&cb_arg, 0, sizeof(struct ossl_generate_cb_arg));
+ if (rb_block_given_p())
+ cb_arg.yield = 1;
+ BN_GENCB_set(&cb, ossl_generate_cb_2, &cb_arg);
+ gen_arg.dsa = dsa;
+ gen_arg.size = size;
+ gen_arg.seed = seed;
+ gen_arg.seed_len = seed_len;
+ gen_arg.counter = &counter;
+ gen_arg.h = &h;
+ gen_arg.cb = &cb;
+ if (cb_arg.yield == 1) {
+ /* we cannot release GVL when callback proc is supplied */
+ dsa_blocking_gen(&gen_arg);
+ } else {
+ /* there's a chance to unblock */
+ rb_thread_call_without_gvl(dsa_blocking_gen, &gen_arg, ossl_generate_cb_stop, &cb_arg);
+ }
+ if (!gen_arg.result) {
+ DSA_free(dsa);
+ if (cb_arg.state) rb_jump_tag(cb_arg.state);
+ return 0;
+ }
+#else
DSA *dsa;
unsigned char seed[20];
int seed_len = 20, counter;
@@ -87,9 +147,9 @@ dsa_generate(int size)
return 0;
}
dsa = DSA_generate_parameters(size, seed, seed_len, &counter, &h,
- rb_block_given_p() ? ossl_generate_cb : NULL,
- NULL);
+ rb_block_given_p() ? ossl_generate_cb : NULL, NULL);
if(!dsa) return 0;
+#endif
if (!DSA_generate_key(dsa)) {
DSA_free(dsa);
@@ -184,7 +244,7 @@ ossl_dsa_initialize(int argc, VALUE *argv, VALUE self)
BIO_free(in);
if (!dsa) {
ERR_clear_error();
- ossl_raise(eDSAError, "Neither PUB key nor PRIV key:");
+ ossl_raise(eDSAError, "Neither PUB key nor PRIV key");
}
}
if (!EVP_PKEY_assign_DSA(pkey, dsa)) {
@@ -231,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.
*
@@ -258,7 +320,10 @@ ossl_dsa_export(int argc, VALUE *argv, VALUE self)
if (!NIL_P(cipher)) {
ciph = GetCipherPtr(cipher);
if (!NIL_P(pass)) {
- passwd = StringValuePtr(pass);
+ StringValue(pass);
+ if (RSTRING_LENINT(pass) < OSSL_MIN_PWD_LEN)
+ ossl_raise(eOSSLError, "OpenSSL requires passwords to be at least four characters long");
+ passwd = RSTRING_PTR(pass);
}
}
if (!(out = BIO_new(BIO_s_mem()))) {
diff --git a/ext/openssl/ossl_pkey_ec.c b/ext/openssl/ossl_pkey_ec.c
index 9f1050f62d..5e419bd167 100644
--- a/ext/openssl/ossl_pkey_ec.c
+++ b/ext/openssl/ossl_pkey_ec.c
@@ -493,7 +493,10 @@ static VALUE ossl_ec_key_to_string(VALUE self, VALUE ciph, VALUE pass, int forma
if (!NIL_P(ciph)) {
cipher = GetCipherPtr(ciph);
if (!NIL_P(pass)) {
- password = StringValuePtr(pass);
+ StringValue(pass);
+ if (RSTRING_LENINT(pass) < OSSL_MIN_PWD_LEN)
+ ossl_raise(eOSSLError, "OpenSSL requires passwords to be at least four characters long");
+ password = RSTRING_PTR(pass);
}
}
else {
@@ -530,8 +533,8 @@ static VALUE ossl_ec_key_to_string(VALUE self, VALUE ciph, VALUE pass, int forma
/*
* call-seq:
- * key.to_pem => String
- * key.to_pem(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
@@ -540,7 +543,7 @@ static VALUE ossl_ec_key_to_string(VALUE self, VALUE ciph, VALUE pass, int forma
* text.
*
*/
-static VALUE ossl_ec_key_to_pem(int argc, VALUE *argv, VALUE self)
+static VALUE ossl_ec_key_export(int argc, VALUE *argv, VALUE self)
{
VALUE cipher, passwd;
rb_scan_args(argc, argv, "02", &cipher, &passwd);
@@ -700,6 +703,8 @@ static VALUE ossl_ec_key_dsa_verify_asn1(VALUE self, VALUE data, VALUE sig)
}
ossl_raise(eECError, "ECDSA_verify");
+
+ UNREACHABLE;
}
static void ossl_ec_group_free(ossl_ec_group *ec_group)
@@ -757,8 +762,10 @@ static VALUE ossl_ec_group_initialize(int argc, VALUE *argv, VALUE self)
method = EC_GFp_mont_method();
} else if (id == s_GFp_nist) {
method = EC_GFp_nist_method();
+#if !defined(OPENSSL_NO_EC2M)
} else if (id == s_GF2m_simple) {
method = EC_GF2m_simple_method();
+#endif
}
if (method) {
@@ -812,8 +819,10 @@ static VALUE ossl_ec_group_initialize(int argc, VALUE *argv, VALUE self)
if (id == s_GFp) {
new_curve = EC_GROUP_new_curve_GFp;
+#if !defined(OPENSSL_NO_EC2M)
} else if (id == s_GF2m) {
new_curve = EC_GROUP_new_curve_GF2m;
+#endif
} else {
ossl_raise(rb_eArgError, "unknown symbol, must be :GFp or :GF2m");
}
@@ -838,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
*
*/
@@ -1307,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
*
*/
@@ -1349,6 +1360,8 @@ static VALUE ossl_ec_point_is_at_infinity(VALUE self)
case 0: return Qfalse;
default: ossl_raise(cEC_POINT, "EC_POINT_is_at_infinity");
}
+
+ UNREACHABLE;
}
/*
@@ -1370,6 +1383,8 @@ static VALUE ossl_ec_point_is_on_curve(VALUE self)
case 0: return Qfalse;
default: ossl_raise(cEC_POINT, "EC_POINT_is_on_curve");
}
+
+ UNREACHABLE;
}
/*
@@ -1461,6 +1476,78 @@ static VALUE ossl_ec_point_to_bn(VALUE self)
return bn_obj;
}
+/*
+ * call-seq:
+ * point.mul(bn) => point
+ * point.mul(bn, bn) => point
+ * point.mul([bn], [point]) => point
+ * point.mul([bn], [point], bn) => point
+ */
+static VALUE ossl_ec_point_mul(int argc, VALUE *argv, VALUE self)
+{
+ EC_POINT *point1, *point2;
+ const EC_GROUP *group;
+ VALUE group_v = rb_iv_get(self, "@group");
+ VALUE bn_v1, bn_v2, r, points_v;
+ BIGNUM *bn1 = NULL, *bn2 = NULL;
+
+ Require_EC_POINT(self, point1);
+ SafeRequire_EC_GROUP(group_v, group);
+
+ r = rb_obj_alloc(cEC_POINT);
+ ossl_ec_point_initialize(1, &group_v, r);
+ Require_EC_POINT(r, point2);
+
+ argc = rb_scan_args(argc, argv, "12", &bn_v1, &points_v, &bn_v2);
+
+ if (rb_obj_is_kind_of(bn_v1, cBN)) {
+ bn1 = GetBNPtr(bn_v1);
+ if (argc >= 2) {
+ bn2 = GetBNPtr(points_v);
+ }
+ if (EC_POINT_mul(group, point2, bn2, point1, bn1, ossl_bn_ctx) != 1)
+ ossl_raise(eEC_POINT, "Multiplication failed");
+ } else {
+ size_t i, points_len, bignums_len;
+ const EC_POINT **points;
+ const BIGNUM **bignums;
+
+ Check_Type(bn_v1, T_ARRAY);
+ bignums_len = RARRAY_LEN(bn_v1);
+ bignums = (const BIGNUM **)OPENSSL_malloc(bignums_len * (int)sizeof(BIGNUM *));
+
+ for (i = 0; i < bignums_len; ++i) {
+ bignums[i] = GetBNPtr(rb_ary_entry(bn_v1, i));
+ }
+
+ if (!rb_obj_is_kind_of(points_v, rb_cArray)) {
+ OPENSSL_free((void *)bignums);
+ rb_raise(rb_eTypeError, "Argument2 must be an array");
+ }
+
+ rb_ary_unshift(points_v, self);
+ points_len = RARRAY_LEN(points_v);
+ points = (const EC_POINT **)OPENSSL_malloc(points_len * (int)sizeof(EC_POINT *));
+
+ for (i = 0; i < points_len; ++i) {
+ Get_EC_POINT(rb_ary_entry(points_v, i), points[i]);
+ }
+
+ if (argc >= 3) {
+ bn2 = GetBNPtr(bn_v2);
+ }
+ if (EC_POINTs_mul(group, point2, bn2, points_len, points, bignums, ossl_bn_ctx) != 1) {
+ OPENSSL_free((void *)bignums);
+ OPENSSL_free((void *)points);
+ ossl_raise(eEC_POINT, "Multiplication failed");
+ }
+ OPENSSL_free((void *)bignums);
+ OPENSSL_free((void *)points);
+ }
+
+ return r;
+}
+
static void no_copy(VALUE klass)
{
rb_undef_method(klass, "copy");
@@ -1527,7 +1614,8 @@ void Init_ossl_ec()
rb_define_method(cEC, "dsa_verify_asn1", ossl_ec_key_dsa_verify_asn1, 2);
/* do_sign/do_verify */
- rb_define_method(cEC, "to_pem", ossl_ec_key_to_pem, -1);
+ rb_define_method(cEC, "export", ossl_ec_key_export, -1);
+ rb_define_alias(cEC, "to_pem", "export");
rb_define_method(cEC, "to_der", ossl_ec_key_to_der, 0);
rb_define_method(cEC, "to_text", ossl_ec_key_to_text, 0);
@@ -1581,6 +1669,7 @@ void Init_ossl_ec()
/* all the other methods */
rb_define_method(cEC_POINT, "to_bn", ossl_ec_point_to_bn, 0);
+ rb_define_method(cEC_POINT, "mul", ossl_ec_point_mul, -1);
no_copy(cEC);
no_copy(cEC_GROUP);
diff --git a/ext/openssl/ossl_pkey_rsa.c b/ext/openssl/ossl_pkey_rsa.c
index eba693b057..4c346a042f 100644
--- a/ext/openssl/ossl_pkey_rsa.c
+++ b/ext/openssl/ossl_pkey_rsa.c
@@ -76,12 +76,77 @@ ossl_rsa_new(EVP_PKEY *pkey)
/*
* Private
*/
+#if defined(HAVE_RSA_GENERATE_KEY_EX) && HAVE_BN_GENCB
+struct rsa_blocking_gen_arg {
+ RSA *rsa;
+ BIGNUM *e;
+ int size;
+ BN_GENCB *cb;
+ int result;
+};
+
+static void *
+rsa_blocking_gen(void *arg)
+{
+ struct rsa_blocking_gen_arg *gen = (struct rsa_blocking_gen_arg *)arg;
+ gen->result = RSA_generate_key_ex(gen->rsa, gen->size, gen->e, gen->cb);
+ return 0;
+}
+#endif
+
static RSA *
-rsa_generate(int size, int exp)
+rsa_generate(int size, unsigned long exp)
{
- return RSA_generate_key(size, exp,
- rb_block_given_p() ? ossl_generate_cb : NULL,
- NULL);
+#if defined(HAVE_RSA_GENERATE_KEY_EX) && HAVE_BN_GENCB
+ int i;
+ BN_GENCB cb;
+ struct ossl_generate_cb_arg cb_arg;
+ struct rsa_blocking_gen_arg gen_arg;
+ RSA *rsa = RSA_new();
+ BIGNUM *e = BN_new();
+
+ if (!rsa || !e) {
+ if (e) BN_free(e);
+ if (rsa) RSA_free(rsa);
+ return 0;
+ }
+ for (i = 0; i < (int)sizeof(exp) * 8; ++i) {
+ if (exp & (1UL << i)) {
+ if (BN_set_bit(e, i) == 0) {
+ BN_free(e);
+ RSA_free(rsa);
+ return 0;
+ }
+ }
+ }
+
+ memset(&cb_arg, 0, sizeof(struct ossl_generate_cb_arg));
+ if (rb_block_given_p())
+ cb_arg.yield = 1;
+ BN_GENCB_set(&cb, ossl_generate_cb_2, &cb_arg);
+ gen_arg.rsa = rsa;
+ gen_arg.e = e;
+ gen_arg.size = size;
+ gen_arg.cb = &cb;
+ if (cb_arg.yield == 1) {
+ /* we cannot release GVL when callback proc is supplied */
+ rsa_blocking_gen(&gen_arg);
+ } else {
+ /* there's a chance to unblock */
+ rb_thread_call_without_gvl(rsa_blocking_gen, &gen_arg, ossl_generate_cb_stop, &cb_arg);
+ }
+ if (!gen_arg.result) {
+ BN_free(e);
+ RSA_free(rsa);
+ if (cb_arg.state) rb_jump_tag(cb_arg.state);
+ return 0;
+ }
+
+ BN_free(e);
+ return rsa;
+#else
+ return RSA_generate_key(size, exp, rb_block_given_p() ? ossl_generate_cb : NULL, NULL);
+#endif
}
/*
@@ -103,7 +168,7 @@ ossl_rsa_s_generate(int argc, VALUE *argv, VALUE klass)
rb_scan_args(argc, argv, "11", &size, &exp);
- rsa = rsa_generate(NUM2INT(size), NIL_P(exp) ? RSA_F4 : NUM2INT(exp)); /* err handled by rsa_instance */
+ rsa = rsa_generate(NUM2INT(size), NIL_P(exp) ? RSA_F4 : NUM2ULONG(exp)); /* err handled by rsa_instance */
obj = rsa_instance(klass, rsa);
if (obj == Qfalse) {
@@ -148,7 +213,7 @@ ossl_rsa_initialize(int argc, VALUE *argv, VALUE self)
rsa = RSA_new();
}
else if (FIXNUM_P(arg)) {
- rsa = rsa_generate(FIX2INT(arg), NIL_P(pass) ? RSA_F4 : NUM2INT(pass));
+ rsa = rsa_generate(FIX2INT(arg), NIL_P(pass) ? RSA_F4 : NUM2ULONG(pass));
if (!rsa) ossl_raise(eRSAError, NULL);
}
else {
@@ -178,7 +243,7 @@ ossl_rsa_initialize(int argc, VALUE *argv, VALUE self)
}
BIO_free(in);
if (!rsa) {
- ossl_raise(eRSAError, "Neither PUB key nor PRIV key:");
+ ossl_raise(eRSAError, "Neither PUB key nor PRIV key");
}
}
if (!EVP_PKEY_assign_RSA(pkey, rsa)) {
@@ -226,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
@@ -249,7 +315,10 @@ ossl_rsa_export(int argc, VALUE *argv, VALUE self)
if (!NIL_P(cipher)) {
ciph = GetCipherPtr(cipher);
if (!NIL_P(pass)) {
- passwd = StringValuePtr(pass);
+ StringValue(pass);
+ if (RSTRING_LENINT(pass) < OSSL_MIN_PWD_LEN)
+ ossl_raise(eOSSLError, "OpenSSL requires passwords to be at least four characters long");
+ passwd = RSTRING_PTR(pass);
}
}
if (!(out = BIO_new(BIO_s_mem()))) {
diff --git a/ext/openssl/ossl_ssl.c b/ext/openssl/ossl_ssl.c
index e437e7ecd6..77007ba691 100644
--- a/ext/openssl/ossl_ssl.c
+++ b/ext/openssl/ossl_ssl.c
@@ -29,47 +29,54 @@ VALUE eSSLError;
VALUE cSSLContext;
VALUE cSSLSocket;
-#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))
-#define ossl_sslctx_set_ca_file(o,v) rb_iv_set((o),"@ca_file",(v))
-#define ossl_sslctx_set_ca_path(o,v) rb_iv_set((o),"@ca_path",(v))
-#define ossl_sslctx_set_timeout(o,v) rb_iv_set((o),"@timeout",(v))
-#define ossl_sslctx_set_verify_mode(o,v) rb_iv_set((o),"@verify_mode",(v))
-#define ossl_sslctx_set_verify_dep(o,v) rb_iv_set((o),"@verify_depth",(v))
-#define ossl_sslctx_set_verify_cb(o,v) rb_iv_set((o),"@verify_callback",(v))
-#define ossl_sslctx_set_options(o,v) rb_iv_set((o),"@options",(v))
-#define ossl_sslctx_set_cert_store(o,v) rb_iv_set((o),"@cert_store",(v))
-#define ossl_sslctx_set_extra_cert(o,v) rb_iv_set((o),"@extra_chain_cert",(v))
-#define ossl_sslctx_set_client_cert_cb(o,v) rb_iv_set((o),"@client_cert_cb",(v))
-#define ossl_sslctx_set_tmp_dh_cb(o,v) rb_iv_set((o),"@tmp_dh_callback",(v))
-#define ossl_sslctx_set_sess_id_ctx(o, v) rb_iv_get((o),"@session_id_context"(v))
-
-#define ossl_sslctx_get_cert(o) rb_iv_get((o),"@cert")
-#define ossl_sslctx_get_key(o) rb_iv_get((o),"@key")
-#define ossl_sslctx_get_client_ca(o) rb_iv_get((o),"@client_ca")
-#define ossl_sslctx_get_ca_file(o) rb_iv_get((o),"@ca_file")
-#define ossl_sslctx_get_ca_path(o) rb_iv_get((o),"@ca_path")
-#define ossl_sslctx_get_timeout(o) rb_iv_get((o),"@timeout")
-#define ossl_sslctx_get_verify_mode(o) rb_iv_get((o),"@verify_mode")
-#define ossl_sslctx_get_verify_dep(o) rb_iv_get((o),"@verify_depth")
-#define ossl_sslctx_get_verify_cb(o) rb_iv_get((o),"@verify_callback")
-#define ossl_sslctx_get_options(o) rb_iv_get((o),"@options")
-#define ossl_sslctx_get_cert_store(o) rb_iv_get((o),"@cert_store")
-#define ossl_sslctx_get_extra_cert(o) rb_iv_get((o),"@extra_chain_cert")
-#define ossl_sslctx_get_client_cert_cb(o) rb_iv_get((o),"@client_cert_cb")
-#define ossl_sslctx_get_tmp_dh_cb(o) rb_iv_get((o),"@tmp_dh_callback")
-#define ossl_sslctx_get_sess_id_ctx(o) rb_iv_get((o),"@session_id_context")
+static 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))
+#define ossl_sslctx_set_ca_file(o,v) rb_iv_set((o),"@ca_file",(v))
+#define ossl_sslctx_set_ca_path(o,v) rb_iv_set((o),"@ca_path",(v))
+#define ossl_sslctx_set_timeout(o,v) rb_iv_set((o),"@timeout",(v))
+#define ossl_sslctx_set_verify_mode(o,v) rb_iv_set((o),"@verify_mode",(v))
+#define ossl_sslctx_set_verify_dep(o,v) rb_iv_set((o),"@verify_depth",(v))
+#define ossl_sslctx_set_verify_cb(o,v) rb_iv_set((o),"@verify_callback",(v))
+#define ossl_sslctx_set_options(o,v) rb_iv_set((o),"@options",(v))
+#define ossl_sslctx_set_cert_store(o,v) rb_iv_set((o),"@cert_store",(v))
+#define ossl_sslctx_set_extra_cert(o,v) rb_iv_set((o),"@extra_chain_cert",(v))
+#define ossl_sslctx_set_client_cert_cb(o,v) rb_iv_set((o),"@client_cert_cb",(v))
+#define ossl_sslctx_set_tmp_dh_cb(o,v) rb_iv_set((o),"@tmp_dh_callback",(v))
+#define ossl_sslctx_set_sess_id_ctx(o, v) rb_iv_set((o),"@session_id_context",(v))
+
+#define ossl_sslctx_get_cert(o) rb_iv_get((o),"@cert")
+#define ossl_sslctx_get_key(o) rb_iv_get((o),"@key")
+#define ossl_sslctx_get_client_ca(o) rb_iv_get((o),"@client_ca")
+#define ossl_sslctx_get_ca_file(o) rb_iv_get((o),"@ca_file")
+#define ossl_sslctx_get_ca_path(o) rb_iv_get((o),"@ca_path")
+#define ossl_sslctx_get_timeout(o) rb_iv_get((o),"@timeout")
+#define ossl_sslctx_get_verify_mode(o) rb_iv_get((o),"@verify_mode")
+#define ossl_sslctx_get_verify_dep(o) rb_iv_get((o),"@verify_depth")
+#define ossl_sslctx_get_verify_cb(o) rb_iv_get((o),"@verify_callback")
+#define ossl_sslctx_get_options(o) rb_iv_get((o),"@options")
+#define ossl_sslctx_get_cert_store(o) rb_iv_get((o),"@cert_store")
+#define ossl_sslctx_get_extra_cert(o) rb_iv_get((o),"@extra_chain_cert")
+#define ossl_sslctx_get_client_cert_cb(o) rb_iv_get((o),"@client_cert_cb")
+#define ossl_sslctx_get_tmp_dh_cb(o) rb_iv_get((o),"@tmp_dh_callback")
+#define ossl_sslctx_get_sess_id_ctx(o) rb_iv_get((o),"@session_id_context")
static const char *ossl_sslctx_attrs[] = {
"cert", "key", "client_ca", "ca_file", "ca_path",
- "timeout", "verify_mode", "verify_depth",
+ "timeout", "verify_mode", "verify_depth", "renegotiation_cb",
"verify_callback", "options", "cert_store", "extra_chain_cert",
"client_cert_cb", "tmp_dh_callback", "session_id_context",
"session_get_cb", "session_new_cb", "session_remove_cb",
#ifdef HAVE_SSL_SET_TLSEXT_HOST_NAME
"servername_cb",
#endif
+#ifdef HAVE_OPENSSL_NPN_NEGOTIATED
+ "npn_protocols",
+ "npn_select_cb",
+#endif
};
#define ossl_ssl_get_io(o) rb_iv_get((o),"@io")
@@ -96,6 +103,8 @@ static const char *ossl_ssl_attrs[] = {
ID ID_callback_state;
+static VALUE sym_exception;
+
/*
* SSLContext class
*/
@@ -107,6 +116,18 @@ struct {
OSSL_SSL_METHOD_ENTRY(TLSv1),
OSSL_SSL_METHOD_ENTRY(TLSv1_server),
OSSL_SSL_METHOD_ENTRY(TLSv1_client),
+#if defined(HAVE_TLSV1_2_METHOD) && defined(HAVE_TLSV1_2_SERVER_METHOD) && \
+ defined(HAVE_TLSV1_2_CLIENT_METHOD)
+ OSSL_SSL_METHOD_ENTRY(TLSv1_2),
+ OSSL_SSL_METHOD_ENTRY(TLSv1_2_server),
+ OSSL_SSL_METHOD_ENTRY(TLSv1_2_client),
+#endif
+#if defined(HAVE_TLSV1_1_METHOD) && defined(HAVE_TLSV1_1_SERVER_METHOD) && \
+ defined(HAVE_TLSV1_1_CLIENT_METHOD)
+ OSSL_SSL_METHOD_ENTRY(TLSv1_1),
+ OSSL_SSL_METHOD_ENTRY(TLSv1_1_server),
+ OSSL_SSL_METHOD_ENTRY(TLSv1_1_client),
+#endif
#if defined(HAVE_SSLV2_METHOD) && defined(HAVE_SSLV2_SERVER_METHOD) && \
defined(HAVE_SSLV2_CLIENT_METHOD)
OSSL_SSL_METHOD_ENTRY(SSLv2),
@@ -148,7 +169,7 @@ ossl_sslctx_s_alloc(VALUE klass)
ctx = SSL_CTX_new(SSLv23_method());
if (!ctx) {
- ossl_raise(eSSLError, "SSL_CTX_new:");
+ ossl_raise(eSSLError, "SSL_CTX_new");
}
SSL_CTX_set_mode(ctx, mode);
return Data_Wrap_Struct(klass, 0, ossl_sslctx_free, ctx);
@@ -184,7 +205,7 @@ ossl_sslctx_set_ssl_version(VALUE self, VALUE ssl_method)
}
Data_Get_Struct(self, SSL_CTX, ctx);
if (SSL_CTX_set_ssl_version(ctx, method) != 1) {
- ossl_raise(eSSLError, "SSL_CTX_set_ssl_version:");
+ ossl_raise(eSSLError, "SSL_CTX_set_ssl_version");
}
return ssl_method;
@@ -379,7 +400,7 @@ ossl_call_session_new_cb(VALUE ary)
static int
ossl_sslctx_session_new_cb(SSL *ssl, SSL_SESSION *sess)
{
- VALUE ary, ssl_obj, sess_obj, ret_obj;
+ VALUE ary, ssl_obj, sess_obj;
void *ptr;
int state = 0;
@@ -396,13 +417,13 @@ ossl_sslctx_session_new_cb(SSL *ssl, SSL_SESSION *sess)
rb_ary_push(ary, ssl_obj);
rb_ary_push(ary, sess_obj);
- ret_obj = rb_protect((VALUE(*)_((VALUE)))ossl_call_session_new_cb, ary, &state);
+ rb_protect((VALUE(*)_((VALUE)))ossl_call_session_new_cb, ary, &state);
if (state) {
rb_ivar_set(ssl_obj, ID_callback_state, INT2NUM(state));
}
/*
- * 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
@@ -428,7 +449,7 @@ ossl_call_session_remove_cb(VALUE ary)
static void
ossl_sslctx_session_remove_cb(SSL_CTX *ctx, SSL_SESSION *sess)
{
- VALUE ary, sslctx_obj, sess_obj, ret_obj;
+ VALUE ary, sslctx_obj, sess_obj;
void *ptr;
int state = 0;
@@ -445,7 +466,7 @@ ossl_sslctx_session_remove_cb(SSL_CTX *ctx, SSL_SESSION *sess)
rb_ary_push(ary, sslctx_obj);
rb_ary_push(ary, sess_obj);
- ret_obj = rb_protect((VALUE(*)_((VALUE)))ossl_call_session_remove_cb, ary, &state);
+ rb_protect((VALUE(*)_((VALUE)))ossl_call_session_remove_cb, ary, &state);
if (state) {
/*
the SSL_CTX is frozen, nowhere to save state.
@@ -505,7 +526,7 @@ ossl_call_servername_cb(VALUE ary)
static int
ssl_servername_cb(SSL *ssl, int *ad, void *arg)
{
- VALUE ary, ssl_obj, ret_obj;
+ VALUE ary, ssl_obj;
void *ptr;
int state = 0;
const char *servername = SSL_get_servername(ssl, TLSEXT_NAMETYPE_host_name);
@@ -520,7 +541,7 @@ ssl_servername_cb(SSL *ssl, int *ad, void *arg)
rb_ary_push(ary, ssl_obj);
rb_ary_push(ary, rb_str_new2(servername));
- ret_obj = rb_protect((VALUE(*)_((VALUE)))ossl_call_servername_cb, ary, &state);
+ rb_protect((VALUE(*)_((VALUE)))ossl_call_servername_cb, ary, &state);
if (state) {
rb_ivar_set(ssl_obj, ID_callback_state, INT2NUM(state));
return SSL_TLSEXT_ERR_ALERT_FATAL;
@@ -530,6 +551,99 @@ ssl_servername_cb(SSL *ssl, int *ad, void *arg)
}
#endif
+static void
+ssl_renegotiation_cb(const SSL *ssl)
+{
+ VALUE ssl_obj, sslctx_obj, cb;
+ void *ptr;
+
+ if ((ptr = SSL_get_ex_data(ssl, ossl_ssl_ex_ptr_idx)) == NULL)
+ ossl_raise(eSSLError, "SSL object could not be retrieved");
+ ssl_obj = (VALUE)ptr;
+
+ sslctx_obj = rb_iv_get(ssl_obj, "@context");
+ if (NIL_P(sslctx_obj)) return;
+ cb = rb_iv_get(sslctx_obj, "@renegotiation_cb");
+ if (NIL_P(cb)) return;
+
+ (void) rb_funcall(cb, rb_intern("call"), 1, ssl_obj);
+}
+
+#ifdef HAVE_OPENSSL_NPN_NEGOTIATED
+static VALUE
+ssl_npn_encode_protocol_i(VALUE cur, VALUE encoded)
+{
+ int len = RSTRING_LENINT(cur);
+ char len_byte;
+ if (len < 1 || len > 255)
+ ossl_raise(eSSLError, "Advertised protocol must have length 1..255");
+ /* Encode the length byte */
+ len_byte = len;
+ rb_str_buf_cat(encoded, &len_byte, 1);
+ rb_str_buf_cat(encoded, RSTRING_PTR(cur), len);
+ return Qnil;
+}
+
+static void
+ssl_npn_encode_protocols(VALUE sslctx, VALUE protocols)
+{
+ VALUE encoded = rb_str_new2("");
+ rb_iterate(rb_each, protocols, ssl_npn_encode_protocol_i, encoded);
+ StringValueCStr(encoded);
+ rb_iv_set(sslctx, "@_protocols", encoded);
+}
+
+static int
+ssl_npn_advertise_cb(SSL *ssl, const unsigned char **out, unsigned int *outlen, void *arg)
+{
+ VALUE sslctx_obj = (VALUE) arg;
+ VALUE protocols = rb_iv_get(sslctx_obj, "@_protocols");
+
+ *out = (const unsigned char *) RSTRING_PTR(protocols);
+ *outlen = RSTRING_LENINT(protocols);
+
+ return SSL_TLSEXT_ERR_OK;
+}
+
+static int
+ssl_npn_select_cb(SSL *s, unsigned char **out, unsigned char *outlen, const unsigned char *in, unsigned int inlen, void *arg)
+{
+ int i = 0;
+ VALUE sslctx_obj, cb, protocols, selected;
+
+ sslctx_obj = (VALUE) arg;
+ cb = rb_iv_get(sslctx_obj, "@npn_select_cb");
+ protocols = rb_ary_new();
+
+ /* The format is len_1|proto_1|...|len_n|proto_n\0 */
+ while (in[i]) {
+ VALUE protocol = rb_str_new((const char *) &in[i + 1], in[i]);
+ rb_ary_push(protocols, protocol);
+ i += in[i] + 1;
+ }
+
+ selected = rb_funcall(cb, rb_intern("call"), 1, protocols);
+ StringValue(selected);
+ *out = (unsigned char *) StringValuePtr(selected);
+ *outlen = RSTRING_LENINT(selected);
+
+ return SSL_TLSEXT_ERR_OK;
+}
+#endif
+
+/* This function may serve as the entry point to support further
+ * callbacks. */
+static void
+ssl_info_cb(const SSL *ssl, int where, int val)
+{
+ int state = SSL_state(ssl);
+
+ if ((where & SSL_CB_HANDSHAKE_START) &&
+ (state & SSL_ST_ACCEPT)) {
+ ssl_renegotiation_cb(ssl);
+ }
+}
+
/*
* call-seq:
* ctx.setup => Qtrue # first time
@@ -589,14 +703,14 @@ ossl_sslctx_setup(VALUE self)
if (cert && key) {
if (!SSL_CTX_use_certificate(ctx, cert)) {
/* Adds a ref => Safe to FREE */
- ossl_raise(eSSLError, "SSL_CTX_use_certificate:");
+ ossl_raise(eSSLError, "SSL_CTX_use_certificate");
}
if (!SSL_CTX_use_PrivateKey(ctx, key)) {
/* Adds a ref => Safe to FREE */
- ossl_raise(eSSLError, "SSL_CTX_use_PrivateKey:");
+ ossl_raise(eSSLError, "SSL_CTX_use_PrivateKey");
}
if (!SSL_CTX_check_private_key(ctx)) {
- ossl_raise(eSSLError, "SSL_CTX_check_private_key:");
+ ossl_raise(eSSLError, "SSL_CTX_check_private_key");
}
}
@@ -643,11 +757,24 @@ ossl_sslctx_setup(VALUE self)
val = ossl_sslctx_get_options(self);
if(!NIL_P(val)) {
- SSL_CTX_set_options(ctx, NUM2LONG(val));
- }
- else {
+ SSL_CTX_set_options(ctx, NUM2LONG(val));
+ } else {
SSL_CTX_set_options(ctx, SSL_OP_ALL);
}
+
+#ifdef HAVE_OPENSSL_NPN_NEGOTIATED
+ val = rb_iv_get(self, "@npn_protocols");
+ if (!NIL_P(val)) {
+ ssl_npn_encode_protocols(self, val);
+ SSL_CTX_set_next_protos_advertised_cb(ctx, ssl_npn_advertise_cb, (void *) self);
+ OSSL_Debug("SSL NPN advertise callback added");
+ }
+ if (RTEST(rb_iv_get(self, "@npn_select_cb"))) {
+ SSL_CTX_set_next_proto_select_cb(ctx, ssl_npn_select_cb, (void *) self);
+ OSSL_Debug("SSL NPN select callback added");
+ }
+#endif
+
rb_obj_freeze(self);
val = ossl_sslctx_get_sess_id_ctx(self);
@@ -655,7 +782,7 @@ ossl_sslctx_setup(VALUE self)
StringValue(val);
if (!SSL_CTX_set_session_id_context(ctx, (unsigned char *)RSTRING_PTR(val),
RSTRING_LENINT(val))){
- ossl_raise(eSSLError, "SSL_CTX_set_session_id_context:");
+ ossl_raise(eSSLError, "SSL_CTX_set_session_id_context");
}
}
@@ -775,13 +902,12 @@ ossl_sslctx_set_ciphers(VALUE self, VALUE v)
return Qnil;
}
if (!SSL_CTX_set_cipher_list(ctx, RSTRING_PTR(str))) {
- ossl_raise(eSSLError, "SSL_CTX_set_cipher_list:");
+ ossl_raise(eSSLError, "SSL_CTX_set_cipher_list");
}
return v;
}
-
/*
* call-seq:
* ctx.session_add(session) -> true | false
@@ -971,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)
{
@@ -987,8 +1114,8 @@ ossl_ssl_shutdown(SSL *ssl)
if (rc = SSL_shutdown(ssl))
break;
}
- ERR_clear_error();
SSL_clear(ssl);
+ ERR_clear_error();
}
}
@@ -1010,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.
@@ -1061,14 +1188,14 @@ ossl_ssl_setup(VALUE self)
ssl = SSL_new(ctx);
if (!ssl) {
- ossl_raise(eSSLError, "SSL_new:");
+ ossl_raise(eSSLError, "SSL_new");
}
DATA_PTR(self) = ssl;
#ifdef HAVE_SSL_SET_TLSEXT_HOST_NAME
if (!NIL_P(hostname)) {
if (SSL_set_tlsext_host_name(ssl, StringValuePtr(hostname)) != 1)
- ossl_raise(eSSLError, "SSL_set_tlsext_host_name:");
+ ossl_raise(eSSLError, "SSL_set_tlsext_host_name");
}
#endif
io = ossl_ssl_get_io(self);
@@ -1083,6 +1210,7 @@ ossl_ssl_setup(VALUE self)
SSL_set_ex_data(ssl, ossl_ssl_ex_client_cert_cb_idx, (void*)cb);
cb = ossl_sslctx_get_tmp_dh_cb(v_ctx);
SSL_set_ex_data(ssl, ossl_ssl_ex_tmp_dh_callback_idx, (void*)cb);
+ SSL_set_info_callback(ssl, ssl_info_cb);
}
return Qtrue;
@@ -1094,12 +1222,20 @@ ossl_ssl_setup(VALUE self)
#define ssl_get_error(ssl, ret) SSL_get_error((ssl), (ret))
#endif
+#define ossl_ssl_data_get_struct(v, ssl) \
+do { \
+ Data_Get_Struct((v), SSL, (ssl)); \
+ if (!(ssl)) { \
+ rb_warning("SSL session is not started yet."); \
+ return Qnil; \
+ } \
+} while (0)
+
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);
}
}
@@ -1108,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);
}
}
@@ -1124,7 +1259,8 @@ ossl_start_ssl(VALUE self, int (*func)(), const char *funcname, int nonblock)
rb_ivar_set(self, ID_callback_state, Qnil);
- Data_Get_Struct(self, SSL, ssl);
+ ossl_ssl_data_get_struct(self, ssl);
+
GetOpenFile(ossl_ssl_get_io(self), fptr);
for(;;){
ret = func(ssl);
@@ -1239,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{
@@ -1263,20 +1405,26 @@ 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:");
+ ossl_raise(eSSLError, "SSL_read");
}
}
}
@@ -1293,7 +1441,6 @@ ossl_ssl_read_internal(int argc, VALUE *argv, VALUE self, int nonblock)
return str;
}
-
/*
* call-seq:
* ssl.sysread(length) => string
@@ -1312,9 +1459,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.
@@ -1326,7 +1475,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;
@@ -1343,17 +1492,19 @@ 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;
case SSL_ERROR_SYSCALL:
if (errno) rb_sys_fail(0);
default:
- ossl_raise(eSSLError, "SSL_write:");
+ ossl_raise(eSSLError, "SSL_write");
}
}
}
@@ -1376,7 +1527,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);
}
/*
@@ -1387,9 +1538,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);
}
/*
@@ -1403,7 +1563,8 @@ ossl_ssl_close(VALUE self)
{
SSL *ssl;
- Data_Get_Struct(self, SSL, ssl);
+ ossl_ssl_data_get_struct(self, ssl);
+
if (ssl) {
VALUE io = ossl_ssl_get_io(self);
if (!RTEST(rb_funcall(io, rb_intern("closed?"), 0))) {
@@ -1430,11 +1591,7 @@ ossl_ssl_get_cert(VALUE self)
SSL *ssl;
X509 *cert = NULL;
- Data_Get_Struct(self, SSL, ssl);
- if (!ssl) {
- rb_warning("SSL session is not started yet.");
- return Qnil;
- }
+ ossl_ssl_data_get_struct(self, ssl);
/*
* Is this OpenSSL bug? Should add a ref?
@@ -1461,12 +1618,7 @@ ossl_ssl_get_peer_cert(VALUE self)
X509 *cert = NULL;
VALUE obj;
- Data_Get_Struct(self, SSL, ssl);
-
- if (!ssl){
- rb_warning("SSL session is not started yet.");
- return Qnil;
- }
+ ossl_ssl_data_get_struct(self, ssl);
cert = SSL_get_peer_certificate(ssl); /* Adds a ref => Safe to FREE. */
@@ -1494,11 +1646,8 @@ ossl_ssl_get_peer_cert_chain(VALUE self)
VALUE ary;
int i, num;
- Data_Get_Struct(self, SSL, ssl);
- if(!ssl){
- rb_warning("SSL session is not started yet.");
- return Qnil;
- }
+ ossl_ssl_data_get_struct(self, ssl);
+
chain = SSL_get_peer_cert_chain(ssl);
if(!chain) return Qnil;
num = sk_X509_num(chain);
@@ -1512,22 +1661,36 @@ ossl_ssl_get_peer_cert_chain(VALUE self)
}
/*
- * call-seq:
- * ssl.cipher => [name, version, bits, alg_bits]
- *
- * The cipher being used for the current connection
- */
+* call-seq:
+* ssl.ssl_version => String
+*
+* Returns a String representing the SSL/TLS version that was negotiated
+* for the connection, for example "TLSv1.2".
+*/
+static VALUE
+ossl_ssl_get_version(VALUE self)
+{
+ SSL *ssl;
+
+ ossl_ssl_data_get_struct(self, ssl);
+
+ return rb_str_new2(SSL_get_version(ssl));
+}
+
+/*
+* call-seq:
+* ssl.cipher => [name, version, bits, alg_bits]
+*
+* The cipher being used for the current connection
+*/
static VALUE
ossl_ssl_get_cipher(VALUE self)
{
SSL *ssl;
SSL_CIPHER *cipher;
- Data_Get_Struct(self, SSL, ssl);
- if (!ssl) {
- rb_warning("SSL session is not started yet.");
- return Qnil;
- }
+ ossl_ssl_data_get_struct(self, ssl);
+
cipher = (SSL_CIPHER *)SSL_get_current_cipher(ssl);
return ossl_ssl_cipher_to_ary(cipher);
@@ -1545,11 +1708,8 @@ ossl_ssl_get_state(VALUE self)
SSL *ssl;
VALUE ret;
- Data_Get_Struct(self, SSL, ssl);
- if (!ssl) {
- rb_warning("SSL session is not started yet.");
- return Qnil;
- }
+ ossl_ssl_data_get_struct(self, ssl);
+
ret = rb_str_new2(SSL_state_string(ssl));
if (ruby_verbose) {
rb_str_cat2(ret, ": ");
@@ -1569,11 +1729,7 @@ ossl_ssl_pending(VALUE self)
{
SSL *ssl;
- Data_Get_Struct(self, SSL, ssl);
- if (!ssl) {
- rb_warning("SSL session is not started yet.");
- return Qnil;
- }
+ ossl_ssl_data_get_struct(self, ssl);
return INT2NUM(SSL_pending(ssl));
}
@@ -1589,17 +1745,15 @@ ossl_ssl_session_reused(VALUE self)
{
SSL *ssl;
- Data_Get_Struct(self, SSL, ssl);
- if (!ssl) {
- rb_warning("SSL session is not started yet.");
- return Qnil;
- }
+ ossl_ssl_data_get_struct(self, ssl);
switch(SSL_session_reused(ssl)) {
case 1: return Qtrue;
case 0: return Qfalse;
default: ossl_raise(eSSLError, "SSL_session_reused");
}
+
+ UNREACHABLE;
}
/*
@@ -1617,11 +1771,7 @@ ossl_ssl_set_session(VALUE self, VALUE arg1)
/* why is ossl_ssl_setup delayed? */
ossl_ssl_setup(self);
- Data_Get_Struct(self, SSL, ssl);
- if (!ssl) {
- rb_warning("SSL session is not started yet.");
- return Qnil;
- }
+ ossl_ssl_data_get_struct(self, ssl);
SafeGetSSLSession(arg1, sess);
@@ -1645,11 +1795,7 @@ ossl_ssl_get_verify_result(VALUE self)
{
SSL *ssl;
- Data_Get_Struct(self, SSL, ssl);
- if (!ssl) {
- rb_warning("SSL session is not started yet.");
- return Qnil;
- }
+ ossl_ssl_data_get_struct(self, ssl);
return INT2FIX(SSL_get_verify_result(ssl));
}
@@ -1671,16 +1817,38 @@ ossl_ssl_get_client_ca_list(VALUE self)
SSL *ssl;
STACK_OF(X509_NAME) *ca;
- Data_Get_Struct(self, SSL, ssl);
- if (!ssl) {
- rb_warning("SSL session is not started yet.");
- return Qnil;
- }
+ ossl_ssl_data_get_struct(self, ssl);
ca = SSL_get_client_CA_list(ssl);
return ossl_x509name_sk2ary(ca);
}
+# ifdef HAVE_OPENSSL_NPN_NEGOTIATED
+/*
+ * call-seq:
+ * ssl.npn_protocol => String
+ *
+ * Returns the protocol string that was finally selected by the client
+ * during the handshake.
+ */
+static VALUE
+ossl_ssl_npn_protocol(VALUE self)
+{
+ SSL *ssl;
+ const unsigned char *out;
+ unsigned int outlen;
+
+ ossl_ssl_data_get_struct(self, ssl);
+
+ SSL_get0_next_proto_negotiated(ssl, &out, &outlen);
+ if (!outlen)
+ return Qnil;
+ else
+ return rb_str_new((const char *) out, outlen);
+}
+# endif
+#endif /* !defined(OPENSSL_NO_SOCK) */
+
void
Init_ossl_ssl()
{
@@ -1701,8 +1869,23 @@ Init_ossl_ssl()
ossl_ssl_ex_tmp_dh_callback_idx =
SSL_get_ex_new_index(0,(void *)"ossl_ssl_ex_tmp_dh_callback_idx",0,0,0);
+ /* Document-module: OpenSSL::SSL
+ *
+ * Use SSLContext to set up the parameters for a TLS (former SSL)
+ * connection. Both client and server TLS connections are supported,
+ * SSLSocket and SSLServer may be used in conjunction with an instance
+ * of SSLContext to set up connections.
+ */
mSSL = rb_define_module_under(mOSSL, "SSL");
+ /* Document-class: OpenSSL::SSL::SSLError
+ *
+ * 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();
@@ -1860,6 +2043,59 @@ Init_ossl_ssl()
*/
rb_attr(cSSLContext, rb_intern("servername_cb"), 1, 1, Qfalse);
#endif
+ /*
+ * A callback invoked whenever a new handshake is initiated. May be used
+ * to disable renegotiation entirely.
+ *
+ * The callback is invoked with the active SSLSocket. The callback's
+ * return value is irrelevant, normal return indicates "approval" of the
+ * renegotiation and will continue the process. To forbid renegotiation
+ * and to cancel the process, an Error may be raised within the callback.
+ *
+ * === Disable client renegotiation
+ *
+ * When running a server, it is often desirable to disable client
+ * renegotiation entirely. You may use a callback as follows to implement
+ * this feature:
+ *
+ * num_handshakes = 0
+ * ctx.renegotiation_cb = lambda do |ssl|
+ * num_handshakes += 1
+ * raise RuntimeError.new("Client renegotiation disabled") if num_handshakes > 1
+ * end
+ */
+ rb_attr(cSSLContext, rb_intern("renegotiation_cb"), 1, 1, Qfalse);
+#ifdef HAVE_OPENSSL_NPN_NEGOTIATED
+ /*
+ * An Enumerable of Strings. Each String represents a protocol to be
+ * advertised as the list of supported protocols for Next Protocol
+ * Negotiation. Supported in OpenSSL 1.0.1 and higher. Has no effect
+ * on the client side. If not set explicitly, the NPN extension will
+ * not be sent by the server in the handshake.
+ *
+ * === Example
+ *
+ * ctx.npn_protocols = ["http/1.1", "spdy/2"]
+ */
+ rb_attr(cSSLContext, rb_intern("npn_protocols"), 1, 1, Qfalse);
+ /*
+ * A callback invoked on the client side when the client needs to select
+ * a protocol from the list sent by the server. Supported in OpenSSL 1.0.1
+ * and higher. The client MUST select a protocol of those advertised by
+ * the server. If none is acceptable, raising an error in the callback
+ * will cause the handshake to fail. Not setting this callback explicitly
+ * means not supporting the NPN extension on the client - any protocols
+ * advertised by the server will be ignored.
+ *
+ * === Example
+ *
+ * ctx.npn_select_cb = lambda do |protocols|
+ * #inspect the protocols and select one
+ * protocols.first
+ * end
+ */
+ rb_attr(cSSLContext, rb_intern("npn_select_cb"), 1, 1, Qfalse);
+#endif
rb_define_alias(cSSLContext, "ssl_timeout", "timeout");
rb_define_alias(cSSLContext, "ssl_timeout=", "timeout=");
@@ -1870,7 +2106,6 @@ Init_ossl_ssl()
rb_define_method(cSSLContext, "setup", ossl_sslctx_setup, 0);
-
/*
* No session caching for client or server
*/
@@ -1892,7 +2127,7 @@ Init_ossl_ssl()
rb_define_const(cSSLContext, "SESSION_CACHE_BOTH", LONG2FIX(SSL_SESS_CACHE_BOTH)); /* no different than CACHE_SERVER in 0.9.8e */
/*
- * Normally the sesison cache is checked for expired sessions every 255
+ * Normally the session cache is checked for expired sessions every 255
* connections. Since this may lead to a delay that cannot be controlled,
* the automatic flushing may be disabled and #flush_sessions can be
* called explicitly.
@@ -1943,6 +2178,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);
@@ -1957,18 +2195,24 @@ 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);
rb_define_method(cSSLSocket, "peer_cert_chain", ossl_ssl_get_peer_cert_chain, 0);
+ rb_define_method(cSSLSocket, "ssl_version", ossl_ssl_get_version, 0);
rb_define_method(cSSLSocket, "cipher", ossl_ssl_get_cipher, 0);
rb_define_method(cSSLSocket, "state", ossl_ssl_get_state, 0);
rb_define_method(cSSLSocket, "pending", ossl_ssl_pending, 0);
rb_define_method(cSSLSocket, "session_reused?", ossl_ssl_session_reused, 0);
+ /* implementation of OpenSSL::SSL::SSLSocket#session is in lib/openssl/ssl.rb */
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
+ 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))
@@ -1977,7 +2221,7 @@ Init_ossl_ssl()
ossl_ssl_def_const(VERIFY_FAIL_IF_NO_PEER_CERT);
ossl_ssl_def_const(VERIFY_CLIENT_ONCE);
/* Introduce constants included in OP_ALL. These constants are mostly for
- * unset some bits in OP_ALL such as:
+ * unset some bits in OP_ALL such as;
* ctx.options = OP_ALL & ~OP_DONT_INSERT_EMPTY_FRAGMENTS
*/
ossl_ssl_def_const(OP_MICROSOFT_SESS_ID_BUG);
@@ -2006,6 +2250,12 @@ Init_ossl_ssl()
ossl_ssl_def_const(OP_NO_SSLv2);
ossl_ssl_def_const(OP_NO_SSLv3);
ossl_ssl_def_const(OP_NO_TLSv1);
+#if defined(SSL_OP_NO_TLSv1_1)
+ ossl_ssl_def_const(OP_NO_TLSv1_1);
+#endif
+#if defined(SSL_OP_NO_TLSv1_2)
+ ossl_ssl_def_const(OP_NO_TLSv1_2);
+#endif
#if defined(SSL_OP_NO_TICKET)
ossl_ssl_def_const(OP_NO_TICKET);
#endif
@@ -2016,4 +2266,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 f5b2f4ff4a..84cedc763a 100644
--- a/ext/openssl/ossl_x509cert.c
+++ b/ext/openssl/ossl_x509cert.c
@@ -66,6 +66,7 @@ ossl_x509_new_from_file(VALUE filename)
if (!(fp = fopen(RSTRING_PTR(filename), "r"))) {
ossl_raise(eX509CertError, "%s", strerror(errno));
}
+ rb_fd_fix_cloexec(fileno(fp));
x509 = PEM_read_X509(fp, NULL, NULL, NULL);
/*
* prepare for DER...
@@ -829,9 +830,6 @@ Init_ossl_x509cert()
* cert.sign(root_key, OpenSSL::Digest::SHA256.new)
*
*/
-
- eX509CertError = rb_define_class_under(mX509, "CertificateError", eOSSLError);
-
cX509Cert = rb_define_class_under(mX509, "Certificate", rb_cObject);
rb_define_alloc_func(cX509Cert, ossl_x509_alloc);
diff --git a/ext/openssl/ossl_x509name.c b/ext/openssl/ossl_x509name.c
index a8f288f4a5..16a2dfd115 100644
--- a/ext/openssl/ossl_x509name.c
+++ b/ext/openssl/ossl_x509name.c
@@ -111,10 +111,23 @@ ossl_x509name_init_i(VALUE i, VALUE args)
/*
* call-seq:
- * X509::Name.new => name
- * X509::Name.new(string) => name
- * X509::Name.new(dn) => name
- * X509::Name.new(dn, template) => name
+ * X509::Name.new => name
+ * X509::Name.new(der) => name
+ * X509::Name.new(distinguished_name) => name
+ * X509::Name.new(distinguished_name, template) => name
+ *
+ * Creates a new Name.
+ *
+ * A name may be created from a DER encoded string +der+, an Array
+ * representing a +distinguished_name+ or a +distinguished_name+ along with a
+ * +template+.
+ *
+ * name = OpenSSL::X509::Name.new [['CN', 'nobody'], ['DC', 'example']]
+ *
+ * name = OpenSSL::X509::Name.new name.to_der
+ *
+ * See add_entry for a description of the +distinguished_name+ Array's
+ * contents
*/
static VALUE
ossl_x509name_initialize(int argc, VALUE *argv, VALUE self)
@@ -154,6 +167,16 @@ ossl_x509name_initialize(int argc, VALUE *argv, VALUE self)
/*
* call-seq:
* name.add_entry(oid, value [, type]) => self
+ *
+ * Adds a new entry with the given +oid+ and +value+ to this name. The +oid+
+ * is an object identifier defined in ASN.1. Some common OIDs are:
+ *
+ * C:: Country Name
+ * CN:: Common Name
+ * DC:: Domain Component
+ * O:: Organization Name
+ * OU:: Organizational Unit Name
+ * ST:: State or Province Name
*/
static
VALUE ossl_x509name_add_entry(int argc, VALUE *argv, VALUE self)
@@ -192,7 +215,14 @@ ossl_x509name_to_s_old(VALUE self)
/*
* call-seq:
* name.to_s => string
- * name.to_s(integer) => string
+ * name.to_s(flags) => string
+ *
+ * Returns this name as a Distinguished Name string. +flags+ may be one of:
+ *
+ * * OpenSSL::X509::Name::COMPAT
+ * * OpenSSL::X509::Name::RFC2253
+ * * OpenSSL::X509::Name::ONELINE
+ * * OpenSSL::X509::Name::MULTILINE
*/
static VALUE
ossl_x509name_to_s(int argc, VALUE *argv, VALUE self)
@@ -221,6 +251,9 @@ ossl_x509name_to_s(int argc, VALUE *argv, VALUE self)
/*
* call-seq:
* name.to_a => [[name, data, type], ...]
+ *
+ * Returns an Array representation of the distinguished name suitable for
+ * passing to ::new
*/
static VALUE
ossl_x509name_to_a(VALUE self)
@@ -293,6 +326,12 @@ ossl_x509name_cmp(VALUE self, VALUE other)
return INT2FIX(0);
}
+/*
+ * call-seq:
+ * name.eql? other => boolean
+ *
+ * Returns true if +name+ and +other+ refer to the same hash key.
+ */
static VALUE
ossl_x509name_eql(VALUE self, VALUE other)
{
@@ -329,7 +368,7 @@ ossl_x509name_hash(VALUE self)
* call-seq:
* name.hash_old => integer
*
- * hash_old returns MD5 based hash used in OpenSSL 0.9.X.
+ * Returns an MD5 based hash used in OpenSSL 0.9.X.
*/
static VALUE
ossl_x509name_hash_old(VALUE self)
@@ -348,6 +387,8 @@ ossl_x509name_hash_old(VALUE self)
/*
* call-seq:
* name.to_der => string
+ *
+ * Converts the name to DER encoding
*/
static VALUE
ossl_x509name_to_der(VALUE self)
@@ -370,8 +411,19 @@ ossl_x509name_to_der(VALUE self)
}
/*
- * INIT
+ * Document-class: OpenSSL::X509::Name
+ *
+ * An X.509 name represents a hostname, email address or other entity
+ * associated with a public key.
+ *
+ * You can create a Name by parsing a distinguished name String or by
+ * supplying the distinguished name as an Array.
+ *
+ * name = OpenSSL::X509::Name.parse 'CN=nobody/DC=example'
+ *
+ * name = OpenSSL::X509::Name.new [['CN', 'nobody'], ['DC', 'example']]
*/
+
void
Init_ossl_x509name()
{
@@ -400,9 +452,14 @@ Init_ossl_x509name()
utf8str = INT2NUM(V_ASN1_UTF8STRING);
ptrstr = INT2NUM(V_ASN1_PRINTABLESTRING);
ia5str = INT2NUM(V_ASN1_IA5STRING);
+
+ /* Document-const: DEFAULT_OBJECT_TYPE
+ *
+ * The default object type for name entries.
+ */
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);
@@ -410,10 +467,43 @@ Init_ossl_x509name()
rb_hash_aset(hash, rb_str_new2("DC"), ia5str);
rb_hash_aset(hash, rb_str_new2("domainComponent"), ia5str);
rb_hash_aset(hash, rb_str_new2("emailAddress"), ia5str);
+
+ /* Document-const: OBJECT_TYPE_TEMPLATE
+ *
+ * The default object type template for name entries.
+ */
rb_define_const(cX509Name, "OBJECT_TYPE_TEMPLATE", hash);
+ /* Document-const: COMPAT
+ *
+ * A flag for #to_s.
+ *
+ * Breaks the name returned into multiple lines if longer than 80
+ * characters.
+ */
rb_define_const(cX509Name, "COMPAT", ULONG2NUM(XN_FLAG_COMPAT));
+
+ /* Document-const: RFC2253
+ *
+ * A flag for #to_s.
+ *
+ * Returns an RFC2253 format name.
+ */
rb_define_const(cX509Name, "RFC2253", ULONG2NUM(XN_FLAG_RFC2253));
+
+ /* Document-const: ONELINE
+ *
+ * A flag for #to_s.
+ *
+ * Returns a more readable format than RFC2253.
+ */
rb_define_const(cX509Name, "ONELINE", ULONG2NUM(XN_FLAG_ONELINE));
+
+ /* Document-const: MULTILINE
+ *
+ * A flag for #to_s.
+ *
+ * Returns a multiline format.
+ */
rb_define_const(cX509Name, "MULTILINE", ULONG2NUM(XN_FLAG_MULTILINE));
}
diff --git a/ext/openssl/ossl_x509store.c b/ext/openssl/ossl_x509store.c
index 5d341c5192..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 */
@@ -204,6 +204,15 @@ ossl_x509store_set_time(VALUE self, VALUE time)
return time;
}
+/*
+ * call-seq:
+ * store.add_file(file) -> store
+ *
+ *
+ * Adds the certificates in +file+ to the certificate store. The +file+ can
+ * contain multiple PEM-encoded certificates.
+ */
+
static VALUE
ossl_x509store_add_file(VALUE self, VALUE file)
{
@@ -246,6 +255,16 @@ ossl_x509store_add_path(VALUE self, VALUE dir)
return self;
}
+/*
+ * call-seq:
+ * 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
+ * determined by:
+ *
+ * File.dirname OpenSSL::Config::DEFAULT_CONFIG_FILE
+ */
static VALUE
ossl_x509store_set_default_paths(VALUE self)
{
@@ -259,6 +278,13 @@ ossl_x509store_set_default_paths(VALUE self)
return Qnil;
}
+/*
+ * call-seq:
+ * store.add_cert(cert)
+ *
+ * Adds the OpenSSL::X509::Certificate +cert+ to the certificate store.
+ */
+
static VALUE
ossl_x509store_add_cert(VALUE self, VALUE arg)
{
@@ -571,8 +597,47 @@ Init_ossl_x509store()
{
VALUE x509stctx;
+#if 0
+ mOSSL = rb_define_module("OpenSSL"); /* let rdoc know about mOSSL */
+ mX509 = rb_define_module_under(mOSSL, "X509");
+#endif
+
eX509StoreError = rb_define_class_under(mX509, "StoreError", eOSSLError);
+ /* Document-class: OpenSSL::X509::Store
+ *
+ * The X509 certificate store holds trusted CA certificates used to verify
+ * peer certificates.
+ *
+ * The easiest way to create a useful certificate store is:
+ *
+ * cert_store = OpenSSL::X509::Store.new
+ * cert_store.set_default_paths
+ *
+ * This will use your system's built-in certificates.
+ *
+ * If your system does not have a default set of certificates you can
+ * obtain a set from Mozilla here: http://curl.haxx.se/docs/caextract.html
+ * (Note that this set does not have an HTTPS download option so you may
+ * wish to use the firefox-db2pem.sh script to extract the certificates
+ * from a local install to avoid man-in-the-middle attacks.)
+ *
+ * After downloading or generating a cacert.pem from the above link you
+ * can create a certificate store from the pem file like this:
+ *
+ * cert_store = OpenSSL::X509::Store.new
+ * cert_store.add_file 'cacert.pem'
+ *
+ * The certificate store can be used with an SSLSocket like this:
+ *
+ * ssl_context = OpenSSL::SSL::SSLContext.new
+ * ssl_context.cert_store = cert_store
+ *
+ * tcp_socket = TCPSocket.open 'example.com', 443
+ *
+ * ssl_socket = OpenSSL::SSL::SSLSocket.new tcp_socket, ssl_context
+ */
+
cX509Store = rb_define_class_under(mX509, "Store", rb_cObject);
rb_attr(cX509Store, rb_intern("verify_callback"), 1, 0, Qfalse);
rb_attr(cX509Store, rb_intern("error"), 1, 0, Qfalse);
diff --git a/ext/openssl/ruby_missing.h b/ext/openssl/ruby_missing.h
index 1c5d05baca..0f9de1c842 100644
--- a/ext/openssl/ruby_missing.h
+++ b/ext/openssl/ruby_missing.h
@@ -25,17 +25,4 @@
#define rb_io_t OpenFile
#endif
-#ifndef HAVE_RB_STR_SET_LEN
-/* these methods should probably be backported to 1.8 */
-#define rb_str_set_len(str, length) do { \
- RSTRING(str)->ptr[(length)] = 0; \
- RSTRING(str)->len = (length); \
-} while(0)
-#endif /* ! HAVE_RB_STR_SET_LEN */
-
-#ifndef HAVE_RB_BLOCK_CALL
-/* the openssl module doesn't use arg[3-4] and arg2 is always rb_each */
-#define rb_block_call(arg1, arg2, arg3, arg4, arg5, arg6) rb_iterate(rb_each, (arg1), (arg5), (arg6))
-#endif /* ! HAVE_RB_BLOCK_CALL */
-
#endif /* _OSSL_RUBY_MISSING_H_ */
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/lib/pathname.rb b/ext/pathname/lib/pathname.rb
index 1d2b37c66b..46fa72b784 100644
--- a/ext/pathname/lib/pathname.rb
+++ b/ext/pathname/lib/pathname.rb
@@ -8,8 +8,6 @@
#
# For documentation, see class Pathname.
#
-# <tt>pathname.rb</tt> is distributed with Ruby since 1.8.0.
-#
require 'pathname.so'
@@ -29,7 +27,6 @@ class Pathname
proc {|a, b| a == b}
end
- # :startdoc:
if File::ALT_SEPARATOR
SEPARATOR_LIST = "#{Regexp.quote File::ALT_SEPARATOR}#{Regexp.quote File::SEPARATOR}"
@@ -39,8 +36,10 @@ class Pathname
SEPARATOR_PAT = /#{Regexp.quote File::SEPARATOR}/
end
+ # :startdoc:
+
# chop_basename(path) -> [pre-basename, basename] or nil
- def chop_basename(path)
+ def chop_basename(path) # :nodoc:
base = File.basename(path)
if /\A#{SEPARATOR_PAT}?\z/o =~ base
return nil
@@ -51,7 +50,7 @@ class Pathname
private :chop_basename
# split_names(path) -> prefix, [name, ...]
- def split_names(path)
+ def split_names(path) # :nodoc:
names = []
while r = chop_basename(path)
path, basename = r
@@ -61,7 +60,7 @@ class Pathname
end
private :split_names
- def prepend_prefix(prefix, relpath)
+ def prepend_prefix(prefix, relpath) # :nodoc:
if relpath.empty?
File.dirname(prefix)
elsif /#{SEPARATOR_PAT}/o =~ prefix
@@ -78,9 +77,11 @@ class Pathname
# removed. The filesystem is not accessed.
#
# If +consider_symlink+ is +true+, then a more conservative algorithm is used
- # to avoid breaking symbolic linkages. This may retain more <tt>..</tt>
+ # to avoid breaking symbolic linkages. This may retain more +..+
# entries than absolutely necessary, but without accessing the filesystem,
- # this can't be avoided. See #realpath.
+ # this can't be avoided.
+ #
+ # See Pathname#realpath.
#
def cleanpath(consider_symlink=false)
if consider_symlink
@@ -91,10 +92,10 @@ class Pathname
end
#
- # Clean the path simply by resolving and removing excess "." and ".." entries.
+ # Clean the path simply by resolving and removing excess +.+ and +..+ entries.
# Nothing more, nothing less.
#
- def cleanpath_aggressive
+ def cleanpath_aggressive # :nodoc:
path = @path
names = []
pre = path
@@ -120,7 +121,7 @@ class Pathname
private :cleanpath_aggressive
# has_trailing_separator?(path) -> bool
- def has_trailing_separator?(path)
+ def has_trailing_separator?(path) # :nodoc:
if r = chop_basename(path)
pre, basename = r
pre.length + basename.length < path.length
@@ -131,7 +132,7 @@ class Pathname
private :has_trailing_separator?
# add_trailing_separator(path) -> path
- def add_trailing_separator(path)
+ def add_trailing_separator(path) # :nodoc:
if File.basename(path + 'a') == 'a'
path
else
@@ -140,7 +141,7 @@ class Pathname
end
private :add_trailing_separator
- def del_trailing_separator(path)
+ def del_trailing_separator(path) # :nodoc:
if r = chop_basename(path)
pre, basename = r
pre + basename
@@ -152,7 +153,7 @@ class Pathname
end
private :del_trailing_separator
- def cleanpath_conservative
+ def cleanpath_conservative # :nodoc:
path = @path
names = []
pre = path
@@ -179,14 +180,14 @@ class Pathname
end
private :cleanpath_conservative
- # #parent returns the parent directory.
+ # Returns the parent directory.
#
- # This is same as <tt>self + '..'</tt>.
+ # This is same as <code>self + '..'</code>.
def parent
self + '..'
end
- # #mountpoint? returns +true+ if <tt>self</tt> points to a mountpoint.
+ # Returns +true+ if +self+ points to a mountpoint.
def mountpoint?
begin
stat1 = self.lstat
@@ -199,10 +200,10 @@ class Pathname
end
#
- # #root? is a predicate for root directories. I.e. it returns +true+ if the
+ # Predicate method for root directories. Returns +true+ if the
# pathname consists of consecutive slashes.
#
- # It doesn't access actual filesystem. So it may return +false+ for some
+ # It doesn't access the filesystem. So it may return +false+ for some
# pathnames which points to roots such as <tt>/usr/..</tt>.
#
def root?
@@ -210,12 +211,31 @@ class Pathname
end
# Predicate method for testing whether a path is absolute.
+ #
# It returns +true+ if the pathname begins with a slash.
+ #
+ # p = Pathname.new('/im/sure')
+ # p.absolute?
+ # #=> true
+ #
+ # p = Pathname.new('not/so/sure')
+ # p.absolute?
+ # #=> false
def absolute?
!relative?
end
- # The opposite of #absolute?
+ # The opposite of Pathname#absolute?
+ #
+ # It returns +false+ if the pathname begins with a slash.
+ #
+ # p = Pathname.new('/im/sure')
+ # p.relative?
+ # #=> false
+ #
+ # p = Pathname.new('not/so/sure')
+ # p.relative?
+ # #=> true
def relative?
path = @path
while r = chop_basename(path)
@@ -230,6 +250,13 @@ class Pathname
# Pathname.new("/usr/bin/ruby").each_filename {|filename| ... }
# # yields "usr", "bin", and "ruby".
#
+ # Returns an Enumerator if no block was given.
+ #
+ # enum = Pathname.new("/usr/bin/ruby").each_filename
+ # # ... do stuff ...
+ # enum.each { |e| ... }
+ # # yields "usr", "bin", and "ruby".
+ #
def each_filename # :yield: filename
return to_enum(__method__) unless block_given?
_, names = split_names(@path)
@@ -253,9 +280,7 @@ class Pathname
# #<Pathname:path/to/some>
# #<Pathname:path/to/some/file.rb>
#
- # It doesn't access actual filesystem.
- #
- # This method is available since 1.8.5.
+ # It doesn't access the filesystem.
#
def descend
vs = []
@@ -280,9 +305,7 @@ class Pathname
# #<Pathname:path/to>
# #<Pathname:path>
#
- # It doesn't access actual filesystem.
- #
- # This method is available since 1.8.5.
+ # It doesn't access the filesystem.
#
def ascend
path = @path
@@ -295,8 +318,7 @@ class Pathname
end
#
- # Pathname#+ appends a pathname fragment to this one to produce a new Pathname
- # object.
+ # Appends a pathname fragment to +self+ to produce a new Pathname object.
#
# p1 = Pathname.new("/usr") # Pathname:/usr
# p2 = p1 + "bin/ruby" # Pathname:/usr/bin/ruby
@@ -309,7 +331,7 @@ class Pathname
Pathname.new(plus(@path, other.to_s))
end
- def plus(path1, path2) # -> path
+ def plus(path1, path2) # -> path # :nodoc:
prefix2 = path2
index_list2 = []
basename_list2 = []
@@ -352,10 +374,14 @@ class Pathname
private :plus
#
- # Pathname#join joins pathnames.
+ # Joins the given pathnames onto +self+ to create a new Pathname object.
#
- # <tt>path0.join(path1, ..., pathN)</tt> is the same as
- # <tt>path0 + path1 + ... + pathN</tt>.
+ # path0 = Pathname.new("/usr") # Pathname:/usr
+ # path0 = path0.join("bin/ruby") # Pathname:/usr/bin/ruby
+ # # is the same as
+ # path1 = Pathname.new("/usr") + "bin/ruby" # Pathname:/usr/bin/ruby
+ # path0 == path1
+ # #=> true
#
def join(*args)
args.unshift self
@@ -372,10 +398,11 @@ class Pathname
#
# Returns the children of the directory (files and subdirectories, not
- # recursive) as an array of Pathname objects. By default, the returned
- # pathnames will have enough information to access the files. If you set
- # +with_directory+ to +false+, then the returned pathnames will contain the
- # filename only.
+ # recursive) as an array of Pathname objects.
+ #
+ # By default, the returned pathnames will have enough information to access
+ # the files. If you set +with_directory+ to +false+, then the returned
+ # pathnames will contain the filename only.
#
# For example:
# pn = Pathname("/usr/lib/ruby/1.8")
@@ -386,11 +413,9 @@ class Pathname
# pn.children(false)
# # -> [ Pathname:English.rb, Pathname:Env.rb, Pathname:abbrev.rb, ... ]
#
- # Note that the results never contain the entries <tt>.</tt> and <tt>..</tt> in
+ # Note that the results never contain the entries +.+ and +..+ in
# the directory because they are not children.
#
- # This method has existed since 1.8.1.
- #
def children(with_directory=true)
with_directory = false if @path == '.'
result = []
@@ -407,9 +432,14 @@ class Pathname
# Iterates over the children of the directory
# (files and subdirectories, not recursive).
+ #
# It yields Pathname object for each child.
- # By default, the yielded pathnames will have enough information to access the files.
- # If you set +with_directory+ to +false+, then the returned pathnames will contain the filename only.
+ #
+ # By default, the yielded pathnames will have enough information to access
+ # the files.
+ #
+ # If you set +with_directory+ to +false+, then the returned pathnames will
+ # contain the filename only.
#
# Pathname("/usr/local").each_child {|f| p f }
# #=> #<Pathname:/usr/local/share>
@@ -431,20 +461,25 @@ class Pathname
# # #<Pathname:src>
# # #<Pathname:man>
#
+ # Note that the results never contain the entries +.+ and +..+ in
+ # the directory because they are not children.
+ #
+ # See Pathname#children
+ #
def each_child(with_directory=true, &b)
children(with_directory).each(&b)
end
#
- # #relative_path_from returns a relative path from the argument to the
- # receiver. If +self+ is absolute, the argument must be absolute too. If
- # +self+ is relative, the argument must be relative too.
+ # Returns a relative path from the given +base_directory+ to the receiver.
#
- # #relative_path_from doesn't access the filesystem. It assumes no symlinks.
+ # If +self+ is absolute, then +base_directory+ must be absolute too.
#
- # ArgumentError is raised when it cannot find a relative path.
+ # If +self+ is relative, then +base_directory+ must be relative too.
+ #
+ # This method doesn't access the filesystem. It assumes no symlinks.
#
- # This method has existed since 1.8.1.
+ # ArgumentError is raised when it cannot find a relative path.
#
def relative_path_from(base_directory)
dest_directory = self.cleanpath.to_s
@@ -486,16 +521,21 @@ end
class Pathname # * Find *
#
- # Pathname#find is an iterator to traverse a directory tree in a depth first
- # manner. It yields a Pathname for each file under "this" directory.
+ # Iterates over the directory tree in a depth first manner, yielding a
+ # Pathname for each file under "this" directory.
+ #
+ # Returns an Enumerator if no block is given.
#
- # Since it is implemented by <tt>find.rb</tt>, <tt>Find.prune</tt> can be used
- # to control the traversal.
+ # Since it is implemented by the standard library module Find, Find.prune can
+ # be used to control the traversal.
#
- # If +self+ is <tt>.</tt>, yielded pathnames begin with a filename in the
- # current directory, not <tt>./</tt>.
+ # If +self+ is +.+, yielded pathnames begin with a filename in the
+ # current directory, not +./+.
#
- def find(&block) # :yield: pathname
+ # See Find.find
+ #
+ def find # :yield: pathname
+ return to_enum(__method__) unless block_given?
require 'find'
if @path == '.'
Find.find(@path) {|f| yield self.class.new(f.sub(%r{\A\./}, '')) }
@@ -507,15 +547,19 @@ end
class Pathname # * FileUtils *
- # See <tt>FileUtils.mkpath</tt>. Creates a full path, including any
- # intermediate directories that don't yet exist.
+ # Creates a full path, including any intermediate directories that don't yet
+ # exist.
+ #
+ # See FileUtils.mkpath and FileUtils.mkdir_p
def mkpath
require 'fileutils'
FileUtils.mkpath(@path)
nil
end
- # See <tt>FileUtils.rm_r</tt>. Deletes a directory and all beneath it.
+ # Recursively deletes a directory, including all directories beneath it.
+ #
+ # See FileUtils.rm_r
def rmtree
# The name "rmtree" is borrowed from File::Path of Perl.
# File::Path provides "mkpath" and "rmtree".
diff --git a/ext/pathname/pathname.c b/ext/pathname/pathname.c
index e35c19d541..8205b3c830 100644
--- a/ext/pathname/pathname.c
+++ b/ext/pathname/pathname.c
@@ -9,7 +9,7 @@ get_strpath(VALUE obj)
{
VALUE strpath;
strpath = rb_ivar_get(obj, id_at_path);
- if (TYPE(strpath) != T_STRING)
+ if (!RB_TYPE_P(strpath, T_STRING))
rb_raise(rb_eTypeError, "unexpected @path");
return strpath;
}
@@ -22,13 +22,13 @@ set_strpath(VALUE obj, VALUE val)
/*
* Create a Pathname object from the given String (or String-like object).
- * If +path+ contains a NUL character (<tt>\0</tt>), an ArgumentError is raised.
+ * If +path+ contains a NULL character (<tt>\0</tt>), an ArgumentError is raised.
*/
static VALUE
path_initialize(VALUE self, VALUE arg)
{
VALUE str;
- if (TYPE(arg) == T_STRING) {
+ if (RB_TYPE_P(arg, T_STRING)) {
str = arg;
}
else {
@@ -46,6 +46,14 @@ path_initialize(VALUE self, VALUE arg)
return self;
}
+/*
+ * call-seq:
+ * pathname.freeze -> obj
+ *
+ * Freezes this Pathname.
+ *
+ * See Object.freeze.
+ */
static VALUE
path_freeze(VALUE self)
{
@@ -54,6 +62,14 @@ path_freeze(VALUE self)
return self;
}
+/*
+ * call-seq:
+ * pathname.taint -> obj
+ *
+ * Taints this Pathname.
+ *
+ * See Object.taint.
+ */
static VALUE
path_taint(VALUE self)
{
@@ -62,6 +78,14 @@ path_taint(VALUE self)
return self;
}
+/*
+ * call-seq:
+ * pathname.untaint -> obj
+ *
+ * Untaints this Pathname.
+ *
+ * See Object.untaint.
+ */
static VALUE
path_untaint(VALUE self)
{
@@ -84,7 +108,18 @@ path_eq(VALUE self, VALUE other)
}
/*
- * Provides for comparing pathnames, case-sensitively.
+ * Provides a case-sensitive comparison operator for pathnames.
+ *
+ * Pathname.new('/usr') <=> Pathname.new('/usr/bin')
+ * #=> -1
+ * Pathname.new('/usr/bin') <=> Pathname.new('/usr/bin')
+ * #=> 0
+ * Pathname.new('/usr/bin') <=> Pathname.new('/USR/BIN')
+ * #=> 1
+ *
+ * It will return +-1+, +0+ or +1+ depending on the value of the left argument
+ * relative to the right argument. Or it will return +nil+ if the arguments
+ * are not comparable.
*/
static VALUE
path_cmp(VALUE self, VALUE other)
@@ -148,11 +183,15 @@ 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);
}
/*
* Return a pathname which is substituted by String#sub.
+ *
+ * path1 = Pathname.new('/usr/bin/perl')
+ * path1.sub('perl', 'ruby')
+ * #=> #<Pathname:/usr/bin/ruby>
*/
static VALUE
path_sub(int argc, VALUE *argv, VALUE self)
@@ -169,10 +208,12 @@ path_sub(int argc, VALUE *argv, VALUE self)
}
/*
- * Return a pathname which the extension of the basename is substituted by
- * <i>repl</i>.
+ * Return a pathname with +repl+ added as a suffix to the basename.
*
- * If self has no extension part, <i>repl</i> is appended.
+ * If self has no extension part, +repl+ is appended.
+ *
+ * Pathname.new('/usr/bin/shutdown').sub_ext('.rb')
+ * #=> #<Pathname:/usr/bin/shutdown.rb>
*/
static VALUE
path_sub_ext(VALUE self, VALUE repl)
@@ -202,8 +243,10 @@ path_sub_ext(VALUE self, VALUE repl)
/* Facade for File */
/*
- * Returns the real (absolute) pathname of +self+ in the actual
- * filesystem not containing symlinks or useless dots.
+ * Returns the real (absolute) pathname for +self+ in the actual
+ * filesystem.
+ *
+ * Does not contain symlinks or useless dots, +..+ and +.+.
*
* All components of the pathname must exist when this method is
* called.
@@ -220,7 +263,8 @@ path_realpath(int argc, VALUE *argv, VALUE self)
/*
* Returns the real (absolute) pathname of +self+ in the actual filesystem.
- * The real pathname doesn't contain symlinks or useless dots.
+ *
+ * Does not contain symlinks or useless dots, +..+ and +.+.
*
* The last component of the real pathname can be nonexistent.
*/
@@ -241,10 +285,7 @@ path_realdirpath(int argc, VALUE *argv, VALUE self)
* pathname.each_line(sep, limit [, open_args]) {|line| block } -> nil
* pathname.each_line(...) -> an_enumerator
*
- * #each_line iterates over the line in the file. It yields a String object
- * for each line.
- *
- * This method is availabel since 1.8.1.
+ * Iterates over each line in the file and yields a String object for each.
*/
static VALUE
path_each_line(int argc, VALUE *argv, VALUE self)
@@ -267,8 +308,9 @@ path_each_line(int argc, VALUE *argv, VALUE self)
* pathname.read([length [, offset]]) -> string
* pathname.read([length [, offset]], open_args) -> string
*
- * See <tt>IO.read</tt>. Returns all data from the file, or the first +N+ bytes
- * if specified.
+ * Returns all data from the file, or the first +N+ bytes if specified.
+ *
+ * See IO.read.
*
*/
static VALUE
@@ -286,8 +328,9 @@ path_read(int argc, VALUE *argv, VALUE self)
* call-seq:
* pathname.binread([length [, offset]]) -> string
*
- * See <tt>IO.binread</tt>. Returns all the bytes from the file, or the first +N+
- * if specified.
+ * Returns all the bytes from the file, or the first +N+ if specified.
+ *
+ * See IO.binread.
*
*/
static VALUE
@@ -303,11 +346,55 @@ 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
*
- * See <tt>IO.readlines</tt>. Returns all the lines from the file.
+ * Returns all the lines from the file.
+ *
+ * See IO.readlines.
*
*/
static VALUE
@@ -325,7 +412,7 @@ path_readlines(int argc, VALUE *argv, VALUE self)
* call-seq:
* pathname.sysopen([mode, [perm]]) -> fixnum
*
- * See <tt>IO.sysopen</tt>.
+ * See IO.sysopen.
*
*/
static VALUE
@@ -340,7 +427,12 @@ path_sysopen(int argc, VALUE *argv, VALUE self)
}
/*
- * See <tt>File.atime</tt>. Returns last access time.
+ * call-seq:
+ * pathname.atime -> time
+ *
+ * Returns the last access time for the file.
+ *
+ * See File.atime.
*/
static VALUE
path_atime(VALUE self)
@@ -349,7 +441,12 @@ path_atime(VALUE self)
}
/*
- * See <tt>File.ctime</tt>. Returns last (directory entry, not file) change time.
+ * call-seq:
+ * pathname.ctime -> time
+ *
+ * Returns the last change time, using directory information, not the file itself.
+ *
+ * See File.ctime.
*/
static VALUE
path_ctime(VALUE self)
@@ -358,7 +455,12 @@ path_ctime(VALUE self)
}
/*
- * See <tt>File.mtime</tt>. Returns last modification time.
+ * call-seq:
+ * pathname.mtime -> time
+ *
+ * Returns the last modified time of the file.
+ *
+ * See File.mtime.
*/
static VALUE
path_mtime(VALUE self)
@@ -367,7 +469,12 @@ path_mtime(VALUE self)
}
/*
- * See <tt>File.chmod</tt>. Changes permissions.
+ * call-seq:
+ * pathname.chmod -> integer
+ *
+ * Changes file permissions.
+ *
+ * See File.chmod.
*/
static VALUE
path_chmod(VALUE self, VALUE mode)
@@ -376,7 +483,12 @@ path_chmod(VALUE self, VALUE mode)
}
/*
- * See <tt>File.lchmod</tt>.
+ * call-seq:
+ * pathname.lchmod -> integer
+ *
+ * Same as Pathname.chmod, but does not follow symbolic links.
+ *
+ * See File.lchmod.
*/
static VALUE
path_lchmod(VALUE self, VALUE mode)
@@ -385,7 +497,12 @@ path_lchmod(VALUE self, VALUE mode)
}
/*
- * See <tt>File.chown</tt>. Change owner and group of file.
+ * call-seq:
+ * pathname.chown -> integer
+ *
+ * Change owner and group of the file.
+ *
+ * See File.chown.
*/
static VALUE
path_chown(VALUE self, VALUE owner, VALUE group)
@@ -394,7 +511,12 @@ path_chown(VALUE self, VALUE owner, VALUE group)
}
/*
- * See <tt>File.lchown</tt>.
+ * call-seq:
+ * pathname.lchown -> integer
+ *
+ * Same as Pathname.chown, but does not follow symbolic links.
+ *
+ * See File.lchown.
*/
static VALUE
path_lchown(VALUE self, VALUE owner, VALUE group)
@@ -407,8 +529,9 @@ path_lchown(VALUE self, VALUE owner, VALUE group)
* pathname.fnmatch(pattern, [flags]) -> string
* pathname.fnmatch?(pattern, [flags]) -> string
*
- * See <tt>File.fnmatch</tt>. Return +true+ if the receiver matches the given
- * pattern.
+ * Return +true+ if the receiver matches the given pattern.
+ *
+ * See File.fnmatch.
*/
static VALUE
path_fnmatch(int argc, VALUE *argv, VALUE self)
@@ -422,8 +545,12 @@ path_fnmatch(int argc, VALUE *argv, VALUE self)
}
/*
- * See <tt>File.ftype</tt>. Returns "type" of file ("file", "directory",
- * etc).
+ * call-seq:
+ * pathname.ftype -> string
+ *
+ * Returns "type" of file ("file", "directory", etc).
+ *
+ * See File.ftype.
*/
static VALUE
path_ftype(VALUE self)
@@ -435,7 +562,9 @@ path_ftype(VALUE self)
* call-seq:
* pathname.make_link(old)
*
- * See <tt>File.link</tt>. Creates a hard link at _pathname_.
+ * Creates a hard link at _pathname_.
+ *
+ * See File.link.
*/
static VALUE
path_make_link(VALUE self, VALUE old)
@@ -444,7 +573,9 @@ path_make_link(VALUE self, VALUE old)
}
/*
- * See <tt>File.open</tt>. Opens the file for reading or writing.
+ * Opens the file for reading or writing.
+ *
+ * See File.open.
*/
static VALUE
path_open(int argc, VALUE *argv, VALUE self)
@@ -463,7 +594,9 @@ path_open(int argc, VALUE *argv, VALUE self)
}
/*
- * See <tt>File.readlink</tt>. Read symbolic link.
+ * Read symbolic link.
+ *
+ * See File.readlink.
*/
static VALUE
path_readlink(VALUE self)
@@ -474,7 +607,9 @@ path_readlink(VALUE self)
}
/*
- * See <tt>File.rename</tt>. Rename the file.
+ * Rename the file.
+ *
+ * See File.rename.
*/
static VALUE
path_rename(VALUE self, VALUE to)
@@ -483,7 +618,9 @@ path_rename(VALUE self, VALUE to)
}
/*
- * See <tt>File.stat</tt>. Returns a <tt>File::Stat</tt> object.
+ * Returns a File::Stat object.
+ *
+ * See File.stat.
*/
static VALUE
path_stat(VALUE self)
@@ -492,7 +629,7 @@ path_stat(VALUE self)
}
/*
- * See <tt>File.lstat</tt>.
+ * See File.lstat.
*/
static VALUE
path_lstat(VALUE self)
@@ -504,7 +641,9 @@ path_lstat(VALUE self)
* call-seq:
* pathname.make_symlink(old)
*
- * See <tt>File.symlink</tt>. Creates a symbolic link.
+ * Creates a symbolic link.
+ *
+ * See File.symlink.
*/
static VALUE
path_make_symlink(VALUE self, VALUE old)
@@ -513,7 +652,9 @@ path_make_symlink(VALUE self, VALUE old)
}
/*
- * See <tt>File.truncate</tt>. Truncate the file to +length+ bytes.
+ * Truncates the file to +length+ bytes.
+ *
+ * See File.truncate.
*/
static VALUE
path_truncate(VALUE self, VALUE length)
@@ -522,7 +663,9 @@ path_truncate(VALUE self, VALUE length)
}
/*
- * See <tt>File.utime</tt>. Update the access and modification times.
+ * Update the access and modification times of the file.
+ *
+ * See File.utime.
*/
static VALUE
path_utime(VALUE self, VALUE atime, VALUE mtime)
@@ -531,7 +674,9 @@ path_utime(VALUE self, VALUE atime, VALUE mtime)
}
/*
- * See <tt>File.basename</tt>. Returns the last component of the path.
+ * Returns the last component of the path.
+ *
+ * See File.basename.
*/
static VALUE
path_basename(int argc, VALUE *argv, VALUE self)
@@ -546,7 +691,9 @@ path_basename(int argc, VALUE *argv, VALUE self)
}
/*
- * See <tt>File.dirname</tt>. Returns all but the last component of the path.
+ * Returns all but the last component of the path.
+ *
+ * See File.dirname.
*/
static VALUE
path_dirname(VALUE self)
@@ -557,7 +704,9 @@ path_dirname(VALUE self)
}
/*
- * See <tt>File.extname</tt>. Returns the file's extension.
+ * Returns the file's extension.
+ *
+ * See File.extname.
*/
static VALUE
path_extname(VALUE self)
@@ -567,7 +716,9 @@ path_extname(VALUE self)
}
/*
- * See <tt>File.expand_path</tt>.
+ * Returns the absolute path for the file.
+ *
+ * See File.expand_path.
*/
static VALUE
path_expand_path(int argc, VALUE *argv, VALUE self)
@@ -582,7 +733,9 @@ path_expand_path(int argc, VALUE *argv, VALUE self)
}
/*
- * See <tt>File.split</tt>. Returns the #dirname and the #basename in an Array.
+ * Returns the #dirname and the #basename in an Array.
+ *
+ * See File.split.
*/
static VALUE
path_split(VALUE self)
@@ -599,7 +752,7 @@ path_split(VALUE self)
}
/*
- * See <tt>FileTest.blockdev?</tt>.
+ * See FileTest.blockdev?.
*/
static VALUE
path_blockdev_p(VALUE self)
@@ -608,7 +761,7 @@ path_blockdev_p(VALUE self)
}
/*
- * See <tt>FileTest.chardev?</tt>.
+ * See FileTest.chardev?.
*/
static VALUE
path_chardev_p(VALUE self)
@@ -617,7 +770,7 @@ path_chardev_p(VALUE self)
}
/*
- * See <tt>FileTest.executable?</tt>.
+ * See FileTest.executable?.
*/
static VALUE
path_executable_p(VALUE self)
@@ -626,7 +779,7 @@ path_executable_p(VALUE self)
}
/*
- * See <tt>FileTest.executable_real?</tt>.
+ * See FileTest.executable_real?.
*/
static VALUE
path_executable_real_p(VALUE self)
@@ -635,7 +788,7 @@ path_executable_real_p(VALUE self)
}
/*
- * See <tt>FileTest.exist?</tt>.
+ * See FileTest.exist?.
*/
static VALUE
path_exist_p(VALUE self)
@@ -644,7 +797,7 @@ path_exist_p(VALUE self)
}
/*
- * See <tt>FileTest.grpowned?</tt>.
+ * See FileTest.grpowned?.
*/
static VALUE
path_grpowned_p(VALUE self)
@@ -653,7 +806,7 @@ path_grpowned_p(VALUE self)
}
/*
- * See <tt>FileTest.directory?</tt>.
+ * See FileTest.directory?.
*/
static VALUE
path_directory_p(VALUE self)
@@ -662,7 +815,7 @@ path_directory_p(VALUE self)
}
/*
- * See <tt>FileTest.file?</tt>.
+ * See FileTest.file?.
*/
static VALUE
path_file_p(VALUE self)
@@ -671,7 +824,7 @@ path_file_p(VALUE self)
}
/*
- * See <tt>FileTest.pipe?</tt>.
+ * See FileTest.pipe?.
*/
static VALUE
path_pipe_p(VALUE self)
@@ -680,7 +833,7 @@ path_pipe_p(VALUE self)
}
/*
- * See <tt>FileTest.socket?</tt>.
+ * See FileTest.socket?.
*/
static VALUE
path_socket_p(VALUE self)
@@ -689,7 +842,7 @@ path_socket_p(VALUE self)
}
/*
- * See <tt>FileTest.owned?</tt>.
+ * See FileTest.owned?.
*/
static VALUE
path_owned_p(VALUE self)
@@ -698,7 +851,7 @@ path_owned_p(VALUE self)
}
/*
- * See <tt>FileTest.readable?</tt>.
+ * See FileTest.readable?.
*/
static VALUE
path_readable_p(VALUE self)
@@ -707,7 +860,7 @@ path_readable_p(VALUE self)
}
/*
- * See <tt>FileTest.world_readable?</tt>.
+ * See FileTest.world_readable?.
*/
static VALUE
path_world_readable_p(VALUE self)
@@ -716,7 +869,7 @@ path_world_readable_p(VALUE self)
}
/*
- * See <tt>FileTest.readable_real?</tt>.
+ * See FileTest.readable_real?.
*/
static VALUE
path_readable_real_p(VALUE self)
@@ -725,7 +878,7 @@ path_readable_real_p(VALUE self)
}
/*
- * See <tt>FileTest.setuid?</tt>.
+ * See FileTest.setuid?.
*/
static VALUE
path_setuid_p(VALUE self)
@@ -734,7 +887,7 @@ path_setuid_p(VALUE self)
}
/*
- * See <tt>FileTest.setgid?</tt>.
+ * See FileTest.setgid?.
*/
static VALUE
path_setgid_p(VALUE self)
@@ -743,7 +896,7 @@ path_setgid_p(VALUE self)
}
/*
- * See <tt>FileTest.size</tt>.
+ * See FileTest.size.
*/
static VALUE
path_size(VALUE self)
@@ -752,7 +905,7 @@ path_size(VALUE self)
}
/*
- * See <tt>FileTest.size?</tt>.
+ * See FileTest.size?.
*/
static VALUE
path_size_p(VALUE self)
@@ -761,7 +914,7 @@ path_size_p(VALUE self)
}
/*
- * See <tt>FileTest.sticky?</tt>.
+ * See FileTest.sticky?.
*/
static VALUE
path_sticky_p(VALUE self)
@@ -770,7 +923,7 @@ path_sticky_p(VALUE self)
}
/*
- * See <tt>FileTest.symlink?</tt>.
+ * See FileTest.symlink?.
*/
static VALUE
path_symlink_p(VALUE self)
@@ -779,7 +932,7 @@ path_symlink_p(VALUE self)
}
/*
- * See <tt>FileTest.writable?</tt>.
+ * See FileTest.writable?.
*/
static VALUE
path_writable_p(VALUE self)
@@ -788,7 +941,7 @@ path_writable_p(VALUE self)
}
/*
- * See <tt>FileTest.world_writable?</tt>.
+ * See FileTest.world_writable?.
*/
static VALUE
path_world_writable_p(VALUE self)
@@ -797,7 +950,7 @@ path_world_writable_p(VALUE self)
}
/*
- * See <tt>FileTest.writable_real?</tt>.
+ * See FileTest.writable_real?.
*/
static VALUE
path_writable_real_p(VALUE self)
@@ -806,7 +959,7 @@ path_writable_real_p(VALUE self)
}
/*
- * See <tt>FileTest.zero?</tt>.
+ * See FileTest.zero?.
*/
static VALUE
path_zero_p(VALUE self)
@@ -821,7 +974,12 @@ glob_i(VALUE elt, VALUE klass, int argc, VALUE *argv)
}
/*
- * See <tt>Dir.glob</tt>. Returns or yields Pathname objects.
+ * Returns or yields Pathname objects.
+ *
+ * Pathname.glob("config/" "*.rb")
+ * #=> [#<Pathname:config/environment.rb>, #<Pathname:config/routes.rb>, ..]
+ *
+ * See Dir.glob.
*/
static VALUE
path_s_glob(int argc, VALUE *argv, VALUE klass)
@@ -839,7 +997,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);
}
@@ -848,7 +1006,12 @@ path_s_glob(int argc, VALUE *argv, VALUE klass)
}
/*
- * See <tt>Dir.getwd</tt>. Returns the current working directory as a Pathname.
+ * Returns the current working directory as a Pathname.
+ *
+ * Pathname.getwd
+ * #=> #<Pathname:/home/zzak/projects/ruby>
+ *
+ * See Dir.getwd.
*/
static VALUE
path_s_getwd(VALUE klass)
@@ -862,8 +1025,27 @@ path_s_getwd(VALUE klass)
* Return the entries (files and subdirectories) in the directory, each as a
* Pathname object.
*
- * The result may contain the current directory #<Pathname:.> and the parent
- * directory #<Pathname:..>.
+ * The results contains just the names in the directory, without any trailing
+ * slashes or recursive look-up.
+ *
+ * pp Pathname.new('/usr/local').entries
+ * #=> [#<Pathname:share>,
+ * # #<Pathname:lib>,
+ * # #<Pathname:..>,
+ * # #<Pathname:include>,
+ * # #<Pathname:etc>,
+ * # #<Pathname:bin>,
+ * # #<Pathname:man>,
+ * # #<Pathname:games>,
+ * # #<Pathname:.>,
+ * # #<Pathname:sbin>,
+ * # #<Pathname:src>]
+ *
+ * The result may contain the current directory <code>#<Pathname:.></code> and
+ * the parent directory <code>#<Pathname:..></code>.
+ *
+ * If you don't want +.+ and +..+ and
+ * want directories, consider Pathname#children.
*/
static VALUE
path_entries(VALUE self)
@@ -875,7 +1057,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);
}
@@ -883,7 +1065,9 @@ path_entries(VALUE self)
}
/*
- * See <tt>Dir.mkdir</tt>. Create the referenced directory.
+ * Create the referenced directory.
+ *
+ * See Dir.mkdir.
*/
static VALUE
path_mkdir(int argc, VALUE *argv, VALUE self)
@@ -897,7 +1081,9 @@ path_mkdir(int argc, VALUE *argv, VALUE self)
}
/*
- * See <tt>Dir.rmdir</tt>. Remove the referenced directory.
+ * Remove the referenced directory.
+ *
+ * See Dir.rmdir.
*/
static VALUE
path_rmdir(VALUE self)
@@ -906,7 +1092,9 @@ path_rmdir(VALUE self)
}
/*
- * See <tt>Dir.open</tt>.
+ * Opens the referenced directory.
+ *
+ * See Dir.open.
*/
static VALUE
path_opendir(VALUE self)
@@ -924,10 +1112,8 @@ each_entry_i(VALUE elt, VALUE klass, int argc, VALUE *argv)
}
/*
- * Iterates over the entries (files and subdirectories) in the directory. It
- * yields a Pathname object for each entry.
- *
- * This method has available since 1.8.1.
+ * Iterates over the entries (files and subdirectories) in the directory,
+ * yielding a Pathname object for each entry.
*/
static VALUE
path_each_entry(VALUE self)
@@ -951,8 +1137,8 @@ unlink_rescue(VALUE str, VALUE errinfo)
}
/*
- * Removes a file or directory, using <tt>File.unlink</tt> or
- * <tt>Dir.unlink</tt> as necessary.
+ * Removes a file or directory, using File.unlink if +self+ is a file, or
+ * Dir.unlink as necessary.
*/
static VALUE
path_unlink(VALUE self)
@@ -963,9 +1149,20 @@ path_unlink(VALUE self)
}
/*
- * create a 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.
*
- * This method is available since 1.8.5.
+ * require 'pathname'
+ * Pathname("/home/zzak")
+ * #=> #<Pathname:/home/zzak>
+ *
+ * See also Pathname::new for more information.
*/
static VALUE
path_f_pathname(VALUE self, VALUE str)
@@ -974,24 +1171,26 @@ path_f_pathname(VALUE self, VALUE str)
}
/*
- * == Pathname
*
- * Pathname represents a pathname which locates a file in a filesystem.
- * The pathname depends on OS: Unix, Windows, etc.
- * Pathname library works with pathnames of local OS.
- * However non-Unix pathnames are supported experimentally.
+ * Pathname represents the name of a file or directory on the filesystem,
+ * but not the file itself.
+ *
+ * The pathname depends on the Operating System: Unix, Windows, etc.
+ * This library works with pathnames of local OS, however non-Unix pathnames
+ * are supported experimentally.
*
- * It does not represent the file itself.
* A Pathname can be relative or absolute. It's not until you try to
* reference the file that it even matters whether the file exists or not.
*
* Pathname is immutable. It has no method for destructive update.
*
- * The value of this class is to manipulate file path information in a neater
+ * The goal of this class is to manipulate file path information in a neater
* way than standard Ruby provides. The examples below demonstrate the
- * difference. *All* functionality from File, FileTest, and some from Dir and
- * FileUtils is included, in an unsurprising way. It is essentially a facade for
- * all of these, and more.
+ * difference.
+ *
+ * *All* functionality from File, FileTest, and some from Dir and FileUtils is
+ * included, in an unsurprising way. It is essentially a facade for all of
+ * these, and more.
*
* == Examples
*
@@ -1039,8 +1238,8 @@ path_f_pathname(VALUE self, VALUE str)
* === Core methods
*
* These methods are effectively manipulating a String, because that's
- * all a path is. Except for #mountpoint?, #children, #each_child,
- * #realdirpath and #realpath, they don't access the filesystem.
+ * all a path is. None of these access the file system except for
+ * #mountpoint?, #children, #each_child, #realdirpath and #realpath.
*
* - +
* - #join
@@ -1177,6 +1376,8 @@ 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, "ctime", path_ctime, 0);
diff --git a/ext/psych/.gitignore b/ext/psych/.gitignore
new file mode 100644
index 0000000000..836058c169
--- /dev/null
+++ b/ext/psych/.gitignore
@@ -0,0 +1,11 @@
+/api.c
+/config.h
+/dumper.c
+/emitter.c
+/loader.c
+/parser.c
+/reader.c
+/scanner.c
+/writer.c
+/yaml.h
+/yaml_private.h
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/extconf.rb b/ext/psych/extconf.rb
index ccc8c9c304..65e83a3554 100644
--- a/ext/psych/extconf.rb
+++ b/ext/psych/extconf.rb
@@ -1,15 +1,37 @@
+# -*- coding: us-ascii -*-
require 'mkmf'
+require 'fileutils'
# :stopdoc:
dir_config 'libyaml'
-def asplode missing
- raise "#{missing} is missing. Please install libyaml."
-end
+if enable_config("bundled-libyaml", false) || !(find_header('yaml.h') && find_library('yaml', 'yaml_get_version'))
+ # Embed libyaml since we could not find it.
+
+ $VPATH << "$(srcdir)/yaml"
+ $INCFLAGS << " -I$(srcdir)/yaml"
+
+ $srcs = Dir.glob("#{$srcdir}/{,yaml/}*.c").map {|n| File.basename(n)}
-asplode('yaml.h') unless find_header 'yaml.h'
-asplode('libyaml') unless find_library 'yaml', 'yaml_get_version'
+ if have_macro("_WIN32")
+ $CPPFLAGS << " -DYAML_DECLARE_STATIC -DHAVE_CONFIG_H"
+ end
+
+ have_header 'dlfcn.h'
+ have_header 'inttypes.h'
+ have_header 'memory.h'
+ have_header 'stdint.h'
+ have_header 'stdlib.h'
+ have_header 'strings.h'
+ have_header 'string.h'
+ have_header 'sys/stat.h'
+ have_header 'sys/types.h'
+ have_header 'unistd.h'
+
+ find_header 'yaml.h'
+ have_header 'config.h'
+end
create_makefile 'psych'
diff --git a/ext/psych/lib/psych.rb b/ext/psych/lib/psych.rb
index 19d8b2bc12..f4abd283d4 100644
--- a/ext/psych/lib/psych.rb
+++ b/ext/psych/lib/psych.rb
@@ -18,10 +18,12 @@ require 'psych/handlers/document_stream'
###
# = Overview
#
-# Psych is a YAML parser and emitter. Psych leverages
-# libyaml[http://libyaml.org] for it's 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.
+# 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
+# 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.
#
# = I NEED TO PARSE OR EMIT YAML RIGHT NOW!
#
@@ -39,16 +41,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 chnages 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
@@ -56,28 +116,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 chnages 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
@@ -85,25 +150,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 = '1.3.4'
+ VERSION = '2.0.1'
# 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.
@@ -121,7 +238,7 @@ module Psych
# Psych.load("--- `", "file.txt")
# rescue Psych::SyntaxError => ex
# ex.file # => 'file.txt'
- # ex.message # => "(foo.txt): found character that cannot start any token"
+ # ex.message # => "(file.txt): found character that cannot start any token"
# end
def self.load yaml, filename = nil
result = parse(yaml, filename)
@@ -129,7 +246,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.
#
@@ -137,13 +303,13 @@ 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")
# rescue Psych::SyntaxError => ex
# ex.file # => 'file.txt'
- # ex.message # => "(foo.txt): found character that cannot start any token"
+ # ex.message # => "(file.txt): found character that cannot start any token"
# end
#
# See Psych::Nodes for more information about YAML AST.
@@ -155,7 +321,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
@@ -171,7 +337,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.
@@ -193,7 +359,7 @@ module Psych
# Psych.parse_stream("--- `", "file.txt")
# rescue Psych::SyntaxError => ex
# ex.file # => 'file.txt'
- # ex.message # => "(foo.txt): found character that cannot start any token"
+ # ex.message # => "(file.txt): found character that cannot start any token"
# end
#
# See Psych::Nodes for more information about YAML AST.
@@ -238,7 +404,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
@@ -250,7 +416,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
@@ -258,16 +424,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:
@@ -292,7 +458,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
@@ -318,7 +484,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/core_ext.rb b/ext/psych/lib/psych/core_ext.rb
index 4a04c2d128..9c8134da7e 100644
--- a/ext/psych/lib/psych/core_ext.rb
+++ b/ext/psych/lib/psych/core_ext.rb
@@ -31,12 +31,5 @@ class Module
end
if defined?(::IRB)
-module Kernel
- def psych_y *objects
- puts Psych.dump_stream(*objects)
- end
- remove_method :y rescue nil
- alias y psych_y
- private :y
-end
+ require 'psych/y'
end
diff --git a/ext/psych/lib/psych/deprecated.rb b/ext/psych/lib/psych/deprecated.rb
index 333c3a1016..8c310b3207 100644
--- a/ext/psych/lib/psych/deprecated.rb
+++ b/ext/psych/lib/psych/deprecated.rb
@@ -21,6 +21,7 @@ module Psych
target.psych_to_yaml unless opts[:nodump]
end
+ # This method is deprecated, use Psych.load_stream instead.
def self.load_documents yaml, &block
if $VERBOSE
warn "#{caller[0]}: load_documents is deprecated, use load_stream"
@@ -34,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/handler.rb b/ext/psych/lib/psych/handler.rb
index d3b99636c4..c55afe745f 100644
--- a/ext/psych/lib/psych/handler.rb
+++ b/ext/psych/lib/psych/handler.rb
@@ -25,6 +25,19 @@ module Psych
# Default dumping options
OPTIONS = DumperOptions.new
+ # Events that a Handler should respond to.
+ EVENTS = [ :alias,
+ :empty,
+ :end_document,
+ :end_mapping,
+ :end_sequence,
+ :end_stream,
+ :scalar,
+ :start_document,
+ :start_mapping,
+ :start_sequence,
+ :start_stream ]
+
###
# Called with +encoding+ when the YAML stream starts. This method is
# called once per stream. A stream may contain multiple documents.
diff --git a/ext/psych/lib/psych/handlers/recorder.rb b/ext/psych/lib/psych/handlers/recorder.rb
new file mode 100644
index 0000000000..4eae62e5f9
--- /dev/null
+++ b/ext/psych/lib/psych/handlers/recorder.rb
@@ -0,0 +1,39 @@
+require 'psych/handler'
+
+module Psych
+ module Handlers
+ ###
+ # This handler will capture an event and record the event. Recorder events
+ # are available vial Psych::Handlers::Recorder#events.
+ #
+ # For example:
+ #
+ # recorder = Psych::Handlers::Recorder.new
+ # parser = Psych::Parser.new recorder
+ # parser.parse '--- foo'
+ #
+ # recorder.events # => [list of events]
+ #
+ # # Replay the events
+ #
+ # emitter = Psych::Emitter.new $stdout
+ # recorder.events.each do |m, args|
+ # emitter.send m, *args
+ # end
+
+ class Recorder < Psych::Handler
+ attr_reader :events
+
+ def initialize
+ @events = []
+ super
+ end
+
+ EVENTS.each do |event|
+ define_method event do |*args|
+ @events << [event, args]
+ end
+ end
+ 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/scalar_scanner.rb b/ext/psych/lib/psych/scalar_scanner.rb
index fa2d385a63..068fc0e3cf 100644
--- a/ext/psych/lib/psych/scalar_scanner.rb
+++ b/ext/psych/lib/psych/scalar_scanner.rb
@@ -8,23 +8,36 @@ module Psych
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)
+ FLOAT = /^(?:[-+]?([0-9][0-9_,]*)?\.[0-9]*([eE][-+][0-9]+)?(?# base 10)
|[-+]?[0-9][0-9_,]*(:[0-5]?[0-9])+\.[0-9_]*(?# base 60)
|[-+]?\.(inf|Inf|INF)(?# infinity)
|\.(nan|NaN|NAN)(?# not a number))$/x
+ # Taken from http://yaml.org/type/int.html
+ INTEGER = /^(?:[-+]?0b[0-1_]+ (?# base 2)
+ |[-+]?0[0-7_]+ (?# base 8)
+ |[-+]?(?: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)
+ return @symbol_cache[string] if @symbol_cache.key?(string)
case string
- when /^[A-Za-z~]/
+ # 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!@#\$%\^&\*\(\)\{\}\<\>\|\/\\~;=]+/
if string.length > 5
@string_cache[string] = true
return string
@@ -45,25 +58,29 @@ module Psych
string
end
when TIME
- parse_time string
+ begin
+ parse_time string
+ rescue ArgumentError
+ string
+ end
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
when /^\.inf$/i
- 1 / 0.0
+ Float::INFINITY
when /^-\.inf$/i
- -1 / 0.0
+ -Float::INFINITY
when /^\.nan$/i
- 0.0 / 0.0
+ Float::NAN
when /^:./
if string =~ /^:(["'])(.*)\1/
- $2.sub(/^:/, '').to_sym
+ @symbol_cache[string] = class_loader.symbolize($2.sub(/^:/, ''))
else
- string.sub(/^:/, '').to_sym
+ @symbol_cache[string] = class_loader.symbolize(string.sub(/^:/, ''))
end
when /^[-+]?[0-9][0-9_]*(:[0-5]?[0-9])+$/
i = 0
@@ -78,20 +95,15 @@ module Psych
end
i
when FLOAT
- begin
- return Float(string.gsub(/[,_]/, ''))
- rescue ArgumentError
+ if string =~ /\A[-+]?\.\Z/
+ @string_cache[string] = true
+ string
+ else
+ Float(string.gsub(/[,_]|\.$/, ''))
end
-
- @string_cache[string] = true
- string
else
- if string.count('.') < 2
- begin
- return Integer(string.gsub(/[,_]/, ''))
- rescue ArgumentError
- end
- end
+ int = parse_int string.gsub(/[,_]/, '')
+ return int if int
@string_cache[string] = true
string
@@ -99,8 +111,17 @@ module Psych
end
###
+ # Parse and return an int from +string+
+ def parse_int string
+ return unless INTEGER === string
+ Integer(string)
+ end
+
+ ###
# 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 }
md = time.match(/(\d+:\d+:\d+)(?:\.(\d*))?\s*(Z|[-+]\d+(:\d\d)?)?/)
@@ -108,10 +129,10 @@ module Psych
(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
@@ -122,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 f79743dba4..e200ef0060 100644
--- a/ext/psych/lib/psych/syntax_error.rb
+++ b/ext/psych/lib/psych/syntax_error.rb
@@ -1,5 +1,7 @@
+require 'psych/exception'
+
module Psych
- class SyntaxError < ::SyntaxError
+ 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 088301ac14..1bfffb952f 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,23 @@ 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/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 +100,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 +121,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)
@@ -118,6 +134,8 @@ module Psych
end
case o.tag
+ when nil
+ register_empty(o)
when '!omap', 'tag:yaml.org,2002:omap'
map = register(o, Psych::Omap.new)
o.children.each { |a|
@@ -130,51 +148,29 @@ module Psych
o.children.each { |c| list.push accept c }
list
else
- list = register(o, [])
- o.children.each { |c| list.push accept c }
- list
+ register_empty(o)
end
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 /^!(?:str|ruby\/string)(?::(.*))?/, 'tag:yaml.org,2002:str'
- klass = resolve_class($1)
- members = Hash[*o.children.map { |c| accept c }]
- string = members.delete 'str'
-
- if klass
- string = klass.allocate.replace string
- register(o, string)
- end
-
- init_with(string, members.map { |k,v| [k.to_s.sub(/^@/, ''),v] }, o)
- when /^!ruby\/array:(.*)$/
- klass = resolve_class($1)
- list = register(o, klass.allocate)
-
- members = Hash[o.children.map { |c| accept c }.each_slice(2).to_a]
- list.replace members['internal']
-
- members['ivars'].each do |ivar, v|
- list.instance_variable_set ivar, v
- end
- list
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
@@ -182,55 +178,95 @@ 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 })
+ klass.new(*h.map { |k,v|
+ class_loader.symbolize k
+ }).new(*h.map { |k,v| v })
+ 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'])
+ else
+ 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 = {}
+ string = nil
+
+ 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)
+ list = register(o, klass.allocate)
+
+ members = Hash[o.children.map { |c| accept c }.each_slice(2).to_a]
+ list.replace members['internal']
+
+ members['ivars'].each do |ivar, v|
+ list.instance_variable_set ivar, v
+ end
+ 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)
end
set
- when '!ruby/object:Complex'
- h = Hash[*o.children.map { |c| accept c }]
- register o, Complex(h['real'], h['image'])
-
- when '!ruby/object:Rational'
- h = Hash[*o.children.map { |c| accept c }]
- register o, Rational(h['numerator'], h['denominator'])
-
- when /^!ruby\/object:?(.*)?$/
- name = $1 || 'Object'
- obj = revive((resolve_class(name) || Object), o)
- obj
-
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
@@ -252,36 +288,52 @@ module Psych
object
end
- def revive_hash hash, o
- @st[o.anchor] = hash if o.anchor
+ def register_empty object
+ list = register(object, [])
+ object.children.each { |c| list.push accept c }
+ list
+ end
- o.children.each_slice(2) { |k,v|
+ def revive_hash hash, o
+ o.children.each_slice(2) { |k,v|
key = accept(k)
+ val = accept(v)
if key == '<<'
case v
when Nodes::Alias
- hash.merge! accept(v)
+ begin
+ hash.merge! val
+ rescue TypeError
+ hash[key] = val
+ end
when Nodes::Sequence
- accept(v).reverse_each do |value|
- hash.merge! value
+ begin
+ h = {}
+ val.reverse_each do |value|
+ h.merge! value
+ end
+ hash.merge! h
+ rescue TypeError
+ hash[key] = val
end
else
- hash[key] = accept(v)
+ hash[key] = val
end
else
- hash[key] = accept(v)
+ hash[key] = val
end
}
hash
end
+ def merge_key hash, key, val
+ 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
@@ -303,21 +355,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 948a976dd1..b469e2ddc3 100644
--- a/ext/psych/lib/psych/visitors/yaml_tree.rb
+++ b/ext/psych/lib/psych/visitors/yaml_tree.rb
@@ -1,23 +1,67 @@
+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' }
# builder.tree # => #<Psych::Nodes::Stream .. }
#
class YAMLTree < Psych::Visitors::Visitor
+ class Registrar # :nodoc:
+ def initialize
+ @obj_to_id = {}
+ @obj_to_node = {}
+ @counter = 0
+ end
+
+ def register target, node
+ @obj_to_node[target.object_id] = node
+ end
+
+ def key? target
+ @obj_to_node.key? target.object_id
+ end
+
+ def id_for target
+ @obj_to_id[target.object_id] ||= (@counter += 1)
+ end
+
+ def node_for target
+ @obj_to_node[target.object_id]
+ end
+ end
+
attr_reader :started, :finished
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
@emitter = emitter
- @st = {}
+ @st = Registrar.new
@ss = ss
@options = options
@coders = []
@@ -47,6 +91,7 @@ module Psych
def tree
finish unless finished?
+ @emitter.root
end
def push object
@@ -65,15 +110,15 @@ module Psych
@emitter.start_document version, [], false
accept object
- @emitter.end_document
+ @emitter.end_document !@emitter.streaming?
end
alias :<< :push
def accept target
# return any aliases we find
- if @st.key? target.object_id
- oid = target.object_id
- node = @st[oid]
+ if @st.key? target
+ oid = @st.id_for target
+ node = @st.node_for target
anchor = oid.to_s
node.anchor = anchor
return @emitter.alias anchor
@@ -171,7 +216,7 @@ module Psych
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
@@ -219,28 +264,28 @@ 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.index("\x00") ||
- string.count("\x00-\x7F", "^ -~\t\r\n").fdiv(string.length) > 0.3
- end
- private :binary?
-
def visit_String o
- plain = false
- quote = false
- style = Nodes::Scalar::ANY
+ plain = true
+ quote = true
+ style = Nodes::Scalar::PLAIN
+ tag = nil
+ str = o
if binary?(o)
str = [o].pack('m').chomp
tag = '!binary' # FIXME: change to below when syck is removed
#tag = 'tag:yaml.org,2002:binary'
style = Nodes::Scalar::LITERAL
+ plain = false
+ quote = false
+ elsif o =~ /\n/
+ style = Nodes::Scalar::LITERAL
+ elsif o =~ /^\W/
+ style = Nodes::Scalar::DOUBLE_QUOTED
else
- str = o
- tag = nil
- quote = !(String === @ss.tokenize(o))
- plain = !quote
+ unless String === @ss.tokenize(o)
+ style = Nodes::Scalar::SINGLE_QUOTED
+ end
end
ivars = find_ivars o
@@ -248,6 +293,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
@@ -326,6 +373,17 @@ module Psych
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?
@@ -402,7 +460,7 @@ module Psych
end
def register target, yaml_obj
- @st[target.object_id] = yaml_obj
+ @st.register target, yaml_obj
yaml_obj
end
@@ -432,7 +490,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/lib/psych/y.rb b/ext/psych/lib/psych/y.rb
new file mode 100644
index 0000000000..d0e049d4e5
--- /dev/null
+++ b/ext/psych/lib/psych/y.rb
@@ -0,0 +1,9 @@
+module Kernel
+ ###
+ # An alias for Psych.dump_stream meant to be used with IRB.
+ def y *objects
+ puts Psych.dump_stream(*objects)
+ end
+ private :y
+end
+
diff --git a/ext/psych/psych.gemspec b/ext/psych/psych.gemspec
new file mode 100644
index 0000000000..a8599c9bd1
--- /dev/null
+++ b/ext/psych/psych.gemspec
@@ -0,0 +1,23 @@
+# -*- encoding: utf-8 -*-
+
+Gem::Specification.new do |s|
+ s.name = "psych"
+ s.version = "2.0.1"
+
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
+ s.authors = ["Aaron Patterson"]
+ s.date = "2013-09-18"
+ s.description = "Psych is a YAML parser and emitter. Psych leverages libyaml[http://pyyaml.org/wiki/LibYAML]\nfor its YAML parsing and emitting capabilities. In addition to wrapping\nlibyaml, Psych also knows how to serialize and de-serialize most Ruby objects\nto and from the YAML format."
+ s.email = ["aaron@tenderlovemaking.com"]
+ s.extensions = ["ext/psych/extconf.rb"]
+ s.extra_rdoc_files = ["CHANGELOG.rdoc", "Manifest.txt", "README.rdoc"]
+ s.files = [".autotest", ".travis.yml", "CHANGELOG.rdoc", "Manifest.txt", "README.rdoc", "Rakefile", "ext/psych/depend", "ext/psych/extconf.rb", "ext/psych/psych.c", "ext/psych/psych.h", "ext/psych/psych_emitter.c", "ext/psych/psych_emitter.h", "ext/psych/psych_parser.c", "ext/psych/psych_parser.h", "ext/psych/psych_to_ruby.c", "ext/psych/psych_to_ruby.h", "ext/psych/psych_yaml_tree.c", "ext/psych/psych_yaml_tree.h", "ext/psych/yaml/LICENSE", "ext/psych/yaml/api.c", "ext/psych/yaml/config.h", "ext/psych/yaml/dumper.c", "ext/psych/yaml/emitter.c", "ext/psych/yaml/loader.c", "ext/psych/yaml/parser.c", "ext/psych/yaml/reader.c", "ext/psych/yaml/scanner.c", "ext/psych/yaml/writer.c", "ext/psych/yaml/yaml.h", "ext/psych/yaml/yaml_private.h", "lib/psych.rb", "lib/psych/class_loader.rb", "lib/psych/coder.rb", "lib/psych/core_ext.rb", "lib/psych/deprecated.rb", "lib/psych/exception.rb", "lib/psych/handler.rb", "lib/psych/handlers/document_stream.rb", "lib/psych/handlers/recorder.rb", "lib/psych/json/ruby_events.rb", "lib/psych/json/stream.rb", "lib/psych/json/tree_builder.rb", "lib/psych/json/yaml_events.rb", "lib/psych/nodes.rb", "lib/psych/nodes/alias.rb", "lib/psych/nodes/document.rb", "lib/psych/nodes/mapping.rb", "lib/psych/nodes/node.rb", "lib/psych/nodes/scalar.rb", "lib/psych/nodes/sequence.rb", "lib/psych/nodes/stream.rb", "lib/psych/omap.rb", "lib/psych/parser.rb", "lib/psych/scalar_scanner.rb", "lib/psych/set.rb", "lib/psych/stream.rb", "lib/psych/streaming.rb", "lib/psych/syntax_error.rb", "lib/psych/tree_builder.rb", "lib/psych/visitors.rb", "lib/psych/visitors/depth_first.rb", "lib/psych/visitors/emitter.rb", "lib/psych/visitors/json_tree.rb", "lib/psych/visitors/to_ruby.rb", "lib/psych/visitors/visitor.rb", "lib/psych/visitors/yaml_tree.rb", "lib/psych/y.rb", "test/psych/handlers/test_recorder.rb", "test/psych/helper.rb", "test/psych/json/test_stream.rb", "test/psych/nodes/test_enumerable.rb", "test/psych/test_alias_and_anchor.rb", "test/psych/test_array.rb", "test/psych/test_boolean.rb", "test/psych/test_class.rb", "test/psych/test_coder.rb", "test/psych/test_date_time.rb", "test/psych/test_deprecated.rb", "test/psych/test_document.rb", "test/psych/test_emitter.rb", "test/psych/test_encoding.rb", "test/psych/test_engine_manager.rb", "test/psych/test_exception.rb", "test/psych/test_hash.rb", "test/psych/test_json_tree.rb", "test/psych/test_merge_keys.rb", "test/psych/test_nil.rb", "test/psych/test_null.rb", "test/psych/test_numeric.rb", "test/psych/test_object.rb", "test/psych/test_object_references.rb", "test/psych/test_omap.rb", "test/psych/test_parser.rb", "test/psych/test_psych.rb", "test/psych/test_safe_load.rb", "test/psych/test_scalar.rb", "test/psych/test_scalar_scanner.rb", "test/psych/test_serialize_subclasses.rb", "test/psych/test_set.rb", "test/psych/test_stream.rb", "test/psych/test_string.rb", "test/psych/test_struct.rb", "test/psych/test_symbol.rb", "test/psych/test_tainted.rb", "test/psych/test_to_yaml_properties.rb", "test/psych/test_tree_builder.rb", "test/psych/test_yaml.rb", "test/psych/test_yamldbm.rb", "test/psych/test_yamlstore.rb", "test/psych/visitors/test_depth_first.rb", "test/psych/visitors/test_emitter.rb", "test/psych/visitors/test_to_ruby.rb", "test/psych/visitors/test_yaml_tree.rb", ".gemtest"]
+ s.homepage = "http://github.com/tenderlove/psych"
+ s.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 = "2.0.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_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.h b/ext/psych/psych.h
index 9f1be449a2..1830ca4b19 100644
--- a/ext/psych/psych.h
+++ b/ext/psych/psych.h
@@ -9,10 +9,10 @@
#include <yaml.h>
-#include <parser.h>
-#include <emitter.h>
-#include <to_ruby.h>
-#include <yaml_tree.h>
+#include <psych_parser.h>
+#include <psych_emitter.h>
+#include <psych_to_ruby.h>
+#include <psych_yaml_tree.h>
extern VALUE mPsych;
diff --git a/ext/psych/emitter.c b/ext/psych/psych_emitter.c
index f0d032649c..f0d032649c 100644
--- a/ext/psych/emitter.c
+++ b/ext/psych/psych_emitter.c
diff --git a/ext/psych/emitter.h b/ext/psych/psych_emitter.h
index 560451ef31..560451ef31 100644
--- a/ext/psych/emitter.h
+++ b/ext/psych/psych_emitter.h
diff --git a/ext/psych/parser.c b/ext/psych/psych_parser.c
index 0908a1b49f..8c65ce1307 100644
--- a/ext/psych/parser.c
+++ b/ext/psych/psych_parser.c
@@ -557,7 +557,7 @@ void Init_psych_parser()
rb_define_const(cPsychParser, "UTF16BE", INT2NUM(YAML_UTF16BE_ENCODING));
rb_require("psych/syntax_error");
- ePsychSyntaxError = rb_define_class_under(mPsych, "SyntaxError", rb_eSyntaxError);
+ ePsychSyntaxError = rb_const_get(mPsych, rb_intern("SyntaxError"));
rb_define_method(cPsychParser, "parse", parse, -1);
rb_define_method(cPsychParser, "mark", mark, 0);
diff --git a/ext/psych/parser.h b/ext/psych/psych_parser.h
index 25e896f01d..25e896f01d 100644
--- a/ext/psych/parser.h
+++ b/ext/psych/psych_parser.h
diff --git a/ext/psych/to_ruby.c b/ext/psych/psych_to_ruby.c
index ed5245e12e..3cc87a965e 100644
--- a/ext/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/to_ruby.h b/ext/psych/psych_to_ruby.h
index 7b8e757a45..7b8e757a45 100644
--- a/ext/psych/to_ruby.h
+++ b/ext/psych/psych_to_ruby.h
diff --git a/ext/psych/yaml_tree.c b/ext/psych/psych_yaml_tree.c
index bcf24d2070..bcf24d2070 100644
--- a/ext/psych/yaml_tree.c
+++ b/ext/psych/psych_yaml_tree.c
diff --git a/ext/psych/yaml_tree.h b/ext/psych/psych_yaml_tree.h
index 4628a69d71..4628a69d71 100644
--- a/ext/psych/yaml_tree.h
+++ b/ext/psych/psych_yaml_tree.h
diff --git a/ext/psych/yaml/LICENSE b/ext/psych/yaml/LICENSE
new file mode 100644
index 0000000000..050ced23f6
--- /dev/null
+++ b/ext/psych/yaml/LICENSE
@@ -0,0 +1,19 @@
+Copyright (c) 2006 Kirill Simonov
+
+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/ext/psych/yaml/api.c b/ext/psych/yaml/api.c
new file mode 100644
index 0000000000..0c4732e152
--- /dev/null
+++ b/ext/psych/yaml/api.c
@@ -0,0 +1,1392 @@
+
+#include "yaml_private.h"
+
+/*
+ * Get the library version.
+ */
+
+YAML_DECLARE(const char *)
+yaml_get_version_string(void)
+{
+ return YAML_VERSION_STRING;
+}
+
+/*
+ * Get the library version numbers.
+ */
+
+YAML_DECLARE(void)
+yaml_get_version(int *major, int *minor, int *patch)
+{
+ *major = YAML_VERSION_MAJOR;
+ *minor = YAML_VERSION_MINOR;
+ *patch = YAML_VERSION_PATCH;
+}
+
+/*
+ * Allocate a dynamic memory block.
+ */
+
+YAML_DECLARE(void *)
+yaml_malloc(size_t size)
+{
+ return malloc(size ? size : 1);
+}
+
+/*
+ * Reallocate a dynamic memory block.
+ */
+
+YAML_DECLARE(void *)
+yaml_realloc(void *ptr, size_t size)
+{
+ return ptr ? realloc(ptr, size ? size : 1) : malloc(size ? size : 1);
+}
+
+/*
+ * Free a dynamic memory block.
+ */
+
+YAML_DECLARE(void)
+yaml_free(void *ptr)
+{
+ if (ptr) free(ptr);
+}
+
+/*
+ * Duplicate a string.
+ */
+
+YAML_DECLARE(yaml_char_t *)
+yaml_strdup(const yaml_char_t *str)
+{
+ if (!str)
+ return NULL;
+
+ return (yaml_char_t *)strdup((char *)str);
+}
+
+/*
+ * Extend a string.
+ */
+
+YAML_DECLARE(int)
+yaml_string_extend(yaml_char_t **start,
+ yaml_char_t **pointer, yaml_char_t **end)
+{
+ yaml_char_t *new_start = yaml_realloc(*start, (*end - *start)*2);
+
+ if (!new_start) return 0;
+
+ memset(new_start + (*end - *start), 0, *end - *start);
+
+ *pointer = new_start + (*pointer - *start);
+ *end = new_start + (*end - *start)*2;
+ *start = new_start;
+
+ return 1;
+}
+
+/*
+ * Append a string B to a string A.
+ */
+
+YAML_DECLARE(int)
+yaml_string_join(
+ yaml_char_t **a_start, yaml_char_t **a_pointer, yaml_char_t **a_end,
+ yaml_char_t **b_start, yaml_char_t **b_pointer, yaml_char_t **b_end)
+{
+ if (*b_start == *b_pointer)
+ return 1;
+
+ while (*a_end - *a_pointer <= *b_pointer - *b_start) {
+ if (!yaml_string_extend(a_start, a_pointer, a_end))
+ return 0;
+ }
+
+ memcpy(*a_pointer, *b_start, *b_pointer - *b_start);
+ *a_pointer += *b_pointer - *b_start;
+
+ return 1;
+}
+
+/*
+ * Extend a stack.
+ */
+
+YAML_DECLARE(int)
+yaml_stack_extend(void **start, void **top, void **end)
+{
+ void *new_start = yaml_realloc(*start, ((char *)*end - (char *)*start)*2);
+
+ if (!new_start) return 0;
+
+ *top = (char *)new_start + ((char *)*top - (char *)*start);
+ *end = (char *)new_start + ((char *)*end - (char *)*start)*2;
+ *start = new_start;
+
+ return 1;
+}
+
+/*
+ * Extend or move a queue.
+ */
+
+YAML_DECLARE(int)
+yaml_queue_extend(void **start, void **head, void **tail, void **end)
+{
+ /* Check if we need to resize the queue. */
+
+ if (*start == *head && *tail == *end) {
+ void *new_start = yaml_realloc(*start,
+ ((char *)*end - (char *)*start)*2);
+
+ if (!new_start) return 0;
+
+ *head = (char *)new_start + ((char *)*head - (char *)*start);
+ *tail = (char *)new_start + ((char *)*tail - (char *)*start);
+ *end = (char *)new_start + ((char *)*end - (char *)*start)*2;
+ *start = new_start;
+ }
+
+ /* Check if we need to move the queue at the beginning of the buffer. */
+
+ if (*tail == *end) {
+ if (*head != *tail) {
+ memmove(*start, *head, (char *)*tail - (char *)*head);
+ }
+ *tail = (char *)*tail - (char *)*head + (char *)*start;
+ *head = *start;
+ }
+
+ return 1;
+}
+
+
+/*
+ * Create a new parser object.
+ */
+
+YAML_DECLARE(int)
+yaml_parser_initialize(yaml_parser_t *parser)
+{
+ assert(parser); /* Non-NULL parser object expected. */
+
+ memset(parser, 0, sizeof(yaml_parser_t));
+ if (!BUFFER_INIT(parser, parser->raw_buffer, INPUT_RAW_BUFFER_SIZE))
+ goto error;
+ if (!BUFFER_INIT(parser, parser->buffer, INPUT_BUFFER_SIZE))
+ goto error;
+ if (!QUEUE_INIT(parser, parser->tokens, INITIAL_QUEUE_SIZE))
+ goto error;
+ if (!STACK_INIT(parser, parser->indents, INITIAL_STACK_SIZE))
+ goto error;
+ if (!STACK_INIT(parser, parser->simple_keys, INITIAL_STACK_SIZE))
+ goto error;
+ if (!STACK_INIT(parser, parser->states, INITIAL_STACK_SIZE))
+ goto error;
+ if (!STACK_INIT(parser, parser->marks, INITIAL_STACK_SIZE))
+ goto error;
+ if (!STACK_INIT(parser, parser->tag_directives, INITIAL_STACK_SIZE))
+ goto error;
+
+ return 1;
+
+error:
+
+ BUFFER_DEL(parser, parser->raw_buffer);
+ BUFFER_DEL(parser, parser->buffer);
+ QUEUE_DEL(parser, parser->tokens);
+ STACK_DEL(parser, parser->indents);
+ STACK_DEL(parser, parser->simple_keys);
+ STACK_DEL(parser, parser->states);
+ STACK_DEL(parser, parser->marks);
+ STACK_DEL(parser, parser->tag_directives);
+
+ return 0;
+}
+
+/*
+ * Destroy a parser object.
+ */
+
+YAML_DECLARE(void)
+yaml_parser_delete(yaml_parser_t *parser)
+{
+ assert(parser); /* Non-NULL parser object expected. */
+
+ BUFFER_DEL(parser, parser->raw_buffer);
+ BUFFER_DEL(parser, parser->buffer);
+ while (!QUEUE_EMPTY(parser, parser->tokens)) {
+ yaml_token_delete(&DEQUEUE(parser, parser->tokens));
+ }
+ QUEUE_DEL(parser, parser->tokens);
+ STACK_DEL(parser, parser->indents);
+ STACK_DEL(parser, parser->simple_keys);
+ STACK_DEL(parser, parser->states);
+ STACK_DEL(parser, parser->marks);
+ while (!STACK_EMPTY(parser, parser->tag_directives)) {
+ yaml_tag_directive_t tag_directive = POP(parser, parser->tag_directives);
+ yaml_free(tag_directive.handle);
+ yaml_free(tag_directive.prefix);
+ }
+ STACK_DEL(parser, parser->tag_directives);
+
+ memset(parser, 0, sizeof(yaml_parser_t));
+}
+
+/*
+ * String read handler.
+ */
+
+static int
+yaml_string_read_handler(void *data, unsigned char *buffer, size_t size,
+ size_t *size_read)
+{
+ yaml_parser_t *parser = data;
+
+ if (parser->input.string.current == parser->input.string.end) {
+ *size_read = 0;
+ return 1;
+ }
+
+ if (size > (size_t)(parser->input.string.end
+ - parser->input.string.current)) {
+ size = parser->input.string.end - parser->input.string.current;
+ }
+
+ memcpy(buffer, parser->input.string.current, size);
+ parser->input.string.current += size;
+ *size_read = size;
+ return 1;
+}
+
+/*
+ * File read handler.
+ */
+
+static int
+yaml_file_read_handler(void *data, unsigned char *buffer, size_t size,
+ size_t *size_read)
+{
+ yaml_parser_t *parser = data;
+
+ *size_read = fread(buffer, 1, size, parser->input.file);
+ return !ferror(parser->input.file);
+}
+
+/*
+ * Set a string input.
+ */
+
+YAML_DECLARE(void)
+yaml_parser_set_input_string(yaml_parser_t *parser,
+ const unsigned char *input, size_t size)
+{
+ assert(parser); /* Non-NULL parser object expected. */
+ assert(!parser->read_handler); /* You can set the source only once. */
+ assert(input); /* Non-NULL input string expected. */
+
+ parser->read_handler = yaml_string_read_handler;
+ parser->read_handler_data = parser;
+
+ parser->input.string.start = input;
+ parser->input.string.current = input;
+ parser->input.string.end = input+size;
+}
+
+/*
+ * Set a file input.
+ */
+
+YAML_DECLARE(void)
+yaml_parser_set_input_file(yaml_parser_t *parser, FILE *file)
+{
+ assert(parser); /* Non-NULL parser object expected. */
+ assert(!parser->read_handler); /* You can set the source only once. */
+ assert(file); /* Non-NULL file object expected. */
+
+ parser->read_handler = yaml_file_read_handler;
+ parser->read_handler_data = parser;
+
+ parser->input.file = file;
+}
+
+/*
+ * Set a generic input.
+ */
+
+YAML_DECLARE(void)
+yaml_parser_set_input(yaml_parser_t *parser,
+ yaml_read_handler_t *handler, void *data)
+{
+ assert(parser); /* Non-NULL parser object expected. */
+ assert(!parser->read_handler); /* You can set the source only once. */
+ assert(handler); /* Non-NULL read handler expected. */
+
+ parser->read_handler = handler;
+ parser->read_handler_data = data;
+}
+
+/*
+ * Set the source encoding.
+ */
+
+YAML_DECLARE(void)
+yaml_parser_set_encoding(yaml_parser_t *parser, yaml_encoding_t encoding)
+{
+ assert(parser); /* Non-NULL parser object expected. */
+ assert(!parser->encoding); /* Encoding is already set or detected. */
+
+ parser->encoding = encoding;
+}
+
+/*
+ * Create a new emitter object.
+ */
+
+YAML_DECLARE(int)
+yaml_emitter_initialize(yaml_emitter_t *emitter)
+{
+ assert(emitter); /* Non-NULL emitter object expected. */
+
+ memset(emitter, 0, sizeof(yaml_emitter_t));
+ if (!BUFFER_INIT(emitter, emitter->buffer, OUTPUT_BUFFER_SIZE))
+ goto error;
+ if (!BUFFER_INIT(emitter, emitter->raw_buffer, OUTPUT_RAW_BUFFER_SIZE))
+ goto error;
+ if (!STACK_INIT(emitter, emitter->states, INITIAL_STACK_SIZE))
+ goto error;
+ if (!QUEUE_INIT(emitter, emitter->events, INITIAL_QUEUE_SIZE))
+ goto error;
+ if (!STACK_INIT(emitter, emitter->indents, INITIAL_STACK_SIZE))
+ goto error;
+ if (!STACK_INIT(emitter, emitter->tag_directives, INITIAL_STACK_SIZE))
+ goto error;
+
+ return 1;
+
+error:
+
+ BUFFER_DEL(emitter, emitter->buffer);
+ BUFFER_DEL(emitter, emitter->raw_buffer);
+ STACK_DEL(emitter, emitter->states);
+ QUEUE_DEL(emitter, emitter->events);
+ STACK_DEL(emitter, emitter->indents);
+ STACK_DEL(emitter, emitter->tag_directives);
+
+ return 0;
+}
+
+/*
+ * Destroy an emitter object.
+ */
+
+YAML_DECLARE(void)
+yaml_emitter_delete(yaml_emitter_t *emitter)
+{
+ assert(emitter); /* Non-NULL emitter object expected. */
+
+ BUFFER_DEL(emitter, emitter->buffer);
+ BUFFER_DEL(emitter, emitter->raw_buffer);
+ STACK_DEL(emitter, emitter->states);
+ while (!QUEUE_EMPTY(emitter, emitter->events)) {
+ yaml_event_delete(&DEQUEUE(emitter, emitter->events));
+ }
+ QUEUE_DEL(emitter, emitter->events);
+ STACK_DEL(emitter, emitter->indents);
+ while (!STACK_EMPTY(empty, emitter->tag_directives)) {
+ yaml_tag_directive_t tag_directive = POP(emitter, emitter->tag_directives);
+ yaml_free(tag_directive.handle);
+ yaml_free(tag_directive.prefix);
+ }
+ STACK_DEL(emitter, emitter->tag_directives);
+ yaml_free(emitter->anchors);
+
+ memset(emitter, 0, sizeof(yaml_emitter_t));
+}
+
+/*
+ * String write handler.
+ */
+
+static int
+yaml_string_write_handler(void *data, unsigned char *buffer, size_t size)
+{
+ yaml_emitter_t *emitter = data;
+
+ if (emitter->output.string.size + *emitter->output.string.size_written
+ < size) {
+ memcpy(emitter->output.string.buffer
+ + *emitter->output.string.size_written,
+ buffer,
+ emitter->output.string.size
+ - *emitter->output.string.size_written);
+ *emitter->output.string.size_written = emitter->output.string.size;
+ return 0;
+ }
+
+ memcpy(emitter->output.string.buffer
+ + *emitter->output.string.size_written, buffer, size);
+ *emitter->output.string.size_written += size;
+ return 1;
+}
+
+/*
+ * File write handler.
+ */
+
+static int
+yaml_file_write_handler(void *data, unsigned char *buffer, size_t size)
+{
+ yaml_emitter_t *emitter = data;
+
+ return (fwrite(buffer, 1, size, emitter->output.file) == size);
+}
+/*
+ * Set a string output.
+ */
+
+YAML_DECLARE(void)
+yaml_emitter_set_output_string(yaml_emitter_t *emitter,
+ unsigned char *output, size_t size, size_t *size_written)
+{
+ assert(emitter); /* Non-NULL emitter object expected. */
+ assert(!emitter->write_handler); /* You can set the output only once. */
+ assert(output); /* Non-NULL output string expected. */
+
+ emitter->write_handler = yaml_string_write_handler;
+ emitter->write_handler_data = emitter;
+
+ emitter->output.string.buffer = output;
+ emitter->output.string.size = size;
+ emitter->output.string.size_written = size_written;
+ *size_written = 0;
+}
+
+/*
+ * Set a file output.
+ */
+
+YAML_DECLARE(void)
+yaml_emitter_set_output_file(yaml_emitter_t *emitter, FILE *file)
+{
+ assert(emitter); /* Non-NULL emitter object expected. */
+ assert(!emitter->write_handler); /* You can set the output only once. */
+ assert(file); /* Non-NULL file object expected. */
+
+ emitter->write_handler = yaml_file_write_handler;
+ emitter->write_handler_data = emitter;
+
+ emitter->output.file = file;
+}
+
+/*
+ * Set a generic output handler.
+ */
+
+YAML_DECLARE(void)
+yaml_emitter_set_output(yaml_emitter_t *emitter,
+ yaml_write_handler_t *handler, void *data)
+{
+ assert(emitter); /* Non-NULL emitter object expected. */
+ assert(!emitter->write_handler); /* You can set the output only once. */
+ assert(handler); /* Non-NULL handler object expected. */
+
+ emitter->write_handler = handler;
+ emitter->write_handler_data = data;
+}
+
+/*
+ * Set the output encoding.
+ */
+
+YAML_DECLARE(void)
+yaml_emitter_set_encoding(yaml_emitter_t *emitter, yaml_encoding_t encoding)
+{
+ assert(emitter); /* Non-NULL emitter object expected. */
+ assert(!emitter->encoding); /* You can set encoding only once. */
+
+ emitter->encoding = encoding;
+}
+
+/*
+ * Set the canonical output style.
+ */
+
+YAML_DECLARE(void)
+yaml_emitter_set_canonical(yaml_emitter_t *emitter, int canonical)
+{
+ assert(emitter); /* Non-NULL emitter object expected. */
+
+ emitter->canonical = (canonical != 0);
+}
+
+/*
+ * Set the indentation increment.
+ */
+
+YAML_DECLARE(void)
+yaml_emitter_set_indent(yaml_emitter_t *emitter, int indent)
+{
+ assert(emitter); /* Non-NULL emitter object expected. */
+
+ emitter->best_indent = (1 < indent && indent < 10) ? indent : 2;
+}
+
+/*
+ * Set the preferred line width.
+ */
+
+YAML_DECLARE(void)
+yaml_emitter_set_width(yaml_emitter_t *emitter, int width)
+{
+ assert(emitter); /* Non-NULL emitter object expected. */
+
+ emitter->best_width = (width >= 0) ? width : -1;
+}
+
+/*
+ * Set if unescaped non-ASCII characters are allowed.
+ */
+
+YAML_DECLARE(void)
+yaml_emitter_set_unicode(yaml_emitter_t *emitter, int unicode)
+{
+ assert(emitter); /* Non-NULL emitter object expected. */
+
+ emitter->unicode = (unicode != 0);
+}
+
+/*
+ * Set the preferred line break character.
+ */
+
+YAML_DECLARE(void)
+yaml_emitter_set_break(yaml_emitter_t *emitter, yaml_break_t line_break)
+{
+ assert(emitter); /* Non-NULL emitter object expected. */
+
+ emitter->line_break = line_break;
+}
+
+/*
+ * Destroy a token object.
+ */
+
+YAML_DECLARE(void)
+yaml_token_delete(yaml_token_t *token)
+{
+ assert(token); /* Non-NULL token object expected. */
+
+ switch (token->type)
+ {
+ case YAML_TAG_DIRECTIVE_TOKEN:
+ yaml_free(token->data.tag_directive.handle);
+ yaml_free(token->data.tag_directive.prefix);
+ break;
+
+ case YAML_ALIAS_TOKEN:
+ yaml_free(token->data.alias.value);
+ break;
+
+ case YAML_ANCHOR_TOKEN:
+ yaml_free(token->data.anchor.value);
+ break;
+
+ case YAML_TAG_TOKEN:
+ yaml_free(token->data.tag.handle);
+ yaml_free(token->data.tag.suffix);
+ break;
+
+ case YAML_SCALAR_TOKEN:
+ yaml_free(token->data.scalar.value);
+ break;
+
+ default:
+ break;
+ }
+
+ memset(token, 0, sizeof(yaml_token_t));
+}
+
+/*
+ * Check if a string is a valid UTF-8 sequence.
+ *
+ * Check 'reader.c' for more details on UTF-8 encoding.
+ */
+
+static int
+yaml_check_utf8(yaml_char_t *start, size_t length)
+{
+ yaml_char_t *end = start+length;
+ yaml_char_t *pointer = start;
+
+ while (pointer < end) {
+ unsigned char octet;
+ unsigned int width;
+ unsigned int value;
+ size_t k;
+
+ octet = pointer[0];
+ width = (octet & 0x80) == 0x00 ? 1 :
+ (octet & 0xE0) == 0xC0 ? 2 :
+ (octet & 0xF0) == 0xE0 ? 3 :
+ (octet & 0xF8) == 0xF0 ? 4 : 0;
+ value = (octet & 0x80) == 0x00 ? octet & 0x7F :
+ (octet & 0xE0) == 0xC0 ? octet & 0x1F :
+ (octet & 0xF0) == 0xE0 ? octet & 0x0F :
+ (octet & 0xF8) == 0xF0 ? octet & 0x07 : 0;
+ if (!width) return 0;
+ if (pointer+width > end) return 0;
+ for (k = 1; k < width; k ++) {
+ octet = pointer[k];
+ if ((octet & 0xC0) != 0x80) return 0;
+ value = (value << 6) + (octet & 0x3F);
+ }
+ if (!((width == 1) ||
+ (width == 2 && value >= 0x80) ||
+ (width == 3 && value >= 0x800) ||
+ (width == 4 && value >= 0x10000))) return 0;
+
+ pointer += width;
+ }
+
+ return 1;
+}
+
+/*
+ * Create STREAM-START.
+ */
+
+YAML_DECLARE(int)
+yaml_stream_start_event_initialize(yaml_event_t *event,
+ yaml_encoding_t encoding)
+{
+ yaml_mark_t mark = { 0, 0, 0 };
+
+ assert(event); /* Non-NULL event object is expected. */
+
+ STREAM_START_EVENT_INIT(*event, encoding, mark, mark);
+
+ return 1;
+}
+
+/*
+ * Create STREAM-END.
+ */
+
+YAML_DECLARE(int)
+yaml_stream_end_event_initialize(yaml_event_t *event)
+{
+ yaml_mark_t mark = { 0, 0, 0 };
+
+ assert(event); /* Non-NULL event object is expected. */
+
+ STREAM_END_EVENT_INIT(*event, mark, mark);
+
+ return 1;
+}
+
+/*
+ * Create DOCUMENT-START.
+ */
+
+YAML_DECLARE(int)
+yaml_document_start_event_initialize(yaml_event_t *event,
+ yaml_version_directive_t *version_directive,
+ yaml_tag_directive_t *tag_directives_start,
+ yaml_tag_directive_t *tag_directives_end,
+ int implicit)
+{
+ struct {
+ yaml_error_type_t error;
+ } context;
+ yaml_mark_t mark = { 0, 0, 0 };
+ yaml_version_directive_t *version_directive_copy = NULL;
+ struct {
+ yaml_tag_directive_t *start;
+ yaml_tag_directive_t *end;
+ yaml_tag_directive_t *top;
+ } tag_directives_copy = { NULL, NULL, NULL };
+ yaml_tag_directive_t value = { NULL, NULL };
+
+ assert(event); /* Non-NULL event object is expected. */
+ assert((tag_directives_start && tag_directives_end) ||
+ (tag_directives_start == tag_directives_end));
+ /* Valid tag directives are expected. */
+
+ if (version_directive) {
+ version_directive_copy = yaml_malloc(sizeof(yaml_version_directive_t));
+ if (!version_directive_copy) goto error;
+ version_directive_copy->major = version_directive->major;
+ version_directive_copy->minor = version_directive->minor;
+ }
+
+ if (tag_directives_start != tag_directives_end) {
+ yaml_tag_directive_t *tag_directive;
+ if (!STACK_INIT(&context, tag_directives_copy, INITIAL_STACK_SIZE))
+ goto error;
+ for (tag_directive = tag_directives_start;
+ tag_directive != tag_directives_end; tag_directive ++) {
+ assert(tag_directive->handle);
+ assert(tag_directive->prefix);
+ if (!yaml_check_utf8(tag_directive->handle,
+ strlen((char *)tag_directive->handle)))
+ goto error;
+ if (!yaml_check_utf8(tag_directive->prefix,
+ strlen((char *)tag_directive->prefix)))
+ goto error;
+ value.handle = yaml_strdup(tag_directive->handle);
+ value.prefix = yaml_strdup(tag_directive->prefix);
+ if (!value.handle || !value.prefix) goto error;
+ if (!PUSH(&context, tag_directives_copy, value))
+ goto error;
+ value.handle = NULL;
+ value.prefix = NULL;
+ }
+ }
+
+ DOCUMENT_START_EVENT_INIT(*event, version_directive_copy,
+ tag_directives_copy.start, tag_directives_copy.top,
+ implicit, mark, mark);
+
+ return 1;
+
+error:
+ yaml_free(version_directive_copy);
+ while (!STACK_EMPTY(context, tag_directives_copy)) {
+ yaml_tag_directive_t value = POP(context, tag_directives_copy);
+ yaml_free(value.handle);
+ yaml_free(value.prefix);
+ }
+ STACK_DEL(context, tag_directives_copy);
+ yaml_free(value.handle);
+ yaml_free(value.prefix);
+
+ return 0;
+}
+
+/*
+ * Create DOCUMENT-END.
+ */
+
+YAML_DECLARE(int)
+yaml_document_end_event_initialize(yaml_event_t *event, int implicit)
+{
+ yaml_mark_t mark = { 0, 0, 0 };
+
+ assert(event); /* Non-NULL emitter object is expected. */
+
+ DOCUMENT_END_EVENT_INIT(*event, implicit, mark, mark);
+
+ return 1;
+}
+
+/*
+ * Create ALIAS.
+ */
+
+YAML_DECLARE(int)
+yaml_alias_event_initialize(yaml_event_t *event, yaml_char_t *anchor)
+{
+ yaml_mark_t mark = { 0, 0, 0 };
+ yaml_char_t *anchor_copy = NULL;
+
+ assert(event); /* Non-NULL event object is expected. */
+ assert(anchor); /* Non-NULL anchor is expected. */
+
+ if (!yaml_check_utf8(anchor, strlen((char *)anchor))) return 0;
+
+ anchor_copy = yaml_strdup(anchor);
+ if (!anchor_copy)
+ return 0;
+
+ ALIAS_EVENT_INIT(*event, anchor_copy, mark, mark);
+
+ return 1;
+}
+
+/*
+ * Create SCALAR.
+ */
+
+YAML_DECLARE(int)
+yaml_scalar_event_initialize(yaml_event_t *event,
+ yaml_char_t *anchor, yaml_char_t *tag,
+ yaml_char_t *value, int length,
+ int plain_implicit, int quoted_implicit,
+ yaml_scalar_style_t style)
+{
+ yaml_mark_t mark = { 0, 0, 0 };
+ yaml_char_t *anchor_copy = NULL;
+ yaml_char_t *tag_copy = NULL;
+ yaml_char_t *value_copy = NULL;
+
+ assert(event); /* Non-NULL event object is expected. */
+ assert(value); /* Non-NULL anchor is expected. */
+
+ if (anchor) {
+ if (!yaml_check_utf8(anchor, strlen((char *)anchor))) goto error;
+ anchor_copy = yaml_strdup(anchor);
+ if (!anchor_copy) goto error;
+ }
+
+ if (tag) {
+ if (!yaml_check_utf8(tag, strlen((char *)tag))) goto error;
+ tag_copy = yaml_strdup(tag);
+ if (!tag_copy) goto error;
+ }
+
+ if (length < 0) {
+ length = strlen((char *)value);
+ }
+
+ if (!yaml_check_utf8(value, length)) goto error;
+ value_copy = yaml_malloc(length+1);
+ if (!value_copy) goto error;
+ memcpy(value_copy, value, length);
+ value_copy[length] = '\0';
+
+ SCALAR_EVENT_INIT(*event, anchor_copy, tag_copy, value_copy, length,
+ plain_implicit, quoted_implicit, style, mark, mark);
+
+ return 1;
+
+error:
+ yaml_free(anchor_copy);
+ yaml_free(tag_copy);
+ yaml_free(value_copy);
+
+ return 0;
+}
+
+/*
+ * Create SEQUENCE-START.
+ */
+
+YAML_DECLARE(int)
+yaml_sequence_start_event_initialize(yaml_event_t *event,
+ yaml_char_t *anchor, yaml_char_t *tag, int implicit,
+ yaml_sequence_style_t style)
+{
+ yaml_mark_t mark = { 0, 0, 0 };
+ yaml_char_t *anchor_copy = NULL;
+ yaml_char_t *tag_copy = NULL;
+
+ assert(event); /* Non-NULL event object is expected. */
+
+ if (anchor) {
+ if (!yaml_check_utf8(anchor, strlen((char *)anchor))) goto error;
+ anchor_copy = yaml_strdup(anchor);
+ if (!anchor_copy) goto error;
+ }
+
+ if (tag) {
+ if (!yaml_check_utf8(tag, strlen((char *)tag))) goto error;
+ tag_copy = yaml_strdup(tag);
+ if (!tag_copy) goto error;
+ }
+
+ SEQUENCE_START_EVENT_INIT(*event, anchor_copy, tag_copy,
+ implicit, style, mark, mark);
+
+ return 1;
+
+error:
+ yaml_free(anchor_copy);
+ yaml_free(tag_copy);
+
+ return 0;
+}
+
+/*
+ * Create SEQUENCE-END.
+ */
+
+YAML_DECLARE(int)
+yaml_sequence_end_event_initialize(yaml_event_t *event)
+{
+ yaml_mark_t mark = { 0, 0, 0 };
+
+ assert(event); /* Non-NULL event object is expected. */
+
+ SEQUENCE_END_EVENT_INIT(*event, mark, mark);
+
+ return 1;
+}
+
+/*
+ * Create MAPPING-START.
+ */
+
+YAML_DECLARE(int)
+yaml_mapping_start_event_initialize(yaml_event_t *event,
+ yaml_char_t *anchor, yaml_char_t *tag, int implicit,
+ yaml_mapping_style_t style)
+{
+ yaml_mark_t mark = { 0, 0, 0 };
+ yaml_char_t *anchor_copy = NULL;
+ yaml_char_t *tag_copy = NULL;
+
+ assert(event); /* Non-NULL event object is expected. */
+
+ if (anchor) {
+ if (!yaml_check_utf8(anchor, strlen((char *)anchor))) goto error;
+ anchor_copy = yaml_strdup(anchor);
+ if (!anchor_copy) goto error;
+ }
+
+ if (tag) {
+ if (!yaml_check_utf8(tag, strlen((char *)tag))) goto error;
+ tag_copy = yaml_strdup(tag);
+ if (!tag_copy) goto error;
+ }
+
+ MAPPING_START_EVENT_INIT(*event, anchor_copy, tag_copy,
+ implicit, style, mark, mark);
+
+ return 1;
+
+error:
+ yaml_free(anchor_copy);
+ yaml_free(tag_copy);
+
+ return 0;
+}
+
+/*
+ * Create MAPPING-END.
+ */
+
+YAML_DECLARE(int)
+yaml_mapping_end_event_initialize(yaml_event_t *event)
+{
+ yaml_mark_t mark = { 0, 0, 0 };
+
+ assert(event); /* Non-NULL event object is expected. */
+
+ MAPPING_END_EVENT_INIT(*event, mark, mark);
+
+ return 1;
+}
+
+/*
+ * Destroy an event object.
+ */
+
+YAML_DECLARE(void)
+yaml_event_delete(yaml_event_t *event)
+{
+ yaml_tag_directive_t *tag_directive;
+
+ assert(event); /* Non-NULL event object expected. */
+
+ switch (event->type)
+ {
+ case YAML_DOCUMENT_START_EVENT:
+ yaml_free(event->data.document_start.version_directive);
+ for (tag_directive = event->data.document_start.tag_directives.start;
+ tag_directive != event->data.document_start.tag_directives.end;
+ tag_directive++) {
+ yaml_free(tag_directive->handle);
+ yaml_free(tag_directive->prefix);
+ }
+ yaml_free(event->data.document_start.tag_directives.start);
+ break;
+
+ case YAML_ALIAS_EVENT:
+ yaml_free(event->data.alias.anchor);
+ break;
+
+ case YAML_SCALAR_EVENT:
+ yaml_free(event->data.scalar.anchor);
+ yaml_free(event->data.scalar.tag);
+ yaml_free(event->data.scalar.value);
+ break;
+
+ case YAML_SEQUENCE_START_EVENT:
+ yaml_free(event->data.sequence_start.anchor);
+ yaml_free(event->data.sequence_start.tag);
+ break;
+
+ case YAML_MAPPING_START_EVENT:
+ yaml_free(event->data.mapping_start.anchor);
+ yaml_free(event->data.mapping_start.tag);
+ break;
+
+ default:
+ break;
+ }
+
+ memset(event, 0, sizeof(yaml_event_t));
+}
+
+/*
+ * Create a document object.
+ */
+
+YAML_DECLARE(int)
+yaml_document_initialize(yaml_document_t *document,
+ yaml_version_directive_t *version_directive,
+ yaml_tag_directive_t *tag_directives_start,
+ yaml_tag_directive_t *tag_directives_end,
+ int start_implicit, int end_implicit)
+{
+ struct {
+ yaml_error_type_t error;
+ } context;
+ struct {
+ yaml_node_t *start;
+ yaml_node_t *end;
+ yaml_node_t *top;
+ } nodes = { NULL, NULL, NULL };
+ yaml_version_directive_t *version_directive_copy = NULL;
+ struct {
+ yaml_tag_directive_t *start;
+ yaml_tag_directive_t *end;
+ yaml_tag_directive_t *top;
+ } tag_directives_copy = { NULL, NULL, NULL };
+ yaml_tag_directive_t value = { NULL, NULL };
+ yaml_mark_t mark = { 0, 0, 0 };
+
+ assert(document); /* Non-NULL document object is expected. */
+ assert((tag_directives_start && tag_directives_end) ||
+ (tag_directives_start == tag_directives_end));
+ /* Valid tag directives are expected. */
+
+ if (!STACK_INIT(&context, nodes, INITIAL_STACK_SIZE)) goto error;
+
+ if (version_directive) {
+ version_directive_copy = yaml_malloc(sizeof(yaml_version_directive_t));
+ if (!version_directive_copy) goto error;
+ version_directive_copy->major = version_directive->major;
+ version_directive_copy->minor = version_directive->minor;
+ }
+
+ if (tag_directives_start != tag_directives_end) {
+ yaml_tag_directive_t *tag_directive;
+ if (!STACK_INIT(&context, tag_directives_copy, INITIAL_STACK_SIZE))
+ goto error;
+ for (tag_directive = tag_directives_start;
+ tag_directive != tag_directives_end; tag_directive ++) {
+ assert(tag_directive->handle);
+ assert(tag_directive->prefix);
+ if (!yaml_check_utf8(tag_directive->handle,
+ strlen((char *)tag_directive->handle)))
+ goto error;
+ if (!yaml_check_utf8(tag_directive->prefix,
+ strlen((char *)tag_directive->prefix)))
+ goto error;
+ value.handle = yaml_strdup(tag_directive->handle);
+ value.prefix = yaml_strdup(tag_directive->prefix);
+ if (!value.handle || !value.prefix) goto error;
+ if (!PUSH(&context, tag_directives_copy, value))
+ goto error;
+ value.handle = NULL;
+ value.prefix = NULL;
+ }
+ }
+
+ DOCUMENT_INIT(*document, nodes.start, nodes.end, version_directive_copy,
+ tag_directives_copy.start, tag_directives_copy.top,
+ start_implicit, end_implicit, mark, mark);
+
+ return 1;
+
+error:
+ STACK_DEL(&context, nodes);
+ yaml_free(version_directive_copy);
+ while (!STACK_EMPTY(&context, tag_directives_copy)) {
+ yaml_tag_directive_t value = POP(&context, tag_directives_copy);
+ yaml_free(value.handle);
+ yaml_free(value.prefix);
+ }
+ STACK_DEL(&context, tag_directives_copy);
+ yaml_free(value.handle);
+ yaml_free(value.prefix);
+
+ return 0;
+}
+
+/*
+ * Destroy a document object.
+ */
+
+YAML_DECLARE(void)
+yaml_document_delete(yaml_document_t *document)
+{
+ struct {
+ yaml_error_type_t error;
+ } context;
+ yaml_tag_directive_t *tag_directive;
+
+ context.error = YAML_NO_ERROR; /* Eliminate a compliler warning. */
+
+ assert(document); /* Non-NULL document object is expected. */
+
+ while (!STACK_EMPTY(&context, document->nodes)) {
+ yaml_node_t node = POP(&context, document->nodes);
+ yaml_free(node.tag);
+ switch (node.type) {
+ case YAML_SCALAR_NODE:
+ yaml_free(node.data.scalar.value);
+ break;
+ case YAML_SEQUENCE_NODE:
+ STACK_DEL(&context, node.data.sequence.items);
+ break;
+ case YAML_MAPPING_NODE:
+ STACK_DEL(&context, node.data.mapping.pairs);
+ break;
+ default:
+ assert(0); /* Should not happen. */
+ }
+ }
+ STACK_DEL(&context, document->nodes);
+
+ yaml_free(document->version_directive);
+ for (tag_directive = document->tag_directives.start;
+ tag_directive != document->tag_directives.end;
+ tag_directive++) {
+ yaml_free(tag_directive->handle);
+ yaml_free(tag_directive->prefix);
+ }
+ yaml_free(document->tag_directives.start);
+
+ memset(document, 0, sizeof(yaml_document_t));
+}
+
+/**
+ * Get a document node.
+ */
+
+YAML_DECLARE(yaml_node_t *)
+yaml_document_get_node(yaml_document_t *document, int index)
+{
+ assert(document); /* Non-NULL document object is expected. */
+
+ if (index > 0 && document->nodes.start + index <= document->nodes.top) {
+ return document->nodes.start + index - 1;
+ }
+ return NULL;
+}
+
+/**
+ * Get the root object.
+ */
+
+YAML_DECLARE(yaml_node_t *)
+yaml_document_get_root_node(yaml_document_t *document)
+{
+ assert(document); /* Non-NULL document object is expected. */
+
+ if (document->nodes.top != document->nodes.start) {
+ return document->nodes.start;
+ }
+ return NULL;
+}
+
+/*
+ * Add a scalar node to a document.
+ */
+
+YAML_DECLARE(int)
+yaml_document_add_scalar(yaml_document_t *document,
+ yaml_char_t *tag, yaml_char_t *value, int length,
+ yaml_scalar_style_t style)
+{
+ struct {
+ yaml_error_type_t error;
+ } context;
+ yaml_mark_t mark = { 0, 0, 0 };
+ yaml_char_t *tag_copy = NULL;
+ yaml_char_t *value_copy = NULL;
+ yaml_node_t node;
+
+ assert(document); /* Non-NULL document object is expected. */
+ assert(value); /* Non-NULL value is expected. */
+
+ if (!tag) {
+ tag = (yaml_char_t *)YAML_DEFAULT_SCALAR_TAG;
+ }
+
+ if (!yaml_check_utf8(tag, strlen((char *)tag))) goto error;
+ tag_copy = yaml_strdup(tag);
+ if (!tag_copy) goto error;
+
+ if (length < 0) {
+ length = strlen((char *)value);
+ }
+
+ if (!yaml_check_utf8(value, length)) goto error;
+ value_copy = yaml_malloc(length+1);
+ if (!value_copy) goto error;
+ memcpy(value_copy, value, length);
+ value_copy[length] = '\0';
+
+ SCALAR_NODE_INIT(node, tag_copy, value_copy, length, style, mark, mark);
+ if (!PUSH(&context, document->nodes, node)) goto error;
+
+ return document->nodes.top - document->nodes.start;
+
+error:
+ yaml_free(tag_copy);
+ yaml_free(value_copy);
+
+ return 0;
+}
+
+/*
+ * Add a sequence node to a document.
+ */
+
+YAML_DECLARE(int)
+yaml_document_add_sequence(yaml_document_t *document,
+ yaml_char_t *tag, yaml_sequence_style_t style)
+{
+ struct {
+ yaml_error_type_t error;
+ } context;
+ yaml_mark_t mark = { 0, 0, 0 };
+ yaml_char_t *tag_copy = NULL;
+ struct {
+ yaml_node_item_t *start;
+ yaml_node_item_t *end;
+ yaml_node_item_t *top;
+ } items = { NULL, NULL, NULL };
+ yaml_node_t node;
+
+ assert(document); /* Non-NULL document object is expected. */
+
+ if (!tag) {
+ tag = (yaml_char_t *)YAML_DEFAULT_SEQUENCE_TAG;
+ }
+
+ if (!yaml_check_utf8(tag, strlen((char *)tag))) goto error;
+ tag_copy = yaml_strdup(tag);
+ if (!tag_copy) goto error;
+
+ if (!STACK_INIT(&context, items, INITIAL_STACK_SIZE)) goto error;
+
+ SEQUENCE_NODE_INIT(node, tag_copy, items.start, items.end,
+ style, mark, mark);
+ if (!PUSH(&context, document->nodes, node)) goto error;
+
+ return document->nodes.top - document->nodes.start;
+
+error:
+ STACK_DEL(&context, items);
+ yaml_free(tag_copy);
+
+ return 0;
+}
+
+/*
+ * Add a mapping node to a document.
+ */
+
+YAML_DECLARE(int)
+yaml_document_add_mapping(yaml_document_t *document,
+ yaml_char_t *tag, yaml_mapping_style_t style)
+{
+ struct {
+ yaml_error_type_t error;
+ } context;
+ yaml_mark_t mark = { 0, 0, 0 };
+ yaml_char_t *tag_copy = NULL;
+ struct {
+ yaml_node_pair_t *start;
+ yaml_node_pair_t *end;
+ yaml_node_pair_t *top;
+ } pairs = { NULL, NULL, NULL };
+ yaml_node_t node;
+
+ assert(document); /* Non-NULL document object is expected. */
+
+ if (!tag) {
+ tag = (yaml_char_t *)YAML_DEFAULT_MAPPING_TAG;
+ }
+
+ if (!yaml_check_utf8(tag, strlen((char *)tag))) goto error;
+ tag_copy = yaml_strdup(tag);
+ if (!tag_copy) goto error;
+
+ if (!STACK_INIT(&context, pairs, INITIAL_STACK_SIZE)) goto error;
+
+ MAPPING_NODE_INIT(node, tag_copy, pairs.start, pairs.end,
+ style, mark, mark);
+ if (!PUSH(&context, document->nodes, node)) goto error;
+
+ return document->nodes.top - document->nodes.start;
+
+error:
+ STACK_DEL(&context, pairs);
+ yaml_free(tag_copy);
+
+ return 0;
+}
+
+/*
+ * Append an item to a sequence node.
+ */
+
+YAML_DECLARE(int)
+yaml_document_append_sequence_item(yaml_document_t *document,
+ int sequence, int item)
+{
+ struct {
+ yaml_error_type_t error;
+ } context;
+
+ assert(document); /* Non-NULL document is required. */
+ assert(sequence > 0
+ && document->nodes.start + sequence <= document->nodes.top);
+ /* Valid sequence id is required. */
+ assert(document->nodes.start[sequence-1].type == YAML_SEQUENCE_NODE);
+ /* A sequence node is required. */
+ assert(item > 0 && document->nodes.start + item <= document->nodes.top);
+ /* Valid item id is required. */
+
+ if (!PUSH(&context,
+ document->nodes.start[sequence-1].data.sequence.items, item))
+ return 0;
+
+ return 1;
+}
+
+/*
+ * Append a pair of a key and a value to a mapping node.
+ */
+
+YAML_DECLARE(int)
+yaml_document_append_mapping_pair(yaml_document_t *document,
+ int mapping, int key, int value)
+{
+ struct {
+ yaml_error_type_t error;
+ } context;
+
+ yaml_node_pair_t pair;
+
+ assert(document); /* Non-NULL document is required. */
+ assert(mapping > 0
+ && document->nodes.start + mapping <= document->nodes.top);
+ /* Valid mapping id is required. */
+ assert(document->nodes.start[mapping-1].type == YAML_MAPPING_NODE);
+ /* A mapping node is required. */
+ assert(key > 0 && document->nodes.start + key <= document->nodes.top);
+ /* Valid key id is required. */
+ assert(value > 0 && document->nodes.start + value <= document->nodes.top);
+ /* Valid value id is required. */
+
+ pair.key = key;
+ pair.value = value;
+
+ if (!PUSH(&context,
+ document->nodes.start[mapping-1].data.mapping.pairs, pair))
+ return 0;
+
+ return 1;
+}
+
+
diff --git a/ext/psych/yaml/config.h b/ext/psych/yaml/config.h
new file mode 100644
index 0000000000..6d6c25b3b1
--- /dev/null
+++ b/ext/psych/yaml/config.h
@@ -0,0 +1,11 @@
+
+#define PACKAGE_NAME "yaml"
+#define PACKAGE_TARNAME "yaml"
+#define PACKAGE_VERSION "0.1.4"
+#define PACKAGE_STRING "yaml 0.1.4"
+#define PACKAGE_BUGREPORT "http://pyyaml.org/newticket?component libyaml"
+#define PACKAGE_URL ""
+#define YAML_VERSION_MAJOR 0
+#define YAML_VERSION_MINOR 1
+#define YAML_VERSION_PATCH 4
+#define YAML_VERSION_STRING "0.1.4"
diff --git a/ext/psych/yaml/dumper.c b/ext/psych/yaml/dumper.c
new file mode 100644
index 0000000000..203c6a709c
--- /dev/null
+++ b/ext/psych/yaml/dumper.c
@@ -0,0 +1,394 @@
+
+#include "yaml_private.h"
+
+/*
+ * API functions.
+ */
+
+YAML_DECLARE(int)
+yaml_emitter_open(yaml_emitter_t *emitter);
+
+YAML_DECLARE(int)
+yaml_emitter_close(yaml_emitter_t *emitter);
+
+YAML_DECLARE(int)
+yaml_emitter_dump(yaml_emitter_t *emitter, yaml_document_t *document);
+
+/*
+ * Clean up functions.
+ */
+
+static void
+yaml_emitter_delete_document_and_anchors(yaml_emitter_t *emitter);
+
+/*
+ * Anchor functions.
+ */
+
+static void
+yaml_emitter_anchor_node(yaml_emitter_t *emitter, int index);
+
+static yaml_char_t *
+yaml_emitter_generate_anchor(yaml_emitter_t *emitter, int anchor_id);
+
+
+/*
+ * Serialize functions.
+ */
+
+static int
+yaml_emitter_dump_node(yaml_emitter_t *emitter, int index);
+
+static int
+yaml_emitter_dump_alias(yaml_emitter_t *emitter, yaml_char_t *anchor);
+
+static int
+yaml_emitter_dump_scalar(yaml_emitter_t *emitter, yaml_node_t *node,
+ yaml_char_t *anchor);
+
+static int
+yaml_emitter_dump_sequence(yaml_emitter_t *emitter, yaml_node_t *node,
+ yaml_char_t *anchor);
+
+static int
+yaml_emitter_dump_mapping(yaml_emitter_t *emitter, yaml_node_t *node,
+ yaml_char_t *anchor);
+
+/*
+ * Issue a STREAM-START event.
+ */
+
+YAML_DECLARE(int)
+yaml_emitter_open(yaml_emitter_t *emitter)
+{
+ yaml_event_t event;
+ yaml_mark_t mark = { 0, 0, 0 };
+
+ assert(emitter); /* Non-NULL emitter object is required. */
+ assert(!emitter->opened); /* Emitter should not be opened yet. */
+
+ STREAM_START_EVENT_INIT(event, YAML_ANY_ENCODING, mark, mark);
+
+ if (!yaml_emitter_emit(emitter, &event)) {
+ return 0;
+ }
+
+ emitter->opened = 1;
+
+ return 1;
+}
+
+/*
+ * Issue a STREAM-END event.
+ */
+
+YAML_DECLARE(int)
+yaml_emitter_close(yaml_emitter_t *emitter)
+{
+ yaml_event_t event;
+ yaml_mark_t mark = { 0, 0, 0 };
+
+ assert(emitter); /* Non-NULL emitter object is required. */
+ assert(emitter->opened); /* Emitter should be opened. */
+
+ if (emitter->closed) return 1;
+
+ STREAM_END_EVENT_INIT(event, mark, mark);
+
+ if (!yaml_emitter_emit(emitter, &event)) {
+ return 0;
+ }
+
+ emitter->closed = 1;
+
+ return 1;
+}
+
+/*
+ * Dump a YAML document.
+ */
+
+YAML_DECLARE(int)
+yaml_emitter_dump(yaml_emitter_t *emitter, yaml_document_t *document)
+{
+ yaml_event_t event;
+ yaml_mark_t mark = { 0, 0, 0 };
+
+ assert(emitter); /* Non-NULL emitter object is required. */
+ assert(document); /* Non-NULL emitter object is expected. */
+
+ emitter->document = document;
+
+ if (!emitter->opened) {
+ if (!yaml_emitter_open(emitter)) goto error;
+ }
+
+ if (STACK_EMPTY(emitter, document->nodes)) {
+ if (!yaml_emitter_close(emitter)) goto error;
+ yaml_emitter_delete_document_and_anchors(emitter);
+ return 1;
+ }
+
+ assert(emitter->opened); /* Emitter should be opened. */
+
+ emitter->anchors = yaml_malloc(sizeof(*(emitter->anchors))
+ * (document->nodes.top - document->nodes.start));
+ if (!emitter->anchors) goto error;
+ memset(emitter->anchors, 0, sizeof(*(emitter->anchors))
+ * (document->nodes.top - document->nodes.start));
+
+ DOCUMENT_START_EVENT_INIT(event, document->version_directive,
+ document->tag_directives.start, document->tag_directives.end,
+ document->start_implicit, mark, mark);
+ if (!yaml_emitter_emit(emitter, &event)) goto error;
+
+ yaml_emitter_anchor_node(emitter, 1);
+ if (!yaml_emitter_dump_node(emitter, 1)) goto error;
+
+ DOCUMENT_END_EVENT_INIT(event, document->end_implicit, mark, mark);
+ if (!yaml_emitter_emit(emitter, &event)) goto error;
+
+ yaml_emitter_delete_document_and_anchors(emitter);
+
+ return 1;
+
+error:
+
+ yaml_emitter_delete_document_and_anchors(emitter);
+
+ return 0;
+}
+
+/*
+ * Clean up the emitter object after a document is dumped.
+ */
+
+static void
+yaml_emitter_delete_document_and_anchors(yaml_emitter_t *emitter)
+{
+ int index;
+
+ if (!emitter->anchors) {
+ yaml_document_delete(emitter->document);
+ emitter->document = NULL;
+ return;
+ }
+
+ for (index = 0; emitter->document->nodes.start + index
+ < emitter->document->nodes.top; index ++) {
+ yaml_node_t node = emitter->document->nodes.start[index];
+ if (!emitter->anchors[index].serialized) {
+ yaml_free(node.tag);
+ if (node.type == YAML_SCALAR_NODE) {
+ yaml_free(node.data.scalar.value);
+ }
+ }
+ if (node.type == YAML_SEQUENCE_NODE) {
+ STACK_DEL(emitter, node.data.sequence.items);
+ }
+ if (node.type == YAML_MAPPING_NODE) {
+ STACK_DEL(emitter, node.data.mapping.pairs);
+ }
+ }
+
+ STACK_DEL(emitter, emitter->document->nodes);
+ yaml_free(emitter->anchors);
+
+ emitter->anchors = NULL;
+ emitter->last_anchor_id = 0;
+ emitter->document = NULL;
+}
+
+/*
+ * Check the references of a node and assign the anchor id if needed.
+ */
+
+static void
+yaml_emitter_anchor_node(yaml_emitter_t *emitter, int index)
+{
+ yaml_node_t *node = emitter->document->nodes.start + index - 1;
+ yaml_node_item_t *item;
+ yaml_node_pair_t *pair;
+
+ emitter->anchors[index-1].references ++;
+
+ if (emitter->anchors[index-1].references == 1) {
+ switch (node->type) {
+ case YAML_SEQUENCE_NODE:
+ for (item = node->data.sequence.items.start;
+ item < node->data.sequence.items.top; item ++) {
+ yaml_emitter_anchor_node(emitter, *item);
+ }
+ break;
+ case YAML_MAPPING_NODE:
+ for (pair = node->data.mapping.pairs.start;
+ pair < node->data.mapping.pairs.top; pair ++) {
+ yaml_emitter_anchor_node(emitter, pair->key);
+ yaml_emitter_anchor_node(emitter, pair->value);
+ }
+ break;
+ default:
+ break;
+ }
+ }
+
+ else if (emitter->anchors[index-1].references == 2) {
+ emitter->anchors[index-1].anchor = (++ emitter->last_anchor_id);
+ }
+}
+
+/*
+ * Generate a textual representation for an anchor.
+ */
+
+#define ANCHOR_TEMPLATE "id%03d"
+#define ANCHOR_TEMPLATE_LENGTH 16
+
+static yaml_char_t *
+yaml_emitter_generate_anchor(yaml_emitter_t *emitter, int anchor_id)
+{
+ yaml_char_t *anchor = yaml_malloc(ANCHOR_TEMPLATE_LENGTH);
+
+ if (!anchor) return NULL;
+
+ sprintf((char *)anchor, ANCHOR_TEMPLATE, anchor_id);
+
+ return anchor;
+}
+
+/*
+ * Serialize a node.
+ */
+
+static int
+yaml_emitter_dump_node(yaml_emitter_t *emitter, int index)
+{
+ yaml_node_t *node = emitter->document->nodes.start + index - 1;
+ int anchor_id = emitter->anchors[index-1].anchor;
+ yaml_char_t *anchor = NULL;
+
+ if (anchor_id) {
+ anchor = yaml_emitter_generate_anchor(emitter, anchor_id);
+ if (!anchor) return 0;
+ }
+
+ if (emitter->anchors[index-1].serialized) {
+ return yaml_emitter_dump_alias(emitter, anchor);
+ }
+
+ emitter->anchors[index-1].serialized = 1;
+
+ switch (node->type) {
+ case YAML_SCALAR_NODE:
+ return yaml_emitter_dump_scalar(emitter, node, anchor);
+ case YAML_SEQUENCE_NODE:
+ return yaml_emitter_dump_sequence(emitter, node, anchor);
+ case YAML_MAPPING_NODE:
+ return yaml_emitter_dump_mapping(emitter, node, anchor);
+ default:
+ assert(0); /* Could not happen. */
+ break;
+ }
+
+ return 0; /* Could not happen. */
+}
+
+/*
+ * Serialize an alias.
+ */
+
+static int
+yaml_emitter_dump_alias(yaml_emitter_t *emitter, yaml_char_t *anchor)
+{
+ yaml_event_t event;
+ yaml_mark_t mark = { 0, 0, 0 };
+
+ ALIAS_EVENT_INIT(event, anchor, mark, mark);
+
+ return yaml_emitter_emit(emitter, &event);
+}
+
+/*
+ * Serialize a scalar.
+ */
+
+static int
+yaml_emitter_dump_scalar(yaml_emitter_t *emitter, yaml_node_t *node,
+ yaml_char_t *anchor)
+{
+ yaml_event_t event;
+ yaml_mark_t mark = { 0, 0, 0 };
+
+ int plain_implicit = (strcmp((char *)node->tag,
+ YAML_DEFAULT_SCALAR_TAG) == 0);
+ int quoted_implicit = (strcmp((char *)node->tag,
+ YAML_DEFAULT_SCALAR_TAG) == 0);
+
+ SCALAR_EVENT_INIT(event, anchor, node->tag, node->data.scalar.value,
+ node->data.scalar.length, plain_implicit, quoted_implicit,
+ node->data.scalar.style, mark, mark);
+
+ return yaml_emitter_emit(emitter, &event);
+}
+
+/*
+ * Serialize a sequence.
+ */
+
+static int
+yaml_emitter_dump_sequence(yaml_emitter_t *emitter, yaml_node_t *node,
+ yaml_char_t *anchor)
+{
+ yaml_event_t event;
+ yaml_mark_t mark = { 0, 0, 0 };
+
+ int implicit = (strcmp((char *)node->tag, YAML_DEFAULT_SEQUENCE_TAG) == 0);
+
+ yaml_node_item_t *item;
+
+ SEQUENCE_START_EVENT_INIT(event, anchor, node->tag, implicit,
+ node->data.sequence.style, mark, mark);
+ if (!yaml_emitter_emit(emitter, &event)) return 0;
+
+ for (item = node->data.sequence.items.start;
+ item < node->data.sequence.items.top; item ++) {
+ if (!yaml_emitter_dump_node(emitter, *item)) return 0;
+ }
+
+ SEQUENCE_END_EVENT_INIT(event, mark, mark);
+ if (!yaml_emitter_emit(emitter, &event)) return 0;
+
+ return 1;
+}
+
+/*
+ * Serialize a mapping.
+ */
+
+static int
+yaml_emitter_dump_mapping(yaml_emitter_t *emitter, yaml_node_t *node,
+ yaml_char_t *anchor)
+{
+ yaml_event_t event;
+ yaml_mark_t mark = { 0, 0, 0 };
+
+ int implicit = (strcmp((char *)node->tag, YAML_DEFAULT_MAPPING_TAG) == 0);
+
+ yaml_node_pair_t *pair;
+
+ MAPPING_START_EVENT_INIT(event, anchor, node->tag, implicit,
+ node->data.mapping.style, mark, mark);
+ if (!yaml_emitter_emit(emitter, &event)) return 0;
+
+ for (pair = node->data.mapping.pairs.start;
+ pair < node->data.mapping.pairs.top; pair ++) {
+ if (!yaml_emitter_dump_node(emitter, pair->key)) return 0;
+ if (!yaml_emitter_dump_node(emitter, pair->value)) return 0;
+ }
+
+ MAPPING_END_EVENT_INIT(event, mark, mark);
+ if (!yaml_emitter_emit(emitter, &event)) return 0;
+
+ return 1;
+}
+
diff --git a/ext/psych/yaml/emitter.c b/ext/psych/yaml/emitter.c
new file mode 100644
index 0000000000..c852f9309f
--- /dev/null
+++ b/ext/psych/yaml/emitter.c
@@ -0,0 +1,2329 @@
+
+#include "yaml_private.h"
+
+/*
+ * Flush the buffer if needed.
+ */
+
+#define FLUSH(emitter) \
+ ((emitter->buffer.pointer+5 < emitter->buffer.end) \
+ || yaml_emitter_flush(emitter))
+
+/*
+ * Put a character to the output buffer.
+ */
+
+#define PUT(emitter,value) \
+ (FLUSH(emitter) \
+ && (*(emitter->buffer.pointer++) = (yaml_char_t)(value), \
+ emitter->column ++, \
+ 1))
+
+/*
+ * Put a line break to the output buffer.
+ */
+
+#define PUT_BREAK(emitter) \
+ (FLUSH(emitter) \
+ && ((emitter->line_break == YAML_CR_BREAK ? \
+ (*(emitter->buffer.pointer++) = (yaml_char_t) '\r') : \
+ emitter->line_break == YAML_LN_BREAK ? \
+ (*(emitter->buffer.pointer++) = (yaml_char_t) '\n') : \
+ emitter->line_break == YAML_CRLN_BREAK ? \
+ (*(emitter->buffer.pointer++) = (yaml_char_t) '\r', \
+ *(emitter->buffer.pointer++) = (yaml_char_t) '\n') : 0), \
+ emitter->column = 0, \
+ emitter->line ++, \
+ 1))
+
+/*
+ * Copy a character from a string into buffer.
+ */
+
+#define WRITE(emitter,string) \
+ (FLUSH(emitter) \
+ && (COPY(emitter->buffer,string), \
+ emitter->column ++, \
+ 1))
+
+/*
+ * Copy a line break character from a string into buffer.
+ */
+
+#define WRITE_BREAK(emitter,string) \
+ (FLUSH(emitter) \
+ && (CHECK(string,'\n') ? \
+ (PUT_BREAK(emitter), \
+ string.pointer ++, \
+ 1) : \
+ (COPY(emitter->buffer,string), \
+ emitter->column = 0, \
+ emitter->line ++, \
+ 1)))
+
+/*
+ * API functions.
+ */
+
+YAML_DECLARE(int)
+yaml_emitter_emit(yaml_emitter_t *emitter, yaml_event_t *event);
+
+/*
+ * Utility functions.
+ */
+
+static int
+yaml_emitter_set_emitter_error(yaml_emitter_t *emitter, const char *problem);
+
+static int
+yaml_emitter_need_more_events(yaml_emitter_t *emitter);
+
+static int
+yaml_emitter_append_tag_directive(yaml_emitter_t *emitter,
+ yaml_tag_directive_t value, int allow_duplicates);
+
+static int
+yaml_emitter_increase_indent(yaml_emitter_t *emitter,
+ int flow, int indentless);
+
+/*
+ * State functions.
+ */
+
+static int
+yaml_emitter_state_machine(yaml_emitter_t *emitter, yaml_event_t *event);
+
+static int
+yaml_emitter_emit_stream_start(yaml_emitter_t *emitter,
+ yaml_event_t *event);
+
+static int
+yaml_emitter_emit_document_start(yaml_emitter_t *emitter,
+ yaml_event_t *event, int first);
+
+static int
+yaml_emitter_emit_document_content(yaml_emitter_t *emitter,
+ yaml_event_t *event);
+
+static int
+yaml_emitter_emit_document_end(yaml_emitter_t *emitter,
+ yaml_event_t *event);
+
+static int
+yaml_emitter_emit_flow_sequence_item(yaml_emitter_t *emitter,
+ yaml_event_t *event, int first);
+
+static int
+yaml_emitter_emit_flow_mapping_key(yaml_emitter_t *emitter,
+ yaml_event_t *event, int first);
+
+static int
+yaml_emitter_emit_flow_mapping_value(yaml_emitter_t *emitter,
+ yaml_event_t *event, int simple);
+
+static int
+yaml_emitter_emit_block_sequence_item(yaml_emitter_t *emitter,
+ yaml_event_t *event, int first);
+
+static int
+yaml_emitter_emit_block_mapping_key(yaml_emitter_t *emitter,
+ yaml_event_t *event, int first);
+
+static int
+yaml_emitter_emit_block_mapping_value(yaml_emitter_t *emitter,
+ yaml_event_t *event, int simple);
+
+static int
+yaml_emitter_emit_node(yaml_emitter_t *emitter, yaml_event_t *event,
+ int root, int sequence, int mapping, int simple_key);
+
+static int
+yaml_emitter_emit_alias(yaml_emitter_t *emitter, yaml_event_t *event);
+
+static int
+yaml_emitter_emit_scalar(yaml_emitter_t *emitter, yaml_event_t *event);
+
+static int
+yaml_emitter_emit_sequence_start(yaml_emitter_t *emitter, yaml_event_t *event);
+
+static int
+yaml_emitter_emit_mapping_start(yaml_emitter_t *emitter, yaml_event_t *event);
+
+/*
+ * Checkers.
+ */
+
+static int
+yaml_emitter_check_empty_document(yaml_emitter_t *emitter);
+
+static int
+yaml_emitter_check_empty_sequence(yaml_emitter_t *emitter);
+
+static int
+yaml_emitter_check_empty_mapping(yaml_emitter_t *emitter);
+
+static int
+yaml_emitter_check_simple_key(yaml_emitter_t *emitter);
+
+static int
+yaml_emitter_select_scalar_style(yaml_emitter_t *emitter, yaml_event_t *event);
+
+/*
+ * Processors.
+ */
+
+static int
+yaml_emitter_process_anchor(yaml_emitter_t *emitter);
+
+static int
+yaml_emitter_process_tag(yaml_emitter_t *emitter);
+
+static int
+yaml_emitter_process_scalar(yaml_emitter_t *emitter);
+
+/*
+ * Analyzers.
+ */
+
+static int
+yaml_emitter_analyze_version_directive(yaml_emitter_t *emitter,
+ yaml_version_directive_t version_directive);
+
+static int
+yaml_emitter_analyze_tag_directive(yaml_emitter_t *emitter,
+ yaml_tag_directive_t tag_directive);
+
+static int
+yaml_emitter_analyze_anchor(yaml_emitter_t *emitter,
+ yaml_char_t *anchor, int alias);
+
+static int
+yaml_emitter_analyze_tag(yaml_emitter_t *emitter,
+ yaml_char_t *tag);
+
+static int
+yaml_emitter_analyze_scalar(yaml_emitter_t *emitter,
+ yaml_char_t *value, size_t length);
+
+static int
+yaml_emitter_analyze_event(yaml_emitter_t *emitter,
+ yaml_event_t *event);
+
+/*
+ * Writers.
+ */
+
+static int
+yaml_emitter_write_bom(yaml_emitter_t *emitter);
+
+static int
+yaml_emitter_write_indent(yaml_emitter_t *emitter);
+
+static int
+yaml_emitter_write_indicator(yaml_emitter_t *emitter,
+ const char *indicator, int need_whitespace,
+ int is_whitespace, int is_indention);
+
+static int
+yaml_emitter_write_anchor(yaml_emitter_t *emitter,
+ yaml_char_t *value, size_t length);
+
+static int
+yaml_emitter_write_tag_handle(yaml_emitter_t *emitter,
+ yaml_char_t *value, size_t length);
+
+static int
+yaml_emitter_write_tag_content(yaml_emitter_t *emitter,
+ yaml_char_t *value, size_t length, int need_whitespace);
+
+static int
+yaml_emitter_write_plain_scalar(yaml_emitter_t *emitter,
+ yaml_char_t *value, size_t length, int allow_breaks);
+
+static int
+yaml_emitter_write_single_quoted_scalar(yaml_emitter_t *emitter,
+ yaml_char_t *value, size_t length, int allow_breaks);
+
+static int
+yaml_emitter_write_double_quoted_scalar(yaml_emitter_t *emitter,
+ yaml_char_t *value, size_t length, int allow_breaks);
+
+static int
+yaml_emitter_write_block_scalar_hints(yaml_emitter_t *emitter,
+ yaml_string_t string);
+
+static int
+yaml_emitter_write_literal_scalar(yaml_emitter_t *emitter,
+ yaml_char_t *value, size_t length);
+
+static int
+yaml_emitter_write_folded_scalar(yaml_emitter_t *emitter,
+ yaml_char_t *value, size_t length);
+
+/*
+ * Set an emitter error and return 0.
+ */
+
+static int
+yaml_emitter_set_emitter_error(yaml_emitter_t *emitter, const char *problem)
+{
+ emitter->error = YAML_EMITTER_ERROR;
+ emitter->problem = problem;
+
+ return 0;
+}
+
+/*
+ * Emit an event.
+ */
+
+YAML_DECLARE(int)
+yaml_emitter_emit(yaml_emitter_t *emitter, yaml_event_t *event)
+{
+ if (!ENQUEUE(emitter, emitter->events, *event)) {
+ yaml_event_delete(event);
+ return 0;
+ }
+
+ while (!yaml_emitter_need_more_events(emitter)) {
+ if (!yaml_emitter_analyze_event(emitter, emitter->events.head))
+ return 0;
+ if (!yaml_emitter_state_machine(emitter, emitter->events.head))
+ return 0;
+ yaml_event_delete(&DEQUEUE(emitter, emitter->events));
+ }
+
+ return 1;
+}
+
+/*
+ * Check if we need to accumulate more events before emitting.
+ *
+ * We accumulate extra
+ * - 1 event for DOCUMENT-START
+ * - 2 events for SEQUENCE-START
+ * - 3 events for MAPPING-START
+ */
+
+static int
+yaml_emitter_need_more_events(yaml_emitter_t *emitter)
+{
+ int level = 0;
+ int accumulate = 0;
+ yaml_event_t *event;
+
+ if (QUEUE_EMPTY(emitter, emitter->events))
+ return 1;
+
+ switch (emitter->events.head->type) {
+ case YAML_DOCUMENT_START_EVENT:
+ accumulate = 1;
+ break;
+ case YAML_SEQUENCE_START_EVENT:
+ accumulate = 2;
+ break;
+ case YAML_MAPPING_START_EVENT:
+ accumulate = 3;
+ break;
+ default:
+ return 0;
+ }
+
+ if (emitter->events.tail - emitter->events.head > accumulate)
+ return 0;
+
+ for (event = emitter->events.head; event != emitter->events.tail; event ++) {
+ switch (event->type) {
+ case YAML_STREAM_START_EVENT:
+ case YAML_DOCUMENT_START_EVENT:
+ case YAML_SEQUENCE_START_EVENT:
+ case YAML_MAPPING_START_EVENT:
+ level += 1;
+ break;
+ case YAML_STREAM_END_EVENT:
+ case YAML_DOCUMENT_END_EVENT:
+ case YAML_SEQUENCE_END_EVENT:
+ case YAML_MAPPING_END_EVENT:
+ level -= 1;
+ break;
+ default:
+ break;
+ }
+ if (!level)
+ return 0;
+ }
+
+ return 1;
+}
+
+/*
+ * Append a directive to the directives stack.
+ */
+
+static int
+yaml_emitter_append_tag_directive(yaml_emitter_t *emitter,
+ yaml_tag_directive_t value, int allow_duplicates)
+{
+ yaml_tag_directive_t *tag_directive;
+ yaml_tag_directive_t copy = { NULL, NULL };
+
+ for (tag_directive = emitter->tag_directives.start;
+ tag_directive != emitter->tag_directives.top; tag_directive ++) {
+ if (strcmp((char *)value.handle, (char *)tag_directive->handle) == 0) {
+ if (allow_duplicates)
+ return 1;
+ return yaml_emitter_set_emitter_error(emitter,
+ "duplicate %TAG directive");
+ }
+ }
+
+ copy.handle = yaml_strdup(value.handle);
+ copy.prefix = yaml_strdup(value.prefix);
+ if (!copy.handle || !copy.prefix) {
+ emitter->error = YAML_MEMORY_ERROR;
+ goto error;
+ }
+
+ if (!PUSH(emitter, emitter->tag_directives, copy))
+ goto error;
+
+ return 1;
+
+error:
+ yaml_free(copy.handle);
+ yaml_free(copy.prefix);
+ return 0;
+}
+
+/*
+ * Increase the indentation level.
+ */
+
+static int
+yaml_emitter_increase_indent(yaml_emitter_t *emitter,
+ int flow, int indentless)
+{
+ if (!PUSH(emitter, emitter->indents, emitter->indent))
+ return 0;
+
+ if (emitter->indent < 0) {
+ emitter->indent = flow ? emitter->best_indent : 0;
+ }
+ else if (!indentless) {
+ emitter->indent += emitter->best_indent;
+ }
+
+ return 1;
+}
+
+/*
+ * State dispatcher.
+ */
+
+static int
+yaml_emitter_state_machine(yaml_emitter_t *emitter, yaml_event_t *event)
+{
+ switch (emitter->state)
+ {
+ case YAML_EMIT_STREAM_START_STATE:
+ return yaml_emitter_emit_stream_start(emitter, event);
+
+ case YAML_EMIT_FIRST_DOCUMENT_START_STATE:
+ return yaml_emitter_emit_document_start(emitter, event, 1);
+
+ case YAML_EMIT_DOCUMENT_START_STATE:
+ return yaml_emitter_emit_document_start(emitter, event, 0);
+
+ case YAML_EMIT_DOCUMENT_CONTENT_STATE:
+ return yaml_emitter_emit_document_content(emitter, event);
+
+ case YAML_EMIT_DOCUMENT_END_STATE:
+ return yaml_emitter_emit_document_end(emitter, event);
+
+ case YAML_EMIT_FLOW_SEQUENCE_FIRST_ITEM_STATE:
+ return yaml_emitter_emit_flow_sequence_item(emitter, event, 1);
+
+ case YAML_EMIT_FLOW_SEQUENCE_ITEM_STATE:
+ return yaml_emitter_emit_flow_sequence_item(emitter, event, 0);
+
+ case YAML_EMIT_FLOW_MAPPING_FIRST_KEY_STATE:
+ return yaml_emitter_emit_flow_mapping_key(emitter, event, 1);
+
+ case YAML_EMIT_FLOW_MAPPING_KEY_STATE:
+ return yaml_emitter_emit_flow_mapping_key(emitter, event, 0);
+
+ case YAML_EMIT_FLOW_MAPPING_SIMPLE_VALUE_STATE:
+ return yaml_emitter_emit_flow_mapping_value(emitter, event, 1);
+
+ case YAML_EMIT_FLOW_MAPPING_VALUE_STATE:
+ return yaml_emitter_emit_flow_mapping_value(emitter, event, 0);
+
+ case YAML_EMIT_BLOCK_SEQUENCE_FIRST_ITEM_STATE:
+ return yaml_emitter_emit_block_sequence_item(emitter, event, 1);
+
+ case YAML_EMIT_BLOCK_SEQUENCE_ITEM_STATE:
+ return yaml_emitter_emit_block_sequence_item(emitter, event, 0);
+
+ case YAML_EMIT_BLOCK_MAPPING_FIRST_KEY_STATE:
+ return yaml_emitter_emit_block_mapping_key(emitter, event, 1);
+
+ case YAML_EMIT_BLOCK_MAPPING_KEY_STATE:
+ return yaml_emitter_emit_block_mapping_key(emitter, event, 0);
+
+ case YAML_EMIT_BLOCK_MAPPING_SIMPLE_VALUE_STATE:
+ return yaml_emitter_emit_block_mapping_value(emitter, event, 1);
+
+ case YAML_EMIT_BLOCK_MAPPING_VALUE_STATE:
+ return yaml_emitter_emit_block_mapping_value(emitter, event, 0);
+
+ case YAML_EMIT_END_STATE:
+ return yaml_emitter_set_emitter_error(emitter,
+ "expected nothing after STREAM-END");
+
+ default:
+ assert(1); /* Invalid state. */
+ }
+
+ return 0;
+}
+
+/*
+ * Expect STREAM-START.
+ */
+
+static int
+yaml_emitter_emit_stream_start(yaml_emitter_t *emitter,
+ yaml_event_t *event)
+{
+ if (event->type == YAML_STREAM_START_EVENT)
+ {
+ if (!emitter->encoding) {
+ emitter->encoding = event->data.stream_start.encoding;
+ }
+
+ if (!emitter->encoding) {
+ emitter->encoding = YAML_UTF8_ENCODING;
+ }
+
+ if (emitter->best_indent < 2 || emitter->best_indent > 9) {
+ emitter->best_indent = 2;
+ }
+
+ if (emitter->best_width >= 0
+ && emitter->best_width <= emitter->best_indent*2) {
+ emitter->best_width = 80;
+ }
+
+ if (emitter->best_width < 0) {
+ emitter->best_width = INT_MAX;
+ }
+
+ if (!emitter->line_break) {
+ emitter->line_break = YAML_LN_BREAK;
+ }
+
+ emitter->indent = -1;
+
+ emitter->line = 0;
+ emitter->column = 0;
+ emitter->whitespace = 1;
+ emitter->indention = 1;
+
+ if (emitter->encoding != YAML_UTF8_ENCODING) {
+ if (!yaml_emitter_write_bom(emitter))
+ return 0;
+ }
+
+ emitter->state = YAML_EMIT_FIRST_DOCUMENT_START_STATE;
+
+ return 1;
+ }
+
+ return yaml_emitter_set_emitter_error(emitter,
+ "expected STREAM-START");
+}
+
+/*
+ * Expect DOCUMENT-START or STREAM-END.
+ */
+
+static int
+yaml_emitter_emit_document_start(yaml_emitter_t *emitter,
+ yaml_event_t *event, int first)
+{
+ if (event->type == YAML_DOCUMENT_START_EVENT)
+ {
+ yaml_tag_directive_t default_tag_directives[] = {
+ {(yaml_char_t *)"!", (yaml_char_t *)"!"},
+ {(yaml_char_t *)"!!", (yaml_char_t *)"tag:yaml.org,2002:"},
+ {NULL, NULL}
+ };
+ yaml_tag_directive_t *tag_directive;
+ int implicit;
+
+ if (event->data.document_start.version_directive) {
+ if (!yaml_emitter_analyze_version_directive(emitter,
+ *event->data.document_start.version_directive))
+ return 0;
+ }
+
+ for (tag_directive = event->data.document_start.tag_directives.start;
+ tag_directive != event->data.document_start.tag_directives.end;
+ tag_directive ++) {
+ if (!yaml_emitter_analyze_tag_directive(emitter, *tag_directive))
+ return 0;
+ if (!yaml_emitter_append_tag_directive(emitter, *tag_directive, 0))
+ return 0;
+ }
+
+ for (tag_directive = default_tag_directives;
+ tag_directive->handle; tag_directive ++) {
+ if (!yaml_emitter_append_tag_directive(emitter, *tag_directive, 1))
+ return 0;
+ }
+
+ implicit = event->data.document_start.implicit;
+ if (!first || emitter->canonical) {
+ implicit = 0;
+ }
+
+ if ((event->data.document_start.version_directive ||
+ (event->data.document_start.tag_directives.start
+ != event->data.document_start.tag_directives.end)) &&
+ emitter->open_ended)
+ {
+ if (!yaml_emitter_write_indicator(emitter, "...", 1, 0, 0))
+ return 0;
+ if (!yaml_emitter_write_indent(emitter))
+ return 0;
+ }
+
+ if (event->data.document_start.version_directive) {
+ implicit = 0;
+ if (!yaml_emitter_write_indicator(emitter, "%YAML", 1, 0, 0))
+ return 0;
+ if (!yaml_emitter_write_indicator(emitter, "1.1", 1, 0, 0))
+ return 0;
+ if (!yaml_emitter_write_indent(emitter))
+ return 0;
+ }
+
+ if (event->data.document_start.tag_directives.start
+ != event->data.document_start.tag_directives.end) {
+ implicit = 0;
+ for (tag_directive = event->data.document_start.tag_directives.start;
+ tag_directive != event->data.document_start.tag_directives.end;
+ tag_directive ++) {
+ if (!yaml_emitter_write_indicator(emitter, "%TAG", 1, 0, 0))
+ return 0;
+ if (!yaml_emitter_write_tag_handle(emitter, tag_directive->handle,
+ strlen((char *)tag_directive->handle)))
+ return 0;
+ if (!yaml_emitter_write_tag_content(emitter, tag_directive->prefix,
+ strlen((char *)tag_directive->prefix), 1))
+ return 0;
+ if (!yaml_emitter_write_indent(emitter))
+ return 0;
+ }
+ }
+
+ if (yaml_emitter_check_empty_document(emitter)) {
+ implicit = 0;
+ }
+
+ if (!implicit) {
+ if (!yaml_emitter_write_indent(emitter))
+ return 0;
+ if (!yaml_emitter_write_indicator(emitter, "---", 1, 0, 0))
+ return 0;
+ if (emitter->canonical) {
+ if (!yaml_emitter_write_indent(emitter))
+ return 0;
+ }
+ }
+
+ emitter->state = YAML_EMIT_DOCUMENT_CONTENT_STATE;
+
+ return 1;
+ }
+
+ else if (event->type == YAML_STREAM_END_EVENT)
+ {
+ if (emitter->open_ended)
+ {
+ if (!yaml_emitter_write_indicator(emitter, "...", 1, 0, 0))
+ return 0;
+ if (!yaml_emitter_write_indent(emitter))
+ return 0;
+ }
+
+ if (!yaml_emitter_flush(emitter))
+ return 0;
+
+ emitter->state = YAML_EMIT_END_STATE;
+
+ return 1;
+ }
+
+ return yaml_emitter_set_emitter_error(emitter,
+ "expected DOCUMENT-START or STREAM-END");
+}
+
+/*
+ * Expect the root node.
+ */
+
+static int
+yaml_emitter_emit_document_content(yaml_emitter_t *emitter,
+ yaml_event_t *event)
+{
+ if (!PUSH(emitter, emitter->states, YAML_EMIT_DOCUMENT_END_STATE))
+ return 0;
+
+ return yaml_emitter_emit_node(emitter, event, 1, 0, 0, 0);
+}
+
+/*
+ * Expect DOCUMENT-END.
+ */
+
+static int
+yaml_emitter_emit_document_end(yaml_emitter_t *emitter,
+ yaml_event_t *event)
+{
+ if (event->type == YAML_DOCUMENT_END_EVENT)
+ {
+ if (!yaml_emitter_write_indent(emitter))
+ return 0;
+ if (!event->data.document_end.implicit) {
+ if (!yaml_emitter_write_indicator(emitter, "...", 1, 0, 0))
+ return 0;
+ if (!yaml_emitter_write_indent(emitter))
+ return 0;
+ }
+ if (!yaml_emitter_flush(emitter))
+ return 0;
+
+ emitter->state = YAML_EMIT_DOCUMENT_START_STATE;
+
+ 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);
+ }
+
+ return 1;
+ }
+
+ return yaml_emitter_set_emitter_error(emitter,
+ "expected DOCUMENT-END");
+}
+
+/*
+ *
+ * Expect a flow item node.
+ */
+
+static int
+yaml_emitter_emit_flow_sequence_item(yaml_emitter_t *emitter,
+ yaml_event_t *event, int first)
+{
+ if (first)
+ {
+ if (!yaml_emitter_write_indicator(emitter, "[", 1, 1, 0))
+ return 0;
+ if (!yaml_emitter_increase_indent(emitter, 1, 0))
+ return 0;
+ emitter->flow_level ++;
+ }
+
+ if (event->type == YAML_SEQUENCE_END_EVENT)
+ {
+ emitter->flow_level --;
+ emitter->indent = POP(emitter, emitter->indents);
+ if (emitter->canonical && !first) {
+ if (!yaml_emitter_write_indicator(emitter, ",", 0, 0, 0))
+ return 0;
+ if (!yaml_emitter_write_indent(emitter))
+ return 0;
+ }
+ if (!yaml_emitter_write_indicator(emitter, "]", 0, 0, 0))
+ return 0;
+ emitter->state = POP(emitter, emitter->states);
+
+ return 1;
+ }
+
+ if (!first) {
+ if (!yaml_emitter_write_indicator(emitter, ",", 0, 0, 0))
+ return 0;
+ }
+
+ if (emitter->canonical || emitter->column > emitter->best_width) {
+ if (!yaml_emitter_write_indent(emitter))
+ return 0;
+ }
+ if (!PUSH(emitter, emitter->states, YAML_EMIT_FLOW_SEQUENCE_ITEM_STATE))
+ return 0;
+
+ return yaml_emitter_emit_node(emitter, event, 0, 1, 0, 0);
+}
+
+/*
+ * Expect a flow key node.
+ */
+
+static int
+yaml_emitter_emit_flow_mapping_key(yaml_emitter_t *emitter,
+ yaml_event_t *event, int first)
+{
+ if (first)
+ {
+ if (!yaml_emitter_write_indicator(emitter, "{", 1, 1, 0))
+ return 0;
+ if (!yaml_emitter_increase_indent(emitter, 1, 0))
+ return 0;
+ emitter->flow_level ++;
+ }
+
+ if (event->type == YAML_MAPPING_END_EVENT)
+ {
+ emitter->flow_level --;
+ emitter->indent = POP(emitter, emitter->indents);
+ if (emitter->canonical && !first) {
+ if (!yaml_emitter_write_indicator(emitter, ",", 0, 0, 0))
+ return 0;
+ if (!yaml_emitter_write_indent(emitter))
+ return 0;
+ }
+ if (!yaml_emitter_write_indicator(emitter, "}", 0, 0, 0))
+ return 0;
+ emitter->state = POP(emitter, emitter->states);
+
+ return 1;
+ }
+
+ if (!first) {
+ if (!yaml_emitter_write_indicator(emitter, ",", 0, 0, 0))
+ return 0;
+ }
+ if (emitter->canonical || emitter->column > emitter->best_width) {
+ if (!yaml_emitter_write_indent(emitter))
+ return 0;
+ }
+
+ if (!emitter->canonical && yaml_emitter_check_simple_key(emitter))
+ {
+ if (!PUSH(emitter, emitter->states,
+ YAML_EMIT_FLOW_MAPPING_SIMPLE_VALUE_STATE))
+ return 0;
+
+ return yaml_emitter_emit_node(emitter, event, 0, 0, 1, 1);
+ }
+ else
+ {
+ if (!yaml_emitter_write_indicator(emitter, "?", 1, 0, 0))
+ return 0;
+ if (!PUSH(emitter, emitter->states,
+ YAML_EMIT_FLOW_MAPPING_VALUE_STATE))
+ return 0;
+
+ return yaml_emitter_emit_node(emitter, event, 0, 0, 1, 0);
+ }
+}
+
+/*
+ * Expect a flow value node.
+ */
+
+static int
+yaml_emitter_emit_flow_mapping_value(yaml_emitter_t *emitter,
+ yaml_event_t *event, int simple)
+{
+ if (simple) {
+ if (!yaml_emitter_write_indicator(emitter, ":", 0, 0, 0))
+ return 0;
+ }
+ else {
+ if (emitter->canonical || emitter->column > emitter->best_width) {
+ if (!yaml_emitter_write_indent(emitter))
+ return 0;
+ }
+ if (!yaml_emitter_write_indicator(emitter, ":", 1, 0, 0))
+ return 0;
+ }
+ if (!PUSH(emitter, emitter->states, YAML_EMIT_FLOW_MAPPING_KEY_STATE))
+ return 0;
+ return yaml_emitter_emit_node(emitter, event, 0, 0, 1, 0);
+}
+
+/*
+ * Expect a block item node.
+ */
+
+static int
+yaml_emitter_emit_block_sequence_item(yaml_emitter_t *emitter,
+ yaml_event_t *event, int first)
+{
+ if (first)
+ {
+ if (!yaml_emitter_increase_indent(emitter, 0,
+ (emitter->mapping_context && !emitter->indention)))
+ return 0;
+ }
+
+ if (event->type == YAML_SEQUENCE_END_EVENT)
+ {
+ emitter->indent = POP(emitter, emitter->indents);
+ emitter->state = POP(emitter, emitter->states);
+
+ return 1;
+ }
+
+ if (!yaml_emitter_write_indent(emitter))
+ return 0;
+ if (!yaml_emitter_write_indicator(emitter, "-", 1, 0, 1))
+ return 0;
+ if (!PUSH(emitter, emitter->states,
+ YAML_EMIT_BLOCK_SEQUENCE_ITEM_STATE))
+ return 0;
+
+ return yaml_emitter_emit_node(emitter, event, 0, 1, 0, 0);
+}
+
+/*
+ * Expect a block key node.
+ */
+
+static int
+yaml_emitter_emit_block_mapping_key(yaml_emitter_t *emitter,
+ yaml_event_t *event, int first)
+{
+ if (first)
+ {
+ if (!yaml_emitter_increase_indent(emitter, 0, 0))
+ return 0;
+ }
+
+ if (event->type == YAML_MAPPING_END_EVENT)
+ {
+ emitter->indent = POP(emitter, emitter->indents);
+ emitter->state = POP(emitter, emitter->states);
+
+ return 1;
+ }
+
+ if (!yaml_emitter_write_indent(emitter))
+ return 0;
+
+ if (yaml_emitter_check_simple_key(emitter))
+ {
+ if (!PUSH(emitter, emitter->states,
+ YAML_EMIT_BLOCK_MAPPING_SIMPLE_VALUE_STATE))
+ return 0;
+
+ return yaml_emitter_emit_node(emitter, event, 0, 0, 1, 1);
+ }
+ else
+ {
+ if (!yaml_emitter_write_indicator(emitter, "?", 1, 0, 1))
+ return 0;
+ if (!PUSH(emitter, emitter->states,
+ YAML_EMIT_BLOCK_MAPPING_VALUE_STATE))
+ return 0;
+
+ return yaml_emitter_emit_node(emitter, event, 0, 0, 1, 0);
+ }
+}
+
+/*
+ * Expect a block value node.
+ */
+
+static int
+yaml_emitter_emit_block_mapping_value(yaml_emitter_t *emitter,
+ yaml_event_t *event, int simple)
+{
+ if (simple) {
+ if (!yaml_emitter_write_indicator(emitter, ":", 0, 0, 0))
+ return 0;
+ }
+ else {
+ if (!yaml_emitter_write_indent(emitter))
+ return 0;
+ if (!yaml_emitter_write_indicator(emitter, ":", 1, 0, 1))
+ return 0;
+ }
+ if (!PUSH(emitter, emitter->states,
+ YAML_EMIT_BLOCK_MAPPING_KEY_STATE))
+ return 0;
+
+ return yaml_emitter_emit_node(emitter, event, 0, 0, 1, 0);
+}
+
+/*
+ * Expect a node.
+ */
+
+static int
+yaml_emitter_emit_node(yaml_emitter_t *emitter, yaml_event_t *event,
+ int root, int sequence, int mapping, int simple_key)
+{
+ emitter->root_context = root;
+ emitter->sequence_context = sequence;
+ emitter->mapping_context = mapping;
+ emitter->simple_key_context = simple_key;
+
+ switch (event->type)
+ {
+ case YAML_ALIAS_EVENT:
+ return yaml_emitter_emit_alias(emitter, event);
+
+ case YAML_SCALAR_EVENT:
+ return yaml_emitter_emit_scalar(emitter, event);
+
+ case YAML_SEQUENCE_START_EVENT:
+ return yaml_emitter_emit_sequence_start(emitter, event);
+
+ case YAML_MAPPING_START_EVENT:
+ return yaml_emitter_emit_mapping_start(emitter, event);
+
+ default:
+ return yaml_emitter_set_emitter_error(emitter,
+ "expected SCALAR, SEQUENCE-START, MAPPING-START, or ALIAS");
+ }
+
+ return 0;
+}
+
+/*
+ * Expect ALIAS.
+ */
+
+static int
+yaml_emitter_emit_alias(yaml_emitter_t *emitter, yaml_event_t *event)
+{
+ if (!yaml_emitter_process_anchor(emitter))
+ return 0;
+ emitter->state = POP(emitter, emitter->states);
+
+ return 1;
+}
+
+/*
+ * Expect SCALAR.
+ */
+
+static int
+yaml_emitter_emit_scalar(yaml_emitter_t *emitter, yaml_event_t *event)
+{
+ if (!yaml_emitter_select_scalar_style(emitter, event))
+ return 0;
+ if (!yaml_emitter_process_anchor(emitter))
+ return 0;
+ if (!yaml_emitter_process_tag(emitter))
+ return 0;
+ if (!yaml_emitter_increase_indent(emitter, 1, 0))
+ return 0;
+ if (!yaml_emitter_process_scalar(emitter))
+ return 0;
+ emitter->indent = POP(emitter, emitter->indents);
+ emitter->state = POP(emitter, emitter->states);
+
+ return 1;
+}
+
+/*
+ * Expect SEQUENCE-START.
+ */
+
+static int
+yaml_emitter_emit_sequence_start(yaml_emitter_t *emitter, yaml_event_t *event)
+{
+ if (!yaml_emitter_process_anchor(emitter))
+ return 0;
+ if (!yaml_emitter_process_tag(emitter))
+ return 0;
+
+ if (emitter->flow_level || emitter->canonical
+ || event->data.sequence_start.style == YAML_FLOW_SEQUENCE_STYLE
+ || yaml_emitter_check_empty_sequence(emitter)) {
+ emitter->state = YAML_EMIT_FLOW_SEQUENCE_FIRST_ITEM_STATE;
+ }
+ else {
+ emitter->state = YAML_EMIT_BLOCK_SEQUENCE_FIRST_ITEM_STATE;
+ }
+
+ return 1;
+}
+
+/*
+ * Expect MAPPING-START.
+ */
+
+static int
+yaml_emitter_emit_mapping_start(yaml_emitter_t *emitter, yaml_event_t *event)
+{
+ if (!yaml_emitter_process_anchor(emitter))
+ return 0;
+ if (!yaml_emitter_process_tag(emitter))
+ return 0;
+
+ if (emitter->flow_level || emitter->canonical
+ || event->data.mapping_start.style == YAML_FLOW_MAPPING_STYLE
+ || yaml_emitter_check_empty_mapping(emitter)) {
+ emitter->state = YAML_EMIT_FLOW_MAPPING_FIRST_KEY_STATE;
+ }
+ else {
+ emitter->state = YAML_EMIT_BLOCK_MAPPING_FIRST_KEY_STATE;
+ }
+
+ return 1;
+}
+
+/*
+ * Check if the document content is an empty scalar.
+ */
+
+static int
+yaml_emitter_check_empty_document(yaml_emitter_t *emitter)
+{
+ return 0;
+}
+
+/*
+ * Check if the next events represent an empty sequence.
+ */
+
+static int
+yaml_emitter_check_empty_sequence(yaml_emitter_t *emitter)
+{
+ if (emitter->events.tail - emitter->events.head < 2)
+ return 0;
+
+ return (emitter->events.head[0].type == YAML_SEQUENCE_START_EVENT
+ && emitter->events.head[1].type == YAML_SEQUENCE_END_EVENT);
+}
+
+/*
+ * Check if the next events represent an empty mapping.
+ */
+
+static int
+yaml_emitter_check_empty_mapping(yaml_emitter_t *emitter)
+{
+ if (emitter->events.tail - emitter->events.head < 2)
+ return 0;
+
+ return (emitter->events.head[0].type == YAML_MAPPING_START_EVENT
+ && emitter->events.head[1].type == YAML_MAPPING_END_EVENT);
+}
+
+/*
+ * Check if the next node can be expressed as a simple key.
+ */
+
+static int
+yaml_emitter_check_simple_key(yaml_emitter_t *emitter)
+{
+ yaml_event_t *event = emitter->events.head;
+ size_t length = 0;
+
+ switch (event->type)
+ {
+ case YAML_ALIAS_EVENT:
+ length += emitter->anchor_data.anchor_length;
+ break;
+
+ case YAML_SCALAR_EVENT:
+ if (emitter->scalar_data.multiline)
+ return 0;
+ length += emitter->anchor_data.anchor_length
+ + emitter->tag_data.handle_length
+ + emitter->tag_data.suffix_length
+ + emitter->scalar_data.length;
+ break;
+
+ case YAML_SEQUENCE_START_EVENT:
+ if (!yaml_emitter_check_empty_sequence(emitter))
+ return 0;
+ length += emitter->anchor_data.anchor_length
+ + emitter->tag_data.handle_length
+ + emitter->tag_data.suffix_length;
+ break;
+
+ case YAML_MAPPING_START_EVENT:
+ if (!yaml_emitter_check_empty_mapping(emitter))
+ return 0;
+ length += emitter->anchor_data.anchor_length
+ + emitter->tag_data.handle_length
+ + emitter->tag_data.suffix_length;
+ break;
+
+ default:
+ return 0;
+ }
+
+ if (length > 128)
+ return 0;
+
+ return 1;
+}
+
+/*
+ * Determine an acceptable scalar style.
+ */
+
+static int
+yaml_emitter_select_scalar_style(yaml_emitter_t *emitter, yaml_event_t *event)
+{
+ yaml_scalar_style_t style = event->data.scalar.style;
+ int no_tag = (!emitter->tag_data.handle && !emitter->tag_data.suffix);
+
+ if (no_tag && !event->data.scalar.plain_implicit
+ && !event->data.scalar.quoted_implicit) {
+ return yaml_emitter_set_emitter_error(emitter,
+ "neither tag nor implicit flags are specified");
+ }
+
+ if (style == YAML_ANY_SCALAR_STYLE)
+ style = YAML_PLAIN_SCALAR_STYLE;
+
+ if (emitter->canonical)
+ style = YAML_DOUBLE_QUOTED_SCALAR_STYLE;
+
+ if (emitter->simple_key_context && emitter->scalar_data.multiline)
+ style = YAML_DOUBLE_QUOTED_SCALAR_STYLE;
+
+ if (style == YAML_PLAIN_SCALAR_STYLE)
+ {
+ if ((emitter->flow_level && !emitter->scalar_data.flow_plain_allowed)
+ || (!emitter->flow_level && !emitter->scalar_data.block_plain_allowed))
+ style = YAML_SINGLE_QUOTED_SCALAR_STYLE;
+ if (!emitter->scalar_data.length
+ && (emitter->flow_level || emitter->simple_key_context))
+ style = YAML_SINGLE_QUOTED_SCALAR_STYLE;
+ if (no_tag && !event->data.scalar.plain_implicit)
+ style = YAML_SINGLE_QUOTED_SCALAR_STYLE;
+ }
+
+ if (style == YAML_SINGLE_QUOTED_SCALAR_STYLE)
+ {
+ if (!emitter->scalar_data.single_quoted_allowed)
+ style = YAML_DOUBLE_QUOTED_SCALAR_STYLE;
+ }
+
+ if (style == YAML_LITERAL_SCALAR_STYLE || style == YAML_FOLDED_SCALAR_STYLE)
+ {
+ if (!emitter->scalar_data.block_allowed
+ || emitter->flow_level || emitter->simple_key_context)
+ style = YAML_DOUBLE_QUOTED_SCALAR_STYLE;
+ }
+
+ if (no_tag && !event->data.scalar.quoted_implicit
+ && style != YAML_PLAIN_SCALAR_STYLE)
+ {
+ emitter->tag_data.handle = (yaml_char_t *)"!";
+ emitter->tag_data.handle_length = 1;
+ }
+
+ emitter->scalar_data.style = style;
+
+ return 1;
+}
+
+/*
+ * Write an achor.
+ */
+
+static int
+yaml_emitter_process_anchor(yaml_emitter_t *emitter)
+{
+ if (!emitter->anchor_data.anchor)
+ return 1;
+
+ if (!yaml_emitter_write_indicator(emitter,
+ (emitter->anchor_data.alias ? "*" : "&"), 1, 0, 0))
+ return 0;
+
+ return yaml_emitter_write_anchor(emitter,
+ emitter->anchor_data.anchor, emitter->anchor_data.anchor_length);
+}
+
+/*
+ * Write a tag.
+ */
+
+static int
+yaml_emitter_process_tag(yaml_emitter_t *emitter)
+{
+ if (!emitter->tag_data.handle && !emitter->tag_data.suffix)
+ return 1;
+
+ if (emitter->tag_data.handle)
+ {
+ if (!yaml_emitter_write_tag_handle(emitter, emitter->tag_data.handle,
+ emitter->tag_data.handle_length))
+ return 0;
+ if (emitter->tag_data.suffix) {
+ if (!yaml_emitter_write_tag_content(emitter, emitter->tag_data.suffix,
+ emitter->tag_data.suffix_length, 0))
+ return 0;
+ }
+ }
+ else
+ {
+ if (!yaml_emitter_write_indicator(emitter, "!<", 1, 0, 0))
+ return 0;
+ if (!yaml_emitter_write_tag_content(emitter, emitter->tag_data.suffix,
+ emitter->tag_data.suffix_length, 0))
+ return 0;
+ if (!yaml_emitter_write_indicator(emitter, ">", 0, 0, 0))
+ return 0;
+ }
+
+ return 1;
+}
+
+/*
+ * Write a scalar.
+ */
+
+static int
+yaml_emitter_process_scalar(yaml_emitter_t *emitter)
+{
+ switch (emitter->scalar_data.style)
+ {
+ case YAML_PLAIN_SCALAR_STYLE:
+ return yaml_emitter_write_plain_scalar(emitter,
+ emitter->scalar_data.value, emitter->scalar_data.length,
+ !emitter->simple_key_context);
+
+ case YAML_SINGLE_QUOTED_SCALAR_STYLE:
+ return yaml_emitter_write_single_quoted_scalar(emitter,
+ emitter->scalar_data.value, emitter->scalar_data.length,
+ !emitter->simple_key_context);
+
+ case YAML_DOUBLE_QUOTED_SCALAR_STYLE:
+ return yaml_emitter_write_double_quoted_scalar(emitter,
+ emitter->scalar_data.value, emitter->scalar_data.length,
+ !emitter->simple_key_context);
+
+ case YAML_LITERAL_SCALAR_STYLE:
+ return yaml_emitter_write_literal_scalar(emitter,
+ emitter->scalar_data.value, emitter->scalar_data.length);
+
+ case YAML_FOLDED_SCALAR_STYLE:
+ return yaml_emitter_write_folded_scalar(emitter,
+ emitter->scalar_data.value, emitter->scalar_data.length);
+
+ default:
+ assert(1); /* Impossible. */
+ }
+
+ return 0;
+}
+
+/*
+ * Check if a %YAML directive is valid.
+ */
+
+static int
+yaml_emitter_analyze_version_directive(yaml_emitter_t *emitter,
+ yaml_version_directive_t version_directive)
+{
+ if (version_directive.major != 1 || version_directive.minor != 1) {
+ return yaml_emitter_set_emitter_error(emitter,
+ "incompatible %YAML directive");
+ }
+
+ return 1;
+}
+
+/*
+ * Check if a %TAG directive is valid.
+ */
+
+static int
+yaml_emitter_analyze_tag_directive(yaml_emitter_t *emitter,
+ yaml_tag_directive_t tag_directive)
+{
+ yaml_string_t handle;
+ yaml_string_t prefix;
+ size_t handle_length;
+ size_t prefix_length;
+
+ handle_length = strlen((char *)tag_directive.handle);
+ prefix_length = strlen((char *)tag_directive.prefix);
+ STRING_ASSIGN(handle, tag_directive.handle, handle_length);
+ STRING_ASSIGN(prefix, tag_directive.prefix, prefix_length);
+
+ if (handle.start == handle.end) {
+ return yaml_emitter_set_emitter_error(emitter,
+ "tag handle must not be empty");
+ }
+
+ if (handle.start[0] != '!') {
+ return yaml_emitter_set_emitter_error(emitter,
+ "tag handle must start with '!'");
+ }
+
+ if (handle.end[-1] != '!') {
+ return yaml_emitter_set_emitter_error(emitter,
+ "tag handle must end with '!'");
+ }
+
+ handle.pointer ++;
+
+ while (handle.pointer < handle.end-1) {
+ if (!IS_ALPHA(handle)) {
+ return yaml_emitter_set_emitter_error(emitter,
+ "tag handle must contain alphanumerical characters only");
+ }
+ MOVE(handle);
+ }
+
+ if (prefix.start == prefix.end) {
+ return yaml_emitter_set_emitter_error(emitter,
+ "tag prefix must not be empty");
+ }
+
+ return 1;
+}
+
+/*
+ * Check if an anchor is valid.
+ */
+
+static int
+yaml_emitter_analyze_anchor(yaml_emitter_t *emitter,
+ yaml_char_t *anchor, int alias)
+{
+ size_t anchor_length;
+ yaml_string_t string;
+
+ anchor_length = strlen((char *)anchor);
+ STRING_ASSIGN(string, anchor, anchor_length);
+
+ if (string.start == string.end) {
+ return yaml_emitter_set_emitter_error(emitter, alias ?
+ "alias value must not be empty" :
+ "anchor value must not be empty");
+ }
+
+ while (string.pointer != string.end) {
+ if (!IS_ALPHA(string)) {
+ return yaml_emitter_set_emitter_error(emitter, alias ?
+ "alias value must contain alphanumerical characters only" :
+ "anchor value must contain alphanumerical characters only");
+ }
+ MOVE(string);
+ }
+
+ emitter->anchor_data.anchor = string.start;
+ emitter->anchor_data.anchor_length = string.end - string.start;
+ emitter->anchor_data.alias = alias;
+
+ return 1;
+}
+
+/*
+ * Check if a tag is valid.
+ */
+
+static int
+yaml_emitter_analyze_tag(yaml_emitter_t *emitter,
+ yaml_char_t *tag)
+{
+ size_t tag_length;
+ yaml_string_t string;
+ yaml_tag_directive_t *tag_directive;
+
+ tag_length = strlen((char *)tag);
+ STRING_ASSIGN(string, tag, tag_length);
+
+ if (string.start == string.end) {
+ return yaml_emitter_set_emitter_error(emitter,
+ "tag value must not be empty");
+ }
+
+ for (tag_directive = emitter->tag_directives.start;
+ tag_directive != emitter->tag_directives.top; tag_directive ++) {
+ size_t prefix_length = strlen((char *)tag_directive->prefix);
+ if (prefix_length < (size_t)(string.end - string.start)
+ && strncmp((char *)tag_directive->prefix, (char *)string.start,
+ prefix_length) == 0)
+ {
+ emitter->tag_data.handle = tag_directive->handle;
+ emitter->tag_data.handle_length =
+ strlen((char *)tag_directive->handle);
+ emitter->tag_data.suffix = string.start + prefix_length;
+ emitter->tag_data.suffix_length =
+ (string.end - string.start) - prefix_length;
+ return 1;
+ }
+ }
+
+ emitter->tag_data.suffix = string.start;
+ emitter->tag_data.suffix_length = string.end - string.start;
+
+ return 1;
+}
+
+/*
+ * Check if a scalar is valid.
+ */
+
+static int
+yaml_emitter_analyze_scalar(yaml_emitter_t *emitter,
+ yaml_char_t *value, size_t length)
+{
+ yaml_string_t string;
+
+ int block_indicators = 0;
+ int flow_indicators = 0;
+ int line_breaks = 0;
+ int special_characters = 0;
+
+ int leading_space = 0;
+ int leading_break = 0;
+ int trailing_space = 0;
+ int trailing_break = 0;
+ int break_space = 0;
+ int space_break = 0;
+
+ int preceeded_by_whitespace = 0;
+ int followed_by_whitespace = 0;
+ int previous_space = 0;
+ int previous_break = 0;
+
+ STRING_ASSIGN(string, value, length);
+
+ emitter->scalar_data.value = value;
+ emitter->scalar_data.length = length;
+
+ if (string.start == string.end)
+ {
+ emitter->scalar_data.multiline = 0;
+ emitter->scalar_data.flow_plain_allowed = 0;
+ emitter->scalar_data.block_plain_allowed = 1;
+ emitter->scalar_data.single_quoted_allowed = 1;
+ emitter->scalar_data.block_allowed = 0;
+
+ return 1;
+ }
+
+ if ((CHECK_AT(string, '-', 0)
+ && CHECK_AT(string, '-', 1)
+ && CHECK_AT(string, '-', 2))
+ || (CHECK_AT(string, '.', 0)
+ && CHECK_AT(string, '.', 1)
+ && CHECK_AT(string, '.', 2))) {
+ block_indicators = 1;
+ flow_indicators = 1;
+ }
+
+ preceeded_by_whitespace = 1;
+ followed_by_whitespace = IS_BLANKZ_AT(string, WIDTH(string));
+
+ while (string.pointer != string.end)
+ {
+ if (string.start == string.pointer)
+ {
+ if (CHECK(string, '#') || CHECK(string, ',')
+ || CHECK(string, '[') || CHECK(string, ']')
+ || CHECK(string, '{') || CHECK(string, '}')
+ || CHECK(string, '&') || CHECK(string, '*')
+ || CHECK(string, '!') || CHECK(string, '|')
+ || CHECK(string, '>') || CHECK(string, '\'')
+ || CHECK(string, '"') || CHECK(string, '%')
+ || CHECK(string, '@') || CHECK(string, '`')) {
+ flow_indicators = 1;
+ block_indicators = 1;
+ }
+
+ if (CHECK(string, '?') || CHECK(string, ':')) {
+ flow_indicators = 1;
+ if (followed_by_whitespace) {
+ block_indicators = 1;
+ }
+ }
+
+ if (CHECK(string, '-') && followed_by_whitespace) {
+ flow_indicators = 1;
+ block_indicators = 1;
+ }
+ }
+ else
+ {
+ if (CHECK(string, ',') || CHECK(string, '?')
+ || CHECK(string, '[') || CHECK(string, ']')
+ || CHECK(string, '{') || CHECK(string, '}')) {
+ flow_indicators = 1;
+ }
+
+ if (CHECK(string, ':')) {
+ flow_indicators = 1;
+ if (followed_by_whitespace) {
+ block_indicators = 1;
+ }
+ }
+
+ if (CHECK(string, '#') && preceeded_by_whitespace) {
+ flow_indicators = 1;
+ block_indicators = 1;
+ }
+ }
+
+ if (!IS_PRINTABLE(string)
+ || (!IS_ASCII(string) && !emitter->unicode)) {
+ special_characters = 1;
+ }
+
+ if (IS_BREAK(string)) {
+ line_breaks = 1;
+ }
+
+ if (IS_SPACE(string))
+ {
+ if (string.start == string.pointer) {
+ leading_space = 1;
+ }
+ if (string.pointer+WIDTH(string) == string.end) {
+ trailing_space = 1;
+ }
+ if (previous_break) {
+ break_space = 1;
+ }
+ previous_space = 1;
+ previous_break = 0;
+ }
+ else if (IS_BREAK(string))
+ {
+ if (string.start == string.pointer) {
+ leading_break = 1;
+ }
+ if (string.pointer+WIDTH(string) == string.end) {
+ trailing_break = 1;
+ }
+ if (previous_space) {
+ space_break = 1;
+ }
+ previous_space = 0;
+ previous_break = 1;
+ }
+ else
+ {
+ previous_space = 0;
+ previous_break = 0;
+ }
+
+ preceeded_by_whitespace = IS_BLANKZ(string);
+ MOVE(string);
+ if (string.pointer != string.end) {
+ followed_by_whitespace = IS_BLANKZ_AT(string, WIDTH(string));
+ }
+ }
+
+ emitter->scalar_data.multiline = line_breaks;
+
+ emitter->scalar_data.flow_plain_allowed = 1;
+ emitter->scalar_data.block_plain_allowed = 1;
+ emitter->scalar_data.single_quoted_allowed = 1;
+ emitter->scalar_data.block_allowed = 1;
+
+ if (leading_space || leading_break || trailing_space || trailing_break) {
+ emitter->scalar_data.flow_plain_allowed = 0;
+ emitter->scalar_data.block_plain_allowed = 0;
+ }
+
+ if (trailing_space) {
+ emitter->scalar_data.block_allowed = 0;
+ }
+
+ if (break_space) {
+ emitter->scalar_data.flow_plain_allowed = 0;
+ emitter->scalar_data.block_plain_allowed = 0;
+ emitter->scalar_data.single_quoted_allowed = 0;
+ }
+
+ if (space_break || special_characters) {
+ emitter->scalar_data.flow_plain_allowed = 0;
+ emitter->scalar_data.block_plain_allowed = 0;
+ emitter->scalar_data.single_quoted_allowed = 0;
+ emitter->scalar_data.block_allowed = 0;
+ }
+
+ if (line_breaks) {
+ emitter->scalar_data.flow_plain_allowed = 0;
+ emitter->scalar_data.block_plain_allowed = 0;
+ }
+
+ if (flow_indicators) {
+ emitter->scalar_data.flow_plain_allowed = 0;
+ }
+
+ if (block_indicators) {
+ emitter->scalar_data.block_plain_allowed = 0;
+ }
+
+ return 1;
+}
+
+/*
+ * Check if the event data is valid.
+ */
+
+static int
+yaml_emitter_analyze_event(yaml_emitter_t *emitter,
+ yaml_event_t *event)
+{
+ emitter->anchor_data.anchor = NULL;
+ emitter->anchor_data.anchor_length = 0;
+ emitter->tag_data.handle = NULL;
+ emitter->tag_data.handle_length = 0;
+ emitter->tag_data.suffix = NULL;
+ emitter->tag_data.suffix_length = 0;
+ emitter->scalar_data.value = NULL;
+ emitter->scalar_data.length = 0;
+
+ switch (event->type)
+ {
+ case YAML_ALIAS_EVENT:
+ if (!yaml_emitter_analyze_anchor(emitter,
+ event->data.alias.anchor, 1))
+ return 0;
+ return 1;
+
+ case YAML_SCALAR_EVENT:
+ if (event->data.scalar.anchor) {
+ if (!yaml_emitter_analyze_anchor(emitter,
+ event->data.scalar.anchor, 0))
+ return 0;
+ }
+ if (event->data.scalar.tag && (emitter->canonical ||
+ (!event->data.scalar.plain_implicit
+ && !event->data.scalar.quoted_implicit))) {
+ if (!yaml_emitter_analyze_tag(emitter, event->data.scalar.tag))
+ return 0;
+ }
+ if (!yaml_emitter_analyze_scalar(emitter,
+ event->data.scalar.value, event->data.scalar.length))
+ return 0;
+ return 1;
+
+ case YAML_SEQUENCE_START_EVENT:
+ if (event->data.sequence_start.anchor) {
+ if (!yaml_emitter_analyze_anchor(emitter,
+ event->data.sequence_start.anchor, 0))
+ return 0;
+ }
+ if (event->data.sequence_start.tag && (emitter->canonical ||
+ !event->data.sequence_start.implicit)) {
+ if (!yaml_emitter_analyze_tag(emitter,
+ event->data.sequence_start.tag))
+ return 0;
+ }
+ return 1;
+
+ case YAML_MAPPING_START_EVENT:
+ if (event->data.mapping_start.anchor) {
+ if (!yaml_emitter_analyze_anchor(emitter,
+ event->data.mapping_start.anchor, 0))
+ return 0;
+ }
+ if (event->data.mapping_start.tag && (emitter->canonical ||
+ !event->data.mapping_start.implicit)) {
+ if (!yaml_emitter_analyze_tag(emitter,
+ event->data.mapping_start.tag))
+ return 0;
+ }
+ return 1;
+
+ default:
+ return 1;
+ }
+}
+
+/*
+ * Write the BOM character.
+ */
+
+static int
+yaml_emitter_write_bom(yaml_emitter_t *emitter)
+{
+ if (!FLUSH(emitter)) return 0;
+
+ *(emitter->buffer.pointer++) = (yaml_char_t) '\xEF';
+ *(emitter->buffer.pointer++) = (yaml_char_t) '\xBB';
+ *(emitter->buffer.pointer++) = (yaml_char_t) '\xBF';
+
+ return 1;
+}
+
+static int
+yaml_emitter_write_indent(yaml_emitter_t *emitter)
+{
+ int indent = (emitter->indent >= 0) ? emitter->indent : 0;
+
+ if (!emitter->indention || emitter->column > indent
+ || (emitter->column == indent && !emitter->whitespace)) {
+ if (!PUT_BREAK(emitter)) return 0;
+ }
+
+ while (emitter->column < indent) {
+ if (!PUT(emitter, ' ')) return 0;
+ }
+
+ emitter->whitespace = 1;
+ emitter->indention = 1;
+
+ return 1;
+}
+
+static int
+yaml_emitter_write_indicator(yaml_emitter_t *emitter,
+ const char *indicator, int need_whitespace,
+ int is_whitespace, int is_indention)
+{
+ size_t indicator_length;
+ yaml_string_t string;
+
+ indicator_length = strlen(indicator);
+ STRING_ASSIGN(string, (yaml_char_t *)indicator, indicator_length);
+
+ if (need_whitespace && !emitter->whitespace) {
+ if (!PUT(emitter, ' ')) return 0;
+ }
+
+ while (string.pointer != string.end) {
+ if (!WRITE(emitter, string)) return 0;
+ }
+
+ emitter->whitespace = is_whitespace;
+ emitter->indention = (emitter->indention && is_indention);
+ emitter->open_ended = 0;
+
+ return 1;
+}
+
+static int
+yaml_emitter_write_anchor(yaml_emitter_t *emitter,
+ yaml_char_t *value, size_t length)
+{
+ yaml_string_t string;
+ STRING_ASSIGN(string, value, length);
+
+ while (string.pointer != string.end) {
+ if (!WRITE(emitter, string)) return 0;
+ }
+
+ emitter->whitespace = 0;
+ emitter->indention = 0;
+
+ return 1;
+}
+
+static int
+yaml_emitter_write_tag_handle(yaml_emitter_t *emitter,
+ yaml_char_t *value, size_t length)
+{
+ yaml_string_t string;
+ STRING_ASSIGN(string, value, length);
+
+ if (!emitter->whitespace) {
+ if (!PUT(emitter, ' ')) return 0;
+ }
+
+ while (string.pointer != string.end) {
+ if (!WRITE(emitter, string)) return 0;
+ }
+
+ emitter->whitespace = 0;
+ emitter->indention = 0;
+
+ return 1;
+}
+
+static int
+yaml_emitter_write_tag_content(yaml_emitter_t *emitter,
+ yaml_char_t *value, size_t length,
+ int need_whitespace)
+{
+ yaml_string_t string;
+ STRING_ASSIGN(string, value, length);
+
+ if (need_whitespace && !emitter->whitespace) {
+ if (!PUT(emitter, ' ')) return 0;
+ }
+
+ while (string.pointer != string.end) {
+ if (IS_ALPHA(string)
+ || CHECK(string, ';') || CHECK(string, '/')
+ || CHECK(string, '?') || CHECK(string, ':')
+ || CHECK(string, '@') || CHECK(string, '&')
+ || CHECK(string, '=') || CHECK(string, '+')
+ || CHECK(string, '$') || CHECK(string, ',')
+ || CHECK(string, '_') || CHECK(string, '.')
+ || CHECK(string, '~') || CHECK(string, '*')
+ || CHECK(string, '\'') || CHECK(string, '(')
+ || CHECK(string, ')') || CHECK(string, '[')
+ || CHECK(string, ']')) {
+ if (!WRITE(emitter, string)) return 0;
+ }
+ else {
+ int width = WIDTH(string);
+ unsigned int value;
+ while (width --) {
+ value = *(string.pointer++);
+ if (!PUT(emitter, '%')) return 0;
+ if (!PUT(emitter, (value >> 4)
+ + ((value >> 4) < 10 ? '0' : 'A' - 10)))
+ return 0;
+ if (!PUT(emitter, (value & 0x0F)
+ + ((value & 0x0F) < 10 ? '0' : 'A' - 10)))
+ return 0;
+ }
+ }
+ }
+
+ emitter->whitespace = 0;
+ emitter->indention = 0;
+
+ return 1;
+}
+
+static int
+yaml_emitter_write_plain_scalar(yaml_emitter_t *emitter,
+ yaml_char_t *value, size_t length, int allow_breaks)
+{
+ yaml_string_t string;
+ int spaces = 0;
+ int breaks = 0;
+
+ STRING_ASSIGN(string, value, length);
+
+ if (!emitter->whitespace) {
+ if (!PUT(emitter, ' ')) return 0;
+ }
+
+ while (string.pointer != string.end)
+ {
+ if (IS_SPACE(string))
+ {
+ if (allow_breaks && !spaces
+ && emitter->column > emitter->best_width
+ && !IS_SPACE_AT(string, 1)) {
+ if (!yaml_emitter_write_indent(emitter)) return 0;
+ MOVE(string);
+ }
+ else {
+ if (!WRITE(emitter, string)) return 0;
+ }
+ spaces = 1;
+ }
+ else if (IS_BREAK(string))
+ {
+ if (!breaks && CHECK(string, '\n')) {
+ if (!PUT_BREAK(emitter)) return 0;
+ }
+ if (!WRITE_BREAK(emitter, string)) return 0;
+ emitter->indention = 1;
+ breaks = 1;
+ }
+ else
+ {
+ if (breaks) {
+ if (!yaml_emitter_write_indent(emitter)) return 0;
+ }
+ if (!WRITE(emitter, string)) return 0;
+ emitter->indention = 0;
+ spaces = 0;
+ breaks = 0;
+ }
+ }
+
+ emitter->whitespace = 0;
+ emitter->indention = 0;
+ if (emitter->root_context)
+ {
+ emitter->open_ended = 1;
+ }
+
+ return 1;
+}
+
+static int
+yaml_emitter_write_single_quoted_scalar(yaml_emitter_t *emitter,
+ yaml_char_t *value, size_t length, int allow_breaks)
+{
+ yaml_string_t string;
+ int spaces = 0;
+ int breaks = 0;
+
+ STRING_ASSIGN(string, value, length);
+
+ if (!yaml_emitter_write_indicator(emitter, "'", 1, 0, 0))
+ return 0;
+
+ while (string.pointer != string.end)
+ {
+ if (IS_SPACE(string))
+ {
+ if (allow_breaks && !spaces
+ && emitter->column > emitter->best_width
+ && string.pointer != string.start
+ && string.pointer != string.end - 1
+ && !IS_SPACE_AT(string, 1)) {
+ if (!yaml_emitter_write_indent(emitter)) return 0;
+ MOVE(string);
+ }
+ else {
+ if (!WRITE(emitter, string)) return 0;
+ }
+ spaces = 1;
+ }
+ else if (IS_BREAK(string))
+ {
+ if (!breaks && CHECK(string, '\n')) {
+ if (!PUT_BREAK(emitter)) return 0;
+ }
+ if (!WRITE_BREAK(emitter, string)) return 0;
+ emitter->indention = 1;
+ breaks = 1;
+ }
+ else
+ {
+ if (breaks) {
+ if (!yaml_emitter_write_indent(emitter)) return 0;
+ }
+ if (CHECK(string, '\'')) {
+ if (!PUT(emitter, '\'')) return 0;
+ }
+ if (!WRITE(emitter, string)) return 0;
+ emitter->indention = 0;
+ spaces = 0;
+ breaks = 0;
+ }
+ }
+
+ if (!yaml_emitter_write_indicator(emitter, "'", 0, 0, 0))
+ return 0;
+
+ emitter->whitespace = 0;
+ emitter->indention = 0;
+
+ return 1;
+}
+
+static int
+yaml_emitter_write_double_quoted_scalar(yaml_emitter_t *emitter,
+ yaml_char_t *value, size_t length, int allow_breaks)
+{
+ yaml_string_t string;
+ int spaces = 0;
+
+ STRING_ASSIGN(string, value, length);
+
+ if (!yaml_emitter_write_indicator(emitter, "\"", 1, 0, 0))
+ return 0;
+
+ while (string.pointer != string.end)
+ {
+ if (!IS_PRINTABLE(string) || (!emitter->unicode && !IS_ASCII(string))
+ || IS_BOM(string) || IS_BREAK(string)
+ || CHECK(string, '"') || CHECK(string, '\\'))
+ {
+ unsigned char octet;
+ unsigned int width;
+ unsigned int value;
+ int k;
+
+ octet = string.pointer[0];
+ width = (octet & 0x80) == 0x00 ? 1 :
+ (octet & 0xE0) == 0xC0 ? 2 :
+ (octet & 0xF0) == 0xE0 ? 3 :
+ (octet & 0xF8) == 0xF0 ? 4 : 0;
+ value = (octet & 0x80) == 0x00 ? octet & 0x7F :
+ (octet & 0xE0) == 0xC0 ? octet & 0x1F :
+ (octet & 0xF0) == 0xE0 ? octet & 0x0F :
+ (octet & 0xF8) == 0xF0 ? octet & 0x07 : 0;
+ for (k = 1; k < (int)width; k ++) {
+ octet = string.pointer[k];
+ value = (value << 6) + (octet & 0x3F);
+ }
+ string.pointer += width;
+
+ if (!PUT(emitter, '\\')) return 0;
+
+ switch (value)
+ {
+ case 0x00:
+ if (!PUT(emitter, '0')) return 0;
+ break;
+
+ case 0x07:
+ if (!PUT(emitter, 'a')) return 0;
+ break;
+
+ case 0x08:
+ if (!PUT(emitter, 'b')) return 0;
+ break;
+
+ case 0x09:
+ if (!PUT(emitter, 't')) return 0;
+ break;
+
+ case 0x0A:
+ if (!PUT(emitter, 'n')) return 0;
+ break;
+
+ case 0x0B:
+ if (!PUT(emitter, 'v')) return 0;
+ break;
+
+ case 0x0C:
+ if (!PUT(emitter, 'f')) return 0;
+ break;
+
+ case 0x0D:
+ if (!PUT(emitter, 'r')) return 0;
+ break;
+
+ case 0x1B:
+ if (!PUT(emitter, 'e')) return 0;
+ break;
+
+ case 0x22:
+ if (!PUT(emitter, '\"')) return 0;
+ break;
+
+ case 0x5C:
+ if (!PUT(emitter, '\\')) return 0;
+ break;
+
+ case 0x85:
+ if (!PUT(emitter, 'N')) return 0;
+ break;
+
+ case 0xA0:
+ if (!PUT(emitter, '_')) return 0;
+ break;
+
+ case 0x2028:
+ if (!PUT(emitter, 'L')) return 0;
+ break;
+
+ case 0x2029:
+ if (!PUT(emitter, 'P')) return 0;
+ break;
+
+ default:
+ if (value <= 0xFF) {
+ if (!PUT(emitter, 'x')) return 0;
+ width = 2;
+ }
+ else if (value <= 0xFFFF) {
+ if (!PUT(emitter, 'u')) return 0;
+ width = 4;
+ }
+ else {
+ if (!PUT(emitter, 'U')) return 0;
+ width = 8;
+ }
+ for (k = (width-1)*4; k >= 0; k -= 4) {
+ int digit = (value >> k) & 0x0F;
+ if (!PUT(emitter, digit + (digit < 10 ? '0' : 'A'-10)))
+ return 0;
+ }
+ }
+ spaces = 0;
+ }
+ else if (IS_SPACE(string))
+ {
+ if (allow_breaks && !spaces
+ && emitter->column > emitter->best_width
+ && string.pointer != string.start
+ && string.pointer != string.end - 1) {
+ if (!yaml_emitter_write_indent(emitter)) return 0;
+ if (IS_SPACE_AT(string, 1)) {
+ if (!PUT(emitter, '\\')) return 0;
+ }
+ MOVE(string);
+ }
+ else {
+ if (!WRITE(emitter, string)) return 0;
+ }
+ spaces = 1;
+ }
+ else
+ {
+ if (!WRITE(emitter, string)) return 0;
+ spaces = 0;
+ }
+ }
+
+ if (!yaml_emitter_write_indicator(emitter, "\"", 0, 0, 0))
+ return 0;
+
+ emitter->whitespace = 0;
+ emitter->indention = 0;
+
+ return 1;
+}
+
+static int
+yaml_emitter_write_block_scalar_hints(yaml_emitter_t *emitter,
+ yaml_string_t string)
+{
+ char indent_hint[2];
+ const char *chomp_hint = NULL;
+
+ if (IS_SPACE(string) || IS_BREAK(string))
+ {
+ indent_hint[0] = '0' + (char)emitter->best_indent;
+ indent_hint[1] = '\0';
+ if (!yaml_emitter_write_indicator(emitter, indent_hint, 0, 0, 0))
+ return 0;
+ }
+
+ emitter->open_ended = 0;
+
+ string.pointer = string.end;
+ if (string.start == string.pointer)
+ {
+ chomp_hint = "-";
+ }
+ else
+ {
+ do {
+ string.pointer --;
+ } while ((*string.pointer & 0xC0) == 0x80);
+ if (!IS_BREAK(string))
+ {
+ chomp_hint = "-";
+ }
+ else if (string.start == string.pointer)
+ {
+ chomp_hint = "+";
+ emitter->open_ended = 1;
+ }
+ else
+ {
+ do {
+ string.pointer --;
+ } while ((*string.pointer & 0xC0) == 0x80);
+ if (IS_BREAK(string))
+ {
+ chomp_hint = "+";
+ emitter->open_ended = 1;
+ }
+ }
+ }
+
+ if (chomp_hint)
+ {
+ if (!yaml_emitter_write_indicator(emitter, chomp_hint, 0, 0, 0))
+ return 0;
+ }
+
+ return 1;
+}
+
+static int
+yaml_emitter_write_literal_scalar(yaml_emitter_t *emitter,
+ yaml_char_t *value, size_t length)
+{
+ yaml_string_t string;
+ int breaks = 1;
+
+ STRING_ASSIGN(string, value, length);
+
+ if (!yaml_emitter_write_indicator(emitter, "|", 1, 0, 0))
+ return 0;
+ if (!yaml_emitter_write_block_scalar_hints(emitter, string))
+ return 0;
+ if (!PUT_BREAK(emitter)) return 0;
+ emitter->indention = 1;
+ emitter->whitespace = 1;
+
+ while (string.pointer != string.end)
+ {
+ if (IS_BREAK(string))
+ {
+ if (!WRITE_BREAK(emitter, string)) return 0;
+ emitter->indention = 1;
+ breaks = 1;
+ }
+ else
+ {
+ if (breaks) {
+ if (!yaml_emitter_write_indent(emitter)) return 0;
+ }
+ if (!WRITE(emitter, string)) return 0;
+ emitter->indention = 0;
+ breaks = 0;
+ }
+ }
+
+ return 1;
+}
+
+static int
+yaml_emitter_write_folded_scalar(yaml_emitter_t *emitter,
+ yaml_char_t *value, size_t length)
+{
+ yaml_string_t string;
+ int breaks = 1;
+ int leading_spaces = 1;
+
+ STRING_ASSIGN(string, value, length);
+
+ if (!yaml_emitter_write_indicator(emitter, ">", 1, 0, 0))
+ return 0;
+ if (!yaml_emitter_write_block_scalar_hints(emitter, string))
+ return 0;
+ if (!PUT_BREAK(emitter)) return 0;
+ emitter->indention = 1;
+ emitter->whitespace = 1;
+
+ while (string.pointer != string.end)
+ {
+ if (IS_BREAK(string))
+ {
+ if (!breaks && !leading_spaces && CHECK(string, '\n')) {
+ int k = 0;
+ while (IS_BREAK_AT(string, k)) {
+ k += WIDTH_AT(string, k);
+ }
+ if (!IS_BLANKZ_AT(string, k)) {
+ if (!PUT_BREAK(emitter)) return 0;
+ }
+ }
+ if (!WRITE_BREAK(emitter, string)) return 0;
+ emitter->indention = 1;
+ breaks = 1;
+ }
+ else
+ {
+ if (breaks) {
+ if (!yaml_emitter_write_indent(emitter)) return 0;
+ leading_spaces = IS_BLANK(string);
+ }
+ if (!breaks && IS_SPACE(string) && !IS_SPACE_AT(string, 1)
+ && emitter->column > emitter->best_width) {
+ if (!yaml_emitter_write_indent(emitter)) return 0;
+ MOVE(string);
+ }
+ else {
+ if (!WRITE(emitter, string)) return 0;
+ }
+ emitter->indention = 0;
+ breaks = 0;
+ }
+ }
+
+ return 1;
+}
+
diff --git a/ext/psych/yaml/loader.c b/ext/psych/yaml/loader.c
new file mode 100644
index 0000000000..9d3d912663
--- /dev/null
+++ b/ext/psych/yaml/loader.c
@@ -0,0 +1,432 @@
+
+#include "yaml_private.h"
+
+/*
+ * API functions.
+ */
+
+YAML_DECLARE(int)
+yaml_parser_load(yaml_parser_t *parser, yaml_document_t *document);
+
+/*
+ * Error handling.
+ */
+
+static int
+yaml_parser_set_composer_error(yaml_parser_t *parser,
+ const char *problem, yaml_mark_t problem_mark);
+
+static int
+yaml_parser_set_composer_error_context(yaml_parser_t *parser,
+ const char *context, yaml_mark_t context_mark,
+ const char *problem, yaml_mark_t problem_mark);
+
+
+/*
+ * Alias handling.
+ */
+
+static int
+yaml_parser_register_anchor(yaml_parser_t *parser,
+ int index, yaml_char_t *anchor);
+
+/*
+ * Clean up functions.
+ */
+
+static void
+yaml_parser_delete_aliases(yaml_parser_t *parser);
+
+/*
+ * Composer functions.
+ */
+
+static int
+yaml_parser_load_document(yaml_parser_t *parser, yaml_event_t *first_event);
+
+static int
+yaml_parser_load_node(yaml_parser_t *parser, yaml_event_t *first_event);
+
+static int
+yaml_parser_load_alias(yaml_parser_t *parser, yaml_event_t *first_event);
+
+static int
+yaml_parser_load_scalar(yaml_parser_t *parser, yaml_event_t *first_event);
+
+static int
+yaml_parser_load_sequence(yaml_parser_t *parser, yaml_event_t *first_event);
+
+static int
+yaml_parser_load_mapping(yaml_parser_t *parser, yaml_event_t *first_event);
+
+/*
+ * Load the next document of the stream.
+ */
+
+YAML_DECLARE(int)
+yaml_parser_load(yaml_parser_t *parser, yaml_document_t *document)
+{
+ yaml_event_t event;
+
+ assert(parser); /* Non-NULL parser object is expected. */
+ assert(document); /* Non-NULL document object is expected. */
+
+ memset(document, 0, sizeof(yaml_document_t));
+ if (!STACK_INIT(parser, document->nodes, INITIAL_STACK_SIZE))
+ goto error;
+
+ if (!parser->stream_start_produced) {
+ if (!yaml_parser_parse(parser, &event)) goto error;
+ assert(event.type == YAML_STREAM_START_EVENT);
+ /* STREAM-START is expected. */
+ }
+
+ if (parser->stream_end_produced) {
+ return 1;
+ }
+
+ if (!yaml_parser_parse(parser, &event)) goto error;
+ if (event.type == YAML_STREAM_END_EVENT) {
+ return 1;
+ }
+
+ if (!STACK_INIT(parser, parser->aliases, INITIAL_STACK_SIZE))
+ goto error;
+
+ parser->document = document;
+
+ if (!yaml_parser_load_document(parser, &event)) goto error;
+
+ yaml_parser_delete_aliases(parser);
+ parser->document = NULL;
+
+ return 1;
+
+error:
+
+ yaml_parser_delete_aliases(parser);
+ yaml_document_delete(document);
+ parser->document = NULL;
+
+ return 0;
+}
+
+/*
+ * Set composer error.
+ */
+
+static int
+yaml_parser_set_composer_error(yaml_parser_t *parser,
+ const char *problem, yaml_mark_t problem_mark)
+{
+ parser->error = YAML_COMPOSER_ERROR;
+ parser->problem = problem;
+ parser->problem_mark = problem_mark;
+
+ return 0;
+}
+
+/*
+ * Set composer error with context.
+ */
+
+static int
+yaml_parser_set_composer_error_context(yaml_parser_t *parser,
+ const char *context, yaml_mark_t context_mark,
+ const char *problem, yaml_mark_t problem_mark)
+{
+ parser->error = YAML_COMPOSER_ERROR;
+ parser->context = context;
+ parser->context_mark = context_mark;
+ parser->problem = problem;
+ parser->problem_mark = problem_mark;
+
+ return 0;
+}
+
+/*
+ * Delete the stack of aliases.
+ */
+
+static void
+yaml_parser_delete_aliases(yaml_parser_t *parser)
+{
+ while (!STACK_EMPTY(parser, parser->aliases)) {
+ yaml_free(POP(parser, parser->aliases).anchor);
+ }
+ STACK_DEL(parser, parser->aliases);
+}
+
+/*
+ * Compose a document object.
+ */
+
+static int
+yaml_parser_load_document(yaml_parser_t *parser, yaml_event_t *first_event)
+{
+ yaml_event_t event;
+
+ assert(first_event->type == YAML_DOCUMENT_START_EVENT);
+ /* DOCUMENT-START is expected. */
+
+ parser->document->version_directive
+ = first_event->data.document_start.version_directive;
+ parser->document->tag_directives.start
+ = first_event->data.document_start.tag_directives.start;
+ parser->document->tag_directives.end
+ = first_event->data.document_start.tag_directives.end;
+ parser->document->start_implicit
+ = first_event->data.document_start.implicit;
+ parser->document->start_mark = first_event->start_mark;
+
+ if (!yaml_parser_parse(parser, &event)) return 0;
+
+ if (!yaml_parser_load_node(parser, &event)) return 0;
+
+ if (!yaml_parser_parse(parser, &event)) return 0;
+ assert(event.type == YAML_DOCUMENT_END_EVENT);
+ /* DOCUMENT-END is expected. */
+
+ parser->document->end_implicit = event.data.document_end.implicit;
+ parser->document->end_mark = event.end_mark;
+
+ return 1;
+}
+
+/*
+ * Compose a node.
+ */
+
+static int
+yaml_parser_load_node(yaml_parser_t *parser, yaml_event_t *first_event)
+{
+ switch (first_event->type) {
+ case YAML_ALIAS_EVENT:
+ return yaml_parser_load_alias(parser, first_event);
+ case YAML_SCALAR_EVENT:
+ return yaml_parser_load_scalar(parser, first_event);
+ case YAML_SEQUENCE_START_EVENT:
+ return yaml_parser_load_sequence(parser, first_event);
+ case YAML_MAPPING_START_EVENT:
+ return yaml_parser_load_mapping(parser, first_event);
+ default:
+ assert(0); /* Could not happen. */
+ return 0;
+ }
+
+ return 0;
+}
+
+/*
+ * Add an anchor.
+ */
+
+static int
+yaml_parser_register_anchor(yaml_parser_t *parser,
+ int index, yaml_char_t *anchor)
+{
+ yaml_alias_data_t data;
+ yaml_alias_data_t *alias_data;
+
+ if (!anchor) return 1;
+
+ data.anchor = anchor;
+ data.index = index;
+ data.mark = parser->document->nodes.start[index-1].start_mark;
+
+ for (alias_data = parser->aliases.start;
+ alias_data != parser->aliases.top; alias_data ++) {
+ if (strcmp((char *)alias_data->anchor, (char *)anchor) == 0) {
+ yaml_free(anchor);
+ return yaml_parser_set_composer_error_context(parser,
+ "found duplicate anchor; first occurence",
+ alias_data->mark, "second occurence", data.mark);
+ }
+ }
+
+ if (!PUSH(parser, parser->aliases, data)) {
+ yaml_free(anchor);
+ return 0;
+ }
+
+ return 1;
+}
+
+/*
+ * Compose a node corresponding to an alias.
+ */
+
+static int
+yaml_parser_load_alias(yaml_parser_t *parser, yaml_event_t *first_event)
+{
+ yaml_char_t *anchor = first_event->data.alias.anchor;
+ yaml_alias_data_t *alias_data;
+
+ for (alias_data = parser->aliases.start;
+ alias_data != parser->aliases.top; alias_data ++) {
+ if (strcmp((char *)alias_data->anchor, (char *)anchor) == 0) {
+ yaml_free(anchor);
+ return alias_data->index;
+ }
+ }
+
+ yaml_free(anchor);
+ return yaml_parser_set_composer_error(parser, "found undefined alias",
+ first_event->start_mark);
+}
+
+/*
+ * Compose a scalar node.
+ */
+
+static int
+yaml_parser_load_scalar(yaml_parser_t *parser, yaml_event_t *first_event)
+{
+ yaml_node_t node;
+ int index;
+ yaml_char_t *tag = first_event->data.scalar.tag;
+
+ if (!tag || strcmp((char *)tag, "!") == 0) {
+ yaml_free(tag);
+ tag = yaml_strdup((yaml_char_t *)YAML_DEFAULT_SCALAR_TAG);
+ if (!tag) goto error;
+ }
+
+ SCALAR_NODE_INIT(node, tag, first_event->data.scalar.value,
+ first_event->data.scalar.length, first_event->data.scalar.style,
+ first_event->start_mark, first_event->end_mark);
+
+ if (!PUSH(parser, parser->document->nodes, node)) goto error;
+
+ index = parser->document->nodes.top - parser->document->nodes.start;
+
+ if (!yaml_parser_register_anchor(parser, index,
+ first_event->data.scalar.anchor)) return 0;
+
+ return index;
+
+error:
+ yaml_free(tag);
+ yaml_free(first_event->data.scalar.anchor);
+ yaml_free(first_event->data.scalar.value);
+ return 0;
+}
+
+/*
+ * Compose a sequence node.
+ */
+
+static int
+yaml_parser_load_sequence(yaml_parser_t *parser, yaml_event_t *first_event)
+{
+ yaml_event_t event;
+ yaml_node_t node;
+ struct {
+ yaml_node_item_t *start;
+ yaml_node_item_t *end;
+ yaml_node_item_t *top;
+ } items = { NULL, NULL, NULL };
+ int index, item_index;
+ yaml_char_t *tag = first_event->data.sequence_start.tag;
+
+ if (!tag || strcmp((char *)tag, "!") == 0) {
+ yaml_free(tag);
+ tag = yaml_strdup((yaml_char_t *)YAML_DEFAULT_SEQUENCE_TAG);
+ if (!tag) goto error;
+ }
+
+ if (!STACK_INIT(parser, items, INITIAL_STACK_SIZE)) goto error;
+
+ SEQUENCE_NODE_INIT(node, tag, items.start, items.end,
+ first_event->data.sequence_start.style,
+ first_event->start_mark, first_event->end_mark);
+
+ if (!PUSH(parser, parser->document->nodes, node)) goto error;
+
+ index = parser->document->nodes.top - parser->document->nodes.start;
+
+ if (!yaml_parser_register_anchor(parser, index,
+ first_event->data.sequence_start.anchor)) return 0;
+
+ if (!yaml_parser_parse(parser, &event)) return 0;
+
+ while (event.type != YAML_SEQUENCE_END_EVENT) {
+ item_index = yaml_parser_load_node(parser, &event);
+ if (!item_index) return 0;
+ if (!PUSH(parser,
+ parser->document->nodes.start[index-1].data.sequence.items,
+ item_index)) return 0;
+ if (!yaml_parser_parse(parser, &event)) return 0;
+ }
+
+ parser->document->nodes.start[index-1].end_mark = event.end_mark;
+
+ return index;
+
+error:
+ yaml_free(tag);
+ yaml_free(first_event->data.sequence_start.anchor);
+ return 0;
+}
+
+/*
+ * Compose a mapping node.
+ */
+
+static int
+yaml_parser_load_mapping(yaml_parser_t *parser, yaml_event_t *first_event)
+{
+ yaml_event_t event;
+ yaml_node_t node;
+ struct {
+ yaml_node_pair_t *start;
+ yaml_node_pair_t *end;
+ yaml_node_pair_t *top;
+ } pairs = { NULL, NULL, NULL };
+ int index;
+ yaml_node_pair_t pair;
+ yaml_char_t *tag = first_event->data.mapping_start.tag;
+
+ if (!tag || strcmp((char *)tag, "!") == 0) {
+ yaml_free(tag);
+ tag = yaml_strdup((yaml_char_t *)YAML_DEFAULT_MAPPING_TAG);
+ if (!tag) goto error;
+ }
+
+ if (!STACK_INIT(parser, pairs, INITIAL_STACK_SIZE)) goto error;
+
+ MAPPING_NODE_INIT(node, tag, pairs.start, pairs.end,
+ first_event->data.mapping_start.style,
+ first_event->start_mark, first_event->end_mark);
+
+ if (!PUSH(parser, parser->document->nodes, node)) goto error;
+
+ index = parser->document->nodes.top - parser->document->nodes.start;
+
+ if (!yaml_parser_register_anchor(parser, index,
+ first_event->data.mapping_start.anchor)) return 0;
+
+ if (!yaml_parser_parse(parser, &event)) return 0;
+
+ while (event.type != YAML_MAPPING_END_EVENT) {
+ pair.key = yaml_parser_load_node(parser, &event);
+ if (!pair.key) return 0;
+ if (!yaml_parser_parse(parser, &event)) return 0;
+ pair.value = yaml_parser_load_node(parser, &event);
+ if (!pair.value) return 0;
+ if (!PUSH(parser,
+ parser->document->nodes.start[index-1].data.mapping.pairs,
+ pair)) return 0;
+ if (!yaml_parser_parse(parser, &event)) return 0;
+ }
+
+ parser->document->nodes.start[index-1].end_mark = event.end_mark;
+
+ return index;
+
+error:
+ yaml_free(tag);
+ yaml_free(first_event->data.mapping_start.anchor);
+ return 0;
+}
+
diff --git a/ext/psych/yaml/parser.c b/ext/psych/yaml/parser.c
new file mode 100644
index 0000000000..dc5430b09f
--- /dev/null
+++ b/ext/psych/yaml/parser.c
@@ -0,0 +1,1374 @@
+
+/*
+ * The parser implements the following grammar:
+ *
+ * stream ::= STREAM-START implicit_document? explicit_document* STREAM-END
+ * implicit_document ::= block_node DOCUMENT-END*
+ * explicit_document ::= DIRECTIVE* DOCUMENT-START block_node? DOCUMENT-END*
+ * block_node_or_indentless_sequence ::=
+ * ALIAS
+ * | properties (block_content | indentless_block_sequence)?
+ * | block_content
+ * | indentless_block_sequence
+ * block_node ::= ALIAS
+ * | properties block_content?
+ * | block_content
+ * flow_node ::= ALIAS
+ * | properties flow_content?
+ * | flow_content
+ * properties ::= TAG ANCHOR? | ANCHOR TAG?
+ * block_content ::= block_collection | flow_collection | SCALAR
+ * flow_content ::= flow_collection | SCALAR
+ * block_collection ::= block_sequence | block_mapping
+ * flow_collection ::= flow_sequence | flow_mapping
+ * block_sequence ::= BLOCK-SEQUENCE-START (BLOCK-ENTRY block_node?)* BLOCK-END
+ * indentless_sequence ::= (BLOCK-ENTRY block_node?)+
+ * block_mapping ::= BLOCK-MAPPING_START
+ * ((KEY block_node_or_indentless_sequence?)?
+ * (VALUE block_node_or_indentless_sequence?)?)*
+ * BLOCK-END
+ * flow_sequence ::= FLOW-SEQUENCE-START
+ * (flow_sequence_entry FLOW-ENTRY)*
+ * flow_sequence_entry?
+ * FLOW-SEQUENCE-END
+ * flow_sequence_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)?
+ * flow_mapping ::= FLOW-MAPPING-START
+ * (flow_mapping_entry FLOW-ENTRY)*
+ * flow_mapping_entry?
+ * FLOW-MAPPING-END
+ * flow_mapping_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)?
+ */
+
+#include "yaml_private.h"
+
+/*
+ * Peek the next token in the token queue.
+ */
+
+#define PEEK_TOKEN(parser) \
+ ((parser->token_available || yaml_parser_fetch_more_tokens(parser)) ? \
+ parser->tokens.head : NULL)
+
+/*
+ * Remove the next token from the queue (must be called after PEEK_TOKEN).
+ */
+
+#define SKIP_TOKEN(parser) \
+ (parser->token_available = 0, \
+ parser->tokens_parsed ++, \
+ parser->stream_end_produced = \
+ (parser->tokens.head->type == YAML_STREAM_END_TOKEN), \
+ parser->tokens.head ++)
+
+/*
+ * Public API declarations.
+ */
+
+YAML_DECLARE(int)
+yaml_parser_parse(yaml_parser_t *parser, yaml_event_t *event);
+
+/*
+ * Error handling.
+ */
+
+static int
+yaml_parser_set_parser_error(yaml_parser_t *parser,
+ const char *problem, yaml_mark_t problem_mark);
+
+static int
+yaml_parser_set_parser_error_context(yaml_parser_t *parser,
+ const char *context, yaml_mark_t context_mark,
+ const char *problem, yaml_mark_t problem_mark);
+
+/*
+ * State functions.
+ */
+
+static int
+yaml_parser_state_machine(yaml_parser_t *parser, yaml_event_t *event);
+
+static int
+yaml_parser_parse_stream_start(yaml_parser_t *parser, yaml_event_t *event);
+
+static int
+yaml_parser_parse_document_start(yaml_parser_t *parser, yaml_event_t *event,
+ int implicit);
+
+static int
+yaml_parser_parse_document_content(yaml_parser_t *parser, yaml_event_t *event);
+
+static int
+yaml_parser_parse_document_end(yaml_parser_t *parser, yaml_event_t *event);
+
+static int
+yaml_parser_parse_node(yaml_parser_t *parser, yaml_event_t *event,
+ int block, int indentless_sequence);
+
+static int
+yaml_parser_parse_block_sequence_entry(yaml_parser_t *parser,
+ yaml_event_t *event, int first);
+
+static int
+yaml_parser_parse_indentless_sequence_entry(yaml_parser_t *parser,
+ yaml_event_t *event);
+
+static int
+yaml_parser_parse_block_mapping_key(yaml_parser_t *parser,
+ yaml_event_t *event, int first);
+
+static int
+yaml_parser_parse_block_mapping_value(yaml_parser_t *parser,
+ yaml_event_t *event);
+
+static int
+yaml_parser_parse_flow_sequence_entry(yaml_parser_t *parser,
+ yaml_event_t *event, int first);
+
+static int
+yaml_parser_parse_flow_sequence_entry_mapping_key(yaml_parser_t *parser,
+ yaml_event_t *event);
+
+static int
+yaml_parser_parse_flow_sequence_entry_mapping_value(yaml_parser_t *parser,
+ yaml_event_t *event);
+
+static int
+yaml_parser_parse_flow_sequence_entry_mapping_end(yaml_parser_t *parser,
+ yaml_event_t *event);
+
+static int
+yaml_parser_parse_flow_mapping_key(yaml_parser_t *parser,
+ yaml_event_t *event, int first);
+
+static int
+yaml_parser_parse_flow_mapping_value(yaml_parser_t *parser,
+ yaml_event_t *event, int empty);
+
+/*
+ * Utility functions.
+ */
+
+static int
+yaml_parser_process_empty_scalar(yaml_parser_t *parser,
+ yaml_event_t *event, yaml_mark_t mark);
+
+static int
+yaml_parser_process_directives(yaml_parser_t *parser,
+ yaml_version_directive_t **version_directive_ref,
+ yaml_tag_directive_t **tag_directives_start_ref,
+ yaml_tag_directive_t **tag_directives_end_ref);
+
+static int
+yaml_parser_append_tag_directive(yaml_parser_t *parser,
+ yaml_tag_directive_t value, int allow_duplicates, yaml_mark_t mark);
+
+/*
+ * Get the next event.
+ */
+
+YAML_DECLARE(int)
+yaml_parser_parse(yaml_parser_t *parser, yaml_event_t *event)
+{
+ assert(parser); /* Non-NULL parser object is expected. */
+ assert(event); /* Non-NULL event object is expected. */
+
+ /* Erase the event object. */
+
+ memset(event, 0, sizeof(yaml_event_t));
+
+ /* No events after the end of the stream or error. */
+
+ if (parser->stream_end_produced || parser->error ||
+ parser->state == YAML_PARSE_END_STATE) {
+ return 1;
+ }
+
+ /* Generate the next event. */
+
+ return yaml_parser_state_machine(parser, event);
+}
+
+/*
+ * Set parser error.
+ */
+
+static int
+yaml_parser_set_parser_error(yaml_parser_t *parser,
+ const char *problem, yaml_mark_t problem_mark)
+{
+ parser->error = YAML_PARSER_ERROR;
+ parser->problem = problem;
+ parser->problem_mark = problem_mark;
+
+ return 0;
+}
+
+static int
+yaml_parser_set_parser_error_context(yaml_parser_t *parser,
+ const char *context, yaml_mark_t context_mark,
+ const char *problem, yaml_mark_t problem_mark)
+{
+ parser->error = YAML_PARSER_ERROR;
+ parser->context = context;
+ parser->context_mark = context_mark;
+ parser->problem = problem;
+ parser->problem_mark = problem_mark;
+
+ return 0;
+}
+
+
+/*
+ * State dispatcher.
+ */
+
+static int
+yaml_parser_state_machine(yaml_parser_t *parser, yaml_event_t *event)
+{
+ switch (parser->state)
+ {
+ case YAML_PARSE_STREAM_START_STATE:
+ return yaml_parser_parse_stream_start(parser, event);
+
+ case YAML_PARSE_IMPLICIT_DOCUMENT_START_STATE:
+ return yaml_parser_parse_document_start(parser, event, 1);
+
+ case YAML_PARSE_DOCUMENT_START_STATE:
+ return yaml_parser_parse_document_start(parser, event, 0);
+
+ case YAML_PARSE_DOCUMENT_CONTENT_STATE:
+ return yaml_parser_parse_document_content(parser, event);
+
+ case YAML_PARSE_DOCUMENT_END_STATE:
+ return yaml_parser_parse_document_end(parser, event);
+
+ case YAML_PARSE_BLOCK_NODE_STATE:
+ return yaml_parser_parse_node(parser, event, 1, 0);
+
+ case YAML_PARSE_BLOCK_NODE_OR_INDENTLESS_SEQUENCE_STATE:
+ return yaml_parser_parse_node(parser, event, 1, 1);
+
+ case YAML_PARSE_FLOW_NODE_STATE:
+ return yaml_parser_parse_node(parser, event, 0, 0);
+
+ case YAML_PARSE_BLOCK_SEQUENCE_FIRST_ENTRY_STATE:
+ return yaml_parser_parse_block_sequence_entry(parser, event, 1);
+
+ case YAML_PARSE_BLOCK_SEQUENCE_ENTRY_STATE:
+ return yaml_parser_parse_block_sequence_entry(parser, event, 0);
+
+ case YAML_PARSE_INDENTLESS_SEQUENCE_ENTRY_STATE:
+ return yaml_parser_parse_indentless_sequence_entry(parser, event);
+
+ case YAML_PARSE_BLOCK_MAPPING_FIRST_KEY_STATE:
+ return yaml_parser_parse_block_mapping_key(parser, event, 1);
+
+ case YAML_PARSE_BLOCK_MAPPING_KEY_STATE:
+ return yaml_parser_parse_block_mapping_key(parser, event, 0);
+
+ case YAML_PARSE_BLOCK_MAPPING_VALUE_STATE:
+ return yaml_parser_parse_block_mapping_value(parser, event);
+
+ case YAML_PARSE_FLOW_SEQUENCE_FIRST_ENTRY_STATE:
+ return yaml_parser_parse_flow_sequence_entry(parser, event, 1);
+
+ case YAML_PARSE_FLOW_SEQUENCE_ENTRY_STATE:
+ return yaml_parser_parse_flow_sequence_entry(parser, event, 0);
+
+ case YAML_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_KEY_STATE:
+ return yaml_parser_parse_flow_sequence_entry_mapping_key(parser, event);
+
+ case YAML_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_VALUE_STATE:
+ return yaml_parser_parse_flow_sequence_entry_mapping_value(parser, event);
+
+ case YAML_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_END_STATE:
+ return yaml_parser_parse_flow_sequence_entry_mapping_end(parser, event);
+
+ case YAML_PARSE_FLOW_MAPPING_FIRST_KEY_STATE:
+ return yaml_parser_parse_flow_mapping_key(parser, event, 1);
+
+ case YAML_PARSE_FLOW_MAPPING_KEY_STATE:
+ return yaml_parser_parse_flow_mapping_key(parser, event, 0);
+
+ case YAML_PARSE_FLOW_MAPPING_VALUE_STATE:
+ return yaml_parser_parse_flow_mapping_value(parser, event, 0);
+
+ case YAML_PARSE_FLOW_MAPPING_EMPTY_VALUE_STATE:
+ return yaml_parser_parse_flow_mapping_value(parser, event, 1);
+
+ default:
+ assert(1); /* Invalid state. */
+ }
+
+ return 0;
+}
+
+/*
+ * Parse the production:
+ * stream ::= STREAM-START implicit_document? explicit_document* STREAM-END
+ * ************
+ */
+
+static int
+yaml_parser_parse_stream_start(yaml_parser_t *parser, yaml_event_t *event)
+{
+ yaml_token_t *token;
+
+ token = PEEK_TOKEN(parser);
+ if (!token) return 0;
+
+ if (token->type != YAML_STREAM_START_TOKEN) {
+ return yaml_parser_set_parser_error(parser,
+ "did not find expected <stream-start>", token->start_mark);
+ }
+
+ parser->state = YAML_PARSE_IMPLICIT_DOCUMENT_START_STATE;
+ STREAM_START_EVENT_INIT(*event, token->data.stream_start.encoding,
+ token->start_mark, token->start_mark);
+ SKIP_TOKEN(parser);
+
+ return 1;
+}
+
+/*
+ * Parse the productions:
+ * implicit_document ::= block_node DOCUMENT-END*
+ * *
+ * explicit_document ::= DIRECTIVE* DOCUMENT-START block_node? DOCUMENT-END*
+ * *************************
+ */
+
+static int
+yaml_parser_parse_document_start(yaml_parser_t *parser, yaml_event_t *event,
+ int implicit)
+{
+ yaml_token_t *token;
+ yaml_version_directive_t *version_directive = NULL;
+ struct {
+ yaml_tag_directive_t *start;
+ yaml_tag_directive_t *end;
+ } tag_directives = { NULL, NULL };
+
+ token = PEEK_TOKEN(parser);
+ if (!token) return 0;
+
+ /* Parse extra document end indicators. */
+
+ if (!implicit)
+ {
+ while (token->type == YAML_DOCUMENT_END_TOKEN) {
+ SKIP_TOKEN(parser);
+ token = PEEK_TOKEN(parser);
+ if (!token) return 0;
+ }
+ }
+
+ /* Parse an implicit document. */
+
+ if (implicit && token->type != YAML_VERSION_DIRECTIVE_TOKEN &&
+ token->type != YAML_TAG_DIRECTIVE_TOKEN &&
+ token->type != YAML_DOCUMENT_START_TOKEN &&
+ token->type != YAML_STREAM_END_TOKEN)
+ {
+ if (!yaml_parser_process_directives(parser, NULL, NULL, NULL))
+ return 0;
+ if (!PUSH(parser, parser->states, YAML_PARSE_DOCUMENT_END_STATE))
+ return 0;
+ parser->state = YAML_PARSE_BLOCK_NODE_STATE;
+ DOCUMENT_START_EVENT_INIT(*event, NULL, NULL, NULL, 1,
+ token->start_mark, token->start_mark);
+ return 1;
+ }
+
+ /* Parse an explicit document. */
+
+ else if (token->type != YAML_STREAM_END_TOKEN)
+ {
+ yaml_mark_t start_mark, end_mark;
+ start_mark = token->start_mark;
+ if (!yaml_parser_process_directives(parser, &version_directive,
+ &tag_directives.start, &tag_directives.end))
+ return 0;
+ token = PEEK_TOKEN(parser);
+ if (!token) goto error;
+ if (token->type != YAML_DOCUMENT_START_TOKEN) {
+ yaml_parser_set_parser_error(parser,
+ "did not find expected <document start>", token->start_mark);
+ goto error;
+ }
+ if (!PUSH(parser, parser->states, YAML_PARSE_DOCUMENT_END_STATE))
+ goto error;
+ parser->state = YAML_PARSE_DOCUMENT_CONTENT_STATE;
+ end_mark = token->end_mark;
+ DOCUMENT_START_EVENT_INIT(*event, version_directive,
+ tag_directives.start, tag_directives.end, 0,
+ start_mark, end_mark);
+ SKIP_TOKEN(parser);
+ version_directive = NULL;
+ tag_directives.start = tag_directives.end = NULL;
+ return 1;
+ }
+
+ /* Parse the stream end. */
+
+ else
+ {
+ parser->state = YAML_PARSE_END_STATE;
+ STREAM_END_EVENT_INIT(*event, token->start_mark, token->end_mark);
+ SKIP_TOKEN(parser);
+ return 1;
+ }
+
+error:
+ yaml_free(version_directive);
+ while (tag_directives.start != tag_directives.end) {
+ yaml_free(tag_directives.end[-1].handle);
+ yaml_free(tag_directives.end[-1].prefix);
+ tag_directives.end --;
+ }
+ yaml_free(tag_directives.start);
+ return 0;
+}
+
+/*
+ * Parse the productions:
+ * explicit_document ::= DIRECTIVE* DOCUMENT-START block_node? DOCUMENT-END*
+ * ***********
+ */
+
+static int
+yaml_parser_parse_document_content(yaml_parser_t *parser, yaml_event_t *event)
+{
+ yaml_token_t *token;
+
+ token = PEEK_TOKEN(parser);
+ if (!token) return 0;
+
+ if (token->type == YAML_VERSION_DIRECTIVE_TOKEN ||
+ token->type == YAML_TAG_DIRECTIVE_TOKEN ||
+ token->type == YAML_DOCUMENT_START_TOKEN ||
+ token->type == YAML_DOCUMENT_END_TOKEN ||
+ token->type == YAML_STREAM_END_TOKEN) {
+ parser->state = POP(parser, parser->states);
+ return yaml_parser_process_empty_scalar(parser, event,
+ token->start_mark);
+ }
+ else {
+ return yaml_parser_parse_node(parser, event, 1, 0);
+ }
+}
+
+/*
+ * Parse the productions:
+ * implicit_document ::= block_node DOCUMENT-END*
+ * *************
+ * explicit_document ::= DIRECTIVE* DOCUMENT-START block_node? DOCUMENT-END*
+ * *************
+ */
+
+static int
+yaml_parser_parse_document_end(yaml_parser_t *parser, yaml_event_t *event)
+{
+ yaml_token_t *token;
+ yaml_mark_t start_mark, end_mark;
+ int implicit = 1;
+
+ token = PEEK_TOKEN(parser);
+ if (!token) return 0;
+
+ start_mark = end_mark = token->start_mark;
+
+ if (token->type == YAML_DOCUMENT_END_TOKEN) {
+ end_mark = token->end_mark;
+ SKIP_TOKEN(parser);
+ implicit = 0;
+ }
+
+ while (!STACK_EMPTY(parser, parser->tag_directives)) {
+ yaml_tag_directive_t tag_directive = POP(parser, parser->tag_directives);
+ yaml_free(tag_directive.handle);
+ yaml_free(tag_directive.prefix);
+ }
+
+ parser->state = YAML_PARSE_DOCUMENT_START_STATE;
+ DOCUMENT_END_EVENT_INIT(*event, implicit, start_mark, end_mark);
+
+ return 1;
+}
+
+/*
+ * Parse the productions:
+ * block_node_or_indentless_sequence ::=
+ * ALIAS
+ * *****
+ * | properties (block_content | indentless_block_sequence)?
+ * ********** *
+ * | block_content | indentless_block_sequence
+ * *
+ * block_node ::= ALIAS
+ * *****
+ * | properties block_content?
+ * ********** *
+ * | block_content
+ * *
+ * flow_node ::= ALIAS
+ * *****
+ * | properties flow_content?
+ * ********** *
+ * | flow_content
+ * *
+ * properties ::= TAG ANCHOR? | ANCHOR TAG?
+ * *************************
+ * block_content ::= block_collection | flow_collection | SCALAR
+ * ******
+ * flow_content ::= flow_collection | SCALAR
+ * ******
+ */
+
+static int
+yaml_parser_parse_node(yaml_parser_t *parser, yaml_event_t *event,
+ int block, int indentless_sequence)
+{
+ yaml_token_t *token;
+ yaml_char_t *anchor = NULL;
+ yaml_char_t *tag_handle = NULL;
+ yaml_char_t *tag_suffix = NULL;
+ yaml_char_t *tag = NULL;
+ yaml_mark_t start_mark, end_mark, tag_mark;
+ int implicit;
+
+ token = PEEK_TOKEN(parser);
+ if (!token) return 0;
+
+ if (token->type == YAML_ALIAS_TOKEN)
+ {
+ parser->state = POP(parser, parser->states);
+ ALIAS_EVENT_INIT(*event, token->data.alias.value,
+ token->start_mark, token->end_mark);
+ SKIP_TOKEN(parser);
+ return 1;
+ }
+
+ else
+ {
+ start_mark = end_mark = token->start_mark;
+
+ if (token->type == YAML_ANCHOR_TOKEN)
+ {
+ anchor = token->data.anchor.value;
+ start_mark = token->start_mark;
+ end_mark = token->end_mark;
+ SKIP_TOKEN(parser);
+ token = PEEK_TOKEN(parser);
+ if (!token) goto error;
+ if (token->type == YAML_TAG_TOKEN)
+ {
+ tag_handle = token->data.tag.handle;
+ tag_suffix = token->data.tag.suffix;
+ tag_mark = token->start_mark;
+ end_mark = token->end_mark;
+ SKIP_TOKEN(parser);
+ token = PEEK_TOKEN(parser);
+ if (!token) goto error;
+ }
+ }
+ else if (token->type == YAML_TAG_TOKEN)
+ {
+ tag_handle = token->data.tag.handle;
+ tag_suffix = token->data.tag.suffix;
+ start_mark = tag_mark = token->start_mark;
+ end_mark = token->end_mark;
+ SKIP_TOKEN(parser);
+ token = PEEK_TOKEN(parser);
+ if (!token) goto error;
+ if (token->type == YAML_ANCHOR_TOKEN)
+ {
+ anchor = token->data.anchor.value;
+ end_mark = token->end_mark;
+ SKIP_TOKEN(parser);
+ token = PEEK_TOKEN(parser);
+ if (!token) goto error;
+ }
+ }
+
+ if (tag_handle) {
+ if (!*tag_handle) {
+ tag = tag_suffix;
+ yaml_free(tag_handle);
+ tag_handle = tag_suffix = NULL;
+ }
+ else {
+ yaml_tag_directive_t *tag_directive;
+ for (tag_directive = parser->tag_directives.start;
+ tag_directive != parser->tag_directives.top;
+ tag_directive ++) {
+ if (strcmp((char *)tag_directive->handle, (char *)tag_handle) == 0) {
+ size_t prefix_len = strlen((char *)tag_directive->prefix);
+ size_t suffix_len = strlen((char *)tag_suffix);
+ tag = yaml_malloc(prefix_len+suffix_len+1);
+ if (!tag) {
+ parser->error = YAML_MEMORY_ERROR;
+ goto error;
+ }
+ memcpy(tag, tag_directive->prefix, prefix_len);
+ memcpy(tag+prefix_len, tag_suffix, suffix_len);
+ tag[prefix_len+suffix_len] = '\0';
+ yaml_free(tag_handle);
+ yaml_free(tag_suffix);
+ tag_handle = tag_suffix = NULL;
+ break;
+ }
+ }
+ if (!tag) {
+ yaml_parser_set_parser_error_context(parser,
+ "while parsing a node", start_mark,
+ "found undefined tag handle", tag_mark);
+ goto error;
+ }
+ }
+ }
+
+ implicit = (!tag || !*tag);
+ if (indentless_sequence && token->type == YAML_BLOCK_ENTRY_TOKEN) {
+ end_mark = token->end_mark;
+ parser->state = YAML_PARSE_INDENTLESS_SEQUENCE_ENTRY_STATE;
+ SEQUENCE_START_EVENT_INIT(*event, anchor, tag, implicit,
+ YAML_BLOCK_SEQUENCE_STYLE, start_mark, end_mark);
+ return 1;
+ }
+ else {
+ if (token->type == YAML_SCALAR_TOKEN) {
+ int plain_implicit = 0;
+ int quoted_implicit = 0;
+ end_mark = token->end_mark;
+ if ((token->data.scalar.style == YAML_PLAIN_SCALAR_STYLE && !tag)
+ || (tag && strcmp((char *)tag, "!") == 0)) {
+ plain_implicit = 1;
+ }
+ else if (!tag) {
+ quoted_implicit = 1;
+ }
+ parser->state = POP(parser, parser->states);
+ SCALAR_EVENT_INIT(*event, anchor, tag,
+ token->data.scalar.value, token->data.scalar.length,
+ plain_implicit, quoted_implicit,
+ token->data.scalar.style, start_mark, end_mark);
+ SKIP_TOKEN(parser);
+ return 1;
+ }
+ else if (token->type == YAML_FLOW_SEQUENCE_START_TOKEN) {
+ end_mark = token->end_mark;
+ parser->state = YAML_PARSE_FLOW_SEQUENCE_FIRST_ENTRY_STATE;
+ SEQUENCE_START_EVENT_INIT(*event, anchor, tag, implicit,
+ YAML_FLOW_SEQUENCE_STYLE, start_mark, end_mark);
+ return 1;
+ }
+ else if (token->type == YAML_FLOW_MAPPING_START_TOKEN) {
+ end_mark = token->end_mark;
+ parser->state = YAML_PARSE_FLOW_MAPPING_FIRST_KEY_STATE;
+ MAPPING_START_EVENT_INIT(*event, anchor, tag, implicit,
+ YAML_FLOW_MAPPING_STYLE, start_mark, end_mark);
+ return 1;
+ }
+ else if (block && token->type == YAML_BLOCK_SEQUENCE_START_TOKEN) {
+ end_mark = token->end_mark;
+ parser->state = YAML_PARSE_BLOCK_SEQUENCE_FIRST_ENTRY_STATE;
+ SEQUENCE_START_EVENT_INIT(*event, anchor, tag, implicit,
+ YAML_BLOCK_SEQUENCE_STYLE, start_mark, end_mark);
+ return 1;
+ }
+ else if (block && token->type == YAML_BLOCK_MAPPING_START_TOKEN) {
+ end_mark = token->end_mark;
+ parser->state = YAML_PARSE_BLOCK_MAPPING_FIRST_KEY_STATE;
+ MAPPING_START_EVENT_INIT(*event, anchor, tag, implicit,
+ YAML_BLOCK_MAPPING_STYLE, start_mark, end_mark);
+ return 1;
+ }
+ else if (anchor || tag) {
+ yaml_char_t *value = yaml_malloc(1);
+ if (!value) {
+ parser->error = YAML_MEMORY_ERROR;
+ goto error;
+ }
+ value[0] = '\0';
+ parser->state = POP(parser, parser->states);
+ SCALAR_EVENT_INIT(*event, anchor, tag, value, 0,
+ implicit, 0, YAML_PLAIN_SCALAR_STYLE,
+ start_mark, end_mark);
+ return 1;
+ }
+ else {
+ yaml_parser_set_parser_error_context(parser,
+ (block ? "while parsing a block node"
+ : "while parsing a flow node"), start_mark,
+ "did not find expected node content", token->start_mark);
+ goto error;
+ }
+ }
+ }
+
+error:
+ yaml_free(anchor);
+ yaml_free(tag_handle);
+ yaml_free(tag_suffix);
+ yaml_free(tag);
+
+ return 0;
+}
+
+/*
+ * Parse the productions:
+ * block_sequence ::= BLOCK-SEQUENCE-START (BLOCK-ENTRY block_node?)* BLOCK-END
+ * ******************** *********** * *********
+ */
+
+static int
+yaml_parser_parse_block_sequence_entry(yaml_parser_t *parser,
+ yaml_event_t *event, int first)
+{
+ yaml_token_t *token;
+
+ if (first) {
+ token = PEEK_TOKEN(parser);
+ if (!PUSH(parser, parser->marks, token->start_mark))
+ return 0;
+ SKIP_TOKEN(parser);
+ }
+
+ token = PEEK_TOKEN(parser);
+ if (!token) return 0;
+
+ if (token->type == YAML_BLOCK_ENTRY_TOKEN)
+ {
+ yaml_mark_t mark = token->end_mark;
+ SKIP_TOKEN(parser);
+ token = PEEK_TOKEN(parser);
+ if (!token) return 0;
+ if (token->type != YAML_BLOCK_ENTRY_TOKEN &&
+ token->type != YAML_BLOCK_END_TOKEN) {
+ if (!PUSH(parser, parser->states,
+ YAML_PARSE_BLOCK_SEQUENCE_ENTRY_STATE))
+ return 0;
+ return yaml_parser_parse_node(parser, event, 1, 0);
+ }
+ else {
+ parser->state = YAML_PARSE_BLOCK_SEQUENCE_ENTRY_STATE;
+ return yaml_parser_process_empty_scalar(parser, event, mark);
+ }
+ }
+
+ 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);
+ SEQUENCE_END_EVENT_INIT(*event, token->start_mark, token->end_mark);
+ SKIP_TOKEN(parser);
+ return 1;
+ }
+
+ else
+ {
+ return yaml_parser_set_parser_error_context(parser,
+ "while parsing a block collection", POP(parser, parser->marks),
+ "did not find expected '-' indicator", token->start_mark);
+ }
+}
+
+/*
+ * Parse the productions:
+ * indentless_sequence ::= (BLOCK-ENTRY block_node?)+
+ * *********** *
+ */
+
+static int
+yaml_parser_parse_indentless_sequence_entry(yaml_parser_t *parser,
+ yaml_event_t *event)
+{
+ yaml_token_t *token;
+
+ token = PEEK_TOKEN(parser);
+ if (!token) return 0;
+
+ if (token->type == YAML_BLOCK_ENTRY_TOKEN)
+ {
+ yaml_mark_t mark = token->end_mark;
+ SKIP_TOKEN(parser);
+ token = PEEK_TOKEN(parser);
+ if (!token) return 0;
+ if (token->type != YAML_BLOCK_ENTRY_TOKEN &&
+ token->type != YAML_KEY_TOKEN &&
+ token->type != YAML_VALUE_TOKEN &&
+ token->type != YAML_BLOCK_END_TOKEN) {
+ if (!PUSH(parser, parser->states,
+ YAML_PARSE_INDENTLESS_SEQUENCE_ENTRY_STATE))
+ return 0;
+ return yaml_parser_parse_node(parser, event, 1, 0);
+ }
+ else {
+ parser->state = YAML_PARSE_INDENTLESS_SEQUENCE_ENTRY_STATE;
+ return yaml_parser_process_empty_scalar(parser, event, mark);
+ }
+ }
+
+ else
+ {
+ parser->state = POP(parser, parser->states);
+ SEQUENCE_END_EVENT_INIT(*event, token->start_mark, token->start_mark);
+ return 1;
+ }
+}
+
+/*
+ * Parse the productions:
+ * block_mapping ::= BLOCK-MAPPING_START
+ * *******************
+ * ((KEY block_node_or_indentless_sequence?)?
+ * *** *
+ * (VALUE block_node_or_indentless_sequence?)?)*
+ *
+ * BLOCK-END
+ * *********
+ */
+
+static int
+yaml_parser_parse_block_mapping_key(yaml_parser_t *parser,
+ yaml_event_t *event, int first)
+{
+ yaml_token_t *token;
+
+ if (first) {
+ token = PEEK_TOKEN(parser);
+ if (!PUSH(parser, parser->marks, token->start_mark))
+ return 0;
+ SKIP_TOKEN(parser);
+ }
+
+ token = PEEK_TOKEN(parser);
+ if (!token) return 0;
+
+ if (token->type == YAML_KEY_TOKEN)
+ {
+ yaml_mark_t mark = token->end_mark;
+ SKIP_TOKEN(parser);
+ token = PEEK_TOKEN(parser);
+ if (!token) return 0;
+ if (token->type != YAML_KEY_TOKEN &&
+ token->type != YAML_VALUE_TOKEN &&
+ token->type != YAML_BLOCK_END_TOKEN) {
+ if (!PUSH(parser, parser->states,
+ YAML_PARSE_BLOCK_MAPPING_VALUE_STATE))
+ return 0;
+ return yaml_parser_parse_node(parser, event, 1, 1);
+ }
+ else {
+ parser->state = YAML_PARSE_BLOCK_MAPPING_VALUE_STATE;
+ return yaml_parser_process_empty_scalar(parser, event, mark);
+ }
+ }
+
+ 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);
+ MAPPING_END_EVENT_INIT(*event, token->start_mark, token->end_mark);
+ SKIP_TOKEN(parser);
+ return 1;
+ }
+
+ else
+ {
+ return yaml_parser_set_parser_error_context(parser,
+ "while parsing a block mapping", POP(parser, parser->marks),
+ "did not find expected key", token->start_mark);
+ }
+}
+
+/*
+ * Parse the productions:
+ * block_mapping ::= BLOCK-MAPPING_START
+ *
+ * ((KEY block_node_or_indentless_sequence?)?
+ *
+ * (VALUE block_node_or_indentless_sequence?)?)*
+ * ***** *
+ * BLOCK-END
+ *
+ */
+
+static int
+yaml_parser_parse_block_mapping_value(yaml_parser_t *parser,
+ yaml_event_t *event)
+{
+ yaml_token_t *token;
+
+ token = PEEK_TOKEN(parser);
+ if (!token) return 0;
+
+ if (token->type == YAML_VALUE_TOKEN)
+ {
+ yaml_mark_t mark = token->end_mark;
+ SKIP_TOKEN(parser);
+ token = PEEK_TOKEN(parser);
+ if (!token) return 0;
+ if (token->type != YAML_KEY_TOKEN &&
+ token->type != YAML_VALUE_TOKEN &&
+ token->type != YAML_BLOCK_END_TOKEN) {
+ if (!PUSH(parser, parser->states,
+ YAML_PARSE_BLOCK_MAPPING_KEY_STATE))
+ return 0;
+ return yaml_parser_parse_node(parser, event, 1, 1);
+ }
+ else {
+ parser->state = YAML_PARSE_BLOCK_MAPPING_KEY_STATE;
+ return yaml_parser_process_empty_scalar(parser, event, mark);
+ }
+ }
+
+ else
+ {
+ parser->state = YAML_PARSE_BLOCK_MAPPING_KEY_STATE;
+ return yaml_parser_process_empty_scalar(parser, event, token->start_mark);
+ }
+}
+
+/*
+ * Parse the productions:
+ * flow_sequence ::= FLOW-SEQUENCE-START
+ * *******************
+ * (flow_sequence_entry FLOW-ENTRY)*
+ * * **********
+ * flow_sequence_entry?
+ * *
+ * FLOW-SEQUENCE-END
+ * *****************
+ * flow_sequence_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)?
+ * *
+ */
+
+static int
+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);
+ if (!PUSH(parser, parser->marks, token->start_mark))
+ return 0;
+ SKIP_TOKEN(parser);
+ }
+
+ token = PEEK_TOKEN(parser);
+ if (!token) return 0;
+
+ if (token->type != YAML_FLOW_SEQUENCE_END_TOKEN)
+ {
+ if (!first) {
+ if (token->type == YAML_FLOW_ENTRY_TOKEN) {
+ SKIP_TOKEN(parser);
+ token = PEEK_TOKEN(parser);
+ if (!token) return 0;
+ }
+ else {
+ return yaml_parser_set_parser_error_context(parser,
+ "while parsing a flow sequence", POP(parser, parser->marks),
+ "did not find expected ',' or ']'", token->start_mark);
+ }
+ }
+
+ if (token->type == YAML_KEY_TOKEN) {
+ parser->state = YAML_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_KEY_STATE;
+ MAPPING_START_EVENT_INIT(*event, NULL, NULL,
+ 1, YAML_FLOW_MAPPING_STYLE,
+ token->start_mark, token->end_mark);
+ SKIP_TOKEN(parser);
+ return 1;
+ }
+
+ else if (token->type != YAML_FLOW_SEQUENCE_END_TOKEN) {
+ if (!PUSH(parser, parser->states,
+ YAML_PARSE_FLOW_SEQUENCE_ENTRY_STATE))
+ return 0;
+ return yaml_parser_parse_node(parser, event, 0, 0);
+ }
+ }
+
+ parser->state = POP(parser, parser->states);
+ dummy_mark = POP(parser, parser->marks);
+ SEQUENCE_END_EVENT_INIT(*event, token->start_mark, token->end_mark);
+ SKIP_TOKEN(parser);
+ return 1;
+}
+
+/*
+ * Parse the productions:
+ * flow_sequence_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)?
+ * *** *
+ */
+
+static int
+yaml_parser_parse_flow_sequence_entry_mapping_key(yaml_parser_t *parser,
+ yaml_event_t *event)
+{
+ yaml_token_t *token;
+
+ token = PEEK_TOKEN(parser);
+ if (!token) return 0;
+
+ if (token->type != YAML_VALUE_TOKEN && token->type != YAML_FLOW_ENTRY_TOKEN
+ && token->type != YAML_FLOW_SEQUENCE_END_TOKEN) {
+ if (!PUSH(parser, parser->states,
+ YAML_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_VALUE_STATE))
+ return 0;
+ return yaml_parser_parse_node(parser, event, 0, 0);
+ }
+ else {
+ yaml_mark_t mark = token->end_mark;
+ SKIP_TOKEN(parser);
+ parser->state = YAML_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_VALUE_STATE;
+ return yaml_parser_process_empty_scalar(parser, event, mark);
+ }
+}
+
+/*
+ * Parse the productions:
+ * flow_sequence_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)?
+ * ***** *
+ */
+
+static int
+yaml_parser_parse_flow_sequence_entry_mapping_value(yaml_parser_t *parser,
+ yaml_event_t *event)
+{
+ yaml_token_t *token;
+
+ token = PEEK_TOKEN(parser);
+ if (!token) return 0;
+
+ if (token->type == YAML_VALUE_TOKEN) {
+ SKIP_TOKEN(parser);
+ token = PEEK_TOKEN(parser);
+ if (!token) return 0;
+ if (token->type != YAML_FLOW_ENTRY_TOKEN
+ && token->type != YAML_FLOW_SEQUENCE_END_TOKEN) {
+ if (!PUSH(parser, parser->states,
+ YAML_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_END_STATE))
+ return 0;
+ return yaml_parser_parse_node(parser, event, 0, 0);
+ }
+ }
+ parser->state = YAML_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_END_STATE;
+ return yaml_parser_process_empty_scalar(parser, event, token->start_mark);
+}
+
+/*
+ * Parse the productions:
+ * flow_sequence_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)?
+ * *
+ */
+
+static int
+yaml_parser_parse_flow_sequence_entry_mapping_end(yaml_parser_t *parser,
+ yaml_event_t *event)
+{
+ yaml_token_t *token;
+
+ token = PEEK_TOKEN(parser);
+ if (!token) return 0;
+
+ parser->state = YAML_PARSE_FLOW_SEQUENCE_ENTRY_STATE;
+
+ MAPPING_END_EVENT_INIT(*event, token->start_mark, token->start_mark);
+ return 1;
+}
+
+/*
+ * Parse the productions:
+ * flow_mapping ::= FLOW-MAPPING-START
+ * ******************
+ * (flow_mapping_entry FLOW-ENTRY)*
+ * * **********
+ * flow_mapping_entry?
+ * ******************
+ * FLOW-MAPPING-END
+ * ****************
+ * flow_mapping_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)?
+ * * *** *
+ */
+
+static int
+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);
+ if (!PUSH(parser, parser->marks, token->start_mark))
+ return 0;
+ SKIP_TOKEN(parser);
+ }
+
+ token = PEEK_TOKEN(parser);
+ if (!token) return 0;
+
+ if (token->type != YAML_FLOW_MAPPING_END_TOKEN)
+ {
+ if (!first) {
+ if (token->type == YAML_FLOW_ENTRY_TOKEN) {
+ SKIP_TOKEN(parser);
+ token = PEEK_TOKEN(parser);
+ if (!token) return 0;
+ }
+ else {
+ return yaml_parser_set_parser_error_context(parser,
+ "while parsing a flow mapping", POP(parser, parser->marks),
+ "did not find expected ',' or '}'", token->start_mark);
+ }
+ }
+
+ if (token->type == YAML_KEY_TOKEN) {
+ SKIP_TOKEN(parser);
+ token = PEEK_TOKEN(parser);
+ if (!token) return 0;
+ if (token->type != YAML_VALUE_TOKEN
+ && token->type != YAML_FLOW_ENTRY_TOKEN
+ && token->type != YAML_FLOW_MAPPING_END_TOKEN) {
+ if (!PUSH(parser, parser->states,
+ YAML_PARSE_FLOW_MAPPING_VALUE_STATE))
+ return 0;
+ return yaml_parser_parse_node(parser, event, 0, 0);
+ }
+ else {
+ parser->state = YAML_PARSE_FLOW_MAPPING_VALUE_STATE;
+ return yaml_parser_process_empty_scalar(parser, event,
+ token->start_mark);
+ }
+ }
+ else if (token->type != YAML_FLOW_MAPPING_END_TOKEN) {
+ if (!PUSH(parser, parser->states,
+ YAML_PARSE_FLOW_MAPPING_EMPTY_VALUE_STATE))
+ return 0;
+ return yaml_parser_parse_node(parser, event, 0, 0);
+ }
+ }
+
+ parser->state = POP(parser, parser->states);
+ dummy_mark = POP(parser, parser->marks);
+ MAPPING_END_EVENT_INIT(*event, token->start_mark, token->end_mark);
+ SKIP_TOKEN(parser);
+ return 1;
+}
+
+/*
+ * Parse the productions:
+ * flow_mapping_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)?
+ * * ***** *
+ */
+
+static int
+yaml_parser_parse_flow_mapping_value(yaml_parser_t *parser,
+ yaml_event_t *event, int empty)
+{
+ yaml_token_t *token;
+
+ token = PEEK_TOKEN(parser);
+ if (!token) return 0;
+
+ if (empty) {
+ parser->state = YAML_PARSE_FLOW_MAPPING_KEY_STATE;
+ return yaml_parser_process_empty_scalar(parser, event,
+ token->start_mark);
+ }
+
+ if (token->type == YAML_VALUE_TOKEN) {
+ SKIP_TOKEN(parser);
+ token = PEEK_TOKEN(parser);
+ if (!token) return 0;
+ if (token->type != YAML_FLOW_ENTRY_TOKEN
+ && token->type != YAML_FLOW_MAPPING_END_TOKEN) {
+ if (!PUSH(parser, parser->states,
+ YAML_PARSE_FLOW_MAPPING_KEY_STATE))
+ return 0;
+ return yaml_parser_parse_node(parser, event, 0, 0);
+ }
+ }
+
+ parser->state = YAML_PARSE_FLOW_MAPPING_KEY_STATE;
+ return yaml_parser_process_empty_scalar(parser, event, token->start_mark);
+}
+
+/*
+ * Generate an empty scalar event.
+ */
+
+static int
+yaml_parser_process_empty_scalar(yaml_parser_t *parser, yaml_event_t *event,
+ yaml_mark_t mark)
+{
+ yaml_char_t *value;
+
+ value = yaml_malloc(1);
+ if (!value) {
+ parser->error = YAML_MEMORY_ERROR;
+ return 0;
+ }
+ value[0] = '\0';
+
+ SCALAR_EVENT_INIT(*event, NULL, NULL, value, 0,
+ 1, 0, YAML_PLAIN_SCALAR_STYLE, mark, mark);
+
+ return 1;
+}
+
+/*
+ * Parse directives.
+ */
+
+static int
+yaml_parser_process_directives(yaml_parser_t *parser,
+ yaml_version_directive_t **version_directive_ref,
+ yaml_tag_directive_t **tag_directives_start_ref,
+ yaml_tag_directive_t **tag_directives_end_ref)
+{
+ yaml_tag_directive_t default_tag_directives[] = {
+ {(yaml_char_t *)"!", (yaml_char_t *)"!"},
+ {(yaml_char_t *)"!!", (yaml_char_t *)"tag:yaml.org,2002:"},
+ {NULL, NULL}
+ };
+ yaml_tag_directive_t *default_tag_directive;
+ yaml_version_directive_t *version_directive = NULL;
+ struct {
+ yaml_tag_directive_t *start;
+ yaml_tag_directive_t *end;
+ yaml_tag_directive_t *top;
+ } tag_directives = { NULL, NULL, NULL };
+ yaml_token_t *token;
+
+ if (!STACK_INIT(parser, tag_directives, INITIAL_STACK_SIZE))
+ goto error;
+
+ token = PEEK_TOKEN(parser);
+ if (!token) goto error;
+
+ while (token->type == YAML_VERSION_DIRECTIVE_TOKEN ||
+ token->type == YAML_TAG_DIRECTIVE_TOKEN)
+ {
+ if (token->type == YAML_VERSION_DIRECTIVE_TOKEN) {
+ if (version_directive) {
+ yaml_parser_set_parser_error(parser,
+ "found duplicate %YAML directive", token->start_mark);
+ goto error;
+ }
+ if (token->data.version_directive.major != 1
+ || token->data.version_directive.minor != 1) {
+ yaml_parser_set_parser_error(parser,
+ "found incompatible YAML document", token->start_mark);
+ goto error;
+ }
+ version_directive = yaml_malloc(sizeof(yaml_version_directive_t));
+ if (!version_directive) {
+ parser->error = YAML_MEMORY_ERROR;
+ goto error;
+ }
+ version_directive->major = token->data.version_directive.major;
+ version_directive->minor = token->data.version_directive.minor;
+ }
+
+ else if (token->type == YAML_TAG_DIRECTIVE_TOKEN) {
+ yaml_tag_directive_t value;
+ value.handle = token->data.tag_directive.handle;
+ value.prefix = token->data.tag_directive.prefix;
+
+ if (!yaml_parser_append_tag_directive(parser, value, 0,
+ token->start_mark))
+ goto error;
+ if (!PUSH(parser, tag_directives, value))
+ goto error;
+ }
+
+ SKIP_TOKEN(parser);
+ token = PEEK_TOKEN(parser);
+ if (!token) goto error;
+ }
+
+ for (default_tag_directive = default_tag_directives;
+ default_tag_directive->handle; default_tag_directive++) {
+ if (!yaml_parser_append_tag_directive(parser, *default_tag_directive, 1,
+ token->start_mark))
+ goto error;
+ }
+
+ if (version_directive_ref) {
+ *version_directive_ref = version_directive;
+ }
+ if (tag_directives_start_ref) {
+ if (STACK_EMPTY(parser, tag_directives)) {
+ *tag_directives_start_ref = *tag_directives_end_ref = NULL;
+ STACK_DEL(parser, tag_directives);
+ }
+ else {
+ *tag_directives_start_ref = tag_directives.start;
+ *tag_directives_end_ref = tag_directives.top;
+ }
+ }
+ else {
+ STACK_DEL(parser, tag_directives);
+ }
+
+ return 1;
+
+error:
+ yaml_free(version_directive);
+ while (!STACK_EMPTY(parser, tag_directives)) {
+ yaml_tag_directive_t tag_directive = POP(parser, tag_directives);
+ yaml_free(tag_directive.handle);
+ yaml_free(tag_directive.prefix);
+ }
+ STACK_DEL(parser, tag_directives);
+ return 0;
+}
+
+/*
+ * Append a tag directive to the directives stack.
+ */
+
+static int
+yaml_parser_append_tag_directive(yaml_parser_t *parser,
+ yaml_tag_directive_t value, int allow_duplicates, yaml_mark_t mark)
+{
+ yaml_tag_directive_t *tag_directive;
+ yaml_tag_directive_t copy = { NULL, NULL };
+
+ for (tag_directive = parser->tag_directives.start;
+ tag_directive != parser->tag_directives.top; tag_directive ++) {
+ if (strcmp((char *)value.handle, (char *)tag_directive->handle) == 0) {
+ if (allow_duplicates)
+ return 1;
+ return yaml_parser_set_parser_error(parser,
+ "found duplicate %TAG directive", mark);
+ }
+ }
+
+ copy.handle = yaml_strdup(value.handle);
+ copy.prefix = yaml_strdup(value.prefix);
+ if (!copy.handle || !copy.prefix) {
+ parser->error = YAML_MEMORY_ERROR;
+ goto error;
+ }
+
+ if (!PUSH(parser, parser->tag_directives, copy))
+ goto error;
+
+ return 1;
+
+error:
+ yaml_free(copy.handle);
+ yaml_free(copy.prefix);
+ return 0;
+}
+
diff --git a/ext/psych/yaml/reader.c b/ext/psych/yaml/reader.c
new file mode 100644
index 0000000000..4e48add7b8
--- /dev/null
+++ b/ext/psych/yaml/reader.c
@@ -0,0 +1,465 @@
+
+#include "yaml_private.h"
+
+/*
+ * Declarations.
+ */
+
+static int
+yaml_parser_set_reader_error(yaml_parser_t *parser, const char *problem,
+ size_t offset, int value);
+
+static int
+yaml_parser_update_raw_buffer(yaml_parser_t *parser);
+
+static int
+yaml_parser_determine_encoding(yaml_parser_t *parser);
+
+YAML_DECLARE(int)
+yaml_parser_update_buffer(yaml_parser_t *parser, size_t length);
+
+/*
+ * Set the reader error and return 0.
+ */
+
+static int
+yaml_parser_set_reader_error(yaml_parser_t *parser, const char *problem,
+ size_t offset, int value)
+{
+ parser->error = YAML_READER_ERROR;
+ parser->problem = problem;
+ parser->problem_offset = offset;
+ parser->problem_value = value;
+
+ return 0;
+}
+
+/*
+ * Byte order marks.
+ */
+
+#define BOM_UTF8 "\xef\xbb\xbf"
+#define BOM_UTF16LE "\xff\xfe"
+#define BOM_UTF16BE "\xfe\xff"
+
+/*
+ * Determine the input stream encoding by checking the BOM symbol. If no BOM is
+ * found, the UTF-8 encoding is assumed. Return 1 on success, 0 on failure.
+ */
+
+static int
+yaml_parser_determine_encoding(yaml_parser_t *parser)
+{
+ /* Ensure that we had enough bytes in the raw buffer. */
+
+ while (!parser->eof
+ && parser->raw_buffer.last - parser->raw_buffer.pointer < 3) {
+ if (!yaml_parser_update_raw_buffer(parser)) {
+ return 0;
+ }
+ }
+
+ /* Determine the encoding. */
+
+ if (parser->raw_buffer.last - parser->raw_buffer.pointer >= 2
+ && !memcmp(parser->raw_buffer.pointer, BOM_UTF16LE, 2)) {
+ parser->encoding = YAML_UTF16LE_ENCODING;
+ parser->raw_buffer.pointer += 2;
+ parser->offset += 2;
+ }
+ else if (parser->raw_buffer.last - parser->raw_buffer.pointer >= 2
+ && !memcmp(parser->raw_buffer.pointer, BOM_UTF16BE, 2)) {
+ parser->encoding = YAML_UTF16BE_ENCODING;
+ parser->raw_buffer.pointer += 2;
+ parser->offset += 2;
+ }
+ else if (parser->raw_buffer.last - parser->raw_buffer.pointer >= 3
+ && !memcmp(parser->raw_buffer.pointer, BOM_UTF8, 3)) {
+ parser->encoding = YAML_UTF8_ENCODING;
+ parser->raw_buffer.pointer += 3;
+ parser->offset += 3;
+ }
+ else {
+ parser->encoding = YAML_UTF8_ENCODING;
+ }
+
+ return 1;
+}
+
+/*
+ * Update the raw buffer.
+ */
+
+static int
+yaml_parser_update_raw_buffer(yaml_parser_t *parser)
+{
+ size_t size_read = 0;
+
+ /* Return if the raw buffer is full. */
+
+ if (parser->raw_buffer.start == parser->raw_buffer.pointer
+ && parser->raw_buffer.last == parser->raw_buffer.end)
+ return 1;
+
+ /* Return on EOF. */
+
+ if (parser->eof) return 1;
+
+ /* Move the remaining bytes in the raw buffer to the beginning. */
+
+ if (parser->raw_buffer.start < parser->raw_buffer.pointer
+ && parser->raw_buffer.pointer < parser->raw_buffer.last) {
+ memmove(parser->raw_buffer.start, parser->raw_buffer.pointer,
+ parser->raw_buffer.last - parser->raw_buffer.pointer);
+ }
+ parser->raw_buffer.last -=
+ parser->raw_buffer.pointer - parser->raw_buffer.start;
+ parser->raw_buffer.pointer = parser->raw_buffer.start;
+
+ /* Call the read handler to fill the buffer. */
+
+ if (!parser->read_handler(parser->read_handler_data, parser->raw_buffer.last,
+ parser->raw_buffer.end - parser->raw_buffer.last, &size_read)) {
+ return yaml_parser_set_reader_error(parser, "input error",
+ parser->offset, -1);
+ }
+ parser->raw_buffer.last += size_read;
+ if (!size_read) {
+ parser->eof = 1;
+ }
+
+ return 1;
+}
+
+/*
+ * Ensure that the buffer contains at least `length` characters.
+ * Return 1 on success, 0 on failure.
+ *
+ * The length is supposed to be significantly less that the buffer size.
+ */
+
+YAML_DECLARE(int)
+yaml_parser_update_buffer(yaml_parser_t *parser, size_t length)
+{
+ int first = 1;
+
+ assert(parser->read_handler); /* Read handler must be set. */
+
+ /* If the EOF flag is set and the raw buffer is empty, do nothing. */
+
+ if (parser->eof && parser->raw_buffer.pointer == parser->raw_buffer.last)
+ return 1;
+
+ /* Return if the buffer contains enough characters. */
+
+ if (parser->unread >= length)
+ return 1;
+
+ /* Determine the input encoding if it is not known yet. */
+
+ if (!parser->encoding) {
+ if (!yaml_parser_determine_encoding(parser))
+ return 0;
+ }
+
+ /* Move the unread characters to the beginning of the buffer. */
+
+ if (parser->buffer.start < parser->buffer.pointer
+ && parser->buffer.pointer < parser->buffer.last) {
+ size_t size = parser->buffer.last - parser->buffer.pointer;
+ memmove(parser->buffer.start, parser->buffer.pointer, size);
+ parser->buffer.pointer = parser->buffer.start;
+ parser->buffer.last = parser->buffer.start + size;
+ }
+ else if (parser->buffer.pointer == parser->buffer.last) {
+ parser->buffer.pointer = parser->buffer.start;
+ parser->buffer.last = parser->buffer.start;
+ }
+
+ /* Fill the buffer until it has enough characters. */
+
+ while (parser->unread < length)
+ {
+ /* Fill the raw buffer if necessary. */
+
+ if (!first || parser->raw_buffer.pointer == parser->raw_buffer.last) {
+ if (!yaml_parser_update_raw_buffer(parser)) return 0;
+ }
+ first = 0;
+
+ /* Decode the raw buffer. */
+
+ while (parser->raw_buffer.pointer != parser->raw_buffer.last)
+ {
+ unsigned int value = 0, value2 = 0;
+ int incomplete = 0;
+ unsigned char octet;
+ unsigned int width = 0;
+ int low, high;
+ size_t k;
+ size_t raw_unread = parser->raw_buffer.last - parser->raw_buffer.pointer;
+
+ /* Decode the next character. */
+
+ switch (parser->encoding)
+ {
+ case YAML_UTF8_ENCODING:
+
+ /*
+ * Decode a UTF-8 character. Check RFC 3629
+ * (http://www.ietf.org/rfc/rfc3629.txt) for more details.
+ *
+ * The following table (taken from the RFC) is used for
+ * decoding.
+ *
+ * Char. number range | UTF-8 octet sequence
+ * (hexadecimal) | (binary)
+ * --------------------+------------------------------------
+ * 0000 0000-0000 007F | 0xxxxxxx
+ * 0000 0080-0000 07FF | 110xxxxx 10xxxxxx
+ * 0000 0800-0000 FFFF | 1110xxxx 10xxxxxx 10xxxxxx
+ * 0001 0000-0010 FFFF | 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx
+ *
+ * Additionally, the characters in the range 0xD800-0xDFFF
+ * are prohibited as they are reserved for use with UTF-16
+ * surrogate pairs.
+ */
+
+ /* Determine the length of the UTF-8 sequence. */
+
+ octet = parser->raw_buffer.pointer[0];
+ width = (octet & 0x80) == 0x00 ? 1 :
+ (octet & 0xE0) == 0xC0 ? 2 :
+ (octet & 0xF0) == 0xE0 ? 3 :
+ (octet & 0xF8) == 0xF0 ? 4 : 0;
+
+ /* Check if the leading octet is valid. */
+
+ if (!width)
+ return yaml_parser_set_reader_error(parser,
+ "invalid leading UTF-8 octet",
+ parser->offset, octet);
+
+ /* Check if the raw buffer contains an incomplete character. */
+
+ if (width > raw_unread) {
+ if (parser->eof) {
+ return yaml_parser_set_reader_error(parser,
+ "incomplete UTF-8 octet sequence",
+ parser->offset, -1);
+ }
+ incomplete = 1;
+ break;
+ }
+
+ /* Decode the leading octet. */
+
+ value = (octet & 0x80) == 0x00 ? octet & 0x7F :
+ (octet & 0xE0) == 0xC0 ? octet & 0x1F :
+ (octet & 0xF0) == 0xE0 ? octet & 0x0F :
+ (octet & 0xF8) == 0xF0 ? octet & 0x07 : 0;
+
+ /* Check and decode the trailing octets. */
+
+ for (k = 1; k < width; k ++)
+ {
+ octet = parser->raw_buffer.pointer[k];
+
+ /* Check if the octet is valid. */
+
+ if ((octet & 0xC0) != 0x80)
+ return yaml_parser_set_reader_error(parser,
+ "invalid trailing UTF-8 octet",
+ parser->offset+k, octet);
+
+ /* Decode the octet. */
+
+ value = (value << 6) + (octet & 0x3F);
+ }
+
+ /* Check the length of the sequence against the value. */
+
+ if (!((width == 1) ||
+ (width == 2 && value >= 0x80) ||
+ (width == 3 && value >= 0x800) ||
+ (width == 4 && value >= 0x10000)))
+ return yaml_parser_set_reader_error(parser,
+ "invalid length of a UTF-8 sequence",
+ parser->offset, -1);
+
+ /* Check the range of the value. */
+
+ if ((value >= 0xD800 && value <= 0xDFFF) || value > 0x10FFFF)
+ return yaml_parser_set_reader_error(parser,
+ "invalid Unicode character",
+ parser->offset, value);
+
+ break;
+
+ case YAML_UTF16LE_ENCODING:
+ case YAML_UTF16BE_ENCODING:
+
+ low = (parser->encoding == YAML_UTF16LE_ENCODING ? 0 : 1);
+ high = (parser->encoding == YAML_UTF16LE_ENCODING ? 1 : 0);
+
+ /*
+ * The UTF-16 encoding is not as simple as one might
+ * naively think. Check RFC 2781
+ * (http://www.ietf.org/rfc/rfc2781.txt).
+ *
+ * Normally, two subsequent bytes describe a Unicode
+ * character. However a special technique (called a
+ * surrogate pair) is used for specifying character
+ * values larger than 0xFFFF.
+ *
+ * A surrogate pair consists of two pseudo-characters:
+ * high surrogate area (0xD800-0xDBFF)
+ * low surrogate area (0xDC00-0xDFFF)
+ *
+ * The following formulas are used for decoding
+ * and encoding characters using surrogate pairs:
+ *
+ * U = U' + 0x10000 (0x01 00 00 <= U <= 0x10 FF FF)
+ * U' = yyyyyyyyyyxxxxxxxxxx (0 <= U' <= 0x0F FF FF)
+ * W1 = 110110yyyyyyyyyy
+ * W2 = 110111xxxxxxxxxx
+ *
+ * where U is the character value, W1 is the high surrogate
+ * area, W2 is the low surrogate area.
+ */
+
+ /* Check for incomplete UTF-16 character. */
+
+ if (raw_unread < 2) {
+ if (parser->eof) {
+ return yaml_parser_set_reader_error(parser,
+ "incomplete UTF-16 character",
+ parser->offset, -1);
+ }
+ incomplete = 1;
+ break;
+ }
+
+ /* Get the character. */
+
+ value = parser->raw_buffer.pointer[low]
+ + (parser->raw_buffer.pointer[high] << 8);
+
+ /* Check for unexpected low surrogate area. */
+
+ if ((value & 0xFC00) == 0xDC00)
+ return yaml_parser_set_reader_error(parser,
+ "unexpected low surrogate area",
+ parser->offset, value);
+
+ /* Check for a high surrogate area. */
+
+ if ((value & 0xFC00) == 0xD800) {
+
+ width = 4;
+
+ /* Check for incomplete surrogate pair. */
+
+ if (raw_unread < 4) {
+ if (parser->eof) {
+ return yaml_parser_set_reader_error(parser,
+ "incomplete UTF-16 surrogate pair",
+ parser->offset, -1);
+ }
+ incomplete = 1;
+ break;
+ }
+
+ /* Get the next character. */
+
+ value2 = parser->raw_buffer.pointer[low+2]
+ + (parser->raw_buffer.pointer[high+2] << 8);
+
+ /* Check for a low surrogate area. */
+
+ if ((value2 & 0xFC00) != 0xDC00)
+ return yaml_parser_set_reader_error(parser,
+ "expected low surrogate area",
+ parser->offset+2, value2);
+
+ /* Generate the value of the surrogate pair. */
+
+ value = 0x10000 + ((value & 0x3FF) << 10) + (value2 & 0x3FF);
+ }
+
+ else {
+ width = 2;
+ }
+
+ break;
+
+ default:
+ assert(1); /* Impossible. */
+ }
+
+ /* Check if the raw buffer contains enough bytes to form a character. */
+
+ if (incomplete) break;
+
+ /*
+ * Check if the character is in the allowed range:
+ * #x9 | #xA | #xD | [#x20-#x7E] (8 bit)
+ * | #x85 | [#xA0-#xD7FF] | [#xE000-#xFFFD] (16 bit)
+ * | [#x10000-#x10FFFF] (32 bit)
+ */
+
+ if (! (value == 0x09 || value == 0x0A || value == 0x0D
+ || (value >= 0x20 && value <= 0x7E)
+ || (value == 0x85) || (value >= 0xA0 && value <= 0xD7FF)
+ || (value >= 0xE000 && value <= 0xFFFD)
+ || (value >= 0x10000 && value <= 0x10FFFF)))
+ return yaml_parser_set_reader_error(parser,
+ "control characters are not allowed",
+ parser->offset, value);
+
+ /* Move the raw pointers. */
+
+ parser->raw_buffer.pointer += width;
+ parser->offset += width;
+
+ /* Finally put the character into the buffer. */
+
+ /* 0000 0000-0000 007F -> 0xxxxxxx */
+ if (value <= 0x7F) {
+ *(parser->buffer.last++) = value;
+ }
+ /* 0000 0080-0000 07FF -> 110xxxxx 10xxxxxx */
+ else if (value <= 0x7FF) {
+ *(parser->buffer.last++) = 0xC0 + (value >> 6);
+ *(parser->buffer.last++) = 0x80 + (value & 0x3F);
+ }
+ /* 0000 0800-0000 FFFF -> 1110xxxx 10xxxxxx 10xxxxxx */
+ else if (value <= 0xFFFF) {
+ *(parser->buffer.last++) = 0xE0 + (value >> 12);
+ *(parser->buffer.last++) = 0x80 + ((value >> 6) & 0x3F);
+ *(parser->buffer.last++) = 0x80 + (value & 0x3F);
+ }
+ /* 0001 0000-0010 FFFF -> 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx */
+ else {
+ *(parser->buffer.last++) = 0xF0 + (value >> 18);
+ *(parser->buffer.last++) = 0x80 + ((value >> 12) & 0x3F);
+ *(parser->buffer.last++) = 0x80 + ((value >> 6) & 0x3F);
+ *(parser->buffer.last++) = 0x80 + (value & 0x3F);
+ }
+
+ parser->unread ++;
+ }
+
+ /* On EOF, put NUL into the buffer and return. */
+
+ if (parser->eof) {
+ *(parser->buffer.last++) = '\0';
+ parser->unread ++;
+ return 1;
+ }
+
+ }
+
+ return 1;
+}
+
diff --git a/ext/psych/yaml/scanner.c b/ext/psych/yaml/scanner.c
new file mode 100644
index 0000000000..31fed0ed94
--- /dev/null
+++ b/ext/psych/yaml/scanner.c
@@ -0,0 +1,3570 @@
+
+/*
+ * Introduction
+ * ************
+ *
+ * The following notes assume that you are familiar with the YAML specification
+ * (http://yaml.org/spec/cvs/current.html). We mostly follow it, although in
+ * some cases we are less restrictive that it requires.
+ *
+ * The process of transforming a YAML stream into a sequence of events is
+ * divided on two steps: Scanning and Parsing.
+ *
+ * The Scanner transforms the input stream into a sequence of tokens, while the
+ * parser transform the sequence of tokens produced by the Scanner into a
+ * sequence of parsing events.
+ *
+ * The Scanner is rather clever and complicated. The Parser, on the contrary,
+ * is a straightforward implementation of a recursive-descendant parser (or,
+ * LL(1) parser, as it is usually called).
+ *
+ * Actually there are two issues of Scanning that might be called "clever", the
+ * rest is quite straightforward. The issues are "block collection start" and
+ * "simple keys". Both issues are explained below in details.
+ *
+ * Here the Scanning step is explained and implemented. We start with the list
+ * of all the tokens produced by the Scanner together with short descriptions.
+ *
+ * Now, tokens:
+ *
+ * STREAM-START(encoding) # The stream start.
+ * STREAM-END # The stream end.
+ * VERSION-DIRECTIVE(major,minor) # The '%YAML' directive.
+ * TAG-DIRECTIVE(handle,prefix) # The '%TAG' directive.
+ * DOCUMENT-START # '---'
+ * DOCUMENT-END # '...'
+ * BLOCK-SEQUENCE-START # Indentation increase denoting a block
+ * BLOCK-MAPPING-START # sequence or a block mapping.
+ * BLOCK-END # Indentation decrease.
+ * FLOW-SEQUENCE-START # '['
+ * FLOW-SEQUENCE-END # ']'
+ * BLOCK-SEQUENCE-START # '{'
+ * BLOCK-SEQUENCE-END # '}'
+ * BLOCK-ENTRY # '-'
+ * FLOW-ENTRY # ','
+ * KEY # '?' or nothing (simple keys).
+ * VALUE # ':'
+ * ALIAS(anchor) # '*anchor'
+ * ANCHOR(anchor) # '&anchor'
+ * TAG(handle,suffix) # '!handle!suffix'
+ * SCALAR(value,style) # A scalar.
+ *
+ * The following two tokens are "virtual" tokens denoting the beginning and the
+ * end of the stream:
+ *
+ * STREAM-START(encoding)
+ * STREAM-END
+ *
+ * We pass the information about the input stream encoding with the
+ * STREAM-START token.
+ *
+ * The next two tokens are responsible for tags:
+ *
+ * VERSION-DIRECTIVE(major,minor)
+ * TAG-DIRECTIVE(handle,prefix)
+ *
+ * Example:
+ *
+ * %YAML 1.1
+ * %TAG ! !foo
+ * %TAG !yaml! tag:yaml.org,2002:
+ * ---
+ *
+ * The correspoding sequence of tokens:
+ *
+ * STREAM-START(utf-8)
+ * VERSION-DIRECTIVE(1,1)
+ * TAG-DIRECTIVE("!","!foo")
+ * TAG-DIRECTIVE("!yaml","tag:yaml.org,2002:")
+ * DOCUMENT-START
+ * STREAM-END
+ *
+ * Note that the VERSION-DIRECTIVE and TAG-DIRECTIVE tokens occupy a whole
+ * line.
+ *
+ * The document start and end indicators are represented by:
+ *
+ * DOCUMENT-START
+ * DOCUMENT-END
+ *
+ * Note that if a YAML stream contains an implicit document (without '---'
+ * and '...' indicators), no DOCUMENT-START and DOCUMENT-END tokens will be
+ * produced.
+ *
+ * In the following examples, we present whole documents together with the
+ * produced tokens.
+ *
+ * 1. An implicit document:
+ *
+ * 'a scalar'
+ *
+ * Tokens:
+ *
+ * STREAM-START(utf-8)
+ * SCALAR("a scalar",single-quoted)
+ * STREAM-END
+ *
+ * 2. An explicit document:
+ *
+ * ---
+ * 'a scalar'
+ * ...
+ *
+ * Tokens:
+ *
+ * STREAM-START(utf-8)
+ * DOCUMENT-START
+ * SCALAR("a scalar",single-quoted)
+ * DOCUMENT-END
+ * STREAM-END
+ *
+ * 3. Several documents in a stream:
+ *
+ * 'a scalar'
+ * ---
+ * 'another scalar'
+ * ---
+ * 'yet another scalar'
+ *
+ * Tokens:
+ *
+ * STREAM-START(utf-8)
+ * SCALAR("a scalar",single-quoted)
+ * DOCUMENT-START
+ * SCALAR("another scalar",single-quoted)
+ * DOCUMENT-START
+ * SCALAR("yet another scalar",single-quoted)
+ * STREAM-END
+ *
+ * We have already introduced the SCALAR token above. The following tokens are
+ * used to describe aliases, anchors, tag, and scalars:
+ *
+ * ALIAS(anchor)
+ * ANCHOR(anchor)
+ * TAG(handle,suffix)
+ * SCALAR(value,style)
+ *
+ * The following series of examples illustrate the usage of these tokens:
+ *
+ * 1. A recursive sequence:
+ *
+ * &A [ *A ]
+ *
+ * Tokens:
+ *
+ * STREAM-START(utf-8)
+ * ANCHOR("A")
+ * FLOW-SEQUENCE-START
+ * ALIAS("A")
+ * FLOW-SEQUENCE-END
+ * STREAM-END
+ *
+ * 2. A tagged scalar:
+ *
+ * !!float "3.14" # A good approximation.
+ *
+ * Tokens:
+ *
+ * STREAM-START(utf-8)
+ * TAG("!!","float")
+ * SCALAR("3.14",double-quoted)
+ * STREAM-END
+ *
+ * 3. Various scalar styles:
+ *
+ * --- # Implicit empty plain scalars do not produce tokens.
+ * --- a plain scalar
+ * --- 'a single-quoted scalar'
+ * --- "a double-quoted scalar"
+ * --- |-
+ * a literal scalar
+ * --- >-
+ * a folded
+ * scalar
+ *
+ * Tokens:
+ *
+ * STREAM-START(utf-8)
+ * DOCUMENT-START
+ * DOCUMENT-START
+ * SCALAR("a plain scalar",plain)
+ * DOCUMENT-START
+ * SCALAR("a single-quoted scalar",single-quoted)
+ * DOCUMENT-START
+ * SCALAR("a double-quoted scalar",double-quoted)
+ * DOCUMENT-START
+ * SCALAR("a literal scalar",literal)
+ * DOCUMENT-START
+ * SCALAR("a folded scalar",folded)
+ * STREAM-END
+ *
+ * Now it's time to review collection-related tokens. We will start with
+ * flow collections:
+ *
+ * FLOW-SEQUENCE-START
+ * FLOW-SEQUENCE-END
+ * FLOW-MAPPING-START
+ * FLOW-MAPPING-END
+ * FLOW-ENTRY
+ * KEY
+ * VALUE
+ *
+ * The tokens FLOW-SEQUENCE-START, FLOW-SEQUENCE-END, FLOW-MAPPING-START, and
+ * FLOW-MAPPING-END represent the indicators '[', ']', '{', and '}'
+ * correspondingly. FLOW-ENTRY represent the ',' indicator. Finally the
+ * indicators '?' and ':', which are used for denoting mapping keys and values,
+ * are represented by the KEY and VALUE tokens.
+ *
+ * The following examples show flow collections:
+ *
+ * 1. A flow sequence:
+ *
+ * [item 1, item 2, item 3]
+ *
+ * Tokens:
+ *
+ * STREAM-START(utf-8)
+ * FLOW-SEQUENCE-START
+ * SCALAR("item 1",plain)
+ * FLOW-ENTRY
+ * SCALAR("item 2",plain)
+ * FLOW-ENTRY
+ * SCALAR("item 3",plain)
+ * FLOW-SEQUENCE-END
+ * STREAM-END
+ *
+ * 2. A flow mapping:
+ *
+ * {
+ * a simple key: a value, # Note that the KEY token is produced.
+ * ? a complex key: another value,
+ * }
+ *
+ * Tokens:
+ *
+ * STREAM-START(utf-8)
+ * FLOW-MAPPING-START
+ * KEY
+ * SCALAR("a simple key",plain)
+ * VALUE
+ * SCALAR("a value",plain)
+ * FLOW-ENTRY
+ * KEY
+ * SCALAR("a complex key",plain)
+ * VALUE
+ * SCALAR("another value",plain)
+ * FLOW-ENTRY
+ * FLOW-MAPPING-END
+ * STREAM-END
+ *
+ * A simple key is a key which is not denoted by the '?' indicator. Note that
+ * the Scanner still produce the KEY token whenever it encounters a simple key.
+ *
+ * For scanning block collections, the following tokens are used (note that we
+ * repeat KEY and VALUE here):
+ *
+ * BLOCK-SEQUENCE-START
+ * BLOCK-MAPPING-START
+ * BLOCK-END
+ * BLOCK-ENTRY
+ * KEY
+ * VALUE
+ *
+ * The tokens BLOCK-SEQUENCE-START and BLOCK-MAPPING-START denote indentation
+ * increase that precedes a block collection (cf. the INDENT token in Python).
+ * The token BLOCK-END denote indentation decrease that ends a block collection
+ * (cf. the DEDENT token in Python). However YAML has some syntax pecularities
+ * that makes detections of these tokens more complex.
+ *
+ * The tokens BLOCK-ENTRY, KEY, and VALUE are used to represent the indicators
+ * '-', '?', and ':' correspondingly.
+ *
+ * The following examples show how the tokens BLOCK-SEQUENCE-START,
+ * BLOCK-MAPPING-START, and BLOCK-END are emitted by the Scanner:
+ *
+ * 1. Block sequences:
+ *
+ * - item 1
+ * - item 2
+ * -
+ * - item 3.1
+ * - item 3.2
+ * -
+ * key 1: value 1
+ * key 2: value 2
+ *
+ * Tokens:
+ *
+ * STREAM-START(utf-8)
+ * BLOCK-SEQUENCE-START
+ * BLOCK-ENTRY
+ * SCALAR("item 1",plain)
+ * BLOCK-ENTRY
+ * SCALAR("item 2",plain)
+ * BLOCK-ENTRY
+ * BLOCK-SEQUENCE-START
+ * BLOCK-ENTRY
+ * SCALAR("item 3.1",plain)
+ * BLOCK-ENTRY
+ * SCALAR("item 3.2",plain)
+ * BLOCK-END
+ * BLOCK-ENTRY
+ * BLOCK-MAPPING-START
+ * KEY
+ * SCALAR("key 1",plain)
+ * VALUE
+ * SCALAR("value 1",plain)
+ * KEY
+ * SCALAR("key 2",plain)
+ * VALUE
+ * SCALAR("value 2",plain)
+ * BLOCK-END
+ * BLOCK-END
+ * STREAM-END
+ *
+ * 2. Block mappings:
+ *
+ * a simple key: a value # The KEY token is produced here.
+ * ? a complex key
+ * : another value
+ * a mapping:
+ * key 1: value 1
+ * key 2: value 2
+ * a sequence:
+ * - item 1
+ * - item 2
+ *
+ * Tokens:
+ *
+ * STREAM-START(utf-8)
+ * BLOCK-MAPPING-START
+ * KEY
+ * SCALAR("a simple key",plain)
+ * VALUE
+ * SCALAR("a value",plain)
+ * KEY
+ * SCALAR("a complex key",plain)
+ * VALUE
+ * SCALAR("another value",plain)
+ * KEY
+ * SCALAR("a mapping",plain)
+ * BLOCK-MAPPING-START
+ * KEY
+ * SCALAR("key 1",plain)
+ * VALUE
+ * SCALAR("value 1",plain)
+ * KEY
+ * SCALAR("key 2",plain)
+ * VALUE
+ * SCALAR("value 2",plain)
+ * BLOCK-END
+ * KEY
+ * SCALAR("a sequence",plain)
+ * VALUE
+ * BLOCK-SEQUENCE-START
+ * BLOCK-ENTRY
+ * SCALAR("item 1",plain)
+ * BLOCK-ENTRY
+ * SCALAR("item 2",plain)
+ * BLOCK-END
+ * BLOCK-END
+ * STREAM-END
+ *
+ * YAML does not always require to start a new block collection from a new
+ * line. If the current line contains only '-', '?', and ':' indicators, a new
+ * block collection may start at the current line. The following examples
+ * illustrate this case:
+ *
+ * 1. Collections in a sequence:
+ *
+ * - - item 1
+ * - item 2
+ * - key 1: value 1
+ * key 2: value 2
+ * - ? complex key
+ * : complex value
+ *
+ * Tokens:
+ *
+ * STREAM-START(utf-8)
+ * BLOCK-SEQUENCE-START
+ * BLOCK-ENTRY
+ * BLOCK-SEQUENCE-START
+ * BLOCK-ENTRY
+ * SCALAR("item 1",plain)
+ * BLOCK-ENTRY
+ * SCALAR("item 2",plain)
+ * BLOCK-END
+ * BLOCK-ENTRY
+ * BLOCK-MAPPING-START
+ * KEY
+ * SCALAR("key 1",plain)
+ * VALUE
+ * SCALAR("value 1",plain)
+ * KEY
+ * SCALAR("key 2",plain)
+ * VALUE
+ * SCALAR("value 2",plain)
+ * BLOCK-END
+ * BLOCK-ENTRY
+ * BLOCK-MAPPING-START
+ * KEY
+ * SCALAR("complex key")
+ * VALUE
+ * SCALAR("complex value")
+ * BLOCK-END
+ * BLOCK-END
+ * STREAM-END
+ *
+ * 2. Collections in a mapping:
+ *
+ * ? a sequence
+ * : - item 1
+ * - item 2
+ * ? a mapping
+ * : key 1: value 1
+ * key 2: value 2
+ *
+ * Tokens:
+ *
+ * STREAM-START(utf-8)
+ * BLOCK-MAPPING-START
+ * KEY
+ * SCALAR("a sequence",plain)
+ * VALUE
+ * BLOCK-SEQUENCE-START
+ * BLOCK-ENTRY
+ * SCALAR("item 1",plain)
+ * BLOCK-ENTRY
+ * SCALAR("item 2",plain)
+ * BLOCK-END
+ * KEY
+ * SCALAR("a mapping",plain)
+ * VALUE
+ * BLOCK-MAPPING-START
+ * KEY
+ * SCALAR("key 1",plain)
+ * VALUE
+ * SCALAR("value 1",plain)
+ * KEY
+ * SCALAR("key 2",plain)
+ * VALUE
+ * SCALAR("value 2",plain)
+ * BLOCK-END
+ * BLOCK-END
+ * STREAM-END
+ *
+ * YAML also permits non-indented sequences if they are included into a block
+ * mapping. In this case, the token BLOCK-SEQUENCE-START is not produced:
+ *
+ * key:
+ * - item 1 # BLOCK-SEQUENCE-START is NOT produced here.
+ * - item 2
+ *
+ * Tokens:
+ *
+ * STREAM-START(utf-8)
+ * BLOCK-MAPPING-START
+ * KEY
+ * SCALAR("key",plain)
+ * VALUE
+ * BLOCK-ENTRY
+ * SCALAR("item 1",plain)
+ * BLOCK-ENTRY
+ * SCALAR("item 2",plain)
+ * BLOCK-END
+ */
+
+#include "yaml_private.h"
+
+/*
+ * Ensure that the buffer contains the required number of characters.
+ * Return 1 on success, 0 on failure (reader error or memory error).
+ */
+
+#define CACHE(parser,length) \
+ (parser->unread >= (length) \
+ ? 1 \
+ : yaml_parser_update_buffer(parser, (length)))
+
+/*
+ * Advance the buffer pointer.
+ */
+
+#define SKIP(parser) \
+ (parser->mark.index ++, \
+ parser->mark.column ++, \
+ parser->unread --, \
+ parser->buffer.pointer += WIDTH(parser->buffer))
+
+#define SKIP_LINE(parser) \
+ (IS_CRLF(parser->buffer) ? \
+ (parser->mark.index += 2, \
+ parser->mark.column = 0, \
+ parser->mark.line ++, \
+ parser->unread -= 2, \
+ parser->buffer.pointer += 2) : \
+ IS_BREAK(parser->buffer) ? \
+ (parser->mark.index ++, \
+ parser->mark.column = 0, \
+ parser->mark.line ++, \
+ parser->unread --, \
+ parser->buffer.pointer += WIDTH(parser->buffer)) : 0)
+
+/*
+ * Copy a character to a string buffer and advance pointers.
+ */
+
+#define READ(parser,string) \
+ (STRING_EXTEND(parser,string) ? \
+ (COPY(string,parser->buffer), \
+ parser->mark.index ++, \
+ parser->mark.column ++, \
+ parser->unread --, \
+ 1) : 0)
+
+/*
+ * Copy a line break character to a string buffer and advance pointers.
+ */
+
+#define READ_LINE(parser,string) \
+ (STRING_EXTEND(parser,string) ? \
+ (((CHECK_AT(parser->buffer,'\r',0) \
+ && CHECK_AT(parser->buffer,'\n',1)) ? /* CR LF -> LF */ \
+ (*((string).pointer++) = (yaml_char_t) '\n', \
+ parser->buffer.pointer += 2, \
+ parser->mark.index += 2, \
+ parser->mark.column = 0, \
+ parser->mark.line ++, \
+ parser->unread -= 2) : \
+ (CHECK_AT(parser->buffer,'\r',0) \
+ || CHECK_AT(parser->buffer,'\n',0)) ? /* CR|LF -> LF */ \
+ (*((string).pointer++) = (yaml_char_t) '\n', \
+ parser->buffer.pointer ++, \
+ parser->mark.index ++, \
+ parser->mark.column = 0, \
+ parser->mark.line ++, \
+ parser->unread --) : \
+ (CHECK_AT(parser->buffer,'\xC2',0) \
+ && CHECK_AT(parser->buffer,'\x85',1)) ? /* NEL -> LF */ \
+ (*((string).pointer++) = (yaml_char_t) '\n', \
+ parser->buffer.pointer += 2, \
+ parser->mark.index ++, \
+ parser->mark.column = 0, \
+ parser->mark.line ++, \
+ parser->unread --) : \
+ (CHECK_AT(parser->buffer,'\xE2',0) && \
+ CHECK_AT(parser->buffer,'\x80',1) && \
+ (CHECK_AT(parser->buffer,'\xA8',2) || \
+ CHECK_AT(parser->buffer,'\xA9',2))) ? /* LS|PS -> LS|PS */ \
+ (*((string).pointer++) = *(parser->buffer.pointer++), \
+ *((string).pointer++) = *(parser->buffer.pointer++), \
+ *((string).pointer++) = *(parser->buffer.pointer++), \
+ parser->mark.index ++, \
+ parser->mark.column = 0, \
+ parser->mark.line ++, \
+ parser->unread --) : 0), \
+ 1) : 0)
+
+/*
+ * Public API declarations.
+ */
+
+YAML_DECLARE(int)
+yaml_parser_scan(yaml_parser_t *parser, yaml_token_t *token);
+
+/*
+ * Error handling.
+ */
+
+static int
+yaml_parser_set_scanner_error(yaml_parser_t *parser, const char *context,
+ yaml_mark_t context_mark, const char *problem);
+
+/*
+ * High-level token API.
+ */
+
+YAML_DECLARE(int)
+yaml_parser_fetch_more_tokens(yaml_parser_t *parser);
+
+static int
+yaml_parser_fetch_next_token(yaml_parser_t *parser);
+
+/*
+ * Potential simple keys.
+ */
+
+static int
+yaml_parser_stale_simple_keys(yaml_parser_t *parser);
+
+static int
+yaml_parser_save_simple_key(yaml_parser_t *parser);
+
+static int
+yaml_parser_remove_simple_key(yaml_parser_t *parser);
+
+static int
+yaml_parser_increase_flow_level(yaml_parser_t *parser);
+
+static int
+yaml_parser_decrease_flow_level(yaml_parser_t *parser);
+
+/*
+ * Indentation treatment.
+ */
+
+static int
+yaml_parser_roll_indent(yaml_parser_t *parser, int column,
+ int number, yaml_token_type_t type, yaml_mark_t mark);
+
+static int
+yaml_parser_unroll_indent(yaml_parser_t *parser, int column);
+
+/*
+ * Token fetchers.
+ */
+
+static int
+yaml_parser_fetch_stream_start(yaml_parser_t *parser);
+
+static int
+yaml_parser_fetch_stream_end(yaml_parser_t *parser);
+
+static int
+yaml_parser_fetch_directive(yaml_parser_t *parser);
+
+static int
+yaml_parser_fetch_document_indicator(yaml_parser_t *parser,
+ yaml_token_type_t type);
+
+static int
+yaml_parser_fetch_flow_collection_start(yaml_parser_t *parser,
+ yaml_token_type_t type);
+
+static int
+yaml_parser_fetch_flow_collection_end(yaml_parser_t *parser,
+ yaml_token_type_t type);
+
+static int
+yaml_parser_fetch_flow_entry(yaml_parser_t *parser);
+
+static int
+yaml_parser_fetch_block_entry(yaml_parser_t *parser);
+
+static int
+yaml_parser_fetch_key(yaml_parser_t *parser);
+
+static int
+yaml_parser_fetch_value(yaml_parser_t *parser);
+
+static int
+yaml_parser_fetch_anchor(yaml_parser_t *parser, yaml_token_type_t type);
+
+static int
+yaml_parser_fetch_tag(yaml_parser_t *parser);
+
+static int
+yaml_parser_fetch_block_scalar(yaml_parser_t *parser, int literal);
+
+static int
+yaml_parser_fetch_flow_scalar(yaml_parser_t *parser, int single);
+
+static int
+yaml_parser_fetch_plain_scalar(yaml_parser_t *parser);
+
+/*
+ * Token scanners.
+ */
+
+static int
+yaml_parser_scan_to_next_token(yaml_parser_t *parser);
+
+static int
+yaml_parser_scan_directive(yaml_parser_t *parser, yaml_token_t *token);
+
+static int
+yaml_parser_scan_directive_name(yaml_parser_t *parser,
+ yaml_mark_t start_mark, yaml_char_t **name);
+
+static int
+yaml_parser_scan_version_directive_value(yaml_parser_t *parser,
+ yaml_mark_t start_mark, int *major, int *minor);
+
+static int
+yaml_parser_scan_version_directive_number(yaml_parser_t *parser,
+ yaml_mark_t start_mark, int *number);
+
+static int
+yaml_parser_scan_tag_directive_value(yaml_parser_t *parser,
+ yaml_mark_t mark, yaml_char_t **handle, yaml_char_t **prefix);
+
+static int
+yaml_parser_scan_anchor(yaml_parser_t *parser, yaml_token_t *token,
+ yaml_token_type_t type);
+
+static int
+yaml_parser_scan_tag(yaml_parser_t *parser, yaml_token_t *token);
+
+static int
+yaml_parser_scan_tag_handle(yaml_parser_t *parser, int directive,
+ yaml_mark_t start_mark, yaml_char_t **handle);
+
+static int
+yaml_parser_scan_tag_uri(yaml_parser_t *parser, int directive,
+ yaml_char_t *head, yaml_mark_t start_mark, yaml_char_t **uri);
+
+static int
+yaml_parser_scan_uri_escapes(yaml_parser_t *parser, int directive,
+ yaml_mark_t start_mark, yaml_string_t *string);
+
+static int
+yaml_parser_scan_block_scalar(yaml_parser_t *parser, yaml_token_t *token,
+ int literal);
+
+static int
+yaml_parser_scan_block_scalar_breaks(yaml_parser_t *parser,
+ int *indent, yaml_string_t *breaks,
+ yaml_mark_t start_mark, yaml_mark_t *end_mark);
+
+static int
+yaml_parser_scan_flow_scalar(yaml_parser_t *parser, yaml_token_t *token,
+ int single);
+
+static int
+yaml_parser_scan_plain_scalar(yaml_parser_t *parser, yaml_token_t *token);
+
+/*
+ * Get the next token.
+ */
+
+YAML_DECLARE(int)
+yaml_parser_scan(yaml_parser_t *parser, yaml_token_t *token)
+{
+ assert(parser); /* Non-NULL parser object is expected. */
+ assert(token); /* Non-NULL token object is expected. */
+
+ /* Erase the token object. */
+
+ memset(token, 0, sizeof(yaml_token_t));
+
+ /* No tokens after STREAM-END or error. */
+
+ if (parser->stream_end_produced || parser->error) {
+ return 1;
+ }
+
+ /* Ensure that the tokens queue contains enough tokens. */
+
+ if (!parser->token_available) {
+ if (!yaml_parser_fetch_more_tokens(parser))
+ return 0;
+ }
+
+ /* Fetch the next token from the queue. */
+
+ *token = DEQUEUE(parser, parser->tokens);
+ parser->token_available = 0;
+ parser->tokens_parsed ++;
+
+ if (token->type == YAML_STREAM_END_TOKEN) {
+ parser->stream_end_produced = 1;
+ }
+
+ return 1;
+}
+
+/*
+ * Set the scanner error and return 0.
+ */
+
+static int
+yaml_parser_set_scanner_error(yaml_parser_t *parser, const char *context,
+ yaml_mark_t context_mark, const char *problem)
+{
+ parser->error = YAML_SCANNER_ERROR;
+ parser->context = context;
+ parser->context_mark = context_mark;
+ parser->problem = problem;
+ parser->problem_mark = parser->mark;
+
+ return 0;
+}
+
+/*
+ * Ensure that the tokens queue contains at least one token which can be
+ * returned to the Parser.
+ */
+
+YAML_DECLARE(int)
+yaml_parser_fetch_more_tokens(yaml_parser_t *parser)
+{
+ int need_more_tokens;
+
+ /* While we need more tokens to fetch, do it. */
+
+ while (1)
+ {
+ /*
+ * Check if we really need to fetch more tokens.
+ */
+
+ need_more_tokens = 0;
+
+ if (parser->tokens.head == parser->tokens.tail)
+ {
+ /* Queue is empty. */
+
+ need_more_tokens = 1;
+ }
+ else
+ {
+ yaml_simple_key_t *simple_key;
+
+ /* Check if any potential simple key may occupy the head position. */
+
+ if (!yaml_parser_stale_simple_keys(parser))
+ return 0;
+
+ for (simple_key = parser->simple_keys.start;
+ simple_key != parser->simple_keys.top; simple_key++) {
+ if (simple_key->possible
+ && simple_key->token_number == parser->tokens_parsed) {
+ need_more_tokens = 1;
+ break;
+ }
+ }
+ }
+
+ /* We are finished. */
+
+ if (!need_more_tokens)
+ break;
+
+ /* Fetch the next token. */
+
+ if (!yaml_parser_fetch_next_token(parser))
+ return 0;
+ }
+
+ parser->token_available = 1;
+
+ return 1;
+}
+
+/*
+ * The dispatcher for token fetchers.
+ */
+
+static int
+yaml_parser_fetch_next_token(yaml_parser_t *parser)
+{
+ /* Ensure that the buffer is initialized. */
+
+ if (!CACHE(parser, 1))
+ return 0;
+
+ /* Check if we just started scanning. Fetch STREAM-START then. */
+
+ if (!parser->stream_start_produced)
+ return yaml_parser_fetch_stream_start(parser);
+
+ /* Eat whitespaces and comments until we reach the next token. */
+
+ if (!yaml_parser_scan_to_next_token(parser))
+ return 0;
+
+ /* Remove obsolete potential simple keys. */
+
+ if (!yaml_parser_stale_simple_keys(parser))
+ return 0;
+
+ /* Check the indentation level against the current column. */
+
+ if (!yaml_parser_unroll_indent(parser, parser->mark.column))
+ return 0;
+
+ /*
+ * Ensure that the buffer contains at least 4 characters. 4 is the length
+ * of the longest indicators ('--- ' and '... ').
+ */
+
+ if (!CACHE(parser, 4))
+ return 0;
+
+ /* Is it the end of the stream? */
+
+ if (IS_Z(parser->buffer))
+ return yaml_parser_fetch_stream_end(parser);
+
+ /* Is it a directive? */
+
+ if (parser->mark.column == 0 && CHECK(parser->buffer, '%'))
+ return yaml_parser_fetch_directive(parser);
+
+ /* Is it the document start indicator? */
+
+ if (parser->mark.column == 0
+ && CHECK_AT(parser->buffer, '-', 0)
+ && CHECK_AT(parser->buffer, '-', 1)
+ && CHECK_AT(parser->buffer, '-', 2)
+ && IS_BLANKZ_AT(parser->buffer, 3))
+ return yaml_parser_fetch_document_indicator(parser,
+ YAML_DOCUMENT_START_TOKEN);
+
+ /* Is it the document end indicator? */
+
+ if (parser->mark.column == 0
+ && CHECK_AT(parser->buffer, '.', 0)
+ && CHECK_AT(parser->buffer, '.', 1)
+ && CHECK_AT(parser->buffer, '.', 2)
+ && IS_BLANKZ_AT(parser->buffer, 3))
+ return yaml_parser_fetch_document_indicator(parser,
+ YAML_DOCUMENT_END_TOKEN);
+
+ /* Is it the flow sequence start indicator? */
+
+ if (CHECK(parser->buffer, '['))
+ return yaml_parser_fetch_flow_collection_start(parser,
+ YAML_FLOW_SEQUENCE_START_TOKEN);
+
+ /* Is it the flow mapping start indicator? */
+
+ if (CHECK(parser->buffer, '{'))
+ return yaml_parser_fetch_flow_collection_start(parser,
+ YAML_FLOW_MAPPING_START_TOKEN);
+
+ /* Is it the flow sequence end indicator? */
+
+ if (CHECK(parser->buffer, ']'))
+ return yaml_parser_fetch_flow_collection_end(parser,
+ YAML_FLOW_SEQUENCE_END_TOKEN);
+
+ /* Is it the flow mapping end indicator? */
+
+ if (CHECK(parser->buffer, '}'))
+ return yaml_parser_fetch_flow_collection_end(parser,
+ YAML_FLOW_MAPPING_END_TOKEN);
+
+ /* Is it the flow entry indicator? */
+
+ if (CHECK(parser->buffer, ','))
+ return yaml_parser_fetch_flow_entry(parser);
+
+ /* Is it the block entry indicator? */
+
+ if (CHECK(parser->buffer, '-') && IS_BLANKZ_AT(parser->buffer, 1))
+ return yaml_parser_fetch_block_entry(parser);
+
+ /* Is it the key indicator? */
+
+ if (CHECK(parser->buffer, '?')
+ && (parser->flow_level || IS_BLANKZ_AT(parser->buffer, 1)))
+ return yaml_parser_fetch_key(parser);
+
+ /* Is it the value indicator? */
+
+ if (CHECK(parser->buffer, ':')
+ && (parser->flow_level || IS_BLANKZ_AT(parser->buffer, 1)))
+ return yaml_parser_fetch_value(parser);
+
+ /* Is it an alias? */
+
+ if (CHECK(parser->buffer, '*'))
+ return yaml_parser_fetch_anchor(parser, YAML_ALIAS_TOKEN);
+
+ /* Is it an anchor? */
+
+ if (CHECK(parser->buffer, '&'))
+ return yaml_parser_fetch_anchor(parser, YAML_ANCHOR_TOKEN);
+
+ /* Is it a tag? */
+
+ if (CHECK(parser->buffer, '!'))
+ return yaml_parser_fetch_tag(parser);
+
+ /* Is it a literal scalar? */
+
+ if (CHECK(parser->buffer, '|') && !parser->flow_level)
+ return yaml_parser_fetch_block_scalar(parser, 1);
+
+ /* Is it a folded scalar? */
+
+ if (CHECK(parser->buffer, '>') && !parser->flow_level)
+ return yaml_parser_fetch_block_scalar(parser, 0);
+
+ /* Is it a single-quoted scalar? */
+
+ if (CHECK(parser->buffer, '\''))
+ return yaml_parser_fetch_flow_scalar(parser, 1);
+
+ /* Is it a double-quoted scalar? */
+
+ if (CHECK(parser->buffer, '"'))
+ return yaml_parser_fetch_flow_scalar(parser, 0);
+
+ /*
+ * Is it a plain scalar?
+ *
+ * A plain scalar may start with any non-blank characters except
+ *
+ * '-', '?', ':', ',', '[', ']', '{', '}',
+ * '#', '&', '*', '!', '|', '>', '\'', '\"',
+ * '%', '@', '`'.
+ *
+ * In the block context (and, for the '-' indicator, in the flow context
+ * too), it may also start with the characters
+ *
+ * '-', '?', ':'
+ *
+ * if it is followed by a non-space character.
+ *
+ * The last rule is more restrictive than the specification requires.
+ */
+
+ if (!(IS_BLANKZ(parser->buffer) || CHECK(parser->buffer, '-')
+ || CHECK(parser->buffer, '?') || CHECK(parser->buffer, ':')
+ || CHECK(parser->buffer, ',') || CHECK(parser->buffer, '[')
+ || CHECK(parser->buffer, ']') || CHECK(parser->buffer, '{')
+ || CHECK(parser->buffer, '}') || CHECK(parser->buffer, '#')
+ || CHECK(parser->buffer, '&') || CHECK(parser->buffer, '*')
+ || CHECK(parser->buffer, '!') || CHECK(parser->buffer, '|')
+ || CHECK(parser->buffer, '>') || CHECK(parser->buffer, '\'')
+ || CHECK(parser->buffer, '"') || CHECK(parser->buffer, '%')
+ || CHECK(parser->buffer, '@') || CHECK(parser->buffer, '`')) ||
+ (CHECK(parser->buffer, '-') && !IS_BLANK_AT(parser->buffer, 1)) ||
+ (!parser->flow_level &&
+ (CHECK(parser->buffer, '?') || CHECK(parser->buffer, ':'))
+ && !IS_BLANKZ_AT(parser->buffer, 1)))
+ return yaml_parser_fetch_plain_scalar(parser);
+
+ /*
+ * If we don't determine the token type so far, it is an error.
+ */
+
+ return yaml_parser_set_scanner_error(parser,
+ "while scanning for the next token", parser->mark,
+ "found character that cannot start any token");
+}
+
+/*
+ * Check the list of potential simple keys and remove the positions that
+ * cannot contain simple keys anymore.
+ */
+
+static int
+yaml_parser_stale_simple_keys(yaml_parser_t *parser)
+{
+ yaml_simple_key_t *simple_key;
+
+ /* Check for a potential simple key for each flow level. */
+
+ for (simple_key = parser->simple_keys.start;
+ simple_key != parser->simple_keys.top; simple_key ++)
+ {
+ /*
+ * The specification requires that a simple key
+ *
+ * - is limited to a single line,
+ * - is shorter than 1024 characters.
+ */
+
+ if (simple_key->possible
+ && (simple_key->mark.line < parser->mark.line
+ || simple_key->mark.index+1024 < parser->mark.index)) {
+
+ /* Check if the potential simple key to be removed is required. */
+
+ if (simple_key->required) {
+ return yaml_parser_set_scanner_error(parser,
+ "while scanning a simple key", simple_key->mark,
+ "could not find expected ':'");
+ }
+
+ simple_key->possible = 0;
+ }
+ }
+
+ return 1;
+}
+
+/*
+ * Check if a simple key may start at the current position and add it if
+ * needed.
+ */
+
+static int
+yaml_parser_save_simple_key(yaml_parser_t *parser)
+{
+ /*
+ * A simple key is required at the current position if the scanner is in
+ * the block context and the current column coincides with the indentation
+ * level.
+ */
+
+ int required = (!parser->flow_level
+ && parser->indent == (int)parser->mark.column);
+
+ /*
+ * A simple key is required only when it is the first token in the current
+ * line. Therefore it is always allowed. But we add a check anyway.
+ */
+
+ assert(parser->simple_key_allowed || !required); /* Impossible. */
+
+ /*
+ * If the current position may start a simple key, save it.
+ */
+
+ if (parser->simple_key_allowed)
+ {
+ yaml_simple_key_t simple_key;
+ simple_key.possible = 1;
+ simple_key.required = required;
+ simple_key.token_number =
+ parser->tokens_parsed + (parser->tokens.tail - parser->tokens.head);
+ simple_key.mark = parser->mark;
+
+ if (!yaml_parser_remove_simple_key(parser)) return 0;
+
+ *(parser->simple_keys.top-1) = simple_key;
+ }
+
+ return 1;
+}
+
+/*
+ * Remove a potential simple key at the current flow level.
+ */
+
+static int
+yaml_parser_remove_simple_key(yaml_parser_t *parser)
+{
+ yaml_simple_key_t *simple_key = parser->simple_keys.top-1;
+
+ if (simple_key->possible)
+ {
+ /* If the key is required, it is an error. */
+
+ if (simple_key->required) {
+ return yaml_parser_set_scanner_error(parser,
+ "while scanning a simple key", simple_key->mark,
+ "could not find expected ':'");
+ }
+ }
+
+ /* Remove the key from the stack. */
+
+ simple_key->possible = 0;
+
+ return 1;
+}
+
+/*
+ * Increase the flow level and resize the simple key list if needed.
+ */
+
+static int
+yaml_parser_increase_flow_level(yaml_parser_t *parser)
+{
+ yaml_simple_key_t empty_simple_key = { 0, 0, 0, { 0, 0, 0 } };
+
+ /* Reset the simple key on the next level. */
+
+ if (!PUSH(parser, parser->simple_keys, empty_simple_key))
+ return 0;
+
+ /* Increase the flow level. */
+
+ parser->flow_level++;
+
+ return 1;
+}
+
+/*
+ * Decrease the flow level.
+ */
+
+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);
+ }
+
+ return 1;
+}
+
+/*
+ * Push the current indentation level to the stack and set the new level
+ * the current column is greater than the indentation level. In this case,
+ * append or insert the specified token into the token queue.
+ *
+ */
+
+static int
+yaml_parser_roll_indent(yaml_parser_t *parser, int column,
+ int number, yaml_token_type_t type, yaml_mark_t mark)
+{
+ yaml_token_t token;
+
+ /* In the flow context, do nothing. */
+
+ if (parser->flow_level)
+ return 1;
+
+ if (parser->indent < column)
+ {
+ /*
+ * Push the current indentation level to the stack and set the new
+ * indentation level.
+ */
+
+ if (!PUSH(parser, parser->indents, parser->indent))
+ return 0;
+
+ parser->indent = column;
+
+ /* Create a token and insert it into the queue. */
+
+ TOKEN_INIT(token, type, mark, mark);
+
+ if (number == -1) {
+ if (!ENQUEUE(parser, parser->tokens, token))
+ return 0;
+ }
+ else {
+ if (!QUEUE_INSERT(parser,
+ parser->tokens, number - parser->tokens_parsed, token))
+ return 0;
+ }
+ }
+
+ return 1;
+}
+
+/*
+ * Pop indentation levels from the indents stack until the current level
+ * becomes less or equal to the column. For each indentation level, append
+ * the BLOCK-END token.
+ */
+
+
+static int
+yaml_parser_unroll_indent(yaml_parser_t *parser, int column)
+{
+ yaml_token_t token;
+
+ /* In the flow context, do nothing. */
+
+ if (parser->flow_level)
+ return 1;
+
+ /* Loop through the indentation levels in the stack. */
+
+ while (parser->indent > column)
+ {
+ /* Create a token and append it to the queue. */
+
+ TOKEN_INIT(token, YAML_BLOCK_END_TOKEN, parser->mark, parser->mark);
+
+ if (!ENQUEUE(parser, parser->tokens, token))
+ return 0;
+
+ /* Pop the indentation level. */
+
+ parser->indent = POP(parser, parser->indents);
+ }
+
+ return 1;
+}
+
+/*
+ * Initialize the scanner and produce the STREAM-START token.
+ */
+
+static int
+yaml_parser_fetch_stream_start(yaml_parser_t *parser)
+{
+ yaml_simple_key_t simple_key = { 0, 0, 0, { 0, 0, 0 } };
+ yaml_token_t token;
+
+ /* Set the initial indentation. */
+
+ parser->indent = -1;
+
+ /* Initialize the simple key stack. */
+
+ if (!PUSH(parser, parser->simple_keys, simple_key))
+ return 0;
+
+ /* A simple key is allowed at the beginning of the stream. */
+
+ parser->simple_key_allowed = 1;
+
+ /* We have started. */
+
+ parser->stream_start_produced = 1;
+
+ /* Create the STREAM-START token and append it to the queue. */
+
+ STREAM_START_TOKEN_INIT(token, parser->encoding,
+ parser->mark, parser->mark);
+
+ if (!ENQUEUE(parser, parser->tokens, token))
+ return 0;
+
+ return 1;
+}
+
+/*
+ * Produce the STREAM-END token and shut down the scanner.
+ */
+
+static int
+yaml_parser_fetch_stream_end(yaml_parser_t *parser)
+{
+ yaml_token_t token;
+
+ /* Force new line. */
+
+ if (parser->mark.column != 0) {
+ parser->mark.column = 0;
+ parser->mark.line ++;
+ }
+
+ /* Reset the indentation level. */
+
+ if (!yaml_parser_unroll_indent(parser, -1))
+ return 0;
+
+ /* Reset simple keys. */
+
+ if (!yaml_parser_remove_simple_key(parser))
+ return 0;
+
+ parser->simple_key_allowed = 0;
+
+ /* Create the STREAM-END token and append it to the queue. */
+
+ STREAM_END_TOKEN_INIT(token, parser->mark, parser->mark);
+
+ if (!ENQUEUE(parser, parser->tokens, token))
+ return 0;
+
+ return 1;
+}
+
+/*
+ * Produce a VERSION-DIRECTIVE or TAG-DIRECTIVE token.
+ */
+
+static int
+yaml_parser_fetch_directive(yaml_parser_t *parser)
+{
+ yaml_token_t token;
+
+ /* Reset the indentation level. */
+
+ if (!yaml_parser_unroll_indent(parser, -1))
+ return 0;
+
+ /* Reset simple keys. */
+
+ if (!yaml_parser_remove_simple_key(parser))
+ return 0;
+
+ parser->simple_key_allowed = 0;
+
+ /* Create the YAML-DIRECTIVE or TAG-DIRECTIVE token. */
+
+ if (!yaml_parser_scan_directive(parser, &token))
+ return 0;
+
+ /* Append the token to the queue. */
+
+ if (!ENQUEUE(parser, parser->tokens, token)) {
+ yaml_token_delete(&token);
+ return 0;
+ }
+
+ return 1;
+}
+
+/*
+ * Produce the DOCUMENT-START or DOCUMENT-END token.
+ */
+
+static int
+yaml_parser_fetch_document_indicator(yaml_parser_t *parser,
+ yaml_token_type_t type)
+{
+ yaml_mark_t start_mark, end_mark;
+ yaml_token_t token;
+
+ /* Reset the indentation level. */
+
+ if (!yaml_parser_unroll_indent(parser, -1))
+ return 0;
+
+ /* Reset simple keys. */
+
+ if (!yaml_parser_remove_simple_key(parser))
+ return 0;
+
+ parser->simple_key_allowed = 0;
+
+ /* Consume the token. */
+
+ start_mark = parser->mark;
+
+ SKIP(parser);
+ SKIP(parser);
+ SKIP(parser);
+
+ end_mark = parser->mark;
+
+ /* Create the DOCUMENT-START or DOCUMENT-END token. */
+
+ TOKEN_INIT(token, type, start_mark, end_mark);
+
+ /* Append the token to the queue. */
+
+ if (!ENQUEUE(parser, parser->tokens, token))
+ return 0;
+
+ return 1;
+}
+
+/*
+ * Produce the FLOW-SEQUENCE-START or FLOW-MAPPING-START token.
+ */
+
+static int
+yaml_parser_fetch_flow_collection_start(yaml_parser_t *parser,
+ yaml_token_type_t type)
+{
+ yaml_mark_t start_mark, end_mark;
+ yaml_token_t token;
+
+ /* The indicators '[' and '{' may start a simple key. */
+
+ if (!yaml_parser_save_simple_key(parser))
+ return 0;
+
+ /* Increase the flow level. */
+
+ if (!yaml_parser_increase_flow_level(parser))
+ return 0;
+
+ /* A simple key may follow the indicators '[' and '{'. */
+
+ parser->simple_key_allowed = 1;
+
+ /* Consume the token. */
+
+ start_mark = parser->mark;
+ SKIP(parser);
+ end_mark = parser->mark;
+
+ /* Create the FLOW-SEQUENCE-START of FLOW-MAPPING-START token. */
+
+ TOKEN_INIT(token, type, start_mark, end_mark);
+
+ /* Append the token to the queue. */
+
+ if (!ENQUEUE(parser, parser->tokens, token))
+ return 0;
+
+ return 1;
+}
+
+/*
+ * Produce the FLOW-SEQUENCE-END or FLOW-MAPPING-END token.
+ */
+
+static int
+yaml_parser_fetch_flow_collection_end(yaml_parser_t *parser,
+ yaml_token_type_t type)
+{
+ yaml_mark_t start_mark, end_mark;
+ yaml_token_t token;
+
+ /* Reset any potential simple key on the current flow level. */
+
+ if (!yaml_parser_remove_simple_key(parser))
+ return 0;
+
+ /* Decrease the flow level. */
+
+ if (!yaml_parser_decrease_flow_level(parser))
+ return 0;
+
+ /* No simple keys after the indicators ']' and '}'. */
+
+ parser->simple_key_allowed = 0;
+
+ /* Consume the token. */
+
+ start_mark = parser->mark;
+ SKIP(parser);
+ end_mark = parser->mark;
+
+ /* Create the FLOW-SEQUENCE-END of FLOW-MAPPING-END token. */
+
+ TOKEN_INIT(token, type, start_mark, end_mark);
+
+ /* Append the token to the queue. */
+
+ if (!ENQUEUE(parser, parser->tokens, token))
+ return 0;
+
+ return 1;
+}
+
+/*
+ * Produce the FLOW-ENTRY token.
+ */
+
+static int
+yaml_parser_fetch_flow_entry(yaml_parser_t *parser)
+{
+ yaml_mark_t start_mark, end_mark;
+ yaml_token_t token;
+
+ /* Reset any potential simple keys on the current flow level. */
+
+ if (!yaml_parser_remove_simple_key(parser))
+ return 0;
+
+ /* Simple keys are allowed after ','. */
+
+ parser->simple_key_allowed = 1;
+
+ /* Consume the token. */
+
+ start_mark = parser->mark;
+ SKIP(parser);
+ end_mark = parser->mark;
+
+ /* Create the FLOW-ENTRY token and append it to the queue. */
+
+ TOKEN_INIT(token, YAML_FLOW_ENTRY_TOKEN, start_mark, end_mark);
+
+ if (!ENQUEUE(parser, parser->tokens, token))
+ return 0;
+
+ return 1;
+}
+
+/*
+ * Produce the BLOCK-ENTRY token.
+ */
+
+static int
+yaml_parser_fetch_block_entry(yaml_parser_t *parser)
+{
+ yaml_mark_t start_mark, end_mark;
+ yaml_token_t token;
+
+ /* Check if the scanner is in the block context. */
+
+ if (!parser->flow_level)
+ {
+ /* Check if we are allowed to start a new entry. */
+
+ if (!parser->simple_key_allowed) {
+ return yaml_parser_set_scanner_error(parser, NULL, parser->mark,
+ "block sequence entries are not allowed in this context");
+ }
+
+ /* Add the BLOCK-SEQUENCE-START token if needed. */
+
+ if (!yaml_parser_roll_indent(parser, parser->mark.column, -1,
+ YAML_BLOCK_SEQUENCE_START_TOKEN, parser->mark))
+ return 0;
+ }
+ else
+ {
+ /*
+ * It is an error for the '-' indicator to occur in the flow context,
+ * but we let the Parser detect and report about it because the Parser
+ * is able to point to the context.
+ */
+ }
+
+ /* Reset any potential simple keys on the current flow level. */
+
+ if (!yaml_parser_remove_simple_key(parser))
+ return 0;
+
+ /* Simple keys are allowed after '-'. */
+
+ parser->simple_key_allowed = 1;
+
+ /* Consume the token. */
+
+ start_mark = parser->mark;
+ SKIP(parser);
+ end_mark = parser->mark;
+
+ /* Create the BLOCK-ENTRY token and append it to the queue. */
+
+ TOKEN_INIT(token, YAML_BLOCK_ENTRY_TOKEN, start_mark, end_mark);
+
+ if (!ENQUEUE(parser, parser->tokens, token))
+ return 0;
+
+ return 1;
+}
+
+/*
+ * Produce the KEY token.
+ */
+
+static int
+yaml_parser_fetch_key(yaml_parser_t *parser)
+{
+ yaml_mark_t start_mark, end_mark;
+ yaml_token_t token;
+
+ /* In the block context, additional checks are required. */
+
+ if (!parser->flow_level)
+ {
+ /* Check if we are allowed to start a new key (not nessesary simple). */
+
+ if (!parser->simple_key_allowed) {
+ return yaml_parser_set_scanner_error(parser, NULL, parser->mark,
+ "mapping keys are not allowed in this context");
+ }
+
+ /* Add the BLOCK-MAPPING-START token if needed. */
+
+ if (!yaml_parser_roll_indent(parser, parser->mark.column, -1,
+ YAML_BLOCK_MAPPING_START_TOKEN, parser->mark))
+ return 0;
+ }
+
+ /* Reset any potential simple keys on the current flow level. */
+
+ if (!yaml_parser_remove_simple_key(parser))
+ return 0;
+
+ /* Simple keys are allowed after '?' in the block context. */
+
+ parser->simple_key_allowed = (!parser->flow_level);
+
+ /* Consume the token. */
+
+ start_mark = parser->mark;
+ SKIP(parser);
+ end_mark = parser->mark;
+
+ /* Create the KEY token and append it to the queue. */
+
+ TOKEN_INIT(token, YAML_KEY_TOKEN, start_mark, end_mark);
+
+ if (!ENQUEUE(parser, parser->tokens, token))
+ return 0;
+
+ return 1;
+}
+
+/*
+ * Produce the VALUE token.
+ */
+
+static int
+yaml_parser_fetch_value(yaml_parser_t *parser)
+{
+ yaml_mark_t start_mark, end_mark;
+ yaml_token_t token;
+ yaml_simple_key_t *simple_key = parser->simple_keys.top-1;
+
+ /* Have we found a simple key? */
+
+ if (simple_key->possible)
+ {
+
+ /* Create the KEY token and insert it into the queue. */
+
+ TOKEN_INIT(token, YAML_KEY_TOKEN, simple_key->mark, simple_key->mark);
+
+ if (!QUEUE_INSERT(parser, parser->tokens,
+ simple_key->token_number - parser->tokens_parsed, token))
+ return 0;
+
+ /* In the block context, we may need to add the BLOCK-MAPPING-START token. */
+
+ if (!yaml_parser_roll_indent(parser, simple_key->mark.column,
+ simple_key->token_number,
+ YAML_BLOCK_MAPPING_START_TOKEN, simple_key->mark))
+ return 0;
+
+ /* Remove the simple key. */
+
+ simple_key->possible = 0;
+
+ /* A simple key cannot follow another simple key. */
+
+ parser->simple_key_allowed = 0;
+ }
+ else
+ {
+ /* The ':' indicator follows a complex key. */
+
+ /* In the block context, extra checks are required. */
+
+ if (!parser->flow_level)
+ {
+ /* Check if we are allowed to start a complex value. */
+
+ if (!parser->simple_key_allowed) {
+ return yaml_parser_set_scanner_error(parser, NULL, parser->mark,
+ "mapping values are not allowed in this context");
+ }
+
+ /* Add the BLOCK-MAPPING-START token if needed. */
+
+ if (!yaml_parser_roll_indent(parser, parser->mark.column, -1,
+ YAML_BLOCK_MAPPING_START_TOKEN, parser->mark))
+ return 0;
+ }
+
+ /* Simple keys after ':' are allowed in the block context. */
+
+ parser->simple_key_allowed = (!parser->flow_level);
+ }
+
+ /* Consume the token. */
+
+ start_mark = parser->mark;
+ SKIP(parser);
+ end_mark = parser->mark;
+
+ /* Create the VALUE token and append it to the queue. */
+
+ TOKEN_INIT(token, YAML_VALUE_TOKEN, start_mark, end_mark);
+
+ if (!ENQUEUE(parser, parser->tokens, token))
+ return 0;
+
+ return 1;
+}
+
+/*
+ * Produce the ALIAS or ANCHOR token.
+ */
+
+static int
+yaml_parser_fetch_anchor(yaml_parser_t *parser, yaml_token_type_t type)
+{
+ yaml_token_t token;
+
+ /* An anchor or an alias could be a simple key. */
+
+ if (!yaml_parser_save_simple_key(parser))
+ return 0;
+
+ /* A simple key cannot follow an anchor or an alias. */
+
+ parser->simple_key_allowed = 0;
+
+ /* Create the ALIAS or ANCHOR token and append it to the queue. */
+
+ if (!yaml_parser_scan_anchor(parser, &token, type))
+ return 0;
+
+ if (!ENQUEUE(parser, parser->tokens, token)) {
+ yaml_token_delete(&token);
+ return 0;
+ }
+ return 1;
+}
+
+/*
+ * Produce the TAG token.
+ */
+
+static int
+yaml_parser_fetch_tag(yaml_parser_t *parser)
+{
+ yaml_token_t token;
+
+ /* A tag could be a simple key. */
+
+ if (!yaml_parser_save_simple_key(parser))
+ return 0;
+
+ /* A simple key cannot follow a tag. */
+
+ parser->simple_key_allowed = 0;
+
+ /* Create the TAG token and append it to the queue. */
+
+ if (!yaml_parser_scan_tag(parser, &token))
+ return 0;
+
+ if (!ENQUEUE(parser, parser->tokens, token)) {
+ yaml_token_delete(&token);
+ return 0;
+ }
+
+ return 1;
+}
+
+/*
+ * Produce the SCALAR(...,literal) or SCALAR(...,folded) tokens.
+ */
+
+static int
+yaml_parser_fetch_block_scalar(yaml_parser_t *parser, int literal)
+{
+ yaml_token_t token;
+
+ /* Remove any potential simple keys. */
+
+ if (!yaml_parser_remove_simple_key(parser))
+ return 0;
+
+ /* A simple key may follow a block scalar. */
+
+ parser->simple_key_allowed = 1;
+
+ /* Create the SCALAR token and append it to the queue. */
+
+ if (!yaml_parser_scan_block_scalar(parser, &token, literal))
+ return 0;
+
+ if (!ENQUEUE(parser, parser->tokens, token)) {
+ yaml_token_delete(&token);
+ return 0;
+ }
+
+ return 1;
+}
+
+/*
+ * Produce the SCALAR(...,single-quoted) or SCALAR(...,double-quoted) tokens.
+ */
+
+static int
+yaml_parser_fetch_flow_scalar(yaml_parser_t *parser, int single)
+{
+ yaml_token_t token;
+
+ /* A plain scalar could be a simple key. */
+
+ if (!yaml_parser_save_simple_key(parser))
+ return 0;
+
+ /* A simple key cannot follow a flow scalar. */
+
+ parser->simple_key_allowed = 0;
+
+ /* Create the SCALAR token and append it to the queue. */
+
+ if (!yaml_parser_scan_flow_scalar(parser, &token, single))
+ return 0;
+
+ if (!ENQUEUE(parser, parser->tokens, token)) {
+ yaml_token_delete(&token);
+ return 0;
+ }
+
+ return 1;
+}
+
+/*
+ * Produce the SCALAR(...,plain) token.
+ */
+
+static int
+yaml_parser_fetch_plain_scalar(yaml_parser_t *parser)
+{
+ yaml_token_t token;
+
+ /* A plain scalar could be a simple key. */
+
+ if (!yaml_parser_save_simple_key(parser))
+ return 0;
+
+ /* A simple key cannot follow a flow scalar. */
+
+ parser->simple_key_allowed = 0;
+
+ /* Create the SCALAR token and append it to the queue. */
+
+ if (!yaml_parser_scan_plain_scalar(parser, &token))
+ return 0;
+
+ if (!ENQUEUE(parser, parser->tokens, token)) {
+ yaml_token_delete(&token);
+ return 0;
+ }
+
+ return 1;
+}
+
+/*
+ * Eat whitespaces and comments until the next token is found.
+ */
+
+static int
+yaml_parser_scan_to_next_token(yaml_parser_t *parser)
+{
+ /* Until the next token is not found. */
+
+ while (1)
+ {
+ /* Allow the BOM mark to start a line. */
+
+ if (!CACHE(parser, 1)) return 0;
+
+ if (parser->mark.column == 0 && IS_BOM(parser->buffer))
+ SKIP(parser);
+
+ /*
+ * Eat whitespaces.
+ *
+ * Tabs are allowed:
+ *
+ * - in the flow context;
+ * - in the block context, but not at the beginning of the line or
+ * after '-', '?', or ':' (complex value).
+ */
+
+ if (!CACHE(parser, 1)) return 0;
+
+ while (CHECK(parser->buffer,' ') ||
+ ((parser->flow_level || !parser->simple_key_allowed) &&
+ CHECK(parser->buffer, '\t'))) {
+ SKIP(parser);
+ if (!CACHE(parser, 1)) return 0;
+ }
+
+ /* Eat a comment until a line break. */
+
+ if (CHECK(parser->buffer, '#')) {
+ while (!IS_BREAKZ(parser->buffer)) {
+ SKIP(parser);
+ if (!CACHE(parser, 1)) return 0;
+ }
+ }
+
+ /* If it is a line break, eat it. */
+
+ if (IS_BREAK(parser->buffer))
+ {
+ if (!CACHE(parser, 2)) return 0;
+ SKIP_LINE(parser);
+
+ /* In the block context, a new line may start a simple key. */
+
+ if (!parser->flow_level) {
+ parser->simple_key_allowed = 1;
+ }
+ }
+ else
+ {
+ /* We have found a token. */
+
+ break;
+ }
+ }
+
+ return 1;
+}
+
+/*
+ * Scan a YAML-DIRECTIVE or TAG-DIRECTIVE token.
+ *
+ * Scope:
+ * %YAML 1.1 # a comment \n
+ * ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ * %TAG !yaml! tag:yaml.org,2002: \n
+ * ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ */
+
+int
+yaml_parser_scan_directive(yaml_parser_t *parser, yaml_token_t *token)
+{
+ yaml_mark_t start_mark, end_mark;
+ yaml_char_t *name = NULL;
+ int major, minor;
+ yaml_char_t *handle = NULL, *prefix = NULL;
+
+ /* Eat '%'. */
+
+ start_mark = parser->mark;
+
+ SKIP(parser);
+
+ /* Scan the directive name. */
+
+ if (!yaml_parser_scan_directive_name(parser, start_mark, &name))
+ goto error;
+
+ /* Is it a YAML directive? */
+
+ if (strcmp((char *)name, "YAML") == 0)
+ {
+ /* Scan the VERSION directive value. */
+
+ if (!yaml_parser_scan_version_directive_value(parser, start_mark,
+ &major, &minor))
+ goto error;
+
+ end_mark = parser->mark;
+
+ /* Create a VERSION-DIRECTIVE token. */
+
+ VERSION_DIRECTIVE_TOKEN_INIT(*token, major, minor,
+ start_mark, end_mark);
+ }
+
+ /* Is it a TAG directive? */
+
+ else if (strcmp((char *)name, "TAG") == 0)
+ {
+ /* Scan the TAG directive value. */
+
+ if (!yaml_parser_scan_tag_directive_value(parser, start_mark,
+ &handle, &prefix))
+ goto error;
+
+ end_mark = parser->mark;
+
+ /* Create a TAG-DIRECTIVE token. */
+
+ TAG_DIRECTIVE_TOKEN_INIT(*token, handle, prefix,
+ start_mark, end_mark);
+ }
+
+ /* Unknown directive. */
+
+ else
+ {
+ yaml_parser_set_scanner_error(parser, "while scanning a directive",
+ start_mark, "found uknown directive name");
+ goto error;
+ }
+
+ /* Eat the rest of the line including any comments. */
+
+ if (!CACHE(parser, 1)) goto error;
+
+ while (IS_BLANK(parser->buffer)) {
+ SKIP(parser);
+ if (!CACHE(parser, 1)) goto error;
+ }
+
+ if (CHECK(parser->buffer, '#')) {
+ while (!IS_BREAKZ(parser->buffer)) {
+ SKIP(parser);
+ if (!CACHE(parser, 1)) goto error;
+ }
+ }
+
+ /* Check if we are at the end of the line. */
+
+ if (!IS_BREAKZ(parser->buffer)) {
+ yaml_parser_set_scanner_error(parser, "while scanning a directive",
+ start_mark, "did not find expected comment or line break");
+ goto error;
+ }
+
+ /* Eat a line break. */
+
+ if (IS_BREAK(parser->buffer)) {
+ if (!CACHE(parser, 2)) goto error;
+ SKIP_LINE(parser);
+ }
+
+ yaml_free(name);
+
+ return 1;
+
+error:
+ yaml_free(prefix);
+ yaml_free(handle);
+ yaml_free(name);
+ return 0;
+}
+
+/*
+ * Scan the directive name.
+ *
+ * Scope:
+ * %YAML 1.1 # a comment \n
+ * ^^^^
+ * %TAG !yaml! tag:yaml.org,2002: \n
+ * ^^^
+ */
+
+static int
+yaml_parser_scan_directive_name(yaml_parser_t *parser,
+ yaml_mark_t start_mark, yaml_char_t **name)
+{
+ yaml_string_t string = NULL_STRING;
+
+ if (!STRING_INIT(parser, string, INITIAL_STRING_SIZE)) goto error;
+
+ /* Consume the directive name. */
+
+ if (!CACHE(parser, 1)) goto error;
+
+ while (IS_ALPHA(parser->buffer))
+ {
+ if (!READ(parser, string)) goto error;
+ if (!CACHE(parser, 1)) goto error;
+ }
+
+ /* Check if the name is empty. */
+
+ if (string.start == string.pointer) {
+ yaml_parser_set_scanner_error(parser, "while scanning a directive",
+ start_mark, "could not find expected directive name");
+ goto error;
+ }
+
+ /* Check for an blank character after the name. */
+
+ if (!IS_BLANKZ(parser->buffer)) {
+ yaml_parser_set_scanner_error(parser, "while scanning a directive",
+ start_mark, "found unexpected non-alphabetical character");
+ goto error;
+ }
+
+ *name = string.start;
+
+ return 1;
+
+error:
+ STRING_DEL(parser, string);
+ return 0;
+}
+
+/*
+ * Scan the value of VERSION-DIRECTIVE.
+ *
+ * Scope:
+ * %YAML 1.1 # a comment \n
+ * ^^^^^^
+ */
+
+static int
+yaml_parser_scan_version_directive_value(yaml_parser_t *parser,
+ yaml_mark_t start_mark, int *major, int *minor)
+{
+ /* Eat whitespaces. */
+
+ if (!CACHE(parser, 1)) return 0;
+
+ while (IS_BLANK(parser->buffer)) {
+ SKIP(parser);
+ if (!CACHE(parser, 1)) return 0;
+ }
+
+ /* Consume the major version number. */
+
+ if (!yaml_parser_scan_version_directive_number(parser, start_mark, major))
+ return 0;
+
+ /* Eat '.'. */
+
+ if (!CHECK(parser->buffer, '.')) {
+ return yaml_parser_set_scanner_error(parser, "while scanning a %YAML directive",
+ start_mark, "did not find expected digit or '.' character");
+ }
+
+ SKIP(parser);
+
+ /* Consume the minor version number. */
+
+ if (!yaml_parser_scan_version_directive_number(parser, start_mark, minor))
+ return 0;
+
+ return 1;
+}
+
+#define MAX_NUMBER_LENGTH 9
+
+/*
+ * Scan the version number of VERSION-DIRECTIVE.
+ *
+ * Scope:
+ * %YAML 1.1 # a comment \n
+ * ^
+ * %YAML 1.1 # a comment \n
+ * ^
+ */
+
+static int
+yaml_parser_scan_version_directive_number(yaml_parser_t *parser,
+ yaml_mark_t start_mark, int *number)
+{
+ int value = 0;
+ size_t length = 0;
+
+ /* Repeat while the next character is digit. */
+
+ if (!CACHE(parser, 1)) return 0;
+
+ while (IS_DIGIT(parser->buffer))
+ {
+ /* Check if the number is too long. */
+
+ if (++length > MAX_NUMBER_LENGTH) {
+ return yaml_parser_set_scanner_error(parser, "while scanning a %YAML directive",
+ start_mark, "found extremely long version number");
+ }
+
+ value = value*10 + AS_DIGIT(parser->buffer);
+
+ SKIP(parser);
+
+ if (!CACHE(parser, 1)) return 0;
+ }
+
+ /* Check if the number was present. */
+
+ if (!length) {
+ return yaml_parser_set_scanner_error(parser, "while scanning a %YAML directive",
+ start_mark, "did not find expected version number");
+ }
+
+ *number = value;
+
+ return 1;
+}
+
+/*
+ * Scan the value of a TAG-DIRECTIVE token.
+ *
+ * Scope:
+ * %TAG !yaml! tag:yaml.org,2002: \n
+ * ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ */
+
+static int
+yaml_parser_scan_tag_directive_value(yaml_parser_t *parser,
+ yaml_mark_t start_mark, yaml_char_t **handle, yaml_char_t **prefix)
+{
+ yaml_char_t *handle_value = NULL;
+ yaml_char_t *prefix_value = NULL;
+
+ /* Eat whitespaces. */
+
+ if (!CACHE(parser, 1)) goto error;
+
+ while (IS_BLANK(parser->buffer)) {
+ SKIP(parser);
+ if (!CACHE(parser, 1)) goto error;
+ }
+
+ /* Scan a handle. */
+
+ if (!yaml_parser_scan_tag_handle(parser, 1, start_mark, &handle_value))
+ goto error;
+
+ /* Expect a whitespace. */
+
+ if (!CACHE(parser, 1)) goto error;
+
+ if (!IS_BLANK(parser->buffer)) {
+ yaml_parser_set_scanner_error(parser, "while scanning a %TAG directive",
+ start_mark, "did not find expected whitespace");
+ goto error;
+ }
+
+ /* Eat whitespaces. */
+
+ while (IS_BLANK(parser->buffer)) {
+ SKIP(parser);
+ if (!CACHE(parser, 1)) goto error;
+ }
+
+ /* Scan a prefix. */
+
+ if (!yaml_parser_scan_tag_uri(parser, 1, NULL, start_mark, &prefix_value))
+ goto error;
+
+ /* Expect a whitespace or line break. */
+
+ if (!CACHE(parser, 1)) goto error;
+
+ if (!IS_BLANKZ(parser->buffer)) {
+ yaml_parser_set_scanner_error(parser, "while scanning a %TAG directive",
+ start_mark, "did not find expected whitespace or line break");
+ goto error;
+ }
+
+ *handle = handle_value;
+ *prefix = prefix_value;
+
+ return 1;
+
+error:
+ yaml_free(handle_value);
+ yaml_free(prefix_value);
+ return 0;
+}
+
+static int
+yaml_parser_scan_anchor(yaml_parser_t *parser, yaml_token_t *token,
+ yaml_token_type_t type)
+{
+ int length = 0;
+ yaml_mark_t start_mark, end_mark;
+ yaml_string_t string = NULL_STRING;
+
+ if (!STRING_INIT(parser, string, INITIAL_STRING_SIZE)) goto error;
+
+ /* Eat the indicator character. */
+
+ start_mark = parser->mark;
+
+ SKIP(parser);
+
+ /* Consume the value. */
+
+ if (!CACHE(parser, 1)) goto error;
+
+ while (IS_ALPHA(parser->buffer)) {
+ if (!READ(parser, string)) goto error;
+ if (!CACHE(parser, 1)) goto error;
+ length ++;
+ }
+
+ end_mark = parser->mark;
+
+ /*
+ * Check if length of the anchor is greater than 0 and it is followed by
+ * a whitespace character or one of the indicators:
+ *
+ * '?', ':', ',', ']', '}', '%', '@', '`'.
+ */
+
+ if (!length || !(IS_BLANKZ(parser->buffer) || CHECK(parser->buffer, '?')
+ || CHECK(parser->buffer, ':') || CHECK(parser->buffer, ',')
+ || CHECK(parser->buffer, ']') || CHECK(parser->buffer, '}')
+ || CHECK(parser->buffer, '%') || CHECK(parser->buffer, '@')
+ || CHECK(parser->buffer, '`'))) {
+ yaml_parser_set_scanner_error(parser, type == YAML_ANCHOR_TOKEN ?
+ "while scanning an anchor" : "while scanning an alias", start_mark,
+ "did not find expected alphabetic or numeric character");
+ goto error;
+ }
+
+ /* Create a token. */
+
+ if (type == YAML_ANCHOR_TOKEN) {
+ ANCHOR_TOKEN_INIT(*token, string.start, start_mark, end_mark);
+ }
+ else {
+ ALIAS_TOKEN_INIT(*token, string.start, start_mark, end_mark);
+ }
+
+ return 1;
+
+error:
+ STRING_DEL(parser, string);
+ return 0;
+}
+
+/*
+ * Scan a TAG token.
+ */
+
+static int
+yaml_parser_scan_tag(yaml_parser_t *parser, yaml_token_t *token)
+{
+ yaml_char_t *handle = NULL;
+ yaml_char_t *suffix = NULL;
+ yaml_mark_t start_mark, end_mark;
+
+ start_mark = parser->mark;
+
+ /* Check if the tag is in the canonical form. */
+
+ if (!CACHE(parser, 2)) goto error;
+
+ if (CHECK_AT(parser->buffer, '<', 1))
+ {
+ /* Set the handle to '' */
+
+ handle = yaml_malloc(1);
+ if (!handle) goto error;
+ handle[0] = '\0';
+
+ /* Eat '!<' */
+
+ SKIP(parser);
+ SKIP(parser);
+
+ /* Consume the tag value. */
+
+ if (!yaml_parser_scan_tag_uri(parser, 0, NULL, start_mark, &suffix))
+ goto error;
+
+ /* Check for '>' and eat it. */
+
+ if (!CHECK(parser->buffer, '>')) {
+ yaml_parser_set_scanner_error(parser, "while scanning a tag",
+ start_mark, "did not find the expected '>'");
+ goto error;
+ }
+
+ SKIP(parser);
+ }
+ else
+ {
+ /* The tag has either the '!suffix' or the '!handle!suffix' form. */
+
+ /* First, try to scan a handle. */
+
+ if (!yaml_parser_scan_tag_handle(parser, 0, start_mark, &handle))
+ goto error;
+
+ /* Check if it is, indeed, handle. */
+
+ if (handle[0] == '!' && handle[1] != '\0' && handle[strlen((char *)handle)-1] == '!')
+ {
+ /* Scan the suffix now. */
+
+ if (!yaml_parser_scan_tag_uri(parser, 0, NULL, start_mark, &suffix))
+ goto error;
+ }
+ else
+ {
+ /* It wasn't a handle after all. Scan the rest of the tag. */
+
+ if (!yaml_parser_scan_tag_uri(parser, 0, handle, start_mark, &suffix))
+ goto error;
+
+ /* Set the handle to '!'. */
+
+ yaml_free(handle);
+ handle = yaml_malloc(2);
+ if (!handle) goto error;
+ handle[0] = '!';
+ handle[1] = '\0';
+
+ /*
+ * A special case: the '!' tag. Set the handle to '' and the
+ * suffix to '!'.
+ */
+
+ if (suffix[0] == '\0') {
+ yaml_char_t *tmp = handle;
+ handle = suffix;
+ suffix = tmp;
+ }
+ }
+ }
+
+ /* Check the character which ends the tag. */
+
+ if (!CACHE(parser, 1)) goto error;
+
+ if (!IS_BLANKZ(parser->buffer)) {
+ yaml_parser_set_scanner_error(parser, "while scanning a tag",
+ start_mark, "did not find expected whitespace or line break");
+ goto error;
+ }
+
+ end_mark = parser->mark;
+
+ /* Create a token. */
+
+ TAG_TOKEN_INIT(*token, handle, suffix, start_mark, end_mark);
+
+ return 1;
+
+error:
+ yaml_free(handle);
+ yaml_free(suffix);
+ return 0;
+}
+
+/*
+ * Scan a tag handle.
+ */
+
+static int
+yaml_parser_scan_tag_handle(yaml_parser_t *parser, int directive,
+ yaml_mark_t start_mark, yaml_char_t **handle)
+{
+ yaml_string_t string = NULL_STRING;
+
+ if (!STRING_INIT(parser, string, INITIAL_STRING_SIZE)) goto error;
+
+ /* Check the initial '!' character. */
+
+ if (!CACHE(parser, 1)) goto error;
+
+ if (!CHECK(parser->buffer, '!')) {
+ yaml_parser_set_scanner_error(parser, directive ?
+ "while scanning a tag directive" : "while scanning a tag",
+ start_mark, "did not find expected '!'");
+ goto error;
+ }
+
+ /* Copy the '!' character. */
+
+ if (!READ(parser, string)) goto error;
+
+ /* Copy all subsequent alphabetical and numerical characters. */
+
+ if (!CACHE(parser, 1)) goto error;
+
+ while (IS_ALPHA(parser->buffer))
+ {
+ if (!READ(parser, string)) goto error;
+ if (!CACHE(parser, 1)) goto error;
+ }
+
+ /* Check if the trailing character is '!' and copy it. */
+
+ if (CHECK(parser->buffer, '!'))
+ {
+ if (!READ(parser, string)) goto error;
+ }
+ else
+ {
+ /*
+ * It's either the '!' tag or not really a tag handle. If it's a %TAG
+ * directive, it's an error. If it's a tag token, it must be a part of
+ * URI.
+ */
+
+ if (directive && !(string.start[0] == '!' && string.start[1] == '\0')) {
+ yaml_parser_set_scanner_error(parser, "while parsing a tag directive",
+ start_mark, "did not find expected '!'");
+ goto error;
+ }
+ }
+
+ *handle = string.start;
+
+ return 1;
+
+error:
+ STRING_DEL(parser, string);
+ return 0;
+}
+
+/*
+ * Scan a tag.
+ */
+
+static int
+yaml_parser_scan_tag_uri(yaml_parser_t *parser, int directive,
+ yaml_char_t *head, yaml_mark_t start_mark, yaml_char_t **uri)
+{
+ size_t length = head ? strlen((char *)head) : 0;
+ yaml_string_t string = NULL_STRING;
+
+ if (!STRING_INIT(parser, string, INITIAL_STRING_SIZE)) goto error;
+
+ /* Resize the string to include the head. */
+
+ while (string.end - string.start <= (int)length) {
+ if (!yaml_string_extend(&string.start, &string.pointer, &string.end)) {
+ parser->error = YAML_MEMORY_ERROR;
+ goto error;
+ }
+ }
+
+ /*
+ * Copy the head if needed.
+ *
+ * Note that we don't copy the leading '!' character.
+ */
+
+ if (length > 1) {
+ memcpy(string.start, head+1, length-1);
+ string.pointer += length-1;
+ }
+
+ /* Scan the tag. */
+
+ if (!CACHE(parser, 1)) goto error;
+
+ /*
+ * The set of characters that may appear in URI is as follows:
+ *
+ * '0'-'9', 'A'-'Z', 'a'-'z', '_', '-', ';', '/', '?', ':', '@', '&',
+ * '=', '+', '$', ',', '.', '!', '~', '*', '\'', '(', ')', '[', ']',
+ * '%'.
+ */
+
+ while (IS_ALPHA(parser->buffer) || CHECK(parser->buffer, ';')
+ || CHECK(parser->buffer, '/') || CHECK(parser->buffer, '?')
+ || CHECK(parser->buffer, ':') || CHECK(parser->buffer, '@')
+ || CHECK(parser->buffer, '&') || CHECK(parser->buffer, '=')
+ || CHECK(parser->buffer, '+') || CHECK(parser->buffer, '$')
+ || CHECK(parser->buffer, ',') || CHECK(parser->buffer, '.')
+ || CHECK(parser->buffer, '!') || CHECK(parser->buffer, '~')
+ || CHECK(parser->buffer, '*') || CHECK(parser->buffer, '\'')
+ || CHECK(parser->buffer, '(') || CHECK(parser->buffer, ')')
+ || CHECK(parser->buffer, '[') || CHECK(parser->buffer, ']')
+ || CHECK(parser->buffer, '%'))
+ {
+ /* Check if it is a URI-escape sequence. */
+
+ if (CHECK(parser->buffer, '%')) {
+ if (!yaml_parser_scan_uri_escapes(parser,
+ directive, start_mark, &string)) goto error;
+ }
+ else {
+ if (!READ(parser, string)) goto error;
+ }
+
+ length ++;
+ if (!CACHE(parser, 1)) goto error;
+ }
+
+ /* Check if the tag is non-empty. */
+
+ if (!length) {
+ if (!STRING_EXTEND(parser, string))
+ goto error;
+
+ yaml_parser_set_scanner_error(parser, directive ?
+ "while parsing a %TAG directive" : "while parsing a tag",
+ start_mark, "did not find expected tag URI");
+ goto error;
+ }
+
+ *uri = string.start;
+
+ return 1;
+
+error:
+ STRING_DEL(parser, string);
+ return 0;
+}
+
+/*
+ * Decode an URI-escape sequence corresponding to a single UTF-8 character.
+ */
+
+static int
+yaml_parser_scan_uri_escapes(yaml_parser_t *parser, int directive,
+ yaml_mark_t start_mark, yaml_string_t *string)
+{
+ int width = 0;
+
+ /* Decode the required number of characters. */
+
+ do {
+
+ unsigned char octet = 0;
+
+ /* Check for a URI-escaped octet. */
+
+ if (!CACHE(parser, 3)) return 0;
+
+ if (!(CHECK(parser->buffer, '%')
+ && IS_HEX_AT(parser->buffer, 1)
+ && IS_HEX_AT(parser->buffer, 2))) {
+ return yaml_parser_set_scanner_error(parser, directive ?
+ "while parsing a %TAG directive" : "while parsing a tag",
+ start_mark, "did not find URI escaped octet");
+ }
+
+ /* Get the octet. */
+
+ octet = (AS_HEX_AT(parser->buffer, 1) << 4) + AS_HEX_AT(parser->buffer, 2);
+
+ /* If it is the leading octet, determine the length of the UTF-8 sequence. */
+
+ if (!width)
+ {
+ width = (octet & 0x80) == 0x00 ? 1 :
+ (octet & 0xE0) == 0xC0 ? 2 :
+ (octet & 0xF0) == 0xE0 ? 3 :
+ (octet & 0xF8) == 0xF0 ? 4 : 0;
+ if (!width) {
+ return yaml_parser_set_scanner_error(parser, directive ?
+ "while parsing a %TAG directive" : "while parsing a tag",
+ start_mark, "found an incorrect leading UTF-8 octet");
+ }
+ }
+ else
+ {
+ /* Check if the trailing octet is correct. */
+
+ if ((octet & 0xC0) != 0x80) {
+ return yaml_parser_set_scanner_error(parser, directive ?
+ "while parsing a %TAG directive" : "while parsing a tag",
+ start_mark, "found an incorrect trailing UTF-8 octet");
+ }
+ }
+
+ /* Copy the octet and move the pointers. */
+
+ *(string->pointer++) = octet;
+ SKIP(parser);
+ SKIP(parser);
+ SKIP(parser);
+
+ } while (--width);
+
+ return 1;
+}
+
+/*
+ * Scan a block scalar.
+ */
+
+static int
+yaml_parser_scan_block_scalar(yaml_parser_t *parser, yaml_token_t *token,
+ int literal)
+{
+ yaml_mark_t start_mark;
+ yaml_mark_t end_mark;
+ yaml_string_t string = NULL_STRING;
+ yaml_string_t leading_break = NULL_STRING;
+ yaml_string_t trailing_breaks = NULL_STRING;
+ int chomping = 0;
+ int increment = 0;
+ int indent = 0;
+ int leading_blank = 0;
+ int trailing_blank = 0;
+
+ if (!STRING_INIT(parser, string, INITIAL_STRING_SIZE)) goto error;
+ if (!STRING_INIT(parser, leading_break, INITIAL_STRING_SIZE)) goto error;
+ if (!STRING_INIT(parser, trailing_breaks, INITIAL_STRING_SIZE)) goto error;
+
+ /* Eat the indicator '|' or '>'. */
+
+ start_mark = parser->mark;
+
+ SKIP(parser);
+
+ /* Scan the additional block scalar indicators. */
+
+ if (!CACHE(parser, 1)) goto error;
+
+ /* Check for a chomping indicator. */
+
+ if (CHECK(parser->buffer, '+') || CHECK(parser->buffer, '-'))
+ {
+ /* Set the chomping method and eat the indicator. */
+
+ chomping = CHECK(parser->buffer, '+') ? +1 : -1;
+
+ SKIP(parser);
+
+ /* Check for an indentation indicator. */
+
+ if (!CACHE(parser, 1)) goto error;
+
+ if (IS_DIGIT(parser->buffer))
+ {
+ /* Check that the indentation 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");
+ goto error;
+ }
+
+ /* Get the indentation level and eat the indicator. */
+
+ increment = AS_DIGIT(parser->buffer);
+
+ SKIP(parser);
+ }
+ }
+
+ /* Do the same as above, but in the opposite order. */
+
+ else if (IS_DIGIT(parser->buffer))
+ {
+ 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");
+ goto error;
+ }
+
+ increment = AS_DIGIT(parser->buffer);
+
+ SKIP(parser);
+
+ if (!CACHE(parser, 1)) goto error;
+
+ if (CHECK(parser->buffer, '+') || CHECK(parser->buffer, '-')) {
+ chomping = CHECK(parser->buffer, '+') ? +1 : -1;
+
+ SKIP(parser);
+ }
+ }
+
+ /* Eat whitespaces and comments to the end of the line. */
+
+ if (!CACHE(parser, 1)) goto error;
+
+ while (IS_BLANK(parser->buffer)) {
+ SKIP(parser);
+ if (!CACHE(parser, 1)) goto error;
+ }
+
+ if (CHECK(parser->buffer, '#')) {
+ while (!IS_BREAKZ(parser->buffer)) {
+ SKIP(parser);
+ if (!CACHE(parser, 1)) goto error;
+ }
+ }
+
+ /* Check if we are at the end of the line. */
+
+ if (!IS_BREAKZ(parser->buffer)) {
+ yaml_parser_set_scanner_error(parser, "while scanning a block scalar",
+ start_mark, "did not find expected comment or line break");
+ goto error;
+ }
+
+ /* Eat a line break. */
+
+ if (IS_BREAK(parser->buffer)) {
+ if (!CACHE(parser, 2)) goto error;
+ SKIP_LINE(parser);
+ }
+
+ end_mark = parser->mark;
+
+ /* Set the indentation level if it was specified. */
+
+ if (increment) {
+ indent = parser->indent >= 0 ? parser->indent+increment : increment;
+ }
+
+ /* Scan the leading line breaks and determine the indentation level if needed. */
+
+ if (!yaml_parser_scan_block_scalar_breaks(parser, &indent, &trailing_breaks,
+ start_mark, &end_mark)) goto error;
+
+ /* Scan the block scalar content. */
+
+ if (!CACHE(parser, 1)) goto error;
+
+ while ((int)parser->mark.column == indent && !IS_Z(parser->buffer))
+ {
+ /*
+ * We are at the beginning of a non-empty line.
+ */
+
+ /* Is it a trailing whitespace? */
+
+ trailing_blank = IS_BLANK(parser->buffer);
+
+ /* Check if we need to fold the leading line break. */
+
+ if (!literal && (*leading_break.start == '\n')
+ && !leading_blank && !trailing_blank)
+ {
+ /* Do we need to join the lines by space? */
+
+ if (*trailing_breaks.start == '\0') {
+ if (!STRING_EXTEND(parser, string)) goto error;
+ *(string.pointer ++) = ' ';
+ }
+
+ CLEAR(parser, leading_break);
+ }
+ else {
+ if (!JOIN(parser, string, leading_break)) goto error;
+ CLEAR(parser, leading_break);
+ }
+
+ /* Append the remaining line breaks. */
+
+ if (!JOIN(parser, string, trailing_breaks)) goto error;
+ CLEAR(parser, trailing_breaks);
+
+ /* Is it a leading whitespace? */
+
+ leading_blank = IS_BLANK(parser->buffer);
+
+ /* Consume the current line. */
+
+ while (!IS_BREAKZ(parser->buffer)) {
+ if (!READ(parser, string)) goto error;
+ if (!CACHE(parser, 1)) goto error;
+ }
+
+ /* Consume the line break. */
+
+ if (!CACHE(parser, 2)) goto error;
+
+ if (!READ_LINE(parser, leading_break)) goto error;
+
+ /* Eat the following indentation spaces and line breaks. */
+
+ if (!yaml_parser_scan_block_scalar_breaks(parser,
+ &indent, &trailing_breaks, start_mark, &end_mark)) goto error;
+ }
+
+ /* Chomp the tail. */
+
+ if (chomping != -1) {
+ if (!JOIN(parser, string, leading_break)) goto error;
+ }
+ if (chomping == 1) {
+ if (!JOIN(parser, string, trailing_breaks)) goto error;
+ }
+
+ /* Create a token. */
+
+ SCALAR_TOKEN_INIT(*token, string.start, string.pointer-string.start,
+ literal ? YAML_LITERAL_SCALAR_STYLE : YAML_FOLDED_SCALAR_STYLE,
+ start_mark, end_mark);
+
+ STRING_DEL(parser, leading_break);
+ STRING_DEL(parser, trailing_breaks);
+
+ return 1;
+
+error:
+ STRING_DEL(parser, string);
+ STRING_DEL(parser, leading_break);
+ STRING_DEL(parser, trailing_breaks);
+
+ return 0;
+}
+
+/*
+ * Scan indentation spaces and line breaks for a block scalar. Determine the
+ * indentation level if needed.
+ */
+
+static int
+yaml_parser_scan_block_scalar_breaks(yaml_parser_t *parser,
+ int *indent, yaml_string_t *breaks,
+ yaml_mark_t start_mark, yaml_mark_t *end_mark)
+{
+ int max_indent = 0;
+
+ *end_mark = parser->mark;
+
+ /* Eat the indentation spaces and line breaks. */
+
+ while (1)
+ {
+ /* Eat the indentation spaces. */
+
+ if (!CACHE(parser, 1)) return 0;
+
+ while ((!*indent || (int)parser->mark.column < *indent)
+ && IS_SPACE(parser->buffer)) {
+ SKIP(parser);
+ if (!CACHE(parser, 1)) return 0;
+ }
+
+ if ((int)parser->mark.column > max_indent)
+ max_indent = (int)parser->mark.column;
+
+ /* Check for a tab character messing the indentation. */
+
+ 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");
+ }
+
+ /* Have we found a non-empty line? */
+
+ if (!IS_BREAK(parser->buffer)) break;
+
+ /* Consume the line break. */
+
+ if (!CACHE(parser, 2)) return 0;
+ if (!READ_LINE(parser, *breaks)) return 0;
+ *end_mark = parser->mark;
+ }
+
+ /* Determine the indentation level if needed. */
+
+ if (!*indent) {
+ *indent = max_indent;
+ if (*indent < parser->indent + 1)
+ *indent = parser->indent + 1;
+ if (*indent < 1)
+ *indent = 1;
+ }
+
+ return 1;
+}
+
+/*
+ * Scan a quoted scalar.
+ */
+
+static int
+yaml_parser_scan_flow_scalar(yaml_parser_t *parser, yaml_token_t *token,
+ int single)
+{
+ yaml_mark_t start_mark;
+ yaml_mark_t end_mark;
+ yaml_string_t string = NULL_STRING;
+ yaml_string_t leading_break = NULL_STRING;
+ yaml_string_t trailing_breaks = NULL_STRING;
+ yaml_string_t whitespaces = NULL_STRING;
+ int leading_blanks;
+
+ if (!STRING_INIT(parser, string, INITIAL_STRING_SIZE)) goto error;
+ if (!STRING_INIT(parser, leading_break, INITIAL_STRING_SIZE)) goto error;
+ if (!STRING_INIT(parser, trailing_breaks, INITIAL_STRING_SIZE)) goto error;
+ if (!STRING_INIT(parser, whitespaces, INITIAL_STRING_SIZE)) goto error;
+
+ /* Eat the left quote. */
+
+ start_mark = parser->mark;
+
+ SKIP(parser);
+
+ /* Consume the content of the quoted scalar. */
+
+ while (1)
+ {
+ /* Check that there are no document indicators at the beginning of the line. */
+
+ if (!CACHE(parser, 4)) goto error;
+
+ if (parser->mark.column == 0 &&
+ ((CHECK_AT(parser->buffer, '-', 0) &&
+ CHECK_AT(parser->buffer, '-', 1) &&
+ CHECK_AT(parser->buffer, '-', 2)) ||
+ (CHECK_AT(parser->buffer, '.', 0) &&
+ CHECK_AT(parser->buffer, '.', 1) &&
+ CHECK_AT(parser->buffer, '.', 2))) &&
+ IS_BLANKZ_AT(parser->buffer, 3))
+ {
+ yaml_parser_set_scanner_error(parser, "while scanning a quoted scalar",
+ start_mark, "found unexpected document indicator");
+ goto error;
+ }
+
+ /* Check for EOF. */
+
+ if (IS_Z(parser->buffer)) {
+ yaml_parser_set_scanner_error(parser, "while scanning a quoted scalar",
+ start_mark, "found unexpected end of stream");
+ goto error;
+ }
+
+ /* Consume non-blank characters. */
+
+ if (!CACHE(parser, 2)) goto error;
+
+ leading_blanks = 0;
+
+ while (!IS_BLANKZ(parser->buffer))
+ {
+ /* Check for an escaped single quote. */
+
+ if (single && CHECK_AT(parser->buffer, '\'', 0)
+ && CHECK_AT(parser->buffer, '\'', 1))
+ {
+ if (!STRING_EXTEND(parser, string)) goto error;
+ *(string.pointer++) = '\'';
+ SKIP(parser);
+ SKIP(parser);
+ }
+
+ /* Check for the right quote. */
+
+ else if (CHECK(parser->buffer, single ? '\'' : '"'))
+ {
+ break;
+ }
+
+ /* Check for an escaped line break. */
+
+ else if (!single && CHECK(parser->buffer, '\\')
+ && IS_BREAK_AT(parser->buffer, 1))
+ {
+ if (!CACHE(parser, 3)) goto error;
+ SKIP(parser);
+ SKIP_LINE(parser);
+ leading_blanks = 1;
+ break;
+ }
+
+ /* Check for an escape sequence. */
+
+ else if (!single && CHECK(parser->buffer, '\\'))
+ {
+ size_t code_length = 0;
+
+ if (!STRING_EXTEND(parser, string)) goto error;
+
+ /* Check the escape character. */
+
+ switch (parser->buffer.pointer[1])
+ {
+ case '0':
+ *(string.pointer++) = '\0';
+ break;
+
+ case 'a':
+ *(string.pointer++) = '\x07';
+ break;
+
+ case 'b':
+ *(string.pointer++) = '\x08';
+ break;
+
+ case 't':
+ case '\t':
+ *(string.pointer++) = '\x09';
+ break;
+
+ case 'n':
+ *(string.pointer++) = '\x0A';
+ break;
+
+ case 'v':
+ *(string.pointer++) = '\x0B';
+ break;
+
+ case 'f':
+ *(string.pointer++) = '\x0C';
+ break;
+
+ case 'r':
+ *(string.pointer++) = '\x0D';
+ break;
+
+ case 'e':
+ *(string.pointer++) = '\x1B';
+ break;
+
+ case ' ':
+ *(string.pointer++) = '\x20';
+ break;
+
+ case '"':
+ *(string.pointer++) = '"';
+ break;
+
+ case '\'':
+ *(string.pointer++) = '\'';
+ break;
+
+ case '\\':
+ *(string.pointer++) = '\\';
+ break;
+
+ case 'N': /* NEL (#x85) */
+ *(string.pointer++) = '\xC2';
+ *(string.pointer++) = '\x85';
+ break;
+
+ case '_': /* #xA0 */
+ *(string.pointer++) = '\xC2';
+ *(string.pointer++) = '\xA0';
+ break;
+
+ case 'L': /* LS (#x2028) */
+ *(string.pointer++) = '\xE2';
+ *(string.pointer++) = '\x80';
+ *(string.pointer++) = '\xA8';
+ break;
+
+ case 'P': /* PS (#x2029) */
+ *(string.pointer++) = '\xE2';
+ *(string.pointer++) = '\x80';
+ *(string.pointer++) = '\xA9';
+ break;
+
+ case 'x':
+ code_length = 2;
+ break;
+
+ case 'u':
+ code_length = 4;
+ break;
+
+ case 'U':
+ code_length = 8;
+ break;
+
+ default:
+ yaml_parser_set_scanner_error(parser, "while parsing a quoted scalar",
+ start_mark, "found unknown escape character");
+ goto error;
+ }
+
+ SKIP(parser);
+ SKIP(parser);
+
+ /* Consume an arbitrary escape code. */
+
+ if (code_length)
+ {
+ unsigned int value = 0;
+ size_t k;
+
+ /* Scan the character value. */
+
+ if (!CACHE(parser, code_length)) goto error;
+
+ for (k = 0; k < code_length; k ++) {
+ if (!IS_HEX_AT(parser->buffer, k)) {
+ yaml_parser_set_scanner_error(parser, "while parsing a quoted scalar",
+ start_mark, "did not find expected hexdecimal number");
+ goto error;
+ }
+ value = (value << 4) + AS_HEX_AT(parser->buffer, k);
+ }
+
+ /* Check the value and write the character. */
+
+ if ((value >= 0xD800 && value <= 0xDFFF) || value > 0x10FFFF) {
+ yaml_parser_set_scanner_error(parser, "while parsing a quoted scalar",
+ start_mark, "found invalid Unicode character escape code");
+ goto error;
+ }
+
+ if (value <= 0x7F) {
+ *(string.pointer++) = value;
+ }
+ else if (value <= 0x7FF) {
+ *(string.pointer++) = 0xC0 + (value >> 6);
+ *(string.pointer++) = 0x80 + (value & 0x3F);
+ }
+ else if (value <= 0xFFFF) {
+ *(string.pointer++) = 0xE0 + (value >> 12);
+ *(string.pointer++) = 0x80 + ((value >> 6) & 0x3F);
+ *(string.pointer++) = 0x80 + (value & 0x3F);
+ }
+ else {
+ *(string.pointer++) = 0xF0 + (value >> 18);
+ *(string.pointer++) = 0x80 + ((value >> 12) & 0x3F);
+ *(string.pointer++) = 0x80 + ((value >> 6) & 0x3F);
+ *(string.pointer++) = 0x80 + (value & 0x3F);
+ }
+
+ /* Advance the pointer. */
+
+ for (k = 0; k < code_length; k ++) {
+ SKIP(parser);
+ }
+ }
+ }
+
+ else
+ {
+ /* It is a non-escaped non-blank character. */
+
+ if (!READ(parser, string)) goto error;
+ }
+
+ if (!CACHE(parser, 2)) goto error;
+ }
+
+ /* Check if we are at the end of the scalar. */
+
+ if (CHECK(parser->buffer, single ? '\'' : '"'))
+ break;
+
+ /* Consume blank characters. */
+
+ if (!CACHE(parser, 1)) goto error;
+
+ while (IS_BLANK(parser->buffer) || IS_BREAK(parser->buffer))
+ {
+ if (IS_BLANK(parser->buffer))
+ {
+ /* Consume a space or a tab character. */
+
+ if (!leading_blanks) {
+ if (!READ(parser, whitespaces)) goto error;
+ }
+ else {
+ SKIP(parser);
+ }
+ }
+ else
+ {
+ if (!CACHE(parser, 2)) goto error;
+
+ /* Check if it is a first line break. */
+
+ if (!leading_blanks)
+ {
+ CLEAR(parser, whitespaces);
+ if (!READ_LINE(parser, leading_break)) goto error;
+ leading_blanks = 1;
+ }
+ else
+ {
+ if (!READ_LINE(parser, trailing_breaks)) goto error;
+ }
+ }
+ if (!CACHE(parser, 1)) goto error;
+ }
+
+ /* Join the whitespaces or fold line breaks. */
+
+ if (leading_blanks)
+ {
+ /* Do we need to fold line breaks? */
+
+ if (leading_break.start[0] == '\n') {
+ if (trailing_breaks.start[0] == '\0') {
+ if (!STRING_EXTEND(parser, string)) goto error;
+ *(string.pointer++) = ' ';
+ }
+ else {
+ if (!JOIN(parser, string, trailing_breaks)) goto error;
+ CLEAR(parser, trailing_breaks);
+ }
+ CLEAR(parser, leading_break);
+ }
+ else {
+ if (!JOIN(parser, string, leading_break)) goto error;
+ if (!JOIN(parser, string, trailing_breaks)) goto error;
+ CLEAR(parser, leading_break);
+ CLEAR(parser, trailing_breaks);
+ }
+ }
+ else
+ {
+ if (!JOIN(parser, string, whitespaces)) goto error;
+ CLEAR(parser, whitespaces);
+ }
+ }
+
+ /* Eat the right quote. */
+
+ SKIP(parser);
+
+ end_mark = parser->mark;
+
+ /* Create a token. */
+
+ SCALAR_TOKEN_INIT(*token, string.start, string.pointer-string.start,
+ single ? YAML_SINGLE_QUOTED_SCALAR_STYLE : YAML_DOUBLE_QUOTED_SCALAR_STYLE,
+ start_mark, end_mark);
+
+ STRING_DEL(parser, leading_break);
+ STRING_DEL(parser, trailing_breaks);
+ STRING_DEL(parser, whitespaces);
+
+ return 1;
+
+error:
+ STRING_DEL(parser, string);
+ STRING_DEL(parser, leading_break);
+ STRING_DEL(parser, trailing_breaks);
+ STRING_DEL(parser, whitespaces);
+
+ return 0;
+}
+
+/*
+ * Scan a plain scalar.
+ */
+
+static int
+yaml_parser_scan_plain_scalar(yaml_parser_t *parser, yaml_token_t *token)
+{
+ yaml_mark_t start_mark;
+ yaml_mark_t end_mark;
+ yaml_string_t string = NULL_STRING;
+ yaml_string_t leading_break = NULL_STRING;
+ yaml_string_t trailing_breaks = NULL_STRING;
+ yaml_string_t whitespaces = NULL_STRING;
+ int leading_blanks = 0;
+ int indent = parser->indent+1;
+
+ if (!STRING_INIT(parser, string, INITIAL_STRING_SIZE)) goto error;
+ if (!STRING_INIT(parser, leading_break, INITIAL_STRING_SIZE)) goto error;
+ if (!STRING_INIT(parser, trailing_breaks, INITIAL_STRING_SIZE)) goto error;
+ if (!STRING_INIT(parser, whitespaces, INITIAL_STRING_SIZE)) goto error;
+
+ start_mark = end_mark = parser->mark;
+
+ /* Consume the content of the plain scalar. */
+
+ while (1)
+ {
+ /* Check for a document indicator. */
+
+ if (!CACHE(parser, 4)) goto error;
+
+ if (parser->mark.column == 0 &&
+ ((CHECK_AT(parser->buffer, '-', 0) &&
+ CHECK_AT(parser->buffer, '-', 1) &&
+ CHECK_AT(parser->buffer, '-', 2)) ||
+ (CHECK_AT(parser->buffer, '.', 0) &&
+ CHECK_AT(parser->buffer, '.', 1) &&
+ CHECK_AT(parser->buffer, '.', 2))) &&
+ IS_BLANKZ_AT(parser->buffer, 3)) break;
+
+ /* Check for a comment. */
+
+ if (CHECK(parser->buffer, '#'))
+ break;
+
+ /* Consume non-blank characters. */
+
+ while (!IS_BLANKZ(parser->buffer))
+ {
+ /* Check for 'x:x' in the flow context. TODO: Fix the test "spec-08-13". */
+
+ if (parser->flow_level
+ && CHECK(parser->buffer, ':')
+ && !IS_BLANKZ_AT(parser->buffer, 1)) {
+ yaml_parser_set_scanner_error(parser, "while scanning a plain scalar",
+ start_mark, "found unexpected ':'");
+ goto error;
+ }
+
+ /* Check for indicators that may end a plain scalar. */
+
+ if ((CHECK(parser->buffer, ':') && IS_BLANKZ_AT(parser->buffer, 1))
+ || (parser->flow_level &&
+ (CHECK(parser->buffer, ',') || CHECK(parser->buffer, ':')
+ || CHECK(parser->buffer, '?') || CHECK(parser->buffer, '[')
+ || CHECK(parser->buffer, ']') || CHECK(parser->buffer, '{')
+ || CHECK(parser->buffer, '}'))))
+ break;
+
+ /* Check if we need to join whitespaces and breaks. */
+
+ if (leading_blanks || whitespaces.start != whitespaces.pointer)
+ {
+ if (leading_blanks)
+ {
+ /* Do we need to fold line breaks? */
+
+ if (leading_break.start[0] == '\n') {
+ if (trailing_breaks.start[0] == '\0') {
+ if (!STRING_EXTEND(parser, string)) goto error;
+ *(string.pointer++) = ' ';
+ }
+ else {
+ if (!JOIN(parser, string, trailing_breaks)) goto error;
+ CLEAR(parser, trailing_breaks);
+ }
+ CLEAR(parser, leading_break);
+ }
+ else {
+ if (!JOIN(parser, string, leading_break)) goto error;
+ if (!JOIN(parser, string, trailing_breaks)) goto error;
+ CLEAR(parser, leading_break);
+ CLEAR(parser, trailing_breaks);
+ }
+
+ leading_blanks = 0;
+ }
+ else
+ {
+ if (!JOIN(parser, string, whitespaces)) goto error;
+ CLEAR(parser, whitespaces);
+ }
+ }
+
+ /* Copy the character. */
+
+ if (!READ(parser, string)) goto error;
+
+ end_mark = parser->mark;
+
+ if (!CACHE(parser, 2)) goto error;
+ }
+
+ /* Is it the end? */
+
+ if (!(IS_BLANK(parser->buffer) || IS_BREAK(parser->buffer)))
+ break;
+
+ /* Consume blank characters. */
+
+ if (!CACHE(parser, 1)) goto error;
+
+ while (IS_BLANK(parser->buffer) || IS_BREAK(parser->buffer))
+ {
+ if (IS_BLANK(parser->buffer))
+ {
+ /* Check for tab character that abuse indentation. */
+
+ 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");
+ goto error;
+ }
+
+ /* Consume a space or a tab character. */
+
+ if (!leading_blanks) {
+ if (!READ(parser, whitespaces)) goto error;
+ }
+ else {
+ SKIP(parser);
+ }
+ }
+ else
+ {
+ if (!CACHE(parser, 2)) goto error;
+
+ /* Check if it is a first line break. */
+
+ if (!leading_blanks)
+ {
+ CLEAR(parser, whitespaces);
+ if (!READ_LINE(parser, leading_break)) goto error;
+ leading_blanks = 1;
+ }
+ else
+ {
+ if (!READ_LINE(parser, trailing_breaks)) goto error;
+ }
+ }
+ if (!CACHE(parser, 1)) goto error;
+ }
+
+ /* Check indentation level. */
+
+ if (!parser->flow_level && (int)parser->mark.column < indent)
+ break;
+ }
+
+ /* Create a token. */
+
+ SCALAR_TOKEN_INIT(*token, string.start, string.pointer-string.start,
+ YAML_PLAIN_SCALAR_STYLE, start_mark, end_mark);
+
+ /* Note that we change the 'simple_key_allowed' flag. */
+
+ if (leading_blanks) {
+ parser->simple_key_allowed = 1;
+ }
+
+ STRING_DEL(parser, leading_break);
+ STRING_DEL(parser, trailing_breaks);
+ STRING_DEL(parser, whitespaces);
+
+ return 1;
+
+error:
+ STRING_DEL(parser, string);
+ STRING_DEL(parser, leading_break);
+ STRING_DEL(parser, trailing_breaks);
+ STRING_DEL(parser, whitespaces);
+
+ return 0;
+}
+
diff --git a/ext/psych/yaml/writer.c b/ext/psych/yaml/writer.c
new file mode 100644
index 0000000000..5d57f392f1
--- /dev/null
+++ b/ext/psych/yaml/writer.c
@@ -0,0 +1,141 @@
+
+#include "yaml_private.h"
+
+/*
+ * Declarations.
+ */
+
+static int
+yaml_emitter_set_writer_error(yaml_emitter_t *emitter, const char *problem);
+
+YAML_DECLARE(int)
+yaml_emitter_flush(yaml_emitter_t *emitter);
+
+/*
+ * Set the writer error and return 0.
+ */
+
+static int
+yaml_emitter_set_writer_error(yaml_emitter_t *emitter, const char *problem)
+{
+ emitter->error = YAML_WRITER_ERROR;
+ emitter->problem = problem;
+
+ return 0;
+}
+
+/*
+ * Flush the output buffer.
+ */
+
+YAML_DECLARE(int)
+yaml_emitter_flush(yaml_emitter_t *emitter)
+{
+ int low, high;
+
+ assert(emitter); /* Non-NULL emitter object is expected. */
+ assert(emitter->write_handler); /* Write handler must be set. */
+ assert(emitter->encoding); /* Output encoding must be set. */
+
+ emitter->buffer.last = emitter->buffer.pointer;
+ emitter->buffer.pointer = emitter->buffer.start;
+
+ /* Check if the buffer is empty. */
+
+ if (emitter->buffer.start == emitter->buffer.last) {
+ return 1;
+ }
+
+ /* If the output encoding is UTF-8, we don't need to recode the buffer. */
+
+ if (emitter->encoding == YAML_UTF8_ENCODING)
+ {
+ if (emitter->write_handler(emitter->write_handler_data,
+ emitter->buffer.start,
+ emitter->buffer.last - emitter->buffer.start)) {
+ emitter->buffer.last = emitter->buffer.start;
+ emitter->buffer.pointer = emitter->buffer.start;
+ return 1;
+ }
+ else {
+ return yaml_emitter_set_writer_error(emitter, "write error");
+ }
+ }
+
+ /* Recode the buffer into the raw buffer. */
+
+ low = (emitter->encoding == YAML_UTF16LE_ENCODING ? 0 : 1);
+ high = (emitter->encoding == YAML_UTF16LE_ENCODING ? 1 : 0);
+
+ while (emitter->buffer.pointer != emitter->buffer.last)
+ {
+ unsigned char octet;
+ unsigned int width;
+ unsigned int value;
+ size_t k;
+
+ /*
+ * See the "reader.c" code for more details on UTF-8 encoding. Note
+ * that we assume that the buffer contains a valid UTF-8 sequence.
+ */
+
+ /* Read the next UTF-8 character. */
+
+ octet = emitter->buffer.pointer[0];
+
+ width = (octet & 0x80) == 0x00 ? 1 :
+ (octet & 0xE0) == 0xC0 ? 2 :
+ (octet & 0xF0) == 0xE0 ? 3 :
+ (octet & 0xF8) == 0xF0 ? 4 : 0;
+
+ value = (octet & 0x80) == 0x00 ? octet & 0x7F :
+ (octet & 0xE0) == 0xC0 ? octet & 0x1F :
+ (octet & 0xF0) == 0xE0 ? octet & 0x0F :
+ (octet & 0xF8) == 0xF0 ? octet & 0x07 : 0;
+
+ for (k = 1; k < width; k ++) {
+ octet = emitter->buffer.pointer[k];
+ value = (value << 6) + (octet & 0x3F);
+ }
+
+ emitter->buffer.pointer += width;
+
+ /* Write the character. */
+
+ if (value < 0x10000)
+ {
+ emitter->raw_buffer.last[high] = value >> 8;
+ emitter->raw_buffer.last[low] = value & 0xFF;
+
+ emitter->raw_buffer.last += 2;
+ }
+ else
+ {
+ /* Write the character using a surrogate pair (check "reader.c"). */
+
+ value -= 0x10000;
+ emitter->raw_buffer.last[high] = 0xD8 + (value >> 18);
+ emitter->raw_buffer.last[low] = (value >> 10) & 0xFF;
+ emitter->raw_buffer.last[high+2] = 0xDC + ((value >> 8) & 0xFF);
+ emitter->raw_buffer.last[low+2] = value & 0xFF;
+
+ emitter->raw_buffer.last += 4;
+ }
+ }
+
+ /* Write the raw buffer. */
+
+ if (emitter->write_handler(emitter->write_handler_data,
+ emitter->raw_buffer.start,
+ emitter->raw_buffer.last - emitter->raw_buffer.start)) {
+ emitter->buffer.last = emitter->buffer.start;
+ emitter->buffer.pointer = emitter->buffer.start;
+ emitter->raw_buffer.last = emitter->raw_buffer.start;
+ emitter->raw_buffer.pointer = emitter->raw_buffer.start;
+ return 1;
+ }
+ else {
+ return yaml_emitter_set_writer_error(emitter, "write error");
+ }
+}
+
diff --git a/ext/psych/yaml/yaml.h b/ext/psych/yaml/yaml.h
new file mode 100644
index 0000000000..f33a152594
--- /dev/null
+++ b/ext/psych/yaml/yaml.h
@@ -0,0 +1,1971 @@
+/**
+ * @file yaml.h
+ * @brief Public interface for libyaml.
+ *
+ * Include the header file with the code:
+ * @code
+ * #include <yaml.h>
+ * @endcode
+ */
+
+#ifndef YAML_H
+#define YAML_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+
+/**
+ * @defgroup export Export Definitions
+ * @{
+ */
+
+/** The public API declaration. */
+
+#ifdef _WIN32
+# if defined(YAML_DECLARE_STATIC)
+# define YAML_DECLARE(type) type
+# elif defined(YAML_DECLARE_EXPORT)
+# define YAML_DECLARE(type) __declspec(dllexport) type
+# else
+# define YAML_DECLARE(type) __declspec(dllimport) type
+# endif
+#else
+# define YAML_DECLARE(type) type
+#endif
+
+/** @} */
+
+/**
+ * @defgroup version Version Information
+ * @{
+ */
+
+/**
+ * Get the library version as a string.
+ *
+ * @returns The function returns the pointer to a static string of the form
+ * @c "X.Y.Z", where @c X is the major version number, @c Y is a minor version
+ * number, and @c Z is the patch version number.
+ */
+
+YAML_DECLARE(const char *)
+yaml_get_version_string(void);
+
+/**
+ * Get the library version numbers.
+ *
+ * @param[out] major Major version number.
+ * @param[out] minor Minor version number.
+ * @param[out] patch Patch version number.
+ */
+
+YAML_DECLARE(void)
+yaml_get_version(int *major, int *minor, int *patch);
+
+/** @} */
+
+/**
+ * @defgroup basic Basic Types
+ * @{
+ */
+
+/** The character type (UTF-8 octet). */
+typedef unsigned char yaml_char_t;
+
+/** The version directive data. */
+typedef struct yaml_version_directive_s {
+ /** The major version number. */
+ int major;
+ /** The minor version number. */
+ int minor;
+} yaml_version_directive_t;
+
+/** The tag directive data. */
+typedef struct yaml_tag_directive_s {
+ /** The tag handle. */
+ yaml_char_t *handle;
+ /** The tag prefix. */
+ yaml_char_t *prefix;
+} yaml_tag_directive_t;
+
+/** The stream encoding. */
+typedef enum yaml_encoding_e {
+ /** Let the parser choose the encoding. */
+ YAML_ANY_ENCODING,
+ /** The default UTF-8 encoding. */
+ YAML_UTF8_ENCODING,
+ /** The UTF-16-LE encoding with BOM. */
+ YAML_UTF16LE_ENCODING,
+ /** The UTF-16-BE encoding with BOM. */
+ YAML_UTF16BE_ENCODING
+} yaml_encoding_t;
+
+/** Line break types. */
+
+typedef enum yaml_break_e {
+ /** Let the parser choose the break type. */
+ YAML_ANY_BREAK,
+ /** Use CR for line breaks (Mac style). */
+ YAML_CR_BREAK,
+ /** Use LN for line breaks (Unix style). */
+ YAML_LN_BREAK,
+ /** Use CR LN for line breaks (DOS style). */
+ YAML_CRLN_BREAK
+} yaml_break_t;
+
+/** Many bad things could happen with the parser and emitter. */
+typedef enum yaml_error_type_e {
+ /** No error is produced. */
+ YAML_NO_ERROR,
+
+ /** Cannot allocate or reallocate a block of memory. */
+ YAML_MEMORY_ERROR,
+
+ /** Cannot read or decode the input stream. */
+ YAML_READER_ERROR,
+ /** Cannot scan the input stream. */
+ YAML_SCANNER_ERROR,
+ /** Cannot parse the input stream. */
+ YAML_PARSER_ERROR,
+ /** Cannot compose a YAML document. */
+ YAML_COMPOSER_ERROR,
+
+ /** Cannot write to the output stream. */
+ YAML_WRITER_ERROR,
+ /** Cannot emit a YAML stream. */
+ YAML_EMITTER_ERROR
+} yaml_error_type_t;
+
+/** The pointer position. */
+typedef struct yaml_mark_s {
+ /** The position index. */
+ size_t index;
+
+ /** The position line. */
+ size_t line;
+
+ /** The position column. */
+ size_t column;
+} yaml_mark_t;
+
+/** @} */
+
+/**
+ * @defgroup styles Node Styles
+ * @{
+ */
+
+/** Scalar styles. */
+typedef enum yaml_scalar_style_e {
+ /** Let the emitter choose the style. */
+ YAML_ANY_SCALAR_STYLE,
+
+ /** The plain scalar style. */
+ YAML_PLAIN_SCALAR_STYLE,
+
+ /** The single-quoted scalar style. */
+ YAML_SINGLE_QUOTED_SCALAR_STYLE,
+ /** The double-quoted scalar style. */
+ YAML_DOUBLE_QUOTED_SCALAR_STYLE,
+
+ /** The literal scalar style. */
+ YAML_LITERAL_SCALAR_STYLE,
+ /** The folded scalar style. */
+ YAML_FOLDED_SCALAR_STYLE
+} yaml_scalar_style_t;
+
+/** Sequence styles. */
+typedef enum yaml_sequence_style_e {
+ /** Let the emitter choose the style. */
+ YAML_ANY_SEQUENCE_STYLE,
+
+ /** The block sequence style. */
+ YAML_BLOCK_SEQUENCE_STYLE,
+ /** The flow sequence style. */
+ YAML_FLOW_SEQUENCE_STYLE
+} yaml_sequence_style_t;
+
+/** Mapping styles. */
+typedef enum yaml_mapping_style_e {
+ /** Let the emitter choose the style. */
+ YAML_ANY_MAPPING_STYLE,
+
+ /** The block mapping style. */
+ YAML_BLOCK_MAPPING_STYLE,
+ /** The flow mapping style. */
+ YAML_FLOW_MAPPING_STYLE
+/* YAML_FLOW_SET_MAPPING_STYLE */
+} yaml_mapping_style_t;
+
+/** @} */
+
+/**
+ * @defgroup tokens Tokens
+ * @{
+ */
+
+/** Token types. */
+typedef enum yaml_token_type_e {
+ /** An empty token. */
+ YAML_NO_TOKEN,
+
+ /** A STREAM-START token. */
+ YAML_STREAM_START_TOKEN,
+ /** A STREAM-END token. */
+ YAML_STREAM_END_TOKEN,
+
+ /** A VERSION-DIRECTIVE token. */
+ YAML_VERSION_DIRECTIVE_TOKEN,
+ /** A TAG-DIRECTIVE token. */
+ YAML_TAG_DIRECTIVE_TOKEN,
+ /** A DOCUMENT-START token. */
+ YAML_DOCUMENT_START_TOKEN,
+ /** A DOCUMENT-END token. */
+ YAML_DOCUMENT_END_TOKEN,
+
+ /** A BLOCK-SEQUENCE-START token. */
+ YAML_BLOCK_SEQUENCE_START_TOKEN,
+ /** A BLOCK-SEQUENCE-END token. */
+ YAML_BLOCK_MAPPING_START_TOKEN,
+ /** A BLOCK-END token. */
+ YAML_BLOCK_END_TOKEN,
+
+ /** A FLOW-SEQUENCE-START token. */
+ YAML_FLOW_SEQUENCE_START_TOKEN,
+ /** A FLOW-SEQUENCE-END token. */
+ YAML_FLOW_SEQUENCE_END_TOKEN,
+ /** A FLOW-MAPPING-START token. */
+ YAML_FLOW_MAPPING_START_TOKEN,
+ /** A FLOW-MAPPING-END token. */
+ YAML_FLOW_MAPPING_END_TOKEN,
+
+ /** A BLOCK-ENTRY token. */
+ YAML_BLOCK_ENTRY_TOKEN,
+ /** A FLOW-ENTRY token. */
+ YAML_FLOW_ENTRY_TOKEN,
+ /** A KEY token. */
+ YAML_KEY_TOKEN,
+ /** A VALUE token. */
+ YAML_VALUE_TOKEN,
+
+ /** An ALIAS token. */
+ YAML_ALIAS_TOKEN,
+ /** An ANCHOR token. */
+ YAML_ANCHOR_TOKEN,
+ /** A TAG token. */
+ YAML_TAG_TOKEN,
+ /** A SCALAR token. */
+ YAML_SCALAR_TOKEN
+} yaml_token_type_t;
+
+/** The token structure. */
+typedef struct yaml_token_s {
+
+ /** The token type. */
+ yaml_token_type_t type;
+
+ /** The token data. */
+ union {
+
+ /** The stream start (for @c YAML_STREAM_START_TOKEN). */
+ struct {
+ /** The stream encoding. */
+ yaml_encoding_t encoding;
+ } stream_start;
+
+ /** The alias (for @c YAML_ALIAS_TOKEN). */
+ struct {
+ /** The alias value. */
+ yaml_char_t *value;
+ } alias;
+
+ /** The anchor (for @c YAML_ANCHOR_TOKEN). */
+ struct {
+ /** The anchor value. */
+ yaml_char_t *value;
+ } anchor;
+
+ /** The tag (for @c YAML_TAG_TOKEN). */
+ struct {
+ /** The tag handle. */
+ yaml_char_t *handle;
+ /** The tag suffix. */
+ yaml_char_t *suffix;
+ } tag;
+
+ /** The scalar value (for @c YAML_SCALAR_TOKEN). */
+ struct {
+ /** The scalar value. */
+ yaml_char_t *value;
+ /** The length of the scalar value. */
+ size_t length;
+ /** The scalar style. */
+ yaml_scalar_style_t style;
+ } scalar;
+
+ /** The version directive (for @c YAML_VERSION_DIRECTIVE_TOKEN). */
+ struct {
+ /** The major version number. */
+ int major;
+ /** The minor version number. */
+ int minor;
+ } version_directive;
+
+ /** The tag directive (for @c YAML_TAG_DIRECTIVE_TOKEN). */
+ struct {
+ /** The tag handle. */
+ yaml_char_t *handle;
+ /** The tag prefix. */
+ yaml_char_t *prefix;
+ } tag_directive;
+
+ } data;
+
+ /** The beginning of the token. */
+ yaml_mark_t start_mark;
+ /** The end of the token. */
+ yaml_mark_t end_mark;
+
+} yaml_token_t;
+
+/**
+ * Free any memory allocated for a token object.
+ *
+ * @param[in,out] token A token object.
+ */
+
+YAML_DECLARE(void)
+yaml_token_delete(yaml_token_t *token);
+
+/** @} */
+
+/**
+ * @defgroup events Events
+ * @{
+ */
+
+/** Event types. */
+typedef enum yaml_event_type_e {
+ /** An empty event. */
+ YAML_NO_EVENT,
+
+ /** A STREAM-START event. */
+ YAML_STREAM_START_EVENT,
+ /** A STREAM-END event. */
+ YAML_STREAM_END_EVENT,
+
+ /** A DOCUMENT-START event. */
+ YAML_DOCUMENT_START_EVENT,
+ /** A DOCUMENT-END event. */
+ YAML_DOCUMENT_END_EVENT,
+
+ /** An ALIAS event. */
+ YAML_ALIAS_EVENT,
+ /** A SCALAR event. */
+ YAML_SCALAR_EVENT,
+
+ /** A SEQUENCE-START event. */
+ YAML_SEQUENCE_START_EVENT,
+ /** A SEQUENCE-END event. */
+ YAML_SEQUENCE_END_EVENT,
+
+ /** A MAPPING-START event. */
+ YAML_MAPPING_START_EVENT,
+ /** A MAPPING-END event. */
+ YAML_MAPPING_END_EVENT
+} yaml_event_type_t;
+
+/** The event structure. */
+typedef struct yaml_event_s {
+
+ /** The event type. */
+ yaml_event_type_t type;
+
+ /** The event data. */
+ union {
+
+ /** The stream parameters (for @c YAML_STREAM_START_EVENT). */
+ struct {
+ /** The document encoding. */
+ yaml_encoding_t encoding;
+ } stream_start;
+
+ /** The document parameters (for @c YAML_DOCUMENT_START_EVENT). */
+ struct {
+ /** The version directive. */
+ yaml_version_directive_t *version_directive;
+
+ /** The list of tag directives. */
+ struct {
+ /** The beginning of the tag directives list. */
+ yaml_tag_directive_t *start;
+ /** The end of the tag directives list. */
+ yaml_tag_directive_t *end;
+ } tag_directives;
+
+ /** Is the document indicator implicit? */
+ int implicit;
+ } document_start;
+
+ /** The document end parameters (for @c YAML_DOCUMENT_END_EVENT). */
+ struct {
+ /** Is the document end indicator implicit? */
+ int implicit;
+ } document_end;
+
+ /** The alias parameters (for @c YAML_ALIAS_EVENT). */
+ struct {
+ /** The anchor. */
+ yaml_char_t *anchor;
+ } alias;
+
+ /** The scalar parameters (for @c YAML_SCALAR_EVENT). */
+ struct {
+ /** The anchor. */
+ yaml_char_t *anchor;
+ /** The tag. */
+ yaml_char_t *tag;
+ /** The scalar value. */
+ yaml_char_t *value;
+ /** The length of the scalar value. */
+ size_t length;
+ /** Is the tag optional for the plain style? */
+ int plain_implicit;
+ /** Is the tag optional for any non-plain style? */
+ int quoted_implicit;
+ /** The scalar style. */
+ yaml_scalar_style_t style;
+ } scalar;
+
+ /** The sequence parameters (for @c YAML_SEQUENCE_START_EVENT). */
+ struct {
+ /** The anchor. */
+ yaml_char_t *anchor;
+ /** The tag. */
+ yaml_char_t *tag;
+ /** Is the tag optional? */
+ int implicit;
+ /** The sequence style. */
+ yaml_sequence_style_t style;
+ } sequence_start;
+
+ /** The mapping parameters (for @c YAML_MAPPING_START_EVENT). */
+ struct {
+ /** The anchor. */
+ yaml_char_t *anchor;
+ /** The tag. */
+ yaml_char_t *tag;
+ /** Is the tag optional? */
+ int implicit;
+ /** The mapping style. */
+ yaml_mapping_style_t style;
+ } mapping_start;
+
+ } data;
+
+ /** The beginning of the event. */
+ yaml_mark_t start_mark;
+ /** The end of the event. */
+ yaml_mark_t end_mark;
+
+} yaml_event_t;
+
+/**
+ * Create the STREAM-START event.
+ *
+ * @param[out] event An empty event object.
+ * @param[in] encoding The stream encoding.
+ *
+ * @returns @c 1 if the function succeeded, @c 0 on error.
+ */
+
+YAML_DECLARE(int)
+yaml_stream_start_event_initialize(yaml_event_t *event,
+ yaml_encoding_t encoding);
+
+/**
+ * Create the STREAM-END event.
+ *
+ * @param[out] event An empty event object.
+ *
+ * @returns @c 1 if the function succeeded, @c 0 on error.
+ */
+
+YAML_DECLARE(int)
+yaml_stream_end_event_initialize(yaml_event_t *event);
+
+/**
+ * Create the DOCUMENT-START event.
+ *
+ * The @a implicit argument is considered as a stylistic parameter and may be
+ * ignored by the emitter.
+ *
+ * @param[out] event An empty event object.
+ * @param[in] version_directive The %YAML directive value or
+ * @c NULL.
+ * @param[in] tag_directives_start The beginning of the %TAG
+ * directives list.
+ * @param[in] tag_directives_end The end of the %TAG directives
+ * list.
+ * @param[in] implicit If the document start indicator is
+ * implicit.
+ *
+ * @returns @c 1 if the function succeeded, @c 0 on error.
+ */
+
+YAML_DECLARE(int)
+yaml_document_start_event_initialize(yaml_event_t *event,
+ yaml_version_directive_t *version_directive,
+ yaml_tag_directive_t *tag_directives_start,
+ yaml_tag_directive_t *tag_directives_end,
+ int implicit);
+
+/**
+ * Create the DOCUMENT-END event.
+ *
+ * The @a implicit argument is considered as a stylistic parameter and may be
+ * ignored by the emitter.
+ *
+ * @param[out] event An empty event object.
+ * @param[in] implicit If the document end indicator is implicit.
+ *
+ * @returns @c 1 if the function succeeded, @c 0 on error.
+ */
+
+YAML_DECLARE(int)
+yaml_document_end_event_initialize(yaml_event_t *event, int implicit);
+
+/**
+ * Create an ALIAS event.
+ *
+ * @param[out] event An empty event object.
+ * @param[in] anchor The anchor value.
+ *
+ * @returns @c 1 if the function succeeded, @c 0 on error.
+ */
+
+YAML_DECLARE(int)
+yaml_alias_event_initialize(yaml_event_t *event, yaml_char_t *anchor);
+
+/**
+ * Create a SCALAR event.
+ *
+ * The @a style argument may be ignored by the emitter.
+ *
+ * Either the @a tag attribute or one of the @a plain_implicit and
+ * @a quoted_implicit flags must be set.
+ *
+ * @param[out] event An empty event object.
+ * @param[in] anchor The scalar anchor or @c NULL.
+ * @param[in] tag The scalar tag or @c NULL.
+ * @param[in] value The scalar value.
+ * @param[in] length The length of the scalar value.
+ * @param[in] plain_implicit If the tag may be omitted for the plain
+ * style.
+ * @param[in] quoted_implicit If the tag may be omitted for any
+ * non-plain style.
+ * @param[in] style The scalar style.
+ *
+ * @returns @c 1 if the function succeeded, @c 0 on error.
+ */
+
+YAML_DECLARE(int)
+yaml_scalar_event_initialize(yaml_event_t *event,
+ yaml_char_t *anchor, yaml_char_t *tag,
+ yaml_char_t *value, int length,
+ int plain_implicit, int quoted_implicit,
+ yaml_scalar_style_t style);
+
+/**
+ * Create a SEQUENCE-START event.
+ *
+ * The @a style argument may be ignored by the emitter.
+ *
+ * Either the @a tag attribute or the @a implicit flag must be set.
+ *
+ * @param[out] event An empty event object.
+ * @param[in] anchor The sequence anchor or @c NULL.
+ * @param[in] tag The sequence tag or @c NULL.
+ * @param[in] implicit If the tag may be omitted.
+ * @param[in] style The sequence style.
+ *
+ * @returns @c 1 if the function succeeded, @c 0 on error.
+ */
+
+YAML_DECLARE(int)
+yaml_sequence_start_event_initialize(yaml_event_t *event,
+ yaml_char_t *anchor, yaml_char_t *tag, int implicit,
+ yaml_sequence_style_t style);
+
+/**
+ * Create a SEQUENCE-END event.
+ *
+ * @param[out] event An empty event object.
+ *
+ * @returns @c 1 if the function succeeded, @c 0 on error.
+ */
+
+YAML_DECLARE(int)
+yaml_sequence_end_event_initialize(yaml_event_t *event);
+
+/**
+ * Create a MAPPING-START event.
+ *
+ * The @a style argument may be ignored by the emitter.
+ *
+ * Either the @a tag attribute or the @a implicit flag must be set.
+ *
+ * @param[out] event An empty event object.
+ * @param[in] anchor The mapping anchor or @c NULL.
+ * @param[in] tag The mapping tag or @c NULL.
+ * @param[in] implicit If the tag may be omitted.
+ * @param[in] style The mapping style.
+ *
+ * @returns @c 1 if the function succeeded, @c 0 on error.
+ */
+
+YAML_DECLARE(int)
+yaml_mapping_start_event_initialize(yaml_event_t *event,
+ yaml_char_t *anchor, yaml_char_t *tag, int implicit,
+ yaml_mapping_style_t style);
+
+/**
+ * Create a MAPPING-END event.
+ *
+ * @param[out] event An empty event object.
+ *
+ * @returns @c 1 if the function succeeded, @c 0 on error.
+ */
+
+YAML_DECLARE(int)
+yaml_mapping_end_event_initialize(yaml_event_t *event);
+
+/**
+ * Free any memory allocated for an event object.
+ *
+ * @param[in,out] event An event object.
+ */
+
+YAML_DECLARE(void)
+yaml_event_delete(yaml_event_t *event);
+
+/** @} */
+
+/**
+ * @defgroup nodes Nodes
+ * @{
+ */
+
+/** The tag @c !!null with the only possible value: @c null. */
+#define YAML_NULL_TAG "tag:yaml.org,2002:null"
+/** The tag @c !!bool with the values: @c true and @c falce. */
+#define YAML_BOOL_TAG "tag:yaml.org,2002:bool"
+/** The tag @c !!str for string values. */
+#define YAML_STR_TAG "tag:yaml.org,2002:str"
+/** The tag @c !!int for integer values. */
+#define YAML_INT_TAG "tag:yaml.org,2002:int"
+/** The tag @c !!float for float values. */
+#define YAML_FLOAT_TAG "tag:yaml.org,2002:float"
+/** The tag @c !!timestamp for date and time values. */
+#define YAML_TIMESTAMP_TAG "tag:yaml.org,2002:timestamp"
+
+/** The tag @c !!seq is used to denote sequences. */
+#define YAML_SEQ_TAG "tag:yaml.org,2002:seq"
+/** The tag @c !!map is used to denote mapping. */
+#define YAML_MAP_TAG "tag:yaml.org,2002:map"
+
+/** The default scalar tag is @c !!str. */
+#define YAML_DEFAULT_SCALAR_TAG YAML_STR_TAG
+/** The default sequence tag is @c !!seq. */
+#define YAML_DEFAULT_SEQUENCE_TAG YAML_SEQ_TAG
+/** The default mapping tag is @c !!map. */
+#define YAML_DEFAULT_MAPPING_TAG YAML_MAP_TAG
+
+/** Node types. */
+typedef enum yaml_node_type_e {
+ /** An empty node. */
+ YAML_NO_NODE,
+
+ /** A scalar node. */
+ YAML_SCALAR_NODE,
+ /** A sequence node. */
+ YAML_SEQUENCE_NODE,
+ /** A mapping node. */
+ YAML_MAPPING_NODE
+} yaml_node_type_t;
+
+/** The forward definition of a document node structure. */
+typedef struct yaml_node_s yaml_node_t;
+
+/** An element of a sequence node. */
+typedef int yaml_node_item_t;
+
+/** An element of a mapping node. */
+typedef struct yaml_node_pair_s {
+ /** The key of the element. */
+ int key;
+ /** The value of the element. */
+ int value;
+} yaml_node_pair_t;
+
+/** The node structure. */
+struct yaml_node_s {
+
+ /** The node type. */
+ yaml_node_type_t type;
+
+ /** The node tag. */
+ yaml_char_t *tag;
+
+ /** The node data. */
+ union {
+
+ /** The scalar parameters (for @c YAML_SCALAR_NODE). */
+ struct {
+ /** The scalar value. */
+ yaml_char_t *value;
+ /** The length of the scalar value. */
+ size_t length;
+ /** The scalar style. */
+ yaml_scalar_style_t style;
+ } scalar;
+
+ /** The sequence parameters (for @c YAML_SEQUENCE_NODE). */
+ struct {
+ /** The stack of sequence items. */
+ struct {
+ /** The beginning of the stack. */
+ yaml_node_item_t *start;
+ /** The end of the stack. */
+ yaml_node_item_t *end;
+ /** The top of the stack. */
+ yaml_node_item_t *top;
+ } items;
+ /** The sequence style. */
+ yaml_sequence_style_t style;
+ } sequence;
+
+ /** The mapping parameters (for @c YAML_MAPPING_NODE). */
+ struct {
+ /** The stack of mapping pairs (key, value). */
+ struct {
+ /** The beginning of the stack. */
+ yaml_node_pair_t *start;
+ /** The end of the stack. */
+ yaml_node_pair_t *end;
+ /** The top of the stack. */
+ yaml_node_pair_t *top;
+ } pairs;
+ /** The mapping style. */
+ yaml_mapping_style_t style;
+ } mapping;
+
+ } data;
+
+ /** The beginning of the node. */
+ yaml_mark_t start_mark;
+ /** The end of the node. */
+ yaml_mark_t end_mark;
+
+};
+
+/** The document structure. */
+typedef struct yaml_document_s {
+
+ /** The document nodes. */
+ struct {
+ /** The beginning of the stack. */
+ yaml_node_t *start;
+ /** The end of the stack. */
+ yaml_node_t *end;
+ /** The top of the stack. */
+ yaml_node_t *top;
+ } nodes;
+
+ /** The version directive. */
+ yaml_version_directive_t *version_directive;
+
+ /** The list of tag directives. */
+ struct {
+ /** The beginning of the tag directives list. */
+ yaml_tag_directive_t *start;
+ /** The end of the tag directives list. */
+ yaml_tag_directive_t *end;
+ } tag_directives;
+
+ /** Is the document start indicator implicit? */
+ int start_implicit;
+ /** Is the document end indicator implicit? */
+ int end_implicit;
+
+ /** The beginning of the document. */
+ yaml_mark_t start_mark;
+ /** The end of the document. */
+ yaml_mark_t end_mark;
+
+} yaml_document_t;
+
+/**
+ * Create a YAML document.
+ *
+ * @param[out] document An empty document object.
+ * @param[in] version_directive The %YAML directive value or
+ * @c NULL.
+ * @param[in] tag_directives_start The beginning of the %TAG
+ * directives list.
+ * @param[in] tag_directives_end The end of the %TAG directives
+ * list.
+ * @param[in] start_implicit If the document start indicator is
+ * implicit.
+ * @param[in] end_implicit If the document end indicator is
+ * implicit.
+ *
+ * @returns @c 1 if the function succeeded, @c 0 on error.
+ */
+
+YAML_DECLARE(int)
+yaml_document_initialize(yaml_document_t *document,
+ yaml_version_directive_t *version_directive,
+ yaml_tag_directive_t *tag_directives_start,
+ yaml_tag_directive_t *tag_directives_end,
+ int start_implicit, int end_implicit);
+
+/**
+ * Delete a YAML document and all its nodes.
+ *
+ * @param[in,out] document A document object.
+ */
+
+YAML_DECLARE(void)
+yaml_document_delete(yaml_document_t *document);
+
+/**
+ * Get a node of a YAML document.
+ *
+ * The pointer returned by this function is valid until any of the functions
+ * modifying the documents are called.
+ *
+ * @param[in] document A document object.
+ * @param[in] index The node id.
+ *
+ * @returns the node objct or @c NULL if @c node_id is out of range.
+ */
+
+YAML_DECLARE(yaml_node_t *)
+yaml_document_get_node(yaml_document_t *document, int index);
+
+/**
+ * Get the root of a YAML document node.
+ *
+ * The root object is the first object added to the document.
+ *
+ * The pointer returned by this function is valid until any of the functions
+ * modifying the documents are called.
+ *
+ * An empty document produced by the parser signifies the end of a YAML
+ * stream.
+ *
+ * @param[in] document A document object.
+ *
+ * @returns the node object or @c NULL if the document is empty.
+ */
+
+YAML_DECLARE(yaml_node_t *)
+yaml_document_get_root_node(yaml_document_t *document);
+
+/**
+ * Create a SCALAR node and attach it to the document.
+ *
+ * The @a style argument may be ignored by the emitter.
+ *
+ * @param[in,out] document A document object.
+ * @param[in] tag The scalar tag.
+ * @param[in] value The scalar value.
+ * @param[in] length The length of the scalar value.
+ * @param[in] style The scalar style.
+ *
+ * @returns the node id or @c 0 on error.
+ */
+
+YAML_DECLARE(int)
+yaml_document_add_scalar(yaml_document_t *document,
+ yaml_char_t *tag, yaml_char_t *value, int length,
+ yaml_scalar_style_t style);
+
+/**
+ * Create a SEQUENCE node and attach it to the document.
+ *
+ * The @a style argument may be ignored by the emitter.
+ *
+ * @param[in,out] document A document object.
+ * @param[in] tag The sequence tag.
+ * @param[in] style The sequence style.
+ *
+ * @returns the node id or @c 0 on error.
+ */
+
+YAML_DECLARE(int)
+yaml_document_add_sequence(yaml_document_t *document,
+ yaml_char_t *tag, yaml_sequence_style_t style);
+
+/**
+ * Create a MAPPING node and attach it to the document.
+ *
+ * The @a style argument may be ignored by the emitter.
+ *
+ * @param[in,out] document A document object.
+ * @param[in] tag The sequence tag.
+ * @param[in] style The sequence style.
+ *
+ * @returns the node id or @c 0 on error.
+ */
+
+YAML_DECLARE(int)
+yaml_document_add_mapping(yaml_document_t *document,
+ yaml_char_t *tag, yaml_mapping_style_t style);
+
+/**
+ * Add an item to a SEQUENCE node.
+ *
+ * @param[in,out] document A document object.
+ * @param[in] sequence The sequence node id.
+ * @param[in] item The item node id.
+*
+ * @returns @c 1 if the function succeeded, @c 0 on error.
+ */
+
+YAML_DECLARE(int)
+yaml_document_append_sequence_item(yaml_document_t *document,
+ int sequence, int item);
+
+/**
+ * Add a pair of a key and a value to a MAPPING node.
+ *
+ * @param[in,out] document A document object.
+ * @param[in] mapping The mapping node id.
+ * @param[in] key The key node id.
+ * @param[in] value The value node id.
+*
+ * @returns @c 1 if the function succeeded, @c 0 on error.
+ */
+
+YAML_DECLARE(int)
+yaml_document_append_mapping_pair(yaml_document_t *document,
+ int mapping, int key, int value);
+
+/** @} */
+
+/**
+ * @defgroup parser Parser Definitions
+ * @{
+ */
+
+/**
+ * The prototype of a read handler.
+ *
+ * The read handler is called when the parser needs to read more bytes from the
+ * source. The handler should write not more than @a size bytes to the @a
+ * buffer. The number of written bytes should be set to the @a length variable.
+ *
+ * @param[in,out] data A pointer to an application data specified by
+ * yaml_parser_set_input().
+ * @param[out] buffer The buffer to write the data from the source.
+ * @param[in] size The size of the buffer.
+ * @param[out] size_read The actual number of bytes read from the source.
+ *
+ * @returns On success, the handler should return @c 1. If the handler failed,
+ * the returned value should be @c 0. On EOF, the handler should set the
+ * @a size_read to @c 0 and return @c 1.
+ */
+
+typedef int yaml_read_handler_t(void *data, unsigned char *buffer, size_t size,
+ size_t *size_read);
+
+/**
+ * This structure holds information about a potential simple key.
+ */
+
+typedef struct yaml_simple_key_s {
+ /** Is a simple key possible? */
+ int possible;
+
+ /** Is a simple key required? */
+ int required;
+
+ /** The number of the token. */
+ size_t token_number;
+
+ /** The position mark. */
+ yaml_mark_t mark;
+} yaml_simple_key_t;
+
+/**
+ * The states of the parser.
+ */
+typedef enum yaml_parser_state_e {
+ /** Expect STREAM-START. */
+ YAML_PARSE_STREAM_START_STATE,
+ /** Expect the beginning of an implicit document. */
+ YAML_PARSE_IMPLICIT_DOCUMENT_START_STATE,
+ /** Expect DOCUMENT-START. */
+ YAML_PARSE_DOCUMENT_START_STATE,
+ /** Expect the content of a document. */
+ YAML_PARSE_DOCUMENT_CONTENT_STATE,
+ /** Expect DOCUMENT-END. */
+ YAML_PARSE_DOCUMENT_END_STATE,
+ /** Expect a block node. */
+ YAML_PARSE_BLOCK_NODE_STATE,
+ /** Expect a block node or indentless sequence. */
+ YAML_PARSE_BLOCK_NODE_OR_INDENTLESS_SEQUENCE_STATE,
+ /** Expect a flow node. */
+ YAML_PARSE_FLOW_NODE_STATE,
+ /** Expect the first entry of a block sequence. */
+ YAML_PARSE_BLOCK_SEQUENCE_FIRST_ENTRY_STATE,
+ /** Expect an entry of a block sequence. */
+ YAML_PARSE_BLOCK_SEQUENCE_ENTRY_STATE,
+ /** Expect an entry of an indentless sequence. */
+ YAML_PARSE_INDENTLESS_SEQUENCE_ENTRY_STATE,
+ /** Expect the first key of a block mapping. */
+ YAML_PARSE_BLOCK_MAPPING_FIRST_KEY_STATE,
+ /** Expect a block mapping key. */
+ YAML_PARSE_BLOCK_MAPPING_KEY_STATE,
+ /** Expect a block mapping value. */
+ YAML_PARSE_BLOCK_MAPPING_VALUE_STATE,
+ /** Expect the first entry of a flow sequence. */
+ YAML_PARSE_FLOW_SEQUENCE_FIRST_ENTRY_STATE,
+ /** Expect an entry of a flow sequence. */
+ YAML_PARSE_FLOW_SEQUENCE_ENTRY_STATE,
+ /** Expect a key of an ordered mapping. */
+ YAML_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_KEY_STATE,
+ /** Expect a value of an ordered mapping. */
+ YAML_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_VALUE_STATE,
+ /** Expect the and of an ordered mapping entry. */
+ YAML_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_END_STATE,
+ /** Expect the first key of a flow mapping. */
+ YAML_PARSE_FLOW_MAPPING_FIRST_KEY_STATE,
+ /** Expect a key of a flow mapping. */
+ YAML_PARSE_FLOW_MAPPING_KEY_STATE,
+ /** Expect a value of a flow mapping. */
+ YAML_PARSE_FLOW_MAPPING_VALUE_STATE,
+ /** Expect an empty value of a flow mapping. */
+ YAML_PARSE_FLOW_MAPPING_EMPTY_VALUE_STATE,
+ /** Expect nothing. */
+ YAML_PARSE_END_STATE
+} yaml_parser_state_t;
+
+/**
+ * This structure holds aliases data.
+ */
+
+typedef struct yaml_alias_data_s {
+ /** The anchor. */
+ yaml_char_t *anchor;
+ /** The node id. */
+ int index;
+ /** The anchor mark. */
+ yaml_mark_t mark;
+} yaml_alias_data_t;
+
+/**
+ * The parser structure.
+ *
+ * All members are internal. Manage the structure using the @c yaml_parser_
+ * family of functions.
+ */
+
+typedef struct yaml_parser_s {
+
+ /**
+ * @name Error handling
+ * @{
+ */
+
+ /** Error type. */
+ yaml_error_type_t error;
+ /** Error description. */
+ const char *problem;
+ /** The byte about which the problem occurred. */
+ size_t problem_offset;
+ /** The problematic value (@c -1 is none). */
+ int problem_value;
+ /** The problem position. */
+ yaml_mark_t problem_mark;
+ /** The error context. */
+ const char *context;
+ /** The context position. */
+ yaml_mark_t context_mark;
+
+ /**
+ * @}
+ */
+
+ /**
+ * @name Reader stuff
+ * @{
+ */
+
+ /** Read handler. */
+ yaml_read_handler_t *read_handler;
+
+ /** A pointer for passing to the read handler. */
+ void *read_handler_data;
+
+ /** Standard (string or file) input data. */
+ union {
+ /** String input data. */
+ struct {
+ /** The string start pointer. */
+ const unsigned char *start;
+ /** The string end pointer. */
+ const unsigned char *end;
+ /** The string current position. */
+ const unsigned char *current;
+ } string;
+
+ /** File input data. */
+ FILE *file;
+ } input;
+
+ /** EOF flag */
+ int eof;
+
+ /** The working buffer. */
+ struct {
+ /** The beginning of the buffer. */
+ yaml_char_t *start;
+ /** The end of the buffer. */
+ yaml_char_t *end;
+ /** The current position of the buffer. */
+ yaml_char_t *pointer;
+ /** The last filled position of the buffer. */
+ yaml_char_t *last;
+ } buffer;
+
+ /* The number of unread characters in the buffer. */
+ size_t unread;
+
+ /** The raw buffer. */
+ struct {
+ /** The beginning of the buffer. */
+ unsigned char *start;
+ /** The end of the buffer. */
+ unsigned char *end;
+ /** The current position of the buffer. */
+ unsigned char *pointer;
+ /** The last filled position of the buffer. */
+ unsigned char *last;
+ } raw_buffer;
+
+ /** The input encoding. */
+ yaml_encoding_t encoding;
+
+ /** The offset of the current position (in bytes). */
+ size_t offset;
+
+ /** The mark of the current position. */
+ yaml_mark_t mark;
+
+ /**
+ * @}
+ */
+
+ /**
+ * @name Scanner stuff
+ * @{
+ */
+
+ /** Have we started to scan the input stream? */
+ int stream_start_produced;
+
+ /** Have we reached the end of the input stream? */
+ int stream_end_produced;
+
+ /** The number of unclosed '[' and '{' indicators. */
+ int flow_level;
+
+ /** The tokens queue. */
+ struct {
+ /** The beginning of the tokens queue. */
+ yaml_token_t *start;
+ /** The end of the tokens queue. */
+ yaml_token_t *end;
+ /** The head of the tokens queue. */
+ yaml_token_t *head;
+ /** The tail of the tokens queue. */
+ yaml_token_t *tail;
+ } tokens;
+
+ /** The number of tokens fetched from the queue. */
+ size_t tokens_parsed;
+
+ /* Does the tokens queue contain a token ready for dequeueing. */
+ int token_available;
+
+ /** The indentation levels stack. */
+ struct {
+ /** The beginning of the stack. */
+ int *start;
+ /** The end of the stack. */
+ int *end;
+ /** The top of the stack. */
+ int *top;
+ } indents;
+
+ /** The current indentation level. */
+ int indent;
+
+ /** May a simple key occur at the current position? */
+ int simple_key_allowed;
+
+ /** The stack of simple keys. */
+ struct {
+ /** The beginning of the stack. */
+ yaml_simple_key_t *start;
+ /** The end of the stack. */
+ yaml_simple_key_t *end;
+ /** The top of the stack. */
+ yaml_simple_key_t *top;
+ } simple_keys;
+
+ /**
+ * @}
+ */
+
+ /**
+ * @name Parser stuff
+ * @{
+ */
+
+ /** The parser states stack. */
+ struct {
+ /** The beginning of the stack. */
+ yaml_parser_state_t *start;
+ /** The end of the stack. */
+ yaml_parser_state_t *end;
+ /** The top of the stack. */
+ yaml_parser_state_t *top;
+ } states;
+
+ /** The current parser state. */
+ yaml_parser_state_t state;
+
+ /** The stack of marks. */
+ struct {
+ /** The beginning of the stack. */
+ yaml_mark_t *start;
+ /** The end of the stack. */
+ yaml_mark_t *end;
+ /** The top of the stack. */
+ yaml_mark_t *top;
+ } marks;
+
+ /** The list of TAG directives. */
+ struct {
+ /** The beginning of the list. */
+ yaml_tag_directive_t *start;
+ /** The end of the list. */
+ yaml_tag_directive_t *end;
+ /** The top of the list. */
+ yaml_tag_directive_t *top;
+ } tag_directives;
+
+ /**
+ * @}
+ */
+
+ /**
+ * @name Dumper stuff
+ * @{
+ */
+
+ /** The alias data. */
+ struct {
+ /** The beginning of the list. */
+ yaml_alias_data_t *start;
+ /** The end of the list. */
+ yaml_alias_data_t *end;
+ /** The top of the list. */
+ yaml_alias_data_t *top;
+ } aliases;
+
+ /** The currently parsed document. */
+ yaml_document_t *document;
+
+ /**
+ * @}
+ */
+
+} yaml_parser_t;
+
+/**
+ * Initialize a parser.
+ *
+ * This function creates a new parser object. An application is responsible
+ * for destroying the object using the yaml_parser_delete() function.
+ *
+ * @param[out] parser An empty parser object.
+ *
+ * @returns @c 1 if the function succeeded, @c 0 on error.
+ */
+
+YAML_DECLARE(int)
+yaml_parser_initialize(yaml_parser_t *parser);
+
+/**
+ * Destroy a parser.
+ *
+ * @param[in,out] parser A parser object.
+ */
+
+YAML_DECLARE(void)
+yaml_parser_delete(yaml_parser_t *parser);
+
+/**
+ * Set a string input.
+ *
+ * Note that the @a input pointer must be valid while the @a parser object
+ * exists. The application is responsible for destroing @a input after
+ * destroying the @a parser.
+ *
+ * @param[in,out] parser A parser object.
+ * @param[in] input A source data.
+ * @param[in] size The length of the source data in bytes.
+ */
+
+YAML_DECLARE(void)
+yaml_parser_set_input_string(yaml_parser_t *parser,
+ const unsigned char *input, size_t size);
+
+/**
+ * Set a file input.
+ *
+ * @a file should be a file object open for reading. The application is
+ * responsible for closing the @a file.
+ *
+ * @param[in,out] parser A parser object.
+ * @param[in] file An open file.
+ */
+
+YAML_DECLARE(void)
+yaml_parser_set_input_file(yaml_parser_t *parser, FILE *file);
+
+/**
+ * Set a generic input handler.
+ *
+ * @param[in,out] parser A parser object.
+ * @param[in] handler A read handler.
+ * @param[in] data Any application data for passing to the read
+ * handler.
+ */
+
+YAML_DECLARE(void)
+yaml_parser_set_input(yaml_parser_t *parser,
+ yaml_read_handler_t *handler, void *data);
+
+/**
+ * Set the source encoding.
+ *
+ * @param[in,out] parser A parser object.
+ * @param[in] encoding The source encoding.
+ */
+
+YAML_DECLARE(void)
+yaml_parser_set_encoding(yaml_parser_t *parser, yaml_encoding_t encoding);
+
+/**
+ * Scan the input stream and produce the next token.
+ *
+ * Call the function subsequently to produce a sequence of tokens corresponding
+ * to the input stream. The initial token has the type
+ * @c YAML_STREAM_START_TOKEN while the ending token has the type
+ * @c YAML_STREAM_END_TOKEN.
+ *
+ * An application is responsible for freeing any buffers associated with the
+ * produced token object using the @c yaml_token_delete function.
+ *
+ * An application must not alternate the calls of yaml_parser_scan() with the
+ * calls of yaml_parser_parse() or yaml_parser_load(). Doing this will break
+ * the parser.
+ *
+ * @param[in,out] parser A parser object.
+ * @param[out] token An empty token object.
+ *
+ * @returns @c 1 if the function succeeded, @c 0 on error.
+ */
+
+YAML_DECLARE(int)
+yaml_parser_scan(yaml_parser_t *parser, yaml_token_t *token);
+
+/**
+ * Parse the input stream and produce the next parsing event.
+ *
+ * Call the function subsequently to produce a sequence of events corresponding
+ * to the input stream. The initial event has the type
+ * @c YAML_STREAM_START_EVENT while the ending event has the type
+ * @c YAML_STREAM_END_EVENT.
+ *
+ * An application is responsible for freeing any buffers associated with the
+ * produced event object using the yaml_event_delete() function.
+ *
+ * An application must not alternate the calls of yaml_parser_parse() with the
+ * calls of yaml_parser_scan() or yaml_parser_load(). Doing this will break the
+ * parser.
+ *
+ * @param[in,out] parser A parser object.
+ * @param[out] event An empty event object.
+ *
+ * @returns @c 1 if the function succeeded, @c 0 on error.
+ */
+
+YAML_DECLARE(int)
+yaml_parser_parse(yaml_parser_t *parser, yaml_event_t *event);
+
+/**
+ * Parse the input stream and produce the next YAML document.
+ *
+ * Call this function subsequently to produce a sequence of documents
+ * constituting the input stream.
+ *
+ * If the produced document has no root node, it means that the document
+ * end has been reached.
+ *
+ * An application is responsible for freeing any data associated with the
+ * produced document object using the yaml_document_delete() function.
+ *
+ * An application must not alternate the calls of yaml_parser_load() with the
+ * calls of yaml_parser_scan() or yaml_parser_parse(). Doing this will break
+ * the parser.
+ *
+ * @param[in,out] parser A parser object.
+ * @param[out] document An empty document object.
+ *
+ * @return @c 1 if the function succeeded, @c 0 on error.
+ */
+
+YAML_DECLARE(int)
+yaml_parser_load(yaml_parser_t *parser, yaml_document_t *document);
+
+/** @} */
+
+/**
+ * @defgroup emitter Emitter Definitions
+ * @{
+ */
+
+/**
+ * The prototype of a write handler.
+ *
+ * The write handler is called when the emitter needs to flush the accumulated
+ * characters to the output. The handler should write @a size bytes of the
+ * @a buffer to the output.
+ *
+ * @param[in,out] data A pointer to an application data specified by
+ * yaml_emitter_set_output().
+ * @param[in] buffer The buffer with bytes to be written.
+ * @param[in] size The size of the buffer.
+ *
+ * @returns On success, the handler should return @c 1. If the handler failed,
+ * the returned value should be @c 0.
+ */
+
+typedef int yaml_write_handler_t(void *data, unsigned char *buffer, size_t size);
+
+/** The emitter states. */
+typedef enum yaml_emitter_state_e {
+ /** Expect STREAM-START. */
+ YAML_EMIT_STREAM_START_STATE,
+ /** Expect the first DOCUMENT-START or STREAM-END. */
+ YAML_EMIT_FIRST_DOCUMENT_START_STATE,
+ /** Expect DOCUMENT-START or STREAM-END. */
+ YAML_EMIT_DOCUMENT_START_STATE,
+ /** Expect the content of a document. */
+ YAML_EMIT_DOCUMENT_CONTENT_STATE,
+ /** Expect DOCUMENT-END. */
+ YAML_EMIT_DOCUMENT_END_STATE,
+ /** Expect the first item of a flow sequence. */
+ YAML_EMIT_FLOW_SEQUENCE_FIRST_ITEM_STATE,
+ /** Expect an item of a flow sequence. */
+ YAML_EMIT_FLOW_SEQUENCE_ITEM_STATE,
+ /** Expect the first key of a flow mapping. */
+ YAML_EMIT_FLOW_MAPPING_FIRST_KEY_STATE,
+ /** Expect a key of a flow mapping. */
+ YAML_EMIT_FLOW_MAPPING_KEY_STATE,
+ /** Expect a value for a simple key of a flow mapping. */
+ YAML_EMIT_FLOW_MAPPING_SIMPLE_VALUE_STATE,
+ /** Expect a value of a flow mapping. */
+ YAML_EMIT_FLOW_MAPPING_VALUE_STATE,
+ /** Expect the first item of a block sequence. */
+ YAML_EMIT_BLOCK_SEQUENCE_FIRST_ITEM_STATE,
+ /** Expect an item of a block sequence. */
+ YAML_EMIT_BLOCK_SEQUENCE_ITEM_STATE,
+ /** Expect the first key of a block mapping. */
+ YAML_EMIT_BLOCK_MAPPING_FIRST_KEY_STATE,
+ /** Expect the key of a block mapping. */
+ YAML_EMIT_BLOCK_MAPPING_KEY_STATE,
+ /** Expect a value for a simple key of a block mapping. */
+ YAML_EMIT_BLOCK_MAPPING_SIMPLE_VALUE_STATE,
+ /** Expect a value of a block mapping. */
+ YAML_EMIT_BLOCK_MAPPING_VALUE_STATE,
+ /** Expect nothing. */
+ YAML_EMIT_END_STATE
+} yaml_emitter_state_t;
+
+/**
+ * The emitter structure.
+ *
+ * All members are internal. Manage the structure using the @c yaml_emitter_
+ * family of functions.
+ */
+
+typedef struct yaml_emitter_s {
+
+ /**
+ * @name Error handling
+ * @{
+ */
+
+ /** Error type. */
+ yaml_error_type_t error;
+ /** Error description. */
+ const char *problem;
+
+ /**
+ * @}
+ */
+
+ /**
+ * @name Writer stuff
+ * @{
+ */
+
+ /** Write handler. */
+ yaml_write_handler_t *write_handler;
+
+ /** A pointer for passing to the white handler. */
+ void *write_handler_data;
+
+ /** Standard (string or file) output data. */
+ union {
+ /** String output data. */
+ struct {
+ /** The buffer pointer. */
+ unsigned char *buffer;
+ /** The buffer size. */
+ size_t size;
+ /** The number of written bytes. */
+ size_t *size_written;
+ } string;
+
+ /** File output data. */
+ FILE *file;
+ } output;
+
+ /** The working buffer. */
+ struct {
+ /** The beginning of the buffer. */
+ yaml_char_t *start;
+ /** The end of the buffer. */
+ yaml_char_t *end;
+ /** The current position of the buffer. */
+ yaml_char_t *pointer;
+ /** The last filled position of the buffer. */
+ yaml_char_t *last;
+ } buffer;
+
+ /** The raw buffer. */
+ struct {
+ /** The beginning of the buffer. */
+ unsigned char *start;
+ /** The end of the buffer. */
+ unsigned char *end;
+ /** The current position of the buffer. */
+ unsigned char *pointer;
+ /** The last filled position of the buffer. */
+ unsigned char *last;
+ } raw_buffer;
+
+ /** The stream encoding. */
+ yaml_encoding_t encoding;
+
+ /**
+ * @}
+ */
+
+ /**
+ * @name Emitter stuff
+ * @{
+ */
+
+ /** If the output is in the canonical style? */
+ int canonical;
+ /** The number of indentation spaces. */
+ int best_indent;
+ /** The preferred width of the output lines. */
+ int best_width;
+ /** Allow unescaped non-ASCII characters? */
+ int unicode;
+ /** The preferred line break. */
+ yaml_break_t line_break;
+
+ /** The stack of states. */
+ struct {
+ /** The beginning of the stack. */
+ yaml_emitter_state_t *start;
+ /** The end of the stack. */
+ yaml_emitter_state_t *end;
+ /** The top of the stack. */
+ yaml_emitter_state_t *top;
+ } states;
+
+ /** The current emitter state. */
+ yaml_emitter_state_t state;
+
+ /** The event queue. */
+ struct {
+ /** The beginning of the event queue. */
+ yaml_event_t *start;
+ /** The end of the event queue. */
+ yaml_event_t *end;
+ /** The head of the event queue. */
+ yaml_event_t *head;
+ /** The tail of the event queue. */
+ yaml_event_t *tail;
+ } events;
+
+ /** The stack of indentation levels. */
+ struct {
+ /** The beginning of the stack. */
+ int *start;
+ /** The end of the stack. */
+ int *end;
+ /** The top of the stack. */
+ int *top;
+ } indents;
+
+ /** The list of tag directives. */
+ struct {
+ /** The beginning of the list. */
+ yaml_tag_directive_t *start;
+ /** The end of the list. */
+ yaml_tag_directive_t *end;
+ /** The top of the list. */
+ yaml_tag_directive_t *top;
+ } tag_directives;
+
+ /** The current indentation level. */
+ int indent;
+
+ /** The current flow level. */
+ int flow_level;
+
+ /** Is it the document root context? */
+ int root_context;
+ /** Is it a sequence context? */
+ int sequence_context;
+ /** Is it a mapping context? */
+ int mapping_context;
+ /** Is it a simple mapping key context? */
+ int simple_key_context;
+
+ /** The current line. */
+ int line;
+ /** The current column. */
+ int column;
+ /** If the last character was a whitespace? */
+ int whitespace;
+ /** If the last character was an indentation character (' ', '-', '?', ':')? */
+ int indention;
+ /** If an explicit document end is required? */
+ int open_ended;
+
+ /** Anchor analysis. */
+ struct {
+ /** The anchor value. */
+ yaml_char_t *anchor;
+ /** The anchor length. */
+ size_t anchor_length;
+ /** Is it an alias? */
+ int alias;
+ } anchor_data;
+
+ /** Tag analysis. */
+ struct {
+ /** The tag handle. */
+ yaml_char_t *handle;
+ /** The tag handle length. */
+ size_t handle_length;
+ /** The tag suffix. */
+ yaml_char_t *suffix;
+ /** The tag suffix length. */
+ size_t suffix_length;
+ } tag_data;
+
+ /** Scalar analysis. */
+ struct {
+ /** The scalar value. */
+ yaml_char_t *value;
+ /** The scalar length. */
+ size_t length;
+ /** Does the scalar contain line breaks? */
+ int multiline;
+ /** Can the scalar be expessed in the flow plain style? */
+ int flow_plain_allowed;
+ /** Can the scalar be expressed in the block plain style? */
+ int block_plain_allowed;
+ /** Can the scalar be expressed in the single quoted style? */
+ int single_quoted_allowed;
+ /** Can the scalar be expressed in the literal or folded styles? */
+ int block_allowed;
+ /** The output style. */
+ yaml_scalar_style_t style;
+ } scalar_data;
+
+ /**
+ * @}
+ */
+
+ /**
+ * @name Dumper stuff
+ * @{
+ */
+
+ /** If the stream was already opened? */
+ int opened;
+ /** If the stream was already closed? */
+ int closed;
+
+ /** The information associated with the document nodes. */
+ struct {
+ /** The number of references. */
+ int references;
+ /** The anchor id. */
+ int anchor;
+ /** If the node has been emitted? */
+ int serialized;
+ } *anchors;
+
+ /** The last assigned anchor id. */
+ int last_anchor_id;
+
+ /** The currently emitted document. */
+ yaml_document_t *document;
+
+ /**
+ * @}
+ */
+
+} yaml_emitter_t;
+
+/**
+ * Initialize an emitter.
+ *
+ * This function creates a new emitter object. An application is responsible
+ * for destroying the object using the yaml_emitter_delete() function.
+ *
+ * @param[out] emitter An empty parser object.
+ *
+ * @returns @c 1 if the function succeeded, @c 0 on error.
+ */
+
+YAML_DECLARE(int)
+yaml_emitter_initialize(yaml_emitter_t *emitter);
+
+/**
+ * Destroy an emitter.
+ *
+ * @param[in,out] emitter An emitter object.
+ */
+
+YAML_DECLARE(void)
+yaml_emitter_delete(yaml_emitter_t *emitter);
+
+/**
+ * Set a string output.
+ *
+ * The emitter will write the output characters to the @a output buffer of the
+ * size @a size. The emitter will set @a size_written to the number of written
+ * bytes. If the buffer is smaller than required, the emitter produces the
+ * YAML_WRITE_ERROR error.
+ *
+ * @param[in,out] emitter An emitter object.
+ * @param[in] output An output buffer.
+ * @param[in] size The buffer size.
+ * @param[in] size_written The pointer to save the number of written
+ * bytes.
+ */
+
+YAML_DECLARE(void)
+yaml_emitter_set_output_string(yaml_emitter_t *emitter,
+ unsigned char *output, size_t size, size_t *size_written);
+
+/**
+ * Set a file output.
+ *
+ * @a file should be a file object open for writing. The application is
+ * responsible for closing the @a file.
+ *
+ * @param[in,out] emitter An emitter object.
+ * @param[in] file An open file.
+ */
+
+YAML_DECLARE(void)
+yaml_emitter_set_output_file(yaml_emitter_t *emitter, FILE *file);
+
+/**
+ * Set a generic output handler.
+ *
+ * @param[in,out] emitter An emitter object.
+ * @param[in] handler A write handler.
+ * @param[in] data Any application data for passing to the write
+ * handler.
+ */
+
+YAML_DECLARE(void)
+yaml_emitter_set_output(yaml_emitter_t *emitter,
+ yaml_write_handler_t *handler, void *data);
+
+/**
+ * Set the output encoding.
+ *
+ * @param[in,out] emitter An emitter object.
+ * @param[in] encoding The output encoding.
+ */
+
+YAML_DECLARE(void)
+yaml_emitter_set_encoding(yaml_emitter_t *emitter, yaml_encoding_t encoding);
+
+/**
+ * Set if the output should be in the "canonical" format as in the YAML
+ * specification.
+ *
+ * @param[in,out] emitter An emitter object.
+ * @param[in] canonical If the output is canonical.
+ */
+
+YAML_DECLARE(void)
+yaml_emitter_set_canonical(yaml_emitter_t *emitter, int canonical);
+
+/**
+ * Set the indentation increment.
+ *
+ * @param[in,out] emitter An emitter object.
+ * @param[in] indent The indentation increment (1 < . < 10).
+ */
+
+YAML_DECLARE(void)
+yaml_emitter_set_indent(yaml_emitter_t *emitter, int indent);
+
+/**
+ * Set the preferred line width. @c -1 means unlimited.
+ *
+ * @param[in,out] emitter An emitter object.
+ * @param[in] width The preferred line width.
+ */
+
+YAML_DECLARE(void)
+yaml_emitter_set_width(yaml_emitter_t *emitter, int width);
+
+/**
+ * Set if unescaped non-ASCII characters are allowed.
+ *
+ * @param[in,out] emitter An emitter object.
+ * @param[in] unicode If unescaped Unicode characters are allowed.
+ */
+
+YAML_DECLARE(void)
+yaml_emitter_set_unicode(yaml_emitter_t *emitter, int unicode);
+
+/**
+ * Set the preferred line break.
+ *
+ * @param[in,out] emitter An emitter object.
+ * @param[in] line_break The preferred line break.
+ */
+
+YAML_DECLARE(void)
+yaml_emitter_set_break(yaml_emitter_t *emitter, yaml_break_t line_break);
+
+/**
+ * Emit an event.
+ *
+ * The event object may be generated using the yaml_parser_parse() function.
+ * The emitter takes the responsibility for the event object and destroys its
+ * content after it is emitted. The event object is destroyed even if the
+ * function fails.
+ *
+ * @param[in,out] emitter An emitter object.
+ * @param[in,out] event An event object.
+ *
+ * @returns @c 1 if the function succeeded, @c 0 on error.
+ */
+
+YAML_DECLARE(int)
+yaml_emitter_emit(yaml_emitter_t *emitter, yaml_event_t *event);
+
+/**
+ * Start a YAML stream.
+ *
+ * This function should be used before yaml_emitter_dump() is called.
+ *
+ * @param[in,out] emitter An emitter object.
+ *
+ * @returns @c 1 if the function succeeded, @c 0 on error.
+ */
+
+YAML_DECLARE(int)
+yaml_emitter_open(yaml_emitter_t *emitter);
+
+/**
+ * Finish a YAML stream.
+ *
+ * This function should be used after yaml_emitter_dump() is called.
+ *
+ * @param[in,out] emitter An emitter object.
+ *
+ * @returns @c 1 if the function succeeded, @c 0 on error.
+ */
+
+YAML_DECLARE(int)
+yaml_emitter_close(yaml_emitter_t *emitter);
+
+/**
+ * Emit a YAML document.
+ *
+ * The documen object may be generated using the yaml_parser_load() function
+ * or the yaml_document_initialize() function. The emitter takes the
+ * responsibility for the document object and destoys its content after
+ * it is emitted. The document object is destroyedeven if the function fails.
+ *
+ * @param[in,out] emitter An emitter object.
+ * @param[in,out] document A document object.
+ *
+ * @returns @c 1 if the function succeeded, @c 0 on error.
+ */
+
+YAML_DECLARE(int)
+yaml_emitter_dump(yaml_emitter_t *emitter, yaml_document_t *document);
+
+/**
+ * Flush the accumulated characters to the output.
+ *
+ * @param[in,out] emitter An emitter object.
+ *
+ * @returns @c 1 if the function succeeded, @c 0 on error.
+ */
+
+YAML_DECLARE(int)
+yaml_emitter_flush(yaml_emitter_t *emitter);
+
+/** @} */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* #ifndef YAML_H */
+
diff --git a/ext/psych/yaml/yaml_private.h b/ext/psych/yaml/yaml_private.h
new file mode 100644
index 0000000000..af10c83973
--- /dev/null
+++ b/ext/psych/yaml/yaml_private.h
@@ -0,0 +1,643 @@
+#ifdef RUBY_EXTCONF_H
+#include RUBY_EXTCONF_H
+#endif
+
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <yaml.h>
+
+#include <assert.h>
+#include <limits.h>
+
+/*
+ * Memory management.
+ */
+
+YAML_DECLARE(void *)
+yaml_malloc(size_t size);
+
+YAML_DECLARE(void *)
+yaml_realloc(void *ptr, size_t size);
+
+YAML_DECLARE(void)
+yaml_free(void *ptr);
+
+YAML_DECLARE(yaml_char_t *)
+yaml_strdup(const yaml_char_t *);
+
+/*
+ * Reader: Ensure that the buffer contains at least `length` characters.
+ */
+
+YAML_DECLARE(int)
+yaml_parser_update_buffer(yaml_parser_t *parser, size_t length);
+
+/*
+ * Scanner: Ensure that the token stack contains at least one token ready.
+ */
+
+YAML_DECLARE(int)
+yaml_parser_fetch_more_tokens(yaml_parser_t *parser);
+
+/*
+ * The size of the input raw buffer.
+ */
+
+#define INPUT_RAW_BUFFER_SIZE 16384
+
+/*
+ * The size of the input buffer.
+ *
+ * It should be possible to decode the whole raw buffer.
+ */
+
+#define INPUT_BUFFER_SIZE (INPUT_RAW_BUFFER_SIZE*3)
+
+/*
+ * The size of the output buffer.
+ */
+
+#define OUTPUT_BUFFER_SIZE 16384
+
+/*
+ * The size of the output raw buffer.
+ *
+ * It should be possible to encode the whole output buffer.
+ */
+
+#define OUTPUT_RAW_BUFFER_SIZE (OUTPUT_BUFFER_SIZE*2+2)
+
+/*
+ * The size of other stacks and queues.
+ */
+
+#define INITIAL_STACK_SIZE 16
+#define INITIAL_QUEUE_SIZE 16
+#define INITIAL_STRING_SIZE 16
+
+/*
+ * Buffer management.
+ */
+
+#define BUFFER_INIT(context,buffer,size) \
+ (((buffer).start = yaml_malloc(size)) ? \
+ ((buffer).last = (buffer).pointer = (buffer).start, \
+ (buffer).end = (buffer).start+(size), \
+ 1) : \
+ ((context)->error = YAML_MEMORY_ERROR, \
+ 0))
+
+#define BUFFER_DEL(context,buffer) \
+ (yaml_free((buffer).start), \
+ (buffer).start = (buffer).pointer = (buffer).end = 0)
+
+/*
+ * String management.
+ */
+
+typedef struct {
+ yaml_char_t *start;
+ yaml_char_t *end;
+ yaml_char_t *pointer;
+} yaml_string_t;
+
+YAML_DECLARE(int)
+yaml_string_extend(yaml_char_t **start,
+ yaml_char_t **pointer, yaml_char_t **end);
+
+YAML_DECLARE(int)
+yaml_string_join(
+ yaml_char_t **a_start, yaml_char_t **a_pointer, yaml_char_t **a_end,
+ yaml_char_t **b_start, yaml_char_t **b_pointer, yaml_char_t **b_end);
+
+#define NULL_STRING { NULL, NULL, NULL }
+
+#define STRING(string,length) { (string), (string)+(length), (string) }
+
+#define STRING_ASSIGN(value,string,length) \
+ ((value).start = (string), \
+ (value).end = (string)+(length), \
+ (value).pointer = (string))
+
+#define STRING_INIT(context,string,size) \
+ (((string).start = yaml_malloc(size)) ? \
+ ((string).pointer = (string).start, \
+ (string).end = (string).start+(size), \
+ memset((string).start, 0, (size)), \
+ 1) : \
+ ((context)->error = YAML_MEMORY_ERROR, \
+ 0))
+
+#define STRING_DEL(context,string) \
+ (yaml_free((string).start), \
+ (string).start = (string).pointer = (string).end = 0)
+
+#define STRING_EXTEND(context,string) \
+ (((string).pointer+5 < (string).end) \
+ || yaml_string_extend(&(string).start, \
+ &(string).pointer, &(string).end))
+
+#define CLEAR(context,string) \
+ ((string).pointer = (string).start, \
+ memset((string).start, 0, (string).end-(string).start))
+
+#define JOIN(context,string_a,string_b) \
+ ((yaml_string_join(&(string_a).start, &(string_a).pointer, \
+ &(string_a).end, &(string_b).start, \
+ &(string_b).pointer, &(string_b).end)) ? \
+ ((string_b).pointer = (string_b).start, \
+ 1) : \
+ ((context)->error = YAML_MEMORY_ERROR, \
+ 0))
+
+/*
+ * String check operations.
+ */
+
+/*
+ * Check the octet at the specified position.
+ */
+
+#define CHECK_AT(string,octet,offset) \
+ ((string).pointer[offset] == (yaml_char_t)(octet))
+
+/*
+ * Check the current octet in the buffer.
+ */
+
+#define CHECK(string,octet) CHECK_AT((string),(octet),0)
+
+/*
+ * Check if the character at the specified position is an alphabetical
+ * character, a digit, '_', or '-'.
+ */
+
+#define IS_ALPHA_AT(string,offset) \
+ (((string).pointer[offset] >= (yaml_char_t) '0' && \
+ (string).pointer[offset] <= (yaml_char_t) '9') || \
+ ((string).pointer[offset] >= (yaml_char_t) 'A' && \
+ (string).pointer[offset] <= (yaml_char_t) 'Z') || \
+ ((string).pointer[offset] >= (yaml_char_t) 'a' && \
+ (string).pointer[offset] <= (yaml_char_t) 'z') || \
+ (string).pointer[offset] == '_' || \
+ (string).pointer[offset] == '-')
+
+#define IS_ALPHA(string) IS_ALPHA_AT((string),0)
+
+/*
+ * Check if the character at the specified position is a digit.
+ */
+
+#define IS_DIGIT_AT(string,offset) \
+ (((string).pointer[offset] >= (yaml_char_t) '0' && \
+ (string).pointer[offset] <= (yaml_char_t) '9'))
+
+#define IS_DIGIT(string) IS_DIGIT_AT((string),0)
+
+/*
+ * Get the value of a digit.
+ */
+
+#define AS_DIGIT_AT(string,offset) \
+ ((string).pointer[offset] - (yaml_char_t) '0')
+
+#define AS_DIGIT(string) AS_DIGIT_AT((string),0)
+
+/*
+ * Check if the character at the specified position is a hex-digit.
+ */
+
+#define IS_HEX_AT(string,offset) \
+ (((string).pointer[offset] >= (yaml_char_t) '0' && \
+ (string).pointer[offset] <= (yaml_char_t) '9') || \
+ ((string).pointer[offset] >= (yaml_char_t) 'A' && \
+ (string).pointer[offset] <= (yaml_char_t) 'F') || \
+ ((string).pointer[offset] >= (yaml_char_t) 'a' && \
+ (string).pointer[offset] <= (yaml_char_t) 'f'))
+
+#define IS_HEX(string) IS_HEX_AT((string),0)
+
+/*
+ * Get the value of a hex-digit.
+ */
+
+#define AS_HEX_AT(string,offset) \
+ (((string).pointer[offset] >= (yaml_char_t) 'A' && \
+ (string).pointer[offset] <= (yaml_char_t) 'F') ? \
+ ((string).pointer[offset] - (yaml_char_t) 'A' + 10) : \
+ ((string).pointer[offset] >= (yaml_char_t) 'a' && \
+ (string).pointer[offset] <= (yaml_char_t) 'f') ? \
+ ((string).pointer[offset] - (yaml_char_t) 'a' + 10) : \
+ ((string).pointer[offset] - (yaml_char_t) '0'))
+
+#define AS_HEX(string) AS_HEX_AT((string),0)
+
+/*
+ * Check if the character is ASCII.
+ */
+
+#define IS_ASCII_AT(string,offset) \
+ ((string).pointer[offset] <= (yaml_char_t) '\x7F')
+
+#define IS_ASCII(string) IS_ASCII_AT((string),0)
+
+/*
+ * Check if the character can be printed unescaped.
+ */
+
+#define IS_PRINTABLE_AT(string,offset) \
+ (((string).pointer[offset] == 0x0A) /* . == #x0A */ \
+ || ((string).pointer[offset] >= 0x20 /* #x20 <= . <= #x7E */ \
+ && (string).pointer[offset] <= 0x7E) \
+ || ((string).pointer[offset] == 0xC2 /* #0xA0 <= . <= #xD7FF */ \
+ && (string).pointer[offset+1] >= 0xA0) \
+ || ((string).pointer[offset] > 0xC2 \
+ && (string).pointer[offset] < 0xED) \
+ || ((string).pointer[offset] == 0xED \
+ && (string).pointer[offset+1] < 0xA0) \
+ || ((string).pointer[offset] == 0xEE) \
+ || ((string).pointer[offset] == 0xEF /* #xE000 <= . <= #xFFFD */ \
+ && !((string).pointer[offset+1] == 0xBB /* && . != #xFEFF */ \
+ && (string).pointer[offset+2] == 0xBF) \
+ && !((string).pointer[offset+1] == 0xBF \
+ && ((string).pointer[offset+2] == 0xBE \
+ || (string).pointer[offset+2] == 0xBF))))
+
+#define IS_PRINTABLE(string) IS_PRINTABLE_AT((string),0)
+
+/*
+ * Check if the character at the specified position is NUL.
+ */
+
+#define IS_Z_AT(string,offset) CHECK_AT((string),'\0',(offset))
+
+#define IS_Z(string) IS_Z_AT((string),0)
+
+/*
+ * Check if the character at the specified position is BOM.
+ */
+
+#define IS_BOM_AT(string,offset) \
+ (CHECK_AT((string),'\xEF',(offset)) \
+ && CHECK_AT((string),'\xBB',(offset)+1) \
+ && CHECK_AT((string),'\xBF',(offset)+2)) /* BOM (#xFEFF) */
+
+#define IS_BOM(string) IS_BOM_AT(string,0)
+
+/*
+ * Check if the character at the specified position is space.
+ */
+
+#define IS_SPACE_AT(string,offset) CHECK_AT((string),' ',(offset))
+
+#define IS_SPACE(string) IS_SPACE_AT((string),0)
+
+/*
+ * Check if the character at the specified position is tab.
+ */
+
+#define IS_TAB_AT(string,offset) CHECK_AT((string),'\t',(offset))
+
+#define IS_TAB(string) IS_TAB_AT((string),0)
+
+/*
+ * Check if the character at the specified position is blank (space or tab).
+ */
+
+#define IS_BLANK_AT(string,offset) \
+ (IS_SPACE_AT((string),(offset)) || IS_TAB_AT((string),(offset)))
+
+#define IS_BLANK(string) IS_BLANK_AT((string),0)
+
+/*
+ * Check if the character at the specified position is a line break.
+ */
+
+#define IS_BREAK_AT(string,offset) \
+ (CHECK_AT((string),'\r',(offset)) /* CR (#xD)*/ \
+ || CHECK_AT((string),'\n',(offset)) /* LF (#xA) */ \
+ || (CHECK_AT((string),'\xC2',(offset)) \
+ && CHECK_AT((string),'\x85',(offset)+1)) /* NEL (#x85) */ \
+ || (CHECK_AT((string),'\xE2',(offset)) \
+ && CHECK_AT((string),'\x80',(offset)+1) \
+ && CHECK_AT((string),'\xA8',(offset)+2)) /* LS (#x2028) */ \
+ || (CHECK_AT((string),'\xE2',(offset)) \
+ && CHECK_AT((string),'\x80',(offset)+1) \
+ && CHECK_AT((string),'\xA9',(offset)+2))) /* PS (#x2029) */
+
+#define IS_BREAK(string) IS_BREAK_AT((string),0)
+
+#define IS_CRLF_AT(string,offset) \
+ (CHECK_AT((string),'\r',(offset)) && CHECK_AT((string),'\n',(offset)+1))
+
+#define IS_CRLF(string) IS_CRLF_AT((string),0)
+
+/*
+ * Check if the character is a line break or NUL.
+ */
+
+#define IS_BREAKZ_AT(string,offset) \
+ (IS_BREAK_AT((string),(offset)) || IS_Z_AT((string),(offset)))
+
+#define IS_BREAKZ(string) IS_BREAKZ_AT((string),0)
+
+/*
+ * Check if the character is a line break, space, or NUL.
+ */
+
+#define IS_SPACEZ_AT(string,offset) \
+ (IS_SPACE_AT((string),(offset)) || IS_BREAKZ_AT((string),(offset)))
+
+#define IS_SPACEZ(string) IS_SPACEZ_AT((string),0)
+
+/*
+ * Check if the character is a line break, space, tab, or NUL.
+ */
+
+#define IS_BLANKZ_AT(string,offset) \
+ (IS_BLANK_AT((string),(offset)) || IS_BREAKZ_AT((string),(offset)))
+
+#define IS_BLANKZ(string) IS_BLANKZ_AT((string),0)
+
+/*
+ * Determine the width of the character.
+ */
+
+#define WIDTH_AT(string,offset) \
+ (((string).pointer[offset] & 0x80) == 0x00 ? 1 : \
+ ((string).pointer[offset] & 0xE0) == 0xC0 ? 2 : \
+ ((string).pointer[offset] & 0xF0) == 0xE0 ? 3 : \
+ ((string).pointer[offset] & 0xF8) == 0xF0 ? 4 : 0)
+
+#define WIDTH(string) WIDTH_AT((string),0)
+
+/*
+ * Move the string pointer to the next character.
+ */
+
+#define MOVE(string) ((string).pointer += WIDTH((string)))
+
+/*
+ * Copy a character and move the pointers of both strings.
+ */
+
+#define COPY(string_a,string_b) \
+ ((*(string_b).pointer & 0x80) == 0x00 ? \
+ (*((string_a).pointer++) = *((string_b).pointer++)) : \
+ (*(string_b).pointer & 0xE0) == 0xC0 ? \
+ (*((string_a).pointer++) = *((string_b).pointer++), \
+ *((string_a).pointer++) = *((string_b).pointer++)) : \
+ (*(string_b).pointer & 0xF0) == 0xE0 ? \
+ (*((string_a).pointer++) = *((string_b).pointer++), \
+ *((string_a).pointer++) = *((string_b).pointer++), \
+ *((string_a).pointer++) = *((string_b).pointer++)) : \
+ (*(string_b).pointer & 0xF8) == 0xF0 ? \
+ (*((string_a).pointer++) = *((string_b).pointer++), \
+ *((string_a).pointer++) = *((string_b).pointer++), \
+ *((string_a).pointer++) = *((string_b).pointer++), \
+ *((string_a).pointer++) = *((string_b).pointer++)) : 0)
+
+/*
+ * Stack and queue management.
+ */
+
+YAML_DECLARE(int)
+yaml_stack_extend(void **start, void **top, void **end);
+
+YAML_DECLARE(int)
+yaml_queue_extend(void **start, void **head, void **tail, void **end);
+
+#define STACK_INIT(context,stack,size) \
+ (((stack).start = yaml_malloc((size)*sizeof(*(stack).start))) ? \
+ ((stack).top = (stack).start, \
+ (stack).end = (stack).start+(size), \
+ 1) : \
+ ((context)->error = YAML_MEMORY_ERROR, \
+ 0))
+
+#define STACK_DEL(context,stack) \
+ (yaml_free((stack).start), \
+ (stack).start = (stack).top = (stack).end = 0)
+
+#define STACK_EMPTY(context,stack) \
+ ((stack).start == (stack).top)
+
+#define PUSH(context,stack,value) \
+ (((stack).top != (stack).end \
+ || yaml_stack_extend((void **)&(stack).start, \
+ (void **)&(stack).top, (void **)&(stack).end)) ? \
+ (*((stack).top++) = value, \
+ 1) : \
+ ((context)->error = YAML_MEMORY_ERROR, \
+ 0))
+
+#define POP(context,stack) \
+ (*(--(stack).top))
+
+#define QUEUE_INIT(context,queue,size) \
+ (((queue).start = yaml_malloc((size)*sizeof(*(queue).start))) ? \
+ ((queue).head = (queue).tail = (queue).start, \
+ (queue).end = (queue).start+(size), \
+ 1) : \
+ ((context)->error = YAML_MEMORY_ERROR, \
+ 0))
+
+#define QUEUE_DEL(context,queue) \
+ (yaml_free((queue).start), \
+ (queue).start = (queue).head = (queue).tail = (queue).end = 0)
+
+#define QUEUE_EMPTY(context,queue) \
+ ((queue).head == (queue).tail)
+
+#define ENQUEUE(context,queue,value) \
+ (((queue).tail != (queue).end \
+ || yaml_queue_extend((void **)&(queue).start, (void **)&(queue).head, \
+ (void **)&(queue).tail, (void **)&(queue).end)) ? \
+ (*((queue).tail++) = value, \
+ 1) : \
+ ((context)->error = YAML_MEMORY_ERROR, \
+ 0))
+
+#define DEQUEUE(context,queue) \
+ (*((queue).head++))
+
+#define QUEUE_INSERT(context,queue,index,value) \
+ (((queue).tail != (queue).end \
+ || yaml_queue_extend((void **)&(queue).start, (void **)&(queue).head, \
+ (void **)&(queue).tail, (void **)&(queue).end)) ? \
+ (memmove((queue).head+(index)+1,(queue).head+(index), \
+ ((queue).tail-(queue).head-(index))*sizeof(*(queue).start)), \
+ *((queue).head+(index)) = value, \
+ (queue).tail++, \
+ 1) : \
+ ((context)->error = YAML_MEMORY_ERROR, \
+ 0))
+
+/*
+ * Token initializers.
+ */
+
+#define TOKEN_INIT(token,token_type,token_start_mark,token_end_mark) \
+ (memset(&(token), 0, sizeof(yaml_token_t)), \
+ (token).type = (token_type), \
+ (token).start_mark = (token_start_mark), \
+ (token).end_mark = (token_end_mark))
+
+#define STREAM_START_TOKEN_INIT(token,token_encoding,start_mark,end_mark) \
+ (TOKEN_INIT((token),YAML_STREAM_START_TOKEN,(start_mark),(end_mark)), \
+ (token).data.stream_start.encoding = (token_encoding))
+
+#define STREAM_END_TOKEN_INIT(token,start_mark,end_mark) \
+ (TOKEN_INIT((token),YAML_STREAM_END_TOKEN,(start_mark),(end_mark)))
+
+#define ALIAS_TOKEN_INIT(token,token_value,start_mark,end_mark) \
+ (TOKEN_INIT((token),YAML_ALIAS_TOKEN,(start_mark),(end_mark)), \
+ (token).data.alias.value = (token_value))
+
+#define ANCHOR_TOKEN_INIT(token,token_value,start_mark,end_mark) \
+ (TOKEN_INIT((token),YAML_ANCHOR_TOKEN,(start_mark),(end_mark)), \
+ (token).data.anchor.value = (token_value))
+
+#define TAG_TOKEN_INIT(token,token_handle,token_suffix,start_mark,end_mark) \
+ (TOKEN_INIT((token),YAML_TAG_TOKEN,(start_mark),(end_mark)), \
+ (token).data.tag.handle = (token_handle), \
+ (token).data.tag.suffix = (token_suffix))
+
+#define SCALAR_TOKEN_INIT(token,token_value,token_length,token_style,start_mark,end_mark) \
+ (TOKEN_INIT((token),YAML_SCALAR_TOKEN,(start_mark),(end_mark)), \
+ (token).data.scalar.value = (token_value), \
+ (token).data.scalar.length = (token_length), \
+ (token).data.scalar.style = (token_style))
+
+#define VERSION_DIRECTIVE_TOKEN_INIT(token,token_major,token_minor,start_mark,end_mark) \
+ (TOKEN_INIT((token),YAML_VERSION_DIRECTIVE_TOKEN,(start_mark),(end_mark)), \
+ (token).data.version_directive.major = (token_major), \
+ (token).data.version_directive.minor = (token_minor))
+
+#define TAG_DIRECTIVE_TOKEN_INIT(token,token_handle,token_prefix,start_mark,end_mark) \
+ (TOKEN_INIT((token),YAML_TAG_DIRECTIVE_TOKEN,(start_mark),(end_mark)), \
+ (token).data.tag_directive.handle = (token_handle), \
+ (token).data.tag_directive.prefix = (token_prefix))
+
+/*
+ * Event initializers.
+ */
+
+#define EVENT_INIT(event,event_type,event_start_mark,event_end_mark) \
+ (memset(&(event), 0, sizeof(yaml_event_t)), \
+ (event).type = (event_type), \
+ (event).start_mark = (event_start_mark), \
+ (event).end_mark = (event_end_mark))
+
+#define STREAM_START_EVENT_INIT(event,event_encoding,start_mark,end_mark) \
+ (EVENT_INIT((event),YAML_STREAM_START_EVENT,(start_mark),(end_mark)), \
+ (event).data.stream_start.encoding = (event_encoding))
+
+#define STREAM_END_EVENT_INIT(event,start_mark,end_mark) \
+ (EVENT_INIT((event),YAML_STREAM_END_EVENT,(start_mark),(end_mark)))
+
+#define DOCUMENT_START_EVENT_INIT(event,event_version_directive, \
+ event_tag_directives_start,event_tag_directives_end,event_implicit,start_mark,end_mark) \
+ (EVENT_INIT((event),YAML_DOCUMENT_START_EVENT,(start_mark),(end_mark)), \
+ (event).data.document_start.version_directive = (event_version_directive), \
+ (event).data.document_start.tag_directives.start = (event_tag_directives_start), \
+ (event).data.document_start.tag_directives.end = (event_tag_directives_end), \
+ (event).data.document_start.implicit = (event_implicit))
+
+#define DOCUMENT_END_EVENT_INIT(event,event_implicit,start_mark,end_mark) \
+ (EVENT_INIT((event),YAML_DOCUMENT_END_EVENT,(start_mark),(end_mark)), \
+ (event).data.document_end.implicit = (event_implicit))
+
+#define ALIAS_EVENT_INIT(event,event_anchor,start_mark,end_mark) \
+ (EVENT_INIT((event),YAML_ALIAS_EVENT,(start_mark),(end_mark)), \
+ (event).data.alias.anchor = (event_anchor))
+
+#define SCALAR_EVENT_INIT(event,event_anchor,event_tag,event_value,event_length, \
+ event_plain_implicit, event_quoted_implicit,event_style,start_mark,end_mark) \
+ (EVENT_INIT((event),YAML_SCALAR_EVENT,(start_mark),(end_mark)), \
+ (event).data.scalar.anchor = (event_anchor), \
+ (event).data.scalar.tag = (event_tag), \
+ (event).data.scalar.value = (event_value), \
+ (event).data.scalar.length = (event_length), \
+ (event).data.scalar.plain_implicit = (event_plain_implicit), \
+ (event).data.scalar.quoted_implicit = (event_quoted_implicit), \
+ (event).data.scalar.style = (event_style))
+
+#define SEQUENCE_START_EVENT_INIT(event,event_anchor,event_tag, \
+ event_implicit,event_style,start_mark,end_mark) \
+ (EVENT_INIT((event),YAML_SEQUENCE_START_EVENT,(start_mark),(end_mark)), \
+ (event).data.sequence_start.anchor = (event_anchor), \
+ (event).data.sequence_start.tag = (event_tag), \
+ (event).data.sequence_start.implicit = (event_implicit), \
+ (event).data.sequence_start.style = (event_style))
+
+#define SEQUENCE_END_EVENT_INIT(event,start_mark,end_mark) \
+ (EVENT_INIT((event),YAML_SEQUENCE_END_EVENT,(start_mark),(end_mark)))
+
+#define MAPPING_START_EVENT_INIT(event,event_anchor,event_tag, \
+ event_implicit,event_style,start_mark,end_mark) \
+ (EVENT_INIT((event),YAML_MAPPING_START_EVENT,(start_mark),(end_mark)), \
+ (event).data.mapping_start.anchor = (event_anchor), \
+ (event).data.mapping_start.tag = (event_tag), \
+ (event).data.mapping_start.implicit = (event_implicit), \
+ (event).data.mapping_start.style = (event_style))
+
+#define MAPPING_END_EVENT_INIT(event,start_mark,end_mark) \
+ (EVENT_INIT((event),YAML_MAPPING_END_EVENT,(start_mark),(end_mark)))
+
+/*
+ * Document initializer.
+ */
+
+#define DOCUMENT_INIT(document,document_nodes_start,document_nodes_end, \
+ document_version_directive,document_tag_directives_start, \
+ document_tag_directives_end,document_start_implicit, \
+ document_end_implicit,document_start_mark,document_end_mark) \
+ (memset(&(document), 0, sizeof(yaml_document_t)), \
+ (document).nodes.start = (document_nodes_start), \
+ (document).nodes.end = (document_nodes_end), \
+ (document).nodes.top = (document_nodes_start), \
+ (document).version_directive = (document_version_directive), \
+ (document).tag_directives.start = (document_tag_directives_start), \
+ (document).tag_directives.end = (document_tag_directives_end), \
+ (document).start_implicit = (document_start_implicit), \
+ (document).end_implicit = (document_end_implicit), \
+ (document).start_mark = (document_start_mark), \
+ (document).end_mark = (document_end_mark))
+
+/*
+ * Node initializers.
+ */
+
+#define NODE_INIT(node,node_type,node_tag,node_start_mark,node_end_mark) \
+ (memset(&(node), 0, sizeof(yaml_node_t)), \
+ (node).type = (node_type), \
+ (node).tag = (node_tag), \
+ (node).start_mark = (node_start_mark), \
+ (node).end_mark = (node_end_mark))
+
+#define SCALAR_NODE_INIT(node,node_tag,node_value,node_length, \
+ node_style,start_mark,end_mark) \
+ (NODE_INIT((node),YAML_SCALAR_NODE,(node_tag),(start_mark),(end_mark)), \
+ (node).data.scalar.value = (node_value), \
+ (node).data.scalar.length = (node_length), \
+ (node).data.scalar.style = (node_style))
+
+#define SEQUENCE_NODE_INIT(node,node_tag,node_items_start,node_items_end, \
+ node_style,start_mark,end_mark) \
+ (NODE_INIT((node),YAML_SEQUENCE_NODE,(node_tag),(start_mark),(end_mark)), \
+ (node).data.sequence.items.start = (node_items_start), \
+ (node).data.sequence.items.end = (node_items_end), \
+ (node).data.sequence.items.top = (node_items_start), \
+ (node).data.sequence.style = (node_style))
+
+#define MAPPING_NODE_INIT(node,node_tag,node_pairs_start,node_pairs_end, \
+ node_style,start_mark,end_mark) \
+ (NODE_INIT((node),YAML_MAPPING_NODE,(node_tag),(start_mark),(end_mark)), \
+ (node).data.mapping.pairs.start = (node_pairs_start), \
+ (node).data.mapping.pairs.end = (node_pairs_end), \
+ (node).data.mapping.pairs.top = (node_pairs_start), \
+ (node).data.mapping.style = (node_style))
+
diff --git a/ext/pty/depend b/ext/pty/depend
index 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/extconf.rb b/ext/pty/extconf.rb
index 3d6d0f1e46..1db9f6e8aa 100644
--- a/ext/pty/extconf.rb
+++ b/ext/pty/extconf.rb
@@ -1,6 +1,8 @@
require 'mkmf'
-if /mswin|mingw|bccwin/ !~ RUBY_PLATFORM
+$INCFLAGS << " -I$(topdir) -I$(top_srcdir)"
+
+if /mswin|mingw|bccwin|nacl/ !~ RUBY_PLATFORM
have_header("sys/stropts.h")
have_func("setresuid")
have_header("libutil.h")
diff --git a/ext/pty/lib/expect.rb b/ext/pty/lib/expect.rb
index c15044bd2a..c3f3925be7 100644
--- a/ext/pty/lib/expect.rb
+++ b/ext/pty/lib/expect.rb
@@ -1,10 +1,30 @@
$expect_verbose = false
+# Expect library adds the IO instance method #expect, which does similar act to
+# tcl's expect extension.
+#
+# In order to use this method, you must require expect:
+#
+# require 'expect'
+#
+# Please see #expect for usage.
class IO
- # Reads from the IO until pattern +pat+ matches or the +timeout+ is over.
+ # call-seq:
+ # IO#expect(pattern,timeout=9999999) -> Array
+ # IO#expect(pattern,timeout=9999999) { |result| ... } -> nil
+ #
+ # Reads from the IO until the given +pattern+ matches or the +timeout+ is over.
+ #
# It returns an array with the read buffer, followed by the matches.
# If a block is given, the result is yielded to the block and returns nil.
#
+ # When called without a block, it waits until the input that matches the
+ # given +pattern+ is obtained from the IO or the time specified as the
+ # timeout passes. An array is returned when the pattern is obtained from the
+ # IO. The first element of the array is the entire string obtained from the
+ # IO until the pattern matches, followed by elements indicating which the
+ # pattern which matched to the anchor in the regular expression.
+ #
# The optional timeout parameter defines, in seconds, the total time to wait
# for the pattern. If the timeout expires or eof is found, nil is returned
# or yielded. However, the buffer in a timeout session is kept for the next
@@ -17,7 +37,7 @@ class IO
when Regexp
e_pat = pat
else
- raise TypeError, "unsupported pattern class: #{pattern.class}"
+ raise TypeError, "unsupported pattern class: #{pat.class}"
end
@unusedBuf ||= ''
while true
diff --git a/ext/pty/pty.c b/ext/pty/pty.c
index b18eb68f77..4ba1cba621 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
@@ -32,6 +36,7 @@
#include "ruby/ruby.h"
#include "ruby/io.h"
#include "ruby/util.h"
+#include "internal.h"
#include <signal.h>
#ifdef HAVE_SYS_STROPTS_H
@@ -44,70 +49,6 @@
#define DEVICELEN 16
-#if !defined(HAVE_OPENPTY)
-#if defined(__hpux)
-static const
-char MasterDevice[] = "/dev/ptym/pty%s",
- SlaveDevice[] = "/dev/pty/tty%s",
- *const deviceNo[] = {
- "p0","p1","p2","p3","p4","p5","p6","p7",
- "p8","p9","pa","pb","pc","pd","pe","pf",
- "q0","q1","q2","q3","q4","q5","q6","q7",
- "q8","q9","qa","qb","qc","qd","qe","qf",
- "r0","r1","r2","r3","r4","r5","r6","r7",
- "r8","r9","ra","rb","rc","rd","re","rf",
- "s0","s1","s2","s3","s4","s5","s6","s7",
- "s8","s9","sa","sb","sc","sd","se","sf",
- "t0","t1","t2","t3","t4","t5","t6","t7",
- "t8","t9","ta","tb","tc","td","te","tf",
- "u0","u1","u2","u3","u4","u5","u6","u7",
- "u8","u9","ua","ub","uc","ud","ue","uf",
- "v0","v1","v2","v3","v4","v5","v6","v7",
- "v8","v9","va","vb","vc","vd","ve","vf",
- "w0","w1","w2","w3","w4","w5","w6","w7",
- "w8","w9","wa","wb","wc","wd","we","wf",
- 0,
- };
-#elif defined(_IBMESA) /* AIX/ESA */
-static const
-char MasterDevice[] = "/dev/ptyp%s",
- SlaveDevice[] = "/dev/ttyp%s",
- *const deviceNo[] = {
-"00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f",
-"10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f",
-"20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f",
-"30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f",
-"40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f",
-"50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f",
-"60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f",
-"70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f",
-"80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f",
-"90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f",
-"a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af",
-"b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf",
-"c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf",
-"d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df",
-"e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef",
-"f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff",
- };
-#elif !defined(HAVE_PTSNAME)
-static const
-char MasterDevice[] = "/dev/pty%s",
- SlaveDevice[] = "/dev/tty%s",
- *const deviceNo[] = {
- "p0","p1","p2","p3","p4","p5","p6","p7",
- "p8","p9","pa","pb","pc","pd","pe","pf",
- "q0","q1","q2","q3","q4","q5","q6","q7",
- "q8","q9","qa","qb","qc","qd","qe","qf",
- "r0","r1","r2","r3","r4","r5","r6","r7",
- "r8","r9","ra","rb","rc","rd","re","rf",
- "s0","s1","s2","s3","s4","s5","s6","s7",
- "s8","s9","sa","sb","sc","sd","se","sf",
- 0,
- };
-#endif
-#endif /* !defined(HAVE_OPENPTY) */
-
#ifndef HAVE_SETEUID
# ifdef HAVE_SETREUID
# define seteuid(e) setreuid(-1, (e))
@@ -141,8 +82,8 @@ static void getDevice(int*, int*, char [DEVICELEN], int);
struct child_info {
int master, slave;
char *slavename;
- int argc;
- VALUE *argv;
+ VALUE execarg_obj;
+ struct rb_execarg *eargp;
};
static int
@@ -151,16 +92,12 @@ chfunc(void *data, char *errbuf, size_t errbuf_len)
struct child_info *carg = data;
int master = carg->master;
int slave = carg->slave;
- int argc = carg->argc;
- VALUE *argv = carg->argv;
#define ERROR_EXIT(str) do { \
strlcpy(errbuf, (str), errbuf_len); \
return -1; \
} while (0)
- rb_thread_atfork_before_exec();
-
/*
* Set free from process group and controlling terminal
*/
@@ -175,7 +112,7 @@ chfunc(void *data, char *errbuf, size_t errbuf_len)
if (setpgrp(0, getpid()) == -1)
ERROR_EXIT("setpgrp()");
{
- int i = open("/dev/tty", O_RDONLY);
+ int i = rb_cloexec_open("/dev/tty", O_RDONLY, 0);
if (i < 0) ERROR_EXIT("/dev/tty");
rb_update_max_fd(i);
if (ioctl(i, TIOCNOTTY, (char *)0))
@@ -195,7 +132,7 @@ chfunc(void *data, char *errbuf, size_t errbuf_len)
/* errors ignored for sun */
#else
close(slave);
- slave = open(carg->slavename, O_RDWR);
+ slave = rb_cloexec_open(carg->slavename, O_RDWR, 0);
if (slave < 0) {
ERROR_EXIT("open: pty slave");
}
@@ -207,11 +144,10 @@ 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
- rb_f_exec(argc, argv);
- return 0;
+ return rb_exec_async_signal_safe(carg->eargp, errbuf, sizeof(errbuf_len));
#undef ERROR_EXIT
}
@@ -219,7 +155,7 @@ static void
establishShell(int argc, VALUE *argv, struct pty_info *info,
char SlaveName[DEVICELEN])
{
- int master,slave;
+ int master, slave, status = 0;
rb_pid_t pid;
char *p, *getenv();
struct passwd *pwent;
@@ -245,21 +181,24 @@ establishShell(int argc, VALUE *argv, struct pty_info *info,
argv = &v;
}
+ carg.execarg_obj = rb_execarg_new(argc, argv, 1);
+ carg.eargp = rb_execarg_get(carg.execarg_obj);
+ rb_execarg_fixup(carg.execarg_obj);
+
getDevice(&master, &slave, SlaveName, 0);
carg.master = master;
carg.slave = slave;
carg.slavename = SlaveName;
- carg.argc = argc;
- carg.argv = argv;
errbuf[0] = '\0';
- pid = rb_fork_err(0, chfunc, &carg, Qnil, errbuf, sizeof(errbuf));
+ pid = rb_fork_async_signal_safe(&status, chfunc, &carg, Qnil, errbuf, sizeof(errbuf));
if (pid < 0) {
int e = errno;
close(master);
close(slave);
errno = e;
+ if (status) rb_jump_tag(status);
rb_sys_fail(errbuf[0] ? errbuf : "fork failed");
}
@@ -267,6 +206,8 @@ establishShell(int argc, VALUE *argv, struct pty_info *info,
info->child_pid = pid;
info->fd = master;
+
+ RB_GC_GUARD(carg.execarg_obj);
}
static int
@@ -282,6 +223,7 @@ static int
get_device_once(int *master, int *slave, char SlaveName[DEVICELEN], int nomesg, int fail)
{
#if defined(HAVE_POSIX_OPENPT)
+ /* Unix98 PTY */
int masterfd = -1, slavefd = -1;
char *slavedevice;
struct sigaction dfl, old;
@@ -290,18 +232,37 @@ 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__) && __FreeBSD_version < 902000)
+ /* workaround for Solaris 10: grantpt() doesn't work if FD_CLOEXEC is set. [ruby-dev:44688] */
+ /* 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;
- rb_update_max_fd(masterfd);
if (sigaction(SIGCHLD, &dfl, &old) == -1) goto error;
if (grantpt(masterfd) == -1) goto grantpt_error;
+ rb_fd_fix_cloexec(masterfd);
+#else
+ {
+ int flags = O_RDWR|O_NOCTTY;
+# if defined(O_CLOEXEC)
+ /* glibc posix_openpt() in GNU/Linux calls open("/dev/ptmx", flags) internally.
+ * So version dependency on GNU/Linux is same as O_CLOEXEC with open().
+ * O_CLOEXEC is available since Linux 2.6.23. Linux 2.6.18 silently ignore it. */
+ flags |= O_CLOEXEC;
+# endif
+ if ((masterfd = posix_openpt(flags)) == -1) goto error;
+ }
+ rb_fd_fix_cloexec(masterfd);
+ if (sigaction(SIGCHLD, &dfl, &old) == -1) goto error;
+ if (grantpt(masterfd) == -1) goto grantpt_error;
+#endif
if (sigaction(SIGCHLD, &old, NULL) == -1) goto error;
if (unlockpt(masterfd) == -1) goto error;
if ((slavedevice = ptsname(masterfd)) == NULL) goto error;
if (no_mesg(slavedevice, nomesg) == -1) goto error;
- if ((slavefd = open(slavedevice, O_RDWR|O_NOCTTY, 0)) == -1) goto error;
+ if ((slavefd = rb_cloexec_open(slavedevice, O_RDWR|O_NOCTTY, 0)) == -1) goto error;
rb_update_max_fd(slavefd);
-#if defined I_PUSH && !defined linux
+#if defined(I_PUSH) && !defined(__linux__)
if (ioctl(slavefd, I_PUSH, "ptem") == -1) goto error;
if (ioctl(slavefd, I_PUSH, "ldterm") == -1) goto error;
if (ioctl(slavefd, I_PUSH, "ttcompat") == -1) goto error;
@@ -331,8 +292,8 @@ get_device_once(int *master, int *slave, char SlaveName[DEVICELEN], int nomesg,
if (!fail) return -1;
rb_raise(rb_eRuntimeError, "openpty() failed");
}
- rb_update_max_fd(*master);
- rb_update_max_fd(*slave);
+ rb_fd_fix_cloexec(*master);
+ rb_fd_fix_cloexec(*slave);
if (no_mesg(SlaveName, nomesg) == -1) {
if (!fail) return -1;
rb_raise(rb_eRuntimeError, "can't chmod slave pty");
@@ -341,6 +302,7 @@ get_device_once(int *master, int *slave, char SlaveName[DEVICELEN], int nomesg,
return 0;
#elif defined HAVE__GETPTY
+ /* SGI IRIX */
char *name;
mode_t mode = nomesg ? 0600 : 0622;
@@ -348,15 +310,16 @@ get_device_once(int *master, int *slave, char SlaveName[DEVICELEN], int nomesg,
if (!fail) return -1;
rb_raise(rb_eRuntimeError, "_getpty() failed");
}
- rb_update_max_fd(*master);
+ rb_fd_fix_cloexec(*master);
- *slave = open(name, O_RDWR);
+ *slave = rb_cloexec_open(name, O_RDWR, 0);
/* error check? */
rb_update_max_fd(*slave);
strlcpy(SlaveName, name, DEVICELEN);
return 0;
#elif defined(HAVE_PTSNAME)
+ /* System V */
int masterfd = -1, slavefd = -1;
char *slavedevice;
void (*s)();
@@ -365,17 +328,25 @@ get_device_once(int *master, int *slave, char SlaveName[DEVICELEN], int nomesg,
extern int unlockpt(int);
extern int grantpt(int);
+#if defined(__sun)
+ /* workaround for Solaris 10: grantpt() doesn't work if FD_CLOEXEC is set. [ruby-dev:44688] */
if((masterfd = open("/dev/ptmx", O_RDWR, 0)) == -1) goto error;
+ s = signal(SIGCHLD, SIG_DFL);
+ if(grantpt(masterfd) == -1) goto error;
+ rb_fd_fix_cloexec(masterfd);
+#else
+ if((masterfd = rb_cloexec_open("/dev/ptmx", O_RDWR, 0)) == -1) goto error;
rb_update_max_fd(masterfd);
s = signal(SIGCHLD, SIG_DFL);
if(grantpt(masterfd) == -1) goto error;
+#endif
signal(SIGCHLD, s);
if(unlockpt(masterfd) == -1) goto error;
if((slavedevice = ptsname(masterfd)) == NULL) goto error;
if (no_mesg(slavedevice, nomesg) == -1) goto error;
- if((slavefd = open(slavedevice, O_RDWR, 0)) == -1) goto error;
+ if((slavefd = rb_cloexec_open(slavedevice, O_RDWR, 0)) == -1) goto error;
rb_update_max_fd(slavefd);
-#if defined I_PUSH && !defined linux
+#if defined(I_PUSH) && !defined(__linux__)
if(ioctl(slavefd, I_PUSH, "ptem") == -1) goto error;
if(ioctl(slavefd, I_PUSH, "ldterm") == -1) goto error;
ioctl(slavefd, I_PUSH, "ttcompat");
@@ -391,17 +362,77 @@ get_device_once(int *master, int *slave, char SlaveName[DEVICELEN], int nomesg,
if (fail) rb_raise(rb_eRuntimeError, "can't get Master/Slave device");
return -1;
#else
+ /* BSD */
int masterfd = -1, slavefd = -1;
const char *const *p;
char MasterName[DEVICELEN];
+#if defined(__hpux)
+ static const char MasterDevice[] = "/dev/ptym/pty%s";
+ static const char SlaveDevice[] = "/dev/pty/tty%s";
+ static const char *const deviceNo[] = {
+ "p0","p1","p2","p3","p4","p5","p6","p7",
+ "p8","p9","pa","pb","pc","pd","pe","pf",
+ "q0","q1","q2","q3","q4","q5","q6","q7",
+ "q8","q9","qa","qb","qc","qd","qe","qf",
+ "r0","r1","r2","r3","r4","r5","r6","r7",
+ "r8","r9","ra","rb","rc","rd","re","rf",
+ "s0","s1","s2","s3","s4","s5","s6","s7",
+ "s8","s9","sa","sb","sc","sd","se","sf",
+ "t0","t1","t2","t3","t4","t5","t6","t7",
+ "t8","t9","ta","tb","tc","td","te","tf",
+ "u0","u1","u2","u3","u4","u5","u6","u7",
+ "u8","u9","ua","ub","uc","ud","ue","uf",
+ "v0","v1","v2","v3","v4","v5","v6","v7",
+ "v8","v9","va","vb","vc","vd","ve","vf",
+ "w0","w1","w2","w3","w4","w5","w6","w7",
+ "w8","w9","wa","wb","wc","wd","we","wf",
+ 0
+ };
+#elif defined(_IBMESA) /* AIX/ESA */
+ static const char MasterDevice[] = "/dev/ptyp%s";
+ static const char SlaveDevice[] = "/dev/ttyp%s";
+ static const char *const deviceNo[] = {
+ "00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f",
+ "10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f",
+ "20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f",
+ "30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f",
+ "40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f",
+ "50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f",
+ "60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f",
+ "70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f",
+ "80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f",
+ "90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f",
+ "a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af",
+ "b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf",
+ "c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf",
+ "d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df",
+ "e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef",
+ "f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff",
+ 0
+ };
+#else /* 4.2BSD */
+ static const char MasterDevice[] = "/dev/pty%s";
+ static const char SlaveDevice[] = "/dev/tty%s";
+ static const char *const deviceNo[] = {
+ "p0","p1","p2","p3","p4","p5","p6","p7",
+ "p8","p9","pa","pb","pc","pd","pe","pf",
+ "q0","q1","q2","q3","q4","q5","q6","q7",
+ "q8","q9","qa","qb","qc","qd","qe","qf",
+ "r0","r1","r2","r3","r4","r5","r6","r7",
+ "r8","r9","ra","rb","rc","rd","re","rf",
+ "s0","s1","s2","s3","s4","s5","s6","s7",
+ "s8","s9","sa","sb","sc","sd","se","sf",
+ 0
+ };
+#endif
for (p = deviceNo; *p != NULL; p++) {
snprintf(MasterName, sizeof MasterName, MasterDevice, *p);
- if ((masterfd = open(MasterName,O_RDWR,0)) >= 0) {
+ if ((masterfd = rb_cloexec_open(MasterName,O_RDWR,0)) >= 0) {
rb_update_max_fd(masterfd);
*master = masterfd;
snprintf(SlaveName, DEVICELEN, SlaveDevice, *p);
- if ((slavefd = open(SlaveName,O_RDWR,0)) >= 0) {
+ if ((slavefd = rb_cloexec_open(SlaveName,O_RDWR,0)) >= 0) {
rb_update_max_fd(slavefd);
*slave = slavefd;
if (chown(SlaveName, getuid(), getgid()) != 0) goto error;
@@ -436,7 +467,7 @@ pty_close_pty(VALUE assoc)
for (i = 0; i < 2; i++) {
io = rb_ary_entry(assoc, i);
- if (TYPE(io) == T_FILE && 0 <= RFILE(io)->fptr->fd)
+ if (RB_TYPE_P(io, T_FILE) && 0 <= RFILE(io)->fptr->fd)
rb_io_close(io);
}
return Qnil;
@@ -449,54 +480,29 @@ pty_close_pty(VALUE assoc)
*
* Allocates a pty (pseudo-terminal).
*
- * In the non-block form, returns a two element array, <tt>[master_io,
- * slave_file]</tt>.
- *
* In the block form, yields two arguments <tt>master_io, slave_file</tt>
* and the value of the block is returned from +open+.
*
* The IO and File are both closed after the block completes if they haven't
* been already closed.
*
- * The arguments in both forms are:
+ * PTY.open {|master, slave|
+ * p master #=> #<IO:masterpty:/dev/pts/1>
+ * p slave #=> #<File:/dev/pts/1>
+ * p slave.path #=> "/dev/pts/1"
+ * }
*
- * <tt>master_io</tt>:: the master of the pty, as an IO.
- * <tt>slave_file</tt>:: the slave of the pty, as a File. The path to the
- * terminal device is available via
- * <tt>slave_file.path</tt>
+ * In the non-block form, returns a two element array, <tt>[master_io,
+ * slave_file]</tt>.
*
- * === Example
+ * master, slave = PTY.open
+ * # do something with master for IO, or the slave file
*
- * PTY.open {|m, s|
- * p m #=> #<IO:masterpty:/dev/pts/1>
- * p s #=> #<File:/dev/pts/1>
- * p s.path #=> "/dev/pts/1"
- * }
+ * The arguments in both forms are:
*
- * # Change the buffering type in factor command,
- * # assuming that factor uses stdio for stdout buffering.
- * # If IO.pipe is used instead of PTY.open,
- * # this code deadlocks because factor's stdout is fully buffered.
- * require 'io/console' # for IO#raw!
- * m, s = PTY.open
- * s.raw! # disable newline conversion.
- * r, w = IO.pipe
- * pid = spawn("factor", :in=>r, :out=>s)
- * r.close
- * s.close
- * w.puts "42"
- * p m.gets #=> "42: 2 3 7\n"
- * w.puts "144"
- * p m.gets #=> "144: 2 2 2 2 3 3\n"
- * w.close
- * # The result of read operation when pty slave is closed is platform
- * # dependent.
- * ret = begin
- * m.gets # FreeBSD returns nil.
- * rescue Errno::EIO # GNU/Linux raises EIO.
- * nil
- * end
- * p ret #=> nil
+ * +master_io+:: the master of the pty, as an IO.
+ * +slave_file+:: the slave of the pty, as a File. The path to the
+ * terminal device is available via +slave_file.path+
*
*/
static VALUE
@@ -540,31 +546,28 @@ pty_detach_process(struct pty_info *info)
* call-seq:
* PTY.spawn(command_line) { |r, w, pid| ... }
* PTY.spawn(command_line) => [r, w, pid]
- * PTY.spawn(command, args, ...) { |r, w, pid| ... }
- * PTY.spawn(command, args, ...) => [r, w, pid]
- * PTY.getpty(command_line) { |r, w, pid| ... }
- * PTY.getpty(command_line) => [r, w, pid]
- * PTY.getpty(command, args, ...) { |r, w, pid| ... }
- * PTY.getpty(command, args, ...) => [r, w, pid]
+ * PTY.spawn(command, arguments, ...) { |r, w, pid| ... }
+ * PTY.spawn(command, arguments, ...) => [r, w, pid]
*
- * Spawns the specified command on a newly allocated pty.
+ * Spawns the specified command on a newly allocated pty. You can also use the
+ * alias ::getpty.
*
* The command's controlling tty is set to the slave device of the pty
* and its standard input/output/error is redirected to the slave device.
*
- * <tt>command_line</tt>:: The full command line to run
- * <tt>command</tt>:: The command to run, as a String.
- * <tt>args</tt>:: Zero or more arguments, as Strings, representing
- * the arguments to +command+
+ * +command+ and +command_line+ are the full commands to run, given a String.
+ * Any additional +arguments+ will be passed to the command.
+ *
+ * === Return values
*
* In the non-block form this returns an array of size three,
- * <tt>[r, w, pid]</tt>. In the block form the block will be called with
- * these as arguments, <tt>|r,w,pid|</tt>:
+ * <tt>[r, w, pid]</tt>.
*
- * +r+:: An IO that can be read from that contains the command's
+ * In the block form these same values will be yielded to the block:
+ *
+ * +r+:: A readable IO that that contains the command's
* standard output and standard error
- * +w+:: An IO that can be written to that is the command's
- * standard input
+ * +w+:: A writable IO that is the command's standard input
* +pid+:: The process identifier for the command.
*/
static VALUE
@@ -587,7 +590,7 @@ pty_getpty(int argc, VALUE *argv, VALUE self)
rfptr->pathv = rb_obj_freeze(rb_str_new_cstr(SlaveName));
wfptr->mode = rb_io_mode_flags("w") | FMODE_SYNC;
- wfptr->fd = dup(info.fd);
+ wfptr->fd = rb_cloexec_dup(info.fd);
if (wfptr->fd == -1)
rb_sys_fail("dup()");
rb_update_max_fd(wfptr->fd);
@@ -605,8 +608,9 @@ pty_getpty(int argc, VALUE *argv, VALUE self)
return res;
}
+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];
@@ -639,21 +643,22 @@ raise_from_check(pid_t pid, int status)
* PTY.check(pid, true) => nil or raises PTY::ChildExited
*
* Checks the status of the child process specified by +pid+.
- * Returns +nil+ if the process is still alive. If the process
- * is not alive, will return a <tt>Process::Status</tt> or raise
- * a <tt>PTY::ChildExited</tt> (if +raise+ was true).
+ * Returns +nil+ if the process is still alive.
+ *
+ * If the process is not alive, and +raise+ was true, a PTY::ChildExited
+ * exception will be raised. Otherwise it will return a Process::Status
+ * instance.
*
* +pid+:: The process id of the process to check
- * +raise+:: If true and the process identified by +pid+ is no longer
- * alive a <tt>PTY::ChildExited</tt> is raised.
+ * +raise+:: If +true+ and the process identified by +pid+ is no longer
+ * alive a PTY::ChildExited is raised.
*
- * Returns nil or a <tt>Process::Status</tt> when +raise+ is false.
*/
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);
@@ -662,7 +667,8 @@ pty_check(int argc, VALUE *argv, VALUE self)
if (!RTEST(exc)) return rb_last_status_get();
raise_from_check(cpid, status);
- return Qnil; /* not reached */
+
+ UNREACHABLE;
}
static VALUE cPTY;
@@ -670,7 +676,7 @@ static VALUE cPTY;
/*
* Document-class: PTY::ChildExited
*
- * Thrown when PTY#check is called for a pid that represents a process that
+ * Thrown when PTY::check is called for a pid that represents a process that
* has exited.
*/
@@ -679,12 +685,65 @@ static VALUE cPTY;
*
* Creates and managed pseudo terminals (PTYs). See also
* http://en.wikipedia.org/wiki/Pseudo_terminal
+ *
+ * PTY allows you to allocate new terminals using ::open or ::spawn a new
+ * terminal with a specific command.
+ *
+ * == Example
+ *
+ * In this example we will change the buffering type in the +factor+ command,
+ * assuming that factor uses stdio for stdout buffering.
+ *
+ * If IO.pipe is used instead of PTY.open, this code deadlocks because factor's
+ * stdout is fully buffered.
+ *
+ * # start by requiring the standard library PTY
+ * require 'pty'
+ *
+ * master, slave = PTY.open
+ * read, write = IO.pipe
+ * pid = spawn("factor", :in=>read, :out=>slave)
+ * read.close # we dont need the read
+ * slave.close # or the slave
+ *
+ * # pipe "42" to the factor command
+ * write.puts "42"
+ * # output the response from factor
+ * p master.gets #=> "42: 2 3 7\n"
+ *
+ * # pipe "144" to factor and print out the response
+ * write.puts "144"
+ * p master.gets #=> "144: 2 2 2 2 3 3\n"
+ * write.close # close the pipe
+ *
+ * # The result of read operation when pty slave is closed is platform
+ * # dependent.
+ * ret = begin
+ * m.gets # FreeBSD returns nil.
+ * rescue Errno::EIO # GNU/Linux raises EIO.
+ * nil
+ * end
+ * p ret #=> nil
+ *
+ * == License
+ *
+ * C) Copyright 1998 by Akinori Ito.
+ *
+ * This software may be redistributed freely for this purpose, in full
+ * or in part, provided that this entire copyright notice is included
+ * on any copies of this software and applications and derivations thereof.
+ *
+ * This software is provided on an "as is" basis, without warranty of any
+ * kind, either expressed or implied, as to any matter including, but not
+ * limited to warranty of fitness of purpose, or merchantability, or
+ * results obtained from use of this software.
*/
void
Init_pty()
{
cPTY = rb_define_module("PTY");
+ /* :nodoc */
rb_define_module_function(cPTY,"getpty",pty_getpty,-1);
rb_define_module_function(cPTY,"spawn",pty_getpty,-1);
rb_define_singleton_method(cPTY,"check",pty_check,-1);
diff --git a/ext/racc/cparse/cparse.c b/ext/racc/cparse/cparse.c
index 3a2a8ae74e..8c16656a28 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)
@@ -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;
@@ -416,7 +416,7 @@ extract_user_token(struct cparse_params *v, VALUE block_args,
return;
}
- if (TYPE(block_args) != T_ARRAY) {
+ if (!RB_TYPE_P(block_args, T_ARRAY)) {
rb_raise(rb_eTypeError,
"%s() %s %s (must be Array[2])",
v->lex_is_iterator ? rb_id2name(v->lexmid) : "next_token",
@@ -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..619b4256f8
--- /dev/null
+++ b/ext/rbconfig/sizeof/extconf.rb
@@ -0,0 +1,2 @@
+$srcs = %w[sizes.c]
+create_makefile('rbconfig/sizeof')
diff --git a/ext/readline/README.ja b/ext/readline/README.ja
index 77ec55c3aa..57a6ee4126 100644
--- a/ext/readline/README.ja
+++ b/ext/readline/README.ja
@@ -1,20 +1,20 @@
-GNU Readline ¤Ë¤è¤ë¥³¥Þ¥ó¥É¥é¥¤¥óÆþÎÏ¥¤¥ó¥¿¥Õ¥§¡¼¥¹¤òÄ󶡤¹¤ë¥â¥¸¥å¡¼¥ë
-¤Ç¤¹¡£GNU Readline ¤Î¸ß´¹¥é¥¤¥Ö¥é¥ê¤Î¤Ò¤È¤Ä¤Ç¤¢¤ë Edit Line(libedit) ¤â
-¥µ¥Ý¡¼¥È¤·¤Æ¤¤¤Þ¤¹¡£
+GNU Readline ã«ã‚ˆã‚‹ã‚³ãƒžãƒ³ãƒ‰ãƒ©ã‚¤ãƒ³å…¥åŠ›ã‚¤ãƒ³ã‚¿ãƒ•ã‚§ãƒ¼ã‚¹ã‚’æä¾›ã™ã‚‹ãƒ¢ã‚¸ãƒ¥ãƒ¼ãƒ«
+ã§ã™ã€‚GNU Readline ã®äº’æ›ãƒ©ã‚¤ãƒ–ラリã®ã²ã¨ã¤ã§ã‚ã‚‹ Edit Line(libedit) ã‚‚
+サãƒãƒ¼ãƒˆã—ã¦ã„ã¾ã™ã€‚
GNU Readline:: http://www.gnu.org/directory/readline.html
libedit:: http://www.thrysoee.dk/editline/
-Readline.readline ¤ò»ÈÍѤ·¤Æ¥æ¡¼¥¶¤«¤é¤ÎÆþÎϤò¼èÆÀ¤Ç¤­¤Þ¤¹¡£¤³¤Î¤È¤­¡¢
-GNU Readline ¤Î¤è¤¦¤ËÆþÎϤÎÊä´°¤äEmacs ¤Î¤è¤¦¤Ê¥­¡¼Áàºî¤Ê¤É¤¬¤Ç¤­¤Þ¤¹¡£
+Readline.readline を使用ã—ã¦ãƒ¦ãƒ¼ã‚¶ã‹ã‚‰ã®å…¥åŠ›ã‚’å–å¾—ã§ãã¾ã™ã€‚ã“ã®ã¨ãã€
+GNU Readline ã®ã‚ˆã†ã«å…¥åŠ›ã®è£œå®Œã‚„Emacs ã®ã‚ˆã†ãªã‚­ãƒ¼æ“作ãªã©ãŒã§ãã¾ã™ã€‚
require "readline"
while buf = Readline.readline("> ", true)
p buf
end
-¥æ¡¼¥¶¤¬ÆþÎϤ·¤¿ÆâÍÆ¤òÍúÎò(°Ê²¼¡¢¥Ò¥¹¥È¥ê)¤È¤·¤Æµ­Ï¿¤¹¤ë¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£
-Äê¿ô Readline::HISTORY ¤ò»ÈÍѤ·¤Æ¥Ò¥¹¥È¥ê¤Ë¥¢¥¯¥»¥¹¤Ç¤­¤Þ¤¹¡£
+ユーザãŒå…¥åŠ›ã—ãŸå†…容を履歴(以下ã€ãƒ’ストリ)ã¨ã—ã¦è¨˜éŒ²ã™ã‚‹ã“ã¨ãŒã§ãã¾ã™ã€‚
+定数 Readline::HISTORY を使用ã—ã¦ãƒ’ストリã«ã‚¢ã‚¯ã‚»ã‚¹ã§ãã¾ã™ã€‚
require "readline"
while buf = Readline.readline("> ", true)
@@ -22,40 +22,38 @@ GNU Readline ¤Î¤è¤¦¤ËÆþÎϤÎÊä´°¤äEmacs ¤Î¤è¤¦¤Ê¥­¡¼Áàºî¤Ê¤É¤¬¤Ç¤­¤Þ¤¹¡£
print("-> ", buf, "\n")
end
-»ÈÍѤ¹¤ë¥é¥¤¥Ö¥é¥ê¤Ë¤è¤ê¡¢¤¤¤¯¤Ä¤«¤Î¥á¥½¥Ã¥É¤ÇÎã³° NotImplementedError
-¤¬È¯À¸¤·¤Þ¤¹¡£
+使用ã™ã‚‹ãƒ©ã‚¤ãƒ–ラリã«ã‚ˆã‚Šã€ã„ãã¤ã‹ã®ãƒ¡ã‚½ãƒƒãƒ‰ã§ä¾‹å¤– NotImplementedError
+ãŒç™ºç”Ÿã—ã¾ã™ã€‚
-$SAFE ¤¬ 4 ¤Î¾ì¹ç¡¢Â¿¤¯¤Î¥á¥½¥Ã¥É¤ÇÎã³° SecurityError ¤¬È¯À¸¤·¤Þ¤¹¡£
+== Readline モジュール
-== Readline ¥â¥¸¥å¡¼¥ë
-
-=== ¥â¥¸¥å¡¼¥ë´Ø¿ô
+=== モジュール関数
readline([prompt, [add_hist]]) -> String | nil
- prompt ¤ò½ÐÎϤ·¡¢¥æ¡¼¥¶¤«¤é¤Î¥­¡¼ÆþÎϤòÂÔ¤Á¤Þ¤¹¡£
- ¥¨¥ó¥¿¡¼¥­¡¼¤Î²¡²¼¤Ê¤É¤Ç¥æ¡¼¥¶¤¬Ê¸»úÎó¤òÆþÎϤ·½ª¤¨¤ë¤È¡¢
- ÆþÎϤ·¤¿Ê¸»úÎó¤òÊÖ¤·¤Þ¤¹¡£
- ¤³¤Î¤È¤­¡¢add_hist ¤¬ true ¤Ç¤¢¤ì¤Ð¡¢ÆþÎϤ·¤¿Ê¸»úÎó¤ò¥Ò¥¹¥È¥ê¤ËÄɲä·¤Þ¤¹¡£
+ prompt を出力ã—ã€ãƒ¦ãƒ¼ã‚¶ã‹ã‚‰ã®ã‚­ãƒ¼å…¥åŠ›ã‚’å¾…ã¡ã¾ã™ã€‚
+ ã‚¨ãƒ³ã‚¿ãƒ¼ã‚­ãƒ¼ã®æŠ¼ä¸‹ãªã©ã§ãƒ¦ãƒ¼ã‚¶ãŒæ–‡å­—列を入力ã—終ãˆã‚‹ã¨ã€
+ 入力ã—ãŸæ–‡å­—列を返ã—ã¾ã™ã€‚
+ ã“ã®ã¨ãã€add_hist ㌠true ã§ã‚れã°ã€å…¥åŠ›ã—ãŸæ–‡å­—列をヒストリã«è¿½åŠ ã—ã¾ã™ã€‚
- ²¿¤âÆþÎϤ·¤Æ¤¤¤Ê¤¤¾õÂÖ¤Ç EOF(UNIX ¤Ç¤Ï ^D) ¤òÆþÎϤ¹¤ë¤Ê¤É¤Ç¡¢
- ¥æ¡¼¥¶¤«¤é¤ÎÆþÎϤ¬¤Ê¤¤¾ì¹ç¤Ï nil ¤òÊÖ¤·¤Þ¤¹¡£
+ 何も入力ã—ã¦ã„ãªã„状態㧠EOF(UNIX ã§ã¯ ^D) を入力ã™ã‚‹ãªã©ã§ã€
+ ユーザã‹ã‚‰ã®å…¥åŠ›ãŒãªã„å ´åˆã¯ nil ã‚’è¿”ã—ã¾ã™ã€‚
- ¼¡¤Î¾ò·ï¤òÁ´¤ÆËþ¤¿¤¹¾ì¹ç¡¢Îã³° IOError ¤¬È¯À¸¤·¤Þ¤¹¡£
- 1. ɸ½àÆþÎϤ¬ tty ¤Ç¤Ê¤¤¡£
- 2. ɸ½àÆþÎϤò¥¯¥í¡¼¥º¤·¤Æ¤¤¤ë¡£(isatty(2) ¤Î errno ¤¬ EBADF ¤Ç¤¢¤ë¡£)
+ æ¬¡ã®æ¡ä»¶ã‚’å…¨ã¦æº€ãŸã™å ´åˆã€ä¾‹å¤– IOError ãŒç™ºç”Ÿã—ã¾ã™ã€‚
+ 1. 標準入力㌠tty ã§ãªã„。
+ 2. 標準入力をクローズã—ã¦ã„る。(isatty(2) ã® errno ㌠EBADF ã§ã‚る。)
- Ëܥ᥽¥Ã¥É¤Ï¥¹¥ì¥Ã¥É¤ËÂбþ¤·¤Æ¤¤¤Þ¤¹¡£
- ÆþÎÏÂÔ¤Á¾õÂ֤ΤȤ­¤Ï¥¹¥ì¥Ã¥É¥³¥ó¥Æ¥­¥¹¥È¤ÎÀÚÂØ¤¨¤¬È¯À¸¤·¤Þ¤¹¡£
+ 本メソッドã¯ã‚¹ãƒ¬ãƒƒãƒ‰ã«å¯¾å¿œã—ã¦ã„ã¾ã™ã€‚
+ 入力待ã¡çŠ¶æ…‹ã®ã¨ãã¯ã‚¹ãƒ¬ãƒƒãƒ‰ã‚³ãƒ³ãƒ†ã‚­ã‚¹ãƒˆã®åˆ‡æ›¿ãˆãŒç™ºç”Ÿã—ã¾ã™ã€‚
- ÆþÎÏ»þ¤Ë¤Ï¹ÔÆâÊÔ½¸¤¬²Äǽ¤Ç¡¢vi ¥â¡¼¥É¤È Emacs ¥â¡¼¥É¤¬ÍѰդµ¤ì¤Æ¤¤¤Þ¤¹¡£
- ¥Ç¥Õ¥©¥ë¥È¤Ï Emacs ¥â¡¼¥É¤Ç¤¹¡£
+ 入力時ã«ã¯è¡Œå†…編集ãŒå¯èƒ½ã§ã€vi モード㨠Emacs モードãŒç”¨æ„ã•れã¦ã„ã¾ã™ã€‚
+ デフォルト㯠Emacs モードã§ã™ã€‚
- Ëܥ᥽¥Ã¥É¤Ë¤ÏÃí°Õ»ö¹à¤¬¤¢¤ê¤Þ¤¹¡£
- ÆþÎÏÂÔ¤Á¤Î¾õÂÖ¤Ç ^C ¤¹¤ë¤È ruby ¥¤¥ó¥¿¥×¥ê¥¿¤¬½ªÎ»¤·¡¢Ã¼Ëö¾õÂÖ¤òÉüµ¢¤·¤Þ¤»¤ó¡£
- ¤³¤ì¤ò²óÈò¤¹¤ë¤¿¤á¤ÎÎã¤ò3¤Äµó¤²¤Þ¤¹¡£
+ 本メソッドã«ã¯æ³¨æ„事項ãŒã‚りã¾ã™ã€‚
+ 入力待ã¡ã®çŠ¶æ…‹ã§ ^C ã™ã‚‹ã¨ ruby インタプリタãŒçµ‚了ã—ã€ç«¯æœ«çŠ¶æ…‹ã‚’å¾©å¸°ã—ã¾ã›ã‚“。
+ ã“れを回é¿ã™ã‚‹ãŸã‚ã®ä¾‹ã‚’3ã¤æŒ™ã’ã¾ã™ã€‚
- * ^C¤Ë¤è¤ëInterruptÎã³°¤òÊä­¤·¤Æ¡¢Ã¼Ëö¾õÂÖ¤òÉüµ¢¤·¤Þ¤¹:
+ * ^Cã«ã‚ˆã‚‹Interrupt例外を補足ã—ã¦ã€ç«¯æœ«çŠ¶æ…‹ã‚’å¾©å¸°ã—ã¾ã™:
require "readline"
@@ -71,7 +69,7 @@ readline([prompt, [add_hist]]) -> String | nil
end
end
- * INT¥·¥°¥Ê¥ë¤òÊä­¤·¤Æ¡¢Ã¼Ëö¾õÂÖ¤òÉüµ¢¤·¤Þ¤¹:
+ * INTシグナルを補足ã—ã¦ã€ç«¯æœ«çŠ¶æ…‹ã‚’å¾©å¸°ã—ã¾ã™:
require "readline"
@@ -82,7 +80,7 @@ readline([prompt, [add_hist]]) -> String | nil
p buf
end
- * ñ¤Ë ^C ¤ò̵»ë¤¹¤ëÊýË¡¤â¤¢¤ê¤Þ¤¹:
+ * å˜ã« ^C を無視ã™ã‚‹æ–¹æ³•ã‚‚ã‚りã¾ã™:
require "readline"
@@ -92,8 +90,8 @@ readline([prompt, [add_hist]]) -> String | nil
p buf
end
- ÆþÎÏÍúÎò Readline::HISTORY ¤ò»ÈÍѤ·¤Æ¡¢¶õ¹Ô¤äľÁ°¤ÎÆþÎÏ¤ÈÆ±¤¸ÆâÍÆ¤ÏÆþÎÏ
- ÍúÎò¤Ë»Ä¤µ¤Ê¤¤¤È¤¤¤¦¤³¤È¤â¤Ç¤­¤Þ¤¹¡£
+ 入力履歴 Readline::HISTORY を使用ã—ã¦ã€ç©ºè¡Œã‚„ç›´å‰ã®å…¥åŠ›ã¨åŒã˜å†…容ã¯å…¥åŠ›
+ å±¥æ­´ã«æ®‹ã•ãªã„ã¨ã„ã†ã“ã¨ã‚‚ã§ãã¾ã™ã€‚
require "readline"
@@ -112,287 +110,241 @@ readline([prompt, [add_hist]]) -> String | nil
print "-> ", buf, "\n"
end
- $SAFE ¤¬ 4 ¤Î¾ì¹ç¡¢Îã³° SecurityError ¤¬È¯À¸¤·¤Þ¤¹¡£
-
-=== ¥¯¥é¥¹¥á¥½¥Ã¥É
+=== クラスメソッド
Readline.input = input
- Readline.readline ¥á¥½¥Ã¥É¤Ç»ÈÍѤ¹¤ëÆþÎÏÍѤΠFile ¥ª¥Ö¥¸¥§¥¯¥È input
- ¤ò»ØÄꤷ¤Þ¤¹¡£
-
- $SAFE ¤¬ 4 ¤Î¾ì¹ç¡¢Îã³° SecurityError ¤¬È¯À¸¤·¤Þ¤¹¡£
+ Readline.readline メソッドã§ä½¿ç”¨ã™ã‚‹å…¥åŠ›ç”¨ã® File オブジェクト input
+ を指定ã—ã¾ã™ã€‚
Readline.output = output
- Readline.readline ¥á¥½¥Ã¥É¤Ç»ÈÍѤ¹¤ë½ÐÎÏÍѤΠFile ¥ª¥Ö¥¸¥§¥¯¥È
- output ¤ò»ØÄꤷ¤Þ¤¹¡£
-
- $SAFE ¤¬ 4 ¤Î¾ì¹ç¡¢Îã³° SecurityError ¤¬È¯À¸¤·¤Þ¤¹¡£
+ Readline.readline メソッドã§ä½¿ç”¨ã™ã‚‹å‡ºåŠ›ç”¨ã® File オブジェクト
+ output を指定ã—ã¾ã™ã€‚
Readline.completion_proc = proc
- ¥æ¡¼¥¶¤«¤é¤ÎÆþÎϤòÊä´°¤¹¤ë»þ¤Î¸õÊä¤ò¼èÆÀ¤¹¤ë Proc ¥ª¥Ö¥¸¥§¥¯¥È proc ¤ò
- »ØÄꤷ¤Þ¤¹¡£proc ¤Ï¡¢¼¡¤Î¤â¤Î¤òÁÛÄꤷ¤Æ¤¤¤Þ¤¹¡£
- 1. call ¥á¥½¥Ã¥É¤ò»ý¤Á¤Þ¤¹¡£
- call ¥á¥½¥Ã¥É¤ò»ý¤¿¤Ê¤¤¾ì¹ç¡¢Îã³° ArgumentError ¤¬È¯À¸¤·¤Þ¤¹¡£
- 2. °ú¿ô¤Ë¥æ¡¼¥¶¤«¤é¤ÎÆþÎÏʸ»úÎó(Ãí1)¤ò¼è¤ê¤Þ¤¹¡£
- 3. ¸õÊä¤Îʸ»úÎó¤ÎÇÛÎó¤òÊÖ¤·¤Þ¤¹¡£
+ ユーザã‹ã‚‰ã®å…¥åŠ›ã‚’è£œå®Œã™ã‚‹æ™‚ã®å€™è£œã‚’å–å¾—ã™ã‚‹ Proc オブジェクト proc ã‚’
+ 指定ã—ã¾ã™ã€‚proc ã¯ã€æ¬¡ã®ã‚‚ã®ã‚’想定ã—ã¦ã„ã¾ã™ã€‚
+ 1. call メソッドをæŒã¡ã¾ã™ã€‚
+ call メソッドをæŒãŸãªã„å ´åˆã€ä¾‹å¤– ArgumentError ãŒç™ºç”Ÿã—ã¾ã™ã€‚
+ 2. 引数ã«ãƒ¦ãƒ¼ã‚¶ã‹ã‚‰ã®å…¥åŠ›æ–‡å­—åˆ—(注1)ã‚’å–りã¾ã™ã€‚
+ 3. å€™è£œã®æ–‡å­—列ã®é…列を返ã—ã¾ã™ã€‚
- Ãí1:¡Ö/var/lib /v¡×¤Î¸å¤ÇÊä´°¤ò¹Ô¤¦¤È¡¢
- ¥Ç¥Õ¥©¥ë¥È¤Ç¤Ï proc ¤Î°ú¿ô¤Ë¡Ö/v¡×¤¬ÅϤµ¤ì¤Þ¤¹¡£
- ¤³¤Î¤è¤¦¤Ë¡¢¥æ¡¼¥¶¤¬ÆþÎϤ·¤¿Ê¸»úÎó¤ò
- Readline.completer_word_break_characters ¤Ë´Þ¤Þ¤ì¤ëʸ»ú¤Ç¶èÀڤ俤â
- ¤Î¤òñ¸ì¤È¤¹¤ë¤È¡¢¥«¡¼¥½¥ë¤¬¤¢¤ëñ¸ì¤ÎºÇ½é¤Îʸ»ú¤«¤é¸½ºß¤Î¥«¡¼¥½¥ë°Ì
- Ã֤ޤǤÎʸ»úÎó¤¬ proc ¤Î°ú¿ô¤ËÅϤµ¤ì¤Þ¤¹¡£
-
- $SAFE ¤¬ 4 ¤Î¾ì¹ç¡¢Îã³° SecurityError ¤¬È¯À¸¤·¤Þ¤¹¡£
+ 注1:「/var/lib /vã€ã®å¾Œã§è£œå®Œã‚’行ã†ã¨ã€
+ デフォルトã§ã¯ proc ã®å¼•æ•°ã«ã€Œ/vã€ãŒæ¸¡ã•れã¾ã™ã€‚
+ ã“ã®ã‚ˆã†ã«ã€ãƒ¦ãƒ¼ã‚¶ãŒå…¥åŠ›ã—ãŸæ–‡å­—列を
+ Readline.completer_word_break_characters ã«å«ã¾ã‚Œã‚‹æ–‡å­—ã§åŒºåˆ‡ã£ãŸã‚‚
+ ã®ã‚’å˜èªžã¨ã™ã‚‹ã¨ã€ã‚«ãƒ¼ã‚½ãƒ«ãŒã‚ã‚‹å˜èªžã®æœ€åˆã®æ–‡å­—ã‹ã‚‰ç¾åœ¨ã®ã‚«ãƒ¼ã‚½ãƒ«ä½
+ ç½®ã¾ã§ã®æ–‡å­—列㌠proc ã®å¼•æ•°ã«æ¸¡ã•れã¾ã™ã€‚
Readline.completion_proc -> proc
- ¥æ¡¼¥¶¤«¤é¤ÎÆþÎϤòÊä´°¤¹¤ë»þ¤Î¸õÊä¤ò¼èÆÀ¤¹¤ë Proc ¥ª¥Ö¥¸¥§¥¯¥È proc
- ¤ò¼èÆÀ¤·¤Þ¤¹¡£
-
- $SAFE ¤¬ 4 ¤Î¾ì¹ç¡¢Îã³° SecurityError ¤¬È¯À¸¤·¤Þ¤¹¡£
+ ユーザã‹ã‚‰ã®å…¥åŠ›ã‚’è£œå®Œã™ã‚‹æ™‚ã®å€™è£œã‚’å–å¾—ã™ã‚‹ Proc オブジェクト proc
+ ã‚’å–å¾—ã—ã¾ã™ã€‚
Readline.completion_case_fold = bool
- ¥æ¡¼¥¶¤ÎÆþÎϤòÊä´°¤¹¤ëºÝ¡¢Âçʸ»ú¤È¾®Ê¸»ú¤ò¶èÊ̤¹¤ë¡¿¤·¤Ê¤¤¤ò»ØÄꤷ¤Þ¤¹¡£
- bool ¤¬¿¿¤Ê¤é¤Ð¶èÊ̤·¤Þ¤»¤ó¡£bool ¤¬µ¶¤Ê¤é¤Ð¶èÊ̤·¤Þ¤¹¡£
-
- $SAFE ¤¬ 4 ¤Î¾ì¹ç¡¢Îã³° SecurityError ¤¬È¯À¸¤·¤Þ¤¹¡£
+ ユーザã®å…¥åŠ›ã‚’è£œå®Œã™ã‚‹éš›ã€å¤§æ–‡å­—ã¨å°æ–‡å­—を区別ã™ã‚‹ï¼ã—ãªã„を指定ã—ã¾ã™ã€‚
+ bool ãŒçœŸãªã‚‰ã°åŒºåˆ¥ã—ã¾ã›ã‚“。bool ãŒå½ãªã‚‰ã°åŒºåˆ¥ã—ã¾ã™ã€‚
Readline.completion_case_fold -> bool
- ¥æ¡¼¥¶¤ÎÆþÎϤòÊä´°¤¹¤ëºÝ¡¢Âçʸ»ú¤È¾®Ê¸»ú¤ò¶èÊ̤¹¤ë¡¿¤·¤Ê¤¤¤ò¼èÆÀ¤·¤Þ¤¹¡£
- bool ¤¬¿¿¤Ê¤é¤Ð¶èÊ̤·¤Þ¤»¤ó¡£bool ¤¬µ¶¤Ê¤é¤Ð¶èÊ̤·¤Þ¤¹¡£
+ ユーザã®å…¥åŠ›ã‚’è£œå®Œã™ã‚‹éš›ã€å¤§æ–‡å­—ã¨å°æ–‡å­—を区別ã™ã‚‹ï¼ã—ãªã„ã‚’å–å¾—ã—ã¾ã™ã€‚
+ bool ãŒçœŸãªã‚‰ã°åŒºåˆ¥ã—ã¾ã›ã‚“。bool ãŒå½ãªã‚‰ã°åŒºåˆ¥ã—ã¾ã™ã€‚
- ¤Ê¤ª¡¢Readline.completion_case_fold= ¥á¥½¥Ã¥É¤Ç»ØÄꤷ¤¿¥ª¥Ö¥¸¥§¥¯¥È¤ò
- ¤½¤Î¤Þ¤Þ¼èÆÀ¤¹¤ë¤Î¤Ç¡¢¼¡¤Î¤è¤¦¤Êưºî¤ò¤·¤Þ¤¹¡£
+ ãªãŠã€Readline.completion_case_fold= ãƒ¡ã‚½ãƒƒãƒ‰ã§æŒ‡å®šã—ãŸã‚ªãƒ–ジェクトを
+ ãã®ã¾ã¾å–å¾—ã™ã‚‹ã®ã§ã€æ¬¡ã®ã‚ˆã†ãªå‹•作をã—ã¾ã™ã€‚
require "readline"
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 ¤ÎÃæ¤Ç»ÈÍѤ¹¤ë¤³¤È¤òÁÛÄꤷ
- ¤Æ¤¤¤Þ¤¹¡£Readline.line_buffer ¤ÎŤµ¤Ï GNU Readline ¤Î rl_end ÊÑ¿ô¤Î
- ÃͤȰìÃפ·¤Þ¤¹¡£
+ 入力中ã®è¡Œå…¨ä½“ã‚’è¿”ã—ã¾ã™ã€‚complete_proc ã®ä¸­ã§ä½¿ç”¨ã™ã‚‹ã“ã¨ã‚’想定ã—
+ ã¦ã„ã¾ã™ã€‚Readline.line_buffer ã®é•·ã•㯠GNU Readline ã® rl_end 変数ã®
+ 値ã¨ä¸€è‡´ã—ã¾ã™ã€‚
Readline.point -> int
- ¸½ºß¤Î¥«¡¼¥½¥ë¤Î°ÌÃÖ¤òÊÖ¤·¤Þ¤¹¡£
- Readline ¥â¥¸¥å¡¼¥ë¤ÏÊä´°ÂоݤÎñ¸ì¤Î³«»Ï°ÌÃ֤ξðÊó¤òÄ󶡤·¤Æ¤¤¤Þ¤»¤ó¡£
- ¤·¤«¤·¤Ê¤¬¤é¡¢ completion_proc ¤ÎÃæ¤ÇÆþÎϤ·¤¿Ã±¸ì text ¤È
- Readline.point ¤ò»ÈÍѤ¹¤ë¤³¤È¤Ç³«»Ï°ÌÃÖ¤òƳ¤¯¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£
+ ç¾åœ¨ã®ã‚«ãƒ¼ã‚½ãƒ«ã®ä½ç½®ã‚’è¿”ã—ã¾ã™ã€‚
+ Readline モジュールã¯è£œå®Œå¯¾è±¡ã®å˜èªžã®é–‹å§‹ä½ç½®ã®æƒ…報をæä¾›ã—ã¦ã„ã¾ã›ã‚“。
+ ã—ã‹ã—ãªãŒã‚‰ã€ completion_proc ã®ä¸­ã§å…¥åŠ›ã—ãŸå˜èªž text ã¨
+ Readline.point を使用ã™ã‚‹ã“ã¨ã§é–‹å§‹ä½ç½®ã‚’å°Žãã“ã¨ãŒã§ãã¾ã™ã€‚
- ³«»Ï°ÌÃÖ = ÆþÎϤ·¤¿Ã±¸ì¤ÎŤµ - Readline.point
+ é–‹å§‹ä½ç½® = 入力ã—ãŸå˜èªžã®é•·ã• - Readline.point
Readline.vi_editing_mode -> nil
- ÊÔ½¸¥â¡¼¥É¤ò vi ¥â¡¼¥É¤Ë¤·¤Þ¤¹¡£
- vi ¥â¡¼¥É¤Î¾ÜºÙ¤Ï¡¢GNU Readline ¤Î¥Þ¥Ë¥å¥¢¥ë¤ò»²¾È¤·¤Æ¤¯¤À¤µ¤¤¡£
-
- ¥µ¥Ý¡¼¥È¤·¤Æ¤¤¤Ê¤¤´Ä¶­¤Ç¤Ï¡¢Îã³° NotImplementedError ¤¬È¯À¸¤·¤Þ¤¹¡£
+ 編集モードを vi モードã«ã—ã¾ã™ã€‚
+ vi モードã®è©³ç´°ã¯ã€GNU Readline ã®ãƒžãƒ‹ãƒ¥ã‚¢ãƒ«ã‚’å‚ç…§ã—ã¦ãã ã•ã„。
- $SAFE ¤¬ 4 ¤Î¾ì¹ç¡¢Îã³° SecurityError ¤¬È¯À¸¤·¤Þ¤¹¡£
+ サãƒãƒ¼ãƒˆã—ã¦ã„ãªã„環境ã§ã¯ã€ä¾‹å¤– NotImplementedError ãŒç™ºç”Ÿã—ã¾ã™ã€‚
Readline.vi_editing_mode? -> bool
- ÊÔ½¸¥â¡¼¥É¤¬ vi ¥â¡¼¥É¤Î¾ì¹ç¡¢true ¤òÊÖ¤·¤Þ¤¹¡£¤½¤¦¤Ç¤Ê¤±¤ì¤Ð false
- ¤òÊÖ¤·¤Þ¤¹¡£
-
- ¥µ¥Ý¡¼¥È¤·¤Æ¤¤¤Ê¤¤´Ä¶­¤Ç¤Ï¡¢Îã³° NotImplementedError ¤¬È¯À¸¤·¤Þ¤¹¡£
+ 編集モード㌠vi モードã®å ´åˆã€true ã‚’è¿”ã—ã¾ã™ã€‚ãã†ã§ãªã‘れ㰠false
+ ã‚’è¿”ã—ã¾ã™ã€‚
- $SAFE ¤¬ 4 ¤Î¾ì¹ç¡¢Îã³° SecurityError ¤¬È¯À¸¤·¤Þ¤¹¡£
+ サãƒãƒ¼ãƒˆã—ã¦ã„ãªã„環境ã§ã¯ã€ä¾‹å¤– NotImplementedError ãŒç™ºç”Ÿã—ã¾ã™ã€‚
Readline.emacs_editing_mode -> nil
- ÊÔ½¸¥â¡¼¥É¤ò Emacs ¥â¡¼¥É¤Ë¤·¤Þ¤¹¡£
- ¥Ç¥Õ¥©¥ë¥È¤Ï Emacs ¥â¡¼¥É¤Ç¤¹¡£
- Emacs ¥â¡¼¥É¤Î¾ÜºÙ¤Ï¡¢GNU Readline ¤Î¥Þ¥Ë¥å¥¢¥ë¤ò»²¾È¤·¤Æ¤¯¤À¤µ¤¤¡£
+ 編集モードを Emacs モードã«ã—ã¾ã™ã€‚
+ デフォルト㯠Emacs モードã§ã™ã€‚
+ Emacs モードã®è©³ç´°ã¯ã€GNU Readline ã®ãƒžãƒ‹ãƒ¥ã‚¢ãƒ«ã‚’å‚ç…§ã—ã¦ãã ã•ã„。
- ¥µ¥Ý¡¼¥È¤·¤Æ¤¤¤Ê¤¤´Ä¶­¤Ç¤Ï¡¢Îã³° NotImplementedError ¤¬È¯À¸¤·¤Þ¤¹¡£
-
- $SAFE ¤¬ 4 ¤Î¾ì¹ç¡¢Îã³° SecurityError ¤¬È¯À¸¤·¤Þ¤¹¡£
+ サãƒãƒ¼ãƒˆã—ã¦ã„ãªã„環境ã§ã¯ã€ä¾‹å¤– NotImplementedError ãŒç™ºç”Ÿã—ã¾ã™ã€‚
Readline.emacs_editing_mode? -> bool
- ÊÔ½¸¥â¡¼¥É¤¬ Emacs ¥â¡¼¥É¤Î¾ì¹ç¡¢true ¤òÊÖ¤·¤Þ¤¹¡£¤½¤¦¤Ç¤Ê¤±¤ì¤Ð false
- ¤òÊÖ¤·¤Þ¤¹¡£
-
- ¥µ¥Ý¡¼¥È¤·¤Æ¤¤¤Ê¤¤´Ä¶­¤Ç¤Ï¡¢Îã³° NotImplementedError ¤¬È¯À¸¤·¤Þ¤¹¡£
+ 編集モード㌠Emacs モードã®å ´åˆã€true ã‚’è¿”ã—ã¾ã™ã€‚ãã†ã§ãªã‘れ㰠false
+ ã‚’è¿”ã—ã¾ã™ã€‚
- $SAFE ¤¬ 4 ¤Î¾ì¹ç¡¢Îã³° SecurityError ¤¬È¯À¸¤·¤Þ¤¹¡£
+ サãƒãƒ¼ãƒˆã—ã¦ã„ãªã„環境ã§ã¯ã€ä¾‹å¤– NotImplementedError ãŒç™ºç”Ÿã—ã¾ã™ã€‚
Readline.completion_append_character = char
- ¥æ¡¼¥¶¤ÎÆþÎϤÎÊä´°¤¬´°Î»¤·¤¿¾ì¹ç¤Ë¡¢ºÇ¸å¤ËÉղ乤ëʸ»ú char ¤ò»ØÄꤷ
- ¤Þ¤¹¡£È¾³Ñ¥¹¥Ú¡¼¥¹¡Ö" "¡×¤Ê¤É¤Îñ¸ì¤ò¶èÀÚ¤ëʸ»ú¤ò»ØÄꤹ¤ì¤Ð¡¢Ï¢Â³¤·¤Æ
- ÆþÎϤ¹¤ëºÝ¤ËÊØÍø¤Ç¤¹¡£
+ ユーザã®å…¥åŠ›ã®è£œå®ŒãŒå®Œäº†ã—ãŸå ´åˆã«ã€æœ€å¾Œã«ä»˜åŠ ã™ã‚‹æ–‡å­— char を指定ã—
+ ã¾ã™ã€‚åŠè§’スペース「" "ã€ãªã©ã®å˜èªžã‚’区切る文字を指定ã™ã‚Œã°ã€é€£ç¶šã—ã¦
+ 入力ã™ã‚‹éš›ã«ä¾¿åˆ©ã§ã™ã€‚
- »ÈÍÑÎã:
+ 使用例:
require "readline"
Readline.readline("> ", true)
Readline.completion_append_character = " "
- ¼Â¹ÔÎã:
+ 実行例:
>
- ¤³¤³¤Ç "/var/li" ¤òÆþÎϤ·¤Þ¤¹¡£
+ ã“ã“ã§ "/var/li" を入力ã—ã¾ã™ã€‚
> /var/li
- ¤³¤³¤Ç TAB ¥­¡¼¤òÆþÎϤ·¤Þ¤¹¡£
+ ã“ã“ã§ TAB キーを入力ã—ã¾ã™ã€‚
> /var/lib
- "b" ¤¬Êä´°¤µ¤ì¡¢ºÇ¸å¤Ë " " ¤¬Äɲ䵤ì¤ë¤Î¤Ç¡¢"/usr" ¤òϢ³¤·¤ÆÆþÎϤǤ­¤Þ¤¹¡£
+ "b" ãŒè£œå®Œã•ã‚Œã€æœ€å¾Œã« " " ãŒè¿½åŠ ã•れるã®ã§ã€"/usr" を連続ã—ã¦å…¥åŠ›ã§ãã¾ã™ã€‚
> /var/lib /usr
- ¤Ê¤ª¡¢1ʸ»ú¤·¤«»ØÄꤹ¤ë¤³¤È¤Ï¤Ç¤­¤Þ¤»¤ó¡£
- Î㤨¤Ð¡¢"string"¤ò»ØÄꤷ¤¿¾ì¹ç¤ÏºÇ½é¤Îʸ»ú¤Ç¤¢¤ë"s"¤À¤±¤ò»ÈÍѤ·¤Þ¤¹¡£
+ ãªãŠã€1文字ã—ã‹æŒ‡å®šã™ã‚‹ã“ã¨ã¯ã§ãã¾ã›ã‚“。
+ 例ãˆã°ã€"string"を指定ã—ãŸå ´åˆã¯æœ€åˆã®æ–‡å­—ã§ã‚ã‚‹"s"ã ã‘を使用ã—ã¾ã™ã€‚
require "readline"
Readline.completion_append_character = "string"
p Readline.completion_append_character # => "s"
- ¥µ¥Ý¡¼¥È¤·¤Æ¤¤¤Ê¤¤´Ä¶­¤Ç¤Ï¡¢Îã³° NotImplementedError ¤¬È¯À¸¤·¤Þ¤¹¡£
-
- $SAFE ¤¬ 4 ¤Î¾ì¹ç¡¢Îã³° SecurityError ¤¬È¯À¸¤·¤Þ¤¹¡£
+ サãƒãƒ¼ãƒˆã—ã¦ã„ãªã„環境ã§ã¯ã€ä¾‹å¤– NotImplementedError ãŒç™ºç”Ÿã—ã¾ã™ã€‚
Readline.completion_append_character -> char
- ¥æ¡¼¥¶¤ÎÆþÎϤÎÊä´°¤¬´°Î»¤·¤¿¾ì¹ç¤Ë¡¢ºÇ¸å¤ËÉղ乤ëʸ»ú¤ò¼èÆÀ¤·¤Þ¤¹¡£
- ¥Ç¥Õ¥©¥ë¥È¤Ï¶õÇò (" ") ¤Ç¤¹¡£
+ ユーザã®å…¥åŠ›ã®è£œå®ŒãŒå®Œäº†ã—ãŸå ´åˆã«ã€æœ€å¾Œã«ä»˜åŠ ã™ã‚‹æ–‡å­—ã‚’å–å¾—ã—ã¾ã™ã€‚
+ デフォルトã¯ç©ºç™½ (" ") ã§ã™ã€‚
- ¥µ¥Ý¡¼¥È¤·¤Æ¤¤¤Ê¤¤´Ä¶­¤Ç¤Ï¡¢Îã³° NotImplementedError ¤¬È¯À¸¤·¤Þ¤¹¡£
-
- $SAFE ¤¬ 4 ¤Î¾ì¹ç¡¢Îã³° SecurityError ¤¬È¯À¸¤·¤Þ¤¹¡£
+ サãƒãƒ¼ãƒˆã—ã¦ã„ãªã„環境ã§ã¯ã€ä¾‹å¤– NotImplementedError ãŒç™ºç”Ÿã—ã¾ã™ã€‚
Readline.basic_word_break_characters = string
- ¥æ¡¼¥¶¤ÎÆþÎϤÎÊä´°¤ò¹Ô¤¦ºÝ¡¢Ã±¸ì¤Î¶èÀÚ¤ê¤ò¼¨¤¹Ê£¿ô¤Îʸ»ú¤Ç¹½À®¤µ¤ì¤ë
- ʸ»úÎó string ¤ò»ØÄꤷ¤Þ¤¹¡£
-
- GNU Readline ¤Î¥Ç¥Õ¥©¥ë¥È¤ÎÃͤϡ¢Bash ¤ÎÊä´°½èÍý¤Ç»ÈÍѤ·¤Æ¤¤¤ëʸ»úÎó
- " \t\n\"\\'`@$><=;|&{(" (¥¹¥Ú¡¼¥¹¤ò´Þ¤à) ¤Ë¤Ê¤Ã¤Æ¤¤¤Þ¤¹¡£
+ ユーザã®å…¥åŠ›ã®è£œå®Œã‚’行ã†éš›ã€å˜èªžã®åŒºåˆ‡ã‚Šã‚’示ã™è¤‡æ•°ã®æ–‡å­—ã§æ§‹æˆã•れる
+ 文字列 string を指定ã—ã¾ã™ã€‚
- ¥µ¥Ý¡¼¥È¤·¤Æ¤¤¤Ê¤¤´Ä¶­¤Ç¤Ï¡¢Îã³° NotImplementedError ¤¬È¯À¸¤·¤Þ¤¹¡£
+ GNU Readline ã®ãƒ‡ãƒ•ォルトã®å€¤ã¯ã€Bash ã®è£œå®Œå‡¦ç†ã§ä½¿ç”¨ã—ã¦ã„る文字列
+ " \t\n\"\\'`@$><=;|&{(" (スペースをå«ã‚€) ã«ãªã£ã¦ã„ã¾ã™ã€‚
- $SAFE ¤¬ 4 ¤Î¾ì¹ç¡¢Îã³° SecurityError ¤¬È¯À¸¤·¤Þ¤¹¡£
+ サãƒãƒ¼ãƒˆã—ã¦ã„ãªã„環境ã§ã¯ã€ä¾‹å¤– NotImplementedError ãŒç™ºç”Ÿã—ã¾ã™ã€‚
Readline.basic_word_break_characters -> string
- ¥æ¡¼¥¶¤ÎÆþÎϤÎÊä´°¤ò¹Ô¤¦ºÝ¡¢Ã±¸ì¤Î¶èÀÚ¤ê¤ò¼¨¤¹Ê£¿ô¤Îʸ»ú¤Ç¹½À®¤µ¤ì¤ë
- ʸ»úÎó¤ò¼èÆÀ¤·¤Þ¤¹¡£
-
- ¥µ¥Ý¡¼¥È¤·¤Æ¤¤¤Ê¤¤´Ä¶­¤Ç¤Ï¡¢Îã³° NotImplementedError ¤¬È¯À¸¤·¤Þ¤¹¡£
+ ユーザã®å…¥åŠ›ã®è£œå®Œã‚’行ã†éš›ã€å˜èªžã®åŒºåˆ‡ã‚Šã‚’示ã™è¤‡æ•°ã®æ–‡å­—ã§æ§‹æˆã•れる
+ 文字列をå–å¾—ã—ã¾ã™ã€‚
- $SAFE ¤¬ 4 ¤Î¾ì¹ç¡¢Îã³° SecurityError ¤¬È¯À¸¤·¤Þ¤¹¡£
+ サãƒãƒ¼ãƒˆã—ã¦ã„ãªã„環境ã§ã¯ã€ä¾‹å¤– NotImplementedError ãŒç™ºç”Ÿã—ã¾ã™ã€‚
Readline.completer_word_break_characters = string
- ¥æ¡¼¥¶¤ÎÆþÎϤÎÊä´°¤ò¹Ô¤¦ºÝ¡¢Ã±¸ì¤Î¶èÀÚ¤ê¤ò¼¨¤¹Ê£¿ô¤Îʸ»ú¤Ç¹½À®¤µ¤ì¤ë
- ʸ»úÎó string ¤ò»ØÄꤷ¤Þ¤¹¡£
- Readline.basic_word_break_characters= ¤È¤Î°ã¤¤¤Ï¡¢
- GNU Readline ¤Î rl_complete_internal ´Ø¿ô¤Ç»ÈÍѤµ¤ì¤ë¤³¤È¤Ç¤¹¡£
+ ユーザã®å…¥åŠ›ã®è£œå®Œã‚’行ã†éš›ã€å˜èªžã®åŒºåˆ‡ã‚Šã‚’示ã™è¤‡æ•°ã®æ–‡å­—ã§æ§‹æˆã•れる
+ 文字列 string を指定ã—ã¾ã™ã€‚
+ Readline.basic_word_break_characters= ã¨ã®é•ã„ã¯ã€
+ GNU Readline ã® rl_complete_internal 関数ã§ä½¿ç”¨ã•れるã“ã¨ã§ã™ã€‚
- GNU Readline ¤Î¥Ç¥Õ¥©¥ë¥È¤ÎÃͤϡ¢
- Readline.basic_word_break_characters ¤ÈƱ¤¸¤Ç¤¹¡£
+ GNU Readline ã®ãƒ‡ãƒ•ォルトã®å€¤ã¯ã€
+ Readline.basic_word_break_characters ã¨åŒã˜ã§ã™ã€‚
- ¥µ¥Ý¡¼¥È¤·¤Æ¤¤¤Ê¤¤´Ä¶­¤Ç¤Ï¡¢Îã³° NotImplementedError ¤¬È¯À¸¤·¤Þ¤¹¡£
-
- $SAFE ¤¬ 4 ¤Î¾ì¹ç¡¢Îã³° SecurityError ¤¬È¯À¸¤·¤Þ¤¹¡£
+ サãƒãƒ¼ãƒˆã—ã¦ã„ãªã„環境ã§ã¯ã€ä¾‹å¤– NotImplementedError ãŒç™ºç”Ÿã—ã¾ã™ã€‚
Readline.completer_word_break_characters -> string
- ¥æ¡¼¥¶¤ÎÆþÎϤÎÊä´°¤ò¹Ô¤¦ºÝ¡¢Ã±¸ì¤Î¶èÀÚ¤ê¤ò¼¨¤¹Ê£¿ô¤Îʸ»ú¤Ç¹½À®¤µ¤ì¤¿
- ʸ»úÎó¤ò¼èÆÀ¤·¤Þ¤¹¡£
-
- ¥µ¥Ý¡¼¥È¤·¤Æ¤¤¤Ê¤¤´Ä¶­¤Ç¤Ï¡¢Îã³° NotImplementedError ¤¬È¯À¸¤·¤Þ¤¹¡£
+ ユーザã®å…¥åŠ›ã®è£œå®Œã‚’行ã†éš›ã€å˜èªžã®åŒºåˆ‡ã‚Šã‚’示ã™è¤‡æ•°ã®æ–‡å­—ã§æ§‹æˆã•れãŸ
+ 文字列をå–å¾—ã—ã¾ã™ã€‚
- $SAFE ¤¬ 4 ¤Î¾ì¹ç¡¢Îã³° SecurityError ¤¬È¯À¸¤·¤Þ¤¹¡£
+ サãƒãƒ¼ãƒˆã—ã¦ã„ãªã„環境ã§ã¯ã€ä¾‹å¤– NotImplementedError ãŒç™ºç”Ÿã—ã¾ã™ã€‚
Readline.basic_quote_characters = string
- ¥¹¥Ú¡¼¥¹¤Ê¤É¤Îñ¸ì¤Î¶èÀÚ¤ê¤ò¥¯¥ª¡¼¥È¤¹¤ë¤¿¤á¤ÎÊ£¿ô¤Îʸ»ú¤Ç¹½À®¤µ¤ì¤ë
- ʸ»úÎó string ¤ò»ØÄꤷ¤Þ¤¹¡£
-
- ¥µ¥Ý¡¼¥È¤·¤Æ¤¤¤Ê¤¤´Ä¶­¤Ç¤Ï¡¢Îã³° NotImplementedError ¤¬È¯À¸¤·¤Þ¤¹¡£
+ スペースãªã©ã®å˜èªžã®åŒºåˆ‡ã‚Šã‚’クオートã™ã‚‹ãŸã‚ã®è¤‡æ•°ã®æ–‡å­—ã§æ§‹æˆã•れる
+ 文字列 string を指定ã—ã¾ã™ã€‚
- $SAFE ¤¬ 4 ¤Î¾ì¹ç¡¢Îã³° SecurityError ¤¬È¯À¸¤·¤Þ¤¹¡£
+ サãƒãƒ¼ãƒˆã—ã¦ã„ãªã„環境ã§ã¯ã€ä¾‹å¤– NotImplementedError ãŒç™ºç”Ÿã—ã¾ã™ã€‚
Readline.basic_quote_characters -> string
- ¥¹¥Ú¡¼¥¹¤Ê¤É¤Îñ¸ì¤Î¶èÀÚ¤ê¤ò¥¯¥ª¡¼¥È¤¹¤ë¤¿¤á¤ÎÊ£¿ô¤Îʸ»ú¤Ç¹½À®¤µ¤ì¤ë
- ʸ»úÎó¤ò¼èÆÀ¤·¤Þ¤¹¡£
+ スペースãªã©ã®å˜èªžã®åŒºåˆ‡ã‚Šã‚’クオートã™ã‚‹ãŸã‚ã®è¤‡æ•°ã®æ–‡å­—ã§æ§‹æˆã•れる
+ 文字列をå–å¾—ã—ã¾ã™ã€‚
- ¥µ¥Ý¡¼¥È¤·¤Æ¤¤¤Ê¤¤´Ä¶­¤Ç¤Ï¡¢Îã³° NotImplementedError ¤¬È¯À¸¤·¤Þ¤¹¡£
-
- $SAFE ¤¬ 4 ¤Î¾ì¹ç¡¢Îã³° SecurityError ¤¬È¯À¸¤·¤Þ¤¹¡£
+ サãƒãƒ¼ãƒˆã—ã¦ã„ãªã„環境ã§ã¯ã€ä¾‹å¤– NotImplementedError ãŒç™ºç”Ÿã—ã¾ã™ã€‚
Readline.completer_quote_characters = string
- ¥æ¡¼¥¶¤ÎÆþÎϤÎÊä´°¤ò¹Ô¤¦ºÝ¡¢¥¹¥Ú¡¼¥¹¤Ê¤É¤Îñ¸ì¤Î¶èÀÚ¤ê¤ò
- ¥¯¥ª¡¼¥È¤¹¤ë¤¿¤á¤ÎÊ£¿ô¤Îʸ»ú¤Ç¹½À®¤µ¤ì¤ëʸ»úÎó string ¤ò»ØÄꤷ¤Þ¤¹¡£
- »ØÄꤷ¤¿Ê¸»ú¤Î´Ö¤Ç¤Ï¡¢Readline.completer_word_break_characters=
- ¤Ç»ØÄꤷ¤¿Ê¸»úÎó¤Ë´Þ¤Þ¤ì¤ëʸ»ú¤â¡¢ÉáÄ̤Îʸ»úÎó¤È¤·¤Æ°·¤ï¤ì¤Þ¤¹¡£
-
- ¥µ¥Ý¡¼¥È¤·¤Æ¤¤¤Ê¤¤´Ä¶­¤Ç¤Ï¡¢Îã³° NotImplementedError ¤¬È¯À¸¤·¤Þ¤¹¡£
+ ユーザã®å…¥åŠ›ã®è£œå®Œã‚’行ã†éš›ã€ã‚¹ãƒšãƒ¼ã‚¹ãªã©ã®å˜èªžã®åŒºåˆ‡ã‚Šã‚’
+ クオートã™ã‚‹ãŸã‚ã®è¤‡æ•°ã®æ–‡å­—ã§æ§‹æˆã•れる文字列 string を指定ã—ã¾ã™ã€‚
+ 指定ã—ãŸæ–‡å­—ã®é–“ã§ã¯ã€Readline.completer_word_break_characters=
+ ã§æŒ‡å®šã—ãŸæ–‡å­—列ã«å«ã¾ã‚Œã‚‹æ–‡å­—ã‚‚ã€æ™®é€šã®æ–‡å­—列ã¨ã—ã¦æ‰±ã‚れã¾ã™ã€‚
- $SAFE ¤¬ 4 ¤Î¾ì¹ç¡¢Îã³° SecurityError ¤¬È¯À¸¤·¤Þ¤¹¡£
+ サãƒãƒ¼ãƒˆã—ã¦ã„ãªã„環境ã§ã¯ã€ä¾‹å¤– NotImplementedError ãŒç™ºç”Ÿã—ã¾ã™ã€‚
Readline.completer_quote_characters -> string
- ¥æ¡¼¥¶¤ÎÆþÎϤÎÊä´°¤ò¹Ô¤¦ºÝ¡¢¥¹¥Ú¡¼¥¹¤Ê¤É¤Îñ¸ì¤Î¶èÀÚ¤ê¤ò
- ¥¯¥ª¡¼¥È¤¹¤ë¤¿¤á¤ÎÊ£¿ô¤Îʸ»ú¤Ç¹½À®¤µ¤ì¤ëʸ»úÎó¤ò¼èÆÀ¤·¤Þ¤¹¡£
-
- ¥µ¥Ý¡¼¥È¤·¤Æ¤¤¤Ê¤¤´Ä¶­¤Ç¤Ï¡¢Îã³° NotImplementedError ¤¬È¯À¸¤·¤Þ¤¹¡£
+ ユーザã®å…¥åŠ›ã®è£œå®Œã‚’行ã†éš›ã€ã‚¹ãƒšãƒ¼ã‚¹ãªã©ã®å˜èªžã®åŒºåˆ‡ã‚Šã‚’
+ クオートã™ã‚‹ãŸã‚ã®è¤‡æ•°ã®æ–‡å­—ã§æ§‹æˆã•れる文字列をå–å¾—ã—ã¾ã™ã€‚
- $SAFE ¤¬ 4 ¤Î¾ì¹ç¡¢Îã³° SecurityError ¤¬È¯À¸¤·¤Þ¤¹¡£
+ サãƒãƒ¼ãƒˆã—ã¦ã„ãªã„環境ã§ã¯ã€ä¾‹å¤– NotImplementedError ãŒç™ºç”Ÿã—ã¾ã™ã€‚
Readline.filename_quote_characters = string
- ¥æ¡¼¥¶¤ÎÆþÎÏ»þ¤Ë¥Õ¥¡¥¤¥ë̾¤ÎÊä´°¤ò¹Ô¤¦ºÝ¡¢¥¹¥Ú¡¼¥¹¤Ê¤É¤Îñ¸ì¤Î¶èÀÚ¤ê¤ò
- ¥¯¥ª¡¼¥È¤¹¤ë¤¿¤á¤ÎÊ£¿ô¤Îʸ»ú¤Ç¹½À®¤µ¤ì¤ëʸ»úÎó string ¤ò»ØÄꤷ¤Þ¤¹¡£
+ ユーザã®å…¥åŠ›æ™‚ã«ãƒ•ァイルåã®è£œå®Œã‚’行ã†éš›ã€ã‚¹ãƒšãƒ¼ã‚¹ãªã©ã®å˜èªžã®åŒºåˆ‡ã‚Šã‚’
+ クオートã™ã‚‹ãŸã‚ã®è¤‡æ•°ã®æ–‡å­—ã§æ§‹æˆã•れる文字列 string を指定ã—ã¾ã™ã€‚
- GNU Readline ¤Î¥Ç¥Õ¥©¥ë¥ÈÃÍ¤Ï nil ¤Ç¤¹¡£
+ GNU Readline ã®ãƒ‡ãƒ•ォルト値㯠nil ã§ã™ã€‚
- ¥µ¥Ý¡¼¥È¤·¤Æ¤¤¤Ê¤¤´Ä¶­¤Ç¤Ï¡¢Îã³° NotImplementedError ¤¬È¯À¸¤·¤Þ¤¹¡£
-
- $SAFE ¤¬ 4 ¤Î¾ì¹ç¡¢Îã³° SecurityError ¤¬È¯À¸¤·¤Þ¤¹¡£
+ サãƒãƒ¼ãƒˆã—ã¦ã„ãªã„環境ã§ã¯ã€ä¾‹å¤– NotImplementedError ãŒç™ºç”Ÿã—ã¾ã™ã€‚
Readline.filename_quote_characters -> string
- ¥æ¡¼¥¶¤ÎÆþÎÏ»þ¤Ë¥Õ¥¡¥¤¥ë̾¤ÎÊä´°¤ò¹Ô¤¦ºÝ¡¢¥¹¥Ú¡¼¥¹¤Ê¤É¤Îñ¸ì¤Î¶èÀÚ¤ê¤ò
- ¥¯¥ª¡¼¥È¤¹¤ë¤¿¤á¤ÎÊ£¿ô¤Îʸ»ú¤Ç¹½À®¤µ¤ì¤ëʸ»úÎó¤ò¼èÆÀ¤·¤Þ¤¹¡£
-
- ¥µ¥Ý¡¼¥È¤·¤Æ¤¤¤Ê¤¤´Ä¶­¤Ç¤Ï¡¢Îã³° NotImplementedError ¤¬È¯À¸¤·¤Þ¤¹¡£
+ ユーザã®å…¥åŠ›æ™‚ã«ãƒ•ァイルåã®è£œå®Œã‚’行ã†éš›ã€ã‚¹ãƒšãƒ¼ã‚¹ãªã©ã®å˜èªžã®åŒºåˆ‡ã‚Šã‚’
+ クオートã™ã‚‹ãŸã‚ã®è¤‡æ•°ã®æ–‡å­—ã§æ§‹æˆã•れる文字列をå–å¾—ã—ã¾ã™ã€‚
- $SAFE ¤¬ 4 ¤Î¾ì¹ç¡¢Îã³° SecurityError ¤¬È¯À¸¤·¤Þ¤¹¡£
+ サãƒãƒ¼ãƒˆã—ã¦ã„ãªã„環境ã§ã¯ã€ä¾‹å¤– NotImplementedError ãŒç™ºç”Ÿã—ã¾ã™ã€‚
-=== ¥¯¥é¥¹Äê¿ô
+=== クラス定数
HISTORY
- Äê¿ô HISTORY ¤ò»ÈÍѤ·¤Æ¥Ò¥¹¥È¥ê¤Ë¥¢¥¯¥»¥¹¤Ç¤­¤Þ¤¹¡£
- Enumerable ¥â¥¸¥å¡¼¥ë¤ò extend ¤·¤Æ¤ª¤ê¡¢
- ÇÛÎó¤Î¤è¤¦¤Ë¿¶¤ëÉñ¤¦¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£
- Î㤨¤Ð¡¢HISTORY[4] ¤Ë¤è¤ê 5 ÈÖÌÜ¤ËÆþÎϤ·¤¿ÆâÍÆ¤ò¼è¤ê½Ð¤¹¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£
+ 定数 HISTORY を使用ã—ã¦ãƒ’ストリã«ã‚¢ã‚¯ã‚»ã‚¹ã§ãã¾ã™ã€‚
+ Enumerable モジュールを extend ã—ã¦ãŠã‚Šã€
+ é…列ã®ã‚ˆã†ã«æŒ¯ã‚‹èˆžã†ã“ã¨ãŒã§ãã¾ã™ã€‚
+ 例ãˆã°ã€HISTORY[4] ã«ã‚ˆã‚Š 5 番目ã«å…¥åŠ›ã—ãŸå†…容をå–り出ã™ã“ã¨ãŒã§ãã¾ã™ã€‚
require "readline"
Readline::HISTORY.push("a", "b", "c", "d", "e")
p Readline::HISTORY[4] # => "e"
- ¼ÂÁõ¤·¤Æ¤¤¤ë¥á¥½¥Ã¥É¤ò¼¡¤Ëµó¤²¤Þ¤¹¡£
+ 実装ã—ã¦ã„ã‚‹ãƒ¡ã‚½ãƒƒãƒ‰ã‚’æ¬¡ã«æŒ™ã’ã¾ã™ã€‚
* HISTORY.to_s -> "HISTORY"
* HISTORY[index] -> string
* HISTORY[index] = string
@@ -407,31 +359,28 @@ HISTORY
* HISTORY.delete_at(index) -> string
* HISTORY.clear -> self
- ¥µ¥Ý¡¼¥È¤·¤Æ¤¤¤Ê¤¤´Ä¶­¤Ç¤Ï¡¢¼¡¤Î¥á¥½¥Ã¥É¤ÇÎã³° NotImplementedError ¤¬
- ȯÀ¸¤·¤Þ¤¹¡£
+ サãƒãƒ¼ãƒˆã—ã¦ã„ãªã„環境ã§ã¯ã€æ¬¡ã®ãƒ¡ã‚½ãƒƒãƒ‰ã§ä¾‹å¤– NotImplementedError ãŒ
+ 発生ã—ã¾ã™ã€‚
* HISTORY[index] = string
* HISTORY.pop -> string
* HISTORY.shift -> string
* HISTORY.delete_at(index) -> string
* HISTORY.clear -> self
- $SAFE ¤¬ 4 ¤Î¾ì¹ç¡¢¥Ò¥¹¥È¥ê¤Ë¥¢¥¯¥»¥¹¤·¤¿¤È¤­¤ËÎã³° SecurityError ¤¬
- ȯÀ¸¤·¤Þ¤¹¡£
-
FILENAME_COMPLETION_PROC
- ¥Õ¥¡¥¤¥ë̾¤ÎÊä´°¤ò¹Ô¤¦ call ¥á¥½¥Ã¥É¤ò»ý¤Ä¥ª¥Ö¥¸¥§¥¯¥È¤Ç¤¹¡£
+ ファイルåã®è£œå®Œã‚’行ㆠcall メソッドをæŒã¤ã‚ªãƒ–ジェクトã§ã™ã€‚
- Readline.completion_proc= ¤Ë¤è¤ê¡¢¥æ¡¼¥¶¤ÎÆþÎÏ»þ¤Ë¥Õ¥¡¥¤¥ë̾¤ÎÊä´°¤ò
- ¹Ô¤¦¤è¤¦¤ËÀßÄꤹ¤ë¤¿¤á¤Ë»ÈÍѤ¹¤ë¤³¤È¤òÁÛÄꤷ¤Æ¤Þ¤¹¡£
+ Readline.completion_proc= ã«ã‚ˆã‚Šã€ãƒ¦ãƒ¼ã‚¶ã®å…¥åŠ›æ™‚ã«ãƒ•ァイルåã®è£œå®Œã‚’
+ 行ã†ã‚ˆã†ã«è¨­å®šã™ã‚‹ãŸã‚ã«ä½¿ç”¨ã™ã‚‹ã“ã¨ã‚’想定ã—ã¦ã¾ã™ã€‚
USERNAME_COMPLETION_PROC
- ¥æ¡¼¥¶Ì¾¤ÎÊä´°¤ò¹Ô¤¦ call ¥á¥½¥Ã¥É¤ò»ý¤Ä¥ª¥Ö¥¸¥§¥¯¥È¤Ç¤¹¡£
+ ユーザåã®è£œå®Œã‚’行ㆠcall メソッドをæŒã¤ã‚ªãƒ–ジェクトã§ã™ã€‚
- Readline.completion_proc= ¤Ë¤è¤ê¡¢¥æ¡¼¥¶¤ÎÆþÎÏ»þ¤Ë¥æ¡¼¥¶Ì¾¤ÎÊä´°¤ò¹Ô
- ¤¦¤è¤¦¤ËÀßÄꤹ¤ë¤¿¤á¤Ë»ÈÍѤ¹¤ë¤³¤È¤òÁÛÄꤷ¤Æ¤Þ¤¹¡£
+ Readline.completion_proc= ã«ã‚ˆã‚Šã€ãƒ¦ãƒ¼ã‚¶ã®å…¥åŠ›æ™‚ã«ãƒ¦ãƒ¼ã‚¶åã®è£œå®Œã‚’行
+ ã†ã‚ˆã†ã«è¨­å®šã™ã‚‹ãŸã‚ã«ä½¿ç”¨ã™ã‚‹ã“ã¨ã‚’想定ã—ã¦ã¾ã™ã€‚
VERSION
- »ÈÍѤ·¤Æ¤¤¤ë GNU Readline ¤Þ¤¿¤Ï libedit ¤Î¥Ð¡¼¥¸¥ç¥ó¤Ç¤¹¡£
+ 使用ã—ã¦ã„ã‚‹ GNU Readline ã¾ãŸã¯ libedit ã®ãƒãƒ¼ã‚¸ãƒ§ãƒ³ã§ã™ã€‚
diff --git a/ext/readline/depend b/ext/readline/depend
index 6570c5a036..ef0414d9b2 100644
--- a/ext/readline/depend
+++ b/ext/readline/depend
@@ -1 +1,5 @@
-readline.o: readline.c $(hdrdir)/ruby.h $(topdir)/config.h $(hdrdir)/defines.h
+readline.o: readline.c $(HDRS) $(ruby_headers) \
+ $(hdrdir)/ruby/io.h \
+ $(hdrdir)/ruby/encoding.h \
+ $(hdrdir)/ruby/oniguruma.h \
+ $(hdrdir)/ruby/thread.h
diff --git a/ext/readline/extconf.rb b/ext/readline/extconf.rb
index e1c37ce5fa..0b121c1ebe 100644
--- a/ext/readline/extconf.rb
+++ b/ext/readline/extconf.rb
@@ -1,26 +1,22 @@
require "mkmf"
-$readline_headers = ["stdio.h"]
+readline = Struct.new(:headers, :extra_check).new(["stdio.h"])
-def have_readline_header(header)
- if have_header(header, &$readline_extra_check)
- $readline_headers.push(header)
+def readline.have_header(header)
+ if super(header, &extra_check)
+ headers.push(header)
return true
else
return false
end
end
-def have_readline_var(var)
- return have_var(var, $readline_headers)
+def readline.have_var(var)
+ return super(var, headers)
end
-def have_readline_func(func)
- return have_func(func, $readline_headers)
-end
-
-def have_readline_macro(macro)
- return have_macro(macro, $readline_headers)
+def readline.have_func(func)
+ return super(func, headers)
end
dir_config('curses')
@@ -37,62 +33,65 @@ have_library("ncurses", "tgetnum") ||
case enable_libedit
when true
# --enable-libedit
- unless (have_readline_header("editline/readline.h") ||
- have_readline_header("readline/readline.h")) &&
+ unless (readline.have_header("editline/readline.h") ||
+ readline.have_header("readline/readline.h")) &&
have_library("edit", "readline")
raise "libedit not found"
end
when false
# --disable-libedit
- unless ((have_readline_header("readline/readline.h") &&
- have_readline_header("readline/history.h")) &&
+ unless ((readline.have_header("readline/readline.h") &&
+ readline.have_header("readline/history.h")) &&
have_library("readline", "readline"))
raise "readline not found"
end
else
# does not specify
- unless ((have_readline_header("readline/readline.h") &&
- have_readline_header("readline/history.h")) &&
+ unless ((readline.have_header("readline/readline.h") &&
+ readline.have_header("readline/history.h")) &&
(have_library("readline", "readline") ||
have_library("edit", "readline"))) ||
- (have_readline_header("editline/readline.h") &&
+ (readline.have_header("editline/readline.h") &&
have_library("edit", "readline"))
raise "readline nor libedit not found"
end
end
-have_readline_func("rl_getc")
-have_readline_func("rl_getc_function")
-have_readline_func("rl_filename_completion_function")
-have_readline_func("rl_username_completion_function")
-have_readline_func("rl_completion_matches")
-have_readline_func("rl_refresh_line")
-have_readline_var("rl_deprep_term_function")
-have_readline_var("rl_completion_append_character")
-have_readline_var("rl_basic_word_break_characters")
-have_readline_var("rl_completer_word_break_characters")
-have_readline_var("rl_basic_quote_characters")
-have_readline_var("rl_completer_quote_characters")
-have_readline_var("rl_filename_quote_characters")
-have_readline_var("rl_attempted_completion_over")
-have_readline_var("rl_library_version")
-have_readline_var("rl_editing_mode")
-have_readline_var("rl_line_buffer")
-have_readline_var("rl_point")
+readline.have_func("rl_getc")
+readline.have_func("rl_getc_function")
+readline.have_func("rl_filename_completion_function")
+readline.have_func("rl_username_completion_function")
+readline.have_func("rl_completion_matches")
+readline.have_func("rl_refresh_line")
+readline.have_var("rl_deprep_term_function")
+readline.have_var("rl_completion_append_character")
+readline.have_var("rl_basic_word_break_characters")
+readline.have_var("rl_completer_word_break_characters")
+readline.have_var("rl_basic_quote_characters")
+readline.have_var("rl_completer_quote_characters")
+readline.have_var("rl_filename_quote_characters")
+readline.have_var("rl_attempted_completion_over")
+readline.have_var("rl_library_version")
+readline.have_var("rl_editing_mode")
+readline.have_var("rl_line_buffer")
+readline.have_var("rl_point")
# workaround for native windows.
-/mswin|bccwin|mingw/ !~ RUBY_PLATFORM && have_readline_var("rl_event_hook")
-/mswin|bccwin|mingw/ !~ RUBY_PLATFORM && have_readline_var("rl_catch_sigwinch")
-/mswin|bccwin|mingw/ !~ RUBY_PLATFORM && have_readline_var("rl_catch_signals")
-have_readline_func("rl_cleanup_after_signal")
-have_readline_func("rl_free_line_state")
-have_readline_func("rl_clear_signals")
-have_readline_func("rl_set_screen_size")
-have_readline_func("rl_get_screen_size")
-have_readline_func("rl_vi_editing_mode")
-have_readline_func("rl_emacs_editing_mode")
-have_readline_func("replace_history_entry")
-have_readline_func("remove_history")
-have_readline_func("clear_history")
-have_readline_macro("RL_PROMPT_START_IGNORE")
-have_readline_macro("RL_PROMPT_END_IGNORE")
+/mswin|bccwin|mingw/ !~ RUBY_PLATFORM && readline.have_var("rl_event_hook")
+/mswin|bccwin|mingw/ !~ RUBY_PLATFORM && readline.have_var("rl_catch_sigwinch")
+/mswin|bccwin|mingw/ !~ RUBY_PLATFORM && readline.have_var("rl_catch_signals")
+readline.have_var("rl_pre_input_hook")
+readline.have_var("rl_special_prefixes")
+readline.have_func("rl_cleanup_after_signal")
+readline.have_func("rl_free_line_state")
+readline.have_func("rl_clear_signals")
+readline.have_func("rl_set_screen_size")
+readline.have_func("rl_get_screen_size")
+readline.have_func("rl_vi_editing_mode")
+readline.have_func("rl_emacs_editing_mode")
+readline.have_func("replace_history_entry")
+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")
create_makefile("readline")
diff --git a/ext/readline/readline.c b/ext/readline/readline.c
index 971ee84e6b..820c6b74be 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,7 @@
#include "ruby/ruby.h"
#include "ruby/io.h"
+#include "ruby/thread.h"
#ifdef HAVE_UNISTD_H
#include <unistd.h>
@@ -48,7 +49,7 @@ static VALUE mReadline;
#define EDIT_LINE_LIBRARY_VERSION "EditLine wrapper"
#ifndef USE_INSERT_IGNORE_ESCAPE
-# if !defined(HAVE_EDITLINE_READLINE_H) && defined(HAVE_RL_PROMPT_START_IGNORE) && defined(HAVE_RL_PROMPT_END_IGNORE)
+# if !defined(HAVE_EDITLINE_READLINE_H) && defined(RL_PROMPT_START_IGNORE) && defined(RL_PROMPT_END_IGNORE)
# define USE_INSERT_IGNORE_ESCAPE 1
# else
# define USE_INSERT_IGNORE_ESCAPE 0
@@ -61,6 +62,12 @@ static ID completion_proc, completion_case_fold;
#if USE_INSERT_IGNORE_ESCAPE
static ID id_orig_prompt, id_last_prompt;
#endif
+#if defined(HAVE_RL_PRE_INPUT_HOOK)
+static ID id_pre_input_hook;
+#endif
+#if defined(HAVE_RL_SPECIAL_PREFIXES)
+static ID id_special_prefixes;
+#endif
#ifndef HAVE_RL_FILENAME_COMPLETION_FUNCTION
# define rl_filename_completion_function filename_completion_function
@@ -117,28 +124,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 ID id_getbyte;
+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;
@@ -146,19 +158,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 {
@@ -167,10 +179,62 @@ readline_getc(FILE *input)
}
}
#endif
- c = rb_funcall(readline_instream, id_getbyte, 0, 0);
- if (NIL_P(c)) return EOF;
- return NUM2CHR(c);
+
+ ss = read(p->fd, &ch, 1);
+ if (ss == 0) {
+ errno = 0;
+ return EOF;
+ }
+ 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
@@ -202,56 +266,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);
@@ -271,6 +335,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
@@ -281,11 +369,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.
@@ -354,8 +442,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)
@@ -365,23 +451,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
@@ -390,7 +484,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) {
@@ -402,9 +496,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
@@ -412,13 +506,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;
}
@@ -429,21 +523,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;
}
@@ -453,21 +560,186 @@ 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;
}
+#if defined(HAVE_RL_PRE_INPUT_HOOK)
+/*
+ * call-seq:
+ * Readline.pre_input_hook = proc
+ *
+ * Specifies a Proc object +proc+ to call after the first prompt has
+ * been printed and just before readline starts reading input
+ * characters.
+ *
+ * See GNU Readline's rl_pre_input_hook variable.
+ *
+ * Raises ArgumentError if +proc+ does not respond to the call method.
+ *
+ * Raises NotImplementedError if the using readline library does not support.
+ */
+static VALUE
+readline_s_set_pre_input_hook(VALUE self, VALUE proc)
+{
+ if (!NIL_P(proc) && !rb_respond_to(proc, rb_intern("call")))
+ rb_raise(rb_eArgError, "argument must respond to `call'");
+ return rb_ivar_set(mReadline, id_pre_input_hook, proc);
+}
+
+/*
+ * call-seq:
+ * Readline.pre_input_hook -> proc
+ *
+ * Returns a Proc object +proc+ to call after the first prompt has
+ * been printed and just before readline starts reading input
+ * characters. The default is nil.
+ *
+ * Raises NotImplementedError if the using readline library does not support.
+ */
+static VALUE
+readline_s_get_pre_input_hook(VALUE self)
+{
+ return rb_attr_get(mReadline, id_pre_input_hook);
+}
+
+static int
+readline_pre_input_hook(void)
+{
+ VALUE proc;
+
+ proc = rb_attr_get(mReadline, id_pre_input_hook);
+ if (!NIL_P(proc))
+ rb_funcall(proc, rb_intern("call"), 0);
+ return 0;
+}
+#else
+#define readline_s_set_pre_input_hook rb_f_notimplement
+#define readline_s_get_pre_input_hook rb_f_notimplement
+#endif
+
+#if defined(HAVE_RL_INSERT_TEXT)
+/*
+ * call-seq:
+ * Readline.insert_text(string) -> self
+ *
+ * Insert text into the line at the current cursor position.
+ *
+ * See GNU Readline's rl_insert_text function.
+ *
+ * Raises NotImplementedError if the using readline library does not support.
+ */
+static VALUE
+readline_s_insert_text(VALUE self, VALUE str)
+{
+ OutputStringValue(str);
+ rl_insert_text(RSTRING_PTR(str));
+ return self;
+}
+#else
+#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 = (VALUE)&fakestr;
+
+ fakestr.basic.flags = T_STRING | RSTRING_NOEMBED;
+ fakestr.as.heap.ptr = ptr;
+ fakestr.as.heap.len = len;
+ rb_enc_associate(str, rb_locale_encoding());
+ OBJ_FREEZE(str);
+ if (argc == 2) {
+ beg = NUM2LONG(argv[0]);
+ 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:
+ * Readline.redisplay -> self
+ *
+ * Change what's displayed on the screen to reflect the current
+ * contents.
+ *
+ * See GNU Readline's rl_redisplay function.
+ *
+ * Raises NotImplementedError if the using readline library does not support.
+ */
+static VALUE
+readline_s_redisplay(VALUE self)
+{
+ rl_redisplay();
+ return self;
+}
+#else
+#define readline_s_redisplay rb_f_notimplement
+#endif
+
/*
* call-seq:
* Readline.completion_proc = proc
@@ -535,15 +807,12 @@ readline_s_set_output(VALUE self, VALUE output)
* 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);
}
@@ -552,13 +821,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);
}
@@ -567,13 +833,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);
}
@@ -590,13 +853,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);
}
@@ -611,13 +871,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
@@ -637,15 +898,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 **
@@ -660,7 +941,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
@@ -670,20 +951,20 @@ 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*));
- if (result == NULL) rb_raise(rb_eNoMemError, "failed to allocate memory");
+ if (result == NULL) rb_memerror();
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;
@@ -691,31 +972,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] = ALLOC_N(char, low + 1);
- 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;
@@ -731,13 +1013,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;
}
@@ -755,8 +1034,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)
@@ -764,7 +1041,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));
@@ -784,13 +1060,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;
}
@@ -806,13 +1079,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
@@ -828,13 +1098,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;
}
@@ -850,13 +1117,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
@@ -899,23 +1163,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;
}
@@ -932,17 +1193,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);
@@ -958,28 +1216,25 @@ readline_s_get_completion_append_character(VALUE self)
*
* Sets the basic list of characters that signal a break between words
* for the completer routine. The default is the characters which
- * break words for completion in Bash: "\t\n\"\\'`@$><=;|&{(".
+ * 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;
@@ -997,15 +1252,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
@@ -1022,25 +1274,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;
@@ -1058,21 +1307,80 @@ 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
#define readline_s_get_completer_word_break_characters rb_f_notimplement
#endif
+#if defined(HAVE_RL_SPECIAL_PREFIXES)
+/*
+ * call-seq:
+ * Readline.special_prefixes = string
+ *
+ * Sets the list of characters that are word break characters, but
+ * should be left in text when it is passed to the completion
+ * function. Programs can use this to help determine what kind of
+ * completing to do. For instance, Bash sets this variable to "$@" so
+ * that it can complete shell variables and hostnames.
+ *
+ * See GNU Readline's rl_special_prefixes variable.
+ *
+ * Raises NotImplementedError if the using readline library does not support.
+ */
+static VALUE
+readline_s_set_special_prefixes(VALUE self, VALUE str)
+{
+ if (!NIL_P(str)) {
+ 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;
+ }
+ else {
+ rl_special_prefixes = RSTRING_PTR(str);
+ }
+ return self;
+}
+
+/*
+ * call-seq:
+ * Readline.special_prefixes -> string
+ *
+ * Gets the list of characters that are word break characters, but
+ * should be left in text when it is passed to the completion
+ * function.
+ *
+ * See GNU Readline's rl_special_prefixes variable.
+ *
+ * Raises NotImplementedError if the using readline library does not support.
+ */
+static VALUE
+readline_s_get_special_prefixes(VALUE self)
+{
+ VALUE str;
+ 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);
+ rb_obj_reveal(str, rb_cString);
+ }
+ return str;
+}
+#else
+#define readline_s_set_special_prefixes rb_f_notimplement
+#define readline_s_get_special_prefixes rb_f_notimplement
+#endif
+
#ifdef HAVE_RL_BASIC_QUOTE_CHARACTERS
/*
* call-seq:
@@ -1081,25 +1389,22 @@ readline_s_get_completer_word_break_characters(VALUE self, VALUE str)
* 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;
@@ -1117,15 +1422,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
@@ -1143,22 +1445,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';
@@ -1179,15 +1478,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
@@ -1203,22 +1499,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';
@@ -1239,15 +1532,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
@@ -1260,13 +1550,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;
}
@@ -1298,16 +1585,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);
}
@@ -1319,17 +1605,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;
}
@@ -1340,7 +1625,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;
@@ -1351,11 +1635,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;
}
@@ -1367,7 +1650,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);
@@ -1378,29 +1660,28 @@ rb_remove_history(int index)
return Qnil;
#else
rb_notimplement();
- return Qnil; /* not reached */
+
+ UNREACHABLE;
#endif
}
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;
}
}
@@ -1412,12 +1693,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;
}
@@ -1425,14 +1705,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;
}
@@ -1441,12 +1719,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);
}
@@ -1455,7 +1732,6 @@ hist_delete_at(VALUE self, VALUE index)
static VALUE
hist_clear(VALUE self)
{
- rb_secure(4);
clear_history();
return self;
}
@@ -1471,19 +1747,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;
}
@@ -1496,19 +1772,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;
}
@@ -1526,7 +1802,6 @@ Init_readline()
/* and using_history() call rl_initialize(). */
/* This assignment should be placed before using_history() */
rl_getc_function = readline_getc;
- id_getbyte = rb_intern_const("getbyte");
#elif defined HAVE_RL_EVENT_HOOK
rl_event_hook = readline_event;
#endif
@@ -1535,64 +1810,86 @@ Init_readline()
completion_proc = rb_intern(COMPLETION_PROC);
completion_case_fold = rb_intern(COMPLETION_CASE_FOLD);
+#if defined(HAVE_RL_PRE_INPUT_HOOK)
+ id_pre_input_hook = rb_intern("pre_input_hook");
+#endif
+#if defined(HAVE_RL_SPECIAL_PREFIXES)
+ id_special_prefixes = rb_intern("special_prefixes");
+#endif
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);
+ rb_define_singleton_method(mReadline, "pre_input_hook",
+ readline_s_get_pre_input_hook, 0);
+ rb_define_singleton_method(mReadline, "insert_text",
+ 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);
+ rb_define_singleton_method(mReadline, "special_prefixes=",
+ readline_s_set_special_prefixes, 1);
+ rb_define_singleton_method(mReadline, "special_prefixes",
+ readline_s_get_special_prefixes, 0);
#if USE_INSERT_IGNORE_ESCAPE
CONST_ID(id_orig_prompt, "orig_prompt");
@@ -1625,7 +1922,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.
@@ -1634,7 +1931,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.
@@ -1646,26 +1943,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
@@ -1676,13 +1973,16 @@ Init_readline()
rb_define_const(mReadline, "VERSION", version);
rl_attempted_completion_function = readline_attempted_completion_function;
+#if defined(HAVE_RL_PRE_INPUT_HOOK)
+ rl_pre_input_hook = (Function *)readline_pre_input_hook;
+#endif
#ifdef HAVE_RL_CATCH_SIGNALS
rl_catch_signals = 0;
-#endif
-
+#endif
#ifdef HAVE_RL_CLEAR_SIGNALS
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 40d54dab77..db7bea74ed 100644
--- a/ext/ripper/depend
+++ b/ext/ripper/depend
@@ -7,12 +7,19 @@ BISON = bison
src: ripper.c eventids1.c eventids2table.c
-ripper.o: ripper.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
+ripper.o: ripper.c id.c lex.c eventids1.c eventids2.c eventids2table.c \
+ $(HDRS) $(ruby_headers) \
+ $(hdrdir)/ruby/encoding.h \
+ $(hdrdir)/ruby/oniguruma.h \
+ $(hdrdir)/ruby/regex.h \
+ $(hdrdir)/ruby/util.h \
+ $(top_srcdir)/node.h \
+ $(top_srcdir)/internal.h \
+ {$(VPATH)}parse.h \
+ {$(VPATH)}id.h \
+ $(top_srcdir)/regenc.h \
+ $(top_srcdir)/vm_opts.h \
+ $(topdir)/probes.h
.y.c:
$(ECHO) compiling compiler $<
@@ -25,7 +32,9 @@ static: check
ripper.y: $(srcdir)/tools/preproc.rb $(top_srcdir)/parse.y
$(ECHO) extracting $@ from $(top_srcdir)/parse.y
- $(Q) $(RUBY) $(srcdir)/tools/preproc.rb $(top_srcdir)/parse.y --output=$@
+ $(Q) $(RUBY) $(top_srcdir)/tool/id2token.rb --path-separator=.$(PATH_SEPARATOR)./ --vpath=$(VPATH) id.h $(top_srcdir)/parse.y > ripper.tmp.y
+ $(Q) $(RUBY) $(srcdir)/tools/preproc.rb ripper.tmp.y --output=$@
+ $(Q) $(RM) ripper.tmp.y
check: $(GEN) $(SRC1) $(SRC2)
$(ECHO) checking $(SRC1) and $(SRC2)
diff --git a/ext/ripper/eventids2.c b/ext/ripper/eventids2.c
index 8b0d9c3757..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;
@@ -38,7 +39,10 @@ static ID ripper_id_tstring_content;
static ID ripper_id_tstring_end;
static ID ripper_id_words_beg;
static ID ripper_id_qwords_beg;
+static ID ripper_id_qsymbols_beg;
+static ID ripper_id_symbols_beg;
static ID ripper_id_words_sep;
+static ID ripper_id_rational;
static ID ripper_id_regexp_beg;
static ID ripper_id_regexp_end;
static ID ripper_id_label;
@@ -59,7 +63,7 @@ static ID ripper_id_CHAR;
#include "eventids2table.c"
static void
-ripper_init_eventids2(VALUE self)
+ripper_init_eventids2(void)
{
ripper_id_backref = rb_intern_const("on_backref");
ripper_id_backtick = rb_intern_const("on_backtick");
@@ -72,6 +76,7 @@ ripper_init_eventids2(VALUE self)
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");
@@ -91,7 +96,10 @@ ripper_init_eventids2(VALUE self)
ripper_id_tstring_end = rb_intern_const("on_tstring_end");
ripper_id_words_beg = rb_intern_const("on_words_beg");
ripper_id_qwords_beg = rb_intern_const("on_qwords_beg");
+ ripper_id_qsymbols_beg = rb_intern_const("on_qsymbols_beg");
+ ripper_id_symbols_beg = rb_intern_const("on_symbols_beg");
ripper_id_words_sep = rb_intern_const("on_words_sep");
+ ripper_id_rational = rb_intern_const("on_rational");
ripper_id_regexp_beg = rb_intern_const("on_regexp_beg");
ripper_id_regexp_end = rb_intern_const("on_regexp_end");
ripper_id_label = rb_intern_const("on_label");
@@ -108,8 +116,6 @@ ripper_init_eventids2(VALUE self)
ripper_id_heredoc_end = rb_intern_const("on_heredoc_end");
ripper_id___end__ = rb_intern_const("on___end__");
ripper_id_CHAR = rb_intern_const("on_CHAR");
-
- ripper_init_eventids2_table(self);
}
static const struct token_assoc {
@@ -207,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},
@@ -230,14 +237,19 @@ static const struct token_assoc {
{tOROP, &ripper_id_op},
{tPOW, &ripper_id_op},
{tQWORDS_BEG, &ripper_id_qwords_beg},
+ {tQSYMBOLS_BEG, &ripper_id_qsymbols_beg},
+ {tSYMBOLS_BEG, &ripper_id_symbols_beg},
+ {tRATIONAL, &ripper_id_rational},
{tREGEXP_BEG, &ripper_id_regexp_beg},
{tREGEXP_END, &ripper_id_regexp_end},
{tRPAREN, &ripper_id_rparen},
{tRSHFT, &ripper_id_op},
{tSTAR, &ripper_id_op},
+ {tDSTAR, &ripper_id_op},
{tSTRING_BEG, &ripper_id_tstring_beg},
{tSTRING_CONTENT, &ripper_id_tstring_content},
{tSTRING_DBEG, &ripper_id_embexpr_beg},
+ {tSTRING_DEND, &ripper_id_embexpr_end},
{tSTRING_DVAR, &ripper_id_embvar},
{tSTRING_END, &ripper_id_tstring_end},
{tSYMBEG, &ripper_id_symbeg},
@@ -276,4 +288,6 @@ ripper_token2eventid(int tok)
return ripper_id_CHAR;
}
rb_raise(rb_eRuntimeError, "[Ripper FATAL] unknown token %d", tok);
+
+ UNREACHABLE;
}
diff --git a/ext/ripper/extconf.rb b/ext/ripper/extconf.rb
index 4914d70e78..db54e5ca2a 100644
--- a/ext/ripper/extconf.rb
+++ b/ext/ripper/extconf.rb
@@ -6,8 +6,7 @@ require 'rbconfig'
def main
unless find_executable('bison')
unless File.exist?('ripper.c') or File.exist?("#{$srcdir}/ripper.c")
- Logging.message 'missing bison; abort'
- return
+ raise 'missing bison; abort'
end
end
$objs = %w(ripper.o)
diff --git a/ext/ripper/lib/ripper.rb b/ext/ripper/lib/ripper.rb
index cb19da334a..542bd405d2 100644
--- a/ext/ripper/lib/ripper.rb
+++ b/ext/ripper/lib/ripper.rb
@@ -2,3 +2,72 @@ require 'ripper/core'
require 'ripper/lexer'
require 'ripper/filter'
require 'ripper/sexp'
+
+# Ripper is a Ruby script parser.
+#
+# You can get information from the parser with event-based style.
+# Information such as abstract syntax trees or simple lexical analysis of the
+# Ruby program.
+#
+# == Usage
+#
+# Ripper provides an easy interface for parsing your program into a symbolic
+# expression tree (or S-expression).
+#
+# Understanding the output of the parser may come as a challenge, it's
+# recommended you use PP to format the output for legibility.
+#
+# require 'ripper'
+# require 'pp'
+#
+# pp Ripper.sexp('def hello(world) "Hello, #{world}!"; end')
+# #=> [:program,
+# [[:def,
+# [:@ident, "hello", [1, 4]],
+# [:paren,
+# [:params, [[:@ident, "world", [1, 10]]], nil, nil, nil, nil, nil, nil]],
+# [:bodystmt,
+# [[:string_literal,
+# [:string_content,
+# [:@tstring_content, "Hello, ", [1, 18]],
+# [:string_embexpr, [[:var_ref, [:@ident, "world", [1, 27]]]]],
+# [:@tstring_content, "!", [1, 33]]]]],
+# nil,
+# nil,
+# nil]]]]
+#
+# You can see in the example above, the expression starts with +:program+.
+#
+# From here, a method definition at +:def+, followed by the method's identifier
+# <code>:@ident</code>. After the method's identifier comes the parentheses
+# +:paren+ and the method parameters under +:params+.
+#
+# Next is the method body, starting at +:bodystmt+ (+stmt+ meaning statement),
+# which contains the full definition of the method.
+#
+# In our case, we're simply returning a String, so next we have the
+# +:string_literal+ expression.
+#
+# Within our +:string_literal+ you'll notice two <code>@tstring_content</code>,
+# this is the literal part for <code>Hello, </code> and <code>!</code>. Between
+# the two <code>@tstring_content</code> statements is a +:string_embexpr+,
+# where _embexpr_ is an embedded expression. Our expression consists of a local
+# variable, or +var_ref+, with the identifier (<code>@ident</code>) of +world+.
+#
+# == Resources
+#
+# * {Ruby Inside}[http://www.rubyinside.com/using-ripper-to-see-how-ruby-is-parsing-your-code-5270.html]
+#
+# == Requirements
+#
+# * ruby 1.9 (support CVS HEAD only)
+# * bison 1.28 or later (Other yaccs do not work)
+#
+# == License
+#
+# Ruby License.
+#
+# Minero Aoki
+# aamine@loveruby.net
+# http://i.loveruby.net
+class Ripper; end
diff --git a/ext/ripper/lib/ripper/core.rb b/ext/ripper/lib/ripper/core.rb
index 35aa54d090..637a72f4ad 100644
--- a/ext/ripper/lib/ripper/core.rb
+++ b/ext/ripper/lib/ripper/core.rb
@@ -12,8 +12,8 @@ require 'ripper.so'
class Ripper
- # Parses Ruby program read from _src_.
- # _src_ must be a String or a IO or a object which has #gets method.
+ # Parses the given Ruby program read from +src+.
+ # +src+ must be a String or an IO or a object with a #gets method.
def Ripper.parse(src, filename = '(ripper)', lineno = 1)
new(src, filename, lineno).parse
end
@@ -42,12 +42,12 @@ class Ripper
end
# This method is called when weak warning is produced by the parser.
- # _fmt_ and _args_ is printf style.
+ # +fmt+ and +args+ is printf style.
def warn(fmt, *args)
end
# This method is called when strong warning is produced by the parser.
- # _fmt_ and _args_ is printf style.
+ # +fmt+ and +args+ is printf style.
def warning(fmt, *args)
end
diff --git a/ext/ripper/lib/ripper/filter.rb b/ext/ripper/lib/ripper/filter.rb
index 898501b23c..239f9f00e1 100644
--- a/ext/ripper/lib/ripper/filter.rb
+++ b/ext/ripper/lib/ripper/filter.rb
@@ -13,9 +13,13 @@ require 'ripper/lexer'
class Ripper
# This class handles only scanner events,
- # and they are dispatched in the `right' order (same with input).
+ # which are dispatched in the 'right' order (same with input).
class Filter
+ # Creates a new Ripper::Filter instance, passes parameters +src+,
+ # +filename+, and +lineno+ to Ripper::Lexer.new
+ #
+ # The lexer is for internal use only.
def initialize(src, filename = '-', lineno = 1)
@__lexer = Lexer.new(src, filename, lineno)
@__line = nil
@@ -41,8 +45,9 @@ class Ripper
@__col
end
- # Starts parsing. _init_ is a data accumulator.
- # It is passed to the next event handler (as of Enumerable#inject).
+ # Starts the parser.
+ # +init+ is a data accumulator and is passed to the next event handler (as
+ # of Enumerable#inject).
def parse(init = nil)
data = init
@__lexer.lex.each do |pos, event, tok|
@@ -57,10 +62,12 @@ class Ripper
private
- # This method is called when some event handler have not defined.
- # _event_ is :on_XXX, _token_ is scanned token, _data_ is a data
- # accumulator. The return value of this method is passed to the
- # next event handler (as of Enumerable#inject).
+ # This method is called when some event handler is undefined.
+ # +event+ is :on_XXX, +token+ is the scanned token, and +data+ is a data
+ # accumulator.
+ #
+ # The return value of this method is passed to the next event handler (as
+ # of Enumerable#inject).
def on_default(event, token, data)
data
end
diff --git a/ext/ripper/lib/ripper/lexer.rb b/ext/ripper/lib/ripper/lexer.rb
index 5bbee39e06..5c99dfe8fa 100644
--- a/ext/ripper/lib/ripper/lexer.rb
+++ b/ext/ripper/lib/ripper/lexer.rb
@@ -12,18 +12,22 @@ require 'ripper/core'
class Ripper
- # Tokenizes Ruby program and returns an Array of String.
+ # Tokenizes the Ruby program and returns an Array of String.
+ #
+ # p Ripper.tokenize("def m(a) nil end")
+ # # => ["def", " ", "m", "(", "a", ")", " ", "nil", " ", "end"]
+ #
def Ripper.tokenize(src, filename = '-', lineno = 1)
Lexer.new(src, filename, lineno).tokenize
end
- # Tokenizes Ruby program and returns an Array of Array,
- # which is formatted like [[lineno, column], type, token].
+ # Tokenizes the Ruby program and returns an Array of an Array,
+ # which is formatted like <code>[[lineno, column], type, token]</code>.
#
# require 'ripper'
# require 'pp'
#
- # p Ripper.lex("def m(a) nil end")
+ # pp Ripper.lex("def m(a) nil end")
# #=> [[[1, 0], :on_kw, "def"],
# [[1, 3], :on_sp, " " ],
# [[1, 4], :on_ident, "m" ],
@@ -90,9 +94,12 @@ class Ripper
class TokenPattern #:nodoc:
- class Error < ::StandardError; end
- class CompileError < Error; end
- class MatchError < Error; end
+ class Error < ::StandardError # :nodoc:
+ end
+ class CompileError < Error # :nodoc:
+ end
+ class MatchError < Error # :nodoc:
+ end
class << self
alias compile new
@@ -155,7 +162,7 @@ class Ripper
MAP[tok] or raise CompileError, "unknown token: #{tok}"
end
- class MatchData
+ class MatchData # :nodoc:
def initialize(tokens, match)
@tokens = tokens
@match = match
diff --git a/ext/ripper/lib/ripper/sexp.rb b/ext/ripper/lib/ripper/sexp.rb
index 37040e4c11..66bd69134d 100644
--- a/ext/ripper/lib/ripper/sexp.rb
+++ b/ext/ripper/lib/ripper/sexp.rb
@@ -15,7 +15,7 @@ class Ripper
# [EXPERIMENTAL]
# Parses +src+ and create S-exp tree.
# Returns more readable tree rather than Ripper.sexp_raw.
- # This method is for mainly developper use.
+ # This method is mainly for developer use.
#
# require 'ripper'
# require 'pp'
@@ -33,7 +33,7 @@ class Ripper
# [EXPERIMENTAL]
# Parses +src+ and create S-exp tree.
- # This method is for mainly developper use.
+ # This method is mainly for developer use.
#
# require 'ripper'
# require 'pp'
diff --git a/ext/ripper/tools/generate.rb b/ext/ripper/tools/generate.rb
index 22c3ac0eb7..48ad9e1d25 100755
--- a/ext/ripper/tools/generate.rb
+++ b/ext/ripper/tools/generate.rb
@@ -6,7 +6,6 @@ def main
mode = nil
ids1src = nil
ids2src = nil
- template = nil
output = nil
parser = @parser = OptionParser.new
@@ -74,15 +73,18 @@ def generate_eventids1(ids)
end
buf << %Q[\n]
buf << %Q[static void\n]
- buf << %Q[ripper_init_eventids1(VALUE self)\n]
+ buf << %Q[ripper_init_eventids1(void)\n]
buf << %Q[{\n]
- buf << %Q[ VALUE h;\n]
- buf << %Q[ ID id;\n]
ids.each do |id, arity|
buf << %Q[ ripper_id_#{id} = rb_intern_const("on_#{id}");\n]
end
+ buf << %Q[}\n]
buf << %Q[\n]
- buf << %Q[ h = rb_hash_new();\n]
+ buf << %Q[static void\n]
+ buf << %Q[ripper_init_eventids1_table(VALUE self)\n]
+ buf << %Q[{\n]
+ buf << %Q[ VALUE h = rb_hash_new();\n]
+ buf << %Q[ ID id;\n]
buf << %Q[ rb_define_const(self, "PARSER_EVENT_TABLE", h);\n]
ids.each do |id, arity|
buf << %Q[ id = rb_intern_const("#{id}");\n]
diff --git a/ext/sdbm/_sdbm.c b/ext/sdbm/_sdbm.c
index 28e5b03b31..847eb2aaf6 100644
--- a/ext/sdbm/_sdbm.c
+++ b/ext/sdbm/_sdbm.c
@@ -7,10 +7,6 @@
* core routines
*/
-#ifndef lint
-/*char sdbm_rcsid[] = "$Id$";*/
-#endif
-
#include "ruby/config.h"
#include "ruby/defines.h"
@@ -110,7 +106,7 @@ static int duppair proto((char *, datum));
/*
* externals
*/
-#if !defined sun && !defined _WIN32 && !defined __CYGWIN__ && !defined(errno)
+#if !defined(__sun) && !defined(_WIN32) && !defined(__CYGWIN__) && !defined(errno)
extern int errno;
#endif
@@ -160,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;
@@ -178,6 +174,29 @@ sdbm_open(register char *file, register int flags, register int mode)
return db;
}
+static int
+fd_set_cloexec(int fd)
+{
+ /* MinGW don't have F_GETFD and FD_CLOEXEC. [ruby-core:40281] */
+#ifdef F_GETFD
+ int flags, ret;
+ flags = fcntl(fd, F_GETFD); /* should not fail except EBADF. */
+ if (flags == -1) {
+ return -1;
+ }
+ if (2 < fd) {
+ if (!(flags & FD_CLOEXEC)) {
+ flags |= FD_CLOEXEC;
+ ret = fcntl(fd, F_SETFD, flags);
+ if (ret == -1) {
+ return -1;
+ }
+ }
+ }
+#endif
+ return 0;
+}
+
DBM *
sdbm_prep(char *dirname, char *pagname, int flags, int mode)
{
@@ -187,6 +206,8 @@ sdbm_prep(char *dirname, char *pagname, int flags, int mode)
if ((db = (DBM *) malloc(sizeof(DBM))) == NULL)
return errno = ENOMEM, (DBM *) NULL;
+ db->pagf = -1;
+ db->dirf = -1;
db->flags = 0;
db->hmask = 0;
db->blkptr = 0;
@@ -205,31 +226,38 @@ sdbm_prep(char *dirname, char *pagname, int flags, int mode)
* If we fail anywhere, undo everything, return NULL.
*/
flags |= O_BINARY;
- if ((db->pagf = open(pagname, flags, mode)) > -1) {
- if ((db->dirf = open(dirname, flags, mode)) > -1) {
+#ifdef O_CLOEXEC
+ flags |= O_CLOEXEC;
+#endif
+
+ if ((db->pagf = open(pagname, flags, mode)) == -1) goto err;
+ if (fd_set_cloexec(db->pagf) == -1) goto err;
+ if ((db->dirf = open(dirname, flags, mode)) == -1) goto err;
+ if (fd_set_cloexec(db->dirf) == -1) goto err;
/*
* need the dirfile size to establish max bit number.
*/
- if (fstat(db->dirf, &dstat) == 0) {
+ if (fstat(db->dirf, &dstat) == -1) goto err;
/*
* zero size: either a fresh database, or one with a single,
* unsplit data page: dirpage is all zeros.
*/
- db->dirbno = (!dstat.st_size) ? 0 : -1;
- db->pagbno = -1;
- db->maxbno = dstat.st_size * (long) BYTESIZ;
+ db->dirbno = (!dstat.st_size) ? 0 : -1;
+ db->pagbno = -1;
+ db->maxbno = dstat.st_size * (long) BYTESIZ;
- (void) memset(db->pagbuf, 0, PBLKSIZ);
- (void) memset(db->dirbuf, 0, DBLKSIZ);
- /*
- * success
- */
- return db;
- }
- (void) close(db->dirf);
- }
- (void) close(db->pagf);
- }
+ (void) memset(db->pagbuf, 0, PBLKSIZ);
+ (void) memset(db->dirbuf, 0, DBLKSIZ);
+/*
+ * success
+ */
+ return db;
+
+ err:
+ if (db->pagf != -1)
+ (void) close(db->pagf);
+ if (db->dirf != -1)
+ (void) close(db->dirf);
free((char *) db);
return (DBM *) NULL;
}
@@ -364,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
@@ -604,10 +632,6 @@ getnext(register DBM *db)
* page-level routines
*/
-#ifndef lint
-/*char pair_rcsid[] = "$Id$";*/
-#endif
-
#ifndef BSD42
/*#include <memory.h>*/
#endif
@@ -648,8 +672,8 @@ fitpair(char *pag, int need)
register short *ino = (short *) pag;
off = ((n = GET_SHORT(ino,0)) > 0) ? GET_SHORT(ino,n) : PBLKSIZ;
- free = off - (n + 1) * sizeof(short);
- need += 2 * sizeof(short);
+ free = off - (n + 1) * (int)sizeof(short);
+ need += 2 * (int)sizeof(short);
debug(("free %d need %d\n", free, need));
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 7ba59c4e5c..78add53e4f 100644
--- a/ext/sdbm/init.c
+++ b/ext/sdbm/init.c
@@ -15,6 +15,55 @@
#include <fcntl.h>
#include <errno.h>
+/*
+ * Document-class: SDBM
+ *
+ * SDBM provides a simple file-based key-value store, which can only store
+ * String keys and values.
+ *
+ * Note that Ruby comes with the source code for SDBM, while the DBM and GDBM
+ * standard libraries rely on external libraries and headers.
+ *
+ * === Examples
+ *
+ * Insert values:
+ *
+ * require 'sdbm'
+ *
+ * SDBM.open 'my_database' do |db|
+ * db['apple'] = 'fruit'
+ * db['pear'] = 'fruit'
+ * db['carrot'] = 'vegetable'
+ * db['tomato'] = 'vegetable'
+ * end
+ *
+ * Bulk update:
+ *
+ * require 'sdbm'
+ *
+ * SDBM.open 'my_database' do |db|
+ * db.update('peach' => 'fruit', 'tomato' => 'fruit')
+ * end
+ *
+ * Retrieve values:
+ *
+ * require 'sdbm'
+ *
+ * SDBM.open 'my_database' do |db|
+ * db.each do |key, value|
+ * puts "Key: #{key}, Value: #{value}"
+ * end
+ * end
+ *
+ * Outputs:
+ *
+ * Key: apple, Value: fruit
+ * Key: pear, Value: fruit
+ * Key: carrot, Value: vegetable
+ * Key: peach, Value: fruit
+ * Key: tomato, Value: fruit
+ */
+
static VALUE rb_cDBM, rb_eDBMError;
struct dbmdata {
@@ -47,6 +96,14 @@ free_sdbm(struct dbmdata *dbmp)
ruby_xfree(dbmp);
}
+/*
+ * call-seq:
+ * sdbm.close -> nil
+ *
+ * Closes the database file.
+ *
+ * Raises SDBMError if the database is already closed.
+ */
static VALUE
fsdbm_close(VALUE obj)
{
@@ -59,6 +116,12 @@ fsdbm_close(VALUE obj)
return Qnil;
}
+/*
+ * call-seq:
+ * sdbm.closed? -> true or false
+ *
+ * Returns +true+ if the database is closed.
+ */
static VALUE
fsdbm_closed(VALUE obj)
{
@@ -78,7 +141,21 @@ 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.
+ */
static VALUE
fsdbm_initialize(int argc, VALUE *argv, VALUE obj)
{
@@ -109,7 +186,7 @@ fsdbm_initialize(int argc, VALUE *argv, VALUE obj)
if (!dbm) {
if (mode == -1) return Qnil;
- rb_sys_fail(RSTRING_PTR(file));
+ rb_sys_fail_str(file);
}
dbmp = ALLOC(struct dbmdata);
@@ -120,6 +197,24 @@ fsdbm_initialize(int argc, VALUE *argv, VALUE obj)
return obj;
}
+/*
+ * call-seq:
+ * SDBM.open(filename, mode = 0666)
+ * SDBM.open(filename, mode = 0666) { |sdbm| ... }
+ *
+ * If called without a block, this is the same as SDBM.new.
+ *
+ * If a block is given, the new database will be passed to the block and
+ * will be safely closed after the block has executed.
+ *
+ * Example:
+ *
+ * require 'sdbm'
+ *
+ * SDBM.open('my_database') do |db|
+ * db['hello'] = 'world'
+ * end
+ */
static VALUE
fsdbm_s_open(int argc, VALUE *argv, VALUE klass)
{
@@ -157,12 +252,34 @@ fsdbm_fetch(VALUE obj, VALUE keystr, VALUE ifnone)
return rb_external_str_new(value.dptr, value.dsize);
}
+/*
+ * call-seq:
+ * sdbm[key] -> value or nil
+ *
+ * Returns the +value+ in the database associated with the given +key+ string.
+ *
+ * If no value is found, returns +nil+.
+ */
static VALUE
fsdbm_aref(VALUE obj, VALUE keystr)
{
return fsdbm_fetch(obj, keystr, Qnil);
}
+/*
+ * call-seq:
+ * sdbm.fetch(key) -> value or nil
+ * sdbm.fetch(key) { |key| ... }
+ *
+ * Returns the +value+ in the database associated with the given +key+ string.
+ *
+ * If a block is provided, the block will be called when there is no
+ * +value+ associated with the given +key+. The +key+ will be passed in as an
+ * argument to the block.
+ *
+ * If no block is provided and no value is associated with the given +key+,
+ * then an IndexError will be raised.
+ */
static VALUE
fsdbm_fetch_m(int argc, VALUE *argv, VALUE obj)
{
@@ -176,6 +293,14 @@ fsdbm_fetch_m(int argc, VALUE *argv, VALUE obj)
return valstr;
}
+/*
+ * call-seq:
+ * sdbm.key(value) -> key
+ *
+ * Returns the +key+ associated with the given +value+. If more than one
+ * +key+ corresponds to the given +value+, then the first key to be found
+ * will be returned. If no keys are found, +nil+ will be returned.
+ */
static VALUE
fsdbm_key(VALUE obj, VALUE valstr)
{
@@ -197,6 +322,9 @@ fsdbm_key(VALUE obj, VALUE valstr)
return Qnil;
}
+/*
+ * :nodoc:
+ */
static VALUE
fsdbm_index(VALUE hash, VALUE value)
{
@@ -204,6 +332,25 @@ fsdbm_index(VALUE hash, VALUE value)
return fsdbm_key(hash, value);
}
+/* call-seq:
+ * sdbm.select { |key, value| ... } -> Array
+ *
+ * Returns a new Array of key-value pairs for which the block returns +true+.
+ *
+ * Example:
+ *
+ * require 'sdbm'
+ *
+ * SDBM.open 'my_database' do |db|
+ * db['apple'] = 'fruit'
+ * db['pear'] = 'fruit'
+ * db['spinach'] = 'vegetable'
+ *
+ * veggies = db.select do |key, value|
+ * value == 'vegetable'
+ * end #=> [["apple", "fruit"], ["pear", "fruit"]]
+ * end
+ */
static VALUE
fsdbm_select(VALUE obj)
{
@@ -228,6 +375,11 @@ fsdbm_select(VALUE obj)
return new;
}
+/* call-seq:
+ * sdbm.values_at(key, ...) -> Array
+ *
+ * Returns an Array of values corresponding to the given keys.
+ */
static VALUE
fsdbm_values_at(int argc, VALUE *argv, VALUE obj)
{
@@ -244,10 +396,21 @@ 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");
}
+/*
+ * call-seq:
+ * sdbm.delete(key) -> value or nil
+ * sdbm.delete(key) { |key, value| ... }
+ *
+ * Deletes the key-value pair corresponding to the given +key+. If the
+ * +key+ exists, the deleted value will be returned, otherwise +nil+.
+ *
+ * If a block is provided, the deleted +key+ and +value+ will be passed to
+ * the block as arguments. If the +key+ does not exist in the database, the
+ * value will be +nil+.
+ */
static VALUE
fsdbm_delete(VALUE obj, VALUE keystr)
{
@@ -283,6 +446,13 @@ fsdbm_delete(VALUE obj, VALUE keystr)
return valstr;
}
+/*
+ * call-seq:
+ * sdbm.shift -> Array or nil
+ *
+ * Removes a key-value pair from the database and returns them as an
+ * Array. If the database is empty, returns +nil+.
+ */
static VALUE
fsdbm_shift(VALUE obj)
{
@@ -306,6 +476,14 @@ fsdbm_shift(VALUE obj)
return rb_assoc_new(keystr, valstr);
}
+/*
+ * call-seq:
+ * sdbm.delete_if { |key, value| ... } -> self
+ * sdbm.reject! { |key, value| ... } -> self
+ *
+ * Iterates over the key-value pairs in the database, deleting those for
+ * which the block returns +true+.
+ */
static VALUE
fsdbm_delete_if(VALUE obj)
{
@@ -345,6 +523,12 @@ fsdbm_delete_if(VALUE obj)
return obj;
}
+/*
+ * call-seq:
+ * sdbm.clear -> self
+ *
+ * Deletes all data from the database.
+ */
static VALUE
fsdbm_clear(VALUE obj)
{
@@ -365,6 +549,22 @@ fsdbm_clear(VALUE obj)
return obj;
}
+/*
+ * call-seq:
+ * sdbm.invert -> Hash
+ *
+ * Returns a Hash in which the key-value pairs have been inverted.
+ *
+ * Example:
+ *
+ * require 'sdbm'
+ *
+ * SDBM.open 'my_database' do |db|
+ * db.update('apple' => 'fruit', 'spinach' => 'vegetable')
+ *
+ * db.invert #=> {"fruit" => "apple", "vegetable" => "spinach"}
+ * end
+ */
static VALUE
fsdbm_invert(VALUE obj)
{
@@ -384,6 +584,18 @@ fsdbm_invert(VALUE obj)
return hash;
}
+/*
+ * call-seq:
+ * sdbm[key] = value -> value
+ * sdbm.store(key, value) -> value
+ *
+ * Stores a new +value+ in the database with the given +key+ as an index.
+ *
+ * If the +key+ already exists, this will update the +value+ associated with
+ * the +key+.
+ *
+ * Returns the given +value+.
+ */
static VALUE
fsdbm_store(VALUE obj, VALUE keystr, VALUE valstr)
{
@@ -430,6 +642,15 @@ update_i(VALUE pair, VALUE dbm)
return Qnil;
}
+/*
+ * call-seq:
+ * sdbm.update(pairs) -> self
+ *
+ * Insert or update key-value pairs.
+ *
+ * This method will work with any object which implements an each_pair
+ * method, such as a Hash.
+ */
static VALUE
fsdbm_update(VALUE obj, VALUE other)
{
@@ -437,6 +658,15 @@ fsdbm_update(VALUE obj, VALUE other)
return obj;
}
+/*
+ * call-seq:
+ * sdbm.replace(pairs) -> self
+ *
+ * Empties the database, then inserts the given key-value pairs.
+ *
+ * This method will work with any object which implements an each_pair
+ * method, such as a Hash.
+ */
static VALUE
fsdbm_replace(VALUE obj, VALUE other)
{
@@ -445,6 +675,13 @@ fsdbm_replace(VALUE obj, VALUE other)
return obj;
}
+/*
+ * call-seq:
+ * sdbm.length -> integer
+ * sdbm.size -> integer
+ *
+ * Returns the number of keys in the database.
+ */
static VALUE
fsdbm_length(VALUE obj)
{
@@ -464,29 +701,43 @@ fsdbm_length(VALUE obj)
return INT2FIX(i);
}
+/*
+ * call-seq:
+ * sdbm.empty? -> true or false
+ *
+ * Returns +true+ if the database is empty.
+ */
static VALUE
fsdbm_empty_p(VALUE obj)
{
datum key;
struct dbmdata *dbmp;
DBM *dbm;
- int i = 0;
GetDBM(obj, dbmp);
if (dbmp->di_size < 0) {
dbm = dbmp->di_dbm;
for (key = sdbm_firstkey(dbm); key.dptr; key = sdbm_nextkey(dbm)) {
- i++;
+ return Qfalse;
}
}
else {
- i = dbmp->di_size;
+ if (dbmp->di_size)
+ return Qfalse;
}
- if (i == 0) return Qtrue;
- return Qfalse;
+ return Qtrue;
}
+/*
+ * call-seq:
+ * sdbm.each_value
+ * sdbm.each_value { |value| ... }
+ *
+ * Iterates over each +value+ in the database.
+ *
+ * If no block is given, returns an Enumerator.
+ */
static VALUE
fsdbm_each_value(VALUE obj)
{
@@ -505,6 +756,15 @@ fsdbm_each_value(VALUE obj)
return obj;
}
+/*
+ * call-seq:
+ * sdbm.each_key
+ * sdbm.each_key { |key| ... }
+ *
+ * Iterates over each +key+ in the database.
+ *
+ * If no block is given, returns an Enumerator.
+ */
static VALUE
fsdbm_each_key(VALUE obj)
{
@@ -522,6 +782,17 @@ fsdbm_each_key(VALUE obj)
return obj;
}
+/*
+ * call-seq:
+ * sdbm.each
+ * sdbm.each { |key, value| ... }
+ * sdbm.each_pair
+ * sdbm.each_pair { |key, value| ... }
+ *
+ * Iterates over each key-value pair in the database.
+ *
+ * If no block is given, returns an Enumerator.
+ */
static VALUE
fsdbm_each_pair(VALUE obj)
{
@@ -544,6 +815,12 @@ fsdbm_each_pair(VALUE obj)
return obj;
}
+/*
+ * call-seq:
+ * sdbm.keys -> Array
+ *
+ * Returns a new Array containing the keys in the database.
+ */
static VALUE
fsdbm_keys(VALUE obj)
{
@@ -561,6 +838,12 @@ fsdbm_keys(VALUE obj)
return ary;
}
+/*
+ * call-seq:
+ * sdbm.values -> Array
+ *
+ * Returns a new Array containing the values in the database.
+ */
static VALUE
fsdbm_values(VALUE obj)
{
@@ -579,6 +862,15 @@ fsdbm_values(VALUE obj)
return ary;
}
+/*
+ * call-seq:
+ * sdbm.include?(key) -> true or false
+ * sdbm.key?(key) -> true or false
+ * sdbm.member?(key) -> true or false
+ * sdbm.has_key?(key) -> true or false
+ *
+ * Returns +true+ if the database contains the given +key+.
+ */
static VALUE
fsdbm_has_key(VALUE obj, VALUE keystr)
{
@@ -596,6 +888,13 @@ fsdbm_has_key(VALUE obj, VALUE keystr)
return Qfalse;
}
+/*
+ * call-seq:
+ * sdbm.value?(key) -> true or false
+ * sdbm.has_value?(key) -> true or false
+ *
+ * Returns +true+ if the database contains the given +value+.
+ */
static VALUE
fsdbm_has_value(VALUE obj, VALUE valstr)
{
@@ -617,6 +916,22 @@ fsdbm_has_value(VALUE obj, VALUE valstr)
return Qfalse;
}
+/*
+ * call-seq:
+ * sdbm.to_a -> Array
+ *
+ * Returns a new Array containing each key-value pair in the database.
+ *
+ * Example:
+ *
+ * require 'sdbm'
+ *
+ * SDBM.open 'my_database' do |db|
+ * db.update('apple' => 'fruit', 'spinach' => 'vegetable')
+ *
+ * db.to_a #=> [["apple", "fruit"], ["spinach", "vegetable"]]
+ * end
+ */
static VALUE
fsdbm_to_a(VALUE obj)
{
@@ -636,6 +951,12 @@ fsdbm_to_a(VALUE obj)
return ary;
}
+/*
+ * call-seq:
+ * sdbm.to_hash -> Hash
+ *
+ * Returns a new Hash containing each key-value pair in the database.
+ */
static VALUE
fsdbm_to_hash(VALUE obj)
{
@@ -655,6 +976,14 @@ fsdbm_to_hash(VALUE obj)
return hash;
}
+/*
+ * call-seq:
+ * sdbm.reject { |key, value| ... } -> Hash
+ *
+ * Creates a new Hash using the key-value pairs from the database, then
+ * calls Hash#reject with the given block, which returns a Hash with
+ * only the key-value pairs for which the block returns +false+.
+ */
static VALUE
fsdbm_reject(VALUE obj)
{
@@ -666,6 +995,9 @@ Init_sdbm()
{
rb_cDBM = rb_define_class("SDBM", rb_cObject);
rb_eDBMError = rb_define_class("SDBMError", rb_eStandardError);
+ /* Document-class: SDBMError
+ * Exception class used to return errors from the sdbm library.
+ */
rb_include_module(rb_cDBM, rb_mEnumerable);
rb_define_alloc_func(rb_cDBM, fsdbm_alloc);
@@ -701,11 +1033,11 @@ Init_sdbm()
rb_define_method(rb_cDBM,"update", fsdbm_update, 1);
rb_define_method(rb_cDBM,"replace", fsdbm_replace, 1);
- rb_define_method(rb_cDBM, "include?", fsdbm_has_key, 1);
rb_define_method(rb_cDBM, "has_key?", fsdbm_has_key, 1);
+ rb_define_method(rb_cDBM, "include?", fsdbm_has_key, 1);
+ rb_define_method(rb_cDBM, "key?", fsdbm_has_key, 1);
rb_define_method(rb_cDBM, "member?", fsdbm_has_key, 1);
rb_define_method(rb_cDBM, "has_value?", fsdbm_has_value, 1);
- rb_define_method(rb_cDBM, "key?", fsdbm_has_key, 1);
rb_define_method(rb_cDBM, "value?", fsdbm_has_value, 1);
rb_define_method(rb_cDBM, "to_a", fsdbm_to_a, 0);
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 c01a1c272a..9a68a0c289 100644
--- a/ext/socket/ancdata.c
+++ b/ext/socket/ancdata.c
@@ -2,7 +2,7 @@
#include <time.h>
-#if defined(HAVE_ST_MSG_CONTROL)
+#if defined(HAVE_STRUCT_MSGHDR_MSG_CONTROL)
static VALUE rb_cAncillaryData;
static VALUE
@@ -86,8 +86,7 @@ ancillary_initialize(VALUE self, VALUE vfamily, VALUE vlevel, VALUE vtype, VALUE
static VALUE
ancdata_new(int family, int level, int type, VALUE data)
{
- NEWOBJ(obj, struct RObject);
- OBJSETUP(obj, rb_cAncillaryData, T_OBJECT);
+ NEWOBJ_OF(obj, struct RObject, rb_cAncillaryData, T_OBJECT);
StringValue(data);
ancillary_initialize((VALUE)obj, INT2NUM(family), INT2NUM(level), INT2NUM(type), data);
return (VALUE)obj;
@@ -196,7 +195,7 @@ ancillary_s_unix_rights(int argc, VALUE *argv, VALUE klass)
for (i = 0 ; i < argc; i++) {
VALUE obj = argv[i];
- if (TYPE(obj) != T_FILE) {
+ if (!RB_TYPE_P(obj, T_FILE)) {
rb_raise(rb_eTypeError, "IO expected");
}
rb_ary_push(ary, obj);
@@ -277,8 +276,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|
@@ -574,9 +573,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;
@@ -1055,7 +1052,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
}
@@ -1110,11 +1107,11 @@ struct sendmsg_args_struct {
int flags;
};
-static VALUE
+static void *
nogvl_sendmsg_func(void *ptr)
{
struct sendmsg_args_struct *args = ptr;
- return sendmsg(args->fd, args->msg, args->flags);
+ return (void *)(VALUE)sendmsg(args->fd, args->msg, args->flags);
}
static ssize_t
@@ -1124,7 +1121,7 @@ rb_sendmsg(int fd, const struct msghdr *msg, int flags)
args.fd = fd;
args.msg = msg;
args.flags = flags;
- return rb_thread_blocking_region(nogvl_sendmsg_func, &args, RUBY_UBF_IO, 0);
+ return (ssize_t)rb_thread_call_without_gvl(nogvl_sendmsg_func, &args, RUBY_UBF_IO, 0);
}
static VALUE
@@ -1132,40 +1129,44 @@ 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__)
int last_level = 0;
int last_type = 0;
+#endif
controls_str = rb_str_tmp_new(0);
for (i = 0; i < controls_num; i++) {
VALUE elt = controls_ptr[i], v;
@@ -1204,8 +1205,10 @@ bsock_sendmsg_internal(int argc, VALUE *argv, VALUE sock, int nonblock)
cmh.cmsg_len = (socklen_t)CMSG_LEN(RSTRING_LEN(cdata));
MEMCPY(cmsg, &cmh, char, sizeof(cmh));
MEMCPY(cmsg+((char*)CMSG_DATA(&cmh)-(char*)&cmh), RSTRING_PTR(cdata), char, RSTRING_LEN(cdata));
+#if defined(__NetBSD__)
last_level = cmh.cmsg_level;
last_type = cmh.cmsg_type;
+#endif
last_pad = cspace - cmh.cmsg_len;
}
if (last_pad) {
@@ -1254,16 +1257,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;
@@ -1284,7 +1287,7 @@ bsock_sendmsg_internal(int argc, VALUE *argv, VALUE sock, int nonblock)
if (ss == -1) {
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)");
}
@@ -1358,11 +1361,28 @@ struct recvmsg_args_struct {
int flags;
};
-static VALUE
+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
+ len0 = message->msg_namelen;
+ ret = recvmsg(socket, message, flags);
+ if (ret != -1 && len0 < message->msg_namelen)
+ message->msg_namelen = len0;
+ return ret;
+}
+
+static void *
nogvl_recvmsg_func(void *ptr)
{
struct recvmsg_args_struct *args = ptr;
- return recvmsg(args->fd, args->msg, args->flags);
+ int flags = args->flags;
+ return (void *)rsock_recvmsg(args->fd, args->msg, flags);
}
static ssize_t
@@ -1372,10 +1392,10 @@ rb_recvmsg(int fd, struct msghdr *msg, int flags)
args.fd = fd;
args.msg = msg;
args.flags = flags;
- return rb_thread_blocking_region(nogvl_recvmsg_func, &args, RUBY_UBF_IO, 0);
+ 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)
{
@@ -1384,7 +1404,7 @@ discard_cmsg(struct cmsghdr *cmh, char *msg_end, int msg_peek_p)
* FreeBSD 8.2.0, NetBSD 5 and MacOS X Snow Leopard doesn't
* allocate fds by recvmsg with MSG_PEEK.
* [ruby-dev:44189]
- * http://redmine.ruby-lang.org/issues/5075
+ * http://bugs.ruby-lang.org/issues/5075
*
* Linux 2.6.38 allocate fds by recvmsg with MSG_PEEK.
*/
@@ -1396,7 +1416,7 @@ discard_cmsg(struct cmsghdr *cmh, char *msg_end, int msg_peek_p)
int *end = (int *)((char *)cmh + cmh->cmsg_len);
while ((char *)fdp + sizeof(int) <= (char *)end &&
(char *)fdp + sizeof(int) <= msg_end) {
- rb_update_max_fd(*fdp);
+ rb_fd_fix_cloexec(*fdp);
close(*fdp);
fdp++;
}
@@ -1407,7 +1427,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;
@@ -1422,7 +1442,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)
{
@@ -1439,7 +1459,7 @@ make_io_for_unix_rights(VALUE ctl, struct cmsghdr *cmh, char *msg_end)
VALUE io;
if (fstat(fd, &stbuf) == -1)
rb_raise(rb_eSocket, "invalid fd in SCM_RIGHTS");
- rb_update_max_fd(fd);
+ rb_fd_fix_cloexec(fd);
if (S_ISSOCK(stbuf.st_mode))
io = rsock_init_sock(rb_obj_alloc(rb_cSocket), fd);
else
@@ -1457,19 +1477,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 {
@@ -1482,16 +1503,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 && TYPE(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))
@@ -1509,13 +1525,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);
@@ -1538,7 +1558,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 {
@@ -1553,7 +1573,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;
@@ -1561,7 +1581,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
@@ -1582,8 +1602,8 @@ bsock_recvmsg_internal(int argc, VALUE *argv, VALUE sock, int nonblock)
if (ss == -1) {
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:
@@ -1602,7 +1622,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");
@@ -1612,7 +1632,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) {
@@ -1655,19 +1675,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;
@@ -1777,7 +1797,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 6f942e3a55..bce085b632 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(NIL_P(path) ? 0 : RSTRING_PTR(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 {
@@ -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 ab0a5e81b3..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 \
+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 5c29876a4b..f3be5862f0 100644
--- a/ext/socket/extconf.rb
+++ b/ext/socket/extconf.rb
@@ -1,136 +1,127 @@
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")
- $defs << "-DHAVE_SOCKETPAIR"
-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 = /mswin|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>
#endif
int
-main()
+main(void)
{
socket(AF_INET6, SOCK_STREAM, 0);
+ return 0;
}
EOF
- $defs << "-DENABLE_IPV6" << "-DINET6"
- ipv6 = true
- end
-end
-if ipv6
- if $mingw
- $CPPFLAGS << " -D_WIN32_WINNT=0x501"
- 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 (aitop)
+ freeaddrinfo(aitop);
+ return EXIT_SUCCESS;
-if checking_for("recvmsg() with MSG_PEEK allocate file descriptors") {try_run(cpp_include(headers) + <<'EOF')}
+ 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,166 @@ 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()
-{
- 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/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
- 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);
- exit(EXIT_SUCCESS);
+have_type("struct sockaddr_storage", headers)
- bad:
- if (aitop)
- freeaddrinfo(aitop);
- exit(EXIT_FAILURE);
-}
-EOF
-if ipv6 and not getaddr_info_ok
- abort <<EOS
+have_type("struct addrinfo", headers)
-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
+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
-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
+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"
+}
-Fatal: invalid value for --with-lookup-order-hack (expected INET, INET6 or UNSPEC)
-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)
+
+case RUBY_PLATFORM
+when /mswin(32|64)|mingw/
+ test_func = "WSACleanup"
+ have_library("ws2_32", "WSACleanup", headers)
+when /cygwin/
+ test_func = "socket(0,0,0)"
+when /beos/
+ test_func = "socket(0,0,0)"
+ have_library("net", "socket(0,0,0)", headers)
+when /haiku/
+ test_func = "socket(0,0,0)"
+ have_library("network", "socket(0,0,0)", headers)
+when /i386-os2_emx/
+ test_func = "socket(0,0,0)"
+ have_library("socket", "socket(0,0,0)", headers)
+else
+ test_func = "socket(0,0,0)"
+ have_library("nsl", 't_open("", 0, (struct t_info *)NULL)', headers) # SunOS
+ 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,97 +409,196 @@ conftest_gai_strerror_is_const()
*gai_strerror(0) = 0;
}
EOF
- $defs << "-DGAI_STRERROR_CONST"
+ $defs << "-DGAI_STRERROR_CONST"
+ end
end
-end
-$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"
+ have_func("accept4", headers)
+
+ 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_func("getpeereid", headers)
+
+ have_func("getpeerucred(0, (ucred_t **)NULL)", headers) # SunOS
+
+ 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 ipv6 == "kame" && have_struct_member("struct in6_addr", "s6_addr32", headers)
- $defs[-1] = "-DFAITH"
+ 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
- $CPPFLAGS="-I. "+$CPPFLAGS
- $objs += ["getaddrinfo.#{$OBJEXT}"]
- $objs += ["getnameinfo.#{$OBJEXT}"]
- $defs << "-DGETADDRINFO_EMU"
-end
-
-have_func("inet_ntop") or have_func("inet_ntoa")
-have_func("inet_pton") or have_func("inet_aton")
-have_func("getservbyport")
-have_header("arpa/nameser.h")
-have_header("resolv.h")
-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("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_header("sys/param.h", headers)
-have_header("sys/ucred.h", 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
-unless have_type("socklen_t", headers)
- $defs << "-Dsocklen_t=int"
-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 have_library("inet6")
+ "inet6"
+ end
+ end or not ipv6lib or abort <<EOS
-have_header("sys/un.h")
-have_header("sys/uio.h")
-have_type("struct in_pktinfo", headers) {|src|
- src.sub(%r'^/\*top\*/', '\1'"\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\*/', '\1'"\n#if defined(IPPROTO_IPV6) && defined(IPV6_PKTINFO)") <<
- "#else\n" << "#error\n" << ">>>>>> no in6_pktinfo <<<<<<\n" << "#endif\n"
-}
+Fatal: no #{ipv6lib} library found. cannot continue.
+You need to fetch lib#{ipv6lib}.a from appropriate
+ipv6 kit and compile beforehand.
+EOS
+ end
-have_type("struct sockcred", headers)
-have_type("struct cmsgcred", headers)
+ 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("getpeereid")
+ 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_header("ucred.h", headers)
-have_func("getpeerucred")
+ 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
-have_func("if_indextoname")
+ if ipv6 and not getaddr_info_ok
+ abort <<EOS
-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
+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
-# workaround for recent Windows SDK
-$defs << "-DIPPROTO_IPV6=IPPROTO_IPV6" if $defs.include?("-DHAVE_CONST_IPPROTO_IPV6") && !have_macro("IPPROTO_IPV6")
+ 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
-$distcleanfiles << "constants.h" << "constdefs.*"
+Fatal: invalid value for --with-lookup-order-hack (expected INET, INET6 or UNSPEC)
+EOS
+ end
-if have_func(test_func)
- have_func("hsterror")
- have_func("getipnodebyname") or have_func("gethostbyname2")
- have_func("socketpair") unless $defs.include?("-DHAVE_SOCKETPAIR")
- unless have_func("gethostname")
- 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"
@@ -497,5 +606,30 @@ 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>
+int t(struct in6_addr *addr) {return IN6_IS_ADDR_UNSPECIFIED(addr);}
+SRC
+ print "fixing apple's netinet6/in6.rb ..."; $stdout.flush
+ in6 = File.read("/usr/include/#{hdr}")
+ if in6.gsub!(/\*\(const\s+__uint32_t\s+\*\)\(const\s+void\s+\*\)\(&(\(\w+\))->s6_addr\[(\d+)\]\)/) do
+ i, r = $2.to_i.divmod(4)
+ if r.zero?
+ "#$1->__u6_addr.__u6_addr32[#{i}]"
+ else
+ $&
+ end
+ end
+ FileUtils.mkdir_p(File.dirname(hdr))
+ open(hdr, "w") {|f| f.write(in6)}
+ $distcleanfiles << hdr
+ $distcleandirs << File.dirname(hdr)
+ puts "done"
+ else
+ puts "not needed"
+ end
+ end
create_makefile("socket")
end
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..16cd47be5a
--- /dev/null
+++ b/ext/socket/ifaddr.c
@@ -0,0 +1,457 @@
+#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,},
+};
+
+#define IS_IFADDRS(obj) rb_typeddata_is_kind_of((obj), &ifaddr_type)
+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_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 54452e4b99..6d98a66d6e 100644
--- a/ext/socket/init.c
+++ b/ext/socket/init.c
@@ -47,11 +47,12 @@ 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");
#else
+ rb_update_max_fd(fd);
if (!rb_w32_is_socket(fd))
rb_raise(rb_eArgError, "not a socket file descriptor");
#endif
@@ -90,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
@@ -126,7 +132,7 @@ 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),
@@ -139,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);
}
@@ -154,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");
}
@@ -174,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);
@@ -204,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) {
@@ -212,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)");
}
@@ -226,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:
@@ -239,17 +249,49 @@ rsock_s_recvfrom_nonblock(VALUE sock, int argc, VALUE *argv, enum sock_recv_type
return rb_assoc_new(str, addr);
}
+static int
+rsock_socket0(int domain, int type, int proto)
+{
+ int ret;
+
+#ifdef SOCK_CLOEXEC
+ static int try_sock_cloexec = 1;
+ if (try_sock_cloexec) {
+ ret = socket(domain, type|SOCK_CLOEXEC, proto);
+ 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;
+ }
+ }
+ }
+ else {
+ ret = socket(domain, type, proto);
+ }
+#else
+ ret = socket(domain, type, proto);
+#endif
+ if (ret == -1)
+ return -1;
+
+ rb_fd_fix_cloexec(ret);
+
+ return ret;
+
+}
+
int
rsock_socket(int domain, int type, int proto)
{
int fd;
- fd = socket(domain, type, proto);
+ fd = rsock_socket0(domain, type, proto);
if (fd < 0) {
- if (errno == EMFILE || errno == ENFILE) {
- rb_gc();
- fd = socket(domain, type, proto);
- }
+ if (errno == EMFILE || errno == ENFILE) {
+ rb_gc();
+ fd = rsock_socket0(domain, type, proto);
+ }
}
if (0 <= fd)
rb_update_max_fd(fd);
@@ -433,26 +475,62 @@ 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)");
+ }
+}
+
+static int
+cloexec_accept(int socket, struct sockaddr *address, socklen_t *address_len)
+{
+ int ret;
+ socklen_t len0 = 0;
+#ifdef HAVE_ACCEPT4
+ static int try_accept4 = 1;
+#endif
+ if (address_len) len0 = *address_len;
+#ifdef HAVE_ACCEPT4
+ if (try_accept4) {
+ int flags = 0;
+#ifdef SOCK_CLOEXEC
+ flags |= SOCK_CLOEXEC;
+#endif
+ ret = accept4(socket, address, address_len, flags);
+ /* accept4 is available since Linux 2.6.28, glibc 2.10. */
+ if (ret != -1) {
+ if (ret <= 2)
+ rb_maygvl_fd_fix_cloexec(ret);
+ if (address_len && len0 < *address_len) *address_len = len0;
+ return ret;
+ }
+ if (errno != ENOSYS) {
+ return -1;
+ }
+ try_accept4 = 0;
}
+#endif
+ ret = accept(socket, address, address_len);
+ if (ret == -1) return -1;
+ if (address_len && len0 < *address_len) *address_len = len0;
+ rb_maygvl_fd_fix_cloexec(ret);
+ return ret;
}
+
VALUE
rsock_s_accept_nonblock(VALUE klass, rb_io_t *fptr, struct sockaddr *sockaddr, socklen_t *len)
{
int fd2;
- socklen_t len0 = len ? *len : 0;
rb_secure(3);
rb_io_set_nonblock(fptr);
- fd2 = accept(fptr->fd, (struct sockaddr*)sockaddr, len);
+ fd2 = cloexec_accept(fptr->fd, (struct sockaddr*)sockaddr, len);
if (fd2 < 0) {
switch (errno) {
case EAGAIN:
@@ -463,11 +541,10 @@ 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)");
}
- if (len && len0 < *len) *len = len0;
rb_update_max_fd(fd2);
make_fd_nonblock(fd2);
return rsock_init_sock(rb_obj_alloc(klass), fd2);
@@ -483,12 +560,7 @@ static VALUE
accept_blocking(void *data)
{
struct accept_arg *arg = data;
- int ret;
- socklen_t len0 = 0;
- if (arg->len) len0 = *arg->len;
- ret = accept(arg->fd, arg->sockaddr, arg->len);
- if (arg->len && len0 < *arg->len) *arg->len = len0;
- return (VALUE)ret;
+ return (VALUE)cloexec_accept(arg->fd, arg->sockaddr, arg->len);
}
VALUE
@@ -518,7 +590,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);
@@ -528,14 +600,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
@@ -555,5 +627,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 2217fffc9d..7b198bd154 100644
--- a/ext/socket/ipsocket.c
+++ b/ext/socket/ipsocket.c
@@ -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,
@@ -62,6 +62,20 @@ init_inetsock_internal(struct inetsock_arg *arg)
if (res->ai_family == AF_INET6)
continue;
#endif
+ lres = NULL;
+ if (arg->local.res) {
+ for (lres = arg->local.res; 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;
+ }
+ }
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,13 +114,23 @@ 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;
if (type == INET_SERVER) {
- status = listen(fd, 5);
+ status = listen(fd, SOMAXCONN);
if (status < 0) {
close(fd);
rb_sys_fail("listen(2)");
@@ -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);
}
/*
@@ -214,7 +239,7 @@ ip_addr(int argc, VALUE *argv, VALUE sock)
*
* TCPSocket.open("www.ruby-lang.org", 80) {|sock|
* p sock.peeraddr #=> ["AF_INET", 80, "carbon.ruby-lang.org", "221.186.184.68"]
- * p sock.peeraddr(true) #=> ["AF_INET", 80, "221.186.184.68", "221.186.184.68"]
+ * p sock.peeraddr(true) #=> ["AF_INET", 80, "carbon.ruby-lang.org", "221.186.184.68"]
* p sock.peeraddr(false) #=> ["AF_INET", 80, "221.186.184.68", "221.186.184.68"]
* p sock.peeraddr(:hostname) #=> ["AF_INET", 80, "carbon.ruby-lang.org", "221.186.184.68"]
* p sock.peeraddr(:numeric) #=> ["AF_INET", 80, "221.186.184.68", "221.186.184.68"]
@@ -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,14 @@ ip_recvfrom(int argc, VALUE *argv, VALUE sock)
static VALUE
ip_s_getaddress(VALUE obj, VALUE host)
{
- struct sockaddr_storage addr;
+ union_sockaddr addr;
struct addrinfo *res = rsock_addrinfo(host, Qnil, SOCK_STREAM, 0);
/* just take the first one */
memcpy(&addr, res->ai_addr, res->ai_addrlen);
freeaddrinfo(res);
- return rsock_make_ipaddr((struct sockaddr*)&addr);
+ return rsock_make_ipaddr(&addr.addr, res->ai_addrlen);
}
void
diff --git a/ext/socket/lib/socket.rb b/ext/socket/lib/socket.rb
index 66ff548270..07c9c4e6ba 100644
--- a/ext/socket/lib/socket.rb
+++ b/ext/socket/lib/socket.rb
@@ -16,6 +16,12 @@ class Addrinfo
raise ArgumentError, "no address specified"
elsif Addrinfo === args.first
raise ArgumentError, "too many arguments" if args.length != 1
+ addrinfo = args.first
+ if (self.pfamily != addrinfo.pfamily) ||
+ (self.socktype != addrinfo.socktype)
+ raise ArgumentError, "Addrinfo type mismatch"
+ end
+ addrinfo
elsif self.ip?
raise ArgumentError, "IP address needs host and port but #{args.length} arguments given" if args.length != 2
host, port = args
@@ -31,16 +37,33 @@ class Addrinfo
# creates a new Socket connected to the address of +local_addrinfo+.
#
- # If no arguments are given, the address of the socket is not bound.
+ # If _local_addrinfo_ is nil, the address of the socket is not bound.
+ #
+ # The _timeout_ specify the seconds for timeout.
+ # Errno::ETIMEDOUT is raised when timeout occur.
#
# If a block is given the created socket is yielded for each address.
#
- def connect_internal(local_addrinfo) # :yields: socket
+ def connect_internal(local_addrinfo, timeout=nil) # :yields: socket
sock = Socket.new(self.pfamily, self.socktype, self.protocol)
begin
sock.ipv6only! if self.ipv6?
sock.bind local_addrinfo if local_addrinfo
- sock.connect(self)
+ if timeout
+ begin
+ sock.connect_nonblock(self)
+ rescue IO::WaitWritable
+ if !IO.select(nil, [sock], nil, timeout)
+ raise Errno::ETIMEDOUT, 'user specified timeout'
+ end
+ begin
+ sock.connect_nonblock(self) # check connection failure
+ rescue Errno::EISCONN
+ end
+ end
+ else
+ sock.connect(self)
+ end
if block_given?
yield sock
else
@@ -52,13 +75,22 @@ class Addrinfo
end
private :connect_internal
+ # :call-seq:
+ # addrinfo.connect_from([local_addr_args], [opts]) {|socket| ... }
+ # addrinfo.connect_from([local_addr_args], [opts])
+ #
# creates a socket connected to the address of self.
#
# If one or more arguments given as _local_addr_args_,
# it is used as the local address of the socket.
# _local_addr_args_ is given for family_addrinfo to obtain actual address.
#
- # If no arguments given, the local address of the socket is not bound.
+ # If _local_addr_args_ is not given, the local address of the socket is not bound.
+ #
+ # The optional last argument _opts_ is options represented by a hash.
+ # _opts_ may have following options:
+ #
+ # [:timeout] specify the timeout in seconds.
#
# If a block is given, it is called with the socket and the value of the block is returned.
# The socket is returned otherwise.
@@ -74,12 +106,23 @@ class Addrinfo
# puts s.read
# }
#
- def connect_from(*local_addr_args, &block)
- connect_internal(family_addrinfo(*local_addr_args), &block)
+ def connect_from(*args, &block)
+ opts = Hash === args.last ? args.pop : {}
+ local_addr_args = args
+ connect_internal(family_addrinfo(*local_addr_args), opts[:timeout], &block)
end
+ # :call-seq:
+ # addrinfo.connect([opts]) {|socket| ... }
+ # addrinfo.connect([opts])
+ #
# creates a socket connected to the address of self.
#
+ # The optional argument _opts_ is options represented by a hash.
+ # _opts_ may have following options:
+ #
+ # [:timeout] specify the timeout in seconds.
+ #
# If a block is given, it is called with the socket and the value of the block is returned.
# The socket is returned otherwise.
#
@@ -88,12 +131,21 @@ class Addrinfo
# puts s.read
# }
#
- def connect(&block)
- connect_internal(nil, &block)
+ def connect(opts={}, &block)
+ connect_internal(nil, opts[:timeout], &block)
end
+ # :call-seq:
+ # addrinfo.connect_to([remote_addr_args], [opts]) {|socket| ... }
+ # addrinfo.connect_to([remote_addr_args], [opts])
+ #
# creates a socket connected to _remote_addr_args_ and bound to self.
#
+ # The optional last argument _opts_ is options represented by a hash.
+ # _opts_ may have following options:
+ #
+ # [:timeout] specify the timeout in seconds.
+ #
# If a block is given, it is called with the socket and the value of the block is returned.
# The socket is returned otherwise.
#
@@ -102,9 +154,11 @@ class Addrinfo
# puts s.read
# }
#
- def connect_to(*remote_addr_args, &block)
+ def connect_to(*args, &block)
+ opts = Hash === args.last ? args.pop : {}
+ remote_addr_args = args
remote_addrinfo = family_addrinfo(*remote_addr_args)
- remote_addrinfo.send(:connect_internal, self, &block)
+ remote_addrinfo.send(:connect_internal, self, opts[:timeout], &block)
end
# creates a socket bound to self.
@@ -134,7 +188,7 @@ class Addrinfo
end
# creates a listening socket bound to self.
- def listen(backlog=5)
+ def listen(backlog=Socket::SOMAXCONN)
sock = Socket.new(self.pfamily, self.socktype, self.protocol)
begin
sock.ipv6only! if self.ipv6?
@@ -216,11 +270,20 @@ class Socket < BasicSocket
end
end
+ # :call-seq:
+ # Socket.tcp(host, port, local_host=nil, local_port=nil, [opts]) {|socket| ... }
+ # Socket.tcp(host, port, local_host=nil, local_port=nil, [opts])
+ #
# creates a new socket object connected to host:port using TCP/IP.
#
# If local_host:local_port is given,
# the socket is bound to it.
#
+ # The optional last argument _opts_ is options represented by a hash.
+ # _opts_ may have following options:
+ #
+ # [:connect_timeout] specify the timeout in seconds.
+ #
# If a block is given, the block is called with the socket.
# The value of the block is returned.
# The socket is closed when this method returns.
@@ -233,10 +296,15 @@ class Socket < BasicSocket
# puts sock.read
# }
#
- def self.tcp(host, port, local_host=nil, local_port=nil) # :yield: socket
+ def self.tcp(host, port, *rest) # :yield: socket
+ opts = Hash === rest.last ? rest.pop : {}
+ raise ArgumentError, "wrong number of arguments (#{rest.length} for 2)" if 2 < rest.length
+ local_host, local_port = rest
last_error = nil
ret = nil
+ connect_timeout = opts[:connect_timeout]
+
local_addr_list = nil
if local_host != nil || local_port != nil
local_addr_list = Addrinfo.getaddrinfo(local_host, local_port, nil, :STREAM, nil)
@@ -250,7 +318,9 @@ class Socket < BasicSocket
local_addr = nil
end
begin
- sock = local_addr ? ai.connect_from(local_addr) : ai.connect
+ sock = local_addr ?
+ ai.connect_from(local_addr, :timeout => connect_timeout) :
+ ai.connect(:timeout => connect_timeout)
rescue SystemCallError
last_error = $!
next
@@ -317,7 +387,7 @@ class Socket < BasicSocket
ai_list = Addrinfo.getaddrinfo(host, 0, nil, :STREAM, nil, Socket::AI_PASSIVE)
sockets = ip_sockets_port0(ai_list, true)
sockets.each {|s|
- s.listen(5)
+ s.listen(Socket::SOMAXCONN)
}
sockets
ensure
@@ -338,7 +408,7 @@ class Socket < BasicSocket
# The value of the block is returned.
# The socket is closed when this method returns.
#
- # If _port_ is 0, actual port number is choosen dynamically.
+ # If _port_ is 0, actual port number is chosen dynamically.
# However all sockets in the result has same port number.
#
# # tcp_server_sockets returns two sockets.
@@ -350,7 +420,7 @@ class Socket < BasicSocket
# #=> #<Addrinfo: [::]:1296 TCP>
# # #<Addrinfo: 0.0.0.0:1296 TCP>
#
- # # IPv6 and IPv4 socket has same port number, 53114, even if it is choosen dynamically.
+ # # IPv6 and IPv4 socket has same port number, 53114, even if it is chosen dynamically.
# sockets = Socket.tcp_server_sockets(0)
# sockets.each {|s| p s.local_address }
# #=> #<Addrinfo: [::]:53114 TCP>
@@ -480,8 +550,8 @@ class Socket < BasicSocket
# The value of the block is returned.
# The sockets are closed when this method returns.
#
- # If _port_ is zero, some port is choosen.
- # But the choosen port is used for the all sockets.
+ # If _port_ is zero, some port is chosen.
+ # But the chosen port is used for the all sockets.
#
# # UDP/IP echo server
# Socket.udp_server_sockets(0) {|sockets|
@@ -643,9 +713,9 @@ class Socket < BasicSocket
# UDP/IP address information used by Socket.udp_server_loop.
class UDPSource
- # +remote_adress+ is an Addrinfo object.
+ # +remote_address+ is an Addrinfo object.
#
- # +local_adress+ is an Addrinfo object.
+ # +local_address+ is an Addrinfo object.
#
# +reply_proc+ is a Proc used to send reply back to the source.
def initialize(remote_address, local_address, &reply_proc)
diff --git a/ext/socket/mkconstants.rb b/ext/socket/mkconstants.rb
index ae28630179..d12b2a24e3 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
@@ -615,6 +623,7 @@ 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
+TCP_FASTOPEN nil Reduce step of the handshake process
UDP_CORK nil Don't send partial frames
@@ -690,7 +699,7 @@ INET6_ADDRSTRLEN 46 Maximum length of an IPv6 address string
IFNAMSIZ nil Maximum interface name size
IF_NAMESIZE nil Maximum interface name size
-SOMAXCONN nil Maximum connection requests that may be queued for a socket
+SOMAXCONN 5 Maximum connection requests that may be queued for a socket
SCM_RIGHTS nil Access rights
SCM_TIMESTAMP nil Timestamp (timeval)
@@ -703,3 +712,62 @@ SCM_UCRED nil User credentials
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 1f334bbca0..3e32230aab 100644
--- a/ext/socket/option.c
+++ b/ext/socket/option.c
@@ -21,7 +21,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
@@ -61,8 +61,7 @@ sockopt_initialize(VALUE self, VALUE vfamily, VALUE vlevel, VALUE voptname, VALU
VALUE
rsock_sockopt_new(int family, int level, int optname, VALUE data)
{
- NEWOBJ(obj, struct RObject);
- OBJSETUP(obj, rb_cSockOpt, T_OBJECT);
+ NEWOBJ_OF(obj, struct RObject, rb_cSockOpt, T_OBJECT);
StringValue(data);
sockopt_initialize((VALUE)obj, INT2NUM(family), INT2NUM(level), INT2NUM(optname), data);
return (VALUE)obj;
@@ -128,6 +127,7 @@ sockopt_optname_m(VALUE self)
/*
* call-seq:
* sockopt.data => string
+ * sockopt.to_s => string
*
* returns the socket option data as a string.
*
@@ -144,6 +144,50 @@ 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.
+ *
+ * The size and endian is dependent on the platform.
+ *
+ * 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);
+ unsigned char i = (unsigned char)NUM2CHR(vint);
+ return rsock_sockopt_new(family, level, optname, rb_str_new((char*)&i, sizeof(i)));
+}
+
+/*
+ * call-seq:
+ * sockopt.byte => integer
+ *
+ * Returns the data in _sockopt_ as an byte.
+ *
+ * The size and endian is dependent on the platform.
+ *
+ * sockopt = Socket::Option.byte(:INET, :SOCKET, :KEEPALIVE, 1)
+ * p sockopt.byte => 1
+ */
+static VALUE
+sockopt_byte(VALUE self)
+{
+ unsigned char i;
+ VALUE data = sockopt_data(self);
+ StringValue(data);
+ 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.
@@ -294,6 +338,135 @@ 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)
+# ifdef __NetBSD__
+ unsigned char i = NUM2CHR(rb_to_int(value));
+# else
+ int i = NUM2INT(rb_to_int(value));
+# endif
+ return rsock_sockopt_new(AF_INET, IPPROTO_IP, IP_MULTICAST_LOOP,
+ rb_str_new((char*)&i, sizeof(i)));
+#else
+# error IPPROTO_IP or IP_MULTICAST_LOOP is not implemented
+#endif
+}
+
+/*
+ * 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) {
+# ifdef __NetBSD__
+ return sockopt_byte(self);
+# else
+ return sockopt_int(self);
+# endif
+ }
+#endif
+ rb_raise(rb_eTypeError, "ipv4_multicast_loop socket option expected");
+ UNREACHABLE;
+}
+
+#ifdef __NetBSD__
+# define inspect_ipv4_multicast_loop(a,b,c,d) inspect_byte(a,b,c,d)
+#else
+# define inspect_ipv4_multicast_loop(a,b,c,d) inspect_int(a,b,c,d)
+#endif
+
+/*
+ * call-seq:
+ * 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)
+# ifdef __NetBSD__
+ unsigned char i = NUM2CHR(rb_to_int(value));
+# else
+ int i = NUM2INT(rb_to_int(value));
+# endif
+ return rsock_sockopt_new(AF_INET, IPPROTO_IP, IP_MULTICAST_TTL,
+ rb_str_new((char*)&i, sizeof(i)));
+#else
+# error IPPROTO_IP or IP_MULTICAST_TTL is not implemented
+#endif
+}
+
+/*
+ * 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) {
+# ifdef __NetBSD__
+ return sockopt_byte(self);
+# else
+ return sockopt_int(self);
+# endif
+ }
+#endif
+ rb_raise(rb_eTypeError, "ipv4_multicast_ttl socket option expected");
+ UNREACHABLE;
+}
+
+#ifdef __NetBSD__
+# define inspect_ipv4_multicast_ttl(a,b,c,d) inspect_byte(a,b,c,d)
+#else
+# define inspect_ipv4_multicast_ttl(a,b,c,d) inspect_int(a,b,c,d)
+#endif
+
static int
inspect_int(int level, int optname, VALUE data, VALUE ret)
{
@@ -308,6 +481,20 @@ inspect_int(int level, int optname, VALUE data, VALUE ret)
}
}
+#ifdef __NetBSD__
+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)
{
@@ -437,7 +624,7 @@ inspect_timeval_as_interval(int level, int optname, VALUE data, VALUE ret)
*/
#ifndef HAVE_INET_NTOP
-static char *
+static const char *
inet_ntop(int af, const void *addr, char *numaddr, size_t numaddr_len)
{
#ifdef HAVE_INET_NTOA
@@ -452,6 +639,8 @@ inet_ntop(int af, const void *addr, char *numaddr, size_t numaddr_len)
#endif
return numaddr;
}
+#elif defined __MINGW64__
+# define inet_ntop(f,a,n,l) rb_w32_inet_ntop(f,a,n,l)
#endif
/* Although the buffer size needed depends on the prefixes, "%u" may generate "4294967295". */
@@ -803,6 +992,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
@@ -910,12 +1105,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 80e59a073f..109fcccae8 100644
--- a/ext/socket/raddrinfo.c
+++ b/ext/socket/raddrinfo.c
@@ -154,12 +154,20 @@ struct getaddrinfo_arg
struct addrinfo **res;
};
-static VALUE
+static void *
nogvl_getaddrinfo(void *arg)
{
+ int ret;
struct getaddrinfo_arg *ptr = arg;
- return 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
@@ -178,7 +186,7 @@ rb_getaddrinfo(const char *node, const char *service,
arg.service = service;
arg.hints = hints;
arg.res = res;
- ret = (int)BLOCKING_REGION(nogvl_getaddrinfo, &arg);
+ ret = (int)(VALUE)rb_thread_call_without_gvl(nogvl_getaddrinfo, &arg, RUBY_UBF_IO, 0);
return ret;
#endif
}
@@ -195,14 +203,14 @@ struct getnameinfo_arg
int flags;
};
-static VALUE
+static void *
nogvl_getnameinfo(void *arg)
{
struct getnameinfo_arg *ptr = arg;
- return getnameinfo(ptr->sa, ptr->salen,
- ptr->host, (socklen_t)ptr->hostlen,
- ptr->serv, (socklen_t)ptr->servlen,
- ptr->flags);
+ return (void *)(VALUE)getnameinfo(ptr->sa, ptr->salen,
+ ptr->host, (socklen_t)ptr->hostlen,
+ ptr->serv, (socklen_t)ptr->servlen,
+ ptr->flags);
}
#endif
@@ -223,41 +231,39 @@ rb_getnameinfo(const struct sockaddr *sa, socklen_t salen,
arg.serv = serv;
arg.servlen = servlen;
arg.flags = flags;
- ret = (int)BLOCKING_REGION(nogvl_getnameinfo, &arg);
+ ret = (int)(VALUE)rb_thread_call_without_gvl(nogvl_getnameinfo, &arg, RUBY_UBF_IO, 0);
return ret;
#endif
}
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 +282,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 +290,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 +300,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 +319,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 +336,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));
}
@@ -380,7 +386,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 +405,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 +458,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
@@ -467,7 +475,7 @@ rsock_unix_sockaddr_len(VALUE path)
struct hostent_arg {
VALUE host;
struct addrinfo* addr;
- VALUE (*ipaddr)(struct sockaddr*, size_t);
+ VALUE (*ipaddr)(struct sockaddr*, socklen_t);
};
static VALUE
@@ -475,7 +483,7 @@ make_hostent_internal(struct hostent_arg *arg)
{
VALUE host = arg->host;
struct addrinfo* addr = arg->addr;
- VALUE (*ipaddr)(struct sockaddr*, size_t) = arg->ipaddr;
+ VALUE (*ipaddr)(struct sockaddr*, socklen_t) = arg->ipaddr;
struct addrinfo *ai;
struct hostent *h;
@@ -521,7 +529,7 @@ rsock_freeaddrinfo(struct addrinfo *addr)
}
VALUE
-rsock_make_hostent(VALUE host, struct addrinfo *addr, VALUE (*ipaddr)(struct sockaddr *, size_t))
+rsock_make_hostent(VALUE host, struct addrinfo *addr, VALUE (*ipaddr)(struct sockaddr *, socklen_t))
{
struct hostent_arg arg;
@@ -539,7 +547,7 @@ typedef struct {
int socktype;
int protocol;
socklen_t sockaddr_len;
- struct sockaddr_storage addr;
+ union_sockaddr addr;
} rb_addrinfo_t;
static void
@@ -687,31 +695,32 @@ make_inspectname(VALUE node, VALUE service, struct addrinfo *res)
VALUE inspectname = Qnil;
if (res) {
+ /* drop redundant information which also shown in address:port part. */
char hbuf[NI_MAXHOST], pbuf[NI_MAXSERV];
int ret;
ret = rb_getnameinfo(res->ai_addr, res->ai_addrlen, hbuf,
sizeof(hbuf), pbuf, sizeof(pbuf),
NI_NUMERICHOST|NI_NUMERICSERV);
if (ret == 0) {
- if (TYPE(node) == T_STRING && strcmp(hbuf, RSTRING_PTR(node)) == 0)
+ if (RB_TYPE_P(node, T_STRING) && strcmp(hbuf, RSTRING_PTR(node)) == 0)
node = Qnil;
- if (TYPE(service) == T_STRING && strcmp(pbuf, RSTRING_PTR(service)) == 0)
+ if (RB_TYPE_P(service, T_STRING) && strcmp(pbuf, RSTRING_PTR(service)) == 0)
service = Qnil;
- else if (TYPE(service) == T_FIXNUM && atoi(pbuf) == FIX2INT(service))
+ else if (RB_TYPE_P(service, T_FIXNUM) && atoi(pbuf) == FIX2INT(service))
service = Qnil;
}
}
- if (TYPE(node) == T_STRING) {
+ if (RB_TYPE_P(node, T_STRING)) {
inspectname = rb_str_dup(node);
}
- if (TYPE(service) == T_STRING) {
+ if (RB_TYPE_P(service, T_STRING)) {
if (NIL_P(inspectname))
inspectname = rb_sprintf(":%s", StringValueCStr(service));
else
rb_str_catf(inspectname, ":%s", StringValueCStr(service));
}
- else if (TYPE(service) == T_FIXNUM && FIX2INT(service) != 0)
+ else if (RB_TYPE_P(service, T_FIXNUM) && FIX2INT(service) != 0)
{
if (NIL_P(inspectname))
inspectname = rb_sprintf(":%d", FIX2INT(service));
@@ -798,9 +807,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);
@@ -926,7 +933,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);
@@ -947,41 +954,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;
}
@@ -992,16 +1027,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) {
@@ -1014,8 +1049,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;
}
@@ -1024,10 +1059,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)
@@ -1043,27 +1078,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;
@@ -1080,7 +1258,7 @@ inspect_sockaddr(VALUE addrinfo, VALUE ret)
*
* returns a string which shows addrinfo in human-readable form.
*
- * Addrinfo.tcp("localhost", 80).inspect #=> "#<Addrinfo: 127.0.0.1:80 TCP (localhost:80)>"
+ * Addrinfo.tcp("localhost", 80).inspect #=> "#<Addrinfo: 127.0.0.1:80 TCP (localhost)>"
* Addrinfo.unix("/tmp/sock").inspect #=> "#<Addrinfo: /tmp/sock SOCK_STREAM>"
*
*/
@@ -1164,8 +1342,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));
}
@@ -1218,7 +1396,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;
@@ -1233,7 +1411,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) {
@@ -1254,7 +1432,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;
@@ -1318,8 +1496,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))
@@ -1352,7 +1529,7 @@ addrinfo_mload(VALUE self, VALUE ary)
}
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;
@@ -1454,7 +1631,7 @@ addrinfo_to_sockaddr(VALUE self)
* The canonical name is set by Addrinfo.getaddrinfo when AI_CANONNAME is specified.
*
* list = Addrinfo.getaddrinfo("www.ruby-lang.org", 80, :INET, :STREAM, nil, Socket::AI_CANONNAME)
- * p list[0] #=> #<Addrinfo: 221.186.184.68:80 TCP carbon.ruby-lang.org (www.ruby-lang.org:80)>
+ * p list[0] #=> #<Addrinfo: 221.186.184.68:80 TCP carbon.ruby-lang.org (www.ruby-lang.org)>
* p list[0].canonname #=> "carbon.ruby-lang.org"
*
*/
@@ -1580,7 +1757,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) {
@@ -1671,14 +1848,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
@@ -1695,7 +1872,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;
}
@@ -1751,7 +1928,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;
}
/*
@@ -1815,6 +1992,18 @@ addrinfo_ipv6_sitelocal_p(VALUE self)
}
/*
+ * Returns true for IPv6 unique local address (fc00::/7, RFC4193).
+ * It returns false otherwise.
+ */
+static VALUE
+addrinfo_ipv6_unique_local_p(VALUE self)
+{
+ struct in6_addr *addr = extract_in6_addr(self);
+ if (addr && IN6_IS_ADDR_UNIQUE_LOCAL(addr)) return Qtrue;
+ return Qfalse;
+}
+
+/*
* Returns true for IPv4-mapped IPv6 address (::ffff:0:0/80).
* It returns false otherwise.
*/
@@ -1915,12 +2104,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,
@@ -1953,14 +2140,17 @@ 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;
if (e < s)
- rb_raise(rb_eSocket, "too short AF_UNIX address");
+ rb_raise(rb_eSocket, "too short AF_UNIX address: %"PRIuSIZE" bytes given for minimum %"PRIuSIZE" bytes.",
+ (size_t)rai->sockaddr_len, (size_t)(s - (char *)addr));
if (addr->sun_path + sizeof(addr->sun_path) < e)
- rb_raise(rb_eSocket, "too long AF_UNIX address");
+ rb_raise(rb_eSocket,
+ "too long AF_UNIX path (%"PRIuSIZE" bytes given but %"PRIuSIZE" bytes max)",
+ (size_t)(e - addr->sun_path), sizeof(addr->sun_path));
while (s < e && *(e-1) == '\0')
e--;
return rb_str_new(s, e-s);
@@ -1990,15 +2180,24 @@ addrinfo_unix_path(VALUE self)
*
* Similarly, PF_INET6 as family restricts for IPv6.
*
- * flags should be bitwise OR of Socket::AI_??? constants.
+ * flags should be bitwise OR of Socket::AI_??? constants such as follows.
+ * Note that the exact list of the constants depends on OS.
+ *
+ * AI_PASSIVE Get address to use with bind()
+ * AI_CANONNAME Fill in the canonical name
+ * AI_NUMERICHOST Prevent host name resolution
+ * AI_NUMERICSERV Prevent service name resolution
+ * AI_V4MAPPED Accept IPv4-mapped IPv6 addresses
+ * AI_ALL Allow all addresses
+ * AI_ADDRCONFIG Accept only if any address is assigned
*
* Note that socktype should be specified whenever application knows the usage of the address.
* Some platform causes an error when socktype is omitted and servname is specified as an integer
* because some port numbers, 512 for example, are ambiguous without socktype.
*
* Addrinfo.getaddrinfo("www.kame.net", 80, nil, :STREAM)
- * #=> [#<Addrinfo: 203.178.141.194:80 TCP (www.kame.net:80)>,
- * # #<Addrinfo: [2001:200:0:8002:203:47ff:fea5:3085]:80 TCP (www.kame.net:80)>]
+ * #=> [#<Addrinfo: 203.178.141.194:80 TCP (www.kame.net)>,
+ * # #<Addrinfo: [2001:200:dff:fff1:216:3eff:feb1:44d7]:80 TCP (www.kame.net)>]
*
*/
static VALUE
@@ -2112,6 +2311,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)
{
@@ -2165,6 +2377,8 @@ rsock_io_socket_addrinfo(VALUE io, struct sockaddr *addr, socklen_t len)
default:
rb_raise(rb_eTypeError, "neither IO nor file descriptor");
}
+
+ UNREACHABLE;
}
/*
@@ -2181,7 +2395,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);
@@ -2215,6 +2429,7 @@ rsock_init_addrinfo(void)
rb_define_method(rb_cAddrinfo, "ipv6_multicast?", addrinfo_ipv6_multicast_p, 0);
rb_define_method(rb_cAddrinfo, "ipv6_linklocal?", addrinfo_ipv6_linklocal_p, 0);
rb_define_method(rb_cAddrinfo, "ipv6_sitelocal?", addrinfo_ipv6_sitelocal_p, 0);
+ rb_define_method(rb_cAddrinfo, "ipv6_unique_local?", addrinfo_ipv6_unique_local_p, 0);
rb_define_method(rb_cAddrinfo, "ipv6_v4mapped?", addrinfo_ipv6_v4mapped_p, 0);
rb_define_method(rb_cAddrinfo, "ipv6_v4compat?", addrinfo_ipv6_v4compat_p, 0);
rb_define_method(rb_cAddrinfo, "ipv6_mc_nodelocal?", addrinfo_ipv6_mc_nodelocal_p, 0);
diff --git a/ext/socket/rubysocket.h b/ext/socket/rubysocket.h
index ab05270be6..97c02fc410 100644
--- a/ext/socket/rubysocket.h
+++ b/ext/socket/rubysocket.h
@@ -3,6 +3,7 @@
#include "ruby/ruby.h"
#include "ruby/io.h"
+#include "ruby/thread.h"
#include "ruby/util.h"
#include "internal.h"
#include <stdio.h>
@@ -10,83 +11,119 @@
#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_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
/*
@@ -99,68 +136,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))
#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
-#if defined __APPLE__ && defined __MACH__
+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
@@ -187,12 +245,12 @@ 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"
@@ -202,8 +260,11 @@ int Rconnect();
#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));
@@ -225,10 +286,14 @@ 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 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);
@@ -280,15 +345,17 @@ 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);
+ssize_t rsock_recvmsg(int socket, struct msghdr *message, int flags);
#else
#define rsock_bsock_recvmsg rb_f_notimplement
#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
@@ -304,6 +371,13 @@ 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_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));
+
#endif
diff --git a/ext/socket/socket.c b/ext/socket/socket.c
index bfe2edbc6c..5fd74652c6 100644
--- a/ext/socket/socket.c
+++ b/ext/socket/socket.c
@@ -10,6 +10,76 @@
#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)
+{
+ VALUE message;
+
+ port = rb_String(port);
+
+ message = rb_sprintf("%s for \"%s\" port %s",
+ mesg, StringValueCStr(host), StringValueCStr(port));
+
+ rb_sys_fail_str(message);
+}
+
+void
+rsock_sys_fail_path(const char *mesg, VALUE path)
+{
+ VALUE message;
+ if (RB_TYPE_P(path, T_STRING)) {
+ if (memchr(RSTRING_PTR(path), '\0', RSTRING_LEN(path))) {
+ path = rb_str_inspect(path);
+ message = rb_sprintf("%s for %s", mesg,
+ StringValueCStr(path));
+ }
+ else {
+ message = rb_sprintf("%s for \"%s\"", mesg,
+ StringValueCStr(path));
+ }
+ rb_sys_fail_str(message);
+ }
+ else {
+ rb_sys_fail(mesg);
+ }
+}
+
+void
+rsock_sys_fail_sockaddr(const char *mesg, struct sockaddr *addr, socklen_t len)
+{
+ VALUE rai;
+
+ rai = rsock_addrinfo_new(addr, len, PF_UNSPEC, 0, 0, Qnil, Qnil);
+
+ rsock_sys_fail_raddrinfo(mesg, rai);
+}
+
+void
+rsock_sys_fail_raddrinfo(const char *mesg, VALUE rai)
+{
+ VALUE str, message;
+
+ str = rsock_addrinfo_inspect_sockaddr(rai);
+ message = rb_sprintf("%s for %s", mesg, StringValueCStr(str));
+
+ rb_sys_fail_str(message);
+}
+
+void
+rsock_sys_fail_raddrinfo_or_sockaddr(const char *mesg, VALUE addr, VALUE rai)
+{
+ if (NIL_P(rai)) {
+ StringValue(addr);
+ rsock_sys_fail_sockaddr(mesg,
+ (struct sockaddr *)RSTRING_PTR(addr),
+ (socklen_t)RSTRING_LEN(addr)); /* overflow should be checked already */
+ }
+ else
+ rsock_sys_fail_raddrinfo(mesg, rai);
+}
+
static void
setup_domain_and_type(VALUE domain, int *dv, VALUE type, int *tv)
{
@@ -27,9 +97,8 @@ setup_domain_and_type(VALUE domain, int *dv, VALUE type, int *tv)
*
* _socktype_ should be a socket type such as: :STREAM, :DGRAM, :RAW, etc.
*
- * _protocol_ should be a protocol defined in the domain.
- * This is optional.
- * If it is not given, 0 is used internally.
+ * _protocol_ is optional and should be a protocol defined in the domain.
+ * If protocol is not given, 0 is used internally.
*
* Socket.new(:INET, :STREAM) # TCP socket
* Socket.new(:INET, :DGRAM) # UDP socket
@@ -76,6 +145,59 @@ pair_yield(VALUE pair)
#endif
#if defined HAVE_SOCKETPAIR
+
+static int
+rsock_socketpair0(int domain, int type, int protocol, int sv[2])
+{
+ int ret;
+
+#ifdef SOCK_CLOEXEC
+ static int try_sock_cloexec = 1;
+ if (try_sock_cloexec) {
+ ret = socketpair(domain, type|SOCK_CLOEXEC, protocol, sv);
+ 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) {
+ /* The reason of EINVAL may be other than SOCK_CLOEXEC.
+ * So disable SOCK_CLOEXEC only if socketpair() succeeds without SOCK_CLOEXEC.
+ * Ex. Socket.pair(:UNIX, 0xff) fails with EINVAL.
+ */
+ try_sock_cloexec = 0;
+ }
+ }
+ }
+ else {
+ ret = socketpair(domain, type, protocol, sv);
+ }
+#else
+ ret = socketpair(domain, type, protocol, sv);
+#endif
+
+ if (ret == -1) {
+ return -1;
+ }
+
+ rb_fd_fix_cloexec(sv[0]);
+ rb_fd_fix_cloexec(sv[1]);
+
+ return ret;
+}
+
+static int
+rsock_socketpair(int domain, int type, int protocol, int sv[2])
+{
+ int ret;
+
+ ret = rsock_socketpair0(domain, type, protocol, sv);
+ if (ret < 0 && (errno == EMFILE || errno == ENFILE)) {
+ rb_gc();
+ ret = rsock_socketpair0(domain, type, protocol, sv);
+ }
+
+ return ret;
+}
+
/*
* call-seq:
* Socket.pair(domain, type, protocol) => [socket1, socket2]
@@ -87,8 +209,16 @@ pair_yield(VALUE pair)
*
* _socktype_ should be a socket type such as: :STREAM, :DGRAM, :RAW, etc.
*
- * _protocol_ should be a protocol defined in the domain.
- * 0 is default protocol for the domain.
+ * _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
@@ -111,16 +241,12 @@ rsock_sock_s_socketpair(int argc, VALUE *argv, VALUE klass)
setup_domain_and_type(domain, &d, type, &t);
p = NUM2INT(protocol);
- ret = socketpair(d, t, p, sp);
- if (ret < 0 && (errno == EMFILE || errno == ENFILE)) {
- rb_gc();
- ret = socketpair(d, t, p, sp);
- }
+ ret = rsock_socketpair(d, t, p, sp);
if (ret < 0) {
rb_sys_fail("socketpair(2)");
}
- rb_update_max_fd(sp[0]);
- rb_update_max_fd(sp[1]);
+ 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]);
@@ -136,7 +262,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.
@@ -248,16 +374,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);
@@ -265,7 +392,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.
@@ -308,18 +435,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);
@@ -327,7 +455,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.
*
@@ -414,19 +542,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
@@ -500,7 +629,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)
@@ -511,8 +639,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
@@ -622,8 +750,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.
@@ -707,18 +835,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.
@@ -772,17 +900,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_,
@@ -823,13 +951,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
@@ -854,7 +982,7 @@ sock_gethostname(VALUE obj)
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);
@@ -889,7 +1017,7 @@ make_addrinfo(struct addrinfo *res0, int norevlookup)
}
base = rb_ary_new();
for (res = res0; res; res = res->ai_next) {
- ary = rsock_ipaddr(res->ai_addr, norevlookup);
+ ary = rsock_ipaddr(res->ai_addr, res->ai_addrlen, norevlookup);
if (res->ai_canonname) {
RARRAY_PTR(ary)[2] = rb_str_new2(res->ai_canonname);
}
@@ -902,19 +1030,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:
@@ -968,7 +1096,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;
@@ -1085,8 +1213,8 @@ sock_s_getservbyport(int argc, VALUE *argv)
*
* _socktype_ should be a socket type such as: :STREAM, :DGRAM, :RAW, etc.
*
- * _protocol_ should be a protocol defined in the family.
- * 0 is default protocol for the family.
+ * _protocol_ should be a protocol defined in the family,
+ * and defaults to 0 for the family.
*
* _flags_ should be bitwise OR of Socket::AI_* constants.
*
@@ -1099,8 +1227,7 @@ sock_s_getservbyport(int argc, VALUE *argv)
* # ["AF_INET", 0, "localhost", "127.0.0.1", 2, 3, 0]] # PF_INET/SOCK_RAW/IPPROTO_IP
*
* _reverse_lookup_ directs the form of the third element, and has to
- * be one of below.
- * If it is ommitted, the default value is +nil+.
+ * be one of below. If _reverse_lookup_ is omitted, the default value is +nil+.
*
* +true+, +:hostname+: hostname is obtained from numeric address using reverse lookup, which may take a time.
* +false+, +:numeric+: hostname is same as numeric address.
@@ -1152,7 +1279,8 @@ sock_s_getaddrinfo(int argc, VALUE *argv)
*
* _flags_ should be bitwise OR of Socket::NI_* constants.
*
- * Note that the last form is compatible with IPSocket#{addr,peeraddr}.
+ * Note:
+ * The last form is compatible with IPSocket#addr and IPSocket#peeraddr.
*
* Socket.getnameinfo(Socket.sockaddr_in(80, "127.0.0.1")) #=> ["localhost", "www"]
* Socket.getnameinfo(["AF_INET", 80, "127.0.0.1"]) #=> ["localhost", "www"]
@@ -1169,8 +1297,9 @@ sock_s_getnameinfo(int argc, VALUE *argv)
int fl;
struct addrinfo hints, *res = NULL, *r;
int error;
- struct sockaddr_storage ss;
+ union_sockaddr ss;
struct sockaddr *sap;
+ socklen_t salen;
sa = flags = Qnil;
rb_scan_args(argc, argv, "11", &sa, &flags);
@@ -1186,10 +1315,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);
@@ -1251,13 +1381,14 @@ sock_s_getnameinfo(int argc, VALUE *argv)
error = rb_getaddrinfo(hptr, pptr, &hints, &res);
if (error) goto error_exit_addr;
sap = res->ai_addr;
+ salen = res->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) {
@@ -1265,7 +1396,8 @@ sock_s_getnameinfo(int argc, VALUE *argv)
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) {
@@ -1284,6 +1416,8 @@ sock_s_getnameinfo(int argc, VALUE *argv)
error_exit_name:
if (res) freeaddrinfo(res);
rsock_raise_socket_error("getnameinfo", error);
+
+ UNREACHABLE;
}
/*
@@ -1349,7 +1483,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);
}
@@ -1373,8 +1507,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));
@@ -1417,17 +1550,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
@@ -1435,18 +1609,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) &&
@@ -1456,27 +1626,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)
@@ -1512,7 +1673,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)));
}
}
@@ -1535,7 +1717,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;
@@ -1574,7 +1756,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));
}
}
@@ -1593,7 +1775,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;
@@ -1605,7 +1787,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;
@@ -1646,9 +1828,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) + \
@@ -1763,7 +1945,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
@@ -1771,7 +1953,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));
}
}
@@ -1808,35 +1990,45 @@ Init_socket()
* TCPSocket, UDPSocket or UNIXSocket for example.
*
* Sockets have their own vocabulary:
- * domain::
- * The family of protocols: Socket::PF_INET, Socket::PF_INET6,
- * Socket::PF_UNIX, etc.
- * type::
- * The type of communications between the two endpoints, typically
- * Socket::SOCK_STREAM or Socket::SOCK_DGRAM.
- * protocol::
- * Typically zero. This may be used to identify a variant of a
- * protocol.
- * hostname::
- * The identifier of a network interface:
- * * a string (hostname, IPv4 or IPv6 adress or <tt><broadcast></tt>
- * which specifies a broadcast address)
- * * a zero-length string which specifies INADDR_ANY
- * * an integer (interpreted as binary address in host byte order).
+ *
+ * *domain:*
+ * The family of protocols:
+ * * Socket::PF_INET
+ * * Socket::PF_INET6
+ * * Socket::PF_UNIX
+ * * etc.
+ *
+ * *type:*
+ * The type of communications between the two endpoints, typically
+ * * Socket::SOCK_STREAM
+ * * Socket::SOCK_DGRAM.
+ *
+ * *protocol:*
+ * Typically _zero_.
+ * This may be used to identify a variant of a protocol.
+ *
+ * *hostname:*
+ * The identifier of a network interface:
+ * * a string (hostname, IPv4 or IPv6 adress or +broadcast+
+ * which specifies a broadcast address)
+ * * a zero-length string which specifies INADDR_ANY
+ * * an integer (interpreted as binary address in host byte order).
*
* === Quick start
*
- * Some classes such as TCPSocket, UDPSocket or UNIXSocket ease use of
- * sockets of these types compared to C programming.
+ * Many of the classes, such as TCPSocket, UDPSocket or UNIXSocket,
+ * ease the use of sockets comparatively to the equivalent C programming interface.
+ *
+ * Let's create an internet socket using the IPv4 protocol in a C-like manner:
*
- * # Creating a TCP socket in a C-like manner
- * s = Socket.new Socket::INET, Socket::SOCK_STREAM
+ * s = Socket.new Socket::AF_INET, Socket::SOCK_STREAM
* s.connect Socket.pack_sockaddr_in(80, 'example.com')
*
- * # Using TCPSocket
+ * You could also use the TCPSocket class:
+ *
* s = TCPSocket.new 'example.com', 80
*
- * A simple server would look like:
+ * A simple server might look like this:
*
* require 'socket'
*
@@ -1849,7 +2041,7 @@ Init_socket()
* client.close
* end
*
- * A simple client may look like:
+ * A simple client may look like this:
*
* require 'socket'
*
@@ -1866,14 +2058,14 @@ Init_socket()
* Ruby's Socket implementation raises exceptions based on the error
* generated by the system dependent implementation. This is why the
* methods are documented in a way that isolate Unix-based system
- * exceptions from Windows based exceptions. If more information on
- * particular exception is needed please refer to the Unix manual pages or
+ * exceptions from Windows based exceptions. If more information on a
+ * particular exception is needed, please refer to the Unix manual pages or
* the Windows WinSock reference.
*
- * === Convenient methods
+ * === Convenience methods
*
* Although the general way to create socket is Socket.new,
- * there are several methods for socket creation for most cases.
+ * there are several methods of socket creation for most cases.
*
* TCP client socket::
* Socket.tcp, TCPSocket.open
diff --git a/ext/socket/sockport.h b/ext/socket/sockport.h
index 5f2fd24530..a3c698e8a4 100644
--- a/ext/socket/sockport.h
+++ b/ext/socket/sockport.h
@@ -10,42 +10,59 @@
#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 SIN_LEN(si) sizeof(struct sockaddr_in)
-# define SET_SIN_LEN(si,len)
+# define SET_SIN_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)
+
+
+/* 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..a89c453239 100644
--- a/ext/socket/udpsocket.c
+++ b/ext/socket/udpsocket.c
@@ -93,7 +93,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);
}
@@ -126,7 +126,9 @@ udp_bind(VALUE sock, VALUE host, VALUE port)
return INT2FIX(0);
}
freeaddrinfo(res0);
- rb_sys_fail("bind(2)");
+
+ rsock_sys_fail_host_port("bind(2)", host, port);
+
return INT2FIX(0);
}
@@ -164,7 +166,6 @@ udp_send(int argc, VALUE *argv, VALUE sock)
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);
@@ -187,14 +188,14 @@ udp_send(int argc, VALUE *argv, VALUE sock)
}
}
freeaddrinfo(res0);
- rb_sys_fail("sendto(2)");
+ 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 3c30e92c6e..1742496e84 100644
--- a/ext/socket/unixsocket.c
+++ b/ext/socket/unixsocket.c
@@ -36,11 +36,10 @@ rsock_init_unixsock(VALUE sock, VALUE path, int server)
SafeStringValue(path);
fd = rsock_socket(AF_UNIX, SOCK_STREAM, 0);
if (fd < 0) {
- rb_sys_fail("socket(2)");
+ rsock_sys_fail_path("socket(2)", 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 (%ldbytes given but %dbytes max)",
RSTRING_LEN(path), (int)sizeof(sockaddr.sun_path));
@@ -66,13 +65,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, 5) < 0) {
+ if (listen(fd, SOMAXCONN) < 0) {
close(fd);
- rb_sys_fail("listen(2)");
+ rsock_sys_fail_path("listen(2)", path);
}
}
@@ -122,7 +121,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 +157,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 +208,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 +255,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;
@@ -270,7 +269,8 @@ static VALUE
recvmsg_blocking(void *data)
{
struct iomsg_arg *arg = data;
- return recvmsg(arg->fd, &arg->msg, 0);
+ int flags = 0;
+ return rsock_recvmsg(arg->fd, &arg->msg, flags);
}
/*
@@ -303,9 +303,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
@@ -343,7 +343,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
@@ -381,7 +381,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
@@ -389,7 +389,7 @@ unix_recv_io(int argc, VALUE *argv, VALUE sock)
#if FD_PASSING_BY_MSG_CONTROL
memcpy(&fd, CMSG_DATA(&cmsg.hdr), sizeof(int));
#endif
- rb_update_max_fd(fd);
+ rb_fd_fix_cloexec(fd);
if (klass == Qnil)
return INT2FIX(fd);
@@ -425,11 +425,13 @@ unix_addr(VALUE sock)
rb_io_t *fptr;
struct sockaddr_un addr;
socklen_t len = (socklen_t)sizeof addr;
+ socklen_t len0 = len;
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);
}
@@ -456,7 +458,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 6c41c3c368..3fef619de6 100644
--- a/ext/stringio/stringio.c
+++ b/ext/stringio/stringio.c
@@ -28,7 +28,7 @@ struct StringIO {
int count;
};
-static void strio_init(int, VALUE *, struct StringIO *);
+static void strio_init(int, VALUE *, struct StringIO *, VALUE);
#define IS_STRIO(obj) (rb_typeddata_is_kind_of((obj), &strio_data_type))
#define error_inval(msg) (errno = EINVAL, rb_sys_fail(msg))
@@ -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,32 +103,43 @@ 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);
}
#define StringIO(obj) get_strio(obj)
-#define CLOSED(ptr) (!((ptr)->flags & FMODE_READWRITE))
-#define READABLE(ptr) ((ptr)->flags & FMODE_READABLE)
-#define WRITABLE(ptr) ((ptr)->flags & FMODE_WRITABLE)
+#define STRIO_READABLE FL_USER4
+#define STRIO_WRITABLE FL_USER5
+#define STRIO_READWRITE (STRIO_READABLE|STRIO_WRITABLE)
+typedef char strio_flags_check[(STRIO_READABLE/FMODE_READABLE == STRIO_WRITABLE/FMODE_WRITABLE) * 2 - 1];
+#define STRIO_MODE_SET_P(strio, mode) \
+ ((RBASIC(strio)->flags & STRIO_##mode) && \
+ ((struct StringIO*)DATA_PTR(strio))->flags & FMODE_##mode)
+#define CLOSED(strio) (!STRIO_MODE_SET_P(strio, READWRITE))
+#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(struct StringIO *ptr)
+readable(VALUE strio)
{
- if (!READABLE(ptr)) {
+ struct StringIO *ptr = StringIO(strio);
+ if (!READABLE(strio)) {
rb_raise(rb_eIOError, "not opened for reading");
}
return ptr;
}
static struct StringIO*
-writable(struct StringIO *ptr)
+writable(VALUE strio)
{
- if (!WRITABLE(ptr)) {
+ struct StringIO *ptr = StringIO(strio);
+ if (!WRITABLE(strio)) {
rb_raise(rb_eIOError, "not opened for writing");
}
if (!OBJ_TAINTED(ptr->string)) {
- rb_secure(4);
}
return ptr;
}
@@ -160,12 +172,12 @@ strio_initialize(int argc, VALUE *argv, VALUE self)
DATA_PTR(self) = ptr = strio_alloc();
}
rb_call_super(0, 0);
- strio_init(argc, argv, ptr);
+ strio_init(argc, argv, ptr, self);
return self;
}
static void
-strio_init(int argc, VALUE *argv, struct StringIO *ptr)
+strio_init(int argc, VALUE *argv, struct StringIO *ptr, VALUE self)
{
VALUE string, mode;
int trunc = 0;
@@ -203,6 +215,7 @@ strio_init(int argc, VALUE *argv, struct StringIO *ptr)
ptr->string = string;
ptr->pos = 0;
ptr->lineno = 0;
+ RBASIC(self)->flags |= (ptr->flags & FMODE_READWRITE) * (STRIO_READABLE / FMODE_READABLE);
}
static VALUE
@@ -287,7 +300,8 @@ strio_unimpl(int argc, VALUE *argv, VALUE self)
{
StringIO(self);
rb_notimplement();
- return Qnil; /* not reached */
+
+ UNREACHABLE;
}
/*
@@ -331,11 +345,11 @@ strio_set_string(VALUE self, VALUE string)
static VALUE
strio_close(VALUE self)
{
- struct StringIO *ptr = StringIO(self);
- if (CLOSED(ptr)) {
+ StringIO(self);
+ if (CLOSED(self)) {
rb_raise(rb_eIOError, "closed stream");
}
- ptr->flags &= ~FMODE_READWRITE;
+ RBASIC(self)->flags &= ~STRIO_READWRITE;
return Qnil;
}
@@ -349,11 +363,11 @@ strio_close(VALUE self)
static VALUE
strio_close_read(VALUE self)
{
- struct StringIO *ptr = StringIO(self);
- if (!READABLE(ptr)) {
+ StringIO(self);
+ if (!READABLE(self)) {
rb_raise(rb_eIOError, "closing non-duplex IO for reading");
}
- ptr->flags &= ~FMODE_READABLE;
+ RBASIC(self)->flags &= ~STRIO_READABLE;
return Qnil;
}
@@ -367,11 +381,11 @@ strio_close_read(VALUE self)
static VALUE
strio_close_write(VALUE self)
{
- struct StringIO *ptr = StringIO(self);
- if (!WRITABLE(ptr)) {
+ StringIO(self);
+ if (!WRITABLE(self)) {
rb_raise(rb_eIOError, "closing non-duplex IO for writing");
}
- ptr->flags &= ~FMODE_WRITABLE;
+ RBASIC(self)->flags &= ~STRIO_WRITABLE;
return Qnil;
}
@@ -384,8 +398,8 @@ strio_close_write(VALUE self)
static VALUE
strio_closed(VALUE self)
{
- struct StringIO *ptr = StringIO(self);
- if (!CLOSED(ptr)) return Qfalse;
+ StringIO(self);
+ if (!CLOSED(self)) return Qfalse;
return Qtrue;
}
@@ -398,8 +412,8 @@ strio_closed(VALUE self)
static VALUE
strio_closed_read(VALUE self)
{
- struct StringIO *ptr = StringIO(self);
- if (READABLE(ptr)) return Qfalse;
+ StringIO(self);
+ if (READABLE(self)) return Qfalse;
return Qtrue;
}
@@ -412,8 +426,8 @@ strio_closed_read(VALUE self)
static VALUE
strio_closed_write(VALUE self)
{
- struct StringIO *ptr = StringIO(self);
- if (WRITABLE(ptr)) return Qfalse;
+ StringIO(self);
+ if (WRITABLE(self)) return Qfalse;
return Qtrue;
}
@@ -428,7 +442,7 @@ strio_closed_write(VALUE self)
static VALUE
strio_eof(VALUE self)
{
- struct StringIO *ptr = readable(StringIO(self));
+ struct StringIO *ptr = readable(self);
if (ptr->pos < RSTRING_LEN(ptr->string)) return Qfalse;
return Qtrue;
}
@@ -447,6 +461,8 @@ strio_copy(VALUE copy, VALUE orig)
}
DATA_PTR(copy) = ptr;
OBJ_INFECT(copy, orig);
+ RBASIC(copy)->flags &= ~STRIO_READWRITE;
+ RBASIC(copy)->flags |= RBASIC(orig)->flags & STRIO_READWRITE;
++ptr->count;
return copy;
}
@@ -481,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
/*
@@ -505,10 +517,10 @@ static VALUE
strio_reopen(int argc, VALUE *argv, VALUE self)
{
rb_io_taint_check(self);
- if (argc == 1 && TYPE(*argv) != T_STRING) {
+ if (argc == 1 && !RB_TYPE_P(*argv, T_STRING)) {
return strio_copy(self, *argv);
}
- strio_init(argc, argv, StringIO(self));
+ strio_init(argc, argv, StringIO(self), self);
return self;
}
@@ -575,7 +587,7 @@ strio_seek(int argc, VALUE *argv, VALUE self)
rb_scan_args(argc, argv, "11", NULL, &whence);
offset = NUM2LONG(argv[0]);
- if (CLOSED(ptr)) {
+ if (CLOSED(self)) {
rb_raise(rb_eIOError, "closed stream");
}
switch (NIL_P(whence) ? 0 : NUM2LONG(whence)) {
@@ -610,16 +622,12 @@ 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
/*
* call-seq:
- * strio.bytes {|byte| block } -> strio
- * strio.bytes -> anEnumerator
- *
* strio.each_byte {|byte| block } -> strio
* strio.each_byte -> anEnumerator
*
@@ -628,7 +636,7 @@ strio_get_sync(VALUE self)
static VALUE
strio_each_byte(VALUE self)
{
- struct StringIO *ptr = readable(StringIO(self));
+ struct StringIO *ptr = readable(self);
RETURN_ENUMERATOR(self, 0, 0);
@@ -640,6 +648,18 @@ strio_each_byte(VALUE self)
}
/*
+ * This is a deprecated alias for #each_byte.
+ */
+static VALUE
+strio_bytes(VALUE self)
+{
+ rb_warn("StringIO#bytes is deprecated; use #each_byte instead");
+ if (!rb_block_given_p())
+ return rb_enumeratorize(self, ID2SYM(rb_intern("each_byte")), 0, 0);
+ return strio_each_byte(self);
+}
+
+/*
* call-seq:
* strio.getc -> string or nil
*
@@ -648,7 +668,7 @@ strio_each_byte(VALUE self)
static VALUE
strio_getc(VALUE self)
{
- struct StringIO *ptr = readable(StringIO(self));
+ struct StringIO *ptr = readable(self);
rb_encoding *enc = rb_enc_get(ptr->string);
int len;
char *p;
@@ -671,7 +691,7 @@ strio_getc(VALUE self)
static VALUE
strio_getbyte(VALUE self)
{
- struct StringIO *ptr = readable(StringIO(self));
+ struct StringIO *ptr = readable(self);
int c;
if (ptr->pos >= RSTRING_LEN(ptr->string)) {
return Qnil;
@@ -709,12 +729,13 @@ strio_extend(struct StringIO *ptr, long pos, long len)
static VALUE
strio_ungetc(VALUE self, VALUE c)
{
- struct StringIO *ptr = readable(StringIO(self));
+ struct StringIO *ptr = readable(self);
long lpos, clen;
char *p, *pend;
rb_encoding *enc, *enc2;
if (NIL_P(c)) return Qnil;
+ check_modifiable(ptr);
if (FIXNUM_P(c)) {
int cc = FIX2INT(c);
char buf[16];
@@ -764,7 +785,7 @@ strio_ungetc(VALUE self, VALUE c)
static VALUE
strio_ungetbyte(VALUE self, VALUE c)
{
- struct StringIO *ptr = readable(StringIO(self));
+ struct StringIO *ptr = readable(self);
char buf[1], *cp = buf;
long pos = ptr->pos, cl = 1;
VALUE str = ptr->string;
@@ -779,6 +800,7 @@ strio_ungetbyte(VALUE self, VALUE c)
cl = RSTRING_LEN(c);
if (cl == 0) return Qnil;
}
+ check_modifiable(ptr);
rb_str_modify(str);
if (cl > pos) {
char *s;
@@ -827,9 +849,6 @@ strio_readbyte(VALUE self)
/*
* call-seq:
- * strio.chars {|char| block } -> strio
- * strio.chars -> anEnumerator
- *
* strio.each_char {|char| block } -> strio
* strio.each_char -> anEnumerator
*
@@ -849,10 +868,19 @@ strio_each_char(VALUE self)
}
/*
+ * This is a deprecated alias for <code>each_char</code>.
+ */
+static VALUE
+strio_chars(VALUE self)
+{
+ rb_warn("StringIO#chars is deprecated; use #each_char instead");
+ if (!rb_block_given_p())
+ return rb_enumeratorize(self, ID2SYM(rb_intern("each_char")), 0, 0);
+ return strio_each_char(self);
+}
+
+/*
* call-seq:
- * strio.codepoints {|c| block } -> strio
- * strio.codepoints -> anEnumerator
- *
* strio.each_codepoint {|c| block } -> strio
* strio.each_codepoint -> anEnumerator
*
@@ -868,7 +896,7 @@ strio_each_codepoint(VALUE self)
RETURN_ENUMERATOR(self, 0, 0);
- ptr = readable(StringIO(self));
+ ptr = readable(self);
enc = rb_enc_get(ptr->string);
for (;;) {
if (ptr->pos >= RSTRING_LEN(ptr->string)) {
@@ -883,6 +911,18 @@ strio_each_codepoint(VALUE self)
return self;
}
+/*
+ * This is a deprecated alias for <code>each_codepoint</code>.
+ */
+static VALUE
+strio_codepoints(VALUE self)
+{
+ rb_warn("StringIO#codepoints is deprecated; use #each_codepoint instead");
+ if (!rb_block_given_p())
+ return rb_enumeratorize(self, ID2SYM(rb_intern("each_codepoint")), 0, 0);
+ return strio_each_codepoint(self);
+}
+
/* Boyer-Moore search: copied from regex.c */
static void
bm_init_skip(long *skip, const char *pat, long m)
@@ -930,7 +970,7 @@ strio_getline(int argc, VALUE *argv, struct StringIO *ptr)
break;
case 1:
- if (!NIL_P(str) && TYPE(str) != T_STRING) {
+ if (!NIL_P(str) && !RB_TYPE_P(str, T_STRING)) {
VALUE tmp = rb_check_string_type(str);
if (NIL_P(tmp)) {
limit = NUM2LONG(str);
@@ -945,7 +985,7 @@ strio_getline(int argc, VALUE *argv, struct StringIO *ptr)
case 2:
if (!NIL_P(str)) StringValue(str);
- limit = NUM2LONG(lim);
+ if (!NIL_P(lim)) limit = NUM2LONG(lim);
break;
}
@@ -1020,7 +1060,7 @@ strio_getline(int argc, VALUE *argv, struct StringIO *ptr)
static VALUE
strio_gets(int argc, VALUE *argv, VALUE self)
{
- VALUE str = strio_getline(argc, argv, readable(StringIO(self)));
+ VALUE str = strio_getline(argc, argv, readable(self));
rb_lastline_set(str);
return str;
@@ -1054,19 +1094,14 @@ strio_readline(int argc, VALUE *argv, VALUE self)
* strio.each_line(sep,limit) {|line| block } -> strio
* strio.each_line(...) -> anEnumerator
*
- * strio.lines(sep=$/) {|line| block } -> strio
- * strio.lines(limit) {|line| block } -> strio
- * strio.lines(sep,limit) {|line| block } -> strio
- * strio.lines(...) -> anEnumerator
- *
* See IO#each.
*/
static VALUE
strio_each(int argc, VALUE *argv, VALUE self)
{
- struct StringIO *ptr = StringIO(self);
VALUE line;
+ StringIO(self);
RETURN_ENUMERATOR(self, argc, argv);
if (argc > 0 && !NIL_P(argv[argc-1]) && NIL_P(rb_check_string_type(argv[argc-1])) &&
@@ -1074,13 +1109,25 @@ strio_each(int argc, VALUE *argv, VALUE self)
rb_raise(rb_eArgError, "invalid limit: 0 for each_line");
}
- while (!NIL_P(line = strio_getline(argc, argv, readable(ptr)))) {
+ while (!NIL_P(line = strio_getline(argc, argv, readable(self)))) {
rb_yield(line);
}
return self;
}
/*
+ * This is a deprecated alias for <code>each_line</code>.
+ */
+static VALUE
+strio_lines(int argc, VALUE *argv, VALUE self)
+{
+ rb_warn("StringIO#lines is deprecated; use #each_line instead");
+ if (!rb_block_given_p())
+ return rb_enumeratorize(self, ID2SYM(rb_intern("each_line")), argc, argv);
+ return strio_each(argc, argv, self);
+}
+
+/*
* call-seq:
* strio.readlines(sep=$/) -> array
* strio.readlines(limit) -> array
@@ -1091,15 +1138,16 @@ strio_each(int argc, VALUE *argv, VALUE self)
static VALUE
strio_readlines(int argc, VALUE *argv, VALUE self)
{
- struct StringIO *ptr = StringIO(self);
- VALUE ary = rb_ary_new(), line;
+ VALUE ary, line;
+ StringIO(self);
+ ary = rb_ary_new();
if (argc > 0 && !NIL_P(argv[argc-1]) && NIL_P(rb_check_string_type(argv[argc-1])) &&
NUM2LONG(argv[argc-1]) == 0) {
rb_raise(rb_eArgError, "invalid limit: 0 for readlines");
}
- while (!NIL_P(line = strio_getline(argc, argv, readable(ptr)))) {
+ while (!NIL_P(line = strio_getline(argc, argv, readable(self)))) {
rb_ary_push(ary, line);
}
return ary;
@@ -1118,12 +1166,12 @@ strio_readlines(int argc, VALUE *argv, VALUE self)
static VALUE
strio_write(VALUE self, VALUE str)
{
- struct StringIO *ptr = writable(StringIO(self));
+ struct StringIO *ptr = writable(self);
long len, olen;
rb_encoding *enc, *enc2;
RB_GC_GUARD(str);
- if (TYPE(str) != T_STRING)
+ if (!RB_TYPE_P(str, T_STRING))
str = rb_obj_as_string(str);
enc = rb_enc_get(ptr->string);
enc2 = rb_enc_get(str);
@@ -1138,7 +1186,7 @@ strio_write(VALUE self, VALUE str)
ptr->pos = olen;
}
if (ptr->pos == olen) {
- rb_str_cat(ptr->string, RSTRING_PTR(str), len);
+ rb_enc_str_buf_cat(ptr->string, RSTRING_PTR(str), len, enc);
}
else {
strio_extend(ptr, ptr->pos, len);
@@ -1184,7 +1232,7 @@ strio_write(VALUE self, VALUE str)
static VALUE
strio_putc(VALUE self, VALUE ch)
{
- struct StringIO *ptr = writable(StringIO(self));
+ struct StringIO *ptr = writable(self);
int c = NUM2CHR(ch);
long olen;
@@ -1209,14 +1257,14 @@ strio_putc(VALUE self, VALUE ch)
/*
* call-seq:
- * strio.read([length [, buffer]]) -> string, buffer, or nil
+ * strio.read([length [, outbuf]]) -> string, outbuf, or nil
*
* See IO#read.
*/
static VALUE
strio_read(int argc, VALUE *argv, VALUE self)
{
- struct StringIO *ptr = readable(StringIO(self));
+ struct StringIO *ptr = readable(self);
VALUE str = Qnil;
long len;
int binary = 0;
@@ -1281,6 +1329,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.
@@ -1295,24 +1344,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.
@@ -1337,11 +1421,11 @@ strio_size(VALUE self)
static VALUE
strio_truncate(VALUE self, VALUE len)
{
- VALUE string = writable(StringIO(self))->string;
+ VALUE string = writable(self)->string;
long l = NUM2LONG(len);
long plen = RSTRING_LEN(string);
if (l < 0) {
- error_inval("negative legnth");
+ error_inval("negative length");
}
rb_str_resize(string, l);
if (plen < l) {
@@ -1427,6 +1511,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);
@@ -1436,26 +1522,30 @@ 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);
rb_define_method(StringIO, "each", strio_each, -1);
rb_define_method(StringIO, "each_line", strio_each, -1);
- rb_define_method(StringIO, "lines", strio_each, -1);
+ rb_define_method(StringIO, "lines", strio_lines, -1);
rb_define_method(StringIO, "each_byte", strio_each_byte, 0);
- rb_define_method(StringIO, "bytes", strio_each_byte, 0);
+ rb_define_method(StringIO, "bytes", strio_bytes, 0);
rb_define_method(StringIO, "each_char", strio_each_char, 0);
- rb_define_method(StringIO, "chars", strio_each_char, 0);
+ rb_define_method(StringIO, "chars", strio_chars, 0);
rb_define_method(StringIO, "each_codepoint", strio_each_codepoint, 0);
- rb_define_method(StringIO, "codepoints", strio_each_codepoint, 0);
+ rb_define_method(StringIO, "codepoints", strio_codepoints, 0);
rb_define_method(StringIO, "getc", strio_getc, 0);
rb_define_method(StringIO, "ungetc", strio_ungetc, 1);
rb_define_method(StringIO, "ungetbyte", strio_ungetbyte, 1);
@@ -1467,9 +1557,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);
@@ -1480,23 +1580,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/extconf.rb b/ext/strscan/extconf.rb
index 0d21966fc2..3e5a295e31 100644
--- a/ext/strscan/extconf.rb
+++ b/ext/strscan/extconf.rb
@@ -1,2 +1,3 @@
require 'mkmf'
+$INCFLAGS << " -I$(top_srcdir)"
create_makefile 'strscan'
diff --git a/ext/strscan/strscan.c b/ext/strscan/strscan.c
index dcad837a37..f020ba780d 100644
--- a/ext/strscan/strscan.c
+++ b/ext/strscan/strscan.c
@@ -11,6 +11,7 @@
#include "ruby/ruby.h"
#include "ruby/re.h"
#include "ruby/encoding.h"
+#include "regint.h"
#define STRSCAN_VERSION "0.7.0"
@@ -20,6 +21,7 @@
static VALUE StringScanner;
static VALUE ScanError;
+static ID id_byteslice;
struct strscanner
{
@@ -36,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)
@@ -51,7 +56,7 @@ struct strscanner
#define EOS_P(s) ((s)->curr >= RSTRING_LEN(p->str))
#define GET_SCANNER(obj,var) do {\
- Data_Get_Struct((obj), struct strscanner, (var));\
+ (var) = check_strscan(obj);\
if (NIL_P((var)->str)) rb_raise(rb_eArgError, "uninitialized StringScanner object");\
} while (0)
@@ -63,9 +68,10 @@ static VALUE infect _((VALUE str, struct strscanner *p));
static VALUE extract_range _((struct strscanner *p, long beg_i, long end_i));
static VALUE extract_beg_len _((struct strscanner *p, long beg_i, long len));
-void check_strscan _((VALUE obj));
-static void strscan_mark _((struct strscanner *p));
-static void strscan_free _((struct strscanner *p));
+static struct strscanner *check_strscan _((VALUE obj));
+static void strscan_mark _((void *p));
+static void strscan_free _((void *p));
+static size_t strscan_memsize _((const void *p));
static VALUE strscan_s_allocate _((VALUE klass));
static VALUE strscan_initialize _((int argc, VALUE *argv, VALUE self));
static VALUE strscan_init_copy _((VALUE vself, VALUE vorig));
@@ -157,18 +163,37 @@ extract_beg_len(struct strscanner *p, long beg_i, long len)
======================================================================= */
static void
-strscan_mark(struct strscanner *p)
+strscan_mark(void *ptr)
{
+ struct strscanner *p = ptr;
rb_gc_mark(p->str);
}
static void
-strscan_free(struct strscanner *p)
+strscan_free(void *ptr)
{
+ struct strscanner *p = ptr;
onig_region_free(&(p->regs), 0);
ruby_xfree(p);
}
+static size_t
+strscan_memsize(const void *ptr)
+{
+ const struct strscanner *p = ptr;
+ size_t size = 0;
+ if (p) {
+ size = sizeof(*p) - sizeof(p->regs) + onig_region_memsize(&p->regs);
+ }
+ return size;
+}
+
+static const rb_data_type_t strscanner_type = {
+ "StringScanner",
+ {strscan_mark, strscan_free, strscan_memsize},
+ NULL, NULL, RUBY_TYPED_FREE_IMMEDIATELY
+};
+
static VALUE
strscan_s_allocate(VALUE klass)
{
@@ -179,7 +204,7 @@ strscan_s_allocate(VALUE klass)
CLEAR_MATCH_STATUS(p);
onig_region_init(&(p->regs));
p->str = Qnil;
- return Data_Wrap_Struct(klass, strscan_mark, strscan_free, p);
+ return TypedData_Wrap_Struct(klass, &strscanner_type, p);
}
/*
@@ -194,7 +219,7 @@ strscan_initialize(int argc, VALUE *argv, VALUE self)
struct strscanner *p;
VALUE str, need_dup;
- Data_Get_Struct(self, struct strscanner, p);
+ p = check_strscan(self);
rb_scan_args(argc, argv, "11", &str, &need_dup);
StringValue(str);
p->str = str;
@@ -202,14 +227,10 @@ strscan_initialize(int argc, VALUE *argv, VALUE self)
return self;
}
-void
+static struct strscanner *
check_strscan(VALUE obj)
{
- if (TYPE(obj) != T_DATA || RDATA(obj)->dmark != (RUBY_DATA_FUNC)strscan_mark) {
- rb_raise(rb_eTypeError,
- "wrong argument type %s (expected StringScanner)",
- rb_obj_classname(obj));
- }
+ return rb_check_typeddata(obj, &strscanner_type);
}
/*
@@ -224,9 +245,8 @@ strscan_init_copy(VALUE vself, VALUE vorig)
{
struct strscanner *self, *orig;
- Data_Get_Struct(vself, struct strscanner, self);
- check_strscan(vorig);
- Data_Get_Struct(vorig, struct strscanner, orig);
+ self = check_strscan(vself);
+ orig = check_strscan(vorig);
if (self != orig) {
self->flags = orig->flags;
self->str = orig->str;
@@ -317,9 +337,8 @@ strscan_get_string(VALUE self)
static VALUE
strscan_set_string(VALUE self, VALUE str)
{
- struct strscanner *p;
+ struct strscanner *p = check_strscan(self);
- Data_Get_Struct(self, struct strscanner, p);
StringValue(str);
p->str = str;
p->curr = 0;
@@ -357,7 +376,7 @@ strscan_concat(VALUE self, VALUE str)
* value is zero. In the 'terminated' position (i.e. the string is exhausted),
* this value is the bytesize of the string.
*
- * In short, it's a 0-based index into the string.
+ * In short, it's a 0-based index into bytes of the string.
*
* s = StringScanner.new('test string')
* s.pos # -> 0
@@ -376,6 +395,32 @@ strscan_get_pos(VALUE self)
}
/*
+ * Returns the character position of the scan pointer. In the 'reset' position, this
+ * value is zero. In the 'terminated' position (i.e. the string is exhausted),
+ * this value is the size of the string.
+ *
+ * In short, it's a 0-based index into the string.
+ *
+ * s = StringScanner.new("abcädeföghi")
+ * s.charpos # -> 0
+ * s.scan_until(/ä/) # -> "abcä"
+ * s.pos # -> 5
+ * s.charpos # -> 4
+ */
+static VALUE
+strscan_get_charpos(VALUE self)
+{
+ struct strscanner *p;
+ VALUE substr;
+
+ GET_SCANNER(self, p);
+
+ substr = rb_funcall(p->str, id_byteslice, 2, INT2FIX(0), INT2NUM(p->curr));
+
+ return rb_str_length(substr);
+}
+
+/*
* call-seq: pos=(n)
*
* Set the byte position of the scan pointer.
@@ -415,6 +460,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++;
@@ -929,6 +976,25 @@ 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)
+{
+ int num;
+
+ num = onig_name_to_backref_number(RREGEXP(regexp)->ptr,
+ (const unsigned char* )name, (const unsigned char* )name_end, regs);
+ if (num >= 1) {
+ return num;
+ }
+ else {
+ VALUE s = rb_str_new(name, (long )(name_end - name));
+ rb_raise(rb_eIndexError, "undefined group name reference: %s",
+ StringValuePtr(s));
+ }
+
+ UNREACHABLE;
+}
+
/*
* call-seq: [](n)
*
@@ -942,17 +1008,43 @@ 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:
+ name = rb_id2name(SYM2ID(idx));
+ goto name_to_backref;
+ break;
+ case T_STRING:
+ name = StringValuePtr(idx);
+ name_to_backref:
+ i = name_to_backref_number(&(p->regs), p->regex, name, name + strlen(name));
+ break;
+ default:
+ i = NUM2LONG(idx);
+ }
+
if (i < 0)
i += p->regs.num_regs;
if (i < 0) return Qnil;
@@ -1067,7 +1159,7 @@ strscan_inspect(VALUE self)
long len;
VALUE a, b;
- Data_Get_Struct(self, struct strscanner, p);
+ p = check_strscan(self);
if (NIL_P(p->str)) {
len = snprintf(buf, BUFSIZE, "#<%s (uninitialized)>",
rb_class2name(CLASS_OF(self)));
@@ -1248,6 +1340,8 @@ Init_strscan()
ID id_scanerr = rb_intern("ScanError");
VALUE tmp;
+ id_byteslice = rb_intern("byteslice");
+
StringScanner = rb_define_class("StringScanner", rb_cObject);
ScanError = rb_define_class_under(StringScanner, "Error", rb_eStandardError);
if (!rb_const_defined(rb_cObject, id_scanerr)) {
@@ -1273,6 +1367,7 @@ Init_strscan()
rb_define_method(StringScanner, "<<", strscan_concat, 1);
rb_define_method(StringScanner, "pos", strscan_get_pos, 0);
rb_define_method(StringScanner, "pos=", strscan_set_pos, 1);
+ rb_define_method(StringScanner, "charpos", strscan_get_charpos, 0);
rb_define_method(StringScanner, "pointer", strscan_get_pos, 0);
rb_define_method(StringScanner, "pointer=", strscan_set_pos, 1);
diff --git a/ext/syck/bytecode.c b/ext/syck/bytecode.c
deleted file mode 100644
index 3310713e5c..0000000000
--- a/ext/syck/bytecode.c
+++ /dev/null
@@ -1,1165 +0,0 @@
-/* Generated by re2c 0.9.10 on Mon Sep 19 23:21:26 2005 */
-#line 1 "bytecode.re"
-/*
- * bytecode.re
- *
- * $Author$
- *
- * Copyright (C) 2003 why the lucky stiff
- */
-#include "ruby/ruby.h"
-#include "syck.h"
-#include "gram.h"
-
-#define QUOTELEN 128
-
-/*
- * They do my bidding...
- */
-#define YYCTYPE char
-#define YYCURSOR parser->cursor
-#define YYMARKER parser->marker
-#define YYLIMIT parser->limit
-#define YYTOKEN parser->token
-#define YYTOKTMP parser->toktmp
-#define YYLINEPTR parser->lineptr
-#define YYLINECTPTR parser->linectptr
-#define YYLINE parser->linect
-#define YYFILL(n) syck_parser_read(parser)
-
-extern SyckParser *syck_parser_ptr;
-
-char *get_inline( SyckParser *parser );
-
-/*
- * Repositions the cursor at `n' offset from the token start.
- * Only works in `Header' and `Document' sections.
- */
-#define YYPOS(n) YYCURSOR = YYTOKEN + n
-
-/*
- * Track line numbers
- */
-#define CHK_NL(ptr) if ( *( ptr - 1 ) == '\n' && ptr > YYLINECTPTR ) { YYLINEPTR = ptr; YYLINE++; YYLINECTPTR = YYLINEPTR; }
-
-/*
- * I like seeing the level operations as macros...
- */
-#define ADD_LEVEL(len, status) syck_parser_add_level( parser, len, status )
-#define POP_LEVEL() syck_parser_pop_level( parser )
-#define CURRENT_LEVEL() syck_parser_current_level( parser )
-
-/*
- * Force a token next time around sycklex()
- */
-#define FORCE_NEXT_TOKEN(tok) parser->force_token = tok;
-
-/*
- * Adding levels in bytecode requires us to make sure
- * we've got all our tokens worked out.
- */
-#define ADD_BYTE_LEVEL(lvl, len, s ) \
- switch ( lvl->status ) \
- { \
- case syck_lvl_seq: \
- lvl->ncount++; \
- ADD_LEVEL(len, syck_lvl_open); \
- YYPOS(0); \
- return '-'; \
- \
- case syck_lvl_map: \
- lvl->ncount++; \
- ADD_LEVEL(len, s); \
- break; \
- \
- case syck_lvl_open: \
- lvl->status = s; \
- break; \
- \
- default: \
- ADD_LEVEL(len, s); \
- break; \
- }
-
-/*
- * Nice little macro to ensure we're YAML_IOPENed to the current level.
- * * Only use this macro in the "Document" section *
- */
-#define ENSURE_YAML_IOPEN(last_lvl, lvl_type, to_len, reset) \
- if ( last_lvl->spaces < to_len ) \
- { \
- if ( last_lvl->status == syck_lvl_iseq || last_lvl->status == syck_lvl_imap ) \
- { \
- goto Document; \
- } \
- else \
- { \
- ADD_LEVEL( to_len, lvl_type ); \
- if ( reset == 1 ) YYPOS(0); \
- return YAML_IOPEN; \
- } \
- }
-
-/*
- * Nice little macro to ensure closure of levels.
- * * Only use this macro in the "Document" section *
- */
-#define ENSURE_YAML_IEND(last_lvl, to_len) \
- if ( last_lvl->spaces > to_len ) \
- { \
- syck_parser_pop_level( parser ); \
- YYPOS(0); \
- return YAML_IEND; \
- }
-
-/*
- * Concatenates string items and manages allocation
- * to the string
- */
-#define CAT(s, c, i, l) \
- { \
- if ( i + 1 >= c ) \
- { \
- c += QUOTELEN; \
- S_REALLOC_N( s, char, c ); \
- } \
- s[i++] = l; \
- s[i] = '\0'; \
- }
-
-/*
- * Parser for standard YAML Bytecode [UTF-8]
- */
-int
-sycklex_bytecode_utf8( YYSTYPE *sycklval, SyckParser *parser )
-{
- SyckLevel *lvl;
- syck_parser_ptr = parser;
- if ( YYCURSOR == NULL )
- {
- syck_parser_read( parser );
- }
-
- if ( parser->force_token != 0 )
- {
- int t = parser->force_token;
- parser->force_token = 0;
- return t;
- }
-
-#line 172 "bytecode.re"
-
-
- lvl = CURRENT_LEVEL();
- if ( lvl->status == syck_lvl_doc )
- {
- goto Document;
- }
-
-/* Header: */
-
- YYTOKEN = YYCURSOR;
-
-
-#line 165 "<stdout>"
-{
- YYCTYPE yych;
- unsigned int yyaccept = 0;
- goto yy0;
- ++YYCURSOR;
-yy0:
- if((YYLIMIT - YYCURSOR) < 3) YYFILL(3);
- yych = *YYCURSOR;
- switch(yych){
- case 0x00: goto yy2;
- case 'D': goto yy3;
- default: goto yy5;
- }
-yy2: YYCURSOR = YYMARKER;
- switch(yyaccept){
- case 0: goto yy4;
- }
-yy3: yyaccept = 0;
- yych = *(YYMARKER = ++YYCURSOR);
- switch(yych){
- case 0x0A: goto yy6;
- case 0x0D: goto yy8;
- default: goto yy4;
- }
-yy4:
-#line 199 "bytecode.re"
-{ YYPOS(0);
- goto Document;
- }
-#line 195 "<stdout>"
-yy5: yych = *++YYCURSOR;
- goto yy4;
-yy6: ++YYCURSOR;
- goto yy7;
-yy7:
-#line 186 "bytecode.re"
-{ if ( lvl->status == syck_lvl_header )
- {
- CHK_NL(YYCURSOR);
- goto Directive;
- }
- else
- {
- ENSURE_YAML_IEND(lvl, -1);
- YYPOS(0);
- return 0;
- }
- }
-#line 214 "<stdout>"
-yy8: ++YYCURSOR;
- switch((yych = *YYCURSOR)) {
- case 0x0A: goto yy6;
- default: goto yy2;
- }
-}
-#line 203 "bytecode.re"
-
-
-Document:
- {
- lvl = CURRENT_LEVEL();
- if ( lvl->status == syck_lvl_header )
- {
- lvl->status = syck_lvl_doc;
- }
-
- YYTOKEN = YYCURSOR;
-
-
-#line 235 "<stdout>"
-{
- YYCTYPE yych;
- goto yy9;
- ++YYCURSOR;
-yy9:
- if((YYLIMIT - YYCURSOR) < 3) YYFILL(3);
- yych = *YYCURSOR;
- switch(yych){
- case 0x00: goto yy30;
- case 0x0A: goto yy27;
- case 0x0D: goto yy29;
- case 'A': goto yy19;
- case 'D': goto yy12;
- case 'E': goto yy16;
- case 'M': goto yy14;
- case 'P': goto yy13;
- case 'Q': goto yy15;
- case 'R': goto yy21;
- case 'S': goto yy17;
- case 'T': goto yy23;
- case 'c': goto yy25;
- default: goto yy11;
- }
-yy11:yy12: yych = *++YYCURSOR;
- switch(yych){
- case 0x0A: goto yy41;
- case 0x0D: goto yy44;
- default: goto yy11;
- }
-yy13: yych = *++YYCURSOR;
- switch(yych){
- case 0x0A: goto yy41;
- case 0x0D: goto yy43;
- default: goto yy11;
- }
-yy14: yych = *++YYCURSOR;
- switch(yych){
- case 0x0A: goto yy38;
- case 0x0D: goto yy40;
- default: goto yy11;
- }
-yy15: yych = *++YYCURSOR;
- switch(yych){
- case 0x0A: goto yy35;
- case 0x0D: goto yy37;
- default: goto yy11;
- }
-yy16: yych = *++YYCURSOR;
- switch(yych){
- case 0x0A: goto yy32;
- case 0x0D: goto yy34;
- default: goto yy11;
- }
-yy17: ++YYCURSOR;
- goto yy18;
-yy18:
-#line 288 "bytecode.re"
-{ ADD_BYTE_LEVEL(lvl, lvl->spaces + 1, syck_lvl_str);
- goto Scalar;
- }
-#line 296 "<stdout>"
-yy19: ++YYCURSOR;
- goto yy20;
-yy20:
-#line 292 "bytecode.re"
-{ ADD_BYTE_LEVEL(lvl, lvl->spaces + 1, syck_lvl_open);
- sycklval->name = get_inline( parser );
- syck_hdlr_remove_anchor( parser, sycklval->name );
- CHK_NL(YYCURSOR);
- return YAML_ANCHOR;
- }
-#line 307 "<stdout>"
-yy21: ++YYCURSOR;
- goto yy22;
-yy22:
-#line 299 "bytecode.re"
-{ ADD_BYTE_LEVEL(lvl, lvl->spaces + 1, syck_lvl_str);
- sycklval->name = get_inline( parser );
- POP_LEVEL();
- if ( *( YYCURSOR - 1 ) == '\n' ) YYCURSOR--;
- return YAML_ALIAS;
- }
-#line 318 "<stdout>"
-yy23: ++YYCURSOR;
- goto yy24;
-yy24:
-#line 306 "bytecode.re"
-{ char *qstr;
- ADD_BYTE_LEVEL(lvl, lvl->spaces + 1, syck_lvl_open);
- qstr = get_inline( parser );
- CHK_NL(YYCURSOR);
- if ( qstr[0] == '!' )
- {
- size_t qidx = strlen( qstr );
- if ( qstr[1] == '\0' )
- {
- free( qstr );
- return YAML_ITRANSFER;
- }
-
- lvl = CURRENT_LEVEL();
-
- /*
- * URL Prefixing
- */
- if ( qstr[1] == '^' )
- {
- sycklval->name = S_ALLOC_N( char, qidx + strlen( lvl->domain ) );
- sycklval->name[0] = '\0';
- strcat( sycklval->name, lvl->domain );
- strncat( sycklval->name, qstr + 2, qidx - 2 );
- free( qstr );
- }
- else
- {
- char *carat = qstr + 1;
- char *qend = qstr + qidx;
- while ( (++carat) < qend )
- {
- if ( *carat == '^' )
- break;
- }
-
- if ( carat < qend )
- {
- free( lvl->domain );
- lvl->domain = syck_strndup( qstr + 1, carat - ( qstr + 1 ) );
- sycklval->name = S_ALLOC_N( char, ( qend - carat ) + strlen( lvl->domain ) );
- sycklval->name[0] = '\0';
- strcat( sycklval->name, lvl->domain );
- strncat( sycklval->name, carat + 1, ( qend - carat ) - 1 );
- free( qstr );
- }
- else
- {
- sycklval->name = S_ALLOC_N( char, strlen( qstr ) );
- sycklval->name[0] = '\0';
- S_MEMCPY( sycklval->name, qstr + 1, char, strlen( qstr ) );
- free( qstr );
- }
- }
- return YAML_TRANSFER;
- }
- sycklval->name = qstr;
- return YAML_TAGURI;
- }
-#line 382 "<stdout>"
-yy25: ++YYCURSOR;
- goto yy26;
-yy26:
-#line 366 "bytecode.re"
-{ goto Comment; }
-#line 388 "<stdout>"
-yy27: ++YYCURSOR;
- goto yy28;
-yy28:
-#line 368 "bytecode.re"
-{ CHK_NL(YYCURSOR);
- if ( lvl->status == syck_lvl_seq )
- {
- return YAML_INDENT;
- }
- else if ( lvl->status == syck_lvl_map )
- {
- if ( lvl->ncount % 2 == 1 ) return ':';
- else return YAML_INDENT;
- }
- goto Document;
- }
-#line 405 "<stdout>"
-yy29: yych = *++YYCURSOR;
- switch(yych){
- case 0x0A: goto yy27;
- default: goto yy11;
- }
-yy30: ++YYCURSOR;
- goto yy31;
-yy31:
-#line 381 "bytecode.re"
-{ ENSURE_YAML_IEND(lvl, -1);
- YYPOS(0);
- return 0;
- }
-#line 419 "<stdout>"
-yy32: ++YYCURSOR;
- goto yy33;
-yy33:
-#line 252 "bytecode.re"
-{ if ( lvl->status == syck_lvl_seq && lvl->ncount == 0 )
- {
- lvl->ncount++;
- YYPOS(0);
- FORCE_NEXT_TOKEN( ']' );
- return '[';
- }
- else if ( lvl->status == syck_lvl_map && lvl->ncount == 0 )
- {
- lvl->ncount++;
- YYPOS(0);
- FORCE_NEXT_TOKEN( '}' );
- return '{';
- }
-
- POP_LEVEL();
- lvl = CURRENT_LEVEL();
- if ( lvl->status == syck_lvl_seq )
- {
- FORCE_NEXT_TOKEN(YAML_INDENT);
- }
- else if ( lvl->status == syck_lvl_map )
- {
- if ( lvl->ncount % 2 == 1 )
- {
- FORCE_NEXT_TOKEN(':');
- }
- else
- {
- FORCE_NEXT_TOKEN(YAML_INDENT);
- }
- }
- CHK_NL(YYCURSOR);
- return YAML_IEND;
- }
-#line 459 "<stdout>"
-yy34: yych = *++YYCURSOR;
- switch(yych){
- case 0x0A: goto yy32;
- default: goto yy11;
- }
-yy35: ++YYCURSOR;
- goto yy36;
-yy36:
-#line 237 "bytecode.re"
-{ int complex = 0;
- if ( lvl->ncount % 2 == 0 && ( lvl->status == syck_lvl_map || lvl->status == syck_lvl_seq ) )
- {
- complex = 1;
- }
- ADD_BYTE_LEVEL(lvl, lvl->spaces + 1, syck_lvl_seq);
- CHK_NL(YYCURSOR);
- if ( complex )
- {
- FORCE_NEXT_TOKEN( YAML_IOPEN );
- return '?';
- }
- return YAML_IOPEN;
- }
-#line 483 "<stdout>"
-yy37: yych = *++YYCURSOR;
- switch(yych){
- case 0x0A: goto yy35;
- default: goto yy11;
- }
-yy38: ++YYCURSOR;
- goto yy39;
-yy39:
-#line 222 "bytecode.re"
-{ int complex = 0;
- if ( lvl->ncount % 2 == 0 && ( lvl->status == syck_lvl_map || lvl->status == syck_lvl_seq ) )
- {
- complex = 1;
- }
- ADD_BYTE_LEVEL(lvl, lvl->spaces + 1, syck_lvl_map);
- CHK_NL(YYCURSOR);
- if ( complex )
- {
- FORCE_NEXT_TOKEN( YAML_IOPEN );
- return '?';
- }
- return YAML_IOPEN;
- }
-#line 507 "<stdout>"
-yy40: yych = *++YYCURSOR;
- switch(yych){
- case 0x0A: goto yy38;
- default: goto yy11;
- }
-yy41: ++YYCURSOR;
- goto yy42;
-yy42:
-#line 217 "bytecode.re"
-{ ENSURE_YAML_IEND(lvl, -1);
- YYPOS(0);
- return 0;
- }
-#line 521 "<stdout>"
-yy43: yych = *++YYCURSOR;
- switch(yych){
- case 0x0A: goto yy41;
- default: goto yy11;
- }
-yy44: ++YYCURSOR;
- switch((yych = *YYCURSOR)) {
- case 0x0A: goto yy41;
- default: goto yy11;
- }
-}
-#line 386 "bytecode.re"
-
-
- }
-
-Directive:
- {
- YYTOKEN = YYCURSOR;
-
-
-#line 543 "<stdout>"
-{
- YYCTYPE yych;
- unsigned int yyaccept = 0;
- goto yy45;
- ++YYCURSOR;
-yy45:
- if((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
- yych = *YYCURSOR;
- switch(yych){
- case 0x00: goto yy47;
- case 'V': goto yy48;
- default: goto yy50;
- }
-yy47: YYCURSOR = YYMARKER;
- switch(yyaccept){
- case 0: goto yy49;
- }
-yy48: yyaccept = 0;
- yych = *(YYMARKER = ++YYCURSOR);
- switch(yych){
- case '.':
- case '/':
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9':
- case ':':
- case ';':
- case '<':
- case '=':
- case '>':
- case '?':
- case '@':
- case 'A':
- case 'B':
- case 'C':
- case 'D':
- case 'E':
- case 'F':
- case 'G':
- case 'H':
- case 'I':
- case 'J':
- case 'K':
- case 'L':
- case 'M':
- case 'N':
- case 'O':
- case 'P':
- case 'Q':
- case 'R':
- case 'S':
- case 'T':
- case 'U':
- case 'V':
- case 'W':
- case 'X':
- case 'Y':
- case 'Z':
- case '[':
- case '\\':
- case ']':
- case '^':
- case '_': case 'a':
- case 'b':
- case 'c':
- case 'd':
- case 'e':
- case 'f':
- case 'g':
- case 'h':
- case 'i':
- case 'j':
- case 'k':
- case 'l':
- case 'm':
- case 'n':
- case 'o':
- case 'p':
- case 'q':
- case 'r':
- case 's':
- case 't':
- case 'u':
- case 'v':
- case 'w':
- case 'x':
- case 'y':
- case 'z': goto yy51;
- default: goto yy49;
- }
-yy49:
-#line 399 "bytecode.re"
-{ YYCURSOR = YYTOKEN;
- return YAML_DOCSEP;
- }
-#line 646 "<stdout>"
-yy50: yych = *++YYCURSOR;
- goto yy49;
-yy51: ++YYCURSOR;
- if((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
- yych = *YYCURSOR;
- goto yy52;
-yy52: switch(yych){
- case '.':
- case '/':
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': case ';':
- case '<':
- case '=':
- case '>':
- case '?':
- case '@':
- case 'A':
- case 'B':
- case 'C':
- case 'D':
- case 'E':
- case 'F':
- case 'G':
- case 'H':
- case 'I':
- case 'J':
- case 'K':
- case 'L':
- case 'M':
- case 'N':
- case 'O':
- case 'P':
- case 'Q':
- case 'R':
- case 'S':
- case 'T':
- case 'U':
- case 'V':
- case 'W':
- case 'X':
- case 'Y':
- case 'Z':
- case '[':
- case '\\':
- case ']':
- case '^':
- case '_': case 'a':
- case 'b':
- case 'c':
- case 'd':
- case 'e':
- case 'f':
- case 'g':
- case 'h':
- case 'i':
- case 'j':
- case 'k':
- case 'l':
- case 'm':
- case 'n':
- case 'o':
- case 'p':
- case 'q':
- case 'r':
- case 's':
- case 't':
- case 'u':
- case 'v':
- case 'w':
- case 'x':
- case 'y':
- case 'z': goto yy51;
- case ':': goto yy53;
- default: goto yy47;
- }
-yy53: yych = *++YYCURSOR;
- switch(yych){
- case '.':
- case '/':
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9':
- case ':':
- case ';':
- case '<':
- case '=':
- case '>':
- case '?':
- case '@':
- case 'A':
- case 'B':
- case 'C':
- case 'D':
- case 'E':
- case 'F':
- case 'G':
- case 'H':
- case 'I':
- case 'J':
- case 'K':
- case 'L':
- case 'M':
- case 'N':
- case 'O':
- case 'P':
- case 'Q':
- case 'R':
- case 'S':
- case 'T':
- case 'U':
- case 'V':
- case 'W':
- case 'X':
- case 'Y':
- case 'Z':
- case '[':
- case '\\':
- case ']':
- case '^':
- case '_': case 'a':
- case 'b':
- case 'c':
- case 'd':
- case 'e':
- case 'f':
- case 'g':
- case 'h':
- case 'i':
- case 'j':
- case 'k':
- case 'l':
- case 'm':
- case 'n':
- case 'o':
- case 'p':
- case 'q':
- case 'r':
- case 's':
- case 't':
- case 'u':
- case 'v':
- case 'w':
- case 'x':
- case 'y':
- case 'z': goto yy54;
- default: goto yy47;
- }
-yy54: ++YYCURSOR;
- if((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
- yych = *YYCURSOR;
- goto yy55;
-yy55: switch(yych){
- case 0x0A: goto yy56;
- case 0x0D: goto yy58;
- case '.':
- case '/':
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9':
- case ':':
- case ';':
- case '<':
- case '=':
- case '>':
- case '?':
- case '@':
- case 'A':
- case 'B':
- case 'C':
- case 'D':
- case 'E':
- case 'F':
- case 'G':
- case 'H':
- case 'I':
- case 'J':
- case 'K':
- case 'L':
- case 'M':
- case 'N':
- case 'O':
- case 'P':
- case 'Q':
- case 'R':
- case 'S':
- case 'T':
- case 'U':
- case 'V':
- case 'W':
- case 'X':
- case 'Y':
- case 'Z':
- case '[':
- case '\\':
- case ']':
- case '^':
- case '_': case 'a':
- case 'b':
- case 'c':
- case 'd':
- case 'e':
- case 'f':
- case 'g':
- case 'h':
- case 'i':
- case 'j':
- case 'k':
- case 'l':
- case 'm':
- case 'n':
- case 'o':
- case 'p':
- case 'q':
- case 'r':
- case 's':
- case 't':
- case 'u':
- case 'v':
- case 'w':
- case 'x':
- case 'y':
- case 'z': goto yy54;
- default: goto yy47;
- }
-yy56: ++YYCURSOR;
- goto yy57;
-yy57:
-#line 396 "bytecode.re"
-{ CHK_NL(YYCURSOR);
- goto Directive; }
-#line 899 "<stdout>"
-yy58: ++YYCURSOR;
- switch((yych = *YYCURSOR)) {
- case 0x0A: goto yy56;
- default: goto yy47;
- }
-}
-#line 402 "bytecode.re"
-
-
- }
-
-Comment:
- {
- YYTOKEN = YYCURSOR;
-
-
-#line 916 "<stdout>"
-{
- YYCTYPE yych;
- goto yy59;
- ++YYCURSOR;
-yy59:
- if((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
- yych = *YYCURSOR;
- switch(yych){
- case 0x00: goto yy61;
- case 0x0A: goto yy62;
- case 0x0D: goto yy64;
- default: goto yy66;
- }
-yy61:yy62: ++YYCURSOR;
- goto yy63;
-yy63:
-#line 412 "bytecode.re"
-{ CHK_NL(YYCURSOR);
- goto Document; }
-#line 936 "<stdout>"
-yy64: ++YYCURSOR;
- switch((yych = *YYCURSOR)) {
- case 0x0A: goto yy67;
- default: goto yy65;
- }
-yy65:
-#line 415 "bytecode.re"
-{ goto Comment; }
-#line 945 "<stdout>"
-yy66: yych = *++YYCURSOR;
- goto yy65;
-yy67: ++YYCURSOR;
- yych = *YYCURSOR;
- goto yy63;
-}
-#line 417 "bytecode.re"
-
-
- }
-
-Scalar:
- {
- int idx = 0;
- int cap = 100;
- char *str = S_ALLOC_N( char, cap );
- char *tok;
-
- str[0] = '\0';
-
-Scalar2:
- tok = YYCURSOR;
-
-
-#line 970 "<stdout>"
-{
- YYCTYPE yych;
- goto yy68;
- ++YYCURSOR;
-yy68:
- if((YYLIMIT - YYCURSOR) < 3) YYFILL(3);
- yych = *YYCURSOR;
- switch(yych){
- case 0x00: goto yy74;
- case 0x0A: goto yy70;
- case 0x0D: goto yy72;
- default: goto yy76;
- }
-yy70: ++YYCURSOR;
- switch((yych = *YYCURSOR)) {
- case 'C': goto yy78;
- case 'N': goto yy80;
- case 'Z': goto yy83;
- default: goto yy71;
- }
-yy71:
-#line 461 "bytecode.re"
-{ YYCURSOR = tok;
- goto ScalarEnd;
- }
-#line 996 "<stdout>"
-yy72: ++YYCURSOR;
- switch((yych = *YYCURSOR)) {
- case 0x0A: goto yy77;
- default: goto yy73;
- }
-yy73:
-#line 469 "bytecode.re"
-{ CAT(str, cap, idx, tok[0]);
- goto Scalar2;
- }
-#line 1007 "<stdout>"
-yy74: ++YYCURSOR;
- goto yy75;
-yy75:
-#line 465 "bytecode.re"
-{ YYCURSOR = tok;
- goto ScalarEnd;
- }
-#line 1015 "<stdout>"
-yy76: yych = *++YYCURSOR;
- goto yy73;
-yy77: yych = *++YYCURSOR;
- switch(yych){
- case 'C': goto yy78;
- case 'N': goto yy80;
- case 'Z': goto yy83;
- default: goto yy71;
- }
-yy78: ++YYCURSOR;
- goto yy79;
-yy79:
-#line 435 "bytecode.re"
-{ CHK_NL(tok+1);
- goto Scalar2; }
-#line 1031 "<stdout>"
-yy80: ++YYCURSOR;
- if(YYLIMIT == YYCURSOR) YYFILL(1);
- yych = *YYCURSOR;
- goto yy81;
-yy81: switch(yych){
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': goto yy80;
- default: goto yy82;
- }
-yy82:
-#line 438 "bytecode.re"
-{ CHK_NL(tok+1);
- if ( tok + 2 < YYCURSOR )
- {
- char *count = tok + 2;
- int total = strtod( count, NULL );
- int i;
- for ( i = 0; i < total; i++ )
- {
- CAT(str, cap, idx, '\n');
- }
- }
- else
- {
- CAT(str, cap, idx, '\n');
- }
- goto Scalar2;
- }
-#line 1068 "<stdout>"
-yy83: ++YYCURSOR;
- goto yy84;
-yy84:
-#line 456 "bytecode.re"
-{ CHK_NL(tok+1);
- CAT(str, cap, idx, '\0');
- goto Scalar2;
- }
-#line 1077 "<stdout>"
-}
-#line 473 "bytecode.re"
-
-
-ScalarEnd:
- {
- SyckNode *n = syck_alloc_str();
- n->data.str->ptr = str;
- n->data.str->len = idx;
- sycklval->nodeData = n;
- POP_LEVEL();
- if ( parser->implicit_typing == 1 )
- {
- try_tag_implicit( sycklval->nodeData, parser->taguri_expansion );
- }
- return YAML_PLAIN;
- }
- }
-
-}
-
-char *
-get_inline( SyckParser *parser )
-{
- int idx = 0;
- int cap = 100;
- char *str = S_ALLOC_N( char, cap );
- char *tok;
-
- str[0] = '\0';
-
-Inline:
- {
- tok = YYCURSOR;
-
-
-#line 1114 "<stdout>"
-{
- YYCTYPE yych;
- goto yy85;
- ++YYCURSOR;
-yy85:
- if((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
- yych = *YYCURSOR;
- switch(yych){
- case 0x00: goto yy91;
- case 0x0A: goto yy87;
- case 0x0D: goto yy89;
- default: goto yy93;
- }
-yy87: ++YYCURSOR;
- goto yy88;
-yy88:
-#line 508 "bytecode.re"
-{ CHK_NL(YYCURSOR);
- return str; }
-#line 1134 "<stdout>"
-yy89: ++YYCURSOR;
- switch((yych = *YYCURSOR)) {
- case 0x0A: goto yy94;
- default: goto yy90;
- }
-yy90:
-#line 515 "bytecode.re"
-{ CAT(str, cap, idx, tok[0]);
- goto Inline;
- }
-#line 1145 "<stdout>"
-yy91: ++YYCURSOR;
- goto yy92;
-yy92:
-#line 511 "bytecode.re"
-{ YYCURSOR = tok;
- return str;
- }
-#line 1153 "<stdout>"
-yy93: yych = *++YYCURSOR;
- goto yy90;
-yy94: ++YYCURSOR;
- yych = *YYCURSOR;
- goto yy88;
-}
-#line 519 "bytecode.re"
-
-
- }
-
-}
-
diff --git a/ext/syck/depend b/ext/syck/depend
deleted file mode 100644
index 3eec4de72a..0000000000
--- a/ext/syck/depend
+++ /dev/null
@@ -1,12 +0,0 @@
-ruby_headers = $(hdrdir)/ruby.h $(topdir)/config.h $(hdrdir)/defines.h \
- $(hdrdir)/missing.h $(hdrdir)/intern.h $(hdrdir)/st.h
-bytecode.o: bytecode.c syck.h gram.h $(ruby_headers)
-emitter.o: emitter.c syck.h $(ruby_headers)
-gram.o: gram.c syck.h $(hdrdir)/st.h
-handler.o: handler.c syck.h $(ruby_headers)
-implicit.o: implicit.c syck.h $(ruby_headers)
-node.o: node.c syck.h $(ruby_headers)
-rubyext.o: rubyext.c syck.h $(ruby_headers)
-syck.o: syck.c syck.h $(ruby_headers)
-token.o: token.c syck.h gram.h $(ruby_headers)
-yaml2byte.o: yaml2byte.c syck.h yamlbyte.h $(ruby_headers)
diff --git a/ext/syck/emitter.c b/ext/syck/emitter.c
deleted file mode 100644
index af0d7891f8..0000000000
--- a/ext/syck/emitter.c
+++ /dev/null
@@ -1,1247 +0,0 @@
-/*
- * emitter.c
- *
- * $Author$
- *
- * Copyright (C) 2003 why the lucky stiff
- *
- * All Base64 code from Ruby's pack.c.
- * Ruby is Copyright (C) 1993-2007 Yukihiro Matsumoto
- */
-#include "ruby/ruby.h"
-
-#include <stdio.h>
-#include <string.h>
-
-#include "syck.h"
-
-#define DEFAULT_ANCHOR_FORMAT "id%03d"
-
-const char hex_table[] =
-"0123456789ABCDEF";
-static char b64_table[] =
-"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
-
-/*
- * Built-in base64 (from Ruby's pack.c)
- */
-char *
-syck_base64enc( char *s, long len )
-{
- long i = 0;
- int padding = '=';
- char *buff = S_ALLOC_N(char, len * 4 / 3 + 6);
-
- while (len >= 3) {
- buff[i++] = b64_table[077 & (*s >> 2)];
- buff[i++] = b64_table[077 & (((*s << 4) & 060) | ((s[1] >> 4) & 017))];
- buff[i++] = b64_table[077 & (((s[1] << 2) & 074) | ((s[2] >> 6) & 03))];
- buff[i++] = b64_table[077 & s[2]];
- s += 3;
- len -= 3;
- }
- if (len == 2) {
- buff[i++] = b64_table[077 & (*s >> 2)];
- buff[i++] = b64_table[077 & (((*s << 4) & 060) | ((s[1] >> 4) & 017))];
- buff[i++] = b64_table[077 & (((s[1] << 2) & 074) | (('\0' >> 6) & 03))];
- buff[i++] = padding;
- }
- else if (len == 1) {
- buff[i++] = b64_table[077 & (*s >> 2)];
- buff[i++] = b64_table[077 & (((*s << 4) & 060) | (('\0' >> 4) & 017))];
- buff[i++] = padding;
- buff[i++] = padding;
- }
- buff[i++] = '\n';
- return buff;
-}
-
-char *
-syck_base64dec( char *s, long len )
-{
- int a = -1,b = -1,c = 0,d;
- static int first = 1;
- static int b64_xtable[256];
- char *ptr = syck_strndup( s, len );
- char *end = ptr;
- char *send = s + len;
-
- if (first) {
- int i;
- first = 0;
-
- for (i = 0; i < 256; i++) {
- b64_xtable[i] = -1;
- }
- for (i = 0; i < 64; i++) {
- b64_xtable[(int)b64_table[i]] = i;
- }
- }
- while (s < send) {
- while (s[0] == '\r' || s[0] == '\n') { s++; }
- if ((a = b64_xtable[(int)s[0]]) == -1) break;
- if ((b = b64_xtable[(int)s[1]]) == -1) break;
- if ((c = b64_xtable[(int)s[2]]) == -1) break;
- if ((d = b64_xtable[(int)s[3]]) == -1) break;
- *end++ = a << 2 | b >> 4;
- *end++ = b << 4 | c >> 2;
- *end++ = c << 6 | d;
- s += 4;
- }
- if (a != -1 && b != -1) {
- if (s + 2 < send && s[2] == '=')
- *end++ = a << 2 | b >> 4;
- if (c != -1 && s + 3 < send && s[3] == '=') {
- *end++ = a << 2 | b >> 4;
- *end++ = b << 4 | c >> 2;
- }
- }
- *end = '\0';
- /*RSTRING_LEN(buf) = ptr - RSTRING_PTR(buf);*/
- return ptr;
-}
-
-/*
- * Allocate an emitter
- */
-SyckEmitter *
-syck_new_emitter(void)
-{
- SyckEmitter *e;
- e = S_ALLOC( SyckEmitter );
- e->headless = 0;
- e->use_header = 0;
- e->use_version = 0;
- e->sort_keys = 0;
- e->anchor_format = NULL;
- e->explicit_typing = 0;
- e->best_width = 80;
- e->style = scalar_none;
- e->stage = doc_open;
- e->indent = 2;
- e->level = -1;
- e->anchors = NULL;
- e->markers = NULL;
- e->anchored = NULL;
- e->bufsize = SYCK_BUFFERSIZE;
- e->buffer = NULL;
- e->marker = NULL;
- e->bufpos = 0;
- e->emitter_handler = NULL;
- e->output_handler = NULL;
- e->lvl_idx = 0;
- e->lvl_capa = ALLOC_CT;
- e->levels = S_ALLOC_N( SyckLevel, e->lvl_capa );
- syck_emitter_reset_levels( e );
- e->bonus = NULL;
- return e;
-}
-
-int
-syck_st_free_anchors( char *key, char *name, char *arg )
-{
- S_FREE( name );
- return ST_CONTINUE;
-}
-
-void
-syck_emitter_st_free( SyckEmitter *e )
-{
- /*
- * Free the anchor tables
- */
- if ( e->anchors != NULL )
- {
- st_foreach( e->anchors, syck_st_free_anchors, 0 );
- st_free_table( e->anchors );
- e->anchors = NULL;
- }
-
- if ( e->anchored != NULL )
- {
- st_free_table( e->anchored );
- e->anchored = NULL;
- }
-
- /*
- * Free the markers tables
- */
- if ( e->markers != NULL )
- {
- st_free_table( e->markers );
- e->markers = NULL;
- }
-}
-
-SyckLevel *
-syck_emitter_current_level( SyckEmitter *e )
-{
- return &e->levels[e->lvl_idx-1];
-}
-
-SyckLevel *
-syck_emitter_parent_level( SyckEmitter *e )
-{
- return &e->levels[e->lvl_idx-2];
-}
-
-void
-syck_emitter_pop_level( SyckEmitter *e )
-{
- ASSERT( e != NULL );
-
- /* The root level should never be popped */
- if ( e->lvl_idx <= 1 ) return;
-
- e->lvl_idx -= 1;
- free( e->levels[e->lvl_idx].domain );
-}
-
-void
-syck_emitter_add_level( SyckEmitter *e, int len, enum syck_level_status status )
-{
- ASSERT( e != NULL );
- if ( e->lvl_idx + 1 > e->lvl_capa )
- {
- e->lvl_capa += ALLOC_CT;
- S_REALLOC_N( e->levels, SyckLevel, e->lvl_capa );
- }
-
- ASSERT( len > e->levels[e->lvl_idx-1].spaces );
- e->levels[e->lvl_idx].spaces = len;
- e->levels[e->lvl_idx].ncount = 0;
- e->levels[e->lvl_idx].domain = syck_strndup( e->levels[e->lvl_idx-1].domain, strlen( e->levels[e->lvl_idx-1].domain ) );
- e->levels[e->lvl_idx].status = status;
- e->levels[e->lvl_idx].anctag = 0;
- e->lvl_idx += 1;
-}
-
-void
-syck_emitter_reset_levels( SyckEmitter *e )
-{
- while ( e->lvl_idx > 1 )
- {
- syck_emitter_pop_level( e );
- }
-
- if ( e->lvl_idx < 1 )
- {
- e->lvl_idx = 1;
- e->levels[0].spaces = -1;
- e->levels[0].ncount = 0;
- e->levels[0].domain = syck_strndup( "", 0 );
- e->levels[0].anctag = 0;
- }
- e->levels[0].status = syck_lvl_header;
-}
-
-void
-syck_emitter_handler( SyckEmitter *e, SyckEmitterHandler hdlr )
-{
- e->emitter_handler = hdlr;
-}
-
-void
-syck_output_handler( SyckEmitter *e, SyckOutputHandler hdlr )
-{
- e->output_handler = hdlr;
-}
-
-void
-syck_free_emitter( SyckEmitter *e )
-{
- /*
- * Free tables
- */
- syck_emitter_st_free( e );
- syck_emitter_reset_levels( e );
- S_FREE( e->levels[0].domain );
- S_FREE( e->levels );
- if ( e->buffer != NULL )
- {
- S_FREE( e->buffer );
- }
- S_FREE( e );
-}
-
-void
-syck_emitter_clear( SyckEmitter *e )
-{
- if ( e->buffer == NULL )
- {
- e->buffer = S_ALLOC_N( char, e->bufsize );
- S_MEMZERO( e->buffer, char, e->bufsize );
- }
- e->buffer[0] = '\0';
- e->marker = e->buffer;
- e->bufpos = 0;
-}
-
-/*
- * Raw write to the emitter buffer.
- */
-void
-syck_emitter_write( SyckEmitter *e, const char *str, long len )
-{
- long at;
- ASSERT( str != NULL );
- if ( e->buffer == NULL )
- {
- syck_emitter_clear( e );
- }
-
- /*
- * Flush if at end of buffer
- */
- at = e->marker - e->buffer;
- if ( len + at >= (long)e->bufsize )
- {
- syck_emitter_flush( e, 0 );
- for (;;) {
- long rest = e->bufsize - (e->marker - e->buffer);
- if (len <= rest) break;
- S_MEMCPY( e->marker, str, char, rest );
- e->marker += rest;
- str += rest;
- len -= rest;
- syck_emitter_flush( e, 0 );
- }
- }
-
- /*
- * Write to buffer
- */
- S_MEMCPY( e->marker, str, char, len );
- e->marker += len;
-}
-
-/*
- * Write a chunk of data out.
- */
-void
-syck_emitter_flush( SyckEmitter *e, long check_room )
-{
- /*
- * Check for enough space in the buffer for check_room length.
- */
- if ( check_room > 0 )
- {
- if ( (long)e->bufsize > ( e->marker - e->buffer ) + check_room )
- {
- return;
- }
- }
- else
- {
- check_room = e->bufsize;
- }
-
- /*
- * Commit buffer.
- */
- if ( check_room > e->marker - e->buffer )
- {
- check_room = e->marker - e->buffer;
- }
- (e->output_handler)( e, e->buffer, check_room );
- e->bufpos += check_room;
- e->marker -= check_room;
-}
-
-/*
- * Start emitting from the given node, check for anchoring and then
- * issue the callback to the emitter handler.
- */
-void
-syck_emit( SyckEmitter *e, st_data_t n )
-{
- SYMID oid;
- char *anchor_name = NULL;
- int indent = 0;
- long x = 0;
- SyckLevel *lvl = syck_emitter_current_level( e );
-
- /*
- * Determine headers.
- */
- if ( e->stage == doc_open && ( e->headless == 0 || e->use_header == 1 ) )
- {
- if ( e->use_version == 1 )
- {
- char *header = S_ALLOC_N( char, 64 );
- S_MEMZERO( header, char, 64 );
- sprintf( header, "--- %%YAML:%d.%d ", SYCK_YAML_MAJOR, SYCK_YAML_MINOR );
- syck_emitter_write( e, header, strlen( header ) );
- S_FREE( header );
- }
- else
- {
- syck_emitter_write( e, "--- ", 4 );
- }
- e->stage = doc_processing;
- }
-
- /* Add new level */
- if ( lvl->spaces >= 0 ) {
- indent = lvl->spaces + e->indent;
- }
- syck_emitter_add_level( e, indent, syck_lvl_open );
- lvl = syck_emitter_current_level( e );
-
- /* Look for anchor */
- if ( e->anchors != NULL &&
- st_lookup( e->markers, n, (st_data_t *)&oid ) &&
- st_lookup( e->anchors, (st_data_t)oid, (void *)&anchor_name ) )
- {
- if ( e->anchored == NULL )
- {
- e->anchored = st_init_numtable();
- }
-
- if ( ! st_lookup( e->anchored, (st_data_t)anchor_name, (st_data_t *)&x ) )
- {
- char *an = S_ALLOC_N( char, strlen( anchor_name ) + 3 );
- sprintf( an, "&%s ", anchor_name );
- syck_emitter_write( e, an, strlen( anchor_name ) + 2 );
- free( an );
-
- x = 1;
- st_insert( e->anchored, (st_data_t)anchor_name, (st_data_t)x );
- lvl->anctag = 1;
- }
- else
- {
- char *an = S_ALLOC_N( char, strlen( anchor_name ) + 2 );
- sprintf( an, "*%s", anchor_name );
- syck_emitter_write( e, an, strlen( anchor_name ) + 1 );
- free( an );
-
- goto end_emit;
- }
- }
-
- (e->emitter_handler)( e, n );
-
- /* Pop the level */
-end_emit:
- syck_emitter_pop_level( e );
- if ( e->lvl_idx == 1 ) {
- syck_emitter_write( e, "\n", 1 );
- e->headless = 0;
- e->stage = doc_open;
- }
-}
-
-/*
- * Determine what tag needs to be written, based on the taguri of the node
- * and the implicit tag which would be assigned to this node. If a tag is
- * required, write the tag.
- */
-void syck_emit_tag( SyckEmitter *e, const char *tag, const char *ignore )
-{
- SyckLevel *lvl;
- if ( tag == NULL ) return;
- if ( ignore != NULL && syck_tagcmp( tag, ignore ) == 0 && e->explicit_typing == 0 ) return;
- lvl = syck_emitter_current_level( e );
-
- /* implicit */
- if ( strlen( tag ) == 0 ) {
- syck_emitter_write( e, "! ", 2 );
-
- /* global types */
- } else if ( strncmp( tag, "tag:", 4 ) == 0 ) {
- int taglen = (int)strlen( tag );
- syck_emitter_write( e, "!", 1 );
- if ( strncmp( tag + 4, YAML_DOMAIN, strlen( YAML_DOMAIN ) ) == 0 ) {
- int skip = 4 + strlen( YAML_DOMAIN ) + 1;
- syck_emitter_write( e, tag + skip, taglen - skip );
- } else {
- const char *subd = tag + 4;
- while ( *subd != ':' && *subd != '\0' ) subd++;
- if ( *subd == ':' ) {
- if ( subd - tag > ( (long)( strlen( YAML_DOMAIN ) + 5 )) &&
- strncmp( subd - strlen( YAML_DOMAIN ), YAML_DOMAIN, strlen( YAML_DOMAIN ) ) == 0 ) {
- syck_emitter_write( e, tag + 4, subd - strlen( YAML_DOMAIN ) - ( tag + 4 ) - 1 );
- syck_emitter_write( e, "/", 1 );
- syck_emitter_write( e, subd + 1, ( tag + taglen ) - ( subd + 1 ) );
- } else {
- syck_emitter_write( e, tag + 4, subd - ( tag + 4 ) );
- syck_emitter_write( e, "/", 1 );
- syck_emitter_write( e, subd + 1, ( tag + taglen ) - ( subd + 1 ) );
- }
- } else {
- /* TODO: Invalid tag (no colon after domain) */
- return;
- }
- }
- syck_emitter_write( e, " ", 1 );
-
- /* private types */
- } else if ( strncmp( tag, "x-private:", 10 ) == 0 ) {
- syck_emitter_write( e, "!!", 2 );
- syck_emitter_write( e, tag + 10, strlen( tag ) - 10 );
- syck_emitter_write( e, " ", 1 );
- }
- lvl->anctag = 1;
-}
-
-/*
- * Emit a newline and an appropriately spaced indent.
- */
-void syck_emit_indent( SyckEmitter *e )
-{
- int i;
- SyckLevel *lvl = syck_emitter_current_level( e );
- if ( e->bufpos == 0 && ( e->marker - e->buffer ) == 0 ) return;
- if ( lvl->spaces >= 0 ) {
- char *spcs = S_ALLOC_N( char, lvl->spaces + 2 );
-
- spcs[0] = '\n'; spcs[lvl->spaces + 1] = '\0';
- for ( i = 0; i < lvl->spaces; i++ ) spcs[i+1] = ' ';
- syck_emitter_write( e, spcs, lvl->spaces + 1 );
- free( spcs );
- }
-}
-
-/* Clear the scan */
-#define SCAN_NONE 0
-/* All printable characters? */
-#define SCAN_NONPRINT 1
-/* Any indented lines? */
-#define SCAN_INDENTED 2
-/* Larger than the requested width? */
-#define SCAN_WIDE 4
-/* Opens or closes with whitespace? */
-#define SCAN_WHITEEDGE 8
-/* Contains a newline */
-#define SCAN_NEWLINE 16
-/* Contains a single quote */
-#define SCAN_SINGLEQ 32
-/* Contains a double quote */
-#define SCAN_DOUBLEQ 64
-/* Starts with a token */
-#define SCAN_INDIC_S 128
-/* Contains a flow indicator */
-#define SCAN_INDIC_C 256
-/* Ends without newlines */
-#define SCAN_NONL_E 512
-/* Ends with many newlines */
-#define SCAN_MANYNL_E 1024
-/* Contains flow map indicators */
-#define SCAN_FLOWMAP 2048
-/* Contains flow seq indicators */
-#define SCAN_FLOWSEQ 4096
-/* Contains a valid doc separator */
-#define SCAN_DOCSEP 8192
-
-/*
- * Basic printable test for LATIN-1 characters.
- */
-int
-syck_scan_scalar( int req_width, const char *cursor, long len )
-{
- long i = 0, start = 0;
- int flags = SCAN_NONE;
-
- if ( len < 1 ) return flags;
-
- /* c-indicators from the spec */
- if ( cursor[0] == '[' || cursor[0] == ']' ||
- cursor[0] == '{' || cursor[0] == '}' ||
- cursor[0] == '!' || cursor[0] == '*' ||
- cursor[0] == '&' || cursor[0] == '|' ||
- cursor[0] == '>' || cursor[0] == '\'' ||
- cursor[0] == '"' || cursor[0] == '#' ||
- cursor[0] == '%' || cursor[0] == '@' ||
- cursor[0] == '&' ) {
- flags |= SCAN_INDIC_S;
- }
- if ( ( cursor[0] == '-' || cursor[0] == ':' ||
- cursor[0] == '?' || cursor[0] == ',' ) &&
- ( len == 1 || cursor[1] == ' ' || cursor[1] == '\n' ) )
- {
- flags |= SCAN_INDIC_S;
- }
-
- /* whitespace edges */
- if ( cursor[len-1] != '\n' ) {
- flags |= SCAN_NONL_E;
- } else if ( len > 1 && cursor[len-2] == '\n' ) {
- flags |= SCAN_MANYNL_E;
- }
- if (
- ( len > 0 && ( cursor[0] == ' ' || cursor[0] == '\t' || cursor[0] == '\n' || cursor[0] == '\r' ) ) ||
- ( len > 1 && ( cursor[len-1] == ' ' || cursor[len-1] == '\t' ) )
- ) {
- flags |= SCAN_WHITEEDGE;
- }
-
- /* opening doc sep */
- if ( len >= 3 && strncmp( cursor, "---", 3 ) == 0 )
- flags |= SCAN_DOCSEP;
-
- /* scan string */
- for ( i = 0; i < len; i++ ) {
-
- if ( ! ( cursor[i] == 0x9 ||
- cursor[i] == 0xA ||
- cursor[i] == 0xD ||
- ( cursor[i] >= 0x20 && cursor[i] <= 0x7E ) )
- ) {
- flags |= SCAN_NONPRINT;
- }
- else if ( cursor[i] == '\n' ) {
- flags |= SCAN_NEWLINE;
- if ( len - i >= 3 && strncmp( &cursor[i+1], "---", 3 ) == 0 )
- flags |= SCAN_DOCSEP;
- if ( cursor[i+1] == ' ' || cursor[i+1] == '\t' )
- flags |= SCAN_INDENTED;
- if ( req_width > 0 && i - start > req_width )
- flags |= SCAN_WIDE;
- start = i;
- }
- else if ( cursor[i] == '\'' )
- {
- flags |= SCAN_SINGLEQ;
- }
- else if ( cursor[i] == '"' )
- {
- flags |= SCAN_DOUBLEQ;
- }
- else if ( cursor[i] == ']' )
- {
- flags |= SCAN_FLOWSEQ;
- }
- else if ( cursor[i] == '}' )
- {
- flags |= SCAN_FLOWMAP;
- }
- /* remember, if plain collections get implemented, to add nb-plain-flow-char */
- else if ( ( cursor[i] == ' ' && cursor[i+1] == '#' ) ||
- ( cursor[i] == ':' &&
- ( cursor[i+1] == ' ' || cursor[i+1] == '\n' || i == len - 1 ) ) )
- {
- flags |= SCAN_INDIC_C;
- }
- else if ( cursor[i] == ',' &&
- ( cursor[i+1] == ' ' || cursor[i+1] == '\n' || i == len - 1 ) )
- {
- flags |= SCAN_FLOWMAP;
- flags |= SCAN_FLOWSEQ;
- }
- }
-
- /* printf( "---STR---\n%s\nFLAGS: %d\n", cursor, flags ); */
- return flags;
-}
-/*
- * All scalars should be emitted through this function, which determines an appropriate style,
- * tag and indent.
- */
-void syck_emit_scalar( SyckEmitter *e, const char *tag, enum scalar_style force_style, int force_indent, int force_width,
- char keep_nl, const char *str, long len )
-{
- enum scalar_style favor_style = scalar_literal;
- SyckLevel *parent = syck_emitter_parent_level( e );
- SyckLevel *lvl = syck_emitter_current_level( e );
- int scan = 0;
- const char *match_implicit;
- char *implicit;
-
- if ( str == NULL ) str = "";
-
- /* No empty nulls as map keys */
- if ( len == 0 && ( parent->status == syck_lvl_map || parent->status == syck_lvl_imap ) &&
- parent->ncount % 2 == 1 && syck_tagcmp( tag, "tag:yaml.org,2002:null" ) == 0 )
- {
- str = "~";
- len = 1;
- }
-
- scan = syck_scan_scalar( force_width, str, len );
- match_implicit = syck_match_implicit( str, len );
-
- /* quote strings which default to implicits */
- implicit = syck_taguri( YAML_DOMAIN, match_implicit, (int)strlen( match_implicit ) );
- if ( syck_tagcmp( tag, implicit ) != 0 && syck_tagcmp( tag, "tag:yaml.org,2002:str" ) == 0 ) {
- force_style = scalar_2quote;
- } else {
- /* complex key */
- if ( parent->status == syck_lvl_map && parent->ncount % 2 == 1 &&
- ( !( tag == NULL ||
- ( implicit != NULL && syck_tagcmp( tag, implicit ) == 0 && e->explicit_typing == 0 ) ) ) )
- {
- syck_emitter_write( e, "? ", 2 );
- parent->status = syck_lvl_mapx;
- }
- syck_emit_tag( e, tag, implicit );
- }
- S_FREE( implicit );
-
- /* if still arbitrary, sniff a good block style. */
- if ( force_style == scalar_none ) {
- if ( scan & SCAN_NEWLINE ) {
- force_style = scalar_literal;
- } else {
- force_style = scalar_plain;
- }
- }
-
- if ( e->style == scalar_fold ) {
- favor_style = scalar_fold;
- }
-
- /* Determine block style */
- if ( scan & SCAN_NONPRINT ) {
- force_style = scalar_2quote;
- } else if ( scan & SCAN_WHITEEDGE ) {
- force_style = scalar_2quote;
- } else if ( force_style != scalar_fold && ( scan & SCAN_INDENTED ) ) {
- force_style = scalar_literal;
- } else if ( force_style == scalar_plain && ( scan & SCAN_NEWLINE ) ) {
- force_style = favor_style;
- } else if ( force_style == scalar_plain && parent->status == syck_lvl_iseq && ( scan & SCAN_FLOWSEQ ) ) {
- force_style = scalar_2quote;
- } else if ( force_style == scalar_plain && parent->status == syck_lvl_imap && ( scan & SCAN_FLOWMAP ) ) {
- force_style = scalar_2quote;
- /* } else if ( force_style == scalar_fold && ( ! ( scan & SCAN_WIDE ) ) ) {
- force_style = scalar_literal; */
- } else if ( force_style == scalar_plain && ( scan & SCAN_INDIC_S || scan & SCAN_INDIC_C ) ) {
- if ( scan & SCAN_NEWLINE ) {
- force_style = favor_style;
- } else {
- force_style = scalar_2quote;
- }
- }
-
- if ( force_indent > 0 ) {
- lvl->spaces = parent->spaces + force_indent;
- } else if ( scan & SCAN_DOCSEP ) {
- lvl->spaces = parent->spaces + e->indent;
- }
-
- /* For now, all ambiguous keys are going to be double-quoted */
- if ( ( parent->status == syck_lvl_map || parent->status == syck_lvl_mapx ) && parent->ncount % 2 == 1 ) {
- if ( force_style != scalar_plain ) {
- force_style = scalar_2quote;
- }
- }
-
- /* If the parent is an inline, double quote anything complex */
- if ( parent->status == syck_lvl_imap || parent->status == syck_lvl_iseq ) {
- if ( force_style != scalar_plain && force_style != scalar_1quote ) {
- force_style = scalar_2quote;
- }
- }
-
- /* Fix the ending newlines */
- if ( scan & SCAN_NONL_E ) {
- keep_nl = NL_CHOMP;
- } else if ( scan & SCAN_MANYNL_E ) {
- keep_nl = NL_KEEP;
- }
-
- /* Write the text node */
- switch ( force_style )
- {
- case scalar_1quote:
- syck_emit_1quoted( e, force_width, str, len );
- break;
-
- case scalar_none:
- case scalar_2quote:
- syck_emit_2quoted( e, force_width, str, len );
- break;
-
- case scalar_fold:
- syck_emit_folded( e, force_width, keep_nl, str, len );
- break;
-
- case scalar_literal:
- syck_emit_literal( e, keep_nl, str, len );
- break;
-
- case scalar_plain:
- syck_emitter_write( e, str, len );
- break;
- }
-
- if ( parent->status == syck_lvl_mapx )
- {
- syck_emitter_write( e, "\n", 1 );
- }
-}
-
-void
-syck_emitter_escape( SyckEmitter *e, const char *src, long len )
-{
- int i;
- for( i = 0; i < len; i++ )
- {
- if( (src[i] < 0x20) || (0x7E < src[i]) )
- {
- syck_emitter_write( e, "\\", 1 );
- if( '\0' == src[i] )
- syck_emitter_write( e, "0", 1 );
- else
- {
- syck_emitter_write( e, "x", 1 );
- syck_emitter_write( e, (const char *)hex_table + ((src[i] & 0xF0) >> 4), 1 );
- syck_emitter_write( e, (const char *)hex_table + (src[i] & 0x0F), 1 );
- }
- }
- else
- {
- syck_emitter_write( e, src + i, 1 );
- if( '\\' == src[i] )
- syck_emitter_write( e, "\\", 1 );
- }
- }
-}
-
-/*
- * Outputs a single-quoted block.
- */
-void
-syck_emit_1quoted( SyckEmitter *e, int width, const char *str, long len )
-{
- char do_indent = 0;
- const char *mark = str;
- const char *start = str;
- const char *end = str;
- syck_emitter_write( e, "'", 1 );
- while ( mark < str + len ) {
- if ( do_indent ) {
- syck_emit_indent( e );
- do_indent = 0;
- }
- switch ( *mark ) {
- case '\'': syck_emitter_write( e, "'", 1 ); break;
-
- case '\n':
- end = mark + 1;
- if ( *start != ' ' && *start != '\n' && *end != '\n' && *end != ' ' ) {
- syck_emitter_write( e, "\n\n", 2 );
- } else {
- syck_emitter_write( e, "\n", 1 );
- }
- do_indent = 1;
- start = mark + 1;
- break;
-
- case ' ':
- if ( width > 0 && *start != ' ' && mark - end > width ) {
- do_indent = 1;
- end = mark + 1;
- } else {
- syck_emitter_write( e, " ", 1 );
- }
- break;
-
- default:
- syck_emitter_write( e, mark, 1 );
- break;
- }
- mark++;
- }
- syck_emitter_write( e, "'", 1 );
-}
-
-/*
- * Outputs a double-quoted block.
- */
-void
-syck_emit_2quoted( SyckEmitter *e, int width, const char *str, long len )
-{
- char do_indent = 0;
- const char *mark = str;
- const char *start = str;
- const char *end = str;
- syck_emitter_write( e, "\"", 1 );
- while ( mark < str + len ) {
- if ( do_indent > 0 ) {
- if ( do_indent == 2 ) {
- syck_emitter_write( e, "\\", 1 );
- }
- syck_emit_indent( e );
- do_indent = 0;
- }
- switch ( *mark ) {
-
- /* Escape sequences allowed within double quotes. */
- case '"': syck_emitter_write( e, "\\\"", 2 ); break;
- case '\\': syck_emitter_write( e, "\\\\", 2 ); break;
- case '\0': syck_emitter_write( e, "\\0", 2 ); break;
- case '\a': syck_emitter_write( e, "\\a", 2 ); break;
- case '\b': syck_emitter_write( e, "\\b", 2 ); break;
- case '\f': syck_emitter_write( e, "\\f", 2 ); break;
- case '\r': syck_emitter_write( e, "\\r", 2 ); break;
- case '\t': syck_emitter_write( e, "\\t", 2 ); break;
- case '\v': syck_emitter_write( e, "\\v", 2 ); break;
- case 0x1b: syck_emitter_write( e, "\\e", 2 ); break;
-
- case '\n':
- end = mark + 1;
- syck_emitter_write( e, "\\n", 2 );
- do_indent = 2;
- start = mark + 1;
- if ( start < str + len && ( *start == ' ' || *start == '\n' ) ) {
- do_indent = 0;
- }
- break;
-
- case ' ':
- if ( width > 0 && *start != ' ' && mark - end > width ) {
- do_indent = 1;
- end = mark + 1;
- } else {
- syck_emitter_write( e, " ", 1 );
- }
- break;
-
- default:
- syck_emitter_escape( e, mark, 1 );
- break;
- }
- mark++;
- }
- syck_emitter_write( e, "\"", 1 );
-}
-
-/*
- * Outputs a literal block.
- */
-void
-syck_emit_literal( SyckEmitter *e, char keep_nl, const char *str, long len )
-{
- const char *mark = str;
- const char *start = str;
- const char *end = str;
- syck_emitter_write( e, "|", 1 );
- if ( keep_nl == NL_CHOMP ) {
- syck_emitter_write( e, "-", 1 );
- } else if ( keep_nl == NL_KEEP ) {
- syck_emitter_write( e, "+", 1 );
- }
- syck_emit_indent( e );
- while ( mark < str + len ) {
- if ( *mark == '\n' ) {
- end = mark;
- if ( *start != ' ' && *start != '\n' && *end != '\n' && *end != ' ' ) end += 1;
- syck_emitter_write( e, start, end - start );
- if ( mark + 1 == str + len ) {
- if ( keep_nl != NL_KEEP ) syck_emitter_write( e, "\n", 1 );
- } else {
- syck_emit_indent( e );
- }
- start = mark + 1;
- }
- mark++;
- }
- end = str + len;
- if ( start < end ) {
- syck_emitter_write( e, start, end - start );
- }
-}
-
-/*
- * Outputs a folded block.
- */
-void
-syck_emit_folded( SyckEmitter *e, int width, char keep_nl, const char *str, long len )
-{
- const char *mark = str;
- const char *start = str;
- const char *end = str;
- syck_emitter_write( e, ">", 1 );
- if ( keep_nl == NL_CHOMP ) {
- syck_emitter_write( e, "-", 1 );
- } else if ( keep_nl == NL_KEEP ) {
- syck_emitter_write( e, "+", 1 );
- }
- syck_emit_indent( e );
- if ( width <= 0 ) width = e->best_width;
- while ( mark < str + len ) {
- switch ( *mark ) {
- case '\n':
- syck_emitter_write( e, end, mark - end );
- end = mark + 1;
- if ( *start != ' ' && *start != '\n' && *end != '\n' && *end != ' ' ) {
- syck_emitter_write( e, "\n", 1 );
- }
- if ( mark + 1 == str + len ) {
- if ( keep_nl != NL_KEEP ) syck_emitter_write( e, "\n", 1 );
- } else {
- syck_emit_indent( e );
- }
- start = mark + 1;
- break;
-
- case ' ':
- if ( *start != ' ' ) {
- if ( mark - end > width ) {
- syck_emitter_write( e, end, mark - end );
- syck_emit_indent( e );
- end = mark + 1;
- }
- }
- break;
- }
- mark++;
- }
- if ( end < mark ) {
- syck_emitter_write( e, end, mark - end );
- }
-}
-
-/*
- * Begins emission of a sequence.
- */
-void syck_emit_seq( SyckEmitter *e, const char *tag, enum seq_style style )
-{
- SyckLevel *parent = syck_emitter_parent_level( e );
- SyckLevel *lvl = syck_emitter_current_level( e );
- syck_emit_tag( e, tag, "tag:yaml.org,2002:seq" );
- if ( style == seq_inline || ( parent->status == syck_lvl_imap || parent->status == syck_lvl_iseq ) ) {
- syck_emitter_write( e, "[", 1 );
- lvl->status = syck_lvl_iseq;
- } else {
- /* complex key */
- if ( parent->status == syck_lvl_map && parent->ncount % 2 == 1 ) {
- syck_emitter_write( e, "? ", 2 );
- parent->status = syck_lvl_mapx;
- }
- lvl->status = syck_lvl_seq;
- }
-}
-
-/*
- * Begins emission of a mapping.
- */
-void
-syck_emit_map( SyckEmitter *e, const char *tag, enum map_style style )
-{
- SyckLevel *parent = syck_emitter_parent_level( e );
- SyckLevel *lvl = syck_emitter_current_level( e );
- syck_emit_tag( e, tag, "tag:yaml.org,2002:map" );
- if ( style == map_inline || ( parent->status == syck_lvl_imap || parent->status == syck_lvl_iseq ) ) {
- syck_emitter_write( e, "{", 1 );
- lvl->status = syck_lvl_imap;
- } else {
- /* complex key */
- if ( parent->status == syck_lvl_map && parent->ncount % 2 == 1 ) {
- syck_emitter_write( e, "? ", 2 );
- parent->status = syck_lvl_mapx;
- }
- lvl->status = syck_lvl_map;
- }
-}
-
-/*
- * Handles emitting of a collection item (for both
- * sequences and maps)
- */
-void syck_emit_item( SyckEmitter *e, st_data_t n )
-{
- SyckLevel *lvl = syck_emitter_current_level( e );
- switch ( lvl->status )
- {
- case syck_lvl_seq:
- {
- SyckLevel *parent = syck_emitter_parent_level( e );
-
- /* seq-in-map shortcut -- the lvl->anctag check should be unneccesary but
- * there is a nasty shift/reduce in the parser on this point and
- * i'm not ready to tickle it. */
- if ( lvl->anctag == 0 && parent->status == syck_lvl_map && lvl->ncount == 0 ) {
- lvl->spaces = parent->spaces;
- }
-
- /* seq-in-seq shortcut */
- else if ( lvl->anctag == 0 && parent->status == syck_lvl_seq && lvl->ncount == 0 ) {
- int spcs = ( lvl->spaces - parent->spaces ) - 2;
- if ( spcs >= 0 ) {
- int i = 0;
- for ( i = 0; i < spcs; i++ ) {
- syck_emitter_write( e, " ", 1 );
- }
- syck_emitter_write( e, "- ", 2 );
- break;
- }
- }
-
- syck_emit_indent( e );
- syck_emitter_write( e, "- ", 2 );
- }
- break;
-
- case syck_lvl_iseq:
- {
- if ( lvl->ncount > 0 ) {
- syck_emitter_write( e, ", ", 2 );
- }
- }
- break;
-
- case syck_lvl_map:
- {
- SyckLevel *parent = syck_emitter_parent_level( e );
-
- /* map-in-seq shortcut */
- if ( lvl->anctag == 0 && parent->status == syck_lvl_seq && lvl->ncount == 0 ) {
- int spcs = ( lvl->spaces - parent->spaces ) - 2;
- if ( spcs >= 0 ) {
- int i = 0;
- for ( i = 0; i < spcs; i++ ) {
- syck_emitter_write( e, " ", 1 );
- }
- break;
- }
- }
-
- if ( lvl->ncount % 2 == 0 ) {
- syck_emit_indent( e );
- } else {
- syck_emitter_write( e, ": ", 2 );
- }
- }
- break;
-
- case syck_lvl_mapx:
- {
- if ( lvl->ncount % 2 == 0 ) {
- syck_emit_indent( e );
- lvl->status = syck_lvl_map;
- } else {
- int i;
- if ( lvl->spaces > 0 ) {
- char *spcs = S_ALLOC_N( char, lvl->spaces + 1 );
-
- spcs[lvl->spaces] = '\0';
- for ( i = 0; i < lvl->spaces; i++ ) spcs[i] = ' ';
- syck_emitter_write( e, spcs, lvl->spaces );
- S_FREE( spcs );
- }
- syck_emitter_write( e, ": ", 2 );
- }
- }
- break;
-
- case syck_lvl_imap:
- {
- if ( lvl->ncount > 0 ) {
- if ( lvl->ncount % 2 == 0 ) {
- syck_emitter_write( e, ", ", 2 );
- } else {
- syck_emitter_write( e, ": ", 2 );
- }
- }
- }
- break;
-
- default: break;
- }
- lvl->ncount++;
-
- syck_emit( e, n );
-}
-
-/*
- * Closes emission of a collection.
- */
-void syck_emit_end( SyckEmitter *e )
-{
- SyckLevel *lvl = syck_emitter_current_level( e );
- SyckLevel *parent = syck_emitter_parent_level( e );
- switch ( lvl->status )
- {
- case syck_lvl_seq:
- if ( lvl->ncount == 0 ) {
- syck_emitter_write( e, "[]\n", 3 );
- } else if ( parent->status == syck_lvl_mapx ) {
- syck_emitter_write( e, "\n", 1 );
- }
- break;
-
- case syck_lvl_iseq:
- syck_emitter_write( e, "]\n", 1 );
- break;
-
- case syck_lvl_map:
- if ( lvl->ncount == 0 ) {
- syck_emitter_write( e, "{}\n", 3 );
- } else if ( lvl->ncount % 2 == 1 ) {
- syck_emitter_write( e, ":\n", 1 );
- } else if ( parent->status == syck_lvl_mapx ) {
- syck_emitter_write( e, "\n", 1 );
- }
- break;
-
- case syck_lvl_imap:
- syck_emitter_write( e, "}\n", 1 );
- break;
-
- default: break;
- }
-}
-
-/*
- * Fill markers table with emitter nodes in the
- * soon-to-be-emitted tree.
- */
-SYMID
-syck_emitter_mark_node( SyckEmitter *e, st_data_t n )
-{
- SYMID oid = 0;
- char *anchor_name = NULL;
-
- /*
- * Ensure markers table is initialized.
- */
- if ( e->markers == NULL )
- {
- e->markers = st_init_numtable();
- }
-
- /*
- * Markers table initially marks the string position of the
- * object. Doesn't yet create an anchor, simply notes the
- * position.
- */
- if ( ! st_lookup( e->markers, n, (st_data_t *)&oid ) )
- {
- /*
- * Store all markers
- */
- oid = e->markers->num_entries + 1;
- st_insert( e->markers, n, (st_data_t)oid );
- }
- else
- {
- if ( e->anchors == NULL )
- {
- e->anchors = st_init_numtable();
- }
-
- if ( ! st_lookup( e->anchors, (st_data_t)oid, (void *)&anchor_name ) )
- {
- int idx = 0;
- const char *anc = ( e->anchor_format == NULL ? DEFAULT_ANCHOR_FORMAT : e->anchor_format );
-
- /*
- * Second time hitting this object, let's give it an anchor
- */
- idx = (int)(e->anchors->num_entries + 1);
- anchor_name = S_ALLOC_N( char, strlen( anc ) + 10 );
- S_MEMZERO( anchor_name, char, strlen( anc ) + 10 );
- sprintf( anchor_name, anc, idx );
-
- /*
- * Insert into anchors table
- */
- st_insert( e->anchors, (st_data_t)oid, (st_data_t)anchor_name );
- }
- }
- return oid;
-}
-
diff --git a/ext/syck/extconf.rb b/ext/syck/extconf.rb
deleted file mode 100644
index 6c10448c70..0000000000
--- a/ext/syck/extconf.rb
+++ /dev/null
@@ -1,5 +0,0 @@
-require 'mkmf'
-
-have_header( "st.h" )
-create_makefile( "syck" )
-
diff --git a/ext/syck/gram.c b/ext/syck/gram.c
deleted file mode 100644
index 8fe4e4f3b5..0000000000
--- a/ext/syck/gram.c
+++ /dev/null
@@ -1,1894 +0,0 @@
-/* A Bison parser, made by GNU Bison 1.875d. */
-
-/* Skeleton parser for Yacc-like parsing with Bison,
- Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA. */
-
-/* As a special exception, when this file is copied by Bison into a
- Bison output file, you may use that output file without restriction.
- This special exception was added by the Free Software Foundation
- in version 1.24 of Bison. */
-
-/* Written by Richard Stallman by simplifying the original so called
- ``semantic'' parser. */
-
-/* All symbols defined below should begin with yy or YY, to avoid
- infringing on user name space. This should be done even for local
- variables, as they might otherwise be expanded by user macros.
- There are some unavoidable exceptions within include files to
- define necessary library symbols; they are noted "INFRINGES ON
- USER NAME SPACE" below. */
-
-/* Identify Bison output. */
-#define YYBISON 1
-
-/* Skeleton name. */
-#define YYSKELETON_NAME "yacc.c"
-
-/* Pure parsers. */
-#define YYPURE 1
-
-/* Using locations. */
-#define YYLSP_NEEDED 0
-
-/* If NAME_PREFIX is specified substitute the variables and functions
- names. */
-#define yyparse syckparse
-#define yylex sycklex
-#define yyerror syckerror
-#define yylval sycklval
-#define yychar syckchar
-#define yydebug syckdebug
-#define yynerrs sycknerrs
-
-
-/* Tokens. */
-#ifndef YYTOKENTYPE
-# define YYTOKENTYPE
- /* Put the tokens into the symbol table, so that GDB and other debuggers
- know about them. */
- enum yytokentype {
- YAML_ANCHOR = 258,
- YAML_ALIAS = 259,
- YAML_TRANSFER = 260,
- YAML_TAGURI = 261,
- YAML_ITRANSFER = 262,
- YAML_WORD = 263,
- YAML_PLAIN = 264,
- YAML_BLOCK = 265,
- YAML_DOCSEP = 266,
- YAML_IOPEN = 267,
- YAML_INDENT = 268,
- YAML_IEND = 269
- };
-#endif
-#define YAML_ANCHOR 258
-#define YAML_ALIAS 259
-#define YAML_TRANSFER 260
-#define YAML_TAGURI 261
-#define YAML_ITRANSFER 262
-#define YAML_WORD 263
-#define YAML_PLAIN 264
-#define YAML_BLOCK 265
-#define YAML_DOCSEP 266
-#define YAML_IOPEN 267
-#define YAML_INDENT 268
-#define YAML_IEND 269
-
-
-
-
-/* Copy the first part of user declarations. */
-#line 14 "gram.y"
-
-
-#include "syck.h"
-
-void apply_seq_in_map( SyckParser *parser, SyckNode *n );
-
-#define YYPARSE_PARAM parser
-#define YYLEX_PARAM parser
-
-#define NULL_NODE(parser, node) \
- SyckNode *node = syck_new_str( "", scalar_plain ); \
- if ( ((SyckParser *)parser)->taguri_expansion == 1 ) \
- { \
- node->type_id = syck_taguri( YAML_DOMAIN, "null", 4 ); \
- } \
- else \
- { \
- node->type_id = syck_strndup( "null", 4 ); \
- }
-
-
-/* Enabling traces. */
-#ifndef YYDEBUG
-# define YYDEBUG 1
-#endif
-
-/* Enabling verbose error messages. */
-#ifdef YYERROR_VERBOSE
-# undef YYERROR_VERBOSE
-# define YYERROR_VERBOSE 1
-#else
-# define YYERROR_VERBOSE 0
-#endif
-
-#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
-#line 35 "gram.y"
-typedef union YYSTYPE {
- SYMID nodeId;
- SyckNode *nodeData;
- char *name;
-} YYSTYPE;
-/* Line 191 of yacc.c. */
-#line 140 "gram.c"
-# define yystype YYSTYPE /* obsolescent; will be withdrawn */
-# define YYSTYPE_IS_DECLARED 1
-# define YYSTYPE_IS_TRIVIAL 1
-#endif
-
-
-
-/* Copy the second part of user declarations. */
-
-
-/* Line 214 of yacc.c. */
-#line 152 "gram.c"
-
-#if ! defined (yyoverflow) || YYERROR_VERBOSE
-
-# ifndef YYFREE
-# define YYFREE free
-# endif
-# ifndef YYMALLOC
-# define YYMALLOC malloc
-# endif
-
-/* The parser invokes alloca or malloc; define the necessary symbols. */
-
-# ifdef YYSTACK_USE_ALLOCA
-# if YYSTACK_USE_ALLOCA
-# define YYSTACK_ALLOC alloca
-# endif
-# else
-# if defined (alloca) || defined (_ALLOCA_H)
-# define YYSTACK_ALLOC alloca
-# else
-# ifdef __GNUC__
-# define YYSTACK_ALLOC __builtin_alloca
-# endif
-# endif
-# endif
-
-# ifdef YYSTACK_ALLOC
- /* Pacify GCC's `empty if-body' warning. */
-# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
-# else
-# if defined (__STDC__) || defined (__cplusplus)
-# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
-# define YYSIZE_T size_t
-# endif
-# define YYSTACK_ALLOC YYMALLOC
-# define YYSTACK_FREE YYFREE
-# endif
-#endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */
-
-
-#if (! defined (yyoverflow) \
- && (! defined (__cplusplus) \
- || (defined (YYSTYPE_IS_TRIVIAL) && YYSTYPE_IS_TRIVIAL)))
-
-/* A type that is properly aligned for any stack member. */
-union yyalloc
-{
- short int yyss;
- YYSTYPE yyvs;
- };
-
-/* The size of the maximum gap between one aligned stack and the next. */
-# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
-
-/* The size of an array large to enough to hold all stacks, each with
- N elements. */
-# define YYSTACK_BYTES(N) \
- ((N) * (sizeof (short int) + sizeof (YYSTYPE)) \
- + YYSTACK_GAP_MAXIMUM)
-
-/* Copy COUNT objects from FROM to TO. The source and destination do
- not overlap. */
-# ifndef YYCOPY
-# if defined (__GNUC__) && 1 < __GNUC__
-# define YYCOPY(To, From, Count) \
- __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
-# else
-# define YYCOPY(To, From, Count) \
- do \
- { \
- register YYSIZE_T yyi; \
- for (yyi = 0; yyi < (Count); yyi++) \
- (To)[yyi] = (From)[yyi]; \
- } \
- while (0)
-# endif
-# endif
-
-/* Relocate STACK from its old location to the new one. The
- local variables YYSIZE and YYSTACKSIZE give the old and new number of
- elements in the stack, and YYPTR gives the new location of the
- stack. Advance YYPTR to a properly aligned location for the next
- stack. */
-# define YYSTACK_RELOCATE(Stack) \
- do \
- { \
- YYSIZE_T yynewbytes; \
- YYCOPY (&yyptr->Stack, Stack, yysize); \
- Stack = &yyptr->Stack; \
- yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
- yyptr += yynewbytes / sizeof (*yyptr); \
- } \
- while (0)
-
-#endif
-
-#if defined (__STDC__) || defined (__cplusplus)
- typedef signed char yysigned_char;
-#else
- typedef short int yysigned_char;
-#endif
-
-/* YYFINAL -- State number of the termination state. */
-#define YYFINAL 52
-/* YYLAST -- Last index in YYTABLE. */
-#define YYLAST 396
-
-/* YYNTOKENS -- Number of terminals. */
-#define YYNTOKENS 23
-/* YYNNTS -- Number of nonterminals. */
-#define YYNNTS 29
-/* YYNRULES -- Number of rules. */
-#define YYNRULES 79
-/* YYNRULES -- Number of states. */
-#define YYNSTATES 128
-
-/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
-#define YYUNDEFTOK 2
-#define YYMAXUTOK 269
-
-#define YYTRANSLATE(YYX) \
- ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
-
-/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
-static const unsigned char yytranslate[] =
-{
- 0, 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, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 21, 15, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 16, 2,
- 2, 2, 2, 22, 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, 17, 2, 18, 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, 19, 2, 20, 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, 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,
- 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, 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, 2, 2, 1, 2, 3, 4,
- 5, 6, 7, 8, 9, 10, 11, 12, 13, 14
-};
-
-#if YYDEBUG
-/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
- YYRHS. */
-static const unsigned char yyprhs[] =
-{
- 0, 0, 3, 5, 8, 9, 11, 13, 15, 18,
- 21, 24, 28, 30, 32, 36, 37, 40, 43, 46,
- 49, 51, 54, 56, 58, 60, 63, 66, 69, 72,
- 75, 77, 79, 81, 85, 87, 89, 91, 93, 95,
- 99, 103, 106, 110, 113, 117, 120, 124, 127, 129,
- 133, 136, 140, 143, 145, 149, 151, 153, 157, 161,
- 165, 168, 172, 175, 179, 182, 184, 188, 190, 194,
- 196, 200, 204, 207, 211, 215, 218, 220, 224, 226
-};
-
-/* YYRHS -- A `-1'-separated list of the rules' RHS. */
-static const yysigned_char yyrhs[] =
-{
- 24, 0, -1, 25, -1, 11, 27, -1, -1, 33,
- -1, 26, -1, 34, -1, 5, 26, -1, 6, 26,
- -1, 3, 26, -1, 29, 26, 32, -1, 25, -1,
- 28, -1, 29, 28, 30, -1, -1, 7, 28, -1,
- 5, 28, -1, 6, 28, -1, 3, 28, -1, 12,
- -1, 29, 13, -1, 14, -1, 13, -1, 14, -1,
- 31, 32, -1, 5, 33, -1, 6, 33, -1, 7,
- 33, -1, 3, 33, -1, 4, -1, 8, -1, 9,
- -1, 29, 33, 32, -1, 10, -1, 35, -1, 39,
- -1, 42, -1, 49, -1, 29, 37, 30, -1, 29,
- 38, 30, -1, 15, 27, -1, 5, 31, 38, -1,
- 5, 37, -1, 6, 31, 38, -1, 6, 37, -1,
- 3, 31, 38, -1, 3, 37, -1, 36, -1, 38,
- 31, 36, -1, 38, 31, -1, 17, 40, 18, -1,
- 17, 18, -1, 41, -1, 40, 21, 41, -1, 25,
- -1, 48, -1, 29, 43, 30, -1, 29, 47, 30,
- -1, 5, 31, 47, -1, 5, 43, -1, 6, 31,
- 47, -1, 6, 43, -1, 3, 31, 47, -1, 3,
- 43, -1, 33, -1, 22, 25, 31, -1, 27, -1,
- 44, 16, 45, -1, 46, -1, 47, 31, 36, -1,
- 47, 31, 46, -1, 47, 31, -1, 25, 16, 27,
- -1, 19, 50, 20, -1, 19, 20, -1, 51, -1,
- 50, 21, 51, -1, 25, -1, 48, -1
-};
-
-/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
-static const unsigned short int yyrline[] =
-{
- 0, 56, 56, 60, 65, 70, 71, 74, 75, 80,
- 85, 94, 100, 101, 104, 109, 113, 121, 126, 131,
- 145, 146, 149, 152, 155, 156, 164, 169, 174, 182,
- 186, 194, 207, 208, 218, 219, 220, 221, 222, 228,
- 232, 238, 244, 249, 254, 259, 264, 268, 274, 278,
- 283, 292, 296, 302, 306, 313, 314, 320, 325, 332,
- 337, 342, 347, 352, 356, 362, 363, 369, 379, 396,
- 397, 409, 417, 426, 434, 438, 444, 445, 454, 461
-};
-#endif
-
-#if YYDEBUG || YYERROR_VERBOSE
-/* YYTNME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
- First, the terminals, then, starting at YYNTOKENS, nonterminals. */
-static const char *const yytname[] =
-{
- "$end", "error", "$undefined", "YAML_ANCHOR", "YAML_ALIAS",
- "YAML_TRANSFER", "YAML_TAGURI", "YAML_ITRANSFER", "YAML_WORD",
- "YAML_PLAIN", "YAML_BLOCK", "YAML_DOCSEP", "YAML_IOPEN", "YAML_INDENT",
- "YAML_IEND", "'-'", "':'", "'['", "']'", "'{'", "'}'", "','", "'?'",
- "$accept", "doc", "atom", "ind_rep", "atom_or_empty", "empty",
- "indent_open", "indent_end", "indent_sep", "indent_flex_end", "word_rep",
- "struct_rep", "implicit_seq", "basic_seq", "top_imp_seq",
- "in_implicit_seq", "inline_seq", "in_inline_seq", "inline_seq_atom",
- "implicit_map", "top_imp_map", "complex_key", "complex_value",
- "complex_mapping", "in_implicit_map", "basic_mapping", "inline_map",
- "in_inline_map", "inline_map_atom", 0
-};
-#endif
-
-# ifdef YYPRINT
-/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
- token YYLEX-NUM. */
-static const unsigned short int yytoknum[] =
-{
- 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
- 265, 266, 267, 268, 269, 45, 58, 91, 93, 123,
- 125, 44, 63
-};
-# endif
-
-/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
-static const unsigned char yyr1[] =
-{
- 0, 23, 24, 24, 24, 25, 25, 26, 26, 26,
- 26, 26, 27, 27, 28, 28, 28, 28, 28, 28,
- 29, 29, 30, 31, 32, 32, 33, 33, 33, 33,
- 33, 33, 33, 33, 34, 34, 34, 34, 34, 35,
- 35, 36, 37, 37, 37, 37, 37, 37, 38, 38,
- 38, 39, 39, 40, 40, 41, 41, 42, 42, 43,
- 43, 43, 43, 43, 43, 44, 44, 45, 46, 47,
- 47, 47, 47, 48, 49, 49, 50, 50, 51, 51
-};
-
-/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
-static const unsigned char yyr2[] =
-{
- 0, 2, 1, 2, 0, 1, 1, 1, 2, 2,
- 2, 3, 1, 1, 3, 0, 2, 2, 2, 2,
- 1, 2, 1, 1, 1, 2, 2, 2, 2, 2,
- 1, 1, 1, 3, 1, 1, 1, 1, 1, 3,
- 3, 2, 3, 2, 3, 2, 3, 2, 1, 3,
- 2, 3, 2, 1, 3, 1, 1, 3, 3, 3,
- 2, 3, 2, 3, 2, 1, 3, 1, 3, 1,
- 3, 3, 2, 3, 3, 2, 1, 3, 1, 1
-};
-
-/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
- STATE-NUM when YYTABLE doesn't specify something else to do. Zero
- means the default is an error. */
-static const unsigned char yydefact[] =
-{
- 4, 0, 30, 0, 0, 0, 31, 32, 34, 15,
- 20, 0, 0, 0, 2, 6, 0, 5, 7, 35,
- 36, 37, 38, 10, 29, 8, 26, 9, 27, 0,
- 0, 0, 0, 28, 15, 15, 15, 15, 12, 3,
- 13, 15, 52, 55, 0, 53, 56, 75, 78, 79,
- 0, 76, 1, 0, 0, 0, 21, 15, 0, 0,
- 65, 48, 0, 0, 0, 0, 69, 0, 0, 19,
- 17, 18, 15, 15, 15, 16, 15, 15, 15, 15,
- 0, 15, 51, 0, 74, 0, 23, 0, 47, 64,
- 0, 43, 60, 0, 45, 62, 41, 0, 24, 0,
- 11, 33, 22, 39, 40, 50, 57, 15, 58, 72,
- 14, 73, 54, 77, 65, 46, 63, 42, 59, 44,
- 61, 66, 25, 49, 67, 68, 70, 71
-};
-
-/* YYDEFGOTO[NTERM-NUM]. */
-static const yysigned_char yydefgoto[] =
-{
- -1, 13, 38, 15, 39, 40, 16, 103, 99, 101,
- 17, 18, 19, 61, 62, 63, 20, 44, 45, 21,
- 64, 65, 125, 66, 67, 46, 22, 50, 51
-};
-
-/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
- STATE-NUM. */
-#define YYPACT_NINF -97
-static const short int yypact[] =
-{
- 250, 318, -97, 318, 318, 374, -97, -97, -97, 335,
- -97, 267, 232, 7, -97, -97, 192, -97, -97, -97,
- -97, -97, -97, -97, -97, -97, -97, -97, -97, 374,
- 374, 374, 352, -97, 335, 335, 335, 384, -97, -97,
- -97, 212, -97, 10, 0, -97, -97, -97, 10, -97,
- -4, -97, -97, 284, 284, 284, -97, 335, 318, 30,
- 30, -97, -2, 36, -2, 16, -97, 36, 30, -97,
- -97, -97, 384, 384, 384, -97, 363, 301, 301, 301,
- -2, 335, -97, 318, -97, 318, -97, 158, -97, -97,
- 158, -97, -97, 158, -97, -97, -97, 24, -97, 30,
- -97, -97, -97, -97, -97, 26, -97, 335, -97, 158,
- -97, -97, -97, -97, -97, 24, 24, 24, 24, 24,
- 24, -97, -97, -97, -97, -97, -97, -97
-};
-
-/* YYPGOTO[NTERM-NUM]. */
-static const yysigned_char yypgoto[] =
-{
- -97, -97, 8, 81, -56, 109, 33, -53, 74, -54,
- -1, -97, -97, -96, -31, -32, -97, -97, -44, -97,
- 77, -97, -97, -52, 9, -6, -97, -97, -29
-};
-
-/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
- positive, shift that token. If negative, reduce the rule which
- number is the opposite. If zero, do what YYDEFACT says.
- If YYTABLE_NINF, syntax error. */
-#define YYTABLE_NINF -1
-static const unsigned char yytable[] =
-{
- 24, 96, 26, 28, 33, 100, 49, 52, 14, 123,
- 104, 106, 102, 126, 108, 60, 84, 85, 82, 43,
- 48, 83, 88, 91, 94, 111, 81, 110, 24, 26,
- 28, 68, 107, 24, 26, 28, 33, 86, 32, 112,
- 60, 57, 41, 86, 98, 122, 88, 91, 94, 86,
- 102, 124, 24, 26, 28, 115, 113, 127, 117, 0,
- 0, 119, 32, 32, 32, 32, 97, 41, 41, 41,
- 76, 24, 26, 28, 41, 68, 24, 26, 28, 49,
- 0, 0, 23, 0, 25, 27, 114, 0, 0, 114,
- 41, 43, 114, 48, 0, 0, 116, 59, 0, 118,
- 0, 0, 120, 0, 0, 76, 76, 76, 114, 76,
- 41, 41, 41, 0, 41, 23, 25, 27, 0, 0,
- 32, 0, 59, 32, 0, 0, 32, 87, 90, 93,
- 89, 92, 95, 0, 23, 25, 27, 105, 0, 0,
- 41, 109, 32, 69, 70, 71, 75, 0, 0, 0,
- 80, 87, 90, 93, 89, 92, 95, 0, 23, 25,
- 27, 29, 2, 30, 31, 5, 6, 7, 0, 0,
- 10, 121, 0, 57, 0, 0, 0, 0, 0, 0,
- 58, 69, 70, 71, 0, 80, 69, 70, 71, 105,
- 109, 105, 109, 105, 109, 53, 2, 54, 55, 5,
- 6, 7, 8, 0, 10, 56, 0, 57, 0, 11,
- 0, 12, 0, 0, 58, 77, 2, 78, 79, 37,
- 6, 7, 8, 0, 10, 56, 0, 57, 0, 11,
- 0, 12, 0, 0, 58, 1, 2, 3, 4, 5,
- 6, 7, 8, 0, 10, 0, 0, 0, 0, 11,
- 0, 12, 47, 1, 2, 3, 4, 5, 6, 7,
- 8, 9, 10, 0, 0, 0, 0, 11, 0, 12,
- 1, 2, 3, 4, 5, 6, 7, 8, 0, 10,
- 0, 0, 0, 0, 11, 42, 12, 53, 2, 54,
- 55, 5, 6, 7, 8, 0, 10, 86, 0, 0,
- 0, 11, 0, 12, 77, 2, 78, 79, 37, 6,
- 7, 8, 0, 10, 86, 0, 0, 0, 11, 0,
- 12, 1, 2, 3, 4, 5, 6, 7, 8, 0,
- 10, 0, 0, 0, 0, 11, 0, 12, 34, 2,
- 35, 36, 37, 6, 7, 8, 0, 10, 0, 0,
- 0, 0, 11, 0, 12, 29, 2, 30, 31, 5,
- 6, 7, 0, 0, 10, 56, 72, 2, 73, 74,
- 37, 6, 7, 0, 0, 10, 56, 29, 2, 30,
- 31, 5, 6, 7, 0, 0, 10, 72, 2, 73,
- 74, 37, 6, 7, 0, 0, 10
-};
-
-static const yysigned_char yycheck[] =
-{
- 1, 57, 3, 4, 5, 59, 12, 0, 0, 105,
- 63, 64, 14, 109, 67, 16, 20, 21, 18, 11,
- 12, 21, 53, 54, 55, 81, 16, 80, 29, 30,
- 31, 32, 16, 34, 35, 36, 37, 13, 5, 83,
- 41, 15, 9, 13, 14, 99, 77, 78, 79, 13,
- 14, 107, 53, 54, 55, 87, 85, 109, 90, -1,
- -1, 93, 29, 30, 31, 32, 58, 34, 35, 36,
- 37, 72, 73, 74, 41, 76, 77, 78, 79, 85,
- -1, -1, 1, -1, 3, 4, 87, -1, -1, 90,
- 57, 83, 93, 85, -1, -1, 87, 16, -1, 90,
- -1, -1, 93, -1, -1, 72, 73, 74, 109, 76,
- 77, 78, 79, -1, 81, 34, 35, 36, -1, -1,
- 87, -1, 41, 90, -1, -1, 93, 53, 54, 55,
- 53, 54, 55, -1, 53, 54, 55, 63, -1, -1,
- 107, 67, 109, 34, 35, 36, 37, -1, -1, -1,
- 41, 77, 78, 79, 77, 78, 79, -1, 77, 78,
- 79, 3, 4, 5, 6, 7, 8, 9, -1, -1,
- 12, 97, -1, 15, -1, -1, -1, -1, -1, -1,
- 22, 72, 73, 74, -1, 76, 77, 78, 79, 115,
- 116, 117, 118, 119, 120, 3, 4, 5, 6, 7,
- 8, 9, 10, -1, 12, 13, -1, 15, -1, 17,
- -1, 19, -1, -1, 22, 3, 4, 5, 6, 7,
- 8, 9, 10, -1, 12, 13, -1, 15, -1, 17,
- -1, 19, -1, -1, 22, 3, 4, 5, 6, 7,
- 8, 9, 10, -1, 12, -1, -1, -1, -1, 17,
- -1, 19, 20, 3, 4, 5, 6, 7, 8, 9,
- 10, 11, 12, -1, -1, -1, -1, 17, -1, 19,
- 3, 4, 5, 6, 7, 8, 9, 10, -1, 12,
- -1, -1, -1, -1, 17, 18, 19, 3, 4, 5,
- 6, 7, 8, 9, 10, -1, 12, 13, -1, -1,
- -1, 17, -1, 19, 3, 4, 5, 6, 7, 8,
- 9, 10, -1, 12, 13, -1, -1, -1, 17, -1,
- 19, 3, 4, 5, 6, 7, 8, 9, 10, -1,
- 12, -1, -1, -1, -1, 17, -1, 19, 3, 4,
- 5, 6, 7, 8, 9, 10, -1, 12, -1, -1,
- -1, -1, 17, -1, 19, 3, 4, 5, 6, 7,
- 8, 9, -1, -1, 12, 13, 3, 4, 5, 6,
- 7, 8, 9, -1, -1, 12, 13, 3, 4, 5,
- 6, 7, 8, 9, -1, -1, 12, 3, 4, 5,
- 6, 7, 8, 9, -1, -1, 12
-};
-
-/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
- symbol of state STATE-NUM. */
-static const unsigned char yystos[] =
-{
- 0, 3, 4, 5, 6, 7, 8, 9, 10, 11,
- 12, 17, 19, 24, 25, 26, 29, 33, 34, 35,
- 39, 42, 49, 26, 33, 26, 33, 26, 33, 3,
- 5, 6, 29, 33, 3, 5, 6, 7, 25, 27,
- 28, 29, 18, 25, 40, 41, 48, 20, 25, 48,
- 50, 51, 0, 3, 5, 6, 13, 15, 22, 26,
- 33, 36, 37, 38, 43, 44, 46, 47, 33, 28,
- 28, 28, 3, 5, 6, 28, 29, 3, 5, 6,
- 28, 16, 18, 21, 20, 21, 13, 31, 37, 43,
- 31, 37, 43, 31, 37, 43, 27, 25, 14, 31,
- 32, 32, 14, 30, 30, 31, 30, 16, 30, 31,
- 30, 27, 41, 51, 33, 38, 47, 38, 47, 38,
- 47, 31, 32, 36, 27, 45, 36, 46
-};
-
-#if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
-# define YYSIZE_T __SIZE_TYPE__
-#endif
-#if ! defined (YYSIZE_T) && defined (size_t)
-# define YYSIZE_T size_t
-#endif
-#if ! defined (YYSIZE_T)
-# if defined (__STDC__) || defined (__cplusplus)
-# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
-# define YYSIZE_T size_t
-# endif
-#endif
-#if ! defined (YYSIZE_T)
-# define YYSIZE_T unsigned int
-#endif
-
-#define yyerrok (yyerrstatus = 0)
-#define yyclearin (yychar = YYEMPTY)
-#define YYEMPTY (-2)
-#define YYEOF 0
-
-#define YYACCEPT goto yyacceptlab
-#define YYABORT goto yyabortlab
-#define YYERROR goto yyerrorlab
-
-
-/* Like YYERROR except do call yyerror. This remains here temporarily
- to ease the transition to the new meaning of YYERROR, for GCC.
- Once GCC version 2 has supplanted version 1, this can go. */
-
-#define YYFAIL goto yyerrlab
-
-#define YYRECOVERING() (!!yyerrstatus)
-
-#define YYBACKUP(Token, Value) \
-do \
- if (yychar == YYEMPTY && yylen == 1) \
- { \
- yychar = (Token); \
- yylval = (Value); \
- yytoken = YYTRANSLATE (yychar); \
- YYPOPSTACK; \
- goto yybackup; \
- } \
- else \
- { \
- yyerror ("syntax error: cannot back up");\
- YYERROR; \
- } \
-while (0)
-
-#define YYTERROR 1
-#define YYERRCODE 256
-
-/* YYLLOC_DEFAULT -- Compute the default location (before the actions
- are run). */
-
-#ifndef YYLLOC_DEFAULT
-# define YYLLOC_DEFAULT(Current, Rhs, N) \
- ((Current).first_line = (Rhs)[1].first_line, \
- (Current).first_column = (Rhs)[1].first_column, \
- (Current).last_line = (Rhs)[N].last_line, \
- (Current).last_column = (Rhs)[N].last_column)
-#endif
-
-/* YYLEX -- calling `yylex' with the right arguments. */
-
-#ifdef YYLEX_PARAM
-# define YYLEX yylex (&yylval, YYLEX_PARAM)
-#else
-# define YYLEX yylex (&yylval)
-#endif
-
-/* Enable debugging if requested. */
-#if YYDEBUG
-
-# ifndef YYFPRINTF
-# include <stdio.h> /* INFRINGES ON USER NAME SPACE */
-# define YYFPRINTF fprintf
-# endif
-
-# define YYDPRINTF(Args) \
-do { \
- if (yydebug) \
- YYFPRINTF Args; \
-} while (0)
-
-# define YYDSYMPRINT(Args) \
-do { \
- if (yydebug) \
- yysymprint Args; \
-} while (0)
-
-# define YYDSYMPRINTF(Title, Token, Value, Location) \
-do { \
- if (yydebug) \
- { \
- YYFPRINTF (stderr, "%s ", Title); \
- yysymprint (stderr, \
- Token, Value); \
- YYFPRINTF (stderr, "\n"); \
- } \
-} while (0)
-
-/*------------------------------------------------------------------.
-| yy_stack_print -- Print the state stack from its BOTTOM up to its |
-| TOP (included). |
-`------------------------------------------------------------------*/
-
-#if defined (__STDC__) || defined (__cplusplus)
-static void
-yy_stack_print (short int *bottom, short int *top)
-#else
-static void
-yy_stack_print (bottom, top)
- short int *bottom;
- short int *top;
-#endif
-{
- YYFPRINTF (stderr, "Stack now");
- for (/* Nothing. */; bottom <= top; ++bottom)
- YYFPRINTF (stderr, " %d", *bottom);
- YYFPRINTF (stderr, "\n");
-}
-
-# define YY_STACK_PRINT(Bottom, Top) \
-do { \
- if (yydebug) \
- yy_stack_print ((Bottom), (Top)); \
-} while (0)
-
-
-/*------------------------------------------------.
-| Report that the YYRULE is going to be reduced. |
-`------------------------------------------------*/
-
-#if defined (__STDC__) || defined (__cplusplus)
-static void
-yy_reduce_print (int yyrule)
-#else
-static void
-yy_reduce_print (yyrule)
- int yyrule;
-#endif
-{
- int yyi;
- unsigned int yylno = yyrline[yyrule];
- YYFPRINTF (stderr, "Reducing stack by rule %d (line %u), ",
- yyrule - 1, yylno);
- /* Print the symbols being reduced, and their result. */
- for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++)
- YYFPRINTF (stderr, "%s ", yytname [yyrhs[yyi]]);
- YYFPRINTF (stderr, "-> %s\n", yytname [yyr1[yyrule]]);
-}
-
-# define YY_REDUCE_PRINT(Rule) \
-do { \
- if (yydebug) \
- yy_reduce_print (Rule); \
-} while (0)
-
-/* Nonzero means print parse trace. It is left uninitialized so that
- multiple parsers can coexist. */
-int yydebug;
-#else /* !YYDEBUG */
-# define YYDPRINTF(Args)
-# define YYDSYMPRINT(Args)
-# define YYDSYMPRINTF(Title, Token, Value, Location)
-# define YY_STACK_PRINT(Bottom, Top)
-# define YY_REDUCE_PRINT(Rule)
-#endif /* !YYDEBUG */
-
-
-/* YYINITDEPTH -- initial size of the parser's stacks. */
-#ifndef YYINITDEPTH
-# define YYINITDEPTH 200
-#endif
-
-/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
- if the built-in stack extension method is used).
-
- Do not make this value too large; the results are undefined if
- SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH)
- evaluated with infinite-precision integer arithmetic. */
-
-#if defined (YYMAXDEPTH) && YYMAXDEPTH == 0
-# undef YYMAXDEPTH
-#endif
-
-#ifndef YYMAXDEPTH
-# define YYMAXDEPTH 10000
-#endif
-
-
-
-#if YYERROR_VERBOSE
-
-# ifndef yystrlen
-# if defined (__GLIBC__) && defined (_STRING_H)
-# define yystrlen strlen
-# else
-/* Return the length of YYSTR. */
-static YYSIZE_T
-# if defined (__STDC__) || defined (__cplusplus)
-yystrlen (const char *yystr)
-# else
-yystrlen (yystr)
- const char *yystr;
-# endif
-{
- register const char *yys = yystr;
-
- while (*yys++ != '\0')
- continue;
-
- return yys - yystr - 1;
-}
-# endif
-# endif
-
-# ifndef yystpcpy
-# if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
-# define yystpcpy stpcpy
-# else
-/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
- YYDEST. */
-static char *
-# if defined (__STDC__) || defined (__cplusplus)
-yystpcpy (char *yydest, const char *yysrc)
-# else
-yystpcpy (yydest, yysrc)
- char *yydest;
- const char *yysrc;
-# endif
-{
- register char *yyd = yydest;
- register const char *yys = yysrc;
-
- while ((*yyd++ = *yys++) != '\0')
- continue;
-
- return yyd - 1;
-}
-# endif
-# endif
-
-#endif /* !YYERROR_VERBOSE */
-
-
-
-#if YYDEBUG
-/*--------------------------------.
-| Print this symbol on YYOUTPUT. |
-`--------------------------------*/
-
-#if defined (__STDC__) || defined (__cplusplus)
-static void
-yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep)
-#else
-static void
-yysymprint (yyoutput, yytype, yyvaluep)
- FILE *yyoutput;
- int yytype;
- YYSTYPE *yyvaluep;
-#endif
-{
- /* Pacify ``unused variable'' warnings. */
- (void) yyvaluep;
-
- if (yytype < YYNTOKENS)
- {
- YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
-# ifdef YYPRINT
- YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
-# endif
- }
- else
- YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
-
- switch (yytype)
- {
- default:
- break;
- }
- YYFPRINTF (yyoutput, ")");
-}
-
-#endif /* ! YYDEBUG */
-/*-----------------------------------------------.
-| Release the memory associated to this symbol. |
-`-----------------------------------------------*/
-
-#if defined (__STDC__) || defined (__cplusplus)
-static void
-yydestruct (int yytype, YYSTYPE *yyvaluep)
-#else
-static void
-yydestruct (yytype, yyvaluep)
- int yytype;
- YYSTYPE *yyvaluep;
-#endif
-{
- /* Pacify ``unused variable'' warnings. */
- (void) yyvaluep;
-
- switch (yytype)
- {
-
- default:
- break;
- }
-}
-
-
-/* Prevent warnings from -Wmissing-prototypes. */
-
-#ifdef YYPARSE_PARAM
-# if defined (__STDC__) || defined (__cplusplus)
-int yyparse (void *YYPARSE_PARAM);
-# else
-int yyparse ();
-# endif
-#else /* ! YYPARSE_PARAM */
-#if defined (__STDC__) || defined (__cplusplus)
-int yyparse (void);
-#else
-int yyparse ();
-#endif
-#endif /* ! YYPARSE_PARAM */
-
-
-
-
-
-
-/*----------.
-| yyparse. |
-`----------*/
-
-#ifdef YYPARSE_PARAM
-# if defined (__STDC__) || defined (__cplusplus)
-int yyparse (void *YYPARSE_PARAM)
-# else
-int yyparse (YYPARSE_PARAM)
- void *YYPARSE_PARAM;
-# endif
-#else /* ! YYPARSE_PARAM */
-#if defined (__STDC__) || defined (__cplusplus)
-int
-yyparse (void)
-#else
-int
-yyparse ()
-
-#endif
-#endif
-{
- /* The lookahead symbol. */
-int yychar;
-
-/* The semantic value of the lookahead symbol. */
-YYSTYPE yylval;
-
-/* Number of syntax errors so far. */
-int yynerrs;
-
- register int yystate;
- register int yyn;
- int yyresult;
- /* Number of tokens to shift before error messages enabled. */
- int yyerrstatus;
- /* Lookahead token as an internal (translated) token number. */
- int yytoken = 0;
-
- /* Three stacks and their tools:
- `yyss': related to states,
- `yyvs': related to semantic values,
- `yyls': related to locations.
-
- Refer to the stacks thru separate pointers, to allow yyoverflow
- to reallocate them elsewhere. */
-
- /* The state stack. */
- short int yyssa[YYINITDEPTH];
- short int *yyss = yyssa;
- register short int *yyssp;
-
- /* The semantic value stack. */
- YYSTYPE yyvsa[YYINITDEPTH];
- YYSTYPE *yyvs = yyvsa;
- register YYSTYPE *yyvsp;
-
-
-
-#define YYPOPSTACK (yyvsp--, yyssp--)
-
- YYSIZE_T yystacksize = YYINITDEPTH;
-
- /* The variables used to return semantic value and location from the
- action routines. */
- YYSTYPE yyval;
-
-
- /* When reducing, the number of symbols on the RHS of the reduced
- rule. */
- int yylen;
-
- YYDPRINTF ((stderr, "Starting parse\n"));
-
- yystate = 0;
- yyerrstatus = 0;
- yynerrs = 0;
- yychar = YYEMPTY; /* Cause a token to be read. */
-
- /* Initialize stack pointers.
- Waste one element of value and location stack
- so that they stay on the same level as the state stack.
- The wasted elements are never initialized. */
-
- yyssp = yyss;
- yyvsp = yyvs;
-
-
- goto yysetstate;
-
-/*------------------------------------------------------------.
-| yynewstate -- Push a new state, which is found in yystate. |
-`------------------------------------------------------------*/
- yynewstate:
- /* In all cases, when you get here, the value and location stacks
- have just been pushed. so pushing a state here evens the stacks.
- */
- yyssp++;
-
- yysetstate:
- *yyssp = yystate;
-
- if (yyss + yystacksize - 1 <= yyssp)
- {
- /* Get the current used size of the three stacks, in elements. */
- YYSIZE_T yysize = yyssp - yyss + 1;
-
-#ifdef yyoverflow
- {
- /* Give user a chance to reallocate the stack. Use copies of
- these so that the &'s don't force the real ones into
- memory. */
- YYSTYPE *yyvs1 = yyvs;
- short int *yyss1 = yyss;
-
-
- /* Each stack pointer address is followed by the size of the
- data in use in that stack, in bytes. This used to be a
- conditional around just the two extra args, but that might
- be undefined if yyoverflow is a macro. */
- yyoverflow ("parser stack overflow",
- &yyss1, yysize * sizeof (*yyssp),
- &yyvs1, yysize * sizeof (*yyvsp),
-
- &yystacksize);
-
- yyss = yyss1;
- yyvs = yyvs1;
- }
-#else /* no yyoverflow */
-# ifndef YYSTACK_RELOCATE
- goto yyoverflowlab;
-# else
- /* Extend the stack our own way. */
- if (YYMAXDEPTH <= yystacksize)
- goto yyoverflowlab;
- yystacksize *= 2;
- if (YYMAXDEPTH < yystacksize)
- yystacksize = YYMAXDEPTH;
-
- {
- short int *yyss1 = yyss;
- union yyalloc *yyptr =
- (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
- if (! yyptr)
- goto yyoverflowlab;
- YYSTACK_RELOCATE (yyss);
- YYSTACK_RELOCATE (yyvs);
-
-# undef YYSTACK_RELOCATE
- if (yyss1 != yyssa)
- YYSTACK_FREE (yyss1);
- }
-# endif
-#endif /* no yyoverflow */
-
- yyssp = yyss + yysize - 1;
- yyvsp = yyvs + yysize - 1;
-
-
- YYDPRINTF ((stderr, "Stack size increased to %lu\n",
- (unsigned long int) yystacksize));
-
- if (yyss + yystacksize - 1 <= yyssp)
- YYABORT;
- }
-
- YYDPRINTF ((stderr, "Entering state %d\n", yystate));
-
- goto yybackup;
-
-/*-----------.
-| yybackup. |
-`-----------*/
-yybackup:
-
-/* Do appropriate processing given the current state. */
-/* Read a lookahead token if we need one and don't already have one. */
-/* yyresume: */
-
- /* First try to decide what to do without reference to lookahead token. */
-
- yyn = yypact[yystate];
- if (yyn == YYPACT_NINF)
- goto yydefault;
-
- /* Not known => get a lookahead token if don't already have one. */
-
- /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
- if (yychar == YYEMPTY)
- {
- YYDPRINTF ((stderr, "Reading a token: "));
- yychar = YYLEX;
- }
-
- if (yychar <= YYEOF)
- {
- yychar = yytoken = YYEOF;
- YYDPRINTF ((stderr, "Now at end of input.\n"));
- }
- else
- {
- yytoken = YYTRANSLATE (yychar);
- YYDSYMPRINTF ("Next token is", yytoken, &yylval, &yylloc);
- }
-
- /* If the proper action on seeing token YYTOKEN is to reduce or to
- detect an error, take that action. */
- yyn += yytoken;
- if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
- goto yydefault;
- yyn = yytable[yyn];
- if (yyn <= 0)
- {
- if (yyn == 0 || yyn == YYTABLE_NINF)
- goto yyerrlab;
- yyn = -yyn;
- goto yyreduce;
- }
-
- if (yyn == YYFINAL)
- YYACCEPT;
-
- /* Shift the lookahead token. */
- YYDPRINTF ((stderr, "Shifting token %s, ", yytname[yytoken]));
-
- /* Discard the token being shifted unless it is eof. */
- if (yychar != YYEOF)
- yychar = YYEMPTY;
-
- *++yyvsp = yylval;
-
-
- /* Count tokens shifted since error; after three, turn off error
- status. */
- if (yyerrstatus)
- yyerrstatus--;
-
- yystate = yyn;
- goto yynewstate;
-
-
-/*-----------------------------------------------------------.
-| yydefault -- do the default action for the current state. |
-`-----------------------------------------------------------*/
-yydefault:
- yyn = yydefact[yystate];
- if (yyn == 0)
- goto yyerrlab;
- goto yyreduce;
-
-
-/*-----------------------------.
-| yyreduce -- Do a reduction. |
-`-----------------------------*/
-yyreduce:
- /* yyn is the number of a rule to reduce with. */
- yylen = yyr2[yyn];
-
- /* If YYLEN is nonzero, implement the default value of the action:
- `$$ = $1'.
-
- Otherwise, the following line sets YYVAL to garbage.
- This behavior is undocumented and Bison
- users should not rely upon it. Assigning to YYVAL
- unconditionally makes the parser a bit smaller, and it avoids a
- GCC warning that YYVAL may be used uninitialized. */
- yyval = yyvsp[1-yylen];
-
-
- YY_REDUCE_PRINT (yyn);
- switch (yyn)
- {
- case 2:
-#line 57 "gram.y"
- {
- ((SyckParser *)parser)->root = syck_hdlr_add_node( (SyckParser *)parser, yyvsp[0].nodeData );
- }
- break;
-
- case 3:
-#line 61 "gram.y"
- {
- ((SyckParser *)parser)->root = syck_hdlr_add_node( (SyckParser *)parser, yyvsp[0].nodeData );
- }
- break;
-
- case 4:
-#line 65 "gram.y"
- {
- ((SyckParser *)parser)->eof = 1;
- }
- break;
-
- case 8:
-#line 76 "gram.y"
- {
- syck_add_transfer( yyvsp[-1].name, yyvsp[0].nodeData, ((SyckParser *)parser)->taguri_expansion );
- yyval.nodeData = yyvsp[0].nodeData;
- }
- break;
-
- case 9:
-#line 81 "gram.y"
- {
- syck_add_transfer( yyvsp[-1].name, yyvsp[0].nodeData, 0 );
- yyval.nodeData = yyvsp[0].nodeData;
- }
- break;
-
- case 10:
-#line 86 "gram.y"
- {
- /*
- * _Anchors_: The language binding must keep a separate symbol table
- * for anchors. The actual ID in the symbol table is returned to the
- * higher nodes, though.
- */
- yyval.nodeData = syck_hdlr_add_anchor( (SyckParser *)parser, yyvsp[-1].name, yyvsp[0].nodeData );
- }
- break;
-
- case 11:
-#line 95 "gram.y"
- {
- yyval.nodeData = yyvsp[-1].nodeData;
- }
- break;
-
- case 14:
-#line 105 "gram.y"
- {
- yyval.nodeData = yyvsp[-1].nodeData;
- }
- break;
-
- case 15:
-#line 109 "gram.y"
- {
- NULL_NODE( parser, n );
- yyval.nodeData = n;
- }
- break;
-
- case 16:
-#line 114 "gram.y"
- {
- if ( ((SyckParser *)parser)->implicit_typing == 1 )
- {
- try_tag_implicit( yyvsp[0].nodeData, ((SyckParser *)parser)->taguri_expansion );
- }
- yyval.nodeData = yyvsp[0].nodeData;
- }
- break;
-
- case 17:
-#line 122 "gram.y"
- {
- syck_add_transfer( yyvsp[-1].name, yyvsp[0].nodeData, ((SyckParser *)parser)->taguri_expansion );
- yyval.nodeData = yyvsp[0].nodeData;
- }
- break;
-
- case 18:
-#line 127 "gram.y"
- {
- syck_add_transfer( yyvsp[-1].name, yyvsp[0].nodeData, 0 );
- yyval.nodeData = yyvsp[0].nodeData;
- }
- break;
-
- case 19:
-#line 132 "gram.y"
- {
- /*
- * _Anchors_: The language binding must keep a separate symbol table
- * for anchors. The actual ID in the symbol table is returned to the
- * higher nodes, though.
- */
- yyval.nodeData = syck_hdlr_add_anchor( (SyckParser *)parser, yyvsp[-1].name, yyvsp[0].nodeData );
- }
- break;
-
- case 26:
-#line 165 "gram.y"
- {
- syck_add_transfer( yyvsp[-1].name, yyvsp[0].nodeData, ((SyckParser *)parser)->taguri_expansion );
- yyval.nodeData = yyvsp[0].nodeData;
- }
- break;
-
- case 27:
-#line 170 "gram.y"
- {
- syck_add_transfer( yyvsp[-1].name, yyvsp[0].nodeData, 0 );
- yyval.nodeData = yyvsp[0].nodeData;
- }
- break;
-
- case 28:
-#line 175 "gram.y"
- {
- if ( ((SyckParser *)parser)->implicit_typing == 1 )
- {
- try_tag_implicit( yyvsp[0].nodeData, ((SyckParser *)parser)->taguri_expansion );
- }
- yyval.nodeData = yyvsp[0].nodeData;
- }
- break;
-
- case 29:
-#line 183 "gram.y"
- {
- yyval.nodeData = syck_hdlr_add_anchor( (SyckParser *)parser, yyvsp[-1].name, yyvsp[0].nodeData );
- }
- break;
-
- case 30:
-#line 187 "gram.y"
- {
- /*
- * _Aliases_: The anchor symbol table is scanned for the anchor name.
- * The anchor's ID in the language's symbol table is returned.
- */
- yyval.nodeData = syck_hdlr_get_anchor( (SyckParser *)parser, yyvsp[0].name );
- }
- break;
-
- case 31:
-#line 195 "gram.y"
- {
- SyckNode *n = yyvsp[0].nodeData;
- if ( ((SyckParser *)parser)->taguri_expansion == 1 )
- {
- n->type_id = syck_taguri( YAML_DOMAIN, "str", 3 );
- }
- else
- {
- n->type_id = syck_strndup( "str", 3 );
- }
- yyval.nodeData = n;
- }
- break;
-
- case 33:
-#line 209 "gram.y"
- {
- yyval.nodeData = yyvsp[-1].nodeData;
- }
- break;
-
- case 39:
-#line 229 "gram.y"
- {
- yyval.nodeData = yyvsp[-1].nodeData;
- }
- break;
-
- case 40:
-#line 233 "gram.y"
- {
- yyval.nodeData = yyvsp[-1].nodeData;
- }
- break;
-
- case 41:
-#line 239 "gram.y"
- {
- yyval.nodeId = syck_hdlr_add_node( (SyckParser *)parser, yyvsp[0].nodeData );
- }
- break;
-
- case 42:
-#line 245 "gram.y"
- {
- syck_add_transfer( yyvsp[-2].name, yyvsp[0].nodeData, ((SyckParser *)parser)->taguri_expansion );
- yyval.nodeData = yyvsp[0].nodeData;
- }
- break;
-
- case 43:
-#line 250 "gram.y"
- {
- syck_add_transfer( yyvsp[-1].name, yyvsp[0].nodeData, ((SyckParser *)parser)->taguri_expansion );
- yyval.nodeData = yyvsp[0].nodeData;
- }
- break;
-
- case 44:
-#line 255 "gram.y"
- {
- syck_add_transfer( yyvsp[-2].name, yyvsp[0].nodeData, 0 );
- yyval.nodeData = yyvsp[0].nodeData;
- }
- break;
-
- case 45:
-#line 260 "gram.y"
- {
- syck_add_transfer( yyvsp[-1].name, yyvsp[0].nodeData, 0 );
- yyval.nodeData = yyvsp[0].nodeData;
- }
- break;
-
- case 46:
-#line 265 "gram.y"
- {
- yyval.nodeData = syck_hdlr_add_anchor( (SyckParser *)parser, yyvsp[-2].name, yyvsp[0].nodeData );
- }
- break;
-
- case 47:
-#line 269 "gram.y"
- {
- yyval.nodeData = syck_hdlr_add_anchor( (SyckParser *)parser, yyvsp[-1].name, yyvsp[0].nodeData );
- }
- break;
-
- case 48:
-#line 275 "gram.y"
- {
- yyval.nodeData = syck_new_seq( yyvsp[0].nodeId );
- }
- break;
-
- case 49:
-#line 279 "gram.y"
- {
- syck_seq_add( yyvsp[-2].nodeData, yyvsp[0].nodeId );
- yyval.nodeData = yyvsp[-2].nodeData;
- }
- break;
-
- case 50:
-#line 284 "gram.y"
- {
- yyval.nodeData = yyvsp[-1].nodeData;
- }
- break;
-
- case 51:
-#line 293 "gram.y"
- {
- yyval.nodeData = yyvsp[-1].nodeData;
- }
- break;
-
- case 52:
-#line 297 "gram.y"
- {
- yyval.nodeData = syck_alloc_seq();
- }
- break;
-
- case 53:
-#line 303 "gram.y"
- {
- yyval.nodeData = syck_new_seq( syck_hdlr_add_node( (SyckParser *)parser, yyvsp[0].nodeData ) );
- }
- break;
-
- case 54:
-#line 307 "gram.y"
- {
- syck_seq_add( yyvsp[-2].nodeData, syck_hdlr_add_node( (SyckParser *)parser, yyvsp[0].nodeData ) );
- yyval.nodeData = yyvsp[-2].nodeData;
- }
- break;
-
- case 57:
-#line 321 "gram.y"
- {
- apply_seq_in_map( (SyckParser *)parser, yyvsp[-1].nodeData );
- yyval.nodeData = yyvsp[-1].nodeData;
- }
- break;
-
- case 58:
-#line 326 "gram.y"
- {
- apply_seq_in_map( (SyckParser *)parser, yyvsp[-1].nodeData );
- yyval.nodeData = yyvsp[-1].nodeData;
- }
- break;
-
- case 59:
-#line 333 "gram.y"
- {
- syck_add_transfer( yyvsp[-2].name, yyvsp[0].nodeData, ((SyckParser *)parser)->taguri_expansion );
- yyval.nodeData = yyvsp[0].nodeData;
- }
- break;
-
- case 60:
-#line 338 "gram.y"
- {
- syck_add_transfer( yyvsp[-1].name, yyvsp[0].nodeData, ((SyckParser *)parser)->taguri_expansion );
- yyval.nodeData = yyvsp[0].nodeData;
- }
- break;
-
- case 61:
-#line 343 "gram.y"
- {
- syck_add_transfer( yyvsp[-2].name, yyvsp[0].nodeData, 0 );
- yyval.nodeData = yyvsp[0].nodeData;
- }
- break;
-
- case 62:
-#line 348 "gram.y"
- {
- syck_add_transfer( yyvsp[-1].name, yyvsp[0].nodeData, 0 );
- yyval.nodeData = yyvsp[0].nodeData;
- }
- break;
-
- case 63:
-#line 353 "gram.y"
- {
- yyval.nodeData = syck_hdlr_add_anchor( (SyckParser *)parser, yyvsp[-2].name, yyvsp[0].nodeData );
- }
- break;
-
- case 64:
-#line 357 "gram.y"
- {
- yyval.nodeData = syck_hdlr_add_anchor( (SyckParser *)parser, yyvsp[-1].name, yyvsp[0].nodeData );
- }
- break;
-
- case 66:
-#line 364 "gram.y"
- {
- yyval.nodeData = yyvsp[-1].nodeData;
- }
- break;
-
- case 68:
-#line 380 "gram.y"
- {
- yyval.nodeData = syck_new_map(
- syck_hdlr_add_node( (SyckParser *)parser, yyvsp[-2].nodeData ),
- syck_hdlr_add_node( (SyckParser *)parser, yyvsp[0].nodeData ) );
- }
- break;
-
- case 70:
-#line 398 "gram.y"
- {
- if ( yyvsp[-2].nodeData->shortcut == NULL )
- {
- yyvsp[-2].nodeData->shortcut = syck_new_seq( yyvsp[0].nodeId );
- }
- else
- {
- syck_seq_add( yyvsp[-2].nodeData->shortcut, yyvsp[0].nodeId );
- }
- yyval.nodeData = yyvsp[-2].nodeData;
- }
- break;
-
- case 71:
-#line 410 "gram.y"
- {
- apply_seq_in_map( (SyckParser *)parser, yyvsp[-2].nodeData );
- syck_map_update( yyvsp[-2].nodeData, yyvsp[0].nodeData );
- syck_free_node( yyvsp[0].nodeData );
- yyvsp[0].nodeData = NULL;
- yyval.nodeData = yyvsp[-2].nodeData;
- }
- break;
-
- case 72:
-#line 418 "gram.y"
- {
- yyval.nodeData = yyvsp[-1].nodeData;
- }
- break;
-
- case 73:
-#line 427 "gram.y"
- {
- yyval.nodeData = syck_new_map(
- syck_hdlr_add_node( (SyckParser *)parser, yyvsp[-2].nodeData ),
- syck_hdlr_add_node( (SyckParser *)parser, yyvsp[0].nodeData ) );
- }
- break;
-
- case 74:
-#line 435 "gram.y"
- {
- yyval.nodeData = yyvsp[-1].nodeData;
- }
- break;
-
- case 75:
-#line 439 "gram.y"
- {
- yyval.nodeData = syck_alloc_map();
- }
- break;
-
- case 77:
-#line 446 "gram.y"
- {
- syck_map_update( yyvsp[-2].nodeData, yyvsp[0].nodeData );
- syck_free_node( yyvsp[0].nodeData );
- yyvsp[0].nodeData = NULL;
- yyval.nodeData = yyvsp[-2].nodeData;
- }
- break;
-
- case 78:
-#line 455 "gram.y"
- {
- NULL_NODE( parser, n );
- yyval.nodeData = syck_new_map(
- syck_hdlr_add_node( (SyckParser *)parser, yyvsp[0].nodeData ),
- syck_hdlr_add_node( (SyckParser *)parser, n ) );
- }
- break;
-
-
- }
-
-/* Line 1010 of yacc.c. */
-#line 1651 "gram.c"
-
- yyvsp -= yylen;
- yyssp -= yylen;
-
-
- YY_STACK_PRINT (yyss, yyssp);
-
- *++yyvsp = yyval;
-
-
- /* Now `shift' the result of the reduction. Determine what state
- that goes to, based on the state we popped back to and the rule
- number reduced by. */
-
- yyn = yyr1[yyn];
-
- yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
- if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
- yystate = yytable[yystate];
- else
- yystate = yydefgoto[yyn - YYNTOKENS];
-
- goto yynewstate;
-
-
-/*------------------------------------.
-| yyerrlab -- here on detecting error |
-`------------------------------------*/
-yyerrlab:
- /* If not already recovering from an error, report this error. */
- if (!yyerrstatus)
- {
- ++yynerrs;
-#if YYERROR_VERBOSE
- yyn = yypact[yystate];
-
- if (YYPACT_NINF < yyn && yyn < YYLAST)
- {
- YYSIZE_T yysize = 0;
- int yytype = YYTRANSLATE (yychar);
- const char* yyprefix;
- char *yymsg;
- int yyx;
-
- /* Start YYX at -YYN if negative to avoid negative indexes in
- YYCHECK. */
- int yyxbegin = yyn < 0 ? -yyn : 0;
-
- /* Stay within bounds of both yycheck and yytname. */
- int yychecklim = YYLAST - yyn;
- int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
- int yycount = 0;
-
- yyprefix = ", expecting ";
- for (yyx = yyxbegin; yyx < yyxend; ++yyx)
- if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
- {
- yysize += yystrlen (yyprefix) + yystrlen (yytname [yyx]);
- yycount += 1;
- if (yycount == 5)
- {
- yysize = 0;
- break;
- }
- }
- yysize += (sizeof ("syntax error, unexpected ")
- + yystrlen (yytname[yytype]));
- yymsg = (char *) YYSTACK_ALLOC (yysize);
- if (yymsg != 0)
- {
- char *yyp = yystpcpy (yymsg, "syntax error, unexpected ");
- yyp = yystpcpy (yyp, yytname[yytype]);
-
- if (yycount < 5)
- {
- yyprefix = ", expecting ";
- for (yyx = yyxbegin; yyx < yyxend; ++yyx)
- if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
- {
- yyp = yystpcpy (yyp, yyprefix);
- yyp = yystpcpy (yyp, yytname[yyx]);
- yyprefix = " or ";
- }
- }
- yyerror (yymsg);
- YYSTACK_FREE (yymsg);
- }
- else
- yyerror ("syntax error; also virtual memory exhausted");
- }
- else
-#endif /* YYERROR_VERBOSE */
- yyerror ("syntax error");
- }
-
-
-
- if (yyerrstatus == 3)
- {
- /* If just tried and failed to reuse lookahead token after an
- error, discard it. */
-
- if (yychar <= YYEOF)
- {
- /* If at end of input, pop the error token,
- then the rest of the stack, then return failure. */
- if (yychar == YYEOF)
- for (;;)
- {
- YYPOPSTACK;
- if (yyssp == yyss)
- YYABORT;
- YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp);
- yydestruct (yystos[*yyssp], yyvsp);
- }
- }
- else
- {
- YYDSYMPRINTF ("Error: discarding", yytoken, &yylval, &yylloc);
- yydestruct (yytoken, &yylval);
- yychar = YYEMPTY;
-
- }
- }
-
- /* Else will try to reuse lookahead token after shifting the error
- token. */
- goto yyerrlab1;
-
-
-/*---------------------------------------------------.
-| yyerrorlab -- error raised explicitly by YYERROR. |
-`---------------------------------------------------*/
-yyerrorlab:
-
-#ifdef __GNUC__
- /* Pacify GCC when the user code never invokes YYERROR and the label
- yyerrorlab therefore never appears in user code. */
- if (0)
- goto yyerrorlab;
-#endif
-
- yyvsp -= yylen;
- yyssp -= yylen;
- yystate = *yyssp;
- goto yyerrlab1;
-
-
-/*-------------------------------------------------------------.
-| yyerrlab1 -- common code for both syntax error and YYERROR. |
-`-------------------------------------------------------------*/
-yyerrlab1:
- yyerrstatus = 3; /* Each real token shifted decrements this. */
-
- for (;;)
- {
- yyn = yypact[yystate];
- if (yyn != YYPACT_NINF)
- {
- yyn += YYTERROR;
- if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
- {
- yyn = yytable[yyn];
- if (0 < yyn)
- break;
- }
- }
-
- /* Pop the current state because it cannot handle the error token. */
- if (yyssp == yyss)
- YYABORT;
-
- YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp);
- yydestruct (yystos[yystate], yyvsp);
- YYPOPSTACK;
- yystate = *yyssp;
- YY_STACK_PRINT (yyss, yyssp);
- }
-
- if (yyn == YYFINAL)
- YYACCEPT;
-
- YYDPRINTF ((stderr, "Shifting error token, "));
-
- *++yyvsp = yylval;
-
-
- yystate = yyn;
- goto yynewstate;
-
-
-/*-------------------------------------.
-| yyacceptlab -- YYACCEPT comes here. |
-`-------------------------------------*/
-yyacceptlab:
- yyresult = 0;
- goto yyreturn;
-
-/*-----------------------------------.
-| yyabortlab -- YYABORT comes here. |
-`-----------------------------------*/
-yyabortlab:
- yyresult = 1;
- goto yyreturn;
-
-#ifndef yyoverflow
-/*----------------------------------------------.
-| yyoverflowlab -- parser overflow comes here. |
-`----------------------------------------------*/
-yyoverflowlab:
- yyerror ("parser stack overflow");
- yyresult = 2;
- /* Fall through. */
-#endif
-
-yyreturn:
-#ifndef yyoverflow
- if (yyss != yyssa)
- YYSTACK_FREE (yyss);
-#endif
- return yyresult;
-}
-
-
-#line 464 "gram.y"
-
-
-void
-apply_seq_in_map( SyckParser *parser, SyckNode *n )
-{
- long map_len;
- if ( n->shortcut == NULL )
- {
- return;
- }
-
- map_len = syck_map_count( n );
- syck_map_assign( n, map_value, map_len - 1,
- syck_hdlr_add_node( parser, n->shortcut ) );
-
- n->shortcut = NULL;
-}
-
-
diff --git a/ext/syck/gram.h b/ext/syck/gram.h
deleted file mode 100644
index 547149ab4b..0000000000
--- a/ext/syck/gram.h
+++ /dev/null
@@ -1,79 +0,0 @@
-/* A Bison parser, made by GNU Bison 1.875d. */
-
-/* Skeleton parser for Yacc-like parsing with Bison,
- Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA. */
-
-/* As a special exception, when this file is copied by Bison into a
- Bison output file, you may use that output file without restriction.
- This special exception was added by the Free Software Foundation
- in version 1.24 of Bison. */
-
-/* Tokens. */
-#ifndef YYTOKENTYPE
-# define YYTOKENTYPE
- /* Put the tokens into the symbol table, so that GDB and other debuggers
- know about them. */
- enum yytokentype {
- YAML_ANCHOR = 258,
- YAML_ALIAS = 259,
- YAML_TRANSFER = 260,
- YAML_TAGURI = 261,
- YAML_ITRANSFER = 262,
- YAML_WORD = 263,
- YAML_PLAIN = 264,
- YAML_BLOCK = 265,
- YAML_DOCSEP = 266,
- YAML_IOPEN = 267,
- YAML_INDENT = 268,
- YAML_IEND = 269
- };
-#endif
-#define YAML_ANCHOR 258
-#define YAML_ALIAS 259
-#define YAML_TRANSFER 260
-#define YAML_TAGURI 261
-#define YAML_ITRANSFER 262
-#define YAML_WORD 263
-#define YAML_PLAIN 264
-#define YAML_BLOCK 265
-#define YAML_DOCSEP 266
-#define YAML_IOPEN 267
-#define YAML_INDENT 268
-#define YAML_IEND 269
-
-
-
-
-#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
-#line 35 "gram.y"
-typedef union YYSTYPE {
- SYMID nodeId;
- SyckNode *nodeData;
- char *name;
-} YYSTYPE;
-/* Line 1285 of yacc.c. */
-#line 71 "gram.h"
-# define yystype YYSTYPE /* obsolescent; will be withdrawn */
-# define YYSTYPE_IS_DECLARED 1
-# define YYSTYPE_IS_TRIVIAL 1
-#endif
-
-
-
-
-
diff --git a/ext/syck/handler.c b/ext/syck/handler.c
deleted file mode 100644
index 40f5ef27d0..0000000000
--- a/ext/syck/handler.c
+++ /dev/null
@@ -1,173 +0,0 @@
-/*
- * handler.c
- *
- * $Author$
- *
- * Copyright (C) 2003 why the lucky stiff
- */
-
-#include "ruby/ruby.h"
-#include "syck.h"
-
-SYMID
-syck_hdlr_add_node( SyckParser *p, SyckNode *n )
-{
- SYMID id;
-
- if ( ! n->id )
- {
- n->id = (p->handler)( p, n );
- }
- id = n->id;
-
- if ( n->anchor == NULL )
- {
- syck_free_node( n );
- }
- return id;
-}
-
-SyckNode *
-syck_hdlr_add_anchor( SyckParser *p, char *a, SyckNode *n )
-{
- SyckNode *ntmp = NULL;
-
- n->anchor = a;
- if ( p->bad_anchors != NULL )
- {
- SyckNode *bad;
- if ( st_lookup( p->bad_anchors, (st_data_t)a, (void *)&bad ) )
- {
- if ( n->kind != syck_str_kind )
- {
- n->id = bad->id;
- (p->handler)( p, n );
- }
- }
- }
- if ( p->anchors == NULL )
- {
- p->anchors = st_init_strtable();
- }
- if ( st_lookup( p->anchors, (st_data_t)a, (void *)&ntmp ) )
- {
- if ( ntmp != (void *)1 )
- {
- syck_free_node( ntmp );
- }
- }
- st_insert( p->anchors, (st_data_t)a, (st_data_t)n );
- return n;
-}
-
-void
-syck_hdlr_remove_anchor( SyckParser *p, char *a )
-{
- char *atmp = a;
- SyckNode *ntmp;
- if ( p->anchors == NULL )
- {
- p->anchors = st_init_strtable();
- }
- if ( st_delete( p->anchors, (void *)&atmp, (void *)&ntmp ) )
- {
- if ( ntmp != (void *)1 )
- {
- syck_free_node( ntmp );
- }
- }
- st_insert( p->anchors, (st_data_t)a, (st_data_t)1 );
-}
-
-SyckNode *
-syck_hdlr_get_anchor( SyckParser *p, char *a )
-{
- SyckNode *n = NULL;
-
- if ( p->anchors != NULL )
- {
- if ( st_lookup( p->anchors, (st_data_t)a, (void *)&n ) )
- {
- if ( n != (void *)1 )
- {
- S_FREE( a );
- return n;
- }
- else
- {
- if ( p->bad_anchors == NULL )
- {
- p->bad_anchors = st_init_strtable();
- }
- if ( ! st_lookup( p->bad_anchors, (st_data_t)a, (void *)&n ) )
- {
- n = (p->bad_anchor_handler)( p, a );
- st_insert( p->bad_anchors, (st_data_t)a, (st_data_t)n );
- }
- }
- }
- }
-
- if ( n == NULL )
- {
- n = (p->bad_anchor_handler)( p, a );
- }
-
- if ( n->anchor )
- {
- S_FREE( a );
- }
- else
- {
- n->anchor = a;
- }
-
- return n;
-}
-
-void
-syck_add_transfer( char *uri, SyckNode *n, int taguri )
-{
- if ( n->type_id != NULL )
- {
- S_FREE( n->type_id );
- }
-
- if ( taguri == 0 )
- {
- n->type_id = uri;
- return;
- }
-
- n->type_id = syck_type_id_to_uri( uri );
- S_FREE( uri );
-}
-
-char *
-syck_xprivate( const char *type_id, int type_len )
-{
- char *uri = S_ALLOC_N( char, type_len + 14 );
- uri[0] = '\0';
- strcat( uri, "x-private:" );
- strncat( uri, type_id, type_len );
- return uri;
-}
-
-char *
-syck_taguri( const char *domain, const char *type_id, int type_len )
-{
- char *uri = S_ALLOC_N( char, strlen( domain ) + type_len + 14 );
- uri[0] = '\0';
- strcat( uri, "tag:" );
- strcat( uri, domain );
- strcat( uri, ":" );
- strncat( uri, type_id, type_len );
- return uri;
-}
-
-int
-syck_try_implicit( SyckNode *n )
-{
- return 1;
-}
-
diff --git a/ext/syck/implicit.c b/ext/syck/implicit.c
deleted file mode 100644
index 6911e6175d..0000000000
--- a/ext/syck/implicit.c
+++ /dev/null
@@ -1,2990 +0,0 @@
-/* Generated by re2c 0.9.10 on Mon Sep 19 21:46:50 2005 */
-#line 1 "implicit.re"
-/*
- * implicit.re
- *
- * $Author$
- *
- * Copyright (C) 2003 why the lucky stiff
- */
-
-#include "ruby/ruby.h"
-#include "syck.h"
-
-#define YYCTYPE char
-#define YYCURSOR cursor
-#define YYMARKER marker
-#define YYLIMIT limit
-#define YYFILL(n) (void)0
-
-void
-try_tag_implicit( SyckNode *n, int taguri )
-{
- const char *tid = "";
- switch ( n->kind )
- {
- case syck_str_kind:
- tid = syck_match_implicit( n->data.str->ptr, n->data.str->len );
- break;
-
- case syck_seq_kind:
- tid = "seq";
- break;
-
- case syck_map_kind:
- tid = "map";
- break;
- }
- if ( n->type_id != NULL ) S_FREE( n->type_id );
- if ( taguri == 1 )
- {
- n->type_id = syck_taguri( YAML_DOMAIN, tid, (int)strlen( tid ) );
- } else {
- n->type_id = syck_strndup( tid, (int)strlen( tid ) );
- }
-}
-
-const char *
-syck_match_implicit( const char *str, size_t len )
-{
- const char *cursor, *limit, *marker = 0;
- cursor = str;
- limit = str + len;
-
-
-#line 55 "<stdout>"
-{
- YYCTYPE yych;
- unsigned int yyaccept;
- goto yy0;
- ++YYCURSOR;
-yy0:
- if((YYLIMIT - YYCURSOR) < 26) YYFILL(26);
- yych = *YYCURSOR;
- switch(yych){
- case 0x00: goto yy6;
- case '+': goto yy16;
- case '-': goto yy17;
- case '.': goto yy20;
- case '0': goto yy18;
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': goto yy19;
- case '<': goto yy22;
- case '=': goto yy21;
- case 'F': goto yy15;
- case 'N': goto yy5;
- case 'O': goto yy13;
- case 'T': goto yy11;
- case 'Y': goto yy9;
- case 'f': goto yy14;
- case 'n': goto yy4;
- case 'o': goto yy12;
- case 't': goto yy10;
- case 'y': goto yy8;
- case '~': goto yy2;
- default: goto yy23;
- }
-yy2: ++YYCURSOR;
- if((yych = *YYCURSOR) <= 0x00) goto yy6;
- goto yy3;
-yy3:
-#line 123 "implicit.re"
-{ return "str"; }
-#line 100 "<stdout>"
-yy4: yyaccept = 0;
- yych = *(YYMARKER = ++YYCURSOR);
- switch(yych){
- case 'o': goto yy172;
- case 'u': goto yy200;
- default: goto yy3;
- }
-yy5: yyaccept = 0;
- yych = *(YYMARKER = ++YYCURSOR);
- switch(yych){
- case 'O': case 'o': goto yy172;
- case 'U': goto yy195;
- case 'u': goto yy196;
- default: goto yy3;
- }
-yy6: ++YYCURSOR;
- goto yy7;
-yy7:
-#line 85 "implicit.re"
-{ return "null"; }
-#line 121 "<stdout>"
-yy8: yyaccept = 0;
- yych = *(YYMARKER = ++YYCURSOR);
- switch(yych){
- case 'e': goto yy194;
- default: goto yy3;
- }
-yy9: yyaccept = 0;
- yych = *(YYMARKER = ++YYCURSOR);
- switch(yych){
- case 'E': goto yy192;
- case 'e': goto yy193;
- default: goto yy3;
- }
-yy10: yyaccept = 0;
- yych = *(YYMARKER = ++YYCURSOR);
- switch(yych){
- case 'r': goto yy190;
- default: goto yy3;
- }
-yy11: yyaccept = 0;
- yych = *(YYMARKER = ++YYCURSOR);
- switch(yych){
- case 'R': goto yy186;
- case 'r': goto yy187;
- default: goto yy3;
- }
-yy12: yyaccept = 0;
- yych = *(YYMARKER = ++YYCURSOR);
- switch(yych){
- case 'f': goto yy185;
- case 'n': goto yy182;
- default: goto yy3;
- }
-yy13: yyaccept = 0;
- yych = *(YYMARKER = ++YYCURSOR);
- switch(yych){
- case 'F': goto yy180;
- case 'N': case 'n': goto yy182;
- case 'f': goto yy181;
- default: goto yy3;
- }
-yy14: yyaccept = 0;
- yych = *(YYMARKER = ++YYCURSOR);
- switch(yych){
- case 'a': goto yy177;
- default: goto yy3;
- }
-yy15: yyaccept = 0;
- yych = *(YYMARKER = ++YYCURSOR);
- switch(yych){
- case 'A': goto yy168;
- case 'a': goto yy169;
- default: goto yy3;
- }
-yy16: yyaccept = 0;
- yych = *(YYMARKER = ++YYCURSOR);
- switch(yych){
- case '.': goto yy167;
- case '0': goto yy158;
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': goto yy47;
- default: goto yy3;
- }
-yy17: yyaccept = 0;
- yych = *(YYMARKER = ++YYCURSOR);
- switch(yych){
- case '.': goto yy157;
- case '0': goto yy158;
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': goto yy47;
- default: goto yy3;
- }
-yy18: yyaccept = 0;
- yych = *(YYMARKER = ++YYCURSOR);
- switch(yych){
- case 0x00: goto yy52;
- case ',': goto yy142;
- case '.': goto yy50;
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7': goto yy140;
- case '8':
- case '9': goto yy141;
- case ':': goto yy49;
- case 'x': goto yy144;
- default: goto yy3;
- }
-yy19: yyaccept = 0;
- yych = *(YYMARKER = ++YYCURSOR);
- switch(yych){
- case 0x00: goto yy52;
- case ',': goto yy47;
- case '.': goto yy50;
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': goto yy46;
- case ':': goto yy49;
- default: goto yy3;
- }
-yy20: yyaccept = 0;
- yych = *(YYMARKER = ++YYCURSOR);
- switch(yych){
- case 'I': goto yy33;
- case 'N': goto yy31;
- case 'i': goto yy32;
- case 'n': goto yy30;
- default: goto yy3;
- }
-yy21: yych = *++YYCURSOR;
- if(yych <= 0x00) goto yy28;
- goto yy3;
-yy22: yyaccept = 0;
- yych = *(YYMARKER = ++YYCURSOR);
- switch(yych){
- case '<': goto yy24;
- default: goto yy3;
- }
-yy23: yych = *++YYCURSOR;
- goto yy3;
-yy24: yych = *++YYCURSOR;
- if(yych <= 0x00) goto yy26;
- goto yy25;
-yy25: YYCURSOR = YYMARKER;
- switch(yyaccept){
- case 0: goto yy3;
- }
-yy26: ++YYCURSOR;
- goto yy27;
-yy27:
-#line 121 "implicit.re"
-{ return "merge"; }
-#line 279 "<stdout>"
-yy28: ++YYCURSOR;
- goto yy29;
-yy29:
-#line 119 "implicit.re"
-{ return "default"; }
-#line 285 "<stdout>"
-yy30: yych = *++YYCURSOR;
- switch(yych){
- case 'a': goto yy45;
- default: goto yy25;
- }
-yy31: yych = *++YYCURSOR;
- switch(yych){
- case 'A': goto yy40;
- case 'a': goto yy41;
- default: goto yy25;
- }
-yy32: yych = *++YYCURSOR;
- switch(yych){
- case 'n': goto yy39;
- default: goto yy25;
- }
-yy33: yych = *++YYCURSOR;
- switch(yych){
- case 'N': goto yy34;
- case 'n': goto yy35;
- default: goto yy25;
- }
-yy34: yych = *++YYCURSOR;
- switch(yych){
- case 'F': goto yy36;
- default: goto yy25;
- }
-yy35: yych = *++YYCURSOR;
- switch(yych){
- case 'f': goto yy36;
- default: goto yy25;
- }
-yy36: yych = *++YYCURSOR;
- if(yych >= 0x01) goto yy25;
- goto yy37;
-yy37: ++YYCURSOR;
- goto yy38;
-yy38:
-#line 105 "implicit.re"
-{ return "float#inf"; }
-#line 326 "<stdout>"
-yy39: yych = *++YYCURSOR;
- switch(yych){
- case 'f': goto yy36;
- default: goto yy25;
- }
-yy40: yych = *++YYCURSOR;
- switch(yych){
- case 'N': goto yy42;
- default: goto yy25;
- }
-yy41: yych = *++YYCURSOR;
- switch(yych){
- case 'N': goto yy42;
- default: goto yy25;
- }
-yy42: yych = *++YYCURSOR;
- if(yych >= 0x01) goto yy25;
- goto yy43;
-yy43: ++YYCURSOR;
- goto yy44;
-yy44:
-#line 109 "implicit.re"
-{ return "float#nan"; }
-#line 350 "<stdout>"
-yy45: yych = *++YYCURSOR;
- switch(yych){
- case 'n': goto yy42;
- default: goto yy25;
- }
-yy46: yych = *++YYCURSOR;
- switch(yych){
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': goto yy74;
- default: goto yy48;
- }
-yy47: ++YYCURSOR;
- if(YYLIMIT == YYCURSOR) YYFILL(1);
- yych = *YYCURSOR;
- goto yy48;
-yy48: switch(yych){
- case 0x00: goto yy52;
- case ',': case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': goto yy47;
- case '.': goto yy50;
- case ':': goto yy49;
- default: goto yy25;
- }
-yy49: ++YYCURSOR;
- if(YYLIMIT == YYCURSOR) YYFILL(1);
- yych = *YYCURSOR;
- switch(yych){
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5': goto yy66;
- case '6':
- case '7':
- case '8':
- case '9': goto yy67;
- default: goto yy25;
- }
-yy50: ++YYCURSOR;
- if((YYLIMIT - YYCURSOR) < 3) YYFILL(3);
- yych = *YYCURSOR;
- goto yy51;
-yy51: switch(yych){
- case 0x00: goto yy56;
- case ',': goto yy54;
- case '.': goto yy58;
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': goto yy50;
- case 'E': case 'e': goto yy60;
- default: goto yy25;
- }
-yy52: ++YYCURSOR;
- goto yy53;
-yy53:
-#line 97 "implicit.re"
-{ return "int"; }
-#line 432 "<stdout>"
-yy54: ++YYCURSOR;
- if(YYLIMIT == YYCURSOR) YYFILL(1);
- yych = *YYCURSOR;
- goto yy55;
-yy55: switch(yych){
- case 0x00: goto yy56;
- case ',': case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': goto yy54;
- default: goto yy25;
- }
-yy56: ++YYCURSOR;
- goto yy57;
-yy57:
-#line 99 "implicit.re"
-{ return "float#fix"; }
-#line 456 "<stdout>"
-yy58: ++YYCURSOR;
- if((YYLIMIT - YYCURSOR) < 3) YYFILL(3);
- yych = *YYCURSOR;
- goto yy59;
-yy59: switch(yych){
- case '.': case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': goto yy58;
- case 'E': case 'e': goto yy60;
- default: goto yy25;
- }
-yy60: yych = *++YYCURSOR;
- switch(yych){
- case '+': case '-': goto yy61;
- default: goto yy25;
- }
-yy61: yych = *++YYCURSOR;
- if(yych <= 0x00) goto yy25;
- goto yy63;
-yy62: ++YYCURSOR;
- if(YYLIMIT == YYCURSOR) YYFILL(1);
- yych = *YYCURSOR;
- goto yy63;
-yy63: switch(yych){
- case 0x00: goto yy64;
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': goto yy62;
- default: goto yy25;
- }
-yy64: ++YYCURSOR;
- goto yy65;
-yy65:
-#line 101 "implicit.re"
-{ return "float#exp"; }
-#line 506 "<stdout>"
-yy66: ++YYCURSOR;
- if(YYLIMIT == YYCURSOR) YYFILL(1);
- yych = *YYCURSOR;
- switch(yych){
- case 0x00: goto yy70;
- case '.': goto yy68;
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': goto yy67;
- case ':': goto yy49;
- default: goto yy25;
- }
-yy67: ++YYCURSOR;
- if(YYLIMIT == YYCURSOR) YYFILL(1);
- yych = *YYCURSOR;
- switch(yych){
- case 0x00: goto yy70;
- case '.': goto yy68;
- case ':': goto yy49;
- default: goto yy25;
- }
-yy68: ++YYCURSOR;
- if(YYLIMIT == YYCURSOR) YYFILL(1);
- yych = *YYCURSOR;
- goto yy69;
-yy69: switch(yych){
- case 0x00: goto yy72;
- case ',': case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': goto yy68;
- default: goto yy25;
- }
-yy70: ++YYCURSOR;
- goto yy71;
-yy71:
-#line 95 "implicit.re"
-{ return "int#base60"; }
-#line 558 "<stdout>"
-yy72: ++YYCURSOR;
- goto yy73;
-yy73:
-#line 103 "implicit.re"
-{ return "float#base60"; }
-#line 564 "<stdout>"
-yy74: yych = *++YYCURSOR;
- switch(yych){
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': goto yy75;
- default: goto yy48;
- }
-yy75: yych = *++YYCURSOR;
- switch(yych){
- case '-': goto yy76;
- default: goto yy48;
- }
-yy76: yych = *++YYCURSOR;
- switch(yych){
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': goto yy77;
- default: goto yy25;
- }
-yy77: yych = *++YYCURSOR;
- switch(yych){
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': goto yy78;
- default: goto yy25;
- }
-yy78: yych = *++YYCURSOR;
- switch(yych){
- case '-': goto yy79;
- default: goto yy25;
- }
-yy79: yych = *++YYCURSOR;
- switch(yych){
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': goto yy80;
- default: goto yy25;
- }
-yy80: yych = *++YYCURSOR;
- switch(yych){
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': goto yy81;
- default: goto yy25;
- }
-yy81: yych = *++YYCURSOR;
- switch(yych){
- case 0x00: goto yy82;
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': goto yy25;
- case 'T': goto yy84;
- case 't': goto yy85;
- default: goto yy87;
- }
-yy82: ++YYCURSOR;
- goto yy83;
-yy83:
-#line 111 "implicit.re"
-{ return "timestamp#ymd"; }
-#line 667 "<stdout>"
-yy84: yych = *++YYCURSOR;
- switch(yych){
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': goto yy126;
- default: goto yy25;
- }
-yy85: yych = *++YYCURSOR;
- switch(yych){
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': goto yy108;
- default: goto yy25;
- }
-yy86: ++YYCURSOR;
- if((YYLIMIT - YYCURSOR) < 9) YYFILL(9);
- yych = *YYCURSOR;
- goto yy87;
-yy87: switch(yych){
- case 0x09: case ' ': goto yy86;
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': goto yy88;
- default: goto yy25;
- }
-yy88: yych = *++YYCURSOR;
- switch(yych){
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': goto yy89;
- default: goto yy25;
- }
-yy89: yych = *++YYCURSOR;
- switch(yych){
- case ':': goto yy90;
- default: goto yy25;
- }
-yy90: yych = *++YYCURSOR;
- switch(yych){
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': goto yy91;
- default: goto yy25;
- }
-yy91: yych = *++YYCURSOR;
- switch(yych){
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': goto yy92;
- default: goto yy25;
- }
-yy92: yych = *++YYCURSOR;
- switch(yych){
- case ':': goto yy93;
- default: goto yy25;
- }
-yy93: yych = *++YYCURSOR;
- switch(yych){
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': goto yy94;
- default: goto yy25;
- }
-yy94: yych = *++YYCURSOR;
- switch(yych){
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': goto yy95;
- default: goto yy25;
- }
-yy95: yych = *++YYCURSOR;
- switch(yych){
- case 0x09: case ' ': goto yy98;
- case '.': goto yy96;
- default: goto yy25;
- }
-yy96: ++YYCURSOR;
- if(YYLIMIT == YYCURSOR) YYFILL(1);
- yych = *YYCURSOR;
- goto yy97;
-yy97: switch(yych){
- case 0x09: case ' ': goto yy98;
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': goto yy96;
- default: goto yy25;
- }
-yy98: ++YYCURSOR;
- if((YYLIMIT - YYCURSOR) < 7) YYFILL(7);
- yych = *YYCURSOR;
- goto yy99;
-yy99: switch(yych){
- case 0x09: case ' ': goto yy98;
- case '+': case '-': goto yy101;
- case 'Z': goto yy100;
- default: goto yy25;
- }
-yy100: yych = *++YYCURSOR;
- if(yych <= 0x00) goto yy105;
- goto yy25;
-yy101: yych = *++YYCURSOR;
- switch(yych){
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': goto yy102;
- default: goto yy25;
- }
-yy102: yych = *++YYCURSOR;
- switch(yych){
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': goto yy103;
- default: goto yy25;
- }
-yy103: yych = *++YYCURSOR;
- switch(yych){
- case 0x00: goto yy105;
- case ':': goto yy104;
- default: goto yy25;
- }
-yy104: yych = *++YYCURSOR;
- switch(yych){
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': goto yy107;
- default: goto yy25;
- }
-yy105: ++YYCURSOR;
- goto yy106;
-yy106:
-#line 115 "implicit.re"
-{ return "timestamp#spaced"; }
-#line 884 "<stdout>"
-yy107: yych = *++YYCURSOR;
- switch(yych){
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': goto yy100;
- default: goto yy25;
- }
-yy108: yych = *++YYCURSOR;
- switch(yych){
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': goto yy109;
- default: goto yy25;
- }
-yy109: yych = *++YYCURSOR;
- switch(yych){
- case ':': goto yy110;
- default: goto yy25;
- }
-yy110: yych = *++YYCURSOR;
- switch(yych){
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': goto yy111;
- default: goto yy25;
- }
-yy111: yych = *++YYCURSOR;
- switch(yych){
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': goto yy112;
- default: goto yy25;
- }
-yy112: yych = *++YYCURSOR;
- switch(yych){
- case ':': goto yy113;
- default: goto yy25;
- }
-yy113: yych = *++YYCURSOR;
- switch(yych){
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': goto yy114;
- default: goto yy25;
- }
-yy114: yych = *++YYCURSOR;
- switch(yych){
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': goto yy115;
- default: goto yy25;
- }
-yy115: yych = *++YYCURSOR;
- switch(yych){
- case '.': goto yy116;
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': goto yy25;
- default: goto yy117;
- }
-yy116: ++YYCURSOR;
- if((YYLIMIT - YYCURSOR) < 7) YYFILL(7);
- yych = *YYCURSOR;
- goto yy117;
-yy117: switch(yych){
- case '+': case '-': goto yy119;
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': goto yy116;
- case 'Z': goto yy118;
- default: goto yy25;
- }
-yy118: yych = *++YYCURSOR;
- if(yych <= 0x00) goto yy123;
- goto yy25;
-yy119: yych = *++YYCURSOR;
- switch(yych){
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': goto yy120;
- default: goto yy25;
- }
-yy120: yych = *++YYCURSOR;
- switch(yych){
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': goto yy121;
- default: goto yy25;
- }
-yy121: yych = *++YYCURSOR;
- switch(yych){
- case 0x00: goto yy123;
- case ':': goto yy122;
- default: goto yy25;
- }
-yy122: yych = *++YYCURSOR;
- switch(yych){
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': goto yy125;
- default: goto yy25;
- }
-yy123: ++YYCURSOR;
- goto yy124;
-yy124:
-#line 113 "implicit.re"
-{ return "timestamp#iso8601"; }
-#line 1069 "<stdout>"
-yy125: yych = *++YYCURSOR;
- switch(yych){
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': goto yy118;
- default: goto yy25;
- }
-yy126: yych = *++YYCURSOR;
- switch(yych){
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': goto yy127;
- default: goto yy25;
- }
-yy127: yych = *++YYCURSOR;
- switch(yych){
- case ':': goto yy128;
- default: goto yy25;
- }
-yy128: yych = *++YYCURSOR;
- switch(yych){
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': goto yy129;
- default: goto yy25;
- }
-yy129: yych = *++YYCURSOR;
- switch(yych){
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': goto yy130;
- default: goto yy25;
- }
-yy130: yych = *++YYCURSOR;
- switch(yych){
- case ':': goto yy131;
- default: goto yy25;
- }
-yy131: yych = *++YYCURSOR;
- switch(yych){
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': goto yy132;
- default: goto yy25;
- }
-yy132: yych = *++YYCURSOR;
- switch(yych){
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': goto yy133;
- default: goto yy25;
- }
-yy133: yych = *++YYCURSOR;
- switch(yych){
- case '.': goto yy134;
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': goto yy25;
- case 'Z': goto yy136;
- default: goto yy135;
- }
-yy134: ++YYCURSOR;
- if((YYLIMIT - YYCURSOR) < 7) YYFILL(7);
- yych = *YYCURSOR;
- goto yy135;
-yy135: switch(yych){
- case '+': case '-': goto yy119;
- case '0': goto yy134;
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': goto yy138;
- case 'Z': goto yy118;
- default: goto yy25;
- }
-yy136: yych = *++YYCURSOR;
- if(yych >= 0x01) goto yy25;
- goto yy137;
-yy137: yych = *++YYCURSOR;
- goto yy124;
-yy138: ++YYCURSOR;
- if((YYLIMIT - YYCURSOR) < 7) YYFILL(7);
- yych = *YYCURSOR;
- goto yy139;
-yy139: switch(yych){
- case '+': case '-': goto yy119;
- case '0': goto yy134;
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': goto yy138;
- case 'Z': goto yy136;
- default: goto yy25;
- }
-yy140: yych = *++YYCURSOR;
- switch(yych){
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7': goto yy155;
- case '8':
- case '9': goto yy153;
- default: goto yy143;
- }
-yy141: yych = *++YYCURSOR;
- switch(yych){
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': goto yy153;
- default: goto yy152;
- }
-yy142: ++YYCURSOR;
- if(YYLIMIT == YYCURSOR) YYFILL(1);
- yych = *YYCURSOR;
- goto yy143;
-yy143: switch(yych){
- case 0x00: goto yy149;
- case ',': case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7': goto yy142;
- case '.': goto yy50;
- case '8':
- case '9': goto yy151;
- case ':': goto yy49;
- default: goto yy25;
- }
-yy144: yych = *++YYCURSOR;
- if(yych <= 0x00) goto yy25;
- goto yy146;
-yy145: ++YYCURSOR;
- if(YYLIMIT == YYCURSOR) YYFILL(1);
- yych = *YYCURSOR;
- goto yy146;
-yy146: switch(yych){
- case 0x00: goto yy147;
- case ',': case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': case 'A':
- case 'B':
- case 'C':
- case 'D':
- case 'E':
- case 'F': case 'a':
- case 'b':
- case 'c':
- case 'd':
- case 'e':
- case 'f': goto yy145;
- default: goto yy25;
- }
-yy147: ++YYCURSOR;
- goto yy148;
-yy148:
-#line 91 "implicit.re"
-{ return "int#hex"; }
-#line 1307 "<stdout>"
-yy149: ++YYCURSOR;
- goto yy150;
-yy150:
-#line 93 "implicit.re"
-{ return "int#oct"; }
-#line 1313 "<stdout>"
-yy151: ++YYCURSOR;
- if(YYLIMIT == YYCURSOR) YYFILL(1);
- yych = *YYCURSOR;
- goto yy152;
-yy152: switch(yych){
- case ',': case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': goto yy151;
- case '.': goto yy50;
- case ':': goto yy49;
- default: goto yy25;
- }
-yy153: yych = *++YYCURSOR;
- switch(yych){
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': goto yy154;
- default: goto yy152;
- }
-yy154: yych = *++YYCURSOR;
- switch(yych){
- case '-': goto yy76;
- default: goto yy152;
- }
-yy155: yych = *++YYCURSOR;
- switch(yych){
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7': goto yy156;
- case '8':
- case '9': goto yy154;
- default: goto yy143;
- }
-yy156: yych = *++YYCURSOR;
- switch(yych){
- case '-': goto yy76;
- default: goto yy143;
- }
-yy157: yych = *++YYCURSOR;
- switch(yych){
- case 'I': goto yy160;
- case 'i': goto yy159;
- default: goto yy25;
- }
-yy158: yych = *++YYCURSOR;
- switch(yych){
- case 0x00: goto yy52;
- case 'x': goto yy144;
- default: goto yy143;
- }
-yy159: yych = *++YYCURSOR;
- switch(yych){
- case 'n': goto yy166;
- default: goto yy25;
- }
-yy160: yych = *++YYCURSOR;
- switch(yych){
- case 'N': goto yy161;
- case 'n': goto yy162;
- default: goto yy25;
- }
-yy161: yych = *++YYCURSOR;
- switch(yych){
- case 'F': goto yy163;
- default: goto yy25;
- }
-yy162: yych = *++YYCURSOR;
- switch(yych){
- case 'f': goto yy163;
- default: goto yy25;
- }
-yy163: yych = *++YYCURSOR;
- if(yych >= 0x01) goto yy25;
- goto yy164;
-yy164: ++YYCURSOR;
- goto yy165;
-yy165:
-#line 107 "implicit.re"
-{ return "float#neginf"; }
-#line 1412 "<stdout>"
-yy166: yych = *++YYCURSOR;
- switch(yych){
- case 'f': goto yy163;
- default: goto yy25;
- }
-yy167: yych = *++YYCURSOR;
- switch(yych){
- case 'I': goto yy33;
- case 'i': goto yy32;
- default: goto yy25;
- }
-yy168: yych = *++YYCURSOR;
- switch(yych){
- case 'L': goto yy175;
- default: goto yy25;
- }
-yy169: yych = *++YYCURSOR;
- switch(yych){
- case 'l': goto yy170;
- default: goto yy25;
- }
-yy170: yych = *++YYCURSOR;
- switch(yych){
- case 's': goto yy171;
- default: goto yy25;
- }
-yy171: yych = *++YYCURSOR;
- switch(yych){
- case 'e': goto yy172;
- default: goto yy25;
- }
-yy172: yych = *++YYCURSOR;
- if(yych >= 0x01) goto yy25;
- goto yy173;
-yy173: ++YYCURSOR;
- goto yy174;
-yy174:
-#line 89 "implicit.re"
-{ return "bool#no"; }
-#line 1452 "<stdout>"
-yy175: yych = *++YYCURSOR;
- switch(yych){
- case 'S': goto yy176;
- default: goto yy25;
- }
-yy176: yych = *++YYCURSOR;
- switch(yych){
- case 'E': goto yy172;
- default: goto yy25;
- }
-yy177: yych = *++YYCURSOR;
- switch(yych){
- case 'l': goto yy178;
- default: goto yy25;
- }
-yy178: yych = *++YYCURSOR;
- switch(yych){
- case 's': goto yy179;
- default: goto yy25;
- }
-yy179: yych = *++YYCURSOR;
- switch(yych){
- case 'e': goto yy172;
- default: goto yy25;
- }
-yy180: yych = *++YYCURSOR;
- switch(yych){
- case 'F': goto yy172;
- default: goto yy25;
- }
-yy181: yych = *++YYCURSOR;
- switch(yych){
- case 'f': goto yy172;
- default: goto yy25;
- }
-yy182: yych = *++YYCURSOR;
- if(yych >= 0x01) goto yy25;
- goto yy183;
-yy183: ++YYCURSOR;
- goto yy184;
-yy184:
-#line 87 "implicit.re"
-{ return "bool#yes"; }
-#line 1496 "<stdout>"
-yy185: yych = *++YYCURSOR;
- switch(yych){
- case 'f': goto yy172;
- default: goto yy25;
- }
-yy186: yych = *++YYCURSOR;
- switch(yych){
- case 'U': goto yy189;
- default: goto yy25;
- }
-yy187: yych = *++YYCURSOR;
- switch(yych){
- case 'u': goto yy188;
- default: goto yy25;
- }
-yy188: yych = *++YYCURSOR;
- switch(yych){
- case 'e': goto yy182;
- default: goto yy25;
- }
-yy189: yych = *++YYCURSOR;
- switch(yych){
- case 'E': goto yy182;
- default: goto yy25;
- }
-yy190: yych = *++YYCURSOR;
- switch(yych){
- case 'u': goto yy191;
- default: goto yy25;
- }
-yy191: yych = *++YYCURSOR;
- switch(yych){
- case 'e': goto yy182;
- default: goto yy25;
- }
-yy192: yych = *++YYCURSOR;
- switch(yych){
- case 'S': goto yy182;
- default: goto yy25;
- }
-yy193: yych = *++YYCURSOR;
- switch(yych){
- case 's': goto yy182;
- default: goto yy25;
- }
-yy194: yych = *++YYCURSOR;
- switch(yych){
- case 's': goto yy182;
- default: goto yy25;
- }
-yy195: yych = *++YYCURSOR;
- switch(yych){
- case 'L': goto yy199;
- default: goto yy25;
- }
-yy196: yych = *++YYCURSOR;
- switch(yych){
- case 'l': goto yy197;
- default: goto yy25;
- }
-yy197: yych = *++YYCURSOR;
- switch(yych){
- case 'l': goto yy198;
- default: goto yy25;
- }
-yy198: yych = *++YYCURSOR;
- if(yych <= 0x00) goto yy6;
- goto yy25;
-yy199: yych = *++YYCURSOR;
- switch(yych){
- case 'L': goto yy198;
- default: goto yy25;
- }
-yy200: yych = *++YYCURSOR;
- switch(yych){
- case 'l': goto yy201;
- default: goto yy25;
- }
-yy201: ++YYCURSOR;
- switch((yych = *YYCURSOR)) {
- case 'l': goto yy198;
- default: goto yy25;
- }
-}
-#line 125 "implicit.re"
-
-
-}
-
-/* Remove ending fragment and compare types */
-int
-syck_tagcmp( const char *tag1, const char *tag2 )
-{
- if ( tag1 == tag2 ) return 1;
- if ( tag1 == NULL || tag2 == NULL ) return 0;
- else {
- int i;
- char *othorpe;
- char *tmp1 = syck_strndup( tag1, strlen( tag1 ) );
- char *tmp2 = syck_strndup( tag2, strlen( tag2 ) );
- othorpe = strstr( tmp1, "#" );
- if ( othorpe != NULL ) {
- othorpe[0] = '\0';
- }
- othorpe = strstr( tmp2, "#" );
- if ( othorpe != NULL ) {
- othorpe[0] = '\0';
- }
- i = strcmp( tmp1, tmp2 );
- S_FREE( tmp1 ); S_FREE( tmp2 );
- return i;
- }
-}
-
-char *
-syck_type_id_to_uri( const char *type_id )
-{
- const char *cursor, *limit, *marker = 0;
-
- cursor = type_id;
- limit = type_id + strlen( type_id );
-
-
-#line 1620 "<stdout>"
-{
- YYCTYPE yych;
- unsigned int yyaccept = 0;
- goto yy202;
- ++YYCURSOR;
-yy202:
- if((YYLIMIT - YYCURSOR) < 11) YYFILL(11);
- yych = *YYCURSOR;
- switch(yych){
- case 0x00: goto yy204;
- case '!': goto yy208;
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': case 'A':
- case 'B':
- case 'C':
- case 'D':
- case 'E':
- case 'F':
- case 'G':
- case 'H':
- case 'I':
- case 'J':
- case 'K':
- case 'L':
- case 'M':
- case 'N':
- case 'O':
- case 'P':
- case 'Q':
- case 'R':
- case 'S':
- case 'T':
- case 'U':
- case 'V':
- case 'W':
- case 'X':
- case 'Y':
- case 'Z': case '_': case 'a':
- case 'b':
- case 'c':
- case 'd':
- case 'e':
- case 'f':
- case 'g':
- case 'h':
- case 'i':
- case 'j':
- case 'k':
- case 'l':
- case 'm':
- case 'n':
- case 'o':
- case 'p':
- case 'q':
- case 'r':
- case 's': case 'u':
- case 'v':
- case 'w': case 'y':
- case 'z': goto yy210;
- case 't': goto yy205;
- case 'x': goto yy207;
- default: goto yy211;
- }
-yy204: YYCURSOR = YYMARKER;
- switch(yyaccept){
- case 0: goto yy206;
- }
-yy205: yyaccept = 0;
- yych = *(YYMARKER = ++YYCURSOR);
- switch(yych){
- case ',': goto yy216;
- case '-': goto yy212;
- case '.': goto yy217;
- case '/': goto yy218;
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': case 'A':
- case 'B':
- case 'C':
- case 'D':
- case 'E':
- case 'F':
- case 'G':
- case 'H':
- case 'I':
- case 'J':
- case 'K':
- case 'L':
- case 'M':
- case 'N':
- case 'O':
- case 'P':
- case 'Q':
- case 'R':
- case 'S':
- case 'T':
- case 'U':
- case 'V':
- case 'W':
- case 'X':
- case 'Y':
- case 'Z': case '_': case 'b':
- case 'c':
- case 'd':
- case 'e':
- case 'f':
- case 'g':
- case 'h':
- case 'i':
- case 'j':
- case 'k':
- case 'l':
- case 'm':
- case 'n':
- case 'o':
- case 'p':
- case 'q':
- case 'r':
- case 's':
- case 't':
- case 'u':
- case 'v':
- case 'w':
- case 'x':
- case 'y':
- case 'z': goto yy214;
- case 'a': goto yy246;
- default: goto yy206;
- }
-yy206:
-#line 202 "implicit.re"
-{ return syck_taguri( YAML_DOMAIN, type_id, (int)strlen( type_id ) ); }
-#line 1768 "<stdout>"
-yy207: yyaccept = 0;
- yych = *(YYMARKER = ++YYCURSOR);
- switch(yych){
- case ',': case '.':
- case '/':
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': case 'A':
- case 'B':
- case 'C':
- case 'D':
- case 'E':
- case 'F':
- case 'G':
- case 'H':
- case 'I':
- case 'J':
- case 'K':
- case 'L':
- case 'M':
- case 'N':
- case 'O':
- case 'P':
- case 'Q':
- case 'R':
- case 'S':
- case 'T':
- case 'U':
- case 'V':
- case 'W':
- case 'X':
- case 'Y':
- case 'Z': case '_': case 'a':
- case 'b':
- case 'c':
- case 'd':
- case 'e':
- case 'f':
- case 'g':
- case 'h':
- case 'i':
- case 'j':
- case 'k':
- case 'l':
- case 'm':
- case 'n':
- case 'o':
- case 'p':
- case 'q':
- case 'r':
- case 's':
- case 't':
- case 'u':
- case 'v':
- case 'w':
- case 'x':
- case 'y':
- case 'z': goto yy215;
- case '-': goto yy236;
- default: goto yy206;
- }
-yy208: ++YYCURSOR;
- goto yy209;
-yy209:
-#line 176 "implicit.re"
-{ return syck_xprivate( type_id + 1, (int)strlen( type_id ) - 1 ); }
-#line 1842 "<stdout>"
-yy210: yyaccept = 0;
- yych = *(YYMARKER = ++YYCURSOR);
- switch(yych){
- case ',': goto yy216;
- case '-': goto yy212;
- case '.': goto yy217;
- case '/': goto yy218;
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': case 'A':
- case 'B':
- case 'C':
- case 'D':
- case 'E':
- case 'F':
- case 'G':
- case 'H':
- case 'I':
- case 'J':
- case 'K':
- case 'L':
- case 'M':
- case 'N':
- case 'O':
- case 'P':
- case 'Q':
- case 'R':
- case 'S':
- case 'T':
- case 'U':
- case 'V':
- case 'W':
- case 'X':
- case 'Y':
- case 'Z': case '_': case 'a':
- case 'b':
- case 'c':
- case 'd':
- case 'e':
- case 'f':
- case 'g':
- case 'h':
- case 'i':
- case 'j':
- case 'k':
- case 'l':
- case 'm':
- case 'n':
- case 'o':
- case 'p':
- case 'q':
- case 'r':
- case 's':
- case 't':
- case 'u':
- case 'v':
- case 'w':
- case 'x':
- case 'y':
- case 'z': goto yy214;
- default: goto yy206;
- }
-yy211: yych = *++YYCURSOR;
- goto yy206;
-yy212: ++YYCURSOR;
- if(YYLIMIT == YYCURSOR) YYFILL(1);
- yych = *YYCURSOR;
- goto yy213;
-yy213: switch(yych){
- case '-': goto yy212;
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': case 'A':
- case 'B':
- case 'C':
- case 'D':
- case 'E':
- case 'F':
- case 'G':
- case 'H':
- case 'I':
- case 'J':
- case 'K':
- case 'L':
- case 'M':
- case 'N':
- case 'O':
- case 'P':
- case 'Q':
- case 'R':
- case 'S':
- case 'T':
- case 'U':
- case 'V':
- case 'W':
- case 'X':
- case 'Y':
- case 'Z': case '_': case 'a':
- case 'b':
- case 'c':
- case 'd':
- case 'e':
- case 'f':
- case 'g':
- case 'h':
- case 'i':
- case 'j':
- case 'k':
- case 'l':
- case 'm':
- case 'n':
- case 'o':
- case 'p':
- case 'q':
- case 'r':
- case 's':
- case 't':
- case 'u':
- case 'v':
- case 'w':
- case 'x':
- case 'y':
- case 'z': goto yy214;
- default: goto yy204;
- }
-yy214: ++YYCURSOR;
- if((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
- yych = *YYCURSOR;
- goto yy215;
-yy215: switch(yych){
- case ',': goto yy216;
- case '-': goto yy212;
- case '.': goto yy217;
- case '/': goto yy218;
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': case 'A':
- case 'B':
- case 'C':
- case 'D':
- case 'E':
- case 'F':
- case 'G':
- case 'H':
- case 'I':
- case 'J':
- case 'K':
- case 'L':
- case 'M':
- case 'N':
- case 'O':
- case 'P':
- case 'Q':
- case 'R':
- case 'S':
- case 'T':
- case 'U':
- case 'V':
- case 'W':
- case 'X':
- case 'Y':
- case 'Z': case '_': case 'a':
- case 'b':
- case 'c':
- case 'd':
- case 'e':
- case 'f':
- case 'g':
- case 'h':
- case 'i':
- case 'j':
- case 'k':
- case 'l':
- case 'm':
- case 'n':
- case 'o':
- case 'p':
- case 'q':
- case 'r':
- case 's':
- case 't':
- case 'u':
- case 'v':
- case 'w':
- case 'x':
- case 'y':
- case 'z': goto yy214;
- default: goto yy204;
- }
-yy216: yych = *++YYCURSOR;
- switch(yych){
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': goto yy224;
- default: goto yy204;
- }
-yy217: ++YYCURSOR;
- if(YYLIMIT == YYCURSOR) YYFILL(1);
- yych = *YYCURSOR;
- switch(yych){
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': case 'A':
- case 'B':
- case 'C':
- case 'D':
- case 'E':
- case 'F':
- case 'G':
- case 'H':
- case 'I':
- case 'J':
- case 'K':
- case 'L':
- case 'M':
- case 'N':
- case 'O':
- case 'P':
- case 'Q':
- case 'R':
- case 'S':
- case 'T':
- case 'U':
- case 'V':
- case 'W':
- case 'X':
- case 'Y':
- case 'Z': case '_': case 'a':
- case 'b':
- case 'c':
- case 'd':
- case 'e':
- case 'f':
- case 'g':
- case 'h':
- case 'i':
- case 'j':
- case 'k':
- case 'l':
- case 'm':
- case 'n':
- case 'o':
- case 'p':
- case 'q':
- case 'r':
- case 's':
- case 't':
- case 'u':
- case 'v':
- case 'w':
- case 'x':
- case 'y':
- case 'z': goto yy220;
- default: goto yy204;
- }
-yy218: ++YYCURSOR;
- goto yy219;
-yy219:
-#line 178 "implicit.re"
-{ char *domain = S_ALLOC_N( char, ( YYCURSOR - type_id ) + 15 );
- char *uri;
-
- domain[0] = '\0';
- strncat( domain, type_id, ( YYCURSOR - type_id ) - 1 );
- strcat( domain, "." );
- strcat( domain, YAML_DOMAIN );
- uri = syck_taguri( domain, YYCURSOR, (int)(YYLIMIT - YYCURSOR) );
-
- S_FREE( domain );
- return uri;
- }
-#line 2149 "<stdout>"
-yy220: ++YYCURSOR;
- if((YYLIMIT - YYCURSOR) < 12) YYFILL(12);
- yych = *YYCURSOR;
- goto yy221;
-yy221: switch(yych){
- case ',': goto yy216;
- case '-': goto yy222;
- case '.': goto yy217;
- case '/': goto yy218;
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': case 'A':
- case 'B':
- case 'C':
- case 'D':
- case 'E':
- case 'F':
- case 'G':
- case 'H':
- case 'I':
- case 'J':
- case 'K':
- case 'L':
- case 'M':
- case 'N':
- case 'O':
- case 'P':
- case 'Q':
- case 'R':
- case 'S':
- case 'T':
- case 'U':
- case 'V':
- case 'W':
- case 'X':
- case 'Y':
- case 'Z': case '_': case 'a':
- case 'b':
- case 'c':
- case 'd':
- case 'e':
- case 'f':
- case 'g':
- case 'h':
- case 'i':
- case 'j':
- case 'k':
- case 'l':
- case 'm':
- case 'n':
- case 'o':
- case 'p':
- case 'q':
- case 'r':
- case 's':
- case 't':
- case 'u':
- case 'v':
- case 'w':
- case 'x':
- case 'y':
- case 'z': goto yy220;
- default: goto yy204;
- }
-yy222: ++YYCURSOR;
- if(YYLIMIT == YYCURSOR) YYFILL(1);
- yych = *YYCURSOR;
- goto yy223;
-yy223: switch(yych){
- case '-': goto yy222;
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': case 'A':
- case 'B':
- case 'C':
- case 'D':
- case 'E':
- case 'F':
- case 'G':
- case 'H':
- case 'I':
- case 'J':
- case 'K':
- case 'L':
- case 'M':
- case 'N':
- case 'O':
- case 'P':
- case 'Q':
- case 'R':
- case 'S':
- case 'T':
- case 'U':
- case 'V':
- case 'W':
- case 'X':
- case 'Y':
- case 'Z': case '_': case 'a':
- case 'b':
- case 'c':
- case 'd':
- case 'e':
- case 'f':
- case 'g':
- case 'h':
- case 'i':
- case 'j':
- case 'k':
- case 'l':
- case 'm':
- case 'n':
- case 'o':
- case 'p':
- case 'q':
- case 'r':
- case 's':
- case 't':
- case 'u':
- case 'v':
- case 'w':
- case 'x':
- case 'y':
- case 'z': goto yy220;
- default: goto yy204;
- }
-yy224: yych = *++YYCURSOR;
- switch(yych){
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': goto yy225;
- default: goto yy204;
- }
-yy225: yych = *++YYCURSOR;
- switch(yych){
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': goto yy226;
- default: goto yy204;
- }
-yy226: yych = *++YYCURSOR;
- switch(yych){
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': goto yy227;
- default: goto yy204;
- }
-yy227: yych = *++YYCURSOR;
- switch(yych){
- case '-': goto yy228;
- case '/': goto yy229;
- default: goto yy204;
- }
-yy228: yych = *++YYCURSOR;
- switch(yych){
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': goto yy231;
- default: goto yy204;
- }
-yy229: ++YYCURSOR;
- goto yy230;
-yy230:
-#line 191 "implicit.re"
-{ char *domain = S_ALLOC_N( char, YYCURSOR - type_id );
- char *uri;
-
- domain[0] = '\0';
- strncat( domain, type_id, ( YYCURSOR - type_id ) - 1 );
- uri = syck_taguri( domain, YYCURSOR, (int)(YYLIMIT - YYCURSOR) );
-
- S_FREE( domain );
- return uri;
- }
-#line 2365 "<stdout>"
-yy231: yych = *++YYCURSOR;
- switch(yych){
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': goto yy232;
- default: goto yy204;
- }
-yy232: yych = *++YYCURSOR;
- switch(yych){
- case '-': goto yy233;
- case '/': goto yy229;
- default: goto yy204;
- }
-yy233: yych = *++YYCURSOR;
- switch(yych){
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': goto yy234;
- default: goto yy204;
- }
-yy234: yych = *++YYCURSOR;
- switch(yych){
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': goto yy235;
- default: goto yy204;
- }
-yy235: yych = *++YYCURSOR;
- switch(yych){
- case '/': goto yy229;
- default: goto yy204;
- }
-yy236: yych = *++YYCURSOR;
- switch(yych){
- case 'p': goto yy237;
- default: goto yy213;
- }
-yy237: yych = *++YYCURSOR;
- switch(yych){
- case ',': goto yy216;
- case '.': goto yy217;
- case '/': goto yy218;
- case 'r': goto yy238;
- default: goto yy213;
- }
-yy238: yych = *++YYCURSOR;
- switch(yych){
- case ',': goto yy216;
- case '.': goto yy217;
- case '/': goto yy218;
- case 'i': goto yy239;
- default: goto yy213;
- }
-yy239: yych = *++YYCURSOR;
- switch(yych){
- case ',': goto yy216;
- case '.': goto yy217;
- case '/': goto yy218;
- case 'v': goto yy240;
- default: goto yy213;
- }
-yy240: yych = *++YYCURSOR;
- switch(yych){
- case ',': goto yy216;
- case '.': goto yy217;
- case '/': goto yy218;
- case 'a': goto yy241;
- default: goto yy213;
- }
-yy241: yych = *++YYCURSOR;
- switch(yych){
- case ',': goto yy216;
- case '.': goto yy217;
- case '/': goto yy218;
- case 't': goto yy242;
- default: goto yy213;
- }
-yy242: yych = *++YYCURSOR;
- switch(yych){
- case ',': goto yy216;
- case '.': goto yy217;
- case '/': goto yy218;
- case 'e': goto yy243;
- default: goto yy213;
- }
-yy243: yych = *++YYCURSOR;
- switch(yych){
- case ',': goto yy216;
- case '.': goto yy217;
- case '/': goto yy218;
- case ':': goto yy244;
- default: goto yy213;
- }
-yy244: ++YYCURSOR;
- goto yy245;
-yy245:
-#line 174 "implicit.re"
-{ return syck_strndup( type_id, strlen( type_id ) ); }
-#line 2485 "<stdout>"
-yy246: yych = *++YYCURSOR;
- switch(yych){
- case ',': goto yy216;
- case '.': goto yy217;
- case '/': goto yy218;
- case 'g': goto yy247;
- default: goto yy213;
- }
-yy247: yych = *++YYCURSOR;
- switch(yych){
- case ',': goto yy216;
- case '.': goto yy217;
- case '/': goto yy218;
- case ':': goto yy248;
- default: goto yy213;
- }
-yy248: yych = *++YYCURSOR;
- switch(yych){
- case ',':
- case '-':
- case '.': goto yy204;
- default: goto yy250;
- }
-yy249: ++YYCURSOR;
- if((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
- yych = *YYCURSOR;
- goto yy250;
-yy250: switch(yych){
- case ',': goto yy253;
- case '-': goto yy251;
- case '.': goto yy254;
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': case 'A':
- case 'B':
- case 'C':
- case 'D':
- case 'E':
- case 'F':
- case 'G':
- case 'H':
- case 'I':
- case 'J':
- case 'K':
- case 'L':
- case 'M':
- case 'N':
- case 'O':
- case 'P':
- case 'Q':
- case 'R':
- case 'S':
- case 'T':
- case 'U':
- case 'V':
- case 'W':
- case 'X':
- case 'Y':
- case 'Z': case '_': case 'a':
- case 'b':
- case 'c':
- case 'd':
- case 'e':
- case 'f':
- case 'g':
- case 'h':
- case 'i':
- case 'j':
- case 'k':
- case 'l':
- case 'm':
- case 'n':
- case 'o':
- case 'p':
- case 'q':
- case 'r':
- case 's':
- case 't':
- case 'u':
- case 'v':
- case 'w':
- case 'x':
- case 'y':
- case 'z': goto yy249;
- default: goto yy204;
- }
-yy251: ++YYCURSOR;
- if(YYLIMIT == YYCURSOR) YYFILL(1);
- yych = *YYCURSOR;
- goto yy252;
-yy252: switch(yych){
- case '-': goto yy251;
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': case 'A':
- case 'B':
- case 'C':
- case 'D':
- case 'E':
- case 'F':
- case 'G':
- case 'H':
- case 'I':
- case 'J':
- case 'K':
- case 'L':
- case 'M':
- case 'N':
- case 'O':
- case 'P':
- case 'Q':
- case 'R':
- case 'S':
- case 'T':
- case 'U':
- case 'V':
- case 'W':
- case 'X':
- case 'Y':
- case 'Z': case '_': case 'a':
- case 'b':
- case 'c':
- case 'd':
- case 'e':
- case 'f':
- case 'g':
- case 'h':
- case 'i':
- case 'j':
- case 'k':
- case 'l':
- case 'm':
- case 'n':
- case 'o':
- case 'p':
- case 'q':
- case 'r':
- case 's':
- case 't':
- case 'u':
- case 'v':
- case 'w':
- case 'x':
- case 'y':
- case 'z': goto yy249;
- default: goto yy204;
- }
-yy253: yych = *++YYCURSOR;
- switch(yych){
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': goto yy259;
- default: goto yy204;
- }
-yy254: ++YYCURSOR;
- if(YYLIMIT == YYCURSOR) YYFILL(1);
- yych = *YYCURSOR;
- switch(yych){
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': case 'A':
- case 'B':
- case 'C':
- case 'D':
- case 'E':
- case 'F':
- case 'G':
- case 'H':
- case 'I':
- case 'J':
- case 'K':
- case 'L':
- case 'M':
- case 'N':
- case 'O':
- case 'P':
- case 'Q':
- case 'R':
- case 'S':
- case 'T':
- case 'U':
- case 'V':
- case 'W':
- case 'X':
- case 'Y':
- case 'Z': case '_': case 'a':
- case 'b':
- case 'c':
- case 'd':
- case 'e':
- case 'f':
- case 'g':
- case 'h':
- case 'i':
- case 'j':
- case 'k':
- case 'l':
- case 'm':
- case 'n':
- case 'o':
- case 'p':
- case 'q':
- case 'r':
- case 's':
- case 't':
- case 'u':
- case 'v':
- case 'w':
- case 'x':
- case 'y':
- case 'z': goto yy255;
- default: goto yy204;
- }
-yy255: ++YYCURSOR;
- if((YYLIMIT - YYCURSOR) < 12) YYFILL(12);
- yych = *YYCURSOR;
- goto yy256;
-yy256: switch(yych){
- case ',': goto yy253;
- case '-': goto yy257;
- case '.': goto yy254;
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': case 'A':
- case 'B':
- case 'C':
- case 'D':
- case 'E':
- case 'F':
- case 'G':
- case 'H':
- case 'I':
- case 'J':
- case 'K':
- case 'L':
- case 'M':
- case 'N':
- case 'O':
- case 'P':
- case 'Q':
- case 'R':
- case 'S':
- case 'T':
- case 'U':
- case 'V':
- case 'W':
- case 'X':
- case 'Y':
- case 'Z': case '_': case 'a':
- case 'b':
- case 'c':
- case 'd':
- case 'e':
- case 'f':
- case 'g':
- case 'h':
- case 'i':
- case 'j':
- case 'k':
- case 'l':
- case 'm':
- case 'n':
- case 'o':
- case 'p':
- case 'q':
- case 'r':
- case 's':
- case 't':
- case 'u':
- case 'v':
- case 'w':
- case 'x':
- case 'y':
- case 'z': goto yy255;
- default: goto yy204;
- }
-yy257: ++YYCURSOR;
- if(YYLIMIT == YYCURSOR) YYFILL(1);
- yych = *YYCURSOR;
- goto yy258;
-yy258: switch(yych){
- case '-': goto yy257;
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': case 'A':
- case 'B':
- case 'C':
- case 'D':
- case 'E':
- case 'F':
- case 'G':
- case 'H':
- case 'I':
- case 'J':
- case 'K':
- case 'L':
- case 'M':
- case 'N':
- case 'O':
- case 'P':
- case 'Q':
- case 'R':
- case 'S':
- case 'T':
- case 'U':
- case 'V':
- case 'W':
- case 'X':
- case 'Y':
- case 'Z': case '_': case 'a':
- case 'b':
- case 'c':
- case 'd':
- case 'e':
- case 'f':
- case 'g':
- case 'h':
- case 'i':
- case 'j':
- case 'k':
- case 'l':
- case 'm':
- case 'n':
- case 'o':
- case 'p':
- case 'q':
- case 'r':
- case 's':
- case 't':
- case 'u':
- case 'v':
- case 'w':
- case 'x':
- case 'y':
- case 'z': goto yy255;
- default: goto yy204;
- }
-yy259: yych = *++YYCURSOR;
- switch(yych){
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': goto yy260;
- default: goto yy204;
- }
-yy260: yych = *++YYCURSOR;
- switch(yych){
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': goto yy261;
- default: goto yy204;
- }
-yy261: yych = *++YYCURSOR;
- switch(yych){
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': goto yy262;
- default: goto yy204;
- }
-yy262: yych = *++YYCURSOR;
- switch(yych){
- case '-': goto yy263;
- case ':': goto yy264;
- default: goto yy204;
- }
-yy263: yych = *++YYCURSOR;
- switch(yych){
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': goto yy266;
- default: goto yy204;
- }
-yy264: ++YYCURSOR;
- goto yy265;
-yy265:
-#line 172 "implicit.re"
-{ return syck_strndup( type_id, strlen( type_id ) ); }
-#line 2932 "<stdout>"
-yy266: yych = *++YYCURSOR;
- switch(yych){
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': goto yy267;
- default: goto yy204;
- }
-yy267: yych = *++YYCURSOR;
- switch(yych){
- case '-': goto yy268;
- case ':': goto yy264;
- default: goto yy204;
- }
-yy268: yych = *++YYCURSOR;
- switch(yych){
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': goto yy269;
- default: goto yy204;
- }
-yy269: yych = *++YYCURSOR;
- switch(yych){
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': goto yy270;
- default: goto yy204;
- }
-yy270: ++YYCURSOR;
- switch((yych = *YYCURSOR)) {
- case ':': goto yy264;
- default: goto yy204;
- }
-}
-#line 204 "implicit.re"
-
-
-}
diff --git a/ext/syck/lib/syck.rb b/ext/syck/lib/syck.rb
deleted file mode 100644
index f8e3c0f8bc..0000000000
--- a/ext/syck/lib/syck.rb
+++ /dev/null
@@ -1,447 +0,0 @@
-# -*- mode: ruby; ruby-indent-level: 4; tab-width: 4 -*- vim: sw=4 ts=4
-# $Id$
-#
-# = yaml.rb: top-level module with methods for loading and parsing YAML documents
-#
-# Author:: why the lucky stiff
-#
-
-require 'yaml/syck'
-
-# == YAML
-#
-# YAML(tm) (rhymes with 'camel') is a
-# straightforward machine parsable data serialization format designed for
-# human readability and interaction with scripting languages such as Perl
-# and Python. YAML is optimized for data serialization, formatted
-# dumping, configuration files, log files, Internet messaging and
-# filtering. This specification describes the YAML information model and
-# serialization format. Together with the Unicode standard for characters, it
-# provides all the information necessary to understand YAML Version 1.0
-# and construct computer programs to process it.
-#
-# See http://yaml.org/ for more information. For a quick tutorial, please
-# visit YAML In Five Minutes (http://yaml.kwiki.org/?YamlInFiveMinutes).
-#
-# == About This Library
-#
-# The YAML 1.0 specification outlines four stages of YAML loading and dumping.
-# This library honors all four of those stages, although data is really only
-# available to you in three stages.
-#
-# The four stages are: native, representation, serialization, and presentation.
-#
-# The native stage refers to data which has been loaded completely into Ruby's
-# own types. (See +YAML::load+.)
-#
-# The representation stage means data which has been composed into
-# +YAML::BaseNode+ objects. In this stage, the document is available as a
-# tree of node objects. You can perform YPath queries and transformations
-# at this level. (See +YAML::parse+.)
-#
-# The serialization stage happens inside the parser. The YAML parser used in
-# Ruby is called Syck. Serialized nodes are available in the extension as
-# SyckNode structs.
-#
-# The presentation stage is the YAML document itself. This is accessible
-# to you as a string. (See +YAML::dump+.)
-#
-# For more information about the various information models, see Chapter
-# 3 of the YAML 1.0 Specification (http://yaml.org/spec/#id2491269).
-#
-# The YAML module provides quick access to the most common loading (YAML::load)
-# and dumping (YAML::dump) tasks. This module also provides an API for registering
-# global types (YAML::add_domain_type).
-#
-# == Example
-#
-# A simple round-trip (load and dump) of an object.
-#
-# require "yaml"
-#
-# test_obj = ["dogs", "cats", "badgers"]
-#
-# yaml_obj = YAML::dump( test_obj )
-# # -> ---
-# - dogs
-# - cats
-# - badgers
-# ruby_obj = YAML::load( yaml_obj )
-# # => ["dogs", "cats", "badgers"]
-# ruby_obj == test_obj
-# # => true
-#
-# To register your custom types with the global resolver, use +add_domain_type+.
-#
-# YAML::add_domain_type( "your-site.com,2004", "widget" ) do |type, val|
-# Widget.new( val )
-# end
-#
-module Syck
-
- DefaultResolver.use_types_at( @@tagged_classes )
-
- # Returns a new default parser
- def self.parser; Parser.new.set_resolver( self.resolver ); end
-
- # Returns a new generic parser
- def self.generic_parser
- warn "#{caller[0]}: YAML.generic_parser is deprecated, switch to psych" if $VERBOSE && !caller[0].start_with?(File.dirname(__FILE__))
- Parser.new.set_resolver( GenericResolver )
- end
-
- # Returns the default resolver
- def self.resolver
- warn "#{caller[0]}: YAML.resolver is deprecated" if $VERBOSE && !caller[0].start_with?(File.dirname(__FILE__))
- DefaultResolver
- end
-
- # Returns a new default emitter
- def self.emitter
- warn "#{caller[0]}: YAML.emitter is deprecated" if $VERBOSE && !caller[0].start_with?(File.dirname(__FILE__))
- Emitter.new.set_resolver( self.resolver )
- end
-
- #
- # Converts _obj_ to YAML and writes the YAML result to _io_.
- #
- # File.open( 'animals.yaml', 'w' ) do |out|
- # YAML.dump( ['badger', 'elephant', 'tiger'], out )
- # end
- #
- # If no _io_ is provided, a string containing the dumped YAML
- # is returned.
- #
- # YAML.dump( :locked )
- # #=> "--- :locked"
- #
- def self.dump( obj, io = nil )
- obj.to_yaml( io || io2 = StringIO.new )
- io || ( io2.rewind; io2.read )
- end
-
- #
- # Load a document from the current _io_ stream.
- #
- # File.open( 'animals.yaml' ) { |yf| YAML::load( yf ) }
- # #=> ['badger', 'elephant', 'tiger']
- #
- # Can also load from a string.
- #
- # YAML.load( "--- :locked" )
- # #=> :locked
- #
- def self.load( io )
- parser.load( io )
- end
-
- #
- # Load a document from the file located at _filepath_.
- #
- # YAML.load_file( 'animals.yaml' )
- # #=> ['badger', 'elephant', 'tiger']
- #
- def self.load_file( filepath )
- File.open( filepath ) do |f|
- load( f )
- end
- end
-
- #
- # Parse the first document from the current _io_ stream
- #
- # File.open( 'animals.yaml' ) { |yf| YAML::load( yf ) }
- # #=> #<YAML::Syck::Node:0x82ccce0
- # @kind=:seq,
- # @value=
- # [#<YAML::Syck::Node:0x82ccd94
- # @kind=:scalar,
- # @type_id="str",
- # @value="badger">,
- # #<YAML::Syck::Node:0x82ccd58
- # @kind=:scalar,
- # @type_id="str",
- # @value="elephant">,
- # #<YAML::Syck::Node:0x82ccd1c
- # @kind=:scalar,
- # @type_id="str",
- # @value="tiger">]>
- #
- # Can also load from a string.
- #
- # YAML.parse( "--- :locked" )
- # #=> #<YAML::Syck::Node:0x82edddc
- # @type_id="tag:ruby.yaml.org,2002:sym",
- # @value=":locked", @kind=:scalar>
- #
- def self.parse( io )
- generic_parser.load( io )
- end
-
- #
- # Parse a document from the file located at _filepath_.
- #
- # YAML.parse_file( 'animals.yaml' )
- # #=> #<YAML::Syck::Node:0x82ccce0
- # @kind=:seq,
- # @value=
- # [#<YAML::Syck::Node:0x82ccd94
- # @kind=:scalar,
- # @type_id="str",
- # @value="badger">,
- # #<YAML::Syck::Node:0x82ccd58
- # @kind=:scalar,
- # @type_id="str",
- # @value="elephant">,
- # #<YAML::Syck::Node:0x82ccd1c
- # @kind=:scalar,
- # @type_id="str",
- # @value="tiger">]>
- #
- def self.parse_file( filepath )
- File.open( filepath ) do |f|
- parse( f )
- end
- end
-
- #
- # Calls _block_ with each consecutive document in the YAML
- # stream contained in _io_.
- #
- # File.open( 'many-docs.yaml' ) do |yf|
- # YAML.each_document( yf ) do |ydoc|
- # ## ydoc contains the single object
- # ## from the YAML document
- # end
- # end
- #
- def self.each_document( io, &block )
- warn "#{caller[0]}: YAML.each_document is deprecated" if $VERBOSE && !caller[0].start_with?(File.dirname(__FILE__))
- parser.load_documents( io, &block )
- end
-
- #
- # Calls _block_ with each consecutive document in the YAML
- # stream contained in _io_.
- #
- # File.open( 'many-docs.yaml' ) do |yf|
- # YAML.load_documents( yf ) do |ydoc|
- # ## ydoc contains the single object
- # ## from the YAML document
- # end
- # end
- #
- def self.load_documents( io, &doc_proc )
- parser.load_documents( io, &doc_proc )
- end
-
- #
- # Calls _block_ with a tree of +YAML::BaseNodes+, one tree for
- # each consecutive document in the YAML stream contained in _io_.
- #
- # File.open( 'many-docs.yaml' ) do |yf|
- # YAML.each_node( yf ) do |ydoc|
- # ## ydoc contains a tree of nodes
- # ## from the YAML document
- # end
- # end
- #
- def self.each_node( io, &doc_proc )
- warn "#{caller[0]}: YAML.each_node is deprecated" if $VERBOSE && !caller[0].start_with?(File.dirname(__FILE__))
- generic_parser.load_documents( io, &doc_proc )
- end
-
- #
- # Calls _block_ with a tree of +YAML::BaseNodes+, one tree for
- # each consecutive document in the YAML stream contained in _io_.
- #
- # File.open( 'many-docs.yaml' ) do |yf|
- # YAML.parse_documents( yf ) do |ydoc|
- # ## ydoc contains a tree of nodes
- # ## from the YAML document
- # end
- # end
- #
- def self.parse_documents( io, &doc_proc )
- warn "#{caller[0]}: YAML.parse_documents is deprecated, use load_stream" if $VERBOSE && !caller[0].start_with?(File.dirname(__FILE__))
- self.each_node( io, &doc_proc )
- end
-
- #
- # Loads all documents from the current _io_ stream,
- # returning a +YAML::Stream+ object containing all
- # loaded documents.
- #
- def self.load_stream( io )
- d = nil
- parser.load_documents( io ) do |doc|
- d = Stream.new if not d
- d.add( doc )
- end
- return d
- end
-
- #
- # Returns a YAML stream containing each of the items in +objs+,
- # each having their own document.
- #
- # YAML.dump_stream( 0, [], {} )
- # #=> --- 0
- # --- []
- # --- {}
- #
- def self.dump_stream( *objs )
- d = Stream.new
- objs.each do |doc|
- d.add( doc )
- end
- d.emit
- end
-
- #
- # Add a global handler for a YAML domain type.
- #
- def self.add_domain_type( domain, type_tag, &transfer_proc )
- resolver.add_type( "tag:#{ domain }:#{ type_tag }", transfer_proc )
- end
-
- #
- # Add a transfer method for a builtin type
- #
- def self.add_builtin_type( type_tag, &transfer_proc )
- resolver.add_type( "tag:yaml.org,2002:#{ type_tag }", transfer_proc )
- end
-
- #
- # Add a transfer method for a builtin type
- #
- def self.add_ruby_type( type_tag, &transfer_proc )
- warn "#{caller[0]}: YAML.add_ruby_type is deprecated, use add_domain_type" if $VERBOSE && !caller[0].start_with?(File.dirname(__FILE__))
- resolver.add_type( "tag:ruby.yaml.org,2002:#{ type_tag }", transfer_proc )
- end
-
- #
- # Add a private document type
- #
- def self.add_private_type( type_re, &transfer_proc )
- warn "#{caller[0]}: YAML.add_private_type is deprecated, use add_domain_type" if $VERBOSE && !caller[0].start_with?(File.dirname(__FILE__))
- resolver.add_type( "x-private:" + type_re, transfer_proc )
- end
-
- #
- # Detect typing of a string
- #
- def self.detect_implicit( val )
- warn "#{caller[0]}: YAML.detect_implicit is deprecated" if $VERBOSE && !caller[0].start_with?(File.dirname(__FILE__))
- resolver.detect_implicit( val )
- end
-
- #
- # Convert a type_id to a taguri
- #
- def self.tagurize( val )
- warn "#{caller[0]}: YAML.tagurize is deprecated" if $VERBOSE && !caller[0].start_with?(File.dirname(__FILE__))
- resolver.tagurize( val )
- end
-
- #
- # Apply a transfer method to a Ruby object
- #
- def self.transfer( type_id, obj )
- warn "#{caller[0]}: YAML.transfer is deprecated" if $VERBOSE && !caller[0].start_with?(File.dirname(__FILE__))
- resolver.transfer( tagurize( type_id ), obj )
- end
-
- #
- # Apply any implicit a node may qualify for
- #
- def self.try_implicit( obj )
- warn "#{caller[0]}: YAML.try_implicit is deprecated" if $VERBOSE && !caller[0].start_with?(File.dirname(__FILE__))
- transfer( detect_implicit( obj ), obj )
- end
-
- #
- # Method to extract colon-seperated type and class, returning
- # the type and the constant of the class
- #
- def self.read_type_class( type, obj_class )
- warn "#{caller[0]}: YAML.read_type_class is deprecated" if $VERBOSE && !caller[0].start_with?(File.dirname(__FILE__))
- type, tclass = type.split( ':', 4 ).last(2)
- tclass.split( "::" ).each { |c| obj_class = obj_class.const_get( c ) } if tclass
- return [ type, obj_class ]
- end
-
- #
- # Allocate blank object
- #
- def self.object_maker( obj_class, val )
- warn "#{caller[0]}: YAML.object_maker is deprecated" if $VERBOSE && !caller[0].start_with?(File.dirname(__FILE__))
- if Hash === val
- o = obj_class.allocate
- val.each_pair { |k,v|
- o.instance_variable_set("@#{k}", v)
- }
- o
- else
- raise Error, "Invalid object explicitly tagged !ruby/Object: " + val.inspect
- end
- end
-
- #
- # Allocate an Emitter if needed
- #
- def self.quick_emit( oid, opts = {}, &e )
- warn "#{caller[0]}: YAML.quick_emit is deprecated" if $VERBOSE && !caller[0].start_with?(File.dirname(__FILE__))
- out =
- if opts.is_a? Emitter
- opts
- else
- emitter.reset( opts )
- end
- out.emit( oid, &e )
- end
-
-end
-
-module Kernel
- #
- # ryan:: You know how Kernel.p is a really convenient way to dump ruby
- # structures? The only downside is that it's not as legible as
- # YAML.
- #
- # _why:: (listening)
- #
- # ryan:: I know you don't want to urinate all over your users' namespaces.
- # But, on the other hand, convenience of dumping for debugging is,
- # IMO, a big YAML use case.
- #
- # _why:: Go nuts! Have a pony parade!
- #
- # ryan:: Either way, I certainly will have a pony parade.
- #
-
- # Prints any supplied _objects_ out in YAML. Intended as
- # a variation on +Kernel::p+.
- #
- # S = Struct.new(:name, :state)
- # s = S['dave', 'TX']
- # y s
- #
- # _produces:_
- #
- # --- !ruby/struct:S
- # name: dave
- # state: TX
- #
- def y( object, *objects )
- objects.unshift object
- puts( if objects.length == 1
- YAML.dump( *objects )
- else
- YAML.dump_stream( *objects )
- end )
- end
- private :y
-end
-
-
diff --git a/ext/syck/lib/syck/baseemitter.rb b/ext/syck/lib/syck/baseemitter.rb
deleted file mode 100644
index 5e39e450de..0000000000
--- a/ext/syck/lib/syck/baseemitter.rb
+++ /dev/null
@@ -1,242 +0,0 @@
-#
-# BaseEmitter
-#
-
-require 'syck/constants'
-require 'syck/encoding'
-require 'syck/error'
-
-module Syck
- module BaseEmitter
- def options( opt = nil )
- if opt
- @options[opt] || DEFAULTS[opt]
- else
- @options
- end
- end
-
- def options=( opt )
- @options = opt
- end
-
- #
- # Emit binary data
- #
- def binary_base64( value )
- self << "!binary "
- self.node_text( [value].pack("m"), '|' )
- end
-
- #
- # Emit plain, normal flowing text
- #
- def node_text( value, block = nil )
- @seq_map = false
- valx = value.dup
- unless block
- block =
- if options(:UseBlock)
- '|'
- elsif not options(:UseFold) and valx =~ /\n[ \t]/ and not valx =~ /#{ESCAPE_CHAR}/
- '|'
- else
- '>'
- end
- indt = $&.to_i if block =~ /\d+/
- if valx =~ /(\A\n*[ \t#]|^---\s+)/
- indt = options(:Indent) unless indt.to_i > 0
- block += indt.to_s
- end
-
- block +=
- if valx =~ /\n\Z\n/
- "+"
- elsif valx =~ /\Z\n/
- ""
- else
- "-"
- end
- end
- block += "\n"
- if block[0] == ?"
- esc_skip = ( "\t\n" unless valx =~ /^[ \t]/ ) || ""
- valx = fold( Syck.escape( valx, esc_skip ) + "\"" ).chomp
- self << '"' + indent_text( valx, indt, false )
- else
- if block[0] == ?>
- valx = fold( valx )
- end
- #p [block, indt]
- self << block + indent_text( valx, indt )
- end
- end
-
- #
- # Emit a simple, unqouted string
- #
- def simple( value )
- @seq_map = false
- self << value.to_s
- end
-
- #
- # Emit double-quoted string
- #
- def double( value )
- "\"#{Syck.escape( value )}\""
- end
-
- #
- # Emit single-quoted string
- #
- def single( value )
- "'#{value}'"
- end
-
- #
- # Write a text block with the current indent
- #
- def indent_text( text, mod, first_line = true )
- return "" if text.to_s.empty?
- spacing = indent( mod )
- text = text.gsub( /\A([^\n])/, "#{ spacing }\\1" ) if first_line
- return text.gsub( /\n^([^\n])/, "\n#{spacing}\\1" )
- end
-
- #
- # Write a current indent
- #
- def indent( mod = nil )
- #p [ self.id, level, mod, :INDENT ]
- if level <= 0
- mod ||= 0
- else
- mod ||= options(:Indent)
- mod += ( level - 1 ) * options(:Indent)
- end
- return " " * mod
- end
-
- #
- # Add indent to the buffer
- #
- def indent!
- self << indent
- end
-
- #
- # Folding paragraphs within a column
- #
- def fold( value )
- value.gsub( /(^[ \t]+.*$)|(\S.{0,#{options(:BestWidth) - 1}})(?:[ \t]+|(\n+(?=[ \t]|\Z))|$)/ ) do
- $1 || $2 + ( $3 || "\n" )
- end
- end
-
- #
- # Quick mapping
- #
- def map( type, &e )
- val = Mapping.new
- e.call( val )
- self << "#{type} " if type.length.nonzero?
-
- #
- # Empty hashes
- #
- if val.length.zero?
- self << "{}"
- @seq_map = false
- else
- # FIXME
- # if @buffer.length == 1 and options(:UseHeader) == false and type.length.zero?
- # @headless = 1
- # end
-
- defkey = @options.delete( :DefaultKey )
- if defkey
- seq_map_shortcut
- self << "= : "
- defkey.to_yaml( :Emitter => self )
- end
-
- #
- # Emit the key and value
- #
- val.each { |v|
- seq_map_shortcut
- if v[0].is_complex_yaml?
- self << "? "
- end
- v[0].to_yaml( :Emitter => self )
- if v[0].is_complex_yaml?
- self << "\n"
- indent!
- end
- self << ": "
- v[1].to_yaml( :Emitter => self )
- }
- end
- end
-
- def seq_map_shortcut
- # FIXME: seq_map needs to work with the new anchoring system
- # if @seq_map
- # @anchor_extras[@buffer.length - 1] = "\n" + indent
- # @seq_map = false
- # else
- self << "\n"
- indent!
- # end
- end
-
- #
- # Quick sequence
- #
- def seq( type, &e )
- @seq_map = false
- val = Sequence.new
- e.call( val )
- self << "#{type} " if type.length.nonzero?
-
- #
- # Empty arrays
- #
- if val.length.zero?
- self << "[]"
- else
- # FIXME
- # if @buffer.length == 1 and options(:UseHeader) == false and type.length.zero?
- # @headless = 1
- # end
-
- #
- # Emit the key and value
- #
- val.each { |v|
- self << "\n"
- indent!
- self << "- "
- @seq_map = true if v.class == Hash
- v.to_yaml( :Emitter => self )
- }
- end
- end
- end
-
- #
- # Emitter helper classes
- #
- class Mapping < Array
- def add( k, v )
- push [k, v]
- end
- end
-
- class Sequence < Array
- def add( v )
- push v
- end
- end
-end
diff --git a/ext/syck/lib/syck/basenode.rb b/ext/syck/lib/syck/basenode.rb
deleted file mode 100644
index 5dc27bfdfe..0000000000
--- a/ext/syck/lib/syck/basenode.rb
+++ /dev/null
@@ -1,222 +0,0 @@
-#
-# YAML::BaseNode class
-#
-
-module Syck
-
- #
- # YAML Generic Model container
- #
- module BaseNode
-
- #
- # Search for YPath entry and return
- # qualified nodes.
- #
- def select( ypath_str )
- warn "#{caller[0]}: select is deprecated" if $VERBOSE
- matches = match_path( ypath_str )
-
- #
- # Create a new generic view of the elements selected
- #
- if matches
- result = []
- matches.each { |m|
- result.push m.last
- }
- Syck.transfer( 'seq', result )
- end
- end
-
- #
- # Search for YPath entry and return
- # transformed nodes.
- #
- def select!( ypath_str )
- warn "#{caller[0]}: select!() is deprecated" if $VERBOSE
- matches = match_path( ypath_str )
-
- #
- # Create a new generic view of the elements selected
- #
- if matches
- result = []
- matches.each { |m|
- result.push m.last.transform
- }
- result
- end
- end
-
- #
- # Search for YPath entry and return a list of
- # qualified paths.
- #
- def search( ypath_str )
- warn "#{caller[0]}: search() is deprecated" if $VERBOSE
- matches = match_path( ypath_str )
-
- if matches
- matches.collect { |m|
- path = []
- m.each_index { |i|
- path.push m[i] if ( i % 2 ).zero?
- }
- "/" + path.compact.join( "/" )
- }
- end
- end
-
- def at( seg )
- warn "#{caller[0]}: at() is deprecated" if $VERBOSE
- if Hash === @value
- self[seg]
- elsif Array === @value and seg =~ /\A\d+\Z/ and @value[seg.to_i]
- @value[seg.to_i]
- end
- end
-
- #
- # YPath search returning a complete depth array
- #
- def match_path( ypath_str )
- warn "#{caller[0]}: match_path is deprecated" if $VERBOSE
- require 'syck/ypath'
- matches = []
- YPath.each_path( ypath_str ) do |ypath|
- seg = match_segment( ypath, 0 )
- matches += seg if seg
- end
- matches.uniq
- end
-
- #
- # Search a node for a single YPath segment
- #
- def match_segment( ypath, depth )
- warn "#{caller[0]}: match_segment is deprecated" if $VERBOSE
- deep_nodes = []
- seg = ypath.segments[ depth ]
- if seg == "/"
- unless String === @value
- idx = -1
- @value.collect { |v|
- idx += 1
- if Hash === @value
- match_init = [v[0].transform, v[1]]
- match_deep = v[1].match_segment( ypath, depth )
- else
- match_init = [idx, v]
- match_deep = v.match_segment( ypath, depth )
- end
- if match_deep
- match_deep.each { |m|
- deep_nodes.push( match_init + m )
- }
- end
- }
- end
- depth += 1
- seg = ypath.segments[ depth ]
- end
- match_nodes =
- case seg
- when "."
- [[nil, self]]
- when ".."
- [["..", nil]]
- when "*"
- if @value.is_a? Enumerable
- idx = -1
- @value.collect { |h|
- idx += 1
- if Hash === @value
- [h[0].transform, h[1]]
- else
- [idx, h]
- end
- }
- end
- else
- if seg =~ /^"(.*)"$/
- seg = $1
- elsif seg =~ /^'(.*)'$/
- seg = $1
- end
- if ( v = at( seg ) )
- [[ seg, v ]]
- end
- end
- return deep_nodes unless match_nodes
- pred = ypath.predicates[ depth ]
- if pred
- case pred
- when /^\.=/
- pred = $' # '
- match_nodes.reject! { |n|
- n.last.value != pred
- }
- else
- match_nodes.reject! { |n|
- n.last.at( pred ).nil?
- }
- end
- end
- return match_nodes + deep_nodes unless ypath.segments.length > depth + 1
-
- #puts "DEPTH: #{depth + 1}"
- deep_nodes = []
- match_nodes.each { |n|
- if n[1].is_a? BaseNode
- match_deep = n[1].match_segment( ypath, depth + 1 )
- if match_deep
- match_deep.each { |m|
- deep_nodes.push( n + m )
- }
- end
- else
- deep_nodes = []
- end
- }
- deep_nodes = nil if deep_nodes.length == 0
- deep_nodes
- end
-
- #
- # We want the node to act like as Hash
- # if it is.
- #
- def []( *key )
- if Hash === @value
- v = @value.detect { |k,| k.transform == key.first }
- v[1] if v
- elsif Array === @value
- @value.[]( *key )
- end
- end
-
- def children
- if Hash === @value
- @value.values.collect { |c| c[1] }
- elsif Array === @value
- @value
- end
- end
-
- def children_with_index
- warn "#{caller[0]}: children_with_index is deprecated, use children" if $VERBOSE
- if Hash === @value
- @value.keys.collect { |i| [self[i], i] }
- elsif Array === @value
- i = -1; @value.collect { |v| i += 1; [v, i] }
- end
- end
-
- def emit
- transform.to_yaml
- end
- end
-
-end
-
diff --git a/ext/syck/lib/syck/constants.rb b/ext/syck/lib/syck/constants.rb
deleted file mode 100644
index 19fe42ef85..0000000000
--- a/ext/syck/lib/syck/constants.rb
+++ /dev/null
@@ -1,45 +0,0 @@
-#
-# Constants used throughout the library
-#
-module Syck
-
- #
- # Constants
- #
- VERSION = '0.60'
- SUPPORTED_YAML_VERSIONS = ['1.0']
-
- #
- # Parser tokens
- #
- WORD_CHAR = 'A-Za-z0-9'
- PRINTABLE_CHAR = '-_A-Za-z0-9!?/()$\'". '
- NOT_PLAIN_CHAR = '\x7f\x0-\x1f\x80-\x9f'
- ESCAPE_CHAR = '[\\x00-\\x09\\x0b-\\x1f]'
- INDICATOR_CHAR = '*&!|\\\\^@%{}[]='
- SPACE_INDICATORS = '-#:,?'
- RESTRICTED_INDICATORS = '#:,}]'
- DNS_COMP_RE = "\\w(?:[-\\w]*\\w)?"
- DNS_NAME_RE = "(?:(?:#{DNS_COMP_RE}\\.)+#{DNS_COMP_RE}|#{DNS_COMP_RE})"
- ESCAPES = %w{\x00 \x01 \x02 \x03 \x04 \x05 \x06 \a
- \x08 \t \n \v \f \r \x0e \x0f
- \x10 \x11 \x12 \x13 \x14 \x15 \x16 \x17
- \x18 \x19 \x1a \e \x1c \x1d \x1e \x1f
- }
- UNESCAPES = {
- 'a' => "\x07", 'b' => "\x08", 't' => "\x09",
- 'n' => "\x0a", 'v' => "\x0b", 'f' => "\x0c",
- 'r' => "\x0d", 'e' => "\x1b", '\\' => '\\',
- }
-
- #
- # Default settings
- #
- DEFAULTS = {
- :Indent => 2, :UseHeader => false, :UseVersion => false, :Version => '1.0',
- :SortKeys => false, :AnchorFormat => 'id%03d', :ExplicitTypes => false,
- :WidthType => 'absolute', :BestWidth => 80,
- :UseBlock => false, :UseFold => false, :Encoding => :None
- }
-
-end
diff --git a/ext/syck/lib/syck/encoding.rb b/ext/syck/lib/syck/encoding.rb
deleted file mode 100644
index dad062994c..0000000000
--- a/ext/syck/lib/syck/encoding.rb
+++ /dev/null
@@ -1,35 +0,0 @@
-#
-# Handle Unicode-to-Internal conversion
-#
-
-module Syck
-
- #
- # Escape the string, condensing common escapes
- #
- def self.escape( value, skip = "" )
- warn "#{caller[0]}: YAML.escape is deprecated" if $VERBOSE
- value.gsub( /\\/, "\\\\\\" ).
- gsub( /"/, "\\\"" ).
- gsub( /([\x00-\x1f])/ ) do
- skip[$&] || ESCAPES[ $&.unpack("C")[0] ]
- end
- end
-
- #
- # Unescape the condenses escapes
- #
- def self.unescape( value )
- warn "#{caller[0]}: YAML.unescape is deprecated" if $VERBOSE
- value.gsub( /\\(?:([nevfbart\\])|0?x([0-9a-fA-F]{2})|u([0-9a-fA-F]{4}))/ ) {
- if $3
- ["#$3".hex ].pack('U*')
- elsif $2
- [$2].pack( "H2" )
- else
- UNESCAPES[$1]
- end
- }
- end
-
-end
diff --git a/ext/syck/lib/syck/error.rb b/ext/syck/lib/syck/error.rb
deleted file mode 100644
index 0bac872411..0000000000
--- a/ext/syck/lib/syck/error.rb
+++ /dev/null
@@ -1,34 +0,0 @@
-#
-# Error messages and exception class
-#
-
-module Syck
-
- #
- # Error messages
- #
-
- ERROR_NO_HEADER_NODE = "With UseHeader=false, the node Array or Hash must have elements"
- ERROR_NEED_HEADER = "With UseHeader=false, the node must be an Array or Hash"
- ERROR_BAD_EXPLICIT = "Unsupported explicit transfer: '%s'"
- ERROR_MANY_EXPLICIT = "More than one explicit transfer"
- ERROR_MANY_IMPLICIT = "More than one implicit request"
- ERROR_NO_ANCHOR = "No anchor for alias '%s'"
- ERROR_BAD_ANCHOR = "Invalid anchor: %s"
- ERROR_MANY_ANCHOR = "More than one anchor"
- ERROR_ANCHOR_ALIAS = "Can't define both an anchor and an alias"
- ERROR_BAD_ALIAS = "Invalid alias: %s"
- ERROR_MANY_ALIAS = "More than one alias"
- ERROR_ZERO_INDENT = "Can't use zero as an indentation width"
- ERROR_UNSUPPORTED_VERSION = "This release of YAML.rb does not support YAML version %s"
- ERROR_UNSUPPORTED_ENCODING = "Attempt to use unsupported encoding: %s"
-
- #
- # YAML Error classes
- #
-
- class Error < StandardError; end
- class ParseError < Error; end
- class TypeError < StandardError; end
-
-end
diff --git a/ext/syck/lib/syck/loader.rb b/ext/syck/lib/syck/loader.rb
deleted file mode 100644
index 925c9ee4b2..0000000000
--- a/ext/syck/lib/syck/loader.rb
+++ /dev/null
@@ -1,14 +0,0 @@
-#
-# YAML::Loader class
-# .. type handling ..
-#
-module Syck
- class Loader
- TRANSFER_DOMAINS = {
- 'yaml.org,2002' => {},
- 'ruby.yaml.org,2002' => {}
- }
- PRIVATE_TYPES = {}
- IMPLICIT_TYPES = [ 'null', 'bool', 'time', 'int', 'float' ]
- end
-end
diff --git a/ext/syck/lib/syck/rubytypes.rb b/ext/syck/lib/syck/rubytypes.rb
deleted file mode 100644
index b6869c4b8b..0000000000
--- a/ext/syck/lib/syck/rubytypes.rb
+++ /dev/null
@@ -1,467 +0,0 @@
-# -*- mode: ruby; ruby-indent-level: 4; tab-width: 4 -*- vim: sw=4 ts=4
-require 'date'
-
-class Class
- def to_yaml( opts = {} )
- raise TypeError, "can't dump anonymous class %s" % self.class
- end
-end
-
-class Object
- yaml_as "tag:ruby.yaml.org,2002:object"
- def to_yaml_style; end
- undef to_yaml_properties rescue nil
- def to_yaml_properties; instance_variables.sort; end
- def to_yaml( opts = {} )
- YAML::quick_emit( self, opts ) do |out|
- out.map( taguri, to_yaml_style ) do |map|
- to_yaml_properties.each do |m|
- map.add( m[1..-1], instance_variable_get( m ) )
- end
- end
- end
- end
- alias :syck_to_yaml :to_yaml
-end
-
-class Hash
- yaml_as "tag:ruby.yaml.org,2002:hash"
- yaml_as "tag:yaml.org,2002:map"
- def yaml_initialize( tag, val )
- if Array === val
- update Hash.[]( *val ) # Convert the map to a sequence
- elsif Hash === val
- update val
- else
- raise YAML::TypeError, "Invalid map explicitly tagged #{ tag }: " + val.inspect
- end
- end
- def to_yaml( opts = {} )
- return super unless YAML::ENGINE.syck?
- YAML::quick_emit( self, opts ) do |out|
- out.map( taguri, to_yaml_style ) do |map|
- each do |k, v|
- map.add( k, v )
- end
- end
- end
- end
-end
-
-class Struct
- yaml_as "tag:ruby.yaml.org,2002:struct"
- def self.yaml_tag_class_name; self.name.gsub( "Struct::", "" ); end
- def self.yaml_tag_read_class( name ); "Struct::#{ name }"; end
- def self.yaml_new( klass, tag, val )
- if Hash === val
- struct_type = nil
-
- #
- # Use existing Struct if it exists
- #
- props = {}
- val.delete_if { |k,v| props[k] = v if k =~ /^@/ }
- begin
- struct_type = YAML.read_type_class( tag, Struct ).last
- rescue NameError
- end
- if not struct_type
- struct_def = [ tag.split( ':', 4 ).last ]
- struct_type = Struct.new( *struct_def.concat( val.keys.collect { |k| k.intern } ) )
- end
-
- #
- # Set the Struct properties
- #
- st = YAML::object_maker( struct_type, {} )
- st.members.each do |m|
- st.send( "#{m}=", val[m.to_s] )
- end
- props.each do |k,v|
- st.instance_variable_set(k, v)
- end
- st
- else
- raise YAML::TypeError, "Invalid Ruby Struct: " + val.inspect
- end
- end
- def to_yaml( opts = {} )
- return super unless YAML::ENGINE.syck?
- YAML::quick_emit( self, opts ) do |out|
- #
- # Basic struct is passed as a YAML map
- #
- out.map( taguri, to_yaml_style ) do |map|
- self.members.each do |m|
- map.add( m.to_s, self[m.to_s] )
- end
- self.to_yaml_properties.each do |m|
- map.add( m, instance_variable_get( m ) )
- end
- end
- end
- end
-end
-
-class Array
- yaml_as "tag:ruby.yaml.org,2002:array"
- yaml_as "tag:yaml.org,2002:seq"
- def yaml_initialize( tag, val ); concat( val.to_a ); end
- def to_yaml( opts = {} )
- return super unless YAML::ENGINE.syck?
- YAML::quick_emit( self, opts ) do |out|
- out.seq( taguri, to_yaml_style ) do |seq|
- each do |x|
- seq.add( x )
- end
- end
- end
- end
-end
-
-class Exception
- yaml_as "tag:ruby.yaml.org,2002:exception"
- def Exception.yaml_new( klass, tag, val )
- o = klass.allocate
- Exception.instance_method(:initialize).bind(o).call(val.delete('message'))
- val.each_pair do |k,v|
- o.instance_variable_set("@#{k}", v)
- end
- o
- end
- def to_yaml( opts = {} )
- return super unless YAML::ENGINE.syck?
- YAML::quick_emit( self, opts ) do |out|
- out.map( taguri, to_yaml_style ) do |map|
- map.add( 'message', message )
- to_yaml_properties.each do |m|
- map.add( m[1..-1], instance_variable_get( m ) )
- end
- end
- end
- end
-end
-
-class String
- yaml_as "tag:ruby.yaml.org,2002:string"
- yaml_as "tag:yaml.org,2002:binary"
- yaml_as "tag:yaml.org,2002:str"
- def is_complex_yaml?
- to_yaml_style or not to_yaml_properties.empty? or self =~ /\n.+/
- end
- def is_binary_data?
- self.count("\x00-\x7F", "^ -~\t\r\n").fdiv(self.size) > 0.3 || self.index("\x00") unless self.empty?
- end
- def String.yaml_new( klass, tag, val )
- val = val.unpack("m")[0] if tag == "tag:yaml.org,2002:binary"
- val = { 'str' => val } if String === val
- if Hash === val
- s = klass.allocate
- # Thank you, NaHi
- String.instance_method(:initialize).
- bind(s).
- call( val.delete( 'str' ) )
- val.each { |k,v| s.instance_variable_set( k, v ) }
- s
- else
- raise YAML::TypeError, "Invalid String: " + val.inspect
- end
- end
- def to_yaml( opts = {} )
- return super unless YAML::ENGINE.syck?
- YAML::quick_emit( is_complex_yaml? ? self : nil, opts ) do |out|
- if is_binary_data?
- out.scalar( "tag:yaml.org,2002:binary", [self].pack("m"), :literal )
- elsif to_yaml_properties.empty?
- out.scalar( taguri, self, self =~ /^:/ ? :quote2 : to_yaml_style )
- else
- out.map( taguri, to_yaml_style ) do |map|
- map.add( 'str', "#{self}" )
- to_yaml_properties.each do |m|
- map.add( m, instance_variable_get( m ) )
- end
- end
- end
- end
- end
-end
-
-class Symbol
- yaml_as "tag:ruby.yaml.org,2002:symbol"
- yaml_as "tag:ruby.yaml.org,2002:sym"
- def Symbol.yaml_new( klass, tag, val )
- if String === val
- val = YAML::load( val ) if val =~ /\A(["']).*\1\z/
- val.intern
- else
- raise YAML::TypeError, "Invalid Symbol: " + val.inspect
- end
- end
- def to_yaml( opts = {} )
- return super unless YAML::ENGINE.syck?
- YAML::quick_emit( nil, opts ) do |out|
- out.scalar( "tag:yaml.org,2002:str", self.inspect, :plain )
- end
- end
-end
-
-class Range
- yaml_as "tag:ruby.yaml.org,2002:range"
- def Range.yaml_new( klass, tag, val )
- inr = %r'(\w+|[+-]?\d+(?:\.\d+)?(?:e[+-]\d+)?|"(?:[^\\"]|\\.)*")'
- opts = {}
- if String === val and val =~ /^#{inr}(\.{2,3})#{inr}$/o
- r1, rdots, r2 = $1, $2, $3
- opts = {
- 'begin' => YAML.load( "--- #{r1}" ),
- 'end' => YAML.load( "--- #{r2}" ),
- 'excl' => rdots.length == 3
- }
- val = {}
- elsif Hash === val
- opts['begin'] = val.delete('begin')
- opts['end'] = val.delete('end')
- opts['excl'] = val.delete('excl')
- end
- if Hash === opts
- r = YAML::object_maker( klass, {} )
- # Thank you, NaHi
- Range.instance_method(:initialize).
- bind(r).
- call( opts['begin'], opts['end'], opts['excl'] )
- val.each { |k,v| r.instance_variable_set( k, v ) }
- r
- else
- raise YAML::TypeError, "Invalid Range: " + val.inspect
- end
- end
- def to_yaml( opts = {} )
- return super unless YAML::ENGINE.syck?
- YAML::quick_emit( self, opts ) do |out|
- # if self.begin.is_complex_yaml? or self.begin.respond_to? :to_str or
- # self.end.is_complex_yaml? or self.end.respond_to? :to_str or
- # not to_yaml_properties.empty?
- out.map( taguri, to_yaml_style ) do |map|
- map.add( 'begin', self.begin )
- map.add( 'end', self.end )
- map.add( 'excl', self.exclude_end? )
- to_yaml_properties.each do |m|
- map.add( m, instance_variable_get( m ) )
- end
- end
- # else
- # out.scalar( taguri ) do |sc|
- # sc.embed( self.begin )
- # sc.concat( self.exclude_end? ? "..." : ".." )
- # sc.embed( self.end )
- # end
- # end
- end
- end
-end
-
-class Regexp
- yaml_as "tag:ruby.yaml.org,2002:regexp"
- def Regexp.yaml_new( klass, tag, val )
- if String === val and val =~ /^\/(.*)\/([mixn]*)$/
- val = { 'regexp' => $1, 'mods' => $2 }
- end
- if Hash === val
- mods = nil
- unless val['mods'].to_s.empty?
- mods = 0x00
- mods |= Regexp::EXTENDED if val['mods'].include?( 'x' )
- mods |= Regexp::IGNORECASE if val['mods'].include?( 'i' )
- mods |= Regexp::MULTILINE if val['mods'].include?( 'm' )
- mods |= Regexp::NOENCODING if val['mods'].include?( 'n' )
- end
- val.delete( 'mods' )
- r = YAML::object_maker( klass, {} )
- Regexp.instance_method(:initialize).
- bind(r).
- call( val.delete( 'regexp' ), mods )
- val.each { |k,v| r.instance_variable_set( k, v ) }
- r
- else
- raise YAML::TypeError, "Invalid Regular expression: " + val.inspect
- end
- end
- def to_yaml( opts = {} )
- return super unless YAML::ENGINE.syck?
- YAML::quick_emit( nil, opts ) do |out|
- if to_yaml_properties.empty?
- out.scalar( taguri, self.inspect, :plain )
- else
- out.map( taguri, to_yaml_style ) do |map|
- src = self.inspect
- if src =~ /\A\/(.*)\/([a-z]*)\Z/
- map.add( 'regexp', $1 )
- map.add( 'mods', $2 )
- else
- raise YAML::TypeError, "Invalid Regular expression: " + src
- end
- to_yaml_properties.each do |m|
- map.add( m, instance_variable_get( m ) )
- end
- end
- end
- end
- end
-end
-
-class Time
- yaml_as "tag:ruby.yaml.org,2002:time"
- yaml_as "tag:yaml.org,2002:timestamp"
- def Time.yaml_new( klass, tag, val )
- if Hash === val
- t = val.delete( 'at' )
- val.each { |k,v| t.instance_variable_set( k, v ) }
- t
- else
- raise YAML::TypeError, "Invalid Time: " + val.inspect
- end
- end
- def to_yaml( opts = {} )
- return super unless YAML::ENGINE.syck?
- YAML::quick_emit( self, opts ) do |out|
- tz = "Z"
- # from the tidy Tobias Peters <t-peters@gmx.de> Thanks!
- unless self.utc?
- utc_same_instant = self.dup.utc
- utc_same_writing = Time.utc(year,month,day,hour,min,sec,usec)
- difference_to_utc = utc_same_writing - utc_same_instant
- if (difference_to_utc < 0)
- difference_sign = '-'
- absolute_difference = -difference_to_utc
- else
- difference_sign = '+'
- absolute_difference = difference_to_utc
- end
- difference_minutes = (absolute_difference/60).round
- tz = "%s%02d:%02d" % [ difference_sign, difference_minutes / 60, difference_minutes % 60]
- end
- standard = self.strftime( "%Y-%m-%d %H:%M:%S" )
- standard += ".%06d" % [usec] if usec.nonzero?
- standard += " %s" % [tz]
- if to_yaml_properties.empty?
- out.scalar( taguri, standard, :plain )
- else
- out.map( taguri, to_yaml_style ) do |map|
- map.add( 'at', standard )
- to_yaml_properties.each do |m|
- map.add( m, instance_variable_get( m ) )
- end
- end
- end
- end
- end
-end
-
-class Date
- yaml_as "tag:yaml.org,2002:timestamp#ymd"
- def to_yaml( opts = {} )
- return super unless YAML::ENGINE.syck?
- YAML::quick_emit( self, opts ) do |out|
- out.scalar( "tag:yaml.org,2002:timestamp", self.to_s, :plain )
- end
- end
-end
-
-class Integer
- yaml_as "tag:yaml.org,2002:int"
- def to_yaml( opts = {} )
- return super unless YAML::ENGINE.syck?
- YAML::quick_emit( nil, opts ) do |out|
- out.scalar( "tag:yaml.org,2002:int", self.to_s, :plain )
- end
- end
-end
-
-class Float
- yaml_as "tag:yaml.org,2002:float"
- def to_yaml( opts = {} )
- return super unless YAML::ENGINE.syck?
- YAML::quick_emit( nil, opts ) do |out|
- str = self.to_s
- if str == "Infinity"
- str = ".Inf"
- elsif str == "-Infinity"
- str = "-.Inf"
- elsif str == "NaN"
- str = ".NaN"
- end
- out.scalar( "tag:yaml.org,2002:float", str, :plain )
- end
- end
-end
-
-class Rational
- yaml_as "tag:ruby.yaml.org,2002:object:Rational"
- def Rational.yaml_new( klass, tag, val )
- if val.is_a? String
- Rational( val )
- else
- Rational( val['numerator'], val['denominator'] )
- end
- end
- def to_yaml( opts = {} )
- return super unless YAML::ENGINE.syck?
- YAML::quick_emit( self, opts ) do |out|
- out.map( taguri, nil ) do |map|
- map.add( 'denominator', denominator )
- map.add( 'numerator', numerator )
- end
- end
- end
-end
-
-class Complex
- yaml_as "tag:ruby.yaml.org,2002:object:Complex"
- def Complex.yaml_new( klass, tag, val )
- if val.is_a? String
- Complex( val )
- else
- Complex( val['real'], val['image'] )
- end
- end
- def to_yaml( opts = {} )
- return super unless YAML::ENGINE.syck?
- YAML::quick_emit( self, opts ) do |out|
- out.map( taguri, nil ) do |map|
- map.add( 'image', imaginary )
- map.add( 'real', real )
- end
- end
- end
-end
-
-class TrueClass
- yaml_as "tag:yaml.org,2002:bool#yes"
- def to_yaml( opts = {} )
- return super unless YAML::ENGINE.syck?
- YAML::quick_emit( nil, opts ) do |out|
- out.scalar( taguri, "true", :plain )
- end
- end
-end
-
-class FalseClass
- yaml_as "tag:yaml.org,2002:bool#no"
- def to_yaml( opts = {} )
- return super unless YAML::ENGINE.syck?
- YAML::quick_emit( nil, opts ) do |out|
- out.scalar( taguri, "false", :plain )
- end
- end
-end
-
-class NilClass
- yaml_as "tag:yaml.org,2002:null"
- def to_yaml( opts = {} )
- return super unless YAML::ENGINE.syck?
- YAML::quick_emit( nil, opts ) do |out|
- out.scalar( taguri, "", :plain )
- end
- end
-end
-
diff --git a/ext/syck/lib/syck/stream.rb b/ext/syck/lib/syck/stream.rb
deleted file mode 100644
index cd77a033c6..0000000000
--- a/ext/syck/lib/syck/stream.rb
+++ /dev/null
@@ -1,41 +0,0 @@
-module Syck
-
- #
- # YAML::Stream -- for emitting many documents
- #
- class Stream
-
- attr_accessor :documents, :options
-
- def initialize( opts = {} )
- @options = opts
- @documents = []
- end
-
- def []( i )
- @documents[ i ]
- end
-
- def add( doc )
- @documents << doc
- end
-
- def edit( doc_num, doc )
- warn "#{caller[0]}: edit is deprecated" if $VERBOSE
- @documents[ doc_num ] = doc
- end
-
- def emit( io = nil )
- # opts = @options.dup
- # opts[:UseHeader] = true if @documents.length > 1
- out = Syck.emitter
- out.reset( io || io2 = StringIO.new )
- @documents.each { |v|
- v.to_yaml( out )
- }
- io || ( io2.rewind; io2.read )
- end
-
- end
-
-end
diff --git a/ext/syck/lib/syck/stringio.rb b/ext/syck/lib/syck/stringio.rb
deleted file mode 100644
index 77a2b827e5..0000000000
--- a/ext/syck/lib/syck/stringio.rb
+++ /dev/null
@@ -1,85 +0,0 @@
-warn "#{caller[0]}: yaml/stringio is deprecated" if $VERBOSE
-
-#
-# Limited StringIO if no core lib is available
-#
-begin
-require 'stringio'
-rescue LoadError
- # StringIO based on code by MoonWolf
- class StringIO
- def initialize(string="")
- @string=string
- @pos=0
- @eof=(string.size==0)
- end
- def pos
- @pos
- end
- def eof
- @eof
- end
- alias eof? eof
- def readline(rs=$/)
- if @eof
- raise EOFError
- else
- if p = @string[@pos..-1]=~rs
- line = @string[@pos,p+1]
- else
- line = @string[@pos..-1]
- end
- @pos+=line.size
- @eof =true if @pos==@string.size
- $_ = line
- end
- end
- def rewind
- seek(0,0)
- end
- def seek(offset,whence)
- case whence
- when 0
- @pos=offset
- when 1
- @pos+=offset
- when 2
- @pos=@string.size+offset
- end
- @eof=(@pos>=@string.size)
- 0
- end
- end
-
- #
- # Class method for creating streams
- #
- def Syck.make_stream( io )
- if String === io
- io = StringIO.new( io )
- elsif not IO === io
- raise Syck::Error, "YAML stream must be an IO or String object."
- end
- if Syck::unicode
- def io.readline
- Syck.utf_to_internal( readline( @ln_sep ), @utf_encoding )
- end
- def io.check_unicode
- @utf_encoding = Syck.sniff_encoding( read( 4 ) )
- @ln_sep = Syck.enc_separator( @utf_encoding )
- seek( -4, IO::SEEK_CUR )
- end
- def io.utf_encoding
- @utf_encoding
- end
- io.check_unicode
- else
- def io.utf_encoding
- :None
- end
- end
- io
- end
-
-end
-
diff --git a/ext/syck/lib/syck/syck.rb b/ext/syck/lib/syck/syck.rb
deleted file mode 100644
index 10e5023f46..0000000000
--- a/ext/syck/lib/syck/syck.rb
+++ /dev/null
@@ -1,16 +0,0 @@
-#
-# YAML::Syck module
-# .. glues syck and yaml.rb together ..
-#
-require 'syck/basenode'
-
-module Syck
-
- #
- # Mixin BaseNode functionality
- #
- class Node
- include Syck::BaseNode
- end
-
-end
diff --git a/ext/syck/lib/syck/tag.rb b/ext/syck/lib/syck/tag.rb
deleted file mode 100644
index 9c6de57953..0000000000
--- a/ext/syck/lib/syck/tag.rb
+++ /dev/null
@@ -1,95 +0,0 @@
-# -*- mode: ruby; ruby-indent-level: 4; tab-width: 4 -*- vim: sw=4 ts=4
-# $Id$
-#
-# = yaml/tag.rb: methods for associating a taguri to a class.
-#
-# Author:: why the lucky stiff
-#
-module Syck
- # A dictionary of taguris which map to
- # Ruby classes.
- @@tagged_classes = {}
-
- #
- # Associates a taguri _tag_ with a Ruby class _cls_. The taguri is used to give types
- # to classes when loading YAML. Taguris are of the form:
- #
- # tag:authorityName,date:specific
- #
- # The +authorityName+ is a domain name or email address. The +date+ is the date the type
- # was issued in YYYY or YYYY-MM or YYYY-MM-DD format. The +specific+ is a name for
- # the type being added.
- #
- # For example, built-in YAML types have 'yaml.org' as the +authorityName+ and '2002' as the
- # +date+. The +specific+ is simply the name of the type:
- #
- # tag:yaml.org,2002:int
- # tag:yaml.org,2002:float
- # tag:yaml.org,2002:timestamp
- #
- # The domain must be owned by you on the +date+ declared. If you don't own any domains on the
- # date you declare the type, you can simply use an e-mail address.
- #
- # tag:why@ruby-lang.org,2004:notes/personal
- #
- def self.tag_class( tag, cls )
- if @@tagged_classes.has_key? tag
- warn "class #{ @@tagged_classes[tag] } held ownership of the #{ tag } tag"
- end
- @@tagged_classes[tag] = cls
- end
-
- # Returns the complete dictionary of taguris, paired with classes. The key for
- # the dictionary is the full taguri. The value for each key is the class constant
- # associated to that taguri.
- #
- # YAML.tagged_classes["tag:yaml.org,2002:int"] => Integer
- #
- def self.tagged_classes
- @@tagged_classes
- end
-end
-
-class Module
- # :stopdoc:
-
- # Adds a taguri _tag_ to a class, used when dumping or loading the class
- # in YAML. See YAML::tag_class for detailed information on typing and
- # taguris.
- def syck_yaml_as( tag, sc = true )
- verbose, $VERBOSE = $VERBOSE, nil
- class_eval <<-"END", __FILE__, __LINE__+1
- attr_writer :taguri
- def taguri
- if respond_to? :to_yaml_type
- Syck.tagurize( to_yaml_type[1..-1] )
- else
- return @taguri if defined?(@taguri) and @taguri
- tag = #{ tag.dump }
- if self.class.yaml_tag_subclasses? and self.class != Syck.tagged_classes[tag]
- tag = "\#{ tag }:\#{ self.class.yaml_tag_class_name }"
- end
- tag
- end
- end
- def self.yaml_tag_subclasses?; #{ sc ? 'true' : 'false' }; end
- END
- Syck.tag_class tag, self
- ensure
- $VERBOSE = verbose
- end
- remove_method :yaml_as rescue nil
- alias :yaml_as :syck_yaml_as
-
- # Transforms the subclass name into a name suitable for display
- # in a subclassed tag.
- def yaml_tag_class_name
- self.name
- end
- # Transforms the subclass name found in the tag into a Ruby
- # constant name.
- def yaml_tag_read_class( name )
- name
- end
- # :startdoc:
-end
diff --git a/ext/syck/lib/syck/types.rb b/ext/syck/lib/syck/types.rb
deleted file mode 100644
index 5c129acba4..0000000000
--- a/ext/syck/lib/syck/types.rb
+++ /dev/null
@@ -1,192 +0,0 @@
-# -*- mode: ruby; ruby-indent-level: 4 -*- vim: sw=4
-#
-# Classes required by the full core typeset
-#
-
-module Syck
-
- #
- # Default private type
- #
- class PrivateType
- def self.tag_subclasses?; false; end
- verbose, $VERBOSE = $VERBOSE, nil
- def initialize( type, val )
- @type_id = type; @value = val
- @value.taguri = "x-private:#{ @type_id }"
- end
- def to_yaml( opts = {} )
- @value.to_yaml( opts )
- end
- ensure
- $VERBOSE = verbose
- end
-
- #
- # Default domain type
- #
- class DomainType
- def self.tag_subclasses?; false; end
- verbose, $VERBOSE = $VERBOSE, nil
- def initialize( domain, type, val )
- @domain = domain; @type_id = type; @value = val
- @value.taguri = "tag:#{ @domain }:#{ @type_id }"
- end
- def to_yaml( opts = {} )
- @value.to_yaml( opts )
- end
- ensure
- $VERBOSE = verbose
- end
-
- #
- # Unresolved objects
- #
- class Object
- def self.tag_subclasses?; false; end
- def to_yaml( opts = {} )
- Syck.quick_emit( self, opts ) do |out|
- out.map( "tag:ruby.yaml.org,2002:object:#{ @class }", to_yaml_style ) do |map|
- @ivars.each do |k,v|
- map.add( k, v )
- end
- end
- end
- end
- end
-
- #
- # YAML Hash class to support comments and defaults
- #
- class SpecialHash < ::Hash
- attr_accessor :default
- def inspect
- self.default.to_s
- end
- def to_s
- self.default.to_s
- end
- def update( h )
- if Syck::SpecialHash === h
- @default = h.default if h.default
- end
- super( h )
- end
- def to_yaml( opts = {} )
- opts[:DefaultKey] = self.default
- super( opts )
- end
- end
-
- #
- # Builtin collection: !omap
- #
- class Omap < ::Array
- yaml_as "tag:yaml.org,2002:omap"
- def yaml_initialize( tag, val )
- if Array === val
- val.each do |v|
- if Hash === v
- concat( v.to_a ) # Convert the map to a sequence
- else
- raise Syck::Error, "Invalid !omap entry: " + val.inspect
- end
- end
- else
- raise Syck::Error, "Invalid !omap: " + val.inspect
- end
- self
- end
- def self.[]( *vals )
- o = Omap.new
- 0.step( vals.length - 1, 2 ) do |i|
- o[vals[i]] = vals[i+1]
- end
- o
- end
- def []( k )
- self.assoc( k ).to_a[1]
- end
- def []=( k, *rest )
- val, set = rest.reverse
- if ( tmp = self.assoc( k ) ) and not set
- tmp[1] = val
- else
- self << [ k, val ]
- end
- val
- end
- def has_key?( k )
- self.assoc( k ) ? true : false
- end
- def is_complex_yaml?
- true
- end
- def to_yaml( opts = {} )
- Syck.quick_emit( self, opts ) do |out|
- out.seq( taguri, to_yaml_style ) do |seq|
- self.each do |v|
- seq.add( Hash[ *v ] )
- end
- end
- end
- end
- end
-
- #
- # Builtin collection: !pairs
- #
- class Pairs < ::Array
- yaml_as "tag:yaml.org,2002:pairs"
- def yaml_initialize( tag, val )
- if Array === val
- val.each do |v|
- if Hash === v
- concat( v.to_a ) # Convert the map to a sequence
- else
- raise Syck::Error, "Invalid !pairs entry: " + val.inspect
- end
- end
- else
- raise Syck::Error, "Invalid !pairs: " + val.inspect
- end
- self
- end
- def self.[]( *vals )
- p = Pairs.new
- 0.step( vals.length - 1, 2 ) { |i|
- p[vals[i]] = vals[i+1]
- }
- p
- end
- def []( k )
- self.assoc( k ).to_a
- end
- def []=( k, val )
- self << [ k, val ]
- val
- end
- def has_key?( k )
- self.assoc( k ) ? true : false
- end
- def is_complex_yaml?
- true
- end
- def to_yaml( opts = {} )
- Syck.quick_emit( self, opts ) do |out|
- out.seq( taguri, to_yaml_style ) do |seq|
- self.each do |v|
- seq.add( Hash[ *v ] )
- end
- end
- end
- end
- end
-
- #
- # Builtin collection: !set
- #
- class Set < ::Hash
- yaml_as "tag:yaml.org,2002:set"
- end
-end
diff --git a/ext/syck/lib/syck/yamlnode.rb b/ext/syck/lib/syck/yamlnode.rb
deleted file mode 100644
index 2fa57b1f97..0000000000
--- a/ext/syck/lib/syck/yamlnode.rb
+++ /dev/null
@@ -1,54 +0,0 @@
-#
-# YAML::YamlNode class
-#
-require 'syck/basenode'
-
-module Syck
-
- #
- # YAML Generic Model container
- #
- class YamlNode
- include BaseNode
- attr_accessor :kind, :type_id, :value, :anchor
- def initialize(t, v)
- @type_id = t
- if Hash === v
- @kind = 'map'
- @value = {}
- v.each {|key,val|
- @value[key.transform] = [key, val]
- }
- elsif Array === v
- @kind = 'seq'
- @value = v
- elsif String === v
- @kind = 'scalar'
- @value = v
- end
- end
-
- #
- # Transform this node fully into a native type
- #
- def transform
- t = nil
- if @value.is_a? Hash
- t = {}
- @value.each { |k,v|
- t[ k ] = v[1].transform
- }
- elsif @value.is_a? Array
- t = []
- @value.each { |v|
- t.push v.transform
- }
- else
- t = @value
- end
- Syck.transfer_method( @type_id, t )
- end
-
- end
-
-end
diff --git a/ext/syck/lib/syck/ypath.rb b/ext/syck/lib/syck/ypath.rb
deleted file mode 100644
index 024dcb7f4e..0000000000
--- a/ext/syck/lib/syck/ypath.rb
+++ /dev/null
@@ -1,54 +0,0 @@
-#
-# YAML::YPath
-#
-
-warn "#{caller[0]}: YAML::YPath is deprecated" if $VERBOSE
-
-module Syck
-
- class YPath
- attr_accessor :segments, :predicates, :flags
- def initialize( str )
- @segments = []
- @predicates = []
- @flags = nil
- while str =~ /^\/?(\/|[^\/\[]+)(?:\[([^\]]+)\])?/
- @segments.push $1
- @predicates.push $2
- str = $'
- end
- unless str.to_s.empty?
- @segments += str.split( "/" )
- end
- if @segments.length == 0
- @segments.push "."
- end
- end
- def self.each_path( str )
- #
- # Find choices
- #
- paths = []
- str = "(#{ str })"
- while str.sub!( /\(([^()]+)\)/, "\n#{ paths.length }\n" )
- paths.push $1.split( '|' )
- end
-
- #
- # Construct all possible paths
- #
- all = [ str ]
- ( paths.length - 1 ).downto( 0 ) do |i|
- all = all.collect do |a|
- paths[i].collect do |p|
- a.gsub( /\n#{ i }\n/, p )
- end
- end.flatten.uniq
- end
- all.collect do |path|
- yield YPath.new( path )
- end
- end
- end
-
-end
diff --git a/ext/syck/lib/yaml/syck.rb b/ext/syck/lib/yaml/syck.rb
deleted file mode 100644
index 5b5d1c494e..0000000000
--- a/ext/syck/lib/yaml/syck.rb
+++ /dev/null
@@ -1,14 +0,0 @@
-# $Id$
-#
-# = yaml/syck.rb:
-#
-
-require 'stringio'
-require 'syck.so'
-require 'syck/error'
-require 'syck/syck'
-require 'syck/tag'
-require 'syck/stream'
-require 'syck/constants'
-require 'syck/rubytypes'
-require 'syck/types'
diff --git a/ext/syck/node.c b/ext/syck/node.c
deleted file mode 100644
index 35c1f45150..0000000000
--- a/ext/syck/node.c
+++ /dev/null
@@ -1,407 +0,0 @@
-/*
- * node.c
- *
- * $Author$
- *
- * Copyright (C) 2003 why the lucky stiff
- */
-
-#include "ruby/ruby.h"
-#include "syck.h"
-
-/*
- * Node allocation functions
- */
-SyckNode *
-syck_alloc_node( enum syck_kind_tag type )
-{
- SyckNode *s;
-
- s = S_ALLOC( SyckNode );
- s->kind = type;
- s->id = 0;
- s->type_id = NULL;
- s->anchor = NULL;
- s->shortcut = NULL;
-
- return s;
-}
-
-void
-syck_free_node( SyckNode *n )
-{
- syck_free_members( n );
- if ( n->type_id != NULL )
- {
- S_FREE( n->type_id );
- n->type_id = NULL;
- }
- if ( n->anchor != NULL )
- {
- S_FREE( n->anchor );
- n->anchor = NULL;
- }
- S_FREE( n );
-}
-
-SyckNode *
-syck_alloc_map(void)
-{
- SyckNode *n;
- struct SyckMap *m;
-
- m = S_ALLOC( struct SyckMap );
- m->style = map_none;
- m->idx = 0;
- m->capa = ALLOC_CT;
- m->keys = S_ALLOC_N( SYMID, m->capa );
- m->values = S_ALLOC_N( SYMID, m->capa );
-
- n = syck_alloc_node( syck_map_kind );
- n->data.pairs = m;
-
- return n;
-}
-
-SyckNode *
-syck_alloc_seq(void)
-{
- SyckNode *n;
- struct SyckSeq *s;
-
- s = S_ALLOC( struct SyckSeq );
- s->style = seq_none;
- s->idx = 0;
- s->capa = ALLOC_CT;
- s->items = S_ALLOC_N( SYMID, s->capa );
-
- n = syck_alloc_node( syck_seq_kind );
- n->data.list = s;
-
- return n;
-}
-
-SyckNode *
-syck_alloc_str(void)
-{
- SyckNode *n;
- struct SyckStr *s;
-
- s = S_ALLOC( struct SyckStr );
- s->len = 0;
- s->ptr = NULL;
- s->style = scalar_none;
-
- n = syck_alloc_node( syck_str_kind );
- n->data.str = s;
-
- return n;
-}
-
-SyckNode *
-syck_new_str( const char *str, enum scalar_style style )
-{
- return syck_new_str2( str, strlen( str ), style );
-}
-
-SyckNode *
-syck_new_str2( const char *str, long len, enum scalar_style style )
-{
- SyckNode *n;
-
- n = syck_alloc_str();
- n->data.str->ptr = S_ALLOC_N( char, len + 1 );
- n->data.str->len = len;
- n->data.str->style = style;
- memcpy( n->data.str->ptr, str, len );
- n->data.str->ptr[len] = '\0';
-
- return n;
-}
-
-void
-syck_replace_str( SyckNode *n, char *str, enum scalar_style style )
-{
- syck_replace_str2( n, str, strlen( str ), style );
-}
-
-void
-syck_replace_str2( SyckNode *n, char *str, long len, enum scalar_style style )
-{
- if ( n->data.str->ptr != NULL )
- {
- S_FREE( n->data.str->ptr );
- n->data.str->ptr = NULL;
- n->data.str->len = 0;
- }
- n->data.str->ptr = S_ALLOC_N( char, len + 1 );
- n->data.str->len = len;
- n->data.str->style = style;
- memcpy( n->data.str->ptr, str, len );
- n->data.str->ptr[len] = '\0';
-}
-
-void
-syck_str_blow_away_commas( SyckNode *n )
-{
- char *go, *end;
-
- go = n->data.str->ptr;
- end = go + n->data.str->len;
- while ( *(++go) != '\0' )
- {
- if ( *go == ',' )
- {
- n->data.str->len -= 1;
- memmove( go, go + 1, end - go );
- end -= 1;
- }
- }
-}
-
-char *
-syck_str_read( SyckNode *n )
-{
- ASSERT( n != NULL );
- return n->data.str->ptr;
-}
-
-SyckNode *
-syck_new_map( SYMID key, SYMID value )
-{
- SyckNode *n;
-
- n = syck_alloc_map();
- syck_map_add( n, key, value );
-
- return n;
-}
-
-void
-syck_map_empty( SyckNode *n )
-{
- struct SyckMap *m;
- ASSERT( n != NULL );
- ASSERT( n->data.list != NULL );
-
- S_FREE( n->data.pairs->keys );
- S_FREE( n->data.pairs->values );
- m = n->data.pairs;
- m->idx = 0;
- m->capa = ALLOC_CT;
- m->keys = S_ALLOC_N( SYMID, m->capa );
- m->values = S_ALLOC_N( SYMID, m->capa );
-}
-
-void
-syck_map_add( SyckNode *map, SYMID key, SYMID value )
-{
- struct SyckMap *m;
- long idx;
-
- ASSERT( map != NULL );
- ASSERT( map->data.pairs != NULL );
-
- m = map->data.pairs;
- idx = m->idx;
- m->idx += 1;
- if ( m->idx > m->capa )
- {
- m->capa += ALLOC_CT;
- S_REALLOC_N( m->keys, SYMID, m->capa );
- S_REALLOC_N( m->values, SYMID, m->capa );
- }
- m->keys[idx] = key;
- m->values[idx] = value;
-}
-
-void
-syck_map_update( SyckNode *map1, SyckNode *map2 )
-{
- struct SyckMap *m1, *m2;
- long new_idx, new_capa;
- ASSERT( map1 != NULL );
- ASSERT( map2 != NULL );
-
- m1 = map1->data.pairs;
- m2 = map2->data.pairs;
- if ( m2->idx < 1 ) return;
-
- new_idx = m1->idx;
- new_idx += m2->idx;
- new_capa = m1->capa;
- while ( new_idx > new_capa )
- {
- new_capa += ALLOC_CT;
- }
- if ( new_capa > m1->capa )
- {
- m1->capa = new_capa;
- S_REALLOC_N( m1->keys, SYMID, m1->capa );
- S_REALLOC_N( m1->values, SYMID, m1->capa );
- }
- for ( new_idx = 0; new_idx < m2->idx; m1->idx++, new_idx++ )
- {
- m1->keys[m1->idx] = m2->keys[new_idx];
- m1->values[m1->idx] = m2->values[new_idx];
- }
-}
-
-long
-syck_map_count( SyckNode *map )
-{
- ASSERT( map != NULL );
- ASSERT( map->data.pairs != NULL );
- return map->data.pairs->idx;
-}
-
-void
-syck_map_assign( SyckNode *map, enum map_part p, long idx, SYMID id )
-{
- struct SyckMap *m;
-
- ASSERT( map != NULL );
- m = map->data.pairs;
- ASSERT( m != NULL );
- if ( p == map_key )
- {
- m->keys[idx] = id;
- }
- else
- {
- m->values[idx] = id;
- }
-}
-
-SYMID
-syck_map_read( SyckNode *map, enum map_part p, long idx )
-{
- struct SyckMap *m;
-
- ASSERT( map != NULL );
- m = map->data.pairs;
- ASSERT( m != NULL );
- if ( p == map_key )
- {
- return m->keys[idx];
- }
- else
- {
- return m->values[idx];
- }
-}
-
-SyckNode *
-syck_new_seq( SYMID value )
-{
- SyckNode *n;
-
- n = syck_alloc_seq();
- syck_seq_add( n, value );
-
- return n;
-}
-
-void
-syck_seq_empty( SyckNode *n )
-{
- struct SyckSeq *s;
- ASSERT( n != NULL );
- ASSERT( n->data.list != NULL );
-
- S_FREE( n->data.list->items );
- s = n->data.list;
- s->idx = 0;
- s->capa = ALLOC_CT;
- s->items = S_ALLOC_N( SYMID, s->capa );
-}
-
-void
-syck_seq_add( SyckNode *arr, SYMID value )
-{
- struct SyckSeq *s;
- long idx;
-
- ASSERT( arr != NULL );
- ASSERT( arr->data.list != NULL );
-
- s = arr->data.list;
- idx = s->idx;
- s->idx += 1;
- if ( s->idx > s->capa )
- {
- s->capa += ALLOC_CT;
- S_REALLOC_N( s->items, SYMID, s->capa );
- }
- s->items[idx] = value;
-}
-
-long
-syck_seq_count( SyckNode *seq )
-{
- ASSERT( seq != NULL );
- ASSERT( seq->data.list != NULL );
- return seq->data.list->idx;
-}
-
-void
-syck_seq_assign( SyckNode *seq, long idx, SYMID id )
-{
- struct SyckSeq *s;
-
- ASSERT( map != NULL );
- s = seq->data.list;
- ASSERT( m != NULL );
- s->items[idx] = id;
-}
-
-SYMID
-syck_seq_read( SyckNode *seq, long idx )
-{
- struct SyckSeq *s;
-
- ASSERT( seq != NULL );
- s = seq->data.list;
- ASSERT( s != NULL );
- return s->items[idx];
-}
-
-void
-syck_free_members( SyckNode *n )
-{
- if ( n == NULL ) return;
-
- switch ( n->kind )
- {
- case syck_str_kind:
- if ( n->data.str != NULL )
- {
- S_FREE( n->data.str->ptr );
- n->data.str->ptr = NULL;
- n->data.str->len = 0;
- S_FREE( n->data.str );
- n->data.str = NULL;
- }
- break;
-
- case syck_seq_kind:
- if ( n->data.list != NULL )
- {
- S_FREE( n->data.list->items );
- S_FREE( n->data.list );
- n->data.list = NULL;
- }
- break;
-
- case syck_map_kind:
- if ( n->data.pairs != NULL )
- {
- S_FREE( n->data.pairs->keys );
- S_FREE( n->data.pairs->values );
- S_FREE( n->data.pairs );
- n->data.pairs = NULL;
- }
- break;
- }
-}
-
diff --git a/ext/syck/rubyext.c b/ext/syck/rubyext.c
deleted file mode 100644
index 2ab2e49482..0000000000
--- a/ext/syck/rubyext.c
+++ /dev/null
@@ -1,2328 +0,0 @@
-/* -*- indent-tabs-mode: nil -*- */
-/*
- * rubyext.c
- *
- * $Author$
- *
- * Copyright (C) 2003-2005 why the lucky stiff
- */
-
-#include "ruby/ruby.h"
-#include "ruby/encoding.h"
-#include "syck.h"
-#include <sys/types.h>
-#include <time.h>
-
-typedef struct RVALUE {
- union {
-#if 0
- struct {
- unsigned long flags; /* always 0 for freed obj */
- struct RVALUE *next;
- } free;
-#endif
- struct RBasic basic;
- struct RObject object;
- struct RClass klass;
- /*struct RFloat flonum;*/
- /*struct RString string;*/
- struct RArray array;
- /*struct RRegexp regexp;*/
- struct RHash hash;
- /*struct RData data;*/
- struct RStruct rstruct;
- /*struct RBignum bignum;*/
- /*struct RFile file;*/
- } as;
-} RVALUE;
-
-typedef struct {
- long hash;
- char *buffer;
- long length;
- long remaining;
- int printed;
-} bytestring_t;
-
-#define RUBY_DOMAIN "ruby.yaml.org,2002"
-
-/*
- * symbols and constants
- */
-static ID s_new, s_utc, s_at, s_to_f, s_to_i, s_read, s_binmode, s_call, s_cmp, s_transfer, s_update, s_dup, s_haskey, s_match, s_keys, s_unpack, s_tr_bang, s_default_set, s_tag_read_class, s_tag_subclasses, s_resolver, s_push, s_emitter, s_level, s_detect_implicit, s_node_import, s_out, s_input, s_intern, s_transform, s_yaml_new, s_yaml_initialize, s_node_export, s_to_yaml, s_write, s_set_resolver, s_each;
-static ID s_tags, s_kind, s_name, s_options, s_type_id, s_type_id_set, s_style, s_style_set, s_value, s_value_set, s_parse;
-static VALUE sym_model, sym_generic, sym_input, sym_bytecode;
-static VALUE sym_scalar, sym_seq, sym_map;
-static VALUE sym_1quote, sym_2quote, sym_fold, sym_literal, sym_plain, sym_inline;
-static VALUE cDate, cNode, cMap, cSeq, cScalar, cOut, cParser, cResolver, cPrivateType, cDomainType, cYObject, cBadAlias, cDefaultKey, cMergeKey, cEmitter, cDateTime;
-static VALUE oDefaultResolver, oGenericResolver;
-
-/*
- * my private collection of numerical oddities.
- */
-static double S_zero(void) { return 0.0; }
-static double S_one(void) { return 1.0; }
-static double S_inf(void) { return S_one() / S_zero(); }
-static double S_nan(void) { return S_zero() / S_zero(); }
-
-static VALUE syck_node_transform( VALUE );
-
-/*
- * handler prototypes
- */
-SYMID rb_syck_load_handler _((SyckParser *, SyckNode *));
-void rb_syck_err_handler _((SyckParser *, const char *));
-SyckNode * rb_syck_bad_anchor_handler _((SyckParser *, char *));
-void rb_syck_output_handler _((SyckEmitter *, char *, long));
-void rb_syck_emitter_handler _((SyckEmitter *, st_data_t));
-int syck_parser_assign_io _((SyckParser *, VALUE *));
-VALUE syck_scalar_alloc _((VALUE class));
-VALUE syck_seq_alloc _((VALUE class));
-VALUE syck_map_alloc _((VALUE class));
-
-struct parser_xtra {
- VALUE data; /* Borrowed this idea from marshal.c to fix [ruby-core:8067] problem */
- VALUE proc;
- VALUE resolver;
- int taint;
-};
-
-struct emitter_xtra {
- VALUE oid;
- VALUE data;
- VALUE port;
-};
-
-/*
- * Convert YAML to bytecode
- */
-VALUE
-rb_syck_compile(VALUE self, VALUE port)
-{
- SYMID oid;
- int taint;
- char *ret;
- VALUE bc;
- bytestring_t *sav = NULL;
- void *data = NULL;
-
- SyckParser *parser = syck_new_parser();
- taint = syck_parser_assign_io(parser, &port);
- syck_parser_handler( parser, syck_yaml2byte_handler );
- syck_parser_error_handler( parser, NULL );
- syck_parser_implicit_typing( parser, 0 );
- syck_parser_taguri_expansion( parser, 0 );
- oid = syck_parse( parser );
- if (!syck_lookup_sym( parser, oid, &data )) {
- rb_raise(rb_eSyntaxError, "root node <%p> not found", (void *)oid);
- }
- sav = data;
-
- ret = S_ALLOCA_N( char, strlen( sav->buffer ) + 3 );
- ret[0] = '\0';
- strcat( ret, "D\n" );
- strcat( ret, sav->buffer );
-
- syck_free_parser( parser );
-
- bc = rb_str_new2( ret );
- if ( taint ) OBJ_TAINT( bc );
- return bc;
-}
-
-/*
- * read from io.
- */
-long
-rb_syck_io_str_read( char *buf, SyckIoStr *str, long max_size, long skip )
-{
- long len = 0;
-
- ASSERT( str != NULL );
- max_size -= skip;
-
- if ( max_size <= 0 ) max_size = 0;
- else
- {
- /*
- * call io#read.
- */
- VALUE src = (VALUE)str->ptr;
- VALUE n = LONG2NUM(max_size);
- VALUE str2 = rb_funcall2(src, s_read, 1, &n);
- if (!NIL_P(str2))
- {
- StringValue(str2);
- len = RSTRING_LEN(str2);
- memcpy( buf + skip, RSTRING_PTR(str2), len );
- }
- }
- len += skip;
- buf[len] = '\0';
- return len;
-}
-
-/*
- * determine: are we reading from a string or io?
- * (returns tainted? boolean)
- */
-int
-syck_parser_assign_io(SyckParser *parser, VALUE *pport)
-{
- int taint = Qtrue;
- VALUE tmp, port = *pport;
- if (!NIL_P(tmp = rb_check_string_type(port))) {
- taint = OBJ_TAINTED(port); /* original taintedness */
- port = tmp;
- syck_parser_str( parser, RSTRING_PTR(port), RSTRING_LEN(port), NULL );
- }
- else if (rb_respond_to(port, s_read)) {
- if (rb_respond_to(port, s_binmode)) {
- rb_funcall2(port, s_binmode, 0, 0);
- }
- syck_parser_str( parser, (char *)port, 0, rb_syck_io_str_read );
- }
- else {
- rb_raise(rb_eTypeError, "instance of IO needed");
- }
- *pport = port;
- return taint;
-}
-
-/*
- * Get value in hash by key, forcing an empty hash if nil.
- */
-VALUE
-syck_get_hash_aref(VALUE hsh, VALUE key)
-{
- VALUE val = rb_hash_aref( hsh, key );
- if ( NIL_P( val ) )
- {
- val = rb_hash_new();
- rb_hash_aset(hsh, key, val);
- }
- return val;
-}
-
-/*
- * creating timestamps
- */
-struct mktime_arg {
- const char *str;
- long len;
-};
-
-VALUE
-mktime_do(VALUE varg)
-{
- struct mktime_arg *arg = (struct mktime_arg *)varg;
- VALUE time;
- const char *str = arg->str;
- long len = arg->len;
- const char *ptr = str;
- VALUE year = INT2FIX(0);
- VALUE mon = INT2FIX(0);
- VALUE day = INT2FIX(0);
- VALUE hour = INT2FIX(0);
- VALUE min = INT2FIX(0);
- VALUE sec = INT2FIX(0);
- long usec;
-
- /* Year*/
- if ( ptr[0] != '\0' && len > 0 ) {
- year = INT2FIX(strtol(ptr, NULL, 10));
- }
-
- /* Month*/
- ptr += 4;
- if ( ptr[0] != '\0' && len > ptr - str ) {
- while ( !ISDIGIT( *ptr ) ) ptr++;
- mon = INT2FIX(strtol(ptr, NULL, 10));
- }
-
- /* Day*/
- ptr += 2;
- if ( ptr[0] != '\0' && len > ptr - str ) {
- while ( !ISDIGIT( *ptr ) ) ptr++;
- day = INT2FIX(strtol(ptr, NULL, 10));
- }
-
- /* Hour*/
- ptr += 2;
- if ( ptr[0] != '\0' && len > ptr - str ) {
- while ( !ISDIGIT( *ptr ) ) ptr++;
- hour = INT2FIX(strtol(ptr, NULL, 10));
- }
-
- /* Minute */
- ptr += 2;
- if ( ptr[0] != '\0' && len > ptr - str ) {
- while ( !ISDIGIT( *ptr ) ) ptr++;
- min = INT2FIX(strtol(ptr, NULL, 10));
- }
-
- /* Second */
- ptr += 2;
- if ( ptr[0] != '\0' && len > ptr - str ) {
- while ( !ISDIGIT( *ptr ) ) ptr++;
- sec = INT2FIX(strtol(ptr, NULL, 10));
- }
-
- /* Millisecond */
- ptr += 2;
- if ( len > ptr - str && *ptr == '.' )
- {
- char padded[] = "000000";
- const int padding = (int)(sizeof(padded) - 1);
- const char *end = ptr + 1;
- const char *begin = end;
- ptrdiff_t length;
- while ( isdigit( *end ) ) end++;
- if ((length = (end - begin)) > padding) length = padding;
- MEMCPY(padded, begin, char, length);
- usec = strtol(padded, NULL, 10);
- }
- else
- {
- usec = 0;
- }
-
- /* Time Zone*/
- while ( len > ptr - str && *ptr != 'Z' && *ptr != '+' && *ptr != '-' && *ptr != '\0' ) ptr++;
- if ( len > ptr - str && ( *ptr == '-' || *ptr == '+' ) )
- {
- time_t tz_offset = strtol(ptr, NULL, 10) * 3600;
- VALUE tmp;
-
- while ( *ptr != ':' && *ptr != '\0' ) ptr++;
- if ( *ptr == ':' )
- {
- ptr += 1;
- if ( tz_offset < 0 )
- {
- tz_offset -= strtol(ptr, NULL, 10) * 60;
- }
- else
- {
- tz_offset += strtol(ptr, NULL, 10) * 60;
- }
- }
-
- /* Make TZ time*/
- time = rb_funcall(rb_cTime, s_utc, 6, year, mon, day, hour, min, sec);
- tmp = rb_funcall(time, s_to_i, 0);
- tmp = rb_funcall(tmp, '-', 1, LONG2FIX(tz_offset));
- return rb_funcall(rb_cTime, s_at, 2, tmp, LONG2NUM(usec));
- }
- else
- {
- /* Make UTC time*/
- return rb_funcall(rb_cTime, s_utc, 7, year, mon, day, hour, min, sec, LONG2NUM(usec));
- }
-}
-
-VALUE
-mktime_r(VALUE varg)
-{
- struct mktime_arg *arg = (struct mktime_arg *)varg;
-
- if (!cDateTime) {
- /*
- * Load Date module
- */
- rb_require("date");
- cDateTime = rb_const_get(rb_cObject, rb_intern("DateTime"));
- }
- return rb_funcall(cDateTime, s_parse, 1, rb_str_new(arg->str, arg->len));
-}
-
-VALUE
-rb_syck_mktime(const char *str, long len)
-{
- struct mktime_arg a;
-
- a.str = str;
- a.len = len;
- return rb_rescue2(mktime_do, (VALUE)&a, mktime_r, (VALUE)&a, rb_eArgError, NULL);
-}
-
-/*
- * handles merging of an array of hashes
- * (see http://www.yaml.org/type/merge/)
- */
-VALUE
-syck_merge_i(VALUE entry, VALUE hsh )
-{
- VALUE tmp;
- if ( !NIL_P(tmp = rb_check_convert_type(entry, T_HASH, "Hash", "to_hash")) )
- {
- entry = tmp;
- rb_funcall( hsh, s_update, 1, entry );
- }
- return Qnil;
-}
-
-/*
- * default handler for ruby.yaml.org types
- */
-int
-yaml_org_handler( SyckNode *n, VALUE *ref )
-{
- char *type_id = n->type_id;
- int transferred = 0;
- long i = 0;
- VALUE obj = Qnil;
-
- if ( type_id != NULL && strncmp( type_id, "tag:yaml.org,2002:", 18 ) == 0 )
- {
- type_id += 18;
- }
-
- switch (n->kind)
- {
- case syck_str_kind:
- transferred = 1;
- if ( type_id == NULL )
- {
- obj = rb_str_new( n->data.str->ptr, n->data.str->len );
- }
- else if ( strcmp( type_id, "null" ) == 0 )
- {
- obj = Qnil;
- }
- else if ( strcmp( type_id, "binary" ) == 0 )
- {
- VALUE arr;
- obj = rb_str_new( n->data.str->ptr, n->data.str->len );
- rb_funcall( obj, s_tr_bang, 2, rb_str_new2( "\n\t " ), rb_str_new2( "" ) );
- arr = rb_funcall( obj, s_unpack, 1, rb_str_new2( "m" ) );
- obj = rb_ary_shift( arr );
- }
- else if ( strcmp( type_id, "bool#yes" ) == 0 )
- {
- obj = Qtrue;
- }
- else if ( strcmp( type_id, "bool#no" ) == 0 )
- {
- obj = Qfalse;
- }
- else if ( strcmp( type_id, "int#hex" ) == 0 )
- {
- syck_str_blow_away_commas( n );
- obj = rb_cstr2inum( n->data.str->ptr, 16 );
- }
- else if ( strcmp( type_id, "int#oct" ) == 0 )
- {
- syck_str_blow_away_commas( n );
- obj = rb_cstr2inum( n->data.str->ptr, 8 );
- }
- else if ( strcmp( type_id, "int#base60" ) == 0 )
- {
- char *ptr, *end;
- long sixty = 1;
- long total = 0;
- syck_str_blow_away_commas( n );
- ptr = n->data.str->ptr;
- end = n->data.str->ptr + n->data.str->len;
- while ( end > ptr )
- {
- long bnum = 0;
- char *colon = end - 1;
- while ( colon >= ptr && *colon != ':' )
- {
- colon--;
- }
- if ( colon >= ptr && *colon == ':' ) *colon = '\0';
-
- bnum = strtol( colon + 1, NULL, 10 );
- total += bnum * sixty;
- sixty *= 60;
- end = colon;
- }
- obj = INT2FIX(total);
- }
- else if ( strncmp( type_id, "int", 3 ) == 0 )
- {
- syck_str_blow_away_commas( n );
- obj = rb_cstr2inum( n->data.str->ptr, 10 );
- }
- else if ( strcmp( type_id, "float#base60" ) == 0 )
- {
- char *ptr, *end;
- long sixty = 1;
- double total = 0.0;
- syck_str_blow_away_commas( n );
- ptr = n->data.str->ptr;
- end = n->data.str->ptr + n->data.str->len;
- while ( end > ptr )
- {
- double bnum = 0;
- char *colon = end - 1;
- while ( colon >= ptr && *colon != ':' )
- {
- colon--;
- }
- if ( colon >= ptr && *colon == ':' ) *colon = '\0';
-
- bnum = strtod( colon + 1, NULL );
- total += bnum * sixty;
- sixty *= 60;
- end = colon;
- }
- obj = rb_float_new( total );
- }
- else if ( strcmp( type_id, "float#nan" ) == 0 )
- {
- obj = rb_float_new( S_nan() );
- }
- else if ( strcmp( type_id, "float#inf" ) == 0 )
- {
- obj = rb_float_new( S_inf() );
- }
- else if ( strcmp( type_id, "float#neginf" ) == 0 )
- {
- obj = rb_float_new( -S_inf() );
- }
- else if ( strncmp( type_id, "float", 5 ) == 0 )
- {
- double f;
- syck_str_blow_away_commas( n );
- f = strtod( n->data.str->ptr, NULL );
- obj = rb_float_new( f );
- }
- else if ( strcmp( type_id, "timestamp#iso8601" ) == 0 )
- {
- obj = rb_syck_mktime( n->data.str->ptr, n->data.str->len );
- }
- else if ( strcmp( type_id, "timestamp#spaced" ) == 0 )
- {
- obj = rb_syck_mktime( n->data.str->ptr, n->data.str->len );
- }
- else if ( strcmp( type_id, "timestamp#ymd" ) == 0 )
- {
- char *ptr = n->data.str->ptr;
- VALUE year, mon, day;
-
- /* Year*/
- ptr[4] = '\0';
- year = INT2FIX(strtol(ptr, NULL, 10));
-
- /* Month*/
- ptr += 4;
- while ( !ISDIGIT( *ptr ) ) ptr++;
- mon = INT2FIX(strtol(ptr, NULL, 10));
-
- /* Day*/
- ptr += 2;
- while ( !ISDIGIT( *ptr ) ) ptr++;
- day = INT2FIX(strtol(ptr, NULL, 10));
-
- if ( !cDate ) {
- /*
- * Load Date module
- */
- rb_require( "date" );
- cDate = rb_const_get( rb_cObject, rb_intern("Date") );
- }
-
- obj = rb_funcall( cDate, s_new, 3, year, mon, day );
- }
- else if ( strncmp( type_id, "timestamp", 9 ) == 0 )
- {
- obj = rb_syck_mktime( n->data.str->ptr, n->data.str->len );
- }
- else if ( strncmp( type_id, "merge", 5 ) == 0 )
- {
- obj = rb_funcall( cMergeKey, s_new, 0 );
- }
- else if ( strncmp( type_id, "default", 7 ) == 0 )
- {
- obj = rb_funcall( cDefaultKey, s_new, 0 );
- }
- else if ( n->data.str->style == scalar_plain &&
- n->data.str->len > 1 &&
- strncmp( n->data.str->ptr, ":", 1 ) == 0 )
- {
- obj = rb_funcall( oDefaultResolver, s_transfer, 2,
- rb_str_new2( "tag:ruby.yaml.org,2002:sym" ),
- rb_str_new( n->data.str->ptr + 1, n->data.str->len - 1 ) );
- }
- else if ( strcmp( type_id, "str" ) == 0 )
- {
- obj = rb_str_new( n->data.str->ptr, n->data.str->len );
- rb_enc_associate(obj, rb_utf8_encoding());
- }
- else
- {
- transferred = 0;
- obj = rb_str_new( n->data.str->ptr, n->data.str->len );
- }
- break;
-
- case syck_seq_kind:
- if ( type_id == NULL || strcmp( type_id, "seq" ) == 0 )
- {
- transferred = 1;
- }
- obj = rb_ary_new2( n->data.list->idx );
- for ( i = 0; i < n->data.list->idx; i++ )
- {
- rb_ary_store( obj, i, syck_seq_read( n, i ) );
- }
- break;
-
- case syck_map_kind:
- if ( type_id == NULL || strcmp( type_id, "map" ) == 0 )
- {
- transferred = 1;
- }
- obj = rb_hash_new();
- for ( i = 0; i < n->data.pairs->idx; i++ )
- {
- VALUE k = syck_map_read( n, map_key, i );
- VALUE v = syck_map_read( n, map_value, i );
- int skip_aset = 0;
-
- /*
- * Handle merge keys
- */
- if ( rb_obj_is_kind_of( k, cMergeKey ) )
- {
- VALUE tmp;
- if ( !NIL_P(tmp = rb_check_convert_type(v, T_HASH, "Hash", "to_hash")) )
- {
- VALUE dup = rb_funcall( tmp, s_dup, 0 );
- rb_funcall( dup, s_update, 1, obj );
- obj = dup;
- skip_aset = 1;
- }
- else if ( !NIL_P(tmp = rb_check_array_type(v)) )
- {
- VALUE end = rb_ary_pop( tmp );
- VALUE tmph = rb_check_convert_type(end, T_HASH, "Hash", "to_hash");
- if ( !NIL_P(tmph) )
- {
- VALUE dup = rb_funcall( tmph, s_dup, 0 );
- tmp = rb_ary_reverse( tmp );
- rb_ary_push( tmp, obj );
- rb_block_call( tmp, s_each, 0, 0, syck_merge_i, dup );
- obj = dup;
- skip_aset = 1;
- }
- }
- }
- else if ( rb_obj_is_kind_of( k, cDefaultKey ) )
- {
- rb_funcall( obj, s_default_set, 1, v );
- skip_aset = 1;
- }
-
- if ( ! skip_aset )
- {
- rb_hash_aset( obj, k, v );
- }
- }
- break;
- }
-
- *ref = obj;
- return transferred;
-}
-
-static void syck_node_mark( SyckNode *n );
-
-/*
- * {native mode} node handler
- * - Converts data into native Ruby types
- */
-SYMID
-rb_syck_load_handler(SyckParser *p, SyckNode *n)
-{
- VALUE obj = Qnil;
- struct parser_xtra *bonus = (struct parser_xtra *)p->bonus;
- VALUE resolver = bonus->resolver;
- if ( NIL_P( resolver ) )
- {
- resolver = oDefaultResolver;
- }
-
- /*
- * Create node,
- */
- obj = rb_funcall( resolver, s_node_import, 1, Data_Wrap_Struct( cNode, NULL, NULL, n ) );
-
- /*
- * ID already set, let's alter the symbol table to accept the new object
- */
- if (n->id > 0 && !NIL_P(obj))
- {
- MEMCPY((void *)n->id, (void *)obj, RVALUE, 1);
- MEMZERO((void *)obj, RVALUE, 1);
- obj = n->id;
- }
-
- if ( bonus->taint) OBJ_TAINT( obj );
- if ( bonus->proc != 0 ) rb_funcall(bonus->proc, s_call, 1, obj);
-
- rb_hash_aset(bonus->data, INT2FIX(RHASH_SIZE(bonus->data)), obj);
- return obj;
-}
-
-/*
- * friendly errors.
- */
-void
-rb_syck_err_handler(SyckParser *p, const char *msg)
-{
- char *endl = p->cursor;
-
- while ( *endl != '\0' && *endl != '\n' )
- endl++;
-
- endl[0] = '\0';
- rb_raise(rb_eArgError, "%s on line %d, col %"PRIdPTRDIFF": `%s'",
- msg,
- p->linect,
- p->cursor - p->lineptr,
- p->lineptr);
-}
-
-/*
- * provide bad anchor object to the parser.
- */
-SyckNode *
-rb_syck_bad_anchor_handler(SyckParser *p, char *a)
-{
- VALUE anchor_name = rb_str_new2( a );
- SyckNode *badanc = syck_new_map( rb_str_new2( "name" ), anchor_name );
- badanc->type_id = syck_strndup( "tag:ruby.yaml.org,2002:object:YAML::Syck::BadAlias", 53 );
- return badanc;
-}
-
-/*
- * data loaded based on the model requested.
- */
-void
-syck_set_model(VALUE p, VALUE input, VALUE model)
-{
- SyckParser *parser;
- Data_Get_Struct(p, SyckParser, parser);
- syck_parser_handler( parser, rb_syck_load_handler );
- /* WARN: gonna be obsoleted soon!! */
- if ( model == sym_generic )
- {
- rb_funcall( p, s_set_resolver, 1, oGenericResolver );
- }
- syck_parser_implicit_typing( parser, 1 );
- syck_parser_taguri_expansion( parser, 1 );
-
- if ( NIL_P( input ) )
- {
- input = rb_ivar_get( p, s_input );
- }
- if ( input == sym_bytecode )
- {
- syck_parser_set_input_type( parser, syck_bytecode_utf8 );
- }
- else
- {
- syck_parser_set_input_type( parser, syck_yaml_utf8 );
- }
- syck_parser_error_handler( parser, rb_syck_err_handler );
- syck_parser_bad_anchor_handler( parser, rb_syck_bad_anchor_handler );
-}
-
-static int
-syck_st_mark_nodes( char *key, SyckNode *n, char *arg )
-{
- if ( n != (void *)1 ) syck_node_mark( n );
- return ST_CONTINUE;
-}
-
-/*
- * mark parser nodes
- */
-static void
-syck_mark_parser(SyckParser *parser)
-{
- struct parser_xtra *bonus = (struct parser_xtra *)parser->bonus;
- rb_gc_mark_maybe(parser->root);
- rb_gc_mark_maybe(parser->root_on_error);
- rb_gc_mark( bonus->data );
- rb_gc_mark( bonus->proc );
- rb_gc_mark( bonus->resolver );
-
- if ( parser->anchors != NULL )
- {
- st_foreach( parser->anchors, syck_st_mark_nodes, 0 );
- }
- if ( parser->bad_anchors != NULL )
- {
- st_foreach( parser->bad_anchors, syck_st_mark_nodes, 0 );
- }
-}
-
-/*
- * Free the parser and any bonus attachment.
- */
-void
-rb_syck_free_parser(SyckParser *p)
-{
- S_FREE( p->bonus );
- syck_free_parser(p);
-}
-
-/*
- * YAML::Syck::Parser.allocate
- */
-VALUE syck_parser_s_alloc _((VALUE));
-VALUE
-syck_parser_s_alloc(VALUE class)
-{
- VALUE pobj;
- SyckParser *parser = syck_new_parser();
-
- parser->bonus = S_ALLOC( struct parser_xtra );
- S_MEMZERO( parser->bonus, struct parser_xtra, 1 );
-
- pobj = Data_Wrap_Struct( class, syck_mark_parser, rb_syck_free_parser, parser );
-
- syck_parser_set_root_on_error( parser, Qnil );
-
- return pobj;
-}
-
-/*
- * YAML::Syck::Parser.initialize( resolver, options )
- */
-static VALUE
-syck_parser_initialize(int argc, VALUE *argv, VALUE self)
-{
- VALUE options;
- if (rb_scan_args(argc, argv, "01", &options) == 0)
- {
- options = rb_hash_new();
- }
- else
- {
- Check_Type(options, T_HASH);
- }
- rb_ivar_set(self, s_options, options);
- rb_ivar_set(self, s_input, Qnil);
- return self;
-}
-
-/*
- * YAML::Syck::Parser.bufsize = Integer
- */
-static VALUE
-syck_parser_bufsize_set(VALUE self, VALUE size)
-{
- SyckParser *parser;
-
- if ( rb_respond_to( size, s_to_i ) ) {
- int n = NUM2INT(rb_funcall(size, s_to_i, 0));
- Data_Get_Struct(self, SyckParser, parser);
- parser->bufsize = n;
- }
- return self;
-}
-
-/*
- * YAML::Syck::Parser.bufsize => Integer
- */
-static VALUE
-syck_parser_bufsize_get(VALUE self)
-{
- SyckParser *parser;
-
- Data_Get_Struct(self, SyckParser, parser);
- return INT2FIX( parser->bufsize );
-}
-
-/*
- * YAML::Syck::Parser.load( IO or String )
- */
-VALUE
-syck_parser_load(int argc, VALUE *argv, VALUE self)
-{
- VALUE port, proc, model, input;
- SyckParser *parser;
- struct parser_xtra *bonus;
-
- rb_scan_args(argc, argv, "11", &port, &proc);
-
- input = rb_hash_aref( rb_attr_get( self, s_options ), sym_input );
- model = rb_hash_aref( rb_attr_get( self, s_options ), sym_model );
- Data_Get_Struct(self, SyckParser, parser);
- syck_set_model( self, input, model );
-
- bonus = (struct parser_xtra *)parser->bonus;
- bonus->taint = syck_parser_assign_io(parser, &port);
- bonus->data = rb_hash_new();
- bonus->resolver = rb_attr_get( self, s_resolver );
- if ( NIL_P( proc ) ) bonus->proc = 0;
- else bonus->proc = proc;
-
- return syck_parse( parser );
-}
-
-/*
- * YAML::Syck::Parser.load_documents( IO or String ) { |doc| }
- */
-VALUE
-syck_parser_load_documents(int argc, VALUE *argv, VALUE self)
-{
- VALUE port, proc, v, input, model;
- SyckParser *parser;
- struct parser_xtra *bonus;
-
- rb_scan_args(argc, argv, "1&", &port, &proc);
-
- input = rb_hash_aref( rb_attr_get( self, s_options ), sym_input );
- model = rb_hash_aref( rb_attr_get( self, s_options ), sym_model );
- Data_Get_Struct(self, SyckParser, parser);
- syck_set_model( self, input, model );
-
- bonus = (struct parser_xtra *)parser->bonus;
- bonus->taint = syck_parser_assign_io(parser, &port);
- bonus->resolver = rb_attr_get( self, s_resolver );
- bonus->proc = 0;
-
- while ( 1 )
- {
- /* Reset hash for tracking nodes */
- bonus->data = rb_hash_new();
-
- /* Parse a document */
- v = syck_parse( parser );
- if ( parser->eof == 1 )
- {
- break;
- }
-
- /* Pass document to block */
- rb_funcall( proc, s_call, 1, v );
- }
-
- return Qnil;
-}
-
-/*
- * YAML::Syck::Parser#set_resolver
- */
-VALUE
-syck_parser_set_resolver(VALUE self, VALUE resolver)
-{
- rb_ivar_set( self, s_resolver, resolver );
- return self;
-}
-
-/*
- * YAML::Syck::Resolver.initialize
- */
-static VALUE
-syck_resolver_initialize(VALUE self)
-{
- rb_ivar_set(self, s_tags, rb_hash_new());
- return self;
-}
-
-/*
- * YAML::Syck::Resolver#add_type
- */
-VALUE
-syck_resolver_add_type(VALUE self, VALUE taguri, VALUE cls)
-{
- VALUE tags = rb_attr_get(self, s_tags);
- rb_hash_aset( tags, taguri, cls );
- return Qnil;
-}
-
-/*
- * YAML::Syck::Resolver#use_types_at
- */
-VALUE
-syck_resolver_use_types_at(VALUE self, VALUE hsh)
-{
- rb_ivar_set( self, s_tags, hsh );
- return Qnil;
-}
-
-/*
- * YAML::Syck::Resolver#detect_implicit
- */
-VALUE
-syck_resolver_detect_implicit(VALUE self, VALUE val)
-{
- return rb_str_new2( "" );
-}
-
-/*
- * YAML::Syck::Resolver#node_import
- */
-VALUE
-syck_resolver_node_import(VALUE self, VALUE node)
-{
- SyckNode *n;
- VALUE obj = Qnil;
- int i = 0;
- Data_Get_Struct(node, SyckNode, n);
-
- switch (n->kind)
- {
- case syck_str_kind:
- obj = rb_str_new( n->data.str->ptr, n->data.str->len );
- break;
-
- case syck_seq_kind:
- obj = rb_ary_new2( n->data.list->idx );
- for ( i = 0; i < n->data.list->idx; i++ )
- {
- rb_ary_store( obj, i, syck_seq_read( n, i ) );
- }
- break;
-
- case syck_map_kind:
- obj = rb_hash_new();
- for ( i = 0; i < n->data.pairs->idx; i++ )
- {
- VALUE k = syck_map_read( n, map_key, i );
- VALUE v = syck_map_read( n, map_value, i );
- int skip_aset = 0;
-
- /*
- * Handle merge keys
- */
- if ( rb_obj_is_kind_of( k, cMergeKey ) )
- {
- if ( rb_obj_is_kind_of( v, rb_cHash ) )
- {
- VALUE dup = rb_funcall( v, s_dup, 0 );
- rb_funcall( dup, s_update, 1, obj );
- obj = dup;
- skip_aset = 1;
- }
- else if ( rb_obj_is_kind_of( v, rb_cArray ) )
- {
- VALUE end = rb_ary_pop( v );
- if ( rb_obj_is_kind_of( end, rb_cHash ) )
- {
- VALUE dup = rb_funcall( end, s_dup, 0 );
- v = rb_ary_reverse( v );
- rb_ary_push( v, obj );
- rb_block_call( v, s_each, 0, 0, syck_merge_i, dup );
- obj = dup;
- skip_aset = 1;
- }
- }
- }
- else if ( rb_obj_is_kind_of( k, cDefaultKey ) )
- {
- rb_funcall( obj, s_default_set, 1, v );
- skip_aset = 1;
- }
-
- if ( ! skip_aset )
- {
- rb_hash_aset( obj, k, v );
- }
- }
- break;
- }
-
- if ( n->type_id != NULL )
- {
- obj = rb_funcall( self, s_transfer, 2, rb_str_new2( n->type_id ), obj );
- }
- return obj;
-}
-
-/*
- * Set instance variables
- */
-VALUE
-syck_set_ivars(VALUE vars, VALUE obj)
-{
- VALUE ivname = rb_ary_entry( vars, 0 );
- char *ivn;
- StringValue( ivname );
- ivn = S_ALLOCA_N( char, RSTRING_LEN(ivname) + 2 );
- ivn[0] = '@';
- ivn[1] = '\0';
- strncat( ivn, RSTRING_PTR(ivname), RSTRING_LEN(ivname) );
- rb_iv_set( obj, ivn, rb_ary_entry( vars, 1 ) );
- return Qnil;
-}
-
-/*
- * YAML::Syck::Resolver#const_find
- */
-VALUE
-syck_const_find(VALUE const_name)
-{
- VALUE tclass = rb_cObject;
- VALUE tparts = rb_str_split( const_name, "::" );
- int i = 0;
- for ( i = 0; i < RARRAY_LEN(tparts); i++ ) {
- VALUE tpart = rb_to_id( rb_ary_entry( tparts, i ) );
- if ( !rb_const_defined( tclass, tpart ) ) return Qnil;
- tclass = rb_const_get( tclass, tpart );
- }
- return tclass;
-}
-
-/*
- * YAML::Syck::Resolver#transfer
- */
-VALUE
-syck_resolver_transfer(VALUE self, VALUE type, VALUE val)
-{
- if (NIL_P(type) || RSTRING_LEN(StringValue(type)) == 0)
- {
- type = rb_funcall( self, s_detect_implicit, 1, val );
- }
-
- if ( ! (NIL_P(type) || RSTRING_LEN(StringValue(type)) == 0) )
- {
- VALUE str_xprivate = rb_str_new2( "x-private" );
- VALUE colon = rb_str_new2( ":" );
- VALUE tags = rb_attr_get(self, s_tags);
- VALUE target_class = rb_hash_aref( tags, type );
- VALUE subclass = target_class;
- VALUE obj = Qnil;
-
- /*
- * Should no tag match exactly, check for subclass format
- */
- if ( NIL_P( target_class ) )
- {
- VALUE subclass_parts = rb_ary_new();
- VALUE parts = rb_str_split( type, ":" );
-
- while ( RARRAY_LEN(parts) > 1 )
- {
- VALUE partial;
- rb_ary_unshift( subclass_parts, rb_ary_pop( parts ) );
- partial = rb_ary_join( parts, colon );
- target_class = rb_hash_aref( tags, partial );
- if ( NIL_P( target_class ) )
- {
- rb_str_append( partial, colon );
- target_class = rb_hash_aref( tags, partial );
- }
-
- /*
- * Possible subclass found, see if it supports subclassing
- */
- if ( ! NIL_P( target_class ) )
- {
- subclass = target_class;
- if ( RARRAY_LEN(subclass_parts) > 0 && rb_respond_to( target_class, s_tag_subclasses ) &&
- RTEST( rb_funcall( target_class, s_tag_subclasses, 0 ) ) )
- {
- VALUE subclass_v;
- subclass = rb_ary_join( subclass_parts, colon );
- subclass = rb_funcall( target_class, s_tag_read_class, 1, subclass );
- subclass_v = syck_const_find( subclass );
-
- if ( subclass_v != Qnil )
- {
- subclass = subclass_v;
- }
- else if ( rb_cObject == target_class && subclass_v == Qnil )
- {
- target_class = cYObject;
- type = subclass;
- subclass = cYObject;
- }
- else /* workaround for SEGV. real fix please */
- {
- rb_raise( rb_eTypeError, "invalid subclass" );
- }
- }
- break;
- }
- }
- }
-
- /* rb_raise(rb_eTypeError, "invalid typing scheme: %s given",
- * scheme);
- */
-
- if ( rb_respond_to( target_class, s_call ) )
- {
- obj = rb_funcall( target_class, s_call, 2, type, val );
- }
- else
- {
- if ( rb_respond_to( target_class, s_yaml_new ) )
- {
- obj = rb_funcall( target_class, s_yaml_new, 3, subclass, type, val );
- }
- else if ( !NIL_P( target_class ) )
- {
- if ( subclass == rb_cBignum )
- {
- obj = rb_str2inum( val, 10 ); /* for yaml dumped by 1.8.3 [ruby-core:6159] */
- }
- else
- {
- obj = rb_obj_alloc( subclass );
- }
-
- if ( rb_respond_to( obj, s_yaml_initialize ) )
- {
- rb_funcall( obj, s_yaml_initialize, 2, type, val );
- }
- else if ( !NIL_P( obj ) && rb_obj_is_instance_of( val, rb_cHash ) )
- {
- rb_block_call( val, s_each, 0, 0, syck_set_ivars, obj );
- }
- }
- else
- {
- VALUE parts = rb_str_split( type, ":" );
- VALUE scheme = rb_ary_shift( parts );
- if ( rb_str_cmp( scheme, str_xprivate ) == 0 )
- {
- VALUE name = rb_ary_join( parts, colon );
- obj = rb_funcall( cPrivateType, s_new, 2, name, val );
- }
- else
- {
- VALUE domain = rb_ary_shift( parts );
- VALUE name = rb_ary_join( parts, colon );
- obj = rb_funcall( cDomainType, s_new, 3, domain, name, val );
- }
- }
- }
- val = obj;
- }
-
- return val;
-}
-
-/*
- * YAML::Syck::Resolver#tagurize
- */
-VALUE
-syck_resolver_tagurize(VALUE self, VALUE val)
-{
- VALUE tmp = rb_check_string_type(val);
-
- if ( !NIL_P(tmp) )
- {
- char *taguri = syck_type_id_to_uri( RSTRING_PTR(tmp) );
- val = rb_str_new2( taguri );
- S_FREE( taguri );
- }
-
- return val;
-}
-
-/*
- * YAML::Syck::DefaultResolver#detect_implicit
- */
-VALUE
-syck_defaultresolver_detect_implicit(VALUE self, VALUE val)
-{
- const char *type_id;
- VALUE tmp = rb_check_string_type(val);
-
- if ( !NIL_P(tmp) )
- {
- val = tmp;
- type_id = syck_match_implicit( RSTRING_PTR(val), RSTRING_LEN(val) );
- return rb_str_new2( type_id );
- }
-
- return rb_str_new2( "" );
-}
-
-/*
- * YAML::Syck::DefaultResolver#node_import
- */
-VALUE
-syck_defaultresolver_node_import(VALUE self, VALUE node)
-{
- SyckNode *n;
- VALUE obj;
- Data_Get_Struct( node, SyckNode, n );
- if ( !yaml_org_handler( n, &obj ) )
- {
- obj = rb_funcall( self, s_transfer, 2, rb_str_new2( n->type_id ), obj );
- }
- return obj;
-}
-
-/*
- * YAML::Syck::GenericResolver#node_import
- */
-VALUE
-syck_genericresolver_node_import(VALUE self, VALUE node)
-{
- SyckNode *n;
- int i = 0;
- VALUE t = Qnil, obj = Qnil, v = Qnil, style = Qnil;
- Data_Get_Struct(node, SyckNode, n);
-
- if ( n->type_id != NULL )
- {
- t = rb_str_new2(n->type_id);
- }
-
- switch (n->kind)
- {
- case syck_str_kind:
- {
- v = rb_str_new( n->data.str->ptr, n->data.str->len );
- rb_enc_associate(v, rb_utf8_encoding());
- if ( n->data.str->style == scalar_1quote )
- {
- style = sym_1quote;
- }
- else if ( n->data.str->style == scalar_2quote )
- {
- style = sym_2quote;
- }
- else if ( n->data.str->style == scalar_fold )
- {
- style = sym_fold;
- }
- else if ( n->data.str->style == scalar_literal )
- {
- style = sym_literal;
- }
- else if ( n->data.str->style == scalar_plain )
- {
- style = sym_plain;
- }
- obj = rb_funcall( cScalar, s_new, 3, t, v, style );
- }
- break;
-
- case syck_seq_kind:
- v = rb_ary_new2( syck_seq_count( n ) );
- for ( i = 0; i < syck_seq_count( n ); i++ )
- {
- rb_ary_store( v, i, syck_seq_read( n, i ) );
- }
- if ( n->data.list->style == seq_inline )
- {
- style = sym_inline;
- }
- obj = rb_funcall( cSeq, s_new, 3, t, v, style );
- rb_iv_set(obj, "@kind", sym_seq);
- break;
-
- case syck_map_kind:
- v = rb_hash_new();
- for ( i = 0; i < syck_map_count( n ); i++ )
- {
- rb_hash_aset( v, syck_map_read( n, map_key, i ), syck_map_read( n, map_value, i ) );
- }
- if ( n->data.pairs->style == map_inline )
- {
- style = sym_inline;
- }
- obj = rb_funcall( cMap, s_new, 3, t, v, style );
- rb_iv_set(obj, "@kind", sym_map);
- break;
- }
-
- return obj;
-}
-
-/*
- * YAML::Syck::BadAlias.initialize
- */
-VALUE
-syck_badalias_initialize(VALUE self, VALUE val)
-{
- rb_iv_set( self, "@name", val );
- return self;
-}
-
-/*
- * YAML::Syck::BadAlias.<=>
- */
-VALUE
-syck_badalias_cmp(VALUE alias1, VALUE alias2)
-{
- VALUE str1 = rb_ivar_get( alias1, s_name );
- VALUE str2 = rb_ivar_get( alias2, s_name );
- VALUE val = rb_funcall( str1, s_cmp, 1, str2 );
- return val;
-}
-
-/*
- * YAML::DomainType.initialize
- */
-VALUE
-syck_domaintype_initialize(VALUE self, VALUE domain, VALUE type_id, VALUE val)
-{
- rb_iv_set( self, "@domain", domain );
- rb_iv_set( self, "@type_id", type_id );
- rb_iv_set( self, "@value", val );
- return self;
-}
-
-/*
- * YAML::Object.initialize
- */
-VALUE
-syck_yobject_initialize(VALUE self, VALUE klass, VALUE ivars)
-{
- rb_iv_set( self, "@class", klass );
- rb_iv_set( self, "@ivars", ivars );
- return self;
-}
-
-/*
- * YAML::PrivateType.initialize
- */
-VALUE
-syck_privatetype_initialize(VALUE self, VALUE type_id, VALUE val)
-{
- rb_iv_set( self, "@type_id", type_id );
- rb_iv_set( self, "@value", val );
- return self;
-}
-
-/*
- * Mark node contents.
- */
-static void
-syck_node_mark(SyckNode *n)
-{
- int i;
- rb_gc_mark_maybe( n->id );
- switch ( n->kind )
- {
- case syck_seq_kind:
- for ( i = 0; i < n->data.list->idx; i++ )
- {
- rb_gc_mark( syck_seq_read( n, i ) );
- }
- break;
-
- case syck_map_kind:
- for ( i = 0; i < n->data.pairs->idx; i++ )
- {
- rb_gc_mark( syck_map_read( n, map_key, i ) );
- rb_gc_mark( syck_map_read( n, map_value, i ) );
- }
- break;
-
- case syck_str_kind:
- default:
- /* nothing */
- break;
- }
-#if 0 /* maybe needed */
- if ( n->shortcut ) syck_node_mark( n->shortcut ); /* caution: maybe cyclic */
-#endif
-}
-
-/*
- * YAML::Syck::Scalar.allocate
- */
-VALUE
-syck_scalar_alloc(VALUE class)
-{
- SyckNode *node = syck_alloc_str();
- VALUE obj = Data_Wrap_Struct( class, syck_node_mark, syck_free_node, node );
- node->id = obj;
- return obj;
-}
-
-/*
- * YAML::Syck::Scalar.initialize
- */
-VALUE
-syck_scalar_initialize(VALUE self, VALUE type_id, VALUE val, VALUE style)
-{
- rb_iv_set( self, "@kind", sym_scalar );
- rb_funcall( self, s_type_id_set, 1, type_id );
- rb_funcall( self, s_value_set, 1, val );
- rb_funcall( self, s_style_set, 1, style );
- return self;
-}
-
-/*
- * YAML::Syck::Scalar.style=
- */
-VALUE
-syck_scalar_style_set(VALUE self, VALUE style)
-{
- SyckNode *node;
- Data_Get_Struct( self, SyckNode, node );
-
- if ( NIL_P( style ) )
- {
- node->data.str->style = scalar_none;
- }
- else if ( style == sym_1quote )
- {
- node->data.str->style = scalar_1quote;
- }
- else if ( style == sym_2quote )
- {
- node->data.str->style = scalar_2quote;
- }
- else if ( style == sym_fold )
- {
- node->data.str->style = scalar_fold;
- }
- else if ( style == sym_literal )
- {
- node->data.str->style = scalar_literal;
- }
- else if ( style == sym_plain )
- {
- node->data.str->style = scalar_plain;
- }
-
- rb_iv_set( self, "@style", style );
- return self;
-}
-
-/*
- * YAML::Syck::Scalar.value=
- */
-VALUE
-syck_scalar_value_set(VALUE self, VALUE val)
-{
- SyckNode *node;
- Data_Get_Struct( self, SyckNode, node );
-
- StringValue( val );
- node->data.str->ptr = syck_strndup( RSTRING_PTR(val), RSTRING_LEN(val) );
- node->data.str->len = RSTRING_LEN(val);
- node->data.str->style = scalar_none;
-
- rb_iv_set( self, "@value", val );
- return val;
-}
-
-/*
- * YAML::Syck::Seq.allocate
- */
-VALUE
-syck_seq_alloc(VALUE class)
-{
- SyckNode *node;
- VALUE obj;
- node = syck_alloc_seq();
- obj = Data_Wrap_Struct( class, syck_node_mark, syck_free_node, node );
- node->id = obj;
- return obj;
-}
-
-/*
- * YAML::Syck::Seq.initialize
- */
-VALUE
-syck_seq_initialize(VALUE self, VALUE type_id, VALUE val, VALUE style)
-{
- SyckNode *node;
- Data_Get_Struct( self, SyckNode, node );
-
- rb_iv_set( self, "@kind", sym_seq );
- rb_funcall( self, s_type_id_set, 1, type_id );
- rb_funcall( self, s_value_set, 1, val );
- rb_funcall( self, s_style_set, 1, style );
- return self;
-}
-
-/*
- * YAML::Syck::Seq.value=
- */
-VALUE
-syck_seq_value_set(VALUE self, VALUE val)
-{
- SyckNode *node;
- Data_Get_Struct( self, SyckNode, node );
-
- val = rb_check_array_type( val );
- if ( !NIL_P( val ) ) {
- int i;
- syck_seq_empty( node );
- for ( i = 0; i < RARRAY_LEN( val ); i++ )
- {
- syck_seq_add( node, rb_ary_entry(val, i) );
- }
- }
-
- rb_iv_set( self, "@value", val );
- return val;
-}
-
-/*
- * YAML::Syck::Seq.add
- */
-VALUE
-syck_seq_add_m(VALUE self, VALUE val)
-{
- SyckNode *node;
- VALUE emitter = rb_ivar_get( self, s_emitter );
- Data_Get_Struct( self, SyckNode, node );
-
- if ( rb_respond_to( emitter, s_node_export ) ) {
- val = rb_funcall( emitter, s_node_export, 1, val );
- }
- syck_seq_add( node, val );
- rb_ary_push( rb_ivar_get( self, s_value ), val );
-
- return self;
-}
-
-/*
- * YAML::Syck::Seq.style=
- */
-VALUE
-syck_seq_style_set(VALUE self, VALUE style)
-{
- SyckNode *node;
- Data_Get_Struct( self, SyckNode, node );
-
- if ( style == sym_inline )
- {
- node->data.list->style = seq_inline;
- }
- else
- {
- node->data.list->style = seq_none;
- }
-
- rb_iv_set( self, "@style", style );
- return self;
-}
-
-/*
- * YAML::Syck::Map.allocate
- */
-VALUE
-syck_map_alloc(VALUE class)
-{
- SyckNode *node;
- VALUE obj;
- node = syck_alloc_map();
- obj = Data_Wrap_Struct( class, syck_node_mark, syck_free_node, node );
- node->id = obj;
- return obj;
-}
-
-/*
- * YAML::Syck::Map.initialize
- */
-VALUE
-syck_map_initialize(VALUE self, VALUE type_id, VALUE val, VALUE style)
-{
- SyckNode *node;
- Data_Get_Struct( self, SyckNode, node );
-
- if ( !NIL_P( val ) )
- {
- VALUE hsh = rb_check_convert_type(val, T_HASH, "Hash", "to_hash");
- VALUE keys;
- int i;
- if ( NIL_P(hsh) )
- {
- rb_raise( rb_eTypeError, "wrong argument type" );
- }
-
- keys = rb_funcall( hsh, s_keys, 0 );
- for ( i = 0; i < RARRAY_LEN(keys); i++ )
- {
- VALUE key = rb_ary_entry(keys, i);
- syck_map_add( node, key, rb_hash_aref(hsh, key) );
- }
- }
-
- rb_iv_set( self, "@kind", sym_seq );
- rb_funcall( self, s_type_id_set, 1, type_id );
- rb_funcall( self, s_value_set, 1, val );
- rb_funcall( self, s_style_set, 1, style );
- return self;
-}
-
-/*
- * YAML::Syck::Map.value=
- */
-VALUE
-syck_map_value_set(VALUE self, VALUE val)
-{
- SyckNode *node;
- Data_Get_Struct( self, SyckNode, node );
-
- if ( !NIL_P( val ) )
- {
- VALUE hsh = rb_check_convert_type(val, T_HASH, "Hash", "to_hash");
- VALUE keys;
- int i;
- if ( NIL_P(hsh) )
- {
- rb_raise( rb_eTypeError, "wrong argument type" );
- }
-
- syck_map_empty( node );
- keys = rb_funcall( hsh, s_keys, 0 );
- for ( i = 0; i < RARRAY_LEN(keys); i++ )
- {
- VALUE key = rb_ary_entry(keys, i);
- syck_map_add( node, key, rb_hash_aref(hsh, key) );
- }
- }
-
- rb_iv_set( self, "@value", val );
- return val;
-}
-
-/*
- * YAML::Syck::Map.add
- */
-VALUE
-syck_map_add_m(VALUE self, VALUE key, VALUE val)
-{
- SyckNode *node;
- VALUE emitter = rb_ivar_get( self, s_emitter );
- Data_Get_Struct( self, SyckNode, node );
-
- if ( rb_respond_to( emitter, s_node_export ) ) {
- key = rb_funcall( emitter, s_node_export, 1, key );
- val = rb_funcall( emitter, s_node_export, 1, val );
- }
- syck_map_add( node, key, val );
- rb_hash_aset( rb_ivar_get( self, s_value ), key, val );
-
- return self;
-}
-
-/*
- * YAML::Syck::Map.style=
- */
-VALUE
-syck_map_style_set(VALUE self, VALUE style)
-{
- SyckNode *node;
- Data_Get_Struct( self, SyckNode, node );
-
- if ( style == sym_inline )
- {
- node->data.pairs->style = map_inline;
- }
- else
- {
- node->data.pairs->style = map_none;
- }
-
- rb_iv_set( self, "@style", style );
- return self;
-}
-
-#if 0
-/*
- * Cloning method for all node types
- */
-VALUE
-syck_node_init_copy(VALUE copy, VALUE orig)
-{
- SyckNode *copy_n;
- SyckNode *orig_n;
-
- if ( copy == orig )
- return copy;
-
- if ( TYPE( orig ) != T_DATA )
- {
- rb_raise( rb_eTypeError, "wrong argument type" );
- }
-
- Data_Get_Struct( orig, SyckNode, orig_n );
- Data_Get_Struct( copy, SyckNode, copy_n );
- MEMCPY( copy_n, orig_n, SyckNode, 1 );
- return copy;
-}
-#endif
-
-/*
- * YAML::Syck::Node#type_id=
- */
-VALUE
-syck_node_type_id_set(VALUE self, VALUE type_id)
-{
- SyckNode *node;
- Data_Get_Struct( self, SyckNode, node );
-
- S_FREE( node->type_id );
-
- if ( !NIL_P( type_id ) ) {
- StringValue( type_id );
- node->type_id = syck_strndup( RSTRING_PTR(type_id), RSTRING_LEN(type_id) );
- }
-
- rb_iv_set( self, "@type_id", type_id );
- return type_id;
-}
-
-/*
- * YAML::Syck::Node.transform
- */
-VALUE
-syck_node_transform(VALUE self)
-{
- VALUE t;
- SyckNode *n = NULL;
- SyckNode *orig_n;
- Data_Get_Struct(self, SyckNode, orig_n);
- t = Data_Wrap_Struct( cNode, syck_node_mark, syck_free_node, 0 );
-
- switch (orig_n->kind)
- {
- case syck_map_kind:
- {
- int i;
- DATA_PTR(t) = n = syck_alloc_map();
- for ( i = 0; i < orig_n->data.pairs->idx; i++ )
- {
- syck_map_add( n, rb_funcall( syck_map_read( orig_n, map_key, i ), s_transform, 0 ),
- rb_funcall( syck_map_read( orig_n, map_value, i ), s_transform, 0 ) );
- }
- }
- break;
-
- case syck_seq_kind:
- {
- int i;
- DATA_PTR(t) = n = syck_alloc_seq();
- for ( i = 0; i < orig_n->data.list->idx; i++ )
- {
- syck_seq_add( n, rb_funcall( syck_seq_read( orig_n, i ), s_transform, 0 ) );
- }
- }
- break;
-
- case syck_str_kind:
- DATA_PTR(t) = n = syck_new_str2( orig_n->data.str->ptr, orig_n->data.str->len, orig_n->data.str->style );
- break;
- }
-
- if ( orig_n->type_id != NULL )
- {
- n->type_id = syck_strndup( orig_n->type_id, strlen( orig_n->type_id ) );
- }
- if ( orig_n->anchor != NULL )
- {
- n->anchor = syck_strndup( orig_n->anchor, strlen( orig_n->anchor ) );
- }
- n->id = t;
- return rb_funcall( oDefaultResolver, s_node_import, 1, t );
-}
-
-/*
- * Emitter callback: assembles YAML document events from
- * Ruby symbols. This is a brilliant way to do it.
- * No one could possibly object.
- */
-void
-rb_syck_emitter_handler(SyckEmitter *e, st_data_t data)
-{
- SyckNode *n;
- Data_Get_Struct((VALUE)data, SyckNode, n);
-
- switch (n->kind)
- {
- case syck_map_kind:
- {
- int i;
- syck_emit_map( e, n->type_id, n->data.pairs->style );
- for ( i = 0; i < n->data.pairs->idx; i++ )
- {
- syck_emit_item( e, syck_map_read( n, map_key, i ) );
- syck_emit_item( e, syck_map_read( n, map_value, i ) );
- }
- syck_emit_end( e );
- }
- break;
-
- case syck_seq_kind:
- {
- int i;
- syck_emit_seq( e, n->type_id, n->data.list->style );
- for ( i = 0; i < n->data.list->idx; i++ )
- {
- syck_emit_item( e, syck_seq_read( n, i ) );
- }
- syck_emit_end( e );
- }
- break;
-
- case syck_str_kind:
- {
- syck_emit_scalar( e, n->type_id, n->data.str->style, 0, 0, 0, n->data.str->ptr, n->data.str->len );
- }
- break;
- }
-}
-
-/*
- * Handle output from the emitter
- */
-void
-rb_syck_output_handler(SyckEmitter * emitter, char *str, long len)
-{
- struct emitter_xtra *bonus = (struct emitter_xtra *)emitter->bonus;
- VALUE dest = bonus->port;
- if (TYPE(dest) == T_STRING) {
- rb_str_cat( dest, str, len );
- } else {
- rb_io_write( dest, rb_str_new( str, len ) );
- }
-}
-
-/*
- * Helper function for marking nodes in the anchor
- * symbol table.
- */
-void
-syck_out_mark(VALUE emitter, VALUE node)
-{
- SyckEmitter *emitterPtr;
- struct emitter_xtra *bonus;
- Data_Get_Struct(emitter, SyckEmitter, emitterPtr);
- bonus = (struct emitter_xtra *)emitterPtr->bonus;
- rb_ivar_set( node, s_emitter, emitter );
- /* syck_emitter_mark_node( emitterPtr, (st_data_t)node ); */
- if ( !NIL_P( bonus->oid ) ) {
- rb_hash_aset( bonus->data, bonus->oid, node );
- }
-}
-
-/*
- * Mark emitter values.
- */
-static void
-syck_mark_emitter(SyckEmitter *emitter)
-{
- struct emitter_xtra *bonus = (struct emitter_xtra *)emitter->bonus;
- rb_gc_mark( bonus->oid );
- rb_gc_mark( bonus->data );
- rb_gc_mark( bonus->port );
-}
-
-/*
- * Free the emitter and any bonus attachment.
- */
-void
-rb_syck_free_emitter(SyckEmitter *e)
-{
- S_FREE( e->bonus );
- syck_free_emitter(e);
-}
-
-/*
- * YAML::Syck::Emitter.allocate
- */
-VALUE syck_emitter_s_alloc _((VALUE));
-VALUE
-syck_emitter_s_alloc(VALUE class)
-{
- VALUE pobj;
- SyckEmitter *emitter = syck_new_emitter();
-
- emitter->bonus = S_ALLOC( struct emitter_xtra );
- S_MEMZERO( emitter->bonus, struct emitter_xtra, 1 );
-
- pobj = Data_Wrap_Struct( class, syck_mark_emitter, rb_syck_free_emitter, emitter );
- syck_emitter_handler( emitter, rb_syck_emitter_handler );
- syck_output_handler( emitter, rb_syck_output_handler );
-
- rb_ivar_set( pobj, s_out, rb_funcall( cOut, s_new, 1, pobj ) );
- return pobj;
-}
-
-static VALUE
-id_hash_new(void)
-{
- VALUE hash;
- hash = rb_hash_new();
- rb_funcall(hash, rb_intern("compare_by_identity"), 0);
- return hash;
-}
-
-/*
- * YAML::Syck::Emitter.reset( options )
- */
-VALUE
-syck_emitter_reset(int argc, VALUE *argv, VALUE self)
-{
- VALUE options, tmp;
- SyckEmitter *emitter;
- struct emitter_xtra *bonus;
-
- Data_Get_Struct(self, SyckEmitter, emitter);
- bonus = (struct emitter_xtra *)emitter->bonus;
-
- bonus->oid = Qnil;
- bonus->port = rb_str_new2( "" );
- bonus->data = id_hash_new();
-
- if (rb_scan_args(argc, argv, "01", &options) == 0)
- {
- options = rb_hash_new();
- rb_ivar_set(self, s_options, options);
- }
- else if ( !NIL_P(tmp = rb_check_string_type(options)) )
- {
- bonus->port = tmp;
- }
- else if ( rb_respond_to( options, s_write ) )
- {
- bonus->port = options;
- }
- else
- {
- Check_Type(options, T_HASH);
- rb_ivar_set(self, s_options, options);
- }
-
- emitter->headless = 0;
- rb_ivar_set(self, s_level, INT2FIX(0));
- rb_ivar_set(self, s_resolver, Qnil);
- return self;
-}
-
-/*
- * YAML::Syck::Emitter.emit( object_id ) { |out| ... }
- */
-VALUE
-syck_emitter_emit(int argc, VALUE *argv, VALUE self)
-{
- VALUE oid, proc;
- SyckEmitter *emitter;
- struct emitter_xtra *bonus;
- SYMID symple;
- int level = FIX2INT(rb_ivar_get(self, s_level)) + 1;
- rb_ivar_set(self, s_level, INT2FIX(level));
-
- rb_scan_args(argc, argv, "1&", &oid, &proc);
- Data_Get_Struct(self, SyckEmitter, emitter);
- bonus = (struct emitter_xtra *)emitter->bonus;
-
- /* Calculate anchors, normalize nodes, build a simpler symbol table */
- bonus->oid = oid;
- if ( !NIL_P( oid ) && RTEST( rb_funcall( bonus->data, s_haskey, 1, oid ) ) ) {
- symple = rb_hash_aref( bonus->data, oid );
- } else {
- symple = rb_funcall( proc, s_call, 1, rb_ivar_get( self, s_out ) );
- }
- syck_emitter_mark_node( emitter, (st_data_t)symple );
-
- /* Second pass, build emitted string */
- level -= 1;
- rb_ivar_set(self, s_level, INT2FIX(level));
- if ( level == 0 )
- {
- syck_emit(emitter, (st_data_t)symple);
- syck_emitter_flush(emitter, 0);
-
- return bonus->port;
- }
-
- return symple;
-}
-
-/*
- * YAML::Syck::Emitter#node_export
- */
-VALUE
-syck_emitter_node_export(VALUE self, VALUE node)
-{
- return rb_funcall( node, s_to_yaml, 1, self );
-}
-
-/*
- * YAML::Syck::Emitter#set_resolver
- */
-VALUE
-syck_emitter_set_resolver(VALUE self, VALUE resolver)
-{
- rb_ivar_set( self, s_resolver, resolver );
- return self;
-}
-
-/*
- * YAML::Syck::Out::initialize
- */
-VALUE
-syck_out_initialize(VALUE self, VALUE emitter)
-{
- rb_ivar_set( self, s_emitter, emitter );
- return self;
-}
-
-/*
- * YAML::Syck::Out::map
- */
-VALUE
-syck_out_map(int argc, VALUE *argv, VALUE self)
-{
- VALUE type_id, style, map;
- if (rb_scan_args(argc, argv, "11", &type_id, &style) == 1) {
- style = Qnil;
- }
- map = rb_funcall( cMap, s_new, 3, type_id, rb_hash_new(), style );
- syck_out_mark( rb_ivar_get( self, s_emitter ), map );
- rb_yield( map );
- return map;
-}
-
-/*
- * YAML::Syck::Out::seq
- */
-VALUE
-syck_out_seq(int argc, VALUE *argv, VALUE self)
-{
- VALUE type_id, style, seq;
- if (rb_scan_args(argc, argv, "11", &type_id, &style) == 1) {
- style = Qnil;
- }
- seq = rb_funcall( cSeq, s_new, 3, type_id, rb_ary_new(), style );
- syck_out_mark( rb_ivar_get( self, s_emitter ), seq );
- rb_yield( seq );
- return seq;
-}
-
-/*
- * YAML::Syck::Out::scalar
-syck_out_scalar( self, type_id, str, style )
- VALUE self, type_id, str, style;
- */
-VALUE
-syck_out_scalar(int argc, VALUE *argv, VALUE self)
-{
- VALUE type_id, str, style, scalar;
- rb_scan_args(argc, argv, "21", &type_id, &str, &style);
- scalar = rb_funcall( cScalar, s_new, 3, type_id, str, style );
- syck_out_mark( rb_ivar_get( self, s_emitter ), scalar );
- return scalar;
-}
-
-/*
- * Initialize Syck extension
- */
-void
-Init_syck()
-{
- VALUE rb_syck = rb_define_module_under( rb_cObject, "Syck" );
- rb_define_module_function( rb_syck, "compile", rb_syck_compile, 1 );
-
- /*
- * Global symbols
- */
- s_new = rb_intern("new");
- s_utc = rb_intern("utc");
- s_at = rb_intern("at");
- s_to_f = rb_intern("to_f");
- s_to_i = rb_intern("to_i");
- s_read = rb_intern("read");
- s_binmode = rb_intern("binmode");
- s_transfer = rb_intern("transfer");
- s_call = rb_intern("call");
- s_cmp = rb_intern("<=>");
- s_intern = rb_intern("intern");
- s_update = rb_intern("update");
- s_detect_implicit = rb_intern("detect_implicit");
- s_dup = rb_intern("dup");
- s_default_set = rb_intern("default=");
- s_match = rb_intern("match");
- s_push = rb_intern("push");
- s_haskey = rb_intern("has_key?");
- s_keys = rb_intern("keys");
- s_node_import = rb_intern("node_import");
- s_tr_bang = rb_intern("tr!");
- s_unpack = rb_intern("unpack");
- s_write = rb_intern("write");
- s_tag_read_class = rb_intern( "yaml_tag_read_class" );
- s_tag_subclasses = rb_intern( "yaml_tag_subclasses?" );
- s_emitter = rb_intern( "emitter" );
- s_set_resolver = rb_intern( "set_resolver" );
- s_node_export = rb_intern( "node_export" );
- s_to_yaml = rb_intern( "to_yaml" );
- s_transform = rb_intern( "transform" );
- s_yaml_new = rb_intern("yaml_new");
- s_yaml_initialize = rb_intern("yaml_initialize");
- s_each = rb_intern("each");
- s_parse = rb_intern("parse");
-
- s_tags = rb_intern("@tags");
- s_name = rb_intern("@name");
- s_options = rb_intern("@options");
- s_kind = rb_intern("@kind");
- s_type_id = rb_intern("@type_id");
- s_type_id_set = rb_intern("type_id=");
- s_resolver = rb_intern("@resolver");
- s_level = rb_intern( "@level" );
- s_style = rb_intern("@style");
- s_style_set = rb_intern("style=");
- s_value = rb_intern("@value");
- s_value_set = rb_intern("value=");
- s_out = rb_intern("@out");
- s_input = rb_intern("@input");
-
- sym_model = ID2SYM(rb_intern("Model"));
- sym_generic = ID2SYM(rb_intern("Generic"));
- sym_bytecode = ID2SYM(rb_intern("bytecode"));
- sym_map = ID2SYM(rb_intern("map"));
- sym_scalar = ID2SYM(rb_intern("scalar"));
- sym_seq = ID2SYM(rb_intern("seq"));
- sym_1quote = ID2SYM(rb_intern("quote1"));
- sym_2quote = ID2SYM(rb_intern("quote2"));
- sym_fold = ID2SYM(rb_intern("fold"));
- sym_literal = ID2SYM(rb_intern("literal"));
- sym_plain = ID2SYM(rb_intern("plain"));
- sym_inline = ID2SYM(rb_intern("inline"));
-
- /*
- * Define YAML::Syck::Resolver class
- */
- cResolver = rb_define_class_under( rb_syck, "Resolver", rb_cObject );
- rb_define_attr( cResolver, "tags", 1, 1 );
- rb_define_method( cResolver, "initialize", syck_resolver_initialize, 0 );
- rb_define_method( cResolver, "add_type", syck_resolver_add_type, 2 );
- rb_define_method( cResolver, "use_types_at", syck_resolver_use_types_at, 1 );
- rb_define_method( cResolver, "detect_implicit", syck_resolver_detect_implicit, 1 );
- rb_define_method( cResolver, "transfer", syck_resolver_transfer, 2 );
- rb_define_method( cResolver, "node_import", syck_resolver_node_import, 1 );
- rb_define_method( cResolver, "tagurize", syck_resolver_tagurize, 1 );
-
- rb_global_variable( &oDefaultResolver );
- oDefaultResolver = rb_funcall( cResolver, rb_intern( "new" ), 0 );
- rb_define_singleton_method( oDefaultResolver, "node_import", syck_defaultresolver_node_import, 1 );
- rb_define_singleton_method( oDefaultResolver, "detect_implicit", syck_defaultresolver_detect_implicit, 1 );
- rb_define_const( rb_syck, "DefaultResolver", oDefaultResolver );
- rb_global_variable( &oGenericResolver );
- oGenericResolver = rb_funcall( cResolver, rb_intern( "new" ), 0 );
- rb_define_singleton_method( oGenericResolver, "node_import", syck_genericresolver_node_import, 1 );
- rb_define_const( rb_syck, "GenericResolver", oGenericResolver );
-
- /*
- * Define YAML::Syck::Parser class
- */
- cParser = rb_define_class_under( rb_syck, "Parser", rb_cObject );
- rb_define_attr( cParser, "options", 1, 1 );
- rb_define_attr( cParser, "resolver", 1, 1 );
- rb_define_attr( cParser, "input", 1, 1 );
- rb_define_alloc_func( cParser, syck_parser_s_alloc );
- rb_define_method(cParser, "initialize", syck_parser_initialize, -1 );
- rb_define_method(cParser, "bufsize=", syck_parser_bufsize_set, 1 );
- rb_define_method(cParser, "bufsize", syck_parser_bufsize_get, 0 );
- rb_define_method(cParser, "load", syck_parser_load, -1);
- rb_define_method(cParser, "load_documents", syck_parser_load_documents, -1);
- rb_define_method(cParser, "set_resolver", syck_parser_set_resolver, 1);
-
- /*
- * Define YAML::Syck::Node class
- */
- cNode = rb_define_class_under( rb_syck, "Node", rb_cObject );
- rb_undef( cNode, rb_intern("initialize_copy") );
- rb_define_attr( cNode, "emitter", 1, 1 );
- rb_define_attr( cNode, "resolver", 1, 1 );
- rb_define_attr( cNode, "kind", 1, 0 );
- rb_define_attr( cNode, "type_id", 1, 0 );
- rb_define_attr( cNode, "value", 1, 0 );
- rb_define_method( cNode, "type_id=", syck_node_type_id_set, 1 );
- rb_define_method( cNode, "transform", syck_node_transform, 0);
-
- /*
- * Define YAML::Syck::Scalar, YAML::Syck::Seq, YAML::Syck::Map --
- * all are the publicly usable variants of YAML::Syck::Node
- */
- cScalar = rb_define_class_under( rb_syck, "Scalar", cNode );
- rb_define_alloc_func( cScalar, syck_scalar_alloc );
- rb_define_method( cScalar, "initialize", syck_scalar_initialize, 3 );
- rb_define_method( cScalar, "value=", syck_scalar_value_set, 1 );
- rb_define_method( cScalar, "style=", syck_scalar_style_set, 1 );
- cSeq = rb_define_class_under( rb_syck, "Seq", cNode );
- rb_define_alloc_func( cSeq, syck_seq_alloc );
- rb_define_method( cSeq, "initialize", syck_seq_initialize, 3 );
- rb_define_method( cSeq, "value=", syck_seq_value_set, 1 );
- rb_define_method( cSeq, "add", syck_seq_add_m, 1 );
- rb_define_method( cSeq, "style=", syck_seq_style_set, 1 );
- cMap = rb_define_class_under( rb_syck, "Map", cNode );
- rb_define_alloc_func( cMap, syck_map_alloc );
- rb_define_method( cMap, "initialize", syck_map_initialize, 3 );
- rb_define_method( cMap, "value=", syck_map_value_set, 1 );
- rb_define_method( cMap, "add", syck_map_add_m, 2 );
- rb_define_method( cMap, "style=", syck_map_style_set, 1 );
-
- /*
- * Define YAML::PrivateType class
- */
- cPrivateType = rb_define_class_under( rb_syck, "PrivateType", rb_cObject );
- rb_define_attr( cPrivateType, "type_id", 1, 1 );
- rb_define_attr( cPrivateType, "value", 1, 1 );
- rb_define_method( cPrivateType, "initialize", syck_privatetype_initialize, 2);
-
- /*
- * Define YAML::DomainType class
- */
- cDomainType = rb_define_class_under( rb_syck, "DomainType", rb_cObject );
- rb_define_attr( cDomainType, "domain", 1, 1 );
- rb_define_attr( cDomainType, "type_id", 1, 1 );
- rb_define_attr( cDomainType, "value", 1, 1 );
- rb_define_method( cDomainType, "initialize", syck_domaintype_initialize, 3);
-
- /*
- * Define YAML::Object class
- */
- cYObject = rb_define_class_under( rb_syck, "Object", rb_cObject );
- rb_define_attr( cYObject, "class", 1, 1 );
- rb_define_attr( cYObject, "ivars", 1, 1 );
- rb_define_method( cYObject, "initialize", syck_yobject_initialize, 2);
- rb_define_method( cYObject, "yaml_initialize", syck_yobject_initialize, 2);
-
- /*
- * Define YAML::Syck::BadAlias class
- */
- cBadAlias = rb_define_class_under( rb_syck, "BadAlias", rb_cObject );
- rb_define_attr( cBadAlias, "name", 1, 1 );
- rb_define_method( cBadAlias, "initialize", syck_badalias_initialize, 1);
- rb_define_method( cBadAlias, "<=>", syck_badalias_cmp, 1);
- rb_include_module( cBadAlias, rb_const_get( rb_cObject, rb_intern("Comparable") ) );
-
- /*
- * Define YAML::Syck::MergeKey class
- */
- cMergeKey = rb_define_class_under( rb_syck, "MergeKey", rb_cObject );
-
- /*
- * Define YAML::Syck::DefaultKey class
- */
- cDefaultKey = rb_define_class_under( rb_syck, "DefaultKey", rb_cObject );
-
- /*
- * Define YAML::Syck::Out classes
- */
- cOut = rb_define_class_under( rb_syck, "Out", rb_cObject );
- rb_define_attr( cOut, "emitter", 1, 1 );
- rb_define_method( cOut, "initialize", syck_out_initialize, 1 );
- rb_define_method( cOut, "map", syck_out_map, -1 );
- rb_define_method( cOut, "seq", syck_out_seq, -1 );
- rb_define_method( cOut, "scalar", syck_out_scalar, -1 );
-
- /*
- * Define YAML::Syck::Emitter class
- */
- cEmitter = rb_define_class_under( rb_syck, "Emitter", rb_cObject );
- rb_define_attr( cEmitter, "level", 1, 1 );
- rb_define_alloc_func( cEmitter, syck_emitter_s_alloc );
- rb_define_method( cEmitter, "initialize", syck_emitter_reset, -1 );
- rb_define_method( cEmitter, "reset", syck_emitter_reset, -1 );
- rb_define_method( cEmitter, "emit", syck_emitter_emit, -1 );
- rb_define_method( cEmitter, "set_resolver", syck_emitter_set_resolver, 1);
- rb_define_method( cEmitter, "node_export", syck_emitter_node_export, 1);
-}
-
diff --git a/ext/syck/syck.c b/ext/syck/syck.c
deleted file mode 100644
index 94e3992d3f..0000000000
--- a/ext/syck/syck.c
+++ /dev/null
@@ -1,524 +0,0 @@
-/*
- * syck.c
- *
- * $Author$
- *
- * Copyright (C) 2003 why the lucky stiff
- */
-#include "ruby/ruby.h"
-
-#include <stdio.h>
-#include <string.h>
-
-#include "syck.h"
-
-void syck_parser_pop_level( SyckParser * );
-
-/*
- * Custom assert
- */
-void
-syck_assert( const char *file_name, unsigned line_num, const char *expr )
-{
- fflush( NULL );
- fprintf( stderr, "\nAssertion failed: %s, line %u: %s\n",
- file_name, line_num, expr );
- fflush( stderr );
- abort();
-}
-
-/*
- * Allocates and copies a string
- */
-char *
-syck_strndup( const char *buf, long len )
-{
- char *new = S_ALLOC_N( char, len + 1 );
- S_MEMZERO( new, char, len + 1 );
- S_MEMCPY( new, buf, char, len );
- return new;
-}
-
-/*
- * Default FILE IO function
- */
-long
-syck_io_file_read( char *buf, SyckIoFile *file, long max_size, long skip )
-{
- long len = 0;
-
- ASSERT( file != NULL );
-
- max_size -= skip;
- len = fread( buf + skip, sizeof( char ), max_size, file->ptr );
- len += skip;
- buf[len] = '\0';
-
- return len;
-}
-
-/*
- * Default string IO function
- */
-long
-syck_io_str_read( char *buf, SyckIoStr *str, long max_size, long skip )
-{
- char *beg;
- long len = 0;
-
- ASSERT( str != NULL );
- beg = str->ptr;
- if ( max_size >= 0 )
- {
- max_size -= skip;
- if ( max_size <= 0 ) max_size = 0;
- else str->ptr += max_size;
-
- if ( str->ptr > str->end )
- {
- str->ptr = str->end;
- }
- }
- else
- {
- /* Use exact string length */
- while ( str->ptr < str->end ) {
- if (*(str->ptr++) == '\n') break;
- }
- }
- if ( beg < str->ptr )
- {
- len = ( str->ptr - beg );
- S_MEMCPY( buf + skip, beg, char, len );
- }
- len += skip;
- buf[len] = '\0';
-
- return len;
-}
-
-void
-syck_parser_reset_levels( SyckParser *p )
-{
- while ( p->lvl_idx > 1 )
- {
- syck_parser_pop_level( p );
- }
-
- if ( p->lvl_idx < 1 )
- {
- p->lvl_idx = 1;
- p->levels[0].spaces = -1;
- p->levels[0].ncount = 0;
- p->levels[0].domain = syck_strndup( "", 0 );
- }
- p->levels[0].status = syck_lvl_header;
-}
-
-void
-syck_parser_reset_cursor( SyckParser *p )
-{
- if ( p->buffer == NULL )
- {
- p->buffer = S_ALLOC_N( char, p->bufsize );
- S_MEMZERO( p->buffer, char, p->bufsize );
- }
- p->buffer[0] = '\0';
-
- p->cursor = NULL;
- p->lineptr = NULL;
- p->linectptr = NULL;
- p->token = NULL;
- p->toktmp = NULL;
- p->marker = NULL;
- p->limit = NULL;
-
- p->root = 0;
- p->root_on_error = 0;
- p->linect = 0;
- p->eof = 0;
- p->last_token = 0;
- p->force_token = 0;
-}
-
-/*
- * Value to return on a parse error
- */
-void
-syck_parser_set_root_on_error( SyckParser *p, SYMID roer )
-{
- p->root_on_error = roer;
-}
-
-/*
- * Allocate the parser
- */
-SyckParser *
-syck_new_parser(void)
-{
- SyckParser *p;
- p = S_ALLOC( SyckParser );
- S_MEMZERO( p, SyckParser, 1 );
- p->lvl_capa = ALLOC_CT;
- p->levels = S_ALLOC_N( SyckLevel, p->lvl_capa );
- p->input_type = syck_yaml_utf8;
- p->io_type = syck_io_str;
- p->io.str = NULL;
- p->syms = NULL;
- p->anchors = NULL;
- p->bad_anchors = NULL;
- p->implicit_typing = 1;
- p->taguri_expansion = 0;
- p->bufsize = SYCK_BUFFERSIZE;
- p->buffer = NULL;
- p->lvl_idx = 0;
- syck_parser_reset_levels( p );
- return p;
-}
-
-int
-syck_add_sym( SyckParser *p, void *data )
-{
- SYMID id = 0;
- if ( p->syms == NULL )
- {
- p->syms = st_init_numtable();
- }
- id = p->syms->num_entries + 1;
- st_insert( p->syms, id, (st_data_t)data );
- return (int)id;
-}
-
-int
-syck_lookup_sym( SyckParser *p, SYMID id, void **datap )
-{
- st_data_t data;
- int ret;
- if ( p->syms == NULL ) return 0;
- ret = st_lookup( p->syms, id, &data );
- if(ret) *datap = (void *)data;
- return ret;
-}
-
-int
-syck_st_free_nodes( char *key, SyckNode *n, char *arg )
-{
- if ( n != (void *)1 ) syck_free_node( n );
- n = NULL;
- return ST_CONTINUE;
-}
-
-void
-syck_st_free( SyckParser *p )
-{
- /*
- * Free the anchor tables
- */
- if ( p->anchors != NULL )
- {
- st_foreach( p->anchors, syck_st_free_nodes, 0 );
- st_free_table( p->anchors );
- p->anchors = NULL;
- }
-
- if ( p->bad_anchors != NULL )
- {
- st_foreach( p->bad_anchors, syck_st_free_nodes, 0 );
- st_free_table( p->bad_anchors );
- p->bad_anchors = NULL;
- }
-}
-
-typedef struct {
- long hash;
- char *buffer;
- long length;
- long remaining;
- int printed;
-} bytestring_t;
-
-int
-syck_st_free_syms( void *key, bytestring_t *sav, void *dummy )
-{
- S_FREE(sav->buffer);
- S_FREE(sav);
- return ST_CONTINUE;
-}
-
-void
-syck_free_parser( SyckParser *p )
-{
- /*
- * Free the adhoc symbol table
- */
- if ( p->syms != NULL )
- {
- st_foreach( p->syms, syck_st_free_syms, 0 );
- st_free_table( p->syms );
- p->syms = NULL;
- }
-
- /*
- * Free tables, levels
- */
- syck_st_free( p );
- syck_parser_reset_levels( p );
- S_FREE( p->levels[0].domain );
- S_FREE( p->levels );
-
- if ( p->buffer != NULL )
- {
- S_FREE( p->buffer );
- }
- free_any_io( p );
- S_FREE( p );
-}
-
-void
-syck_parser_handler( SyckParser *p, SyckNodeHandler hdlr )
-{
- ASSERT( p != NULL );
- p->handler = hdlr;
-}
-
-void
-syck_parser_implicit_typing( SyckParser *p, int flag )
-{
- p->implicit_typing = ( flag == 0 ? 0 : 1 );
-}
-
-void
-syck_parser_taguri_expansion( SyckParser *p, int flag )
-{
- p->taguri_expansion = ( flag == 0 ? 0 : 1 );
-}
-
-void
-syck_parser_error_handler( SyckParser *p, SyckErrorHandler hdlr )
-{
- ASSERT( p != NULL );
- p->error_handler = hdlr;
-}
-
-void
-syck_parser_bad_anchor_handler( SyckParser *p, SyckBadAnchorHandler hdlr )
-{
- ASSERT( p != NULL );
- p->bad_anchor_handler = hdlr;
-}
-
-void
-syck_parser_set_input_type( SyckParser *p, enum syck_parser_input input_type )
-{
- ASSERT( p != NULL );
- p->input_type = input_type;
-}
-
-void
-syck_parser_file( SyckParser *p, FILE *fp, SyckIoFileRead read )
-{
- ASSERT( p != NULL );
- free_any_io( p );
- syck_parser_reset_cursor( p );
- p->io_type = syck_io_file;
- p->io.file = S_ALLOC( SyckIoFile );
- p->io.file->ptr = fp;
- if ( read != NULL )
- {
- p->io.file->read = read;
- }
- else
- {
- p->io.file->read = syck_io_file_read;
- }
-}
-
-void
-syck_parser_str( SyckParser *p, char *ptr, long len, SyckIoStrRead read )
-{
- ASSERT( p != NULL );
- free_any_io( p );
- syck_parser_reset_cursor( p );
- p->io_type = syck_io_str;
- p->io.str = S_ALLOC( SyckIoStr );
- p->io.str->beg = ptr;
- p->io.str->ptr = ptr;
- p->io.str->end = ptr + len;
- if ( read != NULL )
- {
- p->io.str->read = read;
- }
- else
- {
- p->io.str->read = syck_io_str_read;
- }
-}
-
-void
-syck_parser_str_auto( SyckParser *p, char *ptr, SyckIoStrRead read )
-{
- syck_parser_str( p, ptr, strlen( ptr ), read );
-}
-
-SyckLevel *
-syck_parser_current_level( SyckParser *p )
-{
- return &p->levels[p->lvl_idx-1];
-}
-
-void
-syck_parser_pop_level( SyckParser *p )
-{
- ASSERT( p != NULL );
-
- /* The root level should never be popped */
- if ( p->lvl_idx <= 1 ) return;
-
- p->lvl_idx -= 1;
- free( p->levels[p->lvl_idx].domain );
-}
-
-void
-syck_parser_add_level( SyckParser *p, int len, enum syck_level_status status )
-{
- ASSERT( p != NULL );
- if ( p->lvl_idx + 1 > p->lvl_capa )
- {
- p->lvl_capa += ALLOC_CT;
- S_REALLOC_N( p->levels, SyckLevel, p->lvl_capa );
- }
-
- ASSERT( len > p->levels[p->lvl_idx-1].spaces );
- p->levels[p->lvl_idx].spaces = len;
- p->levels[p->lvl_idx].ncount = 0;
- p->levels[p->lvl_idx].domain = syck_strndup( p->levels[p->lvl_idx-1].domain, strlen( p->levels[p->lvl_idx-1].domain ) );
- p->levels[p->lvl_idx].status = status;
- p->lvl_idx += 1;
-}
-
-void
-free_any_io( SyckParser *p )
-{
- ASSERT( p != NULL );
- switch ( p->io_type )
- {
- case syck_io_str:
- if ( p->io.str != NULL )
- {
- S_FREE( p->io.str );
- p->io.str = NULL;
- }
- break;
-
- case syck_io_file:
- if ( p->io.file != NULL )
- {
- S_FREE( p->io.file );
- p->io.file = NULL;
- }
- break;
- }
-}
-
-long
-syck_move_tokens( SyckParser *p )
-{
- long count, skip;
- ASSERT( p->buffer != NULL );
-
- if ( p->token == NULL )
- return 0;
-
- skip = p->limit - p->token;
- if ( ( count = p->token - p->buffer ) )
- {
- if (skip > 0)
- S_MEMMOVE( p->buffer, p->token, char, skip );
- p->token = p->buffer;
- p->marker -= count;
- p->cursor -= count;
- p->toktmp -= count;
- p->limit -= count;
- p->lineptr -= count;
- p->linectptr -= count;
- }
- return skip;
-}
-
-void
-syck_check_limit( SyckParser *p, long len )
-{
- if ( p->cursor == NULL )
- {
- p->cursor = p->buffer;
- p->lineptr = p->buffer;
- p->linectptr = p->buffer;
- p->marker = p->buffer;
- }
- p->limit = p->buffer + len;
-}
-
-long
-syck_parser_read( SyckParser *p )
-{
- long len = 0;
- long skip = 0;
- ASSERT( p != NULL );
- switch ( p->io_type )
- {
- case syck_io_str:
- skip = syck_move_tokens( p );
- len = (p->io.str->read)( p->buffer, p->io.str, SYCK_BUFFERSIZE - 1, skip );
- break;
-
- case syck_io_file:
- skip = syck_move_tokens( p );
- len = (p->io.file->read)( p->buffer, p->io.file, SYCK_BUFFERSIZE - 1, skip );
- break;
- }
- syck_check_limit( p, len );
- return len;
-}
-
-long
-syck_parser_readlen( SyckParser *p, long max_size )
-{
- long len = 0;
- long skip = 0;
- ASSERT( p != NULL );
- switch ( p->io_type )
- {
- case syck_io_str:
- skip = syck_move_tokens( p );
- len = (p->io.str->read)( p->buffer, p->io.str, max_size, skip );
- break;
-
- case syck_io_file:
- skip = syck_move_tokens( p );
- len = (p->io.file->read)( p->buffer, p->io.file, max_size, skip );
- break;
- }
- syck_check_limit( p, len );
- return len;
-}
-
-SYMID
-syck_parse( SyckParser *p )
-{
- ASSERT( p != NULL );
-
- syck_st_free( p );
- syck_parser_reset_levels( p );
- syckparse( p );
- return p->root;
-}
-
-void
-syck_default_error_handler( SyckParser *p, const char *msg )
-{
- printf( "Error at [Line %d, Col %"PRIdPTRDIFF"]: %s\n",
- p->linect,
- p->cursor - p->lineptr,
- msg );
-}
-
diff --git a/ext/syck/syck.h b/ext/syck/syck.h
deleted file mode 100644
index 8885b000de..0000000000
--- a/ext/syck/syck.h
+++ /dev/null
@@ -1,453 +0,0 @@
-/*
- * syck.h
- *
- * $Author$
- *
- * Copyright (C) 2003 why the lucky stiff
- */
-
-#ifndef SYCK_H
-#define SYCK_H
-
-#define SYCK_YAML_MAJOR 1
-#define SYCK_YAML_MINOR 0
-
-#define YAML_DOMAIN "yaml.org,2002"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <ctype.h>
-#include "ruby/st.h"
-
-#if defined(__cplusplus)
-extern "C" {
-#endif
-
-/*
- * Memory Allocation
- */
-#if defined(HAVE_ALLOCA_H) && !defined(__GNUC__)
-#include <alloca.h>
-#endif
-
-#ifdef DEBUG
-void syck_assert( const char *, unsigned, const char * );
-# define ASSERT(f) \
- (( f ) ? (void)0 : syck_assert( __FILE__, __LINE__, #f ))
-#else
-# define ASSERT(f) ((void)0)
-#endif
-
-#ifndef NULL
-# define NULL (void *)0
-#endif
-
-#define ALLOC_CT 8
-#define SYCK_BUFFERSIZE 4096
-#define S_ALLOC_N(type,n) (type*)malloc(sizeof(type)*(n))
-#define S_ALLOC(type) (type*)malloc(sizeof(type))
-#define S_REALLOC_N(var,type,n) (var)=(type*)realloc((char*)(var),sizeof(type)*(n))
-#define S_FREE(n) if (n) { free(n); n = NULL; }
-
-#define S_ALLOCA_N(type,n) (type*)alloca(sizeof(type)*(n))
-
-#define S_MEMZERO(p,type,n) memset((p), 0, sizeof(type)*(n))
-#define S_MEMCPY(p1,p2,type,n) memcpy((p1), (p2), sizeof(type)*(n))
-#define S_MEMMOVE(p1,p2,type,n) memmove((p1), (p2), sizeof(type)*(n))
-#define S_MEMCMP(p1,p2,type,n) memcmp((p1), (p2), sizeof(type)*(n))
-
-#define BLOCK_FOLD 10
-#define BLOCK_LIT 20
-#define BLOCK_PLAIN 30
-#define NL_CHOMP 40
-#define NL_KEEP 50
-
-/*
- * Node definitions
- */
-#ifndef ST_DATA_T_DEFINED
-typedef long st_data_t;
-#endif
-
-#define SYMID st_data_t
-
-typedef struct _syck_node SyckNode;
-
-enum syck_kind_tag {
- syck_map_kind,
- syck_seq_kind,
- syck_str_kind
-};
-
-enum map_part {
- map_key,
- map_value
-};
-
-enum map_style {
- map_none,
- map_inline
-};
-
-enum seq_style {
- seq_none,
- seq_inline
-};
-
-enum scalar_style {
- scalar_none,
- scalar_1quote,
- scalar_2quote,
- scalar_fold,
- scalar_literal,
- scalar_plain
-};
-
-/*
- * Node metadata struct
- */
-struct _syck_node {
- /* Symbol table ID */
- SYMID id;
- /* Underlying kind */
- enum syck_kind_tag kind;
- /* Fully qualified tag-uri for type */
- char *type_id;
- /* Anchor name */
- char *anchor;
- union {
- /* Storage for map data */
- struct SyckMap {
- enum map_style style;
- SYMID *keys;
- SYMID *values;
- long capa;
- long idx;
- } *pairs;
- /* Storage for sequence data */
- struct SyckSeq {
- enum seq_style style;
- SYMID *items;
- long capa;
- long idx;
- } *list;
- /* Storage for string data */
- struct SyckStr {
- enum scalar_style style;
- char *ptr;
- long len;
- } *str;
- } data;
- /* Shortcut node */
- void *shortcut;
-};
-
-/*
- * Parser definitions
- */
-typedef struct _syck_parser SyckParser;
-typedef struct _syck_file SyckIoFile;
-typedef struct _syck_str SyckIoStr;
-typedef struct _syck_level SyckLevel;
-
-typedef SYMID (*SyckNodeHandler)(SyckParser *, SyckNode *);
-typedef void (*SyckErrorHandler)(SyckParser *, const char *);
-typedef SyckNode * (*SyckBadAnchorHandler)(SyckParser *, char *);
-typedef long (*SyckIoFileRead)(char *, SyckIoFile *, long, long);
-typedef long (*SyckIoStrRead)(char *, SyckIoStr *, long, long);
-
-enum syck_io_type {
- syck_io_str,
- syck_io_file
-};
-
-enum syck_parser_input {
- syck_yaml_utf8,
- syck_yaml_utf16,
- syck_yaml_utf32,
- syck_bytecode_utf8
-};
-
-enum syck_level_status {
- syck_lvl_header,
- syck_lvl_doc,
- syck_lvl_open,
- syck_lvl_seq,
- syck_lvl_map,
- syck_lvl_block,
- syck_lvl_str,
- syck_lvl_iseq,
- syck_lvl_imap,
- syck_lvl_end,
- syck_lvl_pause,
- syck_lvl_anctag,
- syck_lvl_mapx,
- syck_lvl_seqx
-};
-
-/*
- * Parser structs
- */
-struct _syck_file {
- /* File pointer */
- FILE *ptr;
- /* Function which FILE -> buffer */
- SyckIoFileRead read;
-};
-
-struct _syck_str {
- /* String buffer pointers */
- char *beg, *ptr, *end;
- /* Function which string -> buffer */
- SyckIoStrRead read;
-};
-
-struct _syck_level {
- /* Indent */
- int spaces;
- /* Counts nodes emitted at this level, useful for parsing
- * keys and pairs in bytecode */
- int ncount;
- /* Does node have anchors or tags? */
- int anctag;
- /* Domain prefixing at the given level */
- char *domain;
- /* Keeps a node status */
- enum syck_level_status status;
-};
-
-struct _syck_parser {
- /* Root node */
- SYMID root, root_on_error;
- /* Implicit typing flag */
- int implicit_typing, taguri_expansion;
- /* Scripting language function to handle nodes */
- SyckNodeHandler handler;
- /* Error handler */
- SyckErrorHandler error_handler;
- /* InvalidAnchor handler */
- SyckBadAnchorHandler bad_anchor_handler;
- /* Parser input type */
- enum syck_parser_input input_type;
- /* IO type */
- enum syck_io_type io_type;
- /* Custom buffer size */
- size_t bufsize;
- /* Buffer pointers */
- char *buffer, *linectptr, *lineptr, *toktmp, *token, *cursor, *marker, *limit;
- /* Line counter */
- int linect;
- /* Last token from yylex() */
- int last_token;
- /* Force a token upon next call to yylex() */
- int force_token;
- /* EOF flag */
- int eof;
- union {
- SyckIoFile *file;
- SyckIoStr *str;
- } io;
- /* Symbol table for anchors */
- st_table *anchors, *bad_anchors;
- /* Optional symbol table for SYMIDs */
- st_table *syms;
- /* Levels of indentation */
- SyckLevel *levels;
- int lvl_idx;
- int lvl_capa;
- /* Pointer for extension's use */
- void *bonus;
-};
-
-/*
- * Emitter definitions
- */
-typedef struct _syck_emitter SyckEmitter;
-typedef struct _syck_emitter_node SyckEmitterNode;
-
-typedef void (*SyckOutputHandler)(SyckEmitter *, char *, long);
-typedef void (*SyckEmitterHandler)(SyckEmitter *, st_data_t);
-
-enum doc_stage {
- doc_open,
- doc_processing
-};
-
-/*
- * Emitter struct
- */
-struct _syck_emitter {
- /* Headerless doc flag */
- int headless;
- /* Force header? */
- int use_header;
- /* Force version? */
- int use_version;
- /* Sort hash keys */
- int sort_keys;
- /* Anchor format */
- char *anchor_format;
- /* Explicit typing on all collections? */
- int explicit_typing;
- /* Best width on folded scalars */
- int best_width;
- /* Use literal[1] or folded[2] blocks on all text? */
- enum scalar_style style;
- /* Stage of written document */
- enum doc_stage stage;
- /* Level counter */
- int level;
- /* Default indentation */
- int indent;
- /* Object ignore ID */
- SYMID ignore_id;
- /* Symbol table for anchors */
- st_table *markers, *anchors, *anchored;
- /* Custom buffer size */
- size_t bufsize;
- /* Buffer */
- char *buffer, *marker;
- /* Absolute position of the buffer */
- long bufpos;
- /* Handler for emitter nodes */
- SyckEmitterHandler emitter_handler;
- /* Handler for output */
- SyckOutputHandler output_handler;
- /* Levels of indentation */
- SyckLevel *levels;
- int lvl_idx;
- int lvl_capa;
- /* Pointer for extension's use */
- void *bonus;
-};
-
-/*
- * Emitter node metadata struct
- */
-struct _syck_emitter_node {
- /* Node buffer position */
- long pos;
- /* Current indent */
- long indent;
- /* Collection? */
- int is_shortcut;
-};
-
-/*
- * Handler prototypes
- */
-SYMID syck_hdlr_add_node( SyckParser *, SyckNode * );
-SyckNode *syck_hdlr_add_anchor( SyckParser *, char *, SyckNode * );
-void syck_hdlr_remove_anchor( SyckParser *, char * );
-SyckNode *syck_hdlr_get_anchor( SyckParser *, char * );
-void syck_add_transfer( char *, SyckNode *, int );
-char *syck_xprivate( const char *, int );
-char *syck_taguri( const char *, const char *, int );
-int syck_tagcmp( const char *, const char * );
-int syck_add_sym( SyckParser *, void * );
-int syck_lookup_sym( SyckParser *, SYMID, void ** );
-int syck_try_implicit( SyckNode * );
-char *syck_type_id_to_uri( const char * );
-void try_tag_implicit( SyckNode *, int );
-const char *syck_match_implicit( const char *, size_t );
-
-/*
- * API prototypes
- */
-char *syck_strndup( const char *, long );
-long syck_io_file_read( char *, SyckIoFile *, long, long );
-long syck_io_str_read( char *, SyckIoStr *, long, long );
-char *syck_base64enc( char *, long );
-char *syck_base64dec( char *, long );
-SyckEmitter *syck_new_emitter(void);
-SYMID syck_emitter_mark_node( SyckEmitter *, st_data_t );
-void syck_emitter_ignore_id( SyckEmitter *, SYMID );
-void syck_output_handler( SyckEmitter *, SyckOutputHandler );
-void syck_emitter_handler( SyckEmitter *, SyckEmitterHandler );
-void syck_free_emitter( SyckEmitter * );
-void syck_emitter_clear( SyckEmitter * );
-void syck_emitter_write( SyckEmitter *, const char *, long );
-void syck_emitter_escape( SyckEmitter *, const char *, long );
-void syck_emitter_flush( SyckEmitter *, long );
-void syck_emit( SyckEmitter *, st_data_t );
-void syck_emit_scalar( SyckEmitter *, const char *, enum scalar_style, int, int, char, const char *, long );
-void syck_emit_1quoted( SyckEmitter *, int, const char *, long );
-void syck_emit_2quoted( SyckEmitter *, int, const char *, long );
-void syck_emit_folded( SyckEmitter *, int, char, const char *, long );
-void syck_emit_literal( SyckEmitter *, char, const char *, long );
-void syck_emit_seq( SyckEmitter *, const char *, enum seq_style );
-void syck_emit_item( SyckEmitter *, st_data_t );
-void syck_emit_map( SyckEmitter *, const char *, enum map_style );
-void syck_emit_end( SyckEmitter * );
-void syck_emit_tag( SyckEmitter *, const char *, const char * );
-void syck_emit_indent( SyckEmitter * );
-SyckLevel *syck_emitter_current_level( SyckEmitter * );
-SyckLevel *syck_emitter_parent_level( SyckEmitter * );
-void syck_emitter_pop_level( SyckEmitter * );
-void syck_emitter_add_level( SyckEmitter *, int, enum syck_level_status );
-void syck_emitter_reset_levels( SyckEmitter * );
-SyckParser *syck_new_parser(void);
-void syck_free_parser( SyckParser * );
-void syck_parser_set_root_on_error( SyckParser *, SYMID );
-void syck_parser_implicit_typing( SyckParser *, int );
-void syck_parser_taguri_expansion( SyckParser *, int );
-int syck_scan_scalar( int, const char *, long );
-void syck_parser_handler( SyckParser *, SyckNodeHandler );
-void syck_parser_error_handler( SyckParser *, SyckErrorHandler );
-void syck_parser_bad_anchor_handler( SyckParser *, SyckBadAnchorHandler );
-void syck_parser_set_input_type( SyckParser *, enum syck_parser_input );
-void syck_parser_file( SyckParser *, FILE *, SyckIoFileRead );
-void syck_parser_str( SyckParser *, char *, long, SyckIoStrRead );
-void syck_parser_str_auto( SyckParser *, char *, SyckIoStrRead );
-SyckLevel *syck_parser_current_level( SyckParser * );
-void syck_parser_add_level( SyckParser *, int, enum syck_level_status );
-void syck_parser_pop_level( SyckParser * );
-void free_any_io( SyckParser * );
-long syck_parser_read( SyckParser * );
-long syck_parser_readlen( SyckParser *, long );
-SYMID syck_parse( SyckParser * );
-void syck_default_error_handler( SyckParser *, const char * );
-SYMID syck_yaml2byte_handler( SyckParser *, SyckNode * );
-char *syck_yaml2byte( char * );
-
-/*
- * Allocation prototypes
- */
-SyckNode *syck_alloc_map(void);
-SyckNode *syck_alloc_seq(void);
-SyckNode *syck_alloc_str(void);
-void syck_free_node( SyckNode * );
-void syck_free_members( SyckNode * );
-SyckNode *syck_new_str( const char *, enum scalar_style );
-SyckNode *syck_new_str2( const char *, long, enum scalar_style );
-void syck_replace_str( SyckNode *, char *, enum scalar_style );
-void syck_replace_str2( SyckNode *, char *, long, enum scalar_style );
-void syck_str_blow_away_commas( SyckNode * );
-char *syck_str_read( SyckNode * );
-SyckNode *syck_new_map( SYMID, SYMID );
-void syck_map_empty( SyckNode * );
-void syck_map_add( SyckNode *, SYMID, SYMID );
-SYMID syck_map_read( SyckNode *, enum map_part, long );
-void syck_map_assign( SyckNode *, enum map_part, long, SYMID );
-long syck_map_count( SyckNode * );
-void syck_map_update( SyckNode *, SyckNode * );
-SyckNode *syck_new_seq( SYMID );
-void syck_seq_empty( SyckNode * );
-void syck_seq_add( SyckNode *, SYMID );
-void syck_seq_assign( SyckNode *, long, SYMID );
-SYMID syck_seq_read( SyckNode *, long );
-long syck_seq_count( SyckNode * );
-
-/*
- * Lexer prototypes
- */
-void syckerror( const char * );
-int syckparse( void * );
-union YYSTYPE;
-int sycklex( union YYSTYPE *, SyckParser * );
-
-#if defined(__cplusplus)
-} /* extern "C" { */
-#endif
-
-#endif /* ifndef SYCK_H */
diff --git a/ext/syck/token.c b/ext/syck/token.c
deleted file mode 100644
index bea79c158a..0000000000
--- a/ext/syck/token.c
+++ /dev/null
@@ -1,2724 +0,0 @@
-/* Generated by re2c 0.9.10 on Tue Sep 20 17:46:17 2005 */
-#line 1 "token.re"
-/*
- * token.re
- *
- * $Author$
- *
- * Copyright (C) 2003 why the lucky stiff
- */
-#include "ruby/ruby.h"
-#include "syck.h"
-#include "gram.h"
-
-/*
- * Allocate quoted strings in chunks
- */
-#define QUOTELEN 1024
-
-/*
- * They do my bidding...
- */
-#define YYCTYPE char
-#define YYCURSOR parser->cursor
-#define YYMARKER parser->marker
-#define YYLIMIT parser->limit
-#define YYTOKEN parser->token
-#define YYTOKTMP parser->toktmp
-#define YYLINEPTR parser->lineptr
-#define YYLINECTPTR parser->linectptr
-#define YYLINE parser->linect
-#define YYFILL(n) syck_parser_read(parser)
-
-/*
- * Repositions the cursor at `n' offset from the token start.
- * Only works in `Header' and `Document' sections.
- */
-#define YYPOS(n) YYCURSOR = YYTOKEN + n
-
-/*
- * Track line numbers
- */
-#define NEWLINE(ptr) YYLINEPTR = ptr + newline_len(ptr); if ( YYLINEPTR > YYLINECTPTR ) { YYLINE++; YYLINECTPTR = YYLINEPTR; }
-
-/*
- * I like seeing the level operations as macros...
- */
-#define ADD_LEVEL(len, status) syck_parser_add_level( parser, len, status )
-#define POP_LEVEL() syck_parser_pop_level( parser )
-#define CURRENT_LEVEL() syck_parser_current_level( parser )
-
-/*
- * Force a token next time around sycklex()
- */
-#define FORCE_NEXT_TOKEN(tok) parser->force_token = tok;
-
-/*
- * Nice little macro to ensure we're YAML_IOPENed to the current level.
- * * Only use this macro in the "Document" section *
- */
-#define ENSURE_YAML_IOPEN(last_lvl, to_len, reset) \
- if ( last_lvl->spaces < to_len ) \
- { \
- if ( last_lvl->status == syck_lvl_iseq || last_lvl->status == syck_lvl_imap ) \
- { \
- goto Document; \
- } \
- else \
- { \
- ADD_LEVEL( to_len, syck_lvl_doc ); \
- if ( reset == 1 ) YYPOS(0); \
- return YAML_IOPEN; \
- } \
- }
-
-/*
- * Nice little macro to ensure closure of levels.
- * * Only use this macro in the "Document" section *
- */
-#define ENSURE_YAML_IEND(last_lvl, to_len) \
- if ( last_lvl->spaces > to_len ) \
- { \
- syck_parser_pop_level( parser ); \
- YYPOS(0); \
- return YAML_IEND; \
- }
-
-/*
- * Concatenates quoted string items and manages allocation
- * to the quoted string
- */
-#define QUOTECAT(s, c, i, l) \
- { \
- if ( i + 1 >= c ) \
- { \
- c += QUOTELEN; \
- S_REALLOC_N( s, char, c ); \
- } \
- s[i++] = l; \
- s[i] = '\0'; \
- }
-
-#define QUOTECATS(s, c, i, cs, cl) \
- { \
- while ( i + cl >= c ) \
- { \
- c += QUOTELEN; \
- S_REALLOC_N( s, char, c ); \
- } \
- S_MEMCPY( s + i, cs, char, cl ); \
- i += cl; \
- s[i] = '\0'; \
- }
-
-/*
- * Tags a plain scalar with a transfer method
- * * Use only in "Plain" section *
- */
-#define RETURN_IMPLICIT() \
- { \
- SyckNode *n = syck_alloc_str(); \
- YYCURSOR = YYTOKEN; \
- n->data.str->ptr = qstr; \
- n->data.str->len = qidx; \
- n->data.str->style = scalar_plain; \
- sycklval->nodeData = n; \
- if ( parser->implicit_typing == 1 ) \
- { \
- try_tag_implicit( sycklval->nodeData, parser->taguri_expansion ); \
- } \
- return YAML_PLAIN; \
- }
-
-/* concat the inline characters to the plain scalar */
-#define PLAIN_NOT_INL() \
- if ( *(YYCURSOR - 1) == ' ' || is_newline( YYCURSOR - 1 ) ) \
- { \
- YYCURSOR--; \
- } \
- QUOTECATS(qstr, qcapa, qidx, YYTOKEN, YYCURSOR - YYTOKEN); \
- goto Plain2;
-
-/* trim spaces off the end in case of indent */
-#define PLAIN_IS_INL() \
- char *walker = qstr + qidx - 1; \
- while ( walker > qstr && ( *walker == '\n' || *walker == ' ' || *walker == '\t' ) ) \
- { \
- qidx--; \
- walker[0] = '\0'; \
- walker--; \
- }
-
-/*
- * Keep or chomp block?
- * * Use only in "ScalarBlock" section *
- */
-#define RETURN_YAML_BLOCK() \
- { \
- SyckNode *n = syck_alloc_str(); \
- if ( ((SyckParser *)parser)->taguri_expansion == 1 ) \
- { \
- n->type_id = syck_taguri( YAML_DOMAIN, "str", 3 ); \
- } \
- else \
- { \
- n->type_id = syck_strndup( "str", 3 ); \
- } \
- n->data.str->ptr = qstr; \
- n->data.str->len = qidx; \
- if ( blockType == BLOCK_LIT ) { \
- n->data.str->style = scalar_literal; \
- } else { \
- n->data.str->style = scalar_fold; \
- } \
- if ( qidx > 0 ) \
- { \
- if ( nlDoWhat != NL_KEEP ) \
- { \
- char *fc = n->data.str->ptr + n->data.str->len - 1; \
- while ( is_newline( fc ) ) fc--; \
- if ( nlDoWhat != NL_CHOMP && fc < n->data.str->ptr + n->data.str->len - 1 ) \
- fc += 1; \
- n->data.str->len = fc - n->data.str->ptr + 1; \
- } \
- } \
- sycklval->nodeData = n; \
- return YAML_BLOCK; \
- }
-
-/*
- * Handles newlines, calculates indent
- */
-#define GOBBLE_UP_YAML_INDENT( ict, start ) \
- char *indent = start; \
- NEWLINE(indent); \
- while ( indent < YYCURSOR ) \
- { \
- if ( is_newline( ++indent ) ) \
- { \
- NEWLINE(indent); \
- } \
- } \
- ict = 0; \
- if ( *YYCURSOR == '\0' ) \
- { \
- ict = -1; \
- start = YYCURSOR - 1; \
- } \
- else if ( *YYLINEPTR == ' ' ) \
- { \
- ict = (int)(YYCURSOR - YYLINEPTR); \
- }
-
-/*
- * If an indent exists at the current level, back up.
- */
-#define GET_TRUE_YAML_INDENT(indt_len) \
- { \
- SyckLevel *lvl_deep = CURRENT_LEVEL(); \
- indt_len = lvl_deep->spaces; \
- if ( lvl_deep->status == syck_lvl_seq || ( indt_len == YYCURSOR - YYLINEPTR && lvl_deep->status != syck_lvl_map ) ) \
- { \
- SyckLevel *lvl_over; \
- parser->lvl_idx--; \
- lvl_over = CURRENT_LEVEL(); \
- indt_len = lvl_over->spaces; \
- parser->lvl_idx++; \
- } \
- }
-
-/*
- * Argjh! I hate globals! Here for syckerror() only!
- */
-SyckParser *syck_parser_ptr = NULL;
-
-/*
- * Accessory funcs later in this file.
- */
-void eat_comments( SyckParser * );
-char escape_seq( char );
-int is_newline( char *ptr );
-int newline_len( char *ptr );
-int sycklex_yaml_utf8( YYSTYPE *, SyckParser * );
-int sycklex_bytecode_utf8( YYSTYPE *, SyckParser * );
-int syckwrap();
-
-/*
- * My own re-entrant sycklex() using re2c.
- * You really get used to the limited regexp.
- * It's really nice to not rely on backtracking and such.
- */
-int
-sycklex( YYSTYPE *sycklval, SyckParser *parser )
-{
- switch ( parser->input_type )
- {
- case syck_yaml_utf8:
- return sycklex_yaml_utf8( sycklval, parser );
-
- case syck_yaml_utf16:
- syckerror( "UTF-16 is not currently supported in Syck.\nPlease contribute code to help this happen!" );
- break;
-
- case syck_yaml_utf32:
- syckerror( "UTF-32 is not currently supported in Syck.\nPlease contribute code to help this happen!" );
- break;
-
- case syck_bytecode_utf8:
- return sycklex_bytecode_utf8( sycklval, parser );
- }
- return YAML_DOCSEP;
-}
-
-/*
- * Parser for standard YAML [UTF-8]
- */
-int
-sycklex_yaml_utf8( YYSTYPE *sycklval, SyckParser *parser )
-{
- int doc_level = 0;
- syck_parser_ptr = parser;
- if ( YYCURSOR == NULL )
- {
- syck_parser_read( parser );
- }
-
- if ( parser->force_token != 0 )
- {
- int t = parser->force_token;
- parser->force_token = 0;
- return t;
- }
-
-#line 315 "token.re"
-
-
- if ( YYLINEPTR != YYCURSOR )
- {
- goto Document;
- }
-
-Header:
-
- YYTOKEN = YYCURSOR;
-
-
-#line 307 "<stdout>"
-{
- YYCTYPE yych;
- unsigned int yyaccept;
- goto yy0;
- ++YYCURSOR;
-yy0:
- if((YYLIMIT - YYCURSOR) < 5) YYFILL(5);
- yych = *YYCURSOR;
- switch(yych){
- case 0x00: goto yy7;
- case 0x09: case ' ': goto yy12;
- case 0x0A: goto yy9;
- case 0x0D: goto yy11;
- case '#': goto yy5;
- case '-': goto yy2;
- case '.': goto yy4;
- default: goto yy14;
- }
-yy2: yyaccept = 0;
- yych = *(YYMARKER = ++YYCURSOR);
- switch(yych){
- case '-': goto yy28;
- default: goto yy3;
- }
-yy3:
-#line 374 "token.re"
-{ YYPOS(0);
- goto Document;
- }
-#line 337 "<stdout>"
-yy4: yyaccept = 0;
- yych = *(YYMARKER = ++YYCURSOR);
- switch(yych){
- case '.': goto yy21;
- default: goto yy3;
- }
-yy5: ++YYCURSOR;
- goto yy6;
-yy6:
-#line 356 "token.re"
-{ eat_comments( parser );
- goto Header;
- }
-#line 351 "<stdout>"
-yy7: ++YYCURSOR;
- goto yy8;
-yy8:
-#line 360 "token.re"
-{ SyckLevel *lvl = CURRENT_LEVEL();
- ENSURE_YAML_IEND(lvl, -1);
- YYPOS(0);
- return 0;
- }
-#line 361 "<stdout>"
-yy9: yyaccept = 1;
- yych = *(YYMARKER = ++YYCURSOR);
- goto yy18;
-yy10:
-#line 366 "token.re"
-{ GOBBLE_UP_YAML_INDENT( doc_level, YYTOKEN );
- goto Header;
- }
-#line 370 "<stdout>"
-yy11: yych = *++YYCURSOR;
- switch(yych){
- case 0x0A: goto yy17;
- default: goto yy3;
- }
-yy12: ++YYCURSOR;
- yych = *YYCURSOR;
- goto yy16;
-yy13:
-#line 370 "token.re"
-{ doc_level = (int)(YYCURSOR - YYLINEPTR);
- goto Header;
- }
-#line 384 "<stdout>"
-yy14: yych = *++YYCURSOR;
- goto yy3;
-yy15: ++YYCURSOR;
- if(YYLIMIT == YYCURSOR) YYFILL(1);
- yych = *YYCURSOR;
- goto yy16;
-yy16: switch(yych){
- case 0x09: case ' ': goto yy15;
- default: goto yy13;
- }
-yy17: yyaccept = 1;
- YYMARKER = ++YYCURSOR;
- if(YYLIMIT == YYCURSOR) YYFILL(1);
- yych = *YYCURSOR;
- goto yy18;
-yy18: switch(yych){
- case 0x0A: case ' ': goto yy17;
- case 0x0D: goto yy19;
- default: goto yy10;
- }
-yy19: ++YYCURSOR;
- if(YYLIMIT == YYCURSOR) YYFILL(1);
- yych = *YYCURSOR;
- switch(yych){
- case 0x0A: goto yy17;
- default: goto yy20;
- }
-yy20: YYCURSOR = YYMARKER;
- switch(yyaccept){
- case 1: goto yy10;
- case 0: goto yy3;
- }
-yy21: yych = *++YYCURSOR;
- switch(yych){
- case '.': goto yy22;
- default: goto yy20;
- }
-yy22: yych = *++YYCURSOR;
- switch(yych){
- case 0x0A: goto yy23;
- case 0x0D: goto yy27;
- case ' ': goto yy25;
- default: goto yy20;
- }
-yy23: ++YYCURSOR;
- goto yy24;
-yy24:
-#line 342 "token.re"
-{ SyckLevel *lvl = CURRENT_LEVEL();
- if ( lvl->status == syck_lvl_header )
- {
- goto Header;
- }
- else
- {
- ENSURE_YAML_IEND(lvl, -1);
- YYPOS(0);
- return 0;
- }
- return 0;
- }
-#line 446 "<stdout>"
-yy25: ++YYCURSOR;
- if(YYLIMIT == YYCURSOR) YYFILL(1);
- yych = *YYCURSOR;
- goto yy26;
-yy26: switch(yych){
- case ' ': goto yy25;
- default: goto yy24;
- }
-yy27: yych = *++YYCURSOR;
- switch(yych){
- case 0x0A: goto yy23;
- default: goto yy20;
- }
-yy28: yych = *++YYCURSOR;
- switch(yych){
- case '-': goto yy29;
- default: goto yy20;
- }
-yy29: yych = *++YYCURSOR;
- switch(yych){
- case 0x0A: goto yy30;
- case 0x0D: goto yy34;
- case ' ': goto yy32;
- default: goto yy20;
- }
-yy30: ++YYCURSOR;
- goto yy31;
-yy31:
-#line 328 "token.re"
-{ SyckLevel *lvl = CURRENT_LEVEL();
- if ( lvl->status == syck_lvl_header )
- {
- YYPOS(3);
- goto Directive;
- }
- else
- {
- ENSURE_YAML_IEND(lvl, -1);
- YYPOS(0);
- return 0;
- }
- }
-#line 489 "<stdout>"
-yy32: ++YYCURSOR;
- if(YYLIMIT == YYCURSOR) YYFILL(1);
- yych = *YYCURSOR;
- goto yy33;
-yy33: switch(yych){
- case ' ': goto yy32;
- default: goto yy31;
- }
-yy34: ++YYCURSOR;
- switch((yych = *YYCURSOR)) {
- case 0x0A: goto yy30;
- default: goto yy20;
- }
-}
-#line 378 "token.re"
-
-
-Document:
- {
- SyckLevel *lvl = CURRENT_LEVEL();
- if ( lvl->status == syck_lvl_header )
- {
- lvl->status = syck_lvl_doc;
- }
-
- YYTOKEN = YYCURSOR;
-
-
-#line 518 "<stdout>"
-{
- YYCTYPE yych;
- unsigned int yyaccept;
- goto yy35;
- ++YYCURSOR;
-yy35:
- if((YYLIMIT - YYCURSOR) < 3) YYFILL(3);
- yych = *YYCURSOR;
- switch(yych){
- case 0x00: goto yy62;
- case 0x09: case ' ': goto yy60;
- case 0x0A: goto yy37;
- case 0x0D: goto yy39;
- case '!': goto yy51;
- case '"': goto yy55;
- case '#': goto yy58;
- case '&': goto yy49;
- case '\'': goto yy53;
- case '*': goto yy50;
- case ',': case ':': goto yy47;
- case '-': case '?': goto yy48;
- case '>': case '|': goto yy57;
- case '[': goto yy41;
- case ']': case '}': goto yy45;
- case '{': goto yy43;
- default: goto yy64;
- }
-yy37: yyaccept = 0;
- yych = *(YYMARKER = ++YYCURSOR);
- goto yy92;
-yy38:
-#line 392 "token.re"
-{ /* Isolate spaces */
- int indt_len;
- GOBBLE_UP_YAML_INDENT( indt_len, YYTOKEN );
- lvl = CURRENT_LEVEL();
- doc_level = 0;
-
- /* XXX: Comment lookahead */
- if ( *YYCURSOR == '#' )
- {
- goto Document;
- }
-
- /* Ignore indentation inside inlines */
- if ( lvl->status == syck_lvl_iseq || lvl->status == syck_lvl_imap )
- {
- goto Document;
- }
-
- /* Check for open indent */
- ENSURE_YAML_IEND(lvl, indt_len);
- ENSURE_YAML_IOPEN(lvl, indt_len, 0);
- if ( indt_len == -1 )
- {
- return 0;
- }
- return YAML_INDENT;
- }
-#line 578 "<stdout>"
-yy39: ++YYCURSOR;
- switch((yych = *YYCURSOR)) {
- case 0x0A: goto yy91;
- default: goto yy40;
- }
-yy40:
-#line 497 "token.re"
-{ ENSURE_YAML_IOPEN(lvl, doc_level, 1);
- goto Plain;
- }
-#line 589 "<stdout>"
-yy41: ++YYCURSOR;
- goto yy42;
-yy42:
-#line 420 "token.re"
-{ ENSURE_YAML_IOPEN(lvl, doc_level, 1);
- lvl = CURRENT_LEVEL();
- ADD_LEVEL(lvl->spaces + 1, syck_lvl_iseq);
- return YYTOKEN[0];
- }
-#line 599 "<stdout>"
-yy43: ++YYCURSOR;
- goto yy44;
-yy44:
-#line 426 "token.re"
-{ ENSURE_YAML_IOPEN(lvl, doc_level, 1);
- lvl = CURRENT_LEVEL();
- ADD_LEVEL(lvl->spaces + 1, syck_lvl_imap);
- return YYTOKEN[0];
- }
-#line 609 "<stdout>"
-yy45: ++YYCURSOR;
- goto yy46;
-yy46:
-#line 432 "token.re"
-{ POP_LEVEL();
- return YYTOKEN[0];
- }
-#line 617 "<stdout>"
-yy47: yyaccept = 1;
- yych = *(YYMARKER = ++YYCURSOR);
- switch(yych){
- case 0x0A: goto yy86;
- case 0x0D: goto yy90;
- case ' ': goto yy88;
- default: goto yy40;
- }
-yy48: yyaccept = 1;
- yych = *(YYMARKER = ++YYCURSOR);
- switch(yych){
- case 0x0A: goto yy81;
- case 0x0D: goto yy85;
- case ' ': goto yy83;
- default: goto yy40;
- }
-yy49: yych = *++YYCURSOR;
- switch(yych){
- case '-': case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': case 'A':
- case 'B':
- case 'C':
- case 'D':
- case 'E':
- case 'F':
- case 'G':
- case 'H':
- case 'I':
- case 'J':
- case 'K':
- case 'L':
- case 'M':
- case 'N':
- case 'O':
- case 'P':
- case 'Q':
- case 'R':
- case 'S':
- case 'T':
- case 'U':
- case 'V':
- case 'W':
- case 'X':
- case 'Y':
- case 'Z': case '_': case 'a':
- case 'b':
- case 'c':
- case 'd':
- case 'e':
- case 'f':
- case 'g':
- case 'h':
- case 'i':
- case 'j':
- case 'k':
- case 'l':
- case 'm':
- case 'n':
- case 'o':
- case 'p':
- case 'q':
- case 'r':
- case 's':
- case 't':
- case 'u':
- case 'v':
- case 'w':
- case 'x':
- case 'y':
- case 'z': goto yy78;
- default: goto yy40;
- }
-yy50: yych = *++YYCURSOR;
- switch(yych){
- case '-': case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': case 'A':
- case 'B':
- case 'C':
- case 'D':
- case 'E':
- case 'F':
- case 'G':
- case 'H':
- case 'I':
- case 'J':
- case 'K':
- case 'L':
- case 'M':
- case 'N':
- case 'O':
- case 'P':
- case 'Q':
- case 'R':
- case 'S':
- case 'T':
- case 'U':
- case 'V':
- case 'W':
- case 'X':
- case 'Y':
- case 'Z': case '_': case 'a':
- case 'b':
- case 'c':
- case 'd':
- case 'e':
- case 'f':
- case 'g':
- case 'h':
- case 'i':
- case 'j':
- case 'k':
- case 'l':
- case 'm':
- case 'n':
- case 'o':
- case 'p':
- case 'q':
- case 'r':
- case 's':
- case 't':
- case 'u':
- case 'v':
- case 'w':
- case 'x':
- case 'y':
- case 'z': goto yy75;
- default: goto yy40;
- }
-yy51: ++YYCURSOR;
- goto yy52;
-yy52:
-#line 471 "token.re"
-{ goto TransferMethod; }
-#line 767 "<stdout>"
-yy53: ++YYCURSOR;
- goto yy54;
-yy54:
-#line 473 "token.re"
-{ ENSURE_YAML_IOPEN(lvl, doc_level, 1);
- goto SingleQuote; }
-#line 774 "<stdout>"
-yy55: ++YYCURSOR;
- goto yy56;
-yy56:
-#line 476 "token.re"
-{ ENSURE_YAML_IOPEN(lvl, doc_level, 1);
- goto DoubleQuote; }
-#line 781 "<stdout>"
-yy57: yyaccept = 1;
- yych = *(YYMARKER = ++YYCURSOR);
- switch(yych){
- case 0x0A: goto yy70;
- case 0x0D: goto yy74;
- case ' ': goto yy72;
- case '+': case '-': case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': goto yy67;
- default: goto yy40;
- }
-yy58: ++YYCURSOR;
- goto yy59;
-yy59:
-#line 486 "token.re"
-{ eat_comments( parser );
- goto Document;
- }
-#line 807 "<stdout>"
-yy60: ++YYCURSOR;
- yych = *YYCURSOR;
- goto yy66;
-yy61:
-#line 490 "token.re"
-{ goto Document; }
-#line 814 "<stdout>"
-yy62: ++YYCURSOR;
- goto yy63;
-yy63:
-#line 492 "token.re"
-{ ENSURE_YAML_IEND(lvl, -1);
- YYPOS(0);
- return 0;
- }
-#line 823 "<stdout>"
-yy64: yych = *++YYCURSOR;
- goto yy40;
-yy65: ++YYCURSOR;
- if(YYLIMIT == YYCURSOR) YYFILL(1);
- yych = *YYCURSOR;
- goto yy66;
-yy66: switch(yych){
- case 0x09: case ' ': goto yy65;
- default: goto yy61;
- }
-yy67: ++YYCURSOR;
- if((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
- yych = *YYCURSOR;
- goto yy68;
-yy68: switch(yych){
- case 0x0A: goto yy70;
- case 0x0D: goto yy74;
- case ' ': goto yy72;
- case '+': case '-': case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': goto yy67;
- default: goto yy69;
- }
-yy69: YYCURSOR = YYMARKER;
- switch(yyaccept){
- case 0: goto yy38;
- case 1: goto yy40;
- }
-yy70: ++YYCURSOR;
- goto yy71;
-yy71:
-#line 479 "token.re"
-{ if ( is_newline( YYCURSOR - 1 ) )
- {
- YYCURSOR--;
- }
- goto ScalarBlock;
- }
-#line 869 "<stdout>"
-yy72: ++YYCURSOR;
- if(YYLIMIT == YYCURSOR) YYFILL(1);
- yych = *YYCURSOR;
- goto yy73;
-yy73: switch(yych){
- case ' ': goto yy72;
- default: goto yy71;
- }
-yy74: yych = *++YYCURSOR;
- switch(yych){
- case 0x0A: goto yy70;
- default: goto yy69;
- }
-yy75: ++YYCURSOR;
- if(YYLIMIT == YYCURSOR) YYFILL(1);
- yych = *YYCURSOR;
- goto yy76;
-yy76: switch(yych){
- case '-': case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': case 'A':
- case 'B':
- case 'C':
- case 'D':
- case 'E':
- case 'F':
- case 'G':
- case 'H':
- case 'I':
- case 'J':
- case 'K':
- case 'L':
- case 'M':
- case 'N':
- case 'O':
- case 'P':
- case 'Q':
- case 'R':
- case 'S':
- case 'T':
- case 'U':
- case 'V':
- case 'W':
- case 'X':
- case 'Y':
- case 'Z': case '_': case 'a':
- case 'b':
- case 'c':
- case 'd':
- case 'e':
- case 'f':
- case 'g':
- case 'h':
- case 'i':
- case 'j':
- case 'k':
- case 'l':
- case 'm':
- case 'n':
- case 'o':
- case 'p':
- case 'q':
- case 'r':
- case 's':
- case 't':
- case 'u':
- case 'v':
- case 'w':
- case 'x':
- case 'y':
- case 'z': goto yy75;
- default: goto yy77;
- }
-yy77:
-#line 466 "token.re"
-{ ENSURE_YAML_IOPEN(lvl, doc_level, 1);
- sycklval->name = syck_strndup( YYTOKEN + 1, YYCURSOR - YYTOKEN - 1 );
- return YAML_ALIAS;
- }
-#line 956 "<stdout>"
-yy78: ++YYCURSOR;
- if(YYLIMIT == YYCURSOR) YYFILL(1);
- yych = *YYCURSOR;
- goto yy79;
-yy79: switch(yych){
- case '-': case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': case 'A':
- case 'B':
- case 'C':
- case 'D':
- case 'E':
- case 'F':
- case 'G':
- case 'H':
- case 'I':
- case 'J':
- case 'K':
- case 'L':
- case 'M':
- case 'N':
- case 'O':
- case 'P':
- case 'Q':
- case 'R':
- case 'S':
- case 'T':
- case 'U':
- case 'V':
- case 'W':
- case 'X':
- case 'Y':
- case 'Z': case '_': case 'a':
- case 'b':
- case 'c':
- case 'd':
- case 'e':
- case 'f':
- case 'g':
- case 'h':
- case 'i':
- case 'j':
- case 'k':
- case 'l':
- case 'm':
- case 'n':
- case 'o':
- case 'p':
- case 'q':
- case 'r':
- case 's':
- case 't':
- case 'u':
- case 'v':
- case 'w':
- case 'x':
- case 'y':
- case 'z': goto yy78;
- default: goto yy80;
- }
-yy80:
-#line 455 "token.re"
-{ sycklval->name = syck_strndup( YYTOKEN + 1, YYCURSOR - YYTOKEN - 1 );
-
- /*
- * Remove previous anchors of the same name. Since the parser will likely
- * construct deeper nodes first, we want those nodes to be placed in the
- * queue for matching at a higher level of indentation.
- */
- syck_hdlr_remove_anchor(parser, sycklval->name);
- return YAML_ANCHOR;
- }
-#line 1036 "<stdout>"
-yy81: ++YYCURSOR;
- goto yy82;
-yy82:
-#line 441 "token.re"
-{ ENSURE_YAML_IOPEN(lvl, (int)(YYTOKEN - YYLINEPTR), 1);
- FORCE_NEXT_TOKEN(YAML_IOPEN);
- if ( *YYCURSOR == '#' || is_newline( YYCURSOR ) || is_newline( YYCURSOR - 1 ) )
- {
- YYCURSOR--;
- ADD_LEVEL((int)((YYTOKEN + 1) - YYLINEPTR), syck_lvl_seq);
- }
- else /* spaces followed by content uses the space as indentation */
- {
- ADD_LEVEL((int)(YYCURSOR - YYLINEPTR), syck_lvl_seq);
- }
- return YYTOKEN[0];
- }
-#line 1054 "<stdout>"
-yy83: ++YYCURSOR;
- if(YYLIMIT == YYCURSOR) YYFILL(1);
- yych = *YYCURSOR;
- goto yy84;
-yy84: switch(yych){
- case ' ': goto yy83;
- default: goto yy82;
- }
-yy85: yych = *++YYCURSOR;
- switch(yych){
- case 0x0A: goto yy81;
- default: goto yy69;
- }
-yy86: ++YYCURSOR;
- goto yy87;
-yy87:
-#line 436 "token.re"
-{ if ( *YYTOKEN == ':' && lvl->status != syck_lvl_imap ) lvl->status = syck_lvl_map;
- YYPOS(1);
- return YYTOKEN[0];
- }
-#line 1076 "<stdout>"
-yy88: ++YYCURSOR;
- if(YYLIMIT == YYCURSOR) YYFILL(1);
- yych = *YYCURSOR;
- goto yy89;
-yy89: switch(yych){
- case ' ': goto yy88;
- default: goto yy87;
- }
-yy90: yych = *++YYCURSOR;
- switch(yych){
- case 0x0A: goto yy86;
- default: goto yy69;
- }
-yy91: yyaccept = 0;
- YYMARKER = ++YYCURSOR;
- if(YYLIMIT == YYCURSOR) YYFILL(1);
- yych = *YYCURSOR;
- goto yy92;
-yy92: switch(yych){
- case 0x0A: case ' ': goto yy91;
- case 0x0D: goto yy93;
- default: goto yy38;
- }
-yy93: ++YYCURSOR;
- if(YYLIMIT == YYCURSOR) YYFILL(1);
- yych = *YYCURSOR;
- switch(yych){
- case 0x0A: goto yy91;
- default: goto yy69;
- }
-}
-#line 501 "token.re"
-
- }
-
-Directive:
- {
- YYTOKTMP = YYCURSOR;
-
-
-#line 1117 "<stdout>"
-{
- YYCTYPE yych;
- unsigned int yyaccept = 0;
- goto yy94;
- ++YYCURSOR;
-yy94:
- if((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
- yych = *YYCURSOR;
- switch(yych){
- case 0x00: goto yy96;
- case 0x09: case ' ': goto yy99;
- case '%': goto yy97;
- default: goto yy101;
- }
-yy96: YYCURSOR = YYMARKER;
- switch(yyaccept){
- case 0: goto yy98;
- }
-yy97: yyaccept = 0;
- yych = *(YYMARKER = ++YYCURSOR);
- switch(yych){
- case '.':
- case '/':
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9':
- case ':':
- case ';':
- case '<':
- case '=':
- case '>':
- case '?':
- case '@':
- case 'A':
- case 'B':
- case 'C':
- case 'D':
- case 'E':
- case 'F':
- case 'G':
- case 'H':
- case 'I':
- case 'J':
- case 'K':
- case 'L':
- case 'M':
- case 'N':
- case 'O':
- case 'P':
- case 'Q':
- case 'R':
- case 'S':
- case 'T':
- case 'U':
- case 'V':
- case 'W':
- case 'X':
- case 'Y':
- case 'Z':
- case '[':
- case '\\':
- case ']':
- case '^':
- case '_': case 'a':
- case 'b':
- case 'c':
- case 'd':
- case 'e':
- case 'f':
- case 'g':
- case 'h':
- case 'i':
- case 'j':
- case 'k':
- case 'l':
- case 'm':
- case 'n':
- case 'o':
- case 'p':
- case 'q':
- case 'r':
- case 's':
- case 't':
- case 'u':
- case 'v':
- case 'w':
- case 'x':
- case 'y':
- case 'z': goto yy104;
- default: goto yy98;
- }
-yy98:
-#line 514 "token.re"
-{ YYCURSOR = YYTOKTMP;
- return YAML_DOCSEP;
- }
-#line 1221 "<stdout>"
-yy99: ++YYCURSOR;
- yych = *YYCURSOR;
- goto yy103;
-yy100:
-#line 512 "token.re"
-{ goto Directive; }
-#line 1228 "<stdout>"
-yy101: yych = *++YYCURSOR;
- goto yy98;
-yy102: ++YYCURSOR;
- if(YYLIMIT == YYCURSOR) YYFILL(1);
- yych = *YYCURSOR;
- goto yy103;
-yy103: switch(yych){
- case 0x09: case ' ': goto yy102;
- default: goto yy100;
- }
-yy104: ++YYCURSOR;
- if((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
- yych = *YYCURSOR;
- goto yy105;
-yy105: switch(yych){
- case '.':
- case '/':
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': case ';':
- case '<':
- case '=':
- case '>':
- case '?':
- case '@':
- case 'A':
- case 'B':
- case 'C':
- case 'D':
- case 'E':
- case 'F':
- case 'G':
- case 'H':
- case 'I':
- case 'J':
- case 'K':
- case 'L':
- case 'M':
- case 'N':
- case 'O':
- case 'P':
- case 'Q':
- case 'R':
- case 'S':
- case 'T':
- case 'U':
- case 'V':
- case 'W':
- case 'X':
- case 'Y':
- case 'Z':
- case '[':
- case '\\':
- case ']':
- case '^':
- case '_': case 'a':
- case 'b':
- case 'c':
- case 'd':
- case 'e':
- case 'f':
- case 'g':
- case 'h':
- case 'i':
- case 'j':
- case 'k':
- case 'l':
- case 'm':
- case 'n':
- case 'o':
- case 'p':
- case 'q':
- case 'r':
- case 's':
- case 't':
- case 'u':
- case 'v':
- case 'w':
- case 'x':
- case 'y':
- case 'z': goto yy104;
- case ':': goto yy106;
- default: goto yy96;
- }
-yy106: yych = *++YYCURSOR;
- switch(yych){
- case '.':
- case '/':
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9':
- case ':':
- case ';':
- case '<':
- case '=':
- case '>':
- case '?':
- case '@':
- case 'A':
- case 'B':
- case 'C':
- case 'D':
- case 'E':
- case 'F':
- case 'G':
- case 'H':
- case 'I':
- case 'J':
- case 'K':
- case 'L':
- case 'M':
- case 'N':
- case 'O':
- case 'P':
- case 'Q':
- case 'R':
- case 'S':
- case 'T':
- case 'U':
- case 'V':
- case 'W':
- case 'X':
- case 'Y':
- case 'Z':
- case '[':
- case '\\':
- case ']':
- case '^':
- case '_': case 'a':
- case 'b':
- case 'c':
- case 'd':
- case 'e':
- case 'f':
- case 'g':
- case 'h':
- case 'i':
- case 'j':
- case 'k':
- case 'l':
- case 'm':
- case 'n':
- case 'o':
- case 'p':
- case 'q':
- case 'r':
- case 's':
- case 't':
- case 'u':
- case 'v':
- case 'w':
- case 'x':
- case 'y':
- case 'z': goto yy107;
- default: goto yy96;
- }
-yy107: ++YYCURSOR;
- if(YYLIMIT == YYCURSOR) YYFILL(1);
- yych = *YYCURSOR;
- goto yy108;
-yy108: switch(yych){
- case '.':
- case '/':
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9':
- case ':':
- case ';':
- case '<':
- case '=':
- case '>':
- case '?':
- case '@':
- case 'A':
- case 'B':
- case 'C':
- case 'D':
- case 'E':
- case 'F':
- case 'G':
- case 'H':
- case 'I':
- case 'J':
- case 'K':
- case 'L':
- case 'M':
- case 'N':
- case 'O':
- case 'P':
- case 'Q':
- case 'R':
- case 'S':
- case 'T':
- case 'U':
- case 'V':
- case 'W':
- case 'X':
- case 'Y':
- case 'Z':
- case '[':
- case '\\':
- case ']':
- case '^':
- case '_': case 'a':
- case 'b':
- case 'c':
- case 'd':
- case 'e':
- case 'f':
- case 'g':
- case 'h':
- case 'i':
- case 'j':
- case 'k':
- case 'l':
- case 'm':
- case 'n':
- case 'o':
- case 'p':
- case 'q':
- case 'r':
- case 's':
- case 't':
- case 'u':
- case 'v':
- case 'w':
- case 'x':
- case 'y':
- case 'z': goto yy107;
- default: goto yy109;
- }
-yy109:
-#line 510 "token.re"
-{ goto Directive; }
-#line 1484 "<stdout>"
-}
-#line 517 "token.re"
-
-
- }
-
-Plain:
- {
- int qidx = 0;
- int qcapa = 100;
- char *qstr = S_ALLOC_N( char, qcapa );
- SyckLevel *plvl;
- int parentIndent;
-
- YYCURSOR = YYTOKEN;
- plvl = CURRENT_LEVEL();
- GET_TRUE_YAML_INDENT(parentIndent);
-
-Plain2:
- YYTOKEN = YYCURSOR;
-
-Plain3:
-
-
-#line 1509 "<stdout>"
-{
- YYCTYPE yych;
- unsigned int yyaccept;
- goto yy110;
- ++YYCURSOR;
-yy110:
- if((YYLIMIT - YYCURSOR) < 3) YYFILL(3);
- yych = *YYCURSOR;
- switch(yych){
- case 0x00: goto yy124;
- case 0x09: goto yy126;
- case 0x0A: goto yy112;
- case 0x0D: goto yy114;
- case ' ': goto yy122;
- case ',': goto yy117;
- case ':': goto yy116;
- case ']': goto yy120;
- case '}': goto yy118;
- default: goto yy127;
- }
-yy112: yyaccept = 0;
- yych = *(YYMARKER = ++YYCURSOR);
- goto yy142;
-yy113:
-#line 540 "token.re"
-{ int indt_len, nl_count = 0;
- SyckLevel *lvl;
- char *tok = YYTOKEN;
- GOBBLE_UP_YAML_INDENT( indt_len, tok );
- lvl = CURRENT_LEVEL();
-
- if ( indt_len <= parentIndent )
- {
- RETURN_IMPLICIT();
- }
-
- while ( YYTOKEN < YYCURSOR )
- {
- int nl_len = newline_len( YYTOKEN++ );
- if ( nl_len )
- {
- nl_count++;
- YYTOKEN += nl_len - 1;
- }
- }
- if ( nl_count <= 1 )
- {
- QUOTECAT(qstr, qcapa, qidx, ' ');
- }
- else
- {
- int i;
- for ( i = 0; i < nl_count - 1; i++ )
- {
- QUOTECAT(qstr, qcapa, qidx, '\n');
- }
- }
-
- goto Plain2;
- }
-#line 1570 "<stdout>"
-yy114: ++YYCURSOR;
- switch((yych = *YYCURSOR)) {
- case 0x0A: goto yy141;
- default: goto yy115;
- }
-yy115:
-#line 627 "token.re"
-{ QUOTECATS(qstr, qcapa, qidx, YYTOKEN, YYCURSOR - YYTOKEN);
- goto Plain2;
- }
-#line 1581 "<stdout>"
-yy116: yyaccept = 1;
- yych = *(YYMARKER = ++YYCURSOR);
- switch(yych){
- case 0x0A: goto yy136;
- case 0x0D: goto yy140;
- case ' ': goto yy138;
- default: goto yy115;
- }
-yy117: yyaccept = 1;
- yych = *(YYMARKER = ++YYCURSOR);
- switch(yych){
- case 0x0A: goto yy130;
- case 0x0D: goto yy134;
- case ' ': goto yy132;
- default: goto yy115;
- }
-yy118: ++YYCURSOR;
- goto yy119;
-yy119:
-#line 589 "token.re"
-{ if ( plvl->status != syck_lvl_imap )
- {
- PLAIN_NOT_INL();
- }
- else
- {
- PLAIN_IS_INL();
- }
- RETURN_IMPLICIT();
- }
-#line 1612 "<stdout>"
-yy120: ++YYCURSOR;
- goto yy121;
-yy121:
-#line 600 "token.re"
-{ if ( plvl->status != syck_lvl_iseq )
- {
- PLAIN_NOT_INL();
- }
- else
- {
- PLAIN_IS_INL();
- }
- RETURN_IMPLICIT();
- }
-#line 1627 "<stdout>"
-yy122: ++YYCURSOR;
- switch((yych = *YYCURSOR)) {
- case '#': goto yy128;
- default: goto yy123;
- }
-yy123:
-#line 617 "token.re"
-{ if ( qidx == 0 )
- {
- goto Plain2;
- }
- else
- {
- goto Plain3;
- }
- }
-#line 1644 "<stdout>"
-yy124: ++YYCURSOR;
- goto yy125;
-yy125:
-#line 615 "token.re"
-{ RETURN_IMPLICIT(); }
-#line 1650 "<stdout>"
-yy126: yych = *++YYCURSOR;
- goto yy123;
-yy127: yych = *++YYCURSOR;
- goto yy115;
-yy128: ++YYCURSOR;
- goto yy129;
-yy129:
-#line 611 "token.re"
-{ eat_comments( parser );
- RETURN_IMPLICIT();
- }
-#line 1662 "<stdout>"
-yy130: ++YYCURSOR;
- goto yy131;
-yy131:
-#line 578 "token.re"
-{ if ( plvl->status != syck_lvl_iseq && plvl->status != syck_lvl_imap )
- {
- PLAIN_NOT_INL();
- }
- else
- {
- PLAIN_IS_INL();
- }
- RETURN_IMPLICIT();
- }
-#line 1677 "<stdout>"
-yy132: ++YYCURSOR;
- if(YYLIMIT == YYCURSOR) YYFILL(1);
- yych = *YYCURSOR;
- goto yy133;
-yy133: switch(yych){
- case ' ': goto yy132;
- default: goto yy131;
- }
-yy134: yych = *++YYCURSOR;
- switch(yych){
- case 0x0A: goto yy130;
- default: goto yy135;
- }
-yy135: YYCURSOR = YYMARKER;
- switch(yyaccept){
- case 0: goto yy113;
- case 1: goto yy115;
- }
-yy136: ++YYCURSOR;
- goto yy137;
-yy137:
-#line 576 "token.re"
-{ RETURN_IMPLICIT(); }
-#line 1701 "<stdout>"
-yy138: ++YYCURSOR;
- if(YYLIMIT == YYCURSOR) YYFILL(1);
- yych = *YYCURSOR;
- goto yy139;
-yy139: switch(yych){
- case ' ': goto yy138;
- default: goto yy137;
- }
-yy140: yych = *++YYCURSOR;
- switch(yych){
- case 0x0A: goto yy136;
- default: goto yy135;
- }
-yy141: yyaccept = 0;
- YYMARKER = ++YYCURSOR;
- if(YYLIMIT == YYCURSOR) YYFILL(1);
- yych = *YYCURSOR;
- goto yy142;
-yy142: switch(yych){
- case 0x0A: case ' ': goto yy141;
- case 0x0D: goto yy143;
- default: goto yy113;
- }
-yy143: ++YYCURSOR;
- if(YYLIMIT == YYCURSOR) YYFILL(1);
- yych = *YYCURSOR;
- switch(yych){
- case 0x0A: goto yy141;
- default: goto yy135;
- }
-}
-#line 631 "token.re"
-
- }
-
-SingleQuote:
- {
- int qidx = 0;
- int qcapa = 100;
- char *qstr = S_ALLOC_N( char, qcapa );
-
-SingleQuote2:
- YYTOKEN = YYCURSOR;
-
-
-#line 1747 "<stdout>"
-{
- YYCTYPE yych;
- unsigned int yyaccept;
- goto yy144;
- ++YYCURSOR;
-yy144:
- if((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
- yych = *YYCURSOR;
- switch(yych){
- case 0x00: goto yy152;
- case 0x0A: goto yy146;
- case 0x0D: goto yy148;
- case '\'': goto yy150;
- default: goto yy153;
- }
-yy146: yyaccept = 0;
- yych = *(YYMARKER = ++YYCURSOR);
- goto yy157;
-yy147:
-#line 645 "token.re"
-{ int indt_len;
- int nl_count = 0;
- SyckLevel *lvl;
- GOBBLE_UP_YAML_INDENT( indt_len, YYTOKEN );
- lvl = CURRENT_LEVEL();
-
- if ( lvl->status != syck_lvl_str )
- {
- ADD_LEVEL( indt_len, syck_lvl_str );
- }
- else if ( indt_len < lvl->spaces )
- {
- /* Error! */
- }
-
- while ( YYTOKEN < YYCURSOR )
- {
- int nl_len = newline_len( YYTOKEN++ );
- if ( nl_len )
- {
- nl_count++;
- YYTOKEN += nl_len - 1;
- }
- }
- if ( nl_count <= 1 )
- {
- QUOTECAT(qstr, qcapa, qidx, ' ');
- }
- else
- {
- int i;
- for ( i = 0; i < nl_count - 1; i++ )
- {
- QUOTECAT(qstr, qcapa, qidx, '\n');
- }
- }
-
- goto SingleQuote2;
- }
-#line 1807 "<stdout>"
-yy148: ++YYCURSOR;
- switch((yych = *YYCURSOR)) {
- case 0x0A: goto yy156;
- default: goto yy149;
- }
-yy149:
-#line 712 "token.re"
-{ QUOTECAT(qstr, qcapa, qidx, *(YYCURSOR - 1));
- goto SingleQuote2;
- }
-#line 1818 "<stdout>"
-yy150: ++YYCURSOR;
- switch((yych = *YYCURSOR)) {
- case '\'': goto yy154;
- default: goto yy151;
- }
-yy151:
-#line 689 "token.re"
-{ SyckLevel *lvl;
- SyckNode *n = syck_alloc_str();
- lvl = CURRENT_LEVEL();
-
- if ( lvl->status == syck_lvl_str )
- {
- POP_LEVEL();
- }
- if ( ((SyckParser *)parser)->taguri_expansion == 1 )
- {
- n->type_id = syck_taguri( YAML_DOMAIN, "str", 3 );
- }
- else
- {
- n->type_id = syck_strndup( "str", 3 );
- }
- n->data.str->ptr = qstr;
- n->data.str->len = qidx;
- n->data.str->style = scalar_1quote;
- sycklval->nodeData = n;
- return YAML_PLAIN;
- }
-#line 1848 "<stdout>"
-yy152: yych = *++YYCURSOR;
- goto yy151;
-yy153: yych = *++YYCURSOR;
- goto yy149;
-yy154: ++YYCURSOR;
- goto yy155;
-yy155:
-#line 685 "token.re"
-{ QUOTECAT(qstr, qcapa, qidx, '\'');
- goto SingleQuote2;
- }
-#line 1860 "<stdout>"
-yy156: yyaccept = 0;
- YYMARKER = ++YYCURSOR;
- if(YYLIMIT == YYCURSOR) YYFILL(1);
- yych = *YYCURSOR;
- goto yy157;
-yy157: switch(yych){
- case 0x0A: case ' ': goto yy156;
- case 0x0D: goto yy158;
- default: goto yy147;
- }
-yy158: ++YYCURSOR;
- if(YYLIMIT == YYCURSOR) YYFILL(1);
- yych = *YYCURSOR;
- switch(yych){
- case 0x0A: goto yy156;
- default: goto yy159;
- }
-yy159: YYCURSOR = YYMARKER;
- switch(yyaccept){
- case 0: goto yy147;
- }
-}
-#line 716 "token.re"
-
-
- }
-
-
-DoubleQuote:
- {
- int keep_nl = 1;
- int qidx = 0;
- int qcapa = 100;
- char *qstr = S_ALLOC_N( char, qcapa );
-
-DoubleQuote2:
- YYTOKEN = YYCURSOR;
-
-
-
-#line 1901 "<stdout>"
-{
- YYCTYPE yych;
- unsigned int yyaccept;
- goto yy160;
- ++YYCURSOR;
-yy160:
- if((YYLIMIT - YYCURSOR) < 4) YYFILL(4);
- yych = *YYCURSOR;
- switch(yych){
- case 0x00: goto yy167;
- case 0x0A: goto yy162;
- case 0x0D: goto yy164;
- case '"': goto yy169;
- case '\\': goto yy166;
- default: goto yy170;
- }
-yy162: yyaccept = 0;
- yych = *(YYMARKER = ++YYCURSOR);
- goto yy184;
-yy163:
-#line 734 "token.re"
-{ int indt_len;
- int nl_count = 0;
- SyckLevel *lvl;
- GOBBLE_UP_YAML_INDENT( indt_len, YYTOKEN );
- lvl = CURRENT_LEVEL();
-
- if ( lvl->status != syck_lvl_str )
- {
- ADD_LEVEL( indt_len, syck_lvl_str );
- }
- else if ( indt_len < lvl->spaces )
- {
- /* FIXME */
- }
-
- if ( keep_nl == 1 )
- {
- while ( YYTOKEN < YYCURSOR )
- {
- int nl_len = newline_len( YYTOKEN++ );
- if ( nl_len )
- {
- nl_count++;
- YYTOKEN += nl_len - 1;
- }
- }
- if ( nl_count <= 1 )
- {
- QUOTECAT(qstr, qcapa, qidx, ' ');
- }
- else
- {
- int i;
- for ( i = 0; i < nl_count - 1; i++ )
- {
- QUOTECAT(qstr, qcapa, qidx, '\n');
- }
- }
- }
-
- keep_nl = 1;
- goto DoubleQuote2;
- }
-#line 1966 "<stdout>"
-yy164: ++YYCURSOR;
- switch((yych = *YYCURSOR)) {
- case 0x0A: goto yy183;
- default: goto yy165;
- }
-yy165:
-#line 820 "token.re"
-{ QUOTECAT(qstr, qcapa, qidx, *(YYCURSOR - 1));
- goto DoubleQuote2;
- }
-#line 1977 "<stdout>"
-yy166: yyaccept = 1;
- yych = *(YYMARKER = ++YYCURSOR);
- switch(yych){
- case 0x0A: goto yy174;
- case 0x0D: goto yy176;
- case ' ': goto yy171;
- case '"': case '0': case '\\': case 'a':
- case 'b': case 'e':
- case 'f': case 'n': case 'r': case 't': case 'v': goto yy178;
- case 'x': goto yy177;
- default: goto yy165;
- }
-yy167: ++YYCURSOR;
- goto yy168;
-yy168:
-#line 797 "token.re"
-{ SyckLevel *lvl;
- SyckNode *n = syck_alloc_str();
- lvl = CURRENT_LEVEL();
-
- if ( lvl->status == syck_lvl_str )
- {
- POP_LEVEL();
- }
- if ( ((SyckParser *)parser)->taguri_expansion == 1 )
- {
- n->type_id = syck_taguri( YAML_DOMAIN, "str", 3 );
- }
- else
- {
- n->type_id = syck_strndup( "str", 3 );
- }
- n->data.str->ptr = qstr;
- n->data.str->len = qidx;
- n->data.str->style = scalar_2quote;
- sycklval->nodeData = n;
- return YAML_PLAIN;
- }
-#line 2016 "<stdout>"
-yy169: yych = *++YYCURSOR;
- goto yy168;
-yy170: yych = *++YYCURSOR;
- goto yy165;
-yy171: ++YYCURSOR;
- if((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
- yych = *YYCURSOR;
- goto yy172;
-yy172: switch(yych){
- case 0x0A: goto yy174;
- case 0x0D: goto yy176;
- case ' ': goto yy171;
- default: goto yy173;
- }
-yy173: YYCURSOR = YYMARKER;
- switch(yyaccept){
- case 0: goto yy163;
- case 1: goto yy165;
- }
-yy174: ++YYCURSOR;
- goto yy175;
-yy175:
-#line 792 "token.re"
-{ keep_nl = 0;
- YYCURSOR--;
- goto DoubleQuote2;
- }
-#line 2044 "<stdout>"
-yy176: yych = *++YYCURSOR;
- switch(yych){
- case 0x0A: goto yy174;
- default: goto yy173;
- }
-yy177: yych = *++YYCURSOR;
- switch(yych){
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': case 'A':
- case 'B':
- case 'C':
- case 'D':
- case 'E':
- case 'F': case 'a':
- case 'b':
- case 'c':
- case 'd':
- case 'e':
- case 'f': goto yy180;
- default: goto yy173;
- }
-yy178: ++YYCURSOR;
- goto yy179;
-yy179:
-#line 778 "token.re"
-{ char ch = *( YYCURSOR - 1 );
- QUOTECAT(qstr, qcapa, qidx, escape_seq( ch ));
- goto DoubleQuote2;
- }
-#line 2082 "<stdout>"
-yy180: yych = *++YYCURSOR;
- switch(yych){
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': case 'A':
- case 'B':
- case 'C':
- case 'D':
- case 'E':
- case 'F': case 'a':
- case 'b':
- case 'c':
- case 'd':
- case 'e':
- case 'f': goto yy181;
- default: goto yy173;
- }
-yy181: ++YYCURSOR;
- goto yy182;
-yy182:
-#line 783 "token.re"
-{ long ch;
- char *chr_text = syck_strndup( YYTOKEN, 4 );
- chr_text[0] = '0';
- ch = strtol( chr_text, NULL, 16 );
- free( chr_text );
- QUOTECAT(qstr, qcapa, qidx, ch);
- goto DoubleQuote2;
- }
-#line 2119 "<stdout>"
-yy183: yyaccept = 0;
- YYMARKER = ++YYCURSOR;
- if(YYLIMIT == YYCURSOR) YYFILL(1);
- yych = *YYCURSOR;
- goto yy184;
-yy184: switch(yych){
- case 0x0A: case ' ': goto yy183;
- case 0x0D: goto yy185;
- default: goto yy163;
- }
-yy185: ++YYCURSOR;
- if(YYLIMIT == YYCURSOR) YYFILL(1);
- yych = *YYCURSOR;
- switch(yych){
- case 0x0A: goto yy183;
- default: goto yy173;
- }
-}
-#line 824 "token.re"
-
- }
-
-TransferMethod:
- {
- int qidx = 0;
- int qcapa = 100;
- char *qstr = S_ALLOC_N( char, qcapa );
-
-TransferMethod2:
- YYTOKTMP = YYCURSOR;
-
-
-#line 2152 "<stdout>"
-{
- YYCTYPE yych;
- unsigned int yyaccept;
- goto yy186;
- ++YYCURSOR;
-yy186:
- if((YYLIMIT - YYCURSOR) < 4) YYFILL(4);
- yych = *YYCURSOR;
- switch(yych){
- case 0x00: goto yy188;
- case 0x0A: goto yy190;
- case 0x0D: goto yy192;
- case ' ': goto yy191;
- case '\\': goto yy194;
- default: goto yy195;
- }
-yy188: ++YYCURSOR;
- goto yy189;
-yy189:
-#line 838 "token.re"
-{ SyckLevel *lvl;
- YYCURSOR = YYTOKTMP;
- if ( YYCURSOR == YYTOKEN + 1 )
- {
- free( qstr );
- return YAML_ITRANSFER;
- }
-
- lvl = CURRENT_LEVEL();
-
- /*
- * URL Prefixing
- */
- if ( *qstr == '^' )
- {
- sycklval->name = S_ALLOC_N( char, qidx + strlen( lvl->domain ) );
- sycklval->name[0] = '\0';
- strcat( sycklval->name, lvl->domain );
- strncat( sycklval->name, qstr + 1, qidx - 1 );
- free( qstr );
- }
- else
- {
- char *carat = qstr;
- char *qend = qstr + qidx;
- while ( (++carat) < qend )
- {
- if ( *carat == '^' )
- break;
- }
-
- if ( carat < qend )
- {
- free( lvl->domain );
- lvl->domain = syck_strndup( qstr, carat - qstr );
- sycklval->name = S_ALLOC_N( char, ( qend - carat ) + strlen( lvl->domain ) );
- sycklval->name[0] = '\0';
- strcat( sycklval->name, lvl->domain );
- strncat( sycklval->name, carat + 1, ( qend - carat ) - 1 );
- free( qstr );
- }
- else
- {
- sycklval->name = qstr;
- }
- }
-
- return YAML_TRANSFER;
- }
-#line 2222 "<stdout>"
-yy190: yych = *++YYCURSOR;
- goto yy189;
-yy191: yych = *++YYCURSOR;
- goto yy204;
-yy192: ++YYCURSOR;
- switch((yych = *YYCURSOR)) {
- case 0x0A: goto yy188;
- default: goto yy193;
- }
-yy193:
-#line 905 "token.re"
-{ QUOTECAT(qstr, qcapa, qidx, *(YYCURSOR - 1));
- goto TransferMethod2;
- }
-#line 2237 "<stdout>"
-yy194: yyaccept = 0;
- yych = *(YYMARKER = ++YYCURSOR);
- switch(yych){
- case '"': case '0': case '\\': case 'a':
- case 'b': case 'e':
- case 'f': case 'n': case 'r': case 't': case 'v': goto yy198;
- case 'x': goto yy196;
- default: goto yy193;
- }
-yy195: yych = *++YYCURSOR;
- goto yy193;
-yy196: yych = *++YYCURSOR;
- switch(yych){
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': case 'A':
- case 'B':
- case 'C':
- case 'D':
- case 'E':
- case 'F': case 'a':
- case 'b':
- case 'c':
- case 'd':
- case 'e':
- case 'f': goto yy200;
- default: goto yy197;
- }
-yy197: YYCURSOR = YYMARKER;
- switch(yyaccept){
- case 0: goto yy193;
- }
-yy198: ++YYCURSOR;
- goto yy199;
-yy199:
-#line 891 "token.re"
-{ char ch = *( YYCURSOR - 1 );
- QUOTECAT(qstr, qcapa, qidx, escape_seq( ch ));
- goto TransferMethod2;
- }
-#line 2285 "<stdout>"
-yy200: yych = *++YYCURSOR;
- switch(yych){
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': case 'A':
- case 'B':
- case 'C':
- case 'D':
- case 'E':
- case 'F': case 'a':
- case 'b':
- case 'c':
- case 'd':
- case 'e':
- case 'f': goto yy201;
- default: goto yy197;
- }
-yy201: ++YYCURSOR;
- goto yy202;
-yy202:
-#line 896 "token.re"
-{ long ch;
- char *chr_text = syck_strndup( YYTOKTMP, 4 );
- chr_text[0] = '0';
- ch = strtol( chr_text, NULL, 16 );
- free( chr_text );
- QUOTECAT(qstr, qcapa, qidx, ch);
- goto TransferMethod2;
- }
-#line 2322 "<stdout>"
-yy203: ++YYCURSOR;
- if(YYLIMIT == YYCURSOR) YYFILL(1);
- yych = *YYCURSOR;
- goto yy204;
-yy204: switch(yych){
- case ' ': goto yy203;
- default: goto yy189;
- }
-}
-#line 910 "token.re"
-
- }
-
-ScalarBlock:
- {
- int qidx = 0;
- int qcapa = 100;
- char *qstr = S_ALLOC_N( char, qcapa );
- int blockType = 0;
- int nlDoWhat = 0;
- int lastIndent = 0;
- int forceIndent = -1;
- char *yyt = YYTOKEN;
- SyckLevel *lvl = CURRENT_LEVEL();
- int parentIndent = -1;
-
- switch ( *yyt )
- {
- case '|': blockType = BLOCK_LIT; break;
- case '>': blockType = BLOCK_FOLD; break;
- }
-
- while ( ++yyt <= YYCURSOR )
- {
- if ( *yyt == '-' )
- {
- nlDoWhat = NL_CHOMP;
- }
- else if ( *yyt == '+' )
- {
- nlDoWhat = NL_KEEP;
- }
- else if ( isdigit( *yyt ) )
- {
- forceIndent = rb_long2int(strtol( yyt, NULL, 10 ));
- }
- }
-
- qstr[0] = '\0';
- YYTOKEN = YYCURSOR;
-
-ScalarBlock2:
- YYTOKEN = YYCURSOR;
-
-
-#line 2378 "<stdout>"
-{
- YYCTYPE yych;
- unsigned int yyaccept;
- goto yy205;
- ++YYCURSOR;
-yy205:
- if((YYLIMIT - YYCURSOR) < 5) YYFILL(5);
- yych = *YYCURSOR;
- switch(yych){
- case 0x00: goto yy213;
- case 0x0A: goto yy207;
- case 0x0D: goto yy209;
- case '#': goto yy211;
- case '-': goto yy215;
- default: goto yy216;
- }
-yy207: yyaccept = 0;
- yych = *(YYMARKER = ++YYCURSOR);
- goto yy226;
-yy208:
-#line 956 "token.re"
-{ char *pacer;
- char *tok = YYTOKEN;
- int indt_len = 0, nl_count = 0, fold_nl = 0, nl_begin = 0;
- GOBBLE_UP_YAML_INDENT( indt_len, tok );
- lvl = CURRENT_LEVEL();
-
- if ( lvl->status != syck_lvl_block )
- {
- GET_TRUE_YAML_INDENT(parentIndent);
- if ( forceIndent > 0 ) forceIndent += parentIndent;
- if ( indt_len > parentIndent )
- {
- int new_spaces = forceIndent > 0 ? forceIndent : indt_len;
- ADD_LEVEL( new_spaces, syck_lvl_block );
- lastIndent = indt_len - new_spaces;
- nl_begin = 1;
- lvl = CURRENT_LEVEL();
- }
- else
- {
- YYCURSOR = YYTOKEN;
- RETURN_YAML_BLOCK();
- }
- }
-
- /*
- * Fold only in the event of two lines being on the leftmost
- * indentation.
- */
- if ( blockType == BLOCK_FOLD && lastIndent == 0 && ( indt_len - lvl->spaces ) == 0 )
- {
- fold_nl = 1;
- }
-
- pacer = YYTOKEN;
- while ( pacer < YYCURSOR )
- {
- int nl_len = newline_len( pacer++ );
- if ( nl_len )
- {
- nl_count++;
- pacer += nl_len - 1;
- }
- }
-
- if ( fold_nl == 1 || nl_begin == 1 )
- {
- nl_count--;
- }
-
- if ( nl_count < 1 && nl_begin == 0 )
- {
- QUOTECAT(qstr, qcapa, qidx, ' ');
- }
- else
- {
- int i;
- for ( i = 0; i < nl_count; i++ )
- {
- QUOTECAT(qstr, qcapa, qidx, '\n');
- }
- }
-
- lastIndent = indt_len - lvl->spaces;
- YYCURSOR -= lastIndent;
-
- if ( indt_len < lvl->spaces )
- {
- POP_LEVEL();
- YYCURSOR = YYTOKEN;
- RETURN_YAML_BLOCK();
- }
- goto ScalarBlock2;
- }
-#line 2474 "<stdout>"
-yy209: ++YYCURSOR;
- switch((yych = *YYCURSOR)) {
- case 0x0A: goto yy225;
- default: goto yy210;
- }
-yy210:
-#line 1070 "token.re"
-{ QUOTECAT(qstr, qcapa, qidx, *YYTOKEN);
- goto ScalarBlock2;
- }
-#line 2485 "<stdout>"
-yy211: ++YYCURSOR;
- goto yy212;
-yy212:
-#line 1032 "token.re"
-{ lvl = CURRENT_LEVEL();
- if ( lvl->status != syck_lvl_block )
- {
- eat_comments( parser );
- YYTOKEN = YYCURSOR;
- }
- else
- {
- QUOTECAT(qstr, qcapa, qidx, *YYTOKEN);
- }
- goto ScalarBlock2;
- }
-#line 2502 "<stdout>"
-yy213: ++YYCURSOR;
- goto yy214;
-yy214:
-#line 1046 "token.re"
-{ YYCURSOR--;
- POP_LEVEL();
- RETURN_YAML_BLOCK();
- }
-#line 2511 "<stdout>"
-yy215: yyaccept = 1;
- yych = *(YYMARKER = ++YYCURSOR);
- switch(yych){
- case '-': goto yy217;
- default: goto yy210;
- }
-yy216: yych = *++YYCURSOR;
- goto yy210;
-yy217: yych = *++YYCURSOR;
- switch(yych){
- case '-': goto yy219;
- default: goto yy218;
- }
-yy218: YYCURSOR = YYMARKER;
- switch(yyaccept){
- case 0: goto yy208;
- case 1: goto yy210;
- }
-yy219: yych = *++YYCURSOR;
- switch(yych){
- case 0x0A: goto yy220;
- case 0x0D: goto yy224;
- case ' ': goto yy222;
- default: goto yy218;
- }
-yy220: ++YYCURSOR;
- goto yy221;
-yy221:
-#line 1051 "token.re"
-{ if ( YYTOKEN == YYLINEPTR )
- {
- if ( blockType == BLOCK_FOLD && qidx > 0 )
- {
- qidx -= 1;
- }
- QUOTECAT(qstr, qcapa, qidx, '\n');
- POP_LEVEL();
- YYCURSOR = YYTOKEN;
- RETURN_YAML_BLOCK();
- }
- else
- {
- QUOTECAT(qstr, qcapa, qidx, *YYTOKEN);
- YYCURSOR = YYTOKEN + 1;
- goto ScalarBlock2;
- }
- }
-#line 2559 "<stdout>"
-yy222: ++YYCURSOR;
- if(YYLIMIT == YYCURSOR) YYFILL(1);
- yych = *YYCURSOR;
- goto yy223;
-yy223: switch(yych){
- case ' ': goto yy222;
- default: goto yy221;
- }
-yy224: yych = *++YYCURSOR;
- switch(yych){
- case 0x0A: goto yy220;
- default: goto yy218;
- }
-yy225: yyaccept = 0;
- YYMARKER = ++YYCURSOR;
- if(YYLIMIT == YYCURSOR) YYFILL(1);
- yych = *YYCURSOR;
- goto yy226;
-yy226: switch(yych){
- case 0x0A: case ' ': goto yy225;
- case 0x0D: goto yy227;
- default: goto yy208;
- }
-yy227: ++YYCURSOR;
- if(YYLIMIT == YYCURSOR) YYFILL(1);
- yych = *YYCURSOR;
- switch(yych){
- case 0x0A: goto yy225;
- default: goto yy218;
- }
-}
-#line 1075 "token.re"
-
- }
-
- return 0;
-
-}
-
-void
-eat_comments( SyckParser *parser )
-{
-Comment:
- {
- YYTOKEN = YYCURSOR;
-
-
-#line 2607 "<stdout>"
-{
- YYCTYPE yych;
- unsigned int yyaccept;
- goto yy228;
- ++YYCURSOR;
-yy228:
- if((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
- yych = *YYCURSOR;
- switch(yych){
- case 0x00: goto yy230;
- case 0x0A: goto yy232;
- case 0x0D: goto yy233;
- default: goto yy235;
- }
-yy230: ++YYCURSOR;
- goto yy231;
-yy231:
-#line 1091 "token.re"
-{ YYCURSOR = YYTOKEN;
- return;
- }
-#line 2629 "<stdout>"
-yy232: yyaccept = 0;
- yych = *(YYMARKER = ++YYCURSOR);
- goto yy237;
-yy233: ++YYCURSOR;
- switch((yych = *YYCURSOR)) {
- case 0x0A: goto yy236;
- default: goto yy234;
- }
-yy234:
-#line 1095 "token.re"
-{ goto Comment;
- }
-#line 2642 "<stdout>"
-yy235: yych = *++YYCURSOR;
- goto yy234;
-yy236: yyaccept = 0;
- YYMARKER = ++YYCURSOR;
- if(YYLIMIT == YYCURSOR) YYFILL(1);
- yych = *YYCURSOR;
- goto yy237;
-yy237: switch(yych){
- case 0x0A: goto yy236;
- case 0x0D: goto yy238;
- default: goto yy231;
- }
-yy238: ++YYCURSOR;
- if(YYLIMIT == YYCURSOR) YYFILL(1);
- yych = *YYCURSOR;
- switch(yych){
- case 0x0A: goto yy236;
- default: goto yy239;
- }
-yy239: YYCURSOR = YYMARKER;
- switch(yyaccept){
- case 0: goto yy231;
- }
-}
-#line 1098 "token.re"
-
-
- }
-
-}
-
-char
-escape_seq( char ch )
-{
- switch ( ch )
- {
- case '0': return '\0';
- case 'a': return 7;
- case 'b': return '\010';
- case 'e': return '\033';
- case 'f': return '\014';
- case 'n': return '\n';
- case 'r': return '\015';
- case 't': return '\t';
- case 'v': return '\013';
- default: return ch;
- }
-}
-
-int
-is_newline( char *ptr )
-{
- return newline_len( ptr );
-}
-
-int
-newline_len( char *ptr )
-{
- if ( *ptr == '\n' )
- return 1;
-
- if ( *ptr == '\r' && *( ptr + 1 ) == '\n' )
- return 2;
-
- return 0;
-}
-
-int
-syckwrap()
-{
- return 1;
-}
-
-void
-syckerror( const char *msg )
-{
- if ( syck_parser_ptr->error_handler == NULL )
- syck_parser_ptr->error_handler = syck_default_error_handler;
-
- syck_parser_ptr->root = syck_parser_ptr->root_on_error;
- (syck_parser_ptr->error_handler)(syck_parser_ptr, msg);
-}
-
diff --git a/ext/syck/yaml2byte.c b/ext/syck/yaml2byte.c
deleted file mode 100644
index e5cc4e0779..0000000000
--- a/ext/syck/yaml2byte.c
+++ /dev/null
@@ -1,259 +0,0 @@
-/*
- * yaml2byte.c
- *
- * $Author$
- *
- * Copyright (C) 2003 why the lucky stiff, clark evans
- *
- * WARNING WARNING WARNING --- THIS IS *NOT JUST* PLAYING
- * ANYMORE! -- WHY HAS EMBRACED THIS AS THE REAL THING!
- */
-#include "ruby/ruby.h"
-#include <syck.h>
-#include <assert.h>
-#define YAMLBYTE_UTF8
-#include "yamlbyte.h"
-
-#include <stdio.h>
-#define TRACE0(a) \
- do { printf(a); printf("\n"); fflush(stdout); } while(0)
-#define TRACE1(a,b) \
- do { printf(a,b); printf("\n"); fflush(stdout); } while(0)
-#define TRACE2(a,b,c) \
- do { printf(a,b,c); printf("\n"); fflush(stdout); } while(0)
-#define TRACE3(a,b,c,d) \
- do { printf(a,b,c,d); printf("\n"); fflush(stdout); } while(0)
-
-/* Reinvent the wheel... */
-#define CHUNKSIZE 64
-#define HASH ((long)0xCAFECAFE)
-typedef struct {
- long hash;
- char *buffer;
- long length;
- long remaining;
- int printed;
-} bytestring_t;
-bytestring_t *bytestring_alloc(void) {
- bytestring_t *ret;
- /*TRACE0("bytestring_alloc()");*/
- ret = S_ALLOC(bytestring_t);
- ret->hash = HASH;
- ret->length = CHUNKSIZE;
- ret->remaining = ret->length;
- ret->buffer = S_ALLOC_N(char, ret->length + 1 );
- ret->buffer[0] = 0;
- ret->printed = 0;
- return ret;
-}
-void bytestring_append(bytestring_t *str, char code,
- char *start, char *finish)
-{
- long grow;
- long length = 2; /* CODE + LF */
- char *curr;
- assert(str && HASH == str->hash);
- /*TRACE0("bytestring_append()");*/
- if(start) {
- if(!finish)
- finish = start + strlen(start);
- length += (finish-start);
- }
- if(length > str->remaining) {
- grow = (length - str->remaining) + CHUNKSIZE;
- str->remaining += grow;
- str->length += grow;
- S_REALLOC_N( str->buffer, char, str->length + 1 );
- assert(str->buffer);
- }
- curr = str->buffer + (str->length - str->remaining);
- *curr = code;
- curr += 1;
- if(start)
- while(start < finish)
- *curr ++ = *start ++;
- *curr = '\n';
- curr += 1;
- *curr = 0;
- str->remaining = str->remaining - length;
- assert( (str->buffer + str->length) - str->remaining );
-}
-void bytestring_extend(bytestring_t *str, bytestring_t *ext)
-{
- char *from;
- char *curr;
- char *stop;
- long grow;
- long length;
- assert(str && HASH == str->hash);
- assert(ext && HASH == ext->hash);
- if(ext->printed) {
- assert(ext->buffer[0] ==YAMLBYTE_ANCHOR);
- curr = ext->buffer;
- while( '\n' != *curr)
- curr++;
- bytestring_append(str, YAMLBYTE_ALIAS, ext->buffer + 1, curr);
- } else {
- ext->printed = 1;
- length = (ext->length - ext->remaining);
- if(length > str->remaining) {
- grow = (length - str->remaining) + CHUNKSIZE;
- str->remaining += grow;
- str->length += grow;
- S_REALLOC_N( str->buffer, char, str->length + 1 );
- }
- curr = str->buffer + (str->length - str->remaining);
- from = ext->buffer;
- stop = ext->buffer + length;
- while( from < stop )
- *curr ++ = *from ++;
- *curr = 0;
- str->remaining = str->remaining - length;
- assert( (str->buffer + str->length) - str->remaining );
- }
-}
-
-/* convert SyckNode into yamlbyte_buffer_t objects */
-SYMID
-syck_yaml2byte_handler(p, n)
- SyckParser *p;
- SyckNode *n;
-{
- SYMID oid;
- long i;
- char ch;
- char nextcode;
- char *start;
- char *current;
- char *finish;
- bytestring_t *val = NULL;
- bytestring_t *sav = NULL;
- void *data;
- /*TRACE0("syck_yaml2byte_handler()");*/
- val = bytestring_alloc();
- if(n->anchor) bytestring_append(val,YAMLBYTE_ANCHOR, n->anchor, NULL);
- if ( n->type_id )
- {
- if ( p->taguri_expansion )
- {
- bytestring_append(val,YAMLBYTE_TRANSFER, n->type_id, NULL);
- }
- else
- {
- char *type_tag = S_ALLOC_N( char, strlen( n->type_id ) + 1 );
- type_tag[0] = '\0';
- strcat( type_tag, "!" );
- strcat( type_tag, n->type_id );
- bytestring_append( val, YAMLBYTE_TRANSFER, type_tag, NULL);
- S_FREE(type_tag);
- }
- }
- switch (n->kind)
- {
- case syck_str_kind:
- nextcode = YAMLBYTE_SCALAR;
- start = n->data.str->ptr;
- finish = start + n->data.str->len - 1;
- current = start;
- /*TRACE2("SCALAR: %s %d", start, n->data.str->len); */
- while(1) {
- ch = *current;
- if('\n' == ch || 0 == ch || current > finish) {
- if(current >= start) {
- bytestring_append(val, nextcode, start, current);
- nextcode = YAMLBYTE_CONTINUE;
- }
- start = current + 1;
- if(current > finish)
- {
- break;
- }
- else if('\n' == ch )
- {
- bytestring_append(val,YAMLBYTE_NEWLINE,NULL,NULL);
- }
- else if(0 == ch)
- {
- bytestring_append(val,YAMLBYTE_NULLCHAR,NULL,NULL);
- }
- else
- {
- assert("oops");
- }
- }
- current += 1;
- }
- break;
- case syck_seq_kind:
- bytestring_append(val,YAMLBYTE_SEQUENCE,NULL,NULL);
- for ( i = 0; i < n->data.list->idx; i++ )
- {
- oid = syck_seq_read( n, i );
- if (syck_lookup_sym( p, oid, &data )) sav = data;
- bytestring_extend(val, sav);
- }
- bytestring_append(val,YAMLBYTE_END_BRANCH,NULL,NULL);
- break;
- case syck_map_kind:
- bytestring_append(val,YAMLBYTE_MAPPING,NULL,NULL);
- for ( i = 0; i < n->data.pairs->idx; i++ )
- {
- oid = syck_map_read( n, map_key, i );
- if (syck_lookup_sym( p, oid, &data )) sav = data;
- bytestring_extend(val, sav);
- oid = syck_map_read( n, map_value, i );
- if (syck_lookup_sym( p, oid, &data )) sav = data;
- bytestring_extend(val, sav);
- }
- bytestring_append(val,YAMLBYTE_END_BRANCH,NULL,NULL);
- break;
- }
- oid = syck_add_sym( p, (char *) val );
- /*TRACE1("Saving: %s", val->buffer );*/
- return oid;
-}
-
-char *
-syck_yaml2byte(char *yamlstr)
-{
- SYMID oid;
- char *ret;
- bytestring_t *sav;
- void *data;
-
- SyckParser *parser = syck_new_parser();
- syck_parser_str_auto( parser, yamlstr, NULL );
- syck_parser_handler( parser, syck_yaml2byte_handler );
- syck_parser_error_handler( parser, NULL );
- syck_parser_implicit_typing( parser, 1 );
- syck_parser_taguri_expansion( parser, 1 );
- oid = syck_parse( parser );
-
- if ( syck_lookup_sym( parser, oid, &data ) ) {
- sav = data;
- ret = S_ALLOC_N( char, strlen( sav->buffer ) + 3 );
- ret[0] = '\0';
- strcat( ret, "D\n" );
- strcat( ret, sav->buffer );
- }
- else
- {
- ret = NULL;
- }
-
- syck_free_parser( parser );
- return ret;
-}
-
-#ifdef TEST_YBEXT
-#include <stdio.h>
-int main() {
- char *yaml = "test: 1\nand: \"with new\\nline\\n\"\nalso: &3 three\nmore: *3";
- printf("--- # YAML \n");
- printf(yaml);
- printf("\n...\n");
- printf(syck_yaml2byte(yaml));
- return 0;
-}
-#endif
-
diff --git a/ext/syck/yamlbyte.h b/ext/syck/yamlbyte.h
deleted file mode 100644
index 16ca3d70de..0000000000
--- a/ext/syck/yamlbyte.h
+++ /dev/null
@@ -1,171 +0,0 @@
-/* yamlbyte.h
- *
- * The YAML bytecode "C" interface header file. See the YAML bytecode
- * reference for bytecode sequence rules and for the meaning of each
- * bytecode.
- */
-
-#ifndef YAMLBYTE_H
-#define YAMLBYTE_H
-#include <stddef.h>
-
-/* define what a character is */
-typedef unsigned char yamlbyte_utf8_t;
-typedef unsigned short yamlbyte_utf16_t;
-#ifdef YAMLBYTE_UTF8
- #ifdef YAMLBYTE_UTF16
- #error Must only define YAMLBYTE_UTF8 or YAMLBYTE_UTF16
- #endif
- typedef yamlbyte_utf8_t yamlbyte_char_t;
-#else
- #ifdef YAMLBYTE_UTF16
- typedef yamlbyte_utf16_t yamlbyte_char_t;
- #else
- #error Must define YAMLBYTE_UTF8 or YAMLBYTE_UTF16
- #endif
-#endif
-
-/* specify list of bytecodes */
-#define YAMLBYTE_FINISH ((yamlbyte_char_t) 0)
-#define YAMLBYTE_DOCUMENT ((yamlbyte_char_t)'D')
-#define YAMLBYTE_DIRECTIVE ((yamlbyte_char_t)'V')
-#define YAMLBYTE_PAUSE ((yamlbyte_char_t)'P')
-#define YAMLBYTE_MAPPING ((yamlbyte_char_t)'M')
-#define YAMLBYTE_SEQUENCE ((yamlbyte_char_t)'Q')
-#define YAMLBYTE_END_BRANCH ((yamlbyte_char_t)'E')
-#define YAMLBYTE_SCALAR ((yamlbyte_char_t)'S')
-#define YAMLBYTE_CONTINUE ((yamlbyte_char_t)'C')
-#define YAMLBYTE_NEWLINE ((yamlbyte_char_t)'N')
-#define YAMLBYTE_NULLCHAR ((yamlbyte_char_t)'Z')
-#define YAMLBYTE_ANCHOR ((yamlbyte_char_t)'A')
-#define YAMLBYTE_ALIAS ((yamlbyte_char_t)'R')
-#define YAMLBYTE_TRANSFER ((yamlbyte_char_t)'T')
-/* formatting bytecodes */
-#define YAMLBYTE_COMMENT ((yamlbyte_char_t)'c')
-#define YAMLBYTE_INDENT ((yamlbyte_char_t)'i')
-#define YAMLBYTE_STYLE ((yamlbyte_char_t)'s')
-/* other bytecodes */
-#define YAMLBYTE_LINE_NUMBER ((yamlbyte_char_t)'#')
-#define YAMLBYTE_WHOLE_SCALAR ((yamlbyte_char_t)'<')
-#define YAMLBYTE_NOTICE ((yamlbyte_char_t)'!')
-#define YAMLBYTE_SPAN ((yamlbyte_char_t)')')
-#define YAMLBYTE_ALLOC ((yamlbyte_char_t)'@')
-
-/* second level style bytecodes, ie "s>" */
-#define YAMLBYTE_FLOW ((yamlbyte_char_t)'>')
-#define YAMLBYTE_LITERAL ((yamlbyte_char_t)'|')
-#define YAMLBYTE_BLOCK ((yamlbyte_char_t)'b')
-#define YAMLBYTE_PLAIN ((yamlbyte_char_t)'p')
-#define YAMLBYTE_INLINE_MAPPING ((yamlbyte_char_t)'{')
-#define YAMLBYTE_INLINE_SEQUENCE ((yamlbyte_char_t)'[')
-#define YAMLBYTE_SINGLE_QUOTED ((yamlbyte_char_t)39)
-#define YAMLBYTE_DOUBLE_QUOTED ((yamlbyte_char_t)'"')
-
-/*
- * The "C" API has two variants, one based on instructions,
- * with events delivered via pointers; and the other one
- * is character based where one or more instructions are
- * serialized into a buffer.
- *
- * Note: In the instruction based API, WHOLE_SCALAR does
- * not have the '<here' marshalling stuff.
- */
-
-typedef void * yamlbyte_consumer_t;
-typedef void * yamlbyte_producer_t;
-
-/* push and pull APIs need a way to communicate results */
-typedef enum {
- YAMLBYTE_OK = 0, /* proceed */
- YAMLBYTE_E_MEMORY = 'M', /* could not allocate memory */
- YAMLBYTE_E_READ = 'R', /* input stream read error */
- YAMLBYTE_E_WRITE = 'W', /* output stream write error */
- YAMLBYTE_E_OTHER = '?', /* some other error condition */
- YAMLBYTE_E_PARSE = 'P', /* parse error, check bytecodes */
- YAMLBYTE_MAX
-} yamlbyte_result_t;
-
-typedef const yamlbyte_char_t *yamlbyte_buff_t;
-
-/*
- * The "Instruction" API
- */
-
-typedef struct yaml_instruction {
- yamlbyte_char_t bytecode;
- yamlbyte_buff_t start;
- yamlbyte_buff_t finish; /* open range, *finish is _not_ part */
-} *yamlbyte_inst_t;
-
-/* producer pushes the instruction with one bytecode event to the
- * consumer; if the consumer's result is not YAMLBYTE_OK, then
- * the producer should stop */
-typedef
- yamlbyte_result_t
- (*yamlbyte_push_t)(
- yamlbyte_consumer_t self,
- yamlbyte_inst_t inst
- );
-
-/* consumer pulls a bytecode instruction from the producer; in this
- * case the instruction (and is buffer) are owned by the producer and
- * will remain valid till the pull function is called once again;
- * if the instruction is NULL, then there are no more results; and
- * it is important to call the pull function till it returns NULL so
- * that the producer can clean up its memory allocations */
-typedef
- yamlbyte_result_t
- (*yamlbyte_pull_t)(
- yamlbyte_producer_t self,
- yamlbyte_inst_t *inst /* to be filled in by the producer */
- );
-
-/*
- * Buffer based API
- */
-
-/* producer pushes a null terminated buffer filled with one or more
- * bytecode events to the consumer; if the consumer's result is not
- * YAMLBYTE_OK, then the producer should stop */
-typedef
- yamlbyte_result_t
- (*yamlbyte_pushbuff_t)(
- yamlbyte_consumer_t self,
- yamlbyte_buff_t buff
- );
-
-/* consumer pulls bytecode events from the producer; in this case
- * the buffer is owned by the producer, and will remain valid till
- * the pull function is called once again; if the buffer pointer
- * is set to NULL, then there are no more results; it is important
- * to call the pull function till it returns NULL so that the
- * producer can clean up its memory allocations */
-typedef
- yamlbyte_result_t
- (*yamlbyte_pullbuff_t)(
- yamlbyte_producer_t self,
- yamlbyte_buff_t *buff /* to be filled in by the producer */
- );
-
-/* convert a pull interface to a push interface; the reverse process
- * requires threads and thus is language dependent */
-#define YAMLBYTE_PULL2PUSH(pull,producer,push,consumer,result) \
- do { \
- yamlbyte_pullbuff_t _pull = (pull); \
- yamlbyte_pushbuff_t _push = (push); \
- yamlbyte_result_t _result = YAMLBYTE_OK; \
- yamlbyte_producer_t _producer = (producer); \
- yamlbyte_consumer_t _consumer = (consumer); \
- while(1) { \
- yamlbyte_buff_t buff = NULL; \
- _result = _pull(_producer,&buff); \
- if(YAMLBYTE_OK != result || NULL == buff) \
- break; \
- _result = _push(_consumer,buff); \
- if(YAMLBYTE_OK != result) \
- break; \
- } \
- (result) = _result; \
- } while(0)
-
-#endif
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
new file mode 100644
index 0000000000..086f83c591
--- /dev/null
+++ b/ext/syslog/lib/syslog/logger.rb
@@ -0,0 +1,208 @@
+require 'syslog'
+require 'logger'
+
+##
+# Syslog::Logger is a Logger work-alike that logs via syslog instead of to a
+# file. You can use Syslog::Logger to aggregate logs between multiple
+# machines.
+#
+# By default, Syslog::Logger uses the program name 'ruby', but this can be
+# changed via the first argument to Syslog::Logger.new.
+#
+# NOTE! You can only set the Syslog::Logger program name when you initialize
+# Syslog::Logger for the first time. This is a limitation of the way
+# Syslog::Logger uses syslog (and in some ways, a limitation of the way
+# syslog(3) works). Attempts to change Syslog::Logger's program name after
+# the first initialization will be ignored.
+#
+# === Example
+#
+# The following will log to syslogd on your local machine:
+#
+# require 'syslog/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:
+#
+# !my_program
+# *.* /var/log/my_program.log
+#
+# Then touch /var/log/my_program.log and signal syslogd with a HUP
+# (killall -HUP syslogd, on FreeBSD).
+#
+# If you wish to have logs automatically roll over and archive, see the
+# newsyslog.conf(5) and newsyslog(8) man pages.
+
+class Syslog::Logger
+ # Default formatter for log messages.
+ class Formatter
+ def call severity, time, progname, msg
+ clean msg
+ end
+
+ private
+
+ ##
+ # Clean up messages so they're nice and pretty.
+
+ def clean message
+ message = message.to_s.strip
+ message.gsub!(/\e\[[0-9;]*m/, '') # remove useless ansi color codes
+ return message
+ end
+ end
+
+ ##
+ # The version of Syslog::Logger you are using.
+
+ VERSION = '2.0'
+
+ ##
+ # Maps Logger warning types to syslog(3) warning types.
+ #
+ # 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
+ # an error for syslog(3).
+
+ LEVEL_MAP = {
+ ::Logger::UNKNOWN => Syslog::LOG_ALERT,
+ ::Logger::FATAL => Syslog::LOG_ERR,
+ ::Logger::ERROR => Syslog::LOG_WARNING,
+ ::Logger::WARN => Syslog::LOG_NOTICE,
+ ::Logger::INFO => Syslog::LOG_INFO,
+ ::Logger::DEBUG => Syslog::LOG_DEBUG,
+ }
+
+ ##
+ # Returns the internal Syslog object that is initialized when the
+ # first instance is created.
+
+ def self.syslog
+ @@syslog
+ end
+
+ ##
+ # Specifies the internal Syslog object to be used.
+
+ def self.syslog= syslog
+ @@syslog = syslog
+ end
+
+ ##
+ # Builds a methods for level +meth+.
+
+ def self.make_methods meth
+ level = ::Logger.const_get(meth.upcase)
+ eval <<-EOM, nil, __FILE__, __LINE__ + 1
+ def #{meth}(message = nil, &block)
+ add(#{level}, message, &block)
+ end
+
+ def #{meth}?
+ @level <= #{level}
+ end
+ EOM
+ end
+
+ ##
+ # :method: unknown
+ #
+ # Logs a +message+ at the unknown (syslog alert) log level, or logs the
+ # message returned from the block.
+
+ ##
+ # :method: fatal
+ #
+ # Logs a +message+ at the fatal (syslog err) log level, or logs the message
+ # returned from the block.
+
+ ##
+ # :method: error
+ #
+ # Logs a +message+ at the error (syslog warning) log level, or logs the
+ # message returned from the block.
+
+ ##
+ # :method: warn
+ #
+ # Logs a +message+ at the warn (syslog notice) log level, or logs the
+ # message returned from the block.
+
+ ##
+ # :method: info
+ #
+ # Logs a +message+ at the info (syslog info) log level, or logs the message
+ # returned from the block.
+
+ ##
+ # :method: debug
+ #
+ # Logs a +message+ at the debug (syslog debug) log level, or logs the
+ # message returned from the block.
+
+ Logger::Severity::constants.each do |severity|
+ make_methods severity.downcase
+ end
+
+ ##
+ # Log level for Logger compatibility.
+
+ attr_accessor :level
+
+ # Logging formatter, as a +Proc+ that will take four arguments and
+ # return the formatted message. The arguments are:
+ #
+ # +severity+:: The Severity of the log message.
+ # +time+:: A Time instance representing when the message was logged.
+ # +progname+:: The #progname configured, or passed to the logger method.
+ # +msg+:: The _Object_ the user passed to the log message; not necessarily a
+ # String.
+ #
+ # The block should return an Object that can be written to the logging
+ # device via +write+. The default formatter is used when no formatter is
+ # set.
+ 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. 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', facility = nil
+ @level = ::Logger::DEBUG
+ @formatter = Formatter.new
+
+ @@syslog ||= Syslog.open(program_name)
+
+ @facility = (facility || @@syslog.facility)
+ end
+
+ ##
+ # Almost duplicates Logger#add. +progname+ is ignored.
+
+ def add severity, message = nil, progname = nil, &block
+ severity ||= ::Logger::UNKNOWN
+ @level <= severity and
+ @@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 d1f75101e4..17c5ef8969 100644
--- a/ext/syslog/syslog.c
+++ b/ext/syslog/syslog.c
@@ -13,7 +13,21 @@
#include <syslog.h>
/* Syslog class */
-static VALUE mSyslog, mSyslogConstants;
+static VALUE mSyslog;
+/*
+ * Module holding all Syslog constants. See Syslog::log and
+ * Syslog::open for constant descriptions.
+ */
+static VALUE mSyslogConstants;
+/* Module holding Syslog option constants */
+static VALUE mSyslogOption;
+/* Module holding Syslog facility constants */
+static VALUE mSyslogFacility;
+/* Module holding Syslog level constants */
+static VALUE mSyslogLevel;
+/* Module holding Syslog utility macros */
+static VALUE mSyslogMacros;
+
static const char *syslog_ident = NULL;
static int syslog_options = -1, syslog_facility = -1, syslog_mask = -1;
static int syslog_opened = 0;
@@ -23,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");
}
@@ -42,14 +55,13 @@ 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");
}
closelog();
- free((void *)syslog_ident);
+ xfree((void *)syslog_ident);
syslog_ident = NULL;
syslog_options = syslog_facility = syslog_mask = -1;
syslog_opened = 0;
@@ -111,7 +123,7 @@ static VALUE mSyslog_close(VALUE self)
* LOG_KERN:: A kernel message (not sendable by user processes, so not of
* much use to Ruby, but listed here for completeness).
*
- * LOG_LRP:: Line printer subsystem.
+ * LOG_LPR:: Line printer subsystem.
*
* LOG_MAIL:: Mail delivery or transport subsystem.
*
@@ -249,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");
}
@@ -313,24 +324,17 @@ static VALUE mSyslog_log(int argc, VALUE *argv, VALUE self)
*/
static VALUE mSyslog_inspect(VALUE self)
{
- char buf[1024];
-
Check_Type(self, T_MODULE);
- if (syslog_opened) {
- snprintf(buf, sizeof(buf),
- "<#%s: opened=true, ident=\"%s\", options=%d, facility=%d, mask=%d>",
- rb_class2name(self),
- syslog_ident,
- syslog_options,
- syslog_facility,
- syslog_mask);
- } else {
- snprintf(buf, sizeof(buf),
- "<#%s: opened=false>", rb_class2name(self));
- }
+ if (!syslog_opened)
+ return rb_sprintf("<#%s: opened=false>", rb_class2name(self));
- return rb_str_new2(buf);
+ return rb_sprintf("<#%s: opened=true, ident=\"%s\", options=%d, facility=%d, mask=%d>",
+ rb_class2name(self),
+ syslog_ident,
+ syslog_options,
+ syslog_facility,
+ syslog_mask);
}
/* Returns self, for backward compatibility.
@@ -378,7 +382,7 @@ define_syslog_shortcut_method(LOG_DEBUG, debug)
*
* Generates a mask bit for a priority level. See #mask=
*/
-static VALUE mSyslogConstants_LOG_MASK(VALUE klass, VALUE pri)
+static VALUE mSyslogMacros_LOG_MASK(VALUE mod, VALUE pri)
{
return INT2FIX(LOG_MASK(NUM2INT(pri)));
}
@@ -389,11 +393,17 @@ static VALUE mSyslogConstants_LOG_MASK(VALUE klass, VALUE pri)
* Generates a mask value for priority levels at or below the level specified.
* See #mask=
*/
-static VALUE mSyslogConstants_LOG_UPTO(VALUE klass, VALUE pri)
+static VALUE mSyslogMacros_LOG_UPTO(VALUE mod, VALUE pri)
{
return INT2FIX(LOG_UPTO(NUM2INT(pri)));
}
+static VALUE mSyslogMacros_included(VALUE mod, VALUE target)
+{
+ rb_extend_object(target, mSyslogMacros);
+ return mod;
+}
+
/* The syslog package provides a Ruby interface to the POSIX system logging
* facility.
*
@@ -412,14 +422,12 @@ void Init_syslog()
{
mSyslog = rb_define_module("Syslog");
- /* Document-module: Syslog::Constants
- *
- * Module holding Syslog constants. See Syslog::log and Syslog::open for
- * constant descriptions.
- */
- mSyslogConstants = rb_define_module_under(mSyslog, "Constants");
+ mSyslogConstants = rb_define_module_under(mSyslog, "Constants");
- rb_include_module(mSyslog, mSyslogConstants);
+ mSyslogOption = rb_define_module_under(mSyslog, "Option");
+ mSyslogFacility = rb_define_module_under(mSyslog, "Facility");
+ mSyslogLevel = rb_define_module_under(mSyslog, "Level");
+ mSyslogMacros = rb_define_module_under(mSyslog, "Macros");
rb_define_module_function(mSyslog, "open", mSyslog_open, -1);
rb_define_module_function(mSyslog, "reopen", mSyslog_reopen, -1);
@@ -435,143 +443,150 @@ 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, "LOG_MASK", mSyslogConstants_LOG_MASK, 1);
- rb_define_module_function(mSyslog, "LOG_UPTO", mSyslogConstants_LOG_UPTO, 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);
- rb_define_module_function(mSyslogConstants, "LOG_MASK", mSyslogConstants_LOG_MASK, 1);
- rb_define_module_function(mSyslogConstants, "LOG_UPTO", mSyslogConstants_LOG_UPTO, 1);
+ /* Syslog options */
-#define rb_define_syslog_const(id) \
- rb_define_const(mSyslogConstants, #id, INT2NUM(id))
+#define rb_define_syslog_option(c) \
+ rb_define_const(mSyslogOption, #c, INT2NUM(c))
- /* Various options when opening log */
#ifdef LOG_PID
- rb_define_syslog_const(LOG_PID);
+ rb_define_syslog_option(LOG_PID);
#endif
#ifdef LOG_CONS
- rb_define_syslog_const(LOG_CONS);
+ rb_define_syslog_option(LOG_CONS);
#endif
#ifdef LOG_ODELAY
- rb_define_syslog_const(LOG_ODELAY); /* deprecated */
+ rb_define_syslog_option(LOG_ODELAY); /* deprecated */
#endif
#ifdef LOG_NDELAY
- rb_define_syslog_const(LOG_NDELAY);
+ rb_define_syslog_option(LOG_NDELAY);
#endif
#ifdef LOG_NOWAIT
- rb_define_syslog_const(LOG_NOWAIT); /* deprecated */
+ rb_define_syslog_option(LOG_NOWAIT); /* deprecated */
#endif
#ifdef LOG_PERROR
- rb_define_syslog_const(LOG_PERROR);
+ rb_define_syslog_option(LOG_PERROR);
#endif
- /* Various syslog facilities */
+ /* Syslog facilities */
+
+#define rb_define_syslog_facility(c) \
+ rb_define_const(mSyslogFacility, #c, INT2NUM(c))
+
#ifdef LOG_AUTH
- rb_define_syslog_const(LOG_AUTH);
+ rb_define_syslog_facility(LOG_AUTH);
#endif
#ifdef LOG_AUTHPRIV
- rb_define_syslog_const(LOG_AUTHPRIV);
+ rb_define_syslog_facility(LOG_AUTHPRIV);
#endif
#ifdef LOG_CONSOLE
- rb_define_syslog_const(LOG_CONSOLE);
+ rb_define_syslog_facility(LOG_CONSOLE);
#endif
#ifdef LOG_CRON
- rb_define_syslog_const(LOG_CRON);
+ rb_define_syslog_facility(LOG_CRON);
#endif
#ifdef LOG_DAEMON
- rb_define_syslog_const(LOG_DAEMON);
+ rb_define_syslog_facility(LOG_DAEMON);
#endif
#ifdef LOG_FTP
- rb_define_syslog_const(LOG_FTP);
+ rb_define_syslog_facility(LOG_FTP);
#endif
#ifdef LOG_KERN
- rb_define_syslog_const(LOG_KERN);
+ rb_define_syslog_facility(LOG_KERN);
#endif
#ifdef LOG_LPR
- rb_define_syslog_const(LOG_LPR);
+ rb_define_syslog_facility(LOG_LPR);
#endif
#ifdef LOG_MAIL
- rb_define_syslog_const(LOG_MAIL);
+ rb_define_syslog_facility(LOG_MAIL);
#endif
#ifdef LOG_NEWS
- rb_define_syslog_const(LOG_NEWS);
+ rb_define_syslog_facility(LOG_NEWS);
#endif
#ifdef LOG_NTP
- rb_define_syslog_const(LOG_NTP);
+ rb_define_syslog_facility(LOG_NTP);
#endif
#ifdef LOG_SECURITY
- rb_define_syslog_const(LOG_SECURITY);
+ rb_define_syslog_facility(LOG_SECURITY);
#endif
#ifdef LOG_SYSLOG
- rb_define_syslog_const(LOG_SYSLOG);
+ rb_define_syslog_facility(LOG_SYSLOG);
#endif
#ifdef LOG_USER
- rb_define_syslog_const(LOG_USER);
+ rb_define_syslog_facility(LOG_USER);
#endif
#ifdef LOG_UUCP
- rb_define_syslog_const(LOG_UUCP);
+ rb_define_syslog_facility(LOG_UUCP);
#endif
#ifdef LOG_LOCAL0
- rb_define_syslog_const(LOG_LOCAL0);
+ rb_define_syslog_facility(LOG_LOCAL0);
#endif
#ifdef LOG_LOCAL1
- rb_define_syslog_const(LOG_LOCAL1);
+ rb_define_syslog_facility(LOG_LOCAL1);
#endif
#ifdef LOG_LOCAL2
- rb_define_syslog_const(LOG_LOCAL2);
+ rb_define_syslog_facility(LOG_LOCAL2);
#endif
#ifdef LOG_LOCAL3
- rb_define_syslog_const(LOG_LOCAL3);
+ rb_define_syslog_facility(LOG_LOCAL3);
#endif
#ifdef LOG_LOCAL4
- rb_define_syslog_const(LOG_LOCAL4);
+ rb_define_syslog_facility(LOG_LOCAL4);
#endif
#ifdef LOG_LOCAL5
- rb_define_syslog_const(LOG_LOCAL5);
+ rb_define_syslog_facility(LOG_LOCAL5);
#endif
#ifdef LOG_LOCAL6
- rb_define_syslog_const(LOG_LOCAL6);
+ rb_define_syslog_facility(LOG_LOCAL6);
#endif
#ifdef LOG_LOCAL7
- rb_define_syslog_const(LOG_LOCAL7);
+ rb_define_syslog_facility(LOG_LOCAL7);
#endif
-#define rb_define_syslog_shortcut(name) \
- rb_define_module_function(mSyslog, #name, mSyslog_##name, -1)
+ /* Syslog levels and the shortcut methods */
+
+#define rb_define_syslog_level(c, m) \
+ rb_define_const(mSyslogLevel, #c, INT2NUM(c)); \
+ rb_define_module_function(mSyslog, #m, mSyslog_##m, -1)
- /* Various syslog priorities and the shortcut methods */
#ifdef LOG_EMERG
- rb_define_syslog_const(LOG_EMERG);
- rb_define_syslog_shortcut(emerg);
+ rb_define_syslog_level(LOG_EMERG, emerg);
#endif
#ifdef LOG_ALERT
- rb_define_syslog_const(LOG_ALERT);
- rb_define_syslog_shortcut(alert);
+ rb_define_syslog_level(LOG_ALERT, alert);
#endif
#ifdef LOG_CRIT
- rb_define_syslog_const(LOG_CRIT);
- rb_define_syslog_shortcut(crit);
+ rb_define_syslog_level(LOG_CRIT, crit);
#endif
#ifdef LOG_ERR
- rb_define_syslog_const(LOG_ERR);
- rb_define_syslog_shortcut(err);
+ rb_define_syslog_level(LOG_ERR, err);
#endif
#ifdef LOG_WARNING
- rb_define_syslog_const(LOG_WARNING);
- rb_define_syslog_shortcut(warning);
+ rb_define_syslog_level(LOG_WARNING, warning);
#endif
#ifdef LOG_NOTICE
- rb_define_syslog_const(LOG_NOTICE);
- rb_define_syslog_shortcut(notice);
+ rb_define_syslog_level(LOG_NOTICE, notice);
#endif
#ifdef LOG_INFO
- rb_define_syslog_const(LOG_INFO);
- rb_define_syslog_shortcut(info);
+ rb_define_syslog_level(LOG_INFO, info);
#endif
#ifdef LOG_DEBUG
- rb_define_syslog_const(LOG_DEBUG);
- rb_define_syslog_shortcut(debug);
+ rb_define_syslog_level(LOG_DEBUG, debug);
#endif
+
+ /* Syslog macros */
+
+ rb_define_method(mSyslogMacros, "LOG_MASK", mSyslogMacros_LOG_MASK, 1);
+ rb_define_method(mSyslogMacros, "LOG_UPTO", mSyslogMacros_LOG_UPTO, 1);
+ rb_define_singleton_method(mSyslogMacros, "included", mSyslogMacros_included, 1);
+
+ rb_include_module(mSyslogConstants, mSyslogOption);
+ rb_include_module(mSyslogConstants, mSyslogFacility);
+ rb_include_module(mSyslogConstants, mSyslogLevel);
+ rb_funcall(mSyslogConstants, rb_intern("include"), 1, mSyslogMacros);
+
+ rb_define_singleton_method(mSyslogConstants, "included", mSyslogMacros_included, 1);
+ rb_funcall(mSyslog, rb_intern("include"), 1, mSyslogConstants);
}
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..126b5b3523
--- /dev/null
+++ b/ext/thread/thread.c
@@ -0,0 +1,579 @@
+#include <ruby.h>
+
+enum {
+ CONDVAR_WAITERS = 0
+};
+
+enum {
+ QUEUE_QUE = 0,
+ QUEUE_WAITERS = 1,
+ SZQUEUE_WAITERS = 2,
+ SZQUEUE_MAX = 3
+};
+
+#define GET_CONDVAR_WAITERS(cv) RSTRUCT_GET((cv), CONDVAR_WAITERS)
+
+#define GET_QUEUE_QUE(q) RSTRUCT_GET((q), QUEUE_QUE)
+#define GET_QUEUE_WAITERS(q) RSTRUCT_GET((q), QUEUE_WAITERS)
+#define GET_SZQUEUE_WAITERS(q) RSTRUCT_GET((q), SZQUEUE_WAITERS)
+#define GET_SZQUEUE_MAX(q) RSTRUCT_GET((q), SZQUEUE_MAX)
+#define GET_SZQUEUE_ULONGMAX(q) NUM2ULONG(GET_SZQUEUE_MAX(q))
+
+static VALUE
+ary_buf_new(void)
+{
+ return rb_ary_tmp_new(1);
+}
+
+static void
+wakeup_first_thread(VALUE list)
+{
+ VALUE thread;
+
+ while (!NIL_P(thread = rb_ary_shift(list))) {
+ if (RTEST(rb_thread_wakeup_alive(thread))) break;
+ }
+}
+
+static void
+wakeup_all_threads(VALUE list)
+{
+ VALUE thread;
+ long i;
+
+ for (i=0; i<RARRAY_LEN(list); i++) {
+ thread = RARRAY_AREF(list, i);
+ rb_thread_wakeup_alive(thread);
+ }
+ rb_ary_clear(list);
+}
+
+/*
+ * Document-class: ConditionVariable
+ *
+ * ConditionVariable objects augment class Mutex. Using condition variables,
+ * it is possible to suspend while in the middle of a critical section until a
+ * resource becomes available.
+ *
+ * Example:
+ *
+ * require 'thread'
+ *
+ * mutex = Mutex.new
+ * resource = ConditionVariable.new
+ *
+ * a = Thread.new {
+ * mutex.synchronize {
+ * # Thread 'a' now needs the resource
+ * resource.wait(mutex)
+ * # 'a' can now have the resource
+ * }
+ * }
+ *
+ * b = Thread.new {
+ * mutex.synchronize {
+ * # Thread 'b' has finished using the resource
+ * resource.signal
+ * }
+ * }
+ */
+
+/*
+ * Document-method: ConditionVariable::new
+ *
+ * Creates a new condition variable instance.
+ */
+
+static VALUE
+rb_condvar_initialize(VALUE self)
+{
+ RSTRUCT_SET(self, CONDVAR_WAITERS, ary_buf_new());
+ return self;
+}
+
+struct sleep_call {
+ VALUE mutex;
+ VALUE timeout;
+};
+
+static ID id_sleep;
+
+static VALUE
+do_sleep(VALUE args)
+{
+ struct sleep_call *p = (struct sleep_call *)args;
+ return rb_funcall2(p->mutex, id_sleep, 1, &p->timeout);
+}
+
+static VALUE
+delete_current_thread(VALUE ary)
+{
+ return rb_ary_delete(ary, rb_thread_current());
+}
+
+/*
+ * Document-method: ConditionVariable#wait
+ * call-seq: wait(mutex, timeout=nil)
+ *
+ * Releases the lock held in +mutex+ and waits; reacquires the lock on wakeup.
+ *
+ * If +timeout+ is given, this method returns after +timeout+ seconds passed,
+ * even if no other thread doesn't signal.
+ */
+
+static VALUE
+rb_condvar_wait(int argc, VALUE *argv, VALUE self)
+{
+ VALUE waiters = GET_CONDVAR_WAITERS(self);
+ VALUE mutex, timeout;
+ struct sleep_call args;
+
+ rb_scan_args(argc, argv, "11", &mutex, &timeout);
+
+ args.mutex = mutex;
+ args.timeout = timeout;
+ rb_ary_push(waiters, rb_thread_current());
+ rb_ensure(do_sleep, (VALUE)&args, delete_current_thread, waiters);
+
+ return self;
+}
+
+/*
+ * Document-method: ConditionVariable#signal
+ *
+ * Wakes up the first thread in line waiting for this lock.
+ */
+
+static VALUE
+rb_condvar_signal(VALUE self)
+{
+ wakeup_first_thread(GET_CONDVAR_WAITERS(self));
+ return self;
+}
+
+/*
+ * Document-method: ConditionVariable#broadcast
+ *
+ * Wakes up all threads waiting for this lock.
+ */
+
+static VALUE
+rb_condvar_broadcast(VALUE self)
+{
+ wakeup_all_threads(GET_CONDVAR_WAITERS(self));
+ return self;
+}
+
+/*
+ * Document-class: Queue
+ *
+ * This class provides a way to synchronize communication between threads.
+ *
+ * Example:
+ *
+ * require 'thread'
+ * queue = Queue.new
+ *
+ * producer = Thread.new do
+ * 5.times do |i|
+ * sleep rand(i) # simulate expense
+ * queue << i
+ * puts "#{i} produced"
+ * end
+ * end
+ *
+ * consumer = Thread.new do
+ * 5.times do |i|
+ * value = queue.pop
+ * sleep rand(i/2) # simulate expense
+ * puts "consumed #{value}"
+ * end
+ * end
+ *
+ */
+
+/*
+ * Document-method: Queue::new
+ *
+ * Creates a new queue instance.
+ */
+
+static VALUE
+rb_queue_initialize(VALUE self)
+{
+ RSTRUCT_SET(self, QUEUE_QUE, ary_buf_new());
+ RSTRUCT_SET(self, QUEUE_WAITERS, ary_buf_new());
+ return self;
+}
+
+static VALUE
+queue_do_push(VALUE self, VALUE obj)
+{
+ rb_ary_push(GET_QUEUE_QUE(self), obj);
+ wakeup_first_thread(GET_QUEUE_WAITERS(self));
+ return self;
+}
+
+/*
+ * Document-method: Queue#push
+ * call-seq: push(object)
+ *
+ * Pushes the given +object+ to the queue.
+ */
+
+static VALUE
+rb_queue_push(VALUE self, VALUE obj)
+{
+ return queue_do_push(self, obj);
+}
+
+static unsigned long
+queue_length(VALUE self)
+{
+ return RARRAY_LEN(GET_QUEUE_QUE(self));
+}
+
+static unsigned long
+queue_num_waiting(VALUE self)
+{
+ return RARRAY_LEN(GET_QUEUE_WAITERS(self));
+}
+
+struct waiting_delete {
+ VALUE waiting;
+ VALUE th;
+};
+
+static VALUE
+queue_delete_from_waiting(struct waiting_delete *p)
+{
+ rb_ary_delete(p->waiting, p->th);
+ return Qnil;
+}
+
+static VALUE
+queue_sleep(VALUE arg)
+{
+ rb_thread_sleep_deadly();
+ return Qnil;
+}
+
+static VALUE
+queue_do_pop(VALUE self, VALUE should_block)
+{
+ struct waiting_delete args;
+ args.waiting = GET_QUEUE_WAITERS(self);
+ args.th = rb_thread_current();
+
+ while (queue_length(self) == 0) {
+ if (!(int)should_block) {
+ rb_raise(rb_eThreadError, "queue empty");
+ }
+ rb_ary_push(args.waiting, args.th);
+ rb_ensure(queue_sleep, (VALUE)0, queue_delete_from_waiting, (VALUE)&args);
+ }
+
+ return rb_ary_shift(GET_QUEUE_QUE(self));
+}
+
+static VALUE
+queue_pop_should_block(int argc, VALUE *argv)
+{
+ VALUE should_block = Qtrue;
+ switch (argc) {
+ case 0:
+ break;
+ case 1:
+ should_block = RTEST(argv[0]) ? Qfalse : Qtrue;
+ break;
+ default:
+ rb_raise(rb_eArgError, "wrong number of arguments (%d for 1)", argc);
+ }
+ return should_block;
+}
+
+/*
+ * Document-method: Queue#pop
+ * call-seq: pop(non_block=false)
+ *
+ * Retrieves data from the queue.
+ *
+ * If the queue is empty, the calling thread is suspended until data is pushed
+ * onto the queue. If +non_block+ is true, the thread isn't suspended, and an
+ * exception is raised.
+ */
+
+static VALUE
+rb_queue_pop(int argc, VALUE *argv, VALUE self)
+{
+ VALUE should_block = queue_pop_should_block(argc, argv);
+ return queue_do_pop(self, should_block);
+}
+
+/*
+ * Document-method: Queue#empty?
+ * call-seq: empty?
+ *
+ * Returns +true+ if the queue is empty.
+ */
+
+static VALUE
+rb_queue_empty_p(VALUE self)
+{
+ return queue_length(self) == 0 ? Qtrue : Qfalse;
+}
+
+/*
+ * Document-method: Queue#clear
+ *
+ * Removes all objects from the queue.
+ */
+
+static VALUE
+rb_queue_clear(VALUE self)
+{
+ rb_ary_clear(GET_QUEUE_QUE(self));
+ return self;
+}
+
+/*
+ * Document-method: Queue#length
+ *
+ * Returns the length of the queue.
+ */
+
+static VALUE
+rb_queue_length(VALUE self)
+{
+ unsigned long len = queue_length(self);
+ return ULONG2NUM(len);
+}
+
+/*
+ * Document-method: Queue#num_waiting
+ *
+ * Returns the number of threads waiting on the queue.
+ */
+
+static VALUE
+rb_queue_num_waiting(VALUE self)
+{
+ unsigned long len = queue_num_waiting(self);
+ return ULONG2NUM(len);
+}
+
+/*
+ * Document-class: SizedQueue
+ *
+ * This class represents queues of specified size capacity. The push operation
+ * may be blocked if the capacity is full.
+ *
+ * See Queue for an example of how a SizedQueue works.
+ */
+
+/*
+ * Document-method: SizedQueue::new
+ * call-seq: new(max)
+ *
+ * Creates a fixed-length queue with a maximum size of +max+.
+ */
+
+static VALUE
+rb_szqueue_initialize(VALUE self, VALUE vmax)
+{
+ long max;
+
+ max = NUM2LONG(vmax);
+ if (max <= 0) {
+ rb_raise(rb_eArgError, "queue size must be positive");
+ }
+
+ RSTRUCT_SET(self, QUEUE_QUE, ary_buf_new());
+ RSTRUCT_SET(self, QUEUE_WAITERS, ary_buf_new());
+ RSTRUCT_SET(self, SZQUEUE_WAITERS, ary_buf_new());
+ RSTRUCT_SET(self, SZQUEUE_MAX, vmax);
+
+ return self;
+}
+
+/*
+ * Document-method: SizedQueue#max
+ *
+ * Returns the maximum size of the queue.
+ */
+
+static VALUE
+rb_szqueue_max_get(VALUE self)
+{
+ return GET_SZQUEUE_MAX(self);
+}
+
+/*
+ * Document-method: SizedQueue#max=
+ * call-seq: max=(number)
+ *
+ * Sets the maximum size of the queue to the given +number+.
+ */
+
+static VALUE
+rb_szqueue_max_set(VALUE self, VALUE vmax)
+{
+ long max = NUM2LONG(vmax), diff = 0;
+ VALUE t;
+
+ if (max <= 0) {
+ rb_raise(rb_eArgError, "queue size must be positive");
+ }
+ if ((unsigned long)max > GET_SZQUEUE_ULONGMAX(self)) {
+ diff = max - GET_SZQUEUE_ULONGMAX(self);
+ }
+ RSTRUCT_SET(self, SZQUEUE_MAX, vmax);
+ while (diff > 0 && !NIL_P(t = rb_ary_shift(GET_QUEUE_QUE(self)))) {
+ rb_thread_wakeup_alive(t);
+ }
+ return vmax;
+}
+
+/*
+ * Document-method: SizedQueue#push
+ * call-seq: push(object)
+ *
+ * Pushes +object+ to the queue.
+ *
+ * If there is no space left in the queue, waits until space becomes available.
+ */
+
+static VALUE
+rb_szqueue_push(VALUE self, VALUE obj)
+{
+ struct waiting_delete args;
+ args.waiting = GET_QUEUE_WAITERS(self);
+ args.th = rb_thread_current();
+
+ while (queue_length(self) >= GET_SZQUEUE_ULONGMAX(self)) {
+ rb_ary_push(args.waiting, args.th);
+ rb_ensure((VALUE (*)())rb_thread_sleep_deadly, (VALUE)0, queue_delete_from_waiting, (VALUE)&args);
+ }
+ return queue_do_push(self, obj);
+}
+
+static VALUE
+szqueue_do_pop(VALUE self, VALUE should_block)
+{
+ VALUE retval = queue_do_pop(self, should_block);
+
+ if (queue_length(self) < GET_SZQUEUE_ULONGMAX(self)) {
+ wakeup_first_thread(GET_SZQUEUE_WAITERS(self));
+ }
+
+ return retval;
+}
+
+/*
+ * Document-method: SizedQueue#pop
+ * call-seq: pop(non_block=false)
+ *
+ * Retrieves data from the queue.
+ *
+ * If the queue is empty, the calling thread is suspended until data is pushed
+ * onto the queue. If +non_block+ is true, the thread isn't suspended, and an
+ * exception is raised.
+ */
+
+static VALUE
+rb_szqueue_pop(int argc, VALUE *argv, VALUE self)
+{
+ VALUE should_block = queue_pop_should_block(argc, argv);
+ return szqueue_do_pop(self, should_block);
+}
+
+/*
+ * Document-method: SizedQueue#num_waiting
+ *
+ * Returns the number of threads waiting on the queue.
+ */
+
+static VALUE
+rb_szqueue_num_waiting(VALUE self)
+{
+ long len = queue_num_waiting(self);
+ len += RARRAY_LEN(GET_SZQUEUE_WAITERS(self));
+ return ULONG2NUM(len);
+}
+
+#ifndef UNDER_THREAD
+#define UNDER_THREAD 1
+#endif
+
+void
+Init_thread(void)
+{
+#if UNDER_THREAD
+#define ALIAS_GLOBAL_CONST(name) do { \
+ ID id = rb_intern_const(#name); \
+ if (!rb_const_defined_at(rb_cObject, id)) { \
+ rb_const_set(rb_cObject, id, rb_c##name); \
+ } \
+ } while (0)
+#define OUTER rb_cThread
+#else
+#define ALIAS_GLOBAL_CONST(name) do { /* nothing */ } while (0)
+#define OUTER 0
+#endif
+
+ VALUE rb_cConditionVariable = rb_struct_define_without_accessor_under(
+ OUTER,
+ "ConditionVariable", rb_cObject, rb_struct_alloc_noinit,
+ "waiters", NULL);
+ VALUE rb_cQueue = rb_struct_define_without_accessor_under(
+ OUTER,
+ "Queue", rb_cObject, rb_struct_alloc_noinit,
+ "que", "waiters", NULL);
+ VALUE rb_cSizedQueue = rb_struct_define_without_accessor_under(
+ OUTER,
+ "SizedQueue", rb_cQueue, rb_struct_alloc_noinit,
+ "que", "waiters", "queue_waiters", "size", NULL);
+
+#if 0
+ rb_cConditionVariable = rb_define_class("ConditionVariable", rb_cObject); /* teach rdoc ConditionVariable */
+ rb_cQueue = rb_define_class("Queue", rb_cObject); /* teach rdoc Queue */
+ rb_cSizedQueue = rb_define_class("SizedQueue", rb_cObject); /* teach rdoc SizedQueue */
+#endif
+
+ id_sleep = rb_intern("sleep");
+
+ rb_define_method(rb_cConditionVariable, "initialize", rb_condvar_initialize, 0);
+ rb_define_method(rb_cConditionVariable, "wait", rb_condvar_wait, -1);
+ rb_define_method(rb_cConditionVariable, "signal", rb_condvar_signal, 0);
+ rb_define_method(rb_cConditionVariable, "broadcast", rb_condvar_broadcast, 0);
+
+ rb_define_method(rb_cQueue, "initialize", rb_queue_initialize, 0);
+ rb_define_method(rb_cQueue, "push", rb_queue_push, 1);
+ rb_define_method(rb_cQueue, "pop", rb_queue_pop, -1);
+ rb_define_method(rb_cQueue, "empty?", rb_queue_empty_p, 0);
+ rb_define_method(rb_cQueue, "clear", rb_queue_clear, 0);
+ rb_define_method(rb_cQueue, "length", rb_queue_length, 0);
+ rb_define_method(rb_cQueue, "num_waiting", rb_queue_num_waiting, 0);
+
+ rb_alias(rb_cQueue, rb_intern("enq"), rb_intern("push"));
+ rb_alias(rb_cQueue, rb_intern("<<"), rb_intern("push"));
+ rb_alias(rb_cQueue, rb_intern("deq"), rb_intern("pop"));
+ rb_alias(rb_cQueue, rb_intern("shift"), rb_intern("pop"));
+ rb_alias(rb_cQueue, rb_intern("size"), rb_intern("length"));
+
+ rb_define_method(rb_cSizedQueue, "initialize", rb_szqueue_initialize, 1);
+ rb_define_method(rb_cSizedQueue, "max", rb_szqueue_max_get, 0);
+ rb_define_method(rb_cSizedQueue, "max=", rb_szqueue_max_set, 1);
+ rb_define_method(rb_cSizedQueue, "push", rb_szqueue_push, 1);
+ rb_define_method(rb_cSizedQueue, "pop", rb_szqueue_pop, -1);
+ rb_define_method(rb_cSizedQueue, "num_waiting", rb_szqueue_num_waiting, 0);
+ rb_alias(rb_cSizedQueue, rb_intern("enq"), rb_intern("push"));
+ rb_alias(rb_cSizedQueue, rb_intern("<<"), rb_intern("push"));
+ rb_alias(rb_cSizedQueue, rb_intern("deq"), rb_intern("pop"));
+ rb_alias(rb_cSizedQueue, rb_intern("shift"), rb_intern("pop"));
+
+ rb_provide("thread.rb");
+ ALIAS_GLOBAL_CONST(ConditionVariable);
+ ALIAS_GLOBAL_CONST(Queue);
+ ALIAS_GLOBAL_CONST(SizedQueue);
+}
diff --git a/ext/tk/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 8ba202c06f..957e8ec840 100644
--- a/ext/tk/MANUAL_tcltklib.eng
+++ b/ext/tk/MANUAL_tcltklib.eng
@@ -11,7 +11,7 @@ module TclTklib
: Tcl/Tk interpreters
module TclTkLib::EventFlag
- : Defines flags to define taget events on 'do_one_event' methos.
+ : Defines flags to define target events on 'do_one_event' methods.
: When to give, please use bit-operator (e.g. WINDOW | DONT_WAIT).
[constants]
@@ -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.eucj
deleted file mode 100644
index 1ff5dddde4..0000000000
--- a/ext/tk/MANUAL_tcltklib.eucj
+++ /dev/null
@@ -1,584 +0,0 @@
-(tof)
- 2005/07/05 Hidetoshi NAGAI
-
-Ëܥɥ­¥å¥á¥ó¥È¤Ë¤Ï¸Å¤¤ tcltk ¥é¥¤¥Ö¥é¥ê¡¤tcltklib ¥é¥¤¥Ö¥é¥ê¤ÎÀâÌÀ
-¤¬´Þ¤Þ¤ì¤Æ¤¤¤Þ¤¹¤¬¡¤¤½¤Îµ­½ÒÆâÍÆ¤Ï¸Å¤¤¤â¤Î¤È¤Ê¤Ã¤Æ¤¤¤Þ¤¹¡¥
-
-tcltk ¥é¥¤¥Ö¥é¥ê¡Êtcltk.rb¡Ë¤Ï¸½ºß¤Ç¤Ï¥á¥ó¥Æ¥Ê¥ó¥¹¤¬»ö¼Â¾å¹Ô¤ï¤ì¤Æ
-¤¤¤Ê¤¤¤¿¤á¡¤¸Å¤¤¥É¥­¥å¥á¥ó¥È¤ÎÀâÌÀ¤¬¤½¤Î¤Þ¤ÞÍ­¸ú¤Ç¤¹¡¥¤½¤ì¤ËÂФ·¡¤
-tcltklib ¥é¥¤¥Ö¥é¥ê¤Ë¤Ä¤¤¤Æ¤Ï¡¤¸½ºß¤Î Ruby/Tk¡Êtk.rb °Ê²¼¤Î¥é¥¤¥Ö¥é
-¥ê·²¡Ë¤ò²ÔƯ¤µ¤»¤ë¤¿¤á¤ÎÃæ¿´¤È¤·¤Æ¥á¥ó¥Æ¥Ê¥ó¥¹¤µ¤ì¤Æ¤¤¤ë¤¿¤á¡¤¾¯¡¹
-°ã¤¤¤¬À¸¤¸¤Æ¤¤¤Þ¤¹¡¥
-
-¤½¤³¤Ç¡¤¤Þ¤º¸Å¤¤ÀâÌÀʸ½ñ¤ò¼¨¤·¤¿¸å¡¤¸½ºß¤Î tcltklib ¥é¥¤¥Ö¥é¥ê¤Ë¤Ä
-¤¤¤Æ¤ÎÀâÌÀ¤ò²Ã¤¨¤Þ¤¹¡¥
-
-°Ê²¼¤¬¥é¥¤¥Ö¥é¥ê¤Î¸Å¤¤ÀâÌÀʸ½ñ¤Ç¤¹¡¥
-==============================================================
- MANUAL.euc
- Sep. 19, 1997 Y. Shigehiro
-
-°Ê²¼, ¡Ötcl/tk¡×¤È¤¤¤¦É½µ­¤Ï, tclsh ¤ä wish ¤ò¼Â¸½¤·¤Æ¤¤¤ë, °ìÈ̤Ǥ¤¤¦
-¤È¤³¤í¤Î tcl/tk ¤ò»Ø¤·¤Þ¤¹. ¡Ötcltk ¥é¥¤¥Ö¥é¥ê¡×, ¡Ötcltklib ¥é¥¤¥Ö¥é
-¥ê¡×¤È¤¤¤¦É½µ­¤Ï, Ëܥѥ屡¼¥¸¤Ë´Þ¤Þ¤ì¤ë ruby ÍѤΥ饤¥Ö¥é¥ê¤ò»Ø¤·¤Þ¤¹.
-
-<< tcltk ¥é¥¤¥Ö¥é¥ê >>
-
-tcl/tk ¤Î C ¥é¥¤¥Ö¥é¥ê¤òÍøÍѤ¹¤ë¤¿¤á¤Î¹â(Ãæ?)¿å½à¥¤¥ó¥¿¡¼¥Õ¥§¡¼¥¹¤òÄó
-¶¡¤·¤Þ¤¹.
-
-¤³¤Î¥é¥¤¥Ö¥é¥ê¤Ï ruby ¤«¤é tcl/tk ¥é¥¤¥Ö¥é¥ê¤òÍøÍѤ¹¤ë¤¿¤á¤Î¤â¤Î¤Ç, Æâ
-Éô¤Ç tcltklib ¥é¥¤¥Ö¥é¥ê¤òÍøÍѤ·¤Æ¤¤¤Þ¤¹.
-
-[ÀâÌÀ]
-
-tcl/tk ¥¤¥ó¥¿¥×¥ê¥¿¤Ç¤Ï, ¥¦¥£¥¸¥§¥Ã¥È¤Ë²¿¤«»Ø¼¨¤òÁ÷¤ë¤Ë¤Ï, ¥¦¥£¥¸¥§¥Ã
-¥È̾¤Ë³¤¤¤Æ¥Ñ¥é¥á¡¼¥¿¤ò½ñ¤­¤Þ¤¹. ¤·¤¿¤¬¤Ã¤Æ, ¥¦¥£¥¸¥§¥Ã¥È¤¬¥ª¥Ö¥¸¥§¥¯
-¥È¤Ç¤¢¤ê, ¤½¤ì¤ËÂФ·¤Æ¥á¥½¥Ã¥É¤òÁ÷¤Ã¤Æ¤¤¤ë, ¤È¤ß¤Ê¤¹¤³¤È¤¬¤Ç¤­¤Þ¤¹. ¤µ
-¤Æ, tcl/tk ¥¤¥ó¥¿¥×¥ê¥¿¤Ç¤Ï, ÁȤ߹þ¤ß¥³¥Þ¥ó¥É¤â, Á°½Ò¤Î¥¦¥£¥¸¥§¥Ã¥È¤È
-Ʊ¤¸¤è¤¦¤Ê½ñ¼°¤ÎÌ¿Îá¤Ç¼Â¹Ô¤µ¤ì¤Þ¤¹. ¤¹¤Ê¤ï¤Á, ¥³¥Þ¥ó¥É¤â¥ª¥Ö¥¸¥§¥¯¥È¤Ç
-¤¢¤ë¤È¹Í¤¨¤ë¤³¤È¤¬¤Ç¤­¤Þ¤¹.
-
-¤³¤Î¤è¤¦¤Ê¹Í¤¨¤Ë´ð¤Å¤­, tcltk ¥é¥¤¥Ö¥é¥ê¤Ç¤Ï, tcl/tk ¤Î¥³¥Þ¥ó¥É¤ä¥¦¥£
-¥¸¥§¥Ã¥È¤ËÂбþ¤¹¤ë¥ª¥Ö¥¸¥§¥¯¥È¤òÀ¸À®¤·¤Þ¤¹. ¥ª¥Ö¥¸¥§¥¯¥È¤ËÂФ¹¤ë¥á¥½¥Ã
-¥É¸Æ¤Ó½Ð¤·¤Ï, e() ¥á¥½¥Ã¥É¤Ë¤è¤ê¼Â¹Ô¤µ¤ì¤Þ¤¹. Î㤨¤Ð, tcl/tk ¤Î info
-¥³¥Þ¥ó¥É¤ËÂбþ¤¹¤ë ruby ¤Î¥ª¥Ö¥¸¥§¥¯¥È¤¬ info ¤È¤¤¤¦Ì¾Á°¤Ç¤¢¤ë¤È¤¹¤ë¤È,
-tcl/tk ¤Î
- info commands
-¤È¤¤¤¦Ì¿Îá¤Ï tcltk ¥é¥¤¥Ö¥é¥ê¤Ç¤Ï
- info.e("commands")
-¤Èµ­½Ò¤µ¤ì¤Þ¤¹. ¤Þ¤¿, ¡Ö.¡×¤È¤¤¤¦¥¦¥£¥¸¥§¥Ã¥È (wish ¼Â¹Ô»þ¤Ë¼«Æ°Åª¤ËÀ¸
-À®¤µ¤ì¤ë¥ë¡¼¥È¥¦¥£¥¸¥§¥Ã¥È) ¤ËÂбþ¤¹¤ë ruby ¤Î¥ª¥Ö¥¸¥§¥¯¥È¤¬ root ¤È¤¤
-¤¦Ì¾Á°¤Ç¤¢¤ë¤È¤¹¤ë¤È,
- . configure -height 300 -width 300
-¤È¤¤¤¦ tcl/tk ¤ÎÌ¿Îá¤Ï
- root.e("configure -height 300 -width 300")
-¤Èµ­½Ò¤µ¤ì¤Þ¤¹. ¤³¤Î¤è¤¦¤Êµ­½Ò¤Ï, ¸«¤¿¤á¤Ë¤ÏÈþ¤·¤¯¤¢¤ê¤Þ¤»¤ó¤¬, ¤½¤·¤Æ,
-¥¹¥¯¥ê¥×¥È¤òÆÉ¤à¿Í¤Ë¤Ï¸«¤Å¤é¤¤¤«¤âÃΤì¤Þ¤»¤ó¤¬, ¼ÂºÝ¤Ë¥¹¥¯¥ê¥×¥È¤ò½ñ¤¤
-¤Æ¤ß¤ë¤ÈͽÁÛ³°¤Ë¼ê·Ú¤Ç¤¹.
-
-[»ÈÍÑË¡]
-
-1. ¥é¥¤¥Ö¥é¥ê¤òÆÉ¤ß¹þ¤à.
- require "tcltk"
-
-2. tcl/tk ¥¤¥ó¥¿¥×¥ê¥¿¤òÀ¸À®¤¹¤ë.
- ip = TclTkInterpreter.new()
-
-3. tcl/tk ¤Î¥³¥Þ¥ó¥É¤ËÂбþ¤¹¤ë¥ª¥Ö¥¸¥§¥¯¥È¤òÊÑ¿ô¤ËÂåÆþ¤·¤Æ¤ª¤¯.
- # ¥³¥Þ¥ó¥É¤ËÂбþ¤¹¤ë¥ª¥Ö¥¸¥§¥¯¥È¤¬Æþ¤Ã¤¿ Hash ¤ò¼è¤ê½Ð¤¹.
- c = ip.commands()
- # »È¤¤¤¿¤¤¥³¥Þ¥ó¥É¤ËÂбþ¤¹¤ë¥ª¥Ö¥¸¥§¥¯¥È¤ò¸ÄÊ̤ÎÊÑ¿ô¤ËÂåÆþ¤¹¤ë.
- bind, button, info, wm = c.indexes("bind", "button", "info", "wm")
-
-4. ɬÍפʽèÍý¤ò¹Ô¤¦.
- ¾Ü¤·¤¯¤Ï, ¥µ¥ó¥×¥ë¤ò»²¾È¤Î¤³¤È.
-
-5. ½àÈ÷¤¬¤Ç¤­¤¿¤é, ¥¤¥Ù¥ó¥È¥ë¡¼¥×¤ËÆþ¤ë.
- TclTk.mainloop()
-
-(( °Ê²¼, ¥â¥¸¥å¡¼¥ë, ¥¯¥é¥¹Åù¤ÎÀâÌÀ¤ò½ñ¤¯Í½Äê.))
-
-
-
-<< tcltklib ¥é¥¤¥Ö¥é¥ê >>
-
-tcl/tk ¤Î C ¥é¥¤¥Ö¥é¥ê¤òÍøÍѤ¹¤ë¤¿¤á¤ÎÄã¿å½à¥¤¥ó¥¿¡¼¥Õ¥§¡¼¥¹¤òÄ󶡤·¤Þ
-¤¹.
-
-¥³¥ó¥Ñ¥¤¥ë/¼Â¹Ô¤Ë¤Ï, tcl/tk ¤Î C ¥é¥¤¥Ö¥é¥ê¤¬É¬ÍפǤ¹.
-
-[ÀâÌÀ]
-
-¤³¤Î¥é¥¤¥Ö¥é¥ê¤òÍѤ¤¤ë¤È, ruby ¤«¤é tcl/tk ¤Î C ¥é¥¤¥Ö¥é¥ê¤òÍøÍѤǤ­¤Þ
-¤¹. ¶ñÂÎŪ¤Ë¤Ï, ruby ¥¤¥ó¥¿¥×¥ê¥¿¤«¤é tcl/tk ¥¤¥ó¥¿¥×¥ê¥¿¤ò¸Æ¤Ó½Ð¤¹¤³
-¤È¤¬¤Ç¤­¤Þ¤¹. ¤µ¤é¤Ë, ¤½¤Î(ruby ¥¤¥ó¥¿¥×¥ê¥¿¤«¤é¸Æ¤Ó½Ð¤·¤¿) tcl/tk ¥¤
-¥ó¥¿¥×¥ê¥¿¤«¤é, µÕ¤Ë ruby ¥¤¥ó¥¿¥×¥ê¥¿¤ò¸Æ¤Ó½Ð¤¹¤³¤È¤â¤Ç¤­¤Þ¤¹.
-
-[»ÈÍÑË¡]
-
-require "tcltklib" ¤¹¤ë¤È, °Ê²¼¤Î¥â¥¸¥å¡¼¥ë, ¥¯¥é¥¹¤¬ÍøÍѲÄǽ¤Ç¤¹.
-
-¥â¥¸¥å¡¼¥ë TclTkLib
- tcl/tk ¥é¥¤¥Ö¥é¥ê¤ò¸Æ¤Ó½Ð¤¹¥á¥½¥Ã¥É¤ò½¸¤á¤¿¥â¥¸¥å¡¼¥ë¤Ç¤¹. ¤¿¤À¤·,
- tcl/tk ¥¤¥ó¥¿¥×¥ê¥¿´Ø·¸¤Î¥á¥½¥Ã¥É¤Ï¥¯¥é¥¹ TclTkIp ¤Ë¤¢¤ê¤Þ¤¹.
-
- ¥â¥¸¥å¡¼¥ë¥á¥½¥Ã¥É mainloop()
- Tk_MainLoop ¤ò¼Â¹Ô¤·¤Þ¤¹. Á´¤Æ¤Î tk ¤Î¥¦¥¤¥ó¥É¥¦¤¬Ìµ¤¯¤Ê¤ë¤È½ªÎ»
- ¤·¤Þ¤¹(Î㤨¤Ð, tcl/tk ¤Ç½ñ¤¯¤È¤³¤í¤Î "destroy ." ¤ò¤·¤¿¾ì¹çÅù).
- °ú¿ô: ̵¤·
- Ìá¤êÃÍ: nil
-
-¥¯¥é¥¹ TclTkIp
- ¥¤¥ó¥¹¥¿¥ó¥¹¤¬ tcl/tk ¤Î¥¤¥ó¥¿¥×¥ê¥¿¤ËÂбþ¤·¤Þ¤¹. tcl/tk ¤Î¥é¥¤¥Ö
- ¥é¥ê¤Î»ÅÍÍÄ̤ê, ¥¤¥ó¥¹¥¿¥ó¥¹¤òÊ£¿ô¸ÄÀ¸À®¤·¤Æ¤âÀµ¤·¤¯Æ°ºî¤·¤Þ¤¹(¤½
- ¤ó¤Ê¤³¤È¤ò¤¹¤ëɬÍפϤ¢¤Þ¤ê̵¤¤¤Ï¤º¤Ç¤¹¤¬). ¥¤¥ó¥¿¥×¥ê¥¿¤Ï wish ¤Î
- tcl/tk ¥³¥Þ¥ó¥É¤ò¼Â¹Ô¤Ç¤­¤Þ¤¹. ¤µ¤é¤Ë, °Ê²¼¤Î¥³¥Þ¥ó¥É¤ò¼Â¹Ô¤Ç¤­¤Þ
- ¤¹.
- ¥³¥Þ¥ó¥É ruby
- °ú¿ô¤ò ruby ¤Ç¼Â¹Ô¤·¤Þ¤¹(ruby_eval_string ¤ò¼Â¹Ô¤·¤Þ¤¹). °ú¿ô
- ¤Ï 1 ¤Ä¤Ç¤Ê¤±¤ì¤Ð¤Ê¤ê¤Þ¤»¤ó. Ìá¤êÃÍ¤Ï ruby ¤Î¼Â¹Ô·ë²Ì¤Ç¤¹.
- ruby ¤Î¼Â¹Ô·ë²Ì¤Ï nil ¤« String ¤Ç¤Ê¤±¤ì¤Ð¤Ê¤ê¤Þ¤»¤ó.
-
- ¥¯¥é¥¹¥á¥½¥Ã¥É new()
- TclTkIp ¥¯¥é¥¹¤Î¥¤¥ó¥¹¥¿¥ó¥¹¤òÀ¸À®¤·¤Þ¤¹
- °ú¿ô: ̵¤·
- Ìá¤êÃÍ (TclTkIp): À¸À®¤µ¤ì¤¿¥¤¥ó¥¹¥¿¥ó¥¹
-
- ¥á¥½¥Ã¥É _eval(script)
- ¥¤¥ó¥¿¥×¥ê¥¿¤Ç script ¤òɾ²Á¤·¤Þ¤¹(Tcl_Eval ¤ò¼Â¹Ô¤·¤Þ¤¹). Á°½Ò
- ¤Î¤è¤¦¤Ë, ruby ¥³¥Þ¥ó¥É¤Ë¤è¤ê script Æâ¤«¤é ruby ¥¹¥¯¥ê¥×¥È¤ò¼Â
- ¹Ô¤Ç¤­¤Þ¤¹.
- °ú¿ô: script (String) - ¥¤¥ó¥¿¥×¥ê¥¿¤Çɾ²Á¤¹¤ë¥¹¥¯¥ê¥×¥Èʸ»úÎó
- Ìá¤êÃÍ (String): ɾ²Á·ë²Ì ((Tcl_Interp *)->result)
-
- ¥á¥½¥Ã¥É _return_value()
- ľÁ°¤Î Tcl_Eval ¤ÎÌá¤êÃͤòÊÖ¤·¤Þ¤¹. 0(TCL_OK) ¤ÇÀµ¾ï½ªÎ»¤Ç¤¹.
- °ú¿ô: ̵¤·
- Ìá¤êÃÍ (Fixnum): ľÁ°¤Î Tcl_Eval() ¤¬ÊÖ¤·¤¿ÃÍ.
-
-==============================================================
-
-°Ê²¼¤¬Ëܥɥ­¥å¥á¥ó¥ÈºîÀ®»þÅÀ¤Ç¤Î tcltklib ¥é¥¤¥Ö¥é¥ê¤ÎÀâÌÀ¤Ç¤¹¡¥
-==============================================================
-¥â¥¸¥å¡¼¥ë TclTkLib
- : ¸Ä¡¹¤Î Tcl/Tk ¥¤¥ó¥¿¡¼¥×¥ê¥¿¤Ë°Í¸¤·¤Ê¤¤½èÍý ( == ¥¤¥Ù¥ó¥È¥ë¡¼
- : ¥×¤Ë´Ø¤¹¤ë½èÍý ) ¤ò¸Æ¤Ó½Ð¤¹¥á¥½¥Ã¥É¤òÄêµÁ¤·¤¿¥â¥¸¥å¡¼¥ë¡¥
-
- ¥â¥¸¥å¡¼¥ë TclTkLib::EventFlag
- : do_one_event ¤ò¸Æ¤Ó½Ð¤¹ºÝ¤Î½èÍýÂоݥ¤¥Ù¥ó¥È¤ò»ØÄꤹ¤ë¤¿¤á¤Î
- : ¥Õ¥é¥° ( WINDOW|DONT_WAIT ¤È¤¤¤¦¤è¤¦¤Ë¥Ó¥Ã¥È±é»»»Ò¤ÇÏ¢·ë¤·¤Æ
- : »ØÄê ) ¤òÄê¿ô¤È¤·¤ÆÄêµÁ¤·¤¿¥â¥¸¥å¡¼¥ë¡¥°Ê²¼¤ÎÄê¿ô¤¬´Þ¤Þ¤ì¤ë¡¥
-
- Äê¿ô NONE
- : ÃÍ¤Ï 0 ¤Ç¡¤ÃͤȤ·¤Æ¤Ï¤¤¤«¤Ê¤ë¼ïÎà¤Î¥¤¥Ù¥ó¥È¤â»ØÄꤷ¤Æ¤¤¤Ê¤¤
- : ¤³¤È¤Ë¤Ê¤ë¤¬¡¤¼ÂºÝ¤Î½èÍý¾å¤Ï ALL ¤ÈƱ¤¸¤È¤·¤Æ°·¤ï¤ì¤ë¡¥
-
- Äê¿ô WINDOW
- : window ¥¤¥Ù¥ó¥È¤ò½èÍýÂоݤȤ¹¤ë
-
- Äê¿ô FILE
- : file ¥¤¥Ù¥ó¥È¤ò½èÍýÂоݤȤ¹¤ë
-
- Äê¿ô TIMER
- : timer ¥¤¥Ù¥ó¥È¤ò½èÍýÂоݤȤ¹¤ë
-
- Äê¿ô IDLE
- : ¥¢¥¤¥É¥ë¥ë¡¼¥×½èÍý ( ºÆÉÁ²è¤Ê¤É¡¤Â¾¤Î¼ïÎà¤Î¥¤¥Ù¥ó¥È¤¬È¯À¸
- : ¤·¤Æ¤¤¤Ê¤¤¤È¤­¤Ë¹Ô¤ï¤ì¤ë½èÍý ) ¤ò½èÍýÂоݤȤ¹¤ë
-
- Äê¿ô ALL
- : ¤¹¤Ù¤Æ¤Î¼ïÎà¤Î¥¤¥Ù¥ó¥È¤ò½èÍýÂоݤȤ¹¤ë
- : WINDOW|FILE|TIMER|IDLE ¤ÈƱ¤¸
-
- Äê¿ô DONT_WAIT
- : ½èÍýÂоݥ¤¥Ù¥ó¥È¤¬Â¸ºß¤·¤Ê¤¤¾ì¹ç¤Ë¡¤¥¤¥Ù¥ó¥ÈȯÀ¸¤òÂÔ¤¿¤º
- : ¤Ë do_one_event ¤ò½ªÎ» ( false ¤òÊÖ¤¹ ) ¤¹¤ë
-
- ¥â¥¸¥å¡¼¥ë TclTkLib::VarAccessFlag
- : _get_variable ¤Ê¤É¤Ç¤Î¥Õ¥é¥°¤ò»ØÄꤹ¤ë¤¿¤á¤Î¤â¤Î¡¥¥Õ¥é¥°¤Ë
- : ¤Ï°Ê²¼¤ÎÄê¿ô¤ò OR ¤ÇÏ¢·ë¤·¤ÆÍ¿¤¨¤ë¡¥
-
- Äê¿ô NONE
- : ÃÍ¤Ï 0 ¤Ç¡¤²¿¤â¥Õ¥é¥°¤ò»ØÄꤷ¤Æ¤¤¤Ê¤¤¤Î¤ËÅù¤·¤¤¡¥
-
- Äê¿ô GLOBAL_ONLY
- : Ä̾ÊÑ¿ô¤Î¸¡º÷¤Ï¤Þ¤º¼ê³¤­¸Æ¤Ó½Ð¤·¤ò¹Ô¤Ã¤¿¥ì¥Ù¥ë¤Ç¸¡
- : º÷¤·¡¤¼¡¤Ë¸½ºß¤Î̾Á°¶õ´Ö¤Ç¸¡º÷¡¤ºÇ¸å¤Ë¥°¥í¡¼¥Ð¥ë¶õ´Ö¤Ç
- : ¸¡º÷¤ò¹Ô¤¦¡¥¤·¤«¤·¡¤¤³¤Î¥Õ¥é¥°¤¬»ØÄꤵ¤ì¤¿¾ì¹ç¤Ë¤Ï¡¤¥°
- : ¥í¡¼¥Ð¥ë¶õ´Ö¤Ç¤Î¤ß¸¡º÷¤¹¤ë¡¥
- : ¤â¤· GLOBAL_ONLY ¤È NAMESPACE_ONLY ¤È¤¬Î¾Êý»ØÄꤵ¤ì¤¿¾ì
- : ¹ç¤Ë¤Ï¡¤GLOBAL_ONLY ¤Î»ØÄê¤Ï̵»ë¤µ¤ì¤ë¡¥
-
- Äê¿ô NAMESPACE_ONLY
- : ¤³¤Î¥Õ¥é¥°¤¬»ØÄꤵ¤ì¤¿¾ì¹ç¤Ë¤Ï¡¤¸½ºß¤Î̾Á°¶õ´Ö¤Ç¤Î¤ßÊÑ
- : ¿ô¤Î¸¡º÷¤ò¹Ô¤¦¡¥GLOBAL_ONLY ¤ÎÀâÌÀ¤â»²¾È¤¹¤ë¤³¤È¡¥
-
- Äê¿ô LEAVE_ERR_MSG
- : ÊÑ¿ô¥¢¥¯¥»¥¹¤Ë¤ª¤¤¤Æ¥¨¥é¡¼¤¬È¯À¸¤·¤¿¾ì¹ç¡¤¤³¤Î¥Õ¥é¥°¤¬
- : »ØÄꤵ¤ì¤Æ¤¤¤ì¤Ð¡¤¼Â¹Ô·ë²Ì¤È¤·¤Æ Tcl ¥¤¥ó¥¿¡¼¥×¥ê¥¿¤Ë¥¨
- : ¥é¡¼¥á¥Ã¥»¡¼¥¸¤¬»Ä¤µ¤ì¤ë¡¥¤³¤Î¥Õ¥é¥°¤¬»ØÄꤵ¤ì¤Æ¤¤¤Ê¤±
- : ¤ì¤Ð¡¤¥¨¥é¡¼¥á¥Ã¥»¡¼¥¸¤Ï°ìÀڻĤµ¤ì¤Ê¤¤¡¥
-
- Äê¿ô APPEND_VALUE
- : ¤³¤Î¥Õ¥é¥°¤¬»ØÄꤵ¤ì¤Æ¤¤¤¿¾ì¹ç¡¤ÊÑ¿ô¤ÎÃͤòÃÖ¤­´¹¤¨¤Î¤Ç
- : ¤Ï¤Ê¤¯¡¤¸½ºß¤ÎÃͤËÂåÆþÃͤ¬Äɲà (append; ʸ»úÎóÏ¢·ë) ¤µ
- : ¤ì¤ë¡¥ÊÑ¿ô¤¬Ì¤ÄêµÁ¤¢¤Ã¤¿¾ì¹ç¡¤¤³¤Î¥Õ¥é¥°¤Ï̵»ë¤µ¤ì¤ë¡¥
-
- Äê¿ô LIST_ELEMENT
- : ¤³¤Î¥Õ¥é¥°¤¬»ØÄꤵ¤ì¤Æ¤¤¤¿¾ì¹ç¡¤ÂåÆþÃͤϤޤº Tcl ¤Î¥ê¥¹
- : ¥ÈÍ×ÁǤȤ·¤ÆÅ¬ÀڤȤʤë¤è¤¦¤ËÊÑ´¹¤µ¤ì¤ë¡¥ÂåÆþÃͤ¬¥ê¥¹¥È
- : (¤Þ¤¿¤Ï¥µ¥Ö¥ê¥¹¥È) ¤ÎºÇ½é¤ÎÍ×ÁǤȤʤë¤Î¤Ç¤Ê¤¤¸Â¤ê¡¤ÂåÆþ
- : ÃͤÎľÁ°¤Ë¤Ï¶õÇòʸ»ú¤¬Äɲ䵤ì¤ë¡¥
-
- Äê¿ô PARSE_VARNAME
- : _set_variable ¤Ê¤É¤Î¸Æ¤Ó½Ð¤·¤Ë¤ª¤¤¤Æ¤³¤Î¥Õ¥é¥°¤¬»ØÄꤵ
- : ¤ì¤Æ¤¤¤¿¾ì¹ç¡¤var_name °ú¿ô¤¬Ï¢ÁÛÇÛÎó̾¤ÈÍ×ÁÇ̾¤È¤òξÊý
- : ´Þ¤à²ÄǽÀ­¤¬¤¢¤ë (³«¤­³ç¸Ì¤ò´Þ¤ß¡¤ÊĤ¸³ç¸Ì¤Ç½ª¤ï¤ë) ¤³
- : ¤È¤ò¼¨¤¹¡¥¤½¤Î¾ì¹ç¡¤³ç¸Ì¤Î´Ö¤¬Í×ÁÇ̾»ØÄꡤºÇ½é¤Î³«¤­³ç
- : ¸Ì¤Þ¤Ç¤¬Ï¢ÁÛÇÛÎó̾¤È¤·¤Æ°·¤ï¤ì¤ë¡¥_set_variable2 ¤Ê¤É¤Ç
- : ¤³¤Î¥Õ¥é¥°¤ò»ØÄꤹ¤ë¾ì¹ç¡¤Ï¢ÁÛÇÛÎó̾¤ÈÍ×ÁÇ̾¤Ï var_name
- : ¤«¤éÃê½Ð¤µ¤ì¤ë¤Ï¤º¤Ç¤¢¤ë¤«¤é¡¤index_name °ú¿ô¤Ï nil ¤È
- : ¤»¤Í¤Ð¤Ê¤é¤Ê¤¤¡¥
-
- ¥â¥¸¥å¡¼¥ë TclTkLib::RELEASE_TYPE
- : Tcl/Tk ¤Î¥ê¥ê¡¼¥¹¥¿¥¤¥×ÈÖ¹æ¤ÎÄêµÁ
-
- Äê¿ô ALPHA
- : ALPHA ¥ê¥ê¡¼¥¹
-
- Äê¿ô BETA
- : BETA ¥ê¥ê¡¼¥¹
-
- Äê¿ô FINAL
- : FINAL ¥ê¥ê¡¼¥¹
-
- ¥â¥¸¥å¡¼¥ë¥á¥½¥Ã¥É
- get_version()
- : Tcl/Tk ¤Î major, minor, release-type ÈÖ¹æ, patchlevel ¤ò
- : ÇÛÎó¤Ë¤·¤ÆÊÖ¤¹¡¥
-
- mainloop(check_root = true)
- : ¥¤¥Ù¥ó¥È¥ë¡¼¥×¤òµ¯Æ°¤¹¤ë¡¥check_root ¤¬ true ¤Ç¤¢¤ì¤Ð¡¤
- : root widget ¤¬Â¸ºß¤¹¤ë¸Â¤ê¡¤¤³¤Î¥á¥½¥Ã¥É¤Ï½ªÎ»¤·¤Ê¤¤¡¥
- : check_root ¤¬ false ¤Î¾ì¹ç¤Ï¡¤root widget ¤¬¾ÃÌǤ·¤Æ¤â
- : ¤³¤Î¥á¥½¥Ã¥É¤Ï½ªÎ»¤·¤Ê¤¤ ( root widget ¤¬¾ÃÌǤ·¤Æ¤â¡¤
- : WINDOW °Ê³°¤Î¥¤¥Ù¥ó¥È¤ÏȯÀ¸¤·¤¦¤ë¤¿¤á )¡¥½ªÎ»¤Ë¤Ï¡¤³°Éô
- : ¤«¤é¤ÎƯ¤­³Ý¤± ( ¥¹¥ì¥Ã¥É¤ò³èÍѤ¹¤ë¤Ê¤É ) ¤¬É¬Íס¥
-
- mainloop_thread?
- : ¥«¥ì¥ó¥È¥¹¥ì¥Ã¥É¤¬¥¤¥Ù¥ó¥È¥ë¡¼¥×¤ò¼Â¹Ô¤·¤Æ¤¤¤ë¥¹¥ì¥Ã¥É
- : ¤«¤É¤¦¤«¤òÊÖ¤¹¡¥
- : ¥¤¥Ù¥ó¥È¥ë¡¼¥×¤ò¼Â¹Ô¤·¤Æ¤¤¤ë¥¹¥ì¥Ã¥É¤Ç¤¢¤ì¤Ð true ¤ò¡¤
- : ¤É¤Î¥¹¥ì¥Ã¥É¤Ç¤â¥¤¥Ù¥ó¥È¥ë¡¼¥×¤¬¼Â¹Ô¤µ¤ì¤Æ¤¤¤Ê¤¤¾ì¹ç¤Ï
- : nil ¤ò¡¤Â¾¤Î¥¹¥ì¥Ã¥É¤Ç¥¤¥Ù¥ó¥È¥ë¡¼¥×¤¬¼Â¹Ô¤µ¤ì¤Æ¤¤¤ë¾ì
- : ¹ç¤Ï false ¤òÊÖ¤¹¡¥
- : false ¤ÎºÝ¤Ë Tk ¥¤¥ó¥¿¡¼¥×¥ê¥¿¤òľÀÜ¸Æ¤Ö¤Î¤Ï´í¸±¤Ç¤¢¤ë¡¥
-
- mainloop_watchdog(check_root = true)
- : Ä̾ï¤Î¥¤¥Ù¥ó¥È¥ë¡¼¥×¤Ç¤Ï¡¤¥¤¥Ù¥ó¥È½èÍý¤ÎÆâÍÆ¤Ë¤è¤Ã¤Æ¤Ï
- : ¥Ç¥Ã¥É¥í¥Ã¥¯¤ò°ú¤­µ¯¤³¤¹²ÄǽÀ­¤¬¤¢¤ë (Î㤨¤Ð¥¤¥Ù¥ó¥È¤Ë
- : ÂФ¹¤ë¥³¡¼¥ë¥Ð¥Ã¥¯½èÍýÃæ¤Ç widget Áàºî¤ò¤·¡¤¤½¤Î½ªÎ»¤ò
- : ÂԤĤʤÉ)¡¥¤³¤Î¥á¥½¥Ã¥É¤Ï¡¤¤½¤¦¤·¤¿¥Ç¥Ã¥É¥í¥Ã¥¯¤ò²óÈò¤¹
- : ¤ë¤¿¤á¤Î´Æ»ë¥¹¥ì¥Ã¥ÉÉÕ¤­¤Ç¥¤¥Ù¥ó¥È¥ë¡¼¥×¤òµ¯Æ°¤¹¤ë
- : ( ´Æ»ë¥¹¥ì¥Ã¥É¤òÀ¸À®¤·¤¿¸å¤Ë¥¤¥Ù¥ó¥È¥ë¡¼¥×¤ò¼Â¹Ô¤¹¤ë )¡¥
- : °ú¿ô¤Î°ÕÌ£¤Ï mainloop ¤ÈƱ¤¸¤Ç¤¢¤ë¡¥
-
- do_one_event(flag = TclTkLib::EventFlag::ALL |
- TclTkLib::EventFlag::DONT_WAIT)
- : ½èÍýÂÔ¤Á¤Î¥¤¥Ù¥ó¥È 1 ¸Ä¤ò¼Â¹Ô¤¹¤ë¡¥
- : ¥¤¥Ù¥ó¥È¤ò½èÍý¤·¤¿¾ì¹ç¤Ï true ¤òÊÖ¤¹¡¥
- : ¥Õ¥é¥°¤Ç DONT_WAIT ¤ò»ØÄꤷ¤Æ¤¤¤Ê¤¤¾ì¹ç¡¤¥Õ¥é¥°¤Ç½èÍýÂÐ
- : ¾Ý¤È¤Ê¤Ã¤Æ¤¤¤ë¼ïÎà¤Î¥¤¥Ù¥ó¥È¤¬È¯À¸¤¹¤ë¤Þ¤ÇÂÔ¤Á³¤±¤ë¡¥
- : DONT_WAIT ¤ò»ØÄꤷ¤Æ¤¤¤¿¾ì¹ç¡¤½èÍýÂоݥ¤¥Ù¥ó¥È¤¬¤Ê¤¯¤Æ¤â
- : ¤¹¤°¤Ë½ªÎ»¤· false ¤òÊÖ¤¹¡¥
- : $SAFE >= 4 ¤«¡¤$SAFE >= 1 ¤«¤Ä flag ¤¬±øÀ÷¤µ¤ì¤Æ¤¤¤ë¤Ê¤é¤Ð
- : flag ¤Ë¤Ï DONT_WAIT ¤¬¶¯À©Åª¤ËÉÕ¤±¤é¤ì¤ë¡¥
-
- set_eventloop_tick(timer_tick)
- : ¥¤¥Ù¥ó¥È¥ë¡¼¥×¤ÈƱ»þ¤ËÊÌ¥¹¥ì¥Ã¥É¤¬²ÔƯ¤·¤Æ¤¤¤ë¾ì¹ç¤Ë¡¤»þ
- : ´Ö¤Ë´ð¤Å¤¤¤¿¶¯À©Åª¤Ê¥¹¥ì¥Ã¥É¥¹¥¤¥Ã¥Á¥ó¥°¤ò¤É¤ÎÄøÅÙ¤ÎÉÑÅÙ
- : ( »þ´Ö´Ö³Ö ) ¤ÇȯÀ¸¤µ¤»¤ë¤«¤ò¥ß¥êÉÃñ°Ì¤ÎÀ°¿ôÃͤǻØÄꤹ¤ë¡¥
- : 0 ¤ò»ØÄꤹ¤ë¤È¡¤¤³¤Î¶¯À©Åª¤Ê¥¹¥¤¥Ã¥Á¥ó¥°¤Ï¹Ô¤ï¤ì¤Ê¤¤¡¥
- : ɸ½à¤Ç¤Ï 0 ¤ËÀßÄꤵ¤ì¤Æ¤ª¤ê¡¤¥¤¥Ù¥ó¥È½èÍý¿ô¤Ë´ð¤Å¤¯¥¹¥¤¥Ã
- : ¥Á¥ó¥°¤À¤±¤¬¹Ô¤ï¤ì¤ë ( see set_eventloop_weight )¡¥
- : ¤¿¤À¤·¡¤²ÔƯ¤·¤Æ¤¤¤ë¥¹¥ì¥Ã¥É¤¬¥¤¥Ù¥ó¥È¥ë¡¼¥×¤À¤±¤Î¾ì¹ç¡¤
- : timer_tick ¤ò 0 ¤ËÀßÄꤹ¤ë¤³¤È¤Ï¤Ç¤­¤Ê¤¤¡¥¤â¤·ÀßÄꤵ¤ì¤Æ
- : ¤¤¤¿¤é¡¤100 ms ( see NO_THREAD_INTERRUPT_TIME ) ¤Ë¼«Æ°Àß
- : Äꤵ¤ì¤ë¡¥
- : ¾ÜºÙ¤ÊÀâÌÀ¤Ïά¤¹¤¬¡¤¤³¤ì¤Ï CPU ¥Ñ¥ï¡¼¤òÀáÌ󤷤ĤİÂÁ´¤Ç
- : °ÂÄꤷ¤¿Æ°ºî¤ò¼Â¸½¤¹¤ë¤¿¤á¤Ë¼ÂÁõ¤·¤¿»ÅÍͤǤ¢¤ë¡¥
- : $SAFE >= 4 ¤Ç¤Ï¼Â¹Ô¤¬¶Ø»ß¤µ¤ì¤ë¡¥
-
- get_eventloop_tick
- : timer_tick ¤Î¸½ºßÃͤòÊÖ¤¹¡¥
-
- set_no_event_wait(no_event_wait)
- : Ê£¿ô¤Î¥¹¥ì¥Ã¥É¤¬²ÔƯ¤·¤Æ¤¤¤ë¾ì¹ç¤Ç¡¤½èÍýÂÔ¤Á¥¤¥Ù¥ó¥È¤¬Á´
- : ¤¯Â¸ºß¤·¤Ê¤«¤Ã¤¿ºÝ¤Ë sleep ¾õÂÖ¤ËÆþ¤ë»þ´ÖŤò»ØÄꤹ¤ë¡¥
- : ²ÔƯ¥¹¥ì¥Ã¥É¤¬¥¤¥Ù¥ó¥È¥ë¡¼¥×¤À¤±¤Î¾ì¹ç¤Ë¤Ï°ÕÌ£¤ò¤Ê¤µ¤Ê¤¤¡¥
- : ¥Ç¥Õ¥©¥ë¥È¤ÎÃÍ¤Ï 20 (ms)
- : $SAFE >= 4 ¤Ç¤Ï¼Â¹Ô¤¬¶Ø»ß¤µ¤ì¤ë¡¥
-
- get_no_event_wait
- : no_event_wait ¤Î¸½ºßÃͤòÊÖ¤¹¡¥
-
- set_eventloop_weight(loop_max, no_event_tick)
- : Ê£¿ô¤Î¥¹¥ì¥Ã¥É¤¬²ÔƯ¤·¤Æ¤¤¤ëºÝ¤Ë Ruby/Tk ¤Î¥¤¥Ù¥ó¥È¥ë¡¼
- : ¥×¤Ë³ä¤êÅö¤Æ¤ëÈæ½Å¤òÄê¤á¤ë¤¿¤á¤Î¥Ñ¥é¥á¡¼¥¿¤òÀßÄꤹ¤ë¡¥
- : ²ÔƯ¥¹¥ì¥Ã¥É¤¬¥¤¥Ù¥ó¥È¥ë¡¼¥×¤À¤±¤Î¾ì¹ç¤Ë¤Ï°ÕÌ£¤ò¤Ê¤µ¤Ê¤¤¡¥
- : °ìÅ٤Υ¹¥ì¥Ã¥ÉÀÚ¤êÂØ¤¨¤Î´Ö¤Ë½èÍý¤¹¤ë¥¤¥Ù¥ó¥È¤ÎºÇÂç¿ô¤È¡¤
- : ½èÍýÂÔ¤Á¤Î¥¤¥Ù¥ó¥È¤¬Â¸ºß¤·¤Ê¤¤ºÝ¤Î²Ã»»¿ô¤È¤òÀßÄꤹ¤ë¡¥
- : ½èÍýÂÔ¤Á¥¤¥Ù¥ó¥È¤¬Â¸ºß¤·¤Ê¤¤¾ì¹ç¤Ï no_event_wait ( see
- : set_no_event_wait ) ¤À¤±¤Î´Ö sleep ¾õÂÖ¤ËÆþ¤ë¡¥
- : ¥Ç¥Õ¥©¥ë¥È¤Ç¤Ï¤½¤ì¤¾¤ì 800 ²ó¤È 10 ²ó¡¤¤Ä¤Þ¤ê¡¤800 ¸Ä¤Î¥¤
- : ¥Ù¥ó¥È (¥¢¥¤¥É¥ë¥¤¥Ù¥ó¥È¤ò´Þ¤à) ¤ò½èÍý¤¹¤ë¤È¤«¡¤¥¤¥Ù¥ó¥È
- : ¤¬Á´¤¯È¯À¸¤·¤Ê¤¤¤Þ¤Þ¤Ë 80 ²ó¤Î½èÍýÂÔ¤Á¥¤¥Ù¥ó¥È¸¡ºº¤¬´°Î»
- : ¤¹¤ë¤È¤«¤Ç¥«¥¦¥ó¥È¤¬ 800 °Ê¾å¤Ë¤Ê¤ë¤È¥¹¥ì¥Ã¥É¥¹¥¤¥Ã¥Á¥ó¥°
- : ¤¬È¯À¸¤¹¤ë¤³¤È¤Ë¤Ê¤ë¡¥
- : $SAFE >= 4 ¤Ç¤Ï¼Â¹Ô¤¬¶Ø»ß¤µ¤ì¤ë¡¥
-
- get_eventloop_weight
- : ¸½ºß¤Î loop_max ¤È no_event_tick ¤È¤ÎÃͤòÊÖ¤¹¡¥
- : ( see set_eventloop_wait )
-
- mainloop_abort_on_exception=(bool)
- : Tk ¥¤¥ó¥¿¡¼¥×¥ê¥¿¾å¤ÇÎã³°¤òȯÀ¸¤·¤¿ºÝ¤Ë¡¤¥¤¥Ù¥ó¥È¥ë¡¼¥×¤ò
- : ¥¨¥é¡¼Ää»ß¤µ¤»¤ë¤«¤É¤¦¤«¤ò»ØÄꤹ¤ë¡¥true ¤ò»ØÄꤷ¤¿¾ì¹ç¤Ï
- : ¥¨¥é¡¼Ää»ß¤¹¤ë¤¬¡¤false ¤Î¾ì¹ç¤ÏÎã³°¤ò̵»ë¤·¤Æ¥¤¥Ù¥ó¥È¥ë¡¼
- : ¥×¤ò·Ñ³¤¹¤ë¡¥¤µ¤é¤Ë nil ¤Î¾ì¹ç¤Ï·Ù¹ð¥â¡¼¥É¤Ç¤Ê¤¤¸Â¤ê¤Ï¥¨
- : ¥é¡¼¥á¥Ã¥»¡¼¥¸¤Î½ÐÎϤ¹¤é¾Êά¤·¤Æ¡¤Îã³°¤ò̵»ë¤¹¤ë¡¥
- : ¥Ç¥Õ¥©¥ë¥È¤Ç¤Ï true ¤ËÀßÄꤵ¤ì¤Æ¤¤¤ë¡¥
- : £±¸Ä¤Î¥¤¥ó¥¿¡¼¥×¥ê¥¿¤À¤±¤ò»È¤Ã¤Æ¤¤¤ë¾ì¹ç¤Ë¤Ï¥¨¥é¡¼»þ¤Ë¤½¤Î
- : ¤Þ¤ÞÄä»ß¤·¤Æ¤âÄ̾ï¤ÏÌäÂê¤Ê¤¤¤¬¡¤Ê£¿ô¤Î¥¤¥ó¥¿¡¼¥×¥ê¥¿¤¬Æ±»þ
- : ¤Ëưºî¤·¤Æ¤¤¤ë¾ì¹ç¤Ë¤Ï¡¤¤½¤ì¤é¤ò´ÉÍý¤¹¤ë¥¤¥Ù¥ó¥È¥ë¡¼¥×¤Ï£±
- : ¸Ä¤À¤±¤Ç¤¢¤ë¤¿¤á¡¤¤¤¤º¤ì¤«¤Î¥¤¥ó¥¿¡¼¥×¥ê¥¿¤Î¥¨¥é¡¼¤¬¸¶°ø¤Ç¡¤
- : ¾¤Î¥¤¥ó¥¿¡¼¥×¥ê¥¿¤Î½èÍý·Ñ³¤¬ÉÔ²Äǽ¤Ë¤Ê¤ë¤³¤È¤¬¤¢¤ë¡¥¤½¤Î
- : ¤è¤¦¤Ê¾ì¹ç¤Ç¤â¥¨¥é¡¼¤ò̵»ë¤·¤Æ¥¤¥Ù¥ó¥È¥ë¡¼¥×¤¬²ÔƯ¤ò³¤±¤ë
- : ¤³¤È¤Ç¡¤Â¾¤Î¥¤¥ó¥¿¡¼¥×¥ê¥¿¤¬Àµ¾ï¤Ëưºî¤·Â³¤±¤ë¤³¤È¤¬¤Ç¤­¤ë¡¥
- : $SAFE >= 4 ¤Ç¤Ï¼Â¹Ô¤¬¶Ø»ß¤µ¤ì¤ë¡¥
-
- mainloop_abort_on_exception
- : Tk ¥¤¥ó¥¿¡¼¥×¥ê¥¿¾å¤ÇÎã³°¤òȯÀ¸¤·¤¿ºÝ¤Ë¡¤¥¤¥Ù¥ó¥È¥ë¡¼¥×¤ò¥¨
- : ¥é¡¼Ää»ß¤µ¤»¤ë¤«¤É¤¦¤«¤ÎÀßÄê¾õÂÖ¤ò true/false ¤ÇÆÀ¤ë¡¥
-
- num_of_mainwindows
- : ¸½ºß¤Î¥á¥¤¥ó¥¦¥£¥ó¥É¥¦ (¥ë¡¼¥È¥¦¥£¥¸¥§¥Ã¥È) ¤Î¿ô¤òÊÖ¤¹¡¥
- : ¥á¥¤¥ó¥¦¥£¥ó¥É¥¦¤Ï°ì¤Ä¤Î¥¤¥ó¥¿¡¼¥×¥ê¥¿¤ËÉÕ¤­ºÇÂç°ì¤Ä¤Ç¤¢¤ë
- : ¤Î¤Ç¡¤¤³¤ÎÃͤϸ½ºß Tk ¤Îµ¡Ç½¤¬Í­¸ú¤Ç¤¢¤ë¥¤¥ó¥¿¡¼¥×¥ê¥¿¤ÎÁí
- : ¿ô¤ËÅù¤·¤¤¡¥
-
- _merge_tklist(str, str, ... )
- : Tcl/Tk ¤Î¥é¥¤¥Ö¥é¥ê´Ø¿ô¤ò»È¤Ã¤Æ¡¤°ú¿ô¤Îʸ»úÎ󤬤½¤ì¤¾¤ì
- : Àµ¤·¤¯°ì¤Ä¤Î¥ê¥¹¥ÈÍ×ÁǤȤʤë¤è¤¦¤ËÏ¢·ë¤·¤¿Ê¸»úÎó¤òÊÖ¤¹¡¥
-
- _conv_listelement(str)
- : Tcl/Tk ¤Î¥é¥¤¥Ö¥é¥ê´Ø¿ô¤ò»È¤Ã¤Æ¡¤°ú¿ô¤Îʸ»úÎó¤¬ Tcl ¤Î
- : °ì¤Ä¤Î¥ê¥¹¥ÈÍ×ÁǤȤ·¤ÆÅ¬ÀÚ¤Êɽ¸½¤Ë¤Ê¤ë¤è¤¦¤ËÊÑ´¹¤·¤¿Ê¸
- : »úÎó¤òÊÖ¤¹¡¥
-
- _toUTF8(str, encoding=nil)
- _fromUTF8(str, encoding=nil)
- : Tcl/Tk ¤¬Æâ¢¤·¤Æ¤¤¤ë UTF8 ÊÑ´¹½èÍý¤ò¸Æ¤Ó½Ð¤¹¡¥
-
- _subst_UTF_backslash(str)
- _subst_Tcl_backslash(str)
- : Tcl ¤Î¥ë¡¼¥ë¤Ç¥Ð¥Ã¥¯¥¹¥é¥Ã¥·¥åµ­Ë¡ ( \uhhhh ¤Ë¤è¤ë
- : Unicode ʸ»úɽ¸½¤ò´Þ¤à ) ¤ò²òÀϤ¹¤ë¡¥
- : _subst_Tcl_backslash ¤Ï¤¹¤Ù¤Æ¤Î¥Ð¥Ã¥¯¥¹¥é¥Ã¥·¥åµ­Ë¡¤ò
- : ÃÖ¤­´¹¤¨¤ë¤Î¤ËÂФ·¡¤_subst_UTF_backslash ¤Ï \uhhhh
- : ¤Ë¤è¤ë Unicode ʸ»úɽ¸½¤À¤±¤òÃÖ¤­´¹¤¨¤ë¡¥
-
- encoding_system
- encoding_system=(encoding)
- : Tcl ¤Î system encoding ¤Î³ÍÆÀ¤ª¤è¤ÓÀßÄê
-
- encoding
- encoding=(encoding)
- : encoding_system / encoding_system= ¤Î alias
- : ( Ruby/Tk ¤Î tk.rb ¤Ç¤ÏÃÖ¤­´¹¤¨¤é¤ì¤ëͽÄê¤Î¤â¤Î¡¥)
-
-
-¥¯¥é¥¹ TclTkIp
- ¥¯¥é¥¹¥á¥½¥Ã¥É
- new(ip_name=nil, options='')
- : TclTkIp ¥¯¥é¥¹¤Î¥¤¥ó¥¹¥¿¥ó¥¹¤òÀ¸À®¤¹¤ë¡¥
- : ip_name ¤Ëʸ»úÎó¤òÍ¿¤¨¤¿¾ì¹ç¤Ï¡¤¤½¤ì¤¬ winfo interps ¤Ê¤É¤Ç
- : ɽ¼¨¤µ¤ì¤ë̾Á°¤Ë¤Ê¤ë¡¥
- : options ¤Ë¤Ï¡¤-geometry ¤ä -use ¤Ê¤É¡¤wish ¤Î¥³¥Þ¥ó¥É¥é¥¤¥ó
- : °ú¿ô¤È¤·¤ÆÍ¿¤¨¤ë¥ª¥×¥·¥ç¥ó¤ÈƱÍͤξðÊó¤òʸ»úÎó¤È¤·¤ÆÍ¿¤¨¤ë¡¥
- : Í¿¤¨¤é¤ì¤¿¾ðÊó¤Ï¡¤root widget À¸À®¤ÎºÝ¤ËÍѤ¤¤é¤ì¤ë¡¥
- : ( e.g. TclTkIp.new('FOO', '-geometry 500x200 -use 0x2200009') )
- : ¤â¤· options ¤Ë´º¤¨¤Æ nil ¤Þ¤¿¤Ï false ¤òÍ¿¤¨¤¿¾ì¹ç¡¤Tk ¥é¥¤
- : ¥Ö¥é¥ê¤¬Æ³Æþ¤µ¤ì¤Æ¤¤¤Ê¤¤ (¤Ä¤Þ¤ê¤Ï Tcl ¤Î¤ß¤Î) ¥¤¥ó¥¿¡¼¥×¥ê
- : ¥¿¤òÀ¸À®¤¹¤ë¡¥¤³¤Î¾ì¹ç¤Ï GUI ´Ä¶­¤ÏɬÍפʤ¤¤¿¤á¡¤¥¦¥¤¥ó¥É¥¦
- : ¥·¥¹¥Æ¥à¤¬Â¸ºß¤·¤Ê¤¤¡¤¤Þ¤¿¤Ï»ÈÍѤǤ­¤Ê¤¤´Ä¶­¤Ç¤â Tcl ¥¤¥ó¥¿¡¼
- : ¥×¥ê¥¿¤òÀ¸À®¤·¡¤Tcl ¤ä¤½¤Î³ÈÄ¥¥é¥¤¥Ö¥é¥ê¤ò³èÍѤ¹¤ë¤³¤È¤¬¤Ç¤­¤ë¡¥
-
- ¥¤¥ó¥¹¥¿¥ó¥¹¥á¥½¥Ã¥É
- create_slave(name, safe=false)
- : ¥ì¥·¡¼¥Ð¤ò¿Æ¤È¤¹¤ë name ¤È¤¤¤¦Ì¾Á°¤Î¥¹¥ì¡¼¥Ö¥¤¥ó¥¿¡¼¥×¥ê¥¿¤ò
- : À¸À®¤¹¤ë¡¥
- : safe ¤Ë¤ÏÀ¸À®¤¹¤ë¥¤¥ó¥¿¡¼¥×¥ê¥¿¤ò safe ¥¤¥ó¥¿¡¼¥×¥ê¥¿¤È¤¹¤ë
- : ¤«¤ò»ØÄꤹ¤ë¡¥¥Ç¥Õ¥©¥ë¥È¤Ï false ¤È¤¤¤¦¤³¤È¤Ë¤Ê¤Ã¤Æ¤¤¤ë¤¬¡¤
- : ¤¿¤È¤¨ÌÀ³Î¤Ë false ¤ò»ØÄꤷ¤Æ¤¤¤¿¤È¤·¤Æ¤â¡¤¿Æ¤È¤Ê¤ë¥¤¥ó¥¿¡¼
- : ¥×¥ê¥¿¤¬ safe ¥¤¥ó¥¿¡¼¥×¥ê¥¿¤Ç¤¢¤ì¤Ð¡¤¤½¤ÎÀßÄê¤ò°ú¤­·Ñ¤¤¤Ç
- : safe ¥¤¥ó¥¿¡¼¥×¥ê¥¿¤È¤·¤ÆÀ¸À®¤µ¤ì¤ë¡¥
- : $SAFE >= 4 ¤Ç¤Ï¡¤safe ¥¤¥ó¥¿¡¼¥×¥ê¥¿°Ê³°¤ÎÀ¸À®¤¬¶Ø»ß¤µ¤ì¤ë¡¥
-
- make_safe
- : Tcl/Tk ¥¤¥ó¥¿¡¼¥×¥ê¥¿¤ò safe ¥¤¥ó¥¿¡¼¥×¥ê¥¿¤ËÊѹ¹¤¹¤ë¡¥
- : Ìá¤êÃͤϥ쥷¡¼¥Ð¤Ç¤¢¤ë¥¤¥ó¥¿¡¼¥×¥ê¥¿¼«¿È¤Ç¤¢¤ë¡¥
- : ¼ºÇÔ¤·¤¿¾ì¹ç¤Ï RuntimeError ¤ÎÎã³°¤òȯÀ¸¤¹¤ë¡¥
-
- safe?
- : Tcl/Tk ¥¤¥ó¥¿¡¼¥×¥ê¥¿¤¬ safe ¥¤¥ó¥¿¡¼¥×¥ê¥¿¤Ç¤¢¤ë¤«¤òÄ´¤Ù¤ë¡¥
- : safe ¥¤¥ó¥¿¡¼¥×¥ê¥¿¤Ç¤¢¤ì¤Ð true ¤òÊÖ¤¹¡¥
-
- allow_ruby_exit?
- : ÂоݤȤʤ륤¥ó¥¿¡¼¥×¥ê¥¿¾å¤Îɾ²Á¤Ç¡¤ruby ¤Î exit ´Ø¿ô¤Þ¤¿¤Ï
- : Tcl/Tk ¾å¤Î exit ¥³¥Þ¥ó¥É¤Ë¤è¤Ã¤Æ ruby ¼«ÂΤò½ªÎ»¤µ¤»¤ë¤³¤È
- : ¤òµö¤¹¤«¤É¤¦¤«¤òÊÖ¤¹¡¥
- : µö¤µ¤Ê¤¤¾ì¹ç¤ÏÂоݤΥ¤¥ó¥¿¡¼¥×¥ê¥¿¤À¤±¤¬½ªÎ»¤¹¤ë¡¥
- : ¥Þ¥¹¥¿¡¼¥¤¥ó¥¿¡¼¥×¥ê¥¿¤Î¥Ç¥Õ¥©¥ë¥ÈÃÍ¤Ï true¡¤¥¹¥ì¡¼¥Ö¥¤¥ó¥¿¡¼
- : ¥×¥ê¥¿¤Î¥Ç¥Õ¥©¥ë¥ÈÃÍ¤Ï false ¤Ç¤¢¤ë¡¥
-
- allow_ruby_exit=(mode)
- : ÂоݤȤʤ륤¥ó¥¿¡¼¥×¥ê¥¿¤Î allow_ruby_exit? ¤Î¾õÂÖ¤òÊѹ¹¤¹¤ë¡¥
- : $SAFE >= 4 ¤Þ¤¿¤Ï¥¤¥ó¥¿¡¼¥×¥ê¥¿¤¬ safe ¥¤¥ó¥¿¡¼¥×¥ê¥¿¤Î¾ì¹ç¤Ï
- : Êѹ¹¤¬µö¤µ¤ì¤Ê¤¤ (Îã³°¤òȯÀ¸)¡¥
-
- delete
- : Tcl/Tk ¥¤¥ó¥¿¡¼¥×¥ê¥¿¤ò delete ¤¹¤ë¡¥
- : delete ¤µ¤ì¤¿¥¤¥ó¥¿¡¼¥×¥ê¥¿¤Ï¡¤°Ê¸å°ìÀÚ¤ÎÁàºî¤¬¤Ç¤­¤Ê¤¯¤Ê¤ê¡¤
- : ¥³¥Þ¥ó¥É¤òÁ÷¤Ã¤Æ¤âÎã³°¤òȯÀ¸¤¹¤ë¤è¤¦¤Ë¤Ê¤ë¡¥
-
- deleted?
- : Tcl/Tk ¥¤¥ó¥¿¡¼¥×¥ê¥¿¤¬¤¹¤Ç¤Ë delete ¤µ¤ì¤Æ¤¤¤ë¤«¤òÄ´¤Ù¤ë¡¥
- : delete ºÑ¤ß¤Ç¥³¥Þ¥ó¥É¤ò¼õ¤±ÉÕ¤±¤Ê¤¤¾õÂ֤ˤʤäƤ¤¤ë¤Ê¤é¤Ð
- : true ¤òÊÖ¤¹¡¥
-
- has_mainwindow?
- : Tcl/Tk ¥¤¥ó¥¿¡¼¥×¥ê¥¿¤Ë¥á¥¤¥ó¥¦¥£¥ó¥É¥¦ (root widget) ¤¬
- : ¸ºß¤¹¤ì¤Ð true ¤ò¡¤Â¸ºß¤·¤Ê¤±¤ì¤Ð false ¤òÊÖ¤¹¡¥
- : ¥¤¥ó¥¿¡¼¥×¥ê¥¿¤¬´û¤Ë delete ºÑ¤ß¤Ç¤¢¤ì¤Ð nil ¤òÊÖ¤¹¡¥
-
- restart
- : Tcl/Tk ¥¤¥ó¥¿¡¼¥×¥ê¥¿¤Î Tk Éôʬ¤Î½é´ü²½¡¤ºÆµ¯Æ°¤ò¹Ô¤¦¡¥
- : °ìö root widget ¤òÇ˲õ¤·¤¿¸å¤ËºÆÅÙ Tk ¤Îµ¡Ç½¤¬É¬ÍפÈ
- : ¤Ê¤Ã¤¿¾ì¹ç¤ËÍѤ¤¤ë¡¥
- : $SAFE >= 4 ¤Ç¤Ï¼Â¹Ô¤¬¶Ø»ß¤µ¤ì¤ë¡¥
-
- _eval(str)
- _invoke(*args)
- : Tcl/Tk ¥¤¥ó¥¿¡¼¥×¥ê¥¿¾å¤Çɾ²Á¤ò¹Ô¤¦¡¥
- : _eval ¤Ïɾ²Á¥¹¥¯¥ê¥×¥È¤¬°ì¤Ä¤Îʸ»úÎó¤Ç¤¢¤ë¤³¤È¤ËÂФ·¡¤
- : _invoke ¤Ïɾ²Á¥¹¥¯¥ê¥×¥È¤Î token ¤´¤È¤Ë°ì¤Ä¤Î°ú¿ô¤È¤Ê
- : ¤ë¤è¤¦¤ËÍ¿¤¨¤ë¡¥
- : _invoke ¤ÎÊý¤Ï Tcl/Tk ¥¤¥ó¥¿¡¼¥×¥ê¥¿¤Î»ú¶ç²òÀÏ´ï¤òÍѤ¤
- : ¤Ê¤¤¤¿¤á¡¤É¾²Á¤ÎÉé²Ù¤¬¤è¤ê¾¯¤Ê¤¯¤Æ¤¹¤à¡¥¤¿¤À¤·¡¤¤½¤ÎÂå
- : ¤ï¤ê¤Ë auto_load ¤Î¤è¤¦¤Êµ¡¹½¤ÏƯ¤«¤º¡¤load Åù¤Ë¤è¤Ã¤Æ
- : Tcl/Tk ¥¤¥ó¥¿¡¼¥×¥ê¥¿¾å¤Ë´û¤ËÅÐÏ¿ºÑ¤ß¤Î¥³¥Þ¥ó¥É¤·¤«¸Æ
- : ¤Ó½Ð¤¹¤³¤È¤¬¤Ç¤­¤Ê¤¤¡¥
- : _eval ¤Ç¤Ï auto_load µ¡¹½¤¬Æ¯¤¯¤¿¤á¡¤°ìÅÙ _eval ¤ò¼Â¹Ô
- : ¤·¤ÆÅÐÏ¿¤ËÀ®¸ù¤·¤µ¤¨¤¹¤ì¤Ð¡¤°Ê¹ß¤Ï _invoke ¤Ç¤âÍøÍѤÇ
- : ¤­¤ë¤è¤¦¤Ë¤Ê¤ë¡¥
-
- _cancel_eval(str)
- _cancel_eval_unwind(str)
- : (Tcl/Tk8.6 or later)
- : Tcl_CancelEval() ´Ø¿ô¤ò¸Æ¤Ó½Ð¤·¡¤eval ¤Î¼Â¹Ô¤òÂǤÁÀڤ롥
-
- _toUTF8(str, encoding=nil)
- _fromUTF8(str, encoding=nil)
- : Tcl/Tk ¤¬Æâ¢¤·¤Æ¤¤¤ë UTF8 ÊÑ´¹½èÍý¤ò¸Æ¤Ó½Ð¤¹¡¥
-
- _thread_vwait(var_name)
- _thread_tkwait(mode, target)
- : ¥¹¥ì¥Ã¥ÉÂбþ¤Î vwait ¤¢¤ë¤¤¤Ï tkwait ÁêÅö¤Î¥á¥½¥Ã¥É¡¥
- : Ä̾ï¤Î vwait ¤¢¤ë¤¤¤Ï tkwait ¥³¥Þ¥ó¥É¤È°Û¤Ê¤ë¤Î¤Ï¡¤¥¤¥Ù¥ó
- : ¥È¥ë¡¼¥×¤È¤Ï°Û¤Ê¤ë¥¹¥ì¥Ã¥É¤«¤é¸Æ¤Ó½Ð¤·¤¿¾ì¹ç¤Ë vwait Åù¤Î
- : ¥¹¥¿¥Ã¥¯¤È¤ÏÆÈΩ¤Ë¾ò·ï¤ÎÀ®Î©ÂÔ¤Á¤¬¤Ê¤µ¤ì¤ë¤³¤È¤Ç¤¢¤ë¡¥
- : Ä̾ï¤Î vwait / tkwait ¤Ç¤Ï¡¤vwait / tkwait (1) ¤ÎÂÔ¤Á¤ÎÅÓ
- : Ãæ¤Ç¤µ¤é¤Ë vwait / tkwait (2) ¤¬¸Æ¤Ð¤ì¤¿¾ì¹ç¡¤ÂÔ¤Á¤ÎÂоÝ
- : ¤È¤Ê¤Ã¤Æ¤¤¤ë¾ò·ï¤ÎÀ®Î©½ç½ø¤¬¤É¤¦¤¢¤ì¡¤(2)->(1) ¤Î½ç¤ÇÂÔ¤Á
- : ¤ò½ªÎ»¤·¤ÆÌá¤Ã¤Æ¤¯¤ë¡¥
- : _thread_vwait / _thread_tkwait ¤Ï¡¤¥¤¥Ù¥ó¥È¥ë¡¼¥×¤Î¥¹¥ì¥Ã
- : ¥É¤Ç¸Æ¤Ð¤ì¤¿¾ì¹ç¤ÏÄ̾ï¤Î vwait / tkwait ¤ÈƱÍÍ¤ËÆ°ºî¤¹¤ë
- : ¤¬¡¤¥¤¥Ù¥ó¥È¥ë¡¼¥×°Ê³°¤Î¥¹¥ì¥Ã¥É¤Ç¸Æ¤Ð¤ì¤¿¾ì¹ç¤Ë¤Ï¤½¤Î¥¹
- : ¥ì¥Ã¥É¤òÄä»ß¤µ¤»¤ÆÂÔ¤Á¤ËÆþ¤ê¡¤¾ò·ï¤¬À®Î©¤·¤¿»þ¤Ë¥¹¥ì¥Ã¥É
- : ¤Î¼Â¹Ô¤òºÆ³«¤¹¤ë¡¥¡Övwait Åù¤ÎÂÔ¤Á¥¹¥¿¥Ã¥¯¤È¤ÏÆÈΩ¡×¤È¤¤
- : ¤¦°ÕÌ£¤Ï¡¤¤³¤ÎºÆ³«¤Î¥¿¥¤¥ß¥ó¥°¤¬Â¾¤Î¥¹¥ì¥Ã¥É¤Ç¤ÎÂÔ¤Á¾õ¶·
- : ¤È¤Ï̵´Ø·¸¤È¤¤¤¦¤³¤È¤Ç¤¢¤ë¡¥¤Ä¤Þ¤ê¡¤¥¤¥Ù¥ó¥È¥ë¡¼¥×Åù¤Î¾
- : ¤Î¥¹¥ì¥Ã¥É¤Ç vwait Åù¤ÇÂÔ¤Á¤Î¾õÂ֤ˤ¢¤Ã¤¿¤È¤·¤Æ¤â¤½¤Î´°Î»
- : ¤òÂԤĤ³¤È¤Ê¤¯¡¤¼«¤é¤ÎÂÔ¤Á¾ò·ï¤¬À®Î©¼¡Â衤½èÍý¤ò·Ñ³¤¹¤ë
- : ¤³¤È¤Ë¤Ê¤ë¡¥
-
- _return_value
- : ľÁ°¤Î Tcl/Tk ¾å¤Ç¤Îɾ²Á¤Î¼Â¹Ô·ë²Ì¤È¤·¤Æ¤ÎÌá¤êÃͤòÊÖ¤¹¡¥
-
- _get_variable(var_name, flag)
- _get_variable2(var_name, index_name, flag)
- : Tcl/Tk ¾å¤Î var ¤È¤¤¤¦ÊÑ¿ô̾¤ÎÊÑ¿ô¤ÎÃͤòÊÖ¤¹¡¥
- : ¤â¤· index_name ¤¬»ØÄê (PARSE_VARNAME ¥Õ¥é¥°¤ÎÀâÌÀ¤â»²¾È)
- : ¤µ¤ì¤¿¾ì¹ç¤ÏÏ¢ÁÛÇÛÎó var_name ¤Î index_name ¤ÎÍ×ÁǤòÊÖ¤¹¡¥
- : flag ¤Ë¤ÏÊÑ¿ô¤ò¸¡º÷¤¹¤ëºÝ¤Î¾ò·ï¤ò»ØÄꤹ¤ë¡¥flag ¤ËÍ¿¤¨¤ë
- : Ãͤϥ⥸¥å¡¼¥ë TclTkLib::VarAccessFlag ¤ò»²¾È¤¹¤ë¤³¤È¡¥
-
- _set_variable(var_name, value, flag)
- _set_variable2(var_name, index_name, value, flag)
- : Tcl/Tk ¾å¤Î var ¤È¤¤¤¦ÊÑ¿ô̾¤ÎÊÑ¿ô¤ËÃͤòÀßÄꤹ¤ë¡¥
- : ¤â¤· index_name ¤¬»ØÄê (PARSE_VARNAME ¥Õ¥é¥°¤ÎÀâÌÀ¤â»²¾È)
- : ¤µ¤ì¤¿¾ì¹ç¤ÏÏ¢ÁÛÇÛÎó var_name ¤Î index_name ¤ÎÍ×ÁǤòÀßÄê
- : ¤¹¤ë¡¥
- : flag ¤Ë¤ÏÊÑ¿ô¤ò¸¡º÷¤¹¤ëºÝ¤Î¾ò·ï¤ò»ØÄꤹ¤ë¡¥flag ¤ËÍ¿¤¨¤ë
- : Ãͤϥ⥸¥å¡¼¥ë TclTkLib::VarAccessFlag ¤ò»²¾È¤¹¤ë¤³¤È¡¥
-
- _unset_variable(var_name)
- _unset_variable2(var_name, index_name)
- : Tcl/Tk ¾å¤Î var_name ¤È¤¤¤¦ÊÑ¿ô̾¤ÎÊÑ¿ô¤ò¾Ãµî¤¹¤ë¡¥
- : ¤â¤· index_name ¤¬»ØÄê (PARSE_VARNAME ¥Õ¥é¥°¤ÎÀâÌÀ¤â»²¾È)
- : ¤µ¤ì¤¿¾ì¹ç¤ÏÏ¢ÁÛÇÛÎó var_name ¤«¤é index_name ¤ÎÍ×ÁǤÀ¤±
- : ¤ò¾Ãµî¤¹¤ë¡¥
-
- _get_global_var(var_name)
- _get_global_var2(var_name, index_name)
- _set_global_var(var_name, value)
- _set_global_var2(var_name, index_name, value)
- _unset_global_var(var_name)
- _unset_global_var2(var_name, index_name)
- : ¤½¤ì¤¾¤ì¡¤Âбþ¤¹¤ëÊÑ¿ô¥¢¥¯¥»¥¹¥á¥½¥Ã¥É¤Î flag ¤ËÂФ·¤Æ
- : (GLOBAL_ONLY | LEAVE_ERR_MSG) ¤òÍ¿¤¨¤¿¤â¤Î¡¥
-
- _split_tklist(str)
- : Tcl/Tk ¤Î¥é¥¤¥Ö¥é¥ê´Ø¿ô¤ò»È¤Ã¤Æ¡¤Ê¸»úÎó str ¤ò¥ê¥¹¥È¤Ë
- : ʬ³ä¤¹¤ë (ʸ»úÎó¤ÎÇÛÎó¤È¤·¤ÆÊÖ¤¹)¡¥
-
- _merge_tklist(str, str, ... )
- : Tcl/Tk ¤Î¥é¥¤¥Ö¥é¥ê´Ø¿ô¤ò»È¤Ã¤Æ¡¤°ú¿ô¤Îʸ»úÎ󤬤½¤ì¤¾¤ì
- : Àµ¤·¤¯°ì¤Ä¤Î¥ê¥¹¥ÈÍ×ÁǤȤʤë¤è¤¦¤ËÏ¢·ë¤·¤¿Ê¸»úÎó¤òÊÖ¤¹¡¥
-
- _conv_listelement(str)
- : Tcl/Tk ¤Î¥é¥¤¥Ö¥é¥ê´Ø¿ô¤ò»È¤Ã¤Æ¡¤°ú¿ô¤Îʸ»úÎó¤¬ Tcl ¤Î
- : °ì¤Ä¤Î¥ê¥¹¥ÈÍ×ÁǤȤ·¤ÆÅ¬ÀÚ¤Êɽ¸½¤Ë¤Ê¤ë¤è¤¦¤ËÊÑ´¹¤·¤¿Ê¸
- : »úÎó¤òÊÖ¤¹¡¥
-
- mainloop
- mainloop_watchdog
- : ¥¹¥ì¡¼¥Ö IP ¤Î¾ì¹ç¤Ë¤Ï¥¤¥Ù¥ó¥È¥ë¡¼¥×¤òµ¯Æ°¤»¤º¤Ë nil ¤òÊÖ¤¹¡¥
- : ¤½¤ì°Ê³°¤ÎÅÀ¤Ç¤Ï°ú¿ô¤ò´Þ¤á¤Æ TclTkLib ¤ÎƱ̾¥á¥½¥Ã¥É¤ËƱ¤¸¡¥
-
- do_one_event
- : ¥¹¥ì¡¼¥Ö IP ¤Î¾ì¹ç¤Ë¤Ï°ú¿ô¤Î¥¤¥Ù¥ó¥È¥Õ¥é¥°¤Ë DONT_WAIT ¤¬
- : ¶¯À©Åª¤ËÄɲ䵤ì¤ë (¥¤¥Ù¥ó¥ÈÂÔ¤Á¤Ç¥¹¥ê¡¼¥×¤¹¤ë¤³¤È¤Ï¶Ø»ß)¡¥
- : ¤½¤ì°Ê³°¤ÎÅÀ¤Ç¤Ï°ú¿ô¤ò´Þ¤á¤Æ TclTkLib ¤ÎƱ̾¥á¥½¥Ã¥É¤ËƱ¤¸¡¥
-
- set_eventloop_tick
- get_eventloop_tick
- set_no_event_wait
- get_no_event_wait
- set_eventloop_weight
- get_eventloop_weight
- mainloop_abort_on_exception
- mainloop_abort_on_exception=
- : ¥¹¥ì¡¼¥Ö IP ¤Î¾ì¹ç¤Ë¤ÏÃͤÎÀßÄ꤬µö¤µ¤ì¤Ê¤¤ (̵»ë¤µ¤ì¤ë)¡¥
- : ¤½¤ì°Ê³°¤ÎÅÀ¤Ç¤Ï°ú¿ô¤ò´Þ¤á¤Æ TclTkLib ¤ÎƱ̾¥á¥½¥Ã¥É¤ËƱ¤¸¡¥
-
- encoding_table
- : Ruby m17n ÍÑ¤Ë Ruby ¤È Tk ¤È¤Î´Ö¤Î encoding Âбþɽ¤òÊÖ¤¹¡¥
-
-¥¯¥é¥¹ TkCallbackBreak < StandardError
-¥¯¥é¥¹ TkCallbackContinue < StandardError
- : ¤³¤ì¤é¤Ï¥¤¥Ù¥ó¥È¥³¡¼¥ë¥Ð¥Ã¥¯¤Ë¤ª¤¤¤Æ¡¤¥³¡¼¥ë¥Ð¥Ã¥¯½èÍý¤òŬÀÚ¤ËÃæ
- : ÃǤ·¤¿¤ê¡¤¼¡¤Î¥Ð¥¤¥ó¥É¥¿¥°¤Î¥Ð¥¤¥ó¥Ç¥£¥ó¥°½èÍý¤Ë¿Ê¤á¤¿¤ê¤¹¤ë¤³¤È
- : ¤ò²Äǽ¤Ë¤¹¤ë¤¿¤á¤ÎÎã³°¥¯¥é¥¹¤Ç¤¢¤ë¡¥
- : ¥³¡¼¥ë¥Ð¥Ã¥¯¤Ç break ¤ä continue ¤ò¼Â¸½¤¹¤ë¤¿¤á¤Ë¤Ï¡¤¥³¡¼¥ë¥Ð¥Ã¥¯
- : ¤Ç¤¢¤ë Ruby ¼ê³¤­¤¬ Tcl/Tk ¥¤¥ó¥¿¡¼¥×¥ê¥¿Â¦¤ËŬÀڤʥ꥿¡¼¥ó¥³¡¼
- : ¥É¤òÊÖ¤¹É¬Íפ¬¤¢¤ë¡¥Ruby ¤Î¼ê³¤­¤¬ÉáÄ̤ËÃͤòÊÖ¤¹¤Î¤Ç¤Ï¡¤¤½¤ì¤¬Éá
- : Ä̤ÎÌá¤êÃͤǤ¢¤ë¤Î¤«Èݤ«¤ò¶èÊ̤¬¤Ç¤­¤Ê¤¤¤¿¤á¡¤Î㳰ȯÀ¸¤òÍøÍѤ·¤¿
- : ¼ÂÁõ¤ò¹Ô¤Ã¤Æ¤¤¤ë¡¥
- : ¤¿¤À¤·¸½ºß¤Ç¤Ï¡¤¥³¡¼¥ë¥Ð¥Ã¥¯¼ê³¤­¤ò Ruby ¤Î break, next ¤Ç½ªÎ»¤¹
- : ¤ë¤³¤È¤ÇƱÅù¤Î·ë²Ì¤òÆÀ¤ë¤³¤È¤¬¤Ç¤­¤ë¤è¤¦¤Ë¤Ê¤Ã¤Æ¤¤¤ë¡¥¤½¤ì¤æ¤¨¡¤
- : ¤³¤ì¤é¤ÏɬÍפʤ¤¤â¤Î¤Ç¤Ï¤¢¤ë¤¬¡¤¸ß´¹À­¤Î¤¿¤á¤Ë»Ä¤·¤Æ¤¢¤ë¡¥
-
-(eof)
diff --git a/ext/tk/MANUAL_tcltklib.ja b/ext/tk/MANUAL_tcltklib.ja
new file mode 100644
index 0000000000..1de1736f9f
--- /dev/null
+++ b/ext/tk/MANUAL_tcltklib.ja
@@ -0,0 +1,584 @@
+(tof)
+ 2005/07/05 Hidetoshi NAGAI
+
+本ドキュメントã«ã¯å¤ã„ tcltk ライブラリ,tcltklib ライブラリã®èª¬æ˜Ž
+ãŒå«ã¾ã‚Œã¦ã„ã¾ã™ãŒï¼Œãã®è¨˜è¿°å†…容ã¯å¤ã„ã‚‚ã®ã¨ãªã£ã¦ã„ã¾ã™ï¼Ž
+
+tcltk ライブラリ(tcltk.rb)ã¯ç¾åœ¨ã§ã¯ãƒ¡ãƒ³ãƒ†ãƒŠãƒ³ã‚¹ãŒäº‹å®Ÿä¸Šè¡Œã‚れã¦
+ã„ãªã„ãŸã‚,å¤ã„ドキュメントã®èª¬æ˜ŽãŒãã®ã¾ã¾æœ‰åйã§ã™ï¼Žãれã«å¯¾ã—,
+tcltklib ライブラリã«ã¤ã„ã¦ã¯ï¼Œç¾åœ¨ã® Ruby/Tk(tk.rb 以下ã®ãƒ©ã‚¤ãƒ–ラ
+リ群)を稼åƒã•ã›ã‚‹ãŸã‚ã®ä¸­å¿ƒã¨ã—ã¦ãƒ¡ãƒ³ãƒ†ãƒŠãƒ³ã‚¹ã•れã¦ã„ã‚‹ãŸã‚,少々
+é•ã„ãŒç”Ÿã˜ã¦ã„ã¾ã™ï¼Ž
+
+ãã“ã§ï¼Œã¾ãšå¤ã„説明文書を示ã—ãŸå¾Œï¼Œç¾åœ¨ã® tcltklib ライブラリã«ã¤
+ã„ã¦ã®èª¬æ˜Žã‚’加ãˆã¾ã™ï¼Ž
+
+以下ãŒãƒ©ã‚¤ãƒ–ラリã®å¤ã„説明文書ã§ã™ï¼Ž
+==============================================================
+ MANUAL.euc
+ Sep. 19, 1997 Y. Shigehiro
+
+以下, 「tcl/tkã€ã¨ã„ã†è¡¨è¨˜ã¯, tclsh ã‚„ wish を実ç¾ã—ã¦ã„ã‚‹, 一般ã§ã„ã†
+ã¨ã“ã‚ã® tcl/tk を指ã—ã¾ã™. 「tcltk ライブラリã€, 「tcltklib ライブラ
+リã€ã¨ã„ã†è¡¨è¨˜ã¯, 本パッケージã«å«ã¾ã‚Œã‚‹ ruby 用ã®ãƒ©ã‚¤ãƒ–ラリを指ã—ã¾ã™.
+
+<< tcltk ライブラリ >>
+
+tcl/tk ã® C ライブラリを利用ã™ã‚‹ãŸã‚ã®é«˜(中?)水準インターフェースをæ
+ä¾›ã—ã¾ã™.
+
+ã“ã®ãƒ©ã‚¤ãƒ–ラリ㯠ruby ã‹ã‚‰ tcl/tk ライブラリを利用ã™ã‚‹ãŸã‚ã®ã‚‚ã®ã§, 内
+部㧠tcltklib ライブラリを利用ã—ã¦ã„ã¾ã™.
+
+[説明]
+
+tcl/tk インタプリタã§ã¯, ウィジェットã«ä½•ã‹æŒ‡ç¤ºã‚’é€ã‚‹ã«ã¯, ウィジェッ
+トåã«ç¶šã„ã¦ãƒ‘ラメータを書ãã¾ã™. ã—ãŸãŒã£ã¦, ウィジェットãŒã‚ªãƒ–ジェク
+トã§ã‚り, ãれã«å¯¾ã—ã¦ãƒ¡ã‚½ãƒƒãƒ‰ã‚’é€ã£ã¦ã„ã‚‹, ã¨ã¿ãªã™ã“ã¨ãŒã§ãã¾ã™. ã•
+ã¦, tcl/tk インタプリタã§ã¯, 組ã¿è¾¼ã¿ã‚³ãƒžãƒ³ãƒ‰ã‚‚, å‰è¿°ã®ã‚¦ã‚£ã‚¸ã‚§ãƒƒãƒˆã¨
+åŒã˜ã‚ˆã†ãªæ›¸å¼ã®å‘½ä»¤ã§å®Ÿè¡Œã•れã¾ã™. ã™ãªã‚ã¡, コマンドもオブジェクトã§
+ã‚ã‚‹ã¨è€ƒãˆã‚‹ã“ã¨ãŒã§ãã¾ã™.
+
+ã“ã®ã‚ˆã†ãªè€ƒãˆã«åŸºã¥ã, tcltk ライブラリã§ã¯, tcl/tk ã®ã‚³ãƒžãƒ³ãƒ‰ã‚„ウィ
+ジェットã«å¯¾å¿œã™ã‚‹ã‚ªãƒ–ジェクトを生æˆã—ã¾ã™. オブジェクトã«å¯¾ã™ã‚‹ãƒ¡ã‚½ãƒƒ
+ド呼ã³å‡ºã—ã¯, e() メソッドã«ã‚ˆã‚Šå®Ÿè¡Œã•れã¾ã™. 例ãˆã°, tcl/tk ã® info
+コマンドã«å¯¾å¿œã™ã‚‹ ruby ã®ã‚ªãƒ–ジェクト㌠info ã¨ã„ã†åå‰ã§ã‚ã‚‹ã¨ã™ã‚‹ã¨,
+tcl/tk ã®
+ info commands
+ã¨ã„ã†å‘½ä»¤ã¯ tcltk ライブラリã§ã¯
+ info.e("commands")
+ã¨è¨˜è¿°ã•れã¾ã™. ã¾ãŸ, 「.ã€ã¨ã„ã†ã‚¦ã‚£ã‚¸ã‚§ãƒƒãƒˆ (wish 実行時ã«è‡ªå‹•çš„ã«ç”Ÿ
+æˆã•れるルートウィジェット) ã«å¯¾å¿œã™ã‚‹ ruby ã®ã‚ªãƒ–ジェクト㌠root ã¨ã„
+ã†åå‰ã§ã‚ã‚‹ã¨ã™ã‚‹ã¨,
+ . configure -height 300 -width 300
+ã¨ã„ㆠtcl/tk ã®å‘½ä»¤ã¯
+ root.e("configure -height 300 -width 300")
+ã¨è¨˜è¿°ã•れã¾ã™. ã“ã®ã‚ˆã†ãªè¨˜è¿°ã¯, 見ãŸã‚ã«ã¯ç¾Žã—ãã‚りã¾ã›ã‚“ãŒ, ãã—ã¦,
+スクリプトを読む人ã«ã¯è¦‹ã¥ã‚‰ã„ã‹ã‚‚知れã¾ã›ã‚“ãŒ, 実際ã«ã‚¹ã‚¯ãƒªãƒ—トを書ã„
+ã¦ã¿ã‚‹ã¨äºˆæƒ³å¤–ã«æ‰‹è»½ã§ã™.
+
+[使用法]
+
+1. ライブラリを読ã¿è¾¼ã‚€.
+ require "tcltk"
+
+2. tcl/tk インタプリタを生æˆã™ã‚‹.
+ ip = TclTkInterpreter.new()
+
+3. tcl/tk ã®ã‚³ãƒžãƒ³ãƒ‰ã«å¯¾å¿œã™ã‚‹ã‚ªãƒ–ジェクトを変数ã«ä»£å…¥ã—ã¦ãŠã.
+ # コマンドã«å¯¾å¿œã™ã‚‹ã‚ªãƒ–ジェクトãŒå…¥ã£ãŸ Hash ã‚’å–り出ã™.
+ c = ip.commands()
+ # 使ã„ãŸã„コマンドã«å¯¾å¿œã™ã‚‹ã‚ªãƒ–ジェクトを個別ã®å¤‰æ•°ã«ä»£å…¥ã™ã‚‹.
+ bind, button, info, wm = c.indexes("bind", "button", "info", "wm")
+
+4. å¿…è¦ãªå‡¦ç†ã‚’行ã†.
+ 詳ã—ãã¯, サンプルをå‚ç…§ã®ã“ã¨.
+
+5. 準備ãŒã§ããŸã‚‰, イベントループã«å…¥ã‚‹.
+ TclTk.mainloop()
+
+(( 以下, モジュール, クラス等ã®èª¬æ˜Žã‚’書ã予定.))
+
+
+
+<< tcltklib ライブラリ >>
+
+tcl/tk ã® C ライブラリを利用ã™ã‚‹ãŸã‚ã®ä½Žæ°´æº–インターフェースをæä¾›ã—ã¾
+ã™.
+
+コンパイル/実行ã«ã¯, tcl/tk ã® C ライブラリãŒå¿…è¦ã§ã™.
+
+[説明]
+
+ã“ã®ãƒ©ã‚¤ãƒ–ラリを用ã„ã‚‹ã¨, ruby ã‹ã‚‰ tcl/tk ã® C ライブラリを利用ã§ãã¾
+ã™. 具体的ã«ã¯, ruby インタプリタã‹ã‚‰ tcl/tk インタプリタを呼ã³å‡ºã™ã“
+ã¨ãŒã§ãã¾ã™. ã•らã«, ãã®(ruby インタプリタã‹ã‚‰å‘¼ã³å‡ºã—ãŸ) tcl/tk イ
+ンタプリタã‹ã‚‰, 逆㫠ruby インタプリタを呼ã³å‡ºã™ã“ã¨ã‚‚ã§ãã¾ã™.
+
+[使用法]
+
+require "tcltklib" ã™ã‚‹ã¨, 以下ã®ãƒ¢ã‚¸ãƒ¥ãƒ¼ãƒ«, クラスãŒåˆ©ç”¨å¯èƒ½ã§ã™.
+
+モジュール TclTkLib
+ tcl/tk ライブラリを呼ã³å‡ºã™ãƒ¡ã‚½ãƒƒãƒ‰ã‚’集ã‚ãŸãƒ¢ã‚¸ãƒ¥ãƒ¼ãƒ«ã§ã™. ãŸã ã—,
+ tcl/tk インタプリタ関係ã®ãƒ¡ã‚½ãƒƒãƒ‰ã¯ã‚¯ãƒ©ã‚¹ TclTkIp ã«ã‚りã¾ã™.
+
+ モジュールメソッド mainloop()
+ Tk_MainLoop を実行ã—ã¾ã™. å…¨ã¦ã® tk ã®ã‚¦ã‚¤ãƒ³ãƒ‰ã‚¦ãŒç„¡ããªã‚‹ã¨çµ‚了
+ ã—ã¾ã™(例ãˆã°, tcl/tk ã§æ›¸ãã¨ã“ã‚ã® "destroy ." ã‚’ã—ãŸå ´åˆç­‰).
+ 引数: ç„¡ã—
+ 戻り値: nil
+
+クラス TclTkIp
+ インスタンス㌠tcl/tk ã®ã‚¤ãƒ³ã‚¿ãƒ—リタã«å¯¾å¿œã—ã¾ã™. tcl/tk ã®ãƒ©ã‚¤ãƒ–
+ ラリã®ä»•様通り, インスタンスを複数個生æˆã—ã¦ã‚‚æ­£ã—ã動作ã—ã¾ã™(ã
+ ã‚“ãªã“ã¨ã‚’ã™ã‚‹å¿…è¦ã¯ã‚ã¾ã‚Šç„¡ã„ã¯ãšã§ã™ãŒ). インタプリタ㯠wish ã®
+ tcl/tk コマンドを実行ã§ãã¾ã™. ã•らã«, 以下ã®ã‚³ãƒžãƒ³ãƒ‰ã‚’実行ã§ãã¾
+ ã™.
+ コマンド ruby
+ 引数を ruby ã§å®Ÿè¡Œã—ã¾ã™(ruby_eval_string を実行ã—ã¾ã™). 引数
+ 㯠1 ã¤ã§ãªã‘れã°ãªã‚Šã¾ã›ã‚“. 戻り値㯠ruby ã®å®Ÿè¡Œçµæžœã§ã™.
+ ruby ã®å®Ÿè¡Œçµæžœã¯ nil ã‹ String ã§ãªã‘れã°ãªã‚Šã¾ã›ã‚“.
+
+ クラスメソッド new()
+ TclTkIp クラスã®ã‚¤ãƒ³ã‚¹ã‚¿ãƒ³ã‚¹ã‚’生æˆã—ã¾ã™
+ 引数: ç„¡ã—
+ 戻り値 (TclTkIp): 生æˆã•れãŸã‚¤ãƒ³ã‚¹ã‚¿ãƒ³ã‚¹
+
+ メソッド _eval(script)
+ インタプリタ㧠script を評価ã—ã¾ã™(Tcl_Eval を実行ã—ã¾ã™). å‰è¿°
+ ã®ã‚ˆã†ã«, ruby コマンドã«ã‚ˆã‚Š script 内ã‹ã‚‰ ruby スクリプトを実
+ 行ã§ãã¾ã™.
+ 引数: script (String) - インタプリタã§è©•価ã™ã‚‹ã‚¹ã‚¯ãƒªãƒ—ト文字列
+ 戻り値 (String): è©•ä¾¡çµæžœ ((Tcl_Interp *)->result)
+
+ メソッド _return_value()
+ ç›´å‰ã® Tcl_Eval ã®æˆ»ã‚Šå€¤ã‚’è¿”ã—ã¾ã™. 0(TCL_OK) ã§æ­£å¸¸çµ‚了ã§ã™.
+ 引数: ç„¡ã—
+ 戻り値 (Fixnum): ç›´å‰ã® Tcl_Eval() ãŒè¿”ã—ãŸå€¤.
+
+==============================================================
+
+ä»¥ä¸‹ãŒæœ¬ãƒ‰ã‚­ãƒ¥ãƒ¡ãƒ³ãƒˆä½œæˆæ™‚点ã§ã® tcltklib ライブラリã®èª¬æ˜Žã§ã™ï¼Ž
+==============================================================
+モジュール TclTkLib
+ : 個々㮠Tcl/Tk インタープリタã«ä¾å­˜ã—ãªã„å‡¦ç† ( == イベントルー
+ : プã«é–¢ã™ã‚‹å‡¦ç† ) を呼ã³å‡ºã™ãƒ¡ã‚½ãƒƒãƒ‰ã‚’定義ã—ãŸãƒ¢ã‚¸ãƒ¥ãƒ¼ãƒ«ï¼Ž
+
+ モジュール TclTkLib::EventFlag
+ : do_one_event を呼ã³å‡ºã™éš›ã®å‡¦ç†å¯¾è±¡ã‚¤ãƒ™ãƒ³ãƒˆã‚’指定ã™ã‚‹ãŸã‚ã®
+ : フラグ ( WINDOW|DONT_WAIT ã¨ã„ã†ã‚ˆã†ã«ãƒ“ット演算å­ã§é€£çµã—ã¦
+ : 指定 ) を定数ã¨ã—ã¦å®šç¾©ã—ãŸãƒ¢ã‚¸ãƒ¥ãƒ¼ãƒ«ï¼Žä»¥ä¸‹ã®å®šæ•°ãŒå«ã¾ã‚Œã‚‹ï¼Ž
+
+ 定数 NONE
+ : 値㯠0 ã§ï¼Œå€¤ã¨ã—ã¦ã¯ã„ã‹ãªã‚‹ç¨®é¡žã®ã‚¤ãƒ™ãƒ³ãƒˆã‚‚指定ã—ã¦ã„ãªã„
+ : ã“ã¨ã«ãªã‚‹ãŒï¼Œå®Ÿéš›ã®å‡¦ç†ä¸Šã¯ ALL ã¨åŒã˜ã¨ã—ã¦æ‰±ã‚れる.
+
+ 定数 WINDOW
+ : window イベントを処ç†å¯¾è±¡ã¨ã™ã‚‹
+
+ 定数 FILE
+ : file イベントを処ç†å¯¾è±¡ã¨ã™ã‚‹
+
+ 定数 TIMER
+ : timer イベントを処ç†å¯¾è±¡ã¨ã™ã‚‹
+
+ 定数 IDLE
+ : ã‚¢ã‚¤ãƒ‰ãƒ«ãƒ«ãƒ¼ãƒ—å‡¦ç† ( å†æç”»ãªã©ï¼Œä»–ã®ç¨®é¡žã®ã‚¤ãƒ™ãƒ³ãƒˆãŒç™ºç”Ÿ
+ : ã—ã¦ã„ãªã„ã¨ãã«è¡Œã‚ã‚Œã‚‹å‡¦ç† ) を処ç†å¯¾è±¡ã¨ã™ã‚‹
+
+ 定数 ALL
+ : ã™ã¹ã¦ã®ç¨®é¡žã®ã‚¤ãƒ™ãƒ³ãƒˆã‚’処ç†å¯¾è±¡ã¨ã™ã‚‹
+ : WINDOW|FILE|TIMER|IDLE ã¨åŒã˜
+
+ 定数 DONT_WAIT
+ : 処ç†å¯¾è±¡ã‚¤ãƒ™ãƒ³ãƒˆãŒå­˜åœ¨ã—ãªã„å ´åˆã«ï¼Œã‚¤ãƒ™ãƒ³ãƒˆç™ºç”Ÿã‚’å¾…ãŸãš
+ : ã« do_one_event を終了 ( false を返㙠) ã™ã‚‹
+
+ モジュール TclTkLib::VarAccessFlag
+ : _get_variable ãªã©ã§ã®ãƒ•ラグを指定ã™ã‚‹ãŸã‚ã®ã‚‚ã®ï¼Žãƒ•ラグã«
+ : ã¯ä»¥ä¸‹ã®å®šæ•°ã‚’ OR ã§é€£çµã—ã¦ä¸Žãˆã‚‹ï¼Ž
+
+ 定数 NONE
+ : 値㯠0 ã§ï¼Œä½•もフラグを指定ã—ã¦ã„ãªã„ã®ã«ç­‰ã—ã„.
+
+ 定数 GLOBAL_ONLY
+ : é€šå¸¸ï¼Œå¤‰æ•°ã®æ¤œç´¢ã¯ã¾ãšæ‰‹ç¶šã呼ã³å‡ºã—を行ã£ãŸãƒ¬ãƒ™ãƒ«ã§æ¤œ
+ : ç´¢ã—,次ã«ç¾åœ¨ã®åå‰ç©ºé–“ã§æ¤œç´¢ï¼Œæœ€å¾Œã«ã‚°ãƒ­ãƒ¼ãƒãƒ«ç©ºé–“ã§
+ : 検索を行ã†ï¼Žã—ã‹ã—,ã“ã®ãƒ•ãƒ©ã‚°ãŒæŒ‡å®šã•れãŸå ´åˆã«ã¯ï¼Œã‚°
+ : ローãƒãƒ«ç©ºé–“ã§ã®ã¿æ¤œç´¢ã™ã‚‹ï¼Ž
+ : ã‚‚ã— GLOBAL_ONLY 㨠NAMESPACE_ONLY ã¨ãŒä¸¡æ–¹æŒ‡å®šã•れãŸå ´
+ : åˆã«ã¯ï¼ŒGLOBAL_ONLY ã®æŒ‡å®šã¯ç„¡è¦–ã•れる.
+
+ 定数 NAMESPACE_ONLY
+ : ã“ã®ãƒ•ãƒ©ã‚°ãŒæŒ‡å®šã•れãŸå ´åˆã«ã¯ï¼Œç¾åœ¨ã®åå‰ç©ºé–“ã§ã®ã¿å¤‰
+ : æ•°ã®æ¤œç´¢ã‚’行ã†ï¼ŽGLOBAL_ONLY ã®èª¬æ˜Žã‚‚å‚ç…§ã™ã‚‹ã“ã¨ï¼Ž
+
+ 定数 LEAVE_ERR_MSG
+ : 変数アクセスã«ãŠã„ã¦ã‚¨ãƒ©ãƒ¼ãŒç™ºç”Ÿã—ãŸå ´åˆï¼Œã“ã®ãƒ•ラグãŒ
+ : 指定ã•れã¦ã„れã°ï¼Œå®Ÿè¡Œçµæžœã¨ã—㦠Tcl インタープリタã«ã‚¨
+ : ãƒ©ãƒ¼ãƒ¡ãƒƒã‚»ãƒ¼ã‚¸ãŒæ®‹ã•れる.ã“ã®ãƒ•ãƒ©ã‚°ãŒæŒ‡å®šã•れã¦ã„ãªã‘
+ : れã°ï¼Œã‚¨ãƒ©ãƒ¼ãƒ¡ãƒƒã‚»ãƒ¼ã‚¸ã¯ä¸€åˆ‡æ®‹ã•れãªã„.
+
+ 定数 APPEND_VALUE
+ : ã“ã®ãƒ•ãƒ©ã‚°ãŒæŒ‡å®šã•れã¦ã„ãŸå ´åˆï¼Œå¤‰æ•°ã®å€¤ã‚’ç½®ãæ›ãˆã®ã§
+ : ã¯ãªã,ç¾åœ¨ã®å€¤ã«ä»£å…¥å€¤ãŒè¿½åŠ  (append; 文字列連çµ) ã•
+ : ã‚Œã‚‹ï¼Žå¤‰æ•°ãŒæœªå®šç¾©ã‚ã£ãŸå ´åˆï¼Œã“ã®ãƒ•ラグã¯ç„¡è¦–ã•れる.
+
+ 定数 LIST_ELEMENT
+ : ã“ã®ãƒ•ãƒ©ã‚°ãŒæŒ‡å®šã•れã¦ã„ãŸå ´åˆï¼Œä»£å…¥å€¤ã¯ã¾ãš Tcl ã®ãƒªã‚¹
+ : トè¦ç´ ã¨ã—ã¦é©åˆ‡ã¨ãªã‚‹ã‚ˆã†ã«å¤‰æ›ã•れる.代入値ãŒãƒªã‚¹ãƒˆ
+ : (ã¾ãŸã¯ã‚µãƒ–リスト) ã®æœ€åˆã®è¦ç´ ã¨ãªã‚‹ã®ã§ãªã„é™ã‚Šï¼Œä»£å…¥
+ : 値ã®ç›´å‰ã«ã¯ç©ºç™½æ–‡å­—ãŒè¿½åŠ ã•れる.
+
+ 定数 PARSE_VARNAME
+ : _set_variable ãªã©ã®å‘¼ã³å‡ºã—ã«ãŠã„ã¦ã“ã®ãƒ•ãƒ©ã‚°ãŒæŒ‡å®šã•
+ : れã¦ã„ãŸå ´åˆï¼Œvar_name 引数ãŒé€£æƒ³é…列åã¨è¦ç´ åã¨ã‚’両方
+ : å«ã‚€å¯èƒ½æ€§ãŒã‚ã‚‹ (é–‹ãæ‹¬å¼§ã‚’å«ã¿ï¼Œé–‰ã˜æ‹¬å¼§ã§çµ‚ã‚ã‚‹) ã“
+ : ã¨ã‚’示ã™ï¼Žãã®å ´åˆï¼Œæ‹¬å¼§ã®é–“ãŒè¦ç´ å指定,最åˆã®é–‹ã括
+ : å¼§ã¾ã§ãŒé€£æƒ³é…列åã¨ã—ã¦æ‰±ã‚れる._set_variable2 ãªã©ã§
+ : ã“ã®ãƒ•ラグを指定ã™ã‚‹å ´åˆï¼Œé€£æƒ³é…列åã¨è¦ç´ å㯠var_name
+ : ã‹ã‚‰æŠ½å‡ºã•れるã¯ãšã§ã‚ã‚‹ã‹ã‚‰ï¼Œindex_name 引数㯠nil ã¨
+ : ã›ã­ã°ãªã‚‰ãªã„.
+
+ モジュール TclTkLib::RELEASE_TYPE
+ : Tcl/Tk ã®ãƒªãƒªãƒ¼ã‚¹ã‚¿ã‚¤ãƒ—番å·ã®å®šç¾©
+
+ 定数 ALPHA
+ : ALPHA リリース
+
+ 定数 BETA
+ : BETA リリース
+
+ 定数 FINAL
+ : FINAL リリース
+
+ モジュールメソッド
+ get_version()
+ : Tcl/Tk ã® major, minor, release-type 番å·, patchlevel ã‚’
+ : é…列ã«ã—ã¦è¿”ã™ï¼Ž
+
+ mainloop(check_root = true)
+ : イベントループを起動ã™ã‚‹ï¼Žcheck_root ㌠true ã§ã‚れã°ï¼Œ
+ : root widget ãŒå­˜åœ¨ã™ã‚‹é™ã‚Šï¼Œã“ã®ãƒ¡ã‚½ãƒƒãƒ‰ã¯çµ‚了ã—ãªã„.
+ : check_root ㌠false ã®å ´åˆã¯ï¼Œroot widget ãŒæ¶ˆæ»…ã—ã¦ã‚‚
+ : ã“ã®ãƒ¡ã‚½ãƒƒãƒ‰ã¯çµ‚了ã—ãªã„ ( root widget ãŒæ¶ˆæ»…ã—ã¦ã‚‚,
+ : WINDOW 以外ã®ã‚¤ãƒ™ãƒ³ãƒˆã¯ç™ºç”Ÿã—ã†ã‚‹ãŸã‚ ).終了ã«ã¯ï¼Œå¤–部
+ : ã‹ã‚‰ã®åƒã掛㑠( スレッドを活用ã™ã‚‹ãªã© ) ãŒå¿…è¦ï¼Ž
+
+ mainloop_thread?
+ : カレントスレッドãŒã‚¤ãƒ™ãƒ³ãƒˆãƒ«ãƒ¼ãƒ—を実行ã—ã¦ã„るスレッド
+ : ã‹ã©ã†ã‹ã‚’è¿”ã™ï¼Ž
+ : イベントループを実行ã—ã¦ã„るスレッドã§ã‚れ㰠true を,
+ : ã©ã®ã‚¹ãƒ¬ãƒƒãƒ‰ã§ã‚‚イベントループãŒå®Ÿè¡Œã•れã¦ã„ãªã„å ´åˆã¯
+ : nil を,他ã®ã‚¹ãƒ¬ãƒƒãƒ‰ã§ã‚¤ãƒ™ãƒ³ãƒˆãƒ«ãƒ¼ãƒ—ãŒå®Ÿè¡Œã•れã¦ã„ã‚‹å ´
+ : åˆã¯ false ã‚’è¿”ã™ï¼Ž
+ : false ã®éš›ã« Tk インタープリタを直接呼ã¶ã®ã¯å±é™ºã§ã‚る.
+
+ mainloop_watchdog(check_root = true)
+ : 通常ã®ã‚¤ãƒ™ãƒ³ãƒˆãƒ«ãƒ¼ãƒ—ã§ã¯ï¼Œã‚¤ãƒ™ãƒ³ãƒˆå‡¦ç†ã®å†…容ã«ã‚ˆã£ã¦ã¯
+ : デッドロックを引ãèµ·ã“ã™å¯èƒ½æ€§ãŒã‚ã‚‹ (例ãˆã°ã‚¤ãƒ™ãƒ³ãƒˆã«
+ : 対ã™ã‚‹ã‚³ãƒ¼ãƒ«ãƒãƒƒã‚¯å‡¦ç†ä¸­ã§ widget æ“作をã—,ãã®çµ‚了を
+ : å¾…ã¤ãªã©).ã“ã®ãƒ¡ã‚½ãƒƒãƒ‰ã¯ï¼Œãã†ã—ãŸãƒ‡ãƒƒãƒ‰ãƒ­ãƒƒã‚¯ã‚’回é¿ã™
+ : ã‚‹ãŸã‚ã®ç›£è¦–スレッド付ãã§ã‚¤ãƒ™ãƒ³ãƒˆãƒ«ãƒ¼ãƒ—ã‚’èµ·å‹•ã™ã‚‹
+ : ( 監視スレッドを生æˆã—ãŸå¾Œã«ã‚¤ãƒ™ãƒ³ãƒˆãƒ«ãƒ¼ãƒ—を実行ã™ã‚‹ ).
+ : å¼•æ•°ã®æ„味㯠mainloop ã¨åŒã˜ã§ã‚る.
+
+ do_one_event(flag = TclTkLib::EventFlag::ALL |
+ TclTkLib::EventFlag::DONT_WAIT)
+ : 処ç†å¾…ã¡ã®ã‚¤ãƒ™ãƒ³ãƒˆ 1 個を実行ã™ã‚‹ï¼Ž
+ : イベントを処ç†ã—ãŸå ´åˆã¯ true ã‚’è¿”ã™ï¼Ž
+ : フラグ㧠DONT_WAIT を指定ã—ã¦ã„ãªã„å ´åˆï¼Œãƒ•ラグã§å‡¦ç†å¯¾
+ : 象ã¨ãªã£ã¦ã„る種類ã®ã‚¤ãƒ™ãƒ³ãƒˆãŒç™ºç”Ÿã™ã‚‹ã¾ã§å¾…ã¡ç¶šã‘る.
+ : DONT_WAIT を指定ã—ã¦ã„ãŸå ´åˆï¼Œå‡¦ç†å¯¾è±¡ã‚¤ãƒ™ãƒ³ãƒˆãŒãªãã¦ã‚‚
+ : ã™ãã«çµ‚了㗠false ã‚’è¿”ã™ï¼Ž
+ : $SAFE >= 4 ã‹ï¼Œ$SAFE >= 1 ã‹ã¤ flag ãŒæ±šæŸ“ã•れã¦ã„ã‚‹ãªã‚‰ã°
+ : flag ã«ã¯ DONT_WAIT ãŒå¼·åˆ¶çš„ã«ä»˜ã‘られる.
+
+ set_eventloop_tick(timer_tick)
+ : イベントループã¨åŒæ™‚ã«åˆ¥ã‚¹ãƒ¬ãƒƒãƒ‰ãŒç¨¼åƒã—ã¦ã„ã‚‹å ´åˆã«ï¼Œæ™‚
+ : é–“ã«åŸºã¥ã„ãŸå¼·åˆ¶çš„ãªã‚¹ãƒ¬ãƒƒãƒ‰ã‚¹ã‚¤ãƒƒãƒãƒ³ã‚°ã‚’ã©ã®ç¨‹åº¦ã®é »åº¦
+ : ( 時間間隔 ) ã§ç™ºç”Ÿã•ã›ã‚‹ã‹ã‚’ミリ秒å˜ä½ã®æ•´æ•°å€¤ã§æŒ‡å®šã™ã‚‹ï¼Ž
+ : 0 を指定ã™ã‚‹ã¨ï¼Œã“ã®å¼·åˆ¶çš„ãªã‚¹ã‚¤ãƒƒãƒãƒ³ã‚°ã¯è¡Œã‚れãªã„.
+ : 標準ã§ã¯ 0 ã«è¨­å®šã•れã¦ãŠã‚Šï¼Œã‚¤ãƒ™ãƒ³ãƒˆå‡¦ç†æ•°ã«åŸºã¥ãスイッ
+ : ãƒãƒ³ã‚°ã ã‘ãŒè¡Œã‚れる ( see set_eventloop_weight ).
+ : ãŸã ã—,稼åƒã—ã¦ã„るスレッドãŒã‚¤ãƒ™ãƒ³ãƒˆãƒ«ãƒ¼ãƒ—ã ã‘ã®å ´åˆï¼Œ
+ : timer_tick ã‚’ 0 ã«è¨­å®šã™ã‚‹ã“ã¨ã¯ã§ããªã„.もã—設定ã•れã¦
+ : ã„ãŸã‚‰ï¼Œ100 ms ( see NO_THREAD_INTERRUPT_TIME ) ã«è‡ªå‹•設
+ : 定ã•れる.
+ : 詳細ãªèª¬æ˜Žã¯ç•¥ã™ãŒï¼Œã“れ㯠CPU パワーを節約ã—ã¤ã¤å®‰å…¨ã§
+ : 安定ã—ãŸå‹•作を実ç¾ã™ã‚‹ãŸã‚ã«å®Ÿè£…ã—ãŸä»•様ã§ã‚る.
+ : $SAFE >= 4 ã§ã¯å®Ÿè¡ŒãŒç¦æ­¢ã•れる.
+
+ get_eventloop_tick
+ : timer_tick ã®ç¾åœ¨å€¤ã‚’è¿”ã™ï¼Ž
+
+ set_no_event_wait(no_event_wait)
+ : 複数ã®ã‚¹ãƒ¬ãƒƒãƒ‰ãŒç¨¼åƒã—ã¦ã„ã‚‹å ´åˆã§ï¼Œå‡¦ç†å¾…ã¡ã‚¤ãƒ™ãƒ³ãƒˆãŒå…¨
+ : ã存在ã—ãªã‹ã£ãŸéš›ã« sleep 状態ã«å…¥ã‚‹æ™‚間長を指定ã™ã‚‹ï¼Ž
+ : 稼åƒã‚¹ãƒ¬ãƒƒãƒ‰ãŒã‚¤ãƒ™ãƒ³ãƒˆãƒ«ãƒ¼ãƒ—ã ã‘ã®å ´åˆã«ã¯æ„味をãªã•ãªã„.
+ : デフォルトã®å€¤ã¯ 20 (ms)
+ : $SAFE >= 4 ã§ã¯å®Ÿè¡ŒãŒç¦æ­¢ã•れる.
+
+ get_no_event_wait
+ : no_event_wait ã®ç¾åœ¨å€¤ã‚’è¿”ã™ï¼Ž
+
+ set_eventloop_weight(loop_max, no_event_tick)
+ : 複数ã®ã‚¹ãƒ¬ãƒƒãƒ‰ãŒç¨¼åƒã—ã¦ã„る際㫠Ruby/Tk ã®ã‚¤ãƒ™ãƒ³ãƒˆãƒ«ãƒ¼
+ : プã«å‰²ã‚Šå½“ã¦ã‚‹æ¯”é‡ã‚’定ã‚ã‚‹ãŸã‚ã®ãƒ‘ラメータを設定ã™ã‚‹ï¼Ž
+ : 稼åƒã‚¹ãƒ¬ãƒƒãƒ‰ãŒã‚¤ãƒ™ãƒ³ãƒˆãƒ«ãƒ¼ãƒ—ã ã‘ã®å ´åˆã«ã¯æ„味をãªã•ãªã„.
+ : 一度ã®ã‚¹ãƒ¬ãƒƒãƒ‰åˆ‡ã‚Šæ›¿ãˆã®é–“ã«å‡¦ç†ã™ã‚‹ã‚¤ãƒ™ãƒ³ãƒˆã®æœ€å¤§æ•°ã¨ï¼Œ
+ : 処ç†å¾…ã¡ã®ã‚¤ãƒ™ãƒ³ãƒˆãŒå­˜åœ¨ã—ãªã„éš›ã®åŠ ç®—æ•°ã¨ã‚’設定ã™ã‚‹ï¼Ž
+ : 処ç†å¾…ã¡ã‚¤ãƒ™ãƒ³ãƒˆãŒå­˜åœ¨ã—ãªã„å ´åˆã¯ no_event_wait ( see
+ : set_no_event_wait ) ã ã‘ã®é–“ sleep 状態ã«å…¥ã‚‹ï¼Ž
+ : デフォルトã§ã¯ãれãžã‚Œ 800 回㨠10 回,ã¤ã¾ã‚Šï¼Œ800 個ã®ã‚¤
+ : ベント (アイドルイベントをå«ã‚€) を処ç†ã™ã‚‹ã¨ã‹ï¼Œã‚¤ãƒ™ãƒ³ãƒˆ
+ : ãŒå…¨ã発生ã—ãªã„ã¾ã¾ã« 80 回ã®å‡¦ç†å¾…ã¡ã‚¤ãƒ™ãƒ³ãƒˆæ¤œæŸ»ãŒå®Œäº†
+ : ã™ã‚‹ã¨ã‹ã§ã‚«ã‚¦ãƒ³ãƒˆãŒ 800 以上ã«ãªã‚‹ã¨ã‚¹ãƒ¬ãƒƒãƒ‰ã‚¹ã‚¤ãƒƒãƒãƒ³ã‚°
+ : ãŒç™ºç”Ÿã™ã‚‹ã“ã¨ã«ãªã‚‹ï¼Ž
+ : $SAFE >= 4 ã§ã¯å®Ÿè¡ŒãŒç¦æ­¢ã•れる.
+
+ get_eventloop_weight
+ : ç¾åœ¨ã® loop_max 㨠no_event_tick ã¨ã®å€¤ã‚’è¿”ã™ï¼Ž
+ : ( see set_eventloop_wait )
+
+ mainloop_abort_on_exception=(bool)
+ : Tk インタープリタ上ã§ä¾‹å¤–を発生ã—ãŸéš›ã«ï¼Œã‚¤ãƒ™ãƒ³ãƒˆãƒ«ãƒ¼ãƒ—ã‚’
+ : ã‚¨ãƒ©ãƒ¼åœæ­¢ã•ã›ã‚‹ã‹ã©ã†ã‹ã‚’指定ã™ã‚‹ï¼Žtrue を指定ã—ãŸå ´åˆã¯
+ : ã‚¨ãƒ©ãƒ¼åœæ­¢ã™ã‚‹ãŒï¼Œfalse ã®å ´åˆã¯ä¾‹å¤–を無視ã—ã¦ã‚¤ãƒ™ãƒ³ãƒˆãƒ«ãƒ¼
+ : プを継続ã™ã‚‹ï¼Žã•ら㫠nil ã®å ´åˆã¯è­¦å‘Šãƒ¢ãƒ¼ãƒ‰ã§ãªã„é™ã‚Šã¯ã‚¨
+ : ラーメッセージã®å‡ºåŠ›ã™ã‚‰çœç•¥ã—ã¦ï¼Œä¾‹å¤–を無視ã™ã‚‹ï¼Ž
+ : デフォルトã§ã¯ true ã«è¨­å®šã•れã¦ã„る.
+ : 1個ã®ã‚¤ãƒ³ã‚¿ãƒ¼ãƒ—リタã ã‘を使ã£ã¦ã„ã‚‹å ´åˆã«ã¯ã‚¨ãƒ©ãƒ¼æ™‚ã«ãã®
+ : ã¾ã¾åœæ­¢ã—ã¦ã‚‚通常ã¯å•題ãªã„ãŒï¼Œè¤‡æ•°ã®ã‚¤ãƒ³ã‚¿ãƒ¼ãƒ—リタãŒåŒæ™‚
+ : ã«å‹•作ã—ã¦ã„ã‚‹å ´åˆã«ã¯ï¼Œãれらを管ç†ã™ã‚‹ã‚¤ãƒ™ãƒ³ãƒˆãƒ«ãƒ¼ãƒ—ã¯ï¼‘
+ : 個ã ã‘ã§ã‚ã‚‹ãŸã‚,ã„ãšã‚Œã‹ã®ã‚¤ãƒ³ã‚¿ãƒ¼ãƒ—リタã®ã‚¨ãƒ©ãƒ¼ãŒåŽŸå› ã§ï¼Œ
+ : ä»–ã®ã‚¤ãƒ³ã‚¿ãƒ¼ãƒ—リタã®å‡¦ç†ç¶™ç¶šãŒä¸å¯èƒ½ã«ãªã‚‹ã“ã¨ãŒã‚る.ãã®
+ : よã†ãªå ´åˆã§ã‚‚エラーを無視ã—ã¦ã‚¤ãƒ™ãƒ³ãƒˆãƒ«ãƒ¼ãƒ—ãŒç¨¼åƒã‚’ç¶šã‘ã‚‹
+ : ã“ã¨ã§ï¼Œä»–ã®ã‚¤ãƒ³ã‚¿ãƒ¼ãƒ—ãƒªã‚¿ãŒæ­£å¸¸ã«å‹•作ã—ç¶šã‘ã‚‹ã“ã¨ãŒã§ãる.
+ : $SAFE >= 4 ã§ã¯å®Ÿè¡ŒãŒç¦æ­¢ã•れる.
+
+ mainloop_abort_on_exception
+ : Tk インタープリタ上ã§ä¾‹å¤–を発生ã—ãŸéš›ã«ï¼Œã‚¤ãƒ™ãƒ³ãƒˆãƒ«ãƒ¼ãƒ—をエ
+ : ãƒ©ãƒ¼åœæ­¢ã•ã›ã‚‹ã‹ã©ã†ã‹ã®è¨­å®šçŠ¶æ…‹ã‚’ true/false ã§å¾—る.
+
+ num_of_mainwindows
+ : ç¾åœ¨ã®ãƒ¡ã‚¤ãƒ³ã‚¦ã‚£ãƒ³ãƒ‰ã‚¦ (ルートウィジェット) ã®æ•°ã‚’è¿”ã™ï¼Ž
+ : メインウィンドウã¯ä¸€ã¤ã®ã‚¤ãƒ³ã‚¿ãƒ¼ãƒ—リタã«ä»˜ã最大一ã¤ã§ã‚ã‚‹
+ : ã®ã§ï¼Œã“ã®å€¤ã¯ç¾åœ¨ Tk ã®æ©Ÿèƒ½ãŒæœ‰åйã§ã‚るインタープリタã®ç·
+ : æ•°ã«ç­‰ã—ã„.
+
+ _merge_tklist(str, str, ... )
+ : Tcl/Tk ã®ãƒ©ã‚¤ãƒ–ラリ関数を使ã£ã¦ï¼Œå¼•æ•°ã®æ–‡å­—列ãŒãれãžã‚Œ
+ : æ­£ã—ã一ã¤ã®ãƒªã‚¹ãƒˆè¦ç´ ã¨ãªã‚‹ã‚ˆã†ã«é€£çµã—ãŸæ–‡å­—列を返ã™ï¼Ž
+
+ _conv_listelement(str)
+ : Tcl/Tk ã®ãƒ©ã‚¤ãƒ–ラリ関数を使ã£ã¦ï¼Œå¼•æ•°ã®æ–‡å­—列㌠Tcl ã®
+ : 一ã¤ã®ãƒªã‚¹ãƒˆè¦ç´ ã¨ã—ã¦é©åˆ‡ãªè¡¨ç¾ã«ãªã‚‹ã‚ˆã†ã«å¤‰æ›ã—ãŸæ–‡
+ : 字列を返ã™ï¼Ž
+
+ _toUTF8(str, encoding=nil)
+ _fromUTF8(str, encoding=nil)
+ : Tcl/Tk ãŒå†…蔵ã—ã¦ã„ã‚‹ UTF8 変æ›å‡¦ç†ã‚’呼ã³å‡ºã™ï¼Ž
+
+ _subst_UTF_backslash(str)
+ _subst_Tcl_backslash(str)
+ : Tcl ã®ãƒ«ãƒ¼ãƒ«ã§ãƒãƒƒã‚¯ã‚¹ãƒ©ãƒƒã‚·ãƒ¥è¨˜æ³• ( \uhhhh ã«ã‚ˆã‚‹
+ : Unicode 文字表ç¾ã‚’å«ã‚€ ) ã‚’è§£æžã™ã‚‹ï¼Ž
+ : _subst_Tcl_backslash ã¯ã™ã¹ã¦ã®ãƒãƒƒã‚¯ã‚¹ãƒ©ãƒƒã‚·ãƒ¥è¨˜æ³•ã‚’
+ : ç½®ãæ›ãˆã‚‹ã®ã«å¯¾ã—,_subst_UTF_backslash 㯠\uhhhh
+ : ã«ã‚ˆã‚‹ Unicode 文字表ç¾ã ã‘ã‚’ç½®ãæ›ãˆã‚‹ï¼Ž
+
+ encoding_system
+ encoding_system=(encoding)
+ : Tcl ã® system encoding ã®ç²å¾—ãŠã‚ˆã³è¨­å®š
+
+ encoding
+ encoding=(encoding)
+ : encoding_system / encoding_system= ã® alias
+ : ( Ruby/Tk ã® tk.rb ã§ã¯ç½®ãæ›ãˆã‚‰ã‚Œã‚‹äºˆå®šã®ã‚‚ã®ï¼Ž)
+
+
+クラス TclTkIp
+ クラスメソッド
+ new(ip_name=nil, options='')
+ : TclTkIp クラスã®ã‚¤ãƒ³ã‚¹ã‚¿ãƒ³ã‚¹ã‚’生æˆã™ã‚‹ï¼Ž
+ : ip_name ã«æ–‡å­—列を与ãˆãŸå ´åˆã¯ï¼Œãれ㌠winfo interps ãªã©ã§
+ : 表示ã•れるåå‰ã«ãªã‚‹ï¼Ž
+ : options ã«ã¯ï¼Œ-geometry ã‚„ -use ãªã©ï¼Œwish ã®ã‚³ãƒžãƒ³ãƒ‰ãƒ©ã‚¤ãƒ³
+ : 引数ã¨ã—ã¦ä¸Žãˆã‚‹ã‚ªãƒ—ションã¨åŒæ§˜ã®æƒ…報を文字列ã¨ã—ã¦ä¸Žãˆã‚‹ï¼Ž
+ : 与ãˆã‚‰ã‚ŒãŸæƒ…å ±ã¯ï¼Œroot widget 生æˆã®éš›ã«ç”¨ã„られる.
+ : ( e.g. TclTkIp.new('FOO', '-geometry 500x200 -use 0x2200009') )
+ : ã‚‚ã— options ã«æ•¢ãˆã¦ nil ã¾ãŸã¯ false を与ãˆãŸå ´åˆï¼ŒTk ライ
+ : ブラリãŒå°Žå…¥ã•れã¦ã„ãªã„ (ã¤ã¾ã‚Šã¯ Tcl ã®ã¿ã®) インタープリ
+ : タを生æˆã™ã‚‹ï¼Žã“ã®å ´åˆã¯ GUI 環境ã¯å¿…è¦ãªã„ãŸã‚,ウインドウ
+ : システムãŒå­˜åœ¨ã—ãªã„,ã¾ãŸã¯ä½¿ç”¨ã§ããªã„環境ã§ã‚‚ Tcl インター
+ : プリタを生æˆã—,Tcl ã‚„ãã®æ‹¡å¼µãƒ©ã‚¤ãƒ–ラリを活用ã™ã‚‹ã“ã¨ãŒã§ãる.
+
+ インスタンスメソッド
+ create_slave(name, safe=false)
+ : レシーãƒã‚’親ã¨ã™ã‚‹ name ã¨ã„ã†åå‰ã®ã‚¹ãƒ¬ãƒ¼ãƒ–インタープリタを
+ : 生æˆã™ã‚‹ï¼Ž
+ : safe ã«ã¯ç”Ÿæˆã™ã‚‹ã‚¤ãƒ³ã‚¿ãƒ¼ãƒ—リタを safe インタープリタã¨ã™ã‚‹
+ : ã‹ã‚’指定ã™ã‚‹ï¼Žãƒ‡ãƒ•ォルト㯠false ã¨ã„ã†ã“ã¨ã«ãªã£ã¦ã„ã‚‹ãŒï¼Œ
+ : ãŸã¨ãˆæ˜Žç¢ºã« false を指定ã—ã¦ã„ãŸã¨ã—ã¦ã‚‚,親ã¨ãªã‚‹ã‚¤ãƒ³ã‚¿ãƒ¼
+ : プリタ㌠safe インタープリタã§ã‚れã°ï¼Œãã®è¨­å®šã‚’引ãç¶™ã„ã§
+ : safe インタープリタã¨ã—ã¦ç”Ÿæˆã•れる.
+ : $SAFE >= 4 ã§ã¯ï¼Œsafe インタープリタ以外ã®ç”ŸæˆãŒç¦æ­¢ã•れる.
+
+ make_safe
+ : Tcl/Tk インタープリタを safe インタープリタã«å¤‰æ›´ã™ã‚‹ï¼Ž
+ : 戻り値ã¯ãƒ¬ã‚·ãƒ¼ãƒã§ã‚るインタープリタ自身ã§ã‚る.
+ : 失敗ã—ãŸå ´åˆã¯ RuntimeError ã®ä¾‹å¤–を発生ã™ã‚‹ï¼Ž
+
+ safe?
+ : Tcl/Tk インタープリタ㌠safe インタープリタã§ã‚ã‚‹ã‹ã‚’調ã¹ã‚‹ï¼Ž
+ : safe インタープリタã§ã‚れ㰠true ã‚’è¿”ã™ï¼Ž
+
+ allow_ruby_exit?
+ : 対象ã¨ãªã‚‹ã‚¤ãƒ³ã‚¿ãƒ¼ãƒ—リタ上ã®è©•価ã§ï¼Œruby ã® exit 関数ã¾ãŸã¯
+ : Tcl/Tk 上㮠exit コマンドã«ã‚ˆã£ã¦ ruby 自体を終了ã•ã›ã‚‹ã“ã¨
+ : を許ã™ã‹ã©ã†ã‹ã‚’è¿”ã™ï¼Ž
+ : 許ã•ãªã„å ´åˆã¯å¯¾è±¡ã®ã‚¤ãƒ³ã‚¿ãƒ¼ãƒ—リタã ã‘ãŒçµ‚了ã™ã‚‹ï¼Ž
+ : マスターインタープリタã®ãƒ‡ãƒ•ォルト値㯠true,スレーブインター
+ : プリタã®ãƒ‡ãƒ•ォルト値㯠false ã§ã‚る.
+
+ allow_ruby_exit=(mode)
+ : 対象ã¨ãªã‚‹ã‚¤ãƒ³ã‚¿ãƒ¼ãƒ—リタ㮠allow_ruby_exit? ã®çŠ¶æ…‹ã‚’å¤‰æ›´ã™ã‚‹ï¼Ž
+ : $SAFE >= 4 ã¾ãŸã¯ã‚¤ãƒ³ã‚¿ãƒ¼ãƒ—リタ㌠safe インタープリタã®å ´åˆã¯
+ : 変更ãŒè¨±ã•れãªã„ (例外を発生).
+
+ delete
+ : Tcl/Tk インタープリタを delete ã™ã‚‹ï¼Ž
+ : delete ã•れãŸã‚¤ãƒ³ã‚¿ãƒ¼ãƒ—リタã¯ï¼Œä»¥å¾Œä¸€åˆ‡ã®æ“作ãŒã§ããªããªã‚Šï¼Œ
+ : コマンドをé€ã£ã¦ã‚‚例外を発生ã™ã‚‹ã‚ˆã†ã«ãªã‚‹ï¼Ž
+
+ deleted?
+ : Tcl/Tk インタープリタãŒã™ã§ã« delete ã•れã¦ã„ã‚‹ã‹ã‚’調ã¹ã‚‹ï¼Ž
+ : delete 済ã¿ã§ã‚³ãƒžãƒ³ãƒ‰ã‚’å—ã‘付ã‘ãªã„状態ã«ãªã£ã¦ã„ã‚‹ãªã‚‰ã°
+ : true ã‚’è¿”ã™ï¼Ž
+
+ has_mainwindow?
+ : Tcl/Tk インタープリタã«ãƒ¡ã‚¤ãƒ³ã‚¦ã‚£ãƒ³ãƒ‰ã‚¦ (root widget) ãŒ
+ : 存在ã™ã‚Œã° true を,存在ã—ãªã‘れ㰠false ã‚’è¿”ã™ï¼Ž
+ : ã‚¤ãƒ³ã‚¿ãƒ¼ãƒ—ãƒªã‚¿ãŒæ—¢ã« delete 済ã¿ã§ã‚れ㰠nil ã‚’è¿”ã™ï¼Ž
+
+ restart
+ : Tcl/Tk インタープリタ㮠Tk 部分ã®åˆæœŸåŒ–,å†èµ·å‹•を行ã†ï¼Ž
+ : 一旦 root widget を破壊ã—ãŸå¾Œã«å†åº¦ Tk ã®æ©Ÿèƒ½ãŒå¿…è¦ã¨
+ : ãªã£ãŸå ´åˆã«ç”¨ã„る.
+ : $SAFE >= 4 ã§ã¯å®Ÿè¡ŒãŒç¦æ­¢ã•れる.
+
+ _eval(str)
+ _invoke(*args)
+ : Tcl/Tk インタープリタ上ã§è©•価を行ã†ï¼Ž
+ : _eval ã¯è©•価スクリプトãŒä¸€ã¤ã®æ–‡å­—列ã§ã‚ã‚‹ã“ã¨ã«å¯¾ã—,
+ : _invoke ã¯è©•価スクリプト㮠token ã”ã¨ã«ä¸€ã¤ã®å¼•æ•°ã¨ãª
+ : るよã†ã«ä¸Žãˆã‚‹ï¼Ž
+ : _invoke ã®æ–¹ã¯ Tcl/Tk インタープリタã®å­—å¥è§£æžå™¨ã‚’用ã„
+ : ãªã„ãŸã‚,評価ã®è² è·ãŒã‚ˆã‚Šå°‘ãªãã¦ã™ã‚€ï¼ŽãŸã ã—,ãã®ä»£
+ : ã‚り㫠auto_load ã®ã‚ˆã†ãªæ©Ÿæ§‹ã¯åƒã‹ãšï¼Œload ç­‰ã«ã‚ˆã£ã¦
+ : Tcl/Tk ã‚¤ãƒ³ã‚¿ãƒ¼ãƒ—ãƒªã‚¿ä¸Šã«æ—¢ã«ç™»éŒ²æ¸ˆã¿ã®ã‚³ãƒžãƒ³ãƒ‰ã—ã‹å‘¼
+ : ã³å‡ºã™ã“ã¨ãŒã§ããªã„.
+ : _eval ã§ã¯ auto_load 機構ãŒåƒããŸã‚,一度 _eval を実行
+ : ã—ã¦ç™»éŒ²ã«æˆåŠŸã—ã•ãˆã™ã‚Œã°ï¼Œä»¥é™ã¯ _invoke ã§ã‚‚利用ã§
+ : ãるよã†ã«ãªã‚‹ï¼Ž
+
+ _cancel_eval(str)
+ _cancel_eval_unwind(str)
+ : (Tcl/Tk8.6 or later)
+ : Tcl_CancelEval() 関数を呼ã³å‡ºã—,eval ã®å®Ÿè¡Œã‚’打ã¡åˆ‡ã‚‹ï¼Ž
+
+ _toUTF8(str, encoding=nil)
+ _fromUTF8(str, encoding=nil)
+ : Tcl/Tk ãŒå†…蔵ã—ã¦ã„ã‚‹ UTF8 変æ›å‡¦ç†ã‚’呼ã³å‡ºã™ï¼Ž
+
+ _thread_vwait(var_name)
+ _thread_tkwait(mode, target)
+ : スレッド対応㮠vwait ã‚ã‚‹ã„㯠tkwait 相当ã®ãƒ¡ã‚½ãƒƒãƒ‰ï¼Ž
+ : 通常㮠vwait ã‚ã‚‹ã„㯠tkwait コマンドã¨ç•°ãªã‚‹ã®ã¯ï¼Œã‚¤ãƒ™ãƒ³
+ : トループã¨ã¯ç•°ãªã‚‹ã‚¹ãƒ¬ãƒƒãƒ‰ã‹ã‚‰å‘¼ã³å‡ºã—ãŸå ´åˆã« vwait ç­‰ã®
+ : スタックã¨ã¯ç‹¬ç«‹ã«æ¡ä»¶ã®æˆç«‹å¾…ã¡ãŒãªã•れるã“ã¨ã§ã‚る.
+ : 通常㮠vwait / tkwait ã§ã¯ï¼Œvwait / tkwait (1) ã®å¾…ã¡ã®é€”
+ : 中ã§ã•ら㫠vwait / tkwait (2) ãŒå‘¼ã°ã‚ŒãŸå ´åˆï¼Œå¾…ã¡ã®å¯¾è±¡
+ : ã¨ãªã£ã¦ã„ã‚‹æ¡ä»¶ã®æˆç«‹é †åºãŒã©ã†ã‚れ,(2)->(1) ã®é †ã§å¾…ã¡
+ : を終了ã—ã¦æˆ»ã£ã¦ãる.
+ : _thread_vwait / _thread_tkwait ã¯ï¼Œã‚¤ãƒ™ãƒ³ãƒˆãƒ«ãƒ¼ãƒ—ã®ã‚¹ãƒ¬ãƒƒ
+ : ドã§å‘¼ã°ã‚ŒãŸå ´åˆã¯é€šå¸¸ã® vwait / tkwait ã¨åŒæ§˜ã«å‹•作ã™ã‚‹
+ : ãŒï¼Œã‚¤ãƒ™ãƒ³ãƒˆãƒ«ãƒ¼ãƒ—以外ã®ã‚¹ãƒ¬ãƒƒãƒ‰ã§å‘¼ã°ã‚ŒãŸå ´åˆã«ã¯ãã®ã‚¹
+ : ãƒ¬ãƒƒãƒ‰ã‚’åœæ­¢ã•ã›ã¦å¾…ã¡ã«å…¥ã‚Šï¼Œæ¡ä»¶ãŒæˆç«‹ã—ãŸæ™‚ã«ã‚¹ãƒ¬ãƒƒãƒ‰
+ : ã®å®Ÿè¡Œã‚’å†é–‹ã™ã‚‹ï¼Žã€Œvwait ç­‰ã®å¾…ã¡ã‚¹ã‚¿ãƒƒã‚¯ã¨ã¯ç‹¬ç«‹ã€ã¨ã„
+ : ã†æ„味ã¯ï¼Œã“ã®å†é–‹ã®ã‚¿ã‚¤ãƒŸãƒ³ã‚°ãŒä»–ã®ã‚¹ãƒ¬ãƒƒãƒ‰ã§ã®å¾…ã¡çжæ³
+ : ã¨ã¯ç„¡é–¢ä¿‚ã¨ã„ã†ã“ã¨ã§ã‚る.ã¤ã¾ã‚Šï¼Œã‚¤ãƒ™ãƒ³ãƒˆãƒ«ãƒ¼ãƒ—ç­‰ã®ä»–
+ : ã®ã‚¹ãƒ¬ãƒƒãƒ‰ã§ vwait ç­‰ã§å¾…ã¡ã®çŠ¶æ…‹ã«ã‚ã£ãŸã¨ã—ã¦ã‚‚ãã®å®Œäº†
+ : ã‚’å¾…ã¤ã“ã¨ãªã,自らã®å¾…ã¡æ¡ä»¶ãŒæˆç«‹æ¬¡ç¬¬ï¼Œå‡¦ç†ã‚’継続ã™ã‚‹
+ : ã“ã¨ã«ãªã‚‹ï¼Ž
+
+ _return_value
+ : ç›´å‰ã® Tcl/Tk 上ã§ã®è©•価ã®å®Ÿè¡Œçµæžœã¨ã—ã¦ã®æˆ»ã‚Šå€¤ã‚’è¿”ã™ï¼Ž
+
+ _get_variable(var_name, flag)
+ _get_variable2(var_name, index_name, flag)
+ : Tcl/Tk 上㮠var ã¨ã„ã†å¤‰æ•°åã®å¤‰æ•°ã®å€¤ã‚’è¿”ã™ï¼Ž
+ : ã‚‚ã— index_name ãŒæŒ‡å®š (PARSE_VARNAME フラグã®èª¬æ˜Žã‚‚å‚ç…§)
+ : ã•れãŸå ´åˆã¯é€£æƒ³é…列 var_name ã® index_name ã®è¦ç´ ã‚’è¿”ã™ï¼Ž
+ : flag ã«ã¯å¤‰æ•°ã‚’検索ã™ã‚‹éš›ã®æ¡ä»¶ã‚’指定ã™ã‚‹ï¼Žflag ã«ä¸Žãˆã‚‹
+ : 値ã¯ãƒ¢ã‚¸ãƒ¥ãƒ¼ãƒ« TclTkLib::VarAccessFlag ã‚’å‚ç…§ã™ã‚‹ã“ã¨ï¼Ž
+
+ _set_variable(var_name, value, flag)
+ _set_variable2(var_name, index_name, value, flag)
+ : Tcl/Tk 上㮠var ã¨ã„ã†å¤‰æ•°åã®å¤‰æ•°ã«å€¤ã‚’設定ã™ã‚‹ï¼Ž
+ : ã‚‚ã— index_name ãŒæŒ‡å®š (PARSE_VARNAME フラグã®èª¬æ˜Žã‚‚å‚ç…§)
+ : ã•れãŸå ´åˆã¯é€£æƒ³é…列 var_name ã® index_name ã®è¦ç´ ã‚’設定
+ : ã™ã‚‹ï¼Ž
+ : flag ã«ã¯å¤‰æ•°ã‚’検索ã™ã‚‹éš›ã®æ¡ä»¶ã‚’指定ã™ã‚‹ï¼Žflag ã«ä¸Žãˆã‚‹
+ : 値ã¯ãƒ¢ã‚¸ãƒ¥ãƒ¼ãƒ« TclTkLib::VarAccessFlag ã‚’å‚ç…§ã™ã‚‹ã“ã¨ï¼Ž
+
+ _unset_variable(var_name)
+ _unset_variable2(var_name, index_name)
+ : Tcl/Tk 上㮠var_name ã¨ã„ã†å¤‰æ•°åã®å¤‰æ•°ã‚’消去ã™ã‚‹ï¼Ž
+ : ã‚‚ã— index_name ãŒæŒ‡å®š (PARSE_VARNAME フラグã®èª¬æ˜Žã‚‚å‚ç…§)
+ : ã•れãŸå ´åˆã¯é€£æƒ³é…列 var_name ã‹ã‚‰ index_name ã®è¦ç´ ã ã‘
+ : を消去ã™ã‚‹ï¼Ž
+
+ _get_global_var(var_name)
+ _get_global_var2(var_name, index_name)
+ _set_global_var(var_name, value)
+ _set_global_var2(var_name, index_name, value)
+ _unset_global_var(var_name)
+ _unset_global_var2(var_name, index_name)
+ : ãれãžã‚Œï¼Œå¯¾å¿œã™ã‚‹å¤‰æ•°ã‚¢ã‚¯ã‚»ã‚¹ãƒ¡ã‚½ãƒƒãƒ‰ã® flag ã«å¯¾ã—ã¦
+ : (GLOBAL_ONLY | LEAVE_ERR_MSG) を与ãˆãŸã‚‚ã®ï¼Ž
+
+ _split_tklist(str)
+ : Tcl/Tk ã®ãƒ©ã‚¤ãƒ–ラリ関数を使ã£ã¦ï¼Œæ–‡å­—列 str をリストã«
+ : 分割ã™ã‚‹ (文字列ã®é…列ã¨ã—ã¦è¿”ã™).
+
+ _merge_tklist(str, str, ... )
+ : Tcl/Tk ã®ãƒ©ã‚¤ãƒ–ラリ関数を使ã£ã¦ï¼Œå¼•æ•°ã®æ–‡å­—列ãŒãれãžã‚Œ
+ : æ­£ã—ã一ã¤ã®ãƒªã‚¹ãƒˆè¦ç´ ã¨ãªã‚‹ã‚ˆã†ã«é€£çµã—ãŸæ–‡å­—列を返ã™ï¼Ž
+
+ _conv_listelement(str)
+ : Tcl/Tk ã®ãƒ©ã‚¤ãƒ–ラリ関数を使ã£ã¦ï¼Œå¼•æ•°ã®æ–‡å­—列㌠Tcl ã®
+ : 一ã¤ã®ãƒªã‚¹ãƒˆè¦ç´ ã¨ã—ã¦é©åˆ‡ãªè¡¨ç¾ã«ãªã‚‹ã‚ˆã†ã«å¤‰æ›ã—ãŸæ–‡
+ : 字列を返ã™ï¼Ž
+
+ mainloop
+ mainloop_watchdog
+ : スレーブ IP ã®å ´åˆã«ã¯ã‚¤ãƒ™ãƒ³ãƒˆãƒ«ãƒ¼ãƒ—ã‚’èµ·å‹•ã›ãšã« nil ã‚’è¿”ã™ï¼Ž
+ : ãれ以外ã®ç‚¹ã§ã¯å¼•æ•°ã‚’å«ã‚㦠TclTkLib ã®åŒåメソッドã«åŒã˜ï¼Ž
+
+ do_one_event
+ : スレーブ IP ã®å ´åˆã«ã¯å¼•æ•°ã®ã‚¤ãƒ™ãƒ³ãƒˆãƒ•ラグ㫠DONT_WAIT ãŒ
+ : 強制的ã«è¿½åŠ ã•れる (イベント待ã¡ã§ã‚¹ãƒªãƒ¼ãƒ—ã™ã‚‹ã“ã¨ã¯ç¦æ­¢).
+ : ãれ以外ã®ç‚¹ã§ã¯å¼•æ•°ã‚’å«ã‚㦠TclTkLib ã®åŒåメソッドã«åŒã˜ï¼Ž
+
+ set_eventloop_tick
+ get_eventloop_tick
+ set_no_event_wait
+ get_no_event_wait
+ set_eventloop_weight
+ get_eventloop_weight
+ mainloop_abort_on_exception
+ mainloop_abort_on_exception=
+ : スレーブ IP ã®å ´åˆã«ã¯å€¤ã®è¨­å®šãŒè¨±ã•れãªã„ (無視ã•れる).
+ : ãれ以外ã®ç‚¹ã§ã¯å¼•æ•°ã‚’å«ã‚㦠TclTkLib ã®åŒåメソッドã«åŒã˜ï¼Ž
+
+ encoding_table
+ : Ruby m17n 用㫠Ruby 㨠Tk ã¨ã®é–“ã® encoding 対応表を返ã™ï¼Ž
+
+クラス TkCallbackBreak < StandardError
+クラス TkCallbackContinue < StandardError
+ : ã“れらã¯ã‚¤ãƒ™ãƒ³ãƒˆã‚³ãƒ¼ãƒ«ãƒãƒƒã‚¯ã«ãŠã„ã¦ï¼Œã‚³ãƒ¼ãƒ«ãƒãƒƒã‚¯å‡¦ç†ã‚’é©åˆ‡ã«ä¸­
+ : æ–­ã—ãŸã‚Šï¼Œæ¬¡ã®ãƒã‚¤ãƒ³ãƒ‰ã‚¿ã‚°ã®ãƒã‚¤ãƒ³ãƒ‡ã‚£ãƒ³ã‚°å‡¦ç†ã«é€²ã‚ãŸã‚Šã™ã‚‹ã“ã¨
+ : ã‚’å¯èƒ½ã«ã™ã‚‹ãŸã‚ã®ä¾‹å¤–クラスã§ã‚る.
+ : コールãƒãƒƒã‚¯ã§ break ã‚„ continue を実ç¾ã™ã‚‹ãŸã‚ã«ã¯ï¼Œã‚³ãƒ¼ãƒ«ãƒãƒƒã‚¯
+ : ã§ã‚ã‚‹ Ruby 手続ã㌠Tcl/Tk インタープリタå´ã«é©åˆ‡ãªãƒªã‚¿ãƒ¼ãƒ³ã‚³ãƒ¼
+ : ドを返ã™å¿…è¦ãŒã‚る.Ruby ã®æ‰‹ç¶šããŒæ™®é€šã«å€¤ã‚’è¿”ã™ã®ã§ã¯ï¼Œãã‚ŒãŒæ™®
+ : é€šã®æˆ»ã‚Šå€¤ã§ã‚ã‚‹ã®ã‹å¦ã‹ã‚’区別ãŒã§ããªã„ãŸã‚,例外発生を利用ã—ãŸ
+ : 実装を行ã£ã¦ã„る.
+ : ãŸã ã—ç¾åœ¨ã§ã¯ï¼Œã‚³ãƒ¼ãƒ«ãƒãƒƒã‚¯æ‰‹ç¶šãã‚’ Ruby ã® break, next ã§çµ‚了ã™
+ : ã‚‹ã“ã¨ã§åŒç­‰ã®çµæžœã‚’å¾—ã‚‹ã“ã¨ãŒã§ãるよã†ã«ãªã£ã¦ã„る.ãれゆãˆï¼Œ
+ : ã“れらã¯å¿…è¦ãªã„ã‚‚ã®ã§ã¯ã‚ã‚‹ãŒï¼Œäº’æ›æ€§ã®ãŸã‚ã«æ®‹ã—ã¦ã‚る.
+
+(eof)
diff --git a/ext/tk/README.1st b/ext/tk/README.1st
index 0179f4d526..4ffef34f1d 100644
--- a/ext/tk/README.1st
+++ b/ext/tk/README.1st
@@ -1,19 +1,19 @@
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.
--------------------------------------------
- ( the following is written in EUC-JP )
+ ( the following is written in UTF-8 )
-Ruby/Tk (tk.rb ¤Ê¤É) ¤ò»È¤¤¤¿¤¤¾ì¹ç¤Ë¤Ï¡¤tcltklib.so ¤¬Àµ¤·¤¯Æ°¤¤¤Æ¤¤¤Ê
-¤±¤ì¤Ð¤Ê¤ê¤Þ¤»¤ó¡¥¥³¥ó¥Ñ¥¤¥ë»þ¤Ë²¿¤«ÌäÂ꤬À¸¤¸¤¿¾ì¹ç¤Ï¡¤README.tcltklib
-¤ä README.ActiveTcl ¤ò¸«¤Æ¤¯¤À¤µ¤¤¡¥
-¤¿¤È¤¨ Ruby ¤Î¥é¥¤¥Ö¥é¥ê¥Ç¥£¥ì¥¯¥È¥ê¤Ë tcltklib.so ¤¬Â¸ºß¤·¤Æ¤¤¤¿¤È¤·¤Æ
-¤â¡¤¼Â¹Ô´Ä¶­¤Ë Tcl/Tk ¥é¥¤¥Ö¥é¥ê (libtcl8.4.so ¤Ê¤É) ¤¬¤Ê¤±¤ì¤Ðµ¡Ç½¤·¤Þ
-¤»¤ó¡¥Tcl/Tk ¤¬Àµ¤·¤¯¥¤¥ó¥¹¥È¡¼¥ë¤µ¤ì¤Æ¤¤¤ë¤«¤â¥Á¥§¥Ã¥¯¤·¤Æ¤¯¤À¤µ¤¤¡¥
+Ruby/Tk (tk.rb ãªã©) を使ã„ãŸã„å ´åˆã«ã¯ï¼Œtcltklib.so ãŒæ­£ã—ãå‹•ã„ã¦ã„ãª
+ã‘れã°ãªã‚Šã¾ã›ã‚“.コンパイル時ã«ä½•ã‹å•題ãŒç”Ÿã˜ãŸå ´åˆã¯ï¼ŒREADME.tcltklib
+ã‚„ README.ActiveTcl を見ã¦ãã ã•ã„.
+ãŸã¨ãˆ Ruby ã®ãƒ©ã‚¤ãƒ–ラリディレクトリ㫠tcltklib.so ãŒå­˜åœ¨ã—ã¦ã„ãŸã¨ã—ã¦
+も,実行環境㫠Tcl/Tk ライブラリ (libtcl8.4.so ãªã©) ãŒãªã‘ã‚Œã°æ©Ÿèƒ½ã—ã¾
+ã›ã‚“.Tcl/Tk ãŒæ­£ã—ãインストールã•れã¦ã„ã‚‹ã‹ã‚‚ãƒã‚§ãƒƒã‚¯ã—ã¦ãã ã•ã„.
==========================================================
Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
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..1367189690 100644
--- a/ext/tk/README.tcltklib
+++ b/ext/tk/README.tcltklib
@@ -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 2b5c8c4674..1a44eccb31 100644
--- a/ext/tk/extconf.rb
+++ b/ext/tk/extconf.rb
@@ -8,7 +8,8 @@ TkLib_Config = {}
TkLib_Config['search_versions'] =
# %w[8.9 8.8 8.7 8.6 8.5 8.4 8.3 8.2 8.1 8.0 7.6 4.2]
# %w[8.7 8.6 8.5 8.4 8.3 8.2 8.1 8.0]
- %w[8.7 8.6 8.5 8.4 8.0] # to shorten search steps
+ # %w[8.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['major_nums'] = '87'
@@ -315,7 +316,7 @@ def find_macosx_framework
paths.map{|dir| dir.strip.chomp('/')}.each{|dir|
next unless File.exist?(File.join(dir, "Tcl.framework", "Headers"))
next unless File.directory?(tcldir = File.join(dir, "Tcl.framework"))
- next unless File.exist?(File.join(dir, "Tk.framework"), "Headers")
+ next unless File.exist?(File.join(dir, "Tk.framework", "Headers"))
next unless File.directory?(tkdir = File.join(dir, "Tk.framework"))
TkLib_Config["tcltk-framework"] = dir
return [tcldir, tkdir]
@@ -543,7 +544,7 @@ end
def get_ext_list()
exts = [CONFIG['DLEXT']]
exts.concat %w(dll lib) if is_win32?
- exts.concat %w(bundle dylib) if is_macosx? || /nextstep|openstep|rhapsody/ =~ RUBY_PLATFORM
+ exts.concat %w(bundle dylib) if is_macosx?
if enable_config("shared") == false
[CONFIG['LIBEXT'], "a"].concat exts
@@ -1360,10 +1361,15 @@ def find_tcltk_header(tclver, tkver)
print(".") # progress
if major && minor
# version check on tcl.h
- have_tcl_h = try_cpp("#include <tcl.h>\n#if TCL_MAJOR_VERSION != #{major} || TCL_MINOR_VERSION != #{minor}\n#error VERSION does not match\n#endif")
+ version_check = proc {|code|
+ code << ("#if TCL_MAJOR_VERSION != #{major} || TCL_MINOR_VERSION != #{minor}\n" \
+ "#error VERSION does not match\n" \
+ "#endif")
+ }
else
- have_tcl_h = have_header('tcl.h')
+ version_check = nil
end
+ have_tcl_h = have_header('tcl.h', &version_check)
unless have_tcl_h
if tclver && ! tclver.empty?
versions = [tclver]
@@ -1385,13 +1391,19 @@ def find_tcltk_header(tclver, tkver)
(File.directory?(dir))? File.expand_path(dir): nil
}.compact.uniq
- code = "#include <tcl.h>\n"
- code << "#if TCL_MAJOR_VERSION != #{major}\n#error MAJOR_VERSION does not match\n#endif\n" if major
- code << "#if TCL_MINOR_VERSION != #{minor}\n#error MINOR_VERSION does not match\n#endif\n" if minor
+ if major || minor
+ version_check = proc {|code|
+ code << "#if TCL_MAJOR_VERSION != #{major}\n#error MAJOR_VERSION does not match\n#endif\n" if major
+ code << "#if TCL_MINOR_VERSION != #{minor}\n#error MINOR_VERSION does not match\n#endif\n" if minor
+ code
+ }
+ else
+ version_check = nil
+ end
have_tcl_h = paths.find{|path|
print(".") # progress
inc_opt = " -I#{path.quote}"
- if try_cpp(code, inc_opt)
+ if try_header("tcl", inc_opt, &version_check)
($INCFLAGS ||= "") << inc_opt
true
else
@@ -1416,10 +1428,15 @@ def find_tcltk_header(tclver, tkver)
print(".") # progress
if major && minor
# version check on tk.h
- have_tk_h = try_cpp("#include <tk.h>\n#if TK_MAJOR_VERSION != #{major} || TK_MINOR_VERSION != #{minor}\n#error VERSION does not match\n#endif")
+ version_check = proc {|code|
+ code << ("#if TK_MAJOR_VERSION != #{major} || TK_MINOR_VERSION != #{minor}\n" \
+ "#error VERSION does not match\n" \
+ "#endif")
+ }
else
- have_tk_h = have_header('tk.h')
+ version_check = nil
end
+ have_tk_h = have_header('tk.h')
unless have_tk_h
if tkver && ! tkver.empty?
versions = [tkver]
@@ -1441,13 +1458,19 @@ def find_tcltk_header(tclver, tkver)
(File.directory?(dir))? File.expand_path(dir): nil
}.compact.uniq
- code = "#include <tcl.h>\n#include <tk.h>\n"
- code << "#if TK_MAJOR_VERSION != #{major}\n#error MAJOR_VERSION does not match\n#endif\n" if major
- code << "#if TK_MINOR_VERSION != #{minor}\n#error MINOR_VERSION does not match\n#endif\n" if minor
+ if major || minor
+ version_check = proc {|code|
+ code << "#if TK_MAJOR_VERSION != #{major}\n#error MAJOR_VERSION does not match\n#endif\n" if major
+ code << "#if TK_MINOR_VERSION != #{minor}\n#error MINOR_VERSION does not match\n#endif\n" if minor
+ code
+ }
+ else
+ version_check = nil
+ end
have_tk_h = paths.find{|path|
print(".") # progress
inc_opt = " -I#{path.quote}"
- if try_cpp(code, inc_opt)
+ if try_header(%w'tcl.h tk.h', inc_opt, &version_check)
($INCFLAGS ||= "") << inc_opt
true
else
@@ -1464,8 +1487,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"]
@@ -1726,23 +1749,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.")
@@ -1949,53 +1962,55 @@ 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"]
+ libs = ''
if tcl_cfg_dir
TclConfig_Info['TCL_LIBS'] ||= ""
($INCFLAGS ||= "") << ' ' << TclConfig_Info['TCL_INCLUDE_SPEC']
- $LDFLAGS << ' ' << TclConfig_Info['TCL_LIBS']
+ libs << ' ' << TclConfig_Info['TCL_LIBS']
if stubs
if TkLib_Config["tcl-build-dir"] &&
TclConfig_Info['TCL_BUILD_STUB_LIB_SPEC'] &&
!TclConfig_Info['TCL_BUILD_STUB_LIB_SPEC'].strip.empty?
- $LDFLAGS << ' ' << TclConfig_Info['TCL_BUILD_STUB_LIB_SPEC']
+ libs << ' ' << TclConfig_Info['TCL_BUILD_STUB_LIB_SPEC']
else
- $LDFLAGS << ' ' << TclConfig_Info['TCL_STUB_LIB_SPEC']
+ libs << ' ' << TclConfig_Info['TCL_STUB_LIB_SPEC']
end
else
if TkLib_Config["tcl-build-dir"] &&
TclConfig_Info['TCL_BUILD_LIB_SPEC'] &&
!TclConfig_Info['TCL_BUILD_LIB_SPEC'].strip.empty?
- $LDFLAGS << ' ' << TclConfig_Info['TCL_BUILD_LIB_SPEC']
+ libs << ' ' << TclConfig_Info['TCL_BUILD_LIB_SPEC']
else
- $LDFLAGS << ' ' << TclConfig_Info['TCL_LIB_SPEC']
+ libs << ' ' << TclConfig_Info['TCL_LIB_SPEC']
end
end
end
- $LDFLAGS << " -L#{TkLib_Config["tk-build-dir"].quote} -Wl,-R#{TkLib_Config["tk-build-dir"].quote}" if TkLib_Config["tk-build-dir"]
+ libs << " -L#{TkLib_Config["tk-build-dir"].quote} -Wl,-R#{TkLib_Config["tk-build-dir"].quote}" if TkLib_Config["tk-build-dir"]
if tk_cfg_dir
TkConfig_Info['TK_LIBS'] ||= ""
($INCFLAGS ||= "") << ' ' << TkConfig_Info['TK_INCLUDE_SPEC']
- $LDFLAGS << ' ' << TkConfig_Info['TK_LIBS']
+ libs << ' ' << TkConfig_Info['TK_LIBS']
if stubs
if TkLib_Config["tk-build-dir"] &&
TclConfig_Info['TK_BUILD_STUB_LIB_SPEC'] &&
!TclConfig_Info['TK_BUILD_STUB_LIB_SPEC'].strip.empty?
- $LDFLAGS << ' ' << TkConfig_Info['TK_BUILD_STUB_LIB_SPEC']
+ libs << ' ' << TkConfig_Info['TK_BUILD_STUB_LIB_SPEC']
else
- $LDFLAGS << ' ' << TkConfig_Info['TK_STUB_LIB_SPEC']
+ libs << ' ' << TkConfig_Info['TK_STUB_LIB_SPEC']
end
else
if TkLib_Config["tk-build-dir"] &&
TclConfig_Info['TK_BUILD_LIB_SPEC'] &&
!TclConfig_Info['TK_BUILD_LIB_SPEC'].strip.empty?
- $LDFLAGS << ' ' << TkConfig_Info['TK_BUILD_LIB_SPEC']
+ libs << ' ' << TkConfig_Info['TK_BUILD_LIB_SPEC']
else
- $LDFLAGS << ' ' << TkConfig_Info['TK_LIB_SPEC']
+ libs << ' ' << TkConfig_Info['TK_LIB_SPEC']
end
end
end
+ $LDFLAGS << ' ' << libs
setup_for_macosx_framework(tclver, tkver) if tcl_cfg_dir && tk_cfg_dir
end
@@ -2031,4 +2046,6 @@ if (TkLib_Config["tcltk-framework"] ||
puts "\nFind Tcl/Tk libraries. Make tcltklib.so which is required by Ruby/Tk."
else
puts "\nCan't find proper Tcl/Tk libraries. So, can't make tcltklib.so which is required by Ruby/Tk."
+ puts "If you have Tcl/Tk libraries on your environment, you may be able to use them with configure options (see ext/tk/README.tcltklib)."
+ puts "At present, Tcl/Tk8.6 is not supported. Although you can try to use Tcl/Tk8.6 with configure options, it will not work correctly. I recommend you to use Tcl/Tk8.5 or 8.4."
end
diff --git a/ext/tk/lib/multi-tk.rb b/ext/tk/lib/multi-tk.rb
index b125c6e18e..68bd849670 100644
--- a/ext/tk/lib/multi-tk.rb
+++ b/ext/tk/lib/multi-tk.rb
@@ -2103,7 +2103,7 @@ end
# evaluate a procedure on the proper interpreter
class MultiTkIp
# instance & class method
- def _proc_on_safelevel(cmd=nil, &blk) # require a block for eval
+ def _proc_on_safelevel(cmd=nil) # require a block for eval
if cmd
if cmd.kind_of?(Method)
_proc_on_safelevel{|*args| cmd.call(*args)}
diff --git a/ext/tk/lib/tcltk.rb b/ext/tk/lib/tcltk.rb
index 2df3b2fd8c..48ec1df09a 100644
--- a/ext/tk/lib/tcltk.rb
+++ b/ext/tk/lib/tcltk.rb
@@ -280,7 +280,7 @@ class TclTkWidget < TclTkCommand
# interp: interpreter(TclTkInterpreter)
# parent: parent widget
- # command: widget generating tk command(label Åù)
+ # command: widget generating tk command(label ç­‰)
# *args: argument to the command
interp, parent, command, *args = args
diff --git a/ext/tk/lib/tk/image.rb b/ext/tk/lib/tk/image.rb
index 00bb440d6a..972383982f 100644
--- a/ext/tk/lib/tk/image.rb
+++ b/ext/tk/lib/tk/image.rb
@@ -130,9 +130,9 @@ end
# A photo is an image whose pixels can display any color or be transparent.
# At present, only GIF and PPM/PGM formats are supported, but an interface
# 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" ]
@@ -162,13 +162,13 @@ class TkPhotoImage<TkImage
# image = TkPhotoImage.new(:file: => 'my_image.gif')
#
# == Options
- # Photos support the following options:
+ # Photos support the following options:
# * :data
# Specifies the contents of the image as a string.
# * :format
# Specifies the name of the file format for the data.
# * :file
- # Gives the name of a file that is to be read to supply data for the image.
+ # Gives the name of a file that is to be read to supply data for the image.
# * :gamma
# Specifies that the colors allocated for displaying this image in a window
# should be corrected for a non-linear display with the specified gamma
@@ -185,7 +185,7 @@ class TkPhotoImage<TkImage
# Specifies the width of the image, in pixels. This option is useful
# primarily in situations where the user wishes to build up the contents of
# the image piece by piece. A value of zero (the default) allows the image
- # to expand or shrink horizontally to fit the data stored in it.
+ # to expand or shrink horizontally to fit the data stored in it.
def initialize(*args)
@type = 'photo'
super(*args)
@@ -193,7 +193,7 @@ class TkPhotoImage<TkImage
# Blank the image; that is, set the entire image to have no data, so it will
# be displayed as transparent, and the background of whatever window it is
- # displayed in will show through.
+ # displayed in will show through.
def blank
tk_send_without_enc('blank')
self
@@ -233,7 +233,7 @@ class TkPhotoImage<TkImage
# destination, possibly with pixel zooming and/or subsampling. If no options
# are specified, this method copies the whole of source into destination,
# starting at coordinates (0,0) in destination. The following options may be
- # specified:
+ # specified:
#
# * :from [x1, y1, x2, y2]
# Specifies a rectangular sub-region of the source image to be copied.
@@ -250,30 +250,30 @@ class TkPhotoImage<TkImage
# specified). If x2 and y2 are specified, the source region will be
# replicated if necessary to fill the destination region in a tiled fashion.
# * :shrink
- # Specifies that the size of the destination image should be reduced, if
- # necessary, so that the region being copied into is at the bottom-right
- # corner of the image. This option will not affect the width or height of
+ # Specifies that the size of the destination image should be reduced, if
+ # necessary, so that the region being copied into is at the bottom-right
+ # corner of the image. This option will not affect the width or height of
# the image if the user has specified a non-zero value for the :width or
# :height configuration option, respectively.
# * :zoom [x, y]
- # Specifies that the source region should be magnified by a factor of x
+ # Specifies that the source region should be magnified by a factor of x
# in the X direction and y in the Y direction. If y is not given, the
# default value is the same as x. With this option, each pixel in the
# source image will be expanded into a block of x x y pixels in the
# destination image, all the same color. x and y must be greater than 0.
# * :subsample [x, y]
# Specifies that the source image should be reduced in size by using only
- # every xth pixel in the X direction and yth pixel in the Y direction.
- # Negative values will cause the image to be flipped about the Y or X axes,
+ # every xth pixel in the X direction and yth pixel in the Y direction.
+ # Negative values will cause the image to be flipped about the Y or X axes,
# respectively. If y is not given, the default value is the same as x.
# * :compositingrule rule
- # Specifies how transparent pixels in the source image are combined with
+ # Specifies how transparent pixels in the source image are combined with
# the destination image. When a compositing rule of <tt>overlay</tt> is set,
# the old contents of the destination image are visible, as if the source
# image were printed on a piece of transparent film and placed over the
# top of the destination. When a compositing rule of <tt>set</tt> is set,
# the old contents of the destination image are discarded and the source
- # image is used as-is. The default compositing rule is <tt>overlay</tt>.
+ # image is used as-is. The default compositing rule is <tt>overlay</tt>.
def copy(src, *opts)
if opts.size == 0
tk_send('copy', src)
@@ -314,14 +314,14 @@ class TkPhotoImage<TkImage
# whole image.
# * :grayscale
# If this options is specified, the data will not contain color information.
- # All pixel data will be transformed into grayscale.
+ # All pixel data will be transformed into grayscale.
def data(keys={})
tk_split_list(tk_send('data', *_photo_hash_kv(keys)))
end
- # Returns the color of the pixel at coordinates (x,y) in the image as a list
+ # Returns the color of the pixel at coordinates (x,y) in the image as a list
# of three integers between 0 and 255, representing the red, green and blue
- # components respectively.
+ # components respectively.
def get(x, y)
tk_send('get', x, y).split.collect{|n| n.to_i}
end
@@ -362,13 +362,13 @@ class TkPhotoImage<TkImage
self
end
- # Returns a boolean indicating if the pixel at (x,y) is transparent.
+ # Returns a boolean indicating if the pixel at (x,y) is transparent.
def get_transparency(x, y)
bool(tk_send('transparency', 'get', x, y))
end
-
+
# Makes the pixel at (x,y) transparent if <tt>state</tt> is true, and makes
- # that pixel opaque otherwise.
+ # that pixel opaque otherwise.
def set_transparency(x, y, state)
tk_send('transparency', 'set', x, y, state)
self
diff --git a/ext/tk/lib/tk/wm.rb b/ext/tk/lib/tk/wm.rb
index b1a2ed886a..fcd5a2cbd2 100644
--- a/ext/tk/lib/tk/wm.rb
+++ b/ext/tk/lib/tk/wm.rb
@@ -83,11 +83,11 @@ module Tk
def Wm.command(win, value=nil)
if value
- tk_call('wm', 'command', epath, value)
+ tk_call('wm', 'command', win.epath, value)
win
else
- #procedure(tk_call('wm', 'command', epath))
- tk_call('wm', 'command', epath)
+ #procedure(tk_call('wm', 'command', win.epath))
+ tk_call('wm', 'command', win.epath)
end
end
def wm_command(value=nil)
diff --git a/ext/tk/lib/tkextlib/SUPPORT_STATUS b/ext/tk/lib/tkextlib/SUPPORT_STATUS
index 522039b11a..865181a766 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>)).
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/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/old-README.tcltklib.eucj b/ext/tk/old-README.tcltklib.eucj
deleted file mode 100644
index 1683629fcb..0000000000
--- a/ext/tk/old-README.tcltklib.eucj
+++ /dev/null
@@ -1,159 +0,0 @@
-(tof)
- 2003/06/19 Hidetoshi NAGAI
-
-Ëܥɥ­¥å¥á¥ó¥È¤Ë¤Ï¸Å¤¤ tcltk ¥é¥¤¥Ö¥é¥ê¡¤tcltklib ¥é¥¤¥Ö¥é¥ê¤ÎÀâÌÀ
-¤¬´Þ¤Þ¤ì¤Æ¤¤¤Þ¤¹¤¬¡¤¤½¤Îµ­½ÒÆâÍÆ¤Ï¸Å¤¤¤â¤Î¤È¤Ê¤Ã¤Æ¤¤¤Þ¤¹¡¥
-
-¤Þ¤º¡¤¸½ºß¤Î Ruby/Tk ¤ÎÃæ¿´¤Ç¤¢¤ë tk.rb ¤Ï wish ¤ò¸Æ¤Ó½Ð¤·¤¿¤ê¤Ï¤»
-¤º¡¤tcltklib ¥é¥¤¥Ö¥é¥ê¤ò wrap ¤·¤ÆÆ°ºî¤¹¤ë¤â¤Î¤È¤Ê¤Ã¤Æ¤¤¤Þ¤¹¡¥¤½¤Î
-¤¿¤á¡¤¸Å¤¤ÀâÌÀµ­½Ò¤Ç½Ò¤Ù¤é¤ì¤Æ¤¤¤ë¤è¤¦¤Ê¥×¥í¥»¥¹´ÖÄÌ¿®¤Ë¤è¤ë¥ª¡¼¥Ð
-¥Ø¥Ã¥É¤Ï¸ºß¤·¤Þ¤»¤ó¡¥
-
-¸½ºß¤Î tcltklib ¥é¥¤¥Ö¥é¥ê¤Ç¤â¡¤Tcl/Tk ¤Î C ¥é¥¤¥Ö¥é¥ê¤ò¥ê¥ó¥¯¤·¤Æ
-ľÀÜ¤ËÆ°¤«¤¹¤³¤È¤Ç¡¤¥ª¡¼¥Ð¥Ø¥Ã¥É¤ò²¡¤µ¤¨¤Ä¤Ä Tcl/Tk ¥¤¥ó¥¿¡¼¥×¥ê¥¿
-¤Î¤Û¤ÜÁ´µ¡Ç½¡Ê³ÈÄ¥¥é¥¤¥Ö¥é¥ê¤ò´Þ¤à¡Ë¤ò»È¤¨¤ëÅÀ¤ÏƱ¤¸¤Ç¤¹¡¥¤·¤«¤·¡¤
-¤½¤ÎÌò³ä¤Ï¤Û¤Ü¡Ötk.rb °Ê²¼¤Î¥é¥¤¥Ö¥é¥ê¤ò¸ú²ÌŪ¤ËƯ¤«¤»¤ë¤¿¤á¤Î¤â¤Î¡×
-¤È¸«¤Ê¤µ¤ì¤Æ¤ª¤ê¡¤¤½¤ÎÌÜŪ¤Ç¥á¥ó¥Æ¥Ê¥ó¥¹¤µ¤ì¤Æ¤¤¤Þ¤¹¡¥
-
-tk.rb ¤Î¹âµ¡Ç½²½¤Ëȼ¤Ã¤Æ¡¤Ãæ¿å½à¤Î¥é¥¤¥Ö¥é¥ê¤Ç¤¢¤ë tcltk ¥é¥¤¥Ö¥é¥ê
-¡Êtcltk.rb¡Ë¤Ï¤½¤Î¸ºß°ÕµÁ¤ò¸º¤¸¤Æ¤ª¤ê¡¤¸½ºß¤Ç¤Ï¥á¥ó¥Æ¥Ê¥ó¥¹¤Ï¹Ô¤ï
-¤ì¤Æ¤¤¤Þ¤»¤ó¡¥
-
-¤Ê¤ª¡¤¸Å¤¤ÀâÌÀ¤Ç¤Ï¥Ð¥¤¥ó¥Ç¥£¥ó¥°¤Ë¤ª¤±¤ë¥¹¥¯¥ê¥×¥È¤ÎÄɲäϤǤ­¤Ê¤¤¤³
-¤È¤È¤Ê¤Ã¤Æ¤¤¤Þ¤¹¤¬¡¤¸½ºß¤Î tk.rb ¤Ç¤Ï¤³¤ì¤â²Äǽ¤Ç¤¢¤ë¤³¤È¤òÊä­¤·¤Æ
-¤ª¤­¤Þ¤¹¡¥
-
-°Ê²¼¤¬¥é¥¤¥Ö¥é¥ê¤Î¸Å¤¤ÀâÌÀʸ½ñ¤Ç¤¹¡¥
-==============================================================
- tcltk ¥é¥¤¥Ö¥é¥ê
- tcltklib ¥é¥¤¥Ö¥é¥ê
- Sep. 19, 1997 Y. Shigehiro
-
-°Ê²¼, ¡Ötcl/tk¡×¤È¤¤¤¦É½µ­¤Ï, tclsh ¤ä wish ¤ò¼Â¸½¤·¤Æ¤¤¤ë, °ìÈ̤Ǥ¤¤¦
-¤È¤³¤í¤Î tcl/tk ¤ò»Ø¤·¤Þ¤¹. ¡Ötcltk ¥é¥¤¥Ö¥é¥ê¡×, ¡Ötcltklib ¥é¥¤¥Ö¥é
-¥ê¡×¤È¤¤¤¦É½µ­¤Ï, Ëܥѥ屡¼¥¸¤Ë´Þ¤Þ¤ì¤ë ruby ÍѤΥ饤¥Ö¥é¥ê¤ò»Ø¤·¤Þ¤¹.
-
-[¥Õ¥¡¥¤¥ë¤Ë¤Ä¤¤¤Æ]
-
-README.euc : ¤³¤Î¥Õ¥¡¥¤¥ë(Ãí°Õ, ÆÃħ, ¥¤¥ó¥¹¥È¡¼¥ë¤ÎÊýË¡).
-MANUAL.euc : ¥Þ¥Ë¥å¥¢¥ë.
-
-lib/, ext/ : ¥é¥¤¥Ö¥é¥ê¤Î¼ÂÂÎ.
-
-sample/ : ¥Þ¥Ë¥å¥¢¥ëÂå¤ï¤ê¤Î¥µ¥ó¥×¥ë¥×¥í¥°¥é¥à.
-sample/sample0.rb : tcltklib ¥é¥¤¥Ö¥é¥ê¤Î¥Æ¥¹¥È.
-sample/sample1.rb : tcltk ¥é¥¤¥Ö¥é¥ê¤Î¥Æ¥¹¥È.
- tcl/tk (wish) ¤Ç¤Ç¤­¤½¤¦¤Ê¤³¤È¤ò°ìÄ̤ê½ñ¤¤¤Æ¤ß¤Þ¤·¤¿.
-sample/sample2.rb : tcltk ¥é¥¤¥Ö¥é¥ê¤Î¥µ¥ó¥×¥ë.
- maeda shugo (shugo@po.aianet.ne.jp) »á¤Ë¤è¤ë
- (`rb.tk' ¤Ç½ñ¤«¤ì¤Æ¤¤¤¿) ruby ¤Î¥µ¥ó¥×¥ë¥×¥í¥°¥é¥à
- http://www.aianet.or.jp/~shugo/ruby/othello.rb.gz
- ¤ò tcltk ¥é¥¤¥Ö¥é¥ê¤ò»È¤¦¤è¤¦¤Ë, µ¡³£Åª¤ËÊѹ¹¤·¤Æ¤ß¤Þ¤·¤¿.
-
-demo/ : 100 ËܤÎÀþ¤ò 100 ²óÉÁ¤¯¥Ç¥â¥×¥í¥°¥é¥à.
- ºÇ½é¤Ë¶õ¥ë¡¼¥×¤Î»þ´Ö¤ò¬Äꤷ, ³¤¤¤Æ¼ÂºÝ¤ËÀþ¤ò°ú¤¯»þ´Ö¤ò¬Äꤷ¤Þ¤¹.
- tcl/tk ¤Ï(ºÆ)ÉÁ²è¤Î¤È¤­¤Ë backing store ¤ò»È¤ï¤º¤ËΧµÁ¤Ë 10000 ËÜ(?)
- Àþ¤ò°ú¤¯¤Î¤Ç, (ºÆ)ÉÁ²è¤ò»Ï¤á¤ë¤È, ¥Þ¥·¥ó¤¬¤«¤Ê¤ê½Å¤¯¤Ê¤ê¤Þ¤¹.
-demo/lines0.tcl : wish ÍѤΥ¹¥¯¥ê¥×¥È.
-demo/lines1.rb : `tk.rb' ÍѤΥ¹¥¯¥ê¥×¥È.
-demo/lines2.rb : tcltk ¥é¥¤¥Ö¥é¥êÍѤΥ¹¥¯¥ê¥×¥È.
-
-[Ãí°Õ]
-
-¥³¥ó¥Ñ¥¤¥ë/¼Â¹Ô¤Ë¤Ï, tcl/tk ¤Î C ¥é¥¤¥Ö¥é¥ê¤¬É¬ÍפǤ¹.
-
-¤³¤Î¥é¥¤¥Ö¥é¥ê¤Ï,
-
- ruby-1.0-970701, ruby-1.0-970911, ruby-1.0-970919
- FreeBSD 2.2.2-RELEASE
- ¤ª¤è¤Ó¤½¤Î¥Ñ¥Ã¥±¡¼¥¸ jp-tcl-7.6.tgz, jp-tk-4.2.tgz
-
-¤ÇºîÀ®/ưºî³Îǧ¤·¤Þ¤·¤¿. ¾¤Î´Ä¶­¤Ç¤Ïưºî¤¹¤ë¤«¤É¤¦¤«¤ï¤«¤ê¤Þ¤»¤ó.
-
-TclTkLib.mainloop ¤ò¼Â¹ÔÃæ¤Ë Control-C ¤¬¸ú¤«¤Ê¤¤¤Î¤ÏÉÔÊØ¤Ê¤Î¤Ç, ruby
-¤Î¥½¡¼¥¹¤ò»²¹Í¤Ë, #include "sig.h" ¤·¤Æ trap_immediate ¤òÁàºî¤·¤Æ¤¤¤Þ
-¤¹¤¬, ruby ¤Î README.EXT ¤Ë¤â½ñ¤¤¤Æ¤Ê¤¤¤Î¤Ë, ¤³¤ó¤Ê¤³¤È¤ò¤·¤ÆÎɤ¤¤Î¤«
-¤É¤¦¤«¤ï¤«¤ê¤Þ¤»¤ó.
-
--d ¥ª¥×¥·¥ç¥ó¤Ç¥Ç¥Ð¥Ã¥°¾ðÊó¤òɽ¼¨¤µ¤»¤ë¤¿¤á¤Ë, ruby ¤Î¥½¡¼¥¹¤ò»²¹Í¤Ë,
-debug ¤È¤¤¤¦Âç°èÊÑ¿ô¤ò»²¾È¤·¤Æ¤¤¤Þ¤¹¤¬, ruby ¤Î README.EXT ¤Ë¤â½ñ¤¤¤Æ
-¤Ê¤¤¤Î¤Ë, ¤³¤ó¤Ê¤³¤È¤ò¤·¤ÆÎɤ¤¤Î¤«¤É¤¦¤«¤ï¤«¤ê¤Þ¤»¤ó.
-
-extconf.rb ¤Ï½ñ¤­¤Þ¤·¤¿¤¬, (¤¤¤í¤¤¤í¤Ê°ÕÌ£¤Ç)¤³¤ì¤ÇÎɤ¤¤Î¤«Îɤ¯Ê¬¤«¤ê
-¤Þ¤»¤ó.
-
-[ÆÃħ]
-
-ruby ¤«¤é tcl/tk ¥é¥¤¥Ö¥é¥ê¤òÍøÍѤǤ­¤Þ¤¹.
-
-tcl/tk ¥¤¥ó¥¿¥×¥ê¥¿¤Î¥¹¥¯¥ê¥×¥È¤Ï, µ¡³£Åª¤Ë tcltk ¥é¥¤¥Ö¥é¥êÍѤΠruby
-¥¹¥¯¥ê¥×¥È¤ËÊÑ´¹¤Ç¤­¤Þ¤¹.
-
-(`tk.rb' ¤È¤Î°ã¤¤)
-
-1. tcl/tk ¥¤¥ó¥¿¥×¥ê¥¿¤Î¥¹¥¯¥ê¥×¥È¤¬, ¤É¤Î¤è¤¦¤Ë, tcltk ¥é¥¤¥Ö¥é¥êÍѤÎ
- ruby ¥¹¥¯¥ê¥×¥È¤ËÊÑ´¹¤µ¤ì¤ë¤«¤¬Íý²ò¤Ç¤­¤ì¤Ð, ¥Þ¥Ë¥å¥¢¥ëÎब̵¤¤¤ËÅù
- ¤·¤¤ `tk.rb' ¤È¤Ï°Û¤Ê¤ê
-
- tcl/tk ¤Î¥Þ¥Ë¥å¥¢¥ë¤ä¥ª¥ó¥é¥¤¥ó¥É¥­¥å¥á¥ó¥È¤òÍѤ¤¤Æ
-
- ¸úΨÎɤ¯¥×¥í¥°¥é¥ß¥ó¥°¤ò¹Ô¤¦¤³¤È¤¬¤Ç¤­¤Þ¤¹.
- µ­½ÒÊýË¡¤¬¤ï¤«¤é¤Ê¤¤, ¥³¥Þ¥ó¥É¤ËÍ¿¤¨¤ë¥Ñ¥é¥á¡¼¥¿¤¬¤ï¤«¤é¤Ê¤¤...
- - Canvas.new { ... } ¤È, ¤Ê¤¼¥¤¥Æ¥ì¡¼¥¿¥Ö¥í¥Ã¥¯¤ò½ñ¤±¤ë¤Î??
- - Canvas ¤Î bbox ¤Ï¿ôÃͤΥꥹ¥È¤òÊÖ¤¹¤Î¤Ë, xview ¤Ïʸ»úÎó¤òÊÖ¤¹¤Î??
- ¤È, ¤¤¤Á¤¤¤Á, ¥é¥¤¥Ö¥é¥ê¤Î¥½¡¼¥¹¤òÄɤ¤¤«¤±¤ëɬÍפϤ¢¤ê¤Þ¤»¤ó.
-
-2. ¸Ä¡¹¤Îµ¡Ç½(¥ª¥×¥·¥ç¥ó)¤ò¸ÄÊ̽èÍý¤Ë¤è¤ê¥µ¥Ý¡¼¥È¤·¤Æ¤ª¤ê, ¤½¤Î¤¿¤á¥µ
- ¥Ý¡¼¥È¤·¤Æ¤¤¤Ê¤¤µ¡Ç½¤Ï»È¤¦¤³¤È¤¬¤Ç¤­¤Ê¤¤(ËÜÅö¤Ï»È¤¨¤Ê¤¤¤³¤È¤â¤Ê¤¤¤Î
- ¤Ç¤¹¤¬) `tk.rb' ¤È¤Ï°Û¤Ê¤ê, tcl/tk ¥¤¥ó¥¿¥×¥ê¥¿¤Ç²Äǽ¤Ê¤³¤È¤Ï
-
- ¤Û¤È¤ó¤É
-
- ruby ¤«¤é¤â¼Â¹Ô¤Ç¤­¤Þ¤¹. ¸½ºß, ruby ¤«¤é¼Â¹Ô¤Ç¤­¤Ê¤¤¤³¤È¤¬³Îǧ¤µ¤ì
- ¤Æ¤¤¤ë¤Î¤Ï,
-
- bind ¥³¥Þ¥ó¥É¤Ç¥¹¥¯¥ê¥×¥È¤òÄɲ乤빽ʸ
- ¡Öbind tag sequence +script¡×
- ^
-
- ¤Î¤ß¤Ç¤¹.
- - `. configure -width' ¤ò¤·¤è¤¦¤È¤·¤Æ, `Tk.root.height()' ¤È½ñ¤¤
- ¤¿¤Î¤Ë, `undefined method `height'' ¤ÈÅܤé¤ì¤Æ¤·¤Þ¤Ã¤¿. tk.rb ¤ò
- ÆÉ¤ó¤Ç¤ß¤Æ, ¥¬¡¼¥ó. ¤Ç¤­¤Ê¤¤¤Î¤«...
- ¤È¤¤¤¦¤³¤È¤Ï¤¢¤ê¤Þ¤»¤ó.
-
-3. wish ¥×¥í¥»¥¹¤òµ¯Æ°¤·¥×¥í¥»¥¹´ÖÄÌ¿®¤Ç wish ¤òÍøÍѤ¹¤ë `tk.rb' ¤È¤Ï
- °Û¤Ê¤ê, tcl/tk ¤Î C ¥é¥¤¥Ö¥é¥ê¤ò¥ê¥ó¥¯¤·
-
- ¤è¤ê¹â®¤Ë (¤È¤¤¤Ã¤Æ¤â, »×¤Ã¤¿Äø¤Ï®¤¯¤Ê¤¤¤Ç¤¹¤¬)
-
- ½èÍý¤ò¹Ô¤¤¤Þ¤¹.
-
-4. `tk.rb' ¤Û¤É, ¹â¿å½à¤Ê¥¤¥ó¥¿¡¼¥Õ¥§¡¼¥¹¤òÈ÷¤¨¤Æ¤¤¤Ê¤¤¤¿¤á, tcl/tk ¥¤
- ¥ó¥¿¥×¥ê¥¿¤ÎÀ¸À®Åù
-
- ²¿¤«¤é²¿¤Þ¤Ç¼«Ê¬¤Çµ­½Ò
-
- ¤·¤Ê¤±¤ì¤Ð¤Ê¤ê¤Þ¤»¤ó(¤½¤ÎÂå¤ï¤ê, tcl/tk ¥é¥¤¥Ö¥é¥ê¤Î»ÅÍÍÄ̤ê,
- tcl/tk ¥¤¥ó¥¿¥×¥ê¥¿¤òÊ£¿ôÀ¸À®¤¹¤ë¤³¤È¤â¤Ç¤­¤Þ¤¹¤¬).
- ¥¤¥ó¥¿¡¼¥Õ¥§¡¼¥¹¤Ï(¤ª¤½¤é¤¯) ruby ¤Î»×Áۤ˱è¤Ã¤¿¤â¤Î¤Ç¤Ï¤¢¤ê¤Þ¤»¤ó.
- ¤Þ¤¿, ¥¹¥¯¥ê¥×¥È¤Îµ­½Ò¤Ï
-
- ¥À¥µ¥À¥µ
-
- ¤Ç¤¹. ¥¹¥¯¥ê¥×¥È¤Ï, °ì¸«, ÆÉ¤ß¤Å¤é¤¤¤â¤Î¤È¤Ê¤ê¤Þ¤¹. ¤¬, ½ñ¤¯¿Í¤Ë¤È¤Ã
- ¤Æ¤Ï, ¤½¤ì¤Û¤ÉÈѤ路¤¤¤â¤Î¤Ç¤Ï¤Ê¤¤¤È»×¤¤¤Þ¤¹.
-
-[¥¤¥ó¥¹¥È¡¼¥ë¤ÎÊýË¡]
-
-0. ruby ¤Î¥½¡¼¥¹¥Õ¥¡¥¤¥ë(ruby-1.0-¤Ê¤ó¤¿¤é.tgz)¤òŸ³«¤·¤Æ¤ª¤­¤Þ¤¹.
-
-1. ruby-1.0-¤Ê¤ó¤¿¤é/ext ¤Ë ext/tcltklib ¤ò¥³¥Ô¡¼¤·¤Þ¤¹.
- cp -r ext/tcltklib ???/ruby-1.0-¤Ê¤ó¤¿¤é/ext/
-
-2. ruby ¤Î¥¤¥ó¥¹¥È¡¼¥ëË¡¤Ë½¾¤¤ make Åù¤ò¤·¤Þ¤¹.
-
-3. ruby ¤Î¥é¥¤¥Ö¥é¥êÃÖ¾ì¤Ë lib/* ¤ò¥³¥Ô¡¼¤·¤Þ¤¹.
- cp lib/* /usr/local/lib/ruby/
-
-(eof)
diff --git a/ext/tk/old-README.tcltklib.ja b/ext/tk/old-README.tcltklib.ja
new file mode 100644
index 0000000000..e29b389402
--- /dev/null
+++ b/ext/tk/old-README.tcltklib.ja
@@ -0,0 +1,159 @@
+(tof)
+ 2003/06/19 Hidetoshi NAGAI
+
+本ドキュメントã«ã¯å¤ã„ tcltk ライブラリ,tcltklib ライブラリã®èª¬æ˜Ž
+ãŒå«ã¾ã‚Œã¦ã„ã¾ã™ãŒï¼Œãã®è¨˜è¿°å†…容ã¯å¤ã„ã‚‚ã®ã¨ãªã£ã¦ã„ã¾ã™ï¼Ž
+
+ã¾ãšï¼Œç¾åœ¨ã® Ruby/Tk ã®ä¸­å¿ƒã§ã‚ã‚‹ tk.rb 㯠wish を呼ã³å‡ºã—ãŸã‚Šã¯ã›
+ãšï¼Œtcltklib ライブラリを wrap ã—ã¦å‹•作ã™ã‚‹ã‚‚ã®ã¨ãªã£ã¦ã„ã¾ã™ï¼Žãã®
+ãŸã‚,å¤ã„説明記述ã§è¿°ã¹ã‚‰ã‚Œã¦ã„るよã†ãªãƒ—ロセス間通信ã«ã‚ˆã‚‹ã‚ªãƒ¼ãƒ
+ヘッドã¯å­˜åœ¨ã—ã¾ã›ã‚“.
+
+ç¾åœ¨ã® tcltklib ライブラリã§ã‚‚,Tcl/Tk ã® C ライブラリをリンクã—ã¦
+直接ã«å‹•ã‹ã™ã“ã¨ã§ï¼Œã‚ªãƒ¼ãƒãƒ˜ãƒƒãƒ‰ã‚’押ã•ãˆã¤ã¤ Tcl/Tk インタープリタ
+ã®ã»ã¼å…¨æ©Ÿèƒ½ï¼ˆæ‹¡å¼µãƒ©ã‚¤ãƒ–ラリをå«ã‚€ï¼‰ã‚’使ãˆã‚‹ç‚¹ã¯åŒã˜ã§ã™ï¼Žã—ã‹ã—,
+ãã®å½¹å‰²ã¯ã»ã¼ã€Œtk.rb 以下ã®ãƒ©ã‚¤ãƒ–ラリを効果的ã«åƒã‹ã›ã‚‹ãŸã‚ã®ã‚‚ã®ã€
+ã¨è¦‹ãªã•れã¦ãŠã‚Šï¼Œãã®ç›®çš„ã§ãƒ¡ãƒ³ãƒ†ãƒŠãƒ³ã‚¹ã•れã¦ã„ã¾ã™ï¼Ž
+
+tk.rb ã®é«˜æ©Ÿèƒ½åŒ–ã«ä¼´ã£ã¦ï¼Œä¸­æ°´æº–ã®ãƒ©ã‚¤ãƒ–ラリã§ã‚ã‚‹ tcltk ライブラリ
+(tcltk.rb)ã¯ãã®å­˜åœ¨æ„義を減ã˜ã¦ãŠã‚Šï¼Œç¾åœ¨ã§ã¯ãƒ¡ãƒ³ãƒ†ãƒŠãƒ³ã‚¹ã¯è¡Œã‚
+れã¦ã„ã¾ã›ã‚“.
+
+ãªãŠï¼Œå¤ã„説明ã§ã¯ãƒã‚¤ãƒ³ãƒ‡ã‚£ãƒ³ã‚°ã«ãŠã‘るスクリプトã®è¿½åŠ ã¯ã§ããªã„ã“
+ã¨ã¨ãªã£ã¦ã„ã¾ã™ãŒï¼Œç¾åœ¨ã® tk.rb ã§ã¯ã“れもå¯èƒ½ã§ã‚ã‚‹ã“ã¨ã‚’補足ã—ã¦
+ãŠãã¾ã™ï¼Ž
+
+以下ãŒãƒ©ã‚¤ãƒ–ラリã®å¤ã„説明文書ã§ã™ï¼Ž
+==============================================================
+ tcltk ライブラリ
+ tcltklib ライブラリ
+ Sep. 19, 1997 Y. Shigehiro
+
+以下, 「tcl/tkã€ã¨ã„ã†è¡¨è¨˜ã¯, tclsh ã‚„ wish を実ç¾ã—ã¦ã„ã‚‹, 一般ã§ã„ã†
+ã¨ã“ã‚ã® tcl/tk を指ã—ã¾ã™. 「tcltk ライブラリã€, 「tcltklib ライブラ
+リã€ã¨ã„ã†è¡¨è¨˜ã¯, 本パッケージã«å«ã¾ã‚Œã‚‹ ruby 用ã®ãƒ©ã‚¤ãƒ–ラリを指ã—ã¾ã™.
+
+[ファイルã«ã¤ã„ã¦]
+
+README.euc : ã“ã®ãƒ•ァイル(注æ„, 特徴, ã‚¤ãƒ³ã‚¹ãƒˆãƒ¼ãƒ«ã®æ–¹æ³•).
+MANUAL.euc : マニュアル.
+
+lib/, ext/ : ライブラリã®å®Ÿä½“.
+
+sample/ : マニュアル代ã‚りã®ã‚µãƒ³ãƒ—ルプログラム.
+sample/sample0.rb : tcltklib ライブラリã®ãƒ†ã‚¹ãƒˆ.
+sample/sample1.rb : tcltk ライブラリã®ãƒ†ã‚¹ãƒˆ.
+ tcl/tk (wish) ã§ã§ããã†ãªã“ã¨ã‚’一通り書ã„ã¦ã¿ã¾ã—ãŸ.
+sample/sample2.rb : tcltk ライブラリã®ã‚µãƒ³ãƒ—ル.
+ maeda shugo (shugo@po.aianet.ne.jp) æ°ã«ã‚ˆã‚‹
+ (`rb.tk' ã§æ›¸ã‹ã‚Œã¦ã„ãŸ) ruby ã®ã‚µãƒ³ãƒ—ルプログラム
+ http://www.aianet.or.jp/~shugo/ruby/othello.rb.gz
+ ã‚’ tcltk ライブラリを使ã†ã‚ˆã†ã«, 機械的ã«å¤‰æ›´ã—ã¦ã¿ã¾ã—ãŸ.
+
+demo/ : 100 本ã®ç·šã‚’ 100 回æãデモプログラム.
+ 最åˆã«ç©ºãƒ«ãƒ¼ãƒ—ã®æ™‚間を測定ã—, ç¶šã„ã¦å®Ÿéš›ã«ç·šã‚’å¼•ãæ™‚間を測定ã—ã¾ã™.
+ tcl/tk ã¯(å†)æç”»ã®ã¨ãã« backing store を使ã‚ãšã«å¾‹ç¾©ã« 10000 本(?)
+ 線を引ãã®ã§, (å†)æç”»ã‚’å§‹ã‚ã‚‹ã¨, マシンãŒã‹ãªã‚Šé‡ããªã‚Šã¾ã™.
+demo/lines0.tcl : wish 用ã®ã‚¹ã‚¯ãƒªãƒ—ト.
+demo/lines1.rb : `tk.rb' 用ã®ã‚¹ã‚¯ãƒªãƒ—ト.
+demo/lines2.rb : tcltk ライブラリ用ã®ã‚¹ã‚¯ãƒªãƒ—ト.
+
+[注æ„]
+
+コンパイル/実行ã«ã¯, tcl/tk ã® C ライブラリãŒå¿…è¦ã§ã™.
+
+ã“ã®ãƒ©ã‚¤ãƒ–ラリã¯,
+
+ ruby-1.0-970701, ruby-1.0-970911, ruby-1.0-970919
+ FreeBSD 2.2.2-RELEASE
+ ãŠã‚ˆã³ãã®ãƒ‘ッケージ jp-tcl-7.6.tgz, jp-tk-4.2.tgz
+
+ã§ä½œæˆ/動作確èªã—ã¾ã—ãŸ. ä»–ã®ç’°å¢ƒã§ã¯å‹•作ã™ã‚‹ã‹ã©ã†ã‹ã‚ã‹ã‚Šã¾ã›ã‚“.
+
+TclTkLib.mainloop を実行中㫠Control-C ãŒåйã‹ãªã„ã®ã¯ä¸ä¾¿ãªã®ã§, ruby
+ã®ã‚½ãƒ¼ã‚¹ã‚’å‚考ã«, #include "sig.h" ã—㦠trap_immediate ã‚’æ“作ã—ã¦ã„ã¾
+ã™ãŒ, ruby ã® README.EXT ã«ã‚‚書ã„ã¦ãªã„ã®ã«, ã“ã‚“ãªã“ã¨ã‚’ã—ã¦è‰¯ã„ã®ã‹
+ã©ã†ã‹ã‚ã‹ã‚Šã¾ã›ã‚“.
+
+-d オプションã§ãƒ‡ãƒãƒƒã‚°æƒ…報を表示ã•ã›ã‚‹ãŸã‚ã«, ruby ã®ã‚½ãƒ¼ã‚¹ã‚’å‚考ã«,
+debug ã¨ã„ã†å¤§åŸŸå¤‰æ•°ã‚’å‚ç…§ã—ã¦ã„ã¾ã™ãŒ, ruby ã® README.EXT ã«ã‚‚書ã„ã¦
+ãªã„ã®ã«, ã“ã‚“ãªã“ã¨ã‚’ã—ã¦è‰¯ã„ã®ã‹ã©ã†ã‹ã‚ã‹ã‚Šã¾ã›ã‚“.
+
+extconf.rb ã¯æ›¸ãã¾ã—ãŸãŒ, (ã„ã‚ã„ã‚ãªæ„味ã§)ã“れã§è‰¯ã„ã®ã‹è‰¯ã分ã‹ã‚Š
+ã¾ã›ã‚“.
+
+[特徴]
+
+ruby ã‹ã‚‰ tcl/tk ライブラリを利用ã§ãã¾ã™.
+
+tcl/tk インタプリタã®ã‚¹ã‚¯ãƒªãƒ—トã¯, 機械的㫠tcltk ライブラリ用㮠ruby
+スクリプトã«å¤‰æ›ã§ãã¾ã™.
+
+(`tk.rb' ã¨ã®é•ã„)
+
+1. tcl/tk インタプリタã®ã‚¹ã‚¯ãƒªãƒ—トãŒ, ã©ã®ã‚ˆã†ã«, tcltk ライブラリ用ã®
+ ruby スクリプトã«å¤‰æ›ã•れるã‹ãŒç†è§£ã§ãれã°, マニュアル類ãŒç„¡ã„ã«ç­‰
+ ã—ã„ `tk.rb' ã¨ã¯ç•°ãªã‚Š
+
+ tcl/tk ã®ãƒžãƒ‹ãƒ¥ã‚¢ãƒ«ã‚„オンラインドキュメントを用ã„ã¦
+
+ 効率良ãプログラミングを行ã†ã“ã¨ãŒã§ãã¾ã™.
+ 記述方法ãŒã‚ã‹ã‚‰ãªã„, コマンドã«ä¸Žãˆã‚‹ãƒ‘ラメータãŒã‚ã‹ã‚‰ãªã„...
+ - Canvas.new { ... } ã¨, ãªãœã‚¤ãƒ†ãƒ¬ãƒ¼ã‚¿ãƒ–ロックを書ã‘ã‚‹ã®??
+ - Canvas ã® bbox ã¯æ•°å€¤ã®ãƒªã‚¹ãƒˆã‚’è¿”ã™ã®ã«, xview ã¯æ–‡å­—列を返ã™ã®??
+ ã¨, ã„ã¡ã„ã¡, ライブラリã®ã‚½ãƒ¼ã‚¹ã‚’追ã„ã‹ã‘ã‚‹å¿…è¦ã¯ã‚りã¾ã›ã‚“.
+
+2. å€‹ã€…ã®æ©Ÿèƒ½(オプション)を個別処ç†ã«ã‚ˆã‚Šã‚µãƒãƒ¼ãƒˆã—ã¦ãŠã‚Š, ãã®ãŸã‚サ
+ ãƒãƒ¼ãƒˆã—ã¦ã„ãªã„機能ã¯ä½¿ã†ã“ã¨ãŒã§ããªã„(本当ã¯ä½¿ãˆãªã„ã“ã¨ã‚‚ãªã„ã®
+ ã§ã™ãŒ) `tk.rb' ã¨ã¯ç•°ãªã‚Š, tcl/tk インタプリタã§å¯èƒ½ãªã“ã¨ã¯
+
+ ã»ã¨ã‚“ã©
+
+ ruby ã‹ã‚‰ã‚‚実行ã§ãã¾ã™. ç¾åœ¨, ruby ã‹ã‚‰å®Ÿè¡Œã§ããªã„ã“ã¨ãŒç¢ºèªã•れ
+ ã¦ã„ã‚‹ã®ã¯,
+
+ bind コマンドã§ã‚¹ã‚¯ãƒªãƒ—トを追加ã™ã‚‹æ§‹æ–‡
+ 「bind tag sequence +scriptã€
+ ^
+
+ ã®ã¿ã§ã™.
+ - `. configure -width' ã‚’ã—よã†ã¨ã—ã¦, `Tk.root.height()' ã¨æ›¸ã„
+ ãŸã®ã«, `undefined method `height'' ã¨æ€’られã¦ã—ã¾ã£ãŸ. tk.rb ã‚’
+ 読んã§ã¿ã¦, ガーン. ã§ããªã„ã®ã‹...
+ ã¨ã„ã†ã“ã¨ã¯ã‚りã¾ã›ã‚“.
+
+3. wish プロセスを起動ã—プロセス間通信㧠wish を利用ã™ã‚‹ `tk.rb' ã¨ã¯
+ ç•°ãªã‚Š, tcl/tk ã® C ライブラリをリンクã—
+
+ より高速㫠(ã¨ã„ã£ã¦ã‚‚, æ€ã£ãŸç¨‹ã¯é€Ÿããªã„ã§ã™ãŒ)
+
+ 処ç†ã‚’行ã„ã¾ã™.
+
+4. `tk.rb' ã»ã©, 高水準ãªã‚¤ãƒ³ã‚¿ãƒ¼ãƒ•ェースを備ãˆã¦ã„ãªã„ãŸã‚, tcl/tk イ
+ ンタプリタã®ç”Ÿæˆç­‰
+
+ 何ã‹ã‚‰ä½•ã¾ã§è‡ªåˆ†ã§è¨˜è¿°
+
+ ã—ãªã‘れã°ãªã‚Šã¾ã›ã‚“(ãã®ä»£ã‚り, tcl/tk ライブラリã®ä»•様通り,
+ tcl/tk インタプリタを複数生æˆã™ã‚‹ã“ã¨ã‚‚ã§ãã¾ã™ãŒ).
+ インターフェースã¯(ãŠãらã) ruby ã®æ€æƒ³ã«æ²¿ã£ãŸã‚‚ã®ã§ã¯ã‚りã¾ã›ã‚“.
+ ã¾ãŸ, スクリプトã®è¨˜è¿°ã¯
+
+ ダサダサ
+
+ ã§ã™. スクリプトã¯, 一見, 読ã¿ã¥ã‚‰ã„ã‚‚ã®ã¨ãªã‚Šã¾ã™. ãŒ, 書ã人ã«ã¨ã£
+ ã¦ã¯, ãれã»ã©ç…©ã‚ã—ã„ã‚‚ã®ã§ã¯ãªã„ã¨æ€ã„ã¾ã™.
+
+[ã‚¤ãƒ³ã‚¹ãƒˆãƒ¼ãƒ«ã®æ–¹æ³•]
+
+0. ruby ã®ã‚½ãƒ¼ã‚¹ãƒ•ァイル(ruby-1.0-ãªã‚“ãŸã‚‰.tgz)を展開ã—ã¦ãŠãã¾ã™.
+
+1. ruby-1.0-ãªã‚“ãŸã‚‰/ext ã« ext/tcltklib をコピーã—ã¾ã™.
+ cp -r ext/tcltklib ???/ruby-1.0-ãªã‚“ãŸã‚‰/ext/
+
+2. ruby ã®ã‚¤ãƒ³ã‚¹ãƒˆãƒ¼ãƒ«æ³•ã«å¾“ã„ make 等をã—ã¾ã™.
+
+3. ruby ã®ãƒ©ã‚¤ãƒ–ラリ置場㫠lib/* をコピーã—ã¾ã™.
+ cp lib/* /usr/local/lib/ruby/
+
+(eof)
diff --git a/ext/tk/sample/demos-en/README b/ext/tk/sample/demos-en/README
index a6ea4fae8c..033dca33c6 100644
--- a/ext/tk/sample/demos-en/README
+++ b/ext/tk/sample/demos-en/README
@@ -68,71 +68,71 @@ Notes:
Ruby/Tk81 widget-demo 1999/08/13
- ËÌΦÀèüÂç¾ðÊó²Ê³Ø¸¦µæ²Ê
- ΩÀÐ <ttate@jaist.ac.jp>
+ 北陸先端大情報科学研究科
+ 立石 <ttate@jaist.ac.jp>
-Tcl/Tk8.1¤Ç¤Ïunicode(UTF8)¤¬ºÎÍѤµ¤ì¡¢unicode¤ËÊÑ´¹¤µ¤ì¤¿ÆüËܸì¤Ç¤¢¤ì¤Ð
-Widget¤Ëɽ¼¨¤µ¤»¤ë¤³¤È¤¬²Äǽ¤Ç¤¹¡£ËÜ¥¢¡¼¥«¥¤¥Ö¤Ë¤Ï°ÊÁ°¤Ë±Ê°æ¤µ¤ó¤¬Ãæ¿´¤È
-¤Ê¤é¤ì¤ÆºîÀ®¤µ¤ì¤¿Ruby/Tk¤Î¥µ¥ó¥×¥ë¤Ë½¤Àµ¤ò²Ã¤¨¡¢°Ê²¼¤Î´Ä¶­¤Ë¤ª¤¤¤Æ¤Çưºî
-¤ò³Îǧ¤·¤¿¤â¤Î¤Ç¤¹¡£
+Tcl/Tk8.1ã§ã¯unicode(UTF8)ãŒæŽ¡ç”¨ã•れã€unicodeã«å¤‰æ›ã•ã‚ŒãŸæ—¥æœ¬èªžã§ã‚れã°
+Widgetã«è¡¨ç¤ºã•ã›ã‚‹ã“ã¨ãŒå¯èƒ½ã§ã™ã€‚本アーカイブã«ã¯ä»¥å‰ã«æ°¸äº•ã•ã‚“ãŒä¸­å¿ƒã¨
+ãªã‚‰ã‚Œã¦ä½œæˆã•れãŸRuby/Tkã®ã‚µãƒ³ãƒ—ルã«ä¿®æ­£ã‚’加ãˆã€ä»¥ä¸‹ã®ç’°å¢ƒã«ãŠã„ã¦ã§å‹•作
+を確èªã—ãŸã‚‚ã®ã§ã™ã€‚
* ruby-1.3.7,ruby-1.4.0
* tcl8.1, tk8.1
* linux-2.2
-Windows(Cygwin)¤Ë¤ª¤¤¤Æ¡¢¥µ¥ó¥×¥ë¤òư¤«¤¹¤Ë¤Ïruby¤ò-Ke¤È¤¤¤¦¥ª¥×¥·¥ç¥ó¤òÉÕ
-¤±¤Æµ¯Æ°¤µ¤»¤ë¤ÈÎɤ¤¤½¤¦¤Ç¤¹¡£
- ¾ðÊóÄó¶¡¡§ÅÏÊÕ¤µ¤ó
+Windows(Cygwin)ã«ãŠã„ã¦ã€ã‚µãƒ³ãƒ—ルを動ã‹ã™ã«ã¯rubyã‚’-Keã¨ã„ã†ã‚ªãƒ—ションを付
+ã‘ã¦èµ·å‹•ã•ã›ã‚‹ã¨è‰¯ã„ãã†ã§ã™ã€‚
+ 情報æä¾›ï¼šæ¸¡è¾ºã•ã‚“
<eban@os.rim.or.jp>
----------------------------------------------------------------------------
Ruby/Tk widget-demo
version 1.1 ( 1998/07/24 )
- ±Ê°æ¡÷ÃÎǽ¡¥¶å¹©Âç (nagai@ai.kyutech.ac.jp)
-
-ɸ½àÇÛÉۤΠTcl/Tk ³ÈÄ¥¥Ñ¥Ã¥±¡¼¥¸¤ò¼è¤ê¹þ¤ó¤À Ruby (°Ê²¼ Ruby/Tk ¤È¸Æ¤Ó¤Þ¤¹)
-¤Ç¤Ï¡¤Tk widget ¤òÍѤ¤¤¿ GUI ¤ÎºîÀ®¤ò¹Ô¤¦¤³¤È¤¬¤Ç¤­¤Þ¤¹¡¥¼ÂºÝ¤Ë GUI ¤òºîÀ®
-¤·¤Æ¤¤¤¯¾ì¹ç¤Ë¤ÏÍÍ¡¹¤Ê¼ÂÎ㤬¥µ¥ó¥×¥ë¤È¤·¤ÆÂ¸ºß¤¹¤ë¤ÈÊØÍø¤Ê¤Î¤Ç¤¹¤¬¡¤Ruby/Tk
-¤Ë¤Ï¤½¤Î¤è¤¦¤ÊŬÅö¤Ê¥µ¥ó¥×¥ë¥¹¥¯¥ê¥×¥È½¸¹ç¤Ï¸ºß¤·¤Þ¤»¤ó¤Ç¤·¤¿¡¥¤½¤ì¤ËÂФ·¡¤
-³ÈÄ¥¥Ñ¥Ã¥±¡¼¥¸¤Î¸µ¤Ç¤¢¤ë Tcl/Tk ¤Ë¤Ï¡¤Tk widget ¤òÍѤ¤¤Æ¤É¤Î¤è¤¦¤Ê¤³¤È¤¬¤Ç
-¤­¤ë¤«¤ò¼¨¤¹¤â¤Î¤È¤·¤Æ widget-demo ¤¬Â¸ºß¤·¤ª¤ê¡¤Tcl/Tk ¤òÍѤ¤¤¿ GUI ¤ÎºîÀ®
-¤ò½¬ÆÀ¤¹¤ëºÝ¤ÎÂåɽŪ¥µ¥ó¥×¥ë¤È¤Ê¤Ã¤Æ¤¤¤Þ¤¹¡¥ËÜ¥¢¡¼¥«¥¤¥Ö¤Ï¡¤Ruby/Tk ¤Î½¬ÆÀ¤Î
-¤¿¤á¤ÎÂåɽŪ¤Ê¥µ¥ó¥×¥ë¥¹¥¯¥ê¥×¥È¤È¤¹¤Ù¤¯¡¤Tcl/Tk ¤Î widget-demo ¤ò°Ü¿¢¤·¤¿¤â
-¤Î¤Ç¤¹¡¥
-
-ËÜ¥¢¡¼¥«¥¤¥Ö¤Ë´Þ¤Þ¤ì¤ë¥¹¥¯¥ê¥×¥È¤ò¼Â¹Ô¤¹¤ë¤¿¤á¤Ë¤Ï¡¤ruby-1.1c2 °Ê¾å¤Ç¤¢¤ë¤³
-¤È¤¬É¬ÍפǤ¹¡¥1.1c1 ¤Î¾ì¹ç¤Ï¡¤ËÜ¥¢¡¼¥«¥¤¥Ö¤Ë´Þ¤Þ¤ì¤ë patck_1.1c1 ¤ò Ruby ¤Î
-¥é¥¤¥Ö¥é¥ê¤Ë¤¢¤Æ¤Æ¤¯¤À¤µ¤¤¡¥ÁȤ߹þ¤à Tk ¤Î¥Ð¡¼¥¸¥ç¥ó¤Ï¡¤4.2 ¤Ç¤â 8.0 ¤Ç¤â½¤
-Àµ¤Ê¤¯Æ°¤«¤»¤ë¤Ï¤º¤Ç¤¹¡¥¤¿¤À¤·¡¤ÆüËܸìÈǤǤΰܿ¢¤È¤Ê¤Ã¤Æ¤¤¤ë¤¿¤á¡¤ÆüËܸ첽¤µ
-¤ì¤¿ Tk ¤ò¤´ÍøÍѤ¯¤À¤µ¤¤¡¥¥¹¥¯¥ê¥×¥È¤Î¥Æ¥¹¥È¤Ï¡¤Tk4.2jp ¤È Tk8.0jp ¤Î¾å¤Ç¹Ô
-¤¤¤Þ¤·¤¿ (´°àú¤Ë¤Ç¤Ï¤Ê¤¤¤Ç¤¹¤¬)¡¥
-
-ËÜ¥¢¡¼¥«¥¤¥Ö¤Ë´Þ¤Þ¤ì¤ë¥¹¥¯¥ê¥×¥È¤Î¿¤¯¤Ï¡¤¸µ¤È¤Ê¤Ã¤Æ¤¤¤ë Tcl/Tk ÈǤËÈæ³ÓŪ¶á
-¤¤¥¹¥¯¥ê¥×¥Èµ­½Ò¤È¤Ê¤ë¤è¤¦¤Ë¤·¤Æ¤¤¤Þ¤¹¡¥¤½¤Î¤¿¤á¡¤Ruby/Tk ¤Î¥µ¥ó¥×¥ë¤È¸À¤¦¤Ë
-¤Ï¡¤¤¢¤Þ¤ê Ruby ¤é¤·¤¯¤Ê¤¤¤È¤â¸À¤¨¤ë¤Ç¤·¤ç¤¦¡¥¤Ë¤â¤«¤«¤ï¤é¤º¡¤¤½¤Î¤è¤¦¤Êµ­½Ò
-¤ò¼è¤Ã¤Æ¤¤¤ëÍýͳ¤Ï¡¤Ruby/Tk ¤Î¥É¥­¥å¥á¥ó¥ÈÉÔ­¤Ë¤¢¤ê¤Þ¤¹¡¥
-
-Tcl/Tk ¤Ë¤ÏŬÅö¤Ê»²¹Í½ñ¤¬²¿ºý¤«Â¸ºß¤·¤Æ¤¤¤Þ¤¹¤«¤é¡¤Ruby/Tk ¥¹¥¯¥ê¥×¥È¤òºîÀ®
-¤¹¤ëºÝ¤Ï¡¤¤½¤Î¤è¤¦¤Ê Tcl/Tk ¤Î»²¹Í½ñ¤Ç¾ðÊó¤òÊ䤤¤Ê¤¬¤éºîÀ®¤¹¤ë¤³¤È¤Ë¤Ê¤ë¤È»×
-¤¤¤Þ¤¹¡¥³Æ widget ¤Î»ÈÍÑÎã¤È¤·¤Æ¡¤Tcl/Tk ¤Î widget-demo ¤ò»²¾È¤¹¤ë¤³¤È¤â¤¢¤ë
-¤Ç¤·¤ç¤¦¡¥Ruby/Tk ÈǤε­½Ò¤ò widget-demo ¤ò Tcl/Tk ÈǤε­½Ò¤Ë¶á¤¤¤â¤Î¤Ë¤·¤Æ
-¤ª¤±¤Ð¡¤¤½¤ÎÂÐÈæ¤Ë¤è¤Ã¤Æ¡¤Ruby/Tk ¤ÎÍý²ò¤òÁá¤á¤ë¤³¤È¤¬¤Ç¤­¤ë¤È¹Í¤¨¤é¤ì¤Þ¤¹¡¥
-°ìö Ruby/Tk ¤Ç¤Î ³Æ widget ¤Î»ÈÍÑÊýË¡¤ò½¬ÆÀ¤·¤Æ¤·¤Þ¤¨¤Ð¡¤Ruby ¤é¤·¤¤¥¹¥¯¥ê
-¥×¥È¤òºîÀ®¤¹¤ë¤³¤È¤ÏÆñ¤·¤¯¤Ê¤¤¤Ç¤·¤ç¤¦¡¥ËÜ¥¢¡¼¥«¥¤¥Ö¤Î¥¹¥¯¥ê¥×¥È¤Ï¡¤Ruby/Tk
-¤òºÇ½é¤Ë½¬ÆÀ¤¹¤ë¤Þ¤Ç¤ÎÆ§Âæ¤È¤·¤ÆÍøÍѤ·¤Æ¤¤¤¿¤À¤±¤ì¤Ð¹¬¤¤¤Ç¤¹¡¥
-
-widget-demo ¤Î°Ü¿¢¤Ë¤¢¤¿¤Ã¤Æ¤Ï¡¤¼¡¤ÎÊý¤Ë¤â°Ü¿¢¤·¤¿¥¹¥¯¥ê¥×¥È¤òÄ󶡤·¤Æ¤¤¤¿¤À
-¤­¤Þ¤·¤¿¡¥¤³¤³¤Ë´¶¼Õ¤Î°Õ¤òɽ¤·¤Þ¤¹¡¥
-
- ΩÀС÷JAIST (ttate@jaist.ac.jp) ¤µ¤ó
- Ê¿¾¾¾Í»Ë (hiramatu@cdrom.co.jp) ¤µ¤ó
-
-Ê¿¾¾¤µ¤ó¤Ë¤è¤ë Ruby/Tk ÆþÌç¤Î Web page (http://www.cdrom.co.jp/~hiramatu/)
-¤â Ruby/Tk ¤Î½¬ÆÀ¤ËÍ­ÍѤȻפ¨¤Þ¤¹¤Î¤Ç¡¤¤¼¤Ò¤´»²¾È¤¯¤À¤µ¤¤¡¥
-
-¤Þ¤¿¡¤Á°¶¶ (maebashi@iij.ad.jp) ¤µ¤ó¤ò¤Ï¤¸¤á¤È¤·¤Æ¡¤widget-demo ¤Î°Ü¿¢¤ËºÝ¤·
-¤ÆÉ¬ÍפȤʤä¿ Ruby ¤Î Tk ´ØÏ¢¥é¥¤¥Ö¥é¥ê½¤Àµ¤Ë¤Ä¤¤¤Æ¡¤ÌäÂêÅÀ¡¤¥Ð¥°¤Î»ØÅ¦¤ò¤·
-¤Æ¤¤¤¿¤À¤¤¤¿Êý¡¹¤Ë¤â´¶¼ÕÃפ·¤Þ¤¹¡¥
-
-¤½¤·¤ÆºÇ¸å¤ËºÇÂç¤Î´¶¼Õ¤ò Ruby À߷׼ԤΠ¤Þ¤Ä¤â¤È ¤æ¤­¤Ò¤í (matz@netlab.co.jp)
-¤µ¤ó¤ËÊû¤²¤¿¤¤¤È»×¤¤¤Þ¤¹¡¥
+ 永井@知能.ä¹å·¥å¤§ (nagai@ai.kyutech.ac.jp)
+
+標準é…布㮠Tcl/Tk 拡張パッケージをå–ã‚Šè¾¼ã‚“ã  Ruby (以下 Ruby/Tk ã¨å‘¼ã³ã¾ã™)
+ã§ã¯ï¼ŒTk widget を用ã„㟠GUI ã®ä½œæˆã‚’行ã†ã“ã¨ãŒã§ãã¾ã™ï¼Žå®Ÿéš›ã« GUI を作æˆ
+ã—ã¦ã„ãå ´åˆã«ã¯æ§˜ã€…ãªå®Ÿä¾‹ãŒã‚µãƒ³ãƒ—ルã¨ã—ã¦å­˜åœ¨ã™ã‚‹ã¨ä¾¿åˆ©ãªã®ã§ã™ãŒï¼ŒRuby/Tk
+ã«ã¯ãã®ã‚ˆã†ãªé©å½“ãªã‚µãƒ³ãƒ—ルスクリプト集åˆã¯å­˜åœ¨ã—ã¾ã›ã‚“ã§ã—ãŸï¼Žãれã«å¯¾ã—,
+拡張パッケージã®å…ƒã§ã‚ã‚‹ Tcl/Tk ã«ã¯ï¼ŒTk widget を用ã„ã¦ã©ã®ã‚ˆã†ãªã“ã¨ãŒã§
+ãã‚‹ã‹ã‚’示ã™ã‚‚ã®ã¨ã—㦠widget-demo ãŒå­˜åœ¨ã—ãŠã‚Šï¼ŒTcl/Tk を用ã„㟠GUI ã®ä½œæˆ
+ã‚’ç¿’å¾—ã™ã‚‹éš›ã®ä»£è¡¨çš„サンプルã¨ãªã£ã¦ã„ã¾ã™ï¼Žæœ¬ã‚¢ãƒ¼ã‚«ã‚¤ãƒ–ã¯ï¼ŒRuby/Tk ã®ç¿’å¾—ã®
+ãŸã‚ã®ä»£è¡¨çš„ãªã‚µãƒ³ãƒ—ルスクリプトã¨ã™ã¹ã,Tcl/Tk ã® widget-demo ã‚’ç§»æ¤ã—ãŸã‚‚
+ã®ã§ã™ï¼Ž
+
+本アーカイブã«å«ã¾ã‚Œã‚‹ã‚¹ã‚¯ãƒªãƒ—トを実行ã™ã‚‹ãŸã‚ã«ã¯ï¼Œruby-1.1c2 以上ã§ã‚ã‚‹ã“
+ã¨ãŒå¿…è¦ã§ã™ï¼Ž1.1c1 ã®å ´åˆã¯ï¼Œæœ¬ã‚¢ãƒ¼ã‚«ã‚¤ãƒ–ã«å«ã¾ã‚Œã‚‹ patck_1.1c1 ã‚’ Ruby ã®
+ライブラリã«ã‚ã¦ã¦ãã ã•ã„.組ã¿è¾¼ã‚€ Tk ã®ãƒãƒ¼ã‚¸ãƒ§ãƒ³ã¯ï¼Œ4.2 ã§ã‚‚ 8.0 ã§ã‚‚ä¿®
+æ­£ãªãå‹•ã‹ã›ã‚‹ã¯ãšã§ã™ï¼ŽãŸã ã—,日本語版ã§ã®ç§»æ¤ã¨ãªã£ã¦ã„ã‚‹ãŸã‚,日本語化ã•
+れ㟠Tk ã‚’ã”利用ãã ã•ã„.スクリプトã®ãƒ†ã‚¹ãƒˆã¯ï¼ŒTk4.2jp 㨠Tk8.0jp ã®ä¸Šã§è¡Œ
+ã„ã¾ã—㟠(完璧ã«ã§ã¯ãªã„ã§ã™ãŒ).
+
+本アーカイブã«å«ã¾ã‚Œã‚‹ã‚¹ã‚¯ãƒªãƒ—トã®å¤šãã¯ï¼Œå…ƒã¨ãªã£ã¦ã„ã‚‹ Tcl/Tk ç‰ˆã«æ¯”較的近
+ã„スクリプト記述ã¨ãªã‚‹ã‚ˆã†ã«ã—ã¦ã„ã¾ã™ï¼Žãã®ãŸã‚,Ruby/Tk ã®ã‚µãƒ³ãƒ—ルã¨è¨€ã†ã«
+ã¯ï¼Œã‚ã¾ã‚Š Ruby らã—ããªã„ã¨ã‚‚言ãˆã‚‹ã§ã—ょã†ï¼Žã«ã‚‚ã‹ã‹ã‚らãšï¼Œãã®ã‚ˆã†ãªè¨˜è¿°
+ã‚’å–ã£ã¦ã„ã‚‹ç†ç”±ã¯ï¼ŒRuby/Tk ã®ãƒ‰ã‚­ãƒ¥ãƒ¡ãƒ³ãƒˆä¸è¶³ã«ã‚りã¾ã™ï¼Ž
+
+Tcl/Tk ã«ã¯é©å½“ãªå‚考書ãŒä½•冊ã‹å­˜åœ¨ã—ã¦ã„ã¾ã™ã‹ã‚‰ï¼ŒRuby/Tk スクリプトを作æˆ
+ã™ã‚‹éš›ã¯ï¼Œãã®ã‚ˆã†ãª Tcl/Tk ã®å‚è€ƒæ›¸ã§æƒ…報を補ã„ãªãŒã‚‰ä½œæˆã™ã‚‹ã“ã¨ã«ãªã‚‹ã¨æ€
+ã„ã¾ã™ï¼Žå„ widget ã®ä½¿ç”¨ä¾‹ã¨ã—ã¦ï¼ŒTcl/Tk ã® widget-demo ã‚’å‚ç…§ã™ã‚‹ã“ã¨ã‚‚ã‚ã‚‹
+ã§ã—ょã†ï¼ŽRuby/Tk 版ã®è¨˜è¿°ã‚’ widget-demo ã‚’ Tcl/Tk 版ã®è¨˜è¿°ã«è¿‘ã„ã‚‚ã®ã«ã—ã¦
+ãŠã‘ã°ï¼Œãã®å¯¾æ¯”ã«ã‚ˆã£ã¦ï¼ŒRuby/Tk ã®ç†è§£ã‚’æ—©ã‚ã‚‹ã“ã¨ãŒã§ãã‚‹ã¨è€ƒãˆã‚‰ã‚Œã¾ã™ï¼Ž
+一旦 Ruby/Tk ã§ã® å„ widget ã®ä½¿ç”¨æ–¹æ³•ã‚’ç¿’å¾—ã—ã¦ã—ã¾ãˆã°ï¼ŒRuby らã—ã„スクリ
+プトを作æˆã™ã‚‹ã“ã¨ã¯é›£ã—ããªã„ã§ã—ょã†ï¼Žæœ¬ã‚¢ãƒ¼ã‚«ã‚¤ãƒ–ã®ã‚¹ã‚¯ãƒªãƒ—トã¯ï¼ŒRuby/Tk
+を最åˆã«ç¿’å¾—ã™ã‚‹ã¾ã§ã®è¸å°ã¨ã—ã¦åˆ©ç”¨ã—ã¦ã„ãŸã ã‘れã°å¹¸ã„ã§ã™ï¼Ž
+
+widget-demo ã®ç§»æ¤ã«ã‚ãŸã£ã¦ã¯ï¼Œæ¬¡ã®æ–¹ã«ã‚‚ç§»æ¤ã—ãŸã‚¹ã‚¯ãƒªãƒ—トをæä¾›ã—ã¦ã„ãŸã 
+ãã¾ã—ãŸï¼Žã“ã“ã«æ„Ÿè¬ã®æ„を表ã—ã¾ã™ï¼Ž
+
+ 立石@JAIST (ttate@jaist.ac.jp) ã•ã‚“
+ å¹³æ¾ç¥¥å² (hiramatu@cdrom.co.jp) ã•ã‚“
+
+å¹³æ¾ã•ã‚“ã«ã‚ˆã‚‹ Ruby/Tk 入門㮠Web page (http://www.cdrom.co.jp/~hiramatu/)
+ã‚‚ Ruby/Tk ã®ç¿’å¾—ã«æœ‰ç”¨ã¨æ€ãˆã¾ã™ã®ã§ï¼Œãœã²ã”å‚ç…§ãã ã•ã„.
+
+ã¾ãŸï¼Œå‰æ©‹ (maebashi@iij.ad.jp) ã•ã‚“ã‚’ã¯ã˜ã‚ã¨ã—ã¦ï¼Œwidget-demo ã®ç§»æ¤ã«éš›ã—
+ã¦å¿…è¦ã¨ãªã£ãŸ Ruby ã® Tk 関連ライブラリ修正ã«ã¤ã„ã¦ï¼Œå•題点,ãƒã‚°ã®æŒ‡æ‘˜ã‚’ã—
+ã¦ã„ãŸã ã„ãŸæ–¹ã€…ã«ã‚‚感è¬è‡´ã—ã¾ã™ï¼Ž
+
+ãã—ã¦æœ€å¾Œã«æœ€å¤§ã®æ„Ÿè¬ã‚’ Ruby 設計者㮠ã¾ã¤ã‚‚㨠ゆãã²ã‚ (matz@netlab.co.jp)
+ã•ã‚“ã«æ§ã’ãŸã„ã¨æ€ã„ã¾ã™ï¼Ž
diff --git a/ext/tk/sample/demos-en/README.tkencoding b/ext/tk/sample/demos-en/README.tkencoding
index 679b476a08..cca8734a28 100644
--- a/ext/tk/sample/demos-en/README.tkencoding
+++ b/ext/tk/sample/demos-en/README.tkencoding
@@ -3,27 +3,27 @@ The library 'tkencoding.rb' is obsolete.
Functions of tkencoding.rb is already included into Ruby/Tk.
-------------------------------------------------
-tkencoding.rb¤òÍѤ¤¤¿ÆüËܸì¤Îɽ¼¨¤Ë¤Ä¤¤¤Æ
+tkencoding.rbを用ã„ãŸæ—¥æœ¬èªžã®è¡¨ç¤ºã«ã¤ã„ã¦
Copyright (C) 1999/07, Takaaki Tateishi <ttate@jaist.ac.jp>
-1. tkencoding.rb¤È¤Ï¡©
+1. tkencoding.rbã¨ã¯ï¼Ÿ
-tkencoding.rb¤ÏTcl/Tk8.1¤òÍøÍѤ·¤¿Ruby/Tk¤Î¤¿¤á¤Î¥é¥¤¥Ö¥é¥ê
-¤Ç¤¹¡£tkencoding.rb¤òrequire¤¹¤ë¤³¤È¤Ë¤è¤Ã¤ÆWedget¤Ëɽ¼¨¤µ
-¤ì¤ë¥Æ¥­¥¹¥È¤ÏÁ´¤Æunicode(UTF8)¤ØÊÑ´¹¤µ¤ì¤Þ¤¹¡£
+tkencoding.rbã¯Tcl/Tk8.1を利用ã—ãŸRuby/Tkã®ãŸã‚ã®ãƒ©ã‚¤ãƒ–ラリ
+ã§ã™ã€‚tkencoding.rbã‚’requireã™ã‚‹ã“ã¨ã«ã‚ˆã£ã¦Wedgetã«è¡¨ç¤ºã•
+れるテキストã¯å…¨ã¦unicode(UTF8)ã¸å¤‰æ›ã•れã¾ã™ã€‚
-2. »È¤¤Êý
+2. ä½¿ã„æ–¹
-tkencoding.rb¤òrequire¤·¤ÆTk.encoding¤Ç»ÈÍѤ·¤Æ¤¤¤ëʸ»ú¥³¡¼¥É
-¤ò»ØÄꤷ¤Æ²¼¤µ¤¤¡£Î㤨¤Ð°Ê²¼¤Î¤è¤¦¤Ê´¶¤¸¤Ë¤Ê¤ê¤Þ¤¹¡£
+tkencoding.rbã‚’requireã—ã¦Tk.encodingã§ä½¿ç”¨ã—ã¦ã„る文字コード
+を指定ã—ã¦ä¸‹ã•ã„。例ãˆã°ä»¥ä¸‹ã®ã‚ˆã†ãªæ„Ÿã˜ã«ãªã‚Šã¾ã™ã€‚
----
require 'tk'
require 'tkencoding'
-Tk.encoding = "euc-jp"
+Tk.encoding = "utf-8"
# Tk.encoding = "shiftjis"
---
diff --git a/ext/tk/sample/demos-en/text.rb b/ext/tk/sample/demos-en/text.rb
index 5794a85e87..2f72de7583 100644
--- a/ext/tk/sample/demos-en/text.rb
+++ b/ext/tk/sample/demos-en/text.rb
@@ -117,7 +117,7 @@ insertion cursor. #{
end
}
-7. Resize the window. This widget has been configured with the "setGrid"
+8. Resize the window. This widget has been configured with the "setGrid"
option on, so that if you resize the window it will always resize to an
even number of characters high and wide. Also, if you make the window
narrow you can see that long lines automatically wrap around onto
diff --git a/ext/tk/sample/demos-en/widget b/ext/tk/sample/demos-en/widget
index 3778929d9c..fb49a746b9 100644
--- a/ext/tk/sample/demos-en/widget
+++ b/ext/tk/sample/demos-en/widget
@@ -627,7 +627,7 @@ class Object
end
class Proc
- def initialize(*args, &b)
+ def initialize(*args)
super
@__pseudo_toplevel__ = Thread.current[:TOPLEVEL]
end
diff --git a/ext/tk/sample/demos-jp/README b/ext/tk/sample/demos-jp/README
index 6375800232..4278124659 100644
--- a/ext/tk/sample/demos-jp/README
+++ b/ext/tk/sample/demos-jp/README
@@ -1,54 +1,54 @@
Ruby/Tk widget-demo
version 1.2 ( 2000/04/08 )
- ±Ê°æ¡÷ÃÎǽ¡¥¶å¹©Âç (nagai@ai.kyutech.ac.jp)
-
-ɸ½àÇÛÉۤΠTcl/Tk ³ÈÄ¥¥Ñ¥Ã¥±¡¼¥¸¤ò¼è¤ê¹þ¤ó¤À Ruby (°Ê²¼ Ruby/Tk ¤È¸Æ¤Ó¤Þ¤¹)
-¤Ç¤Ï¡¤Tk widget ¤òÍѤ¤¤¿ GUI ¤ÎºîÀ®¤ò¹Ô¤¦¤³¤È¤¬¤Ç¤­¤Þ¤¹¡¥¼ÂºÝ¤Ë GUI ¤òºîÀ®
-¤·¤Æ¤¤¤¯¾ì¹ç¤Ë¤ÏÍÍ¡¹¤Ê¼ÂÎ㤬¥µ¥ó¥×¥ë¤È¤·¤ÆÂ¸ºß¤¹¤ë¤ÈÊØÍø¤Ê¤Î¤Ç¤¹¤¬¡¤Ruby/Tk
-¤Ë¤Ï¤½¤Î¤è¤¦¤ÊŬÅö¤Ê¥µ¥ó¥×¥ë¥¹¥¯¥ê¥×¥È½¸¹ç¤Ï¸ºß¤·¤Þ¤»¤ó¤Ç¤·¤¿¡¥¤½¤ì¤ËÂФ·¡¤
-³ÈÄ¥¥Ñ¥Ã¥±¡¼¥¸¤Î¸µ¤Ç¤¢¤ë Tcl/Tk ¤Ë¤Ï¡¤Tk widget ¤òÍѤ¤¤Æ¤É¤Î¤è¤¦¤Ê¤³¤È¤¬¤Ç
-¤­¤ë¤«¤ò¼¨¤¹¤â¤Î¤È¤·¤Æ widget-demo ¤¬Â¸ºß¤·¤ª¤ê¡¤Tcl/Tk ¤òÍѤ¤¤¿ GUI ¤ÎºîÀ®
-¤ò½¬ÆÀ¤¹¤ëºÝ¤ÎÂåɽŪ¥µ¥ó¥×¥ë¤È¤Ê¤Ã¤Æ¤¤¤Þ¤¹¡¥ËÜ¥¢¡¼¥«¥¤¥Ö¤Ï¡¤Ruby/Tk ¤Î½¬ÆÀ¤Î
-¤¿¤á¤ÎÂåɽŪ¤Ê¥µ¥ó¥×¥ë¥¹¥¯¥ê¥×¥È¤È¤¹¤Ù¤¯¡¤Tcl/Tk ¤Î widget-demo ¤ò°Ü¿¢¤·¤¿¤â
-¤Î¤Ç¤¹¡¥
-
-º£²ó¤Î¥Ð¡¼¥¸¥ç¥ó¤Ï ruby-1.4.x ¤ËÂбþ¤È¤·¤Æ¤ª¤­¤Þ¤¹¤¬¡¤µì¥Ð¡¼¥¸¥ç¥ó¤ËÈæ¤Ù¤Æ¡¤
-¤Û¤È¤ó¤ÉÊѹ¹¤Ï¤¢¤ê¤Þ¤»¤ó¡¥ruby-1.1c2 °Ê¾å¤Ê¤éư¤¯¤È»×¤¤¤Þ¤¹¡¥ruby-1.5.x ¤Ë¤Ä
-¤¤¤Æ¤Ï¥Æ¥¹¥È¤·¤Æ¤¤¤Þ¤»¤ó¡¥¤½¤Î¤¿¤á¡¤Èó¸ß´¹¤Î±Æ¶Á¤¬½Ð¤ë¤³¤È¤¬¤¢¤ë¤«¤â¤·¤ì¤Þ¤»
-¤ó¤¬¡¤¤½¤Î¾ì¹ç¤Ç¤â¾¯¤·¤Î½¤Àµ¤Çư¤«¤»¤ë¤È»×¤¤¤Þ¤¹¡¥ÁȤ߹þ¤à Tk ¤Î¥Ð¡¼¥¸¥ç¥ó¤Ï¡¤
-4.2 ¤Ç¤â 8.0 ¤Ç¤â½¤Àµ¤Ê¤¯Æ°¤«¤»¤ë¤Ï¤º¤Ç¤¹¡¥¤¿¤À¤·¡¤ÆüËܸìÈǤǤΰܿ¢¤È¤Ê¤Ã¤Æ
-¤¤¤ë¤¿¤á¡¤ÆüËܸ첽¤µ¤ì¤¿ Tk ¤ò¤´ÍøÍѤ¯¤À¤µ¤¤¡¥¥¹¥¯¥ê¥×¥È¤Î¥Æ¥¹¥È¤Ï¡¤µì¥Ð¡¼¥¸¥ç
-¥ó¤ÎºÝ¤Ë Tk4.2jp ¤È Tk8.0jp ¤Î¾å¤Ç¹Ô¤Ã¤Æ¤¤¤Þ¤¹ (´°àú¤Ë¤Ç¤Ï¤Ê¤¤¤Ç¤¹¤¬)¡¥º£²ó
-¤Î¥Ð¡¼¥¸¥ç¥ó¤Ç¤Ï ruby-1.4.x + Tk8.0jp ¾å¤Ç¤Î´Êñ¤Ê¥Æ¥¹¥È¤·¤«¹Ô¤Ã¤Æ¤¤¤Þ¤»¤ó¤¬¡¤
-½¤Àµ¤È¤¤¤¦¤Û¤É¤Î½¤Àµ¤Ï¤·¤Æ¤¤¤Þ¤»¤ó¤Î¤ÇÌäÂê¤Ï¤Ê¤¤¤È¹Í¤¨¤Æ¤¤¤Þ¤¹¡¥
-
-ËÜ¥¢¡¼¥«¥¤¥Ö¤Ë´Þ¤Þ¤ì¤ë¥¹¥¯¥ê¥×¥È¤Î¿¤¯¤Ï¡¤¸µ¤È¤Ê¤Ã¤Æ¤¤¤ë Tcl/Tk ÈǤËÈæ³ÓŪ¶á
-¤¤¥¹¥¯¥ê¥×¥Èµ­½Ò¤È¤Ê¤ë¤è¤¦¤Ë¤·¤Æ¤¤¤Þ¤¹¡¥¤½¤Î¤¿¤á¡¤Ruby/Tk ¤Î¥µ¥ó¥×¥ë¤È¸À¤¦¤Ë
-¤Ï¡¤¤¢¤Þ¤ê Ruby ¤é¤·¤¯¤Ê¤¤¤È¤â¸À¤¨¤ë¤Ç¤·¤ç¤¦¡¥¤Ë¤â¤«¤«¤ï¤é¤º¡¤¤½¤Î¤è¤¦¤Êµ­½Ò
-¤ò¼è¤Ã¤Æ¤¤¤ëÍýͳ¤Ï¡¤Ruby/Tk ¤Î¥É¥­¥å¥á¥ó¥ÈÉÔ­¤Ë¤¢¤ê¤Þ¤¹¡¥
-
-Tcl/Tk ¤Ë¤ÏŬÅö¤Ê»²¹Í½ñ¤¬²¿ºý¤«Â¸ºß¤·¤Æ¤¤¤Þ¤¹¤«¤é¡¤Ruby/Tk ¥¹¥¯¥ê¥×¥È¤òºîÀ®
-¤¹¤ëºÝ¤Ï¡¤¤½¤Î¤è¤¦¤Ê Tcl/Tk ¤Î»²¹Í½ñ¤Ç¾ðÊó¤òÊ䤤¤Ê¤¬¤éºîÀ®¤¹¤ë¤³¤È¤Ë¤Ê¤ë¤È»×
-¤¤¤Þ¤¹¡¥³Æ widget ¤Î»ÈÍÑÎã¤È¤·¤Æ¡¤Tcl/Tk ¤Î widget-demo ¤ò»²¾È¤¹¤ë¤³¤È¤â¤¢¤ë
-¤Ç¤·¤ç¤¦¡¥Ruby/Tk ÈǤε­½Ò¤ò widget-demo ¤ò Tcl/Tk ÈǤε­½Ò¤Ë¶á¤¤¤â¤Î¤Ë¤·¤Æ
-¤ª¤±¤Ð¡¤¤½¤ÎÂÐÈæ¤Ë¤è¤Ã¤Æ¡¤Ruby/Tk ¤ÎÍý²ò¤òÁá¤á¤ë¤³¤È¤¬¤Ç¤­¤ë¤È¹Í¤¨¤é¤ì¤Þ¤¹¡¥
-°ìö Ruby/Tk ¤Ç¤Î ³Æ widget ¤Î»ÈÍÑÊýË¡¤ò½¬ÆÀ¤·¤Æ¤·¤Þ¤¨¤Ð¡¤Ruby ¤é¤·¤¤¥¹¥¯¥ê
-¥×¥È¤òºîÀ®¤¹¤ë¤³¤È¤ÏÆñ¤·¤¯¤Ê¤¤¤Ç¤·¤ç¤¦¡¥ËÜ¥¢¡¼¥«¥¤¥Ö¤Î¥¹¥¯¥ê¥×¥È¤Ï¡¤Ruby/Tk
-¤òºÇ½é¤Ë½¬ÆÀ¤¹¤ë¤Þ¤Ç¤ÎÆ§Âæ¤È¤·¤ÆÍøÍѤ·¤Æ¤¤¤¿¤À¤±¤ì¤Ð¹¬¤¤¤Ç¤¹¡¥
-
-widget-demo ¤Î°Ü¿¢¤Ë¤¢¤¿¤Ã¤Æ¤Ï¡¤¼¡¤ÎÊý¤Ë¤â°Ü¿¢¤·¤¿¥¹¥¯¥ê¥×¥È¤òÄ󶡤·¤Æ¤¤¤¿¤À
-¤­¤Þ¤·¤¿¡¥¤³¤³¤Ë´¶¼Õ¤Î°Õ¤òɽ¤·¤Þ¤¹¡¥
-
- ΩÀС÷JAIST (ttate@jaist.ac.jp) ¤µ¤ó
- Ê¿¾¾¾Í»Ë (hiramatu@cdrom.co.jp) ¤µ¤ó
-
-Ê¿¾¾¤µ¤ó¤Ë¤è¤ë Ruby/Tk ÆþÌç¤Î Web page (http://www.cdrom.co.jp/~hiramatu/)
-¤â Ruby/Tk ¤Î½¬ÆÀ¤ËÍ­ÍѤȻפ¨¤Þ¤¹¤Î¤Ç¡¤¤¼¤Ò¤´»²¾È¤¯¤À¤µ¤¤¡¥
-
-¤Þ¤¿¡¤Á°¶¶ (maebashi@iij.ad.jp) ¤µ¤ó¤ò¤Ï¤¸¤á¤È¤·¤Æ¡¤widget-demo ¤Î°Ü¿¢¤ËºÝ¤·
-¤ÆÉ¬ÍפȤʤä¿ Ruby ¤Î Tk ´ØÏ¢¥é¥¤¥Ö¥é¥ê½¤Àµ¤Ë¤Ä¤¤¤Æ¡¤ÌäÂêÅÀ¡¤¥Ð¥°¤Î»ØÅ¦¤ò¤·
-¤Æ¤¤¤¿¤À¤¤¤¿Êý¡¹¤Ë¤â´¶¼ÕÃפ·¤Þ¤¹¡¥
-
-¤½¤·¤ÆºÇ¸å¤ËºÇÂç¤Î´¶¼Õ¤ò Ruby À߷׼ԤΠ¤Þ¤Ä¤â¤È ¤æ¤­¤Ò¤í (matz@netlab.co.jp)
-¤µ¤ó¤ËÊû¤²¤¿¤¤¤È»×¤¤¤Þ¤¹¡¥
+ 永井@知能.ä¹å·¥å¤§ (nagai@ai.kyutech.ac.jp)
+
+標準é…布㮠Tcl/Tk 拡張パッケージをå–ã‚Šè¾¼ã‚“ã  Ruby (以下 Ruby/Tk ã¨å‘¼ã³ã¾ã™)
+ã§ã¯ï¼ŒTk widget を用ã„㟠GUI ã®ä½œæˆã‚’行ã†ã“ã¨ãŒã§ãã¾ã™ï¼Žå®Ÿéš›ã« GUI を作æˆ
+ã—ã¦ã„ãå ´åˆã«ã¯æ§˜ã€…ãªå®Ÿä¾‹ãŒã‚µãƒ³ãƒ—ルã¨ã—ã¦å­˜åœ¨ã™ã‚‹ã¨ä¾¿åˆ©ãªã®ã§ã™ãŒï¼ŒRuby/Tk
+ã«ã¯ãã®ã‚ˆã†ãªé©å½“ãªã‚µãƒ³ãƒ—ルスクリプト集åˆã¯å­˜åœ¨ã—ã¾ã›ã‚“ã§ã—ãŸï¼Žãれã«å¯¾ã—,
+拡張パッケージã®å…ƒã§ã‚ã‚‹ Tcl/Tk ã«ã¯ï¼ŒTk widget を用ã„ã¦ã©ã®ã‚ˆã†ãªã“ã¨ãŒã§
+ãã‚‹ã‹ã‚’示ã™ã‚‚ã®ã¨ã—㦠widget-demo ãŒå­˜åœ¨ã—ãŠã‚Šï¼ŒTcl/Tk を用ã„㟠GUI ã®ä½œæˆ
+ã‚’ç¿’å¾—ã™ã‚‹éš›ã®ä»£è¡¨çš„サンプルã¨ãªã£ã¦ã„ã¾ã™ï¼Žæœ¬ã‚¢ãƒ¼ã‚«ã‚¤ãƒ–ã¯ï¼ŒRuby/Tk ã®ç¿’å¾—ã®
+ãŸã‚ã®ä»£è¡¨çš„ãªã‚µãƒ³ãƒ—ルスクリプトã¨ã™ã¹ã,Tcl/Tk ã® widget-demo ã‚’ç§»æ¤ã—ãŸã‚‚
+ã®ã§ã™ï¼Ž
+
+今回ã®ãƒãƒ¼ã‚¸ãƒ§ãƒ³ã¯ ruby-1.4.x ã«å¯¾å¿œã¨ã—ã¦ãŠãã¾ã™ãŒï¼Œæ—§ãƒãƒ¼ã‚¸ãƒ§ãƒ³ã«æ¯”ã¹ã¦ï¼Œ
+ã»ã¨ã‚“ã©å¤‰æ›´ã¯ã‚りã¾ã›ã‚“.ruby-1.1c2 以上ãªã‚‰å‹•ãã¨æ€ã„ã¾ã™ï¼Žruby-1.5.x ã«ã¤
+ã„ã¦ã¯ãƒ†ã‚¹ãƒˆã—ã¦ã„ã¾ã›ã‚“.ãã®ãŸã‚,éžäº’æ›ã®å½±éŸ¿ãŒå‡ºã‚‹ã“ã¨ãŒã‚ã‚‹ã‹ã‚‚ã—れã¾ã›
+ã‚“ãŒï¼Œãã®å ´åˆã§ã‚‚å°‘ã—ã®ä¿®æ­£ã§å‹•ã‹ã›ã‚‹ã¨æ€ã„ã¾ã™ï¼Žçµ„ã¿è¾¼ã‚€ Tk ã®ãƒãƒ¼ã‚¸ãƒ§ãƒ³ã¯ï¼Œ
+4.2 ã§ã‚‚ 8.0 ã§ã‚‚修正ãªãå‹•ã‹ã›ã‚‹ã¯ãšã§ã™ï¼ŽãŸã ã—,日本語版ã§ã®ç§»æ¤ã¨ãªã£ã¦
+ã„ã‚‹ãŸã‚,日本語化ã•れ㟠Tk ã‚’ã”利用ãã ã•ã„.スクリプトã®ãƒ†ã‚¹ãƒˆã¯ï¼Œæ—§ãƒãƒ¼ã‚¸ãƒ§
+ンã®éš›ã« Tk4.2jp 㨠Tk8.0jp ã®ä¸Šã§è¡Œã£ã¦ã„ã¾ã™ (完璧ã«ã§ã¯ãªã„ã§ã™ãŒ).今回
+ã®ãƒãƒ¼ã‚¸ãƒ§ãƒ³ã§ã¯ ruby-1.4.x + Tk8.0jp 上ã§ã®ç°¡å˜ãªãƒ†ã‚¹ãƒˆã—ã‹è¡Œã£ã¦ã„ã¾ã›ã‚“ãŒï¼Œ
+修正ã¨ã„ã†ã»ã©ã®ä¿®æ­£ã¯ã—ã¦ã„ã¾ã›ã‚“ã®ã§å•題ã¯ãªã„ã¨è€ƒãˆã¦ã„ã¾ã™ï¼Ž
+
+本アーカイブã«å«ã¾ã‚Œã‚‹ã‚¹ã‚¯ãƒªãƒ—トã®å¤šãã¯ï¼Œå…ƒã¨ãªã£ã¦ã„ã‚‹ Tcl/Tk ç‰ˆã«æ¯”較的近
+ã„スクリプト記述ã¨ãªã‚‹ã‚ˆã†ã«ã—ã¦ã„ã¾ã™ï¼Žãã®ãŸã‚,Ruby/Tk ã®ã‚µãƒ³ãƒ—ルã¨è¨€ã†ã«
+ã¯ï¼Œã‚ã¾ã‚Š Ruby らã—ããªã„ã¨ã‚‚言ãˆã‚‹ã§ã—ょã†ï¼Žã«ã‚‚ã‹ã‹ã‚らãšï¼Œãã®ã‚ˆã†ãªè¨˜è¿°
+ã‚’å–ã£ã¦ã„ã‚‹ç†ç”±ã¯ï¼ŒRuby/Tk ã®ãƒ‰ã‚­ãƒ¥ãƒ¡ãƒ³ãƒˆä¸è¶³ã«ã‚りã¾ã™ï¼Ž
+
+Tcl/Tk ã«ã¯é©å½“ãªå‚考書ãŒä½•冊ã‹å­˜åœ¨ã—ã¦ã„ã¾ã™ã‹ã‚‰ï¼ŒRuby/Tk スクリプトを作æˆ
+ã™ã‚‹éš›ã¯ï¼Œãã®ã‚ˆã†ãª Tcl/Tk ã®å‚è€ƒæ›¸ã§æƒ…報を補ã„ãªãŒã‚‰ä½œæˆã™ã‚‹ã“ã¨ã«ãªã‚‹ã¨æ€
+ã„ã¾ã™ï¼Žå„ widget ã®ä½¿ç”¨ä¾‹ã¨ã—ã¦ï¼ŒTcl/Tk ã® widget-demo ã‚’å‚ç…§ã™ã‚‹ã“ã¨ã‚‚ã‚ã‚‹
+ã§ã—ょã†ï¼ŽRuby/Tk 版ã®è¨˜è¿°ã‚’ widget-demo ã‚’ Tcl/Tk 版ã®è¨˜è¿°ã«è¿‘ã„ã‚‚ã®ã«ã—ã¦
+ãŠã‘ã°ï¼Œãã®å¯¾æ¯”ã«ã‚ˆã£ã¦ï¼ŒRuby/Tk ã®ç†è§£ã‚’æ—©ã‚ã‚‹ã“ã¨ãŒã§ãã‚‹ã¨è€ƒãˆã‚‰ã‚Œã¾ã™ï¼Ž
+一旦 Ruby/Tk ã§ã® å„ widget ã®ä½¿ç”¨æ–¹æ³•ã‚’ç¿’å¾—ã—ã¦ã—ã¾ãˆã°ï¼ŒRuby らã—ã„スクリ
+プトを作æˆã™ã‚‹ã“ã¨ã¯é›£ã—ããªã„ã§ã—ょã†ï¼Žæœ¬ã‚¢ãƒ¼ã‚«ã‚¤ãƒ–ã®ã‚¹ã‚¯ãƒªãƒ—トã¯ï¼ŒRuby/Tk
+を最åˆã«ç¿’å¾—ã™ã‚‹ã¾ã§ã®è¸å°ã¨ã—ã¦åˆ©ç”¨ã—ã¦ã„ãŸã ã‘れã°å¹¸ã„ã§ã™ï¼Ž
+
+widget-demo ã®ç§»æ¤ã«ã‚ãŸã£ã¦ã¯ï¼Œæ¬¡ã®æ–¹ã«ã‚‚ç§»æ¤ã—ãŸã‚¹ã‚¯ãƒªãƒ—トをæä¾›ã—ã¦ã„ãŸã 
+ãã¾ã—ãŸï¼Žã“ã“ã«æ„Ÿè¬ã®æ„を表ã—ã¾ã™ï¼Ž
+
+ 立石@JAIST (ttate@jaist.ac.jp) ã•ã‚“
+ å¹³æ¾ç¥¥å² (hiramatu@cdrom.co.jp) ã•ã‚“
+
+å¹³æ¾ã•ã‚“ã«ã‚ˆã‚‹ Ruby/Tk 入門㮠Web page (http://www.cdrom.co.jp/~hiramatu/)
+ã‚‚ Ruby/Tk ã®ç¿’å¾—ã«æœ‰ç”¨ã¨æ€ãˆã¾ã™ã®ã§ï¼Œãœã²ã”å‚ç…§ãã ã•ã„.
+
+ã¾ãŸï¼Œå‰æ©‹ (maebashi@iij.ad.jp) ã•ã‚“ã‚’ã¯ã˜ã‚ã¨ã—ã¦ï¼Œwidget-demo ã®ç§»æ¤ã«éš›ã—
+ã¦å¿…è¦ã¨ãªã£ãŸ Ruby ã® Tk 関連ライブラリ修正ã«ã¤ã„ã¦ï¼Œå•題点,ãƒã‚°ã®æŒ‡æ‘˜ã‚’ã—
+ã¦ã„ãŸã ã„ãŸæ–¹ã€…ã«ã‚‚感è¬è‡´ã—ã¾ã™ï¼Ž
+
+ãã—ã¦æœ€å¾Œã«æœ€å¤§ã®æ„Ÿè¬ã‚’ Ruby 設計者㮠ã¾ã¤ã‚‚㨠ゆãã²ã‚ (matz@netlab.co.jp)
+ã•ã‚“ã«æ§ã’ãŸã„ã¨æ€ã„ã¾ã™ï¼Ž
diff --git a/ext/tk/sample/demos-jp/README.1st b/ext/tk/sample/demos-jp/README.1st
index 60b278d7b6..68caf8b14d 100644
--- a/ext/tk/sample/demos-jp/README.1st
+++ b/ext/tk/sample/demos-jp/README.1st
@@ -1,20 +1,20 @@
-¤³¤Î¥Ç¥£¥ì¥¯¥È¥ê¤Ë¤Ï Ruby/Tk ¤Î¥Ç¥â¥¹¥¯¥ê¥×¥È¤¬¼ý¤á¤é¤ì¤Æ¤¤¤Þ¤¹¡¥
+ã“ã®ãƒ‡ã‚£ãƒ¬ã‚¯ãƒˆãƒªã«ã¯ Ruby/Tk ã®ãƒ‡ãƒ¢ã‚¹ã‚¯ãƒªãƒ—トãŒåŽã‚られã¦ã„ã¾ã™ï¼Ž
-'.rb' ¤È¤¤¤¦³ÈÄ¥»Ò¤ò»ý¤Ã¤Æ¤¤¤ë¥Õ¥¡¥¤¥ë¤Ï¡¤¥é¥ó¥Á¥ã¨¡¥¹¥¯¥ê¥×¥È¤Ç
-¤¢¤ë 'widget' ¤«¤é¸Æ¤Ó½Ð¤µ¤ì¤ë¥µ¥Ö¥¹¥¯¥ê¥×¥È¤Ç¤¹¡¥¤½¤ì¤¾¤ìÆÈΩ¤Ë
-¤Ïư¤­¤Þ¤»¤ó¡¥'widget' ¥¹¥¯¥ê¥×¥È¤«¤é¸Æ¤Ó½Ð¤·¤Æ¤¯¤À¤µ¤¤¡¥
+'.rb' ã¨ã„ã†æ‹¡å¼µå­ã‚’æŒã£ã¦ã„るファイルã¯ï¼Œãƒ©ãƒ³ãƒãƒ£â”€ã‚¹ã‚¯ãƒªãƒ—トã§
+ã‚ã‚‹ 'widget' ã‹ã‚‰å‘¼ã³å‡ºã•れるサブスクリプトã§ã™ï¼Žãれãžã‚Œç‹¬ç«‹ã«
+ã¯å‹•ãã¾ã›ã‚“.'widget' スクリプトã‹ã‚‰å‘¼ã³å‡ºã—ã¦ãã ã•ã„.
-¤â¤·¥é¥ó¥Á¥ã¨¡¥¹¥¯¥ê¥×¥È 'widget' ¤Îµ¯Æ°¤ÈƱ»þ¤Ë¤¤¤¯¤Ä¤«¤Î¥µ¥Ö¥¹
-¥¯¥ê¥×¥È¤òµ¯Æ°¤·¤¿¤±¤ì¤Ð¡¤¤½¤Î¥µ¥Ö¥¹¥¯¥ê¥×¥È¤Î̾Á°¤ò°ú¿ô¤È¤·¤ÆÍ¿
-¤¨¤Æ¤¯¤À¤µ¤¤¡¥
-( Îã: /usr/local/bin/ruby widget button.rb entry1.rb text.rb )
-¥µ¥Ö¥¹¥¯¥ê¥×¥È¤Î³ÈÄ¥»Ò '.rb' ¤Ï¾Êά¤¹¤ë¤³¤È¤â¤Ç¤­¤Þ¤¹¡¥
-( Îã: /usr/local/bin/ruby widget button entry1 text )
+ã‚‚ã—ランãƒãƒ£â”€ã‚¹ã‚¯ãƒªãƒ—ト 'widget' ã®èµ·å‹•ã¨åŒæ™‚ã«ã„ãã¤ã‹ã®ã‚µãƒ–ス
+クリプトを起動ã—ãŸã‘れã°ï¼Œãã®ã‚µãƒ–スクリプトã®åå‰ã‚’引数ã¨ã—ã¦ä¸Ž
+ãˆã¦ãã ã•ã„.
+( 例: /usr/local/bin/ruby widget button.rb entry1.rb text.rb )
+ã‚µãƒ–ã‚¹ã‚¯ãƒªãƒ—ãƒˆã®æ‹¡å¼µå­ '.rb' ã¯çœç•¥ã™ã‚‹ã“ã¨ã‚‚ã§ãã¾ã™ï¼Ž
+( 例: /usr/local/bin/ruby widget button entry1 text )
-¤â¤·¥é¥ó¥Á¥ã¨¡¥¹¥¯¥ê¥×¥È¤Î¥¦¥£¥ó¥É¥¦¤¬É¬Íפʤ¤¾ì¹ç¤Ë¤Ï¡¤'-n' ¥ª
-¥×¥·¥ç¥ó¤òÍ¿¤¨¤Æ¤¯¤À¤µ¤¤¡¥
-( Îã: /usr/local/bin/ruby widget -n button.rb entry1.rb text.rb )
+ã‚‚ã—ランãƒãƒ£â”€ã‚¹ã‚¯ãƒªãƒ—トã®ã‚¦ã‚£ãƒ³ãƒ‰ã‚¦ãŒå¿…è¦ãªã„å ´åˆã«ã¯ï¼Œ'-n' オ
+プションを与ãˆã¦ãã ã•ã„.
+( 例: /usr/local/bin/ruby widget -n button.rb entry1.rb text.rb )
-¾¤Î¥Õ¥¡¥¤¥ë (browse1 ¤ä hello ¤Ê¤É) ¤ÏñÆÈ¤Çư¤«¤¹¤³¤È¤¬²Äǽ¤Ç¤¹¡¥
+ä»–ã®ãƒ•ァイル (browse1 ã‚„ hello ãªã©) ã¯å˜ç‹¬ã§å‹•ã‹ã™ã“ã¨ãŒå¯èƒ½ã§ã™ï¼Ž
2004/04/14 Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/sample/demos-jp/anilabel.rb b/ext/tk/sample/demos-jp/anilabel.rb
index d2f5b12041..c882f43f7e 100644
--- a/ext/tk/sample/demos-jp/anilabel.rb
+++ b/ext/tk/sample/demos-jp/anilabel.rb
@@ -1,16 +1,16 @@
-# -*- coding: euc-jp -*-
+# -*- coding: utf-8 -*-
#
# animated label widget demo (called by 'widget')
#
# based on Tcl/Tk8.5a2 widget demos
-# toplevel widget ¤¬Â¸ºß¤¹¤ì¤Ðºï½ü¤¹¤ë
+# toplevel widget ãŒå­˜åœ¨ã™ã‚Œã°å‰Šé™¤ã™ã‚‹
if defined?($anilabel_demo) && $anilabel_demo
$anilabel_demo.destroy
$anilabel_demo = nil
end
-# demo ÍѤΠtoplevel widget ¤òÀ¸À®
+# demo 用㮠toplevel widget を生æˆ
$anilabel_demo = TkToplevel.new {|w|
title("Animated Label Demonstration")
iconname("anilabel")
@@ -19,20 +19,20 @@ $anilabel_demo = TkToplevel.new {|w|
base_frame = TkFrame.new($anilabel_demo).pack(:fill=>:both, :expand=>true)
-# label À¸À®
+# label 生æˆ
msg = TkLabel.new(base_frame) {
font $font
wraplength '4i'
justify 'left'
- text "²¼¤Ë¤Ï4¤Ä¤Î¥¢¥Ë¥á¡¼¥·¥ç¥ó¥é¥Ù¥ë¤¬É½¼¨¤µ¤ì¤Æ¤¤¤Þ¤¹¡£º¸Â¦¤Ë¤¢¤ë¥é¥Ù¥ë¤Ï¡¢ÆâÉô¤Î¥Æ¥­¥¹¥È¥á¥Ã¥»¡¼¥¸¤ò¥¹¥¯¥í¡¼¥ë¤·¤¿¤è¤¦¤Ë¸«¤»¤ë¤³¤È¤Çư¤­¤òÉÕ¤±¤Æ¤¤¤Þ¤¹¡£±¦Â¦¤Î¥é¥Ù¥ë¤Ï¡¢É½¼¨¤¹¤ë¥¤¥á¡¼¥¸¤òÊѲ½¤µ¤»¤ë¤³¤È¤Çư¤­¤òÍ¿¤¨¤Æ¤¤¤Þ¤¹¡£"
+ text "下ã«ã¯4ã¤ã®ã‚¢ãƒ‹ãƒ¡ãƒ¼ã‚·ãƒ§ãƒ³ãƒ©ãƒ™ãƒ«ãŒè¡¨ç¤ºã•れã¦ã„ã¾ã™ã€‚å·¦å´ã«ã‚るラベルã¯ã€å†…部ã®ãƒ†ã‚­ã‚¹ãƒˆãƒ¡ãƒƒã‚»ãƒ¼ã‚¸ã‚’スクロールã—ãŸã‚ˆã†ã«è¦‹ã›ã‚‹ã“ã¨ã§å‹•ãを付ã‘ã¦ã„ã¾ã™ã€‚å³å´ã®ãƒ©ãƒ™ãƒ«ã¯ã€è¡¨ç¤ºã™ã‚‹ã‚¤ãƒ¡ãƒ¼ã‚¸ã‚’変化ã•ã›ã‚‹ã“ã¨ã§å‹•ãを与ãˆã¦ã„ã¾ã™ã€‚"
}
msg.pack('side'=>'top')
-# frame À¸À®
+# frame 生æˆ
TkFrame.new(base_frame) {|frame|
TkButton.new(frame) {
- #text 'λ²ò'
- text 'ÊĤ¸¤ë'
+ #text '了解'
+ text 'é–‰ã˜ã‚‹'
command proc{
tmppath = $anilabel_demo
$anilabel_demo = nil
@@ -41,13 +41,13 @@ TkFrame.new(base_frame) {|frame|
}.pack('side'=>'left', 'expand'=>'yes')
TkButton.new(frame) {
- text '¥³¡¼¥É»²¾È'
+ text 'コードå‚ç…§'
command proc{showCode 'anilabel'}
}.pack('side'=>'left', 'expand'=>'yes')
}.pack('side'=>'bottom', 'fill'=>'x', 'pady'=>'2m')
-# label demo Íѥե졼¥àÀ¸À®
+# label demo 用フレーム生æˆ
f_left = TkLabelFrame.new(base_frame, :text=>'Scrolling Texts')
f_right = TkLabelFrame.new(base_frame, :text=>'GIF Image')
Tk.pack(f_left, f_right, 'side'=>'left', 'expand'=>'yes', 'fill'=>'both',
@@ -123,7 +123,7 @@ class AnimatedImageLabel < AnimatedTextLabel
private :_animation_callback
end
-# label À¸À®
+# label 生æˆ
l1 = AnimatedTextLabel.new(f_left, :borderwidth=>4, :relief=>:ridge,
:font=>{:family=>'Courier', :size=>10})
l2 = AnimatedTextLabel.new(f_left, :borderwidth=>4, :relief=>:groove,
diff --git a/ext/tk/sample/demos-jp/aniwave.rb b/ext/tk/sample/demos-jp/aniwave.rb
index 973c1be1e9..866316c331 100644
--- a/ext/tk/sample/demos-jp/aniwave.rb
+++ b/ext/tk/sample/demos-jp/aniwave.rb
@@ -1,4 +1,4 @@
-# -*- coding: euc-jp -*-
+# -*- coding: utf-8 -*-
#
# animated wave demo (called by 'widget')
#
@@ -24,15 +24,15 @@ msg = TkLabel.new(base_frame) {
font $font
wraplength '4i'
justify 'left'
- text '¤³¤Î¥Ç¥â¤Ç¤Ï¡¢¥é¥¤¥ó¥¢¥¤¥Æ¥à¤¬°ì¤Ä¤À¤±ÉÁ¤«¤ì¤¿¥­¥ã¥ó¥Ð¥¹¥¦¥£¥¸¥§¥Ã¥È¤¬É½¼¨¤µ¤ì¤Æ¤¤¤Þ¤¹¡£¥¢¥Ë¥á¡¼¥·¥ç¥ó½èÍý¤Ï¡¢¤½¤Î¥é¥¤¥ó¥¢¥¤¥Æ¥à¤ÎºÂɸÃͤòÊѹ¹¤¹¤ë¤³¤È¤Ç¼Â¸½¤·¤Æ¤¤¤Þ¤¹¡£'
+ text 'ã“ã®ãƒ‡ãƒ¢ã§ã¯ã€ãƒ©ã‚¤ãƒ³ã‚¢ã‚¤ãƒ†ãƒ ãŒä¸€ã¤ã ã‘æã‹ã‚ŒãŸã‚­ãƒ£ãƒ³ãƒã‚¹ã‚¦ã‚£ã‚¸ã‚§ãƒƒãƒˆãŒè¡¨ç¤ºã•れã¦ã„ã¾ã™ã€‚アニメーション処ç†ã¯ã€ãã®ãƒ©ã‚¤ãƒ³ã‚¢ã‚¤ãƒ†ãƒ ã®åº§æ¨™å€¤ã‚’変更ã™ã‚‹ã“ã¨ã§å®Ÿç¾ã—ã¦ã„ã¾ã™ã€‚'
}
msg.pack('side'=>'top')
# create frame
TkFrame.new(base_frame) {|frame|
TkButton.new(frame) {
- #text 'λ²ò'
- text 'ÊĤ¸¤ë'
+ #text '了解'
+ text 'é–‰ã˜ã‚‹'
command proc{
tmppath = $aniwave_demo
$aniwave_demo = nil
@@ -41,7 +41,7 @@ TkFrame.new(base_frame) {|frame|
}.pack('side'=>'left', 'expand'=>'yes')
TkButton.new(frame) {
- text '¥³¡¼¥É»²¾È'
+ text 'コードå‚ç…§'
command proc{showCode 'aniwave'}
}.pack('side'=>'left', 'expand'=>'yes')
diff --git a/ext/tk/sample/demos-jp/arrow.rb b/ext/tk/sample/demos-jp/arrow.rb
index a1694d019d..2995f96d54 100644
--- a/ext/tk/sample/demos-jp/arrow.rb
+++ b/ext/tk/sample/demos-jp/arrow.rb
@@ -1,4 +1,4 @@
-# -*- coding: euc-jp -*-
+# -*- coding: utf-8 -*-
#
# arrowhead widget demo (called by 'widget')
#
@@ -91,13 +91,13 @@ def arrowSetup(c)
v.count += 1
end
-# toplevel widget ¤¬Â¸ºß¤¹¤ì¤Ðºï½ü¤¹¤ë
+# toplevel widget ãŒå­˜åœ¨ã™ã‚Œã°å‰Šé™¤ã™ã‚‹
if defined?($arrow_demo) && $arrow_demo
$arrow_demo.destroy
$arrow_demo = nil
end
-# demo ÍѤΠtoplevel widget ¤òÀ¸À®
+# demo 用㮠toplevel widget を生æˆ
$arrow_demo = TkToplevel.new {|w|
title("Arrowhead Editor Demonstration")
iconname("arrow")
@@ -106,17 +106,17 @@ $arrow_demo = TkToplevel.new {|w|
base_frame = TkFrame.new($arrow_demo).pack(:fill=>:both, :expand=>true)
-# label À¸À®
+# label 生æˆ
TkLabel.new(base_frame, 'font'=>$font, 'wraplength'=>'5i', 'justify'=>'left',
- 'text'=>"¤³¤Î widget ¤Ç¡¢¥­¥ã¥ó¥Ð¥¹¤Ç»È¤ï¤ì¤ë¥é¥¤¥ó¤Ë¤Ä¤¤¤ÆÍÍ¡¹¤ÊÉý¤äÌð°õ¤ÎƬ¤Î·Á¤ò»î¤·¤Æ¤ß¤ë¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£Àþ¤ÎÉý¤äÌð°õ¤Î·Á¤òÊѤ¨¤ë¤Ë¤Ï¡¢³ÈÂ礵¤ì¤¿Ìð°õ¤Ë¤Ä¤¤¤Æ¤¤¤ë 3¤Ä¤Î»Í³Ñ¤ò¥É¥é¥Ã¥°¤·¤Æ¤¯¤À¤µ¤¤¡£±¦Â¦¤ÎÌð°õ¤ÏÉáÄ̤ÎÂ礭¤µ¤Ç¤Î¥µ¥ó¥×¥ë¤ò¼¨¤·¤Æ¤¤¤Þ¤¹¡£²¼¤Î¥Æ¥­¥¹¥È¤Ï¥é¥¤¥ó¥¢¥¤¥Æ¥à¤ËÂФ¹¤ëÀßÄꥪ¥×¥·¥ç¥ó¤Ç¤¹¡£"){
+ 'text'=>"ã“ã® widget ã§ã€ã‚­ãƒ£ãƒ³ãƒã‚¹ã§ä½¿ã‚れるラインã«ã¤ã„ã¦æ§˜ã€…ãªå¹…や矢å°ã®é ­ã®å½¢ã‚’試ã—ã¦ã¿ã‚‹ã“ã¨ãŒã§ãã¾ã™ã€‚ç·šã®å¹…や矢å°ã®å½¢ã‚’変ãˆã‚‹ã«ã¯ã€æ‹¡å¤§ã•れãŸçŸ¢å°ã«ã¤ã„ã¦ã„ã‚‹ 3ã¤ã®å››è§’をドラッグã—ã¦ãã ã•ã„。å³å´ã®çŸ¢å°ã¯æ™®é€šã®å¤§ãã•ã§ã®ã‚µãƒ³ãƒ—ルを示ã—ã¦ã„ã¾ã™ã€‚下ã®ãƒ†ã‚­ã‚¹ãƒˆã¯ãƒ©ã‚¤ãƒ³ã‚¢ã‚¤ãƒ†ãƒ ã«å¯¾ã™ã‚‹è¨­å®šã‚ªãƒ—ションã§ã™ã€‚"){
pack('side'=>'top')
}
-# frame À¸À®
+# frame 生æˆ
$arrow_buttons = TkFrame.new(base_frame) {|frame|
TkButton.new(frame) {
- #text 'λ²ò'
- text 'ÊĤ¸¤ë'
+ #text '了解'
+ text 'é–‰ã˜ã‚‹'
command proc{
tmppath = $arrow_demo
$arrow_demo = nil
@@ -125,18 +125,18 @@ $arrow_buttons = TkFrame.new(base_frame) {|frame|
}.pack('side'=>'left', 'expand'=>'yes')
TkButton.new(frame) {
- text '¥³¡¼¥É»²¾È'
+ text 'コードå‚ç…§'
command proc{showCode 'arrow'}
}.pack('side'=>'left', 'expand'=>'yes')
}
$arrow_buttons.pack('side'=>'bottom', 'fill'=>'x', 'pady'=>'2m')
-# canvas ÀßÄê
+# canvas 設定
$arrow_canvas = TkCanvas.new(base_frame, 'width'=>500, 'height'=>350,
'relief'=>'sunken', 'borderwidth'=>2)
$arrow_canvas.pack('expand'=>'yes', 'fill'=>'both')
-# ÃÍÀßÄê
+# 値設定
unless Struct.const_defined?("ArrowInfo")
$demo_arrowInfo = Struct.new("ArrowInfo", :a, :b, :c, :width, :motionProc,
:x1, :x2, :y, :smallTips, :count,
diff --git a/ext/tk/sample/demos-jp/bind.rb b/ext/tk/sample/demos-jp/bind.rb
index 99e5c1718c..efba6e6c01 100644
--- a/ext/tk/sample/demos-jp/bind.rb
+++ b/ext/tk/sample/demos-jp/bind.rb
@@ -1,15 +1,15 @@
-# -*- coding: euc-jp -*-
+# -*- coding: utf-8 -*-
#
# text (tag bindings) widget demo (called by 'widget')
#
-# toplevel widget ¤¬Â¸ºß¤¹¤ì¤Ðºï½ü¤¹¤ë
+# toplevel widget ãŒå­˜åœ¨ã™ã‚Œã°å‰Šé™¤ã™ã‚‹
if defined?($bind_demo) && $bind_demo
$bind_demo.destroy
$bind_demo = nil
end
-# demo ÍѤΠtoplevel widget ¤òÀ¸À®
+# demo 用㮠toplevel widget を生æˆ
$bind_demo = TkToplevel.new {|w|
title("Text Demonstration - Tag Bindings")
iconname("bind")
@@ -18,11 +18,11 @@ $bind_demo = TkToplevel.new {|w|
base_frame = TkFrame.new($bind_demo).pack(:fill=>:both, :expand=>true)
-# frame À¸À®
+# frame 生æˆ
TkFrame.new(base_frame) {|frame|
TkButton.new(frame) {
- #text 'λ²ò'
- text 'ÊĤ¸¤ë'
+ #text '了解'
+ text 'é–‰ã˜ã‚‹'
command proc{
tmppath = $bind_demo
$bind_demo = nil
@@ -31,20 +31,20 @@ TkFrame.new(base_frame) {|frame|
}.pack('side'=>'left', 'expand'=>'yes')
TkButton.new(frame) {
- text '¥³¡¼¥É»²¾È'
+ text 'コードå‚ç…§'
command proc{showCode 'bind'}
}.pack('side'=>'left', 'expand'=>'yes')
}.pack('side'=>'bottom', 'fill'=>'x', 'pady'=>'2m')
-# bind Íѥ᥽¥Ã¥É
+# bind 用メソッド
def tag_binding_for_bind_demo(tag, enter_style, leave_style)
tag.bind('Any-Enter', proc{tag.configure enter_style})
tag.bind('Any-Leave', proc{tag.configure leave_style})
end
-# text À¸À®
+# text 生æˆ
txt = TkText.new(base_frame){|t|
- # À¸À®
+ # 生æˆ
setgrid 'true'
#width 60
#height 24
@@ -57,7 +57,7 @@ txt = TkText.new(base_frame){|t|
}
pack('expand'=>'yes', 'fill'=>'both')
- # ¥¹¥¿¥¤¥ëÀßÄê
+ # スタイル設定
if TkWinfo.depth($root).to_i > 1
tagstyle_bold = {'background'=>'#43ce80', 'relief'=>'raised',
'borderwidth'=>1}
@@ -67,25 +67,25 @@ txt = TkText.new(base_frame){|t|
tagstyle_normal = {'foreground'=>'', 'background'=>''}
end
- # ¥Æ¥­¥¹¥ÈÁÞÆþ
- insert 'insert', "¥Æ¥­¥¹¥Èwidget¤Îɽ¼¨¥¹¥¿¥¤¥ë¤òÀ©¸æ¤¹¤ë¤Î¤ÈƱ¤¸¥¿¥°¤Î¥á¥«¥Ë¥º¥à¤ò»È¤Ã¤Æ¡¢¥Æ¥­¥¹¥È¤ËTcl¤Î¥³¥Þ¥ó¥É¤ò³ä¤êÅö¤Æ¤ë¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£¤³¤ì¤Ë¤è¤ê¡¢¥Þ¥¦¥¹¤ä¥­¡¼¥Ü¡¼¥É¤Î¥¢¥¯¥·¥ç¥ó¤ÇÆÃÄê¤ÎTcl¤Î¥³¥Þ¥ó¥É¤¬¼Â¹Ô¤µ¤ì¤ë¤è¤¦¤Ë¤Ê¤ê¤Þ¤¹¡£Î㤨¤Ð¡¢²¼¤Î¥­¥ã¥ó¥Ð¥¹¤Î¥Ç¥â¥×¥í¥°¥é¥à¤Ë¤Ä¤¤¤Æ¤ÎÀâÌÀʸ¤Ë¤Ï¤½¤Î¤è¤¦¤Ê¥¿¥°¤¬¤Ä¤¤¤Æ¤¤¤Þ¤¹¡£¥Þ¥¦¥¹¤òÀâÌÀʸ¤Î¾å¤Ë»ý¤Ã¤Æ¤¤¤¯¤ÈÀâÌÀʸ¤¬¸÷¤ê¡¢¥Ü¥¿¥ó1¤ò²¡¤¹¤È¤½¤ÎÀâÌÀ¤Î¥Ç¥â¤¬»Ï¤Þ¤ê¤Þ¤¹¡£
+ # テキスト挿入
+ insert 'insert', "テキストwidgetã®è¡¨ç¤ºã‚¹ã‚¿ã‚¤ãƒ«ã‚’制御ã™ã‚‹ã®ã¨åŒã˜ã‚¿ã‚°ã®ãƒ¡ã‚«ãƒ‹ã‚ºãƒ ã‚’使ã£ã¦ã€ãƒ†ã‚­ã‚¹ãƒˆã«Tclã®ã‚³ãƒžãƒ³ãƒ‰ã‚’割り当ã¦ã‚‹ã“ã¨ãŒã§ãã¾ã™ã€‚ã“れã«ã‚ˆã‚Šã€ãƒžã‚¦ã‚¹ã‚„キーボードã®ã‚¢ã‚¯ã‚·ãƒ§ãƒ³ã§ç‰¹å®šã®Tclã®ã‚³ãƒžãƒ³ãƒ‰ãŒå®Ÿè¡Œã•れるよã†ã«ãªã‚Šã¾ã™ã€‚例ãˆã°ã€ä¸‹ã®ã‚­ãƒ£ãƒ³ãƒã‚¹ã®ãƒ‡ãƒ¢ãƒ—ログラムã«ã¤ã„ã¦ã®èª¬æ˜Žæ–‡ã«ã¯ãã®ã‚ˆã†ãªã‚¿ã‚°ãŒã¤ã„ã¦ã„ã¾ã™ã€‚マウスを説明文ã®ä¸Šã«æŒã£ã¦ã„ãã¨èª¬æ˜Žæ–‡ãŒå…‰ã‚Šã€ãƒœã‚¿ãƒ³1を押ã™ã¨ãã®èª¬æ˜Žã®ãƒ‡ãƒ¢ãŒå§‹ã¾ã‚Šã¾ã™ã€‚
"
- insert('end', '1. ¥­¥ã¥ó¥Ð¥¹ widget ¤Ëºî¤ë¤³¤È¤Î¤Ç¤­¤ë¥¢¥¤¥Æ¥à¤Î¼ïÎàÁ´¤Æ¤Ë´Ø¤¹¤ë¥µ¥ó¥×¥ë¡£', (d1 = TkTextTag.new(t)) )
+ insert('end', '1. キャンãƒã‚¹ widget ã«ä½œã‚‹ã“ã¨ã®ã§ãるアイテムã®ç¨®é¡žå…¨ã¦ã«é–¢ã™ã‚‹ã‚µãƒ³ãƒ—ル。', (d1 = TkTextTag.new(t)) )
insert('end', "\n\n")
- insert('end', '2. ´Êñ¤Ê 2¼¡¸µ¤Î¥×¥í¥Ã¥È¡£¥Ç¡¼¥¿¤òɽ¤¹ÅÀ¤òư¤«¤¹¤³¤È¤¬¤Ç¤­¤ë¡£', (d2 = TkTextTag.new(t)) )
+ insert('end', '2. ç°¡å˜ãª 2次元ã®ãƒ—ロット。データを表ã™ç‚¹ã‚’å‹•ã‹ã™ã“ã¨ãŒã§ãる。', (d2 = TkTextTag.new(t)) )
insert('end', "\n\n")
- insert('end', '3. ¥Æ¥­¥¹¥È¥¢¥¤¥Æ¥à¤Î¥¢¥ó¥«¡¼¤È¹Ô·¤¨¡£',
+ insert('end', '3. テキストアイテムã®ã‚¢ãƒ³ã‚«ãƒ¼ã¨è¡Œæƒãˆã€‚',
(d3 = TkTextTag.new(t)) )
insert('end', "\n\n")
- insert('end', '4. ¥é¥¤¥ó¥¢¥¤¥Æ¥à¤Î¤¿¤á¤ÎÌð°õ¤ÎƬ¤Î·Á¤Î¥¨¥Ç¥£¥¿¡£',
+ insert('end', '4. ラインアイテムã®ãŸã‚ã®çŸ¢å°ã®é ­ã®å½¢ã®ã‚¨ãƒ‡ã‚£ã‚¿ã€‚',
(d4 = TkTextTag.new(t)) )
insert('end', "\n\n")
- insert('end', '5. ¥¿¥Ö¥¹¥È¥Ã¥×¤òÊѹ¹¤¹¤ë¤¿¤á¤Îµ¡Ç½¤Ä¤­¤Î¥ë¡¼¥é¡¼¡£',
+ insert('end', '5. タブストップを変更ã™ã‚‹ãŸã‚ã®æ©Ÿèƒ½ã¤ãã®ãƒ«ãƒ¼ãƒ©ãƒ¼ã€‚',
(d5 = TkTextTag.new(t)) )
insert('end', "\n\n")
insert('end',
- '6. ¥­¥ã¥ó¥Ð¥¹¤¬¤É¤¦¤ä¤Ã¤Æ¥¹¥¯¥í¡¼¥ë¤¹¤ë¤Î¤«¤ò¼¨¤¹¥°¥ê¥Ã¥É¡£',
+ '6. キャンãƒã‚¹ãŒã©ã†ã‚„ã£ã¦ã‚¹ã‚¯ãƒ­ãƒ¼ãƒ«ã™ã‚‹ã®ã‹ã‚’示ã™ã‚°ãƒªãƒƒãƒ‰ã€‚',
(d6 = TkTextTag.new(t)) )
# binding
diff --git a/ext/tk/sample/demos-jp/bitmap.rb b/ext/tk/sample/demos-jp/bitmap.rb
index 1193e8de24..d84e9a5f09 100644
--- a/ext/tk/sample/demos-jp/bitmap.rb
+++ b/ext/tk/sample/demos-jp/bitmap.rb
@@ -1,4 +1,4 @@
-# -*- coding: euc-jp -*-
+# -*- coding: utf-8 -*-
#
# bitmap widget demo (called by 'widget')
#
@@ -25,13 +25,13 @@ def bitmapRow(w,*args)
}
end
-# toplevel widget ¤¬Â¸ºß¤¹¤ì¤Ðºï½ü¤¹¤ë
+# toplevel widget ãŒå­˜åœ¨ã™ã‚Œã°å‰Šé™¤ã™ã‚‹
if defined?($bitmap_demo) && $bitmap_demo
$bitmap_demo.destroy
$bitmap_demo = nil
end
-# demo ÍѤΠtoplevel widget ¤òÀ¸À®
+# demo 用㮠toplevel widget を生æˆ
$bitmap_demo = TkToplevel.new {|w|
title("Bitmap Demonstration")
iconname("bitmap")
@@ -40,17 +40,17 @@ $bitmap_demo = TkToplevel.new {|w|
base_frame = TkFrame.new($bitmap_demo).pack(:fill=>:both, :expand=>true)
-# label À¸À®
+# label 生æˆ
TkLabel.new(base_frame,'font'=>$font,'wraplength'=>'4i','justify'=>'left',
- 'text'=>"¤³¤Î¥¦¥£¥ó¥É¥¦¤Ë¤Ï¡¢Tk ¤ËÁȤ߹þ¤Þ¤ì¤¿¤¹¤Ù¤Æ¤Î¥Ó¥Ã¥È¥Þ¥Ã¥×¤¬¡¢¤½¤ì¤é¤Î̾Á°¤È¶¦¤Ëɽ¼¨¤µ¤ì¤Æ¤¤¤Þ¤¹¡£Tcl ¤Î¥¹¥¯¥ê¥×¥ÈÃæ¤Ç¤Ï¡¢¤½¤ì¤¾¤ì¤Î̾Á°¤òÍѤ¤¤Æ»²¾È¤·¤Þ¤¹¡£"){
+ 'text'=>"ã“ã®ã‚¦ã‚£ãƒ³ãƒ‰ã‚¦ã«ã¯ã€Tk ã«çµ„ã¿è¾¼ã¾ã‚ŒãŸã™ã¹ã¦ã®ãƒ“ットマップãŒã€ãれらã®åå‰ã¨å…±ã«è¡¨ç¤ºã•れã¦ã„ã¾ã™ã€‚Tcl ã®ã‚¹ã‚¯ãƒªãƒ—ト中ã§ã¯ã€ãれãžã‚Œã®åå‰ã‚’用ã„ã¦å‚ç…§ã—ã¾ã™ã€‚"){
pack('side'=>'top')
}
-# frame À¸À®
+# frame 生æˆ
$bitmap_buttons = TkFrame.new(base_frame) {|frame|
TkButton.new(frame) {
- #text 'λ²ò'
- text 'ÊĤ¸¤ë'
+ #text '了解'
+ text 'é–‰ã˜ã‚‹'
command proc{
tmppath = $bitmap_demo
$bitmap_demo = nil
@@ -59,13 +59,13 @@ $bitmap_buttons = TkFrame.new(base_frame) {|frame|
}.pack('side'=>'left', 'expand'=>'yes')
TkButton.new(frame) {
- text '¥³¡¼¥É»²¾È'
+ text 'コードå‚ç…§'
command proc{showCode 'bitmap'}
}.pack('side'=>'left', 'expand'=>'yes')
}
$bitmap_buttons.pack('side'=>'bottom', 'fill'=>'x', 'pady'=>'2m')
-# frame ÀßÄê
+# frame 設定
TkFrame.new(base_frame){|f|
bitmapRow(f,'error','gray25','gray50','hourglass')
bitmapRow(f,'info','question','questhead','warning')
diff --git a/ext/tk/sample/demos-jp/button.rb b/ext/tk/sample/demos-jp/button.rb
index 87ced45810..301100b057 100644
--- a/ext/tk/sample/demos-jp/button.rb
+++ b/ext/tk/sample/demos-jp/button.rb
@@ -1,36 +1,36 @@
-# -*- coding: euc-jp -*-
+# -*- coding: utf-8 -*-
#
# button widget demo (called by 'widget')
#
#
-# toplevel widget ¤¬Â¸ºß¤¹¤ì¤Ðºï½ü¤¹¤ë
+# toplevel widget ãŒå­˜åœ¨ã™ã‚Œã°å‰Šé™¤ã™ã‚‹
if defined?($button_demo) && $button_demo
$button_demo.destroy
$button_demo = nil
end
-# demo ÍѤΠtoplevel widget ¤òÀ¸À®
+# demo 用㮠toplevel widget を生æˆ
$button_demo = TkToplevel.new {|w|
title("Button Demonstration")
iconname("button")
positionWindow(w)
}
-# label À¸À®
+# label 生æˆ
msg = TkLabel.new($button_demo) {
font $kanji_font
wraplength '4i'
justify 'left'
- text "¥Ü¥¿¥ó¤ò¥¯¥ê¥Ã¥¯¤¹¤ë¤È¡¢¥Ü¥¿¥ó¤ÎÇØ·Ê¿§¤¬¤½¤Î¥Ü¥¿¥ó¤Ë½ñ¤«¤ì¤Æ¤¤¤ë¿§¤Ë¤Ê¤ê¤Þ¤¹¡£¥Ü¥¿¥ó¤«¤é¥Ü¥¿¥ó¤Ø¤Î°Üư¤Ï¥¿¥Ö¤ò²¡¤¹¤³¤È¤Ç¤â²Äǽ¤Ç¤¹¡£¤Þ¤¿¥¹¥Ú¡¼¥¹¤Ç¼Â¹Ô¤¹¤ë¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£"
+ text "ボタンをクリックã™ã‚‹ã¨ã€ãƒœã‚¿ãƒ³ã®èƒŒæ™¯è‰²ãŒãã®ãƒœã‚¿ãƒ³ã«æ›¸ã‹ã‚Œã¦ã„る色ã«ãªã‚Šã¾ã™ã€‚ボタンã‹ã‚‰ãƒœã‚¿ãƒ³ã¸ã®ç§»å‹•ã¯ã‚¿ãƒ–を押ã™ã“ã¨ã§ã‚‚å¯èƒ½ã§ã™ã€‚ã¾ãŸã‚¹ãƒšãƒ¼ã‚¹ã§å®Ÿè¡Œã™ã‚‹ã“ã¨ãŒã§ãã¾ã™ã€‚"
}
msg.pack('side'=>'top')
-# frame À¸À®
+# frame 生æˆ
$button_buttons = Tk::Frame.new($button_demo) {|frame|
TkButton.new(frame) {
- #text 'λ²ò'
- text 'ÊĤ¸¤ë'
+ #text '了解'
+ text 'é–‰ã˜ã‚‹'
command proc{
tmppath = $button_demo
$button_demo = nil
@@ -39,13 +39,13 @@ $button_buttons = Tk::Frame.new($button_demo) {|frame|
}.pack('side'=>'left', 'expand'=>'yes')
TkButton.new(frame) {
- text '¥³¡¼¥É»²¾È'
+ text 'コードå‚ç…§'
command proc{showCode 'button'}
}.pack('side'=>'left', 'expand'=>'yes')
}.pack('side'=>'bottom', 'fill'=>'x', 'pady'=>'2m')
-# button À¸À®
+# button 生æˆ
TkButton.new($button_demo){
text "Peach Puff"
width 10
diff --git a/ext/tk/sample/demos-jp/check.rb b/ext/tk/sample/demos-jp/check.rb
index 762b99778b..422e898ec9 100644
--- a/ext/tk/sample/demos-jp/check.rb
+++ b/ext/tk/sample/demos-jp/check.rb
@@ -1,15 +1,15 @@
-# -*- coding: euc-jp -*-
+# -*- coding: utf-8 -*-
#
# checkbutton widget demo (called by 'widget')
#
-# toplevel widget ¤¬Â¸ºß¤¹¤ì¤Ðºï½ü¤¹¤ë
+# toplevel widget ãŒå­˜åœ¨ã™ã‚Œã°å‰Šé™¤ã™ã‚‹
if defined?($check_demo) && $check_demo
$check_demo.destroy
$check_demo = nil
end
-# demo ÍѤΠtoplevel widget ¤òÀ¸À®
+# demo 用㮠toplevel widget を生æˆ
$check_demo = TkToplevel.new {|w|
title("Checkbutton Demonstration")
iconname("check")
@@ -18,25 +18,25 @@ $check_demo = TkToplevel.new {|w|
base_frame = TkFrame.new($check_demo).pack(:fill=>:both, :expand=>true)
-# label À¸À®
+# label 生æˆ
msg = TkLabel.new(base_frame) {
font $font
wraplength '4i'
justify 'left'
- text "²¼¤Ë¤Ï 3 ¤Ä¤Î¥Á¥§¥Ã¥¯¥Ü¥¿¥ó¤¬É½¼¨¤µ¤ì¤Æ¤¤¤Þ¤¹¡£¥¯¥ê¥Ã¥¯¤¹¤ë¤È¥Ü¥¿¥ó¤ÎÁªÂò¾õÂÖ¤¬ÊѤï¤ê¡¢Tcl ÊÑ¿ô ( TkVariable ¥ª¥Ö¥¸¥§¥¯¥È¤Ç¥¢¥¯¥»¥¹¤Ç¤­¤Þ¤¹ ) ¤Ë¤½¤Î¥Ü¥¿¥ó¤Î¾õÂÖ¤ò¼¨¤¹ÃͤòÀßÄꤷ¤Þ¤¹¡£¸½ºß¤ÎÊÑ¿ô¤ÎÃͤò¸«¤ë¤Ë¤Ï¡ÖÊÑ¿ô»²¾È¡×¥Ü¥¿¥ó¤ò¥¯¥ê¥Ã¥¯¤·¤Æ¤¯¤À¤µ¤¤¡£"
+ text "下ã«ã¯ 3 ã¤ã®ãƒã‚§ãƒƒã‚¯ãƒœã‚¿ãƒ³ãŒè¡¨ç¤ºã•れã¦ã„ã¾ã™ã€‚クリックã™ã‚‹ã¨ãƒœã‚¿ãƒ³ã®é¸æŠžçŠ¶æ…‹ãŒå¤‰ã‚りã€Tcl 変数 ( TkVariable オブジェクトã§ã‚¢ã‚¯ã‚»ã‚¹ã§ãã¾ã™ ) ã«ãã®ãƒœã‚¿ãƒ³ã®çŠ¶æ…‹ã‚’ç¤ºã™å€¤ã‚’設定ã—ã¾ã™ã€‚ç¾åœ¨ã®å¤‰æ•°ã®å€¤ã‚’見るã«ã¯ã€Œå¤‰æ•°å‚ç…§ã€ãƒœã‚¿ãƒ³ã‚’クリックã—ã¦ãã ã•ã„。"
}
msg.pack('side'=>'top')
-# ÊÑ¿ôÀ¸À®
+# 変数生æˆ
wipers = TkVariable.new(0)
brakes = TkVariable.new(0)
sober = TkVariable.new(0)
-# frame À¸À®
+# frame 生æˆ
TkFrame.new(base_frame) {|frame|
TkButton.new(frame) {
- #text 'λ²ò'
- text 'ÊĤ¸¤ë'
+ #text '了解'
+ text 'é–‰ã˜ã‚‹'
command proc{
tmppath = $check_demo
$check_demo = nil
@@ -46,13 +46,13 @@ TkFrame.new(base_frame) {|frame|
}.pack('side'=>'left', 'expand'=>'yes')
TkButton.new(frame) {
- text '¥³¡¼¥É»²¾È'
+ text 'コードå‚ç…§'
command proc{showCode 'check'}
}.pack('side'=>'left', 'expand'=>'yes')
TkButton.new(frame) {
- text 'ÊÑ¿ô»²¾È'
+ text '変数å‚ç…§'
command proc{
showVars(base_frame,
['wipers', wipers], ['brakes', brakes], ['sober', sober])
@@ -62,9 +62,9 @@ TkFrame.new(base_frame) {|frame|
}.pack('side'=>'bottom', 'fill'=>'x', 'pady'=>'2m')
-# checkbutton À¸À®
-[ TkCheckButton.new(base_frame, 'text'=>'¥ï¥¤¥Ñ¡¼ OK', 'variable'=>wipers),
- TkCheckButton.new(base_frame, 'text'=>'¥Ö¥ì¡¼¥­ OK', 'variable'=>brakes),
- TkCheckButton.new(base_frame, 'text'=>'±¿Å¾¼ê ÁÇÌÌ', 'variable'=>sober)
+# checkbutton 生æˆ
+[ TkCheckButton.new(base_frame, 'text'=>'ワイパー OK', 'variable'=>wipers),
+ TkCheckButton.new(base_frame, 'text'=>'ブレーキ OK', 'variable'=>brakes),
+ TkCheckButton.new(base_frame, 'text'=>'é‹è»¢æ‰‹ ç´ é¢', 'variable'=>sober)
].each{|w| w.relief('flat'); w.pack('side'=>'top', 'pady'=>2, 'anchor'=>'w')}
diff --git a/ext/tk/sample/demos-jp/check2.rb b/ext/tk/sample/demos-jp/check2.rb
index 9f845183f3..558e588535 100644
--- a/ext/tk/sample/demos-jp/check2.rb
+++ b/ext/tk/sample/demos-jp/check2.rb
@@ -1,15 +1,15 @@
-# -*- coding: euc-jp -*-
+# -*- coding: utf-8 -*-
#
# checkbutton widget demo2 (called by 'widget')
#
-# toplevel widget ¤¬Â¸ºß¤¹¤ì¤Ðºï½ü¤¹¤ë
+# toplevel widget ãŒå­˜åœ¨ã™ã‚Œã°å‰Šé™¤ã™ã‚‹
if defined?($check2_demo) && $check2_demo
$check2_demo.destroy
$check2_demo = nil
end
-# demo ÍѤΠtoplevel widget ¤òÀ¸À®
+# demo 用㮠toplevel widget を生æˆ
$check2_demo = TkToplevel.new {|w|
title("Checkbutton Demonstration 2")
iconname("check2")
@@ -18,37 +18,37 @@ $check2_demo = TkToplevel.new {|w|
base_frame = TkFrame.new($check2_demo).pack(:fill=>:both, :expand=>true)
-# label À¸À®
+# label 生æˆ
msg = TkLabel.new(base_frame) {
font $font
wraplength '4i'
justify 'left'
- text "²¼¤Ë¤Ï£´¤Ä¤Î¥Á¥§¥Ã¥¯¥Ü¥¿¥ó¤¬É½¼¨¤µ¤ì¤Æ¤¤¤Þ¤¹¡£¥¯¥ê¥Ã¥¯¤¹¤ë¤È¥Ü¥¿¥ó¤ÎÁªÂò¾õÂÖ¤¬ÊѤï¤ê¡¢TclÊÑ¿ô¡ÊTkVariable¥ª¥Ö¥¸¥§¥¯¥È¤Ç¥¢¥¯¥»¥¹¤Ç¤­¤Þ¤¹¡Ë¤Ë¤½¤Î¥Ü¥¿¥ó¤Î¾õÂÖ¤ò¼¨¤¹ÃͤòÀßÄꤷ¤Þ¤¹¡£ºÇ½é¤Î¥Ü¥¿¥ó¤Î¾õÂ֤Ͼ¤Î£³¤Ä¤Î¥Ü¥¿¥ó¤Î¾õÂ֤ˤâ°Í¸¤·¤ÆÊѲ½¤·¤Þ¤¹¡£¤â¤·£³¤Ä¤Î¥Ü¥¿¥ó¤Î°ìÉô¤À¤±¤Ë¥Á¥§¥Ã¥¯¤¬ÉÕ¤±¤é¤ì¤Æ¤¤¤ë¾ì¹ç¡¢ºÇ½é¤Î¥Ü¥¿¥ó¤Ï¥È¥é¥¤¥¹¥Æ¡¼¥È¡Ê£³¾õÂ֡˥⡼¥É¤Ç¤Îɽ¼¨¤ò¹Ô¤¤¤Þ¤¹¡£¸½ºß¤ÎÊÑ¿ô¤ÎÃͤò¸«¤ë¤Ë¤Ï¡ÖÊÑ¿ô»²¾È¡×¥Ü¥¿¥ó¤ò¥¯¥ê¥Ã¥¯¤·¤Æ¤¯¤À¤µ¤¤¡£"
+ text "下ã«ã¯ï¼”ã¤ã®ãƒã‚§ãƒƒã‚¯ãƒœã‚¿ãƒ³ãŒè¡¨ç¤ºã•れã¦ã„ã¾ã™ã€‚クリックã™ã‚‹ã¨ãƒœã‚¿ãƒ³ã®é¸æŠžçŠ¶æ…‹ãŒå¤‰ã‚りã€Tcl変数(TkVariableオブジェクトã§ã‚¢ã‚¯ã‚»ã‚¹ã§ãã¾ã™ï¼‰ã«ãã®ãƒœã‚¿ãƒ³ã®çŠ¶æ…‹ã‚’ç¤ºã™å€¤ã‚’設定ã—ã¾ã™ã€‚最åˆã®ãƒœã‚¿ãƒ³ã®çŠ¶æ…‹ã¯ä»–ã®ï¼“ã¤ã®ãƒœã‚¿ãƒ³ã®çŠ¶æ…‹ã«ã‚‚ä¾å­˜ã—ã¦å¤‰åŒ–ã—ã¾ã™ã€‚ã‚‚ã—3ã¤ã®ãƒœã‚¿ãƒ³ã®ä¸€éƒ¨ã ã‘ã«ãƒã‚§ãƒƒã‚¯ãŒä»˜ã‘られã¦ã„ã‚‹å ´åˆã€æœ€åˆã®ãƒœã‚¿ãƒ³ã¯ãƒˆãƒ©ã‚¤ã‚¹ãƒ†ãƒ¼ãƒˆï¼ˆï¼“状態)モードã§ã®è¡¨ç¤ºã‚’行ã„ã¾ã™ã€‚ç¾åœ¨ã®å¤‰æ•°ã®å€¤ã‚’見るã«ã¯ã€Œå¤‰æ•°å‚ç…§ã€ãƒœã‚¿ãƒ³ã‚’クリックã—ã¦ãã ã•ã„。"
}
msg.pack('side'=>'top')
-# ÊÑ¿ôÀ¸À®
+# 変数生æˆ
safety = TkVariable.new(0)
wipers = TkVariable.new(0)
brakes = TkVariable.new(0)
sober = TkVariable.new(0)
-# frame À¸À®
+# frame 生æˆ
TkFrame.new(base_frame) {|frame|
TkGrid(TkFrame.new(frame, :height=>2, :relief=>:sunken, :bd=>2),
:columnspan=>4, :row=>0, :sticky=>'ew', :pady=>2)
TkGrid('x',
- TkButton.new(frame, :text=>'ÊÑ¿ô»²¾È',
+ TkButton.new(frame, :text=>'変数å‚ç…§',
:image=>$image['view'], :compound=>:left,
:command=>proc{
showVars($check2_demo,
['safety', safety], ['wipers', wipers],
['brakes', brakes], ['sober', sober])
}),
- TkButton.new(frame, :text=>'¥³¡¼¥É»²¾È',
+ TkButton.new(frame, :text=>'コードå‚ç…§',
:image=>$image['view'], :compound=>:left,
:command=>proc{showCode 'check2'}),
- TkButton.new(frame, :text=>'ÊĤ¸¤ë',
+ TkButton.new(frame, :text=>'é–‰ã˜ã‚‹',
:image=>$image['delete'], :compound=>:left,
:command=>proc{
tmppath = $check2_demo
@@ -61,16 +61,16 @@ TkFrame.new(base_frame) {|frame|
}.pack('side'=>'bottom', 'fill'=>'x')
-# checkbutton À¸À®
-TkCheckButton.new(base_frame, :text=>'°ÂÁ´À­¸¡ºº', :variable=>safety,
+# checkbutton 生æˆ
+TkCheckButton.new(base_frame, :text=>'安全性検査', :variable=>safety,
:relief=>:flat, :onvalue=>'all', :offvalue=>'none',
:tristatevalue=>'partial'){
pack('side'=>'top', 'pady'=>2, 'anchor'=>'w')
}
-[ TkCheckButton.new(base_frame, 'text'=>'¥ï¥¤¥Ñ¡¼ OK', 'variable'=>wipers),
- TkCheckButton.new(base_frame, 'text'=>'¥Ö¥ì¡¼¥­ OK', 'variable'=>brakes),
- TkCheckButton.new(base_frame, 'text'=>'±¿Å¾¼ê ÁÇÌÌ', 'variable'=>sober)
+[ TkCheckButton.new(base_frame, 'text'=>'ワイパー OK', 'variable'=>wipers),
+ TkCheckButton.new(base_frame, 'text'=>'ブレーキ OK', 'variable'=>brakes),
+ TkCheckButton.new(base_frame, 'text'=>'é‹è»¢æ‰‹ ç´ é¢', 'variable'=>sober)
].each{|w|
w.relief('flat')
w.pack('side'=>'top', 'padx'=>15, 'pady'=>2, 'anchor'=>'w')
diff --git a/ext/tk/sample/demos-jp/clrpick.rb b/ext/tk/sample/demos-jp/clrpick.rb
index c188723c5a..df8c76a69d 100644
--- a/ext/tk/sample/demos-jp/clrpick.rb
+++ b/ext/tk/sample/demos-jp/clrpick.rb
@@ -1,35 +1,35 @@
-# -*- coding: euc-jp -*-
+# -*- coding: utf-8 -*-
#
# widget demo prompts the user to select a color (called by 'widget')
#
# Note: don't support ttk_wrapper. work with standard widgets only.
#
-# toplevel widget ¤¬Â¸ºß¤¹¤ì¤Ðºï½ü¤¹¤ë
+# toplevel widget ãŒå­˜åœ¨ã™ã‚Œã°å‰Šé™¤ã™ã‚‹
if defined?($clrpick_demo) && $clrpick_demo
$clrpick_demo.destroy
$clrpick_demo = nil
end
-# demo ÍѤΠtoplevel widget ¤òÀ¸À®
+# demo 用㮠toplevel widget を生æˆ
$clrpick_demo = TkToplevel.new {|w|
title("Color Selection Dialogs")
iconname("colors")
positionWindow(w)
}
-# label À¸À®
+# label 生æˆ
#TkLabel.new($clrpick_demo,'font'=>$font,'wraplength'=>'4i','justify'=>'left',
Tk::Label.new($clrpick_demo,'font'=>$font,'wraplength'=>'4i','justify'=>'left',
- 'text'=>"°Ê²¼¤Î¥Ü¥¿¥ó¤ò²¡¤·¤Æ¡¢¤³¤Î¥¦¥£¥ó¥É¥¦¾å¤Ë¤¢¤ë¥¦¥£¥¸¥§¥Ã¥È¤ÎÁ°·Ê¿§¤ÈÇØ·Ê¿§¤òÁªÂò¤·¤Æ²¼¤µ¤¤¡£").pack('side'=>'top')
+ 'text'=>"以下ã®ãƒœã‚¿ãƒ³ã‚’押ã—ã¦ã€ã“ã®ã‚¦ã‚£ãƒ³ãƒ‰ã‚¦ä¸Šã«ã‚るウィジェットã®å‰æ™¯è‰²ã¨èƒŒæ™¯è‰²ã‚’é¸æŠžã—ã¦ä¸‹ã•ã„。").pack('side'=>'top')
-# frame À¸À®
+# frame 生æˆ
# TkFrame.new($clrpick_demo) {|frame|
Tk::Frame.new($clrpick_demo) {|frame|
# TkButton.new(frame) {
Tk::Button.new(frame) {
- #text 'λ²ò'
- text 'ÊĤ¸¤ë'
+ #text '了解'
+ text 'é–‰ã˜ã‚‹'
command proc{
tmppath = $clrpick_demo
$clrpick_demo = nil
@@ -39,21 +39,21 @@ Tk::Frame.new($clrpick_demo) {|frame|
# TkButton.new(frame) {
Tk::Button.new(frame) {
- text '¥³¡¼¥É»²¾È'
+ text 'コードå‚ç…§'
command proc{showCode 'clrpick'}
}.pack('side'=>'left', 'expand'=>'yes')
}.pack('side'=>'bottom', 'fill'=>'x', 'pady'=>'2m')
-# button À¸À®
-# TkButton.new($clrpick_demo, 'text'=>'ÇØ·Ê¿§¤òÀßÄê ...') {|b|
-Tk::Button.new($clrpick_demo, 'text'=>'ÇØ·Ê¿§¤òÀßÄê ...') {|b|
+# button 生æˆ
+# TkButton.new($clrpick_demo, 'text'=>'背景色を設定 ...') {|b|
+Tk::Button.new($clrpick_demo, 'text'=>'背景色を設定 ...') {|b|
command(proc{setColor $clrpick_demo, b, 'background',
['background', 'highlightbackground']})
pack('side'=>'top', 'anchor'=>'c', 'pady'=>'2m')
}
-# TkButton.new($clrpick_demo, 'text'=>'Á°·Ê¿§¤òÀßÄê ...') {|b|
-Tk::Button.new($clrpick_demo, 'text'=>'Á°·Ê¿§¤òÀßÄê ...') {|b|
+# TkButton.new($clrpick_demo, 'text'=>'剿™¯è‰²ã‚’設定 ...') {|b|
+Tk::Button.new($clrpick_demo, 'text'=>'剿™¯è‰²ã‚’設定 ...') {|b|
command(proc{setColor $clrpick_demo, b, 'foreground', ['foreground']})
pack('side'=>'top', 'anchor'=>'c', 'pady'=>'2m')
}
diff --git a/ext/tk/sample/demos-jp/colors.rb b/ext/tk/sample/demos-jp/colors.rb
index 9fcf0333b5..5e5f47cb04 100644
--- a/ext/tk/sample/demos-jp/colors.rb
+++ b/ext/tk/sample/demos-jp/colors.rb
@@ -1,15 +1,15 @@
-# -*- coding: euc-jp -*-
+# -*- coding: utf-8 -*-
#
# listbox widget demo 'colors' (called by 'widget')
#
-# toplevel widget ¤¬Â¸ºß¤¹¤ì¤Ðºï½ü¤¹¤ë
+# toplevel widget ãŒå­˜åœ¨ã™ã‚Œã°å‰Šé™¤ã™ã‚‹
if defined?($colors_demo) && $colors_demo
$colors_demo.destroy
$colors_demo = nil
end
-# demo ÍѤΠtoplevel widget ¤òÀ¸À®
+# demo 用㮠toplevel widget を生æˆ
$colors_demo = TkToplevel.new {|w|
title("Listbox Demonstration (colors)")
iconname("colors")
@@ -18,20 +18,20 @@ $colors_demo = TkToplevel.new {|w|
base_frame = TkFrame.new($colors_demo).pack(:fill=>:both, :expand=>true)
-# label À¸À®
+# label 生æˆ
msg = TkLabel.new(base_frame) {
font $font
wraplength '4i'
justify 'left'
- text "²¼¤Ë¤Ï¿§¤Î̾Á°¤¬Æþ¤Ã¤¿¥¹¥¯¥í¡¼¥ë¥Ð¡¼ÉդΥꥹ¥È¥Ü¥Ã¥¯¥¹¤¬É½¼¨¤µ¤ì¤Æ¤¤¤Þ¤¹¡£¥ê¥¹¥È¤ò¥¹¥¯¥í¡¼¥ë¤µ¤»¤ë¤Î¤Ï¥¹¥¯¥í¡¼¥ë¥Ð¡¼¤Ç¤â¤Ç¤­¤Þ¤¹¤·¡¢¥ê¥¹¥È¥Ü¥Ã¥¯¥¹¤ÎÃæ¤Ç¥Þ¥¦¥¹¤Î¥Ü¥¿¥ó2(Ãæ¥Ü¥¿¥ó)¤ò²¡¤·¤¿¤Þ¤Þ¥É¥é¥Ã¥°¤·¤Æ¤â¤Ç¤­¤Þ¤¹¡£¤¢¤ë¿§¤ò¥Ü¥¿¥ó1(º¸¥Ü¥¿¥ó)¤Ç¥À¥Ö¥ë¥¯¥ê¥Ã¥¯¤¹¤ë¤È¥¢¥×¥ê¥±¡¼¥·¥ç¥óÁ´ÂΤ¬¤½¤Î¿§¤Ë¤Ê¤ê¤Þ¤¹¡£"
+ text "下ã«ã¯è‰²ã®åå‰ãŒå…¥ã£ãŸã‚¹ã‚¯ãƒ­ãƒ¼ãƒ«ãƒãƒ¼ä»˜ã®ãƒªã‚¹ãƒˆãƒœãƒƒã‚¯ã‚¹ãŒè¡¨ç¤ºã•れã¦ã„ã¾ã™ã€‚リストをスクロールã•ã›ã‚‹ã®ã¯ã‚¹ã‚¯ãƒ­ãƒ¼ãƒ«ãƒãƒ¼ã§ã‚‚ã§ãã¾ã™ã—ã€ãƒªã‚¹ãƒˆãƒœãƒƒã‚¯ã‚¹ã®ä¸­ã§ãƒžã‚¦ã‚¹ã®ãƒœã‚¿ãƒ³2(中ボタン)を押ã—ãŸã¾ã¾ãƒ‰ãƒ©ãƒƒã‚°ã—ã¦ã‚‚ã§ãã¾ã™ã€‚ã‚る色をボタン1(左ボタン)ã§ãƒ€ãƒ–ルクリックã™ã‚‹ã¨ã‚¢ãƒ—リケーション全体ãŒãã®è‰²ã«ãªã‚Šã¾ã™ã€‚"
}
msg.pack('side'=>'top')
-# frame À¸À®
+# frame 生æˆ
TkFrame.new(base_frame) {|frame|
TkButton.new(frame) {
- #text 'λ²ò'
- text 'ÊĤ¸¤ë'
+ #text '了解'
+ text 'é–‰ã˜ã‚‹'
command proc{
tmppath = $colors_demo
$colors_demo = nil
@@ -40,13 +40,13 @@ TkFrame.new(base_frame) {|frame|
}.pack('side'=>'left', 'expand'=>'yes')
TkButton.new(frame) {
- text '¥³¡¼¥É»²¾È'
+ text 'コードå‚ç…§'
command proc{showCode 'colors'}
}.pack('side'=>'left', 'expand'=>'yes')
}.pack('side'=>'bottom', 'fill'=>'x', 'pady'=>'2m')
-# frame À¸À®
+# frame 生æˆ
colors_lbox = nil
TkFrame.new(base_frame, 'borderwidth'=>10) {|w|
s = TkScrollbar.new(w)
diff --git a/ext/tk/sample/demos-jp/combo.rb b/ext/tk/sample/demos-jp/combo.rb
index 2059662d48..8bbe36997d 100644
--- a/ext/tk/sample/demos-jp/combo.rb
+++ b/ext/tk/sample/demos-jp/combo.rb
@@ -1,4 +1,4 @@
-# -*- coding: euc-jp -*-
+# -*- coding: utf-8 -*-
#
# combo.rb --
#
@@ -21,16 +21,16 @@ base_frame = TkFrame.new($combo_demo).pack(:fill=>:both, :expand=>true)
Ttk::Label.new(base_frame, :font=>$font, :wraplength=>'5i', :justify=>:left,
:text=><<EOL).pack(:side=>:top, :fill=>:x)
-°Ê²¼¤Ç¤Ï3¼ïÎà¤Î¥³¥ó¥Ü¥Ü¥Ã¥¯¥¹¤¬É½¼¨¤µ¤ì¤Æ¤¤¤Þ¤¹¡¥\
-ºÇ½é¤Î¤â¤Î¤Ï¡¤¥¨¥ó¥È¥ê¥¦¥£¥¸¥§¥Ã¥È¤ÈƱ¤¸Íͤˡ¤\
-¥Ý¥¤¥ó¥È¤·¤¿¤ê¡¤¥¯¥ê¥Ã¥¯¤·¤¿¤ê¡¤¥¿¥¤¥×¤·¤¿¤ê¤¹¤ë¤³¤È¤¬¤Ç¤­¤Þ¤¹¡¥\
-¤Þ¤¿¡¤Return¥­¡¼¤òÆþÎϤ¹¤ì¤Ð¸½ºß¤ÎÃͤ¬¥ê¥¹¥È¤ËÄɲ䵤졤\
-¥É¥í¥Ã¥×¥À¥¦¥ó¥ê¥¹¥È¤«¤éÁªÂò¤¹¤ë¤³¤È¤¬¤Ç¤­¤ë¤è¤¦¤Ë¤Ê¤ê¤Þ¤¹¡¥\
-¢­(²¼¸þ¤­Ìð°õ)¥­¡¼¤ò²¡¤·¤ÆÉ½¼¨¤µ¤ì¤¿¥ê¥¹¥È¤«¤é\
-Ìð°õ¥­¡¼¤Ç¾¤Î¸õÊä¤òÁª¤ó¤ÇReturn¥­¡¼¤ò²¡¤»¤Ð¡¤ÃͤòÁªÂò¤Ç¤­¤Þ¤¹¡¥\
-2ÈÖÌܤΥ³¥ó¥Ü¥Ü¥Ã¥¯¥¹¤ÏÆÃÄê¤ÎÃͤ˸ÇÄꤵ¤ì¤Æ¤ª¤ê¡¤°ìÀÚÊѹ¹¤Ç¤­¤Þ¤»¤ó¡¥\
-3ÈÖÌܤΤâ¤Î¤Ï¥ª¡¼¥¹¥È¥é¥ê¥¢¤ÎÅԻԤΥɥí¥Ã¥×¥À¥¦¥ó¥ê¥¹¥È¤«¤é\
-ÁªÂò¤¹¤ë¤³¤È¤À¤±¤¬²Äǽ¤È¤Ê¤Ã¤Æ¤¤¤Þ¤¹¡¥
+以下ã§ã¯3種類ã®ã‚³ãƒ³ãƒœãƒœãƒƒã‚¯ã‚¹ãŒè¡¨ç¤ºã•れã¦ã„ã¾ã™ï¼Ž\
+最åˆã®ã‚‚ã®ã¯ï¼Œã‚¨ãƒ³ãƒˆãƒªã‚¦ã‚£ã‚¸ã‚§ãƒƒãƒˆã¨åŒã˜æ§˜ã«ï¼Œ\
+ãƒã‚¤ãƒ³ãƒˆã—ãŸã‚Šï¼Œã‚¯ãƒªãƒƒã‚¯ã—ãŸã‚Šï¼Œã‚¿ã‚¤ãƒ—ã—ãŸã‚Šã™ã‚‹ã“ã¨ãŒã§ãã¾ã™ï¼Ž\
+ã¾ãŸï¼ŒReturnキーを入力ã™ã‚Œã°ç¾åœ¨ã®å€¤ãŒãƒªã‚¹ãƒˆã«è¿½åŠ ã•れ,\
+ドロップダウンリストã‹ã‚‰é¸æŠžã™ã‚‹ã“ã¨ãŒã§ãるよã†ã«ãªã‚Šã¾ã™ï¼Ž\
+↓(下å‘ã矢å°)キーを押ã—ã¦è¡¨ç¤ºã•れãŸãƒªã‚¹ãƒˆã‹ã‚‰\
+矢å°ã‚­ãƒ¼ã§ä»–ã®å€™è£œã‚’é¸ã‚“ã§Returnキーを押ã›ã°ï¼Œå€¤ã‚’é¸æŠžã§ãã¾ã™ï¼Ž\
+2番目ã®ã‚³ãƒ³ãƒœãƒœãƒƒã‚¯ã‚¹ã¯ç‰¹å®šã®å€¤ã«å›ºå®šã•れã¦ãŠã‚Šï¼Œä¸€åˆ‡å¤‰æ›´ã§ãã¾ã›ã‚“.\
+3番目ã®ã‚‚ã®ã¯ã‚ªãƒ¼ã‚¹ãƒˆãƒ©ãƒªã‚¢ã®éƒ½å¸‚ã®ãƒ‰ãƒ­ãƒƒãƒ—ダウンリストã‹ã‚‰\
+é¸æŠžã™ã‚‹ã“ã¨ã ã‘ãŒå¯èƒ½ã¨ãªã£ã¦ã„ã¾ã™ï¼Ž
EOL
## variables
@@ -43,7 +43,7 @@ Ttk::Frame.new(base_frame) {|frame|
sep = Ttk::Separator.new(frame)
Tk.grid(sep, :columnspan=>4, :row=>0, :sticky=>'ew', :pady=>2)
TkGrid('x',
- Ttk::Button.new(frame, :text=>'ÊÑ¿ô»²¾È',
+ Ttk::Button.new(frame, :text=>'変数å‚ç…§',
:image=>$image['view'], :compound=>:left,
:command=>proc{
showVars(base_frame,
@@ -51,10 +51,10 @@ Ttk::Frame.new(base_frame) {|frame|
['secondVariable', secondValue],
['ozCity', ozCity])
}),
- Ttk::Button.new(frame, :text=>'¥³¡¼¥É»²¾È',
+ Ttk::Button.new(frame, :text=>'コードå‚ç…§',
:image=>$image['view'], :compound=>:left,
:command=>proc{showCode 'combo'}),
- Ttk::Button.new(frame, :text=>'ÊĤ¸¤ë',
+ Ttk::Button.new(frame, :text=>'é–‰ã˜ã‚‹',
:image=>$image['delete'], :compound=>:left,
:command=>proc{
$combo_demo.destroy
@@ -68,13 +68,13 @@ Ttk::Frame.new(base_frame) {|frame|
frame = Ttk::Frame.new(base_frame).pack(:fill=>:both, :expand=>true)
australianCities = [
- '¥­¥ã¥ó¥Ù¥é', '¥·¥É¥Ë¡¼', '¥á¥ë¥Ü¥ë¥ó', '¥Ñ¡¼¥¹', '¥¢¥Ç¥ì¡¼¥É',
- '¥Ö¥ê¥¹¥Ù¡¼¥ó', '¥Û¥Ð¡¼¥È', '¥À¡¼¥¦¥£¥ó', '¥¢¥ê¥¹ ¥¹¥×¥ê¥ó¥°¥¹'
+ 'キャンベラ', 'シドニー', 'メルボルン', 'パース', 'アデレード',
+ 'ブリスベーン', 'ホãƒãƒ¼ãƒˆ', 'ダーウィン', 'アリス スプリングス'
]
-secondValue.value = 'Êѹ¹ÉÔ²Ä'
-ozCity.value = '¥·¥É¥Ë¡¼'
+secondValue.value = '変更ä¸å¯'
+ozCity.value = 'シドニー'
Tk.pack(Ttk::Labelframe.new(frame, :text=>'Fully Editable'){|f|
Ttk::Combobox.new(f, :textvariable=>firstValue){|b|
diff --git a/ext/tk/sample/demos-jp/cscroll.rb b/ext/tk/sample/demos-jp/cscroll.rb
index 0a31f28b5e..e993326aa9 100644
--- a/ext/tk/sample/demos-jp/cscroll.rb
+++ b/ext/tk/sample/demos-jp/cscroll.rb
@@ -1,15 +1,15 @@
-# -*- coding: euc-jp -*-
+# -*- coding: utf-8 -*-
#
# simple scrollable canvas widget demo (called by 'widget')
#
-# toplevel widget ¤¬Â¸ºß¤¹¤ì¤Ðºï½ü¤¹¤ë
+# toplevel widget ãŒå­˜åœ¨ã™ã‚Œã°å‰Šé™¤ã™ã‚‹
if defined?($cscroll_demo) && $cscroll_demo
$cscroll_demo.destroy
$cscroll_demo = nil
end
-# demo ÍѤΠtoplevel widget ¤òÀ¸À®
+# demo 用㮠toplevel widget を生æˆ
$cscroll_demo = TkToplevel.new {|w|
title("Scrollable Canvas Demonstration")
iconname("cscroll")
@@ -18,17 +18,17 @@ $cscroll_demo = TkToplevel.new {|w|
base_frame = TkFrame.new($cscroll_demo).pack(:fill=>:both, :expand=>true)
-# label À¸À®
+# label 生æˆ
TkLabel.new(base_frame, 'font'=>$font, 'wraplength'=>'4i',
- 'justify'=>'left', 'text'=>"¤³¤Î¥¦¥£¥ó¥É¥¦¤Ë¤Ï¥¹¥¯¥í¡¼¥ë¥Ð¡¼¤ä¥Þ¥¦¥¹¤Î¥Ü¥¿¥ó2 ¤Ç¥¹¥¯¥í¡¼¥ë¤Ç¤­¤ë¥­¥ã¥ó¥Ð¥¹ widget ¤¬É½¼¨¤µ¤ì¤Æ¤¤¤Þ¤¹¡£»Í³Ñ¤Î¾å¤Ç¥Ü¥¿¥ó1 ¤ò¥¯¥ê¥Ã¥¯¤¹¤ë¤È¡¢¤½¤Î¥¤¥ó¥Ç¥Ã¥¯¥¹¤¬É¸½à½ÐÎϤ˽ÐÎϤµ¤ì¤Þ¤¹¡£"){
+ 'justify'=>'left', 'text'=>"ã“ã®ã‚¦ã‚£ãƒ³ãƒ‰ã‚¦ã«ã¯ã‚¹ã‚¯ãƒ­ãƒ¼ãƒ«ãƒãƒ¼ã‚„マウスã®ãƒœã‚¿ãƒ³2 ã§ã‚¹ã‚¯ãƒ­ãƒ¼ãƒ«ã§ãるキャンãƒã‚¹ widget ãŒè¡¨ç¤ºã•れã¦ã„ã¾ã™ã€‚四角ã®ä¸Šã§ãƒœã‚¿ãƒ³1 をクリックã™ã‚‹ã¨ã€ãã®ã‚¤ãƒ³ãƒ‡ãƒƒã‚¯ã‚¹ãŒæ¨™æº–出力ã«å‡ºåŠ›ã•れã¾ã™ã€‚"){
pack('side'=>'top')
}
-# frame À¸À®
+# frame 生æˆ
$cscroll_buttons = TkFrame.new(base_frame) {|frame|
TkButton.new(frame) {
- #text 'λ²ò'
- text 'ÊĤ¸¤ë'
+ #text '了解'
+ text 'é–‰ã˜ã‚‹'
command proc{
tmppath = $cscroll_demo
$cscroll_demo = nil
@@ -37,13 +37,13 @@ $cscroll_buttons = TkFrame.new(base_frame) {|frame|
}.pack('side'=>'left', 'expand'=>'yes')
TkButton.new(frame) {
- text '¥³¡¼¥É»²¾È'
+ text 'コードå‚ç…§'
command proc{showCode 'cscroll'}
}.pack('side'=>'left', 'expand'=>'yes')
}
$cscroll_buttons.pack('side'=>'bottom', 'fill'=>'x', 'pady'=>'2m')
-# frame ÀßÄê
+# frame 設定
unless $tk_version =~ /^4\.[01]/
$cscroll_grid = TkFrame.new(base_frame) {
pack('expand'=>'yes', 'fill'=>'both', 'padx'=>1, 'pady'=>1)
@@ -52,7 +52,7 @@ unless $tk_version =~ /^4\.[01]/
TkGrid.columnconfigure($cscroll_grid, 0, 'weight'=>1, 'minsize'=>0)
end
-# canvas ÀßÄê
+# canvas 設定
$cscroll_canvas = TkCanvas.new(base_frame,
'relief'=>'sunken', 'borderwidth'=>2,
'scrollregion'=>['-11c', '-11c', '50c', '20c']
diff --git a/ext/tk/sample/demos-jp/ctext.rb b/ext/tk/sample/demos-jp/ctext.rb
index 70c1cad1a7..bb354c490e 100644
--- a/ext/tk/sample/demos-jp/ctext.rb
+++ b/ext/tk/sample/demos-jp/ctext.rb
@@ -1,15 +1,15 @@
-# -*- coding: euc-jp -*-
+# -*- coding: utf-8 -*-
#
# Canvas Text widget demo (called by 'widget')
#
-# toplevel widget ¤¬Â¸ºß¤¹¤ì¤Ðºï½ü¤¹¤ë
+# toplevel widget ãŒå­˜åœ¨ã™ã‚Œã°å‰Šé™¤ã™ã‚‹
if defined?($ctext_demo) && $ctext_demo
$ctext_demo.destroy
$ctext_demo = nil
end
-# demo ÍѤΠtoplevel widget ¤òÀ¸À®
+# demo 用㮠toplevel widget を生æˆ
$ctext_demo = TkToplevel.new {|w|
title("Canvas Text Demonstration")
iconname("Text")
@@ -18,23 +18,23 @@ $ctext_demo = TkToplevel.new {|w|
base_frame = TkFrame.new($ctext_demo).pack(:fill=>:both, :expand=>true)
-# label À¸À®
+# label 生æˆ
TkLabel.new(base_frame, 'font'=>$font, 'wraplength'=>'5i', 'justify'=>'left',
- 'text'=>"¤³¤Î¥¦¥£¥ó¥É¥¦¤Ë¤Ï¥­¥ã¥ó¥Ð¥¹widget¤Î¥Æ¥­¥¹¥Èµ¡Ç½¤ò¥Ç¥â¤¹¤ë¤¿¤á¤Î¥Æ¥­¥¹¥Èʸ»úÎó¤¬É½¼¨¤µ¤ì¤Æ¤¤¤Þ¤¹¡£¥Þ¥¦¥¹¤ò»Í³Ñ¤ÎÃæ¤Ë»ý¤Ã¤Æ¤¤¤­¡¢¥¯¥ê¥Ã¥¯¤¹¤ë¤È°ÌÃÖ¤®¤áÍѤÎÅÀ¤«¤é¤ÎÁêÂаÌÃÖ¤òÊѤ¨¤¿¤ê¡¢¹Ô·¤¨¤òÊѤ¨¤¿¤ê¤¹¤ë¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£¤Þ¤¿°Ê²¼¤Î¤è¤¦¤ÊÊÔ½¸¤Î¤¿¤á¤Î´Êñ¤Ê¥Ð¥¤¥ó¥Ç¥£¥ó¥°¤ò¥µ¥Ý¡¼¥È¤·¤Æ¤¤¤Þ¤¹¡£
+ 'text'=>"ã“ã®ã‚¦ã‚£ãƒ³ãƒ‰ã‚¦ã«ã¯ã‚­ãƒ£ãƒ³ãƒã‚¹widgetã®ãƒ†ã‚­ã‚¹ãƒˆæ©Ÿèƒ½ã‚’デモã™ã‚‹ãŸã‚ã®ãƒ†ã‚­ã‚¹ãƒˆæ–‡å­—列ãŒè¡¨ç¤ºã•れã¦ã„ã¾ã™ã€‚マウスを四角ã®ä¸­ã«æŒã£ã¦ã„ãã€ã‚¯ãƒªãƒƒã‚¯ã™ã‚‹ã¨ä½ç½®ãŽã‚用ã®ç‚¹ã‹ã‚‰ã®ç›¸å¯¾ä½ç½®ã‚’変ãˆãŸã‚Šã€è¡Œæƒãˆã‚’変ãˆãŸã‚Šã™ã‚‹ã“ã¨ãŒã§ãã¾ã™ã€‚ã¾ãŸä»¥ä¸‹ã®ã‚ˆã†ãªç·¨é›†ã®ãŸã‚ã®ç°¡å˜ãªãƒã‚¤ãƒ³ãƒ‡ã‚£ãƒ³ã‚°ã‚’サãƒãƒ¼ãƒˆã—ã¦ã„ã¾ã™ã€‚
- 1. ¥Þ¥¦¥¹¤ò»ý¤Ã¤Æ¤¤¤­¡¢¥¯¥ê¥Ã¥¯¤·¡¢ÆþÎϤǤ­¤Þ¤¹¡£
- 2. ¥Ü¥¿¥ó1¤ÇÁªÂò¤Ç¤­¤Þ¤¹¡£
- 3. ¥Þ¥¦¥¹¤Î°ÌÃ֤˥ܥ¿¥ó2¤ÇÁªÂò¤·¤¿¥Æ¥­¥¹¥È¤ò¥³¥Ô¡¼¤Ç¤­¤Þ¤¹¡£
- 4.¥Ð¥Ã¥¯¥¹¥Ú¡¼¥¹¤ò¥³¥ó¥È¥í¡¼¥ë-H¤ÇÁÞÆþ¥«¡¼¥½¥ë¤ÎľÁ°¤Îʸ»ú¤òºï½ü¤·¤Þ¤¹¡£
- 5. Delete¥­¡¼¤ÏÁÞÆþ¥«¡¼¥½¥ë¤Îľ¸å¤Îʸ»ú¤òºï½ü¤·¤Þ¤¹¡£"){
+ 1. マウスをæŒã£ã¦ã„ãã€ã‚¯ãƒªãƒƒã‚¯ã—ã€å…¥åŠ›ã§ãã¾ã™ã€‚
+ 2. ボタン1ã§é¸æŠžã§ãã¾ã™ã€‚
+ 3. マウスã®ä½ç½®ã«ãƒœã‚¿ãƒ³2ã§é¸æŠžã—ãŸãƒ†ã‚­ã‚¹ãƒˆã‚’コピーã§ãã¾ã™ã€‚
+ 4.ãƒãƒƒã‚¯ã‚¹ãƒšãƒ¼ã‚¹ã‚’コントロール-Hã§æŒ¿å…¥ã‚«ãƒ¼ã‚½ãƒ«ã®ç›´å‰ã®æ–‡å­—を削除ã—ã¾ã™ã€‚
+ 5. Deleteã‚­ãƒ¼ã¯æŒ¿å…¥ã‚«ãƒ¼ã‚½ãƒ«ã®ç›´å¾Œã®æ–‡å­—を削除ã—ã¾ã™ã€‚"){
pack('side'=>'top')
}
-# frame À¸À®
+# frame 生æˆ
$ctext_buttons = TkFrame.new(base_frame) {|frame|
TkButton.new(frame) {
- #text 'λ²ò'
- text 'ÊĤ¸¤ë'
+ #text '了解'
+ text 'é–‰ã˜ã‚‹'
command proc{
tmppath = $ctext_demo
$ctext_demo = nil
@@ -43,30 +43,30 @@ $ctext_buttons = TkFrame.new(base_frame) {|frame|
}.pack('side'=>'left', 'expand'=>'yes')
TkButton.new(frame) {
- text '¥³¡¼¥É»²¾È'
+ text 'コードå‚ç…§'
command proc{showCode 'ctext'}
}.pack('side'=>'left', 'expand'=>'yes')
}
$ctext_buttons.pack('side'=>'bottom', 'fill'=>'x', 'pady'=>'2m')
-# canvas À¸À®
+# canvas 生æˆ
$ctext_canvas = TkCanvas.new(base_frame, 'relief'=>'flat',
'borderwidth'=>0, 'width'=>500, 'height'=>350)
$ctext_canvas.pack('side'=>'top', 'expand'=>'yes', 'fill'=>'both')
-# font ÀßÄê
+# font 設定
if $tk_version =~ /^4.*/
textFont = '-*-Helvetica-Medium-R-Normal--*-240-*-*-*-*-*-*'
else
textFont = 'Helvetica 24'
end
-# canvas ÀßÄê
+# canvas 設定
TkcRectangle.new($ctext_canvas, 245, 195, 255, 205,
'outline'=>'black', 'fill'=>'red')
ctag_text_param = {
- 'text'=>"¤³¤ì¤Ï¥­¥ã¥ó¥Ð¥¹widget¤Î¥Æ¥­¥¹¥Èµ¡Ç½¤ò¥Ç¥â¤¹¤ë¤¿¤á¤Îʸ»úÎó¤Ç¤¹¡£\n¾å¤Ç½Ò¤Ù¤¿¤è¤¦¤ÊÊÔ½¸¤ò²Äǽ¤È¤¹¤ë¤¿¤á¤Î¥Ð¥¤¥ó¥Ç¥£¥ó¥°¤ò»Ü¤·¤Æ¤¤¤Þ¤¹¡£",
+ 'text'=>"ã“れã¯ã‚­ãƒ£ãƒ³ãƒã‚¹widgetã®ãƒ†ã‚­ã‚¹ãƒˆæ©Ÿèƒ½ã‚’デモã™ã‚‹ãŸã‚ã®æ–‡å­—列ã§ã™ã€‚\n上ã§è¿°ã¹ãŸã‚ˆã†ãªç·¨é›†ã‚’å¯èƒ½ã¨ã™ã‚‹ãŸã‚ã®ãƒã‚¤ãƒ³ãƒ‡ã‚£ãƒ³ã‚°ã‚’æ–½ã—ã¦ã„ã¾ã™ã€‚",
'width'=>440, 'anchor'=>'n', 'justify'=>'left'
}
if $tk_version =~ /^4.*/
diff --git a/ext/tk/sample/demos-jp/dialog1.rb b/ext/tk/sample/demos-jp/dialog1.rb
index 07e50306ab..e50c9071e5 100644
--- a/ext/tk/sample/demos-jp/dialog1.rb
+++ b/ext/tk/sample/demos-jp/dialog1.rb
@@ -1,4 +1,4 @@
-# -*- coding: euc-jp -*-
+# -*- coding: utf-8 -*-
#
# a dialog box with a local grab (called by 'widget')
#
@@ -11,7 +11,7 @@ class TkDialog_Demo1 < TkDialog
end
def message
- '¥â¡¼¥À¥ë¥À¥¤¥¢¥í¥°¥Ü¥Ã¥¯¥¹¤Ç¤¹¡£Tk ¤Î "grab" ¥³¥Þ¥ó¥É¤ò»ÈÍѤ·¤Æ¥À¥¤¥¢¥í¥°¥Ü¥Ã¥¯¥¹¤Ç¡Ö¥í¡¼¥«¥ë¥°¥é¥Ö¡×¤·¤Æ¤¤¤Þ¤¹¡£²¼¤Î¤¤¤º¤ì¤«¤Î¥Ü¥¿¥ó¤ò¼Â¹Ô¤¹¤ë¤³¤È¤Ë¤è¤Ã¤Æ¡¢¤³¤Î¥À¥¤¥¢¥í¥°¤ËÅú¤¨¤ë¤Þ¤Ç¡¢¤³¤Î¥°¥é¥Ö¤Ë¤è¤Ã¤Æ¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¤Î¾¤Î¥¦¥£¥ó¥É¥¦¤Ç¤Ï¡¢¥Ý¥¤¥ó¥¿´Ø·¸¤Î¥¤¥Ù¥ó¥È¤ò¼õ¤±¼è¤ë¤³¤È¤¬¤Ç¤­¤Ê¤¯¤Ê¤Ã¤Æ¤¤¤Þ¤¹¡£'
+ 'モーダルダイアログボックスã§ã™ã€‚Tk ã® "grab" コマンドを使用ã—ã¦ãƒ€ã‚¤ã‚¢ãƒ­ã‚°ãƒœãƒƒã‚¯ã‚¹ã§ã€Œãƒ­ãƒ¼ã‚«ãƒ«ã‚°ãƒ©ãƒ–ã€ã—ã¦ã„ã¾ã™ã€‚下ã®ã„ãšã‚Œã‹ã®ãƒœã‚¿ãƒ³ã‚’実行ã™ã‚‹ã“ã¨ã«ã‚ˆã£ã¦ã€ã“ã®ãƒ€ã‚¤ã‚¢ãƒ­ã‚°ã«ç­”ãˆã‚‹ã¾ã§ã€ã“ã®ã‚°ãƒ©ãƒ–ã«ã‚ˆã£ã¦ã‚¢ãƒ—リケーションã®ä»–ã®ã‚¦ã‚£ãƒ³ãƒ‰ã‚¦ã§ã¯ã€ãƒã‚¤ãƒ³ã‚¿é–¢ä¿‚ã®ã‚¤ãƒ™ãƒ³ãƒˆã‚’å—ã‘å–ã‚‹ã“ã¨ãŒã§ããªããªã£ã¦ã„ã¾ã™ã€‚'
end
def bitmap
@@ -23,17 +23,17 @@ class TkDialog_Demo1 < TkDialog
end
def buttons
-# "λ²ò ¥­¥ã¥ó¥»¥ë ¥³¡¼¥É»²¾È"
- ["λ²ò", "¥­¥ã¥ó¥»¥ë", "¥³¡¼¥É»²¾È"]
+# "了解 キャンセル コードå‚ç…§"
+ ["了解", "キャンセル", "コードå‚ç…§"]
end
end
ret = TkDialog_Demo1.new('message_config'=>{'wraplength'=>'4i'}).value
case ret
when 0
- print "¤¢¤Ê¤¿¤Ï¡Öλ²ò¡×¤ò²¡¤·¤Þ¤·¤¿¤Í¡£\n"
+ print "ã‚ãªãŸã¯ã€Œäº†è§£ã€ã‚’押ã—ã¾ã—ãŸã­ã€‚\n"
when 1
- print "¤¢¤Ê¤¿¤Ï¡Ö¥­¥ã¥ó¥»¥ë¡×¤ò²¡¤·¤Þ¤·¤¿¤Í¡£\n"
+ print "ã‚ãªãŸã¯ã€Œã‚­ãƒ£ãƒ³ã‚»ãƒ«ã€ã‚’押ã—ã¾ã—ãŸã­ã€‚\n"
when 2
showCode 'dialog1'
end
diff --git a/ext/tk/sample/demos-jp/dialog2.rb b/ext/tk/sample/demos-jp/dialog2.rb
index f747f8d6a8..3e7d9619a4 100644
--- a/ext/tk/sample/demos-jp/dialog2.rb
+++ b/ext/tk/sample/demos-jp/dialog2.rb
@@ -1,4 +1,4 @@
-# -*- coding: euc-jp -*-
+# -*- coding: utf-8 -*-
#
# a dialog box with a global grab (called by 'widget')
#
@@ -11,7 +11,7 @@ class TkDialog_Demo2 < TkDialog
end
def message
- '¤³¤Î¥À¥¤¥¢¥í¥°¥Ü¥Ã¥¯¥¹¤Ï¥°¥í¡¼¥Ð¥ë¥°¥é¥Ö¤ò»ÈÍѤ·¤Æ¤¤¤Þ¤¹¡£²¼¤Î¥Ü¥¿¥ó¤ò¼Â¹Ô¤¹¤ë¤Þ¤Ç¡¢¥Ç¥£¥¹¥×¥ì¥¤¾å¤Î¤¤¤«¤Ê¤ë¤â¤Î¤È¤âÂÐÏäǤ­¤Þ¤»¤ó¡£¥°¥í¡¼¥Ð¥ë¥°¥é¥Ö¤ò»ÈÍѤ¹¤ë¤³¤È¤Ï¡¢¤Þ¤ºÎɤ¤¹Í¤¨¤Ç¤Ï¤¢¤ê¤Þ¤»¤ó¡£¤É¤¦¤·¤Æ¤âɬÍפˤʤë¤Þ¤Ç»È¤ª¤¦¤È»×¤ï¤Ê¤¤¤Ç²¼¤µ¤¤¡£'
+ 'ã“ã®ãƒ€ã‚¤ã‚¢ãƒ­ã‚°ãƒœãƒƒã‚¯ã‚¹ã¯ã‚°ãƒ­ãƒ¼ãƒãƒ«ã‚°ãƒ©ãƒ–を使用ã—ã¦ã„ã¾ã™ã€‚下ã®ãƒœã‚¿ãƒ³ã‚’実行ã™ã‚‹ã¾ã§ã€ãƒ‡ã‚£ã‚¹ãƒ—レイ上ã®ã„ã‹ãªã‚‹ã‚‚ã®ã¨ã‚‚対話ã§ãã¾ã›ã‚“。グローãƒãƒ«ã‚°ãƒ©ãƒ–を使用ã™ã‚‹ã“ã¨ã¯ã€ã¾ãšè‰¯ã„考ãˆã§ã¯ã‚りã¾ã›ã‚“。ã©ã†ã—ã¦ã‚‚å¿…è¦ã«ãªã‚‹ã¾ã§ä½¿ãŠã†ã¨æ€ã‚ãªã„ã§ä¸‹ã•ã„。'
end
def bitmap
@@ -23,8 +23,8 @@ class TkDialog_Demo2 < TkDialog
end
def buttons
-# "λ²ò ¥­¥ã¥ó¥»¥ë ¥³¡¼¥É»²¾È"
- ["λ²ò", "¥­¥ã¥ó¥»¥ë", "¥³¡¼¥É»²¾È"]
+# "了解 キャンセル コードå‚ç…§"
+ ["了解", "キャンセル", "コードå‚ç…§"]
end
end
@@ -34,9 +34,9 @@ ret = TkDialog_Demo2.new('message_config'=>{'wraplength'=>'4i'},
}).value
case ret
when 0
- print "¤¢¤Ê¤¿¤Ï¡Öλ²ò¡×¤ò²¡¤·¤Þ¤·¤¿¤Í¡£\n"
+ print "ã‚ãªãŸã¯ã€Œäº†è§£ã€ã‚’押ã—ã¾ã—ãŸã­ã€‚\n"
when 1
- print "¤¢¤Ê¤¿¤Ï¡Ö¥­¥ã¥ó¥»¥ë¡×¤ò²¡¤·¤Þ¤·¤¿¤Í¡£\n"
+ print "ã‚ãªãŸã¯ã€Œã‚­ãƒ£ãƒ³ã‚»ãƒ«ã€ã‚’押ã—ã¾ã—ãŸã­ã€‚\n"
when 2
showCode 'dialog2'
end
diff --git a/ext/tk/sample/demos-jp/entry1.rb b/ext/tk/sample/demos-jp/entry1.rb
index eb71e87aec..9be677d12d 100644
--- a/ext/tk/sample/demos-jp/entry1.rb
+++ b/ext/tk/sample/demos-jp/entry1.rb
@@ -1,15 +1,15 @@
-# -*- coding: euc-jp -*-
+# -*- coding: utf-8 -*-
#
# entry (no scrollbars) widget demo (called by 'widget')
#
-# toplevel widget ¤¬Â¸ºß¤¹¤ì¤Ðºï½ü¤¹¤ë
+# toplevel widget ãŒå­˜åœ¨ã™ã‚Œã°å‰Šé™¤ã™ã‚‹
if defined?($entry1_demo) && $entry1_demo
$entry1_demo.destroy
$entry1_demo = nil
end
-# demo ÍѤΠtoplevel widget ¤òÀ¸À®
+# demo 用㮠toplevel widget を生æˆ
$entry1_demo = TkToplevel.new {|w|
title("Entry Demonstration (no scrollbars)")
iconname("entry1")
@@ -18,20 +18,20 @@ $entry1_demo = TkToplevel.new {|w|
base_frame = TkFrame.new($entry1_demo).pack(:fill=>:both, :expand=>true)
-# label À¸À®
+# label 生æˆ
msg = TkLabel.new(base_frame) {
font $font
wraplength '5i'
justify 'left'
- text "3¼ïÎà¤Î°Û¤Ê¤ë¥¨¥ó¥È¥ê¤¬É½¼¨¤µ¤ì¤Æ¤¤¤Þ¤¹¡£Ê¸»ú¤òÆþÎϤ¹¤ë¤Ë¤Ï¥Ý¥¤¥ó¥¿¤ò»ý¤Ã¤Æ¹Ô¤­¡¢¥¯¥ê¥Ã¥¯¤·¤Æ¤«¤é¥¿¥¤¥×¤·¤Æ¤¯¤À¤µ¤¤¡£É¸½àŪ¤ÊMotif¤ÎÊÔ½¸µ¡Ç½¤¬¡¢Emacs¤Î¥­¡¼¥Ð¥¤¥ó¥É¤È¤È¤â¤Ë¡¢¥µ¥Ý¡¼¥È¤µ¤ì¤Æ¤¤¤Þ¤¹¡£Î㤨¤Ð¡¢¥Ð¥Ã¥¯¥¹¥Ú¡¼¥¹¤È¥³¥ó¥È¥í¡¼¥ë-H¤Ï¥«¡¼¥½¥ë¤Îº¸¤Îʸ»ú¤òºï½ü¤·¡¢¥Ç¥ê¡¼¥È¥­¡¼¤È¥³¥ó¥È¥í¡¼¥ë-D¤Ï¥«¡¼¥½¥ë¤Î±¦Â¦¤Îʸ»ú¤òºï½ü¤·¤Þ¤¹¡£Ä¹²á¤®¤Æ¥¦¥£¥ó¥É¥¦¤ËÆþ¤êÀÚ¤é¤Ê¤¤¤â¤Î¤Ï¡¢¥Þ¥¦¥¹¤Î¥Ü¥¿¥ó2¤ò²¡¤·¤¿¤Þ¤Þ¥É¥é¥Ã¥°¤¹¤ë¤³¤È¤Ç¥¹¥¯¥í¡¼¥ë¤µ¤»¤ë¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£ÆüËܸì¤òÆþÎϤ¹¤ë¤Î¤Ï¥³¥ó¥È¥í¡¼¥ë-¥Ð¥Ã¥¯¥¹¥é¥Ã¥·¥å¤Ç¤¹¡£kinput2¤¬Æ°¤¤¤Æ¤¤¤ì¤ÐÆþÎϤ¹¤ë¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£"
+ text "3種類ã®ç•°ãªã‚‹ã‚¨ãƒ³ãƒˆãƒªãŒè¡¨ç¤ºã•れã¦ã„ã¾ã™ã€‚文字を入力ã™ã‚‹ã«ã¯ãƒã‚¤ãƒ³ã‚¿ã‚’æŒã£ã¦è¡Œãã€ã‚¯ãƒªãƒƒã‚¯ã—ã¦ã‹ã‚‰ã‚¿ã‚¤ãƒ—ã—ã¦ãã ã•ã„。標準的ãªMotifã®ç·¨é›†æ©Ÿèƒ½ãŒã€Emacsã®ã‚­ãƒ¼ãƒã‚¤ãƒ³ãƒ‰ã¨ã¨ã‚‚ã«ã€ã‚µãƒãƒ¼ãƒˆã•れã¦ã„ã¾ã™ã€‚例ãˆã°ã€ãƒãƒƒã‚¯ã‚¹ãƒšãƒ¼ã‚¹ã¨ã‚³ãƒ³ãƒˆãƒ­ãƒ¼ãƒ«-Hã¯ã‚«ãƒ¼ã‚½ãƒ«ã®å·¦ã®æ–‡å­—を削除ã—ã€ãƒ‡ãƒªãƒ¼ãƒˆã‚­ãƒ¼ã¨ã‚³ãƒ³ãƒˆãƒ­ãƒ¼ãƒ«-Dã¯ã‚«ãƒ¼ã‚½ãƒ«ã®å³å´ã®æ–‡å­—を削除ã—ã¾ã™ã€‚é•·éŽãŽã¦ã‚¦ã‚£ãƒ³ãƒ‰ã‚¦ã«å…¥ã‚Šåˆ‡ã‚‰ãªã„ã‚‚ã®ã¯ã€ãƒžã‚¦ã‚¹ã®ãƒœã‚¿ãƒ³2を押ã—ãŸã¾ã¾ãƒ‰ãƒ©ãƒƒã‚°ã™ã‚‹ã“ã¨ã§ã‚¹ã‚¯ãƒ­ãƒ¼ãƒ«ã•ã›ã‚‹ã“ã¨ãŒã§ãã¾ã™ã€‚日本語を入力ã™ã‚‹ã®ã¯ã‚³ãƒ³ãƒˆãƒ­ãƒ¼ãƒ«-ãƒãƒƒã‚¯ã‚¹ãƒ©ãƒƒã‚·ãƒ¥ã§ã™ã€‚kinput2ãŒå‹•ã„ã¦ã„れã°å…¥åŠ›ã™ã‚‹ã“ã¨ãŒã§ãã¾ã™ã€‚"
}
msg.pack('side'=>'top')
-# frame À¸À®
+# frame 生æˆ
TkFrame.new(base_frame) {|frame|
TkButton.new(frame) {
- #text 'λ²ò'
- text 'ÊĤ¸¤ë'
+ #text '了解'
+ text 'é–‰ã˜ã‚‹'
command proc{
tmppath = $entry1_demo
$entry1_demo = nil
@@ -40,21 +40,21 @@ TkFrame.new(base_frame) {|frame|
}.pack('side'=>'left', 'expand'=>'yes')
TkButton.new(frame) {
- text '¥³¡¼¥É»²¾È'
+ text 'コードå‚ç…§'
command proc{showCode 'entry1'}
}.pack('side'=>'left', 'expand'=>'yes')
}.pack('side'=>'bottom', 'fill'=>'x', 'pady'=>'2m')
-# entry À¸À®
+# entry 生æˆ
e1 = TkEntry.new(base_frame, 'relief'=>'sunken')
e2 = TkEntry.new(base_frame, 'relief'=>'sunken')
e3 = TkEntry.new(base_frame, 'relief'=>'sunken')
[e1,e2,e3].each{|w| w.pack('side'=>'top', 'padx'=>10, 'pady'=>5, 'fill'=>'x')}
-# ½é´üÃÍÁÞÆþ
-e1.insert(0, '½é´üÃÍ')
-e2.insert('end', "¤³¤Î¥¨¥ó¥È¥ê¤Ë¤ÏŤ¤Ê¸»úÎ󤬯þ¤Ã¤Æ¤¤¤Æ¡¢")
-e2.insert('end', "Ť¹¤®¤Æ¥¦¥£¥ó¥É¥¦¤Ë¤ÏÆþ¤êÀÚ¤é¤Ê¤¤¤Î¤Ç¡¢")
-e2.insert('end', "¼ÂºÝ¤Î½ê½ª¤ê¤Þ¤Ç¸«¤ë¤Ë¤Ï¥¹¥¯¥í¡¼¥ë¤µ¤»¤Ê¤±¤ì¤Ð")
-e2.insert('end', "¤Ê¤é¤Ê¤¤¤Ç¤·¤ç¤¦¡£")
+# åˆæœŸå€¤æŒ¿å…¥
+e1.insert(0, 'åˆæœŸå€¤')
+e2.insert('end', "ã“ã®ã‚¨ãƒ³ãƒˆãƒªã«ã¯é•·ã„文字列ãŒå…¥ã£ã¦ã„ã¦ã€")
+e2.insert('end', "é•·ã™ãŽã¦ã‚¦ã‚£ãƒ³ãƒ‰ã‚¦ã«ã¯å…¥ã‚Šåˆ‡ã‚‰ãªã„ã®ã§ã€")
+e2.insert('end', "å®Ÿéš›ã®æ‰€çµ‚りã¾ã§è¦‹ã‚‹ã«ã¯ã‚¹ã‚¯ãƒ­ãƒ¼ãƒ«ã•ã›ãªã‘れã°")
+e2.insert('end', "ãªã‚‰ãªã„ã§ã—ょã†ã€‚")
diff --git a/ext/tk/sample/demos-jp/entry2.rb b/ext/tk/sample/demos-jp/entry2.rb
index b5187ab508..5476d24ade 100644
--- a/ext/tk/sample/demos-jp/entry2.rb
+++ b/ext/tk/sample/demos-jp/entry2.rb
@@ -1,15 +1,15 @@
-# -*- coding: euc-jp -*-
+# -*- coding: utf-8 -*-
#
# entry (with scrollbars) widget demo (called by 'widget')
#
-# toplevel widget ¤¬Â¸ºß¤¹¤ì¤Ðºï½ü¤¹¤ë
+# toplevel widget ãŒå­˜åœ¨ã™ã‚Œã°å‰Šé™¤ã™ã‚‹
if defined?($entry2_demo) && $entry2_demo
$entry2_demo.destroy
$entry2_demo = nil
end
-# demo ÍѤΠtoplevel widget ¤òÀ¸À®
+# demo 用㮠toplevel widget を生æˆ
$entry2_demo = TkToplevel.new {|w|
title("Entry Demonstration (with scrollbars)")
iconname("entry2")
@@ -18,20 +18,20 @@ $entry2_demo = TkToplevel.new {|w|
base_frame = TkFrame.new($entry2_demo).pack(:fill=>:both, :expand=>true)
-# label À¸À®
+# label 生æˆ
msg = TkLabel.new(base_frame) {
font $font
wraplength '5i'
justify 'left'
- text "3¼ïÎà¤Î°Û¤Ê¤ë¥¨¥ó¥È¥ê¤¬³Æ¡¹¥¹¥¯¥í¡¼¥ë¥Ð¡¼ÉÕ¤Çɽ¼¨¤µ¤ì¤Æ¤¤¤Þ¤¹¡£Ê¸»ú¤òÆþÎϤ¹¤ë¤Ë¤Ï¥Ý¥¤¥ó¥¿¤ò»ý¤Ã¤Æ¹Ô¤­¡¢¥¯¥ê¥Ã¥¯¤·¤Æ¤«¤é¥¿¥¤¥×¤·¤Æ¤¯¤À¤µ¤¤¡£É¸½àŪ¤ÊMotif¤ÎÊÔ½¸µ¡Ç½¤¬¡¢Emacs¤Î¥­¡¼¥Ð¥¤¥ó¥É¤È¤È¤â¤Ë¡¢¥µ¥Ý¡¼¥È¤µ¤ì¤Æ¤¤¤Þ¤¹¡£Î㤨¤Ð¡¢¥Ð¥Ã¥¯¥¹¥Ú¡¼¥¹¤È¥³¥ó¥È¥í¡¼¥ë-H¤Ï¥«¡¼¥½¥ë¤Îº¸¤Îʸ»ú¤òºï½ü¤·¡¢¥Ç¥ê¡¼¥È¥­¡¼¤È¥³¥ó¥È¥í¡¼¥ë-D¤Ï¥«¡¼¥½¥ë¤Î±¦Â¦¤Îʸ»ú¤òºï½ü¤·¤Þ¤¹¡£Ä¹²á¤®¤Æ¥¦¥£¥ó¥É¥¦¤ËÆþ¤êÀÚ¤é¤Ê¤¤¤â¤Î¤Ï¡¢¥Þ¥¦¥¹¤Î¥Ü¥¿¥ó2¤ò²¡¤·¤¿¤Þ¤Þ¥É¥é¥Ã¥°¤¹¤ë¤³¤È¤Ç¥¹¥¯¥í¡¼¥ë¤µ¤»¤ë¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£ÆüËܸì¤òÆþÎϤ¹¤ë¤Î¤Ï¥³¥ó¥È¥í¡¼¥ë-¥Ð¥Ã¥¯¥¹¥é¥Ã¥·¥å¤Ç¤¹¡£kinput2¤¬Æ°¤¤¤Æ¤¤¤ì¤ÐÆþÎϤ¹¤ë¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£"
+ text "3種類ã®ç•°ãªã‚‹ã‚¨ãƒ³ãƒˆãƒªãŒå„々スクロールãƒãƒ¼ä»˜ã§è¡¨ç¤ºã•れã¦ã„ã¾ã™ã€‚文字を入力ã™ã‚‹ã«ã¯ãƒã‚¤ãƒ³ã‚¿ã‚’æŒã£ã¦è¡Œãã€ã‚¯ãƒªãƒƒã‚¯ã—ã¦ã‹ã‚‰ã‚¿ã‚¤ãƒ—ã—ã¦ãã ã•ã„。標準的ãªMotifã®ç·¨é›†æ©Ÿèƒ½ãŒã€Emacsã®ã‚­ãƒ¼ãƒã‚¤ãƒ³ãƒ‰ã¨ã¨ã‚‚ã«ã€ã‚µãƒãƒ¼ãƒˆã•れã¦ã„ã¾ã™ã€‚例ãˆã°ã€ãƒãƒƒã‚¯ã‚¹ãƒšãƒ¼ã‚¹ã¨ã‚³ãƒ³ãƒˆãƒ­ãƒ¼ãƒ«-Hã¯ã‚«ãƒ¼ã‚½ãƒ«ã®å·¦ã®æ–‡å­—を削除ã—ã€ãƒ‡ãƒªãƒ¼ãƒˆã‚­ãƒ¼ã¨ã‚³ãƒ³ãƒˆãƒ­ãƒ¼ãƒ«-Dã¯ã‚«ãƒ¼ã‚½ãƒ«ã®å³å´ã®æ–‡å­—を削除ã—ã¾ã™ã€‚é•·éŽãŽã¦ã‚¦ã‚£ãƒ³ãƒ‰ã‚¦ã«å…¥ã‚Šåˆ‡ã‚‰ãªã„ã‚‚ã®ã¯ã€ãƒžã‚¦ã‚¹ã®ãƒœã‚¿ãƒ³2を押ã—ãŸã¾ã¾ãƒ‰ãƒ©ãƒƒã‚°ã™ã‚‹ã“ã¨ã§ã‚¹ã‚¯ãƒ­ãƒ¼ãƒ«ã•ã›ã‚‹ã“ã¨ãŒã§ãã¾ã™ã€‚日本語を入力ã™ã‚‹ã®ã¯ã‚³ãƒ³ãƒˆãƒ­ãƒ¼ãƒ«-ãƒãƒƒã‚¯ã‚¹ãƒ©ãƒƒã‚·ãƒ¥ã§ã™ã€‚kinput2ãŒå‹•ã„ã¦ã„れã°å…¥åŠ›ã™ã‚‹ã“ã¨ãŒã§ãã¾ã™ã€‚"
}
msg.pack('side'=>'top')
-# frame À¸À®
+# frame 生æˆ
TkFrame.new(base_frame) {|frame|
TkButton.new(frame) {
- #text 'λ²ò'
- text 'ÊĤ¸¤ë'
+ #text '了解'
+ text 'é–‰ã˜ã‚‹'
command proc{
tmppath = $entry2_demo
$entry2_demo = nil
@@ -40,12 +40,12 @@ TkFrame.new(base_frame) {|frame|
}.pack('side'=>'left', 'expand'=>'yes')
TkButton.new(frame) {
- text '¥³¡¼¥É»²¾È'
+ text 'コードå‚ç…§'
command proc{showCode 'entry2'}
}.pack('side'=>'left', 'expand'=>'yes')
}.pack('side'=>'bottom', 'fill'=>'x', 'pady'=>'2m')
-# frame À¸À®
+# frame 生æˆ
TkFrame.new(base_frame, 'borderwidth'=>10) {|w|
# entry 1
s1 = TkScrollbar.new(w, 'relief'=>'sunken', 'orient'=>'horiz')
@@ -80,12 +80,12 @@ TkFrame.new(base_frame, 'borderwidth'=>10) {|w|
e3.pack('side'=>'top', 'fill'=>'x')
s3.pack('side'=>'top', 'fill'=>'x')
- # ½é´üÃÍÁÞÆþ
- e1.insert(0, '½é´üÃÍ')
- e2.insert('end', "¤³¤Î¥¨¥ó¥È¥ê¤Ë¤ÏŤ¤Ê¸»úÎ󤬯þ¤Ã¤Æ¤¤¤Æ¡¢")
- e2.insert('end', "Ť¹¤®¤Æ¥¦¥£¥ó¥É¥¦¤Ë¤ÏÆþ¤êÀÚ¤é¤Ê¤¤¤Î¤Ç¡¢")
- e2.insert('end', "¼ÂºÝ¤Î½ê½ª¤ê¤Þ¤Ç¸«¤ë¤Ë¤Ï¥¹¥¯¥í¡¼¥ë¤µ¤»¤Ê¤±¤ì¤Ð")
- e2.insert('end', "¤Ê¤é¤Ê¤¤¤Ç¤·¤ç¤¦¡£")
+ # åˆæœŸå€¤æŒ¿å…¥
+ e1.insert(0, 'åˆæœŸå€¤')
+ e2.insert('end', "ã“ã®ã‚¨ãƒ³ãƒˆãƒªã«ã¯é•·ã„文字列ãŒå…¥ã£ã¦ã„ã¦ã€")
+ e2.insert('end', "é•·ã™ãŽã¦ã‚¦ã‚£ãƒ³ãƒ‰ã‚¦ã«ã¯å…¥ã‚Šåˆ‡ã‚‰ãªã„ã®ã§ã€")
+ e2.insert('end', "å®Ÿéš›ã®æ‰€çµ‚りã¾ã§è¦‹ã‚‹ã«ã¯ã‚¹ã‚¯ãƒ­ãƒ¼ãƒ«ã•ã›ãªã‘れã°")
+ e2.insert('end', "ãªã‚‰ãªã„ã§ã—ょã†ã€‚")
}.pack('side'=>'top', 'fill'=>'x', 'expand'=>'yes')
diff --git a/ext/tk/sample/demos-jp/entry3.rb b/ext/tk/sample/demos-jp/entry3.rb
index 2728de0b93..59c698de62 100644
--- a/ext/tk/sample/demos-jp/entry3.rb
+++ b/ext/tk/sample/demos-jp/entry3.rb
@@ -1,4 +1,4 @@
-# -*- coding: euc-jp -*-
+# -*- coding: utf-8 -*-
# entry3.rb --
#
# This demonstration script creates several entry widgets whose
@@ -23,33 +23,33 @@ base_frame = TkFrame.new($entry3_demo).pack(:fill=>:both, :expand=>true)
TkLabel.new(base_frame,
:font=>$font, :wraplength=>'5i', :justify=>:left,
:text=><<EOL).pack(:side=>:top)
-°Ê²¼¤Ë¤Ï£´¼ïÎà¤Î¥¨¥ó¥È¥ê¥Ü¥Ã¥¯¥¹¤¬É½¼¨¤µ¤ì¤Æ¤¤¤Þ¤¹¡¥³Æ¥¨¥ó¥È¥ê¥Ü¥Ã¥¯¥¹¤Ï¡¤\
-¥Þ¥¦¥¹¥¯¥ê¥Ã¥¯¤ÇÁªÂò¤·Ê¸»ú¤òÂǤÁ¹þ¤à¤³¤È¤¬²Äǽ¤Ç¤¹¤¬¡¤¤½¤ì¤¾¤ì¤¬¤É¤Î¤è¤¦¤Ê\
-ÆþÎϤò¼õ¤±ÉÕ¤±¤ë¤³¤È¤¬¤Ç¤­¤ë¤«¤Ë¤ÏÀ©Ìó¤¬Àߤ±¤é¤ì¤Æ¤¤¤Þ¤¹¡¥\
-°ì¤Ä¤á¤Î¥¨¥ó¥È¥ê¥Ü¥Ã¥¯¥¹¤ÏÀ°¿ô¤È¸«¤Ê¤µ¤ì¤ëʸ»úÎ󤫯þÎÏʸ»ú¤¬¤Ê¤¤¶õ¤Î¾õÂÖ¤«\
-¤Î¾ì¹ç¤À¤±¤ò¼õ¤±ÉÕ¤±¡¤ÌäÂ꤬¤¢¤ë¾ì¹ç¤Ï¥¨¥ó¥È¥ê¥Ü¥Ã¥¯¥¹¤¬ÅÀÌǤ·¤Þ¤¹\
-¡Ê¥Õ¥©¡¼¥«¥¹¤¬µî¤ë»þ¤Ë¥Á¥§¥Ã¥¯¤µ¤ì¤Þ¤¹¡Ë¡¥\
-Æó¤Ä¤á¤Î¥¨¥ó¥È¥ê¥Ü¥Ã¥¯¥¹¤Ï¡¤ÆþÎϤµ¤ì¤¿Ê¸»úÎó¤ÎŤµ¤¬\
-£±£°Ê¸»ṳ́Ëþ¤Î¾ì¹ç¤À¤±¤ò¼õ¤±ÉÕ¤±¡¤À©¸Â¤ò±Û¤¨¤Æ½ñ¤­¹þ¤â¤¦¤È¤·¤¿¤È¤­¤Ë¤Ï\
-¥Ù¥ë¤òÌĤ餷¤ÆÃΤ餻¤Þ¤¹¡¥\
-»°¤Ä¤á¤ÏÊÆ¹ñ¤ÎÅÅÏÃÈÖ¹æ¤ò¼õ¤±ÉÕ¤±¤ë¥¨¥ó¥È¥ê¥Ü¥Ã¥¯¥¹¤Ç¤¹¡¥\
-¥¢¥ë¥Õ¥¡¥Ù¥Ã¥È¤Ï¡¤ÅÅÏõ¡¤Î¥À¥¤¥ä¥ë¾å¤ÇÂбþ¤Å¤±¤é¤ì¤Æ¤¤¤ë¿ô»ú¤ËÊÑ´¹¤µ¤ì¤Þ¤¹¡¥\
-ÉÔŬÀÚ¤Êʸ»ú¤¬ÆþÎϤµ¤ì¤¿¤ê¿ô»ú°Ê³°¤Îʸ»ú¤Î°ÌÃ֤˿ô»ú¤òÆþÎϤ·¤è¤¦¤È¤·¤¿¤ê\
-¤·¤¿¾ì¹ç¤Ë¤Ï·Ù¹ð¤Î¥Ù¥ë¤¬ÌĤê¤Þ¤¹¡¥\
-»Í¤Ä¤á¤Î¥¨¥ó¥È¥ê¥Ü¥Ã¥¯¥¹¤Ï¡¤£¸Ê¸»ú¤Þ¤Ç¤ÎÆþÎϤò¼õ¤±ÉÕ¤±¤ë\
-¥Ñ¥¹¥ï¡¼¥É¥Õ¥£¡¼¥ë¥É¤Ç¤¹¡Ê£¸Ê¸»ú°Ê¾å¤ÏÆÃ¤Ë·Ù¹ð¤ò½Ð¤¹¤³¤È¤Ê¤¯Ìµ»ë¤µ¤ì¤Þ¤¹¡Ë¡¥\
-ÆþÎϤµ¤ì¤¿Ê¸»ú¤Ï¥¢¥¹¥¿¥ê¥¹¥¯µ­¹æ¤ËÃÖ¤­´¹¤¨¤ÆÉ½¼¨¤µ¤ì¤Þ¤¹¡¥
+以下ã«ã¯ï¼”種類ã®ã‚¨ãƒ³ãƒˆãƒªãƒœãƒƒã‚¯ã‚¹ãŒè¡¨ç¤ºã•れã¦ã„ã¾ã™ï¼Žå„エントリボックスã¯ï¼Œ\
+マウスクリックã§é¸æŠžã—文字を打ã¡è¾¼ã‚€ã“ã¨ãŒå¯èƒ½ã§ã™ãŒï¼Œãれãžã‚ŒãŒã©ã®ã‚ˆã†ãª\
+入力をå—ã‘付ã‘ã‚‹ã“ã¨ãŒã§ãã‚‹ã‹ã«ã¯åˆ¶ç´„ãŒè¨­ã‘られã¦ã„ã¾ã™ï¼Ž\
+一ã¤ã‚ã®ã‚¨ãƒ³ãƒˆãƒªãƒœãƒƒã‚¯ã‚¹ã¯æ•´æ•°ã¨è¦‹ãªã•れる文字列ã‹å…¥åŠ›æ–‡å­—ãŒãªã„空ã®çŠ¶æ…‹ã‹\
+ã®å ´åˆã ã‘ã‚’å—ã‘付ã‘,å•題ãŒã‚ã‚‹å ´åˆã¯ã‚¨ãƒ³ãƒˆãƒªãƒœãƒƒã‚¯ã‚¹ãŒç‚¹æ»…ã—ã¾ã™\
+(フォーカスãŒåŽ»ã‚‹æ™‚ã«ãƒã‚§ãƒƒã‚¯ã•れã¾ã™ï¼‰ï¼Ž\
+二ã¤ã‚ã®ã‚¨ãƒ³ãƒˆãƒªãƒœãƒƒã‚¯ã‚¹ã¯ï¼Œå…¥åŠ›ã•ã‚ŒãŸæ–‡å­—列ã®é•·ã•ãŒ\
+ï¼‘ï¼æ–‡å­—未満ã®å ´åˆã ã‘ã‚’å—ã‘付ã‘,制é™ã‚’è¶Šãˆã¦æ›¸ã込もã†ã¨ã—ãŸã¨ãã«ã¯\
+ベルを鳴らã—ã¦çŸ¥ã‚‰ã›ã¾ã™ï¼Ž\
+三ã¤ã‚ã¯ç±³å›½ã®é›»è©±ç•ªå·ã‚’å—ã‘付ã‘るエントリボックスã§ã™ï¼Ž\
+アルファベットã¯ï¼Œé›»è©±æ©Ÿã®ãƒ€ã‚¤ãƒ¤ãƒ«ä¸Šã§å¯¾å¿œã¥ã‘られã¦ã„ã‚‹æ•°å­—ã«å¤‰æ›ã•れã¾ã™ï¼Ž\
+ä¸é©åˆ‡ãªæ–‡å­—ãŒå…¥åŠ›ã•れãŸã‚Šæ•°å­—ä»¥å¤–ã®æ–‡å­—ã®ä½ç½®ã«æ•°å­—を入力ã—よã†ã¨ã—ãŸã‚Š\
+ã—ãŸå ´åˆã«ã¯è­¦å‘Šã®ãƒ™ãƒ«ãŒé³´ã‚Šã¾ã™ï¼Ž\
+å››ã¤ã‚ã®ã‚¨ãƒ³ãƒˆãƒªãƒœãƒƒã‚¯ã‚¹ã¯ï¼Œï¼˜æ–‡å­—ã¾ã§ã®å…¥åŠ›ã‚’å—ã‘付ã‘ã‚‹\
+パスワードフィールドã§ã™ï¼ˆï¼˜æ–‡å­—以上ã¯ç‰¹ã«è­¦å‘Šã‚’出ã™ã“ã¨ãªã無視ã•れã¾ã™ï¼‰ï¼Ž\
+入力ã•ã‚ŒãŸæ–‡å­—ã¯ã‚¢ã‚¹ã‚¿ãƒªã‚¹ã‚¯è¨˜å·ã«ç½®ãæ›ãˆã¦è¡¨ç¤ºã•れã¾ã™ï¼Ž
EOL
TkFrame.new(base_frame){|f|
pack(:side=>:bottom, :fill=>:x, :pady=>'2m')
- TkButton.new(f, :text=>'ÊĤ¸¤ë', :width=>15, :command=>proc{
+ TkButton.new(f, :text=>'é–‰ã˜ã‚‹', :width=>15, :command=>proc{
$entry3_demo.destroy
$entry3_demo = nil
}).pack(:side=>:left, :expand=>true)
- TkButton.new(f, :text=>'¥³¡¼¥É»²¾È', :width=>15, :command=>proc{
+ TkButton.new(f, :text=>'コードå‚ç…§', :width=>15, :command=>proc{
showCode 'entry3'
}).pack(:side=>:left, :expand=>true)
}
@@ -90,7 +90,7 @@ def focusAndFlash(widget, fg, bg, count=5)
widget.focus(true)
end
-l1 = TkLabelFrame.new(base_frame, :text=>"À°¿ô¥¨¥ó¥È¥ê")
+l1 = TkLabelFrame.new(base_frame, :text=>"整数エントリ")
TkEntry.new(l1, :validate=>:focus,
:vcmd=>[
proc{|s| s == '' || /^[+-]?\d+$/ =~ s }, '%P'
@@ -101,7 +101,7 @@ TkEntry.new(l1, :validate=>:focus,
pack(:fill=>:x, :expand=>true, :padx=>'1m', :pady=>'1m')
}
-l2 = TkLabelFrame.new(base_frame, :text=>"ŤµÀ©ÌóÉÕ¤­¥¨¥ó¥È¥ê")
+l2 = TkLabelFrame.new(base_frame, :text=>"é•·ã•制約付ãエントリ")
TkEntry.new(l2, :validate=>:key, :invcmd=>proc{Tk.bell},
:vcmd=>[proc{|s| s.length < 10}, '%P']
).pack(:fill=>:x, :expand=>true, :padx=>'1m', :pady=>'1m')
@@ -190,7 +190,7 @@ def validatePhoneChange(widget, vmode, idx, char)
end
-l3 = TkLabelFrame.new(base_frame, :text=>"ÊÆ¹ñÅÅÏÃÈֹ楨¥ó¥È¥ê")
+l3 = TkLabelFrame.new(base_frame, :text=>"米国電話番å·ã‚¨ãƒ³ãƒˆãƒª")
TkEntry.new(l3, :validate=>:key, :invcmd=>proc{Tk.bell},
:textvariable=>entry3content,
:vcmd=>[
@@ -209,7 +209,7 @@ TkEntry.new(l3, :validate=>:key, :invcmd=>proc{Tk.bell},
pack(:fill=>:x, :expand=>true, :padx=>'1m', :pady=>'1m')
}
-l4 = TkLabelFrame.new(base_frame, :text=>"¥Ñ¥¹¥ï¡¼¥É¥¨¥ó¥È¥ê")
+l4 = TkLabelFrame.new(base_frame, :text=>"パスワードエントリ")
TkEntry.new(l4, :validate=>:key, :show=>'*',
:vcmd=>[
proc{|s| s.length <= 8},
diff --git a/ext/tk/sample/demos-jp/filebox.rb b/ext/tk/sample/demos-jp/filebox.rb
index ffe5fbc5c6..fc014bc282 100644
--- a/ext/tk/sample/demos-jp/filebox.rb
+++ b/ext/tk/sample/demos-jp/filebox.rb
@@ -1,15 +1,15 @@
-# -*- coding: euc-jp -*-
+# -*- coding: utf-8 -*-
#
# widget demo prompts the user to select a file (called by 'widget')
#
-# toplevel widget ¤¬Â¸ºß¤¹¤ì¤Ðºï½ü¤¹¤ë
+# toplevel widget ãŒå­˜åœ¨ã™ã‚Œã°å‰Šé™¤ã™ã‚‹
if defined?($filebox_demo) && $entry2_demo
$filebox_demo.destroy
$filebox_demo = nil
end
-# demo ÍѤΠtoplevel widget ¤òÀ¸À®
+# demo 用㮠toplevel widget を生æˆ
$filebox_demo = TkToplevel.new {|w|
title("File Selection Dialogs")
iconname("filebox")
@@ -18,15 +18,15 @@ $filebox_demo = TkToplevel.new {|w|
base_frame = TkFrame.new($filebox_demo).pack(:fill=>:both, :expand=>true)
-# label À¸À®
+# label 生æˆ
TkLabel.new(base_frame,'font'=>$font,'wraplength'=>'4i','justify'=>'left',
- 'text'=>"¥¨¥ó¥È¥ê¤Ë¥Õ¥¡¥¤¥ë̾¤òľÀÜÆþÎϤ¹¤ë¤«¡¢\"Browse\" ¥Ü¥¿¥ó¤ò²¡¤·¤Æ¥Õ¥¡¥¤¥ëÁªÂò¥À¥¤¥¢¥í¥°¤«¤é¥Õ¥¡¥¤¥ë̾¤òÁª¤ó¤Ç²¼¤µ¤¤¡£").pack('side'=>'top')
+ 'text'=>"エントリã«ãƒ•ァイルåを直接入力ã™ã‚‹ã‹ã€\"Browse\" ボタンを押ã—ã¦ãƒ•ã‚¡ã‚¤ãƒ«é¸æŠžãƒ€ã‚¤ã‚¢ãƒ­ã‚°ã‹ã‚‰ãƒ•ァイルåã‚’é¸ã‚“ã§ä¸‹ã•ã„。").pack('side'=>'top')
-# frame À¸À®
+# frame 生æˆ
TkFrame.new(base_frame) {|frame|
TkButton.new(frame) {
- #text 'λ²ò'
- text 'ÊĤ¸¤ë'
+ #text '了解'
+ text 'é–‰ã˜ã‚‹'
command proc{
tmppath = $filebox_demo
$filebox_demo = nil
@@ -35,15 +35,15 @@ TkFrame.new(base_frame) {|frame|
}.pack('side'=>'left', 'expand'=>'yes')
TkButton.new(frame) {
- text '¥³¡¼¥É»²¾È'
+ text 'コードå‚ç…§'
command proc{showCode 'filebox'}
}.pack('side'=>'left', 'expand'=>'yes')
}.pack('side'=>'bottom', 'fill'=>'x', 'pady'=>'2m')
-# frame À¸À®
-['³«¤¯', 'Êݸ'].each{|type|
+# frame 生æˆ
+['é–‹ã', 'ä¿å­˜'].each{|type|
TkFrame.new(base_frame) {|f|
- TkLabel.new(f, 'text'=>"¥Õ¥¡¥¤¥ë¤ò#{type}: ", 'anchor'=>'e')\
+ TkLabel.new(f, 'text'=>"ファイルを#{type}: ", 'anchor'=>'e')\
.pack('side'=>'left')
TkEntry.new(f, 'width'=>20) {|e|
@@ -61,7 +61,7 @@ TkFrame.new(base_frame) {|frame|
$tk_strictMotif = TkVarAccess.new('tk_strictMotif')
if ($tk_platform['platform'] == 'unix')
TkCheckButton.new(base_frame,
- 'text'=>'Motif¥¹¥¿¥¤¥ë¤Î¥À¥¤¥¢¥í¥°¤òÍѤ¤¤ë',
+ 'text'=>'Motifスタイルã®ãƒ€ã‚¤ã‚¢ãƒ­ã‚°ã‚’用ã„ã‚‹',
'variable'=>$tk_strictMotif,
'onvalue'=>1, 'offvalue'=>0 ).pack('anchor'=>'c')
end
@@ -83,7 +83,7 @@ def fileDialog(w,ent,operation)
['All files', '*' ]
]
- if operation == '³«¤¯'
+ if operation == 'é–‹ã'
file = Tk.getOpenFile('filetypes'=>types, 'parent'=>w)
else
file = Tk.getSaveFile('filetypes'=>types, 'parent'=>w,
diff --git a/ext/tk/sample/demos-jp/floor.rb b/ext/tk/sample/demos-jp/floor.rb
index 78cc23a245..5101a026bb 100644
--- a/ext/tk/sample/demos-jp/floor.rb
+++ b/ext/tk/sample/demos-jp/floor.rb
@@ -1,4 +1,4 @@
-# -*- coding: euc-jp -*-
+# -*- coding: utf-8 -*-
#
# floorDisplay widget demo (called by 'widget')
#
@@ -50,7 +50,7 @@ def floorDisplay(w,active)
# Create items for the room entry and its label.
TkcWindow.new(w, 600, 100, 'anchor'=>'w', 'window'=>$floor_entry)
- TkcText.new(w, 600, 100, 'anchor'=>'e', 'text'=>"Éô²°ÈÖ¹æ: ")
+ TkcText.new(w, 600, 100, 'anchor'=>'e', 'text'=>"部屋番å·: ")
w['scrollregion'] = w.bbox('all')
end
@@ -1572,13 +1572,13 @@ end
# Below is the "main program" that creates the floorplan demonstration.
-# toplevel widget ¤¬Â¸ºß¤¹¤ì¤Ðºï½ü¤¹¤ë
+# toplevel widget ãŒå­˜åœ¨ã™ã‚Œã°å‰Šé™¤ã™ã‚‹
if defined?($floor_demo) && $floor_demo
$floor_demo.destroy
$floor_demo = nil
end
-# demo ÍѤΠtoplevel widget ¤òÀ¸À®
+# demo 用㮠toplevel widget を生æˆ
$floor_demo = TkToplevel.new {|w|
title("Floorplan Canvas Demonstration")
iconname("Floorplan")
@@ -1589,17 +1589,17 @@ $floor_demo = TkToplevel.new {|w|
base_frame = TkFrame.new($floor_demo).pack(:fill=>:both, :expand=>true)
-# label À¸À®
+# label 生æˆ
TkLabel.new(base_frame, 'font'=>$font, 'wraplength'=>'8i', 'justify'=>'left',
- 'text'=>"¤³¤Î¥¦¥£¥ó¥É¥¦¤Ë¤Ï¥Ç¥£¥¸¥¿¥ë¥¨¥¯¥¤¥Ã¥×¥á¥ó¥È¼Ò¤Î¥¦¥§¥¹¥¿¥ó¥ê¥µ¡¼¥Á¥é¥Ü¥é¥È¥ê (DECWRL) ¤Î´Ö¼è¤ê¤¬½ñ¤«¤ì¤¿¥­¥ã¥ó¥Ð¥¹ widget ¤¬Æþ¤Ã¤Æ¤¤¤Þ¤¹¡£¤³¤ì¤Ï 3³¬·ú¤Æ¤Ç¡¢¾ï¤Ë¤½¤Î¤¦¤Á¤Î1³¬Ê¬¤¬ÁªÂò¡¢¤Ä¤Þ¤ê¤½¤Î´Ö¼è¤ê¤¬É½¼¨¤µ¤ì¤ë¤è¤¦¤Ë¤Ê¤Ã¤Æ¤¤¤Þ¤¹¡£¤¢¤ë³¬¤òÁªÂò¤¹¤ë¤Ë¤Ï¡¢¤½¤Î¾å¤Ç¥Þ¥¦¥¹¤Îº¸¥Ü¥¿¥ó¤ò¥¯¥ê¥Ã¥¯¤·¤Æ¤¯¤À¤µ¤¤¡£¥Þ¥¦¥¹¤¬ÁªÂò¤µ¤ì¤Æ¤¤¤ë³¬¤Î¾å¤òư¤¯¤È¡¢¤½¤Î²¼¤Ë¤¢¤ëÉô²°¤Î¿§¤¬ÊѤï¤ê¡¢Éô²°Èֹ椬¡ÖÉô²°ÈÖ¹æ:¡×¥¨¥ó¥È¥ê¤Ëɽ¼¨¤µ¤ì¤Þ¤¹¡£¤Þ¤¿¡¢¥¨¥ó¥È¥ê¤ËÉô²°ÈÖ¹æ¤ò½ñ¤¯¤È¤½¤ÎÉô²°¤Î¿§¤¬ÊѤï¤ê¤Þ¤¹¡£"){
+ 'text'=>"ã“ã®ã‚¦ã‚£ãƒ³ãƒ‰ã‚¦ã«ã¯ãƒ‡ã‚£ã‚¸ã‚¿ãƒ«ã‚¨ã‚¯ã‚¤ãƒƒãƒ—メント社ã®ã‚¦ã‚§ã‚¹ã‚¿ãƒ³ãƒªã‚µãƒ¼ãƒãƒ©ãƒœãƒ©ãƒˆãƒª (DECWRL) ã®é–“å–ã‚ŠãŒæ›¸ã‹ã‚ŒãŸã‚­ãƒ£ãƒ³ãƒã‚¹ widget ãŒå…¥ã£ã¦ã„ã¾ã™ã€‚ã“れ㯠3階建ã¦ã§ã€å¸¸ã«ãã®ã†ã¡ã®1階分ãŒé¸æŠžã€ã¤ã¾ã‚Šãã®é–“å–りãŒè¡¨ç¤ºã•れるよã†ã«ãªã£ã¦ã„ã¾ã™ã€‚ã‚ã‚‹éšŽã‚’é¸æŠžã™ã‚‹ã«ã¯ã€ãã®ä¸Šã§ãƒžã‚¦ã‚¹ã®å·¦ãƒœã‚¿ãƒ³ã‚’クリックã—ã¦ãã ã•ã„。マウスãŒé¸æŠžã•れã¦ã„る階ã®ä¸Šã‚’å‹•ãã¨ã€ãã®ä¸‹ã«ã‚る部屋ã®è‰²ãŒå¤‰ã‚りã€éƒ¨å±‹ç•ªå·ãŒã€Œéƒ¨å±‹ç•ªå·:ã€ã‚¨ãƒ³ãƒˆãƒªã«è¡¨ç¤ºã•れã¾ã™ã€‚ã¾ãŸã€ã‚¨ãƒ³ãƒˆãƒªã«éƒ¨å±‹ç•ªå·ã‚’書ãã¨ãã®éƒ¨å±‹ã®è‰²ãŒå¤‰ã‚りã¾ã™ã€‚"){
pack('side'=>'top')
}
-# frame À¸À®
+# frame 生æˆ
$floor_buttons = TkFrame.new(base_frame) {|frame|
TkButton.new(frame) {
- #text 'λ²ò'
- text 'ÊĤ¸¤ë'
+ #text '了解'
+ text 'é–‰ã˜ã‚‹'
command proc{
tmppath = $floor_demo
$floor_demo = nil
@@ -1608,17 +1608,17 @@ $floor_buttons = TkFrame.new(base_frame) {|frame|
}.pack('side'=>'left', 'expand'=>'yes')
TkButton.new(frame) {
- text '¥³¡¼¥É»²¾È'
+ text 'コードå‚ç…§'
command proc{showCode 'floor'}
}.pack('side'=>'left', 'expand'=>'yes')
}
$floor_buttons.pack('side'=>'bottom', 'fill'=>'x', 'pady'=>'2m')
-# ÊÑ¿ôÀßÄê
+# 変数設定
$floorLabels = {}
$floorItems = {}
-# canvas ÀßÄê
+# canvas 設定
if $tk_version =~ /^4\.[01]/
$floor_canvas_frame = TkFrame.new(base_frame,'bd'=>2,'relief'=>'sunken',
'highlightthickness'=>2)
diff --git a/ext/tk/sample/demos-jp/floor2.rb b/ext/tk/sample/demos-jp/floor2.rb
index 92ace6b51a..7ca705c7bd 100644
--- a/ext/tk/sample/demos-jp/floor2.rb
+++ b/ext/tk/sample/demos-jp/floor2.rb
@@ -1,4 +1,4 @@
-# -*- coding: euc-jp -*-
+# -*- coding: utf-8 -*-
#
# floorDisplay widget demo 2 (called by 'widget')
#
@@ -50,7 +50,7 @@ def floorDisplay2(w,active)
# Create items for the room entry and its label.
w.create(TkcWindow, 600, 100, 'anchor'=>'w', 'window'=>$floor2_entry)
- w.create(TkcText, 600, 100, 'anchor'=>'e', 'text'=>"Éô²°ÈÖ¹æ: ")
+ w.create(TkcText, 600, 100, 'anchor'=>'e', 'text'=>"部屋番å·: ")
w['scrollregion'] = w.bbox('all')
end
@@ -1572,13 +1572,13 @@ end
# Below is the "main program" that creates the floorplan demonstration.
-# toplevel widget ¤¬Â¸ºß¤¹¤ì¤Ðºï½ü¤¹¤ë
+# toplevel widget ãŒå­˜åœ¨ã™ã‚Œã°å‰Šé™¤ã™ã‚‹
if defined?($floor2_demo) && $floor2_demo
$floor2_demo.destroy
$floor2_demo = nil
end
-# demo ÍѤΠtoplevel widget ¤òÀ¸À®
+# demo 用㮠toplevel widget を生æˆ
$floor2_demo = TkToplevel.new {|w|
title("Floorplan Canvas Demonstration 2")
iconname("Floorplan2")
@@ -1589,17 +1589,17 @@ $floor2_demo = TkToplevel.new {|w|
base_frame = TkFrame.new($floor2_demo).pack(:fill=>:both, :expand=>true)
-# label À¸À®
+# label 生æˆ
TkLabel.new(base_frame, 'font'=>$font, 'wraplength'=>'8i', 'justify'=>'left',
- 'text'=>"¤³¤Î¥¦¥£¥ó¥É¥¦¤Ë¤Ï¥Ç¥£¥¸¥¿¥ë¥¨¥¯¥¤¥Ã¥×¥á¥ó¥È¼Ò¤Î¥¦¥§¥¹¥¿¥ó¥ê¥µ¡¼¥Á¥é¥Ü¥é¥È¥ê (DECWRL) ¤Î´Ö¼è¤ê¤¬½ñ¤«¤ì¤¿¥­¥ã¥ó¥Ð¥¹ widget ¤¬Æþ¤Ã¤Æ¤¤¤Þ¤¹¡£¤³¤ì¤Ï 3³¬·ú¤Æ¤Ç¡¢¾ï¤Ë¤½¤Î¤¦¤Á¤Î1³¬Ê¬¤¬ÁªÂò¡¢¤Ä¤Þ¤ê¤½¤Î´Ö¼è¤ê¤¬É½¼¨¤µ¤ì¤ë¤è¤¦¤Ë¤Ê¤Ã¤Æ¤¤¤Þ¤¹¡£¤¢¤ë³¬¤òÁªÂò¤¹¤ë¤Ë¤Ï¡¢¤½¤Î¾å¤Ç¥Þ¥¦¥¹¤Îº¸¥Ü¥¿¥ó¤ò¥¯¥ê¥Ã¥¯¤·¤Æ¤¯¤À¤µ¤¤¡£¥Þ¥¦¥¹¤¬ÁªÂò¤µ¤ì¤Æ¤¤¤ë³¬¤Î¾å¤òư¤¯¤È¡¢¤½¤Î²¼¤Ë¤¢¤ëÉô²°¤Î¿§¤¬ÊѤï¤ê¡¢Éô²°Èֹ椬¡ÖÉô²°ÈÖ¹æ:¡×¥¨¥ó¥È¥ê¤Ëɽ¼¨¤µ¤ì¤Þ¤¹¡£¤Þ¤¿¡¢¥¨¥ó¥È¥ê¤ËÉô²°ÈÖ¹æ¤ò½ñ¤¯¤È¤½¤ÎÉô²°¤Î¿§¤¬ÊѤï¤ê¤Þ¤¹¡£"){
+ 'text'=>"ã“ã®ã‚¦ã‚£ãƒ³ãƒ‰ã‚¦ã«ã¯ãƒ‡ã‚£ã‚¸ã‚¿ãƒ«ã‚¨ã‚¯ã‚¤ãƒƒãƒ—メント社ã®ã‚¦ã‚§ã‚¹ã‚¿ãƒ³ãƒªã‚µãƒ¼ãƒãƒ©ãƒœãƒ©ãƒˆãƒª (DECWRL) ã®é–“å–ã‚ŠãŒæ›¸ã‹ã‚ŒãŸã‚­ãƒ£ãƒ³ãƒã‚¹ widget ãŒå…¥ã£ã¦ã„ã¾ã™ã€‚ã“れ㯠3階建ã¦ã§ã€å¸¸ã«ãã®ã†ã¡ã®1階分ãŒé¸æŠžã€ã¤ã¾ã‚Šãã®é–“å–りãŒè¡¨ç¤ºã•れるよã†ã«ãªã£ã¦ã„ã¾ã™ã€‚ã‚ã‚‹éšŽã‚’é¸æŠžã™ã‚‹ã«ã¯ã€ãã®ä¸Šã§ãƒžã‚¦ã‚¹ã®å·¦ãƒœã‚¿ãƒ³ã‚’クリックã—ã¦ãã ã•ã„。マウスãŒé¸æŠžã•れã¦ã„る階ã®ä¸Šã‚’å‹•ãã¨ã€ãã®ä¸‹ã«ã‚る部屋ã®è‰²ãŒå¤‰ã‚りã€éƒ¨å±‹ç•ªå·ãŒã€Œéƒ¨å±‹ç•ªå·:ã€ã‚¨ãƒ³ãƒˆãƒªã«è¡¨ç¤ºã•れã¾ã™ã€‚ã¾ãŸã€ã‚¨ãƒ³ãƒˆãƒªã«éƒ¨å±‹ç•ªå·ã‚’書ãã¨ãã®éƒ¨å±‹ã®è‰²ãŒå¤‰ã‚りã¾ã™ã€‚"){
pack('side'=>'top')
}
-# frame À¸À®
+# frame 生æˆ
$floor2_buttons = TkFrame.new(base_frame) {|frame|
TkButton.new(frame) {
- #text 'λ²ò'
- text 'ÊĤ¸¤ë'
+ #text '了解'
+ text 'é–‰ã˜ã‚‹'
command proc{
tmppath = $floor2_demo
$floor2_demo = nil
@@ -1608,17 +1608,17 @@ $floor2_buttons = TkFrame.new(base_frame) {|frame|
}.pack('side'=>'left', 'expand'=>'yes')
TkButton.new(frame) {
- text '¥³¡¼¥É»²¾È'
+ text 'コードå‚ç…§'
command proc{showCode 'floor2'}
}.pack('side'=>'left', 'expand'=>'yes')
}
$floor2_buttons.pack('side'=>'bottom', 'fill'=>'x', 'pady'=>'2m')
-# ÊÑ¿ôÀßÄê
+# 変数設定
$floorLabels2 = {}
$floorItems2 = {}
-# canvas ÀßÄê
+# canvas 設定
if $tk_version =~ /^4\.[01]/
$floor2_canvas_frame = TkFrame.new(base_frame,'bd'=>2,'relief'=>'sunken',
'highlightthickness'=>2)
diff --git a/ext/tk/sample/demos-jp/form.rb b/ext/tk/sample/demos-jp/form.rb
index 84ed94de88..000fcb5091 100644
--- a/ext/tk/sample/demos-jp/form.rb
+++ b/ext/tk/sample/demos-jp/form.rb
@@ -1,15 +1,15 @@
-# -*- coding: euc-jp -*-
+# -*- coding: utf-8 -*-
#
# form widget demo (called by 'widget')
#
-# toplevel widget ¤¬Â¸ºß¤¹¤ì¤Ðºï½ü¤¹¤ë
+# toplevel widget ãŒå­˜åœ¨ã™ã‚Œã°å‰Šé™¤ã™ã‚‹
if defined?($form_demo) && $form_demo
$form_demo.destroy
$form_demo = nil
end
-# demo ÍѤΠtoplevel widget ¤òÀ¸À®
+# demo 用㮠toplevel widget を生æˆ
$form_demo = TkToplevel.new {|w|
title("Form Demonstration")
iconname("form")
@@ -18,20 +18,20 @@ $form_demo = TkToplevel.new {|w|
base_frame = TkFrame.new($form_demo).pack(:fill=>:both, :expand=>true)
-# label À¸À®
+# label 生æˆ
msg = TkLabel.new(base_frame) {
font $font
wraplength '4i'
justify 'left'
- text "¤³¤Î¥¦¥£¥ó¥É¥¦¤Ï´Êñ¤Ê¥Õ¥©¡¼¥àÆþÎÏÍѤˤʤäƤ¤¤Æ¡¢¤µ¤Þ¤¶¤Þ¤Ê¥¨¥ó¥È¥ê¤ËÆþÎϤ¬¤Ç¤­¤Þ¤¹¡£¥¿¥Ö¤Ç¥¨¥ó¥È¥ê¤ÎÀÚÂØ¤¨¤¬¤Ç¤­¤Þ¤¹¡£"
+ text "ã“ã®ã‚¦ã‚£ãƒ³ãƒ‰ã‚¦ã¯ç°¡å˜ãªãƒ•ォーム入力用ã«ãªã£ã¦ã„ã¦ã€ã•ã¾ã–ã¾ãªã‚¨ãƒ³ãƒˆãƒªã«å…¥åŠ›ãŒã§ãã¾ã™ã€‚タブã§ã‚¨ãƒ³ãƒˆãƒªã®åˆ‡æ›¿ãˆãŒã§ãã¾ã™ã€‚"
}
msg.pack('side'=>'top', 'fill'=>'x')
-# frame À¸À®
+# frame 生æˆ
TkFrame.new(base_frame) {|frame|
TkButton.new(frame) {
- #text 'λ²ò'
- text 'ÊĤ¸¤ë'
+ #text '了解'
+ text 'é–‰ã˜ã‚‹'
command proc{
tmppath = $form_demo
$form_demo = nil
@@ -40,12 +40,12 @@ TkFrame.new(base_frame) {|frame|
}.pack('side'=>'left', 'expand'=>'yes')
TkButton.new(frame) {
- text '¥³¡¼¥É»²¾È'
+ text 'コードå‚ç…§'
command proc{showCode 'form'}
}.pack('side'=>'left', 'expand'=>'yes')
}.pack('side'=>'bottom', 'fill'=>'x', 'pady'=>'2m')
-# entry À¸À®
+# entry 生æˆ
form_data = []
(1..5).each{|i|
f = TkFrame.new(base_frame, 'bd'=>2)
@@ -56,10 +56,10 @@ form_data = []
form_data[i] = {'frame'=>f, 'entry'=>e, 'label'=>l}
}
-# ʸ»úÎóÀßÄê
-form_data[1]['label'].text('̾Á°:')
-form_data[2]['label'].text('½»½ê:')
-form_data[5]['label'].text('ÅÅÏÃ:')
+# 文字列設定
+form_data[1]['label'].text('åå‰:')
+form_data[2]['label'].text('使‰€:')
+form_data[5]['label'].text('電話:')
# pack
(1..5).each{|i| form_data[i]['frame'].pack('side'=>'top', 'fill'=>'x')}
diff --git a/ext/tk/sample/demos-jp/goldberg.rb b/ext/tk/sample/demos-jp/goldberg.rb
index ea521b82ec..fc38d877db 100644
--- a/ext/tk/sample/demos-jp/goldberg.rb
+++ b/ext/tk/sample/demos-jp/goldberg.rb
@@ -1,4 +1,4 @@
-# -*- coding: euc-jp -*-
+# -*- coding: utf-8 -*-
#
# Ruby/Tk Goldverg demo (called by 'widget')
#
@@ -63,7 +63,7 @@ msg = TkLabel.new($goldberg_demo) {
font 'Arial 10'
wraplength '4i'
justify 'left'
- text "¤³¤ì¤Ï¡¢¤¢¤Ê¤¿¤¬¼«Ê¬¤Î¥¢¥Ë¥á¡¼¥·¥ç¥ó¤ò¤¤¤«¤ËÆþ¤êÁȤó¤À¤â¤Î¤Ë¤Ç¤­¤ë¤«¤ò¼¨¤¹¤È¤¤¤¦¤À¤±¤Î¤¿¤á¤Î¥Ç¥â¤Ç¤¹¡£¥Ü¡¼¥ë¤ò¥¯¥ê¥Ã¥¯¤¹¤ì¤Ðʪ¤¬Æ°¤­»Ï¤á¤Þ¤¹¡ª\n\n\"Man will always find a difficult means to perform a simple task\"\n - Rube Goldberg"
+ text "ã“れã¯ã€ã‚ãªãŸãŒè‡ªåˆ†ã®ã‚¢ãƒ‹ãƒ¡ãƒ¼ã‚·ãƒ§ãƒ³ã‚’ã„ã‹ã«å…¥ã‚Šçµ„ã‚“ã ã‚‚ã®ã«ã§ãã‚‹ã‹ã‚’示ã™ã¨ã„ã†ã ã‘ã®ãŸã‚ã®ãƒ‡ãƒ¢ã§ã™ã€‚ボールをクリックã™ã‚Œã°ç‰©ãŒå‹•ãå§‹ã‚ã¾ã™ï¼\n\n\"Man will always find a difficult means to perform a simple task\"\n - Rube Goldberg"
}
msg.pack('side'=>'top')
=end
@@ -72,7 +72,7 @@ msg.pack('side'=>'top')
# frame
TkFrame.new($goldberg_demo) {|frame|
TkButton.new(frame) {
- text 'ÊĤ¸¤ë'
+ text 'é–‰ã˜ã‚‹'
command proc{
tmppath = $goldberg_demo
$goldberg_demo = nil
@@ -81,7 +81,7 @@ TkFrame.new($goldberg_demo) {|frame|
}.pack('side'=>'left', 'expand'=>'yes')
TkButton.new(frame) {
- text '¥³¡¼¥É»²¾È'
+ text 'コードå‚ç…§'
command proc{showCode 'goldberg'}
}.pack('side'=>'left', 'expand'=>'yes')
@@ -99,7 +99,7 @@ class TkGoldberg_Demo
@S['speed'] = TkVariable.new(5)
@S['cnt'] = TkVariable.new(0)
# @S['message'] = TkVariable.new("\\nWelcome\\nto\\nRuby/Tk")
- @S['message'] = TkVariable.new("\\n ¤è¤¦¤³¤½¡ª\\nRuby/Tk\\n¤Î\\nÀ¤³¦¤Ø")
+ @S['message'] = TkVariable.new("\\n よã†ã“ãï¼\\nRuby/Tk\\nã®\\n世界ã¸")
@S['pause'] = TkVariable.new
@S['details'] = TkVariable.new(true)
@@ -184,7 +184,7 @@ class TkGoldberg_Demo
font 'Arial 10'
wraplength 600
justify 'left'
- text "¤³¤ì¤Ï¡¢¤¢¤Ê¤¿¤¬¼«Ê¬¤Î¥¢¥Ë¥á¡¼¥·¥ç¥ó¤ò¤¤¤«¤ËÆþ¤êÁȤó¤À¤â¤Î¤Ë¤Ç¤­¤ë¤«¤ò¼¨¤¹¤È¤¤¤¦¤À¤±¤Î¤¿¤á¤Î¥Ç¥â¤Ç¤¹¡£¥Ü¡¼¥ë¤ò¥¯¥ê¥Ã¥¯¤¹¤ì¤Ðʪ¤¬Æ°¤­»Ï¤á¤Þ¤¹¡ª\n\"Man will always find a difficult means to perform a simple task\" - Rube Goldberg"
+ text "ã“れã¯ã€ã‚ãªãŸãŒè‡ªåˆ†ã®ã‚¢ãƒ‹ãƒ¡ãƒ¼ã‚·ãƒ§ãƒ³ã‚’ã„ã‹ã«å…¥ã‚Šçµ„ã‚“ã ã‚‚ã®ã«ã§ãã‚‹ã‹ã‚’示ã™ã¨ã„ã†ã ã‘ã®ãŸã‚ã®ãƒ‡ãƒ¢ã§ã™ã€‚ボールをクリックã™ã‚Œã°ç‰©ãŒå‹•ãå§‹ã‚ã¾ã™ï¼\n\"Man will always find a difficult means to perform a simple task\" - Rube Goldberg"
}
msg.place(:in=>@canvas, :relx=>0, :rely=>0, :anchor=>:nw)
@@ -192,7 +192,7 @@ class TkGoldberg_Demo
# TkButton.new(frame, :bg=>@C['bg'], :activebackground=>@C['bg']) {
Tk::Button.new(frame, :bg=>@C['bg'], :activebackground=>@C['bg']) {
- text 'ÊĤ¸¤ë'
+ text 'é–‰ã˜ã‚‹'
command proc{
tmppath = $goldberg_demo
$goldberg_demo = nil
@@ -202,7 +202,7 @@ class TkGoldberg_Demo
# TkButton.new(frame, :bg=>@C['bg'], :activebackground=>@C['bg']) {
Tk::Button.new(frame, :bg=>@C['bg'], :activebackground=>@C['bg']) {
- text '¥³¡¼¥É»²¾È'
+ text 'コードå‚ç…§'
command proc{showCode 'goldberg'}
}.pack('side'=>'left', 'padx'=>5)
@@ -420,7 +420,7 @@ class TkGoldberg_Demo
color = @C['0']
TkcText.new(@canvas,
# [579, 119], :text=>'START HERE!',
- [558, 119], :text=>'¤³¤³¤«¤é¥¹¥¿¡¼¥È¡ª',
+ [558, 119], :text=>'ã“ã“ã‹ã‚‰ã‚¹ã‚¿ãƒ¼ãƒˆï¼',
:fill=>color, :anchor=>:w,
:tag=>'I0', :font=>['Times Roman', 12, :italic, :bold])
TkcLine.new(@canvas, [719, 119, 763, 119], :tag=>'I0', :fill=>color,
@@ -1792,7 +1792,7 @@ class TkGoldberg_Demo
@canvas.delete('I24', 'I26')
TkcText.new(@canvas, 430, 735, :anchor=>:s, :tag=>'I26',
#:text=>'click to continue',
- :text=>'¥¯¥ê¥Ã¥¯¤Ç¥ê¥»¥Ã¥È¤·¤Þ¤¹',
+ :text=>'クリックã§ãƒªã‚»ãƒƒãƒˆã—ã¾ã™',
:font=>['Times Roman', 20, :bold])
@canvas.bind('1', proc{reset})
return 4
diff --git a/ext/tk/sample/demos-jp/hello b/ext/tk/sample/demos-jp/hello
index 08f154d499..e942f3d851 100644
--- a/ext/tk/sample/demos-jp/hello
+++ b/ext/tk/sample/demos-jp/hello
@@ -1,10 +1,10 @@
#!/usr/bin/env ruby
-# -*- coding: euc-jp -*-
+# -*- coding: utf-8 -*-
require 'tk'
TkButton.new(nil,
- 'text'=>"¤³¤ó¤Ë¤Á¤Ï¡¢À¤³¦",
- 'command'=>proc{print "¤³¤ó¤Ë¤Á¤Ï¡¢À¤³¦\n"; exit}
+ 'text'=>"ã“ã‚“ã«ã¡ã¯ã€ä¸–界",
+ 'command'=>proc{print "ã“ã‚“ã«ã¡ã¯ã€ä¸–界\n"; exit}
).pack
Tk.mainloop
diff --git a/ext/tk/sample/demos-jp/hscale.rb b/ext/tk/sample/demos-jp/hscale.rb
index 5615aa50bd..2dfbf38272 100644
--- a/ext/tk/sample/demos-jp/hscale.rb
+++ b/ext/tk/sample/demos-jp/hscale.rb
@@ -1,4 +1,4 @@
-# -*- coding: euc-jp -*-
+# -*- coding: utf-8 -*-
require "tkcanvas"
if defined?($hscale_demo) && $hscale_deom
@@ -18,16 +18,16 @@ msg = TkLabel.new(base_frame) {
font $font
wraplength '3.5i'
justify 'left'
- text "²¼¤Ë¤ÏÌð°õ¤¬1¤Ä¤È¿åÊ¿¤Ê¥¹¥±¡¼¥ë¤¬É½¼¨¤µ¤ì¤Æ¤¤¤Þ¤¹¡£\
-¥¹¥±¡¼¥ë¾å¤Ç¥Þ¥¦¥¹¥Ü¥¿¥ó1¤ò¥¯¥ê¥Ã¥¯¡¢¤Þ¤¿¤Ï¥É¥é¥Ã¥°¤¹¤ë¤È\
-Ìð°õ¤ÎŤµ¤òÊѤ¨¤ë¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£"
+ text "下ã«ã¯çŸ¢å°ãŒ1ã¤ã¨æ°´å¹³ãªã‚¹ã‚±ãƒ¼ãƒ«ãŒè¡¨ç¤ºã•れã¦ã„ã¾ã™ã€‚\
+スケール上ã§ãƒžã‚¦ã‚¹ãƒœã‚¿ãƒ³1をクリックã€ã¾ãŸã¯ãƒ‰ãƒ©ãƒƒã‚°ã™ã‚‹ã¨\
+矢å°ã®é•·ã•を変ãˆã‚‹ã“ã¨ãŒã§ãã¾ã™ã€‚"
}
msg.pack('side'=>'top')
TkFrame.new(base_frame) {|frame|
TkButton.new(frame) {
- #text 'λ²ò'
- text 'ÊĤ¸¤ë'
+ #text '了解'
+ text 'é–‰ã˜ã‚‹'
command proc {
tmppath = $hscale_demo
$hscale_demo = nil
@@ -36,7 +36,7 @@ TkFrame.new(base_frame) {|frame|
}.pack('side'=>'left', 'expand'=>'yes')
TkButton.new(frame) {
- text '¥³¡¼¥É»²¾È'
+ text 'コードå‚ç…§'
command proc { showCode 'hscale' }
}.pack('side'=>'left', 'expand'=>'yes')
}.pack('side'=>'bottom', 'fill'=>'x', 'pady'=>'2m')
diff --git a/ext/tk/sample/demos-jp/icon.rb b/ext/tk/sample/demos-jp/icon.rb
index 935519435b..6b9e1a570a 100644
--- a/ext/tk/sample/demos-jp/icon.rb
+++ b/ext/tk/sample/demos-jp/icon.rb
@@ -1,15 +1,15 @@
-# -*- coding: euc-jp -*-
+# -*- coding: utf-8 -*-
#
# iconic button widget demo (called by 'widget')
#
-# toplevel widget ¤¬Â¸ºß¤¹¤ì¤Ðºï½ü¤¹¤ë
+# toplevel widget ãŒå­˜åœ¨ã™ã‚Œã°å‰Šé™¤ã™ã‚‹
if defined?($icon_demo) && $icon_demo
$icon_demo.destroy
$icon_demo = nil
end
-# demo ÍѤΠtoplevel widget ¤òÀ¸À®
+# demo 用㮠toplevel widget を生æˆ
$icon_demo = TkToplevel.new {|w|
title("Iconic Button Demonstration")
iconname("icon")
@@ -18,20 +18,20 @@ $icon_demo = TkToplevel.new {|w|
base_frame = TkFrame.new($icon_demo).pack(:fill=>:both, :expand=>true)
-# label À¸À®
+# label 生æˆ
msg = TkLabel.new(base_frame) {
font $font
wraplength '5i'
justify 'left'
- text "¤³¤Î¥¦¥£¥ó¥É¥¦¤Ë¤Ï¥é¥¸¥ª¥Ü¥¿¥ó¤È¥Á¥§¥Ã¥¯¥Ü¥¿¥ó¾å¤Ë¥Ó¥Ã¥È¥Þ¥Ã¥×¤ä²èÁü¤òɽ¼¨¤¹¤ë 3 ¤Ä¤ÎÊýË¡¤ò¼¨¤·¤Æ¤¤¤Þ¤¹¡£º¸¤Ë¤¢¤ë¤Î¤Ï2¤Ä¤Î¥é¥¸¥ª¥Ü¥¿¥ó¤Ç¡¢¤½¤ì¤¾¤ì¤¬¡¢¥Ó¥Ã¥È¥Þ¥Ã¥×¤ÈÁªÂò¤ò¼¨¤¹¥¤¥ó¥¸¥±¡¼¥¿¤Ç¤Ç¤­¤Æ¤¤¤Þ¤¹¡£Ãæ±û¤Ë¤¢¤ë¤Î¤Ï¡¢ÁªÂòºÑ¤ß¤«¤É¤¦¤«¤Ë¤è¤Ã¤Æ°Û¤Ê¤ë²èÁü¤òɽ¼¨¤¹¤ë¥Á¥§¥Ã¥¯¥Ü¥¿¥ó¤Ç¤¹¡£±¦Â¦¤Ë¤¢¤ë¤Î¤ÏÁªÂòºÑ¤ß¤«¤É¤¦¤«¤Ë¤è¤Ã¤ÆÇØ·Ê¿§¤¬ÊѤï¤ë¥Ó¥Ã¥È¥Þ¥Ã¥×¤òɽ¼¨¤¹¤ë¥Á¥§¥Ã¥¯¥Ü¥¿¥ó¤Ç¤¹¡£"
+ text "ã“ã®ã‚¦ã‚£ãƒ³ãƒ‰ã‚¦ã«ã¯ãƒ©ã‚¸ã‚ªãƒœã‚¿ãƒ³ã¨ãƒã‚§ãƒƒã‚¯ãƒœã‚¿ãƒ³ä¸Šã«ãƒ“ットマップや画åƒã‚’表示ã™ã‚‹ 3 ã¤ã®æ–¹æ³•を示ã—ã¦ã„ã¾ã™ã€‚å·¦ã«ã‚ã‚‹ã®ã¯2ã¤ã®ãƒ©ã‚¸ã‚ªãƒœã‚¿ãƒ³ã§ã€ãれãžã‚ŒãŒã€ãƒ“ットマップã¨é¸æŠžã‚’示ã™ã‚¤ãƒ³ã‚¸ã‚±ãƒ¼ã‚¿ã§ã§ãã¦ã„ã¾ã™ã€‚中央ã«ã‚ã‚‹ã®ã¯ã€é¸æŠžæ¸ˆã¿ã‹ã©ã†ã‹ã«ã‚ˆã£ã¦ç•°ãªã‚‹ç”»åƒã‚’表示ã™ã‚‹ãƒã‚§ãƒƒã‚¯ãƒœã‚¿ãƒ³ã§ã™ã€‚å³å´ã«ã‚ã‚‹ã®ã¯é¸æŠžæ¸ˆã¿ã‹ã©ã†ã‹ã«ã‚ˆã£ã¦èƒŒæ™¯è‰²ãŒå¤‰ã‚るビットマップを表示ã™ã‚‹ãƒã‚§ãƒƒã‚¯ãƒœã‚¿ãƒ³ã§ã™ã€‚"
}
msg.pack('side'=>'top')
-# frame À¸À®
+# frame 生æˆ
TkFrame.new(base_frame) {|frame|
TkButton.new(frame) {
- #text 'λ²ò'
- text 'ÊĤ¸¤ë'
+ #text '了解'
+ text 'é–‰ã˜ã‚‹'
command proc{
tmppath = $icon_demo
$icon_demo = nil
@@ -40,13 +40,13 @@ TkFrame.new(base_frame) {|frame|
}.pack('side'=>'left', 'expand'=>'yes')
TkButton.new(frame) {
- text '¥³¡¼¥É»²¾È'
+ text 'コードå‚ç…§'
command proc{showCode 'icon'}
}.pack('side'=>'left', 'expand'=>'yes')
}.pack('side'=>'bottom', 'fill'=>'x', 'pady'=>'2m')
-# image À¸À®
+# image 生æˆ
flagup = \
TkBitmapImage.new('file'=>[$demo_dir,'..',
'images','flagup.xbm'].join(File::Separator),
@@ -59,10 +59,10 @@ TkBitmapImage.new('file'=>[$demo_dir,'..',
[$demo_dir,'..',
'images','flagdown.xbm'].join(File::Separator))
-# ÊÑ¿ôÀ¸À®
+# 変数生æˆ
letters = TkVariable.new
-# frame À¸À®
+# frame 生æˆ
TkFrame.new(base_frame, 'borderwidth'=>10){|w|
TkFrame.new(w) {|f|
# TkRadioButton.new(f){
diff --git a/ext/tk/sample/demos-jp/image1.rb b/ext/tk/sample/demos-jp/image1.rb
index 10078c6c22..0c69b2a45f 100644
--- a/ext/tk/sample/demos-jp/image1.rb
+++ b/ext/tk/sample/demos-jp/image1.rb
@@ -1,15 +1,15 @@
-# -*- coding: euc-jp -*-
+# -*- coding: utf-8 -*-
#
# two image widgets demo (called by 'widget')
#
-# toplevel widget ¤¬Â¸ºß¤¹¤ì¤Ðºï½ü¤¹¤ë
+# toplevel widget ãŒå­˜åœ¨ã™ã‚Œã°å‰Šé™¤ã™ã‚‹
if defined?($image1_demo) && $image1_demo
$image1_demo.destroy
$image1_demo = nil
end
-# demo ÍѤΠtoplevel widget ¤òÀ¸À®
+# demo 用㮠toplevel widget を生æˆ
$image1_demo = TkToplevel.new {|w|
title('Image Demonstration #1')
iconname("Image1")
@@ -18,20 +18,20 @@ $image1_demo = TkToplevel.new {|w|
base_frame = TkFrame.new($image1_demo).pack(:fill=>:both, :expand=>true)
-# label À¸À®
+# label 生æˆ
msg = TkLabel.new(base_frame) {
font $font
wraplength '4i'
justify 'left'
- text "¤³¤Î¥Ç¥â¤Ç¤Ï2¤Ä¤Î¥é¥Ù¥ë¾å¤Ë²èÁü¤ò¤½¤ì¤¾¤ìɽ¼¨¤·¤Æ¤¤¤Þ¤¹¡£"
+ text "ã“ã®ãƒ‡ãƒ¢ã§ã¯2ã¤ã®ãƒ©ãƒ™ãƒ«ä¸Šã«ç”»åƒã‚’ãれãžã‚Œè¡¨ç¤ºã—ã¦ã„ã¾ã™ã€‚"
}
msg.pack('side'=>'top')
-# frame À¸À®
+# frame 生æˆ
TkFrame.new(base_frame) {|frame|
TkButton.new(frame) {
- #text 'λ²ò'
- text 'ÊĤ¸¤ë'
+ #text '了解'
+ text 'é–‰ã˜ã‚‹'
command proc{
tmppath = $image1_demo
$image1_demo = nil
@@ -40,13 +40,13 @@ TkFrame.new(base_frame) {|frame|
}.pack('side'=>'left', 'expand'=>'yes')
TkButton.new(frame) {
- text '¥³¡¼¥É»²¾È'
+ text 'コードå‚ç…§'
command proc{showCode 'image1'}
}.pack('side'=>'left', 'expand'=>'yes')
}.pack('side'=>'bottom', 'fill'=>'x', 'pady'=>'2m')
-# image À¸À®
+# image 生æˆ
image1a = \
TkPhotoImage.new('file'=>[$demo_dir,'..',
'images','earth.gif'].join(File::Separator))
@@ -54,7 +54,7 @@ image1b = \
TkPhotoImage.new('file'=>[$demo_dir,'..',
'images','earthris.gif'].join(File::Separator))
-# label À¸À®
+# label 生æˆ
#[ TkLabel.new(base_frame, 'image'=>image1a, 'bd'=>1, 'relief'=>'sunken'),
# TkLabel.new(base_frame, 'image'=>image1b, 'bd'=>1, 'relief'=>'sunken')
#].each{|w| w.pack('side'=>'top', 'padx'=>'.5m', 'pady'=>'.5m')}
diff --git a/ext/tk/sample/demos-jp/image2.rb b/ext/tk/sample/demos-jp/image2.rb
index 3e8b87461f..aa507c5b9b 100644
--- a/ext/tk/sample/demos-jp/image2.rb
+++ b/ext/tk/sample/demos-jp/image2.rb
@@ -1,15 +1,15 @@
-# -*- coding: euc-jp -*-
+# -*- coding: utf-8 -*-
#
# widget demo 'load image' (called by 'widget')
#
-# toplevel widget ¤¬Â¸ºß¤¹¤ì¤Ðºï½ü¤¹¤ë
+# toplevel widget ãŒå­˜åœ¨ã™ã‚Œã°å‰Šé™¤ã™ã‚‹
if defined?($image2_demo) && $image2_demo
$image2_demo.destroy
$image2_demo = nil
end
-# demo ÍѤΠtoplevel widget ¤òÀ¸À®
+# demo 用㮠toplevel widget を生æˆ
$image2_demo = TkToplevel.new {|w|
title('Image Demonstration #2')
iconname("Image2")
@@ -18,20 +18,20 @@ $image2_demo = TkToplevel.new {|w|
base_frame = TkFrame.new($image2_demo).pack(:fill=>:both, :expand=>true)
-# label À¸À®
+# label 生æˆ
msg = TkLabel.new(base_frame) {
font $font
wraplength '4i'
justify 'left'
- text "¤³¤Î¥Ç¥â¤Ç¤ÏTk¤Î photo image ¤ò»ÈÍѤ·¤Æ²èÁü¤ò¸«¤ë¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£ºÇ½é¤Ë¥¨¥ó¥È¥êÆâ¤Ë¤Ë¥Ç¥£¥ì¥¯¥È¥ê̾¤òÆþ¤ì¤Æ²¼¤µ¤¤¡£¼¡¤Ë²¼¤Î¥ê¥¹¥È¥Ü¥Ã¥¯¥¹¤Ë¤³¤Î¥Ç¥£¥ì¥¯¥È¥ê¤ò¥í¡¼¥É¤¹¤ë¤¿¤á¡¢¥ê¥¿¡¼¥ó¤ò²¡¤·¤Æ¤¯¤À¤µ¤¤¡£¤½¤Î¸å¡¢²èÁü¤òÁªÂò¤¹¤ë¤¿¤á¤Ë¥ê¥¹¥È¥Ü¥Ã¥¯¥¹¤ÎÃæ¤Î¥Õ¥¡¥¤¥ë̾¤ò¥À¥Ö¥ë¥¯¥ê¥Ã¥¯¤·¤Æ²¼¤µ¤¤¡£"
+ text "ã“ã®ãƒ‡ãƒ¢ã§ã¯Tkã® photo image を使用ã—ã¦ç”»åƒã‚’見るã“ã¨ãŒã§ãã¾ã™ã€‚最åˆã«ã‚¨ãƒ³ãƒˆãƒªå†…ã«ã«ãƒ‡ã‚£ãƒ¬ã‚¯ãƒˆãƒªåを入れã¦ä¸‹ã•ã„。次ã«ä¸‹ã®ãƒªã‚¹ãƒˆãƒœãƒƒã‚¯ã‚¹ã«ã“ã®ãƒ‡ã‚£ãƒ¬ã‚¯ãƒˆãƒªã‚’ロードã™ã‚‹ãŸã‚ã€ãƒªã‚¿ãƒ¼ãƒ³ã‚’押ã—ã¦ãã ã•ã„。ãã®å¾Œã€ç”»åƒã‚’é¸æŠžã™ã‚‹ãŸã‚ã«ãƒªã‚¹ãƒˆãƒœãƒƒã‚¯ã‚¹ã®ä¸­ã®ãƒ•ァイルåをダブルクリックã—ã¦ä¸‹ã•ã„。"
}
msg.pack('side'=>'top')
-# frame À¸À®
+# frame 生æˆ
TkFrame.new(base_frame) {|frame|
TkButton.new(frame) {
- #text 'λ²ò'
- text 'ÊĤ¸¤ë'
+ #text '了解'
+ text 'é–‰ã˜ã‚‹'
command proc{
tmppath = $image2_demo
$image2_demo = nil
@@ -40,20 +40,20 @@ TkFrame.new(base_frame) {|frame|
}.pack('side'=>'left', 'expand'=>'yes')
TkButton.new(frame) {
- text '¥³¡¼¥É»²¾È'
+ text 'コードå‚ç…§'
command proc{showCode 'image2'}
}.pack('side'=>'left', 'expand'=>'yes')
}.pack('side'=>'bottom', 'fill'=>'x', 'pady'=>'2m')
-# ÊÑ¿ôÀ¸À®
+# 変数生æˆ
$dirName = TkVariable.new([$demo_dir,'..','images'].join(File::Separator))
-# image À¸À®
+# image 生æˆ
$image2a = TkPhotoImage.new
-# ¥Õ¥¡¥¤¥ë̾ÆþÎÏÉô
-TkLabel.new(base_frame, 'text'=>'¥Ç¥£¥ì¥¯¥È¥ê:')\
+# ファイルå入力部
+TkLabel.new(base_frame, 'text'=>'ディレクトリ:')\
.pack('side'=>'top', 'anchor'=>'w')
image2_e = TkEntry.new(base_frame) {
@@ -64,7 +64,7 @@ image2_e = TkEntry.new(base_frame) {
TkFrame.new(base_frame, 'height'=>'3m', 'width'=>20)\
.pack('side'=>'top', 'anchor'=>'w')
-TkLabel.new(base_frame, 'text'=>'¥Õ¥¡¥¤¥ë:')\
+TkLabel.new(base_frame, 'text'=>'ファイル:')\
.pack('side'=>'top', 'anchor'=>'w')
TkFrame.new(base_frame){|w|
@@ -85,14 +85,14 @@ TkFrame.new(base_frame){|w|
}.pack('side'=>'top', 'anchor'=>'w')
-# image ÇÛÃÖ
+# image é…ç½®
[ TkFrame.new(base_frame, 'height'=>'3m', 'width'=>20),
- TkLabel.new(base_frame, 'text'=>'²èÁü:'),
+ TkLabel.new(base_frame, 'text'=>'ç”»åƒ:'),
# TkLabel.new(base_frame, 'image'=>$image2a)
Tk::Label.new(base_frame, 'image'=>$image2a)
].each{|w| w.pack('side'=>'top', 'anchor'=>'w')}
-# ¥á¥½¥Ã¥ÉÄêµÁ
+# メソッド定義
def loadDir(w)
w.delete(0,'end')
Dir.glob([$dirName,'*'].join(File::Separator)).sort.each{|f|
diff --git a/ext/tk/sample/demos-jp/image3.rb b/ext/tk/sample/demos-jp/image3.rb
index 625e69a21d..5c1ceb2816 100644
--- a/ext/tk/sample/demos-jp/image3.rb
+++ b/ext/tk/sample/demos-jp/image3.rb
@@ -1,4 +1,4 @@
-# -*- coding: euc-jp -*-
+# -*- coding: utf-8 -*-
# image3.rb
#
# This demonstration script creates a simple collection of widgets
@@ -56,15 +56,15 @@ msg = TkLabel.new(base_frame) {
font $font
wraplength '4i'
justify 'left'
- text "¤³¤Î¥Ç¥â¤Ç¤ÏTk¤Î photo image ¤ò»ÈÍѤ·¤Æ²èÁü¤ò ¸«¤ë¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£ºÇ½é¤Ë¥¨¥ó¥È¥êÆâ¤Ë¤Ë¥Ç¥£¥ì¥¯¥È¥ê̾¤òÆþ¤ì¤Æ²¼¤µ¤¤¡£¼¡¤Ë²¼¤Î¥ê¥¹¥È¥Ü¥Ã¥¯¥¹¤Ë¤³¤Î¥Ç¥£¥ì¥¯¥È¥ê¤ò¥í¡¼¥É¤¹¤ë¤¿¤á¡¢¥ê¥¿¡¼¥ó¤ò²¡¤·¤Æ¤¯¤À¤µ¤¤¡£¤½¤Î¸å¡¢²èÁü¤òÁªÂò¤¹¤ë¤¿¤á¤Ë¥ê¥¹¥È¥Ü¥Ã¥¯¥¹¤ÎÃæ¤Î¥Õ¥¡¥¤¥ë̾¤ò¥À¥Ö¥ë¥¯¥ê¥Ã¥¯¤·¤Æ²¼¤µ¤¤¡£"
+ text "ã“ã®ãƒ‡ãƒ¢ã§ã¯Tkã® photo image を使用ã—ã¦ç”»åƒã‚’ 見るã“ã¨ãŒã§ãã¾ã™ã€‚最åˆã«ã‚¨ãƒ³ãƒˆãƒªå†…ã«ã«ãƒ‡ã‚£ãƒ¬ã‚¯ãƒˆãƒªåを入れã¦ä¸‹ã•ã„。次ã«ä¸‹ã®ãƒªã‚¹ãƒˆãƒœãƒƒã‚¯ã‚¹ã«ã“ã®ãƒ‡ã‚£ãƒ¬ã‚¯ãƒˆãƒªã‚’ロードã™ã‚‹ãŸã‚ã€ãƒªã‚¿ãƒ¼ãƒ³ã‚’押ã—ã¦ãã ã•ã„。ãã®å¾Œã€ç”»åƒã‚’é¸æŠžã™ã‚‹ãŸã‚ã«ãƒªã‚¹ãƒˆãƒœãƒƒã‚¯ã‚¹ã®ä¸­ã®ãƒ•ァイルåをダブルクリックã—ã¦ä¸‹ã•ã„。"
}
msg.pack('side'=>'top')
# frame
TkFrame.new(base_frame) {|frame|
TkButton.new(frame) {
- #text 'λ²ò'
- text 'ÊĤ¸¤ë'
+ #text '了解'
+ text 'é–‰ã˜ã‚‹'
command proc{
tmppath = $image3_demo
$image3_demo = nil
@@ -73,7 +73,7 @@ TkFrame.new(base_frame) {|frame|
}.pack('side'=>'left', 'expand'=>'yes')
TkButton.new(frame) {
- text '¥³¡¼¥É»²¾È'
+ text 'コードå‚ç…§'
command proc{showCode 'image3'}
}.pack('side'=>'left', 'expand'=>'yes')
@@ -92,9 +92,9 @@ $image3a = TkPhotoImage.new
#
image3_f = TkFrame.new(base_frame).pack(:fill=>:both, :expand=>true)
-image3_df = TkLabelFrame.new(base_frame, :text=>'¥Ç¥£¥ì¥¯¥È¥ê:')
+image3_df = TkLabelFrame.new(base_frame, :text=>'ディレクトリ:')
-image3_ff = TkLabelFrame.new(base_frame, :text=>'¥Õ¥¡¥¤¥ë:',
+image3_ff = TkLabelFrame.new(base_frame, :text=>'ファイル:',
:padx=>'2m', :pady=>'2m')
image3_lbx = TkListbox.new(image3_ff, :width=>20, :height=>10) {
pack(:side=>:left, :fill=>:y, :expand=>true)
@@ -109,12 +109,12 @@ image3_ent = TkEntry.new(image3_df, :width=>30, :textvariable=>$dirName){
bind('Return', proc{loadDir3(image3_lbx)})
}
-TkButton.new(image3_df, :pady=>0, :padx=>'2m', :text=>"¥Ç¥£¥ì¥¯¥È¥êÁªÂò",
+TkButton.new(image3_df, :pady=>0, :padx=>'2m', :text=>"ãƒ‡ã‚£ãƒ¬ã‚¯ãƒˆãƒªé¸æŠž",
:command=>proc{selectAndLoadDir3(image3_ent, image3_lbx)}) {
pack(:side=>:left, :fill=>:y, :padx=>[0, '2m'], :pady=>'2m')
}
-image3_if = TkLabelFrame.new(base_frame, :text=>'¥¤¥á¡¼¥¸:') {|f|
+image3_if = TkLabelFrame.new(base_frame, :text=>'イメージ:') {|f|
# TkLabel.new(f, :image=>$image3a).pack(:padx=>'2m', :pady=>'2m')
Tk::Label.new(f, :image=>$image3a).pack(:padx=>'2m', :pady=>'2m')
}
diff --git a/ext/tk/sample/demos-jp/items.rb b/ext/tk/sample/demos-jp/items.rb
index 4440905db8..b1d66f367b 100644
--- a/ext/tk/sample/demos-jp/items.rb
+++ b/ext/tk/sample/demos-jp/items.rb
@@ -1,15 +1,15 @@
-# -*- coding: euc-jp -*-
+# -*- coding: utf-8 -*-
#
# canvas item types widget demo (called by 'widget')
#
-# toplevel widget ¤¬Â¸ºß¤¹¤ì¤Ðºï½ü¤¹¤ë
+# toplevel widget ãŒå­˜åœ¨ã™ã‚Œã°å‰Šé™¤ã™ã‚‹
if defined?($items_demo) && $items_demo
$items_demo.destroy
$items_demo = nil
end
-# demo ÍѤΠtoplevel widget ¤òÀ¸À®
+# demo 用㮠toplevel widget を生æˆ
$items_demo = TkToplevel.new {|w|
title("Canvas Item Demonstration")
iconname("Items")
@@ -18,19 +18,19 @@ $items_demo = TkToplevel.new {|w|
base_frame = TkFrame.new($items_demo).pack(:fill=>:both, :expand=>true)
-# label À¸À®
+# label 生æˆ
TkLabel.new(base_frame) {
font $font
wraplength '5i'
justify 'left'
- text "¤³¤Î¥¦¥£¥ó¥É¥¦¤Ë¤Ï¥­¥ã¥ó¥Ð¥¹ widget ¤¬Æþ¤Ã¤Æ¤ª¤ê¡¢¤½¤ÎÃæ¤Ë¤Ï¥­¥ã¥ó¥Ð¥¹ widget ¤¬¥µ¥Ý¡¼¥È¤¹¤ëÍÍ¡¹¤Ê¥¿¥¤¥×¤Î¥¢¥¤¥Æ¥à¤ÎÎ㤬Æþ¤Ã¤Æ¤¤¤Þ¤¹¡£¼¡¤Î¤è¤¦¤ÊÁàºî¤¬¤Ç¤­¤Þ¤¹¡£\n ¥Ü¥¿¥ó-1 ¥É¥é¥Ã¥°:\t¥¢¥¤¥Æ¥à¤òư¤«¤¹¡£\n ¥Ü¥¿¥ó-2 ¥É¥é¥Ã¥°:\t¸«¤¨¤Æ¤¤¤ëÉôʬ¤ò¤º¤é¤¹¡£\n ¥Ü¥¿¥ó-3 ¥É¥é¥Ã¥°:\tÎΰè¤ò°Ï¤¦¡£\n ¥³¥ó¥È¥í¡¼¥ë-F:\tÎΰè¤Î²¼¤Î¥¢¥¤¥Æ¥à¤òɽ¼¨¤¹¤ë¡£"
+ text "ã“ã®ã‚¦ã‚£ãƒ³ãƒ‰ã‚¦ã«ã¯ã‚­ãƒ£ãƒ³ãƒã‚¹ widget ãŒå…¥ã£ã¦ãŠã‚Šã€ãã®ä¸­ã«ã¯ã‚­ãƒ£ãƒ³ãƒã‚¹ widget ãŒã‚µãƒãƒ¼ãƒˆã™ã‚‹æ§˜ã€…ãªã‚¿ã‚¤ãƒ—ã®ã‚¢ã‚¤ãƒ†ãƒ ã®ä¾‹ãŒå…¥ã£ã¦ã„ã¾ã™ã€‚次ã®ã‚ˆã†ãªæ“作ãŒã§ãã¾ã™ã€‚\n ボタン-1 ドラッグ:\tアイテムを動ã‹ã™ã€‚\n ボタン-2 ドラッグ:\t見ãˆã¦ã„る部分をãšã‚‰ã™ã€‚\n ボタン-3 ドラッグ:\t領域を囲ã†ã€‚\n コントロール-F:\t領域ã®ä¸‹ã®ã‚¢ã‚¤ãƒ†ãƒ ã‚’表示ã™ã‚‹ã€‚"
}.pack('side'=>'top')
-# frame À¸À®
+# frame 生æˆ
TkFrame.new(base_frame) {|frame|
TkButton.new(frame) {
- #text 'λ²ò'
- text 'ÊĤ¸¤ë'
+ #text '了解'
+ text 'é–‰ã˜ã‚‹'
command proc{
tmppath = $items_demo
$items_demo = nil
@@ -39,15 +39,15 @@ TkFrame.new(base_frame) {|frame|
}.pack('side'=>'left', 'expand'=>'yes')
TkButton.new(frame) {
- text '¥³¡¼¥É»²¾È'
+ text 'コードå‚ç…§'
command proc{showCode 'items'}
}.pack('side'=>'left', 'expand'=>'yes')
}.pack('side'=>'bottom', 'fill'=>'x', 'pady'=>'2m')
-# frame À¸À®
+# frame 生æˆ
cvs = nil
TkFrame.new(base_frame) {|cf|
- # canvas À¸À®
+ # canvas 生æˆ
cvs = TkCanvas.new(cf) {|c|
focus
scrollregion '0c 0c 30c 24c'
@@ -113,11 +113,11 @@ else
green = 'black'
end
-# tag ¥ª¥Ö¥¸¥§¥¯¥È¤òÀ¸À®
+# tag オブジェクトを生æˆ
$tag_item = TkcGroup.new(cvs)
# Set up demos within each of the areas of the grid.
-TkcText.new(cvs, '5c', '.2c', 'text'=>'¥é¥¤¥ó', 'anchor'=>'n')
+TkcText.new(cvs, '5c', '.2c', 'text'=>'ライン', 'anchor'=>'n')
TkcLine.new(cvs, '1c', '1c', '3c', '1c', '1c', '4c', '3c', '4c',
'width'=>2, 'fill'=>blue, 'capstyle'=>'butt',
'join'=>'miter', 'tags'=>$tag_item )
@@ -136,7 +136,7 @@ TkcLine.new(cvs, '1c','7c','1.75c','5.8c','2.5c','7c','3.25c','5.8c','4c','7c',
'tags'=>$tag_item )
TkcText.new(cvs, '15c', '.2c',
- 'text'=>'¶ÊÀþ (³ê¤é¤«¤Ë¤Ä¤Ê¤¤¤ÀľÀþ)', 'anchor'=>'n')
+ 'text'=>'曲線 (滑らã‹ã«ã¤ãªã„ã ç›´ç·š)', 'anchor'=>'n')
TkcLine.new(cvs, '11c','4c','11.5c','1c','13.5c','1c','14c','4c',
'smooth'=>'on', 'fill'=>blue, 'tags'=>$tag_item )
TkcLine.new(cvs, '15.5c','1c','19.5c','1.5c','15.5c','4.5c','19.5c','4c',
@@ -148,7 +148,7 @@ TkcLine.new(cvs, '12c','6c','13.5c','4.5c','16.5c','7.5c','18c','6c',
'images', 'gray25.xbm'].join(File::Separator),
'fill'=>red, 'tags'=>$tag_item )
-TkcText.new(cvs, '25c', '.2c', 'text'=>'¿³Ñ·Á', 'anchor'=>'n')
+TkcText.new(cvs, '25c', '.2c', 'text'=>'多角形', 'anchor'=>'n')
TkcPolygon.new(cvs, '21c','1.0c','22.5c','1.75c','24c','1.0c','23.25c','2.5c',
'24c','4.0c','22.5c','3.25c','21c','4.0c','21.75c','2.5c',
'fill'=>'green', 'outline'=>'black', 'width'=>4,
@@ -163,7 +163,7 @@ TkcPolygon.new(cvs, '22c','4.5c','25c','4.5c','25c','6.75c','28c','6.75c',
'images', 'gray25.xbm'].join(File::Separator),
'outline'=>'black', 'tags'=>$tag_item )
-TkcText.new(cvs, '5c', '8.2c', 'text'=>'¶ë·Á', 'anchor'=>'n')
+TkcText.new(cvs, '5c', '8.2c', 'text'=>'矩形', 'anchor'=>'n')
TkcRectangle.new(cvs, '1c','9.5c','4c','12.5c',
'outline'=>red, 'width'=>'3m', 'tags'=>$tag_item)
TkcRectangle.new(cvs, '0.5c','13.5c','4.5c','15.5c',
@@ -173,7 +173,7 @@ TkcRectangle.new(cvs, '6c','10c','9c','15c', 'outline'=>'',
'images','gray25.xbm'].join(File::Separator),
'fill'=>blue, 'tags'=>$tag_item )
-TkcText.new(cvs, '15c', '8.2c', 'text'=>'Âʱß', 'anchor'=>'n')
+TkcText.new(cvs, '15c', '8.2c', 'text'=>'楕円', 'anchor'=>'n')
TkcOval.new(cvs, '11c','9.5c','14c','12.5c',
'outline'=>red, 'width'=>'3m', 'tags'=>$tag_item)
TkcOval.new(cvs, '10.5c','13.5c','14.5c','15.5c',
@@ -183,13 +183,13 @@ TkcOval.new(cvs, '16c','10c','19c','15c', 'outline'=>'',
'images','gray25.xbm'].join(File::Separator),
'fill'=>blue, 'tags'=>$tag_item )
-TkcText.new(cvs, '25c', '8.2c', 'text'=>'¥Æ¥­¥¹¥È', 'anchor'=>'n')
+TkcText.new(cvs, '25c', '8.2c', 'text'=>'テキスト', 'anchor'=>'n')
TkcRectangle.new(cvs, '22.4c','8.9c','22.6c','9.1c')
TkcText.new(cvs, '22.5c', '9c', 'anchor'=>'n', 'font'=>font1, 'width'=>'4c',
- 'text'=>'û¤¤¥Æ¥­¥¹¥È¡£¥ï¡¼¥É¥é¥Ã¥×¡¢º¸Â·¤¨¡¢¥¢¥ó¥«¡¼¤ÏËÌ(¾å)¡£¢¢¤Ï³Æ¥Æ¥­¥¹¥È¤Î¥¢¥ó¥«¡¼¥Ý¥¤¥ó¥È¤ò¼¨¤¹¡£', 'tags'=>$tag_item )
+ 'text'=>'短ã„テキスト。ワードラップã€å·¦æƒãˆã€ã‚¢ãƒ³ã‚«ãƒ¼ã¯åŒ—(上)。□ã¯å„テキストã®ã‚¢ãƒ³ã‚«ãƒ¼ãƒã‚¤ãƒ³ãƒˆã‚’示ã™ã€‚', 'tags'=>$tag_item )
TkcRectangle.new(cvs, '25.4c','10.9c','25.6c','11.1c')
TkcText.new(cvs, '25.5c', '11c', 'anchor'=>'w', 'font'=>font1, 'fill'=>blue,
- 'text'=>"¤¤¤¯¤Ä¤«¤Î¹Ô¡£\n¤½¤ì¤¾¤ìÆÈΩ¤Ë\n¹Ô·¤¨¡£\nÁ´¤Æº¸Ã¼¤¬¥¢¥ó¥«¡¼¤µ¤ì¤Æ¤¤¤ë¡£", 'justify'=>'center', 'tags'=>$tag_item )
+ 'text'=>"ã„ãã¤ã‹ã®è¡Œã€‚\nãれãžã‚Œç‹¬ç«‹ã«\n行æƒãˆã€‚\nå…¨ã¦å·¦ç«¯ãŒã‚¢ãƒ³ã‚«ãƒ¼ã•れã¦ã„る。", 'justify'=>'center', 'tags'=>$tag_item )
TkcRectangle.new(cvs, '24.9c','13.9c','25.1c','14.1c')
if $tk_version =~ /^4\.[01]/
TkcText.new(cvs, '25c', '14c', 'anchor'=>'c', 'font'=>font2, 'fill'=>red,
@@ -202,7 +202,7 @@ else
'tags'=>$tag_item )
end
-TkcText.new(cvs, '5c', '16.2c', 'text'=>'¸Ì', 'anchor'=>'n')
+TkcText.new(cvs, '5c', '16.2c', 'text'=>'å¼§', 'anchor'=>'n')
TkcArc.new(cvs, '0.5c','17c','7c','20c', 'fill'=>green, 'outline'=>'black',
'start'=>45, 'extent'=>270, 'style'=>'pieslice', 'tags'=>$tag_item)
#TkcArc.new(cvs, '6.5c','17c','9.5c','20c', 'width'=>'4m', 'style'=>'arc',
@@ -221,7 +221,7 @@ TkcArc.new(cvs, '5.5c','20.5c','9.5c','23.5c', 'width'=>'4m', 'style'=>'chord',
'fill'=>blue, 'outline'=>'', 'start'=>45, 'extent'=>270,
'tags'=>$tag_item)
-TkcText.new(cvs, '15c', '16.2c', 'text'=>'¥Ó¥Ã¥È¥Þ¥Ã¥×', 'anchor'=>'n')
+TkcText.new(cvs, '15c', '16.2c', 'text'=>'ビットマップ', 'anchor'=>'n')
#TkcBitmap.new(cvs, '13c','20c',
# 'bitmap'=>'@' + ['images', 'face'].join(File::Separator),
# 'tags'=>$tag_item)
@@ -239,7 +239,7 @@ TkcBitmap.new(cvs, '17c','18.5c',
#TkcBitmap.new(cvs, '17c','21.5c',
# 'bitmap'=>'@' + ['images', 'letters'].join(File::Separator),
# 'tags'=>$tag_item)
-# ¢­¤Î·Á¼°¤Ç¤â²Äǽ
+# ↓ã®å½¢å¼ã§ã‚‚å¯èƒ½
TkcBitmap.new(cvs, '17c','21.5c') {
bitmap '@' + [$demo_dir, '..', 'images', 'letters.xbm'].join(File::Separator)
tags $tag_item
@@ -249,15 +249,15 @@ TkcBitmap.new(cvs, '17c','21.5c') {
# tags $tag_item
#}
-TkcText.new(cvs, '25c', '16.2c', 'text'=>'¥¦¥£¥ó¥É¥¦', 'anchor'=>'n')
+TkcText.new(cvs, '25c', '16.2c', 'text'=>'ウィンドウ', 'anchor'=>'n')
TkButton.new(cvs) {|b|
- text '²¡¤·¤Æ¤Í'
+ text '押ã—ã¦ã­'
command proc{butPress cvs, red}
TkcWindow.new(cvs, '21c','18c',
'window'=>b, 'anchor'=>'nw', 'tags'=>$tag_item)
}
TkEntry.new(cvs, 'width'=>20, 'relief'=>'sunken') {|e|
- insert 'end', 'ÊÔ½¸¤·¤Æ¤Í'
+ insert 'end', '編集ã—ã¦ã­'
TkcWindow.new(cvs, '21c','21c',
'window'=>e, 'anchor'=>'nw', 'tags'=>$tag_item)
}
@@ -266,9 +266,9 @@ TkScale.new(cvs, 'from'=>0, 'to'=>100, 'length'=>'6c', 'sliderlength'=>'.4c',
TkcWindow.new(cvs, '28.5c','17.5c',
'window'=>scl, 'anchor'=>'n', 'tags'=>$tag_item)
}
-TkcText.new(cvs, '21c', '17.9c', 'text'=>'¥Ü¥¿¥ó:', 'anchor'=>'sw')
-TkcText.new(cvs, '21c', '20.9c', 'text'=>'¥¨¥ó¥È¥ê:', 'anchor'=>'sw')
-TkcText.new(cvs, '28.5c', '17.4c', 'text'=>'¥¹¥±¡¼¥ë:', 'anchor'=>'s')
+TkcText.new(cvs, '21c', '17.9c', 'text'=>'ボタン:', 'anchor'=>'sw')
+TkcText.new(cvs, '21c', '20.9c', 'text'=>'エントリ:', 'anchor'=>'sw')
+TkcText.new(cvs, '28.5c', '17.4c', 'text'=>'スケール:', 'anchor'=>'s')
# Set up event bindings for canvas:
cvs.itembind($tag_item, 'Any-Enter', proc{itemEnter cvs})
@@ -374,6 +374,6 @@ end
def butPress(w,color)
i = TkcText.new(w, '25c', '18.1c',
- 'text'=>'¤¤¤Æ¤Æ!!', 'fill'=>color, 'anchor'=>'n')
+ 'text'=>'ã„ã¦ã¦!!', 'fill'=>color, 'anchor'=>'n')
Tk.after(500, proc{w.delete i})
end
diff --git a/ext/tk/sample/demos-jp/ixset2 b/ext/tk/sample/demos-jp/ixset2
index 5011dfe640..e11ce2ac8f 100644
--- a/ext/tk/sample/demos-jp/ixset2
+++ b/ext/tk/sample/demos-jp/ixset2
@@ -1,5 +1,5 @@
#!/usr/bin/env ruby
-# -*- coding: euc-jp -*-
+# -*- coding: utf-8 -*-
#
# ixset --
# A nice interface to "xset" to change X server settings
@@ -167,15 +167,15 @@ class Xsettings
btn_frame = TkFrame.new(@root)
buttons = [
@btn_OK = TkButton.new(btn_frame, 'command'=>proc{win.ok},
- 'default'=>'active', 'text'=>'λ²ò'),
+ 'default'=>'active', 'text'=>'了解'),
@btn_APPLY = TkButton.new(btn_frame, 'command'=>proc{win.writesettings},
- 'default'=>'normal', 'text'=>'ŬÍÑ',
+ 'default'=>'normal', 'text'=>'é©ç”¨',
'state'=>'disabled'),
@btn_CANCEL = TkButton.new(btn_frame, 'command'=>proc{win.cancel},
- 'default'=>'normal', 'text'=>'¼è¾Ã',
+ 'default'=>'normal', 'text'=>'å–æ¶ˆ',
'state'=>'disabled'),
@btn_QUIT = TkButton.new(btn_frame, 'command'=>proc{win.quit},
- 'default'=>'normal', 'text'=>'̾ȧ')
+ 'default'=>'normal', 'text'=>'中止')
]
buttons.each{|b| b.pack('side'=>'left', 'expand'=>'yes', 'pady'=>5) }
@@ -202,16 +202,16 @@ class Xsettings
#
# Bell settings
#
- bell = TkLabelframe.new(@root, 'text'=>'¥Ù¥ëÀßÄê',
+ bell = TkLabelframe.new(@root, 'text'=>'ベル設定',
'padx'=>'1.5m', 'pady'=>'1.5m')
@w_bellvol = TkScale.new(bell, 'from'=>0, 'to'=>100, 'length'=>200,
'tickinterval'=>20, 'orient'=>'horizontal',
- 'label'=>"²»ÎÌ (%)")
+ 'label'=>"éŸ³é‡ (%)")
f = TkFrame.new(bell)
- @w_bellpit = LabelEntry.new(f, "²»Äø (Hz)", 6, [25, 20000])
+ @w_bellpit = LabelEntry.new(f, "音程 (Hz)", 6, [25, 20000])
@w_bellpit.pack('side'=>'left', 'padx'=>5)
- @w_belldur = LabelEntry.new(f, "»ý³»þ´Ö (ms)", 6, [1, 10000])
+ @w_belldur = LabelEntry.new(f, "æŒç¶šæ™‚é–“ (ms)", 6, [1, 10000])
@w_belldur.pack('side'=>'right', 'padx'=>5)
@w_bellvol.pack('side'=>'top', 'expand'=>'yes')
@@ -222,10 +222,10 @@ class Xsettings
#
kbdonoff = nil
kbdcli = nil
- kbd = TkLabelframe.new(@root, 'text'=>'¥­¡¼¥Ü¡¼¥É¥ê¥Ô¡¼¥ÈÀßÄê',
+ kbd = TkLabelframe.new(@root, 'text'=>'キーボードリピート設定',
'padx'=>'1.5m', 'pady'=>'1.5m')
f = TkFrame.new(kbd)
- @w_kbdonoff = TkCheckButton.new(f, 'text'=>'¥¯¥ê¥Ã¥¯²»¤¢¤ê',
+ @w_kbdonoff = TkCheckButton.new(f, 'text'=>'クリック音ã‚り',
'relief'=>'flat',
'onvalue'=>'on', 'offvalue'=>'off',
'variable'=>@w_kbdrep ) {
@@ -240,7 +240,7 @@ class Xsettings
}
@w_kbdcli = TkScale.new(f, 'from'=>0, 'to'=>100, 'length'=>200,
'tickinterval'=>20, 'orient'=>'horizontal',
- 'label'=>'¥¯¥ê¥Ã¥¯²»ÎÌ (%)')
+ 'label'=>'ã‚¯ãƒªãƒƒã‚¯éŸ³é‡ (%)')
@w_kbdcli.pack('side'=>'left', 'expand'=>'yes',
'fill'=>'x', 'padx'=>['1m', 0])
f.pack('side'=>'top', 'expand'=>'yes', 'pady'=>2, 'fill'=>'x')
@@ -248,21 +248,21 @@ class Xsettings
#
# Mouse settings
#
- mouse = TkLabelframe.new(@root, 'text'=>'¥Þ¥¦¥¹ÀßÄê',
+ mouse = TkLabelframe.new(@root, 'text'=>'マウス設定',
'padx'=>'1.5m', 'pady'=>'1.5m')
f = TkFrame.new(mouse)
- @w_mouseacc = LabelEntry.new(f, '²Ã®ÎÌ', 5)
+ @w_mouseacc = LabelEntry.new(f, '加速é‡', 5)
@w_mouseacc.pack('side'=>'left', 'padx'=>[0, '1m'])
- @w_mousethr = LabelEntry.new(f, 'ïçÃÍ (pixels)', 3, [1, 2000])
+ @w_mousethr = LabelEntry.new(f, '閾値 (pixels)', 3, [1, 2000])
@w_mousethr.pack('side'=>'right', 'padx'=>['1m', 0])
f.pack('side'=>'top', 'expand'=>'yes')
#
# Screen Saver settings
#
- screen = TkLabelframe.new(@root, 'text'=>'¥¹¥¯¥ê¡¼¥ó¥»¡¼¥ÐÀßÄê',
+ screen = TkLabelframe.new(@root, 'text'=>'スクリーンセーãƒè¨­å®š',
'padx'=>'1.5m', 'pady'=>'1.5m')
- @w_screenblank = TkRadioButton.new(screen, 'text'=>'¥Ö¥é¥ó¥¯É½¼¨',
+ @w_screenblank = TkRadioButton.new(screen, 'text'=>'ブランク表示',
'relief'=>'flat', 'anchor'=>'w',
'variable'=>@w_screenbla,
'value'=>'blank') {
@@ -275,7 +275,7 @@ class Xsettings
end
}
- @w_screenpat = TkRadioButton.new(screen, 'text'=>'¥Ñ¥¿¡¼¥óɽ¼¨',
+ @w_screenpat = TkRadioButton.new(screen, 'text'=>'パターン表示',
'relief'=>'flat', 'anchor'=>'w',
'variable'=>@w_screenbla,
'value'=>'noblank') {
@@ -288,8 +288,8 @@ class Xsettings
end
}
- @w_screentim = LabelEntry.new(screen, '¥¿¥¤¥à¥¢¥¦¥È (s)', 5, [1, 100000])
- @w_screencyc = LabelEntry.new(screen, '¼þ´ü (s)', 5, [1, 100000])
+ @w_screentim = LabelEntry.new(screen, 'タイムアウト (s)', 5, [1, 100000])
+ @w_screencyc = LabelEntry.new(screen, '周期 (s)', 5, [1, 100000])
Tk.grid(@w_screenblank, @w_screentim, 'sticky'=>'e')
Tk.grid(@w_screenpat, @w_screencyc, 'sticky'=>'e')
diff --git a/ext/tk/sample/demos-jp/knightstour.rb b/ext/tk/sample/demos-jp/knightstour.rb
index ae0f13076e..835a24c392 100644
--- a/ext/tk/sample/demos-jp/knightstour.rb
+++ b/ext/tk/sample/demos-jp/knightstour.rb
@@ -1,4 +1,4 @@
-# -*- coding: euc-jp -*-
+# -*- coding: utf-8 -*-
#
# Based on the widget demo of Tcl/Tk8.5.2
# The following is the original copyright text.
@@ -94,13 +94,13 @@ class Knights_Tour
@start_btn.state :normal
if @visited.length == 64
if @initial == square
- @log.insert :end, '¼þÍ·(closed tour)À®¸ù¡ª'
+ @log.insert :end, '周éŠ(closed tour)æˆåŠŸï¼'
else
- @log.insert :end, "À®¸ù\n", {}
+ @log.insert :end, "æˆåŠŸ\n", {}
Tk.after(@delay.numeric * 2){tour(rand(64))} if @continuous.bool
end
else
- @log.insert :end, "¼ºÇÔ¡ª\n", {}
+ @log.insert :end, "失敗ï¼\n", {}
end
end
end
@@ -158,10 +158,10 @@ class Knights_Tour
sep = Ttk::Separator.new(frame)
Tk.grid(sep, :columnspan=>4, :row=>0, :sticky=>'ew', :pady=>2)
TkGrid('x',
- Ttk::Button.new(frame, :text=>'¥³¡¼¥É»²¾È',
+ Ttk::Button.new(frame, :text=>'コードå‚ç…§',
:image=>$image['view'], :compound=>:left,
:command=>proc{showCode 'knightstour'}),
- Ttk::Button.new(frame, :text=>'ÊĤ¸¤ë',
+ Ttk::Button.new(frame, :text=>'é–‰ã˜ã‚‹',
:image=>$image['delete'], :compound=>:left,
:command=>proc{
$knightstour.destroy
@@ -187,14 +187,14 @@ class Knights_Tour
@continuous = TkVariable.new(false)
tool_f = Ttk::Frame.new($knightstour)
- label = Ttk::Label.new(tool_f, :text=>'¼Â¹Ô®ÅÙ')
+ label = Ttk::Label.new(tool_f, :text=>'実行速度')
scale = Ttk::Scale.new(tool_f, :from=>8, :to=>2000, :variable=>@delay,
:command=>proc{|n| set_delay(n)})
- check = Ttk::Checkbutton.new(tool_f, :text=>'È¿Éü',
+ check = Ttk::Checkbutton.new(tool_f, :text=>'å復',
:variable=>@continuous)
- @start_btn = Ttk::Button.new(tool_f, :text=>'³«»Ï',
+ @start_btn = Ttk::Button.new(tool_f, :text=>'é–‹å§‹',
:command=>proc{tour()})
- @exit_btn = Ttk::Button.new(tool_f, :text=>'½ªÎ»',
+ @exit_btn = Ttk::Button.new(tool_f, :text=>'終了',
:command=>proc{_exit()})
7.downto(0){|row|
diff --git a/ext/tk/sample/demos-jp/label.rb b/ext/tk/sample/demos-jp/label.rb
index 19105e6f71..700e6a61ce 100644
--- a/ext/tk/sample/demos-jp/label.rb
+++ b/ext/tk/sample/demos-jp/label.rb
@@ -1,15 +1,15 @@
-# -*- coding: euc-jp -*-
+# -*- coding: utf-8 -*-
#
# label widget demo (called by 'widget')
#
-# toplevel widget ¤¬Â¸ºß¤¹¤ì¤Ðºï½ü¤¹¤ë
+# toplevel widget ãŒå­˜åœ¨ã™ã‚Œã°å‰Šé™¤ã™ã‚‹
if defined?($label_demo) && $label_demo
$label_demo.destroy
$label_demo = nil
end
-# demo ÍѤΠtoplevel widget ¤òÀ¸À®
+# demo 用㮠toplevel widget を生æˆ
$label_demo = TkToplevel.new {|w|
title("Label Demonstration")
iconname("label")
@@ -18,20 +18,20 @@ $label_demo = TkToplevel.new {|w|
base_frame = TkFrame.new($label_demo).pack(:fill=>:both, :expand=>true)
-# label À¸À®
+# label 生æˆ
msg = TkLabel.new(base_frame) {
font $font
wraplength '4i'
justify 'left'
- text "²¼¤Ë¤Ï5¤Ä¤Î¥é¥Ù¥ë¤¬É½¼¨¤µ¤ì¤Æ¤¤¤Þ¤¹¡£º¸Â¦¤Ë¤Ï¥Æ¥­¥¹¥È¥é¥Ù¥ë¤¬3¤Ä¤¢¤ê¡¢±¦Â¦¤Ë¤Ï¥Ó¥Ã¥È¥Þ¥Ã¥×¥é¥Ù¥ë¤È¥Æ¥­¥¹¥È¥é¥Ù¥ë¤¬¤¢¤ê¤Þ¤¹¡£¥é¥Ù¥ë¤È¤¤¤¦¤Î¤Ï¤¢¤Þ¤êÌÌÇò¤¤¤â¤Î¤Ç¤Ï¤¢¤ê¤Þ¤»¤ó¡£¤Ê¤¼¤Ê¤éį¤á¤ë°Ê³°²¿¤â¤Ç¤­¤Ê¤¤¤«¤é¤Ç¤¹¡£"
+ text "下ã«ã¯5ã¤ã®ãƒ©ãƒ™ãƒ«ãŒè¡¨ç¤ºã•れã¦ã„ã¾ã™ã€‚å·¦å´ã«ã¯ãƒ†ã‚­ã‚¹ãƒˆãƒ©ãƒ™ãƒ«ãŒ3ã¤ã‚りã€å³å´ã«ã¯ãƒ“ットマップラベルã¨ãƒ†ã‚­ã‚¹ãƒˆãƒ©ãƒ™ãƒ«ãŒã‚りã¾ã™ã€‚ラベルã¨ã„ã†ã®ã¯ã‚ã¾ã‚Šé¢ç™½ã„ã‚‚ã®ã§ã¯ã‚りã¾ã›ã‚“。ãªãœãªã‚‰çœºã‚る以外何もã§ããªã„ã‹ã‚‰ã§ã™ã€‚"
}
msg.pack('side'=>'top')
-# frame À¸À®
+# frame 生æˆ
TkFrame.new(base_frame) {|frame|
TkButton.new(frame) {
- #text 'λ²ò'
- text 'ÊĤ¸¤ë'
+ #text '了解'
+ text 'é–‰ã˜ã‚‹'
command proc{
tmppath = $label_demo
$label_demo = nil
@@ -40,23 +40,23 @@ TkFrame.new(base_frame) {|frame|
}.pack('side'=>'left', 'expand'=>'yes')
TkButton.new(frame) {
- text '¥³¡¼¥É»²¾È'
+ text 'コードå‚ç…§'
command proc{showCode 'label'}
}.pack('side'=>'left', 'expand'=>'yes')
}.pack('side'=>'bottom', 'fill'=>'x', 'pady'=>'2m')
-# label demo Íѥե졼¥àÀ¸À®
+# label demo 用フレーム生æˆ
f_left = TkFrame.new(base_frame)
f_right = TkFrame.new(base_frame)
[f_left, f_right].each{|w| w.pack('side'=>'left', 'expand'=>'yes',
'padx'=>10, 'pady'=>10, 'fill'=>'both')}
-# label À¸À®
-[ TkLabel.new(f_left, 'text'=>'ºÇ½é¤Î¥é¥Ù¥ë'),
- TkLabel.new(f_left, 'text'=>'2 ÈÖÌÜ¡£¤Á¤ç¤Ã¤ÈÉ⤭¾å¤¬¤é¤»¤Æ¤ß¤Þ¤·¤¿',
+# label 生æˆ
+[ TkLabel.new(f_left, 'text'=>'最åˆã®ãƒ©ãƒ™ãƒ«'),
+ TkLabel.new(f_left, 'text'=>'2 番目。ã¡ã‚‡ã£ã¨æµ®ã上ãŒã‚‰ã›ã¦ã¿ã¾ã—ãŸ',
'relief'=>'raised'),
- TkLabel.new(f_left, 'text'=>'3 ÈÖÌÜ¡£ÄÀ¤ó¤Ç¤¤¤Þ¤¹ ', 'relief'=>'sunken')
+ TkLabel.new(f_left, 'text'=>'3 番目。沈んã§ã„ã¾ã™ ', 'relief'=>'sunken')
].each{|w| w.pack('side'=>'top', 'expand'=>'yes', 'pady'=>2, 'anchor'=>'w')}
# TkLabel.new(f_right) {
@@ -66,4 +66,4 @@ Tk::Label.new(f_right) {
relief 'sunken'
}.pack('side'=>'top')
-TkLabel.new(f_right) { text 'Tcl/Tk ½êÍ­¼Ô' }.pack('side'=>'top')
+TkLabel.new(f_right) { text 'Tcl/Tk 所有者' }.pack('side'=>'top')
diff --git a/ext/tk/sample/demos-jp/labelframe.rb b/ext/tk/sample/demos-jp/labelframe.rb
index cee504f4b6..80e106c6e7 100644
--- a/ext/tk/sample/demos-jp/labelframe.rb
+++ b/ext/tk/sample/demos-jp/labelframe.rb
@@ -1,4 +1,4 @@
-# -*- coding: euc-jp -*-
+# -*- coding: utf-8 -*-
#
# labelframe.rb
#
@@ -25,28 +25,28 @@ base_frame = TkFrame.new($labelframe_demo).pack(:fill=>:both, :expand=>true)
TkLabel.new(base_frame,
:font=>$font, :wraplength=>'4i', :justify=>:left,
:text=><<EOL).pack(:side=>:top)
-TkLabelFrame ¥¦¥£¥¸¥§¥Ã¥È¤Ï´ØÏ¢¤¹¤ë widget
-·²¤ò¤Þ¤È¤á¤Æ¼è¤ê°·¤¦¤¿¤á¤ËÍѤ¤¤é¤ì¤Þ¤¹¡£¥é
-¥Ù¥ë¤ÏÄ̾ï¤Îʸ»úÎó¤Ç¤â²¿¤é¤«¤Î¥¦¥£¥¸¥§¥Ã¥È
-¤Ç¤â¤«¤Þ¤¤¤Þ¤»¤ó¡£¤â¤·¤¢¤Ê¤¿¤¬»È¤Ã¤Æ¤¤¤ë
-Ruby ¤Ë¥ê¥ó¥¯¤µ¤ì¤Æ¤¤¤ë Tk ¥é¥¤¥Ö¥é¥ê¤¬
-labelframe ¥¦¥£¥¸¥§¥Ã¥È¤ò¼ÂÁõ¤·¤Æ¤¤¤Ê¤¤
-¾ì¹ç¡¢¤³¤Î¥Ç¥â¤Ï¤¦¤Þ¤¯Æ°¤«¤Ê¤¤¤Ï¤º¤Ç¤¹¡£
-¤½¤Î¾ì¹ç¤Ë¤Ï labelframe ¥¦¥£¥¸¥§¥Ã¥È¤¬¼ÂÁõ
-¤µ¤ì¤Æ¤¤¤ë¤è¤¦¤Ê¤è¤ê¿·¤·¤¤¥Ð¡¼¥¸¥ç¥ó¤Î Tk
-¤òÁȤ߹ç¤ï¤»¤Æ»î¤¹¤è¤¦¤Ë¤·¤Æ¤¯¤À¤µ¤¤¡£
+TkLabelFrame ウィジェットã¯é–¢é€£ã™ã‚‹ widget
+群をã¾ã¨ã‚ã¦å–り扱ã†ãŸã‚ã«ç”¨ã„られã¾ã™ã€‚ラ
+ベルã¯é€šå¸¸ã®æ–‡å­—列ã§ã‚‚何らã‹ã®ã‚¦ã‚£ã‚¸ã‚§ãƒƒãƒˆ
+ã§ã‚‚ã‹ã¾ã„ã¾ã›ã‚“。もã—ã‚ãªãŸãŒä½¿ã£ã¦ã„ã‚‹
+Ruby ã«ãƒªãƒ³ã‚¯ã•れã¦ã„ã‚‹ Tk ライブラリãŒ
+labelframe ウィジェットを実装ã—ã¦ã„ãªã„
+å ´åˆã€ã“ã®ãƒ‡ãƒ¢ã¯ã†ã¾ãå‹•ã‹ãªã„ã¯ãšã§ã™ã€‚
+ãã®å ´åˆã«ã¯ labelframe ウィジェットãŒå®Ÿè£…
+ã•れã¦ã„るよã†ãªã‚ˆã‚Šæ–°ã—ã„ãƒãƒ¼ã‚¸ãƒ§ãƒ³ã® Tk
+を組ã¿åˆã‚ã›ã¦è©¦ã™ã‚ˆã†ã«ã—ã¦ãã ã•ã„。
EOL
# The bottom buttons
TkFrame.new(base_frame){|f|
pack(:side=>:bottom, :fill=>:x, :pady=>'2m')
- TkButton.new(f, :text=>'ÊĤ¸¤ë', :width=>15, :command=>proc{
+ TkButton.new(f, :text=>'é–‰ã˜ã‚‹', :width=>15, :command=>proc{
$labelframe_demo.destroy
$labelframe_demo = nil
}).pack(:side=>:left, :expand=>true)
- TkButton.new(f, :text=>'¥³¡¼¥É»²¾È', :width=>15, :command=>proc{
+ TkButton.new(f, :text=>'コードå‚ç…§', :width=>15, :command=>proc{
showCode 'labelframe'
}).pack(:side=>:left, :expand=>true)
}
@@ -56,7 +56,7 @@ w = TkFrame.new(base_frame).pack(:side=>:bottom, :fill=>:both,
:expand=>true)
# A group of radiobuttons in a labelframe
-TkLabelFrame.new(w, :text=>'ÁªÂòÃÍ',
+TkLabelFrame.new(w, :text=>'é¸æŠžå€¤',
:padx=>2, :pady=>2) {|f|
grid(:row=>0, :column=>0, :pady=>'2m', :padx=>'2m')
@@ -86,13 +86,13 @@ end
TkLabelFrame.new(w, :pady=>2, :padx=>2){|f|
TkCheckButton.new(f, :widgetname=>'cb', :variable=>$lfdummy,
- :text=>"¥ª¥×¥·¥ç¥ó¤ò»ÈÍÑ", :padx=>0) {|cb|
+ :text=>"オプションを使用", :padx=>0) {|cb|
command proc{lfEnableButtons(f)}
f.labelwidget(cb)
}
grid(:row=>0, :column=>1, :pady=>'2m', :padx=>'2m')
- %w(¥ª¥×¥·¥ç¥ó1 ¥ª¥×¥·¥ç¥ó2 ¥ª¥×¥·¥ç¥ó3).each{|str|
+ %w(オプション1 オプション2 オプション3).each{|str|
TkCheckbutton.new(f, :text=>str).pack(:side=>:top, :fill=>:x, :pady=>2)
}
diff --git a/ext/tk/sample/demos-jp/mclist.rb b/ext/tk/sample/demos-jp/mclist.rb
index 37f5dfa8eb..67cec638eb 100644
--- a/ext/tk/sample/demos-jp/mclist.rb
+++ b/ext/tk/sample/demos-jp/mclist.rb
@@ -1,4 +1,4 @@
-# -*- coding: euc-jp -*-
+# -*- coding: utf-8 -*-
#
# mclist.rb --
#
@@ -24,16 +24,16 @@ base_frame = TkFrame.new($mclist_demo).pack(:fill=>:both, :expand=>true)
Ttk::Label.new(base_frame, :font=>$font, :wraplength=>'4i',
:justify=>:left, :anchor=>'n', :padding=>[10, 2, 10, 6],
:text=><<EOL).pack(:fill=>:x)
-Ttk¤È¤Ï¡¤¥Æ¡¼¥Þ»ØÄê²Äǽ¤Ê¿·¤·¤¤¥¦¥£¥¸¥§¥Ã¥È½¸¹ç¤Ç¤¹¡¥\
-Ttk::Treeview¥¦¥£¥¸¥§¥Ã¥È¤Ï\
-Ttk¥¦¥£¥¸¥§¥Ã¥È¥»¥Ã¥È¤Ë´Þ¤Þ¤ì¤ë¥¦¥£¥¸¥§¥Ã¥È¤Î°ì¤Ä¤Ç¡¤\
-¤½¤ì¤¬ÊÝ»ý¤¹¤ëÌÚ¹½Â¤¤Î¥Ç¡¼¥¿¤½¤Î¤â¤Î¤Þ¤Ç¤Ïɽ¼¨¤¹¤ë¤³¤È¤Ê¤¯¡¤\
-¼¨¤·¤¿¤¤¾ðÊó¤ò¥Þ¥ë¥Á¥«¥é¥à¤Çɽ¼¨¤µ¤»¤ë¤³¤È¤¬¤Ç¤­¤Þ¤¹¡¥
-¤³¤Î¥µ¥ó¥×¥ë¤Ï¡¤Ê£¿ô¤Î¥«¥é¥à¤ò»ý¤Ã¤¿¥ê¥¹¥È¥Ü¥Ã¥¯¥¹¤òºîÀ®¤¹¤ë´Êñ¤ÊÎã¤Ç¤¹¡¥
-³Æ¥«¥é¥à¤Î¥¿¥¤¥È¥ë(heading)¤ò¥¯¥ê¥Ã¥¯¤¹¤ì¤Ð¡¤\
-¤½¤Î¥«¥é¥à¤Î¾ðÊó¤Ë´ð¤Å¤¤¤Æ¥ê¥¹¥È¤ÎʤÙÂØ¤¨¤¬¤Ê¤µ¤ì¤ë¤Ï¤º¤Ç¤¹¡¥\
-¤Þ¤¿¡¤¥«¥é¥à¤Î¥¿¥¤¥È¥ë´Ö¤Î¶èÀÚ¤êÉôʬ¤ò¥É¥é¥Ã¥°¤¹¤ë¤³¤È¤Ç¡¤\
-¥«¥é¥à¤ÎÉý¤òÊѹ¹¤¹¤ë¤³¤È¤â²Äǽ¤Ç¤¹¡¥
+Ttkã¨ã¯ï¼Œãƒ†ãƒ¼ãƒžæŒ‡å®šå¯èƒ½ãªæ–°ã—ã„ウィジェット集åˆã§ã™ï¼Ž\
+Ttk::Treeviewウィジェットã¯\
+Ttkウィジェットセットã«å«ã¾ã‚Œã‚‹ã‚¦ã‚£ã‚¸ã‚§ãƒƒãƒˆã®ä¸€ã¤ã§ï¼Œ\
+ãれãŒä¿æŒã™ã‚‹æœ¨æ§‹é€ ã®ãƒ‡ãƒ¼ã‚¿ãã®ã‚‚ã®ã¾ã§ã¯è¡¨ç¤ºã™ã‚‹ã“ã¨ãªã,\
+示ã—ãŸã„情報をマルãƒã‚«ãƒ©ãƒ ã§è¡¨ç¤ºã•ã›ã‚‹ã“ã¨ãŒã§ãã¾ã™ï¼Ž
+ã“ã®ã‚µãƒ³ãƒ—ルã¯ï¼Œè¤‡æ•°ã®ã‚«ãƒ©ãƒ ã‚’æŒã£ãŸãƒªã‚¹ãƒˆãƒœãƒƒã‚¯ã‚¹ã‚’作æˆã™ã‚‹ç°¡å˜ãªä¾‹ã§ã™ï¼Ž
+å„カラムã®ã‚¿ã‚¤ãƒˆãƒ«(heading)をクリックã™ã‚Œã°ï¼Œ\
+ãã®ã‚«ãƒ©ãƒ ã®æƒ…å ±ã«åŸºã¥ã„ã¦ãƒªã‚¹ãƒˆã®ä¸¦ã¹æ›¿ãˆãŒãªã•れるã¯ãšã§ã™ï¼Ž\
+ã¾ãŸï¼Œã‚«ãƒ©ãƒ ã®ã‚¿ã‚¤ãƒˆãƒ«é–“ã®åŒºåˆ‡ã‚Šéƒ¨åˆ†ã‚’ドラッグã™ã‚‹ã“ã¨ã§ï¼Œ\
+カラムã®å¹…を変更ã™ã‚‹ã“ã¨ã‚‚å¯èƒ½ã§ã™ï¼Ž
EOL
## See Code / Dismiss
@@ -41,10 +41,10 @@ Ttk::Frame.new(base_frame) {|frame|
sep = Ttk::Separator.new(frame)
Tk.grid(sep, :columnspan=>4, :row=>0, :sticky=>'ew', :pady=>2)
TkGrid('x',
- Ttk::Button.new(frame, :text=>'¥³¡¼¥É»²¾È',
+ Ttk::Button.new(frame, :text=>'コードå‚ç…§',
:image=>$image['view'], :compound=>:left,
:command=>proc{showCode 'mclist'}),
- Ttk::Button.new(frame, :text=>'ÊĤ¸¤ë',
+ Ttk::Button.new(frame, :text=>'é–‰ã˜ã‚‹',
:image=>$image['delete'], :compound=>:left,
:command=>proc{
$mclist_demo.destroy
@@ -74,27 +74,27 @@ container.grid_rowconfigure(0, :weight=>1)
## The data we're going to insert
data = [
- ['¥¢¥ë¥¼¥ó¥Á¥ó', '¥Ö¥¨¥Î¥¹¥¢¥¤¥ì¥¹', 'ARS'],
- ['¥ª¡¼¥¹¥È¥é¥ê¥¢', '¥­¥ã¥ó¥Ù¥é', 'AUD'],
- ['¥Ö¥é¥¸¥ë', '¥Ö¥é¥¸¥ê¥¢', 'BRL'],
- ['¥«¥Ê¥À', '¥ª¥¿¥ï', 'CAD'],
- ['Ãæ¹ñ', 'Ë̵þ', 'CNY'],
- ['¥Õ¥é¥ó¥¹', '¥Ñ¥ê', 'EUR'],
- ['¥É¥¤¥Ä', '¥Ù¥ë¥ê¥ó', 'EUR'],
- ['¥¤¥ó¥É', '¥Ë¥å¡¼¥Ç¥ê¡¼', 'INR'],
- ['¥¤¥¿¥ê¥¢', '¥í¡¼¥Þ', 'EUR'],
- ['ÆüËÜ', 'Åìµþ', 'JPY'],
- ['¥á¥­¥·¥³', '¥á¥­¥·¥³¥·¥Æ¥£', 'MXN'],
- ['¥í¥·¥¢', '¥â¥¹¥¯¥ï', 'RUB'],
- ['Æî¥¢¥Õ¥ê¥«', '¥×¥ì¥È¥ê¥¢', 'ZAR'],
- ['±Ñ¹ñ', '¥í¥ó¥É¥ó', 'GBP'],
- ['¥¢¥á¥ê¥«', '¥ï¥·¥ó¥È¥ó D.C.', 'USD'],
+ ['アルゼンãƒãƒ³', 'ブエノスアイレス', 'ARS'],
+ ['オーストラリア', 'キャンベラ', 'AUD'],
+ ['ブラジル', 'ブラジリア', 'BRL'],
+ ['カナダ', 'オタワ', 'CAD'],
+ ['中国', '北京', 'CNY'],
+ ['フランス', 'パリ', 'EUR'],
+ ['ドイツ', 'ベルリン', 'EUR'],
+ ['インド', 'ニューデリー', 'INR'],
+ ['イタリア', 'ローマ', 'EUR'],
+ ['日本', 'æ±äº¬', 'JPY'],
+ ['メキシコ', 'メキシコシティ', 'MXN'],
+ ['ロシア', 'モスクワ', 'RUB'],
+ ['å—アフリカ', 'プレトリア', 'ZAR'],
+ ['英国', 'ロンドン', 'GBP'],
+ ['アメリカ', 'ワシントン D.C.', 'USD'],
]
## Code to insert the data nicely
font = Ttk::Style.lookup(tree[:style], :font)
cols = %w(country capital currency)
-cols.zip(%w(¹ñ̾ ¼óÅÔ Ä̲ß)).each{|col, name|
+cols.zip(%w(国å 首都 通貨)).each{|col, name|
tree.heading_configure(col, :text=>name,
:command=>proc{sort_by(tree, col, false)})
tree.column_configure(col, :width=>TkFont.measure(font, name))
diff --git a/ext/tk/sample/demos-jp/menu.rb b/ext/tk/sample/demos-jp/menu.rb
index e38a467000..05ea7a9ec2 100644
--- a/ext/tk/sample/demos-jp/menu.rb
+++ b/ext/tk/sample/demos-jp/menu.rb
@@ -1,15 +1,15 @@
-# -*- coding: euc-jp -*-
+# -*- coding: utf-8 -*-
#
# menus widget demo (called by 'widget')
#
-# toplevel widget ¤¬Â¸ºß¤¹¤ì¤Ðºï½ü¤¹¤ë
+# toplevel widget ãŒå­˜åœ¨ã™ã‚Œã°å‰Šé™¤ã™ã‚‹
if defined?($menu_demo) && $menu_demo
$menu_demo.destroy
$menu_demo = nil
end
-# demo ÍѤΠtoplevel widget ¤òÀ¸À®
+# demo 用㮠toplevel widget を生æˆ
$menu_demo = TkToplevel.new {|w|
title("File Selection Dialogs")
iconname("menu")
@@ -18,7 +18,7 @@ $menu_demo = TkToplevel.new {|w|
base_frame = TkFrame.new($menu_demo).pack(:fill=>:both, :expand=>true)
-# menu frame À¸À®
+# menu frame 生æˆ
$menu_frame = TkFrame.new(base_frame, 'relief'=>'raised', 'bd'=>2)
$menu_frame.pack('side'=>'top', 'fill'=>'x')
@@ -28,21 +28,21 @@ rescue
windowingsystem = ""
end
-# label À¸À®
+# label 生æˆ
TkLabel.new(base_frame,'font'=>$font,'wraplength'=>'4i','justify'=>'left') {
if $tk_platform['platform'] == 'macintosh' ||
windowingsystem == "classic" || windowingsystem == "aqua"
- text("¤³¤Î¥¦¥£¥ó¥É¥¦¤ÏÍÍ¡¹¤Ê¥á¥Ë¥å¡¼¤È¥«¥¹¥±¡¼¥É¥á¥Ë¥å¡¼¤«¤é¹½À®¤µ¤ì¤Æ¤¤¤Þ¤¹¡£Command-X ¤òÆþÎϤ¹¤ë¤È¡¢X¤¬¥³¥Þ¥ó¥É¥­¡¼µ­¹æ¤Ë³¤¤¤ÆÉ½¼¨¤µ¤ì¤Æ¤¤¤ëʸ»ú¤Ê¤é¤Ð¡¢¥¢¥¯¥»¥é¥ì¡¼¥¿¤ò»È¤Ã¤¿¹àÌܵ¯Æ°¤ò¹Ô¤¦¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£¥á¥Ë¥å¡¼Í×ÁÇÃæ¡¢ºÇ¸å¤Î¤â¤Î¤Ï¡¢¤½¤Î¥á¥Ë¥å¡¼¤ÎºÇ½é¤Î¹àÌܤòÁªÂò¤¹¤ë¤³¤È¤ÇÆÈΩ¤µ¤»¤ë¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£")
+ text("ã“ã®ã‚¦ã‚£ãƒ³ãƒ‰ã‚¦ã¯æ§˜ã€…ãªãƒ¡ãƒ‹ãƒ¥ãƒ¼ã¨ã‚«ã‚¹ã‚±ãƒ¼ãƒ‰ãƒ¡ãƒ‹ãƒ¥ãƒ¼ã‹ã‚‰æ§‹æˆã•れã¦ã„ã¾ã™ã€‚Command-X を入力ã™ã‚‹ã¨ã€XãŒã‚³ãƒžãƒ³ãƒ‰ã‚­ãƒ¼è¨˜å·ã«ç¶šã„ã¦è¡¨ç¤ºã•れã¦ã„る文字ãªã‚‰ã°ã€ã‚¢ã‚¯ã‚»ãƒ©ãƒ¬ãƒ¼ã‚¿ã‚’使ã£ãŸé …目起動を行ã†ã“ã¨ãŒã§ãã¾ã™ã€‚メニューè¦ç´ ä¸­ã€æœ€å¾Œã®ã‚‚ã®ã¯ã€ãã®ãƒ¡ãƒ‹ãƒ¥ãƒ¼ã®æœ€åˆã®é …ç›®ã‚’é¸æŠžã™ã‚‹ã“ã¨ã§ç‹¬ç«‹ã•ã›ã‚‹ã“ã¨ãŒã§ãã¾ã™ã€‚")
else
- text("¤³¤Î¥¦¥£¥ó¥É¥¦¤ÏÍÍ¡¹¤Ê¥á¥Ë¥å¡¼¤È¥«¥¹¥±¡¼¥É¥á¥Ë¥å¡¼¤«¤é¹½À®¤µ¤ì¤Æ¤¤¤Þ¤¹¡£Alt-X ¤òÆþÎϤ¹¤ë¤È¡¢X¤¬¥á¥Ë¥å¡¼¤Ë¥¢¥ó¥À¡¼¥é¥¤¥óÉÕ¤­¤Çɽ¼¨¤µ¤ì¤Æ¤¤¤ëʸ»ú¤Ê¤é¤Ð¡¢¥­¡¼¥Ü¡¼¥É¤«¤é¤Î»ØÄ꤬¤Ç¤­¤Þ¤¹¡£Ìð°õ¥­¡¼¤Ç¥á¥Ë¥å¡¼¤Î¥È¥é¥Ð¡¼¥¹¤â²Äǽ¤Ç¤¹¡£¥á¥Ë¥å¡¼¤¬»ØÄꤵ¤ì¤¿ºÝ¤Ë¤Ï¡¢¥¹¥Ú¡¼¥¹¥­¡¼¤Ç¼Â¹Ô¤¹¤ë¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£¤¢¤ë¤¤¤Ï¡¢¥¢¥ó¥À¡¼¥é¥¤¥óÉÕ¤­¤Îʸ»ú¤òÆþÎϤ¹¤ë¤³¤È¤Ç¤â¼Â¹Ô¤Ç¤­¤Þ¤¹¡£¥á¥Ë¥å¡¼¤Î¥¨¥ó¥È¥ê¤¬¥¢¥¯¥»¥é¥ì¡¼¥¿¤ò»ý¤Ã¤Æ¤¤¤ë¾ì¹ç¤Ï¡¢¤½¤Î¥¢¥¯¥»¥é¥ì¡¼¥¿¤òÆþÎϤ¹¤ë¤³¤È¤Ç¥á¥Ë¥å¡¼¤ò»ØÄꤹ¤ë¤³¤È¤Ê¤·¤Ë¼Â¹Ô¤¹¤ë¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£¥á¥Ë¥å¡¼Í×ÁÇÃæ¡¢ºÇ¸å¤Î¤â¤Î¤Ï¡¢¤½¤Î¥á¥Ë¥å¡¼¤ÎºÇ½é¤Î¹àÌܤòÁªÂò¤¹¤ë¤³¤È¤ÇÆÈΩ¤µ¤»¤ë¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£")
+ text("ã“ã®ã‚¦ã‚£ãƒ³ãƒ‰ã‚¦ã¯æ§˜ã€…ãªãƒ¡ãƒ‹ãƒ¥ãƒ¼ã¨ã‚«ã‚¹ã‚±ãƒ¼ãƒ‰ãƒ¡ãƒ‹ãƒ¥ãƒ¼ã‹ã‚‰æ§‹æˆã•れã¦ã„ã¾ã™ã€‚Alt-X を入力ã™ã‚‹ã¨ã€XãŒãƒ¡ãƒ‹ãƒ¥ãƒ¼ã«ã‚¢ãƒ³ãƒ€ãƒ¼ãƒ©ã‚¤ãƒ³ä»˜ãã§è¡¨ç¤ºã•れã¦ã„る文字ãªã‚‰ã°ã€ã‚­ãƒ¼ãƒœãƒ¼ãƒ‰ã‹ã‚‰ã®æŒ‡å®šãŒã§ãã¾ã™ã€‚矢å°ã‚­ãƒ¼ã§ãƒ¡ãƒ‹ãƒ¥ãƒ¼ã®ãƒˆãƒ©ãƒãƒ¼ã‚¹ã‚‚å¯èƒ½ã§ã™ã€‚ãƒ¡ãƒ‹ãƒ¥ãƒ¼ãŒæŒ‡å®šã•れãŸéš›ã«ã¯ã€ã‚¹ãƒšãƒ¼ã‚¹ã‚­ãƒ¼ã§å®Ÿè¡Œã™ã‚‹ã“ã¨ãŒã§ãã¾ã™ã€‚ã‚ã‚‹ã„ã¯ã€ã‚¢ãƒ³ãƒ€ãƒ¼ãƒ©ã‚¤ãƒ³ä»˜ãã®æ–‡å­—を入力ã™ã‚‹ã“ã¨ã§ã‚‚実行ã§ãã¾ã™ã€‚メニューã®ã‚¨ãƒ³ãƒˆãƒªãŒã‚¢ã‚¯ã‚»ãƒ©ãƒ¬ãƒ¼ã‚¿ã‚’æŒã£ã¦ã„ã‚‹å ´åˆã¯ã€ãã®ã‚¢ã‚¯ã‚»ãƒ©ãƒ¬ãƒ¼ã‚¿ã‚’入力ã™ã‚‹ã“ã¨ã§ãƒ¡ãƒ‹ãƒ¥ãƒ¼ã‚’指定ã™ã‚‹ã“ã¨ãªã—ã«å®Ÿè¡Œã™ã‚‹ã“ã¨ãŒã§ãã¾ã™ã€‚メニューè¦ç´ ä¸­ã€æœ€å¾Œã®ã‚‚ã®ã¯ã€ãã®ãƒ¡ãƒ‹ãƒ¥ãƒ¼ã®æœ€åˆã®é …ç›®ã‚’é¸æŠžã™ã‚‹ã“ã¨ã§ç‹¬ç«‹ã•ã›ã‚‹ã“ã¨ãŒã§ãã¾ã™ã€‚")
end
}.pack('side'=>'top')
-# frame À¸À®
+# frame 生æˆ
TkFrame.new(base_frame) {|frame|
TkButton.new(frame) {
- #text 'λ²ò'
- text 'ÊĤ¸¤ë'
+ #text '了解'
+ text 'é–‰ã˜ã‚‹'
command proc{
tmppath = $menu_demo
$menu_demo = nil
@@ -51,25 +51,25 @@ TkFrame.new(base_frame) {|frame|
}.pack('side'=>'left', 'expand'=>'yes')
TkButton.new(frame) {
- text '¥³¡¼¥É»²¾È'
+ text 'コードå‚ç…§'
command proc{showCode 'menu'}
}.pack('side'=>'left', 'expand'=>'yes')
}.pack('side'=>'bottom', 'fill'=>'x', 'pady'=>'2m')
-# menu À¸À®
+# menu 生æˆ
TkMenubutton.new($menu_frame, 'text'=>'File', 'underline'=>0) {|m|
pack('side'=>'left')
TkMenu.new(m, 'tearoff'=>false) {|file_menu|
m.configure('menu'=>file_menu)
- add('command', 'label'=>'³«¤¯ ...', 'command'=>proc{fail '¤³¤ì¤Ï¡¢¥Ç¥â¤Ç¤¹¤Î¤Ç"³«¤¯ ..."¤ËÂФ¹¤ë¥¢¥¯¥·¥ç¥ó¤ÏÄêµÁ¤µ¤ì¤Æ¤¤¤Þ¤»¤ó¡£'})
- add('command', 'label'=>'¿·µ¬', 'command'=>proc{fail '¤³¤ì¤Ï¡¢¥Ç¥â¤Ç¤¹¤Î¤Ç"¿·µ¬"¤ËÂФ¹¤ë¥¢¥¯¥·¥ç¥ó¤ÏÄêµÁ¤µ¤ì¤Æ¤¤¤Þ¤»¤ó¡£'})
- add('command', 'label'=>'Êݸ', 'command'=>proc{fail '¤³¤ì¤Ï¡¢¥Ç¥â¤Ç¤¹¤Î¤Ç"Êݸ"¤ËÂФ¹¤ë¥¢¥¯¥·¥ç¥ó¤ÏÄêµÁ¤µ¤ì¤Æ¤¤¤Þ¤»¤ó¡£'})
- add('command', 'label'=>'Êݸ(»ØÄê) ...', 'command'=>proc{fail '¤³¤ì¤Ï¡¢¥Ç¥â¤Ç¤¹¤Î¤Ç"Êݸ(»ØÄê) ..."¤ËÂФ¹¤ë¥¢¥¯¥·¥ç¥ó¤ÏÄêµÁ¤µ¤ì¤Æ¤¤¤Þ¤»¤ó¡£'})
+ add('command', 'label'=>'é–‹ã ...', 'command'=>proc{fail 'ã“れã¯ã€ãƒ‡ãƒ¢ã§ã™ã®ã§"é–‹ã ..."ã«å¯¾ã™ã‚‹ã‚¢ã‚¯ã‚·ãƒ§ãƒ³ã¯å®šç¾©ã•れã¦ã„ã¾ã›ã‚“。'})
+ add('command', 'label'=>'æ–°è¦', 'command'=>proc{fail 'ã“れã¯ã€ãƒ‡ãƒ¢ã§ã™ã®ã§"æ–°è¦"ã«å¯¾ã™ã‚‹ã‚¢ã‚¯ã‚·ãƒ§ãƒ³ã¯å®šç¾©ã•れã¦ã„ã¾ã›ã‚“。'})
+ add('command', 'label'=>'ä¿å­˜', 'command'=>proc{fail 'ã“れã¯ã€ãƒ‡ãƒ¢ã§ã™ã®ã§"ä¿å­˜"ã«å¯¾ã™ã‚‹ã‚¢ã‚¯ã‚·ãƒ§ãƒ³ã¯å®šç¾©ã•れã¦ã„ã¾ã›ã‚“。'})
+ add('command', 'label'=>'ä¿å­˜(指定) ...', 'command'=>proc{fail 'ã“れã¯ã€ãƒ‡ãƒ¢ã§ã™ã®ã§"ä¿å­˜(指定) ..."ã«å¯¾ã™ã‚‹ã‚¢ã‚¯ã‚·ãƒ§ãƒ³ã¯å®šç¾©ã•れã¦ã„ã¾ã›ã‚“。'})
add('separator')
- add('command', 'label'=>'¥×¥ê¥ó¥ÈÀßÄê ...', 'command'=>proc{fail '¤³¤ì¤Ï¡¢¥Ç¥â¤Ç¤¹¤Î¤Ç"¥×¥ê¥ó¥ÈÀßÄê ..."¤ËÂФ¹¤ë¥¢¥¯¥·¥ç¥ó¤ÏÄêµÁ¤µ¤ì¤Æ¤¤¤Þ¤»¤ó¡£'})
- add('command', 'label'=>'¥×¥ê¥ó¥È ...', 'command'=>proc{fail '¤³¤ì¤Ï¡¢¥Ç¥â¤Ç¤¹¤Î¤Ç"¥×¥ê¥ó¥È ..."¤ËÂФ¹¤ë¥¢¥¯¥·¥ç¥ó¤ÏÄêµÁ¤µ¤ì¤Æ¤¤¤Þ¤»¤ó¡£'})
+ add('command', 'label'=>'プリント設定 ...', 'command'=>proc{fail 'ã“れã¯ã€ãƒ‡ãƒ¢ã§ã™ã®ã§"プリント設定 ..."ã«å¯¾ã™ã‚‹ã‚¢ã‚¯ã‚·ãƒ§ãƒ³ã¯å®šç¾©ã•れã¦ã„ã¾ã›ã‚“。'})
+ add('command', 'label'=>'プリント ...', 'command'=>proc{fail 'ã“れã¯ã€ãƒ‡ãƒ¢ã§ã™ã®ã§"プリント ..."ã«å¯¾ã™ã‚‹ã‚¢ã‚¯ã‚·ãƒ§ãƒ³ã¯å®šç¾©ã•れã¦ã„ã¾ã›ã‚“。'})
add('separator')
- add('command', 'label'=>'½ªÎ»', 'command'=>proc{$menu_demo.destroy})
+ add('command', 'label'=>'終了', 'command'=>proc{$menu_demo.destroy})
}
}
@@ -86,10 +86,10 @@ TkMenubutton.new($menu_frame, 'text'=>'Basic', 'underline'=>0) {|m|
pack('side'=>'left')
TkMenu.new(m, 'tearoff'=>false) {|basic_menu|
m.configure('menu'=>basic_menu)
- add('command', 'label'=>'²¿¤â¤·¤Ê¤¤Ä¹¤¤¥¨¥ó¥È¥ê')
+ add('command', 'label'=>'何もã—ãªã„é•·ã„エントリ')
['A','B','C','D','E','F','G'].each{|c|
- # add('command', 'label'=>"ʸ»ú \"#{c}\" ¤ò°õ»ú", 'underline'=>4,
- add('command', 'label'=>"Print letter \"#{c}\" (ʸ»ú \"#{c}\" ¤ò°õ»ú)",
+ # add('command', 'label'=>"文字 \"#{c}\" ã‚’å°å­—", 'underline'=>4,
+ add('command', 'label'=>"Print letter \"#{c}\" (文字 \"#{c}\" ã‚’å°å­—)",
'underline'=>14, 'accelerator'=>"Meta+#{c}",
'command'=>proc{print c,"\n"}, 'accelerator'=>"#{modifier}+#{c}")
$menu_demo.bind("#{modifier}-#{c.downcase}", proc{print c,"\n"})
@@ -101,58 +101,58 @@ TkMenubutton.new($menu_frame, 'text'=>'Cascades', 'underline'=>0) {|m|
pack('side'=>'left')
TkMenu.new(m, 'tearoff'=>false) {|cascade_menu|
m.configure('menu'=>cascade_menu)
- add('command', 'label'=>'Print hello(¤³¤ó¤Ë¤Á¤Ï)',
- 'command'=>proc{print "Hello(¤³¤ó¤Ë¤Á¤Ï)\n"},
+ add('command', 'label'=>'Print hello(ã“ã‚“ã«ã¡ã¯)',
+ 'command'=>proc{print "Hello(ã“ã‚“ã«ã¡ã¯)\n"},
'accelerator'=>"#{modifier}+H", 'underline'=>6)
- $menu_demo.bind("#{modifier}-h", proc{print "Hello(¤³¤ó¤Ë¤Á¤Ï)\n"})
- add('command', 'label'=>'Print goodbye(¤µ¤è¤¦¤Ê¤é)',
- 'command'=>proc{print "Goodbye(¤µ¤è¤¦¤Ê¤é)\n"},
+ $menu_demo.bind("#{modifier}-h", proc{print "Hello(ã“ã‚“ã«ã¡ã¯)\n"})
+ add('command', 'label'=>'Print goodbye(ã•よã†ãªã‚‰)',
+ 'command'=>proc{print "Goodbye(ã•よã†ãªã‚‰)\n"},
'accelerator'=>"#{modifier}+G", 'underline'=>6)
- $menu_demo.bind("#{modifier}-g", proc{print "Goodbye(¤µ¤è¤¦¤Ê¤é)\n"})
+ $menu_demo.bind("#{modifier}-g", proc{print "Goodbye(ã•よã†ãªã‚‰)\n"})
# TkMenu.new(m, 'tearoff'=>false) {|cascade_check|
TkMenu.new(cascade_menu, 'tearoff'=>false) {|cascade_check|
- cascade_menu.add('cascade', 'label'=>'Check buttons(¥Á¥§¥Ã¥¯¥Ü¥¿¥ó)',
+ cascade_menu.add('cascade', 'label'=>'Check buttons(ãƒã‚§ãƒƒã‚¯ãƒœã‚¿ãƒ³)',
'menu'=>cascade_check, 'underline'=>0)
oil = TkVariable.new(0)
- add('check', 'label'=>'¥ª¥¤¥ëÅÀ¸¡', 'variable'=>oil)
+ add('check', 'label'=>'オイル点検', 'variable'=>oil)
trans = TkVariable.new(0)
- add('check', 'label'=>'¥È¥é¥ó¥¹¥ß¥Ã¥·¥ç¥óÅÀ¸¡', 'variable'=>trans)
+ add('check', 'label'=>'トランスミッション点検', 'variable'=>trans)
brakes = TkVariable.new(0)
- add('check', 'label'=>'¥Ö¥ì¡¼¥­ÅÀ¸¡', 'variable'=>brakes)
+ add('check', 'label'=>'ブレーキ点検', 'variable'=>brakes)
lights = TkVariable.new(0)
- add('check', 'label'=>'¥é¥¤¥ÈÅÀ¸¡', 'variable'=>lights)
+ add('check', 'label'=>'ライト点検', 'variable'=>lights)
add('separator')
- add('command', 'label'=>'¸½ºß¤ÎÃͤòɽ¼¨',
+ add('command', 'label'=>'ç¾åœ¨ã®å€¤ã‚’表示',
'command'=>proc{showVars($menu_demo,
- ['¥ª¥¤¥ëÅÀ¸¡', oil],
- ['¥È¥é¥ó¥¹¥ß¥Ã¥·¥ç¥óÅÀ¸¡', trans],
- ['¥Ö¥ì¡¼¥­ÅÀ¸¡', brakes],
- ['¥é¥¤¥ÈÅÀ¸¡', lights])} )
+ ['オイル点検', oil],
+ ['トランスミッション点検', trans],
+ ['ブレーキ点検', brakes],
+ ['ライト点検', lights])} )
invoke 1
invoke 3
}
#TkMenu.new(m, 'tearoff'=>false) {|cascade_radio|
TkMenu.new(cascade_menu, 'tearoff'=>false) {|cascade_radio|
- cascade_menu.add('cascade', 'label'=>'Radio buttons(¥é¥¸¥ª¥Ü¥¿¥ó)',
+ cascade_menu.add('cascade', 'label'=>'Radio buttons(ラジオボタン)',
'menu'=>cascade_radio, 'underline'=>0)
pointSize = TkVariable.new
- add('radio', 'label'=>'10 ¥Ý¥¤¥ó¥È', 'variable'=>pointSize, 'value'=>10)
- add('radio', 'label'=>'14 ¥Ý¥¤¥ó¥È', 'variable'=>pointSize, 'value'=>14)
- add('radio', 'label'=>'18 ¥Ý¥¤¥ó¥È', 'variable'=>pointSize, 'value'=>18)
- add('radio', 'label'=>'24 ¥Ý¥¤¥ó¥È', 'variable'=>pointSize, 'value'=>24)
- add('radio', 'label'=>'32 ¥Ý¥¤¥ó¥È', 'variable'=>pointSize, 'value'=>32)
+ add('radio', 'label'=>'10 ãƒã‚¤ãƒ³ãƒˆ', 'variable'=>pointSize, 'value'=>10)
+ add('radio', 'label'=>'14 ãƒã‚¤ãƒ³ãƒˆ', 'variable'=>pointSize, 'value'=>14)
+ add('radio', 'label'=>'18 ãƒã‚¤ãƒ³ãƒˆ', 'variable'=>pointSize, 'value'=>18)
+ add('radio', 'label'=>'24 ãƒã‚¤ãƒ³ãƒˆ', 'variable'=>pointSize, 'value'=>24)
+ add('radio', 'label'=>'32 ãƒã‚¤ãƒ³ãƒˆ', 'variable'=>pointSize, 'value'=>32)
add('separator')
style = TkVariable.new
- add('radio', 'label'=>'¥í¡¼¥Þ¥ó', 'variable'=>style, 'value'=>'roman')
- add('radio', 'label'=>'¥Ü¡¼¥ë¥É', 'variable'=>style, 'value'=>'bold')
- add('radio', 'label'=>'¥¤¥¿¥ê¥Ã¥¯', 'variable'=>style, 'value'=>'italic')
+ add('radio', 'label'=>'ローマン', 'variable'=>style, 'value'=>'roman')
+ add('radio', 'label'=>'ボールド', 'variable'=>style, 'value'=>'bold')
+ add('radio', 'label'=>'イタリック', 'variable'=>style, 'value'=>'italic')
add('separator')
- add('command', 'label'=>'¸½ºß¤ÎÃͤòɽ¼¨',
+ add('command', 'label'=>'ç¾åœ¨ã®å€¤ã‚’表示',
'command'=>proc{showVars($menu_demo,
- ['¥Ý¥¤¥ó¥È¥µ¥¤¥º', pointSize],
- ['¥¹¥¿¥¤¥ë', style])} )
+ ['ãƒã‚¤ãƒ³ãƒˆã‚µã‚¤ã‚º', pointSize],
+ ['スタイル', style])} )
invoke 1
invoke 7
}
@@ -167,9 +167,9 @@ TkMenubutton.new($menu_frame, 'text'=>'Icons', 'underline'=>0) {|m|
'bitmap'=>'@'+[$demo_dir,'..',
'images','pattern.xbm'].join(File::Separator),
'command'=>proc{TkDialog.new('title'=>'Bitmap Menu Entry',
- 'text'=>'º£¤¢¤Ê¤¿¤¬ÁªÂò¤·¤¿¥á¥Ë¥å¡¼¤Î¹àÌܤϥƥ­¥¹¥È¤Ç¤Ï¤Ê¤¯¥Ó¥Ã¥È¥Þ¥Ã¥×¤òɽ¼¨¤·¤Æ¤¤¤Þ¤·¤¿¡£¤½¤ì°Ê³°¤ÎÅÀ¤Ç¤Ï¾¤Î¥á¥Ë¥å¡¼¹àÌܤÈÊѤï¤ê¤Þ¤»¤ó¡£',
+ 'text'=>'今ã‚ãªãŸãŒé¸æŠžã—ãŸãƒ¡ãƒ‹ãƒ¥ãƒ¼ã®é …ç›®ã¯ãƒ†ã‚­ã‚¹ãƒˆã§ã¯ãªãビットマップを表示ã—ã¦ã„ã¾ã—ãŸã€‚ãれ以外ã®ç‚¹ã§ã¯ä»–ã®ãƒ¡ãƒ‹ãƒ¥ãƒ¼é …ç›®ã¨å¤‰ã‚りã¾ã›ã‚“。',
'bitmap'=>'', 'default'=>0,
- 'buttons'=>'λ²ò')} )
+ 'buttons'=>'了解')} )
['info', 'questhead', 'error'].each{|icon|
add('command', 'bitmap'=>icon,
'command'=>proc{print "You invoked the #{icon} bitmap\n"})
@@ -181,8 +181,8 @@ TkMenubutton.new($menu_frame, 'text'=>'More', 'underline'=>0) {|m|
pack('side'=>'left')
TkMenu.new(m, 'tearoff'=>false) {|more_menu|
m.configure('menu'=>more_menu)
- [ '¥¨¥ó¥È¥ê','Ê̤Υ¨¥ó¥È¥ê','²¿¤â¤·¤Ê¤¤','¤Û¤È¤ó¤É²¿¤â¤·¤Ê¤¤',
- '¿ÍÀ¸¤ò°ÕµÁ¤¢¤ë¤â¤Î¤Ë' ].each{|i|
+ [ 'エントリ','別ã®ã‚¨ãƒ³ãƒˆãƒª','何もã—ãªã„','ã»ã¨ã‚“ã©ä½•ã‚‚ã—ãªã„',
+ '人生をæ„義ã‚ã‚‹ã‚‚ã®ã«' ].each{|i|
add('command', 'label'=>i,
'command'=>proc{print "You invoked \"#{i}\"\n"})
}
diff --git a/ext/tk/sample/demos-jp/menu84.rb b/ext/tk/sample/demos-jp/menu84.rb
index 094853a728..6a57279481 100644
--- a/ext/tk/sample/demos-jp/menu84.rb
+++ b/ext/tk/sample/demos-jp/menu84.rb
@@ -1,4 +1,4 @@
-# -*- coding: euc-jp -*-
+# -*- coding: utf-8 -*-
#
# menus widget demo (called by 'widget')
#
@@ -28,9 +28,9 @@ end
TkLabel.new(base_frame,'font'=>$font,'wraplength'=>'4i','justify'=>'left') {
if $tk_platform['platform'] == 'macintosh' ||
windowingsystem == "classic" || windowingsystem == "aqua"
- text("¤³¤Î¥¦¥£¥ó¥É¥¦¤Ë¤Ï¥«¥¹¥±¡¼¥É¥á¥Ë¥å¡¼¤ò»ý¤Ä¥á¥Ë¥å¡¼¥Ð¡¼¤¬ÉÕ¤±¤é¤ì¤Æ¤¤¤Þ¤¹¡£Command+x ('x'¤Ï¥³¥Þ¥ó¥É¥­¡¼¥·¥ó¥Ü¥ë¤Ë³¤±¤ÆÉ½¼¨¤µ¤ì¤Æ¤¤¤ëʸ»ú¤Ç¤¹) ¤È¥¿¥¤¥×¤¹¤ë¤³¤È¤Ë¤è¤Ã¤Æ¤â¹àÌܤε¡Ç½¤ò¸Æ¤Ó½Ð¤¹¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£ºÇ¸å¤Î¥á¥Ë¥å¡¼¤Ï¡¢¥Þ¥¦¥¹¤Ç¥¦¥£¥ó¥É¥¦¤Î³°¤Ë¥É¥é¥Ã¥°¤¹¤ë¤³¤È¤Ë¤è¤Ã¤Æ¡¢ÆÈΩ¤·¤¿¥Ñ¥ì¥Ã¥È¤È¤Ê¤ë¤è¤¦¤ËÀÚ¤êÊü¤¹¤³¤È¤¬²Äǽ¤Ç¤¹¡£")
+ text("ã“ã®ã‚¦ã‚£ãƒ³ãƒ‰ã‚¦ã«ã¯ã‚«ã‚¹ã‚±ãƒ¼ãƒ‰ãƒ¡ãƒ‹ãƒ¥ãƒ¼ã‚’æŒã¤ãƒ¡ãƒ‹ãƒ¥ãƒ¼ãƒãƒ¼ãŒä»˜ã‘られã¦ã„ã¾ã™ã€‚Command+x ('x'ã¯ã‚³ãƒžãƒ³ãƒ‰ã‚­ãƒ¼ã‚·ãƒ³ãƒœãƒ«ã«ç¶šã‘ã¦è¡¨ç¤ºã•れã¦ã„る文字ã§ã™) ã¨ã‚¿ã‚¤ãƒ—ã™ã‚‹ã“ã¨ã«ã‚ˆã£ã¦ã‚‚é …ç›®ã®æ©Ÿèƒ½ã‚’呼ã³å‡ºã™ã“ã¨ãŒã§ãã¾ã™ã€‚最後ã®ãƒ¡ãƒ‹ãƒ¥ãƒ¼ã¯ã€ãƒžã‚¦ã‚¹ã§ã‚¦ã‚£ãƒ³ãƒ‰ã‚¦ã®å¤–ã«ãƒ‰ãƒ©ãƒƒã‚°ã™ã‚‹ã“ã¨ã«ã‚ˆã£ã¦ã€ç‹¬ç«‹ã—ãŸãƒ‘レットã¨ãªã‚‹ã‚ˆã†ã«åˆ‡ã‚Šæ”¾ã™ã“ã¨ãŒå¯èƒ½ã§ã™ã€‚")
else
- text("¤³¤Î¥¦¥£¥ó¥É¥¦¤Ë¤Ï¥«¥¹¥±¡¼¥É¥á¥Ë¥å¡¼¤ò»ý¤Ä¥á¥Ë¥å¡¼¥Ð¡¼¤¬ÉÕ¤±¤é¤ì¤Æ¤¤¤Þ¤¹¡£Alt+x ('x'¤Ï¥á¥Ë¥å¡¼¾å¤Ç²¼Àþ¤¬°ú¤«¤ì¤¿Ê¸»ú¤Ç¤¹) ¤È¥¿¥¤¥×¤¹¤ë¤³¤È¤Ë¤è¤Ã¤Æ¤â¥á¥Ë¥å¡¼¤ò¸Æ¤Ó½Ð¤¹¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£Ìð°õ¥­¡¼¤ò»È¤Ã¤Æ¡¢¥á¥Ë¥å¡¼´Ö¤ò°Üư¤¹¤ë¤³¤È¤â²Äǽ¤Ç¤¹¡£¥á¥Ë¥å¡¼¤¬É½¼¨¤µ¤ì¤Æ¤¤¤ë»þ¤Ë¤Ï¡¢¸½ºß°ÌÃ֤ιàÌܤò¥¹¥Ú¡¼¥¹¥­¡¼¤ÇÁªÂò¤·¤¿¤ê¡¢²¼Àþ¤¬°ú¤«¤ì¤¿Ê¸»ú¤òÆþÎϤ¹¤ë¤³¤È¤Ç¤½¤Î¹àÌܤòÁªÂò¤·¤¿¤ê¤¹¤ë¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£¤â¤·¹àÌܤ˥¢¥¯¥»¥é¥ì¡¼¥¿¤Î»ØÄ꤬¤Ê¤µ¤ì¤Æ¤¤¤¿¤Ê¤é¤Ð¡¢¤½¤Î»ØÄꤵ¤ì¤¿¥­¡¼ÆþÎϤò¹Ô¤¦¤³¤È¤Ç¡¢¥á¥Ë¥å¡¼¤òɽ¼¨¤µ¤»¤ë¤³¤È¤Ê¤¯Ä¾Àܤ½¤Î¹àÌܤε¡Ç½¤ò¸Æ¤Ó½Ð¤»¤Þ¤¹¡£ºÇ¸å¤Î¥á¥Ë¥å¡¼¤Ï¡¢¥á¥Ë¥å¡¼¤ÎºÇ½é¤Î¹àÌܤòÁªÂò¤¹¤ë¤³¤È¤Ë¤è¤Ã¤Æ¡¢ÆÈΩ¤·¤¿¥Ñ¥ì¥Ã¥È¤È¤Ê¤ë¤è¤¦¤ËÀÚ¤êÊü¤¹¤³¤È¤¬²Äǽ¤Ç¤¹¡£")
+ text("ã“ã®ã‚¦ã‚£ãƒ³ãƒ‰ã‚¦ã«ã¯ã‚«ã‚¹ã‚±ãƒ¼ãƒ‰ãƒ¡ãƒ‹ãƒ¥ãƒ¼ã‚’æŒã¤ãƒ¡ãƒ‹ãƒ¥ãƒ¼ãƒãƒ¼ãŒä»˜ã‘られã¦ã„ã¾ã™ã€‚Alt+x ('x'ã¯ãƒ¡ãƒ‹ãƒ¥ãƒ¼ä¸Šã§ä¸‹ç·šãŒå¼•ã‹ã‚ŒãŸæ–‡å­—ã§ã™) ã¨ã‚¿ã‚¤ãƒ—ã™ã‚‹ã“ã¨ã«ã‚ˆã£ã¦ã‚‚メニューを呼ã³å‡ºã™ã“ã¨ãŒã§ãã¾ã™ã€‚矢å°ã‚­ãƒ¼ã‚’使ã£ã¦ã€ãƒ¡ãƒ‹ãƒ¥ãƒ¼é–“を移動ã™ã‚‹ã“ã¨ã‚‚å¯èƒ½ã§ã™ã€‚メニューãŒè¡¨ç¤ºã•れã¦ã„る時ã«ã¯ã€ç¾åœ¨ä½ç½®ã®é …目をスペースキーã§é¸æŠžã—ãŸã‚Šã€ä¸‹ç·šãŒå¼•ã‹ã‚ŒãŸæ–‡å­—を入力ã™ã‚‹ã“ã¨ã§ãã®é …ç›®ã‚’é¸æŠžã—ãŸã‚Šã™ã‚‹ã“ã¨ãŒã§ãã¾ã™ã€‚ã‚‚ã—é …ç›®ã«ã‚¢ã‚¯ã‚»ãƒ©ãƒ¬ãƒ¼ã‚¿ã®æŒ‡å®šãŒãªã•れã¦ã„ãŸãªã‚‰ã°ã€ãã®æŒ‡å®šã•れãŸã‚­ãƒ¼å…¥åŠ›ã‚’è¡Œã†ã“ã¨ã§ã€ãƒ¡ãƒ‹ãƒ¥ãƒ¼ã‚’表示ã•ã›ã‚‹ã“ã¨ãªã直接ãã®é …ç›®ã®æ©Ÿèƒ½ã‚’呼ã³å‡ºã›ã¾ã™ã€‚最後ã®ãƒ¡ãƒ‹ãƒ¥ãƒ¼ã¯ã€ãƒ¡ãƒ‹ãƒ¥ãƒ¼ã®æœ€åˆã®é …ç›®ã‚’é¸æŠžã™ã‚‹ã“ã¨ã«ã‚ˆã£ã¦ã€ç‹¬ç«‹ã—ãŸãƒ‘レットã¨ãªã‚‹ã‚ˆã†ã«åˆ‡ã‚Šæ”¾ã™ã“ã¨ãŒå¯èƒ½ã§ã™ã€‚")
end
}.pack('side'=>'top')
@@ -48,8 +48,8 @@ TkFrame.new(base_frame) {|frame|
# frame
TkFrame.new(base_frame) {|frame|
TkButton.new(frame) {
- #text 'λ²ò'
- text 'ÊĤ¸¤ë'
+ #text '了解'
+ text 'é–‰ã˜ã‚‹'
command proc{
tmppath = $menu84_demo
$menu84_demo = nil
@@ -58,7 +58,7 @@ TkFrame.new(base_frame) {|frame|
}.pack('side'=>'left', 'expand'=>'yes')
TkButton.new(frame) {
- text '¥³¡¼¥É»²¾È'
+ text 'コードå‚ç…§'
command proc{showCode 'menu84'}
}.pack('side'=>'left', 'expand'=>'yes')
}.pack('side'=>'bottom', 'fill'=>'x', 'pady'=>'2m')
@@ -70,13 +70,13 @@ $menu84_frame = TkMenu.new($menu84_demo, 'tearoff'=>false)
# menu
TkMenu.new($menu84_frame, 'tearoff'=>false) {|m|
$menu84_frame.add('cascade', 'label'=>'File', 'menu'=>m, 'underline'=>0)
- add('command', 'label'=>'Open...', 'command'=>proc{fail '¤³¤ì¤Ïñ¤Ê¤ë¥Ç¥â¤Ç¤¹¤«¤é¡¢"Open..." ¹àÌܤε¡Ç½¤ÏÆÃ¤ËÄêµÁ¤µ¤ì¤Æ¤Ï¤¤¤Þ¤»¤ó¡£'})
- add('command', 'label'=>'New', 'command'=>proc{fail '¤³¤ì¤Ïñ¤Ê¤ë¥Ç¥â¤Ç¤¹¤«¤é¡¢"New" ¹àÌܤε¡Ç½¤ÏÆÃ¤ËÄêµÁ¤µ¤ì¤Æ¤Ï¤¤¤Þ¤»¤ó¡£'})
- add('command', 'label'=>'Save', 'command'=>proc{fail '¤³¤ì¤Ïñ¤Ê¤ë¥Ç¥â¤Ç¤¹¤«¤é¡¢"Save" ¹àÌܤε¡Ç½¤ÏÆÃ¤ËÄêµÁ¤µ¤ì¤Æ¤Ï¤¤¤Þ¤»¤ó¡£'})
- add('command', 'label'=>'Save As...', 'command'=>proc{fail '¤³¤ì¤Ïñ¤Ê¤ë¥Ç¥â¤Ç¤¹¤«¤é¡¢"Save As..." ¹àÌܤε¡Ç½¤ÏÆÃ¤ËÄêµÁ¤µ¤ì¤Æ¤Ï¤¤¤Þ¤»¤ó¡£'})
+ add('command', 'label'=>'Open...', 'command'=>proc{fail 'ã“れã¯å˜ãªã‚‹ãƒ‡ãƒ¢ã§ã™ã‹ã‚‰ã€"Open..." é …ç›®ã®æ©Ÿèƒ½ã¯ç‰¹ã«å®šç¾©ã•れã¦ã¯ã„ã¾ã›ã‚“。'})
+ add('command', 'label'=>'New', 'command'=>proc{fail 'ã“れã¯å˜ãªã‚‹ãƒ‡ãƒ¢ã§ã™ã‹ã‚‰ã€"New" é …ç›®ã®æ©Ÿèƒ½ã¯ç‰¹ã«å®šç¾©ã•れã¦ã¯ã„ã¾ã›ã‚“。'})
+ add('command', 'label'=>'Save', 'command'=>proc{fail 'ã“れã¯å˜ãªã‚‹ãƒ‡ãƒ¢ã§ã™ã‹ã‚‰ã€"Save" é …ç›®ã®æ©Ÿèƒ½ã¯ç‰¹ã«å®šç¾©ã•れã¦ã¯ã„ã¾ã›ã‚“。'})
+ add('command', 'label'=>'Save As...', 'command'=>proc{fail 'ã“れã¯å˜ãªã‚‹ãƒ‡ãƒ¢ã§ã™ã‹ã‚‰ã€"Save As..." é …ç›®ã®æ©Ÿèƒ½ã¯ç‰¹ã«å®šç¾©ã•れã¦ã¯ã„ã¾ã›ã‚“。'})
add('separator')
- add('command', 'label'=>'Print Setup...', 'command'=>proc{fail '¤³¤ì¤Ïñ¤Ê¤ë¥Ç¥â¤Ç¤¹¤«¤é¡¢"Print Setup..." ¹àÌܤε¡Ç½¤ÏÆÃ¤ËÄêµÁ¤µ¤ì¤Æ¤Ï¤¤¤Þ¤»¤ó¡£'})
- add('command', 'label'=>'Print...', 'command'=>proc{fail '¤³¤ì¤Ïñ¤Ê¤ë¥Ç¥â¤Ç¤¹¤«¤é¡¢"Print..." ¹àÌܤε¡Ç½¤ÏÆÃ¤ËÄêµÁ¤µ¤ì¤Æ¤Ï¤¤¤Þ¤»¤ó¡£'})
+ add('command', 'label'=>'Print Setup...', 'command'=>proc{fail 'ã“れã¯å˜ãªã‚‹ãƒ‡ãƒ¢ã§ã™ã‹ã‚‰ã€"Print Setup..." é …ç›®ã®æ©Ÿèƒ½ã¯ç‰¹ã«å®šç¾©ã•れã¦ã¯ã„ã¾ã›ã‚“。'})
+ add('command', 'label'=>'Print...', 'command'=>proc{fail 'ã“れã¯å˜ãªã‚‹ãƒ‡ãƒ¢ã§ã™ã‹ã‚‰ã€"Print..." é …ç›®ã®æ©Ÿèƒ½ã¯ç‰¹ã«å®šç¾©ã•れã¦ã¯ã„ã¾ã›ã‚“。'})
add('separator')
add('command', 'label'=>'Dismiss Menus Demo', 'command'=>proc{$menu84_demo.destroy})
}
@@ -116,20 +116,20 @@ TkMenu.new($menu84_frame, 'tearoff'=>false) {|m|
m.add('cascade', 'label'=>'Check button',
'menu'=>cascade_check, 'underline'=>0)
oil = TkVariable.new(0)
- add('check', 'label'=>'¥ª¥¤¥ë¸¡ºº', 'variable'=>oil)
+ add('check', 'label'=>'オイル検査', 'variable'=>oil)
trans = TkVariable.new(0)
- add('check', 'label'=>'¥È¥é¥ó¥¹¥ß¥Ã¥·¥ç¥ó¸¡ºº', 'variable'=>trans)
+ add('check', 'label'=>'トランスミッション検査', 'variable'=>trans)
brakes = TkVariable.new(0)
- add('check', 'label'=>'¥Ö¥ì¡¼¥­¸¡ºº', 'variable'=>brakes)
+ add('check', 'label'=>'ブレーキ検査', 'variable'=>brakes)
lights = TkVariable.new(0)
- add('check', 'label'=>'¥é¥¤¥È¸¡ºº', 'variable'=>lights)
+ add('check', 'label'=>'ライト検査', 'variable'=>lights)
add('separator')
add('command', 'label'=>'Show current values',
'command'=>proc{showVars($menu84_demo,
- ['¥ª¥¤¥ë', oil],
- ['¥È¥é¥ó¥¹¥ß¥Ã¥·¥ç¥ó', trans],
- ['¥Ö¥ì¡¼¥­', brakes],
- ['¥é¥¤¥È', lights])} )
+ ['オイル', oil],
+ ['トランスミッション', trans],
+ ['ブレーキ', brakes],
+ ['ライト', lights])} )
invoke 1
invoke 3
}
@@ -149,7 +149,7 @@ TkMenu.new($menu84_frame, 'tearoff'=>false) {|m|
add('radio', 'label'=>'Bold', 'variable'=>style, 'value'=>'bold')
add('radio', 'label'=>'Italic', 'variable'=>style, 'value'=>'italic')
add('separator')
- add('command', 'label'=>'¸½ºßÃͤÎɽ¼¨',
+ add('command', 'label'=>'ç¾åœ¨å€¤ã®è¡¨ç¤º',
'command'=>proc{showVars($menu84_demo,
['pointSize', pointSize],
['style', style])} )
@@ -164,9 +164,9 @@ TkMenu.new($menu84_frame, 'tearoff'=>false) {|m|
'bitmap'=>'@'+[$demo_dir,'..',
'images','pattern.xbm'].join(File::Separator),
'command'=>proc{TkDialog.new('title'=>'Bitmap Menu Entry',
- 'text'=>'¤¢¤Ê¤¿¤¬ÁªÂò¤·¤¿¥á¥Ë¥å¡¼¹àÌܤϡ¢Ê¸»úÎó¤ÎÂå¤ï¤ê¤Ë¥Ó¥Ã¥È¥Þ¥Ã¥×¥¤¥á¡¼¥¸¤Ç¹àÌܤòɽ¼¨¤·¤¿¤â¤Î¤Ç¤¹¡£¤½¤ì°Ê³°¤ÎÅÀ¤Ç¤Ï¡¢¤Û¤«¤Î¥á¥Ë¥å¡¼¹àÌÜ¤È¤Î´Ö¤ÇÆÃ¤Ë°ã¤¤¤¬¤¢¤ë¤ï¤±¤Ç¤Ï¤¢¤ê¤Þ¤»¤ó¡£',
+ 'text'=>'ã‚ãªãŸãŒé¸æŠžã—ãŸãƒ¡ãƒ‹ãƒ¥ãƒ¼é …ç›®ã¯ã€æ–‡å­—列ã®ä»£ã‚りã«ãƒ“ットマップイメージã§é …目を表示ã—ãŸã‚‚ã®ã§ã™ã€‚ãれ以外ã®ç‚¹ã§ã¯ã€ã»ã‹ã®ãƒ¡ãƒ‹ãƒ¥ãƒ¼é …ç›®ã¨ã®é–“ã§ç‰¹ã«é•ã„ãŒã‚ã‚‹ã‚ã‘ã§ã¯ã‚りã¾ã›ã‚“。',
'bitmap'=>'', 'default'=>0,
- 'buttons'=>'ÊĤ¸¤ë')} )
+ 'buttons'=>'é–‰ã˜ã‚‹')} )
['info', 'questhead', 'error'].each{|icon|
add('command', 'bitmap'=>icon, 'hidemargin'=>1,
'command'=>proc{print "You invoked the #{icon} bitmap\n"})
@@ -187,8 +187,8 @@ TkMenu.new($menu84_frame, 'tearoff'=>false) {|m|
'bitmap'=>'questhead', 'compound'=>'left',
'command'=>proc{
TkDialog.new('title'=>'Compound Menu Entry',
- 'message'=>'¤¢¤Ê¤¿¤¬ÁªÂò¤·¤¿¥á¥Ë¥å¡¼¹àÌܤϡ¢¥Ó¥Ã¥È¥Þ¥Ã¥×¥¤¥á¡¼¥¸¤Èʸ»úÎó¤È¤òƱ»þ¤Ë°ì¤Ä¤Î¹àÌܤËɽ¼¨¤¹¤ë¤è¤¦¤Ë¤·¤¿¤â¤Î¤Ç¤¹¡£¤½¤ì°Ê³°¤ÎÅÀ¤Ç¤Ï¡¢¤Û¤«¤Î¥á¥Ë¥å¡¼¹àÌÜ¤È¤Î´Ö¤ÇÆÃ¤Ë°ã¤¤¤¬¤¢¤ë¤ï¤±¤Ç¤Ï¤¢¤ê¤Þ¤»¤ó¡£',
- 'buttons'=>['λ²ò'], 'bitmap'=>'')
+ 'message'=>'ã‚ãªãŸãŒé¸æŠžã—ãŸãƒ¡ãƒ‹ãƒ¥ãƒ¼é …ç›®ã¯ã€ãƒ“ãƒƒãƒˆãƒžãƒƒãƒ—ã‚¤ãƒ¡ãƒ¼ã‚¸ã¨æ–‡å­—列ã¨ã‚’åŒæ™‚ã«ä¸€ã¤ã®é …ç›®ã«è¡¨ç¤ºã™ã‚‹ã‚ˆã†ã«ã—ãŸã‚‚ã®ã§ã™ã€‚ãれ以外ã®ç‚¹ã§ã¯ã€ã»ã‹ã®ãƒ¡ãƒ‹ãƒ¥ãƒ¼é …ç›®ã¨ã®é–“ã§ç‰¹ã«é•ã„ãŒã‚ã‚‹ã‚ã‘ã§ã¯ã‚りã¾ã›ã‚“。',
+ 'buttons'=>['了解'], 'bitmap'=>'')
})
}
diff --git a/ext/tk/sample/demos-jp/menu8x.rb b/ext/tk/sample/demos-jp/menu8x.rb
index 49aca6786d..77ecb5bcf3 100644
--- a/ext/tk/sample/demos-jp/menu8x.rb
+++ b/ext/tk/sample/demos-jp/menu8x.rb
@@ -1,15 +1,15 @@
-# -*- coding: euc-jp -*-
+# -*- coding: utf-8 -*-
#
# menus widget demo (called by 'widget')
#
-# toplevel widget ¤¬Â¸ºß¤¹¤ì¤Ðºï½ü¤¹¤ë
+# toplevel widget ãŒå­˜åœ¨ã™ã‚Œã°å‰Šé™¤ã™ã‚‹
if defined?($menu8x_demo) && $menu8x_demo
$menu8x_demo.destroy
$menu8x_demo = nil
end
-# demo ÍѤΠtoplevel widget ¤òÀ¸À®
+# demo 用㮠toplevel widget を生æˆ
$menu8x_demo = TkToplevel.new {|w|
title("Menu Demonstration (Tk8.x)")
iconname("menu")
@@ -21,16 +21,16 @@ base_frame = TkFrame.new($menu8x_demo).pack(:fill=>:both, :expand=>true)
# version check
if $tk_version.to_f < 8.0
-# label À¸À®
+# label 生æˆ
TkLabel.new(base_frame,'font'=>$font,'wraplength'=>'4i','justify'=>'left') {
- text("¼Â¹Ô¤·¤è¤¦¤È¤·¤¿¥¹¥¯¥ê¥×¥È¤Ï Tk8.0 °Ê¾å¤ÇÍøÍѤǤ­¤ëµ¡Ç½¤òÍøÍѤ·¤Æ¤¤¤ë¤¿¤á¡¢¤¢¤Ê¤¿¤Î Ruby#{VERSION}/Tk#{$tk_version}#{(Tk::JAPANIZED_TK)? 'jp': ''} ¤Ç¤ÏÀµ¾ï¤Ë¼Â¹Ô¤Ç¤­¤Þ¤»¤ó¡£¤è¤Ã¤Æ¥Ç¥â¤Î¼Â¹Ô¤òÃæ»ß¤·¤Þ¤·¤¿¡£¤¿¤À¤·¡¢²¼¤Î¥³¡¼¥É»²¾È¥Ü¥¿¥ó¤ò²¡¤¹¤³¤È¤Ç¡¢¼Â¹Ô¤¬Ãæ»ß¤µ¤ì¤¿¥¹¥¯¥ê¥×¥È¤Î¥½¡¼¥¹¤ò»²¾È¤¹¤ë¤³¤È¤Ï²Äǽ¤Ç¤¹¡£")
+ text("実行ã—よã†ã¨ã—ãŸã‚¹ã‚¯ãƒªãƒ—ト㯠Tk8.0 以上ã§åˆ©ç”¨ã§ãる機能を利用ã—ã¦ã„ã‚‹ãŸã‚ã€ã‚ãªãŸã® Ruby#{VERSION}/Tk#{$tk_version}#{(Tk::JAPANIZED_TK)? 'jp': ''} ã§ã¯æ­£å¸¸ã«å®Ÿè¡Œã§ãã¾ã›ã‚“。よã£ã¦ãƒ‡ãƒ¢ã®å®Ÿè¡Œã‚’中止ã—ã¾ã—ãŸã€‚ãŸã ã—ã€ä¸‹ã®ã‚³ãƒ¼ãƒ‰å‚照ボタンを押ã™ã“ã¨ã§ã€å®Ÿè¡ŒãŒä¸­æ­¢ã•れãŸã‚¹ã‚¯ãƒªãƒ—トã®ã‚½ãƒ¼ã‚¹ã‚’å‚ç…§ã™ã‚‹ã“ã¨ã¯å¯èƒ½ã§ã™ã€‚")
}.pack('side'=>'top')
-# frame À¸À®
+# frame 生æˆ
TkFrame.new(base_frame) {|frame|
TkButton.new(frame) {
- #text 'λ²ò'
- text 'ÊĤ¸¤ë'
+ #text '了解'
+ text 'é–‰ã˜ã‚‹'
command proc{
tmppath = $menu8x_demo
$menu8x_demo = nil
@@ -39,7 +39,7 @@ TkFrame.new(base_frame) {|frame|
}.pack('side'=>'left', 'expand'=>'yes')
TkButton.new(frame) {
- text '¥³¡¼¥É»²¾È'
+ text 'コードå‚ç…§'
command proc{showCode 'menu8x'}
}.pack('side'=>'left', 'expand'=>'yes')
}.pack('side'=>'bottom', 'fill'=>'x', 'pady'=>'2m')
@@ -52,17 +52,17 @@ rescue
windowingsystem = ""
end
-# label À¸À®
+# label 生æˆ
TkLabel.new(base_frame,'font'=>$font,'wraplength'=>'4i','justify'=>'left') {
if $tk_platform['platform'] == 'macintosh' ||
windowingsystem == "classic" || windowingsystem == "aqua"
- text("¤³¤Î¥¦¥£¥ó¥É¥¦¤ÏÍÍ¡¹¤Ê¥á¥Ë¥å¡¼¤È¥«¥¹¥±¡¼¥É¥á¥Ë¥å¡¼¤«¤é¹½À®¤µ¤ì¤Æ¤¤¤Þ¤¹¡£Command-X ¤òÆþÎϤ¹¤ë¤È¡¢X¤¬¥³¥Þ¥ó¥É¥­¡¼µ­¹æ¤Ë³¤¤¤ÆÉ½¼¨¤µ¤ì¤Æ¤¤¤ëʸ»ú¤Ê¤é¤Ð¡¢¥¢¥¯¥»¥é¥ì¡¼¥¿¤ò»È¤Ã¤¿¹àÌܵ¯Æ°¤ò¹Ô¤¦¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£¥á¥Ë¥å¡¼Í×ÁÇÃæ¡¢ºÇ¸å¤Î¤â¤Î¤Ï¡¢¤½¤Î¥á¥Ë¥å¡¼¤ÎºÇ½é¤Î¹àÌܤòÁªÂò¤¹¤ë¤³¤È¤ÇÆÈΩ¤µ¤»¤ë¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£")
+ text("ã“ã®ã‚¦ã‚£ãƒ³ãƒ‰ã‚¦ã¯æ§˜ã€…ãªãƒ¡ãƒ‹ãƒ¥ãƒ¼ã¨ã‚«ã‚¹ã‚±ãƒ¼ãƒ‰ãƒ¡ãƒ‹ãƒ¥ãƒ¼ã‹ã‚‰æ§‹æˆã•れã¦ã„ã¾ã™ã€‚Command-X を入力ã™ã‚‹ã¨ã€XãŒã‚³ãƒžãƒ³ãƒ‰ã‚­ãƒ¼è¨˜å·ã«ç¶šã„ã¦è¡¨ç¤ºã•れã¦ã„る文字ãªã‚‰ã°ã€ã‚¢ã‚¯ã‚»ãƒ©ãƒ¬ãƒ¼ã‚¿ã‚’使ã£ãŸé …目起動を行ã†ã“ã¨ãŒã§ãã¾ã™ã€‚メニューè¦ç´ ä¸­ã€æœ€å¾Œã®ã‚‚ã®ã¯ã€ãã®ãƒ¡ãƒ‹ãƒ¥ãƒ¼ã®æœ€åˆã®é …ç›®ã‚’é¸æŠžã™ã‚‹ã“ã¨ã§ç‹¬ç«‹ã•ã›ã‚‹ã“ã¨ãŒã§ãã¾ã™ã€‚")
else
- text("¤³¤Î¥¦¥£¥ó¥É¥¦¤ÏÍÍ¡¹¤Ê¥á¥Ë¥å¡¼¤È¥«¥¹¥±¡¼¥É¥á¥Ë¥å¡¼¤«¤é¹½À®¤µ¤ì¤Æ¤¤¤Þ¤¹¡£Alt-X ¤òÆþÎϤ¹¤ë¤È¡¢X¤¬¥á¥Ë¥å¡¼¤Ë¥¢¥ó¥À¡¼¥é¥¤¥óÉÕ¤­¤Çɽ¼¨¤µ¤ì¤Æ¤¤¤ëʸ»ú¤Ê¤é¤Ð¡¢¥­¡¼¥Ü¡¼¥É¤«¤é¤Î»ØÄ꤬¤Ç¤­¤Þ¤¹¡£Ìð°õ¥­¡¼¤Ç¥á¥Ë¥å¡¼¤Î¥È¥é¥Ð¡¼¥¹¤â²Äǽ¤Ç¤¹¡£¥á¥Ë¥å¡¼¤¬»ØÄꤵ¤ì¤¿ºÝ¤Ë¤Ï¡¢¥¹¥Ú¡¼¥¹¥­¡¼¤Ç¼Â¹Ô¤¹¤ë¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£¤¢¤ë¤¤¤Ï¡¢¥¢¥ó¥À¡¼¥é¥¤¥óÉÕ¤­¤Îʸ»ú¤òÆþÎϤ¹¤ë¤³¤È¤Ç¤â¼Â¹Ô¤Ç¤­¤Þ¤¹¡£¥á¥Ë¥å¡¼¤Î¥¨¥ó¥È¥ê¤¬¥¢¥¯¥»¥é¥ì¡¼¥¿¤ò»ý¤Ã¤Æ¤¤¤ë¾ì¹ç¤Ï¡¢¤½¤Î¥¢¥¯¥»¥é¥ì¡¼¥¿¤òÆþÎϤ¹¤ë¤³¤È¤Ç¥á¥Ë¥å¡¼¤ò»ØÄꤹ¤ë¤³¤È¤Ê¤·¤Ë¼Â¹Ô¤¹¤ë¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£¥á¥Ë¥å¡¼Í×ÁÇÃæ¡¢ºÇ¸å¤Î¤â¤Î¤Ï¡¢¤½¤Î¥á¥Ë¥å¡¼¤ÎºÇ½é¤Î¹àÌܤòÁªÂò¤¹¤ë¤³¤È¤ÇÆÈΩ¤µ¤»¤ë¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£")
+ text("ã“ã®ã‚¦ã‚£ãƒ³ãƒ‰ã‚¦ã¯æ§˜ã€…ãªãƒ¡ãƒ‹ãƒ¥ãƒ¼ã¨ã‚«ã‚¹ã‚±ãƒ¼ãƒ‰ãƒ¡ãƒ‹ãƒ¥ãƒ¼ã‹ã‚‰æ§‹æˆã•れã¦ã„ã¾ã™ã€‚Alt-X を入力ã™ã‚‹ã¨ã€XãŒãƒ¡ãƒ‹ãƒ¥ãƒ¼ã«ã‚¢ãƒ³ãƒ€ãƒ¼ãƒ©ã‚¤ãƒ³ä»˜ãã§è¡¨ç¤ºã•れã¦ã„る文字ãªã‚‰ã°ã€ã‚­ãƒ¼ãƒœãƒ¼ãƒ‰ã‹ã‚‰ã®æŒ‡å®šãŒã§ãã¾ã™ã€‚矢å°ã‚­ãƒ¼ã§ãƒ¡ãƒ‹ãƒ¥ãƒ¼ã®ãƒˆãƒ©ãƒãƒ¼ã‚¹ã‚‚å¯èƒ½ã§ã™ã€‚ãƒ¡ãƒ‹ãƒ¥ãƒ¼ãŒæŒ‡å®šã•れãŸéš›ã«ã¯ã€ã‚¹ãƒšãƒ¼ã‚¹ã‚­ãƒ¼ã§å®Ÿè¡Œã™ã‚‹ã“ã¨ãŒã§ãã¾ã™ã€‚ã‚ã‚‹ã„ã¯ã€ã‚¢ãƒ³ãƒ€ãƒ¼ãƒ©ã‚¤ãƒ³ä»˜ãã®æ–‡å­—を入力ã™ã‚‹ã“ã¨ã§ã‚‚実行ã§ãã¾ã™ã€‚メニューã®ã‚¨ãƒ³ãƒˆãƒªãŒã‚¢ã‚¯ã‚»ãƒ©ãƒ¬ãƒ¼ã‚¿ã‚’æŒã£ã¦ã„ã‚‹å ´åˆã¯ã€ãã®ã‚¢ã‚¯ã‚»ãƒ©ãƒ¬ãƒ¼ã‚¿ã‚’入力ã™ã‚‹ã“ã¨ã§ãƒ¡ãƒ‹ãƒ¥ãƒ¼ã‚’指定ã™ã‚‹ã“ã¨ãªã—ã«å®Ÿè¡Œã™ã‚‹ã“ã¨ãŒã§ãã¾ã™ã€‚メニューè¦ç´ ä¸­ã€æœ€å¾Œã®ã‚‚ã®ã¯ã€ãã®ãƒ¡ãƒ‹ãƒ¥ãƒ¼ã®æœ€åˆã®é …ç›®ã‚’é¸æŠžã™ã‚‹ã“ã¨ã§ç‹¬ç«‹ã•ã›ã‚‹ã“ã¨ãŒã§ãã¾ã™ã€‚")
end
}.pack('side'=>'top')
-# ¾õÂÖɽ¼¨¤ÎÀ¸À®
+# 状態表示ã®ç”Ÿæˆ
$menu8xstatus = TkVariable.new(" ")
TkFrame.new(base_frame) {|frame|
TkLabel.new(frame, 'textvariable'=>$menu8xstatus, 'relief'=>'sunken',
@@ -70,11 +70,11 @@ TkFrame.new(base_frame) {|frame|
.pack('side'=>'left', 'padx'=>2, 'expand'=>'yes', 'fill'=>'both')
}.pack('side'=>'bottom', 'fill'=>'x', 'pady'=>2)
-# frame À¸À®
+# frame 生æˆ
TkFrame.new(base_frame) {|frame|
TkButton.new(frame) {
- #text 'λ²ò'
- text 'ÊĤ¸¤ë'
+ #text '了解'
+ text 'é–‰ã˜ã‚‹'
command proc{
tmppath = $menu8x_demo
$menu8x_demo = nil
@@ -83,24 +83,24 @@ TkFrame.new(base_frame) {|frame|
}.pack('side'=>'left', 'expand'=>'yes')
TkButton.new(frame) {
- text '¥³¡¼¥É»²¾È'
+ text 'コードå‚ç…§'
command proc{showCode 'menu8x'}
}.pack('side'=>'left', 'expand'=>'yes')
}.pack('side'=>'bottom', 'fill'=>'x', 'pady'=>'2m')
-# menu À¸À®
+# menu 生æˆ
TkMenu.new($menu8x_demo, 'tearoff'=>false) {|m|
TkMenu.new(m, 'tearoff'=>false) {|file_menu|
m.add('cascade', 'label'=>'File', 'menu'=>file_menu, 'underline'=>0)
- add('command', 'label'=>'³«¤¯ ...', 'command'=>proc{fail '¤³¤ì¤Ï¡¢¥Ç¥â¤Ç¤¹¤Î¤Ç"³«¤¯ ..."¤ËÂФ¹¤ë¥¢¥¯¥·¥ç¥ó¤ÏÄêµÁ¤µ¤ì¤Æ¤¤¤Þ¤»¤ó¡£'})
- add('command', 'label'=>'¿·µ¬', 'command'=>proc{fail '¤³¤ì¤Ï¡¢¥Ç¥â¤Ç¤¹¤Î¤Ç"¿·µ¬"¤ËÂФ¹¤ë¥¢¥¯¥·¥ç¥ó¤ÏÄêµÁ¤µ¤ì¤Æ¤¤¤Þ¤»¤ó¡£'})
- add('command', 'label'=>'Êݸ', 'command'=>proc{fail '¤³¤ì¤Ï¡¢¥Ç¥â¤Ç¤¹¤Î¤Ç"Êݸ"¤ËÂФ¹¤ë¥¢¥¯¥·¥ç¥ó¤ÏÄêµÁ¤µ¤ì¤Æ¤¤¤Þ¤»¤ó¡£'})
- add('command', 'label'=>'Êݸ(»ØÄê) ...', 'command'=>proc{fail '¤³¤ì¤Ï¡¢¥Ç¥â¤Ç¤¹¤Î¤Ç"Êݸ(»ØÄê) ..."¤ËÂФ¹¤ë¥¢¥¯¥·¥ç¥ó¤ÏÄêµÁ¤µ¤ì¤Æ¤¤¤Þ¤»¤ó¡£'})
+ add('command', 'label'=>'é–‹ã ...', 'command'=>proc{fail 'ã“れã¯ã€ãƒ‡ãƒ¢ã§ã™ã®ã§"é–‹ã ..."ã«å¯¾ã™ã‚‹ã‚¢ã‚¯ã‚·ãƒ§ãƒ³ã¯å®šç¾©ã•れã¦ã„ã¾ã›ã‚“。'})
+ add('command', 'label'=>'æ–°è¦', 'command'=>proc{fail 'ã“れã¯ã€ãƒ‡ãƒ¢ã§ã™ã®ã§"æ–°è¦"ã«å¯¾ã™ã‚‹ã‚¢ã‚¯ã‚·ãƒ§ãƒ³ã¯å®šç¾©ã•れã¦ã„ã¾ã›ã‚“。'})
+ add('command', 'label'=>'ä¿å­˜', 'command'=>proc{fail 'ã“れã¯ã€ãƒ‡ãƒ¢ã§ã™ã®ã§"ä¿å­˜"ã«å¯¾ã™ã‚‹ã‚¢ã‚¯ã‚·ãƒ§ãƒ³ã¯å®šç¾©ã•れã¦ã„ã¾ã›ã‚“。'})
+ add('command', 'label'=>'ä¿å­˜(指定) ...', 'command'=>proc{fail 'ã“れã¯ã€ãƒ‡ãƒ¢ã§ã™ã®ã§"ä¿å­˜(指定) ..."ã«å¯¾ã™ã‚‹ã‚¢ã‚¯ã‚·ãƒ§ãƒ³ã¯å®šç¾©ã•れã¦ã„ã¾ã›ã‚“。'})
add('separator')
- add('command', 'label'=>'¥×¥ê¥ó¥ÈÀßÄê ...', 'command'=>proc{fail '¤³¤ì¤Ï¡¢¥Ç¥â¤Ç¤¹¤Î¤Ç"¥×¥ê¥ó¥ÈÀßÄê ..."¤ËÂФ¹¤ë¥¢¥¯¥·¥ç¥ó¤ÏÄêµÁ¤µ¤ì¤Æ¤¤¤Þ¤»¤ó¡£'})
- add('command', 'label'=>'¥×¥ê¥ó¥È ...', 'command'=>proc{fail '¤³¤ì¤Ï¡¢¥Ç¥â¤Ç¤¹¤Î¤Ç"¥×¥ê¥ó¥È ..."¤ËÂФ¹¤ë¥¢¥¯¥·¥ç¥ó¤ÏÄêµÁ¤µ¤ì¤Æ¤¤¤Þ¤»¤ó¡£'})
+ add('command', 'label'=>'プリント設定 ...', 'command'=>proc{fail 'ã“れã¯ã€ãƒ‡ãƒ¢ã§ã™ã®ã§"プリント設定 ..."ã«å¯¾ã™ã‚‹ã‚¢ã‚¯ã‚·ãƒ§ãƒ³ã¯å®šç¾©ã•れã¦ã„ã¾ã›ã‚“。'})
+ add('command', 'label'=>'プリント ...', 'command'=>proc{fail 'ã“れã¯ã€ãƒ‡ãƒ¢ã§ã™ã®ã§"プリント ..."ã«å¯¾ã™ã‚‹ã‚¢ã‚¯ã‚·ãƒ§ãƒ³ã¯å®šç¾©ã•れã¦ã„ã¾ã›ã‚“。'})
add('separator')
- add('command', 'label'=>'½ªÎ»', 'command'=>proc{$menu8x_demo.destroy})
+ add('command', 'label'=>'終了', 'command'=>proc{$menu8x_demo.destroy})
}
if $tk_platform['platform'] == 'macintosh' ||
@@ -114,10 +114,10 @@ TkMenu.new($menu8x_demo, 'tearoff'=>false) {|m|
TkMenu.new(m, 'tearoff'=>false) {|basic_menu|
m.add('cascade', 'label'=>'Basic', 'menu'=>basic_menu, 'underline'=>0)
- add('command', 'label'=>'²¿¤â¤·¤Ê¤¤Ä¹¤¤¥¨¥ó¥È¥ê')
+ add('command', 'label'=>'何もã—ãªã„é•·ã„エントリ')
['A','B','C','D','E','F','G'].each{|c|
- # add('command', 'label'=>"ʸ»ú \"#{c}\" ¤ò°õ»ú", 'underline'=>4,
- add('command', 'label'=>"Print letter \"#{c}\" (ʸ»ú \"#{c}\" ¤ò°õ»ú)",
+ # add('command', 'label'=>"文字 \"#{c}\" ã‚’å°å­—", 'underline'=>4,
+ add('command', 'label'=>"Print letter \"#{c}\" (文字 \"#{c}\" ã‚’å°å­—)",
'underline'=>14, 'accelerator'=>"Meta+#{c}",
'command'=>proc{print c,"\n"}, 'accelerator'=>"#{modifier}+#{c}")
$menu8x_demo.bind("#{modifier}-#{c.downcase}", proc{print c,"\n"})
@@ -126,56 +126,56 @@ TkMenu.new($menu8x_demo, 'tearoff'=>false) {|m|
TkMenu.new(m, 'tearoff'=>false) {|cascade_menu|
m.add('cascade', 'label'=>'Cascades', 'menu'=>cascade_menu, 'underline'=>0)
- add('command', 'label'=>'Print hello(¤³¤ó¤Ë¤Á¤Ï)',
- 'command'=>proc{print "Hello(¤³¤ó¤Ë¤Á¤Ï)\n"},
+ add('command', 'label'=>'Print hello(ã“ã‚“ã«ã¡ã¯)',
+ 'command'=>proc{print "Hello(ã“ã‚“ã«ã¡ã¯)\n"},
'accelerator'=>"#{modifier}+H", 'underline'=>6)
- $menu8x_demo.bind("#{modifier}-h", proc{print "Hello(¤³¤ó¤Ë¤Á¤Ï)\n"})
- add('command', 'label'=>'Print goodbye(¤µ¤è¤¦¤Ê¤é)',
- 'command'=>proc{print "Goodbye(¤µ¤è¤¦¤Ê¤é)\n"},
+ $menu8x_demo.bind("#{modifier}-h", proc{print "Hello(ã“ã‚“ã«ã¡ã¯)\n"})
+ add('command', 'label'=>'Print goodbye(ã•よã†ãªã‚‰)',
+ 'command'=>proc{print "Goodbye(ã•よã†ãªã‚‰)\n"},
'accelerator'=>"#{modifier}+G", 'underline'=>6)
- $menu8x_demo.bind("#{modifier}-g", proc{print "Goodbye(¤µ¤è¤¦¤Ê¤é)\n"})
+ $menu8x_demo.bind("#{modifier}-g", proc{print "Goodbye(ã•よã†ãªã‚‰)\n"})
TkMenu.new(m, 'tearoff'=>false) {|cascade_check|
- cascade_menu.add('cascade', 'label'=>'Check buttons(¥Á¥§¥Ã¥¯¥Ü¥¿¥ó)',
+ cascade_menu.add('cascade', 'label'=>'Check buttons(ãƒã‚§ãƒƒã‚¯ãƒœã‚¿ãƒ³)',
'menu'=>cascade_check, 'underline'=>0)
oil = TkVariable.new(0)
- add('check', 'label'=>'¥ª¥¤¥ëÅÀ¸¡', 'variable'=>oil)
+ add('check', 'label'=>'オイル点検', 'variable'=>oil)
trans = TkVariable.new(0)
- add('check', 'label'=>'¥È¥é¥ó¥¹¥ß¥Ã¥·¥ç¥óÅÀ¸¡', 'variable'=>trans)
+ add('check', 'label'=>'トランスミッション点検', 'variable'=>trans)
brakes = TkVariable.new(0)
- add('check', 'label'=>'¥Ö¥ì¡¼¥­ÅÀ¸¡', 'variable'=>brakes)
+ add('check', 'label'=>'ブレーキ点検', 'variable'=>brakes)
lights = TkVariable.new(0)
- add('check', 'label'=>'¥é¥¤¥ÈÅÀ¸¡', 'variable'=>lights)
+ add('check', 'label'=>'ライト点検', 'variable'=>lights)
add('separator')
- add('command', 'label'=>'¸½ºß¤ÎÃͤòɽ¼¨',
+ add('command', 'label'=>'ç¾åœ¨ã®å€¤ã‚’表示',
'command'=>proc{showVars($menu8x_demo,
- ['¥ª¥¤¥ëÅÀ¸¡', oil],
- ['¥È¥é¥ó¥¹¥ß¥Ã¥·¥ç¥óÅÀ¸¡', trans],
- ['¥Ö¥ì¡¼¥­ÅÀ¸¡', brakes],
- ['¥é¥¤¥ÈÅÀ¸¡', lights])} )
+ ['オイル点検', oil],
+ ['トランスミッション点検', trans],
+ ['ブレーキ点検', brakes],
+ ['ライト点検', lights])} )
invoke 1
invoke 3
}
TkMenu.new(m, 'tearoff'=>false) {|cascade_radio|
- cascade_menu.add('cascade', 'label'=>'Radio buttons(¥é¥¸¥ª¥Ü¥¿¥ó)',
+ cascade_menu.add('cascade', 'label'=>'Radio buttons(ラジオボタン)',
'menu'=>cascade_radio, 'underline'=>0)
pointSize = TkVariable.new
- add('radio', 'label'=>'10 ¥Ý¥¤¥ó¥È', 'variable'=>pointSize, 'value'=>10)
- add('radio', 'label'=>'14 ¥Ý¥¤¥ó¥È', 'variable'=>pointSize, 'value'=>14)
- add('radio', 'label'=>'18 ¥Ý¥¤¥ó¥È', 'variable'=>pointSize, 'value'=>18)
- add('radio', 'label'=>'24 ¥Ý¥¤¥ó¥È', 'variable'=>pointSize, 'value'=>24)
- add('radio', 'label'=>'32 ¥Ý¥¤¥ó¥È', 'variable'=>pointSize, 'value'=>32)
+ add('radio', 'label'=>'10 ãƒã‚¤ãƒ³ãƒˆ', 'variable'=>pointSize, 'value'=>10)
+ add('radio', 'label'=>'14 ãƒã‚¤ãƒ³ãƒˆ', 'variable'=>pointSize, 'value'=>14)
+ add('radio', 'label'=>'18 ãƒã‚¤ãƒ³ãƒˆ', 'variable'=>pointSize, 'value'=>18)
+ add('radio', 'label'=>'24 ãƒã‚¤ãƒ³ãƒˆ', 'variable'=>pointSize, 'value'=>24)
+ add('radio', 'label'=>'32 ãƒã‚¤ãƒ³ãƒˆ', 'variable'=>pointSize, 'value'=>32)
add('separator')
style = TkVariable.new
- add('radio', 'label'=>'¥í¡¼¥Þ¥ó', 'variable'=>style, 'value'=>'roman')
- add('radio', 'label'=>'¥Ü¡¼¥ë¥É', 'variable'=>style, 'value'=>'bold')
- add('radio', 'label'=>'¥¤¥¿¥ê¥Ã¥¯', 'variable'=>style, 'value'=>'italic')
+ add('radio', 'label'=>'ローマン', 'variable'=>style, 'value'=>'roman')
+ add('radio', 'label'=>'ボールド', 'variable'=>style, 'value'=>'bold')
+ add('radio', 'label'=>'イタリック', 'variable'=>style, 'value'=>'italic')
add('separator')
- add('command', 'label'=>'¸½ºß¤ÎÃͤòɽ¼¨',
+ add('command', 'label'=>'ç¾åœ¨ã®å€¤ã‚’表示',
'command'=>proc{showVars($menu8x_demo,
- ['¥Ý¥¤¥ó¥È¥µ¥¤¥º', pointSize],
- ['¥¹¥¿¥¤¥ë', style])} )
+ ['ãƒã‚¤ãƒ³ãƒˆã‚µã‚¤ã‚º', pointSize],
+ ['スタイル', style])} )
invoke 1
invoke 7
}
@@ -188,9 +188,9 @@ TkMenu.new($menu8x_demo, 'tearoff'=>false) {|m|
'images','pattern.xbm'].join(File::Separator),
'hidemargin'=>1,
'command'=>proc{TkDialog.new('title'=>'Bitmap Menu Entry',
- 'text'=>'º£¤¢¤Ê¤¿¤¬ÁªÂò¤·¤¿¥á¥Ë¥å¡¼¤Î¹àÌܤϥƥ­¥¹¥È¤Ç¤Ï¤Ê¤¯¥Ó¥Ã¥È¥Þ¥Ã¥×¤òɽ¼¨¤·¤Æ¤¤¤Þ¤·¤¿¡£¤½¤ì°Ê³°¤ÎÅÀ¤Ç¤Ï¾¤Î¥á¥Ë¥å¡¼¹àÌܤÈÊѤï¤ê¤Þ¤»¤ó¡£',
+ 'text'=>'今ã‚ãªãŸãŒé¸æŠžã—ãŸãƒ¡ãƒ‹ãƒ¥ãƒ¼ã®é …ç›®ã¯ãƒ†ã‚­ã‚¹ãƒˆã§ã¯ãªãビットマップを表示ã—ã¦ã„ã¾ã—ãŸã€‚ãれ以外ã®ç‚¹ã§ã¯ä»–ã®ãƒ¡ãƒ‹ãƒ¥ãƒ¼é …ç›®ã¨å¤‰ã‚りã¾ã›ã‚“。',
'bitmap'=>'', 'default'=>0,
- 'buttons'=>'λ²ò')} )
+ 'buttons'=>'了解')} )
['info', 'questhead', 'error'].each{|icon|
add('command', 'bitmap'=>icon, 'hidemargin'=>1,
'command'=>proc{print "You invoked the #{icon} bitmap\n"})
@@ -201,8 +201,8 @@ TkMenu.new($menu8x_demo, 'tearoff'=>false) {|m|
TkMenu.new(m, 'tearoff'=>false) {|more_menu|
m.add('cascade', 'label'=>'More', 'menu'=>more_menu, 'underline'=>0)
- [ '¥¨¥ó¥È¥ê','Ê̤Υ¨¥ó¥È¥ê','²¿¤â¤·¤Ê¤¤','¤Û¤È¤ó¤É²¿¤â¤·¤Ê¤¤',
- '¿ÍÀ¸¤ò°ÕµÁ¤¢¤ë¤â¤Î¤Ë' ].each{|i|
+ [ 'エントリ','別ã®ã‚¨ãƒ³ãƒˆãƒª','何もã—ãªã„','ã»ã¨ã‚“ã©ä½•ã‚‚ã—ãªã„',
+ '人生をæ„義ã‚ã‚‹ã‚‚ã®ã«' ].each{|i|
add('command', 'label'=>i,
'command'=>proc{print "You invoked \"#{i}\"\n"})
}
diff --git a/ext/tk/sample/demos-jp/menubu.rb b/ext/tk/sample/demos-jp/menubu.rb
index 78418ce3ea..06f9eb875e 100644
--- a/ext/tk/sample/demos-jp/menubu.rb
+++ b/ext/tk/sample/demos-jp/menubu.rb
@@ -1,4 +1,4 @@
-# -*- coding: euc-jp -*-
+# -*- coding: utf-8 -*-
require "tkcanvas"
def optionMenu(menubutton, varName, firstValue, *rest)
@@ -38,16 +38,16 @@ base_frame = TkFrame.new($menubu_demo).pack(:fill=>:both, :expand=>true)
# version check
if $tk_version.to_f < 8.0
-# label À¸À®
+# label 生æˆ
TkLabel.new(base_frame,'font'=>$font,'wraplength'=>'4i','justify'=>'left') {
- text("¼Â¹Ô¤·¤è¤¦¤È¤·¤¿¥¹¥¯¥ê¥×¥È¤Ï Tk8.0 °Ê¾å¤ÇÍøÍѤǤ­¤ëµ¡Ç½¤òÍøÍѤ·¤Æ¤¤¤ë¤¿¤á¡¢¤¢¤Ê¤¿¤Î Ruby#{VERSION}/Tk#{$tk_version}#{(Tk::JAPANIZED_TK)? 'jp': ''} ¤Ç¤ÏÀµ¾ï¤Ë¼Â¹Ô¤Ç¤­¤Þ¤»¤ó¡£¤è¤Ã¤Æ¥Ç¥â¤Î¼Â¹Ô¤òÃæ»ß¤·¤Þ¤·¤¿¡£¤¿¤À¤·¡¢²¼¤Î¥³¡¼¥É»²¾È¥Ü¥¿¥ó¤ò²¡¤¹¤³¤È¤Ç¡¢¼Â¹Ô¤¬Ãæ»ß¤µ¤ì¤¿¥¹¥¯¥ê¥×¥È¤Î¥½¡¼¥¹¤ò»²¾È¤¹¤ë¤³¤È¤Ï²Äǽ¤Ç¤¹¡£")
+ text("実行ã—よã†ã¨ã—ãŸã‚¹ã‚¯ãƒªãƒ—ト㯠Tk8.0 以上ã§åˆ©ç”¨ã§ãる機能を利用ã—ã¦ã„ã‚‹ãŸã‚ã€ã‚ãªãŸã® Ruby#{VERSION}/Tk#{$tk_version}#{(Tk::JAPANIZED_TK)? 'jp': ''} ã§ã¯æ­£å¸¸ã«å®Ÿè¡Œã§ãã¾ã›ã‚“。よã£ã¦ãƒ‡ãƒ¢ã®å®Ÿè¡Œã‚’中止ã—ã¾ã—ãŸã€‚ãŸã ã—ã€ä¸‹ã®ã‚³ãƒ¼ãƒ‰å‚照ボタンを押ã™ã“ã¨ã§ã€å®Ÿè¡ŒãŒä¸­æ­¢ã•れãŸã‚¹ã‚¯ãƒªãƒ—トã®ã‚½ãƒ¼ã‚¹ã‚’å‚ç…§ã™ã‚‹ã“ã¨ã¯å¯èƒ½ã§ã™ã€‚")
}.pack('side'=>'top')
-# frame À¸À®
+# frame 生æˆ
TkFrame.new(base_frame) {|frame|
TkButton.new(frame) {
- #text 'λ²ò'
- text 'ÊĤ¸¤ë'
+ #text '了解'
+ text 'é–‰ã˜ã‚‹'
command proc{
tmppath = $menubu_demo
$menubu_demo = nil
@@ -56,7 +56,7 @@ TkFrame.new(base_frame) {|frame|
}.pack('side'=>'left', 'expand'=>'yes')
TkButton.new(frame) {
- text '¥³¡¼¥É»²¾È'
+ text 'コードå‚ç…§'
command proc{showCode 'menubu'}
}.pack('side'=>'left', 'expand'=>'yes')
}.pack('side'=>'bottom', 'fill'=>'x', 'pady'=>'2m')
@@ -160,8 +160,8 @@ center = TkFrame.new(body) {
TkFrame.new(base_frame) {|frame|
TkButton.new(frame) {
- #text 'λ²ò'
- text 'ÊĤ¸¤ë'
+ #text '了解'
+ text 'é–‰ã˜ã‚‹'
command proc {
tmppath = $menubu_demo
$menubu_demo = nil
@@ -170,7 +170,7 @@ TkFrame.new(base_frame) {|frame|
}.pack('side'=>'left', 'expand'=>'yes')
TkButton.new(frame) {
- text '¥³¡¼¥É»²¾È'
+ text 'コードå‚ç…§'
command proc { showCode 'menubu' }
}.pack('side'=>'left', 'expand'=>'yes')
}.pack('side'=>'bottom', 'expand'=>'yes', 'fill'=>'x', 'pady'=>'2m')
@@ -179,10 +179,10 @@ msg = TkLabel.new(center) {
# font $font
wraplength '4i'
justify 'left'
- text "¤³¤ì¤Ï¥á¥Ë¥å¡¼¥Ü¥¿¥ó¤Î¥Ç¥â¤Ç¤¹¡£\"Below\"¤Î¥Ü¥¿¥ó¤Ï\
-²¼¤Ë¥á¥Ë¥å¡¼¤ò½Ð¤·¡¢\"Right\"¤Î¥Ü¥¿¥ó¤Ï±¦¤Ë¥á¥Ë¥å¡¼¤ò½Ð¤·¤Æ¡¢\
-¡Ä¡Ä¤È¤Ê¤ê¤Þ¤¹¡£¤³¤Îʸ¾Ï¤Î²¼¤Ë¤Ï2¤Ä¤Î¥ª¥×¥·¥ç¥ó¥á¥Ë¥å¡¼¤¬¤¢¤ê¤Þ¤¹¡£\
-1¤Ä¤ÏÉáÄ̤Υá¥Ë¥å¡¼¤Ç¡¢¤â¤¦1¤Ä¤Ï16¿§¤Î¥Ñ¥ì¥Ã¥È¤Ç¤¹¡£"
+ text "ã“れã¯ãƒ¡ãƒ‹ãƒ¥ãƒ¼ãƒœã‚¿ãƒ³ã®ãƒ‡ãƒ¢ã§ã™ã€‚\"Below\"ã®ãƒœã‚¿ãƒ³ã¯\
+下ã«ãƒ¡ãƒ‹ãƒ¥ãƒ¼ã‚’出ã—ã€\"Right\"ã®ãƒœã‚¿ãƒ³ã¯å³ã«ãƒ¡ãƒ‹ãƒ¥ãƒ¼ã‚’出ã—ã¦ã€\
+……ã¨ãªã‚Šã¾ã™ã€‚ã“ã®æ–‡ç« ã®ä¸‹ã«ã¯2ã¤ã®ã‚ªãƒ—ションメニューãŒã‚りã¾ã™ã€‚\
+1ã¤ã¯æ™®é€šã®ãƒ¡ãƒ‹ãƒ¥ãƒ¼ã§ã€ã‚‚ã†1ã¤ã¯16色ã®ãƒ‘レットã§ã™ã€‚"
}
msg.pack('side'=>'top', 'padx'=>25, 'pady'=>25)
diff --git a/ext/tk/sample/demos-jp/msgbox.rb b/ext/tk/sample/demos-jp/msgbox.rb
index ed5d01252e..ec7b4f2bbc 100644
--- a/ext/tk/sample/demos-jp/msgbox.rb
+++ b/ext/tk/sample/demos-jp/msgbox.rb
@@ -1,15 +1,15 @@
-# -*- coding: euc-jp -*-
+# -*- coding: utf-8 -*-
#
# message boxes widget demo (called by 'widget')
#
-# toplevel widget ¤¬Â¸ºß¤¹¤ì¤Ðºï½ü¤¹¤ë
+# toplevel widget ãŒå­˜åœ¨ã™ã‚Œã°å‰Šé™¤ã™ã‚‹
if defined?($msgbox_demo) && $msgbox_demo
$msgbox_demo.destroy
$msgbox_demo = nil
end
-# demo ÍѤΠtoplevel widget ¤òÀ¸À®
+# demo 用㮠toplevel widget を生æˆ
$msgbox_demo = TkToplevel.new {|w|
title("Message Box Demonstration")
iconname("messagebox")
@@ -18,15 +18,15 @@ $msgbox_demo = TkToplevel.new {|w|
base_frame = TkFrame.new($msgbox_demo).pack(:fill=>:both, :expand=>true)
-# label À¸À®
+# label 生æˆ
TkLabel.new(base_frame, 'font'=>$font, 'wraplength'=>'4i', 'justify'=>'left',
- 'text'=>"¤Þ¤ºÉ½¼¨¤¹¤ë¥¢¥¤¥³¥ó¤È¥á¥Ã¥»¡¼¥¸¥Ü¥Ã¥¯¥¹¤Î¼ïÎà¤òÁª¤ó¤Ç²¼¤µ¤¤¡£¤½¤Î¸å¤Ë\"¥á¥Ã¥»¡¼¥¸¥Ü¥Ã¥¯¥¹\"¥Ü¥¿¥ó¤ò²¡¤¹¤È¡¢»ØÄꤷ¤¿¥á¥Ã¥»¡¼¥¸¥Ü¥Ã¥¯¥¹¤¬É½¼¨¤µ¤ì¤Þ¤¹¡£").pack('side'=>'top')
+ 'text'=>"ã¾ãšè¡¨ç¤ºã™ã‚‹ã‚¢ã‚¤ã‚³ãƒ³ã¨ãƒ¡ãƒƒã‚»ãƒ¼ã‚¸ãƒœãƒƒã‚¯ã‚¹ã®ç¨®é¡žã‚’é¸ã‚“ã§ä¸‹ã•ã„。ãã®å¾Œã«\"メッセージボックス\"ボタンを押ã™ã¨ã€æŒ‡å®šã—ãŸãƒ¡ãƒƒã‚»ãƒ¼ã‚¸ãƒœãƒƒã‚¯ã‚¹ãŒè¡¨ç¤ºã•れã¾ã™ã€‚").pack('side'=>'top')
-# frame À¸À®
+# frame 生æˆ
TkFrame.new(base_frame) {|frame|
TkButton.new(frame) {
- #text 'λ²ò'
- text 'ÊĤ¸¤ë'
+ #text '了解'
+ text 'é–‰ã˜ã‚‹'
command proc{
tmppath = $msgbox_demo
$msgbox_demo = nil
@@ -35,17 +35,17 @@ TkFrame.new(base_frame) {|frame|
}.pack('side'=>'left', 'expand'=>'yes')
TkButton.new(frame) {
- text '¥³¡¼¥É»²¾È'
+ text 'コードå‚ç…§'
command proc{showCode 'msgbox'}
}.pack('side'=>'left', 'expand'=>'yes')
TkButton.new(frame) {
- text '¥á¥Ã¥»¡¼¥¸¥Ü¥Ã¥¯¥¹'
+ text 'メッセージボックス'
command proc{showMessageBox $msgbox_demo}
}.pack('side'=>'left', 'expand'=>'yes')
}.pack('side'=>'bottom', 'fill'=>'x', 'pady'=>'2m')
-# frame À¸À®
+# frame 生æˆ
$msgbox_leftframe = TkFrame.new(base_frame)
$msgbox_rightframe = TkFrame.new(base_frame)
$msgbox_leftframe .pack('side'=>'left', 'expand'=>'yes', 'fill'=>'y',
@@ -53,7 +53,7 @@ $msgbox_leftframe .pack('side'=>'left', 'expand'=>'yes', 'fill'=>'y',
$msgbox_rightframe.pack('side'=>'left', 'expand'=>'yes', 'fill'=>'y',
'pady'=>'.5c', 'padx'=>'.5c')
-TkLabel.new($msgbox_leftframe, 'text'=>'¥¢¥¤¥³¥ó').pack('side'=>'top')
+TkLabel.new($msgbox_leftframe, 'text'=>'アイコン').pack('side'=>'top')
TkFrame.new($msgbox_leftframe, 'relief'=>'ridge', 'bd'=>1, 'height'=>2)\
.pack('side'=>'top', 'fill'=>'x', 'expand'=>'no')
@@ -65,7 +65,7 @@ $msgboxIcon = TkVariable.new('info')
'anchor'=>'w', 'fill'=>'x')
}
-TkLabel.new($msgbox_rightframe, 'text'=>'¼ïÎà').pack('side'=>'top')
+TkLabel.new($msgbox_rightframe, 'text'=>'種類').pack('side'=>'top')
TkFrame.new($msgbox_rightframe, 'relief'=>'ridge', 'bd'=>1, 'height'=>2)\
.pack('side'=>'top', 'fill'=>'x', 'expand'=>'no')
@@ -81,9 +81,9 @@ $msgboxType = TkVariable.new('ok')
def showMessageBox(w)
button = Tk.messageBox('icon'=>$msgboxIcon.value, 'type'=>$msgboxType.value,
'title'=>'Message', 'parent'=>w,
- 'message'=>"¤³¤ì¤Ï\"#{$msgboxType.value}\"¤È¤¤¤¦¼ïÎà¤Î¥á¥Ã¥»¡¼¥¸¥Ü¥Ã¥¯¥¹¤Ç¡¢\"#{$msgboxIcon.value}\"¤Î¥¢¥¤¥³¥ó¤¬É½¼¨¤µ¤ì¤Æ¤¤¤Þ¤¹¡£")
+ 'message'=>"ã“れã¯\"#{$msgboxType.value}\"ã¨ã„ã†ç¨®é¡žã®ãƒ¡ãƒƒã‚»ãƒ¼ã‚¸ãƒœãƒƒã‚¯ã‚¹ã§ã€\"#{$msgboxIcon.value}\"ã®ã‚¢ã‚¤ã‚³ãƒ³ãŒè¡¨ç¤ºã•れã¦ã„ã¾ã™ã€‚")
Tk.messageBox('icon'=>'info', 'type'=>'ok', 'parent'=>w,
- 'message'=>"¤¢¤Ê¤¿¤Ï \"#{button}\" ¤ò²¡¤·¤Þ¤·¤¿¤Í¡£")
+ 'message'=>"ã‚ãªãŸã¯ \"#{button}\" を押ã—ã¾ã—ãŸã­ã€‚")
end
diff --git a/ext/tk/sample/demos-jp/msgbox2.rb b/ext/tk/sample/demos-jp/msgbox2.rb
index 8c80e08d70..ad6d936036 100644
--- a/ext/tk/sample/demos-jp/msgbox2.rb
+++ b/ext/tk/sample/demos-jp/msgbox2.rb
@@ -1,15 +1,15 @@
-# -*- coding: euc-jp -*-
+# -*- coding: utf-8 -*-
#
# message boxes widget demo (called by 'widget')
#
-# toplevel widget ¤¬Â¸ºß¤¹¤ì¤Ðºï½ü¤¹¤ë
+# toplevel widget ãŒå­˜åœ¨ã™ã‚Œã°å‰Šé™¤ã™ã‚‹
if defined?($msgbox2_demo) && $msgbox2_demo
$msgbox2_demo.destroy
$msgbox2_demo = nil
end
-# demo ÍѤΠtoplevel widget ¤òÀ¸À®
+# demo 用㮠toplevel widget を生æˆ
$msgbox2_demo = TkToplevel.new {|w|
title("Message Box Demonstration")
iconname("messagebox")
@@ -18,15 +18,15 @@ $msgbox2_demo = TkToplevel.new {|w|
base_frame = TkFrame.new($msgbox2_demo).pack(:fill=>:both, :expand=>true)
-# label À¸À®
+# label 生æˆ
TkLabel.new(base_frame, 'font'=>$font, 'wraplength'=>'4i', 'justify'=>'left',
- 'text'=>"¤Þ¤ºÉ½¼¨¤¹¤ë¥¢¥¤¥³¥ó¤È¥á¥Ã¥»¡¼¥¸¥Ü¥Ã¥¯¥¹¤Î¼ïÎà¤òÁª¤ó¤Ç²¼¤µ¤¤¡£¤½¤Î¸å¤Ë\"¥á¥Ã¥»¡¼¥¸¥Ü¥Ã¥¯¥¹\"¥Ü¥¿¥ó¤ò²¡¤¹¤È¡¢»ØÄꤵ¤ì¤¿·Á¼°¤Ç¡¢¥á¥Ã¥»¡¼¥¸¤È¾ÜºÙ¥Æ¥­¥¹¥È¤È¤ò»ý¤Ã¤¿¥á¥Ã¥»¡¼¥¸¥Ü¥Ã¥¯¥¹¤¬É½¼¨¤µ¤ì¤Þ¤¹¡£").pack('side'=>'top')
+ 'text'=>"ã¾ãšè¡¨ç¤ºã™ã‚‹ã‚¢ã‚¤ã‚³ãƒ³ã¨ãƒ¡ãƒƒã‚»ãƒ¼ã‚¸ãƒœãƒƒã‚¯ã‚¹ã®ç¨®é¡žã‚’é¸ã‚“ã§ä¸‹ã•ã„。ãã®å¾Œã«\"メッセージボックス\"ボタンを押ã™ã¨ã€æŒ‡å®šã•れãŸå½¢å¼ã§ã€ãƒ¡ãƒƒã‚»ãƒ¼ã‚¸ã¨è©³ç´°ãƒ†ã‚­ã‚¹ãƒˆã¨ã‚’æŒã£ãŸãƒ¡ãƒƒã‚»ãƒ¼ã‚¸ãƒœãƒƒã‚¯ã‚¹ãŒè¡¨ç¤ºã•れã¾ã™ã€‚").pack('side'=>'top')
-# frame À¸À®
+# frame 生æˆ
TkFrame.new(base_frame) {|frame|
TkButton.new(frame) {
- #text 'λ²ò'
- text 'ÊĤ¸¤ë'
+ #text '了解'
+ text 'é–‰ã˜ã‚‹'
command proc{
tmppath = $msgbox2_demo
$msgbox2_demo = nil
@@ -35,17 +35,17 @@ TkFrame.new(base_frame) {|frame|
}.pack('side'=>'left', 'expand'=>'yes')
TkButton.new(frame) {
- text '¥³¡¼¥É»²¾È'
+ text 'コードå‚ç…§'
command proc{showCode 'msgbox2'}
}.pack('side'=>'left', 'expand'=>'yes')
TkButton.new(frame) {
- text '¥á¥Ã¥»¡¼¥¸¥Ü¥Ã¥¯¥¹'
+ text 'メッセージボックス'
command proc{showMessageBox2 $msgbox2_demo}
}.pack('side'=>'left', 'expand'=>'yes')
}.pack('side'=>'bottom', 'fill'=>'x', 'pady'=>'2m')
-# frame À¸À®
+# frame 生æˆ
$msgbox_leftframe = TkFrame.new(base_frame)
$msgbox_rightframe = TkFrame.new(base_frame)
$msgbox_leftframe .pack('side'=>'left', 'expand'=>'yes', 'fill'=>'y',
@@ -53,7 +53,7 @@ $msgbox_leftframe .pack('side'=>'left', 'expand'=>'yes', 'fill'=>'y',
$msgbox_rightframe.pack('side'=>'left', 'expand'=>'yes', 'fill'=>'y',
'pady'=>'.5c', 'padx'=>'.5c')
-TkLabel.new($msgbox_leftframe, 'text'=>'¥¢¥¤¥³¥ó').pack('side'=>'top')
+TkLabel.new($msgbox_leftframe, 'text'=>'アイコン').pack('side'=>'top')
TkFrame.new($msgbox_leftframe, 'relief'=>'ridge', 'bd'=>1, 'height'=>2)\
.pack('side'=>'top', 'fill'=>'x', 'expand'=>'no')
@@ -65,7 +65,7 @@ $msgboxIcon = TkVariable.new('info')
'anchor'=>'w', 'fill'=>'x')
}
-TkLabel.new($msgbox_rightframe, 'text'=>'¼ïÎà').pack('side'=>'top')
+TkLabel.new($msgbox_rightframe, 'text'=>'種類').pack('side'=>'top')
TkFrame.new($msgbox_rightframe, 'relief'=>'ridge', 'bd'=>1, 'height'=>2)\
.pack('side'=>'top', 'fill'=>'x', 'expand'=>'no')
@@ -81,10 +81,10 @@ $msgboxType = TkVariable.new('ok')
def showMessageBox2(w)
button = Tk.messageBox('icon'=>$msgboxIcon.value, 'type'=>$msgboxType.value,
'title'=>'Message', 'parent'=>w,
- 'message'=>"\"#{$msgboxType.value}\"¥¿¥¤¥×¤Î¥á¥Ã¥»¡¼¥¸¥Ü¥Ã¥¯¥¹",
- 'detail'=>"¤³¤ì¤Ï\"#{$msgboxType.value}\"¤È¤¤¤¦¼ïÎà¤Î¥á¥Ã¥»¡¼¥¸¥Ü¥Ã¥¯¥¹¤Ç¡¢\"#{$msgboxIcon.value}\"¤Î¥¢¥¤¥³¥ó¤¬É½¼¨¤µ¤ì¤Æ¤¤¤Þ¤¹¡£²¼¤Î¥Ü¥¿¥ó¤Î¤¤¤º¤ì¤«¤òÁªÂò¤·¤Æ¥¯¥ê¥Ã¥¯¤·¤Æ¤¯¤À¤µ¤¤¡£")
+ 'message'=>"\"#{$msgboxType.value}\"タイプã®ãƒ¡ãƒƒã‚»ãƒ¼ã‚¸ãƒœãƒƒã‚¯ã‚¹",
+ 'detail'=>"ã“れã¯\"#{$msgboxType.value}\"ã¨ã„ã†ç¨®é¡žã®ãƒ¡ãƒƒã‚»ãƒ¼ã‚¸ãƒœãƒƒã‚¯ã‚¹ã§ã€\"#{$msgboxIcon.value}\"ã®ã‚¢ã‚¤ã‚³ãƒ³ãŒè¡¨ç¤ºã•れã¦ã„ã¾ã™ã€‚下ã®ãƒœã‚¿ãƒ³ã®ã„ãšã‚Œã‹ã‚’é¸æŠžã—ã¦ã‚¯ãƒªãƒƒã‚¯ã—ã¦ãã ã•ã„。")
Tk.messageBox('icon'=>'info', 'type'=>'ok', 'parent'=>w,
- 'message'=>"¤¢¤Ê¤¿¤Ï \"#{button}\" ¤ò²¡¤·¤Þ¤·¤¿¤Í¡£")
+ 'message'=>"ã‚ãªãŸã¯ \"#{button}\" を押ã—ã¾ã—ãŸã­ã€‚")
end
diff --git a/ext/tk/sample/demos-jp/paned1.rb b/ext/tk/sample/demos-jp/paned1.rb
index 987a073086..53d2e7162b 100644
--- a/ext/tk/sample/demos-jp/paned1.rb
+++ b/ext/tk/sample/demos-jp/paned1.rb
@@ -1,4 +1,4 @@
-# -*- coding: euc-jp -*-
+# -*- coding: utf-8 -*-
#
# paned1.rb
#
@@ -23,23 +23,23 @@ base_frame = TkFrame.new($paned1_demo).pack(:fill=>:both, :expand=>true)
TkLabel.new(base_frame,
:font=>$font, :wraplength=>'4i', :justify=>:left,
:text=><<EOL).pack(:side=>:top)
-²¼¤Î¿§ÉÕ¤±¤µ¤ì¤¿Æó¤Ä¤Î¥¦¥£¥ó¥É¥¦¤Î´Ö¤Î»ÅÀÚ¤êÏȤϡ¢°ì¤Ä¤ÎÎΰè¤ò¤½¤ì¤¾¤ì¤Î¥¦¥£¥ó¥É¥¦¤Î¤¿¤á¤Ëʬ³ä¤¹¤ë¤¿¤á¤Î¤â¤Î¤Ç¤¹¡£º¸¥Ü¥¿¥ó¤Ç»ÅÀÚ¤ê¤òÁàºî¤¹¤ë¤È¡¢Ê¬³ä¥µ¥¤¥ºÊѹ¹¤ÎÁàºîÅÓÃæ¤Ç¤ÏºÆÉ½¼¨¤Ï¤Ê¤µ¤ì¤º¡¢³ÎÄꤵ¤»¤¿¤È¤­¤Ëɽ¼¨¤¬¹¹¿·¤µ¤ì¤Þ¤¹¡£¥Þ¥¦¥¹¤Ë¤è¤ë»ÅÀÚ¤ê¤ÎÁàºî¤ËÄɿ路¤Æ¥µ¥¤¥º¤òÊѹ¹¤·¤¿É½¼¨¤¬¤Ê¤ï¤ì¤ë¤è¤¦¤Ë¤·¤¿¤¤¾ì¹ç¤Ï¡¢¥Þ¥¦¥¹¤ÎÃæ±û¥Ü¥¿¥ó¤ò»È¤Ã¤Æ¤¯¤À¤µ¤¤¡£
-¤â¤·¤¢¤Ê¤¿¤¬»È¤Ã¤Æ¤¤¤ë Ruby ¤Ë¥ê¥ó¥¯¤µ¤ì¤Æ¤¤¤ë Tk ¥é¥¤¥Ö¥é¥ê¤¬ panedwindow ¤ò¼ÂÁõ¤·¤Æ¤¤¤Ê¤¤
-¾ì¹ç¡¢¤³¤Î¥Ç¥â¤Ï¤¦¤Þ¤¯Æ°¤«¤Ê¤¤¤Ï¤º¤Ç¤¹¡£¤½¤Î¾ì¹ç¤Ë¤Ï panedwindow ¤¬¼ÂÁõ¤µ¤ì¤Æ¤¤¤ë¤è¤¦¤Ê
-¤è¤ê¿·¤·¤¤¥Ð¡¼¥¸¥ç¥ó¤Î Tk ¤òÁȤ߹ç¤ï¤»¤Æ»î¤¹
-¤è¤¦¤Ë¤·¤Æ¤¯¤À¤µ¤¤¡£
+下ã®è‰²ä»˜ã‘ã•れãŸäºŒã¤ã®ã‚¦ã‚£ãƒ³ãƒ‰ã‚¦ã®é–“ã®ä»•切り枠ã¯ã€ä¸€ã¤ã®é ˜åŸŸã‚’ãれãžã‚Œã®ã‚¦ã‚£ãƒ³ãƒ‰ã‚¦ã®ãŸã‚ã«åˆ†å‰²ã™ã‚‹ãŸã‚ã®ã‚‚ã®ã§ã™ã€‚左ボタンã§ä»•切りをæ“作ã™ã‚‹ã¨ã€åˆ†å‰²ã‚µã‚¤ã‚ºå¤‰æ›´ã®æ“作途中ã§ã¯å†è¡¨ç¤ºã¯ãªã•れãšã€ç¢ºå®šã•ã›ãŸã¨ãã«è¡¨ç¤ºãŒæ›´æ–°ã•れã¾ã™ã€‚マウスã«ã‚ˆã‚‹ä»•åˆ‡ã‚Šã®æ“作ã«è¿½éšã—ã¦ã‚µã‚¤ã‚ºã‚’変更ã—ãŸè¡¨ç¤ºãŒãªã‚れるよã†ã«ã—ãŸã„å ´åˆã¯ã€ãƒžã‚¦ã‚¹ã®ä¸­å¤®ãƒœã‚¿ãƒ³ã‚’使ã£ã¦ãã ã•ã„。
+ã‚‚ã—ã‚ãªãŸãŒä½¿ã£ã¦ã„ã‚‹ Ruby ã«ãƒªãƒ³ã‚¯ã•れã¦ã„ã‚‹ Tk ライブラリ㌠panedwindow を実装ã—ã¦ã„ãªã„
+å ´åˆã€ã“ã®ãƒ‡ãƒ¢ã¯ã†ã¾ãå‹•ã‹ãªã„ã¯ãšã§ã™ã€‚ãã®å ´åˆã«ã¯ panedwindow ãŒå®Ÿè£…ã•れã¦ã„るよã†ãª
+より新ã—ã„ãƒãƒ¼ã‚¸ãƒ§ãƒ³ã® Tk を組ã¿åˆã‚ã›ã¦è©¦ã™
+よã†ã«ã—ã¦ãã ã•ã„。
EOL
# The bottom buttons
TkFrame.new(base_frame){|f|
pack(:side=>:bottom, :fill=>:x, :pady=>'2m')
- TkButton.new(f, :text=>'ÊĤ¸¤ë', :width=>15, :command=>proc{
+ TkButton.new(f, :text=>'é–‰ã˜ã‚‹', :width=>15, :command=>proc{
$paned1_demo.destroy
$paned1_demo = nil
}).pack(:side=>:left, :expand=>true)
- TkButton.new(f, :text=>'¥³¡¼¥É»²¾È', :width=>15, :command=>proc{
+ TkButton.new(f, :text=>'コードå‚ç…§', :width=>15, :command=>proc{
showCode 'paned1'
}).pack(:side=>:left, :expand=>true)
}
diff --git a/ext/tk/sample/demos-jp/paned2.rb b/ext/tk/sample/demos-jp/paned2.rb
index a1aee81690..65bd41c757 100644
--- a/ext/tk/sample/demos-jp/paned2.rb
+++ b/ext/tk/sample/demos-jp/paned2.rb
@@ -1,4 +1,4 @@
-# -*- coding: euc-jp -*-
+# -*- coding: utf-8 -*-
#
# paned2.rb --
#
@@ -23,30 +23,30 @@ base_frame = TkFrame.new($paned2_demo).pack(:fill=>:both, :expand=>true)
TkLabel.new(base_frame,
:font=>$font, :wraplength=>'4i', :justify=>:left,
:text=><<EOL).pack(:side=>:top)
-²¼¤Î¥¹¥¯¥í¡¼¥ë¥Ð¡¼ÉÕ¤­¤Î¥¦¥£¥¸¥§¥Ã¥È¤¬ÃÖ¤«¤ì¤¿Æó¤Ä¤Î¥¦¥£¥ó¥É¥¦¤Î´Ö¤Î»ÅÀÚ¤êÏȤϡ¢°ì¤Ä¤ÎÎΰè¤ò¤½¤ì¤¾¤ì¤Î¥¦¥£¥ó¥É¥¦¤Î¤¿¤á¤Ëʬ³ä¤¹¤ë¤¿¤á¤Î¤â¤Î¤Ç¤¹¡£º¸¥Ü¥¿¥ó¤Ç»ÅÀÚ¤ê¤òÁàºî¤¹¤ë¤È¡¢Ê¬³ä¥µ¥¤¥ºÊѹ¹¤ÎÁàºîÅÓÃæ¤Ç¤ÏºÆÉ½¼¨¤Ï¤Ê¤µ¤ì¤º¡¢³ÎÄꤵ¤»¤¿¤È¤­¤Ëɽ¼¨¤¬¹¹¿·¤µ¤ì¤Þ¤¹¡£¥Þ¥¦¥¹¤Ë¤è¤ë»ÅÀÚ¤ê¤ÎÁàºî¤ËÄɿ路¤Æ¥µ¥¤¥º¤òÊѹ¹¤·¤¿É½¼¨¤¬¤Ê¤ï¤ì¤ë¤è¤¦¤Ë¤·¤¿¤¤¾ì¹ç¤Ï¡¢¥Þ¥¦¥¹¤ÎÃæ±û¥Ü¥¿¥ó¤ò»È¤Ã¤Æ¤¯¤À¤µ¤¤¡£
-¤â¤·¤¢¤Ê¤¿¤¬»È¤Ã¤Æ¤¤¤ë Ruby ¤Ë¥ê¥ó¥¯¤µ¤ì¤Æ¤¤¤ë Tk ¥é¥¤¥Ö¥é¥ê¤¬ panedwindow ¤ò¼ÂÁõ¤·¤Æ¤¤¤Ê¤¤
-¾ì¹ç¡¢¤³¤Î¥Ç¥â¤Ï¤¦¤Þ¤¯Æ°¤«¤Ê¤¤¤Ï¤º¤Ç¤¹¡£¤½¤Î¾ì¹ç¤Ë¤Ï panedwindow ¤¬¼ÂÁõ¤µ¤ì¤Æ¤¤¤ë¤è¤¦¤Ê
-¤è¤ê¿·¤·¤¤¥Ð¡¼¥¸¥ç¥ó¤Î Tk ¤òÁȤ߹ç¤ï¤»¤Æ»î¤¹
-¤è¤¦¤Ë¤·¤Æ¤¯¤À¤µ¤¤¡£
+下ã®ã‚¹ã‚¯ãƒ­ãƒ¼ãƒ«ãƒãƒ¼ä»˜ãã®ã‚¦ã‚£ã‚¸ã‚§ãƒƒãƒˆãŒç½®ã‹ã‚ŒãŸäºŒã¤ã®ã‚¦ã‚£ãƒ³ãƒ‰ã‚¦ã®é–“ã®ä»•切り枠ã¯ã€ä¸€ã¤ã®é ˜åŸŸã‚’ãれãžã‚Œã®ã‚¦ã‚£ãƒ³ãƒ‰ã‚¦ã®ãŸã‚ã«åˆ†å‰²ã™ã‚‹ãŸã‚ã®ã‚‚ã®ã§ã™ã€‚左ボタンã§ä»•切りをæ“作ã™ã‚‹ã¨ã€åˆ†å‰²ã‚µã‚¤ã‚ºå¤‰æ›´ã®æ“作途中ã§ã¯å†è¡¨ç¤ºã¯ãªã•れãšã€ç¢ºå®šã•ã›ãŸã¨ãã«è¡¨ç¤ºãŒæ›´æ–°ã•れã¾ã™ã€‚マウスã«ã‚ˆã‚‹ä»•åˆ‡ã‚Šã®æ“作ã«è¿½éšã—ã¦ã‚µã‚¤ã‚ºã‚’変更ã—ãŸè¡¨ç¤ºãŒãªã‚れるよã†ã«ã—ãŸã„å ´åˆã¯ã€ãƒžã‚¦ã‚¹ã®ä¸­å¤®ãƒœã‚¿ãƒ³ã‚’使ã£ã¦ãã ã•ã„。
+ã‚‚ã—ã‚ãªãŸãŒä½¿ã£ã¦ã„ã‚‹ Ruby ã«ãƒªãƒ³ã‚¯ã•れã¦ã„ã‚‹ Tk ライブラリ㌠panedwindow を実装ã—ã¦ã„ãªã„
+å ´åˆã€ã“ã®ãƒ‡ãƒ¢ã¯ã†ã¾ãå‹•ã‹ãªã„ã¯ãšã§ã™ã€‚ãã®å ´åˆã«ã¯ panedwindow ãŒå®Ÿè£…ã•れã¦ã„るよã†ãª
+より新ã—ã„ãƒãƒ¼ã‚¸ãƒ§ãƒ³ã® Tk を組ã¿åˆã‚ã›ã¦è©¦ã™
+よã†ã«ã—ã¦ãã ã•ã„。
EOL
# The bottom buttons
TkFrame.new(base_frame){|f|
pack(:side=>:bottom, :fill=>:x, :pady=>'2m')
- TkButton.new(f, :text=>'ÊĤ¸¤ë', :width=>15, :command=>proc{
+ TkButton.new(f, :text=>'é–‰ã˜ã‚‹', :width=>15, :command=>proc{
$paned2_demo.destroy
$paned2_demo = nil
}).pack(:side=>:left, :expand=>true)
- TkButton.new(f, :text=>'¥³¡¼¥É»²¾È', :width=>15, :command=>proc{
+ TkButton.new(f, :text=>'コードå‚ç…§', :width=>15, :command=>proc{
showCode 'paned2'
}).pack(:side=>:left, :expand=>true)
}
paneList = TkVariable.new # define as normal variable (not array)
paneList.value = [ # ruby's array --> tcl's list
- 'Ruby/Tk ¤Î¥¦¥£¥¸¥§¥Ã¥È°ìÍ÷',
+ 'Ruby/Tk ã®ã‚¦ã‚£ã‚¸ã‚§ãƒƒãƒˆä¸€è¦§',
'TkButton',
'TkCanvas',
'TkCheckbutton',
@@ -87,8 +87,8 @@ TkPanedwindow.new(base_frame, :orient=>:vertical){|f|
paned2_xscr = TkScrollbar.new(paned2_bottom)
paned2_yscr = TkScrollbar.new(paned2_bottom)
paned2_text = TkText.new(paned2_bottom, :width=>30, :wrap=>:non) {
- insert('1.0', '¤³¤³¤ËÇÛÃÖ¤µ¤ì¤Æ¤¤¤ë¤Î¤Ï¡¢' +
- '¤´¤¯ÉáÄ̤Υƥ­¥¹¥È¥¦¥£¥¸¥§¥Ã¥È¤Ç¤¹¡£')
+ insert('1.0', 'ã“ã“ã«é…ç½®ã•れã¦ã„ã‚‹ã®ã¯ã€' +
+ 'ã”ãæ™®é€šã®ãƒ†ã‚­ã‚¹ãƒˆã‚¦ã‚£ã‚¸ã‚§ãƒƒãƒˆã§ã™ã€‚')
xscrollbar(paned2_xscr)
yscrollbar(paned2_yscr)
}
diff --git a/ext/tk/sample/demos-jp/pendulum.rb b/ext/tk/sample/demos-jp/pendulum.rb
index 48839aa58a..60556fd70a 100644
--- a/ext/tk/sample/demos-jp/pendulum.rb
+++ b/ext/tk/sample/demos-jp/pendulum.rb
@@ -1,4 +1,4 @@
-# -*- coding: euc-jp -*-
+# -*- coding: utf-8 -*-
#
# This demonstration illustrates how Tcl/Tk can be used to construct
# simulations of physical systems.
@@ -26,15 +26,15 @@ msg = TkLabel.new(base_frame) {
font $font
wraplength '4i'
justify 'left'
- text '¤³¤Î¥Ç¥â¤Ï¡¢ÊªÍý·Ï¤Î¥·¥ß¥å¥ì¡¼¥·¥ç¥ó¤Ë´Ø¤ï¤ë¤è¤¦¤Ê¥¢¥Ë¥á¡¼¥·¥ç¥ó¼Â¹Ô¤¹¤ë¤¿¤á¤Ë Ruby/Tk ¤ò¤É¤Î¤è¤¦¤ËÍѤ¤¤ë¤³¤È¤¬¤Ç¤­¤ë¤«¤ò¼¨¤·¤Æ¤¤¤Þ¤¹¡£º¸Â¦¤Î¥­¥ã¥ó¥Ð¥¹¤Ïñ½ã¤Ê¿¶¤ê»Ò¤Ç¤¢¤ëʪÍý·Ï¼«ÂΤΥ°¥é¥Õ¥£¥«¥ëɽ¸½¤Ç¤¢¤ë¤Î¤ËÂФ·¡¢±¦Â¦¤Î¥­¥ã¥ó¥Ð¥¹¤Ï·Ï¤Î°ÌÁê¶õ´Ö¤Î¥°¥é¥Õ¡Ê³Ñ®Å٤ȳÑÅ٤Ȥò¥×¥í¥Ã¥È¤·¤¿¤â¤Î¡Ë¤Ë¤Ê¤Ã¤Æ¤¤¤Þ¤¹¡£º¸Â¦¤Î¥­¥ã¥ó¥Ð¥¹¾å¤Ç¥¯¥ê¥Ã¥¯¤ª¤è¤Ó¥É¥é¥Ã¥°¤ò¹Ô¤Ã¤Æ¿¶¤ê»Ò¤Î½Å¤ê¤Î°ÌÃÖ¤òÊѤ¨¤Æ¤ß¤Æ¤¯¤À¤µ¤¤¡£'
+ text 'ã“ã®ãƒ‡ãƒ¢ã¯ã€ç‰©ç†ç³»ã®ã‚·ãƒŸãƒ¥ãƒ¬ãƒ¼ã‚·ãƒ§ãƒ³ã«é–¢ã‚るよã†ãªã‚¢ãƒ‹ãƒ¡ãƒ¼ã‚·ãƒ§ãƒ³å®Ÿè¡Œã™ã‚‹ãŸã‚ã« Ruby/Tk ã‚’ã©ã®ã‚ˆã†ã«ç”¨ã„ã‚‹ã“ã¨ãŒã§ãã‚‹ã‹ã‚’示ã—ã¦ã„ã¾ã™ã€‚å·¦å´ã®ã‚­ãƒ£ãƒ³ãƒã‚¹ã¯å˜ç´”ãªæŒ¯ã‚Šå­ã§ã‚る物ç†ç³»è‡ªä½“ã®ã‚°ãƒ©ãƒ•ィカル表ç¾ã§ã‚ã‚‹ã®ã«å¯¾ã—ã€å³å´ã®ã‚­ãƒ£ãƒ³ãƒã‚¹ã¯ç³»ã®ä½ç›¸ç©ºé–“ã®ã‚°ãƒ©ãƒ•(角速度ã¨è§’度ã¨ã‚’プロットã—ãŸã‚‚ã®ï¼‰ã«ãªã£ã¦ã„ã¾ã™ã€‚å·¦å´ã®ã‚­ãƒ£ãƒ³ãƒã‚¹ä¸Šã§ã‚¯ãƒªãƒƒã‚¯ãŠã‚ˆã³ãƒ‰ãƒ©ãƒƒã‚°ã‚’行ã£ã¦æŒ¯ã‚Šå­ã®é‡ã‚Šã®ä½ç½®ã‚’変ãˆã¦ã¿ã¦ãã ã•ã„。'
}
msg.pack('side'=>'top')
# create frame
TkFrame.new(base_frame) {|frame|
TkButton.new(frame) {
- #text 'λ²ò'
- text 'ÊĤ¸¤ë'
+ #text '了解'
+ text 'é–‰ã˜ã‚‹'
command proc{
tmppath = $pendulum_demo
$pendulum_demo = nil
@@ -43,7 +43,7 @@ TkFrame.new(base_frame) {|frame|
}.pack('side'=>'left', 'expand'=>'yes')
TkButton.new(frame) {
- text '¥³¡¼¥É»²¾È'
+ text 'コードå‚ç…§'
command proc{showCode 'pendulum'}
}.pack('side'=>'left', 'expand'=>'yes')
diff --git a/ext/tk/sample/demos-jp/plot.rb b/ext/tk/sample/demos-jp/plot.rb
index a49ed00df8..4147b35399 100644
--- a/ext/tk/sample/demos-jp/plot.rb
+++ b/ext/tk/sample/demos-jp/plot.rb
@@ -1,15 +1,15 @@
-# -*- coding: euc-jp -*-
+# -*- coding: utf-8 -*-
#
# 2-D plot widget demo (called by 'widget')
#
-# toplevel widget ¤¬Â¸ºß¤¹¤ì¤Ðºï½ü¤¹¤ë
+# toplevel widget ãŒå­˜åœ¨ã™ã‚Œã°å‰Šé™¤ã™ã‚‹
if defined?($plot_demo) && $plot_demo
$plot_demo.destroy
$plot_demo = nil
end
-# demo ÍѤΠtoplevel widget ¤òÀ¸À®
+# demo 用㮠toplevel widget を生æˆ
$plot_demo = TkToplevel.new {|w|
title("Plot Demonstration")
iconname("Plot")
@@ -18,17 +18,17 @@ $plot_demo = TkToplevel.new {|w|
base_frame = TkFrame.new($plot_demo).pack(:fill=>:both, :expand=>true)
-# label À¸À®
+# label 生æˆ
TkLabel.new(base_frame, 'font'=>$font, 'wraplength'=>'4i', 'justify'=>'left',
- 'text'=>"¤³¤Î¥¦¥£¥ó¥É¥¦¤Ï´Êñ¤Ê2¼¡¸µ¤Î¥×¥í¥Ã¥È¤ò´Þ¤ó¤À¥­¥ã¥ó¥Ð¥¹ widget¤Ç¤¹¡£É½¼¨¤µ¤ì¤¿ÅÀ¤ò¥Þ¥¦¥¹¥Ü¥¿¥ó1¤Ç¥É¥é¥Ã¥°¤·¤Æ¥Ç¡¼¥¿¤ò¤¤¤¸¤ë¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£"){
+ 'text'=>"ã“ã®ã‚¦ã‚£ãƒ³ãƒ‰ã‚¦ã¯ç°¡å˜ãª2次元ã®ãƒ—ロットをå«ã‚“ã ã‚­ãƒ£ãƒ³ãƒã‚¹ widgetã§ã™ã€‚表示ã•れãŸç‚¹ã‚’マウスボタン1ã§ãƒ‰ãƒ©ãƒƒã‚°ã—ã¦ãƒ‡ãƒ¼ã‚¿ã‚’ã„ã˜ã‚‹ã“ã¨ãŒã§ãã¾ã™ã€‚"){
pack('side'=>'top')
}
-# frame À¸À®
+# frame 生æˆ
$plot_buttons = TkFrame.new(base_frame) {|frame|
TkButton.new(frame) {
- #text 'λ²ò'
- text 'ÊĤ¸¤ë'
+ #text '了解'
+ text 'é–‰ã˜ã‚‹'
command proc{
tmppath = $plot_demo
$plot_demo = nil
@@ -37,28 +37,28 @@ $plot_buttons = TkFrame.new(base_frame) {|frame|
}.pack('side'=>'left', 'expand'=>'yes')
TkButton.new(frame) {
- text '¥³¡¼¥É»²¾È'
+ text 'コードå‚ç…§'
command proc{showCode 'plot'}
}.pack('side'=>'left', 'expand'=>'yes')
}
$plot_buttons.pack('side'=>'bottom', 'fill'=>'x', 'pady'=>'2m')
-# font ÀßÄê
+# font 設定
if $tk_version =~ /^4.*/
plotFont = '-*-Helvetica-Medium-R-Normal--*-180-*-*-*-*-*-*'
else
font = 'Helvetica 18'
end
-# canvas ÀßÄê
+# canvas 設定
$plot_canvas = TkCanvas.new(base_frame,'relief'=>'raised','width'=>450,'height'=>300)
$plot_canvas.pack('side'=>'top', 'fill'=>'x')
-# plot À¸À®
+# plot 生æˆ
TkcLine.new($plot_canvas, 100, 250, 400, 250, 'width'=>2)
TkcLine.new($plot_canvas, 100, 250, 100, 50, 'width'=>2)
TkcText.new($plot_canvas, 225, 20,
- 'text'=>"´Êñ¤Ê¥×¥í¥Ã¥È", 'font'=>plotFont, 'fill'=>'brown')
+ 'text'=>"ç°¡å˜ãªãƒ—ロット", 'font'=>plotFont, 'fill'=>'brown')
(0..10).each {|i|
x = 100 + (i * 30)
diff --git a/ext/tk/sample/demos-jp/puzzle.rb b/ext/tk/sample/demos-jp/puzzle.rb
index 16d7ce497c..dbcb423463 100644
--- a/ext/tk/sample/demos-jp/puzzle.rb
+++ b/ext/tk/sample/demos-jp/puzzle.rb
@@ -1,15 +1,15 @@
-# -*- coding: euc-jp -*-
+# -*- coding: utf-8 -*-
#
# widet demo 'puzzle' (called by 'widget')
#
-# toplevel widget ¤¬Â¸ºß¤¹¤ì¤Ðºï½ü¤¹¤ë
+# toplevel widget ãŒå­˜åœ¨ã™ã‚Œã°å‰Šé™¤ã™ã‚‹
if defined?($puzzle_demo) && $puzzle_demo
$puzzle_demo.destroy
$puzzle_demo = nil
end
-# demo ÍѤΠtoplevel widget ¤òÀ¸À®
+# demo 用㮠toplevel widget を生æˆ
$puzzle_demo = TkToplevel.new {|w|
title("15-Puzzle Demonstration")
iconname("15-Puzzle")
@@ -18,20 +18,20 @@ $puzzle_demo = TkToplevel.new {|w|
base_frame = TkFrame.new($puzzle_demo).pack(:fill=>:both, :expand=>true)
-# label À¸À®
+# label 生æˆ
msg = TkLabel.new(base_frame) {
font $font
wraplength '4i'
justify 'left'
- text "²¼¤Î15-¥Ñ¥º¥ë¤Ï¥Ü¥¿¥ó¤ò½¸¤á¤Æ¤Ç¤­¤Æ¤¤¤Þ¤¹¡£¶õ¤¤¤Æ¤¤¤ë½ê¤ÎÎ٤Υԡ¼¥¹¤ò¥¯¥ê¥Ã¥¯¤¹¤ë¤È¡¢¤½¤Î¥Ô¡¼¥¹¤¬¤½¤Î¶õ¤¤¤Æ¤¤¤ë¾ì½ê¤Ë¥¹¥é¥¤¥É¤·¤Þ¤¹¡£¤³¤ÎÁàºî¤ò³¤±¡¢¥Ô¡¼¥¹¤¬¤½¤Î¿ô¤Î½ç¤Ë¾å¤«¤é²¼¡¢º¸¤«¤é±¦¤Ëʤ֤褦¤Ë¤·¤Æ¤¯¤À¤µ¤¤¡£"
+ text "下ã®15-パズルã¯ãƒœã‚¿ãƒ³ã‚’集ã‚ã¦ã§ãã¦ã„ã¾ã™ã€‚空ã„ã¦ã„る所ã®éš£ã®ãƒ”ースをクリックã™ã‚‹ã¨ã€ãã®ãƒ”ースãŒãã®ç©ºã„ã¦ã„る場所ã«ã‚¹ãƒ©ã‚¤ãƒ‰ã—ã¾ã™ã€‚ã“ã®æ“作を続ã‘ã€ãƒ”ースãŒãã®æ•°ã®é †ã«ä¸Šã‹ã‚‰ä¸‹ã€å·¦ã‹ã‚‰å³ã«ä¸¦ã¶ã‚ˆã†ã«ã—ã¦ãã ã•ã„。"
}
msg.pack('side'=>'top')
-# frame À¸À®
+# frame 生æˆ
TkFrame.new(base_frame) {|frame|
TkButton.new(frame) {
- #text 'λ²ò'
- text 'ÊĤ¸¤ë'
+ #text '了解'
+ text 'é–‰ã˜ã‚‹'
command proc{
tmppath = $puzzle_demo
$puzzle_demo = nil
@@ -40,16 +40,16 @@ TkFrame.new(base_frame) {|frame|
}.pack('side'=>'left', 'expand'=>'yes')
TkButton.new(frame) {
- text '¥³¡¼¥É»²¾È'
+ text 'コードå‚ç…§'
command proc{showCode 'puzzle'}
}.pack('side'=>'left', 'expand'=>'yes')
}.pack('side'=>'bottom', 'fill'=>'x', 'pady'=>'2m')
-# frame À¸À®
+# frame 生æˆ
#
-# Special trick: scrollbar widget ¤òÀ¸À®¤·¤Æ¤½¤Î trough color ¤òÍѤ¤¤ë¤³¤È¤Ç
-# ¶õÇòÉôʬ¤Î¤¿¤á¤Î°Å¿§¤òÁªÂò¤·¡¤ÀßÄꤹ¤ë
+# Special trick: scrollbar widget を生æˆã—ã¦ãã® trough color を用ã„ã‚‹ã“ã¨ã§
+# 空白部分ã®ãŸã‚ã®æš—è‰²ã‚’é¸æŠžã—,設定ã™ã‚‹
#
begin
if Tk.windowingsystem() == 'aqua'
@@ -81,9 +81,9 @@ base = TkFrame.new(base_frame) {
s.destroy
base.pack('side'=>'top', 'padx'=>'1c', 'pady'=>'1c')
-# proc ¤Î¥¹¥³¡¼¥×¤òÊĤ¸¤ë¤¿¤á¡¤proc À¸À®¥á¥½¥Ã¥É¤òÍѰÕ
-# ¤³¤¦¤·¤Æ¤ª¤«¤Í¤Ð¡¤¥ë¡¼¥×Ãæ¤ÇÃͤ¬ÊѲ½¤¹¤ë num ¤Î±Æ¶Á¤ò¼õ¤±¤Æ
-# puzzleSwitch ¤ÎÂè 2 °ú¿ô¤¬ÊѲ½¤·¤Æ¤·¤Þ¤¤¡¤´üÂÔÄ̤ê¤Ë¤Ï¤Ê¤é¤Ê¤¤¡¥
+# proc ã®ã‚¹ã‚³ãƒ¼ãƒ—ã‚’é–‰ã˜ã‚‹ãŸã‚,proc 生æˆãƒ¡ã‚½ãƒƒãƒ‰ã‚’用æ„
+# ã“ã†ã—ã¦ãŠã‹ã­ã°ï¼Œãƒ«ãƒ¼ãƒ—中ã§å€¤ãŒå¤‰åŒ–ã™ã‚‹ num ã®å½±éŸ¿ã‚’å—ã‘ã¦
+# puzzleSwitch ã®ç¬¬ 2 引数ãŒå¤‰åŒ–ã—ã¦ã—ã¾ã„,期待通りã«ã¯ãªã‚‰ãªã„.
def def_puzzleswitch_proc(w, num)
proc{puzzleSwitch w, num}
end
diff --git a/ext/tk/sample/demos-jp/radio.rb b/ext/tk/sample/demos-jp/radio.rb
index 3355f25116..efb613593d 100644
--- a/ext/tk/sample/demos-jp/radio.rb
+++ b/ext/tk/sample/demos-jp/radio.rb
@@ -1,15 +1,15 @@
-# -*- coding: euc-jp -*-
+# -*- coding: utf-8 -*-
#
# radiobutton widget demo (called by 'widget')
#
-# toplevel widget ¤¬Â¸ºß¤¹¤ì¤Ðºï½ü¤¹¤ë
+# toplevel widget ãŒå­˜åœ¨ã™ã‚Œã°å‰Šé™¤ã™ã‚‹
if defined?($radio_demo) && $radio_demo
$radio_demo.destroy
$radio_demo = nil
end
-# demo ÍѤΠtoplevel widget ¤òÀ¸À®
+# demo 用㮠toplevel widget を生æˆ
$radio_demo = TkToplevel.new {|w|
title("Radiobutton Demonstration")
iconname("radio")
@@ -18,24 +18,24 @@ $radio_demo = TkToplevel.new {|w|
base_frame = TkFrame.new($radio_demo).pack(:fill=>:both, :expand=>true)
-# label À¸À®
+# label 生æˆ
msg = TkLabel.new(base_frame) {
font $font
wraplength '4i'
justify 'left'
- text "²¼¤Ë¤Ï2¤Ä¤Î¥é¥¸¥ª¥Ü¥¿¥ó¥°¥ë¡¼¥×¤¬É½¼¨¤µ¤ì¤Æ¤¤¤Þ¤¹¡£¥Ü¥¿¥ó¤ò¥¯¥ê¥Ã¥¯¤¹¤ë¤È¡¢¤½¤Î¥Ü¥¿¥ó¤À¤±¤¬¤½¤Î¥°¥ë¡¼¥×¤ÎÃæ¤ÇÁªÂò¤µ¤ì¤Þ¤¹¡£³Æ¥°¥ë¡¼¥×¤ËÂФ·¤Æ¤½¤Î¥°¥ë¡¼¥×¤ÎÃæ¤Î¤É¤Î¥Ü¥¿¥ó¤¬ÁªÂò¤µ¤ì¤Æ¤¤¤ë¤«¤ò¼¨¤¹ÊÑ¿ô¤¬³ä¤êÅö¤Æ¤é¤ì¤Æ¤¤¤Þ¤¹¡£¸½ºß¤ÎÊÑ¿ô¤ÎÃͤò¸«¤ë¤Ë¤Ï¡ÖÊÑ¿ô»²¾È¡×¥Ü¥¿¥ó¤ò¥¯¥ê¥Ã¥¯¤·¤Æ¤¯¤À¤µ¤¤¡£"
+ text "下ã«ã¯2ã¤ã®ãƒ©ã‚¸ã‚ªãƒœã‚¿ãƒ³ã‚°ãƒ«ãƒ¼ãƒ—ãŒè¡¨ç¤ºã•れã¦ã„ã¾ã™ã€‚ボタンをクリックã™ã‚‹ã¨ã€ãã®ãƒœã‚¿ãƒ³ã ã‘ãŒãã®ã‚°ãƒ«ãƒ¼ãƒ—ã®ä¸­ã§é¸æŠžã•れã¾ã™ã€‚å„グループã«å¯¾ã—ã¦ãã®ã‚°ãƒ«ãƒ¼ãƒ—ã®ä¸­ã®ã©ã®ãƒœã‚¿ãƒ³ãŒé¸æŠžã•れã¦ã„ã‚‹ã‹ã‚’示ã™å¤‰æ•°ãŒå‰²ã‚Šå½“ã¦ã‚‰ã‚Œã¦ã„ã¾ã™ã€‚ç¾åœ¨ã®å¤‰æ•°ã®å€¤ã‚’見るã«ã¯ã€Œå¤‰æ•°å‚ç…§ã€ãƒœã‚¿ãƒ³ã‚’クリックã—ã¦ãã ã•ã„。"
}
msg.pack('side'=>'top')
-# ÊÑ¿ôÀ¸À®
+# 変数生æˆ
size = TkVariable.new
color = TkVariable.new
-# frame À¸À®
+# frame 生æˆ
TkFrame.new(base_frame) {|frame|
TkButton.new(frame) {
- #text 'λ²ò'
- text 'ÊĤ¸¤ë'
+ #text '了解'
+ text 'é–‰ã˜ã‚‹'
command proc{
tmppath = $radio_demo
$radio_demo = nil
@@ -45,35 +45,35 @@ TkFrame.new(base_frame) {|frame|
}.pack('side'=>'left', 'expand'=>'yes')
TkButton.new(frame) {
- text '¥³¡¼¥É»²¾È'
+ text 'コードå‚ç…§'
command proc{showCode 'radio'}
}.pack('side'=>'left', 'expand'=>'yes')
TkButton.new(frame) {
- text 'ÊÑ¿ô»²¾È'
+ text '変数å‚ç…§'
command proc{
showVars(base_frame, ['size', size], ['color', color])
}
}.pack('side'=>'left', 'expand'=>'yes')
}.pack('side'=>'bottom', 'fill'=>'x', 'pady'=>'2m')
-# frame À¸À®
+# frame 生æˆ
f_left = TkFrame.new(base_frame)
f_right = TkFrame.new(base_frame)
f_left.pack('side'=>'left', 'expand'=>'yes', 'padx'=>'.5c', 'pady'=>'.5c')
f_right.pack('side'=>'left', 'expand'=>'yes', 'padx'=>'.5c', 'pady'=>'.5c')
-# radiobutton À¸À®
+# radiobutton 生æˆ
[10, 12, 18, 24].each {|sz|
TkRadioButton.new(f_left) {
- text "¥Ý¥¤¥ó¥È¥µ¥¤¥º #{sz}"
+ text "ãƒã‚¤ãƒ³ãƒˆã‚µã‚¤ã‚º #{sz}"
variable size
relief 'flat'
value sz
}.pack('side'=>'top', 'pady'=>2, 'anchor'=>'w')
}
-['ÀÖ', 'ÎÐ', 'ÀÄ', '²«', 'Üô', '»ç'].each {|col|
+['赤', 'ç·‘', 'é’', '黄', 'æ©™', 'ç´«'].each {|col|
TkRadioButton.new(f_right) {
text col
variable color
diff --git a/ext/tk/sample/demos-jp/radio2.rb b/ext/tk/sample/demos-jp/radio2.rb
index 91496beb6d..0633a8def1 100644
--- a/ext/tk/sample/demos-jp/radio2.rb
+++ b/ext/tk/sample/demos-jp/radio2.rb
@@ -1,4 +1,4 @@
-# -*- coding: euc-jp -*-
+# -*- coding: utf-8 -*-
#
# radio2.rb
#
@@ -28,7 +28,7 @@ msg = TkLabel.new(base_frame) {
font $font
wraplength '5i'
justify 'left'
- text "²¼¤Ë¤Ï3¤Ä¤Î¥é¥¸¥ª¥Ü¥¿¥ó¥°¥ë¡¼¥×¤¬É½¼¨¤µ¤ì¤Æ¤¤¤Þ¤¹¡£¥Ü¥¿¥ó¤ò¥¯¥ê¥Ã¥¯¤¹¤ë¤È¡¢¤½¤Î¥Ü¥¿¥ó¤À¤±¤¬¤½¤Î¥°¥ë¡¼¥×¤ÎÃæ¤ÇÁªÂò¤µ¤ì¤Þ¤¹¡£³Æ¥°¥ë¡¼¥×¤ËÂФ·¤Æ¤½¤Î¥°¥ë¡¼¥×¤ÎÃæ¤Î¤É¤Î¥Ü¥¿¥ó¤¬ÁªÂò¤µ¤ì¤Æ¤¤¤ë¤«¤ò¼¨¤¹ÊÑ¿ô¤¬³ä¤êÅö¤Æ¤é¤ì¤Æ¤¤¤Þ¤¹¡£¸½ºß¤ÎÊÑ¿ô¤ÎÃͤò¸«¤ë¤Ë¤Ï¡ÖÊÑ¿ô»²¾È¡×¥Ü¥¿¥ó¤ò¥¯¥ê¥Ã¥¯¤·¤Æ¤¯¤À¤µ¤¤¡£"
+ text "下ã«ã¯3ã¤ã®ãƒ©ã‚¸ã‚ªãƒœã‚¿ãƒ³ã‚°ãƒ«ãƒ¼ãƒ—ãŒè¡¨ç¤ºã•れã¦ã„ã¾ã™ã€‚ボタンをクリックã™ã‚‹ã¨ã€ãã®ãƒœã‚¿ãƒ³ã ã‘ãŒãã®ã‚°ãƒ«ãƒ¼ãƒ—ã®ä¸­ã§é¸æŠžã•れã¾ã™ã€‚å„グループã«å¯¾ã—ã¦ãã®ã‚°ãƒ«ãƒ¼ãƒ—ã®ä¸­ã®ã©ã®ãƒœã‚¿ãƒ³ãŒé¸æŠžã•れã¦ã„ã‚‹ã‹ã‚’示ã™å¤‰æ•°ãŒå‰²ã‚Šå½“ã¦ã‚‰ã‚Œã¦ã„ã¾ã™ã€‚ç¾åœ¨ã®å¤‰æ•°ã®å€¤ã‚’見るã«ã¯ã€Œå¤‰æ•°å‚ç…§ã€ãƒœã‚¿ãƒ³ã‚’クリックã—ã¦ãã ã•ã„。"
}
msg.pack('side'=>'top')
@@ -40,8 +40,8 @@ align = TkVariable.new
# frame
TkFrame.new(base_frame) {|frame|
TkButton.new(frame) {
- #text 'λ²ò'
- text 'ÊĤ¸¤ë'
+ #text '了解'
+ text 'é–‰ã˜ã‚‹'
command proc{
tmppath = $radio2_demo
$radio2_demo = nil
@@ -51,12 +51,12 @@ TkFrame.new(base_frame) {|frame|
}.pack('side'=>'left', 'expand'=>'yes')
TkButton.new(frame) {
- text '¥³¡¼¥É»²¾È'
+ text 'コードå‚ç…§'
command proc{showCode 'radio2'}
}.pack('side'=>'left', 'expand'=>'yes')
TkButton.new(frame) {
- text 'ÊÑ¿ô»²¾È'
+ text '変数å‚ç…§'
command proc{
showVars(base_frame,
['size', size], ['color', color], ['compound', align])
@@ -65,11 +65,11 @@ TkFrame.new(base_frame) {|frame|
}.pack('side'=>'bottom', 'fill'=>'x', 'pady'=>'2m')
# frame
-f_left = TkLabelFrame.new(base_frame, 'text'=>'ʸ»ú¥µ¥¤¥º',
+f_left = TkLabelFrame.new(base_frame, 'text'=>'文字サイズ',
'pady'=>2, 'padx'=>2)
-f_mid = TkLabelFrame.new(base_frame, 'text'=>'¿§',
+f_mid = TkLabelFrame.new(base_frame, 'text'=>'色',
'pady'=>2, 'padx'=>2)
-f_right = TkLabelFrame.new(base_frame, 'text'=>'¥Ó¥Ã¥È¥Þ¥Ã¥×ÇÛÃÖ',
+f_right = TkLabelFrame.new(base_frame, 'text'=>'ビットマップé…ç½®',
'pady'=>2, 'padx'=>2)
f_left.pack('side'=>'left', 'expand'=>'yes', 'padx'=>'.5c', 'pady'=>'.5c')
f_mid.pack('side'=>'left', 'expand'=>'yes', 'padx'=>'.5c', 'pady'=>'.5c')
@@ -78,14 +78,14 @@ f_right.pack('side'=>'left', 'expand'=>'yes', 'padx'=>'.5c', 'pady'=>'.5c')
# radiobutton
[10, 12, 18, 24].each {|sz|
TkRadioButton.new(f_left) {
- text "¥Ý¥¤¥ó¥È¥µ¥¤¥º #{sz}"
+ text "ãƒã‚¤ãƒ³ãƒˆã‚µã‚¤ã‚º #{sz}"
variable size
relief 'flat'
value sz
}.pack('side'=>'top', 'pady'=>2, 'anchor'=>'w', 'fill'=>'x')
}
-['ÀÖ', 'ÎÐ', 'ÀÄ', '²«', 'Üô', '»ç'].each {|col|
+['赤', 'ç·‘', 'é’', '黄', 'æ©™', 'ç´«'].each {|col|
TkRadioButton.new(f_mid) {
text col
variable color
@@ -95,8 +95,8 @@ f_right.pack('side'=>'left', 'expand'=>'yes', 'padx'=>'.5c', 'pady'=>'.5c')
}.pack('side'=>'top', 'pady'=>2, 'fill'=>'x')
}
-# label = TkLabel.new(f_right, 'text'=>'¥é¥Ù¥ë', 'bitmap'=>'questhead',
-label = Tk::Label.new(f_right, 'text'=>'¥é¥Ù¥ë', 'bitmap'=>'questhead',
+# label = TkLabel.new(f_right, 'text'=>'ラベル', 'bitmap'=>'questhead',
+label = Tk::Label.new(f_right, 'text'=>'ラベル', 'bitmap'=>'questhead',
'compound'=>'left')
label.configure('width'=>TkWinfo.reqwidth(label), 'compound'=>'top')
label.height(TkWinfo.reqheight(label))
diff --git a/ext/tk/sample/demos-jp/radio3.rb b/ext/tk/sample/demos-jp/radio3.rb
index 763c522448..3356b6945b 100644
--- a/ext/tk/sample/demos-jp/radio3.rb
+++ b/ext/tk/sample/demos-jp/radio3.rb
@@ -1,4 +1,4 @@
-# -*- coding: euc-jp -*-
+# -*- coding: utf-8 -*-
#
# radio3.rb
#
@@ -28,7 +28,7 @@ msg = TkLabel.new(base_frame) {
font $font
wraplength '5i'
justify 'left'
- text '²¼¤Ë¤Ï3¤Ä¤Î¥é¥¸¥ª¥Ü¥¿¥ó¥°¥ë¡¼¥×¤¬É½¼¨¤µ¤ì¤Æ¤¤¤Þ¤¹¡£¥Ü¥¿¥ó¤ò¥¯¥ê¥Ã¥¯¤¹¤ë¤È¡¢¤½¤Î¥°¥ë¡¼¥×¤Ë°¤¹¤ë¤¹¤Ù¤Æ¤Î¥Ü¥¿¥ó¤ÎÃæ¤Ç¥¯¥ê¥Ã¥¯¤·¤¿¥Ü¥¿¥ó¤À¤±¤¬ÁªÂò¤µ¤ì¤¿¾õÂ֤ˤʤê¤Þ¤¹¡£³Æ¥°¥ë¡¼¥×¤Ë¤Ï¡¢¤½¤Î¥°¥ë¡¼¥×¤ÎÃæ¤Î¤É¤Î¥Ü¥¿¥ó¤¬ÁªÂò¤µ¤ì¤Æ¤¤¤ë¤«¤ò¼¨¤¹ÊÑ¿ô¤¬³ä¤êÅö¤Æ¤é¤ì¤Æ¤¤¤Þ¤¹¡£¡Ö¥È¥é¥¤¥¹¥Æ¡¼¥È¡×¥Ü¥¿¥ó¤¬²¡¤µ¤ì¤¿¤È¤­¤Ë¤Ï¡¢¥é¥¸¥ª¥Ü¥¿¥ó¤Îɽ¼¨¤¬¥È¥é¥¤¥¹¥Æ¡¼¥È¥â¡¼¥É¤Ë¤Ê¤ê¤Þ¤¹¡£¤¤¤º¤ì¤«¤Î¥Ü¥¿¥ó¤òÁªÂò¤¹¤ì¤Ð¡¢¥Ü¥¿¥ó¤Î¾õÂ֤ϸµ¤Î¤è¤¦¤Ë¸Ä¡¹¤Î¥Ü¥¿¥ó¤Îon/off¾õÂÖ¤ò¼¨¤¹¤è¤¦¤Ë¤Ê¤ê¤Þ¤¹¡£¸½ºß¤ÎÊÑ¿ô¤ÎÃͤò¸«¤ë¤Ë¤Ï¡ÖÊÑ¿ô»²¾È¡×¥Ü¥¿¥ó¤ò¥¯¥ê¥Ã¥¯¤·¤Æ¤¯¤À¤µ¤¤¡£'
+ text '下ã«ã¯3ã¤ã®ãƒ©ã‚¸ã‚ªãƒœã‚¿ãƒ³ã‚°ãƒ«ãƒ¼ãƒ—ãŒè¡¨ç¤ºã•れã¦ã„ã¾ã™ã€‚ボタンをクリックã™ã‚‹ã¨ã€ãã®ã‚°ãƒ«ãƒ¼ãƒ—ã«å±žã™ã‚‹ã™ã¹ã¦ã®ãƒœã‚¿ãƒ³ã®ä¸­ã§ã‚¯ãƒªãƒƒã‚¯ã—ãŸãƒœã‚¿ãƒ³ã ã‘ãŒé¸æŠžã•れãŸçŠ¶æ…‹ã«ãªã‚Šã¾ã™ã€‚å„グループã«ã¯ã€ãã®ã‚°ãƒ«ãƒ¼ãƒ—ã®ä¸­ã®ã©ã®ãƒœã‚¿ãƒ³ãŒé¸æŠžã•れã¦ã„ã‚‹ã‹ã‚’示ã™å¤‰æ•°ãŒå‰²ã‚Šå½“ã¦ã‚‰ã‚Œã¦ã„ã¾ã™ã€‚「トライステートã€ãƒœã‚¿ãƒ³ãŒæŠ¼ã•れãŸã¨ãã«ã¯ã€ãƒ©ã‚¸ã‚ªãƒœã‚¿ãƒ³ã®è¡¨ç¤ºãŒãƒˆãƒ©ã‚¤ã‚¹ãƒ†ãƒ¼ãƒˆãƒ¢ãƒ¼ãƒ‰ã«ãªã‚Šã¾ã™ã€‚ã„ãšã‚Œã‹ã®ãƒœã‚¿ãƒ³ã‚’é¸æŠžã™ã‚Œã°ã€ãƒœã‚¿ãƒ³ã®çŠ¶æ…‹ã¯å…ƒã®ã‚ˆã†ã«å€‹ã€…ã®ãƒœã‚¿ãƒ³ã®on/off状態を示ã™ã‚ˆã†ã«ãªã‚Šã¾ã™ã€‚ç¾åœ¨ã®å¤‰æ•°ã®å€¤ã‚’見るã«ã¯ã€Œå¤‰æ•°å‚ç…§ã€ãƒœã‚¿ãƒ³ã‚’クリックã—ã¦ãã ã•ã„。'
}
msg.grid(:row=>0, :column=>0, :columnspan=>3, :sticky=>'nsew')
@@ -42,16 +42,16 @@ TkFrame.new(base_frame) {|frame|
TkGrid(TkFrame.new(frame, :height=>2, :relief=>:sunken, :bd=>2),
:columnspan=>4, :row=>0, :sticky=>'ew', :pady=>2)
TkGrid('x',
- TkButton.new(frame, :text=>'ÊÑ¿ô»²¾È',
+ TkButton.new(frame, :text=>'変数å‚ç…§',
:image=>$image['view'], :compound=>:left,
:command=>proc{
showVars(base_frame, ['size', size],
['color', color], ['compound', align])
}),
- TkButton.new(frame, :text=>'¥³¡¼¥É»²¾È',
+ TkButton.new(frame, :text=>'コードå‚ç…§',
:image=>$image['view'], :compound=>:left,
:command=>proc{showCode 'radio3'}),
- TkButton.new(frame, :text=>'ÊĤ¸¤ë',
+ TkButton.new(frame, :text=>'é–‰ã˜ã‚‹',
:image=>$image['delete'], :compound=>:left,
:command=>proc{
tmppath = $radio3_demo
@@ -65,17 +65,17 @@ TkFrame.new(base_frame) {|frame|
}
# frame
-f_left = TkLabelFrame.new(base_frame, 'text'=>'ʸ»ú¥µ¥¤¥º',
+f_left = TkLabelFrame.new(base_frame, 'text'=>'文字サイズ',
'pady'=>2, 'padx'=>2)
-f_mid = TkLabelFrame.new(base_frame, 'text'=>'¿§',
+f_mid = TkLabelFrame.new(base_frame, 'text'=>'色',
'pady'=>2, 'padx'=>2)
-f_right = TkLabelFrame.new(base_frame, 'text'=>'¥Ó¥Ã¥È¥Þ¥Ã¥×ÇÛÃÖ',
+f_right = TkLabelFrame.new(base_frame, 'text'=>'ビットマップé…ç½®',
'pady'=>2, 'padx'=>2)
f_left .grid('column'=>0, 'row'=>1, 'pady'=>'.5c', 'padx'=>'.5c', 'rowspan'=>2)
f_mid .grid('column'=>1, 'row'=>1, 'pady'=>'.5c', 'padx'=>'.5c', 'rowspan'=>2)
f_right.grid('column'=>2, 'row'=>1, 'pady'=>'.5c', 'padx'=>'.5c')
-TkButton.new(base_frame, 'text'=>'¥È¥é¥¤¥¹¥Æ¡¼¥È',
+TkButton.new(base_frame, 'text'=>'トライステート',
'command'=>proc{size.value = 'multi'; color.value = 'multi'}){
grid('column'=>2, 'row'=>2, 'pady'=>'.5c', 'padx'=>'.5c')
}
@@ -83,7 +83,7 @@ TkButton.new(base_frame, 'text'=>'¥È¥é¥¤¥¹¥Æ¡¼¥È',
# radiobutton
[10, 12, 14, 18, 24].each {|sz|
TkRadioButton.new(f_left) {
- text "¥Ý¥¤¥ó¥È¥µ¥¤¥º #{sz}"
+ text "ãƒã‚¤ãƒ³ãƒˆã‚µã‚¤ã‚º #{sz}"
variable size
relief 'flat'
value sz
@@ -103,8 +103,8 @@ TkButton.new(base_frame, 'text'=>'¥È¥é¥¤¥¹¥Æ¡¼¥È',
}.pack('side'=>'top', 'pady'=>2, 'fill'=>'x')
}
-# label = TkLabel.new(f_right, 'text'=>'¥é¥Ù¥ë', 'bitmap'=>'questhead',
-label = Tk::Label.new(f_right, 'text'=>'¥é¥Ù¥ë', 'bitmap'=>'questhead',
+# label = TkLabel.new(f_right, 'text'=>'ラベル', 'bitmap'=>'questhead',
+label = Tk::Label.new(f_right, 'text'=>'ラベル', 'bitmap'=>'questhead',
'compound'=>'left')
label.configure('width'=>TkWinfo.reqwidth(label), 'compound'=>'top')
label.height(TkWinfo.reqheight(label))
diff --git a/ext/tk/sample/demos-jp/rolodex-j b/ext/tk/sample/demos-jp/rolodex-j
index ee8dd110bc..f6e3afdacd 100644
--- a/ext/tk/sample/demos-jp/rolodex-j
+++ b/ext/tk/sample/demos-jp/rolodex-j
@@ -1,15 +1,15 @@
#!/usr/bin/env ruby
-# -*- coding: euc-jp -*-
+# -*- coding: utf-8 -*-
#
# rolodex --
-# ¤³¤Î¥¹¥¯¥ê¥×¥È¤Ï Tom LaStrange ¤Î rolodex ¤Î°ìÉô¤Ç¤¹¡£
+# ã“ã®ã‚¹ã‚¯ãƒªãƒ—ト㯠Tom LaStrange ã® rolodex ã®ä¸€éƒ¨ã§ã™ã€‚
#
# Copyright (C) 1998 by Takaaki Tateishi <ttate@jaist.ac.jp>
# Time-stamp: "04/04/09 00:32:12 nagai"
#
require "tk"
-Tk.encoding = "euc-jp"
+Tk.encoding = "utf-8"
def show_help(topic,x=0,y=0)
if( topic.is_a?(TkWindow) )
@@ -24,20 +24,20 @@ def show_help(topic,x=0,y=0)
if( $helpTopics.include?(topic) )
msg = $helpTopics[topic]
else
- msg = "¤³¤Î¥È¥Ô¥Ã¥¯¤Ë¤Ä¤¤¤Æ¤Î¥Ø¥ë¥×¤Ï¤Þ¤À»ÈÍѤǤ­¤Þ¤»¤ó"
+ msg = "ã“ã®ãƒˆãƒ”ックã«ã¤ã„ã¦ã®ãƒ˜ãƒ«ãƒ—ã¯ã¾ã ä½¿ç”¨ã§ãã¾ã›ã‚“"
end
TkDialog.new("title"=>"Rolodex Help",
- "message"=>"¡Ö#{topic}¡×\n\n#{msg}",
+ "message"=>"「#{topic}ã€\n\n#{msg}",
"default_button"=>0,
"buttons"=>["OK"])
end
def fillCard
clearAction
- $root.frame.entry[1].insert(0, "ΩÀÐ ¹§¾´")
- $root.frame.entry[2].insert(0, "923-1292 ÀÐÀ")
- $root.frame.entry[3].insert(0, "ä¸ýÄ® °°Âæ 1-1")
- $root.frame.entry[4].insert(0, "ËÌΦÀèü²Ê³Øµ»½ÑÂç³Ø±¡Âç³Ø")
+ $root.frame.entry[1].insert(0, "立石 å­å½°")
+ $root.frame.entry[2].insert(0, "923-1292 石å·çœŒ")
+ $root.frame.entry[3].insert(0, "è¾°å£ç”º æ—­å° 1-1")
+ $root.frame.entry[4].insert(0, "北陸先端科学技術大学院大学")
$root.frame.entry[5].insert(0,"private")
$root.frame.entry[6].insert(0,"***-***-****")
$root.frame.entry[7].insert(0,"***-***-****")
@@ -59,7 +59,7 @@ end
def fileAction
TkDialog.new("title"=>"File Selection",
- "message"=>"¤³¤ì¤Ï¥Õ¥¡¥¤¥ëÁªÂò¥À¥¤¥¢¥í¥°¤Î¥À¥ß¡¼¤Ç¤¹¡£\n",
+ "message"=>"ã“れã¯ãƒ•ã‚¡ã‚¤ãƒ«é¸æŠžãƒ€ã‚¤ã‚¢ãƒ­ã‚°ã®ãƒ€ãƒŸãƒ¼ã§ã™ã€‚\n",
"default_button"=>0,
"buttons"=>["OK"])
STDERR.print "dummy file name\n"
@@ -67,9 +67,9 @@ end
def deleteAction
result = TkDialog.new("title"=>"Confirm Action",
- "message"=>"¤è¤í¤·¤¤¤Ç¤¹¤«¡©",
+ "message"=>"よã‚ã—ã„ã§ã™ã‹ï¼Ÿ",
"default_button"=>0,
- "buttons"=>["¥­¥ã¥ó¥»¥ë"])
+ "buttons"=>["キャンセル"])
if( result.value == 0 )
clearAction
end
@@ -79,7 +79,7 @@ end
class RolodexFrame < TkFrame
attr_reader :entry, :label
- LABEL = ["","̾Á°:","½»½ê","","","ÅÅÏÃ(¼«Âð):","ÅÅÏÃ(²ñ¼Ò):","Fax:"]
+ LABEL = ["","åå‰:","使‰€","","","電話(自宅):","電話(会社):","Fax:"]
def initialize(parent=nil,keys=nil)
super(parent,keys)
@@ -109,10 +109,10 @@ class RolodexButtons < TkFrame
def initialize(parent,keys=nil)
super(parent,keys)
- @clear = TkButton.new(self,"text" => "¥¯¥ê¥¢¡¼")
- @add = TkButton.new(self, "text" => "ÄɲÃ")
- @search = TkButton.new(self, "text" => "¸¡º÷")
- @delete = TkButton.new(self, "text" => "¾Ãµî")
+ @clear = TkButton.new(self,"text" => "クリアー")
+ @add = TkButton.new(self, "text" => "追加")
+ @search = TkButton.new(self, "text" => "検索")
+ @delete = TkButton.new(self, "text" => "消去")
for w in [@clear,@add,@search,@delete]
w.pack("side"=>"left", "padx"=>2)
end
@@ -128,43 +128,43 @@ class RolodexMenuFrame < TkFrame
"borderwidth"=>1)
@file = TkMenubutton.new(self,
- "text"=> "¥Õ¥¡¥¤¥ë",
+ "text"=> "ファイル",
"underline"=>0)
@file_menu = TkMenu.new(@file)
@file_menu.add("command",
- "label" => "ÆÉ¤ß¹þ¤ß ...",
+ "label" => "読ã¿è¾¼ã¿ ...",
"command" => proc{fileAction},
"underline" => 0)
@file_menu.add("command",
- "label" => "½ªÎ»",
+ "label" => "終了",
"command" => proc{$root.destroy},
"underline" => 0)
@file.menu(@file_menu)
@file.pack("side"=>"left")
@help = TkMenubutton.new(self,
- "text"=> "¥Ø¥ë¥×",
+ "text"=> "ヘルプ",
"underline"=>0)
@help_menu = TkMenu.new(@help)
@help_menu.add("command",
- "label"=> "¥³¥ó¥Æ¥­¥¹¥È¤Ë¤Ä¤¤¤Æ",
- "command"=>proc{show_help("¥³¥ó¥Æ¥­¥¹¥È")},
+ "label"=> "コンテキストã«ã¤ã„ã¦",
+ "command"=>proc{show_help("コンテキスト")},
"underline"=>3)
@help_menu.add("command",
- "label"=> "¥Ø¥ë¥×¤Ë¤Ä¤¤¤Æ",
- "command"=>proc{show_help("¥Ø¥ë¥×")},
+ "label"=> "ヘルプã«ã¤ã„ã¦",
+ "command"=>proc{show_help("ヘルプ")},
"underline"=>3)
@help_menu.add("command",
- "label"=> "¥¦¥£¥ó¥É¥¦¤Ë¤Ä¤¤¤Æ",
- "command"=>proc{show_help("¥¦¥£¥ó¥É¥¦")},
+ "label"=> "ウィンドウã«ã¤ã„ã¦",
+ "command"=>proc{show_help("ウィンドウ")},
"underline"=>3)
@help_menu.add("command",
- "label"=> "¥­¡¼Áàºî¤Ë¤Ä¤¤¤Æ",
- "command"=>proc{show_help("¥­¡¼Áàºî")},
+ "label"=> "キーæ“作ã«ã¤ã„ã¦",
+ "command"=>proc{show_help("キーæ“作")},
"underline"=>3)
@help_menu.add("command",
- "label"=> "¥Ð¡¼¥¸¥ç¥ó¾ðÊó",
- "command"=>proc{show_help("¥Ð¡¼¥¸¥ç¥ó¾ðÊó")},
+ "label"=> "ãƒãƒ¼ã‚¸ãƒ§ãƒ³æƒ…å ±",
+ "command"=>proc{show_help("ãƒãƒ¼ã‚¸ãƒ§ãƒ³æƒ…å ±")},
"underline"=>3)
@help.menu(@help_menu)
@help.pack("side"=>"right")
@@ -198,16 +198,16 @@ $root.buttons.add.configure("command"=>proc{addAction})
$root.buttons.clear.configure("command"=>proc{clearAction})
$root.buttons.search.configure("command"=>proc{addAction; fillCard})
-$root.buttons.clear.configure("text"=> "¥¯¥ê¥¢¡¼ Ctrl+C")
+$root.buttons.clear.configure("text"=> "クリアー Ctrl+C")
$root.bind("Control-c",proc{clearAction})
-$root.buttons.add.configure("text"=> "Äɲà Ctrl+A")
+$root.buttons.add.configure("text"=> "追加 Ctrl+A")
$root.bind("Control-a",proc{addAction})
-$root.buttons.search.configure("text"=> "¸¡º÷ Ctrl+S")
+$root.buttons.search.configure("text"=> "検索 Ctrl+S")
$root.bind("Control-s",proc{addAction; fillCard})
-$root.buttons.delete.configure("text"=> "¾Ãµî Ctrl+D")
+$root.buttons.delete.configure("text"=> "消去 Ctrl+D")
$root.bind("Control-d",proc{deleteAction})
$root.menu.file_menu.entryconfigure(1, "accel"=>"Ctrl+F")
@@ -227,74 +227,74 @@ $root.bind("Any-Help",
$helpTopics = {}
$helpTopics[$root.menu.file] = <<EOF
-¤³¤ì¤Ï¡Ö¥Õ¥¡¥¤¥ë¡×¥á¥Ë¥å¡¼¤Ç¤¹¡£¡ÖÆÉ¤ß¹þ¤ß¡×¤ä¡Ö½ªÎ»¡×¤Ê¤É¤ò
-¹Ô¤Ê¤¦¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£
+ã“れã¯ã€Œãƒ•ァイルã€ãƒ¡ãƒ‹ãƒ¥ãƒ¼ã§ã™ã€‚「読ã¿è¾¼ã¿ã€ã‚„「終了ã€ãªã©ã‚’
+行ãªã†ã“ã¨ãŒã§ãã¾ã™ã€‚
EOF
$helpTopics[$root.menu.file_menu.index(0)] = <<EOF
-¥Õ¥¡¥¤¥ë¤ÎÆÉ¤ß¹þ¤ß¤ò¹Ô¤Ê¤¦¤È¤­¤Ë»È¤¤¤Þ¤¹¡£
+ファイルã®èª­ã¿è¾¼ã¿ã‚’行ãªã†ã¨ãã«ä½¿ã„ã¾ã™ã€‚
EOF
$helpTopics[$root.menu.file_menu.index(1)] = <<EOF
-¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¤ò½ªÎ»¤¹¤ë¤È¤­¤Ë»È¤¤¤Þ¤¹¡£
+アプリケーションを終了ã™ã‚‹ã¨ãã«ä½¿ã„ã¾ã™ã€‚
EOF
$helpTopics[$root.frame.entry[1]] = <<EOF
-̾Á°¤òµ­Æþ¤¹¤ë¥¨¥ó¥È¥ê¤Ç¤¹¡£
+åå‰ã‚’記入ã™ã‚‹ã‚¨ãƒ³ãƒˆãƒªã§ã™ã€‚
EOF
$helpTopics[$root.frame.entry[2]] = <<EOF
-½»½ê¤òµ­Æþ¤¹¤ë¥¨¥ó¥È¥ê¤Ç¤¹¡£
+使‰€ã‚’記入ã™ã‚‹ã‚¨ãƒ³ãƒˆãƒªã§ã™ã€‚
EOF
$helpTopics[$root.frame.entry[3]] = <<EOF
-½»½ê¤òµ­Æþ¤¹¤ë¥¨¥ó¥È¥ê¤Ç¤¹¡£
+使‰€ã‚’記入ã™ã‚‹ã‚¨ãƒ³ãƒˆãƒªã§ã™ã€‚
EOF
$helpTopics[$root.frame.entry[4]] = <<EOF
-½»½ê¤òµ­Æþ¤¹¤ë¥¨¥ó¥È¥ê¤Ç¤¹¡£
+使‰€ã‚’記入ã™ã‚‹ã‚¨ãƒ³ãƒˆãƒªã§ã™ã€‚
EOF
$helpTopics[$root.frame.entry[5]] = <<EOF
-¼«Âð¤ÎÅÅÏÃÈÖ¹æ¤òµ­Æþ¤¹¤ë¥¨¥ó¥È¥ê¤Ç¤¹¡£¸ø³«\
-¤·¤¿¤¯¤Ê¤¤¤È¤­¤Ï private ¤Èµ­Æþ¤·¤Þ¤¹¡£
+自宅ã®é›»è©±ç•ªå·ã‚’記入ã™ã‚‹ã‚¨ãƒ³ãƒˆãƒªã§ã™ã€‚公開\
+ã—ãŸããªã„ã¨ã㯠private ã¨è¨˜å…¥ã—ã¾ã™ã€‚
EOF
$helpTopics[$root.frame.entry[6]] = <<EOF
-²ñ¼Ò¤ÎÅÅÏÃÈÖ¹æ¤òµ­Æþ¤¹¤ë¥¨¥ó¥È¥ê¤Ç¤¹¡£
+会社ã®é›»è©±ç•ªå·ã‚’記入ã™ã‚‹ã‚¨ãƒ³ãƒˆãƒªã§ã™ã€‚
EOF
$helpTopics[$root.frame.entry[7]] = <<EOF
-FAXÈÖ¹æ¤òµ­Æþ¤¹¤ë¥¨¥ó¥È¥ê¤Ç¤¹¡£
+FAX番å·ã‚’記入ã™ã‚‹ã‚¨ãƒ³ãƒˆãƒªã§ã™ã€‚
EOF
-$helpTopics["¥³¥ó¥Æ¥­¥¹¥È"] = <<EOF
-Ruby/Tk¤Ç¤Ïgrab¤Îµ¡¹½¤¬¤Ê¤¤¤¿¤á¤³¤Î¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¤Ç¤Ï\
-¥³¥ó¥Æ¥­¥¹¥È¥Ø¥ë¥×¤Ï¥µ¥Ý¡¼¥È¤µ¤ì¤Æ¤¤¤Þ¤»¤ó¡£
-¤·¤«¤·Æ±¤¸¤è¤¦¤Ê¸ú²Ì¤òbind¤È¥Þ¥¦¥¹¤Î°ÌÃÖ¤ÎWedget¤òÃΤë\
-¤³¤È¤ÇÆÀ¤ë¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£
+$helpTopics["コンテキスト"] = <<EOF
+Ruby/Tkã§ã¯grabã®æ©Ÿæ§‹ãŒãªã„ãŸã‚ã“ã®ã‚¢ãƒ—リケーションã§ã¯\
+コンテキストヘルプã¯ã‚µãƒãƒ¼ãƒˆã•れã¦ã„ã¾ã›ã‚“。
+ã—ã‹ã—åŒã˜ã‚ˆã†ãªåŠ¹æžœã‚’bindã¨ãƒžã‚¦ã‚¹ã®ä½ç½®ã®Wedgetを知る\
+ã“ã¨ã§å¾—ã‚‹ã“ã¨ãŒã§ãã¾ã™ã€‚
EOF
-$helpTopics["¥Ø¥ë¥×"] = <<EOF
-¥Þ¥¦¥¹¤ò¥¦¥£¥ó¥É¥¦¤Ë¤¢¤ï¤»¤ÆF1¥­¡¼¤ò²¡¤¹¤³¤È¤Ë¤è¤Ã¤Æ\
-¤½¤Î¥Ø¥ë¥×¤ò¸«¤ë¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£
+$helpTopics["ヘルプ"] = <<EOF
+マウスをウィンドウã«ã‚ã‚ã›ã¦F1キーを押ã™ã“ã¨ã«ã‚ˆã£ã¦\
+ãã®ãƒ˜ãƒ«ãƒ—を見るã“ã¨ãŒã§ãã¾ã™ã€‚
EOF
-$helpTopics["¥¦¥£¥ó¥É¥¦"] = <<EOF
-¤³¤Î¥¦¥£¥ó¥É¥¦¤Ï¥À¥ß¡¼¤Ç¤¹¡£
+$helpTopics["ウィンドウ"] = <<EOF
+ã“ã®ã‚¦ã‚£ãƒ³ãƒ‰ã‚¦ã¯ãƒ€ãƒŸãƒ¼ã§ã™ã€‚
EOF
-$helpTopics["¥­¡¼Áàºî"] = <<EOF
-Ctrl+A: ÄɲÃ
-Ctrl+C: ¥¯¥ê¥¢¡¼
-Ctrl+D: ¾Ãµî
-Ctrl+F: ¥Õ¥¡¥¤¥ëÁªÂò
-Ctrl+Q: ½ªÎ»
-Ctrl+S: ¸¡º÷
+$helpTopics["キーæ“作"] = <<EOF
+Ctrl+A: 追加
+Ctrl+C: クリアー
+Ctrl+D: 消去
+Ctrl+F: ãƒ•ã‚¡ã‚¤ãƒ«é¸æŠž
+Ctrl+Q: 終了
+Ctrl+S: 検索
EOF
-$helpTopics["¥Ð¡¼¥¸¥ç¥ó¾ðÊó"] = <<EOF
-¥Ð¡¼¥¸¥ç¥ó¤Ï 1.0.1j ¤Ç¤¹¡£
+$helpTopics["ãƒãƒ¼ã‚¸ãƒ§ãƒ³æƒ…å ±"] = <<EOF
+ãƒãƒ¼ã‚¸ãƒ§ãƒ³ã¯ 1.0.1j ã§ã™ã€‚
EOF
Tk.mainloop
diff --git a/ext/tk/sample/demos-jp/ruler.rb b/ext/tk/sample/demos-jp/ruler.rb
index a721b95a6a..5c34a5a5da 100644
--- a/ext/tk/sample/demos-jp/ruler.rb
+++ b/ext/tk/sample/demos-jp/ruler.rb
@@ -1,4 +1,4 @@
-# -*- coding: euc-jp -*-
+# -*- coding: utf-8 -*-
#
# ruler widget demo (called by 'widget')
#
@@ -16,13 +16,13 @@ def rulerMkTab(c,x,y)
TkcPolygon.new(c, x, y, x+v.size, y+v.size, x-v.size, y+v.size)
end
-# toplevel widget ¤¬Â¸ºß¤¹¤ì¤Ðºï½ü¤¹¤ë
+# toplevel widget ãŒå­˜åœ¨ã™ã‚Œã°å‰Šé™¤ã™ã‚‹
if defined?($ruler_demo) && $ruler_demo
$ruler_demo.destroy
$ruler_demo = nil
end
-# demo ÍѤΠtoplevel widget ¤òÀ¸À®
+# demo 用㮠toplevel widget を生æˆ
$ruler_demo = TkToplevel.new {|w|
title("Ruler Demonstration")
iconname("ruler")
@@ -31,17 +31,17 @@ $ruler_demo = TkToplevel.new {|w|
base_frame = TkFrame.new($ruler_demo).pack(:fill=>:both, :expand=>true)
-# label À¸À®
+# label 生æˆ
TkLabel.new(base_frame, 'font'=>$font, 'wraplength'=>'5i', 'justify'=>'left',
- 'text'=>"¤³¤Î¥­¥ã¥ó¥Ð¥¹widget¤Ï¥ë¡¼¥é¡¼¤ÎÌÏ·¿¤Ç¤¹¡£¥ë¡¼¥é¡¼¤Î±¦¤Ë¤¢¤ë¤Î¤Ï¥¿¥Ö¥¹¥È¥Ã¥×¤Î°æ¸Í¤Ç¡¢¤³¤³¤«¤é°ú¤ÃÄ¥¤Ã¤Æ¤¯¤ë¤³¤È¤Ë¤è¤Ã¤Æ¥¿¥Ö¥¹¥È¥Ã¥×¤òºî¤ë¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£¤Þ¤¿¡¢¤¹¤Ç¤Ë¤¢¤ë¥¿¥Ö¥¹¥È¥Ã¥×¤òư¤«¤¹¤³¤È¤â¤Ç¤­¤Þ¤¹¡£¥¿¥Ö¥¹¥È¥Ã¥×¤ò¾åÊý¤Þ¤¿¤Ï²¼Êý¤Ë¤«¤¹¤ì¤ÆÉ½¼¨¤µ¤ì¤ë¤Þ¤Ç¥É¥é¥Ã¥°¤¹¤ë¤È¡¢¥Þ¥¦¥¹¥Ü¥¿¥ó¤òÎ¥¤·¤¿»þ¤Ë¤½¤Î¥¿¥Ö¥¹¥È¥Ã¥×¤Ï¾Ã¤¨¤Þ¤¹¡£"){
+ 'text'=>"ã“ã®ã‚­ãƒ£ãƒ³ãƒã‚¹widgetã¯ãƒ«ãƒ¼ãƒ©ãƒ¼ã®æ¨¡åž‹ã§ã™ã€‚ルーラーã®å³ã«ã‚ã‚‹ã®ã¯ã‚¿ãƒ–ストップã®äº•戸ã§ã€ã“ã“ã‹ã‚‰å¼•ã£å¼µã£ã¦ãã‚‹ã“ã¨ã«ã‚ˆã£ã¦ã‚¿ãƒ–ストップを作るã“ã¨ãŒã§ãã¾ã™ã€‚ã¾ãŸã€ã™ã§ã«ã‚るタブストップを動ã‹ã™ã“ã¨ã‚‚ã§ãã¾ã™ã€‚タブストップを上方ã¾ãŸã¯ä¸‹æ–¹ã«ã‹ã™ã‚Œã¦è¡¨ç¤ºã•れるã¾ã§ãƒ‰ãƒ©ãƒƒã‚°ã™ã‚‹ã¨ã€ãƒžã‚¦ã‚¹ãƒœã‚¿ãƒ³ã‚’離ã—ãŸæ™‚ã«ãã®ã‚¿ãƒ–ã‚¹ãƒˆãƒƒãƒ—ã¯æ¶ˆãˆã¾ã™ã€‚"){
pack('side'=>'top')
}
-# frame À¸À®
+# frame 生æˆ
$ruler_buttons = TkFrame.new(base_frame) {|frame|
TkButton.new(frame) {
- #text 'λ²ò'
- text 'ÊĤ¸¤ë'
+ #text '了解'
+ text 'é–‰ã˜ã‚‹'
command proc{
tmppath = $ruler_demo
$ruler_demo = nil
@@ -50,17 +50,17 @@ $ruler_buttons = TkFrame.new(base_frame) {|frame|
}.pack('side'=>'left', 'expand'=>'yes')
TkButton.new(frame) {
- text '¥³¡¼¥É»²¾È'
+ text 'コードå‚ç…§'
command proc{showCode 'ruler'}
}.pack('side'=>'left', 'expand'=>'yes')
}
$ruler_buttons.pack('side'=>'bottom', 'fill'=>'x', 'pady'=>'2m')
-# canvas ÀßÄê
+# canvas 設定
$ruler_canvas = TkCanvas.new(base_frame, 'width'=>'14.8c', 'height'=>'2.5c')
$ruler_canvas.pack('side'=>'top', 'fill'=>'x')
-# ÃÍÀßÄê
+# 値設定
unless Struct.const_defined?("RulerInfo")
$demo_rulerInfo = Struct.new("RulerInfo", :grid, :left, :right, :x, :y,
:top, :bottom, :size, :normalStyle,
diff --git a/ext/tk/sample/demos-jp/sayings.rb b/ext/tk/sample/demos-jp/sayings.rb
index b3bdbe0bc5..cf4fe7b1b1 100644
--- a/ext/tk/sample/demos-jp/sayings.rb
+++ b/ext/tk/sample/demos-jp/sayings.rb
@@ -1,15 +1,15 @@
-# -*- coding: euc-jp -*-
+# -*- coding: utf-8 -*-
#
# listbox widget demo 'sayings' (called by 'widget')
#
-# toplevel widget ¤¬Â¸ºß¤¹¤ì¤Ðºï½ü¤¹¤ë
+# toplevel widget ãŒå­˜åœ¨ã™ã‚Œã°å‰Šé™¤ã™ã‚‹
if defined?($sayings_demo) && $sayings_demo
$sayings_demo.destroy
$sayings_demo = nil
end
-# demo ÍѤΠtoplevel widget ¤òÀ¸À®
+# demo 用㮠toplevel widget を生æˆ
$sayings_demo = TkToplevel.new {|w|
title("Listbox Demonstration (well-known sayings)")
iconname("sayings")
@@ -18,20 +18,20 @@ $sayings_demo = TkToplevel.new {|w|
base_frame = TkFrame.new($sayings_demo).pack(:fill=>:both, :expand=>true)
-# label À¸À®
+# label 生æˆ
msg = TkLabel.new(base_frame) {
font $font
wraplength '4i'
justify 'left'
- text "²¼¤Î¥ê¥¹¥È¥Ü¥Ã¥¯¥¹¤Ë¤Ï¤¤¤í¤¤¤í¤Ê³Ê¸À¤¬Æþ¤Ã¤Æ¤¤¤Þ¤¹¡£¥ê¥¹¥È¤ò¥¹¥¯¥í¡¼¥ë¤µ¤»¤ë¤Î¤Ï¥¹¥¯¥í¡¼¥ë¥Ð¡¼¤Ç¤â¤Ç¤­¤Þ¤¹¤·¡¢¥ê¥¹¥È¥Ü¥Ã¥¯¥¹¤ÎÃæ¤Ç¥Þ¥¦¥¹¤Î¥Ü¥¿¥ó2(Ãæ¥Ü¥¿¥ó)¤ò²¡¤·¤¿¤Þ¤Þ¥É¥é¥Ã¥°¤·¤Æ¤â¤Ç¤­¤Þ¤¹¡£"
+ text "下ã®ãƒªã‚¹ãƒˆãƒœãƒƒã‚¯ã‚¹ã«ã¯ã„ã‚ã„ã‚ãªæ ¼è¨€ãŒå…¥ã£ã¦ã„ã¾ã™ã€‚リストをスクロールã•ã›ã‚‹ã®ã¯ã‚¹ã‚¯ãƒ­ãƒ¼ãƒ«ãƒãƒ¼ã§ã‚‚ã§ãã¾ã™ã—ã€ãƒªã‚¹ãƒˆãƒœãƒƒã‚¯ã‚¹ã®ä¸­ã§ãƒžã‚¦ã‚¹ã®ãƒœã‚¿ãƒ³2(中ボタン)を押ã—ãŸã¾ã¾ãƒ‰ãƒ©ãƒƒã‚°ã—ã¦ã‚‚ã§ãã¾ã™ã€‚"
}
msg.pack('side'=>'top')
-# frame À¸À®
+# frame 生æˆ
TkFrame.new(base_frame) {|frame|
TkButton.new(frame) {
- #text 'λ²ò'
- text 'ÊĤ¸¤ë'
+ #text '了解'
+ text 'é–‰ã˜ã‚‹'
command proc{
tmppath = $sayings_demo
$sayings_demo = nil
@@ -40,13 +40,13 @@ TkFrame.new(base_frame) {|frame|
}.pack('side'=>'left', 'expand'=>'yes')
TkButton.new(frame) {
- text '¥³¡¼¥É»²¾È'
+ text 'コードå‚ç…§'
command proc{showCode 'sayings'}
}.pack('side'=>'left', 'expand'=>'yes')
}.pack('side'=>'bottom', 'fill'=>'x', 'pady'=>'2m')
-# frame À¸À®
+# frame 生æˆ
sayings_lbox = nil
TkFrame.new(base_frame, 'borderwidth'=>10) {|w|
sv = TkScrollbar.new(w)
diff --git a/ext/tk/sample/demos-jp/search.rb b/ext/tk/sample/demos-jp/search.rb
index 293ae83910..238450ae30 100644
--- a/ext/tk/sample/demos-jp/search.rb
+++ b/ext/tk/sample/demos-jp/search.rb
@@ -1,4 +1,4 @@
-# -*- coding: euc-jp -*-
+# -*- coding: utf-8 -*-
#
# Text Search widget demo (called by 'widget')
#
@@ -62,13 +62,13 @@ def textToggle(cmd1,sleep1,cmd2,sleep2)
-1, cmd1, cmd2).start(sleep1)
end
-# toplevel widget ¤¬Â¸ºß¤¹¤ì¤Ðºï½ü¤¹¤ë
+# toplevel widget ãŒå­˜åœ¨ã™ã‚Œã°å‰Šé™¤ã™ã‚‹
if defined?($search_demo) && $search_demo
$search_demo.destroy
$search_demo = nil
end
-# demo ÍѤΠtoplevel widget ¤òÀ¸À®
+# demo 用㮠toplevel widget を生æˆ
$search_demo = TkToplevel.new {|w|
title("Text Demonstration - Search and Highlight")
iconname("search")
@@ -77,11 +77,11 @@ $search_demo = TkToplevel.new {|w|
base_frame = TkFrame.new($search_demo).pack(:fill=>:both, :expand=>true)
-# frame À¸À®
+# frame 生æˆ
$search_buttons = TkFrame.new(base_frame) {|frame|
TkButton.new(frame) {
- #text 'λ²ò'
- text 'ÊĤ¸¤ë'
+ #text '了解'
+ text 'é–‰ã˜ã‚‹'
command proc{
tmppath = $search_demo
$search_demo = nil
@@ -90,15 +90,15 @@ $search_buttons = TkFrame.new(base_frame) {|frame|
}.pack('side'=>'left', 'expand'=>'yes')
TkButton.new(frame) {
- text '¥³¡¼¥É»²¾È'
+ text 'コードå‚ç…§'
command proc{showCode 'search'}
}.pack('side'=>'left', 'expand'=>'yes')
}
$search_buttons.pack('side'=>'bottom', 'fill'=>'x', 'pady'=>'2m')
-# frame À¸À®
+# frame 生æˆ
TkFrame.new(base_frame) {|f|
- TkLabel.new(f, 'text'=>'¥Õ¥¡¥¤¥ë̾:',
+ TkLabel.new(f, 'text'=>'ファイルå:',
'width'=>13, 'anchor'=>'w').pack('side'=>'left')
$search_fileName = TkVariable.new
TkEntry.new(f, 'width'=>40,
@@ -108,14 +108,14 @@ TkFrame.new(base_frame) {|f|
$search_string_entry.focus})
focus
}
- TkButton.new(f, 'text'=>'ÆÉ¤ß¹þ¤ß',
+ TkButton.new(f, 'text'=>'読ã¿è¾¼ã¿',
'command'=>proc{textLoadFile($search_text,
$search_fileName.value)})\
.pack('side'=>'left', 'pady'=>5, 'padx'=>10)
}.pack('side'=>'top', 'fill'=>'x')
TkFrame.new(base_frame) {|f|
- TkLabel.new(f, 'text'=>'¸¡º÷ʸ»úÎó:',
+ TkLabel.new(f, 'text'=>'検索文字列:',
'width'=>13, 'anchor'=>'w').pack('side'=>'left')
$search_searchString = TkVariable.new
$search_string_entry = TkEntry.new(f, 'width'=>40,
@@ -124,7 +124,7 @@ TkFrame.new(base_frame) {|f|
bind('Return', proc{textSearch($search_text, $search_searchString.value,
$search_Tag)})
}
- TkButton.new(f, 'text'=>'ȿž',
+ TkButton.new(f, 'text'=>'å転',
'command'=>proc{textSearch($search_text,
$search_searchString.value,
$search_Tag)}) {
@@ -165,15 +165,15 @@ else
200 )
end
$search_text.insert('1.0', "\
-¤³¤Î¥¦¥£¥ó¥É¥¦¤Ï¸¡º÷µ¡¹½¤ò¼Â¸½¤¹¤ë¤Î¤Ë¥Æ¥­¥¹¥È widget ¤Î¥¿¥°µ¡Ç½¤¬¤É¤Î \
-¤è¤¦¤Ë»È¤ï¤ì¤ë¤Î¤«¤ò¥Ç¥â¤¹¤ë¤â¤Î¤Ç¤¹¡£¤Þ¤º¾å¤Î¥¨¥ó¥È¥ê¤Ë¥Õ¥¡¥¤¥ë̾¤òÆþ \
-¤ì¡¢<¥ê¥¿¡¼¥ó> ¤ò²¡¤¹¤«¡Ö¥í¡¼¥É¡×¥Ü¥¿¥ó¤ò²¡¤·¤Æ¤¯¤À¤µ¤¤¡£¼¡¤Ë¤½¤Î²¼¤Î \
-¥¨¥ó¥È¥ê¤Ëʸ»úÎó¤òÆþÎϤ·¡¢<¥ê¥¿¡¼¥ó> ¤ò²¡¤¹¤«¡Öȿž¡×¥Ü¥¿¥ó¤ò²¡¤·¤Æ¤¯ \
-¤À¤µ¤¤¡£¤¹¤ë¤È¥Õ¥¡¥¤¥ëÃæ¤Î¡¢¸¡º÷ʸ»úÎó¤È°ìÃפ¹¤ëÉôʬ¤ËÁ´¤Æ \"search_Tag\" \
-¤È¤¤¤¦¥¿¥°¤¬¤Ä¤±¤é¤ì¡¢¥¿¥°¤Îɽ¼¨Â°À­¤È¤·¤Æ¤½¤Îʸ»úÎó¤¬ÅÀÌǤ¹¤ë¤è¤¦¤Ë \
-ÀßÄꤵ¤ì¤Þ¤¹¡£\n")
+ã“ã®ã‚¦ã‚£ãƒ³ãƒ‰ã‚¦ã¯æ¤œç´¢æ©Ÿæ§‹ã‚’実ç¾ã™ã‚‹ã®ã«ãƒ†ã‚­ã‚¹ãƒˆ widget ã®ã‚¿ã‚°æ©Ÿèƒ½ãŒã©ã® \
+よã†ã«ä½¿ã‚れるã®ã‹ã‚’デモã™ã‚‹ã‚‚ã®ã§ã™ã€‚ã¾ãšä¸Šã®ã‚¨ãƒ³ãƒˆãƒªã«ãƒ•ァイルåã‚’å…¥ \
+れã€<リターン> を押ã™ã‹ã€Œãƒ­ãƒ¼ãƒ‰ã€ãƒœã‚¿ãƒ³ã‚’押ã—ã¦ãã ã•ã„。次ã«ãã®ä¸‹ã® \
+ã‚¨ãƒ³ãƒˆãƒªã«æ–‡å­—列を入力ã—ã€<リターン> を押ã™ã‹ã€Œå転ã€ãƒœã‚¿ãƒ³ã‚’押ã—ã¦ã \
+ã ã•ã„。ã™ã‚‹ã¨ãƒ•ァイル中ã®ã€æ¤œç´¢æ–‡å­—列ã¨ä¸€è‡´ã™ã‚‹éƒ¨åˆ†ã«å…¨ã¦ \"search_Tag\" \
+ã¨ã„ã†ã‚¿ã‚°ãŒã¤ã‘られã€ã‚¿ã‚°ã®è¡¨ç¤ºå±žæ€§ã¨ã—ã¦ãã®æ–‡å­—列ãŒç‚¹æ»…ã™ã‚‹ã‚ˆã†ã« \
+設定ã•れã¾ã™ã€‚\n")
$search_text.insert('end', "\
-¥Õ¥¡¥¤¥ëÆÉ¤ß¹þ¤ß¤Î¥«¥ì¥ó¥È¥Ç¥£¥ì¥¯¥È¥ê¤Ï \"#{Dir.pwd}\" ¤Ç¤¹¡£\
+ファイル読ã¿è¾¼ã¿ã®ã‚«ãƒ¬ãƒ³ãƒˆãƒ‡ã‚£ãƒ¬ã‚¯ãƒˆãƒªã¯ \"#{Dir.pwd}\" ã§ã™ã€‚\
")
$search_text.set_insert '0.0'
diff --git a/ext/tk/sample/demos-jp/spin.rb b/ext/tk/sample/demos-jp/spin.rb
index 2bcc3217e6..fd51a3f457 100644
--- a/ext/tk/sample/demos-jp/spin.rb
+++ b/ext/tk/sample/demos-jp/spin.rb
@@ -1,4 +1,4 @@
-# -*- coding: euc-jp -*-
+# -*- coding: utf-8 -*-
#
# spin.rb --
#
@@ -22,35 +22,35 @@ base_frame = TkFrame.new($spin_demo).pack(:fill=>:both, :expand=>true)
TkLabel.new(base_frame,
:font=>$font, :wraplength=>'5i', :justify=>:left,
:text=><<EOL).pack(:side=>:top)
-²¼¤Ë¤Ï£³¼ïÎà¤Î¥¹¥Ô¥ó¥Ü¥Ã¥¯¥¹¤¬É½¼¨¤µ¤ì¤Æ¤¤¤Þ¤¹¡£
-¤½¤ì¤¾¤ì¡¢¥Þ¥¦¥¹¤ÇÁªÂò¤·¤ÆÊ¸»ú¤òÆþÎϤ¹¤ë¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£
-ÊÔ½¸Áàºî¤È¤·¤Æ¤Ï¡¢Emacs ·Á¼°¤Î¿¤¯¤Ë²Ã¤¨¤Æ¡¢°ìÈÌŪ¤Ê
-Motif ·Á¼°¤Î¥­¡¼Áàºî¤¬¥µ¥Ý¡¼¥È¤µ¤ì¤Æ¤¤¤Þ¤¹¡£¤¿¤È¤¨¤Ð¡¢
-Backspace ¤È Control-h ¤È¤ÏÆþÎÏ¥«¡¼¥½¥ë¤Îº¸Â¦¤Îʸ»ú¤ò
-ºï½ü¤·¡¢Delete ¤È Control-d ¤È¤Ï±¦Â¦¤Îʸ»ú¤òºï½ü¤·¤Þ¤¹¡£
-ÆþÎÏÏȤÎŤµ¤ò±Û¤¨¤ë¤è¤¦¤ÊŤ¤Ê¸»úÎó¤òÆþÎϤ·¤¿¾ì¹ç¤Ë¤Ï¡¢
-¥Þ¥¦¥¹¤Î¥Ü¥¿¥ó£²¤ò²¡¤·¤Æ¥É¥é¥Ã¥°¤¹¤ë¤³¤È¤Ç¡¢ÆþÎÏʸ»úÎó
-¤ò¥¹¥­¥ã¥ó¤¹¤ë¤³¤È¤¬²Äǽ¤Ç¤¹¡£
-¤Ê¤ª¡¢ºÇ½é¤Î¥¹¥Ô¥ó¥Ü¥Ã¥¯¥¹¤Ï¡¢À°¿ôÃͤȤߤʤµ¤ì¤ë¤è¤¦¤Ê
-ʸ»úÎó¤·¤«ÆþÎϤ¬µö¤µ¤ì¤Ê¤¤¤³¤È¤ËÃí°Õ¤·¤Æ¤¯¤À¤µ¤¤¡£¤Þ¤¿¡¢
-£³ÈÖÌܤΥ¹¥Ô¥ó¥Ü¥Ã¥¯¥¹¤ÇÁªÂò¸õÊä¤Ë¸½¤ì¤ë¤Î¤Ï¥ª¡¼¥¹¥È¥é
-¥ê¥¢¤ÎÅÔ»Ô̾¤Î¥ê¥¹¥È¤È¤Ê¤Ã¤Æ¤¤¤Þ¤¹¡£
-¤â¤·¤¢¤Ê¤¿¤¬»È¤Ã¤Æ¤¤¤ë Ruby ¤Ë¥ê¥ó¥¯¤µ¤ì¤Æ¤¤¤ë Tk ¥é¥¤
-¥Ö¥é¥ê¤¬ spinbox ¥¦¥£¥¸¥§¥Ã¥È¤ò¼ÂÁõ¤·¤Æ¤¤¤Ê¤¤¾ì¹ç¡¢¤³¤Î
-¥Ç¥â¤Ï¤¦¤Þ¤¯Æ°¤«¤Ê¤¤¤Ï¤º¤Ç¤¹¡£¤½¤Î¾ì¹ç¤Ë¤Ï spinbox ¥¦¥£
-¥¸¥§¥Ã¥È¤¬¼ÂÁõ¤µ¤ì¤Æ¤¤¤ë¤è¤¦¤Ê¤è¤ê¿·¤·¤¤¥Ð¡¼¥¸¥ç¥ó¤Î Tk
-¤òÁȤ߹ç¤ï¤»¤Æ»î¤¹¤è¤¦¤Ë¤·¤Æ¤¯¤À¤µ¤¤¡£
+下ã«ã¯ï¼“種類ã®ã‚¹ãƒ”ンボックスãŒè¡¨ç¤ºã•れã¦ã„ã¾ã™ã€‚
+ãれãžã‚Œã€ãƒžã‚¦ã‚¹ã§é¸æŠžã—ã¦æ–‡å­—を入力ã™ã‚‹ã“ã¨ãŒã§ãã¾ã™ã€‚
+編集æ“作ã¨ã—ã¦ã¯ã€Emacs å½¢å¼ã®å¤šãã«åŠ ãˆã¦ã€ä¸€èˆ¬çš„ãª
+Motif å½¢å¼ã®ã‚­ãƒ¼æ“作ãŒã‚µãƒãƒ¼ãƒˆã•れã¦ã„ã¾ã™ã€‚ãŸã¨ãˆã°ã€
+Backspace 㨠Control-h ã¨ã¯å…¥åŠ›ã‚«ãƒ¼ã‚½ãƒ«ã®å·¦å´ã®æ–‡å­—ã‚’
+削除ã—ã€Delete 㨠Control-d ã¨ã¯å³å´ã®æ–‡å­—を削除ã—ã¾ã™ã€‚
+入力枠ã®é•·ã•ã‚’è¶Šãˆã‚‹ã‚ˆã†ãªé•·ã„文字列を入力ã—ãŸå ´åˆã«ã¯ã€
+マウスã®ãƒœã‚¿ãƒ³ï¼’を押ã—ã¦ãƒ‰ãƒ©ãƒƒã‚°ã™ã‚‹ã“ã¨ã§ã€å…¥åŠ›æ–‡å­—åˆ—
+をスキャンã™ã‚‹ã“ã¨ãŒå¯èƒ½ã§ã™ã€‚
+ãªãŠã€æœ€åˆã®ã‚¹ãƒ”ンボックスã¯ã€æ•´æ•°å€¤ã¨ã¿ãªã•れるよã†ãª
+文字列ã—ã‹å…¥åŠ›ãŒè¨±ã•れãªã„ã“ã¨ã«æ³¨æ„ã—ã¦ãã ã•ã„。ã¾ãŸã€
+3番目ã®ã‚¹ãƒ”ンボックスã§é¸æŠžå€™è£œã«ç¾ã‚Œã‚‹ã®ã¯ã‚ªãƒ¼ã‚¹ãƒˆãƒ©
+リアã®éƒ½å¸‚åã®ãƒªã‚¹ãƒˆã¨ãªã£ã¦ã„ã¾ã™ã€‚
+ã‚‚ã—ã‚ãªãŸãŒä½¿ã£ã¦ã„ã‚‹ Ruby ã«ãƒªãƒ³ã‚¯ã•れã¦ã„ã‚‹ Tk ライ
+ブラリ㌠spinbox ウィジェットを実装ã—ã¦ã„ãªã„å ´åˆã€ã“ã®
+デモã¯ã†ã¾ãå‹•ã‹ãªã„ã¯ãšã§ã™ã€‚ãã®å ´åˆã«ã¯ spinbox ウィ
+ジェットãŒå®Ÿè£…ã•れã¦ã„るよã†ãªã‚ˆã‚Šæ–°ã—ã„ãƒãƒ¼ã‚¸ãƒ§ãƒ³ã® Tk
+を組ã¿åˆã‚ã›ã¦è©¦ã™ã‚ˆã†ã«ã—ã¦ãã ã•ã„。
EOL
TkFrame.new(base_frame){|f|
pack(:side=>:bottom, :fill=>:x, :pady=>'2m')
- TkButton.new(f, :text=>'ÊĤ¸¤ë', :width=>15, :command=>proc{
+ TkButton.new(f, :text=>'é–‰ã˜ã‚‹', :width=>15, :command=>proc{
$spin_demo.destroy
$spin_demo = nil
}).pack(:side=>:left, :expand=>true)
- TkButton.new(f, :text=>'¥³¡¼¥É»²¾È', :width=>15, :command=>proc{
+ TkButton.new(f, :text=>'コードå‚ç…§', :width=>15, :command=>proc{
showCode 'spin'
}).pack(:side=>:left, :expand=>true)
}
diff --git a/ext/tk/sample/demos-jp/states.rb b/ext/tk/sample/demos-jp/states.rb
index f354d28d84..2966e6d834 100644
--- a/ext/tk/sample/demos-jp/states.rb
+++ b/ext/tk/sample/demos-jp/states.rb
@@ -1,15 +1,15 @@
-# -*- coding: euc-jp -*-
+# -*- coding: utf-8 -*-
#
# listbox widget demo 'states' (called by 'widget')
#
-# toplevel widget ¤¬Â¸ºß¤¹¤ì¤Ðºï½ü¤¹¤ë
+# toplevel widget ãŒå­˜åœ¨ã™ã‚Œã°å‰Šé™¤ã™ã‚‹
if defined?($states_demo) && $states_demo
$states_demo.destroy
$states_demo = nil
end
-# demo ÍѤΠtoplevel widget ¤òÀ¸À®
+# demo 用㮠toplevel widget を生æˆ
$states_demo = TkToplevel.new {|w|
title("Listbox Demonstration (states)")
iconname("states")
@@ -18,20 +18,20 @@ $states_demo = TkToplevel.new {|w|
base_frame = TkFrame.new($states_demo).pack(:fill=>:both, :expand=>true)
-# label À¸À®
+# label 生æˆ
msg = TkLabel.new(base_frame) {
font $font
wraplength '4i'
justify 'left'
- text "²¼¤Ë¤¢¤ë¤Î¤ÏÅÔÆ»Éܸ©Ì¾¤¬Æþ¤Ã¤¿¥¹¥¯¥í¡¼¥ë¥Ð¡¼ÉդΥꥹ¥È¥Ü¥Ã¥¯¥¹¤Ç¤¹¡£¥ê¥¹¥È¤ò¥¹¥¯¥í¡¼¥ë¤µ¤»¤ë¤Î¤Ï¥¹¥¯¥í¡¼¥ë¥Ð¡¼¤Ç¤â¤Ç¤­¤Þ¤¹¤·¡¢¥ê¥¹¥È¥Ü¥Ã¥¯¥¹¤ÎÃæ¤Ç¥Þ¥¦¥¹¤Î¥Ü¥¿¥ó2(Ãæ¥Ü¥¿¥ó)¤ò²¡¤·¤¿¤Þ¤Þ¥É¥é¥Ã¥°¤·¤Æ¤â¤Ç¤­¤Þ¤¹¡£"
+ text "下ã«ã‚ã‚‹ã®ã¯éƒ½é“府県åãŒå…¥ã£ãŸã‚¹ã‚¯ãƒ­ãƒ¼ãƒ«ãƒãƒ¼ä»˜ã®ãƒªã‚¹ãƒˆãƒœãƒƒã‚¯ã‚¹ã§ã™ã€‚リストをスクロールã•ã›ã‚‹ã®ã¯ã‚¹ã‚¯ãƒ­ãƒ¼ãƒ«ãƒãƒ¼ã§ã‚‚ã§ãã¾ã™ã—ã€ãƒªã‚¹ãƒˆãƒœãƒƒã‚¯ã‚¹ã®ä¸­ã§ãƒžã‚¦ã‚¹ã®ãƒœã‚¿ãƒ³2(中ボタン)を押ã—ãŸã¾ã¾ãƒ‰ãƒ©ãƒƒã‚°ã—ã¦ã‚‚ã§ãã¾ã™ã€‚"
}
msg.pack('side'=>'top')
-# frame À¸À®
+# frame 生æˆ
TkFrame.new(base_frame) {|frame|
TkButton.new(frame) {
- #text 'λ²ò'
- text 'ÊĤ¸¤ë'
+ #text '了解'
+ text 'é–‰ã˜ã‚‹'
command proc{
tmppath = $states_demo
$states_demo = nil
@@ -40,13 +40,13 @@ TkFrame.new(base_frame) {|frame|
}.pack('side'=>'left', 'expand'=>'yes')
TkButton.new(frame) {
- text '¥³¡¼¥É»²¾È'
+ text 'コードå‚ç…§'
command proc{showCode 'states'}
}.pack('side'=>'left', 'expand'=>'yes')
}.pack('side'=>'bottom', 'fill'=>'x', 'pady'=>'2m')
-# frame À¸À®
+# frame 生æˆ
states_lbox = nil
TkFrame.new(base_frame, 'borderwidth'=>'.5c') {|w|
s = TkScrollbar.new(w)
@@ -61,13 +61,13 @@ TkFrame.new(base_frame, 'borderwidth'=>'.5c') {|w|
}.pack('side'=>'top', 'expand'=>'yes', 'fill'=>'y')
ins_data = [
- '°¦ÃÎ','ÀÄ¿¹','½©ÅÄ','ÀÐÀî','°ñ¾ë','´ä¼ê','°¦É²',
- 'Âçʬ','Âçºå','²¬»³','²­Æì','¹áÀî','¼¯»ùÅç','¿ÀÆàÀî',
- '´ôÉì','µþÅÔ','·§ËÜ','·²ÇÏ','¹âÃÎ','ºë¶Ì','º´²ì',
- '¼¢²ì','ÀŲ¬','Å纬','ÀéÍÕ','Åìµþ','ÆÁÅç','ÆÊÌÚ',
- 'Ä»¼è','ÉÙ»³','Ĺºê','ĹÌî','ÆàÎÉ','¿·³ã','ʼ¸Ë',
- '¹­Åç','Ê¡°æ','Ê¡²¬','Ê¡Åç','Ë̳¤Æ»','»°½Å','µÜ¾ë',
- 'µÜºê','»³·Á','»³¸ý','»³Íü','ϲλ³'
+ '愛知','é’æ£®','ç§‹ç”°','石å·','茨城','岩手','愛媛',
+ '大分','大阪','岡山','沖縄','香å·','鹿å…å³¶','神奈å·',
+ 'å²é˜œ','京都','熊本','群馬','高知','埼玉','ä½è³€',
+ '滋賀','é™å²¡','å³¶æ ¹','åƒè‘‰','æ±äº¬','徳島','栃木',
+ 'é³¥å–','富山','é•·å´Ž','長野','奈良','新潟','兵庫',
+ '広島','ç¦äº•','ç¦å²¡','ç¦å³¶','北海é“','三é‡','宮城',
+ '宮崎','山形','å±±å£','山梨','和歌山'
]
states_lbox.insert(0, *ins_data)
diff --git a/ext/tk/sample/demos-jp/style.rb b/ext/tk/sample/demos-jp/style.rb
index 3189e1f6d8..813fde7a78 100644
--- a/ext/tk/sample/demos-jp/style.rb
+++ b/ext/tk/sample/demos-jp/style.rb
@@ -1,16 +1,16 @@
-# -*- coding: euc-jp -*-
+# -*- coding: utf-8 -*-
#
# text (display styles) widget demo (called by 'widget')
#
-# toplevel widget ¤¬Â¸ºß¤¹¤ì¤Ðºï½ü¤¹¤ë
+# toplevel widget ãŒå­˜åœ¨ã™ã‚Œã°å‰Šé™¤ã™ã‚‹
if defined?($style_demo) && $style_demo
$style_demo.destroy
$style_demo = nil
end
-# demo ÍѤΠtoplevel widget ¤òÀ¸À®
+# demo 用㮠toplevel widget を生æˆ
$style_demo = TkToplevel.new {|w|
title("Text Demonstration - Display Styles")
iconname("style")
@@ -19,11 +19,11 @@ $style_demo = TkToplevel.new {|w|
base_frame = TkFrame.new($style_demo).pack(:fill=>:both, :expand=>true)
-# frame À¸À®
+# frame 生æˆ
TkFrame.new(base_frame) {|frame|
TkButton.new(frame) {
- #text 'λ²ò'
- text 'ÊĤ¸¤ë'
+ #text '了解'
+ text 'é–‰ã˜ã‚‹'
command proc{
tmppath = $style_demo
$style_demo = nil
@@ -32,15 +32,15 @@ TkFrame.new(base_frame) {|frame|
}.pack('side'=>'left', 'expand'=>'yes')
TkButton.new(frame) {
- text '¥³¡¼¥É»²¾È'
+ text 'コードå‚ç…§'
command proc{showCode 'style'}
}.pack('side'=>'left', 'expand'=>'yes')
}.pack('side'=>'bottom', 'fill'=>'x', 'pady'=>'2m')
-# text À¸À®
+# text 生æˆ
txt = TkText.new(base_frame){|t|
- # À¸À®
+ # 生æˆ
setgrid 'true'
#width 70
#height 32
@@ -53,7 +53,7 @@ txt = TkText.new(base_frame){|t|
}
pack('expand'=>'yes', 'fill'=>'both')
- # ¥Æ¥­¥¹¥È¥¿¥°ÀßÄê (¥Õ¥©¥ó¥È´ØÏ¢)
+ # テキストタグ設定 (フォント関連)
family = 'Courier'
if $tk_version =~ /^4.*/
@@ -89,7 +89,7 @@ txt = TkText.new(base_frame){|t|
# style_tag_small = TkTextTag.new(t, 'font'=>'@cSmallFont')
# end
- # ¥Æ¥­¥¹¥È¥¿¥°ÀßÄê (¿§¡¤¥ì¥ê¡¼¥Õ´ØÏ¢)
+ # テキストタグ設定 (色,レリーフ関連)
if TkWinfo.depth($root).to_i > 1
style_tag_color1 = TkTextTag.new(t, 'background'=>'#a0b7ce')
style_tag_color2 = TkTextTag.new(t, 'foreground'=>'red')
@@ -106,7 +106,7 @@ txt = TkText.new(base_frame){|t|
'relief'=>'sunken', 'borderwidth'=>1)
end
- # ¥Æ¥­¥¹¥È¥¿¥°ÀßÄê (¤½¤Î¾)
+ # テキストタグ設定 (ãã®ä»–)
if $tk_version =~ /^4\.[01]/
style_tag_bgstipple = TkTextTag.new(t, 'background'=>'black',
'borderwidth'=>0,
@@ -134,134 +134,134 @@ txt = TkText.new(base_frame){|t|
'lmargin1'=>'12m', 'lmargin2'=>'6m',
'rmargin'=>'10m')
- # ¥Æ¥­¥¹¥ÈÁÞÆþ
- insert('end', '¤³¤Î¤è¤¦¤Ë¥Æ¥­¥¹¥È widget ¤Ï¾ðÊó¤òÍÍ¡¹¤Ê¥¹¥¿¥¤¥ë¤Çɽ¼¨¤¹¤ë¤³¤È
-¤¬¤Ç¤­¤Þ¤¹¡£')
- insert('end', '¥¿¥°', style_tag_big)
- insert('end', '¤È¤¤¤¦¥á¥«¥Ë¥º¥à¤Ç¥³¥ó¥È¥í¡¼¥ë¤µ¤ì¤Þ¤¹¡£
-¥¿¥°¤È¤Ï¥Æ¥­¥¹¥È widget Æâ¤Î¤¢¤ëʸ»ú (¤ÎÈϰÏ)¤ËÂФ·¤ÆÅ¬ÍѤǤ­¤ë
-ñ¤Ê¤ë̾Á°¤Î¤³¤È¤Ç¤¹¡£¥¿¥°¤ÏÍÍ¡¹¤Êɽ¼¨¥¹¥¿¥¤¥ë¤ËÀßÄê¤Ç¤­¤Þ¤¹¡£
-ÀßÄꤹ¤ë¤È¡¢¤½¤Î¥¿¥°¤Î¤Ä¤¤¤¿Ê¸»ú¤Ï»ØÄꤷ¤¿¥¹¥¿¥¤¥ë¤Çɽ¼¨¤µ¤ì¤ë
-¤è¤¦¤Ë¤Ê¤ê¤Þ¤¹¡£»ÈÍѤǤ­¤ëɽ¼¨¥¹¥¿¥¤¥ë¤Ï¼¡¤ÎÄ̤ê¤Ç¤¹¡£
+ # テキスト挿入
+ insert('end', 'ã“ã®ã‚ˆã†ã«ãƒ†ã‚­ã‚¹ãƒˆ widget ã¯æƒ…報を様々ãªã‚¹ã‚¿ã‚¤ãƒ«ã§è¡¨ç¤ºã™ã‚‹ã“ã¨
+ãŒã§ãã¾ã™ã€‚')
+ insert('end', 'ã‚¿ã‚°', style_tag_big)
+ insert('end', 'ã¨ã„ã†ãƒ¡ã‚«ãƒ‹ã‚ºãƒ ã§ã‚³ãƒ³ãƒˆãƒ­ãƒ¼ãƒ«ã•れã¾ã™ã€‚
+ã‚¿ã‚°ã¨ã¯ãƒ†ã‚­ã‚¹ãƒˆ widget 内ã®ã‚る文字 (ã®ç¯„囲)ã«å¯¾ã—ã¦é©ç”¨ã§ãã‚‹
+å˜ãªã‚‹åå‰ã®ã“ã¨ã§ã™ã€‚ã‚¿ã‚°ã¯æ§˜ã€…ãªè¡¨ç¤ºã‚¹ã‚¿ã‚¤ãƒ«ã«è¨­å®šã§ãã¾ã™ã€‚
+設定ã™ã‚‹ã¨ã€ãã®ã‚¿ã‚°ã®ã¤ã„ãŸæ–‡å­—ã¯æŒ‡å®šã—ãŸã‚¹ã‚¿ã‚¤ãƒ«ã§è¡¨ç¤ºã•れる
+よã†ã«ãªã‚Šã¾ã™ã€‚使用ã§ãã‚‹è¡¨ç¤ºã‚¹ã‚¿ã‚¤ãƒ«ã¯æ¬¡ã®é€šã‚Šã§ã™ã€‚
')
insert('end', '
-1. ¥Õ¥©¥ó¥È', style_tag_big)
- insert('end', ' ¤É¤ó¤Ê X ¤Î¥Õ¥©¥ó¥È¤Ç¤â»È¤¨¤Þ¤¹¡£')
+1. フォント', style_tag_big)
+ insert('end', ' ã©ã‚“㪠X ã®ãƒ•ォントã§ã‚‚使ãˆã¾ã™ã€‚')
insert('end', 'large', style_tag_verybig)
insert('end', '
-¤È¤«')
-# insert('end', '¾®¤µ¤¤', style_tag_small)
+ã¨ã‹')
+# insert('end', 'å°ã•ã„', style_tag_small)
insert('end', 'small', style_tag_small)
- insert('end', '¤È¤«¡£
+ insert('end', 'ã¨ã‹ã€‚
')
insert('end', '
-2. ¿§', style_tag_big)
+2. 色', style_tag_big)
insert('end', ' ')
- insert('end', 'ÇØ·Ê¿§', style_tag_color1)
- insert('end', '¤â')
- insert('end', 'Á°·Ê¿§', style_tag_color2)
- insert('end', '¤â')
- insert('end', 'ξÊý', style_tag_color1, style_tag_color2)
- insert('end', '¤È¤âÊѤ¨¤ë¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£
+ insert('end', '背景色', style_tag_color1)
+ insert('end', 'ã‚‚')
+ insert('end', '剿™¯è‰²', style_tag_color2)
+ insert('end', 'ã‚‚')
+ insert('end', '両方', style_tag_color1, style_tag_color2)
+ insert('end', 'ã¨ã‚‚変ãˆã‚‹ã“ã¨ãŒã§ãã¾ã™ã€‚
')
insert('end', '
-3. ÌÖ¤«¤±', style_tag_big)
- insert('end', ' ¤³¤Î¤è¤¦¤ËÉÁ²è¤ÎºÝ¤Ë')
- insert('end', 'ÇØ·Ê¤â', style_tag_bgstipple)
- insert('end', 'ʸ»ú¤â', style_tag_fgstipple)
- insert('end', 'ñ¤Ê¤ëÅɤê¤Ä¤Ö¤·
-¤Ç¤Ê¤¯¡¢ÌÖ¤«¤±¤ò»È¤¦¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£
+3. ç¶²ã‹ã‘', style_tag_big)
+ insert('end', ' ã“ã®ã‚ˆã†ã«æç”»ã®éš›ã«')
+ insert('end', '背景も', style_tag_bgstipple)
+ insert('end', '文字も', style_tag_fgstipple)
+ insert('end', 'å˜ãªã‚‹å¡—りã¤ã¶ã—
+ã§ãªãã€ç¶²ã‹ã‘を使ã†ã“ã¨ãŒã§ãã¾ã™ã€‚
')
insert('end', '
-4. ²¼Àþ', style_tag_big)
- insert('end', ' ¤³¤Î¤è¤¦¤Ë')
- insert('end', 'ʸ»ú¤Ë²¼Àþ¤ò°ú¤¯', style_tag_underline)
- insert('end', '¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£
+4. 下線', style_tag_big)
+ insert('end', ' ã“ã®ã‚ˆã†ã«')
+ insert('end', '文字ã«ä¸‹ç·šã‚’引ã', style_tag_underline)
+ insert('end', 'ã“ã¨ãŒã§ãã¾ã™ã€‚
')
insert('end', '
-5. ÂǤÁ¾Ã¤·Àþ', style_tag_big)
- insert('end', ' ¤³¤Î¤è¤¦¤Ë')
- insert('end', 'ʸ»ú¤Ë½Å¤Í¤ÆÀþ¤ò°ú¤¯', style_tag_overstrike)
- insert('end', '¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£
+5. æ‰“ã¡æ¶ˆã—ç·š', style_tag_big)
+ insert('end', ' ã“ã®ã‚ˆã†ã«')
+ insert('end', '文字ã«é‡ã­ã¦ç·šã‚’引ã', style_tag_overstrike)
+ insert('end', 'ã“ã¨ãŒã§ãã¾ã™ã€‚
')
insert('end', '
-6. 3D ¸ú²Ì', style_tag_big)
- insert('end', ' ÇØ·Ê¤ËÏȤò¤Ä¤±¤Æ¡¢Ê¸»ú¤ò')
- insert('end', 'Èô¤Ó½Ð¤¹', style_tag_raised)
- insert('end', '¤è¤¦¤Ë¤·¤¿¤ê')
- insert('end', 'ÄÀ¤à', style_tag_sunken)
+6. 3D 効果', style_tag_big)
+ insert('end', ' èƒŒæ™¯ã«æž ã‚’ã¤ã‘ã¦ã€æ–‡å­—ã‚’')
+ insert('end', '飛ã³å‡ºã™', style_tag_raised)
+ insert('end', 'よã†ã«ã—ãŸã‚Š')
+ insert('end', '沈む', style_tag_sunken)
insert('end', '
-¤è¤¦¤Ë¤Ç¤­¤Þ¤¹¡£
+よã†ã«ã§ãã¾ã™ã€‚
')
insert('end', '
-7. ¹Ô·¤¨', style_tag_big)
- insert('end', ' ¤³¤Î¤è¤¦¤Ë¹Ô¤ò
+7. 行æƒãˆ', style_tag_big)
+ insert('end', ' ã“ã®ã‚ˆã†ã«è¡Œã‚’
')
- insert('end', 'º¸¤Ë·¤¨¤¿¤ê
+ insert('end', 'å·¦ã«æƒãˆãŸã‚Š
')
- insert('end', '±¦¤Ë·¤¨¤¿¤ê
+ insert('end', 'å³ã«æƒãˆãŸã‚Š
', style_tag_right)
- insert('end', '¿¿Ãæ¤Ë·¤¨¤¿¤ê¤Ç¤­¤Þ¤¹¡£
+ insert('end', 'çœŸä¸­ã«æƒãˆãŸã‚Šã§ãã¾ã™ã€‚
', style_tag_center)
insert('end', '
-8. ¸ªÉÕ¤­Ê¸»ú¤Èź»ú', style_tag_big)
+8. è‚©ä»˜ãæ–‡å­—ã¨æ·»å­—', style_tag_big)
insert('end', ' 10')
insert('end', 'n', style_tag_super)
- insert('end', ' ¤Î¤è¤¦¤Ë¸ªÉÕ¤­Ê¸»ú¤Î¸ú²Ì¤ä¡¢')
+ insert('end', ' ã®ã‚ˆã†ã«è‚©ä»˜ã文字ã®åŠ¹æžœã‚„ã€')
insert('end', '
X')
insert('end', 'i', style_tag_sub)
- insert('end', '¤Î¤è¤¦¤Ëź»ú¤Î¸ú²Ì¤ò½Ð¤¹¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£
+ insert('end', 'ã®ã‚ˆã†ã«æ·»å­—ã®åŠ¹æžœã‚’å‡ºã™ã“ã¨ãŒã§ãã¾ã™ã€‚
')
insert('end', '
-9. ¥Þ¡¼¥¸¥ó', style_tag_big)
- insert('end', '¥Æ¥­¥¹¥È¤Îº¸Â¦¤Ë;ʬ¤Ê¶õÇò¤òÃÖ¤¯¤³¤È¤¬¤Ç¤­¤Þ¤¹:
+9. マージン', style_tag_big)
+ insert('end', 'テキストã®å·¦å´ã«ä½™åˆ†ãªç©ºç™½ã‚’ç½®ãã“ã¨ãŒã§ãã¾ã™:
')
- insert('end', '¤³¤ÎÃÊÍî¤Ï¥Þ¡¼¥¸¥ó¤Î»ÈÍÑÎã¤Ç¤¹¡£¥¹¥¯¥ê¡¼¥ó',
+ insert('end', 'ã“ã®æ®µè½ã¯ãƒžãƒ¼ã‚¸ãƒ³ã®ä½¿ç”¨ä¾‹ã§ã™ã€‚スクリーン',
style_tag_margins)
- insert('end', '¾å¤ÇÀÞ¤êÊÖ¤µ¤ì¤ÆÉ½¼¨¤µ¤ì¤Æ¤¤¤ë1¹Ô¤Î¥Æ¥­¥¹¥È¤Ç¤¹¡£',
+ insert('end', 'ä¸Šã§æŠ˜ã‚Šè¿”ã•れã¦è¡¨ç¤ºã•れã¦ã„ã‚‹1行ã®ãƒ†ã‚­ã‚¹ãƒˆã§ã™ã€‚',
style_tag_margins)
- insert('end', 'º¸Â¦¤Ë¤Ï2¼ïÎà¤Î¥Þ¡¼¥¸¥ó¤ò»ý¤Á¤Þ¤¹¡£', style_tag_margins)
- insert('end', '1¹ÔÌܤËÂФ¹¤ë¤â¤Î¤È¡¢', style_tag_margins)
- insert('end', '2¹ÔÌܰʹߤÎϢ³¤·¤¿¥Þ¡¼¥¸¥ó', style_tag_margins)
- insert('end', '¤Ç¤¹¡£¤Þ¤¿±¦Â¦¤Ë¤â¥Þ¡¼¥¸¥ó¤¬¤¢¤ê¤Þ¤¹¡£', style_tag_margins)
- insert('end', '¹Ô¤ÎÀÞ¤êÊÖ¤·°ÌÃÖ¤ò·è¤á¤ë¤¿¤á¤Ë»ÈÍѤ¹¤ë¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£
+ insert('end', 'å·¦å´ã«ã¯2種類ã®ãƒžãƒ¼ã‚¸ãƒ³ã‚’æŒã¡ã¾ã™ã€‚', style_tag_margins)
+ insert('end', '1行目ã«å¯¾ã™ã‚‹ã‚‚ã®ã¨ã€', style_tag_margins)
+ insert('end', '2行目以é™ã®é€£ç¶šã—ãŸãƒžãƒ¼ã‚¸ãƒ³', style_tag_margins)
+ insert('end', 'ã§ã™ã€‚ã¾ãŸå³å´ã«ã‚‚マージンãŒã‚りã¾ã™ã€‚', style_tag_margins)
+ insert('end', 'è¡Œã®æŠ˜ã‚Šè¿”ã—ä½ç½®ã‚’決ã‚ã‚‹ãŸã‚ã«ä½¿ç”¨ã™ã‚‹ã“ã¨ãŒã§ãã¾ã™ã€‚
', style_tag_margins)
insert('end', '
-10. ¥¹¥Ú¡¼¥·¥ó¥°', style_tag_big)
- insert('end', '3¤Ä¤Î¥Ñ¥é¥á¡¼¥¿¤Ç¹Ô¤Î¥¹¥Ú¡¼¥·¥ó¥°¤ò')
- insert('end', 'À©¸æ¤¹
-¤ë¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£Spacing1¤Ç¡¢¹Ô¤Î')
- insert('end', '¾å¤Ë¤É¤Î¤¯¤é¤¤¤Î¶õ´Ö¤òÃÖ¤¯¤«¡¢
+10. スペーシング', style_tag_big)
+ insert('end', '3ã¤ã®ãƒ‘ラメータã§è¡Œã®ã‚¹ãƒšãƒ¼ã‚·ãƒ³ã‚°ã‚’')
+ insert('end', '制御ã™
+ã‚‹ã“ã¨ãŒã§ãã¾ã™ã€‚Spacing1ã§ã€è¡Œã®')
+ insert('end', '上ã«ã©ã®ãらã„ã®ç©ºé–“ã‚’ç½®ãã‹ã€
spacing3')
- insert('end', '¤Ç¹Ô¤Î²¼¤Ë¤É¤Î¤¯¤é¤¤¤Î¶õ´Ö¤òÃÖ¤¯¤«¡¢')
- insert('end', '¹Ô¤¬ÀÞ¤êÊÖ¤µ¤ì¤Æ¤¤¤ë¤Ê¤é
-¤Ð¡¢spacing2¤Ç¡¢')
- insert('end', '¥Æ¥­¥¹¥È¹Ô¤òÀ¸À®¤·¤Æ¤¤¤ë¹Ô¤Î´Ö¤Ë¤É¤Î¤¯¤é¤¤')
- insert('end', '¤Î¶õ´Ö¤òÃÖ
-¤¯¤«¤ò¼¨¤·¤Þ¤¹¡£
+ insert('end', 'ã§è¡Œã®ä¸‹ã«ã©ã®ãらã„ã®ç©ºé–“ã‚’ç½®ãã‹ã€')
+ insert('end', 'è¡ŒãŒæŠ˜ã‚Šè¿”ã•れã¦ã„ã‚‹ãªã‚‰
+ã°ã€spacing2ã§ã€')
+ insert('end', 'テキスト行を生æˆã—ã¦ã„る行ã®é–“ã«ã©ã®ãらã„')
+ insert('end', 'ã®ç©ºé–“ã‚’ç½®
+ãã‹ã‚’示ã—ã¾ã™ã€‚
')
- insert('end', '¤³¤ì¤é¤Î¥¤¥ó¥Ç¥ó¥È¤µ¤ì¤¿ÃÊÍî¤Ï¤É¤Î¤è¤¦¤Ë',
+ insert('end', 'ã“れらã®ã‚¤ãƒ³ãƒ‡ãƒ³ãƒˆã•ã‚ŒãŸæ®µè½ã¯ã©ã®ã‚ˆã†ã«',
style_tag_spacing)
- insert('end', '¥¹¥Ú¡¼¥·¥ó¥°¤¬¤¬¹Ô¤ï¤ì¤ë¤Î¤«¤ò¼¨¤·¤Þ¤¹¡£',
+ insert('end', 'スペーシングãŒãŒè¡Œã‚れるã®ã‹ã‚’示ã—ã¾ã™ã€‚',
style_tag_spacing)
- insert('end', '³ÆÃÊÍî¤Ï¼ÂºÝ¤Ï¥Æ¥­¥¹¥Èwidget', style_tag_spacing)
- insert('end', '¤Î1¹Ô¤Ç¡¢widget¤Ë¤è¤Ã¤ÆÀÞ¤ê¾ö¤Þ¤ì¤Æ¤¤¤Þ¤¹¡£
+ insert('end', '儿®µè½ã¯å®Ÿéš›ã¯ãƒ†ã‚­ã‚¹ãƒˆwidget', style_tag_spacing)
+ insert('end', 'ã®1行ã§ã€widgetã«ã‚ˆã£ã¦æŠ˜ã‚Šç•³ã¾ã‚Œã¦ã„ã¾ã™ã€‚
', style_tag_spacing)
- insert('end', 'Spacing1¤Ï¤³¤Î¥Æ¥­¥¹¥È¤Ç¤Ï10point¤Ë', style_tag_spacing)
- insert('end', 'ÀßÄꤵ¤ì¤Æ¤¤¤Þ¤¹¡£', style_tag_spacing)
- insert('end', '¤³¤ì¤Ë¤è¤ê¡¢ÃÊÍî¤Î´Ö¤ËÂ礭¤Ê´Ö³Ö¤¬', style_tag_spacing)
- insert('end', '¸ºß¤·¤Æ¤¤¤Þ¤¹¡£', style_tag_spacing)
- insert('end', 'Spacing2¤Ï2point¤ËÀßÄꤵ¤ì¤Æ¤¤¤Þ¤¹¡£', style_tag_spacing)
- insert('end', '¤³¤ì¤ÇÃÊÍî¤ÎÃæ¤Ë¤Û¤ó¤Î¾¯¤·´Ö³Ö¤¬Â¸ºß¤·¤Æ¤¤¤Þ¤¹¡£',
+ insert('end', 'Spacing1ã¯ã“ã®ãƒ†ã‚­ã‚¹ãƒˆã§ã¯10pointã«', style_tag_spacing)
+ insert('end', '設定ã•れã¦ã„ã¾ã™ã€‚', style_tag_spacing)
+ insert('end', 'ã“れã«ã‚ˆã‚Šã€æ®µè½ã®é–“ã«å¤§ããªé–“éš”ãŒ', style_tag_spacing)
+ insert('end', '存在ã—ã¦ã„ã¾ã™ã€‚', style_tag_spacing)
+ insert('end', 'Spacing2ã¯2pointã«è¨­å®šã•れã¦ã„ã¾ã™ã€‚', style_tag_spacing)
+ insert('end', 'ã“ã‚Œã§æ®µè½ã®ä¸­ã«ã»ã‚“ã®å°‘ã—é–“éš”ãŒå­˜åœ¨ã—ã¦ã„ã¾ã™ã€‚',
style_tag_spacing)
- insert('end', 'Spacing3¤Ï¤³¤ÎÎã¤Ç¤Ï»ÈÍѤµ¤ì¤Æ¤¤¤Þ¤»¤ó¡£
+ insert('end', 'Spacing3ã¯ã“ã®ä¾‹ã§ã¯ä½¿ç”¨ã•れã¦ã„ã¾ã›ã‚“。
', style_tag_spacing)
- insert('end', '´Ö³Ö¤¬¤É¤³¤Ë¤¢¤ë¤«¤ò¸«¤¿¤±¤ì¤Ð¡¢¤³¤ì¤é¤ÎÃÊÍî¤Î',
+ insert('end', 'é–“éš”ãŒã©ã“ã«ã‚ã‚‹ã‹ã‚’見ãŸã‘れã°ã€ã“ã‚Œã‚‰ã®æ®µè½ã®',
style_tag_spacing)
- insert('end', '¤Ê¤«¤Ç¥Æ¥­¥¹¥È¤òÁªÂò¤·¤Æ¤¯¤À¤µ¤¤¡£ÁªÂò¤Î', style_tag_spacing)
- insert('end', 'ȿž¤·¤¿Éôʬ¤Ë¤Ï;ʬ¤Ë¤È¤é¤ì¤¿´Ö³Ö¤¬', style_tag_spacing)
- insert('end', '´Þ¤Þ¤ì¤Æ¤¤¤Þ¤¹¡£
+ insert('end', 'ãªã‹ã§ãƒ†ã‚­ã‚¹ãƒˆã‚’é¸æŠžã—ã¦ãã ã•ã„ã€‚é¸æŠžã®', style_tag_spacing)
+ insert('end', 'å転ã—ãŸéƒ¨åˆ†ã«ã¯ä½™åˆ†ã«ã¨ã‚‰ã‚ŒãŸé–“éš”ãŒ', style_tag_spacing)
+ insert('end', 'å«ã¾ã‚Œã¦ã„ã¾ã™ã€‚
', style_tag_spacing)
}
diff --git a/ext/tk/sample/demos-jp/tcolor b/ext/tk/sample/demos-jp/tcolor
index 1c83a4b10b..f2d5458db4 100644
--- a/ext/tk/sample/demos-jp/tcolor
+++ b/ext/tk/sample/demos-jp/tcolor
@@ -1,20 +1,20 @@
#!/usr/bin/env ruby
-# -*- coding: euc-jp -*-
+# -*- coding: utf-8 -*-
#
# tcolor --
-# ¤³¤Î¥¹¥¯¥ê¥×¥È¤ÏRGB,HSB,CYM·Á¼°¤ò¥µ¥Ý¡¼¥È¤¹¤ë
-# ´Ê°×¥«¥é¡¼¥¨¥Ç¥£¥¿¤Ç¤¹¡£
+# ã“ã®ã‚¹ã‚¯ãƒªãƒ—トã¯RGB,HSB,CYMå½¢å¼ã‚’サãƒãƒ¼ãƒˆã™ã‚‹
+# 簡易カラーエディタã§ã™ã€‚
#
# Copyright (C) 1998 Takaaki Tateishi(ttate@jaist.ac.jp)
# last update: Thu Jun 18 06:32:35 JST 1998
#
-# ¤Þ¤º¤Ïtk.rb¤òÆÉ¤ß¹þ¤à¡£
+# ã¾ãšã¯tk.rbを読ã¿è¾¼ã‚€ã€‚
require "tk"
-# Tk¤Ë¤è¤Ã¤ÆÊѹ¹¤µ¤ì¤ëÊÑ¿ô¤ÏTkVariable¤Î¥¤¥ó¥¹¥¿¥ó¥¹¤ò»È¤¦¡£
+# Tkã«ã‚ˆã£ã¦å¤‰æ›´ã•れる変数ã¯TkVariableã®ã‚¤ãƒ³ã‚¹ã‚¿ãƒ³ã‚¹ã‚’使ã†ã€‚
$colorSpace = TkVariable.new(:rgb)
$master = nil
@@ -32,13 +32,13 @@ $label2 = TkVariable.new("label2")
$label3 = TkVariable.new("label3")
-# ¥ê¥½¡¼¥¹¥Ç¡¼¥¿¥Ù¡¼¥¹¤ÎÀßÄê
+# リソースデータベースã®è¨­å®š
if (TkVarAccess.new('tcl_platform')['platform'] == 'unix')
TkOptionDB.add('*Entry.background', 'white')
end
-# ³Æ¥¤¥Ù¥ó¥ÈÍѤΥ᥽¥Ã¥É
+# å„イベント用ã®ãƒ¡ã‚½ãƒƒãƒ‰
def rgbToHsv(red,green,blue)
@@ -277,7 +277,7 @@ end
-# tcolorÍѤΥá¥Ë¥å¡¼
+# tcolor用ã®ãƒ¡ãƒ‹ãƒ¥ãƒ¼
class TkColorMenuFrame<TkFrame
def initialize(parent)
@@ -285,10 +285,10 @@ class TkColorMenuFrame<TkFrame
"relief"=>"raised",
"borderwidth"=>"2")
- # File¥á¥Ë¥å¡¼¥Ü¥¿¥ó¤ÎÀ¸À®
+ # Fileメニューボタンã®ç”Ÿæˆ
@file = TkMenubutton.new(self){|button|
- # File¥á¥Ë¥å¡¼¤ÎºîÀ®
+ # Fileメニューã®ä½œæˆ
@file_menu = TkMenu.new(button){
add "radio",
"label" => "RGB color space",
@@ -326,7 +326,7 @@ class TkColorMenuFrame<TkFrame
"command" => proc{exit}
}
- # File¥á¥Ë¥å¡¼¤ÈFile¥Ü¥¿¥ó¤ò´ØÏ¢ÉÕ¤±¤ë
+ # Fileメニューã¨Fileボタンを関連付ã‘ã‚‹
menu @file_menu
text "File"
@@ -338,7 +338,7 @@ class TkColorMenuFrame<TkFrame
end
-# ²¼Éô¤Î¥Õ¥ì¡¼¥à¤Î¤¿¤á¤Î¥¯¥é¥¹
+# 下部ã®ãƒ•レームã®ãŸã‚ã®ã‚¯ãƒ©ã‚¹
class TkColorBotFrame<TkFrame
def initialize(parent)
super(parent,
@@ -364,7 +364,7 @@ class TkColorBotFrame<TkFrame
end
-# ÃæÃʺ¸¤Î¥Õ¥ì¡¼¥à
+# 中段左ã®ãƒ•レーム
class TkColorMiddleLeftFrame<TkFrame
def initialize(parent)
super(parent)
@@ -408,9 +408,9 @@ class TkColorMiddleLeftFrame<TkFrame
end
-# ÃæÃÊÃæ±û¤Î¥Õ¥ì¡¼¥à
+# 中段中央ã®ãƒ•レーム
class TkColorMiddleMiddleFrame<TkFrame
- # @scale1,@scale2,@scale3¤ò³°Éô¤«¤é»²¾È¤Î¤ßµö²Ä¤¹¤ë¡£(Êѹ¹ÉÔ²Ä)
+ # @scale1,@scale2,@scale3を外部ã‹ã‚‰å‚ç…§ã®ã¿è¨±å¯ã™ã‚‹ã€‚(変更ä¸å¯)
attr_reader :scale1, :scale2, :scale3
def initialize(parent)
@@ -485,7 +485,7 @@ end
-# ÃæÃʤΥե졼¥à
+# 中段ã®ãƒ•レーム
class TkColorMiddleFrame<TkFrame
attr_reader :left, :middle, :right
@@ -529,6 +529,6 @@ end
$root = TkColor.new
-# ¥¤¥Ù¥ó¥È¤òÂԤİ٤˥롼¥×¤ËÆþ¤ë¡£
+# イベントを待ã¤ç‚ºã«ãƒ«ãƒ¼ãƒ—ã«å…¥ã‚‹ã€‚
changeColorSpace :rgb
Tk.mainloop
diff --git a/ext/tk/sample/demos-jp/text.rb b/ext/tk/sample/demos-jp/text.rb
index ea15064830..e698a79246 100644
--- a/ext/tk/sample/demos-jp/text.rb
+++ b/ext/tk/sample/demos-jp/text.rb
@@ -1,15 +1,15 @@
-# -*- coding: euc-jp -*-
+# -*- coding: utf-8 -*-
#
# text (basic facilities) widget demo (called by 'widget')
#
-# toplevel widget ¤¬Â¸ºß¤¹¤ì¤Ðºï½ü¤¹¤ë
+# toplevel widget ãŒå­˜åœ¨ã™ã‚Œã°å‰Šé™¤ã™ã‚‹
if defined?($text_demo) && $text_demo
$text_demo.destroy
$text_demo = nil
end
-# demo ÍѤΠtoplevel widget ¤òÀ¸À®
+# demo 用㮠toplevel widget を生æˆ
$text_demo = TkToplevel.new {|w|
title("Text Demonstration - Basic Facilities")
iconname("text")
@@ -25,11 +25,11 @@ else
undo_support = true
end
-# frame À¸À®
+# frame 生æˆ
TkFrame.new(base_frame) {|frame|
TkButton.new(frame) {
- #text 'λ²ò'
- text 'ÊĤ¸¤ë'
+ #text '了解'
+ text 'é–‰ã˜ã‚‹'
command proc{
tmppath = $text_demo
$text_demo = nil
@@ -38,14 +38,14 @@ TkFrame.new(base_frame) {|frame|
}.pack('side'=>'left', 'expand'=>'yes')
TkButton.new(frame) {
- text '¥³¡¼¥É»²¾È'
+ text 'コードå‚ç…§'
command proc{showCode 'text'}
}.pack('side'=>'left', 'expand'=>'yes')
}.pack('side'=>'bottom', 'fill'=>'x', 'pady'=>'2m')
-# text À¸À®
+# text 生æˆ
TkText.new(base_frame){|t|
- # À¸À®
+ # 生æˆ
relief 'sunken'
bd 2
setgrid 1
@@ -57,62 +57,62 @@ TkText.new(base_frame){|t|
}
pack('expand'=>'yes', 'fill'=>'both')
- # ¥Æ¥­¥¹¥ÈÁÞÆþ
+ # テキスト挿入
insert('0.0', <<EOT)
-¤³¤Î¥¦¥£¥ó¥É¥¦¤Ï¥Æ¥­¥¹¥È widget ¤Ç¤¹¡£1¹Ô¤Þ¤¿¤Ï¤½¤ì°Ê¾å¤Î¥Æ¥­¥¹¥È¤òɽ
-¼¨¡¦ÊÔ½¸¤¹¤ë¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£°Ê²¼¤Ï¥Æ¥­¥¹¥È widget ¤Ç¤Ç¤­¤ëÁàºî¤Ë¤Ä¤¤¤Æ
-¤Þ¤È¤á¤¿¤â¤Î¤Ç¤¹¡£
-
-1. ¥¹¥¯¥í¡¼¥ë¡£¥¹¥¯¥í¡¼¥ë¥Ð¡¼¤Ç¥Æ¥­¥¹¥È¤Îɽ¼¨Éôʬ¤òư¤«¤¹¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£
-
-2. ¥¹¥­¥ã¥Ë¥ó¥°¡£¥Æ¥­¥¹¥È¤Î¥¦¥£¥ó¥É¥¦¤Ç¥Þ¥¦¥¹¥Ü¥¿¥ó2 (Ãæ¥Ü¥¿¥ó¤ò) ¤ò²¡
-¤·¤Æ¾å²¼¤Ë¥É¥é¥Ã¥°¤·¤Æ¤¯¤À¤µ¤¤¡£¤½¤¦¤¹¤ë¤È¥Æ¥­¥¹¥È¤¬¹â®¤Ç¥É¥é¥Ã¥°¤µ¤ì¡¢
-ÆâÍÆ¤ò¤¶¤Ã¤Èį¤á¤ë¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£
-
-3. ¥Æ¥­¥¹¥È¤ÎÁÞÆþ¡£¥Þ¥¦¥¹¥Ü¥¿¥ó1 (º¸¥Ü¥¿¥ó) ¤ò²¡¤·¡¢ÁÞÆþ¥«¡¼¥½¥ë¤ò¥»¥Ã
-¥È¤·¤Æ¤«¤é¥Æ¥­¥¹¥È¤òÆþÎϤ·¤Æ¤¯¤À¤µ¤¤¡£ÆþÎϤ·¤¿¤â¤Î¤¬ widget ¤ËÆþ¤ê¤Þ¤¹¡£
-
-4. ÁªÂò¡£¤¢¤ëÈϰϤÎʸ»ú¤òÁªÂò¤¹¤ë¤Ë¤Ï¥Þ¥¦¥¹¥Ü¥¿¥ó1 ¤ò²¡¤·¡¢¥É¥é¥Ã¥°¤·
-¤Æ¤¯¤À¤µ¤¤¡£°ìÅ٥ܥ¿¥ó¤òÎ¥¤·¤¿¤é¡¢¥·¥Õ¥È¥­¡¼¤ò²¡¤·¤Ê¤¬¤é¥Ü¥¿¥ó1 ¤ò²¡¤¹
-¤³¤È¤ÇÁªÂòÈϰϤÎÄ´À°¤¬¤Ç¤­¤Þ¤¹¡£¤³¤ì¤ÏÁªÂòÈϰϤκǸå¤ò¥Þ¥¦¥¹¥«¡¼¥½¥ë¤Ë
-ºÇ¤â¶á¤¤°ÌÃ֤˥ꥻ¥Ã¥È¤·¡¢¥Ü¥¿¥ó¤òÎ¥¤¹Á°¤Ë¥Þ¥¦¥¹¤ò¥É¥é¥Ã¥°¤¹¤ë¤³¤È¤Ç¤µ
-¤é¤ËÁªÂòÈϰϤòÄ´À°¤Ç¤­¤Þ¤¹¡£¥À¥Ö¥ë¥¯¥ê¥Ã¥¯¤Ç¥ï¡¼¥É¤ò¡¢¤Þ¤¿¥È¥ê¥×¥ë¥¯¥ê¥Ã
-¥¯¤Ç¹ÔÁ´ÂΤòÁªÂò¤¹¤ë¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£
-
-5. ¾Ãµî¤ÈÃÖ´¹¡£¥Æ¥­¥¹¥È¤ò¾Ãµî¤¹¤ë¤Ë¤Ï¡¢¾Ãµî¤·¤¿¤¤Ê¸»ú¤òÁªÂò¤·¤Æ¥Ð¥Ã¥¯
-¥¹¥Ú¡¼¥¹¤«¥Ç¥ê¡¼¥È¥­¡¼¤òÆþÎϤ·¤Æ¤¯¤À¤µ¤¤¡£¤¢¤ë¤¤¤Ï¡¢¿·¤·¤¤¥Æ¥­¥¹¥È¤ò
-ÆþÎϤ¹¤ë¤ÈÁªÂò¤µ¤ì¤¿¥Æ¥­¥¹¥È¤ÈÃÖ´¹¤µ¤ì¤Þ¤¹¡£
-
-6. ÁªÂòÉôʬ¤Î¥³¥Ô¡¼¡£ÁªÂòÉôʬ¤ò¤³¤Î¥¦¥£¥ó¥É¥¦¤ÎÃæ¤Î¤É¤³¤«¤Ë¥³¥Ô¡¼¤¹¤ë
-¤Ë¤Ï¡¢¤Þ¤º¥³¥Ô¡¼¤·¤¿¤¤½ê¤òÁªÂò(¤³¤³¤Ç¡¢¤¢¤ë¤¤¤ÏÊ̤Υ¢¥×¥ê¥±¡¼¥·¥ç¥ó¤Ç)
-¤·¡¢¥Ü¥¿¥ó 2 ¤ò¥¯¥ê¥Ã¥¯¤·¤Æ¡¢ÁÞÆþ¥«¡¼¥½¥ë¤Î°ÌÃ֤˥³¥Ô¡¼¤·¤Æ¤¯¤À¤µ¤¤¡£
-
-7. ÊÔ½¸¡£¥Æ¥­¥¹¥È widget ¤Ï Emacs ¤Î¥­¡¼¥Ð¥¤¥ó¥É¤Ë²Ã¤¨¤ÆÉ¸½àŪ¤Ê¤Î Motif
-¤ÎÊÔ½¸µ¡Ç½¤ò¥µ¥Ý¡¼¥È¤·¤Æ¤¤¤Þ¤¹¡£¥Ð¥Ã¥¯¥¹¥Ú¡¼¥¹¤È¥³¥ó¥È¥í¡¼¥ë-H ¤ÏÁÞÆþ
-¥«¡¼¥½¥ë¤Îº¸Â¦¤Îʸ»ú¤òºï½ü¤·¤Þ¤¹¡£¥Ç¥ê¡¼¥È¥­¡¼¤È¥³¥ó¥È¥í¡¼¥ë-D ¤ÏÁÞÆþ
-¥«¡¼¥½¥ë¤Î±¦Â¦¤Îʸ»ú¤òºï½ü¤·¤Þ¤¹¡£Meta-¥Ð¥Ã¥¯¥¹¥Ú¡¼¥¹¤ÏÁÞÆþ¥«¡¼¥½¥ë¤Î
-±¦Â¦¤Îñ¸ì¤òºï½ü¤·¡¢Meta-D ¤ÏÁÞÆþ¥«¡¼¥½¥ë¤Îº¸Â¦¤Îñ¸ì¤òºï½ü¤·¤Þ¤¹¡£
-¥³¥ó¥È¥í¡¼¥ë-K ¤ÏÁÞÆþ¥«¡¼¥½¥ë¤«¤é¹ÔËö¤Þ¤Ç¤òºï½ü¤·¡¢¤½¤Î°ÌÃ֤˲þ¹Ô
-¤·¤«¤Ê¤«¤Ã¤¿¾ì¹ç¤Ï¡¢²þ¹Ô¤òºï½ü¤·¤Þ¤¹¡£#{
+ã“ã®ã‚¦ã‚£ãƒ³ãƒ‰ã‚¦ã¯ãƒ†ã‚­ã‚¹ãƒˆ widget ã§ã™ã€‚1行ã¾ãŸã¯ãれ以上ã®ãƒ†ã‚­ã‚¹ãƒˆã‚’表
+示・編集ã™ã‚‹ã“ã¨ãŒã§ãã¾ã™ã€‚以下ã¯ãƒ†ã‚­ã‚¹ãƒˆ widget ã§ã§ãã‚‹æ“作ã«ã¤ã„ã¦
+ã¾ã¨ã‚ãŸã‚‚ã®ã§ã™ã€‚
+
+1. スクロール。スクロールãƒãƒ¼ã§ãƒ†ã‚­ã‚¹ãƒˆã®è¡¨ç¤ºéƒ¨åˆ†ã‚’å‹•ã‹ã™ã“ã¨ãŒã§ãã¾ã™ã€‚
+
+2. スキャニング。テキストã®ã‚¦ã‚£ãƒ³ãƒ‰ã‚¦ã§ãƒžã‚¦ã‚¹ãƒœã‚¿ãƒ³2 (中ボタンを) を押
+ã—ã¦ä¸Šä¸‹ã«ãƒ‰ãƒ©ãƒƒã‚°ã—ã¦ãã ã•ã„。ãã†ã™ã‚‹ã¨ãƒ†ã‚­ã‚¹ãƒˆãŒé«˜é€Ÿã§ãƒ‰ãƒ©ãƒƒã‚°ã•れã€
+内容をã–ã£ã¨çœºã‚ã‚‹ã“ã¨ãŒã§ãã¾ã™ã€‚
+
+3. ãƒ†ã‚­ã‚¹ãƒˆã®æŒ¿å…¥ã€‚マウスボタン1 (左ボタン) を押ã—ã€æŒ¿å…¥ã‚«ãƒ¼ã‚½ãƒ«ã‚’セッ
+トã—ã¦ã‹ã‚‰ãƒ†ã‚­ã‚¹ãƒˆã‚’入力ã—ã¦ãã ã•ã„。入力ã—ãŸã‚‚ã®ãŒ widget ã«å…¥ã‚Šã¾ã™ã€‚
+
+4. é¸æŠžã€‚ã‚ã‚‹ç¯„å›²ã®æ–‡å­—ã‚’é¸æŠžã™ã‚‹ã«ã¯ãƒžã‚¦ã‚¹ãƒœã‚¿ãƒ³1 を押ã—ã€ãƒ‰ãƒ©ãƒƒã‚°ã—
+ã¦ãã ã•ã„。一度ボタンを離ã—ãŸã‚‰ã€ã‚·ãƒ•トキーを押ã—ãªãŒã‚‰ãƒœã‚¿ãƒ³1 を押ã™
+ã“ã¨ã§é¸æŠžç¯„囲ã®èª¿æ•´ãŒã§ãã¾ã™ã€‚ã“れã¯é¸æŠžç¯„å›²ã®æœ€å¾Œã‚’マウスカーソルã«
+最も近ã„ä½ç½®ã«ãƒªã‚»ãƒƒãƒˆã—ã€ãƒœã‚¿ãƒ³ã‚’離ã™å‰ã«ãƒžã‚¦ã‚¹ã‚’ドラッグã™ã‚‹ã“ã¨ã§ã•
+らã«é¸æŠžç¯„囲を調整ã§ãã¾ã™ã€‚ダブルクリックã§ãƒ¯ãƒ¼ãƒ‰ã‚’ã€ã¾ãŸãƒˆãƒªãƒ—ルクリッ
+クã§è¡Œå…¨ä½“ã‚’é¸æŠžã™ã‚‹ã“ã¨ãŒã§ãã¾ã™ã€‚
+
+5. 消去ã¨ç½®æ›ã€‚テキストを消去ã™ã‚‹ã«ã¯ã€æ¶ˆåŽ»ã—ãŸã„æ–‡å­—ã‚’é¸æŠžã—ã¦ãƒãƒƒã‚¯
+スペースã‹ãƒ‡ãƒªãƒ¼ãƒˆã‚­ãƒ¼ã‚’入力ã—ã¦ãã ã•ã„。ã‚ã‚‹ã„ã¯ã€æ–°ã—ã„テキストを
+入力ã™ã‚‹ã¨é¸æŠžã•れãŸãƒ†ã‚­ã‚¹ãƒˆã¨ç½®æ›ã•れã¾ã™ã€‚
+
+6. é¸æŠžéƒ¨åˆ†ã®ã‚³ãƒ”ãƒ¼ã€‚é¸æŠžéƒ¨åˆ†ã‚’ã“ã®ã‚¦ã‚£ãƒ³ãƒ‰ã‚¦ã®ä¸­ã®ã©ã“ã‹ã«ã‚³ãƒ”ーã™ã‚‹
+ã«ã¯ã€ã¾ãšã‚³ãƒ”ーã—ãŸã„æ‰€ã‚’é¸æŠž(ã“ã“ã§ã€ã‚ã‚‹ã„ã¯åˆ¥ã®ã‚¢ãƒ—リケーションã§)
+ã—ã€ãƒœã‚¿ãƒ³ 2 をクリックã—ã¦ã€æŒ¿å…¥ã‚«ãƒ¼ã‚½ãƒ«ã®ä½ç½®ã«ã‚³ãƒ”ーã—ã¦ãã ã•ã„。
+
+7. 編集。テキスト widget 㯠Emacs ã®ã‚­ãƒ¼ãƒã‚¤ãƒ³ãƒ‰ã«åŠ ãˆã¦æ¨™æº–çš„ãªã® Motif
+ã®ç·¨é›†æ©Ÿèƒ½ã‚’サãƒãƒ¼ãƒˆã—ã¦ã„ã¾ã™ã€‚ãƒãƒƒã‚¯ã‚¹ãƒšãƒ¼ã‚¹ã¨ã‚³ãƒ³ãƒˆãƒ­ãƒ¼ãƒ«-H ã¯æŒ¿å…¥
+カーソルã®å·¦å´ã®æ–‡å­—を削除ã—ã¾ã™ã€‚デリートキーã¨ã‚³ãƒ³ãƒˆãƒ­ãƒ¼ãƒ«-D ã¯æŒ¿å…¥
+カーソルã®å³å´ã®æ–‡å­—を削除ã—ã¾ã™ã€‚Meta-ãƒãƒƒã‚¯ã‚¹ãƒšãƒ¼ã‚¹ã¯æŒ¿å…¥ã‚«ãƒ¼ã‚½ãƒ«ã®
+å³å´ã®å˜èªžã‚’削除ã—ã€Meta-D ã¯æŒ¿å…¥ã‚«ãƒ¼ã‚½ãƒ«ã®å·¦å´ã®å˜èªžã‚’削除ã—ã¾ã™ã€‚
+コントロール-K ã¯æŒ¿å…¥ã‚«ãƒ¼ã‚½ãƒ«ã‹ã‚‰è¡Œæœ«ã¾ã§ã‚’削除ã—ã€ãã®ä½ç½®ã«æ”¹è¡Œ
+ã—ã‹ãªã‹ã£ãŸå ´åˆã¯ã€æ”¹è¡Œã‚’削除ã—ã¾ã™ã€‚#{
if undo_support
- undo_text = "Control-z ¤ÏºÇ¸å¤Ë¹Ô¤Ã¤¿Êѹ¹¤Î¼è¤ê¾Ã¤·(undo)¤ò¹Ô¤¤¡¢"
+ undo_text = "Control-z ã¯æœ€å¾Œã«è¡Œã£ãŸå¤‰æ›´ã®å–り消ã—(undo)を行ã„ã€"
case $tk_platform['platform']
when "unix", "macintosh"
undo_text << "Control-Shift-z"
else # 'windows'
undo_text << "Control-y"
end
- undo_text << "¤Ïundo¤·¤¿Êѹ¹¤ÎºÆÅ¬ÍÑ(redo)¤ò¹Ô¤¤¤Þ¤¹¡£"
+ undo_text << "ã¯undoã—ãŸå¤‰æ›´ã®å†é©ç”¨(redo)を行ã„ã¾ã™ã€‚"
else
""
end
}
-8. ¥¦¥£¥ó¥É¥¦¤Î¥ê¥µ¥¤¥º¡£¤³¤Î widget ¤Ï "setGrid" ¥ª¥×¥·¥ç¥ó¤ò¥ª¥ó¤Ë¤·
-¤Æ¤¢¤ê¤Þ¤¹¤Î¤Ç¡¢¥¦¥£¥ó¥É¥¦¤ò¥ê¥µ¥¤¥º¤¹¤ë»þ¤Ë¤Ï¹â¤µ¤ÈÉý¤Ï¾ï¤Ëʸ»ú¹â¤Èʸ
-»úÉý¤ÎÀ°¿ôÇܤˤʤê¤Þ¤¹¡£¤Þ¤¿¡¢¥¦¥£¥ó¥É¥¦¤ò¶¹¤¯¤·¤¿¾ì¹ç¤Ë¤ÏŤ¤¹Ô¤¬¼«Æ°
-Ū¤ËÀÞ¤êÊÖ¤µ¤ì¡¢¾ï¤ËÁ´¤Æ¤ÎÆâÍÆ¤¬¸«¤¨¤ë¤è¤¦¤Ë¤Ê¤Ã¤Æ¤¤¤Þ¤¹¡£
+8. ウィンドウã®ãƒªã‚µã‚¤ã‚ºã€‚ã“ã® widget 㯠"setGrid" オプションをオンã«ã—
+ã¦ã‚りã¾ã™ã®ã§ã€ã‚¦ã‚£ãƒ³ãƒ‰ã‚¦ã‚’リサイズã™ã‚‹æ™‚ã«ã¯é«˜ã•ã¨å¹…ã¯å¸¸ã«æ–‡å­—é«˜ã¨æ–‡
+å­—å¹…ã®æ•´æ•°å€ã«ãªã‚Šã¾ã™ã€‚ã¾ãŸã€ã‚¦ã‚£ãƒ³ãƒ‰ã‚¦ã‚’ç‹­ãã—ãŸå ´åˆã«ã¯é•·ã„行ãŒè‡ªå‹•
+çš„ã«æŠ˜ã‚Šè¿”ã•れã€å¸¸ã«å…¨ã¦ã®å†…容ãŒè¦‹ãˆã‚‹ã‚ˆã†ã«ãªã£ã¦ã„ã¾ã™ã€‚
EOT
set_insert('0.0')
diff --git a/ext/tk/sample/demos-jp/textpeer.rb b/ext/tk/sample/demos-jp/textpeer.rb
index de604f1940..4d896d2a12 100644
--- a/ext/tk/sample/demos-jp/textpeer.rb
+++ b/ext/tk/sample/demos-jp/textpeer.rb
@@ -1,4 +1,4 @@
-# -*- coding: euc-jp -*-
+# -*- coding: utf-8 -*-
#
# text widget peering demo (called by 'widget')
#
@@ -22,17 +22,17 @@ count = [0]
## Define a widget that we peer from; it won't ever actually be shown though
first = TkText.new(base_frame, :widgetname=>"text#{count[0] += 1}")
-first.insert :end,"¤³¤Î¥Ç¥â¤Ï°ì¤Ä¤ÎÁȤòÀ®¤·¤¿¥Æ¥­¥¹¥È¥¦¥£¥¸¥§¥Ã¥È¤ò¼¨¤·¤Þ¤¹¡£"
-first.insert :end,"¤½¤ì¤é¤Î¥Æ¥­¥¹¥È¥¦¥£¥¸¥§¥Ã¥È¤ÏÂÐÅù(¥Ô¥¢;peer)¤Î´Ø·¸¤Ë"
-first.insert :end,"¤Ê¤Ã¤Æ¤¤¤Þ¤¹¡£"
-first.insert :end,"¤½¤ì¤é¤Ï¡¢´ðÈפȤʤë¥Ç¡¼¥¿¥â¥Ç¥ë¤Ï¶¦Ä̤Τâ¤Î¤ò»ý¤Á¤Þ¤¹¤¬¡¢"
-first.insert :end,"²èÌÌɽ¼¨°ÌÃÖ¡¢ÊÔ½¸°ÌÃÖ¡¢ÁªÂòÈϰÏ(selection)¤Ë¤Ä¤¤¤Æ¤Ï"
-first.insert :end,"ÆÈΩ¤Ë»ý¤Ä¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£"
-first.insert :end,"³Æ¥Æ¥­¥¹¥È¥¦¥£¥¸¥§¥Ã¥È¤ÎÏÆ¤Ë¤¢¤ë"
-first.insert :end,"¡Ö¥Ô¥¢(peer)¤ÎºîÀ®¡×¥Ü¥¿¥ó¤ò»È¤¨¤Ð¡¢"
-first.insert :end,"¿·¤¿¤Ê¥Ô¥¢¤òÄɲ乤뤳¤È¤¬²Äǽ¤Ç¤¹¡£"
-first.insert :end,"¤Þ¤¿¡Ö¥Ô¥¢(peer)¤Î¾Ãµî¡×¥Ü¥¿¥ó¤ò»È¤¨¤Ð¡¢"
-first.insert :end,"ÆÃÄê¤Î¥Ô¥¢¥¦¥£¥¸¥§¥Ã¥È¤ò¾Ãµî¤¹¤ë¤³¤È¤â¤Ç¤­¤Þ¤¹¡£"
+first.insert :end,"ã“ã®ãƒ‡ãƒ¢ã¯ä¸€ã¤ã®çµ„ã‚’æˆã—ãŸãƒ†ã‚­ã‚¹ãƒˆã‚¦ã‚£ã‚¸ã‚§ãƒƒãƒˆã‚’示ã—ã¾ã™ã€‚"
+first.insert :end,"ãれらã®ãƒ†ã‚­ã‚¹ãƒˆã‚¦ã‚£ã‚¸ã‚§ãƒƒãƒˆã¯å¯¾ç­‰(ピア;peer)ã®é–¢ä¿‚ã«"
+first.insert :end,"ãªã£ã¦ã„ã¾ã™ã€‚"
+first.insert :end,"ãれらã¯ã€åŸºç›¤ã¨ãªã‚‹ãƒ‡ãƒ¼ã‚¿ãƒ¢ãƒ‡ãƒ«ã¯å…±é€šã®ã‚‚ã®ã‚’æŒã¡ã¾ã™ãŒã€"
+first.insert :end,"ç”»é¢è¡¨ç¤ºä½ç½®ã€ç·¨é›†ä½ç½®ã€é¸æŠžç¯„囲(selection)ã«ã¤ã„ã¦ã¯"
+first.insert :end,"ç‹¬ç«‹ã«æŒã¤ã“ã¨ãŒã§ãã¾ã™ã€‚"
+first.insert :end,"å„テキストウィジェットã®è„‡ã«ã‚ã‚‹"
+first.insert :end,"「ピア(peer)ã®ä½œæˆã€ãƒœã‚¿ãƒ³ã‚’使ãˆã°ã€"
+first.insert :end,"æ–°ãŸãªãƒ”アを追加ã™ã‚‹ã“ã¨ãŒå¯èƒ½ã§ã™ã€‚"
+first.insert :end,"ã¾ãŸã€Œãƒ”ã‚¢(peer)ã®æ¶ˆåŽ»ã€ãƒœã‚¿ãƒ³ã‚’使ãˆã°ã€"
+first.insert :end,"特定ã®ãƒ”アウィジェットを消去ã™ã‚‹ã“ã¨ã‚‚ã§ãã¾ã™ã€‚"
Tk.update_idletasks ## for 'first' widget
@@ -44,10 +44,10 @@ def makeClone(count, win, txt)
sbar = TkScrollbar.new(win, :widgetname=>"sb#{cnt}")
peer.yscrollbar sbar
b1 = TkButton.new(win, :widgetname=>"clone#{cnt}",
- :text=>'¥Ô¥¢(peer)¤ÎºîÀ®',
+ :text=>'ピア(peer)ã®ä½œæˆ',
:command=>proc{makeClone(count, win, peer)})
b2 = TkButton.new(win, :widgetname=>"kill#{cnt}",
- :text=>'¥Ô¥¢(peer)¤Î¾Ãµî',
+ :text=>'ピア(peer)ã®æ¶ˆåŽ»',
:command=>proc{killClone(win, cnt)})
row = cnt * 2
TkGrid.configure(peer, sbar, b1, :sticky=>'nsew', :row=>row)
@@ -68,12 +68,12 @@ first.destroy
## See Code / Dismiss buttons
TkFrame.new(base_frame){|f|
- TkButton.new(f, :text=>'ÊĤ¸¤ë', :width=>15, :command=>proc{
+ TkButton.new(f, :text=>'é–‰ã˜ã‚‹', :width=>15, :command=>proc{
$textpeer_demo.destroy
$textpeer_demo = nil
}).pack(:side=>:left, :expand=>true)
- TkButton.new(f, :text=>'¥³¡¼¥É»²¾È', :width=>15, :command=>proc{
+ TkButton.new(f, :text=>'コードå‚ç…§', :width=>15, :command=>proc{
showCode 'textpeer'
}).pack(:side=>:left, :expand=>true)
diff --git a/ext/tk/sample/demos-jp/toolbar.rb b/ext/tk/sample/demos-jp/toolbar.rb
index 570d52704f..3ee7a5f9d8 100644
--- a/ext/tk/sample/demos-jp/toolbar.rb
+++ b/ext/tk/sample/demos-jp/toolbar.rb
@@ -1,4 +1,4 @@
-# -*- coding: euc-jp -*-
+# -*- coding: utf-8 -*-
#
# toolbar.rb --
#
@@ -21,32 +21,32 @@ base_frame = Ttk::Frame.new($toolbar_demo).pack(:fill=>:both, :expand=>true)
if Tk.windowingsystem != 'aqua'
msg = Ttk::Label.new(base_frame, :wraplength=>'4i', :text=><<EOL)
-¤³¤Î¥Ç¥â¤Ç¤Ï¡¤¥Ä¡¼¥ë¥Ð¡¼¤ò¤É¤Î¤è¤¦¤Ë¤·¤ÆÅ¬Àڤ˥ơ¼¥ÞÂбþ¤µ¤»¤ë¤«¡¤\
-¤Þ¤¿¡¤¤É¤Î¤è¤¦¤Ë¤·¤ÆÀÚ¤êÎ¥¤·²Äǽ¤Ë¤¹¤ë¤«¤ò¼¨¤·¤Æ¤¤¤Þ¤¹\
-¡Ê¤¿¤À¤·¡¤¥Ä¡¼¥ë¥Ð¡¼¤ÎÀÚ¤êÎ¥¤·¤Ë¤ÏTcl/Tk8.5°Ê¾å¤Îµ¡Ç½¤¬É¬ÍפǤ¹¡Ë¡¥\
-¥Ä¡¼¥ë¥Ð¡¼¤Î¥Ü¥¿¥ó¤Ï¡¤'Toolbutton'¥¹¥¿¥¤¥ë¤ò»ÈÍѤ¹¤ë¤è¤¦¤ËÌÀ¼¨¤¹¤ë¤³¤È¤Ç¡¤\
-"toolbar style"¥Ü¥¿¥ó¤È¤Ê¤ë¤è¤¦¤Ë°À­ÀßÄꤵ¤ì¤Æ¤¤¤Þ¤¹¡¥\
-¥Ä¡¼¥ë¥Ð¡¼¤Îº¸Ã¼¤Ë¤Ï´Êñ¤Ê¥Þ¡¼¥«¡¼¤¬ÃÖ¤«¤ì¤Æ¤¤¤Þ¤¹¡¥\
-¥Þ¡¼¥«¡¼¾å¤Ë¥Þ¥¦¥¹¥«¡¼¥½¥ë¤¬Íè¤ë¤È°Üư¥¢¥¤¥³¥ó¤Ë¥«¡¼¥½¥ë¤¬ÊѲ½¤·¤Þ¤¹¡¥\
-¤½¤³¤Ç¥Ä¡¼¥ë¥Ð¡¼¤òư¤«¤¹¤è¤¦¤Ë¥É¥é¥Ã¥°¤¹¤ë¤È¡¤\
-¥Ä¡¼¥ë¥Ð¡¼Á´ÂΤòÀÚ¤êÎ¥¤·¤ÆÆÈΩ¤·¤¿¥È¥Ã¥×¥ì¥Ù¥ë¥¦¥£¥¸¥§¥Ã¥È¤Ë\
-¤¹¤ë¤³¤È¤¬¤Ç¤­¤Þ¤¹¡¥\
-ÀÚ¤êÎ¥¤·¤¿¥Ä¡¼¥ë¥Ð¡¼¤¬ÉÔÍפȤʤä¿»þ¤Ë¤Ï¡¤\
-°ìÈÌŪ¤Ê¥È¥Ã¥×¥ì¥Ù¥ë¥¦¥£¥¸¥§¥Ã¥È¤ÈƱÍͤËñ½ã¤ËÊĤ¸¤ë¤³¤È¤Ç¡¤
-ºÆ¤Ó¸µ¤Î¥¦¥£¥ó¥É¥¦¤ËÄ¥¤êÉÕ¤±¤é¤ì¤ë¤Ç¤·¤ç¤¦¡¥
+ã“ã®ãƒ‡ãƒ¢ã§ã¯ï¼Œãƒ„ールãƒãƒ¼ã‚’ã©ã®ã‚ˆã†ã«ã—ã¦é©åˆ‡ã«ãƒ†ãƒ¼ãƒžå¯¾å¿œã•ã›ã‚‹ã‹ï¼Œ\
+ã¾ãŸï¼Œã©ã®ã‚ˆã†ã«ã—ã¦åˆ‡ã‚Šé›¢ã—å¯èƒ½ã«ã™ã‚‹ã‹ã‚’示ã—ã¦ã„ã¾ã™\
+(ãŸã ã—,ツールãƒãƒ¼ã®åˆ‡ã‚Šé›¢ã—ã«ã¯Tcl/Tk8.5ä»¥ä¸Šã®æ©Ÿèƒ½ãŒå¿…è¦ã§ã™ï¼‰ï¼Ž\
+ツールãƒãƒ¼ã®ãƒœã‚¿ãƒ³ã¯ï¼Œ'Toolbutton'スタイルを使用ã™ã‚‹ã‚ˆã†ã«æ˜Žç¤ºã™ã‚‹ã“ã¨ã§ï¼Œ\
+"toolbar style"ボタンã¨ãªã‚‹ã‚ˆã†ã«å±žæ€§è¨­å®šã•れã¦ã„ã¾ã™ï¼Ž\
+ツールãƒãƒ¼ã®å·¦ç«¯ã«ã¯ç°¡å˜ãªãƒžãƒ¼ã‚«ãƒ¼ãŒç½®ã‹ã‚Œã¦ã„ã¾ã™ï¼Ž\
+マーカー上ã«ãƒžã‚¦ã‚¹ã‚«ãƒ¼ã‚½ãƒ«ãŒæ¥ã‚‹ã¨ç§»å‹•アイコンã«ã‚«ãƒ¼ã‚½ãƒ«ãŒå¤‰åŒ–ã—ã¾ã™ï¼Ž\
+ãã“ã§ãƒ„ールãƒãƒ¼ã‚’å‹•ã‹ã™ã‚ˆã†ã«ãƒ‰ãƒ©ãƒƒã‚°ã™ã‚‹ã¨ï¼Œ\
+ツールãƒãƒ¼å…¨ä½“を切り離ã—ã¦ç‹¬ç«‹ã—ãŸãƒˆãƒƒãƒ—レベルウィジェットã«\
+ã™ã‚‹ã“ã¨ãŒã§ãã¾ã™ï¼Ž\
+切り離ã—ãŸãƒ„ールãƒãƒ¼ãŒä¸è¦ã¨ãªã£ãŸæ™‚ã«ã¯ï¼Œ\
+一般的ãªãƒˆãƒƒãƒ—レベルウィジェットã¨åŒæ§˜ã«å˜ç´”ã«é–‰ã˜ã‚‹ã“ã¨ã§ï¼Œ
+å†ã³å…ƒã®ã‚¦ã‚£ãƒ³ãƒ‰ã‚¦ã«å¼µã‚Šä»˜ã‘られるã§ã—ょã†ï¼Ž
EOL
else
msg = Ttk::Label.new(base_frame, :wraplength=>'4i', :text=><<EOL)
-¤³¤Î¥Ç¥â¤Ç¤Ï¡¤¥Ä¡¼¥ë¥Ð¡¼¤ò¤É¤Î¤è¤¦¤Ë¤·¤ÆÅ¬Àڤ˥ơ¼¥ÞÂбþ¤µ¤»¤ë¤«¤ò\
-¼¨¤·¤Æ¤¤¤Þ¤¹¡¥\
-¥Ä¡¼¥ë¥Ð¡¼¤Î¥Ü¥¿¥ó¤Ï¡¤'Toolbutton'¥¹¥¿¥¤¥ë¤ò»ÈÍѤ¹¤ë¤è¤¦¤ËÌÀ¼¨¤¹¤ë¤³¤È¤Ç¡¤\
-"toolbar style"¥Ü¥¿¥ó¤È¤Ê¤ë¤è¤¦¤Ë°À­ÀßÄꤵ¤ì¤Æ¤¤¤Þ¤¹¡¥
+ã“ã®ãƒ‡ãƒ¢ã§ã¯ï¼Œãƒ„ールãƒãƒ¼ã‚’ã©ã®ã‚ˆã†ã«ã—ã¦é©åˆ‡ã«ãƒ†ãƒ¼ãƒžå¯¾å¿œã•ã›ã‚‹ã‹ã‚’\
+示ã—ã¦ã„ã¾ã™ï¼Ž\
+ツールãƒãƒ¼ã®ãƒœã‚¿ãƒ³ã¯ï¼Œ'Toolbutton'スタイルを使用ã™ã‚‹ã‚ˆã†ã«æ˜Žç¤ºã™ã‚‹ã“ã¨ã§ï¼Œ\
+"toolbar style"ボタンã¨ãªã‚‹ã‚ˆã†ã«å±žæ€§è¨­å®šã•れã¦ã„ã¾ã™ï¼Ž
EOL
end
## Set up the toolbar hull
-tbar_base = Tk::Frame.new(base_frame, # Tk ɸ½à¤Î frame ¤Ç¤Ê¤±¤ì¤Ð¤Ê¤ê¤Þ¤»¤ó¡¥
- :widgetname=>'toolbar') # ¥¦¥£¥ó¥É¥¦¥¿¥¤¥È¥ëʸ»úÎó¤È¤¹¤ë¤¿¤á¤Ë¡¤¥¦¥£¥¸¥§¥Ã¥È̾¤òÌÀ¼¨¤·¤Æ¤¤¤Þ¤¹¡¥
+tbar_base = Tk::Frame.new(base_frame, # Tk 標準㮠frame ã§ãªã‘れã°ãªã‚Šã¾ã›ã‚“.
+ :widgetname=>'toolbar') # ウィンドウタイトル文字列ã¨ã™ã‚‹ãŸã‚ã«ï¼Œã‚¦ã‚£ã‚¸ã‚§ãƒƒãƒˆåを明示ã—ã¦ã„ã¾ã™ï¼Ž
sep = Ttk::Separator.new(base_frame)
to_base = Ttk::Frame.new(tbar_base, :cursor=>'fleur')
if Tk.windowingsystem != 'aqua'
@@ -72,7 +72,7 @@ if Tk.windowingsystem != 'aqua'
self.grid_remove
w.grid_remove
self.wm_manage
- # self.wm_title('Toolbar') # ¤â¤·¥¦¥£¥¸¥§¥Ã¥È̾¤ò¥¦¥£¥ó¥É¥¦¥¿¥¤¥È¥ë¤Ë¤·¤¿¤¯¤Ê¤¤¤Ê¤é¡¤¤³¤³¤ÇÀßÄꤷ¤Æ¤¯¤À¤µ¤¤
+ # self.wm_title('Toolbar') # ã‚‚ã—ウィジェットåをウィンドウタイトルã«ã—ãŸããªã„ãªã‚‰ï¼Œã“ã“ã§è¨­å®šã—ã¦ãã ã•ã„
self.wm_protocol('WM_DELETE_WINDOW'){ self.untearoff(w) }
end
def tbar_base.untearoff(w)
@@ -86,17 +86,17 @@ end
text = TkText.new(base_frame, :width=>40, :height=>10)
## Toolbar contents
-tb_btn = Ttk::Button.new(tbar_base, :text=>'¥Ü¥¿¥ó', :style=>'Toolbutton',
+tb_btn = Ttk::Button.new(tbar_base, :text=>'ボタン', :style=>'Toolbutton',
:command=>proc{
- text.insert(:end, "¥Ü¥¿¥ó¤¬²¡¤µ¤ì¤Þ¤·¤¿¡¥\n")
+ text.insert(:end, "ãƒœã‚¿ãƒ³ãŒæŠ¼ã•れã¾ã—ãŸï¼Ž\n")
})
-tb_chk = Ttk::Checkbutton.new(tbar_base, :text=>'¥Á¥§¥Ã¥¯¥Ü¥¿¥ó',
+tb_chk = Ttk::Checkbutton.new(tbar_base, :text=>'ãƒã‚§ãƒƒã‚¯ãƒœã‚¿ãƒ³',
:style=>'Toolbutton',
:variable=>(check = TkVariable.new),
:command=>proc{
- text.insert(:end, "¥Á¥§¥Ã¥¯¥Ü¥¿¥ó¤ÎÃͤÏ#{check.value}¤Ç¤¹¡¥\n")
+ text.insert(:end, "ãƒã‚§ãƒƒã‚¯ãƒœã‚¿ãƒ³ã®å€¤ã¯#{check.value}ã§ã™ï¼Ž\n")
})
-tb_mbtn = Ttk::Menubutton.new(tbar_base, :text=>'¥á¥Ë¥å¡¼')
+tb_mbtn = Ttk::Menubutton.new(tbar_base, :text=>'メニュー')
tb_combo = Ttk::Combobox.new(tbar_base, :value=>TkFont.families,
:state=>:readonly)
tb_mbtn.menu(menu = Tk::Menu.new(tb_mbtn))
@@ -121,10 +121,10 @@ Ttk::Frame.new(base_frame) {|frame|
sep = Ttk::Separator.new(frame)
Tk.grid(sep, :columnspan=>4, :row=>0, :sticky=>'ew', :pady=>2)
TkGrid('x',
- Ttk::Button.new(frame, :text=>'¥³¡¼¥É»²¾È',
+ Ttk::Button.new(frame, :text=>'コードå‚ç…§',
:image=>$image['view'], :compound=>:left,
:command=>proc{showCode 'toolbar'}),
- Ttk::Button.new(frame, :text=>'ÊĤ¸¤ë',
+ Ttk::Button.new(frame, :text=>'é–‰ã˜ã‚‹',
:image=>$image['delete'], :compound=>:left,
:command=>proc{
$toolbar_demo.destroy
diff --git a/ext/tk/sample/demos-jp/tree.rb b/ext/tk/sample/demos-jp/tree.rb
index f6855445ca..3f3b18b677 100644
--- a/ext/tk/sample/demos-jp/tree.rb
+++ b/ext/tk/sample/demos-jp/tree.rb
@@ -1,4 +1,4 @@
-# -*- coding: euc-jp -*-
+# -*- coding: utf-8 -*-
#
# tree.rb --
#
@@ -24,14 +24,14 @@ base_frame = TkFrame.new($tree_demo).pack(:fill=>:both, :expand=>true)
Ttk::Label.new(base_frame, :font=>$font, :wraplength=>'4i',
:justify=>:left, :anchor=>'n', :padding=>[10, 2, 10, 6],
:text=><<EOL).pack(:fill=>:x)
-Ttk¤È¤Ï¡¤¥Æ¡¼¥Þ»ØÄê²Äǽ¤Ê¿·¤·¤¤¥¦¥£¥¸¥§¥Ã¥È½¸¹ç¤Ç¤¹¡¥\
-¤³¤Î¥µ¥ó¥×¥ë¤Ï¡¤¥Õ¥¡¥¤¥ë¥·¥¹¥Æ¥à¤Î¤è¤¦¤Ê³¬ÁØÅª¤Ê¥Ç¡¼¥¿½¸¹ç¤ò\
-»²¾È¤Ç¤­¤ë¤è¤¦¤Ë¤·¤¿Ttk::Treeview¥¦¥£¥¸¥§¥Ã¥È¤ò´Þ¤ó¤Ç¤¤¤Þ¤¹¡¥\
-Ttk::Treeview¥¦¥£¥¸¥§¥Ã¥È¤Ï¡¤ÌÚ¹½Â¤¼«ÂΤÎɽ¼¨¤ò²Äǽ¤Ë¤¹¤ë¤À¤±¤Ç¤Ê¤¯¡¤\
-ÄɲþðÊó(¤³¤Î¥µ¥ó¥×¥ë¤Î¾ì¹ç¤Ï¥Õ¥¡¥¤¥ë¥µ¥¤¥º)¤òɽ¼¨¤¹¤ë¤¿¤á¤Ë\
-Ǥ°Õ¤Î¸Ä¿ô¤ÎÄɲå«¥é¥à¤â°·¤¦¤³¤È¤â¤Ç¤­¤Þ¤¹¡¥\
-¤Þ¤¿¡¤¥«¥é¥à¤Î¥¿¥¤¥È¥ë´Ö¤Î¶èÀÚ¤êÉôʬ¤ò¥É¥é¥Ã¥°¤¹¤ë¤³¤È¤Ç¡¤\
-¥«¥é¥à¤ÎÉý¤òÊѹ¹¤¹¤ë¤³¤È¤â²Äǽ¤Ç¤¹¡¥
+Ttkã¨ã¯ï¼Œãƒ†ãƒ¼ãƒžæŒ‡å®šå¯èƒ½ãªæ–°ã—ã„ウィジェット集åˆã§ã™ï¼Ž\
+ã“ã®ã‚µãƒ³ãƒ—ルã¯ï¼Œãƒ•ァイルシステムã®ã‚ˆã†ãªéšŽå±¤çš„ãªãƒ‡ãƒ¼ã‚¿é›†åˆã‚’\
+å‚ç…§ã§ãるよã†ã«ã—ãŸTtk::Treeviewウィジェットをå«ã‚“ã§ã„ã¾ã™ï¼Ž\
+Ttk::Treeviewウィジェットã¯ï¼Œæœ¨æ§‹é€ è‡ªä½“ã®è¡¨ç¤ºã‚’å¯èƒ½ã«ã™ã‚‹ã ã‘ã§ãªã,\
+追加情報(ã“ã®ã‚µãƒ³ãƒ—ルã®å ´åˆã¯ãƒ•ァイルサイズ)を表示ã™ã‚‹ãŸã‚ã«\
+ä»»æ„ã®å€‹æ•°ã®è¿½åŠ ã‚«ãƒ©ãƒ ã‚‚æ‰±ã†ã“ã¨ã‚‚ã§ãã¾ã™ï¼Ž\
+ã¾ãŸï¼Œã‚«ãƒ©ãƒ ã®ã‚¿ã‚¤ãƒˆãƒ«é–“ã®åŒºåˆ‡ã‚Šéƒ¨åˆ†ã‚’ドラッグã™ã‚‹ã“ã¨ã§ï¼Œ\
+カラムã®å¹…を変更ã™ã‚‹ã“ã¨ã‚‚å¯èƒ½ã§ã™ï¼Ž
EOL
## See Code / Dismiss
@@ -39,10 +39,10 @@ Ttk::Frame.new(base_frame) {|frame|
sep = Ttk::Separator.new(frame)
Tk.grid(sep, :columnspan=>4, :row=>0, :sticky=>'ew', :pady=>2)
TkGrid('x',
- Ttk::Button.new(frame, :text=>'¥³¡¼¥É»²¾È',
+ Ttk::Button.new(frame, :text=>'コードå‚ç…§',
:image=>$image['view'], :compound=>:left,
:command=>proc{showCode 'tree'}),
- Ttk::Button.new(frame, :text=>'ÊĤ¸¤ë',
+ Ttk::Button.new(frame, :text=>'é–‰ã˜ã‚‹',
:image=>$image['delete'], :compound=>:left,
:command=>proc{
$tree_demo.destroy
diff --git a/ext/tk/sample/demos-jp/ttkbut.rb b/ext/tk/sample/demos-jp/ttkbut.rb
index 90ec3fce5b..ccde541019 100644
--- a/ext/tk/sample/demos-jp/ttkbut.rb
+++ b/ext/tk/sample/demos-jp/ttkbut.rb
@@ -1,4 +1,4 @@
-# -*- coding: euc-jp -*-
+# -*- coding: utf-8 -*-
#
# ttkbut.rb
#
@@ -23,22 +23,22 @@ base_frame = TkFrame.new($ttkbut_demo).pack(:fill=>:both, :expand=>true)
Ttk::Label.new(base_frame, :font=>$font, :wraplength=>'4i', :justify=>:left,
:text=><<EOL).pack(:side=>:top, :fill=>:x)
-Ttk¤È¤Ï¡¤¥Æ¡¼¥Þ»ØÄê²Äǽ¤Ê¿·¤·¤¤¥¦¥£¥¸¥§¥Ã¥È½¸¹ç¤Ç¤¹¡¥\
-º£¡¤¤¢¤Ê¤¿¤¬Ìܤˤ·¤Æ¤¤¤ë¤Î¤ÏTtk¤Î¥Æ¡¼¥Þ²½¥é¥Ù¥ë¤Ç¡¤\
-²¼¤Ë¤ÏTtk¤Î¥é¥Ù¥ë¥Õ¥ì¡¼¥à¤ÎÃæ¤Ë»°¤Ä¤Î¥°¥ë¡¼¥×¤ÎTtk¥¦¥£¥¸¥§¥Ã¥È¤¬\
-ɽ¼¨¤µ¤ì¤Æ¤¤¤Þ¤¹¡¥
-ºÇ½é¤Î¥°¥ë¡¼¥×¤ÏÁ´¤Æ¥Ü¥¿¥ó¤Ç¤¢¤ê¡¤\
-¤½¤ì¤¾¤ì¥¯¥ê¥Ã¥¯¤¹¤ì¤Ð¸½ºß¤Î¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¤Î¥Æ¡¼¥Þ¤¬ÀßÄꤵ¤ì¤Þ¤¹¡¥
-£²ÈÖÌܤΥ°¥ë¡¼¥×¤Ï»°¤Ä¤Î¥Á¥§¥Ã¥¯¥Ü¥¿¥ó½¸¹ç¤Ç¤¹¡¥\
-³Æ½¸¹ç¤Î´Ö¤Ë¤Ï¡¤¥»¥Ñ¥ì¡¼¥¿¥¦¥£¥¸¥§¥Ã¥È¤¬ÃÖ¤«¤ì¤Æ¤¤¤Þ¤¹¡¥\
-¤Ê¤ª¡ÖÍ­¸ú²½¡×¥Ü¥¿¥ó¤Ï¡¤¤³¤Î¥È¥Ã¥×¥ì¥Ù¥ë¥¦¥£¥¸¥§¥Ã¥ÈÆâ¤Î\
-¾¤Î¤¹¤Ù¤Æ¤Î¥Æ¡¼¥Þ²½¥¦¥£¥¸¥§¥Ã¥È¤Î¾õÂÖ(state)¤¬"disabled"¤«¤É¤¦¤«¤ò\
-¥³¥ó¥È¥í¡¼¥ë¤¹¤ë¤³¤È¤ËÃí°Õ¤·¤Æ¤¯¤À¤µ¤¤¡¥
-£³ÈÖÌܤΥ°¥ë¡¼¥×¤Ï´ØÏ¢ÉÕ¤±¤é¤ì¤¿¥é¥¸¥ª¥Ü¥¿¥ó½¸¹ç¤È¤Ê¤Ã¤Æ¤¤¤Þ¤¹¡¥
+Ttkã¨ã¯ï¼Œãƒ†ãƒ¼ãƒžæŒ‡å®šå¯èƒ½ãªæ–°ã—ã„ウィジェット集åˆã§ã™ï¼Ž\
+今,ã‚ãªãŸãŒç›®ã«ã—ã¦ã„ã‚‹ã®ã¯Ttkã®ãƒ†ãƒ¼ãƒžåŒ–ラベルã§ï¼Œ\
+下ã«ã¯Ttkã®ãƒ©ãƒ™ãƒ«ãƒ•レームã®ä¸­ã«ä¸‰ã¤ã®ã‚°ãƒ«ãƒ¼ãƒ—ã®TtkウィジェットãŒ\
+表示ã•れã¦ã„ã¾ã™ï¼Ž
+最åˆã®ã‚°ãƒ«ãƒ¼ãƒ—ã¯å…¨ã¦ãƒœã‚¿ãƒ³ã§ã‚り,\
+ãれãžã‚Œã‚¯ãƒªãƒƒã‚¯ã™ã‚Œã°ç¾åœ¨ã®ã‚¢ãƒ—リケーションã®ãƒ†ãƒ¼ãƒžãŒè¨­å®šã•れã¾ã™ï¼Ž
+2番目ã®ã‚°ãƒ«ãƒ¼ãƒ—ã¯ä¸‰ã¤ã®ãƒã‚§ãƒƒã‚¯ãƒœã‚¿ãƒ³é›†åˆã§ã™ï¼Ž\
+å„集åˆã®é–“ã«ã¯ï¼Œã‚»ãƒ‘レータウィジェットãŒç½®ã‹ã‚Œã¦ã„ã¾ã™ï¼Ž\
+ãªãŠã€Œæœ‰åŠ¹åŒ–ã€ãƒœã‚¿ãƒ³ã¯ï¼Œã“ã®ãƒˆãƒƒãƒ—レベルウィジェット内ã®\
+ä»–ã®ã™ã¹ã¦ã®ãƒ†ãƒ¼ãƒžåŒ–ウィジェットã®çŠ¶æ…‹(state)ãŒ"disabled"ã‹ã©ã†ã‹ã‚’\
+コントロールã™ã‚‹ã“ã¨ã«æ³¨æ„ã—ã¦ãã ã•ã„.
+3番目ã®ã‚°ãƒ«ãƒ¼ãƒ—ã¯é–¢é€£ä»˜ã‘られãŸãƒ©ã‚¸ã‚ªãƒœã‚¿ãƒ³é›†åˆã¨ãªã£ã¦ã„ã¾ã™ï¼Ž
EOL
## Add buttons for setting the theme
-buttons = Ttk::Labelframe.new(base_frame, :text=>'¥Ü¥¿¥ó')
+buttons = Ttk::Labelframe.new(base_frame, :text=>'ボタン')
# Ttk::Style.theme_names.each{|theme|
# Ttk::Button.new(buttons, :text=>theme,
# :command=>proc{Ttk::Style.theme_use theme}).pack(:pady=>2)
@@ -66,9 +66,9 @@ def setState(root, value, *excepts)
end
## Set up the checkbutton group
-checks = Ttk::Labelframe.new(base_frame, :text=>'¥Á¥§¥Ã¥¯¥Ü¥¿¥ó')
+checks = Ttk::Labelframe.new(base_frame, :text=>'ãƒã‚§ãƒƒã‚¯ãƒœã‚¿ãƒ³')
enabled = TkVariable.new(true)
-e = Ttk::Checkbutton.new(checks, :text=>'Í­¸ú²½', :variable=>enabled,
+e = Ttk::Checkbutton.new(checks, :text=>'有効化', :variable=>enabled,
:command=>proc{
setState($ttkbut_demo,
((enabled.bool)? "!disabled" : "disabled"),
@@ -84,15 +84,15 @@ tomato = TkVariable.new
basil = TkVariable.new
oregano = TkVariable.new
-c1 = Ttk::Checkbutton.new(checks, :text=>'¥Á¡¼¥º', :variable=>cheese)
-c2 = Ttk::Checkbutton.new(checks, :text=>'¥È¥Þ¥È', :variable=>tomato)
-c3 = Ttk::Checkbutton.new(checks, :text=>'¥Ð¥¸¥ë', :variable=>basil)
-c4 = Ttk::Checkbutton.new(checks, :text=>'¥ª¥ì¥¬¥Î', :variable=>oregano)
+c1 = Ttk::Checkbutton.new(checks, :text=>'ãƒãƒ¼ã‚º', :variable=>cheese)
+c2 = Ttk::Checkbutton.new(checks, :text=>'トマト', :variable=>tomato)
+c3 = Ttk::Checkbutton.new(checks, :text=>'ãƒã‚¸ãƒ«', :variable=>basil)
+c4 = Ttk::Checkbutton.new(checks, :text=>'オレガノ', :variable=>oregano)
Tk.pack(e, sep1, c1, c2, sep2, c3, c4, :fill=>:x, :pady=>2)
## Set up the radiobutton group
-radios = Ttk::Labelframe.new(base_frame, :text=>'¥é¥¸¥ª¥Ü¥¿¥ó')
+radios = Ttk::Labelframe.new(base_frame, :text=>'ラジオボタン')
happyness = TkVariable.new
@@ -114,18 +114,18 @@ Ttk::Frame.new(base_frame) {|frame|
sep = Ttk::Separator.new(frame)
Tk.grid(sep, :columnspan=>4, :row=>0, :sticky=>'ew', :pady=>2)
TkGrid('x',
- Ttk::Button.new(frame, :text=>'ÊÑ¿ô»²¾È',
+ Ttk::Button.new(frame, :text=>'変数å‚ç…§',
:image=>$image['view'], :compound=>:left,
:command=>proc{
- showVars(base_frame, ['Í­¸ú²½', enabled],
- ['¥Á¡¼¥º', cheese], ['¥È¥Þ¥È', tomato],
- ['¥Ð¥¸¥ë', basil], ['¥ª¥ì¥¬¥Î', oregano],
- ['¹¬Ê¡ÅÙ', happyness])
+ showVars(base_frame, ['有効化', enabled],
+ ['ãƒãƒ¼ã‚º', cheese], ['トマト', tomato],
+ ['ãƒã‚¸ãƒ«', basil], ['オレガノ', oregano],
+ ['幸ç¦åº¦', happyness])
}),
- Ttk::Button.new(frame, :text=>'¥³¡¼¥É»²¾È',
+ Ttk::Button.new(frame, :text=>'コードå‚ç…§',
:image=>$image['view'], :compound=>:left,
:command=>proc{showCode 'ttkbut'}),
- Ttk::Button.new(frame, :text=>'ÊĤ¸¤ë',
+ Ttk::Button.new(frame, :text=>'é–‰ã˜ã‚‹',
:image=>$image['delete'], :compound=>:left,
:command=>proc{
tmppath = $ttkbut_demo
diff --git a/ext/tk/sample/demos-jp/ttkmenu.rb b/ext/tk/sample/demos-jp/ttkmenu.rb
index 9e78678c8e..aa9db5019f 100644
--- a/ext/tk/sample/demos-jp/ttkmenu.rb
+++ b/ext/tk/sample/demos-jp/ttkmenu.rb
@@ -1,4 +1,4 @@
-# -*- coding: euc-jp -*-
+# -*- coding: utf-8 -*-
#
# ttkmenu.rb --
#
@@ -22,21 +22,21 @@ base_frame = Ttk::Frame.new($ttkmenu_demo).pack(:fill=>:both, :expand=>true)
Ttk::Label.new(base_frame, :font=>$font, :wraplength=>'4i', :justify=>:left,
:text=><<EOL).pack(:side=>:top, :fill=>:x)
-Ttk¤È¤Ï¡¤¥Æ¡¼¥Þ»ØÄê²Äǽ¤Ê¿·¤·¤¤¥¦¥£¥¸¥§¥Ã¥È½¸¹ç¤Ç¤¹¡¥\
-¤³¤ì¤Ë¤è¤ê¥Æ¡¼¥Þ¤ËÂбþ¤¹¤ë¤³¤È¤¬¤Ç¤­¤ë¤è¤¦¤Ë¤Ê¤Ã¤¿¥¦¥£¥¸¥§¥Ã¥È¤Î¤Ò¤È¤Ä¤Ë\
-¥á¥Ë¥å¡¼¥Ü¥¿¥ó¤¬¤¢¤ê¤Þ¤¹¡¥\
-°Ê²¼¤Ç¤Ï¡¤¥Æ¡¼¥Þ¤ËÂбþ¤·¤¿¥á¥Ë¥å¡¼¥Ü¥¿¥ó¤¬¤¤¤¯¤Ä¤«É½¼¨¤µ¤ì¤Æ¤¤¤Þ¤¹¡¥\
-¤½¤ì¤é¤ò»È¤Ã¤Æ¡¤¸½ºß»ÈÍÑÃæ¤Î¥Æ¡¼¥Þ¤òÊѹ¹¤¹¤ë¤³¤È¤¬²Äǽ¤Ç¤¹¡¥\
-¥Æ¡¼¥Þ¤ÎÁªÂò¤¬¥á¥Ë¥å¡¼¥Ü¥¿¥ó¼«¿È¤Î¸«³Ý¤±¤òÊѲ½¤µ¤»¤ëÍͻҤ䡤\
-Ãæ±û¤Î¥á¥Ë¥å¡¼¥Ü¥¿¥ó¤À¤±¤¬°Û¤Ê¤ë¥¹¥¿¥¤¥ë\
-(¥Ä¡¼¥ë¥Ð¡¼¤Ç¤Î°ìÈÌŪ¤Êɽ¼¨¤ËŬ¤·¤¿¤â¤Î)¤Çɽ¼¨¤µ¤ì¤Æ¤¤¤ëÍͻҤË\
-ÃíÌܤ·¤Æ¤¯¤À¤µ¤¤¡¥\
-¤Ê¤ª¡¤¥á¥Ë¥å¡¼¥Ü¥¿¥ó¤Ë¤Ä¤¤¤Æ¤Ï¥Æ¡¼¥Þ¤ËÂбþ¤·¤¿¥¦¥£¥¸¥§¥Ã¥È¤¬¤¢¤ê¤Þ¤¹¤¬¡¤\
-¥á¥Ë¥å¡¼¤Ë¤Ä¤¤¤Æ¤Ï¥Æ¡¼¥Þ¤ËÂбþ¤·¤¿¥¦¥£¥¸¥§¥Ã¥È¤Ï´Þ¤Þ¤ì¤Æ¤¤¤Þ¤»¤ó¡¥\
-¤½¤ÎÍýͳ¤Ï¡¤É¸½à¤ÎTk¤Î¥á¥Ë¥å¡¼¥¦¥£¥¸¥§¥Ã¥È¤¬\
-¤¹¤Ù¤Æ¤Î¥×¥é¥Ã¥È¥Û¡¼¥à¤Ç½½Ê¬¤ËÎɹ¥¤Ê¸«³Ý¤±¤ÈÁàºîÀ­¤ò»ý¤Ã¤Æ¤¤¤ë¡¤\
-ÆÃ¤Ë¡¤Â¿¤¯¤Î´Ä¶­¤Ç¤½¤Î´Ä¶­ËÜÍè¤ÎÁàºîÂηϤȤʤë¤è¤¦¤Ë¼ÂÁõ¤µ¤ì¤Æ¤¤¤ë¤È\
-ȽÃǤµ¤ì¤¿¤³¤È¤Ë¤è¤ê¤Þ¤¹¡¥
+Ttkã¨ã¯ï¼Œãƒ†ãƒ¼ãƒžæŒ‡å®šå¯èƒ½ãªæ–°ã—ã„ウィジェット集åˆã§ã™ï¼Ž\
+ã“れã«ã‚ˆã‚Šãƒ†ãƒ¼ãƒžã«å¯¾å¿œã™ã‚‹ã“ã¨ãŒã§ãるよã†ã«ãªã£ãŸã‚¦ã‚£ã‚¸ã‚§ãƒƒãƒˆã®ã²ã¨ã¤ã«\
+メニューボタンãŒã‚りã¾ã™ï¼Ž\
+以下ã§ã¯ï¼Œãƒ†ãƒ¼ãƒžã«å¯¾å¿œã—ãŸãƒ¡ãƒ‹ãƒ¥ãƒ¼ãƒœã‚¿ãƒ³ãŒã„ãã¤ã‹è¡¨ç¤ºã•れã¦ã„ã¾ã™ï¼Ž\
+ãれらを使ã£ã¦ï¼Œç¾åœ¨ä½¿ç”¨ä¸­ã®ãƒ†ãƒ¼ãƒžã‚’変更ã™ã‚‹ã“ã¨ãŒå¯èƒ½ã§ã™ï¼Ž\
+テーマã®é¸æŠžãŒãƒ¡ãƒ‹ãƒ¥ãƒ¼ãƒœã‚¿ãƒ³è‡ªèº«ã®è¦‹æŽ›ã‘を変化ã•ã›ã‚‹æ§˜å­ã‚„,\
+中央ã®ãƒ¡ãƒ‹ãƒ¥ãƒ¼ãƒœã‚¿ãƒ³ã ã‘ãŒç•°ãªã‚‹ã‚¹ã‚¿ã‚¤ãƒ«\
+(ツールãƒãƒ¼ã§ã®ä¸€èˆ¬çš„ãªè¡¨ç¤ºã«é©ã—ãŸã‚‚ã®)ã§è¡¨ç¤ºã•れã¦ã„る様å­ã«\
+注目ã—ã¦ãã ã•ã„.\
+ãªãŠï¼Œãƒ¡ãƒ‹ãƒ¥ãƒ¼ãƒœã‚¿ãƒ³ã«ã¤ã„ã¦ã¯ãƒ†ãƒ¼ãƒžã«å¯¾å¿œã—ãŸã‚¦ã‚£ã‚¸ã‚§ãƒƒãƒˆãŒã‚りã¾ã™ãŒï¼Œ\
+メニューã«ã¤ã„ã¦ã¯ãƒ†ãƒ¼ãƒžã«å¯¾å¿œã—ãŸã‚¦ã‚£ã‚¸ã‚§ãƒƒãƒˆã¯å«ã¾ã‚Œã¦ã„ã¾ã›ã‚“.\
+ãã®ç†ç”±ã¯ï¼Œæ¨™æº–ã®Tkã®ãƒ¡ãƒ‹ãƒ¥ãƒ¼ã‚¦ã‚£ã‚¸ã‚§ãƒƒãƒˆãŒ\
+ã™ã¹ã¦ã®ãƒ—ラットホームã§å分ã«è‰¯å¥½ãªè¦‹æŽ›ã‘ã¨æ“作性をæŒã£ã¦ã„る,\
+特ã«ï¼Œå¤šãã®ç’°å¢ƒã§ãã®ç’°å¢ƒæœ¬æ¥ã®æ“作体系ã¨ãªã‚‹ã‚ˆã†ã«å®Ÿè£…ã•れã¦ã„ã‚‹ã¨\
+判断ã•れãŸã“ã¨ã«ã‚ˆã‚Šã¾ã™ï¼Ž
EOL
Ttk::Separator.new(base_frame).pack(:side=>:top, :fill=>:x)
@@ -46,10 +46,10 @@ Ttk::Frame.new($ttkmenu_demo) {|frame|
sep = Ttk::Separator.new(frame)
Tk.grid(sep, :columnspan=>4, :row=>0, :sticky=>'ew', :pady=>2)
TkGrid('x',
- Ttk::Button.new(frame, :text=>'¥³¡¼¥É»²¾È',
+ Ttk::Button.new(frame, :text=>'コードå‚ç…§',
:image=>$image['view'], :compound=>:left,
:command=>proc{showCode 'ttkmenu'}),
- Ttk::Button.new(frame, :text=>'ÊĤ¸¤ë',
+ Ttk::Button.new(frame, :text=>'é–‰ã˜ã‚‹',
:image=>$image['delete'], :compound=>:left,
:command=>proc{
$ttkmenu_demo.destroy
@@ -60,12 +60,12 @@ Ttk::Frame.new($ttkmenu_demo) {|frame|
pack(:side=>:bottom, :fill=>:x)
}
-b1 = Ttk::Menubutton.new(base_frame,:text=>'¥Æ¡¼¥Þ¤òÁªÂò',:direction=>:above)
-b2 = Ttk::Menubutton.new(base_frame,:text=>'¥Æ¡¼¥Þ¤òÁªÂò',:direction=>:left)
-b3 = Ttk::Menubutton.new(base_frame,:text=>'¥Æ¡¼¥Þ¤òÁªÂò',:direction=>:right)
-b4 = Ttk::Menubutton.new(base_frame,:text=>'¥Æ¡¼¥Þ¤òÁªÂò',:direction=>:flush,
+b1 = Ttk::Menubutton.new(base_frame,:text=>'ãƒ†ãƒ¼ãƒžã‚’é¸æŠž',:direction=>:above)
+b2 = Ttk::Menubutton.new(base_frame,:text=>'ãƒ†ãƒ¼ãƒžã‚’é¸æŠž',:direction=>:left)
+b3 = Ttk::Menubutton.new(base_frame,:text=>'ãƒ†ãƒ¼ãƒžã‚’é¸æŠž',:direction=>:right)
+b4 = Ttk::Menubutton.new(base_frame,:text=>'ãƒ†ãƒ¼ãƒžã‚’é¸æŠž',:direction=>:flush,
:style=>Ttk::Menubutton.style('Toolbutton'))
-b5 = Ttk::Menubutton.new(base_frame,:text=>'¥Æ¡¼¥Þ¤òÁªÂò',:direction=>:below)
+b5 = Ttk::Menubutton.new(base_frame,:text=>'ãƒ†ãƒ¼ãƒžã‚’é¸æŠž',:direction=>:below)
b1.menu(m1 = Tk::Menu.new(b1, :tearoff=>false))
b2.menu(m2 = Tk::Menu.new(b2, :tearoff=>false))
diff --git a/ext/tk/sample/demos-jp/ttknote.rb b/ext/tk/sample/demos-jp/ttknote.rb
index f0cd258893..f3b2fa5881 100644
--- a/ext/tk/sample/demos-jp/ttknote.rb
+++ b/ext/tk/sample/demos-jp/ttknote.rb
@@ -1,4 +1,4 @@
-# -*- coding: euc-jp -*-
+# -*- coding: utf-8 -*-
#
# ttknote.rb --
#
@@ -23,10 +23,10 @@ Ttk::Frame.new($ttknote_demo) {|frame|
sep = Ttk::Separator.new(frame)
Tk.grid(sep, :columnspan=>4, :row=>0, :sticky=>'ew', :pady=>2)
TkGrid('x',
- Ttk::Button.new(frame, :text=>'¥³¡¼¥É»²¾È',
+ Ttk::Button.new(frame, :text=>'コードå‚ç…§',
:image=>$image['view'], :compound=>:left,
:command=>proc{showCode 'ttknote'}),
- Ttk::Button.new(frame, :text=>'ÊĤ¸¤ë',
+ Ttk::Button.new(frame, :text=>'é–‰ã˜ã‚‹',
:image=>$image['delete'], :compound=>:left,
:command=>proc{
$ttknote_demo.destroy
@@ -48,31 +48,31 @@ notebook.enable_traversal
f_msg = Ttk::Frame.new(notebook)
msg_m = Ttk::Label.new(f_msg, :font=>$font, :wraplength=>'5i',
:justify=>:left, :anchor=>'n', :text=><<EOL)
-Ttk¤È¤Ï¡¤¥Æ¡¼¥Þ»ØÄê²Äǽ¤Ê¿·¤·¤¤¥¦¥£¥¸¥§¥Ã¥È½¸¹ç¤Ç¤¹¡¥\
-¤½¤ÎÃæ¤Ë´Þ¤Þ¤ì¤ë¥¦¥£¥¸¥§¥Ã¥È¤Î¤Ò¤È¤Ä¤Ë¥Î¡¼¥È¥Ö¥Ã¥¯¥¦¥£¥¸¥§¥Ã¥È¤¬¤¢¤ê¤Þ¤¹¡¥\
-¥Î¡¼¥È¥Ö¥Ã¥¯¥¦¥£¥¸¥§¥Ã¥È¤Ï¡¤\
-¸ÄÊÌ¤ÎÆâÍÆ¤ò»ý¤Ã¤¿¥Ñ¥Í¥ë¤«¤é¤ÎÁªÂò¤ò²Äǽ¤Ë¤¹¤ë¤è¤¦¤Ê\
-¥¿¥Ö¤Î½¸¹ç¡Ê¥¿¥Ö¥»¥Ã¥È¡Ë¤òÄê¤á¤Þ¤¹¡¥\
-¥¿¥Ö¥»¥Ã¥È¤ÏºÇ¶á¤Î¿¤¯¤Î¥æ¡¼¥¶¥¤¥ó¥¿¡¼¥Õ¥§¡¼¥¹¤Ç¸«¤é¤ì¤ëµ¡Ç½¤Ç¤¹¡¥\
-¥¿¥Ö¤ÎÁªÂò¤Ï¡¤¥Þ¥¦¥¹¤Ë¤è¤ë¤À¤±¤Ç¤Ê¤¯¡¤\
-¥Î¡¼¥È¥Ö¥Ã¥¯¥¦¥£¥¸¥§¥Ã¥È¤Î¥Ú¡¼¥¸¤Î¸«½Ð¤·¤¬ÁªÂò¤µ¤ì¤Æ¤¤¤ë»þ¤Ç¤¢¤ì¤Ð\
-Ctrl+Tab¥­¡¼¤ÎÆþÎϤˤè¤Ã¤Æ¤â¹Ô¤¦¤³¤È¤¬¤Ç¤­¤Þ¤¹¡¥\
-¤³¤Î¥Ç¥â¤Ç¤Ï¡¤¸«½Ð¤·¤Ç²¼ÀþÉÕ¤­¤Îʸ»ú¤Î¥­¡¼¤ÈAlt¥­¡¼¤È¤òÁȤ߹ç¤ï¤»¤ë¤³¤È¤Ç\
-¥Ú¡¼¥¸¤òÁªÂò¤¹¤ë¤³¤È¤¬¤Ç¤­¤ë¤è¤¦¤Ë¤âÀßÄꤷ¤Æ¤¤¤Þ¤¹¡¥\
-¤¿¤À¤·¡¤£²ÈÖÌܤΥ¿¥Ö¤Ï̵¸ú²½¤µ¤ì¤ÆÁªÂò¤Ç¤­¤Ê¤¤¤è¤¦¤Ë¤Ê¤Ã¤Æ¤¤¤ë¤³¤È¤Ë¤Ï\
-Ãí°Õ¤·¤Æ¤¯¤À¤µ¤¤¡¥
+Ttkã¨ã¯ï¼Œãƒ†ãƒ¼ãƒžæŒ‡å®šå¯èƒ½ãªæ–°ã—ã„ウィジェット集åˆã§ã™ï¼Ž\
+ãã®ä¸­ã«å«ã¾ã‚Œã‚‹ã‚¦ã‚£ã‚¸ã‚§ãƒƒãƒˆã®ã²ã¨ã¤ã«ãƒŽãƒ¼ãƒˆãƒ–ックウィジェットãŒã‚りã¾ã™ï¼Ž\
+ノートブックウィジェットã¯ï¼Œ\
+個別ã®å†…容をæŒã£ãŸãƒ‘ãƒãƒ«ã‹ã‚‰ã®é¸æŠžã‚’å¯èƒ½ã«ã™ã‚‹ã‚ˆã†ãª\
+タブã®é›†åˆï¼ˆã‚¿ãƒ–セット)を定ã‚ã¾ã™ï¼Ž\
+ã‚¿ãƒ–ã‚»ãƒƒãƒˆã¯æœ€è¿‘ã®å¤šãã®ãƒ¦ãƒ¼ã‚¶ã‚¤ãƒ³ã‚¿ãƒ¼ãƒ•ェースã§è¦‹ã‚‰ã‚Œã‚‹æ©Ÿèƒ½ã§ã™ï¼Ž\
+タブã®é¸æŠžã¯ï¼Œãƒžã‚¦ã‚¹ã«ã‚ˆã‚‹ã ã‘ã§ãªã,\
+ノートブックウィジェットã®ãƒšãƒ¼ã‚¸ã®è¦‹å‡ºã—ãŒé¸æŠžã•れã¦ã„る時ã§ã‚れã°\
+Ctrl+Tabキーã®å…¥åŠ›ã«ã‚ˆã£ã¦ã‚‚行ã†ã“ã¨ãŒã§ãã¾ã™ï¼Ž\
+ã“ã®ãƒ‡ãƒ¢ã§ã¯ï¼Œè¦‹å‡ºã—ã§ä¸‹ç·šä»˜ãã®æ–‡å­—ã®ã‚­ãƒ¼ã¨Altキーã¨ã‚’組ã¿åˆã‚ã›ã‚‹ã“ã¨ã§\
+ãƒšãƒ¼ã‚¸ã‚’é¸æŠžã™ã‚‹ã“ã¨ãŒã§ãるよã†ã«ã‚‚設定ã—ã¦ã„ã¾ã™ï¼Ž\
+ãŸã ã—,2番目ã®ã‚¿ãƒ–ã¯ç„¡åŠ¹åŒ–ã•れã¦é¸æŠžã§ããªã„よã†ã«ãªã£ã¦ã„ã‚‹ã“ã¨ã«ã¯\
+注æ„ã—ã¦ãã ã•ã„.
EOL
neat = TkVariable.new
after_id = nil
-msg_b = Ttk::Button.new(f_msg, :text=>'¤¹¤Æ¤­¤À¡ª(Neat!)', :underline=>6,
+msg_b = Ttk::Button.new(f_msg, :text=>'ã™ã¦ãã ï¼(Neat!)', :underline=>6,
:command=>proc{
- neat.value = '¤¢¤¡¡¤¤½¤Î¤È¤ª¤ê¤µ¡¥¡¥¡¥'
+ neat.value = 'ã‚ã,ãã®ã¨ãŠã‚Šã•...'
Tk.after_cancel(after_id) if after_id
after_id = Tk.after(500){neat.value = ''}
})
msg_b.winfo_toplevel.bind('Alt-n'){ msg_b.focus; msg_b.invoke }
msg_l = Ttk::Label.new(f_msg, :textvariable=>neat)
-notebook.add(f_msg, :text=>'ÀâÌÀ(Description)', :underline=>3, :padding=>2)
+notebook.add(f_msg, :text=>'説明(Description)', :underline=>3, :padding=>2)
Tk.grid(msg_m, '-', :sticky=>'new', :pady=>2)
Tk.grid(msg_b, msg_l, :pady=>[2, 4], :padx=>20)
msg_b.grid_configure(:sticky=>'e')
@@ -82,11 +82,11 @@ f_msg.grid_columnconfigure([0, 1], :weight=>1, :uniform=>1)
## Populate the second pane. Note that the content doesn't really matter
f_disabled = Ttk::Frame.new(notebook)
-notebook.add(f_disabled, :text=>'̵¸ú²½¤µ¤ì¤¿¥¿¥Ö', :state=>:disabled)
+notebook.add(f_disabled, :text=>'無効化ã•れãŸã‚¿ãƒ–', :state=>:disabled)
## Popuplate the third pane
f_editor = Ttk::Frame.new(notebook)
-notebook.add(f_editor, :text=>'¥Æ¥­¥¹¥È¥¨¥Ç¥£¥¿(Text Editor)', :underline=>9)
+notebook.add(f_editor, :text=>'テキストエディタ(Text Editor)', :underline=>9)
editor_t = Tk::Text.new(f_editor, :width=>40, :height=>10, :wrap=>:char)
if Tk.windowingsystem != 'aqua'
editor_s = editor_t.yscrollbar(Ttk::Scrollbar.new(f_editor))
diff --git a/ext/tk/sample/demos-jp/ttkpane.rb b/ext/tk/sample/demos-jp/ttkpane.rb
index a7b458a683..a5c1a08ec9 100644
--- a/ext/tk/sample/demos-jp/ttkpane.rb
+++ b/ext/tk/sample/demos-jp/ttkpane.rb
@@ -1,4 +1,4 @@
-# -*- coding: euc-jp -*-
+# -*- coding: utf-8 -*-
#
# ttkpane.rb --
#
@@ -21,9 +21,9 @@ base_frame = TkFrame.new($ttkpane_demo).pack(:fill=>:both, :expand=>true)
Ttk::Label.new(base_frame, :font=>$font, :wraplength=>'4i', :justify=>:left,
:text=><<EOL).pack(:side=>:top, :fill=>:x)
-¤³¤Î¥Ç¥â¤Ï¡¤Ëä¤á¹þ¤ß´Ø·¸¤Ë¤¢¤ë¥Æ¡¼¥ÞÉÕ¤­¥Ú¥¤¥ó¥É¥¦¥£¥ó¥É¥¦¤ò¼¨¤·¤Æ¤¤¤Þ¤¹¡¥\
-¤½¤ì¤¾¤ì¤ÎÂ礭¤µ¤Ï¡¤´Þ¤Þ¤ì¤Æ¤¤¤ë¥Ú¥¤¥ó¤Î´Ö¤Ë¤¢¤ë¥¨¥ê¥¢¤ò¤Ä¤«¤ó¤Ç\
-¶­³¦¤ò¥É¥é¥Ã¥°¤¹¤ë¤³¤È¤ÇÊѹ¹¤Ç¤­¤Þ¤¹¡¥
+ã“ã®ãƒ‡ãƒ¢ã¯ï¼ŒåŸ‹ã‚è¾¼ã¿é–¢ä¿‚ã«ã‚るテーマ付ãペインドウィンドウを示ã—ã¦ã„ã¾ã™ï¼Ž\
+ãれãžã‚Œã®å¤§ãã•ã¯ï¼Œå«ã¾ã‚Œã¦ã„るペインã®é–“ã«ã‚るエリアをã¤ã‹ã‚“ã§\
+境界をドラッグã™ã‚‹ã“ã¨ã§å¤‰æ›´ã§ãã¾ã™ï¼Ž
EOL
Ttk::Separator.new(base_frame).pack(:side=>:top, :fill=>:x)
@@ -33,10 +33,10 @@ Ttk::Frame.new(base_frame) {|frame|
sep = Ttk::Separator.new(frame)
Tk.grid(sep, :columnspan=>4, :row=>0, :sticky=>'ew', :pady=>2)
TkGrid('x',
- Ttk::Button.new(frame, :text=>'¥³¡¼¥É»²¾È',
+ Ttk::Button.new(frame, :text=>'コードå‚ç…§',
:image=>$image['view'], :compound=>:left,
:command=>proc{showCode 'ttkpane'}),
- Ttk::Button.new(frame, :text=>'ÊĤ¸¤ë',
+ Ttk::Button.new(frame, :text=>'é–‰ã˜ã‚‹',
:image=>$image['delete'], :compound=>:left,
:command=>proc{
$ttkpane_demo.destroy
@@ -52,19 +52,19 @@ frame = Ttk::Frame.new(base_frame).pack(:fill=>:both, :expand=>true)
outer = Ttk::Panedwindow.new(frame, :orient=>:horizontal)
outer.add(in_left = Ttk::Panedwindow.new(outer, :orient=>:vertical))
outer.add(in_right = Ttk::Panedwindow.new(outer, :orient=>:vertical))
-in_left.add(left_top = Ttk::Labelframe.new(in_left, :text=>'¥Ü¥¿¥ó'))
-in_left.add(left_bot = Ttk::Labelframe.new(in_left, :text=>'»þ·×'))
-in_right.add(right_top = Ttk::Labelframe.new(in_right, :text=>'¥×¥í¥°¥ì¥¹'))
-in_right.add(right_bot = Ttk::Labelframe.new(in_right, :text=>'¥Æ¥­¥¹¥È'))
+in_left.add(left_top = Ttk::Labelframe.new(in_left, :text=>'ボタン'))
+in_left.add(left_bot = Ttk::Labelframe.new(in_left, :text=>'時計'))
+in_right.add(right_top = Ttk::Labelframe.new(in_right, :text=>'プログレス'))
+in_right.add(right_bot = Ttk::Labelframe.new(in_right, :text=>'テキスト'))
if Tk.windowingsystem == 'aqua'
[left_top, left_bot, right_top, right_bot].each{|w| w.padding(3) }
end
# Fill the button pane
-Ttk::Button.new(left_top, :text=>'²¡¤·¤Æ¤Í',
+Ttk::Button.new(left_top, :text=>'押ã—ã¦ã­',
:command=>proc{
Tk.messageBox(:type=>'ok', :icon=>'info',
- :message=>'¤¤¤Æ¤Æ¡ª',
+ :message=>'ã„ã¦ã¦ï¼',
:detail=>'That hurt...', :parent=>base_frame,
:title=>'Button Pressed')
}).pack(:padx=>2, :pady=>5)
diff --git a/ext/tk/sample/demos-jp/ttkprogress.rb b/ext/tk/sample/demos-jp/ttkprogress.rb
index 82898bf50e..ec28253a9f 100644
--- a/ext/tk/sample/demos-jp/ttkprogress.rb
+++ b/ext/tk/sample/demos-jp/ttkprogress.rb
@@ -1,4 +1,4 @@
-# -*- coding: euc-jp -*-
+# -*- coding: utf-8 -*-
#
# ttkprogress.rb --
#
@@ -21,16 +21,16 @@ base_frame = TkFrame.new($ttkprogress_demo).pack(:fill=>:both, :expand=>true)
Ttk::Label.new(base_frame, :font=>$font, :wraplength=>'4i', :justify=>:left,
:text=><<EOL).pack(:side=>:top, :fill=>:x)
-²¼¤Ë¤¢¤ë¤Î¤ÏÆó¤Ä¤Î¥×¥í¥°¥ì¥¹¥Ð¡¼¤Ç¤¹¡¥\
-¾å¤Î¤â¤Î¤Ï"determinate"¥¿¥¤¥×¤Î¥×¥í¥°¥ì¥¹¥Ð¡¼¤Ç¡¤\
-Î㤨¤Ð¥×¥í¥°¥é¥à¤¬Í¿¤¨¤é¤ì¤¿¥¿¥¹¥¯¤ò½ªÎ»¤¹¤ë¤Þ¤Ç¤Ë¤É¤Î¤¯¤é¤¤¤«¤«¤ë¤«¤ò\
-¼¨¤¹¤È¤­¤Ê¤É¤ËÍѤ¤¤é¤ì¤Þ¤¹¡¥\
-²¼¤Î¤â¤Î¤Ï"indeterminate"¥¿¥¤¥×¤Î¥×¥í¥°¥ì¥¹¥Ð¡¼¤Ç¡¤\
-Î㤨¤Ð¥×¥í¥°¥é¥à¤¬¼Â¹ÔÃæ(busy)¤Ç¤¢¤ë¤â¤Î¤Î\
-½ªÎ»¤Þ¤Ç¤Ë¤É¤ì¤¯¤é¤¤¤«¤«¤ë¤«¤Ïʬ¤«¤é¤Ê¤¤¤È¤¤¤¦¾õÂÖ¤ò\
-¼¨¤¹¤È¤­¤Ê¤É¤ËÍѤ¤¤é¤ì¤Þ¤¹¡¥\
-¤¤¤º¤ì¤Î¥×¥í¥°¥ì¥¹¥Ð¡¼¤â¡¤¤¹¤°²¼¤Ë¤¢¤ë¥Ü¥¿¥ó¤ò»È¤¦¤³¤È¤Ç\
-¼«Æ°¥¢¥Ë¥á¡¼¥·¥ç¥ó¥â¡¼¥É¤ÎON/OFF¤òÀÚÂØ¤¨¤ë¤³¤È¤¬¤Ç¤­¤Þ¤¹¡¥
+下ã«ã‚ã‚‹ã®ã¯äºŒã¤ã®ãƒ—ログレスãƒãƒ¼ã§ã™ï¼Ž\
+上ã®ã‚‚ã®ã¯"determinate"タイプã®ãƒ—ログレスãƒãƒ¼ã§ï¼Œ\
+例ãˆã°ãƒ—ログラムãŒä¸Žãˆã‚‰ã‚ŒãŸã‚¿ã‚¹ã‚¯ã‚’終了ã™ã‚‹ã¾ã§ã«ã©ã®ãらã„ã‹ã‹ã‚‹ã‹ã‚’\
+示ã™ã¨ããªã©ã«ç”¨ã„られã¾ã™ï¼Ž\
+下ã®ã‚‚ã®ã¯"indeterminate"タイプã®ãƒ—ログレスãƒãƒ¼ã§ï¼Œ\
+例ãˆã°ãƒ—ログラムãŒå®Ÿè¡Œä¸­(busy)ã§ã‚ã‚‹ã‚‚ã®ã®\
+終了ã¾ã§ã«ã©ã‚Œãらã„ã‹ã‹ã‚‹ã‹ã¯åˆ†ã‹ã‚‰ãªã„ã¨ã„ã†çŠ¶æ…‹ã‚’\
+示ã™ã¨ããªã©ã«ç”¨ã„られã¾ã™ï¼Ž\
+ã„ãšã‚Œã®ãƒ—ログレスãƒãƒ¼ã‚‚,ã™ã下ã«ã‚るボタンを使ã†ã“ã¨ã§\
+自動アニメーションモードã®ON/OFFを切替ãˆã‚‹ã“ã¨ãŒã§ãã¾ã™ï¼Ž
EOL
## See Code / Dismiss buttons
@@ -38,10 +38,10 @@ Ttk::Frame.new(base_frame) {|frame|
sep = Ttk::Separator.new(frame)
Tk.grid(sep, :columnspan=>4, :row=>0, :sticky=>'ew', :pady=>2)
TkGrid('x',
- Ttk::Button.new(frame, :text=>'¥³¡¼¥É»²¾È',
+ Ttk::Button.new(frame, :text=>'コードå‚ç…§',
:image=>$image['view'], :compound=>:left,
:command=>proc{showCode 'ttkprogress'}),
- Ttk::Button.new(frame, :text=>'ÊĤ¸¤ë',
+ Ttk::Button.new(frame, :text=>'é–‰ã˜ã‚‹',
:image=>$image['delete'], :compound=>:left,
:command=>proc{
$ttkprogress_demo.destroy
diff --git a/ext/tk/sample/demos-jp/twind.rb b/ext/tk/sample/demos-jp/twind.rb
index bd0b060754..f13a137cc3 100644
--- a/ext/tk/sample/demos-jp/twind.rb
+++ b/ext/tk/sample/demos-jp/twind.rb
@@ -1,15 +1,15 @@
-# -*- coding: euc-jp -*-
+# -*- coding: utf-8 -*-
#
# text (embedded windows) widget demo (called by 'widget')
#
-# toplevel widget ¤¬Â¸ºß¤¹¤ì¤Ðºï½ü¤¹¤ë
+# toplevel widget ãŒå­˜åœ¨ã™ã‚Œã°å‰Šé™¤ã™ã‚‹
if defined?($twind_demo) && $twind_demo
$twind_demo.destroy
$twind_demo = nil
end
-# demo ÍѤΠtoplevel widget ¤òÀ¸À®
+# demo 用㮠toplevel widget を生æˆ
$twind_demo = TkToplevel.new {|w|
title("Text Demonstration - Embedded Windows")
iconname("Embedded Windows")
@@ -18,11 +18,11 @@ $twind_demo = TkToplevel.new {|w|
base_frame = TkFrame.new($twind_demo).pack(:fill=>:both, :expand=>true)
-# frame À¸À®
+# frame 生æˆ
$twind_buttons = TkFrame.new(base_frame) {|frame|
TkButton.new(frame) {
- #text 'λ²ò'
- text 'ÊĤ¸¤ë'
+ #text '了解'
+ text 'é–‰ã˜ã‚‹'
command proc{
tmppath = $twind_demo
$twind_demo = nil
@@ -31,13 +31,13 @@ $twind_buttons = TkFrame.new(base_frame) {|frame|
}.pack('side'=>'left', 'expand'=>'yes')
TkButton.new(frame) {
- text '¥³¡¼¥É»²¾È'
+ text 'コードå‚ç…§'
command proc{showCode 'twind'}
}.pack('side'=>'left', 'expand'=>'yes')
}
$twind_buttons.pack('side'=>'bottom', 'fill'=>'x', 'pady'=>'2m')
-# frame À¸À®
+# frame 生æˆ
$twind_text = nil
TkFrame.new(base_frame, 'highlightthickness'=>2, 'borderwidth'=>2,
'relief'=>'sunken') {|f|
@@ -51,7 +51,7 @@ TkFrame.new(base_frame, 'highlightthickness'=>2, 'borderwidth'=>2,
}.pack('expand'=>'yes', 'fill'=>'both')
}.pack('expand'=>'yes', 'fill'=>'both')
-# ¥¿¥°À¸À®
+# タグ生æˆ
$tag_center = TkTextTag.new($twind_text,
'justify' =>'center',
'spacing1'=>'5m',
@@ -64,70 +64,70 @@ $tag_buttons = TkTextTag.new($twind_text,
'spacing2'=>0,
'spacing3'=>0 )
-# ¥Æ¥­¥¹¥È¤ÎÀ¸À®
+# テキストã®ç”Ÿæˆ
$twind_text.insert('end',
- '¥Æ¥­¥¹¥Èwidget¾å¤Ë¾¤Îwidget¤òÁȤ߹þ¤à¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£')
+ 'テキストwidget上ã«ä»–ã®widgetを組ã¿è¾¼ã‚€ã“ã¨ãŒã§ãã¾ã™ã€‚')
$twind_text.insert('end',
- 'ÁȤ߹þ¤ß¥¦¥£¥ó¥É¥¦¤È¸Æ¤Ð¤ì¡¢Ç¤°Õ¤Îwidget¤¬²Äǽ¤Ç¤¹¡£')
+ '組ã¿è¾¼ã¿ã‚¦ã‚£ãƒ³ãƒ‰ã‚¦ã¨å‘¼ã°ã‚Œã€ä»»æ„ã®widgetãŒå¯èƒ½ã§ã™ã€‚')
$twind_text.insert('end',
- 'Î㤨¤Ð¡¢¤³¤³¤Ë2¤Ä¤Î¥Ü¥¿¥ówidget¤¬ÁȤ߹þ¤Þ¤ì¤Æ¤¤¤Þ¤¹¡£')
-$twind_text.insert('end', 'ºÇ½é¤Î¥Ü¥¿¥ó¤ò¥¯¥ê¥Ã¥¯¤¹¤È¿åÊ¿Êý¸þ¤Î¥¹¥¯¥í¡¼¥ë¤ò')
+ '例ãˆã°ã€ã“ã“ã«2ã¤ã®ãƒœã‚¿ãƒ³widgetãŒçµ„ã¿è¾¼ã¾ã‚Œã¦ã„ã¾ã™ã€‚')
+$twind_text.insert('end', '最åˆã®ãƒœã‚¿ãƒ³ã‚’クリックã™ã¨æ°´å¹³æ–¹å‘ã®ã‚¹ã‚¯ãƒ­ãƒ¼ãƒ«ã‚’')
TkTextWindow.new($twind_text, 'end',
'window'=>TkButton.new($twind_text) {
#text 'ON'
- text '¥ª¥ó'
+ text 'オン'
command proc{textWindOn $twind_text,$twind_buttons}
cursor 'top_left_arrow'
})
-$twind_text.insert('end', "¤Ë¤·¤Þ¤¹¡£¤Þ¤¿2¤Ä¤á¤Î¥Ü¥¿¥ó¤ò¥¯¥ê¥Ã¥¯¤¹¤ë¤È\n")
-$twind_text.insert('end', '¿åÊ¿Êý¸þ¤Î¥¹¥¯¥í¡¼¥ë¤ò')
+$twind_text.insert('end', "ã«ã—ã¾ã™ã€‚ã¾ãŸ2ã¤ã‚ã®ãƒœã‚¿ãƒ³ã‚’クリックã™ã‚‹ã¨\n")
+$twind_text.insert('end', '水平方å‘ã®ã‚¹ã‚¯ãƒ­ãƒ¼ãƒ«ã‚’')
TkTextWindow.new($twind_text, 'end',
'window'=>TkButton.new($twind_text) {
#text 'OFF'
- text '¥ª¥Õ'
+ text 'オフ'
command proc{textWindOff $twind_text}
cursor 'top_left_arrow'
})
-$twind_text.insert('end', '¤Ë¤·¤Þ¤¹¡£')
+$twind_text.insert('end', 'ã«ã—ã¾ã™ã€‚')
-$twind_text.insert('end', '¤â¤¦¤Ò¤È¤Ä¤ÎÎã¤Ç¤¹¡£')
+$twind_text.insert('end', 'ã‚‚ã†ã²ã¨ã¤ã®ä¾‹ã§ã™ã€‚')
TkTextWindow.new($twind_text, 'end',
'window'=>TkButton.new($twind_text) {
- text '¤³¤³¤ò¥¯¥ê¥Ã¥¯'
+ text 'ã“ã“をクリック'
command proc{textWindPlot $twind_text}
cursor 'top_left_arrow'
})
-$twind_text.insert('end', '¤¹¤ë¤È¡¢x-y¥×¥í¥Ã¥È¤¬¤³¤³¤Ë¸½¤ì¤Þ¤¹¡£')
+$twind_text.insert('end', 'ã™ã‚‹ã¨ã€x-yプロットãŒã“ã“ã«ç¾ã‚Œã¾ã™ã€‚')
$mark_plot = TkTextMark.new($twind_text, 'insert')
$mark_plot.gravity='left'
-$twind_text.insert('end', '¥Þ¥¦¥¹¤Ç¥Ç¡¼¥¿¤òÉÁ²è¤¹¤ë¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£')
+$twind_text.insert('end', 'マウスã§ãƒ‡ãƒ¼ã‚¿ã‚’æç”»ã™ã‚‹ã“ã¨ãŒã§ãã¾ã™ã€‚')
TkTextWindow.new($twind_text, 'end',
'window'=>TkButton.new($twind_text) {
- text '¾Ãµî'
+ text '消去'
command proc{textWindDel $twind_text}
cursor 'top_left_arrow'
})
-$twind_text.insert('end', '¤ò¥¯¥ê¥Ã¥¯¤¹¤ë¤È¸µ¤ËÌá¤ê¤Þ¤¹¡£
+$twind_text.insert('end', 'をクリックã™ã‚‹ã¨å…ƒã«æˆ»ã‚Šã¾ã™ã€‚
')
-$twind_text.insert('end', 'ÁȤ߹þ¤ß¥¦¥£¥ó¥É¥¦¤À¤±¤ò¥Æ¥­¥¹¥Èwidget¾å¤Ë¡¢¼ÂºÝ¤Î')
-$twind_text.insert('end', '¥Æ¥­¥¹¥È¤Ï¤Ê¤·¤ÇÁȤ߹þ¤à¤³¤È¤ÏÊØÍø¤Ç¤¹¡£')
-$twind_text.insert('end', '¤³¤Î¾ì¹ç¤Ï¡¢¥Æ¥­¥¹¥Èwidget¤Ï¥¦¥£¥ó¥É¥¦¥Þ¥Í¡¼¥¸¥ã¤Î')
-$twind_text.insert('end', '¤è¤¦¤Ëưºî¤·¤Þ¤¹¡£Î㤨¤Ð¡¢¤³¤³¤Ë¤Ï¥Æ¥­¥¹¥Èwidget¤Ë')
-$twind_text.insert('end', '¤è¤Ã¤Æ¥Ü¥¿¥ó¤¬¤­¤ì¤¤¤Ëʤ٤é¤ì¤Æ¤¤¤Þ¤¹¡£')
-$twind_text.insert('end', '¤³¤ì¤é¤Î¥Ü¥¿¥ó¤ÇÇØ·Ê¿§¤òÊѤ¨¤ë¤³¤È¤¬¤Ç¤­¤Þ¤¹')
-$twind_text.insert('end', '("Default"¤Ç¸µ¤Î¿§¤ËÌ᤹¤³¤È¤¬¤Ç¤­¤Þ¤¹)¡£')
-$twind_text.insert('end', '"Short"¤È¤¤¤¦¥Ü¥¿¥ó¤ò¥¯¥ê¥Ã¥¯¤¹¤ë¤Èʸ»úÎó¤ÎŤµ¤¬')
-$twind_text.insert('end', 'ÊѤï¤ê¤Þ¤¹¡£¤¹¤ë¤È¼«Æ°Åª¤Ë¥Æ¥­¥¹¥Èwidget¤¬')
-$twind_text.insert('end', '¥ì¥¤¥¢¥¦¥È¤òÀ°¤¨¤Æ¤¯¤ì¤Þ¤¹¡£')
-$twind_text.insert('end', '¤â¤¦°ìÅÙÆ±¤¸¥Ü¥¿¥ó¤ò²¡¤¹¤È¸µ¤ËÌá¤ê¤Þ¤¹¡£
+$twind_text.insert('end', '組ã¿è¾¼ã¿ã‚¦ã‚£ãƒ³ãƒ‰ã‚¦ã ã‘をテキストwidget上ã«ã€å®Ÿéš›ã®')
+$twind_text.insert('end', 'テキストã¯ãªã—ã§çµ„ã¿è¾¼ã‚€ã“ã¨ã¯ä¾¿åˆ©ã§ã™ã€‚')
+$twind_text.insert('end', 'ã“ã®å ´åˆã¯ã€ãƒ†ã‚­ã‚¹ãƒˆwidgetã¯ã‚¦ã‚£ãƒ³ãƒ‰ã‚¦ãƒžãƒãƒ¼ã‚¸ãƒ£ã®')
+$twind_text.insert('end', 'よã†ã«å‹•作ã—ã¾ã™ã€‚例ãˆã°ã€ã“ã“ã«ã¯ãƒ†ã‚­ã‚¹ãƒˆwidgetã«')
+$twind_text.insert('end', 'よã£ã¦ãƒœã‚¿ãƒ³ãŒãれã„ã«ä¸¦ã¹ã‚‰ã‚Œã¦ã„ã¾ã™ã€‚')
+$twind_text.insert('end', 'ã“れらã®ãƒœã‚¿ãƒ³ã§èƒŒæ™¯è‰²ã‚’変ãˆã‚‹ã“ã¨ãŒã§ãã¾ã™')
+$twind_text.insert('end', '("Default"ã§å…ƒã®è‰²ã«æˆ»ã™ã“ã¨ãŒã§ãã¾ã™)。')
+$twind_text.insert('end', '"Short"ã¨ã„ã†ãƒœã‚¿ãƒ³ã‚’クリックã™ã‚‹ã¨æ–‡å­—列ã®é•·ã•ãŒ')
+$twind_text.insert('end', '変ã‚りã¾ã™ã€‚ã™ã‚‹ã¨è‡ªå‹•çš„ã«ãƒ†ã‚­ã‚¹ãƒˆwidgetãŒ')
+$twind_text.insert('end', 'レイアウトを整ãˆã¦ãれã¾ã™ã€‚')
+$twind_text.insert('end', 'ã‚‚ã†ä¸€åº¦åŒã˜ãƒœã‚¿ãƒ³ã‚’押ã™ã¨å…ƒã«æˆ»ã‚Šã¾ã™ã€‚
')
TkTextWindow.new($twind_text, 'end',
'window'=>TkButton.new($twind_text) {|b|
- text '¥Ç¥Õ¥©¥ë¥È'
+ text 'デフォルト'
command proc{embDefBg $twind_text}
cursor 'top_left_arrow'
$tag_buttons.add('end')
@@ -163,7 +163,7 @@ TkTextWindow.new($twind_text, 'end',
'pady'=>2 )
}
-# ¥á¥½¥Ã¥ÉÄêµÁ
+# メソッド定義
def textWindOn (w,f)
if defined? $twind_scroll
begin
diff --git a/ext/tk/sample/demos-jp/twind2.rb b/ext/tk/sample/demos-jp/twind2.rb
index 96000b0e14..a783ba4738 100644
--- a/ext/tk/sample/demos-jp/twind2.rb
+++ b/ext/tk/sample/demos-jp/twind2.rb
@@ -1,15 +1,15 @@
-# -*- coding: euc-jp -*-
+# -*- coding: utf-8 -*-
#
# text (embedded windows) widget demo 2 (called by 'widget')
#
-# toplevel widget ¤¬Â¸ºß¤¹¤ì¤Ðºï½ü¤¹¤ë
+# toplevel widget ãŒå­˜åœ¨ã™ã‚Œã°å‰Šé™¤ã™ã‚‹
if defined?($twind2_demo) && $twind2_demo
$twind2_demo.destroy
$twind2_demo = nil
end
-# demo ÍѤΠtoplevel widget ¤òÀ¸À®
+# demo 用㮠toplevel widget を生æˆ
$twind2_demo = TkToplevel.new {|w|
title("Text Demonstration - Embedded Windows 2")
iconname("Embedded Windows")
@@ -18,15 +18,15 @@ $twind2_demo = TkToplevel.new {|w|
base_frame = TkFrame.new($twind2_demo).pack(:fill=>:both, :expand=>true)
-# frame À¸À®
+# frame 生æˆ
$twind2_buttons = TkFrame.new(base_frame) {|frame|
TkGrid(TkFrame.new(frame, :height=>2, :relief=>:sunken, :bd=>2),
:columnspan=>4, :row=>0, :sticky=>'ew', :pady=>2)
TkGrid('x',
- TkButton.new(frame, :text=>'¥³¡¼¥É»²¾È',
+ TkButton.new(frame, :text=>'コードå‚ç…§',
:image=>$image['view'], :compound=>:left,
:command=>proc{showCode 'twind2'}),
- TkButton.new(frame, :text=>'ÊĤ¸¤ë',
+ TkButton.new(frame, :text=>'é–‰ã˜ã‚‹',
:image=>$image['delete'], :compound=>:left,
:command=>proc{
tmppath = $twind2_demo
@@ -39,7 +39,7 @@ $twind2_buttons = TkFrame.new(base_frame) {|frame|
}
$twind2_buttons.pack('side'=>'bottom', 'fill'=>'x', 'pady'=>'2m')
-# frame À¸À®
+# frame 生æˆ
$twind2_text = nil
TkFrame.new(base_frame, 'highlightthickness'=>2, 'borderwidth'=>2,
'relief'=>'sunken') {|f|
@@ -54,7 +54,7 @@ TkFrame.new(base_frame, 'highlightthickness'=>2, 'borderwidth'=>2,
}.pack('expand'=>'yes', 'fill'=>'both')
}.pack('expand'=>'yes', 'fill'=>'both')
-# ¥¿¥°À¸À®
+# タグ生æˆ
$tag2_center = TkTextTag.new($twind2_text,
'justify' =>'center',
'spacing1'=>'5m',
@@ -67,82 +67,82 @@ $tag2_buttons = TkTextTag.new($twind2_text,
'spacing2'=>0,
'spacing3'=>0 )
-# ¥Æ¥­¥¹¥È¤ÎÀ¸À®
-$twind2_text.insert('end', '¥Æ¥­¥¹¥È¥¦¥£¥¸¥§¥Ã¥È¤Ë¤Ï¿§¡¹¤Ê¼ïÎà¤Î¥¢¥¤¥Æ¥à')
-$twind2_text.insert('end', '¡ÊưŪ¤Ê¤â¤Î¤äÀÅŪ¤Ê¤â¤Î¤ÎξÊý¤¬¤¢¤ê¤Þ¤¹¡Ë¤ò')
-$twind2_text.insert('end', '¿ô¿¤¯´Þ¤á¤ë¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£¤½¤¦¤·¤¿¥¢¥¤¥Æ¥à¤Ï')
-$twind2_text.insert('end', '¹ÔÂØ¤¨¡¢¥¿¥Ö¡¢Ãæ±û·¤¨¤Ê¤É¤ÎÍÍ¡¹¤ÊÊýË¡¤Ç')
-$twind2_text.insert('end', 'ÇÛÃÖ¤¹¤ë¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£')
-$twind2_text.insert('end', '²Ã¤¨¤Æ¡¢¥Æ¥­¥¹¥È¥¦¥£¥¸¥§¥Ã¥È¤ÎÆâÍÆÊª¤¬')
-$twind2_text.insert('end', '¥¦¥£¥ó¥É¥¦¥µ¥¤¥º¤ËÈæ¤Ù¤ÆÂ礭¤¹¤®¤ë¾ì¹ç¤Ç¤â')
-$twind2_text.insert('end', '¤¹¤Ù¤Æ¤ÎÊý¸þ¤Ë¥¹¥à¡¼¥º¤Ë¥¹¥¯¥í¡¼¥ë¤µ¤»¤Æ')
-$twind2_text.insert('end', '³Îǧ¤¹¤ë¤³¤È¤¬²Äǽ¤Ç¤¹¡£')
+# テキストã®ç”Ÿæˆ
+$twind2_text.insert('end', 'テキストウィジェットã«ã¯è‰²ã€…ãªç¨®é¡žã®ã‚¢ã‚¤ãƒ†ãƒ ')
+$twind2_text.insert('end', '(動的ãªã‚‚ã®ã‚„é™çš„ãªã‚‚ã®ã®ä¸¡æ–¹ãŒã‚りã¾ã™ï¼‰ã‚’')
+$twind2_text.insert('end', '数多ãå«ã‚ã‚‹ã“ã¨ãŒã§ãã¾ã™ã€‚ãã†ã—ãŸã‚¢ã‚¤ãƒ†ãƒ ã¯')
+$twind2_text.insert('end', '行替ãˆã€ã‚¿ãƒ–ã€ä¸­å¤®æƒãˆãªã©ã®æ§˜ã€…ãªæ–¹æ³•ã§')
+$twind2_text.insert('end', 'é…ç½®ã™ã‚‹ã“ã¨ãŒã§ãã¾ã™ã€‚')
+$twind2_text.insert('end', '加ãˆã¦ã€ãƒ†ã‚­ã‚¹ãƒˆã‚¦ã‚£ã‚¸ã‚§ãƒƒãƒˆã®å†…容物ãŒ')
+$twind2_text.insert('end', 'ã‚¦ã‚£ãƒ³ãƒ‰ã‚¦ã‚µã‚¤ã‚ºã«æ¯”ã¹ã¦å¤§ãã™ãŽã‚‹å ´åˆã§ã‚‚')
+$twind2_text.insert('end', 'ã™ã¹ã¦ã®æ–¹å‘ã«ã‚¹ãƒ ãƒ¼ã‚ºã«ã‚¹ã‚¯ãƒ­ãƒ¼ãƒ«ã•ã›ã¦')
+$twind2_text.insert('end', '確èªã™ã‚‹ã“ã¨ãŒå¯èƒ½ã§ã™ã€‚')
$twind2_text.insert('end', "\n\n")
-$twind2_text.insert('end', '¥Æ¥­¥¹¥È¥¦¥£¥¸¥§¥Ã¥È¾å¤Ë¤Ï¾¤Î¥¦¥£¥¸¥§¥Ã¥È¤ò')
-$twind2_text.insert('end', '´Þ¤á¤ë¤³¤È¤â¤Ç¤­¤Þ¤¹¡£¤³¤¦¤·¤¿¤â¤Î¤Ï')
-$twind2_text.insert('end', '¡ÖËä¤á¹þ¤ß¥¦¥£¥ó¥É¥¦¡×¤È¸Æ¤Ð¤ì¡¢¤½¤ÎÃæ¤Ë')
-$twind2_text.insert('end', '¤¤¤«¤Ê¤ë¥¦¥£¥¸¥§¥Ã¥È¤Ç¤âµÍ¤á¹þ¤à¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£')
-$twind2_text.insert('end', 'Î㤨¤Ð¡¤¤³¤³¤Ë¤Ï£²¤Ä¤Î')
-$twind2_text.insert('end', '¥Ü¥¿¥ó¥¦¥£¥¸¥§¥Ã¥È¤¬Ëä¤á¹þ¤Þ¤ì¤Æ¤¤¤Þ¤¹¡£')
-$twind2_text.insert('end', 'ºÇ½é¤Î¥Ü¥¿¥ó¤ò¥¯¥ê¥Ã¥¯¤¹¤ë¤È¡¢')
-$twind2_text.insert('end', '¿åÊ¿Êý¸þ¤Î¥¹¥¯¥í¡¼¥ë¤ò ')
+$twind2_text.insert('end', 'テキストウィジェット上ã«ã¯ä»–ã®ã‚¦ã‚£ã‚¸ã‚§ãƒƒãƒˆã‚’')
+$twind2_text.insert('end', 'å«ã‚ã‚‹ã“ã¨ã‚‚ã§ãã¾ã™ã€‚ã“ã†ã—ãŸã‚‚ã®ã¯')
+$twind2_text.insert('end', '「埋ã‚è¾¼ã¿ã‚¦ã‚£ãƒ³ãƒ‰ã‚¦ã€ã¨å‘¼ã°ã‚Œã€ãã®ä¸­ã«')
+$twind2_text.insert('end', 'ã„ã‹ãªã‚‹ã‚¦ã‚£ã‚¸ã‚§ãƒƒãƒˆã§ã‚‚è©°ã‚込むã“ã¨ãŒã§ãã¾ã™ã€‚')
+$twind2_text.insert('end', '例ãˆã°ï¼Œã“ã“ã«ã¯ï¼’ã¤ã®')
+$twind2_text.insert('end', 'ボタンウィジェットãŒåŸ‹ã‚è¾¼ã¾ã‚Œã¦ã„ã¾ã™ã€‚')
+$twind2_text.insert('end', '最åˆã®ãƒœã‚¿ãƒ³ã‚’クリックã™ã‚‹ã¨ã€')
+$twind2_text.insert('end', '水平方å‘ã®ã‚¹ã‚¯ãƒ­ãƒ¼ãƒ«ã‚’ ')
TkTextWindow.new($twind2_text, 'end',
'window'=>TkButton.new($twind2_text) {
#text 'ON'
- text '¥ª¥ó'
+ text 'オン'
command proc{textWindOn2 $twind2_text,$twind2_buttons}
cursor 'top_left_arrow'
})
-$twind2_text.insert('end', "¤Ë¤·¤Þ¤¹¡£¤Þ¤¿¡¢£²¤Ä¤á¤Î¥Ü¥¿¥ó¤ò¥¯¥ê¥Ã¥¯¤¹¤ë¤È\n")
-$twind2_text.insert('end', '¿åÊ¿Êý¸þ¤Î¥¹¥¯¥í¡¼¥ë¤ò')
+$twind2_text.insert('end', "ã«ã—ã¾ã™ã€‚ã¾ãŸã€ï¼’ã¤ã‚ã®ãƒœã‚¿ãƒ³ã‚’クリックã™ã‚‹ã¨\n")
+$twind2_text.insert('end', '水平方å‘ã®ã‚¹ã‚¯ãƒ­ãƒ¼ãƒ«ã‚’')
TkTextWindow.new($twind2_text, 'end',
'window'=>TkButton.new($twind2_text) {
#text 'OFF'
- text '¥ª¥Õ'
+ text 'オフ'
command proc{textWindOff2 $twind2_text}
cursor 'top_left_arrow'
})
-$twind2_text.insert('end', "¤Ë¤·¤Þ¤¹¡£\n\n")
+$twind2_text.insert('end', "ã«ã—ã¾ã™ã€‚\n\n")
-$twind2_text.insert('end', '¼¡¤Ï¤â¤¦¤Ò¤È¤Ä¤ÎÎã¤Ç¤¹¡£')
+$twind2_text.insert('end', '次ã¯ã‚‚ã†ã²ã¨ã¤ã®ä¾‹ã§ã™ã€‚')
TkTextWindow.new($twind2_text, 'end',
'window'=>TkButton.new($twind2_text) {
- text '¤³¤³¤ò¥¯¥ê¥Ã¥¯'
+ text 'ã“ã“をクリック'
command proc{textWindPlot2 $twind2_text}
cursor 'top_left_arrow'
})
-$twind2_text.insert('end', '¤¹¤ë¤È¡¢x-y¥×¥í¥Ã¥È¤¬¤³¤³¤Ë¸½¤ì¤Þ¤¹¡£')
+$twind2_text.insert('end', 'ã™ã‚‹ã¨ã€x-yプロットãŒã“ã“ã«ç¾ã‚Œã¾ã™ã€‚')
$mark2_plot = TkTextMark.new($twind2_text, 'insert')
$mark2_plot.gravity='left'
-$twind2_text.insert('end', '¥Þ¥¦¥¹¤Ç¥É¥é¥Ã¥°¤¹¤ë¤³¤È¤Ç¡¢')
-$twind2_text.insert('end', '¥×¥í¥Ã¥È¾å¤Î¥Ç¡¼¥¿ÅÀ¤ò°Üư¤¹¤ë¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£')
+$twind2_text.insert('end', 'マウスã§ãƒ‰ãƒ©ãƒƒã‚°ã™ã‚‹ã“ã¨ã§ã€')
+$twind2_text.insert('end', 'プロット上ã®ãƒ‡ãƒ¼ã‚¿ç‚¹ã‚’移動ã™ã‚‹ã“ã¨ãŒã§ãã¾ã™ã€‚')
TkTextWindow.new($twind2_text, 'end',
'window'=>TkButton.new($twind2_text) {
- text '¾Ãµî'
+ text '消去'
command proc{textWindDel2 $twind2_text}
cursor 'top_left_arrow'
})
-$twind2_text.insert('end', '¤ò¥¯¥ê¥Ã¥¯¤¹¤ë¤È¸µ¤ËÌá¤ê¤Þ¤¹¡£')
+$twind2_text.insert('end', 'をクリックã™ã‚‹ã¨å…ƒã«æˆ»ã‚Šã¾ã™ã€‚')
$twind2_text.insert('end', "\n\n")
-$twind2_text.insert('end', 'ɽ¼¨¤¹¤ë¥Æ¥­¥¹¥È¤Ê¤·¤ËËä¤á¹þ¤ß¥¦¥£¥ó¥É¥¦¤À¤±¤ò')
-$twind2_text.insert('end', '¥Æ¥­¥¹¥È¥¦¥£¥¸¥§¥Ã¥È¤Ë´Þ¤á¤ë¤³¤È¤âÍ­ÍѤǤ·¤ç¤¦¡£')
-$twind2_text.insert('end', '¤³¤Î¾ì¹ç¡¢¥Æ¥­¥¹¥È¥¦¥£¥¸¥§¥Ã¥È¤Ï')
-$twind2_text.insert('end', '¥¸¥ª¥á¥È¥ê¥Þ¥Í¡¼¥¸¥ã¤Î¤è¤¦¤ËƯ¤­¤Þ¤¹¡£')
-$twind2_text.insert('end', 'Î㤨¤Ð¡¢¤³¤³¤Ë¤Ï¥Æ¥­¥¹¥È¥¦¥£¥¸¥§¥Ã¥È¤Ë')
-$twind2_text.insert('end', '¤è¤Ã¤Æ¥Ü¥¿¥ó¤¬¤­¤ì¤¤¤ËÀ°Îó¤·¤ÆÇÛÃÖ¤µ¤ì¤Æ¤¤¤Þ¤¹¡£')
-$twind2_text.insert('end', '¤³¤ì¤é¤Î¥Ü¥¿¥ó¤ò¥¯¥ê¥Ã¥¯¤¹¤ë¤³¤È¤Ç¡¢')
-$twind2_text.insert('end', '¤³¤Î¥Æ¥­¥¹¥È¥¦¥£¥¸¥§¥Ã¥È¤ÎÇØ·Ê¿§¤ò')
-$twind2_text.insert('end', 'ÊѤ¨¤ë¤³¤È¤¬¤Ç¤­¤Þ¤¹("¥Ç¥Õ¥©¥ë¥È"¥Ü¥¿¥ó¤Ç')
-$twind2_text.insert('end', '¸µ¤Î¿§¤ËÌ᤹¤³¤È¤¬¤Ç¤­¤Þ¤¹)¡£')
-$twind2_text.insert('end', '"Short"¤È¤¤¤¦¥Ü¥¿¥ó¤ò¥¯¥ê¥Ã¥¯¤¹¤ë¤Èʸ»úÎó¤ÎŤµ¤¬')
-$twind2_text.insert('end', 'ÊѤï¤ê¡¢¥Æ¥­¥¹¥È¥¦¥£¥¸¥§¥Ã¥È¤¬¼«Æ°Åª¤Ë')
-$twind2_text.insert('end', '¥ì¥¤¥¢¥¦¥È¤òÀ°¤¨¤ëÍͻҤò¸«¤ë¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£')
-$twind2_text.insert('end', '¤â¤¦°ìÅÙÆ±¤¸¥Ü¥¿¥ó¤ò²¡¤¹¤È¸µ¤ËÌá¤ê¤Þ¤¹¡£')
+$twind2_text.insert('end', '表示ã™ã‚‹ãƒ†ã‚­ã‚¹ãƒˆãªã—ã«åŸ‹ã‚è¾¼ã¿ã‚¦ã‚£ãƒ³ãƒ‰ã‚¦ã ã‘ã‚’')
+$twind2_text.insert('end', 'テキストウィジェットã«å«ã‚ã‚‹ã“ã¨ã‚‚有用ã§ã—ょã†ã€‚')
+$twind2_text.insert('end', 'ã“ã®å ´åˆã€ãƒ†ã‚­ã‚¹ãƒˆã‚¦ã‚£ã‚¸ã‚§ãƒƒãƒˆã¯')
+$twind2_text.insert('end', 'ジオメトリマãƒãƒ¼ã‚¸ãƒ£ã®ã‚ˆã†ã«åƒãã¾ã™ã€‚')
+$twind2_text.insert('end', '例ãˆã°ã€ã“ã“ã«ã¯ãƒ†ã‚­ã‚¹ãƒˆã‚¦ã‚£ã‚¸ã‚§ãƒƒãƒˆã«')
+$twind2_text.insert('end', 'よã£ã¦ãƒœã‚¿ãƒ³ãŒãれã„ã«æ•´åˆ—ã—ã¦é…ç½®ã•れã¦ã„ã¾ã™ã€‚')
+$twind2_text.insert('end', 'ã“れらã®ãƒœã‚¿ãƒ³ã‚’クリックã™ã‚‹ã“ã¨ã§ã€')
+$twind2_text.insert('end', 'ã“ã®ãƒ†ã‚­ã‚¹ãƒˆã‚¦ã‚£ã‚¸ã‚§ãƒƒãƒˆã®èƒŒæ™¯è‰²ã‚’')
+$twind2_text.insert('end', '変ãˆã‚‹ã“ã¨ãŒã§ãã¾ã™("デフォルト"ボタンã§')
+$twind2_text.insert('end', 'å…ƒã®è‰²ã«æˆ»ã™ã“ã¨ãŒã§ãã¾ã™)。')
+$twind2_text.insert('end', '"Short"ã¨ã„ã†ãƒœã‚¿ãƒ³ã‚’クリックã™ã‚‹ã¨æ–‡å­—列ã®é•·ã•ãŒ')
+$twind2_text.insert('end', '変ã‚りã€ãƒ†ã‚­ã‚¹ãƒˆã‚¦ã‚£ã‚¸ã‚§ãƒƒãƒˆãŒè‡ªå‹•çš„ã«')
+$twind2_text.insert('end', 'レイアウトを整ãˆã‚‹æ§˜å­ã‚’見るã“ã¨ãŒã§ãã¾ã™ã€‚')
+$twind2_text.insert('end', 'ã‚‚ã†ä¸€åº¦åŒã˜ãƒœã‚¿ãƒ³ã‚’押ã™ã¨å…ƒã«æˆ»ã‚Šã¾ã™ã€‚')
$twind2_text.insert('end', "\n")
btn_default = TkButton.new($twind2_text) {|b|
- text '¥Ç¥Õ¥©¥ë¥È'
+ text 'デフォルト'
command proc{embDefBg2 $twind2_text}
cursor 'top_left_arrow'
}
@@ -184,8 +184,8 @@ $text_normal2['border'] = $twind2_text.cget('borderwidth')
$text_normal2['highlight'] = $twind2_text.cget('highlightthickness')
$text_normal2['pad'] = $twind2_text.cget('padx')
-$twind2_text.insert('end', "\nborder width ¤ä highlightthickness, ")
-$twind2_text.insert('end', "padding ¤òÄ̾ï¤ÎÃͤ«¤éÊѹ¹¤¹¤ë¤³¤È¤â²Äǽ¤Ç¤¹¡£\n")
+$twind2_text.insert('end', "\nborder width ã‚„ highlightthickness, ")
+$twind2_text.insert('end', "padding を通常ã®å€¤ã‹ã‚‰å¤‰æ›´ã™ã‚‹ã“ã¨ã‚‚å¯èƒ½ã§ã™ã€‚\n")
TkTextWindow.new($twind2_text, 'end',
'window'=>TkButton.new($twind2_text, :text=>"Big borders",
@@ -229,8 +229,8 @@ TkTextWindow.new($twind2_text, 'end',
textWinSmallP2 $twind2_text
}))
-$twind2_text.insert('end', "\n\n¹¹¤Ë¥¤¥á¡¼¥¸¤â¥Æ¥­¥¹¥È¥¦¥£¥¸¥§¥Ã¥È¤Ë")
-$twind2_text.insert('end', "¤¦¤Þ¤¯ÇÛÃ֤Ǥ­¤Þ¤¹¡§")
+$twind2_text.insert('end', "\n\næ›´ã«ã‚¤ãƒ¡ãƒ¼ã‚¸ã‚‚テキストウィジェットã«")
+$twind2_text.insert('end', "ã†ã¾ãé…ç½®ã§ãã¾ã™ï¼š")
TkTextImage.new($twind2_text, 'end',
'image'=>TkBitmapImage.new(:file=>[
@@ -238,7 +238,7 @@ TkTextImage.new($twind2_text, 'end',
'images', 'face.xbm'
].join(File::Separator)))
-# ¥á¥½¥Ã¥ÉÄêµÁ
+# メソッド定義
def textWinBigB2(w)
w.borderwidth 15
end
diff --git a/ext/tk/sample/demos-jp/unicodeout.rb b/ext/tk/sample/demos-jp/unicodeout.rb
index 4857cd131d..31596cf8fd 100644
--- a/ext/tk/sample/demos-jp/unicodeout.rb
+++ b/ext/tk/sample/demos-jp/unicodeout.rb
@@ -1,4 +1,4 @@
-# -*- coding: euc-jp -*-
+# -*- coding: utf-8 -*-
#
# unicodeout.rb --
#
@@ -23,41 +23,41 @@ base_frame = TkFrame.new($unicodeout_demo).pack(:fill=>:both, :expand=>true)
TkLabel.new(base_frame,
:font=>$font, :wraplength=>'5.4i', :justify=>:left,
:text=><<EOL).pack(:side=>:top)
-¤³¤ì¤Ï¡¤Tk¤Ë¤ª¤±¤ëÈó²¤ÊÆÊ¸»ú½¸¹ç¤òÍѤ¤¤ë¸À¸ì¤ËÂФ¹¤ë¥µ¥Ý¡¼¥È¤Ë¤Ä¤¤¤Æ¤Î\
-¥µ¥ó¥×¥ë¤Ç¤¹¡¥¤¿¤À¤·¡¤²¼¤Îɽ¼¨¤Ë¤ª¤¤¤Æ¤¢¤Ê¤¿¤¬¼ÂºÝ¤Ë¤É¤Î¤è¤¦¤Êɽ¼¨¤ò\
-Ìܤˤ¹¤ë¤«¤Ï¡¤¤¢¤Ê¤¿¤Î´Ä¶­¤Ë¤É¤Î¤è¤¦¤Êʸ»ú½¸¹ç¤¬¥¤¥ó¥¹¥È¡¼¥ë¤µ¤ì¤Æ¤¤¤ë¤«¤Ë\
-Â礭¤¯°Í¸¤·¤Þ¤¹¡¥¤Þ¤¿¡¤ÂоݤȤʤëʸ»ú½¸¹ç¤¬¥¤¥ó¥¹¥È¡¼¥ë¤µ¤ì¤Æ¤¤¤Ê¤¤¾ì¹ç¤Ë\
-¤É¤Î¤è¤¦¤Êɽ¼¨¤¬¤Ê¤µ¤ì¤ë¤«¤â¤¢¤Ê¤¿¤Î´Ä¶­¼¡Âè¤Ç¤¹¡¥\
-¡Ö¥³¡¼¥É»²¾È¡×¥Ü¥¿¥ó¤ò²¡¤·¤Æ¥½¡¼¥¹¤òɽ¼¨¤·¡¤\
-Unicodeout_SampleFrame¥¯¥é¥¹¤Î@@font¤ÎÄêµÁ¤ò½ñ¤­´¹¤¨¤Æ\
-(¥Õ¥¡¥¤¥ë¤ÎÆâÍÆ¤ÏÊѹ¹¤µ¤ì¤Þ¤»¤ó)\
-¡ÖºÆ¼Â¹Ô¡×¥Ü¥¿¥ó¤Î¥¯¥ê¥Ã¥¯¤ò»î¤·¤Æ¤ß¤Æ¤¯¤À¤µ¤¤¡¥
-¥¹¥¯¥ê¥×¥È¤¬²ÄÈÂÀ­¤ò»ý¤Ä¤è¤¦¤Ë¡¤Ê¸»úÎó¤Ï\\uXXXX¤È¤¤¤¦\
-Tcl¤Î¥¨¥¹¥±¡¼¥×ɽ¸½¤òÍѤ¤¤¿UNICODEʸ»úÎó¤Ç½ñ¤«¤ì¤Æ¤¤¤Þ¤¹¡¥\
-ʸ»úÎó¤Ï¡¤Tk::UTF8_String¥á¥½¥Ã¥É¤Ë¤è¤Ã¤Æ¡¤\
-¡ÖUTF8·Á¼°¤Îʸ»úÎó¤Ç¤¢¤ë¡×¤È¤¤¤¦\
-¥¨¥ó¥³¡¼¥É¾ðÊóÉÕ¤­¤Îʸ»úÎ󥪥֥¸¥§¥¯¥È\
-(Tcl¤Î¥¨¥¹¥±¡¼¥×ɽ¸½¤ÎÊÑ´¹ºÑ¤ß)¤ËÊÑ´¹¤·¤Æ\
-¥é¥Ù¥ë¥¦¥£¥¸¥§¥Ã¥È¤ËÅϤ·¤Æ¤¤¤ëÅÀ¤ËÃí°Õ¤·¤Æ¤¯¤À¤µ¤¤¡¥
+ã“れã¯ï¼ŒTkã«ãŠã‘ã‚‹éžæ¬§ç±³æ–‡å­—集åˆã‚’用ã„る言語ã«å¯¾ã™ã‚‹ã‚µãƒãƒ¼ãƒˆã«ã¤ã„ã¦ã®\
+サンプルã§ã™ï¼ŽãŸã ã—,下ã®è¡¨ç¤ºã«ãŠã„ã¦ã‚ãªãŸãŒå®Ÿéš›ã«ã©ã®ã‚ˆã†ãªè¡¨ç¤ºã‚’\
+ç›®ã«ã™ã‚‹ã‹ã¯ï¼Œã‚ãªãŸã®ç’°å¢ƒã«ã©ã®ã‚ˆã†ãªæ–‡å­—集åˆãŒã‚¤ãƒ³ã‚¹ãƒˆãƒ¼ãƒ«ã•れã¦ã„ã‚‹ã‹ã«\
+大ããä¾å­˜ã—ã¾ã™ï¼Žã¾ãŸï¼Œå¯¾è±¡ã¨ãªã‚‹æ–‡å­—集åˆãŒã‚¤ãƒ³ã‚¹ãƒˆãƒ¼ãƒ«ã•れã¦ã„ãªã„å ´åˆã«\
+ã©ã®ã‚ˆã†ãªè¡¨ç¤ºãŒãªã•れるã‹ã‚‚ã‚ãªãŸã®ç’°å¢ƒæ¬¡ç¬¬ã§ã™ï¼Ž\
+「コードå‚ç…§ã€ãƒœã‚¿ãƒ³ã‚’押ã—ã¦ã‚½ãƒ¼ã‚¹ã‚’表示ã—,\
+Unicodeout_SampleFrameクラスã®@@fontã®å®šç¾©ã‚’æ›¸ãæ›ãˆã¦\
+(ファイルã®å†…容ã¯å¤‰æ›´ã•れã¾ã›ã‚“)\
+「å†å®Ÿè¡Œã€ãƒœã‚¿ãƒ³ã®ã‚¯ãƒªãƒƒã‚¯ã‚’試ã—ã¦ã¿ã¦ãã ã•ã„.
+スクリプトãŒå¯æ¬æ€§ã‚’æŒã¤ã‚ˆã†ã«ï¼Œæ–‡å­—列ã¯\\uXXXXã¨ã„ã†\
+Tclã®ã‚¨ã‚¹ã‚±ãƒ¼ãƒ—表ç¾ã‚’用ã„ãŸUNICODEæ–‡å­—åˆ—ã§æ›¸ã‹ã‚Œã¦ã„ã¾ã™ï¼Ž\
+文字列ã¯ï¼ŒTk::UTF8_Stringメソッドã«ã‚ˆã£ã¦ï¼Œ\
+「UTF8å½¢å¼ã®æ–‡å­—列ã§ã‚ã‚‹ã€ã¨ã„ã†\
+エンコード情報付ãã®æ–‡å­—列オブジェクト\
+(Tclã®ã‚¨ã‚¹ã‚±ãƒ¼ãƒ—表ç¾ã®å¤‰æ›æ¸ˆã¿)ã«å¤‰æ›ã—ã¦\
+ãƒ©ãƒ™ãƒ«ã‚¦ã‚£ã‚¸ã‚§ãƒƒãƒˆã«æ¸¡ã—ã¦ã„ã‚‹ç‚¹ã«æ³¨æ„ã—ã¦ãã ã•ã„.
EOL
#'
TkFrame.new(base_frame){|f|
pack(:side=>:bottom, :fill=>:x, :pady=>'2m')
- TkButton.new(f, :text=>'ÊĤ¸¤ë', :width=>15, :command=>proc{
+ TkButton.new(f, :text=>'é–‰ã˜ã‚‹', :width=>15, :command=>proc{
$unicodeout_demo.destroy
$unicodeout_demo = nil
}).pack(:side=>:left, :expand=>true)
- TkButton.new(f, :text=>'¥³¡¼¥É»²¾È', :width=>15, :command=>proc{
+ TkButton.new(f, :text=>'コードå‚ç…§', :width=>15, :command=>proc{
showCode 'unicodeout'
}).pack(:side=>:left, :expand=>true)
}
wait_msg = TkLabel.new(base_frame,
- :text=>"¥Õ¥©¥ó¥ÈÆÉ¤ß¹þ¤ß¤Î´°Î»¤Þ¤Ç" +
- "¤·¤Ð¤é¤¯¤ªÂÔ¤Á²¼¤µ¤¤¡¥¡¥¡¥",
+ :text=>"フォント読ã¿è¾¼ã¿ã®å®Œäº†ã¾ã§" +
+ "ã—ã°ã‚‰ããŠå¾…ã¡ä¸‹ã•ã„...",
:font=>"Helvetica 12 italic").pack
class Unicodeout_SampleFrame < TkFrame
diff --git a/ext/tk/sample/demos-jp/vscale.rb b/ext/tk/sample/demos-jp/vscale.rb
index a1097fd77f..6ae513bc33 100644
--- a/ext/tk/sample/demos-jp/vscale.rb
+++ b/ext/tk/sample/demos-jp/vscale.rb
@@ -1,4 +1,4 @@
-# -*- coding: euc-jp -*-
+# -*- coding: utf-8 -*-
require "tkcanvas"
if defined?($vscale_demo) && $vscale_demo
@@ -18,17 +18,17 @@ msg = TkLabel.new(base_frame) {
font $font
wraplength '3.5i'
justify 'left'
-# text "²¼¤Ë¤ÏÌð°õ¤¬1¤Ä¤È¾èľ¤Ê¥¹¥±¡¼¥ë¤¬É½¼¨¤µ¤ì¤Æ¤¤¤Þ¤¹¡£\
-#¥¹¥±¡¼¥ë¾å¤Ç¥Þ¥¦¥¹¥Ü¥¿¥ó1¤ò¥¯¥ê¥Ã¥¯¡¢¤Þ¤¿¤Ï¥É¥é¥Ã¥°¤¹¤ë¤È\
-#Ìð°õ¤ÎŤµ¤òÊѤ¨¤ë¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£"
- text "¤Ë¤Ï¥Ð¡¼¤È½Ä·¿¤Î¥¹¥±¡¼¥ë¤¬É½¼¨¤µ¤ì¤Æ¤¤¤Þ¤¹¡£¥¹¥±¡¼¥ë¤Ç¥Þ¥¦¥¹¤Î¥Ü¥¿¥ó1 ¤ò¥¯¥ê¥Ã¥¯¤¹¤ë¤«¥É¥é¥Ã¥°¤·¤Æ¥Ð¡¼¤Î¹â¤µ¤òÊѤ¨¤ë¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£½ª¤Ã¤¿¤é¡Öλ²ò¡×¥Ü¥¿¥ó¤ò²¡¤·¤Æ¤¯¤À¤µ¤¤¡£"
+# text "下ã«ã¯çŸ¢å°ãŒ1ã¤ã¨ä¹—ç›´ãªã‚¹ã‚±ãƒ¼ãƒ«ãŒè¡¨ç¤ºã•れã¦ã„ã¾ã™ã€‚\
+#スケール上ã§ãƒžã‚¦ã‚¹ãƒœã‚¿ãƒ³1をクリックã€ã¾ãŸã¯ãƒ‰ãƒ©ãƒƒã‚°ã™ã‚‹ã¨\
+#矢å°ã®é•·ã•を変ãˆã‚‹ã“ã¨ãŒã§ãã¾ã™ã€‚"
+ text "ã«ã¯ãƒãƒ¼ã¨ç¸¦åž‹ã®ã‚¹ã‚±ãƒ¼ãƒ«ãŒè¡¨ç¤ºã•れã¦ã„ã¾ã™ã€‚スケールã§ãƒžã‚¦ã‚¹ã®ãƒœã‚¿ãƒ³1 をクリックã™ã‚‹ã‹ãƒ‰ãƒ©ãƒƒã‚°ã—ã¦ãƒãƒ¼ã®é«˜ã•を変ãˆã‚‹ã“ã¨ãŒã§ãã¾ã™ã€‚終ã£ãŸã‚‰ã€Œäº†è§£ã€ãƒœã‚¿ãƒ³ã‚’押ã—ã¦ãã ã•ã„。"
}
msg.pack('side'=>'top', 'padx'=>'.5c')
TkFrame.new(base_frame) {|frame|
TkButton.new(frame) {
- #text 'λ²ò'
- text 'ÊĤ¸¤ë'
+ #text '了解'
+ text 'é–‰ã˜ã‚‹'
command proc {
tmppath = $vscale_demo
$vscale_demo = nil
@@ -37,7 +37,7 @@ TkFrame.new(base_frame) {|frame|
}.pack('side'=>'left', 'expand'=>'yes')
TkButton.new(frame) {
- text '¥³¡¼¥É»²¾È'
+ text 'コードå‚ç…§'
command proc { showCode 'vscale' }
}.pack('side'=>'left', 'expand'=>'yes')
}.pack('side'=>'bottom', 'fill'=>'x', 'pady'=>'2m')
diff --git a/ext/tk/sample/demos-jp/widget b/ext/tk/sample/demos-jp/widget
index ae91031fb6..5f5dfb9d70 100644
--- a/ext/tk/sample/demos-jp/widget
+++ b/ext/tk/sample/demos-jp/widget
@@ -1,7 +1,7 @@
#!/usr/bin/env ruby
-# -*- coding: euc-jp -*-
+# -*- coding: utf-8 -*-
-# ´Á»ú¥³¡¼¥ÉÀßÄê ( tk.rb ¤Î¥í¡¼¥É»þ¤Î encoding ¿äÄê/ÀßÄê¤Ë»È¤ï¤ì¤ë )
+# 漢字コード設定 ( tk.rb ã®ãƒ­ãƒ¼ãƒ‰æ™‚ã® encoding 推定/設定ã«ä½¿ã‚れる )
#if RUBY_VERSION < '1.9.0' ### !!!!!!!!!!!!!!
unless defined?(::Encoding.default_external)
$KCODE = 'euc'
@@ -9,28 +9,28 @@ else
DEFAULT_TK_ENCODING = 'EUC-JP'
end
-# tk ´Ø·¸¥é¥¤¥Ö¥é¥ê¤ÎÆÉ¤ß¹þ¤ß
+# tk 関係ライブラリã®èª­ã¿è¾¼ã¿
require 'tk'
# require 'tkafter'
$RubyTk_WidgetDemo = true
-# widget demo directory °ÌÃÖ¤Î³ÍÆÀ
+# widget demo directory ä½ç½®ã®ç²å¾—
# $demo_dir = File.dirname($0)
$demo_dir = File.dirname(__FILE__)
-# root ¤ÎÀ¸À®
+# root ã®ç”Ÿæˆ
$root = TkRoot.new{title "Ruby/Tk Widget Demonstration"}
-# tk ¥Ð¡¼¥¸¥ç¥ó¤Î¼èÆÀ
+# tk ãƒãƒ¼ã‚¸ãƒ§ãƒ³ã®å–å¾—
$tk_version = Tk::TK_VERSION
$tk_major_ver, $tk_minor_ver = $tk_version.split('.').map{|n| n.to_i}
$tk_patchlevel = Tk::TK_PATCHLEVEL
-# tcl_platform ¾ðÊó¤Ø¤Î¥¢¥¯¥»¥¹¥ª¥Ö¥¸¥§¥¯¥È
+# tcl_platform 情報ã¸ã®ã‚¢ã‚¯ã‚»ã‚¹ã‚ªãƒ–ジェクト
$tk_platform = TkVarAccess.new('tcl_platform')
-# ¥Õ¥©¥ó¥ÈÀßÄê
+# フォント設定
#######
case($tk_version)
when /^4.*/
@@ -64,7 +64,7 @@ else
end
#######
-# ¥¤¥á¡¼¥¸ÀßÄê
+# イメージ設定
$image = {}
if $tk_major_ver >= 8
@@ -123,7 +123,7 @@ $image['print'] = TkPhotoImage.new(:height=>19, :format=>'GIF', :data=><<EOD)
EOD
end
-# ¥á¥Ë¥å¡¼ÀßÄê
+# メニュー設定
if $tk_major_ver >= 8
$root.add_menubar([[['File', 0],
['About ... ', proc{aboutBox}, 0, '<F1>'],
@@ -154,7 +154,7 @@ TkFrame.new($root){|frame|
}.pack('side'=>'top', 'fill'=>'x')
=end
-# ¥Æ¥­¥¹¥È¥Ü¥Ã¥¯¥¹¤ÎÀ¸À®
+# テキストボックスã®ç”Ÿæˆ
if $tk_version =~ /^4\.[01]/
scr = TkScrollbar.new($root, 'orient'=>'vertical')
txt = TkText.new($root) {
@@ -215,7 +215,7 @@ else
}.pack('side'=>'bottom', 'fill'=>'x', 'pady'=>2)
end
-# ¥Æ¥­¥¹¥È¥¿¥°ÀßÄê
+# テキストタグ設定
if $tk_version =~ /^4.*/
tag_title = TkTextTag.new(txt, 'font'=>'-*-Helvetica-Bold-R-Normal--*-180-*-*-*-*-*-*')
else
@@ -277,267 +277,267 @@ tag_demo.bind('Motion', proc{|x, y|
},
'%x %y')
-# ¥Æ¥­¥¹¥ÈÀ¸À®
+# テキスト生æˆ
txt.insert('end', 'Ruby/Tk : Widget', tag_title)
-#txt.insert('end', " ¥Ç¥â¥ó¥¹¥È¥ì¡¼¥·¥ç¥ó\n", tag_middle)
-txt.insert('end', " ¥Ç¥â¥ó¥¹¥È¥ì¡¼¥·¥ç¥ó\n", tag_kanji_title)
+#txt.insert('end', " デモンストレーション\n", tag_middle)
+txt.insert('end', " デモンストレーション\n", tag_kanji_title)
txt.insert('end', <<"EOT")
-¤³¤Î¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¤Ï¡¢Tk Widget ¤òÍѤ¤¤Æ¤É¤Î¤è¤¦¤Ê¤³¤È¤¬¤Ç¤­¤ë¤«\
-¤ò¼¨¤¹¤¿¤á¤Î¡¢¤¤¤¯¤Ä¤«¤Î¾®¤µ¤Ê¥¹¥¯¥ê¥×¥È¤ËÂФ¹¤ë¥Õ¥í¥ó¥È¥¨¥ó¥É¤òÄó\
-¶¡¤·¤Æ¤¤¤Þ¤¹¡£°Ê²¼¤Ë½çÈ֤˵󤲤é¤ì¤Æ¤¤¤ë¥Ç¥â¥ó¥¹¥È¥ì¡¼¥·¥ç¥ó¤ò¼Â¹Ô\
-¤¹¤ë¤Ë¤Ï¥Þ¥¦¥¹¤Ç¥¯¥ê¥Ã¥¯¤·¤Æ¤¯¤À¤µ¤¤¡£¥Ç¥â¥ó¥¹¥È¥ì¡¼¥·¥ç¥ó¤Î¥¦¥£¥ó\
-¥É¥¦¤¬¸½¤ì¤ë¤È¡¢¥Ç¥â¥ó¥¹¥È¥ì¡¼¥·¥ç¥ó¤òÀ¸À®¤·¤¿ Ruby/Tk ¤Î¥³¡¼¥É¤ò¸«\
-¤ë¤¿¤á¤Ë¡¢"¥³¡¼¥É»²¾È"¥Ü¥¿¥ó¤ò¥¯¥ê¥Ã¥¯¤¹¤ë¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£¤¢¤Ê¤¿¤¬\
-˾¤à¤Ê¤é¡¢¤½¤Î¥³¡¼¥É¤ò½¤Àµ¤¹¤ë¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£½¤Àµ¤·¤¿¥³¡¼¥É¤Ç¥Ç¥â\
-¥ó¥¹¥È¥ì¡¼¥·¥ç¥ó¤òºÆ¼Â¹Ô¤¹¤ë¤¿¤á¤Ë¤Ï¡¢¥³¡¼¥É¤¬½ñ¤«¤ì¤¿¥¦¥£¥ó¥É¥¦¤Ë\
-¤¢¤ë"¥Ç¥âºÆ¼Â¹Ô" ¥Ü¥¿¥ó¤ò¥¯¥ê¥Ã¥¯¤·¤Æ¤¯¤À¤µ¤¤¡£\
-¥³¡¼¥É¤ò½¤Àµ¤·¤Æ¤â¥ª¥ê¥¸¥Ê¥ë¤Î¥Õ¥¡¥¤¥ë¤¬½ñ¤­´¹¤¨¤é¤ì¤ë¤³¤È¤Ï\
-¤¢¤ê¤Þ¤»¤ó¤«¤é¡¢¿´ÇÛ¤»¤º¤Ë¿§¡¹¤ÊÊѹ¹¤ò»î¤·¤Æ¤ß¤Æ¤¯¤À¤µ¤¤¡£
-
-°ìÉô¤Î¥Ç¥â¤Ç¤Ï¡¢Èæ³ÓŪºÇ¶á¤Î¥Ð¡¼¥¸¥ç¥ó¤Î Tk ¤Ç¤Ê¤±¤ì¤Ð¥µ¥Ý¡¼¥È¤·¤Æ\
-¤¤¤Ê¤¤µ¡Ç½¤ò»È¤Ã¤Æ¼ÂÁõ¤·¤Æ¤¤¤Þ¤¹(Î㤨¤Ð Tk8.4 °Ê¾å¤Ê¤É)¡£¤½¤Î¤¿¤á¡¢\
-¤½¤¦¤·¤¿µ¡Ç½¤ò»ý¤¿¤Ê¤¤ Tk ¥é¥¤¥Ö¥é¥ê¤ò»È¤Ã¤Æ¤¤¤ë¾ì¹ç¤Ë¤Ï¡¢¤½¤¦¤·¤¿\
-¥Ç¥â¤ÏÀµ¤·¤¯Æ°¤­¤Þ¤»¤ó¡£¤½¤Î¤è¤¦¤Êµ¡Ç½¤¬É¬ÍפǤ¢¤ì¤Ð¡¢¤½¤ì¤ò¥µ¥Ý¡¼¥È\
-¤·¤Æ¤¤¤ë Tk ¥é¥¤¥Ö¥é¥ê¤ò»È¤¦¤è¤¦¤Ë tcltklib ¤ò¥³¥ó¥Ñ¥¤¥ë¤·¤Ê¤ª¤·¤Æ\
-¤¯¤À¤µ¤¤¡£
-
-¤â¤·¤¢¤Ê¤¿¤Î Tk ¤¬ (ºÇ½é¤«¤é´Þ¤à¤«¥¤¥ó¥¹¥È¡¼¥ë¤·¤¿¤«¤Ë¤è¤ê) \
-Ttk (Tile) ³ÈÄ¥¤òÍøÍѤǤ­¤ë¾õÂ֤Ǥ¢¤ë¤Ê¤é¡¢\
-Ttk ³ÈÄ¥¤Î¥Ç¥â (sample/tkextlib/tile/demo.rb) ¤â¤¼¤Ò»î¤·¤Æ¤ß¤Æ¤¯¤À¤µ¤¤¡£
-( ¿ʬ¡¤¸½ºß¤Î¤¢¤Ê¤¿¤Î´Ä¶­¤Ë¤Ï Ttk ³ÈÄ¥¤Ï\
+ã“ã®ã‚¢ãƒ—リケーションã¯ã€Tk Widget を用ã„ã¦ã©ã®ã‚ˆã†ãªã“ã¨ãŒã§ãã‚‹ã‹\
+を示ã™ãŸã‚ã®ã€ã„ãã¤ã‹ã®å°ã•ãªã‚¹ã‚¯ãƒªãƒ—トã«å¯¾ã™ã‚‹ãƒ•ロントエンドをæ\
+ä¾›ã—ã¦ã„ã¾ã™ã€‚以下ã«é †ç•ªã«æŒ™ã’られã¦ã„るデモンストレーションを実行\
+ã™ã‚‹ã«ã¯ãƒžã‚¦ã‚¹ã§ã‚¯ãƒªãƒƒã‚¯ã—ã¦ãã ã•ã„。デモンストレーションã®ã‚¦ã‚£ãƒ³\
+ドウãŒç¾ã‚Œã‚‹ã¨ã€ãƒ‡ãƒ¢ãƒ³ã‚¹ãƒˆãƒ¬ãƒ¼ã‚·ãƒ§ãƒ³ã‚’生æˆã—㟠Ruby/Tk ã®ã‚³ãƒ¼ãƒ‰ã‚’見\
+ã‚‹ãŸã‚ã«ã€"コードå‚ç…§"ボタンをクリックã™ã‚‹ã“ã¨ãŒã§ãã¾ã™ã€‚ã‚ãªãŸãŒ\
+望むãªã‚‰ã€ãã®ã‚³ãƒ¼ãƒ‰ã‚’修正ã™ã‚‹ã“ã¨ãŒã§ãã¾ã™ã€‚修正ã—ãŸã‚³ãƒ¼ãƒ‰ã§ãƒ‡ãƒ¢\
+ンストレーションをå†å®Ÿè¡Œã™ã‚‹ãŸã‚ã«ã¯ã€ã‚³ãƒ¼ãƒ‰ãŒæ›¸ã‹ã‚ŒãŸã‚¦ã‚£ãƒ³ãƒ‰ã‚¦ã«\
+ã‚ã‚‹"デモå†å®Ÿè¡Œ" ボタンをクリックã—ã¦ãã ã•ã„。\
+コードを修正ã—ã¦ã‚‚オリジナルã®ãƒ•ã‚¡ã‚¤ãƒ«ãŒæ›¸ãæ›ãˆã‚‰ã‚Œã‚‹ã“ã¨ã¯\
+ã‚りã¾ã›ã‚“ã‹ã‚‰ã€å¿ƒé…ã›ãšã«è‰²ã€…ãªå¤‰æ›´ã‚’試ã—ã¦ã¿ã¦ãã ã•ã„。
+
+一部ã®ãƒ‡ãƒ¢ã§ã¯ã€æ¯”較的最近ã®ãƒãƒ¼ã‚¸ãƒ§ãƒ³ã® Tk ã§ãªã‘れã°ã‚µãƒãƒ¼ãƒˆã—ã¦\
+ã„ãªã„機能を使ã£ã¦å®Ÿè£…ã—ã¦ã„ã¾ã™(例ãˆã° Tk8.4 以上ãªã©)。ãã®ãŸã‚ã€\
+ãã†ã—ãŸæ©Ÿèƒ½ã‚’æŒãŸãªã„ Tk ライブラリを使ã£ã¦ã„ã‚‹å ´åˆã«ã¯ã€ãã†ã—ãŸ\
+ãƒ‡ãƒ¢ã¯æ­£ã—ãå‹•ãã¾ã›ã‚“。ãã®ã‚ˆã†ãªæ©Ÿèƒ½ãŒå¿…è¦ã§ã‚れã°ã€ãれをサãƒãƒ¼ãƒˆ\
+ã—ã¦ã„ã‚‹ Tk ライブラリを使ã†ã‚ˆã†ã« tcltklib をコンパイルã—ãªãŠã—ã¦\
+ãã ã•ã„。
+
+ã‚‚ã—ã‚ãªãŸã® Tk ㌠(最åˆã‹ã‚‰å«ã‚€ã‹ã‚¤ãƒ³ã‚¹ãƒˆãƒ¼ãƒ«ã—ãŸã‹ã«ã‚ˆã‚Š) \
+Ttk (Tile) 拡張を利用ã§ãる状態ã§ã‚ã‚‹ãªã‚‰ã€\
+Ttk æ‹¡å¼µã®ãƒ‡ãƒ¢ (sample/tkextlib/tile/demo.rb) ã‚‚ãœã²è©¦ã—ã¦ã¿ã¦ãã ã•ã„。
+( 多分,ç¾åœ¨ã®ã‚ãªãŸã®ç’°å¢ƒã«ã¯ Ttk æ‹¡å¼µã¯\
#{
begin
require 'tkextlib/tile'
- "¤¹¤Ç¤ËƳÆþ¤µ¤ì¤Æ¤¤¤Þ¤¹"
+ "ã™ã§ã«å°Žå…¥ã•れã¦ã„ã¾ã™"
rescue
- "¤Þ¤À¥¤¥ó¥¹¥È¡¼¥ë¤µ¤ì¤Æ¤¤¤Þ¤»¤ó"
+ "ã¾ã ã‚¤ãƒ³ã‚¹ãƒˆãƒ¼ãƒ«ã•れã¦ã„ã¾ã›ã‚“"
end
}\
-¡£)
-Ttk ³ÈÄ¥¤Ï¡¢Tk8.5 °Ê¾å¤Ç¤Ïɸ½à¤Îµ¡Ç½¤È¤·¤ÆÁȤ߹þ¤Þ¤ì¤Æ¤¤¤Þ¤¹¡£
+。)
+Ttk æ‹¡å¼µã¯ã€Tk8.5 以上ã§ã¯æ¨™æº–ã®æ©Ÿèƒ½ã¨ã—ã¦çµ„ã¿è¾¼ã¾ã‚Œã¦ã„ã¾ã™ã€‚
EOT
-#txt.insert('end',"¥é¥Ù¥ë, ¥Ü¥¿¥ó, ¥Á¥§¥Ã¥¯¥Ü¥¿¥ó, ¥é¥¸¥ª¥Ü¥¿¥ó\n",tag_middle)
-txt.insert('end', "¥é¥Ù¥ë, ¥Ü¥¿¥ó, ¥Á¥§¥Ã¥¯¥Ü¥¿¥ó, ¥é¥¸¥ª¥Ü¥¿¥ó\n",
+#txt.insert('end',"ラベル, ボタン, ãƒã‚§ãƒƒã‚¯ãƒœã‚¿ãƒ³, ラジオボタン\n",tag_middle)
+txt.insert('end', "ラベル, ボタン, ãƒã‚§ãƒƒã‚¯ãƒœã‚¿ãƒ³, ラジオボタン\n",
tag_kanji_title)
txt.insert('end', " \n ", tag_demospace)
-txt.insert('end', "1. ¥é¥Ù¥ë (¥Æ¥­¥¹¥È, ¥Ó¥Ã¥È¥Þ¥Ã¥×)\n",
+txt.insert('end', "1. ラベル (テキスト, ビットマップ)\n",
tag_demo, "demo-label")
txt.insert('end', " \n ", tag_demospace)
-txt.insert('end', "2. ¥é¥Ù¥ë¤ÈUNICODE¥Æ¥­¥¹¥È (µ¡Ç½¤ËÂбþ¤·¤¿¥Ð¡¼¥¸¥ç¥ó¤ÎTk¤¬É¬Í×)\n", tag_demo, "demo-unicodeout")
+txt.insert('end', "2. ラベルã¨UNICODEテキスト (機能ã«å¯¾å¿œã—ãŸãƒãƒ¼ã‚¸ãƒ§ãƒ³ã®TkãŒå¿…è¦)\n", tag_demo, "demo-unicodeout")
txt.insert('end', " \n ", tag_demospace)
-txt.insert('end', "3. ¥Ü¥¿¥ó \n", tag_demo, "demo-button")
+txt.insert('end', "3. ボタン \n", tag_demo, "demo-button")
txt.insert('end', " \n ", tag_demospace)
-txt.insert('end', "4. ¥Á¥§¥Ã¥¯¥Ü¥¿¥ó (Ê£¿ô¤òÁªÂò²Äǽ)\n",
+txt.insert('end', "4. ãƒã‚§ãƒƒã‚¯ãƒœã‚¿ãƒ³ (è¤‡æ•°ã‚’é¸æŠžå¯èƒ½)\n",
tag_demo, "demo-check")
txt.insert('end', " \n ", tag_demospace)
-txt.insert('end', "5. £³¾õÂÖ¥Á¥§¥Ã¥¯¥Ü¥¿¥ó (µ¡Ç½¤ËÂбþ¤·¤¿¥Ð¡¼¥¸¥ç¥ó¤ÎTk¤¬É¬Í×)\n",
+txt.insert('end', "5. 3状態ãƒã‚§ãƒƒã‚¯ãƒœã‚¿ãƒ³ (機能ã«å¯¾å¿œã—ãŸãƒãƒ¼ã‚¸ãƒ§ãƒ³ã®TkãŒå¿…è¦)\n",
tag_demo, "demo-check2")
txt.insert('end', " \n ", tag_demospace)
-txt.insert('end', "6. ¥é¥¸¥ª¥Ü¥¿¥ó (Ǥ°Õ¤Î°ì¤Ä¤òÁªÂò²Äǽ)\n",
+txt.insert('end', "6. ラジオボタン (ä»»æ„ã®ä¸€ã¤ã‚’é¸æŠžå¯èƒ½)\n",
tag_demo, "demo-radio")
txt.insert('end', " \n ", tag_demospace)
-txt.insert('end', "7. ¥é¥¸¥ª¥Ü¥¿¥ó (µ¡Ç½¤ËÂбþ¤·¤¿¥Ð¡¼¥¸¥ç¥ó¤ÎTk¤¬É¬Í×)\n",
+txt.insert('end', "7. ラジオボタン (機能ã«å¯¾å¿œã—ãŸãƒãƒ¼ã‚¸ãƒ§ãƒ³ã®TkãŒå¿…è¦)\n",
tag_demo, "demo-radio2")
txt.insert('end', " \n ", tag_demospace)
-txt.insert('end', "8. £³¾õÂ֥饸¥ª¥Ü¥¿¥ó (µ¡Ç½¤ËÂбþ¤·¤¿¥Ð¡¼¥¸¥ç¥ó¤ÎTk¤¬É¬Í×)\n",
+txt.insert('end', "8. 3状態ラジオボタン (機能ã«å¯¾å¿œã—ãŸãƒãƒ¼ã‚¸ãƒ§ãƒ³ã®TkãŒå¿…è¦)\n",
tag_demo, "demo-radio3")
txt.insert('end', " \n ", tag_demospace)
-txt.insert('end', "9. ¥Ü¥¿¥ó¤Çºî¤é¤ì¤¿15-¥Ñ¥º¥ë¥²¡¼¥à\n",
+txt.insert('end', "9. ボタンã§ä½œã‚‰ã‚ŒãŸ15-パズルゲーム\n",
tag_demo, "demo-puzzle")
txt.insert('end', " \n ", tag_demospace)
-txt.insert('end', "10. ¥Ó¥Ã¥È¥Þ¥Ã¥×¤ò»ÈÍѤ·¤¿¥¢¥¤¥³¥ó¥Ü¥¿¥ó\n",
+txt.insert('end', "10. ビットマップを使用ã—ãŸã‚¢ã‚¤ã‚³ãƒ³ãƒœã‚¿ãƒ³\n",
tag_demo, "demo-icon")
txt.insert('end', " \n ", tag_demospace)
-txt.insert('end', "11. ²èÁü¤òɽ¼¨¤¹¤ëÆó¤Ä¤Î¥é¥Ù¥ë\n",
+txt.insert('end', "11. ç”»åƒã‚’表示ã™ã‚‹äºŒã¤ã®ãƒ©ãƒ™ãƒ«\n",
tag_demo, "demo-image1")
txt.insert('end', " \n ", tag_demospace)
-txt.insert('end', "12. ²èÁü¤ò¸«¤ë¤¿¤á¤Î´Êñ¤Ê¥æ¡¼¥¶¥¤¥ó¥¿¡¼¥Õ¥§¡¼¥¹\n",
+txt.insert('end', "12. ç”»åƒã‚’見るãŸã‚ã®ç°¡å˜ãªãƒ¦ãƒ¼ã‚¶ã‚¤ãƒ³ã‚¿ãƒ¼ãƒ•ェース\n",
tag_demo, "demo-image2")
txt.insert('end', " \n ", tag_demospace)
-txt.insert('end', "13. ²èÁü¤ò¸«¤ë¤¿¤á¤Î´Êñ¤Ê¥æ¡¼¥¶¥¤¥ó¥¿¡¼¥Õ¥§¡¼¥¹ (µ¡Ç½¤ËÂбþ¤·¤¿¥Ð¡¼¥¸¥ç¥ó¤ÎTk¤¬É¬Í×)\n",
+txt.insert('end', "13. ç”»åƒã‚’見るãŸã‚ã®ç°¡å˜ãªãƒ¦ãƒ¼ã‚¶ã‚¤ãƒ³ã‚¿ãƒ¼ãƒ•ェース (機能ã«å¯¾å¿œã—ãŸãƒãƒ¼ã‚¸ãƒ§ãƒ³ã®TkãŒå¿…è¦)\n",
tag_demo, "demo-image3")
txt.insert('end', " \n ", tag_demospace)
-txt.insert('end', "14. ¥é¥Ù¥ëÉÕ¤­¥Õ¥ì¡¼¥à (µ¡Ç½¤ËÂбþ¤·¤¿¥Ð¡¼¥¸¥ç¥ó¤ÎTk¤¬É¬Í×)\n",
+txt.insert('end', "14. ラベル付ãフレーム (機能ã«å¯¾å¿œã—ãŸãƒãƒ¼ã‚¸ãƒ§ãƒ³ã®TkãŒå¿…è¦)\n",
tag_demo, "demo-labelframe")
txt.insert('end', " \n ", tag_demospace)
-txt.insert('end', "15. ¥Æ¡¼¥Þ¤ËÂбþ¤·¤¿¥¦¥£¥¸¥§¥Ã¥È¤Î´Êñ¤ÊÎã (Tile/Ttk³ÈÄ¥¤Ø¤ÎÂбþ¤¬É¬Í×)\n",
+txt.insert('end', "15. テーマã«å¯¾å¿œã—ãŸã‚¦ã‚£ã‚¸ã‚§ãƒƒãƒˆã®ç°¡å˜ãªä¾‹ (Tile/Ttkæ‹¡å¼µã¸ã®å¯¾å¿œãŒå¿…è¦)\n",
tag_demo, "demo-ttkbut")
txt.insert('end', " \n ", tag_demospace)
txt.insert('end', "\n")
-#txt.insert('end', "¥ê¥¹¥È¥Ü¥Ã¥¯¥¹\n", tag_middle)
-txt.insert('end', "¥ê¥¹¥È¥Ü¥Ã¥¯¥¹\n", tag_kanji_title)
+#txt.insert('end', "リストボックス\n", tag_middle)
+txt.insert('end', "リストボックス\n", tag_kanji_title)
txt.insert('end', " \n ", tag_demospace)
-txt.insert('end', "1. ÅÔÆ»Éܸ©.\n", tag_demo, "demo-states")
+txt.insert('end', "1. 都é“府県.\n", tag_demo, "demo-states")
txt.insert('end', " \n ", tag_demospace)
-txt.insert('end', "2. ¿§: ¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¤Î¤¿¤á¤ÎÇÛ¿§¤òÊѤ¨¤ë\n",
+txt.insert('end', "2. 色: アプリケーションã®ãŸã‚ã®é…色を変ãˆã‚‹\n",
"#{tag_demo.id} demo-colors")
txt.insert('end', " \n ", tag_demospace)
-txt.insert('end', "3. ³Ê¸À½¸\n", tag_demo, "demo-sayings")
+txt.insert('end', "3. 格言集\n", tag_demo, "demo-sayings")
txt.insert('end', " \n ", tag_demospace)
-txt.insert('end', "4. ¹ñ¤Ë¤Ä¤¤¤Æ¤Î¥Þ¥ë¥Á¥«¥é¥à¥ê¥¹¥È (Tile/Ttk³ÈÄ¥¤Ø¤ÎÂбþ¤¬É¬Í×)\n",
+txt.insert('end', "4. 国ã«ã¤ã„ã¦ã®ãƒžãƒ«ãƒã‚«ãƒ©ãƒ ãƒªã‚¹ãƒˆ (Tile/Ttkæ‹¡å¼µã¸ã®å¯¾å¿œãŒå¿…è¦)\n",
tag_demo, "demo-mclist")
txt.insert('end', " \n ", tag_demospace)
-txt.insert('end', "5. ¥Ç¥£¥ì¥¯¥È¥ê¥Ö¥é¥¦¥¶ (Tile/Ttk³ÈÄ¥¤Ø¤ÎÂбþ¤¬É¬Í×)\n",
+txt.insert('end', "5. ディレクトリブラウザ (Tile/Ttkæ‹¡å¼µã¸ã®å¯¾å¿œãŒå¿…è¦)\n",
tag_demo, "demo-tree")
txt.insert('end', " \n ", tag_demospace)
txt.insert('end', "\n")
-#txt.insert('end', "¥¨¥ó¥È¥ê¤È¥¹¥Ô¥ó¥Ü¥Ã¥¯¥¹\n", tag_middle)
-txt.insert('end', "¥¨¥ó¥È¥ê\n", tag_kanji_title)
+#txt.insert('end', "エントリã¨ã‚¹ãƒ”ンボックス\n", tag_middle)
+txt.insert('end', "エントリ\n", tag_kanji_title)
txt.insert('end', " \n ", tag_demospace)
-txt.insert('end', "1. ¥¹¥¯¥í¡¼¥ë¥Ð¡¼¤Ê¤·\n", tag_demo, "demo-entry1")
+txt.insert('end', "1. スクロールãƒãƒ¼ãªã—\n", tag_demo, "demo-entry1")
txt.insert('end', " \n ", tag_demospace)
-txt.insert('end', "2. ¥¹¥¯¥í¡¼¥ë¥Ð¡¼¤¢¤ê\n", tag_demo, "demo-entry2")
+txt.insert('end', "2. スクロールãƒãƒ¼ã‚り\n", tag_demo, "demo-entry2")
txt.insert('end', " \n ", tag_demospace)
-txt.insert('end', "3. ǧ¾Ú½èÍýÉÕ¤­¤Î¥¨¥ó¥È¥ê¥Ü¥Ã¥¯¥¹¤È¥Ñ¥¹¥ï¡¼¥É¥Õ¥£¡¼¥ë¥É (µ¡Ç½¤ËÂбþ¤·¤¿¥Ð¡¼¥¸¥ç¥ó¤ÎTk¤¬É¬Í×)\n",
+txt.insert('end', "3. èªè¨¼å‡¦ç†ä»˜ãã®ã‚¨ãƒ³ãƒˆãƒªãƒœãƒƒã‚¯ã‚¹ã¨ãƒ‘スワードフィールド (機能ã«å¯¾å¿œã—ãŸãƒãƒ¼ã‚¸ãƒ§ãƒ³ã®TkãŒå¿…è¦)\n",
tag_demo, "demo-entry3")
txt.insert('end', " \n ", tag_demospace)
-txt.insert('end', "4. ¥¹¥Ô¥ó¥Ü¥Ã¥¯¥¹ (µ¡Ç½¤ËÂбþ¤·¤¿¥Ð¡¼¥¸¥ç¥ó¤ÎTk¤¬É¬Í×)\n",
+txt.insert('end', "4. スピンボックス (機能ã«å¯¾å¿œã—ãŸãƒãƒ¼ã‚¸ãƒ§ãƒ³ã®TkãŒå¿…è¦)\n",
tag_demo, "demo-spin")
txt.insert('end', " \n ", tag_demospace)
-txt.insert('end', "5. ¥³¥ó¥Ü¥Ü¥Ã¥¯¥¹ (Tile/Ttk³ÈÄ¥¤Ø¤ÎÂбþ¤¬É¬Í×)\n",
+txt.insert('end', "5. コンボボックス (Tile/Ttkæ‹¡å¼µã¸ã®å¯¾å¿œãŒå¿…è¦)\n",
tag_demo, "demo-combo")
txt.insert('end', " \n ", tag_demospace)
-txt.insert('end', "6. ´Êñ¤Ê¥Õ¥©¡¼¥à\n", tag_demo, "demo-form")
+txt.insert('end', "6. ç°¡å˜ãªãƒ•ォーム\n", tag_demo, "demo-form")
txt.insert('end', " \n ", tag_demospace)
txt.insert('end', "\n")
-#txt.insert('end', "¥Æ¥­¥¹¥È\n", tag_middle)
-txt.insert('end', "¥Æ¥­¥¹¥È\n", tag_kanji_title)
+#txt.insert('end', "テキスト\n", tag_middle)
+txt.insert('end', "テキスト\n", tag_kanji_title)
txt.insert('end', " \n ", tag_demospace)
-txt.insert('end', "1. ´ðËÜŪ¤Ê¥Æ¥­¥¹¥È\n", tag_demo, "demo-text")
+txt.insert('end', "1. 基本的ãªãƒ†ã‚­ã‚¹ãƒˆ\n", tag_demo, "demo-text")
txt.insert('end', " \n ", tag_demospace)
-txt.insert('end', "2. ɽ¼¨¥¹¥¿¥¤¥ë.\n", tag_demo, "demo-style")
+txt.insert('end', "2. 表示スタイル.\n", tag_demo, "demo-style")
txt.insert('end', " \n ", tag_demospace)
-txt.insert('end', "3. ¥Ï¥¤¥Ñ¡¼¥Æ¥­¥¹¥È(¥¿¥°¥Ð¥¤¥ó¥É).\n",
+txt.insert('end', "3. ãƒã‚¤ãƒ‘ーテキスト(ã‚¿ã‚°ãƒã‚¤ãƒ³ãƒ‰).\n",
tag_demo, "demo-bind")
txt.insert('end', " \n ", tag_demospace)
-txt.insert('end', "4. ¥¦¥£¥ó¥É¥¦¤òËä¤á¹þ¤ó¤À¥Æ¥­¥¹¥È\n",
+txt.insert('end', "4. ウィンドウを埋ã‚込んã ãƒ†ã‚­ã‚¹ãƒˆ\n",
tag_demo, "demo-twind")
txt.insert('end', " \n ", tag_demospace)
-txt.insert('end', "5. ¥¦¥£¥ó¥É¥¦¤òËä¤á¹þ¤ó¤À¥Æ¥­¥¹¥È (µ¡Ç½¤ËÂбþ¤·¤¿¥Ð¡¼¥¸¥ç¥ó¤ÎTk¤¬É¬Í×)\n",
+txt.insert('end', "5. ウィンドウを埋ã‚込んã ãƒ†ã‚­ã‚¹ãƒˆ (機能ã«å¯¾å¿œã—ãŸãƒãƒ¼ã‚¸ãƒ§ãƒ³ã®TkãŒå¿…è¦)\n",
tag_demo, "demo-twind2")
txt.insert('end', " \n ", tag_demospace)
-txt.insert('end', "6. ¸¡º÷\n", tag_demo, "demo-search")
+txt.insert('end', "6. 検索\n", tag_demo, "demo-search")
txt.insert('end', " \n ", tag_demospace)
-txt.insert('end', "7. ¥Æ¥­¥¹¥È¥¦¥£¥¸¥§¥Ã¥È¤ÎÂÐÅù²½(peering) (µ¡Ç½¤ËÂбþ¤·¤¿¥Ð¡¼¥¸¥ç¥ó¤ÎTk¤¬É¬Í×)\n", tag_demo, "demo-textpeer")
+txt.insert('end', "7. テキストウィジェットã®å¯¾ç­‰åŒ–(peering) (機能ã«å¯¾å¿œã—ãŸãƒãƒ¼ã‚¸ãƒ§ãƒ³ã®TkãŒå¿…è¦)\n", tag_demo, "demo-textpeer")
txt.insert('end', " \n ", tag_demospace)
txt.insert('end', "\n")
-#txt.insert('end', "¥­¥ã¥ó¥Ð¥¹\n", tag_middle)
-txt.insert('end', "¥­¥ã¥ó¥Ð¥¹\n", tag_kanji_title)
+#txt.insert('end', "キャンãƒã‚¹\n", tag_middle)
+txt.insert('end', "キャンãƒã‚¹\n", tag_kanji_title)
txt.insert('end', " \n ", tag_demospace)
-txt.insert('end', "1. ¥¢¥¤¥Æ¥à¤Î·¿\n", tag_demo, "demo-items")
+txt.insert('end', "1. アイテムã®åž‹\n", tag_demo, "demo-items")
txt.insert('end', " \n ", tag_demospace)
-txt.insert('end', "2. 2 ¼¡¸µ¤Î¥×¥í¥Ã¥È\n", tag_demo, "demo-plot")
+txt.insert('end', "2. 2 次元ã®ãƒ—ロット\n", tag_demo, "demo-plot")
txt.insert('end', " \n ", tag_demospace)
-txt.insert('end', "3. ¥Æ¥­¥¹¥È\n", tag_demo, "demo-ctext")
+txt.insert('end', "3. テキスト\n", tag_demo, "demo-ctext")
txt.insert('end', " \n ", tag_demospace)
-txt.insert('end', "4. Ìð°õ¤Î·Á\n", tag_demo, "demo-arrow")
+txt.insert('end', "4. 矢å°ã®å½¢\n", tag_demo, "demo-arrow")
txt.insert('end', " \n ", tag_demospace)
-txt.insert('end', "5. ¥ë¡¼¥é¡¼\n", tag_demo, "demo-ruler")
+txt.insert('end', "5. ルーラー\n", tag_demo, "demo-ruler")
txt.insert('end', " \n ", tag_demospace)
-txt.insert('end', "6. ¥Õ¥í¥¢¥×¥é¥ó\n", tag_demo, "demo-floor")
+txt.insert('end', "6. フロアプラン\n", tag_demo, "demo-floor")
txt.insert('end', " \n ", tag_demospace)
-txt.insert('end', "7. ¥Õ¥í¥¢¥×¥é¥ó (°Û¤Ê¤ë¥­¥ã¥ó¥Ð¥¹¥¢¥¤¥Æ¥àºîÀ®ÊýË¡¤ò»ÈÍÑ)\n", tag_demo, "demo-floor2")
+txt.insert('end', "7. フロアプラン (ç•°ãªã‚‹ã‚­ãƒ£ãƒ³ãƒã‚¹ã‚¢ã‚¤ãƒ†ãƒ ä½œæˆæ–¹æ³•を使用)\n", tag_demo, "demo-floor2")
txt.insert('end', " \n ", tag_demospace)
-txt.insert('end', "8. ¥¹¥¯¥í¡¼¥ë²Äǽ¤Ê¥­¥ã¥ó¥Ð¥¹\n",
+txt.insert('end', "8. スクロールå¯èƒ½ãªã‚­ãƒ£ãƒ³ãƒã‚¹\n",
tag_demo, "demo-cscroll")
txt.insert('end', " \n ", tag_demospace)
-txt.insert('end', "9. ¥Á¥§¥¹¥Ü¡¼¥É¾å¤Îµ³»Î¤Î½ä²ó (Tile/Ttk³ÈÄ¥¤Ø¤ÎÂбþ¤¬É¬Í×)\n",
+txt.insert('end', "9. ãƒã‚§ã‚¹ãƒœãƒ¼ãƒ‰ä¸Šã®é¨Žå£«ã®å·¡å›ž (Tile/Ttkæ‹¡å¼µã¸ã®å¯¾å¿œãŒå¿…è¦)\n",
tag_demo, "demo-knightstour")
txt.insert('end', " \n ", tag_demospace)
txt.insert('end', "\n")
-#txt.insert('end', "¥¹¥±¡¼¥ë¤È¥×¥í¥°¥ì¥¹¥Ð¡¼\n", tag_middle)
-txt.insert('end', "¥¹¥±¡¼¥ë¤È¥×¥í¥°¥ì¥¹¥Ð¡¼\n", tag_kanji_title)
+#txt.insert('end', "スケールã¨ãƒ—ログレスãƒãƒ¼\n", tag_middle)
+txt.insert('end', "スケールã¨ãƒ—ログレスãƒãƒ¼\n", tag_kanji_title)
txt.insert('end', " \n ", tag_demospace)
-txt.insert('end', "1. ¿âľ¥¹¥±¡¼¥ë\n", tag_demo.id, "demo-vscale")
+txt.insert('end', "1. 垂直スケール\n", tag_demo.id, "demo-vscale")
txt.insert('end', " \n ", tag_demospace)
-txt.insert('end', "2. ¿åÊ¿¥¹¥±¡¼¥ë\n", tag_demo.id, "demo-hscale")
+txt.insert('end', "2. 水平スケール\n", tag_demo.id, "demo-hscale")
txt.insert('end', " \n ", tag_demospace)
-txt.insert('end', "3. ¥×¥í¥°¥ì¥¹¥Ð¡¼ (Tile/Ttk³ÈÄ¥¤Ø¤ÎÂбþ¤¬É¬Í×)\n", tag_demo.id, "demo-ttkprogress")
+txt.insert('end', "3. プログレスãƒãƒ¼ (Tile/Ttkæ‹¡å¼µã¸ã®å¯¾å¿œãŒå¿…è¦)\n", tag_demo.id, "demo-ttkprogress")
txt.insert('end', " \n ", tag_demospace)
txt.insert('end', "\n")
-txt.insert('end', "¥Ú¥¤¥ó¥É¥¦¥£¥ó¥É¥¦¤È¥Î¡¼¥È¥Ö¥Ã¥¯\n", tag_kanji_title)
+txt.insert('end', "ペインドウィンドウã¨ãƒŽãƒ¼ãƒˆãƒ–ック\n", tag_kanji_title)
txt.insert('end', " \n ", tag_demospace)
-txt.insert('end', "1. ¿åÊ¿Êý¸þ (µ¡Ç½¤ËÂбþ¤·¤¿¥Ð¡¼¥¸¥ç¥ó¤ÎTk¤¬É¬Í×)\n",
+txt.insert('end', "1. æ°´å¹³æ–¹å‘ (機能ã«å¯¾å¿œã—ãŸãƒãƒ¼ã‚¸ãƒ§ãƒ³ã®TkãŒå¿…è¦)\n",
tag_demo.id, "demo-paned1")
txt.insert('end', " \n ", tag_demospace)
-txt.insert('end', "2. ¿âľÊý¸þ (µ¡Ç½¤ËÂбþ¤·¤¿¥Ð¡¼¥¸¥ç¥ó¤ÎTk¤¬É¬Í×)\n",
+txt.insert('end', "2. åž‚ç›´æ–¹å‘ (機能ã«å¯¾å¿œã—ãŸãƒãƒ¼ã‚¸ãƒ§ãƒ³ã®TkãŒå¿…è¦)\n",
tag_demo.id, "demo-paned2")
txt.insert('end', " \n ", tag_demospace)
-txt.insert('end', "3. ¥Æ¡¼¥Þ¤ËÂбþ¤·¤¿Ëä¤á¹þ¤ß¥Ú¥¤¥ó (Tile/Ttk³ÈÄ¥¤Ø¤ÎÂбþ¤¬É¬Í×)\n",
+txt.insert('end', "3. テーマã«å¯¾å¿œã—ãŸåŸ‹ã‚è¾¼ã¿ãƒšã‚¤ãƒ³ (Tile/Ttkæ‹¡å¼µã¸ã®å¯¾å¿œãŒå¿…è¦)\n",
tag_demo.id, "demo-ttkpane")
txt.insert('end', " \n ", tag_demospace)
-txt.insert('end', "4. ¥Î¡¼¥È¥Ö¥Ã¥¯¥¦¥£¥¸¥§¥Ã¥È (Tile/Ttk³ÈÄ¥¤Ø¤ÎÂбþ¤¬É¬Í×)\n",
+txt.insert('end', "4. ノートブックウィジェット (Tile/Ttkæ‹¡å¼µã¸ã®å¯¾å¿œãŒå¿…è¦)\n",
tag_demo.id, "demo-ttknote")
txt.insert('end', " \n ", tag_demospace)
txt.insert('end', "\n")
-#txt.insert('end', "¥á¥Ë¥å¡¼¤È¥Ä¡¼¥ë¥Ð¡¼\n", tag_middle)
-txt.insert('end', "¥á¥Ë¥å¡¼¤È¥Ä¡¼¥ë¥Ð¡¼\n", tag_kanji_title)
+#txt.insert('end', "メニューã¨ãƒ„ールãƒãƒ¼\n", tag_middle)
+txt.insert('end', "メニューã¨ãƒ„ールãƒãƒ¼\n", tag_kanji_title)
txt.insert('end', " \n ", tag_demospace)
-txt.insert('end', "1. ¥á¥Ë¥å¡¼¤È¥«¥¹¥±¡¼¥É¤ò´Þ¤ó¤À¥¦¥£¥ó¥É¥¦\n",
+txt.insert('end', "1. メニューã¨ã‚«ã‚¹ã‚±ãƒ¼ãƒ‰ã‚’å«ã‚“ã ã‚¦ã‚£ãƒ³ãƒ‰ã‚¦\n",
tag_demo, "demo-menu")
txt.insert('end', " \n ", tag_demospace)
-txt.insert('end', "2. ¥á¥Ë¥å¡¼¤È¥«¥¹¥±¡¼¥É¤ò´Þ¤ó¤À¥¦¥£¥ó¥É¥¦ (Tk8.x ÀìÍÑ)\n",
+txt.insert('end', "2. メニューã¨ã‚«ã‚¹ã‚±ãƒ¼ãƒ‰ã‚’å«ã‚“ã ã‚¦ã‚£ãƒ³ãƒ‰ã‚¦ (Tk8.x 専用)\n",
tag_demo, "demo-menu8x")
txt.insert('end', " \n ", tag_demospace)
-txt.insert('end', "3. ¡· (µ¡Ç½¤ËÂбþ¤·¤¿¥Ð¡¼¥¸¥ç¥ó¤ÎTk¤¬É¬Í×)\n",
+txt.insert('end', "3. 〃 (機能ã«å¯¾å¿œã—ãŸãƒãƒ¼ã‚¸ãƒ§ãƒ³ã®TkãŒå¿…è¦)\n",
tag_demo, "demo-menu84")
txt.insert('end', " \n ", tag_demospace)
-txt.insert('end', "4. ¥á¥Ë¥å¡¼¥Ü¥¿¥ó (Tk8.x ÀìÍÑ)\n",
+txt.insert('end', "4. メニューボタン (Tk8.x 専用)\n",
tag_demo, "demo-menubu")
txt.insert('end', " \n ", tag_demospace)
-txt.insert('end', "5. ¥Æ¡¼¥Þ¤ËÂбþ¤·¤¿¥á¥Ë¥å¡¼¥Ü¥¿¥ó (Tile/Ttk³ÈÄ¥¤Ø¤ÎÂбþ¤¬É¬Í×)\n",
+txt.insert('end', "5. テーマã«å¯¾å¿œã—ãŸãƒ¡ãƒ‹ãƒ¥ãƒ¼ãƒœã‚¿ãƒ³ (Tile/Ttkæ‹¡å¼µã¸ã®å¯¾å¿œãŒå¿…è¦)\n",
tag_demo.id, "demo-ttkmenu")
txt.insert('end', " \n ", tag_demospace)
-txt.insert('end', "6. ¥Æ¡¼¥Þ¤ËÂбþ¤·¤¿¥Ä¡¼¥ë¥Ð¡¼ (Tile/Ttk³ÈÄ¥¤Ø¤ÎÂбþ¤¬É¬Í×)\n",
+txt.insert('end', "6. テーマã«å¯¾å¿œã—ãŸãƒ„ールãƒãƒ¼ (Tile/Ttkæ‹¡å¼µã¸ã®å¯¾å¿œãŒå¿…è¦)\n",
tag_demo.id, "demo-toolbar")
txt.insert('end', " \n ", tag_demospace)
txt.insert('end', "\n")
-#txt.insert('end', "¥À¥¤¥¢¥í¥°¥¦¥£¥ó¥É¥¦\n", tag_middle)
-txt.insert('end', "¥À¥¤¥¢¥í¥°¥¦¥£¥ó¥É¥¦\n", tag_kanji_title)
+#txt.insert('end', "ダイアログウィンドウ\n", tag_middle)
+txt.insert('end', "ダイアログウィンドウ\n", tag_kanji_title)
txt.insert('end', " \n ", tag_demospace)
-txt.insert('end', "1. ¥á¥Ã¥»¡¼¥¸¥Ü¥Ã¥¯¥¹\n", tag_demo, "demo-msgbox")
+txt.insert('end', "1. メッセージボックス\n", tag_demo, "demo-msgbox")
txt.insert('end', " \n ", tag_demospace)
-txt.insert('end', "2. ¾ÜºÙ¥Æ¥­¥¹¥ÈÉÕ¤­¤Î¥á¥Ã¥»¡¼¥¸¥Ü¥Ã¥¯¥¹ (µ¡Ç½¤ËÂбþ¤·¤¿¥Ð¡¼¥¸¥ç¥ó¤ÎTk¤¬É¬Í×)\n", tag_demo, "demo-msgbox2")
+txt.insert('end', "2. 詳細テキスト付ãã®ãƒ¡ãƒƒã‚»ãƒ¼ã‚¸ãƒœãƒƒã‚¯ã‚¹ (機能ã«å¯¾å¿œã—ãŸãƒãƒ¼ã‚¸ãƒ§ãƒ³ã®TkãŒå¿…è¦)\n", tag_demo, "demo-msgbox2")
txt.insert('end', " \n ", tag_demospace)
-txt.insert('end', "3. ¥Õ¥¡¥¤¥ëÁªÂò¥À¥¤¥¢¥í¥°\n", tag_demo, "demo-filebox")
+txt.insert('end', "3. ãƒ•ã‚¡ã‚¤ãƒ«é¸æŠžãƒ€ã‚¤ã‚¢ãƒ­ã‚°\n", tag_demo, "demo-filebox")
txt.insert('end', " \n ", tag_demospace)
-txt.insert('end', "4. ¿§ÁªÂò¥À¥¤¥¢¥í¥°\n", tag_demo, "demo-clrpick")
+txt.insert('end', "4. è‰²é¸æŠžãƒ€ã‚¤ã‚¢ãƒ­ã‚°\n", tag_demo, "demo-clrpick")
txt.insert('end', " \n ", tag_demospace)
txt.insert('end', "\n")
-#txt.insert('end', "¥¢¥Ë¥á¡¼¥·¥ç¥ó\n", tag_middle)
-txt.insert('end', "¥¢¥Ë¥á¡¼¥·¥ç¥ó\n", tag_kanji_title)
+#txt.insert('end', "アニメーション\n", tag_middle)
+txt.insert('end', "アニメーション\n", tag_kanji_title)
txt.insert('end', " \n ", tag_demospace)
-txt.insert('end', "1. ¥¢¥Ë¥á¡¼¥·¥ç¥ó¥é¥Ù¥ë (µ¡Ç½¤ËÂбþ¤·¤¿¥Ð¡¼¥¸¥ç¥ó¤ÎTk¤¬É¬Í×)\n", tag_demo, "demo-anilabel")
+txt.insert('end', "1. アニメーションラベル (機能ã«å¯¾å¿œã—ãŸãƒãƒ¼ã‚¸ãƒ§ãƒ³ã®TkãŒå¿…è¦)\n", tag_demo, "demo-anilabel")
txt.insert('end', " \n ", tag_demospace)
-txt.insert('end', "2. ÇÈ·Á¤Î¥¢¥Ë¥á¡¼¥·¥ç¥ó (µ¡Ç½¤ËÂбþ¤·¤¿¥Ð¡¼¥¸¥ç¥ó¤ÎTk¤¬É¬Í×)\n", tag_demo, "demo-aniwave")
+txt.insert('end', "2. 波形ã®ã‚¢ãƒ‹ãƒ¡ãƒ¼ã‚·ãƒ§ãƒ³ (機能ã«å¯¾å¿œã—ãŸãƒãƒ¼ã‚¸ãƒ§ãƒ³ã®TkãŒå¿…è¦)\n", tag_demo, "demo-aniwave")
txt.insert('end', " \n ", tag_demospace)
-txt.insert('end', "3. ¿¶¤ê»Ò¤Î¥·¥ß¥å¥ì¡¼¥·¥ç¥ó (µ¡Ç½¤ËÂбþ¤·¤¿¥Ð¡¼¥¸¥ç¥ó¤ÎTk¤¬É¬Í×)\n", tag_demo, "demo-pendulum")
+txt.insert('end', "3. 振りå­ã®ã‚·ãƒŸãƒ¥ãƒ¬ãƒ¼ã‚·ãƒ§ãƒ³ (機能ã«å¯¾å¿œã—ãŸãƒãƒ¼ã‚¸ãƒ§ãƒ³ã®TkãŒå¿…è¦)\n", tag_demo, "demo-pendulum")
txt.insert('end', " \n ", tag_demospace)
-txt.insert('end', "4. A celebration of Rube Goldberg (µ¡Ç½¤ËÂбþ¤·¤¿¥Ð¡¼¥¸¥ç¥ó¤ÎTk¤¬É¬Í×)\n", tag_demo, "demo-goldberg")
+txt.insert('end', "4. A celebration of Rube Goldberg (機能ã«å¯¾å¿œã—ãŸãƒãƒ¼ã‚¸ãƒ§ãƒ³ã®TkãŒå¿…è¦)\n", tag_demo, "demo-goldberg")
txt.insert('end', "\n")
-#txt.insert('end', "¤½¤Î¾\n", tag_middle)
-txt.insert('end', "¤½¤Î¾\n", tag_kanji_title)
+#txt.insert('end', "ãã®ä»–\n", tag_middle)
+txt.insert('end', "ãã®ä»–\n", tag_kanji_title)
txt.insert('end', " \n ", tag_demospace)
-txt.insert('end', "1. ÁȤ߹þ¤ß¤Î¥Ó¥Ã¥È¥Þ¥Ã¥×\n", tag_demo, "demo-bitmap")
+txt.insert('end', "1. 組ã¿è¾¼ã¿ã®ãƒ“ットマップ\n", tag_demo, "demo-bitmap")
txt.insert('end', " \n ", tag_demospace)
-txt.insert('end', "2. ¥â¡¼¥À¥ë¥À¥¤¥¢¥í¥°(¥í¡¼¥«¥ë¥°¥é¥Ö)\n",
+txt.insert('end', "2. モーダルダイアログ(ローカルグラブ)\n",
tag_demo, "demo-dialog1")
txt.insert('end', " \n ", tag_demospace)
-txt.insert('end', "3. ¥â¡¼¥À¥ë¥À¥¤¥¢¥í¥°(¥°¥í¡¼¥Ð¥ë¥°¥é¥Ö)\n",
+txt.insert('end', "3. モーダルダイアログ(グローãƒãƒ«ã‚°ãƒ©ãƒ–)\n",
tag_demo, "demo-dialog2")
txt.insert('end', " \n ", tag_demospace)
@@ -545,13 +545,13 @@ txt.state('disabled')
scr.focus
################################
-# method ÄêµÁ
+# method 定義
################################
def positionWindow(w)
w.geometry('+300+300')
end
-# ¿Æ¥¦¥£¥¸¥§¥Ã¥È¤È¡¤ÊÑ¿ô̾¤È TkVariable ¤È¤ÎÁÈ(ÇÛÎó)¤ÎʤӤòÅϤ¹
+# 親ウィジェットã¨ï¼Œå¤‰æ•°å㨠TkVariable ã¨ã®çµ„(é…列)ã®ä¸¦ã³ã‚’渡ã™
$showVarsWin = {}
def showVars1(parent, *args)
if $showVarsWin[parent.path]
@@ -564,7 +564,7 @@ def showVars1(parent, *args)
title "Variable values"
base = TkFrame.new(w).pack(:fill=>:both, :expand=>true)
TkLabel.new(base) {
- text "ÊÑ¿ôÃÍ:"
+ text "変数値:"
width 20
anchor 'center'
if $tk_version =~ /^4.*/
@@ -586,7 +586,7 @@ def showVars1(parent, *args)
}.pack('side'=>'top', 'anchor'=>'w', 'fill'=>'x')
}
TkButton.new(base) {
- text "λ²ò"
+ text "了解"
command proc{w.destroy}
}.pack('side'=>'bottom', 'pady'=>2)
}
@@ -605,7 +605,7 @@ def showVars2(parent, *args)
base = TkFrame.new(top).pack(:fill=>:both, :expand=>true)
- TkLabelFrame.new(base, :text=>"ÊÑ¿ôÃÍ:",
+ TkLabelFrame.new(base, :text=>"変数値:",
:font=>{:family=>'Helvetica', :size=>14}){|f|
args.each{|vnam,vbody|
TkGrid(TkLabel.new(f, :text=>"#{vnam}: ", :anchor=>'w'),
@@ -617,7 +617,7 @@ def showVars2(parent, *args)
f.grid_columnconfig(1, :weight=>1)
f.grid_rowconfig(100, :weight=>1)
}
- TkButton.new(base, :text=>"λ²ò", :width=>8, :default=>:active,
+ TkButton.new(base, :text=>"了解", :width=>8, :default=>:active,
:command=>proc{top.destroy}){|b|
top.bind('Return', proc{b.invoke})
top.bind('Escape', proc{b.invoke})
@@ -637,7 +637,7 @@ else # ver >= 8.4
alias showVars showVars2
end
-# µ¿»÷¥È¥Ã¥×¥ì¥Ù¥ë¥µ¥Ý¡¼¥È
+# 疑似トップレベルサãƒãƒ¼ãƒˆ
module PseudoToplevel_Evaluable
def pseudo_toplevel_eval(body = Proc.new)
Thread.current[:TOPLEVEL] = self
@@ -743,7 +743,7 @@ def eval_samplecode(code, file=nil)
Tk.update rescue nil
end
-# ¥Æ¥­¥¹¥È¾å¤Ç¤Î click ¤ËÂФ¹¤ëưºî
+# テキスト上ã§ã® click ã«å¯¾ã™ã‚‹å‹•作
def invoke(txt, idx)
tag = txt.tag_names(idx).find{|t| t.kind_of?(String) && t =~ /^demo-/}
return unless tag
@@ -776,7 +776,7 @@ def invoke (txt, idx)
end
=end
-# ¾õÂÖɽ¼¨
+# 状態表示
def showStatus (txt, index)
tag = txt.tag_names(index).find{|t| t.kind_of?(String) && t =~ /^demo-/}
cursor = txt.cget('cursor')
@@ -786,13 +786,13 @@ def showStatus (txt, index)
else
demoname = tag[5..-1]
$statusBarLabel.configure('text',
- "¥µ¥ó¥×¥ë¥×¥í¥°¥é¥à \"#{demoname}\" ¤Î¼Â¹Ô ")
+ "サンプルプログラム \"#{demoname}\" ã®å®Ÿè¡Œ ")
newcursor = 'hand2'
end
txt.configure('cursor'=>newcursor) if cursor != newcursor
end
-# ¥½¡¼¥¹¥³¡¼¥É¤Îɽ¼¨
+# ソースコードã®è¡¨ç¤º
def showCode1(demo)
file = "#{demo}.rb"
$code_window = nil unless defined? $code_window
@@ -801,15 +801,15 @@ def showCode1(demo)
f = TkFrame.new($code_window)
TkButton.new(f) {
- #text "λ²ò"
- text "ÊĤ¸¤ë"
+ #text "了解"
+ text "é–‰ã˜ã‚‹"
command proc{
$code_window.destroy
$code_window = nil
}
}.pack('side'=>'right', 'expand'=>'false', 'pady'=>2)
TkButton.new(f) {
- text "ºÆ¼Â¹Ô"
+ text "å†å®Ÿè¡Œ"
# command proc{eval($code_text.get('1.0','end'), _null_binding)}
command proc{eval_samplecode($code_text.get('1.0','end'), '<viewer>')}
}.pack('side'=>'right', 'expand'=>'false', 'pady'=>2)
@@ -924,17 +924,17 @@ def showCode2(demo)
posnum.text = pos
}
- #b_dis = TkButton.new(bf, :text=>'λ²ò', :default=>:active,
- b_dis = TkButton.new(bf, :text=>'ÊĤ¸¤ë', :default=>:active,
+ #b_dis = TkButton.new(bf, :text=>'了解', :default=>:active,
+ b_dis = TkButton.new(bf, :text=>'é–‰ã˜ã‚‹', :default=>:active,
:command=>proc{
$code_window.destroy
$code_window = nil
},
:image=>$image['delete'], :compound=>:left)
- b_prn = TkButton.new(bf, :text=>'°õºþ',
+ b_prn = TkButton.new(bf, :text=>'å°åˆ·',
:command=>proc{printCode($code_text, file)},
:image=>$image['print'], :compound=>:left)
- b_run = TkButton.new(bf, :text=>'ºÆ¼Â¹Ô',
+ b_run = TkButton.new(bf, :text=>'å†å®Ÿè¡Œ',
:command=>proc{
# eval($code_text.get('1.0','end'), _null_binding)
eval_samplecode($code_text.get('1.0','end'), '<viewer>')
@@ -1012,27 +1012,27 @@ def printCode(txt, file)
msg = `lp -c #{fname}`
unless $?.exitstatus == 0
Tk.messageBox(:title=>'Print spooling failure',
- :message=>'¥¨¥é¡¼¤¬È¯À¸¤·¤Þ¤·¤¿¡¥' +
- '°õºþ¤Ë¼ºÇÔ¤·¤¿¤â¤Î¤È»×¤ï¤ì¤Þ¤¹ : ' + msg)
+ :message=>'エラーãŒç™ºç”Ÿã—ã¾ã—ãŸï¼Ž' +
+ 'å°åˆ·ã«å¤±æ•—ã—ãŸã‚‚ã®ã¨æ€ã‚れã¾ã™ : ' + msg)
end
when 'windows'
begin
printTextWin32(fname)
rescue => e
Tk.messageBox(:title=>'Print spooling failure',
- :message=>'¥¨¥é¡¼¤¬È¯À¸¤·¤Þ¤·¤¿¡¥' +
- '°õºþ¤Ë¼ºÇÔ¤·¤¿¤â¤Î¤È»×¤ï¤ì¤Þ¤¹ : ' +
+ :message=>'エラーãŒç™ºç”Ÿã—ã¾ã—ãŸï¼Ž' +
+ 'å°åˆ·ã«å¤±æ•—ã—ãŸã‚‚ã®ã¨æ€ã‚れã¾ã™ : ' +
e.message)
end
when 'macintosh'
Tk.messageBox(:title=>'Operation not Implemented',
- :message=>'°õºþµ¡Ç½¤Ï¤Þ¤À¼ÂÁõ¤µ¤ì¤Æ¤¤¤Þ¤»¤ó')
+ :message=>'å°åˆ·æ©Ÿèƒ½ã¯ã¾ã å®Ÿè£…ã•れã¦ã„ã¾ã›ã‚“')
else
Tk.messageBox(:title=>'Operation not Implemented',
- :message=>'¸¡½Ð¤µ¤ì¤¿´Ä¶­ ' +
+ :message=>'検出ã•れãŸç’°å¢ƒ ' +
Tk::TCL_PLATFORM('platform') +
- ' ¤Ï̤ÃΤδĶ­¤Ç¤¢¤ë¤¿¤á¡¤' +
- '°õºþµ¡Ç½¤Ï¼ÂÁõ¤µ¤ì¤Æ¤¤¤Þ¤»¤ó: ')
+ ' ã¯æœªçŸ¥ã®ç’°å¢ƒã§ã‚ã‚‹ãŸã‚,' +
+ 'å°åˆ·æ©Ÿèƒ½ã¯å®Ÿè£…ã•れã¦ã„ã¾ã›ã‚“: ')
end
ensure
File.delete(fname)
@@ -1074,7 +1074,7 @@ end
#
def aboutBox
Tk.messageBox('icon'=>'info', 'type'=>'ok', 'title'=>'About Widget Demo',
- 'message'=>"Ruby/Tk ¥¦¥£¥¸¥§¥Ã¥È¥Ç¥â Ver.1.7.1-jp\n\n" +
+ 'message'=>"Ruby/Tk ウィジェットデモ Ver.1.7.1-jp\n\n" +
"based on demos of Tk8.1 -- 8.5 " +
"( Copyright of Tcl/Tk demos:: " +
"(c) 1996-1997 Sun Microsystems, Inc. / " +
@@ -1087,7 +1087,7 @@ def aboutBox
end
####################################
-# °ú¿ô¤Ç»ØÄꤵ¤ì¤¿¥Ç¥â¤òµ¯Æ°¤¹¤ë
+# å¼•æ•°ã§æŒ‡å®šã•れãŸãƒ‡ãƒ¢ã‚’èµ·å‹•ã™ã‚‹
no_launcher = false
if ARGV[0] == '-n'
ARGV.shift
@@ -1118,5 +1118,5 @@ if no_launcher
end
################################
-# ¥¤¥Ù¥ó¥ÈÂÔ¤Á¤ËÆþ¤ë
+# イベント待ã¡ã«å…¥ã‚‹
Tk.mainloop
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_rb2/ja.msg b/ext/tk/sample/msgs_rb2/ja.msg
index 84e89aa6ef..54a105b61f 100644
--- a/ext/tk/sample/msgs_rb2/ja.msg
+++ b/ext/tk/sample/msgs_rb2/ja.msg
@@ -1,85 +1,85 @@
TkMsgCatalog.new('::tkmsgcat_demo') {
- ja 'Application Error', '¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¥¨¥é¡¼', 'euc-jp'
- ja 'Blue', 'ÀÄ', 'euc-jp'
- ja 'Color', '¿§ÁªÂò', 'euc-jp'
- ja 'Delete', '¾Ãµî', 'euc-jp'
- ja 'Error', '¥¨¥é¡¼', 'euc-jp'
- ja 'Exit', '½ªÎ»', 'euc-jp'
- ja 'Green', 'ÎÐ', 'euc-jp'
- ja 'Red', 'ÀÖ', 'euc-jp'
- ja 'blue', 'ÀÄ', 'euc-jp'
- ja 'green', 'ÎÐ', 'euc-jp'
- ja 'red', 'ÀÖ', 'euc-jp'
+ ja 'Application Error', 'アプリケーションエラー', 'utf-8'
+ ja 'Blue', 'é’', 'utf-8'
+ ja 'Color', 'è‰²é¸æŠž', 'utf-8'
+ ja 'Delete', '消去', 'utf-8'
+ ja 'Error', 'エラー', 'utf-8'
+ ja 'Exit', '終了', 'utf-8'
+ ja 'Green', 'ç·‘', 'utf-8'
+ ja 'Red', '赤', 'utf-8'
+ ja 'blue', 'é’', 'utf-8'
+ ja 'green', 'ç·‘', 'utf-8'
+ ja 'red', '赤', 'utf-8'
}
TkMsgCatalog.new('::tk') {
- ja "&Abort", '̾ȧ', 'euc-jp'
+ ja "&Abort", '中止', 'utf-8'
ja "About..."
- ja "All Files", '¤¹¤Ù¤Æ¤Î¥Õ¥¡¥¤¥ë', 'euc-jp'
- ja "Application Error", '¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¥¨¥é¡¼', 'euc-jp'
- ja "&Blue", 'ÀÄ', 'euc-jp'
- ja "&Cancel", '¼è¤ê¾Ã¤·', 'euc-jp'
- ja "Cannot change to the directory \"%1\$s\".\nPermission denied.", "¥Ç¥£¥ì¥¯¥È¥ê \"%1\$s\" ¤ËÊѹ¹¤Ç¤­¤Þ¤»¤ó¡¥\nµö²Ä¤¬¤¢¤ê¤Þ¤»¤ó¡¥", 'euc-jp'
- ja "Choose Directory", '¥Ç¥£¥ì¥¯¥È¥ê¤òÁªÂò', 'euc-jp'
- ja "Clear", '¾Ãµî', 'euc-jp'
- ja "Color", '¿§', 'euc-jp'
- ja "Console", '¥³¥ó¥½¡¼¥ë', 'euc-jp'
- ja "Copy", '¥³¥Ô¡¼', 'euc-jp'
- ja "Cut", 'ÀÚ¤ê¼è¤ê', 'euc-jp'
- ja "Delete", '¾Ãµî', 'euc-jp'
- ja "Details >>", '¾ÜºÙ >>', 'euc-jp'
- ja "Directory \"%1\$s\" does not exist.", '"%1$s" ¤È¤¤¤¦¥Ç¥£¥ì¥¯¥È¥ê¤Ï¸ºß¤·¤Þ¤»¤ó¡¥', 'euc-jp'
- ja "&Directory:", '¥Ç¥£¥ì¥¯¥È¥ê', 'euc-jp'
+ ja "All Files", 'ã™ã¹ã¦ã®ãƒ•ァイル', 'utf-8'
+ ja "Application Error", 'アプリケーションエラー', 'utf-8'
+ ja "&Blue", 'é’', 'utf-8'
+ ja "&Cancel", 'å–り消ã—', 'utf-8'
+ ja "Cannot change to the directory \"%1\$s\".\nPermission denied.", "ディレクトリ \"%1\$s\" ã«å¤‰æ›´ã§ãã¾ã›ã‚“.\n許å¯ãŒã‚りã¾ã›ã‚“.", 'utf-8'
+ ja "Choose Directory", 'ãƒ‡ã‚£ãƒ¬ã‚¯ãƒˆãƒªã‚’é¸æŠž', 'utf-8'
+ ja "Clear", '消去', 'utf-8'
+ ja "Color", '色', 'utf-8'
+ ja "Console", 'コンソール', 'utf-8'
+ ja "Copy", 'コピー', 'utf-8'
+ ja "Cut", '切りå–り', 'utf-8'
+ ja "Delete", '消去', 'utf-8'
+ ja "Details >>", '詳細 >>', 'utf-8'
+ ja "Directory \"%1\$s\" does not exist.", '"%1$s" ã¨ã„ã†ãƒ‡ã‚£ãƒ¬ã‚¯ãƒˆãƒªã¯å­˜åœ¨ã—ã¾ã›ã‚“.', 'utf-8'
+ ja "&Directory:", 'ディレクトリ', 'utf-8'
ja "Error: %1\$s"
- ja "Exit", '½ªÎ»', 'euc-jp'
- ja "File \"%1\$s\" already exists.\nDo you want to overwrite it?", "\"%1\$s\" ¤È¤¤¤¦¥Õ¥¡¥¤¥ë¤Ï´û¤Ë¸ºß¤·¤Æ¤¤¤Þ¤¹¡¥\n½ñ¤­´¹¤¨¤Þ¤¹¤«¡©", 'euc-jp'
- ja "File \"%1\$s\" already exists.\n\n", "\"%1\$s\" ¤È¤¤¤¦¥Õ¥¡¥¤¥ë¤Ï´û¤Ë¸ºß¤·¤Æ¤¤¤Þ¤¹¡¥\n\n", 'euc-jp'
- ja "File \"%1\$s\" does not exist.", '"%1$s" ¤È¤¤¤¦¥Õ¥¡¥¤¥ë¤Ï¸ºß¤·¤Þ¤»¤ó¡¥', 'euc-jp'
- ja "File &name:", '¥Õ¥¡¥¤¥ë̾', 'euc-jp'
- ja "File &names:", '¥Õ¥¡¥¤¥ë̾', 'euc-jp'
- ja "Files of &type:", '¥Õ¥¡¥¤¥ë·Á¼°', 'euc-jp'
- ja "Fi&les:", '¥Õ¥¡¥¤¥ë', 'euc-jp'
- ja "&Filter", '¥Õ¥£¥ë¥¿¡¼', 'euc-jp'
- ja "Fil&ter:", '¥Õ¥£¥ë¥¿¡¼', 'euc-jp'
- ja "&Green", 'ÎÐ', 'euc-jp'
- ja "Hi", '¤³¤ó¤Ë¤Á¤Ï', 'euc-jp'
- ja "Hide Console", '¥³¥ó¥½¡¼¥ë¤ò±£¤¹', 'euc-jp'
- ja "&Ignore", '̵»ë', 'euc-jp'
- ja "Invalid file name \"%1\$s\".", '"%1$s" ¤ÏÉÔÀµ¤Ê¥Õ¥¡¥¤¥ë̾¤Ç¤¹¡¥', 'euc-jp'
- ja "Log Files", '¥í¥°¥Õ¥¡¥¤¥ë', 'euc-jp'
- ja "&No", '¤¤¤¤¤¨', 'euc-jp'
- ja "&OK", 'λ²ò', 'euc-jp'
- ja "OK", 'λ²ò', 'euc-jp'
- ja "Ok", 'λ²ò', 'euc-jp'
- ja "Open", '³«¤¯', 'euc-jp'
- ja "&Open", '³«¤¯', 'euc-jp'
- ja "Open Multiple Files", 'Ê£¿ô¤Î¥Õ¥¡¥¤¥ë¤ò³«¤¯', 'euc-jp'
- ja "Paste", 'ޤêÉÕ¤±', 'euc-jp'
- ja "Quit", '½ªÎ»', 'euc-jp'
- ja "&Red", 'ÀÖ', 'euc-jp'
- ja "Replace existing file?", '´û¸¤Î¥Õ¥¡¥¤¥ë¤òÃÖ¤­´¹¤¨¤Þ¤¹¤«¡©', 'euc-jp'
- ja "&Retry", 'ºÆ¼Â¹Ô', 'euc-jp'
- ja "&Save", 'Êݸ', 'euc-jp'
- ja "Save As", '̾Á°¤òÉÕ¤±¤ÆÊݸ', 'euc-jp'
- ja "Save To Log", '¥í¥°¤òÊݸ', 'euc-jp'
- ja "Select Log File", '¥í¥°¥Õ¥¡¥¤¥ë¤òÁªÂò', 'euc-jp'
- ja "Select a file to source", '¥½¡¼¥¹¥Õ¥¡¥¤¥ë¤òÁªÂò', 'euc-jp'
- ja "&Selection:", 'ÁªÂò', 'euc-jp'
- ja "Skip Messages", '¥á¥Ã¥»¡¼¥¸¤ò¤È¤Ð¤¹', 'euc-jp'
- ja "Source...", '¥½¡¼¥¹...', 'euc-jp'
- ja "Tcl Scripts", 'Tcl ¥¹¥¯¥ê¥×¥È', 'euc-jp'
+ ja "Exit", '終了', 'utf-8'
+ ja "File \"%1\$s\" already exists.\nDo you want to overwrite it?", "\"%1\$s\" ã¨ã„ã†ãƒ•ã‚¡ã‚¤ãƒ«ã¯æ—¢ã«å­˜åœ¨ã—ã¦ã„ã¾ã™ï¼Ž\næ›¸ãæ›ãˆã¾ã™ã‹ï¼Ÿ", 'utf-8'
+ ja "File \"%1\$s\" already exists.\n\n", "\"%1\$s\" ã¨ã„ã†ãƒ•ã‚¡ã‚¤ãƒ«ã¯æ—¢ã«å­˜åœ¨ã—ã¦ã„ã¾ã™ï¼Ž\n\n", 'utf-8'
+ ja "File \"%1\$s\" does not exist.", '"%1$s" ã¨ã„ã†ãƒ•ァイルã¯å­˜åœ¨ã—ã¾ã›ã‚“.', 'utf-8'
+ ja "File &name:", 'ファイルå', 'utf-8'
+ ja "File &names:", 'ファイルå', 'utf-8'
+ ja "Files of &type:", 'ファイル形å¼', 'utf-8'
+ ja "Fi&les:", 'ファイル', 'utf-8'
+ ja "&Filter", 'フィルター', 'utf-8'
+ ja "Fil&ter:", 'フィルター', 'utf-8'
+ ja "&Green", 'ç·‘', 'utf-8'
+ ja "Hi", 'ã“ã‚“ã«ã¡ã¯', 'utf-8'
+ ja "Hide Console", 'コンソールを隠ã™', 'utf-8'
+ ja "&Ignore", '無視', 'utf-8'
+ ja "Invalid file name \"%1\$s\".", '"%1$s" ã¯ä¸æ­£ãªãƒ•ァイルåã§ã™ï¼Ž', 'utf-8'
+ ja "Log Files", 'ログファイル', 'utf-8'
+ ja "&No", 'ã„ã„ãˆ', 'utf-8'
+ ja "&OK", '了解', 'utf-8'
+ ja "OK", '了解', 'utf-8'
+ ja "Ok", '了解', 'utf-8'
+ ja "Open", 'é–‹ã', 'utf-8'
+ ja "&Open", 'é–‹ã', 'utf-8'
+ ja "Open Multiple Files", '複数ã®ãƒ•ァイルを開ã', 'utf-8'
+ ja "Paste", '貼り付ã‘', 'utf-8'
+ ja "Quit", '終了', 'utf-8'
+ ja "&Red", '赤', 'utf-8'
+ ja "Replace existing file?", '既存ã®ãƒ•ã‚¡ã‚¤ãƒ«ã‚’ç½®ãæ›ãˆã¾ã™ã‹ï¼Ÿ', 'utf-8'
+ ja "&Retry", 'å†å®Ÿè¡Œ', 'utf-8'
+ ja "&Save", 'ä¿å­˜', 'utf-8'
+ ja "Save As", 'åå‰ã‚’付ã‘ã¦ä¿å­˜', 'utf-8'
+ ja "Save To Log", 'ログをä¿å­˜', 'utf-8'
+ ja "Select Log File", 'ãƒ­ã‚°ãƒ•ã‚¡ã‚¤ãƒ«ã‚’é¸æŠž', 'utf-8'
+ ja "Select a file to source", 'ã‚½ãƒ¼ã‚¹ãƒ•ã‚¡ã‚¤ãƒ«ã‚’é¸æŠž', 'utf-8'
+ ja "&Selection:", 'é¸æŠž', 'utf-8'
+ ja "Skip Messages", 'メッセージをã¨ã°ã™', 'utf-8'
+ ja "Source...", 'ソース...', 'utf-8'
+ ja "Tcl Scripts", 'Tcl スクリプト', 'utf-8'
ja "Tcl for Windows"
- ja "Text Files", '¥Æ¥­¥¹¥È¥Õ¥¡¥¤¥ë', 'euc-jp'
- ja "&Yes", '¤Ï¤¤', 'euc-jp'
- ja "abort", '̾ȧ', 'euc-jp'
- ja "blue", 'ÀÄ', 'euc-jp'
- ja "cancel", '¼è¤ê¾Ã¤·', 'euc-jp'
- ja "extension", '³ÈÄ¥»Ò', 'euc-jp'
- ja "extensions", '³ÈÄ¥»Ò', 'euc-jp'
- ja "green", 'ÎÐ', 'euc-jp'
- ja "ignore", '̵»ë', 'euc-jp'
- ja "ok", 'λ²ò', 'euc-jp'
- ja "red", 'ÀÖ', 'euc-jp'
- ja "retry", 'ºÆ¼Â¹Ô', 'euc-jp'
- ja "yes", '¤Ï¤¤', 'euc-jp'
+ ja "Text Files", 'テキストファイル', 'utf-8'
+ ja "&Yes", 'ã¯ã„', 'utf-8'
+ ja "abort", '中止', 'utf-8'
+ ja "blue", 'é’', 'utf-8'
+ ja "cancel", 'å–り消ã—', 'utf-8'
+ ja "extension", 'æ‹¡å¼µå­', 'utf-8'
+ ja "extensions", 'æ‹¡å¼µå­', 'utf-8'
+ ja "green", 'ç·‘', 'utf-8'
+ ja "ignore", '無視', 'utf-8'
+ ja "ok", '了解', 'utf-8'
+ ja "red", '赤', 'utf-8'
+ ja "retry", 'å†å®Ÿè¡Œ', 'utf-8'
+ ja "yes", 'ã¯ã„', 'utf-8'
}
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/tcltklib/sample0.rb b/ext/tk/sample/tcltklib/sample0.rb
index cd4c8069b4..0ac303ae9e 100644
--- a/ext/tk/sample/tcltklib/sample0.rb
+++ b/ext/tk/sample/tcltklib/sample0.rb
@@ -1,18 +1,18 @@
#! /usr/local/bin/ruby -vd
-# tcltklib ¥é¥¤¥Ö¥é¥ê¤Î¥Æ¥¹¥È
+# tcltklib ライブラリã®ãƒ†ã‚¹ãƒˆ
require "tcltklib"
def test
- # ¥¤¥ó¥¿¥×¥ê¥¿¤òÀ¸À®¤¹¤ë
+ # インタプリタを生æˆã™ã‚‹
ip1 = TclTkIp.new()
- # ɾ²Á¤·¤Æ¤ß¤ë
+ # 評価ã—ã¦ã¿ã‚‹
print ip1._return_value().inspect, "\n"
print ip1._eval("puts {abc}").inspect, "\n"
- # ¥Ü¥¿¥ó¤òºî¤Ã¤Æ¤ß¤ë
+ # ボタンを作ã£ã¦ã¿ã‚‹
print ip1._return_value().inspect, "\n"
print ip1._eval("button .lab -text exit -command \"destroy .\"").inspect,
"\n"
@@ -20,12 +20,12 @@ def test
print ip1._eval("pack .lab").inspect, "\n"
print ip1._return_value().inspect, "\n"
- # ¥¤¥ó¥¿¥×¥ê¥¿¤«¤é ruby ¥³¥Þ¥ó¥É¤òɾ²Á¤·¤Æ¤ß¤ë
+ # インタプリタã‹ã‚‰ ruby コマンドを評価ã—ã¦ã¿ã‚‹
# print ip1._eval(%q/ruby {print "print by ruby\n"}/).inspect, "\n"
print ip1._eval(%q+puts [ruby {print "print by ruby\n"; "puts by tcl/tk"}]+).inspect, "\n"
print ip1._return_value().inspect, "\n"
- # ¤â¤¦°ì¤Ä¥¤¥ó¥¿¥×¥ê¥¿¤òÀ¸À®¤·¤Æ¤ß¤ë
+ # ã‚‚ã†ä¸€ã¤ã‚¤ãƒ³ã‚¿ãƒ—リタを生æˆã—ã¦ã¿ã‚‹
ip2 = TclTkIp.new()
ip2._eval("button .lab -text test -command \"puts test ; destroy .\"")
ip2._eval("pack .lab")
diff --git a/ext/tk/sample/tcltklib/sample1.rb b/ext/tk/sample/tcltklib/sample1.rb
index 1965781533..3235edfe0d 100644
--- a/ext/tk/sample/tcltklib/sample1.rb
+++ b/ext/tk/sample/tcltklib/sample1.rb
@@ -1,131 +1,131 @@
#! /usr/local/bin/ruby -d
-# -*- encoding: euc-jp -*-
-# -d ¥ª¥×¥·¥ç¥ó¤òÉÕ¤±¤ë¤È, ¥Ç¥Ð¥Ã¥°¾ðÊó¤òɽ¼¨¤¹¤ë.
+# -*- encoding: utf-8 -*-
+# -d オプションを付ã‘ã‚‹ã¨, デãƒãƒƒã‚°æƒ…報を表示ã™ã‚‹.
-# tcltk ¥é¥¤¥Ö¥é¥ê¤Î¥µ¥ó¥×¥ë
+# tcltk ライブラリã®ã‚µãƒ³ãƒ—ル
-# ¤Þ¤º, ¥é¥¤¥Ö¥é¥ê¤ò require ¤¹¤ë.
+# ã¾ãš, ライブラリを require ã™ã‚‹.
require "tcltk"
-# °Ê²¼¤Ï, Test1 ¤Î¥¤¥ó¥¹¥¿¥ó¥¹¤Î initialize() ¤Ç,
-# tcl/tk ¤Ë´Ø¤¹¤ë½èÍý¤ò¹Ô¤¦Îã¤Ç¤¢¤ë.
-# ɬ¤º¤·¤â¤½¤Î¤è¤¦¤Ë¤¹¤ëɬÍפÏ̵¤¯,
-# (¤â¤·, ¤½¤¦¤·¤¿¤±¤ì¤Ð) class ¤Î³°¤Ç tcl/tk ¤Ë´Ø¤¹¤ë½èÍý¤ò¹Ô¤Ã¤Æ¤âÎɤ¤.
+# 以下ã¯, Test1 ã®ã‚¤ãƒ³ã‚¹ã‚¿ãƒ³ã‚¹ã® initialize() ã§,
+# tcl/tk ã«é–¢ã™ã‚‹å‡¦ç†ã‚’行ã†ä¾‹ã§ã‚ã‚‹.
+# å¿…ãšã—ã‚‚ãã®ã‚ˆã†ã«ã™ã‚‹å¿…è¦ã¯ç„¡ã,
+# (ã‚‚ã—, ãã†ã—ãŸã‘れã°) class ã®å¤–ã§ tcl/tk ã«é–¢ã™ã‚‹å‡¦ç†ã‚’行ã£ã¦ã‚‚良ã„.
class Test1
- # ½é´ü²½(¥¤¥ó¥¿¥×¥ê¥¿¤òÀ¸À®¤·¤Æ¥¦¥£¥¸¥§¥Ã¥È¤òÀ¸À®¤¹¤ë).
+ # åˆæœŸåŒ–(インタプリタを生æˆã—ã¦ã‚¦ã‚£ã‚¸ã‚§ãƒƒãƒˆã‚’生æˆã™ã‚‹).
def initialize()
- #### »È¤¦Á°¤Î¤ª¤Þ¤¸¤Ê¤¤
+ #### 使ã†å‰ã®ãŠã¾ã˜ãªã„
- # ¥¤¥ó¥¿¥×¥ê¥¿¤ÎÀ¸À®.
+ # インタプリタã®ç”Ÿæˆ.
ip = TclTkInterpreter.new()
- # ¥³¥Þ¥ó¥É¤ËÂбþ¤¹¤ë¥ª¥Ö¥¸¥§¥¯¥È¤ò c ¤ËÀßÄꤷ¤Æ¤ª¤¯.
+ # コマンドã«å¯¾å¿œã™ã‚‹ã‚ªãƒ–ジェクトを c ã«è¨­å®šã—ã¦ãŠã.
c = ip.commands()
- # »ÈÍѤ¹¤ë¥³¥Þ¥ó¥É¤ËÂбþ¤¹¤ë¥ª¥Ö¥¸¥§¥¯¥È¤ÏÊÑ¿ô¤ËÆþ¤ì¤Æ¤ª¤¯.
+ # 使用ã™ã‚‹ã‚³ãƒžãƒ³ãƒ‰ã«å¯¾å¿œã™ã‚‹ã‚ªãƒ–ジェクトã¯å¤‰æ•°ã«å…¥ã‚Œã¦ãŠã.
append, bind, button, destroy, incr, info, label, place, set, wm =
c.values_at(
"append", "bind", "button", "destroy", "incr", "info", "label", "place",
"set", "wm")
- #### tcl/tk ¤Î¥³¥Þ¥ó¥É¤ËÂбþ¤¹¤ë¥ª¥Ö¥¸¥§¥¯¥È(TclTkCommand)¤ÎÁàºî
+ #### tcl/tk ã®ã‚³ãƒžãƒ³ãƒ‰ã«å¯¾å¿œã™ã‚‹ã‚ªãƒ–ジェクト(TclTkCommand)ã®æ“作
- # ¼Â¹Ô¤¹¤ë»þ¤Ï, e() ¥á¥½¥Ã¥É¤ò»È¤¦.
- # (°Ê²¼¤Ï, tcl/tk ¤Ë¤ª¤±¤ë info command r* ¤ò¼Â¹Ô.)
+ # 実行ã™ã‚‹æ™‚ã¯, e() メソッドを使ã†.
+ # (以下ã¯, tcl/tk ã«ãŠã‘ã‚‹ info command r* を実行.)
print info.e("command", "r*"), "\n"
- # °ú¿ô¤Ï, ¤Þ¤È¤á¤¿Ê¸»úÎó¤Ë¤·¤Æ¤âƱ¤¸.
+ # 引数ã¯, ã¾ã¨ã‚ãŸæ–‡å­—列ã«ã—ã¦ã‚‚åŒã˜.
print info.e("command r*"), "\n"
- # ÊÑ¿ô¤òÍѤ¤¤Ê¤¯¤È¤â¼Â¹Ô¤Ç¤­¤ë¤¬, ¸«¤¿¤á¤¬°­¤¤.
+ # 変数を用ã„ãªãã¨ã‚‚実行ã§ãã‚‹ãŒ, 見ãŸã‚ãŒæ‚ªã„.
print c["info"].e("command", "r*"), "\n"
- # ¥¤¥ó¥¿¥×¥ê¥¿¤Î¥á¥½¥Ã¥É¤È¤·¤Æ¤â¼Â¹Ô¤Ç¤­¤ë¤¬, ¸úΨ¤¬°­¤¤.
+ # インタプリタã®ãƒ¡ã‚½ãƒƒãƒ‰ã¨ã—ã¦ã‚‚実行ã§ãã‚‹ãŒ, åŠ¹çŽ‡ãŒæ‚ªã„.
print ip.info("command", "r*"), "\n"
####
- # °Ê²¼, À¸À®¤·¤¿¥ª¥Ö¥¸¥§¥¯¥È¤ÏÊÑ¿ô¤ËÂåÆþ¤·¤Æ¤ª¤«¤Ê¤¤¤È
- # GC ¤ÎÂоݤˤʤäƤ·¤Þ¤¦.
+ # 以下, 生æˆã—ãŸã‚ªãƒ–ジェクトã¯å¤‰æ•°ã«ä»£å…¥ã—ã¦ãŠã‹ãªã„ã¨
+ # GC ã®å¯¾è±¡ã«ãªã£ã¦ã—ã¾ã†.
- #### tcl/tk ¤ÎÊÑ¿ô¤ËÂбþ¤¹¤ë¥ª¥Ö¥¸¥§¥¯¥È(TclTkVariable)¤ÎÁàºî
+ #### tcl/tk ã®å¤‰æ•°ã«å¯¾å¿œã™ã‚‹ã‚ªãƒ–ジェクト(TclTkVariable)ã®æ“作
- # À¸À®¤ÈƱ»þ¤ËÃͤòÀßÄꤹ¤ë.
+ # 生æˆã¨åŒæ™‚ã«å€¤ã‚’設定ã™ã‚‹.
v1 = TclTkVariable.new(ip, "20")
- # ÆÉ¤ß½Ð¤·¤Ï get ¥á¥½¥Ã¥É¤ò»È¤¦.
+ # 読ã¿å‡ºã—㯠get メソッドを使ã†.
print v1.get(), "\n"
- # ÀßÄê¤Ï set ¥á¥½¥Ã¥É¤ò»È¤¦.
+ # 設定㯠set メソッドを使ã†.
v1.set(40)
print v1.get(), "\n"
- # set ¥³¥Þ¥ó¥É¤ò»È¤Ã¤ÆÆÉ¤ß½Ð¤·, ÀßÄê¤Ï²Äǽ¤À¤¬¸«¤¿¤á¤¬°­¤¤.
- # e() ¥á¥½¥Ã¥ÉÅù¤Î°ú¿ô¤ËľÀÜ TclTkObject ¤ä¿ôÃͤò½ñ¤¤¤Æ¤âÎɤ¤.
+ # set コマンドを使ã£ã¦èª­ã¿å‡ºã—, 設定ã¯å¯èƒ½ã ãŒè¦‹ãŸã‚ãŒæ‚ªã„.
+ # e() メソッド等ã®å¼•æ•°ã«ç›´æŽ¥ TclTkObject や数値を書ã„ã¦ã‚‚良ã„.
set.e(v1, 30)
print set.e(v1), "\n"
- # tcl/tk ¤Î¥³¥Þ¥ó¥É¤ÇÊÑ¿ô¤òÁàºî¤Ç¤­¤ë.
+ # tcl/tk ã®ã‚³ãƒžãƒ³ãƒ‰ã§å¤‰æ•°ã‚’æ“作ã§ãã‚‹.
incr.e(v1)
print v1.get(), "\n"
append.e(v1, 10)
print v1.get(), "\n"
- #### tcl/tk ¤Î¥¦¥£¥¸¥§¥Ã¥È¤ËÂбþ¤¹¤ë¥ª¥Ö¥¸¥§¥¯¥È(TclTkWidget)¤ÎÁàºî
+ #### tcl/tk ã®ã‚¦ã‚£ã‚¸ã‚§ãƒƒãƒˆã«å¯¾å¿œã™ã‚‹ã‚ªãƒ–ジェクト(TclTkWidget)ã®æ“作
- # ¥ë¡¼¥È¥¦¥£¥¸¥§¥Ã¥È¤ò¼è¤ê½Ð¤¹.
+ # ルートウィジェットをå–り出ã™.
root = ip.rootwidget()
- # ¥¦¥£¥¸¥§¥Ã¥È¤ÎÁàºî.
+ # ã‚¦ã‚£ã‚¸ã‚§ãƒƒãƒˆã®æ“作.
root.e("configure -height 300 -width 300")
- # ¥¿¥¤¥È¥ë¤òÉÕ¤±¤ë¤È¤­¤Ï wm ¤ò»È¤¦.
+ # タイトルを付ã‘ã‚‹ã¨ã㯠wm を使ã†.
wm.e("title", root, $0)
- # ¿Æ¥¦¥£¥¸¥§¥Ã¥È¤È¥³¥Þ¥ó¥É¤ò»ØÄꤷ¤Æ, ¥¦¥£¥¸¥§¥Ã¥È¤òºî¤ë.
+ # 親ウィジェットã¨ã‚³ãƒžãƒ³ãƒ‰ã‚’指定ã—ã¦, ウィジェットを作る.
l1 = TclTkWidget.new(ip, root, label, "-text {type `x' to print}")
- # place ¤¹¤ë¤Èɽ¼¨¤µ¤ì¤ë.
+ # place ã™ã‚‹ã¨è¡¨ç¤ºã•れる.
place.e(l1, "-x 0 -rely 0.0 -relwidth 1 -relheight 0.1")
- # ¥³¥Þ¥ó¥É̾¤Ïʸ»úÎó¤Ç»ØÄꤷ¤Æ¤âÎɤ¤¤¬, ¸«¤¿¤á¤¬°­¤¤.
- # (¥³¥Þ¥ó¥É̾¤ÏÆÈΩ¤·¤¿°ú¿ô¤Ç¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤.)
+ # コマンドåã¯æ–‡å­—åˆ—ã§æŒ‡å®šã—ã¦ã‚‚良ã„ãŒ, 見ãŸã‚ãŒæ‚ªã„.
+ # (コマンドåã¯ç‹¬ç«‹ã—ãŸå¼•æ•°ã§ãªã‘れã°ãªã‚‰ãªã„.)
l2 = TclTkWidget.new(ip, root, "label")
- # ¥¦¥£¥¸¥§¥Ã¥È¤ÎÁàºî.
+ # ã‚¦ã‚£ã‚¸ã‚§ãƒƒãƒˆã®æ“作.
l2.e("configure -text {type `q' to exit}")
place.e(l2, "-x 0 -rely 0.1 -relwidth 1 -relheight 0.1")
- #### tcl/tk ¤Î¥³¡¼¥ë¥Ð¥Ã¥¯¤ËÂбþ¤¹¤ë¥ª¥Ö¥¸¥§¥¯¥È(TclTkCallback)¤ÎÁàºî
+ #### tcl/tk ã®ã‚³ãƒ¼ãƒ«ãƒãƒƒã‚¯ã«å¯¾å¿œã™ã‚‹ã‚ªãƒ–ジェクト(TclTkCallback)ã®æ“作
- # ¥³¡¼¥ë¥Ð¥Ã¥¯¤òÀ¸À®¤¹¤ë.
+ # コールãƒãƒƒã‚¯ã‚’生æˆã™ã‚‹.
c1 = TclTkCallback.new(ip, proc{sample(ip, root)})
- # ¥³¡¼¥ë¥Ð¥Ã¥¯¤ò»ý¤Ä¥¦¥£¥¸¥§¥Ã¥È¤òÀ¸À®¤¹¤ë.
+ # コールãƒãƒƒã‚¯ã‚’æŒã¤ã‚¦ã‚£ã‚¸ã‚§ãƒƒãƒˆã‚’生æˆã™ã‚‹.
b1 = TclTkWidget.new(ip, root, button, "-text sample -command", c1)
place.e(b1, "-x 0 -rely 0.2 -relwidth 1 -relheight 0.1")
- # ¥¤¥Ù¥ó¥È¥ë¡¼¥×¤òÈ´¤±¤ë¤Ë¤Ï destroy.e(root) ¤¹¤ë.
+ # イベントループを抜ã‘ã‚‹ã«ã¯ destroy.e(root) ã™ã‚‹.
c2 = TclTkCallback.new(ip, proc{destroy.e(root)})
b2 = TclTkWidget.new(ip, root, button, "-text exit -command", c2)
place.e(b2, "-x 0 -rely 0.3 -relwidth 1 -relheight 0.1")
- #### ¥¤¥Ù¥ó¥È¤Î¥Ð¥¤¥ó¥É
- # script ¤ÎÄɲà (bind tag sequence +script) ¤Ïº£¤Î¤È¤³¤í¤Ç¤­¤Ê¤¤.
- # (¥¤¥Æ¥ì¡¼¥¿ÊÑ¿ô¤ÎÀßÄ꤬¤¦¤Þ¤¯¤¤¤«¤Ê¤¤.)
+ #### イベントã®ãƒã‚¤ãƒ³ãƒ‰
+ # script ã®è¿½åŠ  (bind tag sequence +script) ã¯ä»Šã®ã¨ã“ã‚ã§ããªã„.
+ # (イテレータ変数ã®è¨­å®šãŒã†ã¾ãã„ã‹ãªã„.)
- # ´ðËÜŪ¤Ë¤Ï¥¦¥£¥¸¥§¥Ã¥È¤ËÂФ¹¤ë¥³¡¼¥ë¥Ð¥Ã¥¯¤ÈƱ¤¸.
+ # 基本的ã«ã¯ã‚¦ã‚£ã‚¸ã‚§ãƒƒãƒˆã«å¯¾ã™ã‚‹ã‚³ãƒ¼ãƒ«ãƒãƒƒã‚¯ã¨åŒã˜.
c3 = TclTkCallback.new(ip, proc{print("q pressed\n"); destroy.e(root)})
bind.e(root, "q", c3)
- # bind ¥³¥Þ¥ó¥É¤Ç % ÃÖ´¹¤Ë¤è¤ê¥Ñ¥é¥á¡¼¥¿¤ò¼õ¤±¼è¤ê¤¿¤¤¤È¤­¤Ï,
- # proc{} ¤Î¸å¤í¤Ëʸ»úÎó¤Ç»ØÄꤹ¤ë¤È,
- # ÃÖ´¹·ë²Ì¤ò¥¤¥Æ¥ì¡¼¥¿ÊÑ¿ô¤òÄ̤·¤Æ¼õ¤±¼è¤ë¤³¤È¤¬¤Ç¤­¤ë.
- # ¤¿¤À¤· proc{} ¤Î¸å¤í¤Îʸ»úÎó¤Ï,
- # bind ¥³¥Þ¥ó¥É¤ËÍ¿¤¨¤ë¥³¡¼¥ë¥Ð¥Ã¥¯°Ê³°¤Ç»ØÄꤷ¤Æ¤Ï¤¤¤±¤Ê¤¤.
+ # bind コマンド㧠% ç½®æ›ã«ã‚ˆã‚Šãƒ‘ラメータをå—ã‘å–りãŸã„ã¨ãã¯,
+ # proc{} ã®å¾Œã‚ã«æ–‡å­—åˆ—ã§æŒ‡å®šã™ã‚‹ã¨,
+ # ç½®æ›çµæžœã‚’イテレータ変数を通ã—ã¦å—ã‘å–ã‚‹ã“ã¨ãŒã§ãã‚‹.
+ # ãŸã ã— proc{} ã®å¾Œã‚ã®æ–‡å­—列ã¯,
+ # bind コマンドã«ä¸Žãˆã‚‹ã‚³ãƒ¼ãƒ«ãƒãƒƒã‚¯ä»¥å¤–ã§æŒ‡å®šã—ã¦ã¯ã„ã‘ãªã„.
c4 = TclTkCallback.new(ip, proc{|i| print("#{i} pressed\n")}, "%A")
bind.e(root, "x", c4)
- # TclTkCallback ¤ò GC ¤ÎÂоݤˤ·¤¿¤±¤ì¤Ð,
- # dcb() (¤Þ¤¿¤Ï deletecallbackkeys()) ¤¹¤ëɬÍפ¬¤¢¤ë.
+ # TclTkCallback ã‚’ GC ã®å¯¾è±¡ã«ã—ãŸã‘れã°,
+ # dcb() (ã¾ãŸã¯ deletecallbackkeys()) ã™ã‚‹å¿…è¦ãŒã‚ã‚‹.
cb = [c1, c2, c3, c4]
c5 = TclTkCallback.new(ip, proc{|w| TclTk.dcb(cb, root, w)}, "%W")
bind.e(root, "<Destroy>", c5)
cb.push(c5)
- #### tcl/tk ¤Î¥¤¥á¡¼¥¸¤ËÂбþ¤¹¤ë¥ª¥Ö¥¸¥§¥¯¥È(TclTkImage)¤ÎÁàºî
+ #### tcl/tk ã®ã‚¤ãƒ¡ãƒ¼ã‚¸ã«å¯¾å¿œã™ã‚‹ã‚ªãƒ–ジェクト(TclTkImage)ã®æ“作
- # ¥Ç¡¼¥¿¤ò»ØÄꤷ¤ÆÀ¸À®¤¹¤ë.
+ # データを指定ã—ã¦ç”Ÿæˆã™ã‚‹.
i1 = TclTkImage.new(ip, "photo", "-file maru.gif")
- # ¥é¥Ù¥ë¤ËÄ¥¤êÉÕ¤±¤Æ¤ß¤ë.
+ # ラベルã«å¼µã‚Šä»˜ã‘ã¦ã¿ã‚‹.
l3 = TclTkWidget.new(ip, root, label, "-relief raised -image", i1)
place.e(l3, "-x 0 -rely 0.4 -relwidth 0.2 -relheight 0.2")
- # ¶õ¤Î¥¤¥á¡¼¥¸¤òÀ¸À®¤·¤Æ¸å¤ÇÁàºî¤¹¤ë.
+ # 空ã®ã‚¤ãƒ¡ãƒ¼ã‚¸ã‚’生æˆã—ã¦å¾Œã§æ“作ã™ã‚‹.
i2 = TclTkImage.new(ip, "photo")
- # ¥¤¥á¡¼¥¸¤òÁàºî¤¹¤ë.
+ # イメージをæ“作ã™ã‚‹.
i2.e("copy", i1)
i2.e("configure -gamma 0.5")
l4 = TclTkWidget.new(ip, root, label, "-relief raised -image", i2)
@@ -134,26 +134,26 @@ class Test1
####
end
- # ¥µ¥ó¥×¥ë¤Î¤¿¤á¤Î¥¦¥£¥¸¥§¥Ã¥È¤òÀ¸À®¤¹¤ë.
+ # サンプルã®ãŸã‚ã®ã‚¦ã‚£ã‚¸ã‚§ãƒƒãƒˆã‚’生æˆã™ã‚‹.
def sample(ip, parent)
bind, button, destroy, grid, toplevel, wm = ip.commands().values_at(
"bind", "button", "destroy", "grid", "toplevel", "wm")
## toplevel
- # ¿·¤·¤¤¥¦¥¤¥ó¥É¥¦¤ò³«¤¯¤Ë¤Ï, toplevel ¤ò»È¤¦.
+ # æ–°ã—ã„ウインドウを開ãã«ã¯, toplevel を使ã†.
t1 = TclTkWidget.new(ip, parent, toplevel)
- # ¥¿¥¤¥È¥ë¤òÉÕ¤±¤Æ¤ª¤¯
+ # タイトルを付ã‘ã¦ãŠã
wm.e("title", t1, "sample")
- # ¥¦¥£¥¸¥§¥Ã¥È¤¬Ç˲õ¤µ¤ì¤¿¤È¤­, ¥³¡¼¥ë¥Ð¥Ã¥¯¤¬ GC ¤ÎÂоݤˤʤë¤è¤¦¤Ë¤¹¤ë.
+ # ウィジェットãŒç ´å£Šã•れãŸã¨ã, コールãƒãƒƒã‚¯ãŒ GC ã®å¯¾è±¡ã«ãªã‚‹ã‚ˆã†ã«ã™ã‚‹.
cb = []
cb.push(c = TclTkCallback.new(ip, proc{|w| TclTk.dcb(cb, t1, w)}, "%W"))
bind.e(t1, "<Destroy>", c)
- # ¥Ü¥¿¥ó¤ÎÀ¸À®.
+ # ボタンã®ç”Ÿæˆ.
wid = []
- # toplevel ¥¦¥£¥¸¥§¥Ã¥È¤òÇ˲õ¤¹¤ë¤Ë¤Ï destroy ¤¹¤ë.
+ # toplevel ウィジェットを破壊ã™ã‚‹ã«ã¯ destroy ã™ã‚‹.
cb.push(c = TclTkCallback.new(ip, proc{destroy.e(t1)}))
wid.push(TclTkWidget.new(ip, t1, button, "-text close -command", c))
cb.push(c = TclTkCallback.new(ip, proc{test_label(ip, t1)}))
@@ -183,7 +183,7 @@ class Test1
cb.push(c = TclTkCallback.new(ip, proc{test_canvas(ip, t1)}))
wid.push(TclTkWidget.new(ip, t1, button, "-text canvas -command", c))
- # grid ¤Çɽ¼¨¤¹¤ë.
+ # grid ã§è¡¨ç¤ºã™ã‚‹.
ro = co = 0
wid.each{|w|
grid.e(w, "-row", ro, "-column", co, "-sticky news")
@@ -196,38 +196,38 @@ class Test1
end
# inittoplevel(ip, parent, title)
- # °Ê²¼¤Î½èÍý¤ò¤Þ¤È¤á¤Æ¹Ô¤¦.
- # 1. toplevel ¥¦¥£¥¸¥§¥Ã¥È¤òºîÀ®¤¹¤ë.
- # 2. ¥³¡¼¥ë¥Ð¥Ã¥¯¤òÅÐÏ¿¤¹¤ëÇÛÎó¤òÍѰդ·, toplevel ¥¦¥£¥¸¥§¥Ã¥È¤Î
- # <Destroy> ¥¤¥Ù¥ó¥È¤Ë¥³¡¼¥ë¥Ð¥Ã¥¯¤òºï½ü¤¹¤ë¼ê³¤­¤òÅÐÏ¿¤¹¤ë.
- # 3. ¥¯¥í¡¼¥º¥Ü¥¿¥ó¤òºî¤ë.
- # ºîÀ®¤·¤¿ toplevel ¥¦¥£¥¸¥§¥Ã¥È, ¥¯¥í¡¼¥º¥Ü¥¿¥ó, ¥³¡¼¥ë¥Ð¥Ã¥¯ÅÐÏ¿ÍÑÊÑ¿ô
- # ¤òÊÖ¤¹.
- # ip: ¥¤¥ó¥¿¥×¥ê¥¿
- # parent: ¿Æ¥¦¥£¥¸¥§¥Ã¥È
- # title: toplevel ¥¦¥£¥¸¥§¥Ã¥È¤Î¥¦¥¤¥ó¥É¥¦¤Î¥¿¥¤¥È¥ë
+ # 以下ã®å‡¦ç†ã‚’ã¾ã¨ã‚ã¦è¡Œã†.
+ # 1. toplevel ウィジェットを作æˆã™ã‚‹.
+ # 2. コールãƒãƒƒã‚¯ã‚’登録ã™ã‚‹é…列を用æ„ã—, toplevel ウィジェットã®
+ # <Destroy> イベントã«ã‚³ãƒ¼ãƒ«ãƒãƒƒã‚¯ã‚’削除ã™ã‚‹æ‰‹ç¶šãを登録ã™ã‚‹.
+ # 3. クローズボタンを作る.
+ # 作æˆã—㟠toplevel ウィジェット, クローズボタン, コールãƒãƒƒã‚¯ç™»éŒ²ç”¨å¤‰æ•°
+ # ã‚’è¿”ã™.
+ # ip: インタプリタ
+ # parent: 親ウィジェット
+ # title: toplevel ウィジェットã®ã‚¦ã‚¤ãƒ³ãƒ‰ã‚¦ã®ã‚¿ã‚¤ãƒˆãƒ«
def inittoplevel(ip, parent, title)
bind, button, destroy, toplevel, wm = ip.commands().values_at(
"bind", "button", "destroy", "toplevel", "wm")
- # ¿·¤·¤¤¥¦¥¤¥ó¥É¥¦¤ò³«¤¯¤Ë¤Ï, toplevel ¤ò»È¤¦.
+ # æ–°ã—ã„ウインドウを開ãã«ã¯, toplevel を使ã†.
t1 = TclTkWidget.new(ip, parent, toplevel)
- # ¥¿¥¤¥È¥ë¤òÉÕ¤±¤Æ¤ª¤¯
+ # タイトルを付ã‘ã¦ãŠã
wm.e("title", t1, title)
- # ¥¦¥£¥¸¥§¥Ã¥È¤¬Ç˲õ¤µ¤ì¤¿¤È¤­, ¥³¡¼¥ë¥Ð¥Ã¥¯¤¬ GC ¤ÎÂоݤˤʤë¤è¤¦¤Ë¤¹¤ë.
+ # ウィジェットãŒç ´å£Šã•れãŸã¨ã, コールãƒãƒƒã‚¯ãŒ GC ã®å¯¾è±¡ã«ãªã‚‹ã‚ˆã†ã«ã™ã‚‹.
cb = []
cb.push(c = TclTkCallback.new(ip, proc{|w| TclTk.dcb(cb, t1, w)}, "%W"))
bind.e(t1, "<Destroy>", c)
- # close ¥Ü¥¿¥ó¤òºî¤Ã¤Æ¤ª¤¯.
- # toplevel ¥¦¥£¥¸¥§¥Ã¥È¤òÇ˲õ¤¹¤ë¤Ë¤Ï destroy ¤¹¤ë.
+ # close ボタンを作ã£ã¦ãŠã.
+ # toplevel ウィジェットを破壊ã™ã‚‹ã«ã¯ destroy ã™ã‚‹.
cb.push(c = TclTkCallback.new(ip, proc{destroy.e(t1)}))
b1 = TclTkWidget.new(ip, t1, button, "-text close -command", c)
return t1, b1, cb
end
- # label ¤Î¥µ¥ó¥×¥ë.
+ # label ã®ã‚µãƒ³ãƒ—ル.
def test_label(ip, parent)
button, global, label, pack = ip.commands().values_at(
"button", "global", "label", "pack")
@@ -235,7 +235,7 @@ class Test1
## label
- # ¤¤¤í¤¤¤í¤Ê·Á¤Î¥é¥Ù¥ë.
+ # ã„ã‚ã„ã‚ãªå½¢ã®ãƒ©ãƒ™ãƒ«.
l1 = TclTkWidget.new(ip, t1, label, "-text {default(flat)}")
l2 = TclTkWidget.new(ip, t1, label, "-text raised -relief raised")
l3 = TclTkWidget.new(ip, t1, label, "-text sunken -relief sunken")
@@ -244,23 +244,23 @@ class Test1
l6 = TclTkWidget.new(ip, t1, label, "-bitmap error")
l7 = TclTkWidget.new(ip, t1, label, "-bitmap questhead")
- # pack ¤·¤Æ¤âɽ¼¨¤µ¤ì¤ë.
+ # pack ã—ã¦ã‚‚表示ã•れる.
pack.e(b1, l1, l2, l3, l4, l5, l6, l7, "-pady 3")
## -textvariable
- # tcltk ¥é¥¤¥Ö¥é¥ê¤Î¼ÂÁõ¤Ç¤Ï, ¥³¡¼¥ë¥Ð¥Ã¥¯¤Ï tcl/tk ¤Î``¼ê³¤­''¤òÄ̤·¤Æ
- # ¸Æ¤Ð¤ì¤ë. ¤·¤¿¤¬¤Ã¤Æ, ¥³¡¼¥ë¥Ð¥Ã¥¯¤ÎÃæ¤Ç(Âç°è)ÊÑ¿ô¤Ë¥¢¥¯¥»¥¹¤¹¤ë¤È¤­¤Ï,
- # global ¤¹¤ëɬÍפ¬¤¢¤ë.
- # global ¤¹¤ëÁ°¤ËÊÑ¿ô¤ËÃͤòÀßÄꤷ¤Æ¤·¤Þ¤¦¤È¥¨¥é¡¼¤Ë¤Ê¤ë¤Î¤Ç,
- # tcl/tk ¤Ë¤ª¤±¤ëɽ¸½·Á¤À¤±À¸À®¤·¤Æ, ¼ÂºÝ¤ËÃͤòÀßÄꤷ¤Ê¤¤¤è¤¦¤Ë,
- # 2 ÈÖÌܤΰú¿ô¤Ë¤Ï nil ¤òÍ¿¤¨¤ë.
+ # tcltk ライブラリã®å®Ÿè£…ã§ã¯, コールãƒãƒƒã‚¯ã¯ tcl/tk ã®``手続ã''を通ã—ã¦
+ # 呼ã°ã‚Œã‚‹. ã—ãŸãŒã£ã¦, コールãƒãƒƒã‚¯ã®ä¸­ã§(大域)変数ã«ã‚¢ã‚¯ã‚»ã‚¹ã™ã‚‹ã¨ãã¯,
+ # global ã™ã‚‹å¿…è¦ãŒã‚ã‚‹.
+ # global ã™ã‚‹å‰ã«å¤‰æ•°ã«å€¤ã‚’設定ã—ã¦ã—ã¾ã†ã¨ã‚¨ãƒ©ãƒ¼ã«ãªã‚‹ã®ã§,
+ # tcl/tk ã«ãŠã‘る表ç¾å½¢ã ã‘生æˆã—ã¦, 実際ã«å€¤ã‚’設定ã—ãªã„よã†ã«,
+ # 2 番目ã®å¼•æ•°ã«ã¯ nil を与ãˆã‚‹.
v1 = TclTkVariable.new(ip, nil)
global.e(v1)
v1.set(100)
- # -textvariable ¤ÇÊÑ¿ô¤òÀßÄꤹ¤ë.
+ # -textvariable ã§å¤‰æ•°ã‚’設定ã™ã‚‹.
l6 = TclTkWidget.new(ip, t1, label, "-textvariable", v1)
- # ¥³¡¼¥ë¥Ð¥Ã¥¯¤ÎÃæ¤«¤éÊÑ¿ô¤òÁàºî¤¹¤ë.
+ # コールãƒãƒƒã‚¯ã®ä¸­ã‹ã‚‰å¤‰æ•°ã‚’æ“作ã™ã‚‹.
cb.push(c = TclTkCallback.new(ip, proc{
global.e(v1); v1.set(v1.get().to_i + 10)}))
b2 = TclTkWidget.new(ip, t1, button, "-text +10 -command", c)
@@ -270,14 +270,14 @@ class Test1
pack.e(l6, b2, b3)
end
- # button ¤Î¥µ¥ó¥×¥ë.
+ # button ã®ã‚µãƒ³ãƒ—ル.
def test_button(ip, parent)
button, pack = ip.commands().values_at("button", "pack")
t1, b1, cb = inittoplevel(ip, parent, "button")
## button
- # ¥³¡¼¥ë¥Ð¥Ã¥¯Æâ¤Ç»²¾È¤¹¤ëÊÑ¿ô¤ÏÀè¤ËÀë¸À¤·¤Æ¤ª¤«¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤.
+ # コールãƒãƒƒã‚¯å†…ã§å‚ç…§ã™ã‚‹å¤‰æ•°ã¯å…ˆã«å®£è¨€ã—ã¦ãŠã‹ãªã‘れã°ãªã‚‰ãªã„.
b3 = b4 = nil
cb.push(c = TclTkCallback.new(ip, proc{b3.e("flash"); b4.e("flash")}))
b2 = TclTkWidget.new(ip, t1, button, "-text flash -command", c)
@@ -288,7 +288,7 @@ class Test1
pack.e(b1, b2, b3, b4)
end
- # checkbutton ¤Î¥µ¥ó¥×¥ë.
+ # checkbutton ã®ã‚µãƒ³ãƒ—ル.
def test_checkbutton(ip, parent)
checkbutton, global, pack = ip.commands().values_at(
"checkbutton", "global", "pack")
@@ -298,13 +298,13 @@ class Test1
v1 = TclTkVariable.new(ip, nil)
global.e(v1)
- # -variable ¤ÇÊÑ¿ô¤òÀßÄꤹ¤ë.
+ # -variable ã§å¤‰æ•°ã‚’設定ã™ã‚‹.
ch1 = TclTkWidget.new(ip, t1, checkbutton, "-onvalue on -offvalue off",
"-textvariable", v1, "-variable", v1)
pack.e(b1, ch1)
end
- # radiobutton ¤Î¥µ¥ó¥×¥ë.
+ # radiobutton ã®ã‚µãƒ³ãƒ—ル.
def test_radiobutton(ip, parent)
global, label, pack, radiobutton = ip.commands().values_at(
"global", "label", "pack", "radiobutton")
@@ -314,10 +314,10 @@ class Test1
v1 = TclTkVariable.new(ip, nil)
global.e(v1)
- # ¥Ì¥ë¥¹¥È¥ê¥ó¥°¤Ï "{}" ¤Ç»ØÄꤹ¤ë.
+ # ヌルストリング㯠"{}" ã§æŒ‡å®šã™ã‚‹.
v1.set("{}")
l1 = TclTkWidget.new(ip, t1, label, "-textvariable", v1)
- # -variable ¤ÇƱ¤¸ÊÑ¿ô¤ò»ØÄꤹ¤ë¤ÈƱ¤¸¥°¥ë¡¼¥×¤Ë¤Ê¤ë.
+ # -variable ã§åŒã˜å¤‰æ•°ã‚’指定ã™ã‚‹ã¨åŒã˜ã‚°ãƒ«ãƒ¼ãƒ—ã«ãªã‚‹.
ra1 = TclTkWidget.new(ip, t1, radiobutton,
"-text radio1 -value r1 -variable", v1)
ra2 = TclTkWidget.new(ip, t1, radiobutton,
@@ -328,7 +328,7 @@ class Test1
pack.e(b1, l1, ra1, ra2, ra3)
end
- # scale ¤Î¥µ¥ó¥×¥ë.
+ # scale ã®ã‚µãƒ³ãƒ—ル.
def test_scale(ip, parent)
global, pack, scale = ip.commands().values_at(
"global", "pack", "scale")
@@ -339,7 +339,7 @@ class Test1
v1 = TclTkVariable.new(ip, nil)
global.e(v1)
v1.set(219)
- # ¥³¡¼¥ë¥Ð¥Ã¥¯Æâ¤Ç»²¾È¤¹¤ëÊÑ¿ô¤ÏÀè¤ËÀë¸À¤·¤Æ¤ª¤«¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤.
+ # コールãƒãƒƒã‚¯å†…ã§å‚ç…§ã™ã‚‹å¤‰æ•°ã¯å…ˆã«å®£è¨€ã—ã¦ãŠã‹ãªã‘れã°ãªã‚‰ãªã„.
sca1 = nil
cb.push(c = TclTkCallback.new(ip, proc{global.e(v1); v = v1.get();
sca1.e("configure -background", format("#%02x%02x%02x", v, v, v))}))
@@ -348,7 +348,7 @@ class Test1
pack.e(b1, sca1)
end
- # entry ¤Î¥µ¥ó¥×¥ë.
+ # entry ã®ã‚µãƒ³ãƒ—ル.
def test_entry(ip, parent)
button, entry, global, pack = ip.commands().values_at(
"button", "entry", "global", "pack")
@@ -358,7 +358,7 @@ class Test1
v1 = TclTkVariable.new(ip, nil)
global.e(v1)
- # ¥Ì¥ë¥¹¥È¥ê¥ó¥°¤Ï "{}" ¤Ç»ØÄꤹ¤ë.
+ # ヌルストリング㯠"{}" ã§æŒ‡å®šã™ã‚‹.
v1.set("{}")
en1 = TclTkWidget.new(ip, t1, entry, "-textvariable", v1)
cb.push(c = TclTkCallback.new(ip, proc{
@@ -367,7 +367,7 @@ class Test1
pack.e(b1, en1, b2)
end
- # text ¤Î¥µ¥ó¥×¥ë.
+ # text ã®ã‚µãƒ³ãƒ—ル.
def test_text(ip, parent)
button, pack, text = ip.commands().values_at(
"button", "pack", "text")
@@ -377,13 +377,13 @@ class Test1
te1 = TclTkWidget.new(ip, t1, text)
cb.push(c = TclTkCallback.new(ip, proc{
- # 1 ¹ÔÌܤΠ0 ʸ»úÌܤ«¤éºÇ¸å¤Þ¤Ç¤òɽ¼¨¤·, ºï½ü¤¹¤ë.
+ # 1 行目㮠0 文字目ã‹ã‚‰æœ€å¾Œã¾ã§ã‚’表示ã—, 削除ã™ã‚‹.
print(te1.e("get 1.0 end")); te1.e("delete 1.0 end")}))
b2 = TclTkWidget.new(ip, t1, button, "-text print -command", c)
pack.e(b1, te1, b2)
end
- # raise/lower ¤Î¥µ¥ó¥×¥ë.
+ # raise/lower ã®ã‚µãƒ³ãƒ—ル.
def test_raise(ip, parent)
button, frame, lower, pack, raise = ip.commands().values_at(
"button", "frame", "lower", "pack", "raise")
@@ -391,9 +391,9 @@ class Test1
## raise/lower
- # button ¤ò±£¤¹¥Æ¥¹¥È¤Î¤¿¤á¤Ë, frame ¤ò»È¤¦.
+ # button ã‚’éš ã™ãƒ†ã‚¹ãƒˆã®ãŸã‚ã«, frame を使ã†.
f1 = TclTkWidget.new(ip, t1, frame)
- # ¥³¡¼¥ë¥Ð¥Ã¥¯Æâ¤Ç»²¾È¤¹¤ëÊÑ¿ô¤ÏÀè¤ËÀë¸À¤·¤Æ¤ª¤«¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤.
+ # コールãƒãƒƒã‚¯å†…ã§å‚ç…§ã™ã‚‹å¤‰æ•°ã¯å…ˆã«å®£è¨€ã—ã¦ãŠã‹ãªã‘れã°ãªã‚‰ãªã„.
b2 = nil
cb.push(c = TclTkCallback.new(ip, proc{raise.e(f1, b2)}))
b2 = TclTkWidget.new(ip, t1, button, "-text raise -command", c)
@@ -405,21 +405,21 @@ class Test1
pack.e(b1, f1)
end
- # modal ¤Ê¥¦¥£¥¸¥§¥Ã¥È¤Î¥µ¥ó¥×¥ë.
+ # modal ãªã‚¦ã‚£ã‚¸ã‚§ãƒƒãƒˆã®ã‚µãƒ³ãƒ—ル.
def test_modal(ip, parent)
button, frame, message, pack, tk_chooseColor, tk_getOpenFile,
tk_messageBox = ip.commands().values_at(
"button", "frame", "message", "pack", "tk_chooseColor",
"tk_getOpenFile", "tk_messageBox")
- # ºÇ½é¤Ë load ¤µ¤ì¤Æ¤¤¤Ê¤¤¥é¥¤¥Ö¥é¥ê¤Ï ip.commands() ¤Ë¸ºß¤·¤Ê¤¤¤Î¤Ç,
- # TclTkLibCommand ¤òÀ¸À®¤¹¤ëɬÍפ¬¤¢¤ë.
+ # 最åˆã« load ã•れã¦ã„ãªã„ライブラリ㯠ip.commands() ã«å­˜åœ¨ã—ãªã„ã®ã§,
+ # TclTkLibCommand を生æˆã™ã‚‹å¿…è¦ãŒã‚ã‚‹.
tk_dialog = TclTkLibCommand.new(ip, "tk_dialog")
t1, b1, cb = inittoplevel(ip, parent, "message/modal")
## message
- mes = "¤³¤ì¤Ï message ¥¦¥£¥¸¥§¥Ã¥È¤Î¥Æ¥¹¥È¤Ç¤¹."
- mes += "°Ê²¼¤Ï modal ¤Ê¥¦¥£¥¸¥§¥Ã¥È¤Î¥Æ¥¹¥È¤Ç¤¹."
+ mes = "ã“れ㯠message ウィジェットã®ãƒ†ã‚¹ãƒˆã§ã™."
+ mes += "以下㯠modal ãªã‚¦ã‚£ã‚¸ã‚§ãƒƒãƒˆã®ãƒ†ã‚¹ãƒˆã§ã™."
me1 = TclTkWidget.new(ip, t1, message, "-text {#{mes}}")
## modal
@@ -431,7 +431,7 @@ class Test1
b2 = TclTkWidget.new(ip, t1, button, "-text messageBox -command", c)
# tk_dialog
cb.push(c = TclTkCallback.new(ip, proc{
- # ¥¦¥£¥¸¥§¥Ã¥È̾¤òÀ¸À®¤¹¤ë¤¿¤á¤Ë¥À¥ß¡¼¤Î frame ¤òÀ¸À®.
+ # ウィジェットåを生æˆã™ã‚‹ãŸã‚ã«ãƒ€ãƒŸãƒ¼ã® frame を生æˆ.
print tk_dialog.e(TclTkWidget.new(ip, t1, frame),
"dialog dialog error 2 yes no cancel"), "\n"}))
b3 = TclTkWidget.new(ip, t1, button, "-text dialog -command", c)
@@ -449,7 +449,7 @@ class Test1
pack.e(b1, me1, b2, b3, b4, b5)
end
- # menu ¤Î¥µ¥ó¥×¥ë.
+ # menu ã®ã‚µãƒ³ãƒ—ル.
def test_menu(ip, parent)
global, menu, menubutton, pack = ip.commands().values_at(
"global", "menu", "menubutton", "pack")
@@ -458,29 +458,29 @@ class Test1
## menu
- # menubutton ¤òÀ¸À®¤¹¤ë.
+ # menubutton を生æˆã™ã‚‹.
mb1 = TclTkWidget.new(ip, t1, menubutton, "-text menu")
- # menu ¤òÀ¸À®¤¹¤ë.
+ # menu を生æˆã™ã‚‹.
me1 = TclTkWidget.new(ip, mb1, menu)
- # mb1 ¤«¤é me1 ¤¬µ¯Æ°¤µ¤ì¤ë¤è¤¦¤Ë¤¹¤ë.
+ # mb1 ã‹ã‚‰ me1 ãŒèµ·å‹•ã•れるよã†ã«ã™ã‚‹.
mb1.e("configure -menu", me1)
- # cascade ¤Çµ¯Æ°¤µ¤ì¤ë menu ¤òÀ¸À®¤¹¤ë.
+ # cascade ã§èµ·å‹•ã•れる menu を生æˆã™ã‚‹.
me11 = TclTkWidget.new(ip, me1, menu)
- # radiobutton ¤Î¥µ¥ó¥×¥ë.
+ # radiobutton ã®ã‚µãƒ³ãƒ—ル.
v1 = TclTkVariable.new(ip, nil); global.e(v1); v1.set("r1")
me11.e("add radiobutton -label radio1 -value r1 -variable", v1)
me11.e("add radiobutton -label radio2 -value r2 -variable", v1)
me11.e("add radiobutton -label radio3 -value r3 -variable", v1)
- # cascade ¤Ë¤è¤ê mb11 ¤¬µ¯Æ°¤µ¤ì¤ë¤è¤¦¤Ë¤¹¤ë.
+ # cascade ã«ã‚ˆã‚Š mb11 ãŒèµ·å‹•ã•れるよã†ã«ã™ã‚‹.
me1.e("add cascade -label cascade -menu", me11)
- # checkbutton ¤Î¥µ¥ó¥×¥ë.
+ # checkbutton ã®ã‚µãƒ³ãƒ—ル.
v2 = TclTkVariable.new(ip, nil); global.e(v2); v2.set("none")
me1.e("add checkbutton -label check -variable", v2)
- # separator ¤Î¥µ¥ó¥×¥ë.
+ # separator ã®ã‚µãƒ³ãƒ—ル.
me1.e("add separator")
- # command ¤Î¥µ¥ó¥×¥ë.
+ # command ã®ã‚µãƒ³ãƒ—ル.
v3 = nil
cb.push(c = TclTkCallback.new(ip, proc{
global.e(v1, v2, v3); print "v1: ", v1.get(), ", v2: ", v2.get(),
@@ -495,7 +495,7 @@ class Test1
pack.e(b1, mb1, om1, "-side left")
end
- # listbox ¤Î¥µ¥ó¥×¥ë.
+ # listbox ã®ã‚µãƒ³ãƒ—ル.
def test_listbox(ip, parent)
clipboard, frame, grid, listbox, lower, menu, menubutton, pack, scrollbar,
selection = ip.commands().values_at(
@@ -506,11 +506,11 @@ class Test1
## listbox/scrollbar
f1 = TclTkWidget.new(ip, t1, frame)
- # ¥³¡¼¥ë¥Ð¥Ã¥¯Æâ¤Ç»²¾È¤¹¤ëÊÑ¿ô¤ÏÀè¤ËÀë¸À¤·¤Æ¤ª¤«¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤.
+ # コールãƒãƒƒã‚¯å†…ã§å‚ç…§ã™ã‚‹å¤‰æ•°ã¯å…ˆã«å®£è¨€ã—ã¦ãŠã‹ãªã‘れã°ãªã‚‰ãªã„.
li1 = sc1 = sc2 = nil
- # ¼Â¹Ô»þ¤Ë, ¸å¤í¤Ë¥Ñ¥é¥á¡¼¥¿¤¬¤Ä¤¯¥³¡¼¥ë¥Ð¥Ã¥¯¤Ï,
- # ¥¤¥Æ¥ì¡¼¥¿ÊÑ¿ô¤Ç¤½¤Î¥Ñ¥é¥á¡¼¥¿¤ò¼õ¤±¼è¤ë¤³¤È¤¬¤Ç¤­¤ë.
- # (Ê£¿ô¤Î¥Ñ¥é¥á¡¼¥¿¤Ï¤Ò¤È¤Ä¤Îʸ»úÎó¤Ë¤Þ¤È¤á¤é¤ì¤ë.)
+ # 実行時ã«, 後ã‚ã«ãƒ‘ラメータãŒã¤ãコールãƒãƒƒã‚¯ã¯,
+ # イテレータ変数ã§ãã®ãƒ‘ラメータをå—ã‘å–ã‚‹ã“ã¨ãŒã§ãã‚‹.
+ # (複数ã®ãƒ‘ラメータã¯ã²ã¨ã¤ã®æ–‡å­—列ã«ã¾ã¨ã‚られる.)
cb.push(c1 = TclTkCallback.new(ip, proc{|i| li1.e("xview", i)}))
cb.push(c2 = TclTkCallback.new(ip, proc{|i| li1.e("yview", i)}))
cb.push(c3 = TclTkCallback.new(ip, proc{|i| sc1.e("set", i)}))
@@ -532,17 +532,17 @@ class Test1
me1 = TclTkWidget.new(ip, mb1, menu)
mb1.e("configure -menu", me1)
cb.push(c = TclTkCallback.new(ip, proc{
- # clipboard ¤ò¥¯¥ê¥¢.
+ # clipboard をクリア.
clipboard.e("clear")
- # selection ¤«¤éʸ»úÎó¤òÆÉ¤ß¹þ¤ß clipboard ¤ËÄɲ乤ë.
+ # selection ã‹ã‚‰æ–‡å­—列を読ã¿è¾¼ã¿ clipboard ã«è¿½åŠ ã™ã‚‹.
clipboard.e("append {#{selection.e('get')}}")}))
me1.e("add command -label {selection -> clipboard} -command",c)
cb.push(c = TclTkCallback.new(ip, proc{
- # li1 ¤ò¥¯¥ê¥¢.
+ # li1 をクリア.
li1.e("delete 0 end")
- # clipboard ¤«¤éʸ»úÎó¤ò¼è¤ê½Ð¤·, 1 ¹Ô¤º¤Ä
+ # clipboard ã‹ã‚‰æ–‡å­—列をå–り出ã—, 1 行ãšã¤
selection.e("get -selection CLIPBOARD").split(/\n/).each{|line|
- # li1 ¤ËÁÞÆþ¤¹¤ë.
+ # li1 ã«æŒ¿å…¥ã™ã‚‹.
li1.e("insert end {#{line}}")}}))
me1.e("add command -label {clipboard -> listbox} -command",c)
@@ -557,7 +557,7 @@ class Test1
pack.e(f2, f1)
end
- # canvas ¤Î¥µ¥ó¥×¥ë.
+ # canvas ã®ã‚µãƒ³ãƒ—ル.
def test_canvas(ip, parent)
canvas, lower, pack = ip.commands().values_at("canvas", "lower", "pack")
t1, b1, cb = inittoplevel(ip, parent, "canvas")
@@ -566,36 +566,36 @@ class Test1
ca1 = TclTkWidget.new(ip, t1, canvas, "-width 400 -height 300")
lower.e(ca1, b1)
- # rectangle ¤òºî¤ë.
+ # rectangle を作る.
idr = ca1.e("create rectangle 10 10 20 20")
- # oval ¤òºî¤ë.
+ # oval を作る.
ca1.e("create oval 60 10 100 50")
- # polygon ¤òºî¤ë.
+ # polygon を作る.
ca1.e("create polygon 110 10 110 30 140 10")
- # line ¤òºî¤ë.
+ # line を作る.
ca1.e("create line 150 10 150 30 190 10")
- # arc ¤òºî¤ë.
+ # arc を作る.
ca1.e("create arc 200 10 250 50 -start 0 -extent 90 -style pieslice")
- # i1 ¤ÏËÜÅö¤Ï, ¤É¤³¤«¤ÇÇ˲õ¤·¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¤¬, ÌÌÅݤʤΤÇÊü¤Ã¤Æ¤¢¤ë.
+ # i1 ã¯æœ¬å½“ã¯, ã©ã“ã‹ã§ç ´å£Šã—ãªã‘れã°ãªã‚‰ãªã„ãŒ, é¢å€’ãªã®ã§æ”¾ã£ã¦ã‚ã‚‹.
i1 = TclTkImage.new(ip, "photo", "-file maru.gif")
- # image ¤òºî¤ë.
+ # image を作る.
ca1.e("create image 100 100 -image", i1)
- # bitmap ¤òºî¤ë.
+ # bitmap を作る.
ca1.e("create bitmap 260 50 -bitmap questhead")
- # text ¤òºî¤ë.
+ # text を作る.
ca1.e("create text 320 50 -text {drag rectangle}")
- # window ¤òºî¤ë(¥¯¥í¡¼¥º¥Ü¥¿¥ó).
+ # window を作る(クローズボタン).
ca1.e("create window 200 200 -window", b1)
- # bind ¤Ë¤è¤ê rectangle ¤ò drag ¤Ç¤­¤ë¤è¤¦¤Ë¤¹¤ë.
+ # bind ã«ã‚ˆã‚Š rectangle ã‚’ drag ã§ãるよã†ã«ã™ã‚‹.
cb.push(c = TclTkCallback.new(ip, proc{|i|
- # i ¤Ë x ¤È y ¤ò¼õ¤±¼è¤ë¤Î¤Ç, ¼è¤ê½Ð¤¹.
+ # i ã« x 㨠y ã‚’å—ã‘å–ã‚‹ã®ã§, å–り出ã™.
x, y = i.split(/ /); x = x.to_f; y = y.to_f
- # ºÂɸ¤òÊѹ¹¤¹¤ë.
+ # 座標を変更ã™ã‚‹.
ca1.e("coords current #{x - 5} #{y - 5} #{x + 5} #{y + 5}")},
- # x, y ºÂɸ¤ò¶õÇò¤Ç¶èÀڤ俤â¤Î¤ò¥¤¥Æ¥ì¡¼¥¿ÊÑ¿ô¤ØÅϤ¹¤è¤¦¤Ë»ØÄê.
+ # x, y 座標を空白ã§åŒºåˆ‡ã£ãŸã‚‚ã®ã‚’ã‚¤ãƒ†ãƒ¬ãƒ¼ã‚¿å¤‰æ•°ã¸æ¸¡ã™ã‚ˆã†ã«æŒ‡å®š.
"%x %y"))
- # rectangle ¤Ë bind ¤¹¤ë.
+ # rectangle ã« bind ã™ã‚‹.
ca1.e("bind", idr, "<B1-Motion>", c)
pack.e(ca1)
@@ -605,7 +605,7 @@ end
# test driver
if ARGV.size == 0
- print "#{$0} n ¤Ç, n ¸Ä¤Î¥¤¥ó¥¿¥×¥ê¥¿¤òµ¯Æ°¤·¤Þ¤¹.\n"
+ print "#{$0} n ã§, n 個ã®ã‚¤ãƒ³ã‚¿ãƒ—リタを起動ã—ã¾ã™.\n"
n = 1
else
n = ARGV[0].to_i
@@ -614,16 +614,16 @@ end
print "start\n"
ip = []
-# ¥¤¥ó¥¿¥×¥ê¥¿, ¥¦¥£¥¸¥§¥Ã¥ÈÅù¤ÎÀ¸À®.
+# インタプリタ, ウィジェット等ã®ç”Ÿæˆ.
for i in 1 .. n
ip.push(Test1.new())
end
-# ÍѰդ¬¤Ç¤­¤¿¤é¥¤¥Ù¥ó¥È¥ë¡¼¥×¤ËÆþ¤ë.
+# 用æ„ãŒã§ããŸã‚‰ã‚¤ãƒ™ãƒ³ãƒˆãƒ«ãƒ¼ãƒ—ã«å…¥ã‚‹.
TclTk.mainloop()
print "exit from mainloop\n"
-# ¥¤¥ó¥¿¥×¥ê¥¿¤¬ GC ¤µ¤ì¤ë¤«¤Î¥Æ¥¹¥È.
+# インタプリタ㌠GC ã•れるã‹ã®ãƒ†ã‚¹ãƒˆ.
ip = []
print "GC.start\n" if $DEBUG
GC.start() if $DEBUG
diff --git a/ext/tk/sample/tcltklib/sample2.rb b/ext/tk/sample/tcltklib/sample2.rb
index f187d6ce1d..1acc180680 100644
--- a/ext/tk/sample/tcltklib/sample2.rb
+++ b/ext/tk/sample/tcltklib/sample2.rb
@@ -7,12 +7,12 @@
#---------------------------------------------------------------------------
# Sep. 17, 1997 modified by Y. Shigehiro for tcltk library
-# maeda shugo (shugo@po.aianet.ne.jp) »á¤Ë¤è¤ë
-# (ruby/tk ¤Ç½ñ¤«¤ì¤Æ¤¤¤¿) ruby ¤Î¥µ¥ó¥×¥ë¥×¥í¥°¥é¥à
+# maeda shugo (shugo@po.aianet.ne.jp) æ°ã«ã‚ˆã‚‹
+# (ruby/tk ã§æ›¸ã‹ã‚Œã¦ã„ãŸ) ruby ã®ã‚µãƒ³ãƒ—ルプログラム
# http://www.aianet.or.jp/~shugo/ruby/othello.rb.gz
-# ¤ò tcltk ¥é¥¤¥Ö¥é¥ê¤ò»È¤¦¤è¤¦¤Ë, µ¡³£Åª¤ËÊѹ¹¤·¤Æ¤ß¤Þ¤·¤¿.
+# ã‚’ tcltk ライブラリを使ã†ã‚ˆã†ã«, 機械的ã«å¤‰æ›´ã—ã¦ã¿ã¾ã—ãŸ.
#
-# ¤Ê¤ë¤Ù¤¯¥ª¥ê¥¸¥Ê¥ë¤ÈƱ¤¸¤Ë¤Ê¤ë¤è¤¦¤Ë¤·¤Æ¤¢¤ê¤Þ¤¹.
+# ãªã‚‹ã¹ãオリジナルã¨åŒã˜ã«ãªã‚‹ã‚ˆã†ã«ã—ã¦ã‚りã¾ã™.
require "observer"
require "tcltk"
@@ -343,14 +343,14 @@ class Othello
@board = Board.new(self)
@board_view = BoardView.new(self, @board)
#### added by Y. Shigehiro
- ## board_view ¤ÎÂ礭¤µ¤òÀßÄꤹ¤ë.
+ ## board_view ã®å¤§ãã•を設定ã™ã‚‹.
x1, y1, x2, y2 = @board_view.e("bbox all").split(/ /).collect{|i| i.to_f}
@board_view.e("configure -width", x2 - x1)
@board_view.e("configure -height", y2 - y1)
- ## scrollregion ¤òÀßÄꤹ¤ë.
+ ## scrollregion を設定ã™ã‚‹.
@board_view.e("configure -scrollregion {", @board_view.e("bbox all"),
"}")
- #### ¤³¤³¤Þ¤Ç
+ #### ã“ã“ã¾ã§
$pack.e(@board_view, "-fill both -expand true")
panel = TclTkWidget.new($ip, $root, $frame)
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/tkHTML/page1/index.html b/ext/tk/sample/tkextlib/tkHTML/page1/index.html
index 9efac7f7af..af87289c28 100644
--- a/ext/tk/sample/tkextlib/tkHTML/page1/index.html
+++ b/ext/tk/sample/tkextlib/tkHTML/page1/index.html
@@ -90,7 +90,7 @@ everything and the Wirth of nothing?
All trademarks and copyrights on this
page are owned by their respective owners. Comments
are owned by the Poster.
- The Rest © 1997-2000 <A href="http://Andover.Net">Andover.Net</A>.
+ The Rest 1997-2000 <A href="http://Andover.Net">Andover.Net</A>.
</FONT></CENTER>
</TD>
</TR>
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/tkoptdb-safeTk.rb b/ext/tk/sample/tkoptdb-safeTk.rb
index 3972577b0f..7502e30667 100644
--- a/ext/tk/sample/tkoptdb-safeTk.rb
+++ b/ext/tk/sample/tkoptdb-safeTk.rb
@@ -20,7 +20,7 @@ if ENV['LANG'] =~ /^ja/
# read Japanese resource
ent = TkOptionDB.read_entries(File.expand_path('resource.ja',
File.dirname(__FILE__)),
- 'euc-jp')
+ 'utf-8')
else
# read English resource
ent = TkOptionDB.read_entries(File.expand_path('resource.en',
diff --git a/ext/tk/sample/tkoptdb.rb b/ext/tk/sample/tkoptdb.rb
index 75c21e7e47..0171e465b3 100644
--- a/ext/tk/sample/tkoptdb.rb
+++ b/ext/tk/sample/tkoptdb.rb
@@ -13,7 +13,7 @@ if __FILE__ == $0 || !TkCore::INTERP.safe?
# read Japanese resource
TkOptionDB.read_with_encoding(File.expand_path('resource.ja',
File.dirname(__FILE__)),
- 'euc-jp')
+ 'utf-8')
else
# read English resource
TkOptionDB.readfile(File.expand_path('resource.en',
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 dd475c3455..7398a79ae3 100644
--- a/ext/tk/stubs.c
+++ b/ext/tk/stubs.c
@@ -96,7 +96,7 @@ _nativethread_consistency_check(ip)
# define TK_INDEX 7
# define TCL_NAME "libtcl8.9%s"
# define TK_NAME "libtk8.9%s"
-# if defined(__APPLE__) && defined(__MACH__) /* Mac OS X */
+# ifdef __APPLE__
# undef DLEXT
# define DLEXT ".dylib"
# endif
@@ -329,7 +329,7 @@ ruby_tk_stubs_init(tcl_ip)
if (!p_Tk_Init)
return NO_Tk_Init;
-#if defined USE_TK_STUBS && defined TK_FRAMEWORK && defined(__APPLE__) && defined(__MACH__)
+#if defined USE_TK_STUBS && defined TK_FRAMEWORK && defined(__APPLE__)
/*
FIX ME : dirty hack for Mac OS X frameworks.
With stubs, fails to find Resource/Script directory of Tk.framework.
diff --git a/ext/tk/tcltklib.c b/ext/tk/tcltklib.c
index 312b0c05eb..d269f9c43e 100644
--- a/ext/tk/tcltklib.c
+++ b/ext/tk/tcltklib.c
@@ -19,18 +19,22 @@
#define RUBY_RELEASE_DATE "unknown release-date"
#endif
-#ifdef RUBY_VM
-static VALUE rb_thread_critical; /* dummy */
+#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)
#define RSTRING_PTR(s) (RSTRING(s)->ptr)
#define RSTRING_LEN(s) (RSTRING(s)->len)
#endif
+#if !defined(RSTRING_LENINT)
+#define RSTRING_LENINT(s) ((int)RSTRING_LEN(s))
+#endif
#if !defined(RARRAY_PTR)
#define RARRAY_PTR(s) (RARRAY(s)->ptr)
#define RARRAY_LEN(s) (RARRAY(s)->len)
@@ -41,6 +45,7 @@ int rb_thread_check_trap_pending();
#else
#define RbTk_OBJ_UNTRUST(x) OBJ_TAINT(x)
#endif
+#define RbTk_ALLOC_N(type, n) (type *)ckalloc((int)(sizeof(type) * (n)))
#if defined(HAVE_RB_PROC_NEW) && !defined(RUBY_VM)
/* Ruby 1.8 :: rb_proc_new() was hidden from intern.h at 2008/04/22 */
@@ -264,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
@@ -1403,6 +1412,8 @@ pending_exception_check0()
} else {
return 0;
}
+
+ UNREACHABLE;
}
static int
@@ -1444,6 +1455,8 @@ pending_exception_check1(thr_crit_bup, ptr)
} else {
return 0;
}
+
+ UNREACHABLE;
}
@@ -1481,7 +1494,7 @@ call_original_exit(ptr, state)
#if USE_RUBY_ALLOC
argv = (Tcl_Obj **)ALLOC_N(Tcl_Obj *, 3);
#else /* not USE_RUBY_ALLOC */
- argv = (Tcl_Obj **)ckalloc(sizeof(Tcl_Obj *) * 3);
+ argv = RbTk_ALLOC_N(Tcl_Obj *, 3);
#if 0 /* use Tcl_Preserve/Release */
Tcl_Preserve((ClientData)argv); /* XXXXXXXX */
#endif
@@ -1521,7 +1534,7 @@ call_original_exit(ptr, state)
#if USE_RUBY_ALLOC
argv = ALLOC_N(char *, 3); /* XXXXXXXXXX */
#else /* not USE_RUBY_ALLOC */
- argv = (CONST84 char **)ckalloc(sizeof(char *) * 3);
+ argv = RbTk_ALLOC_N(CONST84 char *, 3);
#if 0 /* use Tcl_Preserve/Release */
Tcl_Preserve((ClientData)argv); /* XXXXXXXX */
#endif
@@ -1560,7 +1573,7 @@ call_original_exit(ptr, state)
#if USE_RUBY_ALLOC
argv = (char **)ALLOC_N(char *, 3);
#else /* not USE_RUBY_ALLOC */
- argv = (char **)ckalloc(sizeof(char *) * 3);
+ argv = RbTk_ALLOC_N(char *, 3);
#if 0 /* use Tcl_Preserve/Release */
Tcl_Preserve((ClientData)argv); /* XXXXXXXX */
#endif
@@ -1655,7 +1668,6 @@ set_eventloop_window_mode(self, mode)
VALUE self;
VALUE mode;
{
- rb_secure(4);
if (RTEST(mode)) {
window_event_mode = ~0;
@@ -1685,7 +1697,6 @@ set_eventloop_tick(self, tick)
int ttick = NUM2INT(tick);
int thr_crit_bup;
- rb_secure(4);
if (ttick < 0) {
rb_raise(rb_eArgError,
@@ -1752,7 +1763,6 @@ set_no_event_wait(self, wait)
{
int t_wait = NUM2INT(wait);
- rb_secure(4);
if (t_wait <= 0) {
rb_raise(rb_eArgError,
@@ -1806,7 +1816,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");
@@ -1925,7 +1934,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)) {
@@ -1942,7 +1950,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)) {
@@ -2047,6 +2054,7 @@ call_DoOneEvent(flag_val)
#endif
+#if 0
static VALUE
#ifdef HAVE_PROTOTYPES
eventloop_sleep(VALUE dummy)
@@ -2062,7 +2070,7 @@ eventloop_sleep(dummy)
}
t.tv_sec = 0;
- t.tv_usec = (long)(no_event_wait*1000.0);
+ t.tv_usec = (int)(no_event_wait*1000.0);
#ifdef HAVE_NATIVETHREAD
#ifndef RUBY_USE_NATIVE_THREAD
@@ -2086,6 +2094,7 @@ eventloop_sleep(dummy)
return Qnil;
}
+#endif
#define USE_EVLOOP_THREAD_ALONE_CHECK_FLAG 0
@@ -2182,18 +2191,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 * (long)no_event_wait;
+ t.tv_usec = 1000 * no_event_wait;
+#endif
Tcl_DeleteTimerHandler(timer_token);
run_timer_flag = 0;
@@ -2215,11 +2230,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;
@@ -2640,11 +2651,7 @@ 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);
rb_thread_wakeup(eventloop_thread);
@@ -2676,7 +2683,7 @@ lib_eventloop_launcher(check_root, update_flag, check_var, interp)
{
volatile VALUE parent_evloop = eventloop_thread;
struct evloop_params *args = ALLOC(struct evloop_params);
- /* struct evloop_params *args = (struct evloop_params *)ckalloc(sizeof(struct evloop_params)); */
+ /* struct evloop_params *args = RbTk_ALLOC_N(struct evloop_params, 1); */
tcl_stubs_check();
@@ -2949,17 +2956,17 @@ 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();
}
q = (struct thread_call_proc_arg *)ALLOC(struct thread_call_proc_arg);
- /* q = (struct thread_call_proc_arg *)ckalloc(sizeof(struct thread_call_proc_arg)); */
+ /* q = RbTk_ALLOC_N(struct thread_call_proc_arg, 1); */
q->proc = proc;
q->done = (int*)ALLOC(int);
- /* q->done = (int*)ckalloc(sizeof(int)); */
+ /* q->done = RbTk_ALLOC_N(int, 1); */
*(q->done) = 0;
/* create call-proc thread */
@@ -2968,14 +2975,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 {
@@ -3121,14 +3124,14 @@ ip_set_exc_message(interp, exc)
/* buf = ALLOC_N(char, (RSTRING(msg)->len)+1);*/
/* memcpy(buf, RSTRING(msg)->ptr, RSTRING(msg)->len);*/
/* buf[RSTRING(msg)->len] = 0; */
- buf = ALLOC_N(char, RSTRING_LEN(msg)+1);
- /* buf = ckalloc(sizeof(char)*((RSTRING_LEN(msg))+1)); */
+ buf = ALLOC_N(char, RSTRING_LENINT(msg)+1);
+ /* buf = ckalloc(RSTRING_LENINT(msg)+1); */
memcpy(buf, RSTRING_PTR(msg), RSTRING_LEN(msg));
buf[RSTRING_LEN(msg)] = 0;
Tcl_DStringInit(&dstr);
Tcl_DStringFree(&dstr);
- Tcl_ExternalToUtfDString(encoding, buf, RSTRING_LEN(msg), &dstr);
+ Tcl_ExternalToUtfDString(encoding, buf, RSTRING_LENINT(msg), &dstr);
Tcl_AppendResult(interp, Tcl_DStringValue(&dstr), (char*)NULL);
DUMP2("error message:%s", Tcl_DStringValue(&dstr));
@@ -3555,7 +3558,7 @@ ip_ruby_cmd_receiver_get(str)
} else {
/* global variable omitted '$' */
char *buf;
- int len;
+ size_t len;
len = strlen(str);
buf = ALLOC_N(char, len + 2);
@@ -3677,7 +3680,7 @@ ip_ruby_cmd(clientData, interp, argc, argv)
/* allocate */
arg = ALLOC(struct cmd_body_arg);
- /* arg = (struct cmd_body_arg *)ckalloc(sizeof(struct cmd_body_arg)); */
+ /* arg = RbTk_ALLOC_N(struct cmd_body_arg, 1); */
arg->receiver = receiver;
arg->method = method;
@@ -3878,8 +3881,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};
@@ -3905,6 +3906,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;
@@ -3948,7 +3950,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)) {
@@ -3966,11 +3968,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;
@@ -4032,8 +4030,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};
@@ -4070,17 +4069,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: {
@@ -4093,7 +4096,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
@@ -4116,7 +4121,7 @@ ip_rb_threadUpdateCommand(clientData, interp, objc, objv)
DUMP1("pass argument check");
/* param = (struct th_update_param *)Tcl_Alloc(sizeof(struct th_update_param)); */
- param = (struct th_update_param *)ckalloc(sizeof(struct th_update_param));
+ param = RbTk_ALLOC_N(struct th_update_param, 1);
#if 0 /* use Tcl_Preserve/Release */
Tcl_Preserve((ClientData)param);
#endif
@@ -4344,11 +4349,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
@@ -4637,11 +4638,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;
@@ -4701,11 +4698,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
@@ -4800,11 +4793,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;
@@ -4980,7 +4969,7 @@ ip_rb_threadVwaitCommand(clientData, interp, objc, objv)
rb_thread_critical = Qtrue;
/* param = (struct th_vwait_param *)Tcl_Alloc(sizeof(struct th_vwait_param)); */
- param = (struct th_vwait_param *)ckalloc(sizeof(struct th_vwait_param));
+ param = RbTk_ALLOC_N(struct th_vwait_param, 1);
#if 1 /* use Tcl_Preserve/Release */
Tcl_Preserve((ClientData)param);
#endif
@@ -5196,7 +5185,7 @@ ip_rb_threadTkWaitCommand(clientData, interp, objc, objv)
#endif
/* param = (struct th_vwait_param *)Tcl_Alloc(sizeof(struct th_vwait_param)); */
- param = (struct th_vwait_param *)ckalloc(sizeof(struct th_vwait_param));
+ param = RbTk_ALLOC_N(struct th_vwait_param, 1);
#if 1 /* use Tcl_Preserve/Release */
Tcl_Preserve((ClientData)param);
#endif
@@ -6042,7 +6031,7 @@ ip_rbNamespaceObjCmd(clientData, interp, objc, objv)
char **argv;
/* argv = (char **)Tcl_Alloc(sizeof(char *) * (objc + 1)); */
- argv = (char **)ckalloc(sizeof(char *) * (objc + 1));
+ argv = RbTk_ALLOC_N(char *, (objc + 1));
#if 0 /* use Tcl_Preserve/Release */
Tcl_Preserve((ClientData)argv); /* XXXXXXXX */
#endif
@@ -6151,7 +6140,7 @@ ip_init(argc, argv, self)
/* create object */
Data_Get_Struct(self, struct tcltkip, ptr);
ptr = ALLOC(struct tcltkip);
- /* ptr = (struct tcltkip *)ckalloc(sizeof(struct tcltkip)); */
+ /* ptr = RbTk_ALLOC_N(struct tcltkip, 1); */
DATA_PTR(self) = ptr;
#ifdef RUBY_USE_NATIVE_THREAD
ptr->tk_thread_id = 0;
@@ -6388,7 +6377,7 @@ ip_create_slave_core(interp, argc, argv)
{
struct tcltkip *master = get_ip(interp);
struct tcltkip *slave = ALLOC(struct tcltkip);
- /* struct tcltkip *slave = (struct tcltkip *)ckalloc(sizeof(struct tcltkip)); */
+ /* struct tcltkip *slave = RbTk_ALLOC_N(struct tcltkip, 1); */
VALUE safemode;
VALUE name;
int safe;
@@ -6408,7 +6397,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;
}
@@ -6515,7 +6503,6 @@ ip_create_slave(argc, argv, self)
}
if (Tcl_IsSafe(master->ip) != 1
&& (safemode == Qfalse || NIL_P(safemode))) {
- rb_secure(4);
}
StringValue(name);
@@ -6722,7 +6709,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)) {
@@ -6928,22 +6914,22 @@ get_obj_from_str(str)
StringValue(enc);
if (strcmp(RSTRING_PTR(enc), "binary") == 0) {
/* binary string */
- return Tcl_NewByteArrayObj((const unsigned char *)s, RSTRING_LEN(str));
+ return Tcl_NewByteArrayObj((const unsigned char *)s, RSTRING_LENINT(str));
} else {
/* text string */
- return Tcl_NewStringObj(s, RSTRING_LEN(str));
+ return Tcl_NewStringObj(s, RSTRING_LENINT(str));
}
#ifdef HAVE_RUBY_ENCODING_H
} else if (rb_enc_get_index(str) == ENCODING_INDEX_BINARY) {
/* binary string */
- return Tcl_NewByteArrayObj((const unsigned char *)s, RSTRING_LEN(str));
+ return Tcl_NewByteArrayObj((const unsigned char *)s, RSTRING_LENINT(str));
#endif
} else if (memchr(s, 0, RSTRING_LEN(str))) {
/* probably binary string */
- return Tcl_NewByteArrayObj((const unsigned char *)s, RSTRING_LEN(str));
+ return Tcl_NewByteArrayObj((const unsigned char *)s, RSTRING_LENINT(str));
} else {
/* probably text string */
- return Tcl_NewStringObj(s, RSTRING_LEN(str));
+ return Tcl_NewStringObj(s, RSTRING_LENINT(str));
}
#endif
}
@@ -7006,13 +6992,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;
}
@@ -7061,11 +7042,7 @@ 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());
#if CONTROL_BY_STATUS_OF_RB_THREAD_WAITING_FOR_VALUE
@@ -7149,7 +7126,7 @@ tk_funcall(func, argc, argv, obj)
/* allocate memory (argv cross over thread : must be in heap) */
if (argv) {
/* VALUE *temp = ALLOC_N(VALUE, argc); */
- VALUE *temp = (VALUE*)ckalloc(sizeof(VALUE) * argc);
+ VALUE *temp = RbTk_ALLOC_N(VALUE, argc);
#if 0 /* use Tcl_Preserve/Release */
Tcl_Preserve((ClientData)temp); /* XXXXXXXX */
#endif
@@ -7159,7 +7136,7 @@ tk_funcall(func, argc, argv, obj)
/* allocate memory (keep result) */
/* alloc_done = (int*)ALLOC(int); */
- alloc_done = (int*)ckalloc(sizeof(int));
+ alloc_done = RbTk_ALLOC_N(int, 1);
#if 0 /* use Tcl_Preserve/Release */
Tcl_Preserve((ClientData)alloc_done); /* XXXXXXXX */
#endif
@@ -7167,7 +7144,7 @@ tk_funcall(func, argc, argv, obj)
/* allocate memory (freed by Tcl_ServiceEvent) */
/* callq = (struct call_queue *)Tcl_Alloc(sizeof(struct call_queue)); */
- callq = (struct call_queue *)ckalloc(sizeof(struct call_queue));
+ callq = RbTk_ALLOC_N(struct call_queue, 1);
#if 0 /* use Tcl_Preserve/Release */
Tcl_Preserve(callq);
#endif
@@ -7502,13 +7479,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;
}
@@ -7561,11 +7533,7 @@ 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());
#if CONTROL_BY_STATUS_OF_RB_THREAD_WAITING_FOR_VALUE
@@ -7632,7 +7600,7 @@ ip_eval(self, str)
} else {
DUMP2("eval from current eventloop %lx", current);
}
- result = ip_eval_real(self, RSTRING_PTR(str), RSTRING_LEN(str));
+ result = ip_eval_real(self, RSTRING_PTR(str), RSTRING_LENINT(str));
if (rb_obj_is_kind_of(result, rb_eException)) {
rb_exc_raise(result);
}
@@ -7646,14 +7614,14 @@ ip_eval(self, str)
/* allocate memory (keep result) */
/* alloc_done = (int*)ALLOC(int); */
- alloc_done = (int*)ckalloc(sizeof(int));
+ alloc_done = RbTk_ALLOC_N(int, 1);
#if 0 /* use Tcl_Preserve/Release */
Tcl_Preserve((ClientData)alloc_done); /* XXXXXXXX */
#endif
*alloc_done = 0;
/* eval_str = ALLOC_N(char, RSTRING_LEN(str) + 1); */
- eval_str = ckalloc(sizeof(char) * (RSTRING_LEN(str) + 1));
+ eval_str = ckalloc(RSTRING_LENINT(str) + 1);
#if 0 /* use Tcl_Preserve/Release */
Tcl_Preserve((ClientData)eval_str); /* XXXXXXXX */
#endif
@@ -7662,7 +7630,7 @@ ip_eval(self, str)
/* allocate memory (freed by Tcl_ServiceEvent) */
/* evq = (struct eval_queue *)Tcl_Alloc(sizeof(struct eval_queue)); */
- evq = (struct eval_queue *)ckalloc(sizeof(struct eval_queue));
+ evq = RbTk_ALLOC_N(struct eval_queue, 1);
#if 0 /* use Tcl_Preserve/Release */
Tcl_Preserve(evq);
#endif
@@ -7673,7 +7641,7 @@ ip_eval(self, str)
/* construct event data */
evq->done = alloc_done;
evq->str = eval_str;
- evq->len = RSTRING_LEN(str);
+ evq->len = RSTRING_LENINT(str);
evq->interp = ip_obj;
evq->result = result;
evq->thread = current;
@@ -7775,6 +7743,8 @@ ip_cancel_eval_core(interp, msg, flag)
#if TCL_MAJOR_VERSION < 8 || (TCL_MAJOR_VERSION == 8 && TCL_MINOR_VERSION < 6)
rb_raise(rb_eNotImpError,
"cancel_eval is supported Tcl/Tk8.6 or later.");
+
+ UNREACHABLE;
#else
Tcl_Obj *msg_obj;
@@ -7842,7 +7812,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 */
@@ -7900,7 +7869,6 @@ lib_restart(self)
{
struct tcltkip *ptr = get_ip(self);
- rb_secure(4);
tcl_stubs_check();
@@ -7919,7 +7887,6 @@ ip_restart(self)
{
struct tcltkip *ptr = get_ip(self);
- rb_secure(4);
tcl_stubs_check();
@@ -7944,7 +7911,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);
@@ -7961,15 +7930,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
}
}
@@ -8055,14 +8028,14 @@ lib_toUTF8_core(ip_obj, src, encodename)
return str;
}
buf = ALLOC_N(char, RSTRING_LEN(str)+1);
- /* buf = ckalloc(sizeof(char) * (RSTRING_LEN(str)+1)); */
+ /* buf = ckalloc(sizeof(char) * (RSTRING_LENINT(str)+1)); */
memcpy(buf, RSTRING_PTR(str), RSTRING_LEN(str));
buf[RSTRING_LEN(str)] = 0;
Tcl_DStringInit(&dstr);
Tcl_DStringFree(&dstr);
/* Tcl_ExternalToUtfDString(encoding,buf,strlen(buf),&dstr); */
- Tcl_ExternalToUtfDString(encoding, buf, RSTRING_LEN(str), &dstr);
+ Tcl_ExternalToUtfDString(encoding, buf, RSTRING_LENINT(str), &dstr);
/* str = rb_tainted_str_new2(Tcl_DStringValue(&dstr)); */
/* str = rb_str_new2(Tcl_DStringValue(&dstr)); */
@@ -8210,7 +8183,7 @@ lib_fromUTF8_core(ip_obj, src, encodename)
int len;
StringValue(str);
- tclstr = Tcl_NewStringObj(RSTRING_PTR(str), RSTRING_LEN(str));
+ tclstr = Tcl_NewStringObj(RSTRING_PTR(str), RSTRING_LENINT(str));
Tcl_IncrRefCount(tclstr);
s = (char*)Tcl_GetByteArrayFromObj(tclstr, &len);
str = rb_tainted_str_new(s, len);
@@ -8246,14 +8219,14 @@ lib_fromUTF8_core(ip_obj, src, encodename)
}
buf = ALLOC_N(char, RSTRING_LEN(str)+1);
- /* buf = ckalloc(sizeof(char) * (RSTRING_LEN(str)+1)); */
+ /* buf = ckalloc(sizeof(char) * (RSTRING_LENINT(str)+1)); */
memcpy(buf, RSTRING_PTR(str), RSTRING_LEN(str));
buf[RSTRING_LEN(str)] = 0;
Tcl_DStringInit(&dstr);
Tcl_DStringFree(&dstr);
/* Tcl_UtfToExternalDString(encoding,buf,strlen(buf),&dstr); */
- Tcl_UtfToExternalDString(encoding,buf,RSTRING_LEN(str),&dstr);
+ Tcl_UtfToExternalDString(encoding,buf,RSTRING_LENINT(str),&dstr);
/* str = rb_tainted_str_new2(Tcl_DStringValue(&dstr)); */
/* str = rb_str_new2(Tcl_DStringValue(&dstr)); */
@@ -8342,7 +8315,7 @@ lib_UTF_backslash_core(self, str, all_bs)
rb_thread_critical = Qtrue;
/* src_buf = ALLOC_N(char, RSTRING_LEN(str)+1); */
- src_buf = ckalloc(sizeof(char) * (RSTRING_LEN(str)+1));
+ src_buf = ckalloc(RSTRING_LENINT(str)+1);
#if 0 /* use Tcl_Preserve/Release */
Tcl_Preserve((ClientData)src_buf); /* XXXXXXXX */
#endif
@@ -8350,7 +8323,7 @@ lib_UTF_backslash_core(self, str, all_bs)
src_buf[RSTRING_LEN(str)] = 0;
/* dst_buf = ALLOC_N(char, RSTRING_LEN(str)+1); */
- dst_buf = ckalloc(sizeof(char) * (RSTRING_LEN(str)+1));
+ dst_buf = ckalloc(RSTRING_LENINT(str)+1);
#if 0 /* use Tcl_Preserve/Release */
Tcl_Preserve((ClientData)dst_buf); /* XXXXXXXX */
#endif
@@ -8487,7 +8460,7 @@ invoke_tcl_proc(arg)
if (!inf->cmdinfo.isNativeObjectProc) {
/* string interface */
/* argv = (char **)ALLOC_N(char *, argc+1);*/ /* XXXXXXXXXX */
- argv = (char **)ckalloc(sizeof(char *)*(argc+1));
+ argv = RbTk_ALLOC_N(char *, (argc+1));
#if 0 /* use Tcl_Preserve/Release */
Tcl_Preserve((ClientData)argv); /* XXXXXXXX */
#endif
@@ -8561,7 +8534,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;
@@ -8633,7 +8605,7 @@ ip_invoke_core(interp, argc, argv)
#if TCL_MAJOR_VERSION >= 8
/* unknown_objv = (Tcl_Obj **)ALLOC_N(Tcl_Obj *, objc+2); */
- unknown_objv = (Tcl_Obj **)ckalloc(sizeof(Tcl_Obj *) * (objc+2));
+ unknown_objv = RbTk_ALLOC_N(Tcl_Obj *, (objc+2));
#if 0 /* use Tcl_Preserve/Release */
Tcl_Preserve((ClientData)unknown_objv); /* XXXXXXXX */
#endif
@@ -8644,7 +8616,7 @@ ip_invoke_core(interp, argc, argv)
objv = unknown_objv;
#else
/* unknown_argv = (char **)ALLOC_N(char *, argc+2); */
- unknown_argv = (char **)ckalloc(sizeof(char *) * (argc+2));
+ unknown_argv = RbTk_ALLOC_N(char *, (argc+2));
#if 0 /* use Tcl_Preserve/Release */
Tcl_Preserve((ClientData)unknown_argv); /* XXXXXXXX */
#endif
@@ -8673,7 +8645,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())) {
@@ -8701,7 +8673,7 @@ ip_invoke_core(interp, argc, argv)
/* string interface */
/* argv = (char **)ALLOC_N(char *, argc+1); */
- argv = (char **)ckalloc(sizeof(char *) * (argc+1));
+ argv = RbTk_ALLOC_N(char *, (argc+1));
#if 0 /* use Tcl_Preserve/Release */
Tcl_Preserve((ClientData)argv); /* XXXXXXXX */
#endif
@@ -8846,7 +8818,7 @@ alloc_invoke_arguments(argc, argv)
/* memory allocation */
#if TCL_MAJOR_VERSION >= 8
/* av = ALLOC_N(Tcl_Obj *, argc+1);*/ /* XXXXXXXXXX */
- av = (Tcl_Obj**)ckalloc(sizeof(Tcl_Obj *)*(argc+1));
+ av = RbTk_ALLOC_N(Tcl_Obj *, (argc+1));
#if 0 /* use Tcl_Preserve/Release */
Tcl_Preserve((ClientData)av); /* XXXXXXXX */
#endif
@@ -8859,7 +8831,7 @@ alloc_invoke_arguments(argc, argv)
#else /* TCL_MAJOR_VERSION < 8 */
/* string interface */
/* av = ALLOC_N(char *, argc+1); */
- av = (char**)ckalloc(sizeof(char *) * (argc+1));
+ av = RbTk_ALLOC_N(char *, (argc+1));
#if 0 /* use Tcl_Preserve/Release */
Tcl_Preserve((ClientData)av); /* XXXXXXXX */
#endif
@@ -8992,13 +8964,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;
}
@@ -9046,11 +9013,7 @@ 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());
#if CONTROL_BY_STATUS_OF_RB_THREAD_WAITING_FOR_VALUE
@@ -9139,7 +9102,7 @@ ip_invoke_with_position(argc, argv, obj, position)
/* allocate memory (keep result) */
/* alloc_done = (int*)ALLOC(int); */
- alloc_done = (int*)ckalloc(sizeof(int));
+ alloc_done = RbTk_ALLOC_N(int, 1);
#if 0 /* use Tcl_Preserve/Release */
Tcl_Preserve((ClientData)alloc_done); /* XXXXXXXX */
#endif
@@ -9147,7 +9110,7 @@ ip_invoke_with_position(argc, argv, obj, position)
/* allocate memory (freed by Tcl_ServiceEvent) */
/* ivq = (struct invoke_queue *)Tcl_Alloc(sizeof(struct invoke_queue)); */
- ivq = (struct invoke_queue *)ckalloc(sizeof(struct invoke_queue));
+ ivq = RbTk_ALLOC_N(struct invoke_queue, 1);
#if 0 /* use Tcl_Preserve/Release */
Tcl_Preserve((ClientData)ivq); /* XXXXXXXX */
#endif
@@ -9282,7 +9245,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);
}
@@ -9869,7 +9831,7 @@ lib_merge_tklist(argc, argv, obj)
/* based on Tcl/Tk's Tcl_Merge() */
/* flagPtr = ALLOC_N(int, argc); */
- flagPtr = (int *)ckalloc(sizeof(int) * argc);
+ flagPtr = RbTk_ALLOC_N(int, argc);
#if 0 /* use Tcl_Preserve/Release */
Tcl_Preserve((ClientData)flagPtr); /* XXXXXXXXXX */
#endif
@@ -9880,7 +9842,7 @@ lib_merge_tklist(argc, argv, obj)
if (OBJ_TAINTED(argv[num])) taint_flag = 1;
dst = StringValuePtr(argv[num]);
#if TCL_MAJOR_VERSION >= 8
- len += Tcl_ScanCountedElement(dst, RSTRING_LEN(argv[num]),
+ len += Tcl_ScanCountedElement(dst, RSTRING_LENINT(argv[num]),
&flagPtr[num]) + 1;
#else /* TCL_MAJOR_VERSION < 8 */
len += Tcl_ScanElement(dst, &flagPtr[num]) + 1;
@@ -9897,7 +9859,7 @@ lib_merge_tklist(argc, argv, obj)
for(num = 0; num < argc; num++) {
#if TCL_MAJOR_VERSION >= 8
len = Tcl_ConvertCountedElement(RSTRING_PTR(argv[num]),
- RSTRING_LEN(argv[num]),
+ RSTRING_LENINT(argv[num]),
dst, flagPtr[num]);
#else /* TCL_MAJOR_VERSION < 8 */
len = Tcl_ConvertElement(RSTRING_PTR(argv[num]), dst, flagPtr[num]);
@@ -9961,10 +9923,10 @@ lib_conv_listelement(self, src)
StringValue(src);
#if TCL_MAJOR_VERSION >= 8
- len = Tcl_ScanCountedElement(RSTRING_PTR(src), RSTRING_LEN(src),
+ len = Tcl_ScanCountedElement(RSTRING_PTR(src), RSTRING_LENINT(src),
&scan_flag);
dst = rb_str_new(0, len + 1);
- len = Tcl_ConvertCountedElement(RSTRING_PTR(src), RSTRING_LEN(src),
+ len = Tcl_ConvertCountedElement(RSTRING_PTR(src), RSTRING_LENINT(src),
RSTRING_PTR(dst), scan_flag);
#else /* TCL_MAJOR_VERSION < 8 */
len = Tcl_ScanElement(RSTRING_PTR(src), &scan_flag);
@@ -10008,6 +9970,8 @@ lib_get_reltype_name(self)
default:
rb_raise(rb_eRuntimeError, "tcltklib has invalid release type number");
}
+
+ UNREACHABLE;
}
@@ -10015,8 +9979,8 @@ static VALUE
tcltklib_compile_info()
{
volatile VALUE ret;
- int size;
- char form[]
+ size_t size;
+ static CONST char form[]
= "tcltklib %s :: Ruby%s (%s) %s pthread :: Tcl%s(%s)/Tk%s(%s) %s";
char *info;
@@ -10084,7 +10048,6 @@ create_dummy_encoding_for_tk_core(interp, name, error_mode)
{
get_ip(interp);
- rb_secure(4);
StringValue(name);
@@ -10111,6 +10074,8 @@ create_dummy_encoding_for_tk_core(interp, name, error_mode)
return Qnil;
}
}
+
+ UNREACHABLE;
#else
return name;
#endif
@@ -10540,7 +10505,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);
@@ -10576,7 +10540,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;
}
@@ -10886,7 +10849,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");
diff --git a/ext/tk/tkutil/tkutil.c b/ext/tk/tkutil/tkutil.c
index 2f92b334bb..fd8972645a 100644
--- a/ext/tk/tkutil/tkutil.c
+++ b/ext/tk/tkutil/tkutil.c
@@ -12,7 +12,7 @@
#include "ruby.h"
#ifdef RUBY_VM
-static VALUE rb_thread_critical; /* dummy */
+static int rb_thread_critical; /* dummy */
#else
/* On Ruby 1.8.x, use rb_thread_critical (defined at rubysig.h) */
#include "rubysig.h"
@@ -202,8 +202,8 @@ tk_uninstall_cmd(self, cmd_id)
VALUE self;
VALUE cmd_id;
{
- int head_len = strlen(cmd_id_head);
- int prefix_len = strlen(cmd_id_prefix);
+ size_t head_len = strlen(cmd_id_head);
+ size_t prefix_len = strlen(cmd_id_prefix);
StringValue(cmd_id);
if (strncmp(cmd_id_head, RSTRING_PTR(cmd_id), head_len) != 0) {
@@ -266,7 +266,6 @@ to_strkey(key, value, hash)
VALUE value;
VALUE hash;
{
- if (key == Qundef) return ST_CONTINUE;
rb_hash_aset(hash, rb_funcall(key, ID_to_s, 0, 0), value);
return ST_CHECK;
}
@@ -278,9 +277,9 @@ tk_symbolkey2str(self, keys)
{
volatile VALUE new_keys = rb_hash_new();
- if NIL_P(keys) return new_keys;
+ if (NIL_P(keys)) return new_keys;
keys = rb_convert_type(keys, T_HASH, "Hash", "to_hash");
- st_foreach(RHASH_TBL(keys), to_strkey, new_keys);
+ st_foreach_check(RHASH_TBL(keys), to_strkey, new_keys, Qundef);
return new_keys;
}
@@ -298,7 +297,8 @@ ary2list(ary, enc_flag, self)
VALUE enc_flag;
VALUE self;
{
- int idx, idx2, size, size2, req_chk_flag;
+ long idx, idx2, size, size2;
+ int req_chk_flag;
volatile VALUE val, val2, str_val;
volatile VALUE dst;
volatile VALUE sys_enc, dst_enc, str_enc;
@@ -309,7 +309,7 @@ ary2list(ary, enc_flag, self)
sys_enc = rb_funcall(sys_enc, ID_to_s, 0, 0);
}
- if NIL_P(enc_flag) {
+ 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) {
@@ -451,18 +451,19 @@ ary2list2(ary, enc_flag, self)
VALUE enc_flag;
VALUE self;
{
- int idx, size, req_chk_flag;
+ long idx, size;
+ int req_chk_flag;
volatile VALUE val, str_val;
volatile VALUE dst;
volatile VALUE sys_enc, dst_enc, str_enc;
sys_enc = rb_funcall(cTclTkLib, ID_encoding, 0, 0);
- if NIL_P(sys_enc) {
+ if (NIL_P(sys_enc)) {
sys_enc = rb_funcall(cTclTkLib, ID_encoding_system, 0, 0);
sys_enc = rb_funcall(sys_enc, ID_to_s, 0, 0);
}
- if NIL_P(enc_flag) {
+ 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) {
@@ -551,7 +552,7 @@ assoc2kv(assoc, ary, self)
VALUE ary;
VALUE self;
{
- int i, j, len;
+ long i, j, len;
volatile VALUE pair;
volatile VALUE val;
volatile VALUE dst = rb_ary_new2(2 * RARRAY_LEN(assoc));
@@ -599,7 +600,7 @@ assoc2kv_enc(assoc, ary, self)
VALUE ary;
VALUE self;
{
- int i, j, len;
+ long i, j, len;
volatile VALUE pair;
volatile VALUE val;
volatile VALUE dst = rb_ary_new2(2 * RARRAY_LEN(assoc));
@@ -651,7 +652,6 @@ push_kv(key, val, args)
ary = RARRAY_PTR(args)[0];
- if (key == Qundef) return ST_CONTINUE;
#if 0
rb_ary_push(ary, key2keyname(key));
if (val != TK_None) rb_ary_push(ary, val);
@@ -674,7 +674,7 @@ hash2kv(hash, ary, self)
volatile VALUE dst = rb_ary_new2(2 * RHASH_SIZE(hash));
volatile VALUE args = rb_ary_new3(2, dst, self);
- st_foreach(RHASH_TBL(hash), push_kv, args);
+ st_foreach_check(RHASH_TBL(hash), push_kv, args, Qundef);
if (NIL_P(ary)) {
return dst;
@@ -693,7 +693,6 @@ push_kv_enc(key, val, args)
ary = RARRAY_PTR(args)[0];
- if (key == Qundef) return ST_CONTINUE;
#if 0
rb_ary_push(ary, key2keyname(key));
if (val != TK_None) {
@@ -719,7 +718,7 @@ hash2kv_enc(hash, ary, self)
volatile VALUE dst = rb_ary_new2(2 * RHASH_SIZE(hash));
volatile VALUE args = rb_ary_new3(2, dst, self);
- st_foreach(RHASH_TBL(hash), push_kv_enc, args);
+ st_foreach_check(RHASH_TBL(hash), push_kv_enc, args, Qundef);
if (NIL_P(ary)) {
return dst;
@@ -801,6 +800,8 @@ tk_hash_kv(argc, argv, self)
}
rb_raise(rb_eArgError, "Hash is expected for 1st argument");
}
+
+ UNREACHABLE;
}
static VALUE
@@ -896,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;
}
@@ -935,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;
@@ -1079,7 +1080,7 @@ tkstr_to_str(value)
VALUE value;
{
char * ptr;
- int len;
+ long len;
ptr = RSTRING_PTR(value);
len = RSTRING_LEN(value);
@@ -1133,8 +1134,8 @@ tcl2rb_num_or_nil(self, value)
#define CBSUBST_TBL_MAX (256)
struct cbsubst_info {
- int full_subst_length;
- int keylen[CBSUBST_TBL_MAX];
+ long full_subst_length;
+ long keylen[CBSUBST_TBL_MAX];
char *key[CBSUBST_TBL_MAX];
char type[CBSUBST_TBL_MAX];
ID ivar[CBSUBST_TBL_MAX];
@@ -1246,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);
@@ -1258,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);
@@ -1298,9 +1299,10 @@ cbsubst_sym_to_subst(self, sym)
VALUE sym;
{
struct cbsubst_info *inf;
- const char *str;
+ VALUE str;
char *buf, *ptr;
- int idx, len;
+ int idx;
+ long len;
ID id;
volatile VALUE ret;
@@ -1310,12 +1312,12 @@ cbsubst_sym_to_subst(self, sym)
struct cbsubst_info, inf);
if (!NIL_P(ret = rb_hash_aref(inf->aliases, sym))) {
- str = rb_id2name(SYM2ID(ret));
+ str = rb_id2str(SYM2ID(ret));
} else {
- str = rb_id2name(SYM2ID(sym));
+ str = rb_id2str(SYM2ID(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;
@@ -1352,9 +1354,10 @@ cbsubst_get_subst_arg(argc, argv, self)
VALUE self;
{
struct cbsubst_info *inf;
- const char *str;
+ VALUE str;
char *buf, *ptr;
- int i, idx, len;
+ int i, idx;
+ long len;
ID id;
volatile VALUE arg_sym, ret;
@@ -1366,28 +1369,28 @@ 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 = ID2SYM(rb_intern_str(argv[i]));
break;
case T_SYMBOL:
arg_sym = argv[i];
- str = rb_id2name(SYM2ID(arg_sym));
+ str = rb_id2str(SYM2ID(arg_sym));
break;
default:
rb_raise(rb_eArgError, "arg #%d is not a String or a Symbol", i);
}
if (!NIL_P(ret = rb_hash_aref(inf->aliases, arg_sym))) {
- str = rb_id2name(SYM2ID(ret));
+ str = rb_id2str(SYM2ID(ret));
}
- 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;
}
if (idx >= CBSUBST_TBL_MAX) {
- rb_raise(rb_eArgError, "cannot find attribute :%s", str);
+ rb_raise(rb_eArgError, "cannot find attribute :%"PRIsVALUE, str);
}
*(ptr++) = '%';
@@ -1422,7 +1425,8 @@ cbsubst_get_subst_key(self, str)
volatile VALUE list;
volatile VALUE ret;
VALUE keyval;
- int i, len, keylen, idx;
+ long i, len, keylen;
+ int idx;
char *buf, *ptr, *key;
list = rb_funcall(cTclTkLib, ID_split_tklist, 1, str);
@@ -1473,7 +1477,8 @@ cbsubst_get_all_subst_keys(self)
struct cbsubst_info *inf;
char *buf, *ptr;
char *keys_buf, *keys_ptr;
- int idx, len;
+ int idx;
+ long len;
volatile VALUE ret;
Data_Get_Struct(rb_const_get(self, ID_SUBST_INFO),
@@ -1525,7 +1530,7 @@ cbsubst_table_setup(argc, argv, self)
VALUE inf;
ID id;
struct cbsubst_info *subst_inf;
- int idx, len;
+ long idx, len;
unsigned char chr;
/* accept (key_inf, proc_inf) or (key_inf, longkey_inf, procinf) */
@@ -1567,7 +1572,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);
}
@@ -1606,7 +1611,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);
}
@@ -1646,10 +1651,10 @@ cbsubst_scan_args(self, arg_key, val_ary)
VALUE val_ary;
{
struct cbsubst_info *inf;
- int idx;
+ long idx;
unsigned char *keyptr = (unsigned char*)RSTRING_PTR(arg_key);
- int keylen = RSTRING_LEN(arg_key);
- int vallen = RARRAY_LEN(val_ary);
+ long keylen = RSTRING_LEN(arg_key);
+ long vallen = RARRAY_LEN(val_ary);
unsigned char type_chr;
volatile VALUE dst = rb_ary_new2(vallen);
volatile VALUE proc;
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 f18cec5749..4d7d4887a5 100644
--- a/ext/dl/win32/lib/Win32API.rb
+++ b/ext/win32/lib/Win32API.rb
@@ -7,6 +7,7 @@ require 'dl'
class Win32API
DLL = {}
TYPEMAP = {"0" => DL::TYPE_VOID, "S" => DL::TYPE_VOIDP, "I" => DL::TYPE_LONG}
+ POINTER_TYPE = DL::SIZEOF_VOIDP == DL::SIZEOF_LONG_LONG ? 'q*' : 'l!*'
def initialize(dllname, func, import, export = "0", calltype = :stdcall)
@proto = [import].join.tr("VPpNnLlIi", "0SSI").sub(/^(.)0*$/, '\1')
@@ -19,7 +20,7 @@ class Win32API
def call(*args)
import = @proto.split("")
args.each_with_index do |x, i|
- args[i], = [x == 0 ? nil : x].pack("p").unpack("l!*") if import[i] == "S"
+ args[i], = [x == 0 ? nil : x].pack("p").unpack(POINTER_TYPE) if import[i] == "S"
args[i], = [x].pack("I").unpack("i") if import[i] == "I"
end
ret, = @func.call(args)
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/extconf.rb b/ext/win32ole/extconf.rb
index c3717316d4..52c3d6bdfb 100644
--- a/ext/win32ole/extconf.rb
+++ b/ext/win32ole/extconf.rb
@@ -23,6 +23,14 @@ def create_win32ole_makefile
unless have_type("IMultiLanguage2", "mlang.h")
have_type("IMultiLanguage", "mlang.h")
end
+ spec = nil
+ checking_for('thread_specific', '%s') do
+ spec = %w[__declspec(thread) __thread].find {|th|
+ try_compile("#{th} int foo;", "", :werror => true)
+ }
+ spec or 'no'
+ end
+ $defs << "-DRB_THREAD_SPECIFIC=#{spec}" if spec
create_makefile("win32ole")
end
end
@@ -30,6 +38,7 @@ end
case RUBY_PLATFORM
when /mswin/
- $CFLAGS += ' /W3'
+ $CFLAGS.sub!(/((?:\A|\s)[-\/])W\d(?=\z|\s)/, '\1W3') or
+ $CFLAGS += ' -W3'
end
create_win32ole_makefile
diff --git a/ext/win32ole/lib/win32ole.rb b/ext/win32ole/lib/win32ole.rb
deleted file mode 100644
index aaf7e7cdcf..0000000000
--- a/ext/win32ole/lib/win32ole.rb
+++ /dev/null
@@ -1,22 +0,0 @@
-require 'win32ole.so'
-
-# re-define Thread#initialize
-# bug #2618(ruby-core:27634)
-
-class Thread
- alias :org_initialize :initialize
- def initialize(*arg, &block)
- if block
- org_initialize(*arg) {
- WIN32OLE.ole_initialize
- begin
- block.call(*arg)
- ensure
- WIN32OLE.ole_uninitialize
- end
- }
- else
- org_initialize(*arg)
- end
- end
-end
diff --git a/ext/win32ole/win32ole.c b/ext/win32ole/win32ole.c
index acc2fea39d..45bd923057 100644
--- a/ext/win32ole/win32ole.c
+++ b/ext/win32ole/win32ole.c
@@ -143,7 +143,7 @@ const IID IID_IMultiLanguage2 = {0xDCCFC164, 0x2B38, 0x11d2, {0xB7, 0xEC, 0x00,
#define WC2VSTR(x) ole_wc2vstr((x), TRUE)
-#define WIN32OLE_VERSION "1.5.3"
+#define WIN32OLE_VERSION "1.5.5"
typedef HRESULT (STDAPICALLTYPE FNCOCREATEINSTANCEEX)
(REFCLSID, IUnknown*, DWORD, COSERVERINFO*, DWORD, MULTI_QI*);
@@ -214,7 +214,17 @@ VALUE cWIN32OLE_PROPERTY;
static VALUE ary_ole_event;
static ID id_events;
-static BOOL g_ole_initialized = FALSE;
+#if defined(RB_THREAD_SPECIFIC) && (defined(__CYGWIN__) || defined(__MINGW32__))
+static RB_THREAD_SPECIFIC BOOL g_ole_initialized;
+# define g_ole_initialized_init() ((void)0)
+# define g_ole_initialized_set(val) (g_ole_initialized = (val))
+#else
+static volatile DWORD g_ole_initialized_key = TLS_OUT_OF_INDEXES;
+# define g_ole_initialized (BOOL)TlsGetValue(g_ole_initialized_key)
+# 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;
static HINSTANCE ghhctrl = NULL;
@@ -309,8 +319,8 @@ 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();
-static void ole_msg_loop();
+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);
@@ -370,9 +380,7 @@ static BOOL CALLBACK installed_lcid_proc(LPTSTR str);
static BOOL lcid_installed(LCID lcid);
static VALUE fole_s_set_locale(VALUE self, VALUE vlcid);
static VALUE fole_s_create_guid(VALUE self);
-static void ole_pure_initialize();
static VALUE fole_s_ole_initialize(VALUE self);
-static void ole_pure_uninitialize();
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);
@@ -508,7 +516,7 @@ 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 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);
@@ -572,10 +580,11 @@ 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();
+static VALUE evs_length(void);
static void olevariant_free(struct olevariantdata *pvar);
static VALUE folevariant_s_allocate(VALUE klass);
static VALUE folevariant_s_array(VALUE klass, VALUE dims, VALUE vvt);
+static void check_type_val2variant(VALUE val);
static VALUE folevariant_initialize(VALUE self, VALUE args);
static long *ary2safe_array_index(int ary_size, VALUE *ary, SAFEARRAY *psa);
static void unlock_safe_array(SAFEARRAY *psa);
@@ -586,8 +595,8 @@ 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();
-static void free_enc2cp();
+static void init_enc2cp(void);
+static void free_enc2cp(void);
static HRESULT (STDMETHODCALLTYPE mf_QueryInterface)(
IMessageFilter __RPC_FAR * This,
@@ -756,8 +765,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;
}
@@ -777,17 +788,18 @@ 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;
}
@@ -1056,7 +1068,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;
@@ -1068,7 +1080,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)) {
@@ -1080,17 +1092,29 @@ 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 char *
+ole_alloc_str(UINT size, void *arg)
+{
+ return ALLOC_N(char, size + 1);
+}
+
+static char *
+ole_wc2mb(LPWSTR pw)
+{
+ return ole_wc2mb_alloc(pw, ole_alloc_str, NULL);
+}
+
static VALUE
ole_hresult2msg(HRESULT hr)
{
@@ -1163,7 +1187,7 @@ ole_excepinfo2msg(EXCEPINFO *pExInfo)
}
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);
@@ -1201,29 +1225,36 @@ ole_raise(HRESULT hr, VALUE ecs, const char *fmt, ...)
}
void
-ole_uninitialize()
+ole_uninitialize(void)
{
+ if (!g_ole_initialized) return;
OleUninitialize();
- g_ole_initialized = FALSE;
+ g_ole_initialized_set(FALSE);
}
static void
-ole_initialize()
+ole_uninitialize_hook(rb_event_flag_t evflag, VALUE data, VALUE self, ID mid, VALUE klass)
+{
+ ole_uninitialize();
+}
+
+static void
+ole_initialize(void)
{
HRESULT hr;
+ if(!g_uninitialize_hooked) {
+ rb_add_event_hook(ole_uninitialize_hook, RUBY_EVENT_THREAD_END, Qnil);
+ g_uninitialize_hooked = TRUE;
+ }
+
if(g_ole_initialized == FALSE) {
hr = OleInitialize(NULL);
if(FAILED(hr)) {
ole_raise(hr, rb_eRuntimeError, "fail: OLE initialize");
}
- g_ole_initialized = TRUE;
- /*
- * In some situation, OleUninitialize does not work fine. ;-<
- */
- /*
- atexit((void (*)(void))ole_uninitialize);
- */
+ g_ole_initialized_set(TRUE);
+
hr = CoRegisterMessageFilter(&imessage_filter, &previous_filter);
if(FAILED(hr)) {
previous_filter = NULL;
@@ -1296,7 +1327,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) ||
@@ -1368,14 +1399,22 @@ ole_mb2wc(char *pm, int len)
return pw;
}
+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);
+}
+
static 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;
}
@@ -1816,14 +1855,18 @@ ole_set_byref(VARIANT *realvar, VARIANT *var, VARTYPE vt)
V_R8REF(var) = &V_R8(realvar);
break;
-#if (_MSC_VER >= 1300)
+#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;
@@ -2179,8 +2222,10 @@ ole_variant2val(VARIANT *pvar)
#if (_MSC_VER >= 1300) || defined(__CYGWIN__) || defined(__MINGW32__)
case VT_I8:
if(V_ISBYREF(pvar))
-#if (_MSC_VER >= 1300)
+#if (_MSC_VER >= 1300) || defined(__CYGWIN__) || defined(__MINGW32__)
+#ifdef V_I8REF
obj = I8_2_NUM(*V_I8REF(pvar));
+#endif
#else
obj = Qnil;
#endif
@@ -2189,8 +2234,10 @@ ole_variant2val(VARIANT *pvar)
break;
case VT_UI8:
if(V_ISBYREF(pvar))
-#if (_MSC_VER >= 1300)
+#if (_MSC_VER >= 1300) || defined(__CYGWIN__) || defined(__MINGW32__)
+#ifdef V_UI8REF
obj = UI8_2_NUM(*V_UI8REF(pvar));
+#endif
#else
obj = Qnil;
#endif
@@ -2702,7 +2749,6 @@ fole_s_connect(int argc, VALUE *argv, VALUE self)
void *p;
IUnknown *pUnknown;
- rb_secure(4);
/* initialize to use OLE */
ole_initialize();
@@ -2786,7 +2832,6 @@ 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 &&
@@ -2849,7 +2894,6 @@ ole_types_from_typelib(ITypeLib *pTypeLib, VALUE classes)
ITypeInfo *pTypeInfo;
VALUE type;
- rb_secure(4);
count = pTypeLib->lpVtbl->GetTypeInfoCount(pTypeLib);
for (i = 0; i < count; i++) {
hr = pTypeLib->lpVtbl->GetDocumentation(pTypeLib, i,
@@ -3133,25 +3177,11 @@ fole_s_create_guid(VALUE self)
* You must not use thease method.
*/
-static void ole_pure_initialize()
-{
- HRESULT hr;
- hr = OleInitialize(NULL);
- if(FAILED(hr)) {
- ole_raise(hr, rb_eRuntimeError, "fail: OLE initialize");
- }
-}
-
-static void ole_pure_uninitialize()
-{
- OleUninitialize();
-}
-
/* :nodoc */
static VALUE
fole_s_ole_initialize(VALUE self)
{
- ole_pure_initialize();
+ ole_initialize();
return Qnil;
}
@@ -3159,7 +3189,7 @@ fole_s_ole_initialize(VALUE self)
static VALUE
fole_s_ole_uninitialize(VALUE self)
{
- ole_pure_uninitialize();
+ ole_uninitialize();
return Qnil;
}
@@ -3227,7 +3257,6 @@ 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);
@@ -3955,7 +3984,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;
@@ -4068,20 +4096,27 @@ 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);
}
}
@@ -4160,7 +4195,6 @@ ole_methods_sub(ITypeInfo *pOwnerTypeInfo, ITypeInfo *pTypeInfo, VALUE methods,
HRESULT hr;
TYPEATTR *pTypeAttr;
BSTR bstr;
- char *pstr;
FUNCDESC *pFuncDesc;
VALUE method;
WORD i;
@@ -4169,7 +4203,6 @@ ole_methods_sub(ITypeInfo *pOwnerTypeInfo, ITypeInfo *pTypeInfo, VALUE methods,
ole_raise(hr, eWIN32OLERuntimeError, "failed to GetTypeAttr");
}
for(i = 0; i < pTypeAttr->cFuncs; i++) {
- pstr = NULL;
hr = pTypeInfo->lpVtbl->GetFuncDesc(pTypeInfo, i, &pFuncDesc);
if (FAILED(hr))
continue;
@@ -4518,7 +4551,6 @@ 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)");
}
@@ -5278,7 +5310,7 @@ foletypelib_name(VALUE self)
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);
+ return name;
}
/*
@@ -5433,7 +5465,7 @@ foletypelib_path(VALUE self)
pTypeLib->lpVtbl->ReleaseTLibAttr(pTypeLib, pTLibAttr);
path = WC2VSTR(bstr);
- return rb_enc_str_new(StringValuePtr(path), strlen(StringValuePtr(path)), cWIN32OLE_enc);
+ return path;
}
/*
@@ -5743,7 +5775,7 @@ ole_type_visible(ITypeInfo *pTypeInfo)
/*
* call-seq:
- * WIN32OLE_TYPE#visible #=> true or false
+ * 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')
@@ -6119,7 +6151,6 @@ ole_variables(ITypeInfo *pTypeInfo)
WORD i;
UINT len;
BSTR bstr;
- char *pstr;
VARDESC *pVarDesc;
struct olevariabledata *pvar;
VALUE var;
@@ -6134,7 +6165,6 @@ ole_variables(ITypeInfo *pTypeInfo)
if(FAILED(hr))
continue;
len = 0;
- pstr = NULL;
hr = pTypeInfo->lpVtbl->GetNames(pTypeInfo, pVarDesc->memid, &bstr,
1, &len);
if(FAILED(hr) || len == 0 || !bstr)
@@ -6917,7 +6947,7 @@ folemethod_event_interface(VALUE self)
return Qnil;
}
-static VALUE
+static HRESULT
ole_method_docinfo_from_type(
ITypeInfo *pTypeInfo,
UINT method_index,
@@ -7653,11 +7683,9 @@ static long
ole_search_event_at(VALUE ary, VALUE ev)
{
VALUE event;
- VALUE def_event;
VALUE event_name;
long i, len;
long ret = -1;
- def_event = Qnil;
len = RARRAY_LEN(ary);
for(i = 0; i < len; i++) {
event = rb_ary_entry(ary, i);
@@ -8294,7 +8322,6 @@ ev_advise(int argc, VALUE *argv, VALUE self)
struct oleeventdata *poleev;
void *p;
- rb_secure(4);
rb_scan_args(argc, argv, "11", &ole, &itf);
if (!rb_obj_is_kind_of(ole, cWIN32OLE)) {
@@ -8502,7 +8529,6 @@ 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) {
@@ -8570,7 +8596,7 @@ evs_entry(long i)
}
static VALUE
-evs_length()
+evs_length(void)
{
return rb_funcall(ary_ole_event, rb_intern("length"), 0);
}
@@ -8719,6 +8745,38 @@ folevariant_s_array(VALUE klass, VALUE elems, VALUE vvt)
return obj;
}
+static void
+check_type_val2variant(VALUE val)
+{
+ VALUE elem;
+ int len = 0;
+ int i = 0;
+ if(!rb_obj_is_kind_of(val, cWIN32OLE) &&
+ !rb_obj_is_kind_of(val, cWIN32OLE_VARIANT) &&
+ !rb_obj_is_kind_of(val, rb_cTime)) {
+ switch (TYPE(val)) {
+ case T_ARRAY:
+ len = RARRAY_LEN(val);
+ for(i = 0; i < len; i++) {
+ elem = rb_ary_entry(val, i);
+ check_type_val2variant(elem);
+ }
+ break;
+ case T_STRING:
+ case T_FIXNUM:
+ case T_BIGNUM:
+ case T_FLOAT:
+ case T_TRUE:
+ case T_FALSE:
+ case T_NIL:
+ break;
+ default:
+ rb_raise(rb_eTypeError, "can not convert WIN32OLE_VARIANT from type %s",
+ rb_obj_classname(val));
+ }
+ }
+}
+
/*
* call-seq:
* WIN32OLE_VARIANT.new(val, vartype) #=> WIN32OLE_VARIANT object.
@@ -8754,24 +8812,7 @@ folevariant_initialize(VALUE self, VALUE args)
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));
- }
- }
+ check_type_val2variant(val);
Data_Get_Struct(self, struct olevariantdata, pvar);
if (len == 1) {
@@ -9062,20 +9103,21 @@ folevariant_set_value(VALUE self, VALUE val)
}
static void
-init_enc2cp()
+init_enc2cp(void)
{
enc2cp_table = st_init_numtable();
}
static void
-free_enc2cp()
+free_enc2cp(void)
{
st_free_table(enc2cp_table);
}
void
-Init_win32ole()
+Init_win32ole(void)
{
+ g_ole_initialized_init();
ary_ole_event = rb_ary_new();
rb_gc_register_mark_object(ary_ole_event);
id_events = rb_intern("events");
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/extconf.rb b/ext/zlib/extconf.rb
index a61ebae327..b4348ceca7 100644
--- a/ext/zlib/extconf.rb
+++ b/ext/zlib/extconf.rb
@@ -15,7 +15,7 @@ if %w'z libz zlib1 zlib zdll zlibwapi'.find {|z| have_library(z, 'deflateReset')
defines = []
- message 'checking for kind of operating system... '
+ Logging::message 'checking for kind of operating system... '
os_code = with_config('os-code') ||
case RUBY_PLATFORM.split('-',2)[1]
when 'amigaos' then
@@ -50,7 +50,7 @@ if %w'z libz zlib1 zlib zdll zlibwapi'.find {|z| have_library(z, 'deflateReset')
unless OS_NAMES.key? os_code then
raise "invalid OS_CODE `#{os_code}'"
end
- message "#{OS_NAMES[os_code]}\n"
+ Logging::message "#{OS_NAMES[os_code]}\n"
defines << "OS_CODE=#{os_code}"
$defs.concat(defines.collect{|d|' -D'+d})
diff --git a/ext/zlib/zlib.c b/ext/zlib/zlib.c
index d5909d60c0..df2a2501b2 100644
--- a/ext/zlib/zlib.c
+++ b/ext/zlib/zlib.c
@@ -10,6 +10,7 @@
#include <zlib.h>
#include <time.h>
#include <ruby/io.h>
+#include <ruby/thread.h>
#ifdef HAVE_VALGRIND_MEMCHECK_H
# include <valgrind/memcheck.h>
@@ -20,8 +21,8 @@
# define VALGRIND_MAKE_MEM_UNDEFINED(p, n) VALGRIND_MAKE_WRITABLE((p), (n))
# endif
#else
-# define VALGRIND_MAKE_MEM_DEFINED(p, n) /* empty */
-# define VALGRIND_MAKE_MEM_UNDEFINED(p, n) /* empty */
+# define VALGRIND_MAKE_MEM_DEFINED(p, n) 0
+# define VALGRIND_MAKE_MEM_UNDEFINED(p, n) 0
#endif
#define RUBY_ZLIB_VERSION "0.6.0"
@@ -56,6 +57,8 @@ max_uint(long n)
#define sizeof(x) ((int)sizeof(x))
+static ID id_dictionaries;
+
/*--------- Prototypes --------*/
static NORETURN(void raise_zlib_error(int, const char*));
@@ -70,6 +73,7 @@ static void finalizer_warn(const char*);
struct zstream;
struct zstream_funcs;
+struct zstream_run_args;
static void zstream_init(struct zstream*, const struct zstream_funcs*);
static void zstream_expand_buffer(struct zstream*);
static void zstream_expand_buffer_into(struct zstream*, unsigned long);
@@ -222,9 +226,50 @@ static VALUE rb_gzreader_readlines(int, VALUE*, VALUE);
/*
* Document-module: Zlib
*
- * == Overview
+ * This module provides access to the {zlib library}[http://zlib.net]. Zlib is
+ * designed to be a portable, free, general-purpose, legally unencumbered --
+ * that is, not covered by any patents -- lossless data-compression library
+ * for use on virtually any computer hardware and operating system.
+ *
+ * The zlib compression library provides in-memory compression and
+ * decompression functions, including integrity checks of the uncompressed
+ * data.
+ *
+ * The zlib compressed data format is described in RFC 1950, which is a
+ * wrapper around a deflate stream which is described in RFC 1951.
+ *
+ * The library also supports reading and writing files in gzip (.gz) format
+ * with an interface similar to that of IO. The gzip format is described in
+ * RFC 1952 which is also a wrapper around a deflate stream.
+ *
+ * The zlib format was designed to be compact and fast for use in memory and on
+ * communications channels. The gzip format was designed for single-file
+ * compression on file systems, has a larger header than zlib to maintain
+ * directory information, and uses a different, slower check method than zlib.
+ *
+ * See your system's zlib.h for further information about zlib
+ *
+ * == Sample usage
*
- * Access to the zlib library.
+ * Using the wrapper to compress strings with default parameters is quite
+ * simple:
+ *
+ * require "zlib"
+ *
+ * data_to_compress = File.read("don_quixote.txt")
+ *
+ * puts "Input size: #{data_to_compress.size}"
+ * #=> Input size: 2347740
+ *
+ * data_compressed = Zlib::Deflate.deflate(data_to_compress)
+ *
+ * puts "Compressed size: #{data_compressed.size}"
+ * #=> Compressed size: 887238
+ *
+ * uncompressed_data = Zlib::Inflate.inflate(data_compressed)
+ *
+ * puts "Uncompressed data is: #{uncompressed_data}"
+ * #=> Uncompressed data is: The Project Gutenberg EBook of Don Quixote...
*
* == Class tree
*
@@ -249,8 +294,6 @@ static VALUE rb_gzreader_readlines(int, VALUE*, VALUE);
* - Zlib::GzipFile::CRCError
* - Zlib::GzipFile::NoFooter
*
- * see also zlib.h
- *
*/
void Init_zlib(void);
@@ -502,16 +545,22 @@ struct zstream {
#define ZSTREAM_FLAG_IN_STREAM 0x2
#define ZSTREAM_FLAG_FINISHED 0x4
#define ZSTREAM_FLAG_CLOSING 0x8
-#define ZSTREAM_FLAG_UNUSED 0x10
+#define ZSTREAM_FLAG_GZFILE 0x10 /* disallows yield from expand_buffer for
+ gzip*/
+#define ZSTREAM_FLAG_UNUSED 0x20
#define ZSTREAM_READY(z) ((z)->flags |= ZSTREAM_FLAG_READY)
#define ZSTREAM_IS_READY(z) ((z)->flags & ZSTREAM_FLAG_READY)
#define ZSTREAM_IS_FINISHED(z) ((z)->flags & ZSTREAM_FLAG_FINISHED)
#define ZSTREAM_IS_CLOSING(z) ((z)->flags & ZSTREAM_FLAG_CLOSING)
+#define ZSTREAM_IS_GZFILE(z) ((z)->flags & ZSTREAM_FLAG_GZFILE)
+
+#define ZSTREAM_EXPAND_BUFFER_OK 0
/* I think that more better value should be found,
but I gave up finding it. B) */
#define ZSTREAM_INITIAL_BUFSIZE 1024
+/* Allow a quick return when the thread is interrupted */
#define ZSTREAM_AVAIL_OUT_STEP_MAX 16384
#define ZSTREAM_AVAIL_OUT_STEP_MIN 2048
@@ -523,6 +572,13 @@ static const struct zstream_funcs inflate_funcs = {
inflateReset, inflateEnd, inflate,
};
+struct zstream_run_args {
+ struct zstream * z;
+ int flush; /* stream flush value for inflate() or deflate() */
+ int interrupt; /* stop processing the stream and return to ruby */
+ int jump_state; /* for buffer expansion block break or exception */
+ int stream_output; /* for streaming zlib processing */
+};
static voidpf
zlib_mem_alloc(voidpf opaque, uInt items, uInt size)
@@ -532,7 +588,7 @@ zlib_mem_alloc(voidpf opaque, uInt items, uInt size)
deflate is performing a conditional jump that depends on an
uninitialized value. Isn't that a bug?
http://www.zlib.net/zlib_faq.html#faq36 */
- VALGRIND_MAKE_MEM_DEFINED(p, items * size);
+ (void)VALGRIND_MAKE_MEM_DEFINED(p, items * size);
return p;
}
@@ -566,33 +622,50 @@ zstream_init(struct zstream *z, const struct zstream_funcs *func)
static void
zstream_expand_buffer(struct zstream *z)
{
- long inc;
-
if (NIL_P(z->buf)) {
- /* I uses rb_str_new here not rb_str_buf_new because
- rb_str_buf_new makes a zero-length string. */
- z->buf = rb_str_new(0, ZSTREAM_INITIAL_BUFSIZE);
- z->buf_filled = 0;
- z->stream.next_out = (Bytef*)RSTRING_PTR(z->buf);
- z->stream.avail_out = ZSTREAM_INITIAL_BUFSIZE;
- RBASIC(z->buf)->klass = 0;
+ zstream_expand_buffer_into(z, ZSTREAM_INITIAL_BUFSIZE);
return;
}
- if (RSTRING_LEN(z->buf) - z->buf_filled >= ZSTREAM_AVAIL_OUT_STEP_MAX) {
- /* to keep other threads from freezing */
- z->stream.avail_out = ZSTREAM_AVAIL_OUT_STEP_MAX;
+ if (!ZSTREAM_IS_GZFILE(z) && rb_block_given_p()) {
+ if (z->buf_filled >= ZSTREAM_AVAIL_OUT_STEP_MAX) {
+ int state = 0;
+ VALUE self = (VALUE)z->stream.opaque;
+
+ rb_str_resize(z->buf, z->buf_filled);
+ rb_obj_reveal(z->buf, rb_cString);
+ OBJ_INFECT(z->buf, self);
+
+ rb_protect(rb_yield, z->buf, &state);
+
+ z->buf = Qnil;
+ zstream_expand_buffer_into(z, ZSTREAM_AVAIL_OUT_STEP_MAX);
+
+ if (state)
+ rb_jump_tag(state);
+
+ return;
+ }
+ else {
+ zstream_expand_buffer_into(z,
+ ZSTREAM_AVAIL_OUT_STEP_MAX - z->buf_filled);
+ }
}
else {
- inc = z->buf_filled / 2;
- if (inc < ZSTREAM_AVAIL_OUT_STEP_MIN) {
- inc = ZSTREAM_AVAIL_OUT_STEP_MIN;
+ if (RSTRING_LEN(z->buf) - z->buf_filled >= ZSTREAM_AVAIL_OUT_STEP_MAX) {
+ z->stream.avail_out = ZSTREAM_AVAIL_OUT_STEP_MAX;
}
- rb_str_resize(z->buf, z->buf_filled + inc);
- z->stream.avail_out = (inc < ZSTREAM_AVAIL_OUT_STEP_MAX) ?
- (int)inc : ZSTREAM_AVAIL_OUT_STEP_MAX;
+ else {
+ long inc = z->buf_filled / 2;
+ if (inc < ZSTREAM_AVAIL_OUT_STEP_MIN) {
+ inc = ZSTREAM_AVAIL_OUT_STEP_MIN;
+ }
+ rb_str_resize(z->buf, z->buf_filled + inc);
+ z->stream.avail_out = (inc < ZSTREAM_AVAIL_OUT_STEP_MAX) ?
+ (int)inc : ZSTREAM_AVAIL_OUT_STEP_MAX;
+ }
+ z->stream.next_out = (Bytef*)RSTRING_PTR(z->buf) + z->buf_filled;
}
- z->stream.next_out = (Bytef*)RSTRING_PTR(z->buf) + z->buf_filled;
}
static void
@@ -605,7 +678,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);
@@ -614,6 +687,50 @@ zstream_expand_buffer_into(struct zstream *z, unsigned long size)
}
}
+static void *
+zstream_expand_buffer_protect(void *ptr)
+{
+ struct zstream *z = (struct zstream *)ptr;
+ int state = 0;
+
+ rb_protect((VALUE (*)(VALUE))zstream_expand_buffer, (VALUE)z, &state);
+
+ return (void *)(VALUE)state;
+}
+
+static int
+zstream_expand_buffer_without_gvl(struct zstream *z)
+{
+ char * new_str;
+ long inc, len;
+
+ if (RSTRING_LEN(z->buf) - z->buf_filled >= ZSTREAM_AVAIL_OUT_STEP_MAX) {
+ z->stream.avail_out = ZSTREAM_AVAIL_OUT_STEP_MAX;
+ }
+ else {
+ inc = z->buf_filled / 2;
+ if (inc < ZSTREAM_AVAIL_OUT_STEP_MIN) {
+ inc = ZSTREAM_AVAIL_OUT_STEP_MIN;
+ }
+
+ len = z->buf_filled + inc;
+
+ new_str = ruby_xrealloc(RSTRING(z->buf)->as.heap.ptr, len + 1);
+
+ /* from rb_str_resize */
+ RSTRING(z->buf)->as.heap.ptr = new_str;
+ RSTRING(z->buf)->as.heap.ptr[len] = '\0'; /* sentinel */
+ RSTRING(z->buf)->as.heap.len =
+ RSTRING(z->buf)->as.heap.aux.capa = len;
+
+ z->stream.avail_out = (inc < ZSTREAM_AVAIL_OUT_STEP_MAX) ?
+ (int)inc : ZSTREAM_AVAIL_OUT_STEP_MAX;
+ }
+ z->stream.next_out = (Bytef*)RSTRING_PTR(z->buf) + z->buf_filled;
+
+ return ZSTREAM_EXPAND_BUFFER_OK;
+}
+
static void
zstream_append_buffer(struct zstream *z, const Bytef *src, long len)
{
@@ -623,7 +740,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;
}
@@ -650,7 +767,14 @@ zstream_append_buffer(struct zstream *z, const Bytef *src, long len)
static VALUE
zstream_detach_buffer(struct zstream *z)
{
- VALUE dst;
+ VALUE dst, self = (VALUE)z->stream.opaque;
+
+ if (!ZSTREAM_IS_FINISHED(z) && !ZSTREAM_IS_GZFILE(z) &&
+ rb_block_given_p()) {
+ /* prevent tiny yields mid-stream, save for next
+ * zstream_expand_buffer() or stream end */
+ return Qnil;
+ }
if (NIL_P(z->buf)) {
dst = rb_str_new(0, 0);
@@ -658,13 +782,21 @@ 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);
+
z->buf = Qnil;
z->buf_filled = 0;
z->stream.next_out = 0;
z->stream.avail_out = 0;
+
+ if (!ZSTREAM_IS_GZFILE(z) && rb_block_given_p()) {
+ rb_yield(dst);
+ dst = Qnil;
+ }
+
return dst;
}
@@ -679,7 +811,7 @@ zstream_shift_buffer(struct zstream *z, long len)
}
dst = rb_str_subseq(z->buf, 0, len);
- RBASIC(dst)->klass = rb_cString;
+ rb_obj_reveal(dst, rb_cString);
z->buf_filled -= len;
memmove(RSTRING_PTR(z->buf), RSTRING_PTR(z->buf) + len,
z->buf_filled);
@@ -734,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);
@@ -783,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;
}
@@ -830,13 +962,83 @@ zstream_end(struct zstream *z)
return Qnil;
}
+static void *
+zstream_run_func(void *ptr)
+{
+ struct zstream_run_args *args = (struct zstream_run_args *)ptr;
+ int err, state, flush = args->flush;
+ struct zstream *z = args->z;
+ uInt n;
+
+ err = Z_OK;
+ while (!args->interrupt) {
+ n = z->stream.avail_out;
+ err = z->func->run(&z->stream, flush);
+ z->buf_filled += n - z->stream.avail_out;
+
+ if (err == Z_STREAM_END) {
+ z->flags &= ~ZSTREAM_FLAG_IN_STREAM;
+ z->flags |= ZSTREAM_FLAG_FINISHED;
+ break;
+ }
+
+ if (err != Z_OK && err != Z_BUF_ERROR)
+ break;
+
+ if (z->stream.avail_out > 0) {
+ z->flags |= ZSTREAM_FLAG_IN_STREAM;
+ break;
+ }
+
+ if (z->stream.avail_in == 0 && z->func == &inflate_funcs) {
+ /* break here because inflate() return Z_BUF_ERROR when avail_in == 0. */
+ /* but deflate() could be called with avail_in == 0 (there's hidden buffer
+ in zstream->state) */
+ z->flags |= ZSTREAM_FLAG_IN_STREAM;
+ break;
+ }
+
+ if (args->stream_output) {
+ state = (int)(VALUE)rb_thread_call_with_gvl(zstream_expand_buffer_protect,
+ (void *)z);
+ } else {
+ state = zstream_expand_buffer_without_gvl(z);
+ }
+
+ if (state) {
+ err = Z_OK; /* buffer expanded but stream processing was stopped */
+ args->jump_state = state;
+ break;
+ }
+ }
+
+ return (void *)(VALUE)err;
+}
+
+/*
+ * There is no safe way to interrupt z->run->func().
+ */
+static void
+zstream_unblock_func(void *ptr)
+{
+ struct zstream_run_args *args = (struct zstream_run_args *)ptr;
+
+ args->interrupt = 1;
+}
+
static void
zstream_run(struct zstream *z, Bytef *src, long len, int flush)
{
- uInt n;
+ struct zstream_run_args args;
int err;
volatile VALUE guard = Qnil;
+ args.z = z;
+ args.flush = flush;
+ args.interrupt = 0;
+ args.jump_state = 0;
+ args.stream_output = !ZSTREAM_IS_GZFILE(z) && rb_block_given_p();
+
if (NIL_P(z->input) && len == 0) {
z->stream.next_in = (Bytef*)"";
z->stream.avail_in = 0;
@@ -855,50 +1057,48 @@ zstream_run(struct zstream *z, Bytef *src, long len, int flush)
zstream_expand_buffer(z);
}
- for (;;) {
- /* VC allocates err and guard to same address. accessing err and guard
- in same scope prevents it. */
- RB_GC_GUARD(guard);
- n = z->stream.avail_out;
- err = z->func->run(&z->stream, flush);
- z->buf_filled += n - z->stream.avail_out;
- rb_thread_schedule();
+loop:
+ err = (int)(VALUE)rb_thread_call_without_gvl(zstream_run_func, (void *)&args,
+ zstream_unblock_func, (void *)&args);
- if (err == Z_STREAM_END) {
- z->flags &= ~ZSTREAM_FLAG_IN_STREAM;
- z->flags |= ZSTREAM_FLAG_FINISHED;
- break;
+ if (flush != Z_FINISH && err == Z_BUF_ERROR
+ && z->stream.avail_out > 0) {
+ z->flags |= ZSTREAM_FLAG_IN_STREAM;
+ }
+
+ zstream_reset_input(z);
+
+ if (err != Z_OK && err != Z_STREAM_END) {
+ if (z->stream.avail_in > 0) {
+ zstream_append_input(z, z->stream.next_in, z->stream.avail_in);
}
- if (err != Z_OK) {
- if (flush != Z_FINISH && err == Z_BUF_ERROR
- && z->stream.avail_out > 0) {
- z->flags |= ZSTREAM_FLAG_IN_STREAM;
- break;
+ if (err == Z_NEED_DICT) {
+ VALUE self = (VALUE)z->stream.opaque;
+ if (self) {
+ VALUE dicts = rb_ivar_get(self, id_dictionaries);
+ VALUE dict = rb_hash_aref(dicts, rb_uint2inum(z->stream.adler));
+ if (!NIL_P(dict)) {
+ rb_inflate_set_dictionary(self, dict);
+ goto loop;
+ }
}
- zstream_reset_input(z);
- if (z->stream.avail_in > 0) {
- zstream_append_input(z, z->stream.next_in, z->stream.avail_in);
- }
- raise_zlib_error(err, z->stream.msg);
- }
- if (z->stream.avail_out > 0) {
- z->flags |= ZSTREAM_FLAG_IN_STREAM;
- break;
}
- zstream_expand_buffer(z);
+ raise_zlib_error(err, z->stream.msg);
}
- zstream_reset_input(z);
if (z->stream.avail_in > 0) {
zstream_append_input(z, z->stream.next_in, z->stream.avail_in);
- guard = Qnil; /* prevent tail call to make guard effective */
+ RB_GC_GUARD(guard) = Qnil; /* prevent tail call to make guard effective */
}
+
+ if (args.jump_state)
+ rb_jump_tag(args.jump_state);
}
static VALUE
zstream_sync(struct zstream *z, Bytef *src, long len)
{
- VALUE rest;
+ /* VALUE rest; */
int err;
if (!NIL_P(z->input)) {
@@ -913,7 +1113,7 @@ zstream_sync(struct zstream *z, Bytef *src, long len)
}
zstream_reset_input(z);
if (err != Z_DATA_ERROR) {
- rest = rb_str_new((char*)z->stream.next_in, z->stream.avail_in);
+ /* rest = rb_str_new((char*)z->stream.next_in, z->stream.avail_in); */
raise_zlib_error(err, z->stream.msg);
}
}
@@ -928,7 +1128,7 @@ zstream_sync(struct zstream *z, Bytef *src, long len)
return Qtrue;
}
if (err != Z_DATA_ERROR) {
- rest = rb_str_new((char*)z->stream.next_in, z->stream.avail_in);
+ /* rest = rb_str_new((char*)z->stream.next_in, z->stream.avail_in); */
raise_zlib_error(err, z->stream.msg);
}
return Qfalse;
@@ -969,6 +1169,7 @@ zstream_new(VALUE klass, const struct zstream_funcs *funcs)
obj = Data_Make_Struct(klass, struct zstream,
zstream_mark, zstream_free, z);
zstream_init(z, funcs);
+ z->stream.opaque = (voidpf)obj;
return obj;
}
@@ -1074,24 +1275,28 @@ rb_zstream_reset(VALUE obj)
}
/*
- * Finishes the stream and flushes output buffer. See Zlib::Deflate#finish and
- * Zlib::Inflate#finish for details of this behavior.
+ * call-seq:
+ * finish -> String
+ * finish { |chunk| ... } -> nil
+ *
+ * Finishes the stream and flushes output buffer. If a block is given each
+ * chunk is yielded to the block until the input buffer has been flushed to
+ * the output buffer.
*/
static VALUE
rb_zstream_finish(VALUE obj)
{
struct zstream *z = get_zstream(obj);
- VALUE dst;
zstream_run(z, (Bytef*)"", 0, Z_FINISH);
- dst = zstream_detach_buffer(z);
- OBJ_INFECT(dst, obj);
- return dst;
+ return zstream_detach_buffer(z);
}
/*
- * Flushes input buffer and returns all data in that buffer.
+ * call-seq:
+ * flush_next_in -> input
+ *
*/
static VALUE
rb_zstream_flush_next_in(VALUE obj)
@@ -1106,18 +1311,22 @@ 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)
{
struct zstream *z;
- VALUE dst;
Data_Get_Struct(obj, struct zstream, z);
- dst = zstream_detach_buffer(z);
- OBJ_INFECT(dst, obj);
- return dst;
+
+ return zstream_detach_buffer(z);
}
/*
@@ -1247,60 +1456,73 @@ rb_deflate_s_allocate(VALUE klass)
/*
* Document-method: Zlib::Deflate.new
*
- * call-seq: Zlib::Deflate.new(level=nil, windowBits=nil, memlevel=nil, strategy=nil)
+ * call-seq:
+ * Zlib::Deflate.new(level=DEFAULT_COMPRESSION, window_bits=MAX_WBITS, mem_level=DEF_MEM_LEVEL, strategy=DEFAULT_STRATEGY)
+ *
+ * Creates a new deflate stream for compression. If a given argument is nil,
+ * 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
+ * defined to make code more readable:
*
- * == Arguments
+ * * Zlib::NO_COMPRESSION = 0
+ * * Zlib::BEST_SPEED = 1
+ * * Zlib::DEFAULT_COMPRESSION = 6
+ * * Zlib::BEST_COMPRESSION = 9
*
- * +level+::
- * An Integer compression level between
- * BEST_SPEED and BEST_COMPRESSION
- * +windowBits+::
- * An Integer for the windowBits size. Should be
- * in the range 8..15, larger values of this parameter
- * result in better at the expense of memory usage.
- * +memlevel+::
- * Specifies how much memory should be allocated for
- * the internal compression state.
- * Between DEF_MEM_LEVEL and MAX_MEM_LEVEL
- * +strategy+::
- * A parameter to tune the compression algorithm. Use the
- * DEFAULT_STRATEGY for normal data, FILTERED for data produced by a
- * filter (or predictor), HUFFMAN_ONLY to force Huffman encoding only (no
- * string match).
+ * 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
+ * the expense of memory usage.
*
- * == Description
+ * The +mem_level+ specifies how much memory should be allocated for the
+ * internal compression state. 1 uses minimum memory but is slow and reduces
+ * compression ratio while 9 uses maximum memory for optimal speed. The
+ * default value is 8. Two constants are defined:
*
- * Creates a new deflate stream for compression. See zlib.h for details of
- * each argument. If an argument is nil, the default value of that argument is
- * used.
+ * * Zlib::DEF_MEM_LEVEL
+ * * Zlib::MAX_MEM_LEVEL
*
+ * The +strategy+ sets the deflate compression strategy. The following
+ * strategies are available:
*
- * == examples
+ * Zlib::DEFAULT_STRATEGY:: For normal data
+ * Zlib::FILTERED:: For data produced by a filter or predictor
+ * Zlib::FIXED:: Prevents dynamic Huffman codes
+ * Zlib::HUFFMAN_ONLY:: Prevents string matching
+ * Zlib::RLE:: Designed for better compression of PNG image data
*
- * === basic
+ * See the constants for further description.
*
- * f = File.new("compressed.file","w+")
- * #=> #<File:compressed.file>
- * f << Zlib::Deflate.new().deflate(File.read("big.file"))
- * #=> #<File:compressed.file>
- * f.close
- * #=> nil
+ * == Examples
*
- * === a little more robust
+ * === Basic
*
- * compressed_file = File.open("compressed.file", "w+")
- * #=> #<File:compressed.file>
- * zd = Zlib::Deflate.new(Zlib::BEST_COMPRESSION, 15, Zlib::MAX_MEM_LEVEL, Zlib::HUFFMAN_ONLY)
- * #=> #<Zlib::Deflate:0x000000008610a0>
- * compressed_file << zd.deflate(File.read("big.file"))
- * #=> "\xD4z\xC6\xDE\b\xA1K\x1Ej\x8A ..."
- * compressed_file.close
- * #=> nil
- * zd.close
- * #=> nil
+ * open "compressed.file", "w+" do |io|
+ * io << Zlib::Deflate.new.deflate(File.read("big.file"))
+ * end
*
- * (while this example will work, for best optimization the flags need to be reviewed for your specific function)
+ * === Custom compression
+ *
+ * open "compressed.file", "w+" do |compressed_io|
+ * deflate = Zlib::Deflate.new(Zlib::BEST_COMPRESSION,
+ * Zlib::MAX_WBITS,
+ * Zlib::MAX_MEM_LEVEL,
+ * Zlib::HUFFMAN_ONLY)
+ *
+ * begin
+ * open "big.file" do |big_io|
+ * until big_io.eof? do
+ * compressed_io << zd.deflate(big_io.read(16384))
+ * end
+ * end
+ * ensure
+ * deflate.close
+ * end
+ * end
*
+ * While this example will work, for best optimization review the flags for
+ * your specific time, memory usage and output space requirements.
*/
static VALUE
rb_deflate_initialize(int argc, VALUE *argv, VALUE obj)
@@ -1362,19 +1584,19 @@ deflate_run(VALUE args)
/*
* Document-method: Zlib::Deflate.deflate
*
- * call-seq: Zlib.deflate(string[, level])
- * Zlib::Deflate.deflate(string[, level])
+ * call-seq:
+ * Zlib.deflate(string[, level])
+ * Zlib::Deflate.deflate(string[, level])
*
* Compresses the given +string+. Valid values of level are
- * <tt>NO_COMPRESSION</tt>, <tt>BEST_SPEED</tt>,
- * <tt>BEST_COMPRESSION</tt>, <tt>DEFAULT_COMPRESSION</tt>, and an
- * integer from 0 to 9 (the default is 6).
+ * Zlib::NO_COMPRESSION, Zlib::BEST_SPEED, Zlib::BEST_COMPRESSION,
+ * Zlib::DEFAULT_COMPRESSION, or an integer from 0 to 9 (the default is 6).
*
* This method is almost equivalent to the following code:
*
* def deflate(string, level)
* z = Zlib::Deflate.new(level)
- * dst = z.deflate(string, Zlib::NO_FLUSH)
+ * dst = z.deflate(string, Zlib::FINISH)
* z.close
* dst
* end
@@ -1422,55 +1644,46 @@ do_deflate(struct zstream *z, VALUE src, int flush)
}
/*
- * Document-method: Zlib.deflate
- *
- * call-seq: deflate(string[, flush])
- *
- * == Arguments
+ * Document-method: Zlib::Deflate#deflate
*
- * +string+::
- * String
- *
- * +flush+::
- * Integer representing a flush code. Either NO_FLUSH,
- * SYNC_FLUSH, FULL_FLUSH, or FINISH. See zlib.h for details.
- * Normally the parameter flush is set to Z_NO_FLUSH, which allows deflate to
- * decide how much data to accumulate before producing output, in order to
- * maximize compression.
- *
- * == Description
+ * call-seq:
+ * z.deflate(string, flush = Zlib::NO_FLUSH) -> String
+ * z.deflate(string, flush = Zlib::NO_FLUSH) { |chunk| ... } -> nil
*
* Inputs +string+ into the deflate stream and returns the output from the
* stream. On calling this method, both the input and the output buffers of
- * the stream are flushed.
- *
- * If +string+ is nil, this method finishes the
+ * the stream are flushed. If +string+ is nil, this method finishes the
* stream, just like Zlib::ZStream#finish.
*
- * == Usage
+ * If a block is given consecutive deflated chunks from the +string+ are
+ * yielded to the block and +nil+ is returned.
+ *
+ * The +flush+ parameter specifies the flush mode. The following constants
+ * may be used:
*
- * comp = Zlib.deflate(File.read("big.file"))
- * or
- * comp = Zlib.deflate(File.read("big.file"), Zlib::FULL_FLUSH)
+ * Zlib::NO_FLUSH:: The default
+ * Zlib::SYNC_FLUSH:: Flushes the output to a byte boundary
+ * Zlib::FULL_FLUSH:: SYNC_FLUSH + resets the compression state
+ * Zlib::FINISH:: Pending input is processed, pending output is flushed.
+ *
+ * See the constants for further description.
*
*/
static VALUE
rb_deflate_deflate(int argc, VALUE *argv, VALUE obj)
{
struct zstream *z = get_zstream(obj);
- VALUE src, flush, dst;
+ VALUE src, flush;
rb_scan_args(argc, argv, "11", &src, &flush);
OBJ_INFECT(obj, src);
do_deflate(z, src, ARG_FLUSH(flush));
- dst = zstream_detach_buffer(z);
- OBJ_INFECT(dst, obj);
- return dst;
+ return zstream_detach_buffer(z);
}
/*
- * Document-method: Zlib::Deflate.<<
+ * Document-method: Zlib::Deflate#<<
*
* call-seq: << string
*
@@ -1489,20 +1702,23 @@ rb_deflate_addstr(VALUE obj, VALUE src)
/*
* Document-method: Zlib::Deflate#flush
*
- * call-seq: flush(flush)
+ * call-seq:
+ * flush(flush = Zlib::SYNC_FLUSH) -> String
+ * flush(flush = Zlib::SYNC_FLUSH) { |chunk| ... } -> nil
*
- * This method is equivalent to <tt>deflate('', flush)</tt>. If flush is omitted,
- * <tt>SYNC_FLUSH</tt> is used as flush. This method is just provided
- * to improve the readability of your Ruby program.
- *
- * Please visit your zlib.h for a deeper detail on NO_FLUSH, SYNC_FLUSH, FULL_FLUSH, and FINISH
+ * This method is equivalent to <tt>deflate('', flush)</tt>. This method is
+ * just provided to improve the readability of your Ruby program. If a block
+ * is given chunks of deflate output are yielded to the block until the buffer
+ * is flushed.
*
+ * See Zlib::Deflate#deflate for detail on the +flush+ constants NO_FLUSH,
+ * SYNC_FLUSH, FULL_FLUSH and FINISH.
*/
static VALUE
rb_deflate_flush(int argc, VALUE *argv, VALUE obj)
{
struct zstream *z = get_zstream(obj);
- VALUE v_flush, dst;
+ VALUE v_flush;
int flush;
rb_scan_args(argc, argv, "01", &v_flush);
@@ -1510,10 +1726,8 @@ rb_deflate_flush(int argc, VALUE *argv, VALUE obj)
if (flush != Z_NO_FLUSH) { /* prevent Z_BUF_ERROR */
zstream_run(z, (Bytef*)"", 0, flush);
}
- dst = zstream_detach_buffer(z);
- OBJ_INFECT(dst, obj);
- return dst;
+ return zstream_detach_buffer(z);
}
/*
@@ -1521,18 +1735,11 @@ rb_deflate_flush(int argc, VALUE *argv, VALUE obj)
*
* call-seq: params(level, strategy)
*
- * Changes the parameters of the deflate stream. See zlib.h for details. The
- * output from the stream by changing the params is preserved in output
- * buffer.
+ * Changes the parameters of the deflate stream to allow changes between
+ * different types of data that require different types of compression. Any
+ * unprocessed data is flushed before changing the params.
*
- * +level+::
- * An Integer compression level between
- * BEST_SPEED and BEST_COMPRESSION
- * +strategy+::
- * A parameter to tune the compression algorithm. Use the
- * DEFAULT_STRATEGY for normal data, FILTERED for data produced by a
- * filter (or predictor), HUFFMAN_ONLY to force Huffman encoding only (no
- * string match).
+ * See Zlib::Deflate.new for a description of +level+ and +strategy+.
*
*/
static VALUE
@@ -1606,52 +1813,57 @@ rb_deflate_set_dictionary(VALUE obj, VALUE dic)
* dup) itself.
*/
-
-
static VALUE
rb_inflate_s_allocate(VALUE klass)
{
- return zstream_inflate_new(klass);
+ VALUE inflate = zstream_inflate_new(klass);
+ rb_ivar_set(inflate, id_dictionaries, rb_hash_new());
+ return inflate;
}
/*
* Document-method: Zlib::Inflate.new
*
- * call-seq: Zlib::Inflate.new(window_bits)
- *
- * == Arguments
+ * call-seq:
+ * Zlib::Inflate.new(window_bits = Zlib::MAX_WBITS)
*
- * +windowBits+::
- * An Integer for the windowBits size. Should be
- * in the range 8..15, larger values of this parameter
- * result in better at the expense of memory usage.
+ * Creates a new inflate stream for decompression. +window_bits+ sets the
+ * size of the history buffer and can have the following values:
*
- * == Description
+ * 0::
+ * Have inflate use the window size from the zlib header of the compressed
+ * stream.
*
- * Creates a new inflate stream for decompression. See zlib.h for details
- * of the argument. If +window_bits+ is +nil+, the default value is used.
+ * (8..15)
+ * Overrides the window size of the inflate header in the compressed stream.
+ * The window size must be greater than or equal to the window size of the
+ * compressed stream.
*
- * == Example
+ * Greater than 15::
+ * Add 32 to window_bits to enable zlib and gzip decoding with automatic
+ * header detection, or add 16 to decode only the gzip format (a
+ * Zlib::DataError will be raised for a non-gzip stream).
*
- * cf = File.open("compressed.file")
- * ucf = File.open("uncompressed.file", "w+")
- * zi = Zlib::Inflate.new(Zlib::MAX_WBITS)
+ * (-8..-15)::
+ * Enables raw deflate mode which will not generate a check value, and will
+ * not look for any check values for comparison at the end of the stream.
*
- * ucf << zi.inflate(cf.read)
+ * This is for use with other formats that use the deflate compressed data
+ * format such as zip which provide their own check values.
*
- * ucf.close
- * zi.close
- * cf.close
+ * == Example
*
- * or
+ * open "compressed.file" do |compressed_io|
+ * zi = Zlib::Inflate.new(Zlib::MAX_WBITS + 32)
*
- * File.open("compressed.file") {|cf|
- * zi = Zlib::Inflate.new
- * File.open("uncompressed.file", "w+") {|ucf|
- * ucf << zi.inflate(cf.read)
- * }
- * zi.close
- * }
+ * begin
+ * open "uncompressed.file", "w+" do |uncompressed_io|
+ * uncompressed_io << zi.inflate(compressed_io.read)
+ * end
+ * ensure
+ * zi.close
+ * end
+ * end
*
*/
static VALUE
@@ -1685,9 +1897,11 @@ inflate_run(VALUE args)
}
/*
- * Document-method: Zlib::Inflate.inflate
+ * Document-method: Zlib::inflate
*
- * call-seq: Zlib::Inflate.inflate(string)
+ * call-seq:
+ * Zlib.inflate(string)
+ * Zlib::Inflate.inflate(string)
*
* Decompresses +string+. Raises a Zlib::NeedDict exception if a preset
* dictionary is needed for decompression.
@@ -1741,15 +1955,39 @@ do_inflate(struct zstream *z, VALUE src)
}
}
+/* Document-method: Zlib::Inflate#add_dictionary
+ *
+ * call-seq: add_dictionary(string)
+ *
+ * Provide the inflate stream with a dictionary that may be required in the
+ * future. Multiple dictionaries may be provided. The inflate stream will
+ * automatically choose the correct user-provided dictionary based on the
+ * stream's required dictionary.
+ */
+static VALUE
+rb_inflate_add_dictionary(VALUE obj, VALUE dictionary) {
+ VALUE dictionaries = rb_ivar_get(obj, id_dictionaries);
+ VALUE checksum = do_checksum(1, &dictionary, adler32);
+
+ rb_hash_aset(dictionaries, checksum, dictionary);
+
+ return obj;
+}
+
/*
* Document-method: Zlib::Inflate#inflate
*
- * call-seq: inflate(string)
+ * call-seq:
+ * inflate(deflate_string) -> String
+ * inflate(deflate_string) { |chunk| ... } -> nil
+ *
+ * Inputs +deflate_string+ into the inflate stream and returns the output from
+ * the stream. Calling this method, both the input and the output buffer of
+ * the stream are flushed. If string is +nil+, this method finishes the
+ * stream, just like Zlib::ZStream#finish.
*
- * Inputs +string+ into the inflate stream and returns the output from the
- * stream. Calling this method, both the input and the output buffer of the
- * stream are flushed. If string is +nil+, this method finishes the stream,
- * just like Zlib::ZStream#finish.
+ * If a block is given consecutive inflated chunks from the +deflate_string+
+ * are yielded to the block and +nil+ is returned.
*
* Raises a Zlib::NeedDict exception if a preset dictionary is needed to
* decompress. Set the dictionary by Zlib::Inflate#set_dictionary and then
@@ -1789,6 +2027,7 @@ rb_inflate_inflate(VALUE obj, VALUE src)
StringValue(src);
zstream_append_buffer2(z, src);
dst = rb_str_new(0, 0);
+ OBJ_INFECT(dst, obj);
}
}
else {
@@ -1799,7 +2038,6 @@ rb_inflate_inflate(VALUE obj, VALUE src)
}
}
- OBJ_INFECT(dst, obj);
return dst;
}
@@ -2023,6 +2261,7 @@ gzfile_new(klass, funcs, endfunc)
obj = Data_Make_Struct(klass, struct gzfile, gzfile_mark, gzfile_free, gz);
zstream_init(&gz->z, funcs);
+ gz->z.flags |= ZSTREAM_FLAG_GZFILE;
gz->io = Qnil;
gz->level = 0;
gz->mtime = 0;
@@ -2472,7 +2711,7 @@ gzfile_read(struct gzfile *gz, long len)
if (len == 0) return rb_str_new(0, 0);
if (len < 0) return Qnil;
dst = zstream_shift_buffer(&gz->z, len);
- gzfile_calc_crc(gz, dst);
+ if (!NIL_P(dst)) gzfile_calc_crc(gz, dst);
return dst;
}
@@ -2535,6 +2774,7 @@ gzfile_read_all(struct gzfile *gz)
}
dst = zstream_detach_buffer(&gz->z);
+ if (NIL_P(dst)) return dst;
gzfile_calc_crc(gz, dst);
OBJ_TAINT(dst);
return gzfile_newstr(gz, dst);
@@ -2560,7 +2800,6 @@ gzfile_getc(struct gzfile *gz)
if (gz->ec && rb_enc_dummy_p(gz->enc2)) {
const unsigned char *ss, *sp, *se;
unsigned char *ds, *dp, *de;
- rb_econv_result_t res;
if (!gz->cbuf) {
gz->cbuf = ALLOC_N(char, GZFILE_CBUF_CAPA);
@@ -2569,7 +2808,7 @@ gzfile_getc(struct gzfile *gz)
se = sp + gz->z.buf_filled;
ds = dp = (unsigned char *)gz->cbuf;
de = (unsigned char *)ds + GZFILE_CBUF_CAPA;
- res = rb_econv_convert(gz->ec, &sp, se, &dp, de, ECONV_PARTIAL_INPUT|ECONV_AFTER_OUTPUT);
+ (void)rb_econv_convert(gz->ec, &sp, se, &dp, de, ECONV_PARTIAL_INPUT|ECONV_AFTER_OUTPUT);
rb_econv_check_error(gz->ec);
dst = zstream_shift_buffer(&gz->z, sp - ss);
gzfile_calc_crc(gz, dst);
@@ -2582,6 +2821,7 @@ gzfile_getc(struct gzfile *gz)
buf = gz->z.buf;
len = rb_enc_mbclen(RSTRING_PTR(buf), RSTRING_END(buf), gz->enc);
dst = gzfile_read(gz, len);
+ if (NIL_P(dst)) return dst;
return gzfile_newstr(gz, dst);
}
}
@@ -2788,14 +3028,17 @@ gzfile_wrap(int argc, VALUE *argv, VALUE klass, int close_io_on_error)
/*
* Document-method: Zlib::GzipFile.wrap
*
- * call-seq: Zlib::GzipFile.wrap(io) { |gz| ... }
+ * call-seq:
+ * Zlib::GzipReader.wrap(io, ...) { |gz| ... }
+ * Zlib::GzipWriter.wrap(io, ...) { |gz| ... }
+ *
+ * Creates a GzipReader or GzipWriter associated with +io+, passing in any
+ * necessary extra options, and executes the block with the newly created
+ * object just like File.open.
*
- * Creates a GzipFile object associated with +io+, and
- * executes the block with the newly created GzipFile object,
- * just like File.open. The GzipFile object will be closed
- * automatically after executing the block. If you want to keep
- * the associated IO object opening, you may call
- * +Zlib::GzipFile#finish+ method in the block.
+ * The GzipFile object will be closed automatically after executing the block.
+ * If you want to keep the associated IO object open, you may call
+ * Zlib::GzipFile#finish method in the block.
*/
static VALUE
rb_gzfile_s_wrap(int argc, VALUE *argv, VALUE klass)
@@ -2951,13 +3194,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;
}
@@ -3213,12 +3452,17 @@ rb_gzwriter_s_open(int argc, VALUE *argv, VALUE klass)
}
/*
- * call-seq: Zlib::GzipWriter.new(io, level, strategy)
+ * call-seq:
+ * Zlib::GzipWriter.new(io, level = nil, strategy = nil, options = {})
*
* Creates a GzipWriter object associated with +io+. +level+ and +strategy+
* should be the same as the arguments of Zlib::Deflate.new. The GzipWriter
- * object writes gzipped data to +io+. At least, +io+ must respond to the
- * +write+ method that behaves same as write method in IO class.
+ * object writes gzipped data to +io+. +io+ must respond to the
+ * +write+ method that behaves the same as IO#write.
+ *
+ * The +options+ hash may be used to set the encoding of the data.
+ * +:external_encoding+, +:internal_encoding+ and +:encoding+ may be set as in
+ * IO::new.
*/
static VALUE
rb_gzwriter_initialize(int argc, VALUE *argv, VALUE obj)
@@ -3290,7 +3534,7 @@ rb_gzwriter_write(VALUE obj, VALUE str)
{
struct gzfile *gz = get_gzfile(obj);
- if (TYPE(str) != T_STRING)
+ if (!RB_TYPE_P(str, T_STRING))
str = rb_obj_as_string(str);
if (gz->enc2 && gz->enc2 != rb_ascii8bit_encoding()) {
str = rb_str_conv_enc(str, rb_enc_get(str), gz->enc2);
@@ -3342,7 +3586,7 @@ rb_gzwriter_putc(VALUE obj, VALUE ch)
* Document-class: Zlib::GzipReader
*
* Zlib::GzipReader is the class for reading a gzipped file. GzipReader should
- * be used an IO, or -IO-lie, object.
+ * be used an IO, or -IO-like, object.
*
* Zlib::GzipReader.open('hoge.gz') {|gz|
* print gz.read
@@ -3414,11 +3658,16 @@ rb_gzreader_s_open(int argc, VALUE *argv, VALUE klass)
/*
* Document-method: Zlib::GzipReader.new
*
- * call-seq: Zlib::GzipReader.new(io)
+ * call-seq:
+ * Zlib::GzipReader.new(io, options = {})
*
* Creates a GzipReader object associated with +io+. The GzipReader object reads
- * gzipped data from +io+, and parses/decompresses them. At least, +io+ must have
- * a +read+ method that behaves same as the +read+ method in IO class.
+ * gzipped data from +io+, and parses/decompresses it. The +io+ must
+ * have a +read+ method that behaves same as the IO#read.
+ *
+ * The +options+ hash may be used to set the encoding of the data.
+ * +:external_encoding+, +:internal_encoding+ and +:encoding+ may be set as in
+ * IO::new.
*
* If the gzip file header is incorrect, raises an Zlib::GzipFile::Error
* exception.
@@ -3633,6 +3882,20 @@ rb_gzreader_each_byte(VALUE obj)
}
/*
+ * Document-method: Zlib::GzipReader#bytes
+ *
+ * This is a deprecated alias for <code>each_byte</code>.
+ */
+static VALUE
+rb_gzreader_bytes(VALUE obj)
+{
+ rb_warn("Zlib::GzipReader#bytes is deprecated; use #each_byte instead");
+ if (!rb_block_given_p())
+ return rb_enumeratorize(obj, ID2SYM(rb_intern("each_byte")), 0, 0);
+ return rb_gzreader_each_byte(obj);
+}
+
+/*
* Document-method: Zlib::GzipReader#ungetc
*
* See Zlib::GzipReader documentation for a description.
@@ -3780,6 +4043,7 @@ gzreader_gets(int argc, VALUE *argv, VALUE obj)
n = limit;
}
dst = zstream_shift_buffer(&gz->z, n);
+ if (NIL_P(dst)) return dst;
gzfile_calc_crc(gz, dst);
dst = gzfile_newstr(gz, dst);
}
@@ -3841,6 +4105,7 @@ gzreader_gets(int argc, VALUE *argv, VALUE obj)
gz->lineno++;
dst = gzfile_read(gz, n);
+ if (NIL_P(dst)) return dst;
if (rspara) {
gzreader_skip_linebreaks(gz);
}
@@ -3899,6 +4164,20 @@ rb_gzreader_each(int argc, VALUE *argv, VALUE obj)
}
/*
+ * Document-method: Zlib::GzipReader#lines
+ *
+ * This is a deprecated alias for <code>each_line</code>.
+ */
+static VALUE
+rb_gzreader_lines(int argc, VALUE *argv, VALUE obj)
+{
+ rb_warn("Zlib::GzipReader#lines is deprecated; use #each_line instead");
+ if (!rb_block_given_p())
+ return rb_enumeratorize(obj, ID2SYM(rb_intern("each_line")), argc, argv);
+ return rb_gzreader_each(argc, argv, obj);
+}
+
+/*
* Document-method: Zlib::GzipReader#readlines
*
* See Zlib::GzipReader documentation for a description.
@@ -3916,89 +4195,6 @@ rb_gzreader_readlines(int argc, VALUE *argv, VALUE obj)
#endif /* GZIP_SUPPORT */
-
-
-/*
- * Document-module: Zlib
- *
- * The Zlib module contains several classes for compressing and decompressing
- * streams, and for working with "gzip" files.
- *
- * == Classes
- *
- * Following are the classes that are most likely to be of interest to the
- * user:
- * Zlib::Inflate
- * Zlib::Deflate
- * Zlib::GzipReader
- * Zlib::GzipWriter
- *
- * There are two important base classes for the classes above: Zlib::ZStream
- * and Zlib::GzipFile. Everything else is an error class.
- *
- * == Constants
- *
- * Here's a list.
- *
- * Zlib::VERSION
- * The Ruby/zlib version string.
- *
- * Zlib::ZLIB_VERSION
- * The string which represents the version of zlib.h.
- *
- * Zlib::BINARY
- * Zlib::ASCII
- * Zlib::UNKNOWN
- * The integers representing data types which Zlib::ZStream#data_type
- * method returns.
- *
- * Zlib::NO_COMPRESSION
- * Zlib::BEST_SPEED
- * Zlib::BEST_COMPRESSION
- * Zlib::DEFAULT_COMPRESSION
- * The integers representing compression levels which are an argument
- * for Zlib::Deflate.new, Zlib::Deflate#deflate, and so on.
- *
- * Zlib::FILTERED
- * Zlib::HUFFMAN_ONLY
- * Zlib::DEFAULT_STRATEGY
- * The integers representing compression methods which are an argument
- * for Zlib::Deflate.new and Zlib::Deflate#params.
- *
- * Zlib::DEF_MEM_LEVEL
- * Zlib::MAX_MEM_LEVEL
- * The integers representing memory levels which are an argument for
- * Zlib::Deflate.new, Zlib::Deflate#params, and so on.
- *
- * Zlib::MAX_WBITS
- * The default value of windowBits which is an argument for
- * Zlib::Deflate.new and Zlib::Inflate.new.
- *
- * Zlib::NO_FLUSH
- * Zlib::SYNC_FLUSH
- * Zlib::FULL_FLUSH
- * Zlib::FINISH
- * The integers to control the output of the deflate stream, which are
- * an argument for Zlib::Deflate#deflate and so on.
- *
- * Zlib::OS_CODE
- * Zlib::OS_MSDOS
- * Zlib::OS_AMIGA
- * Zlib::OS_VMS
- * Zlib::OS_UNIX
- * Zlib::OS_VMCMS
- * Zlib::OS_ATARI
- * Zlib::OS_OS2
- * Zlib::OS_MACOS
- * Zlib::OS_ZSYSTEM
- * Zlib::OS_CPM
- * Zlib::OS_TOPS20
- * Zlib::OS_WIN32
- * Zlib::OS_QDOS
- * Zlib::OS_RISCOS
- * Zlib::OS_UNKNOWN
- * The return values of Zlib::GzipFile#os_code method.
- */
void
Init_zlib()
{
@@ -4009,6 +4205,8 @@ Init_zlib()
mZlib = rb_define_module("Zlib");
+ id_dictionaries = rb_intern("@dictionaries");
+
cZError = rb_define_class_under(mZlib, "Error", rb_eStandardError);
cStreamEnd = rb_define_class_under(mZlib, "StreamEnd", cZError);
cNeedDict = rb_define_class_under(mZlib, "NeedDict", cZError);
@@ -4050,14 +4248,29 @@ Init_zlib()
rb_define_method(cZStream, "flush_next_in", rb_zstream_flush_next_in, 0);
rb_define_method(cZStream, "flush_next_out", rb_zstream_flush_next_out, 0);
- /* Integer representing date types which
- * ZStream#data_type method returns */
+ /* Represents binary data as guessed by deflate.
+ *
+ * See Zlib::Deflate#data_type. */
rb_define_const(mZlib, "BINARY", INT2FIX(Z_BINARY));
- /* Integer representing date types which
- * ZStream#data_type method returns */
+
+ /* Represents text data as guessed by deflate.
+ *
+ * NOTE: The underlying constant Z_ASCII was deprecated in favor of Z_TEXT
+ * in zlib 1.2.2. New applications should not use this constant.
+ *
+ * See Zlib::Deflate#data_type. */
rb_define_const(mZlib, "ASCII", INT2FIX(Z_ASCII));
- /* Integer representing date types which
- * ZStream#data_type method returns */
+
+#ifdef Z_TEXT
+ /* Represents text data as guessed by deflate.
+ *
+ * See Zlib::Deflate#data_type. */
+ rb_define_const(mZlib, "TEXT", INT2FIX(Z_TEXT));
+#endif
+
+ /* Represents an unknown data type as guessed by deflate.
+ *
+ * See Zlib::Deflate#data_type. */
rb_define_const(mZlib, "UNKNOWN", INT2FIX(Z_UNKNOWN));
cDeflate = rb_define_class_under(mZlib, "Deflate", cZStream);
@@ -4077,77 +4290,91 @@ Init_zlib()
rb_define_singleton_method(mZlib, "inflate", rb_inflate_s_inflate, 1);
rb_define_alloc_func(cInflate, rb_inflate_s_allocate);
rb_define_method(cInflate, "initialize", rb_inflate_initialize, -1);
+ rb_define_method(cInflate, "add_dictionary", rb_inflate_add_dictionary, 1);
rb_define_method(cInflate, "inflate", rb_inflate_inflate, 1);
rb_define_method(cInflate, "<<", rb_inflate_addstr, 1);
rb_define_method(cInflate, "sync", rb_inflate_sync, 1);
rb_define_method(cInflate, "sync_point?", rb_inflate_sync_point_p, 0);
rb_define_method(cInflate, "set_dictionary", rb_inflate_set_dictionary, 1);
- /* compression level 0
- *
- * Which is an argument for Deflate.new, Deflate#deflate, and so on. */
+ /* No compression, passes through data untouched. Use this for appending
+ * pre-compressed data to a deflate stream.
+ */
rb_define_const(mZlib, "NO_COMPRESSION", INT2FIX(Z_NO_COMPRESSION));
- /* compression level 1
- *
- * Which is an argument for Deflate.new, Deflate#deflate, and so on. */
+ /* Fastest compression level, but with with lowest space savings. */
rb_define_const(mZlib, "BEST_SPEED", INT2FIX(Z_BEST_SPEED));
- /* compression level 9
- *
- * Which is an argument for Deflate.new, Deflate#deflate, and so on. */
+ /* Slowest compression level, but with the best space savings. */
rb_define_const(mZlib, "BEST_COMPRESSION", INT2FIX(Z_BEST_COMPRESSION));
- /* compression level -1
- *
- * Which is an argument for Deflate.new, Deflate#deflate, and so on. */
+ /* Default compression level which is a good trade-off between space and
+ * time
+ */
rb_define_const(mZlib, "DEFAULT_COMPRESSION",
INT2FIX(Z_DEFAULT_COMPRESSION));
- /* compression method 1
- *
- * Which is an argument for Deflate.new and Deflate#params. */
+ /* Deflate strategy for data produced by a filter (or predictor). The
+ * effect of FILTERED is to force more Huffman codes and less string
+ * matching; it is somewhat intermediate between DEFAULT_STRATEGY and
+ * HUFFMAN_ONLY. Filtered data consists mostly of small values with a
+ * somewhat random distribution.
+ */
rb_define_const(mZlib, "FILTERED", INT2FIX(Z_FILTERED));
- /* compression method 2
- *
- * Which is an argument for Deflate.new and Deflate#params. */
+
+ /* Deflate strategy which uses Huffman codes only (no string matching). */
rb_define_const(mZlib, "HUFFMAN_ONLY", INT2FIX(Z_HUFFMAN_ONLY));
- /* compression method 0
- *
- * Which is an argument for Deflate.new and Deflate#params. */
+
+#ifdef Z_RLE
+ /* Deflate compression strategy designed to be almost as fast as
+ * HUFFMAN_ONLY, but give better compression for PNG image data.
+ */
+ rb_define_const(mZlib, "RLE", INT2FIX(Z_RLE));
+#endif
+
+#ifdef Z_FIXED
+ /* Deflate strategy which prevents the use of dynamic Huffman codes,
+ * allowing for a simpler decoder for specialized applications.
+ */
+ rb_define_const(mZlib, "FIXED", INT2FIX(Z_FIXED));
+#endif
+
+ /* Default deflate strategy which is used for normal data. */
rb_define_const(mZlib, "DEFAULT_STRATEGY", INT2FIX(Z_DEFAULT_STRATEGY));
- /* The default value of windowBits which is an argument for
- * Deflate.new and Inflate.new.
- */
+ /* The maximum size of the zlib history buffer. Note that zlib allows
+ * larger values to enable different inflate modes. See Zlib::Inflate.new
+ * for details.
+ */
rb_define_const(mZlib, "MAX_WBITS", INT2FIX(MAX_WBITS));
- /* Default value is 8
- *
- * The integer representing memory levels.
- * Which are an argument for Deflate.new, Deflate#params, and so on. */
+
+ /* The default memory level for allocating zlib deflate compression state.
+ */
rb_define_const(mZlib, "DEF_MEM_LEVEL", INT2FIX(DEF_MEM_LEVEL));
- /* Maximum level is 9
- *
- * The integers representing memory levels which are an argument for
- * Deflate.new, Deflate#params, and so on. */
+
+ /* The maximum memory level for allocating zlib deflate compression state.
+ */
rb_define_const(mZlib, "MAX_MEM_LEVEL", INT2FIX(MAX_MEM_LEVEL));
- /* Output control - 0
- *
- * The integers to control the output of the deflate stream, which are
- * an argument for Deflate#deflate and so on. */
+ /* NO_FLUSH is the default flush method and allows deflate to decide how
+ * much data to accumulate before producing output in order to maximize
+ * compression.
+ */
rb_define_const(mZlib, "NO_FLUSH", INT2FIX(Z_NO_FLUSH));
- /* Output control - 2
- *
- * The integers to control the output of the deflate stream, which are
- * an argument for Deflate#deflate and so on. */
+
+ /* The SYNC_FLUSH method flushes all pending output to the output buffer
+ * and the output is aligned on a byte boundary. Flushing may degrade
+ * compression so it should be used only when necessary, such as at a
+ * request or response boundary for a network stream.
+ */
rb_define_const(mZlib, "SYNC_FLUSH", INT2FIX(Z_SYNC_FLUSH));
- /* Output control - 3
- *
- * The integers to control the output of the deflate stream, which are
- * an argument for Deflate#deflate and so on. */
+
+ /* Flushes all output as with SYNC_FLUSH, and the compression state is
+ * reset so that decompression can restart from this point if previous
+ * compressed data has been damaged or if random access is desired. Like
+ * SYNC_FLUSH, using FULL_FLUSH too often can seriously degrade
+ * compression.
+ */
rb_define_const(mZlib, "FULL_FLUSH", INT2FIX(Z_FULL_FLUSH));
- /* Oputput control - 4
- *
- * The integers to control the output of the deflate stream, which are
- * an argument for Deflate#deflate and so on. */
+
+ /* Processes all pending input and flushes pending output. */
rb_define_const(mZlib, "FINISH", INT2FIX(Z_FINISH));
#if GZIP_SUPPORT
@@ -4225,48 +4452,47 @@ Init_zlib()
rb_define_method(cGzipReader, "readbyte", rb_gzreader_readbyte, 0);
rb_define_method(cGzipReader, "each_byte", rb_gzreader_each_byte, 0);
rb_define_method(cGzipReader, "each_char", rb_gzreader_each_char, 0);
- rb_define_method(cGzipReader, "bytes", rb_gzreader_each_byte, 0);
+ rb_define_method(cGzipReader, "bytes", rb_gzreader_bytes, 0);
rb_define_method(cGzipReader, "ungetc", rb_gzreader_ungetc, 1);
rb_define_method(cGzipReader, "ungetbyte", rb_gzreader_ungetbyte, 1);
rb_define_method(cGzipReader, "gets", rb_gzreader_gets, -1);
rb_define_method(cGzipReader, "readline", rb_gzreader_readline, -1);
rb_define_method(cGzipReader, "each", rb_gzreader_each, -1);
rb_define_method(cGzipReader, "each_line", rb_gzreader_each, -1);
- rb_define_method(cGzipReader, "lines", rb_gzreader_each, -1);
+ rb_define_method(cGzipReader, "lines", rb_gzreader_lines, -1);
rb_define_method(cGzipReader, "readlines", rb_gzreader_readlines, -1);
- /* From GzipFile#os_code - code of current host */
+ /* The OS code of current host */
rb_define_const(mZlib, "OS_CODE", INT2FIX(OS_CODE));
- /* From GzipFile#os_code - 0x00 */
+ /* OS code for MSDOS hosts */
rb_define_const(mZlib, "OS_MSDOS", INT2FIX(OS_MSDOS));
- /* From GzipFile#os_code - 0x01 */
+ /* OS code for Amiga hosts */
rb_define_const(mZlib, "OS_AMIGA", INT2FIX(OS_AMIGA));
- /* From GzipFile#os_code - 0x02 */
+ /* OS code for VMS hosts */
rb_define_const(mZlib, "OS_VMS", INT2FIX(OS_VMS));
- /* From GzipFile#os_code - 0x03 */
+ /* OS code for UNIX hosts */
rb_define_const(mZlib, "OS_UNIX", INT2FIX(OS_UNIX));
- /* From GzipFile#os_code - 0x05 */
+ /* OS code for Atari hosts */
rb_define_const(mZlib, "OS_ATARI", INT2FIX(OS_ATARI));
- /* From GzipFile#os_code - 0x06 */
+ /* OS code for OS2 hosts */
rb_define_const(mZlib, "OS_OS2", INT2FIX(OS_OS2));
- /* From GzipFile#os_code - 0x07 */
+ /* OS code for Mac OS hosts */
rb_define_const(mZlib, "OS_MACOS", INT2FIX(OS_MACOS));
- /* From GzipFile#os_code - 0x0a */
+ /* OS code for TOPS-20 hosts */
rb_define_const(mZlib, "OS_TOPS20", INT2FIX(OS_TOPS20));
- /* From GzipFile#os_code - 0x0b */
+ /* OS code for Win32 hosts */
rb_define_const(mZlib, "OS_WIN32", INT2FIX(OS_WIN32));
-
- /* From GzipFile#os_code - 0x04 */
+ /* OS code for VM OS hosts */
rb_define_const(mZlib, "OS_VMCMS", INT2FIX(OS_VMCMS));
- /* From GzipFile#os_code - 0x08 */
+ /* OS code for Z-System hosts */
rb_define_const(mZlib, "OS_ZSYSTEM", INT2FIX(OS_ZSYSTEM));
- /* From GzipFile#os_code - 0x09 */
+ /* OS code for CP/M hosts */
rb_define_const(mZlib, "OS_CPM", INT2FIX(OS_CPM));
- /* From GzipFile#os_code - 0x0c */
+ /* OS code for QDOS hosts */
rb_define_const(mZlib, "OS_QDOS", INT2FIX(OS_QDOS));
- /* From GzipFile#os_code - 0x0d */
+ /* OS code for RISC OS hosts */
rb_define_const(mZlib, "OS_RISCOS", INT2FIX(OS_RISCOS));
- /* From GzipFile#os_code - 0xff */
+ /* OS code for unknown hosts */
rb_define_const(mZlib, "OS_UNKNOWN", INT2FIX(OS_UNKNOWN));
#endif /* GZIP_SUPPORT */
diff --git a/file.c b/file.c
index c60de23302..b14f42e1f8 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"
@@ -60,6 +63,13 @@ int flock(int, int);
#include <sys/types.h>
#include <sys/stat.h>
+#if defined(__native_client__) && defined(NACL_NEWLIB)
+# include "nacl/utime.h"
+# include "nacl/stat.h"
+# include "nacl/unistd.h"
+#endif
+
+
#ifdef HAVE_SYS_MKDEV_H
#include <sys/mkdev.h>
#endif
@@ -99,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)
@@ -153,40 +161,60 @@ file_path_convert(VALUE name)
return name;
}
-static VALUE
-rb_get_path_check(VALUE obj, int level)
+static rb_encoding *
+check_path_encoding(VALUE str)
+{
+ rb_encoding *enc = rb_enc_get(str);
+ if (!rb_enc_asciicompat(enc)) {
+ rb_raise(rb_eEncCompatError, "path name must be ASCII-compatible (%s): %"PRIsVALUE,
+ rb_enc_name(enc), rb_str_inspect(str));
+ }
+ return enc;
+}
+
+VALUE
+rb_get_path_check_to_string(VALUE obj, int level)
{
VALUE tmp;
ID to_path;
- rb_encoding *enc;
if (insecure_obj_p(obj, level)) {
rb_insecure_operation();
}
+ if (RB_TYPE_P(obj, T_STRING)) {
+ return obj;
+ }
CONST_ID(to_path, "to_path");
tmp = rb_check_funcall(obj, to_path, 0, 0);
if (tmp == Qundef) {
tmp = obj;
}
StringValue(tmp);
+ return tmp;
+}
+VALUE
+rb_get_path_check_convert(VALUE obj, VALUE tmp, int level)
+{
tmp = file_path_convert(tmp);
if (obj != tmp && insecure_obj_p(tmp, level)) {
rb_insecure_operation();
}
- enc = rb_enc_get(tmp);
- if (!rb_enc_asciicompat(enc)) {
- tmp = rb_str_inspect(tmp);
- rb_raise(rb_eEncCompatError, "path name must be ASCII-compatible (%s): %s",
- rb_enc_name(enc), RSTRING_PTR(tmp));
- }
+ check_path_encoding(tmp);
StringValueCStr(tmp);
return rb_str_new4(tmp);
}
+static VALUE
+rb_get_path_check(VALUE obj, int level)
+{
+ VALUE tmp = rb_get_path_check_to_string(obj, level);
+ return rb_get_path_check_convert(obj, tmp, level);
+}
+
VALUE
rb_get_path_no_checksafe(VALUE obj)
{
@@ -204,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);
@@ -239,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.
@@ -268,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;
@@ -282,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);
}
@@ -303,8 +398,10 @@ static struct timespec stat_mtimespec(struct stat *st);
* call-seq:
* stat <=> other_stat -> -1, 0, 1, nil
*
- * Compares <code>File::Stat</code> objects by comparing their
- * respective modification times.
+ * Compares File::Stat objects by comparing their respective modification
+ * times.
+ *
+ * +nil+ is returned if the two values are incomparable.
*
* f1 = File.new("f1", "w")
* sleep 1
@@ -503,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;
@@ -524,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;
@@ -545,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;
@@ -581,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;
@@ -857,8 +954,7 @@ w32_io_info(VALUE *file, BY_HANDLE_FILE_INFORMATION *st)
MultiByteToWideChar(CP_UTF8, 0, RSTRING_PTR(tmp), -1, ptr, len);
f = CreateFileW(ptr, 0,
FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING,
- rb_w32_iswin95() ? 0 : FILE_FLAG_BACKUP_SEMANTICS,
- NULL);
+ FILE_FLAG_BACKUP_SEMANTICS, NULL);
ALLOCV_END(v);
if (f == INVALID_HANDLE_VALUE) return f;
ret = f;
@@ -888,12 +984,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);
}
/*
@@ -921,7 +1016,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);
}
/*
@@ -950,7 +1045,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
@@ -985,7 +1080,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
@@ -994,36 +1089,48 @@ rb_file_lstat(VALUE obj)
static int
rb_group_member(GETGROUPS_T gid)
{
+#ifdef _WIN32
+ return FALSE;
+#else
int rv = FALSE;
-#ifndef _WIN32
+ int groups = 16;
+ VALUE v = 0;
+ GETGROUPS_T *gary;
+ int anum = -1;
+
if (getgid() == gid || getegid() == gid)
return TRUE;
-# ifdef HAVE_GETGROUPS
-# ifndef NGROUPS
-# ifdef NGROUPS_MAX
-# define NGROUPS NGROUPS_MAX
-# else
-# define NGROUPS 32
-# endif
-# endif
- {
- GETGROUPS_T *gary;
- int anum;
-
- gary = xmalloc(NGROUPS * sizeof(GETGROUPS_T));
- anum = getgroups(NGROUPS, gary);
- while (--anum >= 0) {
- if (gary[anum] == gid) {
- rv = TRUE;
- break;
- }
+ /*
+ * On Mac OS X (Mountain Lion), NGROUPS is 16. But libc and kernel
+ * accept more larger value.
+ * So we don't trunk NGROUPS anymore.
+ */
+ while (groups <= RB_MAX_GROUPS) {
+ gary = ALLOCV_N(GETGROUPS_T, v, groups);
+ anum = getgroups(groups, gary);
+ if (anum != -1 && anum != groups)
+ break;
+ groups *= 2;
+ if (v) {
+ ALLOCV_END(v);
+ v = 0;
}
- xfree(gary);
}
-# endif
-#endif
+ if (anum == -1)
+ return FALSE;
+
+ while (--anum >= 0) {
+ if (gary[anum] == gid) {
+ rv = TRUE;
+ break;
+ }
+ }
+ if (v)
+ ALLOCV_END(v);
+
return rv;
+#endif
}
#ifndef S_IXUGO
@@ -1042,11 +1149,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))
@@ -1074,12 +1185,6 @@ eaccess(const char *path, int mode)
}
#endif
-static inline int
-access_internal(const char *path, int mode)
-{
- return access(path, mode);
-}
-
/*
* Document-class: FileTest
@@ -1092,18 +1197,6 @@ access_internal(const char *path, int mode)
*/
/*
- * Document-method: exist?
- *
- * 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.
- *
- */
-
-/*
* Document-method: directory?
*
* call-seq:
@@ -1113,6 +1206,8 @@ access_internal(const char *path, int mode)
* or a symlink that points at a directory, and <code>false</code>
* otherwise.
*
+ * _file_name_ can be an IO object.
+ *
* File.directory?(".")
*/
@@ -1135,6 +1230,8 @@ rb_file_directory_p(VALUE obj, VALUE fname)
* File.pipe?(file_name) -> true or false
*
* Returns <code>true</code> if the named file is a pipe.
+ *
+ * _file_name_ can be an IO object.
*/
static VALUE
@@ -1196,6 +1293,8 @@ rb_file_symlink_p(VALUE obj, VALUE fname)
* File.socket?(file_name) -> true or false
*
* Returns <code>true</code> if the named file is a socket.
+ *
+ * _file_name_ can be an IO object.
*/
static VALUE
@@ -1230,6 +1329,8 @@ rb_file_socket_p(VALUE obj, VALUE fname)
* File.blockdev?(file_name) -> true or false
*
* Returns <code>true</code> if the named file is a block device.
+ *
+ * _file_name_ can be an IO object.
*/
static VALUE
@@ -1258,6 +1359,8 @@ rb_file_blockdev_p(VALUE obj, VALUE fname)
* File.chardev?(file_name) -> true or false
*
* Returns <code>true</code> if the named file is a character device.
+ *
+ * _file_name_ can be an IO object.
*/
static VALUE
rb_file_chardev_p(VALUE obj, VALUE fname)
@@ -1280,6 +1383,10 @@ rb_file_chardev_p(VALUE obj, VALUE fname)
* File.exists?(file_name) -> true or false
*
* Return <code>true</code> if the named file exists.
+ *
+ * _file_name_ can be an IO object.
+ *
+ * "file exists" means that stat() or fstat() system call is successful.
*/
static VALUE
@@ -1291,6 +1398,22 @@ rb_file_exist_p(VALUE obj, VALUE fname)
return Qtrue;
}
+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
@@ -1323,7 +1446,7 @@ rb_file_readable_real_p(VALUE obj, VALUE fname)
rb_secure(2);
FilePathValue(fname);
fname = rb_str_encode_ospath(fname);
- if (access_internal(StringValueCStr(fname), R_OK) < 0) return Qfalse;
+ if (access(StringValueCStr(fname), R_OK) < 0) return Qfalse;
return Qtrue;
}
@@ -1344,6 +1467,8 @@ rb_file_readable_real_p(VALUE obj, VALUE fname)
* <code>nil</code> otherwise. The meaning of the bits is platform
* dependent; on Unix systems, see <code>stat(2)</code>.
*
+ * _file_name_ can be an IO object.
+ *
* File.world_readable?("/etc/passwd") #=> 420
* m = File.world_readable?("/etc/passwd")
* sprintf("%o", m) #=> "644"
@@ -1395,7 +1520,7 @@ rb_file_writable_real_p(VALUE obj, VALUE fname)
rb_secure(2);
FilePathValue(fname);
fname = rb_str_encode_ospath(fname);
- if (access_internal(StringValueCStr(fname), W_OK) < 0) return Qfalse;
+ if (access(StringValueCStr(fname), W_OK) < 0) return Qfalse;
return Qtrue;
}
@@ -1408,6 +1533,8 @@ rb_file_writable_real_p(VALUE obj, VALUE fname)
* <code>nil</code> otherwise. The meaning of the bits is platform
* dependent; on Unix systems, see <code>stat(2)</code>.
*
+ * _file_name_ can be an IO object.
+ *
* File.world_writable?("/tmp") #=> 511
* m = File.world_writable?("/tmp")
* sprintf("%o", m) #=> "777"
@@ -1459,7 +1586,7 @@ rb_file_executable_real_p(VALUE obj, VALUE fname)
rb_secure(2);
FilePathValue(fname);
fname = rb_str_encode_ospath(fname);
- if (access_internal(StringValueCStr(fname), X_OK) < 0) return Qfalse;
+ if (access(StringValueCStr(fname), X_OK) < 0) return Qfalse;
return Qtrue;
}
@@ -1473,6 +1600,8 @@ rb_file_executable_real_p(VALUE obj, VALUE fname)
*
* Returns <code>true</code> if the named file exists and is a
* regular file.
+ *
+ * _file_name_ can be an IO object.
*/
static VALUE
@@ -1491,6 +1620,8 @@ rb_file_file_p(VALUE obj, VALUE fname)
*
* Returns <code>true</code> if the named file exists and has
* a zero size.
+ *
+ * _file_name_ can be an IO object.
*/
static VALUE
@@ -1509,6 +1640,8 @@ rb_file_zero_p(VALUE obj, VALUE fname)
*
* Returns +nil+ if +file_name+ doesn't exist or has zero size, the size of the
* file otherwise.
+ *
+ * _file_name_ can be an IO object.
*/
static VALUE
@@ -1528,6 +1661,8 @@ rb_file_size_p(VALUE obj, VALUE fname)
* Returns <code>true</code> if the named file exists and the
* effective used id of the calling process is the owner of
* the file.
+ *
+ * _file_name_ can be an IO object.
*/
static VALUE
@@ -1557,6 +1692,8 @@ rb_file_rowned_p(VALUE obj, VALUE fname)
* Returns <code>true</code> if the named file exists and the
* effective group id of the calling process is the owner of
* the file. Returns <code>false</code> on Windows.
+ *
+ * _file_name_ can be an IO object.
*/
static VALUE
@@ -1643,6 +1780,8 @@ rb_file_sticky_p(VALUE obj, VALUE fname)
*
* Returns <code>true</code> if the named files are identical.
*
+ * _file_1_ and _file_2_ can be an IO object.
+ *
* open("a", "w") {}
* p File.identical?("a", "a") #=> true
* p File.identical?("a", "./a") #=> true
@@ -1684,7 +1823,6 @@ rb_file_identical_p(VALUE obj, VALUE fname1, VALUE fname2)
st1.nFileIndexLow == st2.nFileIndexLow)
return Qtrue;
if (!f1 || !f2) return Qfalse;
- if (rb_w32_iswin95()) return Qfalse;
# else
FilePathValue(fname1);
fname1 = rb_str_new4(fname1);
@@ -1708,6 +1846,8 @@ rb_file_identical_p(VALUE obj, VALUE fname1, VALUE fname2)
* File.size(file_name) -> integer
*
* Returns the size of <code>file_name</code>.
+ *
+ * _file_name_ can be an IO object.
*/
static VALUE
@@ -1799,6 +1939,8 @@ rb_file_s_ftype(VALUE klass, VALUE fname)
*
* Returns the last access time for the named file as a Time object).
*
+ * _file_name_ can be an IO object.
+ *
* File.atime("testfile") #=> Wed Apr 09 08:51:48 CDT 2003
*
*/
@@ -1845,6 +1987,8 @@ rb_file_atime(VALUE obj)
*
* Returns the modification time for the named file as a Time object.
*
+ * _file_name_ can be an IO object.
+ *
* File.mtime("testfile") #=> Tue Apr 08 12:58:04 CDT 2003
*
*/
@@ -1892,6 +2036,8 @@ rb_file_mtime(VALUE obj)
* directory information about the file was changed, not the file
* itself).
*
+ * _file_name_ can be an IO object.
+ *
* Note that on Windows (NTFS), returns creation time (birth time).
*
* File.ctime("testfile") #=> Wed Apr 09 08:53:13 CDT 2003
@@ -1954,7 +2100,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);
@@ -2179,7 +2325,7 @@ lchown_internal(const char *path, VALUE pathv, void *arg)
/*
* call-seq:
- * file.lchown(owner_int, group_int, file_name,..) -> integer
+ * File.lchown(owner_int, group_int, file_name,..) -> integer
*
* Equivalent to <code>File::chown</code>, but does not follow symbolic
* links (so it will change the owner associated with the link, not the
@@ -2457,7 +2603,6 @@ rb_file_s_readlink(VALUE klass, VALUE path)
static VALUE
rb_readlink(VALUE path)
{
- char *buf;
int size = 100;
ssize_t rv;
VALUE v;
@@ -2465,21 +2610,20 @@ rb_readlink(VALUE path)
rb_secure(2);
FilePathValue(path);
path = rb_str_encode_ospath(path);
- buf = xmalloc(size);
- while ((rv = readlink(RSTRING_PTR(path), buf, size)) == size
+ v = rb_enc_str_new(0, size, rb_filesystem_encoding());
+ while ((rv = readlink(RSTRING_PTR(path), RSTRING_PTR(v), size)) == size
#ifdef _AIX
|| (rv < 0 && errno == ERANGE) /* quirky behavior of GPFS */
#endif
) {
+ rb_str_modify_expand(v, size);
size *= 2;
- buf = xrealloc(buf, size);
}
if (rv < 0) {
- xfree(buf);
+ rb_str_resize(v, 0);
rb_sys_fail_path(path);
}
- v = rb_filesystem_str_new(buf, rv);
- xfree(buf);
+ rb_str_resize(v, rv);
return v;
}
@@ -2588,7 +2732,7 @@ rb_file_s_umask(int argc, VALUE *argv)
omask = umask(NUM2INT(argv[0]));
}
else {
- rb_raise(rb_eArgError, "wrong number of arguments (%d for 0..1)", argc);
+ rb_check_arity(argc, 0, 1);
}
return INT2FIX(omask);
}
@@ -2643,6 +2787,7 @@ has_drive_letter(const char *buf)
}
}
+#ifndef _WIN32
static char*
getcwdofdrv(int drv)
{
@@ -2669,6 +2814,7 @@ getcwdofdrv(int drv)
}
return drvcwd;
}
+#endif
static inline int
not_same_drive(VALUE path, int drive)
@@ -2825,10 +2971,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;
@@ -2836,29 +2981,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__
@@ -2871,6 +2996,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)
@@ -2879,7 +3031,14 @@ append_fspath(VALUE result, VALUE fname, char *dir, rb_encoding **enc, rb_encodi
VALUE dirname = Qnil;
size_t dirlen = strlen(dir), buflen = rb_str_capacity(result);
- *enc = fsenc;
+ if (*enc != fsenc) {
+ rb_encoding *direnc = rb_enc_check(fname, dirname = rb_enc_str_new(dir, dirlen, fsenc));
+ if (direnc != fsenc) {
+ dirname = rb_str_conv_enc(dirname, fsenc, direnc);
+ RSTRING_GETMEM(dirname, cwdp, dirlen);
+ }
+ *enc = direnc;
+ }
do {buflen *= 2;} while (dirlen > buflen);
rb_str_resize(result, buflen);
buf = RSTRING_PTR(result);
@@ -2913,22 +3072,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");
@@ -3232,7 +3394,7 @@ rb_file_expand_path_internal(VALUE fname, VALUE dname, int abs_mode, int long_na
}
#endif /* _WIN32 */
-#define EXPAND_PATH_BUFFER() rb_enc_str_new(0, MAXPATHLEN + 2, rb_filesystem_encoding())
+#define EXPAND_PATH_BUFFER() rb_usascii_str_new(0, MAXPATHLEN + 2)
#define check_expand_path_args(fname, dname) \
(((fname) = rb_get_path(fname)), \
@@ -3254,7 +3416,6 @@ rb_file_expand_path(VALUE fname, VALUE dname)
VALUE
rb_file_expand_path_fast(VALUE fname, VALUE dname)
{
- check_expand_path_args(fname, dname);
return rb_file_expand_path_internal(fname, dname, 0, 0, EXPAND_PATH_BUFFER());
}
@@ -3264,15 +3425,26 @@ 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
@@ -3352,6 +3524,13 @@ realpath_rec(long *prefixlenp, VALUE *resolvedp, const char *unresolved, VALUE l
VALUE testpath = rb_str_dup(*resolvedp);
if (*prefixlenp < RSTRING_LEN(testpath))
rb_str_cat2(testpath, "/");
+#if defined(DOSISH_UNC) || defined(DOSISH_DRIVE_LETTER)
+ if (*prefixlenp > 1 && *prefixlenp == RSTRING_LEN(testpath)) {
+ const char *prefix = RSTRING_PTR(testpath);
+ const char *last = rb_enc_left_char_head(prefix, prefix + *prefixlenp - 1, prefix + *prefixlenp, enc);
+ if (!isdirsep(*last)) rb_str_cat2(testpath, "/");
+ }
+#endif
rb_str_cat(testpath, testname, testnamelen);
checkval = rb_hash_aref(loopcheck, testpath);
if (!NIL_P(checkval)) {
@@ -3367,7 +3546,11 @@ realpath_rec(long *prefixlenp, VALUE *resolvedp, const char *unresolved, VALUE l
struct stat sbuf;
int ret;
VALUE testpath2 = rb_str_encode_ospath(testpath);
+#ifdef __native_client__
+ ret = stat(RSTRING_PTR(testpath2), &sbuf);
+#else
ret = lstat(RSTRING_PTR(testpath2), &sbuf);
+#endif
if (ret == -1) {
if (errno == ENOENT) {
if (strict || !last || *unresolved_firstsep)
@@ -3415,6 +3598,13 @@ realpath_rec(long *prefixlenp, VALUE *resolvedp, const char *unresolved, VALUE l
}
}
+#ifdef __native_client__
+VALUE
+rb_realpath_internal(VALUE basedir, VALUE path, int strict)
+{
+ return path;
+}
+#else
VALUE
rb_realpath_internal(VALUE basedir, VALUE path, int strict)
{
@@ -3488,6 +3678,7 @@ rb_realpath_internal(VALUE basedir, VALUE path, int strict)
OBJ_TAINT(resolved);
return resolved;
}
+#endif
/*
* call-seq:
@@ -3575,7 +3766,7 @@ ruby_enc_find_basename(const char *name, long *baselen, long *alllen, rb_encodin
#endif
long f = 0, n = -1;
- end = name + *alllen;
+ end = name + (alllen ? (size_t)*alllen : strlen(name));
name = skipprefix(name, end, enc);
#if defined DOSISH_DRIVE_LETTER || defined DOSISH_UNC
root = name;
@@ -3634,8 +3825,9 @@ ruby_enc_find_basename(const char *name, long *baselen, long *alllen, rb_encodin
* File.basename(file_name [, suffix] ) -> base_name
*
* Returns the last component of the filename given in <i>file_name</i>,
- * which must be formed using forward slashes (``<code>/</code>'')
- * regardless of the separator used on the local file system. If
+ * which can be formed using both <code>File::SEPARATOR</code> and
+ * <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.
*
@@ -3652,16 +3844,14 @@ rb_file_s_basename(int argc, VALUE *argv)
rb_encoding *enc;
if (rb_scan_args(argc, argv, "11", &fname, &fext) == 2) {
- rb_encoding *enc;
StringValue(fext);
- if (!rb_enc_asciicompat(enc = rb_enc_get(fext))) {
- rb_raise(rb_eEncCompatError, "ascii incompatible character encodings: %s",
- rb_enc_name(enc));
- }
+ enc = check_path_encoding(fext);
}
FilePathStringValue(fname);
- if (!NIL_P(fext)) enc = rb_enc_check(fname, fext);
- else enc = rb_enc_get(fname);
+ if (NIL_P(fext) || !(enc = rb_enc_compatible(fname, fext))) {
+ enc = rb_enc_get(fname);
+ fext = Qnil;
+ }
if ((n = RSTRING_LEN(fname)) == 0 || !*(name = RSTRING_PTR(fname)))
return rb_str_new_shared(fname);
@@ -3671,12 +3861,7 @@ rb_file_s_basename(int argc, VALUE *argv)
f = n;
}
else {
- rb_encoding *fenc = rb_enc_get(fext);
const char *fp;
- if (enc != fenc &&
- rb_enc_str_coderange(fext) != ENC_CODERANGE_7BIT) {
- fext = rb_str_conv_enc(fext, fenc, enc);
- }
fp = StringValueCStr(fext);
if (!(f = rmext(p, f, n, fp, RSTRING_LEN(fext), enc))) {
f = n;
@@ -3694,12 +3879,12 @@ rb_file_s_basename(int argc, VALUE *argv)
/*
* call-seq:
- * File.dirname(file_name ) -> dir_name
+ * File.dirname(file_name) -> dir_name
*
* Returns all components of the filename given in <i>file_name</i>
- * except the last one. The filename must be formed using forward
- * slashes (``<code>/</code>'') regardless of the separator used on the
- * local file system.
+ * except the last one. The filename can be formed using both
+ * <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"
*/
@@ -3822,13 +4007,21 @@ ruby_enc_find_extname(const char *name, long *len, rb_encoding *enc)
* call-seq:
* File.extname(path) -> string
*
- * Returns the extension (the portion of file name in <i>path</i>
- * after the period).
+ * Returns the extension (the portion of file name in +path+
+ * starting from the last period).
+ *
+ * If +path+ is a dotfile, or starts with a period, then the starting
+ * dot is not dealt with the start of the extension.
+ *
+ * An empty string will also be returned when the period is the last character
+ * in +path+.
*
* File.extname("test.rb") #=> ".rb"
* File.extname("a/b/d/test.rb") #=> ".rb"
+ * File.extname("foo.") #=> ""
* File.extname("test") #=> ""
* File.extname(".profile") #=> ""
+ * File.extname(".profile.sh") #=> ".sh"
*
*/
@@ -3903,13 +4096,16 @@ rb_file_join(VALUE ary, VALUE sep)
long len, i;
VALUE result, tmp;
const char *name, *tail;
+ int checked = TRUE;
+ rb_encoding *enc;
if (RARRAY_LEN(ary) == 0) return rb_str_new(0, 0);
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);
}
else {
@@ -3918,14 +4114,17 @@ rb_file_join(VALUE ary, VALUE sep)
}
if (!NIL_P(sep)) {
StringValue(sep);
- len += RSTRING_LEN(sep) * RARRAY_LEN(ary) - 1;
+ len += RSTRING_LEN(sep) * (RARRAY_LEN(ary) - 1);
}
result = rb_str_buf_new(len);
+ 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);
+ StringValueCStr(tmp);
break;
case T_ARRAY:
if (ary == tmp) {
@@ -3941,9 +4140,9 @@ rb_file_join(VALUE ary, VALUE sep)
break;
default:
FilePathStringValue(tmp);
+ checked = FALSE;
}
- name = StringValueCStr(result);
- len = RSTRING_LEN(result);
+ RSTRING_GETMEM(result, name, len);
if (i == 0) {
rb_enc_copy(result, tmp);
}
@@ -3953,11 +4152,16 @@ rb_file_join(VALUE ary, VALUE sep)
rb_str_set_len(result, tail - name);
}
else if (!*tail) {
+ enc = rb_enc_check(result, sep);
rb_str_buf_append(result, sep);
+ rb_enc_associate(result, enc);
}
}
+ enc = rb_enc_check(result, tmp);
rb_str_buf_append(result, tmp);
+ rb_enc_associate(result, enc);
}
+ RBASIC_SET_CLASS_RAW(result, rb_cString);
return result;
}
@@ -3998,10 +4202,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
@@ -4011,7 +4221,7 @@ rb_file_s_truncate(VALUE klass, VALUE path, VALUE len)
{
int tmpfd;
- if ((tmpfd = open(StringValueCStr(path), 0)) < 0) {
+ if ((tmpfd = rb_cloexec_open(StringValueCStr(path), 0, 0)) < 0) {
rb_sys_fail_path(path);
}
rb_update_max_fd(tmpfd);
@@ -4023,6 +4233,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
@@ -4047,15 +4258,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);
@@ -4064,6 +4281,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
@@ -4084,7 +4302,6 @@ rb_file_truncate(VALUE obj, VALUE len)
#ifdef __CYGWIN__
#include <winerror.h>
-extern unsigned long __attribute__((stdcall)) GetLastError(void);
#endif
static VALUE
@@ -4106,7 +4323,7 @@ rb_thread_flock(void *data)
/*
* call-seq:
- * file.flock (locking_constant )-> 0 or false
+ * file.flock(locking_constant) -> 0 or false
*
* Locks or unlocks a file according to <i>locking_constant</i> (a
* logical <em>or</em> of the values in the table below).
@@ -4153,6 +4370,7 @@ rb_file_flock(VALUE obj, VALUE operation)
{
rb_io_t *fptr;
int op[2], op1;
+ struct timeval time;
rb_secure(2);
op[1] = op1 = NUM2INT(operation);
@@ -4160,7 +4378,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) {
@@ -4170,7 +4388,10 @@ rb_file_flock(VALUE obj, VALUE operation)
case EWOULDBLOCK:
#endif
if (op1 & LOCK_NB) return Qfalse;
- rb_thread_polling();
+
+ time.tv_sec = 0;
+ time.tv_usec = 100 * 1000; /* 0.1 sec */
+ rb_thread_wait_for(time);
rb_io_check_closed(fptr);
continue;
@@ -4195,15 +4416,10 @@ test_check(int n, int argc, VALUE *argv)
rb_secure(2);
n+=1;
- if (n != argc) rb_raise(rb_eArgError, "wrong number of arguments (%d for %d)", argc, n);
+ rb_check_arity(argc, n, n);
for (i=1; i<n; i++) {
- switch (TYPE(argv[i])) {
- case T_STRING:
- default:
+ if (!RB_TYPE_P(argv[i], T_FILE)) {
FilePathValue(argv[i]);
- break;
- case T_FILE:
- break;
}
}
}
@@ -4212,15 +4428,14 @@ test_check(int n, int argc, VALUE *argv)
/*
* call-seq:
- * test(int_cmd, file1 [, file2] ) -> obj
+ * test(cmd, file1 [, file2] ) -> obj
*
- * Uses the integer <i>aCmd</i> to perform various tests on
- * <i>file1</i> (first table below) or on <i>file1</i> and
- * <i>file2</i> (second table).
+ * Uses the integer +cmd+ to perform various tests on +file1+ (first
+ * table below) or on +file1+ and +file2+ (second table).
*
* File tests on a single file:
*
- * Test Returns Meaning
+ * Cmd Returns Meaning
* "A" | Time | Last access time for file1
* "b" | boolean | True if file1 is a block device
* "c" | boolean | True if file1 is a character device
@@ -4258,7 +4473,7 @@ test_check(int n, int argc, VALUE *argv)
* | | the real uid/gid
* "z" | boolean | True if file1 exists and has a zero length
*
- * Tests that take two files:
+ * Tests that take two files:
*
* "-" | boolean | True if file1 and file2 are identical
* "=" | boolean | True if the modification times of file1
@@ -4274,9 +4489,18 @@ rb_f_test(int argc, VALUE *argv)
{
int cmd;
- if (argc == 0) rb_raise(rb_eArgError, "wrong number of arguments (0 for 2..3)");
+ if (argc == 0) rb_check_arity(argc, 2, 3);
cmd = NUM2CHR(argv[0]);
- if (cmd == 0) goto unknown;
+ if (cmd == 0) {
+ unknown:
+ /* unknown command */
+ if (ISPRINT(cmd)) {
+ rb_raise(rb_eArgError, "unknown command '%s%c'", cmd == '\'' || cmd == '\\' ? "\\" : "", cmd);
+ }
+ else {
+ rb_raise(rb_eArgError, "unknown command \"\\x%02X\"", cmd);
+ }
+ }
if (strchr("bcdefgGkloOprRsSuwWxXz", cmd)) {
CHECK(1);
switch (cmd) {
@@ -4395,15 +4619,7 @@ rb_f_test(int argc, VALUE *argv)
return Qfalse;
}
}
- unknown:
- /* unknown command */
- if (ISPRINT(cmd)) {
- rb_raise(rb_eArgError, "unknown command '%s%c'", cmd == '\'' || cmd == '\\' ? "\\" : "", cmd);
- }
- else {
- rb_raise(rb_eArgError, "unknown command \"\\x%02X\"", cmd);
- }
- return Qnil; /* not reached */
+ goto unknown;
}
@@ -4464,12 +4680,7 @@ rb_stat_init_copy(VALUE copy, VALUE orig)
{
struct stat *nst;
- if (copy == orig) return orig;
- rb_check_frozen(copy);
- /* need better argument type check */
- if (!rb_obj_is_instance_of(orig, rb_obj_class(copy))) {
- rb_raise(rb_eTypeError, "wrong argument class");
- }
+ if (!OBJ_INIT_COPY(copy, orig)) return copy;
if (DATA_PTR(copy)) {
xfree(DATA_PTR(copy));
DATA_PTR(copy) = 0;
@@ -5162,11 +5373,14 @@ rb_path_check(const char *path)
}
#ifndef _WIN32
+#ifdef __native_client__
+__attribute__((noinline))
+#endif
int
rb_file_load_ok(const char *path)
{
int ret = 1;
- int fd = open(path, O_RDONLY);
+ int fd = rb_cloexec_open(path, O_RDONLY, 0);
if (fd == -1) return 0;
rb_update_max_fd(fd);
#if !defined DOSISH
@@ -5193,7 +5407,7 @@ is_explicit_relative(const char *path)
static VALUE
copy_path_class(VALUE path, VALUE orig)
{
- RBASIC(path)->klass = rb_obj_class(orig);
+ RBASIC_SET_CLASS(path, rb_obj_class(orig));
OBJ_FREEZE(path);
return path;
}
@@ -5241,22 +5455,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_load_path();
+ 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;
@@ -5265,7 +5475,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);
}
@@ -5306,18 +5516,14 @@ 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_load_path();
+ RB_GC_GUARD(load_path) = rb_get_expanded_load_path();
if (load_path) {
long i;
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);
@@ -5388,6 +5594,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
@@ -5398,7 +5606,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);
@@ -5460,16 +5668,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 */
@@ -5486,14 +5697,88 @@ Init_File(void)
rb_define_method(rb_cFile, "flock", rb_file_flock, 1);
+ /*
+ * Document-module: File::Constants
+ *
+ * File::Constants provides file-related constants. All possible
+ * file constants are listed in the documentation but they may not all
+ * be present on your platform.
+ *
+ * If the underlying platform doesn't define a constant the corresponding
+ * Ruby constant is not defined.
+ *
+ * Your platform documentations (e.g. man open(2)) may describe more
+ * detailed information.
+ */
rb_mFConst = rb_define_module_under(rb_cFile, "Constants");
rb_include_module(rb_cIO, rb_mFConst);
- rb_file_const("LOCK_SH", INT2FIX(LOCK_SH));
- rb_file_const("LOCK_EX", INT2FIX(LOCK_EX));
- rb_file_const("LOCK_UN", INT2FIX(LOCK_UN));
- rb_file_const("LOCK_NB", INT2FIX(LOCK_NB));
- rb_file_const("NULL", rb_obj_freeze(rb_usascii_str_new2(null_device)));
+ /* open for reading only */
+ rb_define_const(rb_mFConst, "RDONLY", INT2FIX(O_RDONLY));
+ /* open for writing only */
+ rb_define_const(rb_mFConst, "WRONLY", INT2FIX(O_WRONLY));
+ /* open for reading and writing */
+ rb_define_const(rb_mFConst, "RDWR", INT2FIX(O_RDWR));
+ /* append on each write */
+ rb_define_const(rb_mFConst, "APPEND", INT2FIX(O_APPEND));
+ /* create file if it does not exist */
+ rb_define_const(rb_mFConst, "CREAT", INT2FIX(O_CREAT));
+ /* error if CREAT and the file exists */
+ rb_define_const(rb_mFConst, "EXCL", INT2FIX(O_EXCL));
+#if defined(O_NDELAY) || defined(O_NONBLOCK)
+# ifndef O_NONBLOCK
+# define O_NONBLOCK O_NDELAY
+# endif
+ /* do not block on open or for data to become available */
+ rb_define_const(rb_mFConst, "NONBLOCK", INT2FIX(O_NONBLOCK));
+#endif
+ /* truncate size to 0 */
+ rb_define_const(rb_mFConst, "TRUNC", INT2FIX(O_TRUNC));
+#ifdef O_NOCTTY
+ /* not to make opened IO the controlling terminal device */
+ rb_define_const(rb_mFConst, "NOCTTY", INT2FIX(O_NOCTTY));
+#endif
+#ifndef O_BINARY
+# define O_BINARY 0
+#endif
+ /* disable line code conversion */
+ rb_define_const(rb_mFConst, "BINARY", INT2FIX(O_BINARY));
+#ifdef O_SYNC
+ /* any write operation perform synchronously */
+ rb_define_const(rb_mFConst, "SYNC", INT2FIX(O_SYNC));
+#endif
+#ifdef O_DSYNC
+ /* any write operation perform synchronously except some meta data */
+ rb_define_const(rb_mFConst, "DSYNC", INT2FIX(O_DSYNC));
+#endif
+#ifdef O_RSYNC
+ /* any read operation perform synchronously. used with SYNC or DSYNC. */
+ rb_define_const(rb_mFConst, "RSYNC", INT2FIX(O_RSYNC));
+#endif
+#ifdef O_NOFOLLOW
+ /* do not follow symlinks */
+ rb_define_const(rb_mFConst, "NOFOLLOW", INT2FIX(O_NOFOLLOW)); /* FreeBSD, Linux */
+#endif
+#ifdef O_NOATIME
+ /* do not change atime */
+ rb_define_const(rb_mFConst, "NOATIME", INT2FIX(O_NOATIME)); /* Linux */
+#endif
+#ifdef O_DIRECT
+ /* Try to minimize cache effects of the I/O to and from this file. */
+ rb_define_const(rb_mFConst, "DIRECT", INT2FIX(O_DIRECT));
+#endif
+
+ /* shared lock. see File#flock */
+ rb_define_const(rb_mFConst, "LOCK_SH", INT2FIX(LOCK_SH));
+ /* exclusive lock. see File#flock */
+ rb_define_const(rb_mFConst, "LOCK_EX", INT2FIX(LOCK_EX));
+ /* unlock. see File#flock */
+ rb_define_const(rb_mFConst, "LOCK_UN", INT2FIX(LOCK_UN));
+ /* non-blocking lock. used with LOCK_SH or LOCK_EX. see File#flock */
+ rb_define_const(rb_mFConst, "LOCK_NB", INT2FIX(LOCK_NB));
+
+ /* Name of the null device */
+ rb_define_const(rb_mFConst, "NULL", rb_obj_freeze(rb_usascii_str_new2(null_device)));
rb_define_method(rb_cFile, "path", rb_file_path, 0);
rb_define_method(rb_cFile, "to_path", rb_file_path, 0);
@@ -5555,8 +5840,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 0f84e22966..5478ddd54e 100644
--- a/gc.c
+++ b/gc.c
@@ -15,18 +15,48 @@
#include "ruby/st.h"
#include "ruby/re.h"
#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"
#include "gc.h"
#include "constant.h"
#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 malloc_usable_size(a) _msize(a)
+# endif
+#else
+# ifdef HAVE_MALLOC_H
+# include <malloc.h>
+# elif defined(HAVE_MALLOC_NP_H)
+# include <malloc_np.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
@@ -34,244 +64,242 @@
#ifdef HAVE_SYS_RESOURCE_H
#include <sys/resource.h>
#endif
+#if defined(__native_client__) && defined(NACL_NEWLIB)
+# include "nacl/resource.h"
+# undef HAVE_POSIX_MEMALIGN
+# undef HAVE_MEMALIGN
-#if defined _WIN32 || defined __CYGWIN__
-#include <windows.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) /* empty */
-# define VALGRIND_MAKE_MEM_UNDEFINED(p, n) /* empty */
+#if defined _WIN32 || defined __CYGWIN__
+#include <windows.h>
+#elif defined(HAVE_POSIX_MEMALIGN)
+#elif defined(HAVE_MEMALIGN)
+#include <malloc.h>
#endif
#define rb_setjmp(env) RUBY_SETJMP(env)
#define rb_jmp_buf rb_jmpbuf_t
-/* Make alloca work the best possible way. */
-#ifdef __GNUC__
-# ifndef atarist
-# ifndef alloca
-# define alloca __builtin_alloca
-# endif
-# endif /* atarist */
-#else
-# ifdef HAVE_ALLOCA_H
-# include <alloca.h>
-# else
-# ifdef _AIX
- #pragma alloca
-# else
-# ifndef alloca /* predefined by HP cc +Olibcalls */
-void *alloca ();
-# endif
-# endif /* AIX */
-# endif /* HAVE_ALLOCA_H */
-#endif /* __GNUC__ */
-
-#ifndef GC_MALLOC_LIMIT
-#define GC_MALLOC_LIMIT 8000000
-#endif
-#define HEAP_MIN_SLOTS 10000
-#define FREE_MIN 4096
+#if defined(HAVE_RB_GC_GUARDED_PTR) && HAVE_RB_GC_GUARDED_PTR
+volatile VALUE *
+rb_gc_guarded_ptr(volatile VALUE *ptr)
+{
+ return ptr;
+}
+#endif
+
+#ifndef GC_HEAP_MIN_FREE_SLOTS
+#define GC_HEAP_MIN_FREE_SLOTS 4096
+#endif
+#ifndef GC_HEAP_MIN_SLOTS
+#define GC_HEAP_MIN_SLOTS 10000
+#endif
+#ifndef GC_HEAP_GROWTH_FACTOR
+#define GC_HEAP_GROWTH_FACTOR 1.8
+#endif
+#ifndef GC_HEAP_GROWTH_MAX
+#define GC_HEAP_GROWTH_MAX 0 /* 0 is disable */
+#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_OLDSPACE_LIMIT_MIN
+#define GC_OLDSPACE_LIMIT_MIN (16 * 1024 * 1024 /* 16MB */)
+#endif
+#ifndef GC_OLDSPACE_LIMIT_GROWTH_FACTOR
+#define GC_OLDSPACE_LIMIT_GROWTH_FACTOR 1.2
+#endif
+#ifndef GC_OLDSPACE_LIMIT_MAX
+#define GC_OLDSPACE_LIMIT_MAX (128 * 1024 * 1024 /* 128MB */)
+#endif
typedef struct {
- unsigned int initial_malloc_limit;
- unsigned int initial_heap_min_slots;
- unsigned int initial_free_min;
- int gc_stress;
+ unsigned int heap_min_slots;
+ unsigned int heap_min_free_slots;
+ double growth_factor;
+ unsigned int growth_max;
+ unsigned int malloc_limit_min;
+ unsigned int malloc_limit_max;
+ double malloc_limit_growth_factor;
+ unsigned int oldspace_limit_min;
+ unsigned int oldspace_limit_max;
+ double oldspace_limit_growth_factor;
+#if defined(ENABLE_VM_OBJSPACE) && ENABLE_VM_OBJSPACE
+ VALUE gc_stress;
+#endif
} ruby_gc_params_t;
-ruby_gc_params_t initial_params = {
- GC_MALLOC_LIMIT,
- HEAP_MIN_SLOTS,
- FREE_MIN,
+static ruby_gc_params_t gc_params = {
+ GC_HEAP_MIN_SLOTS,
+ GC_HEAP_MIN_FREE_SLOTS,
+ GC_HEAP_GROWTH_FACTOR,
+ GC_HEAP_GROWTH_MAX,
+ GC_MALLOC_LIMIT_MIN,
+ GC_MALLOC_LIMIT_MAX,
+ GC_MALLOC_LIMIT_GROWTH_FACTOR,
+ GC_OLDSPACE_LIMIT_MIN,
+ GC_OLDSPACE_LIMIT_MAX,
+ GC_OLDSPACE_LIMIT_GROWTH_FACTOR,
#if defined(ENABLE_VM_OBJSPACE) && ENABLE_VM_OBJSPACE
FALSE,
#endif
};
-#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 SIZEOF_LONG == SIZEOF_VOIDP
-# define nonspecial_obj_id(obj) (VALUE)((SIGNED_VALUE)(obj)|FIXNUM_FLAG)
-# define obj_id_to_ref(objid) ((objid) ^ FIXNUM_FLAG) /* unset FIXNUM_FLAG */
-#elif SIZEOF_LONG_LONG == SIZEOF_VOIDP
-# define nonspecial_obj_id(obj) LL2NUM((SIGNED_VALUE)(obj) / 2)
-# define obj_id_to_ref(objid) (FIXNUM_P(objid) ? \
- ((objid) ^ FIXNUM_FLAG) : (NUM2PTR(objid) << 1))
-#else
-# error not supported
+#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
-int ruby_gc_debug_indent = 0;
+/* RGENGC_CHECK_MODE
+ * 0: disable all assertions
+ * 1: enable assertions (to debug RGenGC)
+ * 2: enable bits check (for debugging)
+ * 3: show all references
+ */
+#ifndef RGENGC_CHECK_MODE
+#define RGENGC_CHECK_MODE 0
+#endif
-/* for GC profile */
+/* 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_THREEGEN
+ * Enable/disable three gen GC.
+ * 0: Infant gen -> Old gen
+ * 1: Infant gen -> Young -> Old gen
+ */
+#ifndef RGENGC_THREEGEN
+#define RGENGC_THREEGEN 0
+#endif
+
+/* RGENGC_ESTIMATE_OLDSPACE
+ * Enable/disable to estimate increase size of oldspace.
+ * If estimation exceeds threashold, then will invoke full GC.
+ * 0: disable estimation.
+ * 1: enable estimation.
+ */
+#ifndef RGENGC_ESTIMATE_OLDSPACE
+#define RGENGC_ESTIMATE_OLDSPACE 1
+#endif
+
+#else /* USE_RGENGC */
+
+#define RGENGC_DEBUG 0
+#define RGENGC_CHECK_MODE 0
+#define RGENGC_PROFILE 0
+#define RGENGC_THREEGEN 0
+#define RGENGC_ESTIMATE_OLDSPACE 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_LAZY_SWEEP
+#define GC_ENABLE_LAZY_SWEEP 1
+#endif
+#ifndef CALC_EXACT_MALLOC_SIZE
+#define CALC_EXACT_MALLOC_SIZE 0
+#endif
+#ifndef CALC_EXACT_MALLOC_SIZE_CHECK_OLD_SIZE
+#define CALC_EXACT_MALLOC_SIZE_CHECK_OLD_SIZE 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_RESCAN = 0x008,
+ GPR_FLAG_MAJOR_BY_STRESS = 0x010,
+ GPR_FLAG_MAJOR_MASK = 0x01f,
+
+ /* gc reason */
+ GPR_FLAG_NEWOBJ = 0x020,
+ GPR_FLAG_MALLOC = 0x040,
+ GPR_FLAG_METHOD = 0x080,
+ GPR_FLAG_CAPI = 0x100,
+ GPR_FLAG_STRESS = 0x200,
+
+ /* others */
+ GPR_FLAG_IMMEDIATE_SWEEP = 0x400,
+ GPR_FLAG_HAVE_FINALIZE = 0x800
+
+} gc_profile_record_flag;
+
typedef struct gc_profile_record {
+ int flags;
+
double gc_time;
- double gc_mark_time;
- double gc_sweep_time;
double gc_invoke_time;
- size_t heap_use_slots;
- size_t heap_live_objects;
- size_t heap_free_objects;
size_t heap_total_objects;
size_t heap_use_size;
size_t heap_total_size;
- int have_finalize;
- int is_marked;
+#if GC_PROFILE_MORE_DETAIL
+ double gc_mark_time;
+ double gc_sweep_time;
+
+ size_t heap_use_pages;
+ size_t heap_live_objects;
+ size_t heap_free_objects;
size_t allocate_increase;
size_t allocate_limit;
-} gc_profile_record;
-static double
-getrusage_time(void)
-{
-#ifdef RUSAGE_SELF
- struct rusage usage;
- struct timeval time;
- getrusage(RUSAGE_SELF, &usage);
- time = usage.ru_utime;
- return time.tv_sec + time.tv_usec * 1e-6;
-#elif defined _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)
- {
- return 0.0;
- }
- memcpy(&ui, &user_time, sizeof(FILETIME));
- q = ui.QuadPart / 10L;
- t = (DWORD)(q % 1000000L) * 1e-6;
- q /= 1000000L;
-#ifdef __GNUC__
- t += q;
-#else
- t += (double)(DWORD)(q >> 16) * (1 << 16);
- t += (DWORD)q & ~(~0 << 16);
+ double prepare_time;
+ size_t removing_objects;
+ size_t empty_objects;
+#if GC_PROFILE_DETAIL_MEMORY
+ long maxrss;
+ long minflt;
+ long majflt;
#endif
- return t;
-#else
- return 0.0;
#endif
-}
-
-#define GC_PROF_TIMER_START do {\
- if (objspace->profile.run) {\
- if (!objspace->profile.record) {\
- objspace->profile.size = 1000;\
- 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);\
- gc_time = getrusage_time();\
- objspace->profile.record[count].gc_invoke_time = gc_time - objspace->profile.invoke_time;\
- }\
- } while(0)
-
-#define GC_PROF_TIMER_STOP(marked) do {\
- if (objspace->profile.run) {\
- gc_time = getrusage_time() - gc_time;\
- if (gc_time < 0) gc_time = 0;\
- objspace->profile.record[count].gc_time = gc_time;\
- objspace->profile.record[count].is_marked = !!(marked);\
- GC_PROF_SET_HEAP_INFO(objspace->profile.record[count]);\
- objspace->profile.count++;\
- }\
- } while(0)
-
-#if GC_PROFILE_MORE_DETAIL
-#define INIT_GC_PROF_PARAMS double gc_time = 0, sweep_time = 0;\
- size_t count = objspace->profile.count, total = 0, live = 0
-
-#define GC_PROF_MARK_TIMER_START double mark_time = 0;\
- do {\
- if (objspace->profile.run) {\
- mark_time = getrusage_time();\
- }\
- } while(0)
-
-#define GC_PROF_MARK_TIMER_STOP do {\
- if (objspace->profile.run) {\
- mark_time = getrusage_time() - mark_time;\
- if (mark_time < 0) mark_time = 0;\
- objspace->profile.record[objspace->profile.count].gc_mark_time = mark_time;\
- }\
- } while(0)
-
-#define GC_PROF_SWEEP_TIMER_START do {\
- if (objspace->profile.run) {\
- sweep_time = getrusage_time();\
- }\
- } while(0)
-
-#define GC_PROF_SWEEP_TIMER_STOP do {\
- if (objspace->profile.run) {\
- sweep_time = getrusage_time() - sweep_time;\
- if (sweep_time < 0) sweep_time = 0;\
- objspace->profile.record[count].gc_sweep_time = sweep_time;\
- }\
- } while(0)
-#define GC_PROF_SET_MALLOC_INFO do {\
- if (objspace->profile.run) {\
- gc_profile_record *record = &objspace->profile.record[objspace->profile.count];\
- record->allocate_increase = malloc_increase;\
- record->allocate_limit = malloc_limit; \
- }\
- } while(0)
-#define GC_PROF_SET_HEAP_INFO(record) do {\
- live = objspace->heap.live_num;\
- total = heaps_used * 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);\
- } while(0)
-#define GC_PROF_INC_LIVE_NUM objspace->heap.live_num++
-#define GC_PROF_DEC_LIVE_NUM objspace->heap.live_num--
-#else
-#define INIT_GC_PROF_PARAMS double gc_time = 0;\
- size_t count = objspace->profile.count, total = 0, live = 0
-#define GC_PROF_MARK_TIMER_START
-#define GC_PROF_MARK_TIMER_STOP
-#define GC_PROF_SWEEP_TIMER_START
-#define GC_PROF_SWEEP_TIMER_STOP
-#define GC_PROF_SET_MALLOC_INFO
-#define GC_PROF_SET_HEAP_INFO(record) do {\
- live = objspace->heap.live_num;\
- 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);\
- } while(0)
-#define GC_PROF_INC_LIVE_NUM
-#define GC_PROF_DEC_LIVE_NUM
+#if CALC_EXACT_MALLOC_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;
#if defined(_MSC_VER) || defined(__BORLANDC__) || defined(__CYGWIN__)
#pragma pack(push, 1) /* magic for reducing sizeof(RVALUE): 24 -> 20 */
@@ -300,10 +328,16 @@ typedef struct RVALUE {
struct RMatch match;
struct RRational rational;
struct RComplex complex;
+ struct {
+ struct RBasic basic;
+ VALUE v1;
+ VALUE v2;
+ VALUE v3;
+ } values;
} as;
-#ifdef GC_DEBUG
+#if GC_DEBUG
const char *file;
- int line;
+ VALUE line;
#endif
} RVALUE;
@@ -311,18 +345,20 @@ typedef struct RVALUE {
#pragma pack(pop)
#endif
-struct heaps_slot {
- void *membase;
- RVALUE *slot;
- size_t limit;
- struct heaps_slot *next;
- struct heaps_slot *prev;
+typedef uintptr_t bits_t;
+enum {
+ BITS_SIZE = sizeof(bits_t),
+ BITS_BITLENGTH = ( BITS_SIZE * CHAR_BIT )
};
-struct sorted_heaps_slot {
- RVALUE *start;
- RVALUE *end;
- struct heaps_slot *slot;
+struct heap_page_header {
+ struct heap_page *page;
+};
+
+struct heap_page_body {
+ struct heap_page_header header;
+ /* char gap[]; */
+ /* RVALUE values[]; */
};
struct gc_list {
@@ -346,7 +382,15 @@ typedef struct mark_stack {
size_t unused_cache_size;
} mark_stack_t;
-#define CALC_EXACT_MALLOC_SIZE 0
+typedef struct rb_heap_struct {
+ struct heap_page *pages;
+ struct heap_page *free_pages;
+ struct heap_page *using_page;
+ struct heap_page *sweep_pages;
+ RVALUE *freelist;
+ size_t used; /* total page count in a heap */
+ size_t limit;
+} rb_heap_t;
typedef struct rb_objspace {
struct {
@@ -357,970 +401,2617 @@ typedef struct rb_objspace {
size_t allocations;
#endif
} malloc_params;
+
+ rb_heap_t eden_heap;
+ rb_heap_t tomb_heap; /* heap for zombies and ghosts */
+
struct {
- size_t increment;
- struct heaps_slot *ptr;
- struct heaps_slot *sweep_slots;
- struct sorted_heaps_slot *sorted;
- size_t length;
+ struct heap_page **sorted;
size_t used;
- RVALUE *freelist;
+ size_t length;
RVALUE *range[2];
- RVALUE *freed;
- size_t live_num;
- size_t free_num;
- size_t free_min;
+
+ size_t limit;
+ size_t swept_num;
+ size_t increment;
+
+ size_t min_free_slots;
+ size_t max_free_slots;
+
+ /* final */
size_t final_num;
- size_t do_heap_free;
- } heap;
+ RVALUE *deferred_final;
+ } heap_pages;
+
struct {
int dont_gc;
int dont_lazy_sweep;
int during_gc;
+ rb_atomic_t finalizing;
} flags;
- struct {
- st_table *table;
- RVALUE *deferred;
- } final;
+ st_table *finalizer_table;
mark_stack_t mark_stack;
struct {
int run;
- gc_profile_record *record;
- size_t count;
+ 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 generated_normal_object_count;
+ size_t generated_shady_object_count;
+ size_t shade_operation_count;
+ size_t promote_infant_count;
+#if RGENGC_THREEGEN
+ size_t promote_young_count;
+#endif
+ size_t remembered_normal_object_count;
+ size_t remembered_shady_object_count;
+
+#if RGENGC_PROFILE >= 2
+ size_t generated_normal_object_count_types[RUBY_T_MASK];
+ size_t generated_shady_object_count_types[RUBY_T_MASK];
+ size_t shade_operation_count_types[RUBY_T_MASK];
+ size_t promote_infant_types[RUBY_T_MASK];
+#if RGENGC_THREEGEN
+ size_t promote_young_types[RUBY_T_MASK];
+#endif
+ size_t remembered_normal_object_count_types[RUBY_T_MASK];
+ size_t remembered_shady_object_count_types[RUBY_T_MASK];
+#endif
+#endif /* RGENGC_PROFILE */
+#endif /* USE_RGENGC */
+
+ /* temporary profiling space */
+ double gc_sweep_start_time;
+ size_t total_allocated_object_num_at_gc_start;
+ size_t heap_used_at_gc_start;
+
+ /* basic statistics */
+ size_t count;
+ size_t total_allocated_object_num;
+ size_t total_freed_object_num;
} profile;
struct gc_list *global_list;
- size_t count;
- int gc_stress;
+ rb_event_flag_t hook_events; /* this place may be affinity with memory cache */
+ VALUE gc_stress;
+
+ struct mark_func_data_struct {
+ void *data;
+ void (*mark_func)(VALUE v, void *data);
+ } *mark_func_data;
+
+#if USE_RGENGC
+ struct {
+ int during_minor_gc;
+ int parent_object_is_old;
+
+ int need_major_gc;
+ size_t remembered_shady_object_count;
+ size_t remembered_shady_object_limit;
+ size_t old_object_count;
+ size_t old_object_limit;
+#if RGENGC_THREEGEN
+ size_t young_object_count;
+#endif
+
+#if RGENGC_ESTIMATE_OLDSPACE
+ size_t oldspace_increase;
+ size_t oldspace_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;
+ RVALUE *freelist;
+ RVALUE *start;
+ size_t final_num;
+ size_t limit;
+ struct heap_page *next;
+ struct heap_page *prev;
+ struct heap_page *free_next;
+ rb_heap_t *heap;
+ int before_sweep;
+
+ bits_t mark_bits[HEAP_BITMAP_LIMIT];
+#if USE_RGENGC
+ bits_t rememberset_bits[HEAP_BITMAP_LIMIT];
+ bits_t oldgen_bits[HEAP_BITMAP_LIMIT];
+#endif
+};
+
+#define GET_PAGE_BODY(x) ((struct heap_page_body *)((bits_t)(x) & ~(HEAP_ALIGN_MASK)))
+#define GET_PAGE_HEADER(x) (&GET_PAGE_BODY(x)->header)
+#define GET_HEAP_PAGE(x) (GET_PAGE_HEADER(x)->page)
+#define GET_HEAP_MARK_BITS(x) (&GET_HEAP_PAGE(x)->mark_bits[0])
+#define GET_HEAP_REMEMBERSET_BITS(x) (&GET_HEAP_PAGE(x)->rememberset_bits[0])
+#define GET_HEAP_OLDGEN_BITS(x) (&GET_HEAP_PAGE(x)->oldgen_bits[0])
+#define NUM_IN_PAGE(p) (((bits_t)(p) & HEAP_ALIGN_MASK)/sizeof(RVALUE))
+#define BITMAP_INDEX(p) (NUM_IN_PAGE(p) / BITS_BITLENGTH )
+#define BITMAP_OFFSET(p) (NUM_IN_PAGE(p) & (BITS_BITLENGTH-1))
+#define BITMAP_BIT(p) ((bits_t)1 << BITMAP_OFFSET(p))
+/* Bitmap Operations */
+#define MARKED_IN_BITMAP(bits, p) ((bits)[BITMAP_INDEX(p)] & BITMAP_BIT(p))
+#define MARK_IN_BITMAP(bits, p) ((bits)[BITMAP_INDEX(p)] = (bits)[BITMAP_INDEX(p)] | BITMAP_BIT(p))
+#define CLEAR_IN_BITMAP(bits, p) ((bits)[BITMAP_INDEX(p)] = (bits)[BITMAP_INDEX(p)] & ~BITMAP_BIT(p))
+
+/* 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;
+#define ruby_initial_gc_stress gc_params.gc_stress
+VALUE *ruby_initial_gc_stress_ptr = &ruby_initial_gc_stress;
#else
-static rb_objspace_t rb_objspace = {{GC_MALLOC_LIMIT}, {HEAP_MIN_SLOTS}};
-int *ruby_initial_gc_stress_ptr = &rb_objspace.gc_stress;
+static rb_objspace_t rb_objspace = {{GC_MALLOC_LIMIT_MIN}};
+VALUE *ruby_initial_gc_stress_ptr = &rb_objspace.gc_stress;
#endif
+
#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 freelist objspace->heap.freelist
-#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_pages_used objspace->heap_pages.used
+#define heap_pages_length objspace->heap_pages.length
+#define heap_pages_lomem objspace->heap_pages.range[0]
+#define heap_pages_himem objspace->heap_pages.range[1]
+#define heap_pages_swept_num objspace->heap_pages.swept_num
+#define heap_pages_increment objspace->heap_pages.increment
+#define heap_pages_min_free_slots objspace->heap_pages.min_free_slots
+#define heap_pages_max_free_slots objspace->heap_pages.max_free_slots
+#define heap_pages_final_num objspace->heap_pages.final_num
+#define heap_pages_deferred_final objspace->heap_pages.deferred_final
+#define heap_eden (&objspace->eden_heap)
+#define heap_tomb (&objspace->tomb_heap)
#define dont_gc objspace->flags.dont_gc
#define during_gc objspace->flags.during_gc
-#define finalizer_table objspace->final.table
-#define deferred_final_list objspace->final.deferred
+#define finalizing objspace->flags.finalizing
+#define finalizer_table objspace->finalizer_table
#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 monitor_level objspace->rgengc.monitor_level
+#define monitored_object_table objspace->rgengc.monitored_object_table
+
+#define is_lazy_sweeping(heap) ((heap)->sweep_pages != 0)
+#if SIZEOF_LONG == SIZEOF_VOIDP
+# define nonspecial_obj_id(obj) (VALUE)((SIGNED_VALUE)(obj)|FIXNUM_FLAG)
+# define obj_id_to_ref(objid) ((objid) ^ FIXNUM_FLAG) /* unset FIXNUM_FLAG */
+#elif SIZEOF_LONG_LONG == SIZEOF_VOIDP
+# define nonspecial_obj_id(obj) LL2NUM((SIGNED_VALUE)(obj) / 2)
+# define obj_id_to_ref(objid) (FIXNUM_P(objid) ? \
+ ((objid) ^ FIXNUM_FLAG) : (NUM2PTR(objid) << 1))
+#else
+# error not supported
+#endif
+
+#define RANY(o) ((RVALUE*)(o))
+
+#define nomem_error GET_VM()->special_exceptions[ruby_error_nomemory]
+
+int ruby_gc_debug_indent = 0;
+VALUE rb_mGC;
+int ruby_disable_gc_stress = 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);
-#if defined(ENABLE_VM_OBJSPACE) && ENABLE_VM_OBJSPACE
-rb_objspace_t *
-rb_objspace_alloc(void)
+static void negative_size_allocation_error(const char *);
+static void *aligned_malloc(size_t, size_t);
+static void aligned_free(void *);
+
+static void init_mark_stack(mark_stack_t *stack);
+
+static VALUE lazy_sweep_enable(void);
+static int ready_to_gc(rb_objspace_t *objspace);
+static int heap_ready_to_gc(rb_objspace_t *objspace, rb_heap_t *heap);
+static int garbage_collect(rb_objspace_t *, int full_mark, int immediate_sweep, int reason);
+static int garbage_collect_body(rb_objspace_t *, int full_mark, int immediate_sweep, int reason);
+static int gc_heap_lazy_sweep(rb_objspace_t *objspace, rb_heap_t *heap);
+static void gc_rest_sweep(rb_objspace_t *objspace);
+static void gc_heap_rest_sweep(rb_objspace_t *objspace, rb_heap_t *heap);
+
+static void gc_mark_stacked_objects(rb_objspace_t *);
+static void gc_mark(rb_objspace_t *objspace, VALUE ptr);
+static void gc_mark_maybe(rb_objspace_t *objspace, VALUE ptr);
+static void gc_mark_children(rb_objspace_t *objspace, VALUE ptr);
+
+static size_t obj_memsize_of(VALUE obj, int use_tdata);
+
+static double getrusage_time(void);
+static inline void gc_prof_setup_new_record(rb_objspace_t *objspace, int reason);
+static inline void gc_prof_timer_start(rb_objspace_t *);
+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 rgengc_report if (RGENGC_DEBUG) rgengc_report_body
+static void rgengc_report_body(int level, rb_objspace_t *objspace, const char *fmt, ...);
+static const char * type_name(int type, VALUE obj);
+static const char *obj_type_name(VALUE obj);
+
+#if USE_RGENGC
+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);
+
+#define FL_TEST2(x,f) ((RGENGC_CHECK_MODE && SPECIAL_CONST_P(x)) ? (rb_bug("FL_TEST2: SPECIAL_CONST"), 0) : FL_TEST_RAW((x),(f)) != 0)
+#define FL_SET2(x,f) do {if (RGENGC_CHECK_MODE && SPECIAL_CONST_P(x)) rb_bug("FL_SET2: SPECIAL_CONST"); RBASIC(x)->flags |= (f);} while (0)
+#define FL_UNSET2(x,f) do {if (RGENGC_CHECK_MODE && SPECIAL_CONST_P(x)) rb_bug("FL_UNSET2: SPECIAL_CONST"); RBASIC(x)->flags &= ~(f);} while (0)
+
+#define RVALUE_RAW_SHADY(obj) (!FL_TEST2((obj), FL_WB_PROTECTED))
+#define RVALUE_SHADY(obj) RVALUE_RAW_SHADY(check_gen_consistency((VALUE)obj))
+
+#define RVALUE_OLDEGN_BITMAP(obj) MARKED_IN_BITMAP(GET_HEAP_OLDGEN_BITS(obj), (obj))
+
+static inline int is_pointer_to_heap(rb_objspace_t *objspace, void *ptr);
+static inline int gc_marked(rb_objspace_t *objspace, VALUE ptr);
+
+static inline VALUE
+check_gen_consistency(VALUE obj)
{
- 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;
+ if (RGENGC_CHECK_MODE > 0) {
+ int old_flag = RVALUE_OLDEGN_BITMAP(obj) != 0;
+ int promoted_flag = FL_TEST2(obj, FL_PROMOTED);
+ rb_objspace_t *objspace = &rb_objspace;
- return objspace;
+ obj_memsize_of((VALUE)obj, FALSE);
+
+ if (!is_pointer_to_heap(objspace, (void *)obj)) {
+ rb_bug("check_gen_consistency: %p (%s) is not Ruby object.", (void *)obj, obj_type_name(obj));
+ }
+
+ if (promoted_flag) {
+ if (RVALUE_RAW_SHADY(obj)) {
+ const char *type = old_flag ? "old" : "young";
+ rb_bug("check_gen_consistency: %p (%s) is shady, but %s object.", (void *)obj, obj_type_name(obj), type);
+ }
+
+#if !RGENGC_THREEGEN
+ if (!old_flag) {
+ rb_bug("check_gen_consistency: %p (%s) is not infant, but is not old (on 2gen).", (void *)obj, obj_type_name(obj));
+ }
+#endif
+
+ if (old_flag && objspace->rgengc.during_minor_gc && !gc_marked(objspace, obj)) {
+ rb_bug("check_gen_consistency: %p (%s) is old, but is not marked while minor marking.", (void *)obj, obj_type_name(obj));
+ }
+ }
+ else {
+ if (old_flag) {
+ rb_bug("check_gen_consistency: %p (%s) is not infant, but is old.", (void *)obj, obj_type_name(obj));
+ }
+ }
+ }
+ return obj;
+}
+
+static inline VALUE
+RVALUE_INFANT_P(VALUE obj)
+{
+ check_gen_consistency(obj);
+ return !FL_TEST2(obj, FL_PROMOTED);
}
+
+static inline VALUE
+RVALUE_OLD_BITMAP_P(VALUE obj)
+{
+ check_gen_consistency(obj);
+ return (RVALUE_OLDEGN_BITMAP(obj) != 0);
+}
+
+static inline VALUE
+RVALUE_OLD_P(VALUE obj)
+{
+ check_gen_consistency(obj);
+#if RGENGC_THREEGEN
+ return FL_TEST2(obj, FL_PROMOTED) && RVALUE_OLD_BITMAP_P(obj);
+#else
+ return FL_TEST2(obj, FL_PROMOTED);
#endif
+}
-static void initial_expand_heap(rb_objspace_t *objspace);
-static void init_mark_stack(mark_stack_t *stack);
+static inline VALUE
+RVALUE_PROMOTED_P(VALUE obj)
+{
+ check_gen_consistency(obj);
+ return FL_TEST2(obj, FL_PROMOTED);
+}
-void
-rb_gc_set_params(void)
+static inline void
+RVALUE_PROMOTE_INFANT(VALUE obj)
{
- char *malloc_limit_ptr, *heap_min_slots_ptr, *free_min_ptr;
+ check_gen_consistency(obj);
+ if (RGENGC_CHECK_MODE && !RVALUE_INFANT_P(obj)) rb_bug("RVALUE_PROMOTE_INFANT: %p (%s) is not infant object.", (void *)obj, obj_type_name(obj));
+ FL_SET2(obj, FL_PROMOTED);
+#if !RGENGC_THREEGEN
+ MARK_IN_BITMAP(GET_HEAP_OLDGEN_BITS(obj), obj);
+#endif
+ check_gen_consistency(obj);
- if (rb_safe_level() > 0) return;
+#if RGENGC_PROFILE >= 1
+ {
+ rb_objspace_t *objspace = &rb_objspace;
+ objspace->profile.promote_infant_count++;
- 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 RGENGC_PROFILE >= 2
+ objspace->profile.promote_infant_types[BUILTIN_TYPE(obj)]++;
+#endif
}
+#endif
+}
- 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);
- }
- }
+#if RGENGC_THREEGEN
+/*
+ * Two gen: Infant -> Old.
+ * Three gen: Infant -> Young -> Old.
+ */
+static inline VALUE
+RVALUE_YOUNG_P(VALUE obj)
+{
+ check_gen_consistency(obj);
+ return FL_TEST2(obj, FL_PROMOTED) && (RVALUE_OLDEGN_BITMAP(obj) == 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 inline void
+RVALUE_PROMOTE_YOUNG(VALUE obj)
+{
+ check_gen_consistency(obj);
+ if (RGENGC_CHECK_MODE && !RVALUE_YOUNG_P(obj)) rb_bug("RVALUE_PROMOTE_YOUNG: %p (%s) is not young object.", (void *)obj, obj_type_name(obj));
+ MARK_IN_BITMAP(GET_HEAP_OLDGEN_BITS(obj), obj);
+ check_gen_consistency(obj);
+
+#if RGENGC_PROFILE >= 1
+ {
+ rb_objspace_t *objspace = &rb_objspace;
+ objspace->profile.promote_young_count++;
+#if RGENGC_PROFILE >= 2
+ objspace->profile.promote_young_types[BUILTIN_TYPE(obj)]++;
+#endif
}
+#endif
+}
+
+static inline void
+RVALUE_DEMOTE_FROM_YOUNG(VALUE obj)
+{
+ if (RGENGC_CHECK_MODE && !RVALUE_YOUNG_P(obj))
+ rb_bug("RVALUE_DEMOTE_FROM_YOUNG: %p (%s) is not young object.", (void *)obj, obj_type_name(obj));
+
+ check_gen_consistency(obj);
+ FL_UNSET2(obj, FL_PROMOTED);
+ check_gen_consistency(obj);
+}
+#endif
+
+static inline void
+RVALUE_DEMOTE_FROM_OLD(VALUE obj)
+{
+ if (RGENGC_CHECK_MODE && !RVALUE_OLD_P(obj))
+ rb_bug("RVALUE_DEMOTE_FROM_OLD: %p (%s) is not old object.", (void *)obj, obj_type_name(obj));
+
+ check_gen_consistency(obj);
+ FL_UNSET2(obj, FL_PROMOTED);
+ CLEAR_IN_BITMAP(GET_HEAP_OLDGEN_BITS(obj), obj);
+ check_gen_consistency(obj);
+}
+
+#endif /* USE_RGENGC */
+
+/*
+ --------------------------- ObjectSpace -----------------------------
+*/
+
+#if defined(ENABLE_VM_OBJSPACE) && ENABLE_VM_OBJSPACE
+rb_objspace_t *
+rb_objspace_alloc(void)
+{
+ rb_objspace_t *objspace = malloc(sizeof(rb_objspace_t));
+ memset(objspace, 0, sizeof(*objspace));
+ ruby_gc_stress = ruby_initial_gc_stress;
+
+ malloc_limit = gc_params.malloc_limit_min;
+#if RGENGC_ESTIMATE_OLDSPACE
+ objspace->rgengc.oldspace_increase_limit = gc_params.oldspace_limit_min;
+#endif
+
+ return objspace;
}
+#endif
#if defined(ENABLE_VM_OBJSPACE) && ENABLE_VM_OBJSPACE
-static void gc_sweep(rb_objspace_t *);
-static void slot_sweep(rb_objspace_t *, struct heaps_slot *);
-static void rest_sweep(rb_objspace_t *);
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;
+ gc_rest_sweep(objspace);
+
+ if (objspace->profile.records) {
+ free(objspace->profile.records);
+ objspace->profile.records = 0;
}
+
if (global_List) {
struct gc_list *list, *next;
for (list = global_List; list; list = next) {
next = list->next;
- free(list);
+ xfree(list);
}
}
- if (objspace->heap.sorted) {
+ if (heap_pages_sorted) {
size_t i;
- for (i = 0; i < heaps_used; ++i) {
- free(objspace->heap.sorted[i].slot->membase);
- free(objspace->heap.sorted[i].slot);
+ for (i = 0; i < heap_pages_used; ++i) {
+ heap_page_free(objspace, heap_pages_sorted[i]);
}
- free(objspace->heap.sorted);
- heaps_used = 0;
- heaps = 0;
+ free(heap_pages_sorted);
+ heap_pages_used = 0;
+ heap_pages_length = 0;
+ heap_pages_lomem = 0;
+ heap_pages_himem = 0;
+
+ objspace->eden_heap.used = 0;
+ objspace->eden_heap.limit = 0;
+ objspace->eden_heap.pages = NULL;
}
free_stack_chunks(&objspace->mark_stack);
free(objspace);
}
#endif
-/* tiny heap size */
-/* 32KB */
-/*#define HEAP_SIZE 0x8000 */
-/* 128KB */
-/*#define HEAP_SIZE 0x20000 */
-/* 64KB */
-/*#define HEAP_SIZE 0x10000 */
-/* 16KB */
-#define HEAP_SIZE 0x4000
-/* 8KB */
-/*#define HEAP_SIZE 0x2000 */
-/* 4KB */
-/*#define HEAP_SIZE 0x1000 */
-/* 2KB */
-/*#define HEAP_SIZE 0x800 */
+static void
+heap_pages_expand_sorted(rb_objspace_t *objspace)
+{
+ size_t next_length = heap_pages_increment;
+ next_length += heap_eden->used;
+ next_length += heap_tomb->used;
-#define HEAP_OBJ_LIMIT (unsigned int)(HEAP_SIZE / sizeof(struct RVALUE))
+ if (next_length > heap_pages_length) {
+ struct heap_page **sorted;
+ size_t size = next_length * sizeof(struct heap_page *);
-extern st_table *rb_class_tbl;
+ rgengc_report(3, objspace, "heap_pages_expand_sorted: next_length: %d, size: %d\n", (int)next_length, (int)size);
-int ruby_disable_gc_stress = 0;
+ if (heap_pages_length > 0) {
+ sorted = (struct heap_page **)realloc(heap_pages_sorted, size);
+ if (sorted) heap_pages_sorted = sorted;
+ }
+ else {
+ sorted = heap_pages_sorted = (struct heap_page **)malloc(size);
+ }
+
+ if (sorted == 0) {
+ during_gc = 0;
+ rb_memerror();
+ }
-static void run_final(rb_objspace_t *objspace, VALUE obj);
-static int garbage_collect(rb_objspace_t *objspace);
-static int gc_lazy_sweep(rb_objspace_t *objspace);
+ heap_pages_length = next_length;
+ }
+}
-void
-rb_global_variable(VALUE *var)
+static inline void
+heap_page_add_freeobj(rb_objspace_t *objspace, struct heap_page *page, VALUE obj)
{
- rb_gc_register_address(var);
+ RVALUE *p = (RVALUE *)obj;
+ p->as.free.flags = 0;
+ p->as.free.next = page->freelist;
+ page->freelist = p;
+ rgengc_report(3, objspace, "heap_page_add_freeobj: %p (%s) is added to freelist\n", p, obj_type_name(obj));
}
-static void *
-ruby_memerror_body(void *dummy)
+static inline void
+heap_add_freepage(rb_objspace_t *objspace, rb_heap_t *heap, struct heap_page *page)
{
- rb_memerror();
- return 0;
+ if (page->freelist) {
+ page->free_next = heap->free_pages;
+ heap->free_pages = page;
+ }
}
static void
-ruby_memerror(void)
+heap_unlink_page(rb_objspace_t *objspace, rb_heap_t *heap, struct heap_page *page)
{
- if (ruby_thread_has_gvl_p()) {
+ 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->used--;
+ heap->limit -= page->limit;
+}
+
+static void
+heap_page_free(rb_objspace_t *objspace, struct heap_page *page)
+{
+ heap_pages_used--;
+ aligned_free(page->body);
+ free(page);
+}
+
+static void
+heap_pages_free_unused_pages(rb_objspace_t *objspace)
+{
+ size_t i, j;
+
+ for (i = j = 1; j < heap_pages_used; i++) {
+ struct heap_page *page = heap_pages_sorted[i];
+
+ if (page->heap == heap_tomb && page->final_num == 0) {
+ if (heap_pages_swept_num - page->limit > heap_pages_max_free_slots) {
+ if (0) fprintf(stderr, "heap_pages_free_unused_pages: %d free page %p, heap_pages_swept_num: %d, heap_pages_max_free_slots: %d\n",
+ (int)i, page, (int)heap_pages_swept_num, (int)heap_pages_max_free_slots);
+ heap_pages_swept_num -= page->limit;
+ heap_unlink_page(objspace, heap_tomb, page);
+ heap_page_free(objspace, page);
+ continue;
+ }
+ else {
+ /* fprintf(stderr, "heap_pages_free_unused_pages: remain!!\n"); */
+ }
+ }
+ if (i != j) {
+ heap_pages_sorted[j] = page;
+ }
+ j++;
+ }
+ assert(j == heap_pages_used);
+}
+
+static struct heap_page *
+heap_page_allocate(rb_objspace_t *objspace)
+{
+ RVALUE *start, *end, *p;
+ struct heap_page *page;
+ struct heap_page_body *page_body = 0;
+ size_t hi, lo, mid;
+ size_t limit = HEAP_OBJ_LIMIT;
+
+ /* assign heap_page body (contains heap_page_header and RVALUEs) */
+ page_body = (struct heap_page_body *)aligned_malloc(HEAP_ALIGN, HEAP_SIZE);
+ if (page_body == 0) {
+ during_gc = 0;
rb_memerror();
}
- else {
- if (ruby_native_thread_p()) {
- rb_thread_call_with_gvl(ruby_memerror_body, 0);
+
+ /* assign heap_page entry */
+ page = (struct heap_page *)malloc(sizeof(struct heap_page));
+ if (page == 0) {
+ aligned_free(page_body);
+ during_gc = 0;
+ rb_memerror();
+ }
+ MEMZERO((void*)page, struct heap_page, 1);
+
+ page->body = page_body;
+
+ /* setup heap_pages_sorted */
+ lo = 0;
+ hi = heap_pages_used;
+ while (lo < hi) {
+ struct heap_page *mid_page;
+
+ mid = (lo + hi) / 2;
+ mid_page = heap_pages_sorted[mid];
+ if (mid_page->body < page_body) {
+ lo = mid + 1;
+ }
+ else if (mid_page->body > page_body) {
+ hi = mid;
}
else {
- /* no ruby thread */
- fprintf(stderr, "[FATAL] failed to allocate memory\n");
- exit(EXIT_FAILURE);
+ rb_bug("same heap page is allocated: %p at %"PRIuVALUE, (void *)page_body, (VALUE)mid);
}
}
+ if (hi < heap_pages_used) {
+ MEMMOVE(&heap_pages_sorted[hi+1], &heap_pages_sorted[hi], struct heap_page_header*, heap_pages_used - hi);
+ }
+
+ heap_pages_sorted[hi] = page;
+
+ heap_pages_used++;
+ assert(heap_pages_used <= heap_pages_length);
+
+ /* adjust obj_limit (object number available in this page) */
+ start = (RVALUE*)((VALUE)page_body + sizeof(struct heap_page_header));
+ if ((VALUE)start % sizeof(RVALUE) != 0) {
+ int delta = (int)(sizeof(RVALUE) - ((VALUE)start % sizeof(RVALUE)));
+ start = (RVALUE*)((VALUE)start + delta);
+ limit = (HEAP_SIZE - (size_t)((VALUE)start - (VALUE)page_body))/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->limit = limit;
+ page_body->header.page = page;
+
+ for (p = start; p != end; p++) {
+ rgengc_report(3, objspace, "assign_heap_page: %p is added to freelist\n");
+ heap_page_add_freeobj(objspace, page, (VALUE)p);
+ }
+
+ return page;
}
-void
-rb_memerror(void)
+static struct heap_page *
+heap_page_resurrect(rb_objspace_t *objspace)
{
- rb_thread_t *th = GET_THREAD();
- if (!nomem_error ||
- (rb_thread_raised_p(th, RAISED_NOMEMORY) && rb_safe_level() < 4)) {
- fprintf(stderr, "[FATAL] failed to allocate memory\n");
- exit(EXIT_FAILURE);
+ struct heap_page *page;
+
+ if ((page = heap_tomb->pages) != NULL) {
+ heap_unlink_page(objspace, heap_tomb, page);
+ return page;
}
- if (rb_thread_raised_p(th, RAISED_NOMEMORY)) {
- rb_thread_raised_clear(th);
- GET_THREAD()->errinfo = nomem_error;
- JUMP_TAG(TAG_RAISE);
+ return NULL;
+}
+
+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";
}
- rb_thread_raised_set(th, RAISED_NOMEMORY);
- rb_exc_raise(nomem_error);
+ if (0) fprintf(stderr, "heap_page_create: %s - %p, heap_pages_used: %d, heap_pages_used: %d, tomb->used: %d\n",
+ method, page, (int)heap_pages_length, (int)heap_pages_used, (int)heap_tomb->used);
+ return page;
}
-/*
- * call-seq:
- * GC.stress -> true or false
- *
- * returns current status of GC stress mode.
- */
+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->used++;
+ heap->limit += page->limit;
+}
-static VALUE
-gc_stress_get(VALUE self)
+static void
+heap_assign_page(rb_objspace_t *objspace, rb_heap_t *heap)
{
- rb_objspace_t *objspace = &rb_objspace;
- return ruby_gc_stress ? Qtrue : Qfalse;
+ struct heap_page *page = heap_page_create(objspace);
+ heap_add_page(objspace, heap, page);
+ heap_add_freepage(objspace, heap, page);
}
-/*
- * call-seq:
- * GC.stress = bool -> bool
- *
- * Updates the GC stress mode.
- *
- * When stress mode is enabled the GC is invoked at every GC opportunity:
- * all memory and object allocations.
- *
- * Enabling stress mode makes Ruby very slow, it is only for debugging.
- */
+static void
+heap_add_pages(rb_objspace_t *objspace, rb_heap_t *heap, size_t add)
+{
+ size_t i;
-static VALUE
-gc_stress_set(VALUE self, VALUE flag)
+ heap_pages_increment = add;
+ heap_pages_expand_sorted(objspace);
+ for (i = 0; i < add; i++) {
+ heap_assign_page(objspace, heap);
+ }
+ heap_pages_increment = 0;
+}
+
+static void
+heap_set_increment(rb_objspace_t *objspace, size_t minimum_limit)
{
- rb_objspace_t *objspace = &rb_objspace;
- rb_secure(2);
- ruby_gc_stress = RTEST(flag);
- return flag;
+ size_t used = heap_pages_used - heap_tomb->used;
+ size_t next_used_limit = (size_t)(used * gc_params.growth_factor);
+ if (gc_params.growth_max > 0) {
+ size_t max_used_limit = (size_t)(used + gc_params.growth_max/HEAP_OBJ_LIMIT);
+ if (next_used_limit > max_used_limit) next_used_limit = max_used_limit;
+ }
+ if (next_used_limit == heap_pages_used) next_used_limit++;
+
+ if (next_used_limit < minimum_limit) {
+ next_used_limit = minimum_limit;
+ }
+
+ heap_pages_increment = next_used_limit - used;
+ heap_pages_expand_sorted(objspace);
+
+ if (0) fprintf(stderr, "heap_set_increment: heap_pages_length: %d, heap_pages_used: %d, heap_pages_increment: %d, next_used_limit: %d\n",
+ (int)heap_pages_length, (int)heap_pages_used, (int)heap_pages_increment, (int)next_used_limit);
}
-/*
- * call-seq:
- * GC::Profiler.enable? -> true or false
- *
- * The current status of GC profile mode.
- */
+static int
+heap_increment(rb_objspace_t *objspace, rb_heap_t *heap)
+{
+ rgengc_report(5, objspace, "heap_increment: heap_pages_length: %d, heap_pages_inc: %d, heap->used: %d\n",
+ (int)heap_pages_length, (int)heap_pages_increment, (int)heap->used);
-static VALUE
-gc_profile_enable_get(VALUE self)
+ if (heap_pages_increment > 0) {
+ heap_pages_increment--;
+ heap_assign_page(objspace, heap);
+ return TRUE;
+ }
+ return FALSE;
+}
+
+static struct heap_page *
+heap_prepare_freepage(rb_objspace_t *objspace, rb_heap_t *heap)
{
- rb_objspace_t *objspace = &rb_objspace;
- return objspace->profile.run ? Qtrue : Qfalse;
+ if (!GC_ENABLE_LAZY_SWEEP && objspace->flags.dont_lazy_sweep) {
+ if (heap_increment(objspace, heap) == 0 &&
+ garbage_collect(objspace, FALSE, TRUE, GPR_FLAG_NEWOBJ) == 0) {
+ goto err;
+ }
+ goto ok;
+ }
+
+ if (!heap_ready_to_gc(objspace, heap)) return heap->free_pages;
+
+ during_gc++;
+
+ if ((is_lazy_sweeping(heap) && gc_heap_lazy_sweep(objspace, heap)) || heap_increment(objspace, heap)) {
+ goto ok;
+ }
+
+#if GC_PROFILE_MORE_DETAIL
+ objspace->profile.prepare_time = 0;
+#endif
+ if (garbage_collect_body(objspace, 0, 0, GPR_FLAG_NEWOBJ) == 0) {
+ err:
+ during_gc = 0;
+ rb_memerror();
+ }
+ ok:
+ during_gc = 0;
+ return heap->free_pages;
}
-/*
- * call-seq:
- * GC::Profiler.enable -> nil
- *
- * Starts the GC profiler.
- *
- */
+static inline struct heap_page *
+heap_get_freepage(rb_objspace_t *objspace, rb_heap_t *heap)
+{
+ struct heap_page *page;
-static VALUE
-gc_profile_enable(void)
+ page = heap->free_pages;
+ while (page == NULL) {
+ page = heap_prepare_freepage(objspace, heap);
+ }
+ heap->free_pages = page->free_next;
+
+ return page;
+}
+
+static inline VALUE
+heap_get_freeobj(rb_objspace_t *objspace, rb_heap_t *heap)
+{
+ RVALUE *p = heap->freelist;
+
+ while (UNLIKELY(p == NULL)) {
+ struct heap_page *page = heap_get_freepage(objspace, heap);
+ heap->using_page = page;
+ p = heap->freelist = page->freelist;
+ page->freelist = NULL;
+ }
+ heap->freelist = p->as.free.next;
+
+ return (VALUE)p;
+}
+
+void
+rb_objspace_set_event_hook(const rb_event_flag_t event)
{
rb_objspace_t *objspace = &rb_objspace;
+ objspace->hook_events = event & RUBY_INTERNAL_EVENT_OBJSPACE_MASK;
+}
- objspace->profile.run = TRUE;
- return Qnil;
+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);
}
-/*
- * call-seq:
- * GC::Profiler.disable -> nil
- *
- * Stops the GC profiler.
- *
- */
+#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
-gc_profile_disable(void)
+newobj_of(VALUE klass, VALUE flags, VALUE v1, VALUE v2, VALUE v3)
{
rb_objspace_t *objspace = &rb_objspace;
+ VALUE obj;
- objspace->profile.run = FALSE;
- return Qnil;
+ if (UNLIKELY(during_gc)) {
+ dont_gc = 1;
+ during_gc = 0;
+ rb_bug("object allocation during garbage collection phase");
+ }
+
+ if (UNLIKELY(ruby_gc_stress && !ruby_disable_gc_stress)) {
+ if (!garbage_collect(objspace, FALSE, FALSE, GPR_FLAG_NEWOBJ)) {
+ during_gc = 0;
+ rb_memerror();
+ }
+ }
+
+ obj = heap_get_freeobj(objspace, heap_eden);
+
+ /* OBJSETUP */
+ RBASIC(obj)->flags = flags;
+ RBASIC_SET_CLASS(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 GC_DEBUG
+ RANY(obj)->file = rb_sourcefile();
+ RANY(obj)->line = rb_sourceline();
+ assert(!SPECIAL_CONST_P(obj)); /* check alignment */
+#endif
+
+#if RGENGC_PROFILE
+ if (flags & FL_WB_PROTECTED) {
+ objspace->profile.generated_normal_object_count++;
+#if RGENGC_PROFILE >= 2
+ objspace->profile.generated_normal_object_count_types[BUILTIN_TYPE(obj)]++;
+#endif
+ }
+ else {
+ objspace->profile.generated_shady_object_count++;
+#if RGENGC_PROFILE >= 2
+ objspace->profile.generated_shady_object_count_types[BUILTIN_TYPE(obj)]++;
+#endif
+ }
+#endif
+
+ rgengc_report(5, objspace, "newobj: %p (%s)\n", (void *)obj, obj_type_name(obj));
+
+#if USE_RGENGC && RGENGC_CHECK_MODE
+ if (RVALUE_PROMOTED_P(obj)) rb_bug("newobj: %p (%s) is promoted.\n", (void *)obj, obj_type_name(obj));
+ if (rgengc_remembered(objspace, (VALUE)obj)) rb_bug("newobj: %p (%s) is remembered.\n", (void *)obj, obj_type_name(obj));
+#endif
+
+ objspace->profile.total_allocated_object_num++;
+ gc_event_hook(objspace, RUBY_INTERNAL_EVENT_NEWOBJ, obj);
+
+ return obj;
}
-/*
- * call-seq:
- * GC::Profiler.clear -> nil
- *
- * Clears the GC profiler data.
- *
- */
+VALUE
+rb_newobj(void)
+{
+ return newobj_of(0, T_NONE, 0, 0, 0);
+}
-static VALUE
-gc_profile_clear(void)
+VALUE
+rb_newobj_of(VALUE klass, VALUE flags)
{
- rb_objspace_t *objspace = &rb_objspace;
- MEMZERO(objspace->profile.record, gc_profile_record, objspace->profile.size);
- objspace->profile.count = 0;
- return Qnil;
+ return newobj_of(klass, flags, 0, 0, 0);
}
-static void *
-negative_size_allocation_error_with_gvl(void *ptr)
+NODE*
+rb_node_newnode(enum node_type type, VALUE a0, VALUE a1, VALUE a2)
{
- rb_raise(rb_eNoMemError, "%s", (const char *)ptr);
- return 0; /* should not be reached */
+ NODE *n = (NODE *)newobj_of(0, T_NODE, a0, a1, a2);
+ nd_set_type(n, type);
+ return n;
}
-static void
-negative_size_allocation_error(const char *msg)
+VALUE
+rb_data_object_alloc(VALUE klass, void *datap, RUBY_DATA_FUNC dmark, RUBY_DATA_FUNC dfree)
{
- if (ruby_thread_has_gvl_p()) {
- rb_raise(rb_eNoMemError, "%s", msg);
- }
- else {
- if (ruby_native_thread_p()) {
- rb_thread_call_with_gvl(negative_size_allocation_error_with_gvl, (void *)msg);
- }
- else {
- fprintf(stderr, "[FATAL] %s\n", msg);
- exit(EXIT_FAILURE);
- }
- }
+ if (klass) Check_Type(klass, T_CLASS);
+ return newobj_of(klass, T_DATA, (VALUE)dmark, (VALUE)dfree, (VALUE)datap);
}
-static void *
-gc_with_gvl(void *ptr)
+VALUE
+rb_data_typed_object_alloc(VALUE klass, void *datap, const rb_data_type_t *type)
{
- return (void *)(VALUE)garbage_collect((rb_objspace_t *)ptr);
+ if (klass) Check_Type(klass, T_CLASS);
+ return newobj_of(klass, T_DATA | (type->flags & ~T_MASK), (VALUE)type, (VALUE)1, (VALUE)datap);
}
-static int
-garbage_collect_with_gvl(rb_objspace_t *objspace)
+size_t
+rb_objspace_data_type_memsize(VALUE obj)
{
- if (dont_gc) return TRUE;
- if (ruby_thread_has_gvl_p()) {
- return garbage_collect(objspace);
+ if (RTYPEDDATA_P(obj) && RTYPEDDATA_TYPE(obj)->function.dsize) {
+ return RTYPEDDATA_TYPE(obj)->function.dsize(RTYPEDDATA_DATA(obj));
}
else {
- if (ruby_native_thread_p()) {
- return (int)(VALUE)rb_thread_call_with_gvl(gc_with_gvl, (void *)objspace);
- }
- else {
- /* no ruby thread */
- fprintf(stderr, "[FATAL] failed to allocate memory\n");
- exit(EXIT_FAILURE);
- }
+ return 0;
}
}
-static void vm_xfree(rb_objspace_t *objspace, void *ptr);
-
-static inline size_t
-vm_malloc_prepare(rb_objspace_t *objspace, size_t size)
+const char *
+rb_objspace_data_type_name(VALUE obj)
{
- if ((ssize_t)size < 0) {
- negative_size_allocation_error("negative allocation size (or too big)");
+ if (RTYPEDDATA_P(obj)) {
+ return RTYPEDDATA_TYPE(obj)->wrap_struct_name;
}
- if (size == 0) size = 1;
+ else {
+ return 0;
+ }
+}
-#if CALC_EXACT_MALLOC_SIZE
- size += sizeof(size_t);
-#endif
+static inline int
+is_pointer_to_heap(rb_objspace_t *objspace, void *ptr)
+{
+ register RVALUE *p = RANY(ptr);
+ register struct heap_page *page;
+ register size_t hi, lo, mid;
- if ((ruby_gc_stress && !ruby_disable_gc_stress) ||
- (malloc_increase+size) > malloc_limit) {
- garbage_collect_with_gvl(objspace);
- }
+ if (p < heap_pages_lomem || p > heap_pages_himem) return FALSE;
+ if ((VALUE)p % sizeof(RVALUE) != 0) return FALSE;
- return size;
+ /* check if p looks like a pointer using bsearch*/
+ lo = 0;
+ hi = heap_pages_used;
+ while (lo < hi) {
+ mid = (lo + hi) / 2;
+ page = heap_pages_sorted[mid];
+ if (page->start <= p) {
+ if (p < page->start + page->limit) {
+ return TRUE;
+ }
+ lo = mid + 1;
+ }
+ else {
+ hi = mid;
+ }
+ }
+ return FALSE;
}
-static inline void *
-vm_malloc_fixup(rb_objspace_t *objspace, void *mem, size_t size)
+static int
+free_method_entry_i(ID key, rb_method_entry_t *me, st_data_t data)
{
- malloc_increase += size;
+ if (!me->mark) {
+ rb_free_method_entry(me);
+ }
+ return ST_CONTINUE;
+}
-#if CALC_EXACT_MALLOC_SIZE
- objspace->malloc_params.allocated_size += size;
- objspace->malloc_params.allocations++;
- ((size_t *)mem)[0] = size;
- mem = (size_t *)mem + 1;
-#endif
+void
+rb_free_m_table(st_table *tbl)
+{
+ st_foreach(tbl, free_method_entry_i, 0);
+ st_free_table(tbl);
+}
- return mem;
+static int
+free_const_entry_i(ID key, rb_const_entry_t *ce, st_data_t data)
+{
+ xfree(ce);
+ return ST_CONTINUE;
}
-#define TRY_WITH_GC(alloc) do { \
- if (!(alloc) && \
- (!garbage_collect_with_gvl(objspace) || \
- !(alloc))) { \
- ruby_memerror(); \
- } \
- } while (0)
+void
+rb_free_const_table(st_table *tbl)
+{
+ st_foreach(tbl, free_const_entry_i, 0);
+ st_free_table(tbl);
+}
-static void *
-vm_xmalloc(rb_objspace_t *objspace, size_t size)
+static inline void
+make_deferred(rb_objspace_t *objspace,RVALUE *p)
{
- void *mem;
+ p->as.basic.flags = T_ZOMBIE;
+ p->as.free.next = heap_pages_deferred_final;
+ heap_pages_deferred_final = p;
+}
- size = vm_malloc_prepare(objspace, size);
- TRY_WITH_GC(mem = malloc(size));
- return vm_malloc_fixup(objspace, mem, size);
+static inline void
+make_io_deferred(rb_objspace_t *objspace,RVALUE *p)
+{
+ rb_io_t *fptr = p->as.file.fptr;
+ make_deferred(objspace, p);
+ p->as.data.dfree = (void (*)(void*))rb_io_fptr_finalize;
+ p->as.data.data = fptr;
}
-static void *
-vm_xrealloc(rb_objspace_t *objspace, void *ptr, size_t size)
+static int
+obj_free(rb_objspace_t *objspace, VALUE obj)
{
- void *mem;
+ gc_event_hook(objspace, RUBY_INTERNAL_EVENT_FREEOBJ, obj);
- if ((ssize_t)size < 0) {
- negative_size_allocation_error("negative re-allocation size");
+ switch (BUILTIN_TYPE(obj)) {
+ case T_NIL:
+ case T_FIXNUM:
+ case T_TRUE:
+ case T_FALSE:
+ rb_bug("obj_free() called for broken object");
+ break;
}
- if (!ptr) return vm_xmalloc(objspace, size);
- if (size == 0) {
- vm_xfree(objspace, ptr);
- return 0;
+
+ if (FL_TEST(obj, FL_EXIVAR)) {
+ rb_free_generic_ivar((VALUE)obj);
+ FL_UNSET(obj, FL_EXIVAR);
}
- if (ruby_gc_stress && !ruby_disable_gc_stress)
- garbage_collect_with_gvl(objspace);
-#if CALC_EXACT_MALLOC_SIZE
- size += sizeof(size_t);
- objspace->malloc_params.allocated_size -= size;
- ptr = (size_t *)ptr - 1;
+#if USE_RGENGC
+ if (MARKED_IN_BITMAP(GET_HEAP_OLDGEN_BITS(obj),obj))
+ CLEAR_IN_BITMAP(GET_HEAP_OLDGEN_BITS(obj),obj);
#endif
- mem = realloc(ptr, size);
- if (!mem) {
- if (garbage_collect_with_gvl(objspace)) {
- mem = realloc(ptr, size);
+ switch (BUILTIN_TYPE(obj)) {
+ case T_OBJECT:
+ if (!(RANY(obj)->as.basic.flags & ROBJECT_EMBED) &&
+ RANY(obj)->as.object.as.heap.ivptr) {
+ xfree(RANY(obj)->as.object.as.heap.ivptr);
}
- if (!mem) {
- ruby_memerror();
+ break;
+ case T_MODULE:
+ case T_CLASS:
+ if (RCLASS_M_TBL(obj)) {
+ rb_free_m_table(RCLASS_M_TBL(obj));
}
- }
- malloc_increase += size;
+ if (RCLASS_IV_TBL(obj)) {
+ st_free_table(RCLASS_IV_TBL(obj));
+ }
+ if (RCLASS_CONST_TBL(obj)) {
+ rb_free_const_table(RCLASS_CONST_TBL(obj));
+ }
+ if (RCLASS_IV_INDEX_TBL(obj)) {
+ st_free_table(RCLASS_IV_INDEX_TBL(obj));
+ }
+ 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);
+ break;
+ case T_ARRAY:
+ rb_ary_free(obj);
+ break;
+ case T_HASH:
+ if (RANY(obj)->as.hash.ntbl) {
+ st_free_table(RANY(obj)->as.hash.ntbl);
+ }
+ break;
+ case T_REGEXP:
+ if (RANY(obj)->as.regexp.ptr) {
+ onig_free(RANY(obj)->as.regexp.ptr);
+ }
+ break;
+ case T_DATA:
+ if (DATA_PTR(obj)) {
+ int free_immediately = FALSE;
-#if CALC_EXACT_MALLOC_SIZE
- objspace->malloc_params.allocated_size += size;
- ((size_t *)mem)[0] = size;
- mem = (size_t *)mem + 1;
-#endif
+ if (RTYPEDDATA_P(obj)) {
+ free_immediately = (RANY(obj)->as.typeddata.type->flags & RUBY_TYPED_FREE_IMMEDIATELY) != 0;
+ RDATA(obj)->dfree = RANY(obj)->as.typeddata.type->function.dfree;
+ if (0 && free_immediately == 0) /* to expose non-free-immediate T_DATA */
+ fprintf(stderr, "not immediate -> %s\n", RANY(obj)->as.typeddata.type->wrap_struct_name);
+ }
+ if (RANY(obj)->as.data.dfree == RUBY_DEFAULT_FREE) {
+ xfree(DATA_PTR(obj));
+ }
+ else if (RANY(obj)->as.data.dfree) {
+ if (free_immediately) {
+ (RDATA(obj)->dfree)(DATA_PTR(obj));
+ }
+ else {
+ make_deferred(objspace, RANY(obj));
+ return 1;
+ }
+ }
+ }
+ break;
+ case T_MATCH:
+ if (RANY(obj)->as.match.rmatch) {
+ struct rmatch *rm = RANY(obj)->as.match.rmatch;
+ onig_region_free(&rm->regs, 0);
+ if (rm->char_offset)
+ xfree(rm->char_offset);
+ xfree(rm);
+ }
+ break;
+ case T_FILE:
+ if (RANY(obj)->as.file.fptr) {
+ make_io_deferred(objspace, RANY(obj));
+ return 1;
+ }
+ break;
+ case T_RATIONAL:
+ case T_COMPLEX:
+ 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;
- return mem;
+ case T_FLOAT:
+ break;
+
+ case T_BIGNUM:
+ if (!(RBASIC(obj)->flags & RBIGNUM_EMBED_FLAG) && RBIGNUM_DIGITS(obj)) {
+ xfree(RBIGNUM_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;
+ }
+ 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((void *)RANY(obj)->as.rstruct.as.heap.ptr);
+ }
+ break;
+
+ default:
+ rb_bug("gc_sweep(): unknown data type 0x%x(%p) 0x%"PRIxVALUE,
+ BUILTIN_TYPE(obj), (void*)obj, RBASIC(obj)->flags);
+ }
+
+ return 0;
}
-static void
-vm_xfree(rb_objspace_t *objspace, void *ptr)
+void
+Init_heap(void)
{
-#if CALC_EXACT_MALLOC_SIZE
- size_t size;
- ptr = ((size_t *)ptr) - 1;
- size = ((size_t*)ptr)[0];
- objspace->malloc_params.allocated_size -= size;
- objspace->malloc_params.allocations--;
+ rb_objspace_t *objspace = &rb_objspace;
+
+ heap_add_pages(objspace, heap_eden, gc_params.heap_min_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
- free(ptr);
+ objspace->profile.invoke_time = getrusage_time();
+ finalizer_table = st_init_numtable();
}
-void *
-ruby_xmalloc(size_t size)
-{
- return vm_xmalloc(&rb_objspace, size);
-}
+typedef int each_obj_callback(void *, void *, size_t, void *);
-static inline size_t
-xmalloc2_size(size_t n, size_t size)
+struct each_obj_args {
+ each_obj_callback *callback;
+ void *data;
+};
+
+static VALUE
+objspace_each_objects(VALUE arg)
{
- size_t len = size * n;
- if (n != 0 && size != len / n) {
- rb_raise(rb_eArgError, "malloc: possible integer overflow");
+ size_t i;
+ 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;
+
+ i = 0;
+ while (i < heap_pages_used) {
+ while (0 < i && last_body < heap_pages_sorted[i-1]->body) i--;
+ while (i < heap_pages_used && heap_pages_sorted[i]->body <= last_body) i++;
+ if (heap_pages_used <= i) break;
+
+ page = heap_pages_sorted[i];
+ last_body = page->body;
+
+ pstart = page->start;
+ pend = pstart + page->limit;
+
+ if ((*args->callback)(pstart, pend, sizeof(RVALUE), args->data)) {
+ break;
+ }
}
- return len;
-}
-void *
-ruby_xmalloc2(size_t n, size_t size)
-{
- return vm_xmalloc(&rb_objspace, xmalloc2_size(n, size));
+ return Qnil;
}
-static void *
-vm_xcalloc(rb_objspace_t *objspace, size_t count, size_t elsize)
+/*
+ * 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 page,
+ * at current implementation) with:
+ * 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.
+ *
+ * This is a sample callback code to iterate liveness objects:
+ *
+ * int
+ * sample_callback(void *vstart, void *vend, int stride, void *data) {
+ * VALUE v = (VALUE)vstart;
+ * for (; v != (VALUE)vend; v += stride) {
+ * if (RBASIC(v)->flags) { // liveness check
+ * // do something with live object 'v'
+ * }
+ * return 0; // continue to iteration
+ * }
+ *
+ * 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 page
+ * including freed object page.
+ *
+ * Note: On this implementation, 'stride' is same as sizeof(RVALUE).
+ * However, there are possibilities to pass variable values with
+ * 'stride' with some reasons. You must use stride instead of
+ * use some constant value in the iteration.
+ */
+void
+rb_objspace_each_objects(each_obj_callback *callback, void *data)
{
- void *mem;
- size_t size;
+ struct each_obj_args args;
+ rb_objspace_t *objspace = &rb_objspace;
- size = xmalloc2_size(count, elsize);
- size = vm_malloc_prepare(objspace, size);
+ gc_rest_sweep(objspace);
+ objspace->flags.dont_lazy_sweep = TRUE;
- TRY_WITH_GC(mem = calloc(1, size));
- return vm_malloc_fixup(objspace, mem, size);
+ args.callback = callback;
+ args.data = data;
+ rb_ensure(objspace_each_objects, (VALUE)&args, lazy_sweep_enable, Qnil);
}
-void *
-ruby_xcalloc(size_t n, size_t size)
+struct os_each_struct {
+ size_t num;
+ VALUE of;
+};
+
+static int
+internal_object_p(VALUE obj)
{
- return vm_xcalloc(&rb_objspace, n, size);
+ RVALUE *p = (RVALUE *)obj;
+
+ if (p->as.basic.flags) {
+ switch (BUILTIN_TYPE(p)) {
+ case T_NONE:
+ case T_ICLASS:
+ case T_NODE:
+ case T_ZOMBIE:
+ break;
+ case T_CLASS:
+ if (FL_TEST(p, FL_SINGLETON))
+ break;
+ default:
+ if (!p->as.basic.klass) break;
+ return 0;
+ }
+ }
+ return 1;
}
-void *
-ruby_xrealloc(void *ptr, size_t size)
+int
+rb_objspace_internal_object_p(VALUE obj)
{
- return vm_xrealloc(&rb_objspace, ptr, size);
+ return internal_object_p(obj);
}
-void *
-ruby_xrealloc2(void *ptr, size_t n, size_t size)
+static int
+os_obj_of_i(void *vstart, void *vend, size_t stride, void *data)
{
- size_t len = size * n;
- if (n != 0 && size != len / n) {
- rb_raise(rb_eArgError, "realloc: possible integer overflow");
+ struct os_each_struct *oes = (struct os_each_struct *)data;
+ RVALUE *p = (RVALUE *)vstart, *pend = (RVALUE *)vend;
+
+ for (; p != pend; p++) {
+ volatile VALUE v = (VALUE)p;
+ if (!internal_object_p(v)) {
+ if (!oes->of || rb_obj_is_kind_of(v, oes->of)) {
+ rb_yield(v);
+ oes->num++;
+ }
+ }
}
- return ruby_xrealloc(ptr, len);
+
+ return 0;
}
-void
-ruby_xfree(void *x)
+static VALUE
+os_obj_of(VALUE of)
{
- if (x)
- vm_xfree(&rb_objspace, x);
-}
+ struct os_each_struct oes;
+ oes.num = 0;
+ oes.of = of;
+ rb_objspace_each_objects(os_obj_of_i, &oes);
+ return SIZET2NUM(oes.num);
+}
/*
* call-seq:
- * GC.enable -> true or false
+ * ObjectSpace.each_object([module]) {|obj| ... } -> fixnum
+ * ObjectSpace.each_object([module]) -> an_enumerator
*
- * Enables garbage collection, returning <code>true</code> if garbage
- * collection was previously disabled.
+ * Calls the block once for each living, nonimmediate object in this
+ * Ruby process. If <i>module</i> is specified, calls the block
+ * for only those classes or modules that match (or are a subclass of)
+ * <i>module</i>. Returns the number of objects found. Immediate
+ * objects (<code>Fixnum</code>s, <code>Symbol</code>s
+ * <code>true</code>, <code>false</code>, and <code>nil</code>) are
+ * never returned. In the example below, <code>each_object</code>
+ * returns both the numbers we defined and several constants defined in
+ * the <code>Math</code> module.
*
- * GC.disable #=> false
- * GC.enable #=> true
- * GC.enable #=> false
+ * If no block is given, an enumerator is returned instead.
+ *
+ * a = 102.7
+ * b = 95 # Won't be returned
+ * c = 12345678987654321
+ * count = ObjectSpace.each_object(Numeric) {|x| p x }
+ * puts "Total count: #{count}"
+ *
+ * <em>produces:</em>
+ *
+ * 12345678987654321
+ * 102.7
+ * 2.71828182845905
+ * 3.14159265358979
+ * 2.22044604925031e-16
+ * 1.7976931348623157e+308
+ * 2.2250738585072e-308
+ * Total count: 7
*
*/
-VALUE
-rb_gc_enable(void)
+static VALUE
+os_each_obj(int argc, VALUE *argv, VALUE os)
{
- rb_objspace_t *objspace = &rb_objspace;
- int old = dont_gc;
+ VALUE of;
- dont_gc = FALSE;
- return old ? Qtrue : Qfalse;
+ if (argc == 0) {
+ of = 0;
+ }
+ else {
+ rb_scan_args(argc, argv, "01", &of);
+ }
+ RETURN_ENUMERATOR(os, 1, &of);
+ return os_obj_of(of);
}
/*
* call-seq:
- * GC.disable -> true or false
- *
- * Disables garbage collection, returning <code>true</code> if garbage
- * collection was already disabled.
+ * ObjectSpace.undefine_finalizer(obj)
*
- * GC.disable #=> false
- * GC.disable #=> true
+ * Removes all finalizers for <i>obj</i>.
*
*/
+static VALUE
+undefine_final(VALUE os, VALUE obj)
+{
+ return rb_undefine_finalizer(obj);
+}
+
VALUE
-rb_gc_disable(void)
+rb_undefine_finalizer(VALUE obj)
{
rb_objspace_t *objspace = &rb_objspace;
- int old = dont_gc;
+ st_data_t data = obj;
+ rb_check_frozen(obj);
+ st_delete(finalizer_table, &data, 0);
+ FL_UNSET(obj, FL_FINALIZE);
+ return obj;
+}
- dont_gc = TRUE;
- return old ? Qtrue : Qfalse;
+static void
+should_be_callable(VALUE block)
+{
+ if (!rb_obj_respond_to(block, rb_intern("call"), TRUE)) {
+ rb_raise(rb_eArgError, "wrong type argument %s (should be callable)",
+ rb_obj_classname(block));
+ }
}
-VALUE rb_mGC;
+/*
+ * call-seq:
+ * ObjectSpace.define_finalizer(obj, aProc=proc())
+ *
+ * Adds <i>aProc</i> as a finalizer, to be called after <i>obj</i>
+ * was destroyed.
+ *
+ */
-void
-rb_gc_register_mark_object(VALUE obj)
+static VALUE
+define_final(int argc, VALUE *argv, VALUE os)
{
- VALUE ary = GET_THREAD()->vm->mark_object_ary;
- rb_ary_push(ary, obj);
+ VALUE obj, block;
+
+ rb_scan_args(argc, argv, "11", &obj, &block);
+ rb_check_frozen(obj);
+ if (argc == 1) {
+ block = rb_block_proc();
+ }
+ else {
+ should_be_callable(block);
+ }
+
+ return define_final0(obj, block);
}
-void
-rb_gc_register_address(VALUE *addr)
+static VALUE
+define_final0(VALUE obj, VALUE block)
{
rb_objspace_t *objspace = &rb_objspace;
- struct gc_list *tmp;
+ VALUE table;
+ st_data_t data;
- tmp = ALLOC(struct gc_list);
- tmp->next = global_List;
- tmp->varptr = addr;
- global_List = tmp;
+ 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);
+ OBJ_FREEZE(block);
+
+ if (st_lookup(finalizer_table, obj, &data)) {
+ table = (VALUE)data;
+ rb_ary_push(table, block);
+ }
+ else {
+ table = rb_ary_new3(1, block);
+ RBASIC_CLEAR_CLASS(table);
+ st_add_direct(finalizer_table, obj, table);
+ }
+ return block;
+}
+
+VALUE
+rb_define_finalizer(VALUE obj, VALUE block)
+{
+ rb_check_frozen(obj);
+ should_be_callable(block);
+ return define_final0(obj, block);
}
void
-rb_gc_unregister_address(VALUE *addr)
+rb_gc_copy_finalizer(VALUE dest, VALUE obj)
{
rb_objspace_t *objspace = &rb_objspace;
- struct gc_list *tmp = global_List;
-
- if (tmp->varptr == addr) {
- global_List = tmp->next;
- xfree(tmp);
- return;
- }
- while (tmp->next) {
- if (tmp->next->varptr == addr) {
- struct gc_list *t = tmp->next;
+ VALUE table;
+ st_data_t data;
- tmp->next = tmp->next->next;
- xfree(t);
- break;
- }
- tmp = tmp->next;
+ if (!FL_TEST(obj, FL_FINALIZE)) return;
+ if (st_lookup(finalizer_table, obj, &data)) {
+ table = (VALUE)data;
+ st_insert(finalizer_table, dest, table);
}
+ FL_SET(dest, FL_FINALIZE);
}
+static VALUE
+run_single_final(VALUE arg)
+{
+ VALUE *args = (VALUE *)arg;
+ rb_eval_cmd(args[0], args[1], (int)args[2]);
+ return Qnil;
+}
static void
-allocate_sorted_heaps(rb_objspace_t *objspace, size_t next_heaps_length)
+run_finalizer(rb_objspace_t *objspace, VALUE obj, VALUE table)
{
- struct sorted_heaps_slot *p;
- size_t size;
-
- size = next_heaps_length*sizeof(struct sorted_heaps_slot);
+ long i;
+ int status;
+ VALUE args[3];
+ VALUE objid = nonspecial_obj_id(obj);
- if (heaps_used > 0) {
- p = (struct sorted_heaps_slot *)realloc(objspace->heap.sorted, size);
- if (p) objspace->heap.sorted = p;
+ if (RARRAY_LEN(table) > 0) {
+ args[1] = rb_obj_freeze(rb_ary_new3(1, objid));
}
else {
- p = objspace->heap.sorted = (struct sorted_heaps_slot *)malloc(size);
+ args[1] = 0;
}
- if (p == 0) {
- during_gc = 0;
- rb_memerror();
+ args[2] = (VALUE)rb_safe_level();
+ for (i=0; i<RARRAY_LEN(table); i++) {
+ 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)
+ rb_set_errinfo(Qnil);
}
- heaps_length = next_heaps_length;
}
static void
-assign_heap_slot(rb_objspace_t *objspace)
+run_final(rb_objspace_t *objspace, VALUE obj)
{
- RVALUE *p, *pend, *membase;
- struct heaps_slot *slot;
- size_t hi, lo, mid;
- size_t objs;
+ RUBY_DATA_FUNC free_func = 0;
+ st_data_t key, table;
- objs = HEAP_OBJ_LIMIT;
- p = (RVALUE*)malloc(HEAP_SIZE);
- if (p == 0) {
- during_gc = 0;
- rb_memerror();
- }
- slot = (struct heaps_slot *)malloc(sizeof(struct heaps_slot));
- if (slot == 0) {
- xfree(p);
- during_gc = 0;
- rb_memerror();
- }
- MEMZERO((void*)slot, struct heaps_slot, 1);
+ heap_pages_final_num--;
- slot->next = heaps;
- if (heaps) heaps->prev = slot;
- heaps = slot;
+ RBASIC_CLEAR_CLASS(obj);
- membase = p;
- if ((VALUE)p % sizeof(RVALUE) != 0) {
- p = (RVALUE*)((VALUE)p + sizeof(RVALUE) - ((VALUE)p % sizeof(RVALUE)));
- if ((HEAP_SIZE - HEAP_OBJ_LIMIT * sizeof(RVALUE)) < (size_t)((char*)p - (char*)membase)) {
- objs--;
- }
+ if (RTYPEDDATA_P(obj)) {
+ free_func = RTYPEDDATA_TYPE(obj)->function.dfree;
}
-
- lo = 0;
- hi = heaps_used;
- while (lo < hi) {
- register RVALUE *mid_membase;
- mid = (lo + hi) / 2;
- mid_membase = objspace->heap.sorted[mid].slot->membase;
- if (mid_membase < membase) {
- lo = mid + 1;
- }
- else if (mid_membase > membase) {
- hi = mid;
- }
- else {
- rb_bug("same heap slot is allocated: %p at %"PRIuVALUE, (void *)membase, (VALUE)mid);
- }
+ else {
+ free_func = RDATA(obj)->dfree;
}
- if (hi < heaps_used) {
- MEMMOVE(&objspace->heap.sorted[hi+1], &objspace->heap.sorted[hi], struct sorted_heaps_slot, heaps_used - hi);
+ if (free_func) {
+ (*free_func)(DATA_PTR(obj));
}
- objspace->heap.sorted[hi].slot = slot;
- objspace->heap.sorted[hi].start = p;
- objspace->heap.sorted[hi].end = (p + objs);
- heaps->membase = membase;
- heaps->slot = p;
- heaps->limit = objs;
- objspace->heap.free_num += objs;
- 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 = freelist;
- freelist = p;
- p++;
+ key = (st_data_t)obj;
+ if (st_delete(finalizer_table, &key, &table)) {
+ run_finalizer(objspace, obj, (VALUE)table);
}
}
static void
-add_heap_slots(rb_objspace_t *objspace, size_t add)
+finalize_list(rb_objspace_t *objspace, RVALUE *p)
{
- size_t i;
+ while (p) {
+ RVALUE *tmp = p->as.free.next;
+ struct heap_page *page = GET_HEAP_PAGE(p);
- if ((heaps_used + add) > heaps_length) {
- allocate_sorted_heaps(objspace, heaps_used + add);
- }
+ run_final(objspace, (VALUE)p);
+ objspace->profile.total_freed_object_num++;
- for (i = 0; i < add; i++) {
- assign_heap_slot(objspace);
+ page->final_num--;
+ heap_page_add_freeobj(objspace, GET_HEAP_PAGE(p), (VALUE)p);
+ heap_pages_swept_num++;
+
+ p = tmp;
}
- heaps_inc = 0;
}
static void
-init_heap(rb_objspace_t *objspace)
+finalize_deferred(rb_objspace_t *objspace)
{
- add_heap_slots(objspace, HEAP_MIN_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(ALT_STACK_SIZE);
- free(tmp); /* free previously allocated area */
- }
-#endif
+ RVALUE *p = heap_pages_deferred_final;
+ heap_pages_deferred_final = 0;
- objspace->profile.invoke_time = getrusage_time();
- finalizer_table = st_init_numtable();
+ if (p) {
+ finalize_list(objspace, p);
+ }
}
static void
-initial_expand_heap(rb_objspace_t *objspace)
+gc_finalize_deferred(void *dmy)
{
- size_t min_size = initial_heap_min_slots / HEAP_OBJ_LIMIT;
+ rb_objspace_t *objspace = &rb_objspace;
+ if (ATOMIC_EXCHANGE(finalizing, 1)) return;
+ finalize_deferred(objspace);
+ ATOMIC_SET(finalizing, 0);
+}
- if (min_size > heaps_used) {
- add_heap_slots(objspace, min_size - heaps_used);
+/* TODO: to keep compatibility, maybe unused. */
+void
+rb_gc_finalize_deferred(void)
+{
+ gc_finalize_deferred(0);
+}
+
+static void
+gc_finalize_deferred_register()
+{
+ if (rb_postponed_job_register_one(0, gc_finalize_deferred, 0) == 0) {
+ rb_bug("gc_finalize_deferred_register: can't register finalizer.");
}
}
+struct force_finalize_list {
+ VALUE obj;
+ VALUE table;
+ struct force_finalize_list *next;
+};
+
+static int
+force_chain_object(st_data_t key, st_data_t val, st_data_t arg)
+{
+ struct force_finalize_list **prev = (struct force_finalize_list **)arg;
+ struct force_finalize_list *curr = ALLOC(struct force_finalize_list);
+ curr->obj = key;
+ curr->table = val;
+ curr->next = *prev;
+ *prev = curr;
+ return ST_CONTINUE;
+}
+
+void
+rb_gc_call_finalizer_at_exit(void)
+{
+ rb_objspace_call_finalizer(&rb_objspace);
+}
+
static void
-set_heaps_increment(rb_objspace_t *objspace)
+rb_objspace_call_finalizer(rb_objspace_t *objspace)
{
- size_t next_heaps_length = (size_t)(heaps_used * 1.8);
+ RVALUE *p, *pend;
+ size_t i;
+
+ gc_rest_sweep(objspace);
+
+ if (ATOMIC_EXCHANGE(finalizing, 1)) return;
+
+ /* run finalizers */
+ finalize_deferred(objspace);
+ assert(heap_pages_deferred_final == 0);
- if (next_heaps_length == heaps_used) {
- next_heaps_length++;
+ /* force to run finalizer */
+ while (finalizer_table->num_entries) {
+ struct force_finalize_list *list = 0;
+ st_foreach(finalizer_table, force_chain_object, (st_data_t)&list);
+ while (list) {
+ struct force_finalize_list *curr = list;
+ st_data_t obj = (st_data_t)curr->obj;
+ run_finalizer(objspace, curr->obj, curr->table);
+ st_delete(finalizer_table, &obj, 0);
+ list = curr->next;
+ xfree(curr);
+ }
}
- heaps_inc = next_heaps_length - heaps_used;
+ /* finalizers are part of garbage collection */
+ during_gc++;
- if (next_heaps_length > heaps_length) {
- allocate_sorted_heaps(objspace, next_heaps_length);
+ /* run data object's finalizers */
+ for (i = 0; i < heap_pages_used; i++) {
+ p = heap_pages_sorted[i]->start; pend = p + heap_pages_sorted[i]->limit;
+ while (p < pend) {
+ switch (BUILTIN_TYPE(p)) {
+ case T_DATA:
+ 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;
+ }
+ if (RANY(p)->as.data.dfree == (RUBY_DATA_FUNC)-1) {
+ xfree(DATA_PTR(p));
+ }
+ else if (RANY(p)->as.data.dfree) {
+ make_deferred(objspace, RANY(p));
+ }
+ break;
+ case T_FILE:
+ if (RANY(p)->as.file.fptr) {
+ make_io_deferred(objspace, RANY(p));
+ }
+ break;
+ }
+ p++;
+ }
+ }
+ during_gc = 0;
+ if (heap_pages_deferred_final) {
+ finalize_list(objspace, heap_pages_deferred_final);
}
+
+ st_free_table(finalizer_table);
+ finalizer_table = 0;
+ ATOMIC_SET(finalizing, 0);
}
-static int
-heaps_increment(rb_objspace_t *objspace)
+static inline int
+is_id_value(rb_objspace_t *objspace, VALUE ptr)
{
- if (heaps_inc > 0) {
- assign_heap_slot(objspace);
- heaps_inc--;
+ if (!is_pointer_to_heap(objspace, (void *)ptr)) return FALSE;
+ if (BUILTIN_TYPE(ptr) > T_FIXNUM) return FALSE;
+ if (BUILTIN_TYPE(ptr) == T_ICLASS) return FALSE;
+ return TRUE;
+}
+
+static inline int
+heap_is_swept_object(rb_objspace_t *objspace, rb_heap_t *heap, VALUE ptr)
+{
+ struct heap_page *page = GET_HEAP_PAGE(ptr);
+ return page->before_sweep ? FALSE : TRUE;
+}
+
+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;
+ }
+}
+
+static inline int
+is_dead_object(rb_objspace_t *objspace, VALUE ptr)
+{
+ if (!is_lazy_sweeping(heap_eden) || MARKED_IN_BITMAP(GET_HEAP_MARK_BITS(ptr), ptr)) return FALSE;
+ if (!is_swept_object(objspace, ptr)) return TRUE;
return FALSE;
}
+static inline int
+is_live_object(rb_objspace_t *objspace, VALUE ptr)
+{
+ switch (BUILTIN_TYPE(ptr)) {
+ case 0: case T_ZOMBIE:
+ return FALSE;
+ }
+ if (is_dead_object(objspace, ptr)) return FALSE;
+ return TRUE;
+}
+
+static inline int
+is_markable_object(rb_objspace_t *objspace, VALUE obj)
+{
+ if (rb_special_const_p(obj)) return 0; /* special const is not markable */
+
+ if (RGENGC_CHECK_MODE) {
+ if (!is_pointer_to_heap(objspace, (void *)obj)) rb_bug("is_markable_object: %p is not pointer to heap", (void *)obj);
+ if (BUILTIN_TYPE(obj) == T_NONE) rb_bug("is_markable_object: %p is T_NONE", (void *)obj);
+ if (BUILTIN_TYPE(obj) == T_ZOMBIE) rb_bug("is_markable_object: %p is T_ZOMBIE", (void *)obj);
+ }
+
+ return 1;
+}
+
int
-rb_during_gc(void)
+rb_objspace_markable_object_p(VALUE obj)
{
+ return is_markable_object(&rb_objspace, obj);
+}
+
+/*
+ * call-seq:
+ * ObjectSpace._id2ref(object_id) -> an_object
+ *
+ * Converts an object id to a reference to the object. May not be
+ * called on an object id passed as a parameter to a finalizer.
+ *
+ * s = "I am a string" #=> "I am a string"
+ * r = ObjectSpace._id2ref(s.object_id) #=> "I am a string"
+ * r == s #=> true
+ *
+ */
+
+static VALUE
+id2ref(VALUE obj, VALUE objid)
+{
+#if SIZEOF_LONG == SIZEOF_VOIDP
+#define NUM2PTR(x) NUM2ULONG(x)
+#elif SIZEOF_LONG_LONG == SIZEOF_VOIDP
+#define NUM2PTR(x) NUM2ULL(x)
+#endif
rb_objspace_t *objspace = &rb_objspace;
- return during_gc;
+ VALUE ptr;
+ void *p0;
+
+ ptr = NUM2PTR(objid);
+ p0 = (void *)ptr;
+
+ if (ptr == Qtrue) return Qtrue;
+ if (ptr == Qfalse) return Qfalse;
+ if (ptr == Qnil) return Qnil;
+ if (FIXNUM_P(ptr)) return (VALUE)ptr;
+ if (FLONUM_P(ptr)) return (VALUE)ptr;
+ ptr = obj_id_to_ref(objid);
+
+ if ((ptr % sizeof(RVALUE)) == (4 << 2)) {
+ ID symid = ptr / sizeof(RVALUE);
+ if (rb_id2name(symid) == 0)
+ rb_raise(rb_eRangeError, "%p is not symbol id value", p0);
+ return ID2SYM(symid);
+ }
+
+ if (!is_id_value(objspace, ptr)) {
+ rb_raise(rb_eRangeError, "%p is not id value", p0);
+ }
+ if (!is_live_object(objspace, ptr)) {
+ rb_raise(rb_eRangeError, "%p is recycled object", p0);
+ }
+ return (VALUE)ptr;
}
-#define RANY(o) ((RVALUE*)(o))
+/*
+ * Document-method: __id__
+ * Document-method: object_id
+ *
+ * call-seq:
+ * obj.__id__ -> integer
+ * obj.object_id -> integer
+ *
+ * Returns an integer identifier for +obj+.
+ *
+ * The same number will be returned on all calls to +id+ for a given object,
+ * and no two active objects will share an id.
+ *
+ * Object#object_id is a different concept from the +:name+ notation, which
+ * returns the symbol id of +name+.
+ *
+ * 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.
+ */
VALUE
-rb_newobj(void)
+rb_obj_id(VALUE obj)
{
- rb_objspace_t *objspace = &rb_objspace;
- VALUE obj;
+ /*
+ * 32-bit VALUE space
+ * MSB ------------------------ LSB
+ * false 00000000000000000000000000000000
+ * true 00000000000000000000000000000010
+ * nil 00000000000000000000000000000100
+ * undef 00000000000000000000000000000110
+ * symbol ssssssssssssssssssssssss00001110
+ * object oooooooooooooooooooooooooooooo00 = 0 (mod sizeof(RVALUE))
+ * fixnum fffffffffffffffffffffffffffffff1
+ *
+ * object_id space
+ * LSB
+ * false 00000000000000000000000000000000
+ * true 00000000000000000000000000000010
+ * nil 00000000000000000000000000000100
+ * undef 00000000000000000000000000000110
+ * symbol 000SSSSSSSSSSSSSSSSSSSSSSSSSSS0 S...S % A = 4 (S...S = s...s * A + 4)
+ * object oooooooooooooooooooooooooooooo0 o...o % A = 0
+ * fixnum fffffffffffffffffffffffffffffff1 bignum if required
+ *
+ * where A = sizeof(RVALUE)/4
+ *
+ * sizeof(RVALUE) is
+ * 20 if 32-bit, double is 4-byte aligned
+ * 24 if 32-bit, double is 8-byte aligned
+ * 40 if 64-bit
+ */
+ if (SYMBOL_P(obj)) {
+ return (SYM2ID(obj) * sizeof(RVALUE) + (4 << 2)) | FIXNUM_FLAG;
+ }
+ else if (FLONUM_P(obj)) {
+#if SIZEOF_LONG == SIZEOF_VOIDP
+ return LONG2NUM((SIGNED_VALUE)obj);
+#else
+ return LL2NUM((SIGNED_VALUE)obj);
+#endif
+ }
+ else if (SPECIAL_CONST_P(obj)) {
+ return LONG2NUM((SIGNED_VALUE)obj);
+ }
+ return nonspecial_obj_id(obj);
+}
- if (UNLIKELY(during_gc)) {
- dont_gc = 1;
- during_gc = 0;
- rb_bug("object allocation during garbage collection phase");
+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_tdata)
+{
+ size_t size = 0;
+
+ if (SPECIAL_CONST_P(obj)) {
+ return 0;
}
- if (UNLIKELY(ruby_gc_stress && !ruby_disable_gc_stress)) {
- if (!garbage_collect(objspace)) {
- during_gc = 0;
- rb_memerror();
+ 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_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_tdata) 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);
}
- if (UNLIKELY(!freelist)) {
- if (!gc_lazy_sweep(objspace)) {
- during_gc = 0;
- rb_memerror();
+ 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)
+{
+ VALUE k = (VALUE)key;
+ VALUE hash = (VALUE)arg;
+ rb_hash_aset(hash, k, INT2FIX(0));
+ return ST_CONTINUE;
+}
+
+/*
+ * call-seq:
+ * ObjectSpace.count_objects([result_hash]) -> hash
+ *
+ * Counts objects for each type.
+ *
+ * It returns a hash, such as:
+ * {
+ * :TOTAL=>10000,
+ * :FREE=>3011,
+ * :T_OBJECT=>6,
+ * :T_CLASS=>404,
+ * # ...
+ * }
+ *
+ * The contents of the returned hash are implementation specific.
+ * 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.
+ *
+ * This method is only expected to work on C Ruby.
+ *
+ */
+
+static VALUE
+count_objects(int argc, VALUE *argv, VALUE os)
+{
+ rb_objspace_t *objspace = &rb_objspace;
+ size_t counts[T_MASK+1];
+ size_t freed = 0;
+ size_t total = 0;
+ size_t i;
+ VALUE hash;
+
+ if (rb_scan_args(argc, argv, "01", &hash) == 1) {
+ if (!RB_TYPE_P(hash, T_HASH))
+ rb_raise(rb_eTypeError, "non-hash given");
+ }
+
+ for (i = 0; i <= T_MASK; i++) {
+ counts[i] = 0;
+ }
+
+ for (i = 0; i < heap_pages_used; i++) {
+ struct heap_page *page = heap_pages_sorted[i];
+ RVALUE *p, *pend;
+
+ p = page->start; pend = p + page->limit;
+ for (;p < pend; p++) {
+ if (p->as.basic.flags) {
+ counts[BUILTIN_TYPE(p)]++;
+ }
+ else {
+ freed++;
+ }
}
+ total += page->limit;
}
- obj = (VALUE)freelist;
- freelist = freelist->as.free.next;
+ if (hash == Qnil) {
+ hash = rb_hash_new();
+ }
+ else if (!RHASH_EMPTY_P(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));
- MEMZERO((void*)obj, RVALUE, 1);
-#ifdef GC_DEBUG
- RANY(obj)->file = rb_sourcefile();
- RANY(obj)->line = rb_sourceline();
-#endif
- GC_PROF_INC_LIVE_NUM;
+ for (i = 0; i <= T_MASK; i++) {
+ VALUE type;
+ switch (i) {
+#define COUNT_TYPE(t) case (t): type = ID2SYM(rb_intern(#t)); break;
+ COUNT_TYPE(T_NONE);
+ COUNT_TYPE(T_OBJECT);
+ COUNT_TYPE(T_CLASS);
+ COUNT_TYPE(T_MODULE);
+ COUNT_TYPE(T_FLOAT);
+ COUNT_TYPE(T_STRING);
+ COUNT_TYPE(T_REGEXP);
+ COUNT_TYPE(T_ARRAY);
+ COUNT_TYPE(T_HASH);
+ COUNT_TYPE(T_STRUCT);
+ COUNT_TYPE(T_BIGNUM);
+ COUNT_TYPE(T_FILE);
+ COUNT_TYPE(T_DATA);
+ COUNT_TYPE(T_MATCH);
+ COUNT_TYPE(T_COMPLEX);
+ COUNT_TYPE(T_RATIONAL);
+ COUNT_TYPE(T_NIL);
+ COUNT_TYPE(T_TRUE);
+ COUNT_TYPE(T_FALSE);
+ COUNT_TYPE(T_SYMBOL);
+ COUNT_TYPE(T_FIXNUM);
+ COUNT_TYPE(T_UNDEF);
+ COUNT_TYPE(T_NODE);
+ COUNT_TYPE(T_ICLASS);
+ COUNT_TYPE(T_ZOMBIE);
+#undef COUNT_TYPE
+ default: type = INT2NUM(i); break;
+ }
+ if (counts[i])
+ rb_hash_aset(hash, type, SIZET2NUM(counts[i]));
+ }
- return obj;
+ return hash;
}
-NODE*
-rb_node_newnode(enum node_type type, VALUE a0, VALUE a1, VALUE a2)
+/*
+ ------------------------ Garbage Collection ------------------------
+*/
+
+/* Sweeping */
+
+static VALUE
+lazy_sweep_enable(void)
{
- NODE *n = (NODE*)rb_newobj();
+ rb_objspace_t *objspace = &rb_objspace;
- n->flags |= T_NODE;
- nd_set_type(n, type);
+ objspace->flags.dont_lazy_sweep = FALSE;
+ return Qnil;
+}
- n->u1.value = a0;
- n->u2.value = a1;
- n->u3.value = a2;
+static size_t
+objspace_live_num(rb_objspace_t *objspace)
+{
+ return objspace->profile.total_allocated_object_num - objspace->profile.total_freed_object_num;
+}
- return n;
+static size_t
+objspace_limit_num(rb_objspace_t *objspace)
+{
+ return heap_eden->limit + heap_tomb->limit;
}
-VALUE
-rb_data_object_alloc(VALUE klass, void *datap, RUBY_DATA_FUNC dmark, RUBY_DATA_FUNC dfree)
+static size_t
+objspace_free_num(rb_objspace_t *objspace)
{
- 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 objspace_limit_num(objspace) - (objspace_live_num(objspace) - heap_pages_final_num);
+}
- return (VALUE)data;
+static void
+gc_setup_mark_bits(struct heap_page *page)
+{
+#if USE_RGENGC
+ /* copy oldgen bitmap to mark bitmap */
+ memcpy(&page->mark_bits[0], &page->oldgen_bits[0], HEAP_BITMAP_SIZE);
+#else
+ /* clear mark bitmap */
+ memset(&page->mark_bits[0], 0, HEAP_BITMAP_SIZE);
+#endif
}
-VALUE
-rb_data_typed_object_alloc(VALUE klass, void *datap, const rb_data_type_t *type)
+static inline void
+gc_page_sweep(rb_objspace_t *objspace, rb_heap_t *heap, struct heap_page *sweep_page)
{
- NEWOBJ(data, struct RTypedData);
+ int i;
+ size_t empty_num = 0, freed_num = 0, final_num = 0;
+ RVALUE *p, *pend,*offset;
+ bits_t *bits, bitset;
+
+ rgengc_report(1, objspace, "page_sweep: start.\n");
+
+ sweep_page->before_sweep = 0;
+
+ p = sweep_page->start; pend = p + sweep_page->limit;
+ 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) && BUILTIN_TYPE(p) != T_ZOMBIE) {
+ if (p->as.basic.flags) {
+ rgengc_report(3, objspace, "page_sweep: free %p (%s)\n", p, obj_type_name((VALUE)p));
+#if USE_RGENGC && RGENGC_CHECK_MODE
+ if (objspace->rgengc.during_minor_gc && RVALUE_OLD_P((VALUE)p)) rb_bug("page_sweep: %p (%s) is old while minor GC.\n", p, obj_type_name((VALUE)p));
+ if (rgengc_remembered(objspace, (VALUE)p)) rb_bug("page_sweep: %p (%s) is remembered.\n", p, obj_type_name((VALUE)p));
+#endif
+ if (obj_free(objspace, (VALUE)p)) {
+ final_num++;
+ }
+ else if (FL_TEST(p, FL_FINALIZE)) {
+ RDATA(p)->dfree = 0;
+ make_deferred(objspace,p);
+ final_num++;
+ }
+ else {
+ (void)VALGRIND_MAKE_MEM_UNDEFINED((void*)p, sizeof(RVALUE));
+ heap_page_add_freeobj(objspace, sweep_page, (VALUE)p);
+ rgengc_report(3, objspace, "page_sweep: %p (%s) is added to freelist\n", p, obj_type_name((VALUE)p));
+ freed_num++;
+ }
+ }
+ else {
+ empty_num++;
+ }
+ }
+ p++;
+ bitset >>= 1;
+ } while (bitset);
+ }
+ }
- if (klass) Check_Type(klass, T_CLASS);
+ gc_setup_mark_bits(sweep_page);
+
+#if GC_PROFILE_MORE_DETAIL
+ if (objspace->profile.run) {
+ gc_profile_record *record = gc_prof_record(objspace);
+ record->removing_objects += final_num + freed_num;
+ record->empty_objects += empty_num;
+ }
+#endif
- OBJSETUP(data, klass, T_DATA);
+ if (final_num + freed_num + empty_num == sweep_page->limit) {
+ /* there are no living objects -> move this page to tomb heap */
+ heap_unlink_page(objspace, heap, sweep_page);
+ heap_add_page(objspace, heap_tomb, sweep_page);
+ }
+ else {
+ if (freed_num + empty_num > 0) {
+ heap_add_freepage(objspace, heap, sweep_page);
+ }
+ else {
+ sweep_page->free_next = NULL;
+ }
+ }
+ heap_pages_swept_num += freed_num + empty_num;
+ objspace->profile.total_freed_object_num += freed_num;
+ heap_pages_final_num += final_num;
+ sweep_page->final_num = final_num;
- data->data = datap;
- data->typed_flag = 1;
- data->type = type;
+ if (heap_pages_deferred_final && !finalizing) {
+ rb_thread_t *th = GET_THREAD();
+ if (th) {
+ gc_finalize_deferred_register();
+ }
+ }
- return (VALUE)data;
+ rgengc_report(1, objspace, "page_sweep: end.\n");
}
-size_t
-rb_objspace_data_type_memsize(VALUE obj)
+/* allocate additional minimum page to work */
+static void
+gc_heap_prepare_minimum_pages(rb_objspace_t *objspace, rb_heap_t *heap)
{
- if (RTYPEDDATA_P(obj) && RTYPEDDATA_TYPE(obj)->function.dsize) {
- return RTYPEDDATA_TYPE(obj)->function.dsize(RTYPEDDATA_DATA(obj));
+ if (!heap->free_pages) {
+ /* there is no free after page_sweep() */
+ heap_set_increment(objspace, 0);
+ if (!heap_increment(objspace, heap)) { /* can't allocate additional free objects */
+ during_gc = 0;
+ rb_memerror();
+ }
}
- else {
- return 0;
+}
+
+static void
+gc_before_heap_sweep(rb_objspace_t *objspace, rb_heap_t *heap)
+{
+ heap->sweep_pages = heap->pages;
+ heap->free_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;
}
-const char *
-rb_objspace_data_type_name(VALUE obj)
+#if defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ == 4
+__attribute__((noinline))
+#endif
+static void
+gc_before_sweep(rb_objspace_t *objspace)
{
- if (RTYPEDDATA_P(obj)) {
- return RTYPEDDATA_TYPE(obj)->wrap_struct_name;
+ rb_heap_t *heap;
+ size_t total_limit_num;
+
+ rgengc_report(1, objspace, "gc_before_sweep\n");
+
+ /* sweep unlinked method entries */
+ if (GET_VM()->unlinked_method_entry_list) {
+ rb_sweep_method_entry(GET_VM());
+ }
+
+ heap_pages_swept_num = 0;
+ total_limit_num = objspace_limit_num(objspace);
+
+ heap_pages_min_free_slots = (size_t)(total_limit_num * 0.30);
+ if (heap_pages_min_free_slots < gc_params.heap_min_free_slots) {
+ heap_pages_min_free_slots = gc_params.heap_min_free_slots;
+ }
+ heap_pages_max_free_slots = (size_t)(total_limit_num * 0.80);
+ if (heap_pages_max_free_slots < gc_params.heap_min_slots) {
+ heap_pages_max_free_slots = gc_params.heap_min_slots;
+ }
+ if (0) fprintf(stderr, "heap_pages_min_free_slots: %d, heap_pages_max_free_slots: %d\n",
+ (int)heap_pages_min_free_slots, (int)heap_pages_max_free_slots);
+
+ heap = heap_eden;
+ gc_before_heap_sweep(objspace, heap);
+
+ gc_prof_set_malloc_info(objspace);
+
+ /* reset malloc info */
+ if (0) fprintf(stderr, "%d\t%d\t%d\n", (int)rb_gc_count(), (int)malloc_increase, (int)malloc_limit);
+
+ {
+ size_t inc = ATOMIC_SIZE_EXCHANGE(malloc_increase, 0);
+ size_t old_limit = malloc_limit;
+
+ if (inc > malloc_limit) {
+ malloc_limit = (size_t)(inc * gc_params.malloc_limit_growth_factor);
+ if (gc_params.malloc_limit_max > 0 && /* ignore max-check if 0 */
+ malloc_limit > gc_params.malloc_limit_max) {
+ malloc_limit = inc;
+ }
+ }
+ else {
+ malloc_limit = (size_t)(malloc_limit * 0.98); /* magic number */
+ if (malloc_limit < gc_params.malloc_limit_min) {
+ malloc_limit = gc_params.malloc_limit_min;
+ }
+ }
+
+ if (0) {
+ if (old_limit != malloc_limit) {
+ fprintf(stderr, "[%"PRIuSIZE"] malloc_limit: %"PRIuSIZE" -> %"PRIuSIZE"\n",
+ rb_gc_count(), old_limit, malloc_limit);
+ }
+ else {
+ fprintf(stderr, "[%"PRIuSIZE"] malloc_limit: not changed (%"PRIuSIZE")\n",
+ rb_gc_count(), malloc_limit);
+ }
+ }
+ }
+
+ /* reset oldspace info */
+#if RGENGC_ESTIMATE_OLDSPACE
+ if (objspace->rgengc.during_minor_gc) {
+ if (objspace->rgengc.oldspace_increase > objspace->rgengc.oldspace_increase_limit) {
+ objspace->rgengc.need_major_gc = TRUE;
+ objspace->rgengc.oldspace_increase_limit =
+ (size_t)(objspace->rgengc.oldspace_increase_limit * gc_params.oldspace_limit_growth_factor);
+ if (objspace->rgengc.oldspace_increase_limit > gc_params.oldspace_limit_max) {
+ objspace->rgengc.oldspace_increase_limit = gc_params.oldspace_limit_max;
+ }
+ }
+ else {
+ objspace->rgengc.oldspace_increase_limit =
+ (size_t)(objspace->rgengc.oldspace_increase_limit / ((gc_params.oldspace_limit_growth_factor - 1)/10 + 1));
+ if (objspace->rgengc.oldspace_increase_limit < gc_params.oldspace_limit_min) {
+ objspace->rgengc.oldspace_increase_limit = gc_params.oldspace_limit_min;
+ }
+ }
+
+ if (0) fprintf(stderr, "%d\t%d\t%u\t%u\t%d\n", (int)rb_gc_count(), objspace->rgengc.need_major_gc,
+ (unsigned int)objspace->rgengc.oldspace_increase,
+ (unsigned int)objspace->rgengc.oldspace_increase_limit,
+ (unsigned int)gc_params.oldspace_limit_max);
}
else {
- return 0;
+ /* major GC */
+ objspace->rgengc.oldspace_increase = 0;
}
+
+#endif
+
}
-#ifdef __ia64
-#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)
+static void
+gc_after_sweep(rb_objspace_t *objspace)
+{
+ rb_heap_t *heap = heap_eden;
+
+ rgengc_report(1, objspace, "after_gc_sweep: heap->limit: %d, heap->swept_num: %d, min_free_slots: %d\n",
+ (int)heap->limit, (int)heap_pages_swept_num, (int)heap_pages_min_free_slots);
+
+ if (heap_pages_swept_num < heap_pages_min_free_slots) {
+ heap_set_increment(objspace, (heap_pages_min_free_slots - heap_pages_swept_num) / HEAP_OBJ_LIMIT);
+ heap_increment(objspace, heap);
+
+#if USE_RGENGC
+ if (objspace->rgengc.remembered_shady_object_count + objspace->rgengc.old_object_count > (heap_pages_length * HEAP_OBJ_LIMIT) / 2) {
+ /* if [old]+[remembered shady] > [all object count]/2, then do major GC */
+ objspace->rgengc.need_major_gc = TRUE;
+ }
#endif
+ }
-#define STACK_START (th->machine_stack_start)
-#define STACK_END (th->machine_stack_end)
-#define STACK_LEVEL_MAX (th->machine_stack_maxsize/sizeof(VALUE))
+ gc_prof_set_heap_info(objspace);
-#if STACK_GROW_DIRECTION < 0
-# define STACK_LENGTH (size_t)(STACK_START - STACK_END)
-#elif STACK_GROW_DIRECTION > 0
-# define STACK_LENGTH (size_t)(STACK_END - STACK_START + 1)
+ heap_pages_free_unused_pages(objspace);
+
+ /* if heap_pages has unused pages, then assign them to increment */
+ if (heap_pages_increment < heap_tomb->used) {
+ heap_pages_increment = heap_tomb->used;
+ heap_pages_expand_sorted(objspace);
+ }
+
+#if RGENGC_PROFILE > 0
+ if (0) {
+ fprintf(stderr, "%d\t%d\t%d\t%d\t%d\t%d\t%d\n",
+ (int)rb_gc_count(),
+ (int)objspace->profile.major_gc_count,
+ (int)objspace->profile.minor_gc_count,
+ (int)objspace->profile.promote_infant_count,
+#if RGENGC_THREEGEN
+ (int)objspace->profile.promote_young_count,
#else
-# define STACK_LENGTH ((STACK_END < STACK_START) ? (size_t)(STACK_START - STACK_END) \
- : (size_t)(STACK_END - STACK_START + 1))
+ 0,
#endif
-#if !STACK_GROW_DIRECTION
-int ruby_stack_grow_direction;
-int
-ruby_get_stack_grow_direction(volatile VALUE *addr)
+ (int)objspace->profile.remembered_normal_object_count,
+ (int)objspace->rgengc.remembered_shady_object_count);
+ }
+#endif
+
+ gc_event_hook(objspace, RUBY_INTERNAL_EVENT_GC_END, 0 /* TODO: pass minor/immediate flag? */);
+}
+
+static int
+gc_heap_lazy_sweep(rb_objspace_t *objspace, rb_heap_t *heap)
{
- VALUE *end;
- SET_MACHINE_STACK_END(&end);
+ struct heap_page *page = heap->sweep_pages, *next;
+ int result = FALSE;
- if (end > addr) return ruby_stack_grow_direction = 1;
- return ruby_stack_grow_direction = -1;
+ if (page == NULL) return FALSE;
+
+#if GC_ENABLE_LAZY_SWEEP
+ gc_prof_sweep_timer_start(objspace);
+#endif
+
+ while (page) {
+ heap->sweep_pages = next = page->next;
+
+ gc_page_sweep(objspace, heap, page);
+
+ if (!next) gc_after_sweep(objspace);
+
+ if (heap->free_pages) {
+ result = TRUE;
+ break;
+ }
+
+ page = next;
+ }
+
+#if GC_ENABLE_LAZY_SWEEP
+ gc_prof_sweep_timer_stop(objspace);
+#endif
+
+ return result;
+}
+
+static void
+gc_heap_rest_sweep(rb_objspace_t *objspace, rb_heap_t *heap)
+{
+ if (is_lazy_sweeping(heap)) {
+ during_gc++;
+ while (is_lazy_sweeping(heap)) {
+ gc_heap_lazy_sweep(objspace, heap);
+ }
+ during_gc = 0;
+ }
}
+
+static void
+gc_rest_sweep(rb_objspace_t *objspace)
+{
+ rb_heap_t *heap = heap_eden; /* lazy sweep only for eden */
+ gc_heap_rest_sweep(objspace, heap);
+}
+
+static void
+gc_sweep(rb_objspace_t *objspace, int immediate_sweep)
+{
+ if (immediate_sweep) {
+#if !GC_ENABLE_LAZY_SWEEP
+ gc_prof_sweep_timer_start(objspace);
#endif
+ gc_before_sweep(objspace);
+ gc_heap_rest_sweep(objspace, heap_eden);
+#if !GC_ENABLE_LAZY_SWEEP
+ gc_prof_sweep_timer_stop(objspace);
+#endif
+ }
+ else {
+ struct heap_page *page;
+ gc_before_sweep(objspace);
+ page = heap_eden->sweep_pages;
+ while (page) {
+ page->before_sweep = 1;
+ page = page->next;
+ }
+ gc_heap_lazy_sweep(objspace, heap_eden);
+ }
+
+ gc_heap_prepare_minimum_pages(objspace, heap_eden);
+}
-/* Marking stack */
+/* Marking - Marking stack */
static void push_mark_stack(mark_stack_t *, VALUE);
static int pop_mark_stack(mark_stack_t *, VALUE *);
@@ -1371,6 +3062,7 @@ push_mark_stack_chunk(mark_stack_t *stack)
{
stack_chunk_t *next;
+ assert(stack->index == stack->limit);
if (stack->cache_size > 0) {
next = stack->cache;
stack->cache = stack->cache->next;
@@ -1392,6 +3084,7 @@ pop_mark_stack_chunk(mark_stack_t *stack)
stack_chunk_t *prev;
prev = stack->chunk->next;
+ assert(stack->index == 0);
add_stack_chunk_cache(stack, stack->chunk);
stack->chunk = prev;
stack->index = stack->limit;
@@ -1430,9 +3123,10 @@ pop_mark_stack(mark_stack_t *stack, VALUE *data)
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;
}
@@ -1441,15 +3135,47 @@ init_mark_stack(mark_stack_t *stack)
{
int i;
- push_mark_stack_chunk(stack);
- stack->limit = STACK_CHUNK_SIZE;
+ if (0) push_mark_stack_chunk(stack);
+ stack->index = stack->limit = STACK_CHUNK_SIZE;
- for(i=0; i < 4; i++) {
+ for (i=0; i < 4; i++) {
add_stack_chunk_cache(stack, stack_chunk_alloc());
}
stack->unused_cache_size = stack->cache_size;
}
+/* Marking */
+
+#ifdef __ia64
+#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)
+#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))
+
+#if STACK_GROW_DIRECTION < 0
+# define STACK_LENGTH (size_t)(STACK_START - STACK_END)
+#elif STACK_GROW_DIRECTION > 0
+# define STACK_LENGTH (size_t)(STACK_END - STACK_START + 1)
+#else
+# define STACK_LENGTH ((STACK_END < STACK_START) ? (size_t)(STACK_START - STACK_END) \
+ : (size_t)(STACK_END - STACK_START + 1))
+#endif
+#if !STACK_GROW_DIRECTION
+int ruby_stack_grow_direction;
+int
+ruby_get_stack_grow_direction(volatile VALUE *addr)
+{
+ VALUE *end;
+ SET_MACHINE_STACK_END(&end);
+
+ if (end > addr) return ruby_stack_grow_direction = 1;
+ return ruby_stack_grow_direction = -1;
+}
+#endif
size_t
ruby_stack_length(VALUE **p)
@@ -1490,62 +3216,14 @@ ruby_stack_check(void)
#endif
}
-#define MARK_STACK_EMPTY (mark_stack_ptr == mark_stack)
-
-static void gc_mark(rb_objspace_t *objspace, VALUE ptr);
-static void gc_mark_children(rb_objspace_t *objspace, VALUE ptr);
-
-static void
-gc_mark_stacked_objects(rb_objspace_t *objspace)
-{
- mark_stack_t *mstack = &objspace->mark_stack;
- VALUE obj = 0;
-
- if (!mstack->index) return;
- while (pop_mark_stack(mstack, &obj)) {
- gc_mark_children(objspace, obj);
- }
- shrink_stack_chunk_cache(mstack);
-}
-
-static inline int
-is_pointer_to_heap(rb_objspace_t *objspace, void *ptr)
-{
- register RVALUE *p = RANY(ptr);
- register struct sorted_heaps_slot *heap;
- register size_t hi, lo, mid;
-
- if (p < lomem || p > 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;
- while (lo < hi) {
- mid = (lo + hi) / 2;
- heap = &objspace->heap.sorted[mid];
- if (heap->start <= p) {
- if (p < heap->end)
- return TRUE;
- lo = mid + 1;
- }
- else {
- hi = mid;
- }
- }
- return FALSE;
-}
-
+ATTRIBUTE_NO_ADDRESS_SAFETY_ANALYSIS
static void
mark_locations_array(rb_objspace_t *objspace, register VALUE *x, register long n)
{
VALUE v;
while (n--) {
v = *x;
- 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++;
}
}
@@ -1573,10 +3251,10 @@ struct mark_tbl_arg {
};
static int
-mark_entry(ID key, VALUE value, st_data_t data)
+mark_entry(st_data_t key, st_data_t value, st_data_t data)
{
struct mark_tbl_arg *arg = (void*)data;
- gc_mark(arg->objspace, value);
+ gc_mark(arg->objspace, (VALUE)value);
return ST_CONTINUE;
}
@@ -1590,10 +3268,10 @@ mark_tbl(rb_objspace_t *objspace, st_table *tbl)
}
static int
-mark_key(VALUE key, VALUE value, st_data_t data)
+mark_key(st_data_t key, st_data_t value, st_data_t data)
{
struct mark_tbl_arg *arg = (void*)data;
- gc_mark(arg->objspace, key);
+ gc_mark(arg->objspace, (VALUE)key);
return ST_CONTINUE;
}
@@ -1613,11 +3291,11 @@ rb_mark_set(st_table *tbl)
}
static int
-mark_keyvalue(VALUE key, VALUE value, st_data_t data)
+mark_keyvalue(st_data_t key, st_data_t value, st_data_t data)
{
struct mark_tbl_arg *arg = (void*)data;
- gc_mark(arg->objspace, key);
- gc_mark(arg->objspace, value);
+ gc_mark(arg->objspace, (VALUE)key);
+ gc_mark(arg->objspace, (VALUE)value);
return ST_CONTINUE;
}
@@ -1642,6 +3320,7 @@ mark_method_entry(rb_objspace_t *objspace, const rb_method_entry_t *me)
const rb_method_definition_t *def = me->def;
gc_mark(objspace, me->klass);
+ again:
if (!def) return;
switch (def->type) {
case VM_METHOD_TYPE_ISEQ:
@@ -1654,6 +3333,12 @@ mark_method_entry(rb_objspace_t *objspace, const rb_method_entry_t *me)
case VM_METHOD_TYPE_IVAR:
gc_mark(objspace, def->body.attr.location);
break;
+ case VM_METHOD_TYPE_REFINED:
+ if (def->body.orig_me) {
+ def = def->body.orig_me->def;
+ goto again;
+ }
+ break;
default:
break; /* ignore */
}
@@ -1683,26 +3368,11 @@ mark_m_tbl(rb_objspace_t *objspace, st_table *tbl)
}
static int
-free_method_entry_i(ID key, rb_method_entry_t *me, st_data_t data)
-{
- if (!me->mark) {
- rb_free_method_entry(me);
- }
- return ST_CONTINUE;
-}
-
-void
-rb_free_m_table(st_table *tbl)
-{
- st_foreach(tbl, free_method_entry_i, 0);
- st_free_table(tbl);
-}
-
-static int
mark_const_entry_i(ID key, const rb_const_entry_t *ce, st_data_t data)
{
struct mark_tbl_arg *arg = (void*)data;
gc_mark(arg->objspace, ce->value);
+ gc_mark(arg->objspace, ce->file);
return ST_CONTINUE;
}
@@ -1715,18 +3385,54 @@ mark_const_tbl(rb_objspace_t *objspace, st_table *tbl)
st_foreach(tbl, mark_const_entry_i, (st_data_t)&arg);
}
-static int
-free_const_entry_i(ID key, rb_const_entry_t *ce, st_data_t data)
+#if STACK_GROW_DIRECTION < 0
+#define GET_STACK_BOUNDS(start, end, appendix) ((start) = STACK_END, (end) = STACK_START)
+#elif STACK_GROW_DIRECTION > 0
+#define GET_STACK_BOUNDS(start, end, appendix) ((start) = STACK_START, (end) = STACK_END+(appendix))
+#else
+#define GET_STACK_BOUNDS(start, end, appendix) \
+ ((STACK_END < STACK_START) ? \
+ ((start) = STACK_END, (end) = STACK_START) : ((start) = STACK_START, (end) = STACK_END+(appendix)))
+#endif
+
+static void
+mark_current_machine_context(rb_objspace_t *objspace, rb_thread_t *th)
{
- xfree(ce);
- return ST_CONTINUE;
+ union {
+ rb_jmp_buf j;
+ VALUE v[sizeof(rb_jmp_buf) / sizeof(VALUE)];
+ } save_regs_gc_mark;
+ VALUE *stack_start, *stack_end;
+
+ FLUSH_REGISTER_WINDOWS;
+ /* This assumes that all registers are saved into the jmp_buf (and stack) */
+ rb_setjmp(save_regs_gc_mark.j);
+
+ GET_STACK_BOUNDS(stack_start, stack_end, 1);
+
+ mark_locations_array(objspace, save_regs_gc_mark.v, numberof(save_regs_gc_mark.v));
+
+ rb_gc_mark_locations(stack_start, stack_end);
+#ifdef __ia64
+ rb_gc_mark_locations(th->machine_register_stack_start, th->machine_register_stack_end);
+#endif
+#if defined(__mc68000__)
+ mark_locations_array(objspace, (VALUE*)((char*)STACK_END + 2),
+ (STACK_START - STACK_END));
+#endif
}
void
-rb_free_const_table(st_table *tbl)
+rb_gc_mark_machine_stack(rb_thread_t *th)
{
- st_foreach(tbl, free_const_entry_i, 0);
- st_free_table(tbl);
+ rb_objspace_t *objspace = &rb_objspace;
+ VALUE *stack_start, *stack_end;
+
+ GET_STACK_BOUNDS(stack_start, stack_end, 0);
+ rb_gc_mark_locations(stack_start, stack_end);
+#ifdef __ia64
+ rb_gc_mark_locations(th->machine_register_stack_start, th->machine_register_stack_end);
+#endif
}
void
@@ -1735,27 +3441,83 @@ 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(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 inline int
+gc_marked(rb_objspace_t *objspace, VALUE ptr)
+{
+ register bits_t *bits = GET_HEAP_MARK_BITS(ptr);
+ if (MARKED_IN_BITMAP(bits, ptr)) return 1;
+ return 0;
+}
+
+static inline int
+gc_mark_ptr(rb_objspace_t *objspace, VALUE ptr)
+{
+ register bits_t *bits = GET_HEAP_MARK_BITS(ptr);
+ if (gc_marked(objspace, ptr)) return 0;
+ MARK_IN_BITMAP(bits, ptr);
+ return 1;
+}
+
+static void
+rgengc_check_shady(rb_objspace_t *objspace, VALUE obj)
+{
+#if USE_RGENGC
+ if (objspace->rgengc.parent_object_is_old) {
+ if (RVALUE_SHADY(obj)) {
+ if (rgengc_remember(objspace, obj)) {
+ objspace->rgengc.remembered_shady_object_count++;
+ }
+ }
+#if RGENGC_THREEGEN
+ else {
+ if (gc_marked(objspace, obj)) {
+ if (!RVALUE_OLD_P(obj)) {
+ /* An object pointed from an OLD object should be OLD. */
+ rgengc_remember(objspace, obj);
+ }
+ }
+ else {
+ if (RVALUE_INFANT_P(obj)) {
+ RVALUE_PROMOTE_INFANT(obj);
+ }
+ }
+ }
+#endif
}
+#endif
}
static void
gc_mark(rb_objspace_t *objspace, VALUE ptr)
{
- register RVALUE *obj;
-
- obj = RANY(ptr);
- if (rb_special_const_p(ptr)) return; /* special const not marked */
- if (obj->as.basic.flags == 0) return; /* free cell */
- if (obj->as.basic.flags & FL_MARK) return; /* already marked */
- obj->as.basic.flags |= FL_MARK;
- objspace->heap.live_num++;
+ if (!is_markable_object(objspace, ptr)) return;
- push_mark_stack(&objspace->mark_stack, ptr);
+ if (LIKELY(objspace->mark_func_data == 0)) {
+ rgengc_check_shady(objspace, ptr);
+ if (!gc_mark_ptr(objspace, ptr)) return; /* already marked */
+ push_mark_stack(&objspace->mark_stack, ptr);
+ }
+ else {
+ objspace->mark_func_data->mark_func(ptr, objspace->mark_func_data->data);
+ }
}
void
@@ -1764,6 +3526,20 @@ rb_gc_mark(VALUE ptr)
gc_mark(&rb_objspace, ptr);
}
+/* resurrect non-marked `obj' if obj is before swept */
+
+void
+rb_gc_resurrect(VALUE obj)
+{
+ rb_objspace_t *objspace = &rb_objspace;
+
+ if (is_lazy_sweeping(heap_eden) &&
+ !gc_marked(objspace, obj) &&
+ !is_swept_object(objspace, obj)) {
+ gc_mark_ptr(objspace, obj);
+ }
+}
+
static void
gc_mark_children(rb_objspace_t *objspace, VALUE ptr)
{
@@ -1772,14 +3548,77 @@ gc_mark_children(rb_objspace_t *objspace, VALUE ptr)
goto marking; /* skip */
again:
- obj = RANY(ptr);
- if (rb_special_const_p(ptr)) return; /* special const not marked */
- if (obj->as.basic.flags == 0) return; /* free cell */
- if (obj->as.basic.flags & FL_MARK) return; /* already marked */
- obj->as.basic.flags |= FL_MARK;
- objspace->heap.live_num++;
+ if (LIKELY(objspace->mark_func_data == 0)) {
+ obj = RANY(ptr);
+ if (!is_markable_object(objspace, ptr)) return;
+ rgengc_check_shady(objspace, ptr);
+ if (!gc_mark_ptr(objspace, ptr)) return; /* already marked */
+ }
+ else {
+ gc_mark(objspace, ptr);
+ return;
+ }
marking:
+
+#if USE_RGENGC
+ check_gen_consistency((VALUE)obj);
+
+ if (LIKELY(objspace->mark_func_data == 0)) {
+ /* minor/major common */
+ if (!RVALUE_SHADY(obj)) {
+ if (RVALUE_INFANT_P((VALUE)obj)) {
+ /* infant -> young */
+ RVALUE_PROMOTE_INFANT((VALUE)obj);
+#if RGENGC_THREEGEN
+ /* infant -> young */
+ objspace->rgengc.young_object_count++;
+ objspace->rgengc.parent_object_is_old = FALSE;
+#else
+ /* infant -> old */
+ objspace->rgengc.old_object_count++;
+ objspace->rgengc.parent_object_is_old = TRUE;
+
+#if RGENGC_ESTIMATE_OLDSPACE
+ objspace->rgengc.oldspace_increase += obj_memsize_of((VALUE)obj, FALSE);
+#endif
+
+#endif
+ rgengc_report(3, objspace, "gc_mark_children: promote infant -> young %p (%s).\n", (void *)obj, obj_type_name((VALUE)obj));
+ }
+ else {
+ objspace->rgengc.parent_object_is_old = TRUE;
+
+#if RGENGC_THREEGEN
+ if (RVALUE_YOUNG_P((VALUE)obj)) {
+ /* young -> old */
+ RVALUE_PROMOTE_YOUNG((VALUE)obj);
+ objspace->rgengc.old_object_count++;
+#if RGENGC_ESTIMATE_OLDSPACE
+ objspace->rgengc.oldspace_increase += obj_memsize_of((VALUE)obj, FALSE);
+#endif
+ rgengc_report(3, objspace, "gc_mark_children: promote young -> old %p (%s).\n", (void *)obj, obj_type_name((VALUE)obj));
+ }
+ else {
+#endif
+ if (!objspace->rgengc.during_minor_gc) {
+ /* major/full GC */
+ objspace->rgengc.old_object_count++;
+ }
+#if RGENGC_THREEGEN
+ }
+#endif
+ }
+ }
+ else {
+ rgengc_report(3, objspace, "gc_mark_children: do not promote shady %p (%s).\n", (void *)obj, obj_type_name((VALUE)obj));
+ objspace->rgengc.parent_object_is_old = FALSE;
+ }
+ }
+
+ check_gen_consistency((VALUE)obj);
+#endif /* USE_RGENGC */
+
if (FL_TEST(obj, FL_EXIVAR)) {
rb_mark_generic_ivar(ptr);
}
@@ -1804,7 +3643,6 @@ gc_mark_children(rb_objspace_t *objspace, VALUE ptr)
gc_mark(objspace, (VALUE)obj->as.node.u2.node);
/* fall through */
case NODE_BLOCK: /* 1,3 */
- case NODE_OPTBLOCK:
case NODE_ARRAY:
case NODE_DSTR:
case NODE_DXSTR:
@@ -1814,7 +3652,6 @@ gc_mark_children(rb_objspace_t *objspace, VALUE ptr)
case NODE_CALL:
case NODE_DEFS:
case NODE_OP_ASGN1:
- case NODE_ARGS:
gc_mark(objspace, (VALUE)obj->as.node.u1.node);
/* fall through */
case NODE_SUPER: /* 3 */
@@ -1882,6 +3719,20 @@ gc_mark_children(rb_objspace_t *objspace, VALUE ptr)
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:
@@ -1905,19 +3756,19 @@ gc_mark_children(rb_objspace_t *objspace, VALUE ptr)
mark_locations_array(objspace,
(VALUE*)obj->as.node.u1.value,
obj->as.node.u3.cnt);
- ptr = (VALUE)obj->as.node.u2.node;
+ 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);
- }
+ gc_mark_maybe(objspace, (VALUE)obj->as.node.u1.node);
+ gc_mark_maybe(objspace, (VALUE)obj->as.node.u2.node);
+ gc_mark_maybe(objspace, (VALUE)obj->as.node.u3.node);
}
return; /* no need to mark class. */
}
@@ -1928,9 +3779,10 @@ gc_mark_children(rb_objspace_t *objspace, VALUE ptr)
case T_CLASS:
case T_MODULE:
mark_m_tbl(objspace, RCLASS_M_TBL(obj));
+ if (!RCLASS_EXT(obj)) break;
mark_tbl(objspace, RCLASS_IV_TBL(obj));
mark_const_tbl(objspace, RCLASS_CONST_TBL(obj));
- ptr = RCLASS_SUPER(obj);
+ ptr = RCLASS_SUPER((VALUE)obj);
goto again;
case T_ARRAY:
@@ -1940,7 +3792,7 @@ gc_mark_children(rb_objspace_t *objspace, VALUE ptr)
}
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++);
}
@@ -1997,7 +3849,6 @@ gc_mark_children(rb_objspace_t *objspace, VALUE ptr)
case T_FLOAT:
case T_BIGNUM:
- case T_ZOMBIE:
break;
case T_MATCH:
@@ -2021,7 +3872,7 @@ gc_mark_children(rb_objspace_t *objspace, VALUE ptr)
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++);
@@ -2030,606 +3881,1071 @@ 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");
}
}
-static int obj_free(rb_objspace_t *, VALUE);
+static void
+gc_mark_stacked_objects(rb_objspace_t *objspace)
+{
+ mark_stack_t *mstack = &objspace->mark_stack;
+ VALUE obj = 0;
+
+ if (!mstack->index) return;
+ while (pop_mark_stack(mstack, &obj)) {
+ if (!gc_marked(objspace, obj)) {
+ rb_bug("gc_mark_stacked_objects: %p (%s) is infant, but not marked.", (void *)obj, obj_type_name(obj));
+ }
+ gc_mark_children(objspace, obj);
+ }
+ shrink_stack_chunk_cache(mstack);
+}
+
+#ifndef RGENGC_PRINT_TICK
+#define RGENGC_PRINT_TICK 0
+#endif
+/* the following code is only for internal tuning. */
-static inline void
-add_freelist(rb_objspace_t *objspace, RVALUE *p)
+/* 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 RGENGC_PRINT_TICK
+#if defined(__GNUC__) && defined(__i386__)
+typedef unsigned long long tick_t;
+
+static inline tick_t
+tick(void)
{
- VALGRIND_MAKE_MEM_UNDEFINED((void*)p, sizeof(RVALUE));
- p->as.free.flags = 0;
- p->as.free.next = freelist;
- freelist = p;
+ unsigned long long int x;
+ __asm__ __volatile__ ("rdtsc" : "=A" (x));
+ return x;
+}
+
+#elif defined(__GNUC__) && defined(__x86_64__)
+typedef unsigned long long tick_t;
+
+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;
+
+static inline tick_t
+tick(void)
+{
+ return __rdtsc();
+}
+
+#else /* use clock */
+typedef clock_t tick_t;
+static inline tick_t
+tick(void)
+{
+ return clock();
+}
+#endif
+
+#define MAX_TICKS 0x100
+static tick_t mark_ticks[MAX_TICKS];
+static const char *mark_ticks_categories[MAX_TICKS];
+
static void
-finalize_list(rb_objspace_t *objspace, RVALUE *p)
+show_mark_ticks(void)
{
- while (p) {
- RVALUE *tmp = p->as.free.next;
- run_final(objspace, (VALUE)p);
- if (!FL_TEST(p, FL_SINGLETON)) { /* not freeing page */
- if (objspace->heap.sweep_slots) {
- p->as.free.flags = 0;
- }
- else {
- GC_PROF_DEC_LIVE_NUM;
- add_freelist(objspace, p);
- }
+ 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 {
- struct heaps_slot *slot = (struct heaps_slot *)(VALUE)RDATA(p)->dmark;
- slot->limit--;
+ break;
}
- p = tmp;
}
}
+#endif /* RGENGC_PRINT_TICK */
+
+static void
+gc_mark_roots(rb_objspace_t *objspace, int full_mark, const char **categoryp)
+{
+ struct gc_list *list;
+ rb_thread_t *th = GET_THREAD();
+ if (categoryp) *categoryp = "xxx";
+
+#if RGENGC_PRINT_TICK
+ tick_t start_tick = tick();
+ int tick_count = 0;
+ const char *prev_category = 0;
+
+ if (mark_ticks_categories[0] == 0) {
+ atexit(show_mark_ticks);
+ }
+#endif
+
+#if RGENGC_PRINT_TICK
+#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 /* RGENGC_PRINT_TICK */
+#define MARK_CHECKPOINT_PRINT_TICK(category)
+#endif
+
+#define MARK_CHECKPOINT(category) do { \
+ if (categoryp) *categoryp = category; \
+ MARK_CHECKPOINT_PRINT_TICK(category); \
+} while (0)
+
+ MARK_CHECKPOINT("vm");
+ SET_STACK_END;
+ th->vm->self ? rb_gc_mark(th->vm->self) : rb_vm_mark(th->vm);
+
+ MARK_CHECKPOINT("finalizers");
+ mark_tbl(objspace, finalizer_table);
+
+ MARK_CHECKPOINT("machine_context");
+ mark_current_machine_context(objspace, th);
+
+ MARK_CHECKPOINT("symbols");
+#if USE_RGENGC
+ objspace->rgengc.parent_object_is_old = TRUE;
+ rb_gc_mark_symbols(full_mark);
+ objspace->rgengc.parent_object_is_old = FALSE;
+#else
+ rb_gc_mark_symbols(full_mark);
+#endif
+
+ MARK_CHECKPOINT("encodings");
+ rb_gc_mark_encodings();
+
+ /* mark protected global variables */
+ MARK_CHECKPOINT("global_list");
+ for (list = global_List; list; list = list->next) {
+ rb_gc_mark_maybe(*list->varptr);
+ }
+
+ MARK_CHECKPOINT("end_proc");
+ rb_mark_end_proc();
+
+ 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();
+
+ MARK_CHECKPOINT("parser");
+ rb_gc_mark_parser();
+
+ MARK_CHECKPOINT("live_method_entries");
+ rb_gc_mark_unlinked_live_method_entries(th->vm);
+
+ MARK_CHECKPOINT("finish");
+#undef MARK_CHECKPOINT
+}
+
static void
-unlink_heap_slot(rb_objspace_t *objspace, struct heaps_slot *slot)
+gc_marks_body(rb_objspace_t *objspace, int full_mark)
{
- 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;
+ /* start marking */
+ rgengc_report(1, objspace, "gc_marks_body: start (%s)\n", full_mark ? "full" : "minor");
+
+#if USE_RGENGC
+ objspace->rgengc.parent_object_is_old = FALSE;
+ objspace->rgengc.during_minor_gc = full_mark ? FALSE : TRUE;
+
+ if (objspace->rgengc.during_minor_gc) {
+ objspace->profile.minor_gc_count++;
+ rgengc_rememberset_mark(objspace, heap_eden);
+ }
+ else {
+ objspace->profile.major_gc_count++;
+ rgengc_mark_and_rememberset_clear(objspace, heap_eden);
+ }
+#endif
+ gc_mark_roots(objspace, full_mark, 0);
+ gc_mark_stacked_objects(objspace);
+
+ /* cleanup */
+ rgengc_report(1, objspace, "gc_marks_body: end (%s)\n", full_mark ? "full" : "minor");
}
+#if RGENGC_CHECK_MODE >= 2
+
+#define MAKE_ROOTSIG(obj) (((VALUE)(obj) << 1) | 0x01)
+#define IS_ROOTSIG(obj) ((VALUE)(obj) & 0x01)
+#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
-free_unused_heaps(rb_objspace_t *objspace)
+reflist_destruct(struct reflist *refs)
{
- size_t i, j;
- RVALUE *last = 0;
+ xfree(refs->list);
+ xfree(refs);
+}
- for (i = j = 1; j < heaps_used; i++) {
- if (objspace->heap.sorted[i].slot->limit == 0) {
- if (!last) {
- last = objspace->heap.sorted[i].slot->membase;
- }
- else {
- free(objspace->heap.sorted[i].slot->membase);
- }
- free(objspace->heap.sorted[i].slot);
- heaps_used--;
- }
- else {
- if (i != j) {
- objspace->heap.sorted[j] = objspace->heap.sorted[i];
- }
- j++;
- }
+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);
}
- if (last) {
- if (last < heaps_freed) {
- free(heaps_freed);
- heaps_freed = last;
+ 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 {
- free(last);
+ fprintf(stderr, "<%p@%s>", (void *)obj, obj_type_name(obj));
}
+ if (i+1 < refs->pos) fprintf(stderr, ", ");
}
}
-static void
-slot_sweep(rb_objspace_t *objspace, struct heaps_slot *sweep_slot)
+static int
+reflist_refered_from_machine_context(struct reflist *refs)
{
- size_t free_num = 0, final_num = 0;
- RVALUE *p, *pend;
- RVALUE *free = freelist, *final = deferred_final_list;
- int deferred;
-
- p = sweep_slot->slot; pend = p + sweep_slot->limit;
- while (p < pend) {
- if (!(p->as.basic.flags & FL_MARK)) {
- if (p->as.basic.flags &&
- ((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.flags |= FL_MARK;
- p->as.free.next = deferred_final_list;
- deferred_final_list = p;
- final_num++;
- }
- else {
- add_freelist(objspace, p);
- free_num++;
- }
- }
- else if (BUILTIN_TYPE(p) == T_ZOMBIE) {
- /* objects to be finalized */
- /* do nothing remain marked */
- }
- else {
- RBASIC(p)->flags &= ~FL_MARK;
- }
- p++;
+ 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;
}
- if (final_num + free_num == sweep_slot->limit &&
- objspace->heap.free_num > objspace->heap.do_heap_free) {
- RVALUE *pp;
+ return 0;
+}
- 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->limit = final_num;
- freelist = free; /* cancel this page from freelist */
- unlink_heap_slot(objspace, sweep_slot);
+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;
+};
+
+static void
+allrefs_add(struct allrefs *data, VALUE obj)
+{
+ struct reflist *refs;
+
+ if (st_lookup(data->references, obj, (st_data_t *)&refs)) {
+ reflist_add(refs, data->root_obj);
}
else {
- objspace->heap.free_num += free_num;
+ refs = reflist_create(data->root_obj);
+ st_insert(data->references, obj, (st_data_t)refs);
}
- objspace->heap.final_num += final_num;
+}
- if (deferred_final_list) {
- rb_thread_t *th = GET_THREAD();
- if (th) {
- RUBY_VM_SET_FINALIZER_INTERRUPT(th);
- }
+static void
+allrefs_i(VALUE obj, void *ptr)
+{
+ struct allrefs *data = (struct allrefs *)ptr;
+ allrefs_add(data, 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);
+ allrefs_add(data, obj);
+ push_mark_stack(&data->objspace->mark_stack, obj);
+}
+
+static st_table *
+objspace_allrefs(rb_objspace_t *objspace)
+{
+ struct allrefs data;
+ struct mark_func_data_struct mfd;
+ VALUE obj;
+
+ rb_gc_disable();
+
+ data.objspace = objspace;
+ data.references = st_init_numtable();
+
+ mfd.mark_func = allrefs_roots_i;
+ mfd.data = &data;
+
+ /* traverse root objects */
+ objspace->mark_func_data = &mfd;
+ gc_mark_roots(objspace, TRUE, &data.category);
+ objspace->mark_func_data = 0;
+
+ /* traverse rest objects reachable from root objects */
+ while (pop_mark_stack(&objspace->mark_stack, &obj)) {
+ rb_objspace_reachable_objects_from(data.root_obj = obj, allrefs_i, &data);
}
+ shrink_stack_chunk_cache(&objspace->mark_stack);
+
+ rb_gc_enable();
+ return data.references;
}
static int
-ready_to_gc(rb_objspace_t *objspace)
+objspaec_allrefs_destruct_i(st_data_t key, st_data_t value, void *ptr)
{
- if (dont_gc || during_gc) {
- if (!freelist) {
- if (!heaps_increment(objspace)) {
- set_heaps_increment(objspace);
- heaps_increment(objspace);
- }
- }
- return FALSE;
- }
- return TRUE;
+ struct reflist *refs = (struct reflist *)value;
+ reflist_destruct(refs);
+ return ST_CONTINUE;
}
static void
-before_gc_sweep(rb_objspace_t *objspace)
+objspaec_allrefs_destruct(struct st_table *refs)
{
- freelist = 0;
- 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.do_heap_free = heaps_used * HEAP_OBJ_LIMIT;
- objspace->heap.free_min = initial_free_min;
+ st_foreach(refs, objspaec_allrefs_destruct_i, 0);
+ st_free_table(refs);
+}
+
+#if RGENGC_CHECK_MODE >= 3
+static int
+allrefs_dump_i(st_data_t k, st_data_t v, st_data_t ptr)
+{
+ VALUE obj = (VALUE)k;
+ struct reflist *refs = (struct reflist *)v;
+ fprintf(stderr, "[allrefs_dump_i] %p (%s%s%s%s) <- ",
+ (void *)obj, obj_type_name(obj),
+ RVALUE_OLD_P(obj) ? "[O]" : "[Y]",
+ RVALUE_SHADY(obj) ? "[S]" : "",
+ MARKED_IN_BITMAP(GET_HEAP_REMEMBERSET_BITS(obj), obj) ? "[R]" : "");
+ reflist_dump(refs);
+ fprintf(stderr, "\n");
+ return ST_CONTINUE;
+}
+
+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_before_marks_i(st_data_t k, st_data_t v, void *ptr)
+{
+ VALUE obj = k;
+ struct reflist *refs = (struct reflist *)v;
+ rb_objspace_t *objspace = (rb_objspace_t *)ptr;
+
+ /* check WB sanity */
+ if (!RVALUE_OLD_P(obj)) {
+ int i;
+ for (i=0; i<refs->pos; i++) {
+ VALUE parent = refs->list[i];
+ if (!IS_ROOTSIG(parent) && RVALUE_OLD_P(parent)) {
+ /* parent is old */
+ if (!MARKED_IN_BITMAP(GET_HEAP_PAGE(parent)->rememberset_bits, parent) &&
+ !MARKED_IN_BITMAP(GET_HEAP_PAGE(obj)->rememberset_bits, obj)) {
+ fprintf(stderr, "gc_marks_check_i: WB miss %p (%s) -> %p (%s)\n",
+ (void *)parent, obj_type_name(parent),
+ (void *)obj, obj_type_name(obj));
+ objspace->rgengc.error_count++;
+ }
+ }
+ }
}
- objspace->heap.sweep_slots = heaps;
- objspace->heap.free_num = 0;
+ return ST_CONTINUE;
+}
- /* sweep unlinked method entries */
- if (GET_VM()->unlinked_method_entry_list) {
- rb_sweep_method_entry(GET_VM());
+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: %p (%s) is not marked and not oldgen.\n", (void *)obj, obj_type_name(obj));
+ fprintf(stderr, "gc_check_after_marks_i: %p is referred from ", (void *)obj);
+ reflist_dump(refs);
+
+ 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
-after_gc_sweep(rb_objspace_t *objspace)
+gc_marks_check(rb_objspace_t *objspace, int (*checker_func)(ANYARGS), const char *checker_name)
{
- GC_PROF_SET_MALLOC_INFO;
+ objspace->rgengc.allrefs_table = objspace_allrefs(objspace);
- if (objspace->heap.free_num < objspace->heap.free_min) {
- set_heaps_increment(objspace);
- heaps_increment(objspace);
- }
+ st_foreach(objspace->rgengc.allrefs_table, checker_func, (st_data_t)objspace);
- if (malloc_increase > malloc_limit) {
- malloc_limit += (size_t)((malloc_increase - malloc_limit) * (double)objspace->heap.live_num / (heaps_used * HEAP_OBJ_LIMIT));
- if (malloc_limit < initial_malloc_limit) malloc_limit = initial_malloc_limit;
+ if (objspace->rgengc.error_count > 0) {
+#if RGENGC_CHECK_MODE >= 3
+ allrefs_dump(objspace);
+#endif
+ rb_bug("%s: GC has problem.", checker_name);
}
- malloc_increase = 0;
- free_unused_heaps(objspace);
+ objspaec_allrefs_destruct(objspace->rgengc.allrefs_table);
+ objspace->rgengc.allrefs_table = 0;
}
-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 (freelist) {
- during_gc = 0;
- return TRUE;
- }
+#endif /* RGENGC_CHECK_MODE >= 2 */
+
+static void
+gc_marks(rb_objspace_t *objspace, int full_mark)
+{
+ struct mark_func_data_struct *prev_mark_func_data;
+
+ gc_prof_mark_timer_start(objspace);
+ {
+ /* setup marking */
+ prev_mark_func_data = objspace->mark_func_data;
+ objspace->mark_func_data = 0;
+
+#if USE_RGENGC
+
+#if RGENGC_CHECK_MODE >= 2
+ gc_marks_check(objspace, gc_check_before_marks_i, "before_marks");
+#endif
+ if (full_mark == TRUE) { /* major/full GC */
+ objspace->rgengc.remembered_shady_object_count = 0;
+ objspace->rgengc.old_object_count = 0;
+#if RGENGC_THREEGEN
+ objspace->rgengc.young_object_count = 0;
+#endif
+
+ gc_marks_body(objspace, TRUE);
+
+ /* Do full GC if old/remembered_shady object counts is greater than counts two times at last full GC counts */
+ objspace->rgengc.remembered_shady_object_limit = objspace->rgengc.remembered_shady_object_count * 2;
+ objspace->rgengc.old_object_limit = objspace->rgengc.old_object_count * 2;
+ }
+ else { /* minor GC */
+ gc_marks_body(objspace, FALSE);
+ }
+
+#if RGENGC_PROFILE > 0
+ if (gc_prof_record(objspace)) {
+ gc_profile_record *record = gc_prof_record(objspace);
+ record->old_objects = objspace->rgengc.old_object_count;
+ }
+#endif
+
+#if RGENGC_CHECK_MODE >= 2
+ gc_marks_check(objspace, gc_check_after_marks_i, "after_marks");
+#endif
+
+#else /* USE_RGENGC */
+ gc_marks_body(objspace, TRUE);
+#endif
+
+ objspace->mark_func_data = prev_mark_func_data;
}
- return FALSE;
+ gc_prof_mark_timer_stop(objspace);
}
+/* RGENGC */
+
static void
-rest_sweep(rb_objspace_t *objspace)
+rgengc_report_body(int level, rb_objspace_t *objspace, const char *fmt, ...)
{
- if (objspace->heap.sweep_slots) {
- while (objspace->heap.sweep_slots) {
- lazy_sweep(objspace);
- }
- after_gc_sweep(objspace);
+ if (level <= RGENGC_DEBUG) {
+ char buf[1024];
+ FILE *out = stderr;
+ va_list args;
+ const char *status = " ";
+
+#if USE_RGENGC
+ if (during_gc) {
+ status = objspace->rgengc.during_minor_gc ? "-" : "+";
+ }
+#endif
+
+ va_start(args, fmt);
+ vsnprintf(buf, 1024, fmt, args);
+ va_end(args);
+
+ fprintf(out, "%s|", status);
+ fputs(buf, out);
}
}
-static void gc_marks(rb_objspace_t *objspace);
+#if USE_RGENGC
+
+/* bit operations */
static int
-gc_lazy_sweep(rb_objspace_t *objspace)
+rgengc_remembersetbits_get(rb_objspace_t *objspace, VALUE obj)
{
- int res;
- INIT_GC_PROF_PARAMS;
+ bits_t *bits = GET_HEAP_REMEMBERSET_BITS(obj);
+ return MARKED_IN_BITMAP(bits, obj) ? 1 : 0;
+}
- if (objspace->flags.dont_lazy_sweep)
- return garbage_collect(objspace);
+static int
+rgengc_remembersetbits_set(rb_objspace_t *objspace, VALUE obj)
+{
+ bits_t *bits = GET_HEAP_REMEMBERSET_BITS(obj);
+ if (MARKED_IN_BITMAP(bits, obj)) {
+ return FALSE;
+ }
+ else {
+ MARK_IN_BITMAP(bits, obj);
+ return TRUE;
+ }
+}
+/* wb, etc */
- if (!ready_to_gc(objspace)) return TRUE;
+/* return FALSE if already remembered */
+static int
+rgengc_remember(rb_objspace_t *objspace, VALUE obj)
+{
+ rgengc_report(2, objspace, "rgengc_remember: %p (%s, %s) %s\n", (void *)obj, obj_type_name(obj),
+ RVALUE_SHADY(obj) ? "shady" : "non-shady",
+ rgengc_remembersetbits_get(objspace, obj) ? "was already remembered" : "is remembered now");
- during_gc++;
- GC_PROF_TIMER_START;
- GC_PROF_SWEEP_TIMER_START;
-
- if (objspace->heap.sweep_slots) {
- res = lazy_sweep(objspace);
- if (res) {
- GC_PROF_SWEEP_TIMER_STOP;
- GC_PROF_SET_MALLOC_INFO;
- GC_PROF_TIMER_STOP(Qfalse);
- return res;
- }
- after_gc_sweep(objspace);
+#if RGENGC_CHECK_MODE > 0
+ {
+ switch (BUILTIN_TYPE(obj)) {
+ case T_NONE:
+ case T_ZOMBIE:
+ rb_bug("rgengc_remember: should not remember %p (%s)\n",
+ (void *)obj, obj_type_name(obj));
+ default:
+ ;
+ }
}
- else {
- if (heaps_increment(objspace)) {
- during_gc = 0;
- return TRUE;
- }
+#endif
+
+ if (RGENGC_PROFILE) {
+ if (!rgengc_remembered(objspace, obj)) {
+ if (!RVALUE_SHADY(obj)) {
+#if RGENGC_PROFILE > 0
+ objspace->profile.remembered_normal_object_count++;
+#if RGENGC_PROFILE >= 2
+ objspace->profile.remembered_normal_object_count_types[BUILTIN_TYPE(obj)]++;
+#endif
+#endif
+ }
+ else {
+#if RGENGC_PROFILE > 0
+ objspace->profile.remembered_shady_object_count++;
+#if RGENGC_PROFILE >= 2
+ objspace->profile.remembered_shady_object_count_types[BUILTIN_TYPE(obj)]++;
+#endif
+#endif
+ }
+ }
}
- gc_marks(objspace);
+ return rgengc_remembersetbits_set(objspace, obj);
+}
- before_gc_sweep(objspace);
- if (objspace->heap.free_min > (heaps_used * HEAP_OBJ_LIMIT - objspace->heap.live_num)) {
- set_heaps_increment(objspace);
- }
+static int
+rgengc_remembered(rb_objspace_t *objspace, VALUE obj)
+{
+ int result = rgengc_remembersetbits_get(objspace, obj);
+ check_gen_consistency(obj);
+ rgengc_report(6, objspace, "gc_remembered: %p (%s) => %d\n", (void *)obj, obj_type_name(obj), result);
+ return result;
+}
- GC_PROF_SWEEP_TIMER_START;
- if(!(res = lazy_sweep(objspace))) {
- after_gc_sweep(objspace);
- if(freelist) {
- res = TRUE;
- during_gc = 0;
- }
+static void
+rgengc_rememberset_mark(rb_objspace_t *objspace, rb_heap_t *heap)
+{
+ size_t j;
+ RVALUE *p, *offset;
+ bits_t *bits, bitset;
+ struct heap_page *page = heap->pages;
+
+#if RGENGC_PROFILE > 0
+ size_t shady_object_count = 0, clear_count = 0;
+#endif
+
+ while (page) {
+ p = page->start;
+ bits = page->rememberset_bits;
+ offset = p - NUM_IN_PAGE(p);
+
+ for (j=0; j < HEAP_BITMAP_LIMIT; j++) {
+ if (bits[j]) {
+ p = offset + j * BITS_BITLENGTH;
+ bitset = bits[j];
+ do {
+ if (bitset & 1) {
+ /* mark before RVALUE_PROMOTE_... */
+ gc_mark_ptr(objspace, (VALUE)p);
+
+ if (!RVALUE_SHADY(p)) {
+ rgengc_report(2, objspace, "rgengc_rememberset_mark: clear %p (%s)\n", p, obj_type_name((VALUE)p));
+#if RGENGC_THREEGEN
+ if (RVALUE_INFANT_P((VALUE)p)) RVALUE_PROMOTE_INFANT((VALUE)p);
+ if (RVALUE_YOUNG_P((VALUE)p)) RVALUE_PROMOTE_YOUNG((VALUE)p);
+#endif
+ CLEAR_IN_BITMAP(bits, p);
+#if RGENGC_PROFILE > 0
+ clear_count++;
+#endif
+ }
+ else {
+#if RGENGC_PROFILE > 0
+ shady_object_count++;
+#endif
+ }
+
+ rgengc_report(2, objspace, "rgengc_rememberset_mark: mark %p (%s)\n", p, obj_type_name((VALUE)p));
+ gc_mark_children(objspace, (VALUE) p);
+ }
+ p++;
+ bitset >>= 1;
+ } while (bitset);
+ }
+ }
+ page = page->next;
}
- GC_PROF_SWEEP_TIMER_STOP;
- GC_PROF_TIMER_STOP(Qtrue);
- return res;
+ rgengc_report(2, objspace, "rgengc_rememberset_mark: finished\n");
+
+#if RGENGC_PROFILE > 0
+ rgengc_report(2, objspace, "rgengc_rememberset_mark: clear_count: %"PRIdSIZE", shady_object_count: %"PRIdSIZE"\n", clear_count, shady_object_count);
+ if (gc_prof_record(objspace)) {
+ gc_profile_record *record = gc_prof_record(objspace);
+ record->remembered_normal_objects = clear_count;
+ record->remembered_shady_objects = shady_object_count;
+ }
+#endif
}
static void
-gc_sweep(rb_objspace_t *objspace)
+rgengc_mark_and_rememberset_clear(rb_objspace_t *objspace, rb_heap_t *heap)
{
- struct heaps_slot *next;
+ struct heap_page *page = heap->pages;
- before_gc_sweep(objspace);
+ while (page) {
+ memset(&page->mark_bits[0], 0, HEAP_BITMAP_SIZE);
+ memset(&page->rememberset_bits[0], 0, HEAP_BITMAP_SIZE);
+ page = page->next;
+ }
+}
- while (objspace->heap.sweep_slots) {
- next = objspace->heap.sweep_slots->next;
- slot_sweep(objspace, objspace->heap.sweep_slots);
- objspace->heap.sweep_slots = next;
+/* RGENGC: APIs */
+
+void
+rb_gc_writebarrier(VALUE a, VALUE b)
+{
+ if (RGENGC_CHECK_MODE) {
+ if (!RVALUE_PROMOTED_P(a)) rb_bug("rb_gc_writebarrier: referer object %p (%s) is not promoted.\n", (void *)a, obj_type_name(a));
}
- after_gc_sweep(objspace);
+ if (!RVALUE_OLD_P(b) && RVALUE_OLD_BITMAP_P(a)) {
+ rb_objspace_t *objspace = &rb_objspace;
- during_gc = 0;
+ if (!rgengc_remembered(objspace, a)) {
+ int type = BUILTIN_TYPE(a);
+ /* TODO: 2 << 16 is just a magic number. */
+ if ((type == T_ARRAY && RARRAY_LEN(a) >= 2 << 16) ||
+ (type == T_HASH && RHASH_SIZE(a) >= 2 << 16)) {
+ if (!rgengc_remembered(objspace, b)) {
+ rgengc_report(2, objspace, "rb_gc_wb: %p (%s) -> %p (%s)\n", (void *)a, obj_type_name(a), (void *)b, obj_type_name(b));
+ rgengc_remember(objspace, b);
+ }
+ }
+ else {
+ rgengc_report(2, objspace, "rb_gc_wb: %p (%s) -> %p (%s)\n",
+ (void *)a, obj_type_name(a), (void *)b, obj_type_name(b));
+ rgengc_remember(objspace, a);
+ }
+ }
+ }
}
void
-rb_gc_force_recycle(VALUE p)
+rb_gc_writebarrier_unprotect_promoted(VALUE obj)
{
rb_objspace_t *objspace = &rb_objspace;
- GC_PROF_DEC_LIVE_NUM;
- if (RBASIC(p)->flags & FL_MARK) {
- RANY(p)->as.free.flags = 0;
+
+ if (RGENGC_CHECK_MODE) {
+ if (!RVALUE_PROMOTED_P(obj)) rb_bug("rb_gc_writebarrier_unprotect_promoted: called on non-promoted object");
+ if (RVALUE_SHADY(obj)) rb_bug("rb_gc_writebarrier_unprotect_promoted: called on shady object");
}
+
+ rgengc_report(0, objspace, "rb_gc_writebarrier_unprotect_promoted: %p (%s)%s\n", (void *)obj, obj_type_name(obj),
+ rgengc_remembered(objspace, obj) ? " (already remembered)" : "");
+
+ if (RVALUE_OLD_P(obj)) {
+ RVALUE_DEMOTE_FROM_OLD(obj);
+
+ rgengc_remember(objspace, obj);
+ objspace->rgengc.remembered_shady_object_count++;
+
+#if RGENGC_PROFILE
+ objspace->profile.shade_operation_count++;
+#if RGENGC_PROFILE >= 2
+ objspace->profile.shade_operation_count_types[BUILTIN_TYPE(obj)]++;
+#endif /* RGENGC_PROFILE >= 2 */
+#endif /* RGENGC_PROFILE */
+ }
+#if RGENGC_THREEGEN
else {
- add_freelist(objspace, (RVALUE *)p);
+ RVALUE_DEMOTE_FROM_YOUNG(obj);
}
+#endif
}
-static inline void
-make_deferred(RVALUE *p)
+void
+rb_gc_writebarrier_remember_promoted(VALUE obj)
{
- p->as.basic.flags = (p->as.basic.flags & ~T_MASK) | T_ZOMBIE;
+ rb_objspace_t *objspace = &rb_objspace;
+ rgengc_remember(objspace, obj);
}
-static inline void
-make_io_deferred(RVALUE *p)
+static st_table *rgengc_unprotect_logging_table;
+
+static int
+rgengc_unprotect_logging_exit_func_i(st_data_t key, st_data_t val)
{
- 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;
+ fprintf(stderr, "%s\t%d\n", (char *)key, (int)val);
+ return ST_CONTINUE;
}
-static int
-obj_free(rb_objspace_t *objspace, VALUE obj)
+static void
+rgengc_unprotect_logging_exit_func(void)
{
- switch (BUILTIN_TYPE(obj)) {
- case T_NIL:
- case T_FIXNUM:
- case T_TRUE:
- case T_FALSE:
- rb_bug("obj_free() called for broken object");
- break;
- }
+ st_foreach(rgengc_unprotect_logging_table, rgengc_unprotect_logging_exit_func_i, 0);
+}
- if (FL_TEST(obj, FL_EXIVAR)) {
- rb_free_generic_ivar((VALUE)obj);
- FL_UNSET(obj, FL_EXIVAR);
+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);
}
- switch (BUILTIN_TYPE(obj)) {
- case T_OBJECT:
- if (!(RANY(obj)->as.basic.flags & ROBJECT_EMBED) &&
- RANY(obj)->as.object.as.heap.ivptr) {
- xfree(RANY(obj)->as.object.as.heap.ivptr);
- }
- break;
- case T_MODULE:
- case T_CLASS:
- rb_clear_cache_by_class((VALUE)obj);
- rb_free_m_table(RCLASS_M_TBL(obj));
- if (RCLASS_IV_TBL(obj)) {
- st_free_table(RCLASS_IV_TBL(obj));
- }
- if (RCLASS_CONST_TBL(obj)) {
- rb_free_const_table(RCLASS_CONST_TBL(obj));
- }
- if (RCLASS_IV_INDEX_TBL(obj)) {
- st_free_table(RCLASS_IV_INDEX_TBL(obj));
- }
- xfree(RANY(obj)->as.klass.ptr);
- break;
- case T_STRING:
- rb_str_free(obj);
- break;
- case T_ARRAY:
- rb_ary_free(obj);
- break;
- case T_HASH:
- if (RANY(obj)->as.hash.ntbl) {
- st_free_table(RANY(obj)->as.hash.ntbl);
- }
- break;
- case T_REGEXP:
- if (RANY(obj)->as.regexp.ptr) {
- onig_free(RANY(obj)->as.regexp.ptr);
- }
- break;
- case T_DATA:
- if (DATA_PTR(obj)) {
- if (RTYPEDDATA_P(obj)) {
- RDATA(obj)->dfree = RANY(obj)->as.typeddata.type->function.dfree;
- }
- if (RANY(obj)->as.data.dfree == (RUBY_DATA_FUNC)-1) {
- xfree(DATA_PTR(obj));
- }
- else if (RANY(obj)->as.data.dfree) {
- make_deferred(RANY(obj));
- return 1;
- }
- }
- break;
- case T_MATCH:
- if (RANY(obj)->as.match.rmatch) {
- struct rmatch *rm = RANY(obj)->as.match.rmatch;
- onig_region_free(&rm->regs, 0);
- if (rm->char_offset)
- xfree(rm->char_offset);
- xfree(rm);
- }
- break;
- case T_FILE:
- if (RANY(obj)->as.file.fptr) {
- make_io_deferred(RANY(obj));
- return 1;
- }
- break;
- case T_RATIONAL:
- case T_COMPLEX:
- break;
- case T_ICLASS:
- /* iClass shares table with the module */
- xfree(RANY(obj)->as.klass.ptr);
- break;
+ if (OBJ_WB_PROTECTED(obj)) {
+ char buff[0x100];
+ st_data_t cnt = 1;
+ char *ptr = buff;
- case T_FLOAT:
- break;
+ snprintf(ptr, 0x100 - 1, "%s|%s:%d", obj_type_name(obj), filename, line);
- case T_BIGNUM:
- if (!(RBASIC(obj)->flags & RBIGNUM_EMBED_FLAG) && RBIGNUM_DIGITS(obj)) {
- xfree(RBIGNUM_DIGITS(obj));
+ if (st_lookup(rgengc_unprotect_logging_table, (st_data_t)ptr, &cnt)) {
+ cnt++;
}
- 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_ALLOCA:
- xfree(RANY(obj)->as.node.u1.node);
- break;
+ else {
+ ptr = (char *)malloc(strlen(buff) + 1);
+ strcpy(ptr, buff);
}
- break; /* no need to free iv_tbl */
+ st_insert(rgengc_unprotect_logging_table, (st_data_t)ptr, cnt);
+ }
+}
- 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);
- }
- break;
+#endif /* USE_RGENGC */
- default:
- rb_bug("gc_sweep(): unknown data type 0x%x(%p)",
- BUILTIN_TYPE(obj), (void*)obj);
- }
+/* RGENGC analysis information */
- return 0;
+VALUE
+rb_obj_rgengc_writebarrier_protected_p(VALUE obj)
+{
+ return OBJ_WB_PROTECTED(obj) ? Qtrue : Qfalse;
}
-#define GC_NOTIFY 0
-
-#if STACK_GROW_DIRECTION < 0
-#define GET_STACK_BOUNDS(start, end, appendix) ((start) = STACK_END, (end) = STACK_START)
-#elif STACK_GROW_DIRECTION > 0
-#define GET_STACK_BOUNDS(start, end, appendix) ((start) = STACK_START, (end) = STACK_END+(appendix))
-#else
-#define GET_STACK_BOUNDS(start, end, appendix) \
- ((STACK_END < STACK_START) ? \
- ((start) = STACK_END, (end) = STACK_START) : ((start) = STACK_START, (end) = STACK_END+(appendix)))
-#endif
+VALUE
+rb_obj_rgengc_promoted_p(VALUE obj)
+{
+ return OBJ_PROMOTED(obj) ? Qtrue : Qfalse;
+}
-#define numberof(array) (int)(sizeof(array) / sizeof((array)[0]))
+/* GC */
-static void
-mark_current_machine_context(rb_objspace_t *objspace, rb_thread_t *th)
+void
+rb_gc_force_recycle(VALUE p)
{
- union {
- rb_jmp_buf j;
- VALUE v[sizeof(rb_jmp_buf) / sizeof(VALUE)];
- } save_regs_gc_mark;
- VALUE *stack_start, *stack_end;
+ rb_objspace_t *objspace = &rb_objspace;
- FLUSH_REGISTER_WINDOWS;
- /* This assumes that all registers are saved into the jmp_buf (and stack) */
- rb_setjmp(save_regs_gc_mark.j);
+#if USE_RGENGC
+ CLEAR_IN_BITMAP(GET_HEAP_REMEMBERSET_BITS(p), p);
+ CLEAR_IN_BITMAP(GET_HEAP_OLDGEN_BITS(p), p);
+ if (!GET_HEAP_PAGE(p)->before_sweep) {
+ CLEAR_IN_BITMAP(GET_HEAP_MARK_BITS(p), p);
+ }
+#endif
- SET_STACK_END;
- GET_STACK_BOUNDS(stack_start, stack_end, 1);
+ objspace->profile.total_freed_object_num++;
+ heap_page_add_freeobj(objspace, GET_HEAP_PAGE(p), p);
- mark_locations_array(objspace, save_regs_gc_mark.v, numberof(save_regs_gc_mark.v));
+ /* Disable counting swept_num because there are no meaning.
+ * if (!MARKED_IN_BITMAP(GET_HEAP_MARK_BITS(p), p)) {
+ * objspace->heap.swept_num++;
+ * }
+ */
+}
- rb_gc_mark_locations(stack_start, stack_end);
-#ifdef __ia64
- rb_gc_mark_locations(th->machine_register_stack_start, th->machine_register_stack_end);
-#endif
-#if defined(__mc68000__)
- mark_locations_array(objspace, (VALUE*)((char*)STACK_END + 2),
- (STACK_START - STACK_END));
-#endif
+void
+rb_gc_register_mark_object(VALUE obj)
+{
+ VALUE ary = GET_THREAD()->vm->mark_object_ary;
+ rb_ary_push(ary, obj);
}
-static void
-gc_marks(rb_objspace_t *objspace)
+void
+rb_gc_register_address(VALUE *addr)
{
- struct gc_list *list;
- rb_thread_t *th = GET_THREAD();
- GC_PROF_MARK_TIMER_START;
+ rb_objspace_t *objspace = &rb_objspace;
+ struct gc_list *tmp;
- objspace->heap.live_num = 0;
- objspace->count++;
+ tmp = ALLOC(struct gc_list);
+ tmp->next = global_List;
+ tmp->varptr = addr;
+ global_List = tmp;
+}
+void
+rb_gc_unregister_address(VALUE *addr)
+{
+ rb_objspace_t *objspace = &rb_objspace;
+ struct gc_list *tmp = global_List;
- SET_STACK_END;
+ if (tmp->varptr == addr) {
+ global_List = tmp->next;
+ xfree(tmp);
+ return;
+ }
+ while (tmp->next) {
+ if (tmp->next->varptr == addr) {
+ struct gc_list *t = tmp->next;
- th->vm->self ? rb_gc_mark(th->vm->self) : rb_vm_mark(th->vm);
+ tmp->next = tmp->next->next;
+ xfree(t);
+ break;
+ }
+ tmp = tmp->next;
+ }
+}
- mark_tbl(objspace, finalizer_table);
- mark_current_machine_context(objspace, th);
+void
+rb_global_variable(VALUE *var)
+{
+ rb_gc_register_address(var);
+}
- rb_gc_mark_symbols();
- rb_gc_mark_encodings();
+#define GC_NOTIFY 0
- /* mark protected global variables */
- for (list = global_List; list; list = list->next) {
- rb_gc_mark_maybe(*list->varptr);
+static int
+garbage_collect_body(rb_objspace_t *objspace, int full_mark, int immediate_sweep, int reason)
+{
+ if (ruby_gc_stress && !ruby_disable_gc_stress) {
+ int flag = FIXNUM_P(ruby_gc_stress) ? FIX2INT(ruby_gc_stress) : 0;
+
+ if (flag & 0x01)
+ reason &= ~GPR_FLAG_MAJOR_MASK;
+ else
+ reason |= GPR_FLAG_MAJOR_BY_STRESS;
+ immediate_sweep = !(flag & 0x02);
}
- rb_mark_end_proc();
- rb_gc_mark_global_tbl();
- mark_tbl(objspace, rb_class_tbl);
+#if USE_RGENGC
+ else {
+ if (full_mark) {
+ reason |= GPR_FLAG_MAJOR_BY_NOFREE;
+ }
+ if (objspace->rgengc.need_major_gc) {
+ objspace->rgengc.need_major_gc = FALSE;
+ reason |= GPR_FLAG_MAJOR_BY_RESCAN;
+ }
+ if (objspace->rgengc.remembered_shady_object_count > objspace->rgengc.remembered_shady_object_limit) {
+ reason |= GPR_FLAG_MAJOR_BY_SHADY;
+ }
+ if (objspace->rgengc.old_object_count > objspace->rgengc.old_object_limit) {
+ reason |= GPR_FLAG_MAJOR_BY_OLDGEN;
+ }
- /* mark generic instance variables for special constants */
- rb_mark_generic_ivar_tbl();
+ if (!GC_ENABLE_LAZY_SWEEP || objspace->flags.dont_lazy_sweep) {
+ immediate_sweep = TRUE;
+ }
+ }
+#endif
- rb_gc_mark_parser();
+ if (immediate_sweep) reason |= GPR_FLAG_IMMEDIATE_SWEEP;
+ full_mark = (reason & GPR_FLAG_MAJOR_MASK) ? TRUE : FALSE;
- rb_gc_mark_unlinked_live_method_entries(th->vm);
+ if (GC_NOTIFY) fprintf(stderr, "start garbage_collect(%d, %d, %d)\n", full_mark, immediate_sweep, reason);
- /* marking-loop */
- gc_mark_stacked_objects(objspace);
+ objspace->profile.count++;
+ gc_event_hook(objspace, RUBY_INTERNAL_EVENT_GC_START, 0 /* TODO: pass minor/immediate flag? */);
- GC_PROF_MARK_TIMER_STOP;
+ objspace->profile.total_allocated_object_num_at_gc_start = objspace->profile.total_allocated_object_num;
+ objspace->profile.heap_used_at_gc_start = heap_pages_used;
+
+ gc_prof_setup_new_record(objspace, reason);
+ gc_prof_timer_start(objspace);
+ {
+ assert(during_gc > 0);
+ gc_marks(objspace, full_mark);
+ gc_sweep(objspace, immediate_sweep);
+ during_gc = 0;
+ }
+ gc_prof_timer_stop(objspace);
+
+ if (GC_NOTIFY) fprintf(stderr, "end garbage_collect()\n");
+ return TRUE;
}
static int
-garbage_collect(rb_objspace_t *objspace)
+heap_ready_to_gc(rb_objspace_t *objspace, rb_heap_t *heap)
{
- INIT_GC_PROF_PARAMS;
+ if (dont_gc || during_gc) {
+ if (!heap->freelist && !heap->free_pages) {
+ if (!heap_increment(objspace, heap)) {
+ heap_set_increment(objspace, 0);
+ heap_increment(objspace, heap);
+ }
+ }
+ return FALSE;
+ }
+ return TRUE;
+}
- if (GC_NOTIFY) printf("start garbage_collect()\n");
+static int
+ready_to_gc(rb_objspace_t *objspace)
+{
+ return heap_ready_to_gc(objspace, heap_eden);
+}
- if (!heaps) {
+static int
+garbage_collect(rb_objspace_t *objspace, int full_mark, int immediate_sweep, int reason)
+{
+ if (!heap_pages_used) {
+ during_gc = 0;
return FALSE;
}
if (!ready_to_gc(objspace)) {
- return TRUE;
+ during_gc = 0;
+ return TRUE;
}
- GC_PROF_TIMER_START;
-
- rest_sweep(objspace);
+#if GC_PROFILE_MORE_DETAIL
+ objspace->profile.prepare_time = getrusage_time();
+#endif
+ gc_rest_sweep(objspace);
+#if GC_PROFILE_MORE_DETAIL
+ objspace->profile.prepare_time = getrusage_time() - objspace->profile.prepare_time;
+#endif
during_gc++;
- gc_marks(objspace);
- GC_PROF_SWEEP_TIMER_START;
- gc_sweep(objspace);
- GC_PROF_SWEEP_TIMER_STOP;
+ return garbage_collect_body(objspace, full_mark, immediate_sweep, reason);
+}
+
+struct objspace_and_reason {
+ rb_objspace_t *objspace;
+ int reason;
+ int full_mark;
+ int immediate_sweep;
+};
- GC_PROF_TIMER_STOP(Qtrue);
- if (GC_NOTIFY) printf("end garbage_collect()\n");
- return TRUE;
+static void *
+gc_with_gvl(void *ptr)
+{
+ struct objspace_and_reason *oar = (struct objspace_and_reason *)ptr;
+ return (void *)(VALUE)garbage_collect(oar->objspace, oar->full_mark, oar->immediate_sweep, oar->reason);
+}
+
+static int
+garbage_collect_with_gvl(rb_objspace_t *objspace, int full_mark, int immediate_sweep, int reason)
+{
+ if (dont_gc) return TRUE;
+ if (ruby_thread_has_gvl_p()) {
+ return garbage_collect(objspace, full_mark, immediate_sweep, reason);
+ }
+ else {
+ if (ruby_native_thread_p()) {
+ struct objspace_and_reason oar;
+ oar.objspace = objspace;
+ oar.reason = reason;
+ oar.full_mark = full_mark;
+ oar.immediate_sweep = immediate_sweep;
+ return (int)(VALUE)rb_thread_call_with_gvl(gc_with_gvl, (void *)&oar);
+ }
+ else {
+ /* no ruby thread */
+ fprintf(stderr, "[FATAL] failed to allocate memory\n");
+ exit(EXIT_FAILURE);
+ }
+ }
}
int
rb_garbage_collect(void)
{
- return garbage_collect(&rb_objspace);
+ return garbage_collect(&rb_objspace, TRUE, TRUE, GPR_FLAG_CAPI);
}
+#undef Init_stack
+
void
-rb_gc_mark_machine_stack(rb_thread_t *th)
+Init_stack(volatile VALUE *addr)
{
- rb_objspace_t *objspace = &rb_objspace;
- VALUE *stack_start, *stack_end;
-
- GET_STACK_BOUNDS(stack_start, stack_end, 0);
- rb_gc_mark_locations(stack_start, stack_end);
-#ifdef __ia64
- rb_gc_mark_locations(th->machine_register_stack_start, th->machine_register_stack_end);
-#endif
+ ruby_init_stack(addr);
}
-
/*
* call-seq:
* GC.start -> nil
@@ -2647,851 +4963,1479 @@ rb_gc_start(void)
return Qnil;
}
-#undef Init_stack
-
void
-Init_stack(volatile VALUE *addr)
+rb_gc(void)
{
- ruby_init_stack(addr);
+ rb_objspace_t *objspace = &rb_objspace;
+ garbage_collect(objspace, TRUE, TRUE, GPR_FLAG_METHOD);
+ if (!finalizing) finalize_deferred(objspace);
+ heap_pages_free_unused_pages(objspace);
+}
+
+int
+rb_during_gc(void)
+{
+ rb_objspace_t *objspace = &rb_objspace;
+ return during_gc;
+}
+
+#if RGENGC_PROFILE >= 2
+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;
}
/*
- * Document-class: ObjectSpace
- *
- * The <code>ObjectSpace</code> module contains a number of routines
- * that interact with the garbage collection facility and allow you to
- * traverse all living objects with an iterator.
+ * call-seq:
+ * GC.count -> Integer
*
- * <code>ObjectSpace</code> also provides support for object
- * finalizers, procs that will be called when a specific object is
- * about to be destroyed by garbage collection.
+ * The number of times GC occurred.
*
- * include ObjectSpace
+ * It returns the number of times GC occurred since the process started.
*
+ */
+
+static VALUE
+gc_count(VALUE self)
+{
+ return SIZET2NUM(rb_gc_count());
+}
+
+/*
+ * call-seq:
+ * GC.stat -> Hash
*
- * a = "A"
- * b = "B"
- * c = "C"
+ * Returns a Hash containing information about the GC.
*
+ * The hash includes information about internal statistics about GC such as:
*
- * 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}" })
+ * {
+ * :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
+ * }
*
- * <em>produces:</em>
+ * The contents of the hash are implementation specific and may be changed in
+ * the future.
*
- * Finalizer three on 537763470
- * Finalizer one on 537763480
- * Finalizer two on 537763480
+ * This method is only expected to work on C Ruby.
*
*/
-void
-Init_heap(void)
-{
- init_heap(&rb_objspace);
-}
-
static VALUE
-lazy_sweep_enable(void)
+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 USE_RGENGC
+ static VALUE sym_minor_gc_count, sym_major_gc_count;
+#if RGENGC_PROFILE
+ static VALUE sym_generated_normal_object_count, sym_generated_shady_object_count;
+ static VALUE sym_shade_operation_count, sym_promote_infant_count, sym_promote_young_count;
+ static VALUE sym_remembered_normal_object_count, sym_remembered_shady_object_count;
+#endif /* RGENGC_PROFILE */
+#endif /* USE_RGENGC */
+
+ if (sym_count == 0) {
+#define S(s) sym_##s = ID2SYM(rb_intern_const(#s))
+ S(count);
+ S(heap_used);
+ S(heap_length);
+ S(heap_increment);
+ S(heap_live_num);
+ S(heap_free_num);
+ S(heap_final_num);
+ S(total_allocated_object);
+ S(total_freed_object);
+#if USE_RGENGC
+ S(minor_gc_count);
+ S(major_gc_count);
+#if RGENGC_PROFILE
+ S(generated_normal_object_count);
+ S(generated_shady_object_count);
+ S(shade_operation_count);
+ S(promote_infant_count);
+ S(promote_young_count);
+ S(remembered_normal_object_count);
+ S(remembered_shady_object_count);
+#endif /* USE_RGENGC */
+#endif /* RGENGC_PROFILE */
+#undef S
+ }
- objspace->flags.dont_lazy_sweep = FALSE;
- return Qnil;
-}
+ if (rb_scan_args(argc, argv, "01", &hash) == 1) {
+ if (!RB_TYPE_P(hash, T_HASH)) {
+ rb_raise(rb_eTypeError, "non-hash given");
+ }
+ }
-typedef int each_obj_callback(void *, void *, size_t, void *);
+ if (hash == Qnil) {
+ hash = rb_hash_new();
+ }
-struct each_obj_args {
- each_obj_callback *callback;
- void *data;
-};
+ rb_hash_aset(hash, sym_count, SIZET2NUM(objspace->profile.count));
+ /* implementation dependent counters */
+ rb_hash_aset(hash, sym_heap_used, SIZET2NUM(heap_pages_used));
+ rb_hash_aset(hash, sym_heap_final_num, SIZET2NUM(heap_pages_final_num));
+
+ rb_hash_aset(hash, sym_heap_length, SIZET2NUM(heap_pages_length));
+ rb_hash_aset(hash, sym_heap_increment, SIZET2NUM(heap_pages_increment));
+
+ rb_hash_aset(hash, sym_heap_live_num, SIZET2NUM(objspace_live_num(objspace)));
+ rb_hash_aset(hash, sym_heap_free_num, SIZET2NUM(objspace_free_num(objspace)));
+
+ rb_hash_aset(hash, sym_total_allocated_object, SIZET2NUM(objspace->profile.total_allocated_object_num));
+ rb_hash_aset(hash, sym_total_freed_object, SIZET2NUM(objspace->profile.total_freed_object_num));
+#if USE_RGENGC
+ rb_hash_aset(hash, sym_minor_gc_count, SIZET2NUM(objspace->profile.minor_gc_count));
+ rb_hash_aset(hash, sym_major_gc_count, SIZET2NUM(objspace->profile.major_gc_count));
+#if RGENGC_PROFILE
+ rb_hash_aset(hash, sym_generated_normal_object_count, SIZET2NUM(objspace->profile.generated_normal_object_count));
+ rb_hash_aset(hash, sym_generated_shady_object_count, SIZET2NUM(objspace->profile.generated_shady_object_count));
+ rb_hash_aset(hash, sym_shade_operation_count, SIZET2NUM(objspace->profile.shade_operation_count));
+ rb_hash_aset(hash, sym_promote_infant_count, SIZET2NUM(objspace->profile.promote_infant_count));
+#if RGENGC_THREEGEN
+ rb_hash_aset(hash, sym_promote_young_count, SIZET2NUM(objspace->profile.promote_young_count));
+#endif
+ rb_hash_aset(hash, sym_remembered_normal_object_count, SIZET2NUM(objspace->profile.remembered_normal_object_count));
+ rb_hash_aset(hash, sym_remembered_shady_object_count, SIZET2NUM(objspace->profile.remembered_shady_object_count));
+#if RGENGC_PROFILE >= 2
+ {
+ gc_count_add_each_types(hash, "generated_normal_object_count_types", objspace->profile.generated_normal_object_count_types);
+ gc_count_add_each_types(hash, "generated_shady_object_count_types", objspace->profile.generated_shady_object_count_types);
+ gc_count_add_each_types(hash, "shade_operation_count_types", objspace->profile.shade_operation_count_types);
+ gc_count_add_each_types(hash, "promote_infant_types", objspace->profile.promote_infant_types);
+#if RGENGC_THREEGEN
+ gc_count_add_each_types(hash, "promote_young_types", objspace->profile.promote_young_types);
+#endif
+ gc_count_add_each_types(hash, "remembered_normal_object_count_types", objspace->profile.remembered_normal_object_count_types);
+ gc_count_add_each_types(hash, "remembered_shady_object_count_types", objspace->profile.remembered_shady_object_count_types);
+ }
+#endif
+#endif /* RGENGC_PROFILE */
+#endif /* USE_RGENGC */
+
+ return hash;
+}
+
+/*
+ * call-seq:
+ * GC.stress -> fixnum, true or false
+ *
+ * Returns current status of GC stress mode.
+ */
static VALUE
-objspace_each_objects(VALUE arg)
+gc_stress_get(VALUE self)
{
- size_t i;
- RVALUE *membase = 0;
- RVALUE *pstart, *pend;
rb_objspace_t *objspace = &rb_objspace;
- struct each_obj_args *args = (struct each_obj_args *)arg;
- volatile VALUE v;
+ return ruby_gc_stress;
+}
- i = 0;
- while (i < heaps_used) {
- while (0 < i && (uintptr_t)membase < (uintptr_t)objspace->heap.sorted[i-1].slot->membase)
- i--;
- while (i < heaps_used && (uintptr_t)objspace->heap.sorted[i].slot->membase <= (uintptr_t)membase)
- i++;
- if (heaps_used <= i)
- break;
- membase = objspace->heap.sorted[i].slot->membase;
-
- pstart = objspace->heap.sorted[i].slot->slot;
- pend = pstart + objspace->heap.sorted[i].slot->limit;
-
- 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;
- }
- }
- }
+/*
+ * call-seq:
+ * GC.stress = bool -> bool
+ *
+ * Updates the GC stress mode.
+ *
+ * When stress mode is enabled, the GC is invoked at every GC opportunity:
+ * all memory and object allocations.
+ *
+ * Enabling stress mode will degrade performance, it is only for debugging.
+ */
- return Qnil;
+static VALUE
+gc_stress_set(VALUE self, VALUE flag)
+{
+ rb_objspace_t *objspace = &rb_objspace;
+ rb_secure(2);
+ ruby_gc_stress = FIXNUM_P(flag) ? flag : (RTEST(flag) ? Qtrue : Qfalse);
+ return flag;
}
/*
- * 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.
+ * call-seq:
+ * GC.enable -> true or false
*
- * 'callback' will be called several times (the number of heap slot,
- * 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.
- * stride: a distance to next VALUE.
+ * Enables garbage collection, returning +true+ if garbage
+ * collection was previously disabled.
*
- * If callback() returns non-zero, the iteration will be stopped.
+ * GC.disable #=> false
+ * GC.enable #=> true
+ * GC.enable #=> false
*
- * This is a sample callback code to iterate liveness objects:
+ */
+
+VALUE
+rb_gc_enable(void)
+{
+ rb_objspace_t *objspace = &rb_objspace;
+ int old = dont_gc;
+
+ dont_gc = FALSE;
+ return old ? Qtrue : Qfalse;
+}
+
+/*
+ * call-seq:
+ * GC.disable -> true or false
*
- * int
- * sample_callback(void *vstart, void *vend, int stride, void *data) {
- * VALUE v = (VALUE)vstart;
- * for (; v != (VALUE)vend; v += stride) {
- * if (RBASIC(v)->flags) { // liveness check
- * // do something with live object 'v'
- * }
- * return 0; // continue to iteration
- * }
+ * Disables garbage collection, returning +true+ if garbage
+ * collection was already disabled.
*
- * Note: 'vstart' is not a top of heap_slot. 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.
+ * GC.disable #=> false
+ * GC.disable #=> true
*
- * Note: On this implementation, 'stride' is same as sizeof(RVALUE).
- * However, there are possibilities to pass variable values with
- * 'stride' with some reasons. You must use stride instead of
- * use some constant value in the iteration.
*/
-void
-rb_objspace_each_objects(each_obj_callback *callback, void *data)
+
+VALUE
+rb_gc_disable(void)
{
- struct each_obj_args args;
rb_objspace_t *objspace = &rb_objspace;
+ int old = dont_gc;
- rest_sweep(objspace);
- objspace->flags.dont_lazy_sweep = TRUE;
+ gc_rest_sweep(objspace);
- args.callback = callback;
- args.data = data;
- rb_ensure(objspace_each_objects, (VALUE)&args, lazy_sweep_enable, Qnil);
+ dont_gc = TRUE;
+ return old ? Qtrue : Qfalse;
}
-struct os_each_struct {
- size_t num;
- VALUE of;
-};
-
static int
-os_obj_of_i(void *vstart, void *vend, size_t stride, void *data)
+get_envparam_int(const char *name, unsigned int *default_value, int lower_bound)
{
- struct os_each_struct *oes = (struct os_each_struct *)data;
- RVALUE *p = (RVALUE *)vstart, *pend = (RVALUE *)vend;
- volatile VALUE v;
+ char *ptr = getenv(name);
+ int val;
- for (; p != pend; p++) {
- if (p->as.basic.flags) {
- switch (BUILTIN_TYPE(p)) {
- case T_NONE:
- case T_ICLASS:
- case T_NODE:
- case T_ZOMBIE:
- continue;
- case T_CLASS:
- if (FL_TEST(p, FL_SINGLETON))
- continue;
- default:
- if (!p->as.basic.klass) continue;
- v = (VALUE)p;
- if (!oes->of || rb_obj_is_kind_of(v, oes->of)) {
- rb_yield(v);
- oes->num++;
- }
- }
+ if (ptr != NULL) {
+ val = atoi(ptr);
+ if (val > lower_bound) {
+ if (RTEST(ruby_verbose)) fprintf(stderr, "%s=%d (%d)\n", name, val, *default_value);
+ *default_value = val;
+ return 1;
+ }
+ else {
+ if (RTEST(ruby_verbose)) fprintf(stderr, "%s=%d (%d), but ignored because lower than %d\n", name, val, *default_value, lower_bound);
}
}
+ return 0;
+}
+static int
+get_envparam_double(const char *name, double *default_value, double lower_bound)
+{
+ char *ptr = getenv(name);
+ double val;
+
+ if (ptr != NULL) {
+ val = strtod(ptr, NULL);
+ if (val > lower_bound) {
+ if (RTEST(ruby_verbose)) fprintf(stderr, "%s=%f (%f)\n", name, val, *default_value);
+ *default_value = val;
+ return 1;
+ }
+ else {
+ if (RTEST(ruby_verbose)) fprintf(stderr, "%s=%f (%f), but ignored because lower than %f\n", name, val, *default_value, lower_bound);
+ }
+ }
return 0;
}
-static VALUE
-os_obj_of(VALUE of)
+void
+ruby_gc_set_params(void)
{
- struct os_each_struct oes;
+ if (rb_safe_level() > 0) return;
- oes.num = 0;
- oes.of = of;
- rb_objspace_each_objects(os_obj_of_i, &oes);
- return SIZET2NUM(oes.num);
+ get_envparam_int ("RUBY_FREE_MIN", &gc_params.heap_min_free_slots, 0);
+
+ get_envparam_double("RUBY_HEAP_SLOTS_GROWTH_FACTOR", &gc_params.growth_factor, 1.0);
+ get_envparam_int ("RUBY_HEAP_SLOTS_GROWTH_MAX", &gc_params.growth_max, 0);
+ if (get_envparam_int("RUBY_HEAP_MIN_SLOTS", &gc_params.heap_min_slots, 0)) {
+ size_t min_size;
+ rb_objspace_t *objspace = &rb_objspace;
+
+ min_size = gc_params.heap_min_slots / HEAP_OBJ_LIMIT;
+ if (min_size > heap_eden->used) {
+ heap_add_pages(objspace, heap_eden, min_size - heap_eden->used);
+ }
+ }
+
+ get_envparam_int("RUBY_GC_MALLOC_LIMIT", &gc_params.malloc_limit_min, 0);
+ get_envparam_int("RUBY_GC_MALLOC_LIMIT_MAX", &gc_params.malloc_limit_max, 0);
+ get_envparam_double("RUBY_GC_MALLOC_LIMIT_GROWTH_FACTOR", &gc_params.malloc_limit_growth_factor, 1.0);
+
+ get_envparam_int("RUBY_GC_HEAP_OLDSPACE", &gc_params.oldspace_limit_min, 0);
+ get_envparam_int("RUBY_GC_HEAP_OLDSPACE_MAX", &gc_params.oldspace_limit_max, 0);
+ get_envparam_double("RUBY_GC_HEAP_OLDSPACE_GROWTH_FACTOR", &gc_params.oldspace_limit_growth_factor, 1.0);
}
-/*
- * call-seq:
- * ObjectSpace.each_object([module]) {|obj| ... } -> fixnum
- * ObjectSpace.each_object([module]) -> an_enumerator
- *
- * Calls the block once for each living, nonimmediate object in this
- * Ruby process. If <i>module</i> is specified, calls the block
- * for only those classes or modules that match (or are a subclass of)
- * <i>module</i>. Returns the number of objects found. Immediate
- * objects (<code>Fixnum</code>s, <code>Symbol</code>s
- * <code>true</code>, <code>false</code>, and <code>nil</code>) are
- * never returned. In the example below, <code>each_object</code>
- * returns both the numbers we defined and several constants defined in
- * the <code>Math</code> module.
- *
- * If no block is given, an enumerator is returned instead.
- *
- * a = 102.7
- * b = 95 # Won't be returned
- * c = 12345678987654321
- * count = ObjectSpace.each_object(Numeric) {|x| p x }
- * puts "Total count: #{count}"
- *
- * <em>produces:</em>
- *
- * 12345678987654321
- * 102.7
- * 2.71828182845905
- * 3.14159265358979
- * 2.22044604925031e-16
- * 1.7976931348623157e+308
- * 2.2250738585072e-308
- * Total count: 7
- *
- */
+RUBY_ALIAS_FUNCTION_VOID(rb_gc_set_params(void), ruby_gc_set_params, ())
-static VALUE
-os_each_obj(int argc, VALUE *argv, VALUE os)
+void
+rb_objspace_reachable_objects_from(VALUE obj, void (func)(VALUE, void *), void *data)
{
- VALUE of;
+ rb_objspace_t *objspace = &rb_objspace;
- rb_secure(4);
- if (argc == 0) {
- of = 0;
- }
- else {
- rb_scan_args(argc, argv, "01", &of);
+ if (is_markable_object(objspace, obj)) {
+ struct mark_func_data_struct mfd;
+ mfd.mark_func = func;
+ mfd.data = data;
+ objspace->mark_func_data = &mfd;
+ gc_mark_children(objspace, obj);
+ objspace->mark_func_data = 0;
}
- RETURN_ENUMERATOR(os, 1, &of);
- return os_obj_of(of);
}
-/*
- * call-seq:
- * ObjectSpace.undefine_finalizer(obj)
- *
- * Removes all finalizers for <i>obj</i>.
- *
- */
+struct root_objects_data {
+ const char *category;
+ void (*func)(const char *category, VALUE, void *);
+ void *data;
+};
-static VALUE
-undefine_final(VALUE os, VALUE obj)
+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;
- st_data_t data = obj;
- rb_check_frozen(obj);
- st_delete(finalizer_table, &data, 0);
- FL_UNSET(obj, FL_FINALIZE);
- return obj;
+ 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;
+
+ objspace->mark_func_data = &mfd;
+ {
+ gc_mark_roots(objspace, TRUE, &data.category);
+ }
+ objspace->mark_func_data = 0;
}
/*
- * call-seq:
- * ObjectSpace.define_finalizer(obj, aProc=proc())
- *
- * Adds <i>aProc</i> as a finalizer, to be called after <i>obj</i>
- * was destroyed.
- *
- */
+ ------------------------ Extended allocator ------------------------
+*/
-static VALUE
-define_final(int argc, VALUE *argv, VALUE os)
+static void vm_xfree(rb_objspace_t *objspace, void *ptr, size_t size);
+
+static void *
+negative_size_allocation_error_with_gvl(void *ptr)
{
- rb_objspace_t *objspace = &rb_objspace;
- VALUE obj, block, table;
- st_data_t data;
+ rb_raise(rb_eNoMemError, "%s", (const char *)ptr);
+ return 0; /* should not be reached */
+}
- rb_scan_args(argc, argv, "11", &obj, &block);
- rb_check_frozen(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));
+static void
+negative_size_allocation_error(const char *msg)
+{
+ if (ruby_thread_has_gvl_p()) {
+ rb_raise(rb_eNoMemError, "%s", msg);
}
- if (!FL_ABLE(obj)) {
- rb_raise(rb_eArgError, "cannot define finalizer for %s",
- rb_obj_classname(obj));
+ else {
+ if (ruby_native_thread_p()) {
+ rb_thread_call_with_gvl(negative_size_allocation_error_with_gvl, (void *)msg);
+ }
+ else {
+ fprintf(stderr, "[FATAL] %s\n", msg);
+ exit(EXIT_FAILURE);
+ }
}
- RBASIC(obj)->flags |= FL_FINALIZE;
+}
- block = rb_ary_new3(2, INT2FIX(rb_safe_level()), block);
- OBJ_FREEZE(block);
+static void *
+ruby_memerror_body(void *dummy)
+{
+ rb_memerror();
+ return 0;
+}
- if (st_lookup(finalizer_table, obj, &data)) {
- table = (VALUE)data;
- rb_ary_push(table, block);
+static void
+ruby_memerror(void)
+{
+ if (ruby_thread_has_gvl_p()) {
+ rb_memerror();
}
else {
- table = rb_ary_new3(1, block);
- RBASIC(table)->klass = 0;
- st_add_direct(finalizer_table, obj, table);
+ if (ruby_native_thread_p()) {
+ rb_thread_call_with_gvl(ruby_memerror_body, 0);
+ }
+ else {
+ /* no ruby thread */
+ fprintf(stderr, "[FATAL] failed to allocate memory\n");
+ exit(EXIT_FAILURE);
+ }
}
- return block;
}
void
-rb_gc_copy_finalizer(VALUE dest, VALUE obj)
+rb_memerror(void)
{
- rb_objspace_t *objspace = &rb_objspace;
- VALUE table;
- st_data_t data;
-
- if (!FL_TEST(obj, FL_FINALIZE)) return;
- if (st_lookup(finalizer_table, obj, &data)) {
- table = (VALUE)data;
- st_insert(finalizer_table, dest, table);
+ rb_thread_t *th = GET_THREAD();
+ if (!nomem_error ||
+ rb_thread_raised_p(th, RAISED_NOMEMORY)) {
+ fprintf(stderr, "[FATAL] failed to allocate memory\n");
+ exit(EXIT_FAILURE);
}
- FL_SET(dest, FL_FINALIZE);
+ if (rb_thread_raised_p(th, RAISED_NOMEMORY)) {
+ rb_thread_raised_clear(th);
+ GET_THREAD()->errinfo = nomem_error;
+ JUMP_TAG(TAG_RAISE);
+ }
+ rb_thread_raised_set(th, RAISED_NOMEMORY);
+ rb_exc_raise(nomem_error);
}
-static VALUE
-run_single_final(VALUE arg)
+static void *
+aligned_malloc(size_t alignment, size_t size)
{
- VALUE *args = (VALUE *)arg;
- rb_eval_cmd(args[0], args[1], (int)args[2]);
- return Qnil;
+ void *res;
+
+#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) {
+ return res;
+ }
+ else {
+ return NULL;
+ }
+#elif defined(HAVE_MEMALIGN)
+ res = memalign(alignment, size);
+#else
+ char* aligned;
+ res = malloc(alignment + size + sizeof(void*));
+ aligned = (char*)res + alignment + sizeof(void*);
+ aligned -= ((VALUE)aligned & (alignment - 1));
+ ((void**)aligned)[-1] = res;
+ res = (void*)aligned;
+#endif
+
+#if defined(_DEBUG) || GC_DEBUG
+ /* alignment must be a power of 2 */
+ assert(((alignment - 1) & alignment) == 0);
+ assert(alignment % sizeof(void*) == 0);
+#endif
+ return res;
}
static void
-run_finalizer(rb_objspace_t *objspace, VALUE objid, VALUE table)
+aligned_free(void *ptr)
{
- long i;
- int status;
- VALUE args[3];
+#if defined __MINGW32__
+ __mingw_aligned_free(ptr);
+#elif defined _WIN32 && !defined __CYGWIN__
+ _aligned_free(ptr);
+#elif defined(HAVE_MEMALIGN) || defined(HAVE_POSIX_MEMALIGN)
+ free(ptr);
+#else
+ free(((void**)ptr)[-1]);
+#endif
+}
- if (RARRAY_LEN(table) > 0) {
- args[1] = rb_obj_freeze(rb_ary_new3(1, objid));
+static void
+vm_malloc_increase(rb_objspace_t *objspace, size_t new_size, size_t old_size, int do_gc)
+{
+ if (new_size > old_size) {
+ ATOMIC_SIZE_ADD(malloc_increase, new_size - old_size);
}
else {
- args[1] = 0;
+ size_t sub = old_size - new_size;
+ if (sub != 0) {
+ retry_sub:;
+ {
+ size_t old_increase = malloc_increase;
+ size_t new_increase = old_increase > sub ? old_increase - sub : 0;
+ if (ATOMIC_SIZE_CAS(malloc_increase, old_increase, new_increase) != old_increase) goto retry_sub;
+ }
+ }
}
- 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]);
- status = 0;
- rb_protect(run_single_final, (VALUE)args, &status);
- if (status)
- rb_set_errinfo(Qnil);
+ if (do_gc) {
+ if (ruby_gc_stress && !ruby_disable_gc_stress) {
+ garbage_collect_with_gvl(objspace, FALSE, TRUE, GPR_FLAG_MALLOC);
+ }
+ else {
+ retry:
+ if (malloc_increase > malloc_limit) {
+ if (ruby_thread_has_gvl_p() && is_lazy_sweeping(heap_eden)) {
+ gc_rest_sweep(objspace); /* rest_sweep can reduce malloc_increase */
+ goto retry;
+ }
+ garbage_collect_with_gvl(objspace, FALSE, TRUE, GPR_FLAG_MALLOC);
+ }
+ }
}
}
-static void
-run_final(rb_objspace_t *objspace, VALUE obj)
+static inline size_t
+vm_malloc_prepare(rb_objspace_t *objspace, size_t size)
{
- VALUE objid;
- RUBY_DATA_FUNC free_func = 0;
- st_data_t key, table;
+ if ((ssize_t)size < 0) {
+ negative_size_allocation_error("negative allocation size (or too big)");
+ }
+ if (size == 0) size = 1;
- objspace->heap.final_num--;
+#if CALC_EXACT_MALLOC_SIZE
+ size += sizeof(size_t);
+#endif
- objid = rb_obj_id(obj); /* make obj into id */
- RBASIC(obj)->klass = 0;
+ vm_malloc_increase(objspace, size, 0, TRUE);
- if (RTYPEDDATA_P(obj)) {
- free_func = RTYPEDDATA_TYPE(obj)->function.dfree;
- }
- else {
- free_func = RDATA(obj)->dfree;
+ return size;
+}
+
+static inline void *
+vm_malloc_fixup(rb_objspace_t *objspace, void *mem, size_t size)
+{
+#if CALC_EXACT_MALLOC_SIZE
+ ATOMIC_SIZE_ADD(objspace->malloc_params.allocated_size, size);
+ ATOMIC_SIZE_INC(objspace->malloc_params.allocations);
+ ((size_t *)mem)[0] = size;
+ mem = (size_t *)mem + 1;
+#endif
+
+ return mem;
+}
+
+#define TRY_WITH_GC(alloc) do { \
+ if (!(alloc) && \
+ (!garbage_collect_with_gvl(objspace, 1, 1, GPR_FLAG_MALLOC) || /* full mark && immediate sweep */ \
+ !(alloc))) { \
+ ruby_memerror(); \
+ } \
+ } while (0)
+
+static void *
+vm_xmalloc(rb_objspace_t *objspace, size_t size)
+{
+ void *mem;
+
+ size = vm_malloc_prepare(objspace, size);
+ TRY_WITH_GC(mem = malloc(size));
+ return vm_malloc_fixup(objspace, mem, size);
+}
+
+static void *
+vm_xrealloc(rb_objspace_t *objspace, void *ptr, size_t new_size, size_t old_size)
+{
+ void *mem;
+#if CALC_EXACT_MALLOC_SIZE
+ size_t cem_oldsize;
+#endif
+
+ if ((ssize_t)new_size < 0) {
+ negative_size_allocation_error("negative re-allocation size");
}
- if (free_func) {
- (*free_func)(DATA_PTR(obj));
+
+ if (!ptr) return vm_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 (new_size == 0) {
+ vm_xfree(objspace, ptr, old_size);
+ return 0;
}
- key = (st_data_t)obj;
- if (st_delete(finalizer_table, &key, &table)) {
- run_finalizer(objspace, objid, (VALUE)table);
+#ifdef HAVE_MALLOC_USABLE_SIZE
+ old_size = malloc_usable_size(ptr);
+#endif
+
+ vm_malloc_increase(objspace, new_size, old_size, FALSE);
+
+#if CALC_EXACT_MALLOC_SIZE
+ new_size += sizeof(size_t);
+ ptr = (size_t *)ptr - 1;
+ cem_oldsize = ((size_t *)ptr)[0];
+
+ if (CALC_EXACT_MALLOC_SIZE_CHECK_OLD_SIZE && old_size > 0 && cem_oldsize - sizeof(size_t) != old_size) {
+ fprintf(stderr, "vm_xrealloc: old_size mismatch: expected %d, but %d\n", (int)(cem_oldsize-sizeof(size_t)), (int)old_size);
}
+#endif
+
+ TRY_WITH_GC(mem = realloc(ptr, new_size));
+
+#if CALC_EXACT_MALLOC_SIZE
+ ATOMIC_SIZE_ADD(objspace->malloc_params.allocated_size, new_size - cem_oldsize);
+ ((size_t *)mem)[0] = new_size;
+ mem = (size_t *)mem + 1;
+#endif
+
+ return mem;
}
static void
-finalize_deferred(rb_objspace_t *objspace)
+vm_xfree(rb_objspace_t *objspace, void *ptr, size_t old_size)
{
- RVALUE *p = deferred_final_list;
- deferred_final_list = 0;
+#if CALC_EXACT_MALLOC_SIZE
+ size_t cem_oldsize;
+ ptr = ((size_t *)ptr) - 1;
+ cem_oldsize = ((size_t*)ptr)[0];
+ if (cem_oldsize) {
+ ATOMIC_SIZE_SUB(objspace->malloc_params.allocated_size, cem_oldsize);
+ ATOMIC_SIZE_DEC(objspace->malloc_params.allocations);
+ }
+#endif
- if (p) {
- finalize_list(objspace, p);
+#ifdef HAVE_MALLOC_USABLE_SIZE
+ old_size = malloc_usable_size(ptr);
+#endif
+
+#if CALC_EXACT_MALLOC_SIZE
+ if (CALC_EXACT_MALLOC_SIZE_CHECK_OLD_SIZE && old_size > 0 && cem_oldsize - sizeof(size_t) != old_size) {
+ fprintf(stderr, "vm_xfree: old_size mismatch: expected %d, but %d\n", (int)(cem_oldsize-sizeof(size_t)), (int)old_size);
}
+#endif
+ vm_malloc_increase(objspace, 0, old_size, FALSE);
+
+ free(ptr);
}
-void
-rb_gc_finalize_deferred(void)
+void *
+ruby_xmalloc(size_t size)
{
- finalize_deferred(&rb_objspace);
+ return vm_xmalloc(&rb_objspace, size);
}
-struct force_finalize_list {
- VALUE obj;
- VALUE table;
- struct force_finalize_list *next;
-};
-
-static int
-force_chain_object(st_data_t key, st_data_t val, st_data_t arg)
+static inline size_t
+xmalloc2_size(size_t n, size_t size)
{
- struct force_finalize_list **prev = (struct force_finalize_list **)arg;
- struct force_finalize_list *curr = ALLOC(struct force_finalize_list);
- curr->obj = key;
- curr->table = val;
- curr->next = *prev;
- *prev = curr;
- return ST_CONTINUE;
+ size_t len = size * n;
+ if (n != 0 && size != len / n) {
+ rb_raise(rb_eArgError, "malloc: possible integer overflow");
+ }
+ return len;
}
-void
-rb_gc_call_finalizer_at_exit(void)
+void *
+ruby_xmalloc2(size_t n, size_t size)
{
- rb_objspace_call_finalizer(&rb_objspace);
+ return vm_xmalloc(&rb_objspace, xmalloc2_size(n, size));
}
-static void
-rb_objspace_call_finalizer(rb_objspace_t *objspace)
+static void *
+vm_xcalloc(rb_objspace_t *objspace, size_t count, size_t elsize)
{
- RVALUE *p, *pend;
- RVALUE *final_list = 0;
- size_t i;
+ void *mem;
+ size_t size;
- rest_sweep(objspace);
+ size = xmalloc2_size(count, elsize);
+ size = vm_malloc_prepare(objspace, size);
- /* run finalizers */
- finalize_deferred(objspace);
- assert(deferred_final_list == 0);
+ TRY_WITH_GC(mem = calloc(1, size));
+ return vm_malloc_fixup(objspace, mem, size);
+}
- /* force to run finalizer */
- while (finalizer_table->num_entries) {
- struct force_finalize_list *list = 0;
- st_foreach(finalizer_table, force_chain_object, (st_data_t)&list);
- while (list) {
- struct force_finalize_list *curr = list;
- run_finalizer(objspace, rb_obj_id(curr->obj), curr->table);
- st_delete(finalizer_table, (st_data_t*)&curr->obj, 0);
- list = curr->next;
- xfree(curr);
- }
- }
+void *
+ruby_xcalloc(size_t n, size_t size)
+{
+ return vm_xcalloc(&rb_objspace, n, size);
+}
- /* finalizers are part of garbage collection */
- during_gc++;
+void *
+ruby_sized_xrealloc(void *ptr, size_t new_size, size_t old_size)
+{
+ return vm_xrealloc(&rb_objspace, ptr, new_size, old_size);
+}
- /* run data object's finalizers */
- for (i = 0; i < heaps_used; i++) {
- p = objspace->heap.sorted[i].start; pend = objspace->heap.sorted[i].end;
- 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)) {
- p->as.free.flags = 0;
- if (RTYPEDDATA_P(p)) {
- RDATA(p)->dfree = RANY(p)->as.typeddata.type->function.dfree;
- }
- if (RANY(p)->as.data.dfree == (RUBY_DATA_FUNC)-1) {
- 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;
- }
- }
- else if (BUILTIN_TYPE(p) == T_FILE) {
- if (RANY(p)->as.file.fptr) {
- make_io_deferred(RANY(p));
- RANY(p)->as.free.next = final_list;
- final_list = p;
- }
- }
- p++;
- }
+void *
+ruby_xrealloc(void *ptr, size_t new_size)
+{
+ return ruby_sized_xrealloc(ptr, new_size, 0);
+}
+
+void *
+ruby_xrealloc2(void *ptr, size_t n, size_t size)
+{
+ size_t len = size * n;
+ if (n != 0 && size != len / n) {
+ rb_raise(rb_eArgError, "realloc: possible integer overflow");
}
- during_gc = 0;
- if (final_list) {
- finalize_list(objspace, final_list);
+ return ruby_xrealloc(ptr, len);
+}
+
+void
+ruby_sized_xfree(void *x, size_t size)
+{
+ if (x) {
+ vm_xfree(&rb_objspace, x, size);
}
+}
- st_free_table(finalizer_table);
- finalizer_table = 0;
+void
+ruby_xfree(void *x)
+{
+ ruby_sized_xfree(x, 0);
+}
+
+/* Mimic ruby_xmalloc, but need not rb_objspace.
+ * should return pointer suitable for ruby_xfree
+ */
+void *
+ruby_mimmalloc(size_t size)
+{
+ void *mem;
+#if CALC_EXACT_MALLOC_SIZE
+ size += sizeof(size_t);
+#endif
+ mem = malloc(size);
+#if CALC_EXACT_MALLOC_SIZE
+ /* set 0 for consistency of allocated_size/allocations */
+ ((size_t *)mem)[0] = 0;
+ mem = (size_t *)mem + 1;
+#endif
+ return mem;
}
void
-rb_gc(void)
+ruby_mimfree(void *ptr)
{
- rb_objspace_t *objspace = &rb_objspace;
- garbage_collect(objspace);
- finalize_deferred(objspace);
- free_unused_heaps(objspace);
+ size_t *mem = (size_t *)ptr;
+#if CALC_EXACT_MALLOC_SIZE
+ mem = mem - 1;
+#endif
+ free(mem);
}
+#if CALC_EXACT_MALLOC_SIZE
/*
* call-seq:
- * ObjectSpace._id2ref(object_id) -> an_object
+ * GC.malloc_allocated_size -> Integer
*
- * Converts an object id to a reference to the object. May not be
- * called on an object id passed as a parameter to a finalizer.
+ * Returns the size of memory allocated by malloc().
*
- * s = "I am a string" #=> "I am a string"
- * r = ObjectSpace._id2ref(s.object_id) #=> "I am a string"
- * r == s #=> true
+ * Only available if ruby was built with +CALC_EXACT_MALLOC_SIZE+.
+ */
+
+static VALUE
+gc_malloc_allocated_size(VALUE self)
+{
+ return UINT2NUM(rb_objspace.malloc_params.allocated_size);
+}
+
+/*
+ * call-seq:
+ * GC.malloc_allocations -> Integer
+ *
+ * Returns the number of malloc() allocations.
*
+ * Only available if ruby was built with +CALC_EXACT_MALLOC_SIZE+.
*/
static VALUE
-id2ref(VALUE obj, VALUE objid)
+gc_malloc_allocations(VALUE self)
{
-#if SIZEOF_LONG == SIZEOF_VOIDP
-#define NUM2PTR(x) NUM2ULONG(x)
-#elif SIZEOF_LONG_LONG == SIZEOF_VOIDP
-#define NUM2PTR(x) NUM2ULL(x)
+ return UINT2NUM(rb_objspace.malloc_params.allocations);
+}
#endif
- rb_objspace_t *objspace = &rb_objspace;
- VALUE ptr;
- void *p0;
- rb_secure(4);
- ptr = NUM2PTR(objid);
- p0 = (void *)ptr;
+/*
+ ------------------------------ WeakMap ------------------------------
+*/
- if (ptr == Qtrue) return Qtrue;
- if (ptr == Qfalse) return Qfalse;
- if (ptr == Qnil) return Qnil;
- if (FIXNUM_P(ptr)) return (VALUE)ptr;
- ptr = obj_id_to_ref(objid);
+struct weakmap {
+ st_table *obj2wmap; /* obj -> [ref,...] */
+ st_table *wmap2obj; /* ref -> obj */
+ VALUE final;
+};
- if ((ptr % sizeof(RVALUE)) == (4 << 2)) {
- ID symid = ptr / sizeof(RVALUE);
- if (rb_id2name(symid) == 0)
- rb_raise(rb_eRangeError, "%p is not symbol id value", p0);
- return ID2SYM(symid);
- }
+static int
+wmap_mark_map(st_data_t key, st_data_t val, st_data_t arg)
+{
+ rb_objspace_t *objspace = (rb_objspace_t *)arg;
+ VALUE obj = (VALUE)val;
+ if (!is_live_object(objspace, obj)) return ST_DELETE;
+ gc_mark_ptr(objspace, obj);
+ return ST_CONTINUE;
+}
- if (!is_pointer_to_heap(objspace, (void *)ptr) ||
- BUILTIN_TYPE(ptr) > T_FIXNUM || BUILTIN_TYPE(ptr) == T_ICLASS) {
- rb_raise(rb_eRangeError, "%p is not id value", p0);
+static void
+wmap_mark(void *ptr)
+{
+ struct weakmap *w = ptr;
+ if (w->obj2wmap) st_foreach(w->obj2wmap, wmap_mark_map, (st_data_t)&rb_objspace);
+ 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);
+ return ST_CONTINUE;
+}
+
+static void
+wmap_free(void *ptr)
+{
+ struct weakmap *w = ptr;
+ st_foreach(w->obj2wmap, wmap_free_map, 0);
+ st_free_table(w->obj2wmap);
+ 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);
+ return ST_CONTINUE;
+}
+
+static size_t
+wmap_memsize(const void *ptr)
+{
+ size_t size;
+ const struct weakmap *w = ptr;
+ if (!w) return 0;
+ size = sizeof(*w);
+ size += st_memsize(w->obj2wmap);
+ size += st_memsize(w->wmap2obj);
+ st_foreach(w->obj2wmap, wmap_memsize_map, (st_data_t)&size);
+ return size;
+}
+
+static const rb_data_type_t weakmap_type = {
+ "weakmap",
+ {
+ wmap_mark,
+ wmap_free,
+ wmap_memsize,
+ },
+ NULL, NULL, RUBY_TYPED_FREE_IMMEDIATELY
+};
+
+static VALUE
+wmap_allocate(VALUE klass)
+{
+ struct weakmap *w;
+ VALUE obj = TypedData_Make_Struct(klass, struct weakmap, &weakmap_type, w);
+ w->obj2wmap = st_init_numtable();
+ w->wmap2obj = st_init_numtable();
+ w->final = rb_obj_method(obj, ID2SYM(rb_intern("finalize")));
+ return obj;
+}
+
+static int
+wmap_final_func(st_data_t *key, st_data_t *value, st_data_t arg, int existing)
+{
+ VALUE wmap, ary;
+ if (!existing) return ST_STOP;
+ wmap = (VALUE)arg, ary = (VALUE)*value;
+ rb_ary_delete_same(ary, wmap);
+ if (!RARRAY_LEN(ary)) return ST_DELETE;
+ return ST_CONTINUE;
+}
+
+static VALUE
+wmap_finalize(VALUE self, VALUE objid)
+{
+ st_data_t orig, wmap, data;
+ VALUE obj, rids;
+ long i;
+ struct weakmap *w;
+
+ TypedData_Get_Struct(self, struct weakmap, &weakmap_type, w);
+ /* Get reference from object id. */
+ obj = obj_id_to_ref(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_AREF(rids, i);
+ st_delete(w->wmap2obj, &wmap, NULL);
+ }
}
- if (BUILTIN_TYPE(ptr) == 0 || RBASIC(ptr)->klass == 0) {
- rb_raise(rb_eRangeError, "%p is recycled object", p0);
+
+ wmap = (st_data_t)obj;
+ if (st_delete(w->wmap2obj, &wmap, &orig)) {
+ wmap = (st_data_t)obj;
+ st_update(w->obj2wmap, orig, wmap_final_func, wmap);
}
- return (VALUE)ptr;
+ return self;
}
-/*
- * Document-method: __id__
- * Document-method: object_id
- *
- * call-seq:
- * obj.__id__ -> fixnum
- * obj.object_id -> fixnum
- *
- * Returns an integer identifier for <i>obj</i>. The same number will
- * be returned on all calls to <code>id</code> for a given object, and
- * no two active objects will share an id.
- * <code>Object#object_id</code> is a different concept from the
- * <code>:name</code> notation, which returns the symbol id of
- * <code>name</code>. Replaces the deprecated <code>Object#id</code>.
- */
+struct wmap_iter_arg {
+ rb_objspace_t *objspace;
+ VALUE value;
+};
-/*
- * call-seq:
- * obj.hash -> fixnum
- *
- * Generates a <code>Fixnum</code> 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 class
- * <code>Hash</code>. Any hash value that exceeds the capacity of a
- * <code>Fixnum</code> will be truncated before being used.
- */
+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;
-VALUE
-rb_obj_id(VALUE obj)
+ 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_inspect(VALUE self)
{
- /*
- * 32-bit VALUE space
- * MSB ------------------------ LSB
- * false 00000000000000000000000000000000
- * true 00000000000000000000000000000010
- * nil 00000000000000000000000000000100
- * undef 00000000000000000000000000000110
- * symbol ssssssssssssssssssssssss00001110
- * object oooooooooooooooooooooooooooooo00 = 0 (mod sizeof(RVALUE))
- * fixnum fffffffffffffffffffffffffffffff1
- *
- * object_id space
- * LSB
- * false 00000000000000000000000000000000
- * true 00000000000000000000000000000010
- * nil 00000000000000000000000000000100
- * undef 00000000000000000000000000000110
- * symbol 000SSSSSSSSSSSSSSSSSSSSSSSSSSS0 S...S % A = 4 (S...S = s...s * A + 4)
- * object oooooooooooooooooooooooooooooo0 o...o % A = 0
- * fixnum fffffffffffffffffffffffffffffff1 bignum if required
- *
- * where A = sizeof(RVALUE)/4
- *
- * sizeof(RVALUE) is
- * 20 if 32-bit, double is 4-byte aligned
- * 24 if 32-bit, double is 8-byte aligned
- * 40 if 64-bit
- */
- if (SYMBOL_P(obj)) {
- return (SYM2ID(obj) * sizeof(RVALUE) + (4 << 2)) | FIXNUM_FLAG;
+ VALUE str;
+ VALUE c = rb_class_name(CLASS_OF(self));
+ struct weakmap *w;
+
+ TypedData_Get_Struct(self, struct weakmap, &weakmap_type, w);
+ str = rb_sprintf("-<%"PRIsVALUE":%p", c, (void *)self);
+ if (w->obj2wmap) {
+ st_foreach(w->obj2wmap, wmap_inspect_i, str);
}
- if (SPECIAL_CONST_P(obj)) {
- return LONG2NUM((SIGNED_VALUE)obj);
+ 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 nonspecial_obj_id(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
-set_zero(st_data_t key, st_data_t val, st_data_t arg)
+wmap_each_key_i(st_data_t key, st_data_t val, st_data_t arg)
{
- VALUE k = (VALUE)key;
- VALUE hash = (VALUE)arg;
- rb_hash_aset(hash, k, INT2FIX(0));
+ 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;
}
-/*
- * call-seq:
- * ObjectSpace.count_objects([result_hash]) -> hash
- *
- * Counts objects for each type.
- *
- * It returns a hash as:
- * {:TOTAL=>10000, :FREE=>3011, :T_OBJECT=>6, :T_CLASS=>404, ...}
- *
- * 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 defined.
- * It may be changed in future.
- *
- * This method is not expected to work except C Ruby.
- *
- */
+/* 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);
+ }
+ return ST_CONTINUE;
+}
+
+/* Iterates over keys and objects in a weakly referenced object */
static VALUE
-count_objects(int argc, VALUE *argv, VALUE os)
+wmap_each_value(VALUE self)
{
+ struct weakmap *w;
rb_objspace_t *objspace = &rb_objspace;
- size_t counts[T_MASK+1];
- size_t freed = 0;
- size_t total = 0;
- size_t i;
- VALUE hash;
- if (rb_scan_args(argc, argv, "01", &hash) == 1) {
- if (TYPE(hash) != T_HASH)
- rb_raise(rb_eTypeError, "non-hash given");
+ 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)
+{
+ rb_ary_push((VALUE)arg, (VALUE)key);
+ return ST_CONTINUE;
+}
+
+/* Iterates over keys and objects in a weakly referenced object */
+static VALUE
+wmap_keys(VALUE self)
+{
+ struct weakmap *w;
+ VALUE ary;
+
+ TypedData_Get_Struct(self, struct weakmap, &weakmap_type, w);
+ ary = rb_ary_new();
+ st_foreach(w->wmap2obj, wmap_keys_i, (st_data_t)ary);
+ return ary;
+}
+
+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;
+}
- for (i = 0; i <= T_MASK; i++) {
- counts[i] = 0;
+/* 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;
+}
+
+/* Creates a weak reference from the given key to the given value */
+static VALUE
+wmap_aset(VALUE self, VALUE wmap, VALUE orig)
+{
+ st_data_t data;
+ VALUE rids;
+ struct weakmap *w;
+
+ TypedData_Get_Struct(self, struct weakmap, &weakmap_type, w);
+ rb_define_finalizer(orig, w->final);
+ rb_define_finalizer(wmap, w->final);
+ if (st_lookup(w->obj2wmap, (st_data_t)orig, &data)) {
+ rids = (VALUE)data;
}
+ else {
+ rids = rb_ary_tmp_new(1);
+ st_insert(w->obj2wmap, (st_data_t)orig, (st_data_t)rids);
+ }
+ rb_ary_push(rids, wmap);
+ st_insert(w->wmap2obj, (st_data_t)wmap, (st_data_t)orig);
+ return nonspecial_obj_id(orig);
+}
- for (i = 0; i < heaps_used; i++) {
- RVALUE *p, *pend;
+/* Retrieves a weakly referenced object with the given key */
+static VALUE
+wmap_aref(VALUE self, VALUE wmap)
+{
+ st_data_t data;
+ VALUE obj;
+ struct weakmap *w;
+ rb_objspace_t *objspace = &rb_objspace;
- p = objspace->heap.sorted[i].start; pend = objspace->heap.sorted[i].end;
- for (;p < pend; p++) {
- if (p->as.basic.flags) {
- counts[BUILTIN_TYPE(p)]++;
- }
- else {
- freed++;
- }
+ TypedData_Get_Struct(self, struct weakmap, &weakmap_type, w);
+ if (!st_lookup(w->wmap2obj, (st_data_t)wmap, &data)) return Qnil;
+ obj = (VALUE)data;
+ if (!is_id_value(objspace, obj)) return Qnil;
+ if (!is_live_object(objspace, obj)) return Qnil;
+ 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;
+}
+
+
+/*
+ ------------------------------ GC profiler ------------------------------
+*/
+
+#define GC_PROFILE_RECORD_DEFAULT_SIZE 100
+
+static double
+getrusage_time(void)
+{
+#if defined(HAVE_CLOCK_GETTIME) && defined(CLOCK_PROCESS_CPUTIME_ID)
+ {
+ static int try_clock_gettime = 1;
+ struct timespec ts;
+ if (try_clock_gettime && clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &ts) == 0) {
+ return ts.tv_sec + ts.tv_nsec * 1e-9;
+ }
+ else {
+ try_clock_gettime = 0;
}
- total += objspace->heap.sorted[i].slot->limit;
}
+#endif
- if (hash == Qnil) {
- hash = rb_hash_new();
- }
- else if (!RHASH_EMPTY_P(hash)) {
- st_foreach(RHASH_TBL(hash), set_zero, hash);
+#ifdef RUSAGE_SELF
+ {
+ struct rusage usage;
+ struct timeval time;
+ if (getrusage(RUSAGE_SELF, &usage) == 0) {
+ time = usage.ru_utime;
+ return time.tv_sec + time.tv_usec * 1e-6;
+ }
}
- rb_hash_aset(hash, ID2SYM(rb_intern("TOTAL")), SIZET2NUM(total));
- rb_hash_aset(hash, ID2SYM(rb_intern("FREE")), SIZET2NUM(freed));
+#endif
- for (i = 0; i <= T_MASK; i++) {
- VALUE type;
- switch (i) {
-#define COUNT_TYPE(t) case (t): type = ID2SYM(rb_intern(#t)); break;
- COUNT_TYPE(T_NONE);
- COUNT_TYPE(T_OBJECT);
- COUNT_TYPE(T_CLASS);
- COUNT_TYPE(T_MODULE);
- COUNT_TYPE(T_FLOAT);
- COUNT_TYPE(T_STRING);
- COUNT_TYPE(T_REGEXP);
- COUNT_TYPE(T_ARRAY);
- COUNT_TYPE(T_HASH);
- COUNT_TYPE(T_STRUCT);
- COUNT_TYPE(T_BIGNUM);
- COUNT_TYPE(T_FILE);
- COUNT_TYPE(T_DATA);
- COUNT_TYPE(T_MATCH);
- COUNT_TYPE(T_COMPLEX);
- COUNT_TYPE(T_RATIONAL);
- COUNT_TYPE(T_NIL);
- COUNT_TYPE(T_TRUE);
- COUNT_TYPE(T_FALSE);
- COUNT_TYPE(T_SYMBOL);
- COUNT_TYPE(T_FIXNUM);
- COUNT_TYPE(T_UNDEF);
- COUNT_TYPE(T_NODE);
- COUNT_TYPE(T_ICLASS);
- COUNT_TYPE(T_ZOMBIE);
-#undef COUNT_TYPE
- default: type = INT2NUM(i); break;
+#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;
+#ifdef __GNUC__
+ t += q;
+#else
+ t += (double)(DWORD)(q >> 16) * (1 << 16);
+ t += (DWORD)q & ~(~0 << 16);
+#endif
+ return t;
}
- if (counts[i])
- rb_hash_aset(hash, type, SIZET2NUM(counts[i]));
}
+#endif
- return hash;
+ return 0.0;
}
-/*
- * call-seq:
- * GC.count -> Integer
- *
- * The number of times GC occurred.
- *
- * It returns the number of times GC occurred since the process started.
- *
- */
+static inline void
+gc_prof_setup_new_record(rb_objspace_t *objspace, int reason)
+{
+ if (objspace->profile.run) {
+ size_t index = objspace->profile.next_index;
+ gc_profile_record *record;
-static VALUE
-gc_count(VALUE self)
+ /* create new record */
+ objspace->profile.next_index++;
+
+ 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);
+
+ /* setup before-GC parameter */
+ record->flags = reason | ((ruby_gc_stress && !ruby_disable_gc_stress) ? GPR_FLAG_STRESS : 0);
+#if CALC_EXACT_MALLOC_SIZE
+ record->allocated_size = malloc_allocated_size;
+#endif
+#if GC_PROFILE_DETAIL_MEMORY
+#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
+ }
+}
+
+static inline void
+gc_prof_timer_start(rb_objspace_t *objspace)
{
- return UINT2NUM((&rb_objspace)->count);
+ if (objspace->profile.run) {
+ 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();
+ }
}
-/*
- * call-seq:
- * GC.stat -> Hash
- *
- * Returns a Hash containing information about the GC.
- *
- * The hash includes information about internal statistics about GC such as:
- *
- * {
- * :count => 18,
- * :heap_used => 77,
- * :heap_length => 77,
- * :heap_increment => 0,
- * :heap_live_num => 23287,
- * :heap_free_num => 8115,
- * :heap_final_num => 0,
- * }
- *
- * The contents of the hash are implementation defined and may be changed in
- * the future.
- *
- * This method is only expected to work on C Ruby.
- *
- */
+static double
+elapsed_time_from(double time)
+{
+ double now = getrusage_time();
+ if (now > time) {
+ return now - time;
+ }
+ else {
+ return 0;
+ }
+}
-static VALUE
-gc_stat(int argc, VALUE *argv, VALUE self)
+static inline void
+gc_prof_timer_stop(rb_objspace_t *objspace)
{
- rb_objspace_t *objspace = &rb_objspace;
- VALUE hash;
+ if (objspace->profile.run) {
+ gc_profile_record *record = gc_prof_record(objspace);
+ record->gc_time = elapsed_time_from(record->gc_invoke_time);
+ record->gc_invoke_time -= objspace->profile.invoke_time;
+ }
+}
- if (rb_scan_args(argc, argv, "01", &hash) == 1) {
- if (TYPE(hash) != T_HASH)
- rb_raise(rb_eTypeError, "non-hash given");
+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 GC_PROFILE_MORE_DETAIL
+ if (objspace->profile.run) {
+ gc_prof_record(objspace)->gc_mark_time = getrusage_time();
+ }
+#endif
+}
- if (hash == Qnil) {
- hash = rb_hash_new();
+static inline void
+gc_prof_mark_timer_stop(rb_objspace_t *objspace)
+{
+ if (RUBY_DTRACE_GC_MARK_END_ENABLED()) {
+ RUBY_DTRACE_GC_MARK_END();
}
+#if GC_PROFILE_MORE_DETAIL
+ if (objspace->profile.run) {
+ gc_profile_record *record = gc_prof_record(objspace);
+ record->gc_mark_time = elapsed_time_from(record->gc_mark_time);
+ }
+#endif
+}
- rest_sweep(objspace);
+static inline void
+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) {
+ gc_profile_record *record = gc_prof_record(objspace);
- rb_hash_aset(hash, ID2SYM(rb_intern("count")), SIZET2NUM(objspace->count));
+ if (record->gc_time > 0 || GC_PROFILE_MORE_DETAIL) {
+ objspace->profile.gc_sweep_start_time = getrusage_time();
+ }
+ }
+}
- /* implementation dependent counters */
- rb_hash_aset(hash, ID2SYM(rb_intern("heap_used")), SIZET2NUM(objspace->heap.used));
- rb_hash_aset(hash, ID2SYM(rb_intern("heap_length")), SIZET2NUM(objspace->heap.length));
- rb_hash_aset(hash, ID2SYM(rb_intern("heap_increment")), SIZET2NUM(objspace->heap.increment));
- rb_hash_aset(hash, ID2SYM(rb_intern("heap_live_num")), SIZET2NUM(objspace->heap.live_num));
- rb_hash_aset(hash, ID2SYM(rb_intern("heap_free_num")), SIZET2NUM(objspace->heap.free_num));
- rb_hash_aset(hash, ID2SYM(rb_intern("heap_final_num")), SIZET2NUM(objspace->heap.final_num));
- return hash;
+static inline void
+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;
+ 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
+ }
}
+static inline void
+gc_prof_set_malloc_info(rb_objspace_t *objspace)
+{
+#if GC_PROFILE_MORE_DETAIL
+ if (objspace->profile.run) {
+ 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)
+{
+ if (objspace->profile.run) {
+ gc_profile_record *record = gc_prof_record(objspace);
+ size_t live = objspace->profile.total_allocated_object_num_at_gc_start - objspace->profile.total_freed_object_num;
+ size_t total = objspace->profile.heap_used_at_gc_start * HEAP_OBJ_LIMIT;
+
+#if GC_PROFILE_MORE_DETAIL
+ 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);
+ }
+}
-#if CALC_EXACT_MALLOC_SIZE
/*
* call-seq:
- * GC.malloc_allocated_size -> Integer
+ * GC::Profiler.clear -> nil
*
- * The allocated size by malloc().
+ * Clears the GC profiler data.
*
- * It returns the allocated size by malloc().
*/
static VALUE
-gc_malloc_allocated_size(VALUE self)
+gc_profile_clear(void)
{
- return UINT2NUM((&rb_objspace)->malloc_params.allocated_size);
+ rb_objspace_t *objspace = &rb_objspace;
+
+ /* This method doesn't change profile.run status.
+ * While lazy sweeping, it is possible to touch zero-cleared profile.current_record.
+ */
+ gc_rest_sweep(objspace);
+
+ if (GC_PROFILE_RECORD_DEFAULT_SIZE * 2 < objspace->profile.size) {
+ objspace->profile.size = GC_PROFILE_RECORD_DEFAULT_SIZE * 2;
+ objspace->profile.records = realloc(objspace->profile.records, sizeof(gc_profile_record) * objspace->profile.size);
+ if (!objspace->profile.records) {
+ rb_memerror();
+ }
+ }
+ MEMZERO(objspace->profile.records, gc_profile_record, objspace->profile.size);
+ objspace->profile.next_index = 0;
+ objspace->profile.current_record = 0;
+ return Qnil;
+}
+
+static VALUE
+gc_profile_flags(int flags)
+{
+ VALUE result = rb_ary_new();
+ rb_ary_push(result, ID2SYM(rb_intern(flags & GPR_FLAG_MAJOR_MASK ? "major_gc" : "minor_gc")));
+ if (flags & GPR_FLAG_HAVE_FINALIZE) rb_ary_push(result, ID2SYM(rb_intern("HAVE_FINALIZE")));
+ if (flags & GPR_FLAG_NEWOBJ) rb_ary_push(result, ID2SYM(rb_intern("CAUSED_BY_NEWOBJ")));
+ if (flags & GPR_FLAG_MALLOC) rb_ary_push(result, ID2SYM(rb_intern("CAUSED_BY_MALLOC")));
+ if (flags & GPR_FLAG_METHOD) rb_ary_push(result, ID2SYM(rb_intern("CAUSED_BY_METHOD")));
+ if (flags & GPR_FLAG_STRESS) rb_ary_push(result, ID2SYM(rb_intern("CAUSED_BY_STRESS")));
+ return result;
}
/*
* call-seq:
- * GC.malloc_allocations -> Integer
+ * GC::Profiler.raw_data -> [Hash, ...]
+ *
+ * Returns an Array of individual raw profile data Hashes ordered
+ * from earliest to latest by +:GC_INVOKE_TIME+.
+ *
+ * For example:
+ *
+ * [
+ * {
+ * :GC_TIME=>1.3000000000000858e-05,
+ * :GC_INVOKE_TIME=>0.010634999999999999,
+ * :HEAP_USE_SIZE=>289640,
+ * :HEAP_TOTAL_SIZE=>588960,
+ * :HEAP_TOTAL_OBJECTS=>14724,
+ * :GC_IS_MARKED=>false
+ * },
+ * # ...
+ * ]
+ *
+ * The keys mean:
*
- * The number of allocated memory object by malloc().
+ * +:GC_TIME+::
+ * Time elapsed in seconds for this GC run
+ * +:GC_INVOKE_TIME+::
+ * Time elapsed in seconds from startup to when the GC was invoked
+ * +:HEAP_USE_SIZE+::
+ * Total bytes of heap used
+ * +:HEAP_TOTAL_SIZE+::
+ * Total size of heap in bytes
+ * +:HEAP_TOTAL_OBJECTS+::
+ * Total number of objects
+ * +:GC_IS_MARKED+::
+ * Returns +true+ if the GC is in mark phase
+ *
+ * If ruby was built with +GC_PROFILE_MORE_DETAIL+, you will also have access
+ * to the following hash keys:
+ *
+ * +:GC_MARK_TIME+::
+ * +:GC_SWEEP_TIME+::
+ * +:ALLOCATE_INCREASE+::
+ * +:ALLOCATE_LIMIT+::
+ * +:HEAP_USE_PAGES+::
+ * +:HEAP_LIVE_OBJECTS+::
+ * +:HEAP_FREE_OBJECTS+::
+ * +:HAVE_FINALIZE+::
*
- * It returns the number of allocated memory object by malloc().
*/
static VALUE
-gc_malloc_allocations(VALUE self)
-{
- return UINT2NUM((&rb_objspace)->malloc_params.allocations);
-}
-#endif
-
-static VALUE
gc_profile_record_get(void)
{
VALUE prof;
@@ -3503,23 +6447,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_profile_flags(record->flags));
+ rb_hash_aset(prof, ID2SYM(rb_intern("GC_TIME")), DBL2NUM(record->gc_time));
+ rb_hash_aset(prof, ID2SYM(rb_intern("GC_INVOKE_TIME")), DBL2NUM(record->gc_invoke_time));
+ rb_hash_aset(prof, ID2SYM(rb_intern("HEAP_USE_SIZE")), SIZET2NUM(record->heap_use_size));
+ 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);
}
@@ -3527,9 +6484,101 @@ gc_profile_record_get(void)
return gc_profile;
}
+static void
+gc_profile_dump_on(VALUE out, VALUE (*append)(VALUE, VALUE))
+{
+ rb_objspace_t *objspace = &rb_objspace;
+ size_t count = objspace->profile.next_index;
+
+ if (objspace->profile.run && count /* > 1 */) {
+ size_t i;
+ 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++) {
+ 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" \
+ "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++) {
+ record = &objspace->profile.records[i];
+ append(out, rb_sprintf("%5"PRIdSIZE" %c/%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,
+ "-+O3S567R9abcdef!"[record->flags & GPR_FLAG_MAJOR_MASK], /* Stress,Rescan,Shady,Oldgen,NoFree */
+ (record->flags & GPR_FLAG_HAVE_FINALIZE) ? 'F' : '.',
+ (record->flags & GPR_FLAG_NEWOBJ) ? "NEWOBJ" :
+ (record->flags & GPR_FLAG_MALLOC) ? "MALLOC" :
+ (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
+ }
+}
+
/*
* call-seq:
- * GC::Profiler.result -> String
+ * GC::Profiler.result -> String
*
* Returns a profile data report such as:
*
@@ -3541,61 +6590,17 @@ gc_profile_record_get(void)
static VALUE
gc_profile_result(void)
{
- rb_objspace_t *objspace = &rb_objspace;
- VALUE record;
- VALUE result;
- int i, index;
-
- record = gc_profile_record_get();
- if (objspace->profile.run && objspace->profile.count) {
- result = rb_sprintf("GC %d invokes.\n", NUM2INT(gc_count(0)));
- index = 1;
- rb_str_cat2(result, "Index Invoke Time(sec) Use Size(byte) Total Size(byte) Total Object GC Time(ms)\n");
- for (i = 0; i < (int)RARRAY_LEN(record); i++) {
- VALUE r = RARRAY_PTR(record)[i];
-#if !GC_PROFILE_MORE_DETAIL
- if (rb_hash_aref(r, ID2SYM(rb_intern("GC_IS_MARKED")))) {
-#endif
- rb_str_catf(result, "%5d %19.3f %20"PRIuSIZE" %20"PRIuSIZE" %20"PRIuSIZE" %30.20f\n",
- index++, NUM2DBL(rb_hash_aref(r, ID2SYM(rb_intern("GC_INVOKE_TIME")))),
- (size_t)NUM2SIZET(rb_hash_aref(r, ID2SYM(rb_intern("HEAP_USE_SIZE")))),
- (size_t)NUM2SIZET(rb_hash_aref(r, ID2SYM(rb_intern("HEAP_TOTAL_SIZE")))),
- (size_t)NUM2SIZET(rb_hash_aref(r, ID2SYM(rb_intern("HEAP_TOTAL_OBJECTS")))),
- NUM2DBL(rb_hash_aref(r, ID2SYM(rb_intern("GC_TIME"))))*1000);
-#if !GC_PROFILE_MORE_DETAIL
- }
-#endif
- }
-#if GC_PROFILE_MORE_DETAIL
- rb_str_cat2(result, "\n\n");
- rb_str_cat2(result, "More detail.\n");
- rb_str_cat2(result, "Index Allocate Increase Allocate Limit Use Slot Have Finalize Mark Time(ms) Sweep Time(ms)\n");
- index = 1;
- for (i = 0; i < (int)RARRAY_LEN(record); i++) {
- VALUE r = RARRAY_PTR(record)[i];
- rb_str_catf(result, "%5d %17"PRIuSIZE" %17"PRIuSIZE" %9"PRIuSIZE" %14s %25.20f %25.20f\n",
- index++, (size_t)NUM2SIZET(rb_hash_aref(r, ID2SYM(rb_intern("ALLOCATE_INCREASE")))),
- (size_t)NUM2SIZET(rb_hash_aref(r, ID2SYM(rb_intern("ALLOCATE_LIMIT")))),
- (size_t)NUM2SIZET(rb_hash_aref(r, ID2SYM(rb_intern("HEAP_USE_SLOTS")))),
- rb_hash_aref(r, ID2SYM(rb_intern("HAVE_FINALIZE")))? "true" : "false",
- NUM2DBL(rb_hash_aref(r, ID2SYM(rb_intern("GC_MARK_TIME"))))*1000,
- NUM2DBL(rb_hash_aref(r, ID2SYM(rb_intern("GC_SWEEP_TIME"))))*1000);
- }
-#endif
- }
- else {
- result = rb_str_new2("");
- }
- return result;
+ VALUE str = rb_str_buf_new(0);
+ gc_profile_dump_on(str, rb_str_buf_append);
+ return str;
}
-
/*
* call-seq:
* GC::Profiler.report
- * GC::Profiler.report io
+ * GC::Profiler.report(io)
*
- * Writes the GC::Profiler#result to <tt>$stdout</tt> or the given IO object.
+ * Writes the GC::Profiler.result to <tt>$stdout</tt> or the given IO object.
*
*/
@@ -3610,16 +6615,16 @@ gc_profile_report(int argc, VALUE *argv, VALUE self)
else {
rb_scan_args(argc, argv, "01", &out);
}
- rb_io_write(out, gc_profile_result());
+ gc_profile_dump_on(out, rb_io_write);
return Qnil;
}
/*
* call-seq:
- * GC::Profiler.total_time -> float
+ * GC::Profiler.total_time -> float
*
- * The total time used for garbage collection in milliseconds
+ * The total time used for garbage collection in seconds
*/
static VALUE
@@ -3627,16 +6632,199 @@ 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);
}
+/*
+ * call-seq:
+ * GC::Profiler.enabled? -> true or false
+ *
+ * The current status of GC profile mode.
+ */
+
+static VALUE
+gc_profile_enable_get(VALUE self)
+{
+ rb_objspace_t *objspace = &rb_objspace;
+ return objspace->profile.run ? Qtrue : Qfalse;
+}
+
+/*
+ * call-seq:
+ * GC::Profiler.enable -> nil
+ *
+ * Starts the GC profiler.
+ *
+ */
+
+static VALUE
+gc_profile_enable(void)
+{
+ rb_objspace_t *objspace = &rb_objspace;
+ gc_rest_sweep(objspace);
+ objspace->profile.run = TRUE;
+ return Qnil;
+}
+
+/*
+ * call-seq:
+ * GC::Profiler.disable -> nil
+ *
+ * Stops the GC profiler.
+ *
+ */
+
+static VALUE
+gc_profile_disable(void)
+{
+ rb_objspace_t *objspace = &rb_objspace;
+
+ objspace->profile.run = FALSE;
+ objspace->profile.current_record = 0;
+ return Qnil;
+}
+
+/*
+ ------------------------------ 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 GC_DEBUG
+
+void
+rb_gcdebug_print_obj_condition(VALUE obj)
+{
+ rb_objspace_t *objspace = &rb_objspace;
+
+ fprintf(stderr, "created at: %s:%d\n", RSTRING_PTR(RANY(obj)->file), FIX2INT(RANY(obj)->line));
+
+ if (is_pointer_to_heap(objspace, (void *)obj)) {
+ fprintf(stderr, "pointer to heap?: true\n");
+ }
+ else {
+ fprintf(stderr, "pointer to heap?: false\n");
+ return;
+ }
+
+ fprintf(stderr, "marked? : %s\n", MARKED_IN_BITMAP(GET_HEAP_MARK_BITS(obj), obj) ? "true" : "false");
+#if USE_RGENGC
+#if RGENGC_THREEGEN
+ fprintf(stderr, "young? : %s\n", RVALUE_YOUNG_P(obj) ? "true" : "false");
+#endif
+ fprintf(stderr, "old? : %s\n", RVALUE_OLD_P(obj) ? "true" : "false");
+ fprintf(stderr, "shady? : %s\n", RVALUE_SHADY(obj) ? "true" : "false");
+ fprintf(stderr, "remembered?: %s\n", MARKED_IN_BITMAP(GET_HEAP_REMEMBERSET_BITS(obj), obj) ? "true" : "false");
+#endif
+
+ if (is_lazy_sweeping(heap_eden)) {
+ fprintf(stderr, "lazy sweeping?: true\n");
+ fprintf(stderr, "swept?: %s\n", is_swept_object(objspace, obj) ? "done" : "not yet");
+ }
+ else {
+ fprintf(stderr, "lazy sweeping?: false\n");
+ }
+}
+
+static VALUE
+gcdebug_sential(VALUE obj, VALUE name)
+{
+ fprintf(stderr, "WARNING: object %s(%p) is inadvertently collected\n", (char *)name, (void *)obj);
+ return Qnil;
+}
+
+void
+rb_gcdebug_sentinel(VALUE obj, const char *name)
+{
+ rb_define_finalizer(obj, rb_proc_new(gcdebug_sential, (VALUE)name));
+}
+#endif /* GC_DEBUG */
+
+/*
+ * Document-module: ObjectSpace
+ *
+ * The ObjectSpace module contains a number of routines
+ * that interact with the garbage collection facility and allow you to
+ * traverse all living objects with an iterator.
+ *
+ * ObjectSpace also provides support for object finalizers, procs that will be
+ * called when a specific object is about to be destroyed by garbage
+ * collection.
+ *
+ * a = "A"
+ * b = "B"
+ *
+ * ObjectSpace.define_finalizer(a, proc {|id| puts "Finalizer one on #{id}" })
+ * ObjectSpace.define_finalizer(b, proc {|id| puts "Finalizer two on #{id}" })
+ *
+ * _produces:_
+ *
+ * Finalizer two on 537763470
+ * Finalizer one on 537763480
+ */
+
+/*
+ * Document-class: ObjectSpace::WeakMap
+ *
+ * An ObjectSpace::WeakMap object holds references to
+ * any objects, but those objects can get garbage collected.
+ *
+ * This class is mostly used internally by WeakRef, please use
+ * +lib/weakref.rb+ for the public interface.
+ */
+
/* Document-class: GC::Profiler
*
* The GC profiler provides access to information on GC runs including time,
@@ -3648,7 +6836,7 @@ gc_profile_total_time(VALUE self)
*
* require 'rdoc/rdoc'
*
- * puts GC::Profiler.result
+ * GC::Profiler.report
*
* GC::Profiler.disable
*
@@ -3656,9 +6844,11 @@ gc_profile_total_time(VALUE self)
*/
/*
- * The <code>GC</code> module provides an interface to Ruby's mark and
- * sweep garbage collection mechanism. Some of the underlying methods
- * are also available via the ObjectSpace module.
+ * The GC module provides an interface to Ruby's mark and
+ * sweep garbage collection mechanism.
+ *
+ * Some of the underlying methods are also available via the ObjectSpace
+ * module.
*
* You may obtain information about the operation of the GC through
* GC::Profiler.
@@ -3667,7 +6857,7 @@ gc_profile_total_time(VALUE self)
void
Init_GC(void)
{
- VALUE rb_mObSpace;
+ VALUE rb_mObjSpace;
VALUE rb_mProfiler;
rb_mGC = rb_define_module("GC");
@@ -3683,20 +6873,21 @@ Init_GC(void)
rb_mProfiler = rb_define_module_under(rb_mGC, "Profiler");
rb_define_singleton_method(rb_mProfiler, "enabled?", gc_profile_enable_get, 0);
rb_define_singleton_method(rb_mProfiler, "enable", gc_profile_enable, 0);
+ rb_define_singleton_method(rb_mProfiler, "raw_data", gc_profile_record_get, 0);
rb_define_singleton_method(rb_mProfiler, "disable", gc_profile_disable, 0);
rb_define_singleton_method(rb_mProfiler, "clear", gc_profile_clear, 0);
rb_define_singleton_method(rb_mProfiler, "result", gc_profile_result, 0);
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", rb_gc_start, 0);
- 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")));
@@ -3706,10 +6897,49 @@ Init_GC(void)
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_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_private_method(rb_cWeakMap, "finalize", wmap_finalize, 1);
+ rb_include_module(rb_cWeakMap, rb_mEnumerable);
+ }
#if CALC_EXACT_MALLOC_SIZE
rb_define_singleton_method(rb_mGC, "malloc_allocated_size", gc_malloc_allocated_size, 0);
rb_define_singleton_method(rb_mGC, "malloc_allocations", gc_malloc_allocations, 0);
#endif
+
+ /* ::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_str_new2(#o))
+ OPT(GC_DEBUG);
+ OPT(USE_RGENGC);
+ OPT(RGENGC_DEBUG);
+ OPT(RGENGC_CHECK_MODE);
+ OPT(RGENGC_PROFILE);
+ OPT(RGENGC_THREEGEN);
+ OPT(RGENGC_ESTIMATE_OLDSPACE);
+ OPT(GC_PROFILE_MORE_DETAIL);
+ OPT(GC_ENABLE_LAZY_SWEEP);
+ OPT(CALC_EXACT_MALLOC_SIZE);
+ OPT(CALC_EXACT_MALLOC_SIZE_CHECK_OLD_SIZE);
+ OPT(GC_PROFILE_DETAIL_MEMORY);
+#undef OPT
+ }
}
diff --git a/gc.h b/gc.h
index 08ee62ad13..09edafa027 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__)
-#define SET_MACHINE_STACK_END(p) __asm__ volatile ("movq\t%%rsp, %0" : "=r" (*(p)))
-#elif defined(__i386) && defined(__GNUC__)
-#define SET_MACHINE_STACK_END(p) __asm__ volatile ("movl\t%%esp, %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)))
#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,17 +83,19 @@ 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);
+
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
+RUBY_SYMBOL_EXPORT_END
#endif /* RUBY_GC_H */
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 17be654800..8f7cf30be4 100644
--- a/goruby.c
+++ b/goruby.c
@@ -1,18 +1,52 @@
void Init_golf(void);
+#define ruby_options goruby_options
#define ruby_run_node goruby_run_node
#include "main.c"
+#undef ruby_options
#undef ruby_run_node
+#if defined _WIN32
+#include <io.h>
+#include <fcntl.h>
+#define pipe(p) _pipe(p, 32L, _O_NOINHERIT)
+#elif defined HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
+RUBY_EXTERN void *ruby_options(int argc, char **argv);
RUBY_EXTERN int ruby_run_node(void*);
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;
}
+void *
+goruby_options(int argc, char **argv)
+{
+ static const char cmd[] = "END{require 'irb';IRB.start}";
+ int rw[2], infd;
+ void *ret;
+
+ if ((isatty(0) && isatty(1) && isatty(2)) && (pipe(rw) == 0)) {
+ infd = dup(0);
+ dup2(rw[0], 0);
+ close(rw[0]);
+ write(rw[1], cmd, sizeof(cmd) - 1);
+ close(rw[1]);
+ ret = ruby_options(argc, argv);
+ dup2(infd, 0);
+ close(infd);
+ return ret;
+ }
+ else {
+ return ruby_options(argc, argv);
+ }
+}
+
int
goruby_run_node(void *arg)
{
diff --git a/hash.c b/hash.c
index 0a5f6a600e..bc90adaa35 100644
--- a/hash.c
+++ b/hash.c
@@ -15,16 +15,29 @@
#include "ruby/st.h"
#include "ruby/util.h"
#include "ruby/encoding.h"
+#include "internal.h"
#include <errno.h>
+#include "probes.h"
#ifdef __APPLE__
-#include <crt_externs.h>
+# ifdef HAVE_CRT_EXTERNS_H
+# include <crt_externs.h>
+# else
+# include "missing/crt_externs.h"
+# endif
#endif
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)
@@ -37,6 +50,13 @@ VALUE rb_cHash;
static VALUE envtbl;
static ID id_hash, id_yield, id_default;
+VALUE
+rb_hash_set_ifnone(VALUE hash, VALUE ifnone)
+{
+ OBJ_WRITE(hash, (&RHASH(hash)->ifnone), ifnone);
+ return hash;
+}
+
static int
rb_any_cmp(VALUE a, VALUE b)
{
@@ -44,8 +64,8 @@ rb_any_cmp(VALUE a, VALUE b)
if (FIXNUM_P(a) && FIXNUM_P(b)) {
return a != b;
}
- if (TYPE(a) == T_STRING && RBASIC(a)->klass == rb_cString &&
- TYPE(b) == T_STRING && RBASIC(b)->klass == rb_cString) {
+ if (RB_TYPE_P(a, T_STRING) && RBASIC(a)->klass == rb_cString &&
+ RB_TYPE_P(b, T_STRING) && RBASIC(b)->klass == rb_cString) {
return rb_str_hash_cmp(a, b);
}
if (a == Qundef || b == Qundef) return -1;
@@ -66,7 +86,16 @@ rb_hash(VALUE obj)
return hval;
case T_BIGNUM:
- return LONG2FIX(((long*)(RBIGNUM_DIGITS(hval)))[0]);
+ {
+ 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);
+ }
default:
hval = rb_to_int(hval);
@@ -80,20 +109,14 @@ rb_any_hash(VALUE a)
VALUE hval;
st_index_t hnum;
- switch (TYPE(a)) {
- case T_FIXNUM:
- case T_SYMBOL:
- case T_NIL:
- case T_FALSE:
- case T_TRUE:
- hnum = rb_hash_end(rb_hash_start((unsigned int)a));
- break;
-
- case T_STRING:
+ if (SPECIAL_CONST_P(a)) {
+ if (a == Qundef) return 0;
+ hnum = rb_hash_end(rb_hash_start((st_index_t)a));
+ }
+ else if (BUILTIN_TYPE(a) == T_STRING) {
hnum = rb_str_hash(a);
- break;
-
- default:
+ }
+ else {
hval = rb_hash(a);
hnum = FIX2LONG(hval);
}
@@ -106,10 +129,8 @@ static const struct st_hash_type objhash = {
rb_any_hash,
};
-static const struct st_hash_type identhash = {
- st_numcmp,
- st_numhash,
-};
+extern const struct st_hash_type st_hashtype_num;
+#define identhash st_hashtype_num
typedef int st_foreach_func(st_data_t, st_data_t, st_data_t);
@@ -120,11 +141,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 (key == Qundef) return ST_CONTINUE;
+ if (error) return ST_STOP;
status = (*arg->func)(key, value, arg->arg);
if (status == ST_CONTINUE) {
return ST_CHECK;
@@ -140,7 +162,7 @@ st_foreach_safe(st_table *table, int (*func)(ANYARGS), st_data_t a)
arg.tbl = table;
arg.func = (st_foreach_func *)func;
arg.arg = a;
- if (st_foreach(table, foreach_safe_i, (st_data_t)&arg)) {
+ if (st_foreach_check(table, foreach_safe_i, (st_data_t)&arg, 0)) {
rb_raise(rb_eRuntimeError, "hash modified during iteration");
}
}
@@ -154,21 +176,22 @@ struct hash_foreach_arg {
};
static int
-hash_foreach_iter(st_data_t key, st_data_t value, struct hash_foreach_arg *arg)
+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;
- if ((VALUE)key == Qundef) return ST_CONTINUE;
status = (*arg->func)((VALUE)key, (VALUE)value, arg->arg);
if (RHASH(arg->hash)->ntbl != tbl) {
rb_raise(rb_eRuntimeError, "rehash occurred during iteration");
}
switch (status) {
case ST_DELETE:
- st_delete_safe(tbl, &key, 0, Qundef);
FL_SET(arg->hash, HASH_DELETED);
+ return ST_DELETE;
case ST_CONTINUE:
break;
case ST_STOP:
@@ -178,13 +201,18 @@ hash_foreach_iter(st_data_t key, st_data_t value, struct hash_foreach_arg *arg)
}
static VALUE
-hash_foreach_ensure(VALUE hash)
+hash_foreach_ensure_rollback(VALUE hash)
{
- RHASH(hash)->iter_lev--;
+ RHASH_ITER_LEV(hash)++;
+ return 0;
+}
- if (RHASH(hash)->iter_lev == 0) {
+static VALUE
+hash_foreach_ensure(VALUE hash)
+{
+ if (--RHASH_ITER_LEV(hash) == 0) {
if (FL_TEST(hash, HASH_DELETED)) {
- st_cleanup_safe(RHASH(hash)->ntbl, Qundef);
+ st_cleanup_safe(RHASH(hash)->ntbl, (st_data_t)Qundef);
FL_UNSET(hash, HASH_DELETED);
}
}
@@ -192,9 +220,10 @@ hash_foreach_ensure(VALUE hash)
}
static VALUE
-hash_foreach_call(struct hash_foreach_arg *arg)
+hash_foreach_call(VALUE arg)
{
- if (st_foreach(RHASH(arg->hash)->ntbl, hash_foreach_iter, (st_data_t)arg)) {
+ VALUE hash = ((struct hash_foreach_arg *)arg)->hash;
+ if (st_foreach_check(RHASH(hash)->ntbl, hash_foreach_iter, (st_data_t)arg, (st_data_t)Qundef)) {
rb_raise(rb_eRuntimeError, "hash modified during iteration");
}
return Qnil;
@@ -207,7 +236,7 @@ rb_hash_foreach(VALUE hash, int (*func)(ANYARGS), VALUE farg)
if (!RHASH(hash)->ntbl)
return;
- RHASH(hash)->iter_lev++;
+ RHASH_ITER_LEV(hash)++;
arg.hash = hash;
arg.func = (rb_foreach_func *)func;
arg.arg = farg;
@@ -217,14 +246,23 @@ rb_hash_foreach(VALUE hash, int (*func)(ANYARGS), VALUE farg)
static VALUE
hash_alloc(VALUE klass)
{
- NEWOBJ(hash, struct RHash);
- OBJSETUP(hash, 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;
}
+static VALUE
+empty_hash_alloc(VALUE klass)
+{
+ if (RUBY_DTRACE_HASH_CREATE_ENABLED()) {
+ RUBY_DTRACE_HASH_CREATE(0, rb_sourcefile(), rb_sourceline());
+ }
+
+ return hash_alloc(klass);
+}
+
VALUE
rb_hash_new(void)
{
@@ -234,15 +272,18 @@ rb_hash_new(void)
VALUE
rb_hash_dup(VALUE hash)
{
- NEWOBJ(ret, struct RHash);
- DUPSETUP(ret, hash);
+ NEWOBJ_OF(ret, struct RHash,
+ rb_obj_class(hash),
+ (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;
}
@@ -250,12 +291,10 @@ 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);
@@ -263,21 +302,92 @@ 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));
static void
-hash_update(VALUE hash, VALUE key)
+no_new_key(void)
{
- if (RHASH(hash)->iter_lev > 0 && !st_lookup(RHASH(hash)->ntbl, key, 0)) {
- rb_raise(rb_eRuntimeError, "can't add a new key into hash during iteration");
- }
+ rb_raise(rb_eRuntimeError, "can't add a new key into hash during iteration");
}
+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, (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); \
+}
+
+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) OBJ_WRITTEN(hash, arg.old_key, arg.new_key);
+ if (arg.new_value) 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(hash, key, func, arg) \
+ RHASH_UPDATE_ITER(hash, RHASH_ITER_LEV(hash), key, func, arg)
+
static void
default_proc_arity_check(VALUE proc)
{
@@ -331,17 +441,15 @@ rb_hash_initialize(int argc, VALUE *argv, VALUE hash)
rb_hash_modify(hash);
if (rb_block_given_p()) {
- if (argc > 0) {
- rb_raise(rb_eArgError, "wrong number of arguments");
- }
+ 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;
+ RHASH_SET_IFNONE(hash, ifnone);
}
return hash;
@@ -353,11 +461,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}
@@ -386,15 +497,31 @@ rb_hash_s_create(int argc, VALUE *argv, VALUE klass)
hash = hash_alloc(klass);
for (i = 0; i < RARRAY_LEN(tmp); ++i) {
- VALUE v = rb_check_array_type(RARRAY_PTR(tmp)[i]);
+ VALUE e = RARRAY_AREF(tmp, i);
+ VALUE v = rb_check_array_type(e);
VALUE key, val = Qnil;
- if (NIL_P(v)) continue;
+ if (NIL_P(v)) {
+#if 0 /* refix in the next release */
+ rb_raise(rb_eArgError, "wrong element type %s at %ld (expected array)",
+ rb_builtin_class_name(e), i);
+
+#else
+ rb_warn("wrong element type %s at %ld (expected array)",
+ rb_builtin_class_name(e), i);
+ rb_warn("ignoring wrong elements is deprecated, remove them explicitly");
+ rb_warn("this causes ArgumentError in the next release");
+ continue;
+#endif
+ }
switch (RARRAY_LEN(v)) {
+ default:
+ 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);
}
}
@@ -447,7 +574,7 @@ rb_hash_rehash_i(VALUE key, VALUE value, VALUE arg)
{
st_table *tbl = (st_table *)arg;
- if (key != Qundef) st_insert(tbl, key, value);
+ st_insert(tbl, (st_data_t)key, (st_data_t)value);
return ST_CONTINUE;
}
@@ -476,7 +603,7 @@ rb_hash_rehash(VALUE hash)
{
st_table *tbl;
- if (RHASH(hash)->iter_lev > 0) {
+ if (RHASH_ITER_LEV(hash) > 0) {
rb_raise(rb_eRuntimeError, "rehash during iteration");
}
rb_hash_modify_check(hash);
@@ -490,6 +617,20 @@ rb_hash_rehash(VALUE hash)
return hash;
}
+static VALUE
+hash_default_value(VALUE hash, VALUE key)
+{
+ if (rb_method_basic_definition_p(CLASS_OF(hash), id_default)) {
+ VALUE ifnone = RHASH_IFNONE(hash);
+ if (!FL_TEST(hash, HASH_PROC_DEFAULT)) return ifnone;
+ if (key == Qundef) return Qnil;
+ return rb_funcall(ifnone, id_yield, 2, hash, key);
+ }
+ else {
+ return rb_funcall(hash, id_default, 1, key);
+ }
+}
+
/*
* call-seq:
* hsh[key] -> value
@@ -510,13 +651,7 @@ rb_hash_aref(VALUE hash, VALUE key)
st_data_t val;
if (!RHASH(hash)->ntbl || !st_lookup(RHASH(hash)->ntbl, key, &val)) {
- if (!FL_TEST(hash, HASH_PROC_DEFAULT) &&
- rb_method_basic_definition_p(CLASS_OF(hash), id_default)) {
- return RHASH_IFNONE(hash);
- }
- else {
- return rb_funcall(hash, id_default, 1, key);
- }
+ return hash_default_value(hash, key);
}
return (VALUE)val;
}
@@ -588,7 +723,7 @@ 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;
}
@@ -659,8 +794,8 @@ rb_hash_default(int argc, VALUE *argv, VALUE hash)
static VALUE
rb_hash_set_default(VALUE hash, VALUE ifnone)
{
- rb_hash_modify(hash);
- RHASH_IFNONE(hash) = ifnone;
+ rb_hash_modify_check(hash);
+ RHASH_SET_IFNONE(hash, ifnone);
FL_UNSET(hash, HASH_PROC_DEFAULT);
return ifnone;
}
@@ -691,9 +826,9 @@ rb_hash_default_proc(VALUE hash)
/*
* call-seq:
- * hsh.default_proc = proc_obj -> proc_obj
+ * hsh.default_proc = proc_obj or nil
*
- * Sets the default proc to be executed on each key lookup.
+ * Sets the default proc to be executed on each failed key lookup.
*
* h.default_proc = proc do |hash, key|
* hash[key] = key + key
@@ -707,7 +842,12 @@ rb_hash_set_default_proc(VALUE hash, VALUE proc)
{
VALUE b;
- rb_hash_modify(hash);
+ rb_hash_modify_check(hash);
+ if (NIL_P(proc)) {
+ FL_UNSET(hash, HASH_PROC_DEFAULT);
+ RHASH_SET_IFNONE(hash, proc);
+ return proc;
+ }
b = rb_check_convert_type(proc, T_DATA, "Proc", "to_proc");
if (NIL_P(b) || !rb_obj_is_proc(b)) {
rb_raise(rb_eTypeError,
@@ -716,7 +856,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;
}
@@ -775,8 +915,8 @@ rb_hash_delete_key(VALUE hash, VALUE key)
if (!RHASH(hash)->ntbl)
return Qundef;
- if (RHASH(hash)->iter_lev > 0) {
- if (st_delete_safe(RHASH(hash)->ntbl, &ktmp, &val, Qundef)) {
+ if (RHASH_ITER_LEV(hash) > 0) {
+ if (st_delete_safe(RHASH(hash)->ntbl, &ktmp, &val, (st_data_t)Qundef)) {
FL_SET(hash, HASH_DELETED);
return (VALUE)val;
}
@@ -791,8 +931,8 @@ rb_hash_delete_key(VALUE hash, VALUE key)
* hsh.delete(key) -> value
* hsh.delete(key) {| key | block } -> value
*
- * Deletes and returns a key-value pair from <i>hsh</i> whose key is
- * equal to <i>key</i>. If the key is not found, returns the
+ * Deletes the key-value pair and returns the value from <i>hsh</i> whose
+ * key is equal to <i>key</i>. If the key is not found, returns the
* <em>default value</em>. If the optional code block is given and the
* key is not found, pass in the key and return the result of
* <i>block</i>.
@@ -809,7 +949,7 @@ rb_hash_delete(VALUE hash, VALUE key)
{
VALUE val;
- rb_hash_modify(hash);
+ rb_hash_modify_check(hash);
val = rb_hash_delete_key(hash, key);
if (val != Qundef) return val;
if (rb_block_given_p()) {
@@ -828,7 +968,6 @@ shift_i_safe(VALUE key, VALUE value, VALUE arg)
{
struct shift_var *var = (struct shift_var *)arg;
- if (key == Qundef) return ST_CONTINUE;
var->key = key;
var->val = value;
return ST_STOP;
@@ -852,39 +991,42 @@ rb_hash_shift(VALUE hash)
{
struct shift_var var;
- rb_hash_modify(hash);
- var.key = Qundef;
- if (RHASH(hash)->iter_lev == 0) {
- if (st_shift(RHASH(hash)->ntbl, &var.key, &var.val)) {
- return rb_assoc_new(var.key, var.val);
+ rb_hash_modify_check(hash);
+ if (RHASH(hash)->ntbl) {
+ var.key = Qundef;
+ 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);
+ 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);
+ }
}
}
- if (FL_TEST(hash, HASH_PROC_DEFAULT)) {
- return rb_funcall(RHASH_IFNONE(hash), id_yield, 2, hash, Qnil);
- }
- else {
- return RHASH_IFNONE(hash);
- }
+ return hash_default_value(hash, Qnil);
}
static int
delete_if_i(VALUE key, VALUE value, VALUE hash)
{
- if (key == Qundef) return ST_CONTINUE;
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:
* hsh.delete_if {| key, value | block } -> hsh
@@ -903,9 +1045,10 @@ delete_if_i(VALUE key, VALUE value, VALUE hash)
VALUE
rb_hash_delete_if(VALUE hash)
{
- RETURN_ENUMERATOR(hash, 0, 0);
- rb_hash_modify(hash);
- rb_hash_foreach(hash, delete_if_i, hash);
+ 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);
return hash;
}
@@ -923,11 +1066,10 @@ rb_hash_reject_bang(VALUE hash)
{
st_index_t n;
- RETURN_ENUMERATOR(hash, 0, 0);
+ 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;
@@ -976,7 +1118,6 @@ rb_hash_values_at(int argc, VALUE *argv, VALUE hash)
static int
select_i(VALUE key, VALUE value, VALUE result)
{
- if (key == Qundef) return ST_CONTINUE;
if (RTEST(rb_yield_values(2, key, value)))
rb_hash_aset(result, key, value);
return ST_CONTINUE;
@@ -1001,7 +1142,7 @@ rb_hash_select(VALUE hash)
{
VALUE result;
- RETURN_ENUMERATOR(hash, 0, 0);
+ RETURN_SIZED_ENUMERATOR(hash, 0, 0, hash_enum_size);
result = rb_hash_new();
rb_hash_foreach(hash, select_i, result);
return result;
@@ -1010,7 +1151,6 @@ rb_hash_select(VALUE hash)
static int
keep_if_i(VALUE key, VALUE value, VALUE hash)
{
- if (key == Qundef) return ST_CONTINUE;
if (!RTEST(rb_yield_values(2, key, value))) {
return ST_DELETE;
}
@@ -1031,8 +1171,8 @@ rb_hash_select_bang(VALUE hash)
{
st_index_t n;
- RETURN_ENUMERATOR(hash, 0, 0);
- rb_hash_modify(hash);
+ RETURN_SIZED_ENUMERATOR(hash, 0, 0, hash_enum_size);
+ rb_hash_modify_check(hash);
if (!RHASH(hash)->ntbl)
return Qnil;
n = RHASH(hash)->ntbl->num_entries;
@@ -1056,9 +1196,10 @@ rb_hash_select_bang(VALUE hash)
VALUE
rb_hash_keep_if(VALUE hash)
{
- RETURN_ENUMERATOR(hash, 0, 0);
- rb_hash_modify(hash);
- rb_hash_foreach(hash, keep_if_i, hash);
+ 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);
return hash;
}
@@ -1079,14 +1220,14 @@ clear_i(VALUE key, VALUE value, VALUE dummy)
*
*/
-static VALUE
+VALUE
rb_hash_clear(VALUE hash)
{
rb_hash_modify_check(hash);
if (!RHASH(hash)->ntbl)
return hash;
if (RHASH(hash)->ntbl->num_entries > 0) {
- if (RHASH(hash)->iter_lev > 0)
+ if (RHASH_ITER_LEV(hash) > 0)
rb_hash_foreach(hash, clear_i, 0);
else
st_clear(RHASH(hash)->ntbl);
@@ -1095,40 +1236,75 @@ rb_hash_clear(VALUE hash)
return hash;
}
-static st_data_t
-copy_str_key(st_data_t str)
+static int
+hash_aset(st_data_t *key, st_data_t *val, struct update_arg *arg, int existing)
{
- return (st_data_t)rb_str_new4((VALUE)str);
+ 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, struct update_arg *arg, int existing)
+{
+ if (!existing) {
+ *key = rb_str_new_frozen((VALUE)*key);
+ }
+ return hash_aset(key, val, arg, existing);
}
+NOINSERT_UPDATE_CALLBACK(hash_aset);
+NOINSERT_UPDATE_CALLBACK(hash_aset_str);
+
/*
* call-seq:
* hsh[key] = value -> value
* hsh.store(key, value) -> value
*
- * Element Assignment---Associates the value given by
- * <i>value</i> with the key given by <i>key</i>.
- * <i>key</i> should not have its value changed while it is in
- * use as a key (a <code>String</code> passed as a key will be
- * duplicated and frozen).
+ * == Element Assignment
+ *
+ * Associates the value given by +value+ with the key given by +key+.
*
* h = { "a" => 100, "b" => 200 }
* h["a"] = 9
* h["c"] = 4
* h #=> {"a"=>9, "b"=>200, "c"=>4}
+ * h.store("d", 42) #=> {"a"=>9, "b"=>200, "c"=>4, "d"=>42}
+ *
+ * +key+ should not have its value changed while it is in use as a key (an
+ * <tt>unfrozen String</tt> passed as a key will be duplicated and frozen).
+ *
+ * a = "a"
+ * b = "b".freeze
+ * h = { a => 100, b => 200 }
+ * h.key(100).equal? a #=> false
+ * h.key(200).equal? b #=> true
*
*/
VALUE
rb_hash_aset(VALUE hash, VALUE key, VALUE val)
{
+ int iter_lev = RHASH_ITER_LEV(hash);
+ st_table *tbl = RHASH(hash)->ntbl;
+
rb_hash_modify(hash);
- hash_update(hash, key);
- if (RHASH(hash)->ntbl->type == &identhash || rb_obj_class(key) != rb_cString) {
- st_insert(RHASH(hash)->ntbl, key, val);
+ if (!tbl) {
+ if (iter_lev > 0) no_new_key();
+ tbl = hash_tbl(hash);
+ }
+ if (tbl->type == &identhash || rb_obj_class(key) != rb_cString) {
+ RHASH_UPDATE_ITER(hash, iter_lev, key, hash_aset, val);
}
else {
- st_insert2(RHASH(hash)->ntbl, key, val, copy_str_key);
+ RHASH_UPDATE_ITER(hash, iter_lev, key, hash_aset_str, val);
}
return val;
}
@@ -1136,13 +1312,44 @@ rb_hash_aset(VALUE hash, VALUE key, VALUE val)
static int
replace_i(VALUE key, VALUE val, VALUE hash)
{
- if (key != Qundef) {
- rb_hash_aset(hash, key, val);
- }
+ rb_hash_aset(hash, key, val);
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);
+
+ ntbl = RHASH(hash)->ntbl;
+ if (RHASH(hash2)->ntbl) {
+ if (ntbl) st_free_table(ntbl);
+ RHASH(hash)->ntbl = st_copy(RHASH(hash2)->ntbl);
+ if (RHASH(hash)->ntbl->num_entries)
+ rb_hash_rehash(hash);
+ }
+ else if (ntbl) {
+ st_clear(ntbl);
+ }
+
+ if (FL_TEST(hash2, HASH_PROC_DEFAULT)) {
+ FL_SET(hash, HASH_PROC_DEFAULT);
+ }
+ else {
+ FL_UNSET(hash, HASH_PROC_DEFAULT);
+ }
+ RHASH_SET_IFNONE(hash, RHASH_IFNONE(hash2));
+
+ return hash;
+}
+
/*
* call-seq:
* hsh.replace(other_hash) -> hsh
@@ -1158,21 +1365,35 @@ replace_i(VALUE key, VALUE val, VALUE hash)
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
+ FL_UNSET(hash, HASH_PROC_DEFAULT);
+
+ table2 = RHASH(hash2)->ntbl;
+
+ if (RHASH_EMPTY_P(hash2)) {
+ rb_hash_clear(hash);
+ if (table2) hash_tbl(hash)->type = table2->type;
+ return hash;
+ }
+
+ if (RHASH_ITER_LEV(hash) > 0) {
+ rb_hash_clear(hash);
+ hash_tbl(hash)->type = table2->type;
+ rb_hash_foreach(hash2, replace_i, hash);
}
else {
- FL_UNSET(hash, HASH_PROC_DEFAULT);
+ st_table *old_table = RHASH(hash)->ntbl;
+ if (old_table) st_free_table(old_table);
+ RHASH(hash)->ntbl = st_copy(table2);
}
return hash;
@@ -1194,9 +1415,7 @@ rb_hash_replace(VALUE hash, VALUE hash2)
static 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));
}
@@ -1219,7 +1438,6 @@ rb_hash_empty_p(VALUE hash)
static int
each_value_i(VALUE key, VALUE value)
{
- if (key == Qundef) return ST_CONTINUE;
rb_yield(value);
return ST_CONTINUE;
}
@@ -1246,7 +1464,7 @@ each_value_i(VALUE key, VALUE value)
static VALUE
rb_hash_each_value(VALUE hash)
{
- RETURN_ENUMERATOR(hash, 0, 0);
+ RETURN_SIZED_ENUMERATOR(hash, 0, 0, hash_enum_size);
rb_hash_foreach(hash, each_value_i, 0);
return hash;
}
@@ -1254,7 +1472,6 @@ rb_hash_each_value(VALUE hash)
static int
each_key_i(VALUE key, VALUE value)
{
- if (key == Qundef) return ST_CONTINUE;
rb_yield(key);
return ST_CONTINUE;
}
@@ -1280,7 +1497,7 @@ each_key_i(VALUE key, VALUE value)
static VALUE
rb_hash_each_key(VALUE hash)
{
- RETURN_ENUMERATOR(hash, 0, 0);
+ RETURN_SIZED_ENUMERATOR(hash, 0, 0, hash_enum_size);
rb_hash_foreach(hash, each_key_i, 0);
return hash;
}
@@ -1288,11 +1505,17 @@ rb_hash_each_key(VALUE hash)
static int
each_pair_i(VALUE key, VALUE value)
{
- if (key == Qundef) return ST_CONTINUE;
rb_yield(rb_assoc_new(key, 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
@@ -1318,15 +1541,17 @@ each_pair_i(VALUE key, VALUE value)
static VALUE
rb_hash_each_pair(VALUE hash)
{
- RETURN_ENUMERATOR(hash, 0, 0);
- 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;
}
static int
to_a_i(VALUE key, VALUE value, VALUE ary)
{
- if (key == Qundef) return ST_CONTINUE;
rb_ary_push(ary, rb_assoc_new(key, value));
return ST_CONTINUE;
}
@@ -1359,17 +1584,16 @@ inspect_i(VALUE key, VALUE value, VALUE str)
{
VALUE str2;
- if (key == Qundef) return ST_CONTINUE;
str2 = rb_inspect(key);
if (RSTRING_LEN(str) > 1) {
- rb_str_cat2(str, ", ");
+ rb_str_buf_cat_ascii(str, ", ");
}
else {
rb_enc_copy(str, str2);
}
rb_str_buf_append(str, str2);
OBJ_INFECT(str, str2);
- rb_str_buf_cat2(str, "=>");
+ rb_str_buf_cat_ascii(str, "=>");
str2 = rb_inspect(value);
rb_str_buf_append(str, str2);
OBJ_INFECT(str, str2);
@@ -1423,10 +1647,33 @@ rb_hash_to_hash(VALUE hash)
return hash;
}
+/*
+ * call-seq:
+ * hsh.to_h -> hsh or new_hash
+ *
+ * Returns +self+. If called on a subclass of Hash, converts
+ * the receiver to a Hash object.
+ */
+
+static VALUE
+rb_hash_to_h(VALUE hash)
+{
+ if (rb_obj_class(hash) != rb_cHash) {
+ VALUE ret = rb_hash_new();
+ if (!RHASH_EMPTY_P(hash))
+ RHASH(ret)->ntbl = st_copy(RHASH(hash)->ntbl);
+ if (FL_TEST(hash, HASH_PROC_DEFAULT)) {
+ FL_SET(ret, HASH_PROC_DEFAULT);
+ }
+ RHASH_SET_IFNONE(ret, RHASH_IFNONE(hash));
+ return ret;
+ }
+ return hash;
+}
+
static int
keys_i(VALUE key, VALUE value, VALUE ary)
{
- if (key == Qundef) return ST_CONTINUE;
rb_ary_push(ary, key);
return ST_CONTINUE;
}
@@ -1443,12 +1690,12 @@ keys_i(VALUE key, VALUE value, VALUE ary)
*
*/
-static VALUE
+VALUE
rb_hash_keys(VALUE hash)
{
VALUE ary;
- ary = rb_ary_new();
+ ary = rb_ary_new_capa(RHASH_SIZE(hash));
rb_hash_foreach(hash, keys_i, ary);
return ary;
@@ -1457,7 +1704,6 @@ rb_hash_keys(VALUE hash)
static int
values_i(VALUE key, VALUE value, VALUE ary)
{
- if (key == Qundef) return ST_CONTINUE;
rb_ary_push(ary, value);
return ST_CONTINUE;
}
@@ -1474,12 +1720,12 @@ values_i(VALUE key, VALUE value, VALUE ary)
*
*/
-static VALUE
+VALUE
rb_hash_values(VALUE hash)
{
VALUE ary;
- ary = rb_ary_new();
+ ary = rb_ary_new_capa(RHASH_SIZE(hash));
rb_hash_foreach(hash, values_i, ary);
return ary;
@@ -1516,7 +1762,6 @@ rb_hash_search_value(VALUE key, VALUE value, VALUE arg)
{
VALUE *data = (VALUE *)arg;
- if (key == Qundef) return ST_CONTINUE;
if (rb_equal(value, data[1])) {
data[0] = Qtrue;
return ST_STOP;
@@ -1560,7 +1805,6 @@ eql_i(VALUE key, VALUE val1, VALUE arg)
struct equal_data *data = (struct equal_data *)arg;
st_data_t val2;
- if (key == Qundef) return ST_CONTINUE;
if (!st_lookup(data->tbl, key, &val2)) {
data->result = Qfalse;
return ST_STOP;
@@ -1591,7 +1835,7 @@ hash_equal(VALUE hash1, VALUE hash2, int eql)
struct equal_data data;
if (hash1 == hash2) return Qtrue;
- if (TYPE(hash2) != T_HASH) {
+ if (!RB_TYPE_P(hash2, T_HASH)) {
if (!rb_respond_to(hash2, rb_intern("to_hash"))) {
return Qfalse;
}
@@ -1662,7 +1906,6 @@ hash_i(VALUE key, VALUE val, VALUE arg)
st_index_t *hval = (st_index_t *)arg;
st_index_t hdata[2];
- if (key == Qundef) return ST_CONTINUE;
hdata[0] = rb_hash(key);
hdata[1] = rb_hash(val);
*hval ^= st_hash(hdata, sizeof(hdata), 0);
@@ -1672,12 +1915,9 @@ hash_i(VALUE key, VALUE val, VALUE arg)
static VALUE
recursive_hash(VALUE hash, VALUE dummy, int recur)
{
- st_index_t hval;
+ st_index_t hval = RHASH_SIZE(hash);
- if (!RHASH(hash)->ntbl)
- return LONG2FIX(0);
- hval = RHASH(hash)->ntbl->num_entries;
- if (!hval) return LONG2FIX(0);
+ if (!hval) return INT2FIX(0);
if (recur)
hval = rb_hash_uint(rb_hash_start(rb_hash(rb_cHash)), hval);
else
@@ -1703,7 +1943,6 @@ rb_hash_hash(VALUE hash)
static int
rb_hash_invert_i(VALUE key, VALUE value, VALUE hash)
{
- if (key == Qundef) return ST_CONTINUE;
rb_hash_aset(hash, value, key);
return ST_CONTINUE;
}
@@ -1730,23 +1969,53 @@ rb_hash_invert(VALUE hash)
}
static int
+rb_hash_update_callback(st_data_t *key, st_data_t *value, struct update_arg *arg, int existing)
+{
+ 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;
+}
+
+NOINSERT_UPDATE_CALLBACK(rb_hash_update_callback);
+
+static int
rb_hash_update_i(VALUE key, VALUE value, VALUE hash)
{
- if (key == Qundef) return ST_CONTINUE;
- hash_update(hash, key);
- st_insert(RHASH(hash)->ntbl, key, value);
+ RHASH_UPDATE(hash, key, rb_hash_update_callback, value);
return ST_CONTINUE;
}
static int
-rb_hash_update_block_i(VALUE key, VALUE value, VALUE hash)
+rb_hash_update_block_callback(st_data_t *key, st_data_t *value, struct update_arg *arg, int existing)
{
- if (key == Qundef) return ST_CONTINUE;
- if (rb_hash_has_key(hash, key)) {
- value = rb_yield_values(3, key, rb_hash_aref(hash, key), value);
+ 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;
}
- hash_update(hash, key);
- st_insert(RHASH(hash)->ntbl, key, value);
+ *value = newvalue;
+ return ST_CONTINUE;
+}
+
+NOINSERT_UPDATE_CALLBACK(rb_hash_update_block_callback);
+
+static int
+rb_hash_update_block_i(VALUE key, VALUE value, VALUE hash)
+{
+ RHASH_UPDATE(hash, key, rb_hash_update_block_callback, value);
return ST_CONTINUE;
}
@@ -1757,11 +2026,11 @@ rb_hash_update_block_i(VALUE key, VALUE value, VALUE hash)
* hsh.merge!(other_hash){|key, oldval, newval| block} -> hsh
* hsh.update(other_hash){|key, oldval, newval| block} -> hsh
*
- * Adds the contents of <i>other_hash</i> to <i>hsh</i>. If no
- * block is specified, entries with duplicate keys are overwritten
- * with the values from <i>other_hash</i>, otherwise the value
- * of each duplicate key is determined by calling the block with
- * the key, its value in <i>hsh</i> and its value in <i>other_hash</i>.
+ * Adds the contents of _other_hash_ to _hsh_. If no block is specified,
+ * entries with duplicate keys are overwritten with the values from
+ * _other_hash_, otherwise the value of each duplicate key is determined by
+ * calling the block with the key, its value in _hsh_ and its value in
+ * _other_hash_.
*
* h1 = { "a" => 100, "b" => 200 }
* h2 = { "b" => 254, "c" => 300 }
@@ -1787,23 +2056,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, struct update_arg *arg, int existing)
+{
+ struct update_func_arg *uf_arg = (struct update_func_arg *)arg->arg;
+ VALUE newvalue = uf_arg->value;
+
+ if (existing) {
+ 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 = newvalue;
+ return ST_CONTINUE;
+}
+
+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;
- if (key == Qundef) return ST_CONTINUE;
- if (rb_hash_has_key(hash, key)) {
- value = (*arg->func)(key, rb_hash_aref(hash, key), value);
- }
- hash_update(hash, key);
- st_insert(RHASH(hash)->ntbl, key, value);
+ arg->value = value;
+ RHASH_UPDATE(hash, key, rb_hash_update_func_callback, (VALUE)arg);
return ST_CONTINUE;
}
@@ -1813,7 +2100,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);
@@ -1851,11 +2138,36 @@ 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;
- if (key == Qundef) return ST_CONTINUE;
if (RTEST(rb_equal(args[0], key))) {
args[1] = rb_assoc_new(key, val);
return ST_STOP;
@@ -1878,11 +2190,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];
@@ -1893,7 +2227,6 @@ rassoc_i(VALUE key, VALUE val, VALUE arg)
{
VALUE *args = (VALUE *)arg;
- if (key == Qundef) return ST_CONTINUE;
if (RTEST(rb_equal(args[0], val))) {
args[1] = rb_assoc_new(key, val);
return ST_STOP;
@@ -1925,6 +2258,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
@@ -1944,18 +2289,22 @@ 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;
+ ary = rb_ary_new_capa(RHASH_SIZE(hash) * 2);
+ rb_hash_foreach(hash, flatten_i, ary);
+ if (argc) {
+ int level = NUM2INT(*argv) - 1;
+ if (level > 0) {
+ *argv = INT2FIX(level);
+ rb_funcall2(ary, rb_intern("flatten!"), argc, argv);
+ }
}
- 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
@@ -1975,6 +2324,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);
@@ -2010,6 +2360,8 @@ static char **origenviron;
static char **my_environ;
#undef environ
#define environ my_environ
+#undef getenv
+#define getenv(n) rb_w32_ugetenv(n)
#elif defined(__APPLE__)
#undef environ
#define environ (*_NSGetEnviron())
@@ -2031,7 +2383,11 @@ extern char **environ;
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());
+#else
VALUE str = rb_locale_str_new(ptr, len);
+#endif
rb_obj_freeze(str);
return str;
@@ -2049,7 +2405,6 @@ env_delete(VALUE obj, VALUE name)
{
char *nam, *val;
- rb_secure(4);
SafeStringValue(name);
nam = RSTRING_PTR(name);
if (memchr(nam, '\0', RSTRING_LEN(name))) {
@@ -2101,7 +2456,6 @@ rb_f_getenv(VALUE obj, VALUE name)
{
char *nam, *env;
- rb_secure(4);
SafeStringValue(name);
nam = RSTRING_PTR(name);
if (memchr(nam, '\0', RSTRING_LEN(name))) {
@@ -2110,7 +2464,11 @@ rb_f_getenv(VALUE obj, VALUE 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;
@@ -2141,7 +2499,6 @@ env_fetch(int argc, VALUE *argv)
long block_given;
char *nam, *env;
- rb_secure(4);
rb_scan_args(argc, argv, "11", &key, &if_none);
block_given = rb_block_given_p();
if (block_given && argc == 2) {
@@ -2156,12 +2513,16 @@ env_fetch(int argc, VALUE *argv)
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;
}
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_str_new2(env);
}
@@ -2190,7 +2551,7 @@ rb_env_path_tainted(void)
}
#if defined(_WIN32) || (defined(HAVE_SETENV) && defined(HAVE_UNSETENV))
-#elif defined __sun__
+#elif defined __sun
static int
in_origenv(const char *str)
{
@@ -2232,17 +2593,32 @@ getenvblocksize()
}
#endif
+#if !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();
if (!p) goto fail; /* never happen */
@@ -2263,28 +2639,29 @@ 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__
+#elif defined __sun
size_t len;
char **env_ptr, *str;
- if (strchr(name, '=')) {
- errno = EINVAL;
- rb_sys_fail("ruby_setenv");
- }
+
len = strlen(name);
for (env_ptr = GET_ENVIRON(environ); (str = *env_ptr) != 0; ++env_ptr) {
if (!strncmp(str, name, len) && str[len] == '=') {
@@ -2297,15 +2674,12 @@ ruby_setenv(const char *name, const char *value)
str = malloc(len += strlen(value) + 2);
snprintf(str, len, "%s=%s", name, value);
if (putenv(str))
- rb_sys_fail("putenv");
+ 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? */
@@ -2364,10 +2738,6 @@ 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;
@@ -2407,7 +2777,6 @@ env_keys(void)
char **env;
VALUE ary;
- rb_secure(4);
ary = rb_ary_new();
env = GET_ENVIRON(environ);
while (*env) {
@@ -2421,6 +2790,22 @@ env_keys(void)
return ary;
}
+static VALUE
+rb_env_size(VALUE ehash, VALUE args, VALUE eobj)
+{
+ char **env;
+ long cnt = 0;
+
+ env = GET_ENVIRON(environ);
+ for (; *env ; ++env) {
+ if (strchr(*env, '=')) {
+ cnt++;
+ }
+ }
+ FREE_ENVIRON(environ);
+ return LONG2FIX(cnt);
+}
+
/*
* call-seq:
* ENV.each_key { |name| } -> Hash
@@ -2436,10 +2821,10 @@ env_each_key(VALUE ehash)
VALUE keys;
long i;
- RETURN_ENUMERATOR(ehash, 0, 0);
- keys = env_keys(); /* rb_secure(4); */
+ RETURN_SIZED_ENUMERATOR(ehash, 0, 0, rb_env_size);
+ 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;
}
@@ -2456,7 +2841,6 @@ env_values(void)
VALUE ary;
char **env;
- rb_secure(4);
ary = rb_ary_new();
env = GET_ENVIRON(environ);
while (*env) {
@@ -2485,10 +2869,10 @@ env_each_value(VALUE ehash)
VALUE values;
long i;
- RETURN_ENUMERATOR(ehash, 0, 0);
- values = env_values(); /* rb_secure(4); */
+ RETURN_SIZED_ENUMERATOR(ehash, 0, 0, rb_env_size);
+ 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;
}
@@ -2511,9 +2895,8 @@ env_each_pair(VALUE ehash)
VALUE ary;
long i;
- RETURN_ENUMERATOR(ehash, 0, 0);
+ RETURN_SIZED_ENUMERATOR(ehash, 0, 0, rb_env_size);
- rb_secure(4);
ary = rb_ary_new();
env = GET_ENVIRON(environ);
while (*env) {
@@ -2526,15 +2909,22 @@ 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;
}
/*
* call-seq:
- * ENV.reject! { |name, value| } -> Hash or nil
+ * ENV.reject! { |name, value| } -> ENV or nil
* ENV.reject! -> Enumerator
*
* Equivalent to ENV#delete_if but returns +nil+ if no changes were made.
@@ -2548,14 +2938,15 @@ env_reject_bang(VALUE ehash)
long i;
int del = 0;
- RETURN_ENUMERATOR(ehash, 0, 0);
- keys = env_keys(); /* rb_secure(4); */
+ RETURN_SIZED_ENUMERATOR(ehash, 0, 0, rb_env_size);
+ 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++;
}
}
@@ -2576,7 +2967,7 @@ env_reject_bang(VALUE ehash)
static VALUE
env_delete_if(VALUE ehash)
{
- RETURN_ENUMERATOR(ehash, 0, 0);
+ RETURN_SIZED_ENUMERATOR(ehash, 0, 0, rb_env_size);
env_reject_bang(ehash);
return envtbl;
}
@@ -2594,7 +2985,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]));
@@ -2617,8 +3007,7 @@ env_select(VALUE ehash)
VALUE result;
char **env;
- RETURN_ENUMERATOR(ehash, 0, 0);
- rb_secure(4);
+ RETURN_SIZED_ENUMERATOR(ehash, 0, 0, rb_env_size);
result = rb_hash_new();
env = GET_ENVIRON(environ);
while (*env) {
@@ -2651,14 +3040,15 @@ env_select_bang(VALUE ehash)
long i;
int del = 0;
- RETURN_ENUMERATOR(ehash, 0, 0);
- keys = env_keys(); /* rb_secure(4); */
+ RETURN_SIZED_ENUMERATOR(ehash, 0, 0, rb_env_size);
+ 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++;
}
}
@@ -2679,7 +3069,7 @@ env_select_bang(VALUE ehash)
static VALUE
env_keep_if(VALUE ehash)
{
- RETURN_ENUMERATOR(ehash, 0, 0);
+ RETURN_SIZED_ENUMERATOR(ehash, 0, 0, rb_env_size);
env_select_bang(ehash);
return envtbl;
}
@@ -2696,11 +3086,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;
@@ -2730,7 +3120,6 @@ env_inspect(void)
char **env;
VALUE str, i;
- rb_secure(4);
str = rb_str_buf_new2("{");
env = GET_ENVIRON(environ);
while (*env) {
@@ -2761,7 +3150,7 @@ env_inspect(void)
*
* Converts the environment variables into an array of names and value arrays.
*
- * ENV.to_a # => [["TERM" => "xterm-color"], ["SHELL" => "/bin/bash"], ...]
+ * ENV.to_a # => [["TERM", "xterm-color"], ["SHELL", "/bin/bash"], ...]
*
*/
static VALUE
@@ -2770,7 +3159,6 @@ env_to_a(void)
char **env;
VALUE ary;
- rb_secure(4);
ary = rb_ary_new();
env = GET_ENVIRON(environ);
while (*env) {
@@ -2811,9 +3199,8 @@ env_size(void)
int i;
char **env;
- rb_secure(4);
env = GET_ENVIRON(environ);
- for(i=0; env[i]; i++)
+ for (i=0; env[i]; i++)
;
FREE_ENVIRON(environ);
return INT2FIX(i);
@@ -2830,7 +3217,6 @@ env_empty_p(void)
{
char **env;
- rb_secure(4);
env = GET_ENVIRON(environ);
if (env[0] == 0) {
FREE_ENVIRON(environ);
@@ -2854,7 +3240,6 @@ env_has_key(VALUE env, VALUE key)
{
char *s;
- rb_secure(4);
s = StringValuePtr(key);
if (memchr(s, '\0', RSTRING_LEN(key)))
rb_raise(rb_eArgError, "bad environment variable name");
@@ -2874,7 +3259,6 @@ env_assoc(VALUE env, VALUE key)
{
char *s, *e;
- rb_secure(4);
s = StringValuePtr(key);
if (memchr(s, '\0', RSTRING_LEN(key)))
rb_raise(rb_eArgError, "bad environment variable name");
@@ -2895,7 +3279,6 @@ env_has_value(VALUE dmy, VALUE obj)
{
char **env;
- rb_secure(4);
obj = rb_check_string_type(obj);
if (NIL_P(obj)) return Qnil;
env = GET_ENVIRON(environ);
@@ -2926,7 +3309,6 @@ env_rassoc(VALUE dmy, VALUE obj)
{
char **env;
- rb_secure(4);
obj = rb_check_string_type(obj);
if (NIL_P(obj)) return Qnil;
env = GET_ENVIRON(environ);
@@ -2959,7 +3341,6 @@ env_key(VALUE dmy, VALUE value)
char **env;
VALUE str;
- rb_secure(4);
StringValue(value);
env = GET_ENVIRON(environ);
while (*env) {
@@ -2993,7 +3374,8 @@ env_index(VALUE dmy, VALUE value)
/*
* call-seq:
- * ENV.to_hash -> Hash
+ * ENV.to_hash -> hash
+ * ENV.to_h -> hash
*
* Creates a hash with a copy of the environment variables.
*
@@ -3004,7 +3386,6 @@ env_to_hash(void)
char **env;
VALUE hash;
- rb_secure(4);
hash = rb_hash_new();
env = GET_ENVIRON(environ);
while (*env) {
@@ -3045,7 +3426,6 @@ env_shift(void)
{
char **env;
- rb_secure(4);
env = GET_ENVIRON(environ);
if (*env) {
char *s = strchr(*env, '=');
@@ -3076,11 +3456,9 @@ env_invert(void)
static int
env_replace_i(VALUE key, VALUE val, VALUE keys)
{
- if (key != Qundef) {
- env_aset(Qnil, key, val);
- if (rb_ary_includes(keys, key)) {
- rb_ary_delete(keys, key);
- }
+ env_aset(Qnil, key, val);
+ if (rb_ary_includes(keys, key)) {
+ rb_ary_delete(keys, key);
}
return ST_CONTINUE;
}
@@ -3098,13 +3476,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;
}
@@ -3112,12 +3490,10 @@ env_replace(VALUE env, VALUE hash)
static int
env_update_i(VALUE key, VALUE val)
{
- if (key != Qundef) {
- if (rb_block_given_p()) {
- val = rb_yield_values(3, key, rb_f_getenv(Qnil, key), val);
- }
- env_aset(Qnil, key, val);
+ if (rb_block_given_p()) {
+ val = rb_yield_values(3, key, rb_f_getenv(Qnil, key), val);
}
+ env_aset(Qnil, key, val);
return ST_CONTINUE;
}
@@ -3134,7 +3510,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);
@@ -3142,15 +3517,116 @@ env_update(VALUE env, VALUE hash)
}
/*
- * A <code>Hash</code> is a collection of key-value pairs. It is
- * similar to an <code>Array</code>, except that indexing is done via
- * arbitrary keys of any object type, not an integer index. Hashes enumerate
- * their values in the order that the corresponding keys were inserted.
+ * A Hash is a dictionary-like collection of unique keys and their values.
+ * Also called associative arrays, they are similar to Arrays, but where an
+ * Array uses integers as its index, a Hash allows you to use any object
+ * type.
+ *
+ * Hashes enumerate their values in the order that the corresponding keys
+ * were inserted.
+ *
+ * A Hash can be easily created by using its implicit form:
+ *
+ * grades = { "Jane Doe" => 10, "Jim Doe" => 6 }
+ *
+ * Hashes allow an alternate syntax form when your keys are always symbols.
+ * Instead of
+ *
+ * options = { :font_size => 10, :font_family => "Arial" }
+ *
+ * You could write it as:
+ *
+ * options = { font_size: 10, font_family: "Arial" }
+ *
+ * Each named key is a symbol you can access in hash:
+ *
+ * options[:font_size] # => 10
+ *
+ * A Hash can also be created through its ::new method:
+ *
+ * grades = Hash.new
+ * grades["Dorothy Doe"] = 9
*
* Hashes have a <em>default value</em> that is returned when accessing
- * keys that do not exist in the hash. By default, that value is
- * <code>nil</code>.
+ * keys that do not exist in the hash. If no default is set +nil+ is used.
+ * You can set the default value by sending it as an argument to Hash.new:
+ *
+ * grades = Hash.new(0)
+ *
+ * Or by using the #default= method:
+ *
+ * grades = {"Timmy Doe" => 8}
+ * grades.default = 0
*
+ * Accessing a value in a Hash requires using its key:
+ *
+ * puts grades["Jane Doe"] # => 0
+ *
+ * === Common Uses
+ *
+ * Hashes are an easy way to represent data structures, such as
+ *
+ * books = {}
+ * books[:matz] = "The Ruby Language"
+ * books[:black] = "The Well-Grounded Rubyist"
+ *
+ * Hashes are also commonly used as a way to have named parameters in
+ * functions. Note that no brackets are used below. If a hash is the last
+ * argument on a method call, no braces are needed, thus creating a really
+ * clean interface:
+ *
+ * Person.create(name: "John Doe", age: 27)
+ *
+ * def self.create(params)
+ * @name = params[:name]
+ * @age = params[:age]
+ * end
+ *
+ * === Hash Keys
+ *
+ * Two objects refer to the same hash key when their <code>hash</code> value
+ * is identical and the two objects are <code>eql?</code> to each other.
+ *
+ * A user-defined class may be used as a hash key if the <code>hash</code>
+ * and <code>eql?</code> methods are overridden to provide meaningful
+ * behavior. By default, separate instances refer to separate hash keys.
+ *
+ * A typical implementation of <code>hash</code> is based on the
+ * object's data while <code>eql?</code> is usually aliased to the overridden
+ * <code>==</code> method:
+ *
+ * class Book
+ * attr_reader :author, :title
+ *
+ * def initialize(author, title)
+ * @author = author
+ * @title = title
+ * end
+ *
+ * def ==(other)
+ * self.class === other and
+ * other.author == @author and
+ * other.title == @title
+ * end
+ *
+ * alias eql? ==
+ *
+ * def hash
+ * @author.hash ^ @title.hash # XOR
+ * end
+ * end
+ *
+ * book1 = Book.new 'matz', 'Ruby in a Nutshell'
+ * book2 = Book.new 'matz', 'Ruby in a Nutshell'
+ *
+ * reviews = {}
+ *
+ * reviews[book1] = 'Great reference!'
+ * reviews[book2] = 'Nice and compact!'
+ *
+ * reviews.length #=> 1
+ *
+ * See also Object#hash and Object#eql?
*/
void
@@ -3167,14 +3643,15 @@ Init_Hash(void)
rb_include_module(rb_cHash, rb_mEnumerable);
- rb_define_alloc_func(rb_cHash, hash_alloc);
+ rb_define_alloc_func(rb_cHash, empty_hash_alloc);
rb_define_singleton_method(rb_cHash, "[]", rb_hash_s_create, -1);
rb_define_singleton_method(rb_cHash, "try_convert", rb_hash_s_try_convert, 1);
rb_define_method(rb_cHash,"initialize", rb_hash_initialize, -1);
- rb_define_method(rb_cHash,"initialize_copy", rb_hash_replace, 1);
+ rb_define_method(rb_cHash,"initialize_copy", rb_hash_initialize_copy, 1);
rb_define_method(rb_cHash,"rehash", rb_hash_rehash, 0);
rb_define_method(rb_cHash,"to_hash", rb_hash_to_hash, 0);
+ rb_define_method(rb_cHash,"to_h", rb_hash_to_h, 0);
rb_define_method(rb_cHash,"to_a", rb_hash_to_a, 0);
rb_define_method(rb_cHash,"inspect", rb_hash_inspect, 0);
rb_define_alias(rb_cHash, "to_s", "inspect");
@@ -3285,6 +3762,7 @@ Init_Hash(void)
rb_define_singleton_method(envtbl,"key?", env_has_key, 1);
rb_define_singleton_method(envtbl,"value?", env_has_value, 1);
rb_define_singleton_method(envtbl,"to_hash", env_to_hash, 0);
+ rb_define_singleton_method(envtbl,"to_h", env_to_hash, 0);
rb_define_singleton_method(envtbl,"assoc", env_assoc, 1);
rb_define_singleton_method(envtbl,"rassoc", env_rassoc, 1);
@@ -3294,4 +3772,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/ia64.s b/ia64.s
index 92415b4e97..1087105585 100644
--- a/ia64.s
+++ b/ia64.s
@@ -5,11 +5,11 @@
//
// void rb_ia64_flushrs(void) { __builtin_ia64_flushrs(); }
// void *rb_ia64_bsp(void) { return __builtin_ia64_bsp(); }
-//
+//
// Note that rb_ia64_flushrs and rb_ia64_bsp works in its own stack frame.
// It's because BSP is updated by br.call/brl.call (not alloc instruction).
// So rb_ia64_flushrs flushes stack frames including caller's one.
-// rb_ia64_bsp returns the address next to caller's register stack frame.
+// rb_ia64_bsp returns the address next to caller's register stack frame.
//
// See also
// Intel Itanium Architecture Software Developer's Manual
diff --git a/id.c b/id.c
deleted file mode 100644
index 95059caaed..0000000000
--- a/id.c
+++ /dev/null
@@ -1,52 +0,0 @@
-/**********************************************************************
-
- id.c -
-
- $Author$
- created at: Thu Jul 12 04:37:51 2007
-
- Copyright (C) 2004-2007 Koichi Sasada
-
-**********************************************************************/
-
-#include "ruby/ruby.h"
-
-#include "id.h"
-
-static void
-Init_id(void)
-{
-#undef rb_intern
-#define rb_intern(str) rb_intern_const(str)
- rb_encoding *enc = rb_usascii_encoding();
-
- REGISTER_SYMID(idNULL, "");
- REGISTER_SYMID(idIFUNC, "<IFUNC>");
- REGISTER_SYMID(idCFUNC, "<CFUNC>");
- REGISTER_SYMID(idRespond_to, "respond_to?");
-
- REGISTER_SYMID(id_core_set_method_alias, "core#set_method_alias");
- REGISTER_SYMID(id_core_set_variable_alias, "core#set_variable_alias");
- REGISTER_SYMID(id_core_undef_method, "core#undef_method");
- REGISTER_SYMID(id_core_define_method, "core#define_method");
- REGISTER_SYMID(id_core_define_singleton_method, "core#define_singleton_method");
- REGISTER_SYMID(id_core_set_postexe, "core#set_postexe");
-
- REGISTER_SYMID(idEach, "each");
- REGISTER_SYMID(idLength, "length");
- REGISTER_SYMID(idSize, "size");
- REGISTER_SYMID(idProc, "proc");
- REGISTER_SYMID(idLambda, "lambda");
- REGISTER_SYMID(idIntern, "intern");
- REGISTER_SYMID(idGets, "gets");
- REGISTER_SYMID(idSucc, "succ");
- REGISTER_SYMID(idMethodMissing, "method_missing");
-#if SUPPORT_JOKE
- REGISTER_SYMID(idBitblt, "bitblt");
- REGISTER_SYMID(idAnswer, "the_answer_to_life_the_universe_and_everything");
-#endif
- REGISTER_SYMID(idSend, "send");
- REGISTER_SYMID(id__send__, "__send__");
- REGISTER_SYMID(idInitialize, "initialize");
- REGISTER_SYMID(idUScore, "_");
-}
diff --git a/include/ruby.h b/include/ruby.h
index 862b1687d4..076b5ce258 100644
--- a/include/ruby.h
+++ b/include/ruby.h
@@ -22,6 +22,7 @@
#define HAVE_RUBY_REGEX_H 1
#define HAVE_RUBY_RUBY_H 1
#define HAVE_RUBY_ST_H 1
+#define HAVE_RUBY_THREAD_H 1
#define HAVE_RUBY_UTIL_H 1
#define HAVE_RUBY_VERSION_H 1
#define HAVE_RUBY_VM_H 1
diff --git a/include/ruby/backward/rubysig.h b/include/ruby/backward/rubysig.h
index f46679ae67..945a09a8c8 100644
--- a/include/ruby/backward/rubysig.h
+++ b/include/ruby/backward/rubysig.h
@@ -27,9 +27,7 @@ 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));
@@ -42,9 +40,7 @@ DEPRECATED(RUBY_EXTERN void rb_thread_blocking_region_end(struct rb_blocking_reg
#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
new file mode 100644
index 0000000000..9bfc9b9a83
--- /dev/null
+++ b/include/ruby/debug.h
@@ -0,0 +1,110 @@
+/**********************************************************************
+
+ ruby/debug.h -
+
+ $Author: ko1 $
+ created at: Tue Nov 20 20:35:08 2012
+
+ Copyright (C) 2012 Yukihiro Matsumoto
+
+**********************************************************************/
+
+#ifndef RB_DEBUG_H
+#define RB_DEBUG_H 1
+
+#if defined(__cplusplus)
+extern "C" {
+#if 0
+} /* satisfy cc-mode */
+#endif
+#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 *);
+
+VALUE rb_debug_inspector_open(rb_debug_inspector_func_t func, void *data);
+VALUE rb_debug_inspector_frame_self_get(const rb_debug_inspector_t *dc, long index);
+VALUE rb_debug_inspector_frame_class_get(const rb_debug_inspector_t *dc, long index);
+VALUE rb_debug_inspector_frame_binding_get(const rb_debug_inspector_t *dc, long index);
+VALUE rb_debug_inspector_frame_iseq_get(const rb_debug_inspector_t *dc, long index);
+VALUE rb_debug_inspector_backtrace_locations(const rb_debug_inspector_t *dc);
+
+/* Old style set_trace_func APIs */
+
+/* duplicated def of include/ruby/ruby.h */
+void rb_add_event_hook(rb_event_hook_func_t func, rb_event_flag_t events, VALUE data);
+int rb_remove_event_hook(rb_event_hook_func_t func);
+
+int rb_remove_event_hook_with_data(rb_event_hook_func_t func, VALUE data);
+void rb_thread_add_event_hook(VALUE thval, rb_event_hook_func_t func, rb_event_flag_t events, VALUE data);
+int rb_thread_remove_event_hook(VALUE thval, rb_event_hook_func_t func);
+int rb_thread_remove_event_hook_with_data(VALUE thval, rb_event_hook_func_t func, VALUE data);
+
+/* TracePoint APIs */
+
+VALUE rb_tracepoint_new(VALUE target_thread_not_supported_yet, rb_event_flag_t events, void (*func)(VALUE, void *), void *data);
+VALUE rb_tracepoint_enable(VALUE tpval);
+VALUE rb_tracepoint_disable(VALUE tpval);
+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);
+VALUE rb_tracearg_method_id(rb_trace_arg_t *trace_arg);
+VALUE rb_tracearg_defined_class(rb_trace_arg_t *trace_arg);
+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 */
+
+typedef enum {
+ RUBY_EVENT_HOOK_FLAG_SAFE = 0x01,
+ RUBY_EVENT_HOOK_FLAG_DELETED = 0x02,
+ RUBY_EVENT_HOOK_FLAG_RAW_ARG = 0x04
+} rb_event_hook_flag_t;
+
+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);
+
+RUBY_SYMBOL_EXPORT_END
+
+#if defined(__cplusplus)
+#if 0
+{ /* satisfy cc-mode */
+#endif
+} /* extern "C" { */
+#endif
+
+#endif /* RUBY_DEBUG_H */
diff --git a/include/ruby/defines.h b/include/ruby/defines.h
index 8fd09716f1..3327e69123 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,49 +143,61 @@ 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"
+#ifndef BDIGIT
+# if defined(HAVE_INT64_T) && defined(HAVE_INT128_T)
+# define BDIGIT uint64_t
+# define SIZEOF_BDIGITS SIZEOF_INT64_T
+# define BDIGIT_DBL uint128_t
+# define BDIGIT_DBL_SIGNED int128_t
+# define PRI_BDIGIT_PREFIX PRI_64_PREFIX
+# elif SIZEOF_INT*2 <= SIZEOF_LONG_LONG
+# define BDIGIT unsigned int
+# define SIZEOF_BDIGITS SIZEOF_INT
+# define BDIGIT_DBL unsigned LONG_LONG
+# define BDIGIT_DBL_SIGNED LONG_LONG
+# define PRI_BDIGIT_PREFIX ""
+# define PRI_BDIGIT_DBL_PREFIX PRI_LL_PREFIX
+# elif SIZEOF_INT*2 <= SIZEOF_LONG
+# define BDIGIT unsigned int
+# define SIZEOF_BDIGITS SIZEOF_INT
+# define BDIGIT_DBL unsigned long
+# define BDIGIT_DBL_SIGNED long
+# define PRI_BDIGIT_PREFIX ""
+# define PRI_BDIGIT_DBL_PREFIX "l"
+# elif SIZEOF_SHORT*2 <= SIZEOF_LONG
+# define BDIGIT unsigned short
+# define SIZEOF_BDIGITS SIZEOF_SHORT
+# define BDIGIT_DBL unsigned long
+# define BDIGIT_DBL_SIGNED long
+# define PRI_BDIGIT_PREFIX "h"
+# define PRI_BDIGIT_DBL_PREFIX "l"
+# else
+# define BDIGIT unsigned short
+# define SIZEOF_BDIGITS (SIZEOF_LONG/2)
+# define BDIGIT_DBL unsigned long
+# define BDIGIT_DBL_SIGNED long
+# define PRI_BDIGIT_PREFIX "h"
+# define PRI_BDIGIT_DBL_PREFIX "l"
+# endif
+#endif
+
+#ifdef PRI_BDIGIT_PREFIX
+# define PRIdBDIGIT PRI_BDIGIT_PREFIX"d"
+# define PRIiBDIGIT PRI_BDIGIT_PREFIX"i"
+# define PRIoBDIGIT PRI_BDIGIT_PREFIX"o"
+# define PRIuBDIGIT PRI_BDIGIT_PREFIX"u"
+# define PRIxBDIGIT PRI_BDIGIT_PREFIX"x"
+# define PRIXBDIGIT PRI_BDIGIT_PREFIX"X"
+#endif
+
+#ifdef PRI_BDIGIT_DBL_PREFIX
+# define PRIdBDIGIT_DBL PRI_BDIGIT_DBL_PREFIX"d"
+# define PRIiBDIGIT_DBL PRI_BDIGIT_DBL_PREFIX"i"
+# define PRIoBDIGIT_DBL PRI_BDIGIT_DBL_PREFIX"o"
+# define PRIuBDIGIT_DBL PRI_BDIGIT_DBL_PREFIX"u"
+# define PRIxBDIGIT_DBL PRI_BDIGIT_DBL_PREFIX"x"
+# define PRIXBDIGIT_DBL PRI_BDIGIT_DBL_PREFIX"X"
+#endif
#ifdef __CYGWIN__
#undef _WIN32
@@ -149,84 +215,12 @@ void xfree(void*);
#endif
#endif
-#ifdef __NeXT__
-/* NextStep, OpenStep, Rhapsody */
-#ifndef S_IRUSR
-#define S_IRUSR 0000400 /* read permission, owner */
-#endif
-#ifndef S_IRGRP
-#define S_IRGRP 0000040 /* read permission, group */
-#endif
-#ifndef S_IROTH
-#define S_IROTH 0000004 /* read permission, other */
-#endif
-#ifndef S_IWUSR
-#define S_IWUSR 0000200 /* write permission, owner */
-#endif
-#ifndef S_IWGRP
-#define S_IWGRP 0000020 /* write permission, group */
-#endif
-#ifndef S_IWOTH
-#define S_IWOTH 0000002 /* write permission, other */
-#endif
-#ifndef S_IXUSR
-#define S_IXUSR 0000100 /* execute/search permission, owner */
-#endif
-#ifndef S_IXGRP
-#define S_IXGRP 0000010 /* execute/search permission, group */
-#endif
-#ifndef S_IXOTH
-#define S_IXOTH 0000001 /* execute/search permission, other */
-#endif
-#ifndef S_IRWXU
-#define S_IRWXU 0000700 /* read, write, execute permissions, owner */
-#endif
-#ifndef S_IRWXG
-#define S_IRWXG 0000070 /* read, write, execute permissions, group */
-#endif
-#ifndef S_IRWXO
-#define S_IRWXO 0000007 /* read, write, execute permissions, other */
-#endif
-#ifndef S_ISBLK
-#define S_ISBLK(mode) (((mode) & (0170000)) == (0060000))
-#endif
-#ifndef S_ISCHR
-#define S_ISCHR(mode) (((mode) & (0170000)) == (0020000))
-#endif
-#ifndef S_ISDIR
-#define S_ISDIR(mode) (((mode) & (0170000)) == (0040000))
-#endif
-#ifndef S_ISFIFO
-#define S_ISFIFO(mode) (((mode) & (0170000)) == (0010000))
-#endif
-#ifndef S_ISREG
-#define S_ISREG(mode) (((mode) & (0170000)) == (0100000))
-#endif
-#ifndef __APPLE__
-/* NextStep, OpenStep (but not Rhapsody) */
-#ifndef GETPGRP_VOID
-#define GETPGRP_VOID 1
-#endif
-#ifndef WNOHANG
-#define WNOHANG 01
-#endif
-#ifndef WUNTRACED
-#define WUNTRACED 02
-#endif
-#ifndef X_OK
-#define X_OK 1
-#endif
-#endif /* __APPLE__ */
-#endif /* NeXT */
-
#ifdef _WIN32
#include "ruby/win32.h"
#endif
#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__
@@ -267,7 +261,7 @@ void xfree(void*);
/* MB_CUR_MAX will not work well in C locale */
#endif
-#if defined(sparc) || defined(__sparc__)
+#if defined(__sparc)
void rb_sparc_flush_register_windows(void);
# define FLUSH_REGISTER_WINDOWS rb_sparc_flush_register_windows()
#elif defined(__ia64)
@@ -320,9 +314,7 @@ void rb_ia64_flushrs(void);
RUBY_ALIAS_FUNCTION_TYPE(VALUE, prot, name, args)
#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/encoding.h b/include/ruby/encoding.h
index cced3d2688..1c5d8da015 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) \
@@ -89,6 +80,7 @@ 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);
@@ -97,6 +89,7 @@ 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);
@@ -111,6 +104,17 @@ 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);
@@ -153,6 +157,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))
@@ -200,9 +207,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);
@@ -217,6 +230,7 @@ char *rb_enc_path_last_separator(const char *,const char *,rb_encoding*);
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);
RUBY_EXTERN VALUE rb_cEncoding;
#define ENC_DUMMY_FLAG (1<<24)
@@ -295,6 +309,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);
@@ -336,9 +351,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 5851f2083b..4ee6b0969b 100644
--- a/include/ruby/intern.h
+++ b/include/ruby/intern.h
@@ -32,39 +32,30 @@ 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
* the kernel.
*/
-#define ID_ALLOCATOR 1
+#define UNLIMITED_ARGUMENTS (-1)
/* array.c */
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_subseq(VALUE, long, long);
void rb_ary_store(VALUE, long, VALUE);
@@ -72,6 +63,7 @@ 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);
@@ -80,6 +72,7 @@ VALUE rb_ary_entry(VALUE, long);
VALUE rb_ary_each(VALUE);
VALUE rb_ary_join(VALUE, VALUE);
VALUE rb_ary_reverse(VALUE);
+VALUE rb_ary_rotate(VALUE, long);
VALUE rb_ary_sort(VALUE);
VALUE rb_ary_sort_bang(VALUE);
VALUE rb_ary_delete(VALUE, VALUE);
@@ -94,6 +87,9 @@ 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_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);
int rb_bigzero_p(VALUE x);
@@ -101,24 +97,18 @@ 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);
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);
+DEPRECATED(VALUE rb_big2str0(VALUE, int, int));
SIGNED_VALUE rb_big2long(VALUE);
#define rb_big2int(x) rb_big2long(x)
VALUE rb_big2ulong(VALUE);
#define rb_big2uint(x) rb_big2ulong(x)
-VALUE rb_big2ulong_pack(VALUE x);
+DEPRECATED(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 */
@@ -145,6 +135,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))
@@ -155,6 +172,8 @@ 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_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))
@@ -180,6 +199,7 @@ VALUE rb_define_class_id_under(VALUE, ID, VALUE);
VALUE rb_module_new(void);
VALUE rb_define_module_id(ID);
VALUE rb_define_module_id_under(VALUE, ID);
+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);
@@ -205,34 +225,49 @@ VALUE rb_fiber_yield(int argc, VALUE *args);
VALUE rb_fiber_current(void);
VALUE rb_fiber_alive_p(VALUE);
/* enum.c */
+VALUE rb_enum_values_pack(int, VALUE*);
/* enumerator.c */
VALUE rb_enumeratorize(VALUE, VALUE, int, VALUE *);
-#define RETURN_ENUMERATOR(obj, argc, argv) do { \
+typedef VALUE rb_enumerator_size_func(VALUE, VALUE, VALUE);
+VALUE rb_enumeratorize_with_size(VALUE, VALUE, int, VALUE *, rb_enumerator_size_func *);
+#ifndef RUBY_EXPORT
+#define rb_enumeratorize_with_size(obj, id, argc, argv, size_fn) \
+ rb_enumeratorize_with_size(obj, id, argc, argv, (rb_enumerator_size_func *)(size_fn))
+#endif
+#define RETURN_SIZED_ENUMERATOR(obj, argc, argv, size_fn) do { \
if (!rb_block_given_p()) \
- return rb_enumeratorize((obj), ID2SYM(rb_frame_this_func()),\
- (argc), (argv)); \
+ return rb_enumeratorize_with_size((obj), ID2SYM(rb_frame_this_func()),\
+ (argc), (argv), (size_fn)); \
} while (0)
+#define RETURN_ENUMERATOR(obj, argc, argv) RETURN_SIZED_ENUMERATOR(obj, argc, argv, 0)
/* error.c */
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);
+PRINTF_ARGS(NORETURN(void rb_name_error_str(VALUE, const char*, ...)), 2, 3);
NORETURN(void rb_invalid_str(const char*, const char*));
PRINTF_ARGS(void rb_compile_error(const char*, int, const char*, ...), 3, 4);
PRINTF_ARGS(void rb_compile_error_with_enc(const char*, int, void *, const char*, ...), 4, 5);
PRINTF_ARGS(void rb_compile_error_append(const char*, ...), 1, 2);
-NORETURN(void rb_load_fail(const char*));
NORETURN(void rb_error_frozen(const char*));
+void rb_error_untrusted(VALUE);
void rb_check_frozen(VALUE);
+void rb_check_trusted(VALUE);
#define rb_check_frozen_internal(obj) do { \
VALUE frozen_obj = (obj); \
if (OBJ_FROZEN(frozen_obj)) { \
rb_error_frozen(rb_obj_classname(frozen_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);})
#else
static inline void
rb_check_frozen_inline(VALUE obj)
@@ -240,12 +275,31 @@ rb_check_frozen_inline(VALUE obj)
rb_check_frozen_internal(obj);
}
#define rb_check_frozen(obj) rb_check_frozen_inline(obj)
+static inline void
+rb_check_trusted_inline(VALUE obj)
+{
+ rb_check_trusted_internal(obj);
+}
+#define rb_check_trusted(obj) rb_check_trusted_inline(obj)
#endif
+void rb_check_copyable(VALUE obj, VALUE orig);
+
+#define OBJ_INIT_COPY(obj, orig) \
+ ((obj) != (orig) && (rb_obj_init_copy((obj), (orig)), 1))
/* 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 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 {
@@ -322,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);
@@ -354,7 +409,7 @@ 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);
@@ -366,20 +421,16 @@ int rb_mod_method_arity(VALUE, ID);
int rb_obj_method_arity(VALUE, ID);
VALUE rb_protect(VALUE (*)(VALUE), VALUE, int*);
void rb_set_end_proc(void (*)(VALUE), VALUE);
-void rb_mark_end_proc(void);
void rb_exec_end_proc(void);
-void ruby_finalize(void);
-NORETURN(void ruby_stop(int));
-int ruby_cleanup(volatile int);
-DEPRECATED(void rb_gc_mark_threads(void));
void rb_thread_schedule(void);
void rb_thread_wait_fd(int);
int rb_thread_fd_writable(int);
void rb_thread_fd_close(int);
int rb_thread_alone(void);
-void rb_thread_polling(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);
@@ -398,6 +449,7 @@ void rb_thread_atfork_before_exec(void);
VALUE rb_exec_recursive(VALUE(*)(VALUE, VALUE, int),VALUE,VALUE);
VALUE rb_exec_recursive_paired(VALUE(*)(VALUE, VALUE, int),VALUE,VALUE,VALUE);
VALUE rb_exec_recursive_outer(VALUE(*)(VALUE, VALUE, int),VALUE,VALUE);
+VALUE rb_exec_recursive_paired_outer(VALUE(*)(VALUE, VALUE, int),VALUE,VALUE,VALUE);
/* dir.c */
VALUE rb_dir_getwd(void);
/* file.c */
@@ -406,8 +458,6 @@ VALUE rb_file_expand_path(VALUE, VALUE);
VALUE rb_file_s_absolute_path(int, VALUE *);
VALUE rb_file_absolute_path(VALUE, VALUE);
VALUE rb_file_dirname(VALUE fname);
-void rb_file_const(const char*, VALUE);
-int rb_file_load_ok(const char *);
int rb_find_file_ext_safe(VALUE*, const char* const*, int);
VALUE rb_find_file_safe(VALUE, int);
int rb_find_file_ext(VALUE*, const char* const*);
@@ -416,10 +466,7 @@ VALUE rb_file_directory_p(VALUE,VALUE);
VALUE rb_str_encode_ospath(VALUE);
int rb_is_absolute_path(const char *);
/* gc.c */
-void ruby_set_stack_size(size_t);
NORETURN(void rb_memerror(void));
-int ruby_stack_check(void);
-size_t ruby_stack_length(VALUE**);
int rb_during_gc(void);
void rb_gc_mark_locations(VALUE*, VALUE*);
void rb_mark_tbl(struct st_table*);
@@ -435,8 +482,10 @@ void rb_gc_call_finalizer_at_exit(void);
VALUE rb_gc_enable(void);
VALUE rb_gc_disable(void);
VALUE rb_gc_start(void);
-#define Init_stack(addr) ruby_init_stack(addr)
-void rb_gc_set_params(void);
+DEPRECATED(void rb_gc_set_params(void));
+VALUE rb_define_finalizer(VALUE, VALUE);
+VALUE rb_undefine_finalizer(VALUE);
+size_t rb_gc_count(void);
/* hash.c */
void st_foreach_safe(struct st_table *, int (*)(ANYARGS), st_data_t);
VALUE rb_check_hash_type(VALUE);
@@ -450,8 +499,10 @@ VALUE rb_hash_lookup(VALUE, VALUE);
VALUE rb_hash_lookup2(VALUE, VALUE, VALUE);
VALUE rb_hash_fetch(VALUE, VALUE);
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);
@@ -489,8 +540,14 @@ void rb_write_error2(const char*, long);
void rb_close_before_exec(int lowfd, int maxhint, VALUE noclose_fds);
int rb_pipe(int *pipes);
int rb_reserved_fd_p(int fd);
+int rb_cloexec_open(const char *pathname, int flags, mode_t mode);
+int rb_cloexec_dup(int oldfd);
+int rb_cloexec_dup2(int oldfd, int newfd);
+int rb_cloexec_pipe(int fildes[2]);
+int rb_cloexec_fcntl_dupfd(int fd, int minfd);
#define RB_RESERVED_FD_P(fd) rb_reserved_fd_p(fd)
void rb_update_max_fd(int fd);
+void rb_fd_fix_cloexec(int fd);
/* marshal.c */
VALUE rb_marshal_dump(VALUE, VALUE);
VALUE rb_marshal_load(VALUE);
@@ -501,7 +558,7 @@ NORETURN(void rb_num_zerodiv(void));
VALUE rb_num_coerce_bin(VALUE, VALUE, ID);
VALUE rb_num_coerce_cmp(VALUE, VALUE, ID);
VALUE rb_num_coerce_relop(VALUE, VALUE, ID);
-VALUE rb_float_new(double);
+VALUE rb_num_coerce_bit(VALUE, VALUE, ID);
VALUE rb_num2fix(VALUE);
VALUE rb_fix2str(VALUE, int);
VALUE rb_dbl_cmp(double, double);
@@ -534,26 +591,28 @@ VALUE rb_check_convert_type(VALUE,int,const char*,const char*);
VALUE rb_check_to_integer(VALUE, const char *);
VALUE rb_check_to_float(VALUE);
VALUE rb_to_int(VALUE);
+VALUE rb_check_to_int(VALUE);
VALUE rb_Integer(VALUE);
VALUE rb_to_float(VALUE);
VALUE rb_Float(VALUE);
VALUE rb_String(VALUE);
VALUE rb_Array(VALUE);
+VALUE rb_Hash(VALUE);
double rb_cstr_to_dbl(const char*, int);
double rb_str_to_dbl(VALUE, int);
/* parse.y */
RUBY_EXTERN int ruby_sourceline;
RUBY_EXTERN char *ruby_sourcefile;
ID rb_id_attrset(ID);
-void rb_gc_mark_parser(void);
int rb_is_const_id(ID);
+int rb_is_global_id(ID);
int rb_is_instance_id(ID);
+int rb_is_attrset_id(ID);
int rb_is_class_id(ID);
int rb_is_local_id(ID);
int rb_is_junk_id(ID);
int rb_symname_p(const char*);
int rb_sym_interned_p(VALUE);
-void rb_gc_mark_symbols(void);
VALUE rb_backref_get(void);
void rb_backref_set(VALUE);
VALUE rb_lastline_get(void);
@@ -563,23 +622,19 @@ VALUE rb_sym_all_symbols(void);
void rb_last_status_set(int status, rb_pid_t pid);
VALUE rb_last_status_get(void);
struct rb_exec_arg {
- int argc;
- VALUE *argv;
- const char *prog;
- VALUE options;
- VALUE redirect_fds;
+ VALUE execarg_obj;
};
-int rb_proc_exec_n(int, VALUE*, const char*);
+DEPRECATED(int rb_proc_exec_n(int, VALUE*, const char*));
int rb_proc_exec(const char*);
-VALUE rb_exec_arg_init(int argc, VALUE *argv, int accept_shell, struct rb_exec_arg *e);
-int rb_exec_arg_addopt(struct rb_exec_arg *e, VALUE key, VALUE val);
-void rb_exec_arg_fixup(struct rb_exec_arg *e);
-int rb_run_exec_options(const struct rb_exec_arg *e, struct rb_exec_arg *s);
-int rb_run_exec_options_err(const struct rb_exec_arg *e, struct rb_exec_arg *s, char*, size_t);
-int rb_exec(const struct rb_exec_arg*);
-int rb_exec_err(const struct rb_exec_arg*, char*, size_t);
-rb_pid_t rb_fork(int*, int (*)(void*), void*, VALUE);
-rb_pid_t rb_fork_err(int*, int (*)(void*, char*, size_t), void*, VALUE, char*, size_t);
+DEPRECATED(VALUE rb_exec_arg_init(int argc, VALUE *argv, int accept_shell, struct rb_exec_arg *e));
+DEPRECATED(int rb_exec_arg_addopt(struct rb_exec_arg *e, VALUE key, VALUE val));
+DEPRECATED(void rb_exec_arg_fixup(struct rb_exec_arg *e));
+DEPRECATED(int rb_run_exec_options(const struct rb_exec_arg *e, struct rb_exec_arg *s));
+DEPRECATED(int rb_run_exec_options_err(const struct rb_exec_arg *e, struct rb_exec_arg *s, char*, size_t));
+DEPRECATED(int rb_exec(const struct rb_exec_arg*));
+DEPRECATED(int rb_exec_err(const struct rb_exec_arg*, char*, size_t));
+DEPRECATED(rb_pid_t rb_fork(int*, int (*)(void*), void*, VALUE));
+DEPRECATED(rb_pid_t rb_fork_err(int*, int (*)(void*, char*, size_t), void*, VALUE, char*, size_t));
VALUE rb_f_exec(int,VALUE*);
rb_pid_t rb_waitpid(rb_pid_t pid, int *status, int flags);
void rb_syswait(rb_pid_t pid);
@@ -599,6 +654,7 @@ VALUE rb_random_bytes(VALUE rnd, long n);
VALUE rb_random_int(VALUE rnd, VALUE max);
unsigned int rb_random_int32(VALUE rnd);
double rb_random_real(VALUE rnd);
+unsigned long rb_random_ulong_limited(VALUE rnd, unsigned long limit);
unsigned long rb_genrand_ulong_limited(unsigned long i);
/* re.c */
#define rb_memcmp memcmp
@@ -624,20 +680,13 @@ int rb_reg_options(VALUE);
RUBY_EXTERN VALUE rb_argv0;
VALUE rb_get_argv(void);
void *rb_load_file(const char*);
-void ruby_script(const char*);
-void ruby_prog_init(void);
-void ruby_set_argv(int, char**);
-void *ruby_process_options(int, char**);
-void ruby_init_loadpath(void);
-void ruby_incpush(const char*);
+void *rb_load_file_str(VALUE);
/* signal.c */
VALUE rb_f_kill(int, VALUE*);
-void rb_gc_mark_trap_list(void);
#ifdef POSIX_SIGNAL
#define posix_signal ruby_posix_signal
RETSIGTYPE (*posix_signal(int, RETSIGTYPE (*)(int)))(int);
#endif
-void ruby_sig_finalize(void);
void rb_trap_exit(void);
void rb_trap_exec(void);
const char *ruby_signal_name(int);
@@ -652,16 +701,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);
@@ -674,7 +718,6 @@ VALUE rb_str_buf_new2(const char*);
VALUE rb_str_tmp_new(long);
VALUE rb_usascii_str_new(const char*, long);
VALUE rb_usascii_str_new_cstr(const char*);
-VALUE rb_usascii_str_new2(const char*);
void rb_str_free(VALUE);
void rb_str_shared_replace(VALUE, VALUE);
VALUE rb_str_buf_append(VALUE, VALUE);
@@ -683,6 +726,7 @@ VALUE rb_str_buf_cat2(VALUE, const char*);
VALUE rb_str_buf_cat_ascii(VALUE, const char*);
VALUE rb_obj_as_string(VALUE);
VALUE rb_check_string_type(VALUE);
+void rb_must_asciicompat(VALUE);
VALUE rb_str_dup(VALUE);
VALUE rb_str_resurrect(VALUE str);
VALUE rb_str_locktmp(VALUE);
@@ -694,6 +738,7 @@ 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);
@@ -732,6 +777,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__ ( \
{ \
@@ -782,11 +828,11 @@ VALUE rb_str_ellipsize(VALUE, long);
rb_str_cat((str), (ptr), (long)strlen(ptr)) : \
rb_str_cat2((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
@@ -799,6 +845,7 @@ VALUE rb_str_ellipsize(VALUE, long);
/* 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);
@@ -809,13 +856,17 @@ 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);
-VALUE rb_thread_blocking_region(rb_blocking_function_t *func, void *data1,
- rb_unblock_function_t *ubf, void *data2);
+
+/* 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);
@@ -825,10 +876,6 @@ VALUE rb_mutex_lock(VALUE mutex);
VALUE rb_mutex_unlock(VALUE mutex);
VALUE rb_mutex_sleep(VALUE self, VALUE timeout);
VALUE rb_mutex_synchronize(VALUE mutex, VALUE (*func)(VALUE arg), VALUE arg);
-VALUE rb_barrier_new(void);
-VALUE rb_barrier_wait(VALUE self);
-VALUE rb_barrier_release(VALUE self);
-VALUE rb_barrier_destroy(VALUE self);
/* time.c */
VALUE rb_time_new(time_t, long);
VALUE rb_time_nano_new(time_t, long);
@@ -848,23 +895,18 @@ VALUE rb_class_name(VALUE);
void rb_autoload(VALUE, ID, const char*);
VALUE rb_autoload_load(VALUE, ID);
VALUE rb_autoload_p(VALUE, ID);
-void rb_gc_mark_global_tbl(void);
VALUE rb_f_trace_var(int, VALUE*);
VALUE rb_f_untrace_var(int, VALUE*);
VALUE rb_f_global_variables(void);
void rb_alias_variable(ID, ID);
struct st_table* rb_generic_ivar_table(VALUE);
void rb_copy_generic_ivar(VALUE,VALUE);
-void rb_mark_generic_ivar(VALUE);
-void rb_mark_generic_ivar_tbl(void);
void rb_free_generic_ivar(VALUE);
VALUE rb_ivar_get(VALUE, ID);
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);
@@ -888,11 +930,8 @@ 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(VALUE);
+VALUE rb_mod_class_variables(int, VALUE*, VALUE);
VALUE rb_mod_remove_cvar(VALUE, VALUE);
-/* version.c */
-void ruby_show_version(void);
-void ruby_show_copyright(void);
ID rb_frame_callee(void);
VALUE rb_str_succ(VALUE);
@@ -902,9 +941,7 @@ int rb_frame_method_id_and_class(ID *idp, VALUE *klassp);
VALUE rb_make_backtrace(void);
VALUE rb_make_exception(int, VALUE*);
-#if defined __GNUC__ && __GNUC__ >= 4
-#pragma GCC visibility pop
-#endif
+RUBY_SYMBOL_EXPORT_END
#if defined(__cplusplus)
#if 0
diff --git a/include/ruby/io.h b/include/ruby/io.h
index cfdfaf1fb7..23337679f0 100644
--- a/include/ruby/io.h
+++ b/include/ruby/io.h
@@ -29,7 +29,17 @@ extern "C" {
#include "ruby/config.h"
#if defined(HAVE_POLL)
+# ifdef _AIX
+# define reqevents events
+# define rtnevents revents
+# endif
# include <poll.h>
+# ifdef _AIX
+# undef reqevents
+# undef rtnevents
+# undef events
+# undef revents
+# endif
# define RB_WAITFD_IN POLLIN
# define RB_WAITFD_PRI POLLPRI
# define RB_WAITFD_OUT POLLOUT
@@ -39,9 +49,7 @@ 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 {
char *ptr; /* off + len <= capa */
@@ -168,6 +176,7 @@ void rb_io_synchronized(rb_io_t*);
void rb_io_check_initialized(rb_io_t*);
void rb_io_check_closed(rb_io_t*);
VALUE rb_io_get_io(VALUE io);
+VALUE rb_io_check_io(VALUE io);
VALUE rb_io_get_write_io(VALUE io);
VALUE rb_io_set_write_io(VALUE io, VALUE w);
int rb_io_wait_readable(int);
@@ -188,9 +197,12 @@ 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 f055104a0e..5dba4edda7 100644
--- a/include/ruby/missing.h
+++ b/include/ruby/missing.h
@@ -20,6 +20,7 @@ extern "C" {
#include "ruby/config.h"
#include <stddef.h>
+#include <math.h> /* for INFINITY and NAN */
#ifdef RUBY_EXTCONF_H
#include RUBY_EXTCONF_H
#endif
@@ -33,6 +34,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 */
@@ -61,9 +67,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);
@@ -122,20 +126,27 @@ RUBY_EXTERN double lgamma_r(double, int *);
RUBY_EXTERN double cbrt(double);
#endif
+#if !defined(INFINITY) || !defined(NAN)
+union bytesequence4_or_float {
+ unsigned char bytesequence[4];
+ float float_value;
+};
+#endif
+
#ifdef INFINITY
# define HAVE_INFINITY
#else
/** @internal */
-RUBY_EXTERN const unsigned char rb_infinity[];
-# define INFINITY (*(float *)rb_infinity)
+RUBY_EXTERN const union bytesequence4_or_float rb_infinity;
+# define INFINITY (rb_infinity.float_value)
#endif
#ifdef NAN
# define HAVE_NAN
#else
/** @internal */
-RUBY_EXTERN const unsigned char rb_nan[];
-# define NAN (*(float *)rb_nan)
+RUBY_EXTERN const union bytesequence4_or_float rb_nan;
+# define NAN (rb_nan.float_value)
#endif
#ifndef isinf
@@ -221,9 +232,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 67773aa482..6a26ee4aaa 100644
--- a/include/ruby/oniguruma.h
+++ b/include/ruby/oniguruma.h
@@ -1,10 +1,11 @@
#ifndef ONIGURUMA_H
#define ONIGURUMA_H
/**********************************************************************
- oniguruma.h - Oniguruma (regular expression library)
+ oniguruma.h - Onigmo (Oniguruma-mod) (regular expression library)
**********************************************************************/
/*-
- * Copyright (c) 2002-2008 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
+ * Copyright (c) 2002-2009 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
+ * Copyright (c) 2011-2013 K.Takata <kentkt AT csc DOT jp>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -38,8 +39,8 @@ extern "C" {
#define ONIGURUMA
#define ONIGURUMA_VERSION_MAJOR 5
-#define ONIGURUMA_VERSION_MINOR 9
-#define ONIGURUMA_VERSION_TEENY 2
+#define ONIGURUMA_VERSION_MINOR 13
+#define ONIGURUMA_VERSION_TEENY 5
#ifdef __cplusplus
# ifndef HAVE_PROTOTYPES
@@ -97,9 +98,9 @@ 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 */
/* PART: character encoding */
@@ -108,9 +109,10 @@ extern "C" {
#endif
typedef unsigned char OnigUChar;
-typedef unsigned int OnigCodePoint;
+typedef unsigned int OnigCodePoint;
typedef unsigned int OnigCtype;
typedef size_t OnigDistance;
+typedef ptrdiff_t OnigPosition;
#define ONIG_INFINITE_DISTANCE ~((OnigDistance )0)
@@ -171,6 +173,7 @@ typedef struct OnigEncodingTypeST {
OnigUChar* (*left_adjust_char_head)(const OnigUChar* start, const OnigUChar* p, const OnigUChar* end, struct OnigEncodingTypeST* enc);
int (*is_allowed_reverse_match)(const OnigUChar* p, const OnigUChar* end, struct OnigEncodingTypeST* enc);
int ruby_encoding_index;
+ unsigned int flags;
} OnigEncodingType;
typedef OnigEncodingType* OnigEncoding;
@@ -204,17 +207,12 @@ ONIG_EXTERN OnigEncodingType OnigEncodingASCII;
#define ONIGENC_CTYPE_ALNUM 13 /* alpha || digit */
#define ONIGENC_CTYPE_ASCII 14
#define ONIGENC_MAX_STD_CTYPE ONIGENC_CTYPE_ASCII
-#define ONIGENC_CTYPE_SPECIAL_MASK 256
-#define ONIGENC_CTYPE_S /* [\t\n\v\f\r\s] */ \
- ONIGENC_CTYPE_SPECIAL_MASK | ONIGENC_CTYPE_SPACE
-#define ONIGENC_CTYPE_D /* [0-9] */ \
- ONIGENC_CTYPE_SPECIAL_MASK | ONIGENC_CTYPE_DIGIT
-#define ONIGENC_CTYPE_W /* [0-9A-Za-z_] */ \
- ONIGENC_CTYPE_SPECIAL_MASK | ONIGENC_CTYPE_WORD
-#define ONIGENC_CTYPE_SPECIAL_P(ctype) ((ctype) & ONIGENC_CTYPE_SPECIAL_MASK)
+/* flags */
+#define ONIGENC_FLAG_NONE 0U
+#define ONIGENC_FLAG_UNICODE 1U
-#define onig_enc_len(enc,p,e) ONIGENC_MBC_ENC_LEN(enc, p, e)
+#define onig_enc_len(enc,p,e) ONIGENC_MBC_ENC_LEN(enc, p, e)
#define ONIGENC_IS_UNDEF(enc) ((enc) == ONIG_ENCODING_UNDEF)
#define ONIGENC_IS_SINGLEBYTE(enc) (ONIGENC_MBC_MAXLEN(enc) == 1)
@@ -223,6 +221,10 @@ ONIG_EXTERN OnigEncodingType OnigEncodingASCII;
#define ONIGENC_IS_CODE_ASCII(code) ((code) < 128)
#define ONIGENC_IS_MBC_WORD(enc,s,end) \
ONIGENC_IS_CODE_WORD(enc,ONIGENC_MBC_TO_CODE(enc,s,end))
+#define ONIGENC_IS_MBC_ASCII_WORD(enc,s,end) \
+ onigenc_ascii_is_code_ctype( \
+ ONIGENC_MBC_TO_CODE(enc,s,end),ONIGENC_CTYPE_WORD,enc)
+#define ONIGENC_IS_UNICODE(enc) ((enc)->flags & ONIGENC_FLAG_UNICODE)
#define ONIGENC_NAME(enc) ((enc)->name)
@@ -350,6 +352,7 @@ typedef unsigned int OnigOptionType;
#define ONIG_OPTION_IGNORECASE 1U
#define ONIG_OPTION_EXTEND (ONIG_OPTION_IGNORECASE << 1)
#define ONIG_OPTION_MULTILINE (ONIG_OPTION_EXTEND << 1)
+#define ONIG_OPTION_DOTALL ONIG_OPTION_MULTILINE
#define ONIG_OPTION_SINGLELINE (ONIG_OPTION_MULTILINE << 1)
#define ONIG_OPTION_FIND_LONGEST (ONIG_OPTION_SINGLELINE << 1)
#define ONIG_OPTION_FIND_NOT_EMPTY (ONIG_OPTION_FIND_LONGEST << 1)
@@ -360,7 +363,13 @@ typedef unsigned int OnigOptionType;
#define ONIG_OPTION_NOTBOL (ONIG_OPTION_CAPTURE_GROUP << 1)
#define ONIG_OPTION_NOTEOL (ONIG_OPTION_NOTBOL << 1)
#define ONIG_OPTION_POSIX_REGION (ONIG_OPTION_NOTEOL << 1)
-#define ONIG_OPTION_MAXBIT ONIG_OPTION_POSIX_REGION /* limit */
+/* options (ctype range) */
+#define ONIG_OPTION_ASCII_RANGE (ONIG_OPTION_POSIX_REGION << 1)
+#define ONIG_OPTION_POSIX_BRACKET_ALL_RANGE (ONIG_OPTION_ASCII_RANGE << 1)
+#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_ON(options,regopt) ((options) |= (regopt))
#define ONIG_OPTION_OFF(options,regopt) ((options) &= ~(regopt))
@@ -382,9 +391,11 @@ ONIG_EXTERN const OnigSyntaxType OnigSyntaxEmacs;
ONIG_EXTERN const OnigSyntaxType OnigSyntaxGrep;
ONIG_EXTERN const OnigSyntaxType OnigSyntaxGnuRegex;
ONIG_EXTERN const OnigSyntaxType OnigSyntaxJava;
+ONIG_EXTERN const OnigSyntaxType OnigSyntaxPerl58;
+ONIG_EXTERN const OnigSyntaxType OnigSyntaxPerl58_NG;
ONIG_EXTERN const OnigSyntaxType OnigSyntaxPerl;
-ONIG_EXTERN const OnigSyntaxType OnigSyntaxPerl_NG;
ONIG_EXTERN const OnigSyntaxType OnigSyntaxRuby;
+ONIG_EXTERN const OnigSyntaxType OnigSyntaxPython;
/* predefined syntaxes (see regsyntax.c) */
#define ONIG_SYNTAX_ASIS (&OnigSyntaxASIS)
@@ -394,9 +405,11 @@ ONIG_EXTERN const OnigSyntaxType OnigSyntaxRuby;
#define ONIG_SYNTAX_GREP (&OnigSyntaxGrep)
#define ONIG_SYNTAX_GNU_REGEX (&OnigSyntaxGnuRegex)
#define ONIG_SYNTAX_JAVA (&OnigSyntaxJava)
+#define ONIG_SYNTAX_PERL58 (&OnigSyntaxPerl58)
+#define ONIG_SYNTAX_PERL58_NG (&OnigSyntaxPerl58_NG)
#define ONIG_SYNTAX_PERL (&OnigSyntaxPerl)
-#define ONIG_SYNTAX_PERL_NG (&OnigSyntaxPerl_NG)
#define ONIG_SYNTAX_RUBY (&OnigSyntaxRuby)
+#define ONIG_SYNTAX_PYTHON (&OnigSyntaxPython)
/* default syntax */
ONIG_EXTERN const OnigSyntaxType* OnigDefaultSyntax;
@@ -434,11 +447,12 @@ ONIG_EXTERN const OnigSyntaxType* OnigDefaultSyntax;
#define ONIG_SYN_OP_ESC_OCTAL3 (1U<<28) /* \OOO */
#define ONIG_SYN_OP_ESC_X_HEX2 (1U<<29) /* \xHH */
#define ONIG_SYN_OP_ESC_X_BRACE_HEX8 (1U<<30) /* \x{7HHHHHHH} */
+#define ONIG_SYN_OP_ESC_O_BRACE_OCTAL (1U<<31) /* \o{OOO} */ /* NOTIMPL */
#define ONIG_SYN_OP2_ESC_CAPITAL_Q_QUOTE (1U<<0) /* \Q...\E */
#define ONIG_SYN_OP2_QMARK_GROUP_EFFECT (1U<<1) /* (?...) */
-#define ONIG_SYN_OP2_OPTION_PERL (1U<<2) /* (?imsx),(?-imsx) */
-#define ONIG_SYN_OP2_OPTION_RUBY (1U<<3) /* (?imx), (?-imx) */
+#define ONIG_SYN_OP2_OPTION_PERL (1U<<2) /* (?imsxadlu), (?-imsx), (?^imsxalu) */
+#define ONIG_SYN_OP2_OPTION_RUBY (1U<<3) /* (?imxadu), (?-imx) */
#define ONIG_SYN_OP2_PLUS_POSSESSIVE_REPEAT (1U<<4) /* ?+,*+,++ */
#define ONIG_SYN_OP2_PLUS_POSSESSIVE_INTERVAL (1U<<5) /* {n,m}+ */
#define ONIG_SYN_OP2_CCLASS_SET_OP (1U<<6) /* [...&&..[..]..] */
@@ -456,6 +470,17 @@ ONIG_EXTERN const OnigSyntaxType* OnigDefaultSyntax;
/* #define ONIG_SYN_OP2_CHAR_PROPERTY_PREFIX_IS (1U<<18) */
#define ONIG_SYN_OP2_ESC_H_XDIGIT (1U<<19) /* \h, \H */
#define ONIG_SYN_OP2_INEFFECTIVE_ESCAPE (1U<<20) /* \ */
+#define ONIG_SYN_OP2_ESC_CAPITAL_R_LINEBREAK (1U<<21) /* \R as (?>\x0D\x0A|[\x0A-\x0D\x{85}\x{2028}\x{2029}]) */
+#define ONIG_SYN_OP2_ESC_CAPITAL_X_EXTENDED_GRAPHEME_CLUSTER (1U<<22) /* \X as (?>\P{M}\p{M}*) */
+#define ONIG_SYN_OP2_ESC_V_VERTICAL_WHITESPACE (1U<<23) /* \v, \V -- Perl */ /* NOTIMPL */
+#define ONIG_SYN_OP2_ESC_H_HORIZONTAL_WHITESPACE (1U<<24) /* \h, \H -- Perl */ /* NOTIMPL */
+#define ONIG_SYN_OP2_ESC_CAPITAL_K_KEEP (1U<<25) /* \K */
+#define ONIG_SYN_OP2_ESC_G_BRACE_BACKREF (1U<<26) /* \g{name}, \g{n} */
+#define ONIG_SYN_OP2_QMARK_SUBEXP_CALL (1U<<27) /* (?&name), (?n), (?R), (?0) */
+#define ONIG_SYN_OP2_QMARK_VBAR_BRANCH_RESET (1U<<28) /* (?|...) */ /* NOTIMPL */
+#define ONIG_SYN_OP2_QMARK_LPAREN_CONDITION (1U<<29) /* (?(cond)yes...|no...) */
+#define ONIG_SYN_OP2_QMARK_CAPITAL_P_NAMED_GROUP (1U<<30) /* (?P<name>...), (?P=name), (?P>name) -- Python/PCRE */
+#define ONIG_SYN_OP2_OPTION_JAVA (1U<<31) /* (?idmsux), (?-idmsux) */ /* NOTIMPL */
/* syntax (behavior) */
#define ONIG_SYN_CONTEXT_INDEP_ANCHORS (1U<<31) /* not implemented */
@@ -469,6 +494,7 @@ ONIG_EXTERN const OnigSyntaxType* OnigDefaultSyntax;
#define ONIG_SYN_CAPTURE_ONLY_NAMED_GROUP (1U<<7) /* see doc/RE */
#define ONIG_SYN_ALLOW_MULTIPLEX_DEFINITION_NAME (1U<<8) /* (?<x>)(?<x>) */
#define ONIG_SYN_FIXED_INTERVAL_IS_GREEDY_ONLY (1U<<9) /* a{n}?=(?:a{n})? */
+#define ONIG_SYN_ALLOW_MULTIPLEX_DEFINITION_NAME_CALL (1U<<10) /* (?<x>)(?<x>)(?&x) */
/* syntax (behavior) in char class [...] */
#define ONIG_SYN_NOT_NEWLINE_IN_NEGATIVE_CC (1U<<20) /* [^...] */
@@ -505,7 +531,7 @@ ONIG_EXTERN const OnigSyntaxType* OnigDefaultSyntax;
#define ONIGERR_UNDEFINED_BYTECODE -13
#define ONIGERR_UNEXPECTED_BYTECODE -14
#define ONIGERR_MATCH_STACK_LIMIT_OVER -15
-#define ONIGERR_DEFAULT_ENCODING_IS_NOT_SETTED -21
+#define ONIGERR_DEFAULT_ENCODING_IS_NOT_SET -21
#define ONIGERR_SPECIFIED_ENCODING_CANT_CONVERT_TO_WIDE_CHAR -22
/* general error */
#define ONIGERR_INVALID_ARGUMENT -30
@@ -532,6 +558,7 @@ ONIG_EXTERN const OnigSyntaxType* OnigDefaultSyntax;
#define ONIGERR_INVALID_POSIX_BRACKET_TYPE -121
#define ONIGERR_INVALID_LOOK_BEHIND_PATTERN -122
#define ONIGERR_INVALID_REPEAT_RANGE_PATTERN -123
+#define ONIGERR_INVALID_CONDITION_PATTERN -124
/* values error (syntax error) */
#define ONIGERR_TOO_BIG_NUMBER -200
#define ONIGERR_TOO_BIG_NUMBER_FOR_REPEAT_RANGE -201
@@ -543,6 +570,7 @@ ONIG_EXTERN const OnigSyntaxType* OnigDefaultSyntax;
#define ONIGERR_TOO_BIG_BACKREF_NUMBER -207
#define ONIGERR_INVALID_BACKREF -208
#define ONIGERR_NUMBERED_BACKREF_OR_CALL_NOT_ALLOWED -209
+#define ONIGERR_TOO_SHORT_DIGITS -210
#define ONIGERR_TOO_LONG_WIDE_CHAR_VALUE -212
#define ONIGERR_EMPTY_GROUP_NAME -214
#define ONIGERR_INVALID_GROUP_NAME -215
@@ -571,8 +599,8 @@ ONIG_EXTERN const OnigSyntaxType* OnigDefaultSyntax;
typedef struct OnigCaptureTreeNodeStruct {
int group; /* group number */
- int beg;
- int end;
+ OnigPosition beg;
+ OnigPosition end;
int allocated;
int num_childs;
struct OnigCaptureTreeNodeStruct** childs;
@@ -582,8 +610,8 @@ typedef struct OnigCaptureTreeNodeStruct {
struct re_registers {
int allocated;
int num_regs;
- int* beg;
- int* end;
+ OnigPosition* beg;
+ OnigPosition* end;
/* extended */
OnigCaptureTreeNode* history_root; /* capture history tree root */
};
@@ -689,7 +717,7 @@ typedef struct {
ONIG_EXTERN
int onig_init P_((void));
ONIG_EXTERN
-int onig_error_code_to_str PV_((OnigUChar* s, int err_code, ...));
+int onig_error_code_to_str PV_((OnigUChar* s, OnigPosition err_code, ...));
ONIG_EXTERN
void onig_set_warn_func P_((OnigWarnFunc f));
ONIG_EXTERN
@@ -697,7 +725,7 @@ void onig_set_verb_warn_func P_((OnigWarnFunc f));
ONIG_EXTERN
int onig_new P_((OnigRegex*, const OnigUChar* pattern, const OnigUChar* pattern_end, OnigOptionType option, OnigEncoding enc, const OnigSyntaxType* syntax, OnigErrorInfo* einfo));
ONIG_EXTERN
-int onig_reg_init P_((regex_t* reg, OnigOptionType option, OnigCaseFoldType case_fold_flag, OnigEncoding enc, const OnigSyntaxType* syntax));
+int onig_reg_init P_((OnigRegex reg, OnigOptionType option, OnigCaseFoldType case_fold_flag, OnigEncoding enc, const OnigSyntaxType* syntax));
ONIG_EXTERN
int onig_new_without_alloc P_((OnigRegex, const OnigUChar* pattern, const OnigUChar* pattern_end, OnigOptionType option, OnigEncoding enc, OnigSyntaxType* syntax, OnigErrorInfo* einfo));
ONIG_EXTERN
@@ -711,9 +739,11 @@ int onig_recompile P_((OnigRegex, const OnigUChar* pattern, const OnigUChar* pat
ONIG_EXTERN
int onig_recompile_deluxe P_((OnigRegex reg, const OnigUChar* pattern, const OnigUChar* pattern_end, OnigCompileInfo* ci, OnigErrorInfo* einfo));
ONIG_EXTERN
-long onig_search P_((OnigRegex, const OnigUChar* str, const OnigUChar* end, const OnigUChar* start, const OnigUChar* range, OnigRegion* region, OnigOptionType option));
+OnigPosition onig_search P_((OnigRegex, const OnigUChar* str, const OnigUChar* end, const OnigUChar* start, const OnigUChar* range, OnigRegion* region, OnigOptionType option));
ONIG_EXTERN
-long onig_match P_((OnigRegex, const OnigUChar* str, const OnigUChar* end, const OnigUChar* at, OnigRegion* region, OnigOptionType option));
+OnigPosition onig_search_gpos P_((OnigRegex, const OnigUChar* str, const OnigUChar* end, const OnigUChar* global_pos, const OnigUChar* start, const OnigUChar* range, OnigRegion* region, OnigOptionType option));
+ONIG_EXTERN
+OnigPosition onig_match P_((OnigRegex, const OnigUChar* str, const OnigUChar* end, const OnigUChar* at, OnigRegion* region, OnigOptionType option));
ONIG_EXTERN
OnigRegion* onig_region_new P_((void));
ONIG_EXTERN
@@ -743,7 +773,7 @@ int onig_number_of_capture_histories P_((OnigRegex reg));
ONIG_EXTERN
OnigCaptureTreeNode* onig_get_capture_tree P_((OnigRegion* region));
ONIG_EXTERN
-int onig_capture_tree_traverse P_((OnigRegion* region, int at, int(*callback_func)(int,int,int,int,int,void*), void* arg));
+int onig_capture_tree_traverse P_((OnigRegion* region, int at, int(*callback_func)(int,OnigPosition,OnigPosition,int,int,void*), void* arg));
ONIG_EXTERN
int onig_noname_group_capture_is_active P_((OnigRegex reg));
ONIG_EXTERN
@@ -793,9 +823,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 453a6039a9..3b6a279b5b 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
@@ -36,6 +38,9 @@ extern "C" {
#ifndef NOINLINE
# define NOINLINE(x) x
#endif
+#ifndef UNREACHABLE
+# define UNREACHABLE /* unreachable */
+#endif
#ifdef __GNUC__
#define PRINTF_ARGS(decl, string_index, first_to_check) \
@@ -44,39 +49,34 @@ 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"
+RUBY_SYMBOL_EXPORT_BEGIN
-#if defined __GNUC__ && __GNUC__ >= 4
-#pragma GCC visibility push(default)
-#endif
-
-#if defined(HAVE_ALLOCA_H)
-#include <alloca.h>
+/* Make alloca work the best possible way. */
+#ifdef __GNUC__
+# ifndef atarist
+# ifndef alloca
+# define alloca __builtin_alloca
+# endif
+# endif /* atarist */
#else
+# ifdef HAVE_ALLOCA_H
+# include <alloca.h>
+# else
# ifdef _AIX
#pragma alloca
-# endif
-#endif
+# else
+# ifndef alloca /* predefined by HP cc +Olibcalls */
+void *alloca();
+# endif
+# endif /* AIX */
+# endif /* HAVE_ALLOCA_H */
+#endif /* __GNUC__ */
#if defined HAVE_UINTPTR_T && 0
typedef uintptr_t VALUE;
@@ -98,12 +98,12 @@ typedef unsigned LONG_LONG ID;
# define SIZEOF_VALUE SIZEOF_LONG_LONG
# define PRI_VALUE_PREFIX PRI_LL_PREFIX
#else
-# error ---->> ruby requires sizeof(void*) == sizeof(long) to be compiled. <<----
+# error ---->> ruby requires sizeof(void*) == sizeof(long) or sizeof(LONG_LONG) to be compiled. <<----
#endif
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];
@@ -115,20 +115,26 @@ 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 PRIiVALUE PRIiPTR
#define PRIoVALUE PRIoPTR
#define PRIuVALUE PRIuPTR
#define PRIxVALUE PRIxPTR
#define PRIXVALUE PRIXPTR
+#define PRIsVALUE PRIiPTR
#else
#define PRIdVALUE PRI_VALUE_PREFIX"d"
-#define PRIiVALUE PRI_VALUE_PREFIX"i"
#define PRIoVALUE PRI_VALUE_PREFIX"o"
#define PRIuVALUE PRI_VALUE_PREFIX"u"
#define PRIxVALUE PRI_VALUE_PREFIX"x"
#define PRIXVALUE PRI_VALUE_PREFIX"X"
+#define PRIsVALUE PRI_VALUE_PREFIX"i"
#endif
#ifndef PRI_VALUE_PREFIX
# define PRI_VALUE_PREFIX ""
@@ -181,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
@@ -239,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
@@ -246,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)
@@ -295,15 +303,16 @@ NORETURN(void rb_out_of_int(SIGNED_VALUE num));
#endif
#if SIZEOF_INT < SIZEOF_LONG
-#define rb_long2int_internal(n, i) \
- int (i) = (int)(n); \
- if ((long)(i) != (n)) rb_out_of_int(n)
-#ifdef __GNUC__
-#define rb_long2int(n) __extension__ ({long i2l_n = (n); rb_long2int_internal(i2l_n, i2l_i); i2l_i;})
-#else
static inline int
-rb_long2int(long n) {rb_long2int_internal(n, i); return i;}
-#endif
+rb_long2int_inline(long n)
+{
+ int i = (int)n;
+ if ((long)i != n)
+ rb_out_of_int(n);
+
+ return i;
+}
+#define rb_long2int(n) rb_long2int_inline(n)
#else
#define rb_long2int(n) ((int)(n))
#endif
@@ -333,8 +342,8 @@ rb_long2int(long n) {rb_long2int_internal(n, i); return i;}
#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)
@@ -342,15 +351,63 @@ rb_long2int(long n) {rb_long2int_internal(n, i); return i;}
#define IMMEDIATE_P(x) ((VALUE)(x) & IMMEDIATE_MASK)
-#define SYMBOL_P(x) (((VALUE)(x)&~(~(VALUE)0<<RUBY_SPECIAL_SHIFT))==SYMBOL_FLAG)
+#define SYMBOL_P(x) (((VALUE)(x)&~((~(VALUE)0)<<RUBY_SPECIAL_SHIFT))==SYMBOL_FLAG)
#define ID2SYM(x) (((VALUE)(x)<<RUBY_SPECIAL_SHIFT)|SYMBOL_FLAG)
#define SYM2ID(x) RSHIFT((unsigned long)(x),RUBY_SPECIAL_SHIFT)
+#ifndef USE_FLONUM
+#if SIZEOF_VALUE >= SIZEOF_DOUBLE
+#define USE_FLONUM 1
+#else
+#define USE_FLONUM 0
+#endif
+#endif
+
+#if USE_FLONUM
+#define FLONUM_P(x) ((((int)(SIGNED_VALUE)(x))&FLONUM_MASK) == FLONUM_FLAG)
+#else
+#define FLONUM_P(x) 0
+#endif
+
/* 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_IMMEDIATE_MASK = 0x07,
+ RUBY_FIXNUM_FLAG = 0x01,
+ RUBY_FLONUM_MASK = 0x03,
+ RUBY_FLONUM_FLAG = 0x02,
+ RUBY_SYMBOL_FLAG = 0x0c,
+ RUBY_SPECIAL_SHIFT = 8
+#else
RUBY_Qfalse = 0,
RUBY_Qtrue = 2,
RUBY_Qnil = 4,
@@ -358,8 +415,11 @@ enum ruby_special_consts {
RUBY_IMMEDIATE_MASK = 0x03,
RUBY_FIXNUM_FLAG = 0x01,
+ RUBY_FLONUM_MASK = 0x00, /* any values ANDed with FLONUM_MASK cannot be FLONUM_FLAG */
+ RUBY_FLONUM_FLAG = 0x02,
RUBY_SYMBOL_FLAG = 0x0e,
RUBY_SPECIAL_SHIFT = 8
+#endif
};
#define Qfalse ((VALUE)RUBY_Qfalse)
@@ -368,10 +428,14 @@ enum ruby_special_consts {
#define Qundef ((VALUE)RUBY_Qundef) /* undefined value for placeholder */
#define IMMEDIATE_MASK RUBY_IMMEDIATE_MASK
#define FIXNUM_FLAG RUBY_FIXNUM_FLAG
+#if USE_FLONUM
+#define FLONUM_MASK RUBY_FLONUM_MASK
+#define FLONUM_FLAG RUBY_FLONUM_FLAG
+#endif
#define SYMBOL_FLAG RUBY_SYMBOL_FLAG
-#define RTEST(v) (((VALUE)(v) & ~Qnil) != 0)
-#define NIL_P(v) ((VALUE)(v) == Qnil)
+#define RTEST(v) !(((VALUE)(v) & ~Qnil) == 0)
+#define NIL_P(v) !((VALUE)(v) != Qnil)
#define CLASS_OF(v) rb_class_of((VALUE)(v))
@@ -440,21 +504,30 @@ enum ruby_value_type {
static inline int rb_type(VALUE obj);
#define TYPE(x) rb_type((VALUE)(x))
+/* RB_GC_GUARD_PTR() is an intermediate macro, and has no effect by
+ * itself. don't use it directly */
#ifdef __GNUC__
#define RB_GC_GUARD_PTR(ptr) \
__extension__ ({volatile VALUE *rb_gc_guarded_ptr = (ptr); rb_gc_guarded_ptr;})
#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(volatile VALUE *ptr);
+#define HAVE_RB_GC_GUARDED_PTR 1
#endif
#define RB_GC_GUARD_PTR(ptr) rb_gc_guarded_ptr(ptr)
#endif
#define RB_GC_GUARD(v) (*RB_GC_GUARD_PTR(&(v)))
+#ifdef __GNUC__
+#define RB_UNUSED_VAR(x) x __attribute__ ((unused))
+#else
+#define RB_UNUSED_VAR(x) x
+#endif
+
void rb_check_type(VALUE,int);
#define Check_Type(v,t) rb_check_type((VALUE)(v),(t))
@@ -489,9 +562,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));
@@ -501,70 +589,93 @@ void rb_set_errinfo(VALUE);
SIGNED_VALUE rb_num2long(VALUE);
VALUE rb_num2ulong(VALUE);
-#define NUM2LONG_internal(x) ((long)(FIXNUM_P(x) ? FIX2LONG(x) : rb_num2long(x)))
-#ifdef __GNUC__
-#define NUM2LONG(x) \
- __extension__ ({VALUE num2long_x = (x); NUM2LONG_internal(num2long_x);})
-#else
static inline long
-NUM2LONG(VALUE x)
+rb_num2long_inline(VALUE x)
{
- return NUM2LONG_internal(x);
+ if (FIXNUM_P(x))
+ return FIX2LONG(x);
+ else
+ return (long)rb_num2long(x);
}
-#endif
-#define NUM2ULONG(x) rb_num2ulong((VALUE)(x))
+#define NUM2LONG(x) rb_num2long_inline(x)
+static inline unsigned long
+rb_num2ulong_inline(VALUE x)
+{
+ if (FIXNUM_P(x))
+ return (unsigned long)FIX2LONG(x);
+ else
+ return (unsigned long)rb_num2ulong(x);
+}
+#define NUM2ULONG(x) rb_num2ulong_inline(x)
#if SIZEOF_INT < SIZEOF_LONG
long rb_num2int(VALUE);
long rb_fix2int(VALUE);
#define FIX2INT(x) ((int)rb_fix2int((VALUE)(x)))
-#define NUM2INT_internal(x) (FIXNUM_P(x) ? FIX2INT(x) : (int)rb_num2int(x))
-#ifdef __GNUC__
-#define NUM2INT(x) \
- __extension__ ({VALUE num2int_x = (x); NUM2INT_internal(num2int_x);})
-#else
+
static inline int
-NUM2INT(VALUE x)
+rb_num2int_inline(VALUE x)
{
- return NUM2INT_internal(x);
+ if (FIXNUM_P(x))
+ return FIX2INT(x);
+ else
+ return (int)rb_num2int(x);
}
-#endif
+#define NUM2INT(x) rb_num2int_inline(x)
+
unsigned long rb_num2uint(VALUE);
#define NUM2UINT(x) ((unsigned int)rb_num2uint(x))
unsigned long rb_fix2uint(VALUE);
#define FIX2UINT(x) ((unsigned int)rb_fix2uint(x))
-#else
+#else /* SIZEOF_INT < SIZEOF_LONG */
#define NUM2INT(x) ((int)NUM2LONG(x))
#define NUM2UINT(x) ((unsigned int)NUM2ULONG(x))
#define FIX2INT(x) ((int)FIX2LONG(x))
#define FIX2UINT(x) ((unsigned int)FIX2ULONG(x))
-#endif
+#endif /* SIZEOF_INT < SIZEOF_LONG */
+
+short rb_num2short(VALUE);
+unsigned short rb_num2ushort(VALUE);
+short rb_fix2short(VALUE);
+unsigned short rb_fix2ushort(VALUE);
+#define FIX2SHORT(x) (rb_fix2short((VALUE)(x)))
+static inline short
+rb_num2short_inline(VALUE x)
+{
+ if (FIXNUM_P(x))
+ return FIX2SHORT(x);
+ else
+ return rb_num2short(x);
+}
+
+#define NUM2SHORT(x) rb_num2short_inline(x)
+#define NUM2USHORT(x) rb_num2ushort(x)
#ifdef HAVE_LONG_LONG
LONG_LONG rb_num2ll(VALUE);
unsigned LONG_LONG rb_num2ull(VALUE);
-# define NUM2LL_internal(x) (FIXNUM_P(x) ? FIX2LONG(x) : rb_num2ll(x))
-# ifdef __GNUC__
-# define NUM2LL(x) \
- __extension__ ({VALUE num2ll_x = (x); NUM2LL_internal(num2ll_x);})
-# else
static inline LONG_LONG
-NUM2LL(VALUE x)
+rb_num2ll_inline(VALUE x)
{
- return NUM2LL_internal(x);
+ if (FIXNUM_P(x))
+ return FIX2LONG(x);
+ else
+ return rb_num2ll(x);
}
-# endif
-# define NUM2ULL(x) rb_num2ull((VALUE)(x))
+# define NUM2LL(x) rb_num2ll_inline(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
# define NUM2SIZET(x) ((size_t)NUM2ULL(x))
-# define NUM2SSIZET(x) ((size_t)NUM2LL(x))
+# define NUM2SSIZET(x) ((ssize_t)NUM2LL(x))
#else
# define NUM2SIZET(x) NUM2ULONG(x)
# define NUM2SSIZET(x) NUM2LONG(x)
@@ -577,26 +688,72 @@ VALUE rb_uint2big(VALUE);
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 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 NEWOBJ_OF(obj,type,klass,flags) type *(obj) = (type*)rb_newobj_of(klass, flags)
+#define OBJSETUP(obj,c,t) rb_obj_setup(obj, c, t) /* use NEWOBJ_OF instead of NEWOBJ()+OBJSETUP() */
#define CLONESETUP(clone,obj) 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
+#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
+
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 {
@@ -638,12 +795,20 @@ struct RClass {
#define RMODULE_CONST_TBL(m) RCLASS_CONST_TBL(m)
#define RMODULE_M_TBL(m) RCLASS_M_TBL(m)
#define RMODULE_SUPER(m) RCLASS_SUPER(m)
+#define RMODULE_IS_OVERLAID FL_USER2
+#define RMODULE_IS_REFINEMENT FL_USER3
+#define RMODULE_INCLUDED_INTO_REFINEMENT FL_USER4
struct RFloat {
struct RBasic basic;
double float_value;
};
-#define RFLOAT_VALUE(v) (RFLOAT(v)->float_value)
+
+double rb_float_value(VALUE);
+VALUE rb_float_new(double);
+VALUE rb_float_new_in_heap(double);
+
+#define RFLOAT_VALUE(v) rb_float_value(v)
#define DBL2NUM(dbl) rb_float_new(dbl)
#define ELTS_SHARED FL_USER2
@@ -664,6 +829,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) \
@@ -697,9 +863,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
@@ -711,16 +877,36 @@ 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); \
+ OBJ_WRITE(_ary_, &RARRAY_CONST_PTR(_ary_)[i], (v)); \
+} 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
@@ -732,14 +918,15 @@ struct RHash {
struct RBasic basic;
struct st_table *ntbl; /* possibly 0 */
int iter_lev;
- VALUE ifnone;
+ const 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_SIZE(h) (RHASH(h)->ntbl ? (st_index_t)RHASH(h)->ntbl->num_entries : 0)
#define RHASH_EMPTY_P(h) (RHASH_SIZE(h) == 0)
+#define RHASH_SET_IFNONE(h, ifnone) rb_hash_set_ifnone((VALUE)h, ifnone)
struct RFile {
struct RBasic basic;
@@ -748,16 +935,22 @@ struct RFile {
struct RRational {
struct RBasic basic;
- VALUE num;
- VALUE den;
+ const VALUE num;
+ const VALUE den;
};
+#define RRATIONAL_SET_NUM(rat, n) OBJ_WRITE((rat), &((struct RRational *)(rat))->num,(n))
+#define RRATIONAL_SET_DEN(rat, d) OBJ_WRITE((rat), &((struct RRational *)(rat))->den,(d))
+
struct RComplex {
struct RBasic basic;
- VALUE real;
- VALUE imag;
+ const VALUE real;
+ const VALUE imag;
};
+#define RCOMPLEX_SET_REAL(cmp, r) OBJ_WRITE((cmp), &((struct RComplex *)(cmp))->real,(r))
+#define RCOMPLEX_SET_IMAG(cmp, i) OBJ_WRITE((cmp), &((struct RComplex *)(cmp))->imag,(i))
+
struct RData {
struct RBasic basic;
void (*dmark)(void*);
@@ -779,6 +972,7 @@ struct rb_data_type_struct {
const rb_data_type_t *parent;
void *data; /* This area can be used for any purpose
by a programmer who define the type. */
+ VALUE flags; /* FL_WB_PROTECTED */
};
#define HAVE_TYPE_RB_DATA_TYPE_T 1
@@ -814,6 +1008,10 @@ 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))
@@ -847,9 +1045,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)
@@ -859,13 +1057,19 @@ 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)))
+#define RSTRUCT_SET(st, idx, v) OBJ_WRITE(st, &RSTRUCT_CONST_PTR(st)[idx], (v))
+#define RSTRUCT_GET(st, idx) (RSTRUCT_CONST_PTR(st)[idx])
+
+#ifndef RBIGNUM_EMBED_LEN_MAX
+# define RBIGNUM_EMBED_LEN_MAX ((int)((sizeof(VALUE)*3)/sizeof(BDIGIT)))
+#endif
struct RBignum {
struct RBasic basic;
union {
@@ -919,11 +1123,11 @@ struct RBignum {
#define RCOMPLEX(obj) (R_CAST(RComplex)(obj))
#define FL_SINGLETON FL_USER0
-#define FL_MARK (((VALUE)1)<<5)
-#define FL_RESERVED (((VALUE)1)<<6) /* will be used in the future GC */
+#define FL_WB_PROTECTED (((VALUE)1)<<5)
+#define FL_PROMOTED (((VALUE)1)<<6)
#define FL_FINALIZE (((VALUE)1)<<7)
#define FL_TAINT (((VALUE)1)<<8)
-#define FL_UNTRUSTED (((VALUE)1)<<9)
+#define FL_UNTRUSTED FL_TAINT
#define FL_EXIVAR (((VALUE)1)<<10)
#define FL_FREEZE (((VALUE)1)<<11)
@@ -953,7 +1157,8 @@ 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)
@@ -962,73 +1167,148 @@ struct RBignum {
#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_UNTRUSTED(x) OBJ_TAINTED(x)
+#define OBJ_UNTRUST(x) OBJ_TAINT(x)
+#define OBJ_INFECT(x,s) do { \
+ if (FL_ABLE(x) && FL_ABLE(s)) \
+ RBASIC(x)->flags |= RBASIC(s)->flags & FL_TAINT; \
+} while (0)
-#define OBJ_FROZEN(x) (!!FL_TEST((x), FL_FREEZE))
+#define OBJ_FROZEN(x) (!!(FL_ABLE(x)?(RBASIC(x)->flags&(FL_FREEZE)):(FIXNUM_P(x)||FLONUM_P(x)||SYMBOL_P(x))))
#define OBJ_FREEZE(x) FL_SET((x), FL_FREEZE)
+#if USE_RGENGC
+#define OBJ_PROMOTED(x) (SPECIAL_CONST_P(x) ? 0 : FL_TEST_RAW((x), FL_PROMOTED))
+#define OBJ_WB_PROTECTED(x) (SPECIAL_CONST_P(x) ? 1 : FL_TEST_RAW((x), FL_WB_PROTECTED))
+#define OBJ_WB_UNPROTECT(x) rb_obj_wb_unprotect(x, __FILE__, __LINE__)
+
+void rb_gc_writebarrier(VALUE a, VALUE b);
+void rb_gc_writebarrier_unprotect_promoted(VALUE obj);
+
+#else /* USE_RGENGC */
+#define OBJ_PROMOTED(x) 0
+#define OBJ_WB_PROTECTED(x) 0
+#define OBJ_WB_UNPROTECT(x) rb_obj_wb_unprotect(x, __FILE__, __LINE__)
+#endif
+
+#define OBJ_WRITE(a, slot, b) rb_obj_write((VALUE)(a), (VALUE *)(slot), (VALUE)(b), __FILE__, __LINE__)
+#define OBJ_WRITTEN(a, oldv, b) rb_obj_written((VALUE)(a), (VALUE)(oldv), (VALUE)(b), __FILE__, __LINE__)
+
+#ifndef USE_RGENGC_LOGGING_WB_UNPROTECT
+#define USE_RGENGC_LOGGING_WB_UNPROTECT 0
+#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
+ /* `x' should be an RVALUE object */
+ if (FL_TEST_RAW((x), FL_WB_PROTECTED)) {
+ if (FL_TEST_RAW((x), FL_PROMOTED)) {
+ rb_gc_writebarrier_unprotect_promoted(x);
+ }
+ RBASIC(x)->flags &= ~FL_WB_PROTECTED;
+ }
+#endif
+ return x;
+}
+
+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
+ /* `a' should be an RVALUE object */
+ if (FL_TEST_RAW((a), FL_PROMOTED) && !SPECIAL_CONST_P(b)) {
+ rb_gc_writebarrier(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))
# define UINT2NUM(v) LONG2FIX((unsigned int)(v))
#else
-# define INT2NUM_internal(v) (FIXABLE(v) ? INT2FIX(v) : rb_int2big(v))
-# ifdef __GNUC__
-# define INT2NUM(v) __extension__ ({int int2num_v = (v); INT2NUM_internal(int2num_v);})
-# else
static inline VALUE
-INT2NUM(int v)
+rb_int2num_inline(int v)
{
- return INT2NUM_internal(v);
+ if (FIXABLE(v))
+ return INT2FIX(v);
+ else
+ return rb_int2big(v);
}
-# endif
+#define INT2NUM(x) rb_int2num_inline(x)
-# define UINT2NUM_internal(v) (POSFIXABLE(v) ? LONG2FIX(v) : rb_uint2big(v))
-# ifdef __GNUC__
-# define UINT2NUM(v) __extension__ ({unsigned int uint2num_v = (v); UINT2NUM_internal(uint2num_v);})
-# else
static inline VALUE
-UINT2NUM(unsigned int v)
+rb_uint2num_inline(unsigned int v)
{
- return UINT2NUM_internal(v);
+ if (POSFIXABLE(v))
+ return LONG2FIX(v);
+ else
+ return rb_uint2big(v);
}
-# endif
+#define UINT2NUM(x) rb_uint2num_inline(x)
#endif
-#define LONG2NUM_internal(v) (FIXABLE(v) ? LONG2FIX(v) : rb_int2big(v))
-#ifdef __GNUC__
-# define LONG2NUM(v) __extension__ ({long long2num_v = (v); LONG2NUM_internal(long2num_v);})
-#else
static inline VALUE
-LONG2NUM(long v)
+rb_long2num_inline(long v)
{
- return LONG2NUM_internal(v);
+ if (FIXABLE(v))
+ return LONG2FIX(v);
+ else
+ return rb_int2big(v);
}
-#endif
+#define LONG2NUM(x) rb_long2num_inline(x)
-#define ULONG2NUM_internal(v) (POSFIXABLE(v) ? LONG2FIX(v) : rb_uint2big(v))
-#ifdef __GNUC__
-# define ULONG2NUM(v) __extension__ ({unsigned long ulong2num_v = (v); ULONG2NUM_internal(ulong2num_v);})
-#else
static inline VALUE
-ULONG2NUM(unsigned long v)
+rb_ulong2num_inline(unsigned long v)
{
- return ULONG2NUM_internal(v);
+ if (POSFIXABLE(v))
+ return LONG2FIX(v);
+ else
+ return rb_uint2big(v);
}
-#endif
+#define ULONG2NUM(x) rb_ulong2num_inline(x)
-#define NUM2CHR_internal(x) (((TYPE(x) == T_STRING)&&(RSTRING_LEN(x)>=1))?\
- RSTRING_PTR(x)[0]:(char)(NUM2INT(x)&0xff))
-#ifdef __GNUC__
-# define NUM2CHR(x) __extension__ ({VALUE num2chr_x = (x); NUM2CHR_internal(num2chr_x);})
-#else
static inline char
-NUM2CHR(VALUE x)
+rb_num2char_inline(VALUE x)
{
- return NUM2CHR_internal(x);
+ if ((TYPE(x) == T_STRING) && (RSTRING_LEN(x)>=1))
+ return RSTRING_PTR(x)[0];
+ else
+ return (char)(NUM2INT(x) & 0xff);
}
-#endif
+#define NUM2CHR(x) rb_num2char_inline(x)
+
#define CHR2FIX(x) INT2FIX((long)((x)&0xff))
#define ALLOC_N(type,n) ((type*)xmalloc2((n),sizeof(type)))
@@ -1037,7 +1317,7 @@ NUM2CHR(VALUE x)
#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. */
@@ -1068,6 +1348,7 @@ VALUE rb_define_module_under(VALUE, const char*);
void rb_include_module(VALUE,VALUE);
void rb_extend_object(VALUE,VALUE);
+void rb_prepend_module(VALUE,VALUE);
struct rb_global_variable;
@@ -1114,6 +1395,7 @@ ID rb_intern(const char*);
ID rb_intern2(const char*, long);
ID rb_intern_str(VALUE str);
const char *rb_id2name(ID);
+ID rb_check_id(volatile VALUE *);
ID rb_to_id(VALUE);
VALUE rb_id2str(ID);
@@ -1150,13 +1432,18 @@ 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*, ...);
VALUE rb_call_super(int, const VALUE*);
+/* rb_scan_args() format allows ':' for optional hash */
+#define HAVE_RB_SCAN_ARGS_OPTIONAL_HASH 1
+
VALUE rb_gv_set(const char*, VALUE);
VALUE rb_gv_get(const char*);
VALUE rb_iv_get(VALUE, const char*);
@@ -1177,7 +1464,9 @@ 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));
NORETURN(void rb_notimplement(void));
VALUE rb_syserr_new(int, const char *);
@@ -1195,6 +1484,10 @@ 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);
+/* for rb_readwrite_sys_fail first argument */
+#define RB_IO_WAIT_READABLE 0
+#define RB_IO_WAIT_WRITABLE 1
+
typedef VALUE rb_block_call_func(VALUE, VALUE, int, VALUE*);
VALUE rb_each(VALUE);
@@ -1216,21 +1509,6 @@ NORETURN(void rb_throw_obj(VALUE,VALUE));
VALUE rb_require(const char*);
-#ifdef __ia64
-void ruby_init_stack(volatile VALUE*, void*);
-#define ruby_init_stack(addr) ruby_init_stack((addr), rb_ia64_bsp())
-#else
-void ruby_init_stack(volatile VALUE*);
-#endif
-#define RUBY_INIT_STACK \
- VALUE variable_in_this_stack_frame; \
- ruby_init_stack(&variable_in_this_stack_frame);
-void ruby_init(void);
-void *ruby_options(int, char**);
-int ruby_run_node(void *);
-int ruby_exec_node(void *);
-int ruby_executable_node(void *n, int *status);
-
RUBY_EXTERN VALUE rb_mKernel;
RUBY_EXTERN VALUE rb_mComparable;
RUBY_EXTERN VALUE rb_mEnumerable;
@@ -1324,6 +1602,7 @@ rb_class_of(VALUE obj)
{
if (IMMEDIATE_P(obj)) {
if (FIXNUM_P(obj)) return rb_cFixnum;
+ if (FLONUM_P(obj)) return rb_cFloat;
if (obj == Qtrue) return rb_cTrueClass;
if (SYMBOL_P(obj)) return rb_cSymbol;
}
@@ -1339,17 +1618,20 @@ rb_type(VALUE obj)
{
if (IMMEDIATE_P(obj)) {
if (FIXNUM_P(obj)) return T_FIXNUM;
- if (obj == Qtrue) return T_TRUE;
+ if (FLONUM_P(obj)) return T_FLOAT;
+ if (obj == Qtrue) return T_TRUE;
if (SYMBOL_P(obj)) return T_SYMBOL;
if (obj == Qundef) return T_UNDEF;
}
else if (!RTEST(obj)) {
- if (obj == Qnil) return T_NIL;
+ if (obj == Qnil) return T_NIL;
if (obj == Qfalse) return T_FALSE;
}
return BUILTIN_TYPE(obj);
}
+#define RB_FLOAT_TYPE_P(obj) (FLONUM_P(obj) || (!SPECIAL_CONST_P(obj) && BUILTIN_TYPE(obj) == T_FLOAT))
+
#define RB_TYPE_P(obj, type) ( \
((type) == T_FIXNUM) ? FIXNUM_P(obj) : \
((type) == T_TRUE) ? ((obj) == Qtrue) : \
@@ -1357,6 +1639,7 @@ rb_type(VALUE obj)
((type) == T_NIL) ? ((obj) == Qnil) : \
((type) == T_UNDEF) ? ((obj) == Qundef) : \
((type) == T_SYMBOL) ? SYMBOL_P(obj) : \
+ ((type) == T_FLOAT) ? RB_FLOAT_TYPE_P(obj) : \
(!SPECIAL_CONST_P(obj) && BUILTIN_TYPE(obj) == (type)))
#ifdef __GNUC__
@@ -1379,7 +1662,6 @@ rb_special_const_p(VALUE obj)
}
#endif
-#include "ruby/missing.h"
#include "ruby/intern.h"
#if defined(EXTLIB) && defined(USE_DLN_A_OUT)
@@ -1387,18 +1669,11 @@ rb_special_const_p(VALUE obj)
static char *dln_libs_to_be_linked[] = { EXTLIB, 0 };
#endif
-#if (defined(__APPLE__) || defined(__NeXT__)) && defined(__MACH__)
-#define RUBY_GLOBAL_SETUP /* use linker option to link startup code with ObjC support */
-#else
-#define RUBY_GLOBAL_SETUP
-#endif
-
-void ruby_sysinit(int *, char ***);
-
#define RUBY_VM 1 /* YARV */
#define HAVE_NATIVETHREAD
int ruby_native_thread_p(void);
+/* traditional set_trace_func events */
#define RUBY_EVENT_NONE 0x0000
#define RUBY_EVENT_LINE 0x0001
#define RUBY_EVENT_CLASS 0x0002
@@ -1408,24 +1683,35 @@ int ruby_native_thread_p(void);
#define RUBY_EVENT_C_CALL 0x0020
#define RUBY_EVENT_C_RETURN 0x0040
#define RUBY_EVENT_RAISE 0x0080
-#define RUBY_EVENT_ALL 0xffff
-#define RUBY_EVENT_VM 0x10000
-#define RUBY_EVENT_SWITCH 0x20000
-#define RUBY_EVENT_COVERAGE 0x40000
-
-typedef unsigned int rb_event_flag_t;
-typedef void (*rb_event_hook_func_t)(rb_event_flag_t, VALUE data, VALUE, ID, VALUE klass);
-
-typedef struct rb_event_hook_struct {
- rb_event_flag_t flag;
- rb_event_hook_func_t func;
- VALUE data;
- struct rb_event_hook_struct *next;
-} rb_event_hook_t;
+#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
+
+/* special events */
+#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 0x800000
+#define RUBY_INTERNAL_EVENT_OBJSPACE_MASK 0xf00000
+#define RUBY_INTERNAL_EVENT_MASK 0xfffe0000
+
+typedef unsigned long rb_event_flag_t;
+typedef void (*rb_event_hook_func_t)(rb_event_flag_t evflag, VALUE data, VALUE self, ID mid, VALUE klass);
#define RB_EVENT_HOOKS_HAVE_CALLBACK_DATA 1
-void rb_add_event_hook(rb_event_hook_func_t func, rb_event_flag_t events,
- VALUE data);
+void rb_add_event_hook(rb_event_hook_func_t func, rb_event_flag_t events, VALUE data);
int rb_remove_event_hook(rb_event_hook_func_t func);
/* locale insensitive functions */
@@ -1450,6 +1736,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))
@@ -1461,10 +1748,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)))
@@ -1474,14 +1761,78 @@ unsigned long ruby_strtoul(const char *str, char **endptr, int base);
PRINTF_ARGS(int ruby_snprintf(char *str, size_t n, char const *fmt, ...), 3, 4);
int ruby_vsnprintf(char *str, size_t n, char const *fmt, va_list ap);
-#if defined __GNUC__ && __GNUC__ >= 4
-#pragma GCC visibility pop
-#endif
-
#ifndef RUBY_DONT_SUBST
#include "ruby/subst.h"
#endif
+/**
+ * @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 extension library API.
+ * Extension libraries of Ruby should not depend on these functions.
+ * @{
+ */
+
+/** @defgroup ruby1 ruby(1) implementation
+ * A part of the implementation of ruby(1) command.
+ * Other programs that embed Ruby interpreter do not always need to use these
+ * functions.
+ * @{
+ */
+
+void ruby_sysinit(int *argc, char ***argv);
+void ruby_init(void);
+void* ruby_options(int argc, char** argv);
+int ruby_executable_node(void *n, int *status);
+int ruby_run_node(void *n);
+
+/* version.c */
+void ruby_show_version(void);
+void ruby_show_copyright(void);
+
+
+/*! A convenience macro to call ruby_init_stack(). Must be placed just after
+ * variable declarations */
+#define RUBY_INIT_STACK \
+ VALUE variable_in_this_stack_frame; \
+ ruby_init_stack(&variable_in_this_stack_frame);
+/*! @} */
+
+#ifdef __ia64
+void ruby_init_stack(volatile VALUE*, void*);
+#define ruby_init_stack(addr) ruby_init_stack((addr), rb_ia64_bsp())
+#else
+void ruby_init_stack(volatile VALUE*);
+#endif
+#define Init_stack(addr) ruby_init_stack(addr)
+
+int ruby_setup(void);
+int ruby_cleanup(volatile int);
+
+void ruby_finalize(void);
+NORETURN(void ruby_stop(int));
+
+void ruby_set_stack_size(size_t);
+int ruby_stack_check(void);
+size_t ruby_stack_length(VALUE**);
+
+int ruby_exec_node(void *n);
+
+void ruby_script(const char* name);
+void ruby_set_script_name(VALUE name);
+
+void ruby_prog_init(void);
+void ruby_set_argv(int, char**);
+void *ruby_process_options(int, char**);
+void ruby_init_loadpath(void);
+void ruby_incpush(const char*);
+void ruby_sig_finalize(void);
+
+/*! @} */
+
+RUBY_SYMBOL_EXPORT_END
+
#if defined(__cplusplus)
#if 0
{ /* satisfy cc-mode */
diff --git a/include/ruby/st.h b/include/ruby/st.h
index 68cc511809..e71301b519 100644
--- a/include/ruby/st.h
+++ b/include/ruby/st.h
@@ -14,29 +14,14 @@ 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;
#elif SIZEOF_LONG_LONG == SIZEOF_VOIDP
typedef unsigned LONG_LONG st_data_t;
#else
-# error ---->> st.c requires sizeof(void*) == sizeof(long) to be compiled. <<----
+# error ---->> st.c requires sizeof(void*) == sizeof(long) or sizeof(LONG_LONG) to be compiled. <<----
#endif
#define ST_DATA_T_DEFINED
@@ -91,8 +76,16 @@ struct st_table {
__extension__
#endif
st_index_t num_entries : ST_INDEX_BITS - 1;
- struct st_table_entry **bins;
- struct st_table_entry *head, *tail;
+ union {
+ struct {
+ struct st_table_entry **bins;
+ struct st_table_entry *head, *tail;
+ } big;
+ struct {
+ struct st_packed_entry *entries;
+ st_index_t real_entries;
+ } packed;
+ } as;
};
#define st_is_member(table,key) st_lookup((table),(key),(st_data_t *)0)
@@ -114,7 +107,10 @@ 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);
+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);
void st_add_direct(st_table *, st_data_t, st_data_t);
void st_free_table(st_table *);
@@ -123,8 +119,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);
@@ -133,9 +131,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/subst.h b/include/ruby/subst.h
index 6c01b25900..1f0e6db5a4 100644
--- a/include/ruby/subst.h
+++ b/include/ruby/subst.h
@@ -16,5 +16,4 @@
#undef close
#define close ruby_close
#endif
-
#endif
diff --git a/include/ruby/thread.h b/include/ruby/thread.h
new file mode 100644
index 0000000000..550f678e54
--- /dev/null
+++ b/include/ruby/thread.h
@@ -0,0 +1,45 @@
+/**********************************************************************
+
+ thread.h -
+
+ $Author: matz $
+ created at: Tue Jul 10 17:35:43 JST 2012
+
+ Copyright (C) 2007 Yukihiro Matsumoto
+
+**********************************************************************/
+
+#ifndef RUBY_THREAD_H
+#define RUBY_THREAD_H 1
+
+#if defined(__cplusplus)
+extern "C" {
+#if 0
+} /* satisfy cc-mode */
+#endif
+#endif
+
+#include "ruby/intern.h"
+
+RUBY_SYMBOL_EXPORT_BEGIN
+
+void *rb_thread_call_with_gvl(void *(*func)(void *), void *data1);
+
+void *rb_thread_call_without_gvl(void *(*func)(void *), void *data1,
+ rb_unblock_function_t *ubf, void *data2);
+void *rb_thread_call_without_gvl2(void *(*func)(void *), void *data1,
+ rb_unblock_function_t *ubf, void *data2);
+
+#define RUBY_CALL_WO_GVL_FLAG_SKIP_CHECK_INTS_AFTER 0x01
+#define RUBY_CALL_WO_GVL_FLAG_SKIP_CHECK_INTS_
+
+RUBY_SYMBOL_EXPORT_END
+
+#if defined(__cplusplus)
+#if 0
+{ /* satisfy cc-mode */
+#endif
+} /* extern "C" { */
+#endif
+
+#endif /* RUBY_THREAD_H */
diff --git a/include/ruby/util.h b/include/ruby/util.h
index e82f537728..5be5f2e0b4 100644
--- a/include/ruby/util.h
+++ b/include/ruby/util.h
@@ -45,9 +45,7 @@ extern "C" {
#endif
#endif
-#if defined __GNUC__ && __GNUC__ >= 4
-#pragma GCC visibility push(default)
-#endif
+RUBY_SYMBOL_EXPORT_BEGIN
#define scan_oct(s,l,e) ((int)ruby_scan_oct((s),(l),(e)))
unsigned long ruby_scan_oct(const char *, size_t, size_t *);
@@ -62,7 +60,7 @@ void ruby_unsetenv(const char *);
#undef setenv
#undef unsetenv
#define setenv(name,val) ruby_setenv((name),(val))
-#define unsetenv(name,val) ruby_unsetenv(name);
+#define unsetenv(name,val) ruby_unsetenv(name)
char *ruby_strdup(const char *);
#undef strdup
@@ -85,9 +83,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 458efff320..4ffcc7a9ad 100644
--- a/include/ruby/version.h
+++ b/include/ruby/version.h
@@ -30,9 +30,9 @@
#define RUBY_BIRTH_DAY 24
/* API version */
-#define RUBY_API_VERSION_MAJOR 1
-#define RUBY_API_VERSION_MINOR 9
-#define RUBY_API_VERSION_TEENY 1
+#define RUBY_API_VERSION_MAJOR 2
+#define RUBY_API_VERSION_MINOR 1
+#define RUBY_API_VERSION_TEENY 0
#define RUBY_API_VERSION_CODE (RUBY_API_VERSION_MAJOR*10000+RUBY_API_VERSION_MINOR*100+RUBY_API_VERSION_TEENY)
#ifdef RUBY_EXTERN
@@ -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 99382f48e3..96b2f3f8a2 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
@@ -20,16 +18,16 @@ extern "C" {
*
*/
-//
-// Definitions for NT port of Perl
-//
+/*
+ * Definitions for NT port of Perl
+ */
-//
-// Ok now we can include the normal include files.
-//
+/*
+ * Ok now we can include the normal include files.
+ */
-// #include <stdarg.h> conflict with varargs.h?
+/* #include <stdarg.h> conflict with varargs.h? */
#if !defined(WSAAPI)
#if defined(__cplusplus) && defined(_MSC_VER)
extern "C++" { /* template without extern "C++" */
@@ -39,17 +37,18 @@ 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
#endif
-#define NT 1 /* deprecated */
-
-//
-// We're not using Microsoft's "extensions" to C for
-// Structured Exception Handling (SEH) so we can nuke these
-//
+/*
+ * We're not using Microsoft's "extensions" to C for
+ * Structured Exception Handling (SEH) so we can nuke these
+ */
#undef try
#undef except
#undef finally
@@ -89,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;
@@ -97,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
@@ -105,17 +119,15 @@ typedef unsigned int uintptr_t;
# include <unistd.h>
#endif
-#ifdef WIN95
-extern DWORD rb_w32_osid(void);
-#define rb_w32_iswinnt() (rb_w32_osid() == VER_PLATFORM_WIN32_NT)
-#define rb_w32_iswin95() (rb_w32_osid() == VER_PLATFORM_WIN32_WINDOWS)
-#else
#define rb_w32_iswinnt() TRUE
#define rb_w32_iswin95() FALSE
-#endif
#define WNOHANG -1
+typedef int clockid_t;
+#define CLOCK_REALTIME 0
+#define CLOCK_MONOTONIC 1
+
#undef getc
#undef putc
#undef fgetc
@@ -230,7 +242,27 @@ struct msghdr {
int msg_flags;
};
-#define NtInitialize ruby_sysinit
+/* 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);
@@ -265,15 +297,18 @@ 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 *);
extern int rb_w32_rename(const char *, const char *);
extern int rb_w32_urename(const char *, const char *);
extern char **rb_w32_get_environ(void);
extern void rb_w32_free_environ(char **);
extern int rb_w32_map_errno(DWORD);
-extern char * WSAAPI rb_w32_inet_ntop(int,void *,char *,size_t);
+extern const char *WSAAPI rb_w32_inet_ntop(int,const void *,char *,size_t);
extern DWORD rb_w32_osver(void);
extern int chown(const char *, int, int);
@@ -281,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);
@@ -315,6 +355,20 @@ extern FILE *rb_w32_fsopen(const char *, const char *, int);
#endif
#include <float.h>
+
+#if defined _MSC_VER && _MSC_VER >= 1800 && defined INFINITY
+#pragma warning(push)
+#pragma warning(disable:4756)
+static inline float
+rb_infinity_float(void)
+{
+ return INFINITY;
+}
+#pragma warning(pop)
+#undef INFINITY
+#define INFINITY rb_infinity_float()
+#endif
+
#if !defined __MINGW32__ || defined __NO_ISOCEXT
#ifndef isnan
#define isnan(x) _isnan(x)
@@ -332,6 +386,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
@@ -381,16 +437,14 @@ scalb(double a, long b)
#define S_IXOTH 0001
#endif
-//
-// define this so we can do inplace editing
-//
+/*
+ * define this so we can do inplace editing
+ */
#define SUFFIX
extern int rb_w32_ftruncate(int fd, off_t length);
extern int rb_w32_truncate(const char *path, off_t length);
-extern 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
@@ -408,25 +462,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
-#endif
-
-//
-// stubs
-//
+/*
+ * stubs
+ */
extern int ioctl (int, int, ...);
extern rb_uid_t getuid (void);
extern rb_uid_t geteuid (void);
@@ -435,6 +473,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
@@ -571,7 +611,16 @@ extern char *rb_w32_strerror(int);
# define EREMOTE WSAEREMOTE
#endif
-#define F_SETFL 1
+#define F_DUPFD 0
+#if 0
+#define F_GETFD 1
+#define F_SETFD 2
+#define F_GETFL 3
+#endif
+#define F_SETFL 4
+#if 0
+#define FD_CLOEXEC 1 /* F_GETFD, F_SETFD */
+#endif
#define O_NONBLOCK 1
#undef FD_SET
@@ -671,9 +720,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)
@@ -699,8 +745,10 @@ struct tms {
int rb_w32_times(struct tms *);
+struct tm *gmtime_r(const time_t *, struct tm *);
+struct tm *localtime_r(const time_t *, struct tm *);
+
/* thread stuff */
-HANDLE GetCurrentThreadHandle(void);
int rb_w32_sleep(unsigned long msec);
int rb_w32_putc(int, FILE*);
int rb_w32_getc(FILE*);
@@ -718,6 +766,8 @@ long rb_w32_write_console(uintptr_t, int); /* use uintptr_t instead of VALUE bec
int WINAPI rb_w32_Sleep(unsigned long msec);
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);
/*
== ***CAUTION***
@@ -729,11 +779,10 @@ 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 */
/* get rid of bugs in math.h of mingw */
#define frexp(_X, _Y) __extension__ ({\
int intpart_frexp_bug = intpart_frexp_bug;\
@@ -741,6 +790,7 @@ uintptr_t rb_w32_asynchronize(asynchronous_func_t func, uintptr_t self, int argc
*(_Y) = intpart_frexp_bug;\
result_frexp_bug;\
})
+/* License: Ruby's */
#define modf(_X, _Y) __extension__ ({\
double intpart_modf_bug = intpart_modf_bug;\
double result_modf_bug = modf((_X), &intpart_modf_bug);\
@@ -756,7 +806,7 @@ uintptr_t rb_w32_asynchronize(asynchronous_func_t func, uintptr_t self, int argc
} /* extern "C" { */
#endif
-#ifdef __MINGW64__
+#if defined(__MINGW64__)
/*
* Use powl() instead of broken pow() of x86_64-w64-mingw32.
* This workaround will fix test failures in test_bignum.rb,
@@ -767,6 +817,10 @@ rb_w32_pow(double x, double y)
{
return powl(x, y);
}
+#elif defined(__MINGW64_VERSION_MAJOR)
+double rb_w32_pow(double x, double y);
+#endif
+#if defined(__MINGW64_VERSION_MAJOR) || defined(__MINGW64__)
#define pow rb_w32_pow
#endif
diff --git a/inits.c b/inits.c
index 73b9eb4283..fe0aade090 100644
--- a/inits.c
+++ b/inits.c
@@ -60,5 +60,6 @@ rb_call_inits(void)
CALL(Rational);
CALL(Complex);
CALL(version);
+ CALL(vm_trace);
}
#undef CALL
diff --git a/insns.def b/insns.def
index 45eca2ed52..63a36b3979 100644
--- a/insns.def
+++ b/insns.def
@@ -1,4 +1,4 @@
-/** ##skip -*- mode:c; style:ruby; coding: shift_jis -*-
+/** ##skip -*- mode:c; style:ruby; coding: utf-8 -*-
insns.def - YARV instruction definitions
$Author: $
@@ -46,36 +46,52 @@ nop
/**
@c variable
- @e get local variable value (which is pointed by idx).
- @j idx ‚ÅŽw’肳‚ꂽƒ[ƒJƒ‹•Ï”‚ðƒXƒ^ƒbƒN‚É’u‚­B
+ @e Get local variable (pointed by `idx' and `level').
+ 'level' indicates the nesting depth from the current block.
+ @j level, idx ã§æŒ‡å®šã•れãŸãƒ­ãƒ¼ã‚«ãƒ«å¤‰æ•°ã®å€¤ã‚’スタックã«ç½®ã。
+ level ã¯ãƒ–ロックã®ãƒã‚¹ãƒˆãƒ¬ãƒ™ãƒ«ã§ã€ä½•段上ã‹ã‚’示ã™ã€‚
*/
DEFINE_INSN
getlocal
-(lindex_t idx)
+(lindex_t idx, rb_num_t level)
()
(VALUE val)
{
- val = *(GET_LFP() - idx);
+ int i, lev = (int)level;
+ VALUE *ep = GET_EP();
+
+ for (i = 0; i < lev; i++) {
+ ep = GET_PREV_EP(ep);
+ }
+ val = *(ep - idx);
}
/**
@c variable
- @e set local variable value (which is pointed by idx) as val.
- @j idx ‚ÅŽw’肳‚ꂽƒ[ƒJƒ‹•Ï”‚ð val ‚ÉÝ’è‚·‚éB
+ @e Set a local variable (pointed to by 'idx') as val.
+ 'level' indicates the nesting depth from the current block.
+ @j level, idx ã§æŒ‡å®šã•れãŸãƒ­ãƒ¼ã‚«ãƒ«å¤‰æ•°ã®å€¤ã‚’ val ã«ã™ã‚‹ã€‚
+ level ã¯ãƒ–ロックã®ãƒã‚¹ãƒˆãƒ¬ãƒ™ãƒ«ã§ã€ä½•段上ã‹ã‚’示ã™ã€‚
*/
DEFINE_INSN
setlocal
-(lindex_t idx)
+(lindex_t idx, rb_num_t level)
(VALUE val)
()
{
- (*(GET_LFP() - idx)) = val;
+ int i, lev = (int)level;
+ VALUE *ep = GET_EP();
+
+ for (i = 0; i < lev; i++) {
+ ep = GET_PREV_EP(ep);
+ }
+ *(ep - idx) = val;
}
/**
@c variable
- @e get special local variable ($~, $_, ..) value.
- @j “ÁŽê‚ȃ[ƒJƒ‹•Ï”i$~, $_, ...j‚Ì’l‚𓾂éB
+ @e Get value of special local variable ($~, $_, ..).
+ @j 特殊ãªãƒ­ãƒ¼ã‚«ãƒ«å¤‰æ•°ï¼ˆ$~, $_, ...)ã®å€¤ã‚’得る。
*/
DEFINE_INSN
getspecial
@@ -83,13 +99,13 @@ getspecial
()
(VALUE val)
{
- val = vm_getspecial(th, GET_LFP(), key, type);
+ val = vm_getspecial(th, GET_LEP(), key, type);
}
/**
@c variable
- @e set special local variable ($~, $_, ...) value as obj.
- @j “Á•ʂȃ[ƒJƒ‹•Ï”i$~, $_, ...j‚Ì’l‚ðÝ’è‚·‚éB
+ @e Set value of special local variable ($~, $_, ...) to obj.
+ @j 特別ãªãƒ­ãƒ¼ã‚«ãƒ«å¤‰æ•°ï¼ˆ$~, $_, ...)ã®å€¤ã‚’設定ã™ã‚‹ã€‚
*/
DEFINE_INSN
setspecial
@@ -97,56 +113,14 @@ setspecial
(VALUE obj)
()
{
- lfp_svar_set(th, GET_LFP(), key, obj);
-}
-
-/**
- @c variable
- @e get block local variable(which is pointed by idx and level).
- level means nest level of block, and specify how above this variable.
- @j level, idx ‚ÅŽw’肳‚ꂽƒuƒƒbƒNƒ[ƒJƒ‹•Ï”‚Ì’l‚ðƒXƒ^ƒbƒN‚É’u‚­B
- level ‚̓uƒƒbƒN‚̃lƒXƒgƒŒƒxƒ‹‚ÅA‰½’iã‚©‚ðŽ¦‚·B
- */
-DEFINE_INSN
-getdynamic
-(dindex_t idx, rb_num_t level)
-()
-(VALUE val)
-{
- rb_num_t i;
- VALUE *dfp2 = GET_DFP();
- for (i = 0; i < level; i++) {
- dfp2 = GET_PREV_DFP(dfp2);
- }
- val = *(dfp2 - idx);
+ lep_svar_set(th, GET_LEP(), key, obj);
}
/**
@c variable
- @e set block local variable(which is pointed by 'idx') as val.
- level means nest level of block, and specify how above this variable.
- @j level, idx ‚ÅŽw’肳‚ꂽƒuƒƒbƒNƒ[ƒJƒ‹•Ï”‚Ì’l‚ð val ‚É‚·‚éB
- level ‚̓uƒƒbƒN‚̃lƒXƒgƒŒƒxƒ‹‚ÅA‰½’iã‚©‚ðŽ¦‚·B
- */
-DEFINE_INSN
-setdynamic
-(dindex_t idx, rb_num_t level)
-(VALUE val)
-()
-{
- rb_num_t i;
- VALUE *dfp2 = GET_DFP();
- for (i = 0; i < level; i++) {
- dfp2 = GET_PREV_DFP(dfp2);
- }
- *(dfp2 - idx) = val;
-}
-
-/**
- @c variable
- @e get instance variable id of obj.
- if is_local is not 0, search as class local variable.
- @j self ‚̃Cƒ“ƒXƒ^ƒ“ƒX•Ï” id ‚Ì’l‚𓾂éB
+ @e Get value of instance variable id of self.
+ If is_local is not 0, get value of class local variable.
+ @j self ã®ã‚¤ãƒ³ã‚¹ã‚¿ãƒ³ã‚¹å¤‰æ•° id ã®å€¤ã‚’得る。
*/
DEFINE_INSN
getinstancevariable
@@ -154,14 +128,14 @@ getinstancevariable
()
(VALUE val)
{
- val = vm_getivar(GET_SELF(), id, ic);
+ val = vm_getinstancevariable(GET_SELF(), id, ic);
}
/**
@c variable
- @e set instance variable id of obj as val.
- if is_local is not 0, search as class local variable.
- @j self ‚̃Cƒ“ƒXƒ^ƒ“ƒX•Ï” id ‚ð val ‚É‚·‚éB
+ @e Set value of instance variable id of self to val.
+ If is_local is not 0, set value of class local variable.
+ @j self ã®ã‚¤ãƒ³ã‚¹ã‚¿ãƒ³ã‚¹å¤‰æ•° id ã‚’ val ã«ã™ã‚‹ã€‚
*/
DEFINE_INSN
setinstancevariable
@@ -169,13 +143,13 @@ setinstancevariable
(VALUE val)
()
{
- vm_setivar(GET_SELF(), id, val, ic);
+ vm_setinstancevariable(GET_SELF(), id, val, ic);
}
/**
@c variable
- @e get class variable id of klass as val.
- @j Œ»Ý‚̃XƒR[ƒv‚̃Nƒ‰ƒX•Ï” id ‚Ì’l‚𓾂éB
+ @e Get value of class variable id of klass as val.
+ @j ç¾åœ¨ã®ã‚¹ã‚³ãƒ¼ãƒ—ã®ã‚¯ãƒ©ã‚¹å¤‰æ•° id ã®å€¤ã‚’得る。
*/
DEFINE_INSN
getclassvariable
@@ -183,14 +157,14 @@ getclassvariable
()
(VALUE val)
{
- NODE * const cref = vm_get_cref(GET_ISEQ(), GET_LFP(), GET_DFP());
- val = rb_cvar_get(vm_get_cvar_base(cref), id);
+ NODE *cref = rb_vm_get_cref(GET_ISEQ(), GET_EP());
+ val = rb_cvar_get(vm_get_cvar_base(cref, GET_CFP()), id);
}
/**
@c variable
- @e set class variable id of klass as val.
- @j klass ‚̃Nƒ‰ƒX•Ï” id ‚ð val ‚É‚·‚éB
+ @e Set value of class variable id of klass as val.
+ @j klass ã®ã‚¯ãƒ©ã‚¹å¤‰æ•° id ã‚’ val ã«ã™ã‚‹ã€‚
*/
DEFINE_INSN
setclassvariable
@@ -198,21 +172,21 @@ setclassvariable
(VALUE val)
()
{
- NODE * const cref = vm_get_cref(GET_ISEQ(), GET_LFP(), GET_DFP());
- rb_cvar_set(vm_get_cvar_base(cref), id, val);
+ NODE *cref = rb_vm_get_cref(GET_ISEQ(), GET_EP());
+ rb_cvar_set(vm_get_cvar_base(cref, GET_CFP()), id, val);
}
/**
@c variable
@e
- get constant variable id. if klass is Qnil, constant
- are searched in current scope. if klass is Qfalse, constant as
- top level constant. otherwise, get constant under klass
+ Get constant variable id. If klass is Qnil, constants
+ are searched in the current scope. If klass is Qfalse, constants
+ are searched as top level constants. Otherwise, get constant under klass
class or module.
- @j ’è” id ‚Ì’l‚𓾂éB
- klass ‚ª Qnil ‚È‚çA‚»‚̃XƒR[ƒv‚Å“¾‚ç‚ê‚é’蔂̒l‚𓾂éB
- Qfalse ‚È‚çAƒgƒbƒvƒŒƒxƒ‹ƒXƒR[ƒv‚𓾂éB
- ‚»‚êˆÈŠO‚È‚çAklass ƒNƒ‰ƒX‚̉º‚̒蔂𓾂éB
+ @j 定数 id ã®å€¤ã‚’得る。
+ klass ㌠Qnil ãªã‚‰ã€ãã®ã‚¹ã‚³ãƒ¼ãƒ—ã§å¾—られる定数ã®å€¤ã‚’得る。
+ Qfalse ãªã‚‰ã€ãƒˆãƒƒãƒ—レベルスコープを得る。
+ ãれ以外ãªã‚‰ã€klass クラスã®ä¸‹ã®å®šæ•°ã‚’得る。
*/
DEFINE_INSN
getconstant
@@ -226,15 +200,15 @@ getconstant
/**
@c variable
@e
- set constant variable id. if klass is Qfalse, constant
+ Set constant variable id. If klass is Qfalse, constant
is able to access in this scope. if klass is Qnil, set
top level constant. otherwise, set constant under klass
class or module.
- @j ’è” id ‚Ì’l‚ð val ‚É‚·‚éB
- klass ‚ª Qfalse ‚È‚çA‚»‚̃XƒR[ƒv‚Å“¾‚ç‚ê‚é’è” id ‚Ì’l‚ðÝ’è‚·‚éB
- Qnil ‚È‚çAƒgƒbƒvƒŒƒxƒ‹ƒXƒR[ƒv‚Ì’l‚ðÝ’è‚·‚éB
- ‚»‚êˆÈŠO‚È‚çAklass ƒNƒ‰ƒX‚̉º‚̒蔂ðÝ’è‚·‚éB
+ @j 定数 id ã®å€¤ã‚’ val ã«ã™ã‚‹ã€‚
+ klass ㌠Qfalse ãªã‚‰ã€ãã®ã‚¹ã‚³ãƒ¼ãƒ—ã§å¾—られる定数 id ã®å€¤ã‚’設定ã™ã‚‹ã€‚
+ Qnil ãªã‚‰ã€ãƒˆãƒƒãƒ—レベルスコープã®å€¤ã‚’設定ã™ã‚‹ã€‚
+ ãれ以外ãªã‚‰ã€klass クラスã®ä¸‹ã®å®šæ•°ã‚’設定ã™ã‚‹ã€‚
*/
DEFINE_INSN
setconstant
@@ -244,13 +218,12 @@ setconstant
{
vm_check_if_namespace(cbase);
rb_const_set(cbase, id, val);
- INC_VM_STATE_VERSION();
}
/**
@c variable
@e get global variable id.
- @j ƒOƒ[ƒoƒ‹•Ï” id ‚Ì’l‚𓾂éB
+ @j グローãƒãƒ«å¤‰æ•° id ã®å€¤ã‚’得る。
*/
DEFINE_INSN
getglobal
@@ -264,7 +237,7 @@ getglobal
/**
@c variable
@e set global variable id as val.
- @j ƒOƒ[ƒoƒ‹•Ï” id ‚Ì’l‚ðÝ’è‚·‚éB
+ @j グローãƒãƒ«å¤‰æ•° id ã®å€¤ã‚’設定ã™ã‚‹ã€‚
*/
DEFINE_INSN
setglobal
@@ -283,7 +256,7 @@ setglobal
/**
@c put
@e put nil to stack.
- @j ƒXƒ^ƒbƒN‚É nil ‚ðƒvƒbƒVƒ…‚·‚éB
+ @j スタック㫠nil をプッシュã™ã‚‹ã€‚
*/
DEFINE_INSN
putnil
@@ -297,7 +270,7 @@ putnil
/**
@c put
@e put self.
- @j ƒXƒ^ƒbƒN‚É self ‚ðƒvƒbƒVƒ…‚·‚éB
+ @j スタック㫠self をプッシュã™ã‚‹ã€‚
*/
DEFINE_INSN
putself
@@ -312,7 +285,7 @@ putself
@c put
@e put some object.
i.e. Fixnum, true, false, nil, and so on.
- @j ƒIƒuƒWƒFƒNƒg val ‚ðƒXƒ^ƒbƒN‚ɃvƒbƒVƒ…‚·‚éB
+ @j オブジェクト val をスタックã«ãƒ—ッシュã™ã‚‹ã€‚
i.e. Fixnum, true, false, nil, and so on.
*/
DEFINE_INSN
@@ -327,8 +300,8 @@ putobject
/**
@c put
@e put special object. "value_type" is for expansion.
- @j “Á•ʂȃIƒuƒWƒFƒNƒg val ‚ðƒXƒ^ƒbƒN‚ɃvƒbƒVƒ…‚·‚éB
- ƒIƒuƒWƒFƒNƒg‚ÌŽí—Þ‚Í value_type ‚É‚æ‚éD
+ @j 特別ãªã‚ªãƒ–ジェクト val をスタックã«ãƒ—ッシュã™ã‚‹ã€‚
+ オブジェクトã®ç¨®é¡žã¯ value_type ã«ã‚ˆã‚‹ï¼Ž
*/
DEFINE_INSN
putspecialobject
@@ -343,10 +316,10 @@ putspecialobject
val = rb_mRubyVMFrozenCore;
break;
case VM_SPECIAL_OBJECT_CBASE:
- val = vm_get_cbase(GET_ISEQ(), GET_LFP(), GET_DFP());
+ val = vm_get_cbase(GET_ISEQ(), GET_EP());
break;
case VM_SPECIAL_OBJECT_CONST_BASE:
- val = vm_get_const_base(GET_ISEQ(), GET_LFP(), GET_DFP());
+ val = vm_get_const_base(GET_ISEQ(), GET_EP());
break;
default:
rb_bug("putspecialobject insn: unknown value_type");
@@ -370,7 +343,7 @@ putiseq
/**
@c put
@e put string val. string will be copied.
- @j •¶Žš—ñ‚ðƒRƒs[‚µ‚ăXƒ^ƒbƒN‚ɃvƒbƒVƒ…‚·‚éB
+ @j 文字列をコピーã—ã¦ã‚¹ã‚¿ãƒƒã‚¯ã«ãƒ—ッシュã™ã‚‹ã€‚
*/
DEFINE_INSN
putstring
@@ -384,7 +357,7 @@ putstring
/**
@c put
@e put concatenate strings
- @j ƒXƒ^ƒbƒNƒgƒbƒv‚Ì•¶Žš—ñ‚ð n ŒÂ˜AŒ‹‚µCŒ‹‰Ê‚ðƒXƒ^ƒbƒN‚ɃvƒbƒVƒ…‚·‚éB
+ @j ã‚¹ã‚¿ãƒƒã‚¯ãƒˆãƒƒãƒ—ã®æ–‡å­—列を n 個連çµã—ï¼Œçµæžœã‚’スタックã«ãƒ—ッシュã™ã‚‹ã€‚
*/
DEFINE_INSN
concatstrings
@@ -405,7 +378,7 @@ concatstrings
/**
@c put
@e to_str
- @j to_str ‚ÌŒ‹‰Ê‚ðƒXƒ^ƒbƒN‚ɃvƒbƒVƒ…‚·‚éB
+ @j to_str ã®çµæžœã‚’スタックã«ãƒ—ッシュã™ã‚‹ã€‚
*/
DEFINE_INSN
tostring
@@ -419,8 +392,8 @@ tostring
/**
@c put
@e to Regexp
- @j •¶Žš—ñ str ‚ð³‹K•\Œ»‚ɃRƒ“ƒpƒCƒ‹‚µ‚ăXƒ^ƒbƒN‚ɃvƒbƒVƒ…‚·‚éB
- ƒRƒ“ƒpƒCƒ‹ŽžCopt ‚ð³‹K•\Œ»‚̃IƒvƒVƒ‡ƒ“‚Æ‚·‚éB
+ @j 文字列 str ã‚’æ­£è¦è¡¨ç¾ã«ã‚³ãƒ³ãƒ‘イルã—ã¦ã‚¹ã‚¿ãƒƒã‚¯ã«ãƒ—ッシュã™ã‚‹ã€‚
+ コンパイル時,opt ã‚’æ­£è¦è¡¨ç¾ã®ã‚ªãƒ—ションã¨ã™ã‚‹ã€‚
*/
DEFINE_INSN
toregexp
@@ -442,7 +415,7 @@ toregexp
/**
@c put
@e put new array.
- @j V‚µ‚¢”z—ñ‚ðƒXƒ^ƒbƒNã‚Ì num ŒÂ‚Ì’l‚ʼnŠú‰»‚µ‚ͬ‚µƒvƒbƒVƒ…‚·‚éB
+ @j æ–°ã—ã„é…列をスタック上㮠num 個ã®å€¤ã§åˆæœŸåŒ–ã—ã¦ç”Ÿæˆã—プッシュã™ã‚‹ã€‚
*/
DEFINE_INSN
newarray
@@ -457,7 +430,7 @@ newarray
/**
@c put
@e dup array
- @j ”z—ñ ary ‚ð dup ‚µ‚ăXƒ^ƒbƒN‚ɃvƒbƒVƒ…‚·‚éB
+ @j é…列 ary ã‚’ dup ã—ã¦ã‚¹ã‚¿ãƒƒã‚¯ã«ãƒ—ッシュã™ã‚‹ã€‚
*/
DEFINE_INSN
duparray
@@ -471,13 +444,13 @@ duparray
/**
@c put
@e expand array to num objects.
- @j ƒXƒ^ƒbƒNƒgƒbƒv‚̃IƒuƒWƒFƒNƒg‚ª”z—ñ‚Å‚ ‚ê‚ÎA‚»‚ê‚ð“WŠJ‚·‚éB
- ”z—ñƒIƒuƒWƒFƒNƒg‚Ì—v‘f”‚ª numˆÈ‰º‚È‚ç‚ÎA‘ã‚í‚è‚É nil ‚ðÏ‚ÞBnumˆÈã‚È‚çA
- numˆÈã‚Ì—v‘f‚ÍØ‚èŽÌ‚Ä‚éB
- ”z—ñƒIƒuƒWƒFƒNƒg‚łȂ¯‚ê‚ÎAnum - 1 ŒÂ‚Ì nil ‚ðÏ‚ÞB
- ‚à‚µ flag ‚ª^‚È‚çAŽc‚è—v‘f‚Ì”z—ñ‚ðÏ‚Þ
- flag: 0x01 - ÅŒã‚ð”z—ñ‚É
- flag: 0x02 - postarg —p
+ @j スタックトップã®ã‚ªãƒ–ジェクトãŒé…列ã§ã‚れã°ã€ãれを展開ã™ã‚‹ã€‚
+ é…列オブジェクトã®è¦ç´ æ•°ãŒ num以下ãªã‚‰ã°ã€ä»£ã‚り㫠nil ã‚’ç©ã‚€ã€‚num以上ãªã‚‰ã€
+ num以上ã®è¦ç´ ã¯åˆ‡ã‚Šæ¨ã¦ã‚‹ã€‚
+ é…列オブジェクトã§ãªã‘れã°ã€num - 1 個㮠nil ã‚’ç©ã‚€ã€‚
+ ã‚‚ã— flag ãŒçœŸãªã‚‰ã€æ®‹ã‚Šè¦ç´ ã®é…列をç©ã‚€
+ flag: 0x01 - 最後をé…列ã«
+ flag: 0x02 - postarg 用
flag: 0x04 - reverse?
*/
DEFINE_INSN
@@ -492,7 +465,7 @@ expandarray
/**
@c put
@e concat two arrays
- @j “ñ‚‚̔z—ñ ary1, ary2 ‚ð˜AŒ‹‚µƒXƒ^ƒbƒN‚ÖƒvƒbƒVƒ…‚·‚éB
+ @j 二ã¤ã®é…列 ary1, ary2 を連çµã—スタックã¸ãƒ—ッシュã™ã‚‹ã€‚
*/
DEFINE_INSN
concatarray
@@ -521,7 +494,7 @@ concatarray
/**
@c put
@e splat array
- @j ”z—ñ ary ‚ɑ΂µ‚Ä to_a ‚ðŒÄ‚Ño‚·B
+ @j é…列 ary ã«å¯¾ã—㦠to_a を呼ã³å‡ºã™ã€‚
*/
DEFINE_INSN
splatarray
@@ -541,49 +514,9 @@ splatarray
/**
@c put
- @e check value is included in ary
- @j ”z—ñ ary ‚É—v‘f obj ‚ª“ü‚Á‚Ä‚¢‚é‚©‚Ç‚¤‚©ƒ`ƒFƒbƒNBcase/when ‚Å—˜—p‚·‚éB
- */
-DEFINE_INSN
-checkincludearray
-(VALUE flag)
-(VALUE obj, VALUE ary)
-(VALUE obj, VALUE result)
-{
- int i;
- result = Qfalse;
-
- if (TYPE(ary) != T_ARRAY) {
- ary = rb_Array(ary);
- }
-
- if (flag == Qtrue) {
- /* NODE_CASE */
- for (i = 0; i < RARRAY_LEN(ary); i++) {
- /* TODO: fix me (use another method dispatch) */
- if (RTEST(rb_funcall2(RARRAY_PTR(ary)[i], idEqq, 1, &obj))) {
- result = Qtrue;
- break;
- }
- }
- }
- else {
- obj = Qfalse;
- /* NODE_WHEN */
- for (i = 0; i < RARRAY_LEN(ary); i++) {
- if (RTEST(RARRAY_PTR(ary)[i])) {
- obj = result = Qtrue;
- break;
- }
- }
- }
-}
-
-/**
- @c put
@e put new Hash.
- @j V‚µ‚¢ƒnƒbƒVƒ…‚ðƒXƒ^ƒbƒNƒgƒbƒv‚Ì n ŒÂ‚ð‰Šú’l‚Æ‚µ‚ͬ‚·‚éB
- n ‚̓L[‚Æ’l‚̃yƒA‚Ȃ̂Š2 ‚Ì”{”‚łȂ¯‚ê‚΂Ȃç‚È‚¢B
+ @j æ–°ã—ã„ãƒãƒƒã‚·ãƒ¥ã‚’スタックトップ㮠n å€‹ã‚’åˆæœŸå€¤ã¨ã—ã¦ç”Ÿæˆã™ã‚‹ã€‚
+ n ã¯ã‚­ãƒ¼ã¨å€¤ã®ãƒšã‚¢ãªã®ã§ 2 ã®å€æ•°ã§ãªã‘れã°ãªã‚‰ãªã„。
*/
DEFINE_INSN
newhash
@@ -592,6 +525,11 @@ newhash
(VALUE val) // inc += 1 - num;
{
rb_num_t i;
+
+ if(RUBY_DTRACE_HASH_CREATE_ENABLED()) {
+ RUBY_DTRACE_HASH_CREATE(num, rb_sourcefile(), rb_sourceline());
+ }
+
val = rb_hash_new();
for (i = num; i > 0; i -= 2) {
@@ -605,7 +543,7 @@ newhash
/**
@c put
@e put new Range object.(Range.new(low, high, flag))
- @j Range.new(low, high, flag) ‚̂悤‚ȃIƒuƒWƒFƒNƒg‚𶬂µƒXƒ^ƒbƒN‚ɃvƒbƒVƒ…‚·‚éB
+ @j Range.new(low, high, flag) ã®ã‚ˆã†ãªã‚ªãƒ–ジェクトを生æˆã—スタックã«ãƒ—ッシュã™ã‚‹ã€‚
*/
DEFINE_INSN
newrange
@@ -623,7 +561,7 @@ newrange
/**
@c stack
@e pop from stack.
- @j ƒXƒ^ƒbƒN‚©‚çˆê‚ƒ|ƒbƒv‚·‚éB
+ @j スタックã‹ã‚‰ä¸€ã¤ãƒãƒƒãƒ—ã™ã‚‹ã€‚
*/
DEFINE_INSN
pop
@@ -638,7 +576,7 @@ pop
/**
@c stack
@e duplicate stack top.
- @j ƒXƒ^ƒbƒNƒgƒbƒv‚ðƒRƒs[‚µ‚ăXƒ^ƒbƒN‚ɃvƒbƒVƒ…‚·‚éB
+ @j スタックトップをコピーã—ã¦ã‚¹ã‚¿ãƒƒã‚¯ã«ãƒ—ッシュã™ã‚‹ã€‚
*/
DEFINE_INSN
dup
@@ -652,7 +590,7 @@ dup
/**
@c stack
@e duplicate stack top n elements
- @j ƒXƒ^ƒbƒNƒgƒbƒv‚Ì n ŒÂ‚ðƒRƒs[‚µ‚ăXƒ^ƒbƒN‚ɃvƒbƒVƒ…‚·‚éB
+ @j スタックトップ㮠n 個をコピーã—ã¦ã‚¹ã‚¿ãƒƒã‚¯ã«ãƒ—ッシュã™ã‚‹ã€‚
*/
DEFINE_INSN
dupn
@@ -672,7 +610,7 @@ dupn
/**
@c stack
@e swap top 2 vals
- @j ƒXƒ^ƒbƒNƒgƒbƒv‚Ì 2 ‚‚̒l‚ðŒðŠ·‚·‚éB
+ @j スタックトップ㮠2 ã¤ã®å€¤ã‚’交æ›ã™ã‚‹ã€‚
*/
DEFINE_INSN
swap
@@ -686,7 +624,7 @@ swap
/**
@c stack
@e for stack caching.
- @j ƒXƒ^ƒbƒNƒLƒƒƒbƒVƒ“ƒO‚Ìó‘Ô‚ð’²®‚·‚邽‚߂ɕK—v‚È–½—ßB
+ @j スタックキャッシングã®çŠ¶æ…‹ã‚’èª¿æ•´ã™ã‚‹ãŸã‚ã«å¿…è¦ãªå‘½ä»¤ã€‚
*/
DEFINE_INSN
reput
@@ -700,7 +638,7 @@ reput
/**
@c stack
@e get nth stack value from stack top
- @j ƒXƒ^ƒbƒNƒgƒbƒv‚©‚ç n ŒÂ–Ú‚ðƒXƒ^ƒbƒN‚ɃvƒbƒVƒ…‚·‚éB
+ @j スタックトップã‹ã‚‰ n 個目をスタックã«ãƒ—ッシュã™ã‚‹ã€‚
*/
DEFINE_INSN
topn
@@ -714,7 +652,7 @@ topn
/**
@c stack
@e set Nth stack entry to stack top
- @j ƒXƒ^ƒbƒNƒgƒbƒv‚Ì’l‚ð n ŒÂ–ڂ̃Xƒ^ƒbƒN‚ɃRƒs[
+ @j スタックトップã®å€¤ã‚’ n 個目ã®ã‚¹ã‚¿ãƒƒã‚¯ã«ã‚³ãƒ”ー
*/
DEFINE_INSN
setn
@@ -728,7 +666,7 @@ setn
/**
@c stack
@e empt current stack
- @j current stack ‚ð‹ó‚É‚·‚éB
+ @j current stack を空ã«ã™ã‚‹ã€‚
*/
DEFINE_INSN
adjuststack
@@ -747,7 +685,7 @@ adjuststack
/**
@c setting
@e defined?
- @j defined? ‚ðs‚¤B
+ @j defined? を行ã†ã€‚
*/
DEFINE_INSN
defined
@@ -756,7 +694,7 @@ defined
(VALUE val)
{
VALUE klass;
- const char *expr_type = 0;
+ enum defined_type expr_type = 0;
enum defined_type type = (enum defined_type)op_type;
val = Qnil;
@@ -764,48 +702,47 @@ defined
switch (type) {
case DEFINED_IVAR:
if (rb_ivar_defined(GET_SELF(), SYM2ID(obj))) {
- expr_type = "instance-variable";
+ expr_type = DEFINED_IVAR;
}
break;
case DEFINED_IVAR2:
- klass = vm_get_cbase(GET_ISEQ(), GET_LFP(), GET_DFP());
+ klass = vm_get_cbase(GET_ISEQ(), GET_EP());
break;
case DEFINED_GVAR:
if (rb_gvar_defined(rb_global_entry(SYM2ID(obj)))) {
- expr_type = "global-variable";
+ expr_type = DEFINED_GVAR;
}
break;
- case DEFINED_CVAR:
- {
- NODE *cref = vm_get_cref(GET_ISEQ(), GET_LFP(), GET_DFP());
- klass = vm_get_cvar_base(cref);
+ case DEFINED_CVAR: {
+ NODE *cref = rb_vm_get_cref(GET_ISEQ(), GET_EP());
+ klass = vm_get_cvar_base(cref, GET_CFP());
if (rb_cvar_defined(klass, SYM2ID(obj))) {
- expr_type = "class variable";
+ expr_type = DEFINED_CVAR;
}
break;
- }
+ }
case DEFINED_CONST:
klass = v;
if (vm_get_ev_const(th, GET_ISEQ(), klass, SYM2ID(obj), 1)) {
- expr_type = "constant";
+ expr_type = DEFINED_CONST;
}
break;
case DEFINED_FUNC:
klass = CLASS_OF(v);
if (rb_method_boundp(klass, SYM2ID(obj), 0)) {
- expr_type = "method";
+ expr_type = DEFINED_METHOD;
}
break;
case DEFINED_METHOD:{
VALUE klass = CLASS_OF(v);
- const rb_method_entry_t *me = rb_method_entry(klass, SYM2ID(obj));
+ const rb_method_entry_t *me = rb_method_entry(klass, SYM2ID(obj), 0);
if (me) {
if (!(me->flag & NOEX_PRIVATE)) {
if (!((me->flag & NOEX_PROTECTED) &&
!rb_obj_is_kind_of(GET_SELF(),
rb_class_real(klass)))) {
- expr_type = "method";
+ expr_type = DEFINED_METHOD;
}
}
}
@@ -814,37 +751,32 @@ defined
VALUE r;
args[0] = obj; args[1] = Qfalse;
- r = rb_check_funcall(v, rb_intern("respond_to_missing?"), 2, args);
- if (r != Qundef && RTEST(r))
- expr_type = "method";
+ r = rb_check_funcall(v, idRespond_to_missing, 2, args);
+ if (r != Qundef && RTEST(r))
+ expr_type = DEFINED_METHOD;
}
break;
}
case DEFINED_YIELD:
if (GET_BLOCK_PTR()) {
- expr_type = "yield";
+ expr_type = DEFINED_YIELD;
}
break;
case DEFINED_ZSUPER:{
- rb_iseq_t *iseq = GET_ISEQ();
- while (iseq) {
- if (iseq->defined_method_id) {
- break;
- }
- iseq = iseq->parent_iseq;
- }
- if (iseq) {
- VALUE klass = vm_search_normal_superclass(iseq->klass, GET_SELF());
- if (rb_method_boundp(klass, iseq->defined_method_id, 0)) {
- expr_type = "super";
+ rb_call_info_t cit;
+ if (vm_search_superclass(GET_CFP(), GET_ISEQ(), Qnil, &cit) == 0) {
+ VALUE klass = cit.klass;
+ ID id = cit.mid;
+ if (rb_method_boundp(klass, id, 0)) {
+ expr_type = DEFINED_ZSUPER;
}
}
break;
}
case DEFINED_REF:{
- val = vm_getspecial(th, GET_LFP(), Qfalse, FIX2INT(obj));
+ val = vm_getspecial(th, GET_LEP(), Qfalse, FIX2INT(obj));
if (val != Qnil) {
- expr_type = "global-variable";
+ expr_type = DEFINED_GVAR;
}
break;
}
@@ -854,7 +786,7 @@ defined
}
if (expr_type != 0) {
if (needstr != Qfalse) {
- val = rb_str_new2(expr_type);
+ val = rb_iseq_defined_string(expr_type);
}
else {
val = Qtrue;
@@ -864,8 +796,44 @@ defined
/**
@c setting
+ @e check `target' matches `pattern'.
+ `flag & VM_CHECKMATCH_TYPE_MASK' describe how to check pattern.
+ VM_CHECKMATCH_TYPE_WHEN: ignore target and check pattern is truthy.
+ VM_CHECKMATCH_TYPE_CASE: check `patten === target'.
+ VM_CHECKMATCH_TYPE_RESCUE: check `pattern.kind_op?(Module) && pattern == target'.
+ if `flag & VM_CHECKMATCH_ARRAY' is not 0, then `patten' is array of patterns.
+ @j see above comments.
+ */
+DEFINE_INSN
+checkmatch
+(rb_num_t flag)
+(VALUE target, VALUE pattern)
+(VALUE result)
+{
+ enum vm_check_match_type checkmatch_type =
+ (enum vm_check_match_type)(flag & VM_CHECKMATCH_TYPE_MASK);
+ result = Qfalse;
+
+ if (flag & VM_CHECKMATCH_ARRAY) {
+ int i;
+ for (i = 0; i < RARRAY_LEN(pattern); i++) {
+ if (RTEST(check_match(RARRAY_AREF(pattern, i), target, checkmatch_type))) {
+ result = Qtrue;
+ break;
+ }
+ }
+ }
+ else {
+ if (RTEST(check_match(pattern, target, checkmatch_type))) {
+ result = Qtrue;
+ }
+ }
+}
+
+/**
+ @c setting
@e trace
- @j trace —p‚Ì–½—ßB
+ @j trace 用ã®å‘½ä»¤ã€‚
*/
DEFINE_INSN
trace
@@ -875,7 +843,29 @@ trace
{
rb_event_flag_t flag = (rb_event_flag_t)nf;
- EXEC_EVENT_HOOK(th, flag, GET_SELF(), 0, 0 /* TODO: id, klass */);
+ if (RUBY_DTRACE_METHOD_ENTRY_ENABLED() ||
+ RUBY_DTRACE_METHOD_RETURN_ENABLED() ||
+ RUBY_DTRACE_CMETHOD_ENTRY_ENABLED() ||
+ RUBY_DTRACE_CMETHOD_RETURN_ENABLED()) {
+
+ switch(flag) {
+ case RUBY_EVENT_CALL:
+ RUBY_DTRACE_METHOD_ENTRY_HOOK(th, 0, 0);
+ break;
+ case RUBY_EVENT_C_CALL:
+ RUBY_DTRACE_CMETHOD_ENTRY_HOOK(th, 0, 0);
+ break;
+ case RUBY_EVENT_RETURN:
+ RUBY_DTRACE_METHOD_RETURN_HOOK(th, 0, 0);
+ break;
+ case RUBY_EVENT_C_RETURN:
+ RUBY_DTRACE_CMETHOD_RETURN_HOOK(th, 0, 0);
+ break;
+ }
+ }
+
+ EXEC_EVENT_HOOK(th, flag, GET_SELF(), 0, 0 /* id and klass are resolved at callee */,
+ (flag & (RUBY_EVENT_RETURN | RUBY_EVENT_B_RETURN)) ? TOPN(0) : Qundef);
}
/**********************************************************/
@@ -887,23 +877,29 @@ trace
@e
enter class definition scope. if super is Qfalse, and clsas
"klass" is defined, it's redefine. otherwise, define "klass" class.
- @j ƒNƒ‰ƒX’è‹`ƒXƒR[ƒv‚ÖˆÚs‚·‚éB
- ‚à‚µ super ‚ª Qfalse ‚Å klassƒNƒ‰ƒX‚ª’è‹`‚³‚ê‚Ä‚¢‚ê‚ÎÄ’è‹`‚Å‚ ‚éB
- ‚»‚¤‚łȂ¯‚ê‚ÎAklass ƒNƒ‰ƒX‚ð’è‹`‚·‚éB
+ @j クラス定義スコープã¸ç§»è¡Œã™ã‚‹ã€‚
+ ã‚‚ã— super ㌠Qfalse ã§ klassクラスãŒå®šç¾©ã•れã¦ã„れã°å†å®šç¾©ã§ã‚る。
+ ãã†ã§ãªã‘れã°ã€klass クラスを定義ã™ã‚‹ã€‚
*/
DEFINE_INSN
defineclass
-(ID id, ISEQ class_iseq, rb_num_t define_type)
+(ID id, ISEQ class_iseq, rb_num_t flags)
(VALUE cbase, VALUE super)
(VALUE val)
{
VALUE klass;
+ rb_vm_defineclass_type_t type = VM_DEFINECLASS_TYPE(flags);
- switch ((int)define_type) {
- case 0: /* scoped: class Foo::Bar */
- case 3: /* no scope: class Bar */
+ switch (type) {
+ case VM_DEFINECLASS_TYPE_CLASS:
/* val is dummy. classdef returns class scope value */
+ if (VM_DEFINECLASS_HAS_SUPERCLASS_P(flags) &&
+ !RB_TYPE_P(super, T_CLASS)) {
+ rb_raise(rb_eTypeError, "superclass must be a Class (%s given)",
+ rb_obj_classname(super));
+ }
+
if (super == Qnil) {
super = rb_cObject;
}
@@ -914,8 +910,9 @@ defineclass
rb_autoload_load(cbase, id);
if ((klass = vm_search_const_defined_class(cbase, id)) != 0) {
/* already exist */
- klass = define_type == 0 ? rb_public_const_get_at(klass, id) : rb_const_get_at(klass, id);
- if (TYPE(klass) != T_CLASS) {
+ klass = VM_DEFINECLASS_SCOPED_P(flags) ?
+ rb_public_const_get_at(klass, id) : rb_const_get_at(klass, id);
+ if (!RB_TYPE_P(klass, T_CLASS)) {
rb_raise(rb_eTypeError, "%s is not a class", rb_id2name(id));
}
@@ -937,13 +934,12 @@ defineclass
rb_class_inherited(super, klass);
}
break;
- case 1:
+ case VM_DEFINECLASS_TYPE_SINGLETON_CLASS:
/* val is dummy. classdef returns class scope value */
/* super is dummy */
klass = rb_singleton_class(cbase);
break;
- case 2: /* scoped: module Foo::Bar or module ::Bar */
- case 5: /* no scope: module Bar */
+ case VM_DEFINECLASS_TYPE_MODULE:
/* val is dummy. classdef returns class scope value */
/* super is dummy */
@@ -951,9 +947,10 @@ defineclass
/* find klass */
if ((klass = vm_search_const_defined_class(cbase, id)) != 0) {
- klass = define_type == 2 ? rb_public_const_get_at(klass, id) : rb_const_get_at(klass, id);
+ klass = VM_DEFINECLASS_SCOPED_P(flags) ?
+ rb_public_const_get_at(klass, id) : rb_const_get_at(klass, id);
/* already exist */
- if (TYPE(klass) != T_MODULE) {
+ if (!RB_TYPE_P(klass, T_MODULE)) {
rb_raise(rb_eTypeError, "%s is not a module", rb_id2name(id));
}
}
@@ -965,19 +962,17 @@ defineclass
}
break;
default:
- rb_bug("unknown defineclass type: %d", (int)define_type);
+ rb_bug("unknown defineclass type: %d", (int)type);
}
COPY_CREF(class_iseq->cref_stack, vm_cref_push(th, klass, NOEX_PUBLIC, NULL));
/* enter scope */
- vm_push_frame(th, class_iseq,
- VM_FRAME_MAGIC_CLASS, klass, (VALUE) GET_BLOCK_PTR(),
- class_iseq->iseq_encoded, GET_SP(), 0,
- class_iseq->local_size);
+ vm_push_frame(th, class_iseq, VM_FRAME_MAGIC_CLASS,
+ klass, 0, VM_ENVVAL_BLOCK_PTR(GET_BLOCK_PTR()),
+ class_iseq->iseq_encoded, GET_SP(),
+ class_iseq->local_size, 0, class_iseq->stack_max);
RESTORE_REGS();
-
- INC_VM_STATE_VERSION();
NEXT_INSN();
}
@@ -988,85 +983,88 @@ defineclass
/**
@c method/iterator
- @e obj.send(id, args..) # args.size => num
- @j ƒƒ\ƒbƒhŒÄ‚Ño‚µ‚ðs‚¤B
- obj.send(id, args..) # args.size => num
- flag & VM_CALL_ARGS_SPLAT_BIT != 0 -> splat last arg
- flag & VM_CALL_ARGS_BLOCKARG_BIT != 0 -> Proc as Block
- flag & VM_CALL_FCALL_BIT != 0 -> FCALL ( func() )
- flag & VM_CALL_VCALL_BIT != 0 -> VCALL ( func )
- ...
+ @e invoke method.
+ @j メソッド呼ã³å‡ºã—を行ã†ã€‚ci ã«å¿…è¦ãªæƒ…å ±ãŒæ ¼ç´ã•れã¦ã„る。
*/
DEFINE_INSN
send
-(ID op_id, rb_num_t op_argc, ISEQ blockiseq, rb_num_t op_flag, IC ic)
+(CALL_INFO ci)
(...)
-(VALUE val) // inc += - (int)(op_argc + ((op_flag & VM_CALL_ARGS_BLOCKARG_BIT) ? 1 : 0));
+(VALUE val) // inc += - (int)(ci->orig_argc + ((ci->flag & VM_CALL_ARGS_BLOCKARG) ? 1 : 0));
{
- const rb_method_entry_t *me;
- VALUE recv, klass;
- rb_block_t *blockptr = 0;
- VALUE flag = op_flag;
- int num = caller_setup_args(th, GET_CFP(), flag, (int)op_argc,
- (rb_iseq_t *)blockiseq, &blockptr);
- ID id = op_id;
+ ci->argc = ci->orig_argc;
+ ci->blockptr = 0;
+ vm_caller_setup_args(th, reg_cfp, ci);
+ vm_search_method(ci, ci->recv = TOPN(ci->argc));
+ CALL_METHOD(ci);
+}
- /* get receiver */
- recv = TOPN(num);
- klass = CLASS_OF(recv);
- me = vm_method_search(id, klass, ic);
- CALL_METHOD(num, blockptr, flag, id, me, recv);
+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
+ @j Invoke method without block, splat
+ */
+DEFINE_INSN
+opt_send_simple
+(CALL_INFO ci)
+(...)
+(VALUE val) // inc += -ci->orig_argc;
+{
+ vm_search_method(ci, ci->recv = TOPN(ci->argc));
+ CALL_METHOD(ci);
}
/**
@c method/iterator
@e super(args) # args.size => num
- @j super ‚ðŽÀs‚·‚éB
- super(args) # args.size => num
- flag “™ƒIƒyƒ‰ƒ“ƒh‚̈Ӗ¡‚Í send ‚Æ“¯‚¶B
+ @j super を実行ã™ã‚‹ã€‚ci ã«å¿…è¦ãªæƒ…å ±ãŒæ ¼ç´ã•れã¦ã„る。
*/
DEFINE_INSN
invokesuper
-(rb_num_t op_argc, ISEQ blockiseq, rb_num_t op_flag)
+(CALL_INFO ci)
(...)
-(VALUE val) // inc += - (int)(op_argc + ((op_flag & VM_CALL_ARGS_BLOCKARG_BIT) ? 1 : 0));
+(VALUE val) // inc += - (int)(ci->orig_argc + ((ci->flag & VM_CALL_ARGS_BLOCKARG) ? 1 : 0));
{
- rb_block_t *blockptr = !(op_flag & VM_CALL_ARGS_BLOCKARG_BIT) ? GET_BLOCK_PTR() : 0;
- VALUE flag = op_flag;
- int num = caller_setup_args(th, GET_CFP(), flag,
- (int)op_argc, blockiseq, &blockptr);
- VALUE recv, klass;
- ID id;
- const rb_method_entry_t *me;
-
- flag = VM_CALL_SUPER_BIT | VM_CALL_FCALL_BIT;
-
- recv = GET_SELF();
- vm_search_superclass(GET_CFP(), GET_ISEQ(), recv, TOPN(num), &id, &klass);
+ ci->argc = ci->orig_argc;
+ ci->blockptr = !(ci->flag & VM_CALL_ARGS_BLOCKARG) ? GET_BLOCK_PTR() : 0;
- /* temporary measure for [Bug #2402] [Bug #2502] [Bug #3136] */
- if (!rb_obj_is_kind_of(recv, klass)) {
- rb_raise(rb_eNotImpError, "super from singleton method that is defined to multiple classes is not supported; this will be fixed in 1.9.3 or later");
+ if (UNLIKELY(!(ci->flag & VM_CALL_ARGS_SKIP_SETUP))) {
+ vm_caller_setup_args(th, reg_cfp, ci);
}
-
- me = rb_method_entry(klass, id);
-
- CALL_METHOD(num, blockptr, flag, id, me, recv);
+ ci->recv = GET_SELF();
+ vm_search_super_method(th, GET_CFP(), ci);
+ CALL_METHOD(ci);
}
/**
@c method/iterator
- @e yield(args) # args.size => num, flag shows expand argument or not
- @j yield ‚ðŽÀs‚·‚éB
- yield(args) # args.size => num
+ @e yield(args)
+ @j yield を実行ã™ã‚‹ã€‚
*/
DEFINE_INSN
invokeblock
-(rb_num_t num, rb_num_t flag)
+(CALL_INFO ci)
(...)
-(VALUE val) // inc += 1 - num;
+(VALUE val) // inc += 1 - ci->orig_argc;
{
- val = vm_invoke_block(th, GET_CFP(), num, flag);
+ ci->argc = ci->orig_argc;
+ ci->blockptr = 0;
+ ci->recv = GET_SELF();
+ val = vm_invoke_block(th, GET_CFP(), ci);
if (val == Qundef) {
RESTORE_REGS();
NEXT_INSN();
@@ -1076,7 +1074,7 @@ invokeblock
/**
@c method/iterator
@e return from this scope.
- @j ‚±‚̃XƒR[ƒv‚©‚甲‚¯‚éB
+ @j ã“ã®ã‚¹ã‚³ãƒ¼ãƒ—ã‹ã‚‰æŠœã‘る。
*/
DEFINE_INSN
leave
@@ -1085,34 +1083,28 @@ leave
(VALUE val)
{
if (OPT_CHECKED_RUN) {
- if (reg_cfp->sp != reg_cfp->bp) {
+ if (reg_cfp->sp != vm_base_ptr(reg_cfp)) {
rb_bug("Stack consistency error (sp: %"PRIdPTRDIFF", bp: %"PRIdPTRDIFF")",
- VM_SP_CNT(th, reg_cfp->sp), VM_SP_CNT(th, reg_cfp->bp));
+ VM_SP_CNT(th, reg_cfp->sp), VM_SP_CNT(th, vm_base_ptr(reg_cfp)));
}
}
- RUBY_VM_CHECK_INTS();
- vm_pop_frame(th);
- RESTORE_REGS();
-}
+ RUBY_VM_CHECK_INTS(th);
+
+ if (UNLIKELY(VM_FRAME_TYPE_FINISH_P(GET_CFP()))) {
+ vm_pop_frame(th);
-/**
- @c method/iterator
- @e return from this vm loop
- @j VM loop ‚©‚甲‚¯‚éB
- */
-DEFINE_INSN
-finish
-()
-(VALUE val)
-(VALUE val)
-{
#if OPT_CALL_THREADED_CODE
- rb_bug("unused instruction on OPT_CALL_THREADED_CODE");
+ th->retval = val;
+ return 0;
#else
- th->cfp++;
- return val;
+ return val;
#endif
+ }
+ else {
+ vm_pop_frame(th);
+ RESTORE_REGS();
+ }
}
/**********************************************************/
@@ -1122,7 +1114,7 @@ finish
/**
@c exception
@e longjump
- @j ‘åˆæƒWƒƒƒ“ƒv‚ðs‚¤B
+ @j 大域ジャンプを行ã†ã€‚
*/
DEFINE_INSN
throw
@@ -1130,7 +1122,7 @@ throw
(VALUE throwobj)
(VALUE val)
{
- RUBY_VM_CHECK_INTS();
+ RUBY_VM_CHECK_INTS(th);
val = vm_throw(th, GET_CFP(), throw_state, throwobj);
THROW_EXCEPTION(val);
/* unreachable */
@@ -1143,7 +1135,7 @@ throw
/**
@c jump
@e set PC to (PC + dst).
- @j PC ‚ð (PC + dst) ‚É‚·‚éB
+ @j PC ã‚’ (PC + dst) ã«ã™ã‚‹ã€‚
*/
DEFINE_INSN
jump
@@ -1151,14 +1143,14 @@ jump
()
()
{
- RUBY_VM_CHECK_INTS();
+ RUBY_VM_CHECK_INTS(th);
JUMP(dst);
}
/**
@c jump
@e if val is not false or nil, set PC to (PC + dst).
- @j ‚à‚µ val ‚ª false ‚© nil ‚łȂ¯‚ê‚ÎAPC ‚ð (PC + dst) ‚É‚·‚éB
+ @j ã‚‚ã— val ㌠false ã‹ nil ã§ãªã‘れã°ã€PC ã‚’ (PC + dst) ã«ã™ã‚‹ã€‚
*/
DEFINE_INSN
branchif
@@ -1167,7 +1159,7 @@ branchif
()
{
if (RTEST(val)) {
- RUBY_VM_CHECK_INTS();
+ RUBY_VM_CHECK_INTS(th);
JUMP(dst);
}
}
@@ -1175,7 +1167,7 @@ branchif
/**
@c jump
@e if val is false or nil, set PC to (PC + dst).
- @j ‚à‚µ val ‚ª false ‚© nil ‚È‚ç‚ÎAPC ‚ð (PC + dst) ‚É‚·‚éB
+ @j ã‚‚ã— val ㌠false ã‹ nil ãªã‚‰ã°ã€PC ã‚’ (PC + dst) ã«ã™ã‚‹ã€‚
*/
DEFINE_INSN
branchunless
@@ -1184,7 +1176,7 @@ branchunless
()
{
if (!RTEST(val)) {
- RUBY_VM_CHECK_INTS();
+ RUBY_VM_CHECK_INTS(th);
JUMP(dst);
}
}
@@ -1196,8 +1188,8 @@ branchunless
/**
@c optimize
- @e inline cache
- @j ƒCƒ“ƒ‰ƒCƒ“ƒLƒƒƒbƒVƒ…‚ª—LŒø‚È‚çA’l‚ðƒXƒ^ƒbƒN‚ɃvƒbƒVƒ…‚µ‚Ä dst ‚ÖƒWƒƒƒ“ƒv‚·‚éB
+ @e push inline-cached value and go to dst if it is valid
+ @j ã‚¤ãƒ³ãƒ©ã‚¤ãƒ³ã‚­ãƒ£ãƒƒã‚·ãƒ¥ãŒæœ‰åйãªã‚‰ã€å€¤ã‚’スタックã«ãƒ—ッシュã—㦠dst ã¸ã‚¸ãƒ£ãƒ³ãƒ—ã™ã‚‹ã€‚
*/
DEFINE_INSN
getinlinecache
@@ -1205,7 +1197,7 @@ getinlinecache
()
(VALUE val)
{
- if (ic->ic_vmstat == GET_VM_STATE_VERSION()) {
+ if (ic->ic_serial == GET_CONSTANT_SERIAL()) {
val = ic->ic_value.value;
JUMP(dst);
}
@@ -1217,56 +1209,65 @@ getinlinecache
/**
@c optimize
- @e inline cache (once)
- @j once ‚ðŽÀŒ»‚·‚éB
+ @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();
- 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_CONSTANT_SERIAL() - ruby_vm_const_missing_count;
+ ruby_vm_const_missing_count = 0;
}
/**
@c optimize
- @e set inline cache
- @j ƒCƒ“ƒ‰ƒCƒ“ƒLƒƒƒbƒVƒ…‚Ì’l‚ðÝ’è‚·‚éB
+ @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) {
- rb_ary_push(GET_ISEQ()->mark_ary, val);
+ union iseq_inline_storage_entry *is = (union iseq_inline_storage_entry *)ic;
+
+ retry:
+ if (is->once.done == Qfalse) {
+ if (is->once.running_thread == NULL) {
+ is->once.running_thread = th;
+ val = is->once.value = rb_ensure(vm_once_exec, (VALUE)iseq, vm_once_clear, (VALUE)is);
+ /* is->once.running_thread is cleared by vm_once_clear() */
+ is->once.done = Qtrue;
+ rb_iseq_add_mark_object(GET_ISEQ(), val);
+ }
+ else if (is->once.running_thread == th) {
+ /* recursive once */
+ val = vm_once_exec(iseq);
+ }
+ else {
+ /* waiting for finish */
+ RUBY_VM_CHECK_INTS(th);
+ rb_thread_schedule();
+ goto retry;
+ }
+ }
+ else {
+ val = is->once.value;
}
- ic->ic_value.value = val;
- ic->ic_vmstat = GET_VM_STATE_VERSION() - ruby_vm_const_missing_count;
- ruby_vm_const_missing_count = 0;
}
/**
@c optimize
- @e case dispatcher
- @j case •¶‚ÅA‰Â”\‚È‚ç•\ˆø‚«‚ŃWƒƒƒ“ƒv‚·‚éB
+ @e case dispatcher, jump by table if possible
+ @j case æ–‡ã§ã€å¯èƒ½ãªã‚‰è¡¨å¼•ãã§ã‚¸ãƒ£ãƒ³ãƒ—ã™ã‚‹ã€‚
*/
DEFINE_INSN
opt_case_dispatch
@@ -1285,9 +1286,13 @@ opt_case_dispatch
case T_FIXNUM:
case T_BIGNUM:
case T_STRING:
- if (BASIC_OP_UNREDEFINED_P(BOP_EQQ)) {
+ if (BASIC_OP_UNREDEFINED_P(BOP_EQQ,
+ SYMBOL_REDEFINED_OP_FLAG |
+ FIXNUM_REDEFINED_OP_FLAG |
+ 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 {
@@ -1300,45 +1305,21 @@ opt_case_dispatch
}
}
-/**
- @c optimize
- @e check environment
- @j «—ˆ‚ÌŠg’£—pB
- */
-DEFINE_INSN
-opt_checkenv
-()
-()
-()
-{
- if (GET_CFP()->bp != GET_DFP() + 1) {
- VALUE *new_dfp = GET_CFP()->bp - 1;
- /* TODO: copy env and clean stack at creating env? */
- *new_dfp = *GET_DFP();
- SET_DFP(new_dfp);
- }
-}
-
-
/** simple functions */
/**
@c optimize
@e optimized X+Y.
- @j Å“K‰»‚³‚ꂽ X+YB
+ @j 最é©åŒ–ã•れ㟠X+Y。
*/
DEFINE_INSN
opt_plus
-(IC ic)
+(CALL_INFO ci)
(VALUE recv, VALUE obj)
(VALUE val)
{
- if (0) {
-
- }
-#if 1
- else if (FIXNUM_2_P(recv, obj) &&
- BASIC_OP_UNREDEFINED_P(BOP_PLUS)) {
+ if (FIXNUM_2_P(recv, obj) &&
+ BASIC_OP_UNREDEFINED_P(BOP_PLUS,FIXNUM_REDEFINED_OP_FLAG)) {
/* fixnum + fixnum */
#ifndef LONG_LONG_VALUE
val = (recv + (obj & (~1)));
@@ -1360,57 +1341,48 @@ opt_plus
}
#endif
}
-#endif
-
+ else if (FLONUM_2_P(recv, obj) &&
+ BASIC_OP_UNREDEFINED_P(BOP_PLUS, FLOAT_REDEFINED_OP_FLAG)) {
+ val = DBL2NUM(RFLOAT_VALUE(recv) + RFLOAT_VALUE(obj));
+ }
else if (!SPECIAL_CONST_P(recv) && !SPECIAL_CONST_P(obj)) {
- if (0) {
- }
-#if 1
- else if (HEAP_CLASS_OF(recv) == rb_cFloat &&
- HEAP_CLASS_OF(obj) == rb_cFloat &&
- BASIC_OP_UNREDEFINED_P(BOP_PLUS)) {
+ 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));
}
-#endif
-
-#if 1
- else if (HEAP_CLASS_OF(recv) == rb_cString &&
- HEAP_CLASS_OF(obj) == rb_cString &&
- BASIC_OP_UNREDEFINED_P(BOP_PLUS)) {
+ 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);
}
-#endif
-#if 1
- else if (HEAP_CLASS_OF(recv) == rb_cArray &&
- BASIC_OP_UNREDEFINED_P(BOP_PLUS)) {
+ else if (RBASIC_CLASS(recv) == rb_cArray &&
+ BASIC_OP_UNREDEFINED_P(BOP_PLUS, ARRAY_REDEFINED_OP_FLAG)) {
val = rb_ary_plus(recv, obj);
}
-#endif
else {
goto INSN_LABEL(normal_dispatch);
}
}
else {
- INSN_LABEL(normal_dispatch):
+ INSN_LABEL(normal_dispatch):
PUSH(recv);
PUSH(obj);
- CALL_SIMPLE_METHOD(1, idPLUS, recv);
+ CALL_SIMPLE_METHOD(recv);
}
}
/**
@c optimize
@e optimized X-Y.
- @j Å“K‰»‚³‚ꂽ X-YB
+ @j 最é©åŒ–ã•れ㟠X-Y。
*/
DEFINE_INSN
opt_minus
-(IC ic)
+(CALL_INFO ci)
(VALUE recv, VALUE obj)
(VALUE val)
{
if (FIXNUM_2_P(recv, obj) &&
- BASIC_OP_UNREDEFINED_P(BOP_MINUS)) {
+ BASIC_OP_UNREDEFINED_P(BOP_MINUS, FIXNUM_REDEFINED_OP_FLAG)) {
long a, b, c;
a = FIX2LONG(recv);
@@ -1424,16 +1396,15 @@ opt_minus
val = rb_big_minus(rb_int2big(a), rb_int2big(b));
}
}
+ else if (FLONUM_2_P(recv, obj) &&
+ BASIC_OP_UNREDEFINED_P(BOP_MINUS, FLOAT_REDEFINED_OP_FLAG)) {
+ val = DBL2NUM(RFLOAT_VALUE(recv) - RFLOAT_VALUE(obj));
+ }
else if (!SPECIAL_CONST_P(recv) && !SPECIAL_CONST_P(obj)) {
- if (0) {
- }
-#if 1
- else if (HEAP_CLASS_OF(recv) == rb_cFloat &&
- HEAP_CLASS_OF(obj) == rb_cFloat &&
- BASIC_OP_UNREDEFINED_P(BOP_MINUS)) {
+ 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));
}
-#endif
else {
goto INSN_LABEL(normal_dispatch);
}
@@ -1443,23 +1414,23 @@ opt_minus
INSN_LABEL(normal_dispatch):
PUSH(recv);
PUSH(obj);
- CALL_SIMPLE_METHOD(1, idMINUS, recv);
+ CALL_SIMPLE_METHOD(recv);
}
}
/**
@c optimize
@e optimized X*Y.
- @j Å“K‰»‚³‚ꂽ X*YB
+ @j 最é©åŒ–ã•れ㟠X*Y。
*/
DEFINE_INSN
opt_mult
-(IC ic)
+(CALL_INFO ci)
(VALUE recv, VALUE obj)
(VALUE val)
{
if (FIXNUM_2_P(recv, obj) &&
- BASIC_OP_UNREDEFINED_P(BOP_MULT)) {
+ BASIC_OP_UNREDEFINED_P(BOP_MULT, FIXNUM_REDEFINED_OP_FLAG)) {
long a, b;
a = FIX2LONG(recv);
@@ -1467,28 +1438,24 @@ opt_mult
val = recv;
}
else {
- volatile long c;
b = FIX2LONG(obj);
- c = a * b;
-
- if (FIXABLE(c) && c / a == b) {
- val = LONG2FIX(c);
- }
- else {
+ if (MUL_OVERFLOW_FIXNUM_P(a, b)) {
val = rb_big_mul(rb_int2big(a), rb_int2big(b));
- }
+ }
+ else {
+ val = LONG2FIX(a * b);
+ }
}
}
+ else if (FLONUM_2_P(recv, obj) &&
+ BASIC_OP_UNREDEFINED_P(BOP_MULT, FLOAT_REDEFINED_OP_FLAG)) {
+ val = DBL2NUM(RFLOAT_VALUE(recv) * RFLOAT_VALUE(obj));
+ }
else if (!SPECIAL_CONST_P(recv) && !SPECIAL_CONST_P(obj)) {
- if (0) {
- }
-#if 1
- else if (HEAP_CLASS_OF(recv) == rb_cFloat &&
- HEAP_CLASS_OF(obj) == rb_cFloat &&
- BASIC_OP_UNREDEFINED_P(BOP_MULT)) {
+ 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));
}
-#endif
else {
goto INSN_LABEL(normal_dispatch);
}
@@ -1497,23 +1464,23 @@ opt_mult
INSN_LABEL(normal_dispatch):
PUSH(recv);
PUSH(obj);
- CALL_SIMPLE_METHOD(1, idMULT, recv);
+ CALL_SIMPLE_METHOD(recv);
}
}
/**
@c optimize
@e optimized X/Y.
- @j Å“K‰»‚³‚ꂽ X/YB
+ @j 最é©åŒ–ã•れ㟠X/Y。
*/
DEFINE_INSN
opt_div
-(IC ic)
+(CALL_INFO ci)
(VALUE recv, VALUE obj)
(VALUE val)
{
if (FIXNUM_2_P(recv, obj) &&
- BASIC_OP_UNREDEFINED_P(BOP_DIV)) {
+ BASIC_OP_UNREDEFINED_P(BOP_DIV, FIXNUM_REDEFINED_OP_FLAG)) {
long x, y, div;
x = FIX2LONG(recv);
@@ -1543,16 +1510,15 @@ opt_div
}
val = LONG2NUM(div);
}
+ else if (FLONUM_2_P(recv, obj) &&
+ BASIC_OP_UNREDEFINED_P(BOP_MULT, FLOAT_REDEFINED_OP_FLAG)) {
+ val = DBL2NUM(RFLOAT_VALUE(recv) / RFLOAT_VALUE(obj));
+ }
else if (!SPECIAL_CONST_P(recv) && !SPECIAL_CONST_P(obj)) {
- if (0) {
- }
-#if 1
- else if (HEAP_CLASS_OF(recv) == rb_cFloat &&
- HEAP_CLASS_OF(obj) == rb_cFloat &&
- BASIC_OP_UNREDEFINED_P(BOP_DIV)) {
+ 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));
}
-#endif
else {
goto INSN_LABEL(normal_dispatch);
}
@@ -1561,30 +1527,32 @@ opt_div
INSN_LABEL(normal_dispatch):
PUSH(recv);
PUSH(obj);
- CALL_SIMPLE_METHOD(1, idDIV, recv);
+ CALL_SIMPLE_METHOD(recv);
}
}
/**
@c optimize
@e optimized X%Y.
- @j Å“K‰»‚³‚ꂽ X%YB
+ @j 最é©åŒ–ã•れ㟠X%Y。
*/
DEFINE_INSN
opt_mod
-(IC ic)
+(CALL_INFO ci)
(VALUE recv, VALUE obj)
(VALUE val)
{
if (FIXNUM_2_P(recv, obj) &&
- BASIC_OP_UNREDEFINED_P(BOP_MOD)) {
- long x, y, mod;
+ BASIC_OP_UNREDEFINED_P(BOP_MOD, FIXNUM_REDEFINED_OP_FLAG )) {
+ 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();
@@ -1605,15 +1573,16 @@ 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 (0) {
- }
- else if (HEAP_CLASS_OF(recv) == rb_cFloat &&
- HEAP_CLASS_OF(obj) == rb_cFloat &&
- BASIC_OP_UNREDEFINED_P(BOP_MOD)) {
+ 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)));
}
else {
@@ -1624,48 +1593,48 @@ opt_mod
INSN_LABEL(normal_dispatch):
PUSH(recv);
PUSH(obj);
- CALL_SIMPLE_METHOD(1, idMOD, recv);
+ CALL_SIMPLE_METHOD(recv);
}
}
/**
@c optimize
@e optimized X==Y.
- @j Å“K‰»‚³‚ꂽ X==YB
+ @j 最é©åŒ–ã•れ㟠X==Y。
*/
DEFINE_INSN
opt_eq
-(IC ic)
+(CALL_INFO ci)
(VALUE recv, VALUE obj)
(VALUE val)
{
- val = opt_eq_func(recv, obj, ic);
+ val = opt_eq_func(recv, obj, ci);
if (val == Qundef) {
/* other */
PUSH(recv);
PUSH(obj);
- CALL_SIMPLE_METHOD(1, idEq, recv);
+ CALL_SIMPLE_METHOD(recv);
}
}
/**
@c optimize
@e optimized X!=Y.
- @j Å“K‰»‚³‚ꂽ X!=YB
+ @j 最é©åŒ–ã•れ㟠X!=Y。
*/
DEFINE_INSN
opt_neq
-(IC ic, IC ic_eq)
+(CALL_INFO ci, CALL_INFO ci_eq)
(VALUE recv, VALUE obj)
(VALUE val)
{
extern VALUE rb_obj_not_equal(VALUE obj1, VALUE obj2);
- const rb_method_entry_t *me = vm_method_search(idNeq, CLASS_OF(recv), ic);
+ vm_search_method(ci, recv);
val = Qundef;
- if (check_cfunc(me, rb_obj_not_equal)) {
- val = opt_eq_func(recv, obj, ic_eq);
+ if (check_cfunc(ci->me, rb_obj_not_equal)) {
+ val = opt_eq_func(recv, obj, ci_eq);
if (val != Qundef) {
val = RTEST(val) ? Qfalse : Qtrue;
@@ -1676,23 +1645,23 @@ opt_neq
/* other */
PUSH(recv);
PUSH(obj);
- CALL_SIMPLE_METHOD(1, idNeq, recv);
+ CALL_SIMPLE_METHOD(recv);
}
}
/**
@c optimize
@e optimized X<Y.
- @j Å“K‰»‚³‚ꂽ X<YB
+ @j 最é©åŒ–ã•れ㟠X<Y。
*/
DEFINE_INSN
opt_lt
-(IC ic)
+(CALL_INFO ci)
(VALUE recv, VALUE obj)
(VALUE val)
{
if (FIXNUM_2_P(recv, obj) &&
- BASIC_OP_UNREDEFINED_P(BOP_LT)) {
+ BASIC_OP_UNREDEFINED_P(BOP_LT, FIXNUM_REDEFINED_OP_FLAG)) {
SIGNED_VALUE a = recv, b = obj;
if (a < b) {
@@ -1702,22 +1671,16 @@ opt_lt
val = Qfalse;
}
}
+ else if (FLONUM_2_P(recv, obj) &&
+ BASIC_OP_UNREDEFINED_P(BOP_LT, FLOAT_REDEFINED_OP_FLAG)) {
+ /* flonum is not NaN */
+ val = RFLOAT_VALUE(recv) < RFLOAT_VALUE(obj) ? Qtrue : Qfalse;
+ }
else if (!SPECIAL_CONST_P(recv) && !SPECIAL_CONST_P(obj)) {
- if (0) {
- }
-#if 1
- else if (HEAP_CLASS_OF(recv) == rb_cFloat &&
- HEAP_CLASS_OF(obj) == rb_cFloat &&
- BASIC_OP_UNREDEFINED_P(BOP_LT)) {
- double a = RFLOAT_VALUE(recv);
- double b = RFLOAT_VALUE(obj);
-#if defined(_MSC_VER) && _MSC_VER < 1300
- if (isnan(a) || isnan(b)) val = Qfalse;
- else
-#endif
- val = a < b ? Qtrue : Qfalse;
+ 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));
}
-#endif
else {
goto INSN_LABEL(normal_dispatch);
}
@@ -1726,23 +1689,23 @@ opt_lt
INSN_LABEL(normal_dispatch):
PUSH(recv);
PUSH(obj);
- CALL_SIMPLE_METHOD(1, idLT, recv);
+ CALL_SIMPLE_METHOD(recv);
}
}
/**
@c optimize
@e optimized X<=Y.
- @j Å“K‰»‚³‚ꂽ X<=YB
+ @j 最é©åŒ–ã•れ㟠X<=Y。
*/
DEFINE_INSN
opt_le
-(IC ic)
+(CALL_INFO ci)
(VALUE recv, VALUE obj)
(VALUE val)
{
if (FIXNUM_2_P(recv, obj) &&
- BASIC_OP_UNREDEFINED_P(BOP_LE)) {
+ BASIC_OP_UNREDEFINED_P(BOP_LE, FIXNUM_REDEFINED_OP_FLAG)) {
SIGNED_VALUE a = recv, b = obj;
if (a <= b) {
@@ -1752,27 +1715,32 @@ opt_le
val = Qfalse;
}
}
+ else if (FLONUM_2_P(recv, obj) &&
+ BASIC_OP_UNREDEFINED_P(BOP_LE, FLOAT_REDEFINED_OP_FLAG)) {
+ /* flonum is not NaN */
+ val = RFLOAT_VALUE(recv) <= RFLOAT_VALUE(obj) ? Qtrue : Qfalse;
+ }
else {
/* other */
PUSH(recv);
PUSH(obj);
- CALL_SIMPLE_METHOD(1, idLE, recv);
+ CALL_SIMPLE_METHOD(recv);
}
}
/**
@c optimize
@e optimized X>Y.
- @j Å“K‰»‚³‚ꂽ X>YB
+ @j 最é©åŒ–ã•れ㟠X>Y。
*/
DEFINE_INSN
opt_gt
-(IC ic)
+(CALL_INFO ci)
(VALUE recv, VALUE obj)
(VALUE val)
{
if (FIXNUM_2_P(recv, obj) &&
- BASIC_OP_UNREDEFINED_P(BOP_GT)) {
+ BASIC_OP_UNREDEFINED_P(BOP_GT, FIXNUM_REDEFINED_OP_FLAG)) {
SIGNED_VALUE a = recv, b = obj;
if (a > b) {
@@ -1782,22 +1750,16 @@ opt_gt
val = Qfalse;
}
}
+ else if (FLONUM_2_P(recv, obj) &&
+ BASIC_OP_UNREDEFINED_P(BOP_GT, FLOAT_REDEFINED_OP_FLAG)) {
+ /* flonum is not NaN */
+ val = RFLOAT_VALUE(recv) > RFLOAT_VALUE(obj) ? Qtrue : Qfalse;
+ }
else if (!SPECIAL_CONST_P(recv) && !SPECIAL_CONST_P(obj)) {
- if (0) {
- }
-#if 1
- else if (HEAP_CLASS_OF(recv) == rb_cFloat &&
- HEAP_CLASS_OF(obj) == rb_cFloat &&
- BASIC_OP_UNREDEFINED_P(BOP_GT)) {
- double a = RFLOAT_VALUE(recv);
- double b = RFLOAT_VALUE(obj);
-#if defined(_MSC_VER) && _MSC_VER < 1300
- if (isnan(a) || isnan(b)) val = Qfalse;
- else
-#endif
- val = a > b ? Qtrue : Qfalse;
+ 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));
}
-#endif
else {
goto INSN_LABEL(normal_dispatch);
}
@@ -1806,23 +1768,23 @@ opt_gt
INSN_LABEL(normal_dispatch):
PUSH(recv);
PUSH(obj);
- CALL_SIMPLE_METHOD(1, idGT, recv);
+ CALL_SIMPLE_METHOD(recv);
}
}
/**
@c optimize
@e optimized X>=Y.
- @j Å“K‰»‚³‚ꂽ X>=YB
+ @j 最é©åŒ–ã•れ㟠X>=Y。
*/
DEFINE_INSN
opt_ge
-(IC ic)
+(CALL_INFO ci)
(VALUE recv, VALUE obj)
(VALUE val)
{
if (FIXNUM_2_P(recv, obj) &&
- BASIC_OP_UNREDEFINED_P(BOP_GE)) {
+ BASIC_OP_UNREDEFINED_P(BOP_GE, FIXNUM_REDEFINED_OP_FLAG)) {
SIGNED_VALUE a = recv, b = obj;
if (a >= b) {
@@ -1832,33 +1794,36 @@ opt_ge
val = Qfalse;
}
}
+ else if (FLONUM_2_P(recv, obj) &&
+ BASIC_OP_UNREDEFINED_P(BOP_GE, FLOAT_REDEFINED_OP_FLAG)) {
+ /* flonum is not NaN */
+ val = RFLOAT_VALUE(recv) >= RFLOAT_VALUE(obj) ? Qtrue : Qfalse;
+ }
else {
PUSH(recv);
PUSH(obj);
- CALL_SIMPLE_METHOD(1, idGE, recv);
+ CALL_SIMPLE_METHOD(recv);
}
}
/**
@c optimize
@e <<
- @j Å“K‰»‚³‚ꂽ X<<YB
+ @j 最é©åŒ–ã•れ㟠X<<Y。
*/
DEFINE_INSN
opt_ltlt
-(IC ic)
+(CALL_INFO ci)
(VALUE recv, VALUE obj)
(VALUE val)
{
if (!SPECIAL_CONST_P(recv)) {
- if (0) {
- }
- else if (HEAP_CLASS_OF(recv) == rb_cString &&
- BASIC_OP_UNREDEFINED_P(BOP_LTLT)) {
+ 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 &&
- BASIC_OP_UNREDEFINED_P(BOP_LTLT)) {
+ else if (RBASIC_CLASS(recv) == rb_cArray &&
+ BASIC_OP_UNREDEFINED_P(BOP_LTLT, ARRAY_REDEFINED_OP_FLAG)) {
val = rb_ary_push(recv, obj);
}
else {
@@ -1869,26 +1834,26 @@ opt_ltlt
INSN_LABEL(normal_dispatch):
PUSH(recv);
PUSH(obj);
- CALL_SIMPLE_METHOD(1, idLTLT, recv);
+ CALL_SIMPLE_METHOD(recv);
}
}
/**
@c optimize
@e []
- @j Å“K‰»‚³‚ꂽ recv[obj]B
+ @j 最é©åŒ–ã•れ㟠recv[obj]。
*/
DEFINE_INSN
opt_aref
-(IC ic)
+(CALL_INFO ci)
(VALUE recv, VALUE obj)
(VALUE val)
{
- if (!SPECIAL_CONST_P(recv) && BASIC_OP_UNREDEFINED_P(BOP_AREF)) {
- if (HEAP_CLASS_OF(recv) == rb_cArray && FIXNUM_P(obj)) {
+ if (!SPECIAL_CONST_P(recv)) {
+ 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) {
+ else if (RBASIC_CLASS(recv) == rb_cHash && BASIC_OP_UNREDEFINED_P(BOP_AREF, HASH_REDEFINED_OP_FLAG)) {
val = rb_hash_aref(recv, obj);
}
else {
@@ -1899,28 +1864,27 @@ opt_aref
INSN_LABEL(normal_dispatch):
PUSH(recv);
PUSH(obj);
- CALL_SIMPLE_METHOD(1, idAREF, recv);
+ CALL_SIMPLE_METHOD(recv);
}
}
/**
@c optimize
@e recv[obj] = set
- @j Å“K‰»‚³‚ꂽ recv[obj] = setB
+ @j 最é©åŒ–ã•れ㟠recv[obj] = set。
*/
DEFINE_INSN
opt_aset
-(IC ic)
+(CALL_INFO ci)
(VALUE recv, VALUE obj, VALUE set)
(VALUE val)
{
- if (!SPECIAL_CONST_P(recv) &&
- BASIC_OP_UNREDEFINED_P(BOP_ASET)) {
- if (HEAP_CLASS_OF(recv) == rb_cArray && FIXNUM_P(obj)) {
+ if (!SPECIAL_CONST_P(recv)) {
+ 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) {
+ 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;
}
@@ -1933,30 +1897,32 @@ opt_aset
PUSH(recv);
PUSH(obj);
PUSH(set);
- CALL_SIMPLE_METHOD(2, idASET, recv);
+ CALL_SIMPLE_METHOD(recv);
}
}
/**
@c optimize
@e optimized length
- @j Å“K‰»‚³‚ꂽ recv.length()B
+ @j 最é©åŒ–ã•れ㟠recv.length()。
*/
DEFINE_INSN
opt_length
-(IC ic)
+(CALL_INFO ci)
(VALUE recv)
(VALUE val)
{
- if (LIKELY(!SPECIAL_CONST_P(recv) &&
- BASIC_OP_UNREDEFINED_P(BOP_LENGTH))) {
- if (HEAP_CLASS_OF(recv) == rb_cString) {
+ if (!SPECIAL_CONST_P(recv)) {
+ 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));
}
else {
@@ -1966,30 +1932,32 @@ opt_length
else {
INSN_LABEL(normal_dispatch):
PUSH(recv);
- CALL_SIMPLE_METHOD(0, idLength, recv);
+ CALL_SIMPLE_METHOD(recv);
}
}
/**
@c optimize
@e optimized size
- @j Å“K‰»‚³‚ꂽ recv.size()B
+ @j 最é©åŒ–ã•れ㟠recv.size()。
*/
DEFINE_INSN
opt_size
-(IC ic)
+(CALL_INFO ci)
(VALUE recv)
(VALUE val)
{
- if (LIKELY(BASIC_OP_UNREDEFINED_P(BOP_SIZE) &&
- !SPECIAL_CONST_P(recv))) {
- if (HEAP_CLASS_OF(recv) == rb_cString) {
+ if (!SPECIAL_CONST_P(recv)) {
+ 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));
}
else {
@@ -1999,24 +1967,62 @@ opt_size
else {
INSN_LABEL(normal_dispatch):
PUSH(recv);
- CALL_SIMPLE_METHOD(0, idSize, recv);
+ CALL_SIMPLE_METHOD(recv);
+ }
+}
+
+/**
+ @c optimize
+ @e optimized empty?
+ @j 最é©åŒ–ã•れ㟠recv.empty?()。
+ */
+DEFINE_INSN
+opt_empty_p
+(CALL_INFO ci)
+(VALUE recv)
+(VALUE val)
+{
+ if (!SPECIAL_CONST_P(recv)) {
+ 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 (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 (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;
+ }
+ else {
+ goto INSN_LABEL(normal_dispatch);
+ }
+ }
+ else {
+ INSN_LABEL(normal_dispatch):
+ PUSH(recv);
+ CALL_SIMPLE_METHOD(recv);
}
}
/**
@c optimize
@e optimized succ
- @j Å“K‰»‚³‚ꂽ recv.succ()B
+ @j 最é©åŒ–ã•れ㟠recv.succ()。
*/
DEFINE_INSN
opt_succ
-(IC ic)
+(CALL_INFO ci)
(VALUE recv)
(VALUE val)
{
if (SPECIAL_CONST_P(recv)) {
if (FIXNUM_P(recv) &&
- BASIC_OP_UNREDEFINED_P(BOP_SUCC)) {
+ BASIC_OP_UNREDEFINED_P(BOP_SUCC, FIXNUM_REDEFINED_OP_FLAG)) {
const VALUE obj = INT2FIX(1);
/* fixnum + INT2FIX(1) */
val = (recv + (obj & (~1)));
@@ -2030,12 +2036,12 @@ opt_succ
}
}
else {
- if (HEAP_CLASS_OF(recv) == rb_cString &&
- BASIC_OP_UNREDEFINED_P(BOP_SUCC)) {
+ 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 &&
- BASIC_OP_UNREDEFINED_P(BOP_SUCC)) {
+ else if (RBASIC_CLASS(recv) == rb_cTime &&
+ BASIC_OP_UNREDEFINED_P(BOP_SUCC, TIME_REDEFINED_OP_FLAG)) {
val = rb_time_succ(recv);
}
else
@@ -2046,30 +2052,30 @@ opt_succ
if (0) {
INSN_LABEL(normal_dispatch):
PUSH(recv);
- CALL_SIMPLE_METHOD(0, idSucc, recv);
+ CALL_SIMPLE_METHOD(recv);
}
}
/**
@c optimize
@e optimized not
- @j Å“K‰»‚³‚ꂽ recv.!()B
+ @j 最é©åŒ–ã•れ㟠recv.!()。
*/
DEFINE_INSN
opt_not
-(IC ic)
+(CALL_INFO ci)
(VALUE recv)
(VALUE val)
{
extern VALUE rb_obj_not(VALUE obj);
- const rb_method_entry_t *me = vm_method_search(idNot, CLASS_OF(recv), ic);
+ vm_search_method(ci, recv);
- if (check_cfunc(me, rb_obj_not)) {
+ if (check_cfunc(ci->me, rb_obj_not)) {
val = RTEST(recv) ? Qfalse : Qtrue;
}
else {
PUSH(recv);
- CALL_SIMPLE_METHOD(0, idNot, recv);
+ CALL_SIMPLE_METHOD(recv);
}
}
@@ -2077,7 +2083,7 @@ opt_not
/**
@c optimize
@e optimized regexp match
- @j Å“K‰»‚³‚ꂽ³‹K•\Œ»ƒ}ƒbƒ`B
+ @j 最é©åŒ–ã•ã‚ŒãŸæ­£è¦è¡¨ç¾ãƒžãƒƒãƒã€‚
*/
DEFINE_INSN
opt_regexpmatch1
@@ -2085,32 +2091,39 @@ 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);
+ }
}
/**
@c optimize
@e optimized regexp match 2
- @j Å“K‰»‚³‚ꂽ³‹K•\Œ»ƒ}ƒbƒ` 2
+ @j 最é©åŒ–ã•ã‚ŒãŸæ­£è¦è¡¨ç¾ãƒžãƒƒãƒ 2
*/
DEFINE_INSN
opt_regexpmatch2
-()
+(CALL_INFO ci)
(VALUE obj2, VALUE obj1)
(VALUE val)
{
- if (TYPE(obj2) == T_STRING) {
+ if (RB_TYPE_P(obj2, T_STRING) &&
+ 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);
}
}
/**
@c optimize
@e call native compiled method
- @j ƒlƒCƒeƒBƒuƒRƒ“ƒpƒCƒ‹‚µ‚½ƒƒ\ƒbƒh‚ð‹N“®B
+ @j ãƒã‚¤ãƒ†ã‚£ãƒ–コンパイルã—ãŸãƒ¡ã‚½ãƒƒãƒ‰ã‚’起動。
*/
DEFINE_INSN
opt_call_c_function
@@ -2147,7 +2160,7 @@ bitblt
/**
@c joke
@e The Answer to Life, the Universe, and Everything
- @j l¶A‰F’ˆA‚·‚ׂĂ̓š‚¦B
+ @j 人生ã€å®‡å®™ã€ã™ã¹ã¦ã®ç­”ãˆã€‚
*/
DEFINE_INSN
answer
diff --git a/internal.h b/internal.h
index 59c928462e..464266ffbb 100644
--- a/internal.h
+++ b/internal.h
@@ -19,51 +19,330 @@ extern "C" {
#endif
#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) : \
+ (a) > 0 ? \
+ ((b) > 0 ? (max) / (a) < (b) : (min) / (a) > (b)) : \
+ ((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
+# 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;
+#elif defined(HAVE_UINT64_T)
+typedef uint64_t rb_serial_t;
+#else
+typedef unsigned long rb_serial_t;
+#endif
+
struct rb_classext_struct {
VALUE super;
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
+/* 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_ORIGIN(c) (RCLASS_EXT(c)->origin)
+#define RCLASS_REFINED_CLASS(c) (RCLASS_EXT(c)->refined_class)
+
+#undef RCLASS_SUPER
+static inline VALUE
+RCLASS_SUPER(VALUE klass)
+{
+ return RCLASS_EXT(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);
+ }
+ OBJ_WRITE(klass, &RCLASS_EXT(klass)->super, super);
+ return super;
+}
struct vtm; /* defined by timev.h */
/* array.c */
VALUE rb_ary_last(int, VALUE *, VALUE);
+void rb_ary_set_len(VALUE, long);
+void rb_ary_delete_same(VALUE, VALUE);
/* bignum.c */
VALUE rb_big_fdiv(VALUE x, VALUE y);
VALUE rb_big_uminus(VALUE x);
+VALUE rb_integer_float_cmp(VALUE x, VALUE y);
+VALUE rb_integer_float_eq(VALUE x, VALUE y);
/* class.c */
+void rb_class_foreach_subclass(VALUE klass, void(*f)(VALUE));
+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, VALUE *argv, VALUE obj);
VALUE rb_obj_protected_methods(int argc, VALUE *argv, VALUE obj);
VALUE rb_obj_private_methods(int argc, VALUE *argv, VALUE obj);
VALUE rb_obj_public_methods(int argc, VALUE *argv, VALUE obj);
int rb_obj_basic_to_s_p(VALUE);
+VALUE rb_special_singleton_class(VALUE);
+VALUE rb_singleton_class_clone_and_attach(VALUE obj, VALUE attach);
+VALUE rb_singleton_class_get(VALUE obj);
void Init_class_hierarchy(void);
+/* compar.c */
+VALUE rb_invcmp(VALUE, VALUE);
+
/* compile.c */
int rb_dvar_defined(ID);
int rb_local_defined(ID);
int rb_parse_in_eval(void);
int rb_parse_in_main(void);
+const char * rb_insns_name(int i);
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);
@@ -72,15 +351,43 @@ 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 */
NORETURN(PRINTF_ARGS(void rb_compile_bug(const char*, int, const char*, ...), 3, 4));
VALUE rb_check_backtrace(VALUE);
NORETURN(void rb_async_bug_errno(const char *,int));
+const char *rb_builtin_type_name(int t);
+const char *rb_builtin_class_name(VALUE x);
+
+/* eval.c */
+VALUE rb_refinement_module_get_refined_class(VALUE module);
/* eval_error.c */
void ruby_error_print(void);
@@ -88,21 +395,57 @@ VALUE rb_get_backtrace(VALUE info);
/* eval_jump.c */
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 *);
VALUE rb_file_expand_path_fast(VALUE, VALUE);
VALUE rb_file_expand_path_internal(VALUE, VALUE, int, int, VALUE);
+VALUE rb_get_path_check_to_string(VALUE, int);
+VALUE rb_get_path_check_convert(VALUE, VALUE, int);
void Init_File(void);
-#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);
+void rb_gc_writebarrier_remember_promoted(VALUE obj);
+void ruby_gc_set_params(void);
+
+void *ruby_sized_xrealloc(void *ptr, size_t new_size, size_t old_size) RUBY_ATTR_ALLOC_SIZE((2));
+void ruby_sized_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)))
+
+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);
@@ -112,13 +455,23 @@ const char *ruby_get_inplace_mode(void);
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_compile_with_option(VALUE src, VALUE file, VALUE filepath, VALUE line, VALUE opt);
VALUE rb_iseq_clone(VALUE iseqval, VALUE newcbase);
+VALUE rb_iseq_path(VALUE iseqval);
+VALUE rb_iseq_absolute_path(VALUE iseqval);
+VALUE rb_iseq_label(VALUE iseqval);
+VALUE rb_iseq_base_label(VALUE iseqval);
+VALUE rb_iseq_first_lineno(VALUE iseqval);
+VALUE rb_iseq_klass(VALUE iseqval); /* completely temporary fucntion */
+VALUE rb_iseq_method_name(VALUE self);
/* load.c */
VALUE rb_get_load_path(void);
+VALUE rb_get_expanded_load_path(void);
+NORETURN(void rb_load_fail(VALUE, const char*));
/* math.c */
VALUE rb_math_atan2(VALUE, VALUE);
@@ -136,18 +489,165 @@ void Init_newline(void);
/* numeric.c */
int rb_num_to_uint(VALUE val, unsigned int *ret);
+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 */
VALUE rb_obj_equal(VALUE obj1, VALUE obj2);
+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); \
+ OBJ_WRITE(_obj_, &((struct RBasicRaw *)(_obj_))->klass, cls); \
+} while (0)
+
/* parse.y */
VALUE rb_parser_get_yydebug(VALUE);
VALUE rb_parser_set_yydebug(VALUE, VALUE);
+int rb_is_const_name(VALUE name);
+int rb_is_class_name(VALUE name);
+int rb_is_global_name(VALUE name);
+int rb_is_instance_name(VALUE name);
+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(int full_mark);
/* proc.c */
VALUE rb_proc_location(VALUE self);
+st_index_t rb_hash_proc(st_index_t hash, VALUE proc);
+int rb_block_arity(void);
+
+/* process.c */
+#define RB_MAX_GROUPS (65536)
+
+struct rb_execarg {
+ int use_shell;
+ union {
+ struct {
+ VALUE shell_script;
+ } sh;
+ struct {
+ VALUE command_name;
+ VALUE command_abspath; /* full path string or nil */
+ VALUE argv_str;
+ VALUE argv_buf;
+ } cmd;
+ } invoke;
+ VALUE redirect_fds;
+ VALUE envp_str;
+ VALUE envp_buf;
+ VALUE dup2_tmpbuf;
+ unsigned pgroup_given : 1;
+ unsigned umask_given : 1;
+ unsigned unsetenv_others_given : 1;
+ unsigned unsetenv_others_do : 1;
+ unsigned close_others_given : 1;
+ unsigned close_others_do : 1;
+ unsigned chdir_given : 1;
+ unsigned new_pgroup_given : 1;
+ unsigned new_pgroup_flag : 1;
+ unsigned uid_given : 1;
+ unsigned gid_given : 1;
+ rb_pid_t pgroup_pgid; /* asis(-1), new pgroup(0), specified pgroup (0<V). */
+ VALUE rlimit_limits; /* Qfalse or [[rtype, softlim, hardlim], ...] */
+ mode_t umask_mask;
+ rb_uid_t uid;
+ rb_gid_t gid;
+ VALUE fd_dup2;
+ VALUE fd_close;
+ VALUE fd_open;
+ VALUE fd_dup2_child;
+ int close_others_maxhint;
+ VALUE env_modification; /* Qfalse or [[k1,v1], ...] */
+ VALUE chdir_dir;
+};
+
+/* argv_str contains extra two elements.
+ * The beginning one is for /bin/sh used by exec_with_sh.
+ * The last one for terminating NULL used by execve.
+ * See rb_exec_fillarg() in process.c. */
+#define ARGVSTR2ARGC(argv_str) (RSTRING_LEN(argv_str) / sizeof(char *) - 2)
+#define ARGVSTR2ARGV(argv_str) ((char **)RSTRING_PTR(argv_str) + 1)
+
+rb_pid_t rb_fork_ruby(int *status);
+void rb_last_status_clear(void);
/* rational.c */
VALUE rb_lcm(VALUE x, VALUE y);
@@ -159,12 +659,39 @@ VALUE rb_reg_check_preprocess(VALUE);
/* signal.c */
int rb_get_next_signal(void);
+int rb_sigaltstack_size(void);
/* strftime.c */
-size_t rb_strftime_timespec(char *s, size_t maxsize, const char *format, const struct vtm *vtm, struct timespec *ts, int gmt);
+#ifdef RUBY_ENCODING_H
+size_t rb_strftime_timespec(char *s, size_t maxsize, const char *format, rb_encoding *enc,
+ const struct vtm *vtm, struct timespec *ts, int gmt);
+size_t rb_strftime(char *s, size_t maxsize, const char *format, rb_encoding *enc,
+ const struct vtm *vtm, VALUE timev, int gmt);
+#endif
/* string.c */
+VALUE rb_fstring(VALUE);
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_ASSOC FL_USER3
+#define STR_SHARED_P(s) FL_ALL((s), STR_NOEMBED|ELTS_SHARED)
+#define STR_ASSOC_P(s) FL_ALL((s), STR_NOEMBED|STR_ASSOC)
+#define STR_NOCAPA (STR_NOEMBED|ELTS_SHARED|STR_ASSOC)
+#define STR_NOCAPA_P(s) (FL_TEST((s),STR_NOEMBED) && FL_ANY((s),ELTS_SHARED|STR_ASSOC))
+#define STR_EMBED_P(str) (!FL_TEST((str), STR_NOEMBED))
+#define is_ascii_string(str) (rb_enc_str_coderange(str) == ENC_CODERANGE_7BIT)
+#define is_broken_string(str) (rb_enc_str_coderange(str) == ENC_CODERANGE_BROKEN)
/* struct.c */
VALUE rb_struct_init_copy(VALUE copy, VALUE s);
@@ -174,15 +701,25 @@ struct timeval rb_time_timeval(VALUE);
/* thread.c */
VALUE rb_obj_is_mutex(VALUE obj);
-VALUE ruby_suppress_tracing(VALUE (*func)(VALUE, int), VALUE arg, int always);
+VALUE rb_suppress_tracing(VALUE (*func)(VALUE), VALUE arg);
void rb_thread_execute_interrupts(VALUE th);
void rb_clear_trace_func(void);
-VALUE rb_thread_backtrace(VALUE thval);
VALUE rb_get_coverages(void);
+VALUE rb_thread_shield_new(void);
+VALUE rb_thread_shield_wait(VALUE self);
+VALUE rb_thread_shield_release(VALUE self);
+VALUE rb_thread_shield_destroy(VALUE self);
+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);
@@ -193,42 +730,115 @@ void rb_vm_change_state(void);
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);
/* 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, 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);
+
+/* vm_insnhelper.c */
+VALUE rb_equal_opt(VALUE obj1, VALUE obj2);
/* vm_method.c */
void Init_eval_method(void);
+int rb_method_defined_by(VALUE obj, ID mid, VALUE (*cfunc)(ANYARGS));
/* miniprelude.c, prelude.c */
void Init_prelude(void);
-#if defined __GNUC__ && __GNUC__ >= 4
-#pragma GCC visibility push(default)
-#endif
+/* vm_backtrace.c */
+void Init_vm_backtrace(void);
+VALUE rb_vm_thread_backtrace(int argc, VALUE *argv, VALUE thval);
+VALUE rb_vm_thread_backtrace_locations(int argc, VALUE *argv, VALUE thval);
+
+VALUE rb_make_backtrace(void);
+void rb_backtrace_print_as_bugreport(void);
+int rb_backtrace_p(VALUE obj);
+VALUE rb_backtrace_to_str_ary(VALUE obj);
+void rb_backtrace_print_to(VALUE output);
+VALUE rb_vm_backtrace_object(void);
+
+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);
-/* experimental.
- * These APIs can be changed on Ruby 1.9.4 or later.
- * We will change these APIs (spac, name and so on) if there are something wrong.
- * If you use these APIs, catch up future changes.
- */
-void *rb_thread_call_with_gvl(void *(*func)(void *), void *data1);
-VALUE rb_thread_call_without_gvl(
- rb_blocking_function_t *func, void *data1,
- rb_unblock_function_t *ubf, void *data2);
+/* 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);
-#if defined __GNUC__ && __GNUC__ >= 4
-#pragma GCC visibility pop
+/* 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);
+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);
+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
+/* 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);
+
+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);
+
+RUBY_SYMBOL_EXPORT_END
+
#if defined(__cplusplus)
#if 0
{ /* satisfy cc-mode */
diff --git a/io.c b/io.c
index e88918f575..053e8f3b0e 100644
--- a/io.c
+++ b/io.c
@@ -13,10 +13,13 @@
#include "ruby/ruby.h"
#include "ruby/io.h"
+#include "ruby/thread.h"
#include "dln.h"
#include "internal.h"
+#include "id.h"
#include <ctype.h>
#include <errno.h>
+#include "ruby_atomic.h"
#define free(x) xfree(x)
@@ -28,14 +31,16 @@
#if defined HAVE_NET_SOCKET_H
# include <net/socket.h>
#elif defined HAVE_SYS_SOCKET_H
-# include <sys/socket.h>
+# ifndef __native_client__
+# include <sys/socket.h>
+# endif
#endif
#if defined(__BOW__) || defined(__CYGWIN__) || defined(_WIN32) || defined(__EMX__) || defined(__BEOS__) || defined(__HAIKU__)
# define NO_SAFE_RENAME
#endif
-#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__) || defined(sun) || defined(_nec_ews)
+#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__) || defined(__sun) || defined(_nec_ews)
# define USE_SETVBUF
#endif
@@ -47,6 +52,9 @@
#if defined(HAVE_SYS_IOCTL_H) && !defined(_WIN32)
#include <sys/ioctl.h>
#endif
+#if defined(__native_client__) && defined(NACL_NEWLIB)
+# include "nacl/ioctl.h"
+#endif
#if defined(HAVE_FCNTL_H) || defined(_WIN32)
#include <fcntl.h>
#elif defined(HAVE_SYS_FCNTL_H)
@@ -102,13 +110,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)
@@ -125,6 +135,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 */
@@ -139,7 +159,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;
@@ -151,70 +178,188 @@ struct argf {
int8_t init_p, next_p, binmode;
};
-static int max_file_descriptor = NOFILE;
+static rb_atomic_t max_file_descriptor = NOFILE;
void
rb_update_max_fd(int fd)
{
struct stat buf;
+ rb_atomic_t afd = (rb_atomic_t)fd;
+
if (fstat(fd, &buf) != 0 && errno == EBADF) {
rb_bug("rb_update_max_fd: invalid fd (%d) given.", fd);
}
- if (max_file_descriptor < fd) max_file_descriptor = fd;
+
+ while (max_file_descriptor < afd) {
+ ATOMIC_CAS(max_file_descriptor, max_file_descriptor, afd);
+ }
}
void
rb_maygvl_fd_fix_cloexec(int fd)
{
/* MinGW don't have F_GETFD and FD_CLOEXEC. [ruby-core:40281] */
-#ifdef F_GETFD
- int flags, flags2, ret;
- flags = fcntl(fd, F_GETFD); /* should not fail except EBADF. */
- if (flags == -1) {
- rb_bug("rb_maygvl_fd_fix_cloexec: fcntl(%d, F_GETFD) failed: %s", fd, strerror(errno));
- }
- if (fd <= 2)
- flags2 = flags & ~FD_CLOEXEC; /* Clear CLOEXEC for standard file descriptors: 0, 1, 2. */
- else
- flags2 = flags | FD_CLOEXEC; /* Set CLOEXEC for non-standard file descriptors: 3, 4, 5, ... */
- if (flags != flags2) {
- ret = fcntl(fd, F_SETFD, flags2);
- if (ret == -1) {
- rb_bug("rb_maygvl_fd_fix_cloexec: fcntl(%d, F_SETFD, %d) failed: %s", fd, flags2, strerror(errno));
+#if defined(HAVE_FCNTL) && defined(F_GETFD) && defined(F_SETFD) && defined(FD_CLOEXEC)
+ int flags, flags2, ret;
+ flags = fcntl(fd, F_GETFD); /* should not fail except EBADF. */
+ if (flags == -1) {
+ rb_bug("rb_maygvl_fd_fix_cloexec: fcntl(%d, F_GETFD) failed: %s", fd, strerror(errno));
+ }
+ if (fd <= 2)
+ flags2 = flags & ~FD_CLOEXEC; /* Clear CLOEXEC for standard file descriptors: 0, 1, 2. */
+ else
+ flags2 = flags | FD_CLOEXEC; /* Set CLOEXEC for non-standard file descriptors: 3, 4, 5, ... */
+ if (flags != flags2) {
+ ret = fcntl(fd, F_SETFD, flags2);
+ if (ret == -1) {
+ rb_bug("rb_maygvl_fd_fix_cloexec: fcntl(%d, F_SETFD, %d) failed: %s", fd, flags2, strerror(errno));
+ }
}
- }
#endif
}
+void
+rb_fd_fix_cloexec(int fd)
+{
+ rb_maygvl_fd_fix_cloexec(fd);
+ rb_update_max_fd(fd);
+}
+
+int
+rb_cloexec_open(const char *pathname, int flags, mode_t mode)
+{
+ int ret;
+#ifdef O_CLOEXEC
+ /* O_CLOEXEC is available since Linux 2.6.23. Linux 2.6.18 silently ignore it. */
+ flags |= O_CLOEXEC;
+#elif defined O_NOINHERIT
+ flags |= O_NOINHERIT;
+#endif
+ ret = open(pathname, flags, mode);
+ if (ret == -1) return -1;
+ rb_maygvl_fd_fix_cloexec(ret);
+ return ret;
+}
+
+int
+rb_cloexec_dup(int oldfd)
+{
+ /* Don't allocate standard file descriptors: 0, 1, 2 */
+ return rb_cloexec_fcntl_dupfd(oldfd, 3);
+}
+
+int
+rb_cloexec_dup2(int oldfd, int newfd)
+{
+ int ret;
+
+ /* When oldfd == newfd, dup2 succeeds but dup3 fails with EINVAL.
+ * rb_cloexec_dup2 succeeds as dup2. */
+ if (oldfd == newfd) {
+ ret = newfd;
+ }
+ else {
+#if defined(HAVE_DUP3) && defined(O_CLOEXEC)
+ static int try_dup3 = 1;
+ if (2 < newfd && try_dup3) {
+ ret = dup3(oldfd, newfd, O_CLOEXEC);
+ if (ret != -1)
+ return ret;
+ /* dup3 is available since Linux 2.6.27, glibc 2.9. */
+ if (errno == ENOSYS) {
+ try_dup3 = 0;
+ ret = dup2(oldfd, newfd);
+ }
+ }
+ else {
+ ret = dup2(oldfd, 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;
+ }
+ rb_maygvl_fd_fix_cloexec(ret);
+ return ret;
+}
+
+int
+rb_cloexec_pipe(int fildes[2])
+{
+ int ret;
+
+#if defined(HAVE_PIPE2)
+ static int try_pipe2 = 1;
+ if (try_pipe2) {
+ ret = pipe2(fildes, O_CLOEXEC);
+ if (ret != -1)
+ return ret;
+ /* pipe2 is available since Linux 2.6.27, glibc 2.9. */
+ if (errno == ENOSYS) {
+ try_pipe2 = 0;
+ ret = pipe(fildes);
+ }
+ }
+ else {
+ ret = pipe(fildes);
+ }
+#else
+ ret = pipe(fildes);
+#endif
+ if (ret == -1) return -1;
+#ifdef __CYGWIN__
+ if (ret == 0 && fildes[1] == -1) {
+ close(fildes[0]);
+ fildes[0] = -1;
+ errno = ENFILE;
+ return -1;
+ }
+#endif
+ rb_maygvl_fd_fix_cloexec(fildes[0]);
+ rb_maygvl_fd_fix_cloexec(fildes[1]);
+ return ret;
+}
+
int
rb_cloexec_fcntl_dupfd(int fd, int minfd)
{
int ret;
-#if defined(HAVE_FCNTL) && defined(F_DUPFD_CLOEXEC)
+#if defined(HAVE_FCNTL) && defined(F_DUPFD_CLOEXEC) && defined(F_DUPFD)
static int try_dupfd_cloexec = 1;
if (try_dupfd_cloexec) {
- ret = fcntl(fd, F_DUPFD_CLOEXEC, minfd);
- if (ret != -1) {
- if (ret <= 2)
- rb_maygvl_fd_fix_cloexec(ret);
- return ret;
- }
- /* F_DUPFD_CLOEXEC is available since Linux 2.6.24. Linux 2.6.18 fails with EINVAL */
- if (errno == EINVAL) {
- ret = fcntl(fd, F_DUPFD, minfd);
- if (ret != -1) {
- try_dupfd_cloexec = 0;
- }
- }
+ ret = fcntl(fd, F_DUPFD_CLOEXEC, minfd);
+ if (ret != -1) {
+ if (ret <= 2)
+ rb_maygvl_fd_fix_cloexec(ret);
+ return ret;
+ }
+ /* F_DUPFD_CLOEXEC is available since Linux 2.6.24. Linux 2.6.18 fails with EINVAL */
+ if (errno == EINVAL) {
+ ret = fcntl(fd, F_DUPFD, minfd);
+ if (ret != -1) {
+ try_dupfd_cloexec = 0;
+ }
+ }
}
else {
- ret = fcntl(fd, F_DUPFD, minfd);
+ ret = fcntl(fd, F_DUPFD, minfd);
}
-#elif defined(F_DUPFD)
+#elif defined(HAVE_FCNTL) && defined(F_DUPFD)
ret = fcntl(fd, F_DUPFD, minfd);
+#elif defined(HAVE_DUP)
+ ret = dup(fd);
+ if (ret != -1 && ret < minfd) {
+ const int prev_fd = ret;
+ ret = rb_cloexec_fcntl_dupfd(fd, minfd);
+ close(prev_fd);
+ }
+ return ret;
#else
- ret = -1;
- errno = EINVAL;
+# error "dup() or fcntl(F_DUPFD) must be supported."
#endif
if (ret == -1) return -1;
rb_maygvl_fd_fix_cloexec(ret);
@@ -279,8 +424,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);
@@ -460,8 +603,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;
}
@@ -490,7 +631,7 @@ rb_io_get_io(VALUE io)
return rb_convert_type(io, T_FILE, "IO", "to_io");
}
-static VALUE
+VALUE
rb_io_check_io(VALUE io)
{
return rb_check_convert_type(io, T_FILE, "IO", "to_io");
@@ -623,8 +764,6 @@ flush_before_seek(rb_io_t *fptr)
# define SEEK_END 2
#endif
-#define FMODE_SYNCWRITE (FMODE_SYNC|FMODE_WRITABLE)
-
void
rb_io_check_char_readable(rb_io_t *fptr)
{
@@ -720,11 +859,11 @@ ruby_dup(int orig)
{
int fd;
- fd = dup(orig);
+ fd = rb_cloexec_dup(orig);
if (fd < 0) {
if (errno == EMFILE || errno == ENFILE || errno == ENOMEM) {
rb_gc();
- fd = dup(orig);
+ fd = rb_cloexec_dup(orig);
}
if (fd < 0) {
rb_sys_fail(0);
@@ -737,8 +876,7 @@ ruby_dup(int orig)
static VALUE
io_alloc(VALUE klass)
{
- NEWOBJ(io, struct RFile);
- OBJSETUP(io, klass, T_FILE);
+ NEWOBJ_OF(io, struct RFile, klass, T_FILE);
io->fptr = 0;
@@ -798,6 +936,13 @@ internal_write_func(void *ptr)
return write(iis->fd, iis->buf, iis->capa);
}
+static void*
+internal_write_func2(void *ptr)
+{
+ struct io_internal_write_struct *iis = ptr;
+ return (void*)(intptr_t)write(iis->fd, iis->buf, iis->capa);
+}
+
static ssize_t
rb_read_internal(int fd, void *buf, size_t count)
{
@@ -820,6 +965,18 @@ rb_write_internal(int fd, const void *buf, size_t count)
return (ssize_t)rb_thread_io_blocking_region(internal_write_func, &iis, fd);
}
+static ssize_t
+rb_write_internal2(int fd, const void *buf, size_t count)
+{
+ struct io_internal_write_struct iis;
+ iis.fd = fd;
+ iis.buf = buf;
+ iis.capa = count;
+
+ return (ssize_t)rb_thread_call_without_gvl2(internal_write_func2, &iis,
+ RUBY_UBF_IO, NULL);
+}
+
static long
io_writable_length(rb_io_t *fptr, long l)
{
@@ -851,6 +1008,18 @@ io_flush_buffer_sync(void *arg)
return (VALUE)-1;
}
+static void*
+io_flush_buffer_sync2(void *arg)
+{
+ VALUE result = io_flush_buffer_sync(arg);
+
+ /*
+ * rb_thread_call_without_gvl2 uses 0 as interrupted.
+ * So, we need to avoid to use 0.
+ */
+ return !result ? (void*)1 : (void*)result;
+}
+
static VALUE
io_flush_buffer_async(VALUE arg)
{
@@ -858,11 +1027,33 @@ io_flush_buffer_async(VALUE arg)
return rb_thread_io_blocking_region(io_flush_buffer_sync, fptr, fptr->fd);
}
+static VALUE
+io_flush_buffer_async2(VALUE arg)
+{
+ rb_io_t *fptr = (rb_io_t *)arg;
+ VALUE ret;
+
+ ret = (VALUE)rb_thread_call_without_gvl2(io_flush_buffer_sync2, fptr,
+ RUBY_UBF_IO, NULL);
+
+ if (!ret) {
+ /* pending async interrupt is there. */
+ errno = EAGAIN;
+ return -1;
+ } else if (ret == 1) {
+ return 0;
+ } else
+ return ret;
+}
+
static inline int
io_flush_buffer(rb_io_t *fptr)
{
if (fptr->write_lock) {
- return (int)rb_mutex_synchronize(fptr->write_lock, io_flush_buffer_async, (VALUE)fptr);
+ if (rb_mutex_owned_p(fptr->write_lock))
+ return (int)io_flush_buffer_async2((VALUE)fptr);
+ else
+ return (int)rb_mutex_synchronize(fptr->write_lock, io_flush_buffer_async2, (VALUE)fptr);
}
else {
return (int)io_flush_buffer_async((VALUE)fptr);
@@ -875,9 +1066,7 @@ io_fflush(rb_io_t *fptr)
rb_io_check_closed(fptr);
if (fptr->wbuf.len == 0)
return 0;
- if (!rb_thread_fd_writable(fptr->fd)) {
- rb_io_check_closed(fptr);
- }
+ rb_io_check_closed(fptr);
while (fptr->wbuf.len > 0 && io_flush_buffer(fptr) != 0) {
if (!rb_io_wait_writable(fptr->fd))
return -1;
@@ -897,14 +1086,14 @@ rb_io_wait_readable(int f)
#if defined(ERESTART)
case ERESTART:
#endif
- rb_thread_wait_fd(f);
+ rb_thread_check_ints();
return TRUE;
case EAGAIN:
#if defined(EWOULDBLOCK) && EWOULDBLOCK != EAGAIN
case EWOULDBLOCK:
#endif
- rb_wait_for_single_fd(f, RB_WAITFD_IN, NULL);
+ rb_thread_wait_fd(f);
return TRUE;
default:
@@ -923,14 +1112,23 @@ rb_io_wait_writable(int f)
#if defined(ERESTART)
case ERESTART:
#endif
- rb_thread_fd_writable(f);
+ /*
+ * In old Linux, several special files under /proc and /sys don't handle
+ * select properly. Thus we need avoid to call if don't use O_NONBLOCK.
+ * Otherwise, we face nasty hang up. Sigh.
+ * e.g. http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=31b07093c44a7a442394d44423e21d783f5523b8
+ * http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=31b07093c44a7a442394d44423e21d783f5523b8
+ * In EINTR case, we only need to call RUBY_VM_CHECK_INTS_BLOCKING().
+ * Then rb_thread_check_ints() is enough.
+ */
+ rb_thread_check_ints();
return TRUE;
case EAGAIN:
#if defined(EWOULDBLOCK) && EWOULDBLOCK != EAGAIN
case EWOULDBLOCK:
#endif
- rb_wait_for_single_fd(f, RB_WAITFD_OUT, NULL);
+ rb_thread_fd_writable(f);
return TRUE;
default:
@@ -1012,7 +1210,7 @@ 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_internal(p->fptr->fd, p->ptr, l);
+ return rb_write_internal2(p->fptr->fd, p->ptr, l);
}
static long
@@ -1020,6 +1218,9 @@ io_binwrite(VALUE str, const char *ptr, long len, rb_io_t *fptr, int nosync)
{
long n, r, offset = 0;
+ /* don't write anything if current thread has a pending interrupt. */
+ rb_thread_check_ints();
+
if ((n = len) <= 0) return n;
if (fptr->wbuf.ptr == NULL && !(!nosync && (fptr->mode & FMODE_SYNC))) {
fptr->wbuf.off = 0;
@@ -1027,12 +1228,18 @@ io_binwrite(VALUE str, const char *ptr, long len, rb_io_t *fptr, int nosync)
fptr->wbuf.capa = IO_WBUF_CAPA_MIN;
fptr->wbuf.ptr = ALLOC_N(char, fptr->wbuf.capa);
fptr->write_lock = rb_mutex_new();
+ rb_mutex_allow_trap(fptr->write_lock, 1);
}
if ((!nosync && (fptr->mode & (FMODE_SYNC|FMODE_TTY))) ||
(fptr->wbuf.ptr && fptr->wbuf.capa <= fptr->wbuf.len + len)) {
struct binwrite_arg arg;
- /* xxx: use writev to avoid double write if available */
+ /*
+ * 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);
@@ -1046,11 +1253,8 @@ io_binwrite(VALUE str, const char *ptr, long len, rb_io_t *fptr, int nosync)
return -1L;
if (n == 0)
return len;
- /* avoid context switch between "a" and "\n" in STDERR.puts "a".
- [ruby-dev:25080] */
- if (fptr->stdio_file != stderr && !rb_thread_fd_writable(fptr->fd)) {
- rb_io_check_closed(fptr);
- }
+
+ rb_io_check_closed(fptr);
arg.fptr = fptr;
arg.str = str;
retry:
@@ -1176,7 +1380,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);
@@ -1187,6 +1390,8 @@ io_write(VALUE io, VALUE str, int nosync)
io = tmp;
if (RSTRING_LEN(str) == 0) return INT2FIX(0);
+ str = rb_str_new_frozen(str);
+
GetOpenFile(io, fptr);
rb_io_check_writable(fptr);
@@ -1223,7 +1428,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);
}
/*
@@ -1249,28 +1454,22 @@ rb_io_addstr(VALUE io, VALUE str)
return 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
- */
+#ifdef HAVE_FSYNC
+static VALUE
+nogvl_fsync(void *ptr)
+{
+ rb_io_t *fptr = ptr;
+
+ return (VALUE)fsync(fptr->fd);
+}
+#endif
VALUE
-rb_io_flush(VALUE io)
+rb_io_flush_raw(VALUE io, int sync)
{
rb_io_t *fptr;
- if (TYPE(io) != T_FILE) {
+ if (!RB_TYPE_P(io, T_FILE)) {
return rb_funcall(io, id_flush, 0);
}
@@ -1281,9 +1480,9 @@ rb_io_flush(VALUE io)
if (io_fflush(fptr) < 0)
rb_sys_fail(0);
#ifdef _WIN32
- if (GetFileType((HANDLE)rb_w32_get_osfhandle(fptr->fd)) == FILE_TYPE_DISK) {
- fsync(fptr->fd);
- }
+ if (sync && GetFileType((HANDLE)rb_w32_get_osfhandle(fptr->fd)) == FILE_TYPE_DISK) {
+ rb_thread_io_blocking_region(nogvl_fsync, fptr, fptr->fd);
+ }
#endif
}
if (fptr->mode & FMODE_READABLE) {
@@ -1295,6 +1494,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
*
@@ -1333,6 +1554,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
@@ -1340,12 +1581,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:
*
@@ -1361,7 +1602,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);
@@ -1372,6 +1613,8 @@ 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 guaranteed that seeking to the right position when <em>ios</em>
+ * is textmode.
*
* f = File.new("testfile")
* f.pos = 17
@@ -1417,11 +1660,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;
}
@@ -1455,7 +1693,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 */
@@ -1544,6 +1788,8 @@ rb_io_sync(VALUE io)
return (fptr->mode & FMODE_SYNC) ? Qtrue : Qfalse;
}
+#ifdef HAVE_FSYNC
+
/*
* call-seq:
* ios.sync = boolean -> boolean
@@ -1575,14 +1821,6 @@ rb_io_set_sync(VALUE io, VALUE sync)
return sync;
}
-#ifdef HAVE_FSYNC
-static VALUE nogvl_fsync(void *ptr)
-{
- rb_io_t *fptr = ptr;
-
- return (VALUE)fsync(fptr->fd);
-}
-
/*
* call-seq:
* ios.fsync -> 0 or nil
@@ -1590,7 +1828,7 @@ static VALUE nogvl_fsync(void *ptr)
* Immediately writes all buffered data in <em>ios</em> to disk.
* Note that <code>fsync</code> differs from
* using <code>IO#sync=</code>. The latter ensures that data is flushed
- * from Ruby's buffers, but doesn't not guarantee that the underlying
+ * from Ruby's buffers, but does not guarantee that the underlying
* operating system actually writes it to disk.
*
* <code>NotImplementedError</code> is raised
@@ -1607,18 +1845,26 @@ rb_io_fsync(VALUE io)
if (io_fflush(fptr) < 0)
rb_sys_fail(0);
-#ifndef _WIN32 /* already called in io_fflush() */
+# 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
+# endif
return INT2FIX(0);
}
#else
-#define rb_io_fsync rb_f_notimplement
+# define rb_io_fsync rb_f_notimplement
+# define rb_io_sync rb_f_notimplement
+static VALUE
+rb_io_set_sync(VALUE io, VALUE sync)
+{
+ rb_notimplement();
+ UNREACHABLE;
+}
#endif
#ifdef HAVE_FDATASYNC
-static VALUE nogvl_fdatasync(void *ptr)
+static VALUE
+nogvl_fdatasync(void *ptr)
{
rb_io_t *fptr = ptr;
@@ -1796,7 +2042,6 @@ io_bufread(char *ptr, long len, rb_io_t *fptr)
}
offset += c;
if ((n -= c) <= 0) break;
- rb_thread_wait_fd(fptr->fd);
}
return len - n;
}
@@ -1807,7 +2052,6 @@ io_bufread(char *ptr, long len, rb_io_t *fptr)
offset += c;
if ((n -= c) <= 0) break;
}
- rb_thread_wait_fd(fptr->fd);
rb_io_check_closed(fptr);
if (io_fillbuf(fptr) < 0) {
break;
@@ -1816,15 +2060,34 @@ io_bufread(char *ptr, long len, rb_io_t *fptr)
return len - n;
}
+static void io_setstrbuf(VALUE *str, long len);
+
+struct bufread_arg {
+ char *str_ptr;
+ long len;
+ rb_io_t *fptr;
+};
+
+static VALUE
+bufread_call(VALUE arg)
+{
+ struct bufread_arg *p = (struct bufread_arg *)arg;
+ p->len = io_bufread(p->str_ptr, p->len, p->fptr);
+ return Qundef;
+}
+
static long
-io_fread(VALUE str, long offset, rb_io_t *fptr)
+io_fread(VALUE str, long offset, long size, rb_io_t *fptr)
{
long len;
-
- rb_str_locktmp(str);
- len = io_bufread(RSTRING_PTR(str) + offset, RSTRING_LEN(str) - offset,
- fptr);
- rb_str_unlocktmp(str);
+ struct bufread_arg arg;
+
+ io_setstrbuf(&str, offset + size);
+ arg.str_ptr = RSTRING_PTR(str) + offset;
+ arg.len = size;
+ arg.fptr = fptr;
+ rb_str_locktmp_ensure(str, bufread_call, (VALUE)&arg);
+ len = arg.len;
if (len < 0) rb_sys_fail_path(fptr->pathv);
return len;
}
@@ -2019,29 +2282,36 @@ io_shift_cbuf(rb_io_t *fptr, int len, VALUE *strp)
}
static void
-io_setstrbuf(VALUE *str,long len)
+io_setstrbuf(VALUE *str, long len)
{
#ifdef _WIN32
+ len = (len + 1) & ~1L; /* round up for wide char */
+#endif
if (NIL_P(*str)) {
- *str = rb_str_new(0, len+1);
- rb_str_set_len(*str,len);
+ *str = rb_str_new(0, 0);
}
else {
- StringValue(*str);
- rb_str_modify(*str);
- rb_str_resize(*str, len+1);
- rb_str_set_len(*str,len);
- }
-#else
- if (NIL_P(*str)) {
- *str = rb_str_new(0, 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);
+ }
+ return;
+ }
+ len -= clen;
}
- else {
- StringValue(*str);
- rb_str_modify(*str);
- rb_str_resize(*str, len);
+ rb_str_modify_expand(*str, len);
+}
+
+static void
+io_set_read_length(VALUE str, long n)
+{
+ if (RSTRING_LEN(str) != n) {
+ rb_str_modify(str);
+ rb_str_set_len(str, n);
}
-#endif
}
static VALUE
@@ -2087,18 +2357,19 @@ read_all(rb_io_t *fptr, long siz, VALUE str)
io_setstrbuf(&str,siz);
for (;;) {
READ_CHECK(fptr);
- n = io_fread(str, bytes, fptr);
+ n = io_fread(str, bytes, siz - bytes, fptr);
if (n == 0 && bytes == 0) {
+ rb_str_set_len(str, 0);
break;
}
bytes += n;
+ rb_str_set_len(str, bytes);
if (cr != ENC_CODERANGE_BROKEN)
pos += rb_str_coderange_scan_restartable(RSTRING_PTR(str) + pos, RSTRING_PTR(str) + bytes, enc, &cr);
if (bytes < siz) break;
siz += BUFSIZ;
- rb_str_resize(str, siz);
+ rb_str_modify_expand(str, BUFSIZ);
}
- if (bytes != siz) rb_str_resize(str, bytes);
str = io_enc_str(str, fptr);
ENC_CODERANGE_SET(str, cr);
return str;
@@ -2124,14 +2395,32 @@ 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;
+ long len;
+};
+
static VALUE
-io_getpartial(int argc, VALUE *argv, VALUE io, int nonblock)
+read_internal_call(VALUE arg)
+{
+ struct read_internal_arg *p = (struct read_internal_arg *)arg;
+ p->len = rb_read_internal(p->fd, p->str_ptr, p->len);
+ return Qundef;
+}
+
+static VALUE
+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);
@@ -2154,18 +2443,25 @@ io_getpartial(int argc, VALUE *argv, VALUE io, int nonblock)
if (nonblock) {
rb_io_set_nonblock(fptr);
}
- rb_str_locktmp(str);
- n = rb_read_internal(fptr->fd, RSTRING_PTR(str), len);
- rb_str_unlocktmp(str);
+ io_setstrbuf(&str, len);
+ arg.fd = fptr->fd;
+ arg.str_ptr = RSTRING_PTR(str);
+ arg.len = len;
+ rb_str_locktmp_ensure(str, read_internal_call, (VALUE)&arg);
+ n = arg.len;
if (n < 0) {
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);
}
}
- rb_str_resize(str, n);
+ io_set_read_length(str, n);
if (n == 0)
return Qnil;
@@ -2183,6 +2479,8 @@ io_getpartial(int argc, VALUE *argv, VALUE io, int nonblock)
* It doesn't block if some data available.
* If the optional <i>outbuf</i> argument is present,
* it must reference a String, which will receive the data.
+ * The <i>outbuf</i> will contain only the received data after the method call
+ * even if it is not empty at the beginning.
* It raises <code>EOFError</code> on end of file.
*
* readpartial is designed for streams such as pipe, socket, tty, etc.
@@ -2235,11 +2533,10 @@ 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();
- else
- return ret;
+ return ret;
}
/*
@@ -2253,6 +2550,8 @@ io_readpartial(int argc, VALUE *argv, VALUE io)
*
* If the optional <i>outbuf</i> argument is present,
* it must reference a String, which will receive the data.
+ * The <i>outbuf</i> will contain only the received data after the method call
+ * even if it is not empty at the beginning.
*
* read_nonblock just calls the read(2) system call.
* It causes all errors the read(2) system call causes: Errno::EWOULDBLOCK, Errno::EINTR, etc.
@@ -2295,17 +2594,62 @@ 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();
- else
- return ret;
+ rb_scan_args(argc, argv, "11:", NULL, NULL, &opts);
+
+ if (!NIL_P(opts) && Qfalse == rb_hash_aref(opts, sym_exception))
+ 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
@@ -2354,40 +2698,30 @@ 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 (TYPE(str) != T_STRING)
- str = rb_obj_as_string(str);
-
- io = GetWriteIO(io);
- GetOpenFile(io, fptr);
- rb_io_check_writable(fptr);
+ VALUE str;
+ VALUE opts = Qnil;
+ int no_exceptions = 0;
- if (io_fflush(fptr) < 0)
- rb_sys_fail(0);
+ rb_scan_args(argc, argv, "10:", &str, &opts);
- rb_io_set_nonblock(fptr);
- n = write(fptr->fd, RSTRING_PTR(str), RSTRING_LEN(str));
+ if (!NIL_P(opts) && Qfalse == rb_hash_aref(opts, sym_exception))
+ no_exceptions = 1;
- if (n == -1) {
- if (errno == EWOULDBLOCK || errno == EAGAIN)
- rb_mod_sys_fail(rb_mWaitWritable, "write would block");
- rb_sys_fail_path(fptr->pathv);
- }
-
- return LONG2FIX(n);
+ return io_write_nonblock(io, str, no_exceptions);
}
/*
* call-seq:
- * ios.read([length [, buffer]]) -> string, buffer, or nil
+ * ios.read([length [, outbuf]]) -> string, outbuf, or nil
*
* Reads <i>length</i> bytes from the I/O stream.
*
@@ -2407,8 +2741,10 @@ rb_io_write_nonblock(VALUE io, VALUE str)
*
* If <i>length</i> is zero, it returns <code>""</code>.
*
- * If the optional <i>buffer</i> argument is present, it must reference
+ * If the optional <i>outbuf</i> argument is present, it must reference
* a String, which will receive the data.
+ * The <i>outbuf</i> will contain only the received data after the method call
+ * even if it is not empty at the beginning.
*
* At end of file, it returns <code>nil</code> or <code>""</code>
* depend on <i>length</i>.
@@ -2442,7 +2778,10 @@ rb_io_write_nonblock(VALUE io, VALUE str)
* }
*
* Note that this method behaves like fread() function in C.
- * If you need the behavior like read(2) system call,
+ * This means it retry to invoke read(2) system call to read data with the specified length (or until EOF).
+ * This behavior is preserved even if <i>ios</i> is non-blocking mode.
+ * (This method is non-blocking flag insensitive as other methods.)
+ * If you need the behavior like single read(2) system call,
* consider readpartial, read_nonblock and sysread.
*/
@@ -2478,18 +2817,14 @@ io_read(int argc, VALUE *argv, VALUE io)
#if defined(RUBY_TEST_CRLF_ENVIRONMENT) || defined(_WIN32)
previous_mode = set_binary_mode_with_seek_cur(fptr);
#endif
- n = io_fread(str, 0, fptr);
+ n = io_fread(str, 0, len, fptr);
+ io_set_read_length(str, n);
#if defined(RUBY_TEST_CRLF_ENVIRONMENT) || defined(_WIN32)
if (previous_mode == O_TEXT) {
setmode(fptr->fd, O_TEXT);
}
#endif
- if (n == 0) {
- if (fptr->fd < 0) return Qnil;
- rb_str_resize(str, 0);
- return Qnil;
- }
- rb_str_resize(str, n);
+ if (n == 0) return Qnil;
OBJ_TAINT(str);
return str;
@@ -2514,10 +2849,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);
@@ -2643,7 +2977,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) {
@@ -2669,11 +3003,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);
@@ -2795,7 +3126,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;
@@ -2804,7 +3135,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))) {
@@ -2820,25 +3151,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;
}
}
@@ -3020,11 +3346,6 @@ rb_io_readlines(int argc, VALUE *argv, VALUE io)
* ios.each_line(sep,limit) {|line| block } -> ios
* ios.each_line(...) -> an_enumerator
*
- * ios.lines(sep=$/) {|line| block } -> ios
- * ios.lines(limit) {|line| block } -> ios
- * ios.lines(sep,limit) {|line| block } -> ios
- * ios.lines(...) -> an_enumerator
- *
* Executes the block for every line in <em>ios</em>, where lines are
* separated by <i>sep</i>. <em>ios</em> must be opened for
* reading or an <code>IOError</code> will be raised.
@@ -3059,10 +3380,20 @@ rb_io_each_line(int argc, VALUE *argv, VALUE io)
}
/*
+ * This is a deprecated alias for <code>each_line</code>.
+ */
+
+static VALUE
+rb_io_lines(int argc, VALUE *argv, VALUE io)
+{
+ rb_warn("IO#lines is deprecated; use #each_line instead");
+ if (!rb_block_given_p())
+ return rb_enumeratorize(io, ID2SYM(rb_intern("each_line")), argc, argv);
+ return rb_io_each_line(argc, argv, io);
+}
+
+/*
* call-seq:
- * ios.bytes {|byte| block } -> ios
- * ios.bytes -> an_enumerator
- *
* ios.each_byte {|byte| block } -> ios
* ios.each_byte -> an_enumerator
*
@@ -3082,27 +3413,36 @@ static VALUE
rb_io_each_byte(VALUE io)
{
rb_io_t *fptr;
- char *p, *e;
RETURN_ENUMERATOR(io, 0, 0);
GetOpenFile(io, fptr);
- for (;;) {
+ do {
while (fptr->rbuf.len > 0) {
- p = fptr->rbuf.ptr + fptr->rbuf.off++;
- e = p + fptr->rbuf.len--;
+ char *p = fptr->rbuf.ptr + fptr->rbuf.off++;
+ fptr->rbuf.len--;
rb_yield(INT2FIX(*p & 0xff));
errno = 0;
}
rb_io_check_byte_readable(fptr);
READ_CHECK(fptr);
- if (io_fillbuf(fptr) < 0) {
- break;
- }
- }
+ } while (io_fillbuf(fptr) >= 0);
return io;
}
+/*
+ * This is a deprecated alias for <code>each_byte</code>.
+ */
+
+static VALUE
+rb_io_bytes(VALUE io)
+{
+ rb_warn("IO#bytes is deprecated; use #each_byte instead");
+ if (!rb_block_given_p())
+ return rb_enumeratorize(io, ID2SYM(rb_intern("each_byte")), 0, 0);
+ return rb_io_each_byte(io);
+}
+
static VALUE
io_getc(rb_io_t *fptr, rb_encoding *enc)
{
@@ -3212,9 +3552,6 @@ io_getc(rb_io_t *fptr, rb_encoding *enc)
/*
* call-seq:
- * ios.chars {|c| block } -> ios
- * ios.chars -> an_enumerator
- *
* ios.each_char {|c| block } -> ios
* ios.each_char -> an_enumerator
*
@@ -3247,6 +3584,19 @@ rb_io_each_char(VALUE io)
return io;
}
+/*
+ * This is a deprecated alias for <code>each_char</code>.
+ */
+
+static VALUE
+rb_io_chars(VALUE io)
+{
+ rb_warn("IO#chars is deprecated; use #each_char instead");
+ if (!rb_block_given_p())
+ return rb_enumeratorize(io, ID2SYM(rb_intern("each_char")), 0, 0);
+ return rb_io_each_char(io);
+}
+
/*
* call-seq:
@@ -3320,10 +3670,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) &&
@@ -3344,6 +3691,18 @@ rb_io_each_codepoint(VALUE io)
return io;
}
+/*
+ * This is a deprecated alias for <code>each_codepoint</code>.
+ */
+
+static VALUE
+rb_io_codepoints(VALUE io)
+{
+ rb_warn("IO#codepoints is deprecated; use #each_codepoint instead");
+ if (!rb_block_given_p())
+ return rb_enumeratorize(io, ID2SYM(rb_intern("each_codepoint")), 0, 0);
+ return rb_io_each_codepoint(io);
+}
/*
@@ -3416,7 +3775,7 @@ rb_io_getbyte(VALUE io)
GetOpenFile(io, fptr);
rb_io_check_byte_readable(fptr);
READ_CHECK(fptr);
- if (fptr->fd == 0 && (fptr->mode & FMODE_TTY) && TYPE(rb_stdout) == T_FILE) {
+ if (fptr->fd == 0 && (fptr->mode & FMODE_TTY) && RB_TYPE_P(rb_stdout, T_FILE)) {
rb_io_t *ofp;
GetOpenFile(rb_stdout, ofp);
if (ofp->mode & FMODE_TTY) {
@@ -3515,7 +3874,7 @@ rb_io_ungetc(VALUE io, VALUE c)
if (FIXNUM_P(c)) {
c = rb_enc_uint_chr(FIX2UINT(c), io_read_encoding(fptr));
}
- else if (TYPE(c) == T_BIGNUM) {
+ else if (RB_TYPE_P(c, T_BIGNUM)) {
c = rb_enc_uint_chr(NUM2UINT(c), io_read_encoding(fptr));
}
else {
@@ -3624,6 +3983,14 @@ rb_io_close_on_exec_p(VALUE io)
* f.close_on_exec = true
* system("cat", "/proc/self/fd/#{f.fileno}") # cat: /proc/self/fd/3: No such file or directory
* f.closed? #=> false
+ *
+ * Ruby sets close-on-exec flags of all file descriptors by default
+ * since Ruby 2.0.0.
+ * So you don't need to set by yourself.
+ * Also, unsetting a close-on-exec flag can cause file descriptor leak
+ * if another thread use fork() and exec() (via system() method for example).
+ * If you really needs file descriptor inheritance to child process,
+ * use spawn()'s argument such as fd=>fd.
*/
static VALUE
@@ -3684,7 +4051,10 @@ finish_writeconv(rb_io_t *fptr, int noalloc)
res = rb_econv_convert(fptr->writeconv, NULL, NULL, &dp, de, 0);
while (dp-ds) {
retry:
- r = rb_write_internal(fptr->fd, ds, dp-ds);
+ if (fptr->write_lock && rb_mutex_owned_p(fptr->write_lock))
+ r = rb_write_internal2(fptr->fd, ds, dp-ds);
+ else
+ r = rb_write_internal(fptr->fd, ds, dp-ds);
if (r == dp-ds)
break;
if (0 <= r) {
@@ -3739,10 +4109,51 @@ finish_writeconv_sync(VALUE arg)
return finish_writeconv(p->fptr, p->noalloc);
}
+static void*
+nogvl_close(void *ptr)
+{
+ int *fd = ptr;
+
+ return (void*)(intptr_t)close(*fd);
+}
+
+static int
+maygvl_close(int fd, int keepgvl)
+{
+ if (keepgvl)
+ return close(fd);
+
+ /*
+ * close() may block for certain file types (NFS, SO_LINGER sockets,
+ * inotify), so let other threads run.
+ */
+ return (int)(intptr_t)rb_thread_call_without_gvl(nogvl_close, &fd, RUBY_UBF_IO, 0);
+}
+
+static void*
+nogvl_fclose(void *ptr)
+{
+ FILE *file = ptr;
+
+ return (void*)(intptr_t)fclose(file);
+}
+
+static int
+maygvl_fclose(FILE *file, int keepgvl)
+{
+ if (keepgvl)
+ return fclose(file);
+
+ return (int)(intptr_t)rb_thread_call_without_gvl(nogvl_fclose, file, RUBY_UBF_IO, 0);
+}
+
static void
fptr_finalize(rb_io_t *fptr, int noraise)
{
VALUE err = Qnil;
+ int fd = fptr->fd;
+ FILE *stdio_file = fptr->stdio_file;
+
if (fptr->writeconv) {
if (fptr->write_lock && !noraise) {
struct finish_writeconv_arg arg;
@@ -3764,29 +4175,30 @@ fptr_finalize(rb_io_t *fptr, int noraise)
err = INT2NUM(errno);
}
}
- if (IS_PREP_STDIO(fptr) || fptr->fd <= 2) {
- goto skip_fd_close;
+
+ fptr->fd = -1;
+ fptr->stdio_file = 0;
+ fptr->mode &= ~(FMODE_READABLE|FMODE_WRITABLE);
+
+ if (IS_PREP_STDIO(fptr) || fd <= 2) {
+ /* need to keep FILE objects of stdin, stdout and stderr */
}
- if (fptr->stdio_file) {
- /* fptr->stdio_file is deallocated anyway
+ else if (stdio_file) {
+ /* stdio_file is deallocated anyway
* even if fclose failed. */
- if (fclose(fptr->stdio_file) < 0 && NIL_P(err))
- err = noraise ? Qtrue : INT2NUM(errno);
+ if ((maygvl_fclose(stdio_file, noraise) < 0) && NIL_P(err))
+ err = noraise ? Qtrue : INT2NUM(errno);
}
- else if (0 <= fptr->fd) {
- /* fptr->fd may be closed even if close fails.
+ else if (0 <= fd) {
+ /* fptr->fd may be closed even if close fails.
* POSIX doesn't specify it.
* We assumes it is closed. */
- if (close(fptr->fd) < 0 && NIL_P(err))
- err = noraise ? Qtrue : INT2NUM(errno);
+ if ((maygvl_close(fd, noraise) < 0) && NIL_P(err))
+ err = noraise ? Qtrue : INT2NUM(errno);
}
- skip_fd_close:
- fptr->fd = -1;
- fptr->stdio_file = 0;
- fptr->mode &= ~(FMODE_READABLE|FMODE_WRITABLE);
if (!NIL_P(err) && !noraise) {
- switch(TYPE(err)) {
+ switch (TYPE(err)) {
case T_FIXNUM:
case T_BIGNUM:
errno = NUM2INT(err);
@@ -3895,16 +4307,11 @@ rb_io_close(VALUE io)
if (fptr->fd < 0) return Qnil;
fd = fptr->fd;
-#if defined __APPLE__ && defined(__MACH__) && \
- (!defined(MAC_OS_X_VERSION_MIN_ALLOWED) || MAC_OS_X_VERSION_MIN_ALLOWED <= 1050)
- /* close(2) on a fd which is being read by another thread causes
- * deadlock on Mac OS X 10.5 */
rb_thread_fd_close(fd);
-#endif
rb_io_fptr_cleanup(fptr, FALSE);
- rb_thread_fd_close(fd);
if (fptr->pid) {
+ rb_last_status_clear();
rb_syswait(fptr->pid);
fptr->pid = 0;
}
@@ -3929,9 +4336,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;
@@ -4012,9 +4416,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
@@ -4031,11 +4432,16 @@ rb_io_close_read(VALUE io)
write_io = GetWriteIO(io);
if (io != write_io) {
rb_io_t *wfptr;
- rb_io_fptr_cleanup(fptr, FALSE);
GetOpenFile(write_io, wfptr);
+ wfptr->pid = fptr->pid;
+ fptr->pid = 0;
RFILE(io)->fptr = wfptr;
- RFILE(write_io)->fptr = NULL;
- rb_io_fptr_finalize(fptr);
+ /* bind to write_io temporarily to get rid of memory/fd leak */
+ fptr->tied_io_for_writing = 0;
+ fptr->mode &= ~FMODE_DUPLEX;
+ RFILE(write_io)->fptr = fptr;
+ rb_io_fptr_cleanup(fptr, FALSE);
+ /* should not finalize fptr because another thread may be reading it */
return Qnil;
}
@@ -4070,9 +4476,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)) {
@@ -4091,12 +4494,12 @@ rb_io_close_write(VALUE io)
rb_raise(rb_eIOError, "closing non-duplex IO for writing");
}
- rb_io_close(write_io);
if (io != write_io) {
GetOpenFile(io, fptr);
fptr->tied_io_for_writing = 0;
fptr->mode &= ~FMODE_DUPLEX;
}
+ rb_io_close(write_io);
return Qnil;
}
@@ -4122,7 +4525,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);
@@ -4159,20 +4562,18 @@ rb_io_syswrite(VALUE io, VALUE str)
rb_io_t *fptr;
long n;
- rb_secure(4);
- if (TYPE(str) != T_STRING)
+ if (!RB_TYPE_P(str, T_STRING))
str = rb_obj_as_string(str);
io = GetWriteIO(io);
GetOpenFile(io, fptr);
rb_io_check_writable(fptr);
+ str = rb_str_new_frozen(str);
+
if (fptr->wbuf.len) {
rb_warn("syswrite for buffered IO");
}
- if (!rb_thread_fd_writable(fptr->fd)) {
- rb_io_check_closed(fptr);
- }
n = rb_write_internal(fptr->fd, RSTRING_PTR(str), RSTRING_LEN(str));
@@ -4190,6 +4591,8 @@ rb_io_syswrite(VALUE io, VALUE str)
* that read from <em>ios</em> or you may get unpredictable results.
* If the optional <i>outbuf</i> argument is present, it must reference
* a String, which will receive the data.
+ * The <i>outbuf</i> will contain only the received data after the method call
+ * even if it is not empty at the beginning.
* Raises <code>SystemCallError</code> on error and
* <code>EOFError</code> at end of file.
*
@@ -4203,6 +4606,7 @@ rb_io_sysread(int argc, VALUE *argv, VALUE io)
VALUE len, str;
rb_io_t *fptr;
long n, ilen;
+ struct read_internal_arg arg;
rb_scan_args(argc, argv, "11", &len, &str);
ilen = NUM2LONG(len);
@@ -4218,21 +4622,33 @@ rb_io_sysread(int argc, VALUE *argv, VALUE io)
}
n = fptr->fd;
+
+ /*
+ * FIXME: removing rb_thread_wait_fd() here changes sysread semantics
+ * on non-blocking IOs. However, it's still currently possible
+ * for sysread to raise Errno::EAGAIN if another thread read()s
+ * the IO after we return from rb_thread_wait_fd() but before
+ * we call read()
+ */
rb_thread_wait_fd(fptr->fd);
+
rb_io_check_closed(fptr);
+ io_setstrbuf(&str, ilen);
rb_str_locktmp(str);
- n = rb_read_internal(fptr->fd, RSTRING_PTR(str), ilen);
- rb_str_unlocktmp(str);
+ arg.fd = fptr->fd;
+ arg.str_ptr = RSTRING_PTR(str);
+ arg.len = ilen;
+ rb_ensure(read_internal_call, (VALUE)&arg, rb_str_unlocktmp, str);
+ n = arg.len;
if (n == -1) {
rb_sys_fail_path(fptr->pathv);
}
- rb_str_set_len(str, n);
+ io_set_read_length(str, n);
if (n == 0 && ilen > 0) {
rb_eof_error();
}
- rb_str_resize(str, n);
OBJ_TAINT(str);
return str;
@@ -4262,12 +4678,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;
@@ -4285,6 +4698,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;
}
@@ -4339,6 +4761,8 @@ rb_io_fmode_modestr(int fmode)
return MODE_BTMODE("a", "ab", "at");
}
switch (fmode & FMODE_READWRITE) {
+ default:
+ rb_raise(rb_eArgError, "invalid access fmode 0x%x", fmode);
case FMODE_READABLE:
return MODE_BTMODE("r", "rb", "rt");
case FMODE_WRITABLE:
@@ -4349,8 +4773,6 @@ rb_io_fmode_modestr(int fmode)
}
return MODE_BTMODE("r+", "rb+", "rt+");
}
- rb_raise(rb_eArgError, "invalid access fmode 0x%x", fmode);
- return NULL; /* not reached */
}
static int
@@ -4508,6 +4930,8 @@ rb_io_oflags_modestr(int oflags)
}
}
switch (oflags & (O_RDONLY|O_WRONLY|O_RDWR)) {
+ default:
+ rb_raise(rb_eArgError, "invalid access oflags 0x%x", oflags);
case O_RDONLY:
return MODE_BINARY("r", "rb");
case O_WRONLY:
@@ -4515,8 +4939,6 @@ rb_io_oflags_modestr(int oflags)
case O_RDWR:
return MODE_BINARY("r+", "rb+");
}
- rb_raise(rb_eArgError, "invalid access oflags 0x%x", oflags);
- return NULL; /* not reached */
}
/*
@@ -4525,7 +4947,7 @@ rb_io_oflags_modestr(int oflags)
* Qnil => no encoding specified (internal only)
*/
static void
-rb_io_ext_int_to_encs(rb_encoding *ext, rb_encoding *intern, rb_encoding **enc, rb_encoding **enc2)
+rb_io_ext_int_to_encs(rb_encoding *ext, rb_encoding *intern, rb_encoding **enc, rb_encoding **enc2, int fmode)
{
int default_ext = 0;
@@ -4533,10 +4955,15 @@ 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 || intern == ext) {
+ }
+ if (intern == NULL || intern == (rb_encoding *)Qnil ||
+ (!(fmode & FMODE_SETENC_BY_BOM) && (intern == ext))) {
/* No internal encoding => use external + no transcoding */
*enc = (default_ext && intern != ext) ? NULL : ext;
*enc2 = NULL;
@@ -4548,11 +4975,18 @@ rb_io_ext_int_to_encs(rb_encoding *ext, rb_encoding *intern, rb_encoding **enc,
}
static void
+unsupported_encoding(const char *name)
+{
+ rb_warn("Unsupported encoding %s ignored", name);
+}
+
+static void
parse_mode_enc(const char *estr, rb_encoding **enc_p, rb_encoding **enc2_p, int *fmode_p)
{
const char *p;
char encname[ENCODING_MAXNAMELEN+1];
int idx, idx2;
+ int fmode = fmode_p ? *fmode_p : 0;
rb_encoding *ext_enc, *int_enc;
/* parse estr as "enc" or "enc2:enc" or "enc:-" */
@@ -4564,7 +4998,7 @@ parse_mode_enc(const char *estr, rb_encoding **enc_p, rb_encoding **enc2_p, int
idx = -1;
else {
if (io_encname_bom_p(estr, len)) {
- if (fmode_p) *fmode_p |= FMODE_SETENC_BY_BOM;
+ fmode |= FMODE_SETENC_BY_BOM;
estr += 4;
len -= 4;
}
@@ -4577,7 +5011,7 @@ parse_mode_enc(const char *estr, rb_encoding **enc_p, rb_encoding **enc2_p, int
else {
long len = strlen(estr);
if (io_encname_bom_p(estr, len)) {
- if (fmode_p) *fmode_p |= FMODE_SETENC_BY_BOM;
+ fmode |= FMODE_SETENC_BY_BOM;
estr += 4;
len -= 4;
memcpy(encname, estr, len);
@@ -4586,12 +5020,13 @@ parse_mode_enc(const char *estr, rb_encoding **enc_p, rb_encoding **enc2_p, int
}
idx = rb_enc_find_index(estr);
}
+ if (fmode_p) *fmode_p = fmode;
if (idx >= 0)
ext_enc = rb_enc_from_index(idx);
else {
if (idx != -2)
- rb_warn("Unsupported encoding %s ignored", estr);
+ unsupported_encoding(estr);
ext_enc = NULL;
}
@@ -4604,9 +5039,8 @@ parse_mode_enc(const char *estr, rb_encoding **enc_p, rb_encoding **enc2_p, int
else {
idx2 = rb_enc_find_index(p);
if (idx2 < 0)
- rb_warn("Unsupported encoding %s ignored", p);
- else if (idx2 == idx) {
- rb_warn("Ignoring internal encoding %s: it is identical to external encoding %s", p, estr);
+ unsupported_encoding(p);
+ else if (!(fmode & FMODE_SETENC_BY_BOM) && (idx2 == idx)) {
int_enc = (rb_encoding *)Qnil;
}
else
@@ -4614,24 +5048,7 @@ parse_mode_enc(const char *estr, rb_encoding **enc_p, rb_encoding **enc2_p, int
}
}
- rb_io_ext_int_to_encs(ext_enc, int_enc, enc_p, enc2_p);
-}
-
-static void
-mode_enc(rb_io_t *fptr, const char *estr)
-{
- clear_codeconv(fptr);
-
- parse_mode_enc(estr, &fptr->encs.enc, &fptr->encs.enc2, NULL);
-}
-
-static void
-rb_io_mode_enc(rb_io_t *fptr, const char *modestr)
-{
- const char *p = strchr(modestr, ':');
- if (p) {
- mode_enc(fptr, p+1);
- }
+ rb_io_ext_int_to_encs(ext_enc, int_enc, enc_p, enc2_p, fmode);
}
int
@@ -4692,12 +5109,12 @@ rb_io_extract_encoding_option(VALUE opt, rb_encoding **enc_p, rb_encoding **enc2
parse_mode_enc(StringValueCStr(tmp), enc_p, enc2_p, fmode_p);
}
else {
- rb_io_ext_int_to_encs(rb_to_encoding(encoding), NULL, enc_p, enc2_p);
+ rb_io_ext_int_to_encs(rb_to_encoding(encoding), NULL, enc_p, enc2_p, 0);
}
}
else if (extenc != Qundef || intenc != Qundef) {
extracted = 1;
- rb_io_ext_int_to_encs(extencoding, intencoding, enc_p, enc2_p);
+ rb_io_ext_int_to_encs(extencoding, intencoding, enc_p, enc2_p, 0);
}
return extracted;
}
@@ -4734,11 +5151,23 @@ extract_binmode(VALUE opthash, int *fmode)
if (!NIL_P(opthash)) {
VALUE v;
v = rb_hash_aref(opthash, sym_textmode);
- if (!NIL_P(v) && RTEST(v))
- *fmode |= FMODE_TEXTMODE;
+ 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;
+ }
v = rb_hash_aref(opthash, sym_binmode);
- if (!NIL_P(v) && RTEST(v))
- *fmode |= FMODE_BINMODE;
+ 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;
+ }
if ((*fmode & FMODE_BINMODE) && (*fmode & FMODE_TEXTMODE))
rb_raise(rb_eArgError, "both textmode and binmode specified");
@@ -4760,7 +5189,7 @@ rb_io_extract_modeenc(VALUE *vmode_p, VALUE *vperm_p, VALUE opthash,
vmode = *vmode_p;
/* Set to defaults */
- rb_io_ext_int_to_encs(NULL, NULL, &enc, &enc2);
+ rb_io_ext_int_to_encs(NULL, NULL, &enc, &enc2, 0);
vmode_handle:
if (NIL_P(vmode)) {
@@ -4788,7 +5217,7 @@ rb_io_extract_modeenc(VALUE *vmode_p, VALUE *vperm_p, VALUE opthash,
rb_encoding *e;
e = (fmode & FMODE_BINMODE) ? rb_ascii8bit_encoding() : NULL;
- rb_io_ext_int_to_encs(e, NULL, &enc, &enc2);
+ rb_io_ext_int_to_encs(e, NULL, &enc, &enc2, fmode);
}
}
@@ -4807,10 +5236,13 @@ rb_io_extract_modeenc(VALUE *vmode_p, VALUE *vperm_p, VALUE opthash,
else {
VALUE v;
extract_binmode(opthash, &fmode);
+ if (fmode & FMODE_BINMODE) {
#ifdef O_BINARY
- if (fmode & FMODE_BINMODE)
oflags |= O_BINARY;
#endif
+ if (!has_enc)
+ rb_io_ext_int_to_encs(rb_ascii8bit_encoding(), NULL, &enc, &enc2, fmode);
+ }
#if DEFAULT_TEXTMODE
else if (NIL_P(vmode)) {
fmode |= DEFAULT_TEXTMODE;
@@ -4875,19 +5307,19 @@ struct sysopen_struct {
mode_t perm;
};
-static VALUE
+static void *
sysopen_func(void *ptr)
{
const struct sysopen_struct *data = ptr;
const char *fname = RSTRING_PTR(data->fname);
- return (VALUE)open(fname, data->oflags, data->perm);
+ return (void *)(VALUE)rb_cloexec_open(fname, data->oflags, data->perm);
}
static inline int
rb_sysopen_internal(struct sysopen_struct *data)
{
int fd;
- fd = (int)rb_thread_blocking_region(sysopen_func, data, RUBY_UBF_IO, 0);
+ fd = (int)(VALUE)rb_thread_call_without_gvl(sysopen_func, data, RUBY_UBF_IO, 0);
if (0 <= fd)
rb_update_max_fd(fd);
return fd;
@@ -4913,7 +5345,6 @@ rb_sysopen(VALUE fname, int oflags, mode_t perm)
rb_sys_fail_path(fname);
}
}
- rb_update_max_fd(fd);
return fd;
}
@@ -4922,18 +5353,18 @@ rb_fdopen(int fd, const char *modestr)
{
FILE *file;
-#if defined(sun)
+#if defined(__sun)
errno = 0;
#endif
file = fdopen(fd, modestr);
if (!file) {
if (
-#if defined(sun)
+#if defined(__sun)
errno == 0 ||
#endif
errno == EMFILE || errno == ENFILE) {
rb_gc();
-#if defined(sun)
+#if defined(__sun)
errno = 0;
#endif
file = fdopen(fd, modestr);
@@ -4941,7 +5372,7 @@ rb_fdopen(int fd, const char *modestr)
if (!file) {
#ifdef _WIN32
if (errno == 0) errno = EINVAL;
-#elif defined(sun)
+#elif defined(__sun)
if (errno == 0) errno = EMFILE;
#endif
rb_sys_fail(0);
@@ -4987,7 +5418,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;
@@ -4998,14 +5429,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);
@@ -5016,7 +5447,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);
}
@@ -5033,13 +5464,16 @@ static void
io_set_encoding_by_bom(VALUE io)
{
int idx = io_strip_bom(io);
+ rb_io_t *fptr;
+ GetOpenFile(io, fptr);
if (idx) {
- rb_io_t *fptr;
- GetOpenFile(io, fptr);
io_encoding_set(fptr, rb_enc_from_encoding(rb_enc_from_index(idx)),
rb_io_internal_encoding(io), Qnil);
}
+ else {
+ fptr->encs.enc2 = NULL;
+ }
}
static VALUE
@@ -5049,7 +5483,7 @@ rb_file_open_generic(VALUE io, VALUE filename, int oflags, int fmode, convconfig
convconfig_t cc;
if (!convconfig) {
/* Set to default encodings */
- rb_io_ext_int_to_encs(NULL, NULL, &cc.enc, &cc.enc2);
+ rb_io_ext_int_to_encs(NULL, NULL, &cc.enc, &cc.enc2, fmode);
cc.ecflags = 0;
cc.ecopts = Qnil;
convconfig = &cc;
@@ -5083,7 +5517,7 @@ rb_file_open_internal(VALUE io, VALUE filename, const char *modestr)
/* Set to default encodings */
e = (fmode & FMODE_BINMODE) ? rb_ascii8bit_encoding() : NULL;
- rb_io_ext_int_to_encs(e, NULL, &convconfig.enc, &convconfig.enc2);
+ rb_io_ext_int_to_encs(e, NULL, &convconfig.enc, &convconfig.enc2, fmode);
convconfig.ecflags = 0;
convconfig.ecopts = Qnil;
}
@@ -5196,11 +5630,11 @@ int
rb_pipe(int *pipes)
{
int ret;
- ret = pipe(pipes);
+ ret = rb_cloexec_pipe(pipes);
if (ret == -1) {
if (errno == EMFILE || errno == ENFILE) {
rb_gc();
- ret = pipe(pipes);
+ ret = rb_cloexec_pipe(pipes);
}
}
if (ret == 0) {
@@ -5210,14 +5644,23 @@ rb_pipe(int *pipes)
return ret;
}
-#ifdef HAVE_FORK
+#ifdef _WIN32
+#define HAVE_SPAWNV 1
+#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)
struct popen_arg {
- struct rb_exec_arg *execp;
+ VALUE execarg_obj;
+ struct rb_execarg *eargp;
int modef;
int pair[2];
int write_pair[2];
};
+#endif
+#ifdef HAVE_FORK
static void
popen_redirect(struct popen_arg *p)
{
@@ -5249,25 +5692,75 @@ popen_redirect(struct popen_arg *p)
}
}
+#if defined(__linux__)
+/* Linux /proc/self/status contains a line: "FDSize:\t<nnn>\n"
+ * Since /proc may not be available, linux_get_maxfd is just a hint.
+ * This function, linux_get_maxfd, must be async-signal-safe.
+ * I.e. opendir() is not usable.
+ *
+ * Note that memchr() and memcmp is *not* async-signal-safe in POSIX.
+ * However they are easy to re-implement in async-signal-safe manner.
+ * (Also note that there is missing/memcmp.c.)
+ */
+static int
+linux_get_maxfd(void)
+{
+ int fd;
+ char buf[4096], *p, *np, *e;
+ ssize_t ss;
+ fd = rb_cloexec_open("/proc/self/status", O_RDONLY|O_NOCTTY, 0);
+ if (fd == -1) return -1;
+ ss = read(fd, buf, sizeof(buf));
+ if (ss == -1) goto err;
+ p = buf;
+ e = buf + ss;
+ while ((int)sizeof("FDSize:\t0\n")-1 <= e-p &&
+ (np = memchr(p, '\n', e-p)) != NULL) {
+ if (memcmp(p, "FDSize:", sizeof("FDSize:")-1) == 0) {
+ int fdsize;
+ p += sizeof("FDSize:")-1;
+ *np = '\0';
+ fdsize = (int)ruby_strtoul(p, (char **)NULL, 10);
+ close(fd);
+ return fdsize;
+ }
+ p = np+1;
+ }
+ /* fall through */
+
+ err:
+ close(fd);
+ return -1;
+}
+#endif
+
+/* This function should be async-signal-safe. */
void
rb_close_before_exec(int lowfd, int maxhint, VALUE noclose_fds)
{
int fd, ret;
- int max = max_file_descriptor;
+ int max = (int)max_file_descriptor;
+#ifdef F_MAXFD
+ /* F_MAXFD is available since NetBSD 2.0. */
+ ret = fcntl(0, F_MAXFD); /* async-signal-safe */
+ if (ret != -1)
+ maxhint = max = ret;
+#elif defined(__linux__)
+ ret = linux_get_maxfd();
+ if (maxhint < ret)
+ maxhint = ret;
+ /* maxhint = max = ret; if (ret == -1) abort(); // test */
+#endif
if (max < maxhint)
max = maxhint;
for (fd = lowfd; fd <= max; fd++) {
if (!NIL_P(noclose_fds) &&
- RTEST(rb_hash_lookup(noclose_fds, INT2FIX(fd))))
+ RTEST(rb_hash_lookup(noclose_fds, INT2FIX(fd)))) /* async-signal-safe */
continue;
-#ifdef FD_CLOEXEC
- ret = fcntl(fd, F_GETFD);
+ ret = fcntl(fd, F_GETFD); /* async-signal-safe */
if (ret != -1 && !(ret & FD_CLOEXEC)) {
- fcntl(fd, F_SETFD, ret|FD_CLOEXEC);
+ fcntl(fd, F_SETFD, ret|FD_CLOEXEC); /* async-signal-safe */
}
-#else
- ret = close(fd);
-#endif
#define CONTIGUOUS_CLOSED_FDS 20
if (ret != -1) {
if (max < fd + CONTIGUOUS_CLOSED_FDS)
@@ -5281,14 +5774,15 @@ popen_exec(void *pp, char *errmsg, size_t errmsg_len)
{
struct popen_arg *p = (struct popen_arg*)pp;
- rb_thread_atfork_before_exec();
- return rb_exec_err(p->execp, errmsg, errmsg_len);
+ return rb_exec_async_signal_safe(p->eargp, errmsg, errmsg_len);
}
#endif
static VALUE
-pipe_open(struct rb_exec_arg *eargp, VALUE prog, const char *modestr, int fmode, convconfig_t *convconfig)
+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);
+ VALUE prog = eargp ? (eargp->use_shell ? eargp->invoke.sh.shell_script : eargp->invoke.cmd.command_name) : Qfalse ;
rb_pid_t pid = 0;
rb_io_t *fptr;
VALUE port;
@@ -5296,85 +5790,116 @@ pipe_open(struct rb_exec_arg *eargp, VALUE prog, const char *modestr, int fmode,
VALUE write_port;
#if defined(HAVE_FORK)
int status;
- struct popen_arg arg;
char errmsg[80] = { '\0' };
-#elif defined(_WIN32)
- volatile VALUE argbuf;
+#endif
+#if defined(HAVE_FORK) || defined(HAVE_SPAWNV)
+ struct popen_arg arg;
+ int e = 0;
+#endif
+#if defined(HAVE_SPAWNV)
+# if defined(HAVE_SPAWNVE)
+# define DO_SPAWN(cmd, args, envp) ((args) ? \
+ spawnve(P_NOWAIT, (cmd), (args), (envp)) : \
+ spawne(P_NOWAIT, (cmd), (envp)))
+# else
+# define DO_SPAWN(cmd, args, envp) ((args) ? \
+ spawnv(P_NOWAIT, (cmd), (args)) : \
+ spawn(P_NOWAIT, (cmd)))
+# endif
+# if !defined(HAVE_FORK)
char **args = NULL;
- int pair[2], write_pair[2];
+# if defined(HAVE_SPAWNVE)
+ char **envp = NULL;
+# endif
+# endif
#endif
#if !defined(HAVE_FORK)
- struct rb_exec_arg sarg;
+ struct rb_execarg sarg, *sargp = &sarg;
#endif
FILE *fp = 0;
int fd = -1;
int write_fd = -1;
+#if !defined(HAVE_FORK)
const char *cmd = 0;
+#if !defined(HAVE_SPAWNV)
int argc;
VALUE *argv;
+#endif
if (prog)
cmd = StringValueCStr(prog);
+#endif
- if (!eargp) {
- /* fork : IO.popen("-") */
- argc = 0;
- argv = 0;
- }
- else if (eargp->argc) {
- /* no shell : IO.popen([prog, arg0], arg1, ...) */
- argc = eargp->argc;
- argv = eargp->argv;
- }
- else {
- /* with shell : IO.popen(prog) */
- argc = 0;
- argv = 0;
- }
-
-#if defined(HAVE_FORK)
- arg.execp = eargp;
+#if defined(HAVE_FORK) || defined(HAVE_SPAWNV)
+ arg.execarg_obj = execarg_obj;
+ arg.eargp = eargp;
arg.modef = fmode;
arg.pair[0] = arg.pair[1] = -1;
arg.write_pair[0] = arg.write_pair[1] = -1;
+# if !defined(HAVE_FORK)
+ if (eargp && !eargp->use_shell) {
+ args = ARGVSTR2ARGV(eargp->invoke.cmd.argv_str);
+ }
+# endif
switch (fmode & (FMODE_READABLE|FMODE_WRITABLE)) {
case FMODE_READABLE|FMODE_WRITABLE:
if (rb_pipe(arg.write_pair) < 0)
- rb_sys_fail(cmd);
+ rb_sys_fail_str(prog);
if (rb_pipe(arg.pair) < 0) {
int e = errno;
close(arg.write_pair[0]);
close(arg.write_pair[1]);
errno = e;
- rb_sys_fail(cmd);
+ rb_sys_fail_str(prog);
}
if (eargp) {
- rb_exec_arg_addopt(eargp, INT2FIX(0), INT2FIX(arg.write_pair[0]));
- rb_exec_arg_addopt(eargp, INT2FIX(1), INT2FIX(arg.pair[1]));
+ rb_execarg_addopt(execarg_obj, INT2FIX(0), INT2FIX(arg.write_pair[0]));
+ rb_execarg_addopt(execarg_obj, INT2FIX(1), INT2FIX(arg.pair[1]));
}
break;
case FMODE_READABLE:
if (rb_pipe(arg.pair) < 0)
- rb_sys_fail(cmd);
+ rb_sys_fail_str(prog);
if (eargp)
- rb_exec_arg_addopt(eargp, INT2FIX(1), INT2FIX(arg.pair[1]));
+ rb_execarg_addopt(execarg_obj, INT2FIX(1), INT2FIX(arg.pair[1]));
break;
case FMODE_WRITABLE:
if (rb_pipe(arg.pair) < 0)
- rb_sys_fail(cmd);
+ rb_sys_fail_str(prog);
if (eargp)
- rb_exec_arg_addopt(eargp, INT2FIX(0), INT2FIX(arg.pair[0]));
+ rb_execarg_addopt(execarg_obj, INT2FIX(0), INT2FIX(arg.pair[0]));
break;
default:
- rb_sys_fail(cmd);
+ rb_sys_fail_str(prog);
}
- if (eargp) {
- rb_exec_arg_fixup(arg.execp);
- pid = rb_fork_err(&status, popen_exec, &arg, arg.execp->redirect_fds, errmsg, sizeof(errmsg));
+ if (!NIL_P(execarg_obj)) {
+ rb_execarg_fixup(execarg_obj);
+# if defined(HAVE_FORK)
+ pid = rb_fork_async_signal_safe(&status, popen_exec, &arg, arg.eargp->redirect_fds, errmsg, sizeof(errmsg));
+# else
+ rb_execarg_run_options(eargp, sargp, NULL, 0);
+# if defined(HAVE_SPAWNVE)
+ if (eargp->envp_str) envp = (char **)RSTRING_PTR(eargp->envp_str);
+# endif
+ while ((pid = DO_SPAWN(cmd, args, envp)) == -1) {
+ /* exec failed */
+ switch (e = errno) {
+ case EAGAIN:
+# if defined(EWOULDBLOCK) && EWOULDBLOCK != EAGAIN
+ case EWOULDBLOCK:
+# endif
+ rb_thread_sleep(1);
+ continue;
+ }
+ break;
+ }
+ if (eargp)
+ rb_execarg_run_options(sargp, NULL, NULL, 0);
+# endif
}
else {
- fflush(stdin); /* is it really needed? */
- pid = rb_fork(&status, 0, 0, Qnil);
+# if defined(HAVE_FORK)
+ pid = rb_fork_ruby(&status);
if (pid == 0) { /* child */
rb_thread_atfork();
popen_redirect(&arg);
@@ -5382,11 +5907,16 @@ pipe_open(struct rb_exec_arg *eargp, VALUE prog, const char *modestr, int fmode,
rb_io_synchronized(RFILE(orig_stderr)->fptr);
return Qnil;
}
+# else
+ rb_notimplement();
+# endif
}
/* parent */
if (pid == -1) {
- int e = errno;
+# if defined(HAVE_FORK)
+ e = errno;
+# endif
close(arg.pair[0]);
close(arg.pair[1]);
if ((fmode & (FMODE_READABLE|FMODE_WRITABLE)) == (FMODE_READABLE|FMODE_WRITABLE)) {
@@ -5394,9 +5924,11 @@ pipe_open(struct rb_exec_arg *eargp, VALUE prog, const char *modestr, int fmode,
close(arg.write_pair[1]);
}
errno = e;
+# if defined(HAVE_FORK)
if (errmsg[0])
rb_sys_fail(errmsg);
- rb_sys_fail(cmd);
+# endif
+ rb_sys_fail_str(prog);
}
if ((fmode & FMODE_READABLE) && (fmode & FMODE_WRITABLE)) {
close(arg.pair[1]);
@@ -5412,114 +5944,18 @@ pipe_open(struct rb_exec_arg *eargp, VALUE prog, const char *modestr, int fmode,
close(arg.pair[0]);
fd = arg.pair[1];
}
-#elif defined(_WIN32)
- if (argc) {
- int i;
-
- if (argc >= (int)(FIXNUM_MAX / sizeof(char *))) {
- rb_raise(rb_eArgError, "too many arguments");
- }
- argbuf = rb_str_tmp_new((argc+1) * sizeof(char *));
- args = (void *)RSTRING_PTR(argbuf);
- for (i = 0; i < argc; ++i) {
- args[i] = StringValueCStr(argv[i]);
- }
- args[i] = NULL;
- }
- switch (fmode & (FMODE_READABLE|FMODE_WRITABLE)) {
- case FMODE_READABLE|FMODE_WRITABLE:
- if (rb_pipe(write_pair) < 0)
- rb_sys_fail(cmd);
- if (rb_pipe(pair) < 0) {
- int e = errno;
- close(write_pair[0]);
- close(write_pair[1]);
- errno = e;
- rb_sys_fail(cmd);
- }
- if (eargp) {
- rb_exec_arg_addopt(eargp, INT2FIX(0), INT2FIX(write_pair[0]));
- rb_exec_arg_addopt(eargp, INT2FIX(1), INT2FIX(pair[1]));
- }
- break;
- case FMODE_READABLE:
- if (rb_pipe(pair) < 0)
- rb_sys_fail(cmd);
- if (eargp)
- rb_exec_arg_addopt(eargp, INT2FIX(1), INT2FIX(pair[1]));
- break;
- case FMODE_WRITABLE:
- if (rb_pipe(pair) < 0)
- rb_sys_fail(cmd);
- if (eargp)
- rb_exec_arg_addopt(eargp, INT2FIX(0), INT2FIX(pair[0]));
- break;
- default:
- rb_sys_fail(cmd);
- }
- if (eargp) {
- rb_exec_arg_fixup(eargp);
- rb_run_exec_options(eargp, &sarg);
- }
- while ((pid = (args ?
- rb_w32_aspawn(P_NOWAIT, cmd, args) :
- rb_w32_spawn(P_NOWAIT, cmd, 0))) == -1) {
- /* exec failed */
- switch (errno) {
- case EAGAIN:
-#if defined(EWOULDBLOCK) && EWOULDBLOCK != EAGAIN
- case EWOULDBLOCK:
-#endif
- rb_thread_sleep(1);
- break;
- default:
- {
- int e = errno;
- if (eargp)
- rb_run_exec_options(&sarg, NULL);
- close(pair[0]);
- close(pair[1]);
- if ((fmode & (FMODE_READABLE|FMODE_WRITABLE)) == (FMODE_READABLE|FMODE_WRITABLE)) {
- close(write_pair[0]);
- close(write_pair[1]);
- }
- errno = e;
- rb_sys_fail(cmd);
- }
- break;
- }
- }
-
- RB_GC_GUARD(argbuf);
-
- if (eargp)
- rb_run_exec_options(&sarg, NULL);
- if ((fmode & FMODE_READABLE) && (fmode & FMODE_WRITABLE)) {
- close(pair[1]);
- fd = pair[0];
- close(write_pair[0]);
- write_fd = write_pair[1];
- }
- else if (fmode & FMODE_READABLE) {
- close(pair[1]);
- fd = pair[0];
- }
- else {
- close(pair[0]);
- fd = pair[1];
- }
#else
if (argc) {
prog = rb_ary_join(rb_ary_new4(argc, argv), rb_str_new2(" "));
cmd = StringValueCStr(prog);
}
- if (eargp) {
- rb_exec_arg_fixup(eargp);
- rb_run_exec_options(eargp, &sarg);
+ if (!NIL_P(execarg_obj)) {
+ rb_execarg_fixup(execarg_obj);
+ rb_execarg_run_options(eargp, sargp, NULL, 0);
}
fp = popen(cmd, modestr);
if (eargp)
- rb_run_exec_options(&sarg, NULL);
+ rb_execarg_run_options(sargp, NULL, NULL, 0);
if (!fp) rb_sys_fail_path(prog);
fd = fileno(fp);
#endif
@@ -5566,39 +6002,36 @@ pipe_open(struct rb_exec_arg *eargp, VALUE prog, const char *modestr, int fmode,
return port;
}
-static VALUE
-pipe_open_v(int argc, VALUE *argv, const char *modestr, int fmode, convconfig_t *convconfig)
+static int
+is_popen_fork(VALUE prog)
{
- VALUE prog;
- struct rb_exec_arg earg;
- prog = rb_exec_arg_init(argc, argv, FALSE, &earg);
- return pipe_open(&earg, prog, modestr, fmode, convconfig);
+ if (RSTRING_LEN(prog) == 1 && RSTRING_PTR(prog)[0] == '-') {
+#if !defined(HAVE_FORK)
+ rb_raise(rb_eNotImpError,
+ "fork() function is unimplemented on this machine");
+#else
+ return TRUE;
+#endif
+ }
+ return FALSE;
}
static VALUE
pipe_open_s(VALUE prog, const char *modestr, int fmode, convconfig_t *convconfig)
{
- const char *cmd = RSTRING_PTR(prog);
int argc = 1;
VALUE *argv = &prog;
- struct rb_exec_arg earg;
+ VALUE execarg_obj = Qnil;
- if (RSTRING_LEN(prog) == 1 && cmd[0] == '-') {
-#if !defined(HAVE_FORK)
- rb_raise(rb_eNotImpError,
- "fork() function is unimplemented on this machine");
-#endif
- return pipe_open(0, 0, modestr, fmode, convconfig);
- }
-
- rb_exec_arg_init(argc, argv, TRUE, &earg);
- return pipe_open(&earg, prog, modestr, fmode, convconfig);
+ if (!is_popen_fork(prog))
+ execarg_obj = rb_execarg_new(argc, argv, TRUE);
+ return pipe_open(execarg_obj, modestr, fmode, convconfig);
}
/*
* call-seq:
- * IO.popen(cmd, mode="r" [, opt]) -> io
- * IO.popen(cmd, mode="r" [, opt]) {|io| block } -> obj
+ * IO.popen([env,] cmd, mode="r" [, opt]) -> io
+ * IO.popen([env,] cmd, mode="r" [, opt]) {|io| block } -> obj
*
* Runs the specified command as a subprocess; the subprocess's
* standard input and output will be connected to the returned
@@ -5638,6 +6071,11 @@ pipe_open_s(VALUE prog, const char *modestr, int fmode, convconfig_t *convconfig
* ls_result_with_error = ls_io.read
* }
*
+ * # spawn options can be mixed with IO options
+ * IO.popen(["ls", "/"], :err=>[:child, :out]) {|ls_io|
+ * ls_result_with_error = ls_io.read
+ * }
+ *
* Raises exceptions which <code>IO.pipe</code> and
* <code>Kernel.spawn</code> raise.
*
@@ -5682,14 +6120,24 @@ static VALUE
rb_io_s_popen(int argc, VALUE *argv, VALUE klass)
{
const char *modestr;
- VALUE pname, pmode, port, tmp, opt;
+ VALUE pname, pmode = Qnil, port, tmp, opt = Qnil, env = Qnil, execarg_obj = Qnil;
int oflags, fmode;
convconfig_t convconfig;
- argc = rb_scan_args(argc, argv, "11:", &pname, &pmode, &opt);
-
- rb_io_extract_modeenc(&pmode, 0, opt, &oflags, &fmode, &convconfig);
- modestr = rb_io_oflags_modestr(oflags);
+ if (argc > 1 && !NIL_P(opt = rb_check_hash_type(argv[argc-1]))) --argc;
+ if (argc > 1 && !NIL_P(env = rb_check_hash_type(argv[0]))) --argc, ++argv;
+ switch (argc) {
+ case 2:
+ pmode = argv[1];
+ case 1:
+ pname = argv[0];
+ break;
+ default:
+ {
+ int ex = !NIL_P(opt);
+ rb_error_arity(argc + ex, 1 + ex, 2 + ex);
+ }
+ }
tmp = rb_check_array_type(pname);
if (!NIL_P(tmp)) {
@@ -5700,14 +6148,26 @@ rb_io_s_popen(int argc, VALUE *argv, VALUE klass)
}
#endif
tmp = rb_ary_dup(tmp);
- RBASIC(tmp)->klass = 0;
- port = pipe_open_v((int)len, RARRAY_PTR(tmp), modestr, fmode, &convconfig);
+ RBASIC_CLEAR_CLASS(tmp);
+ execarg_obj = rb_execarg_new((int)len, RARRAY_PTR(tmp), FALSE);
rb_ary_clear(tmp);
}
else {
SafeStringValue(pname);
- port = pipe_open_s(pname, modestr, fmode, &convconfig);
+ execarg_obj = Qnil;
+ if (!is_popen_fork(pname))
+ execarg_obj = rb_execarg_new(1, &pname, TRUE);
+ }
+ if (!NIL_P(execarg_obj)) {
+ if (!NIL_P(opt))
+ opt = rb_execarg_extract_options(execarg_obj, opt);
+ if (!NIL_P(env))
+ rb_execarg_setenv(execarg_obj, env);
}
+ rb_io_extract_modeenc(&pmode, 0, opt, &oflags, &fmode, &convconfig);
+ modestr = rb_io_oflags_modestr(oflags);
+
+ port = pipe_open(execarg_obj, modestr, fmode, &convconfig);
if (NIL_P(port)) {
/* child */
if (rb_block_given_p()) {
@@ -5718,7 +6178,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);
}
@@ -5726,7 +6186,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)
{
@@ -5748,7 +6208,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;
@@ -5773,27 +6233,29 @@ rb_open_file(int argc, VALUE *argv, VALUE io)
*
* With no associated block, <code>File.open</code> is a synonym for
* File.new. If the optional code block is given, it will
- * be passed the opened +file+ as an argument, and the File object will
- * automatically be closed when the block terminates. In this instance,
- * <code>File.open</code> returns the value of the block.
+ * be passed the opened +file+ as an argument and the File object will
+ * automatically be closed when the block terminates. The value of the block
+ * will be returned from <code>File.open</code>.
*
- * See IO.new for a list of values for the +opt+ parameter.
+ * If a file is being created, its initial permissions may be set using the
+ * +perm+ parameter. See File.new for further discussion.
+ *
+ * See IO.new for a description of the +mode+ and +opt+ parameters.
*/
/*
* Document-method: IO::open
*
* call-seq:
- * IO.open(fd, mode_string="r" [, opt]) -> io
- * IO.open(fd, mode_string="r" [, opt]) {|io| block } -> obj
- *
- * With no associated block, <code>IO.open</code> is a synonym for IO.new. If
- * the optional code block is given, it will be passed +io+ as an
- * argument, and the IO object will automatically be closed when the block
- * terminates. In this instance, IO.open returns the value of the block.
+ * IO.open(fd, mode="r" [, opt]) -> io
+ * IO.open(fd, mode="r" [, opt]) { |io| block } -> obj
*
- * See IO.new for a description of values for the +opt+ parameter.
+ * With no associated block, <code>IO.open</code> is a synonym for IO.new. If
+ * the optional code block is given, it will be passed +io+ as an argument,
+ * and the IO object will automatically be closed when the block terminates.
+ * In this instance, IO.open returns the value of the block.
*
+ * See IO.new for a description of the +fd+, +mode+ and +opt+ parameters.
*/
static VALUE
@@ -5816,7 +6278,6 @@ rb_io_s_open(int argc, VALUE *argv, VALUE klass)
* <code>Fixnum</code>.
*
* IO.sysopen("testfile") #=> 3
- *
*/
static VALUE
@@ -5864,72 +6325,58 @@ check_pipe_command(VALUE filename_or_command)
/*
* call-seq:
- * open(path [, mode_enc [, perm]] [, opt]) -> io or nil
- * open(path [, mode_enc [, perm]] [, opt]) {|io| block } -> obj
- *
- * Creates an <code>IO</code> object connected to the given stream,
- * file, or subprocess.
- *
- * If <i>path</i> does not start with a pipe character
- * (``<code>|</code>''), treat it as the name of a file to open using
- * the specified mode (defaulting to ``<code>r</code>'').
- *
- * The mode_enc is
- * either a string or an integer. If it is an integer, it must be
- * bitwise-or of open(2) flags, such as File::RDWR or File::EXCL.
- * If it is a string, it is either "mode", "mode:ext_enc", or
- * "mode:ext_enc:int_enc".
- * The mode is one of the following:
- *
- * r: read (default)
- * w: write
- * a: append
- *
- * The mode can be followed by "b" (means binary-mode), or "+"
- * (means both reading and writing allowed) or both.
- * If ext_enc (external encoding) is specified,
- * read string will be tagged by the encoding in reading,
- * and output string will be converted
- * to the specified encoding in writing.
- * If ext_enc starts with 'BOM|', check whether the input has a BOM. If
- * there is a BOM, strip it and set external encoding as
- * what the BOM tells. If there is no BOM, use ext_enc without 'BOM|'.
- * If two encoding names,
- * ext_enc and int_enc (external encoding and internal encoding),
- * are specified, the read string is converted from ext_enc
- * to int_enc then tagged with the int_enc in read mode,
- * and in write mode, the output string will be
- * converted from int_enc to ext_enc before writing.
- *
- * If a file is being created, its initial permissions may be
- * set using the integer third parameter.
- *
- * If a block is specified, it will be invoked with the
- * <code>File</code> object as a parameter, and the file will be
- * automatically closed when the block terminates. The call
- * returns the value of the block.
+ * open(path [, mode [, perm]] [, opt]) -> io or nil
+ * open(path [, mode [, perm]] [, opt]) {|io| block } -> obj
+ *
+ * Creates an IO object connected to the given stream, file, or subprocess.
+ *
+ * If +path+ does not start with a pipe character (<code>|</code>), treat it
+ * as the name of a file to open using the specified mode (defaulting to
+ * "r").
+ *
+ * The +mode+ is either a string or an integer. If it is an integer, it
+ * must be bitwise-or of open(2) flags, such as File::RDWR or File::EXCL. If
+ * it is a string, it is either "fmode", "fmode:ext_enc", or
+ * "fmode:ext_enc:int_enc".
+ *
+ * See the documentation of IO.new for full documentation of the +mode+ string
+ * directives.
+ *
+ * If a file is being created, its initial permissions may be set using the
+ * +perm+ parameter. See File.new and the open(2) and chmod(2) man pages for
+ * a description of permissions.
+ *
+ * If a block is specified, it will be invoked with the IO object as a
+ * parameter, and the IO will be automatically closed when the block
+ * terminates. The call returns the value of the block.
+ *
+ * If +path+ starts with a pipe character (<code>"|"</code>), a subprocess is
+ * created, connected to the caller by a pair of pipes. The returned IO
+ * object may be used to write to the standard input and read from the
+ * standard output of this subprocess.
+ *
+ * If the command following the pipe is a single minus sign
+ * (<code>"|-"</code>), Ruby forks, and this subprocess is connected to the
+ * parent. If the command is not <code>"-"</code>, the subprocess runs the
+ * command.
+ *
+ * When the subprocess is ruby (opened via <code>"|-"</code>), the +open+
+ * call returns +nil+. If a block is associated with the open call, that
+ * block will run twice --- once in the parent and once in the child.
*
- * If <i>path</i> starts with a pipe character, a subprocess is
- * created, connected to the caller by a pair of pipes. The returned
- * <code>IO</code> object may be used to write to the standard input
- * and read from the standard output of this subprocess. If the command
- * following the ``<code>|</code>'' is a single minus sign, Ruby forks,
- * and this subprocess is connected to the parent. In the subprocess,
- * the <code>open</code> call returns <code>nil</code>. If the command
- * is not ``<code>-</code>'', the subprocess runs the command. If a
- * block is associated with an <code>open("|-")</code> call, that block
- * will be run twice---once in the parent and once in the child. The
- * block parameter will be an <code>IO</code> object in the parent and
- * <code>nil</code> in the child. The parent's <code>IO</code> object
- * will be connected to the child's <code>$stdin</code> and
- * <code>$stdout</code>. The subprocess will be terminated at the end
- * of the block.
+ * The block parameter will be an IO object in the parent and +nil+ in the
+ * child. The parent's +IO+ object will be connected to the child's $stdin
+ * and $stdout. The subprocess will be terminated at the end of the block.
+ *
+ * === Examples
+ *
+ * Reading from "testfile":
*
* open("testfile") do |f|
* print f.gets
* end
*
- * <em>produces:</em>
+ * Produces:
*
* This is line one
*
@@ -5939,7 +6386,7 @@ check_pipe_command(VALUE filename_or_command)
* print cmd.gets
* cmd.close
*
- * <em>produces:</em>
+ * Produces:
*
* Wed Apr 9 08:56:31 CDT 2003
*
@@ -5953,21 +6400,23 @@ check_pipe_command(VALUE filename_or_command)
* puts "Got: #{f.gets}"
* end
*
- * <em>produces:</em>
+ * Produces:
*
* Got: in Child
*
- * Open a subprocess using a block to receive the I/O object:
+ * Open a subprocess using a block to receive the IO object:
*
- * open("|-") do |f|
- * if f == nil
- * puts "in Child"
- * else
+ * open "|-" do |f|
+ * if f then
+ * # parent process
* puts "Got: #{f.gets}"
+ * else
+ * # child process
+ * puts "in Child"
* end
* end
*
- * <em>produces:</em>
+ * Produces:
*
* Got: in Child
*/
@@ -6030,7 +6479,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;
@@ -6047,10 +6496,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);
@@ -6097,7 +6542,7 @@ io_reopen(VALUE io, VALUE nfile)
if (fd != fd2) {
if (IS_PREP_STDIO(fptr) || fd <= 2 || !fptr->stdio_file) {
/* need to keep FILE objects of stdin, stdout and stderr */
- if (dup2(fd2, fd) < 0)
+ if (rb_cloexec_dup2(fd2, fd) < 0)
rb_sys_fail_path(orig->pathv);
rb_update_max_fd(fd);
}
@@ -6105,7 +6550,7 @@ io_reopen(VALUE io, VALUE nfile)
fclose(fptr->stdio_file);
fptr->stdio_file = 0;
fptr->fd = -1;
- if (dup2(fd2, fd) < 0)
+ if (rb_cloexec_dup2(fd2, fd) < 0)
rb_sys_fail_path(orig->pathv);
rb_update_max_fd(fd);
fptr->fd = fd;
@@ -6125,7 +6570,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;
}
@@ -6148,12 +6593,11 @@ io_reopen(VALUE io, VALUE nfile)
static VALUE
rb_io_reopen(int argc, VALUE *argv, VALUE file)
{
- VALUE fname, nmode;
+ VALUE fname, nmode, opt;
int oflags;
rb_io_t *fptr;
- rb_secure(4);
- if (rb_scan_args(argc, argv, "11", &fname, &nmode) == 1) {
+ if (rb_scan_args(argc, argv, "11:", &fname, &nmode, &opt) == 1) {
VALUE tmp = rb_io_check_io(fname);
if (!NIL_P(tmp)) {
return io_reopen(file, tmp);
@@ -6168,8 +6612,11 @@ rb_io_reopen(int argc, VALUE *argv, VALUE file)
MEMZERO(fptr, rb_io_t, 1);
}
- if (!NIL_P(nmode)) {
- int fmode = rb_io_modestr_fmode(StringValueCStr(nmode));
+ if (!NIL_P(nmode) || !NIL_P(opt)) {
+ int fmode;
+ convconfig_t convconfig;
+
+ rb_io_extract_modeenc(&nmode, 0, opt, &oflags, &fmode, &convconfig);
if (IS_PREP_STDIO(fptr) &&
((fptr->mode & FMODE_READWRITE) & (fmode & FMODE_READWRITE)) !=
(fptr->mode & FMODE_READWRITE)) {
@@ -6179,13 +6626,13 @@ rb_io_reopen(int argc, VALUE *argv, VALUE file)
rb_io_fmode_modestr(fmode));
}
fptr->mode = fmode;
- rb_io_mode_enc(fptr, StringValueCStr(nmode));
- fptr->encs.ecflags = 0;
- fptr->encs.ecopts = Qnil;
+ fptr->encs = convconfig;
+ }
+ else {
+ oflags = rb_io_fmode_oflags(fptr->mode);
}
fptr->pathv = rb_str_new_frozen(fname);
- oflags = rb_io_fmode_oflags(fptr->mode);
if (fptr->fd < 0) {
fptr->fd = rb_sysopen(fptr->pathv, oflags, 0666);
fptr->stdio_file = 0;
@@ -6203,16 +6650,29 @@ rb_io_reopen(int argc, VALUE *argv, VALUE file)
rb_sys_fail_path(fptr->pathv);
}
fptr->fd = fileno(fptr->stdio_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 %"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 %"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;
@@ -6228,7 +6688,7 @@ rb_io_init_copy(VALUE dest, VALUE io)
off_t pos;
io = rb_io_get_io(io);
- if (dest == io) return dest;
+ if (!OBJ_INIT_COPY(dest, io)) return dest;
GetOpenFile(io, orig);
MakeOpenFile(dest, fptr);
@@ -6287,9 +6747,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
@@ -6298,7 +6758,7 @@ rb_f_printf(int argc, VALUE *argv)
VALUE out;
if (argc == 0) return Qnil;
- if (TYPE(argv[0]) == T_STRING) {
+ if (RB_TYPE_P(argv[0], T_STRING)) {
out = rb_stdout;
}
else {
@@ -6410,7 +6870,7 @@ static VALUE
rb_io_putc(VALUE io, VALUE ch)
{
VALUE str;
- if (TYPE(ch) == T_STRING) {
+ if (RB_TYPE_P(ch, T_STRING)) {
str = rb_str_substr(ch, 0, 1);
}
else {
@@ -6467,13 +6927,15 @@ io_puts_ary(VALUE ary, VALUE out, int recur)
if (recur) {
tmp = rb_str_new2("[...]");
rb_io_puts(1, &tmp, out);
- return Qnil;
+ return Qtrue;
}
+ 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 Qnil;
+ return Qtrue;
}
/*
@@ -6508,13 +6970,11 @@ rb_io_puts(int argc, VALUE *argv, VALUE out)
return Qnil;
}
for (i=0; i<argc; i++) {
- if (TYPE(argv[i]) == T_STRING) {
+ if (RB_TYPE_P(argv[i], T_STRING)) {
line = argv[i];
goto string;
}
- line = rb_check_array_type(argv[i]);
- if (!NIL_P(line)) {
- rb_exec_recursive(io_puts_ary, line, out);
+ if (rb_exec_recursive(io_puts_ary, argv[i], out)) {
continue;
}
line = rb_obj_as_string(argv[i]);
@@ -6551,7 +7011,7 @@ void
rb_p(VALUE obj) /* for debug print within C code */
{
VALUE str = rb_obj_as_string(rb_inspect(obj));
- if (TYPE(rb_stdout) == T_FILE &&
+ if (RB_TYPE_P(rb_stdout, T_FILE) &&
rb_method_basic_definition_p(CLASS_OF(rb_stdout), id_write)) {
io_write(rb_stdout, str, 1);
io_write(rb_stdout, rb_default_rs, 0);
@@ -6562,6 +7022,35 @@ rb_p(VALUE obj) /* for debug print within C code */
}
}
+struct rb_f_p_arg {
+ int argc;
+ VALUE *argv;
+};
+
+static VALUE
+rb_f_p_internal(VALUE arg)
+{
+ struct rb_f_p_arg *arg1 = (struct rb_f_p_arg*)arg;
+ int argc = arg1->argc;
+ VALUE *argv = arg1->argv;
+ int i;
+ VALUE ret = Qnil;
+
+ for (i=0; i<argc; i++) {
+ rb_p(argv[i]);
+ }
+ if (argc == 1) {
+ ret = argv[0];
+ }
+ else if (argc > 1) {
+ ret = rb_ary_new4(argc, argv);
+ }
+ if (RB_TYPE_P(rb_stdout, T_FILE)) {
+ rb_io_flush(rb_stdout);
+ }
+ return ret;
+}
+
/*
* call-seq:
* p(obj) -> obj
@@ -6583,22 +7072,11 @@ rb_p(VALUE obj) /* for debug print within C code */
static VALUE
rb_f_p(int argc, VALUE *argv, VALUE self)
{
- int i;
- VALUE ret = Qnil;
+ struct rb_f_p_arg arg;
+ arg.argc = argc;
+ arg.argv = argv;
- for (i=0; i<argc; i++) {
- rb_p(argv[i]);
- }
- if (argc == 1) {
- ret = argv[0];
- }
- else if (argc > 1) {
- ret = rb_ary_new4(argc, argv);
- }
- if (TYPE(rb_stdout) == T_FILE) {
- rb_io_flush(rb_stdout);
- }
- return ret;
+ return rb_uninterruptible(rb_f_p_internal, (VALUE)&arg);
}
/*
@@ -6644,7 +7122,10 @@ void
rb_write_error2(const char *mesg, long len)
{
if (rb_stderr == orig_stderr || RFILE(orig_stderr)->fptr->fd < 0) {
- (void)fwrite(mesg, sizeof(char), len, stderr);
+ if (fwrite(mesg, sizeof(char), (size_t)len, stderr) < (size_t)len) {
+ /* failed to write to stderr, what can we do? */
+ return;
+ }
}
else {
rb_io_write(rb_stderr, rb_str_new(mesg, len));
@@ -6657,6 +7138,23 @@ rb_write_error(const char *mesg)
rb_write_error2(mesg, strlen(mesg));
}
+void
+rb_write_error_str(VALUE mesg)
+{
+ /* a stopgap measure for the time being */
+ if (rb_stderr == orig_stderr || RFILE(orig_stderr)->fptr->fd < 0) {
+ size_t len = (size_t)RSTRING_LEN(mesg);
+ if (fwrite(RSTRING_PTR(mesg), sizeof(char), len, stderr) < len) {
+ RB_GC_GUARD(mesg);
+ return;
+ }
+ }
+ else {
+ /* may unlock GVL, and */
+ rb_io_write(rb_stderr, mesg);
+ }
+}
+
static void
must_respond_to(ID mid, VALUE val, ID id)
{
@@ -6738,59 +7236,117 @@ rb_io_stdio_file(rb_io_t *fptr)
* call-seq:
* IO.new(fd [, mode] [, opt]) -> io
*
- * Returns a new IO object (a stream) for the given IO object or integer file
- * descriptor and mode string. See also IO.sysopen and IO.for_fd.
+ * Returns a new IO object (a stream) for the given integer file descriptor
+ * +fd+ and +mode+ string. +opt+ may be used to specify parts of +mode+ in a
+ * more readable fashion. See also IO.sysopen and IO.for_fd.
*
- * === Parameters
+ * IO.new is called by various File and IO opening methods such as IO::open,
+ * Kernel#open, and File::open.
+ *
+ * === Open Mode
+ *
+ * When +mode+ is an integer it must be combination of the modes defined in
+ * File::Constants (+File::RDONLY+, +File::WRONLY | File::CREAT+). See the
+ * open(2) man page for more information.
+ *
+ * When +mode+ is a string it must be in one of the following forms:
+ *
+ * fmode
+ * fmode ":" ext_enc
+ * fmode ":" ext_enc ":" int_enc
+ * fmode ":" "BOM|UTF-*"
+ *
+ * +fmode+ is an IO open mode string, +ext_enc+ is the external encoding for
+ * the IO and +int_enc+ is the internal encoding.
+ *
+ * ==== IO Open Mode
+ *
+ * Ruby allows the following open modes:
*
- * fd:: numeric file descriptor or IO object
- * mode:: file mode. a string or an integer
- * opt:: hash for specifying +mode+ by name.
+ * "r" Read-only, starts at beginning of file (default mode).
*
- * ==== Mode
+ * "r+" Read-write, starts at beginning of file.
*
- * When mode is an integer it must be combination of the modes defined in
- * File::Constants.
+ * "w" Write-only, truncates existing file
+ * to zero length or creates a new file for writing.
*
- * When mode is a string it must be in one of the following forms:
- * - "fmode",
- * - "fmode:extern",
- * - "fmode:extern:intern".
- * <code>extern</code> is the external encoding name for the IO.
- * <code>intern</code> is the internal encoding.
- * <code>fmode</code> must be a file open mode string. See the description of
- * class IO for mode string directives.
+ * "w+" Read-write, truncates existing file to zero length
+ * or creates a new file for reading and writing.
*
- * When the mode of original IO is read only, the mode cannot be changed to
- * be writable. Similarly, the mode cannot be changed from write only to
- * readable.
+ * "a" Write-only, starts at end of file if file exists,
+ * otherwise creates a new file for writing.
+ *
+ * "a+" Read-write, starts at end of file if file exists,
+ * otherwise creates a new file for reading and
+ * writing.
+ *
+ * The following modes must be used separately, and along with one or more of
+ * the modes seen above.
+ *
+ * "b" Binary file mode
+ * Suppresses EOL <-> CRLF conversion on Windows. And
+ * sets external encoding to ASCII-8BIT unless explicitly
+ * specified.
+ *
+ * "t" Text file mode
+ *
+ * When the open mode of original IO is read only, the mode cannot be
+ * changed to be writable. Similarly, the open mode cannot be changed from
+ * write only to readable.
*
* When such a change is attempted the error is raised in different locations
* according to the platform.
*
- * ==== Options
- * +opt+ can have the following keys
+ * === IO Encoding
+ *
+ * When +ext_enc+ is specified, strings read will be tagged by the encoding
+ * when reading, and strings output will be converted to the specified
+ * encoding when writing.
+ *
+ * When +ext_enc+ and +int_enc+ are specified read strings will be converted
+ * from +ext_enc+ to +int_enc+ upon input, and written strings will be
+ * converted from +int_enc+ to +ext_enc+ upon output. See Encoding for
+ * further details of transcoding on input and output.
+ *
+ * If "BOM|UTF-8", "BOM|UTF-16LE" or "BOM|UTF16-BE" are used, ruby checks for
+ * a Unicode BOM in the input document to help determine the encoding. For
+ * UTF-16 encodings the file open mode must be binary. When present, the BOM
+ * is stripped and the external encoding from the BOM is used. When the BOM
+ * is missing the given Unicode encoding is used as +ext_enc+. (The BOM-set
+ * encoding option is case insensitive, so "bom|utf-8" is also valid.)
+ *
+ * === Options
+ *
+ * +opt+ can be used instead of +mode+ for improved readability. The
+ * following keys are supported:
+ *
* :mode ::
* Same as +mode+ parameter
- * :external_encoding ::
+ *
+ * :\external_encoding ::
* External encoding for the IO. "-" is a synonym for the default external
* encoding.
- * :internal_encoding ::
+ *
+ * :\internal_encoding ::
* Internal encoding for the IO. "-" is a synonym for the default internal
* encoding.
*
* If the value is nil no conversion occurs.
+ *
* :encoding ::
* Specifies external and internal encodings as "extern:intern".
+ *
* :textmode ::
* If the value is truth value, same as "t" in argument +mode+.
+ *
* :binmode ::
* If the value is truth value, same as "b" in argument +mode+.
+ *
* :autoclose ::
* If the value is +false+, the +fd+ will be kept open after this IO
* instance gets finalized.
*
- * Also +opt+ can have same keys in String#encode for controlling conversion
+ * Also, +opt+ can have same keys in String#encode for controlling conversion
* between the external encoding and the internal encoding.
*
* === Example 1
@@ -6800,7 +7356,7 @@ rb_io_stdio_file(rb_io_t *fptr)
* $stderr.puts "Hello"
* a.puts "World"
*
- * <em>produces:</em>
+ * Produces:
*
* Hello
* World
@@ -6836,7 +7392,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);
@@ -6887,20 +7442,14 @@ rb_io_initialize(int argc, VALUE *argv, VALUE io)
* File.new(filename, mode="r" [, opt]) -> file
* File.new(filename [, mode [, perm]] [, opt]) -> file
*
- * Opens the file named by +filename+ according to +mode+ (default is "r")
- * and returns a new <code>File</code> object.
- *
- * === Parameters
- *
- * See the description of class IO for a description of +mode+. The file
- * mode may optionally be specified as a Fixnum by +or+-ing together the
- * flags (O_RDONLY etc, again described under +IO+).
+ * Opens the file named by +filename+ according to the given +mode+ and
+ * returns a new File object.
*
- * Optional permission bits may be given in +perm+. These mode and
- * permission bits are platform dependent; on Unix systems, see
- * <code>open(2)</code> for details.
+ * See IO.new for a description of +mode+ and +opt+.
*
- * Optional +opt+ parameter is same as in IO.open.
+ * If a file is being created, permission bits may be given in +perm+. These
+ * mode and permission bits are platform dependent; on Unix systems, see
+ * open(2) and chmod(2) man pages for details.
*
* === Examples
*
@@ -6970,7 +7519,6 @@ static VALUE
rb_io_autoclose_p(VALUE io)
{
rb_io_t *fptr;
- rb_secure(4);
GetOpenFile(io, fptr);
return (fptr->mode & FMODE_PREP) ? Qfalse : Qtrue;
}
@@ -6996,7 +7544,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;
@@ -7023,6 +7570,22 @@ argf_free(void *ptr)
xfree(p);
}
+static size_t
+argf_memsize(const void *ptr)
+{
+ const struct argf *p = ptr;
+ size_t size = sizeof(*p);
+ if (!ptr) return 0;
+ if (p->inplace) size += strlen(p->inplace) + 1;
+ return size;
+}
+
+static const rb_data_type_t argf_type = {
+ "ARGF",
+ {argf_mark, argf_free, argf_memsize},
+ NULL, NULL, RUBY_TYPED_FREE_IMMEDIATELY
+};
+
static inline void
argf_init(struct argf *p, VALUE v)
{
@@ -7036,7 +7599,7 @@ static VALUE
argf_alloc(VALUE klass)
{
struct argf *p;
- VALUE argf = Data_Make_Struct(klass, struct argf, argf_mark, argf_free, p);
+ VALUE argf = TypedData_Make_Struct(klass, struct argf, &argf_type, p);
argf_init(p, Qnil);
return argf;
@@ -7058,6 +7621,7 @@ argf_initialize(VALUE argf, VALUE argv)
static VALUE
argf_initialize_copy(VALUE argf, VALUE orig)
{
+ if (!OBJ_INIT_COPY(argf, orig)) return argf;
ARGF = argf_of(orig);
ARGF.argv = rb_obj_dup(ARGF.argv);
if (ARGF.inplace) {
@@ -7070,7 +7634,7 @@ argf_initialize_copy(VALUE argf, VALUE orig)
/*
* call-seq:
- * ARGF.lineno = number -> nil
+ * ARGF.lineno = integer -> integer
*
* Sets the line number of +ARGF+ as a whole to the given +Integer+.
*
@@ -7083,7 +7647,7 @@ argf_initialize_copy(VALUE argf, VALUE orig)
* ARGF.lineno #=> 0
* ARGF.readline #=> "This is line 1\n"
* ARGF.lineno #=> 1
- * ARGF.lineno = 0 #=> nil
+ * ARGF.lineno = 0 #=> 0
* ARGF.lineno #=> 0
*/
static VALUE
@@ -7121,7 +7685,7 @@ argf_forward(int argc, VALUE *argv, VALUE argf)
#define next_argv() argf_next_argv(argf)
#define ARGF_GENERIC_INPUT_P() \
- (ARGF.current_file == rb_stdin && TYPE(ARGF.current_file) != T_FILE)
+ (ARGF.current_file == rb_stdin && !RB_TYPE_P(ARGF.current_file, T_FILE))
#define ARGF_FORWARD(argc, argv) do {\
if (ARGF_GENERIC_INPUT_P())\
return argf_forward((argc), (argv), argf);\
@@ -7132,13 +7696,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
@@ -7149,7 +7715,7 @@ argf_next_argv(VALUE argf)
int stdout_binmode = 0;
int fmode;
- if (TYPE(rb_stdout) == T_FILE) {
+ if (RB_TYPE_P(rb_stdout, T_FILE)) {
GetOpenFile(rb_stdout, fptr);
if (fptr->mode & FMODE_BINMODE)
stdout_binmode = 1;
@@ -7197,7 +7763,7 @@ argf_next_argv(VALUE argf)
VALUE str;
int fw;
- if (TYPE(rb_stdout) == T_FILE && rb_stdout != orig_stdout) {
+ if (RB_TYPE_P(rb_stdout, T_FILE) && rb_stdout != orig_stdout) {
rb_io_close(rb_stdout);
}
fstat(fr, &st);
@@ -7303,6 +7869,7 @@ argf_next_argv(VALUE argf)
rb_stdout = orig_stdout;
}
}
+ if (ARGF.init_p == -1) ARGF.init_p = 1;
return TRUE;
}
@@ -7315,7 +7882,7 @@ argf_getline(int argc, VALUE *argv, VALUE argf)
retry:
if (!next_argv()) return Qnil;
if (ARGF_GENERIC_INPUT_P()) {
- line = rb_funcall3(ARGF.current_file, rb_intern("gets"), argc, argv);
+ line = rb_funcall3(ARGF.current_file, idGets, argc, argv);
}
else {
if (argc == 0 && rb_rs == rb_default_rs) {
@@ -7325,7 +7892,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;
}
@@ -7393,21 +7960,21 @@ rb_f_gets(int argc, VALUE *argv, VALUE recv)
if (recv == argf) {
return argf_gets(argc, argv, argf);
}
- return rb_funcall2(argf, rb_intern("gets"), argc, argv);
+ return rb_funcall2(argf, idGets, argc, argv);
}
/*
* 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.
*
*/
@@ -7551,7 +8118,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);
@@ -7584,6 +8151,7 @@ rb_f_backquote(VALUE obj, VALUE str)
rb_io_t *fptr;
SafeStringValue(str);
+ rb_last_status_clear();
port = pipe_open_s(str, "r", FMODE_READABLE|DEFAULT_TEXTMODE, NULL);
if (NIL_P(port)) return rb_str_new(0,0);
@@ -7612,7 +8180,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++;
@@ -7632,7 +8200,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;
@@ -7645,7 +8213,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]);
@@ -7676,7 +8244,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);
@@ -7689,7 +8257,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);
@@ -7702,7 +8270,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);
@@ -7815,7 +8383,7 @@ do_io_advise(rb_io_t *fptr, VALUE advice, off_t offset, off_t len)
* The platform doesn't support this hint. We don't raise exception, instead
* silently ignore it. Because IO::advise is only hint.
*/
- if (num_adv == Qnil)
+ if (NIL_P(num_adv))
return Qnil;
ias.fd = fptr->fd;
@@ -7824,10 +8392,11 @@ do_io_advise(rb_io_t *fptr, VALUE advice, off_t offset, off_t len)
ias.len = len;
rv = (int)rb_thread_io_blocking_region(io_advise_internal, &ias, fptr->fd);
- if (rv)
+ if (rv) {
/* posix_fadvise(2) doesn't set errno. On success it returns 0; otherwise
it returns the error code. */
- rb_syserr_fail(rv, RSTRING_PTR(fptr->pathv));
+ rb_syserr_fail_str(rv, fptr->pathv);
+ }
return Qnil;
}
@@ -7860,18 +8429,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
@@ -7880,18 +8449,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)
@@ -7912,7 +8482,7 @@ rb_io_advise(int argc, VALUE *argv, VALUE io)
#ifdef HAVE_POSIX_FADVISE
return do_io_advise(fptr, advice, off, l);
#else
- /* Ignore all hint */
+ ((void)off, (void)l); /* Ignore all hint */
return Qnil;
#endif
}
@@ -7927,11 +8497,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
@@ -7943,6 +8605,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)
@@ -7993,10 +8656,10 @@ rb_f_select(int argc, VALUE *argv, VALUE obj)
#if defined(__linux__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__APPLE__)
typedef unsigned long ioctl_req_t;
- #define NUM2IOCTLREQ(num) NUM2ULONG(num)
+# define NUM2IOCTLREQ(num) NUM2ULONG(num)
#else
typedef int ioctl_req_t;
- #define NUM2IOCTLREQ(num) NUM2INT(num)
+# define NUM2IOCTLREQ(num) NUM2INT(num)
#endif
struct ioctl_arg {
@@ -8005,7 +8668,8 @@ struct ioctl_arg {
long narg;
};
-static VALUE nogvl_ioctl(void *ptr)
+static VALUE
+nogvl_ioctl(void *ptr)
{
struct ioctl_arg *arg = ptr;
@@ -8029,7 +8693,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)
{
@@ -8062,7 +8726,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 */
@@ -8247,8 +8911,9 @@ setup_narg(ioctl_req_t cmd, VALUE *argp, int io_p)
narg = (long)(SIGNED_VALUE)RSTRING_PTR(arg);
}
}
- return narg;
- }
+
+ return narg;
+}
static VALUE
rb_ioctl(VALUE io, VALUE req, VALUE arg)
@@ -8257,7 +8922,7 @@ rb_ioctl(VALUE io, VALUE req, VALUE arg)
rb_io_t *fptr;
long narg;
int retval;
-
+
rb_secure(2);
narg = setup_narg(cmd, &arg, 1);
@@ -8301,7 +8966,8 @@ struct fcntl_arg {
long narg;
};
-static VALUE nogvl_fcntl(void *ptr)
+static VALUE
+nogvl_fcntl(void *ptr)
{
struct fcntl_arg *arg = ptr;
@@ -8443,7 +9109,7 @@ rb_f_syscall(int argc, VALUE *argv)
# else
# error ---->> it is asserted that __syscall takes the first argument and returns retval in 64bit signed integer. <<----
# endif
-#elif defined linux
+#elif defined(__linux__)
# define SYSCALL syscall
# define NUM2SYSCALLID(x) NUM2LONG(x)
# define RETVAL2NUM(x) LONG2NUM(x)
@@ -8556,6 +9222,14 @@ io_new_instance(VALUE args)
return rb_class_new_instance(2, (VALUE*)args+1, *(VALUE*)args);
}
+static rb_encoding *
+find_encoding(VALUE v)
+{
+ rb_encoding *enc = rb_find_encoding(v);
+ if (!enc) unsupported_encoding(StringValueCStr(v));
+ return enc;
+}
+
static void
io_encoding_set(rb_io_t *fptr, VALUE v1, VALUE v2, VALUE opt)
{
@@ -8564,7 +9238,7 @@ io_encoding_set(rb_io_t *fptr, VALUE v1, VALUE v2, VALUE opt)
VALUE ecopts, tmp;
if (!NIL_P(v2)) {
- enc2 = rb_to_encoding(v1);
+ enc2 = find_encoding(v1);
tmp = rb_check_string_type(v2);
if (!NIL_P(tmp)) {
if (RSTRING_LEN(tmp) == 1 && RSTRING_PTR(tmp)[0] == '-') {
@@ -8573,21 +9247,26 @@ io_encoding_set(rb_io_t *fptr, VALUE v1, VALUE v2, VALUE opt)
enc2 = NULL;
}
else
- enc = rb_to_encoding(v2);
+ enc = find_encoding(v2);
+ if (enc == enc2) {
+ /* Special case - "-" => no transcoding */
+ enc2 = NULL;
+ }
+ }
+ else {
+ enc = find_encoding(v2);
if (enc == enc2) {
/* Special case - "-" => no transcoding */
enc2 = NULL;
}
}
- else
- enc = rb_to_encoding(v2);
SET_UNIVERSAL_NEWLINE_DECORATOR_IF_ENC2(enc2, ecflags);
ecflags = rb_econv_prepare_options(opt, &ecopts, ecflags);
}
else {
if (NIL_P(v1)) {
/* Set to default encodings */
- rb_io_ext_int_to_encs(NULL, NULL, &enc, &enc2);
+ rb_io_ext_int_to_encs(NULL, NULL, &enc, &enc2, 0);
SET_UNIVERSAL_NEWLINE_DECORATOR_IF_ENC2(enc2, ecflags);
ecopts = Qnil;
}
@@ -8599,7 +9278,7 @@ io_encoding_set(rb_io_t *fptr, VALUE v1, VALUE v2, VALUE opt)
ecflags = rb_econv_prepare_options(opt, &ecopts, ecflags);
}
else {
- rb_io_ext_int_to_encs(rb_to_encoding(v1), NULL, &enc, &enc2);
+ rb_io_ext_int_to_encs(find_encoding(v1), NULL, &enc, &enc2, 0);
SET_UNIVERSAL_NEWLINE_DECORATOR_IF_ENC2(enc2, ecflags);
ecopts = Qnil;
}
@@ -8784,7 +9463,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;
}
@@ -8903,31 +9582,35 @@ seek_before_access(VALUE argp)
* IO.read(name, [length [, offset]] ) -> string
* IO.read(name, [length [, offset]], open_args) -> string
*
- * Opens the file, optionally seeks to the given <i>offset</i>, then returns
- * <i>length</i> bytes (defaulting to the rest of the file).
- * <code>read</code> ensures the file is closed before returning.
+ * 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.
*
- * encoding: string or encoding
+ * encoding::
+ * string or encoding
*
- * specifies encoding of the read string. encoding will be ignored
+ * specifies encoding of the read string. +encoding+ will be ignored
* if length is specified.
*
- * mode: string
+ * mode::
+ * string
*
- * specifies mode argument for open(). it should start with "r"
- * otherwise it would cause error.
+ * specifies mode argument for open(). It should start with "r"
+ * otherwise it will cause an error.
*
- * open_args: array of strings
+ * open_args:: array of strings
*
* specifies arguments for open() as an array.
*
- * 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 "
+ * 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 "
*/
static VALUE
@@ -9089,18 +9772,11 @@ rb_io_s_write(int argc, VALUE *argv, VALUE io)
/*
* call-seq:
* IO.binwrite(name, string, [offset] ) => fixnum
+ * IO.binwrite(name, string, [offset], open_args ) => fixnum
*
- * Opens the file, optionally seeks to the given <i>offset</i>, writes
- * <i>string</i> then returns the length written.
- * <code>binwrite</code> ensures the file is closed before returning.
- * The open mode would be "wb:ASCII-8BIT".
- * If <i>offset</i> is not given, the file is truncated. Otherwise,
- * it is not truncated.
+ * Same as <code>IO.write</code> except opening the file in binary mode
+ * and ASCII-8BIT encoding ("wb:ASCII-8BIT").
*
- * IO.binwrite("testfile", "0123456789", 20) # => 10
- * # File could contain: "This is line one\nThi0123456789two\nThis is line three\nAnd so on...\n"
- * IO.binwrite("testfile", "0123456789") #=> 10
- * # File would now read: "0123456789"
*/
static VALUE
@@ -9340,7 +10016,7 @@ nogvl_copy_stream_sendfile(struct copy_stream_struct *stp)
#if defined(EWOULDBLOCK) && EWOULDBLOCK != EAGAIN
case EWOULDBLOCK:
#endif
-#ifndef linux
+#ifndef __linux__
/*
* Linux requires stp->src_fd to be a mmap-able (regular) file,
* select() reports regular files to always be "ready", so
@@ -9498,7 +10174,7 @@ nogvl_copy_stream_read_write(struct copy_stream_struct *stp)
}
}
-static VALUE
+static void *
nogvl_copy_stream_func(void *arg)
{
struct copy_stream_struct *stp = (struct copy_stream_struct *)arg;
@@ -9517,7 +10193,7 @@ nogvl_copy_stream_func(void *arg)
#ifdef USE_SENDFILE
finish:
#endif
- return Qnil;
+ return 0;
}
static VALUE
@@ -9549,11 +10225,13 @@ copy_stream_fallback_body(VALUE arg)
l = buflen < rest ? buflen : (long)rest;
}
if (stp->src_fd == -1) {
- rb_funcall(stp->src, read_method, 2, INT2FIX(l), buf);
+ VALUE rc = rb_funcall(stp->src, read_method, 2, INT2FIX(l), buf);
+
+ if (read_method == id_read && NIL_P(rc))
+ break;
}
else {
ssize_t ss;
- rb_thread_wait_fd(stp->src_fd);
rb_str_resize(buf, buflen);
ss = maygvl_copy_stream_read(1, stp, RSTRING_PTR(buf), l, off);
if (ss == -1)
@@ -9592,31 +10270,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 ||
- !(TYPE(stp->src) == T_FILE ||
- TYPE(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 = TYPE(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;
@@ -9627,24 +10305,19 @@ copy_stream_body(VALUE arg)
}
stp->src_fd = src_fd;
- if (stp->dst == argf ||
- !(TYPE(stp->dst) == T_FILE ||
- TYPE(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 = TYPE(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);
- args[2] = INT2FIX(0600);
+ FilePathValue(dst_io);
+ args[0] = dst_io;
+ args[1] = INT2NUM(O_WRONLY|O_CREAT|O_TRUNC|common_oflags);
+ args[2] = INT2FIX(0666);
dst_io = rb_class_new_instance(3, args, rb_cFile);
stp->dst = dst_io;
stp->close_dst = 1;
@@ -9662,9 +10335,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;
@@ -9680,7 +10353,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;
@@ -9700,7 +10373,8 @@ copy_stream_body(VALUE arg)
rb_fd_set(src_fd, &stp->fds);
rb_fd_set(dst_fd, &stp->fds);
- return rb_thread_blocking_region(nogvl_copy_stream_func, (void*)stp, RUBY_UBF_IO, 0);
+ rb_thread_call_without_gvl(nogvl_copy_stream_func, (void*)stp, RUBY_UBF_IO, 0);
+ return Qnil;
}
static VALUE
@@ -9849,7 +10523,7 @@ rb_io_set_encoding(int argc, VALUE *argv, VALUE io)
rb_io_t *fptr;
VALUE v1, v2, opt;
- if (TYPE(io) != T_FILE) {
+ if (!RB_TYPE_P(io, T_FILE)) {
return rb_funcall2(io, id_set_encoding, argc, argv);
}
@@ -10119,7 +10793,7 @@ argf_eof(VALUE argf)
/*
* call-seq:
- * ARGF.read([length [, buffer]]) -> string, buffer, or nil
+ * ARGF.read([length [, outbuf]]) -> string, outbuf, or nil
*
* Reads _length_ bytes from ARGF. The files named on the command line
* are concatenated and treated as a single file by this method, so when
@@ -10136,8 +10810,10 @@ argf_eof(VALUE argf)
*
* If _length_ is zero, it returns _""_.
*
- * If the optional _buffer_ argument is present, it must reference a String,
+ * If the optional _outbuf_ argument is present, it must reference a String,
* which will receive the data.
+ * The <i>outbuf</i> will contain only the received data after the method call
+ * even if it is not empty at the beginning.
*
* For example:
*
@@ -10184,7 +10860,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;
}
@@ -10220,27 +10896,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. 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:
+ * Reads at most _maxlen_ bytes from the ARGF stream.
*
- * * The byte buffer in the +IO+ object is empty.
- * * The content of the stream is empty.
- * * The stream has not reached EOF.
+ * 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.
*
- * 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+.
+ * 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+ 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
@@ -10287,13 +10955,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();
@@ -10341,7 +11009,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;
}
@@ -10374,14 +11042,14 @@ argf_getbyte(VALUE argf)
retry:
if (!next_argv()) return Qnil;
- if (TYPE(ARGF.current_file) != T_FILE) {
+ if (!RB_TYPE_P(ARGF.current_file, T_FILE)) {
ch = rb_funcall3(ARGF.current_file, rb_intern("getbyte"), 0, 0);
}
else {
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;
}
@@ -10414,14 +11082,14 @@ argf_readchar(VALUE argf)
retry:
if (!next_argv()) rb_eof_error();
- if (TYPE(ARGF.current_file) != T_FILE) {
+ if (!RB_TYPE_P(ARGF.current_file, T_FILE)) {
ch = rb_funcall3(ARGF.current_file, rb_intern("getc"), 0, 0);
}
else {
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;
}
@@ -10460,6 +11128,26 @@ argf_readbyte(VALUE argf)
return c;
}
+#define FOREACH_ARGF() while (next_argv())
+
+static VALUE
+argf_block_call_i(VALUE i, VALUE argf, int argc, VALUE *argv)
+{
+ 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
@@ -10470,10 +11158,6 @@ argf_readbyte(VALUE argf)
* ARGF.each_line(sep=$/,limit) {|line| block } -> ARGF
* ARGF.each_line(...) -> an_enumerator
*
- * ARGF.lines(sep=$/) {|line| block } -> ARGF
- * ARGF.lines(sep=$/,limit) {|line| block } -> ARGF
- * ARGF.lines(...) -> an_enumerator
- *
* Returns an enumerator which iterates over each line (separated by _sep_,
* which defaults to your platform's newline character) of each file in
* +ARGV+. If a block is supplied, each line in turn will be yielded to the
@@ -10500,11 +11184,23 @@ 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;
+}
+
+/*
+ * This is a deprecated alias for <code>each_line</code>.
+ */
+
+static VALUE
+argf_lines(int argc, VALUE *argv, VALUE argf)
+{
+ rb_warn("ARGF#lines is deprecated; use #each_line instead");
+ if (!rb_block_given_p())
+ return rb_enumeratorize(argf, ID2SYM(rb_intern("each_line")), argc, argv);
+ return argf_each_line(argc, argv, argf);
}
/*
@@ -10535,18 +11231,27 @@ 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;
+}
+
+/*
+ * This is a deprecated alias for <code>each_byte</code>.
+ */
+
+static VALUE
+argf_bytes(VALUE argf)
+{
+ rb_warn("ARGF#bytes is deprecated; use #each_byte instead");
+ if (!rb_block_given_p())
+ return rb_enumeratorize(argf, ID2SYM(rb_intern("each_byte")), 0, 0);
+ return argf_each_byte(argf);
}
/*
* call-seq:
- * ARGF.chars {|char| block } -> ARGF
- * ARGF.chars -> an_enumerator
- *
* ARGF.each_char {|char| block } -> ARGF
* ARGF.each_char -> an_enumerator
*
@@ -10565,18 +11270,27 @@ 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;
+}
+
+/*
+ * This is a deprecated alias for <code>each_char</code>.
+ */
+
+static VALUE
+argf_chars(VALUE argf)
+{
+ rb_warn("ARGF#chars is deprecated; use #each_char instead");
+ if (!rb_block_given_p())
+ return rb_enumeratorize(argf, ID2SYM(rb_intern("each_char")), 0, 0);
+ return argf_each_char(argf);
}
/*
* call-seq:
- * ARGF.codepoints {|codepoint| block } -> ARGF
- * ARGF.codepoints -> an_enumerator
- *
* ARGF.each_codepoint {|codepoint| block } -> ARGF
* ARGF.each_codepoint -> an_enumerator
*
@@ -10595,11 +11309,23 @@ 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;
+}
+
+/*
+ * This is a deprecated alias for <code>each_codepoint</code>.
+ */
+
+static VALUE
+argf_codepoints(VALUE argf)
+{
+ rb_warn("ARGF#codepoints is deprecated; use #each_codepoint instead");
+ if (!rb_block_given_p())
+ return rb_enumeratorize(argf, ID2SYM(rb_intern("each_codepoint")), 0, 0);
+ return argf_each_codepoint(argf);
}
/*
@@ -10720,7 +11446,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;
@@ -10748,7 +11474,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;
}
@@ -10923,6 +11649,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
*
@@ -11000,91 +11771,59 @@ argf_write(VALUE argf, VALUE str)
*/
/*
- * Class <code>IO</code> is the basis for all input and output in Ruby.
+ * The IO class is the basis for all input and output in Ruby.
* An I/O stream may be <em>duplexed</em> (that is, bidirectional), and
* so may use more than one native operating system stream.
*
- * Many of the examples in this section use class <code>File</code>,
- * the only standard subclass of <code>IO</code>. The two classes are
- * closely associated.
+ * Many of the examples in this section use the File class, the only standard
+ * subclass of IO. The two classes are closely associated. Like the File
+ * class, the Socket library subclasses from IO (such as TCPSocket or
+ * UDPSocket).
*
- * As used in this section, <em>portname</em> may take any of the
- * following forms.
+ * The Kernel#open method can create an IO (or File) object for these types
+ * of arguments:
*
* * A plain string represents a filename suitable for the underlying
* operating system.
*
- * * A string starting with ``<code>|</code>'' indicates a subprocess.
- * The remainder of the string following the ``<code>|</code>'' is
+ * * A string starting with <code>"|"</code> indicates a subprocess.
+ * The remainder of the string following the <code>"|"</code> is
* invoked as a process with appropriate input/output channels
* connected to it.
*
- * * A string equal to ``<code>|-</code>'' will create another Ruby
+ * * A string equal to <code>"|-"</code> will create another Ruby
* instance as a subprocess.
*
+ * The IO may be opened with different file modes (read-only, write-only) and
+ * encodings for proper conversion. See IO.new for these options. See
+ * Kernel#open for details of the various command formats described above.
+ *
+ * IO.popen, the Open3 library, or Process#spawn may also be used to
+ * communicate with subprocesses through an IO.
+ *
* Ruby will convert pathnames between different operating system
- * conventions if possible. For instance, on a Windows system the
- * filename ``<code>/gumby/ruby/test.rb</code>'' will be opened as
- * ``<code>\gumby\ruby\test.rb</code>''. When specifying a
- * Windows-style filename in a Ruby string, remember to escape the
- * backslashes:
+ * conventions if possible. For instance, on a Windows system the
+ * filename <code>"/gumby/ruby/test.rb"</code> will be opened as
+ * <code>"\gumby\ruby\test.rb"</code>. When specifying a Windows-style
+ * filename in a Ruby string, remember to escape the backslashes:
*
- * "c:\\gumby\\ruby\\test.rb"
+ * "c:\\gumby\\ruby\\test.rb"
*
* Our examples here will use the Unix-style forward slashes;
- * <code>File::SEPARATOR</code> can be used to get the
- * platform-specific separator character.
- *
- * I/O ports may be opened in any one of several different modes, which
- * are shown in this section as <em>mode</em>. The mode may
- * either be a Fixnum or a String. If numeric, it should be
- * one of the operating system specific constants (O_RDONLY,
- * O_WRONLY, O_RDWR, O_APPEND and so on). See man open(2) for
- * more information.
- *
- * If the mode is given as a String, it must be one of the
- * values listed in the following table.
- *
- * Mode | Meaning
- * -----+--------------------------------------------------------
- * "r" | Read-only, starts at beginning of file (default mode).
- * -----+--------------------------------------------------------
- * "r+" | Read-write, starts at beginning of file.
- * -----+--------------------------------------------------------
- * "w" | Write-only, truncates existing file
- * | to zero length or creates a new file for writing.
- * -----+--------------------------------------------------------
- * "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+" | Read-write, starts at end of file if file exists,
- * | otherwise creates a new file for reading and
- * | writing.
- * -----+--------------------------------------------------------
- * "b" | Binary file mode (may appear with
- * | any of the key letters listed above).
- * | Suppresses EOL <-> CRLF conversion on Windows. And
- * | sets external encoding to ASCII-8BIT unless explicitly
- * | specified.
- * -----+--------------------------------------------------------
- * "t" | Text file mode (may appear with
- * | any of the key letters listed above except "b").
- *
+ * File::ALT_SEPARATOR can be used to get the platform-specific separator
+ * character.
*
* The global constant ARGF (also accessible as $<) provides an
* IO-like stream which allows access to all files mentioned on the
- * command line (or STDIN if no files are mentioned). ARGF provides
- * the methods <code>#path</code> and <code>#filename</code> to access
- * the name of the file currently being read.
+ * command line (or STDIN if no files are mentioned). ARGF#path and its alias
+ * ARGF#filename are provided to access the name of the file currently being
+ * read.
*
* == io/console
*
* The io/console extension provides methods for interacting with the
- * console. The console can be accessed from <code>IO.console</code> or
- * the standard input/output/error IO objects.
+ * console. The console can be accessed from IO.console or the standard
+ * input/output/error IO objects.
*
* Requiring io/console adds the following methods:
*
@@ -11107,7 +11846,7 @@ argf_write(VALUE argf, VALUE str)
*
* require 'io/console'
* rows, columns = $stdin.winsize
- * puts "You screen is #{columns} wide and #{rows} tall"
+ * puts "Your screen is #{columns} wide and #{rows} tall"
*/
void
@@ -11163,6 +11902,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 */
@@ -11214,10 +11974,10 @@ Init_IO(void)
rb_define_method(rb_cIO, "each_byte", rb_io_each_byte, 0);
rb_define_method(rb_cIO, "each_char", rb_io_each_char, 0);
rb_define_method(rb_cIO, "each_codepoint", rb_io_each_codepoint, 0);
- rb_define_method(rb_cIO, "lines", rb_io_each_line, -1);
- rb_define_method(rb_cIO, "bytes", rb_io_each_byte, 0);
- rb_define_method(rb_cIO, "chars", rb_io_each_char, 0);
- rb_define_method(rb_cIO, "codepoints", rb_io_each_codepoint, 0);
+ rb_define_method(rb_cIO, "lines", rb_io_lines, -1);
+ rb_define_method(rb_cIO, "bytes", rb_io_bytes, 0);
+ rb_define_method(rb_cIO, "chars", rb_io_chars, 0);
+ rb_define_method(rb_cIO, "codepoints", rb_io_codepoints, 0);
rb_define_method(rb_cIO, "syswrite", rb_io_syswrite, 1);
rb_define_method(rb_cIO, "sysread", rb_io_sysread, -1);
@@ -11237,7 +11997,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);
@@ -11253,9 +12013,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);
@@ -11320,6 +12091,7 @@ Init_IO(void)
rb_define_method(rb_cARGF, "initialize", argf_initialize, -2);
rb_define_method(rb_cARGF, "initialize_copy", argf_initialize_copy, 1);
rb_define_method(rb_cARGF, "to_s", argf_to_s, 0);
+ rb_define_alias(rb_cARGF, "inspect", "to_s");
rb_define_method(rb_cARGF, "argv", argf_argv, 0);
rb_define_method(rb_cARGF, "fileno", argf_fileno, 0);
@@ -11331,10 +12103,10 @@ Init_IO(void)
rb_define_method(rb_cARGF, "each_byte", argf_each_byte, 0);
rb_define_method(rb_cARGF, "each_char", argf_each_char, 0);
rb_define_method(rb_cARGF, "each_codepoint", argf_each_codepoint, 0);
- rb_define_method(rb_cARGF, "lines", argf_each_line, -1);
- rb_define_method(rb_cARGF, "bytes", argf_each_byte, 0);
- rb_define_method(rb_cARGF, "chars", argf_each_char, 0);
- rb_define_method(rb_cARGF, "codepoints", argf_each_codepoint, 0);
+ rb_define_method(rb_cARGF, "lines", argf_lines, -1);
+ rb_define_method(rb_cARGF, "bytes", argf_bytes, 0);
+ rb_define_method(rb_cARGF, "chars", argf_chars, 0);
+ rb_define_method(rb_cARGF, "codepoints", argf_codepoints, 0);
rb_define_method(rb_cARGF, "read", argf_read, -1);
rb_define_method(rb_cARGF, "readpartial", argf_readpartial, -1);
@@ -11406,58 +12178,6 @@ Init_IO(void)
rb_define_method(rb_cFile, "initialize", rb_file_initialize, -1);
- /* open for reading only */
- rb_file_const("RDONLY", INT2FIX(O_RDONLY));
- /* open for writing only */
- rb_file_const("WRONLY", INT2FIX(O_WRONLY));
- /* open for reading and writing */
- rb_file_const("RDWR", INT2FIX(O_RDWR));
- /* append on each write */
- rb_file_const("APPEND", INT2FIX(O_APPEND));
- /* create file if it does not exist */
- rb_file_const("CREAT", INT2FIX(O_CREAT));
- /* error if CREAT and the file exists */
- rb_file_const("EXCL", INT2FIX(O_EXCL));
-#if defined(O_NDELAY) || defined(O_NONBLOCK)
-# ifndef O_NONBLOCK
-# define O_NONBLOCK O_NDELAY
-# endif
- /* do not block on open or for data to become available */
- rb_file_const("NONBLOCK", INT2FIX(O_NONBLOCK));
-#endif
- /* truncate size to 0 */
- rb_file_const("TRUNC", INT2FIX(O_TRUNC));
-#ifdef O_NOCTTY
- /* not to make opened IO the controlling terminal device */
- rb_file_const("NOCTTY", INT2FIX(O_NOCTTY));
-#endif
-#ifndef O_BINARY
-# define O_BINARY 0
-#endif
- /* disable line code conversion and make ASCII-8BIT */
- rb_file_const("BINARY", INT2FIX(O_BINARY));
-#ifdef O_SYNC
- rb_file_const("SYNC", INT2FIX(O_SYNC));
-#endif
-#ifdef O_DSYNC
- rb_file_const("DSYNC", INT2FIX(O_DSYNC));
-#endif
-#ifdef O_RSYNC
- rb_file_const("RSYNC", INT2FIX(O_RSYNC));
-#endif
-#ifdef O_NOFOLLOW
- /* do not follow symlinks */
- rb_file_const("NOFOLLOW", INT2FIX(O_NOFOLLOW)); /* FreeBSD, Linux */
-#endif
-#ifdef O_NOATIME
- /* do not change atime */
- rb_file_const("NOATIME", INT2FIX(O_NOATIME)); /* Linux */
-#endif
-#ifdef O_DIRECT
- /* Try to minimize cache effects of the I/O to and from this file. */
- rb_file_const("DIRECT", INT2FIX(O_DIRECT));
-#endif
-
sym_mode = ID2SYM(rb_intern("mode"));
sym_perm = ID2SYM(rb_intern("perm"));
sym_extenc = ID2SYM(rb_intern("external_encoding"));
@@ -11473,4 +12193,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 721277a7d3..2db1d3be56 100644
--- a/iseq.c
+++ b/iseq.c
@@ -11,6 +11,7 @@
#include "ruby/ruby.h"
#include "internal.h"
+#include "eval_intern.h"
/* #define RUBY_MARK_FREE_DEBUG 1 */
#include "gc.h"
@@ -20,8 +21,8 @@
#include "insns.inc"
#include "insns_info.inc"
-#define ISEQ_MAJOR_VERSION 1
-#define ISEQ_MINOR_VERSION 2
+#define ISEQ_MAJOR_VERSION 2
+#define ISEQ_MINOR_VERSION 1
VALUE rb_cISeq;
@@ -69,8 +70,8 @@ iseq_free(void *ptr)
if (!iseq->orig) {
/* It's possible that strings are freed */
if (0) {
- RUBY_GC_INFO("%s @ %s\n", RSTRING_PTR(iseq->name),
- RSTRING_PTR(iseq->filename));
+ RUBY_GC_INFO("%s @ %s\n", RSTRING_PTR(iseq->location.label),
+ RSTRING_PTR(iseq->location.path));
}
if (iseq->iseq != iseq->iseq_encoded) {
@@ -78,11 +79,13 @@ iseq_free(void *ptr)
}
RUBY_FREE_UNLESS_NULL(iseq->iseq);
- RUBY_FREE_UNLESS_NULL(iseq->insn_info_table);
+ 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_xfree(ptr);
@@ -98,18 +101,17 @@ iseq_mark(void *ptr)
if (ptr) {
rb_iseq_t *iseq = ptr;
- RUBY_GC_INFO("%s @ %s\n", RSTRING_PTR(iseq->name), RSTRING_PTR(iseq->filename));
+ RUBY_GC_INFO("%s @ %s\n", RSTRING_PTR(iseq->location.label), RSTRING_PTR(iseq->location.path));
RUBY_MARK_UNLESS_NULL(iseq->mark_ary);
- RUBY_MARK_UNLESS_NULL(iseq->name);
- RUBY_MARK_UNLESS_NULL(iseq->filename);
- RUBY_MARK_UNLESS_NULL(iseq->filepath);
+
+ RUBY_MARK_UNLESS_NULL(iseq->location.label);
+ RUBY_MARK_UNLESS_NULL(iseq->location.base_label);
+ RUBY_MARK_UNLESS_NULL(iseq->location.path);
+ RUBY_MARK_UNLESS_NULL(iseq->location.absolute_path);
+
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) {
@@ -136,11 +138,12 @@ iseq_memsize(const void *ptr)
}
size += iseq->iseq_size * sizeof(VALUE);
- size += iseq->insn_info_size * sizeof(struct iseq_insn_info_entry);
+ size += iseq->line_info_size * sizeof(struct iseq_line_info_entry);
size += iseq->local_table_size * sizeof(ID);
size += iseq->catch_table_size * sizeof(struct iseq_catch_table_entry);
size += iseq->arg_opts * sizeof(VALUE);
- size += iseq->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) {
struct iseq_compile_data_storage *cur;
@@ -164,7 +167,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
@@ -174,45 +179,59 @@ iseq_alloc(VALUE klass)
return TypedData_Make_Struct(klass, rb_iseq_t, &iseq_data_type, iseq);
}
+static rb_iseq_location_t *
+iseq_location_setup(rb_iseq_t *iseq, VALUE path, VALUE absolute_path, VALUE name, size_t first_lineno)
+{
+ rb_iseq_location_t *loc = &iseq->location;
+ OBJ_WRITE(iseq->self, &loc->path, path);
+ if (RTEST(absolute_path) && rb_str_cmp(path, absolute_path) == 0) {
+ OBJ_WRITE(iseq->self, &loc->absolute_path, path);
+ }
+ else {
+ OBJ_WRITE(iseq->self, &loc->absolute_path, absolute_path);
+ }
+ OBJ_WRITE(iseq->self, &loc->label, name);
+ OBJ_WRITE(iseq->self, &loc->base_label, name);
+ loc->first_lineno = first_lineno;
+ return loc;
+}
+
+#define ISEQ_SET_CREF(iseq, cref) OBJ_WRITE((iseq)->self, &(iseq)->cref_stack, (cref))
+
static void
set_relation(rb_iseq_t *iseq, const VALUE parent)
{
const VALUE type = iseq->type;
rb_thread_t *th = GET_THREAD();
+ rb_iseq_t *piseq;
/* set class nest stack */
if (type == ISEQ_TYPE_TOP) {
/* toplevel is private */
- iseq->cref_stack = NEW_BLOCK(rb_cObject);
+ 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_BLOCK(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;
+ ISEQ_SET_CREF(iseq, cref);
}
+ iseq->local_iseq = iseq;
}
else if (type == ISEQ_TYPE_METHOD || type == ISEQ_TYPE_CLASS) {
- iseq->cref_stack = NEW_BLOCK(0); /* place holder */
- }
- else if (RTEST(parent)) {
- rb_iseq_t *piseq;
- GetISeqPtr(parent, piseq);
- iseq->cref_stack = piseq->cref_stack;
- }
-
- if (type == ISEQ_TYPE_TOP ||
- type == ISEQ_TYPE_METHOD || type == ISEQ_TYPE_CLASS) {
+ ISEQ_SET_CREF(iseq, NEW_CREF(0)); /* place holder */
+ iseq->cref_stack->nd_refinements = Qnil;
iseq->local_iseq = iseq;
}
else if (RTEST(parent)) {
- rb_iseq_t *piseq;
GetISeqPtr(parent, piseq);
+ ISEQ_SET_CREF(iseq, piseq->cref_stack);
iseq->local_iseq = piseq->local_iseq;
}
if (RTEST(parent)) {
- rb_iseq_t *piseq;
GetISeqPtr(parent, piseq);
iseq->parent_iseq = piseq;
}
@@ -222,28 +241,39 @@ set_relation(rb_iseq_t *iseq, const VALUE parent)
}
}
+void
+rb_iseq_add_mark_object(rb_iseq_t *iseq, VALUE obj)
+{
+ if (!RTEST(iseq->mark_ary)) {
+ OBJ_WRITE(iseq->self, &iseq->mark_ary, rb_ary_tmp_new(3));
+ RBASIC_CLEAR_CLASS(iseq->mark_ary);
+ }
+ rb_ary_push(iseq->mark_ary, obj);
+}
+
static VALUE
prepare_iseq_build(rb_iseq_t *iseq,
- VALUE name, VALUE filename, VALUE filepath, VALUE line_no,
+ VALUE name, VALUE path, VALUE absolute_path, VALUE first_lineno,
VALUE parent, enum iseq_type type, VALUE block_opt,
const rb_compile_option_t *option)
{
- OBJ_FREEZE(name);
- OBJ_FREEZE(filename);
-
- iseq->name = name;
- iseq->filename = filename;
- iseq->filepath = filepath;
- iseq->line_no = (unsigned short)line_no; /* TODO: really enough? */
- iseq->defined_method_id = 0;
- iseq->mark_ary = rb_ary_tmp_new(3);
- OBJ_UNTRUST(iseq->mark_ary);
- RBASIC(iseq->mark_ary)->klass = 0;
-
iseq->type = type;
iseq->arg_rest = -1;
iseq->arg_block = -1;
- iseq->klass = 0;
+ iseq->arg_keyword = -1;
+ OBJ_WRITE(iseq->self, &iseq->klass, 0);
+ set_relation(iseq, parent);
+
+ OBJ_FREEZE(name);
+ OBJ_FREEZE(path);
+
+ iseq_location_setup(iseq, path, absolute_path, name, first_lineno);
+ if (iseq != iseq->local_iseq) {
+ OBJ_WRITE(iseq->self, &iseq->location.base_label, iseq->local_iseq->location.label);
+ }
+
+ iseq->defined_method_id = 0;
+ OBJ_WRITE(iseq->self, &iseq->mark_ary, 0);
/*
* iseq->special_block_builder = GC_GUARDED_PTR_REF(block_opt);
@@ -253,15 +283,15 @@ prepare_iseq_build(rb_iseq_t *iseq,
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);
+ OBJ_WRITE(iseq->self, &iseq->compile_data->err_info, Qnil);
+ OBJ_WRITE(iseq->self, &iseq->compile_data->mark_ary, rb_ary_tmp_new(3));
iseq->compile_data->storage_head = iseq->compile_data->storage_current =
(struct iseq_compile_data_storage *)
ALLOC_N(char, INITIAL_ISEQ_COMPILE_DATA_STORAGE_BUFF_SIZE +
sizeof(struct iseq_compile_data_storage));
- iseq->compile_data->catch_table_ary = rb_ary_new();
+ 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 =
@@ -271,14 +301,12 @@ prepare_iseq_build(rb_iseq_t *iseq,
iseq->compile_data->option = option;
iseq->compile_data->last_coverable_line = -1;
- set_relation(iseq, parent);
-
- iseq->coverage = Qfalse;
+ 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, filename);
- if (NIL_P(iseq->coverage)) iseq->coverage = Qfalse;
+ OBJ_WRITE(iseq->self, &iseq->coverage, rb_hash_lookup(coverages, path));
+ if (NIL_P(iseq->coverage)) OBJ_WRITE(iseq->self, &iseq->coverage, Qfalse);
}
}
@@ -294,7 +322,7 @@ cleanup_iseq_build(rb_iseq_t *iseq)
compile_data_free(data);
if (RTEST(err)) {
- rb_funcall2(err, rb_intern("set_backtrace"), 1, &iseq->filename);
+ rb_funcall2(err, rb_intern("set_backtrace"), 1, &iseq->location.path);
rb_exc_raise(err);
}
return Qtrue;
@@ -322,7 +350,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;
@@ -369,6 +399,7 @@ make_compile_option_value(rb_compile_option_t *option)
SET_COMPILE_OPTION(option, opt, operands_unification);
SET_COMPILE_OPTION(option, opt, instructions_unification);
SET_COMPILE_OPTION(option, opt, stack_caching);
+ SET_COMPILE_OPTION(option, opt, trace_instruction);
SET_COMPILE_OPTION_NUM(option, opt, debug_level);
}
#undef SET_COMPILE_OPTION
@@ -377,31 +408,31 @@ make_compile_option_value(rb_compile_option_t *option)
}
VALUE
-rb_iseq_new(NODE *node, VALUE name, VALUE filename, VALUE filepath,
+rb_iseq_new(NODE *node, VALUE name, VALUE path, VALUE absolute_path,
VALUE parent, enum iseq_type type)
{
- return rb_iseq_new_with_opt(node, name, filename, filepath, INT2FIX(0), parent, type,
+ return rb_iseq_new_with_opt(node, name, path, absolute_path, INT2FIX(0), parent, type,
&COMPILE_OPTION_DEFAULT);
}
VALUE
-rb_iseq_new_top(NODE *node, VALUE name, VALUE filename, VALUE filepath, VALUE parent)
+rb_iseq_new_top(NODE *node, VALUE name, VALUE path, VALUE absolute_path, VALUE parent)
{
- return rb_iseq_new_with_opt(node, name, filename, filepath, INT2FIX(0), parent, ISEQ_TYPE_TOP,
+ return rb_iseq_new_with_opt(node, name, path, absolute_path, INT2FIX(0), parent, ISEQ_TYPE_TOP,
&COMPILE_OPTION_DEFAULT);
}
VALUE
-rb_iseq_new_main(NODE *node, VALUE filename, VALUE filepath)
+rb_iseq_new_main(NODE *node, VALUE path, VALUE absolute_path)
{
rb_thread_t *th = GET_THREAD();
VALUE parent = th->base_block->iseq->self;
- return rb_iseq_new_with_opt(node, rb_str_new2("<main>"), filename, filepath, INT2FIX(0),
+ return rb_iseq_new_with_opt(node, rb_str_new2("<main>"), path, absolute_path, INT2FIX(0),
parent, ISEQ_TYPE_MAIN, &COMPILE_OPTION_DEFAULT);
}
static VALUE
-rb_iseq_new_with_bopt_and_opt(NODE *node, VALUE name, VALUE filename, VALUE filepath, VALUE line_no,
+rb_iseq_new_with_bopt_and_opt(NODE *node, VALUE name, VALUE path, VALUE absolute_path, VALUE first_lineno,
VALUE parent, enum iseq_type type, VALUE bopt,
const rb_compile_option_t *option)
{
@@ -411,28 +442,28 @@ rb_iseq_new_with_bopt_and_opt(NODE *node, VALUE name, VALUE filename, VALUE file
GetISeqPtr(self, iseq);
iseq->self = self;
- prepare_iseq_build(iseq, name, filename, filepath, line_no, parent, type, bopt, option);
+ prepare_iseq_build(iseq, name, path, absolute_path, first_lineno, parent, type, bopt, option);
rb_iseq_compile_node(self, node);
cleanup_iseq_build(iseq);
return self;
}
VALUE
-rb_iseq_new_with_opt(NODE *node, VALUE name, VALUE filename, VALUE filepath, VALUE line_no,
+rb_iseq_new_with_opt(NODE *node, VALUE name, VALUE path, VALUE absolute_path, VALUE first_lineno,
VALUE parent, enum iseq_type type,
const rb_compile_option_t *option)
{
/* TODO: argument check */
- return rb_iseq_new_with_bopt_and_opt(node, name, filename, filepath, line_no, parent, type,
+ return rb_iseq_new_with_bopt_and_opt(node, name, path, absolute_path, first_lineno, parent, type,
Qfalse, option);
}
VALUE
-rb_iseq_new_with_bopt(NODE *node, VALUE name, VALUE filename, VALUE filepath, VALUE line_no,
+rb_iseq_new_with_bopt(NODE *node, VALUE name, VALUE path, VALUE absolute_path, VALUE first_lineno,
VALUE parent, enum iseq_type type, VALUE bopt)
{
/* TODO: argument check */
- return rb_iseq_new_with_bopt_and_opt(node, name, filename, filepath, line_no, parent, type,
+ return rb_iseq_new_with_bopt_and_opt(node, name, path, absolute_path, first_lineno, parent, type,
bopt, &COMPILE_OPTION_DEFAULT);
}
@@ -446,7 +477,7 @@ iseq_load(VALUE self, VALUE data, VALUE parent, VALUE opt)
VALUE iseqval = iseq_alloc(self);
VALUE magic, version1, version2, format_type, misc;
- VALUE name, filename, filepath, line_no;
+ VALUE name, path, absolute_path, first_lineno;
VALUE type, body, locals, args, exception;
st_data_t iseq_type;
@@ -456,7 +487,7 @@ iseq_load(VALUE self, VALUE data, VALUE parent, VALUE opt)
int i = 0;
/* [magic, major_version, minor_version, format_type, misc,
- * name, filename, line_no,
+ * label, path, first_lineno,
* type, locals, args, exception_table, body]
*/
@@ -467,12 +498,13 @@ iseq_load(VALUE self, VALUE data, VALUE parent, VALUE opt)
version2 = CHECK_INTEGER(rb_ary_entry(data, i++));
format_type = CHECK_INTEGER(rb_ary_entry(data, i++));
misc = rb_ary_entry(data, i++); /* TODO */
+ ((void)magic, (void)version1, (void)version2, (void)format_type, (void)misc);
name = CHECK_STRING(rb_ary_entry(data, i++));
- filename = CHECK_STRING(rb_ary_entry(data, i++));
- filepath = rb_ary_entry(data, i++);
- filepath = NIL_P(filepath) ? Qnil : CHECK_STRING(filepath);
- line_no = CHECK_INTEGER(rb_ary_entry(data, i++));
+ path = CHECK_STRING(rb_ary_entry(data, i++));
+ absolute_path = rb_ary_entry(data, i++);
+ absolute_path = NIL_P(absolute_path) ? Qnil : CHECK_STRING(absolute_path);
+ first_lineno = CHECK_INTEGER(rb_ary_entry(data, i++));
type = CHECK_SYMBOL(rb_ary_entry(data, i++));
locals = CHECK_ARRAY(rb_ary_entry(data, i++));
@@ -487,6 +519,7 @@ 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();
@@ -502,11 +535,12 @@ iseq_load(VALUE self, VALUE data, VALUE parent, VALUE opt)
}
if (st_lookup(type_map, type, &iseq_type) == 0) {
- const char *typename = rb_id2name(type);
+ ID typeid = SYM2ID(type);
+ VALUE typename = rb_id2str(typeid);
if (typename)
- rb_raise(rb_eTypeError, "unsupport type: :%s", typename);
+ rb_raise(rb_eTypeError, "unsupport type: :%"PRIsVALUE, typename);
else
- rb_raise(rb_eTypeError, "unsupport type: %p", (void *)type);
+ rb_raise(rb_eTypeError, "unsupport type: %p", (void *)typeid);
}
if (parent == Qnil) {
@@ -514,7 +548,7 @@ iseq_load(VALUE self, VALUE data, VALUE parent, VALUE opt)
}
make_compile_option(&option, opt);
- prepare_iseq_build(iseq, name, filename, filepath, line_no,
+ prepare_iseq_build(iseq, name, path, absolute_path, first_lineno,
parent, (enum iseq_type)iseq_type, 0, &option);
rb_iseq_build_from_ary(iseq, locals, args, exception, body);
@@ -523,6 +557,9 @@ iseq_load(VALUE self, VALUE data, VALUE parent, VALUE opt)
return iseqval;
}
+/*
+ * :nodoc:
+ */
static VALUE
iseq_s_load(int argc, VALUE *argv, VALUE self)
{
@@ -538,45 +575,92 @@ 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 filepath, VALUE line, VALUE opt)
+rb_iseq_compile_with_option(VALUE src, VALUE file, VALUE absolute_path, VALUE line, rb_block_t *base_block, VALUE opt)
{
- rb_compile_option_t option;
- const char *fn = StringValueCStr(file);
- int ln = NUM2INT(line);
- NODE *node = parse_string(StringValue(src), fn, ln);
+ int state;
rb_thread_t *th = GET_THREAD();
- make_compile_option(&option, opt);
+ rb_block_t *prev_base_block = th->base_block;
+ VALUE iseqval = Qundef;
+
+ th->base_block = base_block;
+
+ TH_PUSH_TAG(th);
+ if ((state = EXEC_TAG()) == 0) {
+ VALUE parser;
+ int ln = NUM2INT(line);
+ NODE *node;
+ rb_compile_option_t option;
+
+ StringValueCStr(file);
+ make_compile_option(&option, opt);
+
+ parser = rb_parser_new();
+
+ if (RB_TYPE_P((src), T_FILE))
+ node = rb_parser_compile_file_path(parser, file, src, ln);
+ else {
+ node = rb_parser_compile_string_path(parser, file, src, ln);
- if (th->base_block && th->base_block->iseq) {
- return rb_iseq_new_with_opt(node, th->base_block->iseq->name,
- file, filepath, line, th->base_block->iseq->self,
- ISEQ_TYPE_EVAL, &option);
+ if (!node) {
+ rb_exc_raise(GET_THREAD()->errinfo); /* TODO: check err */
+ }
+ }
+
+ if (base_block && base_block->iseq) {
+ iseqval = rb_iseq_new_with_opt(node, base_block->iseq->location.label,
+ file, absolute_path, line, base_block->iseq->self,
+ ISEQ_TYPE_EVAL, &option);
+ }
+ else {
+ iseqval = rb_iseq_new_with_opt(node, rb_str_new2("<compiled>"), file, absolute_path, line, Qfalse,
+ ISEQ_TYPE_TOP, &option);
+ }
}
- else {
- return rb_iseq_new_with_opt(node, rb_str_new2("<compiled>"), file, filepath, line, Qfalse,
- ISEQ_TYPE_TOP, &option);
+ TH_POP_TAG();
+
+ th->base_block = prev_base_block;
+
+ if (state) {
+ JUMP_TAG(state);
}
+
+ return iseqval;
}
VALUE
rb_iseq_compile(VALUE src, VALUE file, VALUE line)
{
- return rb_iseq_compile_with_option(src, file, Qnil, line, Qnil);
+ return rb_iseq_compile_with_option(src, file, Qnil, line, 0, Qnil);
+}
+
+VALUE
+rb_iseq_compile_on_base(VALUE src, VALUE file, VALUE line, rb_block_t *base_block)
+{
+ return rb_iseq_compile_with_option(src, file, Qnil, line, base_block, Qnil);
}
+/*
+ * call-seq:
+ * InstructionSequence.compile(source[, file[, path[, line[, options]]]]) -> iseq
+ * InstructionSequence.new(source[, file[, path[, line[, options]]]]) -> iseq
+ *
+ * Takes +source+, a String of Ruby code and compiles it to an
+ * InstructionSequence.
+ *
+ * Optionally takes +file+, +path+, and +line+ which describe the filename,
+ * absolute path and first line number of the ruby code in +source+ which are
+ * metadata attached to the returned +iseq+.
+ *
+ * +options+, which can be +true+, +false+ or a +Hash+, is used to
+ * modify the default behavior of the Ruby iseq compiler.
+ *
+ * For details regarding valid compile options see ::compile_option=.
+ *
+ * RubyVM::InstructionSequence.compile("a = 1 + 2")
+ * #=> <RubyVM::InstructionSequence:<compiled>@<compiled>>
+ *
+ */
static VALUE
iseq_s_compile(int argc, VALUE *argv, VALUE self)
{
@@ -588,9 +672,29 @@ iseq_s_compile(int argc, VALUE *argv, VALUE self)
if (NIL_P(file)) file = rb_str_new2("<compiled>");
if (NIL_P(line)) line = INT2FIX(1);
- return rb_iseq_compile_with_option(src, file, path, line, opt);
+ return rb_iseq_compile_with_option(src, file, path, line, 0, opt);
}
+/*
+ * call-seq:
+ * InstructionSequence.compile_file(file[, options]) -> iseq
+ *
+ * Takes +file+, a String with the location of a Ruby source file, reads,
+ * parses and compiles the file, and returns +iseq+, the compiled
+ * InstructionSequence with source location metadata set.
+ *
+ * Optionally takes +options+, which can be +true+, +false+ or a +Hash+, to
+ * modify the default behavior of the Ruby iseq compiler.
+ *
+ * For details regarding valid compile options see ::compile_option=.
+ *
+ * # /tmp/hello.rb
+ * puts "Hello, world!"
+ *
+ * # elsewhere
+ * RubyVM::InstructionSequence.compile_file("/tmp/hello.rb")
+ * #=> <RubyVM::InstructionSequence:<main>@/tmp/hello.rb>
+ */
static VALUE
iseq_s_compile_file(int argc, VALUE *argv, VALUE self)
{
@@ -616,6 +720,38 @@ iseq_s_compile_file(int argc, VALUE *argv, VALUE self)
ISEQ_TYPE_TOP, &option);
}
+/*
+ * call-seq:
+ * InstructionSequence.compile_option = options
+ *
+ * Sets the default values for various optimizations in the Ruby iseq
+ * compiler.
+ *
+ * Possible values for +options+ include +true+, which enables all options,
+ * +false+ which disables all options, and +nil+ which leaves all options
+ * unchanged.
+ *
+ * You can also pass a +Hash+ of +options+ that you want to change, any
+ * options not present in the hash will be left unchanged.
+ *
+ * Possible option names (which are keys in +options+) which can be set to
+ * +true+ or +false+ include:
+ *
+ * * +:inline_const_cache+
+ * * +:instructions_unification+
+ * * +:operands_unification+
+ * * +:peephole_optimization+
+ * * +:specialized_instruction+
+ * * +:stack_caching+
+ * * +:tailcall_optimization+
+ * * +:trace_instruction+
+ *
+ * Additionally, +:debug_level+ can be set to an integer.
+ *
+ * These default options can be overwritten for a single run of the iseq
+ * compiler by passing any of the above values as the +options+ parameter to
+ * ::new, ::compile and ::compile_file.
+ */
static VALUE
iseq_s_compile_option_set(VALUE self, VALUE opt)
{
@@ -626,6 +762,14 @@ iseq_s_compile_option_set(VALUE self, VALUE opt)
return opt;
}
+/*
+ * call-seq:
+ * InstructionSequence.compile_option -> options
+ *
+ * Returns a hash of default options used by the Ruby iseq compiler.
+ *
+ * For details, see InstructionSequence.compile_option=.
+ */
static VALUE
iseq_s_compile_option_get(VALUE self)
{
@@ -637,12 +781,20 @@ iseq_check(VALUE val)
{
rb_iseq_t *iseq;
GetISeqPtr(val, iseq);
- if (!iseq->name) {
+ if (!iseq->location.label) {
rb_raise(rb_eTypeError, "uninitialized InstructionSequence");
}
return iseq;
}
+/*
+ * call-seq:
+ * iseq.eval -> obj
+ *
+ * Evaluates the instruction sequence and returns the result.
+ *
+ * RubyVM::InstructionSequence.compile("1 + 2").eval #=> 3
+ */
static VALUE
iseq_eval(VALUE self)
{
@@ -650,23 +802,266 @@ iseq_eval(VALUE self)
return rb_iseq_eval(self);
}
+/*
+ * Returns a human-readable string representation of this instruction
+ * sequence, including the #label and #path.
+ */
static VALUE
iseq_inspect(VALUE self)
{
rb_iseq_t *iseq;
GetISeqPtr(self, iseq);
- if (!iseq->name) {
+ if (!iseq->location.label) {
return rb_sprintf("#<%s: uninitialized>", rb_obj_classname(self));
}
return rb_sprintf("<%s:%s@%s>",
rb_obj_classname(self),
- RSTRING_PTR(iseq->name), RSTRING_PTR(iseq->filename));
+ RSTRING_PTR(iseq->location.label), RSTRING_PTR(iseq->location.path));
+}
+
+/*
+ * Returns the path of this instruction sequence.
+ *
+ * <code><compiled></code> if the iseq was evaluated from a string.
+ *
+ * For example, using irb:
+ *
+ * iseq = RubyVM::InstructionSequence.compile('num = 1 + 2')
+ * #=> <RubyVM::InstructionSequence:<compiled>@<compiled>>
+ * iseq.path
+ * #=> "<compiled>"
+ *
+ * Using ::compile_file:
+ *
+ * # /tmp/method.rb
+ * def hello
+ * puts "hello, world"
+ * end
+ *
+ * # in irb
+ * > iseq = RubyVM::InstructionSequence.compile_file('/tmp/method.rb')
+ * > iseq.path #=> /tmp/method.rb
+ */
+VALUE
+rb_iseq_path(VALUE self)
+{
+ rb_iseq_t *iseq;
+ GetISeqPtr(self, iseq);
+ return iseq->location.path;
+}
+
+/*
+ * Returns the absolute path of this instruction sequence.
+ *
+ * +nil+ if the iseq was evaluated from a string.
+ *
+ * For example, using ::compile_file:
+ *
+ * # /tmp/method.rb
+ * def hello
+ * puts "hello, world"
+ * end
+ *
+ * # in irb
+ * > iseq = RubyVM::InstructionSequence.compile_file('/tmp/method.rb')
+ * > iseq.absolute_path #=> /tmp/method.rb
+ */
+VALUE
+rb_iseq_absolute_path(VALUE self)
+{
+ rb_iseq_t *iseq;
+ GetISeqPtr(self, iseq);
+ return iseq->location.absolute_path;
+}
+
+/* Returns the label of this instruction sequence.
+ *
+ * <code><main></code> if it's at the top level, <code><compiled></code> if it
+ * was evaluated from a string.
+ *
+ * For example, using irb:
+ *
+ * iseq = RubyVM::InstructionSequence.compile('num = 1 + 2')
+ * #=> <RubyVM::InstructionSequence:<compiled>@<compiled>>
+ * iseq.label
+ * #=> "<compiled>"
+ *
+ * Using ::compile_file:
+ *
+ * # /tmp/method.rb
+ * def hello
+ * puts "hello, world"
+ * end
+ *
+ * # in irb
+ * > iseq = RubyVM::InstructionSequence.compile_file('/tmp/method.rb')
+ * > iseq.label #=> <main>
+ */
+VALUE
+rb_iseq_label(VALUE self)
+{
+ rb_iseq_t *iseq;
+ GetISeqPtr(self, iseq);
+ return iseq->location.label;
+}
+
+/* Returns the base label of this instruction sequence.
+ *
+ * For example, using irb:
+ *
+ * iseq = RubyVM::InstructionSequence.compile('num = 1 + 2')
+ * #=> <RubyVM::InstructionSequence:<compiled>@<compiled>>
+ * iseq.base_label
+ * #=> "<compiled>"
+ *
+ * Using ::compile_file:
+ *
+ * # /tmp/method.rb
+ * def hello
+ * puts "hello, world"
+ * end
+ *
+ * # in irb
+ * > iseq = RubyVM::InstructionSequence.compile_file('/tmp/method.rb')
+ * > iseq.base_label #=> <main>
+ */
+VALUE
+rb_iseq_base_label(VALUE self)
+{
+ rb_iseq_t *iseq;
+ GetISeqPtr(self, iseq);
+ return iseq->location.base_label;
+}
+
+/* Returns the number of the first source line where the instruction sequence
+ * was loaded from.
+ *
+ * For example, using irb:
+ *
+ * iseq = RubyVM::InstructionSequence.compile('num = 1 + 2')
+ * #=> <RubyVM::InstructionSequence:<compiled>@<compiled>>
+ * iseq.first_lineno
+ * #=> 1
+ */
+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);
+/*
+ * call-seq:
+ * iseq.to_a -> ary
+ *
+ * Returns an Array with 14 elements representing the instruction sequence
+ * with the following data:
+ *
+ * [magic]
+ * A string identifying the data format. <b>Always
+ * +YARVInstructionSequence/SimpleDataFormat+.</b>
+ *
+ * [major_version]
+ * The major version of the instruction sequence.
+ *
+ * [minor_version]
+ * The minor version of the instruction sequence.
+ *
+ * [format_type]
+ * A number identifying the data format. <b>Always 1</b>.
+ *
+ * [misc]
+ * A hash containing:
+ *
+ * [+:arg_size+]
+ * the total number of arguments taken by the method or the block (0 if
+ * _iseq_ doesn't represent a method or block)
+ * [+:local_size+]
+ * the number of local variables + 1
+ * [+:stack_max+]
+ * used in calculating the stack depth at which a SystemStackError is
+ * thrown.
+ *
+ * [#label]
+ * The name of the context (block, method, class, module, etc.) that this
+ * instruction sequence belongs to.
+ *
+ * <code><main></code> if it's at the top level, <code><compiled></code> if
+ * it was evaluated from a string.
+ *
+ * [#path]
+ * The relative path to the Ruby file where the instruction sequence was
+ * loaded from.
+ *
+ * <code><compiled></code> if the iseq was evaluated from a string.
+ *
+ * [#absolute_path]
+ * The absolute path to the Ruby file where the instruction sequence was
+ * loaded from.
+ *
+ * +nil+ if the iseq was evaluated from a string.
+ *
+ * [#first_lineno]
+ * The number of the first source line where the instruction sequence was
+ * loaded from.
+ *
+ * [type]
+ * The type of the instruction sequence.
+ *
+ * Valid values are +:top+, +:method+, +:block+, +:class+, +:rescue+,
+ * +:ensure+, +:eval+, +:main+, and +:defined_guard+.
+ *
+ * [locals]
+ * An array containing the names of all arguments and local variables as
+ * symbols.
+ *
+ * [args]
+ * The arity if the method or block only has required arguments.
+ *
+ * Otherwise an array of:
+ *
+ * [required_argc, [optional_arg_labels, ...],
+ * splat_index, post_splat_argc, post_splat_index,
+ * block_index, simple]
+ *
+ * More info about these values can be found in +vm_core.h+.
+ *
+ * [catch_table]
+ * A list of exceptions and control flow operators (rescue, next, redo,
+ * break, etc.).
+ *
+ * [bytecode]
+ * An array of arrays containing the instruction names and operands that
+ * make up the body of the instruction sequence.
+ *
+ */
static VALUE
iseq_to_a(VALUE self)
{
@@ -675,34 +1070,48 @@ iseq_to_a(VALUE self)
return iseq_data_to_ary(iseq);
}
-int
-rb_iseq_first_lineno(rb_iseq_t *iseq)
-{
- return FIX2INT(iseq->line_no);
-}
-
/* TODO: search algorithm is brute force.
this should be binary search or so. */
-static struct iseq_insn_info_entry *
-get_insn_info(const rb_iseq_t *iseq, const unsigned long pos)
+static struct iseq_line_info_entry *
+get_line_info(const rb_iseq_t *iseq, size_t pos)
{
- unsigned long i, size = iseq->insn_info_size;
- struct iseq_insn_info_entry *table = iseq->insn_info_table;
+ size_t i = 0, size = iseq->line_info_size;
+ struct iseq_line_info_entry *table = iseq->line_info_table;
+ const int debug = 0;
- for (i = 0; i < size; i++) {
- if (table[i].position == pos) {
- return &table[i];
- }
+ if (debug) {
+ printf("size: %"PRIdSIZE"\n", size);
+ printf("table[%"PRIdSIZE"]: position: %d, line: %d, pos: %"PRIdSIZE"\n",
+ i, table[i].position, table[i].line_no, pos);
+ }
+
+ if (size == 0) {
+ return 0;
}
+ else if (size == 1) {
+ return &table[0];
+ }
+ else {
+ for (i=1; i<size; i++) {
+ if (debug) printf("table[%"PRIdSIZE"]: position: %d, line: %d, pos: %"PRIdSIZE"\n",
+ i, table[i].position, table[i].line_no, pos);
- return 0;
+ if (table[i].position == pos) {
+ return &table[i];
+ }
+ if (table[i].position > pos) {
+ return &table[i-1];
+ }
+ }
+ }
+ return &table[i-1];
}
-static unsigned short
-find_line_no(rb_iseq_t *iseq, unsigned long pos)
+static unsigned int
+find_line_no(const rb_iseq_t *iseq, size_t pos)
{
- struct iseq_insn_info_entry *entry = get_insn_info(iseq, pos);
+ struct iseq_line_info_entry *entry = get_line_info(iseq, pos);
if (entry) {
return entry->line_no;
}
@@ -711,30 +1120,34 @@ find_line_no(rb_iseq_t *iseq, unsigned long pos)
}
}
-static unsigned short
-find_prev_line_no(rb_iseq_t *iseqdat, unsigned long pos)
+unsigned int
+rb_iseq_line_no(const rb_iseq_t *iseq, size_t pos)
{
- unsigned long i, size = iseqdat->insn_info_size;
- struct iseq_insn_info_entry *iiary = iseqdat->insn_info_table;
-
- for (i = 0; i < size; i++) {
- if (iiary[i].position == pos) {
- if (i > 0) {
- return iiary[i - 1].line_no;
- }
- else {
- return 0;
- }
- }
+ if (pos == 0) {
+ return find_line_no(iseq, pos);
+ }
+ else {
+ return find_line_no(iseq, pos - 1);
}
-
- return 0;
}
static VALUE
-insn_operand_intern(rb_iseq_t *iseq,
- VALUE insn, int op_no, VALUE op,
- int len, size_t pos, VALUE *pnop, VALUE child)
+id_to_name(ID id, VALUE default_value)
+{
+ VALUE str = rb_id2str(id);
+ if (!str) {
+ str = default_value;
+ }
+ else if (!rb_str_symname_p(str)) {
+ str = rb_str_inspect(str);
+ }
+ return str;
+}
+
+VALUE
+rb_insn_operand_intern(rb_iseq_t *iseq,
+ VALUE insn, int op_no, VALUE op,
+ int len, size_t pos, VALUE *pnop, VALUE child)
{
const char *types = insn_op_types(insn);
char type = types[op_no];
@@ -749,34 +1162,20 @@ insn_operand_intern(rb_iseq_t *iseq,
ret = rb_sprintf("%"PRIuVALUE, op);
break;
- case TS_LINDEX:
- {
- rb_iseq_t *liseq = iseq->local_iseq;
- int lidx = liseq->local_size - (int)op;
- const char *name = rb_id2name(liseq->local_table[lidx]);
+ case TS_LINDEX:{
+ if (insn == BIN(getlocal) || insn == BIN(setlocal)) {
+ if (pnop) {
+ rb_iseq_t *diseq = iseq;
+ VALUE level = *pnop, i;
- if (name) {
- ret = rb_str_new2(name);
+ for (i = 0; i < level; i++) {
+ diseq = diseq->parent_iseq;
+ }
+ ret = id_to_name(diseq->local_table[diseq->local_size - op], INT2FIX('*'));
}
else {
- ret = rb_str_new2("*");
+ ret = rb_sprintf("%"PRIuVALUE, op);
}
- break;
- }
- case TS_DINDEX:{
- if (insn == BIN(getdynamic) || insn == BIN(setdynamic)) {
- rb_iseq_t *diseq = iseq;
- VALUE level = *pnop, i;
- const char *name;
- for (i = 0; i < level; i++) {
- diseq = diseq->parent_iseq;
- }
- name = rb_id2name(diseq->local_table[diseq->local_size - op]);
-
- if (!name) {
- name = "*";
- }
- ret = rb_str_new2(name);
}
else {
ret = rb_inspect(INT2FIX(op));
@@ -790,7 +1189,9 @@ insn_operand_intern(rb_iseq_t *iseq,
op = obj_resurrect(op);
ret = rb_inspect(op);
if (CLASS_OF(op) == rb_cISeq) {
- rb_ary_push(child, op);
+ if (child) {
+ rb_ary_push(child, op);
+ }
}
break;
@@ -798,7 +1199,7 @@ insn_operand_intern(rb_iseq_t *iseq,
{
rb_iseq_t *iseq = (rb_iseq_t *)op;
if (iseq) {
- ret = iseq->name;
+ ret = iseq->location.label;
if (child) {
rb_ary_push(child, iseq->self);
}
@@ -816,7 +1217,41 @@ 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:
+ {
+ rb_call_info_t *ci = (rb_call_info_t *)op;
+ VALUE ary = rb_ary_new();
+
+ if (ci->mid) {
+ rb_ary_push(ary, rb_sprintf("mid:%s", rb_id2name(ci->mid)));
+ }
+
+ rb_ary_push(ary, rb_sprintf("argc:%d", ci->orig_argc));
+
+ if (ci->blockiseq) {
+ if (child) {
+ rb_ary_push(child, ci->blockiseq->self);
+ }
+ rb_ary_push(ary, rb_sprintf("block:%"PRIsVALUE, ci->blockiseq->location.label));
+ }
+
+ if (ci->flag) {
+ VALUE flags = rb_ary_new();
+ if (ci->flag & VM_CALL_ARGS_SPLAT) rb_ary_push(flags, rb_str_new2("ARGS_SPLAT"));
+ if (ci->flag & VM_CALL_ARGS_BLOCKARG) rb_ary_push(flags, rb_str_new2("ARGS_BLOCKARG"));
+ if (ci->flag & VM_CALL_FCALL) rb_ary_push(flags, rb_str_new2("FCALL"));
+ if (ci->flag & VM_CALL_VCALL) rb_ary_push(flags, rb_str_new2("VCALL"));
+ if (ci->flag & VM_CALL_TAILCALL) rb_ary_push(flags, rb_str_new2("TAILCALL"));
+ if (ci->flag & VM_CALL_SUPER) rb_ary_push(flags, rb_str_new2("SUPER"));
+ if (ci->flag & VM_CALL_OPT_SEND) rb_ary_push(flags, rb_str_new2("SNED")); /* maybe not reachable */
+ if (ci->flag & VM_CALL_ARGS_SKIP_SETUP) rb_ary_push(flags, rb_str_new2("ARGS_SKIP")); /* maybe not reachable */
+ rb_ary_push(ary, rb_ary_join(flags, rb_str_new2("|")));
+ }
+ ret = rb_sprintf("<callinfo!%"PRIsVALUE">", rb_ary_join(ary, rb_str_new2(", ")));
+ }
break;
case TS_CDHASH:
@@ -828,7 +1263,7 @@ insn_operand_intern(rb_iseq_t *iseq,
break;
default:
- rb_bug("rb_iseq_disasm: unknown operand type: %c", type);
+ rb_bug("insn_operand_intern: unknown operand type: %c", type);
}
return ret;
}
@@ -859,9 +1294,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]) {
@@ -869,23 +1304,15 @@ rb_iseq_disasm_insn(VALUE ret, VALUE *iseq, size_t pos,
}
}
- if (1) {
- int line_no = find_line_no(iseqdat, pos);
- int prev = find_prev_line_no(iseqdat, pos);
+ {
+ unsigned int line_no = find_line_no(iseqdat, pos);
+ unsigned int prev = pos == 0 ? 0 : find_line_no(iseqdat, pos - 1);
if (line_no && line_no != prev) {
long slen = RSTRING_LEN(str);
slen = (slen > 70) ? 0 : (70 - slen);
str = rb_str_catf(str, "%*s(%4d)", (int)slen, "", line_no);
}
}
- else {
- /* for debug */
- struct iseq_insn_info_entry *entry = get_insn_info(iseqdat, pos);
- long slen = RSTRING_LEN(str);
- slen = (slen > 60) ? 0 : (60 - slen);
- str = rb_str_catf(str, "%*s(line: %d, sp: %d)",
- (int)slen, "", entry->line_no, entry->sp);
- }
if (ret) {
rb_str_cat2(str, "\n");
@@ -919,6 +1346,24 @@ catch_type(int type)
}
}
+/*
+ * call-seq:
+ * iseq.disasm -> str
+ * iseq.disassemble -> str
+ *
+ * Returns the instruction sequence as a +String+ in human readable form.
+ *
+ * puts RubyVM::InstructionSequence.compile('1 + 2').disasm
+ *
+ * Produces:
+ *
+ * == disasm: <RubyVM::InstructionSequence:<compiled>@<compiled>>==========
+ * 0000 trace 1 ( 1)
+ * 0002 putobject 1
+ * 0004 putobject 2
+ * 0006 opt_plus <ic:1>
+ * 0008 leave
+ */
VALUE
rb_iseq_disasm(VALUE self)
{
@@ -972,15 +1417,16 @@ 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++) {
- const char *name = rb_id2name(tbl[i]);
- char info[0x100];
+ long width;
+ VALUE name = id_to_name(tbl[i], 0);
char argi[0x100] = "";
char opti[0x100] = "";
@@ -1001,10 +1447,14 @@ rb_iseq_disasm(VALUE self)
i < iseqdat->arg_post_start + iseqdat->arg_post_len) ? "Post" : "",
iseqdat->arg_block == i ? "Block" : "");
- snprintf(info, sizeof(info), "%s%s%s%s", name ? name : "?",
- *argi ? "<" : "", argi, *argi ? ">" : "");
-
- rb_str_catf(str, "[%2d] %-11s", iseqdat->local_size - i, info);
+ rb_str_catf(str, "[%2d] ", iseqdat->local_size - i);
+ width = RSTRING_LEN(str) + 11;
+ if (name)
+ rb_str_append(str, name);
+ else
+ rb_str_cat2(str, "?");
+ if (*argi) rb_str_catf(str, "<%s>", argi);
+ if ((width -= RSTRING_LEN(str)) > 0) rb_str_catf(str, "%*s", (int)width, "");
}
rb_str_cat2(str, "\n");
}
@@ -1022,8 +1472,43 @@ rb_iseq_disasm(VALUE self)
return str;
}
+/*
+ * Returns the instruction sequence containing the given proc or method.
+ *
+ * For example, using irb:
+ *
+ * # a proc
+ * > p = proc { num = 1 + 2 }
+ * > RubyVM::InstructionSequence.of(p)
+ * > #=> <RubyVM::InstructionSequence:block in irb_binding@(irb)>
+ *
+ * # for a method
+ * > def foo(bar); puts bar; end
+ * > RubyVM::InstructionSequence.of(method(:foo))
+ * > #=> <RubyVM::InstructionSequence:foo@(irb)>
+ *
+ * Using ::compile_file:
+ *
+ * # /tmp/iseq_of.rb
+ * def hello
+ * puts "hello, world"
+ * end
+ *
+ * $a_global_proc = proc { str = 'a' + 'b' }
+ *
+ * # in irb
+ * > require '/tmp/iseq_of.rb'
+ *
+ * # first the method hello
+ * > RubyVM::InstructionSequence.of(method(:hello))
+ * > #=> #<RubyVM::InstructionSequence:0x007fb73d7cb1d0>
+ *
+ * # then the global proc
+ * > RubyVM::InstructionSequence.of($a_global_proc)
+ * > #=> #<RubyVM::InstructionSequence:0x007fb73d7caf78>
+ */
static VALUE
-iseq_s_disasm(VALUE klass, VALUE body)
+iseq_s_of(VALUE klass, VALUE body)
{
VALUE ret = Qnil;
rb_iseq_t *iseq;
@@ -1035,16 +1520,75 @@ iseq_s_disasm(VALUE klass, VALUE body)
GetProcPtr(body, proc);
iseq = proc->block.iseq;
if (RUBY_VM_NORMAL_ISEQ_P(iseq)) {
- ret = rb_iseq_disasm(iseq->self);
+ ret = iseq->self;
}
}
else if ((iseq = rb_method_get_iseq(body)) != 0) {
- ret = rb_iseq_disasm(iseq->self);
+ ret = iseq->self;
}
-
return ret;
}
+/*
+ * call-seq:
+ * InstructionSequence.disasm(body) -> str
+ * InstructionSequence.disassemble(body) -> str
+ *
+ * Takes +body+, a Method or Proc object, and returns a String with the
+ * human readable instructions for +body+.
+ *
+ * For a Method object:
+ *
+ * # /tmp/method.rb
+ * def hello
+ * puts "hello, world"
+ * end
+ *
+ * puts RubyVM::InstructionSequence.disasm(method(:hello))
+ *
+ * Produces:
+ *
+ * == disasm: <RubyVM::InstructionSequence:hello@/tmp/method.rb>============
+ * 0000 trace 8 ( 1)
+ * 0002 trace 1 ( 2)
+ * 0004 putself
+ * 0005 putstring "hello, world"
+ * 0007 send :puts, 1, nil, 8, <ic:0>
+ * 0013 trace 16 ( 3)
+ * 0015 leave ( 2)
+ *
+ * For a Proc:
+ *
+ * # /tmp/proc.rb
+ * p = proc { num = 1 + 2 }
+ * puts RubyVM::InstructionSequence.disasm(p)
+ *
+ * Produces:
+ *
+ * == disasm: <RubyVM::InstructionSequence:block in <main>@/tmp/proc.rb>===
+ * == catch table
+ * | catch type: redo st: 0000 ed: 0012 sp: 0000 cont: 0000
+ * | catch type: next st: 0000 ed: 0012 sp: 0000 cont: 0012
+ * |------------------------------------------------------------------------
+ * local table (size: 2, argc: 0 [opts: 0, rest: -1, post: 0, block: -1] s1)
+ * [ 2] num
+ * 0000 trace 1 ( 1)
+ * 0002 putobject 1
+ * 0004 putobject 2
+ * 0006 opt_plus <ic:1>
+ * 0008 dup
+ * 0009 setlocal num, 0
+ * 0012 leave
+ *
+ */
+
+static VALUE
+iseq_s_disasm(VALUE klass, VALUE body)
+{
+ VALUE iseqval = iseq_s_of(klass, body);
+ return NIL_P(iseqval) ? Qnil : rb_iseq_disasm(iseqval);
+}
+
const char *
ruby_node_name(int node)
{
@@ -1078,7 +1622,7 @@ static VALUE
exception_type2symbol(VALUE type)
{
ID id;
- switch(type) {
+ switch (type) {
case CATCH_TYPE_RESCUE: CONST_ID(id, "rescue"); break;
case CATCH_TYPE_ENSURE: CONST_ID(id, "ensure"); break;
case CATCH_TYPE_RETRY: CONST_ID(id, "retry"); break;
@@ -1102,8 +1646,10 @@ cdhash_each(VALUE key, VALUE value, VALUE ary)
static VALUE
iseq_data_to_ary(rb_iseq_t *iseq)
{
- long i, pos;
- int line = 0;
+ long i;
+ size_t ti;
+ unsigned int pos;
+ unsigned int line = 0;
VALUE *seq;
VALUE val = rb_ary_new();
@@ -1145,7 +1691,7 @@ iseq_data_to_ary(rb_iseq_t *iseq)
}
/* type */
- switch(iseq->type) {
+ switch (iseq->type) {
case ISEQ_TYPE_TOP: type = sym_top; break;
case ISEQ_TYPE_METHOD: type = sym_method; break;
case ISEQ_TYPE_BLOCK: type = sym_block; break;
@@ -1220,7 +1766,6 @@ iseq_data_to_ary(rb_iseq_t *iseq)
break;
}
case TS_LINDEX:
- case TS_DINDEX:
case TS_NUM:
rb_ary_push(ary, INT2FIX(*seq));
break;
@@ -1245,9 +1790,21 @@ 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:
+ {
+ rb_call_info_t *ci = (rb_call_info_t *)*seq;
+ VALUE e = rb_hash_new();
+ rb_hash_aset(e, ID2SYM(rb_intern("mid")), ci->mid ? ID2SYM(ci->mid) : Qnil);
+ rb_hash_aset(e, ID2SYM(rb_intern("flag")), ULONG2NUM(ci->flag));
+ rb_hash_aset(e, ID2SYM(rb_intern("orig_argc")), INT2FIX(ci->orig_argc));
+ rb_hash_aset(e, ID2SYM(rb_intern("blockptr")), ci->blockiseq ? iseq_data_to_ary(ci->blockiseq) : Qnil);
+ rb_ary_push(ary, e);
}
break;
case TS_ID:
@@ -1302,18 +1859,20 @@ iseq_data_to_ary(rb_iseq_t *iseq)
/* make body with labels and insert line number */
body = rb_ary_new();
+ 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)) {
rb_ary_push(body, (VALUE)label);
}
- if (iseq->insn_info_table[i].line_no != line) {
- line = iseq->insn_info_table[i].line_no;
+ if (ti < iseq->line_info_size && iseq->line_info_table[ti].position == pos) {
+ line = iseq->line_info_table[ti].line_no;
rb_ary_push(body, INT2FIX(line));
+ ti++;
}
rb_ary_push(body, ary);
@@ -1326,9 +1885,10 @@ iseq_data_to_ary(rb_iseq_t *iseq)
rb_hash_aset(misc, ID2SYM(rb_intern("local_size")), INT2FIX(iseq->local_size));
rb_hash_aset(misc, ID2SYM(rb_intern("stack_max")), INT2FIX(iseq->stack_max));
+ /* TODO: compatibility issue */
/*
* [:magic, :major_version, :minor_version, :format_type, :misc,
- * :name, :filename, :filepath, :line_no, :type, :locals, :args,
+ * :name, :path, :absolute_path, :start_lineno, :type, :locals, :args,
* :catch_table, :bytecode]
*/
rb_ary_push(val, rb_str_new2("YARVInstructionSequence/SimpleDataFormat"));
@@ -1336,10 +1896,10 @@ iseq_data_to_ary(rb_iseq_t *iseq)
rb_ary_push(val, INT2FIX(ISEQ_MINOR_VERSION)); /* minor */
rb_ary_push(val, INT2FIX(1));
rb_ary_push(val, misc);
- rb_ary_push(val, iseq->name);
- rb_ary_push(val, iseq->filename);
- rb_ary_push(val, iseq->filepath);
- rb_ary_push(val, iseq->line_no);
+ rb_ary_push(val, iseq->location.label);
+ rb_ary_push(val, iseq->location.path);
+ rb_ary_push(val, iseq->location.absolute_path);
+ rb_ary_push(val, iseq->location.first_lineno);
rb_ary_push(val, type);
rb_ary_push(val, locals);
rb_ary_push(val, args);
@@ -1357,20 +1917,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;
+ OBJ_WRITE(iseq1->self, &iseq1->orig, iseqval);
}
if (iseq0->local_iseq == iseq0) {
iseq1->local_iseq = iseq1;
}
if (newcbase) {
- iseq1->cref_stack = NEW_BLOCK(newcbase);
+ ISEQ_SET_CREF(iseq1, NEW_CREF(newcbase));
+ iseq1->cref_stack->nd_refinements = iseq0->cref_stack->nd_refinements;
+ iseq1->cref_stack->nd_visi = iseq0->cref_stack->nd_visi;
if (iseq0->cref_stack->nd_next) {
iseq1->cref_stack->nd_next = iseq0->cref_stack->nd_next;
}
- iseq1->klass = newcbase;
+ OBJ_WRITE(iseq1, &iseq1->klass, newcbase);
}
return newiseq;
@@ -1379,14 +1942,14 @@ rb_iseq_clone(VALUE iseqval, VALUE newcbase)
VALUE
rb_iseq_parameters(const rb_iseq_t *iseq, int is_proc)
{
- int i, r, s;
+ int i, r;
VALUE a, args = rb_ary_new2(iseq->arg_size);
- ID req, opt, rest, block;
+ ID req, opt, rest, block, key, keyrest;
#define PARAM_TYPE(type) rb_ary_push(a = rb_ary_new2(2), ID2SYM(type))
#define PARAM_ID(i) iseq->local_table[(i)]
#define PARAM(i, type) ( \
PARAM_TYPE(type), \
- rb_id2name(PARAM_ID(i)) ? \
+ rb_id2str(PARAM_ID(i)) ? \
rb_ary_push(a, ID2SYM(PARAM_ID(i))) : \
a)
@@ -1395,7 +1958,7 @@ rb_iseq_parameters(const rb_iseq_t *iseq, int is_proc)
if (is_proc) {
for (i = 0; i < iseq->argc; i++) {
PARAM_TYPE(opt);
- rb_ary_push(a, rb_id2name(PARAM_ID(i)) ? ID2SYM(PARAM_ID(i)) : Qnil);
+ rb_ary_push(a, rb_id2str(PARAM_ID(i)) ? ID2SYM(PARAM_ID(i)) : Qnil);
rb_ary_push(args, a);
}
}
@@ -1404,13 +1967,10 @@ rb_iseq_parameters(const rb_iseq_t *iseq, int is_proc)
rb_ary_push(args, PARAM(i, req));
}
}
- r = iseq->arg_rest != -1 ? iseq->arg_rest :
- iseq->arg_post_len > 0 ? iseq->arg_post_start :
- iseq->arg_block != -1 ? iseq->arg_block :
- iseq->arg_size;
- for (s = i; i < r; i++) {
+ r = iseq->argc + iseq->arg_opts - 1;
+ for (; i < r; i++) {
PARAM_TYPE(opt);
- if (rb_id2name(PARAM_ID(i))) {
+ if (rb_id2str(PARAM_ID(i))) {
rb_ary_push(a, ID2SYM(PARAM_ID(i)));
}
rb_ary_push(args, a);
@@ -1423,7 +1983,7 @@ rb_iseq_parameters(const rb_iseq_t *iseq, int is_proc)
if (is_proc) {
for (i = iseq->arg_post_start; i < r; i++) {
PARAM_TYPE(opt);
- rb_ary_push(a, rb_id2name(PARAM_ID(i)) ? ID2SYM(PARAM_ID(i)) : Qnil);
+ rb_ary_push(a, rb_id2str(PARAM_ID(i)) ? ID2SYM(PARAM_ID(i)) : Qnil);
rb_ary_push(args, a);
}
}
@@ -1432,6 +1992,32 @@ rb_iseq_parameters(const rb_iseq_t *iseq, int is_proc)
rb_ary_push(args, PARAM(i, req));
}
}
+ 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 < 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])) {
+ CONST_ID(keyrest, "keyrest");
+ rb_ary_push(args, PARAM(iseq->arg_keyword, keyrest));
+ }
+ }
if (iseq->arg_block != -1) {
CONST_ID(block, "block");
rb_ary_push(args, PARAM(iseq->arg_block, block));
@@ -1439,19 +2025,58 @@ rb_iseq_parameters(const rb_iseq_t *iseq, int is_proc)
return args;
}
+VALUE
+rb_iseq_defined_string(enum defined_type type)
+{
+ static const char expr_names[][18] = {
+ "nil",
+ "instance-variable",
+ "local-variable",
+ "global-variable",
+ "class variable",
+ "constant",
+ "method",
+ "yield",
+ "super",
+ "self",
+ "true",
+ "false",
+ "assignment",
+ "expression",
+ };
+ const char *estr;
+ VALUE *defs, str;
+
+ if ((unsigned)(type - 1) >= (unsigned)numberof(expr_names)) return 0;
+ estr = expr_names[type - 1];
+ if (!estr[0]) return 0;
+ defs = GET_VM()->defined_strings;
+ if (!defs) {
+ defs = ruby_xcalloc(numberof(expr_names), sizeof(VALUE));
+ GET_VM()->defined_strings = defs;
+ }
+ str = defs[type-1];
+ if (!str) {
+ str = rb_str_new_cstr(estr);;
+ OBJ_FREEZE(str);
+ defs[type-1] = str;
+ }
+ return str;
+}
+
/* ruby2cext */
VALUE
rb_iseq_build_for_ruby2cext(
const rb_iseq_t *iseq_template,
const rb_insn_func_t *func,
- const struct iseq_insn_info_entry *insn_info_table,
+ const struct iseq_line_info_entry *line_info_table,
const char **local_table,
const VALUE *arg_opt_table,
const struct iseq_catch_table_entry *catch_table,
const char *name,
- const char *filename,
- const unsigned short line_no)
+ const char *path,
+ const unsigned short first_lineno)
{
unsigned long i;
VALUE iseqval = iseq_alloc(rb_cISeq);
@@ -1459,12 +2084,11 @@ rb_iseq_build_for_ruby2cext(
GetISeqPtr(iseqval, iseq);
/* copy iseq */
- *iseq = *iseq_template;
- iseq->name = rb_str_new2(name);
- iseq->filename = rb_str_new2(filename);
- iseq->line_no = line_no;
- iseq->mark_ary = rb_ary_tmp_new(3);
- OBJ_UNTRUST(iseq->mark_ary);
+ MEMCPY(iseq, iseq_template, rb_iseq_t, 1); /* TODO: write barrier, *iseq = *iseq_template; */
+ OBJ_WRITE(iseq->self, &iseq->location.label, rb_str_new2(name));
+ OBJ_WRITE(iseq->self, &iseq->location.path, rb_str_new2(path));
+ iseq->location.first_lineno = first_lineno;
+ OBJ_WRITE(iseq->self, &iseq->mark_ary, 0);
iseq->self = iseqval;
iseq->iseq = ALLOC_N(VALUE, iseq->iseq_size);
@@ -1483,8 +2107,8 @@ rb_iseq_build_for_ruby2cext(
} \
} while (0)
- ALLOC_AND_COPY(iseq->insn_info_table, insn_info_table,
- struct iseq_insn_info_entry, iseq->insn_info_size);
+ 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);
@@ -1497,6 +2121,148 @@ rb_iseq_build_for_ruby2cext(
return iseqval;
}
+/* Experimental tracing support: trace(line) -> trace(specified_line)
+ * MRI Specific.
+ */
+
+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;
+ rb_iseq_t *iseq;
+ int cont = 1;
+ GetISeqPtr(iseqval, iseq);
+
+ for (pos = 0; cont && pos < iseq->iseq_size; pos += insn_len(insn)) {
+ insn = iseq->iseq[pos];
+
+ if (insn == BIN(trace)) {
+ rb_event_flag_t current_events = (VALUE)iseq->iseq[pos+1];
+
+ if (current_events & RUBY_EVENT_LINE) {
+ rb_event_flag_t events = current_events & RUBY_EVENT_SPECIFIED_LINE;
+ trace_num++;
+
+ if (func) {
+ int line = find_line_no(iseq, pos);
+ /* printf("line: %d\n", line); */
+ cont = (*func)(line, &events, data);
+ if (current_events != events) {
+ iseq->iseq[pos+1] = iseq->iseq_encoded[pos+1] =
+ (VALUE)(current_events | (events & RUBY_EVENT_SPECIFIED_LINE));
+ }
+ }
+ }
+ }
+ }
+ return trace_num;
+}
+
+static int
+collect_trace(int line, rb_event_flag_t *events_ptr, void *ptr)
+{
+ VALUE result = (VALUE)ptr;
+ rb_ary_push(result, INT2NUM(line));
+ return 1;
+}
+
+/*
+ * <b>Experimental MRI specific feature, only available as C level api.</b>
+ *
+ * Returns all +specified_line+ events.
+ */
+VALUE
+rb_iseq_line_trace_all(VALUE iseqval)
+{
+ VALUE result = rb_ary_new();
+ rb_iseq_line_trace_each(iseqval, collect_trace, (void *)result);
+ return result;
+}
+
+struct set_specifc_data {
+ int pos;
+ int set;
+ int prev; /* 1: set, 2: unset, 0: not found */
+};
+
+static int
+line_trace_specify(int line, rb_event_flag_t *events_ptr, void *ptr)
+{
+ struct set_specifc_data *data = (struct set_specifc_data *)ptr;
+
+ if (data->pos == 0) {
+ data->prev = *events_ptr & RUBY_EVENT_SPECIFIED_LINE ? 1 : 2;
+ if (data->set) {
+ *events_ptr = *events_ptr | RUBY_EVENT_SPECIFIED_LINE;
+ }
+ else {
+ *events_ptr = *events_ptr & ~RUBY_EVENT_SPECIFIED_LINE;
+ }
+ return 0; /* found */
+ }
+ else {
+ data->pos--;
+ return 1;
+ }
+}
+
+/*
+ * <b>Experimental MRI specific feature, only available as C level api.</b>
+ *
+ * Set a +specified_line+ event at the given line position, if the +set+
+ * parameter is +true+.
+ *
+ * This method is useful for building a debugger breakpoint at a specific line.
+ *
+ * A TypeError is raised if +set+ is not boolean.
+ *
+ * If +pos+ is a negative integer a TypeError exception is raised.
+ */
+VALUE
+rb_iseq_line_trace_specify(VALUE iseqval, VALUE pos, VALUE set)
+{
+ struct set_specifc_data data;
+
+ data.prev = 0;
+ data.pos = NUM2INT(pos);
+ if (data.pos < 0) rb_raise(rb_eTypeError, "`pos' is negative");
+
+ switch (set) {
+ case Qtrue: data.set = 1; break;
+ case Qfalse: data.set = 0; break;
+ default:
+ rb_raise(rb_eTypeError, "`set' should be true/false");
+ }
+
+ rb_iseq_line_trace_each(iseqval, line_trace_specify, (void *)&data);
+
+ if (data.prev == 0) {
+ rb_raise(rb_eTypeError, "`pos' is out of range.");
+ }
+ return data.prev == 1 ? Qtrue : Qfalse;
+}
+
+/*
+ * Document-class: RubyVM::InstructionSequence
+ *
+ * The InstructionSequence class represents a compiled sequence of
+ * instructions for the Ruby Virtual Machine.
+ *
+ * With it, you can get a handle to the instructions that make up a method or
+ * a proc, compile strings of Ruby code down to VM instructions, and
+ * disassemble instruction sequences to strings for easy inspection. It is
+ * mostly useful if you want to learn how the Ruby VM works, but it also lets
+ * you control various settings for the Ruby iseq compiler.
+ *
+ * You can find the source for the VM instructions in +insns.def+ in the Ruby
+ * source.
+ *
+ * The instruction sequence results will almost certainly change as Ruby
+ * changes, so example output in this documentation may be different from what
+ * you see.
+ */
+
void
Init_ISeq(void)
{
@@ -1509,9 +2275,26 @@ Init_ISeq(void)
rb_define_method(rb_cISeq, "to_a", iseq_to_a, 0);
rb_define_method(rb_cISeq, "eval", iseq_eval, 0);
+ /* location APIs */
+ rb_define_method(rb_cISeq, "path", rb_iseq_path, 0);
+ rb_define_method(rb_cISeq, "absolute_path", rb_iseq_absolute_path, 0);
+ rb_define_method(rb_cISeq, "label", rb_iseq_label, 0);
+ rb_define_method(rb_cISeq, "base_label", rb_iseq_base_label, 0);
+ rb_define_method(rb_cISeq, "first_lineno", rb_iseq_first_lineno, 0);
+
+#if 0
+ /* Now, it is experimental. No discussions, no tests. */
+ /* They can be used from C level. Please give us feedback. */
+ rb_define_method(rb_cISeq, "line_trace_all", rb_iseq_line_trace_all, 0);
+ rb_define_method(rb_cISeq, "line_trace_specify", rb_iseq_line_trace_specify, 2);
+#else
+ (void)rb_iseq_line_trace_all;
+ (void)rb_iseq_line_trace_specify;
+#endif
+
#if 0 /* TBD */
- rb_define_method(rb_cISeq, "marshal_dump", iseq_marshal_dump, 0);
- rb_define_method(rb_cISeq, "marshal_load", iseq_marshal_load, 1);
+ rb_define_private_method(rb_cISeq, "marshal_dump", iseq_marshal_dump, 0);
+ rb_define_private_method(rb_cISeq, "marshal_load", iseq_marshal_load, 1);
#endif
/* disable this feature because there is no verifier. */
@@ -1525,5 +2308,5 @@ Init_ISeq(void)
rb_define_singleton_method(rb_cISeq, "compile_option=", iseq_s_compile_option_set, 1);
rb_define_singleton_method(rb_cISeq, "disasm", iseq_s_disasm, 1);
rb_define_singleton_method(rb_cISeq, "disassemble", iseq_s_disasm, 1);
+ rb_define_singleton_method(rb_cISeq, "of", iseq_s_of, 1);
}
-
diff --git a/iseq.h b/iseq.h
index d07e98bd43..5487d86f7b 100644
--- a/iseq.h
+++ b/iseq.h
@@ -12,9 +12,7 @@
#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);
@@ -23,9 +21,15 @@ VALUE rb_iseq_build_from_ary(rb_iseq_t *iseq, VALUE locals, VALUE args,
VALUE exception, VALUE body);
/* iseq.c */
+void rb_iseq_add_mark_object(rb_iseq_t *iseq, VALUE obj);
VALUE rb_iseq_load(VALUE data, VALUE parent, VALUE opt);
VALUE rb_iseq_parameters(const rb_iseq_t *iseq, int is_proc);
struct st_table *ruby_insn_make_insn_table(void);
+unsigned int rb_iseq_line_no(const rb_iseq_t *iseq, size_t pos);
+
+int rb_iseq_line_trace_each(VALUE iseqval, int (*func)(int line, rb_event_flag_t *events_ptr, void *d), void *data);
+VALUE rb_iseq_line_trace_all(VALUE iseqval);
+VALUE rb_iseq_line_trace_specify(VALUE iseqval, VALUE pos, VALUE set);
/* proc.c */
rb_iseq_t *rb_method_get_iseq(VALUE body);
@@ -43,20 +47,19 @@ struct rb_compile_option_struct {
int debug_level;
};
-struct iseq_insn_info_entry {
- unsigned short position;
- unsigned short line_no;
- unsigned short sp;
+struct iseq_line_info_entry {
+ unsigned int position;
+ unsigned int line_no;
};
struct iseq_catch_table_entry {
enum catch_type {
- CATCH_TYPE_RESCUE,
- CATCH_TYPE_ENSURE,
- CATCH_TYPE_RETRY,
- CATCH_TYPE_BREAK,
- CATCH_TYPE_REDO,
- CATCH_TYPE_NEXT
+ CATCH_TYPE_RESCUE = INT2FIX(1),
+ CATCH_TYPE_ENSURE = INT2FIX(2),
+ CATCH_TYPE_RETRY = INT2FIX(3),
+ CATCH_TYPE_BREAK = INT2FIX(4),
+ CATCH_TYPE_REDO = INT2FIX(5),
+ CATCH_TYPE_NEXT = INT2FIX(6)
} type;
VALUE iseq;
unsigned long start;
@@ -76,9 +79,9 @@ struct iseq_compile_data_storage {
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;
@@ -105,22 +108,29 @@ struct iseq_compile_data {
/* defined? */
enum defined_type {
- DEFINED_IVAR = 1,
- DEFINED_IVAR2,
+ DEFINED_NIL = 1,
+ DEFINED_IVAR,
+ DEFINED_LVAR,
DEFINED_GVAR,
DEFINED_CVAR,
DEFINED_CONST,
DEFINED_METHOD,
DEFINED_YIELD,
- DEFINED_REF,
DEFINED_ZSUPER,
+ DEFINED_SELF,
+ DEFINED_TRUE,
+ DEFINED_FALSE,
+ DEFINED_ASGN,
+ DEFINED_EXPR,
+ DEFINED_IVAR2,
+ DEFINED_REF,
DEFINED_FUNC
};
+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 4fd53c5ec6..32769fb18b 100644
--- a/lib/English.rb
+++ b/lib/English.rb
@@ -15,7 +15,37 @@
# $OUTPUT_FIELD_SEPARATOR = ' -- '
# "waterbuffalo" =~ /buff/
# print $LOADED_FEATURES, $POSTMATCH, $PID, "\n"
-
+#
+# Below is a full list of descriptive aliases and their associated global
+# variable:
+#
+# $ERROR_INFO:: $!
+# $ERROR_POSITION:: $@
+# $FS:: $;
+# $FIELD_SEPARATOR:: $;
+# $OFS:: $,
+# $OUTPUT_FIELD_SEPARATOR:: $,
+# $RS:: $/
+# $INPUT_RECORD_SEPARATOR:: $/
+# $ORS:: $\
+# $OUTPUT_RECORD_SEPARATOR:: $\
+# $INPUT_LINE_NUMBER:: $.
+# $NR:: $.
+# $LAST_READ_LINE:: $_
+# $DEFAULT_OUTPUT:: $>
+# $DEFAULT_INPUT:: $<
+# $PID:: $$
+# $PROCESS_ID:: $$
+# $CHILD_STATUS:: $?
+# $LAST_MATCH_INFO:: $~
+# $IGNORECASE:: $=
+# $ARGV:: $*
+# $MATCH:: $&
+# $PREMATCH:: $`
+# $POSTMATCH:: $'
+# $LAST_PAREN_MATCH:: $+
+#
+module English end if false
# The exception object passed to +raise+.
alias $ERROR_INFO $!
@@ -119,7 +149,7 @@ alias $CHILD_STATUS $?
# and <tt>$1</tt> to <tt>$9</tt> are all derived from
# <tt>$~</tt>. Assigning to <tt>$~</tt> changes the values of these
# derived variables. This variable is local to the current
-# scope. Thread local.
+# scope.
alias $LAST_MATCH_INFO $~
# If set to any value apart from +nil+ or +false+, all pattern matches
@@ -135,21 +165,21 @@ alias $ARGV $*
# The string matched by the last successful pattern
# match. This variable is local to the current
-# scope. Read only. Thread local.
+# scope. Read only.
alias $MATCH $&
# The string preceding the match in the last
# successful pattern match. This variable is local to
-# the current scope. Read only. Thread local.
+# the current scope. Read only.
alias $PREMATCH $`
# The string following the match in the last
# successful pattern match. This variable is local to
-# the current scope. Read only. Thread local.
+# the current scope. Read only.
alias $POSTMATCH $'
# The contents of the highest-numbered group matched in the last
# successful pattern match. Thus, in <tt>"cat" =~ /(c|a)(t|z)/</tt>,
# <tt>$+</tt> will be set to "t". This variable is local to the
-# current scope. Read only. Thread local.
+# current scope. Read only.
alias $LAST_PAREN_MATCH $+
diff --git a/lib/README b/lib/README
deleted file mode 100644
index cfe7145307..0000000000
--- a/lib/README
+++ /dev/null
@@ -1,91 +0,0 @@
-English.rb lets Perl'ish global variables have English names
-README this file
-abbrev.rb abbreviation calculator
-base64.rb Base64 de- and encoder
-benchmark.rb a benchmark utility
-cgi.rb CGI support library
-cgi/session.rb CGI session class
-cmath.rb math support for complex numbers
-complex.rb includes cmath and set complex arithemtic as default (obsolete)
-csv.rb CSV parser/generator
-debug.rb ruby debugger
-delegate.rb delegates messages to other object
-drb.rb distributed Ruby
-e2mmap.rb exception utilities
-erb.rb tiny eRuby library
-fileutils.rb file utilities
-find.rb traverses directory tree
-forwardable.rb explicit delegation library
-gauntlet_rubygems.rb Gem package validator
-getoptlong.rb GNU getoptlong compatible
-gserver.rb general TCP server
-ipaddr.rb defines the IPAddr class
-irb.rb interactive ruby
-logger.rb simple logging utility
-mathn.rb extended math operation (obsolete)
-matrix.rb matrix calculation library
-minitest/unit minimal drop-in replacement for test-unit
-mkmf.rb Makefile maker
-monitor.rb exclusive region monitor for thread
-mutex_m.rb mutex mixin
-net/ftp.rb ftp access
-net/http.rb HTTP access
-net/https.rb HTTPS access
-net/imap.rb IMAP4 access
-net/pop.rb POP3 access
-net/protocol.rb abstract class for net library (DO NOT USE)
-net/smtp.rb SMTP access
-net/telnet.rb telnet library
-observer.rb observer desing pattern library (provides Observable)
-open-uri.rb easy-to-use network interface using URI and Net
-open3.rb opens subprocess connection stdin/stdout/stderr
-optparse.rb command line option analysis
-ostruct.rb python style object
-pathname.rb Object-Oriented Pathname Class
-pp.rb pretty print objects
-prettyprint.rb pretty printing algorithm
-prime.rb prime numbers and factorization
-profile.rb runs ruby profiler
-profiler.rb ruby profiler module
-pstore.rb persistent object strage using marshal
-racc/parser.rb racc (Ruby yACC) runtime
-rake.rb Ruby Make
-rational.rb rational number support (obsolete)
-rdoc source-code documentation tool
-resolv-replace.rb replace Socket DNS by resolve.rb
-resolv.rb DNS resolver in Ruby
-rexml an XML parser for Ruby, in Ruby
-rinda/rinda.rb Linda distributed computing paradigm for drb
-rinda/ring.rb RingServer for tuplespace
-rinda/tuplespace.rb tuplespace for drb
-rss.rb RSS parser/generator
-rubygems Ruby package management system
-scanf.rb scanf for Ruby
-securerandom.rb Secure random number generator interface
-set.rb defines the Set class
-shell.rb runs commands and does pipeline operations like shell
-shellwords.rb split into words like shell
-singleton.rb singleton design pattern library
-sync.rb 2 phase lock
-tempfile.rb temporary file with automatic removal
-test/unit Ruby Unit Testing Framework
-thread.rb thread support
-thwait.rb thread syncronization class
-time.rb RFC2822, RFC2616, ISO8601 style time formatting/parsing
-timeout.rb provides timeout
-tmpdir.rb retrieve temporary directory path
-tracer.rb execution tracer
-tsort.rb topological sorting
-ubygems.rb command line shortcut for RubyGems
-un.rb Utilities to replace common UNIX commands in Makefiles etc
-uri.rb URI support
-uri/ftp.rb ftp scheme support
-uri/http.rb http scheme support
-uri/https.rb https scheme support
-uri/ldap.rb ldap scheme support
-uri/ldaps.rb ldaps scheme support
-uri/mailto.rb mailto scheme support
-weakref.rb weak reference class
-webrick.rb WEB server toolkit
-xmlrpc XML-RPC implementation
-yaml.rb YAML implementation
diff --git a/lib/abbrev.rb b/lib/abbrev.rb
index aa7e33a65d..841f6d980e 100644..100755
--- a/lib/abbrev.rb
+++ b/lib/abbrev.rb
@@ -10,48 +10,72 @@
# $Id$
#++
-# Calculate the set of unique abbreviations for a given set of strings.
+##
+# Calculates the set of unique abbreviations for a given set of strings.
#
# require 'abbrev'
# require 'pp'
#
-# pp Abbrev::abbrev(['ruby', 'rules']).sort
+# pp Abbrev.abbrev(['ruby', 'rules'])
#
-# <i>Generates:</i>
+# Generates:
#
-# [["rub", "ruby"],
-# ["ruby", "ruby"],
-# ["rul", "rules"],
-# ["rule", "rules"],
-# ["rules", "rules"]]
+# { "rub" => "ruby",
+# "ruby" => "ruby",
+# "rul" => "rules",
+# "rule" => "rules",
+# "rules" => "rules" }
#
-# Also adds an +abbrev+ method to class +Array+.
+# 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"}
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. Thus, given input of "car" and "cone", the keys pointing
- # to "car" would be "ca" and "car", while those pointing to "cone"
- # would be "co", "con", and "cone".
+ # 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
+ # "cone".
+ #
+ # require 'abbrev'
+ #
+ # Abbrev.abbrev(['car', 'cone'])
+ # #=> {"ca"=>"car", "con"=>"cone", "co"=>"cone", "car"=>"car", "cone"=>"cone"}
#
# The optional +pattern+ parameter is a pattern or a string. Only
- # those input strings matching the pattern, or begging the string,
- # are considered for inclusion in the output hash
-
+ # input strings that match the pattern or start with the string
+ # are included in the output hash.
+ #
+ # Abbrev.abbrev(%w{car box cone}, /b/)
+ # #=> {"bo"=>"box", "b"=>"box", "box"=>"box"}
def abbrev(words, pattern = nil)
table = {}
seen = Hash.new(0)
if pattern.is_a?(String)
- pattern = /^#{Regexp.quote(pattern)}/ # regard as a prefix
+ pattern = /\A#{Regexp.quote(pattern)}/ # regard as a prefix
end
words.each do |word|
- next if (abbrev = word).empty?
- while (len = abbrev.rindex(/[\w\W]\z/)) > 0
- abbrev = word[0,len]
+ next if word.empty?
+ word.size.downto(1) { |len|
+ abbrev = word[0...len]
next if pattern && pattern !~ abbrev
@@ -63,7 +87,7 @@ module Abbrev
else
break
end
- end
+ }
end
words.each do |word|
@@ -80,12 +104,22 @@ end
class Array
# Calculates the set of unambiguous abbreviations for the strings in
- # +self+. If passed a pattern or a string, only the strings matching
- # the pattern or starting with the string are considered.
+ # +self+.
+ #
+ # require 'abbrev'
+ # %w{ car cone }.abbrev
+ # #=> {"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.
+ #
+ # %w{ fast boat day }.abbrev(/^.a/)
+ # #=> {"fas"=>"fast", "fa"=>"fast", "da"=>"day",
+ # "fast"=>"fast", "day"=>"day"}
#
- # %w{ car cone }.abbrev #=> { "ca" => "car", "car" => "car",
- # "co" => "cone", "con" => cone",
- # "cone" => "cone" }
+ # See also Abbrev.abbrev
def abbrev(pattern = nil)
Abbrev::abbrev(self, pattern)
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 6a00da1359..81ca0bcede 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
-# <tt>"a"*1_000_000</tt>:
+# <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,26 +112,26 @@
# 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
- BENCHMARK_VERSION = "2002-04-25" #:nodoc"
+ BENCHMARK_VERSION = "2002-04-25" # :nodoc:
- # Invokes the block with a <tt>Benchmark::Report</tt> object, which
+ # Invokes the block with a Benchmark::Report object, which
# may be used to collect and report on the results of individual
- # benchmark tests. Reserves <i>label_width</i> leading spaces for
- # labels on each line. Prints _caption_ at the top of the
- # report, and uses _format_ to format each line.
+ # benchmark tests. Reserves +label_width+ leading spaces for
+ # labels on each line. Prints +caption+ at the top of the
+ # report, and uses +format+ to format each line.
# Returns an array of Benchmark::Tms objects.
#
# If the block returns an array of
- # <tt>Benchmark::Tms</tt> objects, these will be used to format
- # additional lines of output. If _label_ parameters are
+ # Benchmark::Tms objects, these will be used to format
+ # additional lines of output. If +label+ parameters are
# given, these are used to label these extra lines.
#
# _Note_: Other methods provide a simpler interface to this one, and are
@@ -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 }
@@ -153,14 +151,14 @@ module Benchmark
# [tf+tt+tu, (tf+tt+tu)/3]
# end
#
- # <i>Generates:</i>
+ # 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
@@ -169,7 +167,7 @@ module Benchmark
label_width ||= 0
label_width += 1
format ||= FORMAT
- print ' '*label_width + caption
+ print ' '*label_width + caption unless caption.empty?
report = Report.new(label_width, format)
results = yield(report)
Array === results and results.grep(Tms).each {|t|
@@ -181,24 +179,25 @@ module Benchmark
end
- # A simple interface to the #benchmark method, #bm is generates sequential reports
- # with labels. The parameters have the same meaning as for #benchmark.
+ # 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 }
# x.report("upto:") { 1.upto(n) do ; a = "1"; end }
# end
#
- # <i>Generates:</i>
+ # 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
@@ -211,7 +210,7 @@ module Benchmark
# that run later. #bmbm attempts to minimize this effect by running
# the tests twice, the first time as a rehearsal in order to get the
# runtime environment stable, the second time for
- # real. <tt>GC.start</tt> is executed before the start of each of
+ # real. GC.start is executed before the start of each of
# the real timings; the cost of this is not included in the
# timings. In reality, though, there's only so much that #bmbm can
# do, and the results are not guaranteed to be isolated from garbage
@@ -229,21 +228,21 @@ module Benchmark
# x.report("sort") { array.dup.sort }
# end
#
- # <i>Generates:</i>
+ # 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.
#
- def bmbm(width = 0, &blk) # :yield: job
+ def bmbm(width = 0) # :yield: job
job = Job.new(width)
yield(job)
width = job.width + 1
@@ -283,7 +282,7 @@ module Benchmark
t1.stime - t0.stime,
t1.cutime - t0.cutime,
t1.cstime - t0.cstime,
- r1.to_f - r0.to_f,
+ r1 - r0,
label)
end
@@ -307,8 +306,8 @@ module Benchmark
# Returns an initialized Job instance.
# Usually, one doesn't call this method directly, as new
# Job objects are created by the #bmbm method.
- # _width_ is a initial value for the label offset used in formatting;
- # the #bmbm method passes its _width_ argument to this constructor.
+ # +width+ is a initial value for the label offset used in formatting;
+ # the #bmbm method passes its +width+ argument to this constructor.
#
def initialize(width)
@width = width
@@ -345,7 +344,7 @@ module Benchmark
# Returns an initialized Report instance.
# Usually, one doesn't call this method directly, as new
# Report objects are created by the #benchmark and #bm methods.
- # _width_ and _format_ are the label offset and
+ # +width+ and +format+ are the label offset and
# format string used by Tms#format.
#
def initialize(width = 0, format = nil)
@@ -353,8 +352,8 @@ module Benchmark
end
#
- # Prints the _label_ and measured time for the block,
- # formatted by _format_. See Tms#format for the
+ # Prints the +label+ and measured time for the block,
+ # formatted by +format+. See Tms#format for the
# formatting rules.
#
def item(label = "", *format, &blk) # :yield:
@@ -399,7 +398,7 @@ module Benchmark
# Elapsed real time
attr_reader :real
- # Total time, that is _utime_ + _stime_ + _cutime_ + _cstime_
+ # Total time, that is +utime+ + +stime+ + +cutime+ + +cstime+
attr_reader :total
# Label
@@ -407,9 +406,9 @@ module Benchmark
#
# Returns an initialized Tms object which has
- # _utime_ as the user CPU time, _stime_ as the system CPU time,
- # _cutime_ as the children's user CPU time, _cstime_ as the children's
- # system CPU time, _real_ as the elapsed real time and _label_ as the label.
+ # +utime+ as the user CPU time, +stime+ as the system CPU time,
+ # +cutime+ as the children's user CPU time, +cstime+ as the children's
+ # system CPU time, +real+ as the elapsed real time and +label+ as the label.
#
def initialize(utime = 0.0, stime = 0.0, cutime = 0.0, cstime = 0.0, real = 0.0, label = nil)
@utime, @stime, @cutime, @cstime, @real, @label = utime, stime, cutime, cstime, real, label.to_s
@@ -418,7 +417,7 @@ module Benchmark
#
# Returns a new Tms object whose times are the sum of the times for this
- # Tms object, plus the time required to execute the code block (_blk_).
+ # Tms object, plus the time required to execute the code block (+blk+).
#
def add(&blk) # :yield:
self + Benchmark.measure(&blk)
@@ -484,13 +483,13 @@ module Benchmark
#
def format(format = nil, *args)
str = (format || FORMAT).dup
- str.gsub!(/(%[-+\.\d]*)n/) { "#{$1}s" % label }
- str.gsub!(/(%[-+\.\d]*)u/) { "#{$1}f" % utime }
- str.gsub!(/(%[-+\.\d]*)y/) { "#{$1}f" % stime }
- str.gsub!(/(%[-+\.\d]*)U/) { "#{$1}f" % cutime }
- str.gsub!(/(%[-+\.\d]*)Y/) { "#{$1}f" % cstime }
- str.gsub!(/(%[-+\.\d]*)t/) { "#{$1}f" % total }
- str.gsub!(/(%[-+\.\d]*)r/) { "(#{$1}f)" % real }
+ str.gsub!(/(%[-+.\d]*)n/) { "#{$1}s" % label }
+ str.gsub!(/(%[-+.\d]*)u/) { "#{$1}f" % utime }
+ str.gsub!(/(%[-+.\d]*)y/) { "#{$1}f" % stime }
+ str.gsub!(/(%[-+.\d]*)U/) { "#{$1}f" % cutime }
+ str.gsub!(/(%[-+.\d]*)Y/) { "#{$1}f" % cstime }
+ str.gsub!(/(%[-+.\d]*)t/) { "#{$1}f" % total }
+ str.gsub!(/(%[-+.\d]*)r/) { "(#{$1}f)" % real }
format ? str % args : str
end
@@ -512,7 +511,7 @@ module Benchmark
end
protected
-
+
#
# Returns a new Tms object obtained by memberwise operation +op+
# of the individual times for this Tms object with those of the other
@@ -553,7 +552,7 @@ if __FILE__ == $0
n = ARGV[0].to_i.nonzero? || 50000
puts %Q([#{n} times iterations of `a = "1"'])
- benchmark(" " + CAPTION, 7, FORMAT) do |x|
+ 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}
diff --git a/lib/cgi.rb b/lib/cgi.rb
index 31730bd60c..15676eab5f 100644
--- a/lib/cgi.rb
+++ b/lib/cgi.rb
@@ -122,7 +122,7 @@ raise "Please, use ruby 1.9.0 or later." if RUBY_VERSION < "1.9.0"
#
# The simplest way to send output to the HTTP client is using the #out() method.
# This takes the HTTP headers as a hash parameter, and the body content
-# via a block. The headers can be generated as a string using the #header()
+# via a block. The headers can be generated as a string using the #http_header()
# method. The output stream can be written directly to using the #print()
# method.
#
@@ -143,6 +143,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 +164,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
#
@@ -234,22 +239,26 @@ raise "Please, use ruby 1.9.0 or later." if RUBY_VERSION < "1.9.0"
# === Print http header and html string to $DEFAULT_OUTPUT ($>)
#
# require "cgi"
-# cgi = CGI.new("html3") # add HTML generation methods
-# cgi.out() do
-# cgi.html() do
-# cgi.head{ cgi.title{"TITLE"} } +
-# cgi.body() do
-# cgi.form() do
-# cgi.textarea("get_text") +
-# cgi.br +
-# cgi.submit
+# cgi = CGI.new("html4") # add HTML generation methods
+# cgi.out do
+# cgi.html do
+# cgi.head do
+# cgi.title { "TITLE" }
+# end +
+# cgi.body do
+# cgi.form("ACTION" => "uri") do
+# cgi.p do
+# cgi.textarea("get_text") +
+# cgi.br +
+# cgi.submit
+# end
# end +
-# cgi.pre() do
+# cgi.pre do
# CGI::escapeHTML(
-# "params: " + cgi.params.inspect + "\n" +
-# "cookies: " + cgi.cookies.inspect + "\n" +
-# ENV.collect() do |key, value|
-# key + " --> " + value + "\n"
+# "params: #{cgi.params.inspect}\n" +
+# "cookies: #{cgi.cookies.inspect}\n" +
+# ENV.collect do |key, value|
+# "#{key} --> #{value}\n"
# end.join("")
# )
# end
@@ -262,6 +271,21 @@ raise "Please, use ruby 1.9.0 or later." if RUBY_VERSION < "1.9.0"
# CGI.new("html4") # html4.01 (Strict)
# CGI.new("html4Tr") # html4.01 Transitional
# 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
diff --git a/lib/cgi/cookie.rb b/lib/cgi/cookie.rb
index c2526931d5..3ec884dffb 100644
--- a/lib/cgi/cookie.rb
+++ b/lib/cgi/cookie.rb
@@ -1,5 +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
@@ -8,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
@@ -34,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.
#
@@ -124,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
@@ -133,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 e961b16474..662e04c9b7 100644
--- a/lib/cgi/core.rb
+++ b/lib/cgi/core.rb
@@ -67,8 +67,8 @@ class CGI
# Create an HTTP header block as a string.
#
# :call-seq:
- # headers(content_type_string="text/html")
- # headers(headers_hash)
+ # http_header(content_type_string="text/html")
+ # http_header(headers_hash)
#
# Includes the empty line that ends the header block.
#
@@ -127,29 +127,29 @@ class CGI
#
# Examples:
#
- # header
+ # http_header
# # Content-Type: text/html
#
- # header("text/plain")
+ # http_header("text/plain")
# # Content-Type: text/plain
#
- # header("nph" => true,
- # "status" => "OK", # == "200 OK"
- # # "status" => "200 GOOD",
- # "server" => ENV['SERVER_SOFTWARE'],
- # "connection" => "close",
- # "type" => "text/html",
- # "charset" => "iso-2022-jp",
- # # Content-Type: text/html; charset=iso-2022-jp
- # "length" => 103,
- # "language" => "ja",
- # "expires" => Time.now + 30,
- # "cookie" => [cookie1, cookie2],
- # "my_header1" => "my_value"
- # "my_header2" => "my_value")
+ # http_header("nph" => true,
+ # "status" => "OK", # == "200 OK"
+ # # "status" => "200 GOOD",
+ # "server" => ENV['SERVER_SOFTWARE'],
+ # "connection" => "close",
+ # "type" => "text/html",
+ # "charset" => "iso-2022-jp",
+ # # Content-Type: text/html; charset=iso-2022-jp
+ # "length" => 103,
+ # "language" => "ja",
+ # "expires" => Time.now + 30,
+ # "cookie" => [cookie1, cookie2],
+ # "my_header1" => "my_value"
+ # "my_header2" => "my_value")
#
# This method does not perform charset conversion.
- def header(options='text/html')
+ def http_header(options='text/html')
if options.is_a?(String)
content_type = options
buf = _header_for_string(content_type)
@@ -170,7 +170,15 @@ class CGI
buf << EOL # empty line of separator
return buf
end
- end # header()
+ end # http_header()
+
+ # This method is an alias for #http_header, when HTML5 tag maker is inactive.
+ #
+ # NOTE: use #http_header to create HTTP header blocks, this alias is only
+ # provided for backwards compatibility.
+ #
+ # Using #header with the HTML5 tag maker will create a <header> element.
+ alias :header :http_header
def _header_for_string(content_type) #:nodoc:
buf = ''
@@ -230,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
@@ -283,7 +291,7 @@ class CGI
# +content_type_string+::
# If a string is passed, it is assumed to be the content type.
# +headers_hash+::
- # This is a Hash of headers, similar to that used by #header.
+ # This is a Hash of headers, similar to that used by #http_header.
# +block+::
# A block is required and should evaluate to the body of the response.
#
@@ -344,7 +352,7 @@ class CGI
options["length"] = content.bytesize.to_s
output = stdoutput
output.binmode if defined? output.binmode
- output.print header(options)
+ output.print http_header(options)
output.print content unless "HEAD" == env_table['REQUEST_METHOD']
end
@@ -367,12 +375,13 @@ class CGI
params = {}
query.split(/[&;]/).each do |pairs|
key, value = pairs.split('=',2).collect{|v| CGI::unescape(v) }
- if key && value
- params.has_key?(key) ? params[key].push(value) : params[key] = [value]
- elsif key
- params[key]=[]
- end
+
+ next unless key
+
+ params[key] ||= []
+ params[key].push(value) if value
end
+
params.default=[].freeze
params
end
@@ -452,10 +461,10 @@ class CGI
end
##
- # Parses multipart form elements according to
+ # Parses multipart form elements according to
# http://www.w3.org/TR/html401/interact/forms.html#h-17.13.4.2
#
- # Returns a hash of multipart form parameters with bodies of type StringIO or
+ # Returns a hash of multipart form parameters with bodies of type StringIO or
# Tempfile depending on whether the multipart form element exceeds 10 KB
#
# params[name => body]
@@ -478,10 +487,12 @@ class CGI
bufsize = 10 * 1024
max_count = MAX_MULTIPART_COUNT
n = 0
+ tempfiles = []
while true
(n += 1) < max_count or raise StandardError.new("too many parameters.")
## create body (StringIO or Tempfile)
body = create_body(bufsize < content_length)
+ tempfiles << body if defined?(Tempfile) && body.kind_of?(Tempfile)
class << body
if method_defined?(:path)
alias local_path path
@@ -529,16 +540,17 @@ class CGI
/Content-Disposition:.* filename=(?:"(.*?)"|([^;\r\n]*))/i.match(head)
filename = $1 || $2 || ''
filename = CGI.unescape(filename) if unescape_filename?()
- body.instance_variable_set('@original_filename', filename.taint)
+ body.instance_variable_set(:@original_filename, filename.taint)
## content type
/Content-Type: (.*)/i.match(head)
(content_type = $1 || '').chomp!
- body.instance_variable_set('@content_type', content_type.taint)
+ body.instance_variable_set(:@content_type, content_type.taint)
## query parameter name
/Content-Disposition:.* name=(?:"(.*?)"|([^;\r\n]*))/i.match(head)
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)
(params[name] ||= []) << value
unless value.valid_encoding?
if @accept_charset_error_block
@@ -562,19 +574,27 @@ class CGI
raise EOFError, "bad boundary end of body part" unless boundary_end =~ /--/
params.default = []
params
+ ensure
+ if $! && tempfiles
+ tempfiles.each {|t|
+ if t.path
+ t.unlink
+ end
+ }
+ end
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
@@ -681,9 +701,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
@@ -770,6 +790,7 @@ class CGI
# "html4":: HTML 4.0
# "html4Tr":: HTML 4.0 Transitional
# "html4Fr":: HTML 4.0 with Framesets
+ # "html5":: HTML 5
#
# <tt>block</tt>::
# If provided, the block is called when an invalid encoding is
@@ -787,7 +808,7 @@ class CGI
# cookies and other parameters are parsed automatically from the standard
# CGI locations, which varies according to the REQUEST_METHOD.
def initialize(options = {}, &block) # :yields: name, value
- @accept_charset_error_block=block if block_given?
+ @accept_charset_error_block = block_given? ? block : nil
@options={:accept_charset=>@@accept_charset}
case options
when Hash
@@ -811,24 +832,23 @@ 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
extend HtmlExtension
end
end
diff --git a/lib/cgi/html.rb b/lib/cgi/html.rb
index 04e2431735..4c4f698a2b 100644
--- a/lib/cgi/html.rb
+++ b/lib/cgi/html.rb
@@ -8,63 +8,70 @@ 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,
# cgi.a("http://www.example.com") { "Example" }
# # => "<A HREF=\"http://www.example.com\">Example</A>"
#
- # Modules Http3, Http4, etc., contain more basic HTML-generation methods
- # (:title, :center, etc.).
+ # Modules Html3, Html4, etc., contain more basic HTML-generation methods
+ # (+#title+, +#h1+, etc.).
#
# See class CGI for a detailed 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
@@ -334,7 +325,7 @@ class CGI
body = ""
end
if @output_hidden
- body += @output_hidden.collect{|k,v|
+ body << @output_hidden.collect{|k,v|
"<INPUT TYPE=\"HIDDEN\" NAME=\"#{k}\" VALUE=\"#{v}\">"
}.join
end
@@ -420,19 +411,15 @@ class CGI
if attributes.has_key?("DOCTYPE")
if attributes["DOCTYPE"]
- buf += attributes.delete("DOCTYPE")
+ buf << attributes.delete("DOCTYPE")
else
attributes.delete("DOCTYPE")
end
else
- buf += doctype
+ 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,49 +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
- 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
+ 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
+ for element in %w[ HTML HEAD BODY P PLAINTEXT DT DD LI OPTION TR
+ TH TD ]
+ define_method(element.downcase, m)
end
- eval(methods)
end
end # Html3
@@ -886,6 +858,7 @@ 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
@@ -893,41 +866,30 @@ class CGI
end
# Initialise the HTML generation methods for this version.
- def element_init
- extend TagMaker
- methods = ""
- # - -
+ # - -
+ 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
+ COLGROUP TR TH TD HEAD ]
+ define_method(element.downcase, m)
end
- eval(methods)
end
end # Html4
@@ -935,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
@@ -942,43 +905,32 @@ class CGI
end
# Initialise the HTML generation methods for this version.
- def element_init
- extend TagMaker
- 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
@@ -986,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
@@ -993,29 +946,89 @@ class CGI
end
# Initialise the HTML generation methods for this version.
- def element_init
- 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
-end
+ # Mixin module for HTML version 5 generation methods.
+ module Html5 # :nodoc:
+ include TagMaker
+
+ # The DOCTYPE declaration for this version of HTML
+ def doctype
+ %|<!DOCTYPE HTML>|
+ end
+
+ # Initialise the HTML generation methods for this version.
+ # - -
+ 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
+ SUMMARY MENU DIALOG I B SMALL EM STRONG DFN CODE SAMP KBD
+ VAR CITE ABBR SUB SUP SPAN BDO ADDRESS DIV MAP OBJECT
+ 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 ]
+ define_method(element.downcase, m)
+ end
+ end
+
+ # - 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 ]
+ define_method(element.downcase, m)
+ end
+ end
+
+ # 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 ]
+ define_method(element.downcase, m)
+ end
+ 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 42b5ead81a..606d5bc541 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,
@@ -308,7 +308,7 @@ class CGI
@data[key]
end
- # Set the session date for key +key+.
+ # Set the session data for key +key+.
def []=(key, val)
@write_lock ||= true
@data ||= @dbman.restore
@@ -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:
diff --git a/lib/cgi/util.rb b/lib/cgi/util.rb
index 2bb3b0da78..199e17bbbc 100644
--- a/lib/cgi/util.rb
+++ b/lib/cgi/util.rb
@@ -1,26 +1,29 @@
-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)
- string.gsub(/([^ a-zA-Z0-9_.-]+)/) do
- '%' + $1.unpack('H2' * $1.bytesize).join('%').upcase
- end.tr(' ', '+')
+ def escape(string)
+ encoding = string.encoding
+ 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
# The set of special characters and their escaped values
TABLE_FOR_ESCAPE_HTML__ = {
+ "'" => '&#39;',
'&' => '&amp;',
'"' => '&quot;',
'<' => '&lt;',
@@ -30,18 +33,20 @@ 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)
- string.gsub(/[&\"<>]/, TABLE_FOR_ESCAPE_HTML__)
+ 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)
- return string.gsub(Regexp.new('&(amp|quot|gt|lt|#[0-9]+|#x[0-9A-Fa-f]+);'.encode(enc))) do
- case $1.encode("US-ASCII")
+ 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(Encoding::US_ASCII)
+ when 'apos' then "'".encode(enc)
when 'amp' then '&'.encode(enc)
when 'quot' then '"'.encode(enc)
when 'gt' then '>'.encode(enc)
@@ -52,9 +57,10 @@ class CGI
end
end
asciicompat = Encoding.compatible?(string, "a")
- string.gsub(/&(amp|quot|gt|lt|\#[0-9]+|\#x[0-9A-Fa-f]+);/) do
+ string.gsub(/&(apos|amp|quot|gt|lt|\#[0-9]+|\#[xX][0-9A-Fa-f]+);/) do
match = $1.dup
case match
+ when 'apos' then "'"
when 'amp' then '&'
when 'quot' then '"'
when 'gt' then '>'
@@ -84,12 +90,12 @@ class CGI
end
# Synonym for CGI::escapeHTML(str)
- def CGI::escape_html(str)
+ def escape_html(str)
escapeHTML(str)
end
-
+
# Synonym for CGI::unescapeHTML(str)
- def CGI::unescape_html(str)
+ def unescape_html(str)
unescapeHTML(str)
end
@@ -106,7 +112,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
@@ -126,11 +132,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
@@ -138,12 +144,12 @@ class CGI
end
# Synonym for CGI::escapeElement(str)
- def CGI::escape_element(str)
+ def escape_element(str)
escapeElement(str)
end
-
+
# Synonym for CGI::unescapeElement(str)
- def CGI::unescape_element(str)
+ def unescape_element(str)
unescapeElement(str)
end
@@ -157,11 +163,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.
@@ -181,7 +187,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)
@@ -191,4 +197,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..337c2e063a 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.
#
diff --git a/lib/csv.rb b/lib/csv.rb
index 13f86ec318..804b941433 100644
--- a/lib/csv.rb
+++ b/lib/csv.rb
@@ -274,7 +274,7 @@ class CSV
# field( header, offset )
# field( index )
#
- # This method will fetch the field value by +header+ or +index+. If a field
+ # 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
@@ -293,6 +293,42 @@ class CSV
#
# :call-seq:
+ # fetch( header )
+ # fetch( header ) { |row| ... }
+ # fetch( header, default )
+ #
+ # This method will fetch the field value by +header+. It has the same
+ # behavior as Hash#fetch: if there is a field with the given +header+, its
+ # value is returned. Otherwise, if a block is given, it is yielded the
+ # +header+ and its result is returned; if a +default+ is given as the
+ # second argument, it is returned; otherwise a KeyError is raised.
+ #
+ def fetch(header, *varargs)
+ raise ArgumentError, "Too many arguments" if varargs.length > 1
+ pair = @row.assoc(header)
+ if pair
+ pair.last
+ else
+ if block_given?
+ yield header
+ elsif varargs.empty?
+ raise KeyError, "key not found: #{header}"
+ else
+ varargs.first
+ end
+ end
+ end
+
+ # Returns +true+ if there is a field with the given +header+.
+ def has_key?(header)
+ !!@row.assoc(header)
+ end
+ alias_method :include?, :has_key?
+ alias_method :key?, :has_key?
+ alias_method :member?, :has_key?
+
+ #
+ # :call-seq:
# []=( header, value )
# []=( header, offset, value )
# []=( index, value )
@@ -475,7 +511,8 @@ class CSV
# same order as +other+.
#
def ==(other)
- @row == other.row
+ return @row == other.row if other.is_a? CSV::Row
+ @row == other
end
#
@@ -973,6 +1010,7 @@ class CSV
# <b><tt>:header_converters</tt></b>:: +nil+
# <b><tt>:skip_blanks</tt></b>:: +false+
# <b><tt>:force_quotes</tt></b>:: +false+
+ # <b><tt>:skip_lines</tt></b>:: +nil+
#
DEFAULT_OPTIONS = { col_sep: ",",
row_sep: :auto,
@@ -984,7 +1022,8 @@ class CSV
return_headers: false,
header_converters: nil,
skip_blanks: false,
- force_quotes: false }.freeze
+ force_quotes: false,
+ skip_lines: nil }.freeze
#
# This method will return a CSV instance, just like CSV::new(), but the
@@ -1012,133 +1051,6 @@ class CSV
end
#
- # This method allows you to serialize an Array of Ruby objects to a String or
- # File of CSV data. This is not as powerful as Marshal or YAML, but perhaps
- # useful for spreadsheet and database interaction.
- #
- # Out of the box, this method is intended to work with simple data objects or
- # Structs. It will serialize a list of instance variables and/or
- # Struct.members().
- #
- # If you need need more complicated serialization, you can control the process
- # by adding methods to the class to be serialized.
- #
- # A class method csv_meta() is responsible for returning the first row of the
- # document (as an Array). This row is considered to be a Hash of the form
- # key_1,value_1,key_2,value_2,... CSV::load() expects to find a class key
- # with a value of the stringified class name and CSV::dump() will create this,
- # if you do not define this method. This method is only called on the first
- # object of the Array.
- #
- # The next method you can provide is an instance method called csv_headers().
- # This method is expected to return the second line of the document (again as
- # an Array), which is to be used to give each column a header. By default,
- # CSV::load() will set an instance variable if the field header starts with an
- # @ character or call send() passing the header as the method name and
- # the field value as an argument. This method is only called on the first
- # object of the Array.
- #
- # Finally, you can provide an instance method called csv_dump(), which will
- # be passed the headers. This should return an Array of fields that can be
- # serialized for this object. This method is called once for every object in
- # the Array.
- #
- # The +io+ parameter can be used to serialize to a File, and +options+ can be
- # anything CSV::new() accepts.
- #
- def self.dump(ary_of_objs, io = "", options = Hash.new)
- obj_template = ary_of_objs.first
-
- csv = new(io, options)
-
- # write meta information
- begin
- csv << obj_template.class.csv_meta
- rescue NoMethodError
- csv << [:class, obj_template.class]
- end
-
- # write headers
- begin
- headers = obj_template.csv_headers
- rescue NoMethodError
- headers = obj_template.instance_variables.sort
- if obj_template.class.ancestors.find { |cls| cls.to_s =~ /\AStruct\b/ }
- headers += obj_template.members.map { |mem| "#{mem}=" }.sort
- end
- end
- csv << headers
-
- # serialize each object
- ary_of_objs.each do |obj|
- begin
- csv << obj.csv_dump(headers)
- rescue NoMethodError
- csv << headers.map do |var|
- if var[0] == ?@
- obj.instance_variable_get(var)
- else
- obj[var[0..-2]]
- end
- end
- end
- end
-
- if io.is_a? String
- csv.string
- else
- csv.close
- end
- end
-
- #
- # This method is the reading counterpart to CSV::dump(). See that method for
- # a detailed description of the process.
- #
- # You can customize loading by adding a class method called csv_load() which
- # will be passed a Hash of meta information, an Array of headers, and an Array
- # of fields for the object the method is expected to return.
- #
- # Remember that all fields will be Strings after this load. If you need
- # something else, use +options+ to setup converters or provide a custom
- # csv_load() implementation.
- #
- def self.load(io_or_str, options = Hash.new)
- csv = new(io_or_str, options)
-
- # load meta information
- meta = Hash[*csv.shift]
- cls = meta["class".encode(csv.encoding)].split("::".encode(csv.encoding)).
- inject(Object) do |c, const|
- c.const_get(const)
- end
-
- # load headers
- headers = csv.shift
-
- # unserialize each object stored in the file
- results = csv.inject(Array.new) do |all, row|
- begin
- obj = cls.csv_load(meta, headers, row)
- rescue NoMethodError
- obj = cls.allocate
- headers.zip(row) do |name, value|
- if name[0] == ?@
- obj.instance_variable_set(name, value)
- else
- obj.send(name, value)
- end
- end
- end
- all << obj
- end
-
- csv.close unless io_or_str.is_a? String
-
- results
- end
-
- #
# :call-seq:
# filter( options = Hash.new ) { |row| ... }
# filter( input, options = Hash.new ) { |row| ... }
@@ -1204,6 +1116,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
@@ -1387,8 +1300,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.
#
@@ -1554,6 +1467,14 @@ class CSV
# skip over any rows with no content.
# <b><tt>:force_quotes</tt></b>:: When set to a +true+ value, CSV will
# quote all CSV fields it creates.
+ # <b><tt>:skip_lines</tt></b>:: When set to an object responding to
+ # <tt>match</tt>, every line matching
+ # it is considered a comment and ignored
+ # during parsing. When set to +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.
#
@@ -1591,6 +1512,7 @@ class CSV
init_parsers(options)
init_converters(options)
init_headers(options)
+ init_comments(options)
options.delete(:encoding)
options.delete(:internal_encoding)
@@ -1620,6 +1542,10 @@ class CSV
attr_reader :quote_char
# The limit for field size, if any. See CSV::new for details.
attr_reader :field_size_limit
+
+ # The regex marking a line as a comment. See CSV::new for details
+ attr_reader :skip_lines
+
#
# Returns the current list of converters in effect. See CSV::new for details.
# Built-in converters will be returned by name, while others will be returned
@@ -1730,7 +1656,7 @@ class CSV
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.set_encoding(compatible_encoding)
@io.seek(0, IO::SEEK_END)
end
@io << output
@@ -1873,6 +1799,8 @@ class CSV
end
end
+ next if @skip_lines and @skip_lines.match parse
+
parts = parse.split(@col_sep, -1)
if parts.empty?
if in_extended_col
@@ -2189,6 +2117,17 @@ class CSV
init_converters(options, :header_converters)
end
+ # Stores the pattern of comments to skip from the provided options.
+ #
+ # The pattern must respond to +.match+, else ArgumentError is raised.
+ #
+ # See also CSV.new
+ def init_comments(options)
+ @skip_lines = options.delete(:skip_lines)
+ if @skip_lines and not @skip_lines.respond_to?(:match)
+ raise ArgumentError, ":skip_lines has to respond to matches"
+ end
+ end
#
# The actual work method for adding converters, used by both CSV.convert() and
# CSV.header_convert().
@@ -2319,8 +2258,8 @@ class CSV
private
- #
- # Returns the encoding of the internal IO object or the +default+ if the
+ #
+ # Returns the encoding of the internal IO object or the +default+ if the
# encoding cannot be determined.
#
def raw_encoding(default = Encoding::ASCII_8BIT)
@@ -2336,20 +2275,41 @@ class CSV
end
end
-# Another name for CSV::instance().
+# Passes +args+ to CSV::instance.
+#
+# CSV("CSV,data").read
+# #=> [["CSV", "data"]]
+#
+# If a block is given, the instance is passed the block and the return value
+# becomes the return value of the block.
+#
+# CSV("CSV,data") { |c|
+# c.read.any? { |a| a.include?("data") }
+# } #=> true
+#
+# CSV("CSV,data") { |c|
+# c.read.any? { |a| a.include?("zombies") }
+# } #=> false
+#
def CSV(*args, &block)
CSV.instance(*args, &block)
end
-class Array
- # Equivalent to <tt>CSV::generate_line(self, options)</tt>.
+class Array # :nodoc:
+ # Equivalent to CSV::generate_line(self, options)
+ #
+ # ["CSV", "data"].to_csv
+ # #=> "CSV,data\n"
def to_csv(options = Hash.new)
CSV.generate_line(self, options)
end
end
-class String
- # Equivalent to <tt>CSV::parse_line(self, options)</tt>.
+class String # :nodoc:
+ # Equivalent to CSV::parse_line(self, options)
+ #
+ # "CSV,data".parse_csv
+ # #=> ["CSV", "data"]
def parse_csv(options = Hash.new)
CSV.parse_line(self, options)
end
diff --git a/lib/debug.rb b/lib/debug.rb
index e99f69826a..67861cba64 100644
--- a/lib/debug.rb
+++ b/lib/debug.rb
@@ -12,18 +12,178 @@ end
require 'tracer'
require 'pp'
-class Tracer
+class Tracer # :nodoc:
def Tracer.trace_func(*vars)
Single.trace_func(*vars)
end
end
-SCRIPT_LINES__ = {} unless defined? SCRIPT_LINES__
+SCRIPT_LINES__ = {} unless defined? SCRIPT_LINES__ # :nodoc:
+
+##
+# This library provides debugging functionality to Ruby.
+#
+# To add a debugger to your code, start by requiring +debug+ in your
+# program:
+#
+# def say(word)
+# require 'debug'
+# puts word
+# end
+#
+# This will cause Ruby to interrupt execution and show a prompt when the +say+
+# method is run.
+#
+# Once you're inside the prompt, you can start debugging your program.
+#
+# (rdb:1) p word
+# "hello"
+#
+# == Getting help
+#
+# You can get help at any time by pressing +h+.
+#
+# (rdb:1) h
+# Debugger help v.-0.002b
+# Commands
+# b[reak] [file:|class:]<line|method>
+# b[reak] [class.]<line|method>
+# set breakpoint to some position
+# wat[ch] <expression> set watchpoint to some expression
+# cat[ch] (<exception>|off) set catchpoint to an exception
+# b[reak] list breakpoints
+# cat[ch] show catchpoint
+# del[ete][ nnn] delete some or all breakpoints
+# disp[lay] <expression> add expression into display expression list
+# undisp[lay][ nnn] delete one particular or all display expressions
+# c[ont] run until program ends or hit breakpoint
+# s[tep][ nnn] step (into methods) one line or till line nnn
+# n[ext][ nnn] go over one line or till line nnn
+# w[here] display frames
+# f[rame] alias for where
+# l[ist][ (-|nn-mm)] list program, - lists backwards
+# nn-mm lists given lines
+# up[ nn] move to higher frame
+# down[ nn] move to lower frame
+# fin[ish] return to outer frame
+# tr[ace] (on|off) set trace mode of current thread
+# tr[ace] (on|off) all set trace mode of all threads
+# q[uit] exit from debugger
+# v[ar] g[lobal] show global variables
+# v[ar] l[ocal] show local variables
+# v[ar] i[nstance] <object> show instance variables of object
+# v[ar] c[onst] <object> show constants of object
+# m[ethod] i[nstance] <obj> show methods of object
+# m[ethod] <class|module> show instance methods of class or module
+# th[read] l[ist] list all threads
+# th[read] c[ur[rent]] show current thread
+# th[read] [sw[itch]] <nnn> switch thread context to nnn
+# th[read] stop <nnn> stop thread nnn
+# th[read] resume <nnn> resume thread nnn
+# p expression evaluate expression and print its value
+# h[elp] print this help
+# <everything else> evaluate
+#
+# == Usage
+#
+# The following is a list of common functionalities that the debugger
+# provides.
+#
+# === Navigating through your code
+#
+# In general, a debugger is used to find bugs in your program, which
+# often means pausing execution and inspecting variables at some point
+# in time.
+#
+# Let's look at an example:
+#
+# def my_method(foo)
+# require 'debug'
+# foo = get_foo if foo.nil?
+# raise if foo.nil?
+# end
+#
+# When you run this program, the debugger will kick in just before the
+# +foo+ assignment.
+#
+# (rdb:1) p foo
+# nil
+#
+# In this example, it'd be interesting to move to the next line and
+# inspect the value of +foo+ again. You can do that by pressing +n+:
+#
+# (rdb:1) n # goes to next line
+# (rdb:1) p foo
+# nil
+#
+# You now know that the original value of +foo+ was nil, and that it
+# still was nil after calling +get_foo+.
+#
+# Other useful commands for navigating through your code are:
+#
+# +c+::
+# Runs the program until it either exists or encounters another breakpoint.
+# You usually press +c+ when you are finished debugging your program and
+# want to resume its execution.
+# +s+::
+# Steps into method definition. In the previous example, +s+ would take you
+# inside the method definition of +get_foo+.
+# +r+::
+# Restart the program.
+# +q+::
+# Quit the program.
+#
+# === Inspecting variables
+#
+# You can use the debugger to easily inspect both local and global variables.
+# We've seen how to inspect local variables before:
+#
+# (rdb:1) p my_arg
+# 42
+#
+# You can also pretty print the result of variables or expressions:
+#
+# (rdb:1) pp %w{a very long long array containing many words}
+# ["a",
+# "very",
+# "long",
+# ...
+# ]
+#
+# You can list all local variables with +v l+:
+#
+# (rdb:1) v l
+# foo => "hello"
+#
+# Similarly, you can show all global variables with +v g+:
+#
+# (rdb:1) v g
+# all global variables
+#
+# Finally, you can omit +p+ if you simply want to evaluate a variable or
+# expression
+#
+# (rdb:1) 5**2
+# 25
+#
+# === Going beyond basics
+#
+# Ruby Debug provides more advanced functionalities like switching
+# between threads, setting breakpoints and watch expressions, and more.
+# The full list of commands is available at any time by pressing +h+.
+#
+# == Staying out of trouble
+#
+# Make sure you remove every instance of +require 'debug'+ before
+# shipping your code. Failing to do so may result in your program
+# hanging unpredictably.
+#
+# Debug is not available in safe mode.
class DEBUGGER__
- MUTEX = Mutex.new
+ MUTEX = Mutex.new # :nodoc:
- class Context
+ class Context # :nodoc:
DEBUG_LAST_CMD = []
begin
@@ -545,7 +705,9 @@ Commands
th[read] [sw[itch]] <nnn> switch thread context to nnn
th[read] stop <nnn> stop thread nnn
th[read] resume <nnn> resume thread nnn
+ pp expression evaluate expression and pretty_print its value
p expression evaluate expression and print its value
+ r[estart] restart program
h[elp] print this help
<everything else> evaluate
EOHELP
@@ -590,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
@@ -608,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"
@@ -729,22 +897,34 @@ EOHELP
@stdout = STDOUT
class << DEBUGGER__
+ # Returns the IO used as stdout. Defaults to STDOUT
def stdout
@stdout
end
+ # Sets the IO used as stdout. Defaults to STDOUT
def stdout=(s)
@stdout = s
end
+ # Returns the display expression list
+ #
+ # See DEBUGGER__ for more usage
def display
@display
end
+ # Returns the list of break points where execution will be stopped.
+ #
+ # See DEBUGGER__ for more useage
def break_points
@break_points
end
+ # Returns the list of waiting threads.
+ #
+ # When stepping through the traces of a function, thread gets suspended, to
+ # be resumed later.
def waiting
@waiting
end
diff --git a/lib/delegate.rb b/lib/delegate.rb
index 2086a721f9..0eaf37122b 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__raise__\z/ =~ m
+ next
+ end
+ undef_method m
+ end
end
include kernel
@@ -69,9 +76,15 @@ class Delegator < BasicObject
def method_missing(m, *args, &block)
target = self.__getobj__
begin
- target.respond_to?(m) ? target.__send__(m, *args, &block) : super(m, *args, &block)
+ if target.respond_to?(m)
+ target.__send__(m, *args, &block)
+ elsif ::Kernel.respond_to?(m, true)
+ ::Kernel.instance_method(m).bind(self).(*args, &block)
+ else
+ super(m, *args, &block)
+ end
ensure
- $@.delete_if {|t| %r"\A#{Regexp.quote(__FILE__)}:#{__LINE__-2}:"o =~ t} if $@
+ $@.delete_if {|t| %r"\A#{Regexp.quote(__FILE__)}:(?:#{[__LINE__-7, __LINE__-5, __LINE__-3].join('|')}):"o =~ t} if $@
end
end
@@ -92,8 +105,8 @@ class Delegator < BasicObject
# Returns the methods available to this delegate object as the union
# of this object's and \_\_getobj\_\_ methods.
#
- def methods
- __getobj__.methods | super
+ def methods(all=true)
+ __getobj__.methods(all) | super
end
#
@@ -130,6 +143,9 @@ class Delegator < BasicObject
__getobj__ != obj
end
+ #
+ # Delegates ! to the \_\_getobj\_\_
+ #
def !
!__getobj__
end
@@ -139,7 +155,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
#
@@ -147,7 +163,7 @@ class Delegator < BasicObject
# to _obj_.
#
def __setobj__(obj)
- raise NotImplementedError, "need to define `__setobj__'"
+ __raise__ ::NotImplementedError, "need to define `__setobj__'"
end
#
@@ -227,6 +243,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, 09, 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.
#
@@ -262,6 +306,7 @@ end
class SimpleDelegator<Delegator
# Returns the current object method calls are being delegated to.
def __getobj__
+ __raise__ ::ArgumentError, "not delegated" unless defined?(@delegate_sd_obj)
@delegate_sd_obj
end
@@ -280,13 +325,12 @@ 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
-# :stopdoc:
-def Delegator.delegating_block(mid)
+def Delegator.delegating_block(mid) # :nodoc:
lambda do |*args, &block|
target = self.__getobj__
begin
@@ -296,7 +340,6 @@ def Delegator.delegating_block(mid)
end
end
end
-# :startdoc:
#
# The primary interface to this library. Use to setup delegation when defining
@@ -338,10 +381,11 @@ def DelegateClass(superclass)
methods -= [:to_s,:inspect,:=~,:!~,:===]
klass.module_eval do
def __getobj__ # :nodoc:
+ __raise__ ::ArgumentError, "not delegated" unless defined?(@delegate_dc_obj)
@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|
diff --git a/lib/drb/drb.rb b/lib/drb/drb.rb
index 69456b1db2..97965228bb 100644
--- a/lib/drb/drb.rb
+++ b/lib/drb/drb.rb
@@ -34,17 +34,11 @@
# [http://www2a.biglobe.ne.jp/~seki/ruby/druby.en.html]
# The English version of the dRuby home page.
#
-# [http://www.chadfowler.com/ruby/drb.html]
-# A quick tutorial introduction to using dRuby by Chad Fowler.
+# [http://pragprog.com/book/sidruby/the-druby-book]
+# The dRuby Book: Distributed and Parallel Computing with Ruby
+# by Masatoshi Seki and Makoto Inoue
#
-# [http://www.linux-mag.com/2002-09/ruby_05.html]
-# A tutorial introduction to dRuby in Linux Magazine by Dave Thomas.
-# Includes a discussion of Rinda.
-#
-# [http://www.eng.cse.dmu.ac.uk/~hgs/ruby/dRuby/]
-# Links to English-language Ruby material collected by Hugh Sasse.
-#
-# [http://www.rubycentral.com/book/ospace.html]
+# [http://www.ruby-doc.org/docs/ProgrammingRuby/html/ospace.html]
# The chapter from *Programming* *Ruby* by Dave Thomas and Andy Hunt
# which discusses dRuby.
#
@@ -237,7 +231,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]
@@ -432,6 +426,8 @@ module DRb
# An exception wrapping an error object
class DRbRemoteError < DRbError
+
+ # Creates a new remote error that wraps the Exception +error+
def initialize(error)
@reason = error.class.to_s
super("#{error.message} (#{error.class})")
@@ -511,7 +507,16 @@ module DRb
end
end
+ # An Array wrapper that can be sent to another server via DRb.
+ #
+ # All entries in the array will be dumped or be references that point to
+ # the local server.
+
class DRbArray
+
+ # Creates a new DRbArray that either dumps or wraps all the items in the
+ # Array +ary+ so they can be loaded by a remote DRb server.
+
def initialize(ary)
@ary = ary.collect { |obj|
if obj.kind_of? DRbUndumped
@@ -527,11 +532,11 @@ module DRb
}
end
- def self._load(s)
+ def self._load(s) # :nodoc:
Marshal::load(s)
end
- def _dump(lv)
+ def _dump(lv) # :nodoc:
Marshal.dump(@ary)
end
end
@@ -635,7 +640,7 @@ module DRb
end
private
- def make_proxy(obj, error=false)
+ def make_proxy(obj, error=false) # :nodoc:
if error
DRbRemoteError.new(obj)
else
@@ -799,10 +804,13 @@ module DRb
module_function :auto_load
end
- # The default drb protocol.
+ # The default drb protocol which communicates over a TCP socket.
#
- # Communicates over a TCP socket.
+ # The DRb TCP protocol URI looks like:
+ # <code>druby://<host>:<port>?<option></code>. The option is optional.
+
class DRbTCPSocket
+ # :stopdoc:
private
def self.parse_uri(uri)
if uri =~ /^druby:\/\/(.*?):(\d+)(\?(.*))?$/
@@ -818,7 +826,12 @@ module DRb
public
- # Open a client connection to +uri+ using configuration +config+.
+ # Open a client connection to +uri+ (DRb URI string) using configuration
+ # +config+.
+ #
+ # This can raise DRb::DRbBadScheme or DRb::DRbBadURI if +uri+ is not for a
+ # recognized protocol. See DRb::DRbServer.new for information on built-in
+ # URI protocols.
def self.open(uri, config)
host, port, = parse_uri(uri)
host.untaint
@@ -827,6 +840,7 @@ module DRb
self.new(uri, soc, config)
end
+ # Returns the hostname of this server
def self.getservername
host = Socket::gethostname
begin
@@ -836,6 +850,9 @@ module DRb
end
end
+ # For the families available for +host+, returns a TCPServer on +port+.
+ # If +port+ is 0 the first available port is used. IPv4 servers are
+ # preferred over IPv6 servers.
def self.open_server_inaddr_any(host, port)
infos = Socket::getaddrinfo(host, nil,
Socket::AF_UNSPEC,
@@ -846,6 +863,7 @@ module DRb
return TCPServer.open('0.0.0.0', port) if families.has_key?('AF_INET')
return TCPServer.open('::', port) if families.has_key?('AF_INET6')
return TCPServer.open(port)
+ # :stopdoc:
end
# Open a server listening for connections at +uri+ using
@@ -1014,10 +1032,13 @@ module DRb
self.new_with(uri, ref)
end
+ # Creates a DRb::DRbObject given the reference information to the remote
+ # host +uri+ and object +ref+.
+
def self.new_with(uri, ref)
it = self.allocate
- it.instance_variable_set('@uri', uri)
- it.instance_variable_set('@ref', ref)
+ it.instance_variable_set(:@uri, uri)
+ it.instance_variable_set(:@ref, ref)
it
end
@@ -1064,6 +1085,7 @@ module DRb
undef :to_s
undef :to_a if respond_to?(:to_a)
+ # Routes respond_to? to the referenced remote object.
def respond_to?(msg_id, priv=false)
case msg_id
when :_dump
@@ -1075,7 +1097,7 @@ module DRb
end
end
- # Routes method calls to the referenced object.
+ # Routes method calls to the referenced remote object.
def method_missing(msg_id, *a, &b)
if DRb.here?(@uri)
obj = DRb.to_obj(@ref)
@@ -1100,7 +1122,8 @@ module DRb
end
end
- def self.with_friend(uri)
+ # Given the +uri+ of another host executes the block provided.
+ def self.with_friend(uri) # :nodoc:
friend = DRb.fetch_server(uri)
return yield() unless friend
@@ -1111,7 +1134,9 @@ module DRb
Thread.current['DRb'] = save if friend
end
- def self.prepare_backtrace(uri, result)
+ # Returns a modified backtrace from +result+ with the +uri+ where each call
+ # in the backtrace came from.
+ def self.prepare_backtrace(uri, result) # :nodoc:
prefix = "(#{uri}) "
bt = []
result.backtrace.each do |x|
@@ -1242,9 +1267,9 @@ module DRb
@@load_limit = sz
end
- # Set the default value for the :acl option.
+ # Set the default access control list to +acl+. The default ACL is +nil+.
#
- # See #new(). The initial default value is nil.
+ # See also DRb::ACL and #new()
def self.default_acl(acl)
@@acl = acl
end
@@ -1256,6 +1281,9 @@ module DRb
@@idconv = idconv
end
+ # Set the default safe level to +level+. The default safe level is 0
+ #
+ # See #new for more information.
def self.default_safe_level(level)
@@safe_level = level
end
@@ -1313,6 +1341,9 @@ module DRb
# :argc_limit :: the maximum number of arguments to a remote
# method accepted by the server. Defaults to
# 256.
+ # :safe_level :: The safe level of the DRbServer. The attribute
+ # sets $SAFE for methods performed in the main_loop.
+ # Defaults to 0.
#
# The default values of these options can be modified on
# a class-wide basis by the class methods #default_argc_limit,
@@ -1372,6 +1403,10 @@ module DRb
# The configuration of this DRbServer
attr_reader :config
+ # The safe level for this server. This is a number corresponding to
+ # $SAFE.
+ #
+ # The default safe_level is 0
attr_reader :safe_level
# Set whether to operate in verbose mode.
@@ -1388,7 +1423,8 @@ module DRb
def alive?
@thread.alive?
end
-
+
+ # Is +uri+ the URI for this server?
def here?(uri)
@exported_uri.include?(uri)
end
@@ -1417,6 +1453,10 @@ module DRb
end
private
+
+ ##
+ # Starts the DRb main loop in a new thread.
+
def run
Thread.start do
begin
@@ -1726,7 +1766,10 @@ module DRb
end
module_function :thread
- # Set the default id conv object.
+ # Set the default id conversion object.
+ #
+ # This is expected to be an instance such as DRb::DRbIdConv that responds to
+ # #to_id and #to_obj that can convert objects to and from DRb references.
#
# See DRbServer#default_id_conv.
def install_id_conv(idconv)
@@ -1734,7 +1777,7 @@ module DRb
end
module_function :install_id_conv
- # Set the default acl.
+ # Set the default ACL to +acl+.
#
# See DRb::DRbServer.default_acl.
def install_acl(acl)
@@ -1743,12 +1786,24 @@ module DRb
module_function :install_acl
@mutex = Mutex.new
- def mutex
+ def mutex # :nodoc:
@mutex
end
module_function :mutex
@server = {}
+ # Registers +server+ with DRb.
+ #
+ # This is called when a new DRb::DRbServer is created.
+ #
+ # If there is no primary server then +server+ becomes the primary server.
+ #
+ # Example:
+ #
+ # require 'drb'
+ #
+ # s = DRb::DRbServer.new # automatically calls regist_server
+ # DRb.fetch_server s.uri #=> #<DRb::DRbServer:0x...>
def regist_server(server)
@server[server.uri] = server
mutex.synchronize do
@@ -1757,11 +1812,15 @@ module DRb
end
module_function :regist_server
+ # Removes +server+ from the list of registered servers.
def remove_server(server)
@server.delete(server.uri)
end
module_function :remove_server
+ # Retrieves the server with the given +uri+.
+ #
+ # See also regist_server and remove_server.
def fetch_server(uri)
@server[uri]
end
diff --git a/lib/drb/eq.rb b/lib/drb/eq.rb
index 6328c81202..553f30c598 100644
--- a/lib/drb/eq.rb
+++ b/lib/drb/eq.rb
@@ -1,5 +1,5 @@
module DRb
- class DRbObject
+ class DRbObject # :nodoc:
def ==(other)
return false unless DRbObject === other
(@ref == other.__drbref) && (@uri == other.__drburi)
diff --git a/lib/drb/extserv.rb b/lib/drb/extserv.rb
index bb11211cd1..c70ced877c 100644
--- a/lib/drb/extserv.rb
+++ b/lib/drb/extserv.rb
@@ -42,6 +42,8 @@ module DRb
end
end
+# :stopdoc:
+
if __FILE__ == $0
class Foo
include DRbUndumped
diff --git a/lib/drb/gw.rb b/lib/drb/gw.rb
index b7a5f5383f..b3568ab08d 100644
--- a/lib/drb/gw.rb
+++ b/lib/drb/gw.rb
@@ -2,8 +2,36 @@ require 'drb/drb'
require 'monitor'
module DRb
+
+ # Gateway id conversion forms a gateway between different DRb protocols or
+ # networks.
+ #
+ # The gateway needs to install this id conversion and create servers for
+ # each of the protocols or networks it will be a gateway between. It then
+ # needs to create a server that attaches to each of these networks. For
+ # example:
+ #
+ # require 'drb/drb'
+ # require 'drb/unix'
+ # require 'drb/gw'
+ #
+ # DRb.install_id_conv DRb::GWIdConv.new
+ # gw = DRb::GW.new
+ # s1 = DRb::DRbServer.new 'drbunix:/path/to/gateway', gw
+ # s2 = DRb::DRbServer.new 'druby://example:10000', gw
+ #
+ # s1.thread.join
+ # s2.thread.join
+ #
+ # Each client must register services with the gateway, for example:
+ #
+ # DRb.start_service 'drbunix:', nil # an anonymous server
+ # gw = DRbObject.new nil, 'drbunix:/path/to/gateway'
+ # gw[:unix] = some_service
+ # DRb.thread.join
+
class GWIdConv < DRbIdConv
- def to_obj(ref)
+ def to_obj(ref) # :nodoc:
if Array === ref && ref[0] == :DRbObject
return DRbObject.new_with(ref[1], ref[2])
end
@@ -11,19 +39,29 @@ module DRb
end
end
+ # The GW provides a synchronized store for participants in the gateway to
+ # communicate.
+
class GW
include MonitorMixin
+
+ # Creates a new GW
+
def initialize
super()
@hash = {}
end
+ # Retrieves +key+ from the GW
+
def [](key)
synchronize do
@hash[key]
end
end
+ # Stores value +v+ at +key+ in the GW
+
def []=(key, v)
synchronize do
@hash[key] = v
@@ -31,7 +69,7 @@ module DRb
end
end
- class DRbObject
+ class DRbObject # :nodoc:
def self._load(s)
uri, ref = Marshal.load(s)
if DRb.uri == uri
diff --git a/lib/drb/invokemethod.rb b/lib/drb/invokemethod.rb
index 353dbd00d8..71ebec11f6 100644
--- a/lib/drb/invokemethod.rb
+++ b/lib/drb/invokemethod.rb
@@ -1,6 +1,6 @@
# for ruby-1.8.0
-module DRb
+module DRb # :nodoc: all
class DRbServer
module InvokeMethod18Mixin
def block_yield(x)
diff --git a/lib/drb/observer.rb b/lib/drb/observer.rb
index 149426db7b..cab9ebc60b 100644
--- a/lib/drb/observer.rb
+++ b/lib/drb/observer.rb
@@ -1,9 +1,12 @@
require 'observer'
module DRb
+ # The Observable module extended to DRb. See Observable for details.
module DRbObservable
include Observable
+ # Notifies observers of a change in state. See also
+ # Observable#notify_observers
def notify_observers(*arg)
if defined? @observer_state and @observer_state
if defined? @observer_peers
diff --git a/lib/drb/ssl.rb b/lib/drb/ssl.rb
index 2b6a2376ef..8651702797 100644
--- a/lib/drb/ssl.rb
+++ b/lib/drb/ssl.rb
@@ -5,16 +5,31 @@ require 'singleton'
module DRb
+ # The protocol for DRb over an SSL socket
+ #
+ # The URI for a DRb socket over SSL is:
+ # <code>drbssl://<host>:<port>?<option></code>. The option is optional
class DRbSSLSocket < DRbTCPSocket
+ # SSLConfig handles the needed SSL information for establishing a
+ # DRbSSLSocket connection, including generating the X509 / RSA pair.
+ #
+ # An instance of this config can be passed to DRbSSLSocket.new,
+ # DRbSSLSocket.open and DRbSSLSocket.open_server
+ #
+ # See DRb::DRbSSLSocket::SSLConfig.new for more details
class SSLConfig
+ # Default values for a SSLConfig instance.
+ #
+ # See DRb::DRbSSLSocket::SSLConfig.new for more details
DEFAULT = {
:SSLCertificate => nil,
:SSLPrivateKey => nil,
:SSLClientCA => nil,
:SSLCACertificatePath => nil,
:SSLCACertificateFile => nil,
+ :SSLTmpDhCallback => nil,
:SSLVerifyMode => ::OpenSSL::SSL::VERIFY_NONE,
:SSLVerifyDepth => nil,
:SSLVerifyCallback => nil, # custom verification
@@ -24,6 +39,90 @@ module DRb
:SSLCertComment => "Generated by Ruby/OpenSSL"
}
+ # 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
+ # configuration. If want it to generate a generic certificate, the bare
+ # minimum is to provide the :SSLCertName
+ #
+ # === Config options
+ #
+ # From +config+ Hash:
+ #
+ # :SSLCertificate ::
+ # An instance of OpenSSL::X509::Certificate. If this is not provided,
+ # then a generic X509 is generated, with a correspond :SSLPrivateKey
+ #
+ # :SSLPrivateKey ::
+ # A private key instance, like OpenSSL::PKey::RSA. This key must be
+ # the key that signed the :SSLCertificate
+ #
+ # :SSLClientCA ::
+ # An OpenSSL::X509::Certificate, or Array of certificates that will
+ # used as ClientCAs in the SSL Context
+ #
+ # :SSLCACertificatePath ::
+ # A path to the directory of CA certificates. The certificates must
+ # be in PEM format.
+ #
+ # :SSLCACertificateFile ::
+ # A path to a CA certificate file, in PEM format.
+ #
+ # :SSLTmpDhCallback ::
+ # A DH callback. See OpenSSL::SSL::SSLContext.tmp_dh_callback
+ #
+ # :SSLVerifyMode ::
+ # This is the SSL verification mode. See OpenSSL::SSL::VERIFY_* for
+ # available modes. The default is OpenSSL::SSL::VERIFY_NONE
+ #
+ # :SSLVerifyDepth ::
+ # Number of CA certificates to walk, when verifying a certificate
+ # chain.
+ #
+ # :SSLVerifyCallback ::
+ # A callback to be used for additional verification. See
+ # OpenSSL::SSL::SSLContext.verify_callback
+ #
+ # :SSLCertificateStore ::
+ # A OpenSSL::X509::Store used for verification of certificates
+ #
+ # :SSLCertName ::
+ # Issuer name for the certificate. This is required when generating
+ # the certificate (if :SSLCertificate and :SSLPrivateKey were not
+ # given). The value of this is to be an Array of pairs:
+ #
+ # [["C", "Raleigh"], ["ST","North Carolina"],
+ # ["CN","fqdn.example.com"]]
+ #
+ # See also OpenSSL::X509::Name
+ #
+ # :SSLCertComment ::
+ # A comment to be used for generating the certificate. The default is
+ # "Generated by Ruby/OpenSSL"
+ #
+ #
+ # === Example
+ #
+ # These values can be added after the fact, like a Hash.
+ #
+ # require 'drb/ssl'
+ # c = DRb::DRbSSLSocket::SSLConfig.new {}
+ # c[:SSLCertificate] =
+ # OpenSSL::X509::Certificate.new(File.read('mycert.crt'))
+ # c[:SSLPrivateKey] = OpenSSL::PKey::RSA.new(File.read('mycert.key'))
+ # c[:SSLVerifyMode] = OpenSSL::SSL::VERIFY_PEER
+ # c[:SSLCACertificatePath] = "/etc/ssl/certs/"
+ # c.setup_certificate
+ #
+ # or
+ #
+ # require 'drb/ssl'
+ # c = DRb::DRbSSLSocket::SSLConfig.new({
+ # :SSLCertName => [["CN" => DRb::DRbSSLSocket.getservername]]
+ # })
+ # c.setup_certificate
+ #
def initialize(config)
@config = config
@cert = config[:SSLCertificate]
@@ -31,10 +130,13 @@ module DRb
@ssl_ctx = nil
end
+ # A convenience method to access the values like a Hash
def [](key);
@config[key] || DEFAULT[key]
end
+ # Connect to IO +tcp+, with context of the current certificate
+ # configuration
def connect(tcp)
ssl = ::OpenSSL::SSL::SSLSocket.new(tcp, @ssl_ctx)
ssl.sync = true
@@ -42,6 +144,8 @@ module DRb
ssl
end
+ # Accept connection to IO +tcp+, with context of the current certificate
+ # configuration
def accept(tcp)
ssl = OpenSSL::SSL::SSLSocket.new(tcp, @ssl_ctx)
ssl.sync = true
@@ -49,6 +153,9 @@ module DRb
ssl
end
+ # Ensures that :SSLCertificate and :SSLPrivateKey have been provided
+ # or that a new certificate is generated with the other parameters
+ # provided.
def setup_certificate
if @cert && @pkey
return
@@ -94,6 +201,8 @@ module DRb
@pkey = rsa
end
+ # Establish the OpenSSL::SSL::SSLContext with the configuration
+ # parameters provided.
def setup_ssl_context
ctx = ::OpenSSL::SSL::SSLContext.new
ctx.cert = @cert
@@ -101,6 +210,7 @@ module DRb
ctx.client_ca = self[:SSLClientCA]
ctx.ca_path = self[:SSLCACertificatePath]
ctx.ca_file = self[:SSLCACertificateFile]
+ ctx.tmp_dh_callback = self[:SSLTmpDhCallback]
ctx.verify_mode = self[:SSLVerifyMode]
ctx.verify_depth = self[:SSLVerifyDepth]
ctx.verify_callback = self[:SSLVerifyCallback]
@@ -109,7 +219,12 @@ module DRb
end
end
- def self.parse_uri(uri)
+ # Parse the dRuby +uri+ for an SSL connection.
+ #
+ # Expects drbssl://...
+ #
+ # Raises DRbBadScheme or DRbBadURI if +uri+ is not matching or malformed
+ def self.parse_uri(uri) # :nodoc:
if uri =~ /^drbssl:\/\/(.*?):(\d+)(\?(.*))?$/
host = $1
port = $2.to_i
@@ -121,6 +236,15 @@ module DRb
end
end
+ # Return an DRb::DRbSSLSocket instance as a client-side connection,
+ # with the SSL connected. This is called from DRb::start_service or while
+ # connecting to a remote object:
+ #
+ # DRb.start_service 'drbssl://localhost:0', front, config
+ #
+ # +uri+ is the URI we are connected to,
+ # <code>'drbssl://localhost:0'</code> above, +config+ is our
+ # configuration. Either a Hash or DRb::DRbSSLSocket::SSLConfig
def self.open(uri, config)
host, port, = parse_uri(uri)
host.untaint
@@ -132,6 +256,15 @@ module DRb
self.new(uri, ssl, ssl_conf, true)
end
+ # Returns a DRb::DRbSSLSocket instance as a server-side connection, with
+ # the SSL connected. This is called from DRb::start_service or while
+ # connecting to a remote object:
+ #
+ # DRb.start_service 'drbssl://localhost:0', front, config
+ #
+ # +uri+ is the URI we are connected to,
+ # <code>'drbssl://localhost:0'</code> above, +config+ is our
+ # configuration. Either a Hash or DRb::DRbSSLSocket::SSLConfig
def self.open_server(uri, config)
uri = 'drbssl://:0' unless uri
host, port, = parse_uri(uri)
@@ -150,19 +283,35 @@ module DRb
self.new(@uri, soc, ssl_conf, false)
end
- def self.uri_option(uri, config)
+ # This is a convenience method to parse +uri+ and separate out any
+ # additional options appended in the +uri+.
+ #
+ # Returns an option-less uri and the option => [uri,option]
+ #
+ # The +config+ is completely unused, so passing nil is sufficient.
+ def self.uri_option(uri, config) # :nodoc:
host, port, option = parse_uri(uri)
return "drbssl://#{host}:#{port}", option
end
+ # Create a DRb::DRbSSLSocket instance.
+ #
+ # +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
+ #
+ # This is called automatically based on the DRb protocol.
def initialize(uri, soc, config, is_established)
@ssl = is_established ? soc : nil
super(uri, soc.to_io, config)
end
- def stream; @ssl; end
+ # Returns the SSL stream
+ def stream; @ssl; end # :nodoc:
- def close
+ # Closes the SSL stream before closing the dRuby connection.
+ def close # :nodoc:
if @ssl
@ssl.close
@ssl = nil
@@ -170,7 +319,7 @@ module DRb
super
end
- def accept
+ def accept # :nodoc:
begin
while true
soc = @socket.accept
diff --git a/lib/drb/timeridconv.rb b/lib/drb/timeridconv.rb
index b460e2c987..4ea3035f39 100644
--- a/lib/drb/timeridconv.rb
+++ b/lib/drb/timeridconv.rb
@@ -2,8 +2,17 @@ require 'drb/drb'
require 'monitor'
module DRb
+
+ # Timer id conversion keeps objects alive for a certain amount of time after
+ # their last access. The default time period is 600 seconds and can be
+ # changed upon initialization.
+ #
+ # To use TimerIdConv:
+ #
+ # DRb.install_id_conv TimerIdConv.new 60 # one minute
+
class TimerIdConv < DRbIdConv
- class TimerHolder2
+ class TimerHolder2 # :nodoc:
include MonitorMixin
class InvalidIndexError < RuntimeError; end
@@ -71,18 +80,19 @@ module DRb
end
end
+ # Creates a new TimerIdConv which will hold objects for +timeout+ seconds.
def initialize(timeout=600)
@holder = TimerHolder2.new(timeout)
end
- def to_obj(ref)
+ def to_obj(ref) # :nodoc:
return super if ref.nil?
@holder.fetch(ref)
rescue TimerHolder2::InvalidIndexError
raise "invalid reference"
end
- def to_id(obj)
+ def to_id(obj) # :nodoc:
return @holder.add(obj)
end
end
diff --git a/lib/drb/unix.rb b/lib/drb/unix.rb
index 6de5052451..4d245780a5 100644
--- a/lib/drb/unix.rb
+++ b/lib/drb/unix.rb
@@ -6,7 +6,13 @@ raise(LoadError, "UNIXServer is required") unless defined?(UNIXServer)
module DRb
+ # Implements DRb over a UNIX socket
+ #
+ # DRb UNIX socket URIs look like <code>drbunix:<path>?<option></code>. The
+ # option is optional.
+
class DRbUNIXSocket < DRbTCPSocket
+ # :stopdoc:
def self.parse_uri(uri)
if /^drbunix:(.*?)(\?(.*))?$/ =~ uri
filename = $1
@@ -105,4 +111,5 @@ module DRb
end
DRbProtocol.add_protocol(DRbUNIXSocket)
+ # :startdoc:
end
diff --git a/lib/e2mmap.rb b/lib/e2mmap.rb
index 18a7ca003d..3473a1c844 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..."
@@ -50,7 +54,7 @@
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
diff --git a/lib/erb.rb b/lib/erb.rb
index bb47943a86..5c89cb403e 100644
--- a/lib/erb.rb
+++ b/lib/erb.rb
@@ -1,3 +1,4 @@
+# -*- coding: us-ascii -*-
# = ERB -- Ruby Templating
#
# Author:: Masatoshi SEKI
@@ -10,6 +11,8 @@
#
# You can redistribute it and/or modify it under the same terms as Ruby.
+require "cgi/util"
+
#
# = ERB -- Ruby Templating
#
@@ -60,7 +63,7 @@
#
# == 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.
@@ -254,7 +257,7 @@
# Rails, the web application framework, uses ERB to create views.
#
class ERB
- Revision = '$Date:: $' #'
+ Revision = '$Date:: $' # :nodoc: #'
# Returns revision information for the erb.rb module.
def self.version
@@ -580,12 +583,20 @@ class ERB
end
end
+ def add_put_cmd(out, content)
+ out.push("#{@put_cmd} #{content_dump(content)}")
+ end
+
+ def add_insert_cmd(out, content)
+ out.push("#{@insert_cmd}((#{content}).to_s)")
+ end
+
# Compiles an ERB template into Ruby code. Returns an array of the code
# and encoding like ["code", Encoding].
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)
@@ -597,7 +608,7 @@ class ERB
if scanner.stag.nil?
case token
when PercentLine
- out.push("#{@put_cmd} #{content_dump(content)}") if content.size > 0
+ add_put_cmd(out, content) if content.size > 0
content = ''
out.push(token.to_s)
out.cr
@@ -605,11 +616,11 @@ class ERB
out.cr
when '<%', '<%=', '<%#'
scanner.stag = token
- out.push("#{@put_cmd} #{content_dump(content)}") if content.size > 0
+ add_put_cmd(out, content) if content.size > 0
content = ''
when "\n"
content << "\n"
- out.push("#{@put_cmd} #{content_dump(content)}")
+ add_put_cmd(out, content)
content = ''
when '<%%'
content << '<%'
@@ -629,7 +640,7 @@ class ERB
out.push(content)
end
when '<%='
- out.push("#{@insert_cmd}((#{content}).to_s)")
+ add_insert_cmd(out, content)
when '<%#'
# out.push("# #{content_dump(content)}")
end
@@ -642,7 +653,7 @@ class ERB
end
end
end
- out.push("#{@put_cmd} #{content_dump(content)}") if content.size > 0
+ add_put_cmd(out, content) if content.size > 0
out.close
return out.script, enc
end
@@ -675,7 +686,7 @@ class ERB
Scanner.make_scanner(src, @trim_mode, @percent)
end
- # Construct a new compiler using the trim_mode. See ERB#new for available
+ # Construct a new compiler using the trim_mode. See ERB::new for available
# trim modes.
def initialize(trim_mode)
@percent, @trim_mode = prepare_trim_mode(trim_mode)
@@ -729,6 +740,7 @@ class ERB
# % enables Ruby code processing for lines beginning with %
# <> omit newline for lines starting with <% and ending in %>
# > omit newline for lines ending in %>
+ # - omit blank lines ending in -%>
#
# _eoutvar_ can be used to set the name of the variable ERB will build up
# its output in. This is useful when you need to run multiple ERB
@@ -782,12 +794,19 @@ class ERB
#
def initialize(str, safe_level=nil, trim_mode=nil, eoutvar='_erbout')
@safe_level = safe_level
- compiler = ERB::Compiler.new(trim_mode)
+ compiler = make_compiler(trim_mode)
set_eoutvar(compiler, eoutvar)
@src, @enc = *compiler.compile(str)
@filename = nil
end
+ ##
+ # Creates a new compiler for ERB. See ERB::Compiler.new for details
+
+ def make_compiler(trim_mode)
+ ERB::Compiler.new(trim_mode)
+ end
+
# The Ruby code generated by ERB
attr_reader :src
@@ -796,39 +815,31 @@ class ERB
attr_accessor :filename
#
- # Can be used to set _eoutvar_ as described in ERB#new. It's probably easier
- # to just use the constructor though, since calling this method requires the
- # setup of an ERB _compiler_ object.
+ # Can be used to set _eoutvar_ as described in ERB::new. It's probably
+ # easier to just use the constructor though, since calling this method
+ # requires the setup of an ERB _compiler_ object.
#
def set_eoutvar(compiler, eoutvar = '_erbout')
compiler.put_cmd = "#{eoutvar}.concat"
compiler.insert_cmd = "#{eoutvar}.concat"
-
- cmd = []
- cmd.push "#{eoutvar} = ''"
-
- compiler.pre_cmd = cmd
-
- cmd = []
- cmd.push("#{eoutvar}.force_encoding(__ENCODING__)")
-
- compiler.post_cmd = cmd
+ compiler.pre_cmd = ["#{eoutvar} = ''"]
+ compiler.post_cmd = ["#{eoutvar}.force_encoding(__ENCODING__)"]
end
# Generate results and print them. (see ERB#result)
- def run(b=TOPLEVEL_BINDING)
+ def run(b=new_toplevel)
print self.result(b)
end
#
# Executes the generated ERB code to produce a completed template, returning
- # the results of that code. (See ERB#new for details on how this process can
- # be affected by _safe_level_.)
+ # 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
# code evaluation.
#
- def result(b=TOPLEVEL_BINDING)
+ def result(b=new_toplevel)
if @safe_level
proc {
$SAFE = @safe_level
@@ -839,7 +850,16 @@ class ERB
end
end
- # Define _methodname_ as instance method of _mod_ from compiled ruby source.
+ ##
+ # Returns a new binding each time *near* TOPLEVEL_BINDING for runs that do
+ # not specify a binding.
+
+ def new_toplevel
+ TOPLEVEL_BINDING.dup
+ end
+ private :new_toplevel
+
+ # Define _methodname_ as instance method of _mod_ from compiled Ruby source.
#
# example:
# filename = 'example.rhtml' # 'arg1' and 'arg2' are used in example.rhtml
@@ -909,7 +929,7 @@ class ERB
# is a &gt; 0 &amp; a &lt; 10?
#
def html_escape(s)
- s.to_s.gsub(/&/, "&amp;").gsub(/\"/, "&quot;").gsub(/>/, "&gt;").gsub(/</, "&lt;")
+ CGI.escapeHTML(s.to_s)
end
alias h html_escape
module_function :h
@@ -928,8 +948,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 ee396e35cb..26129c4204 100644
--- a/lib/fileutils.rb
+++ b/lib/fileutils.rb
@@ -118,7 +118,7 @@ module FileUtils
# FileUtils.cd('/') do # chdir
# [...] # do something
# end # return to original directory
- #
+ #
def cd(dir, options = {}, &block) # :yield: dir
fu_check_options options, OPT_TABLE['cd']
fu_output_message "cd #{dir}" if options[:verbose]
@@ -142,9 +142,7 @@ module FileUtils
# FileUtils.uptodate?('hello.o', %w(hello.c hello.h)) or \
# system 'make hello.o'
#
- def uptodate?(new, old_list, options = nil)
- raise ArgumentError, 'uptodate? does not accept any option' if options
-
+ def uptodate?(new, old_list)
return false unless File.exist?(new)
new_time = File.mtime(new)
old_list.each do |old|
@@ -156,6 +154,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
#
@@ -202,7 +205,7 @@ module FileUtils
fu_output_message "mkdir -p #{options[:mode] ? ('-m %03o ' % options[:mode]) : ''}#{list.join ' '}" if options[:verbose]
return *list if options[:noop]
- list.map {|path| 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]
@@ -239,7 +242,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
@@ -267,9 +270,10 @@ 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
@@ -363,7 +367,7 @@ module FileUtils
# Options: noop verbose
#
# Same as
- # #ln_s(src, dest, :force)
+ # #ln_s(src, dest, :force => true)
#
def ln_sf(src, dest, options = {})
fu_check_options options, OPT_TABLE['ln_sf']
@@ -413,7 +417,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'
#
@@ -424,7 +428,7 @@ module FileUtils
# # If you want to copy all contents of a directory instead of the
# # directory itself, c.f. src/x -> dest/x, src/y -> dest/y,
# # use following code.
- # FileUtils.cp_r 'src/.', 'dest' # cp_r('src', 'dest') makes src/dest,
+ # FileUtils.cp_r 'src/.', 'dest' # cp_r('src', 'dest') makes dest/src,
# # but this doesn't.
#
def cp_r(src, dest, options = {})
@@ -459,12 +463,14 @@ module FileUtils
# If +remove_destination+ is true, this method removes each destination file before copy.
#
def copy_entry(src, dest, preserve = false, dereference_root = false, remove_destination = false)
- Entry_.new(src, nil, dereference_root).traverse do |ent|
+ Entry_.new(src, nil, dereference_root).wrap_traverse(proc do |ent|
destent = Entry_.new(dest, ent.rel, false)
File.unlink destent.path if remove_destination && File.file?(destent.path)
ent.copy destent.path
+ end, proc do |ent|
+ destent = Entry_.new(dest, ent.rel, false)
ent.copy_metadata destent.path if preserve
- end
+ end)
end
module_function :copy_entry
@@ -747,7 +753,7 @@ module FileUtils
File.symlink nil, nil
rescue NotImplementedError
return false
- rescue
+ rescue TypeError
return true
end
private_module_function :fu_have_symlink?
@@ -823,16 +829,13 @@ module FileUtils
#
def compare_stream(a, b)
bsize = fu_stream_blksize(a, b)
- sa = sb = nil
- while sa == sb
- sa = a.read(bsize)
- sb = b.read(bsize)
- unless sa and sb
- if sa.nil? and sb.nil?
- return true
- end
- end
- end
+ sa = ""
+ sb = ""
+ begin
+ a.read(bsize, sa)
+ b.read(bsize, sb)
+ return true if sa.empty? && sb.empty?
+ end while sa == sb
false
end
module_function :compare_stream
@@ -865,62 +868,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
@@ -930,6 +949,11 @@ module FileUtils
end
private_module_function :fu_mode
+ def mode_to_s(mode) #:nodoc:
+ mode.is_a?(String) ? mode : "%o" % mode
+ end
+ private_module_function :mode_to_s
+
#
# Options: noop verbose
#
@@ -948,23 +972,25 @@ module FileUtils
# FileUtils.chmod "u=wr,go=rr", %w(my.rb your.rb his.rb her.rb)
# FileUtils.chmod "u=wrx,go=rx", '/usr/bin/ruby', :verbose => true
#
- # "a" is user, group, other mask.
- # "u" is user's mask.
- # "g" is group's mask.
- # "o" is other's mask.
- # "w" is write permission.
- # "r" is read permission.
- # "x" is execute permission.
- # "s" is uid, gid.
- # "t" is sticky bit.
- # "+" is added to a class given the specified mode.
- # "-" Is removed from a given class given mode.
- # "=" Is the exact nature of the class will be given a specified mode.
+ # "a" :: is user, group, other mask.
+ # "u" :: is user's mask.
+ # "g" :: is group's mask.
+ # "o" :: is other's mask.
+ # "w" :: is write permission.
+ # "r" :: is read permission.
+ # "x" :: is execute permission.
+ # "X" ::
+ # is execute permission for directories only, must be used in conjunction with "+"
+ # "s" :: is uid, gid.
+ # "t" :: is sticky bit.
+ # "+" :: is added to a class given the specified mode.
+ # "-" :: Is removed from a given class given mode.
+ # "=" :: Is the exact nature of the class will be given a specified mode.
def chmod(mode, list, options = {})
fu_check_options options, OPT_TABLE['chmod']
list = fu_list(list)
- fu_output_message sprintf('chmod %o %s', mode, list.join(' ')) if options[:verbose]
+ fu_output_message sprintf('chmod %s %s', mode_to_s(mode), list.join(' ')) if options[:verbose]
return if options[:noop]
list.each do |path|
Entry_.new(path).chmod(fu_mode(mode, path))
@@ -986,9 +1012,9 @@ module FileUtils
def chmod_R(mode, list, options = {})
fu_check_options options, OPT_TABLE['chmod_R']
list = fu_list(list)
- fu_output_message sprintf('chmod -R%s %o %s',
+ fu_output_message sprintf('chmod -R%s %s %s',
(options[:force] ? 'f' : ''),
- mode, list.join(' ')) if options[:verbose]
+ mode_to_s(mode), list.join(' ')) if options[:verbose]
return if options[:noop]
list.each do |root|
Entry_.new(root).traverse do |ent|
@@ -1019,8 +1045,8 @@ module FileUtils
def chown(user, group, list, options = {})
fu_check_options options, OPT_TABLE['chown']
list = fu_list(list)
- fu_output_message sprintf('chown %s%s',
- [user,group].compact.join(':') + ' ',
+ fu_output_message sprintf('chown %s %s',
+ (group ? "#{user}:#{group}" : user || ':'),
list.join(' ')) if options[:verbose]
return if options[:noop]
uid = fu_get_uid(user)
@@ -1048,14 +1074,13 @@ module FileUtils
def chown_R(user, group, list, options = {})
fu_check_options options, OPT_TABLE['chown_R']
list = fu_list(list)
- fu_output_message sprintf('chown -R%s %s%s',
+ fu_output_message sprintf('chown -R%s %s %s',
(options[:force] ? 'f' : ''),
- [user,group].compact.join(':') + ' ',
+ (group ? "#{user}:#{group}" : user || ':'),
list.join(' ')) if options[:verbose]
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
@@ -1376,14 +1401,37 @@ module FileUtils
def copy_metadata(path)
st = lstat()
- File.utime st.atime, st.mtime, path
+ if !st.symlink?
+ File.utime st.atime, st.mtime, path
+ end
begin
- File.chown st.uid, st.gid, path
+ if st.symlink?
+ begin
+ File.lchown st.uid, st.gid, path
+ rescue NotImplementedError
+ end
+ else
+ File.chown st.uid, st.gid, path
+ end
rescue Errno::EPERM
# clear setuid/setgid
- File.chmod st.mode & 01777, path
+ if st.symlink?
+ begin
+ File.lchmod st.mode & 01777, path
+ rescue NotImplementedError
+ end
+ else
+ File.chmod st.mode & 01777, path
+ end
else
- File.chmod st.mode, path
+ if st.symlink?
+ begin
+ File.lchmod st.mode, path
+ rescue NotImplementedError
+ end
+ else
+ File.chmod st.mode, path
+ end
end
end
@@ -1448,6 +1496,16 @@ module FileUtils
yield self
end
+ def wrap_traverse(pre, post)
+ pre.call self
+ if directory?
+ entries.each do |ent|
+ ent.wrap_traverse pre, post
+ end
+ end
+ post.call self
+ end
+
private
$fileutils_rb_have_lchmod = nil
diff --git a/lib/find.rb b/lib/find.rb
index cd2d1bf38b..6f3e4282ed 100644
--- a/lib/find.rb
+++ b/lib/find.rb
@@ -30,35 +30,43 @@ module Find
# Calls the associated block with the name of every file and directory listed
# as arguments, then recursively on their subdirectories, and so on.
#
+ # Returns an enumerator if no block is given.
+ #
# See the +Find+ module documentation for an example.
#
def find(*paths) # :yield: path
block_given? or return enum_for(__method__, *paths)
- 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
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
+ 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 2b71b904d0..ecc5f03843 100644
--- a/lib/forwardable.rb
+++ b/lib/forwardable.rb
@@ -7,29 +7,59 @@
# Revised by Daniel J. Berger with suggestions from Florian Gross.
#
# Documentation by James Edward Gray II and Gavin Sinclair
+
+
+
+# The Forwardable module provides delegation of specified
+# methods to a designated object, using the methods #def_delegator
+# and #def_delegators.
#
-# == Introduction
+# For example, say you have a class RecordCollection which
+# contains an array <tt>@records</tt>. You could provide the lookup method
+# #record_number(), which simply calls #[] on the <tt>@records</tt>
+# array, like this:
#
-# This library allows you delegate method calls to an object, on a method by
-# method basis.
+# require 'forwardable'
#
-# == Notes
+# class RecordCollection
+# attr_accessor :records
+# extend Forwardable
+# def_delegator :@records, :[], :record_number
+# end
#
-# Be advised, RDoc will not detect delegated methods.
+# 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 # re-open RecordCollection class
+# def_delegators :@records, :size, :<<, :map
+# end
+#
+# 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]
#
-# <b>forwardable.rb provides single-method delegation via the
-# def_delegator() and def_delegators() methods. For full-class
-# delegation via DelegateClass(), see delegate.rb.</b>
+# You can even extend regular objects with Forwardable.
#
-# == Examples
+# 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!"
#
-# === Forwardable
+# == Another example
#
-# Forwardable makes building a new class based on existing work, with a proper
-# interface, almost trivial. We want to rely on what has come before obviously,
-# but with delegation we can take just the methods we need and even rename them
-# as appropriate. In many cases this is preferable to inheritance, which gives
-# us the entire old interface, even if much of it isn't needed.
+# We want to rely on what has come before obviously, but with delegation we can
+# take just the methods we need and even rename them as appropriate. In many
+# cases this is preferable to inheritance, which gives us the entire old
+# interface, even if much of it isn't needed.
#
# class Queue
# extend Forwardable
@@ -60,7 +90,7 @@
# q.clear
# puts q.first
#
-# <i>Prints:</i>
+# This should output:
#
# 2
# 3
@@ -70,72 +100,24 @@
# Ruby
# nil
#
-# SingleForwardable can be used to setup delegation at the object level as well.
-#
-# printer = String.new
-# printer.extend SingleForwardable # prepare object for delegation
-# printer.def_delegator "STDOUT", "puts" # add delegation for STDOUT.puts()
-# printer.puts "Howdy!"
-#
-# Also, SingleForwardable can be use to Class or Module.
-#
-# module Facade
-# extend SingleForwardable
-# def_delegator :Implementation, :service
-#
-# class Implementation
-# def service...
-# end
-# end
-#
-# If you want to use both Forwardable and SingleForwardable, you can
-# use methods def_instance_delegator and def_single_delegator, etc.
-#
-# If the object isn't a Module and Class, You can too extend
-# Forwardable module.
-# printer = String.new
-# printer.extend Forwardable # prepare object for delegation
-# printer.def_delegator "STDOUT", "puts" # add delegation for STDOUT.puts()
-# printer.puts "Howdy!"
-#
-# <i>Prints:</i>
-#
-# Howdy!
-
-#
-# The Forwardable module provides delegation of specified
-# methods to a designated object, using the methods #def_delegator
-# and #def_delegators.
-#
-# For example, say you have a class RecordCollection which
-# contains an array <tt>@records</tt>. You could provide the lookup method
-# #record_number(), which simply calls #[] on the <tt>@records</tt>
-# array, like this:
+# == Notes
#
-# class RecordCollection
-# extend Forwardable
-# def_delegator :@records, :[], :record_number
-# end
+# Be advised, RDoc will not detect delegated methods.
#
-# Further, if you wish to provide the methods #size, #<<, and #map,
-# all of which delegate to @records, this is how you can do it:
+# +forwardable.rb+ provides single-method delegation via the def_delegator and
+# def_delegators methods. For full-class delegation via DelegateClass, see
+# +delegate.rb+.
#
-# class RecordCollection
-# # extend Forwardable, but we did that above
-# def_delegators :@records, :size, :<<, :map
-# end
-# f = Foo.new
-# f.printf ...
-# f.gets
-# f.content_at(1)
-#
-# Also see the example at forwardable.rb.
-
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
+ # Exception is raised.
attr_accessor :debug
end
@@ -177,7 +159,7 @@ module Forwardable
# Define +method+ as delegator instance method with an optional
# alias name +ali+. Method calls to +ali+ will be delegated to
- # +accessor.method+.
+ # +accessor.method+.
#
# class MyQueue
# extend Forwardable
@@ -185,7 +167,7 @@ module Forwardable
# def initialize
# @queue = []
# end
- #
+ #
# def_delegator :@queue, :push, :mypush
# end
#
@@ -200,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
@@ -219,9 +201,30 @@ module Forwardable
alias def_delegator def_instance_delegator
end
+# SingleForwardable can be used to setup delegation at the object level as well.
+#
+# printer = String.new
+# printer.extend SingleForwardable # prepare object for delegation
+# printer.def_delegator "STDOUT", "puts" # add delegation for STDOUT.puts()
+# printer.puts "Howdy!"
#
-# Usage of The SingleForwardable is like Fowadable module.
+# Also, SingleForwardable can be used to set up delegation for a Class or Module.
#
+# class Implementation
+# def self.service
+# 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
# Takes a hash as its argument. The key is a symbol or an array of
# symbols. These symbols correspond to method names. The value is
@@ -259,18 +262,19 @@ module SingleForwardable
end
end
+ # :call-seq:
+ # def_single_delegator(accessor, method, new_name=method)
#
- # Defines a method _method_ which delegates to _obj_ (i.e. it calls
- # the method of the same name in _obj_). If _new_name_ is
+ # Defines a method _method_ which delegates to _accessor_ (i.e. it calls
+ # the method of the same name in _accessor_). If _new_name_ is
# provided, it is used as the name for the delegate method.
- #
def def_single_delegator(accessor, method, ali = method)
str = %{
def #{ali}(*args, &block)
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
index f6f37d3a89..48770289f8 100644
--- a/lib/gserver.rb
+++ b/lib/gserver.rb
@@ -3,7 +3,7 @@
#
# Author:: John W. Small
# Documentation:: Gavin Sinclair
-# Licence:: Freeware.
+# Licence:: Ruby License
require "socket"
require "thread"
@@ -261,7 +261,8 @@ class GServer
end
}
client = @tcpServer.accept
- @connections << Thread.new(client) { |myClient|
+ Thread.new(client) { |myClient|
+ @connections << Thread.current
begin
myPort = myClient.peeraddr[1]
serve(myClient) if !@audit or connecting(myClient)
diff --git a/lib/ipaddr.rb b/lib/ipaddr.rb
index 15692cf4f8..13016fcbba 100644
--- a/lib/ipaddr.rb
+++ b/lib/ipaddr.rb
@@ -82,6 +82,21 @@ class IPAddr
\z
}xi
+ # Generic IPAddr related error. Exceptions raised in this class should
+ # inherit from Error.
+ class Error < ArgumentError; end
+
+ # Raised when the provided IP address is an invalid address.
+ class InvalidAddressError < Error; end
+
+ # Raised when the address family is invalid such as an address with an
+ # unsupported family, an address with an inconsistent family, or an address
+ # who's family cannot be determined.
+ class AddressFamilyError < Error; end
+
+ # Raised when the address is an invalid length.
+ class InvalidPrefixError < InvalidAddressError; end
+
# Returns the address family of this IP address.
attr_reader :family
@@ -100,7 +115,7 @@ class IPAddr
when 16
s = IN6FORMAT % addr.unpack('n8')
else
- raise ArgumentError, "unsupported address family"
+ raise AddressFamilyError, "unsupported address family"
end
return s
end
@@ -226,7 +241,7 @@ class IPAddr
(@addr >> (112 - 16 * i)) & 0xffff
}.pack('n8')
else
- raise "unsupported address family"
+ raise AddressFamilyError, "unsupported address family"
end
end
@@ -258,7 +273,7 @@ class IPAddr
# into an IPv4-mapped IPv6 address.
def ipv4_mapped
if !ipv4?
- raise ArgumentError, "not an IPv4 address"
+ raise InvalidAddressError, "not an IPv4 address"
end
return self.clone.set(@addr | 0xffff00000000, Socket::AF_INET6)
end
@@ -267,7 +282,7 @@ class IPAddr
# into an IPv4-compatible IPv6 address.
def ipv4_compat
if !ipv4?
- raise ArgumentError, "not an IPv4 address"
+ raise InvalidAddressError, "not an IPv4 address"
end
return self.clone.set(@addr, Socket::AF_INET6)
end
@@ -291,14 +306,14 @@ class IPAddr
when Socket::AF_INET6
return ip6_arpa
else
- raise "unsupported address family"
+ raise AddressFamilyError, "unsupported address family"
end
end
# Returns a string for DNS reverse lookup compatible with RFC3172.
def ip6_arpa
if !ipv6?
- raise ArgumentError, "not an IPv6 address"
+ raise InvalidAddressError, "not an IPv6 address"
end
return _reverse + ".ip6.arpa"
end
@@ -306,7 +321,7 @@ class IPAddr
# Returns a string for DNS reverse lookup compatible with RFC1886.
def ip6_int
if !ipv6?
- raise ArgumentError, "not an IPv6 address"
+ raise InvalidAddressError, "not an IPv6 address"
end
return _reverse + ".ip6.int"
end
@@ -346,7 +361,7 @@ class IPAddr
when Socket::AF_INET6
end_addr = (@addr | (IN6MASK ^ @mask_addr))
else
- raise "unsupported address family"
+ raise AddressFamilyError, "unsupported address family"
end
return clone.set(begin_addr, @family)..clone.set(end_addr, @family)
@@ -361,7 +376,7 @@ class IPAddr
when Socket::AF_INET6
af = "IPv6"
else
- raise "unsupported address family"
+ raise AddressFamilyError, "unsupported address family"
end
return sprintf("#<%s: %s:%s/%s>", self.class.name,
af, _to_string(@addr), _to_string(@mask_addr))
@@ -376,14 +391,14 @@ class IPAddr
case family[0] ? family[0] : @family
when Socket::AF_INET
if addr < 0 || addr > IN4MASK
- raise ArgumentError, "invalid address"
+ raise InvalidAddressError, "invalid address"
end
when Socket::AF_INET6
if addr < 0 || addr > IN6MASK
- raise ArgumentError, "invalid address"
+ raise InvalidAddressError, "invalid address"
end
else
- raise ArgumentError, "unsupported address family"
+ raise AddressFamilyError, "unsupported address family"
end
@addr = addr
if family[0]
@@ -400,7 +415,7 @@ class IPAddr
else
m = IPAddr.new(mask)
if m.family != @family
- raise ArgumentError, "address family is not same"
+ raise InvalidPrefixError, "address family is not same"
end
@mask_addr = m.to_i
@addr &= @mask_addr
@@ -412,18 +427,18 @@ class IPAddr
case @family
when Socket::AF_INET
if prefixlen < 0 || prefixlen > 32
- raise ArgumentError, "invalid length"
+ raise InvalidPrefixError, "invalid length"
end
masklen = 32 - prefixlen
@mask_addr = ((IN4MASK >> masklen) << masklen)
when Socket::AF_INET6
if prefixlen < 0 || prefixlen > 128
- raise ArgumentError, "invalid length"
+ raise InvalidPrefixError, "invalid length"
end
masklen = 128 - prefixlen
@mask_addr = ((IN6MASK >> masklen) << masklen)
else
- raise "unsupported address family"
+ raise AddressFamilyError, "unsupported address family"
end
@addr = ((@addr >> masklen) << masklen)
return self
@@ -457,9 +472,9 @@ class IPAddr
@mask_addr = (family == Socket::AF_INET) ? IN4MASK : IN6MASK
return
when Socket::AF_UNSPEC
- raise ArgumentError, "address family must be specified"
+ raise AddressFamilyError, "address family must be specified"
else
- raise ArgumentError, "unsupported address family: #{family}"
+ raise AddressFamilyError, "unsupported address family: #{family}"
end
end
prefix, prefixlen = addr.split('/')
@@ -482,7 +497,7 @@ class IPAddr
@family = Socket::AF_INET6
end
if family != Socket::AF_UNSPEC && @family != family
- raise ArgumentError, "address family mismatch"
+ raise AddressFamilyError, "address family mismatch"
end
if prefixlen
mask!(prefixlen)
@@ -511,8 +526,8 @@ class IPAddr
octets = m.captures
end
octets.inject(0) { |i, s|
- (n = s.to_i) < 256 or raise ArgumentError, "invalid address"
- s.match(/\A0./) and raise ArgumentError, "zero-filled number is ambiguous"
+ (n = s.to_i) < 256 or raise InvalidAddressError, "invalid address"
+ s.match(/\A0./) and raise InvalidAddressError, "zero-filled number in IPv4 address is ambiguous"
i << 8 | n
}
end
@@ -529,7 +544,7 @@ class IPAddr
right = ''
when RE_IPV6ADDRLIKE_COMPRESSED
if $4
- left.count(':') <= 6 or raise ArgumentError, "invalid address"
+ left.count(':') <= 6 or raise InvalidAddressError, "invalid address"
addr = in_addr($~[4,4])
left = $1
right = $3 + '0:0'
@@ -541,7 +556,7 @@ class IPAddr
addr = 0
end
else
- raise ArgumentError, "invalid address"
+ raise InvalidAddressError, "invalid address"
end
l = left.split(':')
r = right.split(':')
@@ -561,7 +576,7 @@ class IPAddr
when Socket::AF_INET6
return addr & IN6MASK
else
- raise "unsupported address family"
+ raise AddressFamilyError, "unsupported address family"
end
end
@@ -574,7 +589,7 @@ class IPAddr
when Socket::AF_INET6
return ("%.32x" % @addr).reverse!.gsub!(/.(?!$)/, '\&.')
else
- raise "unsupported address family"
+ raise AddressFamilyError, "unsupported address family"
end
end
@@ -587,13 +602,13 @@ class IPAddr
when Socket::AF_INET6
return (("%.32x" % addr).gsub!(/.{4}(?!$)/, '\&:'))
else
- raise "unsupported address family"
+ raise AddressFamilyError, "unsupported address family"
end
end
end
-unless Socket.const_defined? "AF_INET6"
+unless Socket.const_defined? :AF_INET6
class Socket < BasicSocket
# IPv6 protocol family
AF_INET6 = Object.new
@@ -718,19 +733,15 @@ class TC_IPAddr < Test::Unit::TestCase
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)
- [
- ["192.168.0.256"],
- ["192.168.0.011"],
- ["fe80::1%fxp0"],
- ["::1/255.255.255.0"],
- [IPAddr.new("::1").to_i],
- ["::ffff:192.168.1.2/120", Socket::AF_INET],
- ["[192.168.1.2]/120"],
- ].each { |args|
- assert_raises(ArgumentError) {
- IPAddr.new(*args)
- }
- }
+ 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
@@ -791,14 +802,14 @@ class TC_IPAddr < Test::Unit::TestCase
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(ArgumentError) {
+ 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(ArgumentError) {
+ assert_raises(IPAddr::InvalidAddressError) {
IPAddr.new("192.168.2.1").ip6_int
}
end
diff --git a/lib/irb.rb b/lib/irb.rb
index c8fa04c4e5..20390d2205 100644
--- a/lib/irb.rb
+++ b/lib/irb.rb
@@ -21,19 +21,341 @@ require "irb/locale"
STDOUT.sync = true
+# IRB stands for "interactive Ruby" and is a tool to interactively execute Ruby
+# expressions read from the standard input.
+#
+# The +irb+ command from your shell will start the interpreter.
+#
+# == Usage
+#
+# Use of irb is easy if you know Ruby.
+#
+# When executing irb, prompts are displayed as follows. Then, enter the Ruby
+# expression. An input is executed when it is syntactically complete.
+#
+# $ irb
+# irb(main):001:0> 1+2
+# #=> 3
+# irb(main):002:0> class Foo
+# irb(main):003:1> def foo
+# irb(main):004:2> print 1
+# irb(main):005:2> end
+# irb(main):006:1> end
+# #=> nil
+#
+# The Readline extension module can be used with irb. Use of Readline is
+# default if it's installed.
+#
+# == Command line options
+#
+# Usage: irb.rb [options] [programfile] [arguments]
+# -f Suppress read of ~/.irbrc
+# -m Bc mode (load mathn, fraction or matrix are available)
+# -d Set $DEBUG to true (same as `ruby -d')
+# -r load-module Same as `ruby -r'
+# -I path Specify $LOAD_PATH directory
+# -U Same as `ruby -U`
+# -E enc Same as `ruby -E`
+# -w Same as `ruby -w`
+# -W[level=2] Same as `ruby -W`
+# --inspect Use `inspect' for output (default except for bc mode)
+# --noinspect Don't use inspect for output
+# --readline Use Readline extension module
+# --noreadline Don't use Readline extension module
+# --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.
+# --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)
+# -v, --version Print the version of irb
+#
+# == Configuration
+#
+# IRB reads from <code>~/.irbrc</code> when it's invoked.
+#
+# If <code>~/.irbrc</code> doesn't exist, +irb+ will try to read in the following order:
+#
+# * +.irbrc+
+# * +irb.rc+
+# * +_irbrc+
+# * <code>$irbrc</code>
+#
+# The following are alternatives to the command line options. To use them type
+# as follows in an +irb+ session:
+#
+# IRB.conf[:IRB_NAME]="irb"
+# IRB.conf[:MATH_MODE]=false
+# IRB.conf[:INSPECT_MODE]=nil
+# IRB.conf[:IRB_RC] = nil
+# IRB.conf[:BACK_TRACE_LIMIT]=16
+# IRB.conf[:USE_LOADER] = false
+# IRB.conf[:USE_READLINE] = nil
+# IRB.conf[:USE_TRACER] = false
+# IRB.conf[:IGNORE_SIGINT] = true
+# IRB.conf[:IGNORE_EOF] = false
+# IRB.conf[:PROMPT_MODE] = :DEFAULT
+# IRB.conf[:PROMPT] = {...}
+# IRB.conf[:DEBUG_LEVEL]=0
+#
+# === Auto indentation
+#
+# To enable auto-indent mode in irb, add the following to your +.irbrc+:
+#
+# IRB.conf[:AUTO_INDENT] = true
+#
+# === Autocompletion
+#
+# To enable autocompletion for irb, add the following to your +.irbrc+:
+#
+# require 'irb/completion'
+#
+# === History
+#
+# By default, irb disables history and will not store any commands you used.
+#
+# If you want to enable history, add the following to your +.irbrc+:
+#
+# IRB.conf[:SAVE_HISTORY] = 1000
+#
+# This will now store the last 1000 commands in <code>~/.irb_history</code>.
+#
+# See IRB::Context#save_history= for more information.
+#
+# == Customizing the IRB Prompt
+#
+# In order to customize the prompt, you can change the following Hash:
+#
+# IRB.conf[:PROMPT]
+#
+# 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
+# :PROMPT_S => nil, # prompt for continuated strings
+# :PROMPT_C => nil, # prompt for continuated statement
+# :RETURN => " ==>%s\n" # format to return value
+# }
+#
+# IRB.conf[:PROMPT_MODE] = :MY_PROMPT
+#
+# Or, invoke irb with the above prompt mode by:
+#
+# irb --prompt my-prompt
+#
+# Constants +PROMPT_I+, +PROMPT_S+ and +PROMPT_C+ specify the format. In the
+# prompt specification, some special strings are available:
+#
+# %N # command name which is running
+# %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").
+# # It can be ommited
+# %NNn # line number.
+# %% # %
+#
+# For instance, the default prompt mode is defined as follows:
+#
+# IRB.conf[:PROMPT_MODE][:DEFAULT] = {
+# :PROMPT_I => "%N(%m):%03n:%i> ",
+# :PROMPT_S => "%N(%m):%03n:%i%l ",
+# :PROMPT_C => "%N(%m):%03n:%i* ",
+# :RETURN => "%s\n" # used to printf
+# }
+#
+# irb comes with a number of available modes:
+#
+# # :NULL:
+# # :PROMPT_I:
+# # :PROMPT_N:
+# # :PROMPT_S:
+# # :PROMPT_C:
+# # :RETURN: |
+# # %s
+# # :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
+# # :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
+# # :SIMPLE:
+# # :PROMPT_I: ! '>> '
+# # :PROMPT_N: ! '>> '
+# # :PROMPT_S:
+# # :PROMPT_C: ! '?> '
+# # :RETURN: |
+# # => %s
+# # :INF_RUBY:
+# # :PROMPT_I: ! '%N(%m):%03n:%i> '
+# # :PROMPT_N:
+# # :PROMPT_S:
+# # :PROMPT_C:
+# # :RETURN: |
+# # %s
+# # :AUTO_INDENT: true
+# # :XMP:
+# # :PROMPT_I:
+# # :PROMPT_N:
+# # :PROMPT_S:
+# # :PROMPT_C:
+# # :RETURN: |2
+# # ==>%s
+#
+# == Restrictions
+#
+# Because irb evaluates input immediately after it is syntactically complete,
+# the results may be slightly different than directly using Ruby.
+#
+# == IRB Sessions
+#
+# IRB has a special feature, that allows you to manage many sessions at once.
+#
+# You can create new sessions with Irb.irb, and get a list of current sessions
+# with the +jobs+ command in the prompt.
+#
+# === Commands
+#
+# JobManager provides commands to handle the current sessions:
+#
+# jobs # List of current sessions
+# fg # Switches to the session of the given number
+# kill # Kills the session with the given number
+#
+# The +exit+ command, or ::irb_exit, will quit the current session and call any
+# exit hooks with IRB.irb_at_exit.
+#
+# A few commands for loading files within the session are also available:
+#
+# +source+::
+# Loads a given file in the current session and displays the source lines,
+# see IrbLoader#source_file
+# +irb_load+::
+# Loads the given file similarly to Kernel#load, see IrbLoader#irb_load
+# +irb_require+::
+# Loads the given file similarly to Kernel#require
+#
+# === Configuration
+#
+# The command line options, or IRB.conf, specify the default behavior of
+# Irb.irb.
+#
+# On the other hand, each conf in IRB@Command+line+options is used to
+# individually configure IRB.irb.
+#
+# If a proc is set for IRB.conf[:IRB_RC], its will be invoked after execution
+# of that proc with the context of the current session as its argument. Each
+# session can be configured using this mechanism.
+#
+# === Session variables
+#
+# There are a few variables in every Irb session that can come in handy:
+#
+# <code>_</code>::
+# The value command executed, as a local variable
+# <code>__</code>::
+# The history of evaluated commands
+# <code>__[line_no]</code>::
+# Returns the evaluation value at the given line number, +line_no+.
+# If +line_no+ is a negative, the return value +line_no+ many lines before
+# the most recent return value.
+#
+# === Example using IRB Sessions
+#
+# # invoke a new session
+# irb(main):001:0> irb
+# # list open sessions
+# irb.1(main):001:0> jobs
+# #0->irb on main (#<Thread:0x400fb7e4> : stop)
+# #1->irb#1 on main (#<Thread:0x40125d64> : running)
+#
+# # change the active session
+# irb.1(main):002:0> fg 0
+# # define class Foo in top-level session
+# irb(main):002:0> class Foo;end
+# # invoke a new session with the context of Foo
+# irb(main):003:0> irb Foo
+# # define Foo#foo
+# irb.2(Foo):001:0> def foo
+# irb.2(Foo):002:1> print 1
+# irb.2(Foo):003:1> end
+#
+# # change the active session
+# irb.2(Foo):004:0> fg 0
+# # list open sessions
+# irb(main):004:0> jobs
+# #0->irb on main (#<Thread:0x400fb7e4> : running)
+# #1->irb#1 on main (#<Thread:0x40125d64> : stop)
+# #2->irb#2 on Foo (#<Thread:0x4011d54c> : stop)
+# # check if Foo#foo is available
+# irb(main):005:0> Foo.instance_methods #=> [:foo, ...]
+#
+# # change the active sesssion
+# irb(main):006:0> fg 2
+# # define Foo#bar in the context of Foo
+# irb.2(Foo):005:0> def bar
+# irb.2(Foo):006:1> print "bar"
+# irb.2(Foo):007:1> end
+# irb.2(Foo):010:0> Foo.instance_methods #=> [:bar, :foo, ...]
+#
+# # change the active session
+# irb.2(Foo):011:0> fg 0
+# irb(main):007:0> f = Foo.new #=> #<Foo:0x4010af3c>
+# # invoke a new session with the context of f (instance of Foo)
+# irb(main):008:0> irb f
+# # list open sessions
+# irb.3(<Foo:0x4010af3c>):001:0> jobs
+# #0->irb on main (#<Thread:0x400fb7e4> : stop)
+# #1->irb#1 on main (#<Thread:0x40125d64> : stop)
+# #2->irb#2 on Foo (#<Thread:0x4011d54c> : stop)
+# #3->irb#3 on #<Foo:0x4010af3c> (#<Thread:0x4010a1e0> : running)
+# # evaluate f.foo
+# irb.3(<Foo:0x4010af3c>):002:0> foo #=> 1 => nil
+# # evaluate f.bar
+# irb.3(<Foo:0x4010af3c>):003:0> bar #=> bar => nil
+# # kill jobs 1, 2, and 3
+# irb.3(<Foo:0x4010af3c>):004:0> kill 1, 2, 3
+# # list open sesssions, should only include main session
+# irb(main):009:0> jobs
+# #0->irb on main (#<Thread:0x400fb7e4> : running)
+# # quit irb
+# irb(main):010:0> exit
module IRB
@RCS_ID='-$Id$-'
+ # An exception raised by IRB.irb_abort
class Abort < Exception;end
- #
@CONF = {}
+
+ # Displays current configuration.
+ #
+ # Modifing the configuration is achieved by sending a message to IRB.conf.
+ #
+ # See IRB@Configuration for more information.
def IRB.conf
@CONF
end
- # IRB version method
+ # Returns the current version of IRB, including release version and last
+ # updated date.
def IRB.version
if v = @CONF[:VERSION] then return v end
@@ -42,11 +364,16 @@ module IRB
@CONF[:VERSION] = format("irb %s(%s)", rv, @LAST_UPDATE_DATE)
end
+ # The current IRB::Context of the session, see IRB.conf
+ #
+ # irb
+ # irb(main):001:0> IRB.CurrentContext.irb_name = "foo"
+ # foo(main):002:0> IRB.conf[:MAIN_CONTEXT].irb_name #=> "foo"
def IRB.CurrentContext
IRB.conf[:MAIN_CONTEXT]
end
- # initialize IRB and start TOP_LEVEL irb
+ # Initializes IRB and creates a new Irb.irb object at the +TOPLEVEL_BINDING+
def IRB.start(ap_path = nil)
$0 = File::basename(ap_path, ".rb") if ap_path
@@ -75,14 +402,19 @@ module IRB
# print "\n"
end
+ # Calls each event hook of IRB.conf[:AT_EXIT] when the current session quits.
def IRB.irb_at_exit
@CONF[:AT_EXIT].each{|hook| hook.call}
end
+ # Quits irb
def IRB.irb_exit(irb, ret)
throw :IRB_EXIT, ret
end
+ # Aborts then interrupts irb.
+ #
+ # Will raise an Abort exception, or the given +exception+.
def IRB.irb_abort(irb, exception = Abort)
if defined? Thread
irb.context.thread.raise exception, "abort then interrupt!"
@@ -91,10 +423,8 @@ module IRB
end
end
- #
- # irb interpreter main routine
- #
class Irb
+ # Creates a new irb session
def initialize(workspace = nil, input_method = nil, output_method = nil)
@context = Context.new(self, workspace, input_method, output_method)
@context.main.extend ExtendCommandBundle
@@ -103,9 +433,12 @@ module IRB
@scanner = RubyLex.new
@scanner.exception_on_syntax_error = false
end
+ # Returns the current context of this irb session
attr_reader :context
+ # The lexer used by this irb session
attr_accessor :scanner
+ # Evaluates input for this session.
def eval_input
@scanner.set_prompt do
|ltype, indent, continue, line_no|
@@ -139,7 +472,7 @@ module IRB
if l = @context.io.gets
print l if @context.verbose?
else
- if @context.ignore_eof? and @context.io.readable_atfer_eof?
+ if @context.ignore_eof? and @context.io.readable_after_eof?
l = "\n"
if @context.verbose?
printf "Use \"exit\" to leave %s\n", @context.ap_name
@@ -204,6 +537,11 @@ module IRB
end
end
+ # Evaluates the given block using the given +path+ as the Context#irb_path
+ # and +name+ as the Context#irb_name.
+ #
+ # Used by the irb command +source+, see IRB@IRB+Sessions for more
+ # information.
def suspend_name(path = nil, name = nil)
@context.irb_path, back_path = path, @context.irb_path if path
@context.irb_name, back_name = name, @context.irb_name if name
@@ -215,6 +553,11 @@ module IRB
end
end
+ # Evaluates the given block using the given +workspace+ as the
+ # Context#workspace.
+ #
+ # Used by the irb command +irb_load+, see IRB@IRB+Sessions for more
+ # information.
def suspend_workspace(workspace)
@context.workspace, back_workspace = workspace, @context.workspace
begin
@@ -224,6 +567,11 @@ module IRB
end
end
+ # Evaluates the given block using the given +input_method+ as the
+ # Context#io.
+ #
+ # Used by the irb commands +source+ and +irb_load+, see IRB@IRB+Sessions
+ # for more information.
def suspend_input_method(input_method)
back_io = @context.io
@context.instance_eval{@io = input_method}
@@ -234,6 +582,7 @@ module IRB
end
end
+ # Evaluates the given block using the given +context+ as the Context.
def suspend_context(context)
@context, back_context = context, @context
begin
@@ -243,6 +592,7 @@ module IRB
end
end
+ # Handler for the signal SIGINT, see Kernel#trap for more information.
def signal_handle
unless @context.ignore_sigint?
print "\nabort!\n" if @context.verbose?
@@ -264,6 +614,7 @@ module IRB
end
end
+ # Evaluates the given block using the given +status+.
def signal_status(status)
return yield if @signal_status == :IN_LOAD
@@ -276,7 +627,7 @@ module IRB
end
end
- def prompt(prompt, ltype, indent, line_no)
+ def prompt(prompt, ltype, indent, line_no) # :nodoc:
p = prompt.dup
p.gsub!(/%([0-9]+)?([a-zA-Z])/) do
case $2
@@ -307,10 +658,12 @@ module IRB
p
end
- def output_value
+ def output_value # :nodoc:
printf @context.return_format, @context.inspect_last_value
end
+ # Outputs the local variables to this current session, including
+ # #signal_status and #context, using IRB::Locale.
def inspect
ary = []
for iv in instance_variables
@@ -327,7 +680,6 @@ module IRB
end
end
- # Singleton method
def @CONF.inspect
IRB.version unless self[:VERSION]
diff --git a/lib/irb/cmd/chws.rb b/lib/irb/cmd/chws.rb
index 65c977016b..1889e75d5e 100644
--- a/lib/irb/cmd/chws.rb
+++ b/lib/irb/cmd/chws.rb
@@ -12,6 +12,7 @@
require "irb/cmd/nop.rb"
require "irb/ext/change-ws.rb"
+# :stopdoc:
module IRB
module ExtendCommand
@@ -29,4 +30,4 @@ module IRB
end
end
end
-
+# :startdoc:
diff --git a/lib/irb/cmd/fork.rb b/lib/irb/cmd/fork.rb
index c2664626ae..fbe5126c85 100644
--- a/lib/irb/cmd/fork.rb
+++ b/lib/irb/cmd/fork.rb
@@ -11,11 +11,11 @@
@RCS_ID='-$Id$-'
-
+# :stopdoc:
module IRB
module ExtendCommand
class Fork<Nop
- def execute(&block)
+ def execute
pid = send ExtendCommand.irb_original_method_name("fork")
unless pid
class << self
@@ -34,5 +34,6 @@ module IRB
end
end
end
+# :startdoc:
diff --git a/lib/irb/cmd/help.rb b/lib/irb/cmd/help.rb
index 67cf89990b..76e299fc20 100644
--- a/lib/irb/cmd/help.rb
+++ b/lib/irb/cmd/help.rb
@@ -12,6 +12,7 @@ require 'rdoc/ri/driver'
require "irb/cmd/nop.rb"
+# :stopdoc:
module IRB
module ExtendCommand
class Help<Nop
@@ -37,3 +38,4 @@ module IRB
end
end
end
+# :startdoc:
diff --git a/lib/irb/cmd/load.rb b/lib/irb/cmd/load.rb
index 2a6de21ed7..6c9e9f67ce 100644
--- a/lib/irb/cmd/load.rb
+++ b/lib/irb/cmd/load.rb
@@ -12,6 +12,7 @@
require "irb/cmd/nop.rb"
require "irb/ext/loader"
+# :stopdoc:
module IRB
module ExtendCommand
class Load<Nop
@@ -64,3 +65,4 @@ module IRB
end
end
+# :startdoc:
diff --git a/lib/irb/cmd/nop.rb b/lib/irb/cmd/nop.rb
index 2b028975c8..7bd443121e 100644
--- a/lib/irb/cmd/nop.rb
+++ b/lib/irb/cmd/nop.rb
@@ -8,6 +8,7 @@
#
#
#
+# :stopdoc:
module IRB
module ExtendCommand
class Nop
@@ -35,4 +36,4 @@ module IRB
end
end
end
-
+# :startdoc:
diff --git a/lib/irb/cmd/pushws.rb b/lib/irb/cmd/pushws.rb
index 5fd567731c..cee8538e3e 100644
--- a/lib/irb/cmd/pushws.rb
+++ b/lib/irb/cmd/pushws.rb
@@ -12,6 +12,7 @@
require "irb/cmd/nop.rb"
require "irb/ext/workspaces.rb"
+# :stopdoc:
module IRB
module ExtendCommand
class Workspaces<Nop
@@ -35,4 +36,5 @@ module IRB
end
end
end
+# :startdoc:
diff --git a/lib/irb/cmd/subirb.rb b/lib/irb/cmd/subirb.rb
index 4d54a72b6f..7363d64769 100644
--- a/lib/irb/cmd/subirb.rb
+++ b/lib/irb/cmd/subirb.rb
@@ -11,6 +11,7 @@
require "irb/cmd/nop.rb"
require "irb/ext/multi-irb"
+# :stopdoc:
module IRB
module ExtendCommand
class IrbCommand<Nop
@@ -38,3 +39,4 @@ module IRB
end
end
end
+# :startdoc:
diff --git a/lib/irb/completion.rb b/lib/irb/completion.rb
index 7fd69a0a09..c6f8a5889f 100644
--- a/lib/irb/completion.rb
+++ b/lib/irb/completion.rb
@@ -9,28 +9,30 @@
require "readline"
module IRB
- module InputCompletor
+ module InputCompletor # :nodoc:
@RCS_ID='-$Id$-'
- 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",
+ # Set of reserved words used by Ruby, you should not use these for
+ # constants or variables
+ 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|
@@ -42,7 +44,7 @@ module IRB
when /^((["'`]).*\2)\.([^.]*)$/
# String
receiver = $1
- message = $3
+ message = Regexp.quote($3)
candidates = String.instance_methods.collect{|m| m.to_s}
select_message(receiver, message, candidates)
@@ -77,7 +79,7 @@ module IRB
if Symbol.respond_to?(:all_symbols)
sym = $1
candidates = Symbol.all_symbols.collect{|s| ":" + s.id2name}
- candidates.grep(/^#{sym}/)
+ candidates.grep(/^#{Regexp.quote(sym)}/)
else
[]
end
@@ -152,9 +154,10 @@ module IRB
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 | cv).include?(receiver) or /^[A-Z]/ =~ receiver && /\./ !~ receiver
+ 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
@@ -201,15 +204,14 @@ module IRB
select_message(receiver, message, candidates)
else
- candidates = eval("methods | private_methods | local_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)}/)
end
}
- Operators = ["%", "&", "*", "**", "+", "-", "/",
- "<", "<<", "<=", "<=>", "==", "===", "=~", ">", ">=", ">>",
- "[]", "[]=", "^", "!", "!=", "!~"]
+ # Set of available operators in Ruby
+ Operators = %w[% & * ** + - / < << <= <=> == === =~ > >= >> [] []= ^ ! != !~]
def self.select_message(receiver, message, candidates, sep = ".")
candidates.grep(/^#{message}/).collect do |e|
diff --git a/lib/irb/context.rb b/lib/irb/context.rb
index 61b519170d..72b36307d5 100644
--- a/lib/irb/context.rb
+++ b/lib/irb/context.rb
@@ -12,13 +12,16 @@ require "irb/workspace"
require "irb/inspector"
module IRB
+ # A class that wraps the current state of the irb session, including the
+ # configuration of IRB.conf.
class Context
+ # Creates a new IRB context.
#
- # Arguments:
- # input_method: nil -- stdin or readline
- # String -- File
- # other -- using this as InputMethod
+ # The optional +input_method+ argument:
#
+ # +nil+:: uses stdin or Readline
+ # +String+:: uses a File
+ # +other+:: uses this as InputMethod
def initialize(irb, workspace = nil, input_method = nil, output_method = nil)
@irb = irb
if workspace
@@ -51,10 +54,10 @@ module IRB
self.prompt_mode = IRB.conf[:PROMPT_MODE]
- if IRB.conf[:SINGLE_IRB] or !defined?(JobManager)
+ if IRB.conf[:SINGLE_IRB] or !defined?(IRB::JobManager)
@irb_name = IRB.conf[:IRB_NAME]
else
- @irb_name = "irb#"+IRB.JobManager.n_jobs.to_s
+ @irb_name = IRB.conf[:IRB_NAME]+"#"+IRB.JobManager.n_jobs.to_s
end
@irb_path = "(" + @irb_name + ")"
@@ -97,50 +100,139 @@ module IRB
if @echo.nil?
@echo = true
end
- @debug_level = IRB.conf[:DEBUG_LEVEL]
+ self.debug_level = IRB.conf[:DEBUG_LEVEL]
end
+ # The top-level workspace, see WorkSpace#main
def main
@workspace.main
end
+ # The toplevel workspace, see #home_workspace
attr_reader :workspace_home
+ # WorkSpace in the current context
attr_accessor :workspace
+ # The current thread in this context
attr_reader :thread
+ # The current input method
+ #
+ # Can be either StdioInputMethod, ReadlineInputMethod, FileInputMethod or
+ # other specified when the context is created. See ::new for more
+ # information on +input_method+.
attr_accessor :io
+ # Current irb session
attr_accessor :irb
+ # A copy of the default <code>IRB.conf[:AP_NAME]</code>
attr_accessor :ap_name
+ # A copy of the default <code>IRB.conf[:RC]</code>
attr_accessor :rc
+ # A copy of the default <code>IRB.conf[:LOAD_MODULES]</code>
attr_accessor :load_modules
+ # Can be either name from <code>IRB.conf[:IRB_NAME]</code>, or the number of
+ # the current job set by JobManager, such as <code>irb#2</code>
attr_accessor :irb_name
+ # Can be either the #irb_name surrounded by parenthesis, or the
+ # +input_method+ passed to Context.new
attr_accessor :irb_path
+ # Whether +Readline+ is enabled or not.
+ #
+ # A copy of the default <code>IRB.conf[:USE_READLINE]</code>
+ #
+ # See #use_readline= for more information.
attr_reader :use_readline
+ # A copy of the default <code>IRB.conf[:INSPECT_MODE]</code>
attr_reader :inspect_mode
+ # A copy of the default <code>IRB.conf[:PROMPT_MODE]</code>
attr_reader :prompt_mode
+ # Standard IRB prompt
+ #
+ # See IRB@Customizing+the+IRB+Prompt for more information.
attr_accessor :prompt_i
+ # IRB prompt for continuated strings
+ #
+ # See IRB@Customizing+the+IRB+Prompt for more information.
attr_accessor :prompt_s
+ # IRB prompt for continuated statement (e.g. immediately after an +if+)
+ #
+ # See IRB@Customizing+the+IRB+Prompt for more information.
attr_accessor :prompt_c
+ # See IRB@Customizing+the+IRB+Prompt for more information.
attr_accessor :prompt_n
+ # Can be either the default <code>IRB.conf[:AUTO_INDENT]</code>, or the
+ # mode set by #prompt_mode=
+ #
+ # To enable auto-indentation in irb:
+ #
+ # IRB.conf[:AUTO_INDENT] = true
+ #
+ # or
+ #
+ # irb_context.auto_indent_mode = true
+ #
+ # or
+ #
+ # IRB.CurrentContext.auto_indent_mode = true
+ #
+ # See IRB@Configuration for more information.
attr_accessor :auto_indent_mode
+ # The format of the return statement, set by #prompt_mode= using the
+ # +:RETURN+ of the +mode+ passed to set the current #prompt_mode.
attr_accessor :return_format
+ # Whether <code>^C</code> (+control-c+) will be ignored or not.
+ #
+ # If set to +false+, <code>^C</code> will quit irb.
+ #
+ # If set to +true+,
+ #
+ # * during input: cancel input then return to top level.
+ # * during execute: abandon current execution.
attr_accessor :ignore_sigint
+ # Whether <code>^D</code> (+control-d+) will be ignored or not.
+ #
+ # If set to +false+, <code>^D</code> will quit irb.
attr_accessor :ignore_eof
+ # Whether to echo the return value to output or not.
+ #
+ # Uses IRB.conf[:ECHO] if available, or defaults to +true+.
+ #
+ # puts "hello"
+ # # hello
+ # #=> nil
+ # IRB.CurrentContext.echo = false
+ # puts "omg"
+ # # omg
attr_accessor :echo
+ # Whether verbose messages are displayed or not.
+ #
+ # A copy of the default <code>IRB.conf[:VERBOSE]</code>
attr_accessor :verbose
+ # The debug level of irb
+ #
+ # See #debug_level= for more information.
attr_reader :debug_level
+ # The limit of backtrace lines displayed as top +n+ and tail +n+.
+ #
+ # The default value is 16.
+ #
+ # Can also be set using the +--back-trace-limit+ command line option.
+ #
+ # See IRB@Command+line+options for more command line options.
attr_accessor :back_trace_limit
+ # Alias for #use_readline
alias use_readline? use_readline
+ # Alias for #rc
alias rc? rc
alias ignore_sigint? ignore_sigint
alias ignore_eof? ignore_eof
alias echo? echo
+ # Returns whether messages are displayed or not.
def verbose?
if @verbose.nil?
if defined?(ReadlineInputMethod) && @io.kind_of?(ReadlineInputMethod)
@@ -155,18 +247,26 @@ module IRB
end
end
+ # Whether #verbose? is +true+, and +input_method+ is either
+ # StdioInputMethod or ReadlineInputMethod, see #io for more information.
def prompting?
verbose? || (STDIN.tty? && @io.kind_of?(StdioInputMethod) ||
(defined?(ReadlineInputMethod) && @io.kind_of?(ReadlineInputMethod)))
end
+ # The return value of the last statement evaluated.
attr_reader :last_value
+ # Sets the return value from the last statement evaluated in this context
+ # to #last_value.
def set_last_value(value)
@last_value = value
@workspace.evaluate self, "_ = IRB.CurrentContext.last_value"
end
+ # Sets the +mode+ of the prompt in this context.
+ #
+ # See IRB@Customizing+the+IRB+Prompt for more information.
def prompt_mode=(mode)
@prompt_mode = mode
pconf = IRB.conf[:PROMPT][mode]
@@ -182,26 +282,42 @@ module IRB
end
end
+ # Whether #inspect_mode is set or not, see #inspect_mode= for more detail.
def inspect?
@inspect_mode.nil? or @inspect_mode
end
+ # Whether #io uses a File for the +input_method+ passed when creating the
+ # current context, see ::new
def file_input?
@io.class == FileInputMethod
end
+ # Specifies the inspect mode with +opt+:
+ #
+ # +true+:: display +inspect+
+ # +false+:: display +to_s+
+ # +nil+:: inspect mode in non-math mode,
+ # non-inspect mode in math mode
+ #
+ # See IRB::Inspector for more information.
+ #
+ # Can also be set using the +--inspect+ and +--noinspect+ command line
+ # options.
+ #
+ # See IRB@Command+line+options for more command line options.
def inspect_mode=(opt)
- if i = INSPECTORS[opt]
+ if i = Inspector::INSPECTORS[opt]
@inspect_mode = opt
@inspect_method = i
i.init
else
case opt
when nil
- if INSPECTORS.keys_with_inspector(INSPECTORS[true]).include?(@inspect_mode)
+ if Inspector.keys_with_inspector(Inspector::INSPECTORS[true]).include?(@inspect_mode)
self.inspect_mode = false
- elsif INSPECTORS.keys_with_inspector(INSPECTORS[false]).include?(@inspect_mode)
+ elsif Inspector.keys_with_inspector(Inspector::INSPECTORS[false]).include?(@inspect_mode)
self.inspect_mode = true
else
puts "Can't switch inspect mode."
@@ -220,10 +336,10 @@ module IRB
when Inspector
prefix = "usr%d"
i = 1
- while INSPECTORS[format(prefix, i)]; i += 1; end
+ while Inspector::INSPECTORS[format(prefix, i)]; i += 1; end
@inspect_mode = format(prefix, i)
@inspect_method = opt
- INSPECTORS.def_inspector(format(prefix, i), @inspect_method)
+ Inspector.def_inspector(format(prefix, i), @inspect_method)
else
puts "Can't switch inspect mode(#{opt})."
return
@@ -233,44 +349,55 @@ module IRB
@inspect_mode
end
-
+ # Obsolete method.
+ #
+ # Can be set using the +--noreadline+ and +--readline+ command line
+ # options.
+ #
+ # See IRB@Command+line+options for more command line options.
def use_readline=(opt)
- @use_readline = opt
- print "use readline module\n" if @use_readline
+ print "This method is obsolete."
+ print "Do nothing."
end
+ # Sets the debug level of irb
+ #
+ # Can also be set using the +--irb_debug+ command line option.
+ #
+ # See IRB@Command+line+options for more command line options.
def debug_level=(value)
@debug_level = value
RubyLex.debug_level = value
- SLex.debug_level = value
end
+ # Whether or not debug mode is enabled, see #debug_level=.
def debug?
@debug_level > 0
end
- def evaluate(line, line_no)
+ 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
+ def inspect_last_value # :nodoc:
@inspect_method.inspect_value(@last_value)
end
alias __exit__ exit
+ # Exits the current session, see IRB.irb_exit
def exit(ret = 0)
IRB.irb_exit(@irb, ret)
end
- NOPRINTING_IVARS = ["@last_value"]
- NO_INSPECTING_IVARS = ["@irb", "@io"]
- IDNAME_IVARS = ["@prompt_mode"]
+ NOPRINTING_IVARS = ["@last_value"] # :nodoc:
+ NO_INSPECTING_IVARS = ["@irb", "@io"] # :nodoc:
+ IDNAME_IVARS = ["@prompt_mode"] # :nodoc:
alias __inspect__ inspect
- def inspect
+ def inspect # :nodoc:
array = []
for ivar in instance_variables.sort{|e1, e2| e1 <=> e2}
ivar = ivar.to_s
diff --git a/lib/irb/ext/change-ws.rb b/lib/irb/ext/change-ws.rb
index dea969d384..ce921eb5e3 100644
--- a/lib/irb/ext/change-ws.rb
+++ b/lib/irb/ext/change-ws.rb
@@ -9,9 +9,10 @@
#
#
-module IRB
+module IRB # :nodoc:
class Context
+ # Inherited from +TOPLEVEL_BINDING+.
def home_workspace
if defined? @home_workspace
@home_workspace
@@ -20,6 +21,13 @@ module IRB
end
end
+ # Changes the current workspace to given object or binding.
+ #
+ # If the optional argument is omitted, the workspace will be
+ # #home_workspace which is inherited from +TOPLEVEL_BINDING+ or the main
+ # object, <code>IRB.conf[:MAIN_CONTEXT]</code> when irb was initialized.
+ #
+ # See IRB::WorkSpace.new for more information.
def change_workspace(*_main)
if _main.empty?
@workspace = home_workspace
diff --git a/lib/irb/ext/history.rb b/lib/irb/ext/history.rb
index 1495f9eb14..3239c57a6c 100644
--- a/lib/irb/ext/history.rb
+++ b/lib/irb/ext/history.rb
@@ -9,12 +9,13 @@
#
#
-module IRB
+module IRB # :nodoc:
class Context
NOPRINTING_IVARS.push "@eval_history_values"
+ # See #set_last_value
alias _set_last_value set_last_value
def set_last_value(value)
@@ -29,7 +30,17 @@ module IRB
@last_value
end
+ # The command result history limit.
attr_reader :eval_history
+ # Sets command result history limit.
+ #
+ # +no+ is an Integer or +nil+.
+ #
+ # Returns +no+ of history items if greater than 0.
+ #
+ # If +no+ is 0, the number of history items is unlimited.
+ #
+ # If +no+ is +nil+, execution result history isn't used (default).
def eval_history=(no)
if no
if defined?(@eval_history) && @eval_history
@@ -47,7 +58,7 @@ module IRB
end
end
- class History
+ class History # :nodoc:
@RCS_ID='-$Id$-'
def initialize(size = 16)
diff --git a/lib/irb/ext/loader.rb b/lib/irb/ext/loader.rb
index 26a3203676..6cdc8ec898 100644
--- a/lib/irb/ext/loader.rb
+++ b/lib/irb/ext/loader.rb
@@ -10,15 +10,20 @@
#
-module IRB
+module IRB # :nodoc:
+ # Raised in the event of an exception in a file loaded from an Irb session
class LoadAbort < Exception;end
+ # Provides a few commands for loading files within an irb session.
+ #
+ # See ExtendCommandBundle for more information.
module IrbLoader
@RCS_ID='-$Id$-'
alias ruby_load load
alias ruby_require require
+ # Loads the given file similarly to Kernel#load
def irb_load(fn, priv = nil)
path = search_file_from_ruby_path(fn)
raise LoadError, "No such file to load -- #{fn}" unless path
@@ -26,7 +31,7 @@ module IRB
load_file(path, priv)
end
- def search_file_from_ruby_path(fn)
+ def search_file_from_ruby_path(fn) # :nodoc:
if /^#{Regexp.quote(File::Separator)}/ =~ fn
return fn if File.exist?(fn)
return nil
@@ -40,6 +45,9 @@ module IRB
return nil
end
+ # Loads a given file in the current session and displays the source lines
+ #
+ # 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
@@ -59,6 +67,9 @@ module IRB
end
end
+ # Loads the given file in the current session's context and evaluates it.
+ #
+ # See Irb#suspend_input_method for more information.
def load_file(path, priv = nil)
irb.suspend_name(path, File.basename(path)) do
@@ -87,7 +98,7 @@ module IRB
end
end
- def old
+ def old # :nodoc:
back_io = @io
back_path = @irb_path
back_name = @irb_name
diff --git a/lib/irb/ext/math-mode.rb b/lib/irb/ext/math-mode.rb
index 41be79841c..067eb1e7fa 100644
--- a/lib/irb/ext/math-mode.rb
+++ b/lib/irb/ext/math-mode.rb
@@ -12,11 +12,22 @@ require "mathn"
module IRB
class Context
+ # Returns whether bc mode is enabled.
+ #
+ # See #math_mode=
attr_reader :math_mode
+ # Alias for #math_mode
alias math? math_mode
+ # Sets bc mode, which loads +lib/mathn.rb+ so fractions or matrix are
+ # available.
+ #
+ # Also available as the +-m+ command line option.
+ #
+ # See IRB@Command+line+options and the unix manpage <code>bc(1)</code> for
+ # more information.
def math_mode=(opt)
- if @math_mode == true && opt == false
+ if @math_mode == true && !opt
IRB.fail CantReturnToNormalMode
return
end
diff --git a/lib/irb/ext/multi-irb.rb b/lib/irb/ext/multi-irb.rb
index a8475b75cd..e49a158fa3 100644
--- a/lib/irb/ext/multi-irb.rb
+++ b/lib/irb/ext/multi-irb.rb
@@ -12,44 +12,61 @@ IRB.fail CantShiftToMultiIrbMode unless defined?(Thread)
require "thread"
module IRB
- # job management class
class JobManager
@RCS_ID='-$Id$-'
+ # Creates a new JobManager object
def initialize
# @jobs = [[thread, irb],...]
@jobs = []
@current_job = nil
end
+ # The active irb session
attr_accessor :current_job
+ # The total number of irb sessions, used to set +irb_name+ of the current
+ # Context.
def n_jobs
@jobs.size
end
+ # Returns the thread for the given +key+ object, see #search for more
+ # information.
def thread(key)
th, = search(key)
th
end
+ # Returns the irb session for the given +key+ object, see #search for more
+ # information.
def irb(key)
_, irb = search(key)
irb
end
+ # Returns the top level thread.
def main_thread
@jobs[0][0]
end
+ # Returns the top level irb session.
def main_irb
@jobs[0][1]
end
+ # Add the given +irb+ session to the jobs Array.
def insert(irb)
@jobs.push [Thread.current, irb]
end
+ # Changes the current active irb session to the given +key+ in the jobs
+ # Array.
+ #
+ # Raises an IrbAlreadyDead exception if the given +key+ is no longer alive.
+ #
+ # If the given irb session is already active, an IrbSwitchedToCurrentThread
+ # exception is raised.
def switch(key)
th, irb = search(key)
IRB.fail IrbAlreadyDead unless th.alive?
@@ -60,6 +77,12 @@ module IRB
@current_job = irb(Thread.current)
end
+ # Terminates the irb sessions specified by the given +keys+.
+ #
+ # Raises an IrbAlreadyDead exception if one of the given +keys+ is already
+ # terminated.
+ #
+ # See Thread#exit for more information.
def kill(*keys)
for key in keys
th, _ = search(key)
@@ -68,6 +91,20 @@ module IRB
end
end
+ # Returns the associated job for the given +key+.
+ #
+ # If given an Integer, it will return the +key+ index for the jobs Array.
+ #
+ # When an instance of Irb is given, it will return the irb session
+ # associated with +key+.
+ #
+ # If given an instance of Thread, it will return the associated thread
+ # +key+ using Object#=== on the jobs Array.
+ #
+ # Otherwise returns the irb session with the same top-level binding as the
+ # given +key+.
+ #
+ # Raises a NoSuchJob exception if no job can be found with the given +key+.
def search(key)
job = case key
when Integer
@@ -83,6 +120,7 @@ module IRB
job
end
+ # Deletes the job at the given +key+.
def delete(key)
case key
when Integer
@@ -106,6 +144,7 @@ module IRB
@jobs.push assoc
end
+ # Outputs a list of jobs, see the irb command +irb_jobs+, or +jobs+.
def inspect
ary = []
@jobs.each_index do
@@ -135,15 +174,20 @@ module IRB
@JobManager = JobManager.new
+ # The current JobManager in the session
def IRB.JobManager
@JobManager
end
+ # The current Context in this session
def IRB.CurrentContext
IRB.JobManager.irb(Thread.current).context
end
- # invoke multi-irb
+ # Creates a new IRB session, see Irb.new.
+ #
+ # The optional +file+ argument is given to Context.new, along with the
+ # workspace created with the remaining arguments, see WorkSpace.new
def IRB.irb(file = nil, *main)
workspace = WorkSpace.new(*main)
parent_thread = Thread.current
diff --git a/lib/irb/ext/save-history.rb b/lib/irb/ext/save-history.rb
index f9c983ac11..7b3fcbbeec 100644
--- a/lib/irb/ext/save-history.rb
+++ b/lib/irb/ext/save-history.rb
@@ -11,21 +11,31 @@
require "readline"
module IRB
- module HistorySavingAbility
+ module HistorySavingAbility # :nodoc:
@RCS_ID='-$Id$-'
end
class Context
- def init_save_history
+ def init_save_history# :nodoc:
unless (class<<@io;self;end).include?(HistorySavingAbility)
@io.extend(HistorySavingAbility)
end
end
+ # A copy of the default <code>IRB.conf[:SAVE_HISTORY]</code>
def save_history
IRB.conf[:SAVE_HISTORY]
end
+ # Sets <code>IRB.conf[:SAVE_HISTORY]</code> to the given +val+ and calls
+ # #init_save_history with this context.
+ #
+ # Will store the number of +val+ entries of history in the #history_file
+ #
+ # Add the following to your +.irbrc+ to change the number of history
+ # entries stored to 1000:
+ #
+ # IRB.conf[:SAVE_HISTORY] = 1000
def save_history=(val)
IRB.conf[:SAVE_HISTORY] = val
if val
@@ -35,16 +45,18 @@ module IRB
end
end
+ # A copy of the default <code>IRB.conf[:HISTORY_FILE]</code>
def history_file
IRB.conf[:HISTORY_FILE]
end
+ # Set <code>IRB.conf[:HISTORY_FILE]</code> to the given +hist+.
def history_file=(hist)
IRB.conf[:HISTORY_FILE] = hist
end
end
- module HistorySavingAbility
+ module HistorySavingAbility # :nodoc:
include Readline
# def HistorySavingAbility.create_finalizer
@@ -87,7 +99,18 @@ module IRB
history_file = File.expand_path(history_file)
end
history_file = IRB.rc_file("_history") unless history_file
- open(history_file, 'w' ) do |f|
+
+ # 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
diff --git a/lib/irb/ext/tracer.rb b/lib/irb/ext/tracer.rb
index 46a9d53a2e..8c9083dbad 100644
--- a/lib/irb/ext/tracer.rb
+++ b/lib/irb/ext/tracer.rb
@@ -23,9 +23,16 @@ module IRB
end
class Context
+ # Whether Tracer is used when evaluating statements in this context.
+ #
+ # See +lib/tracer.rb+ for more information.
attr_reader :use_tracer
alias use_tracer? use_tracer
+ # Sets whether or not to use the Tracer library when evaluating statements
+ # in this context.
+ #
+ # See +lib/tracer.rb+ for more information.
def use_tracer=(opt)
if opt
Tracer.set_get_line_procs(@irb_path) {
@@ -41,6 +48,10 @@ module IRB
class WorkSpace
alias __evaluate__ evaluate
+ # Evaluate the context of this workspace and use the Tracer library to
+ # output the exact lines of code are being executed in chronological order.
+ #
+ # 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
diff --git a/lib/irb/ext/use-loader.rb b/lib/irb/ext/use-loader.rb
index 64283b8989..4e98f5b7a2 100644
--- a/lib/irb/ext/use-loader.rb
+++ b/lib/irb/ext/use-loader.rb
@@ -19,9 +19,11 @@ end
module IRB
module ExtendCommandBundle
+ # Loads the given file similarly to Kernel#load, see IrbLoader#irb_load
def irb_load(*opts, &b)
ExtendCommand::Load.execute(irb_context, *opts, &b)
end
+ # Loads the given file similarly to Kernel#require
def irb_require(*opts, &b)
ExtendCommand::Require.execute(irb_context, *opts, &b)
end
@@ -31,12 +33,19 @@ module IRB
IRB.conf[:USE_LOADER] = false
+ # Returns whether +irb+'s own file reader method is used by
+ # +load+/+require+ or not.
+ #
+ # This mode is globally affected (irb-wide).
def use_loader
IRB.conf[:USE_LOADER]
end
alias use_loader? use_loader
+ # Sets IRB.conf[:USE_LOADER]
+ #
+ # See #use_loader for more information.
def use_loader=(opt)
if IRB.conf[:USE_LOADER] != opt
diff --git a/lib/irb/ext/workspaces.rb b/lib/irb/ext/workspaces.rb
index 118ea598c0..641befbdf3 100644
--- a/lib/irb/ext/workspaces.rb
+++ b/lib/irb/ext/workspaces.rb
@@ -9,13 +9,15 @@
#
#
-module IRB
+module IRB # :nodoc:
class Context
+ # Size of the current WorkSpace stack
def irb_level
workspace_stack.size
end
+ # WorkSpaces in the current stack
def workspaces
if defined? @workspaces
@workspaces
@@ -24,6 +26,11 @@ module IRB
end
end
+ # Creates a new workspace with the given object or binding, and appends it
+ # onto the current #workspaces stack.
+ #
+ # See IRB::Context#change_workspace and IRB::WorkSpace.new for more
+ # information.
def push_workspace(*_main)
if _main.empty?
if workspaces.empty?
@@ -43,6 +50,10 @@ module IRB
end
end
+ # Removes the last element from the current #workspaces stack and returns
+ # it, or +nil+ if the current workspace stack is empty.
+ #
+ # Also, see #push_workspace.
def pop_workspace
if workspaces.empty?
print "workspace stack empty\n"
diff --git a/lib/irb/extend-command.rb b/lib/irb/extend-command.rb
index 190c49ae78..487c0bbeff 100644
--- a/lib/irb/extend-command.rb
+++ b/lib/irb/extend-command.rb
@@ -8,21 +8,30 @@
#
#
#
-module IRB
- #
- # IRB extended command
- #
+module IRB # :nodoc:
+ # Installs the default irb extensions command bundle.
module ExtendCommandBundle
- EXCB = ExtendCommandBundle
+ EXCB = ExtendCommandBundle # :nodoc:
+ # See #install_alias_method.
NO_OVERRIDE = 0
+ # See #install_alias_method.
OVERRIDE_PRIVATE_ONLY = 0x01
+ # See #install_alias_method.
OVERRIDE_ALL = 0x02
+ # Quits the current irb context
+ #
+ # +ret+ is the optional signal or message to send to Context#exit
+ #
+ # Same as <code>IRB.CurrentContext.exit</code>.
def irb_exit(ret = 0)
irb_context.exit(ret)
end
+ # Displays current configuration.
+ #
+ # Modifing the configuration is achieved by sending a message to IRB.conf.
def irb_context
IRB.CurrentContext
end
@@ -105,13 +114,33 @@ module IRB
]
+ # Installs the default irb commands:
+ #
+ # +irb_current_working_workspace+:: Context#main
+ # +irb_change_workspace+:: Context#change_workspace
+ # +irb_workspaces+:: Context#workspaces
+ # +irb_push_workspace+:: Context#push_workspace
+ # +irb_pop_workspace+:: Context#pop_workspace
+ # +irb_load+:: #irb_load
+ # +irb_require+:: #irb_require
+ # +irb_source+:: IrbLoader#source_file
+ # +irb+:: IRB.irb
+ # +irb_jobs+:: JobManager
+ # +irb_fg+:: JobManager#switch
+ # +irb_kill+:: JobManager#kill
+ # +irb_help+:: IRB@Command+line+options
def self.install_extend_commands
for args in @EXTEND_COMMANDS
def_extend_command(*args)
end
end
- # aliases = [commands_alias, flag], ...
+ # Evaluate the given +cmd_name+ on the given +cmd_class+ Class.
+ #
+ # Will also define any given +aliases+ for the method.
+ #
+ # The optional +load_file+ parameter will be required within the method
+ # definition.
def self.def_extend_command(cmd_name, cmd_class, load_file = nil, *aliases)
case cmd_class
when Symbol
@@ -151,7 +180,8 @@ module IRB
end
end
- # override = {NO_OVERRIDE, OVERRIDE_PRIVATE_ONLY, OVERRIDE_ALL}
+ # Installs alias methods for the default irb commands, see
+ # ::install_extend_commands.
def install_alias_method(to, from, override = NO_OVERRIDE)
to = to.id2name unless to.kind_of?(String)
from = from.id2name unless from.kind_of?(String)
@@ -172,10 +202,12 @@ module IRB
end
end
- def self.irb_original_method_name(method_name)
+ def self.irb_original_method_name(method_name) # :nodoc:
"irb_" + method_name + "_org"
end
+ # Installs alias methods for the default irb commands on the given object
+ # using #install_alias_method.
def self.extend_object(obj)
unless (class << obj; ancestors; end).include?(EXCB)
super
@@ -188,9 +220,9 @@ module IRB
install_extend_commands
end
- # extension support for Context
+ # Extends methods for the Context module
module ContextExtender
- CE = ContextExtender
+ CE = ContextExtender # :nodoc:
@EXTEND_COMMANDS = [
[:eval_history=, "irb/ext/history.rb"],
@@ -200,12 +232,23 @@ module IRB
[:save_history=, "irb/ext/save-history.rb"],
]
+ # Installs the default context extensions as irb commands:
+ #
+ # Context#eval_history=:: +irb/ext/history.rb+
+ # Context#use_tracer=:: +irb/ext/tracer.rb+
+ # Context#math_mode=:: +irb/ext/math-mode.rb+
+ # Context#use_loader=:: +irb/ext/use-loader.rb+
+ # Context#save_history=:: +irb/ext/save-history.rb+
def self.install_extend_commands
for args in @EXTEND_COMMANDS
def_extend_command(*args)
end
end
+ # Evaluate the given +command+ from the given +load_file+ on the Context
+ # module.
+ #
+ # Will also define any given +aliases+ for the method.
def self.def_extend_command(cmd_name, load_file, *aliases)
line = __LINE__; Context.module_eval %[
def #{cmd_name}(*opts, &b)
@@ -222,7 +265,10 @@ module IRB
CE.install_extend_commands
end
+ # A convenience module for extending Ruby methods.
module MethodExtender
+ # Extends the given +base_method+ with a prefix call to the given
+ # +extend_method+.
def def_pre_proc(base_method, extend_method)
base_method = base_method.to_s
extend_method = extend_method.to_s
@@ -237,6 +283,8 @@ module IRB
]
end
+ # Extends the given +base_method+ with a postfix call to the given
+ # +extend_method+.
def def_post_proc(base_method, extend_method)
base_method = base_method.to_s
extend_method = extend_method.to_s
@@ -251,7 +299,13 @@ module IRB
]
end
- # return #{prefix}#{name}#{postfix}<num>
+ # Returns a unique method name to use as an alias for the given +name+.
+ #
+ # Usually returns <code>#{prefix}#{name}#{postfix}<num></code>, example:
+ #
+ # new_alias_name('foo') #=> __alias_of__foo__
+ # def bar; end
+ # new_alias_name('bar') #=> __alias_of__bar__2
def new_alias_name(name, prefix = "__alias_of__", postfix = "__")
base_name = "#{prefix}#{name}#{postfix}"
all_methods = instance_methods(true) + private_instance_methods(true)
diff --git a/lib/irb/frame.rb b/lib/irb/frame.rb
index 8814b47a9d..bcfa3a3140 100644
--- a/lib/irb/frame.rb
+++ b/lib/irb/frame.rb
@@ -17,13 +17,17 @@ module IRB
def_exception :FrameOverflow, "frame overflow"
def_exception :FrameUnderflow, "frame underflow"
+ # Default number of stack frames
INIT_STACK_TIMES = 3
+ # Default number of frames offset
CALL_STACK_OFFSET = 3
+ # Creates a new stack frame
def initialize
@frames = [TOPLEVEL_BINDING] * INIT_STACK_TIMES
end
+ # Used by Kernel#set_trace_func to register each event in the call stack
def trace_func(event, file, line, id, binding)
case event
when 'call', 'class'
@@ -33,27 +37,37 @@ module IRB
end
end
+ # Returns the +n+ number of frames on the call stack from the last frame
+ # initialized.
+ #
+ # Raises FrameUnderflow if there are no frames in the given stack range.
def top(n = 0)
bind = @frames[-(n + CALL_STACK_OFFSET)]
Fail FrameUnderflow unless bind
bind
end
+ # Returns the +n+ number of frames on the call stack from the first frame
+ # initialized.
+ #
+ # Raises FrameOverflow if there are no frames in the given stack range.
def bottom(n = 0)
bind = @frames[n]
Fail FrameOverflow unless bind
bind
end
- # singleton functions
+ # Convenience method for Frame#bottom
def Frame.bottom(n = 0)
@backtrace.bottom(n)
end
+ # Convenience method for Frame#top
def Frame.top(n = 0)
@backtrace.top(n)
end
+ # Returns the binding context of the caller from the last frame initialized
def Frame.sender
eval "self", @backtrace.top
end
diff --git a/lib/irb/help.rb b/lib/irb/help.rb
index 4a308b6e46..9fd734038f 100644
--- a/lib/irb/help.rb
+++ b/lib/irb/help.rb
@@ -12,6 +12,7 @@
require 'irb/magic-file'
module IRB
+ # Outputs the irb help message, see IRB@Command+line+options.
def IRB.print_usage
lc = IRB.conf[:LC_MESSAGES]
path = lc.find("irb/help-message")
diff --git a/lib/irb/init.rb b/lib/irb/init.rb
index fce2df4f09..826bcaf3ac 100644
--- a/lib/irb/init.rb
+++ b/lib/irb/init.rb
@@ -9,7 +9,7 @@
#
#
-module IRB
+module IRB # :nodoc:
# initialize config
def IRB.setup(ap_path)
@@ -115,7 +115,7 @@ module IRB
@CONF[:AT_EXIT] = []
- @CONF[:DEBUG_LEVEL] = 1
+ @CONF[:DEBUG_LEVEL] = 0
end
def IRB.init_error
@@ -197,7 +197,7 @@ module IRB
@CONF[:CONTEXT_MODE] = ($1 || ARGV.shift).to_i
when "--single-irb"
@CONF[:SINGLE_IRB] = true
- when /^--irb_debug=(?:=(.+))?/
+ when /^--irb_debug(?:=(.+))?/
@CONF[:DEBUG_LEVEL] = ($1 || ARGV.shift).to_i
when "-v", "--version"
print IRB.version, "\n"
@@ -256,7 +256,12 @@ module IRB
end
end
end
- @CONF[:RC_NAME_GENERATOR].call ext
+ case rc_file = @CONF[:RC_NAME_GENERATOR].call(ext)
+ when String
+ return rc_file
+ else
+ IRB.fail IllegalRCNameGenerator
+ end
end
# enumerate possible rc-file base name generators
diff --git a/lib/irb/input-method.rb b/lib/irb/input-method.rb
index 7227df4ca0..55363fe0c4 100644
--- a/lib/irb/input-method.rb
+++ b/lib/irb/input-method.rb
@@ -12,34 +12,39 @@ require 'irb/src_encoding'
require 'irb/magic-file'
module IRB
- #
- # InputMethod
- # StdioInputMethod
- # FileInputMethod
- # (ReadlineInputMethod)
- #
- STDIN_FILE_NAME = "(line)"
+ STDIN_FILE_NAME = "(line)" # :nodoc:
class InputMethod
@RCS_ID='-$Id$-'
+ # Creates a new input method object
def initialize(file = STDIN_FILE_NAME)
@file_name = file
end
+ # The file name of this input method, usually given during initialization.
attr_reader :file_name
+ # The irb prompt associated with this input method
attr_accessor :prompt
+ # Reads the next line from this input method.
+ #
+ # See IO#gets for more information.
def gets
IRB.fail NotImplementedError, "gets"
end
public :gets
- def readable_atfer_eof?
+ # Whether this input method is still readable when there is no more data to
+ # read.
+ #
+ # See IO#eof for more information.
+ def readable_after_eof?
false
end
end
class StdioInputMethod < InputMethod
+ # Creates a new input method object
def initialize
super
@line_no = 0
@@ -48,40 +53,67 @@ module IRB
@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.
+ #
+ # See IO#gets for more information.
def gets
print @prompt
line = @stdin.gets
@line[@line_no += 1] = line
end
+ # Whether the end of this input method has been reached, returns +true+ if
+ # there is no more data to read.
+ #
+ # See IO#eof? for more information.
def eof?
@stdin.eof?
end
- def readable_atfer_eof?
+ # Whether this input method is still readable when there is no more data to
+ # read.
+ #
+ # See IO#eof for more information.
+ def readable_after_eof?
true
end
+ # Returns the current line number for #io.
+ #
+ # #line counts the number of times #gets is called.
+ #
+ # See IO#lineno for more information.
def line(line_no)
@line[line_no]
end
+ # The external encoding for standard input.
def encoding
@stdin.external_encoding
end
end
+ # Use a File for IO with irb, see InputMethod
class FileInputMethod < InputMethod
+ # Creates a new input method object
def initialize(file)
super
@io = IRB::MagicFile.open(file)
end
+ # The file name of this input method, usually given during initialization.
attr_reader :file_name
+ # Whether the end of this input method has been reached, returns +true+ if
+ # there is no more data to read.
+ #
+ # See IO#eof? for more information.
def eof?
@io.eof?
end
+ # Reads the next line from this input method.
+ #
+ # See IO#gets for more information.
def gets
print @prompt
l = @io.gets
@@ -89,6 +121,7 @@ module IRB
l
end
+ # The external encoding for standard input.
def encoding
@io.external_encoding
end
@@ -98,6 +131,7 @@ module IRB
require "readline"
class ReadlineInputMethod < InputMethod
include Readline
+ # Creates a new input method object using Readline
def initialize
super
@@ -109,6 +143,9 @@ module IRB
@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.
+ #
+ # See IO#gets for more information.
def gets
Readline.input = @stdin
Readline.output = @stdout
@@ -121,18 +158,32 @@ module IRB
end
end
+ # Whether the end of this input method has been reached, returns +true+
+ # if there is no more data to read.
+ #
+ # See IO#eof? for more information.
def eof?
@eof
end
- def readable_atfer_eof?
+ # Whether this input method is still readable when there is no more data to
+ # read.
+ #
+ # See IO#eof for more information.
+ def readable_after_eof?
true
end
+ # Returns the current line number for #io.
+ #
+ # #line counts the number of times #gets is called.
+ #
+ # See IO#lineno for more information.
def line(line_no)
@line[line_no]
end
+ # The external encoding for standard input.
def encoding
@stdin.external_encoding
end
diff --git a/lib/irb/inspector.rb b/lib/irb/inspector.rb
index aefe077f37..eaff44fc0b 100644
--- a/lib/irb/inspector.rb
+++ b/lib/irb/inspector.rb
@@ -10,86 +10,122 @@
#
#
-module IRB
+module IRB # :nodoc:
+
+ # Convenience method to create a new Inspector, using the given +inspect+
+ # proc, and optional +init+ proc and passes them to Inspector.new
+ #
+ # irb(main):001:0> ins = IRB::Inspector(proc{ |v| "omg! #{v}" })
+ # irb(main):001:0> IRB.CurrentContext.inspect_mode = ins # => omg! #<IRB::Inspector:0x007f46f7ba7d28>
+ # irb(main):001:0> "what?" #=> omg! what?
+ #
def IRB::Inspector(inspect, init = nil)
Inspector.new(inspect, init)
end
+ # An irb inspector
+ #
+ # In order to create your own custom inspector there are two things you
+ # should be aware of:
+ #
+ # Inspector uses #inspect_value, or +inspect_proc+, for output of return values.
+ #
+ # This also allows for an optional #init+, or +init_proc+, which is called
+ # when the inspector is activated.
+ #
+ # Knowing this, you can create a rudimentary inspector as follows:
+ #
+ # irb(main):001:0> ins = IRB::Inspector.new(proc{ |v| "omg! #{v}" })
+ # irb(main):001:0> IRB.CurrentContext.inspect_mode = ins # => omg! #<IRB::Inspector:0x007f46f7ba7d28>
+ # irb(main):001:0> "what?" #=> omg! what?
+ #
class Inspector
+ # Default inspectors available to irb, this includes:
+ #
+ # +:pp+:: Using Kernel#pretty_inspect
+ # +:yaml+:: Using YAML.dump
+ # +:marshal+:: Using Marshal.dump
+ INSPECTORS = {}
+
+ # Determines the inspector to use where +inspector+ is one of the keys passed
+ # during inspector definition.
+ def self.keys_with_inspector(inspector)
+ INSPECTORS.select{|k,v| v == inspector}.collect{|k, v| k}
+ end
+
+ # Example
+ #
+ # Inspector.def_inspector(key, init_p=nil){|v| v.inspect}
+ # Inspector.def_inspector([key1,..], init_p=nil){|v| v.inspect}
+ # 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
+ inspector = arg
+ end
+
+ case key
+ when Array
+ for k in key
+ def_inspector(k, inspector)
+ end
+ when Symbol
+ INSPECTORS[key] = inspector
+ INSPECTORS[key.to_s] = inspector
+ when String
+ INSPECTORS[key] = inspector
+ INSPECTORS[key.intern] = inspector
+ else
+ INSPECTORS[key] = inspector
+ end
+ end
+
+ # Creates a new inspector object, using the given +inspect_proc+ when
+ # output return values in irb.
def initialize(inspect_proc, init_proc = nil)
@init = init_proc
@inspect = inspect_proc
end
+ # Proc to call when the inspector is activated, good for requiring
+ # dependant libraries.
def init
@init.call if @init
end
+ # Proc to call when the input is evaluated and output in irb.
def inspect_value(v)
@inspect.call(v)
end
end
- INSPECTORS = {}
-
- def INSPECTORS.keys_with_inspector(inspector)
- select{|k,v| v == inspector}.collect{|k, v| k}
- end
-
- # ex)
- # INSPECTORS.def_inspector(key, init_p=nil){|v| v.inspect}
- # INSPECTORS.def_inspector([key1,..], init_p=nil){|v| v.inspect}
- # INSPECTORS.def_inspector(key, inspector)
- # INSPECTORS.def_inspector([key1,...], inspector)
-
- def INSPECTORS.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
- inspector = arg
- end
-
- case key
- when Array
- for k in key
- def_inspector(k, inspector)
- end
- when Symbol
- self[key] = inspector
- self[key.to_s] = inspector
- when String
- self[key] = inspector
- self[key.intern] = inspector
- else
- self[key] = inspector
- end
- end
-
- INSPECTORS.def_inspector([false, :to_s, :raw]){|v| v.to_s}
- INSPECTORS.def_inspector([true, :p, :inspect]){|v|
+ Inspector.def_inspector([false, :to_s, :raw]){|v| v.to_s}
+ Inspector.def_inspector([true, :p, :inspect]){|v|
begin
v.inspect
rescue NoMethodError
puts "(Object doesn't support #inspect)"
end
}
- INSPECTORS.def_inspector([:pp, :pretty_inspect], proc{require "pp"}){|v| v.pretty_inspect.chomp}
- INSPECTORS.def_inspector([:yaml, :YAML], proc{require "yaml"}){|v|
+ Inspector.def_inspector([:pp, :pretty_inspect], proc{require "pp"}){|v| v.pretty_inspect.chomp}
+ Inspector.def_inspector([:yaml, :YAML], proc{require "yaml"}){|v|
begin
YAML.dump(v)
rescue
@@ -98,7 +134,7 @@ module IRB
end
}
- INSPECTORS.def_inspector([:marshal, :Marshal, :MARSHAL, Marshal]){|v|
+ Inspector.def_inspector([:marshal, :Marshal, :MARSHAL, Marshal]){|v|
Marshal.dump(v)
}
end
diff --git a/lib/irb/lc/.document b/lib/irb/lc/.document
new file mode 100644
index 0000000000..524bb9430b
--- /dev/null
+++ b/lib/irb/lc/.document
@@ -0,0 +1,4 @@
+# hide help-message files which contain usage information
+error.rb
+ja/encoding_aliases.rb
+ja/error.rb
diff --git a/lib/irb/lc/error.rb b/lib/irb/lc/error.rb
index 742821e3af..c0c6c30d79 100644
--- a/lib/irb/lc/error.rb
+++ b/lib/irb/lc/error.rb
@@ -10,6 +10,7 @@
#
require "e2mmap"
+# :stopdoc:
module IRB
# exceptions
@@ -24,6 +25,7 @@ module IRB
def_exception :CantShiftToMultiIrbMode, "Can't shift to multi irb mode."
def_exception :CantChangeBinding, "Can't change binding to (%s)."
def_exception :UndefinedPromptMode, "Undefined prompt mode(%s)."
+ def_exception :IllegalRCGenerator, 'Define illegal RC_NAME_GENERATOR.'
end
-
+# :startdoc:
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/encoding_aliases.rb b/lib/irb/lc/ja/encoding_aliases.rb
index a713dff4be..5bef32e20e 100644
--- a/lib/irb/lc/ja/encoding_aliases.rb
+++ b/lib/irb/lc/ja/encoding_aliases.rb
@@ -1,3 +1,4 @@
+# :stopdoc:
module IRB
class Locale
@@legacy_encoding_alias_map = {
@@ -6,3 +7,4 @@ module IRB
}.freeze
end
end
+# :startdoc:
diff --git a/lib/irb/lc/ja/error.rb b/lib/irb/lc/ja/error.rb
index 9a7670f459..4f09d781cb 100644
--- a/lib/irb/lc/ja/error.rb
+++ b/lib/irb/lc/ja/error.rb
@@ -10,6 +10,7 @@
#
require "e2mmap"
+# :stopdoc:
module IRB
# exceptions
extend Exception2MessageMapper
@@ -23,5 +24,7 @@ module IRB
def_exception :CantShiftToMultiIrbMode, 'multi-irb modeã«ç§»ã‚Œã¾ã›ã‚“.'
def_exception :CantChangeBinding, 'ãƒã‚¤ãƒ³ãƒ‡ã‚£ãƒ³ã‚°(%s)ã«å¤‰æ›´ã§ãã¾ã›ã‚“.'
def_exception :UndefinedPromptMode, 'プロンプトモード(%s)ã¯å®šç¾©ã•れã¦ã„ã¾ã›ã‚“.'
+ def_exception :IllegalRCNameGenerator, 'RC_NAME_GENERATORãŒæ­£ã—ã定義ã•れã¦ã„ã¾ã›ã‚“.'
end
+# :startdoc:
# 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 7781006da4..accce9e13f 100644
--- a/lib/irb/locale.rb
+++ b/lib/irb/locale.rb
@@ -8,7 +8,7 @@
#
#
#
-module IRB
+module IRB # :nodoc:
class Locale
@RCS_ID='-$Id$-'
diff --git a/lib/irb/notifier.rb b/lib/irb/notifier.rb
index d20679da4a..effb12c30d 100644
--- a/lib/irb/notifier.rb
+++ b/lib/irb/notifier.rb
@@ -13,6 +13,7 @@ require "e2mmap"
require "irb/output-method"
module IRB
+ # An output formatter used internally by the lexer.
module Notifier
extend Exception2MessageMapper
def_exception :ErrUndefinedNotifier,
@@ -20,59 +21,100 @@ module IRB
def_exception :ErrUnrecognizedLevel,
"unrecognized notifier level: %s is specified"
+ # Define a new Notifier output source, returning a new CompositeNotifier
+ # with the given +prefix+ and +output_method+.
+ #
+ # 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
+ # expressions will be sent directly to STDOUT without any additional
+ # formatting.
def def_notifier(prefix = "", output_method = StdioOutputMethod.new)
CompositeNotifier.new(prefix, output_method)
end
module_function :def_notifier
+ # An abstract class, or superclass, for CompositeNotifier and
+ # LeveledNotifier to inherit. It provides several wrapper methods for the
+ # OutputMethod object used by the Notifier.
class AbstractNotifier
+ # Creates a new Notifier object
def initialize(prefix, base_notifier)
@prefix = prefix
@base_notifier = base_notifier
end
+ # The +prefix+ for this Notifier, which is appended to all objects being
+ # inspected during output.
attr_reader :prefix
+ # A wrapper method used to determine whether notifications are enabled.
+ #
+ # Defaults to +true+.
def notify?
true
end
+ # See OutputMethod#print for more detail.
def print(*opts)
@base_notifier.print prefix, *opts if notify?
end
+ # See OutputMethod#printn for more detail.
def printn(*opts)
@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?
end
+ # See OutputMethod#puts for more detail.
def puts(*objs)
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
end
+ # Same as #pp, except it concatenates the given +prefix+ with the #prefix
+ # given during object initialization.
+ #
+ # See OutputMethod#ppx for more detail.
def ppx(prefix, *objs)
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?
end
end
+ # A class that can be used to create a group of notifier objects with the
+ # intent of representing a leveled notification system for irb.
+ #
+ # This class will allow you to generate other notifiers, and assign them
+ # the appropriate level for output.
+ #
+ # The Notifier class provides a class-method Notifier.def_notifier to
+ # create a new composite notifier. Using the first composite notifier
+ # object you create, sibling notifiers can be initialized with
+ # #def_notifier.
class CompositeNotifier<AbstractNotifier
+ # Create a new composite notifier object with the given +prefix+, and
+ # +base_notifier+ to use for output.
def initialize(prefix, base_notifier)
super
@@ -80,17 +122,39 @@ module IRB
@level_notifier = D_NOMSG
end
+ # List of notifiers in the group
attr_reader :notifiers
+ # Creates a new LeveledNotifier in the composite #notifiers group.
+ #
+ # The given +prefix+ will be assigned to the notifier, and +level+ will
+ # be used as the index of the #notifiers Array.
+ #
+ # This method returns the newly created instance.
def def_notifier(level, prefix = "")
notifier = LeveledNotifier.new(self, level, prefix)
@notifiers[level] = notifier
notifier
end
+ # Returns the leveled notifier for this object
attr_reader :level_notifier
alias level level_notifier
+ # Sets the leveled notifier for this object.
+ #
+ # When the given +value+ is an instance of AbstractNotifier,
+ # #level_notifier is set to the given object.
+ #
+ # When an Integer is given, #level_notifier is set to the notifier at the
+ # index +value+ in the #notifiers Array.
+ #
+ # If no notifier exists at the index +value+ in the #notifiers Array, an
+ # ErrUndefinedNotifier exception is raised.
+ #
+ # An ErrUnrecognizedLevel exception is raised if the given +value+ is not
+ # found in the existing #notifiers Array, or an instance of
+ # AbstractNotifier
def level_notifier=(value)
case value
when AbstractNotifier
@@ -107,38 +171,61 @@ module IRB
alias level= level_notifier=
end
+ # A leveled notifier is comparable to the composite group from
+ # CompositeNotifier#notifiers.
class LeveledNotifier<AbstractNotifier
include Comparable
+ # Create a new leveled notifier with the given +base+, and +prefix+ to
+ # send to AbstractNotifier.new
+ #
+ # The given +level+ is used to compare other leveled notifiers in the
+ # CompositeNotifier group to determine whether or not to output
+ # notifications.
def initialize(base, level, prefix)
super(prefix, base)
@level = level
end
+ # The current level of this notifier object
attr_reader :level
+ # Compares the level of this notifier object with the given +other+
+ # notifier.
+ #
+ # See the Comparable module for more information.
def <=>(other)
@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
end
end
+ # NoMsgNotifier is a LeveledNotifier that's used as the default notifier
+ # when creating a new CompositeNotifier.
+ #
+ # This notifier is used as the +zero+ index, or level +0+, for
+ # CompositeNotifier#notifiers, and will not output messages of any sort.
class NoMsgNotifier<LeveledNotifier
+ # Creates a new notifier that should not be used to output messages.
def initialize
@base_notifier = nil
@level = 0
@prefix = ""
end
+ # Ensures notifications are ignored, see AbstractNotifier#notify? for
+ # more information.
def notify?
false
end
end
- D_NOMSG = NoMsgNotifier.new
+ D_NOMSG = NoMsgNotifier.new # :nodoc:
end
end
diff --git a/lib/irb/output-method.rb b/lib/irb/output-method.rb
index 9cccda1c6a..aae9e2294d 100644
--- a/lib/irb/output-method.rb
+++ b/lib/irb/output-method.rb
@@ -12,21 +12,27 @@
require "e2mmap"
module IRB
- # OutputMethod
- # StdioOutputMethod
-
+ # An abstract output class for IO in irb. This is mainly used internally by
+ # IRB::Notifier. You can define your own output method to use with Irb.new,
+ # or Context.new
class OutputMethod
- @RCS_ID='-$Id$-'
+ extend Exception2MessageMapper
+ def_exception :NotImplementedError, "Need to define `%s'"
+
+ # Open this method to implement your own output method, raises a
+ # NotImplementedError if you don't define #print in your own class.
def print(*opts)
- IRB.fail NotImplementError, "print"
+ OutputMethod.Raise NotImplementedError, "print"
end
+ # Prints the given +opts+, with a newline delimiter.
def printn(*opts)
print opts.join(" "), "\n"
end
- # extend printf
+ # Extends IO#printf to format the given +opts+ for Kernel#sprintf using
+ # #parse_printf_format
def printf(format, *opts)
if /(%*)%I/ =~ format
format, opts = parse_printf_format(format, opts)
@@ -34,16 +40,22 @@ module IRB
print sprintf(format, *opts)
end
- # %
- # <flag> [#0- +]
- # <minimum field width> (\*|\*[1-9][0-9]*\$|[1-9][0-9]*)
- # <precision>.(\*|\*[1-9][0-9]*\$|[1-9][0-9]*|)?
- # #<length modifier>(hh|h|l|ll|L|q|j|z|t)
- # <conversion specifier>[diouxXeEfgGcsb%]
+ # Returns an array of the given +format+ and +opts+ to be used by
+ # Kernel#sprintf, if there was a successful Regexp match in the given
+ # +format+ from #printf
+ #
+ # %
+ # <flag> [#0- +]
+ # <minimum field width> (\*|\*[1-9][0-9]*\$|[1-9][0-9]*)
+ # <precision>.(\*|\*[1-9][0-9]*\$|[1-9][0-9]*|)?
+ # #<length modifier>(hh|h|l|ll|L|q|j|z|t)
+ # <conversion specifier>[diouxXeEfgGcsb%]
def parse_printf_format(format, opts)
return format, opts if $1.size % 2 == 1
end
+ # Calls #print on each element in the given +objs+, followed by a newline
+ # character.
def puts(*objs)
for obj in objs
print(*obj)
@@ -51,17 +63,27 @@ module IRB
end
end
+ # Prints the given +objs+ calling Object#inspect on each.
+ #
+ # See #puts for more detail.
def pp(*objs)
puts(*objs.collect{|obj| obj.inspect})
end
+ # Prints the given +objs+ calling Object#inspect on each and appending the
+ # given +prefix+.
+ #
+ # See #puts for more detail.
def ppx(prefix, *objs)
puts(*objs.collect{|obj| prefix+obj.inspect})
end
end
+ # A standard output printer
class StdioOutputMethod<OutputMethod
+ # Prints the given +opts+ to standard output, see IO#print for more
+ # information.
def print(*opts)
STDOUT.print(*opts)
end
diff --git a/lib/irb/ruby-lex.rb b/lib/irb/ruby-lex.rb
index 2a23534bf3..4a700b3324 100644
--- a/lib/irb/ruby-lex.rb
+++ b/lib/irb/ruby-lex.rb
@@ -13,6 +13,7 @@ require "e2mmap"
require "irb/slex"
require "irb/ruby-token"
+# :stopdoc:
class RubyLex
@RCS_ID='-$Id$-'
@@ -53,6 +54,7 @@ class RubyLex
@lex_state = EXPR_BEG
@space_seen = false
@here_header = false
+ @post_symbeg = false
@continue = false
@line = ""
@@ -86,8 +88,8 @@ class RubyLex
end
def get_readed
- if idx = @readed.reverse.index("\n")
- @base_char_no = idx
+ if idx = @readed.rindex("\n")
+ @base_char_no = @readed.size - (idx + 1)
else
@base_char_no += @readed.size
end
@@ -151,8 +153,8 @@ class RubyLex
@seek -= 1
if c == "\n"
@line_no -= 1
- if idx = @readed.reverse.index("\n")
- @char_no = @readed.size - idx
+ if idx = @readed.rindex("\n")
+ @char_no = idx + 1
else
@char_no = @base_char_no + @readed.size
end
@@ -217,6 +219,8 @@ class RubyLex
@here_header = false
@continue = false
+ @post_symbeg = false
+
prompt
@line = ""
@@ -285,6 +289,8 @@ class RubyLex
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)
rescue SyntaxError
raise if @exception_on_syntax_error
tk = TkError.new(@seek, @line_no, @char_no)
@@ -311,6 +317,8 @@ class RubyLex
"r" => "/",
"w" => "]",
"W" => "]",
+ "i" => "]",
+ "I" => "]",
"s" => ":"
}
@@ -539,7 +547,7 @@ class RubyLex
@lex_state = EXPR_BEG
Token(TkCOLON)
else
- @lex_state = EXPR_FNAME;
+ @lex_state = EXPR_FNAME
Token(TkSYMBEG)
end
end
@@ -904,10 +912,25 @@ class RubyLex
end
@here_header = false
- while l = gets
- l = l.sub(/(:?\r)?\n\z/, '')
- if (indent ? l.strip : l) == quoted
- break
+# 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 = ""
+ else
+ line.concat ch unless indent && line == "" && /\s/ =~ ch
+ if @ltype != "'" && ch == "#" && peek(0) == "{"
+ identify_string_dvar
+ end
end
end
@@ -1185,3 +1208,4 @@ class RubyLex
end
end
end
+# :startdoc:
diff --git a/lib/irb/ruby-token.rb b/lib/irb/ruby-token.rb
index 531fb859ff..2c7565dbfc 100644
--- a/lib/irb/ruby-token.rb
+++ b/lib/irb/ruby-token.rb
@@ -8,6 +8,7 @@
#
#
#
+# :stopdoc:
module RubyToken
EXPR_BEG = :EXPR_BEG
EXPR_MID = :EXPR_MID
@@ -263,3 +264,4 @@ module RubyToken
def_token(*defs)
end
end
+# :startdoc:
diff --git a/lib/irb/slex.rb b/lib/irb/slex.rb
index b395eaa475..09c1c02ebc 100644
--- a/lib/irb/slex.rb
+++ b/lib/irb/slex.rb
@@ -12,6 +12,7 @@
require "e2mmap"
require "irb/notifier"
+# :stopdoc:
module IRB
class SLex
@RCS_ID='-$Id$-'
@@ -75,7 +76,7 @@ module IRB
return @head.match_io(token)
end
ret = @head.match(token)
- D_DETAIL.exec_if{D_DEATIL.printf "match end: %s:%s\n", ret, token.inspect}
+ D_DETAIL.exec_if{D_DETAIL.printf "match end: %s:%s\n", ret, token.inspect}
ret
end
@@ -243,6 +244,7 @@ module IRB
end
end
end
+# :startdoc:
if $0 == __FILE__
# Tracer.on
diff --git a/lib/irb/version.rb b/lib/irb/version.rb
index 621a127ebd..bb998db3dd 100644
--- a/lib/irb/version.rb
+++ b/lib/irb/version.rb
@@ -9,7 +9,7 @@
#
#
-module IRB
+module IRB # :nodoc:
@RELEASE_VERSION = "0.9.6"
@LAST_UPDATE_DATE = "09/06/30"
end
diff --git a/lib/irb/workspace.rb b/lib/irb/workspace.rb
index edc0d3b147..65214a2217 100644
--- a/lib/irb/workspace.rb
+++ b/lib/irb/workspace.rb
@@ -8,9 +8,11 @@
#
#
#
-module IRB
+module IRB # :nodoc:
class WorkSpace
- # create new workspace. set self to main if specified, otherwise
+ # Creates a new workspace.
+ #
+ # set self to main if specified, otherwise
# inherit main from TOPLEVEL_BINDING.
def initialize(*main)
if main[0].kind_of?(Binding)
@@ -38,7 +40,7 @@ EOF
unless defined? BINDING_QUEUE
require "thread"
- IRB.const_set("BINDING_QUEUE", SizedQueue.new(1))
+ 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__
@@ -48,7 +50,7 @@ EOF
@binding = BINDING_QUEUE.pop
when 3 # binging in function on TOPLEVEL_BINDING(default)
- @binding = eval("def irb_binding; binding; end; irb_binding",
+ @binding = eval("def irb_binding; private; binding; end; irb_binding",
TOPLEVEL_BINDING,
__FILE__,
__LINE__ - 3)
@@ -73,9 +75,13 @@ EOF
eval("_=nil", @binding)
end
+ # The Binding of this workspace
attr_reader :binding
+ # The top-level workspace of this context, also available as
+ # <code>IRB.conf[:__MAIN__]</code>
attr_reader :main
+ # Evaluate the given +statements+ within the context of this workspace.
def evaluate(context, statements, file = __FILE__, line = __LINE__)
eval(statements, @binding, file, line)
end
diff --git a/lib/irb/xmp.rb b/lib/irb/xmp.rb
index bcef964020..947d2cf5a2 100644
--- a/lib/irb/xmp.rb
+++ b/lib/irb/xmp.rb
@@ -12,9 +12,46 @@
require "irb"
require "irb/frame"
+# An example printer for irb.
+#
+# It's much like the standard library PrettyPrint, that shows the value of each
+# expression as it runs.
+#
+# In order to use this library, you must first require it:
+#
+# require 'irb/xmp'
+#
+# Now, you can take advantage of the Object#xmp convenience method.
+#
+# xmp <<END
+# foo = "bar"
+# baz = 42
+# END
+# #=> foo = "bar"
+# #==>"bar"
+# #=> baz = 42
+# #==>42
+#
+# You can also create an XMP object, with an optional binding to print
+# expressions in the given binding:
+#
+# ctx = binding
+# x = XMP.new ctx
+# x.puts
+# #=> today = "a good day"
+# #==>"a good day"
+# ctx.eval 'today # is what?'
+# #=> "a good day"
class XMP
@RCS_ID='-$Id$-'
+ # Creates a new XMP object.
+ #
+ # The top-level binding or, optional +bind+ parameter will be used when
+ # creating the workspace. See WorkSpace.new for more information.
+ #
+ # This uses the +:XMP+ prompt mode, see IRB@Customizing+the+IRB+Prompt for
+ # full detail.
def initialize(bind = nil)
IRB.init_config(nil)
#IRB.parse_opts
@@ -32,6 +69,17 @@ class XMP
IRB.conf[:MAIN_CONTEXT] = @irb.context
end
+ # Evaluates the given +exps+, for example:
+ #
+ # require 'irb/xmp'
+ # x = XMP.new
+ #
+ # x.puts '{:a => 1, :b => 2, :c => 3}'
+ # #=> {:a => 1, :b => 2, :c => 3}
+ # # ==>{:a=>1, :b=>2, :c=>3}
+ # x.puts 'foo = "bar"'
+ # # => foo = "bar"
+ # # ==>"bar"
def puts(exps)
@io.puts exps
@@ -51,16 +99,22 @@ class XMP
end
end
+ # A custom InputMethod class used by XMP for evaluating string io.
class StringInputMethod < IRB::InputMethod
+ # Creates a new StringInputMethod object
def initialize
super
@exps = []
end
+ # Whether there are any expressions left in this printer.
def eof?
@exps.empty?
end
+ # Reads the next expression from this printer.
+ #
+ # See IO#gets for more information.
def gets
while l = @exps.shift
next if /^\s+$/ =~ l
@@ -71,6 +125,10 @@ class XMP
l
end
+ # Concatenates all expressions in this printer, separated by newlines.
+ #
+ # An Encoding::CompatibilityError is raised of the given +exps+'s encoding
+ # doesn't match the previous expression evaluated.
def puts(exps)
if @encoding and exps.encoding != @encoding
enc = Encoding.compatible?(@exps.join("\n"), exps)
@@ -85,10 +143,28 @@ class XMP
@exps.concat exps.split(/\n/)
end
+ # Returns the encoding of last expression printed by #puts.
attr_reader :encoding
end
end
+# A convenience method that's only available when the you require the IRB::XMP standard library.
+#
+# Creates a new XMP object, using the given expressions as the +exps+
+# parameter, and optional binding as +bind+ or uses the top-level binding. Then
+# evaluates the given expressions using the +:XMP+ prompt mode.
+#
+# For example:
+#
+# require 'irb/xmp'
+# ctx = binding
+# xmp 'foo = "bar"', ctx
+# #=> foo = "bar"
+# #==>"bar"
+# ctx.eval 'foo'
+# #=> "bar"
+#
+# See XMP.new for more information.
def xmp(exps, bind = nil)
bind = IRB::Frame.top(1) unless bind
xmp = XMP.new(bind)
diff --git a/lib/logger.rb b/lib/logger.rb
index 6092959399..c70b091469 100644
--- a/lib/logger.rb
+++ b/lib/logger.rb
@@ -18,18 +18,19 @@ require 'monitor'
#
# The messages have associated levels, such as +INFO+ or +ERROR+ that indicate
# their importance. You can then give the Logger a level, and only messages
-# at that level of higher will be printed.
+# at that level or higher will be printed.
#
# The levels are:
#
-# +FATAL+:: an unhandleable error that results in a program crash
-# +ERROR+:: a handleable error condition
-# +WARN+:: a warning
-# +INFO+:: generic (useful) information about system operation
-# +DEBUG+:: low-level information for developers
+# +UNKNOWN+:: An unknown message that should always be logged.
+# +FATAL+:: An unhandleable error that results in a program crash.
+# +ERROR+:: A handleable error condition.
+# +WARN+:: A warning.
+# +INFO+:: Generic (useful) information about system operation.
+# +DEBUG+:: Low-level information for developers.
#
# For instance, in a production system, you may have your Logger set to
-# +INFO+ or even +WARN+
+# +INFO+ or even +WARN+.
# When you are developing the system, however, you probably
# want to know about the program's internal state, and would set the Logger to
# +DEBUG+.
@@ -51,24 +52,29 @@ require 'monitor'
#
# === Example
#
-# This creates a logger to the standard output stream, with a level of +WARN+
+# This creates a Logger that outputs to the standard output stream, with a
+# level of +WARN+:
#
-# log = Logger.new(STDOUT)
-# log.level = Logger::WARN
+# require 'logger'
#
-# log.debug("Created logger")
-# log.info("Program started")
-# log.warn("Nothing to do!")
+# logger = Logger.new(STDOUT)
+# logger.level = Logger::WARN
+#
+# logger.debug("Created logger")
+# logger.info("Program started")
+# logger.warn("Nothing to do!")
+#
+# path = "a_non_existent_file"
#
# begin
-# File.each_line(path) do |line|
+# File.foreach(path) do |line|
# unless line =~ /^(\w+) = (.*)$/
-# log.error("Line in wrong format: #{line}")
+# logger.error("Line in wrong format: #{line.chomp}")
# end
# end
# rescue => err
-# log.fatal("Caught exception; exiting")
-# log.fatal(err)
+# logger.fatal("Caught exception; exiting")
+# logger.fatal(err)
# end
#
# Because the Logger's level is set to +WARN+, only the warning, error, and
@@ -102,16 +108,16 @@ require 'monitor'
# 3. Create a logger for the specified file.
#
# file = File.open('foo.log', File::WRONLY | File::APPEND)
-# # To create new (and to remove old) logfile, add File::CREAT like;
-# # file = open('foo.log', File::WRONLY | File::APPEND | File::CREAT)
+# # To create new (and to remove old) logfile, add File::CREAT like:
+# # file = File.open('foo.log', File::WRONLY | File::APPEND | File::CREAT)
# logger = Logger.new(file)
#
-# 4. Create a logger which ages logfile once it reaches a certain size. Leave
-# 10 "old log files" and each file is about 1,024,000 bytes.
+# 4. Create a logger which ages the logfile once it reaches a certain size.
+# Leave 10 "old" log files where each file is about 1,024,000 bytes.
#
# logger = Logger.new('foo.log', 10, 1024000)
#
-# 5. Create a logger which ages logfile daily/weekly/monthly.
+# 5. Create a logger which ages the logfile daily/weekly/monthly.
#
# logger = Logger.new('foo.log', 'daily')
# logger = Logger.new('foo.log', 'weekly')
@@ -124,13 +130,13 @@ require 'monitor'
# +debug+. +add+ is used below to log a message of an arbitrary (perhaps
# dynamic) level.
#
-# 1. Message in block.
+# 1. Message in a block.
#
# logger.fatal { "Argument 'foo' not given." }
#
# 2. Message as a string.
#
-# logger.error "Argument #{ @foo } mismatch."
+# logger.error "Argument #{@foo} mismatch."
#
# 3. With progname.
#
@@ -168,8 +174,7 @@ require 'monitor'
#
# logger.level = Logger::INFO
#
-# DEBUG < INFO < WARN < ERROR < FATAL < UNKNOWN
-#
+# # DEBUG < INFO < WARN < ERROR < FATAL < UNKNOWN
#
# == Format
#
@@ -177,22 +182,22 @@ require 'monitor'
# default. The default format and a sample are shown below:
#
# Log format:
-# SeverityID, [Date Time mSec #pid] SeverityLabel -- ProgName: message
+# SeverityID, [DateTime #pid] SeverityLabel -- ProgName: message
#
# Log sample:
-# I, [Wed Mar 03 02:34:24 JST 1999 895701 #19074] INFO -- Main: info.
+# I, [1999-03-03T02:34:24.895701 #19074] INFO -- Main: info.
#
-# You may change the date and time format via #datetime_format=
+# You may change the date and time format via #datetime_format=.
#
-# logger.datetime_format = "%Y-%m-%d %H:%M:%S"
+# logger.datetime_format = '%Y-%m-%d %H:%M:%S'
# # e.g. "2004-01-03 00:54:26"
#
-# Or, you may change the overall format with #formatter= method.
+# Or, you may change the overall format via the #formatter= method.
#
# logger.formatter = proc do |severity, datetime, progname, msg|
# "#{datetime}: #{msg}\n"
# end
-# # e.g. "Thu Sep 22 08:51:08 GMT+9:00 2005: hello world"
+# # e.g. "2005-09-22 08:51:08 +0900: hello world"
#
class Logger
VERSION = "1.2.7"
@@ -213,17 +218,17 @@ class Logger
# Logging severity.
module Severity
- # Low-level information, mostly for developers
+ # Low-level information, mostly for developers.
DEBUG = 0
- # generic, useful information about system operation
+ # Generic (useful) information about system operation.
INFO = 1
- # a warning
+ # A warning.
WARN = 2
- # a handleable error condition
+ # A handleable error condition.
ERROR = 3
- # an unhandleable error that results in a program crash
+ # An unhandleable error that results in a program crash.
FATAL = 4
- # an unknown message that should always be logged
+ # An unknown message that should always be logged.
UNKNOWN = 5
end
include Severity
@@ -231,7 +236,7 @@ class Logger
# Logging severity threshold (e.g. <tt>Logger::INFO</tt>).
attr_accessor :level
- # program name to include in log messages.
+ # Program name to include in log messages.
attr_accessor :progname
# Set date-time format.
@@ -249,9 +254,9 @@ class Logger
# Logging formatter, as a +Proc+ that will take four arguments and
# return the formatted message. The arguments are:
#
- # +severity+:: The Severity of the log message
- # +time+:: A Time instance representing when the message was logged
- # +progname+:: The #progname configured, or passed to the logger method
+ # +severity+:: The Severity of the log message.
+ # +time+:: A Time instance representing when the message was logged.
+ # +progname+:: The #progname configured, or passed to the logger method.
# +msg+:: The _Object_ the user passed to the log message; not necessarily a
# String.
#
@@ -284,8 +289,7 @@ class Logger
def fatal?; @level <= FATAL; end
#
- # === Synopsis
- #
+ # :call-seq:
# Logger.new(name, shift_age = 7, shift_size = 1048576)
# Logger.new(name, shift_age = 'weekly')
#
@@ -317,8 +321,7 @@ class Logger
end
#
- # === Synopsis
- #
+ # :call-seq:
# Logger#add(severity, message = nil, progname = nil) { ... }
#
# === Args
@@ -336,10 +339,8 @@ 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+.
+ # When the given severity is not high enough (for this particular logger),
+ # log no message, and return +true+.
#
# === Description
#
@@ -358,7 +359,7 @@ class Logger
#
# * Logfile is not locked.
# * Append open does not need to lock file.
- # * If the OS which supports multi I/O, records possibly be mixed.
+ # * If the OS supports multi I/O, records possibly may be mixed.
#
def add(severity, message = nil, progname = nil, &block)
severity ||= UNKNOWN
@@ -402,18 +403,17 @@ class Logger
#
# :call-seq:
# info(message)
- # info(progname,&block)
+ # info(progname, &block)
#
# Log an +INFO+ message.
#
- # +message+:: the message to log; does not need to be a String
- # +progname+:: in the block form, this is the #progname to use in the
- # the log message. The default can be set with #progname=
- # <tt>&block</tt>:: evaluates to the message to log. This is not evaluated
- # unless the logger's level is sufficient
- # to log the message. This allows you to create
- # potentially expensive logging messages that are
- # only called when the logger is configured to show them.
+ # +message+:: The message to log; does not need to be a String.
+ # +progname+:: In the block form, this is the #progname to use in the
+ # log message. The default can be set with #progname=.
+ # +block+:: Evaluates to the message to log. This is not evaluated unless
+ # the logger's level is sufficient to log the message. This
+ # allows you to create potentially expensive logging messages that
+ # are only called when the logger is configured to show them.
#
# === Examples
#
@@ -463,7 +463,7 @@ class Logger
#
# Log an +UNKNOWN+ message. This will be printed no matter what the logger's
- # level.
+ # level is.
#
# See #info for more information.
#
@@ -480,7 +480,7 @@ class Logger
private
- # Severity label for logging. (max 5 char)
+ # Severity label for logging (max 5 chars).
SEV_LABEL = %w(DEBUG INFO WARN ERROR FATAL ANY)
def format_severity(severity)
@@ -492,7 +492,7 @@ private
end
- # Default formatter for log messages
+ # Default formatter for log messages.
class Formatter
Format = "%s, [%s#%d] %5s -- %s: %s\n"
@@ -588,24 +588,32 @@ 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
@@ -614,17 +622,54 @@ private
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)
+ lock_shift_log { shift_log_period(period_end) }
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
+ ino = lock.stat.ino
+ if ino == File.stat(@filename).ino
+ yield # log shifting
+ else
+ # log shifted by another process (i-node before locking and i-node after locking are different)
+ @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}")
@@ -678,17 +723,17 @@ private
#
# == Description
#
- # Application -- Add logging support to your application.
+ # Logger::Application --- Add logging support to your application.
#
# == Usage
#
# 1. Define your application class as a sub-class of this class.
- # 2. Override 'run' method in your class to do many things.
- # 3. Instantiate it and invoke 'start'.
+ # 2. Override the +run+ method in your class to do many things.
+ # 3. Instantiate it and invoke #start.
#
# == Example
#
- # class FooApp < Application
+ # class FooApp < Logger::Application
# def initialize(foo_app, application_specific, arguments)
# super('FooApp') # Name of the application.
# end
@@ -711,9 +756,8 @@ private
attr_reader :appname
#
- # == Synopsis
- #
- # Application.new(appname = '')
+ # :call-seq:
+ # Logger::Application.new(appname = '')
#
# == Args
#
diff --git a/lib/matrix.rb b/lib/matrix.rb
index 3c078c0c06..f82ed65979 100644
--- a/lib/matrix.rb
+++ b/lib/matrix.rb
@@ -32,93 +32,93 @@ end
# == Method Catalogue
#
# To create a matrix:
-# * <tt> Matrix[*rows] </tt>
-# * <tt> Matrix.[](*rows) </tt>
-# * <tt> Matrix.rows(rows, copy = true) </tt>
-# * <tt> Matrix.columns(columns) </tt>
-# * <tt> Matrix.build(row_size, column_size, &block) </tt>
-# * <tt> Matrix.diagonal(*values) </tt>
-# * <tt> Matrix.scalar(n, value) </tt>
-# * <tt> Matrix.identity(n) </tt>
-# * <tt> Matrix.unit(n) </tt>
-# * <tt> Matrix.I(n) </tt>
-# * <tt> Matrix.zero(n) </tt>
-# * <tt> Matrix.row_vector(row) </tt>
-# * <tt> Matrix.column_vector(column) </tt>
+# * Matrix[*rows]
+# * Matrix.[](*rows)
+# * Matrix.rows(rows, copy = true)
+# * Matrix.columns(columns)
+# * Matrix.build(row_count, column_count, &block)
+# * Matrix.diagonal(*values)
+# * Matrix.scalar(n, value)
+# * Matrix.identity(n)
+# * Matrix.unit(n)
+# * Matrix.I(n)
+# * Matrix.zero(n)
+# * Matrix.row_vector(row)
+# * Matrix.column_vector(column)
#
# To access Matrix elements/columns/rows/submatrices/properties:
-# * <tt> [](i, j) </tt>
-# * <tt> #row_size </tt>
-# * <tt> #column_size </tt>
-# * <tt> #row(i) </tt>
-# * <tt> #column(j) </tt>
-# * <tt> #collect </tt>
-# * <tt> #map </tt>
-# * <tt> #each </tt>
-# * <tt> #each_with_index </tt>
-# * <tt> #find_index </tt>
-# * <tt> #minor(*param) </tt>
+# * #[](i, j)
+# * #row_count (row_size)
+# * #column_count (column_size)
+# * #row(i)
+# * #column(j)
+# * #collect
+# * #map
+# * #each
+# * #each_with_index
+# * #find_index
+# * #minor(*param)
#
# Properties of a matrix:
-# * <tt> #diagonal? </tt>
-# * <tt> #empty? </tt>
-# * <tt> #hermitian? </tt>
-# * <tt> #lower_triangular? </tt>
-# * <tt> #normal? </tt>
-# * <tt> #orthogonal? </tt>
-# * <tt> #permutation? </tt>
-# * <tt> #real? </tt>
-# * <tt> #regular? </tt>
-# * <tt> #singular? </tt>
-# * <tt> #square? </tt>
-# * <tt> #symmetric? </tt>
-# * <tt> #unitary? </tt>
-# * <tt> #upper_triangular? </tt>
-# * <tt> #zero? </tt>
+# * #diagonal?
+# * #empty?
+# * #hermitian?
+# * #lower_triangular?
+# * #normal?
+# * #orthogonal?
+# * #permutation?
+# * #real?
+# * #regular?
+# * #singular?
+# * #square?
+# * #symmetric?
+# * #unitary?
+# * #upper_triangular?
+# * #zero?
#
# Matrix arithmetic:
-# * <tt> *(m) </tt>
-# * <tt> +(m) </tt>
-# * <tt> -(m) </tt>
-# * <tt> #/(m) </tt>
-# * <tt> #inverse </tt>
-# * <tt> #inv </tt>
-# * <tt> ** </tt>
+# * #*(m)
+# * #+(m)
+# * #-(m)
+# * #/(m)
+# * #inverse
+# * #inv
+# * #**
#
# Matrix functions:
-# * <tt> #determinant </tt>
-# * <tt> #det </tt>
-# * <tt> #rank </tt>
-# * <tt> #round </tt>
-# * <tt> #trace </tt>
-# * <tt> #tr </tt>
-# * <tt> #transpose </tt>
-# * <tt> #t </tt>
+# * #determinant
+# * #det
+# * #rank
+# * #round
+# * #trace
+# * #tr
+# * #transpose
+# * #t
#
# Matrix decompositions:
-# * <tt> #eigen </tt>
-# * <tt> #eigensystem </tt>
-# * <tt> #lup </tt>
-# * <tt> #lup_decomposition </tt>
+# * #eigen
+# * #eigensystem
+# * #lup
+# * #lup_decomposition
#
# Complex arithmetic:
-# * <tt> conj </tt>
-# * <tt> conjugate </tt>
-# * <tt> imag </tt>
-# * <tt> imaginary </tt>
-# * <tt> real </tt>
-# * <tt> rect </tt>
-# * <tt> rectangular </tt>
+# * conj
+# * conjugate
+# * imag
+# * imaginary
+# * real
+# * rect
+# * rectangular
#
# Conversion to other data types:
-# * <tt> #coerce(other) </tt>
-# * <tt> #row_vectors </tt>
-# * <tt> #column_vectors </tt>
-# * <tt> #to_a </tt>
+# * #coerce(other)
+# * #row_vectors
+# * #column_vectors
+# * #to_a
#
# String representations:
-# * <tt> #to_s </tt>
-# * <tt> #inspect </tt>
+# * #to_s
+# * #inspect
#
class Matrix
include Enumerable
@@ -138,7 +138,7 @@ class Matrix
# -1 66
#
def Matrix.[](*rows)
- Matrix.rows(rows, false)
+ rows(rows, false)
end
#
@@ -156,7 +156,7 @@ class Matrix
end
size = (rows[0] || []).size
rows.each do |row|
- Matrix.Raise ErrDimensionMismatch, "row size differs (#{row.size} should be #{size})" unless row.size == size
+ raise ErrDimensionMismatch, "row size differs (#{row.size} should be #{size})" unless row.size == size
end
new rows, size
end
@@ -168,11 +168,11 @@ class Matrix
# 93 66
#
def Matrix.columns(columns)
- Matrix.rows(columns, false).transpose
+ rows(columns, false).transpose
end
#
- # Creates a matrix of size +row_size+ x +column_size+.
+ # Creates a matrix of size +row_count+ x +column_count+.
# It fills the values by calling the given block,
# passing the current row and column.
# Returns an enumerator if no block is given.
@@ -182,17 +182,17 @@ class Matrix
# m = Matrix.build(3) { rand }
# => a 3x3 matrix with random elements
#
- def Matrix.build(row_size, column_size = row_size)
- row_size = CoercionHelper.coerce_to_int(row_size)
- column_size = CoercionHelper.coerce_to_int(column_size)
- raise ArgumentError if row_size < 0 || column_size < 0
- return to_enum :build, row_size, column_size unless block_given?
- rows = Array.new(row_size) do |i|
- Array.new(column_size) do |j|
+ def Matrix.build(row_count, column_count = row_count)
+ row_count = CoercionHelper.coerce_to_int(row_count)
+ column_count = CoercionHelper.coerce_to_int(column_count)
+ raise ArgumentError if row_count < 0 || column_count < 0
+ return to_enum :build, row_count, column_count unless block_given?
+ rows = Array.new(row_count) do |i|
+ Array.new(column_count) do |j|
yield i, j
end
end
- new rows, column_size
+ new rows, column_count
end
#
@@ -220,7 +220,7 @@ class Matrix
# 0 5
#
def Matrix.scalar(n, value)
- Matrix.diagonal(*Array.new(n, value))
+ diagonal(*Array.new(n, value))
end
#
@@ -230,7 +230,7 @@ class Matrix
# 0 1
#
def Matrix.identity(n)
- Matrix.scalar(n, 1)
+ scalar(n, 1)
end
class << Matrix
alias unit identity
@@ -243,9 +243,9 @@ class Matrix
# => 0 0
# 0 0
#
- def Matrix.zero(row_size, column_size = row_size)
- rows = Array.new(row_size){Array.new(column_size, 0)}
- new rows, column_size
+ def Matrix.zero(row_count, column_count = row_count)
+ rows = Array.new(row_count){Array.new(column_count, 0)}
+ new rows, column_count
end
#
@@ -273,8 +273,8 @@ class Matrix
end
#
- # Creates a empty matrix of +row_size+ x +column_size+.
- # At least one of +row_size+ or +column_size+ must be 0.
+ # Creates a empty matrix of +row_count+ x +column_count+.
+ # At least one of +row_count+ or +column_count+ must be 0.
#
# m = Matrix.empty(2, 0)
# m == Matrix[ [], [] ]
@@ -285,26 +285,26 @@ class Matrix
# m * n
# => Matrix[[0, 0, 0], [0, 0, 0]]
#
- def Matrix.empty(row_size = 0, column_size = 0)
- Matrix.Raise ArgumentError, "One size must be 0" if column_size != 0 && row_size != 0
- Matrix.Raise ArgumentError, "Negative size" if column_size < 0 || row_size < 0
+ def Matrix.empty(row_count = 0, column_count = 0)
+ raise ArgumentError, "One size must be 0" if column_count != 0 && row_count != 0
+ raise ArgumentError, "Negative size" if column_count < 0 || row_count < 0
- new([[]]*row_size, column_size)
+ new([[]]*row_count, column_count)
end
#
# Matrix.new is private; use Matrix.rows, columns, [], etc... to create.
#
- def initialize(rows, column_size = rows[0].size)
+ def initialize(rows, column_count = rows[0].size)
# No checking is done at this point. rows must be an Array of Arrays.
- # column_size must be the size of the first row, if there is one,
+ # column_count must be the size of the first row, if there is one,
# otherwise it *must* be specified and can be any integer >= 0
@rows = rows
- @column_size = column_size
+ @column_count = column_count
end
- def new_matrix(rows, column_size = rows[0].size) # :nodoc:
- Matrix.send(:new, rows, column_size) # bypass privacy of Matrix.new
+ def new_matrix(rows, column_count = rows[0].size) # :nodoc:
+ self.class.send(:new, rows, column_count) # bypass privacy of Matrix.new
end
private :new_matrix
@@ -327,14 +327,16 @@ class Matrix
#
# Returns the number of rows.
#
- def row_size
+ def row_count
@rows.size
end
+ alias_method :row_size, :row_count
#
# Returns the number of columns.
#
- attr_reader :column_size
+ attr_reader :column_count
+ alias_method :column_size, :column_count
#
# Returns row vector number +i+ of the matrix as a Vector (starting at 0 like
@@ -356,14 +358,14 @@ class Matrix
#
def column(j) # :yield: e
if block_given?
- return self if j >= column_size || j < -column_size
- row_size.times do |i|
+ return self if j >= column_count || j < -column_count
+ row_count.times do |i|
yield @rows[i][j]
end
self
else
- return nil if j >= column_size || j < -column_size
- col = Array.new(row_size) {|i|
+ return nil if j >= column_count || j < -column_count
+ col = Array.new(row_count) {|i|
@rows[i][j]
}
Vector.elements(col, false)
@@ -380,7 +382,7 @@ class Matrix
def collect(&block) # :yield: e
return to_enum(:collect) unless block_given?
rows = @rows.collect{|row| row.collect(&block)}
- new_matrix rows, column_size
+ new_matrix rows, column_count
end
alias map collect
@@ -402,7 +404,7 @@ class Matrix
#
def each(which = :all) # :yield: e
return to_enum :each, which unless block_given?
- last = column_size - 1
+ last = column_count - 1
case which
when :all
block = Proc.new
@@ -415,7 +417,7 @@ class Matrix
end
when :off_diagonal
@rows.each_with_index do |row, row_index|
- column_size.times do |col_index|
+ column_count.times do |col_index|
yield row[col_index] unless row_index == col_index
end
end
@@ -427,7 +429,7 @@ class Matrix
end
when :strict_lower
@rows.each_with_index do |row, row_index|
- [row_index, column_size].min.times do |col_index|
+ [row_index, column_count].min.times do |col_index|
yield row[col_index]
end
end
@@ -444,7 +446,7 @@ class Matrix
end
end
else
- Matrix.Raise ArgumentError, "expected #{which.inspect} to be one of :all, :diagonal, :off_diagonal, :lower, :strict_lower, :strict_upper or :upper"
+ raise ArgumentError, "expected #{which.inspect} to be one of :all, :diagonal, :off_diagonal, :lower, :strict_lower, :strict_upper or :upper"
end
self
end
@@ -463,7 +465,7 @@ class Matrix
#
def each_with_index(which = :all) # :yield: e, row, column
return to_enum :each_with_index, which unless block_given?
- last = column_size - 1
+ last = column_count - 1
case which
when :all
@rows.each_with_index do |row, row_index|
@@ -477,7 +479,7 @@ class Matrix
end
when :off_diagonal
@rows.each_with_index do |row, row_index|
- column_size.times do |col_index|
+ column_count.times do |col_index|
yield row[col_index], row_index, col_index unless row_index == col_index
end
end
@@ -489,7 +491,7 @@ class Matrix
end
when :strict_lower
@rows.each_with_index do |row, row_index|
- [row_index, column_size].min.times do |col_index|
+ [row_index, column_count].min.times do |col_index|
yield row[col_index], row_index, col_index
end
end
@@ -506,7 +508,7 @@ class Matrix
end
end
else
- Matrix.Raise ArgumentError, "expected #{which.inspect} to be one of :all, :diagonal, :off_diagonal, :lower, :strict_lower, :strict_upper or :upper"
+ raise ArgumentError, "expected #{which.inspect} to be one of :all, :diagonal, :off_diagonal, :lower, :strict_lower, :strict_upper or :upper"
end
self
end
@@ -552,39 +554,39 @@ class Matrix
#
# Like Array#[], negative indices count backward from the end of the
# row or column (-1 is the last element). Returns nil if the starting
- # row or column is greater than row_size or column_size respectively.
+ # row or column is greater than row_count or column_count respectively.
#
def minor(*param)
case param.size
when 2
row_range, col_range = param
from_row = row_range.first
- from_row += row_size if from_row < 0
+ from_row += row_count if from_row < 0
to_row = row_range.end
- to_row += row_size if to_row < 0
+ to_row += row_count if to_row < 0
to_row += 1 unless row_range.exclude_end?
size_row = to_row - from_row
from_col = col_range.first
- from_col += column_size if from_col < 0
+ from_col += column_count if from_col < 0
to_col = col_range.end
- to_col += column_size if to_col < 0
+ to_col += column_count if to_col < 0
to_col += 1 unless col_range.exclude_end?
size_col = to_col - from_col
when 4
from_row, size_row, from_col, size_col = param
return nil if size_row < 0 || size_col < 0
- from_row += row_size if from_row < 0
- from_col += column_size if from_col < 0
+ from_row += row_count if from_row < 0
+ from_col += column_count if from_col < 0
else
- Matrix.Raise ArgumentError, param.inspect
+ raise ArgumentError, param.inspect
end
- return nil if from_row > row_size || from_col > column_size || from_row < 0 || from_col < 0
+ return nil if from_row > row_count || from_col > column_count || from_row < 0 || from_col < 0
rows = @rows[from_row, size_row].collect{|row|
row[from_col, size_col]
}
- new_matrix rows, [column_size - from_col, size_col].min
+ new_matrix rows, [column_count - from_col, size_col].min
end
#--
@@ -605,7 +607,7 @@ class Matrix
# or the number of columns is 0.
#
def empty?
- column_size == 0 || row_size == 0
+ column_count == 0 || row_count == 0
end
#
@@ -614,7 +616,7 @@ class Matrix
#
def hermitian?
Matrix.Raise ErrDimensionMismatch unless square?
- each_with_index(:strict_upper).all? do |e, row, col|
+ each_with_index(:upper).all? do |e, row, col|
e == rows[col][row].conj
end
end
@@ -651,9 +653,9 @@ class Matrix
def orthogonal?
Matrix.Raise ErrDimensionMismatch unless square?
rows.each_with_index do |row, i|
- column_size.times do |j|
+ column_count.times do |j|
s = 0
- row_size.times do |k|
+ row_count.times do |k|
s += row[k] * rows[k][j]
end
return false unless s == (i == j ? 1 : 0)
@@ -668,7 +670,7 @@ class Matrix
#
def permutation?
Matrix.Raise ErrDimensionMismatch unless square?
- cols = Array.new(column_size)
+ cols = Array.new(column_count)
rows.each_with_index do |row, i|
found = false
row.each_with_index do |e, j|
@@ -709,7 +711,7 @@ class Matrix
# Returns +true+ is this is a square matrix.
#
def square?
- column_size == row_size
+ column_count == row_count
end
#
@@ -718,9 +720,10 @@ class Matrix
#
def symmetric?
Matrix.Raise ErrDimensionMismatch unless square?
- each_with_index(:strict_upper).all? do |e, row, col|
- e == rows[col][row]
+ each_with_index(:strict_upper) do |e, row, col|
+ return false if e != rows[col][row]
end
+ true
end
#
@@ -730,9 +733,9 @@ class Matrix
def unitary?
Matrix.Raise ErrDimensionMismatch unless square?
rows.each_with_index do |row, i|
- column_size.times do |j|
+ column_count.times do |j|
s = 0
- row_size.times do |k|
+ row_count.times do |k|
s += row[k].conj * rows[k][j]
end
return false unless s == (i == j ? 1 : 0)
@@ -764,13 +767,13 @@ class Matrix
#
def ==(other)
return false unless Matrix === other &&
- column_size == other.column_size # necessary for empty matrices
+ column_count == other.column_count # necessary for empty matrices
rows == other.rows
end
def eql?(other)
return false unless Matrix === other &&
- column_size == other.column_size # necessary for empty matrices
+ column_count == other.column_count # necessary for empty matrices
rows.eql? other.rows
end
@@ -780,7 +783,7 @@ class Matrix
# There should be no good reason to do this since Matrices are immutable.
#
def clone
- new_matrix @rows.map(&:dup), column_size
+ new_matrix @rows.map(&:dup), column_count
end
#
@@ -806,22 +809,22 @@ class Matrix
rows = @rows.collect {|row|
row.collect {|e| e * m }
}
- return new_matrix rows, column_size
+ return new_matrix rows, column_count
when Vector
- m = Matrix.column_vector(m)
+ m = self.class.column_vector(m)
r = self * m
return r.column(0)
when Matrix
- Matrix.Raise ErrDimensionMismatch if column_size != m.row_size
+ Matrix.Raise ErrDimensionMismatch if column_count != m.row_count
- rows = Array.new(row_size) {|i|
- Array.new(m.column_size) {|j|
- (0 ... column_size).inject(0) do |vij, k|
+ rows = Array.new(row_count) {|i|
+ Array.new(m.column_count) {|j|
+ (0 ... column_count).inject(0) do |vij, k|
vij + self[i, k] * m[k, j]
end
}
}
- return new_matrix rows, m.column_size
+ return new_matrix rows, m.column_count
else
return apply_through_coercion(m, __method__)
end
@@ -838,20 +841,20 @@ class Matrix
when Numeric
Matrix.Raise ErrOperationNotDefined, "+", self.class, m.class
when Vector
- m = Matrix.column_vector(m)
+ m = self.class.column_vector(m)
when Matrix
else
return apply_through_coercion(m, __method__)
end
- Matrix.Raise ErrDimensionMismatch unless row_size == m.row_size and column_size == m.column_size
+ Matrix.Raise ErrDimensionMismatch unless row_count == m.row_count and column_count == m.column_count
- rows = Array.new(row_size) {|i|
- Array.new(column_size) {|j|
+ rows = Array.new(row_count) {|i|
+ Array.new(column_count) {|j|
self[i, j] + m[i, j]
}
}
- new_matrix rows, column_size
+ new_matrix rows, column_count
end
#
@@ -865,20 +868,20 @@ class Matrix
when Numeric
Matrix.Raise ErrOperationNotDefined, "-", self.class, m.class
when Vector
- m = Matrix.column_vector(m)
+ m = self.class.column_vector(m)
when Matrix
else
return apply_through_coercion(m, __method__)
end
- Matrix.Raise ErrDimensionMismatch unless row_size == m.row_size and column_size == m.column_size
+ Matrix.Raise ErrDimensionMismatch unless row_count == m.row_count and column_count == m.column_count
- rows = Array.new(row_size) {|i|
- Array.new(column_size) {|j|
+ rows = Array.new(row_count) {|i|
+ Array.new(column_count) {|j|
self[i, j] - m[i, j]
}
}
- new_matrix rows, column_size
+ new_matrix rows, column_count
end
#
@@ -893,7 +896,7 @@ class Matrix
rows = @rows.collect {|row|
row.collect {|e| e / other }
}
- return new_matrix rows, column_size
+ return new_matrix rows, column_count
when Matrix
return self * other.inverse
else
@@ -909,12 +912,12 @@ class Matrix
#
def inverse
Matrix.Raise ErrDimensionMismatch unless square?
- Matrix.I(row_size).send(:inverse_from, self)
+ self.class.I(row_count).send(:inverse_from, self)
end
alias inv inverse
def inverse_from(src) # :nodoc:
- last = row_size - 1
+ last = row_count - 1
a = src.to_a
0.upto(last) do |k|
@@ -973,7 +976,7 @@ class Matrix
x = self
if other <= 0
x = self.inverse
- return Matrix.identity(self.column_size) if other == 0
+ return self.class.identity(self.column_count) if other == 0
other = -other
end
z = nil
@@ -984,7 +987,7 @@ class Matrix
end
when Numeric
v, d, v_inv = eigensystem
- v * Matrix.diagonal(*d.each(:diagonal).map{|e| e ** other}) * v_inv
+ v * self.class.diagonal(*d.each(:diagonal).map{|e| e ** other}) * v_inv
else
Matrix.Raise ErrOperationNotDefined, "**", self.class, other.class
end
@@ -1007,7 +1010,7 @@ class Matrix
def determinant
Matrix.Raise ErrDimensionMismatch unless square?
m = @rows
- case row_size
+ case row_count
# Up to 4x4, give result using Laplacian expansion by minors.
# This will typically be faster, as well as giving good results
# in case of Floats
@@ -1056,7 +1059,7 @@ class Matrix
# intermediate results with better precision.
#
def determinant_bareiss
- size = row_size
+ size = row_count
last = size - 1
a = to_a
no_pivot = Proc.new{ return 0 }
@@ -1088,7 +1091,7 @@ class Matrix
#
def determinant_e
warn "#{caller(1)[0]}: warning: Matrix#determinant_e is deprecated; use #determinant"
- rank
+ determinant
end
alias det_e determinant_e
@@ -1105,8 +1108,8 @@ class Matrix
# We currently use Bareiss' multistep integer-preserving gaussian elimination
# (see comments on determinant)
a = to_a
- last_column = column_size - 1
- last_row = row_size - 1
+ last_column = column_count - 1
+ last_row = row_count - 1
pivot_row = 0
previous_pivot = 1
0.upto(last_column) do |k|
@@ -1151,7 +1154,7 @@ class Matrix
#
def trace
Matrix.Raise ErrDimensionMismatch unless square?
- (0...column_size).inject(0) do |tr, i|
+ (0...column_count).inject(0) do |tr, i|
tr + @rows[i][i]
end
end
@@ -1168,8 +1171,8 @@ class Matrix
# 2 4 6
#
def transpose
- return Matrix.empty(column_size, 0) if row_size.zero?
- new_matrix @rows.transpose, row_size
+ return self.class.empty(column_count, 0) if row_count.zero?
+ new_matrix @rows.transpose, row_count
end
alias t transpose
@@ -1197,7 +1200,7 @@ class Matrix
# l.lower_triangular? # => true
# u.upper_triangular? # => true
# p.permutation? # => true
- # l * u == a * p # => true
+ # l * u == p * a # => true
# a.lup.solve([2, 5]) # => Vector[(1/1), (1/2)]
#
def lup
@@ -1285,7 +1288,7 @@ class Matrix
# Returns an array of the row vectors of the matrix. See Vector.
#
def row_vectors
- Array.new(row_size) {|i|
+ Array.new(row_count) {|i|
row(i)
}
end
@@ -1294,7 +1297,7 @@ class Matrix
# Returns an array of the column vectors of the matrix. See Vector.
#
def column_vectors
- Array.new(column_size) {|i|
+ Array.new(column_count) {|i|
column(i)
}
end
@@ -1330,9 +1333,9 @@ class Matrix
#
def to_s
if empty?
- "Matrix.empty(#{row_size}, #{column_size})"
+ "#{self.class}.empty(#{row_count}, #{column_count})"
else
- "Matrix[" + @rows.collect{|row|
+ "#{self.class}[" + @rows.collect{|row|
"[" + row.collect{|e| e.to_s}.join(", ") + "]"
}.join(", ")+"]"
end
@@ -1343,9 +1346,9 @@ class Matrix
#
def inspect
if empty?
- "Matrix.empty(#{row_size}, #{column_size})"
+ "#{self.class}.empty(#{row_count}, #{column_count})"
else
- "Matrix#{@rows.inspect}"
+ "#{self.class}#{@rows.inspect}"
end
end
@@ -1499,40 +1502,41 @@ end
# == Method Catalogue
#
# To create a Vector:
-# * <tt> Vector.[](*array) </tt>
-# * <tt> Vector.elements(array, copy = true) </tt>
+# * Vector.[](*array)
+# * Vector.elements(array, copy = true)
#
# To access elements:
-# * <tt> [](i) </tt>
+# * #[](i)
#
# To enumerate the elements:
-# * <tt> #each2(v) </tt>
-# * <tt> #collect2(v) </tt>
+# * #each2(v)
+# * #collect2(v)
#
# Vector arithmetic:
-# * <tt> *(x) "is matrix or number" </tt>
-# * <tt> +(v) </tt>
-# * <tt> -(v) </tt>
+# * #*(x) "is matrix or number"
+# * #+(v)
+# * #-(v)
#
# Vector functions:
-# * <tt> #inner_product(v) </tt>
-# * <tt> #collect </tt>
-# * <tt> #magnitude </tt>
-# * <tt> #map </tt>
-# * <tt> #map2(v) </tt>
-# * <tt> #norm </tt>
-# * <tt> #normalize </tt>
-# * <tt> #r </tt>
-# * <tt> #size </tt>
+# * #inner_product(v)
+# * #cross_product(v)
+# * #collect
+# * #magnitude
+# * #map
+# * #map2(v)
+# * #norm
+# * #normalize
+# * #r
+# * #size
#
# Conversion to other data types:
-# * <tt> #covector </tt>
-# * <tt> #to_a </tt>
-# * <tt> #coerce(other) </tt>
+# * #covector
+# * #to_a
+# * #coerce(other)
#
# String representations:
-# * <tt> #to_s </tt>
-# * <tt> #inspect </tt>
+# * #to_s
+# * #inspect
#
class Vector
include ExceptionForMatrix
@@ -1654,7 +1658,7 @@ class Vector
# Return a copy of the vector.
#
def clone
- Vector.elements(@elements)
+ self.class.elements(@elements)
end
#
@@ -1675,7 +1679,7 @@ class Vector
case x
when Numeric
els = @elements.collect{|e| e * x}
- Vector.elements(els, false)
+ self.class.elements(els, false)
when Matrix
Matrix.column_vector(self) * x
when Vector
@@ -1695,7 +1699,7 @@ class Vector
els = collect2(v) {|v1, v2|
v1 + v2
}
- Vector.elements(els, false)
+ self.class.elements(els, false)
when Matrix
Matrix.column_vector(self) + v
else
@@ -1713,7 +1717,7 @@ class Vector
els = collect2(v) {|v1, v2|
v1 - v2
}
- Vector.elements(els, false)
+ self.class.elements(els, false)
when Matrix
Matrix.column_vector(self) - v
else
@@ -1728,7 +1732,7 @@ class Vector
case x
when Numeric
els = @elements.collect{|e| e / x}
- Vector.elements(els, false)
+ self.class.elements(els, false)
when Matrix, Vector
Vector.Raise ErrOperationNotDefined, "/", self.class, x.class
else
@@ -1749,18 +1753,29 @@ class Vector
p = 0
each2(v) {|v1, v2|
- p += v1 * v2
+ p += v1 * v2.conj
}
p
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[1]*@elements[2] - v[2]*@elements[1],
+ v[2]*@elements[0] - v[0]*@elements[2],
+ v[0]*@elements[1] - v[1]*@elements[0] ]
+ end
+
+ #
# Like Array#collect.
#
def collect(&block) # :yield: e
return to_enum(:collect) unless block_given?
els = @elements.collect(&block)
- Vector.elements(els, false)
+ self.class.elements(els, false)
end
alias map collect
@@ -1769,7 +1784,7 @@ class Vector
# Vector[5,8,2].r => 9.643650761
#
def magnitude
- Math.sqrt(@elements.inject(0) {|v, e| v + e*e})
+ Math.sqrt(@elements.inject(0) {|v, e| v + e.abs2})
end
alias r magnitude
alias norm magnitude
@@ -1780,7 +1795,7 @@ class Vector
def map2(v, &block) # :yield: e1, e2
return to_enum(:map2, v) unless block_given?
els = collect2(v, &block)
- Vector.elements(els, false)
+ self.class.elements(els, false)
end
class ZeroVectorError < StandardError
diff --git a/lib/matrix/eigenvalue_decomposition.rb b/lib/matrix/eigenvalue_decomposition.rb
index 55e41aaf7c..0dd9d42f29 100644
--- a/lib/matrix/eigenvalue_decomposition.rb
+++ b/lib/matrix/eigenvalue_decomposition.rb
@@ -20,7 +20,7 @@ class Matrix
# @v: Array for internal storage of eigenvectors.
# @h: Array for internal storage of nonsymmetric Hessenberg form.
raise TypeError, "Expected Matrix but got #{a.class}" unless a.is_a?(Matrix)
- @size = a.row_size
+ @size = a.row_count
@d = Array.new(@size, 0)
@e = Array.new(@size, 0)
@@ -84,14 +84,14 @@ class Matrix
private
def build_eigenvectors
# JAMA stores complex eigenvectors in a strange way
- # See http://cio.nist.gov/esd/emaildir/lists/jama/msg01021.html
+ # See http://web.archive.org/web/20111016032731/http://cio.nist.gov/esd/emaildir/lists/jama/msg01021.html
@e.each_with_index.map do |imag, i|
if imag == 0
Array.new(@size){|j| @v[j][i]}
elsif imag > 0
Array.new(@size){|j| Complex(@v[j][i], @v[j][i+1])}
else
- Array.new(@size){|j| Complex(@v[j][i], -@v[j][i-1])}
+ Array.new(@size){|j| Complex(@v[j][i-1], -@v[j][i])}
end
end
end
@@ -659,14 +659,10 @@ class Matrix
q = @h[k+1][k-1]
r = (notlast ? @h[k+2][k-1] : 0.0)
x = p.abs + q.abs + r.abs
- if (x != 0.0)
- p /= x
- q /= x
- r /= x
- end
- end
- if (x == 0.0)
- break
+ next if x == 0
+ p /= x
+ q /= x
+ r /= x
end
s = Math.sqrt(p * p + q * q + r * r)
if (p < 0)
diff --git a/lib/matrix/lup_decomposition.rb b/lib/matrix/lup_decomposition.rb
index 8f5aac2e5a..30f3276253 100644
--- a/lib/matrix/lup_decomposition.rb
+++ b/lib/matrix/lup_decomposition.rb
@@ -19,7 +19,7 @@ class Matrix
include Matrix::ConversionHelper
def l
- Matrix.build(@row_size, @col_size) do |i, j|
+ Matrix.build(@row_count, [@column_count, @row_count].min) do |i, j|
if (i > j)
@lu[i][j]
elsif (i == j)
@@ -33,7 +33,7 @@ class Matrix
# Returns the upper triangular factor +U+
def u
- Matrix.build(@col_size, @col_size) do |i, j|
+ Matrix.build([@column_count, @row_count].min, @column_count) do |i, j|
if (i <= j)
@lu[i][j]
else
@@ -45,9 +45,9 @@ class Matrix
# Returns the permutation matrix +P+
def p
- rows = Array.new(@row_size){Array.new(@col_size, 0)}
+ rows = Array.new(@row_count){Array.new(@row_count, 0)}
@pivots.each_with_index{|p, i| rows[i][p] = 1}
- Matrix.send :new, rows, @col_size
+ Matrix.send :new, rows, @row_count
end
# Returns +L+, +U+, +P+ in an array
@@ -64,7 +64,7 @@ class Matrix
# Returns +true+ if +U+, and hence +A+, is singular.
def singular? ()
- @col_size.times do |j|
+ @column_count.times do |j|
if (@lu[j][j] == 0)
return true
end
@@ -76,11 +76,11 @@ class Matrix
# from the factorization.
def det
- if (@row_size != @col_size)
- Matrix.Raise Matrix::ErrDimensionMismatch unless square?
+ if (@row_count != @column_count)
+ Matrix.Raise Matrix::ErrDimensionMismatch
end
d = @pivot_sign
- @col_size.times do |j|
+ @column_count.times do |j|
d *= @lu[j][j]
end
d
@@ -96,24 +96,24 @@ class Matrix
Matrix.Raise Matrix::ErrNotRegular, "Matrix is singular."
end
if b.is_a? Matrix
- if (b.row_size != @row_size)
+ if (b.row_count != @row_count)
Matrix.Raise Matrix::ErrDimensionMismatch
end
# Copy right hand side with pivoting
- nx = b.column_size
+ nx = b.column_count
m = @pivots.map{|row| b.row(row).to_a}
# Solve L*Y = P*b
- @col_size.times do |k|
- (k+1).upto(@col_size-1) do |i|
+ @column_count.times do |k|
+ (k+1).upto(@column_count-1) do |i|
nx.times do |j|
m[i][j] -= m[k][j]*@lu[i][k]
end
end
end
# Solve U*m = Y
- (@col_size-1).downto(0) do |k|
+ (@column_count-1).downto(0) do |k|
nx.times do |j|
m[k][j] = m[k][j].quo(@lu[k][k])
end
@@ -126,7 +126,7 @@ class Matrix
Matrix.send :new, m, nx
else # same algorithm, specialized for simpler case of a vector
b = convert_to_array(b)
- if (b.size != @row_size)
+ if (b.size != @row_count)
Matrix.Raise Matrix::ErrDimensionMismatch
end
@@ -134,13 +134,13 @@ class Matrix
m = b.values_at(*@pivots)
# Solve L*Y = P*b
- @col_size.times do |k|
- (k+1).upto(@col_size-1) do |i|
+ @column_count.times do |k|
+ (k+1).upto(@column_count-1) do |i|
m[i] -= m[k]*@lu[i][k]
end
end
# Solve U*m = Y
- (@col_size-1).downto(0) do |k|
+ (@column_count-1).downto(0) do |k|
m[k] = m[k].quo(@lu[k][k])
k.times do |i|
m[i] -= m[k]*@lu[i][k]
@@ -154,28 +154,28 @@ class Matrix
raise TypeError, "Expected Matrix but got #{a.class}" unless a.is_a?(Matrix)
# Use a "left-looking", dot-product, Crout/Doolittle algorithm.
@lu = a.to_a
- @row_size = a.row_size
- @col_size = a.column_size
- @pivots = Array.new(@row_size)
- @row_size.times do |i|
+ @row_count = a.row_count
+ @column_count = a.column_count
+ @pivots = Array.new(@row_count)
+ @row_count.times do |i|
@pivots[i] = i
end
@pivot_sign = 1
- lu_col_j = Array.new(@row_size)
+ lu_col_j = Array.new(@row_count)
# Outer loop.
- @col_size.times do |j|
+ @column_count.times do |j|
# Make a copy of the j-th column to localize references.
- @row_size.times do |i|
+ @row_count.times do |i|
lu_col_j[i] = @lu[i][j]
end
# Apply previous transformations.
- @row_size.times do |i|
+ @row_count.times do |i|
lu_row_i = @lu[i]
# Most of the time is spent in the following dot product.
@@ -192,13 +192,13 @@ class Matrix
# Find pivot and exchange if necessary.
p = j
- (j+1).upto(@row_size-1) do |i|
+ (j+1).upto(@row_count-1) do |i|
if (lu_col_j[i].abs > lu_col_j[p].abs)
p = i
end
end
if (p != j)
- @col_size.times do |k|
+ @column_count.times do |k|
t = @lu[p][k]; @lu[p][k] = @lu[j][k]; @lu[j][k] = t
end
k = @pivots[p]; @pivots[p] = @pivots[j]; @pivots[j] = k
@@ -207,8 +207,8 @@ class Matrix
# Compute multipliers.
- if (j < @row_size && @lu[j][j] != 0)
- (j+1).upto(@row_size-1) do |i|
+ if (j < @row_count && @lu[j][j] != 0)
+ (j+1).upto(@row_count-1) do |i|
@lu[i][j] = @lu[i][j].quo(@lu[j][j])
end
end
diff --git a/lib/minitest/.document b/lib/minitest/.document
new file mode 100644
index 0000000000..6850e5befb
--- /dev/null
+++ b/lib/minitest/.document
@@ -0,0 +1,2 @@
+# Ignore README.txt, it is included in the minitest documentation.
+*.rb
diff --git a/lib/minitest/README.txt b/lib/minitest/README.txt
index 7b1e6e681f..368cc3aa4e 100644
--- a/lib/minitest/README.txt
+++ b/lib/minitest/README.txt
@@ -1,12 +1,25 @@
-= minitest/*
+= minitest/{unit,spec,mock,benchmark}
-* http://rubyforge.org/projects/bfts
+home :: https://github.com/seattlerb/minitest
+rdoc :: http://docs.seattlerb.org/minitest
+vim :: https://github.com/sunaku/vim-ruby-minitest
== DESCRIPTION:
minitest provides a complete suite of testing facilities supporting
TDD, BDD, mocking, and benchmarking.
+ "I had a class with Jim Weirich on testing last week and we were
+ allowed to choose our testing frameworks. Kirk Haines and I were
+ paired up and we cracked open the code for a few test
+ frameworks...
+
+ I MUST say that minitest is *very* readable / understandable
+ compared to the 'other two' options we looked at. Nicely done and
+ thank you for helping us keep our mental sanity."
+
+ -- Wayne E. Seguin
+
minitest/unit is a small and incredibly fast unit testing framework.
It provides a rich set of assertions to make your tests clean and
readable.
@@ -20,23 +33,39 @@ algorithms in a repeatable manner. Now you can assert that your newb
co-worker doesn't replace your linear algorithm with an exponential
one!
-minitest/mock by Steven Baker, is a beautifully tiny mock object
-framework.
+minitest/mock by Steven Baker, is a beautifully tiny mock (and stub)
+object framework.
minitest/pride shows pride in testing and adds coloring to your test
-output.
+output. I guess it is an example of how to write IO pipes too. :P
minitest/unit is meant to have a clean implementation for language
implementors that need a minimal set of methods to bootstrap a working
test suite. For example, there is no magic involved for test-case
discovery.
+ "Again, I can't praise enough the idea of a testing/specing
+ framework that I can actually read in full in one sitting!"
+
+ -- Piotr Szotkowski
+
+Comparing to rspec:
+
+ rspec is a testing DSL. minitest is ruby.
+
+ -- Adam Hawkins, "Bow Before MiniTest"
+
+minitest doesn't reinvent anything that ruby already provides, like:
+classes, modules, inheritance, methods. This means you only have to
+learn ruby to use minitest and all of your regular OO practices like
+extract-method refactorings still apply.
+
== FEATURES/PROBLEMS:
* minitest/autorun - the easy and explicit way to run all your tests.
* minitest/unit - a very fast, simple, and clean test system.
* minitest/spec - a very fast, simple, and clean spec system.
-* minitest/mock - a simple and clean mock system.
+* minitest/mock - a simple and clean mock/stub system.
* minitest/benchmark - an awesome way to assert your algorithm's performance.
* minitest/pride - show your pride in testing!
* Incredibly small and fast runner, but no bells and whistles.
@@ -75,6 +104,10 @@ 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
end
=== Specs
@@ -99,6 +132,10 @@ Given that you'd like to test the following class:
end
end
+For matchers support check out:
+
+https://github.com/zenspider/minitest-matchers
+
=== Benchmarks
Add benchmarks to your regular unit tests. If the unit tests fail, the
@@ -111,9 +148,7 @@ benchmarks won't run.
# Override self.bench_range or default range is [1, 10, 100, 1_000, 10_000]
def bench_my_algorithm
assert_performance_linear 0.9999 do |n| # n is a range value
- n.times do
- @obj.my_algorithm
- end
+ @obj.my_algorithm(n)
end
end
end
@@ -151,7 +186,7 @@ Output is tab-delimited to make it easy to paste into a spreadsheet.
def ask(question)
method = question.tr(" ","_") + "?"
- @meme.send(method)
+ @meme.__send__(method)
end
end
@@ -174,6 +209,26 @@ Output is tab-delimited to make it easy to paste into a spreadsheet.
end
end
+=== Stubs
+
+ def test_stale_eh
+ obj_under_test = Something.new
+
+ refute obj_under_test.stale?
+
+ Time.stub :now, Time.at(0) do # stub goes away once the block is done
+ assert obj_under_test.stale?
+ 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
@@ -226,6 +281,132 @@ 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:
+
+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
+* detroit-minitest
+* em-minitest-spec
+* flexmock-minitest
+* guard-minitest
+* guard-minitest-decisiv
+* minitest-activemodel
+* minitest-ar-assertions
+* minitest-capybara-unit
+* minitest-colorer
+* minitest-deluxe
+* minitest-extra-assertions
+* minitest-rails-shoulda
+* minitest-spec
+* minitest-spec-should
+* minitest-sugar
+* minitest_should
+* mongoid-minitest
+* spork-minitest
+
== REQUIREMENTS:
* Ruby 1.8, maybe even 1.6 or lower. No magic is involved.
@@ -240,14 +421,21 @@ 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
+packages their own gems. They install a gem specification file, but
+don't install the gem contents in the gem path. This messes up
+Gem.find_files and many other things (gem which, gem contents, etc).
+
+Just install minitest as a gem for real and you'll be happier.
+
== LICENSE:
(The MIT License)
-Copyright (c) Ryan Davis, Seattle.rb
+Copyright (c) Ryan Davis, seattle.rb
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
diff --git a/lib/minitest/autorun.rb b/lib/minitest/autorun.rb
index 443f2f61d4..cb4a3a0e5d 100644
--- a/lib/minitest/autorun.rb
+++ b/lib/minitest/autorun.rb
@@ -1,3 +1,4 @@
+# encoding: utf-8
######################################################################
# This file is imported from the minitest project.
# DO NOT make modifications in this repo. They _will_ be reverted!
diff --git a/lib/minitest/benchmark.rb b/lib/minitest/benchmark.rb
index 77c0afafb7..e233282b0a 100644
--- a/lib/minitest/benchmark.rb
+++ b/lib/minitest/benchmark.rb
@@ -1,3 +1,4 @@
+# encoding: utf-8
######################################################################
# This file is imported from the minitest project.
# DO NOT make modifications in this repo. They _will_ be reverted!
@@ -7,9 +8,7 @@
require 'minitest/unit'
require 'minitest/spec'
-class MiniTest::Unit
- attr_accessor :runner
-
+class MiniTest::Unit # :nodoc:
def run_benchmarks # :nodoc:
_run_anything :benchmark
end
@@ -83,8 +82,8 @@ class MiniTest::Unit
#
# def bench_algorithm
# validation = proc { |x, y| ... }
- # assert_performance validation do |x|
- # @obj.algorithm
+ # assert_performance validation do |n|
+ # @obj.algorithm(n)
# end
# end
@@ -127,8 +126,8 @@ class MiniTest::Unit
# Eg:
#
# def bench_algorithm
- # assert_performance_constant 0.9999 do |x|
- # @obj.algorithm
+ # assert_performance_constant 0.9999 do |n|
+ # @obj.algorithm(n)
# end
# end
@@ -153,8 +152,8 @@ class MiniTest::Unit
# Eg:
#
# def bench_algorithm
- # assert_performance_exponential 0.9999 do |x|
- # @obj.algorithm
+ # assert_performance_exponential 0.9999 do |n|
+ # @obj.algorithm(n)
# end
# end
@@ -164,6 +163,26 @@ class MiniTest::Unit
##
# 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.
@@ -173,8 +192,8 @@ class MiniTest::Unit
# Eg:
#
# def bench_algorithm
- # assert_performance_linear 0.9999 do |x|
- # @obj.algorithm
+ # assert_performance_linear 0.9999 do |n|
+ # @obj.algorithm(n)
# end
# end
@@ -238,6 +257,29 @@ class MiniTest::Unit
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].
@@ -318,6 +360,15 @@ class MiniTest::Spec
define_method "bench_#{name.gsub(/\W+/, '_')}", &block
end
+ ##
+ # Specifies the ranges used for benchmarking for that class.
+ #
+ # bench_range do
+ # bench_exp(2, 16, 2)
+ # end
+ #
+ # See Unit::TestCase.bench_range for more details.
+
def self.bench_range &block
return super unless block
@@ -329,8 +380,8 @@ class MiniTest::Spec
# Create a benchmark that verifies that the performance is linear.
#
# describe "my class" do
- # bench_performance_linear "fast_algorithm", 0.9999 do
- # @obj.fast_algorithm
+ # bench_performance_linear "fast_algorithm", 0.9999 do |n|
+ # @obj.fast_algorithm(n)
# end
# end
@@ -344,8 +395,8 @@ class MiniTest::Spec
# Create a benchmark that verifies that the performance is constant.
#
# describe "my class" do
- # bench_performance_constant "zoom_algorithm!" do
- # @obj.zoom_algorithm!
+ # bench_performance_constant "zoom_algorithm!" do |n|
+ # @obj.zoom_algorithm!(n)
# end
# end
@@ -359,8 +410,8 @@ class MiniTest::Spec
# Create a benchmark that verifies that the performance is exponential.
#
# describe "my class" do
- # bench_performance_exponential "algorithm" do
- # @obj.algorithm
+ # bench_performance_exponential "algorithm" do |n|
+ # @obj.algorithm(n)
# end
# end
diff --git a/lib/minitest/hell.rb b/lib/minitest/hell.rb
new file mode 100644
index 0000000000..827bf0e320
--- /dev/null
+++ b/lib/minitest/hell.rb
@@ -0,0 +1,20 @@
+# encoding: utf-8
+######################################################################
+# This file is imported from the minitest project.
+# DO NOT make modifications in this repo. They _will_ be reverted!
+# File a patch instead and assign it to Ryan Davis.
+######################################################################
+
+require "minitest/parallel_each"
+
+# :stopdoc:
+class Minitest::Unit::TestCase
+ class << self
+ alias :old_test_order :test_order
+
+ def test_order
+ :parallel
+ end
+ end
+end
+# :startdoc:
diff --git a/lib/minitest/mock.rb b/lib/minitest/mock.rb
index c342c04995..a5b0f602f5 100644
--- a/lib/minitest/mock.rb
+++ b/lib/minitest/mock.rb
@@ -1,15 +1,16 @@
+# 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; end
+class MockExpectationError < StandardError; end # :nodoc:
##
# A simple and clean mock object framework.
-module MiniTest
+module MiniTest # :nodoc:
##
# All mock objects are an instance of Mock
@@ -24,13 +25,13 @@ module MiniTest
end
def initialize # :nodoc:
- @expected_calls = {}
- @actual_calls = Hash.new {|h,k| h[k] = [] }
+ @expected_calls = Hash.new { |calls, name| calls[name] = [] }
+ @actual_calls = Hash.new { |calls, name| calls[name] = [] }
end
##
- # Expect that method +name+ is called, optionally with +args+, and returns
- # +retval+.
+ # Expect that method +name+ is called, optionally with +args+ or a
+ # +blk+, and returns +retval+.
#
# @mock.expect(:meaning_of_life, 42)
# @mock.meaning_of_life # => 42
@@ -38,6 +39,10 @@ module MiniTest
# @mock.expect(:do_something_with, true, [some_obj, true])
# @mock.do_something_with(some_obj, true) # => true
#
+ # @mock.expect(:do_something_else, true) do |a1, a2|
+ # a1 == "buggs" && a2 == :bunny
+ # end
+ #
# +args+ is compared to the expected args using case equality (ie, the
# '===' operator), allowing for less specific expectations.
#
@@ -49,58 +54,147 @@ module MiniTest
# @mock.uses_one_string("bar") # => true
# @mock.verify # => raises MockExpectationError
- def expect(name, retval, args=[])
- @expected_calls[name] = { :retval => retval, :args => args }
+ def expect(name, retval, args=[], &blk)
+ if block_given?
+ raise ArgumentError, "args ignored when block given" unless args.empty?
+ @expected_calls[name] << { :retval => retval, :block => blk }
+ else
+ raise ArgumentError, "args must be an array" unless Array === args
+ @expected_calls[name] << { :retval => retval, :args => args }
+ end
self
end
+ def __call name, data # :nodoc:
+ case data
+ when Hash then
+ "#{name}(#{data[:args].inspect[1..-2]}) => #{data[:retval].inspect}"
+ else
+ data.map { |d| __call name, d }.join ", "
+ end
+ end
+
##
# Verify that all methods were called as expected. Raises
# +MockExpectationError+ if the mock object was not called as
# expected.
def verify
- @expected_calls.each_key do |name|
- expected = @expected_calls[name]
- msg1 = "expected #{name}, #{expected.inspect}"
- msg2 = "#{msg1}, got #{@actual_calls[name].inspect}"
-
- raise MockExpectationError, msg2 if
- @actual_calls.has_key? name and
- not @actual_calls[name].include?(expected)
-
- raise MockExpectationError, msg1 unless
- @actual_calls.has_key? name and @actual_calls[name].include?(expected)
+ @expected_calls.each do |name, calls|
+ calls.each do |expected|
+ msg1 = "expected #{__call name, expected}"
+ msg2 = "#{msg1}, got [#{__call name, @actual_calls[name]}]"
+
+ raise MockExpectationError, msg2 if
+ @actual_calls.has_key?(name) and
+ not @actual_calls[name].include?(expected)
+
+ raise MockExpectationError, msg1 unless
+ @actual_calls.has_key?(name) and
+ @actual_calls[name].include?(expected)
+ end
end
true
end
def method_missing(sym, *args) # :nodoc:
- expected = @expected_calls[sym]
-
- unless expected then
+ unless @expected_calls.has_key?(sym) then
raise NoMethodError, "unmocked method %p, expected one of %p" %
[sym, @expected_calls.keys.sort_by(&:to_s)]
end
- expected_args, retval = expected[:args], expected[:retval]
+ index = @actual_calls[sym].length
+ expected_call = @expected_calls[sym][index]
- unless expected_args.size == args.size
+ unless expected_call then
+ raise MockExpectationError, "No more expects available for %p: %p" %
+ [sym, args]
+ end
+
+ expected_args, retval, val_block =
+ expected_call.values_at(:args, :retval, :block)
+
+ if val_block then
+ raise MockExpectationError, "mocked method %p failed block w/ %p" %
+ [sym, args] unless val_block.call(args)
+
+ # keep "verify" happy
+ @actual_calls[sym] << expected_call
+ return retval
+ end
+
+ if expected_args.size != args.size then
raise ArgumentError, "mocked method %p expects %d arguments, got %d" %
- [sym, expected[:args].size, args.size]
+ [sym, expected_args.size, args.size]
+ end
+
+ fully_matched = expected_args.zip(args).all? { |mod, a|
+ mod === a or mod == a
+ }
+
+ unless fully_matched then
+ raise MockExpectationError, "mocked method %p called with unexpected arguments %p" %
+ [sym, args]
end
@actual_calls[sym] << {
:retval => retval,
- :args => expected_args.zip(args).map { |mod, a| mod if mod === a }
+ :args => expected_args.zip(args).map { |mod, a| mod === a ? mod : a }
}
retval
end
- def respond_to?(sym) # :nodoc:
- return true if @expected_calls.has_key?(sym)
- return __respond_to?(sym)
+ def respond_to?(sym, include_private = false) # :nodoc:
+ return true if @expected_calls.has_key?(sym.to_sym)
+ return __respond_to?(sym, include_private)
end
end
end
+
+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+. The method
+ # +name+ must exist before stubbing.
+ #
+ # def test_stale_eh
+ # obj_under_test = Something.new
+ # refute obj_under_test.stale?
+ #
+ # Time.stub :now, Time.at(0) do
+ # assert obj_under_test.stale?
+ # end
+ # end
+
+ def stub name, val_or_callable, &block
+ new_name = "__minitest_stub__#{name}"
+
+ metaclass = class << self; self; end
+
+ if respond_to? name and not methods.map(&:to_s).include? name.to_s then
+ metaclass.send :define_method, name do |*args|
+ super(*args)
+ end
+ end
+
+ metaclass.send :alias_method, new_name, name
+
+ metaclass.send :define_method, name do |*args|
+ if val_or_callable.respond_to? :call then
+ val_or_callable.call(*args)
+ else
+ val_or_callable
+ end
+ end
+
+ yield self
+ ensure
+ metaclass.send :undef_method, name
+ metaclass.send :alias_method, name, new_name
+ metaclass.send :undef_method, new_name
+ end
+end
diff --git a/lib/minitest/parallel_each.rb b/lib/minitest/parallel_each.rb
new file mode 100644
index 0000000000..e1020b35a0
--- /dev/null
+++ b/lib/minitest/parallel_each.rb
@@ -0,0 +1,80 @@
+# encoding: utf-8
+######################################################################
+# This file is imported from the minitest project.
+# DO NOT make modifications in this repo. They _will_ be reverted!
+# File a patch instead and assign it to Ryan Davis.
+######################################################################
+
+##
+# Provides a parallel #each that lets you enumerate using N threads.
+# Use environment variable N to customize. Defaults to 2. Enumerable,
+# so all the goodies come along (tho not all are wrapped yet to
+# return another ParallelEach instance).
+
+class ParallelEach
+ require 'thread'
+ include Enumerable
+
+ ##
+ # How many Threads to use for this parallel #each.
+
+ N = (ENV['N'] || 2).to_i
+
+ ##
+ # Create a new ParallelEach instance over +list+.
+
+ def initialize list
+ @queue = Queue.new # *sigh*... the Queue api sucks sooo much...
+
+ list.each { |i| @queue << i }
+ N.times { @queue << nil }
+ end
+
+ def grep pattern # :nodoc:
+ self.class.new super
+ end
+
+ def select(&block) # :nodoc:
+ self.class.new super
+ end
+
+ alias find_all select # :nodoc:
+
+ ##
+ # Starts N threads that yield each element to your block. Joins the
+ # threads at the end.
+
+ def each
+ threads = N.times.map {
+ Thread.new do
+ Thread.current.abort_on_exception = true
+ while job = @queue.pop
+ yield job
+ end
+ end
+ }
+ threads.map(&:join)
+ end
+
+ def count
+ [@queue.size - N, 0].max
+ end
+
+ alias_method :size, :count
+end
+
+class MiniTest::Unit
+ alias _old_run_suites _run_suites
+
+ ##
+ # Runs all the +suites+ for a given +type+. Runs suites declaring
+ # a test_order of +:parallel+ in parallel, and everything else
+ # serial.
+
+ def _run_suites suites, type
+ parallel, serial = suites.partition { |s| s.test_order == :parallel }
+
+ ParallelEach.new(parallel).map { |suite| _run_suite suite, type } +
+ serial.map { |suite| _run_suite suite, type }
+ end
+end
diff --git a/lib/minitest/pride.rb b/lib/minitest/pride.rb
index ac7745695c..40c35394fa 100644
--- a/lib/minitest/pride.rb
+++ b/lib/minitest/pride.rb
@@ -1,3 +1,4 @@
+# encoding: utf-8
######################################################################
# This file is imported from the minitest project.
# DO NOT make modifications in this repo. They _will_ be reverted!
@@ -10,12 +11,17 @@ 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
+ 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
@@ -25,6 +31,9 @@ class PrideIO
# io.sync = true
end
+ ##
+ # Wrap print to colorize the output.
+
def print o
case o
when "." then
@@ -36,9 +45,9 @@ class PrideIO
end
end
- def puts(*o)
+ def puts(*o) # :nodoc:
o.map! { |s|
- s.sub(/Finished tests/) {
+ s.to_s.sub(/Finished tests/) {
@index = 0
'Fabulous tests'.split(//).map { |c|
pride(c)
@@ -49,6 +58,9 @@ class PrideIO
super
end
+ ##
+ # Color a string.
+
def pride string
string = "*" if string == "."
c = @colors[@index % @size]
@@ -56,15 +68,20 @@ class PrideIO
"#{ESC}#{c}m#{string}#{NND}"
end
- def method_missing msg, *args
+ def method_missing msg, *args # :nodoc:
io.send(msg, *args)
end
end
-class PrideLOL < PrideIO # inspired by lolcat, but massively cleaned up
- PI_3 = Math::PI / 3
+##
+# 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
+ def initialize io # :nodoc:
# walk red, green, and blue around a circle separated by equal thirds.
#
# To visualize, type this into wolfram-alpha:
@@ -88,6 +105,9 @@ class PrideLOL < PrideIO # inspired by lolcat, but massively cleaned up
super
end
+ ##
+ # Make the string even more colorful. Damnit.
+
def pride string
c = @colors[@index % @size]
@index += 1
@@ -95,5 +115,5 @@ class PrideLOL < PrideIO # inspired by lolcat, but massively cleaned up
end
end
-klass = ENV['TERM'] =~ /^xterm(-256color)?$/ ? PrideLOL : PrideIO
+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
index a70bbdd405..d91fccf5bc 100644
--- a/lib/minitest/spec.rb
+++ b/lib/minitest/spec.rb
@@ -1,3 +1,4 @@
+# encoding: utf-8
######################################################################
# This file is imported from the minitest project.
# DO NOT make modifications in this repo. They _will_ be reverted!
@@ -12,12 +13,15 @@ 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, &block
- return MiniTest::Spec.current.#{meth}(*args, &self) if
- Proc === self
- return MiniTest::Spec.current.#{meth}(args.first, self) if
- args.size == 1 unless #{!!dont_flip}
- return MiniTest::Spec.current.#{meth}(self, *args)
+ 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
@@ -62,7 +66,7 @@ module Kernel # :nodoc:
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
+ sclas = stack.last || if Class === self && is_a?(MiniTest::Spec::DSL) then
self
else
MiniTest::Spec.spec_type desc
@@ -84,167 +88,188 @@ end
# 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
+ # Oh look! A MiniTest::Spec::DSL module! Eat your heart out DHH.
+
+ module DSL
+ ##
+ # Contains pairs of matchers and Spec classes to be used to
+ # calculate the superclass of a top-level describe. This allows for
+ # automatically customizable spec types.
+ #
+ # See: register_spec_type and spec_type
+
+ TYPES = [[//, MiniTest::Spec]]
+
+ ##
+ # Register a new type of spec that matches the spec's description.
+ # This method can take either a Regexp and a spec class or a spec
+ # class and a block that takes the description and returns true if
+ # it matches.
+ #
+ # Eg:
+ #
+ # register_spec_type(/Controller$/, MiniTest::Spec::Rails)
+ #
+ # or:
+ #
+ # register_spec_type(MiniTest::Spec::RailsModel) do |desc|
+ # desc.superclass == ActiveRecord::Base
+ # end
+
+ def register_spec_type(*args, &block)
+ if block then
+ matcher, klass = block, args.first
else
- matcher === desc.to_s
+ matcher, klass = *args
end
- }.last
- end
+ TYPES.unshift [matcher, klass]
+ end
- @@describe_stack = []
- def self.describe_stack # :nodoc:
- @@describe_stack
- end
+ ##
+ # Figure out the spec class to use based on a spec's description. Eg:
+ #
+ # spec_type("BlahController") # => MiniTest::Spec::Rails
+
+ def spec_type desc
+ TYPES.find { |matcher, klass|
+ if matcher.respond_to? :call then
+ matcher.call desc
+ else
+ matcher === desc.to_s
+ end
+ }.last
+ end
- def self.current # :nodoc:
- @@current_spec
- end
+ def describe_stack # :nodoc:
+ Thread.current[:describe_stack] ||= []
+ end
- ##
- # Returns the children of this spec.
+ ##
+ # Returns the children of this spec.
- def self.children
- @children ||= []
- end
+ def children
+ @children ||= []
+ end
- def initialize name # :nodoc:
- super
- @@current_spec = self
- end
+ def nuke_test_methods! # :nodoc:
+ self.public_instance_methods.grep(/^test_/).each do |name|
+ self.send :undef_method, name
+ end
+ end
- def self.nuke_test_methods! # :nodoc:
- self.public_instance_methods.grep(/^test_/).each do |name|
- self.send :undef_method, name
+ ##
+ # Define a 'before' action. Inherits the way normal methods should.
+ #
+ # NOTE: +type+ is ignored and is only there to make porting easier.
+ #
+ # Equivalent to MiniTest::Unit::TestCase#setup.
+
+ def before type = nil, &block
+ define_method :setup do
+ super()
+ self.instance_eval(&block)
+ end
end
- 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.
+ ##
+ # Define an 'after' action. Inherits the way normal methods should.
+ #
+ # NOTE: +type+ is ignored and is only there to make porting easier.
+ #
+ # Equivalent to MiniTest::Unit::TestCase#teardown.
+
+ def after type = nil, &block
+ define_method :teardown do
+ self.instance_eval(&block)
+ super()
+ end
+ end
- def self.before type = :each, &block
- raise "unsupported before type: #{type}" unless type == :each
+ ##
+ # Define an expectation with name +desc+. Name gets morphed to a
+ # proper test method name. For some freakish reason, people who
+ # write specs don't like class inheritance, so this goes way out of
+ # its way to make sure that expectations aren't inherited.
+ #
+ # This is also aliased to #specify and doesn't require a +desc+ arg.
+ #
+ # Hint: If you _do_ want inheritence, use minitest/unit. You can mix
+ # and match between assertions and expectations as much as you want.
- add_setup_hook {|tc| tc.instance_eval(&block) }
- end
+ def it desc = "anonymous", &block
+ block ||= proc { skip "(no tests defined)" }
- ##
- # 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.
+ @specs ||= 0
+ @specs += 1
- def self.after type = :each, &block
- raise "unsupported after type: #{type}" unless type == :each
+ name = "test_%04d_%s" % [ @specs, desc ]
- add_teardown_hook {|tc| tc.instance_eval(&block) }
- end
+ define_method name, &block
- ##
- # 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.
- #
- # Hint: If you _do_ want inheritence, use minitest/unit. You can mix
- # and match between assertions and expectations as much as you want.
+ self.children.each do |mod|
+ mod.send :undef_method, name if mod.public_method_defined? name
+ end
- def self.it desc, &block
- block ||= proc { skip "(no tests defined)" }
+ name
+ end
- @specs ||= 0
- @specs += 1
+ ##
+ # Essentially, define an accessor for +name+ with +block+.
+ #
+ # Why use let instead of def? I honestly don't know.
- name = "test_%04d_%s" % [ @specs, desc.gsub(/\W+/, '_').downcase ]
+ def let name, &block
+ define_method name do
+ @_memoized ||= {}
+ @_memoized.fetch(name) { |k| @_memoized[k] = instance_eval(&block) }
+ end
+ end
- define_method name, &block
+ ##
+ # Another lazy man's accessor generator. Made even more lazy by
+ # setting the name for you to +subject+.
- self.children.each do |mod|
- mod.send :undef_method, name if mod.public_method_defined? name
+ def subject &block
+ let :subject, &block
end
- end
- def self.let name, &block
- define_method name do
- @_memoized ||= {}
- @_memoized.fetch(name) { |k| @_memoized[k] = instance_eval(&block) }
- end
- end
+ def create name, desc # :nodoc:
+ cls = Class.new(self) do
+ @name = name
+ @desc = desc
- def self.subject &block
- let :subject, &block
- end
+ nuke_test_methods!
+ end
- def self.create name, desc # :nodoc:
- cls = Class.new(self) do
- @name = name
- @desc = desc
+ children << cls
- nuke_test_methods!
+ cls
end
- children << cls
+ def name # :nodoc:
+ defined?(@name) ? @name : super
+ end
- cls
- end
+ def to_s # :nodoc:
+ name # Can't alias due to 1.8.7, not sure why
+ end
- def self.to_s # :nodoc:
- defined?(@name) ? @name : super
+ # :stopdoc:
+ attr_reader :desc
+ alias :specify :it
+ # :startdoc:
end
- # :stopdoc:
- class << self
- attr_reader :name, :desc
- end
- # :startdoc:
+ extend DSL
+
+ TYPES = DSL::TYPES # :nodoc:
end
+##
+# It's where you hide your "assertions".
+
module MiniTest::Expectations
##
# See MiniTest::Assertions#assert_empty.
@@ -253,7 +278,7 @@ module MiniTest::Expectations
#
# :method: must_be_empty
- infect_an_assertion :assert_empty, :must_be_empty
+ infect_an_assertion :assert_empty, :must_be_empty, :unary
##
# See MiniTest::Assertions#assert_equal
@@ -269,11 +294,11 @@ module MiniTest::Expectations
#
# n.must_be_close_to m [, delta]
#
- # :method: must_be_within_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
+ alias :must_be_within_delta :must_be_close_to # :nodoc:
##
# See MiniTest::Assertions#assert_in_epsilon
@@ -327,16 +352,20 @@ module MiniTest::Expectations
#
# :method: must_be_nil
- infect_an_assertion :assert_nil, :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
+ infect_an_assertion :assert_operator, :must_be, :reverse
##
# See MiniTest::Assertions#assert_output
@@ -409,7 +438,7 @@ module MiniTest::Expectations
#
# :method: wont_be_empty
- infect_an_assertion :refute_empty, :wont_be_empty
+ infect_an_assertion :refute_empty, :wont_be_empty, :unary
##
# See MiniTest::Assertions#refute_equal
@@ -425,12 +454,11 @@ module MiniTest::Expectations
#
# n.wont_be_close_to m [, delta]
#
- # :method: wont_be_within_delta
+ # :method: wont_be_close_to
- infect_an_assertion :refute_in_delta, :wont_be_within_delta
+ infect_an_assertion :refute_in_delta, :wont_be_close_to
- alias :wont_be_close_to :wont_be_within_delta
- # FIX: reverse aliases
+ alias :wont_be_within_delta :wont_be_close_to # :nodoc:
##
# See MiniTest::Assertions#refute_in_epsilon
@@ -484,16 +512,20 @@ module MiniTest::Expectations
#
# :method: wont_be_nil
- infect_an_assertion :refute_nil, :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
+ infect_an_assertion :refute_operator, :wont_be, :reverse
##
# See MiniTest::Assertions#refute_respond_to
@@ -514,6 +546,6 @@ module MiniTest::Expectations
infect_an_assertion :refute_same, :wont_be_same_as
end
-class Object
- include MiniTest::Expectations
+class Object # :nodoc:
+ include MiniTest::Expectations unless ENV["MT_NO_EXPECTATIONS"]
end
diff --git a/lib/minitest/unit.rb b/lib/minitest/unit.rb
index 922ef70183..465e5b4c98 100644
--- a/lib/minitest/unit.rb
+++ b/lib/minitest/unit.rb
@@ -1,11 +1,12 @@
+# 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 "optparse"
+require "rbconfig"
##
# Minimal (mostly drop-in) replacement for test-unit.
@@ -14,6 +15,18 @@ require 'rbconfig'
module MiniTest
+ def self.const_missing name # :nodoc:
+ case name
+ when :MINI_DIR then
+ msg = "MiniTest::MINI_DIR was removed. Don't violate other's internals."
+ warn "WAR\NING: #{msg}"
+ warn "WAR\NING: Used by #{caller.first}."
+ const_set :MINI_DIR, "bad value"
+ else
+ super
+ end
+ end
+
##
# Assertion base class
@@ -24,40 +37,39 @@ module MiniTest
class Skip < Assertion; end
- file = if RUBY_VERSION =~ /^1\.9/ then # bt's expanded, but __FILE__ isn't :(
- File.expand_path __FILE__
- elsif __FILE__ =~ /^[^\.]/ then # assume both relative
- require 'pathname'
- pwd = Pathname.new Dir.pwd
- pn = Pathname.new File.expand_path(__FILE__)
- relpath = pn.relative_path_from(pwd) rescue pn
- pn = File.join ".", relpath unless pn.relative?
- pn.to_s
- else # assume both are expanded
- __FILE__
- end
-
- # './lib' in project dir, or '/usr/local/blahblah' if installed
- MINI_DIR = File.dirname(File.dirname(file)) # :nodoc:
+ class << self
+ ##
+ # Filter object for backtraces.
- def self.filter_backtrace bt # :nodoc:
- return ["No backtrace"] unless bt
+ attr_accessor :backtrace_filter
+ end
+
+ class BacktraceFilter # :nodoc:
+ def filter bt
+ return ["No backtrace"] unless bt
- new_bt = []
+ new_bt = []
- unless $DEBUG then
- bt.each do |line|
- break if line.rindex MINI_DIR, 0
- new_bt << line
+ unless $DEBUG then
+ bt.each do |line|
+ break if line =~ /lib\/minitest/
+ new_bt << line
+ end
+
+ new_bt = bt.reject { |line| line =~ /lib\/minitest/ } if new_bt.empty?
+ new_bt = bt.dup if new_bt.empty?
+ else
+ new_bt = bt.dup
end
- new_bt = bt.reject { |line| line.rindex MINI_DIR, 0 } if new_bt.empty?
- new_bt = bt.dup if new_bt.empty?
- else
- new_bt = bt.dup
+ new_bt
end
+ end
- new_bt
+ self.backtrace_filter = BacktraceFilter.new
+
+ def self.filter_backtrace bt # :nodoc:
+ backtrace_filter.filter bt
end
##
@@ -65,24 +77,28 @@ module MiniTest
# printed if the assertion fails.
module Assertions
+ UNDEFINED = Object.new # :nodoc:
- WINDOZE = RbConfig::CONFIG['host_os'] =~ /mswin|mingw/
+ def UNDEFINED.inspect # :nodoc:
+ "UNDEFINED" # again with the rdoc bugs... :(
+ end
##
# Returns the diff command to use in #diff. Tries to intelligently
# figure out what diff to use.
def self.diff
- @diff = if WINDOZE
+ @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
@@ -134,10 +150,11 @@ module MiniTest
if result.empty? then
klass = exp.class
result = [
- "No visible difference.",
- "You should look at your implementation of #{klass}#==.",
- expect
- ].join "\n"
+ "No visible difference in the #{klass}#inspect output.\n",
+ "You should look at the implementation of #== on ",
+ "#{klass} or its members.\n",
+ expect,
+ ].join
end
end
end
@@ -162,8 +179,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:
@@ -188,14 +205,6 @@ module MiniTest
end
##
- # Fails unless the block returns a true value.
-
- def assert_block msg = nil
- msg = message(msg) { "Expected block to return true value" }
- assert yield, msg
- end
-
- ##
# Fails unless +obj+ is empty.
def assert_empty obj, msg = nil
@@ -218,7 +227,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
##
@@ -229,7 +238,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
@@ -238,7 +249,7 @@ module MiniTest
# error less than +epsilon+.
def assert_in_epsilon a, b, epsilon = 0.001, msg = nil
- assert_in_delta a, b, [a, b].min * epsilon, msg
+ assert_in_delta a, b, [a.abs, b.abs].min * epsilon, msg
end
##
@@ -253,7 +264,7 @@ module MiniTest
end
##
- # Fails unless +obj+ is an instace of +cls+.
+ # Fails unless +obj+ is an instance of +cls+.
def assert_instance_of cls, obj, msg = nil
msg = message(msg) {
@@ -274,13 +285,13 @@ module MiniTest
end
##
- # Fails unless +exp+ is <tt>=~</tt> +act+.
+ # Fails unless +matcher+ <tt>=~</tt> +obj+.
- def assert_match exp, act, msg = nil
- msg = message(msg) { "Expected #{mu_pp(exp)} to match #{mu_pp(act)}" }
- assert_respond_to act, :"=~"
- exp = Regexp.new Regexp.escape exp if String === exp and String === act
- assert exp =~ act, msg
+ def assert_match matcher, obj, msg = nil
+ msg = message(msg) { "Expected #{mu_pp matcher} to match #{mu_pp obj}" }
+ assert_respond_to matcher, :"=~"
+ matcher = Regexp.new Regexp.escape matcher if String === matcher
+ assert matcher =~ obj, msg
end
##
@@ -292,11 +303,12 @@ module MiniTest
end
##
- # For testing equality operators and so-forth.
+ # For testing with binary operators.
#
# assert_operator 5, :<=, 4
- def assert_operator o1, op, o2, msg = nil
+ def assert_operator o1, op, o2 = UNDEFINED, msg = nil
+ return assert_predicate o1, op, msg if UNDEFINED == o2
msg = message(msg) { "Expected #{mu_pp(o1)} to be #{op} #{mu_pp(o2)}" }
assert o1.__send__(op, o2), msg
end
@@ -304,7 +316,10 @@ module MiniTest
##
# Fails if stdout or stderr do not output the expected results.
# Pass in nil if you don't care about that streams output. Pass in
- # "" if you require it to be silent.
+ # "" if you require it to be silent. Pass in a regexp if you want
+ # to pattern match.
+ #
+ # NOTE: this uses #capture_io, not #capture_subprocess_io.
#
# See also: #assert_silent
@@ -313,42 +328,60 @@ module MiniTest
yield
end
- x = assert_equal stdout, out, "In stdout" if stdout
- y = assert_equal stderr, err, "In stderr" if stderr
+ err_msg = Regexp === stderr ? :assert_match : :assert_equal if stderr
+ out_msg = Regexp === stdout ? :assert_match : :assert_equal if stdout
+
+ y = send err_msg, stderr, err, "In stderr" if err_msg
+ x = send out_msg, stdout, out, "In stdout" if out_msg
(!stdout || x) && (!stderr || y)
end
##
- # Fails unless the block raises one of +exp+
+ # For testing with predicates.
+ #
+ # assert_predicate str, :empty?
+ #
+ # This is really meant for specs and is front-ended by assert_operator:
+ #
+ # str.must_be :empty?
+
+ def assert_predicate o1, op, msg = nil
+ msg = message(msg) { "Expected #{mu_pp(o1)} to be #{op}" }
+ assert o1.__send__(op), msg
+ end
+
+ ##
+ # Fails unless the block raises one of +exp+. Returns the
+ # exception matched so you can check the message, attributes, etc.
def assert_raises *exp
- msg = "#{exp.pop}\n" if String === exp.last
+ msg = "#{exp.pop}.\n" if String === exp.last
- should_raise = false
begin
yield
- should_raise = true
rescue MiniTest::Skip => e
- details = "#{msg}#{mu_pp(exp)} exception expected, not"
-
- if exp.include? MiniTest::Skip then
- return e
- else
- raise e
- end
+ return e if exp.include? MiniTest::Skip
+ raise e
rescue Exception => e
- details = "#{msg}#{mu_pp(exp)} exception expected, not"
- assert(exp.any? { |ex|
- ex.instance_of?(Module) ? e.kind_of?(ex) : ex == e.class
- }, exception_details(e, details))
+ 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, "#{msg}#{mu_pp(exp)} exception expected, not")
+ }
return e
end
exp = exp.first if exp.size == 1
- flunk "#{msg}#{mu_pp(exp)} expected but nothing was raised." if
- should_raise
+
+ flunk "#{msg}#{mu_pp(exp)} expected but nothing was raised."
end
##
@@ -405,6 +438,8 @@ module MiniTest
catch(sym) do
begin
yield
+ rescue ThreadError => e # wtf?!? 1.8 + threads == suck
+ default += ", not \:#{e.message[/uncaught throw \`(\w+?)\'/, 1]}"
rescue ArgumentError => e # 1.9 exception
default += ", not #{e.message.split(/ /).last}"
rescue NameError => e # 1.8 exception
@@ -420,24 +455,76 @@ module MiniTest
# Captures $stdout and $stderr into strings:
#
# out, err = capture_io do
+ # puts "Some info"
# warn "You did a bad thing"
# end
#
+ # assert_match %r%info%, out
# assert_match %r%bad%, err
+ #
+ # NOTE: For efficiency, this method uses StringIO and does not
+ # capture IO for subprocesses. Use #capture_subprocess_io for
+ # that.
def capture_io
require 'stringio'
- orig_stdout, orig_stderr = $stdout, $stderr
captured_stdout, captured_stderr = StringIO.new, StringIO.new
- $stdout, $stderr = captured_stdout, captured_stderr
- yield
+ synchronize do
+ orig_stdout, orig_stderr = $stdout, $stderr
+ $stdout, $stderr = captured_stdout, captured_stderr
+
+ begin
+ yield
+ ensure
+ $stdout = orig_stdout
+ $stderr = orig_stderr
+ end
+ end
return captured_stdout.string, captured_stderr.string
- ensure
- $stdout = orig_stdout
- $stderr = orig_stderr
+ end
+
+ ##
+ # Captures $stdout and $stderr into strings, using Tempfile to
+ # ensure that subprocess IO is captured as well.
+ #
+ # out, err = capture_subprocess_io do
+ # system "echo Some info"
+ # system "echo You did a bad thing 1>&2"
+ # end
+ #
+ # assert_match %r%info%, out
+ # assert_match %r%bad%, err
+ #
+ # NOTE: This method is approximately 10x slower than #capture_io so
+ # only use it when you need to test the output of a subprocess.
+
+ def capture_subprocess_io
+ require 'tempfile'
+
+ captured_stdout, captured_stderr = Tempfile.new("out"), Tempfile.new("err")
+
+ synchronize do
+ orig_stdout, orig_stderr = $stdout.dup, $stderr.dup
+ $stdout.reopen captured_stdout
+ $stderr.reopen captured_stderr
+
+ begin
+ yield
+
+ $stdout.rewind
+ $stderr.rewind
+
+ [captured_stdout.read, captured_stderr.read]
+ ensure
+ captured_stdout.unlink
+ captured_stderr.unlink
+ $stdout.reopen orig_stdout
+ $stderr.reopen orig_stderr
+ end
+ end
end
##
@@ -467,6 +554,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}"
}
@@ -509,16 +597,16 @@ module MiniTest
end
##
- # For comparing Floats. Fails if +exp+ is within +delta+ of +act+
+ # For comparing Floats. Fails if +exp+ is within +delta+ of +act+.
#
# refute_in_delta Math::PI, (22.0 / 7.0)
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
##
@@ -530,7 +618,7 @@ module MiniTest
end
##
- # Fails if +collection+ includes +obj+
+ # Fails if +collection+ includes +obj+.
def refute_includes collection, obj, msg = nil
msg = message(msg) {
@@ -541,7 +629,7 @@ module MiniTest
end
##
- # Fails if +obj+ is an instance of +cls+
+ # Fails if +obj+ is an instance of +cls+.
def refute_instance_of cls, obj, msg = nil
msg = message(msg) {
@@ -551,7 +639,7 @@ module MiniTest
end
##
- # Fails if +obj+ is a kind of +cls+
+ # Fails if +obj+ is a kind of +cls+.
def refute_kind_of cls, obj, msg = nil # TODO: merge with instance_of
msg = message(msg) { "Expected #{mu_pp(obj)} to not be a kind of #{cls}" }
@@ -559,13 +647,13 @@ module MiniTest
end
##
- # Fails if +exp+ <tt>=~</tt> +act+
+ # Fails if +matcher+ <tt>=~</tt> +obj+.
- def refute_match exp, act, msg = nil
- msg = message(msg) { "Expected #{mu_pp(exp)} to not match #{mu_pp(act)}" }
- assert_respond_to act, :"=~"
- exp = (/#{Regexp.escape exp}/) if String === exp and String === act
- refute exp =~ act, msg
+ def refute_match matcher, obj, msg = nil
+ msg = message(msg) {"Expected #{mu_pp matcher} to not match #{mu_pp obj}"}
+ assert_respond_to matcher, :"=~"
+ matcher = Regexp.new Regexp.escape matcher if String === matcher
+ refute matcher =~ obj, msg
end
##
@@ -582,14 +670,27 @@ module MiniTest
# refute_operator 1, :>, 2 #=> pass
# refute_operator 1, :<, 2 #=> fail
- def refute_operator o1, op, o2, msg = nil
- msg = message(msg) {
- "Expected #{mu_pp(o1)} to not be #{op} #{mu_pp(o2)}"
- }
+ def refute_operator o1, op, o2 = UNDEFINED, msg = nil
+ return refute_predicate o1, op, msg if UNDEFINED == o2
+ msg = message(msg) { "Expected #{mu_pp(o1)} to not be #{op} #{mu_pp(o2)}"}
refute o1.__send__(op, o2), msg
end
##
+ # For testing with predicates.
+ #
+ # refute_predicate str, :empty?
+ #
+ # This is really meant for specs and is front-ended by refute_operator:
+ #
+ # str.wont_be :empty?
+
+ def refute_predicate o1, op, msg = nil
+ msg = message(msg) { "Expected #{mu_pp(o1)} to not be #{op}" }
+ refute o1.__send__(op), msg
+ end
+
+ ##
# Fails if +obj+ responds to the message +meth+.
def refute_respond_to obj, meth, msg = nil
@@ -615,35 +716,68 @@ 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
+ Minitest::Unit.runner.synchronize do
+ yield
+ end
+ end
end
- class Unit
- VERSION = "2.5.1" # :nodoc:
+ class Unit # :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
@options ||= {}
end
@@installed_at_exit ||= false
@@out = $stdout
+ @@after_tests = []
##
- # A simple hook allowing you to run a block of code after the
- # tests are done. Eg:
+ # A simple hook allowing you to run a block of code after _all_ of
+ # the tests are done. Eg:
#
# MiniTest::Unit.after_tests { p $debugging_info }
- def self.after_tests
- at_exit { at_exit { yield } }
+ def self.after_tests &block
+ @@after_tests << block
end
##
@@ -651,7 +785,8 @@ module MiniTest
def self.autorun
at_exit {
- next if $! # don't run if there was an exception
+ # don't run if there was a non-exit exception
+ next if $! and not $!.kind_of? SystemExit
# the order here is important. The at_exit handler must be
# installed before anyone else gets a chance to install their
@@ -659,7 +794,10 @@ module MiniTest
# to run (at_exit stacks).
exit_code = nil
- at_exit { exit false if exit_code && exit_code != 0 }
+ at_exit {
+ @@after_tests.reverse_each(&:call)
+ exit false if exit_code && exit_code != 0
+ }
exit_code = MiniTest::Unit.new.run ARGV
} unless @@installed_at_exit
@@ -674,16 +812,6 @@ module MiniTest
end
##
- # Returns the stream to use for output.
- #
- # DEPRECATED: use ::output instead.
-
- def self.out
- warn "::out deprecated, use ::output instead." if $VERBOSE
- output
- end
-
- ##
# Sets MiniTest::Unit to write output to +stream+. $stdout is the default
# output
@@ -717,6 +845,9 @@ module MiniTest
grep(/^run_/).map { |s| s.to_s }).uniq
end
+ ##
+ # Return the IO for output.
+
def output
self.class.output
end
@@ -729,6 +860,13 @@ module MiniTest
output.print(*a)
end
+ def test_count # :nodoc:
+ @test_count ||= 0
+ end
+
+ ##
+ # Runner for a given +type+ (eg, test vs bench).
+
def _run_anything type
suites = TestCase.send "#{type}_suites"
return if suites.empty?
@@ -766,10 +904,19 @@ module MiniTest
status
end
+ ##
+ # Runs all the +suites+ for a given +type+.
+ #
+ # NOTE: this method is redefined in parallel_each.rb, which is
+ # loaded if a test-suite calls parallelize_me!.
+
def _run_suites suites, type
suites.map { |suite| _run_suite suite, type }
end
+ ##
+ # Run a single +suite+ for a given +type+.
+
def _run_suite suite, type
header = "#{type}_suite_header"
puts send(header, suite) if respond_to? header
@@ -777,17 +924,22 @@ 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}"
+ }
+
+ assertions = filtered_test_methods.map { |method|
inst = suite.new method
inst._assertions = 0
print "#{suite}##{method} = " if @verbose
- @start_time = Time.now
+ start_time = Time.now if @verbose
result = inst.run self
- time = Time.now - @start_time
- print "%.2f s = " % time if @verbose
+ print "%.2f s = " % (Time.now - start_time) if @verbose
print result
puts if @verbose
@@ -797,6 +949,26 @@ module MiniTest
return assertions.size, assertions.inject(0) { |sum, n| sum + n }
end
+ ##
+ # Record the result of a single test. Makes it very easy to gather
+ # information. Eg:
+ #
+ # class StatisticsRecorder < MiniTest::Unit
+ # def record suite, method, assertions, time, error
+ # # ... record the results somewhere ...
+ # end
+ # 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
+
def location e # :nodoc:
last_before_assertion = ""
e.backtrace.reverse_each do |s|
@@ -815,14 +987,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]
@@ -832,9 +1004,19 @@ module MiniTest
@report = []
@errors = @failures = @skips = 0
@verbose = false
+ @mutex = defined?(Mutex) ? Mutex.new : nil
+ @info_signal = Signal.list['INFO']
end
- def process_args args = []
+ def synchronize # :nodoc:
+ if @mutex then
+ @mutex.synchronize { yield }
+ else
+ yield
+ end
+ end
+
+ def process_args args = [] # :nodoc:
options = {}
orig_args = args.dup
@@ -855,7 +1037,7 @@ module MiniTest
options[:verbose] = true
end
- opts.on '-n', '--name PATTERN', "Filter test names on pattern." do |a|
+ opts.on '-n', '--name PATTERN', "Filter test names on pattern (e.g. /foo/)" do |a|
options[:filter] = a
end
@@ -888,7 +1070,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}"
@@ -897,7 +1080,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
@@ -918,67 +1101,220 @@ module MiniTest
end
##
+ # Provides a simple set of guards that you can use in your tests
+ # to skip execution if it is not applicable. These methods are
+ # mixed into TestCase as both instance and class methods so you
+ # can use them inside or outside of the test methods.
+ #
+ # def test_something_for_mri
+ # skip "bug 1234" if jruby?
+ # # ...
+ # end
+ #
+ # if windows? then
+ # # ... lots of test methods ...
+ # end
+
+ module Guard
+
+ ##
+ # Is this running on jruby?
+
+ def jruby? platform = RUBY_PLATFORM
+ "java" == platform
+ end
+
+ ##
+ # 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
+
+ ##
+ # Is this running on rubinius?
+
+ def rubinius? platform = defined?(RUBY_ENGINE) && RUBY_ENGINE
+ "rbx" == platform
+ end
+
+ ##
+ # Is this running on windows?
+
+ def windows? platform = RUBY_PLATFORM
+ /mswin|mingw/ =~ platform
+ end
+ end
+
+ ##
+ # Provides before/after hooks for setup and teardown. These are
+ # meant for library writers, NOT for regular test authors. See
+ # #before_setup for an example.
+
+ module LifecycleHooks
+ ##
+ # Runs before every test, after setup. This hook is meant for
+ # libraries to extend minitest. It is not meant to be used by
+ # test developers.
+ #
+ # See #before_setup for an example.
+
+ def after_setup; end
+
+ ##
+ # Runs before every test, before setup. This hook is meant for
+ # libraries to extend minitest. It is not meant to be used by
+ # test developers.
+ #
+ # As a simplistic example:
+ #
+ # module MyMinitestPlugin
+ # def before_setup
+ # super
+ # # ... stuff to do before setup is run
+ # end
+ #
+ # def after_setup
+ # # ... stuff to do after setup is run
+ # super
+ # end
+ #
+ # def before_teardown
+ # super
+ # # ... stuff to do before teardown is run
+ # end
+ #
+ # def after_teardown
+ # # ... stuff to do after teardown is run
+ # super
+ # end
+ # end
+ #
+ # class MiniTest::Unit::TestCase
+ # include MyMinitestPlugin
+ # end
+
+ def before_setup; end
+
+ ##
+ # Runs after every test, before teardown. This hook is meant for
+ # libraries to extend minitest. It is not meant to be used by
+ # test developers.
+ #
+ # See #before_setup for an example.
+
+ def before_teardown; end
+
+ ##
+ # Runs after every test, after teardown. This hook is meant for
+ # libraries to extend minitest. It is not meant to be used by
+ # test developers.
+ #
+ # See #before_setup for an example.
+
+ def after_teardown; end
+ end
+
+ ##
# Subclass TestCase to create your own tests. Typically you'll want a
# TestCase subclass per implementation class.
#
# See MiniTest::Assertions
class TestCase
+ include LifecycleHooks
+ include Guard
+ extend Guard
+
attr_reader :__name__ # :nodoc:
PASSTHROUGH_EXCEPTIONS = [NoMemoryError, SignalException,
Interrupt, SystemExit] # :nodoc:
- SUPPORTS_INFO_SIGNAL = Signal.list['INFO'] # :nodoc:
-
##
# Runs the tests reporting the status to +runner+
def run runner
trap "INFO" do
+ runner.report.each_with_index do |msg, i|
+ warn "\n%3d) %s" % [i + 1, msg]
+ end
+ warn ''
time = runner.start_time ? Time.now - runner.start_time : 0
- warn "%s#%s %.2fs" % [self.class, self.__name__, time]
+ 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
result = ""
begin
@passed = nil
+ self.before_setup
self.setup
- self.run_setup_hooks
- self.__send__ self.__name__
+ self.after_setup
+ self.run_test self.__name__
result = "." unless io?
+ time = Time.now - start_time
+ runner.record self.class, self.__name__, self._assertions, time, nil
@passed = true
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
ensure
- begin
- self.run_teardown_hooks
- self.teardown
- rescue *PASSTHROUGH_EXCEPTIONS
- raise
- rescue Exception => e
- result = runner.puke self.class, self.__name__, e
+ %w{ before_teardown teardown after_teardown }.each do |hook|
+ begin
+ self.send hook
+ rescue *PASSTHROUGH_EXCEPTIONS
+ 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
+ alias :run_test :__send__
+
def initialize name # :nodoc:
@__name__ = name
@__io__ = nil
@passed = nil
+ @@current = self # FIX: make thread local
+ end
+
+ def self.current # :nodoc:
+ @@current # FIX: make thread local
end
+ ##
+ # Return the output IO object
+
def io
@__io__ = true
MiniTest::Unit.output
end
+ ##
+ # Have we hooked up the IO yet?
+
def io?
@__io__
end
@@ -996,13 +1332,41 @@ module MiniTest
def self.i_suck_and_my_tests_are_order_dependent!
class << self
+ undef_method :test_order if method_defined? :test_order
define_method :test_order do :alpha end
end
end
+ ##
+ # Make diffs for this TestCase use #pretty_inspect so that diff
+ # in assert_equal can be more details. NOTE: this is much slower
+ # than the regular inspect but much more usable for complex
+ # objects.
+
+ def self.make_my_diffs_pretty!
+ require 'pp'
+
+ define_method :mu_pp do |o|
+ o.pretty_inspect
+ end
+ end
+
+ ##
+ # Call this at the top of your tests when you want to run your
+ # tests in parallel. In doing so, you're admitting that you rule
+ # and your tests are awesome.
+
+ def self.parallelize_me!
+ require "minitest/parallel_each"
+
+ class << self
+ undef_method :test_order if method_defined? :test_order
+ define_method :test_order do :parallel end
+ end
+ end
+
def self.inherited klass # :nodoc:
@@test_suites[klass] = true
- klass.reset_setup_teardown_hooks
super
end
@@ -1018,6 +1382,9 @@ module MiniTest
methods = public_instance_methods(true).grep(/^test/).map { |m| m.to_s }
case self.test_order
+ when :parallel
+ max = methods.size
+ ParallelEach.new methods.sort.sort_by { rand max }
when :random then
max = methods.size
methods.sort.sort_by { rand max }
@@ -1036,134 +1403,20 @@ module MiniTest
end
##
- # Runs before every test. Use this to refactor test initialization.
+ # Runs before every test. Use this to set up before each test
+ # run.
def setup; end
##
- # Runs after every test. Use this to refactor test cleanup.
+ # Runs after every test. Use this to clean up after each test
+ # run.
def teardown; end
- def self.reset_setup_teardown_hooks # :nodoc:
- @setup_hooks = []
- @teardown_hooks = []
- end
-
- reset_setup_teardown_hooks
-
- ##
- # Adds a block of code that will be executed before every TestCase is
- # run. Equivalent to +setup+, but usable multiple times and without
- # re-opening any classes.
- #
- # All of the setup hooks will run in order after the +setup+ method, if
- # one is defined.
- #
- # The argument can be any object that responds to #call or a block.
- # That means that this call,
- #
- # MiniTest::TestCase.add_setup_hook { puts "foo" }
- #
- # ... is equivalent to:
- #
- # module MyTestSetup
- # def call
- # puts "foo"
- # end
- # end
- #
- # MiniTest::TestCase.add_setup_hook MyTestSetup
- #
- # The blocks passed to +add_setup_hook+ take an optional parameter that
- # will be the TestCase instance that is executing the block.
-
- def self.add_setup_hook arg=nil, &block
- hook = arg || block
- @setup_hooks << hook
- end
-
- def self.setup_hooks # :nodoc:
- if superclass.respond_to? :setup_hooks then
- superclass.setup_hooks
- else
- []
- end + @setup_hooks
- end
-
- def run_setup_hooks # :nodoc:
- self.class.setup_hooks.each do |hook|
- if hook.respond_to?(:arity) && hook.arity == 1
- hook.call(self)
- else
- hook.call
- end
- end
- end
-
- ##
- # Adds a block of code that will be executed after every TestCase is
- # run. Equivalent to +teardown+, but usable multiple times and without
- # re-opening any classes.
- #
- # All of the teardown hooks will run in reverse order after the
- # +teardown+ method, if one is defined.
- #
- # The argument can be any object that responds to #call or a block.
- # That means that this call,
- #
- # MiniTest::TestCase.add_teardown_hook { puts "foo" }
- #
- # ... is equivalent to:
- #
- # module MyTestTeardown
- # def call
- # puts "foo"
- # end
- # end
- #
- # MiniTest::TestCase.add_teardown_hook MyTestTeardown
- #
- # The blocks passed to +add_teardown_hook+ take an optional parameter
- # that will be the TestCase instance that is executing the block.
-
- def self.add_teardown_hook arg=nil, &block
- hook = arg || block
- @teardown_hooks << hook
- end
-
- def self.teardown_hooks # :nodoc:
- if superclass.respond_to? :teardown_hooks then
- superclass.teardown_hooks
- else
- []
- end + @teardown_hooks
- end
-
- def run_teardown_hooks # :nodoc:
- self.class.teardown_hooks.reverse.each do |hook|
- if hook.respond_to?(:arity) && hook.arity == 1
- hook.call(self)
- else
- hook.call
- end
- end
- end
-
include MiniTest::Assertions
end # class TestCase
end # class Unit
end # module MiniTest
-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
+Minitest = MiniTest # :nodoc: because ugh... I typo this all the time
diff --git a/lib/mkmf.rb b/lib/mkmf.rb
index 8f4e69e429..a3a39dfe3c 100644
--- a/lib/mkmf.rb
+++ b/lib/mkmf.rb
@@ -1,4 +1,4 @@
-# -*- indent-tabs-mode: t -*-
+# -*- coding: us-ascii -*-
# module to create Makefile for extension modules
# invoke like: ruby -r mkmf extconf.rb
@@ -6,1680 +6,1883 @@ require 'rbconfig'
require 'fileutils'
require 'shellwords'
-CONFIG = RbConfig::MAKEFILE_CONFIG
-ORIG_LIBPATH = ENV['LIB']
-
-C_EXT = %w[c m]
-CXX_EXT = %w[cc mm cxx cpp]
-if File::FNM_SYSCASE.zero?
- CXX_EXT.concat(%w[C])
-end
-SRC_EXT = C_EXT + CXX_EXT
-$static = nil
-$config_h = '$(arch_hdrdir)/ruby/config.h'
-$default_static = $static
-
-unless defined? $configure_args
- $configure_args = {}
- args = CONFIG["configure_args"]
- if ENV["CONFIGURE_ARGS"]
- args << " " << ENV["CONFIGURE_ARGS"]
- end
- for arg in Shellwords::shellwords(args)
- arg, val = arg.split('=', 2)
- next unless arg
- arg.tr!('_', '-')
- if arg.sub!(/^(?!--)/, '--')
- val or next
- arg.downcase!
- end
- next if /^--(?:top|topsrc|src|cur)dir$/ =~ arg
- $configure_args[arg] = val || true
- end
- for arg in ARGV
- arg, val = arg.split('=', 2)
- next unless arg
- arg.tr!('_', '-')
- if arg.sub!(/^(?!--)/, '--')
- val or next
- arg.downcase!
- end
- $configure_args[arg] = val || true
+# :stopdoc:
+class String
+ # Wraps a string in escaped quotes if it contains whitespace.
+ def quote
+ /\s/ =~ self ? "\"#{self}\"" : "#{self}"
end
-end
-$libdir = CONFIG["libdir"]
-$rubylibdir = CONFIG["rubylibdir"]
-$archdir = CONFIG["archdir"]
-$sitedir = CONFIG["sitedir"]
-$sitelibdir = CONFIG["sitelibdir"]
-$sitearchdir = CONFIG["sitearchdir"]
-$vendordir = CONFIG["vendordir"]
-$vendorlibdir = CONFIG["vendorlibdir"]
-$vendorarchdir = CONFIG["vendorarchdir"]
-
-$mswin = /mswin/ =~ RUBY_PLATFORM
-$bccwin = /bccwin/ =~ RUBY_PLATFORM
-$mingw = /mingw/ =~ RUBY_PLATFORM
-$cygwin = /cygwin/ =~ RUBY_PLATFORM
-$netbsd = /netbsd/ =~ RUBY_PLATFORM
-$os2 = /os2/ =~ RUBY_PLATFORM
-$beos = /beos/ =~ RUBY_PLATFORM
-$haiku = /haiku/ =~ RUBY_PLATFORM
-$solaris = /solaris/ =~ RUBY_PLATFORM
-$universal = /universal/ =~ RUBY_PLATFORM
-$dest_prefix_pattern = (File::PATH_SEPARATOR == ';' ? /\A([[:alpha:]]:)?/ : /\A/)
+ # Escape whitespaces for Makefile.
+ def unspace
+ gsub(/\s/, '\\\\\\&')
+ end
-# :stopdoc:
+ # Generates a string used as cpp macro name.
+ def tr_cpp
+ strip.upcase.tr_s("^A-Z0-9_*", "_").tr_s("*", "P")
+ end
-def config_string(key, config = CONFIG)
- s = config[key] and !s.empty? and block_given? ? yield(s) : s
-end
+ def funcall_style
+ /\)\z/ =~ self ? dup : "#{self}()"
+ end
-def dir_re(dir)
- Regexp.new('\$(?:\('+dir+'\)|\{'+dir+'\})(?:\$(?:\(target_prefix\)|\{target_prefix\}))?')
+ def sans_arguments
+ self[/\A[^()]+/]
+ end
end
-def relative_from(path, base)
- dir = File.join(path, "")
- if File.expand_path(dir) == File.expand_path(dir, base)
- path
- else
- File.join(base, path)
+class Array
+ # Wraps all strings in escaped quotes if they contain whitespace.
+ def quote
+ map {|s| s.quote}
end
end
+# :startdoc:
-INSTALL_DIRS = [
- [dir_re('commondir'), "$(RUBYCOMMONDIR)"],
- [dir_re('sitedir'), "$(RUBYCOMMONDIR)"],
- [dir_re('vendordir'), "$(RUBYCOMMONDIR)"],
- [dir_re('rubylibdir'), "$(RUBYLIBDIR)"],
- [dir_re('archdir'), "$(RUBYARCHDIR)"],
- [dir_re('sitelibdir'), "$(RUBYLIBDIR)"],
- [dir_re('vendorlibdir'), "$(RUBYLIBDIR)"],
- [dir_re('sitearchdir'), "$(RUBYARCHDIR)"],
- [dir_re('vendorarchdir'), "$(RUBYARCHDIR)"],
- [dir_re('rubyhdrdir'), "$(RUBYHDRDIR)"],
- [dir_re('sitehdrdir'), "$(SITEHDRDIR)"],
- [dir_re('vendorhdrdir'), "$(VENDORHDRDIR)"],
- [dir_re('bindir'), "$(BINDIR)"],
-]
-
-def install_dirs(target_prefix = nil)
- if $extout
- dirs = [
- ['BINDIR', '$(extout)/bin'],
- ['RUBYCOMMONDIR', '$(extout)/common'],
- ['RUBYLIBDIR', '$(RUBYCOMMONDIR)$(target_prefix)'],
- ['RUBYARCHDIR', '$(extout)/$(arch)$(target_prefix)'],
- ['HDRDIR', '$(extout)/include/ruby$(target_prefix)'],
- ['ARCHHDRDIR', '$(extout)/include/$(arch)/ruby$(target_prefix)'],
- ['extout', "#$extout"],
- ['extout_prefix', "#$extout_prefix"],
- ]
- elsif $extmk
- dirs = [
- ['BINDIR', '$(bindir)'],
- ['RUBYCOMMONDIR', '$(rubylibdir)'],
- ['RUBYLIBDIR', '$(rubylibdir)$(target_prefix)'],
- ['RUBYARCHDIR', '$(archdir)$(target_prefix)'],
- ['HDRDIR', '$(rubyhdrdir)/ruby$(target_prefix)'],
- ['ARCHHDRDIR', '$(rubyhdrdir)/$(arch)/ruby$(target_prefix)'],
- ]
- elsif $configure_args.has_key?('--vendor')
- dirs = [
- ['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', '$(bindir)'],
- ['RUBYCOMMONDIR', '$(sitedir)$(target_prefix)'],
- ['RUBYLIBDIR', '$(sitelibdir)$(target_prefix)'],
- ['RUBYARCHDIR', '$(sitearchdir)$(target_prefix)'],
- ['HDRDIR', '$(rubyhdrdir)/ruby$(target_prefix)'],
- ['ARCHHDRDIR', '$(rubyhdrdir)/$(arch)/ruby$(target_prefix)'],
- ]
+##
+# 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.
+
+ CONFIG = RbConfig::MAKEFILE_CONFIG
+ ORIG_LIBPATH = ENV['LIB']
+
+ ##
+ # Extensions for files compiled with a C compiler
+
+ C_EXT = %w[c m]
+
+ ##
+ # Extensions for files complied with a C++ compiler
+
+ CXX_EXT = %w[cc mm cxx cpp]
+ if File::FNM_SYSCASE.zero?
+ CXX_EXT.concat(%w[C])
end
- dirs << ['target_prefix', (target_prefix ? "/#{target_prefix}" : "")]
- dirs
-end
-def map_dir(dir, map = nil)
- map ||= INSTALL_DIRS
- map.inject(dir) {|d, (orig, new)| d.gsub(orig, new)}
-end
+ ##
+ # Extensions for source files
-topdir = File.dirname(File.dirname(__FILE__))
-path = File.expand_path($0)
-$extmk = path[0, topdir.size+1] == topdir+"/"
-$extmk &&= %r"\A(?:ext|enc|tool|test(?:/.+)?)\z" =~ File.dirname(path[topdir.size+1..-1])
-$extmk &&= true
-if not $extmk and File.exist?(($hdrdir = RbConfig::CONFIG["rubyhdrdir"]) + "/ruby/ruby.h")
- $topdir = $hdrdir
- $top_srcdir = $hdrdir
- $arch_hdrdir = $hdrdir + "/$(arch)"
-elsif File.exist?(($hdrdir = ($top_srcdir ||= topdir) + "/include") + "/ruby.h")
- $topdir ||= RbConfig::CONFIG["topdir"]
- $arch_hdrdir = "$(extout)/include/$(arch)"
-else
- abort "mkmf.rb can't find header files for ruby at #{$hdrdir}/ruby.h"
-end
+ SRC_EXT = C_EXT + CXX_EXT
-OUTFLAG = CONFIG['OUTFLAG']
-COUTFLAG = CONFIG['COUTFLAG']
-CPPOUTFILE = CONFIG['CPPOUTFILE']
+ ##
+ # Extensions for header files
-CONFTEST_C = "conftest.c".freeze
+ HDR_EXT = %w[h hpp]
+ $static = nil
+ $config_h = '$(arch_hdrdir)/ruby/config.h'
+ $default_static = $static
-class String
- # Wraps a string in escaped quotes if it contains whitespace.
- def quote
- /\s/ =~ self ? "\"#{self}\"" : "#{self}"
+ unless defined? $configure_args
+ $configure_args = {}
+ args = CONFIG["configure_args"]
+ if ENV["CONFIGURE_ARGS"]
+ args << " " << ENV["CONFIGURE_ARGS"]
+ end
+ for arg in Shellwords::shellwords(args)
+ arg, val = arg.split('=', 2)
+ next unless arg
+ arg.tr!('_', '-')
+ if arg.sub!(/^(?!--)/, '--')
+ val or next
+ arg.downcase!
+ end
+ next if /^--(?:top|topsrc|src|cur)dir$/ =~ arg
+ $configure_args[arg] = val || true
+ end
+ for arg in ARGV
+ arg, val = arg.split('=', 2)
+ next unless arg
+ arg.tr!('_', '-')
+ if arg.sub!(/^(?!--)/, '--')
+ val or next
+ arg.downcase!
+ end
+ $configure_args[arg] = val || true
+ end
end
- # Generates a string used as cpp macro name.
- def tr_cpp
- strip.upcase.tr_s("^A-Z0-9_*", "_").tr_s("*", "P")
+ $libdir = CONFIG["libdir"]
+ $rubylibdir = CONFIG["rubylibdir"]
+ $archdir = CONFIG["archdir"]
+ $sitedir = CONFIG["sitedir"]
+ $sitelibdir = CONFIG["sitelibdir"]
+ $sitearchdir = CONFIG["sitearchdir"]
+ $vendordir = CONFIG["vendordir"]
+ $vendorlibdir = CONFIG["vendorlibdir"]
+ $vendorarchdir = CONFIG["vendorarchdir"]
+
+ $mswin = /mswin/ =~ RUBY_PLATFORM
+ $bccwin = /bccwin/ =~ RUBY_PLATFORM
+ $mingw = /mingw/ =~ RUBY_PLATFORM
+ $cygwin = /cygwin/ =~ RUBY_PLATFORM
+ $netbsd = /netbsd/ =~ RUBY_PLATFORM
+ $os2 = /os2/ =~ RUBY_PLATFORM
+ $beos = /beos/ =~ RUBY_PLATFORM
+ $haiku = /haiku/ =~ RUBY_PLATFORM
+ $solaris = /solaris/ =~ RUBY_PLATFORM
+ $universal = /universal/ =~ RUBY_PLATFORM
+ $dest_prefix_pattern = (File::PATH_SEPARATOR == ';' ? /\A([[:alpha:]]:)?/ : /\A/)
+
+ # :stopdoc:
+
+ def config_string(key, config = CONFIG)
+ s = config[key] and !s.empty? and block_given? ? yield(s) : s
end
-end
-class Array
- # Wraps all strings in escaped quotes if they contain whitespace.
- def quote
- map {|s| s.quote}
+ module_function :config_string
+
+ def dir_re(dir)
+ Regexp.new('\$(?:\('+dir+'\)|\{'+dir+'\})(?:\$(?:\(target_prefix\)|\{target_prefix\}))?')
end
-end
+ module_function :dir_re
-def rm_f(*files)
- opt = (Hash === files.last ? [files.pop] : [])
- FileUtils.rm_f(Dir[*files.flatten], *opt)
-end
+ def relative_from(path, base)
+ dir = File.join(path, "")
+ if File.expand_path(dir) == File.expand_path(dir, base)
+ path
+ else
+ File.join(base, path)
+ end
+ end
-def rm_rf(*files)
- opt = (Hash === files.last ? [files.pop] : [])
- FileUtils.rm_rf(Dir[*files.flatten], *opt)
-end
+ INSTALL_DIRS = [
+ [dir_re('commondir'), "$(RUBYCOMMONDIR)"],
+ [dir_re('sitedir'), "$(RUBYCOMMONDIR)"],
+ [dir_re('vendordir'), "$(RUBYCOMMONDIR)"],
+ [dir_re('rubylibdir'), "$(RUBYLIBDIR)"],
+ [dir_re('archdir'), "$(RUBYARCHDIR)"],
+ [dir_re('sitelibdir'), "$(RUBYLIBDIR)"],
+ [dir_re('vendorlibdir'), "$(RUBYLIBDIR)"],
+ [dir_re('sitearchdir'), "$(RUBYARCHDIR)"],
+ [dir_re('vendorarchdir'), "$(RUBYARCHDIR)"],
+ [dir_re('rubyhdrdir'), "$(RUBYHDRDIR)"],
+ [dir_re('sitehdrdir'), "$(SITEHDRDIR)"],
+ [dir_re('vendorhdrdir'), "$(VENDORHDRDIR)"],
+ [dir_re('bindir'), "$(BINDIR)"],
+ ]
+
+ def install_dirs(target_prefix = nil)
+ if $extout
+ dirs = [
+ ['BINDIR', '$(extout)/bin'],
+ ['RUBYCOMMONDIR', '$(extout)/common'],
+ ['RUBYLIBDIR', '$(RUBYCOMMONDIR)$(target_prefix)'],
+ ['RUBYARCHDIR', '$(extout)/$(arch)$(target_prefix)'],
+ ['HDRDIR', '$(extout)/include/ruby$(target_prefix)'],
+ ['ARCHHDRDIR', '$(extout)/include/$(arch)/ruby$(target_prefix)'],
+ ['extout', "#$extout"],
+ ['extout_prefix', "#$extout_prefix"],
+ ]
+ elsif $extmk
+ dirs = [
+ ['BINDIR', '$(bindir)'],
+ ['RUBYCOMMONDIR', '$(rubylibdir)'],
+ ['RUBYLIBDIR', '$(rubylibdir)$(target_prefix)'],
+ ['RUBYARCHDIR', '$(archdir)$(target_prefix)'],
+ ['HDRDIR', '$(rubyhdrdir)/ruby$(target_prefix)'],
+ ['ARCHHDRDIR', '$(rubyhdrdir)/$(arch)/ruby$(target_prefix)'],
+ ]
+ elsif $configure_args.has_key?('--vendor')
+ dirs = [
+ ['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', '$(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}" : "")]
+ dirs
+ end
-# Returns time stamp of the +target+ file if it exists and is newer
-# than or equal to all of +times+.
-def modified?(target, times)
- (t = File.mtime(target)) rescue return nil
- Array === times or times = [times]
- t if times.all? {|n| n <= t}
-end
+ def map_dir(dir, map = nil)
+ map ||= INSTALL_DIRS
+ map.inject(dir) {|d, (orig, new)| d.gsub(orig, new)}
+ end
-def merge_libs(*libs)
- libs.inject([]) do |x, y|
- xy = x & y
- xn = yn = 0
- y = y.inject([]) {|ary, e| ary.last == e ? ary : ary << e}
- y.each_with_index do |v, yi|
- if xy.include?(v)
- xi = [x.index(v), xn].max()
- x[xi, 1] = y[yn..yi]
- xn, yn = xi + (yi - yn + 1), yi + 1
- end
+ topdir = File.dirname(File.dirname(__FILE__))
+ path = File.expand_path($0)
+ until (dir = File.dirname(path)) == path
+ if File.identical?(dir, topdir)
+ $extmk = true if %r"\A(?:ext|enc|tool|test)\z" =~ File.basename(path)
+ break
end
- x.concat(y[yn..-1] || [])
+ path = dir
+ end
+ $extmk ||= false
+ if not $extmk and File.exist?(($hdrdir = RbConfig::CONFIG["rubyhdrdir"]) + "/ruby/ruby.h")
+ $topdir = $hdrdir
+ $top_srcdir = $hdrdir
+ $arch_hdrdir = RbConfig::CONFIG["rubyarchhdrdir"]
+ elsif File.exist?(($hdrdir = ($top_srcdir ||= topdir) + "/include") + "/ruby.h")
+ $topdir ||= RbConfig::CONFIG["topdir"]
+ $arch_hdrdir = "$(extout)/include/$(arch)"
+ else
+ abort "mkmf.rb can't find header files for ruby at #{$hdrdir}/ruby.h"
end
-end
-# This is a custom logging module. It generates an mkmf.log file when you
-# run your extconf.rb script. This can be useful for debugging unexpected
-# failures.
-#
-# This module and its associated methods are meant for internal use only.
-#
-module Logging
- @log = nil
- @logfile = 'mkmf.log'
- @orgerr = $stderr.dup
- @orgout = $stdout.dup
- @postpone = 0
- @quiet = $extmk
-
- def self::log_open
- @log ||= File::open(@logfile, 'wb')
- @log.sync = true
- end
-
- def self::open
- log_open
- $stderr.reopen(@log)
- $stdout.reopen(@log)
- yield
- ensure
- $stderr.reopen(@orgerr)
- $stdout.reopen(@orgout)
+ CONFTEST = "conftest".freeze
+ CONFTEST_C = "#{CONFTEST}.c"
+
+ OUTFLAG = CONFIG['OUTFLAG']
+ COUTFLAG = CONFIG['COUTFLAG']
+ CPPOUTFILE = config_string('CPPOUTFILE') {|str| str.sub(/\bconftest\b/, CONFTEST)}
+
+ def rm_f(*files)
+ opt = (Hash === files.last ? [files.pop] : [])
+ FileUtils.rm_f(Dir[*files.flatten], *opt)
end
+ module_function :rm_f
- def self::message(*s)
- log_open
- @log.printf(*s)
+ def rm_rf(*files)
+ opt = (Hash === files.last ? [files.pop] : [])
+ FileUtils.rm_rf(Dir[*files.flatten], *opt)
end
+ module_function :rm_rf
- def self::logfile file
- @logfile = file
- log_close
+ # Returns time stamp of the +target+ file if it exists and is newer than or
+ # equal to all of +times+.
+ def modified?(target, times)
+ (t = File.mtime(target)) rescue return nil
+ Array === times or times = [times]
+ t if times.all? {|n| n <= t}
end
- def self::log_close
- if @log and not @log.closed?
- @log.flush
- @log.close
- @log = nil
+ def split_libs(*strs)
+ strs.map {|s| s.split(/\s+(?=-|\z)/)}.flatten
+ end
+
+ def merge_libs(*libs)
+ libs.inject([]) do |x, y|
+ y = y.inject([]) {|ary, e| ary.last == e ? ary : ary << e}
+ y.each_with_index do |v, yi|
+ if xi = x.rindex(v)
+ x[(xi+1)..-1] = merge_libs(y[(yi+1)..-1], x[(xi+1)..-1])
+ x[xi, 0] = y[0...yi]
+ break
+ end
+ end and x.concat(y)
+ x
end
end
- def self::postpone
- tmplog = "mkmftmp#{@postpone += 1}.log"
- open do
- log, *save = @log, @logfile, @orgout, @orgerr
- @log, @logfile, @orgout, @orgerr = nil, tmplog, log, log
- begin
- log.print(open {yield @log})
- ensure
- @log.close if @log and not @log.closed?
- File::open(tmplog) {|t| FileUtils.copy_stream(t, log)} if File.exist?(tmplog)
- @log, @logfile, @orgout, @orgerr = log, *save
- @postpone -= 1
- rm_f tmplog
+ # This is a custom logging module. It generates an mkmf.log file when you
+ # run your extconf.rb script. This can be useful for debugging unexpected
+ # failures.
+ #
+ # This module and its associated methods are meant for internal use only.
+ #
+ module Logging
+ @log = nil
+ @logfile = 'mkmf.log'
+ @orgerr = $stderr.dup
+ @orgout = $stdout.dup
+ @postpone = 0
+ @quiet = $extmk
+
+ def self::log_open
+ @log ||= File::open(@logfile, 'wb')
+ @log.sync = true
+ end
+
+ def self::log_opened?
+ @log and not @log.closed?
+ end
+
+ def self::open
+ log_open
+ $stderr.reopen(@log)
+ $stdout.reopen(@log)
+ yield
+ ensure
+ $stderr.reopen(@orgerr)
+ $stdout.reopen(@orgout)
+ end
+
+ def self::message(*s)
+ log_open
+ @log.printf(*s)
+ end
+
+ def self::logfile file
+ @logfile = file
+ log_close
+ end
+
+ def self::log_close
+ if @log and not @log.closed?
+ @log.flush
+ @log.close
+ @log = nil
end
end
+
+ def self::postpone
+ tmplog = "mkmftmp#{@postpone += 1}.log"
+ open do
+ log, *save = @log, @logfile, @orgout, @orgerr
+ @log, @logfile, @orgout, @orgerr = nil, tmplog, log, log
+ begin
+ log.print(open {yield @log})
+ ensure
+ @log.close if @log and not @log.closed?
+ File::open(tmplog) {|t| FileUtils.copy_stream(t, log)} if File.exist?(tmplog)
+ @log, @logfile, @orgout, @orgerr = log, *save
+ @postpone -= 1
+ MakeMakefile.rm_f tmplog
+ end
+ end
+ end
+
+ class << self
+ attr_accessor :quiet
+ end
end
- class << self
- attr_accessor :quiet
+ 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
-end
-def xsystem command, opts = nil
- varpat = /\$\((\w+)\)|\$\{(\w+)\}/
- if varpat =~ command
- vars = Hash.new {|h, k| h[k] = ''; ENV[k]}
- command = command.dup
- nil while command.gsub!(varpat) {vars[$1||$2]}
- end
- Logging::open do
- puts command.quote
- if opts and opts[:werror]
- result = nil
- Logging.postpone do |log|
- result = (system(command) and File.zero?(log.path))
- ""
+ def xsystem command, opts = nil
+ varpat = /\$\((\w+)\)|\$\{(\w+)\}/
+ if varpat =~ command
+ vars = Hash.new {|h, k| h[k] = ENV[k]}
+ command = command.dup
+ nil while command.gsub!(varpat) {vars[$1||$2]}
+ end
+ Logging::open do
+ puts command.quote
+ if opts and opts[:werror]
+ result = nil
+ Logging.postpone do |log|
+ result = (system(libpath_env, command) and File.zero?(log.path))
+ ""
+ end
+ result
+ else
+ system(libpath_env, command)
end
- result
- else
- system(command)
end
end
-end
-def xpopen command, *mode, &block
- Logging::open do
- case mode[0]
- when nil, /^r/
- puts "#{command} |"
- else
- puts "| #{command}"
+ def xpopen command, *mode, &block
+ Logging::open do
+ case mode[0]
+ when nil, /^r/
+ puts "#{command} |"
+ else
+ puts "| #{command}"
+ end
+ IO.popen(libpath_env, command, *mode, &block)
end
- IO.popen(command, *mode, &block)
end
-end
-def log_src(src, heading="checked program was")
- src = src.split(/^/)
- fmt = "%#{src.size.to_s.size}d: %s"
- Logging::message <<"EOM"
+ def log_src(src, heading="checked program was")
+ src = src.split(/^/)
+ fmt = "%#{src.size.to_s.size}d: %s"
+ Logging::message <<"EOM"
#{heading}:
/* begin */
EOM
- src.each_with_index {|line, no| Logging::message fmt, no+1, line}
- Logging::message <<"EOM"
+ src.each_with_index {|line, no| Logging::message fmt, no+1, line}
+ Logging::message <<"EOM"
/* end */
EOM
-end
+ end
-def create_tmpsrc(src)
- src = "#{COMMON_HEADERS}\n#{src}"
- src = yield(src) if block_given?
- src.gsub!(/[ \t]+$/, '')
- src.gsub!(/\A\n+|^\n+$/, '')
- src.sub!(/[^\n]\z/, "\\&\n")
- count = 0
- begin
- open(CONFTEST_C, "wb") do |cfile|
- cfile.print src
- end
- rescue Errno::EACCES
- if (count += 1) < 5
- sleep 0.2
- retry
+ def create_tmpsrc(src)
+ src = "#{COMMON_HEADERS}\n#{src}"
+ src = yield(src) if block_given?
+ src.gsub!(/[ \t]+$/, '')
+ src.gsub!(/\A\n+|^\n+$/, '')
+ src.sub!(/[^\n]\z/, "\\&\n")
+ count = 0
+ begin
+ open(CONFTEST_C, "wb") do |cfile|
+ cfile.print src
+ end
+ rescue Errno::EACCES
+ if (count += 1) < 5
+ sleep 0.2
+ retry
+ end
end
+ src
end
- src
-end
-def have_devel?
- unless defined? $have_devel
- $have_devel = true
- $have_devel = try_link(MAIN_DOES_NOTHING)
+ def have_devel?
+ unless defined? $have_devel
+ $have_devel = true
+ $have_devel = try_link(MAIN_DOES_NOTHING)
+ end
+ $have_devel
end
- $have_devel
-end
-def try_do(src, command, *opts, &b)
- unless have_devel?
- raise <<MSG
+ def try_do(src, command, *opts, &b)
+ unless have_devel?
+ raise <<MSG
The compiler failed to generate an executable file.
You have to install development tools first.
MSG
+ end
+ begin
+ src = create_tmpsrc(src, &b)
+ xsystem(command, *opts)
+ ensure
+ log_src(src)
+ MakeMakefile.rm_rf "#{CONFTEST}.dSYM"
+ end
end
- begin
- src = create_tmpsrc(src, &b)
- xsystem(command, *opts)
- ensure
- log_src(src)
- rm_rf 'conftest.dSYM'
- end
-end
-def link_command(ldflags, opt="", libpath=$DEFLIBPATH|$LIBPATH)
- librubyarg = $extmk ? $LIBRUBYARG_STATIC : "$(LIBRUBYARG)"
- conf = RbConfig::CONFIG.merge('hdrdir' => $hdrdir.quote,
- 'src' => "#{CONFTEST_C}",
- 'arch_hdrdir' => $arch_hdrdir.quote,
- 'top_srcdir' => $top_srcdir.quote,
- 'INCFLAGS' => "#$INCFLAGS",
- 'CPPFLAGS' => "#$CPPFLAGS",
- 'CFLAGS' => "#$CFLAGS",
- 'ARCH_FLAG' => "#$ARCH_FLAG",
- 'LDFLAGS' => "#$LDFLAGS #{ldflags}",
- 'LOCAL_LIBS' => "#$LOCAL_LIBS #$libs",
- 'LIBS' => "#{librubyarg} #{opt} #$LIBS")
- conf['LIBPATH'] = libpathflag(libpath.map {|s| RbConfig::expand(s.dup, conf)})
- RbConfig::expand(TRY_LINK.dup, conf)
-end
-
-def cc_command(opt="")
- conf = RbConfig::CONFIG.merge('hdrdir' => $hdrdir.quote, 'srcdir' => $srcdir.quote,
- 'arch_hdrdir' => $arch_hdrdir.quote,
- 'top_srcdir' => $top_srcdir.quote)
- RbConfig::expand("$(CC) #$INCFLAGS #$CPPFLAGS #$CFLAGS #$ARCH_FLAG #{opt} -c #{CONFTEST_C}",
- conf)
-end
+ def link_command(ldflags, opt="", libpath=$DEFLIBPATH|$LIBPATH)
+ librubyarg = $extmk ? $LIBRUBYARG_STATIC : "$(LIBRUBYARG)"
+ conf = RbConfig::CONFIG.merge('hdrdir' => $hdrdir.quote,
+ 'src' => "#{CONFTEST_C}",
+ 'arch_hdrdir' => $arch_hdrdir.quote,
+ 'top_srcdir' => $top_srcdir.quote,
+ 'INCFLAGS' => "#$INCFLAGS",
+ 'CPPFLAGS' => "#$CPPFLAGS",
+ 'CFLAGS' => "#$CFLAGS",
+ 'ARCH_FLAG' => "#$ARCH_FLAG",
+ 'LDFLAGS' => "#$LDFLAGS #{ldflags}",
+ 'LOCAL_LIBS' => "#$LOCAL_LIBS #$libs",
+ 'LIBS' => "#{librubyarg} #{opt} #$LIBS")
+ conf['LIBPATH'] = libpathflag(libpath.map {|s| RbConfig::expand(s.dup, conf)})
+ RbConfig::expand(TRY_LINK.dup, conf)
+ end
+
+ def cc_command(opt="")
+ conf = RbConfig::CONFIG.merge('hdrdir' => $hdrdir.quote, 'srcdir' => $srcdir.quote,
+ 'arch_hdrdir' => $arch_hdrdir.quote,
+ 'top_srcdir' => $top_srcdir.quote)
+ RbConfig::expand("$(CC) #$INCFLAGS #$CPPFLAGS #$CFLAGS #$ARCH_FLAG #{opt} -c #{CONFTEST_C}",
+ conf)
+ end
+
+ def cpp_command(outfile, opt="")
+ conf = RbConfig::CONFIG.merge('hdrdir' => $hdrdir.quote, 'srcdir' => $srcdir.quote,
+ 'arch_hdrdir' => $arch_hdrdir.quote,
+ 'top_srcdir' => $top_srcdir.quote)
+ if $universal and (arch_flag = conf['ARCH_FLAG']) and !arch_flag.empty?
+ conf['ARCH_FLAG'] = arch_flag.gsub(/(?:\G|\s)-arch\s+\S+/, '')
+ end
+ RbConfig::expand("$(CPP) #$INCFLAGS #$CPPFLAGS #$CFLAGS #{opt} #{CONFTEST_C} #{outfile}",
+ conf)
+ end
-def cpp_command(outfile, opt="")
- conf = RbConfig::CONFIG.merge('hdrdir' => $hdrdir.quote, 'srcdir' => $srcdir.quote,
- 'arch_hdrdir' => $arch_hdrdir.quote,
- 'top_srcdir' => $top_srcdir.quote)
- RbConfig::expand("$(CPP) #$INCFLAGS #$CPPFLAGS #$CFLAGS #{opt} #{CONFTEST_C} #{outfile}",
- conf)
-end
+ def libpathflag(libpath=$DEFLIBPATH|$LIBPATH)
+ libpath.map{|x|
+ case x
+ when "$(topdir)", /\A\./
+ LIBPATHFLAG
+ else
+ LIBPATHFLAG+RPATHFLAG
+ end % x.quote
+ }.join
+ end
-def libpathflag(libpath=$DEFLIBPATH|$LIBPATH)
- libpath.map{|x|
- case x
- when "$(topdir)", /\A\./
- LIBPATHFLAG
+ def with_werror(opt, opts = nil)
+ if opts
+ if opts[:werror] and config_string("WERRORFLAG") {|flag| opt = opt ? "#{opt} #{flag}" : flag}
+ (opts = opts.dup).delete(:werror)
+ end
+ yield(opt, opts)
else
- LIBPATHFLAG+RPATHFLAG
- end % x.quote
- }.join
-end
-
-def with_werror(opt, opts = nil)
- if opts
- if opts[:werror] and config_string("WERRORFLAG") {|flag| opt = opt ? "#{opt} #{flag}" : flag}
- (opts = opts.dup).delete(:werror)
+ yield(opt)
end
- yield(opt, opts)
- else
- yield(opt)
end
-end
-# :nodoc:
-def try_link0(src, opt="", *opts, &b)
- cmd = link_command("", opt)
- if $universal
- require 'tmpdir'
- Dir.mktmpdir("mkmf_", oldtmpdir = ENV["TMPDIR"]) do |tmpdir|
- begin
- ENV["TMPDIR"] = tmpdir
- try_do(src, cmd, *opts, &b)
- ensure
- ENV["TMPDIR"] = oldtmpdir
+ def try_link0(src, opt="", *opts, &b) # :nodoc:
+ cmd = link_command("", opt)
+ if $universal
+ require 'tmpdir'
+ Dir.mktmpdir("mkmf_", oldtmpdir = ENV["TMPDIR"]) do |tmpdir|
+ begin
+ ENV["TMPDIR"] = tmpdir
+ try_do(src, cmd, *opts, &b)
+ ensure
+ ENV["TMPDIR"] = oldtmpdir
+ end
end
- end
- else
- try_do(src, cmd, *opts, &b)
+ else
+ try_do(src, cmd, *opts, &b)
+ end and File.executable?(CONFTEST+$EXEEXT)
+ end
+
+ # Returns whether or not the +src+ can be compiled as a C source and linked
+ # with its depending libraries successfully. +opt+ is passed to the linker
+ # as options. Note that +$CFLAGS+ and +$LDFLAGS+ are also passed to the
+ # linker.
+ #
+ # If a block given, it is called with the source before compilation. You can
+ # modify the source in the block.
+ #
+ # [+src+] a String which contains a C source
+ # [+opt+] a String which contains linker options
+ def try_link(src, opt="", *opts, &b)
+ try_link0(src, opt, *opts, &b)
+ ensure
+ MakeMakefile.rm_f "#{CONFTEST}*", "c0x32*"
+ end
+
+ # Returns whether or not the +src+ can be compiled as a C source. +opt+ is
+ # passed to the C compiler as options. Note that +$CFLAGS+ is also passed to
+ # the compiler.
+ #
+ # If a block given, it is called with the source before compilation. You can
+ # modify the source in the block.
+ #
+ # [+src+] a String which contains a C source
+ # [+opt+] a String which contains compiler options
+ def try_compile(src, opt="", *opts, &b)
+ with_werror(opt, *opts) {|_opt, *_opts| try_do(src, cc_command(_opt), *_opts, &b)} and
+ File.file?("#{CONFTEST}.#{$OBJEXT}")
+ ensure
+ MakeMakefile.rm_f "#{CONFTEST}*"
+ end
+
+ # Returns whether or not the +src+ can be preprocessed with the C
+ # preprocessor. +opt+ is passed to the preprocessor as options. Note that
+ # +$CFLAGS+ is also passed to the preprocessor.
+ #
+ # If a block given, it is called with the source before preprocessing. You
+ # can modify the source in the block.
+ #
+ # [+src+] a String which contains a C source
+ # [+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")
+ ensure
+ MakeMakefile.rm_f "#{CONFTEST}*"
end
-end
-# Returns whether or not the +src+ can be compiled as a C source and
-# linked with its depending libraries successfully.
-# +opt+ is passed to the linker as options. Note that +$CFLAGS+ and +$LDFLAGS+
-# are also passed to the linker.
-#
-# If a block given, it is called with the source before compilation. You can
-# modify the source in the block.
-#
-# [+src+] a String which contains a C source
-# [+opt+] a String which contains linker options
-def try_link(src, opt="", *opts, &b)
- try_link0(src, opt, *opts, &b)
-ensure
- rm_f "conftest*", "c0x32*"
-end
+ alias_method :try_header, (config_string('try_header') || :try_cpp)
-# Returns whether or not the +src+ can be compiled as a C source.
-# +opt+ is passed to the C compiler as options. Note that +$CFLAGS+ is
-# also passed to the compiler.
-#
-# If a block given, it is called with the source before compilation. You can
-# modify the source in the block.
-#
-# [+src+] a String which contains a C source
-# [+opt+] a String which contains compiler options
-def try_compile(src, opt="", *opts, &b)
- with_werror(opt, *opts) {|_opt, *_opts| try_do(src, cc_command(_opt), *_opts, &b)}
-ensure
- rm_f "conftest*"
-end
+ def cpp_include(header)
+ if header
+ header = [header] unless header.kind_of? Array
+ header.map {|h| String === h ? "#include <#{h}>\n" : h}.join
+ else
+ ""
+ end
+ end
-# Returns whether or not the +src+ can be preprocessed with the C preprocessor.
-# +opt+ is passed to the preprocessor as options. Note that +$CFLAGS+ is
-# also passed to the preprocessor.
-#
-# If a block given, it is called with the source before preprocessing. You can
-# modify the source in the block.
-#
-# [+src+] a String which contains a C source
-# [+opt+] a String which contains preprocessor options
-def try_cpp(src, opt="", *opts, &b)
- try_do(src, cpp_command(CPPOUTFILE, opt), *opts, &b)
-ensure
- rm_f "conftest*"
-end
+ def with_cppflags(flags)
+ cppflags = $CPPFLAGS
+ $CPPFLAGS = flags
+ ret = yield
+ ensure
+ $CPPFLAGS = cppflags unless ret
+ end
-class Object
- alias_method :try_header, (config_string('try_header') || :try_cpp)
-end
+ def try_cppflags(flags)
+ with_cppflags(flags) do
+ try_header("int main() {return 0;}")
+ end
+ end
-def cpp_include(header)
- if header
- header = [header] unless header.kind_of? Array
- header.map {|h| String === h ? "#include <#{h}>\n" : h}.join
- else
- ""
+ def with_cflags(flags)
+ cflags = $CFLAGS
+ $CFLAGS = flags
+ ret = yield
+ ensure
+ $CFLAGS = cflags unless ret
end
-end
-def with_cppflags(flags)
- cppflags = $CPPFLAGS
- $CPPFLAGS = flags
- ret = yield
-ensure
- $CPPFLAGS = cppflags unless ret
-end
+ def try_cflags(flags)
+ with_cflags(flags) do
+ try_compile("int main() {return 0;}")
+ end
+ end
-def with_cflags(flags)
- cflags = $CFLAGS
- $CFLAGS = flags
- ret = yield
-ensure
- $CFLAGS = cflags unless ret
-end
+ def with_ldflags(flags)
+ ldflags = $LDFLAGS
+ $LDFLAGS = flags
+ ret = yield
+ ensure
+ $LDFLAGS = ldflags unless ret
+ end
-def with_ldflags(flags)
- ldflags = $LDFLAGS
- $LDFLAGS = flags
- ret = yield
-ensure
- $LDFLAGS = ldflags unless ret
-end
+ def try_ldflags(flags)
+ with_ldflags(flags) do
+ try_link("int main() {return 0;}")
+ end
+ end
-def try_static_assert(expr, headers = nil, opt = "", &b)
- headers = cpp_include(headers)
- try_compile(<<SRC, opt, &b)
+ def try_static_assert(expr, headers = nil, opt = "", &b)
+ headers = cpp_include(headers)
+ try_compile(<<SRC, opt, &b)
#{headers}
/*top*/
int conftest_const[(#{expr}) ? 1 : -1];
SRC
-end
+ end
-def try_constant(const, headers = nil, opt = "", &b)
- includes = cpp_include(headers)
- if CROSS_COMPILING
- if try_static_assert("#{const} > 0", headers, opt)
- # positive constant
- elsif try_static_assert("#{const} < 0", headers, opt)
- neg = true
- const = "-(#{const})"
- elsif try_static_assert("#{const} == 0", headers, opt)
- return 0
- else
- # not a constant
- return nil
- end
- upper = 1
- lower = 0
- until try_static_assert("#{const} <= #{upper}", headers, opt)
- lower = upper
- upper <<= 1
- end
- return nil unless lower
- while upper > lower + 1
- mid = (upper + lower) / 2
- if try_static_assert("#{const} > #{mid}", headers, opt)
- lower = mid
+ def try_constant(const, headers = nil, opt = "", &b)
+ includes = cpp_include(headers)
+ neg = try_static_assert("#{const} < 0", headers, opt)
+ if CROSS_COMPILING
+ if neg
+ const = "-(#{const})"
+ elsif try_static_assert("#{const} > 0", headers, opt)
+ # positive constant
+ elsif try_static_assert("#{const} == 0", headers, opt)
+ return 0
else
- upper = mid
+ # not a constant
+ return nil
end
- end
- upper = -upper if neg
- return upper
- else
- src = %{#{includes}
+ upper = 1
+ lower = 0
+ until try_static_assert("#{const} <= #{upper}", headers, opt)
+ lower = upper
+ upper <<= 1
+ end
+ return nil unless lower
+ while upper > lower + 1
+ mid = (upper + lower) / 2
+ if try_static_assert("#{const} > #{mid}", headers, opt)
+ lower = mid
+ else
+ upper = mid
+ end
+ end
+ upper = -upper if neg
+ return upper
+ else
+ src = %{#{includes}
#include <stdio.h>
/*top*/
-int conftest_const = (int)(#{const});
-int main() {printf("%d\\n", conftest_const); return 0;}
+typedef#{neg ? '' : ' unsigned'}
+#ifdef PRI_LL_PREFIX
+#define PRI_CONFTEST_PREFIX PRI_LL_PREFIX
+LONG_LONG
+#else
+#define PRI_CONFTEST_PREFIX "l"
+long
+#endif
+conftest_type;
+conftest_type conftest_const = (conftest_type)(#{const});
+int main() {printf("%"PRI_CONFTEST_PREFIX"#{neg ? 'd' : 'u'}\\n", conftest_const); return 0;}
}
- if try_link0(src, opt, &b)
- xpopen("./conftest") do |f|
- return Integer(f.gets)
+ begin
+ if try_link0(src, opt, &b)
+ xpopen("./#{CONFTEST}") do |f|
+ return Integer(f.gets)
+ end
+ end
+ ensure
+ MakeMakefile.rm_f "#{CONFTEST}*"
end
end
+ nil
end
- nil
-end
-# You should use +have_func+ rather than +try_func+.
-#
-# [+func+] a String which contains a symbol name
-# [+libs+] a String which contains library names.
-# [+headers+] a String or an Array of strings which contains
-# names of header files.
-def try_func(func, libs, headers = nil, &b)
- headers = cpp_include(headers)
- case func
- when /^&/
- decltype = proc {|x|"const volatile void *#{x}"}
- else
- call = true
- decltype = proc {|x| "void ((*#{x})())"}
- end
- try_link(<<"SRC", libs, &b) or
+ # You should use +have_func+ rather than +try_func+.
+ #
+ # [+func+] a String which contains a symbol name
+ # [+libs+] a String which contains library names.
+ # [+headers+] a String or an Array of strings which contains names of header
+ # files.
+ def try_func(func, libs, headers = nil, opt = "", &b)
+ headers = cpp_include(headers)
+ case func
+ when /^&/
+ decltype = proc {|x|"const volatile void *#{x}"}
+ when /\)$/
+ call = func
+ else
+ call = "#{func}()"
+ decltype = proc {|x| "void ((*#{x})())"}
+ end
+ if opt and !opt.empty?
+ [[:to_str], [:join, " "], [:to_s]].each do |meth, *args|
+ if opt.respond_to?(meth)
+ break opt = opt.send(meth, *args)
+ end
+ end
+ opt = "#{opt} #{libs}"
+ else
+ opt = libs
+ end
+ decltype && try_link(<<"SRC", opt, &b) or
#{headers}
/*top*/
-int t() { #{decltype["volatile p"]}; p = (#{decltype[]})#{func}; return 0; }
-#{MAIN_DOES_NOTHING "t"}
+extern int t(void);
+#{MAIN_DOES_NOTHING 't'}
+int t(void) { #{decltype["volatile p"]}; p = (#{decltype[]})#{func}; return 0; }
SRC
- call && try_link(<<"SRC", libs, &b)
+ call && try_link(<<"SRC", opt, &b)
#{headers}
/*top*/
-int t() { #{func}(); return 0; }
-#{MAIN_DOES_NOTHING "t"}
+extern int t(void);
+#{MAIN_DOES_NOTHING 't'}
+int t(void) { #{call}; return 0; }
SRC
-end
+ end
-# You should use +have_var+ rather than +try_var+.
-def try_var(var, headers = nil, &b)
- headers = cpp_include(headers)
- try_compile(<<"SRC", &b)
+ # You should use +have_var+ rather than +try_var+.
+ def try_var(var, headers = nil, opt = "", &b)
+ headers = cpp_include(headers)
+ try_compile(<<"SRC", opt, &b)
#{headers}
/*top*/
-int t() { const volatile void *volatile p; p = &(&#{var})[0]; return 0; }
-#{MAIN_DOES_NOTHING "t"}
+extern int t(void);
+#{MAIN_DOES_NOTHING 't'}
+int t(void) { const volatile void *volatile p; p = &(&#{var})[0]; return 0; }
SRC
-end
+ end
-# Returns whether or not the +src+ can be preprocessed with the C preprocessor and
-# matches with +pat+.
-#
-# If a block given, it is called with the source before compilation. You can
-# modify the source in the block.
-#
-# [+pat+] a Regexp or a String
-# [+src+] a String which contains a C source
-# [+opt+] a String which contains preprocessor options
-#
-# Note:
-# When pat is a Regexp the matching will be checked in process,
-# otherwise egrep(1) will be invoked to check it.
-def egrep_cpp(pat, src, opt = "", &b)
- src = create_tmpsrc(src, &b)
- xpopen(cpp_command('', opt)) do |f|
- if Regexp === pat
- puts(" ruby -ne 'print if #{pat.inspect}'")
- f.grep(pat) {|l|
- puts "#{f.lineno}: #{l}"
- return true
- }
- false
- else
- puts(" egrep '#{pat}'")
- begin
- stdin = $stdin.dup
- $stdin.reopen(f)
- system("egrep", pat)
- ensure
- $stdin.reopen(stdin)
+ # Returns whether or not the +src+ can be preprocessed with the C
+ # preprocessor and matches with +pat+.
+ #
+ # If a block given, it is called with the source before compilation. You can
+ # modify the source in the block.
+ #
+ # [+pat+] a Regexp or a String
+ # [+src+] a String which contains a C source
+ # [+opt+] a String which contains preprocessor options
+ #
+ # NOTE: When pat is a Regexp the matching will be checked in process,
+ # otherwise egrep(1) will be invoked to check it.
+ def egrep_cpp(pat, src, opt = "", &b)
+ src = create_tmpsrc(src, &b)
+ xpopen(cpp_command('', opt)) do |f|
+ if Regexp === pat
+ puts(" ruby -ne 'print if #{pat.inspect}'")
+ f.grep(pat) {|l|
+ puts "#{f.lineno}: #{l}"
+ return true
+ }
+ false
+ else
+ puts(" egrep '#{pat}'")
+ begin
+ stdin = $stdin.dup
+ $stdin.reopen(f)
+ system("egrep", pat)
+ ensure
+ $stdin.reopen(stdin)
+ end
end
end
+ ensure
+ MakeMakefile.rm_f "#{CONFTEST}*"
+ log_src(src)
end
-ensure
- rm_f "conftest*"
- log_src(src)
-end
-# This is used internally by the have_macro? method.
-def macro_defined?(macro, src, opt = "", &b)
- src = src.sub(/[^\n]\z/, "\\&\n")
- try_compile(src + <<"SRC", opt, &b)
+ # This is used internally by the have_macro? method.
+ def macro_defined?(macro, src, opt = "", &b)
+ src = src.sub(/[^\n]\z/, "\\&\n")
+ try_compile(src + <<"SRC", opt, &b)
/*top*/
#ifndef #{macro}
# error
->>>>>> #{macro} undefined <<<<<<
+|:/ === #{macro} undefined === /:|
#endif
SRC
-end
-
-# Returns whether or not
-# * the +src+ can be compiled as a C source,
-# * the result object can be linked with its depending libraries successfully,
-# * the linked file can be invoked as an executable
-# * and the executable exits successfully
-# +opt+ is passed to the linker as options. Note that +$CFLAGS+ and +$LDFLAGS+
-# are also passed to the linker.
-#
-# If a block given, it is called with the source before compilation. You can
-# modify the source in the block.
-#
-# [+src+] a String which contains a C source
-# [+opt+] a String which contains linker options
-#
-# @return true when the executable exits successfully, false when it fails, or
-# nil when preprocessing, compilation or link fails.
-def try_run(src, opt = "", &b)
- if try_link0(src, opt, &b)
- xsystem("./conftest")
- else
- nil
end
-ensure
- rm_f "conftest*"
-end
-def install_files(mfile, ifiles, map = nil, srcprefix = nil)
- ifiles or return
- ifiles.empty? and return
- srcprefix ||= "$(srcdir)/#{srcprefix}".chomp('/')
- RbConfig::expand(srcdir = srcprefix.dup)
- dirs = []
- path = Hash.new {|h, i| h[i] = dirs.push([i])[-1]}
- ifiles.each do |files, dir, prefix|
- dir = map_dir(dir, map)
- prefix &&= %r|\A#{Regexp.quote(prefix)}/?|
- if /\A\.\// =~ files
- # install files which are in current working directory.
- files = files[2..-1]
- len = nil
+ # Returns whether or not:
+ # * the +src+ can be compiled as a C source,
+ # * the result object can be linked with its depending libraries
+ # successfully,
+ # * the linked file can be invoked as an executable
+ # * and the executable exits successfully
+ #
+ # +opt+ is passed to the linker as options. Note that +$CFLAGS+ and
+ # +$LDFLAGS+ are also passed to the linker.
+ #
+ # If a block given, it is called with the source before compilation. You can
+ # modify the source in the block.
+ #
+ # [+src+] a String which contains a C source
+ # [+opt+] a String which contains linker options
+ #
+ # 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}")
else
- # install files which are under the $(srcdir).
- files = File.join(srcdir, files)
- len = srcdir.size
- end
- f = nil
- Dir.glob(files) do |fx|
- f = fx
- f[0..len] = "" if len
- case File.basename(f)
- when *$NONINSTALLFILES
- next
- end
- d = File.dirname(f)
- d.sub!(prefix, "") if prefix
- d = (d.empty? || d == ".") ? dir : File.join(dir, d)
- f = File.join(srcprefix, f) if len
- path[d] << f
+ nil
end
- unless len or f
- d = File.dirname(files)
- d.sub!(prefix, "") if prefix
- d = (d.empty? || d == ".") ? dir : File.join(dir, d)
- path[d] << files
+ ensure
+ MakeMakefile.rm_f "#{CONFTEST}*"
+ end
+
+ def install_files(mfile, ifiles, map = nil, srcprefix = nil)
+ ifiles or return
+ ifiles.empty? and return
+ srcprefix ||= "$(srcdir)/#{srcprefix}".chomp('/')
+ RbConfig::expand(srcdir = srcprefix.dup)
+ dirs = []
+ path = Hash.new {|h, i| h[i] = dirs.push([i])[-1]}
+ ifiles.each do |files, dir, prefix|
+ dir = map_dir(dir, map)
+ prefix &&= %r|\A#{Regexp.quote(prefix)}/?|
+ if /\A\.\// =~ files
+ # install files which are in current working directory.
+ files = files[2..-1]
+ len = nil
+ else
+ # install files which are under the $(srcdir).
+ files = File.join(srcdir, files)
+ len = srcdir.size
+ end
+ f = nil
+ Dir.glob(files) do |fx|
+ f = fx
+ f[0..len] = "" if len
+ case File.basename(f)
+ when *$NONINSTALLFILES
+ next
+ end
+ d = File.dirname(f)
+ d.sub!(prefix, "") if prefix
+ d = (d.empty? || d == ".") ? dir : File.join(dir, d)
+ f = File.join(srcprefix, f) if len
+ path[d] << f
+ end
+ unless len or f
+ d = File.dirname(files)
+ d.sub!(prefix, "") if prefix
+ d = (d.empty? || d == ".") ? dir : File.join(dir, d)
+ path[d] << files
+ end
end
+ dirs
end
- dirs
-end
-def install_rb(mfile, dest, srcdir = nil)
- install_files(mfile, [["lib/**/*.rb", dest, "lib"]], nil, srcdir)
-end
+ def install_rb(mfile, dest, srcdir = nil)
+ install_files(mfile, [["lib/**/*.rb", dest, "lib"]], nil, srcdir)
+ end
-def append_library(libs, lib) # :no-doc:
- format(LIBARG, lib) + " " + libs
-end
+ def append_library(libs, lib) # :no-doc:
+ format(LIBARG, lib) + " " + libs
+ end
-def message(*s)
- unless Logging.quiet and not $VERBOSE
- printf(*s)
- $stdout.flush
+ def message(*s)
+ unless Logging.quiet and not $VERBOSE
+ printf(*s)
+ $stdout.flush
+ end
end
-end
-# This emits a string to stdout that allows users to see the results of the
-# various have* and find* methods as they are tested.
-#
-# Internal use only.
-#
-def checking_for(m, fmt = nil)
- f = caller[0][/in `([^<].*)'$/, 1] and f << ": " #` for vim #'
- m = "checking #{/\Acheck/ =~ f ? '' : 'for '}#{m}... "
- message "%s", m
- a = r = nil
- Logging::postpone do
- r = yield
- a = (fmt ? fmt % r : r ? "yes" : "no") << "\n"
- "#{f}#{m}-------------------- #{a}\n"
- end
- message(a)
- Logging::message "--------------------\n\n"
- r
-end
+ # This emits a string to stdout that allows users to see the results of the
+ # various have* and find* methods as they are tested.
+ #
+ # Internal use only.
+ #
+ def checking_for(m, fmt = nil)
+ f = caller[0][/in `([^<].*)'$/, 1] and f << ": " #` for vim #'
+ m = "checking #{/\Acheck/ =~ f ? '' : 'for '}#{m}... "
+ message "%s", m
+ a = r = nil
+ Logging::postpone do
+ r = yield
+ a = (fmt ? "#{fmt % r}" : r ? "yes" : "no") << "\n"
+ "#{f}#{m}-------------------- #{a}\n"
+ end
+ message(a)
+ Logging::message "--------------------\n\n"
+ r
+ end
-def checking_message(target, place = nil, opt = nil)
- [["in", place], ["with", opt]].inject("#{target}") do |msg, (pre, noun)|
- if noun
- [[:to_str], [:join, ","], [:to_s]].each do |meth, *args|
- if noun.respond_to?(meth)
- break noun = noun.send(meth, *args)
+ def checking_message(target, place = nil, opt = nil)
+ [["in", place], ["with", opt]].inject("#{target}") do |msg, (pre, noun)|
+ if noun
+ [[:to_str], [:join, ","], [:to_s]].each do |meth, *args|
+ if noun.respond_to?(meth)
+ break noun = noun.send(meth, *args)
+ end
end
+ msg << " #{pre} #{noun}" unless noun.empty?
end
- msg << " #{pre} #{noun}" unless noun.empty?
+ msg
end
- msg
end
-end
-# :startdoc:
+ # :startdoc:
-# Returns whether or not +macro+ is defined either in the common header
-# files or within any +headers+ you provide.
-#
-# Any options you pass to +opt+ are passed along to the compiler.
-#
-def have_macro(macro, headers = nil, opt = "", &b)
- checking_for checking_message(macro, headers, opt) do
- macro_defined?(macro, cpp_include(headers), opt, &b)
+ # Returns whether or not +macro+ is defined either in the common header
+ # files or within any +headers+ you provide.
+ #
+ # Any options you pass to +opt+ are passed along to the compiler.
+ #
+ def have_macro(macro, headers = nil, opt = "", &b)
+ checking_for checking_message(macro, headers, opt) do
+ macro_defined?(macro, cpp_include(headers), opt, &b)
+ end
end
-end
-# Returns whether or not the given entry point +func+ can be found within
-# +lib+. If +func+ is nil, the 'main()' entry point is used by default.
-# If found, it adds the library to list of libraries to be used when linking
-# your extension.
-#
-# If +headers+ are provided, it will include those header files as the
-# header files it looks in when searching for +func+.
-#
-# The real name of the library to be linked can be altered by
-# '--with-FOOlib' configuration option.
-#
-def have_library(lib, func = nil, headers = nil, &b)
- func = "main" if !func or func.empty?
- lib = with_config(lib+'lib', lib)
- checking_for checking_message("#{func}()", LIBARG%lib) do
- if COMMON_LIBS.include?(lib)
- true
- else
- libs = append_library($libs, lib)
- if try_func(func, libs, headers, &b)
- $libs = libs
+ # Returns whether or not the given entry point +func+ can be found within
+ # +lib+. If +func+ is +nil+, the <code>main()</code> entry point is used by
+ # default. If found, it adds the library to list of libraries to be used
+ # when linking your extension.
+ #
+ # If +headers+ are provided, it will include those header files as the
+ # header files it looks in when searching for +func+.
+ #
+ # The real name of the library to be linked can be altered by
+ # <code>--with-FOOlib</code> configuration option.
+ #
+ def have_library(lib, func = nil, headers = nil, opt = "", &b)
+ func = "main" if !func or func.empty?
+ lib = with_config(lib+'lib', lib)
+ checking_for checking_message(func.funcall_style, LIBARG%lib, opt) do
+ if COMMON_LIBS.include?(lib)
true
else
- false
+ libs = append_library($libs, lib)
+ if try_func(func, libs, headers, opt, &b)
+ $libs = libs
+ true
+ else
+ false
+ end
end
end
end
-end
-# Returns whether or not the entry point +func+ can be found within the library
-# +lib+ in one of the +paths+ specified, where +paths+ is an array of strings.
-# If +func+ is nil , then the main() function is used as the entry point.
-#
-# If +lib+ is found, then the path it was found on is added to the list of
-# library paths searched and linked against.
-#
-def find_library(lib, func, *paths, &b)
- func = "main" if !func or func.empty?
- lib = with_config(lib+'lib', lib)
- paths = paths.collect {|path| path.split(File::PATH_SEPARATOR)}.flatten
- checking_for "#{func}() in #{LIBARG%lib}" do
- libpath = $LIBPATH
- libs = append_library($libs, lib)
- begin
- until r = try_func(func, libs, &b) or paths.empty?
- $LIBPATH = libpath | [paths.shift]
- end
- if r
- $libs = libs
- libpath = nil
+ # Returns whether or not the entry point +func+ can be found within the
+ # library +lib+ in one of the +paths+ specified, where +paths+ is an array
+ # of strings. If +func+ is +nil+ , then the <code>main()</code> function is
+ # used as the entry point.
+ #
+ # If +lib+ is found, then the path it was found on is added to the list of
+ # library paths searched and linked against.
+ #
+ def find_library(lib, func, *paths, &b)
+ func = "main" if !func or func.empty?
+ lib = with_config(lib+'lib', lib)
+ paths = paths.collect {|path| path.split(File::PATH_SEPARATOR)}.flatten
+ checking_for checking_message(func.funcall_style, LIBARG%lib) do
+ libpath = $LIBPATH
+ libs = append_library($libs, lib)
+ begin
+ until r = try_func(func, libs, &b) or paths.empty?
+ $LIBPATH = libpath | [paths.shift]
+ end
+ if r
+ $libs = libs
+ libpath = nil
+ end
+ ensure
+ $LIBPATH = libpath if libpath
end
- ensure
- $LIBPATH = libpath if libpath
+ r
end
- r
end
-end
-# Returns whether or not the function +func+ can be found in the common
-# header files, or within any +headers+ that you provide. If found, a
-# macro is passed as a preprocessor constant to the compiler using the
-# function name, in uppercase, prepended with 'HAVE_'.
-#
-# For example, if have_func('foo') returned true, then the HAVE_FOO
-# preprocessor macro would be passed to the compiler.
-#
-def have_func(func, headers = nil, &b)
- checking_for checking_message("#{func}()", headers) do
- if try_func(func, $libs, headers, &b)
- $defs.push(format("-DHAVE_%s", func.tr_cpp))
- true
- else
- false
+ # Returns whether or not the function +func+ can be found in the common
+ # header files, or within any +headers+ that you provide. If found, a macro
+ # is passed as a preprocessor constant to the compiler using the function
+ # name, in uppercase, prepended with +HAVE_+.
+ #
+ # To check functions in an additional library, you need to check that
+ # library first using <code>have_library()</code>. The +func+ shall be
+ # either mere function name or function name with arguments.
+ #
+ # For example, if <code>have_func('foo')</code> returned +true+, then the
+ # +HAVE_FOO+ preprocessor macro would be passed to the compiler.
+ #
+ def have_func(func, headers = nil, opt = "", &b)
+ checking_for checking_message(func.funcall_style, headers, opt) do
+ if try_func(func, $libs, headers, opt, &b)
+ $defs << "-DHAVE_#{func.sans_arguments.tr_cpp}"
+ true
+ else
+ false
+ end
end
end
-end
-# Returns whether or not the variable +var+ can be found in the common
-# header files, or within any +headers+ that you provide. If found, a
-# macro is passed as a preprocessor constant to the compiler using the
-# variable name, in uppercase, prepended with 'HAVE_'.
-#
-# For example, if have_var('foo') returned true, then the HAVE_FOO
-# preprocessor macro would be passed to the compiler.
-#
-def have_var(var, headers = nil, &b)
- checking_for checking_message(var, headers) do
- if try_var(var, headers, &b)
- $defs.push(format("-DHAVE_%s", var.tr_cpp))
- true
- else
- false
+ # Returns whether or not the variable +var+ can be found in the common
+ # header files, or within any +headers+ that you provide. If found, a macro
+ # is passed as a preprocessor constant to the compiler using the variable
+ # name, in uppercase, prepended with +HAVE_+.
+ #
+ # To check variables in an additional library, you need to check that
+ # library first using <code>have_library()</code>.
+ #
+ # For example, if <code>have_var('foo')</code> returned true, then the
+ # +HAVE_FOO+ preprocessor macro would be passed to the compiler.
+ #
+ def have_var(var, headers = nil, opt = "", &b)
+ checking_for checking_message(var, headers, opt) do
+ if try_var(var, headers, opt, &b)
+ $defs.push(format("-DHAVE_%s", var.tr_cpp))
+ true
+ else
+ false
+ end
end
end
-end
-# Returns whether or not the given +header+ file can be found on your system.
-# If found, a macro is passed as a preprocessor constant to the compiler using
-# the header file name, in uppercase, prepended with 'HAVE_'.
-#
-# For example, if have_header('foo.h') returned true, then the HAVE_FOO_H
-# preprocessor macro would be passed to the compiler.
-#
-def have_header(header, preheaders = nil, &b)
- checking_for header do
- if try_header(cpp_include(preheaders)+cpp_include(header), &b)
- $defs.push(format("-DHAVE_%s", header.tr_cpp))
- true
- else
- false
+ # Returns whether or not the given +header+ file can be found on your system.
+ # If found, a macro is passed as a preprocessor constant to the compiler
+ # using the header file name, in uppercase, prepended with +HAVE_+.
+ #
+ # For example, if <code>have_header('foo.h')</code> returned true, then the
+ # +HAVE_FOO_H+ preprocessor macro would be passed to the compiler.
+ #
+ def have_header(header, preheaders = nil, opt = "", &b)
+ checking_for header do
+ if try_header(cpp_include(preheaders)+cpp_include(header), opt, &b)
+ $defs.push(format("-DHAVE_%s", header.tr_cpp))
+ true
+ else
+ false
+ end
end
end
-end
-# Returns whether or not the given +framework+ can be found on your system.
-# If found, a macro is passed as a preprocessor constant to the compiler using
-# the framework name, in uppercase, prepended with 'HAVE_FRAMEWORK_'.
-#
-# For example, if have_framework('Ruby') returned true, then the HAVE_FRAMEWORK_RUBY
-# preprocessor macro would be passed to the compiler.
-#
-def have_framework(fw, &b)
- checking_for fw do
- src = cpp_include("#{fw}/#{fw}.h") << "\n" "int main(void){return 0;}"
- if try_link(src, opt = "-framework #{fw}", &b)
- $defs.push(format("-DHAVE_FRAMEWORK_%s", fw.tr_cpp))
- $LDFLAGS << " " << opt
- true
+ # Returns whether or not the given +framework+ can be found on your system.
+ # If found, a macro is passed as a preprocessor constant to the compiler
+ # using the framework name, in uppercase, prepended with +HAVE_FRAMEWORK_+.
+ #
+ # For example, if <code>have_framework('Ruby')</code> returned true, then
+ # the +HAVE_FRAMEWORK_RUBY+ preprocessor macro would be passed to the
+ # compiler.
+ #
+ # If +fw+ is a pair of the framework name and its header file name
+ # that header file is checked, instead of the normally used header
+ # file which is named same as the framework.
+ def have_framework(fw, &b)
+ if Array === fw
+ fw, header = *fw
else
- false
+ header = "#{fw}.h"
+ end
+ 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)
+ $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
+ $LIBS << opt
+ true
+ else
+ false
+ end
end
end
-end
-# Instructs mkmf to search for the given +header+ in any of the +paths+
-# provided, and returns whether or not it was found in those paths.
-#
-# If the header is found then the path it was found on is added to the list
-# of included directories that are sent to the compiler (via the -I switch).
-#
-def find_header(header, *paths)
- message = checking_message(header, paths)
- header = cpp_include(header)
- checking_for message do
- if try_header(header)
- true
- else
- found = false
- paths.each do |dir|
- opt = "-I#{dir}".quote
- if try_header(header, opt)
- $INCFLAGS << " " << opt
- found = true
- break
+ # Instructs mkmf to search for the given +header+ in any of the +paths+
+ # provided, and returns whether or not it was found in those paths.
+ #
+ # If the header is found then the path it was found on is added to the list
+ # of included directories that are sent to the compiler (via the
+ # <code>-I</code> switch).
+ #
+ def find_header(header, *paths)
+ message = checking_message(header, paths)
+ header = cpp_include(header)
+ checking_for message do
+ if try_header(header)
+ true
+ else
+ found = false
+ paths.each do |dir|
+ opt = "-I#{dir}".quote
+ if try_header(header, opt)
+ $INCFLAGS << " " << opt
+ found = true
+ break
+ end
end
+ found
end
- found
end
end
-end
-# Returns whether or not the struct of type +type+ contains +member+. If
-# it does not, or the struct type can't be found, then false is returned. You
-# may optionally specify additional +headers+ in which to look for the struct
-# (in addition to the common header files).
-#
-# If found, a macro is passed as a preprocessor constant to the compiler using
-# the type name and the member name, in uppercase, prepended with 'HAVE_'.
-#
-# For example, if have_struct_member('struct foo', 'bar') returned true, then the
-# HAVE_STRUCT_FOO_BAR preprocessor macro would be passed to the compiler.
-#
-# HAVE_ST_BAR is also defined for backward compatibility.
-#
-def have_struct_member(type, member, headers = nil, &b)
- checking_for checking_message("#{type}.#{member}", headers) do
- if try_compile(<<"SRC", &b)
+ # Returns whether or not the struct of type +type+ contains +member+. If
+ # it does not, or the struct type can't be found, then false is returned.
+ # You may optionally specify additional +headers+ in which to look for the
+ # struct (in addition to the common header files).
+ #
+ # If found, a macro is passed as a preprocessor constant to the compiler
+ # using the type name and the member name, in uppercase, prepended with
+ # +HAVE_+.
+ #
+ # For example, if <code>have_struct_member('struct foo', 'bar')</code>
+ # returned true, then the +HAVE_STRUCT_FOO_BAR+ preprocessor macro would be
+ # passed to the compiler.
+ #
+ # +HAVE_ST_BAR+ is also defined for backward compatibility.
+ #
+ def have_struct_member(type, member, headers = nil, opt = "", &b)
+ checking_for checking_message("#{type}.#{member}", headers) do
+ if try_compile(<<"SRC", opt, &b)
#{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
- true
- else
- false
+ $defs.push(format("-DHAVE_%s_%s", type.tr_cpp, member.tr_cpp))
+ $defs.push(format("-DHAVE_ST_%s", member.tr_cpp)) # backward compatibility
+ true
+ else
+ false
+ end
end
end
-end
-# Returns whether or not the static type +type+ is defined.
-#
-# See also +have_type+
-#
-def try_type(type, headers = nil, opt = "", &b)
- if try_compile(<<"SRC", opt, &b)
+ # Returns whether or not the static type +type+ is defined.
+ #
+ # See also +have_type+
+ #
+ def try_type(type, headers = nil, opt = "", &b)
+ if try_compile(<<"SRC", opt, &b)
#{cpp_include(headers)}
/*top*/
typedef #{type} conftest_type;
int conftestval[sizeof(conftest_type)?1:-1];
SRC
- $defs.push(format("-DHAVE_TYPE_%s", type.tr_cpp))
- true
- else
- false
+ $defs.push(format("-DHAVE_TYPE_%s", type.tr_cpp))
+ true
+ else
+ false
+ end
end
-end
-# Returns whether or not the static type +type+ is defined. You may
-# optionally pass additional +headers+ to check against in addition to the
-# common header files.
-#
-# You may also pass additional flags to +opt+ which are then passed along to
-# the compiler.
-#
-# If found, a macro is passed as a preprocessor constant to the compiler using
-# the type name, in uppercase, prepended with 'HAVE_TYPE_'.
-#
-# For example, if have_type('foo') returned true, then the HAVE_TYPE_FOO
-# preprocessor macro would be passed to the compiler.
-#
-def have_type(type, headers = nil, opt = "", &b)
- checking_for checking_message(type, headers, opt) do
- try_type(type, headers, opt, &b)
+ # Returns whether or not the static type +type+ is defined. You may
+ # optionally pass additional +headers+ to check against in addition to the
+ # common header files.
+ #
+ # You may also pass additional flags to +opt+ which are then passed along to
+ # the compiler.
+ #
+ # If found, a macro is passed as a preprocessor constant to the compiler
+ # using the type name, in uppercase, prepended with +HAVE_TYPE_+.
+ #
+ # For example, if <code>have_type('foo')</code> returned true, then the
+ # +HAVE_TYPE_FOO+ preprocessor macro would be passed to the compiler.
+ #
+ def have_type(type, headers = nil, opt = "", &b)
+ checking_for checking_message(type, headers, opt) do
+ try_type(type, headers, opt, &b)
+ end
end
-end
-# Returns where the static type +type+ is defined.
-#
-# You may also pass additional flags to +opt+ which are then passed along to
-# the compiler.
-#
-# See also +have_type+.
-#
-def find_type(type, opt, *headers, &b)
- opt ||= ""
- fmt = "not found"
- def fmt.%(x)
- x ? x.respond_to?(:join) ? x.join(",") : x : self
- end
- checking_for checking_message(type, nil, opt), fmt do
- headers.find do |h|
- try_type(type, h, opt, &b)
+ # Returns where the static type +type+ is defined.
+ #
+ # You may also pass additional flags to +opt+ which are then passed along to
+ # the compiler.
+ #
+ # See also +have_type+.
+ #
+ def find_type(type, opt, *headers, &b)
+ opt ||= ""
+ fmt = "not found"
+ def fmt.%(x)
+ x ? x.respond_to?(:join) ? x.join(",") : x : self
+ end
+ checking_for checking_message(type, nil, opt), fmt do
+ headers.find do |h|
+ try_type(type, h, opt, &b)
+ end
end
end
-end
-# Returns whether or not the Constant +const+ is defined.
-#
-# See also +have_const+
-#
-def try_const(const, headers = nil, opt = "", &b)
- const, type = *const
- if try_compile(<<"SRC", opt, &b)
+ # Returns whether or not the constant +const+ is defined.
+ #
+ # See also +have_const+
+ #
+ def try_const(const, headers = nil, opt = "", &b)
+ const, type = *const
+ if try_compile(<<"SRC", opt, &b)
#{cpp_include(headers)}
/*top*/
typedef #{type || 'int'} conftest_type;
conftest_type conftestval = #{type ? '' : '(int)'}#{const};
SRC
- $defs.push(format("-DHAVE_CONST_%s", const.tr_cpp))
- true
- else
- false
+ $defs.push(format("-DHAVE_CONST_%s", const.tr_cpp))
+ true
+ else
+ false
+ end
end
-end
-# Returns whether or not the constant +const+ is defined. You may
-# optionally pass the +type+ of +const+ as <code>[const, type]</code>,
-# like as:
-#
-# have_const(%w[PTHREAD_MUTEX_INITIALIZER pthread_mutex_t], "pthread.h")
-#
-# You may also pass additional +headers+ to check against in addition
-# to the common header files, and additional flags to +opt+ which are
-# then passed along to the compiler.
-#
-# If found, a macro is passed as a preprocessor constant to the compiler using
-# the type name, in uppercase, prepended with 'HAVE_CONST_'.
-#
-# For example, if have_const('foo') returned true, then the HAVE_CONST_FOO
-# preprocessor macro would be passed to the compiler.
-#
-def have_const(const, headers = nil, opt = "", &b)
- checking_for checking_message([*const].compact.join(' '), headers, opt) do
- try_const(const, headers, opt, &b)
+ # Returns whether or not the constant +const+ is defined. You may
+ # optionally pass the +type+ of +const+ as <code>[const, type]</code>,
+ # such as:
+ #
+ # have_const(%w[PTHREAD_MUTEX_INITIALIZER pthread_mutex_t], "pthread.h")
+ #
+ # You may also pass additional +headers+ to check against in addition to the
+ # common header files, and additional flags to +opt+ which are then passed
+ # along to the compiler.
+ #
+ # If found, a macro is passed as a preprocessor constant to the compiler
+ # using the type name, in uppercase, prepended with +HAVE_CONST_+.
+ #
+ # For example, if <code>have_const('foo')</code> returned true, then the
+ # +HAVE_CONST_FOO+ preprocessor macro would be passed to the compiler.
+ #
+ def have_const(const, headers = nil, opt = "", &b)
+ checking_for checking_message([*const].compact.join(' '), headers, opt) do
+ try_const(const, headers, opt, &b)
+ end
end
-end
-
-STRING_OR_FAILED_FORMAT = "%s"
-# :stopdoc:
-def STRING_OR_FAILED_FORMAT.%(x)
- x ? super : "failed"
-end
-def typedef_expr(type, headers)
- typename, member = type.split('.', 2)
- prelude = cpp_include(headers).split(/$/)
- prelude << "typedef #{typename} rbcv_typedef_;\n"
- return "rbcv_typedef_", member, prelude
-end
-
-def try_signedness(type, member, headers = nil, opts = nil, &b)
- raise ArgumentError, "don't know how to tell signedness of members" if member
- if try_static_assert("(#{type})-1 < 0", headers, opts)
- return -1
- elsif try_static_assert("(#{type})-1 > 0", headers, opts)
- return +1
+ # :stopdoc:
+ STRING_OR_FAILED_FORMAT = "%s"
+ def STRING_OR_FAILED_FORMAT.%(x) # :nodoc:
+ x ? super : "failed"
end
-end
-# :startdoc:
+ def typedef_expr(type, headers)
+ typename, member = type.split('.', 2)
+ prelude = cpp_include(headers).split(/$/)
+ prelude << "typedef #{typename} rbcv_typedef_;\n"
+ return "rbcv_typedef_", member, prelude
+ end
-# Returns the size of the given +type+. You may optionally specify additional
-# +headers+ to search in for the +type+.
-#
-# If found, a macro is passed as a preprocessor constant to the compiler using
-# the type name, in uppercase, prepended with 'SIZEOF_', followed by the type
-# name, followed by '=X' where 'X' is the actual size.
-#
-# For example, if check_sizeof('mystruct') returned 12, then the
-# SIZEOF_MYSTRUCT=12 preprocessor macro would be passed to the compiler.
-#
-def check_sizeof(type, headers = nil, opts = "", &b)
- typedef, member, prelude = typedef_expr(type, headers)
- prelude << "static #{typedef} *rbcv_ptr_;\n"
- prelude = [prelude]
- expr = "sizeof((*rbcv_ptr_)#{"." << member if member})"
- fmt = STRING_OR_FAILED_FORMAT
- checking_for checking_message("size of #{type}", headers), fmt do
- if size = try_constant(expr, prelude, opts, &b)
- $defs.push(format("-DSIZEOF_%s=%s", type.tr_cpp, size))
- size
+ def try_signedness(type, member, headers = nil, opts = nil)
+ raise ArgumentError, "don't know how to tell signedness of members" if member
+ if try_static_assert("(#{type})-1 < 0", headers, opts)
+ return -1
+ elsif try_static_assert("(#{type})-1 > 0", headers, opts)
+ return +1
end
end
-end
-# Returns the signedness of the given +type+. You may optionally
-# specify additional +headers+ to search in for the +type+.
-#
-# If the +type+ is found and is a numeric type, a macro is passed as a
-# preprocessor constant to the compiler using the +type+ name, in
-# uppercase, prepended with 'SIGNEDNESS_OF_', followed by the +type+
-# name, followed by '=X' where 'X' is positive integer if the +type+ is
-# unsigned, or negative integer if the +type+ is signed.
-#
-# For example, if size_t is defined as unsigned, then
-# check_signedness('size_t') would returned +1 and the
-# SIGNEDNESS_OF_SIZE_T=+1 preprocessor macro would be passed to the
-# compiler, and SIGNEDNESS_OF_INT=-1 if check_signedness('int') is
-# done.
-#
-def check_signedness(type, headers = nil, opts = nil, &b)
- typedef, member, prelude = typedef_expr(type, headers)
- signed = nil
- checking_for("signedness of #{type}", STRING_OR_FAILED_FORMAT) do
- signed = try_signedness(typedef, member, [prelude], opts, &b) or next nil
- $defs.push("-DSIGNEDNESS_OF_%s=%+d" % [type.tr_cpp, signed])
- signed < 0 ? "signed" : "unsigned"
- end
- signed
-end
+ # :startdoc:
+
+ # Returns the size of the given +type+. You may optionally specify
+ # additional +headers+ to search in for the +type+.
+ #
+ # If found, a macro is passed as a preprocessor constant to the compiler
+ # using the type name, in uppercase, prepended with +SIZEOF_+, followed by
+ # the type name, followed by <code>=X</code> where "X" is the actual size.
+ #
+ # For example, if <code>check_sizeof('mystruct')</code> returned 12, then
+ # the <code>SIZEOF_MYSTRUCT=12</code> preprocessor macro would be passed to
+ # the compiler.
+ #
+ def check_sizeof(type, headers = nil, opts = "", &b)
+ typedef, member, prelude = typedef_expr(type, headers)
+ prelude << "static #{typedef} *rbcv_ptr_;\n"
+ prelude = [prelude]
+ expr = "sizeof((*rbcv_ptr_)#{"." << member if member})"
+ fmt = STRING_OR_FAILED_FORMAT
+ checking_for checking_message("size of #{type}", headers), fmt do
+ if size = try_constant(expr, prelude, opts, &b)
+ $defs.push(format("-DSIZEOF_%s=%s", type.tr_cpp, size))
+ size
+ end
+ end
+ end
-# Returns the convertible integer type of the given +type+. You may
-# optionally specify additional +headers+ to search in for the +type+.
-# _Convertible_ means actually same type, or typedefed from same type.
-#
-# If the +type+ is a integer type and _convertible_ type is found,
-# following macros are passed as preprocessor constants to the
-# compiler using the +type+ name, in uppercase.
-#
-# * 'TYPEOF_', followed by the +type+ name, followed by '=X' where 'X'
-# is the found _convertible_ type name. * 'TYP2NUM' and 'NUM2TYP,
-# where 'TYP' is the +type+ name in uppercase with replacing '_t'
-# suffix with 'T', followed by '=X' where 'X' is the macro name to
-# convert +type+ to +Integer+ object, and vice versa.
-#
-# For example, if foobar_t is defined as unsigned long, then
-# convertible_int("foobar_t") would return "unsigned long", and define
-# macros:
-#
-# #define TYPEOF_FOOBAR_T unsigned long
-# #define FOOBART2NUM ULONG2NUM
-# #define NUM2FOOBART NUM2ULONG
-def convertible_int(type, headers = nil, opts = nil, &b)
- type, macname = *type
- checking_for("convertible type of #{type}", STRING_OR_FAILED_FORMAT) do
- if UNIVERSAL_INTS.include?(type)
- type
- else
- typedef, member, prelude = typedef_expr(type, headers, &b)
- next unless signed = try_signedness(typedef, member, [prelude])
- u = "unsigned " if signed > 0
- prelude << "extern rbcv_typedef_ foo();"
- compat = UNIVERSAL_INTS.find {|t|
- try_compile([prelude, "extern #{u}#{t} foo();"].join("\n"), opts, :werror=>true, &b)
- }
- if compat
- macname ||= type.sub(/_(?=t\z)/, '').tr_cpp
- conv = (compat == "long long" ? "LL" : compat.upcase)
- compat = "#{u}#{compat}"
- $defs.push(format("-DTYPEOF_%s=%s", type.tr_cpp, compat.quote))
- $defs.push(format("-DPRI_%s_PREFIX=PRI_%s_PREFIX", macname, conv))
- conv = (u ? "U" : "") + conv
- $defs.push(format("-D%s2NUM=%s2NUM", macname, conv))
- $defs.push(format("-DNUM2%s=NUM2%s", macname, conv))
- compat
+ # Returns the signedness of the given +type+. You may optionally specify
+ # additional +headers+ to search in for the +type+.
+ #
+ # If the +type+ is found and is a numeric type, a macro is passed as a
+ # preprocessor constant to the compiler using the +type+ name, in uppercase,
+ # prepended with +SIGNEDNESS_OF_+, followed by the +type+ name, followed by
+ # <code>=X</code> where "X" is positive integer if the +type+ is unsigned
+ # and a negative integer if the +type+ is signed.
+ #
+ # For example, if +size_t+ is defined as unsigned, then
+ # <code>check_signedness('size_t')</code> would return +1 and the
+ # <code>SIGNEDNESS_OF_SIZE_T=+1</code> preprocessor macro would be passed to
+ # the compiler. The <code>SIGNEDNESS_OF_INT=-1</code> macro would be set
+ # for <code>check_signedness('int')</code>
+ #
+ def check_signedness(type, headers = nil, opts = nil, &b)
+ typedef, member, prelude = typedef_expr(type, headers)
+ signed = nil
+ checking_for("signedness of #{type}", STRING_OR_FAILED_FORMAT) do
+ signed = try_signedness(typedef, member, [prelude], opts, &b) or next nil
+ $defs.push("-DSIGNEDNESS_OF_%s=%+d" % [type.tr_cpp, signed])
+ signed < 0 ? "signed" : "unsigned"
+ end
+ signed
+ end
+
+ # Returns the convertible integer type of the given +type+. You may
+ # optionally specify additional +headers+ to search in for the +type+.
+ # _convertible_ means actually the same type, or typedef'd from the same
+ # type.
+ #
+ # If the +type+ is a integer type and the _convertible_ type is found,
+ # the following macros are passed as preprocessor constants to the compiler
+ # using the +type+ name, in uppercase.
+ #
+ # * +TYPEOF_+, followed by the +type+ name, followed by <code>=X</code>
+ # where "X" is the found _convertible_ type name.
+ # * +TYP2NUM+ and +NUM2TYP+,
+ # where +TYP+ is the +type+ name in uppercase with replacing an +_t+
+ # suffix with "T", followed by <code>=X</code> where "X" is the macro name
+ # to convert +type+ to an Integer object, and vice versa.
+ #
+ # For example, if +foobar_t+ is defined as unsigned long, then
+ # <code>convertible_int("foobar_t")</code> would return "unsigned long", and
+ # define these macros:
+ #
+ # #define TYPEOF_FOOBAR_T unsigned long
+ # #define FOOBART2NUM ULONG2NUM
+ # #define NUM2FOOBART NUM2ULONG
+ #
+ def convertible_int(type, headers = nil, opts = nil, &b)
+ type, macname = *type
+ checking_for("convertible type of #{type}", STRING_OR_FAILED_FORMAT) do
+ if UNIVERSAL_INTS.include?(type)
+ type
+ else
+ typedef, member, prelude = typedef_expr(type, headers, &b)
+ if member
+ prelude << "static rbcv_typedef_ rbcv_var;"
+ compat = UNIVERSAL_INTS.find {|t|
+ try_static_assert("sizeof(rbcv_var.#{member}) == sizeof(#{t})", [prelude], opts, &b)
+ }
+ else
+ next unless signed = try_signedness(typedef, member, [prelude])
+ u = "unsigned " if signed > 0
+ prelude << "extern rbcv_typedef_ foo();"
+ compat = UNIVERSAL_INTS.find {|t|
+ try_compile([prelude, "extern #{u}#{t} foo();"].join("\n"), opts, :werror=>true, &b)
+ }
+ end
+ if compat
+ macname ||= type.sub(/_(?=t\z)/, '').tr_cpp
+ conv = (compat == "long long" ? "LL" : compat.upcase)
+ compat = "#{u}#{compat}"
+ typename = type.tr_cpp
+ $defs.push(format("-DSIZEOF_%s=SIZEOF_%s", typename, compat.tr_cpp))
+ $defs.push(format("-DTYPEOF_%s=%s", typename, compat.quote))
+ $defs.push(format("-DPRI_%s_PREFIX=PRI_%s_PREFIX", macname, conv))
+ conv = (u ? "U" : "") + conv
+ $defs.push(format("-D%s2NUM=%s2NUM", macname, conv))
+ $defs.push(format("-DNUM2%s=NUM2%s", macname, conv))
+ compat
+ end
end
end
end
-end
-# :stopdoc:
+ # :stopdoc:
-# Used internally by the what_type? method to determine if +type+ is a scalar
-# pointer.
-def scalar_ptr_type?(type, member = nil, headers = nil, &b)
- try_compile(<<"SRC", &b) # pointer
+ # Used internally by the what_type? method to determine if +type+ is a scalar
+ # pointer.
+ def scalar_ptr_type?(type, member = nil, headers = nil, &b)
+ try_compile(<<"SRC", &b) # pointer
#{cpp_include(headers)}
/*top*/
volatile #{type} conftestval;
-int t() {return (int)(1-*(conftestval#{member ? ".#{member}" : ""}));}
-#{MAIN_DOES_NOTHING "t"}
+extern int t(void);
+#{MAIN_DOES_NOTHING 't'}
+int t(void) {return (int)(1-*(conftestval#{member ? ".#{member}" : ""}));}
SRC
-end
+ end
-# Used internally by the what_type? method to determine if +type+ is a scalar
-# pointer.
-def scalar_type?(type, member = nil, headers = nil, &b)
- try_compile(<<"SRC", &b) # pointer
+ # Used internally by the what_type? method to determine if +type+ is a scalar
+ # pointer.
+ def scalar_type?(type, member = nil, headers = nil, &b)
+ try_compile(<<"SRC", &b) # pointer
#{cpp_include(headers)}
/*top*/
volatile #{type} conftestval;
-int t() {return (int)(1-(conftestval#{member ? ".#{member}" : ""}));}
-#{MAIN_DOES_NOTHING "t"}
+extern int t(void);
+#{MAIN_DOES_NOTHING 't'}
+int t(void) {return (int)(1-(conftestval#{member ? ".#{member}" : ""}));}
SRC
-end
+ end
-# Used internally by the what_type? method to check if _typeof_ GCC
-# extension is available.
-def have_typeof?
- return $typeof if defined?($typeof)
- $typeof = %w[__typeof__ typeof].find do |t|
- try_compile(<<SRC)
+ # Used internally by the what_type? method to check if the _typeof_ GCC
+ # extension is available.
+ def have_typeof?
+ return $typeof if defined?($typeof)
+ $typeof = %w[__typeof__ typeof].find do |t|
+ try_compile(<<SRC)
int rbcv_foo;
#{t}(rbcv_foo) rbcv_bar;
SRC
+ end
end
-end
-def what_type?(type, member = nil, headers = nil, &b)
- m = "#{type}"
- var = val = "*rbcv_var_"
- func = "rbcv_func_(void)"
- if member
- m << "." << member
- else
- type, member = type.split('.', 2)
- end
- if member
- val = "(#{var}).#{member}"
- end
- prelude = [cpp_include(headers).split(/^/)]
- prelude << ["typedef #{type} rbcv_typedef_;\n",
- "extern rbcv_typedef_ *#{func};\n",
- "static rbcv_typedef_ #{var};\n",
- ]
- type = "rbcv_typedef_"
- fmt = member && !(typeof = have_typeof?) ? "seems %s" : "%s"
- if typeof
- var = "*rbcv_member_"
- func = "rbcv_mem_func_(void)"
- member = nil
- type = "rbcv_mem_typedef_"
- prelude[-1] << "typedef #{typeof}(#{val}) #{type};\n"
- prelude[-1] << "extern #{type} *#{func};\n"
- prelude[-1] << "static #{type} #{var};\n"
- val = var
- end
- def fmt.%(x)
- x ? super : "unknown"
- end
- checking_for checking_message(m, headers), fmt do
- if scalar_ptr_type?(type, member, prelude, &b)
- if try_static_assert("sizeof(*#{var}) == 1", prelude)
- return "string"
- end
- ptr = "*"
- elsif scalar_type?(type, member, prelude, &b)
- unless member and !typeof or try_static_assert("(#{type})-1 < 0", prelude)
- unsigned = "unsigned"
- end
- ptr = ""
+ def what_type?(type, member = nil, headers = nil, &b)
+ m = "#{type}"
+ var = val = "*rbcv_var_"
+ func = "rbcv_func_(void)"
+ if member
+ m << "." << member
else
- next
+ type, member = type.split('.', 2)
end
- type = UNIVERSAL_INTS.find do |t|
- pre = prelude
- unless member
- pre += [["static #{unsigned} #{t} #{ptr}#{var};\n",
- "extern #{unsigned} #{t} #{ptr}*#{func};\n"]]
+ if member
+ val = "(#{var}).#{member}"
+ end
+ prelude = [cpp_include(headers).split(/^/)]
+ prelude << ["typedef #{type} rbcv_typedef_;\n",
+ "extern rbcv_typedef_ *#{func};\n",
+ "static rbcv_typedef_ #{var};\n",
+ ]
+ type = "rbcv_typedef_"
+ fmt = member && !(typeof = have_typeof?) ? "seems %s" : "%s"
+ if typeof
+ var = "*rbcv_member_"
+ func = "rbcv_mem_func_(void)"
+ member = nil
+ type = "rbcv_mem_typedef_"
+ prelude[-1] << "typedef #{typeof}(#{val}) #{type};\n"
+ prelude[-1] << "extern #{type} *#{func};\n"
+ prelude[-1] << "static #{type} #{var};\n"
+ val = var
+ end
+ def fmt.%(x)
+ x ? super : "unknown"
+ end
+ checking_for checking_message(m, headers), fmt do
+ if scalar_ptr_type?(type, member, prelude, &b)
+ if try_static_assert("sizeof(*#{var}) == 1", prelude)
+ return "string"
+ end
+ ptr = "*"
+ elsif scalar_type?(type, member, prelude, &b)
+ unless member and !typeof or try_static_assert("(#{type})-1 < 0", prelude)
+ unsigned = "unsigned"
+ end
+ ptr = ""
+ else
+ next
+ end
+ type = UNIVERSAL_INTS.find do |t|
+ pre = prelude
+ unless member
+ pre += [["static #{unsigned} #{t} #{ptr}#{var};\n",
+ "extern #{unsigned} #{t} #{ptr}*#{func};\n"]]
+ end
+ try_static_assert("sizeof(#{ptr}#{val}) == sizeof(#{unsigned} #{t})", pre)
end
- try_static_assert("sizeof(#{ptr}#{val}) == sizeof(#{unsigned} #{t})", pre)
+ type or next
+ [unsigned, type, ptr].join(" ").strip
end
- type or next
- [unsigned, type, ptr].join(" ").strip
end
-end
-# This method is used internally by the find_executable method.
-#
-# Internal use only.
-#
-def find_executable0(bin, path = nil)
- executable_file = proc do |name|
- begin
- stat = File.stat(name)
- rescue SystemCallError
- else
- next name if stat.file? and stat.executable?
+ # This method is used internally by the find_executable method.
+ #
+ # Internal use only.
+ #
+ def find_executable0(bin, path = nil)
+ executable_file = proc do |name|
+ begin
+ stat = File.stat(name)
+ rescue SystemCallError
+ else
+ next name if stat.file? and stat.executable?
+ end
end
- end
- exts = config_string('EXECUTABLE_EXTS') {|s| s.split} || config_string('EXEEXT') {|s| [s]}
- if File.expand_path(bin) == bin
- return bin if executable_file.call(bin)
- if exts
- exts.each {|ext| executable_file.call(file = bin + ext) and return file}
+ exts = config_string('EXECUTABLE_EXTS') {|s| s.split} || config_string('EXEEXT') {|s| [s]}
+ if File.expand_path(bin) == bin
+ return bin if executable_file.call(bin)
+ if exts
+ exts.each {|ext| executable_file.call(file = bin + ext) and return file}
+ end
+ return nil
end
- return nil
- end
- if path ||= ENV['PATH']
- path = path.split(File::PATH_SEPARATOR)
- else
- path = %w[/usr/local/bin /usr/ucb /usr/bin /bin]
- end
- file = nil
- path.each do |dir|
- return file if executable_file.call(file = File.join(dir, bin))
- if exts
- exts.each {|ext| executable_file.call(ext = file + ext) and return ext}
+ if path ||= ENV['PATH']
+ path = path.split(File::PATH_SEPARATOR)
+ else
+ path = %w[/usr/local/bin /usr/ucb /usr/bin /bin]
+ end
+ file = nil
+ path.each do |dir|
+ return file if executable_file.call(file = File.join(dir, bin))
+ if exts
+ exts.each {|ext| executable_file.call(ext = file + ext) and return ext}
+ end
end
+ nil
end
- nil
-end
-
-# :startdoc:
-# Searches for the executable +bin+ on +path+. The default path is your
-# PATH environment variable. If that isn't defined, it will resort to
-# searching /usr/local/bin, /usr/ucb, /usr/bin and /bin.
-#
-# If found, it will return the full path, including the executable name,
-# of where it was found.
-#
-# Note that this method does not actually affect the generated Makefile.
-#
-def find_executable(bin, path = nil)
- checking_for checking_message(bin, path) do
- find_executable0(bin, path)
+ # :startdoc:
+
+ # Searches for the executable +bin+ on +path+. The default path is your
+ # +PATH+ environment variable. If that isn't defined, it will resort to
+ # searching /usr/local/bin, /usr/ucb, /usr/bin and /bin.
+ #
+ # If found, it will return the full path, including the executable name, of
+ # where it was found.
+ #
+ # Note that this method does not actually affect the generated Makefile.
+ #
+ def find_executable(bin, path = nil)
+ checking_for checking_message(bin, path) do
+ find_executable0(bin, path)
+ end
end
-end
-# :stopdoc:
+ # :stopdoc:
-def arg_config(config, default=nil, &block)
- $arg_config << [config, default]
- defaults = []
- if default
- defaults << default
- elsif !block
- defaults << nil
+ def arg_config(config, default=nil, &block)
+ $arg_config << [config, default]
+ defaults = []
+ if default
+ defaults << default
+ elsif !block
+ defaults << nil
+ end
+ $configure_args.fetch(config.tr('_', '-'), *defaults, &block)
+ end
+
+ # :startdoc:
+
+ # Tests for the presence of a <tt>--with-</tt>_config_ or
+ # <tt>--without-</tt>_config_ option. Returns +true+ if the with option is
+ # given, +false+ if the without option is given, and the default value
+ # otherwise.
+ #
+ # This can be useful for adding custom definitions, such as debug
+ # information.
+ #
+ # Example:
+ #
+ # if with_config("debug")
+ # $defs.push("-DOSSL_DEBUG") unless $defs.include? "-DOSSL_DEBUG"
+ # end
+ #
+ def with_config(config, default=nil)
+ config = config.sub(/^--with[-_]/, '')
+ val = arg_config("--with-"+config) do
+ if arg_config("--without-"+config)
+ false
+ elsif block_given?
+ yield(config, default)
+ else
+ break default
+ end
+ end
+ case val
+ when "yes"
+ true
+ when "no"
+ false
+ else
+ val
+ end
end
- $configure_args.fetch(config.tr('_', '-'), *defaults, &block)
-end
-
-# :startdoc:
-# Tests for the presence of a --with-<tt>config</tt> or --without-<tt>config</tt>
-# option. Returns true if the with option is given, false if the without
-# option is given, and the default value otherwise.
-#
-# This can be useful for adding custom definitions, such as debug information.
-#
-# Example:
-#
-# if with_config("debug")
-# $defs.push("-DOSSL_DEBUG") unless $defs.include? "-DOSSL_DEBUG"
-# end
-#
-def with_config(config, default=nil)
- config = config.sub(/^--with[-_]/, '')
- val = arg_config("--with-"+config) do
- if arg_config("--without-"+config)
+ # Tests for the presence of an <tt>--enable-</tt>_config_ or
+ # <tt>--disable-</tt>_config_ option. Returns +true+ if the enable option is
+ # given, +false+ if the disable option is given, and the default value
+ # otherwise.
+ #
+ # This can be useful for adding custom definitions, such as debug
+ # information.
+ #
+ # Example:
+ #
+ # if enable_config("debug")
+ # $defs.push("-DOSSL_DEBUG") unless $defs.include? "-DOSSL_DEBUG"
+ # end
+ #
+ def enable_config(config, default=nil)
+ if arg_config("--enable-"+config)
+ true
+ elsif arg_config("--disable-"+config)
false
elsif block_given?
yield(config, default)
else
- break default
+ return default
end
end
- case val
- when "yes"
- true
- when "no"
- false
- else
- val
- end
-end
-# Tests for the presence of an --enable-<tt>config</tt> or
-# --disable-<tt>config</tt> option. Returns true if the enable option is given,
-# false if the disable option is given, and the default value otherwise.
-#
-# This can be useful for adding custom definitions, such as debug information.
-#
-# Example:
-#
-# if enable_config("debug")
-# $defs.push("-DOSSL_DEBUG") unless $defs.include? "-DOSSL_DEBUG"
-# end
-#
-def enable_config(config, default=nil)
- if arg_config("--enable-"+config)
- true
- elsif arg_config("--disable-"+config)
- false
- elsif block_given?
- yield(config, default)
- else
- return default
- end
-end
+ # Generates a header file consisting of the various macro definitions
+ # generated by other methods such as have_func and have_header. These are
+ # then wrapped in a custom <code>#ifndef</code> based on the +header+ file
+ # name, which defaults to "extconf.h".
+ #
+ # For example:
+ #
+ # # extconf.rb
+ # require 'mkmf'
+ # have_func('realpath')
+ # have_header('sys/utime.h')
+ # create_header
+ # create_makefile('foo')
+ #
+ # The above script would generate the following extconf.h file:
+ #
+ # #ifndef EXTCONF_H
+ # #define EXTCONF_H
+ # #define HAVE_REALPATH 1
+ # #define HAVE_SYS_UTIME_H 1
+ # #endif
+ #
+ # Given that the create_header method generates a file based on definitions
+ # set earlier in your extconf.rb file, you will probably want to make this
+ # one of the last methods you call in your script.
+ #
+ def create_header(header = "extconf.h")
+ message "creating %s\n", header
+ sym = header.tr_cpp
+ hdr = ["#ifndef #{sym}\n#define #{sym}\n"]
+ for line in $defs
+ case line
+ when /^-D([^=]+)(?:=(.*))?/
+ hdr << "#define #$1 #{$2 ? Shellwords.shellwords($2)[0].gsub(/(?=\t+)/, "\\\n") : 1}\n"
+ when /^-U(.*)/
+ hdr << "#undef #$1\n"
+ end
+ end
+ hdr << "#endif\n"
+ hdr = hdr.join("")
+ log_src(hdr, "#{header} is")
+ unless (IO.read(header) == hdr rescue false)
+ open(header, "wb") do |hfile|
+ hfile.write(hdr)
+ end
+ end
+ $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.
+ #
+ # You may pass along additional "include" or "lib" defaults via the
+ # +idefault+ and +ldefault+ parameters, respectively.
+ #
+ # Note that dir_config only adds to the list of places to search for
+ # libraries and include files. It does not link the libraries into your
+ # application.
+ #
+ def dir_config(target, idefault=nil, ldefault=nil)
+ if dir = with_config(target + "-dir", (idefault unless ldefault))
+ defaults = Array === dir ? dir : dir.split(File::PATH_SEPARATOR)
+ idefault = ldefault = nil
+ end
-# Generates a header file consisting of the various macro definitions generated
-# by other methods such as have_func and have_header. These are then wrapped in
-# a custom #ifndef based on the +header+ file name, which defaults to
-# 'extconf.h'.
-#
-# For example:
-#
-# # extconf.rb
-# require 'mkmf'
-# have_func('realpath')
-# have_header('sys/utime.h')
-# create_header
-# create_makefile('foo')
-#
-# The above script would generate the following extconf.h file:
-#
-# #ifndef EXTCONF_H
-# #define EXTCONF_H
-# #define HAVE_REALPATH 1
-# #define HAVE_SYS_UTIME_H 1
-# #endif
-#
-# Given that the create_header method generates a file based on definitions
-# set earlier in your extconf.rb file, you will probably want to make this
-# one of the last methods you call in your script.
-#
-def create_header(header = "extconf.h")
- message "creating %s\n", header
- sym = header.tr_cpp
- hdr = ["#ifndef #{sym}\n#define #{sym}\n"]
- for line in $defs
- case line
- when /^-D([^=]+)(?:=(.*))?/
- hdr << "#define #$1 #{$2 ? Shellwords.shellwords($2)[0].gsub(/(?=\t+)/, "\\\n") : 1}\n"
- when /^-U(.*)/
- hdr << "#undef #$1\n"
- end
- end
- hdr << "#endif\n"
- hdr = hdr.join
- log_src(hdr, "#{header} is")
- unless (IO.read(header) == hdr rescue false)
- open(header, "wb") do |hfile|
- hfile.write(hdr)
- end
- end
- $extconf_h = header
-end
+ 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}"
-# 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 --with-foo-dir command
-# line option.
-#
-# You may pass along additional 'include' or 'lib' defaults via the +idefault+
-# and +ldefault+ parameters, respectively.
-#
-# Note that dir_config only adds to the list of places to search for libraries
-# and include files. It does not link the libraries into your application.
-#
-def dir_config(target, idefault=nil, ldefault=nil)
- if dir = with_config(target + "-dir", (idefault unless ldefault))
- defaults = Array === dir ? dir : dir.split(File::PATH_SEPARATOR)
- idefault = ldefault = nil
- end
-
- 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}"
-
- idirs = idir ? Array === idir ? idir.dup : idir.split(File::PATH_SEPARATOR) : []
- if defaults
- idirs.concat(defaults.collect {|d| d + "/include"})
- idir = ([idir] + idirs).compact.join(File::PATH_SEPARATOR)
- end
- unless idirs.empty?
- idirs.collect! {|d| "-I" + d}
- idirs -= Shellwords.shellwords($CPPFLAGS)
+ idirs = idir ? Array === idir ? idir.dup : idir.split(File::PATH_SEPARATOR) : []
+ if defaults
+ idirs.concat(defaults.collect {|d| d + "/include"})
+ idir = ([idir] + idirs).compact.join(File::PATH_SEPARATOR)
+ end
unless idirs.empty?
- $CPPFLAGS = (idirs.quote << $CPPFLAGS).join(" ")
+ idirs.collect! {|d| "-I" + d}
+ idirs -= Shellwords.shellwords($CPPFLAGS)
+ unless idirs.empty?
+ $CPPFLAGS = (idirs.quote << $CPPFLAGS).join(" ")
+ end
end
- end
- ldirs = ldir ? Array === ldir ? ldir.dup : ldir.split(File::PATH_SEPARATOR) : []
- if defaults
- ldirs.concat(defaults.collect {|d| "#{d}/#{@libdir_basename}"})
- ldir = ([ldir] + ldirs).compact.join(File::PATH_SEPARATOR)
+ ldirs = ldir ? Array === ldir ? ldir.dup : ldir.split(File::PATH_SEPARATOR) : []
+ if defaults
+ ldirs.concat(defaults.collect {|d| "#{d}/#{_libdir_basename}"})
+ ldir = ([ldir] + ldirs).compact.join(File::PATH_SEPARATOR)
+ end
+ $LIBPATH = ldirs | $LIBPATH
+
+ [idir, ldir]
+ end
+
+ # 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 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}
+ elsif find_executable0(pkgconfig = "#{pkg}-config")
+ # default to package specific config command, as a last resort.
+ get = proc {|opt| `#{pkgconfig} --#{opt}`.strip}
+ end
+ orig_ldflags = $LDFLAGS
+ if get and option
+ get[option]
+ elsif get and try_ldflags(ldflags = get['libs'])
+ cflags = get['cflags']
+ libs = get['libs-only-l']
+ ldflags = (Shellwords.shellwords(ldflags) - Shellwords.shellwords(libs)).quote.join(" ")
+ $CFLAGS += " " << cflags
+ $LDFLAGS = [orig_ldflags, ldflags].join(' ')
+ $libs += " " << libs
+ Logging::message "package configuration for %s\n", pkg
+ Logging::message "cflags: %s\nldflags: %s\nlibs: %s\n\n",
+ cflags, ldflags, libs
+ [cflags, ldflags, libs]
+ else
+ Logging::message "package configuration for %s is not found\n", pkg
+ nil
+ end
end
- $LIBPATH = ldirs | $LIBPATH
- [idir, ldir]
-end
+ # :stopdoc:
-# :stopdoc:
-
-# Handles meta information about installed libraries. Uses your platform's
-# pkg-config program if it has one.
-def pkg_config(pkg)
- if pkgconfig = with_config("#{pkg}-config") and find_executable0(pkgconfig)
- # iff package specific config command is given
- get = proc {|opt| `#{pkgconfig} --#{opt}`.chomp}
- 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}`.chomp}
- elsif find_executable0(pkgconfig = "#{pkg}-config")
- # default to package specific config command, as a last resort.
- get = proc {|opt| `#{pkgconfig} --#{opt}`.chomp}
- end
- if get
- cflags = get['cflags']
- ldflags = get['libs']
- libs = get['libs-only-l']
- ldflags = (Shellwords.shellwords(ldflags) - Shellwords.shellwords(libs)).quote.join(" ")
- $CFLAGS += " " << cflags
- $LDFLAGS += " " << ldflags
- $libs += " " << libs
- Logging::message "package configuration for %s\n", pkg
- Logging::message "cflags: %s\nldflags: %s\nlibs: %s\n\n",
- cflags, ldflags, libs
- [cflags, ldflags, libs]
- else
- Logging::message "package configuration for %s is not found\n", pkg
- nil
+ def with_destdir(dir)
+ dir = dir.sub($dest_prefix_pattern, '')
+ /\A\$[\(\{]/ =~ dir ? dir : "$(DESTDIR)"+dir
end
-end
-def with_destdir(dir)
- dir = dir.sub($dest_prefix_pattern, '')
- /\A\$[\(\{]/ =~ dir ? dir : "$(DESTDIR)"+dir
-end
-
-# Converts forward slashes to backslashes. Aimed at MS Windows.
-#
-# Internal use only.
-#
-def winsep(s)
- s.tr('/', '\\')
-end
-
-# Converts native path to format acceptable in Makefile
-#
-# Internal use only.
-#
-if !CROSS_COMPILING
- case CONFIG['build_os']
- when 'mingw32'
- def mkintpath(path)
- # mingw uses make from msys and it needs special care
- # converts from C:\some\path to /C/some/path
- path = path.dup
- path.tr!('\\', '/')
- path.sub!(/\A([A-Za-z]):(?=\/)/, '/\1')
- path
- end
+ # Converts forward slashes to backslashes. Aimed at MS Windows.
+ #
+ # Internal use only.
+ #
+ def winsep(s)
+ s.tr('/', '\\')
end
-end
-unless defined?(mkintpath)
- def mkintpath(path)
- path
- end
-end
-def configuration(srcdir)
- mk = []
- vpath = $VPATH.dup
+ # Converts native path to format acceptable in Makefile
+ #
+ # Internal use only.
+ #
if !CROSS_COMPILING
case CONFIG['build_os']
+ when 'mingw32'
+ def mkintpath(path)
+ # mingw uses make from msys and it needs special care
+ # converts from C:\some\path to /C/some/path
+ path = path.dup
+ path.tr!('\\', '/')
+ path.sub!(/\A([A-Za-z]):(?=\/)/, '/\1')
+ path
+ end
when 'cygwin'
if CONFIG['target_os'] != 'cygwin'
- vpath = vpath.map {|p| p.sub(/.*/, '$(shell cygpath -u \&)')}
+ def mkintpath(path)
+ IO.popen(["cygpath", "-u", path], &:read).chomp
+ end
end
end
end
- CONFIG["hdrdir"] ||= $hdrdir
- mk << %{
+ unless method_defined?(:mkintpath)
+ def mkintpath(path)
+ path
+ end
+ end
+
+ def configuration(srcdir)
+ mk = []
+ vpath = $VPATH.dup
+ CONFIG["hdrdir"] ||= $hdrdir
+ mk << %{
SHELL = /bin/sh
# V=0 quiet, V=1 verbose. other values don't work.
V = 0
Q1 = $(V:1=)
Q = $(Q1:0=@)
-n=$(NULLCMD)
-ECHO1 = $(V:1=@$n)
+ECHO1 = $(V:1=@#{CONFIG['NULLCMD']})
ECHO = $(ECHO1:0=@echo)
#### Start of system configuration section. ####
#{"top_srcdir = " + $top_srcdir.sub(%r"\A#{Regexp.quote($topdir)}/", "$(topdir)/") if $extmk}
-srcdir = #{srcdir.gsub(/\$\((srcdir)\)|\$\{(srcdir)\}/) {mkintpath(CONFIG[$1||$2])}.quote}
-topdir = #{mkintpath($extmk ? CONFIG["topdir"] : $topdir).quote}
-hdrdir = #{mkintpath(CONFIG["hdrdir"]).quote}
+srcdir = #{srcdir.gsub(/\$\((srcdir)\)|\$\{(srcdir)\}/) {mkintpath(CONFIG[$1||$2]).unspace}}
+topdir = #{mkintpath(topdir = $extmk ? CONFIG["topdir"] : $topdir).unspace}
+hdrdir = #{(hdrdir = CONFIG["hdrdir"]) == topdir ? "$(topdir)" : mkintpath(hdrdir).unspace}
arch_hdrdir = #{$arch_hdrdir.quote}
+PATH_SEPARATOR = #{CONFIG['PATH_SEPARATOR']}
VPATH = #{vpath.join(CONFIG['PATH_SEPARATOR'])}
}
- if $extmk
- mk << "RUBYLIB =\n""RUBYOPT = -\n"
- end
- if destdir = CONFIG["prefix"][$dest_prefix_pattern, 1]
- mk << "\nDESTDIR = #{destdir}\n"
- end
- CONFIG.each do |key, var|
- next unless /prefix$/ =~ key
- mk << "#{key} = #{with_destdir(var)}\n"
- end
- CONFIG.each do |key, var|
- next if /^abs_/ =~ key
- next if /^(?:src|top|hdr)dir$/ =~ key
- next unless /dir$/ =~ key
- mk << "#{key} = #{with_destdir(var)}\n"
- end
- if !$extmk and !$configure_args.has_key?('--ruby') and
- sep = config_string('BUILD_FILE_SEPARATOR')
- sep = ":/=#{sep}"
- else
- sep = ""
- end
- possible_command = (proc {|s| s if /top_srcdir/ !~ s} unless $extmk)
- extconf_h = $extconf_h ? "-DRUBY_EXTCONF_H=\\\"$(RUBY_EXTCONF_H)\\\" " : $defs.join(" ") << " "
- mk << %{
-NULLCMD = #{CONFIG['NULLCMD']}
+ if $extmk
+ mk << "RUBYLIB =\n""RUBYOPT = -\n"
+ end
+ prefix = mkintpath(CONFIG["prefix"])
+ if destdir = prefix[$dest_prefix_pattern, 1]
+ mk << "\nDESTDIR = #{destdir}\n"
+ end
+ mk << "prefix = #{with_destdir(prefix).unspace}\n"
+ CONFIG.each do |key, var|
+ mk << "#{key} = #{with_destdir(mkintpath(var)).unspace}\n" if /.prefix$/ =~ key
+ end
+ CONFIG.each do |key, var|
+ next if /^abs_/ =~ key
+ next if /^(?:src|top|hdr)dir$/ =~ key
+ next unless /dir$/ =~ key
+ mk << "#{key} = #{with_destdir(var)}\n"
+ end
+ if !$extmk and !$configure_args.has_key?('--ruby') and
+ sep = config_string('BUILD_FILE_SEPARATOR')
+ sep = ":/=#{sep}"
+ else
+ sep = ""
+ 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/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
+ headers << $config_h
+ headers << '$(RUBY_EXTCONF_H)' if $extconf_h
+ mk << %{
CC = #{CONFIG['CC']}
CXX = #{CONFIG['CXX']}
@@ -1696,11 +1899,12 @@ cflags = #{CONFIG['cflags']}
optflags = #{CONFIG['optflags']}
debugflags = #{CONFIG['debugflags']}
warnflags = #{$warnflags}
-CFLAGS = #{$static ? '' : CONFIG['CCDLFLAGS']} #$CFLAGS $(ARCH_FLAG)
+CCDLFLAGS = #{$static ? '' : CONFIG['CCDLFLAGS']}
+CFLAGS = $(CCDLFLAGS) #$CFLAGS $(ARCH_FLAG)
INCFLAGS = -I. #$INCFLAGS
DEFS = #{CONFIG['DEFS']}
CPPFLAGS = #{extconf_h}#{$CPPFLAGS}
-CXXFLAGS = $(CFLAGS) #{CONFIG['CXXFLAGS']}
+CXXFLAGS = $(CCDLFLAGS) #{CONFIG['CXXFLAGS']} $(ARCH_FLAG)
ldflags = #{$LDFLAGS}
dldflags = #{$DLDFLAGS} #{CONFIG['EXTDLDFLAGS']}
ARCH_FLAG = #{$ARCH_FLAG}
@@ -1710,14 +1914,18 @@ LDSHAREDXX = #{config_string('LDSHAREDXX') || '$(LDSHARED)'}
AR = #{CONFIG['AR']}
EXEEXT = #{CONFIG['EXEEXT']}
-RUBY_BASE_NAME = #{CONFIG['RUBY_BASE_NAME']}
-RUBY_INSTALL_NAME = #{CONFIG['RUBY_INSTALL_NAME']}
-RUBY_SO_NAME = #{CONFIG['RUBY_SO_NAME']}
+}
+ CONFIG.each do |key, val|
+ mk << "#{key} = #{val}\n" if /^RUBY.*NAME/ =~ key
+ end
+ mk << %{
arch = #{CONFIG['arch']}
sitearch = #{CONFIG['sitearch']}
ruby_version = #{RbConfig::CONFIG['ruby_version']}
-ruby = #{$ruby}
+ruby = #{$ruby.sub(%r[\A#{Regexp.quote(RbConfig::CONFIG['bindir'])}(?=/|\z)]) {'$(bindir)'}}
RUBY = $(ruby#{sep})
+ruby_headers = #{headers.join(' ')}
+
RM = #{config_string('RM', &possible_command) || '$(RUBY) -run -e rm -- -f'}
RM_RF = #{'$(RUBY) -run -e rm -- -rf'}
RMDIRS = #{config_string('RMDIRS', &possible_command) || '$(RUBY) -run -e rmdir -- -p'}
@@ -1732,227 +1940,256 @@ TOUCH = exit >
preload = #{defined?($preload) && $preload ? $preload.join(' ') : ''}
}
- if $nmake == ?b
- mk.each do |x|
- x.gsub!(/^(MAKEDIRS|INSTALL_(?:PROG|DATA))+\s*=.*\n/) do
- "!ifndef " + $1 + "\n" +
- $& +
- "!endif\n"
+ if $nmake == ?b
+ mk.each do |x|
+ x.gsub!(/^(MAKEDIRS|INSTALL_(?:PROG|DATA))+\s*=.*\n/) do
+ "!ifndef " + $1 + "\n" +
+ $& +
+ "!endif\n"
+ end
end
end
+ mk
end
- mk
-end
-def timestamp_file(name)
- name = name.gsub(/(\$[({]|[})])|(\/+)|[^-.\w]+/) {$1 ? "" : $2 ? ".-." : "_"}
- "./.#{name}.time"
-end
-# :startdoc:
+ 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 ? ".-." : "_"}
+ "$(TIMESTAMP_DIR)/.#{name}.time"
+ end
+ # :startdoc:
-# creates a stub Makefile.
-#
-def dummy_makefile(srcdir)
- configuration(srcdir) << <<RULES << CLEANINGS
+ # creates a stub Makefile.
+ #
+ def dummy_makefile(srcdir)
+ configuration(srcdir) << <<RULES << CLEANINGS
CLEANFILES = #{$cleanfiles.join(' ')}
DISTCLEANFILES = #{$distcleanfiles.join(' ')}
all install static install-so install-rb: Makefile
.PHONY: all install static install-so install-rb
-.PHONY: clean clean-so clean-rb
+.PHONY: clean clean-so clean-static clean-rb
RULES
-end
+ end
-# Processes the data contents of the "depend" file.
-# Each line of this file is expected to be a file name.
-#
-# Returns the output of findings, in Makefile format.
-#
-def depend_rules(depend)
- suffixes = []
- depout = []
- cont = implicit = nil
- impconv = proc do
- COMPILE_RULES.each {|rule| depout << (rule % implicit[0]) << implicit[1]}
- implicit = nil
- end
- ruleconv = proc do |line|
- if implicit
- if /\A\t/ =~ line
- implicit[1] << line
- next
+ def each_compile_rules # :nodoc:
+ vpath_splat = /\$\(\*VPATH\*\)/
+ COMPILE_RULES.each do |rule|
+ if vpath_splat =~ rule
+ $VPATH.each do |path|
+ yield rule.sub(vpath_splat) {path}
+ end
else
- impconv[]
+ yield rule
end
end
- if m = /\A\.(\w+)\.(\w+)(?:\s*:)/.match(line)
- suffixes << m[1] << m[2]
- implicit = [[m[1], m[2]], [m.post_match]]
- next
- elsif RULE_SUBST and /\A(?!\s*\w+\s*=)[$\w][^#]*:/ =~ line
- line.gsub!(%r"(\s)(?!\.)([^$(){}+=:\s\/\\,]+)(?=\s|\z)") {$1 + RULE_SUBST % $2}
- end
- depout << line
- end
- depend.each_line do |line|
- line.gsub!(/\.o\b/, ".#{$OBJEXT}")
- 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
- line.gsub!(%r"[-\w\./]{2,}"){$&.tr("/", "\\")}
- line.gsub!(/(\$\((?!RM|COPY)[^:)]+)(?=\))/, '\1:/=\\')
- end
- if /(?:^|[^\\])(?:\\\\)*\\$/ =~ line
- (cont ||= []) << line
- next
- elsif cont
- line = (cont << line).join
- cont = nil
- end
- ruleconv.call(line)
- end
- if cont
- ruleconv.call(cont.join)
- elsif implicit
- impconv.call
- end
- unless suffixes.empty?
- depout.unshift(".SUFFIXES: ." + suffixes.uniq.join(" .") + "\n\n")
- end
- depout.unshift("$(OBJS): $(RUBY_EXTCONF_H)\n\n") if $extconf_h
- depout.flatten!
- depout
-end
-
-# Generates the Makefile for your extension, passing along any options and
-# preprocessor constants that you may have generated through other methods.
-#
-# The +target+ name should correspond the name of the global function name
-# defined within your C extension, minus the 'Init_'. For example, if your
-# C extension is defined as 'Init_foo', then your target would simply be 'foo'.
-#
-# If any '/' characters are present in the target name, only the last name
-# is interpreted as the target name, and the rest are considered toplevel
-# directory names, and the generated Makefile will be altered accordingly to
-# follow that directory structure.
-#
-# For example, if you pass 'test/foo' as a target name, your extension will
-# be installed under the 'test' directory. This means that in order to
-# load the file within a Ruby program later, that directory structure will
-# have to be followed, e.g. "require 'test/foo'".
-#
-# The +srcprefix+ should be used when your source files are not in the same
-# directory as your build script. This will not only eliminate the need for
-# you to manually copy the source files into the same directory as your build
-# script, but it also sets the proper +target_prefix+ in the generated
-# Makefile.
-#
-# Setting the +target_prefix+ will, in turn, install the generated binary in
-# a directory under your RbConfig::CONFIG['sitearchdir'] that mimics your local
-# filesystem when you run 'make install'.
-#
-# For example, given the following file tree:
-#
-# ext/
-# extconf.rb
-# test/
-# foo.c
-#
-# And given the following code:
-#
-# create_makefile('test/foo', 'test')
-#
-# That will set the +target_prefix+ in the generated Makefile to 'test'. That,
-# in turn, will create the following file tree when installed via the
-# 'make install' command:
-#
-# /path/to/ruby/sitearchdir/test/foo.so
-#
-# It is recommended that you use this approach to generate your makefiles,
-# instead of copying files around manually, because some third party
-# libraries may depend on the +target_prefix+ being set properly.
-#
-# The +srcprefix+ argument can be used to override the default source
-# directory, i.e. the current directory . It is included as part of the VPATH
-# and added to the list of INCFLAGS.
-#
-def create_makefile(target, srcprefix = nil)
- $target = target
- libpath = $DEFLIBPATH|$LIBPATH
- message "creating Makefile\n"
- rm_f "conftest*"
- if CONFIG["DLEXT"] == $OBJEXT
- for lib in libs = $libs.split
- lib.sub!(/-l(.*)/, %%"lib\\1.#{$LIBEXT}"%)
- end
- $defs.push(format("-DEXTLIB='%s'", libs.join(",")))
- end
-
- if target.include?('/')
- target_prefix, target = File.split(target)
- target_prefix[0,0] = '/'
- else
- target_prefix = ""
end
- srcprefix ||= "$(srcdir)/#{srcprefix}".chomp('/')
- RbConfig.expand(srcdir = srcprefix.dup)
-
- ext = ".#{$OBJEXT}"
- if not $objs
- srcs = $srcs || Dir[File.join(srcdir, "*.{#{SRC_EXT.join(%q{,})}}")]
- objs = srcs.inject(Hash.new {[]}) {|h, f| h[File.basename(f, ".*") << ext] <<= f; h}
- $objs = objs.keys
- unless objs.delete_if {|b, f| f.size == 1}.empty?
- dups = objs.sort.map {|b, f|
- "#{b[/.*\./]}{#{f.collect {|n| n[/([^.]+)\z/]}.join(',')}}"
- }
- abort "source files duplication - #{dups.join(", ")}"
+ # Processes the data contents of the "depend" file. Each line of this file
+ # is expected to be a file name.
+ #
+ # Returns the output of findings, in Makefile format.
+ #
+ def depend_rules(depend)
+ suffixes = []
+ depout = []
+ cont = implicit = nil
+ impconv = proc do
+ each_compile_rules {|rule| depout << (rule % implicit[0]) << implicit[1]}
+ implicit = nil
+ end
+ ruleconv = proc do |line|
+ if implicit
+ if /\A\t/ =~ line
+ implicit[1] << line
+ next
+ else
+ impconv[]
+ end
+ end
+ if m = /\A\.(\w+)\.(\w+)(?:\s*:)/.match(line)
+ suffixes << m[1] << m[2]
+ implicit = [[m[1], m[2]], [m.post_match]]
+ next
+ elsif RULE_SUBST and /\A(?!\s*\w+\s*=)[$\w][^#]*:/ =~ line
+ line.gsub!(%r"(\s)(?!\.)([^$(){}+=:\s\/\\,]+)(?=\s|\z)") {$1 + RULE_SUBST % $2}
+ end
+ depout << line
+ 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
+ line.gsub!(%r"[-\w\./]{2,}"){$&.tr("/", "\\")}
+ line.gsub!(/(\$\((?!RM|COPY)[^:)]+)(?=\))/, '\1:/=\\')
+ end
+ if /(?:^|[^\\])(?:\\\\)*\\$/ =~ line
+ (cont ||= []) << line
+ next
+ elsif cont
+ line = (cont << line).join
+ cont = nil
+ end
+ ruleconv.call(line)
+ end
+ if cont
+ ruleconv.call(cont.join)
+ elsif implicit
+ impconv.call
+ end
+ unless suffixes.empty?
+ depout.unshift(".SUFFIXES: ." + suffixes.uniq.join(" .") + "\n\n")
+ end
+ depout.unshift("$(OBJS): $(RUBY_EXTCONF_H)\n\n") if $extconf_h
+ depout.flatten!
+ depout
+ end
+
+ # Generates the Makefile for your extension, passing along any options and
+ # preprocessor constants that you may have generated through other methods.
+ #
+ # The +target+ name should correspond the name of the global function name
+ # defined within your C extension, minus the +Init_+. For example, if your
+ # C extension is defined as +Init_foo+, then your target would simply be
+ # "foo".
+ #
+ # If any "/" characters are present in the target name, only the last name
+ # is interpreted as the target name, and the rest are considered toplevel
+ # directory names, and the generated Makefile will be altered accordingly to
+ # follow that directory structure.
+ #
+ # For example, if you pass "test/foo" as a target name, your extension will
+ # be installed under the "test" directory. This means that in order to
+ # load the file within a Ruby program later, that directory structure will
+ # have to be followed, e.g. <code>require 'test/foo'</code>.
+ #
+ # The +srcprefix+ should be used when your source files are not in the same
+ # directory as your build script. This will not only eliminate the need for
+ # you to manually copy the source files into the same directory as your
+ # build script, but it also sets the proper +target_prefix+ in the generated
+ # Makefile.
+ #
+ # Setting the +target_prefix+ will, in turn, install the generated binary in
+ # a directory under your <code>RbConfig::CONFIG['sitearchdir']</code> that
+ # mimics your local filesystem when you run <code>make install</code>.
+ #
+ # For example, given the following file tree:
+ #
+ # ext/
+ # extconf.rb
+ # test/
+ # foo.c
+ #
+ # And given the following code:
+ #
+ # create_makefile('test/foo', 'test')
+ #
+ # That will set the +target_prefix+ in the generated Makefile to "test".
+ # That, in turn, will create the following file tree when installed via the
+ # <code>make install</code> command:
+ #
+ # /path/to/ruby/sitearchdir/test/foo.so
+ #
+ # It is recommended that you use this approach to generate your makefiles,
+ # instead of copying files around manually, because some third party
+ # libraries may depend on the +target_prefix+ being set properly.
+ #
+ # The +srcprefix+ argument can be used to override the default source
+ # directory, i.e. the current directory. It is included as part of the
+ # +VPATH+ and added to the list of +INCFLAGS+.
+ #
+ def create_makefile(target, srcprefix = nil)
+ $target = target
+ libpath = $DEFLIBPATH|$LIBPATH
+ message "creating Makefile\n"
+ MakeMakefile.rm_f "#{CONFTEST}*"
+ if CONFIG["DLEXT"] == $OBJEXT
+ for lib in libs = $libs.split
+ lib.sub!(/-l(.*)/, %%"lib\\1.#{$LIBEXT}"%)
+ end
+ $defs.push(format("-DEXTLIB='%s'", libs.join(",")))
end
- else
- $objs.collect! {|o| File.basename(o, ".*") << ext} unless $OBJEXT == "o"
- srcs = $srcs || $objs.collect {|o| o.chomp(ext) << ".c"}
- end
- $srcs = srcs
- target = nil if $objs.empty?
+ if target.include?('/')
+ target_prefix, target = File.split(target)
+ target_prefix[0,0] = '/'
+ else
+ target_prefix = ""
+ end
- if target and EXPORT_PREFIX
- if File.exist?(File.join(srcdir, target + '.def'))
- deffile = "$(srcdir)/$(TARGET).def"
- unless EXPORT_PREFIX.empty?
- makedef = %{-pe "$_.sub!(/^(?=\\w)/,'#{EXPORT_PREFIX}') unless 1../^EXPORTS$/i"}
+ srcprefix ||= "$(srcdir)/#{srcprefix}".chomp('/')
+ RbConfig.expand(srcdir = srcprefix.dup)
+
+ ext = ".#{$OBJEXT}"
+ orig_srcs = Dir[File.join(srcdir, "*.{#{SRC_EXT.join(%q{,})}}")]
+ if not $objs
+ srcs = $srcs || orig_srcs
+ objs = srcs.inject(Hash.new {[]}) {|h, f| h[File.basename(f, ".*") << ext] <<= f; h}
+ $objs = objs.keys
+ unless objs.delete_if {|b, f| f.size == 1}.empty?
+ dups = objs.sort.map {|b, f|
+ "#{b[/.*\./]}{#{f.collect {|n| n[/([^.]+)\z/]}.join(',')}}"
+ }
+ abort "source files duplication - #{dups.join(", ")}"
end
else
- makedef = %{-e "puts 'EXPORTS', '$(TARGET_ENTRY)'"}
+ $objs.collect! {|o| File.basename(o, ".*") << ext} unless $OBJEXT == "o"
+ srcs = $srcs || $objs.collect {|o| o.chomp(ext) << ".c"}
end
- if makedef
- $cleanfiles << '$(DEFFILE)'
- origdef = deffile
- deffile = "$(TARGET)-$(arch).def"
+ $srcs = srcs
+
+ hdrs = Dir[File.join(srcdir, "*.{#{HDR_EXT.join(%q{,})}}")]
+
+ target = nil if $objs.empty?
+
+ if target and EXPORT_PREFIX
+ if File.exist?(File.join(srcdir, target + '.def'))
+ deffile = "$(srcdir)/$(TARGET).def"
+ unless EXPORT_PREFIX.empty?
+ makedef = %{-pe "$_.sub!(/^(?=\\w)/,'#{EXPORT_PREFIX}') unless 1../^EXPORTS$/i"}
+ end
+ else
+ makedef = %{-e "puts 'EXPORTS', '$(TARGET_ENTRY)'"}
+ end
+ if makedef
+ $cleanfiles << '$(DEFFILE)'
+ origdef = deffile
+ deffile = "$(TARGET)-$(arch).def"
+ end
end
- end
- origdef ||= ''
+ origdef ||= ''
- if $extout and $INSTALLFILES
- $cleanfiles.concat($INSTALLFILES.collect {|files, dir|File.join(dir, files.sub(/\A\.\//, ''))})
- $distcleandirs.concat($INSTALLFILES.collect {|files, dir| dir})
- end
+ if $extout and $INSTALLFILES
+ $cleanfiles.concat($INSTALLFILES.collect {|files, dir|File.join(dir, files.sub(/\A\.\//, ''))})
+ $distcleandirs.concat($INSTALLFILES.collect {|files, dir| dir})
+ end
- if $extmk and not $extconf_h
- create_header
- end
+ if $extmk and $static
+ $defs << "-DRUBY_EXPORT=1"
+ end
+
+ if $extmk and not $extconf_h
+ create_header
+ end
- libpath = libpathflag(libpath)
+ libpath = libpathflag(libpath)
- dllib = target ? "$(TARGET).#{CONFIG['DLEXT']}" : ""
- staticlib = target ? "$(TARGET).#$LIBEXT" : ""
- mfile = open("Makefile", "wb")
- conf = configuration(srcprefix)
- conf = yield(conf) if block_given?
- mfile.puts(conf)
- mfile.print "
+ dllib = target ? "$(TARGET).#{CONFIG['DLEXT']}" : ""
+ staticlib = target ? "$(TARGET).#$LIBEXT" : ""
+ mfile = open("Makefile", "wb")
+ conf = configuration(srcprefix)
+ conf = yield(conf) if block_given?
+ mfile.puts(conf)
+ mfile.print "
libpath = #{($DEFLIBPATH|$LIBPATH).join(" ")}
LIBPATH = #{libpath}
DEFFILE = #{deffile}
@@ -1966,8 +2203,10 @@ extout_prefix = #{$extout_prefix}
target_prefix = #{target_prefix}
LOCAL_LIBS = #{$LOCAL_LIBS}
LIBS = #{$LIBRUBYARG} #{$libs} #{$LIBS}
-SRCS = #{srcs.collect(&File.method(:basename)).join(' ')}
+ORIG_SRCS = #{orig_srcs.collect(&File.method(:basename)).join(' ')}
+SRCS = $(ORIG_SRCS) #{(srcs - orig_srcs).collect(&File.method(:basename)).join(' ')}
OBJS = #{$objs.join(" ")}
+HDRS = #{hdrs.map{|h| '$(srcdir)/' + File.basename(h)}.join(' ')}
TARGET = #{target}
TARGET_NAME = #{target && target[/\A\w+/]}
TARGET_ENTRY = #{EXPORT_PREFIX || ''}Init_$(TARGET_NAME)
@@ -1975,11 +2214,12 @@ 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]}
- n = ($extout ? '$(RUBYARCHDIR)/' : '') + '$(TARGET)'
- mfile.print "
+ # TODO: fixme
+ install_dirs.each {|d| mfile.print("%-14s= %s\n" % d) if /^[[:upper:]]/ =~ d[0]}
+ n = ($extout ? '$(RUBYARCHDIR)/' : '') + '$(TARGET)'
+ mfile.print "
TARGET_SO = #{($extout ? '$(RUBYARCHDIR)/' : '')}$(DLLIB)
CLEANLIBS = #{n}.#{CONFIG['DLEXT']} #{config_string('cleanlibs') {|t| t.gsub(/\$\*/) {n}}}
CLEANOBJS = *.#{$OBJEXT} #{config_string('cleanobjs') {|t| t.gsub(/\$\*/, "$(TARGET)#{deffile ? '-$(arch)': ''}")} if target} *.bak
@@ -1987,330 +2227,374 @@ CLEANOBJS = *.#{$OBJEXT} #{config_string('cleanobjs') {|t| t.gsub(/\$\*/, "$
all: #{$extout ? "install" : target ? "$(DLLIB)" : "Makefile"}
static: $(STATIC_LIB)#{$extout ? " install-rb" : ""}
.PHONY: all install static install-so install-rb
-.PHONY: clean clean-so clean-rb
+.PHONY: clean clean-so clean-static clean-rb
"
- mfile.print CLEANINGS
- fsep = config_string('BUILD_FILE_SEPARATOR') {|s| s unless s == "/"}
- if fsep
- sep = ":/=#{fsep}"
- fseprepl = proc {|s|
- s = s.gsub("/", fsep)
- s = s.gsub(/(\$\(\w+)(\))/) {$1+sep+$2}
- s = s.gsub(/(\$\{\w+)(\})/) {$1+sep+$2}
- }
- rsep = ":#{fsep}=/"
- else
- fseprepl = proc {|s| s}
- sep = ""
- rsep = ""
- end
- dirs = []
- mfile.print "install: install-so install-rb\n\n"
- sodir = (dir = "$(RUBYARCHDIR)").dup
- mfile.print("install-so: ")
- if target
- f = "$(DLLIB)"
- dest = "#{dir}/#{f}"
- mfile.puts dest
- if $extout
- mfile.print "clean-so::\n"
- mfile.print "\t-$(Q)$(RM) #{fseprepl[dest]}\n"
- mfile.print "\t-$(Q)$(RMDIRS) #{fseprepl[dir]}#{$ignore_error}\n"
+ mfile.print CLEANINGS
+ fsep = config_string('BUILD_FILE_SEPARATOR') {|s| s unless s == "/"}
+ if fsep
+ sep = ":/=#{fsep}"
+ fseprepl = proc {|s|
+ s = s.gsub("/", fsep)
+ s = s.gsub(/(\$\(\w+)(\))/) {$1+sep+$2}
+ s = s.gsub(/(\$\{\w+)(\})/) {$1+sep+$2}
+ }
+ rsep = ":#{fsep}=/"
else
- mfile.print "#{dest}: #{f}\n\t-$(Q)$(MAKEDIRS) $(@D#{sep})\n"
- mfile.print "\t$(INSTALL_PROG) #{fseprepl[f]} $(@D#{sep})\n"
- if defined?($installed_list)
- mfile.print "\t@echo #{dir}/#{File.basename(f)}>>$(INSTALLED_LIST)\n"
- end
+ fseprepl = proc {|s| s}
+ sep = ""
+ rsep = ""
end
- mfile.print "clean-static::\n"
- mfile.print "\t-$(Q)$(RM) $(STATIC_LIB)\n"
- else
- mfile.puts "Makefile"
- end
- mfile.print("install-rb: pre-install-rb install-rb-default\n")
- mfile.print("install-rb-default: pre-install-rb-default\n")
- mfile.print("pre-install-rb: Makefile\n")
- mfile.print("pre-install-rb-default: Makefile\n")
- for sfx, i in [["-default", [["lib/**/*.rb", "$(RUBYLIBDIR)", "lib"]]], ["", $INSTALLFILES]]
- files = install_files(mfile, i, nil, srcprefix) or next
- for dir, *files in files
- unless dirs.include?(dir)
- dirs << dir
- mfile.print "pre-install-rb#{sfx}: #{timestamp_file(dir)}\n"
+ dirs = []
+ mfile.print "install: install-so install-rb\n\n"
+ sodir = (dir = "$(RUBYARCHDIR)").dup
+ mfile.print("install-so: ")
+ if target
+ f = "$(DLLIB)"
+ dest = "#{dir}/#{f}"
+ if $extout
+ mfile.puts dest
+ mfile.print "clean-so::\n"
+ 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, 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"
+ end
end
- for f in files
- dest = "#{dir}/#{File.basename(f)}"
- mfile.print("install-rb#{sfx}: #{dest} #{dir}\n")
- mfile.print("#{dest}: #{f}\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")
+ mfile.print "clean-static::\n"
+ mfile.print "\t-$(Q)$(RM) $(STATIC_LIB)\n"
+ else
+ mfile.puts "Makefile"
+ end
+ mfile.print("install-rb: pre-install-rb install-rb-default\n")
+ mfile.print("install-rb-default: pre-install-rb-default\n")
+ mfile.print("pre-install-rb: Makefile\n")
+ mfile.print("pre-install-rb-default: Makefile\n")
+ for sfx, i in [["-default", [["lib/**/*.rb", "$(RUBYLIBDIR)", "lib"]]], ["", $INSTALLFILES]]
+ files = install_files(mfile, i, nil, srcprefix) or next
+ for dir, *files in files
+ unless dirs.include?(dir)
+ dirs << dir
+ mfile.print "pre-install-rb#{sfx}: #{timestamp_file(dir, target_prefix)}\n"
end
- if $extout
- mfile.print("clean-rb#{sfx}::\n")
- mfile.print("\t@-$(RM) #{fseprepl[dest]}\n")
+ for f in files
+ dest = "#{dir}/#{File.basename(f)}"
+ mfile.print("install-rb#{sfx}: #{dest}\n")
+ mfile.print("#{dest}: #{f} #{timestamp_file(dir, target_prefix)}\n")
+ mfile.print("\t$(Q) $(#{$extout ? 'COPY' : 'INSTALL_DATA'}) #{f} $(@D#{sep})\n")
+ if defined?($installed_list) and !$extout
+ mfile.print("\t@echo #{dest}>>$(INSTALLED_LIST)\n")
+ end
+ if $extout
+ mfile.print("clean-rb#{sfx}::\n")
+ mfile.print("\t-$(Q)$(RM) #{fseprepl[dest]}\n")
+ end
end
end
- end
- mfile.print "pre-install-rb#{sfx}:\n"
- mfile.print("\t$(ECHO) installing#{sfx.sub(/^-/, " ")} #{target} libraries\n")
- if $extout
- dirs.uniq!
- unless dirs.empty?
- mfile.print("clean-rb#{sfx}::\n")
- for dir in dirs.sort_by {|d| -d.count('/')}
- mfile.print("\t@-$(RMDIRS) #{fseprepl[dir]}#{$ignore_error}\n")
+ mfile.print "pre-install-rb#{sfx}:\n"
+ mfile.print("\t$(ECHO) installing#{sfx.sub(/^-/, " ")} #{target} libraries\n")
+ if $extout
+ dirs.uniq!
+ unless dirs.empty?
+ mfile.print("clean-rb#{sfx}::\n")
+ for dir in dirs.sort_by {|d| -d.count('/')}
+ mfile.print("\t-$(Q)$(RMDIRS) #{fseprepl[dir]}#{$ignore_error}\n")
+ end
end
end
end
- 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"
- end
+ dirs.unshift(sodir) if target and !dirs.include?(sodir)
+ dirs.each do |d|
+ t = timestamp_file(d, target_prefix)
+ mfile.print "#{t}:\n\t$(Q) $(MAKEDIRS) $(@D) #{d}\n\t$(Q) $(TOUCH) $@\n"
+ end
- mfile.print <<-SITEINSTALL
+ mfile.print <<-SITEINSTALL
site-install: site-install-so site-install-rb
site-install-so: install-so
site-install-rb: install-rb
- SITEINSTALL
+ SITEINSTALL
- return unless target
+ return unless target
- mfile.puts SRC_EXT.collect {|e| ".path.#{e} = $(VPATH)"} if $nmake == ?b
- mfile.print ".SUFFIXES: .#{SRC_EXT.join(' .')} .#{$OBJEXT}\n"
- mfile.print "\n"
+ mfile.puts SRC_EXT.collect {|e| ".path.#{e} = $(VPATH)"} if $nmake == ?b
+ mfile.print ".SUFFIXES: .#{SRC_EXT.join(' .')} .#{$OBJEXT}\n"
+ mfile.print "\n"
- compile_command = "\n\t$(ECHO) compiling $(<#{rsep})\n\t$(Q) %s\n\n"
- CXX_EXT.each do |e|
- COMPILE_RULES.each do |rule|
- mfile.printf(rule, e, $OBJEXT)
- mfile.printf(compile_command, COMPILE_CXX)
+ compile_command = "\n\t$(ECHO) compiling $(<#{rsep})\n\t$(Q) %s\n\n"
+ CXX_EXT.each do |e|
+ each_compile_rules do |rule|
+ mfile.printf(rule, e, $OBJEXT)
+ mfile.printf(compile_command, COMPILE_CXX)
+ end
end
- end
- C_EXT.each do |e|
- COMPILE_RULES.each do |rule|
- mfile.printf(rule, e, $OBJEXT)
- mfile.printf(compile_command, COMPILE_C)
- end
- end
-
- mfile.print "$(RUBYARCHDIR)/" if $extout
- mfile.print "$(DLLIB): "
- mfile.print "$(DEFFILE) " if makedef
- mfile.print "$(OBJS) Makefile"
- mfile.print " #{timestamp_file('$(RUBYARCHDIR)')}" 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"
- link_so = LINK_SO.gsub(/^/, "\t$(Q) ")
- if srcs.any?(&%r"\.(?:#{CXX_EXT.join('|')})\z".method(:===))
- link_so = link_so.sub(/\bLDSHARED\b/, '\&XX')
- end
- mfile.print link_so, "\n\n"
- unless $static.nil?
- mfile.print "$(STATIC_LIB): $(OBJS)\n\t@-$(RM) $(@#{sep})\n\t"
- 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@-#{ranlib} $(DLLIB) 2> /dev/null || true"
- end
- end
- mfile.print "\n\n"
- if makedef
- mfile.print "$(DEFFILE): #{origdef}\n"
- mfile.print "\t$(ECHO) generating $(@#{rsep})\n"
- mfile.print "\t$(Q) $(RUBY) #{makedef} #{origdef} > $@\n\n"
- end
-
- depend = File.join(srcdir, "depend")
- if File.exist?(depend)
- mfile.print("###\n", *depend_rules(File.read(depend)))
- else
- headers = %w[$(hdrdir)/ruby.h $(hdrdir)/ruby/defines.h]
- if RULE_SUBST
- headers.each {|h| h.sub!(/.*/, &RULE_SUBST.method(:%))}
+ C_EXT.each do |e|
+ each_compile_rules do |rule|
+ mfile.printf(rule, e, $OBJEXT)
+ mfile.printf(compile_command, COMPILE_C)
+ end
end
- headers << $config_h
- headers << '$(RUBY_EXTCONF_H)' if $extconf_h
- mfile.print "$(OBJS): ", headers.join(' '), "\n"
- end
- $makefile_created = true
-ensure
- mfile.close if mfile
-end
+ mfile.print "$(RUBYARCHDIR)/" if $extout
+ mfile.print "$(DLLIB): "
+ mfile.print "$(DEFFILE) " if makedef
+ mfile.print "$(OBJS) Makefile"
+ 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"
+ link_so = LINK_SO.gsub(/^/, "\t$(Q) ")
+ if srcs.any?(&%r"\.(?:#{CXX_EXT.join('|')})\z".method(:===))
+ link_so = link_so.sub(/\bLDSHARED\b/, '\&XX')
+ end
+ mfile.print link_so, "\n\n"
+ unless $static.nil?
+ mfile.print "$(STATIC_LIB): $(OBJS)\n\t-$(Q)$(RM) $(@#{sep})\n\t"
+ 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} $(@) 2> /dev/null || true"
+ end
+ end
+ mfile.print "\n\n"
+ if makedef
+ mfile.print "$(DEFFILE): #{origdef}\n"
+ mfile.print "\t$(ECHO) generating $(@#{rsep})\n"
+ mfile.print "\t$(Q) $(RUBY) #{makedef} #{origdef} > $@\n\n"
+ end
-# :stopdoc:
+ depend = File.join(srcdir, "depend")
+ if File.exist?(depend)
+ mfile.print("###\n", *depend_rules(File.read(depend)))
+ else
+ mfile.print "$(OBJS): $(HDRS) $(ruby_headers)\n"
+ end
-def init_mkmf(config = CONFIG, rbconfig = RbConfig::CONFIG)
- $makefile_created = false
- $arg_config = []
- $enable_shared = config['ENABLE_SHARED'] == 'yes'
- $defs = []
- $extconf_h = nil
- if $warnflags = CONFIG['warnflags'] and CONFIG['GCC'] == 'yes'
- # turn warnings into errors only for bundled extensions.
- config['warnflags'] = $warnflags.gsub(/(\A|\s)-Werror[-=]/, '\1-W')
- RbConfig.expand(rbconfig['warnflags'] = config['warnflags'].dup)
- config.each do |key, val|
- RbConfig.expand(rbconfig[key] = val.dup) if /warnflags/ =~ val
- end
- $warnflags = config['warnflags'] unless $extmk
- end
- $CFLAGS = with_config("cflags", arg_config("CFLAGS", config["CFLAGS"])).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
- $INCFLAGS = "-I$(arch_hdrdir)"
- $INCFLAGS << " -I$(hdrdir)/ruby/backward" unless $extmk
- $INCFLAGS << " -I$(hdrdir) -I$(srcdir)"
- $DLDFLAGS = with_config("dldflags", arg_config("DLDFLAGS", config["DLDFLAGS"])).dup
- $LIBEXT = config['LIBEXT'].dup
- $OBJEXT = config["OBJEXT"].dup
- $LIBS = "#{config['LIBS']} #{config['DLDLIBS']}"
- $LIBRUBYARG = ""
- $LIBRUBYARG_STATIC = config['LIBRUBYARG_STATIC']
- $LIBRUBYARG_SHARED = config['LIBRUBYARG_SHARED']
- $DEFLIBPATH = [$extmk ? "$(topdir)" : "$(libdir)"]
- $DEFLIBPATH.unshift(".")
- $LIBPATH = []
- $INSTALLFILES = []
- $NONINSTALLFILES = [/~\z/, /\A#.*#\z/, /\A\.#/, /\.bak\z/i, /\.orig\z/, /\.rej\z/, /\.l[ao]\z/, /\.o\z/]
- $VPATH = %w[$(srcdir) $(arch_hdrdir)/ruby $(hdrdir)/ruby]
-
- $objs = nil
- $srcs = nil
- $libs = ""
- if $enable_shared or RbConfig.expand(config["LIBRUBY"].dup) != RbConfig.expand(config["LIBRUBY_A"].dup)
- $LIBRUBYARG = config['LIBRUBYARG']
- end
-
- $LOCAL_LIBS = ""
-
- $cleanfiles = config_string('CLEANFILES') {|s| Shellwords.shellwords(s)} || []
- $cleanfiles << "mkmf.log"
- $distcleanfiles = config_string('DISTCLEANFILES') {|s| Shellwords.shellwords(s)} || []
- $distcleandirs = config_string('DISTCLEANDIRS') {|s| Shellwords.shellwords(s)} || []
-
- $extout ||= nil
- $extout_prefix ||= nil
-
- @libdir_basename = config["libdir"] && config["libdir"][/\A\$\(exec_prefix\)\/(.*)/, 1] or "lib"
-
- $arg_config.clear
- dir_config("opt")
-end
+ $makefile_created = true
+ ensure
+ mfile.close if mfile
+ end
+
+ # :stopdoc:
+
+ def init_mkmf(config = CONFIG, rbconfig = RbConfig::CONFIG)
+ $makefile_created = false
+ $arg_config = []
+ $enable_shared = config['ENABLE_SHARED'] == 'yes'
+ $defs = []
+ $extconf_h = nil
+ if $warnflags = CONFIG['warnflags'] and CONFIG['GCC'] == 'yes'
+ # turn warnings into errors only for bundled extensions.
+ config['warnflags'] = $warnflags.gsub(/(\A|\s)-Werror[-=]/, '\1-W')
+ RbConfig.expand(rbconfig['warnflags'] = config['warnflags'].dup)
+ config.each do |key, val|
+ RbConfig.expand(rbconfig[key] = val.dup) if /warnflags/ =~ val
+ end
+ $warnflags = config['warnflags'] unless $extmk
+ end
+ $CFLAGS = with_config("cflags", arg_config("CFLAGS", config["CFLAGS"])).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
+ $INCFLAGS = "-I$(arch_hdrdir)"
+ $INCFLAGS << " -I$(hdrdir)/ruby/backward" unless $extmk
+ $INCFLAGS << " -I$(hdrdir) -I$(srcdir)"
+ $DLDFLAGS = with_config("dldflags", arg_config("DLDFLAGS", config["DLDFLAGS"])).dup
+ $LIBEXT = config['LIBEXT'].dup
+ $OBJEXT = config["OBJEXT"].dup
+ $EXEEXT = config["EXEEXT"].dup
+ $LIBS = "#{config['LIBS']} #{config['DLDLIBS']}"
+ $LIBRUBYARG = ""
+ $LIBRUBYARG_STATIC = config['LIBRUBYARG_STATIC']
+ $LIBRUBYARG_SHARED = config['LIBRUBYARG_SHARED']
+ $DEFLIBPATH = [$extmk ? "$(topdir)" : "$(#{config["libdirname"] || "libdir"})"]
+ $DEFLIBPATH.unshift(".")
+ $LIBPATH = []
+ $INSTALLFILES = []
+ $NONINSTALLFILES = [/~\z/, /\A#.*#\z/, /\A\.#/, /\.bak\z/i, /\.orig\z/, /\.rej\z/, /\.l[ao]\z/, /\.o\z/]
+ $VPATH = %w[$(srcdir) $(arch_hdrdir)/ruby $(hdrdir)/ruby]
+
+ $objs = nil
+ $srcs = nil
+ $libs = ""
+ if $enable_shared or RbConfig.expand(config["LIBRUBY"].dup) != RbConfig.expand(config["LIBRUBY_A"].dup)
+ $LIBRUBYARG = config['LIBRUBYARG']
+ end
+
+ $LOCAL_LIBS = ""
+
+ $cleanfiles = config_string('CLEANFILES') {|s| Shellwords.shellwords(s)} || []
+ $cleanfiles << "mkmf.log"
+ $distcleanfiles = config_string('DISTCLEANFILES') {|s| Shellwords.shellwords(s)} || []
+ $distcleandirs = config_string('DISTCLEANDIRS') {|s| Shellwords.shellwords(s)} || []
+
+ $extout ||= nil
+ $extout_prefix ||= nil
-FailedMessage = <<MESSAGE
-Could not create Makefile due to some reason, probably lack of
-necessary libraries and/or headers. Check the mkmf.log file for more
-details. You may need configuration options.
+ $arg_config.clear
+ dir_config("opt")
+ end
+
+ FailedMessage = <<MESSAGE
+Could not create Makefile due to some reason, probably lack of necessary
+libraries and/or headers. Check the mkmf.log file for more details. You may
+need configuration options.
Provided configuration options:
MESSAGE
-# Returns whether or not the Makefile was successfully generated. If not,
-# the script will abort with an error message.
-#
-# Internal use only.
-#
-def mkmf_failed(path)
- unless $makefile_created or File.exist?("Makefile")
- opts = $arg_config.collect {|t, n| "\t#{t}#{n ? "=#{n}" : ""}\n"}
- abort "*** #{path} failed ***\n" + FailedMessage + opts.join
+ # Returns whether or not the Makefile was successfully generated. If not,
+ # the script will abort with an error message.
+ #
+ # Internal use only.
+ #
+ def mkmf_failed(path)
+ unless $makefile_created or File.exist?("Makefile")
+ opts = $arg_config.collect {|t, n| "\t#{t}#{n ? "=#{n}" : ""}\n"}
+ abort "*** #{path} failed ***\n" + FailedMessage + opts.join
+ end
end
-end
-def MAIN_DOES_NOTHING(*refs)
- src = MAIN_DOES_NOTHING
- unless refs.empty?
- src = src.sub(/\{/) do
- $& +
- "\n if (argc > 1000000) {\n" +
- refs.map {|n|" printf(\"%p\", &#{n});\n"}.join("") +
- " }\n"
+ 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?
+ src = src.sub(/\{/) do
+ $& +
+ "\n if (argc > 1000000) {\n" +
+ refs.map {|n|" printf(\"%p\", &#{n});\n"}.join("") +
+ " }\n"
+ end
end
+ src
end
- src
-end
-# :startdoc:
+ extend self
+ init_mkmf
-init_mkmf
+ $make = with_config("make-prog", ENV["MAKE"] || "make")
+ make, = Shellwords.shellwords($make)
+ $nmake = nil
+ case
+ when $mswin
+ $nmake = ?m if /nmake/i =~ make
+ when $bccwin
+ $nmake = ?b if /Borland/i =~ `#{make} -h`
+ end
+ $ignore_error = $nmake ? '' : ' 2> /dev/null || true'
-$make = with_config("make-prog", ENV["MAKE"] || "make")
-make, = Shellwords.shellwords($make)
-$nmake = nil
-case
-when $mswin
- $nmake = ?m if /nmake/i =~ make
-when $bccwin
- $nmake = ?b if /Borland/i =~ `#{make} -h`
-end
-$ignore_error = $nmake ? '' : ' 2> /dev/null || true'
-
-RbConfig::CONFIG["srcdir"] = CONFIG["srcdir"] =
- $srcdir = arg_config("--srcdir", File.dirname($0))
-$configure_args["--topsrcdir"] ||= $srcdir
-if $curdir = arg_config("--curdir")
- RbConfig.expand(curdir = $curdir.dup)
-else
- curdir = $curdir = "."
-end
-unless File.expand_path(RbConfig::CONFIG["topdir"]) == File.expand_path(curdir)
- CONFIG["topdir"] = $curdir
- RbConfig::CONFIG["topdir"] = curdir
-end
-$configure_args["--topdir"] ||= $curdir
-$ruby = arg_config("--ruby", File.join(RbConfig::CONFIG["bindir"], CONFIG["ruby_install_name"]))
+ RbConfig::CONFIG["srcdir"] = CONFIG["srcdir"] =
+ $srcdir = arg_config("--srcdir", File.dirname($0))
+ $configure_args["--topsrcdir"] ||= $srcdir
+ if $curdir = arg_config("--curdir")
+ RbConfig.expand(curdir = $curdir.dup)
+ else
+ curdir = $curdir = "."
+ end
+ unless File.expand_path(RbConfig::CONFIG["topdir"]) == File.expand_path(curdir)
+ CONFIG["topdir"] = $curdir
+ RbConfig::CONFIG["topdir"] = curdir
+ end
+ $configure_args["--topdir"] ||= $curdir
+ $ruby = arg_config("--ruby", File.join(RbConfig::CONFIG["bindir"], CONFIG["ruby_install_name"]))
+
+ # :startdoc:
-split = Shellwords.method(:shellwords).to_proc
+ split = Shellwords.method(:shellwords).to_proc
-EXPORT_PREFIX = config_string('EXPORT_PREFIX') {|s| s.strip}
+ EXPORT_PREFIX = config_string('EXPORT_PREFIX') {|s| s.strip}
-hdr = ['#include "ruby.h"' "\n"]
-config_string('COMMON_MACROS') do |s|
- Shellwords.shellwords(s).each do |w|
- w, v = w.split(/=/, 2)
- hdr << "#ifndef #{w}"
- hdr << "#define #{[w, v].compact.join(" ")}"
- hdr << "#endif /* #{w} */"
+ hdr = ['#include "ruby.h"' "\n"]
+ config_string('COMMON_MACROS') do |s|
+ Shellwords.shellwords(s).each do |w|
+ w, v = w.split(/=/, 2)
+ hdr << "#ifndef #{w}"
+ hdr << "#define #{[w, v].compact.join(" ")}"
+ hdr << "#endif /* #{w} */"
+ end
end
-end
-config_string('COMMON_HEADERS') do |s|
- Shellwords.shellwords(s).each {|w| hdr << "#include <#{w}>"}
-end
-COMMON_HEADERS = hdr.join("\n")
-COMMON_LIBS = config_string('COMMON_LIBS', &split) || []
-
-COMPILE_RULES = config_string('COMPILE_RULES', &split) || %w[.%s.%s:]
-RULE_SUBST = config_string('RULE_SUBST')
-COMPILE_C = config_string('COMPILE_C') || '$(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) $(COUTFLAG)$@ -c $<'
-COMPILE_CXX = config_string('COMPILE_CXX') || '$(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $<'
-TRY_LINK = config_string('TRY_LINK') ||
- "$(CC) #{OUTFLAG}conftest $(INCFLAGS) $(CPPFLAGS) " \
- "$(CFLAGS) $(src) $(LIBPATH) $(LDFLAGS) $(ARCH_FLAG) $(LOCAL_LIBS) $(LIBS)"
-LINK_SO = config_string('LINK_SO') ||
- if CONFIG["DLEXT"] == $OBJEXT
- "ld $(DLDFLAGS) -r -o $@ $(OBJS)\n"
- else
- "$(LDSHARED) #{OUTFLAG}$@ $(OBJS) " \
- "$(LIBPATH) $(DLDFLAGS) $(LOCAL_LIBS) $(LIBS)"
- end
-LIBPATHFLAG = config_string('LIBPATHFLAG') || ' -L"%s"'
-RPATHFLAG = config_string('RPATHFLAG') || ''
-LIBARG = config_string('LIBARG') || '-l%s'
-MAIN_DOES_NOTHING = config_string('MAIN_DOES_NOTHING') || "int main(int argc, char **argv)\n{\n return 0;\n}"
-UNIVERSAL_INTS = config_string('UNIVERSAL_INTS') {|s| Shellwords.shellwords(s)} ||
- %w[int short long long\ long]
-
-sep = config_string('BUILD_FILE_SEPARATOR') {|s| ":/=#{s}" if s != "/"} || ""
-CLEANINGS = "
+ config_string('COMMON_HEADERS') do |s|
+ Shellwords.shellwords(s).each {|w| hdr << "#include <#{w}>"}
+ end
+
+ ##
+ # Common headers for Ruby C extensions
+
+ COMMON_HEADERS = hdr.join("\n")
+
+ ##
+ # Common libraries for Ruby C extensions
+
+ COMMON_LIBS = config_string('COMMON_LIBS', &split) || []
+
+ ##
+ # make compile rules
+
+ COMPILE_RULES = config_string('COMPILE_RULES', &split) || %w[.%s.%s:]
+ RULE_SUBST = config_string('RULE_SUBST')
+
+ ##
+ # Command which will compile C files in the generated Makefile
+
+ COMPILE_C = config_string('COMPILE_C') || '$(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) $(COUTFLAG)$@ -c $<'
+
+ ##
+ # Command which will compile C++ files in the generated Makefile
+
+ COMPILE_CXX = config_string('COMPILE_CXX') || '$(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $<'
+
+ ##
+ # 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) " \
+ "$(CFLAGS) $(src) $(LIBPATH) $(LDFLAGS) $(ARCH_FLAG) $(LOCAL_LIBS) $(LIBS)"
+
+ ##
+ # Command which will link a shared library
+
+ LINK_SO = (config_string('LINK_SO') || "").sub(/^$/) do
+ if CONFIG["DLEXT"] == $OBJEXT
+ "ld $(DLDFLAGS) -r -o $@ $(OBJS)\n"
+ else
+ "$(LDSHARED) #{OUTFLAG}$@ $(OBJS) " \
+ "$(LIBPATH) $(DLDFLAGS) $(LOCAL_LIBS) $(LIBS)"
+ end
+ end
+
+ ##
+ # Argument which will add a library path to the linker
+
+ LIBPATHFLAG = config_string('LIBPATHFLAG') || ' -L%s'
+ RPATHFLAG = config_string('RPATHFLAG') || ''
+
+ ##
+ # Argument which will add a library to the linker
+
+ LIBARG = config_string('LIBARG') || '-l%s'
+
+ ##
+ # A C main function which does no work
+
+ MAIN_DOES_NOTHING = config_string('MAIN_DOES_NOTHING') || "int main(int argc, char **argv)\n{\n return 0;\n}"
+ UNIVERSAL_INTS = config_string('UNIVERSAL_INTS') {|s| Shellwords.shellwords(s)} ||
+ %w[int short long long\ long]
+
+ sep = config_string('BUILD_FILE_SEPARATOR') {|s| ":/=#{s}" if s != "/"} || ""
+
+ ##
+ # Makefile rules that will clean the extension build directory
+
+ CLEANINGS = "
clean-static::
clean-rb-default::
clean-rb::
@@ -2321,13 +2605,17 @@ clean: clean-so clean-static clean-rb-default clean-rb
distclean-rb-default::
distclean-rb::
distclean-so::
-distclean: clean distclean-so distclean-rb-default distclean-rb
-\t\t@-$(RM) Makefile $(RUBY_EXTCONF_H) conftest.* mkmf.log
-\t\t@-$(RM) core ruby$(EXEEXT) *~ $(DISTCLEANFILES#{sep})
-\t\t@-$(RMDIRS) $(DISTCLEANDIRS#{sep})#{$ignore_error}
+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) core ruby$(EXEEXT) *~ $(DISTCLEANFILES#{sep})
+\t\t-$(Q)$(RMDIRS) $(DISTCLEANDIRS#{sep})#{$ignore_error}
realclean: distclean
"
+end
+
+include MakeMakefile
if not $extmk and /\A(extconf|makefile).rb\z/ =~ File.basename($0)
END {mkmf_failed($0)}
diff --git a/lib/monitor.rb b/lib/monitor.rb
index 9e26ec1de1..07394b5900 100644
--- a/lib/monitor.rb
+++ b/lib/monitor.rb
@@ -107,7 +107,7 @@ module MonitorMixin
@monitor.__send__(:mon_check_owner)
count = @monitor.__send__(:mon_exit_for_cond)
begin
- @cond.wait(@monitor.instance_variable_get("@mon_mutex"), timeout)
+ @cond.wait(@monitor.instance_variable_get(:@mon_mutex), timeout)
return true
ensure
@monitor.__send__(:mon_enter_for_cond, count)
diff --git a/lib/mutex_m.rb b/lib/mutex_m.rb
index 722754b8d5..6698cb5ac6 100644
--- a/lib/mutex_m.rb
+++ b/lib/mutex_m.rb
@@ -8,25 +8,36 @@
# patched by akira yamada
#
# --
-# Usage:
-# require "mutex_m.rb"
-# obj = Object.new
-# obj.extend Mutex_m
-# ...
-# extended object can be handled like Mutex
-# or
-# class Foo
-# include Mutex_m
-# ...
-# end
-# obj = Foo.new
-# this obj can be handled like Mutex
-#
+
require 'thread'
+# = mutex_m.rb
+#
+# When 'mutex_m' is required, any object that extends or includes Mutex_m will
+# be treated like a Mutex.
+#
+# Start by requiring the standard library Mutex_m:
+#
+# require "mutex_m.rb"
+#
+# From here you can extend an object with Mutex instance methods:
+#
+# obj = Object.new
+# obj.extend Mutex_m
+#
+# Or mixin Mutex_m into your module to your class inherit Mutex instance
+# methods.
+#
+# class Foo
+# include Mutex_m
+# # ...
+# end
+# obj = Foo.new
+# # this obj can be handled like Mutex
+#
module Mutex_m
- def Mutex_m.define_aliases(cl)
+ def Mutex_m.define_aliases(cl) # :nodoc:
cl.module_eval %q{
alias locked? mu_locked?
alias lock mu_lock
@@ -36,17 +47,17 @@ module Mutex_m
}
end
- def Mutex_m.append_features(cl)
+ def Mutex_m.append_features(cl) # :nodoc:
super
define_aliases(cl) unless cl.instance_of?(Module)
end
- def Mutex_m.extend_object(obj)
+ def Mutex_m.extend_object(obj) # :nodoc:
super
obj.mu_extended
end
- def mu_extended
+ def mu_extended # :nodoc:
unless (defined? locked? and
defined? lock and
defined? unlock and
@@ -57,38 +68,43 @@ module Mutex_m
mu_initialize
end
- # locking
+ # See Mutex#synchronize
def mu_synchronize(&block)
@_mutex.synchronize(&block)
end
+ # See Mutex#locked?
def mu_locked?
@_mutex.locked?
end
+ # See Mutex#try_lock
def mu_try_lock
@_mutex.try_lock
end
+ # See Mutex#lock
def mu_lock
@_mutex.lock
end
+ # See Mutex#unlock
def mu_unlock
@_mutex.unlock
end
+ # See Mutex#sleep
def sleep(timeout = nil)
@_mutex.sleep(timeout)
end
private
- def mu_initialize
+ def mu_initialize # :nodoc:
@_mutex = Mutex.new
end
- def initialize(*args)
+ def initialize(*args) # :nodoc:
mu_initialize
super
end
diff --git a/lib/net/.document b/lib/net/.document
deleted file mode 100644
index 6332bb9e7e..0000000000
--- a/lib/net/.document
+++ /dev/null
@@ -1,8 +0,0 @@
-ftp.rb
-http.rb
-https.rb
-imap.rb
-pop.rb
-smtp.rb
-smtps.rb
-telnet.rb
diff --git a/lib/net/ftp.rb b/lib/net/ftp.rb
index 149fc6adc1..c22b9636d5 100644
--- a/lib/net/ftp.rb
+++ b/lib/net/ftp.rb
@@ -16,6 +16,7 @@
require "socket"
require "monitor"
+require "net/protocol"
module Net
@@ -40,7 +41,7 @@ module Net
#
# === Example 1
#
- # ftp = Net::FTP.new('ftp.netlab.co.jp')
+ # ftp = Net::FTP.new('example.com')
# ftp.login
# files = ftp.chdir('pub/lang/ruby/contrib')
# files = ftp.list('n*')
@@ -49,7 +50,7 @@ module Net
#
# === Example 2
#
- # Net::FTP.open('ftp.netlab.co.jp') do |ftp|
+ # Net::FTP.open('example.com') do |ftp|
# ftp.login
# files = ftp.chdir('pub/lang/ruby/contrib')
# files = ftp.list('n*')
@@ -76,7 +77,7 @@ module Net
# :stopdoc:
FTP_PORT = 21
CRLF = "\r\n"
- DEFAULT_BLOCKSIZE = 4096
+ DEFAULT_BLOCKSIZE = BufferedIO::BUFSIZE
# :startdoc:
# When +true+, transfers are performed in binary mode. Default: +true+.
@@ -93,6 +94,24 @@ module Net
# transfers are resumed or restarted. Default: +false+.
attr_accessor :resume
+ # Number of seconds to wait for the connection to open. Any number
+ # may be used, including Floats for fractional seconds. If the FTP
+ # object cannot open a connection in this many seconds, it raises a
+ # Net::OpenTimeout exception. The default value is +nil+.
+ attr_accessor :open_timeout
+
+ # Number of seconds to wait for one block to be read (via one read(2)
+ # call). Any number may be used, including Floats for fractional
+ # seconds. If the FTP object cannot read data in this many seconds,
+ # it raises a TimeoutError exception. The default value is 60 seconds.
+ attr_reader :read_timeout
+
+ # Setter for the read_timeout attribute.
+ def read_timeout=(sec)
+ @sock.read_timeout = sec
+ @read_timeout = sec
+ end
+
# The server's welcome message.
attr_reader :welcome
@@ -135,6 +154,8 @@ module Net
@resume = false
@sock = NullSocket.new
@logged_in = false
+ @open_timeout = nil
+ @read_timeout = 60
if host
connect(host)
if user
@@ -193,18 +214,23 @@ 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
# returned.
def open_socket(host, port) # :nodoc:
- if defined? SOCKSSocket and ENV["SOCKS_SERVER"]
- @passive = true
- return SOCKSSocket.open(host, port)
- else
- return TCPSocket.open(host, port)
- end
+ return Timeout.timeout(@open_timeout, Net::OpenTimeout) {
+ if defined? SOCKSSocket and ENV["SOCKS_SERVER"]
+ @passive = true
+ sock = SOCKSSocket.open(host, port)
+ else
+ sock = TCPSocket.open(host, port)
+ end
+ io = BufferedSocket.new(sock)
+ io.read_timeout = @read_timeout
+ io
+ }
end
private :open_socket
@@ -225,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
@@ -284,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
@@ -304,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.
@@ -405,7 +432,10 @@ module Net
if resp[0] != ?1
raise FTPReplyError, resp
end
- conn = sock.accept
+ 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
@@ -454,13 +484,19 @@ module Net
def retrbinary(cmd, blocksize, rest_offset = nil) # :yield: data
synchronize do
with_binary(true) do
- conn = transfercmd(cmd, rest_offset)
- loop do
- data = conn.read(blocksize)
- break if data == nil
- yield(data)
+ begin
+ conn = transfercmd(cmd, rest_offset)
+ loop do
+ data = conn.read(blocksize)
+ break if data == nil
+ yield(data)
+ end
+ conn.shutdown(Socket::SHUT_WR)
+ conn.read_timeout = 1
+ conn.read
+ ensure
+ conn.close if conn
end
- conn.close
voidresp
end
end
@@ -475,13 +511,19 @@ module Net
def retrlines(cmd) # :yield: line
synchronize do
with_binary(false) do
- conn = transfercmd(cmd)
- loop do
- line = conn.gets
- break if line == nil
- yield(line.sub(/\r?\n\z/, ""), !line.match(/\n\z/).nil?)
+ begin
+ conn = transfercmd(cmd)
+ loop do
+ line = conn.gets
+ break if line == nil
+ yield(line.sub(/\r?\n\z/, ""), !line.match(/\n\z/).nil?)
+ end
+ conn.shutdown(Socket::SHUT_WR)
+ conn.read_timeout = 1
+ conn.read
+ ensure
+ conn.close if conn
end
- conn.close
voidresp
end
end
@@ -493,7 +535,7 @@ module Net
# +file+ to the server. If the optional block is given, it also passes it
# the data, in chunks of +blocksize+ characters.
#
- def storbinary(cmd, file, blocksize, rest_offset = nil, &block) # :yield: data
+ def storbinary(cmd, file, blocksize, rest_offset = nil) # :yield: data
if rest_offset
file.seek(rest_offset, IO::SEEK_SET)
end
@@ -504,7 +546,7 @@ module Net
buf = file.read(blocksize)
break if buf == nil
conn.write(buf)
- yield(buf) if block
+ yield(buf) if block_given?
end
conn.close
voidresp
@@ -525,7 +567,7 @@ module Net
# named +file+ to the server, one line at a time. If the optional block is
# given, it also passes it the lines.
#
- def storlines(cmd, file, &block) # :yield: line
+ def storlines(cmd, file) # :yield: line
synchronize do
with_binary(false) do
conn = transfercmd(cmd)
@@ -536,7 +578,7 @@ module Net
buf = buf.chomp + CRLF
end
conn.write(buf)
- yield(buf) if block
+ yield(buf) if block_given?
end
conn.close
voidresp
@@ -856,7 +898,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)
@@ -905,7 +950,16 @@ module Net
# a new connection with #connect.
#
def close
- @sock.close if @sock and not @sock.closed?
+ if @sock and not @sock.closed?
+ begin
+ @sock.shutdown(Socket::SHUT_WR) rescue nil
+ orig, self.read_timeout = self.read_timeout, 3
+ @sock.read rescue nil
+ ensure
+ @sock.close
+ self.read_timeout = orig
+ end
+ end
end
#
@@ -923,18 +977,11 @@ module Net
if resp[0, 3] != "227"
raise FTPReplyError, resp
end
- left = resp.index("(")
- right = resp.index(")")
- if left == nil or right == nil
- raise FTPProtoError, resp
- end
- numbers = resp[left + 1 .. right - 1].split(",")
- if numbers.length != 6
+ if m = /\((?<host>\d+(,\d+){3}),(?<port>\d+,\d+)\)/.match(resp)
+ return parse_pasv_ipv4_host(m["host"]), parse_pasv_port(m["port"])
+ else
raise FTPProtoError, resp
end
- host = numbers[0, 4].join(".")
- port = (numbers[4].to_i << 8) + numbers[5].to_i
- return host, port
end
private :parse227
@@ -946,34 +993,35 @@ module Net
if resp[0, 3] != "228"
raise FTPReplyError, resp
end
- left = resp.index("(")
- right = resp.index(")")
- if left == nil or right == nil
+ if m = /\(4,4,(?<host>\d+(,\d+){3}),2,(?<port>\d+,\d+)\)/.match(resp)
+ return parse_pasv_ipv4_host(m["host"]), parse_pasv_port(m["port"])
+ elsif m = /\(6,16,(?<host>\d+(,(\d+)){15}),2,(?<port>\d+,\d+)\)/.match(resp)
+ return parse_pasv_ipv6_host(m["host"]), parse_pasv_port(m["port"])
+ else
raise FTPProtoError, resp
end
- numbers = resp[left + 1 .. right - 1].split(",")
- if numbers[0] == "4"
- if numbers.length != 9 || numbers[1] != "4" || numbers[2 + 4] != "2"
- raise FTPProtoError, resp
- end
- host = numbers[2, 4].join(".")
- port = (numbers[7].to_i << 8) + numbers[8].to_i
- elsif numbers[0] == "6"
- if numbers.length != 21 || numbers[1] != "16" || numbers[2 + 16] != "2"
- raise FTPProtoError, resp
- end
- v6 = ["", "", "", "", "", "", "", ""]
- for i in 0 .. 7
- v6[i] = sprintf("%02x%02x", numbers[(i * 2) + 2].to_i,
- numbers[(i * 2) + 3].to_i)
- end
- host = v6[0, 8].join(":")
- port = (numbers[19].to_i << 8) + numbers[20].to_i
- end
- return host, port
end
private :parse228
+ def parse_pasv_ipv4_host(s)
+ return s.tr(",", ".")
+ end
+ private :parse_pasv_ipv4_host
+
+ def parse_pasv_ipv6_host(s)
+ return s.split(/,/).map { |i|
+ "%02x" % i.to_i
+ }.each_slice(2).map(&:join).join(":")
+ end
+ private :parse_pasv_ipv6_host
+
+ def parse_pasv_port(s)
+ return s.split(/,/).map(&:to_i).inject { |x, y|
+ (x << 8) + y
+ }
+ end
+ private :parse_pasv_port
+
# handler for response code 229
# (Extended Passive Mode Entered)
#
@@ -982,18 +1030,11 @@ module Net
if resp[0, 3] != "229"
raise FTPReplyError, resp
end
- left = resp.index("(")
- right = resp.index(")")
- if left == nil or right == nil
- raise FTPProtoError, resp
- end
- numbers = resp[left + 1 .. right - 1].split(resp[left + 1, 1])
- if numbers.length != 4
+ if m = /\((?<d>[!-~])\k<d>\k<d>(?<port>\d+)\k<d>\)/.match(resp)
+ return @sock.peeraddr[3], m["port"].to_i
+ else
raise FTPProtoError, resp
end
- port = numbers[3].to_i
- host = (@sock.peeraddr())[3]
- return host, port
end
private :parse229
@@ -1028,10 +1069,48 @@ module Net
# :stopdoc:
class NullSocket
+ def read_timeout=(sec)
+ end
+
+ def close
+ end
+
def method_missing(mid, *args)
raise FTPConnectionError, "not connected"
end
end
+
+ class BufferedSocket < BufferedIO
+ [:addr, :peeraddr, :send, :shutdown].each do |method|
+ define_method(method) { |*args|
+ @io.__send__(method, *args)
+ }
+ end
+
+ def read(len = nil)
+ if len
+ s = super(len, "", true)
+ return s.empty? ? nil : s
+ else
+ result = ""
+ while s = super(DEFAULT_BLOCKSIZE, "", true)
+ break if s.empty?
+ result << s
+ end
+ return result
+ end
+ end
+
+ def gets
+ return readuntil("\n")
+ rescue EOFError
+ return nil
+ end
+
+ def readline
+ return readuntil("\n")
+ end
+ end
# :startdoc:
end
end
@@ -1039,5 +1118,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 9e4fe6a120..44c123b0e3 100644
--- a/lib/net/http.rb
+++ b/lib/net/http.rb
@@ -21,9 +21,9 @@
require 'net/protocol'
require 'uri'
-autoload :OpenSSL, 'openssl'
module Net #:nodoc:
+ autoload :OpenSSL, 'openssl'
# :stopdoc:
class HTTPBadResponse < StandardError; end
@@ -93,7 +93,7 @@ module Net #:nodoc:
# uri = URI('http://example.com/some_path?query=string')
#
# Net::HTTP.start(uri.host, uri.port) do |http|
- # request = Net::HTTP::Get.new uri.request_uri
+ # request = Net::HTTP::Get.new uri
#
# response = http.request request # Net::HTTPResponse object
# end
@@ -111,6 +111,10 @@ module Net #:nodoc:
# will automatically open a connection to the server if one is not currently
# open. You can manually close the connection with #finish.
#
+ # For all the Net::HTTP request objects and shortcut request methods you may
+ # supply either a String for the request path or a URI from which Net::HTTP
+ # will extract the request path.
+ #
# === Response Data
#
# uri = URI('http://example.com/index.html')
@@ -168,7 +172,7 @@ module Net #:nodoc:
# creates a urlencoded POST body:
#
# uri = URI('http://www.example.com/todo.cgi')
- # req = Net::HTTP::Post.new(uri.path)
+ # req = Net::HTTP::Post.new(uri)
# req.set_form_data('from' => '2005-01-01', 'to' => '2005-03-31')
#
# res = Net::HTTP.start(uri.hostname, uri.port) do |http|
@@ -186,7 +190,7 @@ module Net #:nodoc:
# multipart/form-data use Net::HTTPRequest#body= and
# Net::HTTPRequest#content_type=:
#
- # req = Net::HTTP::Post.new(uri.path)
+ # req = Net::HTTP::Post.new(uri)
# req.body = multipart_data
# req.content_type = 'multipart/form-data'
#
@@ -203,7 +207,7 @@ module Net #:nodoc:
# uri = URI('http://example.com/cached_response')
# file = File.stat 'cached_response'
#
- # req = Net::HTTP::Get.new(uri.request_uri)
+ # req = Net::HTTP::Get.new(uri)
# req['If-Modified-Since'] = file.mtime.rfc2822
#
# res = Net::HTTP.start(uri.hostname, uri.port) {|http|
@@ -221,7 +225,7 @@ module Net #:nodoc:
#
# uri = URI('http://example.com/index.html?key=value')
#
- # req = Net::HTTP::Get.new(uri.request_uri)
+ # req = Net::HTTP::Get.new(uri)
# req.basic_auth 'user', 'pass'
#
# res = Net::HTTP.start(uri.hostname, uri.port) {|http|
@@ -238,7 +242,7 @@ module Net #:nodoc:
# uri = URI('http://example.com/large_file')
#
# Net::HTTP.start(uri.host, uri.port) do |http|
- # request = Net::HTTP::Get.new uri.request_uri
+ # request = Net::HTTP::Get.new uri
#
# http.request request do |response|
# open 'large_file', 'w' do |io|
@@ -256,33 +260,41 @@ module Net #:nodoc:
# uri = URI('https://secure.example.com/some_path?query=string')
#
# Net::HTTP.start(uri.host, uri.port,
- # :use_ssl => uri.scheme == 'https').start do |http|
- # request = Net::HTTP::Get.new uri.request_uri
+ # :use_ssl => uri.scheme == 'https') do |http|
+ # request = Net::HTTP::Get.new uri
#
# 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
#
- # Net::HTTP::Proxy has the same methods as Net::HTTP but its instances always
- # connect via the proxy instead of directly to the given host.
+ # Net::HTTP will automatically create a proxy from the +http_proxy+
+ # environment variable if it is present. To disable use of +http_proxy+,
+ # pass +nil+ for the proxy address.
+ #
+ # You may also create a custom proxy:
#
# proxy_addr = 'your.proxy.host'
# proxy_port = 8080
#
- # Net::HTTP::Proxy(proxy_addr, proxy_port).start('www.example.com') {|http|
- # # always connect to your.proxy.addr:8080
+ # Net::HTTP.new('example.com', nil, proxy_addr, proxy_port).start { |http|
+ # # always proxy via your.proxy.addr:8080
# }
#
- # Net::HTTP::Proxy returns a Net::HTTP instance when proxy_addr is nil so
- # there is no need for conditional code.
- #
- # See Net::HTTP::Proxy for further details and examples such as proxies that
+ # See Net::HTTP.new for further details and examples such as proxies that
# require a username and password.
#
+ # === Compression
+ #
+ # Net::HTTP automatically adds Accept-Encoding for compression of response
+ # bodies and automatically decompresses gzip and deflate responses unless a
+ # Range header was sent.
+ #
+ # Compression can be disabled through the Accept-Encoding: identity header.
+ #
# == HTTP Request Classes
#
# Here is the HTTP request class hierarchy.
@@ -291,6 +303,7 @@ module Net #:nodoc:
# * Net::HTTP::Get
# * Net::HTTP::Head
# * Net::HTTP::Post
+ # * Net::HTTP::Patch
# * Net::HTTP::Put
# * Net::HTTP::Proppatch
# * Net::HTTP::Lock
@@ -320,8 +333,9 @@ module Net #:nodoc:
# HTTPNoContent:: 204
# HTTPResetContent:: 205
# HTTPPartialContent:: 206
+ # HTTPMultiStatus:: 207
# HTTPRedirection:: 3xx
- # HTTPMultipleChoice:: 300
+ # HTTPMultipleChoices:: 300
# HTTPMovedPermanently:: 301
# HTTPFound:: 302
# HTTPSeeOther:: 303
@@ -347,6 +361,13 @@ module Net #:nodoc:
# HTTPUnsupportedMediaType:: 415
# HTTPRequestedRangeNotSatisfiable:: 416
# HTTPExpectationFailed:: 417
+ # HTTPUnprocessableEntity:: 422
+ # HTTPLocked:: 423
+ # HTTPFailedDependency:: 424
+ # HTTPUpgradeRequired:: 426
+ # HTTPPreconditionRequired:: 428
+ # HTTPTooManyRequests:: 429
+ # HTTPRequestHeaderFieldsTooLarge:: 431
# HTTPServerError:: 5xx
# HTTPInternalServerError:: 500
# HTTPNotImplemented:: 501
@@ -354,6 +375,8 @@ module Net #:nodoc:
# HTTPServiceUnavailable:: 503
# HTTPGatewayTimeOut:: 504
# HTTPVersionNotSupported:: 505
+ # HTTPInsufficientStorage:: 507
+ # HTTPNetworkAuthenticationRequired:: 511
#
# There is also the Net::HTTPBadResponse exception which is raised when
# there is a protocol error.
@@ -372,8 +395,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
@@ -451,8 +474,9 @@ module Net #:nodoc:
}
else
uri = uri_or_host
- new(uri.hostname, uri.port).start {|http|
- return http.request_get(uri.request_uri, &block)
+ start(uri.hostname, uri.port,
+ :use_ssl => uri.scheme == 'https') {|http|
+ return http.request_get(uri, &block)
}
end
end
@@ -472,14 +496,15 @@ module Net #:nodoc:
# require 'net/http'
# require 'uri'
#
- # HTTP.post_form URI('http://www.example.com/search.cgi'),
- # { "q" => "ruby", "max" => "50" }
+ # Net::HTTP.post_form URI('http://www.example.com/search.cgi'),
+ # { "q" => "ruby", "max" => "50" }
#
def HTTP.post_form(url, params)
- req = Post.new(url.request_uri)
+ req = Post.new(url)
req.form_data = params
req.basic_auth url.user, url.password if url.user
- new(url.hostname, url.port).start {|http|
+ start(url.hostname, url.port,
+ :use_ssl => url.scheme == 'https' ) {|http|
http.request(req)
}
end
@@ -507,7 +532,7 @@ module Net #:nodoc:
BufferedIO
end
- # call-seq:
+ # :call-seq:
# HTTP.start(address, port, p_addr, p_port, p_user, p_pass, &block)
# HTTP.start(address, port=nil, p_addr=nil, p_port=nil, p_user=nil, p_pass=nil, opt, &block)
#
@@ -558,15 +583,47 @@ module Net #:nodoc:
end
class << HTTP
- alias newobj new
+ alias newobj new # :nodoc:
end
# Creates a new Net::HTTP object without opening a TCP connection or
# HTTP session.
- # The +address+ should be a DNS hostname or IP address.
- # If +p_addr+ is given, creates a Net::HTTP object with proxy support.
- def HTTP.new(address, port = nil, p_addr = nil, p_port = nil, p_user = nil, p_pass = nil)
- Proxy(p_addr, p_port, p_user, p_pass).newobj(address, port)
+ #
+ # The +address+ should be a DNS hostname or IP address, the +port+ is the
+ # port the server operates on. If no +port+ is given the default port for
+ # HTTP or HTTPS is used.
+ #
+ # If none of the +p_+ arguments are given, the proxy host and port are
+ # taken from the +http_proxy+ environment variable (or its uppercase
+ # equivalent) if present. If the proxy requires authentication you must
+ # supply it by hand. See URI::Generic#find_proxy for details of proxy
+ # detection from the environment. To disable proxy detection set +p_addr+
+ # to nil.
+ #
+ # If you are connecting to a custom proxy, +p_addr+ the DNS name or IP
+ # address of the proxy host, +p_port+ the port to use to access the proxy,
+ # and +p_user+ and +p_pass+ the username and password if authorization is
+ # required to use the proxy.
+ #
+ def HTTP.new(address, port = nil, p_addr = :ENV, p_port = nil, p_user = nil, p_pass = nil)
+ http = super address, port
+
+ if proxy_class? then # from Net::HTTP::Proxy()
+ http.proxy_from_env = @proxy_from_env
+ http.proxy_address = @proxy_address
+ http.proxy_port = @proxy_port
+ http.proxy_user = @proxy_user
+ http.proxy_pass = @proxy_pass
+ elsif p_addr == :ENV then
+ http.proxy_from_env = true
+ else
+ http.proxy_address = p_addr
+ http.proxy_port = p_port || default_port
+ http.proxy_user = p_user
+ http.proxy_pass = p_pass
+ end
+
+ http
end
# Creates a new Net::HTTP object for the specified server address,
@@ -575,8 +632,11 @@ module Net #:nodoc:
def initialize(address, port = nil)
@address = address
@port = (port || HTTP.default_port)
+ @local_host = nil
+ @local_port = nil
@curr_http_version = HTTPVersion
- @no_keepalive_server = false
+ @keep_alive_timeout = 2
+ @last_communicated = nil
@close_on_empty_response = false
@socket = nil
@started = false
@@ -584,15 +644,21 @@ module Net #:nodoc:
@read_timeout = 60
@continue_timeout = nil
@debug_output = nil
+
+ @proxy_from_env = false
+ @proxy_uri = nil
+ @proxy_address = nil
+ @proxy_port = nil
+ @proxy_user = nil
+ @proxy_pass = nil
+
@use_ssl = false
@ssl_context = nil
+ @ssl_session = nil
@enable_post_connection_check = true
- @compression = nil
@sspi_enabled = false
- if defined?(SSL_ATTRIBUTES)
- SSL_ATTRIBUTES.each do |name|
- instance_variable_set "@#{name}", nil
- end
+ SSL_IVNAMES.each do |ivname|
+ instance_variable_set ivname, nil
end
end
@@ -605,7 +671,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 { .... }
#
@@ -620,16 +686,28 @@ module Net #:nodoc:
# The port number to connect to.
attr_reader :port
+ # The local host used to estabilish the connection.
+ attr_accessor :local_host
+
+ # The local port used to estabilish the connection.
+ attr_accessor :local_port
+
+ attr_writer :proxy_from_env
+ attr_writer :proxy_address
+ attr_writer :proxy_port
+ attr_writer :proxy_user
+ attr_writer :proxy_pass
+
# Number of seconds to wait for the connection to open. Any number
# may be used, including Floats for fractional seconds. If the HTTP
# object cannot open a connection in this many seconds, it raises a
- # TimeoutError exception. The default value is +nil+.
+ # Net::OpenTimeout exception. The default value is +nil+.
attr_accessor :open_timeout
# Number of seconds to wait for one block to be read (via one read(2)
# call). Any number may be used, including Floats for fractional
# seconds. If the HTTP object cannot read data in this many seconds,
- # it raises a TimeoutError exception. The default value is 60 seconds.
+ # it raises a Net::ReadTimeout exception. The default value is 60 seconds.
attr_reader :read_timeout
# Setter for the read_timeout attribute.
@@ -649,6 +727,12 @@ module Net #:nodoc:
@continue_timeout = sec
end
+ # Seconds to reuse the connection of the previous request.
+ # If the idle time is less than this Keep-Alive Timeout,
+ # Net::HTTP reuses the TCP/IP socket used by the previous communication.
+ # The default value is 2 seconds.
+ attr_accessor :keep_alive_timeout
+
# Returns true if the HTTP session has been started.
def started?
@started
@@ -675,10 +759,32 @@ module Net #:nodoc:
@use_ssl = flag
end
- SSL_ATTRIBUTES = %w(
- ssl_version key cert ca_file ca_path cert_store ciphers
- verify_mode verify_callback verify_depth ssl_timeout
- )
+ SSL_IVNAMES = [
+ :@ca_file,
+ :@ca_path,
+ :@cert,
+ :@cert_store,
+ :@ciphers,
+ :@key,
+ :@ssl_timeout,
+ :@ssl_version,
+ :@verify_callback,
+ :@verify_depth,
+ :@verify_mode,
+ ]
+ SSL_ATTRIBUTES = [
+ :ca_file,
+ :ca_path,
+ :cert,
+ :cert_store,
+ :ciphers,
+ :key,
+ :ssl_timeout,
+ :ssl_version,
+ :verify_callback,
+ :verify_depth,
+ :verify_mode,
+ ]
# Sets path of a CA certification file in PEM format.
#
@@ -759,23 +865,35 @@ module Net #:nodoc:
private :do_start
def connect
- D "opening connection to #{conn_address()}..."
- s = timeout(@open_timeout) { TCPSocket.open(conn_address(), conn_port()) }
+ if proxy? then
+ conn_address = proxy_address
+ conn_port = proxy_port
+ else
+ conn_address = address
+ conn_port = port
+ end
+
+ D "opening connection to #{conn_address}:#{conn_port}..."
+ 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
iv_list = instance_variables
- SSL_ATTRIBUTES.each do |name|
- ivname = "@#{name}".intern
+ SSL_IVNAMES.each_with_index do |ivname, i|
if iv_list.include?(ivname) and
- value = instance_variable_get(ivname)
- ssl_parameters[name] = value
+ value = instance_variable_get(ivname)
+ ssl_parameters[SSL_ATTRIBUTES[i]] = value if value
end
end
@ssl_context = OpenSSL::SSL::SSLContext.new
@ssl_context.set_params(ssl_parameters)
+ D "starting SSL for #{conn_address}:#{conn_port}..."
s = OpenSSL::SSL::SSLSocket.new(s, @ssl_context)
s.sync_close = true
+ D "SSL established"
end
@socket = BufferedIO.new(s)
@socket.read_timeout = @read_timeout
@@ -784,23 +902,25 @@ module Net #:nodoc:
if use_ssl?
begin
if proxy?
- @socket.writeline sprintf('CONNECT %s:%s HTTP/%s',
- @address, @port, HTTPVersion)
- @socket.writeline "Host: #{@address}:#{@port}"
+ buf = "CONNECT #{@address}:#{@port} HTTP/#{HTTPVersion}\r\n"
+ buf << "Host: #{@address}:#{@port}\r\n"
if proxy_user
credential = ["#{proxy_user}:#{proxy_pass}"].pack('m')
credential.delete!("\r\n")
- @socket.writeline "Proxy-Authorization: Basic #{credential}"
+ buf << "Proxy-Authorization: Basic #{credential}\r\n"
end
- @socket.writeline ''
+ buf << "\r\n"
+ @socket.write(buf)
HTTPResponse.read_new(@socket).value
end
+ s.session = @ssl_session if @ssl_session
# Server Name Indication (SNI) RFC 3546
s.hostname = @address if s.respond_to? :hostname=
- timeout(@open_timeout) { s.connect }
+ Timeout.timeout(@open_timeout, Net::OpenTimeout) { s.connect }
if @ssl_context.verify_mode != OpenSSL::SSL::VERIFY_NONE
s.post_connection_check(@address)
end
+ @ssl_session = s.session
rescue => exception
D "Conn close because of connect error #{exception}"
@socket.close if @socket and not @socket.closed?
@@ -837,6 +957,7 @@ module Net #:nodoc:
# no proxy
@is_proxy_class = false
+ @proxy_from_env = false
@proxy_addr = nil
@proxy_port = nil
@proxy_user = nil
@@ -845,58 +966,33 @@ module Net #:nodoc:
# Creates an HTTP proxy class which behaves like Net::HTTP, but
# performs all access via the specified proxy.
#
- # The arguments are the DNS name or IP address of the proxy host,
- # the port to use to access the proxy, and a username and password
- # if authorization is required to use the proxy.
- #
- # You can replace any use of the Net::HTTP class with use of the
- # proxy class created.
- #
- # If +p_addr+ is nil, this method returns self (a Net::HTTP object).
- #
- # # Example
- # proxy_class = Net::HTTP::Proxy('proxy.example.com', 8080)
- #
- # proxy_class.start('www.ruby-lang.org') {|http|
- # # connecting proxy.foo.org:8080
- # }
- #
- # You may use them to work with authorization-enabled proxies:
- #
- # proxy_host = 'your.proxy.example'
- # proxy_port = 8080
- # proxy_user = 'user'
- # proxy_pass = 'pass'
- #
- # proxy = Net::HTTP::Proxy(proxy_host, proxy_port, proxy_user, proxy_pass)
- # proxy.start('www.example.com') { |http|
- # # always connect to your.proxy.example:8080 using specified username
- # # and password
- # }
- #
- # Note that net/http does not use the HTTP_PROXY environment variable.
- # If you want to use a proxy, you must set it explicitly.
- #
- def HTTP.Proxy(p_addr, p_port = nil, p_user = nil, p_pass = nil)
+ # This class is obsolete. You may pass these same parameters directly to
+ # Net::HTTP.new. See Net::HTTP.new for details of the arguments.
+ def HTTP.Proxy(p_addr = :ENV, p_port = nil, p_user = nil, p_pass = nil)
return self unless p_addr
- delta = ProxyDelta
- proxyclass = Class.new(self)
- proxyclass.module_eval {
- include delta
- # with proxy
+
+ Class.new(self) {
@is_proxy_class = true
- @proxy_address = p_addr
- @proxy_port = p_port || default_port()
- @proxy_user = p_user
- @proxy_pass = p_pass
+
+ if p_addr == :ENV then
+ @proxy_from_env = true
+ @proxy_address = nil
+ @proxy_port = nil
+ else
+ @proxy_from_env = false
+ @proxy_address = p_addr
+ @proxy_port = p_port || default_port
+ end
+
+ @proxy_user = p_user
+ @proxy_pass = p_pass
}
- proxyclass
end
class << HTTP
# returns true if self is a class which was created by HTTP::Proxy.
def proxy_class?
- @is_proxy_class
+ defined?(@is_proxy_class) ? @is_proxy_class : false
end
# Address of proxy host. If Net::HTTP does not use a proxy, nil.
@@ -913,29 +1009,51 @@ module Net #:nodoc:
attr_reader :proxy_pass
end
- # True if self is a HTTP proxy class.
+ # True if requests for this connection will be proxied
def proxy?
- self.class.proxy_class?
+ !!if @proxy_from_env then
+ proxy_uri
+ else
+ @proxy_address
+ end
end
- # A convenience method for accessing value of proxy_address from Net::HTTP.
+ # True if the proxy for this connection is determined from the environment
+ def proxy_from_env?
+ @proxy_from_env
+ end
+
+ # The proxy URI determined from the environment for this connection.
+ def proxy_uri # :nodoc:
+ @proxy_uri ||= URI("http://#{address}:#{port}").find_proxy
+ end
+
+ # The address of the proxy server, if one is configured.
def proxy_address
- self.class.proxy_address
+ if @proxy_from_env then
+ proxy_uri && proxy_uri.hostname
+ else
+ @proxy_address
+ end
end
- # A convenience method for accessing value of proxy_port from Net::HTTP.
+ # The port of the proxy server, if one is configured.
def proxy_port
- self.class.proxy_port
+ if @proxy_from_env then
+ proxy_uri && proxy_uri.port
+ else
+ @proxy_port
+ end
end
- # A convenience method for accessing value of proxy_user from Net::HTTP.
+ # The proxy username, if one is configured
def proxy_user
- self.class.proxy_user
+ @proxy_user
end
- # A convenience method for accessing value of proxy_pass from Net::HTTP.
+ # The proxy password, if one is configured
def proxy_pass
- self.class.proxy_pass
+ @proxy_pass
end
alias proxyaddr proxy_address #:nodoc: obsolete
@@ -943,33 +1061,21 @@ module Net #:nodoc:
private
- # without proxy
+ # without proxy, obsolete
- def conn_address
+ def conn_address # :nodoc:
address()
end
- def conn_port
+ def conn_port # :nodoc:
port()
end
def edit_path(path)
- path
- end
-
- module ProxyDelta #:nodoc: internal use only
- private
-
- def conn_address
- proxy_address()
- end
-
- def conn_port
- proxy_port()
- end
-
- def edit_path(path)
- use_ssl? ? path : "http://#{addr_port()}#{path}"
+ if proxy? and not use_ssl? then
+ "http://#{addr_port}#{path}"
+ else
+ path
end
end
@@ -979,7 +1085,9 @@ module Net #:nodoc:
public
- # Gets data from +path+ on the connected-to host.
+ # Retrieves data from +path+ on the connected-to host which may be an
+ # absolute path String or a URI to extract the path from.
+ #
# +initheader+ must be a Hash like { 'Accept' => '*/*', ... },
# and it defaults to an empty hash.
# If +initheader+ doesn't have the key 'accept-encoding', then
@@ -1016,33 +1124,8 @@ module Net #:nodoc:
#
def get(path, initheader = {}, dest = nil, &block) # :yield: +body_segment+
res = nil
- if HAVE_ZLIB
- unless initheader.keys.any?{|k| k.downcase == "accept-encoding"}
- initheader = initheader.merge({
- "accept-encoding" => "gzip;q=1.0,deflate;q=0.6,identity;q=0.3"
- })
- @compression = true
- end
- end
request(Get.new(path, initheader)) {|r|
- if r.key?("content-encoding") and @compression
- @compression = nil # Clear it till next set.
- the_body = r.read_body dest, &block
- case r["content-encoding"]
- when "gzip"
- r.body= Zlib::GzipReader.new(StringIO.new(the_body), encoding: "ASCII-8BIT").read
- r.delete("content-encoding")
- when "deflate"
- r.body= Zlib::Inflate.inflate(the_body);
- r.delete("content-encoding")
- when "identity"
- ; # nothing needed
- else
- ; # Don't do anything dramatic, unless we need to later
- end
- else
- r.read_body dest, &block
- end
+ r.read_body dest, &block
res = r
}
res
@@ -1312,18 +1395,44 @@ module Net #:nodoc:
res
end
+ IDEMPOTENT_METHODS_ = %w/GET HEAD PUT DELETE OPTIONS TRACE/ # :nodoc:
+
def transport_request(req)
- begin_transport req
- res = catch(:response) {
- req.exec @socket, @curr_http_version, edit_path(req.path)
- begin
- res = HTTPResponse.read_new(@socket)
- end while res.kind_of?(HTTPContinue)
- res.reading_body(@socket, req.response_body_permitted?) {
- yield res if block_given?
+ count = 0
+ begin
+ begin_transport req
+ res = catch(:response) {
+ req.exec @socket, @curr_http_version, edit_path(req.path)
+ begin
+ res = HTTPResponse.read_new(@socket)
+ res.decode_content = req.decode_content
+ end while res.kind_of?(HTTPContinue)
+
+ res.uri = req.uri
+
+ res.reading_body(@socket, req.response_body_permitted?) {
+ yield res if block_given?
+ }
+ res
}
- res
- }
+ rescue Net::OpenTimeout
+ raise
+ rescue Net::ReadTimeout, IOError, EOFError,
+ Errno::ECONNRESET, Errno::ECONNABORTED, Errno::EPIPE,
+ # avoid a dependency on OpenSSL
+ defined?(OpenSSL::SSL) ? OpenSSL::SSL::SSLError : IOError,
+ Timeout::Error => exception
+ if count == 0 && IDEMPOTENT_METHODS_.include?(req.method)
+ count += 1
+ @socket.close if @socket and not @socket.closed?
+ D "Conn close because of error #{exception}, and retry"
+ retry
+ end
+ D "Conn close because of error #{exception}"
+ @socket.close if @socket and not @socket.closed?
+ raise
+ end
+
end_transport req, res
res
rescue => exception
@@ -1333,15 +1442,28 @@ module Net #:nodoc:
end
def begin_transport(req)
- connect if @socket.closed?
+ if @socket.closed?
+ connect
+ elsif @last_communicated && @last_communicated + @keep_alive_timeout < Time.now
+ D 'Conn close because of keep_alive_timeout'
+ @socket.close
+ connect
+ end
+
if not req.response_body_permitted? and @close_on_empty_response
req['connection'] ||= 'close'
end
+
+ host = req['host'] || address
+ host = $1 if host =~ /(.*):\d+$/
+ req.update_uri host, port, use_ssl?
+
req['host'] ||= addr_port()
end
def end_transport(req, res)
@curr_http_version = res.http_version
+ @last_communicated = nil
if @socket.closed?
D 'Conn socket closed'
elsif not res.body and @close_on_empty_response
@@ -1349,6 +1471,7 @@ module Net #:nodoc:
@socket.close
elsif keep_alive?(req, res)
D 'Conn keep-alive'
+ @last_communicated = Time.now
else
D 'Conn close'
@socket.close
@@ -1411,1415 +1534,22 @@ module Net #:nodoc:
@debug_output << msg
@debug_output << "\n"
end
-
end
- HTTPSession = HTTP
-
-
- # The HTTPHeader module defines methods for reading and writing
- # HTTP headers.
- #
- # It is used as a mixin by other classes, to provide hash-like
- # access to HTTP header values. Unlike raw hash access, HTTPHeader
- # provides access via case-insensitive keys. It also provides
- # methods for accessing commonly-used HTTP header values in more
- # convenient formats.
- #
- module HTTPHeader
+end
- def initialize_http_header(initheader)
- @header = {}
- return unless initheader
- initheader.each do |key, value|
- warn "net/http: warning: duplicated HTTP header: #{key}" if key?(key) and $VERBOSE
- @header[key.downcase] = [value.strip]
- end
- end
+require 'net/http/exceptions'
- def size #:nodoc: obsolete
- @header.size
- end
+require 'net/http/header'
- alias length size #:nodoc: obsolete
-
- # Returns the header field corresponding to the case-insensitive key.
- # For example, a key of "Content-Type" might return "text/html"
- def [](key)
- a = @header[key.downcase] or return nil
- a.join(', ')
- end
-
- # Sets the header field corresponding to the case-insensitive key.
- def []=(key, val)
- unless val
- @header.delete key.downcase
- return val
- end
- @header[key.downcase] = [val]
- end
-
- # [Ruby 1.8.3]
- # Adds a value to a named header field, instead of replacing its value.
- # Second argument +val+ must be a String.
- # See also #[]=, #[] and #get_fields.
- #
- # request.add_field 'X-My-Header', 'a'
- # p request['X-My-Header'] #=> "a"
- # p request.get_fields('X-My-Header') #=> ["a"]
- # request.add_field 'X-My-Header', 'b'
- # p request['X-My-Header'] #=> "a, b"
- # p request.get_fields('X-My-Header') #=> ["a", "b"]
- # request.add_field 'X-My-Header', 'c'
- # p request['X-My-Header'] #=> "a, b, c"
- # p request.get_fields('X-My-Header') #=> ["a", "b", "c"]
- #
- def add_field(key, val)
- if @header.key?(key.downcase)
- @header[key.downcase].push val
- else
- @header[key.downcase] = [val]
- end
- end
+require 'net/http/generic_request'
+require 'net/http/request'
+require 'net/http/requests'
- # [Ruby 1.8.3]
- # Returns an array of header field strings corresponding to the
- # case-insensitive +key+. This method allows you to get duplicated
- # header fields without any processing. See also #[].
- #
- # p response.get_fields('Set-Cookie')
- # #=> ["session=al98axx; expires=Fri, 31-Dec-1999 23:58:23",
- # "query=rubyscript; expires=Fri, 31-Dec-1999 23:58:23"]
- # p response['Set-Cookie']
- # #=> "session=al98axx; expires=Fri, 31-Dec-1999 23:58:23, query=rubyscript; expires=Fri, 31-Dec-1999 23:58:23"
- #
- def get_fields(key)
- return nil unless @header[key.downcase]
- @header[key.downcase].dup
- end
-
- # Returns the header field corresponding to the case-insensitive key.
- # Returns the default value +args+, or the result of the block, or
- # raises an IndexError if there's no header field named +key+
- # See Hash#fetch
- def fetch(key, *args, &block) #:yield: +key+
- a = @header.fetch(key.downcase, *args, &block)
- a.kind_of?(Array) ? a.join(', ') : a
- end
-
- # Iterates through the header names and values, passing in the name
- # and value to the code block supplied.
- #
- # Example:
- #
- # response.header.each_header {|key,value| puts "#{key} = #{value}" }
- #
- def each_header #:yield: +key+, +value+
- block_given? or return enum_for(__method__)
- @header.each do |k,va|
- yield k, va.join(', ')
- end
- end
-
- alias each each_header
-
- # Iterates through the header names in the header, passing
- # each header name to the code block.
- def each_name(&block) #:yield: +key+
- block_given? or return enum_for(__method__)
- @header.each_key(&block)
- end
-
- alias each_key each_name
-
- # Iterates through the header names in the header, passing
- # capitalized header names to the code block.
- #
- # Note that header names are capitalized systematically;
- # capitalization may not match that used by the remote HTTP
- # server in its response.
- def each_capitalized_name #:yield: +key+
- block_given? or return enum_for(__method__)
- @header.each_key do |k|
- yield capitalize(k)
- end
- end
-
- # Iterates through header values, passing each value to the
- # code block.
- def each_value #:yield: +value+
- block_given? or return enum_for(__method__)
- @header.each_value do |va|
- yield va.join(', ')
- end
- end
-
- # Removes a header field, specified by case-insensitive key.
- def delete(key)
- @header.delete(key.downcase)
- end
-
- # true if +key+ header exists.
- def key?(key)
- @header.key?(key.downcase)
- end
-
- # Returns a Hash consisting of header names and values.
- # e.g.
- # {"cache-control" => "private",
- # "content-type" => "text/html",
- # "date" => "Wed, 22 Jun 2005 22:11:50 GMT"}
- def to_hash
- @header.dup
- end
+require 'net/http/response'
+require 'net/http/responses'
- # As for #each_header, except the keys are provided in capitalized form.
- #
- # Note that header names are capitalized systematically;
- # capitalization may not match that used by the remote HTTP
- # server in its response.
- def each_capitalized
- block_given? or return enum_for(__method__)
- @header.each do |k,v|
- yield capitalize(k), v.join(', ')
- end
- end
-
- alias canonical_each each_capitalized
-
- def capitalize(name)
- name.split(/-/).map {|s| s.capitalize }.join('-')
- end
- private :capitalize
-
- # Returns an Array of Range objects which represent the Range:
- # HTTP header field, or +nil+ if there is no such header.
- def range
- return nil unless @header['range']
- self['Range'].split(/,/).map {|spec|
- m = /bytes\s*=\s*(\d+)?\s*-\s*(\d+)?/i.match(spec) or
- raise HTTPHeaderSyntaxError, "wrong Range: #{spec}"
- d1 = m[1].to_i
- d2 = m[2].to_i
- if m[1] and m[2] then d1..d2
- elsif m[1] then d1..-1
- elsif m[2] then -d2..-1
- else
- raise HTTPHeaderSyntaxError, 'range is not specified'
- end
- }
- end
-
- # Sets the HTTP Range: header.
- # Accepts either a Range object as a single argument,
- # or a beginning index and a length from that index.
- # Example:
- #
- # req.range = (0..1023)
- # req.set_range 0, 1023
- #
- def set_range(r, e = nil)
- unless r
- @header.delete 'range'
- return r
- end
- r = (r...r+e) if e
- case r
- when Numeric
- n = r.to_i
- rangestr = (n > 0 ? "0-#{n-1}" : "-#{-n}")
- when Range
- first = r.first
- last = r.last
- last -= 1 if r.exclude_end?
- if last == -1
- rangestr = (first > 0 ? "#{first}-" : "-#{-first}")
- else
- raise HTTPHeaderSyntaxError, 'range.first is negative' if first < 0
- raise HTTPHeaderSyntaxError, 'range.last is negative' if last < 0
- raise HTTPHeaderSyntaxError, 'must be .first < .last' if first > last
- rangestr = "#{first}-#{last}"
- end
- else
- raise TypeError, 'Range/Integer is required'
- end
- @header['range'] = ["bytes=#{rangestr}"]
- r
- end
-
- alias range= set_range
-
- # Returns an Integer object which represents the HTTP Content-Length:
- # header field, or +nil+ if that field was not provided.
- def content_length
- return nil unless key?('Content-Length')
- len = self['Content-Length'].slice(/\d+/) or
- raise HTTPHeaderSyntaxError, 'wrong Content-Length format'
- len.to_i
- end
-
- def content_length=(len)
- unless len
- @header.delete 'content-length'
- return nil
- end
- @header['content-length'] = [len.to_i.to_s]
- end
-
- # Returns "true" if the "transfer-encoding" header is present and
- # set to "chunked". This is an HTTP/1.1 feature, allowing the
- # the content to be sent in "chunks" without at the outset
- # stating the entire content length.
- def chunked?
- return false unless @header['transfer-encoding']
- field = self['Transfer-Encoding']
- (/(?:\A|[^\-\w])chunked(?![\-\w])/i =~ field) ? true : false
- end
-
- # Returns a Range object which represents the value of the Content-Range:
- # header field.
- # For a partial entity body, this indicates where this fragment
- # fits inside the full entity body, as range of byte offsets.
- def content_range
- return nil unless @header['content-range']
- m = %r<bytes\s+(\d+)-(\d+)/(\d+|\*)>i.match(self['Content-Range']) or
- raise HTTPHeaderSyntaxError, 'wrong Content-Range format'
- m[1].to_i .. m[2].to_i
- end
-
- # The length of the range represented in Content-Range: header.
- def range_length
- r = content_range() or return nil
- r.end - r.begin + 1
- end
-
- # Returns a content type string such as "text/html".
- # This method returns nil if Content-Type: header field does not exist.
- def content_type
- return nil unless main_type()
- if sub_type()
- then "#{main_type()}/#{sub_type()}"
- else main_type()
- end
- end
-
- # Returns a content type string such as "text".
- # This method returns nil if Content-Type: header field does not exist.
- def main_type
- return nil unless @header['content-type']
- self['Content-Type'].split(';').first.to_s.split('/')[0].to_s.strip
- end
-
- # Returns a content type string such as "html".
- # This method returns nil if Content-Type: header field does not exist
- # or sub-type is not given (e.g. "Content-Type: text").
- def sub_type
- return nil unless @header['content-type']
- _, sub = *self['Content-Type'].split(';').first.to_s.split('/')
- return nil unless sub
- sub.strip
- end
-
- # Any parameters specified for the content type, returned as a Hash.
- # For example, a header of Content-Type: text/html; charset=EUC-JP
- # would result in type_params returning {'charset' => 'EUC-JP'}
- def type_params
- result = {}
- list = self['Content-Type'].to_s.split(';')
- list.shift
- list.each do |param|
- k, v = *param.split('=', 2)
- result[k.strip] = v.strip
- end
- result
- end
-
- # Sets the content type in an HTTP header.
- # The +type+ should be a full HTTP content type, e.g. "text/html".
- # The +params+ are an optional Hash of parameters to add after the
- # content type, e.g. {'charset' => 'iso-8859-1'}
- def set_content_type(type, params = {})
- @header['content-type'] = [type + params.map{|k,v|"; #{k}=#{v}"}.join('')]
- end
-
- alias content_type= set_content_type
-
- # Set header fields and a body from HTML form data.
- # +params+ should be an Array of Arrays or
- # a Hash containing HTML form data.
- # Optional argument +sep+ means data record separator.
- #
- # Values are URL encoded as necessary and the content-type is set to
- # application/x-www-form-urlencoded
- #
- # Example:
- # http.form_data = {"q" => "ruby", "lang" => "en"}
- # http.form_data = {"q" => ["ruby", "perl"], "lang" => "en"}
- # http.set_form_data({"q" => "ruby", "lang" => "en"}, ';')
- #
- def set_form_data(params, sep = '&')
- query = URI.encode_www_form(params)
- query.gsub!(/&/, sep) if sep != '&'
- self.body = query
- self.content_type = 'application/x-www-form-urlencoded'
- end
-
- alias form_data= set_form_data
-
- # Set a HTML form data set.
- # +params+ is the form data set; it is an Array of Arrays or a Hash
- # +enctype is the type to encode the form data set.
- # It is application/x-www-form-urlencoded or multipart/form-data.
- # +formpot+ is an optional hash to specify the detail.
- #
- # boundary:: the boundary of the multipart message
- # charset:: the charset of the message. All names and the values of
- # non-file fields are encoded as the charset.
- #
- # Each item of params is an array and contains following items:
- # +name+:: the name of the field
- # +value+:: the value of the field, it should be a String or a File
- # +opt+:: an optional hash to specify additional information
- #
- # Each item is a file field or a normal field.
- # If +value+ is a File object or the +opt+ have a filename key,
- # the item is treated as a file field.
- #
- # If Transfer-Encoding is set as chunked, this send the request in
- # chunked encoding. Because chunked encoding is HTTP/1.1 feature,
- # you must confirm the server to support HTTP/1.1 before sending it.
- #
- # Example:
- # http.set_form([["q", "ruby"], ["lang", "en"]])
- #
- # See also RFC 2388, RFC 2616, HTML 4.01, and HTML5
- #
- def set_form(params, enctype='application/x-www-form-urlencoded', formopt={})
- @body_data = params
- @body = nil
- @body_stream = nil
- @form_option = formopt
- case enctype
- when /\Aapplication\/x-www-form-urlencoded\z/i,
- /\Amultipart\/form-data\z/i
- self.content_type = enctype
- else
- raise ArgumentError, "invalid enctype: #{enctype}"
- end
- end
-
- # Set the Authorization: header for "Basic" authorization.
- def basic_auth(account, password)
- @header['authorization'] = [basic_encode(account, password)]
- end
-
- # Set Proxy-Authorization: header for "Basic" authorization.
- def proxy_basic_auth(account, password)
- @header['proxy-authorization'] = [basic_encode(account, password)]
- end
-
- def basic_encode(account, password)
- 'Basic ' + ["#{account}:#{password}"].pack('m').delete("\r\n")
- end
- private :basic_encode
-
- def connection_close?
- tokens(@header['connection']).include?('close') or
- tokens(@header['proxy-connection']).include?('close')
- end
-
- def connection_keep_alive?
- tokens(@header['connection']).include?('keep-alive') or
- tokens(@header['proxy-connection']).include?('keep-alive')
- end
-
- def tokens(vals)
- return [] unless vals
- vals.map {|v| v.split(',') }.flatten\
- .reject {|str| str.strip.empty? }\
- .map {|tok| tok.strip.downcase }
- end
- private :tokens
-
- end
-
-
- # HTTPGenericRequest is the parent of the HTTPRequest class.
- # Do not use this directly; use a subclass of HTTPRequest.
- #
- # Mixes in the HTTPHeader module to provide easier access to HTTP headers.
- #
- class HTTPGenericRequest
-
- include HTTPHeader
-
- def initialize(m, reqbody, resbody, path, initheader = nil)
- @method = m
- @request_has_body = reqbody
- @response_has_body = resbody
- raise ArgumentError, "no HTTP request path given" unless path
- raise ArgumentError, "HTTP request path is empty" if path.empty?
- @path = path
- initialize_http_header initheader
- self['Accept'] ||= '*/*'
- self['User-Agent'] ||= 'Ruby'
- @body = nil
- @body_stream = nil
- @body_data = nil
- end
-
- attr_reader :method
- attr_reader :path
-
- def inspect
- "\#<#{self.class} #{@method}>"
- end
-
- def request_body_permitted?
- @request_has_body
- end
-
- def response_body_permitted?
- @response_has_body
- end
-
- def body_exist?
- warn "Net::HTTPRequest#body_exist? is obsolete; use response_body_permitted?" if $VERBOSE
- response_body_permitted?
- end
-
- attr_reader :body
-
- def body=(str)
- @body = str
- @body_stream = nil
- @body_data = nil
- str
- end
-
- attr_reader :body_stream
-
- def body_stream=(input)
- @body = nil
- @body_stream = input
- @body_data = nil
- input
- end
-
- def set_body_internal(str) #:nodoc: internal use only
- raise ArgumentError, "both of body argument and HTTPRequest#body set" if str and (@body or @body_stream)
- self.body = str if str
- end
-
- #
- # write
- #
-
- def exec(sock, ver, path) #:nodoc: internal use only
- if @body
- send_request_with_body sock, ver, path, @body
- elsif @body_stream
- send_request_with_body_stream sock, ver, path, @body_stream
- elsif @body_data
- send_request_with_body_data sock, ver, path, @body_data
- else
- write_header sock, ver, path
- end
- end
-
- private
-
- def send_request_with_body(sock, ver, path, body)
- self.content_length = body.bytesize
- delete 'Transfer-Encoding'
- supply_default_content_type
- write_header sock, ver, path
- wait_for_continue sock, ver if sock.continue_timeout
- sock.write body
- end
-
- def send_request_with_body_stream(sock, ver, path, f)
- unless content_length() or chunked?
- raise ArgumentError,
- "Content-Length not given and Transfer-Encoding is not `chunked'"
- end
- supply_default_content_type
- write_header sock, ver, path
- wait_for_continue sock, ver if sock.continue_timeout
- if chunked?
- while s = f.read(1024)
- sock.write(sprintf("%x\r\n", s.length) << s << "\r\n")
- end
- sock.write "0\r\n\r\n"
- else
- while s = f.read(1024)
- sock.write s
- end
- end
- end
-
- def send_request_with_body_data(sock, ver, path, params)
- if /\Amultipart\/form-data\z/i !~ self.content_type
- self.content_type = 'application/x-www-form-urlencoded'
- return send_request_with_body(sock, ver, path, URI.encode_www_form(params))
- end
-
- opt = @form_option.dup
- require 'securerandom' unless defined?(SecureRandom)
- opt[:boundary] ||= SecureRandom.urlsafe_base64(40)
- self.set_content_type(self.content_type, boundary: opt[:boundary])
- if chunked?
- write_header sock, ver, path
- encode_multipart_form_data(sock, params, opt)
- else
- require 'tempfile'
- file = Tempfile.new('multipart')
- file.binmode
- encode_multipart_form_data(file, params, opt)
- file.rewind
- self.content_length = file.size
- write_header sock, ver, path
- IO.copy_stream(file, sock)
- end
- end
-
- def encode_multipart_form_data(out, params, opt)
- charset = opt[:charset]
- boundary = opt[:boundary]
- require 'securerandom' unless defined?(SecureRandom)
- boundary ||= SecureRandom.urlsafe_base64(40)
- chunked_p = chunked?
-
- buf = ''
- params.each do |key, value, h={}|
- key = quote_string(key, charset)
- filename =
- h.key?(:filename) ? h[:filename] :
- value.respond_to?(:to_path) ? File.basename(value.to_path) :
- nil
-
- buf << "--#{boundary}\r\n"
- if filename
- filename = quote_string(filename, charset)
- type = h[:content_type] || 'application/octet-stream'
- buf << "Content-Disposition: form-data; " \
- "name=\"#{key}\"; filename=\"#{filename}\"\r\n" \
- "Content-Type: #{type}\r\n\r\n"
- if !out.respond_to?(:write) || !value.respond_to?(:read)
- # if +out+ is not an IO or +value+ is not an IO
- buf << (value.respond_to?(:read) ? value.read : value)
- elsif value.respond_to?(:size) && chunked_p
- # if +out+ is an IO and +value+ is a File, use IO.copy_stream
- flush_buffer(out, buf, chunked_p)
- out << "%x\r\n" % value.size if chunked_p
- IO.copy_stream(value, out)
- out << "\r\n" if chunked_p
- else
- # +out+ is an IO, and +value+ is not a File but an IO
- flush_buffer(out, buf, chunked_p)
- 1 while flush_buffer(out, value.read(4096), chunked_p)
- end
- else
- # non-file field:
- # HTML5 says, "The parts of the generated multipart/form-data
- # resource that correspond to non-file fields must not have a
- # Content-Type header specified."
- buf << "Content-Disposition: form-data; name=\"#{key}\"\r\n\r\n"
- buf << (value.respond_to?(:read) ? value.read : value)
- end
- buf << "\r\n"
- end
- buf << "--#{boundary}--\r\n"
- flush_buffer(out, buf, chunked_p)
- out << "0\r\n\r\n" if chunked_p
- end
-
- def quote_string(str, charset)
- str = str.encode(charset, fallback:->(c){'&#%d;'%c.encode("UTF-8").ord}) if charset
- str = str.gsub(/[\\"]/, '\\\\\&')
- end
-
- def flush_buffer(out, buf, chunked_p)
- return unless buf
- out << "%x\r\n"%buf.bytesize if chunked_p
- out << buf
- out << "\r\n" if chunked_p
- buf.clear
- end
-
- def supply_default_content_type
- return if content_type()
- warn 'net/http: warning: Content-Type did not set; using application/x-www-form-urlencoded' if $VERBOSE
- set_content_type 'application/x-www-form-urlencoded'
- end
-
- ##
- # Waits up to the continue timeout for a response from the server provided
- # we're speaking HTTP 1.1 and are expecting a 100-continue response.
-
- def wait_for_continue(sock, ver)
- if ver >= '1.1' and @header['expect'] and
- @header['expect'].include?('100-continue')
- if IO.select([sock.io], nil, nil, sock.continue_timeout)
- res = HTTPResponse.read_new(sock)
- unless res.kind_of?(Net::HTTPContinue)
- throw :response, res
- end
- end
- end
- end
-
- def write_header(sock, ver, path)
- buf = "#{@method} #{path} HTTP/#{ver}\r\n"
- each_capitalized do |k,v|
- buf << "#{k}: #{v}\r\n"
- end
- buf << "\r\n"
- sock.write buf
- end
-
- end
-
-
- #
- # HTTP request class.
- # This class wraps together the request header and the request path.
- # You cannot use this class directly. Instead, you should use one of its
- # subclasses: Net::HTTP::Get, Net::HTTP::Post, Net::HTTP::Head.
- #
- class HTTPRequest < HTTPGenericRequest
-
- # Creates HTTP request object.
- def initialize(path, initheader = nil)
- super self.class::METHOD,
- self.class::REQUEST_HAS_BODY,
- self.class::RESPONSE_HAS_BODY,
- path, initheader
- end
- end
-
-
- class HTTP # reopen
- #
- # HTTP/1.1 methods --- RFC2616
- #
-
- # See Net::HTTPGenericRequest for attributes and methods.
- # See Net::HTTP for usage examples.
- class Get < HTTPRequest
- METHOD = 'GET'
- REQUEST_HAS_BODY = false
- RESPONSE_HAS_BODY = true
- end
-
- # See Net::HTTPGenericRequest for attributes and methods.
- # See Net::HTTP for usage examples.
- class Head < HTTPRequest
- METHOD = 'HEAD'
- REQUEST_HAS_BODY = false
- RESPONSE_HAS_BODY = false
- end
-
- # See Net::HTTPGenericRequest for attributes and methods.
- # See Net::HTTP for usage examples.
- class Post < HTTPRequest
- METHOD = 'POST'
- REQUEST_HAS_BODY = true
- RESPONSE_HAS_BODY = true
- end
-
- # See Net::HTTPGenericRequest for attributes and methods.
- # See Net::HTTP for usage examples.
- class Put < HTTPRequest
- METHOD = 'PUT'
- REQUEST_HAS_BODY = true
- RESPONSE_HAS_BODY = true
- end
-
- # See Net::HTTPGenericRequest for attributes and methods.
- # See Net::HTTP for usage examples.
- class Delete < HTTPRequest
- METHOD = 'DELETE'
- REQUEST_HAS_BODY = false
- RESPONSE_HAS_BODY = true
- end
-
- # See Net::HTTPGenericRequest for attributes and methods.
- class Options < HTTPRequest
- METHOD = 'OPTIONS'
- REQUEST_HAS_BODY = false
- RESPONSE_HAS_BODY = false
- end
-
- # See Net::HTTPGenericRequest for attributes and methods.
- class Trace < HTTPRequest
- METHOD = 'TRACE'
- REQUEST_HAS_BODY = false
- RESPONSE_HAS_BODY = true
- end
-
- #
- # PATCH method --- RFC5789
- #
-
- # See Net::HTTPGenericRequest for attributes and methods.
- class Patch < HTTPRequest
- METHOD = 'PATCH'
- REQUEST_HAS_BODY = true
- RESPONSE_HAS_BODY = true
- end
-
- #
- # WebDAV methods --- RFC2518
- #
-
- # See Net::HTTPGenericRequest for attributes and methods.
- class Propfind < HTTPRequest
- METHOD = 'PROPFIND'
- REQUEST_HAS_BODY = true
- RESPONSE_HAS_BODY = true
- end
-
- # See Net::HTTPGenericRequest for attributes and methods.
- class Proppatch < HTTPRequest
- METHOD = 'PROPPATCH'
- REQUEST_HAS_BODY = true
- RESPONSE_HAS_BODY = true
- end
-
- # See Net::HTTPGenericRequest for attributes and methods.
- class Mkcol < HTTPRequest
- METHOD = 'MKCOL'
- REQUEST_HAS_BODY = true
- RESPONSE_HAS_BODY = true
- end
-
- # See Net::HTTPGenericRequest for attributes and methods.
- class Copy < HTTPRequest
- METHOD = 'COPY'
- REQUEST_HAS_BODY = false
- RESPONSE_HAS_BODY = true
- end
-
- # See Net::HTTPGenericRequest for attributes and methods.
- class Move < HTTPRequest
- METHOD = 'MOVE'
- REQUEST_HAS_BODY = false
- RESPONSE_HAS_BODY = true
- end
-
- # See Net::HTTPGenericRequest for attributes and methods.
- class Lock < HTTPRequest
- METHOD = 'LOCK'
- REQUEST_HAS_BODY = true
- RESPONSE_HAS_BODY = true
- end
-
- # See Net::HTTPGenericRequest for attributes and methods.
- class Unlock < HTTPRequest
- METHOD = 'UNLOCK'
- REQUEST_HAS_BODY = true
- RESPONSE_HAS_BODY = true
- end
- end
-
-
- ###
- ### Response
- ###
-
- # HTTP exception class.
- # You cannot use HTTPExceptions directly; instead, you must use
- # its subclasses.
- module HTTPExceptions
- def initialize(msg, res) #:nodoc:
- super msg
- @response = res
- end
- attr_reader :response
- alias data response #:nodoc: obsolete
- end
- class HTTPError < ProtocolError
- include HTTPExceptions
- end
- class HTTPRetriableError < ProtoRetriableError
- include HTTPExceptions
- end
- class HTTPServerException < ProtoServerError
- # We cannot use the name "HTTPServerError", it is the name of the response.
- include HTTPExceptions
- end
- class HTTPFatalError < ProtoFatalError
- include HTTPExceptions
- end
-
-
- # HTTP response class.
- #
- # This class wraps together the response header and the response body (the
- # entity requested).
- #
- # It mixes in the HTTPHeader module, which provides access to response
- # header values both via hash-like methods and via individual readers.
- #
- # Note that each possible HTTP response code defines its own
- # HTTPResponse subclass. These are listed below.
- #
- # All classes are
- # defined under the Net module. Indentation indicates inheritance.
- #
- # xxx HTTPResponse
- #
- # 1xx HTTPInformation
- # 100 HTTPContinue
- # 101 HTTPSwitchProtocol
- #
- # 2xx HTTPSuccess
- # 200 HTTPOK
- # 201 HTTPCreated
- # 202 HTTPAccepted
- # 203 HTTPNonAuthoritativeInformation
- # 204 HTTPNoContent
- # 205 HTTPResetContent
- # 206 HTTPPartialContent
- #
- # 3xx HTTPRedirection
- # 300 HTTPMultipleChoice
- # 301 HTTPMovedPermanently
- # 302 HTTPFound
- # 303 HTTPSeeOther
- # 304 HTTPNotModified
- # 305 HTTPUseProxy
- # 307 HTTPTemporaryRedirect
- #
- # 4xx HTTPClientError
- # 400 HTTPBadRequest
- # 401 HTTPUnauthorized
- # 402 HTTPPaymentRequired
- # 403 HTTPForbidden
- # 404 HTTPNotFound
- # 405 HTTPMethodNotAllowed
- # 406 HTTPNotAcceptable
- # 407 HTTPProxyAuthenticationRequired
- # 408 HTTPRequestTimeOut
- # 409 HTTPConflict
- # 410 HTTPGone
- # 411 HTTPLengthRequired
- # 412 HTTPPreconditionFailed
- # 413 HTTPRequestEntityTooLarge
- # 414 HTTPRequestURITooLong
- # 415 HTTPUnsupportedMediaType
- # 416 HTTPRequestedRangeNotSatisfiable
- # 417 HTTPExpectationFailed
- #
- # 5xx HTTPServerError
- # 500 HTTPInternalServerError
- # 501 HTTPNotImplemented
- # 502 HTTPBadGateway
- # 503 HTTPServiceUnavailable
- # 504 HTTPGatewayTimeOut
- # 505 HTTPVersionNotSupported
- #
- # xxx HTTPUnknownResponse
- #
- class HTTPResponse
- # true if the response has a body.
- def HTTPResponse.body_permitted?
- self::HAS_BODY
- end
-
- def HTTPResponse.exception_type # :nodoc: internal use only
- self::EXCEPTION_TYPE
- end
- end # reopened after
-
- # :stopdoc:
-
- class HTTPUnknownResponse < HTTPResponse
- HAS_BODY = true
- EXCEPTION_TYPE = HTTPError
- end
- class HTTPInformation < HTTPResponse # 1xx
- HAS_BODY = false
- EXCEPTION_TYPE = HTTPError
- end
- class HTTPSuccess < HTTPResponse # 2xx
- HAS_BODY = true
- EXCEPTION_TYPE = HTTPError
- end
- class HTTPRedirection < HTTPResponse # 3xx
- HAS_BODY = true
- EXCEPTION_TYPE = HTTPRetriableError
- end
- class HTTPClientError < HTTPResponse # 4xx
- HAS_BODY = true
- EXCEPTION_TYPE = HTTPServerException # for backward compatibility
- end
- class HTTPServerError < HTTPResponse # 5xx
- HAS_BODY = true
- EXCEPTION_TYPE = HTTPFatalError # for backward compatibility
- end
-
- class HTTPContinue < HTTPInformation # 100
- HAS_BODY = false
- end
- class HTTPSwitchProtocol < HTTPInformation # 101
- HAS_BODY = false
- end
-
- class HTTPOK < HTTPSuccess # 200
- HAS_BODY = true
- end
- class HTTPCreated < HTTPSuccess # 201
- HAS_BODY = true
- end
- class HTTPAccepted < HTTPSuccess # 202
- HAS_BODY = true
- end
- class HTTPNonAuthoritativeInformation < HTTPSuccess # 203
- HAS_BODY = true
- end
- class HTTPNoContent < HTTPSuccess # 204
- HAS_BODY = false
- end
- class HTTPResetContent < HTTPSuccess # 205
- HAS_BODY = false
- end
- class HTTPPartialContent < HTTPSuccess # 206
- HAS_BODY = true
- end
-
- class HTTPMultipleChoice < HTTPRedirection # 300
- HAS_BODY = true
- end
- class HTTPMovedPermanently < HTTPRedirection # 301
- HAS_BODY = true
- end
- class HTTPFound < HTTPRedirection # 302
- HAS_BODY = true
- end
- HTTPMovedTemporarily = HTTPFound
- class HTTPSeeOther < HTTPRedirection # 303
- HAS_BODY = true
- end
- class HTTPNotModified < HTTPRedirection # 304
- HAS_BODY = false
- end
- class HTTPUseProxy < HTTPRedirection # 305
- HAS_BODY = false
- end
- # 306 unused
- class HTTPTemporaryRedirect < HTTPRedirection # 307
- HAS_BODY = true
- end
-
- class HTTPBadRequest < HTTPClientError # 400
- HAS_BODY = true
- end
- class HTTPUnauthorized < HTTPClientError # 401
- HAS_BODY = true
- end
- class HTTPPaymentRequired < HTTPClientError # 402
- HAS_BODY = true
- end
- class HTTPForbidden < HTTPClientError # 403
- HAS_BODY = true
- end
- class HTTPNotFound < HTTPClientError # 404
- HAS_BODY = true
- end
- class HTTPMethodNotAllowed < HTTPClientError # 405
- HAS_BODY = true
- end
- class HTTPNotAcceptable < HTTPClientError # 406
- HAS_BODY = true
- end
- class HTTPProxyAuthenticationRequired < HTTPClientError # 407
- HAS_BODY = true
- end
- class HTTPRequestTimeOut < HTTPClientError # 408
- HAS_BODY = true
- end
- class HTTPConflict < HTTPClientError # 409
- HAS_BODY = true
- end
- class HTTPGone < HTTPClientError # 410
- HAS_BODY = true
- end
- class HTTPLengthRequired < HTTPClientError # 411
- HAS_BODY = true
- end
- class HTTPPreconditionFailed < HTTPClientError # 412
- HAS_BODY = true
- end
- class HTTPRequestEntityTooLarge < HTTPClientError # 413
- HAS_BODY = true
- end
- class HTTPRequestURITooLong < HTTPClientError # 414
- HAS_BODY = true
- end
- HTTPRequestURITooLarge = HTTPRequestURITooLong
- class HTTPUnsupportedMediaType < HTTPClientError # 415
- HAS_BODY = true
- end
- class HTTPRequestedRangeNotSatisfiable < HTTPClientError # 416
- HAS_BODY = true
- end
- class HTTPExpectationFailed < HTTPClientError # 417
- HAS_BODY = true
- end
-
- class HTTPInternalServerError < HTTPServerError # 500
- HAS_BODY = true
- end
- class HTTPNotImplemented < HTTPServerError # 501
- HAS_BODY = true
- end
- class HTTPBadGateway < HTTPServerError # 502
- HAS_BODY = true
- end
- class HTTPServiceUnavailable < HTTPServerError # 503
- HAS_BODY = true
- end
- class HTTPGatewayTimeOut < HTTPServerError # 504
- HAS_BODY = true
- end
- class HTTPVersionNotSupported < HTTPServerError # 505
- HAS_BODY = true
- end
-
- # :startdoc:
-
-
- class HTTPResponse # reopen
-
- CODE_CLASS_TO_OBJ = {
- '1' => HTTPInformation,
- '2' => HTTPSuccess,
- '3' => HTTPRedirection,
- '4' => HTTPClientError,
- '5' => HTTPServerError
- }
- CODE_TO_OBJ = {
- '100' => HTTPContinue,
- '101' => HTTPSwitchProtocol,
-
- '200' => HTTPOK,
- '201' => HTTPCreated,
- '202' => HTTPAccepted,
- '203' => HTTPNonAuthoritativeInformation,
- '204' => HTTPNoContent,
- '205' => HTTPResetContent,
- '206' => HTTPPartialContent,
-
- '300' => HTTPMultipleChoice,
- '301' => HTTPMovedPermanently,
- '302' => HTTPFound,
- '303' => HTTPSeeOther,
- '304' => HTTPNotModified,
- '305' => HTTPUseProxy,
- '307' => HTTPTemporaryRedirect,
-
- '400' => HTTPBadRequest,
- '401' => HTTPUnauthorized,
- '402' => HTTPPaymentRequired,
- '403' => HTTPForbidden,
- '404' => HTTPNotFound,
- '405' => HTTPMethodNotAllowed,
- '406' => HTTPNotAcceptable,
- '407' => HTTPProxyAuthenticationRequired,
- '408' => HTTPRequestTimeOut,
- '409' => HTTPConflict,
- '410' => HTTPGone,
- '411' => HTTPLengthRequired,
- '412' => HTTPPreconditionFailed,
- '413' => HTTPRequestEntityTooLarge,
- '414' => HTTPRequestURITooLong,
- '415' => HTTPUnsupportedMediaType,
- '416' => HTTPRequestedRangeNotSatisfiable,
- '417' => HTTPExpectationFailed,
-
- '500' => HTTPInternalServerError,
- '501' => HTTPNotImplemented,
- '502' => HTTPBadGateway,
- '503' => HTTPServiceUnavailable,
- '504' => HTTPGatewayTimeOut,
- '505' => HTTPVersionNotSupported
- }
-
- class << HTTPResponse
- def read_new(sock) #:nodoc: internal use only
- httpv, code, msg = read_status_line(sock)
- res = response_class(code).new(httpv, code, msg)
- each_response_header(sock) do |k,v|
- res.add_field k, v
- end
- res
- end
-
- private
-
- def read_status_line(sock)
- str = sock.readline
- m = /\AHTTP(?:\/(\d+\.\d+))?\s+(\d\d\d)\s*(.*)\z/in.match(str) or
- raise HTTPBadResponse, "wrong status line: #{str.dump}"
- m.captures
- end
-
- def response_class(code)
- CODE_TO_OBJ[code] or
- CODE_CLASS_TO_OBJ[code[0,1]] or
- HTTPUnknownResponse
- end
-
- def each_response_header(sock)
- key = value = nil
- while true
- line = sock.readuntil("\n", true).sub(/\s+\z/, '')
- break if line.empty?
- if line[0] == ?\s or line[0] == ?\t and value
- value << ' ' unless value.empty?
- value << line.strip
- else
- yield key, value if key
- key, value = line.strip.split(/\s*:\s*/, 2)
- raise HTTPBadResponse, 'wrong header line format' if value.nil?
- end
- end
- yield key, value if key
- end
- end
-
- # next is to fix bug in RDoc, where the private inside class << self
- # spills out.
- public
-
- include HTTPHeader
-
- def initialize(httpv, code, msg) #:nodoc: internal use only
- @http_version = httpv
- @code = code
- @message = msg
- initialize_http_header nil
- @body = nil
- @read = false
- end
-
- # The HTTP version supported by the server.
- attr_reader :http_version
-
- # The HTTP result code string. For example, '302'. You can also
- # determine the response type by examining which response subclass
- # the response object is an instance of.
- attr_reader :code
-
- # The HTTP result message sent by the server. For example, 'Not Found'.
- attr_reader :message
- alias msg message # :nodoc: obsolete
-
- def inspect
- "#<#{self.class} #{@code} #{@message} readbody=#{@read}>"
- end
-
- #
- # response <-> exception relationship
- #
-
- def code_type #:nodoc:
- self.class
- end
-
- def error! #:nodoc:
- raise error_type().new(@code + ' ' + @message.dump, self)
- end
-
- def error_type #:nodoc:
- self.class::EXCEPTION_TYPE
- end
-
- # Raises an HTTP error if the response is not 2xx (success).
- def value
- error! unless self.kind_of?(HTTPSuccess)
- end
-
- #
- # header (for backward compatibility only; DO NOT USE)
- #
-
- def response #:nodoc:
- warn "#{caller(1)[0]}: warning: HTTPResponse#response is obsolete" if $VERBOSE
- self
- end
-
- def header #:nodoc:
- warn "#{caller(1)[0]}: warning: HTTPResponse#header is obsolete" if $VERBOSE
- self
- end
-
- def read_header #:nodoc:
- warn "#{caller(1)[0]}: warning: HTTPResponse#read_header is obsolete" if $VERBOSE
- self
- end
-
- #
- # body
- #
-
- def reading_body(sock, reqmethodallowbody) #:nodoc: internal use only
- @socket = sock
- @body_exist = reqmethodallowbody && self.class.body_permitted?
- begin
- yield
- self.body # ensure to read body
- ensure
- @socket = nil
- end
- end
-
- # Gets the entity body returned by the remote HTTP server.
- #
- # If a block is given, the body is passed to the block, and
- # the body is provided in fragments, as it is read in from the socket.
- #
- # Calling this method a second or subsequent time for the same
- # HTTPResponse object will return the value already read.
- #
- # http.request_get('/index.html') {|res|
- # puts res.read_body
- # }
- #
- # http.request_get('/index.html') {|res|
- # p res.read_body.object_id # 538149362
- # p res.read_body.object_id # 538149362
- # }
- #
- # # using iterator
- # http.request_get('/index.html') {|res|
- # res.read_body do |segment|
- # print segment
- # end
- # }
- #
- def read_body(dest = nil, &block)
- if @read
- raise IOError, "#{self.class}\#read_body called twice" if dest or block
- return @body
- end
- to = procdest(dest, block)
- stream_check
- if @body_exist
- read_body_0 to
- @body = to
- else
- @body = nil
- end
- @read = true
-
- @body
- end
-
- # Returns the full entity body.
- #
- # Calling this method a second or subsequent time will return the
- # string already read.
- #
- # http.request_get('/index.html') {|res|
- # puts res.body
- # }
- #
- # http.request_get('/index.html') {|res|
- # p res.body.object_id # 538149362
- # p res.body.object_id # 538149362
- # }
- #
- def body
- read_body()
- end
-
- # Because it may be necessary to modify the body, Eg, decompression
- # this method facilitates that.
- def body=(value)
- @body = value
- end
-
- alias entity body #:nodoc: obsolete
-
- private
-
- def read_body_0(dest)
- if chunked?
- read_chunked dest
- return
- end
- clen = content_length()
- if clen
- @socket.read clen, dest, true # ignore EOF
- return
- end
- clen = range_length()
- if clen
- @socket.read clen, dest
- return
- end
- @socket.read_all dest
- end
-
- def read_chunked(dest)
- len = nil
- total = 0
- while true
- line = @socket.readline
- hexlen = line.slice(/[0-9a-fA-F]+/) or
- raise HTTPBadResponse, "wrong chunk size line: #{line}"
- len = hexlen.hex
- break if len == 0
- begin
- @socket.read len, dest
- ensure
- total += len
- @socket.read 2 # \r\n
- end
- end
- until @socket.readline.empty?
- # none
- end
- end
-
- def stream_check
- raise IOError, 'attempt to read body out of block' if @socket.closed?
- end
-
- def procdest(dest, block)
- raise ArgumentError, 'both arg and block given for HTTP method' \
- if dest and block
- if block
- ReadAdapter.new(block)
- else
- dest || ''
- end
- end
-
- end
-
-
- # :enddoc:
-
- #--
- # for backward compatibility
- class HTTP
- ProxyMod = ProxyDelta
- end
- module NetPrivate
- HTTPRequest = ::Net::HTTPRequest
- end
+require 'net/http/proxy_delta'
- HTTPInformationCode = HTTPInformation
- HTTPSuccessCode = HTTPSuccess
- HTTPRedirectionCode = HTTPRedirection
- HTTPRetriableCode = HTTPRedirection
- HTTPClientErrorCode = HTTPClientError
- HTTPFatalErrorCode = HTTPClientError
- HTTPServerErrorCode = HTTPServerError
- HTTPResponceReceiver = HTTPResponse
+require 'net/http/backward'
-end # module Net
diff --git a/lib/net/http/backward.rb b/lib/net/http/backward.rb
new file mode 100644
index 0000000000..faf47b8489
--- /dev/null
+++ b/lib/net/http/backward.rb
@@ -0,0 +1,25 @@
+# for backward compatibility
+
+# :enddoc:
+
+class Net::HTTP
+ ProxyMod = ProxyDelta
+end
+
+module Net
+ HTTPSession = Net::HTTP
+end
+
+module Net::NetPrivate
+ HTTPRequest = ::Net::HTTPRequest
+end
+
+Net::HTTPInformationCode = Net::HTTPInformation
+Net::HTTPSuccessCode = Net::HTTPSuccess
+Net::HTTPRedirectionCode = Net::HTTPRedirection
+Net::HTTPRetriableCode = Net::HTTPRedirection
+Net::HTTPClientErrorCode = Net::HTTPClientError
+Net::HTTPFatalErrorCode = Net::HTTPClientError
+Net::HTTPServerErrorCode = Net::HTTPServerError
+Net::HTTPResponceReceiver = Net::HTTPResponse
+
diff --git a/lib/net/http/exceptions.rb b/lib/net/http/exceptions.rb
new file mode 100644
index 0000000000..6c5d81cb04
--- /dev/null
+++ b/lib/net/http/exceptions.rb
@@ -0,0 +1,25 @@
+# Net::HTTP exception class.
+# You cannot use Net::HTTPExceptions directly; instead, you must use
+# its subclasses.
+module Net::HTTPExceptions
+ def initialize(msg, res) #:nodoc:
+ super msg
+ @response = res
+ end
+ attr_reader :response
+ alias data response #:nodoc: obsolete
+end
+class Net::HTTPError < Net::ProtocolError
+ include Net::HTTPExceptions
+end
+class Net::HTTPRetriableError < Net::ProtoRetriableError
+ include Net::HTTPExceptions
+end
+class Net::HTTPServerException < Net::ProtoServerError
+ # We cannot use the name "HTTPServerError", it is the name of the response.
+ include Net::HTTPExceptions
+end
+class Net::HTTPFatalError < Net::ProtoFatalError
+ include Net::HTTPExceptions
+end
+
diff --git a/lib/net/http/generic_request.rb b/lib/net/http/generic_request.rb
new file mode 100644
index 0000000000..b51034c7ea
--- /dev/null
+++ b/lib/net/http/generic_request.rb
@@ -0,0 +1,329 @@
+# HTTPGenericRequest is the parent of the HTTPRequest class.
+# Do not use this directly; use a subclass of HTTPRequest.
+#
+# Mixes in the HTTPHeader module to provide easier access to HTTP headers.
+#
+class Net::HTTPGenericRequest
+
+ include Net::HTTPHeader
+
+ def initialize(m, reqbody, resbody, uri_or_path, initheader = nil)
+ @method = m
+ @request_has_body = reqbody
+ @response_has_body = resbody
+
+ 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
+ else
+ @uri = nil
+ host = nil
+ path = uri_or_path
+ end
+
+ raise ArgumentError, "no HTTP request path given" unless path
+ raise ArgumentError, "HTTP request path is empty" if path.empty?
+ @path = path
+
+ @decode_content = false
+
+ if @response_has_body and Net::HTTP::HAVE_ZLIB then
+ if !initheader ||
+ !initheader.keys.any? { |k|
+ %w[accept-encoding range].include? k.downcase
+ } then
+ @decode_content = true
+ initheader = initheader ? initheader.dup : {}
+ initheader["accept-encoding"] =
+ "gzip;q=1.0,deflate;q=0.6,identity;q=0.3"
+ end
+ end
+
+ initialize_http_header initheader
+ self['Accept'] ||= '*/*'
+ self['User-Agent'] ||= 'Ruby'
+ self['Host'] ||= host
+ @body = nil
+ @body_stream = nil
+ @body_data = nil
+ end
+
+ attr_reader :method
+ attr_reader :path
+ attr_reader :uri
+
+ # Automatically set to false if the user sets the Accept-Encoding header.
+ # This indicates they wish to handle Content-encoding in responses
+ # themselves.
+ attr_reader :decode_content
+
+ def inspect
+ "\#<#{self.class} #{@method}>"
+ end
+
+ ##
+ # Don't automatically decode response content-encoding if the user indicates
+ # they want to handle it.
+
+ def []=(key, val) # :nodoc:
+ @decode_content = false if key.downcase == 'accept-encoding'
+
+ super key, val
+ end
+
+ def request_body_permitted?
+ @request_has_body
+ end
+
+ def response_body_permitted?
+ @response_has_body
+ end
+
+ def body_exist?
+ warn "Net::HTTPRequest#body_exist? is obsolete; use response_body_permitted?" if $VERBOSE
+ response_body_permitted?
+ end
+
+ attr_reader :body
+
+ def body=(str)
+ @body = str
+ @body_stream = nil
+ @body_data = nil
+ str
+ end
+
+ attr_reader :body_stream
+
+ def body_stream=(input)
+ @body = nil
+ @body_stream = input
+ @body_data = nil
+ input
+ end
+
+ def set_body_internal(str) #:nodoc: internal use only
+ raise ArgumentError, "both of body argument and HTTPRequest#body set" if str and (@body or @body_stream)
+ self.body = str if str
+ if @body.nil? && @body_stream.nil? && @body_data.nil? && request_body_permitted?
+ self.body = ''
+ end
+ end
+
+ #
+ # write
+ #
+
+ 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
+ send_request_with_body_stream sock, ver, path, @body_stream
+ elsif @body_data
+ send_request_with_body_data sock, ver, path, @body_data
+ else
+ write_header sock, ver, path
+ end
+ end
+
+ def update_uri(host, port, ssl) # :nodoc: internal use only
+ return unless @uri
+
+ @uri.host ||= host
+ @uri.port = port
+
+ scheme = ssl ? 'https' : 'http'
+
+ # convert the class of the URI
+ unless scheme == @uri.scheme then
+ new_uri = @uri.to_s.sub(/^https?/, scheme)
+ @uri = URI new_uri
+ end
+
+ @uri
+ end
+
+ private
+
+ class Chunker #:nodoc:
+ def initialize(sock)
+ @sock = sock
+ @prev = nil
+ end
+
+ def write(buf)
+ # avoid memcpy() of buf, buf can huge and eat memory bandwidth
+ @sock.write("#{buf.bytesize.to_s(16)}\r\n")
+ rv = @sock.write(buf)
+ @sock.write("\r\n")
+ rv
+ end
+
+ def finish
+ @sock.write("0\r\n\r\n")
+ end
+ end
+
+ def send_request_with_body(sock, ver, path, body)
+ self.content_length = body.bytesize
+ delete 'Transfer-Encoding'
+ supply_default_content_type
+ write_header sock, ver, path
+ wait_for_continue sock, ver if sock.continue_timeout
+ sock.write body
+ end
+
+ def send_request_with_body_stream(sock, ver, path, f)
+ unless content_length() or chunked?
+ raise ArgumentError,
+ "Content-Length not given and Transfer-Encoding is not `chunked'"
+ end
+ supply_default_content_type
+ write_header sock, ver, path
+ wait_for_continue sock, ver if sock.continue_timeout
+ if chunked?
+ chunker = Chunker.new(sock)
+ IO.copy_stream(f, chunker)
+ chunker.finish
+ else
+ # copy_stream can sendfile() to sock.io unless we use SSL.
+ # If sock.io is an SSLSocket, copy_stream will hit SSL_write()
+ IO.copy_stream(f, sock.io)
+ end
+ end
+
+ def send_request_with_body_data(sock, ver, path, params)
+ if /\Amultipart\/form-data\z/i !~ self.content_type
+ self.content_type = 'application/x-www-form-urlencoded'
+ return send_request_with_body(sock, ver, path, URI.encode_www_form(params))
+ end
+
+ opt = @form_option.dup
+ require 'securerandom' unless defined?(SecureRandom)
+ opt[:boundary] ||= SecureRandom.urlsafe_base64(40)
+ self.set_content_type(self.content_type, boundary: opt[:boundary])
+ if chunked?
+ write_header sock, ver, path
+ encode_multipart_form_data(sock, params, opt)
+ else
+ require 'tempfile'
+ file = Tempfile.new('multipart')
+ file.binmode
+ encode_multipart_form_data(file, params, opt)
+ file.rewind
+ self.content_length = file.size
+ write_header sock, ver, path
+ IO.copy_stream(file, sock)
+ file.close(true)
+ end
+ end
+
+ def encode_multipart_form_data(out, params, opt)
+ charset = opt[:charset]
+ boundary = opt[:boundary]
+ require 'securerandom' unless defined?(SecureRandom)
+ boundary ||= SecureRandom.urlsafe_base64(40)
+ chunked_p = chunked?
+
+ buf = ''
+ params.each do |key, value, h={}|
+ key = quote_string(key, charset)
+ filename =
+ h.key?(:filename) ? h[:filename] :
+ value.respond_to?(:to_path) ? File.basename(value.to_path) :
+ nil
+
+ buf << "--#{boundary}\r\n"
+ if filename
+ filename = quote_string(filename, charset)
+ type = h[:content_type] || 'application/octet-stream'
+ buf << "Content-Disposition: form-data; " \
+ "name=\"#{key}\"; filename=\"#{filename}\"\r\n" \
+ "Content-Type: #{type}\r\n\r\n"
+ if !out.respond_to?(:write) || !value.respond_to?(:read)
+ # if +out+ is not an IO or +value+ is not an IO
+ buf << (value.respond_to?(:read) ? value.read : value)
+ elsif value.respond_to?(:size) && chunked_p
+ # if +out+ is an IO and +value+ is a File, use IO.copy_stream
+ flush_buffer(out, buf, chunked_p)
+ out << "%x\r\n" % value.size if chunked_p
+ IO.copy_stream(value, out)
+ out << "\r\n" if chunked_p
+ else
+ # +out+ is an IO, and +value+ is not a File but an IO
+ flush_buffer(out, buf, chunked_p)
+ 1 while flush_buffer(out, value.read(4096), chunked_p)
+ end
+ else
+ # non-file field:
+ # HTML5 says, "The parts of the generated multipart/form-data
+ # resource that correspond to non-file fields must not have a
+ # Content-Type header specified."
+ buf << "Content-Disposition: form-data; name=\"#{key}\"\r\n\r\n"
+ buf << (value.respond_to?(:read) ? value.read : value)
+ end
+ buf << "\r\n"
+ end
+ buf << "--#{boundary}--\r\n"
+ flush_buffer(out, buf, chunked_p)
+ out << "0\r\n\r\n" if chunked_p
+ end
+
+ def quote_string(str, charset)
+ str = str.encode(charset, fallback:->(c){'&#%d;'%c.encode("UTF-8").ord}) if charset
+ str.gsub(/[\\"]/, '\\\\\&')
+ end
+
+ def flush_buffer(out, buf, chunked_p)
+ return unless buf
+ out << "%x\r\n"%buf.bytesize if chunked_p
+ out << buf
+ out << "\r\n" if chunked_p
+ buf.clear
+ end
+
+ def supply_default_content_type
+ return if content_type()
+ warn 'net/http: warning: Content-Type did not set; using application/x-www-form-urlencoded' if $VERBOSE
+ set_content_type 'application/x-www-form-urlencoded'
+ end
+
+ ##
+ # Waits up to the continue timeout for a response from the server provided
+ # we're speaking HTTP 1.1 and are expecting a 100-continue response.
+
+ def wait_for_continue(sock, ver)
+ if ver >= '1.1' and @header['expect'] and
+ @header['expect'].include?('100-continue')
+ if IO.select([sock.io], nil, nil, sock.continue_timeout)
+ res = Net::HTTPResponse.read_new(sock)
+ unless res.kind_of?(Net::HTTPContinue)
+ res.decode_content = @decode_content
+ throw :response, res
+ end
+ end
+ end
+ end
+
+ def write_header(sock, ver, path)
+ buf = "#{@method} #{path} HTTP/#{ver}\r\n"
+ each_capitalized do |k,v|
+ buf << "#{k}: #{v}\r\n"
+ end
+ buf << "\r\n"
+ sock.write buf
+ end
+
+end
+
diff --git a/lib/net/http/header.rb b/lib/net/http/header.rb
new file mode 100644
index 0000000000..029b647b5e
--- /dev/null
+++ b/lib/net/http/header.rb
@@ -0,0 +1,452 @@
+# The HTTPHeader module defines methods for reading and writing
+# HTTP headers.
+#
+# It is used as a mixin by other classes, to provide hash-like
+# access to HTTP header values. Unlike raw hash access, HTTPHeader
+# provides access via case-insensitive keys. It also provides
+# methods for accessing commonly-used HTTP header values in more
+# convenient formats.
+#
+module Net::HTTPHeader
+
+ def initialize_http_header(initheader)
+ @header = {}
+ return unless initheader
+ initheader.each do |key, value|
+ warn "net/http: warning: duplicated HTTP header: #{key}" if key?(key) and $VERBOSE
+ @header[key.downcase] = [value.strip]
+ end
+ end
+
+ def size #:nodoc: obsolete
+ @header.size
+ end
+
+ alias length size #:nodoc: obsolete
+
+ # Returns the header field corresponding to the case-insensitive key.
+ # For example, a key of "Content-Type" might return "text/html"
+ def [](key)
+ a = @header[key.downcase] or return nil
+ a.join(', ')
+ end
+
+ # Sets the header field corresponding to the case-insensitive key.
+ def []=(key, val)
+ unless val
+ @header.delete key.downcase
+ return val
+ end
+ @header[key.downcase] = [val]
+ end
+
+ # [Ruby 1.8.3]
+ # Adds a value to a named header field, instead of replacing its value.
+ # Second argument +val+ must be a String.
+ # See also #[]=, #[] and #get_fields.
+ #
+ # request.add_field 'X-My-Header', 'a'
+ # p request['X-My-Header'] #=> "a"
+ # p request.get_fields('X-My-Header') #=> ["a"]
+ # request.add_field 'X-My-Header', 'b'
+ # p request['X-My-Header'] #=> "a, b"
+ # p request.get_fields('X-My-Header') #=> ["a", "b"]
+ # request.add_field 'X-My-Header', 'c'
+ # p request['X-My-Header'] #=> "a, b, c"
+ # p request.get_fields('X-My-Header') #=> ["a", "b", "c"]
+ #
+ def add_field(key, val)
+ if @header.key?(key.downcase)
+ @header[key.downcase].push val
+ else
+ @header[key.downcase] = [val]
+ end
+ end
+
+ # [Ruby 1.8.3]
+ # Returns an array of header field strings corresponding to the
+ # case-insensitive +key+. This method allows you to get duplicated
+ # header fields without any processing. See also #[].
+ #
+ # p response.get_fields('Set-Cookie')
+ # #=> ["session=al98axx; expires=Fri, 31-Dec-1999 23:58:23",
+ # "query=rubyscript; expires=Fri, 31-Dec-1999 23:58:23"]
+ # p response['Set-Cookie']
+ # #=> "session=al98axx; expires=Fri, 31-Dec-1999 23:58:23, query=rubyscript; expires=Fri, 31-Dec-1999 23:58:23"
+ #
+ def get_fields(key)
+ return nil unless @header[key.downcase]
+ @header[key.downcase].dup
+ end
+
+ # Returns the header field corresponding to the case-insensitive key.
+ # Returns the default value +args+, or the result of the block, or
+ # raises an IndexError if there's no header field named +key+
+ # See Hash#fetch
+ def fetch(key, *args, &block) #:yield: +key+
+ a = @header.fetch(key.downcase, *args, &block)
+ a.kind_of?(Array) ? a.join(', ') : a
+ end
+
+ # Iterates through the header names and values, passing in the name
+ # and value to the code block supplied.
+ #
+ # Example:
+ #
+ # response.header.each_header {|key,value| puts "#{key} = #{value}" }
+ #
+ def each_header #:yield: +key+, +value+
+ block_given? or return enum_for(__method__)
+ @header.each do |k,va|
+ yield k, va.join(', ')
+ end
+ end
+
+ alias each each_header
+
+ # Iterates through the header names in the header, passing
+ # each header name to the code block.
+ def each_name(&block) #:yield: +key+
+ block_given? or return enum_for(__method__)
+ @header.each_key(&block)
+ end
+
+ alias each_key each_name
+
+ # Iterates through the header names in the header, passing
+ # capitalized header names to the code block.
+ #
+ # Note that header names are capitalized systematically;
+ # capitalization may not match that used by the remote HTTP
+ # server in its response.
+ def each_capitalized_name #:yield: +key+
+ block_given? or return enum_for(__method__)
+ @header.each_key do |k|
+ yield capitalize(k)
+ end
+ end
+
+ # Iterates through header values, passing each value to the
+ # code block.
+ def each_value #:yield: +value+
+ block_given? or return enum_for(__method__)
+ @header.each_value do |va|
+ yield va.join(', ')
+ end
+ end
+
+ # Removes a header field, specified by case-insensitive key.
+ def delete(key)
+ @header.delete(key.downcase)
+ end
+
+ # true if +key+ header exists.
+ def key?(key)
+ @header.key?(key.downcase)
+ end
+
+ # Returns a Hash consisting of header names and values.
+ # e.g.
+ # {"cache-control" => "private",
+ # "content-type" => "text/html",
+ # "date" => "Wed, 22 Jun 2005 22:11:50 GMT"}
+ def to_hash
+ @header.dup
+ end
+
+ # As for #each_header, except the keys are provided in capitalized form.
+ #
+ # Note that header names are capitalized systematically;
+ # capitalization may not match that used by the remote HTTP
+ # server in its response.
+ def each_capitalized
+ block_given? or return enum_for(__method__)
+ @header.each do |k,v|
+ yield capitalize(k), v.join(', ')
+ end
+ end
+
+ alias canonical_each each_capitalized
+
+ def capitalize(name)
+ name.split(/-/).map {|s| s.capitalize }.join('-')
+ end
+ private :capitalize
+
+ # Returns an Array of Range objects which represent the Range:
+ # HTTP header field, or +nil+ if there is no such header.
+ def range
+ return nil unless @header['range']
+
+ value = self['Range']
+ # byte-range-set = *( "," OWS ) ( byte-range-spec / suffix-byte-range-spec )
+ # *( OWS "," [ OWS ( byte-range-spec / suffix-byte-range-spec ) ] )
+ # corrected collected ABNF
+ # http://tools.ietf.org/html/draft-ietf-httpbis-p5-range-19#section-5.4.1
+ # http://tools.ietf.org/html/draft-ietf-httpbis-p5-range-19#appendix-C
+ # http://tools.ietf.org/html/draft-ietf-httpbis-p1-messaging-19#section-3.2.5
+ unless /\Abytes=((?:,[ \t]*)*(?:\d+-\d*|-\d+)(?:[ \t]*,(?:[ \t]*\d+-\d*|-\d+)?)*)\z/ =~ value
+ raise Net::HTTPHeaderSyntaxError, "invalid syntax for byte-ranges-specifier: '#{value}'"
+ end
+
+ byte_range_set = $1
+ result = byte_range_set.split(/,/).map {|spec|
+ m = /(\d+)?\s*-\s*(\d+)?/i.match(spec) or
+ raise Net::HTTPHeaderSyntaxError, "invalid byte-range-spec: '#{spec}'"
+ d1 = m[1].to_i
+ d2 = m[2].to_i
+ if m[1] and m[2]
+ if d1 > d2
+ raise Net::HTTPHeaderSyntaxError, "last-byte-pos MUST greater than or equal to first-byte-pos but '#{spec}'"
+ end
+ d1..d2
+ elsif m[1]
+ d1..-1
+ elsif m[2]
+ -d2..-1
+ else
+ raise Net::HTTPHeaderSyntaxError, 'range is not specified'
+ end
+ }
+ # if result.empty?
+ # byte-range-set must include at least one byte-range-spec or suffix-byte-range-spec
+ # but above regexp already denies it.
+ if result.size == 1 && result[0].begin == 0 && result[0].end == -1
+ raise Net::HTTPHeaderSyntaxError, 'only one suffix-byte-range-spec with zero suffix-length'
+ end
+ result
+ end
+
+ # Sets the HTTP Range: header.
+ # Accepts either a Range object as a single argument,
+ # or a beginning index and a length from that index.
+ # Example:
+ #
+ # req.range = (0..1023)
+ # req.set_range 0, 1023
+ #
+ def set_range(r, e = nil)
+ unless r
+ @header.delete 'range'
+ return r
+ end
+ r = (r...r+e) if e
+ case r
+ when Numeric
+ n = r.to_i
+ rangestr = (n > 0 ? "0-#{n-1}" : "-#{-n}")
+ when Range
+ first = r.first
+ last = r.end
+ last -= 1 if r.exclude_end?
+ if last == -1
+ rangestr = (first > 0 ? "#{first}-" : "-#{-first}")
+ else
+ raise Net::HTTPHeaderSyntaxError, 'range.first is negative' if first < 0
+ raise Net::HTTPHeaderSyntaxError, 'range.last is negative' if last < 0
+ raise Net::HTTPHeaderSyntaxError, 'must be .first < .last' if first > last
+ rangestr = "#{first}-#{last}"
+ end
+ else
+ raise TypeError, 'Range/Integer is required'
+ end
+ @header['range'] = ["bytes=#{rangestr}"]
+ r
+ end
+
+ alias range= set_range
+
+ # Returns an Integer object which represents the HTTP Content-Length:
+ # header field, or +nil+ if that field was not provided.
+ def content_length
+ return nil unless key?('Content-Length')
+ len = self['Content-Length'].slice(/\d+/) or
+ raise Net::HTTPHeaderSyntaxError, 'wrong Content-Length format'
+ len.to_i
+ end
+
+ def content_length=(len)
+ unless len
+ @header.delete 'content-length'
+ return nil
+ end
+ @header['content-length'] = [len.to_i.to_s]
+ end
+
+ # Returns "true" if the "transfer-encoding" header is present and
+ # set to "chunked". This is an HTTP/1.1 feature, allowing the
+ # the content to be sent in "chunks" without at the outset
+ # stating the entire content length.
+ def chunked?
+ return false unless @header['transfer-encoding']
+ field = self['Transfer-Encoding']
+ (/(?:\A|[^\-\w])chunked(?![\-\w])/i =~ field) ? true : false
+ end
+
+ # Returns a Range object which represents the value of the Content-Range:
+ # header field.
+ # For a partial entity body, this indicates where this fragment
+ # fits inside the full entity body, as range of byte offsets.
+ def content_range
+ return nil unless @header['content-range']
+ m = %r<bytes\s+(\d+)-(\d+)/(\d+|\*)>i.match(self['Content-Range']) or
+ raise Net::HTTPHeaderSyntaxError, 'wrong Content-Range format'
+ m[1].to_i .. m[2].to_i
+ end
+
+ # The length of the range represented in Content-Range: header.
+ def range_length
+ r = content_range() or return nil
+ r.end - r.begin + 1
+ end
+
+ # Returns a content type string such as "text/html".
+ # This method returns nil if Content-Type: header field does not exist.
+ def content_type
+ return nil unless main_type()
+ if sub_type()
+ then "#{main_type()}/#{sub_type()}"
+ else main_type()
+ end
+ end
+
+ # Returns a content type string such as "text".
+ # This method returns nil if Content-Type: header field does not exist.
+ def main_type
+ return nil unless @header['content-type']
+ self['Content-Type'].split(';').first.to_s.split('/')[0].to_s.strip
+ end
+
+ # Returns a content type string such as "html".
+ # This method returns nil if Content-Type: header field does not exist
+ # or sub-type is not given (e.g. "Content-Type: text").
+ def sub_type
+ return nil unless @header['content-type']
+ _, sub = *self['Content-Type'].split(';').first.to_s.split('/')
+ return nil unless sub
+ sub.strip
+ end
+
+ # Any parameters specified for the content type, returned as a Hash.
+ # For example, a header of Content-Type: text/html; charset=EUC-JP
+ # would result in type_params returning {'charset' => 'EUC-JP'}
+ def type_params
+ result = {}
+ list = self['Content-Type'].to_s.split(';')
+ list.shift
+ list.each do |param|
+ k, v = *param.split('=', 2)
+ result[k.strip] = v.strip
+ end
+ result
+ end
+
+ # Sets the content type in an HTTP header.
+ # The +type+ should be a full HTTP content type, e.g. "text/html".
+ # The +params+ are an optional Hash of parameters to add after the
+ # content type, e.g. {'charset' => 'iso-8859-1'}
+ def set_content_type(type, params = {})
+ @header['content-type'] = [type + params.map{|k,v|"; #{k}=#{v}"}.join('')]
+ end
+
+ alias content_type= set_content_type
+
+ # Set header fields and a body from HTML form data.
+ # +params+ should be an Array of Arrays or
+ # a Hash containing HTML form data.
+ # Optional argument +sep+ means data record separator.
+ #
+ # Values are URL encoded as necessary and the content-type is set to
+ # application/x-www-form-urlencoded
+ #
+ # Example:
+ # http.form_data = {"q" => "ruby", "lang" => "en"}
+ # http.form_data = {"q" => ["ruby", "perl"], "lang" => "en"}
+ # http.set_form_data({"q" => "ruby", "lang" => "en"}, ';')
+ #
+ def set_form_data(params, sep = '&')
+ query = URI.encode_www_form(params)
+ query.gsub!(/&/, sep) if sep != '&'
+ self.body = query
+ self.content_type = 'application/x-www-form-urlencoded'
+ end
+
+ alias form_data= set_form_data
+
+ # Set a HTML form data set.
+ # +params+ is the form data set; it is an Array of Arrays or a Hash
+ # +enctype is the type to encode the form data set.
+ # It is application/x-www-form-urlencoded or multipart/form-data.
+ # +formpot+ is an optional hash to specify the detail.
+ #
+ # boundary:: the boundary of the multipart message
+ # charset:: the charset of the message. All names and the values of
+ # non-file fields are encoded as the charset.
+ #
+ # Each item of params is an array and contains following items:
+ # +name+:: the name of the field
+ # +value+:: the value of the field, it should be a String or a File
+ # +opt+:: an optional hash to specify additional information
+ #
+ # Each item is a file field or a normal field.
+ # If +value+ is a File object or the +opt+ have a filename key,
+ # the item is treated as a file field.
+ #
+ # If Transfer-Encoding is set as chunked, this send the request in
+ # chunked encoding. Because chunked encoding is HTTP/1.1 feature,
+ # you must confirm the server to support HTTP/1.1 before sending it.
+ #
+ # Example:
+ # http.set_form([["q", "ruby"], ["lang", "en"]])
+ #
+ # See also RFC 2388, RFC 2616, HTML 4.01, and HTML5
+ #
+ def set_form(params, enctype='application/x-www-form-urlencoded', formopt={})
+ @body_data = params
+ @body = nil
+ @body_stream = nil
+ @form_option = formopt
+ case enctype
+ when /\Aapplication\/x-www-form-urlencoded\z/i,
+ /\Amultipart\/form-data\z/i
+ self.content_type = enctype
+ else
+ raise ArgumentError, "invalid enctype: #{enctype}"
+ end
+ end
+
+ # Set the Authorization: header for "Basic" authorization.
+ def basic_auth(account, password)
+ @header['authorization'] = [basic_encode(account, password)]
+ end
+
+ # Set Proxy-Authorization: header for "Basic" authorization.
+ def proxy_basic_auth(account, password)
+ @header['proxy-authorization'] = [basic_encode(account, password)]
+ end
+
+ def basic_encode(account, password)
+ 'Basic ' + ["#{account}:#{password}"].pack('m').delete("\r\n")
+ end
+ private :basic_encode
+
+ def connection_close?
+ tokens(@header['connection']).include?('close') or
+ tokens(@header['proxy-connection']).include?('close')
+ end
+
+ def connection_keep_alive?
+ tokens(@header['connection']).include?('keep-alive') or
+ tokens(@header['proxy-connection']).include?('keep-alive')
+ end
+
+ def tokens(vals)
+ return [] unless vals
+ vals.map {|v| v.split(',') }.flatten\
+ .reject {|str| str.strip.empty? }\
+ .map {|tok| tok.strip.downcase }
+ end
+ private :tokens
+
+end
+
diff --git a/lib/net/http/proxy_delta.rb b/lib/net/http/proxy_delta.rb
new file mode 100644
index 0000000000..b16c9f1ed8
--- /dev/null
+++ b/lib/net/http/proxy_delta.rb
@@ -0,0 +1,16 @@
+module Net::HTTP::ProxyDelta #:nodoc: internal use only
+ private
+
+ def conn_address
+ proxy_address()
+ end
+
+ def conn_port
+ proxy_port()
+ end
+
+ def edit_path(path)
+ use_ssl? ? path : "http://#{addr_port()}#{path}"
+ end
+end
+
diff --git a/lib/net/http/request.rb b/lib/net/http/request.rb
new file mode 100644
index 0000000000..e8b0f48fcc
--- /dev/null
+++ b/lib/net/http/request.rb
@@ -0,0 +1,20 @@
+# HTTP request class.
+# This class wraps together the request header and the request path.
+# You cannot use this class directly. Instead, you should use one of its
+# subclasses: Net::HTTP::Get, Net::HTTP::Post, Net::HTTP::Head.
+#
+class Net::HTTPRequest < Net::HTTPGenericRequest
+ # Creates an HTTP request object for +path+.
+ #
+ # +initheader+ are the default headers to use. Net::HTTP adds
+ # Accept-Encoding to enable compression of the response body unless
+ # Accept-Encoding or Range are supplied in +initheader+.
+
+ def initialize(path, initheader = nil)
+ super self.class::METHOD,
+ self.class::REQUEST_HAS_BODY,
+ self.class::RESPONSE_HAS_BODY,
+ path, initheader
+ end
+end
+
diff --git a/lib/net/http/requests.rb b/lib/net/http/requests.rb
new file mode 100644
index 0000000000..ef719ea6e7
--- /dev/null
+++ b/lib/net/http/requests.rb
@@ -0,0 +1,122 @@
+#
+# HTTP/1.1 methods --- RFC2616
+#
+
+# See Net::HTTPGenericRequest for attributes and methods.
+# See Net::HTTP for usage examples.
+class Net::HTTP::Get < Net::HTTPRequest
+ METHOD = 'GET'
+ REQUEST_HAS_BODY = false
+ RESPONSE_HAS_BODY = true
+end
+
+# See Net::HTTPGenericRequest for attributes and methods.
+# See Net::HTTP for usage examples.
+class Net::HTTP::Head < Net::HTTPRequest
+ METHOD = 'HEAD'
+ REQUEST_HAS_BODY = false
+ RESPONSE_HAS_BODY = false
+end
+
+# See Net::HTTPGenericRequest for attributes and methods.
+# See Net::HTTP for usage examples.
+class Net::HTTP::Post < Net::HTTPRequest
+ METHOD = 'POST'
+ REQUEST_HAS_BODY = true
+ RESPONSE_HAS_BODY = true
+end
+
+# See Net::HTTPGenericRequest for attributes and methods.
+# See Net::HTTP for usage examples.
+class Net::HTTP::Put < Net::HTTPRequest
+ METHOD = 'PUT'
+ REQUEST_HAS_BODY = true
+ RESPONSE_HAS_BODY = true
+end
+
+# See Net::HTTPGenericRequest for attributes and methods.
+# See Net::HTTP for usage examples.
+class Net::HTTP::Delete < Net::HTTPRequest
+ METHOD = 'DELETE'
+ REQUEST_HAS_BODY = false
+ RESPONSE_HAS_BODY = true
+end
+
+# See Net::HTTPGenericRequest for attributes and methods.
+class Net::HTTP::Options < Net::HTTPRequest
+ METHOD = 'OPTIONS'
+ REQUEST_HAS_BODY = false
+ RESPONSE_HAS_BODY = false
+end
+
+# See Net::HTTPGenericRequest for attributes and methods.
+class Net::HTTP::Trace < Net::HTTPRequest
+ METHOD = 'TRACE'
+ REQUEST_HAS_BODY = false
+ RESPONSE_HAS_BODY = true
+end
+
+#
+# PATCH method --- RFC5789
+#
+
+# See Net::HTTPGenericRequest for attributes and methods.
+class Net::HTTP::Patch < Net::HTTPRequest
+ METHOD = 'PATCH'
+ REQUEST_HAS_BODY = true
+ RESPONSE_HAS_BODY = true
+end
+
+#
+# WebDAV methods --- RFC2518
+#
+
+# See Net::HTTPGenericRequest for attributes and methods.
+class Net::HTTP::Propfind < Net::HTTPRequest
+ METHOD = 'PROPFIND'
+ REQUEST_HAS_BODY = true
+ RESPONSE_HAS_BODY = true
+end
+
+# See Net::HTTPGenericRequest for attributes and methods.
+class Net::HTTP::Proppatch < Net::HTTPRequest
+ METHOD = 'PROPPATCH'
+ REQUEST_HAS_BODY = true
+ RESPONSE_HAS_BODY = true
+end
+
+# See Net::HTTPGenericRequest for attributes and methods.
+class Net::HTTP::Mkcol < Net::HTTPRequest
+ METHOD = 'MKCOL'
+ REQUEST_HAS_BODY = true
+ RESPONSE_HAS_BODY = true
+end
+
+# See Net::HTTPGenericRequest for attributes and methods.
+class Net::HTTP::Copy < Net::HTTPRequest
+ METHOD = 'COPY'
+ REQUEST_HAS_BODY = false
+ RESPONSE_HAS_BODY = true
+end
+
+# See Net::HTTPGenericRequest for attributes and methods.
+class Net::HTTP::Move < Net::HTTPRequest
+ METHOD = 'MOVE'
+ REQUEST_HAS_BODY = false
+ RESPONSE_HAS_BODY = true
+end
+
+# See Net::HTTPGenericRequest for attributes and methods.
+class Net::HTTP::Lock < Net::HTTPRequest
+ METHOD = 'LOCK'
+ REQUEST_HAS_BODY = true
+ RESPONSE_HAS_BODY = true
+end
+
+# See Net::HTTPGenericRequest for attributes and methods.
+class Net::HTTP::Unlock < Net::HTTPRequest
+ METHOD = 'UNLOCK'
+ REQUEST_HAS_BODY = true
+ RESPONSE_HAS_BODY = true
+end
+
diff --git a/lib/net/http/response.rb b/lib/net/http/response.rb
new file mode 100644
index 0000000000..da3e4b4c8c
--- /dev/null
+++ b/lib/net/http/response.rb
@@ -0,0 +1,405 @@
+# HTTP response class.
+#
+# This class wraps together the response header and the response body (the
+# entity requested).
+#
+# It mixes in the HTTPHeader module, which provides access to response
+# header values both via hash-like methods and via individual readers.
+#
+# Note that each possible HTTP response code defines its own
+# HTTPResponse subclass. These are listed below.
+#
+# All classes are defined under the Net module. Indentation indicates
+# inheritance. For a list of the classes see Net::HTTP.
+#
+#
+class Net::HTTPResponse
+ class << self
+ # true if the response has a body.
+ def body_permitted?
+ self::HAS_BODY
+ end
+
+ def exception_type # :nodoc: internal use only
+ self::EXCEPTION_TYPE
+ end
+
+ def read_new(sock) #:nodoc: internal use only
+ httpv, code, msg = read_status_line(sock)
+ res = response_class(code).new(httpv, code, msg)
+ each_response_header(sock) do |k,v|
+ res.add_field k, v
+ end
+ res
+ end
+
+ private
+
+ def read_status_line(sock)
+ str = sock.readline
+ m = /\AHTTP(?:\/(\d+\.\d+))?\s+(\d\d\d)\s*(.*)\z/in.match(str) or
+ raise Net::HTTPBadResponse, "wrong status line: #{str.dump}"
+ m.captures
+ end
+
+ def response_class(code)
+ CODE_TO_OBJ[code] or
+ CODE_CLASS_TO_OBJ[code[0,1]] or
+ Net::HTTPUnknownResponse
+ end
+
+ def each_response_header(sock)
+ key = value = nil
+ while true
+ line = sock.readuntil("\n", true).sub(/\s+\z/, '')
+ break if line.empty?
+ if line[0] == ?\s or line[0] == ?\t and value
+ value << ' ' unless value.empty?
+ value << line.strip
+ else
+ yield key, value if key
+ key, value = line.strip.split(/\s*:\s*/, 2)
+ raise Net::HTTPBadResponse, 'wrong header line format' if value.nil?
+ end
+ end
+ yield key, value if key
+ end
+ end
+
+ # next is to fix bug in RDoc, where the private inside class << self
+ # spills out.
+ public
+
+ include Net::HTTPHeader
+
+ def initialize(httpv, code, msg) #:nodoc: internal use only
+ @http_version = httpv
+ @code = code
+ @message = msg
+ initialize_http_header nil
+ @body = nil
+ @read = false
+ @uri = nil
+ @decode_content = false
+ end
+
+ # The HTTP version supported by the server.
+ attr_reader :http_version
+
+ # The HTTP result code string. For example, '302'. You can also
+ # determine the response type by examining which response subclass
+ # the response object is an instance of.
+ attr_reader :code
+
+ # The HTTP result message sent by the server. For example, 'Not Found'.
+ attr_reader :message
+ alias msg message # :nodoc: obsolete
+
+ # The URI used to fetch this response. The response URI is only available
+ # if a URI was used to create the request.
+ attr_reader :uri
+
+ # Set to true automatically when the request did not contain an
+ # Accept-Encoding header from the user.
+ attr_accessor :decode_content
+
+ def inspect
+ "#<#{self.class} #{@code} #{@message} readbody=#{@read}>"
+ end
+
+ #
+ # response <-> exception relationship
+ #
+
+ def code_type #:nodoc:
+ self.class
+ end
+
+ def error! #:nodoc:
+ raise error_type().new(@code + ' ' + @message.dump, self)
+ end
+
+ def error_type #:nodoc:
+ self.class::EXCEPTION_TYPE
+ end
+
+ # Raises an HTTP error if the response is not 2xx (success).
+ def value
+ error! unless self.kind_of?(Net::HTTPSuccess)
+ end
+
+ def uri= uri # :nodoc:
+ @uri = uri.dup if uri
+ end
+
+ #
+ # header (for backward compatibility only; DO NOT USE)
+ #
+
+ def response #:nodoc:
+ warn "#{caller(1)[0]}: warning: Net::HTTPResponse#response is obsolete" if $VERBOSE
+ self
+ end
+
+ def header #:nodoc:
+ warn "#{caller(1)[0]}: warning: Net::HTTPResponse#header is obsolete" if $VERBOSE
+ self
+ end
+
+ def read_header #:nodoc:
+ warn "#{caller(1)[0]}: warning: Net::HTTPResponse#read_header is obsolete" if $VERBOSE
+ self
+ end
+
+ #
+ # body
+ #
+
+ def reading_body(sock, reqmethodallowbody) #:nodoc: internal use only
+ @socket = sock
+ @body_exist = reqmethodallowbody && self.class.body_permitted?
+ begin
+ yield
+ self.body # ensure to read body
+ ensure
+ @socket = nil
+ end
+ end
+
+ # Gets the entity body returned by the remote HTTP server.
+ #
+ # If a block is given, the body is passed to the block, and
+ # the body is provided in fragments, as it is read in from the socket.
+ #
+ # Calling this method a second or subsequent time for the same
+ # HTTPResponse object will return the value already read.
+ #
+ # http.request_get('/index.html') {|res|
+ # puts res.read_body
+ # }
+ #
+ # http.request_get('/index.html') {|res|
+ # p res.read_body.object_id # 538149362
+ # p res.read_body.object_id # 538149362
+ # }
+ #
+ # # using iterator
+ # http.request_get('/index.html') {|res|
+ # res.read_body do |segment|
+ # print segment
+ # end
+ # }
+ #
+ def read_body(dest = nil, &block)
+ if @read
+ raise IOError, "#{self.class}\#read_body called twice" if dest or block
+ return @body
+ end
+ to = procdest(dest, block)
+ stream_check
+ if @body_exist
+ read_body_0 to
+ @body = to
+ else
+ @body = nil
+ end
+ @read = true
+
+ @body
+ end
+
+ # Returns the full entity body.
+ #
+ # Calling this method a second or subsequent time will return the
+ # string already read.
+ #
+ # http.request_get('/index.html') {|res|
+ # puts res.body
+ # }
+ #
+ # http.request_get('/index.html') {|res|
+ # p res.body.object_id # 538149362
+ # p res.body.object_id # 538149362
+ # }
+ #
+ def body
+ read_body()
+ end
+
+ # Because it may be necessary to modify the body, Eg, decompression
+ # this method facilitates that.
+ def body=(value)
+ @body = value
+ end
+
+ alias entity body #:nodoc: obsolete
+
+ private
+
+ ##
+ # Checks for a supported Content-Encoding header and yields an Inflate
+ # wrapper for this response's socket when zlib is present. If the
+ # Content-Encoding is unsupported or zlib is missing the plain socket is
+ # yielded.
+ #
+ # If a Content-Range header is present a plain socket is yielded as the
+ # bytes in the range may not be a complete deflate block.
+
+ def inflater # :nodoc:
+ return yield @socket unless Net::HTTP::HAVE_ZLIB
+ return yield @socket unless @decode_content
+ return yield @socket if self['content-range']
+
+ case self['content-encoding']
+ when 'deflate', 'gzip', 'x-gzip' then
+ self.delete 'content-encoding'
+
+ inflate_body_io = Inflater.new(@socket)
+
+ begin
+ yield inflate_body_io
+ ensure
+ inflate_body_io.finish
+ end
+ when 'none', 'identity' then
+ self.delete 'content-encoding'
+
+ yield @socket
+ else
+ yield @socket
+ end
+ end
+
+ def read_body_0(dest)
+ inflater do |inflate_body_io|
+ if chunked?
+ read_chunked dest, inflate_body_io
+ return
+ end
+
+ @socket = inflate_body_io
+
+ clen = content_length()
+ if clen
+ @socket.read clen, dest, true # ignore EOF
+ return
+ end
+ clen = range_length()
+ if clen
+ @socket.read clen, dest
+ return
+ end
+ @socket.read_all dest
+ end
+ end
+
+ ##
+ # read_chunked reads from +@socket+ for chunk-size, chunk-extension, CRLF,
+ # etc. and +chunk_data_io+ for chunk-data which may be deflate or gzip
+ # encoded.
+ #
+ # 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
+ hexlen = line.slice(/[0-9a-fA-F]+/) or
+ raise Net::HTTPBadResponse, "wrong chunk size line: #{line}"
+ len = hexlen.hex
+ break if len == 0
+ begin
+ chunk_data_io.read len, dest
+ ensure
+ total += len
+ @socket.read 2 # \r\n
+ end
+ end
+ until @socket.readline.empty?
+ # none
+ end
+ end
+
+ def stream_check
+ raise IOError, 'attempt to read body out of block' if @socket.closed?
+ end
+
+ def procdest(dest, block)
+ raise ArgumentError, 'both arg and block given for HTTP method' if
+ dest and block
+ if block
+ Net::ReadAdapter.new(block)
+ else
+ dest || ''
+ end
+ end
+
+ ##
+ # Inflater is a wrapper around Net::BufferedIO that transparently inflates
+ # zlib and gzip streams.
+
+ class Inflater # :nodoc:
+
+ ##
+ # Creates a new Inflater wrapping +socket+
+
+ def initialize socket
+ @socket = socket
+ # zlib with automatic gzip detection
+ @inflate = Zlib::Inflate.new(32 + Zlib::MAX_WBITS)
+ end
+
+ ##
+ # Finishes the inflate stream.
+
+ def finish
+ @inflate.finish
+ end
+
+ ##
+ # Returns a Net::ReadAdapter that inflates each read chunk into +dest+.
+ #
+ # This allows a large response body to be inflated without storing the
+ # entire body in memory.
+
+ def inflate_adapter(dest)
+ block = proc do |compressed_chunk|
+ @inflate.inflate(compressed_chunk) do |chunk|
+ dest << chunk
+ end
+ end
+
+ Net::ReadAdapter.new(block)
+ end
+
+ ##
+ # Reads +clen+ bytes from the socket, inflates them, then writes them to
+ # +dest+. +ignore_eof+ is passed down to Net::BufferedIO#read
+ #
+ # Unlike Net::BufferedIO#read, this method returns more than +clen+ bytes.
+ # At this time there is no way for a user of Net::HTTPResponse to read a
+ # specific number of bytes from the HTTP response body, so this internal
+ # API does not return the same number of bytes as were requested.
+ #
+ # See https://bugs.ruby-lang.org/issues/6492 for further discussion.
+
+ def read clen, dest, ignore_eof = false
+ temp_dest = inflate_adapter(dest)
+
+ @socket.read clen, temp_dest, ignore_eof
+ end
+
+ ##
+ # Reads the rest of the socket, inflates it, then writes it to +dest+.
+
+ def read_all dest
+ temp_dest = inflate_adapter(dest)
+
+ @socket.read_all temp_dest
+ end
+
+ end
+
+end
+
diff --git a/lib/net/http/responses.rb b/lib/net/http/responses.rb
new file mode 100644
index 0000000000..38a5da2443
--- /dev/null
+++ b/lib/net/http/responses.rb
@@ -0,0 +1,268 @@
+# :stopdoc:
+class Net::HTTPUnknownResponse < Net::HTTPResponse
+ HAS_BODY = true
+ EXCEPTION_TYPE = Net::HTTPError
+end
+class Net::HTTPInformation < Net::HTTPResponse # 1xx
+ HAS_BODY = false
+ EXCEPTION_TYPE = Net::HTTPError
+end
+class Net::HTTPSuccess < Net::HTTPResponse # 2xx
+ HAS_BODY = true
+ EXCEPTION_TYPE = Net::HTTPError
+end
+class Net::HTTPRedirection < Net::HTTPResponse # 3xx
+ HAS_BODY = true
+ EXCEPTION_TYPE = Net::HTTPRetriableError
+end
+class Net::HTTPClientError < Net::HTTPResponse # 4xx
+ HAS_BODY = true
+ EXCEPTION_TYPE = Net::HTTPServerException # for backward compatibility
+end
+class Net::HTTPServerError < Net::HTTPResponse # 5xx
+ HAS_BODY = true
+ EXCEPTION_TYPE = Net::HTTPFatalError # for backward compatibility
+end
+
+class Net::HTTPContinue < Net::HTTPInformation # 100
+ HAS_BODY = false
+end
+class Net::HTTPSwitchProtocol < Net::HTTPInformation # 101
+ HAS_BODY = false
+end
+# 102 - RFC 2518; removed in RFC 4918
+
+class Net::HTTPOK < Net::HTTPSuccess # 200
+ HAS_BODY = true
+end
+class Net::HTTPCreated < Net::HTTPSuccess # 201
+ HAS_BODY = true
+end
+class Net::HTTPAccepted < Net::HTTPSuccess # 202
+ HAS_BODY = true
+end
+class Net::HTTPNonAuthoritativeInformation < Net::HTTPSuccess # 203
+ HAS_BODY = true
+end
+class Net::HTTPNoContent < Net::HTTPSuccess # 204
+ HAS_BODY = false
+end
+class Net::HTTPResetContent < Net::HTTPSuccess # 205
+ HAS_BODY = false
+end
+class Net::HTTPPartialContent < Net::HTTPSuccess # 206
+ HAS_BODY = true
+end
+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::HTTPMultipleChoices < Net::HTTPRedirection # 300
+ HAS_BODY = true
+end
+Net::HTTPMultipleChoice = Net::HTTPMultipleChoices
+class Net::HTTPMovedPermanently < Net::HTTPRedirection # 301
+ HAS_BODY = true
+end
+class Net::HTTPFound < Net::HTTPRedirection # 302
+ HAS_BODY = true
+end
+Net::HTTPMovedTemporarily = Net::HTTPFound
+class Net::HTTPSeeOther < Net::HTTPRedirection # 303
+ HAS_BODY = true
+end
+class Net::HTTPNotModified < Net::HTTPRedirection # 304
+ HAS_BODY = false
+end
+class Net::HTTPUseProxy < Net::HTTPRedirection # 305
+ HAS_BODY = false
+end
+# 306 Switch Proxy - no longer unused
+class Net::HTTPTemporaryRedirect < Net::HTTPRedirection # 307
+ HAS_BODY = true
+end
+# 308 Permanent Redirect - in draft
+
+class Net::HTTPBadRequest < Net::HTTPClientError # 400
+ HAS_BODY = true
+end
+class Net::HTTPUnauthorized < Net::HTTPClientError # 401
+ HAS_BODY = true
+end
+class Net::HTTPPaymentRequired < Net::HTTPClientError # 402
+ HAS_BODY = true
+end
+class Net::HTTPForbidden < Net::HTTPClientError # 403
+ HAS_BODY = true
+end
+class Net::HTTPNotFound < Net::HTTPClientError # 404
+ HAS_BODY = true
+end
+class Net::HTTPMethodNotAllowed < Net::HTTPClientError # 405
+ HAS_BODY = true
+end
+class Net::HTTPNotAcceptable < Net::HTTPClientError # 406
+ HAS_BODY = true
+end
+class Net::HTTPProxyAuthenticationRequired < Net::HTTPClientError # 407
+ HAS_BODY = true
+end
+class Net::HTTPRequestTimeOut < Net::HTTPClientError # 408
+ HAS_BODY = true
+end
+class Net::HTTPConflict < Net::HTTPClientError # 409
+ HAS_BODY = true
+end
+class Net::HTTPGone < Net::HTTPClientError # 410
+ HAS_BODY = true
+end
+class Net::HTTPLengthRequired < Net::HTTPClientError # 411
+ HAS_BODY = true
+end
+class Net::HTTPPreconditionFailed < Net::HTTPClientError # 412
+ HAS_BODY = true
+end
+class Net::HTTPRequestEntityTooLarge < Net::HTTPClientError # 413
+ HAS_BODY = true
+end
+class Net::HTTPRequestURITooLong < Net::HTTPClientError # 414
+ HAS_BODY = true
+end
+Net::HTTPRequestURITooLarge = Net::HTTPRequestURITooLong
+class Net::HTTPUnsupportedMediaType < Net::HTTPClientError # 415
+ HAS_BODY = true
+end
+class Net::HTTPRequestedRangeNotSatisfiable < Net::HTTPClientError # 416
+ HAS_BODY = true
+end
+class Net::HTTPExpectationFailed < Net::HTTPClientError # 417
+ HAS_BODY = true
+end
+# 418 I'm a teapot - RFC 2324; a joke RFC
+# 420 Enhance Your Calm - Twitter
+class Net::HTTPUnprocessableEntity < Net::HTTPClientError # 422 - RFC 4918
+ HAS_BODY = true
+end
+class Net::HTTPLocked < Net::HTTPClientError # 423 - RFC 4918
+ HAS_BODY = true
+end
+class Net::HTTPFailedDependency < Net::HTTPClientError # 424 - RFC 4918
+ HAS_BODY = true
+end
+# 425 Unordered Collection - existed only in draft
+class Net::HTTPUpgradeRequired < Net::HTTPClientError # 426 - RFC 2817
+ HAS_BODY = true
+end
+class Net::HTTPPreconditionRequired < Net::HTTPClientError # 428 - RFC 6585
+ HAS_BODY = true
+end
+class Net::HTTPTooManyRequests < Net::HTTPClientError # 429 - RFC 6585
+ HAS_BODY = true
+end
+class Net::HTTPRequestHeaderFieldsTooLarge < Net::HTTPClientError # 431 - RFC 6585
+ HAS_BODY = true
+end
+# 444 No Response - Nginx
+# 449 Retry With - Microsoft
+# 450 Blocked by Windows Parental Controls - Microsoft
+# 499 Client Closed Request - Nginx
+
+class Net::HTTPInternalServerError < Net::HTTPServerError # 500
+ HAS_BODY = true
+end
+class Net::HTTPNotImplemented < Net::HTTPServerError # 501
+ HAS_BODY = true
+end
+class Net::HTTPBadGateway < Net::HTTPServerError # 502
+ HAS_BODY = true
+end
+class Net::HTTPServiceUnavailable < Net::HTTPServerError # 503
+ HAS_BODY = true
+end
+class Net::HTTPGatewayTimeOut < Net::HTTPServerError # 504
+ HAS_BODY = true
+end
+class Net::HTTPVersionNotSupported < Net::HTTPServerError # 505
+ HAS_BODY = true
+end
+# 506 Variant Also Negotiates - RFC 2295; experimental
+class Net::HTTPInsufficientStorage < Net::HTTPServerError # 507 - RFC 4918
+ HAS_BODY = true
+end
+# 508 Loop Detected - RFC 5842; experimental
+# 509 Bandwidth Limit Exceeded - Apache bw/limited extension
+# 510 Not Extended - RFC 2774; experimental
+class Net::HTTPNetworkAuthenticationRequired < Net::HTTPServerError # 511 - RFC 6585
+ HAS_BODY = true
+end
+
+class Net::HTTPResponse
+ CODE_CLASS_TO_OBJ = {
+ '1' => Net::HTTPInformation,
+ '2' => Net::HTTPSuccess,
+ '3' => Net::HTTPRedirection,
+ '4' => Net::HTTPClientError,
+ '5' => Net::HTTPServerError
+ }
+ CODE_TO_OBJ = {
+ '100' => Net::HTTPContinue,
+ '101' => Net::HTTPSwitchProtocol,
+
+ '200' => Net::HTTPOK,
+ '201' => Net::HTTPCreated,
+ '202' => Net::HTTPAccepted,
+ '203' => Net::HTTPNonAuthoritativeInformation,
+ '204' => Net::HTTPNoContent,
+ '205' => Net::HTTPResetContent,
+ '206' => Net::HTTPPartialContent,
+ '207' => Net::HTTPMultiStatus,
+
+ '300' => Net::HTTPMultipleChoices,
+ '301' => Net::HTTPMovedPermanently,
+ '302' => Net::HTTPFound,
+ '303' => Net::HTTPSeeOther,
+ '304' => Net::HTTPNotModified,
+ '305' => Net::HTTPUseProxy,
+ '307' => Net::HTTPTemporaryRedirect,
+
+ '400' => Net::HTTPBadRequest,
+ '401' => Net::HTTPUnauthorized,
+ '402' => Net::HTTPPaymentRequired,
+ '403' => Net::HTTPForbidden,
+ '404' => Net::HTTPNotFound,
+ '405' => Net::HTTPMethodNotAllowed,
+ '406' => Net::HTTPNotAcceptable,
+ '407' => Net::HTTPProxyAuthenticationRequired,
+ '408' => Net::HTTPRequestTimeOut,
+ '409' => Net::HTTPConflict,
+ '410' => Net::HTTPGone,
+ '411' => Net::HTTPLengthRequired,
+ '412' => Net::HTTPPreconditionFailed,
+ '413' => Net::HTTPRequestEntityTooLarge,
+ '414' => Net::HTTPRequestURITooLong,
+ '415' => Net::HTTPUnsupportedMediaType,
+ '416' => Net::HTTPRequestedRangeNotSatisfiable,
+ '417' => Net::HTTPExpectationFailed,
+ '422' => Net::HTTPUnprocessableEntity,
+ '423' => Net::HTTPLocked,
+ '424' => Net::HTTPFailedDependency,
+ '426' => Net::HTTPUpgradeRequired,
+ '428' => Net::HTTPPreconditionRequired,
+ '429' => Net::HTTPTooManyRequests,
+ '431' => Net::HTTPRequestHeaderFieldsTooLarge,
+
+ '500' => Net::HTTPInternalServerError,
+ '501' => Net::HTTPNotImplemented,
+ '502' => Net::HTTPBadGateway,
+ '503' => Net::HTTPServiceUnavailable,
+ '504' => Net::HTTPGatewayTimeOut,
+ '505' => Net::HTTPVersionNotSupported,
+ '507' => Net::HTTPInsufficientStorage,
+ '511' => Net::HTTPNetworkAuthenticationRequired,
+ }
+end
+
+# :startdoc:
+
diff --git a/lib/net/imap.rb b/lib/net/imap.rb
index df9ee8ce1e..55c611b9c6 100644
--- a/lib/net/imap.rb
+++ b/lib/net/imap.rb
@@ -200,7 +200,7 @@ module Net
#
class IMAP
include MonitorMixin
- if defined?(OpenSSL)
+ if defined?(OpenSSL::SSL)
include OpenSSL
include SSL
end
@@ -295,6 +295,22 @@ module Net
@@authenticators[auth_type] = authenticator
end
+ # The default port for IMAP connections, port 143
+ def self.default_port
+ return PORT
+ end
+
+ # The default port for IMAPS connections, port 993
+ def self.default_tls_port
+ return SSL_PORT
+ end
+
+ class << self
+ alias default_imap_port default_port
+ alias default_imaps_port default_tls_port
+ alias default_ssl_port default_tls_port
+ end
+
# Disconnects from the server.
def disconnect
begin
@@ -939,27 +955,22 @@ module Net
# Net::IMAP does _not_ automatically encode and decode
# mailbox names to and from utf7.
def self.decode_utf7(s)
- return s.gsub(/&(.*?)-/n) {
- if $1.empty?
- "&"
+ return s.gsub(/&([^-]+)?-/n) {
+ if $1
+ ($1.tr(",", "/") + "===").unpack("m")[0].encode(Encoding::UTF_8, Encoding::UTF_16BE)
else
- base64 = $1.tr(",", "/")
- x = base64.length % 4
- if x > 0
- base64.concat("=" * (4 - x))
- end
- base64.unpack("m")[0].unpack("n*").pack("U*")
+ "&"
end
- }.force_encoding("UTF-8")
+ }
end
# Encode a string from UTF-8 format to modified UTF-7.
def self.encode_utf7(s)
- return s.gsub(/(&)|([^\x20-\x7e]+)/u) {
+ return s.gsub(/(&)|[^\x20-\x7e]+/) {
if $1
"&-"
else
- base64 = [$&.unpack("U*").pack("n*")].pack("m")
+ base64 = [$&.encode(Encoding::UTF_16BE)].pack("m")
"&" + base64.delete("=\n").tr("/", ",") + "-"
end
}.force_encoding("ASCII-8BIT")
@@ -985,7 +996,7 @@ module Net
@@authenticators = {}
@@max_flag_count = 10000
- # call-seq:
+ # :call-seq:
# Net::IMAP.new(host, options = {})
#
# Creates a new Net::IMAP object and connects it to the specified
@@ -1049,6 +1060,10 @@ module Net
@exception = nil
@greeting = get_response
+ if @greeting.nil?
+ @sock.close
+ raise Error, "connection closed"
+ end
if @greeting.name == "BYE"
@sock.close
raise ByeResponseError, @greeting
@@ -1125,7 +1140,7 @@ module Net
@tagged_response_arrival.broadcast
@continuation_request_arrival.broadcast
if @idle_done_cond
- @idle_done_cond.signal
+ @idle_done_cond.signal
end
end
end
@@ -1418,7 +1433,7 @@ module Net
end
def start_tls_session(params = {})
- unless defined?(OpenSSL)
+ unless defined?(OpenSSL::SSL)
raise "SSL extension not installed"
end
if @sock.kind_of?(OpenSSL::SSL::SSLSocket)
@@ -1957,6 +1972,26 @@ module Net
end
end
+ # Net::IMAP::BodyTypeAttachment represents attachment body structures
+ # of messages.
+ #
+ # ==== Fields:
+ #
+ # media_type:: Returns the content media type name.
+ #
+ # subtype:: Returns +nil+.
+ #
+ # param:: Returns a hash that represents parameters.
+ #
+ # multipart?:: Returns false.
+ #
+ class BodyTypeAttachment < Struct.new(:media_type, :subtype,
+ :param)
+ def multipart?
+ return false
+ end
+ end
+
# Net::IMAP::BodyTypeMultipart represents multipart body structures
# of messages.
#
@@ -1998,6 +2033,14 @@ module Net
end
end
+ class BodyTypeExtension < Struct.new(:media_type, :subtype,
+ :params, :content_id,
+ :description, :encoding, :size)
+ def multipart?
+ return false
+ end
+ end
+
class ResponseParser # :nodoc:
def initialize
@str = nil
@@ -2164,12 +2207,12 @@ module Net
when "FETCH"
shift_token
match(T_SPACE)
- data = FetchData.new(n, msg_att)
+ data = FetchData.new(n, msg_att(n))
return UntaggedResponse.new(name, data, @str)
end
end
- def msg_att
+ def msg_att(n)
match(T_LPAR)
attr = {}
while true
@@ -2198,7 +2241,7 @@ module Net
when /\A(?:UID)\z/ni
name, val = uid_data
else
- parse_error("unknown attribute `%s'", token.value)
+ parse_error("unknown attribute `%s' for {%d}", token.value, n)
end
attr[name] = val
end
@@ -2265,6 +2308,11 @@ module Net
def rfc822_text
token = match(T_ATOM)
name = token.value.upcase
+ token = lookahead
+ if token.symbol == T_LBRA
+ shift_token
+ match(T_RBRA)
+ end
match(T_SPACE)
return name, nstring
end
@@ -2322,6 +2370,8 @@ module Net
return body_type_text
when /\A(?:MESSAGE)\z/ni
return body_type_msg
+ when /\A(?:ATTACHMENT)\z/ni
+ return body_type_attachment
else
return body_type_basic
end
@@ -2360,6 +2410,29 @@ module Net
mtype, msubtype = media_type
match(T_SPACE)
param, content_id, desc, enc, size = body_fields
+
+ token = lookahead
+ 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)
env = envelope
match(T_SPACE)
@@ -2374,6 +2447,13 @@ module Net
md5, disposition, language, extension)
end
+ def body_type_attachment
+ mtype = case_insensitive_string
+ match(T_SPACE)
+ param = body_fld_param
+ return BodyTypeAttachment.new(mtype, nil, param)
+ end
+
def body_type_mpart
parts = []
while true
@@ -2394,6 +2474,10 @@ module Net
def media_type
mtype = case_insensitive_string
+ token = lookahead
+ if token.symbol != T_SPACE
+ return mtype, nil
+ end
match(T_SPACE)
msubtype = case_insensitive_string
return mtype, msubtype
diff --git a/lib/net/pop.rb b/lib/net/pop.rb
index ff2d77f72a..ebf1085d55 100644
--- a/lib/net/pop.rb
+++ b/lib/net/pop.rb
@@ -42,8 +42,6 @@ module Net
class POPBadResponse < POPError; end
#
- # = Net::POP3
- #
# == What is This Library?
#
# This library provides functionality for retrieving
@@ -326,7 +324,7 @@ module Net
@ssl_params = nil
- # call-seq:
+ # :call-seq:
# Net::POP.enable_ssl(params = {})
#
# Enable SSL for all new instances.
@@ -375,7 +373,7 @@ module Net
return @ssl_params[:verify_mode]
end
- # returns the :ca_file or :ca_path from POP3.ssh_params
+ # returns the :ca_file or :ca_path from POP3.ssl_params
def POP3.certs
return @ssl_params[:ca_file] || @ssl_params[:ca_path]
end
@@ -444,7 +442,7 @@ module Net
return !@ssl_params.nil?
end
- # call-seq:
+ # :call-seq:
# Net::POP#enable_ssl(params = {})
#
# Enables SSL for this instance. Must be called before the connection is
@@ -498,12 +496,12 @@ module Net
# Seconds to wait until a connection is opened.
# If the POP3 object cannot open a connection within this time,
- # it raises a TimeoutError exception. The default value is 30 seconds.
+ # it raises a Net::OpenTimeout exception. The default value is 30 seconds.
attr_accessor :open_timeout
# Seconds to wait until reading one block (by one read(1) call).
# If the POP3 object cannot complete a read() within this time,
- # it raises a TimeoutError exception. The default value is 60 seconds.
+ # it raises a Net::ReadTimeout exception. The default value is 60 seconds.
attr_reader :read_timeout
# Set the read timeout.
@@ -542,7 +540,9 @@ module Net
# internal method for Net::POP3.start
def do_start(account, password) # :nodoc:
- s = timeout(@open_timeout) { TCPSocket.open(@address, port) }
+ s = Timeout.timeout(@open_timeout, Net::OpenTimeout) do
+ TCPSocket.open(@address, port)
+ end
if use_ssl?
raise 'openssl library not installed' unless defined?(OpenSSL)
context = OpenSSL::SSL::SSLContext.new
@@ -715,9 +715,9 @@ module Net
end # class POP3
# class aliases
- POP = POP3
- POPSession = POP3
- POP3Session = POP3
+ POP = POP3 # :nodoc:
+ POPSession = POP3 # :nodoc:
+ POP3Session = POP3 # :nodoc:
#
# This class is equivalent to POP3, except that it uses APOP authentication.
@@ -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 f3744661f5..14a68e1115 100644
--- a/lib/net/protocol.rb
+++ b/lib/net/protocol.rb
@@ -45,6 +45,18 @@ module Net # :nodoc:
class ProtoRetriableError < ProtocolError; end
ProtocRetryError = ProtoRetriableError
+ ##
+ # OpenTimeout, a subclass of Timeout::Error, is raised if a connection cannot
+ # be created within the open_timeout.
+
+ class OpenTimeout < Timeout::Error; end
+
+ ##
+ # ReadTimeout, a subclass of Timeout::Error, is raised if a chunk of the
+ # response cannot be read within the read_timeout.
+
+ class ReadTimeout < Timeout::Error; end
+
class BufferedIO #:nodoc: internal use only
def initialize(io)
@@ -143,7 +155,7 @@ module Net # :nodoc:
if IO.select([@io], nil, nil, @read_timeout)
retry
else
- raise Timeout::Error
+ raise Net::ReadTimeout
end
rescue IO::WaitWritable
# OpenSSL::Buffering#read_nonblock may fail with IO::WaitWritable.
@@ -151,7 +163,7 @@ module Net # :nodoc:
if IO.select(nil, [@io], nil, @read_timeout)
retry
else
- raise Timeout::Error
+ raise Net::ReadTimeout
end
end
end
diff --git a/lib/net/smtp.rb b/lib/net/smtp.rb
index f6e2ea9d9c..4ed7e746d9 100644
--- a/lib/net/smtp.rb
+++ b/lib/net/smtp.rb
@@ -66,8 +66,6 @@ module Net
end
#
- # = Net::SMTP
- #
# == What is This Library?
#
# This library provides functionality to send internet
@@ -217,7 +215,7 @@ module Net
@started = false
@open_timeout = 30
@read_timeout = 60
- @error_occured = false
+ @error_occurred = false
@debug_output = nil
@tls = false
@starttls = false
@@ -364,12 +362,12 @@ module Net
# Seconds to wait while attempting to open a connection.
# If the connection cannot be opened within this time, a
- # TimeoutError is raised. The default value is 30 seconds.
+ # Net::OpenTimeout is raised. The default value is 30 seconds.
attr_accessor :open_timeout
# Seconds to wait while reading one block (by one read(2) call).
# If the read(2) call does not complete within this time, a
- # TimeoutError is raised. The default value is 60 seconds.
+ # Net::ReadTimeout is raised. The default value is 60 seconds.
attr_reader :read_timeout
# Set the number of seconds to wait until timing-out a read(2)
@@ -448,8 +446,9 @@ module Net
# * Net::SMTPSyntaxError
# * Net::SMTPFatalError
# * Net::SMTPUnknownError
+ # * Net::OpenTimeout
+ # * Net::ReadTimeout
# * IOError
- # * TimeoutError
#
def SMTP.start(address, port = nil, helo = 'localhost',
user = nil, secret = nil, authtype = nil,
@@ -509,8 +508,9 @@ module Net
# * Net::SMTPSyntaxError
# * Net::SMTPFatalError
# * Net::SMTPUnknownError
+ # * Net::OpenTimeout
+ # * Net::ReadTimeout
# * IOError
- # * TimeoutError
#
def start(helo = 'localhost',
user = nil, secret = nil, authtype = nil) # :yield: smtp
@@ -546,7 +546,9 @@ module Net
check_auth_method(authtype || DEFAULT_AUTH_TYPE)
check_auth_args user, secret
end
- s = timeout(@open_timeout) { tcp_socket(@address, @port) }
+ s = Timeout.timeout(@open_timeout, Net::OpenTimeout) do
+ tcp_socket(@address, @port)
+ end
logging "Connection opened: #{@address}:#{@port}"
@socket = new_internet_message_io(tls? ? tlsconnect(s) : s)
check_response critical { recv_response() }
@@ -603,17 +605,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
@@ -651,8 +653,8 @@ module Net
# * Net::SMTPSyntaxError
# * Net::SMTPFatalError
# * Net::SMTPUnknownError
+ # * Net::ReadTimeout
# * IOError
- # * TimeoutError
#
def send_message(msgstr, from_addr, *to_addrs)
raise IOError, 'closed session' unless @socket
@@ -704,8 +706,8 @@ module Net
# * Net::SMTPSyntaxError
# * Net::SMTPFatalError
# * Net::SMTPUnknownError
+ # * Net::ReadTimeout
# * IOError
- # * TimeoutError
#
def open_message_stream(from_addr, *to_addrs, &block) # :yield: stream
raise IOError, 'closed session' unless @socket
@@ -813,6 +815,12 @@ module Net
public
+ # Aborts the current mail transaction
+
+ def rset
+ getok('RSET')
+ end
+
def starttls
getok('STARTTLS')
end
@@ -933,12 +941,12 @@ module Net
Response.parse(buf)
end
- def critical(&block)
- return '200 dummy reply code' if @error_occured
+ def critical
+ return '200 dummy reply code' if @error_occurred
begin
return yield()
rescue Exception
- @error_occured = true
+ @error_occurred = true
raise
end
end
@@ -951,7 +959,7 @@ module Net
def check_continue(res)
unless res.continue?
- raise SMTPUnknownError, "could not get 3xx (#{res.status})"
+ raise SMTPUnknownError, "could not get 3xx (#{res.status}: #{res.string})"
end
end
@@ -1052,6 +1060,6 @@ module Net
end # class SMTP
- SMTPSession = SMTP
+ SMTPSession = SMTP # :nodoc:
end
diff --git a/lib/net/telnet.rb b/lib/net/telnet.rb
index fe463c63dc..3c5d6e8e73 100644
--- a/lib/net/telnet.rb
+++ b/lib/net/telnet.rb
@@ -9,8 +9,7 @@
# For documentation, see Net::Telnet.
#
-require "socket"
-require "timeout"
+require "net/protocol"
require "English"
module Net
@@ -244,15 +243,15 @@ module Net
#
# Timeout:: the number of seconds to wait before timing out both the
# initial attempt to connect to host (in this constructor),
- # and all attempts to read data from the host (in #waitfor(),
- # #cmd(), and #login()). Exceeding this timeout causes a
- # TimeoutError to be raised. The default value is 10 seconds.
+ # which raises a Net::OpenTimeout, and all attempts to read data
+ # from the host, which raises a Net::ReadTimeout (in #waitfor(),
+ # #cmd(), and #login()). The default value is 10 seconds.
# You can disable the timeout by setting this value to false.
# In this case, the connect attempt will eventually timeout
# on the underlying connect(2) socket call with an
# Errno::ETIMEDOUT error (but generally only after a few
# minutes), but other attempts to read data from the host
- # will hand indefinitely if no data is forthcoming.
+ # will hang indefinitely if no data is forthcoming.
#
# Waittime:: the amount of time to wait after seeing what looks like a
# prompt (that is, received data that matches the Prompt
@@ -347,12 +346,12 @@ module Net
if @options["Timeout"] == false
@sock = TCPSocket.open(@options["Host"], @options["Port"])
else
- timeout(@options["Timeout"]) do
+ Timeout.timeout(@options["Timeout"], Net::OpenTimeout) do
@sock = TCPSocket.open(@options["Host"], @options["Port"])
end
end
- rescue TimeoutError
- raise TimeoutError, "timed out while opening a connection to the host"
+ rescue Net::OpenTimeout
+ raise Net::OpenTimeout, "timed out while opening a connection to the host"
rescue
@log.write($ERROR_INFO.to_s + "\n") if @options.has_key?("Output_log")
@dumplog.log_dump('#', $ERROR_INFO.to_s + "\n") if @options.has_key?("Dump_log")
@@ -508,7 +507,7 @@ module Net
# into a regular expression. Used only if Match and
# Prompt are not specified.
# Timeout:: the number of seconds to wait for data from the host
- # before raising a TimeoutError. If set to false,
+ # before raising a Timeout::Error. If set to false,
# no timeout will occur. If not specified, the
# Timeout option value specified when this instance
# was created will be used, or, failing that, the
@@ -555,7 +554,7 @@ module Net
rest = ''
until(prompt === line and not IO::select([@sock], nil, nil, waittime))
unless IO::select([@sock], nil, nil, time_out)
- raise TimeoutError, "timed out while waiting for more data"
+ raise Net::ReadTimeout, "timed out while waiting for more data"
end
begin
c = @sock.readpartial(1024 * 1024)
diff --git a/lib/observer.rb b/lib/observer.rb
index a5d0dc0f4e..99610f7505 100644
--- a/lib/observer.rb
+++ b/lib/observer.rb
@@ -1,7 +1,7 @@
#
# Implementation of the _Observer_ object-oriented design pattern. The
# following documentation is copied, with modifications, from "Programming
-# Ruby", by Hunt and Thomas; http://www.rubycentral.com/book/lib_patterns.html.
+# Ruby", by Hunt and Thomas; http://www.ruby-doc.org/docs/ProgrammingRuby/html/lib_patterns.html.
#
# See Observable for more info.
@@ -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
@@ -184,7 +185,7 @@ module Observable
# Notify observers of a change in state *if* this object's changed state is
# +true+.
#
- # This will invoke the method named in #add_observer, pasing <tt>*arg</tt>.
+ # This will invoke the method named in #add_observer, passing <tt>*arg</tt>.
# The changed state is then set to +false+.
#
# <tt>*arg</tt>:: Any arguments to pass to the observers.
diff --git a/lib/open-uri.rb b/lib/open-uri.rb
index 6e24b40ba5..b1a253841d 100644
--- a/lib/open-uri.rb
+++ b/lib/open-uri.rb
@@ -20,10 +20,11 @@ module Kernel
#
# Otherwise, the original Kernel#open is called.
#
- # Since open-uri.rb provides URI::HTTP#open, URI::HTTPS#open and
- # URI::FTP#open, Kernel[#.]open can accept URIs and strings that begin with
- # http://, https:// and ftp://. In these cases, the opened file object is
- # extended by OpenURI::Meta.
+ # OpenURI::OpenRead#open provides URI::HTTP#open, URI::HTTPS#open and
+ # URI::FTP#open, Kernel#open.
+ #
+ # We can accept URIs and strings that begin with http://, https:// and
+ # ftp://. In these cases, the opened file object is extended by OpenURI::Meta.
def open(name, *rest, &block) # :doc:
if name.respond_to?(:open)
name.open(*rest, &block)
@@ -38,9 +39,9 @@ module Kernel
module_function :open
end
-# OpenURI is an easy-to-use wrapper for net/http, net/https and net/ftp.
+# OpenURI is an easy-to-use wrapper for Net::HTTP, Net::HTTPS and Net::FTP.
#
-#== Example
+# == Example
#
# It is possible to open an http, https or ftp URL as though it were a file:
#
@@ -70,12 +71,14 @@ end
# }
#
# The environment variables such as http_proxy, https_proxy and ftp_proxy
-# are in effect by default. :proxy => nil disables proxy.
+# are in effect by default. Here we disable proxy:
#
# open("http://www.ruby-lang.org/en/raa.html", :proxy => nil) {|f|
# # ...
# }
#
+# See OpenURI::OpenRead.open and Kernel#open for more on available options.
+#
# URI objects can be opened in a similar way.
#
# uri = URI.parse("http://www.ruby-lang.org/en/")
@@ -149,7 +152,11 @@ module OpenURI
begin
yield io
ensure
- io.close
+ if io.respond_to? :close!
+ io.close! # Tempfile
+ else
+ io.close
+ end
end
else
io
@@ -329,7 +336,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
@@ -355,6 +362,8 @@ module OpenURI
attr_reader :io
end
+ # Raised on redirection,
+ # only occurs when +redirect+ option for HTTP is +false+.
class HTTPRedirect < HTTPError
def initialize(message, io, uri)
super(message, io)
@@ -363,7 +372,7 @@ module OpenURI
attr_reader :uri
end
- class Buffer # :nodoc:
+ class Buffer # :nodoc: all
def initialize
@io = StringIO.new
@size = 0
@@ -396,13 +405,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
@@ -416,8 +426,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
@@ -437,30 +455,38 @@ 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
end
end
+ # :stopdoc:
RE_LWS = /[\r\n\t ]+/n
RE_TOKEN = %r{[^\x00- ()<>@,;:\\"/\[\]?={}\x7f]+}n
RE_QUOTED_STRING = %r{"(?:[\r\n\t !#-\[\]-~\x80-\xff]|\\[\x00-\x7f])*"}n
RE_PARAMETERS = %r{(?:;#{RE_LWS}?#{RE_TOKEN}#{RE_LWS}?=#{RE_LWS}?(?:#{RE_TOKEN}|#{RE_QUOTED_STRING})#{RE_LWS}?)*}n
+ # :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 = []
@@ -512,8 +538,8 @@ module OpenURI
# as an Array of String.
# 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
[]
@@ -692,84 +718,6 @@ module OpenURI
end
module URI
- class Generic
- # returns a proxy URI.
- # The proxy URI is obtained from environment variables such as http_proxy,
- # ftp_proxy, no_proxy, etc.
- # If there is no proper proxy, nil is returned.
- #
- # Note that capitalized variables (HTTP_PROXY, FTP_PROXY, NO_PROXY, etc.)
- # are examined too.
- #
- # But http_proxy and HTTP_PROXY is treated specially under CGI environment.
- # It's because HTTP_PROXY may be set by Proxy: header.
- # So HTTP_PROXY is not used.
- # http_proxy is not used too if the variable is case insensitive.
- # CGI_HTTP_PROXY can be used instead.
- def find_proxy
- name = self.scheme.downcase + '_proxy'
- proxy_uri = nil
- if name == 'http_proxy' && ENV.include?('REQUEST_METHOD') # CGI?
- # HTTP_PROXY conflicts with *_proxy for proxy settings and
- # HTTP_* for header information in CGI.
- # So it should be careful to use it.
- pairs = ENV.reject {|k, v| /\Ahttp_proxy\z/i !~ k }
- case pairs.length
- when 0 # no proxy setting anyway.
- proxy_uri = nil
- when 1
- k, _ = pairs.shift
- if k == 'http_proxy' && ENV[k.upcase] == nil
- # http_proxy is safe to use because ENV is case sensitive.
- proxy_uri = ENV[name]
- else
- proxy_uri = nil
- end
- else # http_proxy is safe to use because ENV is case sensitive.
- proxy_uri = ENV.to_hash[name]
- end
- if !proxy_uri
- # Use CGI_HTTP_PROXY. cf. libwww-perl.
- proxy_uri = ENV["CGI_#{name.upcase}"]
- end
- elsif name == 'http_proxy'
- unless proxy_uri = ENV[name]
- if proxy_uri = ENV[name.upcase]
- warn 'The environment variable HTTP_PROXY is discouraged. Use http_proxy.'
- end
- end
- else
- proxy_uri = ENV[name] || ENV[name.upcase]
- end
-
- if proxy_uri && self.hostname
- require 'socket'
- begin
- addr = IPSocket.getaddress(self.hostname)
- proxy_uri = nil if /\A127\.|\A::1\z/ =~ addr
- rescue SocketError
- end
- end
-
- if proxy_uri
- proxy_uri = URI.parse(proxy_uri)
- name = 'no_proxy'
- if no_proxy = ENV[name] || ENV[name.upcase]
- no_proxy.scan(/([^:,]*)(?::(\d+))?/) {|host, port|
- if /(\A|\.)#{Regexp.quote host}\z/i =~ self.host &&
- (!port || self.port == port.to_i)
- proxy_uri = nil
- break
- end
- }
- end
- proxy_uri
- else
- nil
- end
- end
- end
-
class HTTP
def buffer_open(buf, proxy, options) # :nodoc:
OpenURI.open_http(buf, self, proxy, options)
diff --git a/lib/open3.rb b/lib/open3.rb
index 03a7937c09..134601c907 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 : a pipeline
-# - Open3.pipeline : run a pipline 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,19 +45,19 @@ 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 a") {|i, o, e, t| ... }
- # Open3.popen3("echo", "a") {|i, o, e, t| ... }
- # Open3.popen3(["echo", "argv0"], "a") {|i, o, e, t| ... }
+ # Open3.popen3("echo abc") {|i, o, e, t| ... }
+ # Open3.popen3("echo", "abc") {|i, o, e, t| ... }
+ # Open3.popen3(["echo", "argv0"], "abc") {|i, o, e, t| ... }
#
# If the last parameter, opts, is a Hash, it is recognized as an option for Process.spawn.
#
@@ -65,18 +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.
#
- def popen3(*cmd, &block)
- if Hash === cmd.last
- opts = cmd.pop.dup
- else
- opts = {}
- end
-
+ # You should be careful to avoid deadlocks.
+ # Since pipes are fixed length buffers,
+ # Open3.popen3("prog") {|i, o, e, t| o.read } deadlocks if
+ # 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 need stdout and stderr output as separate strings, you can consider Open3.capture3.
+ #
+ def popen3(*cmd, **opts, &block)
in_r, in_w = IO.pipe
opts[:in] = in_r
in_w.sync = true
@@ -91,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:
@@ -131,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
@@ -149,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:
@@ -180,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
@@ -229,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'
@@ -237,19 +228,19 @@ 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 a; sort >&2", :stdin_data=>"foo\nbar\nbaz\n")
- # p o #=> "a\n"
+ # 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,
+ # # 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)
@@ -257,16 +248,7 @@ module Open3
# STDOUT.binmode; print thumnail
# end
#
- def capture3(*cmd, &block)
- 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
@@ -311,16 +293,7 @@ module Open3
# End
# image, s = Open3.capture2("gnuplot", :stdin_data=>gnuplot_commands, :binmode=>true)
#
- def capture2(*cmd, &block)
- 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: '', binmode: false, **opts)
popen2(*cmd, opts) {|i, o, t|
if binmode
i.binmode
@@ -350,16 +323,7 @@ module Open3
# # capture make log
# make_log, s = Open3.capture2e("make")
#
- def capture2e(*cmd, &block)
- 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: '', binmode: false, **opts)
popen2e(*cmd, opts) {|i, oe, t|
if binmode
i.binmode
@@ -374,7 +338,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|
# ...
@@ -394,15 +358,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"
@@ -415,13 +379,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
@@ -434,7 +392,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|
# ...
@@ -453,7 +411,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:
#
@@ -471,13 +429,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
@@ -486,7 +438,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|
# ...
@@ -505,7 +457,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:
#
@@ -513,13 +465,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
@@ -529,7 +475,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|
@@ -548,11 +494,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]
@@ -560,8 +506,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
@@ -572,13 +518,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
@@ -589,8 +529,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])
@@ -640,20 +580,14 @@ 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 }
}
end
module_function :pipeline
- def pipeline_run(cmds, pipeline_opts, child_io, parent_io, &block) # :nodoc:
+ def pipeline_run(cmds, pipeline_opts, child_io, parent_io) # :nodoc:
if cmds.empty?
raise ArgumentError, "no commands"
end
diff --git a/lib/optparse.rb b/lib/optparse.rb
index dcb67604e2..33faed0057 100644
--- a/lib/optparse.rb
+++ b/lib/optparse.rb
@@ -8,6 +8,7 @@
#
+#--
# == Developer Documentation (not for RDoc output)
#
# === Class tree
@@ -42,6 +43,8 @@
# | all instances)|
# +---------------+
#
+#++
+#
# == OptionParser
#
# === Introduction
@@ -108,7 +111,7 @@
# options.transfer_type = :auto
# options.verbose = false
#
-# opts = OptionParser.new do |opts|
+# opt_parser = OptionParser.new do |opts|
# opts.banner = "Usage: example.rb [options]"
#
# opts.separator ""
@@ -182,12 +185,12 @@
#
# # Another typical switch to print the version.
# opts.on_tail("--version", "Show version") do
-# puts OptionParser::Version.join('.')
+# puts ::Version.join('.')
# exit
# end
# end
#
-# opts.parse!(args)
+# opt_parser.parse!(args)
# options
# end # parse()
#
@@ -195,6 +198,7 @@
#
# options = OptparseExample.parse(ARGV)
# pp options
+# pp ARGV
#
# === Shell Completion
#
@@ -204,16 +208,10 @@
# === Further documentation
#
# The above examples should be enough to learn how to use this class. If you
-# have any questions, email me (gsinclair@soyabean.com.au) and I will update
-# this document.
+# have any questions, file a ticket at http://bugs.ruby-lang.org.
#
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
@@ -734,7 +732,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 = {}
@@ -1090,7 +1088,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.
@@ -1336,6 +1334,7 @@ XXX
#
# Same as #order, but removes switches destructively.
+ # Non-option arguments remain in +argv+.
#
def order!(argv = default_argv, &nonopt)
parse_in_order(argv, &nonopt)
@@ -1426,6 +1425,7 @@ XXX
#
# Same as #permute, but removes switches destructively.
+ # Non-option arguments remain in +argv+.
#
def permute!(argv = default_argv)
nonopts = []
@@ -1445,6 +1445,7 @@ XXX
#
# Same as #parse, but removes switches destructively.
+ # Non-option arguments remain in +argv+.
#
def parse!(argv = default_argv)
if ENV.include?('POSIXLY_CORRECT')
@@ -1631,15 +1632,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}
#
@@ -1647,7 +1655,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
@@ -1658,22 +1666,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
@@ -1928,10 +1954,3 @@ 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
diff --git a/lib/optparse/ac.rb b/lib/optparse/ac.rb
new file mode 100644
index 0000000000..6a8626094d
--- /dev/null
+++ b/lib/optparse/ac.rb
@@ -0,0 +1,50 @@
+require 'optparse'
+
+class OptionParser::AC < OptionParser
+ private
+
+ def _check_ac_args(name, block)
+ unless /\A\w[-\w]*\z/ =~ name
+ raise ArgumentError, name
+ end
+ unless block
+ raise ArgumentError, "no block given", ParseError.filter_backtrace(caller)
+ end
+ end
+
+ def _ac_arg_enable(prefix, name, help_string, block)
+ _check_ac_args(name, block)
+
+ sdesc = []
+ ldesc = ["--#{prefix}-#{name}"]
+ desc = [help_string]
+ q = name.downcase
+ enable = Switch::NoArgument.new(nil, proc {true}, sdesc, ldesc, nil, desc, block)
+ disable = Switch::NoArgument.new(nil, proc {false}, sdesc, ldesc, nil, desc, block)
+ top.append(enable, [], ["enable-" + q], disable, ['disable-' + q])
+ enable
+ end
+
+ public
+
+ def ac_arg_enable(name, help_string, &block)
+ _ac_arg_enable("enable", name, help_string, block)
+ end
+
+ def ac_arg_disable(name, help_string, &block)
+ _ac_arg_enable("disable", name, help_string, block)
+ end
+
+ def ac_arg_with(name, help_string, &block)
+ _check_ac_args(name, block)
+
+ sdesc = []
+ ldesc = ["--with-#{name}"]
+ desc = [help_string]
+ q = name.downcase
+ with = Switch::PlacedArgument.new(*search(:atype, String), sdesc, ldesc, nil, desc, block)
+ without = Switch::NoArgument.new(nil, proc {}, sdesc, ldesc, nil, desc, block)
+ top.append(with, [], ["with-" + q], without, ['without-' + q])
+ with
+ end
+end
diff --git a/lib/ostruct.rb b/lib/ostruct.rb
index a4c0d55d09..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
@@ -74,7 +74,8 @@ class OpenStruct
# Creates a new OpenStruct object. By default, the resulting OpenStruct
# object will have no attributes.
#
- # The optional +hash+, if given, will generate attributes and values.
+ # The optional +hash+, if given, will generate attributes and values
+ # (can be a Hash, an OpenStruct or a Struct).
# For example:
#
# require 'ostruct'
@@ -86,8 +87,9 @@ class OpenStruct
def initialize(hash=nil)
@table = {}
if hash
- for k,v in hash
- @table[k.to_sym] = v
+ hash.each_pair do |k, v|
+ k = k.to_sym
+ @table[k] = v
new_ostruct_member(k)
end
end
@@ -97,35 +99,45 @@ class OpenStruct
def initialize_copy(orig)
super
@table = @table.dup
+ @table.each_key{|key| new_ostruct_member(key)}
end
#
- # Provides marshalling support for use by the Marshal library. Returning the
- # underlying Hash table that contains the functions defined as the keys and
- # the values assigned to them.
+ # Converts the OpenStruct to a hash with keys representing
+ # each attribute (as symbols) and their corresponding values
+ # Example:
+ #
+ # require 'ostruct'
+ # data = OpenStruct.new("country" => "Australia", :population => 20_000_000)
+ # data.to_h # => {:country => "Australia", :population => 20000000 }
#
- # require 'ostruct'
+ def to_h
+ @table.dup
+ end
+
#
- # person = OpenStruct.new
- # person.name = 'John Smith'
- # person.age = 70
+ # Yields all attributes (as a symbol) along with the corresponding values
+ # or returns an enumerator if not block is given.
+ # Example:
#
- # person.marshal_dump # => { :name => 'John Smith', :age => 70 }
+ # require 'ostruct'
+ # data = OpenStruct.new("country" => "Australia", :population => 20_000_000)
+ # data.each_pair.to_a # => [[:country, "Australia"], [:population, 20000000]]
#
- def marshal_dump
- @table
+ def each_pair
+ return to_enum(__method__) { @table.size } unless block_given?
+ @table.each_pair{|p| yield p}
end
#
- # Provides marshalling support for use by the Marshal library. Accepting
- # a Hash of keys and values which will be used to populate the internal table
+ # Provides marshalling support for use by the Marshal library.
#
- # require 'ostruct'
+ def marshal_dump
+ @table
+ end
+
#
- # event = OpenStruct.new
- # hash = { 'time' => Time.now, 'title' => 'Birthday Party' }
- # event.marshal_load(hash)
- # event.title # => 'Birthday Party'
+ # Provides marshalling support for use by the Marshal library.
#
def marshal_load(x)
@table = x
@@ -133,50 +145,71 @@ class OpenStruct
end
#
- # #modifiable is used internally to check if the OpenStruct is able to be
+ # Used internally to check if the OpenStruct is able to be
# modified before granting access to the internal Hash table to be modified.
#
def modifiable
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
protected :modifiable
#
- # new_ostruct_member is used internally to defined properties on the
+ # Used internally to defined properties on the
# OpenStruct. It does this by using the metaprogramming function
- # define_method for both the getter method and the setter method.
+ # define_singleton_method for both the getter method and the setter method.
#
def new_ostruct_member(name)
name = name.to_sym
- unless self.respond_to?(name)
- class << self; self; end.class_eval do
- define_method(name) { @table[name] }
- define_method("#{name}=") { |x| modifiable[name] = x }
- end
+ unless respond_to?(name)
+ define_singleton_method(name) { @table[name] }
+ define_singleton_method("#{name}=") { |x| modifiable[name] = x }
end
name
end
+ protected :new_ostruct_member
def method_missing(mid, *args) # :nodoc:
mname = mid.id2name
len = args.length
- if mname.chomp!('=') && mid != :[]=
+ if mname.chomp!('=')
if len != 1
raise ArgumentError, "wrong number of arguments (#{len} for 1)", caller(1)
end
modifiable[new_ostruct_member(mname)] = args[0]
- elsif len == 0 && mid != :[]
+ 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
+ # Returns the value of a member.
+ #
+ # person = OpenStruct.new('name' => 'John Smith', 'age' => 70)
+ # person[:age] # => 70, same as ostruct.age
+ #
+ def [](name)
+ @table[name.to_sym]
+ end
+
+ #
+ # Sets the value of a member.
+ #
+ # person = OpenStruct.new('name' => 'John Smith', 'age' => 70)
+ # person[:age] = 42 # => equivalent to ostruct.age = 42
+ # person.age # => 42
+ #
+ def []=(name, value)
+ modifiable[new_ostruct_member(name)] = value
+ end
+
#
# Remove the named field from the object. Returns the value that the field
# contained if it was defined.
@@ -189,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
@@ -226,11 +259,28 @@ class OpenStruct
#
# Compares this object and +other+ for equality. An OpenStruct is equal to
- # +other+ when +other+ is an OpenStruct and the two object's Hash tables are
+ # +other+ when +other+ is an OpenStruct and the two objects' Hash tables are
# equal.
#
def ==(other)
- return false unless(other.kind_of?(OpenStruct))
- return @table == other.table
+ return false unless other.kind_of?(OpenStruct)
+ @table == other.table
+ end
+
+ #
+ # Compares this object and +other+ for equality. An OpenStruct is eql? to
+ # +other+ when +other+ is an OpenStruct and the two objects' Hash tables are
+ # eql?.
+ #
+ def eql?(other)
+ return false unless other.kind_of?(OpenStruct)
+ @table.eql?(other.table)
+ end
+
+ # Compute a hash-code for this OpenStruct.
+ # Two hashes with the same content will have the same hash code
+ # (and will be eql?).
+ def hash
+ @table.hash
end
end
diff --git a/lib/pp.rb b/lib/pp.rb
index 56d726dc7d..0091ddf74c 100644
--- a/lib/pp.rb
+++ b/lib/pp.rb
@@ -1,11 +1,43 @@
-# == Pretty-printer for Ruby objects.
+require 'prettyprint'
+
+module Kernel
+ # 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
+
+ private
+ # prints arguments in pretty form.
+ #
+ # pp returns argument(s).
+ def pp(*objs) # :nodoc:
+ objs.each {|obj|
+ PP.pp(obj)
+ }
+ objs.size <= 1 ? objs.first : objs
+ end
+ module_function :pp # :nodoc:
+end
+
+##
+# 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,
@@ -23,52 +55,42 @@
# @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
#
-# pp(obj)
+# Output <tt>obj(s)</tt> to <tt>$></tt> in pretty printed format.
#
-# output +obj+ to +$>+ in pretty printed format.
+# It returns <tt>obj(s)</tt>.
#
-# It returns +nil+.
+##
+# == Output Customization
#
-# = 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 define a customized pretty printing function for your classes,
+# redefine method <code>#pretty_print(pp)</code> in the class.
#
-# = Author
-# Tanaka Akira <akr@m17n.org>
-
-require 'prettyprint'
-
-module Kernel
- # returns a pretty printed object as a string.
- def pretty_inspect
- PP.pp(self, '')
- end
-
- private
- # prints arguments in pretty form.
- #
- # pp returns argument(s).
- def pp(*objs) # :doc:
- objs.each {|obj|
- PP.pp(obj)
- }
- objs.size <= 1 ? objs.first : objs
- end
- module_function :pp
-end
+# <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.
+#
+##
+# == Pretty-Print JSON
+#
+# To pretty-print JSON refer to JSON#pretty_generate.
+#
+##
+# == 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+.
@@ -105,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
@@ -164,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:
@@ -224,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|
@@ -239,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|
@@ -257,15 +286,14 @@ 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. specific to_s
- # 4. generic pretty_print
+ # 3. generic pretty_print
# A default pretty printing method for general objects.
# It calls #pretty_print_instance_variables to list instance variables.
@@ -282,18 +310,10 @@ class PP < PrettyPrint
inspect_method = method_method.call(:inspect)
rescue NameError
end
- begin
- to_s_method = method_method.call(:to_s)
- rescue NameError
- end
if inspect_method && /\(Kernel\)#/ !~ inspect_method.inspect
q.text self.inspect
elsif !inspect_method && self.respond_to?(:inspect)
q.text self.inspect
- elsif to_s_method && /\(Kernel\)#/ !~ to_s_method.inspect
- q.text self.to_s
- elsif !to_s_method && self.respond_to?(:to_s)
- q.text self.to_s
else
q.pp_object(self)
end
@@ -332,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
@@ -341,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]
@@ -366,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
@@ -381,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? ? '...' : '..')
@@ -396,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
@@ -478,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 }
@@ -503,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..5b1da330dd 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,10 +92,64 @@ class PrettyPrint
@group_queue = GroupQueue.new(root_group)
@indent = 0
end
- attr_reader :output, :maxwidth, :newline, :genspace
- attr_reader :indent, :group_queue
+
+ # The output object.
+ #
+ # This defaults to '', and should accept the << method
+ attr_reader :output
+
+ # The maximum width of a line, before it is separated in to a newline
+ #
+ # This defaults to 79, and should be a Fixnum
+ attr_reader :maxwidth
+
+ # The value that is appended to +output+ to add a new line.
+ #
+ # 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.
+ #
+ # 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.
+ #
+ # 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
@@ -166,7 +222,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 +276,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 +313,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 +370,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 +402,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 +451,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 +493,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 +562,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 4a20d93fb7..f359c12693 100644
--- a/lib/prime.rb
+++ b/lib/prime.rb
@@ -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.
-# Futhermore, 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
@@ -191,9 +191,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 +209,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 +272,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 +306,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 +337,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 +419,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 a4b8889093..e53951cbe6 100644
--- a/lib/profiler.rb
+++ b/lib/profiler.rb
@@ -1,39 +1,138 @@
+# Profile provides a way to Profile your Ruby application.
+#
+# Profiling your program is a way of determining which methods are called and
+# how long each method takes to complete. This way you can detect which
+# methods are possible bottlenecks.
+#
+# Profiling your program will slow down your execution time considerably,
+# so activate it only when you need it. Don't confuse benchmarking with
+# profiling.
+#
+# There are two ways to activate Profiling:
+#
+# == Command line
+#
+# Run your Ruby script with <code>-rprofile</code>:
+#
+# ruby -rprofile example.rb
+#
+# If you're profiling an executable in your <code>$PATH</code> you can use
+# <code>ruby -S</code>:
+#
+# ruby -rprofile -S some_executable
+#
+# == From code
+#
+# Just require 'profile':
+#
+# require 'profile'
+#
+# def slow_method
+# 5000.times do
+# 9999999999999999*999999999
+# end
+# end
+#
+# def fast_method
+# 5000.times do
+# 9999999999999999+999999999
+# end
+# end
+#
+# slow_method
+# fast_method
+#
+# The output in both cases is a report when the execution is over:
+#
+# ruby -rprofile example.rb
+#
+# % cumulative self self total
+# time seconds seconds calls ms/call ms/call name
+# 68.42 0.13 0.13 2 65.00 95.00 Integer#times
+# 15.79 0.16 0.03 5000 0.01 0.01 Fixnum#*
+# 15.79 0.19 0.03 5000 0.01 0.01 Fixnum#+
+# 0.00 0.19 0.00 2 0.00 0.00 IO#set_encoding
+# 0.00 0.19 0.00 1 0.00 100.00 Object#slow_method
+# 0.00 0.19 0.00 2 0.00 0.00 Module#method_added
+# 0.00 0.19 0.00 1 0.00 90.00 Object#fast_method
+# 0.00 0.19 0.00 1 0.00 190.00 #toplevel
+
module Profiler__
+ class Wrapper < Struct.new(:defined_class, :method_id, :hash) # :nodoc:
+ private :defined_class=, :method_id=, :hash=
+
+ def initialize(klass, mid)
+ super(klass, mid, nil)
+ self.hash = Struct.instance_method(:hash).bind(self).call
+ end
+
+ def to_s
+ "#{defined_class.inspect}#".sub(/\A\#<Class:(.*)>#\z/, '\1.') << method_id.to_s
+ end
+ alias inspect to_s
+ end
+
# internal values
- @@start = @@stack = @@map = nil
- PROFILE_PROC = proc{|event, file, line, id, binding, klass|
- case event
- when "call", "c-call"
- now = Process.times[0]
- @@stack.push [now, 0.0]
- when "return", "c-return"
- now = Process.times[0]
- key = [klass, id]
- if tick = @@stack.pop
- data = (@@map[key] ||= [0, 0.0, 0.0, key])
- data[0] += 1
- cost = now - tick[0]
- data[1] += cost
- data[2] += cost - tick[1]
- @@stack[-1][1] += cost if @@stack[-1]
- end
+ @@start = nil # the start time that profiling began
+ @@stacks = nil # the map of stacks keyed by thread
+ @@maps = nil # the map of call data keyed by thread, class and id. Call data contains the call count, total time,
+ PROFILE_CALL_PROC = TracePoint.new(*%i[call c_call b_call]) {|tp| # :nodoc:
+ now = Process.times[0]
+ stack = (@@stacks[Thread.current] ||= [])
+ stack.push [now, 0.0]
+ }
+ PROFILE_RETURN_PROC = TracePoint.new(*%i[return c_return b_return]) {|tp| # :nodoc:
+ now = Process.times[0]
+ key = Wrapper.new(tp.defined_class, tp.method_id)
+ stack = (@@stacks[Thread.current] ||= [])
+ if tick = stack.pop
+ threadmap = (@@maps[Thread.current] ||= {})
+ data = (threadmap[key] ||= [0, 0.0, 0.0, key])
+ data[0] += 1
+ cost = now - tick[0]
+ data[1] += cost
+ data[2] += cost - tick[1]
+ stack[-1][1] += cost if stack[-1]
end
}
module_function
+ # Starts the profiler.
+ #
+ # See Profiler__ for more information.
def start_profile
@@start = Process.times[0]
- @@stack = []
- @@map = {}
- set_trace_func PROFILE_PROC
+ @@stacks = {}
+ @@maps = {}
+ PROFILE_CALL_PROC.enable
+ PROFILE_RETURN_PROC.enable
end
+ # Stops the profiler.
+ #
+ # See Profiler__ for more information.
def stop_profile
- set_trace_func nil
+ 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
if total == 0 then total = 0.01 end
- data = @@map.values
+ totals = {}
+ @@maps.values.each do |threadmap|
+ threadmap.each do |key, data|
+ total_data = (totals[key] ||= [0, 0.0, 0.0, key])
+ total_data[0] += data[0]
+ total_data[1] += data[1]
+ total_data[2] += data[2]
+ end
+ end
+
+ # Maybe we should show a per thread output and a totals view?
+
+ data = totals.values
data = data.sort_by{|x| -x[2]}
sum = 0
f.printf " %% cumulative self self total\n"
@@ -41,19 +140,9 @@ module_function
for d in data
sum += d[2]
f.printf "%6.2f %8.2f %8.2f %8d ", d[2]/total*100, sum, d[2], d[0]
- f.printf "%8.2f %8.2f %s\n", d[2]*1000/d[0], d[1]*1000/d[0], get_name(*d[3])
+ f.printf "%8.2f %8.2f %s\n", d[2]*1000/d[0], d[1]*1000/d[0], d[3]
end
f.printf "%6.2f %8.2f %8.2f %8d ", 0.0, total, 0.0, 1 # ???
f.printf "%8.2f %8.2f %s\n", 0.0, total*1000, "#toplevel" # ???
end
- def get_name(klass, id)
- name = klass.to_s || ""
- if klass.kind_of? Class
- name += "#"
- else
- name += "."
- end
- name + id.id2name
- end
- private :get_name
end
diff --git a/lib/pstore.rb b/lib/pstore.rb
index 429d7e5c7d..a2813a8e20 100644
--- a/lib/pstore.rb
+++ b/lib/pstore.rb
@@ -7,10 +7,7 @@
#
# See PStore for documentation.
-
-require "fileutils"
require "digest/md5"
-require "thread"
#
# PStore implements a file based persistence mechanism based on a Hash. User
@@ -141,8 +138,8 @@ class PStore
# Raises PStore::Error if the calling code is not in a PStore#transaction or
# if the code is in a read-only PStore#transaction.
#
- def in_transaction_wr()
- in_transaction()
+ def in_transaction_wr
+ in_transaction
raise PStore::Error, "in read-only transaction" if @rdonly
end
private :in_transaction, :in_transaction_wr
@@ -200,7 +197,7 @@ class PStore
# be read-only. It will raise PStore::Error if called at any other time.
#
def []=(name, value)
- in_transaction_wr()
+ in_transaction_wr
@table[name] = value
end
#
@@ -210,7 +207,7 @@ class PStore
# be read-only. It will raise PStore::Error if called at any other time.
#
def delete(name)
- in_transaction_wr()
+ in_transaction_wr
@table.delete name
end
@@ -310,10 +307,18 @@ class PStore
#
# Note that PStore does not support nested transactions.
#
- def transaction(read_only = false, &block) # :yields: pstore
+ def transaction(read_only = false) # :yields: pstore
value = nil
- raise PStore::Error, "nested transaction" if !@thread_safe && @lock.locked?
- @lock.synchronize do
+ if !@thread_safe
+ raise PStore::Error, "nested transaction" unless @lock.try_lock
+ else
+ begin
+ @lock.lock
+ rescue ThreadError
+ raise PStore::Error, "nested transaction"
+ end
+ end
+ begin
@rdonly = read_only
@abort = false
file = open_and_lock_file(@filename, read_only)
@@ -338,10 +343,10 @@ class PStore
value = yield(self)
end
end
+ ensure
+ @lock.unlock
end
value
- rescue ThreadError
- raise PStore::Error, "nested transaction"
end
private
@@ -388,9 +393,7 @@ class PStore
if read_only
begin
table = load(file)
- if !table.is_a?(Hash)
- raise Error, "PStore file seems to be corrupted."
- end
+ raise Error, "PStore file seems to be corrupted." unless table.is_a?(Hash)
rescue EOFError
# This seems to be a newly-created file.
table = {}
@@ -402,14 +405,12 @@ class PStore
# This seems to be a newly-created file.
table = {}
checksum = empty_marshal_checksum
- size = empty_marshal_data.size
+ size = empty_marshal_data.bytesize
else
table = load(data)
checksum = Digest::MD5.digest(data)
- size = data.size
- if !table.is_a?(Hash)
- raise Error, "PStore file seems to be corrupted."
- end
+ size = data.bytesize
+ raise Error, "PStore file seems to be corrupted." unless table.is_a?(Hash)
end
data.replace(EMPTY_STRING)
[table, checksum, size]
@@ -417,44 +418,17 @@ class PStore
end
def on_windows?
- is_windows = RUBY_PLATFORM =~ /mswin/ ||
- RUBY_PLATFORM =~ /mingw/ ||
- RUBY_PLATFORM =~ /bccwin/ ||
- RUBY_PLATFORM =~ /wince/
+ is_windows = RUBY_PLATFORM =~ /mswin|mingw|bccwin|wince/
self.class.__send__(:define_method, :on_windows?) do
is_windows
end
is_windows
end
- # Check whether Marshal.dump supports the 'canonical' option. This option
- # makes sure that Marshal.dump always dumps data structures in the same order.
- # This is important because otherwise, the checksums that we generate may differ.
- def marshal_dump_supports_canonical_option?
- begin
- Marshal.dump(nil, -1, true)
- result = true
- rescue
- result = false
- end
- self.class.instance_method(:marshal_dump_supports_canonical_option?)
- self.class.__send__(:define_method, :marshal_dump_supports_canonical_option?) do
- result
- end
- result
- end
-
def save_data(original_checksum, original_file_size, file)
- # We only want to save the new data if the size or checksum has changed.
- # This results in less filesystem calls, which is good for performance.
- if marshal_dump_supports_canonical_option?
- new_data = Marshal.dump(@table, -1, true)
- else
- new_data = dump(@table)
- end
- new_checksum = Digest::MD5.digest(new_data)
+ new_data = dump(@table)
- if new_data.size != original_file_size || new_checksum != original_checksum
+ if new_data.bytesize != original_file_size || Digest::MD5.digest(new_data) != original_checksum
if @ultra_safe && !on_windows?
# Windows doesn't support atomic file renames.
save_data_with_atomic_file_rename_strategy(new_data, file)
@@ -484,8 +458,8 @@ class PStore
def save_data_with_fast_strategy(data, file)
file.rewind
- file.truncate(0)
file.write(data)
+ file.truncate(data.bytesize)
end
diff --git a/lib/racc/parser.rb b/lib/racc/parser.rb
index 737b0fda5d..058d080a8a 100644
--- a/lib/racc/parser.rb
+++ b/lib/racc/parser.rb
@@ -1,4 +1,4 @@
-#
+#--
# $originalId: parser.rb,v 1.8 2006/07/06 11:42:07 aamine Exp $
#
# Copyright (c) 1999-2006 Minero Aoki
@@ -9,11 +9,7 @@
# As a special exception, when this code is copied by Racc
# into a Racc output file, you may use that output file
# without restriction.
-#
-
-unless defined?(NotImplementedError)
- NotImplementedError = NotImplementError
-end
+#++
module Racc
class ParseError < StandardError; end
@@ -22,10 +18,164 @@ unless defined?(::ParseError)
ParseError = Racc::ParseError
end
+# Racc is a LALR(1) parser generator.
+# It is written in Ruby itself, and generates Ruby programs.
+#
+# == Command-line Reference
+#
+# racc [-o<var>filename</var>] [--output-file=<var>filename</var>]
+# [-e<var>rubypath</var>] [--embedded=<var>rubypath</var>]
+# [-v] [--verbose]
+# [-O<var>filename</var>] [--log-file=<var>filename</var>]
+# [-g] [--debug]
+# [-E] [--embedded]
+# [-l] [--no-line-convert]
+# [-c] [--line-convert-all]
+# [-a] [--no-omit-actions]
+# [-C] [--check-only]
+# [-S] [--output-status]
+# [--version] [--copyright] [--help] <var>grammarfile</var>
+#
+# [+filename+]
+# 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.
+# [-v, --verbose]
+# verbose mode. create +filename+.output file, like yacc's y.output file.
+# [-g, --debug]
+# 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 grammar file and quit.
+# [-S, --output-status]
+# Print messages time to time while compiling.
+# [-l, --no-line-convert]
+# turns off line number converting.
+# [-c, --line-convert-all]
+# Convert line number of actions, inner, header and footer.
+# [-a, --no-omit-actions]
+# Call all actions, even if an action is empty.
+# [--version]
+# print Racc version and quit.
+# [--copyright]
+# Print copyright and quit.
+# [--help]
+# Print usage and quit.
+#
+# == Generating Parser Using Racc
+#
+# To compile Racc grammar file, simply type:
+#
+# $ racc parse.y
+#
+# This creates Ruby script file "parse.tab.y". The -o option can change the output filename.
+#
+# == Writing A Racc Grammar File
+#
+# If you want your own parser, you have to write a grammar file.
+# A grammar file contains the name of your parser class, grammar for the parser,
+# user code, and anything else.
+# When writing a grammar file, yacc's knowledge is helpful.
+# If you have not used yacc before, Racc is not too difficult.
+#
+# Here's an example Racc grammar file.
+#
+# class Calcparser
+# rule
+# target: exp { print val[0] }
+#
+# exp: exp '+' exp
+# | exp '*' exp
+# | '(' exp ')'
+# | NUMBER
+# end
+#
+# Racc grammar files resemble yacc files.
+# But (of course), this is Ruby code.
+# yacc's $$ is the 'result', $0, $1... is
+# an array called 'val', and $-1, $-2... is an array called '_values'.
+#
+# See the {Grammar File Reference}[rdoc-ref:lib/racc/rdoc/grammar.en.rdoc] for
+# more information on grammar files.
+#
+# == Parser
+#
+# Then you must prepare the parse entry method. There are two types of
+# parse methods in Racc, Racc::Parser#do_parse and Racc::Parser#yyparse
+#
+# Racc::Parser#do_parse is simple.
+#
+# It's yyparse() of yacc, and Racc::Parser#next_token is yylex().
+# This method must returns an array like [TOKENSYMBOL, ITS_VALUE].
+# EOF is [false, false].
+# (TOKENSYMBOL is a Ruby symbol (taken from String#intern) by default.
+# If you want to change this, see the grammar reference.
+#
+# Racc::Parser#yyparse is little complicated, but useful.
+# It does not use Racc::Parser#next_token, instead it gets tokens from any iterator.
+#
+# For example, <code>yyparse(obj, :scan)</code> causes
+# calling +obj#scan+, and you can return tokens by yielding them from +obj#scan+.
+#
+# == Debugging
+#
+# When debugging, "-v" or/and the "-g" option is helpful.
+#
+# "-v" creates verbose log file (.output).
+# "-g" creates a "Verbose Parser".
+# Verbose Parser prints the internal status when parsing.
+# But it's _not_ automatic.
+# You must use -g option and set +@yydebug+ to +true+ in order to get output.
+# -g option only creates the verbose parser.
+#
+# === Racc reported syntax error.
+#
+# Isn't there too many "end"?
+# grammar of racc file is changed in v0.10.
+#
+# Racc does not use '%' mark, while yacc uses huge number of '%' marks..
+#
+# === Racc reported "XXXX conflicts".
+#
+# Try "racc -v xxxx.y".
+# It causes producing racc's internal log file, xxxx.output.
+#
+# === Generated parsers does not work correctly
+#
+# Try "racc -g xxxx.y".
+# This command let racc generate "debugging parser".
+# Then set @yydebug=true in your parser.
+# It produces a working log of your parser.
+#
+# == Re-distributing Racc runtime
+#
+# A parser, which is created by Racc, requires the Racc runtime module;
+# racc/parser.rb.
+#
+# Ruby 1.8.x comes with Racc runtime module,
+# you need NOT distribute Racc runtime files.
+#
+# If you want to include the Racc runtime module with your parser.
+# This can be done by using '-E' option:
+#
+# $ racc -E -omyparser.rb myparser.y
+#
+# This command creates myparser.rb which `includes' Racc runtime.
+# Only you must do is to distribute your parser file (myparser.rb).
+#
+# Note: parser.rb is LGPL, but your parser is not.
+# Your own parser is completely yours.
module Racc
unless defined?(Racc_No_Extentions)
- Racc_No_Extentions = false
+ Racc_No_Extentions = false # :nodoc:
end
class Parser
@@ -37,7 +187,7 @@ 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'
@@ -46,11 +196,11 @@ module Racc
raise LoadError, 'selecting ruby version of racc runtime core'
end
- Racc_Main_Parsing_Routine = :_racc_do_parse_c
- Racc_YY_Parse_Method = :_racc_yyparse_c
- Racc_Runtime_Core_Version = Racc_Runtime_Core_Version_C
- Racc_Runtime_Core_Revision = Racc_Runtime_Core_Revision_C
- Racc_Runtime_Type = 'c'
+ Racc_Main_Parsing_Routine = :_racc_do_parse_c # :nodoc:
+ Racc_YY_Parse_Method = :_racc_yyparse_c # :nodoc:
+ Racc_Runtime_Core_Version = Racc_Runtime_Core_Version_C # :nodoc:
+ Racc_Runtime_Core_Revision = Racc_Runtime_Core_Revision_C # :nodoc:
+ Racc_Runtime_Type = 'c' # :nodoc:
rescue LoadError
Racc_Main_Parsing_Routine = :_racc_do_parse_rb
Racc_YY_Parse_Method = :_racc_yyparse_rb
@@ -59,12 +209,10 @@ module Racc
Racc_Runtime_Type = 'ruby'
end
- def Parser.racc_runtime_type
+ def Parser.racc_runtime_type # :nodoc:
Racc_Runtime_Type
end
- private
-
def _racc_setup
@yydebug = false unless self.class::Racc_debug_parser
@yydebug = false unless defined?(@yydebug)
@@ -91,16 +239,33 @@ module Racc
@racc_error_status = 0
end
- ###
- ### do_parse
- ###
-
- class_eval %{
+ # The entry point of the parser. This method is used with #next_token.
+ # If Racc wants to get token (and its value), calls next_token.
+ #
+ # Example:
+ # def parse
+ # @q = [[1,1],
+ # [2,2],
+ # [3,3],
+ # [false, '$']]
+ # do_parse
+ # end
+ #
+ # def next_token
+ # @q.shift
+ # end
def do_parse
- #{Racc_Main_Parsing_Routine}(_racc_setup(), false)
+ __send__(Racc_Main_Parsing_Routine, _racc_setup(), false)
end
- }
+ # The method to fetch next token.
+ # If you use #do_parse method, you must implement #next_token.
+ #
+ # The format of return value is [TOKEN_SYMBOL, VALUE].
+ # +token-symbol+ is represented by Ruby's symbol by default, e.g. :IDENT
+ # for 'IDENT'. ";" (String) for ';'.
+ #
+ # The final symbol (End of file) must be false.
def next_token
raise NotImplementedError, "#{self.class}\#next_token is not defined"
end
@@ -145,15 +310,14 @@ module Racc
}
end
- ###
- ### yyparse
- ###
-
- class_eval %{
+ # Another entry point for the parser.
+ # If you use this method, you must implement RECEIVER#METHOD_ID method.
+ #
+ # RECEIVER#METHOD_ID is a method to get next token.
+ # It must 'yield' the token, which format is [TOKEN-SYMBOL, VALUE].
def yyparse(recv, mid)
- #{Racc_YY_Parse_Method}(recv, mid, _racc_setup(), true)
+ __send__(Racc_YY_Parse_Method, recv, mid, _racc_setup(), true)
end
- }
def _racc_yyparse_rb(recv, mid, arg, c_debug)
action_table, action_check, action_default, action_pointer,
@@ -347,27 +511,43 @@ module Racc
goto_default[k1]
end
+ # This method is called when a parse error is found.
+ #
+ # ERROR_TOKEN_ID is an internal ID of token which caused error.
+ # You can get string representation of this ID by calling
+ # #token_to_str.
+ #
+ # ERROR_VALUE is a value of error token.
+ #
+ # value_stack is a stack of symbol values.
+ # DO NOT MODIFY this object.
+ #
+ # This method raises ParseError by default.
+ #
+ # If this method returns, parsers enter "error recovering mode".
def on_error(t, val, vstack)
raise ParseError, sprintf("\nparse error on value %s (%s)",
val.inspect, token_to_str(t) || '?')
end
+ # Enter error recovering mode.
+ # This method does not call #on_error.
def yyerror
throw :racc_jump, 1
end
+ # Exit parser.
+ # Return value is Symbol_Value_Stack[0].
def yyaccept
throw :racc_jump, 2
end
+ # Leave error recovering mode.
def yyerrok
@racc_error_status = 0
end
- #
- # for debugging output
- #
-
+ # For debugging output
def racc_read_token(t, tok, val)
@racc_debug_out.print 'read '
@racc_debug_out.print tok.inspect, '(', racc_token2str(t), ') '
@@ -434,6 +614,7 @@ module Racc
raise "[Racc Bug] can't convert token #{tok} to string"
end
+ # Convert internal ID of token symbol to the string.
def token_to_str(t)
self.class::Racc_token_to_s_table[t]
end
diff --git a/lib/racc/rdoc/grammar.en.rdoc b/lib/racc/rdoc/grammar.en.rdoc
new file mode 100644
index 0000000000..b667a7cb5e
--- /dev/null
+++ b/lib/racc/rdoc/grammar.en.rdoc
@@ -0,0 +1,226 @@
+= Racc Grammar File Reference
+
+== Global Structure
+
+== 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.
+
+== Comment
+
+You can insert comment about all places. Two style comment can be used,
+Ruby style (#.....) and C style (/*......*/) .
+
+== Class Block
+
+The class block is formed like this:
+
+ class CLASS_NAME
+ [precedance table]
+ [token declearations]
+ [expected number of S/R conflict]
+ [options]
+ [semantic value convertion]
+ [start rule]
+ rule
+ GRAMMARS
+
+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:
+
+ module M
+ class C
+ :
+ :
+ end
+ end
+
+== Grammar Block
+
+The grammar block discripts grammar which is able
+to be understood by parser. Syntax is:
+
+ (token): (token) (token) (token).... (action)
+
+ (token): (token) (token) (token).... (action)
+ | (token) (token) (token).... (action)
+ | (token) (token) (token).... (action)
+
+(action) is an action which is executed when its (token)s are found.
+(action) is a ruby code block, which is surrounded by braces:
+
+ { print val[0]
+ puts val[1] }
+
+Note that you cannot use '%' string, here document, '%r' regexp in action.
+
+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.
+
+Here is an example of whole grammar block.
+
+ rule
+ goal: definition ruls source { result = val }
+
+ definition: /* none */ { result = [] }
+ | definition startdesig { result[0] = val[1] }
+ | definition
+ precrule # this line continue from upper line
+ {
+ result[1] = val[1]
+ }
+
+ startdesig: START TOKEN
+
+You can use following special local variables in action.
+
+* result ($$)
+
+The value of left-hand side (lhs). A default value is val[0].
+
+* val ($1,$2,$3...)
+
+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.
+
+== Operator Precedence
+
+This function is equal to '%prec' in yacc.
+To designate this block:
+
+ prechigh
+ nonassoc '++'
+ left '*' '/'
+ left '+' '-'
+ right '='
+ preclow
+
+`right' is yacc's %right, `left' is yacc's %left.
+
+`=' + (symbol) means yacc's %prec:
+
+ prechigh
+ nonassoc UMINUS
+ left '*' '/'
+ left '+' '-'
+ preclow
+
+ rule
+ exp: exp '*' exp
+ | exp '-' exp
+ | '-' exp =UMINUS # equals to "%prec UMINUS"
+ :
+ :
+
+== expect
+
+Racc has bison's "expect" directive.
+
+ # Example
+
+ class MyParser
+ rule
+ expect 3
+ :
+ :
+
+This directive declears "expected" number of shift/reduce conflict.
+If "expected" number is equal to real number of conflicts,
+racc does not print confliction warning message.
+
+== Declaring Tokens
+
+By declaring tokens, you can avoid many meanless bugs.
+If decleared token does not exist/existing token does not decleared,
+Racc output warnings. Declearation syntax is:
+
+ token TOKEN_NAME AND_IS_THIS
+ ALSO_THIS_IS AGAIN_AND_AGAIN THIS_IS_LAST
+
+== Options
+
+You can write options for racc command in your racc file.
+
+ options OPTION OPTION ...
+
+Options are:
+
+* omit_action_call
+
+omit empty action call or not.
+
+* result_var
+
+use/does not use local variable "result"
+
+You can use 'no_' prefix to invert its meanings.
+
+== Converting Token Symbol
+
+Token symbols are, as default,
+
+ * naked token string in racc file (TOK, XFILE, this_is_token, ...)
+ --> symbol (:TOK, :XFILE, :this_is_token, ...)
+ * quoted string (':', '.', '(', ...)
+ --> same string (':', '.', '(', ...)
+
+You can change this default by "convert" block.
+Here is an example:
+
+ convert
+ PLUS 'PlusClass' # We use PlusClass for symbol of `PLUS'
+ MIN 'MinusClass' # We use MinusClass for symbol of `MIN'
+ end
+
+We can use almost all ruby value can be used by token symbol,
+except 'false' and 'nil'. These are causes unexpected parse error.
+
+If you want to use String as token symbol, special care is required.
+For example:
+
+ convert
+ class '"cls"' # in code, "cls"
+ PLUS '"plus\n"' # in code, "plus\n"
+ MIN "\"minus#{val}\"" # in code, \"minus#{val}\"
+ end
+
+== Start Rule
+
+'%start' in yacc. This changes start rule.
+
+ 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".
+
+Format of user code is like this:
+
+ ---- header
+ ruby statement
+ ruby statement
+ ruby statement
+
+ ---- inner
+ ruby statement
+ :
+ :
+
+If four '-' exist on line head,
+racc treat it as beginning of user code block.
+A name of user code must be one word.
diff --git a/lib/rake.rb b/lib/rake.rb
index fc1a6a5165..531cfc82b8 100644
--- a/lib/rake.rb
+++ b/lib/rake.rb
@@ -40,9 +40,12 @@ require 'rake/ext/time'
require 'rake/win32'
+require 'rake/linked_list'
+require 'rake/scope'
require 'rake/task_argument_error'
require 'rake/rule_recursion_overflow_error'
require 'rake/rake_module'
+require 'rake/trace_output'
require 'rake/pseudo_status'
require 'rake/task_arguments'
require 'rake/invocation_chain'
@@ -58,6 +61,7 @@ require 'rake/early_time'
require 'rake/name_space'
require 'rake/task_manager'
require 'rake/application'
+require 'rake/backtrace'
$trace = false
diff --git a/lib/rake/alt_system.rb b/lib/rake/alt_system.rb
index 05af19863a..a42597bf09 100644
--- a/lib/rake/alt_system.rb
+++ b/lib/rake/alt_system.rb
@@ -39,7 +39,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 +73,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 2079fb9be6..b76244b7a3 100644
--- a/lib/rake/application.rb
+++ b/lib/rake/application.rb
@@ -2,16 +2,23 @@ require 'shellwords'
require 'optparse'
require 'rake/task_manager'
+require 'rake/file_list'
+require 'rake/thread_pool'
+require 'rake/thread_history_display'
+require 'rake/trace_output'
require 'rake/win32'
module Rake
+ CommandLineOptionError = Class.new(StandardError)
+
######################################################################
# Rake main application object. When invoking +rake+ from the
# command line, a Rake::Application object is created and run.
#
class Application
include TaskManager
+ include TraceOutput
# The name of the application (typically 'rake')
attr_reader :name
@@ -28,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
@@ -54,7 +66,7 @@ module Rake
#
# * Initialize the command line options (+init+).
# * Define the tasks (+load_rakefile+).
- # * Run the top level tasks (+run_tasks+).
+ # * Run the top level tasks (+top_level+).
#
# If you wish to build a custom rake command, you should call
# +init+ on your application. Then define any tasks. Finally,
@@ -85,7 +97,7 @@ module Rake
# Run the top level tasks of a Rake application.
def top_level
- standard_exception_handling do
+ run_with_threads do
if options.show_tasks
display_tasks_and_comments
elsif options.show_prereqs
@@ -96,6 +108,22 @@ module Rake
end
end
+ # Run the given block with the thread startup and shutdown.
+ def run_with_threads
+ thread_pool.gather_history if options.job_stats == :history
+
+ yield
+
+ thread_pool.join
+ if options.job_stats
+ stats = thread_pool.statistics
+ puts "Maximum active threads: #{stats[:max_active_threads]}"
+ puts "Total threads in play: #{stats[:total_threads_in_play]}"
+ end
+ ThreadHistoryDisplay.new(thread_pool.history).show if
+ options.job_stats == :history
+ end
+
# Add a loader to handle imported files ending in the extension
# +ext+.
def add_loader(ext, loader)
@@ -108,6 +136,11 @@ module Rake
@options ||= OpenStruct.new
end
+ # Return the thread pool used for multithreaded processing.
+ def thread_pool # :nodoc:
+ @thread_pool ||= ThreadPool.new(options.thread_pool_size || FIXNUM_MAX)
+ end
+
# private ----------------------------------------------------------------
def invoke_task(task_string)
@@ -129,32 +162,37 @@ module Rake
# 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
+ yield
+ rescue SystemExit
+ # Exit silently with current status
+ raise
+ rescue OptionParser::InvalidOption => ex
+ $stderr.puts ex.message
+ exit(false)
+ rescue Exception => ex
+ # Exit with error message
+ display_error_message(ex)
+ exit_because_of_exception(ex)
+ end
+
+ # Exit the program because of an unhandle exception.
+ # (may be overridden by subclasses)
+ def exit_because_of_exception(ex)
+ exit(false)
end
# Display the error message that caused the exception.
def display_error_message(ex)
- $stderr.puts "#{name} aborted!"
- $stderr.puts ex.message
- if options.trace
- $stderr.puts ex.backtrace.join("\n")
+ trace "#{name} aborted!"
+ trace ex.message
+ if options.backtrace
+ trace ex.backtrace.join("\n")
else
- $stderr.puts rakefile_location(ex.backtrace)
+ trace Backtrace.collapse(ex.backtrace).join("\n")
end
- $stderr.puts "Tasks: #{ex.chain}" if has_chain?(ex)
- $stderr.puts "(See full trace by running task with --trace)" unless options.trace
+ 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.
@@ -163,10 +201,11 @@ module Rake
# 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}"
+ 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?
@@ -180,7 +219,7 @@ module Rake
def have_rakefile
@rakefiles.each do |fn|
if File.exist?(fn)
- others = Dir.glob(fn, File::FNM_CASEFOLD)
+ others = FileList.glob(fn, File::FNM_CASEFOLD)
return others.size == 1 ? others.first : fn
elsif fn == ''
return fn
@@ -195,7 +234,7 @@ module Rake
end
# Override the detected TTY output state (mostly for testing)
- def tty_output=( tty_output_state )
+ def tty_output=(tty_output_state)
@tty_output = tty_output_state
end
@@ -208,21 +247,28 @@ module Rake
# Display the tasks and comments.
def display_tasks_and_comments
displayable_tasks = tasks.select { |t|
- 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|
puts "#{name} #{t.name_with_args}"
- t.full_comment.split("\n").each do |line|
+ comment = t.full_comment || ""
+ comment.split("\n").each do |line|
puts " #{line}"
end
puts
@@ -230,7 +276,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
@@ -263,7 +309,8 @@ module Rake
end
def unix?
- RbConfig::CONFIG['host_os'] =~ /(aix|darwin|linux|(net|free|open)bsd|cygwin|solaris|irix|hpux)/i
+ RbConfig::CONFIG['host_os'] =~
+ /(aix|darwin|linux|(net|free|open)bsd|cygwin|solaris|irix|hpux)/i
end
def windows?
@@ -271,10 +318,12 @@ module Rake
end
def truncate(string, width)
- if string.length <= width
+ if string.nil?
+ ""
+ elsif string.length <= width
string
else
- ( string[0, width-3] || "" ) + "..."
+ (string[0, width - 3] || "") + "..."
end
end
@@ -286,144 +335,244 @@ module Rake
end
end
+ def trace(*strings)
+ options.trace_output ||= $stderr
+ trace_on(options.trace_output, *strings)
+ end
+
+ def sort_options(options)
+ options.sort_by { |opt|
+ opt.select { |o| o =~ /^-/ }.map { |o| o.downcase }.sort.reverse
+ }
+ end
+ private :sort_options
+
# A list of all the standard options used in rake, suitable for
# passing to OptionParser.
def standard_rake_options
- [
- ['--classic-namespace', '-C', "Put Task and FileTask in the top level namespace",
- lambda { |value|
- require 'rake/classic_namespace'
- options.classic_namespace = true
- }
- ],
- ['--describe', '-D [PATTERN]', "Describe the tasks (matching optional PATTERN), then exit.",
- lambda { |value|
- options.show_tasks = :describe
- options.show_task_pattern = Regexp.new(value || '')
- TaskManager.record_task_metadata = true
- }
- ],
- ['--dry-run', '-n', "Do a dry run without executing actions.",
- lambda { |value|
- Rake.verbose(true)
- Rake.nowrite(true)
- options.dryrun = true
- options.trace = true
- }
- ],
- ['--execute', '-e CODE', "Execute some Ruby code and exit.",
- lambda { |value|
- eval(value)
- exit
- }
- ],
- ['--execute-print', '-p CODE', "Execute some Ruby code, print the result, then exit.",
- lambda { |value|
- puts eval(value)
- exit
- }
- ],
- ['--execute-continue', '-E CODE',
- "Execute some Ruby code, then continue with normal task processing.",
- lambda { |value| eval(value) }
- ],
- ['--libdir', '-I LIBDIR', "Include LIBDIR in the search path for required modules.",
- lambda { |value| $:.push(value) }
- ],
- ['--no-search', '--nosearch', '-N', "Do not search parent directories for the Rakefile.",
- lambda { |value| options.nosearch = true }
- ],
- ['--prereqs', '-P', "Display the tasks and dependencies, then exit.",
- lambda { |value| options.show_prereqs = true }
- ],
- ['--quiet', '-q', "Do not log messages to standard output.",
- lambda { |value| Rake.verbose(false) }
- ],
- ['--rakefile', '-f [FILE]', "Use FILE as the rakefile.",
- lambda { |value|
- value ||= ''
- @rakefiles.clear
- @rakefiles << value
- }
- ],
- ['--rakelibdir', '--rakelib', '-R RAKELIBDIR',
- "Auto-import any .rake files in RAKELIBDIR. (default is 'rakelib')",
- # HACK Use File::PATH_SEPARATOR
- lambda { |value| options.rakelib = value.split(':') }
- ],
- ['--require', '-r MODULE', "Require MODULE before executing rakefile.",
- lambda { |value|
- begin
- require value
- rescue LoadError => ex
+ sort_options(
+ [
+ ['--all', '-A',
+ "Show all tasks, even uncommented ones",
+ lambda { |value|
+ options.show_all_tasks = value
+ }
+ ],
+ ['--backtrace=[OUT]',
+ "Enable full backtrace. OUT can be stderr (default) or stdout.",
+ lambda { |value|
+ options.backtrace = true
+ select_trace_output(options, 'backtrace', value)
+ }
+ ],
+ ['--comments',
+ "Show commented tasks only",
+ lambda { |value|
+ options.show_all_tasks = !value
+ }
+ ],
+ ['--describe', '-D [PATTERN]',
+ "Describe the tasks (matching optional PATTERN), then exit.",
+ lambda { |value|
+ select_tasks_to_show(options, :describe, value)
+ }
+ ],
+ ['--dry-run', '-n',
+ "Do a dry run without executing actions.",
+ lambda { |value|
+ Rake.verbose(true)
+ Rake.nowrite(true)
+ options.dryrun = true
+ options.trace = true
+ }
+ ],
+ ['--execute', '-e CODE',
+ "Execute some Ruby code and exit.",
+ lambda { |value|
+ eval(value)
+ exit
+ }
+ ],
+ ['--execute-print', '-p CODE',
+ "Execute some Ruby code, print the result, then exit.",
+ lambda { |value|
+ puts eval(value)
+ exit
+ }
+ ],
+ ['--execute-continue', '-E CODE',
+ "Execute some Ruby code, " +
+ "then continue with normal task processing.",
+ lambda { |value| eval(value) }
+ ],
+ ['--jobs', '-j [NUMBER]',
+ "Specifies the maximum number of tasks to execute in parallel. " +
+ "(default is 2)",
+ lambda { |value|
+ options.thread_pool_size = [(value || 2).to_i, 2].max
+ }
+ ],
+ ['--job-stats [LEVEL]',
+ "Display job statistics. " +
+ "LEVEL=history displays a complete job list",
+ lambda { |value|
+ if value =~ /^history/i
+ options.job_stats = :history
+ else
+ options.job_stats = true
+ end
+ }
+ ],
+ ['--libdir', '-I LIBDIR',
+ "Include LIBDIR in the search path for required modules.",
+ lambda { |value| $:.push(value) }
+ ],
+ ['--multitask', '-m',
+ "Treat all tasks as multitasks.",
+ lambda { |value| options.always_multitask = true }
+ ],
+ ['--no-search', '--nosearch',
+ '-N', "Do not search parent directories for the Rakefile.",
+ lambda { |value| options.nosearch = true }
+ ],
+ ['--prereqs', '-P',
+ "Display the tasks and dependencies, then exit.",
+ lambda { |value| options.show_prereqs = true }
+ ],
+ ['--quiet', '-q',
+ "Do not log messages to standard output.",
+ lambda { |value| Rake.verbose(false) }
+ ],
+ ['--rakefile', '-f [FILE]',
+ "Use FILE as the rakefile.",
+ lambda { |value|
+ value ||= ''
+ @rakefiles.clear
+ @rakefiles << value
+ }
+ ],
+ ['--rakelibdir', '--rakelib', '-R RAKELIBDIR',
+ "Auto-import any .rake files in RAKELIBDIR. " +
+ "(default is 'rakelib')",
+ lambda { |value|
+ options.rakelib = value.split(File::PATH_SEPARATOR)
+ }
+ ],
+ ['--require', '-r MODULE',
+ "Require MODULE before executing rakefile.",
+ lambda { |value|
begin
- rake_require value
- rescue LoadError
- raise ex
+ require value
+ rescue LoadError => ex
+ begin
+ rake_require value
+ rescue LoadError
+ raise ex
+ end
end
- end
- }
- ],
- ['--rules', "Trace the rules resolution.",
- lambda { |value| options.trace_rules = true }
- ],
- ['--silent', '-s', "Like --quiet, but also suppresses the 'in directory' announcement.",
- lambda { |value|
- Rake.verbose(false)
- options.silent = true
- }
- ],
- ['--system', '-g',
- "Using system wide (global) rakefiles (usually '~/.rake/*.rake').",
- lambda { |value| options.load_system = true }
- ],
- ['--no-system', '--nosystem', '-G',
- "Use standard project Rakefile search paths, ignore system wide rakefiles.",
- lambda { |value| options.ignore_system = true }
- ],
- ['--tasks', '-T [PATTERN]', "Display the tasks (matching optional PATTERN) with descriptions, then exit.",
- lambda { |value|
- options.show_tasks = :tasks
- options.show_task_pattern = Regexp.new(value || '')
- Rake::TaskManager.record_task_metadata = true
- }
- ],
- ['--trace', '-t', "Turn on invoke/execute tracing, enable full backtrace.",
- lambda { |value|
- options.trace = true
- Rake.verbose(true)
- }
- ],
- ['--verbose', '-v', "Log message to standard output.",
- lambda { |value| Rake.verbose(true) }
- ],
- ['--version', '-V', "Display the program version.",
- lambda { |value|
- puts "rake, version #{RAKEVERSION}"
- exit
- }
- ],
- ['--where', '-W [PATTERN]', "Describe the tasks (matching optional PATTERN), then exit.",
- lambda { |value|
- options.show_tasks = :lines
- options.show_task_pattern = Regexp.new(value || '')
- Rake::TaskManager.record_task_metadata = true
- }
- ],
- ['--no-deprecation-warnings', '-X', "Disable the deprecation warnings.",
- lambda { |value|
- options.ignore_deprecate = true
- }
- ],
- ]
+ }
+ ],
+ ['--rules',
+ "Trace the rules resolution.",
+ lambda { |value| options.trace_rules = true }
+ ],
+ ['--silent', '-s',
+ "Like --quiet, but also suppresses the " +
+ "'in directory' announcement.",
+ lambda { |value|
+ Rake.verbose(false)
+ options.silent = true
+ }
+ ],
+ ['--suppress-backtrace PATTERN',
+ "Suppress backtrace lines matching regexp PATTERN. " +
+ "Ignored if --trace is on.",
+ lambda { |value|
+ options.suppress_backtrace_pattern = Regexp.new(value)
+ }
+ ],
+ ['--system', '-g',
+ "Using system wide (global) rakefiles " +
+ "(usually '~/.rake/*.rake').",
+ lambda { |value| options.load_system = true }
+ ],
+ ['--no-system', '--nosystem', '-G',
+ "Use standard project Rakefile search paths, " +
+ "ignore system wide rakefiles.",
+ lambda { |value| options.ignore_system = true }
+ ],
+ ['--tasks', '-T [PATTERN]',
+ "Display the tasks (matching optional PATTERN) " +
+ "with descriptions, then exit.",
+ lambda { |value|
+ select_tasks_to_show(options, :tasks, value)
+ }
+ ],
+ ['--trace=[OUT]', '-t',
+ "Turn on invoke/execute tracing, enable full backtrace. " +
+ "OUT can be stderr (default) or stdout.",
+ lambda { |value|
+ options.trace = true
+ options.backtrace = true
+ select_trace_output(options, 'trace', value)
+ Rake.verbose(true)
+ }
+ ],
+ ['--verbose', '-v',
+ "Log message to standard output.",
+ lambda { |value| Rake.verbose(true) }
+ ],
+ ['--version', '-V',
+ "Display the program version.",
+ lambda { |value|
+ puts "rake, version #{RAKEVERSION}"
+ exit
+ }
+ ],
+ ['--where', '-W [PATTERN]',
+ "Describe the tasks (matching optional PATTERN), then exit.",
+ lambda { |value|
+ select_tasks_to_show(options, :lines, value)
+ options.show_all_tasks = true
+ }
+ ],
+ ['--no-deprecation-warnings', '-X',
+ "Disable the deprecation warnings.",
+ lambda { |value|
+ options.ignore_deprecate = true
+ }
+ ],
+ ])
+ end
+
+ def select_tasks_to_show(options, show_tasks, value)
+ options.show_tasks = show_tasks
+ options.show_task_pattern = Regexp.new(value || '')
+ Rake::TaskManager.record_task_metadata = true
+ end
+ private :select_tasks_to_show
+
+ def select_trace_output(options, trace_option, value)
+ value = value.strip unless value.nil?
+ case value
+ when 'stdout'
+ options.trace_output = $stdout
+ when 'stderr', nil
+ options.trace_output = $stderr
+ else
+ fail CommandLineOptionError,
+ "Unrecognized --#{trace_option} option '#{value}'"
+ end
end
+ private :select_trace_output
# Read and handle the command line options.
def handle_options
options.rakelib = ['rakelib']
+ options.trace_output = $stderr
OptionParser.new do |opts|
- opts.banner = "rake [-f rakefile] {options} targets..."
+ opts.banner = "#{Rake.application.name} [-f rakefile] {options} targets..."
opts.separator ""
opts.separator "Options are ..."
@@ -435,16 +584,6 @@ 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
@@ -465,11 +604,9 @@ module Rake
def find_rakefile_location
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]
@@ -497,8 +634,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
@@ -509,7 +646,7 @@ module Rake
end
def glob(path, &block)
- Dir[path.gsub("\\", '/')].each(&block)
+ FileList.glob(path.gsub("\\", '/')).each(&block)
end
private :glob
@@ -543,13 +680,19 @@ module Rake
def collect_tasks
@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
+ "default"
end
# Add a file to the list of files to be imported.
@@ -561,9 +704,7 @@ module Rake
def load_imports
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)
@@ -571,25 +712,17 @@ module Rake
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)
+ backtrace.map { |t| t[/([^:]+):/, 1] }
re = /^#{@rakefile}$/
re = /#{re.source}/i if windows?
backtrace.find { |str| str =~ re } || ''
end
+
+ private
+ FIXNUM_MAX = (2**(0.size * 8 - 2) - 1) # :nodoc:
+
end
end
diff --git a/lib/rake/backtrace.rb b/lib/rake/backtrace.rb
new file mode 100644
index 0000000000..9b2ba6157f
--- /dev/null
+++ b/lib/rake/backtrace.rb
@@ -0,0 +1,20 @@
+module Rake
+ module Backtrace
+ SYS_KEYS = RbConfig::CONFIG.keys.grep(/(prefix|libdir)/)
+ SYS_PATHS = RbConfig::CONFIG.values_at(*SYS_KEYS).uniq +
+ [ File.join(File.dirname(__FILE__), "..") ]
+
+ SUPPRESSED_PATHS = SYS_PATHS.
+ map { |s| s.gsub("\\", "/") }.
+ map { |f| File.expand_path(f) }.
+ reject { |s| s.nil? || s =~ /^ *$/ }
+ SUPPRESSED_PATHS_RE = SUPPRESSED_PATHS.map { |f| Regexp.quote(f) }.join("|")
+ SUPPRESS_PATTERN = %r!(\A(#{SUPPRESSED_PATHS_RE})|bin/rake:\d+)!i
+
+ def self.collapse(backtrace)
+ pattern = Rake.application.options.suppress_backtrace_pattern ||
+ SUPPRESS_PATTERN
+ backtrace.reject { |elem| elem =~ pattern }
+ end
+ end
+end
diff --git a/lib/rake/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 5c9cbcdb24..8001ce569a 100644
--- a/lib/rake/clean.rb
+++ b/lib/rake/clean.rb
@@ -14,19 +14,42 @@
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}"
+ end
+ end
+ end
+end
+
+CLEAN = ::Rake::FileList["**/*~", "**/*.bak", "**/core"]
CLEAN.clear_exclude.exclude { |fn|
- fn.pathmap("%f") == 'core' && File.directory?(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 19c780bff6..ac67471232 100644
--- a/lib/rake/cloneable.rb
+++ b/lib/rake/cloneable.rb
@@ -3,23 +3,14 @@ module Rake
# Mixin for creating easily cloned objects.
#
module Cloneable
- # Clone an object by making a new object and setting all the instance
- # variables to the same values.
- def dup
- sibling = self.class.new
- instance_variables.each do |ivar|
- value = self.instance_variable_get(ivar)
- new_value = value.clone rescue value
- sibling.instance_variable_set(ivar, new_value)
+ # The hook that invoked by 'clone' and 'dup' methods.
+ def initialize_copy(source)
+ super
+ source.instance_variables.each do |var|
+ src_value = source.instance_variable_get(var)
+ value = src_value.clone rescue src_value
+ instance_variable_set(var, value)
end
- sibling.taint if tainted?
- sibling
- end
-
- def clone
- sibling = dup
- sibling.freeze if frozen?
- sibling
end
end
end
diff --git a/lib/rake/contrib/ftptools.rb b/lib/rake/contrib/ftptools.rb
index 78420c7412..0dd50fdc8d 100644
--- a/lib/rake/contrib/ftptools.rb
+++ b/lib/rake/contrib/ftptools.rb
@@ -5,6 +5,7 @@
require 'date'
require 'net/ftp'
+require 'rake/file_list'
module Rake # :nodoc:
@@ -49,33 +50,21 @@ 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
@@ -127,7 +116,7 @@ module Rake # :nodoc:
# Upload all files matching +wildcard+ to the uploader's root
# path.
def upload_files(wildcard)
- Dir[wildcard].each do |fn|
+ FileList.glob(wildcard).each do |fn|
upload(fn)
end
end
diff --git a/lib/rake/contrib/sys.rb b/lib/rake/contrib/sys.rb
index 41963f1fef..a3a9f69e25 100644
--- a/lib/rake/contrib/sys.rb
+++ b/lib/rake/contrib/sys.rb
@@ -1,191 +1,2 @@
-warn 'Sys has been deprecated in favor of FileUtils'
-
-#--
-# Copyright 2003-2010 by Jim Weirich (jim.weirich@gmail.com)
-# All rights reserved.
-#++
-#
-begin
- require 'ftools'
-rescue LoadError
-end
-require 'rbconfig'
-
-######################################################################
-# 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)
- Dir[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|
- Dir[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|
- Dir[wildcard].each do |fn|
- next if ! File.exist?(fn)
- if File.directory?(fn)
- Dir["#{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|
- Dir[wildcard].each do |fn|
- yield(fn)
- end
- end
- end
-
- extend(self)
-
- private # ----------------------------------------------------------
-
- def for_matching_files(wildcard, dest_dir)
- Dir[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/dsl_definition.rb b/lib/rake/dsl_definition.rb
index 6d9a6b88f3..b24a821386 100644
--- a/lib/rake/dsl_definition.rb
+++ b/lib/rake/dsl_definition.rb
@@ -32,7 +32,6 @@ module Rake
Rake::Task.define_task(*args, &block)
end
-
# Declare a file task.
#
# Example:
@@ -52,8 +51,8 @@ module Rake
# Declare a file creation task.
# (Mainly used for the directory command).
- def file_create(args, &block)
- Rake::FileCreationTask.define_task(args, &block)
+ def file_create(*args, &block)
+ Rake::FileCreationTask.define_task(*args, &block)
end
# Declare a set of files tasks to create the given directories on
@@ -62,12 +61,15 @@ module Rake
# Example:
# directory "testdata/doc"
#
- def directory(dir)
+ def directory(*args, &block)
+ result = file_create(*args, &block)
+ dir, _ = *Rake.application.resolve_args(args)
Rake.each_dir_parent(dir) do |d|
file_create d do |t|
- mkdir_p t.name if ! File.exist?(t.name)
+ mkdir_p t.name unless File.exist?(t.name)
end
end
+ result
end
# Declare a task that performs its prerequisites in
@@ -78,8 +80,8 @@ module Rake
# Example:
# multitask :deploy => [:deploy_gem, :deploy_rdoc]
#
- def multitask(args, &block)
- Rake::MultiTask.define_task(args, &block)
+ def multitask(*args, &block)
+ Rake::MultiTask.define_task(*args, &block)
end
# Create a new rake namespace and use it for evaluating the given
@@ -114,6 +116,7 @@ module Rake
end
# Describe the next rake task.
+ # Duplicate descriptions are discarded.
#
# Example:
# desc "Run the Unit Tests"
@@ -144,33 +147,11 @@ module Rake
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
-
extend FileUtilsExt
end
+# Extend the main object with the DSL commands. This allows top-level
+# calls to task, etc. to work from a Rakefile without polluting the
+# object inheritance tree.
self.extend Rake::DSL
-include Rake::DeprecatedObjectDSL
diff --git a/lib/rake/ext/core.rb b/lib/rake/ext/core.rb
index 1f3a738906..c924c7eaba 100644
--- a/lib/rake/ext/core.rb
+++ b/lib/rake/ext/core.rb
@@ -19,7 +19,8 @@ class Module
#
def rake_extension(method)
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 3f64aef6c8..8b13789179 100644
--- a/lib/rake/ext/module.rb
+++ b/lib/rake/ext/module.rb
@@ -1,39 +1 @@
-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
diff --git a/lib/rake/ext/string.rb b/lib/rake/ext/string.rb
index fb22a9deb1..07ef167f82 100644
--- a/lib/rake/ext/string.rb
+++ b/lib/rake/ext/string.rb
@@ -4,6 +4,7 @@ require 'rake/ext/core'
# Rake extension methods for String.
#
class String
+
rake_extension("ext") do
# Replace the file extension with +newext+. If there is no extension on
# the string, append the new extension to the end. If the new extension
@@ -12,9 +13,7 @@ class String
# +ext+ is a user added method for the String class.
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
@@ -163,5 +162,5 @@ class String
result
end
end
-end # class String
+end
diff --git a/lib/rake/ext/time.rb b/lib/rake/ext/time.rb
index 7877abf0ce..ea8b037e39 100644
--- a/lib/rake/ext/time.rb
+++ b/lib/rake/ext/time.rb
@@ -1,6 +1,8 @@
#--
# Extensions to time to allow comparisons with an early time class.
+require 'rake/early_time'
+
class Time
alias rake_original_time_compare :<=>
def <=>(other)
@@ -11,4 +13,3 @@ class Time
end
end
end
-
diff --git a/lib/rake/file_list.rb b/lib/rake/file_list.rb
index e49ccd0147..0b60925f09 100644
--- a/lib/rake/file_list.rb
+++ b/lib/rake/file_list.rb
@@ -41,10 +41,11 @@ 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).
@@ -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
@@ -149,10 +151,8 @@ module Rake
patterns.each do |pat|
@exclude_patterns << pat
end
- if block_given?
- @exclude_procs << block
- end
- resolve_exclude if ! @pending
+ @exclude_procs << block if block_given?
+ resolve_exclude unless @pending
self
end
@@ -219,7 +219,7 @@ module Rake
private :resolve_add
def resolve_exclude
- reject! { |fn| exclude?(fn) }
+ reject! { |fn| excluded_from_list?(fn) }
self
end
private :resolve_exclude
@@ -231,7 +231,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 +242,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
@@ -286,7 +286,7 @@ module Rake
matched = 0
each do |fn|
begin
- open(fn, "r:ascii-8bit", *options) do |inf|
+ open(fn, "r", *options) do |inf|
count = 0
inf.each do |line|
count += 1
@@ -340,14 +340,20 @@ module Rake
# Add matching glob patterns.
def add_matching(pattern)
- Dir[pattern].each do |fn|
- self << fn unless exclude?(fn)
+ FileList.glob(pattern).each do |fn|
+ self << fn unless excluded_from_list?(fn)
end
end
private :add_matching
- # Should the given file name be excluded?
- def exclude?(fn)
+ # Should the given file name be excluded from the list?
+ #
+ # NOTE: This method was formally named "exclude?", but Rails
+ # introduced an exclude? method as an array method and setup a
+ # conflict with file list. We renamed the method to avoid
+ # confusion. If you were using "FileList#exclude?" in your user
+ # code, you will need to update.
+ def excluded_from_list?(fn)
return true if @exclude_patterns.any? do |pat|
case pat
when Regexp
@@ -383,6 +389,13 @@ module Rake
def [](*args)
new(*args)
end
+
+ # Get a sorted list of files matching the pattern. This method
+ # should be prefered to Dir[pattern] and Dir.glob(pattern) because
+ # the files returned are guaranteed to be sorted.
+ def glob(pattern, *args)
+ Dir.glob(pattern, *args).sort
+ end
end
end
end
diff --git a/lib/rake/file_task.rb b/lib/rake/file_task.rb
index 78902a86fd..3e717c24b7 100644
--- a/lib/rake/file_task.rb
+++ b/lib/rake/file_task.rb
@@ -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
# ----------------------------------------------------------------
@@ -44,4 +44,3 @@ module Rake
end
end
end
-
diff --git a/lib/rake/file_utils.rb b/lib/rake/file_utils.rb
index e02d541ab8..0f7f459d87 100644
--- a/lib/rake/file_utils.rb
+++ b/lib/rake/file_utils.rb
@@ -6,7 +6,7 @@ require 'fileutils'
# added to the FileUtils utility functions.
module FileUtils
# Path to the currently running Ruby program
- RUBY = File.join(
+ RUBY = ENV['RUBY'] || File.join(
RbConfig::CONFIG['bindir'],
RbConfig::CONFIG['ruby_install_name'] + RbConfig::CONFIG['EXEEXT']).
sub(/.*\s.*/m, '"\&"')
@@ -41,24 +41,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 +76,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 +90,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 557420df80..309159aec1 100644
--- a/lib/rake/file_utils_ext.rb
+++ b/lib/rake/file_utils_ext.rb
@@ -18,15 +18,13 @@ module Rake
FileUtilsExt.verbose_flag = DEFAULT
FileUtilsExt.nowrite_flag = false
- $fileutils_verbose = true
- $fileutils_nowrite = false
-
- FileUtils::OPT_TABLE.each do |name, opts|
+ FileUtils.commands.each do |name|
+ opts = FileUtils.options_of name
default_options = []
- if opts.include?(:verbose) || opts.include?("verbose")
+ if opts.include?("verbose")
default_options << ':verbose => FileUtilsExt.verbose_flag'
end
- if opts.include?(:noop) || opts.include?("noop")
+ if opts.include?("noop")
default_options << ':noop => FileUtilsExt.nowrite_flag'
end
@@ -137,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..4ace0a6f0e 100644
--- a/lib/rake/gempackagetask.rb
+++ b/lib/rake/gempackagetask.rb
@@ -1,15 +1,2 @@
-# 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
-
+fail "ERROR: 'rake/gempackagetask' is obsolete and no longer supported. " +
+ "Use 'rubygems/packagetask' instead."
diff --git a/lib/rake/invocation_chain.rb b/lib/rake/invocation_chain.rb
index 8a01ab4c29..dae9a35915 100644
--- a/lib/rake/invocation_chain.rb
+++ b/lib/rake/invocation_chain.rb
@@ -3,44 +3,50 @@ 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.to_s} => "
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
new file mode 100644
index 0000000000..098e64716e
--- /dev/null
+++ b/lib/rake/lib/.document
@@ -0,0 +1 @@
+# Ignore project.rake
diff --git a/lib/rake/linked_list.rb b/lib/rake/linked_list.rb
new file mode 100644
index 0000000000..26483703f4
--- /dev/null
+++ b/lib/rake/linked_list.rb
@@ -0,0 +1,103 @@
+module Rake
+
+ # Polylithic linked list structure used to implement several data
+ # structures in Rake.
+ class LinkedList
+ include Enumerable
+
+ attr_reader :head, :tail
+
+ def initialize(head, tail=EMPTY)
+ @head = head
+ @tail = tail
+ end
+
+ # Polymorphically add a new element to the head of a list. The
+ # type of head node will be the same list type has the tail.
+ def conj(item)
+ self.class.cons(item, self)
+ end
+
+ # Is the list empty?
+ def empty?
+ false
+ end
+
+ # Lists are structurally equivalent.
+ def ==(other)
+ current = self
+ while ! current.empty? && ! other.empty?
+ return false if current.head != other.head
+ current = current.tail
+ other = other.tail
+ end
+ current.empty? && other.empty?
+ end
+
+ # Convert to string: LL(item, item...)
+ def to_s
+ items = map { |item| item.to_s }.join(", ")
+ "LL(#{items})"
+ end
+
+ # Same as +to_s+, but with inspected items.
+ def inspect
+ items = map { |item| item.inspect }.join(", ")
+ "LL(#{items})"
+ end
+
+ # For each item in the list.
+ def each
+ current = self
+ while ! current.empty?
+ yield(current.head)
+ current = current.tail
+ end
+ self
+ end
+
+ # Make a list out of the given arguments. This method is
+ # polymorphic
+ def self.make(*args)
+ result = empty
+ args.reverse_each do |item|
+ result = cons(item, result)
+ end
+ result
+ end
+
+ # Cons a new head onto the tail list.
+ def self.cons(head, tail)
+ new(head, tail)
+ end
+
+ # The standard empty list class for the given LinkedList class.
+ def self.empty
+ self::EMPTY
+ end
+
+ # Represent an empty list, using the Null Object Pattern.
+ #
+ # When inheriting from the LinkedList class, you should implement
+ # a type specific Empty class as well. Make sure you set the class
+ # instance variable @parent to the assocated list class (this
+ # allows conj, cons and make to work polymorphically).
+ class EmptyLinkedList < LinkedList
+ @parent = LinkedList
+
+ def initialize
+ end
+
+ def empty?
+ true
+ end
+
+ def self.cons(head, tail)
+ @parent.cons(head, tail)
+ end
+ end
+
+ EMPTY = EmptyLinkedList.new
+ end
+
+end
diff --git a/lib/rake/multi_task.rb b/lib/rake/multi_task.rb
index 21c8de732f..5418a7a7b0 100644
--- a/lib/rake/multi_task.rb
+++ b/lib/rake/multi_task.rb
@@ -5,11 +5,8 @@ module Rake
#
class MultiTask < Task
private
- def invoke_prerequisites(args, invocation_chain)
- threads = @prerequisites.collect { |p|
- Thread.new(p) { |r| application[r, @scope].invoke_with_call_chain(args, invocation_chain) }
- }
- threads.each { |t| t.join }
+ def invoke_prerequisites(task_args, invocation_chain) # :nodoc:
+ invoke_prerequisites_concurrently(task_args, invocation_chain)
end
end
diff --git a/lib/rake/packagetask.rb b/lib/rake/packagetask.rb
index 08c1a8c025..029caa6d49 100644
--- a/lib/rake/packagetask.rb
+++ b/lib/rake/packagetask.rb
@@ -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,7 +124,8 @@ 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}}
end
@@ -131,7 +135,8 @@ 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}}
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
diff --git a/lib/rake/phony.rb b/lib/rake/phony.rb
new file mode 100644
index 0000000000..29633ae066
--- /dev/null
+++ b/lib/rake/phony.rb
@@ -0,0 +1,15 @@
+# Defines a :phony task that you can use as a dependency. This allows
+# file-based tasks to use non-file-based tasks as prerequisites
+# without forcing them to rebuild.
+#
+# See FileTask#out_of_date? and Task#timestamp for more info.
+
+require 'rake'
+
+task :phony
+
+Rake::Task[:phony].tap do |task|
+ def task.timestamp # :nodoc:
+ Time.at 0
+ end
+end
diff --git a/lib/rake/private_reader.rb b/lib/rake/private_reader.rb
new file mode 100644
index 0000000000..1620978576
--- /dev/null
+++ b/lib/rake/private_reader.rb
@@ -0,0 +1,20 @@
+module Rake
+
+ # Include PrivateReader to use +private_reader+.
+ module PrivateReader # :nodoc: all
+
+ def self.included(base)
+ base.extend(ClassMethods)
+ end
+
+ module ClassMethods
+
+ # Declare a list of private accessors
+ def private_reader(*names)
+ attr_reader(*names)
+ private(*names)
+ end
+ end
+
+ end
+end
diff --git a/lib/rake/promise.rb b/lib/rake/promise.rb
new file mode 100644
index 0000000000..31c4563476
--- /dev/null
+++ b/lib/rake/promise.rb
@@ -0,0 +1,99 @@
+module Rake
+
+ # A Promise object represents a promise to do work (a chore) in the
+ # future. The promise is created with a block and a list of
+ # arguments for the block. Calling value will return the value of
+ # the promised chore.
+ #
+ # Used by ThreadPool.
+ #
+ class Promise # :nodoc: all
+ NOT_SET = Object.new.freeze # :nodoc:
+
+ attr_accessor :recorder
+
+ # Create a promise to do the chore specified by the block.
+ def initialize(args, &block)
+ @mutex = Mutex.new
+ @result = NOT_SET
+ @error = NOT_SET
+ @args = args
+ @block = block
+ end
+
+ # Return the value of this promise.
+ #
+ # If the promised chore is not yet complete, then do the work
+ # synchronously. We will wait.
+ def value
+ unless complete?
+ stat :sleeping_on, :item_id => object_id
+ @mutex.synchronize do
+ stat :has_lock_on, :item_id => object_id
+ chore
+ stat :releasing_lock_on, :item_id => object_id
+ end
+ end
+ error? ? raise(@error) : @result
+ end
+
+ # If no one else is working this promise, go ahead and do the chore.
+ def work
+ stat :attempting_lock_on, :item_id => object_id
+ if @mutex.try_lock
+ stat :has_lock_on, :item_id => object_id
+ chore
+ stat :releasing_lock_on, :item_id => object_id
+ @mutex.unlock
+ else
+ stat :bailed_on, :item_id => object_id
+ end
+ end
+
+ private
+
+ # Perform the chore promised
+ def chore
+ if complete?
+ stat :found_completed, :item_id => object_id
+ return
+ end
+ stat :will_execute, :item_id => object_id
+ begin
+ @result = @block.call(*@args)
+ rescue Exception => e
+ @error = e
+ end
+ stat :did_execute, :item_id => object_id
+ discard
+ end
+
+ # Do we have a result for the promise
+ def result?
+ ! @result.equal?(NOT_SET)
+ end
+
+ # Did the promise throw an error
+ def error?
+ ! @error.equal?(NOT_SET)
+ end
+
+ # Are we done with the promise
+ def complete?
+ result? || error?
+ end
+
+ # free up these items for the GC
+ def discard
+ @args = nil
+ @block = nil
+ end
+
+ # Record execution statistics if there is a recorder
+ def stat(*args)
+ @recorder.call(*args) if @recorder
+ end
+
+ end
+
+end
diff --git a/lib/rake/pseudo_status.rb b/lib/rake/pseudo_status.rb
index b58df3da18..09d5c88c7e 100644
--- a/lib/rake/pseudo_status.rb
+++ b/lib/rake/pseudo_status.rb
@@ -4,18 +4,23 @@ module Rake
# Exit status class for times the system just gives us a nil.
class PseudoStatus
attr_reader :exitstatus
+
def initialize(code=0)
@exitstatus = code
end
+
def to_i
@exitstatus << 8
end
+
def >>(n)
to_i >> n
end
+
def stopped?
false
end
+
def exited?
true
end
diff --git a/lib/rake/rake_module.rb b/lib/rake/rake_module.rb
index a9d210c637..fcf5800064 100644
--- a/lib/rake/rake_module.rb
+++ b/lib/rake/rake_module.rb
@@ -24,6 +24,14 @@ module Rake
def load_rakefile(path)
load(path)
end
+
+ # Add files to the rakelib list
+ def add_rakelib(*files)
+ application.options.rakelib ||= []
+ files.each do |file|
+ application.options.rakelib << file
+ end
+ end
end
end
diff --git a/lib/rake/rdoctask.rb b/lib/rake/rdoctask.rb
index b6ae224a9e..50b7e269d5 100644
--- a/lib/rake/rdoctask.rb
+++ b/lib/rake/rdoctask.rb
@@ -1,234 +1,2 @@
-# 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+)', __FILE__)
-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
-
+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..e47feeb09c 100755..100644
--- a/lib/rake/ruby182_test_unit_fix.rb
+++ b/lib/rake/ruby182_test_unit_fix.rb
@@ -10,12 +10,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 2b98a60cae..3f01b28cad 100644
--- a/lib/rake/runtest.rb
+++ b/lib/rake/runtest.rb
@@ -1,11 +1,12 @@
require 'test/unit'
require 'test/unit/assertions'
+require 'rake/file_list'
module Rake
include Test::Unit::Assertions
def run_tests(pattern='test/test*.rb', log_enabled=false)
- Dir["#{pattern}"].each { |fn|
+ FileList.glob(pattern).each do |fn|
$stderr.puts fn if log_enabled
begin
require fn
@@ -14,7 +15,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..33e1c08e7b
--- /dev/null
+++ b/lib/rake/scope.rb
@@ -0,0 +1,42 @@
+module Rake
+ class Scope < LinkedList
+
+ # Path for the scope.
+ def path
+ map { |item| item.to_s }.reverse.join(":")
+ end
+
+ # Path for the scope + the named path.
+ def path_with_task_name(task_name)
+ "#{path}:#{task_name}"
+ end
+
+ # Trim +n+ innermost scope levels from the scope. In no case will
+ # this trim beyond the toplevel scope.
+ def trim(n)
+ result = self
+ while n > 0 && ! result.empty?
+ result = result.tail
+ n -= 1
+ end
+ result
+ end
+
+ # Scope lists always end with an EmptyScope object. See Null
+ # Object Pattern)
+ class EmptyScope < EmptyLinkedList
+ @parent = Scope
+
+ def path
+ ""
+ end
+
+ def path_with_task_name(task_name)
+ task_name
+ end
+ end
+
+ # Singleton null object for an empty scope.
+ EMPTY = EmptyScope.new
+ end
+end
diff --git a/lib/rake/task.rb b/lib/rake/task.rb
index f977d18711..5e4dd64d4e 100644
--- a/lib/rake/task.rb
+++ b/lib/rake/task.rb
@@ -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
@@ -53,7 +46,7 @@ module Rake
# 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)
@@ -61,6 +54,24 @@ module Rake
end
private :lookup_prerequisite
+ # List of all unique prerequisite tasks including prerequisite tasks'
+ # prerequisites.
+ # Includes self when cyclic dependencies are found.
+ def all_prerequisite_tasks
+ seen = {}
+ collect_prerequisites(seen)
+ seen.values
+ end
+
+ def collect_prerequisites(seen)
+ prerequisite_tasks.each do |pre|
+ next if seen[pre.name]
+ seen[pre.name] = pre
+ pre.collect_prerequisites(seen)
+ end
+ end
+ protected :collect_prerequisites
+
# First source from a rule (nil if no sources)
def source
@sources.first if defined?(@sources)
@@ -69,17 +80,16 @@ module Rake
# 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.
@@ -105,7 +115,7 @@ module Rake
# Argument description (nil if none).
def arg_description # :nodoc:
- @arg_names ? "[#{(arg_names || []).join(',')}]" : nil
+ @arg_names ? "[#{arg_names.join(',')}]" : nil
end
# Name of arguments for this task.
@@ -123,6 +133,7 @@ module Rake
def clear
clear_prerequisites
clear_actions
+ clear_comments
self
end
@@ -138,6 +149,12 @@ module Rake
self
end
+ # Clear the existing comments on a rake task.
+ def clear_comments
+ @comments = []
+ self
+ end
+
# Invoke the task if it is needed. Prerequisites are invoked first.
def invoke(*args)
task_args = TaskArguments.new(arg_names, args)
@@ -150,7 +167,7 @@ module Rake
new_chain = InvocationChain.append(self, invocation_chain)
@lock.synchronize do
if application.options.trace
- $stderr.puts "** Invoke #{name} #{format_trace_flags}"
+ application.trace "** Invoke #{name} #{format_trace_flags}"
end
return if @already_invoked
@already_invoked = true
@@ -164,17 +181,33 @@ module Rake
protected :invoke_with_call_chain
def add_chain_to(exception, new_chain)
- exception.extend(InvocationExceptionMixin) unless exception.respond_to?(:chain)
+ exception.extend(InvocationExceptionMixin) unless
+ exception.respond_to?(:chain)
exception.chain = new_chain if exception.chain.nil?
end
private :add_chain_to
# Invoke all the prerequisites of a task.
def invoke_prerequisites(task_args, invocation_chain) # :nodoc:
- prerequisite_tasks.each { |prereq|
- prereq_args = task_args.new_scope(prereq.arg_names)
- prereq.invoke_with_call_chain(prereq_args, invocation_chain)
- }
+ if application.options.always_multitask
+ invoke_prerequisites_concurrently(task_args, invocation_chain)
+ else
+ prerequisite_tasks.each { |p|
+ prereq_args = task_args.new_scope(p.arg_names)
+ p.invoke_with_call_chain(prereq_args, invocation_chain)
+ }
+ end
+ end
+
+ # Invoke all the prerequisites of a task in parallel.
+ def invoke_prerequisites_concurrently(task_args, invocation_chain)# :nodoc:
+ futures = prerequisite_tasks.map do |p|
+ prereq_args = task_args.new_scope(p.arg_names)
+ application.thread_pool.future(p) do |r|
+ r.invoke_with_call_chain(prereq_args, invocation_chain)
+ end
+ end
+ futures.each { |f| f.value }
end
# Format the trace flags for display.
@@ -190,12 +223,10 @@ module Rake
def execute(args=nil)
args ||= EMPTY_TASK_ARGS
if application.options.dryrun
- $stderr.puts "** Execute (dry run) #{name}"
+ application.trace "** Execute (dry run) #{name}"
return
end
- if application.options.trace
- $stderr.puts "** 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
@@ -215,38 +246,57 @@ 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)
+ 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
+ @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.
@@ -264,11 +314,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
@@ -319,7 +369,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 02d01b99f9..0094682579 100644
--- a/lib/rake/task_arguments.rb
+++ b/lib/rake/task_arguments.rb
@@ -15,16 +15,27 @@ module Rake
@names = names
@parent = parent
@hash = {}
+ @values = values
names.each_with_index { |name, i|
@hash[name.to_sym] = values[i] unless values[i].nil?
}
end
+ # Retrive the complete array of sequential values
+ def to_a
+ @values.dup
+ end
+
+ # Retrive the list of values not associated with named arguments
+ def extras
+ @values[@names.length..-1] || []
+ end
+
# Create a new argument scope using the prerequisite argument
# names.
def new_scope(names)
- values = names.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.
@@ -47,7 +58,7 @@ module Rake
keys.map { |k| lookup(k) }
end
- def method_missing(sym, *args, &block)
+ def method_missing(sym, *args)
lookup(sym.to_sym)
end
diff --git a/lib/rake/task_manager.rb b/lib/rake/task_manager.rb
index 4c3c26aa3a..06c243a7b2 100644
--- a/lib/rake/task_manager.rb
+++ b/lib/rake/task_manager.rb
@@ -10,21 +10,21 @@ module Rake
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)
+ 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)
task_name, arg_names, deps = resolve_args(args)
task_name = task_class.scope_name(@scope, task_name)
deps = [deps] unless deps.respond_to?(:to_ary)
- deps = deps.collect {|d| d.to_s }
+ deps = deps.map { |d| d.to_s }
task = intern(task_class, task_name)
task.set_arg_names(arg_names) unless arg_names.empty?
if Rake::TaskManager.record_task_metadata
@@ -72,7 +72,6 @@ module Rake
#
# task :t
# task :t, [:a]
- # task :t, :a (deprecated)
#
def resolve_args_without_dependencies(args)
task_name = args.shift
@@ -92,24 +91,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 +116,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 +136,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 +157,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 +170,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 +184,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 +213,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
@@ -238,18 +227,19 @@ module Rake
end
def trace_rule(level, message)
- $stderr.puts "#{" "*level}#{message}" if Rake.application.options.trace_rules
+ 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 +247,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 +255,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)
diff --git a/lib/rake/tasklib.rb b/lib/rake/tasklib.rb
index f1e17dad31..48d27df9ed 100644
--- a/lib/rake/tasklib.rb
+++ b/lib/rake/tasklib.rb
@@ -14,7 +14,7 @@ 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:
+ 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 04d3ae473a..c693dd2626 100644
--- a/lib/rake/testtask.rb
+++ b/lib/rake/testtask.rb
@@ -93,10 +93,20 @@ module Rake
# Create the tasks defined by this task lib.
def define
- desc "Run tests" + (@name==:test ? "" : " for #{@name}")
+ desc "Run tests" + (@name == :test ? "" : " for #{@name}")
task @name do
FileUtilsExt.verbose(@verbose) do
- ruby "#{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}]"
+ end
+ end
end
end
self
@@ -113,8 +123,8 @@ module Rake
def ruby_opts_string
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
@@ -123,12 +133,12 @@ module Rake
end
def file_list_string
- file_list.collect { |fn| "\"#{fn}\"" }.join(' ')
+ 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
diff --git a/lib/rake/thread_history_display.rb b/lib/rake/thread_history_display.rb
new file mode 100644
index 0000000000..c2af9ecef5
--- /dev/null
+++ b/lib/rake/thread_history_display.rb
@@ -0,0 +1,48 @@
+require 'rake/private_reader'
+
+module Rake
+
+ class ThreadHistoryDisplay # :nodoc: all
+ include Rake::PrivateReader
+
+ private_reader :stats, :items, :threads
+
+ def initialize(stats)
+ @stats = stats
+ @items = { :_seq_ => 1 }
+ @threads = { :_seq_ => "A" }
+ end
+
+ def show
+ puts "Job History:"
+ stats.each do |stat|
+ stat[:data] ||= {}
+ rename(stat, :thread, threads)
+ rename(stat[:data], :item_id, items)
+ rename(stat[:data], :new_thread, threads)
+ rename(stat[:data], :deleted_thread, threads)
+ printf("%8d %2s %-20s %s\n",
+ (stat[:time] * 1_000_000).round,
+ stat[:thread],
+ stat[:event],
+ stat[:data].map do |k, v| "#{k}:#{v}" end.join(" "))
+ end
+ end
+
+ private
+
+ def rename(hash, key, renames)
+ if hash && hash[key]
+ original = hash[key]
+ value = renames[original]
+ unless value
+ value = renames[:_seq_]
+ renames[:_seq_] = renames[:_seq_].succ
+ renames[original] = value
+ end
+ hash[key] = value
+ end
+ end
+ end
+
+end
diff --git a/lib/rake/thread_pool.rb b/lib/rake/thread_pool.rb
new file mode 100644
index 0000000000..44bc7483e4
--- /dev/null
+++ b/lib/rake/thread_pool.rb
@@ -0,0 +1,161 @@
+require 'thread'
+require 'set'
+
+require 'rake/promise'
+
+module Rake
+
+ class ThreadPool # :nodoc: all
+
+ # Creates a ThreadPool object.
+ # The parameter is the size of the pool.
+ def initialize(thread_count)
+ @max_active_threads = [thread_count, 0].max
+ @threads = Set.new
+ @threads_mon = Monitor.new
+ @queue = Queue.new
+ @join_cond = @threads_mon.new_cond
+
+ @history_start_time = nil
+ @history = []
+ @history_mon = Monitor.new
+ @total_threads_in_play = 0
+ end
+
+ # Creates a future executed by the +ThreadPool+.
+ #
+ # The args are passed to the block when executing (similarly to
+ # <tt>Thread#new</tt>) The return value is an object representing
+ # a future which has been created and added to the queue in the
+ # pool. Sending <tt>#value</tt> to the object will sleep the
+ # current thread until the future is finished and will return the
+ # result (or raise an exception thrown from the future)
+ def future(*args, &block)
+ promise = Promise.new(args, &block)
+ promise.recorder = lambda { |*stats| stat(*stats) }
+
+ @queue.enq promise
+ stat :queued, :item_id => promise.object_id
+ start_thread
+ promise
+ end
+
+ # Waits until the queue of futures is empty and all threads have exited.
+ def join
+ @threads_mon.synchronize do
+ begin
+ stat :joining
+ @join_cond.wait unless @threads.empty?
+ stat :joined
+ rescue Exception => e
+ stat :joined
+ $stderr.puts e
+ $stderr.print "Queue contains #{@queue.size} items. " +
+ "Thread pool contains #{@threads.count} threads\n"
+ $stderr.print "Current Thread #{Thread.current} status = " +
+ "#{Thread.current.status}\n"
+ $stderr.puts e.backtrace.join("\n")
+ @threads.each do |t|
+ $stderr.print "Thread #{t} status = #{t.status}\n"
+ # 1.8 doesn't support Thread#backtrace
+ $stderr.puts t.backtrace.join("\n") if t.respond_to? :backtrace
+ end
+ raise e
+ end
+ end
+ end
+
+ # Enable the gathering of history events.
+ def gather_history #:nodoc:
+ @history_start_time = Time.now if @history_start_time.nil?
+ end
+
+ # Return a array of history events for the thread pool.
+ #
+ # History gathering must be enabled to be able to see the events
+ # (see #gather_history). Best to call this when the job is
+ # complete (i.e. after ThreadPool#join is called).
+ def history # :nodoc:
+ @history_mon.synchronize { @history.dup }.
+ sort_by { |i| i[:time] }.
+ each { |i| i[:time] -= @history_start_time }
+ end
+
+ # Return a hash of always collected statistics for the thread pool.
+ def statistics # :nodoc:
+ {
+ :total_threads_in_play => @total_threads_in_play,
+ :max_active_threads => @max_active_threads,
+ }
+ end
+
+ private
+
+ # processes one item on the queue. Returns true if there was an
+ # item to process, false if there was no item
+ def process_queue_item #:nodoc:
+ return false if @queue.empty?
+
+ # Even though we just asked if the queue was empty, it
+ # still could have had an item which by this statement
+ # is now gone. For this reason we pass true to Queue#deq
+ # because we will sleep indefinitely if it is empty.
+ promise = @queue.deq(true)
+ stat :dequeued, :item_id => promise.object_id
+ promise.work
+ return true
+
+ rescue ThreadError # this means the queue is empty
+ false
+ end
+
+ def start_thread # :nodoc:
+ @threads_mon.synchronize do
+ next unless @threads.count < @max_active_threads
+
+ t = Thread.new do
+ begin
+ while @threads.count <= @max_active_threads
+ break unless process_queue_item
+ end
+ ensure
+ @threads_mon.synchronize do
+ @threads.delete Thread.current
+ stat :ended, :thread_count => @threads.count
+ @join_cond.broadcast if @threads.empty?
+ end
+ end
+ end
+ @threads << t
+ stat(
+ :spawned,
+ :new_thread => t.object_id,
+ :thread_count => @threads.count)
+ @total_threads_in_play = @threads.count if
+ @threads.count > @total_threads_in_play
+ end
+ end
+
+ def stat(event, data=nil) # :nodoc:
+ return if @history_start_time.nil?
+ info = {
+ :event => event,
+ :data => data,
+ :time => Time.now,
+ :thread => Thread.current.object_id,
+ }
+ @history_mon.synchronize { @history << info }
+ end
+
+ # for testing only
+
+ def __queue__ # :nodoc:
+ @queue
+ end
+
+ def __threads__ # :nodoc:
+ @threads.dup
+ end
+ end
+
+end
diff --git a/lib/rake/trace_output.rb b/lib/rake/trace_output.rb
new file mode 100644
index 0000000000..1cd19451ca
--- /dev/null
+++ b/lib/rake/trace_output.rb
@@ -0,0 +1,22 @@
+module Rake
+ module TraceOutput
+
+ # Write trace output to output stream +out+.
+ #
+ # The write is done as a single IO call (to print) to lessen the
+ # chance that the trace output is interrupted by other tasks also
+ # producing output.
+ def trace_on(out, *strings)
+ sep = $\ || "\n"
+ if strings.empty?
+ output = sep
+ else
+ output = strings.map { |s|
+ next if s.nil?
+ s =~ /#{sep}$/ ? s : s + sep
+ }.join
+ end
+ out.print(output)
+ end
+ end
+end
diff --git a/lib/rake/version.rb b/lib/rake/version.rb
index 6c43493df9..05c934d785 100644
--- a/lib/rake/version.rb
+++ b/lib/rake/version.rb
@@ -1,8 +1,9 @@
module Rake
- VERSION = '0.9.2.2'
+ VERSION = '10.1.0'
module Version # :nodoc: all
- MAJOR, MINOR, BUILD = VERSION.split '.'
- NUMBERS = [ MAJOR, MINOR, BUILD ]
+ MAJOR, MINOR, BUILD, *OTHER = Rake::VERSION.split '.'
+
+ NUMBERS = [MAJOR, MINOR, BUILD, *OTHER]
end
end
diff --git a/lib/rake/win32.rb b/lib/rake/win32.rb
index 98289a10b4..edb33938b4 100644
--- a/lib/rake/win32.rb
+++ b/lib/rake/win32.rb
@@ -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/rbconfig/obsolete.rb b/lib/rbconfig/obsolete.rb
index eae9155af6..7025fb43fb 100644
--- a/lib/rbconfig/obsolete.rb
+++ b/lib/rbconfig/obsolete.rb
@@ -1,5 +1,38 @@
-loc = caller[0]
-loc = loc[/\A.*:\d+:/] if loc
-loc = "#{loc} " if loc
-warn "#{loc}Use RbConfig instead of obsolete and deprecated Config."
-Config = RbConfig # compatibility for ruby-1.8.4 and older.
+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 50f3f542ee..4fb0c3b881 100644
--- a/lib/rdoc.rb
+++ b/lib/rdoc.rb
@@ -1,86 +1,55 @@
$DEBUG_RDOC = nil
-# :main: README.txt
+# :main: README.rdoc
##
-# RDoc is a Ruby documentation system which contains RDoc::RDoc for generating
-# documentation, RDoc::RI for interactive documentation and RDoc::Markup for
-# text markup.
+# RDoc produces documentation for Ruby source files by parsing the source and
+# extracting the definition for classes, modules, methods, includes and
+# requires. It associates these with optional documentation contained in an
+# immediately preceding comment block then renders the result using an output
+# formatter.
#
-# RDoc::RDoc produces documentation for Ruby source files. It works similarly
-# to JavaDoc, parsing the source and extracting the definition for classes,
-# modules, methods, includes and requires. It associates these with optional
-# documentation contained in an immediately preceding comment block then
-# renders the result using an output formatter.
-#
-# RDoc::Markup that converts plain text into various output formats. The
-# markup library is used to interpret the comment blocks that RDoc uses to
-# document methods, classes, and so on.
-#
-# RDoc::RI implements the +ri+ command-line tool which displays on-line
-# documentation for ruby classes, methods, etc. +ri+ features several output
-# formats and an interactive mode (<tt>ri -i</tt>). See <tt>ri --help</tt>
-# for further details.
+# For a simple introduction to writing or generating documentation using RDoc
+# see the README.
#
# == Roadmap
#
-# * 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.
-# * If you want to write documentation for Ruby files see RDoc::Parser::Ruby
-# * If you want to write documentation for extensions written in C see
-# RDoc::Parser::C
-# * If you want to generate documentation using <tt>rake</tt> see RDoc::Task.
-# * If you want to drive RDoc programmatically, see RDoc::RDoc.
-# * If you want to use the library to format text blocks into HTML, look at
-# RDoc::Markup.
-# * If you want to make an RDoc plugin such as a generator or directive
-# handler see RDoc::RDoc.
-# * If you want to write your own output generator see RDoc::Generator.
-#
-# == Summary
+# If you think you found a bug in RDoc see CONTRIBUTING@Bugs
#
-# Once installed, you can create documentation using the +rdoc+ command
+# 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.
#
-# % rdoc [options] [names...]
+# If you want to set the default markup format see
+# RDoc::Markup@Supported+Formats
#
-# For an up-to-date option summary, type
+# If you want to store rdoc configuration in your gem (such as the default
+# markup format) see RDoc::Options@Saved+Options
#
-# % rdoc --help
+# If you want to write documentation for Ruby files see RDoc::Parser::Ruby
#
-# A typical use might be to generate documentation for a package of Ruby
-# source (such as RDoc itself).
+# If you want to write documentation for extensions written in C see
+# RDoc::Parser::C
#
-# % rdoc
+# If you want to generate documentation using <tt>rake</tt> see RDoc::Task.
#
-# 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+.
+# If you want to drive RDoc programmatically, see RDoc::RDoc.
#
-# You can make this slightly more useful for your readers by having the
-# index page contain the documentation for the primary file. In our
-# case, we could type
+# If you want to use the library to format text blocks into HTML or other
+# formats, look at RDoc::Markup.
#
-# % rdoc --main README.txt
+# If you want to make an RDoc plugin such as a generator or directive handler
+# see RDoc::RDoc.
#
-# You'll find information on the various formatting tricks you can use
-# in comment blocks in the documentation this generates.
+# If you want to write your own output generator see RDoc::Generator.
#
-# RDoc uses file extensions to determine how to process each file. File names
-# ending +.rb+ and +.rbw+ are assumed to be Ruby source. Files
-# ending +.c+ are parsed as C files. All other files are assumed to
-# contain just Markup-style markup (with or without leading '#' comment
-# markers). If directory names are passed to RDoc, they are scanned
-# recursively for C and Ruby source files only.
+# If you want an overview of how RDoc works see CONTRIBUTING
#
-# == Other stuff
+# == Credits
#
# RDoc is currently being maintained by Eric Hodel <drbrain@segment7.net>.
#
# Dave Thomas <dave@pragmaticprogrammer.com> is the original author of RDoc.
#
-# == Credits
-#
# * The Ruby parser in rdoc/parse.rb is based heavily on the outstanding
# work of Keiju ISHITSUKA of Nippon Rational Inc, who produced the Ruby
# parser for irb and the rtags package.
@@ -92,19 +61,10 @@ module RDoc
class Error < RuntimeError; end
- def self.const_missing const_name # :nodoc:
- if const_name.to_s == 'RDocError' then
- warn "RDoc::RDocError is deprecated"
- return Error
- end
-
- super
- end
-
##
# RDoc version you are using
- VERSION = '3.9.5'
+ VERSION = '4.1.0.preview.2'
##
# Method visibilities
@@ -143,5 +103,81 @@ module RDoc
METHOD_MODIFIERS = GENERAL_MODIFIERS +
%w[arg args yield yields notnew not-new not_new doc]
+ ##
+ # Loads the best available YAML library.
+
+ def self.load_yaml
+ begin
+ gem 'psych'
+ rescue Gem::LoadError
+ end
+
+ begin
+ require 'psych'
+ rescue ::LoadError
+ ensure
+ require 'yaml'
+ end
+ end
+
+ autoload :RDoc, 'rdoc/rdoc'
+
+ autoload :TestCase, 'rdoc/test_case'
+
+ autoload :CrossReference, 'rdoc/cross_reference'
+ autoload :ERBIO, 'rdoc/erbio'
+ autoload :ERBPartial, 'rdoc/erb_partial'
+ autoload :Encoding, 'rdoc/encoding'
+ autoload :Generator, 'rdoc/generator'
+ autoload :Options, 'rdoc/options'
+ autoload :Parser, 'rdoc/parser'
+ autoload :Servlet, 'rdoc/servlet'
+ autoload :RI, 'rdoc/ri'
+ autoload :Stats, 'rdoc/stats'
+ autoload :Store, 'rdoc/store'
+ autoload :Task, 'rdoc/task'
+ autoload :Text, 'rdoc/text'
+
+ autoload :Markdown, 'rdoc/markdown'
+ autoload :Markup, 'rdoc/markup'
+ autoload :RD, 'rdoc/rd'
+ autoload :TomDoc, 'rdoc/tom_doc'
+
+ autoload :KNOWN_CLASSES, 'rdoc/known_classes'
+
+ autoload :RubyLex, 'rdoc/ruby_lex'
+ autoload :RubyToken, 'rdoc/ruby_token'
+ autoload :TokenStream, 'rdoc/token_stream'
+
+ autoload :Comment, 'rdoc/comment'
+
+ # code objects
+ #
+ # We represent the various high-level code constructs that appear in Ruby
+ # programs: classes, modules, methods, and so on.
+ autoload :CodeObject, 'rdoc/code_object'
+
+ autoload :Context, 'rdoc/context'
+ autoload :TopLevel, 'rdoc/top_level'
+
+ autoload :AnonClass, 'rdoc/anon_class'
+ autoload :ClassModule, 'rdoc/class_module'
+ autoload :NormalClass, 'rdoc/normal_class'
+ autoload :NormalModule, 'rdoc/normal_module'
+ autoload :SingleClass, 'rdoc/single_class'
+
+ autoload :Alias, 'rdoc/alias'
+ autoload :AnyMethod, 'rdoc/any_method'
+ autoload :MethodAttr, 'rdoc/method_attr'
+ autoload :GhostMethod, 'rdoc/ghost_method'
+ autoload :MetaMethod, 'rdoc/meta_method'
+ autoload :Attr, 'rdoc/attr'
+
+ autoload :Constant, 'rdoc/constant'
+ autoload :Mixin, 'rdoc/mixin'
+ autoload :Include, 'rdoc/include'
+ autoload :Extend, 'rdoc/extend'
+ autoload :Require, 'rdoc/require'
+
end
diff --git a/lib/rdoc/alias.rb b/lib/rdoc/alias.rb
index fa433dc0a9..39d2694817 100644
--- a/lib/rdoc/alias.rb
+++ b/lib/rdoc/alias.rb
@@ -1,5 +1,3 @@
-require 'rdoc/code_object'
-
##
# Represent an alias, which is an old_name/new_name pair associated with a
# particular context
diff --git a/lib/rdoc/anon_class.rb b/lib/rdoc/anon_class.rb
index 63c09e11f1..c23d8e5d96 100644
--- a/lib/rdoc/anon_class.rb
+++ b/lib/rdoc/anon_class.rb
@@ -1,5 +1,3 @@
-require 'rdoc/class_module'
-
##
# An anonymous class like:
#
diff --git a/lib/rdoc/any_method.rb b/lib/rdoc/any_method.rb
index c008edfe95..3afafc86b8 100644
--- a/lib/rdoc/any_method.rb
+++ b/lib/rdoc/any_method.rb
@@ -1,12 +1,19 @@
-require 'rdoc/method_attr'
-require 'rdoc/token_stream'
-
##
# AnyMethod is the base class for objects representing methods
class RDoc::AnyMethod < RDoc::MethodAttr
- MARSHAL_VERSION = 1 # :nodoc:
+ ##
+ # 2::
+ # RDoc 4
+ # Added calls_super
+ # Added parent name and class
+ # Added section title
+ # 3::
+ # RDoc 4.1
+ # Added is_alias_for
+
+ MARSHAL_VERSION = 3 # :nodoc:
##
# Don't rename \#initialize to \::new
@@ -21,13 +28,18 @@ class RDoc::AnyMethod < RDoc::MethodAttr
##
# Different ways to call this method
- attr_accessor :call_seq
+ attr_reader :call_seq
##
# Parameters for this method
attr_accessor :params
+ ##
+ # If true this method uses +super+ to call a superclass version
+
+ attr_accessor :calls_super
+
include RDoc::TokenStream
##
@@ -39,6 +51,8 @@ class RDoc::AnyMethod < RDoc::MethodAttr
@c_function = nil
@dont_rename_initialize = false
@token_stream = nil
+ @calls_super = false
+ @superclass_method = nil
end
##
@@ -79,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
@@ -86,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,
@@ -96,7 +147,12 @@ class RDoc::AnyMethod < RDoc::MethodAttr
@block_params,
aliases,
@params,
- @file.absolute_name,
+ @file.relative_name,
+ @calls_super,
+ @parent.name,
+ @parent.class,
+ @section.title,
+ is_alias_for,
]
end
@@ -107,34 +163,46 @@ class RDoc::AnyMethod < RDoc::MethodAttr
# * #full_name
# * #parent_name
- def marshal_load(array)
+ def marshal_load array
+ initialize_visibility
+
@dont_rename_initialize = nil
- @is_alias_for = nil
@token_stream = nil
@aliases = []
-
- version = array[0]
- @name = array[1]
- @full_name = array[2]
- @singleton = array[3]
- @visibility = array[4]
- @comment = array[5]
- @call_seq = array[6]
- @block_params = array[7]
+ @parent = nil
+ @parent_name = nil
+ @parent_class = nil
+ @section = nil
+ @file = nil
+
+ version = array[0]
+ @name = array[1]
+ @full_name = array[2]
+ @singleton = array[3]
+ @visibility = array[4]
+ @comment = array[5]
+ @call_seq = array[6]
+ @block_params = array[7]
+ # 8 handled below
+ @params = array[9]
+ # 10 handled below
+ @calls_super = array[11]
+ @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)
end
- @params = array[9]
-
- @parent_name = if @full_name =~ /#/ then
- $`
- else
- name = @full_name.split('::')
- name.pop
- name.join '::'
- end
+ @parent_name ||= if @full_name =~ /#/ then
+ $`
+ else
+ name = @full_name.split('::')
+ name.pop
+ name.join '::'
+ end
@file = RDoc::TopLevel.new array[10] if version > 0
end
@@ -147,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
##
@@ -169,7 +240,9 @@ class RDoc::AnyMethod < RDoc::MethodAttr
return []
end
- params.gsub(/\s+/, '').split ','
+ params = params.gsub(/\s+/, '').split ','
+
+ params.map { |param| param.sub(/=.*/, '') }
end
##
@@ -181,10 +254,12 @@ class RDoc::AnyMethod < RDoc::MethodAttr
params = @call_seq.split("\n").last
params = params.sub(/[^( ]+/, '')
params = params.sub(/(\|[^|]+\|)\s*\.\.\.\s*(end|\})/, '\1 \2')
- else
+ elsif @params then
params = @params.gsub(/\s*\#.*/, '')
params = params.tr("\n", " ").squeeze(" ")
params = "(#{params})" unless params[0] == ?(
+ else
+ params = ''
end
if @block_params then
@@ -203,5 +278,31 @@ class RDoc::AnyMethod < RDoc::MethodAttr
params
end
+ ##
+ # Sets the store for this method and its referenced code objects.
+
+ def store= store
+ super
+
+ @file = @store.add_file @file.full_name if @file
+ end
+
+ ##
+ # For methods that +super+, find the superclass method that would be called.
+
+ def superclass_method
+ return unless @calls_super
+ return @superclass_method if @superclass_method
+
+ parent.each_ancestor do |ancestor|
+ if method = ancestor.method_list.find { |m| m.name == @name } then
+ @superclass_method = method
+ break
+ end
+ end
+
+ @superclass_method
+ end
+
end
diff --git a/lib/rdoc/attr.rb b/lib/rdoc/attr.rb
index 5d9bc17831..960e1d1107 100644
--- a/lib/rdoc/attr.rb
+++ b/lib/rdoc/attr.rb
@@ -1,12 +1,16 @@
-require 'rdoc/method_attr'
-
##
# An attribute created by \#attr, \#attr_reader, \#attr_writer or
# \#attr_accessor
class RDoc::Attr < RDoc::MethodAttr
- MARSHAL_VERSION = 2 # :nodoc:
+ ##
+ # 3::
+ # RDoc 4
+ # Added parent name and class
+ # Added section title
+
+ MARSHAL_VERSION = 3 # :nodoc:
##
# Is the attribute readable ('R'), writable ('W') or both ('RW')?
@@ -58,6 +62,16 @@ class RDoc::Attr < RDoc::MethodAttr
end
##
+ # Attributes never call super. See RDoc::AnyMethod#calls_super
+ #
+ # An RDoc::Attr can show up in the method list in some situations (see
+ # Gem::ConfigFile)
+
+ def calls_super # :nodoc:
+ false
+ end
+
+ ##
# Returns attr_reader, attr_writer or attr_accessor as appropriate.
def definition
@@ -92,7 +106,10 @@ class RDoc::Attr < RDoc::MethodAttr
@visibility,
parse(@comment),
singleton,
- @file.absolute_name,
+ @file.relative_name,
+ @parent.full_name,
+ @parent.class,
+ @section.title
]
end
@@ -104,17 +121,30 @@ class RDoc::Attr < RDoc::MethodAttr
# * #parent_name
def marshal_load array
- version = array[0]
- @name = array[1]
- @full_name = array[2]
- @rw = array[3]
- @visibility = array[4]
- @comment = array[5]
- @singleton = array[6] || false # MARSHAL_VERSION == 0
+ initialize_visibility
+
+ @aliases = []
+ @parent = nil
+ @parent_name = nil
+ @parent_class = nil
+ @section = nil
+ @file = nil
+
+ version = array[0]
+ @name = array[1]
+ @full_name = array[2]
+ @rw = array[3]
+ @visibility = array[4]
+ @comment = array[5]
+ @singleton = array[6] || false # MARSHAL_VERSION == 0
+ # 7 handled below
+ @parent_name = array[8]
+ @parent_class = array[9]
+ @section_title = array[10]
@file = RDoc::TopLevel.new array[7] if version > 1
- @parent_name = @full_name
+ @parent_name ||= @full_name.split('#', 2).first
end
def pretty_print q # :nodoc:
@@ -132,5 +162,14 @@ class RDoc::Attr < RDoc::MethodAttr
"#{definition} #{name} in: #{parent}"
end
+ ##
+ # Attributes do not have token streams.
+ #
+ # An RDoc::Attr can show up in the method list in some situations (see
+ # Gem::ConfigFile)
+
+ def token_stream # :nodoc:
+ end
+
end
diff --git a/lib/rdoc/class_module.rb b/lib/rdoc/class_module.rb
index 27066d8bd7..71566f050a 100644
--- a/lib/rdoc/class_module.rb
+++ b/lib/rdoc/class_module.rb
@@ -1,5 +1,3 @@
-require 'rdoc/context'
-
##
# ClassModule is the base class for objects representing either a class or a
# module.
@@ -13,8 +11,17 @@ class RDoc::ClassModule < RDoc::Context
# * Added file to constants
# * Added file to includes
# * Added file to methods
-
- MARSHAL_VERSION = 1 # :nodoc:
+ # 2::
+ # RDoc 3.13
+ # * Added extends
+ # 3::
+ # RDoc 4.0
+ # * Added sections
+ # * Added in_files
+ # * Added parent name
+ # * Complete Constant dump
+
+ MARSHAL_VERSION = 3 # :nodoc:
##
# Constants that are aliases for this class or module
@@ -24,7 +31,7 @@ class RDoc::ClassModule < RDoc::Context
##
# Comment and the location it came from. Use #add_comment to add comments
- attr_reader :comment_location
+ attr_accessor :comment_location
attr_accessor :diagram # :nodoc:
@@ -56,6 +63,7 @@ class RDoc::ClassModule < RDoc::Context
klass.external_aliases.concat mod.external_aliases
klass.constants.concat mod.constants
klass.includes.concat mod.includes
+ klass.extends.concat mod.extends
klass.methods_hash.update mod.methods_hash
klass.constants_hash.update mod.constants_hash
@@ -84,6 +92,7 @@ class RDoc::ClassModule < RDoc::Context
klass.external_aliases +
klass.constants +
klass.includes +
+ klass.extends +
klass.classes +
klass.modules).each do |obj|
obj.parent = klass
@@ -115,16 +124,35 @@ class RDoc::ClassModule < RDoc::Context
# across multiple runs.
def add_comment comment, location
- return if comment.empty? or not document_self
+ return unless document_self
original = comment
- comment = normalize_comment comment
+ comment = case comment
+ when RDoc::Comment then
+ comment.normalize
+ else
+ normalize_comment comment
+ end
+
+ @comment_location.delete_if { |(_, l)| l == location }
+
@comment_location << [comment, location]
self.comment = original
end
+ def add_things my_things, other_things # :nodoc:
+ other_things.each do |group, things|
+ my_things[group].each { |thing| yield false, thing } if
+ my_things.include? group
+
+ things.each do |thing|
+ yield true, thing
+ end
+ end
+ end
+
##
# Ancestors list for this ClassModule: the list of included modules
# (classes will add their superclass if any).
@@ -141,8 +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
+
##
- # Clears the comment. Used by the ruby parser.
+ # 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.
def clear_comment
@comment = ''
@@ -154,10 +199,14 @@ class RDoc::ClassModule < RDoc::Context
# Appends +comment+ to the current comment, but separated by a rule. Works
# more like <tt>+=</tt>.
- def comment= comment
- return if comment.empty?
+ def comment= comment # :nodoc:
+ comment = case comment
+ when RDoc::Comment then
+ comment.normalize
+ else
+ normalize_comment comment
+ end
- comment = normalize_comment comment
comment = "#{@comment}\n---\n#{comment}" unless @comment.empty?
super comment
@@ -166,7 +215,7 @@ class RDoc::ClassModule < RDoc::Context
##
# Prepares this ClassModule for use by a generator.
#
- # See RDoc::TopLevel::complete
+ # See RDoc::Store#complete
def complete min_visibility
update_aliases
@@ -176,12 +225,32 @@ class RDoc::ClassModule < RDoc::Context
end
##
+ # Does this ClassModule or any of its methods have document_self set?
+
+ def document_self_or_methods
+ document_self || method_list.any?{ |m| m.document_self }
+ end
+
+ ##
+ # Does this class or module have a comment with content or is
+ # #received_nodoc true?
+
+ def documented?
+ return true if @received_nodoc
+ return false if @comment_location.empty?
+ @comment_location.any? { |comment, _| not comment.empty? }
+ end
+
+ ##
# Iterates the ancestors of this class or module for which an
# RDoc::ClassModule exists.
def each_ancestor # :yields: module
+ return enum_for __method__ unless block_given?
+
ancestors.each do |mod|
next if String === mod
+ next if self == mod
yield mod
end
end
@@ -215,8 +284,8 @@ class RDoc::ClassModule < RDoc::Context
# Return the fully qualified name of this class or module
def full_name
- @full_name ||= if RDoc::ClassModule === @parent then
- "#{@parent.full_name}::#{@name}"
+ @full_name ||= if RDoc::ClassModule === parent then
+ "#{parent.full_name}::#{@name}"
else
@name
end
@@ -227,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
@@ -250,17 +321,27 @@ class RDoc::ClassModule < RDoc::Context
@superclass,
parse(@comment_location),
attrs,
- constants.map do |const|
- [const.name, parse(const.comment), const.file_name]
- end,
+ 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.compact,
+ @sections.values,
+ @in_files.map do |tl|
+ tl.relative_name
+ end,
+ parent.full_name,
+ parent.class,
]
end
def marshal_load array # :nodoc:
+ initialize_visibility
initialize_methods_etc
@current_section = nil
@document_self = true
@@ -268,6 +349,8 @@ class RDoc::ClassModule < RDoc::Context
@parent = nil
@temporary_section = nil
@visibility = nil
+ @classes = {}
+ @modules = {}
@name = array[1]
@full_name = array[2]
@@ -291,9 +374,14 @@ class RDoc::ClassModule < RDoc::Context
attr.record_location RDoc::TopLevel.new file
end
- array[6].each do |name, comment, file|
- const = add_constant RDoc::Constant.new(name, nil, comment)
- const.record_location RDoc::TopLevel.new file
+ array[6].each do |constant, comment, file|
+ case constant
+ when RDoc::Constant then
+ add_constant constant
+ else
+ constant = add_constant RDoc::Constant.new(constant, nil, comment)
+ constant.record_location RDoc::TopLevel.new file
+ end
end
array[7].each do |name, comment, file|
@@ -313,6 +401,27 @@ class RDoc::ClassModule < RDoc::Context
end
end
end
+
+ array[9].each do |name, comment, file|
+ ext = add_extend RDoc::Extend.new(name, comment)
+ ext.record_location RDoc::TopLevel.new file
+ end if array[9] # Support Marshal version 1
+
+ sections = (array[10] || []).map do |section|
+ [section.title, section]
+ end
+
+ @sections = Hash[*sections.flatten]
+ @current_section = add_section nil
+
+ @in_files = []
+
+ (array[11] || []).each do |filename|
+ record_location RDoc::TopLevel.new filename
+ end
+
+ @parent_name = array[12]
+ @parent_class = array[13]
end
##
@@ -321,6 +430,9 @@ class RDoc::ClassModule < RDoc::Context
# The data in +class_module+ is preferred over the receiver.
def merge class_module
+ @parent = class_module.parent
+ @parent_name = class_module.parent_name
+
other_document = parse class_module.comment_location
if other_document then
@@ -360,6 +472,18 @@ class RDoc::ClassModule < RDoc::Context
end
end
+ @includes.uniq! # clean up
+
+ merge_collections extends, cm.extends, other_files do |add, ext|
+ if add then
+ add_extend ext
+ else
+ @extends.delete ext
+ end
+ end
+
+ @extends.uniq! # clean up
+
merge_collections method_list, cm.method_list, other_files do |add, meth|
if add then
add_method meth
@@ -369,6 +493,8 @@ class RDoc::ClassModule < RDoc::Context
end
end
+ merge_sections cm
+
self
end
@@ -391,22 +517,46 @@ class RDoc::ClassModule < RDoc::Context
my_things = mine. group_by { |thing| thing.file }
other_things = other.group_by { |thing| thing.file }
- my_things.delete_if do |file, things|
- next false unless other_files.include? file
+ remove_things my_things, other_files, &block
+ add_things my_things, other_things, &block
+ end
- things.each do |thing|
- yield false, thing
- end
+ ##
+ # Merges the comments in this ClassModule with the comments in the other
+ # ClassModule +cm+.
- true
+ def merge_sections cm # :nodoc:
+ my_sections = sections.group_by { |section| section.title }
+ other_sections = cm.sections.group_by { |section| section.title }
+
+ other_files = cm.in_files
+
+ remove_things my_sections, other_files do |_, section|
+ @sections.delete section.title
end
- other_things.each do |file, things|
- my_things[file].each { |thing| yield false, thing } if
- my_things.include?(file)
+ other_sections.each do |group, sections|
+ if my_sections.include? group
+ my_sections[group].each do |my_section|
+ other_section = cm.sections_hash[group]
- things.each do |thing|
- yield true, thing
+ my_comments = my_section.comments
+ other_comments = other_section.comments
+
+ other_files = other_section.in_files
+
+ merge_collections my_comments, other_comments, other_files do |add, comment|
+ if add then
+ my_section.add_comment comment
+ else
+ my_section.remove_comment comment
+ end
+ end
+ end
+ else
+ sections.each do |section|
+ add_section group, section.comments
+ end
end
end
end
@@ -438,11 +588,15 @@ class RDoc::ClassModule < RDoc::Context
when Array then
docs = comment_location.map do |comment, location|
doc = super comment
- doc.file = location.absolute_name
+ doc.file = location
doc
end
RDoc::Markup::Document.new(*docs)
+ when RDoc::Comment then
+ doc = super comment_location.text, comment_location.format
+ doc.file = comment_location.location
+ doc
when RDoc::Markup::Document then
return comment_location
else
@@ -451,10 +605,10 @@ class RDoc::ClassModule < RDoc::Context
end
##
- # Path to this class or module
+ # Path to this class or module for use with HTML generator output.
def path
- http_url RDoc::RDoc.current.generator.class_dir
+ http_url @store.rdoc.generator.class_dir
end
##
@@ -488,21 +642,61 @@ class RDoc::ClassModule < RDoc::Context
modules_hash.each_key do |name|
full_name = prefix + name
- modules_hash.delete name unless RDoc::TopLevel.all_modules_hash[full_name]
+ modules_hash.delete name unless @store.modules_hash[full_name]
end
classes_hash.each_key do |name|
full_name = prefix + name
- classes_hash.delete name unless RDoc::TopLevel.all_classes_hash[full_name]
+ classes_hash.delete name unless @store.classes_hash[full_name]
end
end
+ def remove_things my_things, other_files # :nodoc:
+ my_things.delete_if do |file, things|
+ next false unless other_files.include? file
+
+ things.each do |thing|
+ yield false, thing
+ end
+
+ true
+ end
+ end
+
+ ##
+ # Search record used by RDoc::Generator::JsonIndex
+
+ def search_record
+ [
+ name,
+ full_name,
+ full_name,
+ '',
+ path,
+ '',
+ snippet(@comment_location),
+ ]
+ end
+
+ ##
+ # Sets the store for this class or module and its contained code objects.
+
+ def store= store
+ super
+
+ @attributes .each do |attr| attr.store = store end
+ @constants .each do |const| const.store = store end
+ @includes .each do |incl| incl.store = store end
+ @extends .each do |ext| ext.store = store end
+ @method_list.each do |meth| meth.store = store end
+ end
+
##
# Get the superclass of this class. Attempts to retrieve the superclass
# object, returns the name if it is not known.
def superclass
- RDoc::TopLevel.find_class_named(@superclass) || @superclass
+ @store.find_class_named(@superclass) || @superclass
end
##
@@ -533,7 +727,7 @@ class RDoc::ClassModule < RDoc::Context
# aliases through a constant.
#
# The aliased module/class is replaced in the children and in
- # RDoc::TopLevel::all_modules_hash or RDoc::TopLevel::all_classes_hash
+ # RDoc::Store#modules_hash or RDoc::Store#classes_hash
# by a copy that has <tt>RDoc::ClassModule#is_alias_for</tt> set to
# the aliased module/class, and this copy is added to <tt>#aliases</tt>
# of the aliased module/class.
@@ -548,16 +742,21 @@ class RDoc::ClassModule < RDoc::Context
next unless cm = const.is_alias_for
cm_alias = cm.dup
cm_alias.name = const.name
- cm_alias.parent = self
- cm_alias.full_name = nil # force update for new parent
+
+ # Don't move top-level aliases under Object, they look ugly there
+ unless RDoc::TopLevel === cm_alias.parent then
+ cm_alias.parent = self
+ cm_alias.full_name = nil # force update for new parent
+ end
+
cm_alias.aliases.clear
cm_alias.is_alias_for = cm
if cm.module? then
- RDoc::TopLevel.all_modules_hash[cm_alias.full_name] = cm_alias
+ @store.modules_hash[cm_alias.full_name] = cm_alias
modules_hash[const.name] = cm_alias
else
- RDoc::TopLevel.all_classes_hash[cm_alias.full_name] = cm_alias
+ @store.classes_hash[cm_alias.full_name] = cm_alias
classes_hash[const.name] = cm_alias
end
@@ -574,8 +773,26 @@ class RDoc::ClassModule < RDoc::Context
def update_includes
includes.reject! do |include|
mod = include.module
- !(String === mod) && RDoc::TopLevel.all_modules_hash[mod.full_name].nil?
+ !(String === mod) && @store.modules_hash[mod.full_name].nil?
end
+
+ includes.uniq!
+ end
+
+ ##
+ # Deletes from #extends those whose module has been removed from the
+ # documentation.
+ #--
+ # FIXME: like update_includes, extends are not reliably removed
+
+ def update_extends
+ extends.reject! do |ext|
+ mod = ext.module
+
+ !(String === mod) && @store.modules_hash[mod.full_name].nil?
+ end
+
+ extends.uniq!
end
end
diff --git a/lib/rdoc/code_object.rb b/lib/rdoc/code_object.rb
index 54826fffbd..4620fa586d 100644
--- a/lib/rdoc/code_object.rb
+++ b/lib/rdoc/code_object.rb
@@ -1,6 +1,3 @@
-require 'rdoc'
-require 'rdoc/text'
-
##
# Base class for the RDoc code tree.
#
@@ -23,8 +20,9 @@ require 'rdoc/text'
# * RDoc::MetaMethod
# * RDoc::Alias
# * RDoc::Constant
-# * RDoc::Require
-# * RDoc::Include
+# * RDoc::Mixin
+# * RDoc::Require
+# * RDoc::Include
class RDoc::CodeObject
@@ -78,9 +76,9 @@ class RDoc::CodeObject
attr_accessor :offset
##
- # Our parent CodeObject
+ # Sets the parent CodeObject
- attr_accessor :parent
+ attr_writer :parent
##
# Did we ever receive a +:nodoc:+ directive?
@@ -88,9 +86,14 @@ class RDoc::CodeObject
attr_reader :received_nodoc
##
- # Which section are we in
+ # Set the section this CodeObject is in
+
+ attr_writer :section
+
+ ##
+ # The RDoc::Store for this object.
- attr_accessor :section
+ attr_reader :store
##
# We are the model of the code, but we know that at some point we will be
@@ -103,18 +106,33 @@ class RDoc::CodeObject
# Creates a new CodeObject that will document itself and its children
def initialize
- @metadata = {}
- @comment = ''
- @parent = nil
- @file = nil
- @full_name = 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
+
+ ##
+ # Initializes state for visibility of this CodeObject and its children.
+ def initialize_visibility # :nodoc:
@document_children = true
@document_self = true
@done_documenting = false
@force_documentation = false
@received_nodoc = false
@ignored = false
+ @suppressed = false
+ @track_visibility = true
end
##
@@ -124,11 +142,11 @@ class RDoc::CodeObject
@comment = case comment
when NilClass then ''
when RDoc::Markup::Document then comment
+ when RDoc::Comment then comment.normalize
else
if comment and not comment.empty? then
normalize_comment comment
else
- # TODO is this sufficient?
# HACK correct fix is to have #initialize create @comment
# with the correct encoding
if String === @comment and
@@ -141,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
##
@@ -152,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
@@ -161,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
@@ -184,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
@@ -216,7 +245,7 @@ class RDoc::CodeObject
##
# Force the documentation of this object unless documentation
- # has been turned off by :endoc:
+ # has been turned off by :enddoc:
#--
# HACK untested, was assigning to an ivar
@@ -235,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
@@ -245,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
@@ -256,12 +288,51 @@ 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.
+
+ def parent
+ return @parent if @parent
+ return nil unless @parent_name
+
+ if @parent_class == RDoc::TopLevel then
+ @parent = @store.add_file @parent_name
+ else
+ @parent = @store.find_class_or_module @parent_name
+
+ return @parent if @parent
+
+ begin
+ @parent = @store.load_class @parent_name
+ rescue RDoc::Store::MissingFileError
+ nil
+ end
+ end
+ end
+
+ ##
# File name of our parent
def parent_file_name
@@ -279,29 +350,80 @@ 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
+
+ ##
+ # The section this CodeObject is in. Sections allow grouping of constants,
+ # attributes and methods inside a class or module.
+
+ def section
+ return @section if @section
+
+ @section = parent.add_section @section_title if parent
end
##
# Enable capture of documentation unless documentation has been
- # turned off by :endoc:
+ # turned off by :enddoc:
def start_doc
return if @done_documenting
@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/code_objects.rb b/lib/rdoc/code_objects.rb
index c60dad92df..f1a626cd2e 100644
--- a/lib/rdoc/code_objects.rb
+++ b/lib/rdoc/code_objects.rb
@@ -1,23 +1,5 @@
-# We represent the various high-level code constructs that appear in Ruby
-# programs: classes, modules, methods, and so on.
+# This file was used to load all the RDoc::CodeObject subclasses at once. Now
+# autoload handles this.
-require 'rdoc/code_object'
-require 'rdoc/context'
-require 'rdoc/top_level'
-
-require 'rdoc/class_module'
-require 'rdoc/normal_class'
-require 'rdoc/normal_module'
-require 'rdoc/anon_class'
-require 'rdoc/single_class'
-
-require 'rdoc/any_method'
-require 'rdoc/alias'
-require 'rdoc/ghost_method'
-require 'rdoc/meta_method'
-
-require 'rdoc/attr'
-require 'rdoc/constant'
-require 'rdoc/require'
-require 'rdoc/include'
+require 'rdoc'
diff --git a/lib/rdoc/comment.rb b/lib/rdoc/comment.rb
new file mode 100644
index 0000000000..33ced18b5a
--- /dev/null
+++ b/lib/rdoc/comment.rb
@@ -0,0 +1,229 @@
+##
+# A comment holds the text comment for a RDoc::CodeObject and provides a
+# unified way of cleaning it up and parsing it into an RDoc::Markup::Document.
+#
+# Each comment may have a different markup format set by #format=. By default
+# 'rdoc' is used. The :markup: directive tells RDoc which format to use.
+#
+# See RDoc::Markup@Other+directives for instructions on adding an alternate
+# format.
+
+class RDoc::Comment
+
+ include RDoc::Text
+
+ ##
+ # The format of this comment. Defaults to RDoc::Markup
+
+ attr_reader :format
+
+ ##
+ # The RDoc::TopLevel this comment was found in
+
+ attr_accessor :location
+
+ ##
+ # For duck-typing when merging classes at load time
+
+ alias file location # :nodoc:
+
+ ##
+ # The text for this comment
+
+ attr_reader :text
+
+ ##
+ # Overrides the content returned by #parse. Use when there is no #text
+ # source for this comment
+
+ attr_writer :document
+
+ ##
+ # Creates a new comment with +text+ that is found in the RDoc::TopLevel
+ # +location+.
+
+ def initialize text = nil, location = nil
+ @location = location
+ @text = text
+
+ @document = nil
+ @format = 'rdoc'
+ @normalized = false
+ end
+
+ ##
+ #--
+ # TODO deep copy @document
+
+ def initialize_copy copy # :nodoc:
+ @text = copy.text.dup
+ end
+
+ def == other # :nodoc:
+ self.class === other and
+ other.text == @text and other.location == @location
+ end
+
+ ##
+ # Look for a 'call-seq' in the comment to override the normal parameter
+ # handling. The :call-seq: is indented from the baseline. All lines of the
+ # same indentation level and prefix are consumed.
+ #
+ # For example, all of the following will be used as the :call-seq:
+ #
+ # # :call-seq:
+ # # ARGF.readlines(sep=$/) -> array
+ # # ARGF.readlines(limit) -> array
+ # # ARGF.readlines(sep, limit) -> array
+ # #
+ # # ARGF.to_a(sep=$/) -> array
+ # # ARGF.to_a(limit) -> array
+ # # ARGF.to_a(sep, limit) -> array
+
+ def extract_call_seq method
+ # we must handle situations like the above followed by an unindented first
+ # comment. The difficulty is to make sure not to match lines starting
+ # with ARGF at the same indent, but that are after the first description
+ # paragraph.
+ if @text =~ /^\s*:?call-seq:(.*?(?:\S).*?)^\s*$/m then
+ all_start, all_stop = $~.offset(0)
+ seq_start, seq_stop = $~.offset(1)
+
+ # we get the following lines that start with the leading word at the
+ # same indent, even if they have blank lines before
+ if $1 =~ /(^\s*\n)+^(\s*\w+)/m then
+ leading = $2 # ' * ARGF' in the example above
+ re = %r%
+ \A(
+ (^\s*\n)+
+ (^#{Regexp.escape leading}.*?\n)+
+ )+
+ ^\s*$
+ %xm
+
+ if @text[seq_stop..-1] =~ re then
+ all_stop = seq_stop + $~.offset(0).last
+ seq_stop = seq_stop + $~.offset(1).last
+ end
+ end
+
+ seq = @text[seq_start..seq_stop]
+ seq.gsub!(/^\s*(\S|\n)/m, '\1')
+ @text.slice! all_start...all_stop
+
+ method.call_seq = seq.chomp
+
+ elsif @text.sub!(/^\s*:?call-seq:(.*?)(^\s*$|\z)/m, '') then
+ seq = $1
+ seq.gsub!(/^\s*/, '')
+ method.call_seq = seq
+ end
+
+ method
+ end
+
+ ##
+ # A comment is empty if its text String is empty.
+
+ def empty?
+ @text.empty?
+ end
+
+ ##
+ # HACK dubious
+
+ def force_encoding encoding
+ @text.force_encoding encoding
+ end
+
+ ##
+ # Sets the format of this comment and resets any parsed document
+
+ def format= format
+ @format = format
+ @document = nil
+ end
+
+ def inspect # :nodoc:
+ location = @location ? @location.relative_name : '(unknown)'
+
+ "#<%s:%x %s %p>" % [self.class, object_id, location, @text]
+ end
+
+ ##
+ # Normalizes the text. See RDoc::Text#normalize_comment for details
+
+ def normalize
+ return self unless @text
+ return self if @normalized # TODO eliminate duplicate normalization
+
+ @text = normalize_comment @text
+
+ @normalized = true
+
+ self
+ end
+
+ ##
+ # Was this text normalized?
+
+ def normalized? # :nodoc:
+ @normalized
+ end
+
+ ##
+ # Parses the comment into an RDoc::Markup::Document. The parsed document is
+ # cached until the text is changed.
+
+ def parse
+ return @document if @document
+
+ @document = super @text, @format
+ @document.file = @location
+ @document
+ end
+
+ ##
+ # Removes private sections from this comment. Private sections are flush to
+ # the comment marker and start with <tt>--</tt> and end with <tt>++</tt>.
+ # For C-style comments, a private marker may not start at the opening of the
+ # comment.
+ #
+ # /*
+ # *--
+ # * private
+ # *++
+ # * public
+ # */
+
+ def remove_private
+ # Workaround for gsub encoding for Ruby 1.9.2 and earlier
+ empty = ''
+ empty.force_encoding @text.encoding if Object.const_defined? :Encoding
+
+ @text = @text.gsub(%r%^\s*([#*]?)--.*?^\s*(\1)\+\+\n?%m, empty)
+ @text = @text.sub(%r%^\s*[#*]?--.*%m, '')
+ end
+
+ ##
+ # Replaces this comment's text with +text+ and resets the parsed document.
+ #
+ # An error is raised if the comment contains a document but no text.
+
+ def text= text
+ raise RDoc::Error, 'replacing document-only comment is not allowed' if
+ @text.nil? and @document
+
+ @document = nil
+ @text = text
+ end
+
+ ##
+ # Returns true if this comment is in TomDoc format.
+
+ def tomdoc?
+ @format == 'tomdoc'
+ end
+
+end
+
diff --git a/lib/rdoc/constant.rb b/lib/rdoc/constant.rb
index 056ce130be..97985cbf99 100644
--- a/lib/rdoc/constant.rb
+++ b/lib/rdoc/constant.rb
@@ -1,16 +1,14 @@
-require 'rdoc/code_object'
-
##
# A constant
class RDoc::Constant < RDoc::CodeObject
+ MARSHAL_VERSION = 0 # :nodoc:
+
##
- # If this constant is an alias for a module or class,
- # this is the RDoc::ClassModule it is an alias for.
- # +nil+ otherwise.
+ # Sets the module or class this is constant is an alias for.
- attr_accessor :is_alias_for
+ attr_writer :is_alias_for
##
# The constant's name
@@ -23,13 +21,22 @@ class RDoc::Constant < RDoc::CodeObject
attr_accessor :value
##
+ # The constant's visibility
+
+ attr_accessor :visibility
+
+ ##
# Creates a new constant with +name+, +value+ and +comment+
def initialize(name, value, comment)
super()
- @name = name
+
+ @name = name
@value = value
+
@is_alias_for = nil
+ @visibility = nil
+
self.comment = comment
end
@@ -56,7 +63,36 @@ 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
+
+ ##
+ # Full constant name including namespace
+
+ def full_name
+ @full_name ||= "#{parent_name}::#{@name}"
+ end
+
+ ##
+ # The module or class this constant is an alias for
+
+ def is_alias_for
+ case @is_alias_for
+ when String then
+ found = @store.find_class_or_module @is_alias_for
+ @is_alias_for = found if found
+ @is_alias_for
+ else
+ @is_alias_for
+ end
end
def inspect # :nodoc:
@@ -67,12 +103,76 @@ class RDoc::Constant < RDoc::CodeObject
end
##
- # Path to this constant
+ # Dumps this Constant for use by ri. See also #marshal_load
+
+ def marshal_dump
+ alias_name = case found = is_alias_for
+ when RDoc::CodeObject then found.full_name
+ else found
+ end
+
+ [ MARSHAL_VERSION,
+ @name,
+ full_name,
+ @visibility,
+ alias_name,
+ parse(@comment),
+ @file.relative_name,
+ parent.name,
+ parent.class,
+ section.title,
+ ]
+ end
+
+ ##
+ # Loads this Constant from +array+. For a loaded Constant the following
+ # methods will return cached values:
+ #
+ # * #full_name
+ # * #parent_name
+
+ def marshal_load array
+ initialize array[1], nil, array[5]
+
+ @full_name = array[2]
+ @visibility = array[3]
+ @is_alias_for = array[4]
+ # 5 handled above
+ # 6 handled below
+ @parent_name = array[7]
+ @parent_class = array[8]
+ @section_title = array[9]
+
+ @file = RDoc::TopLevel.new array[6]
+ end
+
+ ##
+ # Path to this constant for use with HTML generator output.
def path
"#{@parent.path}##{@name}"
end
+ def pretty_print q # :nodoc:
+ q.group 2, "[#{self.class.name} #{full_name}", "]" do
+ unless comment.empty? then
+ q.breakable
+ q.text "comment:"
+ q.breakable
+ q.pp @comment
+ end
+ end
+ 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:
parent_name = parent ? parent.full_name : '(unknown)'
if is_alias_for
diff --git a/lib/rdoc/context.rb b/lib/rdoc/context.rb
index abdab2026d..892a43e118 100644
--- a/lib/rdoc/context.rb
+++ b/lib/rdoc/context.rb
@@ -1,4 +1,4 @@
-require 'rdoc/code_object'
+require 'cgi'
##
# A Context is something that can hold modules, classes, methods, attributes,
@@ -15,6 +15,12 @@ class RDoc::Context < RDoc::CodeObject
TYPES = %w[class instance]
##
+ # If a context has these titles it will be sorted in this order.
+
+ TOMDOC_TITLES = [nil, 'Public', 'Internal', 'Deprecated'] # :nodoc:
+ TOMDOC_TITLES_SORT = TOMDOC_TITLES.sort_by { |title| title.to_s } # :nodoc:
+
+ ##
# Class/module aliases
attr_reader :aliases
@@ -25,6 +31,11 @@ class RDoc::Context < RDoc::CodeObject
attr_reader :attributes
##
+ # Block params to be used in the next MethodAttr parsed under this context
+
+ attr_accessor :block_params
+
+ ##
# Constants defined
attr_reader :constants
@@ -45,6 +56,11 @@ class RDoc::Context < RDoc::CodeObject
attr_reader :includes
##
+ # Modules this context is extended with
+
+ attr_reader :extends
+
+ ##
# Methods defined in this context
attr_reader :method_list
@@ -72,7 +88,7 @@ class RDoc::Context < RDoc::CodeObject
attr_accessor :unmatched_alias_lists
##
- # Aliases that could not eventually be resolved.
+ # Aliases that could not be resolved.
attr_reader :external_aliases
@@ -88,121 +104,14 @@ class RDoc::Context < RDoc::CodeObject
attr_reader :methods_hash
##
- # Hash of registered constants.
+ # Params to be used in the next MethodAttr parsed under this context
- attr_reader :constants_hash
+ attr_accessor :params
##
- # A section of documentation like:
- #
- # # :section: The title
- # # The body
- #
- # Sections can be referenced multiple times and will be collapsed into a
- # single section.
-
- class Section
-
- include RDoc::Text
-
- ##
- # Section comment
-
- attr_reader :comment
-
- ##
- # Context this Section lives in
-
- attr_reader :parent
-
- ##
- # Section title
-
- attr_reader :title
-
- @@sequence = "SEC00000"
-
- ##
- # Creates a new section with +title+ and +comment+
-
- def initialize parent, title, comment
- @parent = parent
- @title = title ? title.strip : title
-
- @@sequence.succ!
- @sequence = @@sequence.dup
-
- @comment = extract_comment comment
- end
-
- ##
- # Sections are equal when they have the same #title
-
- def == other
- self.class === other and @title == other.title
- end
-
- ##
- # Anchor reference for linking to this section
-
- def aref
- title = @title || '[untitled]'
-
- CGI.escape(title).gsub('%', '-').sub(/^-/, '')
- end
-
- ##
- # Appends +comment+ to the current comment separated by a rule.
-
- def comment= comment
- comment = extract_comment comment
-
- return if comment.empty?
-
- if @comment then
- @comment += "\n# ---\n#{comment}"
- else
- @comment = comment
- end
- end
-
- ##
- # Extracts the comment for this section from the original comment block.
- # If the first line contains :section:, strip it and use the rest.
- # Otherwise remove lines up to the line containing :section:, and look
- # for those lines again at the end and remove them. This lets us write
- #
- # # :section: The title
- # # The body
-
- def extract_comment comment
- if comment =~ /^#[ \t]*:section:.*\n/ then
- start = $`
- rest = $'
-
- if start.empty? then
- rest
- else
- rest.sub(/#{start.chomp}\Z/, '')
- end
- else
- comment
- end
- end
-
- def inspect # :nodoc:
- "#<%s:0x%x %p>" % [self.class, object_id, title]
- end
-
- ##
- # Section sequence number (deprecated)
-
- def sequence
- warn "RDoc::Context::Section#sequence is deprecated, use #aref"
- @sequence
- end
+ # Hash of registered constants.
- end
+ attr_reader :constants_hash
##
# Creates an unnamed empty context with public current visibility
@@ -235,6 +144,7 @@ class RDoc::Context < RDoc::CodeObject
@aliases = []
@requires = []
@includes = []
+ @extends = []
@constants = []
@external_aliases = []
@@ -242,8 +152,12 @@ class RDoc::Context < RDoc::CodeObject
# a method not yet encountered).
@unmatched_alias_lists = {}
- @methods_hash = {}
+ @methods_hash = {}
@constants_hash = {}
+
+ @params = nil
+
+ @store ||= nil
end
##
@@ -254,6 +168,24 @@ class RDoc::Context < RDoc::CodeObject
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
@@ -366,12 +298,12 @@ class RDoc::Context < RDoc::CodeObject
if full_name =~ /^(.+)::(\w+)$/ then
name = $2
ename = $1
- enclosing = RDoc::TopLevel.classes_hash[ename] ||
- RDoc::TopLevel.modules_hash[ename]
+ enclosing = @store.classes_hash[ename] || @store.modules_hash[ename]
# HACK: crashes in actionpack/lib/action_view/helpers/form_helper.rb (metaprogramming)
unless enclosing then
# try the given name at top level (will work for the above example)
- enclosing = RDoc::TopLevel.classes_hash[given_name] || RDoc::TopLevel.modules_hash[given_name]
+ enclosing = @store.classes_hash[given_name] ||
+ @store.modules_hash[given_name]
return enclosing if enclosing
# not found: create the parent(s)
names = ename.split('::')
@@ -410,7 +342,7 @@ class RDoc::Context < RDoc::CodeObject
end
# did we believe it was a module?
- mod = RDoc::TopLevel.modules_hash.delete superclass
+ mod = @store.modules_hash.delete superclass
upgrade_to_class mod, RDoc::NormalClass, mod.parent if mod
@@ -418,7 +350,7 @@ class RDoc::Context < RDoc::CodeObject
superclass = nil if superclass == full_name
end
- klass = RDoc::TopLevel.classes_hash[full_name]
+ klass = @store.classes_hash[full_name]
if klass then
# if TopLevel, it may not be registered in the classes:
@@ -435,7 +367,7 @@ class RDoc::Context < RDoc::CodeObject
end
else
# this is a new class
- mod = RDoc::TopLevel.modules_hash.delete full_name
+ mod = @store.modules_hash.delete full_name
if mod then
klass = upgrade_to_class mod, RDoc::NormalClass, enclosing
@@ -445,10 +377,12 @@ class RDoc::Context < RDoc::CodeObject
klass = class_type.new name, superclass
enclosing.add_class_or_module(klass, enclosing.classes_hash,
- RDoc::TopLevel.classes_hash)
+ @store.classes_hash)
end
end
+ klass.parent = self
+
klass
end
@@ -463,6 +397,7 @@ class RDoc::Context < RDoc::CodeObject
mod.section = current_section # TODO declaring context? something is
# wrong here...
mod.parent = self
+ mod.store = @store
unless @done_documenting then
self_hash[mod.name] = mod
@@ -504,13 +439,21 @@ class RDoc::Context < RDoc::CodeObject
# Adds included module +include+ which should be an RDoc::Include
def add_include include
- add_to @includes, include unless
- @includes.map { |i| i.full_name }.include? include.full_name
+ add_to @includes, include
include
end
##
+ # Adds extension module +ext+ which should be an RDoc::Extend
+
+ def add_extend ext
+ add_to @extends, ext
+
+ ext
+ end
+
+ ##
# Adds +method+ if not already there. If it is (as method or attribute),
# updates the comment if it was empty.
@@ -522,7 +465,13 @@ class RDoc::Context < RDoc::CodeObject
known = @methods_hash[key]
if known then
- known.comment = method.comment if known.comment.empty?
+ if @store then # otherwise we are loading
+ known.comment = method.comment if known.comment.empty?
+ previously = ", previously in #{known.file}" unless
+ method.file == known.file
+ @store.rdoc.options.warn \
+ "Duplicate method #{known.full_name} in #{method.file}#{previously}"
+ end
else
@methods_hash[key] = method
method.visibility = @visibility
@@ -542,9 +491,9 @@ class RDoc::Context < RDoc::CodeObject
return mod if mod
full_name = child_name name
- mod = RDoc::TopLevel.modules_hash[full_name] || class_type.new(name)
+ mod = @store.modules_hash[full_name] || class_type.new(name)
- add_class_or_module(mod, @modules, RDoc::TopLevel.modules_hash)
+ add_class_or_module mod, @modules, @store.modules_hash
end
##
@@ -554,31 +503,34 @@ class RDoc::Context < RDoc::CodeObject
def add_module_alias from, name, file
return from if @done_documenting
- to_name = child_name(name)
+ to_name = child_name name
# if we already know this name, don't register an alias:
# see the metaprogramming in lib/active_support/basic_object.rb,
- # where we already know BasicObject as a class when we find
+ # where we already know BasicObject is a class when we find
# BasicObject = BlankSlate
- return from if RDoc::TopLevel.find_class_or_module(to_name)
+ return from if @store.find_class_or_module to_name
+
+ to = from.dup
+ to.name = name
+ to.full_name = nil
- if from.module? then
- RDoc::TopLevel.modules_hash[to_name] = from
- @modules[name] = from
+ if to.module? then
+ @store.modules_hash[to_name] = to
+ @modules[name] = to
else
- RDoc::TopLevel.classes_hash[to_name] = from
- @classes[name] = from
+ @store.classes_hash[to_name] = to
+ @classes[name] = to
end
- # HACK: register a constant for this alias:
- # constant value and comment will be updated after,
- # when the Ruby parser adds the constant
- const = RDoc::Constant.new name, nil, ''
+ # Registers a constant for this alias. The constant value and comment
+ # will be updated later, when the Ruby parser adds the constant
+ const = RDoc::Constant.new name, nil, to.comment
const.record_location file
const.is_alias_for = from
add_constant const
- from
+ to
end
##
@@ -602,9 +554,9 @@ class RDoc::Context < RDoc::CodeObject
#
# See also RDoc::Context::Section
- def add_section title, comment
+ def add_section title, comment = nil
if section = @sections[title] then
- section.comment = comment
+ section.add_comment comment if comment
else
section = Section.new self, title, comment
@sections[title] = section
@@ -616,9 +568,11 @@ class RDoc::Context < RDoc::CodeObject
##
# Adds +thing+ to the collection +array+
- def add_to(array, thing)
+ def add_to array, thing
array << thing if @document_self
- thing.parent = self
+
+ thing.parent = self
+ thing.store = @store if @store
thing.section = current_section
end
@@ -628,7 +582,7 @@ class RDoc::Context < RDoc::CodeObject
# This means any of: comment, aliases, methods, attributes, external
# aliases, require, constant.
#
- # Includes are also checked unless <tt>includes == false</tt>.
+ # Includes and extends are also checked unless <tt>includes == false</tt>.
def any_content(includes = true)
@any_content ||= !(
@@ -640,7 +594,7 @@ class RDoc::Context < RDoc::CodeObject
@requires.empty? &&
@constants.empty?
)
- @any_content || (includes && !@includes.empty?)
+ @any_content || (includes && !(@includes + @extends).empty? )
end
##
@@ -723,6 +677,9 @@ class RDoc::Context < RDoc::CodeObject
##
# Iterator for ancestors for duck-typing. Does nothing. See
# RDoc::ClassModule#each_ancestor.
+ #
+ # This method exists to make it easy to work with Context subclasses that
+ # aren't part of RDoc.
def each_ancestor # :nodoc:
end
@@ -756,10 +713,19 @@ class RDoc::Context < RDoc::CodeObject
end
##
+ # Iterator for extension modules
+
+ def each_extend # :yields: extend
+ @extends.each do |e| yield e end
+ end
+
+ ##
# Iterator for methods
def each_method # :yields: method
- @method_list.sort.each {|m| yield m}
+ return enum_for __method__ unless block_given?
+
+ @method_list.sort.each { |m| yield m }
end
##
@@ -773,13 +739,15 @@ class RDoc::Context < RDoc::CodeObject
# NOTE: Do not edit collections yielded by this method
def each_section # :yields: section, constants, attributes
- constants = @constants.group_by do |constant| constant.section end
- constants.default = []
+ return enum_for __method__ unless block_given?
+ constants = @constants.group_by do |constant| constant.section end
attributes = @attributes.group_by do |attribute| attribute.section end
+
+ constants.default = []
attributes.default = []
- @sections.sort_by { |title, _| title.to_s }.each do |_, section|
+ sort_sections.each do |section|
yield section, constants[section].sort, attributes[section].sort
end
end
@@ -851,8 +819,8 @@ class RDoc::Context < RDoc::CodeObject
##
# Finds a file with +name+ in this context
- def find_file_named(name)
- top_level.class.find_file_named(name)
+ def find_file_named name
+ @store.find_file_named name
end
##
@@ -922,21 +890,21 @@ class RDoc::Context < RDoc::CodeObject
# look for a class or module 'symbol'
case symbol
when /^::/ then
- result = RDoc::TopLevel.find_class_or_module(symbol)
+ result = @store.find_class_or_module symbol
when /^(\w+):+(.+)$/
suffix = $2
top = $1
searched = self
- loop do
+ while searched do
mod = searched.find_module_named(top)
break unless mod
- result = RDoc::TopLevel.find_class_or_module(mod.full_name + '::' + suffix)
+ result = @store.find_class_or_module "#{mod.full_name}::#{suffix}"
break if result || searched.is_a?(RDoc::TopLevel)
searched = searched.parent
end
else
searched = self
- loop do
+ while searched do
result = searched.find_module_named(symbol)
break if result || searched.is_a?(RDoc::TopLevel)
searched = searched.parent
@@ -985,6 +953,8 @@ class RDoc::Context < RDoc::CodeObject
##
# Instance methods
+ #--
+ # TODO rename to instance_methods
def instance_method_list
@instance_method_list ||= method_list.reject { |a| a.singleton }
@@ -1089,8 +1059,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
@@ -1098,24 +1068,23 @@ class RDoc::Context < RDoc::CodeObject
##
# Only called when min_visibility == :public or :private
- def remove_invisible_in(array, min_visibility) # :nodoc:
- if min_visibility == :public
+ def remove_invisible_in array, min_visibility # :nodoc:
+ if min_visibility == :public then
array.reject! { |e|
e.visibility != :public and not e.force_documentation
}
else
array.reject! { |e|
- e.visibility == :private and
- not e.force_documentation
+ e.visibility == :private and not e.force_documentation
}
end
end
##
- # Tries to resolve unmatched aliases when a method
- # or attribute has just been added.
+ # Tries to resolve unmatched aliases when a method or attribute has just
+ # been added.
- def resolve_aliases(added)
+ def resolve_aliases added
# resolve any pending unmatched aliases
key = added.pretty_name
unmatched_alias_list = @unmatched_alias_lists[key]
@@ -1128,6 +1097,31 @@ class RDoc::Context < RDoc::CodeObject
end
##
+ # Returns RDoc::Context::Section objects referenced in this context for use
+ # in a table of contents.
+
+ def section_contents
+ used_sections = {}
+
+ each_method do |method|
+ next unless method.display?
+
+ used_sections[method.section] = true
+ end
+
+ # order found sections
+ sections = sort_sections.select do |section|
+ used_sections[section]
+ end
+
+ # only the default section is used
+ return [] if
+ sections.length == 1 and not sections.first.title
+
+ sections
+ end
+
+ ##
# Sections in this context
def sections
@@ -1155,6 +1149,26 @@ class RDoc::Context < RDoc::CodeObject
end
end
+ ##
+ # Sorts sections alphabetically (default) or in TomDoc fashion (none,
+ # Public, Internal, Deprecated)
+
+ def sort_sections
+ titles = @sections.map { |title, _| title }
+
+ if titles.length > 1 and
+ TOMDOC_TITLES_SORT ==
+ (titles | TOMDOC_TITLES).sort_by { |title| title.to_s } then
+ @sections.values_at(*TOMDOC_TITLES).compact
+ else
+ @sections.sort_by { |title, _|
+ title.to_s
+ }.map { |_, section|
+ section
+ }
+ end
+ end
+
def to_s # :nodoc:
"#{self.class.name} #{self.full_name}"
end
@@ -1179,13 +1193,16 @@ class RDoc::Context < RDoc::CodeObject
enclosing.modules_hash.delete mod.name
klass = RDoc::ClassModule.from_module class_type, mod
+ klass.store = @store
# if it was there, then we keep it even if done_documenting
- RDoc::TopLevel.classes_hash[mod.full_name] = klass
- enclosing.classes_hash[mod.name] = klass
+ @store.classes_hash[mod.full_name] = klass
+ enclosing.classes_hash[mod.name] = klass
klass
end
+ autoload :Section, 'rdoc/context/section'
+
end
diff --git a/lib/rdoc/context/section.rb b/lib/rdoc/context/section.rb
new file mode 100644
index 0000000000..580f07deff
--- /dev/null
+++ b/lib/rdoc/context/section.rb
@@ -0,0 +1,238 @@
+##
+# A section of documentation like:
+#
+# # :section: The title
+# # The body
+#
+# Sections can be referenced multiple times and will be collapsed into a
+# single section.
+
+class RDoc::Context::Section
+
+ include RDoc::Text
+
+ MARSHAL_VERSION = 0 # :nodoc:
+
+ ##
+ # Section comment
+
+ attr_reader :comment
+
+ ##
+ # Section comments
+
+ attr_reader :comments
+
+ ##
+ # Context this Section lives in
+
+ attr_reader :parent
+
+ ##
+ # Section title
+
+ attr_reader :title
+
+ @@sequence = "SEC00000"
+
+ ##
+ # Creates a new section with +title+ and +comment+
+
+ def initialize parent, title, comment
+ @parent = parent
+ @title = title ? title.strip : title
+
+ @@sequence.succ!
+ @sequence = @@sequence.dup
+
+ @comments = []
+
+ add_comment comment
+ end
+
+ ##
+ # Sections are equal when they have the same #title
+
+ def == other
+ self.class === other and @title == other.title
+ end
+
+ ##
+ # Adds +comment+ to this section
+
+ def add_comment comment
+ comment = extract_comment comment
+
+ return if comment.empty?
+
+ case comment
+ when RDoc::Comment then
+ @comments << comment
+ when RDoc::Markup::Document then
+ @comments.concat comment.parts
+ when Array then
+ @comments.concat comment
+ else
+ raise TypeError, "unknown comment type: #{comment.inspect}"
+ end
+ end
+
+ ##
+ # Anchor reference for linking to this section
+
+ def aref
+ title = @title || '[untitled]'
+
+ CGI.escape(title).gsub('%', '-').sub(/^-/, '')
+ end
+
+ ##
+ # Extracts the comment for this section from the original comment block.
+ # If the first line contains :section:, strip it and use the rest.
+ # Otherwise remove lines up to the line containing :section:, and look
+ # for those lines again at the end and remove them. This lets us write
+ #
+ # # :section: The title
+ # # The body
+
+ def extract_comment comment
+ case comment
+ when Array then
+ comment.map do |c|
+ extract_comment c
+ end
+ when nil
+ RDoc::Comment.new ''
+ when RDoc::Comment then
+ if comment.text =~ /^#[ \t]*:section:.*\n/ then
+ start = $`
+ rest = $'
+
+ comment.text = if start.empty? then
+ rest
+ else
+ rest.sub(/#{start.chomp}\Z/, '')
+ end
+ end
+
+ comment
+ when RDoc::Markup::Document then
+ comment
+ else
+ raise TypeError, "unknown comment #{comment.inspect}"
+ end
+ end
+
+ def inspect # :nodoc:
+ "#<%s:0x%x %p>" % [self.class, object_id, title]
+ end
+
+ ##
+ # The files comments in this section come from
+
+ def in_files
+ return [] if @comments.empty?
+
+ case @comments
+ when Array then
+ @comments.map do |comment|
+ comment.file
+ end
+ when RDoc::Markup::Document then
+ @comment.parts.map do |document|
+ document.file
+ end
+ else
+ raise RDoc::Error, "BUG: unknown comment class #{@comments.class}"
+ end
+ end
+
+ ##
+ # Serializes this Section. The title and parsed comment are saved, but not
+ # the section parent which must be restored manually.
+
+ def marshal_dump
+ [
+ MARSHAL_VERSION,
+ @title,
+ parse,
+ ]
+ end
+
+ ##
+ # De-serializes this Section. The section parent must be restored manually.
+
+ def marshal_load array
+ @parent = nil
+
+ @title = array[1]
+ @comments = array[2]
+ end
+
+ ##
+ # Parses +comment_location+ into an RDoc::Markup::Document composed of
+ # multiple RDoc::Markup::Documents with their file set.
+
+ def parse
+ case @comments
+ when String then
+ super
+ when Array then
+ docs = @comments.map do |comment, location|
+ doc = super comment
+ doc.file = location if location
+ doc
+ end
+
+ RDoc::Markup::Document.new(*docs)
+ when RDoc::Comment then
+ doc = super @comments.text, comments.format
+ doc.file = @comments.location
+ doc
+ when RDoc::Markup::Document then
+ return @comments
+ else
+ raise ArgumentError, "unknown comment class #{comments.class}"
+ end
+ end
+
+ ##
+ # The section's title, or 'Top Section' if the title is nil.
+ #
+ # This is used by the table of contents template so the name is silly.
+
+ def plain_html
+ @title || 'Top Section'
+ end
+
+ ##
+ # Removes a comment from this section if it is from the same file as
+ # +comment+
+
+ def remove_comment comment
+ return if @comments.empty?
+
+ case @comments
+ when Array then
+ @comments.delete_if do |my_comment|
+ my_comment.file == comment.file
+ end
+ when RDoc::Markup::Document then
+ @comments.parts.delete_if do |document|
+ document.file == comment.file.name
+ end
+ else
+ raise RDoc::Error, "BUG: unknown comment class #{@comments.class}"
+ end
+ end
+
+ ##
+ # Section sequence number (deprecated)
+
+ def sequence
+ warn "RDoc::Context::Section#sequence is deprecated, use #aref"
+ @sequence
+ end
+
+end
+
diff --git a/lib/rdoc/cross_reference.rb b/lib/rdoc/cross_reference.rb
index adeef2661a..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
@@ -27,63 +27,79 @@ class RDoc::CrossReference
# have been suppressed, since the suppression characters are removed by the
# code that is triggered.
- CROSSREF_REGEXP = /(
- # A::B::C.meth
- #{CLASS_REGEXP_STR}(?:[.#]|::)#{METHOD_REGEXP_STR}
-
- # Stand-alone method (preceded by a #)
- | \\?\##{METHOD_REGEXP_STR}
-
- # Stand-alone method (preceded by ::)
- | ::#{METHOD_REGEXP_STR}
-
- # A::B::C
- # The stuff after CLASS_REGEXP_STR is a
- # nasty hack. CLASS_REGEXP_STR unfortunately matches
- # words like dog and cat (these are legal "class"
- # names in Fortran 95). When a word is flagged as a
- # potential cross-reference, limitations in the markup
- # engine suppress other processing, such as typesetting.
- # This is particularly noticeable for contractions.
- # In order that words like "can't" not
- # be flagged as potential cross-references, only
- # flag potential class cross-references if the character
- # after the cross-reference is a space, sentence
- # punctuation, tag start character, or attribute
- # marker.
- | #{CLASS_REGEXP_STR}(?=[\s\)\.\?\!\,\;<\000]|\z)
-
- # Things that look like filenames
- # The key thing is that there must be at least
- # one special character (period, slash, or
- # underscore).
- | (?:\.\.\/)*[-\/\w]+[_\/\.][-\w\/\.]+
-
- # Things that have markup suppressed
- # Don't process things like '\<' in \<tt>, though.
- # TODO: including < is a hack, not very satisfying.
- | \\[^\s<]
- )/x
+ CROSSREF_REGEXP = /(?:^|\s)
+ (
+ (?:
+ # A::B::C.meth
+ #{CLASS_REGEXP_STR}(?:[.#]|::)#{METHOD_REGEXP_STR}
+
+ # Stand-alone method (preceded by a #)
+ | \\?\##{METHOD_REGEXP_STR}
+
+ # Stand-alone method (preceded by ::)
+ | ::#{METHOD_REGEXP_STR}
+
+ # A::B::C
+ # The stuff after CLASS_REGEXP_STR is a
+ # nasty hack. CLASS_REGEXP_STR unfortunately matches
+ # words like dog and cat (these are legal "class"
+ # names in Fortran 95). When a word is flagged as a
+ # potential cross-reference, limitations in the markup
+ # engine suppress other processing, such as typesetting.
+ # This is particularly noticeable for contractions.
+ # In order that words like "can't" not
+ # be flagged as potential cross-references, only
+ # flag potential class cross-references if the character
+ # after the cross-reference is a space, sentence
+ # punctuation, tag start character, or attribute
+ # marker.
+ | #{CLASS_REGEXP_STR}(?=[@\s).?!,;<\000]|\z)
+
+ # Things that look like filenames
+ # The key thing is that there must be at least
+ # one special character (period, slash, or
+ # underscore).
+ | (?:\.\.\/)*[-\/\w]+[_\/.][-\w\/.]+
+
+ # Things that have markup suppressed
+ # Don't process things like '\<' in \<tt>, though.
+ # TODO: including < is a hack, not very satisfying.
+ | \\[^\s<]
+ )
+
+ # labels for headings
+ (?:@[\w+%-]+(?:\.[\w|%-]+)?)?
+ )/x
##
# Version of CROSSREF_REGEXP used when <tt>--hyperlink-all</tt> is specified.
- ALL_CROSSREF_REGEXP = /(
- # A::B::C.meth
- #{CLASS_REGEXP_STR}(?:[.#]|::)#{METHOD_REGEXP_STR}
+ ALL_CROSSREF_REGEXP = /
+ (?:^|\s)
+ (
+ (?:
+ # A::B::C.meth
+ #{CLASS_REGEXP_STR}(?:[.#]|::)#{METHOD_REGEXP_STR}
- # Stand-alone method
- | \\?#{METHOD_REGEXP_STR}
+ # Stand-alone method
+ | \\?#{METHOD_REGEXP_STR}
- # A::B::C
- | #{CLASS_REGEXP_STR}(?=[\s\)\.\?\!\,\;<\000]|\z)
+ # A::B::C
+ | #{CLASS_REGEXP_STR}(?=[@\s).?!,;<\000]|\z)
- # Things that look like filenames
- | (?:\.\.\/)*[-\/\w]+[_\/\.][-\w\/\.]+
+ # Things that look like filenames
+ | (?:\.\.\/)*[-\/\w]+[_\/.][-\w\/.]+
- # Things that have markup suppressed
- | \\[^\s<]
- )/x
+ # Things that have markup suppressed
+ | \\[^\s<]
+ )
+
+ # labels for headings
+ (?:@[\w+%-]+)?
+ )/x
+
+ ##
+ # Hash of references that have been looked-up to their replacements
attr_accessor :seen
@@ -93,6 +109,7 @@ class RDoc::CrossReference
def initialize context
@context = context
+ @store = context.store
@seen = {}
end
@@ -107,16 +124,6 @@ class RDoc::CrossReference
def resolve name, text
return @seen[name] if @seen.include? name
- # Find class, module, or method in class or module.
- #
- # Do not, however, use an if/elsif/else chain to do so. Instead, test
- # each possible pattern until one matches. The reason for this is that a
- # string like "YAML.txt" could be the txt() class method of class YAML (in
- # which case it would match the first pattern, which splits the string
- # into container and method components and looks up both) or a filename
- # (in which case it would match the last pattern, which just checks
- # whether the string as a whole is a known symbol).
-
if /#{CLASS_REGEXP_STR}([.#]|::)#{METHOD_REGEXP_STR}/o =~ name then
type = $2
type = '' if type == '.' # will find either #method or ::method
@@ -141,12 +148,15 @@ class RDoc::CrossReference
ref = case name
when /^\\(#{CLASS_REGEXP_STR})$/o then
- ref = @context.find_symbol $1
+ @context.find_symbol $1
else
- ref = @context.find_symbol name
+ @context.find_symbol name
end unless ref
- ref = nil if RDoc::Alias === ref # external alias: can't link to it
+ # Try a page name
+ ref = @store.page name if not ref and name =~ /^\w+$/
+
+ ref = nil if RDoc::Alias === ref # external alias, can't link to it
out = if name == '\\' then
name
diff --git a/lib/rdoc/encoding.rb b/lib/rdoc/encoding.rb
index ab752ee665..9fe3539412 100644
--- a/lib/rdoc/encoding.rb
+++ b/lib/rdoc/encoding.rb
@@ -1,7 +1,5 @@
# coding: US-ASCII
-require 'rdoc'
-
##
# This class is a wrapper around File IO and Encoding that helps RDoc load
# files and convert them to the correct encoding.
@@ -27,26 +25,40 @@ module RDoc::Encoding
RDoc::Encoding.set_encoding content
if Object.const_defined? :Encoding then
- encoding ||= Encoding.default_external
- orig_encoding = content.encoding
-
- if utf8 then
- content.force_encoding Encoding::UTF_8
- content.encode! encoding
- else
- # assume the content is in our output encoding
- content.force_encoding encoding
- end
-
- unless content.valid_encoding? then
- # revert and try to transcode
- content.force_encoding orig_encoding
- content.encode! encoding
- end
-
- unless content.valid_encoding? then
- warn "unable to convert #{filename} to #{encoding}, skipping"
- content = nil
+ begin
+ encoding ||= Encoding.default_external
+ orig_encoding = content.encoding
+
+ if utf8 then
+ content.force_encoding Encoding::UTF_8
+ content.encode! encoding
+ else
+ # assume the content is in our output encoding
+ content.force_encoding encoding
+ end
+
+ unless content.valid_encoding? then
+ # revert and try to transcode
+ content.force_encoding orig_encoding
+ content.encode! encoding
+ end
+
+ unless content.valid_encoding? then
+ warn "unable to convert #{filename} to #{encoding}, skipping"
+ content = nil
+ end
+ rescue Encoding::InvalidByteSequenceError,
+ Encoding::UndefinedConversionError => e
+ if force_transcode then
+ content.force_encoding orig_encoding
+ content.encode!(encoding,
+ :invalid => :replace, :undef => :replace,
+ :replace => '?')
+ return content
+ else
+ warn "unable to convert #{e.message} for #{filename}, skipping"
+ return nil
+ end
end
end
@@ -55,15 +67,6 @@ module RDoc::Encoding
raise unless e.message =~ /unknown encoding name - (.*)/
warn "unknown encoding name \"#{$1}\" for #{filename}, skipping"
nil
- rescue Encoding::UndefinedConversionError => e
- if force_transcode then
- content.force_encoding orig_encoding
- content.encode! encoding, :undef => :replace, :replace => '?'
- content
- else
- warn "unable to convert #{e.message} for #{filename}, skipping"
- nil
- end
rescue Errno::EISDIR, Errno::ENOENT
nil
end
@@ -72,7 +75,9 @@ module RDoc::Encoding
# Sets the encoding of +string+ based on the magic comment
def self.set_encoding string
- first_line = string[/\A(?:#!.*\n)?.*\n/]
+ string =~ /\A(?:#!.*\n)?(.*\n)/
+
+ first_line = $1
name = case first_line
when /^<\?xml[^?]*encoding=(["'])(.*?)\1/ then $2
diff --git a/lib/rdoc/erb_partial.rb b/lib/rdoc/erb_partial.rb
new file mode 100644
index 0000000000..910d1e0351
--- /dev/null
+++ b/lib/rdoc/erb_partial.rb
@@ -0,0 +1,18 @@
+##
+# Allows an ERB template to be rendered in the context (binding) of an
+# existing ERB template evaluation.
+
+class RDoc::ERBPartial < ERB
+
+ ##
+ # Overrides +compiler+ startup to set the +eoutvar+ to an empty string only
+ # if it isn't already set.
+
+ def set_eoutvar compiler, eoutvar = '_erbout'
+ super
+
+ compiler.pre_cmd = ["#{eoutvar} ||= ''"]
+ end
+
+end
+
diff --git a/lib/rdoc/extend.rb b/lib/rdoc/extend.rb
new file mode 100644
index 0000000000..efa2c69bee
--- /dev/null
+++ b/lib/rdoc/extend.rb
@@ -0,0 +1,9 @@
+##
+# A Module extension to a class with \#extend
+#
+# RDoc::Extend.new 'Enumerable', 'comment ...'
+
+class RDoc::Extend < RDoc::Mixin
+
+end
+
diff --git a/lib/rdoc/generator.rb b/lib/rdoc/generator.rb
index 2fa891f533..9051f8a658 100644
--- a/lib/rdoc/generator.rb
+++ b/lib/rdoc/generator.rb
@@ -1,12 +1,10 @@
-require 'rdoc'
-
##
# RDoc uses generators to turn parsed source code in the form of an
# RDoc::CodeObject tree into some form of output. RDoc comes with the HTML
# generator RDoc::Generator::Darkfish and an ri data generator
# RDoc::Generator::RI.
#
-# = Registering a Generator
+# == Registering a Generator
#
# Generators are registered by calling RDoc::RDoc.add_generator with the class
# of the generator:
@@ -15,26 +13,38 @@ require 'rdoc'
# RDoc::RDoc.add_generator self
# end
#
-# = Adding Options to +rdoc+
+# == Adding Options to +rdoc+
#
# Before option processing in +rdoc+, RDoc::Options will call ::setup_options
# on the generator class with an RDoc::Options instance. The generator can
# use RDoc::Options#option_parser to add command-line options to the +rdoc+
-# tool. See OptionParser for details on how to add options.
+# tool. See RDoc::Options@Custom+Options for an example and see OptionParser
+# for details on how to add options.
#
# You can extend the RDoc::Options instance with additional accessors for your
# generator.
#
-# = Generator Instantiation
+# == Generator Instantiation
#
# After parsing, RDoc::RDoc will instantiate a generator by calling
-# #initialize with an RDoc::Options instance.
+# #initialize with an RDoc::Store instance and an RDoc::Options instance.
+#
+# The RDoc::Store instance holds documentation for parsed source code. In
+# RDoc 3 and earlier the RDoc::TopLevel class held this data. When upgrading
+# a generator from RDoc 3 and earlier you should only need to replace
+# RDoc::TopLevel with the store instance.
#
-# RDoc will then call #generate on the generator instance and pass in an Array
-# of RDoc::TopLevel instances, each representing a parsed file. You can use
-# the various class methods on RDoc::TopLevel and in the RDoc::CodeObject tree
-# to create your desired output format.
+# RDoc will then call #generate on the generator instance. You can use the
+# various methods on RDoc::Store and in the RDoc::CodeObject tree to create
+# your desired output format.
module RDoc::Generator
+
+ autoload :Markup, 'rdoc/generator/markup'
+
+ autoload :Darkfish, 'rdoc/generator/darkfish'
+ autoload :JsonIndex, 'rdoc/generator/json_index'
+ autoload :RI, 'rdoc/generator/ri'
+
end
diff --git a/lib/rdoc/generator/darkfish.rb b/lib/rdoc/generator/darkfish.rb
index a3ffea0ce8..bd37b60668 100644
--- a/lib/rdoc/generator/darkfish.rb
+++ b/lib/rdoc/generator/darkfish.rb
@@ -1,9 +1,8 @@
# -*- mode: ruby; ruby-indent-level: 2; tab-width: 2 -*-
-require 'pathname'
+require 'erb'
require 'fileutils'
-require 'rdoc/erbio'
-
+require 'pathname'
require 'rdoc/generator/markup'
##
@@ -46,6 +45,11 @@ require 'rdoc/generator/markup'
# 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.
+#
+# == Attributions
+#
+# Darkfish uses the {Silk Icons}[http://www.famfamfam.com/lab/icons/silk/] set
+# by Mark James.
class RDoc::Generator::Darkfish
@@ -53,6 +57,22 @@ 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.
@@ -61,7 +81,7 @@ class RDoc::Generator::Darkfish
##
# Release Version
- VERSION = '2'
+ VERSION = '3'
##
# Description of this generator
@@ -69,19 +89,63 @@ class RDoc::Generator::Darkfish
DESCRIPTION = 'HTML generator, written by Michael Granger'
##
- # Initialize a few instance variables before we start
+ # The relative path to style sheets and javascript. By default this is set
+ # the same as the rel_prefix.
- def initialize options
- @options = options
+ attr_accessor :asset_rel_path
- @template_dir = Pathname.new options.template_dir
- @template_cache = {}
+ ##
+ # The path to generate files into, combined with <tt>--op</tt> from the
+ # options for a full path.
- @files = nil
- @classes = nil
+ attr_reader :base_dir
- @basedir = Pathname.pwd.expand_path
- end
+ ##
+ # Classes and modules to be used by this generator, not necessarily
+ # displayed. See also #modsort
+
+ attr_reader :classes
+
+ ##
+ # No files will be written when dry_run is true.
+
+ attr_accessor :dry_run
+
+ ##
+ # When false the generate methods return a String instead of writing to a
+ # file. The default is true.
+
+ attr_accessor :file_output
+
+ ##
+ # Files to be displayed by this generator
+
+ attr_reader :files
+
+ ##
+ # The JSON index generator for this Darkfish generator
+
+ attr_reader :json_index
+
+ ##
+ # Methods to be displayed by this generator
+
+ attr_reader :methods
+
+ ##
+ # Sorted list of classes and modules to be displayed by this generator
+
+ attr_reader :modsort
+
+ ##
+ # The RDoc::Store that is the source of the generated content
+
+ attr_reader :store
+
+ ##
+ # The directory where the template files live
+
+ attr_reader :template_dir # :nodoc:
##
# The output directory
@@ -89,6 +153,29 @@ class RDoc::Generator::Darkfish
attr_reader :outputdir
##
+ # Initialize a few instance variables before we start
+
+ def initialize store, options
+ @store = store
+ @options = options
+
+ @asset_rel_path = ''
+ @base_dir = Pathname.pwd.expand_path
+ @dry_run = @options.dry_run
+ @file_output = true
+ @template_dir = Pathname.new options.template_dir
+ @template_cache = {}
+
+ @classes = nil
+ @context = nil
+ @files = nil
+ @methods = nil
+ @modsort = nil
+
+ @json_index = RDoc::Generator::JsonIndex.new self, options
+ end
+
+ ##
# Output progress information if debugging is enabled
def debug_msg *msg
@@ -126,21 +213,23 @@ class RDoc::Generator::Darkfish
def write_style_sheet
debug_msg "Copying static files"
- options = { :verbose => $DEBUG_RDOC, :noop => @options.dry_run }
+ 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
next if File.basename(path) =~ /^\./
- 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
+ dst = Pathname.new(path).relative_path_from @template_dir
- FileUtils.cp @template_dir + path, dst, options
+ install_rdoc_static_file @template_dir + path, dst, options
end
end
@@ -148,19 +237,17 @@ class RDoc::Generator::Darkfish
# Build the initial indices and output objects based on an array of TopLevel
# objects containing the extracted information.
- def generate top_levels
- @outputdir = Pathname.new(@options.op_dir).expand_path(@basedir)
+ def generate
+ setup
- @files = top_levels.sort
- @classes = RDoc::TopLevel.all_classes_and_modules.sort
- @methods = @classes.map { |m| m.method_list }.flatten.sort
- @modsort = get_sorted_module_list(@classes)
-
- # Now actually write the output
write_style_sheet
generate_index
generate_class_files
generate_file_files
+ generate_table_of_contents
+ @json_index.generate
+
+ copy_static
rescue => e
debug_msg "%s: %s\n %s" % [
@@ -170,42 +257,64 @@ class RDoc::Generator::Darkfish
raise
end
- protected
-
##
- # Return a list of the documented modules sorted by salience first, then
- # by name.
+ # Copies static files from the static_path into the output directory
- def get_sorted_module_list(classes)
- nscounts = classes.inject({}) do |counthash, klass|
- top_level = klass.full_name.gsub(/::.*/, '')
- counthash[top_level] ||= 0
- counthash[top_level] += 1
+ def copy_static
+ return if @options.static_path.empty?
+
+ fu_options = { :verbose => $DEBUG_RDOC, :noop => @dry_run }
+
+ @options.static_path.each do |path|
+ unless File.directory? path then
+ FileUtils.install path, @outputdir, fu_options.merge(:mode => 0644)
+ next
+ end
- counthash
+ Dir.chdir path do
+ Dir[File.join('**', '*')].each do |entry|
+ dest_file = @outputdir + entry
+
+ if File.directory? entry then
+ FileUtils.mkdir_p entry, fu_options
+ else
+ FileUtils.install entry, dest_file, fu_options.merge(:mode => 0644)
+ end
+ end
+ end
end
+ end
+
+ ##
+ # Return a list of the documented modules sorted by salience first, then
+ # by name.
- # Sort based on how often the top level namespace occurs, and then on the
- # name of the module -- this works for projects that put their stuff into
- # a namespace, of course, but doesn't hurt if they don't.
- classes.sort_by do |klass|
- top_level = klass.full_name.gsub( /::.*/, '' )
- [nscounts[top_level] * -1, klass.full_name]
- end.select do |klass|
+ def get_sorted_module_list classes
+ classes.select do |klass|
klass.display?
- end
+ end.sort
end
##
# Generate an index page which lists all the classes which are documented.
def generate_index
+ setup
+
template_file = @template_dir + 'index.rhtml'
return unless template_file.exist?
debug_msg "Rendering the index page..."
- out_file = @basedir + @options.op_dir + 'index.html'
+ out_file = @base_dir + @options.op_dir + 'index.html'
+ rel_prefix = @outputdir.relative_path_from out_file.dirname
+ search_index_rel_prefix = rel_prefix
+ search_index_rel_prefix += @asset_rel_path if @file_output
+
+ # suppress 1.9.3 warning
+ asset_rel_prefix = asset_rel_prefix = rel_prefix + @asset_rel_path
+
+ @title = @options.title
render_template template_file, out_file do |io| binding end
rescue => e
@@ -217,10 +326,40 @@ class RDoc::Generator::Darkfish
end
##
- # Generate a documentation file for each class
+ # Generates a class file for +klass+
+
+ def generate_class klass, template_file = nil
+ setup
+
+ current = klass
+
+ template_file ||= @template_dir + 'class.rhtml'
+
+ debug_msg " working on %s (%s)" % [klass.full_name, klass.path]
+ out_file = @outputdir + klass.path
+ rel_prefix = @outputdir.relative_path_from out_file.dirname
+ search_index_rel_prefix = rel_prefix
+ search_index_rel_prefix += @asset_rel_path if @file_output
+
+ # suppress 1.9.3 warning
+ asset_rel_prefix = asset_rel_prefix = rel_prefix + @asset_rel_path
+ svninfo = svninfo = get_svninfo(current)
+
+ @title = "#{klass.type} #{klass.full_name} - #{@options.title}"
+
+ debug_msg " rendering #{out_file}"
+ render_template template_file, out_file do |io| binding end
+ end
+
+ ##
+ # Generate a documentation file for each class and module
def generate_class_files
- template_file = @template_dir + 'classpage.rhtml'
+ setup
+
+ template_file = @template_dir + 'class.rhtml'
+ template_file = @template_dir + 'classpage.rhtml' unless
+ template_file.exist?
return unless template_file.exist?
debug_msg "Generating class documentation in #{@outputdir}"
@@ -228,14 +367,8 @@ class RDoc::Generator::Darkfish
@classes.each do |klass|
current = klass
- debug_msg " working on %s (%s)" % [klass.full_name, klass.path]
- out_file = @outputdir + klass.path
- # suppress 1.9.3 warning
- rel_prefix = rel_prefix = @outputdir.relative_path_from(out_file.dirname)
- svninfo = svninfo = self.get_svninfo(klass)
- debug_msg " rendering #{out_file}"
- render_template template_file, out_file do |io| binding end
+ generate_class klass, template_file
end
rescue => e
error = RDoc::Error.new \
@@ -249,19 +382,56 @@ class RDoc::Generator::Darkfish
# Generate a documentation file for each file
def generate_file_files
- template_file = @template_dir + 'filepage.rhtml'
- return unless template_file.exist?
+ setup
+
+ page_file = @template_dir + 'page.rhtml'
+ fileinfo_file = @template_dir + 'fileinfo.rhtml'
+
+ # for legacy templates
+ filepage_file = @template_dir + 'filepage.rhtml' unless
+ page_file.exist? or fileinfo_file.exist?
+
+ return unless
+ page_file.exist? or fileinfo_file.exist? or filepage_file.exist?
+
debug_msg "Generating file documentation in #{@outputdir}"
out_file = nil
+ current = nil
@files.each do |file|
- out_file = @outputdir + file.path
+ current = file
+
+ if file.text? and page_file.exist? then
+ generate_page file
+ next
+ end
+
+ template_file = nil
+ out_file = @outputdir + file.path
debug_msg " working on %s (%s)" % [file.full_name, out_file]
+ rel_prefix = @outputdir.relative_path_from out_file.dirname
+ search_index_rel_prefix = rel_prefix
+ search_index_rel_prefix += @asset_rel_path if @file_output
+
# suppress 1.9.3 warning
- rel_prefix = rel_prefix = @outputdir.relative_path_from(out_file.dirname)
+ asset_rel_prefix = asset_rel_prefix = rel_prefix + @asset_rel_path
+
+ unless filepage_file then
+ if file.text? then
+ next unless page_file.exist?
+ template_file = page_file
+ @title = file.page_name
+ else
+ next unless fileinfo_file.exist?
+ template_file = fileinfo_file
+ @title = "File: #{file.base_name}"
+ end
+ end
+
+ @title += " - #{@options.title}"
+ template_file ||= filepage_file
- debug_msg " rendering #{out_file}"
render_template template_file, out_file do |io| binding end
end
rescue => e
@@ -273,6 +443,149 @@ class RDoc::Generator::Darkfish
end
##
+ # Generate a page file for +file+
+
+ def generate_page file
+ setup
+
+ template_file = @template_dir + 'page.rhtml'
+
+ out_file = @outputdir + file.path
+ debug_msg " working on %s (%s)" % [file.full_name, out_file]
+ rel_prefix = @outputdir.relative_path_from out_file.dirname
+ search_index_rel_prefix = rel_prefix
+ search_index_rel_prefix += @asset_rel_path if @file_output
+
+ # suppress 1.9.3 warning
+ current = current = file
+ asset_rel_prefix = asset_rel_prefix = rel_prefix + @asset_rel_path
+
+ @title = "#{file.page_name} - #{@options.title}"
+
+ debug_msg " rendering #{out_file}"
+ render_template template_file, out_file do |io| binding end
+ end
+
+ ##
+ # Generates the 404 page for the RDoc servlet
+
+ def generate_servlet_not_found message
+ setup
+
+ template_file = @template_dir + 'servlet_not_found.rhtml'
+ return unless template_file.exist?
+
+ debug_msg "Rendering the servlet 404 Not Found page..."
+
+ rel_prefix = rel_prefix = ''
+ search_index_rel_prefix = rel_prefix
+ search_index_rel_prefix += @asset_rel_path if @file_output
+
+ # suppress 1.9.3 warning
+ asset_rel_prefix = asset_rel_prefix = ''
+
+ @title = 'Not Found'
+
+ render_template template_file do |io| binding end
+ rescue => e
+ error = RDoc::Error.new \
+ "error generating servlet_not_found: #{e.message} (#{e.class})"
+ error.set_backtrace e.backtrace
+
+ raise error
+ end
+
+ ##
+ # Generates the servlet root page for the RDoc servlet
+
+ def generate_servlet_root installed
+ setup
+
+ template_file = @template_dir + 'servlet_root.rhtml'
+ return unless template_file.exist?
+
+ debug_msg 'Rendering the servlet root page...'
+
+ rel_prefix = '.'
+ asset_rel_prefix = rel_prefix
+ search_index_rel_prefix = asset_rel_prefix
+ search_index_rel_prefix += @asset_rel_path if @file_output
+
+ @title = 'Local RDoc Documentation'
+
+ render_template template_file do |io| binding end
+ rescue => e
+ error = RDoc::Error.new \
+ "error generating servlet_root: #{e.message} (#{e.class})"
+ error.set_backtrace e.backtrace
+
+ raise error
+ end
+
+ ##
+ # Generate an index page which lists all the classes which are documented.
+
+ def generate_table_of_contents
+ setup
+
+ template_file = @template_dir + 'table_of_contents.rhtml'
+ return unless template_file.exist?
+
+ debug_msg "Rendering the Table of Contents..."
+
+ out_file = @outputdir + 'table_of_contents.html'
+ rel_prefix = @outputdir.relative_path_from out_file.dirname
+ search_index_rel_prefix = rel_prefix
+ search_index_rel_prefix += @asset_rel_path if @file_output
+
+ # suppress 1.9.3 warning
+ asset_rel_prefix = asset_rel_prefix = rel_prefix + @asset_rel_path
+
+ @title = "Table of Contents - #{@options.title}"
+
+ render_template template_file, out_file do |io| binding end
+ rescue => e
+ error = RDoc::Error.new \
+ "error generating table_of_contents.html: #{e.message} (#{e.class})"
+ error.set_backtrace e.backtrace
+
+ 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
+
+ def setup
+ return if instance_variable_defined? :@outputdir
+
+ @outputdir = Pathname.new(@options.op_dir).expand_path @base_dir
+
+ return unless @store
+
+ @classes = @store.all_classes_and_modules.sort
+ @files = @store.all_files.sort
+ @methods = @classes.map { |m| m.method_list }.flatten.sort
+ @modsort = get_sorted_module_list @classes
+ end
+
+ ##
# Return a string describing the amount of time in the given number of
# seconds in terms a human can understand easily.
@@ -325,6 +638,46 @@ class RDoc::Generator::Darkfish
end
##
+ # Creates a template from its components and the +body_file+.
+ #
+ # For backwards compatibility, if +body_file+ contains "<html" the body is
+ # used directly.
+
+ def assemble_template body_file
+ body = body_file.read
+ return body if body =~ /<html/
+
+ head_file = @template_dir + '_head.rhtml'
+ footer_file = @template_dir + '_footer.rhtml'
+
+ <<-TEMPLATE
+<!DOCTYPE html>
+
+<html>
+<head>
+#{head_file.read}
+
+#{body}
+
+#{footer_file.read}
+ TEMPLATE
+ end
+
+ ##
+ # Renders the ERb contained in +file_name+ relative to the template
+ # directory and returns the result based on the current context.
+
+ def render file_name
+ template_file = @template_dir + file_name
+
+ template = template_for template_file, false, RDoc::ERBPartial
+
+ template.filename = template_file.to_s
+
+ template.result @context
+ end
+
+ ##
# Load and render the erb template in the given +template_file+ and write
# it out to +out_file+.
#
@@ -332,28 +685,33 @@ class RDoc::Generator::Darkfish
#
# An io will be yielded which must be captured by binding in the caller.
- def render_template template_file, out_file # :yield: io
- template = template_for template_file
+ def render_template template_file, out_file = nil # :yield: io
+ io_output = out_file && !@dry_run && @file_output
+ erb_klass = io_output ? RDoc::ERBIO : ERB
- unless @options.dry_run then
+ template = template_for template_file, true, erb_klass
+
+ if io_output then
debug_msg "Outputting to %s" % [out_file.expand_path]
out_file.dirname.mkpath
out_file.open 'w', 0644 do |io|
io.set_encoding @options.encoding if Object.const_defined? :Encoding
- context = yield io
+ @context = yield io
- template_result template, context, template_file
+ template_result template, @context, template_file
end
else
- context = yield nil
+ @context = yield nil
- output = template_result template, context, template_file
+ output = template_result template, @context, template_file
debug_msg " would have written %d characters to %s" % [
output.length, out_file.expand_path
- ]
+ ] if @dry_run
+
+ output
end
end
@@ -374,14 +732,25 @@ class RDoc::Generator::Darkfish
##
# Retrieves a cache template for +file+, if present, or fills the cache.
- def template_for file
+ def template_for file, page = true, klass = ERB
template = @template_cache[file]
return template if template
- klass = @options.dry_run ? ERB : RDoc::ERBIO
+ if page then
+ template = assemble_template file
+ erbout = 'io'
+ else
+ template = file.read
+ template = template.encode @options.encoding if
+ Object.const_defined? :Encoding
+
+ file_var = File.basename(file).sub(/\..*/, '')
+
+ erbout = "_erbout_#{file_var}"
+ end
- template = klass.new file.read, nil, '<>'
+ template = klass.new template, nil, '<>', erbout
@template_cache[file] = template
template
end
diff --git a/lib/rdoc/generator/json_index.rb b/lib/rdoc/generator/json_index.rb
new file mode 100644
index 0000000000..c303b2effb
--- /dev/null
+++ b/lib/rdoc/generator/json_index.rb
@@ -0,0 +1,248 @@
+require 'json'
+
+##
+# The JsonIndex generator is designed to complement an HTML generator and
+# produces a JSON search index. This generator is derived from sdoc by
+# Vladimir Kolesnikov and contains verbatim code written by him.
+#
+# This generator is designed to be used with a regular HTML generator:
+#
+# class RDoc::Generator::Darkfish
+# def initialize options
+# # ...
+# @base_dir = Pathname.pwd.expand_path
+#
+# @json_index = RDoc::Generator::JsonIndex.new self, options
+# end
+#
+# def generate
+# # ...
+# @json_index.generate
+# end
+# end
+#
+# == Index Format
+#
+# The index is output as a JSON file assigned to the global variable
+# +search_data+. The structure is:
+#
+# var search_data = {
+# "index": {
+# "searchIndex":
+# ["a", "b", ...],
+# "longSearchIndex":
+# ["a", "a::b", ...],
+# "info": [
+# ["A", "A", "A.html", "", ""],
+# ["B", "A::B", "A::B.html", "", ""],
+# ...
+# ]
+# }
+# }
+#
+# The same item is described across the +searchIndex+, +longSearchIndex+ and
+# +info+ fields. The +searchIndex+ field contains the item's short name, the
+# +longSearchIndex+ field contains the full_name (when appropriate) and the
+# +info+ field contains the item's name, full_name, path, parameters and a
+# snippet of the item's comment.
+#
+# == LICENSE
+#
+# Copyright (c) 2009 Vladimir Kolesnikov
+#
+# 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.
+
+class RDoc::Generator::JsonIndex
+
+ include RDoc::Text
+
+ ##
+ # Where the search index lives in the generated output
+
+ SEARCH_INDEX_FILE = File.join 'js', 'search_index.js'
+
+ attr_reader :index # :nodoc:
+
+ ##
+ # Creates a new generator. +parent_generator+ is used to determine the
+ # class_dir and file_dir of links in the output index.
+ #
+ # +options+ are the same options passed to the parent generator.
+
+ def initialize parent_generator, options
+ @parent_generator = parent_generator
+ @store = parent_generator.store
+ @options = options
+
+ @template_dir = File.expand_path '../template/json_index', __FILE__
+ @base_dir = @parent_generator.base_dir
+
+ @classes = nil
+ @files = nil
+ @index = nil
+ end
+
+ ##
+ # Builds the JSON index as a Hash.
+
+ def build_index
+ reset @store.all_files.sort, @store.all_classes_and_modules.sort
+
+ index_classes
+ index_methods
+ index_pages
+
+ { :index => @index }
+ end
+
+ ##
+ # Output progress information if debugging is enabled
+
+ def debug_msg *msg
+ return unless $DEBUG_RDOC
+ $stderr.puts(*msg)
+ end
+
+ ##
+ # Writes the JSON index to disk
+
+ def generate
+ debug_msg "Generating JSON index"
+
+ debug_msg " writing search index to %s" % SEARCH_INDEX_FILE
+ data = build_index
+
+ return if @options.dry_run
+
+ out_dir = @base_dir + @options.op_dir
+ index_file = out_dir + SEARCH_INDEX_FILE
+
+ FileUtils.mkdir_p index_file.dirname, :verbose => $DEBUG_RDOC
+
+ index_file.open 'w', 0644 do |io|
+ io.set_encoding Encoding::UTF_8 if Object.const_defined? :Encoding
+ io.write 'var search_data = '
+
+ JSON.dump data, io, 0
+ end
+
+ Dir.chdir @template_dir do
+ Dir['**/*.js'].each do |source|
+ dest = File.join out_dir, source
+
+ FileUtils.install source, dest, :mode => 0644, :verbose => $DEBUG_RDOC
+ end
+ end
+ end
+
+ ##
+ # Adds classes and modules to the index
+
+ def index_classes
+ debug_msg " generating class search index"
+
+ documented = @classes.uniq.select do |klass|
+ klass.document_self_or_methods
+ end
+
+ documented.each do |klass|
+ debug_msg " #{klass.full_name}"
+ record = klass.search_record
+ @index[:searchIndex] << search_string(record.shift)
+ @index[:longSearchIndex] << search_string(record.shift)
+ @index[:info] << record
+ end
+ end
+
+ ##
+ # Adds methods to the index
+
+ def index_methods
+ debug_msg " generating method search index"
+
+ list = @classes.uniq.map do |klass|
+ klass.method_list
+ end.flatten.sort_by do |method|
+ [method.name, method.parent.full_name]
+ end
+
+ list.each do |method|
+ debug_msg " #{method.full_name}"
+ record = method.search_record
+ @index[:searchIndex] << "#{search_string record.shift}()"
+ @index[:longSearchIndex] << "#{search_string record.shift}()"
+ @index[:info] << record
+ end
+ end
+
+ ##
+ # Adds pages to the index
+
+ def index_pages
+ debug_msg " generating pages search index"
+
+ pages = @files.select do |file|
+ file.text?
+ end
+
+ pages.each do |page|
+ debug_msg " #{page.page_name}"
+ record = page.search_record
+ @index[:searchIndex] << search_string(record.shift)
+ @index[:longSearchIndex] << ''
+ record.shift
+ @index[:info] << record
+ end
+ end
+
+ ##
+ # The directory classes are written to
+
+ def class_dir
+ @parent_generator.class_dir
+ end
+
+ ##
+ # The directory files are written to
+
+ def file_dir
+ @parent_generator.file_dir
+ end
+
+ def reset files, classes # :nodoc:
+ @files = files
+ @classes = classes
+
+ @index = {
+ :searchIndex => [],
+ :longSearchIndex => [],
+ :info => []
+ }
+ end
+
+ ##
+ # Removes whitespace and downcases +string+
+
+ def search_string string
+ string.downcase.gsub(/\s/, '')
+ end
+
+end
+
diff --git a/lib/rdoc/generator/markup.rb b/lib/rdoc/generator/markup.rb
index c267bb1c13..788e5a485d 100644
--- a/lib/rdoc/generator/markup.rb
+++ b/lib/rdoc/generator/markup.rb
@@ -1,14 +1,8 @@
-# This file is loaded by generators. It allows RDoc's CodeObject tree to
-# avoid loading generator code to increase startup time (for ri).
-
-require 'rdoc/text'
-require 'rdoc/code_objects'
-require 'rdoc/generator'
-require 'rdoc/markup/to_html_crossref'
-require 'rdoc/ruby_token'
-
##
# Handle common RDoc::Markup tasks for various CodeObjects
+#
+# This module is loaded by generators. It allows RDoc's CodeObject tree to
+# avoid loading generator code to improve startup time for +ri+.
module RDoc::Generator::Markup
@@ -39,18 +33,18 @@ module RDoc::Generator::Markup
def formatter
return @formatter if defined? @formatter
- show_hash = RDoc::RDoc.current.options.show_hash
- hyperlink_all = RDoc::RDoc.current.options.hyperlink_all
+ options = @store.rdoc.options
this = RDoc::Context === self ? self : @parent
- @formatter = RDoc::Markup::ToHtmlCrossref.new(this.path, this, show_hash,
- hyperlink_all)
+ @formatter = RDoc::Markup::ToHtmlCrossref.new options, this.path, this
+ @formatter.code_object = self
+ @formatter
end
##
# Build a webcvs URL starting for the given +url+ with +full_path+ appended
# as the destination path. If +url+ contains '%s' +full_path+ will be
- # sprintf'd into +url+ instead.
+ # will replace the %s using sprintf on the +url+.
def cvs_url(url, full_path)
if /%s/ =~ url then
@@ -62,10 +56,14 @@ module RDoc::Generator::Markup
end
-class RDoc::AnyMethod
+class RDoc::CodeObject
include RDoc::Generator::Markup
+end
+
+class RDoc::MethodAttr
+
@add_line_numbers = false
class << self
@@ -82,7 +80,8 @@ class RDoc::AnyMethod
#
# # File xxxxx, line dddd
#
- # If it has, line numbers are added an ', line dddd' is removed.
+ # If it has this comment then line numbers are added to +src+ and the <tt>,
+ # line dddd</tt> portion of the comment is removed.
def add_line_numbers(src)
return unless src.sub!(/\A(.*)(, line (\d+))/, '\1')
@@ -111,32 +110,7 @@ class RDoc::AnyMethod
def markup_code
return '' unless @token_stream
- src = ""
-
- @token_stream.each do |t|
- next unless t
-
- style = case t
- when RDoc::RubyToken::TkCONSTANT then 'ruby-constant'
- when RDoc::RubyToken::TkKW then 'ruby-keyword'
- when RDoc::RubyToken::TkIVAR then 'ruby-ivar'
- when RDoc::RubyToken::TkOp then 'ruby-operator'
- when RDoc::RubyToken::TkId then 'ruby-identifier'
- when RDoc::RubyToken::TkNode then 'ruby-node'
- when RDoc::RubyToken::TkCOMMENT then 'ruby-comment'
- when RDoc::RubyToken::TkREGEXP then 'ruby-regexp'
- when RDoc::RubyToken::TkSTRING then 'ruby-string'
- when RDoc::RubyToken::TkVal then 'ruby-value'
- end
-
- text = CGI.escapeHTML t.text
-
- if style then
- src << "<span class=\"#{style}\">#{text}</span>"
- else
- src << text
- end
- end
+ src = RDoc::TokenStream.to_html @token_stream
# dedent the source
indent = src.length
@@ -151,34 +125,21 @@ class RDoc::AnyMethod
end
src.gsub!(/^#{' ' * indent}/, '') if indent > 0
- add_line_numbers(src) if self.class.add_line_numbers
+ add_line_numbers(src) if RDoc::MethodAttr.add_line_numbers
src
end
end
-class RDoc::Attr
+class RDoc::ClassModule
- include RDoc::Generator::Markup
-
-end
-
-class RDoc::Alias
-
- include RDoc::Generator::Markup
-
-end
-
-class RDoc::Constant
-
- include RDoc::Generator::Markup
-
-end
-
-class RDoc::Context
+ ##
+ # Handy wrapper for marking up this class or module's comment
- include RDoc::Generator::Markup
+ def description
+ markup @comment_location
+ end
end
@@ -195,12 +156,12 @@ class RDoc::TopLevel
# command line option to set.
def cvs_url
- url = RDoc::RDoc.current.options.webcvs
+ url = @store.rdoc.options.webcvs
if /%s/ =~ url then
- url % @absolute_name
+ url % @relative_name
else
- url + @absolute_name
+ url + @relative_name
end
end
diff --git a/lib/rdoc/generator/ri.rb b/lib/rdoc/generator/ri.rb
index 939a165cfb..b9c4141a5e 100644
--- a/lib/rdoc/generator/ri.rb
+++ b/lib/rdoc/generator/ri.rb
@@ -1,6 +1,3 @@
-require 'rdoc/generator'
-require 'rdoc/ri'
-
##
# Generates ri data files
@@ -16,70 +13,17 @@ class RDoc::Generator::RI
##
# Set up a new ri generator
- def initialize options #:not-new:
- @options = options
- @old_siginfo = nil
- @current = nil
-
- @store = RDoc::RI::Store.new '.'
- @store.dry_run = @options.dry_run
- @store.encoding = @options.encoding if @options.respond_to? :encoding
- end
-
- ##
- # Build the initial indices and output objects based on an array of TopLevel
- # objects containing the extracted information.
-
- def generate top_levels
- install_siginfo_handler
-
- @store.load_cache
-
- RDoc::TopLevel.all_classes_and_modules.each do |klass|
- @current = "#{klass.class}: #{klass.full_name}"
-
- @store.save_class klass
-
- klass.each_method do |method|
- @current = "#{method.class}: #{method.full_name}"
- @store.save_method klass, method
- end
-
- klass.each_attribute do |attribute|
- @store.save_method klass, attribute
- end
- end
-
- @current = 'saving cache'
-
- @store.save_cache
-
- ensure
- @current = nil
-
- remove_siginfo_handler
+ def initialize store, options #:not-new:
+ @options = options
+ @store = store
+ @store.path = '.'
end
##
- # Installs a siginfo handler that prints the current filename.
-
- def install_siginfo_handler
- return unless Signal.list.key? 'INFO'
-
- @old_siginfo = trap 'INFO' do
- puts @current if @current
- end
- end
-
- ##
- # Removes a siginfo handler and replaces the previous
-
- def remove_siginfo_handler
- return unless Signal.list.key? 'INFO'
-
- handler = @old_siginfo || 'DEFAULT'
+ # Writes the parsed data store to disk for use by ri.
- trap 'INFO', handler
+ def generate
+ @store.save
end
end
diff --git a/lib/rdoc/generator/template/darkfish/_footer.rhtml b/lib/rdoc/generator/template/darkfish/_footer.rhtml
new file mode 100644
index 0000000000..3d9526f02a
--- /dev/null
+++ b/lib/rdoc/generator/template/darkfish/_footer.rhtml
@@ -0,0 +1,5 @@
+<footer id="validator-badges" role="contentinfo">
+ <p><a href="http://validator.w3.org/check/referer">Validate</a>
+ <p>Generated by <a href="http://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
new file mode 100644
index 0000000000..062160a751
--- /dev/null
+++ b/lib/rdoc/generator/template/darkfish/_head.rhtml
@@ -0,0 +1,22 @@
+<meta charset="<%= @options.charset %>">
+
+<title><%= h @title %></title>
+
+<link href="<%= asset_rel_prefix %>/fonts.css" rel="stylesheet">
+<link href="<%= asset_rel_prefix %>/rdoc.css" rel="stylesheet">
+<% if @options.template_stylesheets.flatten.any? then %>
+<% @options.template_stylesheets.flatten.each do |stylesheet| %>
+<link href="<%= asset_rel_prefix %>/<%= File.basename stylesheet %>" rel="stylesheet">
+<% end %>
+<% end %>
+
+<script type="text/javascript">
+ var rdoc_rel_prefix = "<%= rel_prefix %>/";
+</script>
+
+<script src="<%= asset_rel_prefix %>/js/jquery.js"></script>
+<script src="<%= asset_rel_prefix %>/js/navigation.js"></script>
+<script src="<%= search_index_rel_prefix %>/js/search_index.js"></script>
+<script src="<%= asset_rel_prefix %>/js/search.js"></script>
+<script src="<%= asset_rel_prefix %>/js/searcher.js"></script>
+<script src="<%= asset_rel_prefix %>/js/darkfish.js"></script>
diff --git a/lib/rdoc/generator/template/darkfish/_sidebar_VCS_info.rhtml b/lib/rdoc/generator/template/darkfish/_sidebar_VCS_info.rhtml
new file mode 100644
index 0000000000..e889f8063d
--- /dev/null
+++ b/lib/rdoc/generator/template/darkfish/_sidebar_VCS_info.rhtml
@@ -0,0 +1,19 @@
+<% if !svninfo.empty? then %>
+<div id="file-svninfo-section" class="nav-section">
+ <h3>VCS Info</h3>
+
+ <div class="section-body">
+ <dl class="svninfo">
+ <dt>Rev
+ <dd><%= svninfo[:rev] %>
+
+ <dt>Last Checked In
+ <dd><%= svninfo[:commitdate].strftime('%Y-%m-%d %H:%M:%S') %>
+ (<%= svninfo[:commitdelta] %> ago)
+
+ <dt>Checked in by
+ <dd><%= svninfo[:committer] %>
+ </dl>
+ </div>
+</div>
+<% end %>
diff --git a/lib/rdoc/generator/template/darkfish/_sidebar_classes.rhtml b/lib/rdoc/generator/template/darkfish/_sidebar_classes.rhtml
new file mode 100644
index 0000000000..fe54d8339f
--- /dev/null
+++ b/lib/rdoc/generator/template/darkfish/_sidebar_classes.rhtml
@@ -0,0 +1,9 @@
+<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>
+</div>
diff --git a/lib/rdoc/generator/template/darkfish/_sidebar_extends.rhtml b/lib/rdoc/generator/template/darkfish/_sidebar_extends.rhtml
new file mode 100644
index 0000000000..2bd8efee99
--- /dev/null
+++ b/lib/rdoc/generator/template/darkfish/_sidebar_extends.rhtml
@@ -0,0 +1,15 @@
+<% unless klass.extends.empty? then %>
+<div id="extends-section" class="nav-section">
+ <h3>Extended With Modules</h3>
+
+ <ul class="link-list">
+ <% klass.each_extend do |ext| %>
+ <% unless String === ext.module then %>
+ <li><a class="extend" href="<%= klass.aref_to ext.module.path %>"><%= ext.module.full_name %></a>
+ <% else %>
+ <li><span class="extend"><%= ext.name %></span>
+ <% end %>
+ <% end %>
+ </ul>
+</div>
+<% end %>
diff --git a/lib/rdoc/generator/template/darkfish/_sidebar_in_files.rhtml b/lib/rdoc/generator/template/darkfish/_sidebar_in_files.rhtml
new file mode 100644
index 0000000000..0ba1d2be80
--- /dev/null
+++ b/lib/rdoc/generator/template/darkfish/_sidebar_in_files.rhtml
@@ -0,0 +1,9 @@
+<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>
+</div>
diff --git a/lib/rdoc/generator/template/darkfish/_sidebar_includes.rhtml b/lib/rdoc/generator/template/darkfish/_sidebar_includes.rhtml
new file mode 100644
index 0000000000..d141098ecd
--- /dev/null
+++ b/lib/rdoc/generator/template/darkfish/_sidebar_includes.rhtml
@@ -0,0 +1,15 @@
+<% unless klass.includes.empty? then %>
+<div id="includes-section" class="nav-section">
+ <h3>Included Modules</h3>
+
+ <ul class="link-list">
+ <% klass.each_include do |inc| %>
+ <% unless String === inc.module then %>
+ <li><a class="include" href="<%= klass.aref_to inc.module.path %>"><%= inc.module.full_name %></a>
+ <% else %>
+ <li><span class="include"><%= inc.name %></span>
+ <% end %>
+ <% end %>
+ </ul>
+</div>
+<% end %>
diff --git a/lib/rdoc/generator/template/darkfish/_sidebar_installed.rhtml b/lib/rdoc/generator/template/darkfish/_sidebar_installed.rhtml
new file mode 100644
index 0000000000..1285bfd732
--- /dev/null
+++ b/lib/rdoc/generator/template/darkfish/_sidebar_installed.rhtml
@@ -0,0 +1,15 @@
+<div id="home-section" class="nav-section">
+ <h3>Documentation</h3>
+
+ <ul>
+ <% installed.each do |name, href, exists, type, _| %>
+ <% next if type == :extra %>
+ <li class="folder">
+ <% if exists then %>
+ <a href="<%= href %>"><%= h name %></a>
+ <% else %>
+ <%= h name %>
+ <% end %>
+ <% end %>
+ </ul>
+</div>
diff --git a/lib/rdoc/generator/template/darkfish/_sidebar_methods.rhtml b/lib/rdoc/generator/template/darkfish/_sidebar_methods.rhtml
new file mode 100644
index 0000000000..45df08d8fe
--- /dev/null
+++ b/lib/rdoc/generator/template/darkfish/_sidebar_methods.rhtml
@@ -0,0 +1,12 @@
+<% unless klass.method_list.empty? then %>
+<!-- Method Quickref -->
+<div id="method-list-section" class="nav-section">
+ <h3>Methods</h3>
+
+ <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>
+</div>
+<% end %>
diff --git a/lib/rdoc/generator/template/darkfish/_sidebar_navigation.rhtml b/lib/rdoc/generator/template/darkfish/_sidebar_navigation.rhtml
new file mode 100644
index 0000000000..d7f330840a
--- /dev/null
+++ b/lib/rdoc/generator/template/darkfish/_sidebar_navigation.rhtml
@@ -0,0 +1,11 @@
+<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>
+ </div>
+</div>
diff --git a/lib/rdoc/generator/template/darkfish/_sidebar_pages.rhtml b/lib/rdoc/generator/template/darkfish/_sidebar_pages.rhtml
new file mode 100644
index 0000000000..5f39825f08
--- /dev/null
+++ b/lib/rdoc/generator/template/darkfish/_sidebar_pages.rhtml
@@ -0,0 +1,12 @@
+<% simple_files = @files.select { |f| f.text? } %>
+<% unless simple_files.empty? then %>
+<div id="fileindex-section" class="nav-section">
+ <h3>Pages</h3>
+
+ <ul class="link-list">
+ <% simple_files.each do |f| %>
+ <li><a href="<%= rel_prefix %>/<%= f.path %>"><%= h f.page_name %></a>
+ <% end %>
+ </ul>
+</div>
+<% end %>
diff --git a/lib/rdoc/generator/template/darkfish/_sidebar_parent.rhtml b/lib/rdoc/generator/template/darkfish/_sidebar_parent.rhtml
new file mode 100644
index 0000000000..cc04852652
--- /dev/null
+++ b/lib/rdoc/generator/template/darkfish/_sidebar_parent.rhtml
@@ -0,0 +1,11 @@
+<% if klass.type == 'class' then %>
+<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 %>
+</div>
+<% end %>
diff --git a/lib/rdoc/generator/template/darkfish/_sidebar_search.rhtml b/lib/rdoc/generator/template/darkfish/_sidebar_search.rhtml
new file mode 100644
index 0000000000..4c1e1f7cc3
--- /dev/null
+++ b/lib/rdoc/generator/template/darkfish/_sidebar_search.rhtml
@@ -0,0 +1,15 @@
+<div id="search-section" role="search" class="project-section initially-hidden">
+ <form action="#" method="get" accept-charset="utf-8">
+ <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"
+ title="Type to search, Up and Down to navigate, Enter to load">
+ </div>
+
+ <ul id="search-results" aria-label="Search Results"
+ aria-busy="false" aria-expanded="false"
+ aria-atomic="false" aria-live="polite"
+ aria-relevant="all" 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
new file mode 100644
index 0000000000..15ff78ba91
--- /dev/null
+++ b/lib/rdoc/generator/template/darkfish/_sidebar_sections.rhtml
@@ -0,0 +1,11 @@
+<% unless klass.sections.length == 1 then %>
+<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>
+</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
new file mode 100644
index 0000000000..b58e6b3c61
--- /dev/null
+++ b/lib/rdoc/generator/template/darkfish/_sidebar_table_of_contents.rhtml
@@ -0,0 +1,18 @@
+<% comment = if current.respond_to? :comment_location then
+ current.comment_location
+ else
+ current.comment
+ end
+ table = current.parse(comment).table_of_contents
+
+ if table.length > 1 then %>
+<div class="nav-section">
+ <h3>Table of Contents</h3>
+
+ <ul class="link-list" role="directory">
+<% table.each do |heading| %>
+ <li><a href="#<%= heading.label current %>"><%= heading.plain_html %></a>
+<% end %>
+ </ul>
+</div>
+<% end %>
diff --git a/lib/rdoc/generator/template/darkfish/class.rhtml b/lib/rdoc/generator/template/darkfish/class.rhtml
new file mode 100644
index 0000000000..b497000112
--- /dev/null
+++ b/lib/rdoc/generator/template/darkfish/class.rhtml
@@ -0,0 +1,174 @@
+<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="class-metadata">
+ <%= render '_sidebar_sections.rhtml' %>
+ <%= render '_sidebar_parent.rhtml' %>
+ <%= render '_sidebar_includes.rhtml' %>
+ <%= render '_sidebar_extends.rhtml' %>
+ <%= render '_sidebar_methods.rhtml' %>
+ </div>
+</nav>
+
+<main role="main" aria-labelledby="<%=h klass.aref %>">
+ <h1 id="<%=h klass.aref %>" class="<%= klass.type %>">
+ <%= klass.type %> <%= klass.full_name %>
+ </h1>
+
+ <section class="description">
+ <%= klass.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 %>
+ <header class="documentation-section-title">
+ <h2>
+ <%= section.title %>
+ </h2>
+ <span class="section-click-top">
+ <a href="#top">&uarr; top</a>
+ </span>
+ </header>
+ <% end %>
+
+ <% if section.comment then %>
+ <div>
+ <%= section.description %>
+ </div>
+ <% end %>
+
+ <% unless constants.empty? then %>
+ <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><%= const.description.strip %>
+ <% else %>
+ <dd class="missing-docs">(Not documented)
+ <% end %>
+ <% end %>
+ </dl>
+ </section>
+ <% end %>
+
+ <% unless attributes.empty? then %>
+ <section class="attribute-method-details" class="method-section">
+ <header>
+ <h3>Attributes</h3>
+ </header>
+
+ <% attributes.each do |attrib| %>
+ <div id="<%= attrib.aref %>" class="method-detail">
+ <div class="method-heading attribute-method-heading">
+ <span class="method-name"><%= h attrib.name %></span><span
+ class="attribute-access-type">[<%= attrib.rw %>]</span>
+ </div>
+
+ <div class="method-description">
+ <% if attrib.comment then %>
+ <%= attrib.description.strip %>
+ <% else %>
+ <p class="missing-docs">(Not documented)
+ <% end %>
+ </div>
+ </div>
+ <% end %>
+ </section>
+ <% end %>
+
+ <% 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">
+ <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" : '' %>">
+ <% if method.call_seq then %>
+ <% method.call_seq.strip.split("\n").each_with_index do |call_seq, i| %>
+ <div class="method-heading">
+ <span class="method-callseq">
+ <%= h(call_seq.strip.
+ gsub( /^\w+\./m, '')).
+ gsub(/(.*)[-=]&gt;/, '\1&rarr;') %>
+ </span>
+ <% if i == 0 and method.token_stream then %>
+ <span class="method-click-advice">click to toggle source</span>
+ <% end %>
+ </div>
+ <% end %>
+ <% else %>
+ <div class="method-heading">
+ <span class="method-name"><%= h method.name %></span><span
+ class="method-args"><%= method.param_seq %></span>
+ <% if method.token_stream then %>
+ <span class="method-click-advice">click to toggle source</span>
+ <% end %>
+ </div>
+ <% end %>
+
+ <div class="method-description">
+ <% if method.comment then %>
+ <%= method.description.strip %>
+ <% else %>
+ <p class="missing-docs">(Not documented)
+ <% end %>
+ <% if method.calls_super then %>
+ <div class="method-calls-super">
+ Calls superclass method
+ <%=
+ method.superclass_method ?
+ method.formatter.link(method.superclass_method.full_name, method.superclass_method.full_name) : nil
+ %>
+ </div>
+ <% end %>
+
+ <% if method.token_stream then %>
+ <div class="method-source-code" id="<%= method.html_name %>-source">
+ <pre><%= method.markup_code %></pre>
+ </div>
+ <% end %>
+ </div>
+
+ <% unless method.aliases.empty? then %>
+ <div class="aliases">
+ Also aliased as: <%= method.aliases.map do |aka|
+ if aka.parent then # HACK lib/rexml/encodings
+ %{<a href="#{klass.aref_to aka.path}">#{h aka.name}</a>}
+ else
+ h aka.name
+ end
+ end.join ", " %>
+ </div>
+ <% end %>
+
+ <% if method.is_alias_for then %>
+ <div class="aliases">
+ Alias for: <a href="<%= klass.aref_to method.is_alias_for.path %>"><%= h method.is_alias_for.name %></a>
+ </div>
+ <% end %>
+ </div>
+
+ <% end %>
+ </section>
+ <% end
+ end %>
+ </section>
+<% end %>
+</main>
diff --git a/lib/rdoc/generator/template/darkfish/classpage.rhtml b/lib/rdoc/generator/template/darkfish/classpage.rhtml
deleted file mode 100644
index 9c74cacf0f..0000000000
--- a/lib/rdoc/generator/template/darkfish/classpage.rhtml
+++ /dev/null
@@ -1,321 +0,0 @@
-<?xml version="1.0" encoding="<%= @options.charset %>"?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
- <meta content="text/html; charset=<%= @options.charset %>" http-equiv="Content-Type" />
-
- <title><%= klass.type.capitalize %>: <%= klass.full_name %></title>
-
- <link rel="stylesheet" href="<%= rel_prefix %>/rdoc.css" type="text/css" media="screen" />
-
- <script src="<%= rel_prefix %>/js/jquery.js" type="text/javascript" charset="utf-8"></script>
- <script src="<%= rel_prefix %>/js/thickbox-compressed.js" type="text/javascript" charset="utf-8"></script>
- <script src="<%= rel_prefix %>/js/quicksearch.js" type="text/javascript" charset="utf-8"></script>
- <script src="<%= rel_prefix %>/js/darkfish.js" type="text/javascript" charset="utf-8"></script>
-
-</head>
-<body id="top" class="<%= klass.type %>">
-
- <div id="metadata">
- <div id="home-metadata">
- <div id="home-section" class="section">
- <h3 class="section-header">
- <a href="<%= rel_prefix %>/index.html">Home</a>
- <a href="<%= rel_prefix %>/index.html#classes">Classes</a>
- <a href="<%= rel_prefix %>/index.html#methods">Methods</a>
- </h3>
- </div>
- </div>
-
- <div id="file-metadata">
- <div id="file-list-section" class="section">
- <h3 class="section-header">In Files</h3>
- <div class="section-body">
- <ul>
- <% klass.in_files.each do |tl| %>
- <li><a href="<%= rel_prefix %>/<%= h tl.path %>?TB_iframe=true&amp;height=550&amp;width=785"
- class="thickbox" title="<%= h tl.absolute_name %>"><%= h tl.absolute_name %></a></li>
- <% end %>
- </ul>
- </div>
- </div>
-
- <% if !svninfo.empty? then %>
- <div id="file-svninfo-section" class="section">
- <h3 class="section-header">Subversion Info</h3>
- <div class="section-body">
- <dl class="svninfo">
- <dt>Rev</dt>
- <dd><%= svninfo[:rev] %></dd>
-
- <dt>Last Checked In</dt>
- <dd><%= svninfo[:commitdate].strftime('%Y-%m-%d %H:%M:%S') %>
- (<%= svninfo[:commitdelta] %> ago)</dd>
-
- <dt>Checked in by</dt>
- <dd><%= svninfo[:committer] %></dd>
- </dl>
- </div>
- </div>
- <% end %>
- </div>
-
- <div id="class-metadata">
- <% if klass.type == 'class' then %>
- <!-- Parent Class -->
- <div id="parent-class-section" class="section">
- <h3 class="section-header">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></p>
- <% else %>
- <p class="link"><%= klass.superclass %></p>
- <% end %>
- </div>
- <% end %>
-
- <% unless klass.sections.length == 1 then %>
- <!-- Sections -->
- <div id="sections-section" class="section">
- <h3 class="section-header">Sections</h3>
- <ul class="link-list">
- <% klass.sections.sort_by { |s| s.title.to_s }.each do |section| %>
- <li><a href="#<%= section.aref %>"><%= h section.title %></a></li>
- <% end %>
- </ul>
- </div>
- <% end %>
-
- <% unless klass.classes_and_modules.empty? then %>
- <!-- Namespace Contents -->
- <div id="namespace-list-section" class="section">
- <h3 class="section-header">Namespace</h3>
- <ul class="link-list">
- <% (klass.modules.sort + klass.classes.sort).each do |mod| %>
- <li><span class="type"><%= mod.type.upcase %></span> <a href="<%= klass.aref_to mod.path %>"><%= mod.full_name %></a></li>
- <% end %>
- </ul>
- </div>
- <% end %>
-
- <% unless klass.method_list.empty? then %>
- <!-- Method Quickref -->
- <div id="method-list-section" class="section">
- <h3 class="section-header">Methods</h3>
- <ul class="link-list">
- <% klass.each_method do |meth| %>
- <li><a href="#<%= meth.aref %>"><%= meth.singleton ? '::' : '#' %><%= meth.name %></a></li>
- <% end %>
- </ul>
- </div>
- <% end %>
-
- <% unless klass.includes.empty? then %>
- <!-- Included Modules -->
- <div id="includes-section" class="section">
- <h3 class="section-header">Included Modules</h3>
- <ul class="link-list">
- <% klass.each_include do |inc| %>
- <% unless String === inc.module then %>
- <li><a class="include" href="<%= klass.aref_to inc.module.path %>"><%= inc.module.full_name %></a></li>
- <% else %>
- <li><span class="include"><%= inc.name %></span></li>
- <% end %>
- <% end %>
- </ul>
- </div>
- <% end %>
- </div>
-
- <div id="project-metadata">
- <% simple_files = @files.select {|tl| tl.parser == RDoc::Parser::Simple } %>
- <% unless simple_files.empty? then %>
- <div id="fileindex-section" class="section project-section">
- <h3 class="section-header">Files</h3>
- <ul>
- <% simple_files.each do |file| %>
- <li class="file"><a href="<%= rel_prefix %>/<%= file.path %>"><%= h file.base_name %></a></li>
- <% end %>
- </ul>
- </div>
- <% end %>
-
- <div id="classindex-section" class="section project-section">
- <h3 class="section-header">Class/Module Index
- <span class="search-toggle"><img src="<%= rel_prefix %>/images/find.png"
- height="16" width="16" alt="[+]"
- title="show/hide quicksearch" /></span></h3>
- <form action="#" method="get" accept-charset="utf-8" class="initially-hidden">
- <fieldset>
- <legend>Quicksearch</legend>
- <input type="text" name="quicksearch" value=""
- class="quicksearch-field" />
- </fieldset>
- </form>
-
- <ul class="link-list">
- <% @modsort.each do |index_klass| %>
- <li><a href="<%= rel_prefix %>/<%= index_klass.path %>"><%= index_klass.full_name %></a></li>
- <% end %>
- </ul>
- <div id="no-class-search-results" style="display: none;">No matching classes.</div>
- </div>
-
- <% if $DEBUG_RDOC then %>
- <div id="debugging-toggle"><img src="<%= rel_prefix %>/images/bug.png"
- alt="toggle debugging" height="16" width="16" /></div>
- <% end %>
- </div>
- </div>
-
- <div id="documentation">
- <h1 class="<%= klass.type %>"><%= klass.full_name %></h1>
-
- <div id="description" class="description">
- <%= klass.description %>
- </div><!-- description -->
-
- <% klass.each_section do |section, constants, attributes| %>
- <% constants = constants.select { |const| const.display? } %>
- <% attributes = attributes.select { |attr| attr.display? } %>
- <div id="<%= section.aref %>" class="documentation-section">
- <% if section.title then %>
- <h2 class="section-header">
- <%= section.title %>
- <a href="#top">&uarr; top</a>
- </h2>
- <% end %>
-
- <% if section.comment then %>
- <div class="description">
- <%= section.description %>
- </div>
- <% end %>
-
- <% unless constants.empty? then %>
- <!-- Constants -->
- <div id="constants-list" class="section">
- <h3 class="section-header">Constants</h3>
- <dl>
- <% constants.each do |const| %>
- <dt><a name="<%= const.name %>"><%= const.name %></a></dt>
- <% if const.comment then %>
- <dd class="description"><%= const.description.strip %></dd>
- <% else %>
- <dd class="description missing-docs">(Not documented)</dd>
- <% end %>
- <% end %>
- </dl>
- </div>
- <% end %>
-
- <% unless attributes.empty? then %>
- <!-- Attributes -->
- <div id="attribute-method-details" class="method-section section">
- <h3 class="section-header">Attributes</h3>
-
- <% attributes.each do |attrib| %>
- <div id="<%= attrib.html_name %>-attribute-method" class="method-detail">
- <a name="<%= h attrib.name %>"></a>
- <% if attrib.rw =~ /w/i then %>
- <a name="<%= h attrib.name %>="></a>
- <% end %>
- <div class="method-heading attribute-method-heading">
- <span class="method-name"><%= h attrib.name %></span><span
- class="attribute-access-type">[<%= attrib.rw %>]</span>
- </div>
-
- <div class="method-description">
- <% if attrib.comment then %>
- <%= attrib.description.strip %>
- <% else %>
- <p class="missing-docs">(Not documented)</p>
- <% end %>
- </div>
- </div>
- <% end %>
- </div><!-- attribute-method-details -->
- <% end %>
-
- <!-- Methods -->
- <% klass.methods_by_type(section).each do |type, visibilities|
- next if visibilities.empty?
- visibilities.each do |visibility, methods|
- next if methods.empty? %>
- <div id="<%= visibility %>-<%= type %>-method-details" class="method-section section">
- <h3 class="section-header"><%= visibility.to_s.capitalize %> <%= type.capitalize %> Methods</h3>
-
- <% methods.each do |method| %>
- <div id="<%= method.html_name %>-method" class="method-detail <%= method.is_alias_for ? "method-alias" : '' %>">
- <a name="<%= h method.aref %>"></a>
-
- <% if method.call_seq then %>
- <% method.call_seq.strip.split("\n").each_with_index do |call_seq, i| %>
- <div class="method-heading">
- <span class="method-callseq"><%= call_seq.strip.gsub(/->/, '&rarr;').gsub( /^\w+\./m, '') %></span>
- <% if i == 0 then %>
- <span class="method-click-advice">click to toggle source</span>
- <% end %>
- </div>
- <% end %>
- <% else %>
- <div class="method-heading">
- <span class="method-name"><%= h method.name %></span><span
- class="method-args"><%= method.params %></span>
- <span class="method-click-advice">click to toggle source</span>
- </div>
- <% end %>
-
- <div class="method-description">
- <% if method.comment then %>
- <%= method.description.strip %>
- <% else %>
- <p class="missing-docs">(Not documented)</p>
- <% end %>
-
- <% 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 -->
- <% end %>
- </div>
-
- <% unless method.aliases.empty? then %>
- <div class="aliases">
- Also aliased as: <%= method.aliases.map do |aka|
- if aka.parent then # HACK lib/rexml/encodings
- %{<a href="#{klass.aref_to aka.path}">#{h aka.name}</a>}
- else
- h aka.name
- end
- end.join ", " %>
- </div>
- <% end %>
-
- <% if method.is_alias_for then %>
- <div class="aliases">
- 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 -->
-
- <% end %>
- </div><!-- <%= visibility %>-<%= type %>-method-details -->
- <% end
- end %>
- </div><!-- <%= section.aref %> -->
- <% end %>
-
- </div><!-- documentation -->
-
- <div id="validator-badges">
- <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
- <p><small>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish
- Rdoc Generator</a> <%= RDoc::Generator::Darkfish::VERSION %></small>.</p>
- </div>
-
-</body>
-</html>
-
diff --git a/lib/rdoc/generator/template/darkfish/filepage.rhtml b/lib/rdoc/generator/template/darkfish/filepage.rhtml
deleted file mode 100644
index b230a456a3..0000000000
--- a/lib/rdoc/generator/template/darkfish/filepage.rhtml
+++ /dev/null
@@ -1,124 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
- <meta content="text/html; charset=<%= @options.charset %>" http-equiv="Content-Type" />
-
- <title>File: <%= file.base_name %> [<%= @options.title %>]</title>
-
- <link type="text/css" media="screen" href="<%= rel_prefix %>/rdoc.css" rel="stylesheet" />
-
- <script src="<%= rel_prefix %>/js/jquery.js" type="text/javascript"
- charset="utf-8"></script>
- <script src="<%= rel_prefix %>/js/thickbox-compressed.js" type="text/javascript"
- charset="utf-8"></script>
- <script src="<%= rel_prefix %>/js/quicksearch.js" type="text/javascript"
- charset="utf-8"></script>
- <script src="<%= rel_prefix %>/js/darkfish.js" type="text/javascript"
- charset="utf-8"></script>
-</head>
-
-<% if file.parser == RDoc::Parser::Simple %>
-<body class="file">
- <div id="metadata">
- <div id="home-metadata">
- <div id="home-section" class="section">
- <h3 class="section-header">
- <a href="<%= rel_prefix %>/index.html">Home</a>
- <a href="<%= rel_prefix %>/index.html#classes">Classes</a>
- <a href="<%= rel_prefix %>/index.html#methods">Methods</a>
- </h3>
- </div>
- </div>
-
- <div id="project-metadata">
- <% simple_files = @files.select { |f| f.parser == RDoc::Parser::Simple } %>
- <% unless simple_files.empty? then %>
- <div id="fileindex-section" class="section project-section">
- <h3 class="section-header">Files</h3>
- <ul>
- <% simple_files.each do |f| %>
- <li class="file"><a href="<%= rel_prefix %>/<%= f.path %>"><%= h f.base_name %></a></li>
- <% end %>
- </ul>
- </div>
- <% end %>
-
- <div id="classindex-section" class="section project-section">
- <h3 class="section-header">Class Index
- <span class="search-toggle"><img src="<%= rel_prefix %>/images/find.png"
- height="16" width="16" alt="[+]"
- title="show/hide quicksearch" /></span></h3>
- <form action="#" method="get" accept-charset="utf-8" class="initially-hidden">
- <fieldset>
- <legend>Quicksearch</legend>
- <input type="text" name="quicksearch" value=""
- class="quicksearch-field" />
- </fieldset>
- </form>
-
- <ul class="link-list">
- <% @modsort.each do |index_klass| %>
- <li><a href="<%= rel_prefix %>/<%= index_klass.path %>"><%= index_klass.full_name %></a></li>
- <% end %>
- </ul>
- <div id="no-class-search-results" style="display: none;">No matching classes.</div>
- </div>
-
- <% if $DEBUG_RDOC %>
- <div id="debugging-toggle"><img src="<%= rel_prefix %>/images/bug.png"
- alt="toggle debugging" height="16" width="16" /></div>
- <% end %>
- </div>
- </div>
-
- <div id="documentation">
- <%= file.description %>
- </div>
-
- <div id="validator-badges">
- <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
- <p><small>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish
- Rdoc Generator</a> <%= RDoc::Generator::Darkfish::VERSION %></small>.</p>
- </div>
-</body>
-<% else %>
-<body class="file file-popup">
- <div id="metadata">
- <dl>
- <dt class="modified-date">Last Modified</dt>
- <dd class="modified-date"><%= file.last_modified %></dd>
-
- <% if file.requires %>
- <dt class="requires">Requires</dt>
- <dd class="requires">
- <ul>
- <% file.requires.each do |require| %>
- <li><%= require.name %></li>
- <% end %>
- </ul>
- </dd>
- <% end %>
-
- <% if @options.webcvs %>
- <dt class="scs-url">Trac URL</dt>
- <dd class="scs-url"><a target="_top"
- href="<%= file.cvs_url %>"><%= file.cvs_url %></a></dd>
- <% end %>
- </dl>
- </div>
-
- <div id="documentation">
- <% if file.comment %>
- <div class="description">
- <h2>Description</h2>
- <%= file.description %>
- </div>
- <% end %>
- </div>
-</body>
-<% end %>
-</html>
-
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
new file mode 100755
index 0000000000..6332fefea4
--- /dev/null
+++ 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
new file mode 100755
index 0000000000..1ebb193243
--- /dev/null
+++ 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
new file mode 100755
index 0000000000..08f249365a
--- /dev/null
+++ 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
new file mode 100755
index 0000000000..3f02b5f8f8
--- /dev/null
+++ b/lib/rdoc/generator/template/darkfish/images/tag_blue.png
Binary files differ
diff --git a/lib/rdoc/generator/template/darkfish/images/transparent.png b/lib/rdoc/generator/template/darkfish/images/transparent.png
new file mode 100644
index 0000000000..d665e179ef
--- /dev/null
+++ b/lib/rdoc/generator/template/darkfish/images/transparent.png
Binary files differ
diff --git a/lib/rdoc/generator/template/darkfish/index.rhtml b/lib/rdoc/generator/template/darkfish/index.rhtml
index 3198246f8a..7d1c74807b 100644
--- a/lib/rdoc/generator/template/darkfish/index.rhtml
+++ b/lib/rdoc/generator/template/darkfish/index.rhtml
@@ -1,64 +1,23 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
- "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
+<body id="top" role="document" class="file">
+<nav role="navigation">
+ <div id="project-navigation">
+ <%= render '_sidebar_navigation.rhtml' %>
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
-<head>
- <meta content="text/html; charset=<%= @options.charset %>" http-equiv="Content-Type" />
-
- <title><%= h @options.title %></title>
-
- <link type="text/css" media="screen" href="rdoc.css" rel="stylesheet" />
-
- <script src="js/jquery.js" type="text/javascript" charset="utf-8"></script>
- <script src="js/thickbox-compressed.js" type="text/javascript" charset="utf-8"></script>
- <script src="js/quicksearch.js" type="text/javascript" charset="utf-8"></script>
- <script src="js/darkfish.js" type="text/javascript" charset="utf-8"></script>
-
-</head>
-<body class="indexpage">
-
- <% $stderr.sync = true %>
- <h1><%= h @options.title %></h1>
-
- <% if @options.main_page && main_page = @files.find { |f| f.full_name == @options.main_page } then %>
- <div id="main">
- <%= main_page.description.sub(%r{^\s*<h1.*?/h1>}i, '') %>
+ <%= render '_sidebar_search.rhtml' %>
</div>
- <% else %>
- <p>This is the API documentation for '<%= @options.title %>'.</p>
- <% end %>
-
- <% simple_files = @files.select {|tl| tl.parser == RDoc::Parser::Simple } %>
- <% unless simple_files.empty? then %>
- <h2>Files</h2>
- <ul>
- <% simple_files.sort.each do |file| %>
- <li class="file"><a href="<%= file.path %>"><%= h file.base_name %></a></li>
- <% end %>
- </ul>
- <% end %>
- <h2 id="classes">Classes/Modules</h2>
- <ul>
- <% @modsort.each do |klass| %>
- <li class="<%= klass.type %>"><a href="<%= klass.path %>"><%= klass.full_name %></a></li>
- <% end %>
- </ul>
+ <div id="project-metadata">
+ <%= render '_sidebar_pages.rhtml' %>
+ <%= render '_sidebar_classes.rhtml' %>
+ </div>
+</nav>
- <h2 id="methods">Methods</h2>
- <ul>
- <% RDoc::TopLevel.all_classes_and_modules.map do |mod|
- mod.method_list
- end.flatten.sort.each do |method| %>
- <li><a href="<%= method.path %>"><%= method.pretty_name %> &mdash; <%= method.parent.full_name %></a></li>
- <% end %>
- </ul>
+<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 %>
+</main>
- <div id="validator-badges">
- <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
- <p><small>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish
- Rdoc Generator</a> <%= RDoc::Generator::Darkfish::VERSION %></small>.</p>
- </div>
-</body>
-</html>
diff --git a/lib/rdoc/generator/template/darkfish/js/darkfish.js b/lib/rdoc/generator/template/darkfish/js/darkfish.js
index 7a2f44c765..06fef3b215 100644
--- a/lib/rdoc/generator/template/darkfish/js/darkfish.js
+++ b/lib/rdoc/generator/template/darkfish/js/darkfish.js
@@ -9,12 +9,12 @@
/* Provide console simulation for firebug-less environments */
if (!("console" in window) || !("firebug" in console)) {
- var names = ["log", "debug", "info", "warn", "error", "assert", "dir", "dirxml",
+ var names = ["log", "debug", "info", "warn", "error", "assert", "dir", "dirxml",
"group", "groupEnd", "time", "timeEnd", "count", "trace", "profile", "profileEnd"];
- window.console = {};
- for (var i = 0; i < names.length; ++i)
- window.console[names[i]] = function() {};
+ window.console = {};
+ for (var i = 0; i < names.length; ++i)
+ window.console[names[i]] = function() {};
};
@@ -23,96 +23,118 @@ if (!("console" in window) || !("firebug" in console)) {
*/
$.fn.unwrap = function( expr ) {
return this.each( function() {
- $(this).parents( expr ).eq( 0 ).after( this ).remove();
+ $(this).parents( expr ).eq( 0 ).after( this ).remove();
});
};
function showSource( e ) {
- var target = e.target;
- var codeSections = $(target).
- parents('.method-detail').
- find('.method-source-code');
-
- $(target).
- parents('.method-detail').
- find('.method-source-code').
- slideToggle();
+ var target = e.target;
+ var codeSections = $(target).
+ parents('.method-detail').
+ find('.method-source-code');
+
+ $(target).
+ parents('.method-detail').
+ find('.method-source-code').
+ slideToggle();
};
function hookSourceViews() {
- $('.method-description,.method-heading').click( showSource );
+ $('.method-heading').click( showSource );
};
function toggleDebuggingSection() {
- $('.debugging-section').slideToggle();
+ $('.debugging-section').slideToggle();
};
function hookDebuggingToggle() {
- $('#debugging-toggle img').click( toggleDebuggingSection );
+ $('#debugging-toggle img').click( toggleDebuggingSection );
};
-function hookQuickSearch() {
- $('.quicksearch-field').each( function() {
- var searchElems = $(this).parents('.section').find( 'li' );
- var toggle = $(this).parents('.section').find('h3 .search-toggle');
- // console.debug( "Toggle is: %o", toggle );
- var qsbox = $(this).parents('form').get( 0 );
-
- $(this).quicksearch( this, searchElems, {
- noSearchResultsIndicator: 'no-class-search-results',
- focusOnLoad: false
- });
- $(toggle).click( function() {
- // console.debug( "Toggling qsbox: %o", qsbox );
- $(qsbox).toggle();
- });
- });
+function hookSearch() {
+ var input = $('#search-field').eq(0);
+ var result = $('#search-results').eq(0);
+ $(result).show();
+
+ var search_section = $('#search-section').get(0);
+ $(search_section).show();
+
+ var search = new Search(search_data, input, result);
+
+ search.renderItem = function(result) {
+ var li = document.createElement('li');
+ var html = '';
+
+ // TODO add relative path to <script> per-page
+ html += '<p class="search-match"><a href="' + rdoc_rel_prefix + result.path + '">' + this.hlt(result.title);
+ if (result.params)
+ html += '<span class="params">' + result.params + '</span>';
+ html += '</a>';
+
+
+ if (result.namespace)
+ html += '<p class="search-namespace">' + this.hlt(result.namespace);
+
+ if (result.snippet)
+ html += '<div class="search-snippet">' + result.snippet + '</div>';
+
+ li.innerHTML = html;
+
+ return li;
+ }
+
+ search.select = function(result) {
+ var result_element = result.get(0);
+ window.location.href = result_element.firstChild.firstChild.href;
+ }
+
+ search.scrollIntoView = search.scrollInWindow;
};
function highlightTarget( anchor ) {
- console.debug( "Highlighting target '%s'.", anchor );
-
- $("a[name]").each( function() {
- if ( $(this).attr("name") == anchor ) {
- if ( !$(this).parent().parent().hasClass('target-section') ) {
- console.debug( "Wrapping the target-section" );
- $('div.method-detail').unwrap( 'div.target-section' );
- $(this).parent().wrap( '<div class="target-section"></div>' );
- } else {
- console.debug( "Already wrapped." );
- }
- }
- });
+ console.debug( "Highlighting target '%s'.", anchor );
+
+ $("a[name]").each( function() {
+ if ( $(this).attr("name") == anchor ) {
+ if ( !$(this).parent().parent().hasClass('target-section') ) {
+ console.debug( "Wrapping the target-section" );
+ $('div.method-detail').unwrap( 'div.target-section' );
+ $(this).parent().wrap( '<div class="target-section"></div>' );
+ } else {
+ console.debug( "Already wrapped." );
+ }
+ }
+ });
};
function highlightLocationTarget() {
- console.debug( "Location hash: %s", window.location.hash );
- if ( ! window.location.hash || window.location.hash.length == 0 ) return;
+ console.debug( "Location hash: %s", window.location.hash );
+ if ( ! window.location.hash || window.location.hash.length == 0 ) return;
- var anchor = window.location.hash.substring(1);
- console.debug( "Found anchor: %s; matching %s", anchor, "a[name=" + anchor + "]" );
+ var anchor = window.location.hash.substring(1);
+ console.debug( "Found anchor: %s; matching %s", anchor, "a[name=" + anchor + "]" );
- highlightTarget( anchor );
+ highlightTarget( anchor );
};
function highlightClickTarget( event ) {
- console.debug( "Highlighting click target for event %o", event.target );
- try {
- var anchor = $(event.target).attr( 'href' ).substring(1);
- console.debug( "Found target anchor: %s", anchor );
- highlightTarget( anchor );
- } catch ( err ) {
- console.error( "Exception while highlighting: %o", err );
- };
+ console.debug( "Highlighting click target for event %o", event.target );
+ try {
+ var anchor = $(event.target).attr( 'href' ).substring(1);
+ console.debug( "Found target anchor: %s", anchor );
+ highlightTarget( anchor );
+ } catch ( err ) {
+ console.error( "Exception while highlighting: %o", err );
+ };
};
$(document).ready( function() {
- hookSourceViews();
- hookDebuggingToggle();
- hookQuickSearch();
- highlightLocationTarget();
+ hookSourceViews();
+ hookDebuggingToggle();
+ hookSearch();
+ highlightLocationTarget();
- $('ul.link-list a').bind( "click", highlightClickTarget );
+ $('ul.link-list a').bind( "click", highlightClickTarget );
});
diff --git a/lib/rdoc/generator/template/darkfish/js/jquery.js b/lib/rdoc/generator/template/darkfish/js/jquery.js
index afe9e74c90..48590ecb96 100644
--- a/lib/rdoc/generator/template/darkfish/js/jquery.js
+++ b/lib/rdoc/generator/template/darkfish/js/jquery.js
@@ -1,32 +1,18 @@
-/*
- * jQuery 1.2.6 - New Wave Javascript
+/*!
+ * jQuery JavaScript Library v1.6.2
+ * http://jquery.com/
*
- * Copyright (c) 2008 John Resig (jquery.com)
- * Dual licensed under the MIT (MIT-LICENSE.txt)
- * and GPL (GPL-LICENSE.txt) licenses.
+ * Copyright 2011, John Resig
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
*
- * $Date: 2008-09-25 09:50:52 -0700 (Thu, 25 Sep 2008) $
- * $Rev: 38 $
+ * 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(){var _jQuery=window.jQuery,_$=window.$;var jQuery=window.jQuery=window.$=function(selector,context){return new jQuery.fn.init(selector,context);};var quickExpr=/^[^<]*(<(.|\s)+>)[^>]*$|^#(\w+)$/,isSimple=/^.[^:#\[\.]*$/,undefined;jQuery.fn=jQuery.prototype={init:function(selector,context){selector=selector||document;if(selector.nodeType){this[0]=selector;this.length=1;return this;}if(typeof selector=="string"){var match=quickExpr.exec(selector);if(match&&(match[1]||!context)){if(match[1])selector=jQuery.clean([match[1]],context);else{var elem=document.getElementById(match[3]);if(elem){if(elem.id!=match[3])return jQuery().find(selector);return jQuery(elem);}selector=[];}}else
-return jQuery(context).find(selector);}else if(jQuery.isFunction(selector))return jQuery(document)[jQuery.fn.ready?"ready":"load"](selector);return this.setArray(jQuery.makeArray(selector));},jquery:"1.2.6",size:function(){return this.length;},length:0,get:function(num){return num==undefined?jQuery.makeArray(this):this[num];},pushStack:function(elems){var ret=jQuery(elems);ret.prevObject=this;return ret;},setArray:function(elems){this.length=0;Array.prototype.push.apply(this,elems);return this;},each:function(callback,args){return jQuery.each(this,callback,args);},index:function(elem){var ret=-1;return jQuery.inArray(elem&&elem.jquery?elem[0]:elem,this);},attr:function(name,value,type){var options=name;if(name.constructor==String)if(value===undefined)return this[0]&&jQuery[type||"attr"](this[0],name);else{options={};options[name]=value;}return this.each(function(i){for(name in options)jQuery.attr(type?this.style:this,name,jQuery.prop(this,options[name],type,i,name));});},css:function(key,value){if((key=='width'||key=='height')&&parseFloat(value)<0)value=undefined;return this.attr(key,value,"curCSS");},text:function(text){if(typeof text!="object"&&text!=null)return this.empty().append((this[0]&&this[0].ownerDocument||document).createTextNode(text));var ret="";jQuery.each(text||this,function(){jQuery.each(this.childNodes,function(){if(this.nodeType!=8)ret+=this.nodeType!=1?this.nodeValue:jQuery.fn.text([this]);});});return ret;},wrapAll:function(html){if(this[0])jQuery(html,this[0].ownerDocument).clone().insertBefore(this[0]).map(function(){var elem=this;while(elem.firstChild)elem=elem.firstChild;return elem;}).append(this);return this;},wrapInner:function(html){return this.each(function(){jQuery(this).contents().wrapAll(html);});},wrap:function(html){return this.each(function(){jQuery(this).wrapAll(html);});},append:function(){return this.domManip(arguments,true,false,function(elem){if(this.nodeType==1)this.appendChild(elem);});},prepend:function(){return this.domManip(arguments,true,true,function(elem){if(this.nodeType==1)this.insertBefore(elem,this.firstChild);});},before:function(){return this.domManip(arguments,false,false,function(elem){this.parentNode.insertBefore(elem,this);});},after:function(){return this.domManip(arguments,false,true,function(elem){this.parentNode.insertBefore(elem,this.nextSibling);});},end:function(){return this.prevObject||jQuery([]);},find:function(selector){var elems=jQuery.map(this,function(elem){return jQuery.find(selector,elem);});return this.pushStack(/[^+>] [^+>]/.test(selector)||selector.indexOf("..")>-1?jQuery.unique(elems):elems);},clone:function(events){var ret=this.map(function(){if(jQuery.browser.msie&&!jQuery.isXMLDoc(this)){var clone=this.cloneNode(true),container=document.createElement("div");container.appendChild(clone);return jQuery.clean([container.innerHTML])[0];}else
-return this.cloneNode(true);});var clone=ret.find("*").andSelf().each(function(){if(this[expando]!=undefined)this[expando]=null;});if(events===true)this.find("*").andSelf().each(function(i){if(this.nodeType==3)return;var events=jQuery.data(this,"events");for(var type in events)for(var handler in events[type])jQuery.event.add(clone[i],type,events[type][handler],events[type][handler].data);});return ret;},filter:function(selector){return this.pushStack(jQuery.isFunction(selector)&&jQuery.grep(this,function(elem,i){return selector.call(elem,i);})||jQuery.multiFilter(selector,this));},not:function(selector){if(selector.constructor==String)if(isSimple.test(selector))return this.pushStack(jQuery.multiFilter(selector,this,true));else
-selector=jQuery.multiFilter(selector,this);var isArrayLike=selector.length&&selector[selector.length-1]!==undefined&&!selector.nodeType;return this.filter(function(){return isArrayLike?jQuery.inArray(this,selector)<0:this!=selector;});},add:function(selector){return this.pushStack(jQuery.unique(jQuery.merge(this.get(),typeof selector=='string'?jQuery(selector):jQuery.makeArray(selector))));},is:function(selector){return!!selector&&jQuery.multiFilter(selector,this).length>0;},hasClass:function(selector){return this.is("."+selector);},val:function(value){if(value==undefined){if(this.length){var elem=this[0];if(jQuery.nodeName(elem,"select")){var index=elem.selectedIndex,values=[],options=elem.options,one=elem.type=="select-one";if(index<0)return null;for(var i=one?index:0,max=one?index+1:options.length;i<max;i++){var option=options[i];if(option.selected){value=jQuery.browser.msie&&!option.attributes.value.specified?option.text:option.value;if(one)return value;values.push(value);}}return values;}else
-return(this[0].value||"").replace(/\r/g,"");}return undefined;}if(value.constructor==Number)value+='';return this.each(function(){if(this.nodeType!=1)return;if(value.constructor==Array&&/radio|checkbox/.test(this.type))this.checked=(jQuery.inArray(this.value,value)>=0||jQuery.inArray(this.name,value)>=0);else if(jQuery.nodeName(this,"select")){var values=jQuery.makeArray(value);jQuery("option",this).each(function(){this.selected=(jQuery.inArray(this.value,values)>=0||jQuery.inArray(this.text,values)>=0);});if(!values.length)this.selectedIndex=-1;}else
-this.value=value;});},html:function(value){return value==undefined?(this[0]?this[0].innerHTML:null):this.empty().append(value);},replaceWith:function(value){return this.after(value).remove();},eq:function(i){return this.slice(i,i+1);},slice:function(){return this.pushStack(Array.prototype.slice.apply(this,arguments));},map:function(callback){return this.pushStack(jQuery.map(this,function(elem,i){return callback.call(elem,i,elem);}));},andSelf:function(){return this.add(this.prevObject);},data:function(key,value){var parts=key.split(".");parts[1]=parts[1]?"."+parts[1]:"";if(value===undefined){var data=this.triggerHandler("getData"+parts[1]+"!",[parts[0]]);if(data===undefined&&this.length)data=jQuery.data(this[0],key);return data===undefined&&parts[1]?this.data(parts[0]):data;}else
-return this.trigger("setData"+parts[1]+"!",[parts[0],value]).each(function(){jQuery.data(this,key,value);});},removeData:function(key){return this.each(function(){jQuery.removeData(this,key);});},domManip:function(args,table,reverse,callback){var clone=this.length>1,elems;return this.each(function(){if(!elems){elems=jQuery.clean(args,this.ownerDocument);if(reverse)elems.reverse();}var obj=this;if(table&&jQuery.nodeName(this,"table")&&jQuery.nodeName(elems[0],"tr"))obj=this.getElementsByTagName("tbody")[0]||this.appendChild(this.ownerDocument.createElement("tbody"));var scripts=jQuery([]);jQuery.each(elems,function(){var elem=clone?jQuery(this).clone(true)[0]:this;if(jQuery.nodeName(elem,"script"))scripts=scripts.add(elem);else{if(elem.nodeType==1)scripts=scripts.add(jQuery("script",elem).remove());callback.call(obj,elem);}});scripts.each(evalScript);});}};jQuery.fn.init.prototype=jQuery.fn;function evalScript(i,elem){if(elem.src)jQuery.ajax({url:elem.src,async:false,dataType:"script"});else
-jQuery.globalEval(elem.text||elem.textContent||elem.innerHTML||"");if(elem.parentNode)elem.parentNode.removeChild(elem);}function now(){return+new Date;}jQuery.extend=jQuery.fn.extend=function(){var target=arguments[0]||{},i=1,length=arguments.length,deep=false,options;if(target.constructor==Boolean){deep=target;target=arguments[1]||{};i=2;}if(typeof target!="object"&&typeof target!="function")target={};if(length==i){target=this;--i;}for(;i<length;i++)if((options=arguments[i])!=null)for(var name in options){var src=target[name],copy=options[name];if(target===copy)continue;if(deep&&copy&&typeof copy=="object"&&!copy.nodeType)target[name]=jQuery.extend(deep,src||(copy.length!=null?[]:{}),copy);else if(copy!==undefined)target[name]=copy;}return target;};var expando="jQuery"+now(),uuid=0,windowData={},exclude=/z-?index|font-?weight|opacity|zoom|line-?height/i,defaultView=document.defaultView||{};jQuery.extend({noConflict:function(deep){window.$=_$;if(deep)window.jQuery=_jQuery;return jQuery;},isFunction:function(fn){return!!fn&&typeof fn!="string"&&!fn.nodeName&&fn.constructor!=Array&&/^[\s[]?function/.test(fn+"");},isXMLDoc:function(elem){return elem.documentElement&&!elem.body||elem.tagName&&elem.ownerDocument&&!elem.ownerDocument.body;},globalEval:function(data){data=jQuery.trim(data);if(data){var head=document.getElementsByTagName("head")[0]||document.documentElement,script=document.createElement("script");script.type="text/javascript";if(jQuery.browser.msie)script.text=data;else
-script.appendChild(document.createTextNode(data));head.insertBefore(script,head.firstChild);head.removeChild(script);}},nodeName:function(elem,name){return elem.nodeName&&elem.nodeName.toUpperCase()==name.toUpperCase();},cache:{},data:function(elem,name,data){elem=elem==window?windowData:elem;var id=elem[expando];if(!id)id=elem[expando]=++uuid;if(name&&!jQuery.cache[id])jQuery.cache[id]={};if(data!==undefined)jQuery.cache[id][name]=data;return name?jQuery.cache[id][name]:id;},removeData:function(elem,name){elem=elem==window?windowData:elem;var id=elem[expando];if(name){if(jQuery.cache[id]){delete jQuery.cache[id][name];name="";for(name in jQuery.cache[id])break;if(!name)jQuery.removeData(elem);}}else{try{delete elem[expando];}catch(e){if(elem.removeAttribute)elem.removeAttribute(expando);}delete jQuery.cache[id];}},each:function(object,callback,args){var name,i=0,length=object.length;if(args){if(length==undefined){for(name in object)if(callback.apply(object[name],args)===false)break;}else
-for(;i<length;)if(callback.apply(object[i++],args)===false)break;}else{if(length==undefined){for(name in object)if(callback.call(object[name],name,object[name])===false)break;}else
-for(var value=object[0];i<length&&callback.call(value,i,value)!==false;value=object[++i]){}}return object;},prop:function(elem,value,type,i,name){if(jQuery.isFunction(value))value=value.call(elem,i);return value&&value.constructor==Number&&type=="curCSS"&&!exclude.test(name)?value+"px":value;},className:{add:function(elem,classNames){jQuery.each((classNames||"").split(/\s+/),function(i,className){if(elem.nodeType==1&&!jQuery.className.has(elem.className,className))elem.className+=(elem.className?" ":"")+className;});},remove:function(elem,classNames){if(elem.nodeType==1)elem.className=classNames!=undefined?jQuery.grep(elem.className.split(/\s+/),function(className){return!jQuery.className.has(classNames,className);}).join(" "):"";},has:function(elem,className){return jQuery.inArray(className,(elem.className||elem).toString().split(/\s+/))>-1;}},swap:function(elem,options,callback){var old={};for(var name in options){old[name]=elem.style[name];elem.style[name]=options[name];}callback.call(elem);for(var name in options)elem.style[name]=old[name];},css:function(elem,name,force){if(name=="width"||name=="height"){var val,props={position:"absolute",visibility:"hidden",display:"block"},which=name=="width"?["Left","Right"]:["Top","Bottom"];function getWH(){val=name=="width"?elem.offsetWidth:elem.offsetHeight;var padding=0,border=0;jQuery.each(which,function(){padding+=parseFloat(jQuery.curCSS(elem,"padding"+this,true))||0;border+=parseFloat(jQuery.curCSS(elem,"border"+this+"Width",true))||0;});val-=Math.round(padding+border);}if(jQuery(elem).is(":visible"))getWH();else
-jQuery.swap(elem,props,getWH);return Math.max(0,val);}return jQuery.curCSS(elem,name,force);},curCSS:function(elem,name,force){var ret,style=elem.style;function color(elem){if(!jQuery.browser.safari)return false;var ret=defaultView.getComputedStyle(elem,null);return!ret||ret.getPropertyValue("color")=="";}if(name=="opacity"&&jQuery.browser.msie){ret=jQuery.attr(style,"opacity");return ret==""?"1":ret;}if(jQuery.browser.opera&&name=="display"){var save=style.outline;style.outline="0 solid black";style.outline=save;}if(name.match(/float/i))name=styleFloat;if(!force&&style&&style[name])ret=style[name];else if(defaultView.getComputedStyle){if(name.match(/float/i))name="float";name=name.replace(/([A-Z])/g,"-$1").toLowerCase();var computedStyle=defaultView.getComputedStyle(elem,null);if(computedStyle&&!color(elem))ret=computedStyle.getPropertyValue(name);else{var swap=[],stack=[],a=elem,i=0;for(;a&&color(a);a=a.parentNode)stack.unshift(a);for(;i<stack.length;i++)if(color(stack[i])){swap[i]=stack[i].style.display;stack[i].style.display="block";}ret=name=="display"&&swap[stack.length-1]!=null?"none":(computedStyle&&computedStyle.getPropertyValue(name))||"";for(i=0;i<swap.length;i++)if(swap[i]!=null)stack[i].style.display=swap[i];}if(name=="opacity"&&ret=="")ret="1";}else if(elem.currentStyle){var camelCase=name.replace(/\-(\w)/g,function(all,letter){return letter.toUpperCase();});ret=elem.currentStyle[name]||elem.currentStyle[camelCase];if(!/^\d+(px)?$/i.test(ret)&&/^\d/.test(ret)){var left=style.left,rsLeft=elem.runtimeStyle.left;elem.runtimeStyle.left=elem.currentStyle.left;style.left=ret||0;ret=style.pixelLeft+"px";style.left=left;elem.runtimeStyle.left=rsLeft;}}return ret;},clean:function(elems,context){var ret=[];context=context||document;if(typeof context.createElement=='undefined')context=context.ownerDocument||context[0]&&context[0].ownerDocument||document;jQuery.each(elems,function(i,elem){if(!elem)return;if(elem.constructor==Number)elem+='';if(typeof elem=="string"){elem=elem.replace(/(<(\w+)[^>]*?)\/>/g,function(all,front,tag){return tag.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i)?all:front+"></"+tag+">";});var tags=jQuery.trim(elem).toLowerCase(),div=context.createElement("div");var wrap=!tags.indexOf("<opt")&&[1,"<select multiple='multiple'>","</select>"]||!tags.indexOf("<leg")&&[1,"<fieldset>","</fieldset>"]||tags.match(/^<(thead|tbody|tfoot|colg|cap)/)&&[1,"<table>","</table>"]||!tags.indexOf("<tr")&&[2,"<table><tbody>","</tbody></table>"]||(!tags.indexOf("<td")||!tags.indexOf("<th"))&&[3,"<table><tbody><tr>","</tr></tbody></table>"]||!tags.indexOf("<col")&&[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"]||jQuery.browser.msie&&[1,"div<div>","</div>"]||[0,"",""];div.innerHTML=wrap[1]+elem+wrap[2];while(wrap[0]--)div=div.lastChild;if(jQuery.browser.msie){var tbody=!tags.indexOf("<table")&&tags.indexOf("<tbody")<0?div.firstChild&&div.firstChild.childNodes:wrap[1]=="<table>"&&tags.indexOf("<tbody")<0?div.childNodes:[];for(var j=tbody.length-1;j>=0;--j)if(jQuery.nodeName(tbody[j],"tbody")&&!tbody[j].childNodes.length)tbody[j].parentNode.removeChild(tbody[j]);if(/^\s/.test(elem))div.insertBefore(context.createTextNode(elem.match(/^\s*/)[0]),div.firstChild);}elem=jQuery.makeArray(div.childNodes);}if(elem.length===0&&(!jQuery.nodeName(elem,"form")&&!jQuery.nodeName(elem,"select")))return;if(elem[0]==undefined||jQuery.nodeName(elem,"form")||elem.options)ret.push(elem);else
-ret=jQuery.merge(ret,elem);});return ret;},attr:function(elem,name,value){if(!elem||elem.nodeType==3||elem.nodeType==8)return undefined;var notxml=!jQuery.isXMLDoc(elem),set=value!==undefined,msie=jQuery.browser.msie;name=notxml&&jQuery.props[name]||name;if(elem.tagName){var special=/href|src|style/.test(name);if(name=="selected"&&jQuery.browser.safari)elem.parentNode.selectedIndex;if(name in elem&&notxml&&!special){if(set){if(name=="type"&&jQuery.nodeName(elem,"input")&&elem.parentNode)throw"type property can't be changed";elem[name]=value;}if(jQuery.nodeName(elem,"form")&&elem.getAttributeNode(name))return elem.getAttributeNode(name).nodeValue;return elem[name];}if(msie&&notxml&&name=="style")return jQuery.attr(elem.style,"cssText",value);if(set)elem.setAttribute(name,""+value);var attr=msie&&notxml&&special?elem.getAttribute(name,2):elem.getAttribute(name);return attr===null?undefined:attr;}if(msie&&name=="opacity"){if(set){elem.zoom=1;elem.filter=(elem.filter||"").replace(/alpha\([^)]*\)/,"")+(parseInt(value)+''=="NaN"?"":"alpha(opacity="+value*100+")");}return elem.filter&&elem.filter.indexOf("opacity=")>=0?(parseFloat(elem.filter.match(/opacity=([^)]*)/)[1])/100)+'':"";}name=name.replace(/-([a-z])/ig,function(all,letter){return letter.toUpperCase();});if(set)elem[name]=value;return elem[name];},trim:function(text){return(text||"").replace(/^\s+|\s+$/g,"");},makeArray:function(array){var ret=[];if(array!=null){var i=array.length;if(i==null||array.split||array.setInterval||array.call)ret[0]=array;else
-while(i)ret[--i]=array[i];}return ret;},inArray:function(elem,array){for(var i=0,length=array.length;i<length;i++)if(array[i]===elem)return i;return-1;},merge:function(first,second){var i=0,elem,pos=first.length;if(jQuery.browser.msie){while(elem=second[i++])if(elem.nodeType!=8)first[pos++]=elem;}else
-while(elem=second[i++])first[pos++]=elem;return first;},unique:function(array){var ret=[],done={};try{for(var i=0,length=array.length;i<length;i++){var id=jQuery.data(array[i]);if(!done[id]){done[id]=true;ret.push(array[i]);}}}catch(e){ret=array;}return ret;},grep:function(elems,callback,inv){var ret=[];for(var i=0,length=elems.length;i<length;i++)if(!inv!=!callback(elems[i],i))ret.push(elems[i]);return ret;},map:function(elems,callback){var ret=[];for(var i=0,length=elems.length;i<length;i++){var value=callback(elems[i],i);if(value!=null)ret[ret.length]=value;}return ret.concat.apply([],ret);}});var userAgent=navigator.userAgent.toLowerCase();jQuery.browser={version:(userAgent.match(/.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/)||[])[1],safari:/webkit/.test(userAgent),opera:/opera/.test(userAgent),msie:/msie/.test(userAgent)&&!/opera/.test(userAgent),mozilla:/mozilla/.test(userAgent)&&!/(compatible|webkit)/.test(userAgent)};var styleFloat=jQuery.browser.msie?"styleFloat":"cssFloat";jQuery.extend({boxModel:!jQuery.browser.msie||document.compatMode=="CSS1Compat",props:{"for":"htmlFor","class":"className","float":styleFloat,cssFloat:styleFloat,styleFloat:styleFloat,readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing"}});jQuery.each({parent:function(elem){return elem.parentNode;},parents:function(elem){return jQuery.dir(elem,"parentNode");},next:function(elem){return jQuery.nth(elem,2,"nextSibling");},prev:function(elem){return jQuery.nth(elem,2,"previousSibling");},nextAll:function(elem){return jQuery.dir(elem,"nextSibling");},prevAll:function(elem){return jQuery.dir(elem,"previousSibling");},siblings:function(elem){return jQuery.sibling(elem.parentNode.firstChild,elem);},children:function(elem){return jQuery.sibling(elem.firstChild);},contents:function(elem){return jQuery.nodeName(elem,"iframe")?elem.contentDocument||elem.contentWindow.document:jQuery.makeArray(elem.childNodes);}},function(name,fn){jQuery.fn[name]=function(selector){var ret=jQuery.map(this,fn);if(selector&&typeof selector=="string")ret=jQuery.multiFilter(selector,ret);return this.pushStack(jQuery.unique(ret));};});jQuery.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(name,original){jQuery.fn[name]=function(){var args=arguments;return this.each(function(){for(var i=0,length=args.length;i<length;i++)jQuery(args[i])[original](this);});};});jQuery.each({removeAttr:function(name){jQuery.attr(this,name,"");if(this.nodeType==1)this.removeAttribute(name);},addClass:function(classNames){jQuery.className.add(this,classNames);},removeClass:function(classNames){jQuery.className.remove(this,classNames);},toggleClass:function(classNames){jQuery.className[jQuery.className.has(this,classNames)?"remove":"add"](this,classNames);},remove:function(selector){if(!selector||jQuery.filter(selector,[this]).r.length){jQuery("*",this).add(this).each(function(){jQuery.event.remove(this);jQuery.removeData(this);});if(this.parentNode)this.parentNode.removeChild(this);}},empty:function(){jQuery(">*",this).remove();while(this.firstChild)this.removeChild(this.firstChild);}},function(name,fn){jQuery.fn[name]=function(){return this.each(fn,arguments);};});jQuery.each(["Height","Width"],function(i,name){var type=name.toLowerCase();jQuery.fn[type]=function(size){return this[0]==window?jQuery.browser.opera&&document.body["client"+name]||jQuery.browser.safari&&window["inner"+name]||document.compatMode=="CSS1Compat"&&document.documentElement["client"+name]||document.body["client"+name]:this[0]==document?Math.max(Math.max(document.body["scroll"+name],document.documentElement["scroll"+name]),Math.max(document.body["offset"+name],document.documentElement["offset"+name])):size==undefined?(this.length?jQuery.css(this[0],type):null):this.css(type,size.constructor==String?size:size+"px");};});function num(elem,prop){return elem[0]&&parseInt(jQuery.curCSS(elem[0],prop,true),10)||0;}var chars=jQuery.browser.safari&&parseInt(jQuery.browser.version)<417?"(?:[\\w*_-]|\\\\.)":"(?:[\\w\u0128-\uFFFF*_-]|\\\\.)",quickChild=new RegExp("^>\\s*("+chars+"+)"),quickID=new RegExp("^("+chars+"+)(#)("+chars+"+)"),quickClass=new RegExp("^([#.]?)("+chars+"*)");jQuery.extend({expr:{"":function(a,i,m){return m[2]=="*"||jQuery.nodeName(a,m[2]);},"#":function(a,i,m){return a.getAttribute("id")==m[2];},":":{lt:function(a,i,m){return i<m[3]-0;},gt:function(a,i,m){return i>m[3]-0;},nth:function(a,i,m){return m[3]-0==i;},eq:function(a,i,m){return m[3]-0==i;},first:function(a,i){return i==0;},last:function(a,i,m,r){return i==r.length-1;},even:function(a,i){return i%2==0;},odd:function(a,i){return i%2;},"first-child":function(a){return a.parentNode.getElementsByTagName("*")[0]==a;},"last-child":function(a){return jQuery.nth(a.parentNode.lastChild,1,"previousSibling")==a;},"only-child":function(a){return!jQuery.nth(a.parentNode.lastChild,2,"previousSibling");},parent:function(a){return a.firstChild;},empty:function(a){return!a.firstChild;},contains:function(a,i,m){return(a.textContent||a.innerText||jQuery(a).text()||"").indexOf(m[3])>=0;},visible:function(a){return"hidden"!=a.type&&jQuery.css(a,"display")!="none"&&jQuery.css(a,"visibility")!="hidden";},hidden:function(a){return"hidden"==a.type||jQuery.css(a,"display")=="none"||jQuery.css(a,"visibility")=="hidden";},enabled:function(a){return!a.disabled;},disabled:function(a){return a.disabled;},checked:function(a){return a.checked;},selected:function(a){return a.selected||jQuery.attr(a,"selected");},text:function(a){return"text"==a.type;},radio:function(a){return"radio"==a.type;},checkbox:function(a){return"checkbox"==a.type;},file:function(a){return"file"==a.type;},password:function(a){return"password"==a.type;},submit:function(a){return"submit"==a.type;},image:function(a){return"image"==a.type;},reset:function(a){return"reset"==a.type;},button:function(a){return"button"==a.type||jQuery.nodeName(a,"button");},input:function(a){return/input|select|textarea|button/i.test(a.nodeName);},has:function(a,i,m){return jQuery.find(m[3],a).length;},header:function(a){return/h\d/i.test(a.nodeName);},animated:function(a){return jQuery.grep(jQuery.timers,function(fn){return a==fn.elem;}).length;}}},parse:[/^(\[) *@?([\w-]+) *([!*$^~=]*) *('?"?)(.*?)\4 *\]/,/^(:)([\w-]+)\("?'?(.*?(\(.*?\))?[^(]*?)"?'?\)/,new RegExp("^([:.#]*)("+chars+"+)")],multiFilter:function(expr,elems,not){var old,cur=[];while(expr&&expr!=old){old=expr;var f=jQuery.filter(expr,elems,not);expr=f.t.replace(/^\s*,\s*/,"");cur=not?elems=f.r:jQuery.merge(cur,f.r);}return cur;},find:function(t,context){if(typeof t!="string")return[t];if(context&&context.nodeType!=1&&context.nodeType!=9)return[];context=context||document;var ret=[context],done=[],last,nodeName;while(t&&last!=t){var r=[];last=t;t=jQuery.trim(t);var foundToken=false,re=quickChild,m=re.exec(t);if(m){nodeName=m[1].toUpperCase();for(var i=0;ret[i];i++)for(var c=ret[i].firstChild;c;c=c.nextSibling)if(c.nodeType==1&&(nodeName=="*"||c.nodeName.toUpperCase()==nodeName))r.push(c);ret=r;t=t.replace(re,"");if(t.indexOf(" ")==0)continue;foundToken=true;}else{re=/^([>+~])\s*(\w*)/i;if((m=re.exec(t))!=null){r=[];var merge={};nodeName=m[2].toUpperCase();m=m[1];for(var j=0,rl=ret.length;j<rl;j++){var n=m=="~"||m=="+"?ret[j].nextSibling:ret[j].firstChild;for(;n;n=n.nextSibling)if(n.nodeType==1){var id=jQuery.data(n);if(m=="~"&&merge[id])break;if(!nodeName||n.nodeName.toUpperCase()==nodeName){if(m=="~")merge[id]=true;r.push(n);}if(m=="+")break;}}ret=r;t=jQuery.trim(t.replace(re,""));foundToken=true;}}if(t&&!foundToken){if(!t.indexOf(",")){if(context==ret[0])ret.shift();done=jQuery.merge(done,ret);r=ret=[context];t=" "+t.substr(1,t.length);}else{var re2=quickID;var m=re2.exec(t);if(m){m=[0,m[2],m[3],m[1]];}else{re2=quickClass;m=re2.exec(t);}m[2]=m[2].replace(/\\/g,"");var elem=ret[ret.length-1];if(m[1]=="#"&&elem&&elem.getElementById&&!jQuery.isXMLDoc(elem)){var oid=elem.getElementById(m[2]);if((jQuery.browser.msie||jQuery.browser.opera)&&oid&&typeof oid.id=="string"&&oid.id!=m[2])oid=jQuery('[@id="'+m[2]+'"]',elem)[0];ret=r=oid&&(!m[3]||jQuery.nodeName(oid,m[3]))?[oid]:[];}else{for(var i=0;ret[i];i++){var tag=m[1]=="#"&&m[3]?m[3]:m[1]!=""||m[0]==""?"*":m[2];if(tag=="*"&&ret[i].nodeName.toLowerCase()=="object")tag="param";r=jQuery.merge(r,ret[i].getElementsByTagName(tag));}if(m[1]==".")r=jQuery.classFilter(r,m[2]);if(m[1]=="#"){var tmp=[];for(var i=0;r[i];i++)if(r[i].getAttribute("id")==m[2]){tmp=[r[i]];break;}r=tmp;}ret=r;}t=t.replace(re2,"");}}if(t){var val=jQuery.filter(t,r);ret=r=val.r;t=jQuery.trim(val.t);}}if(t)ret=[];if(ret&&context==ret[0])ret.shift();done=jQuery.merge(done,ret);return done;},classFilter:function(r,m,not){m=" "+m+" ";var tmp=[];for(var i=0;r[i];i++){var pass=(" "+r[i].className+" ").indexOf(m)>=0;if(!not&&pass||not&&!pass)tmp.push(r[i]);}return tmp;},filter:function(t,r,not){var last;while(t&&t!=last){last=t;var p=jQuery.parse,m;for(var i=0;p[i];i++){m=p[i].exec(t);if(m){t=t.substring(m[0].length);m[2]=m[2].replace(/\\/g,"");break;}}if(!m)break;if(m[1]==":"&&m[2]=="not")r=isSimple.test(m[3])?jQuery.filter(m[3],r,true).r:jQuery(r).not(m[3]);else if(m[1]==".")r=jQuery.classFilter(r,m[2],not);else if(m[1]=="["){var tmp=[],type=m[3];for(var i=0,rl=r.length;i<rl;i++){var a=r[i],z=a[jQuery.props[m[2]]||m[2]];if(z==null||/href|src|selected/.test(m[2]))z=jQuery.attr(a,m[2])||'';if((type==""&&!!z||type=="="&&z==m[5]||type=="!="&&z!=m[5]||type=="^="&&z&&!z.indexOf(m[5])||type=="$="&&z.substr(z.length-m[5].length)==m[5]||(type=="*="||type=="~=")&&z.indexOf(m[5])>=0)^not)tmp.push(a);}r=tmp;}else if(m[1]==":"&&m[2]=="nth-child"){var merge={},tmp=[],test=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(m[3]=="even"&&"2n"||m[3]=="odd"&&"2n+1"||!/\D/.test(m[3])&&"0n+"+m[3]||m[3]),first=(test[1]+(test[2]||1))-0,last=test[3]-0;for(var i=0,rl=r.length;i<rl;i++){var node=r[i],parentNode=node.parentNode,id=jQuery.data(parentNode);if(!merge[id]){var c=1;for(var n=parentNode.firstChild;n;n=n.nextSibling)if(n.nodeType==1)n.nodeIndex=c++;merge[id]=true;}var add=false;if(first==0){if(node.nodeIndex==last)add=true;}else if((node.nodeIndex-last)%first==0&&(node.nodeIndex-last)/first>=0)add=true;if(add^not)tmp.push(node);}r=tmp;}else{var fn=jQuery.expr[m[1]];if(typeof fn=="object")fn=fn[m[2]];if(typeof fn=="string")fn=eval("false||function(a,i){return "+fn+";}");r=jQuery.grep(r,function(elem,i){return fn(elem,i,m,r);},not);}}return{r:r,t:t};},dir:function(elem,dir){var matched=[],cur=elem[dir];while(cur&&cur!=document){if(cur.nodeType==1)matched.push(cur);cur=cur[dir];}return matched;},nth:function(cur,result,dir,elem){result=result||1;var num=0;for(;cur;cur=cur[dir])if(cur.nodeType==1&&++num==result)break;return cur;},sibling:function(n,elem){var r=[];for(;n;n=n.nextSibling){if(n.nodeType==1&&n!=elem)r.push(n);}return r;}});jQuery.event={add:function(elem,types,handler,data){if(elem.nodeType==3||elem.nodeType==8)return;if(jQuery.browser.msie&&elem.setInterval)elem=window;if(!handler.guid)handler.guid=this.guid++;if(data!=undefined){var fn=handler;handler=this.proxy(fn,function(){return fn.apply(this,arguments);});handler.data=data;}var events=jQuery.data(elem,"events")||jQuery.data(elem,"events",{}),handle=jQuery.data(elem,"handle")||jQuery.data(elem,"handle",function(){if(typeof jQuery!="undefined"&&!jQuery.event.triggered)return jQuery.event.handle.apply(arguments.callee.elem,arguments);});handle.elem=elem;jQuery.each(types.split(/\s+/),function(index,type){var parts=type.split(".");type=parts[0];handler.type=parts[1];var handlers=events[type];if(!handlers){handlers=events[type]={};if(!jQuery.event.special[type]||jQuery.event.special[type].setup.call(elem)===false){if(elem.addEventListener)elem.addEventListener(type,handle,false);else if(elem.attachEvent)elem.attachEvent("on"+type,handle);}}handlers[handler.guid]=handler;jQuery.event.global[type]=true;});elem=null;},guid:1,global:{},remove:function(elem,types,handler){if(elem.nodeType==3||elem.nodeType==8)return;var events=jQuery.data(elem,"events"),ret,index;if(events){if(types==undefined||(typeof types=="string"&&types.charAt(0)=="."))for(var type in events)this.remove(elem,type+(types||""));else{if(types.type){handler=types.handler;types=types.type;}jQuery.each(types.split(/\s+/),function(index,type){var parts=type.split(".");type=parts[0];if(events[type]){if(handler)delete events[type][handler.guid];else
-for(handler in events[type])if(!parts[1]||events[type][handler].type==parts[1])delete events[type][handler];for(ret in events[type])break;if(!ret){if(!jQuery.event.special[type]||jQuery.event.special[type].teardown.call(elem)===false){if(elem.removeEventListener)elem.removeEventListener(type,jQuery.data(elem,"handle"),false);else if(elem.detachEvent)elem.detachEvent("on"+type,jQuery.data(elem,"handle"));}ret=null;delete events[type];}}});}for(ret in events)break;if(!ret){var handle=jQuery.data(elem,"handle");if(handle)handle.elem=null;jQuery.removeData(elem,"events");jQuery.removeData(elem,"handle");}}},trigger:function(type,data,elem,donative,extra){data=jQuery.makeArray(data);if(type.indexOf("!")>=0){type=type.slice(0,-1);var exclusive=true;}if(!elem){if(this.global[type])jQuery("*").add([window,document]).trigger(type,data);}else{if(elem.nodeType==3||elem.nodeType==8)return undefined;var val,ret,fn=jQuery.isFunction(elem[type]||null),event=!data[0]||!data[0].preventDefault;if(event){data.unshift({type:type,target:elem,preventDefault:function(){},stopPropagation:function(){},timeStamp:now()});data[0][expando]=true;}data[0].type=type;if(exclusive)data[0].exclusive=true;var handle=jQuery.data(elem,"handle");if(handle)val=handle.apply(elem,data);if((!fn||(jQuery.nodeName(elem,'a')&&type=="click"))&&elem["on"+type]&&elem["on"+type].apply(elem,data)===false)val=false;if(event)data.shift();if(extra&&jQuery.isFunction(extra)){ret=extra.apply(elem,val==null?data:data.concat(val));if(ret!==undefined)val=ret;}if(fn&&donative!==false&&val!==false&&!(jQuery.nodeName(elem,'a')&&type=="click")){this.triggered=true;try{elem[type]();}catch(e){}}this.triggered=false;}return val;},handle:function(event){var val,ret,namespace,all,handlers;event=arguments[0]=jQuery.event.fix(event||window.event);namespace=event.type.split(".");event.type=namespace[0];namespace=namespace[1];all=!namespace&&!event.exclusive;handlers=(jQuery.data(this,"events")||{})[event.type];for(var j in handlers){var handler=handlers[j];if(all||handler.type==namespace){event.handler=handler;event.data=handler.data;ret=handler.apply(this,arguments);if(val!==false)val=ret;if(ret===false){event.preventDefault();event.stopPropagation();}}}return val;},fix:function(event){if(event[expando]==true)return event;var originalEvent=event;event={originalEvent:originalEvent};var props="altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode metaKey newValue originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target timeStamp toElement type view wheelDelta which".split(" ");for(var i=props.length;i;i--)event[props[i]]=originalEvent[props[i]];event[expando]=true;event.preventDefault=function(){if(originalEvent.preventDefault)originalEvent.preventDefault();originalEvent.returnValue=false;};event.stopPropagation=function(){if(originalEvent.stopPropagation)originalEvent.stopPropagation();originalEvent.cancelBubble=true;};event.timeStamp=event.timeStamp||now();if(!event.target)event.target=event.srcElement||document;if(event.target.nodeType==3)event.target=event.target.parentNode;if(!event.relatedTarget&&event.fromElement)event.relatedTarget=event.fromElement==event.target?event.toElement:event.fromElement;if(event.pageX==null&&event.clientX!=null){var doc=document.documentElement,body=document.body;event.pageX=event.clientX+(doc&&doc.scrollLeft||body&&body.scrollLeft||0)-(doc.clientLeft||0);event.pageY=event.clientY+(doc&&doc.scrollTop||body&&body.scrollTop||0)-(doc.clientTop||0);}if(!event.which&&((event.charCode||event.charCode===0)?event.charCode:event.keyCode))event.which=event.charCode||event.keyCode;if(!event.metaKey&&event.ctrlKey)event.metaKey=event.ctrlKey;if(!event.which&&event.button)event.which=(event.button&1?1:(event.button&2?3:(event.button&4?2:0)));return event;},proxy:function(fn,proxy){proxy.guid=fn.guid=fn.guid||proxy.guid||this.guid++;return proxy;},special:{ready:{setup:function(){bindReady();return;},teardown:function(){return;}},mouseenter:{setup:function(){if(jQuery.browser.msie)return false;jQuery(this).bind("mouseover",jQuery.event.special.mouseenter.handler);return true;},teardown:function(){if(jQuery.browser.msie)return false;jQuery(this).unbind("mouseover",jQuery.event.special.mouseenter.handler);return true;},handler:function(event){if(withinElement(event,this))return true;event.type="mouseenter";return jQuery.event.handle.apply(this,arguments);}},mouseleave:{setup:function(){if(jQuery.browser.msie)return false;jQuery(this).bind("mouseout",jQuery.event.special.mouseleave.handler);return true;},teardown:function(){if(jQuery.browser.msie)return false;jQuery(this).unbind("mouseout",jQuery.event.special.mouseleave.handler);return true;},handler:function(event){if(withinElement(event,this))return true;event.type="mouseleave";return jQuery.event.handle.apply(this,arguments);}}}};jQuery.fn.extend({bind:function(type,data,fn){return type=="unload"?this.one(type,data,fn):this.each(function(){jQuery.event.add(this,type,fn||data,fn&&data);});},one:function(type,data,fn){var one=jQuery.event.proxy(fn||data,function(event){jQuery(this).unbind(event,one);return(fn||data).apply(this,arguments);});return this.each(function(){jQuery.event.add(this,type,one,fn&&data);});},unbind:function(type,fn){return this.each(function(){jQuery.event.remove(this,type,fn);});},trigger:function(type,data,fn){return this.each(function(){jQuery.event.trigger(type,data,this,true,fn);});},triggerHandler:function(type,data,fn){return this[0]&&jQuery.event.trigger(type,data,this[0],false,fn);},toggle:function(fn){var args=arguments,i=1;while(i<args.length)jQuery.event.proxy(fn,args[i++]);return this.click(jQuery.event.proxy(fn,function(event){this.lastToggle=(this.lastToggle||0)%i;event.preventDefault();return args[this.lastToggle++].apply(this,arguments)||false;}));},hover:function(fnOver,fnOut){return this.bind('mouseenter',fnOver).bind('mouseleave',fnOut);},ready:function(fn){bindReady();if(jQuery.isReady)fn.call(document,jQuery);else
-jQuery.readyList.push(function(){return fn.call(this,jQuery);});return this;}});jQuery.extend({isReady:false,readyList:[],ready:function(){if(!jQuery.isReady){jQuery.isReady=true;if(jQuery.readyList){jQuery.each(jQuery.readyList,function(){this.call(document);});jQuery.readyList=null;}jQuery(document).triggerHandler("ready");}}});var readyBound=false;function bindReady(){if(readyBound)return;readyBound=true;if(document.addEventListener&&!jQuery.browser.opera)document.addEventListener("DOMContentLoaded",jQuery.ready,false);if(jQuery.browser.msie&&window==top)(function(){if(jQuery.isReady)return;try{document.documentElement.doScroll("left");}catch(error){setTimeout(arguments.callee,0);return;}jQuery.ready();})();if(jQuery.browser.opera)document.addEventListener("DOMContentLoaded",function(){if(jQuery.isReady)return;for(var i=0;i<document.styleSheets.length;i++)if(document.styleSheets[i].disabled){setTimeout(arguments.callee,0);return;}jQuery.ready();},false);if(jQuery.browser.safari){var numStyles;(function(){if(jQuery.isReady)return;if(document.readyState!="loaded"&&document.readyState!="complete"){setTimeout(arguments.callee,0);return;}if(numStyles===undefined)numStyles=jQuery("style, link[rel=stylesheet]").length;if(document.styleSheets.length!=numStyles){setTimeout(arguments.callee,0);return;}jQuery.ready();})();}jQuery.event.add(window,"load",jQuery.ready);}jQuery.each(("blur,focus,load,resize,scroll,unload,click,dblclick,"+"mousedown,mouseup,mousemove,mouseover,mouseout,change,select,"+"submit,keydown,keypress,keyup,error").split(","),function(i,name){jQuery.fn[name]=function(fn){return fn?this.bind(name,fn):this.trigger(name);};});var withinElement=function(event,elem){var parent=event.relatedTarget;while(parent&&parent!=elem)try{parent=parent.parentNode;}catch(error){parent=elem;}return parent==elem;};jQuery(window).bind("unload",function(){jQuery("*").add(document).unbind();});jQuery.fn.extend({_load:jQuery.fn.load,load:function(url,params,callback){if(typeof url!='string')return this._load(url);var off=url.indexOf(" ");if(off>=0){var selector=url.slice(off,url.length);url=url.slice(0,off);}callback=callback||function(){};var type="GET";if(params)if(jQuery.isFunction(params)){callback=params;params=null;}else{params=jQuery.param(params);type="POST";}var self=this;jQuery.ajax({url:url,type:type,dataType:"html",data:params,complete:function(res,status){if(status=="success"||status=="notmodified")self.html(selector?jQuery("<div/>").append(res.responseText.replace(/<script(.|\s)*?\/script>/g,"")).find(selector):res.responseText);self.each(callback,[res.responseText,status,res]);}});return this;},serialize:function(){return jQuery.param(this.serializeArray());},serializeArray:function(){return this.map(function(){return jQuery.nodeName(this,"form")?jQuery.makeArray(this.elements):this;}).filter(function(){return this.name&&!this.disabled&&(this.checked||/select|textarea/i.test(this.nodeName)||/text|hidden|password/i.test(this.type));}).map(function(i,elem){var val=jQuery(this).val();return val==null?null:val.constructor==Array?jQuery.map(val,function(val,i){return{name:elem.name,value:val};}):{name:elem.name,value:val};}).get();}});jQuery.each("ajaxStart,ajaxStop,ajaxComplete,ajaxError,ajaxSuccess,ajaxSend".split(","),function(i,o){jQuery.fn[o]=function(f){return this.bind(o,f);};});var jsc=now();jQuery.extend({get:function(url,data,callback,type){if(jQuery.isFunction(data)){callback=data;data=null;}return jQuery.ajax({type:"GET",url:url,data:data,success:callback,dataType:type});},getScript:function(url,callback){return jQuery.get(url,null,callback,"script");},getJSON:function(url,data,callback){return jQuery.get(url,data,callback,"json");},post:function(url,data,callback,type){if(jQuery.isFunction(data)){callback=data;data={};}return jQuery.ajax({type:"POST",url:url,data:data,success:callback,dataType:type});},ajaxSetup:function(settings){jQuery.extend(jQuery.ajaxSettings,settings);},ajaxSettings:{url:location.href,global:true,type:"GET",timeout:0,contentType:"application/x-www-form-urlencoded",processData:true,async:true,data:null,username:null,password:null,accepts:{xml:"application/xml, text/xml",html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},lastModified:{},ajax:function(s){s=jQuery.extend(true,s,jQuery.extend(true,{},jQuery.ajaxSettings,s));var jsonp,jsre=/=\?(&|$)/g,status,data,type=s.type.toUpperCase();if(s.data&&s.processData&&typeof s.data!="string")s.data=jQuery.param(s.data);if(s.dataType=="jsonp"){if(type=="GET"){if(!s.url.match(jsre))s.url+=(s.url.match(/\?/)?"&":"?")+(s.jsonp||"callback")+"=?";}else if(!s.data||!s.data.match(jsre))s.data=(s.data?s.data+"&":"")+(s.jsonp||"callback")+"=?";s.dataType="json";}if(s.dataType=="json"&&(s.data&&s.data.match(jsre)||s.url.match(jsre))){jsonp="jsonp"+jsc++;if(s.data)s.data=(s.data+"").replace(jsre,"="+jsonp+"$1");s.url=s.url.replace(jsre,"="+jsonp+"$1");s.dataType="script";window[jsonp]=function(tmp){data=tmp;success();complete();window[jsonp]=undefined;try{delete window[jsonp];}catch(e){}if(head)head.removeChild(script);};}if(s.dataType=="script"&&s.cache==null)s.cache=false;if(s.cache===false&&type=="GET"){var ts=now();var ret=s.url.replace(/(\?|&)_=.*?(&|$)/,"$1_="+ts+"$2");s.url=ret+((ret==s.url)?(s.url.match(/\?/)?"&":"?")+"_="+ts:"");}if(s.data&&type=="GET"){s.url+=(s.url.match(/\?/)?"&":"?")+s.data;s.data=null;}if(s.global&&!jQuery.active++)jQuery.event.trigger("ajaxStart");var remote=/^(?:\w+:)?\/\/([^\/?#]+)/;if(s.dataType=="script"&&type=="GET"&&remote.test(s.url)&&remote.exec(s.url)[1]!=location.host){var head=document.getElementsByTagName("head")[0];var script=document.createElement("script");script.src=s.url;if(s.scriptCharset)script.charset=s.scriptCharset;if(!jsonp){var done=false;script.onload=script.onreadystatechange=function(){if(!done&&(!this.readyState||this.readyState=="loaded"||this.readyState=="complete")){done=true;success();complete();head.removeChild(script);}};}head.appendChild(script);return undefined;}var requestDone=false;var xhr=window.ActiveXObject?new ActiveXObject("Microsoft.XMLHTTP"):new XMLHttpRequest();if(s.username)xhr.open(type,s.url,s.async,s.username,s.password);else
-xhr.open(type,s.url,s.async);try{if(s.data)xhr.setRequestHeader("Content-Type",s.contentType);if(s.ifModified)xhr.setRequestHeader("If-Modified-Since",jQuery.lastModified[s.url]||"Thu, 01 Jan 1970 00:00:00 GMT");xhr.setRequestHeader("X-Requested-With","XMLHttpRequest");xhr.setRequestHeader("Accept",s.dataType&&s.accepts[s.dataType]?s.accepts[s.dataType]+", */*":s.accepts._default);}catch(e){}if(s.beforeSend&&s.beforeSend(xhr,s)===false){s.global&&jQuery.active--;xhr.abort();return false;}if(s.global)jQuery.event.trigger("ajaxSend",[xhr,s]);var onreadystatechange=function(isTimeout){if(!requestDone&&xhr&&(xhr.readyState==4||isTimeout=="timeout")){requestDone=true;if(ival){clearInterval(ival);ival=null;}status=isTimeout=="timeout"&&"timeout"||!jQuery.httpSuccess(xhr)&&"error"||s.ifModified&&jQuery.httpNotModified(xhr,s.url)&&"notmodified"||"success";if(status=="success"){try{data=jQuery.httpData(xhr,s.dataType,s.dataFilter);}catch(e){status="parsererror";}}if(status=="success"){var modRes;try{modRes=xhr.getResponseHeader("Last-Modified");}catch(e){}if(s.ifModified&&modRes)jQuery.lastModified[s.url]=modRes;if(!jsonp)success();}else
-jQuery.handleError(s,xhr,status);complete();if(s.async)xhr=null;}};if(s.async){var ival=setInterval(onreadystatechange,13);if(s.timeout>0)setTimeout(function(){if(xhr){xhr.abort();if(!requestDone)onreadystatechange("timeout");}},s.timeout);}try{xhr.send(s.data);}catch(e){jQuery.handleError(s,xhr,null,e);}if(!s.async)onreadystatechange();function success(){if(s.success)s.success(data,status);if(s.global)jQuery.event.trigger("ajaxSuccess",[xhr,s]);}function complete(){if(s.complete)s.complete(xhr,status);if(s.global)jQuery.event.trigger("ajaxComplete",[xhr,s]);if(s.global&&!--jQuery.active)jQuery.event.trigger("ajaxStop");}return xhr;},handleError:function(s,xhr,status,e){if(s.error)s.error(xhr,status,e);if(s.global)jQuery.event.trigger("ajaxError",[xhr,s,e]);},active:0,httpSuccess:function(xhr){try{return!xhr.status&&location.protocol=="file:"||(xhr.status>=200&&xhr.status<300)||xhr.status==304||xhr.status==1223||jQuery.browser.safari&&xhr.status==undefined;}catch(e){}return false;},httpNotModified:function(xhr,url){try{var xhrRes=xhr.getResponseHeader("Last-Modified");return xhr.status==304||xhrRes==jQuery.lastModified[url]||jQuery.browser.safari&&xhr.status==undefined;}catch(e){}return false;},httpData:function(xhr,type,filter){var ct=xhr.getResponseHeader("content-type"),xml=type=="xml"||!type&&ct&&ct.indexOf("xml")>=0,data=xml?xhr.responseXML:xhr.responseText;if(xml&&data.documentElement.tagName=="parsererror")throw"parsererror";if(filter)data=filter(data,type);if(type=="script")jQuery.globalEval(data);if(type=="json")data=eval("("+data+")");return data;},param:function(a){var s=[];if(a.constructor==Array||a.jquery)jQuery.each(a,function(){s.push(encodeURIComponent(this.name)+"="+encodeURIComponent(this.value));});else
-for(var j in a)if(a[j]&&a[j].constructor==Array)jQuery.each(a[j],function(){s.push(encodeURIComponent(j)+"="+encodeURIComponent(this));});else
-s.push(encodeURIComponent(j)+"="+encodeURIComponent(jQuery.isFunction(a[j])?a[j]():a[j]));return s.join("&").replace(/%20/g,"+");}});jQuery.fn.extend({show:function(speed,callback){return speed?this.animate({height:"show",width:"show",opacity:"show"},speed,callback):this.filter(":hidden").each(function(){this.style.display=this.oldblock||"";if(jQuery.css(this,"display")=="none"){var elem=jQuery("<"+this.tagName+" />").appendTo("body");this.style.display=elem.css("display");if(this.style.display=="none")this.style.display="block";elem.remove();}}).end();},hide:function(speed,callback){return speed?this.animate({height:"hide",width:"hide",opacity:"hide"},speed,callback):this.filter(":visible").each(function(){this.oldblock=this.oldblock||jQuery.css(this,"display");this.style.display="none";}).end();},_toggle:jQuery.fn.toggle,toggle:function(fn,fn2){return jQuery.isFunction(fn)&&jQuery.isFunction(fn2)?this._toggle.apply(this,arguments):fn?this.animate({height:"toggle",width:"toggle",opacity:"toggle"},fn,fn2):this.each(function(){jQuery(this)[jQuery(this).is(":hidden")?"show":"hide"]();});},slideDown:function(speed,callback){return this.animate({height:"show"},speed,callback);},slideUp:function(speed,callback){return this.animate({height:"hide"},speed,callback);},slideToggle:function(speed,callback){return this.animate({height:"toggle"},speed,callback);},fadeIn:function(speed,callback){return this.animate({opacity:"show"},speed,callback);},fadeOut:function(speed,callback){return this.animate({opacity:"hide"},speed,callback);},fadeTo:function(speed,to,callback){return this.animate({opacity:to},speed,callback);},animate:function(prop,speed,easing,callback){var optall=jQuery.speed(speed,easing,callback);return this[optall.queue===false?"each":"queue"](function(){if(this.nodeType!=1)return false;var opt=jQuery.extend({},optall),p,hidden=jQuery(this).is(":hidden"),self=this;for(p in prop){if(prop[p]=="hide"&&hidden||prop[p]=="show"&&!hidden)return opt.complete.call(this);if(p=="height"||p=="width"){opt.display=jQuery.css(this,"display");opt.overflow=this.style.overflow;}}if(opt.overflow!=null)this.style.overflow="hidden";opt.curAnim=jQuery.extend({},prop);jQuery.each(prop,function(name,val){var e=new jQuery.fx(self,opt,name);if(/toggle|show|hide/.test(val))e[val=="toggle"?hidden?"show":"hide":val](prop);else{var parts=val.toString().match(/^([+-]=)?([\d+-.]+)(.*)$/),start=e.cur(true)||0;if(parts){var end=parseFloat(parts[2]),unit=parts[3]||"px";if(unit!="px"){self.style[name]=(end||1)+unit;start=((end||1)/e.cur(true))*start;self.style[name]=start+unit;}if(parts[1])end=((parts[1]=="-="?-1:1)*end)+start;e.custom(start,end,unit);}else
-e.custom(start,val,"");}});return true;});},queue:function(type,fn){if(jQuery.isFunction(type)||(type&&type.constructor==Array)){fn=type;type="fx";}if(!type||(typeof type=="string"&&!fn))return queue(this[0],type);return this.each(function(){if(fn.constructor==Array)queue(this,type,fn);else{queue(this,type).push(fn);if(queue(this,type).length==1)fn.call(this);}});},stop:function(clearQueue,gotoEnd){var timers=jQuery.timers;if(clearQueue)this.queue([]);this.each(function(){for(var i=timers.length-1;i>=0;i--)if(timers[i].elem==this){if(gotoEnd)timers[i](true);timers.splice(i,1);}});if(!gotoEnd)this.dequeue();return this;}});var queue=function(elem,type,array){if(elem){type=type||"fx";var q=jQuery.data(elem,type+"queue");if(!q||array)q=jQuery.data(elem,type+"queue",jQuery.makeArray(array));}return q;};jQuery.fn.dequeue=function(type){type=type||"fx";return this.each(function(){var q=queue(this,type);q.shift();if(q.length)q[0].call(this);});};jQuery.extend({speed:function(speed,easing,fn){var opt=speed&&speed.constructor==Object?speed:{complete:fn||!fn&&easing||jQuery.isFunction(speed)&&speed,duration:speed,easing:fn&&easing||easing&&easing.constructor!=Function&&easing};opt.duration=(opt.duration&&opt.duration.constructor==Number?opt.duration:jQuery.fx.speeds[opt.duration])||jQuery.fx.speeds.def;opt.old=opt.complete;opt.complete=function(){if(opt.queue!==false)jQuery(this).dequeue();if(jQuery.isFunction(opt.old))opt.old.call(this);};return opt;},easing:{linear:function(p,n,firstNum,diff){return firstNum+diff*p;},swing:function(p,n,firstNum,diff){return((-Math.cos(p*Math.PI)/2)+0.5)*diff+firstNum;}},timers:[],timerId:null,fx:function(elem,options,prop){this.options=options;this.elem=elem;this.prop=prop;if(!options.orig)options.orig={};}});jQuery.fx.prototype={update:function(){if(this.options.step)this.options.step.call(this.elem,this.now,this);(jQuery.fx.step[this.prop]||jQuery.fx.step._default)(this);if(this.prop=="height"||this.prop=="width")this.elem.style.display="block";},cur:function(force){if(this.elem[this.prop]!=null&&this.elem.style[this.prop]==null)return this.elem[this.prop];var r=parseFloat(jQuery.css(this.elem,this.prop,force));return r&&r>-10000?r:parseFloat(jQuery.curCSS(this.elem,this.prop))||0;},custom:function(from,to,unit){this.startTime=now();this.start=from;this.end=to;this.unit=unit||this.unit||"px";this.now=this.start;this.pos=this.state=0;this.update();var self=this;function t(gotoEnd){return self.step(gotoEnd);}t.elem=this.elem;jQuery.timers.push(t);if(jQuery.timerId==null){jQuery.timerId=setInterval(function(){var timers=jQuery.timers;for(var i=0;i<timers.length;i++)if(!timers[i]())timers.splice(i--,1);if(!timers.length){clearInterval(jQuery.timerId);jQuery.timerId=null;}},13);}},show:function(){this.options.orig[this.prop]=jQuery.attr(this.elem.style,this.prop);this.options.show=true;this.custom(0,this.cur());if(this.prop=="width"||this.prop=="height")this.elem.style[this.prop]="1px";jQuery(this.elem).show();},hide:function(){this.options.orig[this.prop]=jQuery.attr(this.elem.style,this.prop);this.options.hide=true;this.custom(this.cur(),0);},step:function(gotoEnd){var t=now();if(gotoEnd||t>this.options.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;var done=true;for(var i in this.options.curAnim)if(this.options.curAnim[i]!==true)done=false;if(done){if(this.options.display!=null){this.elem.style.overflow=this.options.overflow;this.elem.style.display=this.options.display;if(jQuery.css(this.elem,"display")=="none")this.elem.style.display="block";}if(this.options.hide)this.elem.style.display="none";if(this.options.hide||this.options.show)for(var p in this.options.curAnim)jQuery.attr(this.elem.style,p,this.options.orig[p]);}if(done)this.options.complete.call(this.elem);return false;}else{var n=t-this.startTime;this.state=n/this.options.duration;this.pos=jQuery.easing[this.options.easing||(jQuery.easing.swing?"swing":"linear")](this.state,n,0,1,this.options.duration);this.now=this.start+((this.end-this.start)*this.pos);this.update();}return true;}};jQuery.extend(jQuery.fx,{speeds:{slow:600,fast:200,def:400},step:{scrollLeft:function(fx){fx.elem.scrollLeft=fx.now;},scrollTop:function(fx){fx.elem.scrollTop=fx.now;},opacity:function(fx){jQuery.attr(fx.elem.style,"opacity",fx.now);},_default:function(fx){fx.elem.style[fx.prop]=fx.now+fx.unit;}}});jQuery.fn.offset=function(){var left=0,top=0,elem=this[0],results;if(elem)with(jQuery.browser){var parent=elem.parentNode,offsetChild=elem,offsetParent=elem.offsetParent,doc=elem.ownerDocument,safari2=safari&&parseInt(version)<522&&!/adobeair/i.test(userAgent),css=jQuery.curCSS,fixed=css(elem,"position")=="fixed";if(elem.getBoundingClientRect){var box=elem.getBoundingClientRect();add(box.left+Math.max(doc.documentElement.scrollLeft,doc.body.scrollLeft),box.top+Math.max(doc.documentElement.scrollTop,doc.body.scrollTop));add(-doc.documentElement.clientLeft,-doc.documentElement.clientTop);}else{add(elem.offsetLeft,elem.offsetTop);while(offsetParent){add(offsetParent.offsetLeft,offsetParent.offsetTop);if(mozilla&&!/^t(able|d|h)$/i.test(offsetParent.tagName)||safari&&!safari2)border(offsetParent);if(!fixed&&css(offsetParent,"position")=="fixed")fixed=true;offsetChild=/^body$/i.test(offsetParent.tagName)?offsetChild:offsetParent;offsetParent=offsetParent.offsetParent;}while(parent&&parent.tagName&&!/^body|html$/i.test(parent.tagName)){if(!/^inline|table.*$/i.test(css(parent,"display")))add(-parent.scrollLeft,-parent.scrollTop);if(mozilla&&css(parent,"overflow")!="visible")border(parent);parent=parent.parentNode;}if((safari2&&(fixed||css(offsetChild,"position")=="absolute"))||(mozilla&&css(offsetChild,"position")!="absolute"))add(-doc.body.offsetLeft,-doc.body.offsetTop);if(fixed)add(Math.max(doc.documentElement.scrollLeft,doc.body.scrollLeft),Math.max(doc.documentElement.scrollTop,doc.body.scrollTop));}results={top:top,left:left};}function border(elem){add(jQuery.curCSS(elem,"borderLeftWidth",true),jQuery.curCSS(elem,"borderTopWidth",true));}function add(l,t){left+=parseInt(l,10)||0;top+=parseInt(t,10)||0;}return results;};jQuery.fn.extend({position:function(){var left=0,top=0,results;if(this[0]){var offsetParent=this.offsetParent(),offset=this.offset(),parentOffset=/^body|html$/i.test(offsetParent[0].tagName)?{top:0,left:0}:offsetParent.offset();offset.top-=num(this,'marginTop');offset.left-=num(this,'marginLeft');parentOffset.top+=num(offsetParent,'borderTopWidth');parentOffset.left+=num(offsetParent,'borderLeftWidth');results={top:offset.top-parentOffset.top,left:offset.left-parentOffset.left};}return results;},offsetParent:function(){var offsetParent=this[0].offsetParent;while(offsetParent&&(!/^body|html$/i.test(offsetParent.tagName)&&jQuery.css(offsetParent,'position')=='static'))offsetParent=offsetParent.offsetParent;return jQuery(offsetParent);}});jQuery.each(['Left','Top'],function(i,name){var method='scroll'+name;jQuery.fn[method]=function(val){if(!this[0])return;return val!=undefined?this.each(function(){this==window||this==document?window.scrollTo(!i?val:jQuery(window).scrollLeft(),i?val:jQuery(window).scrollTop()):this[method]=val;}):this[0]==window||this[0]==document?self[i?'pageYOffset':'pageXOffset']||jQuery.boxModel&&document.documentElement[method]||document.body[method]:this[0][method];};});jQuery.each(["Height","Width"],function(i,name){var tl=i?"Left":"Top",br=i?"Right":"Bottom";jQuery.fn["inner"+name]=function(){return this[name.toLowerCase()]()+num(this,"padding"+tl)+num(this,"padding"+br);};jQuery.fn["outer"+name]=function(margin){return this["inner"+name]()+num(this,"border"+tl+"Width")+num(this,"border"+br+"Width")+(margin?num(this,"margin"+tl)+num(this,"margin"+br):0);};});})(); \ No newline at end of file
+(function(a,b){function cv(a){return f.isWindow(a)?a:a.nodeType===9?a.defaultView||a.parentWindow:!1}function cs(a){if(!cg[a]){var b=c.body,d=f("<"+a+">").appendTo(b),e=d.css("display");d.remove();if(e==="none"||e===""){ch||(ch=c.createElement("iframe"),ch.frameBorder=ch.width=ch.height=0),b.appendChild(ch);if(!ci||!ch.createElement)ci=(ch.contentWindow||ch.contentDocument).document,ci.write((c.compatMode==="CSS1Compat"?"<!doctype html>":"")+"<html><body>"),ci.close();d=ci.createElement(a),ci.body.appendChild(d),e=f.css(d,"display"),b.removeChild(ch)}cg[a]=e}return cg[a]}function cr(a,b){var c={};f.each(cm.concat.apply([],cm.slice(0,b)),function(){c[this]=a});return c}function cq(){cn=b}function cp(){setTimeout(cq,0);return cn=f.now()}function cf(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}function ce(){try{return new a.XMLHttpRequest}catch(b){}}function b$(a,c){a.dataFilter&&(c=a.dataFilter(c,a.dataType));var d=a.dataTypes,e={},g,h,i=d.length,j,k=d[0],l,m,n,o,p;for(g=1;g<i;g++){if(g===1)for(h in a.converters)typeof h=="string"&&(e[h.toLowerCase()]=a.converters[h]);l=k,k=d[g];if(k==="*")k=l;else if(l!=="*"&&l!==k){m=l+" "+k,n=e[m]||e["* "+k];if(!n){p=b;for(o in e){j=o.split(" ");if(j[0]===l||j[0]==="*"){p=e[j[1]+" "+k];if(p){o=e[o],o===!0?n=p:p===!0&&(n=o);break}}}}!n&&!p&&f.error("No conversion from "+m.replace(" "," to ")),n!==!0&&(c=n?n(c):p(o(c)))}}return c}function bZ(a,c,d){var e=a.contents,f=a.dataTypes,g=a.responseFields,h,i,j,k;for(i in g)i in d&&(c[g[i]]=d[i]);while(f[0]==="*")f.shift(),h===b&&(h=a.mimeType||c.getResponseHeader("content-type"));if(h)for(i in e)if(e[i]&&e[i].test(h)){f.unshift(i);break}if(f[0]in d)j=f[0];else{for(i in d){if(!f[0]||a.converters[i+" "+f[0]]){j=i;break}k||(k=i)}j=j||k}if(j){j!==f[0]&&f.unshift(j);return d[j]}}function bY(a,b,c,d){if(f.isArray(b))f.each(b,function(b,e){c||bC.test(a)?d(a,e):bY(a+"["+(typeof e=="object"||f.isArray(e)?b:"")+"]",e,c,d)});else if(!c&&b!=null&&typeof b=="object")for(var e in b)bY(a+"["+e+"]",b[e],c,d);else d(a,b)}function bX(a,c,d,e,f,g){f=f||c.dataTypes[0],g=g||{},g[f]=!0;var h=a[f],i=0,j=h?h.length:0,k=a===bR,l;for(;i<j&&(k||!l);i++)l=h[i](c,d,e),typeof l=="string"&&(!k||g[l]?l=b:(c.dataTypes.unshift(l),l=bX(a,c,d,e,l,g)));(k||!l)&&!g["*"]&&(l=bX(a,c,d,e,"*",g));return l}function bW(a){return function(b,c){typeof b!="string"&&(c=b,b="*");if(f.isFunction(c)){var d=b.toLowerCase().split(bN),e=0,g=d.length,h,i,j;for(;e<g;e++)h=d[e],j=/^\+/.test(h),j&&(h=h.substr(1)||"*"),i=a[h]=a[h]||[],i[j?"unshift":"push"](c)}}}function bA(a,b,c){var d=b==="width"?a.offsetWidth:a.offsetHeight,e=b==="width"?bv:bw;if(d>0){c!=="border"&&f.each(e,function(){c||(d-=parseFloat(f.css(a,"padding"+this))||0),c==="margin"?d+=parseFloat(f.css(a,c+this))||0:d-=parseFloat(f.css(a,"border"+this+"Width"))||0});return d+"px"}d=bx(a,b,b);if(d<0||d==null)d=a.style[b]||0;d=parseFloat(d)||0,c&&f.each(e,function(){d+=parseFloat(f.css(a,"padding"+this))||0,c!=="padding"&&(d+=parseFloat(f.css(a,"border"+this+"Width"))||0),c==="margin"&&(d+=parseFloat(f.css(a,c+this))||0)});return d+"px"}function bm(a,b){b.src?f.ajax({url:b.src,async:!1,dataType:"script"}):f.globalEval((b.text||b.textContent||b.innerHTML||"").replace(be,"/*$0*/")),b.parentNode&&b.parentNode.removeChild(b)}function bl(a){f.nodeName(a,"input")?bk(a):"getElementsByTagName"in a&&f.grep(a.getElementsByTagName("input"),bk)}function bk(a){if(a.type==="checkbox"||a.type==="radio")a.defaultChecked=a.checked}function bj(a){return"getElementsByTagName"in a?a.getElementsByTagName("*"):"querySelectorAll"in a?a.querySelectorAll("*"):[]}function bi(a,b){var c;if(b.nodeType===1){b.clearAttributes&&b.clearAttributes(),b.mergeAttributes&&b.mergeAttributes(a),c=b.nodeName.toLowerCase();if(c==="object")b.outerHTML=a.outerHTML;else if(c!=="input"||a.type!=="checkbox"&&a.type!=="radio"){if(c==="option")b.selected=a.defaultSelected;else if(c==="input"||c==="textarea")b.defaultValue=a.defaultValue}else a.checked&&(b.defaultChecked=b.checked=a.checked),b.value!==a.value&&(b.value=a.value);b.removeAttribute(f.expando)}}function bh(a,b){if(b.nodeType===1&&!!f.hasData(a)){var c=f.expando,d=f.data(a),e=f.data(b,d);if(d=d[c]){var g=d.events;e=e[c]=f.extend({},d);if(g){delete e.handle,e.events={};for(var h in g)for(var i=0,j=g[h].length;i<j;i++)f.event.add(b,h+(g[h][i].namespace?".":"")+g[h][i].namespace,g[h][i],g[h][i].data)}}}}function bg(a,b){return f.nodeName(a,"table")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function W(a,b,c){b=b||0;if(f.isFunction(b))return f.grep(a,function(a,d){var e=!!b.call(a,d,a);return e===c});if(b.nodeType)return f.grep(a,function(a,d){return a===b===c});if(typeof b=="string"){var d=f.grep(a,function(a){return a.nodeType===1});if(R.test(b))return f.filter(b,d,!c);b=f.filter(b,d)}return f.grep(a,function(a,d){return f.inArray(a,b)>=0===c})}function V(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function N(a,b){return(a&&a!=="*"?a+".":"")+b.replace(z,"`").replace(A,"&")}function M(a){var b,c,d,e,g,h,i,j,k,l,m,n,o,p=[],q=[],r=f._data(this,"events");if(!(a.liveFired===this||!r||!r.live||a.target.disabled||a.button&&a.type==="click")){a.namespace&&(n=new RegExp("(^|\\.)"+a.namespace.split(".").join("\\.(?:.*\\.)?")+"(\\.|$)")),a.liveFired=this;var s=r.live.slice(0);for(i=0;i<s.length;i++)g=s[i],g.origType.replace(x,"")===a.type?q.push(g.selector):s.splice(i--,1);e=f(a.target).closest(q,a.currentTarget);for(j=0,k=e.length;j<k;j++){m=e[j];for(i=0;i<s.length;i++){g=s[i];if(m.selector===g.selector&&(!n||n.test(g.namespace))&&!m.elem.disabled){h=m.elem,d=null;if(g.preType==="mouseenter"||g.preType==="mouseleave")a.type=g.preType,d=f(a.relatedTarget).closest(g.selector)[0],d&&f.contains(h,d)&&(d=h);(!d||d!==h)&&p.push({elem:h,handleObj:g,level:m.level})}}}for(j=0,k=p.length;j<k;j++){e=p[j];if(c&&e.level>c)break;a.currentTarget=e.elem,a.data=e.handleObj.data,a.handleObj=e.handleObj,o=e.handleObj.origHandler.apply(e.elem,arguments);if(o===!1||a.isPropagationStopped()){c=e.level,o===!1&&(b=!1);if(a.isImmediatePropagationStopped())break}}return b}}function K(a,c,d){var e=f.extend({},d[0]);e.type=a,e.originalEvent={},e.liveFired=b,f.event.handle.call(c,e),e.isDefaultPrevented()&&d[0].preventDefault()}function E(){return!0}function D(){return!1}function m(a,c,d){var e=c+"defer",g=c+"queue",h=c+"mark",i=f.data(a,e,b,!0);i&&(d==="queue"||!f.data(a,g,b,!0))&&(d==="mark"||!f.data(a,h,b,!0))&&setTimeout(function(){!f.data(a,g,b,!0)&&!f.data(a,h,b,!0)&&(f.removeData(a,e,!0),i.resolve())},0)}function l(a){for(var b in a)if(b!=="toJSON")return!1;return!0}function k(a,c,d){if(d===b&&a.nodeType===1){var e="data-"+c.replace(j,"$1-$2").toLowerCase();d=a.getAttribute(e);if(typeof d=="string"){try{d=d==="true"?!0:d==="false"?!1:d==="null"?null:f.isNaN(d)?i.test(d)?f.parseJSON(d):d:parseFloat(d)}catch(g){}f.data(a,c,d)}else d=b}return d}var c=a.document,d=a.navigator,e=a.location,f=function(){function J(){if(!e.isReady){try{c.documentElement.doScroll("left")}catch(a){setTimeout(J,1);return}e.ready()}}var e=function(a,b){return new e.fn.init(a,b,h)},f=a.jQuery,g=a.$,h,i=/^(?:[^<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,j=/\S/,k=/^\s+/,l=/\s+$/,m=/\d/,n=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,o=/^[\],:{}\s]*$/,p=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,q=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,r=/(?:^|:|,)(?:\s*\[)+/g,s=/(webkit)[ \/]([\w.]+)/,t=/(opera)(?:.*version)?[ \/]([\w.]+)/,u=/(msie) ([\w.]+)/,v=/(mozilla)(?:.*? rv:([\w.]+))?/,w=/-([a-z])/ig,x=function(a,b){return b.toUpperCase()},y=d.userAgent,z,A,B,C=Object.prototype.toString,D=Object.prototype.hasOwnProperty,E=Array.prototype.push,F=Array.prototype.slice,G=String.prototype.trim,H=Array.prototype.indexOf,I={};e.fn=e.prototype={constructor:e,init:function(a,d,f){var g,h,j,k;if(!a)return this;if(a.nodeType){this.context=this[0]=a,this.length=1;return this}if(a==="body"&&!d&&c.body){this.context=c,this[0]=c.body,this.selector=a,this.length=1;return this}if(typeof a=="string"){a.charAt(0)!=="<"||a.charAt(a.length-1)!==">"||a.length<3?g=i.exec(a):g=[null,a,null];if(g&&(g[1]||!d)){if(g[1]){d=d instanceof e?d[0]:d,k=d?d.ownerDocument||d:c,j=n.exec(a),j?e.isPlainObject(d)?(a=[c.createElement(j[1])],e.fn.attr.call(a,d,!0)):a=[k.createElement(j[1])]:(j=e.buildFragment([g[1]],[k]),a=(j.cacheable?e.clone(j.fragment):j.fragment).childNodes);return e.merge(this,a)}h=c.getElementById(g[2]);if(h&&h.parentNode){if(h.id!==g[2])return f.find(a);this.length=1,this[0]=h}this.context=c,this.selector=a;return this}return!d||d.jquery?(d||f).find(a):this.constructor(d).find(a)}if(e.isFunction(a))return f.ready(a);a.selector!==b&&(this.selector=a.selector,this.context=a.context);return e.makeArray(a,this)},selector:"",jquery:"1.6.2",length:0,size:function(){return this.length},toArray:function(){return F.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this[this.length+a]:this[a]},pushStack:function(a,b,c){var d=this.constructor();e.isArray(a)?E.apply(d,a):e.merge(d,a),d.prevObject=this,d.context=this.context,b==="find"?d.selector=this.selector+(this.selector?" ":"")+c:b&&(d.selector=this.selector+"."+b+"("+c+")");return d},each:function(a,b){return e.each(this,a,b)},ready:function(a){e.bindReady(),A.done(a);return this},eq:function(a){return a===-1?this.slice(a):this.slice(a,+a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(F.apply(this,arguments),"slice",F.call(arguments).join(","))},map:function(a){return this.pushStack(e.map(this,function(b,c){return a.call(b,c,b)}))},end:function(){return this.prevObject||this.constructor(null)},push:E,sort:[].sort,splice:[].splice},e.fn.init.prototype=e.fn,e.extend=e.fn.extend=function(){var a,c,d,f,g,h,i=arguments[0]||{},j=1,k=arguments.length,l=!1;typeof i=="boolean"&&(l=i,i=arguments[1]||{},j=2),typeof i!="object"&&!e.isFunction(i)&&(i={}),k===j&&(i=this,--j);for(;j<k;j++)if((a=arguments[j])!=null)for(c in a){d=i[c],f=a[c];if(i===f)continue;l&&f&&(e.isPlainObject(f)||(g=e.isArray(f)))?(g?(g=!1,h=d&&e.isArray(d)?d:[]):h=d&&e.isPlainObject(d)?d:{},i[c]=e.extend(l,h,f)):f!==b&&(i[c]=f)}return i},e.extend({noConflict:function(b){a.$===e&&(a.$=g),b&&a.jQuery===e&&(a.jQuery=f);return e},isReady:!1,readyWait:1,holdReady:function(a){a?e.readyWait++:e.ready(!0)},ready:function(a){if(a===!0&&!--e.readyWait||a!==!0&&!e.isReady){if(!c.body)return setTimeout(e.ready,1);e.isReady=!0;if(a!==!0&&--e.readyWait>0)return;A.resolveWith(c,[e]),e.fn.trigger&&e(c).trigger("ready").unbind("ready")}},bindReady:function(){if(!A){A=e._Deferred();if(c.readyState==="complete")return setTimeout(e.ready,1);if(c.addEventListener)c.addEventListener("DOMContentLoaded",B,!1),a.addEventListener("load",e.ready,!1);else if(c.attachEvent){c.attachEvent("onreadystatechange",B),a.attachEvent("onload",e.ready);var b=!1;try{b=a.frameElement==null}catch(d){}c.documentElement.doScroll&&b&&J()}}},isFunction:function(a){return e.type(a)==="function"},isArray:Array.isArray||function(a){return e.type(a)==="array"},isWindow:function(a){return a&&typeof a=="object"&&"setInterval"in a},isNaN:function(a){return a==null||!m.test(a)||isNaN(a)},type:function(a){return a==null?String(a):I[C.call(a)]||"object"},isPlainObject:function(a){if(!a||e.type(a)!=="object"||a.nodeType||e.isWindow(a))return!1;if(a.constructor&&!D.call(a,"constructor")&&!D.call(a.constructor.prototype,"isPrototypeOf"))return!1;var c;for(c in a);return c===b||D.call(a,c)},isEmptyObject:function(a){for(var b in a)return!1;return!0},error:function(a){throw a},parseJSON:function(b){if(typeof b!="string"||!b)return null;b=e.trim(b);if(a.JSON&&a.JSON.parse)return a.JSON.parse(b);if(o.test(b.replace(p,"@").replace(q,"]").replace(r,"")))return(new Function("return "+b))();e.error("Invalid JSON: "+b)},parseXML:function(b,c,d){a.DOMParser?(d=new DOMParser,c=d.parseFromString(b,"text/xml")):(c=new ActiveXObject("Microsoft.XMLDOM"),c.async="false",c.loadXML(b)),d=c.documentElement,(!d||!d.nodeName||d.nodeName==="parsererror")&&e.error("Invalid XML: "+b);return c},noop:function(){},globalEval:function(b){b&&j.test(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},camelCase:function(a){return a.replace(w,x)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase()},each:function(a,c,d){var f,g=0,h=a.length,i=h===b||e.isFunction(a);if(d){if(i){for(f in a)if(c.apply(a[f],d)===!1)break}else for(;g<h;)if(c.apply(a[g++],d)===!1)break}else if(i){for(f in a)if(c.call(a[f],f,a[f])===!1)break}else for(;g<h;)if(c.call(a[g],g,a[g++])===!1)break;return a},trim:G?function(a){return a==null?"":G.call(a)}:function(a){return a==null?"":(a+"").replace(k,"").replace(l,"")},makeArray:function(a,b){var c=b||[];if(a!=null){var d=e.type(a);a.length==null||d==="string"||d==="function"||d==="regexp"||e.isWindow(a)?E.call(c,a):e.merge(c,a)}return c},inArray:function(a,b){if(H)return H.call(b,a);for(var c=0,d=b.length;c<d;c++)if(b[c]===a)return c;return-1},merge:function(a,c){var d=a.length,e=0;if(typeof c.length=="number")for(var f=c.length;e<f;e++)a[d++]=c[e];else while(c[e]!==b)a[d++]=c[e++];a.length=d;return a},grep:function(a,b,c){var d=[],e;c=!!c;for(var f=0,g=a.length;f<g;f++)e=!!b(a[f],f),c!==e&&d.push(a[f]);return d},map:function(a,c,d){var f,g,h=[],i=0,j=a.length,k=a instanceof e||j!==b&&typeof j=="number"&&(j>0&&a[0]&&a[j-1]||j===0||e.isArray(a));if(k)for(;i<j;i++)f=c(a[i],i,d),f!=null&&(h[h.length]=f);else for(g in a)f=c(a[g],g,d),f!=null&&(h[h.length]=f);return h.concat.apply([],h)},guid:1,proxy:function(a,c){if(typeof c=="string"){var d=a[c];c=a,a=d}if(!e.isFunction(a))return b;var f=F.call(arguments,2),g=function(){return a.apply(c,f.concat(F.call(arguments)))};g.guid=a.guid=a.guid||g.guid||e.guid++;return g},access:function(a,c,d,f,g,h){var i=a.length;if(typeof c=="object"){for(var j in c)e.access(a,j,c[j],f,g,d);return a}if(d!==b){f=!h&&f&&e.isFunction(d);for(var k=0;k<i;k++)g(a[k],c,f?d.call(a[k],k,g(a[k],c)):d,h);return a}return i?g(a[0],c):b},now:function(){return(new Date).getTime()},uaMatch:function(a){a=a.toLowerCase();var b=s.exec(a)||t.exec(a)||u.exec(a)||a.indexOf("compatible")<0&&v.exec(a)||[];return{browser:b[1]||"",version:b[2]||"0"}},sub:function(){function a(b,c){return new a.fn.init(b,c)}e.extend(!0,a,this),a.superclass=this,a.fn=a.prototype=this(),a.fn.constructor=a,a.sub=this.sub,a.fn.init=function(d,f){f&&f instanceof e&&!(f instanceof a)&&(f=a(f));return e.fn.init.call(this,d,f,b)},a.fn.init.prototype=a.fn;var b=a(c);return a},browser:{}}),e.each("Boolean Number String Function Array Date RegExp Object".split(" "),function(a,b){I["[object "+b+"]"]=b.toLowerCase()}),z=e.uaMatch(y),z.browser&&(e.browser[z.browser]=!0,e.browser.version=z.version),e.browser.webkit&&(e.browser.safari=!0),j.test(" ")&&(k=/^[\s\xA0]+/,l=/[\s\xA0]+$/),h=e(c),c.addEventListener?B=function(){c.removeEventListener("DOMContentLoaded",B,!1),e.ready()}:c.attachEvent&&(B=function(){c.readyState==="complete"&&(c.detachEvent("onreadystatechange",B),e.ready())});return e}(),g="done fail isResolved isRejected promise then always pipe".split(" "),h=[].slice;f.extend({_Deferred:function(){var a=[],b,c,d,e={done:function(){if(!d){var c=arguments,g,h,i,j,k;b&&(k=b,b=0);for(g=0,h=c.length;g<h;g++)i=c[g],j=f.type(i),j==="array"?e.done.apply(e,i):j==="function"&&a.push(i);k&&e.resolveWith(k[0],k[1])}return this},resolveWith:function(e,f){if(!d&&!b&&!c){f=f||[],c=1;try{while(a[0])a.shift().apply(e,f)}finally{b=[e,f],c=0}}return this},resolve:function(){e.resolveWith(this,arguments);return this},isResolved:function(){return!!c||!!b},cancel:function(){d=1,a=[];return this}};return e},Deferred:function(a){var b=f._Deferred(),c=f._Deferred(),d;f.extend(b,{then:function(a,c){b.done(a).fail(c);return this},always:function(){return b.done.apply(b,arguments).fail.apply(this,arguments)},fail:c.done,rejectWith:c.resolveWith,reject:c.resolve,isRejected:c.isResolved,pipe:function(a,c){return f.Deferred(function(d){f.each({done:[a,"resolve"],fail:[c,"reject"]},function(a,c){var e=c[0],g=c[1],h;f.isFunction(e)?b[a](function(){h=e.apply(this,arguments),h&&f.isFunction(h.promise)?h.promise().then(d.resolve,d.reject):d[g](h)}):b[a](d[g])})}).promise()},promise:function(a){if(a==null){if(d)return d;d=a={}}var c=g.length;while(c--)a[g[c]]=b[g[c]];return a}}),b.done(c.cancel).fail(b.cancel),delete b.cancel,a&&a.call(b,b);return b},when:function(a){function i(a){return function(c){b[a]=arguments.length>1?h.call(arguments,0):c,--e||g.resolveWith(g,h.call(b,0))}}var b=arguments,c=0,d=b.length,e=d,g=d<=1&&a&&f.isFunction(a.promise)?a:f.Deferred();if(d>1){for(;c<d;c++)b[c]&&f.isFunction(b[c].promise)?b[c].promise().then(i(c),g.reject):--e;e||g.resolveWith(g,b)}else g!==a&&g.resolveWith(g,d?[a]:[]);return g.promise()}}),f.support=function(){var a=c.createElement("div"),b=c.documentElement,d,e,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u;a.setAttribute("className","t"),a.innerHTML=" <link/><table></table><a href='/a' style='top:1px;float:left;opacity:.55;'>a</a><input type='checkbox'/>",d=a.getElementsByTagName("*"),e=a.getElementsByTagName("a")[0];if(!d||!d.length||!e)return{};g=c.createElement("select"),h=g.appendChild(c.createElement("option")),i=a.getElementsByTagName("input")[0],k={leadingWhitespace:a.firstChild.nodeType===3,tbody:!a.getElementsByTagName("tbody").length,htmlSerialize:!!a.getElementsByTagName("link").length,style:/top/.test(e.getAttribute("style")),hrefNormalized:e.getAttribute("href")==="/a",opacity:/^0.55$/.test(e.style.opacity),cssFloat:!!e.style.cssFloat,checkOn:i.value==="on",optSelected:h.selected,getSetAttribute:a.className!=="t",submitBubbles:!0,changeBubbles:!0,focusinBubbles:!1,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0},i.checked=!0,k.noCloneChecked=i.cloneNode(!0).checked,g.disabled=!0,k.optDisabled=!h.disabled;try{delete a.test}catch(v){k.deleteExpando=!1}!a.addEventListener&&a.attachEvent&&a.fireEvent&&(a.attachEvent("onclick",function(){k.noCloneEvent=!1}),a.cloneNode(!0).fireEvent("onclick")),i=c.createElement("input"),i.value="t",i.setAttribute("type","radio"),k.radioValue=i.value==="t",i.setAttribute("checked","checked"),a.appendChild(i),l=c.createDocumentFragment(),l.appendChild(a.firstChild),k.checkClone=l.cloneNode(!0).cloneNode(!0).lastChild.checked,a.innerHTML="",a.style.width=a.style.paddingLeft="1px",m=c.getElementsByTagName("body")[0],o=c.createElement(m?"div":"body"),p={visibility:"hidden",width:0,height:0,border:0,margin:0},m&&f.extend(p,{position:"absolute",left:-1e3,top:-1e3});for(t in p)o.style[t]=p[t];o.appendChild(a),n=m||b,n.insertBefore(o,n.firstChild),k.appendChecked=i.checked,k.boxModel=a.offsetWidth===2,"zoom"in a.style&&(a.style.display="inline",a.style.zoom=1,k.inlineBlockNeedsLayout=a.offsetWidth===2,a.style.display="",a.innerHTML="<div style='width:4px;'></div>",k.shrinkWrapBlocks=a.offsetWidth!==2),a.innerHTML="<table><tr><td style='padding:0;border:0;display:none'></td><td>t</td></tr></table>",q=a.getElementsByTagName("td"),u=q[0].offsetHeight===0,q[0].style.display="",q[1].style.display="none",k.reliableHiddenOffsets=u&&q[0].offsetHeight===0,a.innerHTML="",c.defaultView&&c.defaultView.getComputedStyle&&(j=c.createElement("div"),j.style.width="0",j.style.marginRight="0",a.appendChild(j),k.reliableMarginRight=(parseInt((c.defaultView.getComputedStyle(j,null)||{marginRight:0}).marginRight,10)||0)===0),o.innerHTML="",n.removeChild(o);if(a.attachEvent)for(t in{submit:1,change:1,focusin:1})s="on"+t,u=s in a,u||(a.setAttribute(s,"return;"),u=typeof a[s]=="function"),k[t+"Bubbles"]=u;o=l=g=h=m=j=a=i=null;return k}(),f.boxModel=f.support.boxModel;var i=/^(?:\{.*\}|\[.*\])$/,j=/([a-z])([A-Z])/g;f.extend({cache:{},uuid:0,expando:"jQuery"+(f.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(a){a=a.nodeType?f.cache[a[f.expando]]:a[f.expando];return!!a&&!l(a)},data:function(a,c,d,e){if(!!f.acceptData(a)){var g=f.expando,h=typeof c=="string",i,j=a.nodeType,k=j?f.cache:a,l=j?a[f.expando]:a[f.expando]&&f.expando;if((!l||e&&l&&!k[l][g])&&h&&d===b)return;l||(j?a[f.expando]=l=++f.uuid:l=f.expando),k[l]||(k[l]={},j||(k[l].toJSON=f.noop));if(typeof c=="object"||typeof c=="function")e?k[l][g]=f.extend(k[l][g],c):k[l]=f.extend(k[l],c);i=k[l],e&&(i[g]||(i[g]={}),i=i[g]),d!==b&&(i[f.camelCase(c)]=d);if(c==="events"&&!i[c])return i[g]&&i[g].events;return h?i[f.camelCase(c)]||i[c]:i}},removeData:function(b,c,d){if(!!f.acceptData(b)){var e=f.expando,g=b.nodeType,h=g?f.cache:b,i=g?b[f.expando]:f.expando;if(!h[i])return;if(c){var j=d?h[i][e]:h[i];if(j){delete j[c];if(!l(j))return}}if(d){delete h[i][e];if(!l(h[i]))return}var k=h[i][e];f.support.deleteExpando||h!=a?delete h[i]:h[i]=null,k?(h[i]={},g||(h[i].toJSON=f.noop),h[i][e]=k):g&&(f.support.deleteExpando?delete b[f.expando]:b.removeAttribute?b.removeAttribute(f.expando):b[f.expando]=null)}},_data:function(a,b,c){return f.data(a,b,c,!0)},acceptData:function(a){if(a.nodeName){var b=f.noData[a.nodeName.toLowerCase()];if(b)return b!==!0&&a.getAttribute("classid")===b}return!0}}),f.fn.extend({data:function(a,c){var d=null;if(typeof a=="undefined"){if(this.length){d=f.data(this[0]);if(this[0].nodeType===1){var e=this[0].attributes,g;for(var h=0,i=e.length;h<i;h++)g=e[h].name,g.indexOf("data-")===0&&(g=f.camelCase(g.substring(5)),k(this[0],g,d[g]))}}return d}if(typeof a=="object")return this.each(function(){f.data(this,a)});var j=a.split(".");j[1]=j[1]?"."+j[1]:"";if(c===b){d=this.triggerHandler("getData"+j[1]+"!",[j[0]]),d===b&&this.length&&(d=f.data(this[0],a),d=k(this[0],a,d));return d===b&&j[1]?this.data(j[0]):d}return this.each(function(){var b=f(this),d=[j[0],c];b.triggerHandler("setData"+j[1]+"!",d),f.data(this,a,c),b.triggerHandler("changeData"+j[1]+"!",d)})},removeData:function(a){return this.each(function(){f.removeData(this,a)})}}),f.extend({_mark:function(a,c){a&&(c=(c||"fx")+"mark",f.data(a,c,(f.data(a,c,b,!0)||0)+1,!0))},_unmark:function(a,c,d){a!==!0&&(d=c,c=a,a=!1);if(c){d=d||"fx";var e=d+"mark",g=a?0:(f.data(c,e,b,!0)||1)-1;g?f.data(c,e,g,!0):(f.removeData(c,e,!0),m(c,d,"mark"))}},queue:function(a,c,d){if(a){c=(c||"fx")+"queue";var e=f.data(a,c,b,!0);d&&(!e||f.isArray(d)?e=f.data(a,c,f.makeArray(d),!0):e.push(d));return e||[]}},dequeue:function(a,b){b=b||"fx";var c=f.queue(a,b),d=c.shift(),e;d==="inprogress"&&(d=c.shift()),d&&(b==="fx"&&c.unshift("inprogress"),d.call(a,function(){f.dequeue(a,b)})),c.length||(f.removeData(a,b+"queue",!0),m(a,b,"queue"))}}),f.fn.extend({queue:function(a,c){typeof a!="string"&&(c=a,a="fx");if(c===b)return f.queue(this[0],a);return this.each(function(){var b=f.queue(this,a,c);a==="fx"&&b[0]!=="inprogress"&&f.dequeue(this,a)})},dequeue:function(a){return this.each(function(){f.dequeue(this,a)})},delay:function(a,b){a=f.fx?f.fx.speeds[a]||a:a,b=b||"fx";return this.queue(b,function(){var c=this;setTimeout(function(){f.dequeue(c,b)},a)})},clearQueue:function(a){return this.queue(a||"fx",[])},promise:function(a,c){function m(){--h||d.resolveWith(e,[e])}typeof a!="string"&&(c=a,a=b),a=a||"fx";var d=f.Deferred(),e=this,g=e.length,h=1,i=a+"defer",j=a+"queue",k=a+"mark",l;while(g--)if(l=f.data(e[g],i,b,!0)||(f.data(e[g],j,b,!0)||f.data(e[g],k,b,!0))&&f.data(e[g],i,f._Deferred(),!0))h++,l.done(m);m();return d.promise()}});var n=/[\n\t\r]/g,o=/\s+/,p=/\r/g,q=/^(?:button|input)$/i,r=/^(?:button|input|object|select|textarea)$/i,s=/^a(?:rea)?$/i,t=/^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,u=/\:|^on/,v,w;f.fn.extend({attr:function(a,b){return f.access(this,a,b,!0,f.attr)},removeAttr:function(a){return this.each(function(){f.removeAttr(this,a)})},prop:function(a,b){return f.access(this,a,b,!0,f.prop)},removeProp:function(a){a=f.propFix[a]||a;return this.each(function(){try{this[a]=b,delete this[a]}catch(c){}})},addClass:function(a){var b,c,d,e,g,h,i;if(f.isFunction(a))return this.each(function(b){f(this).addClass(a.call(this,b,this.className))});if(a&&typeof a=="string"){b=a.split(o);for(c=0,d=this.length;c<d;c++){e=this[c];if(e.nodeType===1)if(!e.className&&b.length===1)e.className=a;else{g=" "+e.className+" ";for(h=0,i=b.length;h<i;h++)~g.indexOf(" "+b[h]+" ")||(g+=b[h]+" ");e.className=f.trim(g)}}}return this},removeClass:function(a){var c,d,e,g,h,i,j;if(f.isFunction(a))return this.each(function(b){f(this).removeClass(a.call(this,b,this.className))});if(a&&typeof a=="string"||a===b){c=(a||"").split(o);for(d=0,e=this.length;d<e;d++){g=this[d];if(g.nodeType===1&&g.className)if(a){h=(" "+g.className+" ").replace(n," ");for(i=0,j=c.length;i<j;i++)h=h.replace(" "+c[i]+" "," ");g.className=f.trim(h)}else g.className=""}}return this},toggleClass:function(a,b){var c=typeof a,d=typeof b=="boolean";if(f.isFunction(a))return this.each(function(c){f(this).toggleClass(a.call(this,c,this.className,b),b)});return this.each(function(){if(c==="string"){var e,g=0,h=f(this),i=b,j=a.split(o);while(e=j[g++])i=d?i:!h.hasClass(e),h[i?"addClass":"removeClass"](e)}else if(c==="undefined"||c==="boolean")this.className&&f._data(this,"__className__",this.className),this.className=this.className||a===!1?"":f._data(this,"__className__")||""})},hasClass:function(a){var b=" "+a+" ";for(var c=0,d=this.length;c<d;c++)if((" "+this[c].className+" ").replace(n," ").indexOf(b)>-1)return!0;return!1},val:function(a){var c,d,e=this[0];if(!arguments.length){if(e){c=f.valHooks[e.nodeName.toLowerCase()]||f.valHooks[e.type];if(c&&"get"in c&&(d=c.get(e,"value"))!==b)return d;d=e.value;return typeof d=="string"?d.replace(p,""):d==null?"":d}return b}var g=f.isFunction(a);return this.each(function(d){var e=f(this),h;if(this.nodeType===1){g?h=a.call(this,d,e.val()):h=a,h==null?h="":typeof h=="number"?h+="":f.isArray(h)&&(h=f.map(h,function(a){return a==null?"":a+""})),c=f.valHooks[this.nodeName.toLowerCase()]||f.valHooks[this.type];if(!c||!("set"in c)||c.set(this,h,"value")===b)this.value=h}})}}),f.extend({valHooks:{option:{get:function(a){var b=a.attributes.value;return!b||b.specified?a.value:a.text}},select:{get:function(a){var b,c=a.selectedIndex,d=[],e=a.options,g=a.type==="select-one";if(c<0)return null;for(var h=g?c:0,i=g?c+1:e.length;h<i;h++){var j=e[h];if(j.selected&&(f.support.optDisabled?!j.disabled:j.getAttribute("disabled")===null)&&(!j.parentNode.disabled||!f.nodeName(j.parentNode,"optgroup"))){b=f(j).val();if(g)return b;d.push(b)}}if(g&&!d.length&&e.length)return f(e[c]).val();return d},set:function(a,b){var c=f.makeArray(b);f(a).find("option").each(function(){this.selected=f.inArray(f(this).val(),c)>=0}),c.length||(a.selectedIndex=-1);return c}}},attrFn:{val:!0,css:!0,html:!0,text:!0,data:!0,width:!0,height:!0,offset:!0},attrFix:{tabindex:"tabIndex"},attr:function(a,c,d,e){var g=a.nodeType;if(!a||g===3||g===8||g===2)return b;if(e&&c in f.attrFn)return f(a)[c](d);if(!("getAttribute"in a))return f.prop(a,c,d);var h,i,j=g!==1||!f.isXMLDoc(a);j&&(c=f.attrFix[c]||c,i=f.attrHooks[c],i||(t.test(c)?i=w:v&&c!=="className"&&(f.nodeName(a,"form")||u.test(c))&&(i=v)));if(d!==b){if(d===null){f.removeAttr(a,c);return b}if(i&&"set"in i&&j&&(h=i.set(a,d,c))!==b)return h;a.setAttribute(c,""+d);return d}if(i&&"get"in i&&j&&(h=i.get(a,c))!==null)return h;h=a.getAttribute(c);return h===null?b:h},removeAttr:function(a,b){var c;a.nodeType===1&&(b=f.attrFix[b]||b,f.support.getSetAttribute?a.removeAttribute(b):(f.attr(a,b,""),a.removeAttributeNode(a.getAttributeNode(b))),t.test(b)&&(c=f.propFix[b]||b)in a&&(a[c]=!1))},attrHooks:{type:{set:function(a,b){if(q.test(a.nodeName)&&a.parentNode)f.error("type property can't be changed");else if(!f.support.radioValue&&b==="radio"&&f.nodeName(a,"input")){var c=a.value;a.setAttribute("type",b),c&&(a.value=c);return b}}},tabIndex:{get:function(a){var c=a.getAttributeNode("tabIndex");return c&&c.specified?parseInt(c.value,10):r.test(a.nodeName)||s.test(a.nodeName)&&a.href?0:b}},value:{get:function(a,b){if(v&&f.nodeName(a,"button"))return v.get(a,b);return b in a?a.value:null},set:function(a,b,c){if(v&&f.nodeName(a,"button"))return v.set(a,b,c);a.value=b}}},propFix:{tabindex:"tabIndex",readonly:"readOnly","for":"htmlFor","class":"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},prop:function(a,c,d){var e=a.nodeType;if(!a||e===3||e===8||e===2)return b;var g,h,i=e!==1||!f.isXMLDoc(a);i&&(c=f.propFix[c]||c,h=f.propHooks[c]);return d!==b?h&&"set"in h&&(g=h.set(a,d,c))!==b?g:a[c]=d:h&&"get"in h&&(g=h.get(a,c))!==b?g:a[c]},propHooks:{}}),w={get:function(a,c){return f.prop(a,c)?c.toLowerCase():b},set:function(a,b,c){var d;b===!1?f.removeAttr(a,c):(d=f.propFix[c]||c,d in a&&(a[d]=!0),a.setAttribute(c,c.toLowerCase()));return c}},f.support.getSetAttribute||(f.attrFix=f.propFix,v=f.attrHooks.name=f.attrHooks.title=f.valHooks.button={get:function(a,c){var d;d=a.getAttributeNode(c);return d&&d.nodeValue!==""?d.nodeValue:b},set:function(a,b,c){var d=a.getAttributeNode(c);if(d){d.nodeValue=b;return b}}},f.each(["width","height"],function(a,b){f.attrHooks[b]=f.extend(f.attrHooks[b],{set:function(a,c){if(c===""){a.setAttribute(b,"auto");return c}}})})),f.support.hrefNormalized||f.each(["href","src","width","height"],function(a,c){f.attrHooks[c]=f.extend(f.attrHooks[c],{get:function(a){var d=a.getAttribute(c,2);return d===null?b:d}})}),f.support.style||(f.attrHooks.style={get:function(a){return a.style.cssText.toLowerCase()||b},set:function(a,b){return a.style.cssText=""+b}}),f.support.optSelected||(f.propHooks.selected=f.extend(f.propHooks.selected,{get:function(a){var b=a.parentNode;b&&(b.selectedIndex,b.parentNode&&b.parentNode.selectedIndex)}})),f.support.checkOn||f.each(["radio","checkbox"],function(){f.valHooks[this]={get:function(a){return a.getAttribute("value")===null?"on":a.value}}}),f.each(["radio","checkbox"],function(){f.valHooks[this]=f.extend(f.valHooks[this],{set:function(a,b){if(f.isArray(b))return a.checked=f.inArray(f(a).val(),b)>=0}})});var x=/\.(.*)$/,y=/^(?:textarea|input|select)$/i,z=/\./g,A=/ /g,B=/[^\w\s.|`]/g,C=function(a){return a.replace(B,"\\$&")};f.event={add:function(a,c,d,e){if(a.nodeType!==3&&a.nodeType!==8){if(d===!1)d=D;else if(!d)return;var g,h;d.handler&&(g=d,d=g.handler),d.guid||(d.guid=f.guid++);var i=f._data(a);if(!i)return;var j=i.events,k=i.handle;j||(i.events=j={}),k||(i.handle=k=function(a){return typeof f!="undefined"&&(!a||f.event.triggered!==a.type)?f.event.handle.apply(k.elem,arguments):b}),k.elem=a,c=c.split(" ");var l,m=0,n;while(l=c[m++]){h=g?f.extend({},g):{handler:d,data:e},l.indexOf(".")>-1?(n=l.split("."),l=n.shift(),h.namespace=n.slice(0).sort().join(".")):(n=[],h.namespace=""),h.type=l,h.guid||(h.guid=d.guid);var o=j[l],p=f.event.special[l]||{};if(!o){o=j[l]=[];if(!p.setup||p.setup.call(a,e,n,k)===!1)a.addEventListener?a.addEventListener(l,k,!1):a.attachEvent&&a.attachEvent("on"+l,k)}p.add&&(p.add.call(a,h),h.handler.guid||(h.handler.guid=d.guid)),o.push(h),f.event.global[l]=!0}a=null}},global:{},remove:function(a,c,d,e){if(a.nodeType!==3&&a.nodeType!==8){d===!1&&(d=D);var g,h,i,j,k=0,l,m,n,o,p,q,r,s=f.hasData(a)&&f._data(a),t=s&&s.events;if(!s||!t)return;c&&c.type&&(d=c.handler,c=c.type);if(!c||typeof c=="string"&&c.charAt(0)==="."){c=c||"";for(h in t)f.event.remove(a,h+c);return}c=c.split(" ");while(h=c[k++]){r=h,q=null,l=h.indexOf(".")<0,m=[],l||(m=h.split("."),h=m.shift(),n=new RegExp("(^|\\.)"+f.map(m.slice(0).sort(),C).join("\\.(?:.*\\.)?")+"(\\.|$)")),p=t[h];if(!p)continue;if(!d){for(j=0;j<p.length;j++){q=p[j];if(l||n.test(q.namespace))f.event.remove(a,r,q.handler,j),p.splice(j--,1)}continue}o=f.event.special[h]||{};for(j=e||0;j<p.length;j++){q=p[j];if(d.guid===q.guid){if(l||n.test(q.namespace))e==null&&p.splice(j--,1),o.remove&&o.remove.call(a,q);if(e!=null)break}}if(p.length===0||e!=null&&p.length===1)(!o.teardown||o.teardown.call(a,m)===!1)&&f.removeEvent(a,h,s.handle),g=null,delete t[h]}if(f.isEmptyObject(t)){var u=s.handle;u&&(u.elem=null),delete s.events,delete s.handle,f.isEmptyObject(s)&&f.removeData(a,b,!0)}}},customEvent:{getData:!0,setData:!0,changeData:!0},trigger:function(c,d,e,g){var h=c.type||c,i=[],j;h.indexOf("!")>=0&&(h=h.slice(0,-1),j=!0),h.indexOf(".")>=0&&(i=h.split("."),h=i.
+shift(),i.sort());if(!!e&&!f.event.customEvent[h]||!!f.event.global[h]){c=typeof c=="object"?c[f.expando]?c:new f.Event(h,c):new f.Event(h),c.type=h,c.exclusive=j,c.namespace=i.join("."),c.namespace_re=new RegExp("(^|\\.)"+i.join("\\.(?:.*\\.)?")+"(\\.|$)");if(g||!e)c.preventDefault(),c.stopPropagation();if(!e){f.each(f.cache,function(){var a=f.expando,b=this[a];b&&b.events&&b.events[h]&&f.event.trigger(c,d,b.handle.elem)});return}if(e.nodeType===3||e.nodeType===8)return;c.result=b,c.target=e,d=d!=null?f.makeArray(d):[],d.unshift(c);var k=e,l=h.indexOf(":")<0?"on"+h:"";do{var m=f._data(k,"handle");c.currentTarget=k,m&&m.apply(k,d),l&&f.acceptData(k)&&k[l]&&k[l].apply(k,d)===!1&&(c.result=!1,c.preventDefault()),k=k.parentNode||k.ownerDocument||k===c.target.ownerDocument&&a}while(k&&!c.isPropagationStopped());if(!c.isDefaultPrevented()){var n,o=f.event.special[h]||{};if((!o._default||o._default.call(e.ownerDocument,c)===!1)&&(h!=="click"||!f.nodeName(e,"a"))&&f.acceptData(e)){try{l&&e[h]&&(n=e[l],n&&(e[l]=null),f.event.triggered=h,e[h]())}catch(p){}n&&(e[l]=n),f.event.triggered=b}}return c.result}},handle:function(c){c=f.event.fix(c||a.event);var d=((f._data(this,"events")||{})[c.type]||[]).slice(0),e=!c.exclusive&&!c.namespace,g=Array.prototype.slice.call(arguments,0);g[0]=c,c.currentTarget=this;for(var h=0,i=d.length;h<i;h++){var j=d[h];if(e||c.namespace_re.test(j.namespace)){c.handler=j.handler,c.data=j.data,c.handleObj=j;var k=j.handler.apply(this,g);k!==b&&(c.result=k,k===!1&&(c.preventDefault(),c.stopPropagation()));if(c.isImmediatePropagationStopped())break}}return c.result},props:"altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode layerX layerY metaKey newValue offsetX offsetY pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),fix:function(a){if(a[f.expando])return a;var d=a;a=f.Event(d);for(var e=this.props.length,g;e;)g=this.props[--e],a[g]=d[g];a.target||(a.target=a.srcElement||c),a.target.nodeType===3&&(a.target=a.target.parentNode),!a.relatedTarget&&a.fromElement&&(a.relatedTarget=a.fromElement===a.target?a.toElement:a.fromElement);if(a.pageX==null&&a.clientX!=null){var h=a.target.ownerDocument||c,i=h.documentElement,j=h.body;a.pageX=a.clientX+(i&&i.scrollLeft||j&&j.scrollLeft||0)-(i&&i.clientLeft||j&&j.clientLeft||0),a.pageY=a.clientY+(i&&i.scrollTop||j&&j.scrollTop||0)-(i&&i.clientTop||j&&j.clientTop||0)}a.which==null&&(a.charCode!=null||a.keyCode!=null)&&(a.which=a.charCode!=null?a.charCode:a.keyCode),!a.metaKey&&a.ctrlKey&&(a.metaKey=a.ctrlKey),!a.which&&a.button!==b&&(a.which=a.button&1?1:a.button&2?3:a.button&4?2:0);return a},guid:1e8,proxy:f.proxy,special:{ready:{setup:f.bindReady,teardown:f.noop},live:{add:function(a){f.event.add(this,N(a.origType,a.selector),f.extend({},a,{handler:M,guid:a.handler.guid}))},remove:function(a){f.event.remove(this,N(a.origType,a.selector),a)}},beforeunload:{setup:function(a,b,c){f.isWindow(this)&&(this.onbeforeunload=c)},teardown:function(a,b){this.onbeforeunload===b&&(this.onbeforeunload=null)}}}},f.removeEvent=c.removeEventListener?function(a,b,c){a.removeEventListener&&a.removeEventListener(b,c,!1)}:function(a,b,c){a.detachEvent&&a.detachEvent("on"+b,c)},f.Event=function(a,b){if(!this.preventDefault)return new f.Event(a,b);a&&a.type?(this.originalEvent=a,this.type=a.type,this.isDefaultPrevented=a.defaultPrevented||a.returnValue===!1||a.getPreventDefault&&a.getPreventDefault()?E:D):this.type=a,b&&f.extend(this,b),this.timeStamp=f.now(),this[f.expando]=!0},f.Event.prototype={preventDefault:function(){this.isDefaultPrevented=E;var a=this.originalEvent;!a||(a.preventDefault?a.preventDefault():a.returnValue=!1)},stopPropagation:function(){this.isPropagationStopped=E;var a=this.originalEvent;!a||(a.stopPropagation&&a.stopPropagation(),a.cancelBubble=!0)},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=E,this.stopPropagation()},isDefaultPrevented:D,isPropagationStopped:D,isImmediatePropagationStopped:D};var F=function(a){var b=a.relatedTarget,c=!1,d=a.type;a.type=a.data,b!==this&&(b&&(c=f.contains(this,b)),c||(f.event.handle.apply(this,arguments),a.type=d))},G=function(a){a.type=a.data,f.event.handle.apply(this,arguments)};f.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(a,b){f.event.special[a]={setup:function(c){f.event.add(this,b,c&&c.selector?G:F,a)},teardown:function(a){f.event.remove(this,b,a&&a.selector?G:F)}}}),f.support.submitBubbles||(f.event.special.submit={setup:function(a,b){if(!f.nodeName(this,"form"))f.event.add(this,"click.specialSubmit",function(a){var b=a.target,c=b.type;(c==="submit"||c==="image")&&f(b).closest("form").length&&K("submit",this,arguments)}),f.event.add(this,"keypress.specialSubmit",function(a){var b=a.target,c=b.type;(c==="text"||c==="password")&&f(b).closest("form").length&&a.keyCode===13&&K("submit",this,arguments)});else return!1},teardown:function(a){f.event.remove(this,".specialSubmit")}});if(!f.support.changeBubbles){var H,I=function(a){var b=a.type,c=a.value;b==="radio"||b==="checkbox"?c=a.checked:b==="select-multiple"?c=a.selectedIndex>-1?f.map(a.options,function(a){return a.selected}).join("-"):"":f.nodeName(a,"select")&&(c=a.selectedIndex);return c},J=function(c){var d=c.target,e,g;if(!!y.test(d.nodeName)&&!d.readOnly){e=f._data(d,"_change_data"),g=I(d),(c.type!=="focusout"||d.type!=="radio")&&f._data(d,"_change_data",g);if(e===b||g===e)return;if(e!=null||g)c.type="change",c.liveFired=b,f.event.trigger(c,arguments[1],d)}};f.event.special.change={filters:{focusout:J,beforedeactivate:J,click:function(a){var b=a.target,c=f.nodeName(b,"input")?b.type:"";(c==="radio"||c==="checkbox"||f.nodeName(b,"select"))&&J.call(this,a)},keydown:function(a){var b=a.target,c=f.nodeName(b,"input")?b.type:"";(a.keyCode===13&&!f.nodeName(b,"textarea")||a.keyCode===32&&(c==="checkbox"||c==="radio")||c==="select-multiple")&&J.call(this,a)},beforeactivate:function(a){var b=a.target;f._data(b,"_change_data",I(b))}},setup:function(a,b){if(this.type==="file")return!1;for(var c in H)f.event.add(this,c+".specialChange",H[c]);return y.test(this.nodeName)},teardown:function(a){f.event.remove(this,".specialChange");return y.test(this.nodeName)}},H=f.event.special.change.filters,H.focus=H.beforeactivate}f.support.focusinBubbles||f.each({focus:"focusin",blur:"focusout"},function(a,b){function e(a){var c=f.event.fix(a);c.type=b,c.originalEvent={},f.event.trigger(c,null,c.target),c.isDefaultPrevented()&&a.preventDefault()}var d=0;f.event.special[b]={setup:function(){d++===0&&c.addEventListener(a,e,!0)},teardown:function(){--d===0&&c.removeEventListener(a,e,!0)}}}),f.each(["bind","one"],function(a,c){f.fn[c]=function(a,d,e){var g;if(typeof a=="object"){for(var h in a)this[c](h,d,a[h],e);return this}if(arguments.length===2||d===!1)e=d,d=b;c==="one"?(g=function(a){f(this).unbind(a,g);return e.apply(this,arguments)},g.guid=e.guid||f.guid++):g=e;if(a==="unload"&&c!=="one")this.one(a,d,e);else for(var i=0,j=this.length;i<j;i++)f.event.add(this[i],a,g,d);return this}}),f.fn.extend({unbind:function(a,b){if(typeof a=="object"&&!a.preventDefault)for(var c in a)this.unbind(c,a[c]);else for(var d=0,e=this.length;d<e;d++)f.event.remove(this[d],a,b);return this},delegate:function(a,b,c,d){return this.live(b,c,d,a)},undelegate:function(a,b,c){return arguments.length===0?this.unbind("live"):this.die(b,null,c,a)},trigger:function(a,b){return this.each(function(){f.event.trigger(a,b,this)})},triggerHandler:function(a,b){if(this[0])return f.event.trigger(a,b,this[0],!0)},toggle:function(a){var b=arguments,c=a.guid||f.guid++,d=0,e=function(c){var e=(f.data(this,"lastToggle"+a.guid)||0)%d;f.data(this,"lastToggle"+a.guid,e+1),c.preventDefault();return b[e].apply(this,arguments)||!1};e.guid=c;while(d<b.length)b[d++].guid=c;return this.click(e)},hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)}});var L={focus:"focusin",blur:"focusout",mouseenter:"mouseover",mouseleave:"mouseout"};f.each(["live","die"],function(a,c){f.fn[c]=function(a,d,e,g){var h,i=0,j,k,l,m=g||this.selector,n=g?this:f(this.context);if(typeof a=="object"&&!a.preventDefault){for(var o in a)n[c](o,d,a[o],m);return this}if(c==="die"&&!a&&g&&g.charAt(0)==="."){n.unbind(g);return this}if(d===!1||f.isFunction(d))e=d||D,d=b;a=(a||"").split(" ");while((h=a[i++])!=null){j=x.exec(h),k="",j&&(k=j[0],h=h.replace(x,""));if(h==="hover"){a.push("mouseenter"+k,"mouseleave"+k);continue}l=h,L[h]?(a.push(L[h]+k),h=h+k):h=(L[h]||h)+k;if(c==="live")for(var p=0,q=n.length;p<q;p++)f.event.add(n[p],"live."+N(h,m),{data:d,selector:m,handler:e,origType:h,origHandler:e,preType:l});else n.unbind("live."+N(h,m),e)}return this}}),f.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error".split(" "),function(a,b){f.fn[b]=function(a,c){c==null&&(c=a,a=null);return arguments.length>0?this.bind(b,a,c):this.trigger(b)},f.attrFn&&(f.attrFn[b]=!0)}),function(){function u(a,b,c,d,e,f){for(var g=0,h=d.length;g<h;g++){var i=d[g];if(i){var j=!1;i=i[a];while(i){if(i.sizcache===c){j=d[i.sizset];break}if(i.nodeType===1){f||(i.sizcache=c,i.sizset=g);if(typeof b!="string"){if(i===b){j=!0;break}}else if(k.filter(b,[i]).length>0){j=i;break}}i=i[a]}d[g]=j}}}function t(a,b,c,d,e,f){for(var g=0,h=d.length;g<h;g++){var i=d[g];if(i){var j=!1;i=i[a];while(i){if(i.sizcache===c){j=d[i.sizset];break}i.nodeType===1&&!f&&(i.sizcache=c,i.sizset=g);if(i.nodeName.toLowerCase()===b){j=i;break}i=i[a]}d[g]=j}}}var a=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,d=0,e=Object.prototype.toString,g=!1,h=!0,i=/\\/g,j=/\W/;[0,0].sort(function(){h=!1;return 0});var k=function(b,d,f,g){f=f||[],d=d||c;var h=d;if(d.nodeType!==1&&d.nodeType!==9)return[];if(!b||typeof b!="string")return f;var i,j,n,o,q,r,s,t,u=!0,w=k.isXML(d),x=[],y=b;do{a.exec(""),i=a.exec(y);if(i){y=i[3],x.push(i[1]);if(i[2]){o=i[3];break}}}while(i);if(x.length>1&&m.exec(b))if(x.length===2&&l.relative[x[0]])j=v(x[0]+x[1],d);else{j=l.relative[x[0]]?[d]:k(x.shift(),d);while(x.length)b=x.shift(),l.relative[b]&&(b+=x.shift()),j=v(b,j)}else{!g&&x.length>1&&d.nodeType===9&&!w&&l.match.ID.test(x[0])&&!l.match.ID.test(x[x.length-1])&&(q=k.find(x.shift(),d,w),d=q.expr?k.filter(q.expr,q.set)[0]:q.set[0]);if(d){q=g?{expr:x.pop(),set:p(g)}:k.find(x.pop(),x.length===1&&(x[0]==="~"||x[0]==="+")&&d.parentNode?d.parentNode:d,w),j=q.expr?k.filter(q.expr,q.set):q.set,x.length>0?n=p(j):u=!1;while(x.length)r=x.pop(),s=r,l.relative[r]?s=x.pop():r="",s==null&&(s=d),l.relative[r](n,s,w)}else n=x=[]}n||(n=j),n||k.error(r||b);if(e.call(n)==="[object Array]")if(!u)f.push.apply(f,n);else if(d&&d.nodeType===1)for(t=0;n[t]!=null;t++)n[t]&&(n[t]===!0||n[t].nodeType===1&&k.contains(d,n[t]))&&f.push(j[t]);else for(t=0;n[t]!=null;t++)n[t]&&n[t].nodeType===1&&f.push(j[t]);else p(n,f);o&&(k(o,h,f,g),k.uniqueSort(f));return f};k.uniqueSort=function(a){if(r){g=h,a.sort(r);if(g)for(var b=1;b<a.length;b++)a[b]===a[b-1]&&a.splice(b--,1)}return a},k.matches=function(a,b){return k(a,null,null,b)},k.matchesSelector=function(a,b){return k(b,null,null,[a]).length>0},k.find=function(a,b,c){var d;if(!a)return[];for(var e=0,f=l.order.length;e<f;e++){var g,h=l.order[e];if(g=l.leftMatch[h].exec(a)){var j=g[1];g.splice(1,1);if(j.substr(j.length-1)!=="\\"){g[1]=(g[1]||"").replace(i,""),d=l.find[h](g,b,c);if(d!=null){a=a.replace(l.match[h],"");break}}}}d||(d=typeof b.getElementsByTagName!="undefined"?b.getElementsByTagName("*"):[]);return{set:d,expr:a}},k.filter=function(a,c,d,e){var f,g,h=a,i=[],j=c,m=c&&c[0]&&k.isXML(c[0]);while(a&&c.length){for(var n in l.filter)if((f=l.leftMatch[n].exec(a))!=null&&f[2]){var o,p,q=l.filter[n],r=f[1];g=!1,f.splice(1,1);if(r.substr(r.length-1)==="\\")continue;j===i&&(i=[]);if(l.preFilter[n]){f=l.preFilter[n](f,j,d,i,e,m);if(!f)g=o=!0;else if(f===!0)continue}if(f)for(var s=0;(p=j[s])!=null;s++)if(p){o=q(p,f,s,j);var t=e^!!o;d&&o!=null?t?g=!0:j[s]=!1:t&&(i.push(p),g=!0)}if(o!==b){d||(j=i),a=a.replace(l.match[n],"");if(!g)return[];break}}if(a===h)if(g==null)k.error(a);else break;h=a}return j},k.error=function(a){throw"Syntax error, unrecognized expression: "+a};var l=k.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF\-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF\-]|\\.)+)\s*(?:(\S?=)\s*(?:(['"])(.*?)\3|(#?(?:[\w\u00c0-\uFFFF\-]|\\.)*)|)|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\(\s*(even|odd|(?:[+\-]?\d+|(?:[+\-]?\d*)?n\s*(?:[+\-]\s*\d+)?))\s*\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/},leftMatch:{},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(a){return a.getAttribute("href")},type:function(a){return a.getAttribute("type")}},relative:{"+":function(a,b){var c=typeof b=="string",d=c&&!j.test(b),e=c&&!d;d&&(b=b.toLowerCase());for(var f=0,g=a.length,h;f<g;f++)if(h=a[f]){while((h=h.previousSibling)&&h.nodeType!==1);a[f]=e||h&&h.nodeName.toLowerCase()===b?h||!1:h===b}e&&k.filter(b,a,!0)},">":function(a,b){var c,d=typeof b=="string",e=0,f=a.length;if(d&&!j.test(b)){b=b.toLowerCase();for(;e<f;e++){c=a[e];if(c){var g=c.parentNode;a[e]=g.nodeName.toLowerCase()===b?g:!1}}}else{for(;e<f;e++)c=a[e],c&&(a[e]=d?c.parentNode:c.parentNode===b);d&&k.filter(b,a,!0)}},"":function(a,b,c){var e,f=d++,g=u;typeof b=="string"&&!j.test(b)&&(b=b.toLowerCase(),e=b,g=t),g("parentNode",b,f,a,e,c)},"~":function(a,b,c){var e,f=d++,g=u;typeof b=="string"&&!j.test(b)&&(b=b.toLowerCase(),e=b,g=t),g("previousSibling",b,f,a,e,c)}},find:{ID:function(a,b,c){if(typeof b.getElementById!="undefined"&&!c){var d=b.getElementById(a[1]);return d&&d.parentNode?[d]:[]}},NAME:function(a,b){if(typeof b.getElementsByName!="undefined"){var c=[],d=b.getElementsByName(a[1]);for(var e=0,f=d.length;e<f;e++)d[e].getAttribute("name")===a[1]&&c.push(d[e]);return c.length===0?null:c}},TAG:function(a,b){if(typeof b.getElementsByTagName!="undefined")return b.getElementsByTagName(a[1])}},preFilter:{CLASS:function(a,b,c,d,e,f){a=" "+a[1].replace(i,"")+" ";if(f)return a;for(var g=0,h;(h=b[g])!=null;g++)h&&(e^(h.className&&(" "+h.className+" ").replace(/[\t\n\r]/g," ").indexOf(a)>=0)?c||d.push(h):c&&(b[g]=!1));return!1},ID:function(a){return a[1].replace(i,"")},TAG:function(a,b){return a[1].replace(i,"").toLowerCase()},CHILD:function(a){if(a[1]==="nth"){a[2]||k.error(a[0]),a[2]=a[2].replace(/^\+|\s*/g,"");var b=/(-?)(\d*)(?:n([+\-]?\d*))?/.exec(a[2]==="even"&&"2n"||a[2]==="odd"&&"2n+1"||!/\D/.test(a[2])&&"0n+"+a[2]||a[2]);a[2]=b[1]+(b[2]||1)-0,a[3]=b[3]-0}else a[2]&&k.error(a[0]);a[0]=d++;return a},ATTR:function(a,b,c,d,e,f){var g=a[1]=a[1].replace(i,"");!f&&l.attrMap[g]&&(a[1]=l.attrMap[g]),a[4]=(a[4]||a[5]||"").replace(i,""),a[2]==="~="&&(a[4]=" "+a[4]+" ");return a},PSEUDO:function(b,c,d,e,f){if(b[1]==="not")if((a.exec(b[3])||"").length>1||/^\w/.test(b[3]))b[3]=k(b[3],null,null,c);else{var g=k.filter(b[3],c,d,!0^f);d||e.push.apply(e,g);return!1}else if(l.match.POS.test(b[0])||l.match.CHILD.test(b[0]))return!0;return b},POS:function(a){a.unshift(!0);return a}},filters:{enabled:function(a){return a.disabled===!1&&a.type!=="hidden"},disabled:function(a){return a.disabled===!0},checked:function(a){return a.checked===!0},selected:function(a){a.parentNode&&a.parentNode.selectedIndex;return a.selected===!0},parent:function(a){return!!a.firstChild},empty:function(a){return!a.firstChild},has:function(a,b,c){return!!k(c[3],a).length},header:function(a){return/h\d/i.test(a.nodeName)},text:function(a){var b=a.getAttribute("type"),c=a.type;return a.nodeName.toLowerCase()==="input"&&"text"===c&&(b===c||b===null)},radio:function(a){return a.nodeName.toLowerCase()==="input"&&"radio"===a.type},checkbox:function(a){return a.nodeName.toLowerCase()==="input"&&"checkbox"===a.type},file:function(a){return a.nodeName.toLowerCase()==="input"&&"file"===a.type},password:function(a){return a.nodeName.toLowerCase()==="input"&&"password"===a.type},submit:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"submit"===a.type},image:function(a){return a.nodeName.toLowerCase()==="input"&&"image"===a.type},reset:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"reset"===a.type},button:function(a){var b=a.nodeName.toLowerCase();return b==="input"&&"button"===a.type||b==="button"},input:function(a){return/input|select|textarea|button/i.test(a.nodeName)},focus:function(a){return a===a.ownerDocument.activeElement}},setFilters:{first:function(a,b){return b===0},last:function(a,b,c,d){return b===d.length-1},even:function(a,b){return b%2===0},odd:function(a,b){return b%2===1},lt:function(a,b,c){return b<c[3]-0},gt:function(a,b,c){return b>c[3]-0},nth:function(a,b,c){return c[3]-0===b},eq:function(a,b,c){return c[3]-0===b}},filter:{PSEUDO:function(a,b,c,d){var e=b[1],f=l.filters[e];if(f)return f(a,c,b,d);if(e==="contains")return(a.textContent||a.innerText||k.getText([a])||"").indexOf(b[3])>=0;if(e==="not"){var g=b[3];for(var h=0,i=g.length;h<i;h++)if(g[h]===a)return!1;return!0}k.error(e)},CHILD:function(a,b){var c=b[1],d=a;switch(c){case"only":case"first":while(d=d.previousSibling)if(d.nodeType===1)return!1;if(c==="first")return!0;d=a;case"last":while(d=d.nextSibling)if(d.nodeType===1)return!1;return!0;case"nth":var e=b[2],f=b[3];if(e===1&&f===0)return!0;var g=b[0],h=a.parentNode;if(h&&(h.sizcache!==g||!a.nodeIndex)){var i=0;for(d=h.firstChild;d;d=d.nextSibling)d.nodeType===1&&(d.nodeIndex=++i);h.sizcache=g}var j=a.nodeIndex-f;return e===0?j===0:j%e===0&&j/e>=0}},ID:function(a,b){return a.nodeType===1&&a.getAttribute("id")===b},TAG:function(a,b){return b==="*"&&a.nodeType===1||a.nodeName.toLowerCase()===b},CLASS:function(a,b){return(" "+(a.className||a.getAttribute("class"))+" ").indexOf(b)>-1},ATTR:function(a,b){var c=b[1],d=l.attrHandle[c]?l.attrHandle[c](a):a[c]!=null?a[c]:a.getAttribute(c),e=d+"",f=b[2],g=b[4];return d==null?f==="!=":f==="="?e===g:f==="*="?e.indexOf(g)>=0:f==="~="?(" "+e+" ").indexOf(g)>=0:g?f==="!="?e!==g:f==="^="?e.indexOf(g)===0:f==="$="?e.substr(e.length-g.length)===g:f==="|="?e===g||e.substr(0,g.length+1)===g+"-":!1:e&&d!==!1},POS:function(a,b,c,d){var e=b[2],f=l.setFilters[e];if(f)return f(a,c,b,d)}}},m=l.match.POS,n=function(a,b){return"\\"+(b-0+1)};for(var o in l.match)l.match[o]=new RegExp(l.match[o].source+/(?![^\[]*\])(?![^\(]*\))/.source),l.leftMatch[o]=new RegExp(/(^(?:.|\r|\n)*?)/.source+l.match[o].source.replace(/\\(\d+)/g,n));var p=function(a,b){a=Array.prototype.slice.call(a,0);if(b){b.push.apply(b,a);return b}return a};try{Array.prototype.slice.call(c.documentElement.childNodes,0)[0].nodeType}catch(q){p=function(a,b){var c=0,d=b||[];if(e.call(a)==="[object Array]")Array.prototype.push.apply(d,a);else if(typeof a.length=="number")for(var f=a.length;c<f;c++)d.push(a[c]);else for(;a[c];c++)d.push(a[c]);return d}}var r,s;c.documentElement.compareDocumentPosition?r=function(a,b){if(a===b){g=!0;return 0}if(!a.compareDocumentPosition||!b.compareDocumentPosition)return a.compareDocumentPosition?-1:1;return a.compareDocumentPosition(b)&4?-1:1}:(r=function(a,b){if(a===b){g=!0;return 0}if(a.sourceIndex&&b.sourceIndex)return a.sourceIndex-b.sourceIndex;var c,d,e=[],f=[],h=a.parentNode,i=b.parentNode,j=h;if(h===i)return s(a,b);if(!h)return-1;if(!i)return 1;while(j)e.unshift(j),j=j.parentNode;j=i;while(j)f.unshift(j),j=j.parentNode;c=e.length,d=f.length;for(var k=0;k<c&&k<d;k++)if(e[k]!==f[k])return s(e[k],f[k]);return k===c?s(a,f[k],-1):s(e[k],b,1)},s=function(a,b,c){if(a===b)return c;var d=a.nextSibling;while(d){if(d===b)return-1;d=d.nextSibling}return 1}),k.getText=function(a){var b="",c;for(var d=0;a[d];d++)c=a[d],c.nodeType===3||c.nodeType===4?b+=c.nodeValue:c.nodeType!==8&&(b+=k.getText(c.childNodes));return b},function(){var a=c.createElement("div"),d="script"+(new Date).getTime(),e=c.documentElement;a.innerHTML="<a name='"+d+"'/>",e.insertBefore(a,e.firstChild),c.getElementById(d)&&(l.find.ID=function(a,c,d){if(typeof c.getElementById!="undefined"&&!d){var e=c.getElementById(a[1]);return e?e.id===a[1]||typeof e.getAttributeNode!="undefined"&&e.getAttributeNode("id").nodeValue===a[1]?[e]:b:[]}},l.filter.ID=function(a,b){var c=typeof a.getAttributeNode!="undefined"&&a.getAttributeNode("id");return a.nodeType===1&&c&&c.nodeValue===b}),e.removeChild(a),e=a=null}(),function(){var a=c.createElement("div");a.appendChild(c.createComment("")),a.getElementsByTagName("*").length>0&&(l.find.TAG=function(a,b){var c=b.getElementsByTagName(a[1]);if(a[1]==="*"){var d=[];for(var e=0;c[e];e++)c[e].nodeType===1&&d.push(c[e]);c=d}return c}),a.innerHTML="<a href='#'></a>",a.firstChild&&typeof a.firstChild.getAttribute!="undefined"&&a.firstChild.getAttribute("href")!=="#"&&(l.attrHandle.href=function(a){return a.getAttribute("href",2)}),a=null}(),c.querySelectorAll&&function(){var a=k,b=c.createElement("div"),d="__sizzle__";b.innerHTML="<p class='TEST'></p>";if(!b.querySelectorAll||b.querySelectorAll(".TEST").length!==0){k=function(b,e,f,g){e=e||c;if(!g&&!k.isXML(e)){var h=/^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec(b);if(h&&(e.nodeType===1||e.nodeType===9)){if(h[1])return p(e.getElementsByTagName(b),f);if(h[2]&&l.find.CLASS&&e.getElementsByClassName)return p(e.getElementsByClassName(h[2]),f)}if(e.nodeType===9){if(b==="body"&&e.body)return p([e.body],f);if(h&&h[3]){var i=e.getElementById(h[3]);if(!i||!i.parentNode)return p([],f);if(i.id===h[3])return p([i],f)}try{return p(e.querySelectorAll(b),f)}catch(j){}}else if(e.nodeType===1&&e.nodeName.toLowerCase()!=="object"){var m=e,n=e.getAttribute("id"),o=n||d,q=e.parentNode,r=/^\s*[+~]/.test(b);n?o=o.replace(/'/g,"\\$&"):e.setAttribute("id",o),r&&q&&(e=e.parentNode);try{if(!r||q)return p(e.querySelectorAll("[id='"+o+"'] "+b),f)}catch(s){}finally{n||m.removeAttribute("id")}}}return a(b,e,f,g)};for(var e in a)k[e]=a[e];b=null}}(),function(){var a=c.documentElement,b=a.matchesSelector||a.mozMatchesSelector||a.webkitMatchesSelector||a.msMatchesSelector;if(b){var d=!b.call(c.createElement("div"),"div"),e=!1;try{b.call(c.documentElement,"[test!='']:sizzle")}catch(f){e=!0}k.matchesSelector=function(a,c){c=c.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!k.isXML(a))try{if(e||!l.match.PSEUDO.test(c)&&!/!=/.test(c)){var f=b.call(a,c);if(f||!d||a.document&&a.document.nodeType!==11)return f}}catch(g){}return k(c,null,null,[a]).length>0}}}(),function(){var a=c.createElement("div");a.innerHTML="<div class='test e'></div><div class='test'></div>";if(!!a.getElementsByClassName&&a.getElementsByClassName("e").length!==0){a.lastChild.className="e";if(a.getElementsByClassName("e").length===1)return;l.order.splice(1,0,"CLASS"),l.find.CLASS=function(a,b,c){if(typeof b.getElementsByClassName!="undefined"&&!c)return b.getElementsByClassName(a[1])},a=null}}(),c.documentElement.contains?k.contains=function(a,b){return a!==b&&(a.contains?a.contains(b):!0)}:c.documentElement.compareDocumentPosition?k.contains=function(a,b){return!!(a.compareDocumentPosition(b)&16)}:k.contains=function(){return!1},k.isXML=function(a){var b=(a?a.ownerDocument||a:0).documentElement;return b?b.nodeName!=="HTML":!1};var v=function(a,b){var c,d=[],e="",f=b.nodeType?[b]:b;while(c=l.match.PSEUDO.exec(a))e+=c[0],a=a.replace(l.match.PSEUDO,"");a=l.relative[a]?a+"*":a;for(var g=0,h=f.length;g<h;g++)k(a,f[g],d);return k.filter(e,d)};f.find=k,f.expr=k.selectors,f.expr[":"]=f.expr.filters,f.unique=k.uniqueSort,f.text=k.getText,f.isXMLDoc=k.isXML,f.contains=k.contains}();var O=/Until$/,P=/^(?:parents|prevUntil|prevAll)/,Q=/,/,R=/^.[^:#\[\.,]*$/,S=Array.prototype.slice,T=f.expr.match.POS,U={children:!0,contents:!0,next:!0,prev:!0};f.fn.extend({find:function(a){var b=this,c,d;if(typeof a!="string")return f(a).filter(function(){for(c=0,d=b.length;c<d;c++)if(f.contains(b[c],this))return!0});var e=this.pushStack("","find",a),g,h,i;for(c=0,d=this.length;c<d;c++){g=e.length,f.find(a,this[c],e);if(c>0)for(h=g;h<e.length;h++)for(i=0;i<g;i++)if(e[i]===e[h]){e.splice(h--,1);break}}return e},has:function(a){var b=f(a);return this.filter(function(){for(var a=0,c=b.length;a<c;a++)if(f.contains(this,b[a]))return!0})},not:function(a){return this.pushStack(W(this,a,!1),"not",a)},filter:function(a){return this.pushStack(W(this,a,!0),"filter",a)},is:function(a){return!!a&&(typeof a=="string"?f.filter(a,this).length>0:this.filter(a).length>0)},closest:function(a,b){var c=[],d,e,g=this[0];if(f.isArray(a)){var h,i,j={},k=1;if(g&&a.length){for(d=0,e=a.length;d<e;d++)i=a[d],j[i]||(j[i]=T.test(i)?f(i,b||this.context):i);while(g&&g.ownerDocument&&g!==b){for(i in j)h=j[i],(h.jquery?h.index(g)>-1:f(g).is(h))&&c.push({selector:i,elem:g,level:k});g=g.parentNode,k++}}return c}var l=T.test(a)||typeof a!="string"?f(a,b||this.context):0;for(d=0,e=this.length;d<e;d++){g=this[d];while(g){if(l?l.index(g)>-1:f.find.matchesSelector(g,a)){c.push(g);break}g=g.parentNode;if(!g||!g.ownerDocument||g===b||g.nodeType===11)break}}c=c.length>1?f.unique(c):c;return this.pushStack(c,"closest",a)},index:function(a){if(!a||typeof a=="string")return f.inArray(this[0],a?f(a):this.parent().children());return f.inArray(a.jquery?a[0]:a,this)},add:function(a,b){var c=typeof a=="string"?f(a,b):f.makeArray(a&&a.nodeType?[a]:a),d=f.merge(this.get(),c);return this.pushStack(V(c[0])||V(d[0])?d:f.unique(d))},andSelf:function(){return this.add(this.prevObject)}}),f.each({parent:function(a){var b=a.parentNode;return b&&b.nodeType!==11?b:null},parents:function(a){return f.dir(a,"parentNode")},parentsUntil:function(a,b,c){return f.dir(a,"parentNode",c)},next:function(a){return f.nth(a,2,"nextSibling")},prev:function(a){return f.nth(a,2,"previousSibling")},nextAll:function(a){return f.dir(a,"nextSibling")},prevAll:function(a){return f.dir(a,"previousSibling")},nextUntil:function(a,b,c){return f.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return f.dir(a,"previousSibling",c)},siblings:function(a){return f.sibling(a.parentNode.firstChild,a)},children:function(a){return f.sibling(a.firstChild)},contents:function(a){return f.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:f.makeArray(a.childNodes)}},function(a,b){f.fn[a]=function(c,d){var e=f.map(this,b,c),g=S.call(arguments);O.test(a)||(d=c),d&&typeof d=="string"&&(e=f.filter(d,e)),e=this.length>1&&!U[a]?f.unique(e):e,(this.length>1||Q.test(d))&&P.test(a)&&(e=e.reverse());return this.pushStack(e,a,g.join(","))}}),f.extend({filter:function(a,b,c){c&&(a=":not("+a+")");return b.length===1?f.find.matchesSelector(b[0],a)?[b[0]]:[]:f.find.matches(a,b)},dir:function(a,c,d){var e=[],g=a[c];while(g&&g.nodeType!==9&&(d===b||g.nodeType!==1||!f(g).is(d)))g.nodeType===1&&e.push(g),g=g[c];return e},nth:function(a,b,c,d){b=b||1;var e=0;for(;a;a=a[c])if(a.nodeType===1&&++e===b)break;return a},sibling:function(a,b){var c=[];for(;a;a=a.nextSibling)a.nodeType===1&&a!==b&&c.push(a);return c}});var X=/ jQuery\d+="(?:\d+|null)"/g,Y=/^\s+/,Z=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,$=/<([\w:]+)/,_=/<tbody/i,ba=/<|&#?\w+;/,bb=/<(?:script|object|embed|option|style)/i,bc=/checked\s*(?:[^=]|=\s*.checked.)/i,bd=/\/(java|ecma)script/i,be=/^\s*<!(?:\[CDATA\[|\-\-)/,bf={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],area:[1,"<map>","</map>"],_default:[0,"",""]};bf.optgroup=bf.option,bf.tbody=bf.tfoot=bf.colgroup=bf.caption=bf.thead,bf.th=bf.td,f.support.htmlSerialize||(bf._default=[1,"div<div>","</div>"]),f.fn.extend({text:function(a){if(f.isFunction(a))return this.each(function(b){var c=f(this);c.text(a.call(this,b,c.text()))});if(typeof a!="object"&&a!==b)return this.empty().append((this[0]&&this[0].ownerDocument||c).createTextNode(a));return f.text(this)},wrapAll:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapAll(a.call(this,b))});if(this[0]){var b=f(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstChild&&a.firstChild.nodeType===1)a=a.firstChild;return a}).append(this)}return this},wrapInner:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapInner(a.call(this,b))});return this.each(function(){var b=f(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){return this.each(function(){f(this).wrapAll(a)})},unwrap:function(){return this.parent().each(function(){f.nodeName(this,"body")||f(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.appendChild(a)})},prepend:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this)});if(arguments.length){var a=f(arguments[0]);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this.nextSibling)});if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,f(arguments[0]).toArray());return a}},remove:function(a,b){for(var c=0,d;(d=this[c])!=null;c++)if(!a||f.filter(a,[d]).length)!b&&d.nodeType===1&&(f.cleanData(d.getElementsByTagName("*")),f.cleanData([d])),d.parentNode&&d.parentNode.removeChild(d);return this},empty:function(){for(var a=0,b;(b=this[a])!=null;a++){b.nodeType===1&&f.cleanData(b.getElementsByTagName("*"));while(b.firstChild)b.removeChild(b.firstChild)}return this},clone:function(a,b){a=a==null?!1:a,b=b==null?a:b;return this.map(function(){return f.clone(this,a,b)})},html:function(a){if(a===b)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(X,""):null;if(typeof a=="string"&&!bb.test(a)&&(f.support.leadingWhitespace||!Y.test(a))&&!bf[($.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(Z,"<$1></$2>");try{for(var c=0,d=this.length;c<d;c++)this[c].nodeType===1&&(f.cleanData(this[c].getElementsByTagName("*")),this[c].innerHTML=a)}catch(e){this.empty().append(a)}}else f.isFunction(a)?this.each(function(b){var c=f(this);c.html(a.call(this,b,c.html()))}):this.empty().append(a);return this},replaceWith:function(a){if(this[0]&&this[0].parentNode){if(f.isFunction(a))return this.each(function(b){var c=f(this),d=c.html();c.replaceWith(a.call(this,b,d))});typeof a!="string"&&(a=f(a).detach());return this.each(function(){var b=this.nextSibling,c=this.parentNode;f(this).remove(),b?f(b).before(a):f(c).append(a)})}return this.length?this.pushStack(f(f.isFunction(a)?a():a),"replaceWith",a):this},detach:function(a){return this.remove(a,!0)},domManip:function(a,c,d){var e,g,h,i,j=a[0],k=[];if(!f.support.checkClone&&arguments.length===3&&typeof j=="string"&&bc.test(j))return this.each(function(){f(this).domManip(a,c,d,!0)});if(f.isFunction(j))return this.each(function(e){var g=f(this);a[0]=j.call(this,e,c?g.html():b),g.domManip(a,c,d)});if(this[0]){i=j&&j.parentNode,f.support.parentNode&&i&&i.nodeType===11&&i.childNodes.length===this.length?e={fragment:i}:e=f.buildFragment(a,this,k),h=e.fragment,h.childNodes.length===1?g=h=h.firstChild:g=h.firstChild;if(g){c=c&&f.nodeName(g,"tr");for(var l=0,m=this.length,n=m-1;l<m;l++)d.call(c?bg(this[l],g):this[l],e.cacheable||m>1&&l<n?f.clone(h,!0,!0):h)}k.length&&f.each(k,bm)}return this}}),f.buildFragment=function(a,b,d){var e,g,h,i;b&&b[0]&&(i=b[0].ownerDocument||b[0]),i.createDocumentFragment||(i=c),a.length===1&&typeof a[0]=="string"&&a[0].length<512&&i===c&&a[0].charAt(0)==="<"&&!bb.test(a[0])&&(f.support.checkClone||!bc.test(a[0]))&&(g=!0,h=f.fragments[a[0]],h&&h!==1&&(e=h)),e||(e=i.createDocumentFragment(),f.clean(a,i,e,d)),g&&(f.fragments[a[0]]=h?e:1);return{fragment:e,cacheable:g}},f.fragments={},f.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){f.fn[a]=function(c){var d=[],e=f(c),g=this.length===1&&this[0].parentNode;if(g&&g.nodeType===11&&g.childNodes.length===1&&e.length===1){e[b](this[0]);return this}for(var h=0,i=e.length;h<i;h++){var j=(h>0?this.clone(!0):this).get();f(e[h])[b](j),d=d.concat(j
+)}return this.pushStack(d,a,e.selector)}}),f.extend({clone:function(a,b,c){var d=a.cloneNode(!0),e,g,h;if((!f.support.noCloneEvent||!f.support.noCloneChecked)&&(a.nodeType===1||a.nodeType===11)&&!f.isXMLDoc(a)){bi(a,d),e=bj(a),g=bj(d);for(h=0;e[h];++h)bi(e[h],g[h])}if(b){bh(a,d);if(c){e=bj(a),g=bj(d);for(h=0;e[h];++h)bh(e[h],g[h])}}e=g=null;return d},clean:function(a,b,d,e){var g;b=b||c,typeof b.createElement=="undefined"&&(b=b.ownerDocument||b[0]&&b[0].ownerDocument||c);var h=[],i;for(var j=0,k;(k=a[j])!=null;j++){typeof k=="number"&&(k+="");if(!k)continue;if(typeof k=="string")if(!ba.test(k))k=b.createTextNode(k);else{k=k.replace(Z,"<$1></$2>");var l=($.exec(k)||["",""])[1].toLowerCase(),m=bf[l]||bf._default,n=m[0],o=b.createElement("div");o.innerHTML=m[1]+k+m[2];while(n--)o=o.lastChild;if(!f.support.tbody){var p=_.test(k),q=l==="table"&&!p?o.firstChild&&o.firstChild.childNodes:m[1]==="<table>"&&!p?o.childNodes:[];for(i=q.length-1;i>=0;--i)f.nodeName(q[i],"tbody")&&!q[i].childNodes.length&&q[i].parentNode.removeChild(q[i])}!f.support.leadingWhitespace&&Y.test(k)&&o.insertBefore(b.createTextNode(Y.exec(k)[0]),o.firstChild),k=o.childNodes}var r;if(!f.support.appendChecked)if(k[0]&&typeof (r=k.length)=="number")for(i=0;i<r;i++)bl(k[i]);else bl(k);k.nodeType?h.push(k):h=f.merge(h,k)}if(d){g=function(a){return!a.type||bd.test(a.type)};for(j=0;h[j];j++)if(e&&f.nodeName(h[j],"script")&&(!h[j].type||h[j].type.toLowerCase()==="text/javascript"))e.push(h[j].parentNode?h[j].parentNode.removeChild(h[j]):h[j]);else{if(h[j].nodeType===1){var s=f.grep(h[j].getElementsByTagName("script"),g);h.splice.apply(h,[j+1,0].concat(s))}d.appendChild(h[j])}}return h},cleanData:function(a){var b,c,d=f.cache,e=f.expando,g=f.event.special,h=f.support.deleteExpando;for(var i=0,j;(j=a[i])!=null;i++){if(j.nodeName&&f.noData[j.nodeName.toLowerCase()])continue;c=j[f.expando];if(c){b=d[c]&&d[c][e];if(b&&b.events){for(var k in b.events)g[k]?f.event.remove(j,k):f.removeEvent(j,k,b.handle);b.handle&&(b.handle.elem=null)}h?delete j[f.expando]:j.removeAttribute&&j.removeAttribute(f.expando),delete d[c]}}}});var bn=/alpha\([^)]*\)/i,bo=/opacity=([^)]*)/,bp=/([A-Z]|^ms)/g,bq=/^-?\d+(?:px)?$/i,br=/^-?\d/,bs=/^[+\-]=/,bt=/[^+\-\.\de]+/g,bu={position:"absolute",visibility:"hidden",display:"block"},bv=["Left","Right"],bw=["Top","Bottom"],bx,by,bz;f.fn.css=function(a,c){if(arguments.length===2&&c===b)return this;return f.access(this,a,c,!0,function(a,c,d){return d!==b?f.style(a,c,d):f.css(a,c)})},f.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=bx(a,"opacity","opacity");return c===""?"1":c}return a.style.opacity}}},cssNumber:{fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":f.support.cssFloat?"cssFloat":"styleFloat"},style:function(a,c,d,e){if(!!a&&a.nodeType!==3&&a.nodeType!==8&&!!a.style){var g,h,i=f.camelCase(c),j=a.style,k=f.cssHooks[i];c=f.cssProps[i]||i;if(d===b){if(k&&"get"in k&&(g=k.get(a,!1,e))!==b)return g;return j[c]}h=typeof d;if(h==="number"&&isNaN(d)||d==null)return;h==="string"&&bs.test(d)&&(d=+d.replace(bt,"")+parseFloat(f.css(a,c)),h="number"),h==="number"&&!f.cssNumber[i]&&(d+="px");if(!k||!("set"in k)||(d=k.set(a,d))!==b)try{j[c]=d}catch(l){}}},css:function(a,c,d){var e,g;c=f.camelCase(c),g=f.cssHooks[c],c=f.cssProps[c]||c,c==="cssFloat"&&(c="float");if(g&&"get"in g&&(e=g.get(a,!0,d))!==b)return e;if(bx)return bx(a,c)},swap:function(a,b,c){var d={};for(var e in b)d[e]=a.style[e],a.style[e]=b[e];c.call(a);for(e in b)a.style[e]=d[e]}}),f.curCSS=f.css,f.each(["height","width"],function(a,b){f.cssHooks[b]={get:function(a,c,d){var e;if(c){if(a.offsetWidth!==0)return bA(a,b,d);f.swap(a,bu,function(){e=bA(a,b,d)});return e}},set:function(a,b){if(!bq.test(b))return b;b=parseFloat(b);if(b>=0)return b+"px"}}}),f.support.opacity||(f.cssHooks.opacity={get:function(a,b){return bo.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?parseFloat(RegExp.$1)/100+"":b?"1":""},set:function(a,b){var c=a.style,d=a.currentStyle;c.zoom=1;var e=f.isNaN(b)?"":"alpha(opacity="+b*100+")",g=d&&d.filter||c.filter||"";c.filter=bn.test(g)?g.replace(bn,e):g+" "+e}}),f(function(){f.support.reliableMarginRight||(f.cssHooks.marginRight={get:function(a,b){var c;f.swap(a,{display:"inline-block"},function(){b?c=bx(a,"margin-right","marginRight"):c=a.style.marginRight});return c}})}),c.defaultView&&c.defaultView.getComputedStyle&&(by=function(a,c){var d,e,g;c=c.replace(bp,"-$1").toLowerCase();if(!(e=a.ownerDocument.defaultView))return b;if(g=e.getComputedStyle(a,null))d=g.getPropertyValue(c),d===""&&!f.contains(a.ownerDocument.documentElement,a)&&(d=f.style(a,c));return d}),c.documentElement.currentStyle&&(bz=function(a,b){var c,d=a.currentStyle&&a.currentStyle[b],e=a.runtimeStyle&&a.runtimeStyle[b],f=a.style;!bq.test(d)&&br.test(d)&&(c=f.left,e&&(a.runtimeStyle.left=a.currentStyle.left),f.left=b==="fontSize"?"1em":d||0,d=f.pixelLeft+"px",f.left=c,e&&(a.runtimeStyle.left=e));return d===""?"auto":d}),bx=by||bz,f.expr&&f.expr.filters&&(f.expr.filters.hidden=function(a){var b=a.offsetWidth,c=a.offsetHeight;return b===0&&c===0||!f.support.reliableHiddenOffsets&&(a.style.display||f.css(a,"display"))==="none"},f.expr.filters.visible=function(a){return!f.expr.filters.hidden(a)});var bB=/%20/g,bC=/\[\]$/,bD=/\r?\n/g,bE=/#.*$/,bF=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,bG=/^(?:color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,bH=/^(?:about|app|app\-storage|.+\-extension|file|widget):$/,bI=/^(?:GET|HEAD)$/,bJ=/^\/\//,bK=/\?/,bL=/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,bM=/^(?:select|textarea)/i,bN=/\s+/,bO=/([?&])_=[^&]*/,bP=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?)?/,bQ=f.fn.load,bR={},bS={},bT,bU;try{bT=e.href}catch(bV){bT=c.createElement("a"),bT.href="",bT=bT.href}bU=bP.exec(bT.toLowerCase())||[],f.fn.extend({load:function(a,c,d){if(typeof a!="string"&&bQ)return bQ.apply(this,arguments);if(!this.length)return this;var e=a.indexOf(" ");if(e>=0){var g=a.slice(e,a.length);a=a.slice(0,e)}var h="GET";c&&(f.isFunction(c)?(d=c,c=b):typeof c=="object"&&(c=f.param(c,f.ajaxSettings.traditional),h="POST"));var i=this;f.ajax({url:a,type:h,dataType:"html",data:c,complete:function(a,b,c){c=a.responseText,a.isResolved()&&(a.done(function(a){c=a}),i.html(g?f("<div>").append(c.replace(bL,"")).find(g):c)),d&&i.each(d,[c,b,a])}});return this},serialize:function(){return f.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?f.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||bM.test(this.nodeName)||bG.test(this.type))}).map(function(a,b){var c=f(this).val();return c==null?null:f.isArray(c)?f.map(c,function(a,c){return{name:b.name,value:a.replace(bD,"\r\n")}}):{name:b.name,value:c.replace(bD,"\r\n")}}).get()}}),f.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(a,b){f.fn[b]=function(a){return this.bind(b,a)}}),f.each(["get","post"],function(a,c){f[c]=function(a,d,e,g){f.isFunction(d)&&(g=g||e,e=d,d=b);return f.ajax({type:c,url:a,data:d,success:e,dataType:g})}}),f.extend({getScript:function(a,c){return f.get(a,b,c,"script")},getJSON:function(a,b,c){return f.get(a,b,c,"json")},ajaxSetup:function(a,b){b?f.extend(!0,a,f.ajaxSettings,b):(b=a,a=f.extend(!0,f.ajaxSettings,b));for(var c in{context:1,url:1})c in b?a[c]=b[c]:c in f.ajaxSettings&&(a[c]=f.ajaxSettings[c]);return a},ajaxSettings:{url:bT,isLocal:bH.test(bU[1]),global:!0,type:"GET",contentType:"application/x-www-form-urlencoded",processData:!0,async:!0,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":"*/*"},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":a.String,"text html":!0,"text json":f.parseJSON,"text xml":f.parseXML}},ajaxPrefilter:bW(bR),ajaxTransport:bW(bS),ajax:function(a,c){function w(a,c,l,m){if(s!==2){s=2,q&&clearTimeout(q),p=b,n=m||"",v.readyState=a?4:0;var o,r,u,w=l?bZ(d,v,l):b,x,y;if(a>=200&&a<300||a===304){if(d.ifModified){if(x=v.getResponseHeader("Last-Modified"))f.lastModified[k]=x;if(y=v.getResponseHeader("Etag"))f.etag[k]=y}if(a===304)c="notmodified",o=!0;else try{r=b$(d,w),c="success",o=!0}catch(z){c="parsererror",u=z}}else{u=c;if(!c||a)c="error",a<0&&(a=0)}v.status=a,v.statusText=c,o?h.resolveWith(e,[r,c,v]):h.rejectWith(e,[v,c,u]),v.statusCode(j),j=b,t&&g.trigger("ajax"+(o?"Success":"Error"),[v,d,o?r:u]),i.resolveWith(e,[v,c]),t&&(g.trigger("ajaxComplete",[v,d]),--f.active||f.event.trigger("ajaxStop"))}}typeof a=="object"&&(c=a,a=b),c=c||{};var d=f.ajaxSetup({},c),e=d.context||d,g=e!==d&&(e.nodeType||e instanceof f)?f(e):f.event,h=f.Deferred(),i=f._Deferred(),j=d.statusCode||{},k,l={},m={},n,o,p,q,r,s=0,t,u,v={readyState:0,setRequestHeader:function(a,b){if(!s){var c=a.toLowerCase();a=m[c]=m[c]||a,l[a]=b}return this},getAllResponseHeaders:function(){return s===2?n:null},getResponseHeader:function(a){var c;if(s===2){if(!o){o={};while(c=bF.exec(n))o[c[1].toLowerCase()]=c[2]}c=o[a.toLowerCase()]}return c===b?null:c},overrideMimeType:function(a){s||(d.mimeType=a);return this},abort:function(a){a=a||"abort",p&&p.abort(a),w(0,a);return this}};h.promise(v),v.success=v.done,v.error=v.fail,v.complete=i.done,v.statusCode=function(a){if(a){var b;if(s<2)for(b in a)j[b]=[j[b],a[b]];else b=a[v.status],v.then(b,b)}return this},d.url=((a||d.url)+"").replace(bE,"").replace(bJ,bU[1]+"//"),d.dataTypes=f.trim(d.dataType||"*").toLowerCase().split(bN),d.crossDomain==null&&(r=bP.exec(d.url.toLowerCase()),d.crossDomain=!(!r||r[1]==bU[1]&&r[2]==bU[2]&&(r[3]||(r[1]==="http:"?80:443))==(bU[3]||(bU[1]==="http:"?80:443)))),d.data&&d.processData&&typeof d.data!="string"&&(d.data=f.param(d.data,d.traditional)),bX(bR,d,c,v);if(s===2)return!1;t=d.global,d.type=d.type.toUpperCase(),d.hasContent=!bI.test(d.type),t&&f.active++===0&&f.event.trigger("ajaxStart");if(!d.hasContent){d.data&&(d.url+=(bK.test(d.url)?"&":"?")+d.data),k=d.url;if(d.cache===!1){var x=f.now(),y=d.url.replace(bO,"$1_="+x);d.url=y+(y===d.url?(bK.test(d.url)?"&":"?")+"_="+x:"")}}(d.data&&d.hasContent&&d.contentType!==!1||c.contentType)&&v.setRequestHeader("Content-Type",d.contentType),d.ifModified&&(k=k||d.url,f.lastModified[k]&&v.setRequestHeader("If-Modified-Since",f.lastModified[k]),f.etag[k]&&v.setRequestHeader("If-None-Match",f.etag[k])),v.setRequestHeader("Accept",d.dataTypes[0]&&d.accepts[d.dataTypes[0]]?d.accepts[d.dataTypes[0]]+(d.dataTypes[0]!=="*"?", */*; q=0.01":""):d.accepts["*"]);for(u in d.headers)v.setRequestHeader(u,d.headers[u]);if(d.beforeSend&&(d.beforeSend.call(e,v,d)===!1||s===2)){v.abort();return!1}for(u in{success:1,error:1,complete:1})v[u](d[u]);p=bX(bS,d,c,v);if(!p)w(-1,"No Transport");else{v.readyState=1,t&&g.trigger("ajaxSend",[v,d]),d.async&&d.timeout>0&&(q=setTimeout(function(){v.abort("timeout")},d.timeout));try{s=1,p.send(l,w)}catch(z){status<2?w(-1,z):f.error(z)}}return v},param:function(a,c){var d=[],e=function(a,b){b=f.isFunction(b)?b():b,d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};c===b&&(c=f.ajaxSettings.traditional);if(f.isArray(a)||a.jquery&&!f.isPlainObject(a))f.each(a,function(){e(this.name,this.value)});else for(var g in a)bY(g,a[g],c,e);return d.join("&").replace(bB,"+")}}),f.extend({active:0,lastModified:{},etag:{}});var b_=f.now(),ca=/(\=)\?(&|$)|\?\?/i;f.ajaxSetup({jsonp:"callback",jsonpCallback:function(){return f.expando+"_"+b_++}}),f.ajaxPrefilter("json jsonp",function(b,c,d){var e=b.contentType==="application/x-www-form-urlencoded"&&typeof b.data=="string";if(b.dataTypes[0]==="jsonp"||b.jsonp!==!1&&(ca.test(b.url)||e&&ca.test(b.data))){var g,h=b.jsonpCallback=f.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,i=a[h],j=b.url,k=b.data,l="$1"+h+"$2";b.jsonp!==!1&&(j=j.replace(ca,l),b.url===j&&(e&&(k=k.replace(ca,l)),b.data===k&&(j+=(/\?/.test(j)?"&":"?")+b.jsonp+"="+h))),b.url=j,b.data=k,a[h]=function(a){g=[a]},d.always(function(){a[h]=i,g&&f.isFunction(i)&&a[h](g[0])}),b.converters["script json"]=function(){g||f.error(h+" was not called");return g[0]},b.dataTypes[0]="json";return"script"}}),f.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(a){f.globalEval(a);return a}}}),f.ajaxPrefilter("script",function(a){a.cache===b&&(a.cache=!1),a.crossDomain&&(a.type="GET",a.global=!1)}),f.ajaxTransport("script",function(a){if(a.crossDomain){var d,e=c.head||c.getElementsByTagName("head")[0]||c.documentElement;return{send:function(f,g){d=c.createElement("script"),d.async="async",a.scriptCharset&&(d.charset=a.scriptCharset),d.src=a.url,d.onload=d.onreadystatechange=function(a,c){if(c||!d.readyState||/loaded|complete/.test(d.readyState))d.onload=d.onreadystatechange=null,e&&d.parentNode&&e.removeChild(d),d=b,c||g(200,"success")},e.insertBefore(d,e.firstChild)},abort:function(){d&&d.onload(0,1)}}}});var cb=a.ActiveXObject?function(){for(var a in cd)cd[a](0,1)}:!1,cc=0,cd;f.ajaxSettings.xhr=a.ActiveXObject?function(){return!this.isLocal&&ce()||cf()}:ce,function(a){f.extend(f.support,{ajax:!!a,cors:!!a&&"withCredentials"in a})}(f.ajaxSettings.xhr()),f.support.ajax&&f.ajaxTransport(function(c){if(!c.crossDomain||f.support.cors){var d;return{send:function(e,g){var h=c.xhr(),i,j;c.username?h.open(c.type,c.url,c.async,c.username,c.password):h.open(c.type,c.url,c.async);if(c.xhrFields)for(j in c.xhrFields)h[j]=c.xhrFields[j];c.mimeType&&h.overrideMimeType&&h.overrideMimeType(c.mimeType),!c.crossDomain&&!e["X-Requested-With"]&&(e["X-Requested-With"]="XMLHttpRequest");try{for(j in e)h.setRequestHeader(j,e[j])}catch(k){}h.send(c.hasContent&&c.data||null),d=function(a,e){var j,k,l,m,n;try{if(d&&(e||h.readyState===4)){d=b,i&&(h.onreadystatechange=f.noop,cb&&delete cd[i]);if(e)h.readyState!==4&&h.abort();else{j=h.status,l=h.getAllResponseHeaders(),m={},n=h.responseXML,n&&n.documentElement&&(m.xml=n),m.text=h.responseText;try{k=h.statusText}catch(o){k=""}!j&&c.isLocal&&!c.crossDomain?j=m.text?200:404:j===1223&&(j=204)}}}catch(p){e||g(-1,p)}m&&g(j,k,m,l)},!c.async||h.readyState===4?d():(i=++cc,cb&&(cd||(cd={},f(a).unload(cb)),cd[i]=d),h.onreadystatechange=d)},abort:function(){d&&d(0,1)}}}});var cg={},ch,ci,cj=/^(?:toggle|show|hide)$/,ck=/^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i,cl,cm=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]],cn,co=a.webkitRequestAnimationFrame||a.mozRequestAnimationFrame||a.oRequestAnimationFrame;f.fn.extend({show:function(a,b,c){var d,e;if(a||a===0)return this.animate(cr("show",3),a,b,c);for(var g=0,h=this.length;g<h;g++)d=this[g],d.style&&(e=d.style.display,!f._data(d,"olddisplay")&&e==="none"&&(e=d.style.display=""),e===""&&f.css(d,"display")==="none"&&f._data(d,"olddisplay",cs(d.nodeName)));for(g=0;g<h;g++){d=this[g];if(d.style){e=d.style.display;if(e===""||e==="none")d.style.display=f._data(d,"olddisplay")||""}}return this},hide:function(a,b,c){if(a||a===0)return this.animate(cr("hide",3),a,b,c);for(var d=0,e=this.length;d<e;d++)if(this[d].style){var g=f.css(this[d],"display");g!=="none"&&!f._data(this[d],"olddisplay")&&f._data(this[d],"olddisplay",g)}for(d=0;d<e;d++)this[d].style&&(this[d].style.display="none");return this},_toggle:f.fn.toggle,toggle:function(a,b,c){var d=typeof a=="boolean";f.isFunction(a)&&f.isFunction(b)?this._toggle.apply(this,arguments):a==null||d?this.each(function(){var b=d?a:f(this).is(":hidden");f(this)[b?"show":"hide"]()}):this.animate(cr("toggle",3),a,b,c);return this},fadeTo:function(a,b,c,d){return this.filter(":hidden").css("opacity",0).show().end().animate({opacity:b},a,c,d)},animate:function(a,b,c,d){var e=f.speed(b,c,d);if(f.isEmptyObject(a))return this.each(e.complete,[!1]);a=f.extend({},a);return this[e.queue===!1?"each":"queue"](function(){e.queue===!1&&f._mark(this);var b=f.extend({},e),c=this.nodeType===1,d=c&&f(this).is(":hidden"),g,h,i,j,k,l,m,n,o;b.animatedProperties={};for(i in a){g=f.camelCase(i),i!==g&&(a[g]=a[i],delete a[i]),h=a[g],f.isArray(h)?(b.animatedProperties[g]=h[1],h=a[g]=h[0]):b.animatedProperties[g]=b.specialEasing&&b.specialEasing[g]||b.easing||"swing";if(h==="hide"&&d||h==="show"&&!d)return b.complete.call(this);c&&(g==="height"||g==="width")&&(b.overflow=[this.style.overflow,this.style.overflowX,this.style.overflowY],f.css(this,"display")==="inline"&&f.css(this,"float")==="none"&&(f.support.inlineBlockNeedsLayout?(j=cs(this.nodeName),j==="inline"?this.style.display="inline-block":(this.style.display="inline",this.style.zoom=1)):this.style.display="inline-block"))}b.overflow!=null&&(this.style.overflow="hidden");for(i in a)k=new f.fx(this,b,i),h=a[i],cj.test(h)?k[h==="toggle"?d?"show":"hide":h]():(l=ck.exec(h),m=k.cur(),l?(n=parseFloat(l[2]),o=l[3]||(f.cssNumber[i]?"":"px"),o!=="px"&&(f.style(this,i,(n||1)+o),m=(n||1)/k.cur()*m,f.style(this,i,m+o)),l[1]&&(n=(l[1]==="-="?-1:1)*n+m),k.custom(m,n,o)):k.custom(m,h,""));return!0})},stop:function(a,b){a&&this.queue([]),this.each(function(){var a=f.timers,c=a.length;b||f._unmark(!0,this);while(c--)a[c].elem===this&&(b&&a[c](!0),a.splice(c,1))}),b||this.dequeue();return this}}),f.each({slideDown:cr("show",1),slideUp:cr("hide",1),slideToggle:cr("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){f.fn[a]=function(a,c,d){return this.animate(b,a,c,d)}}),f.extend({speed:function(a,b,c){var d=a&&typeof a=="object"?f.extend({},a):{complete:c||!c&&b||f.isFunction(a)&&a,duration:a,easing:c&&b||b&&!f.isFunction(b)&&b};d.duration=f.fx.off?0:typeof d.duration=="number"?d.duration:d.duration in f.fx.speeds?f.fx.speeds[d.duration]:f.fx.speeds._default,d.old=d.complete,d.complete=function(a){f.isFunction(d.old)&&d.old.call(this),d.queue!==!1?f.dequeue(this):a!==!1&&f._unmark(this)};return d},easing:{linear:function(a,b,c,d){return c+d*a},swing:function(a,b,c,d){return(-Math.cos(a*Math.PI)/2+.5)*d+c}},timers:[],fx:function(a,b,c){this.options=b,this.elem=a,this.prop=c,b.orig=b.orig||{}}}),f.fx.prototype={update:function(){this.options.step&&this.options.step.call(this.elem,this.now,this),(f.fx.step[this.prop]||f.fx.step._default)(this)},cur:function(){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null))return this.elem[this.prop];var a,b=f.css(this.elem,this.prop);return isNaN(a=parseFloat(b))?!b||b==="auto"?0:b:a},custom:function(a,b,c){function h(a){return d.step(a)}var d=this,e=f.fx,g;this.startTime=cn||cp(),this.start=a,this.end=b,this.unit=c||this.unit||(f.cssNumber[this.prop]?"":"px"),this.now=this.start,this.pos=this.state=0,h.elem=this.elem,h()&&f.timers.push(h)&&!cl&&(co?(cl=!0,g=function(){cl&&(co(g),e.tick())},co(g)):cl=setInterval(e.tick,e.interval))},show:function(){this.options.orig[this.prop]=f.style(this.elem,this.prop),this.options.show=!0,this.custom(this.prop==="width"||this.prop==="height"?1:0,this.cur()),f(this.elem).show()},hide:function(){this.options.orig[this.prop]=f.style(this.elem,this.prop),this.options.hide=!0,this.custom(this.cur(),0)},step:function(a){var b=cn||cp(),c=!0,d=this.elem,e=this.options,g,h;if(a||b>=e.duration+this.startTime){this.now=this.end,this.pos=this.state=1,this.update(),e.animatedProperties[this.prop]=!0;for(g in e.animatedProperties)e.animatedProperties[g]!==!0&&(c=!1);if(c){e.overflow!=null&&!f.support.shrinkWrapBlocks&&f.each(["","X","Y"],function(a,b){d.style["overflow"+b]=e.overflow[a]}),e.hide&&f(d).hide();if(e.hide||e.show)for(var i in e.animatedProperties)f.style(d,i,e.orig[i]);e.complete.call(d)}return!1}e.duration==Infinity?this.now=b:(h=b-this.startTime,this.state=h/e.duration,this.pos=f.easing[e.animatedProperties[this.prop]](this.state,h,0,1,e.duration),this.now=this.start+(this.end-this.start)*this.pos),this.update();return!0}},f.extend(f.fx,{tick:function(){for(var a=f.timers,b=0;b<a.length;++b)a[b]()||a.splice(b--,1);a.length||f.fx.stop()},interval:13,stop:function(){clearInterval(cl),cl=null},speeds:{slow:600,fast:200,_default:400},step:{opacity:function(a){f.style(a.elem,"opacity",a.now)},_default:function(a){a.elem.style&&a.elem.style[a.prop]!=null?a.elem.style[a.prop]=(a.prop==="width"||a.prop==="height"?Math.max(0,a.now):a.now)+a.unit:a.elem[a.prop]=a.now}}}),f.expr&&f.expr.filters&&(f.expr.filters.animated=function(a){return f.grep(f.timers,function(b){return a===b.elem}).length});var ct=/^t(?:able|d|h)$/i,cu=/^(?:body|html)$/i;"getBoundingClientRect"in c.documentElement?f.fn.offset=function(a){var b=this[0],c;if(a)return this.each(function(b){f.offset.setOffset(this,a,b)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return f.offset.bodyOffset(b);try{c=b.getBoundingClientRect()}catch(d){}var e=b.ownerDocument,g=e.documentElement;if(!c||!f.contains(g,b))return c?{top:c.top,left:c.left}:{top:0,left:0};var h=e.body,i=cv(e),j=g.clientTop||h.clientTop||0,k=g.clientLeft||h.clientLeft||0,l=i.pageYOffset||f.support.boxModel&&g.scrollTop||h.scrollTop,m=i.pageXOffset||f.support.boxModel&&g.scrollLeft||h.scrollLeft,n=c.top+l-j,o=c.left+m-k;return{top:n,left:o}}:f.fn.offset=function(a){var b=this[0];if(a)return this.each(function(b){f.offset.setOffset(this,a,b)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return f.offset.bodyOffset(b);f.offset.initialize();var c,d=b.offsetParent,e=b,g=b.ownerDocument,h=g.documentElement,i=g.body,j=g.defaultView,k=j?j.getComputedStyle(b,null):b.currentStyle,l=b.offsetTop,m=b.offsetLeft;while((b=b.parentNode)&&b!==i&&b!==h){if(f.offset.supportsFixedPosition&&k.position==="fixed")break;c=j?j.getComputedStyle(b,null):b.currentStyle,l-=b.scrollTop,m-=b.scrollLeft,b===d&&(l+=b.offsetTop,m+=b.offsetLeft,f.offset.doesNotAddBorder&&(!f.offset.doesAddBorderForTableAndCells||!ct.test(b.nodeName))&&(l+=parseFloat(c.borderTopWidth)||0,m+=parseFloat(c.borderLeftWidth)||0),e=d,d=b.offsetParent),f.offset.subtractsBorderForOverflowNotVisible&&c.overflow!=="visible"&&(l+=parseFloat(c.borderTopWidth)||0,m+=parseFloat(c.borderLeftWidth)||0),k=c}if(k.position==="relative"||k.position==="static")l+=i.offsetTop,m+=i.offsetLeft;f.offset.supportsFixedPosition&&k.position==="fixed"&&(l+=Math.max(h.scrollTop,i.scrollTop),m+=Math.max(h.scrollLeft,i.scrollLeft));return{top:l,left:m}},f.offset={initialize:function(){var a=c.body,b=c.createElement("div"),d,e,g,h,i=parseFloat(f.css(a,"marginTop"))||0,j="<div style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;'><div></div></div><table style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;' cellpadding='0' cellspacing='0'><tr><td></td></tr></table>";f.extend(b.style,{position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"}),b.innerHTML=j,a.insertBefore(b,a.firstChild),d=b.firstChild,e=d.firstChild,h=d.nextSibling.firstChild.firstChild,this.doesNotAddBorder=e.offsetTop!==5,this.doesAddBorderForTableAndCells=h.offsetTop===5,e.style.position="fixed",e.style.top="20px",this.supportsFixedPosition=e.offsetTop===20||e.offsetTop===15,e.style.position=e.style.top="",d.style.overflow="hidden",d.style.position="relative",this.subtractsBorderForOverflowNotVisible=e.offsetTop===-5,this.doesNotIncludeMarginInBodyOffset=a.offsetTop!==i,a.removeChild(b),f.offset.initialize=f.noop},bodyOffset:function(a){var b=a.offsetTop,c=a.offsetLeft;f.offset.initialize(),f.offset.doesNotIncludeMarginInBodyOffset&&(b+=parseFloat(f.css(a,"marginTop"))||0,c+=parseFloat(f.css(a,"marginLeft"))||0);return{top:b,left:c}},setOffset:function(a,b,c){var d=f.css(a,"position");d==="static"&&(a.style.position="relative");var e=f(a),g=e.offset(),h=f.css(a,"top"),i=f.css(a,"left"),j=(d==="absolute"||d==="fixed")&&f.inArray("auto",[h,i])>-1,k={},l={},m,n;j?(l=e.position(),m=l.top,n=l.left):(m=parseFloat(h)||0,n=parseFloat(i)||0),f.isFunction(b)&&(b=b.call(a,c,g)),b.top!=null&&(k.top=b.top-g.top+m),b.left!=null&&(k.left=b.left-g.left+n),"using"in b?b.using.call(a,k):e.css(k)}},f.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),c=this.offset(),d=cu.test(b[0].nodeName)?{top:0,left:0}:b.offset();c.top-=parseFloat(f.css(a,"marginTop"))||0,c.left-=parseFloat(f.css(a,"marginLeft"))||0,d.top+=parseFloat(f.css(b[0],"borderTopWidth"))||0,d.left+=parseFloat(f.css(b[0],"borderLeftWidth"))||0;return{top:c.top-d.top,left:c.left-d.left}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||c.body;while(a&&!cu.test(a.nodeName)&&f.css(a,"position")==="static")a=a.offsetParent;return a})}}),f.each(["Left","Top"],function(a,c){var d="scroll"+c;f.fn[d]=function(c){var e,g;if(c===b){e=this[0];if(!e)return null;g=cv(e);return g?"pageXOffset"in g?g[a?"pageYOffset":"pageXOffset"]:f.support.boxModel&&g.document.documentElement[d]||g.document.body[d]:e[d]}return this.each(function(){g=cv(this),g?g.scrollTo(a?f(g).scrollLeft():c,a?c:f(g).scrollTop()):this[d]=c})}}),f.each(["Height","Width"],function(a,c){var d=c.toLowerCase();f.fn["inner"+c]=function(){var a=this[0];return a&&a.style?parseFloat(f.css(a,d,"padding")):null},f.fn["outer"+c]=function(a){var b=this[0];return b&&b.style?parseFloat(f.css(b,d,a?"margin":"border")):null},f.fn[d]=function(a){var e=this[0];if(!e)return a==null?null:this;if(f.isFunction(a))return this.each(function(b){var c=f(this);c[d](a.call(this,b,c[d]()))});if(f.isWindow(e)){var g=e.document.documentElement["client"+c];return e.document.compatMode==="CSS1Compat"&&g||e.document.body["client"+c]||g}if(e.nodeType===9)return Math.max(e.documentElement["client"+c],e.body["scroll"+c],e.documentElement["scroll"+c],e.body["offset"+c],e.documentElement["offset"+c]);if(a===b){var h=f.css(e,d),i=parseFloat(h);return f.isNaN(i)?h:i}return this.css(d,typeof a=="string"?a:a+"px")}}),a.jQuery=a.$=f})(window); \ No newline at end of file
diff --git a/lib/rdoc/generator/template/darkfish/js/quicksearch.js b/lib/rdoc/generator/template/darkfish/js/quicksearch.js
deleted file mode 100644
index 70dbd33cd9..0000000000
--- a/lib/rdoc/generator/template/darkfish/js/quicksearch.js
+++ /dev/null
@@ -1,114 +0,0 @@
-/**
- *
- * JQuery QuickSearch - Hook up a form field to hide non-matching elements.
- * $Id: quicksearch.js 53 2009-01-07 02:52:03Z deveiant $
- *
- * Author: Michael Granger <mgranger@laika.com>
- *
- */
-jQuery.fn.quicksearch = function( target, searchElems, options ) {
- // console.debug( "Quicksearch fn" );
-
- var settings = {
- delay: 250,
- clearButton: false,
- highlightMatches: false,
- focusOnLoad: false,
- noSearchResultsIndicator: null
- };
- if ( options ) $.extend( settings, options );
-
- return jQuery(this).each( function() {
- // console.debug( "Creating a new quicksearch on %o for %o", this, searchElems );
- new jQuery.quicksearch( this, searchElems, settings );
- });
-};
-
-
-jQuery.quicksearch = function( searchBox, searchElems, settings ) {
- var timeout;
- var boxdiv = $(searchBox).parents('div').eq(0);
-
- function init() {
- setupKeyEventHandlers();
- focusOnLoad();
- };
-
- function setupKeyEventHandlers() {
- // console.debug( "Hooking up the 'keypress' event to %o", searchBox );
- $(searchBox).
- unbind( 'keyup' ).
- keyup( function(e) { return onSearchKey( e.keyCode ); });
- $(searchBox).
- unbind( 'keypress' ).
- keypress( function(e) {
- switch( e.which ) {
- // Execute the search on Enter, Tab, or Newline
- case 9:
- case 13:
- case 10:
- clearTimeout( timeout );
- e.preventDefault();
- doQuickSearch();
- break;
-
- // Allow backspace
- case 8:
- return true;
- break;
-
- // Only allow valid search characters
- default:
- return validQSChar( e.charCode );
- }
- });
- };
-
- function focusOnLoad() {
- if ( !settings.focusOnLoad ) return false;
- $(searchBox).focus();
- };
-
- function onSearchKey ( code ) {
- clearTimeout( timeout );
- // console.debug( "...scheduling search." );
- timeout = setTimeout( doQuickSearch, settings.delay );
- };
-
- function validQSChar( code ) {
- var c = String.fromCharCode( code );
- return (
- (c == ':') ||
- (c >= 'a' && c <= 'z') ||
- (c >= 'A' && c <= 'Z')
- );
- };
-
- function doQuickSearch() {
- var searchText = searchBox.value;
- var pat = new RegExp( searchText, "im" );
- var shownCount = 0;
-
- if ( settings.noSearchResultsIndicator ) {
- $('#' + settings.noSearchResultsIndicator).hide();
- }
-
- // All elements start out hidden
- $(searchElems).each( function(index) {
- var str = $(this).text();
-
- if ( pat.test(str) ) {
- shownCount += 1;
- $(this).fadeIn();
- } else {
- $(this).hide();
- }
- });
-
- if ( shownCount == 0 && settings.noSearchResultsIndicator ) {
- $('#' + settings.noSearchResultsIndicator).slideDown();
- }
- };
-
- init();
-};
diff --git a/lib/rdoc/generator/template/darkfish/js/search.js b/lib/rdoc/generator/template/darkfish/js/search.js
new file mode 100644
index 0000000000..563ed7e54e
--- /dev/null
+++ b/lib/rdoc/generator/template/darkfish/js/search.js
@@ -0,0 +1,102 @@
+Search = function(data, input, result) {
+ this.data = data;
+ this.$input = $(input);
+ this.$result = $(result);
+
+ this.$current = null;
+ this.$view = this.$result.parent();
+ this.searcher = new Searcher(data.index);
+ this.init();
+}
+
+Search.prototype = $.extend({}, Navigation, new function() {
+ var suid = 1;
+
+ this.init = function() {
+ var _this = this;
+ var observer = function() {
+ _this.search(_this.$input[0].value);
+ };
+ this.$input.keyup(observer);
+ this.$input.click(observer); // mac's clear field
+
+ this.searcher.ready(function(results, isLast) {
+ _this.addResults(results, isLast);
+ })
+
+ this.initNavigation();
+ this.setNavigationActive(false);
+ }
+
+ this.search = function(value, selectFirstMatch) {
+ value = jQuery.trim(value).toLowerCase();
+ if (value) {
+ this.setNavigationActive(true);
+ } else {
+ this.setNavigationActive(false);
+ }
+
+ 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);
+ }
+ }
+
+ this.addResults = function(results, isLast) {
+ var target = this.$result.get(0);
+ if (this.firstRun && (results.length > 0 || isLast)) {
+ this.$current = null;
+ this.$result.empty();
+ }
+
+ for (var i=0, l = results.length; i < l; 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('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('search-selected');
+ $next.addClass('search-selected');
+ this.$input.attr('aria-activedescendant', $next.attr('id'));
+ this.scrollIntoView($next[0], this.$view[0]);
+ this.$current = $next;
+ }
+ return true;
+ }
+
+ this.hlt = function(html) {
+ return this.escapeHTML(html).
+ replace(/\u0001/g, '<em>').
+ replace(/\u0002/g, '</em>');
+ }
+
+ this.escapeHTML = function(html) {
+ return html.replace(/[&<>]/g, function(c) {
+ return '&#' + c.charCodeAt(0) + ';';
+ });
+ }
+
+});
+
diff --git a/lib/rdoc/generator/template/darkfish/js/thickbox-compressed.js b/lib/rdoc/generator/template/darkfish/js/thickbox-compressed.js
deleted file mode 100644
index 3a3fdae1fb..0000000000
--- a/lib/rdoc/generator/template/darkfish/js/thickbox-compressed.js
+++ /dev/null
@@ -1,10 +0,0 @@
-/*
- * Thickbox 3 - One Box To Rule Them All.
- * By Cody Lindley (http://www.codylindley.com)
- * Copyright (c) 2007 cody lindley
- * Licensed under the MIT License: http://www.opensource.org/licenses/mit-license.php
-*/
-
-var tb_pathToImage = "../images/loadingAnimation.gif";
-
-eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('$(o).2S(9(){1u(\'a.18, 3n.18, 3i.18\');1w=1p 1t();1w.L=2H});9 1u(b){$(b).s(9(){6 t=X.Q||X.1v||M;6 a=X.u||X.23;6 g=X.1N||P;19(t,a,g);X.2E();H P})}9 19(d,f,g){3m{3(2t o.v.J.2i==="2g"){$("v","11").r({A:"28%",z:"28%"});$("11").r("22","2Z");3(o.1Y("1F")===M){$("v").q("<U 5=\'1F\'></U><4 5=\'B\'></4><4 5=\'8\'></4>");$("#B").s(G)}}n{3(o.1Y("B")===M){$("v").q("<4 5=\'B\'></4><4 5=\'8\'></4>");$("#B").s(G)}}3(1K()){$("#B").1J("2B")}n{$("#B").1J("2z")}3(d===M){d=""}$("v").q("<4 5=\'K\'><1I L=\'"+1w.L+"\' /></4>");$(\'#K\').2y();6 h;3(f.O("?")!==-1){h=f.3l(0,f.O("?"))}n{h=f}6 i=/\\.2s$|\\.2q$|\\.2m$|\\.2l$|\\.2k$/;6 j=h.1C().2h(i);3(j==\'.2s\'||j==\'.2q\'||j==\'.2m\'||j==\'.2l\'||j==\'.2k\'){1D="";1G="";14="";1z="";1x="";R="";1n="";1r=P;3(g){E=$("a[@1N="+g+"]").36();25(D=0;((D<E.1c)&&(R===""));D++){6 k=E[D].u.1C().2h(i);3(!(E[D].u==f)){3(1r){1z=E[D].Q;1x=E[D].u;R="<1e 5=\'1X\'>&1d;&1d;<a u=\'#\'>2T &2R;</a></1e>"}n{1D=E[D].Q;1G=E[D].u;14="<1e 5=\'1U\'>&1d;&1d;<a u=\'#\'>&2O; 2N</a></1e>"}}n{1r=1b;1n="1t "+(D+1)+" 2L "+(E.1c)}}}S=1p 1t();S.1g=9(){S.1g=M;6 a=2x();6 x=a[0]-1M;6 y=a[1]-1M;6 b=S.z;6 c=S.A;3(b>x){c=c*(x/b);b=x;3(c>y){b=b*(y/c);c=y}}n 3(c>y){b=b*(y/c);c=y;3(b>x){c=c*(x/b);b=x}}13=b+30;1a=c+2G;$("#8").q("<a u=\'\' 5=\'1L\' Q=\'1o\'><1I 5=\'2F\' L=\'"+f+"\' z=\'"+b+"\' A=\'"+c+"\' 23=\'"+d+"\'/></a>"+"<4 5=\'2D\'>"+d+"<4 5=\'2C\'>"+1n+14+R+"</4></4><4 5=\'2A\'><a u=\'#\' 5=\'Z\' Q=\'1o\'>1l</a> 1k 1j 1s</4>");$("#Z").s(G);3(!(14==="")){9 12(){3($(o).N("s",12)){$(o).N("s",12)}$("#8").C();$("v").q("<4 5=\'8\'></4>");19(1D,1G,g);H P}$("#1U").s(12)}3(!(R==="")){9 1i(){$("#8").C();$("v").q("<4 5=\'8\'></4>");19(1z,1x,g);H P}$("#1X").s(1i)}o.1h=9(e){3(e==M){I=2w.2v}n{I=e.2u}3(I==27){G()}n 3(I==3k){3(!(R=="")){o.1h="";1i()}}n 3(I==3j){3(!(14=="")){o.1h="";12()}}};16();$("#K").C();$("#1L").s(G);$("#8").r({Y:"T"})};S.L=f}n{6 l=f.2r(/^[^\\?]+\\??/,\'\');6 m=2p(l);13=(m[\'z\']*1)+30||3h;1a=(m[\'A\']*1)+3g||3f;W=13-30;V=1a-3e;3(f.O(\'2j\')!=-1){1E=f.1B(\'3d\');$("#15").C();3(m[\'1A\']!="1b"){$("#8").q("<4 5=\'2f\'><4 5=\'1H\'>"+d+"</4><4 5=\'2e\'><a u=\'#\' 5=\'Z\' Q=\'1o\'>1l</a> 1k 1j 1s</4></4><U 1W=\'0\' 2d=\'0\' L=\'"+1E[0]+"\' 5=\'15\' 1v=\'15"+1f.2c(1f.1y()*2b)+"\' 1g=\'1m()\' J=\'z:"+(W+29)+"p;A:"+(V+17)+"p;\' > </U>")}n{$("#B").N();$("#8").q("<U 1W=\'0\' 2d=\'0\' L=\'"+1E[0]+"\' 5=\'15\' 1v=\'15"+1f.2c(1f.1y()*2b)+"\' 1g=\'1m()\' J=\'z:"+(W+29)+"p;A:"+(V+17)+"p;\'> </U>")}}n{3($("#8").r("Y")!="T"){3(m[\'1A\']!="1b"){$("#8").q("<4 5=\'2f\'><4 5=\'1H\'>"+d+"</4><4 5=\'2e\'><a u=\'#\' 5=\'Z\'>1l</a> 1k 1j 1s</4></4><4 5=\'F\' J=\'z:"+W+"p;A:"+V+"p\'></4>")}n{$("#B").N();$("#8").q("<4 5=\'F\' 3c=\'3b\' J=\'z:"+W+"p;A:"+V+"p;\'></4>")}}n{$("#F")[0].J.z=W+"p";$("#F")[0].J.A=V+"p";$("#F")[0].3a=0;$("#1H").11(d)}}$("#Z").s(G);3(f.O(\'37\')!=-1){$("#F").q($(\'#\'+m[\'26\']).1T());$("#8").24(9(){$(\'#\'+m[\'26\']).q($("#F").1T())});16();$("#K").C();$("#8").r({Y:"T"})}n 3(f.O(\'2j\')!=-1){16();3($.1q.35){$("#K").C();$("#8").r({Y:"T"})}}n{$("#F").34(f+="&1y="+(1p 33().32()),9(){16();$("#K").C();1u("#F a.18");$("#8").r({Y:"T"})})}}3(!m[\'1A\']){o.21=9(e){3(e==M){I=2w.2v}n{I=e.2u}3(I==27){G()}}}}31(e){}}9 1m(){$("#K").C();$("#8").r({Y:"T"})}9 G(){$("#2Y").N("s");$("#Z").N("s");$("#8").2X("2W",9(){$(\'#8,#B,#1F\').2V("24").N().C()});$("#K").C();3(2t o.v.J.2i=="2g"){$("v","11").r({A:"1Z",z:"1Z"});$("11").r("22","")}o.1h="";o.21="";H P}9 16(){$("#8").r({2U:\'-\'+20((13/2),10)+\'p\',z:13+\'p\'});3(!(1V.1q.2Q&&1V.1q.2P<7)){$("#8").r({38:\'-\'+20((1a/2),10)+\'p\'})}}9 2p(a){6 b={};3(!a){H b}6 c=a.1B(/[;&]/);25(6 i=0;i<c.1c;i++){6 d=c[i].1B(\'=\');3(!d||d.1c!=2){39}6 e=2a(d[0]);6 f=2a(d[1]);f=f.2r(/\\+/g,\' \');b[e]=f}H b}9 2x(){6 a=o.2M;6 w=1S.2o||1R.2o||(a&&a.1Q)||o.v.1Q;6 h=1S.1P||1R.1P||(a&&a.2n)||o.v.2n;1O=[w,h];H 1O}9 1K(){6 a=2K.2J.1C();3(a.O(\'2I\')!=-1&&a.O(\'3o\')!=-1){H 1b}}',62,211,'|||if|div|id|var||TB_window|function||||||||||||||else|document|px|append|css|click||href|body||||width|height|TB_overlay|remove|TB_Counter|TB_TempArray|TB_ajaxContent|tb_remove|return|keycode|style|TB_load|src|null|unbind|indexOf|false|title|TB_NextHTML|imgPreloader|block|iframe|ajaxContentH|ajaxContentW|this|display|TB_closeWindowButton||html|goPrev|TB_WIDTH|TB_PrevHTML|TB_iframeContent|tb_position||thickbox|tb_show|TB_HEIGHT|true|length|nbsp|span|Math|onload|onkeydown|goNext|Esc|or|close|tb_showIframe|TB_imageCount|Close|new|browser|TB_FoundURL|Key|Image|tb_init|name|imgLoader|TB_NextURL|random|TB_NextCaption|modal|split|toLowerCase|TB_PrevCaption|urlNoQuery|TB_HideSelect|TB_PrevURL|TB_ajaxWindowTitle|img|addClass|tb_detectMacXFF|TB_ImageOff|150|rel|arrayPageSize|innerHeight|clientWidth|self|window|children|TB_prev|jQuery|frameborder|TB_next|getElementById|auto|parseInt|onkeyup|overflow|alt|unload|for|inlineId||100||unescape|1000|round|hspace|TB_closeAjaxWindow|TB_title|undefined|match|maxHeight|TB_iframe|bmp|gif|png|clientHeight|innerWidth|tb_parseQuery|jpeg|replace|jpg|typeof|which|keyCode|event|tb_getPageSize|show|TB_overlayBG|TB_closeWindow|TB_overlayMacFFBGHack|TB_secondLine|TB_caption|blur|TB_Image|60|tb_pathToImage|mac|userAgent|navigator|of|documentElement|Prev|lt|version|msie|gt|ready|Next|marginLeft|trigger|fast|fadeOut|TB_imageOff|hidden||catch|getTime|Date|load|safari|get|TB_inline|marginTop|continue|scrollTop|TB_modal|class|TB_|45|440|40|630|input|188|190|substr|try|area|firefox'.split('|'),0,{})) \ No newline at end of file
diff --git a/lib/rdoc/generator/template/darkfish/page.rhtml b/lib/rdoc/generator/template/darkfish/page.rhtml
new file mode 100644
index 0000000000..4a6b006bb3
--- /dev/null
+++ b/lib/rdoc/generator/template/darkfish/page.rhtml
@@ -0,0 +1,18 @@
+<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' %>
+ </div>
+</nav>
+
+<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 ea91421837..4f22adaae1 100644
--- a/lib/rdoc/generator/template/darkfish/rdoc.css
+++ b/lib/rdoc/generator/template/darkfish/rdoc.css
@@ -6,61 +6,78 @@
*
*/
+/* vim: ft=css et sw=2 ts=2 sts=2 */
/* Base Green is: #6C8C22 */
-*{ padding: 0; margin: 0; }
+* { padding: 0; margin: 0; }
body {
- background: #efefef;
- font: 14px "Helvetica Neue", Helvetica, Tahoma, sans-serif;
+ background: #fafafa;
+ font-family: Lato, sans-serif;
+ font-weight: 300;
}
-body.class, body.module, body.file {
- margin-left: 40px;
-}
-body.file-popup {
- font-size: 90%;
- margin-left: 0;
+
+h1 span,
+h2 span,
+h3 span,
+h4 span,
+h5 span,
+h6 span {
+ display: none;
+ padding-left: 1em;
+ font-size: 10px;
+ vertical-align: super;
}
-h1 {
- font-size: 300%;
- text-shadow: rgba(135,145,135,0.65) 2px 2px 3px;
- color: #6C8C22;
+h1:hover span,
+h2:hover span,
+h3:hover span,
+h4:hover span,
+h5:hover span,
+h6:hover span {
+ display: inline;
}
-h2,h3,h4 { margin-top: 1.5em; }
:link,
:visited {
color: #6C8C22;
text-decoration: none;
}
+
:link:hover,
:visited:hover {
border-bottom: 1px dotted #6C8C22;
}
+code,
pre {
- background: #ddd;
- padding: 0.5em 0;
+ font-family: "Source Code Pro", Monaco, monospace;
}
-
/* @group Generic Classes */
.initially-hidden {
display: none;
}
-.quicksearch-field {
+#search-field {
width: 98%;
- background: #ddd;
- border: 1px solid #aaa;
+ background: white;
+ border: none;
height: 1.5em;
-webkit-border-radius: 4px;
+ -moz-border-radius: 4px;
+ border-radius: 4px;
+ text-align: left;
}
-.quicksearch-field:focus {
+#search-field:focus {
background: #f1edba;
}
+#search-field:-moz-placeholder,
+#search-field::-webkit-input-placeholder {
+ font-weight: bold;
+ color: #666;
+}
.missing-docs {
font-size: 120%;
@@ -86,146 +103,145 @@ pre {
/* @end */
-
/* @group Index Page, Standalone file pages */
-body.indexpage {
- margin: 1em 3em;
-}
-body.indexpage p,
-body.indexpage div,
-body.file p {
- margin: 1em 0;
-}
-
-.indexpage .rdoc-list p, .file .rdoc-list p {
- margin: 0em 0;
+.table-of-contents ul {
+ margin: 1em;
+ list-style: none;
}
-.indexpage ol,
-.file #documentation ol {
- line-height: 160%;
+.table-of-contents ul ul {
+ margin-top: 0.25em;
}
-.indexpage ul,
-.file #documentation ul {
- line-height: 160%;
- list-style: none;
-}
-.indexpage ul :link,
-.indexpage ul :visited {
+.table-of-contents ul :link,
+.table-of-contents ul :visited {
font-size: 16px;
}
-.indexpage li,
-.file #documentation li {
- padding-left: 20px;
-}
-
-.indexpage ol,
-.file #documentation ol {
- margin-left: 20px;
+.table-of-contents li {
+ margin-bottom: 0.25em;
}
-.indexpage ol > li,
-.file #documentation ol > li {
- padding-left: 0;
+.table-of-contents li .toc-toggle {
+ width: 16px;
+ height: 16px;
+ background: url(images/add.png) no-repeat;
}
-.indexpage ul > li,
-.file #documentation ul > li {
- background: url(images/bullet_black.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;
-}
-.file li p,
-.indexpage li p {
- margin: 0 0;
+.table-of-contents li .toc-toggle.open {
+ background: url(images/delete.png) no-repeat;
}
/* @end */
/* @group Top-Level Structure */
-.class #metadata,
-.file #metadata,
-.module #metadata {
+nav {
float: left;
width: 260px;
+ font-family: Helvetica, sans-serif;
+ font-size: 14px;
}
-.class #documentation,
-.file #documentation,
-.module #documentation {
- margin: 2em 1em 5em 300px;
+main {
+ display: block;
+ margin: 0 2em 5em 260px;
+ padding-left: 20px;
min-width: 340px;
+ font-size: 16px;
}
-.file #metadata {
- margin: 0.8em;
+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 {
clear: both;
margin: 1em 1em 2em;
+ font-size: smaller;
}
/* @end */
-/* @group Metadata Section */
-#metadata .section {
- background-color: #dedede;
- -moz-border-radius: 5px;
- -webkit-border-radius: 5px;
- border: 1px solid #aaa;
- margin: 0 8px 16px;
+/* @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 ul {
- padding-left: 28px;
- list-style-image: url(images/page_green.png);
+#project-navigation .nav-section {
+ margin: 0;
+ border-top: 0;
}
-dl.svninfo {
- color: #666;
- margin: 0;
+#home-section h2 {
+ text-align: center;
}
-dl.svninfo dt {
+
+#table-of-contents-navigation {
+ font-size: 1.2em;
font-weight: bold;
+ text-align: center;
+}
+
+#search-section {
+ margin-top: 0;
+ border-top: 0;
+}
+
+#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: 1.4em;
}
+
ul.link-list .type {
font-size: 8px;
text-transform: uppercase;
@@ -235,142 +251,162 @@ ul.link-list .type {
-webkit-border-radius: 5px;
}
-/* @end */
+.calls-super {
+ background: url(images/arrow_up.png) no-repeat right center;
+}
+/* @end */
-/* @group Project Metadata Section */
-#project-metadata {
- margin-top: 3em;
+/* @group Documentation Section */
+main {
+ color: #333;
}
-.file #project-metadata {
- margin-top: 0em;
+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;
-}
-#project-metadata h3.section-header {
- border-bottom: 1px solid #aaa;
- position: relative;
+main sup {
+ vertical-align: super;
+ font-size: 0.8em;
}
-#project-metadata h3.section-header .search-toggle {
- position: absolute;
- right: 5px;
+
+/* The heading with the class name */
+main h1[class] {
+ margin-top: 0;
+ margin-bottom: 1em;
+ font-size: 2em;
+ color: #6C8C22;
}
+main h1 {
+ margin: 2em 0 0.5em;
+ font-size: 1.7em;
+}
-#project-metadata form {
- color: #777;
- background: #ccc;
- padding: 8px 8px 16px;
- border-bottom: 1px solid #bbb;
+main h2 {
+ margin: 2em 0 0.5em;
+ font-size: 1.5em;
}
-#project-metadata fieldset {
- border: 0;
+
+main h3 {
+ margin: 2em 0 0.5em;
+ font-size: 1.2em;
}
-#no-class-search-results {
- margin: 0 auto 1em;
- text-align: center;
- font-size: 14px;
- font-weight: bold;
- color: #aaa;
+main h4 {
+ margin: 2em 0 0.5em;
+ font-size: 1.1em;
}
-/* @end */
+main h5 {
+ margin: 2em 0 0.5em;
+ font-size: 1em;
+}
+main h6 {
+ margin: 2em 0 0.5em;
+ font-size: 1em;
+}
-/* @group Documentation Section */
-.description {
- font-size: 100%;
- color: #333;
+main p {
+ margin: 0 0 0.5em;
+ line-height: 1.4em;
}
-.description p {
- margin: 1em 0.4em;
+main pre {
+ margin: 1.2em 0.5em;
+ padding: 1em;
+ font-size: 0.8em;
}
-.description li p {
- margin: 0;
+main hr {
+ margin: 1.5em 1em;
+ border: 2px solid #ddd;
}
-.description ul {
- margin-left: 1.5em;
+main blockquote {
+ margin: 0 2em 1.2em 1.2em;
+ padding-left: 0.5em;
+ border-left: 2px solid #ddd;
}
-.description ul li {
- line-height: 1.4em;
+
+main ol,
+main ul {
+ margin: 1em 2em;
}
-.description dl,
-#documentation dl {
- margin: 8px 1.5em;
- border: 1px solid #ccc;
+main li > p {
+ margin-bottom: 0.5em;
}
-.description dl {
- font-size: 14px;
+
+main dl {
+ margin: 1em 0.5em;
}
-.description dt,
-#documentation dt {
- padding: 2px 4px;
+main dt {
+ margin-bottom: 0.5em;
font-weight: bold;
- background: #ddd;
}
-.description dd,
-#documentation dd {
- padding: 2px 12px;
+
+main dd {
+ margin: 0 1em 1em 0.5em;
}
-.description dd + dt,
-#documentation dd + dt {
- margin-top: 0.7em;
+
+main header h2 {
+ margin-top: 2em;
+ border-width: 0;
+ border-top: 4px solid #bbb;
+ font-size: 130%;
}
-#documentation .section {
- font-size: 90%;
+main header h3 {
+ margin: 2em 0 1.5em;
+ border-width: 0;
+ border-top: 3px solid #bbb;
+ font-size: 120%;
}
-#documentation h2.section-header {
- margin-top: 2em;
- padding: 0.75em 0.5em;
- background: #ccc;
- color: #333;
- font-size: 175%;
- border: 1px solid #bbb;
- -moz-border-radius: 3px;
- -webkit-border-radius: 3px;
+.documentation-section-title {
+ position: relative;
+}
+.documentation-section-title .section-click-top {
+ position: absolute;
+ top: 6px;
+ left: 12px;
+ font-size: 10px;
+ color: #9b9877;
+ visibility: hidden;
+ padding-left: 0.5px;
}
-#documentation h3.section-header {
- margin-top: 2em;
- 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;
+.documentation-section-title:hover .section-click-top {
+ visibility: visible;
}
-#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;
}
@@ -394,370 +430,151 @@ ul.link-list .type {
/* @group Method Details */
-#documentation .method-source-code {
+main .method-source-code {
display: none;
}
-#documentation .method-detail {
- margin: 0.5em 0;
- padding: 0.5em 0;
+main .method-description .method-calls-super {
+ color: #333;
+ font-weight: bold;
+}
+
+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-detail: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 {
- padding: 0;
-}
-#documentation .method-description p + p {
- margin-bottom: 0.5em;
-}
-#documentation .method-description ul {
+main .method-description ul {
margin-left: 1.5em;
}
-#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 */
/* @end */
-
-
/* @group Source Code */
-div.method-source-code {
- background: #262626;
- color: #efefef;
- margin: 1em;
- padding: 0.5em;
+pre {
+ margin: 0.5em 0;
border: 1px dashed #999;
- overflow: hidden;
-}
-
-div.method-source-code pre {
- background: inherit;
- padding: 0;
+ padding: 0.5em;
+ background: #262626;
color: white;
overflow: auto;
}
-/* @group Ruby keyword styles */
-
.ruby-constant { color: #7fffd4; background: transparent; }
.ruby-keyword { color: #00ffff; background: transparent; }
.ruby-ivar { color: #eedd82; background: transparent; }
.ruby-operator { color: #00ffee; background: transparent; }
.ruby-identifier { color: #ffdead; background: transparent; }
.ruby-node { color: #ffa07a; background: transparent; }
-.ruby-comment { color: #b22222; font-weight: bold; background: transparent; }
+.ruby-comment { color: #dc0000; background: transparent; }
.ruby-regexp { color: #ffa07a; background: transparent; }
.ruby-value { color: #7fffd4; background: transparent; }
/* @end */
-/* @end */
-/* @group File Popup Contents */
-
-.file #metadata,
-.file-popup #metadata {
-}
-
-.file-popup dl {
- font-size: 80%;
- padding: 0.75em;
- background-color: #dedede;
- color: #333;
- border: 1px solid #bbb;
- -moz-border-radius: 3px;
- -webkit-border-radius: 3px;
-}
-.file dt {
- font-weight: bold;
- padding-left: 22px;
- line-height: 20px;
- background: url(images/page_white_width.png) no-repeat left top;
-}
-.file dt.modified-date {
- background: url(images/date.png) no-repeat left top;
-}
-.file dt.requires {
- background: url(images/plugin.png) no-repeat left top;
-}
-.file dt.scs-url {
- background: url(images/wrench.png) no-repeat left top;
+/* @group search results */
+#search-results {
+ font-family: Lato, sans-serif;
+ font-weight: 300;
}
-.file dl dd {
- margin: 0 0 1em 0;
-}
-.file #metadata dl dd ul {
- list-style: circle;
- margin-left: 20px;
- padding-top: 0;
-}
-.file #metadata dl dd ul li {
+#search-results .search-match {
+ font-family: Helvetica, sans-serif;
+ font-weight: normal;
}
-
-.file h2 {
- margin-top: 2em;
- padding: 0.75em 0.5em;
- background-color: #dedede;
- color: #333;
- font-size: 120%;
- border: 1px solid #bbb;
- -moz-border-radius: 3px;
- -webkit-border-radius: 3px;
+#search-results .search-selected {
+ background: #e8e8e8;
+ border-bottom: 1px solid transparent;
}
-/* @end */
-
-
-
-
-/* @group ThickBox Styles */
-#TB_window {
- font: 12px Arial, Helvetica, sans-serif;
- color: #333333;
-}
-
-#TB_secondLine {
- font: 10px Arial, Helvetica, sans-serif;
- color:#666666;
-}
-
-#TB_window :link,
-#TB_window :visited { color: #666666; }
-#TB_window :link:hover,
-#TB_window :visited:hover { color: #000; }
-#TB_window :link:active,
-#TB_window :visited:active { color: #666666; }
-#TB_window :link:focus,
-#TB_window :visited:focus { color: #666666; }
-
-#TB_overlay {
- position: fixed;
- z-index:100;
- top: 0px;
- left: 0px;
- height:100%;
- width:100%;
-}
-
-.TB_overlayMacFFBGHack {background: url(images/macFFBgHack.png) repeat;}
-.TB_overlayBG {
- background-color:#000;
- filter:alpha(opacity=75);
- -moz-opacity: 0.75;
- opacity: 0.75;
-}
-
-* html #TB_overlay { /* ie6 hack */
- position: absolute;
- height: expression(document.body.scrollHeight > document.body.offsetHeight ? document.body.scrollHeight : document.body.offsetHeight + 'px');
-}
-
-#TB_window {
- position: fixed;
- background: #ffffff;
- z-index: 102;
- color:#000000;
- display:none;
- border: 4px solid #525252;
- text-align:left;
- top:50%;
- left:50%;
-}
-
-* html #TB_window { /* ie6 hack */
- position: absolute;
- margin-top: expression(0 - parseInt(this.offsetHeight / 2) + (TBWindowMargin = document.documentElement && document.documentElement.scrollTop || document.body.scrollTop) + 'px');
-}
-
-#TB_window img#TB_Image {
- display:block;
- margin: 15px 0 0 15px;
- border-right: 1px solid #ccc;
- border-bottom: 1px solid #ccc;
- border-top: 1px solid #666;
- border-left: 1px solid #666;
-}
-
-#TB_caption{
- height:25px;
- padding:7px 30px 10px 25px;
- float:left;
-}
-
-#TB_closeWindow{
- height:25px;
- padding:11px 25px 10px 0;
- float:right;
-}
-
-#TB_closeAjaxWindow{
- padding:7px 10px 5px 0;
- margin-bottom:1px;
- text-align:right;
- float:right;
-}
-
-#TB_ajaxWindowTitle{
- float:left;
- padding:7px 0 5px 10px;
- margin-bottom:1px;
- font-size: 22px;
-}
-
-#TB_title{
- background-color: #6C8C22;
- color: #dedede;
- height:40px;
-}
-#TB_title :link,
-#TB_title :visited {
- color: white !important;
- border-bottom: 1px dotted #dedede;
-}
-
-#TB_ajaxContent{
- clear:both;
- padding:2px 15px 15px 15px;
- overflow:auto;
- text-align:left;
- line-height:1.4em;
-}
-
-#TB_ajaxContent.TB_modal{
- padding:15px;
+#search-results li {
+ list-style: none;
+ border-bottom: 1px solid #aaa;
+ margin-bottom: 0.5em;
}
-#TB_ajaxContent p{
- padding:5px 0px 5px 0px;
+#search-results li:last-child {
+ border-bottom: none;
+ margin-bottom: 0;
}
-#TB_load{
- position: fixed;
- display:none;
- height:13px;
- width:208px;
- z-index:103;
- top: 50%;
- left: 50%;
- margin: -6px 0 0 -104px; /* -height/2 0 0 -width/2 */
+#search-results li p {
+ padding: 0;
+ margin: 0.5em;
}
-* html #TB_load { /* ie6 hack */
- position: absolute;
- margin-top: expression(0 - parseInt(this.offsetHeight / 2) + (TBWindowMargin = document.documentElement && document.documentElement.scrollTop || document.body.scrollTop) + 'px');
+#search-results .search-namespace {
+ font-weight: bold;
}
-#TB_HideSelect{
- z-index:99;
- position:fixed;
- top: 0;
- left: 0;
- background-color:#fff;
- border:none;
- filter:alpha(opacity=0);
- -moz-opacity: 0;
- opacity: 0;
- height:100%;
- width:100%;
+#search-results li em {
+ background: yellow;
+ font-style: normal;
}
-* html #TB_HideSelect { /* ie6 hack */
- position: absolute;
- height: expression(document.body.scrollHeight > document.body.offsetHeight ? document.body.scrollHeight : document.body.offsetHeight + 'px');
-}
-
-#TB_iframeContent{
- clear:both;
- border:none;
- margin-bottom:-1px;
- margin-top:1px;
- _margin-bottom:1px;
+#search-results pre {
+ margin: 0.5em;
+ font-family: "Source Code Pro", Monaco, monospace;
}
/* @end */
-/* @group Debugging Section */
-
-#debugging-toggle {
- text-align: center;
-}
-#debugging-toggle img {
- cursor: pointer;
-}
-
-#rdoc-debugging-section-dump {
- display: none;
- margin: 0 2em 2em;
- background: #ccc;
- border: 1px solid #999;
-}
-
-
-
-/* @end */
diff --git a/lib/rdoc/generator/template/darkfish/servlet_not_found.rhtml b/lib/rdoc/generator/template/darkfish/servlet_not_found.rhtml
new file mode 100644
index 0000000000..f0841572c3
--- /dev/null
+++ b/lib/rdoc/generator/template/darkfish/servlet_not_found.rhtml
@@ -0,0 +1,18 @@
+<body role="document">
+<nav role="navigation">
+ <%= render '_sidebar_navigation.rhtml' %>
+
+ <%= render '_sidebar_search.rhtml' %>
+
+ <div id="project-metadata">
+ <%= render '_sidebar_pages.rhtml' %>
+ <%= render '_sidebar_classes.rhtml' %>
+ </div>
+</nav>
+
+<main role="main">
+ <h1>Not Found</h1>
+
+ <p><%= message %>
+</main>
+
diff --git a/lib/rdoc/generator/template/darkfish/servlet_root.rhtml b/lib/rdoc/generator/template/darkfish/servlet_root.rhtml
new file mode 100644
index 0000000000..3a33659aea
--- /dev/null
+++ b/lib/rdoc/generator/template/darkfish/servlet_root.rhtml
@@ -0,0 +1,63 @@
+<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>
+
+<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 %>
+ <h2>Missing Gem Documentation</h2>
+
+ <p>You are missing documentation for some of your installed gems.
+ You can install missing documentation for gems by running
+ <kbd>gem rdoc --all</kbd>. After installing the missing documentation you
+ only need to reload this page. The newly created documentation will
+ automatically appear.
+
+ <p>You can also install documentation for a specific gem by running one of
+ the following commands.
+
+ <ul>
+ <% names = missing.map { |name,| name.sub(/-([^-]*)$/, '') }.uniq %>
+ <% names.each do |name| %>
+ <li><kbd>gem rdoc <%=h name %></kbd>
+ <% end %>
+ </ul>
+<% end %>
+</main>
+
diff --git a/lib/rdoc/generator/template/darkfish/table_of_contents.rhtml b/lib/rdoc/generator/template/darkfish/table_of_contents.rhtml
new file mode 100644
index 0000000000..7ff1a9e93e
--- /dev/null
+++ b/lib/rdoc/generator/template/darkfish/table_of_contents.rhtml
@@ -0,0 +1,58 @@
+<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 id="pages">Pages</h2>
+<ul>
+<% simple_files.sort.each do |file| %>
+ <li class="file">
+ <a href="<%= file.path %>"><%= h file.page_name %></a>
+<%
+ # HACK table_of_contents should not exist on Document
+ table = file.parse(file.comment).table_of_contents
+ unless table.empty? then %>
+ <ul>
+<% table.each do |heading| %>
+ <li><a href="<%= file.path %>#<%= heading.aref %>"><%= heading.plain_html %></a>
+<% end %>
+ </ul>
+<% end %>
+ </li>
+ <% end %>
+</ul>
+<% end %>
+
+<h2 id="classes">Classes and Modules</h2>
+<ul>
+<% @modsort.each do |klass| %>
+ <li class="<%= klass.type %>">
+ <a href="<%= klass.path %>"><%= klass.full_name %></a>
+<% table = []
+ table.concat klass.parse(klass.comment_location).table_of_contents
+ table.concat klass.section_contents
+
+ unless table.empty? then %>
+ <ul>
+<% table.each do |item| %>
+ <li><a href="<%= klass.path %>#<%= item.aref %>"><%= item.plain_html %></a>
+<% end %>
+ </ul>
+<% end %>
+ </li>
+<% 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 %>"><%= h method.pretty_name %></a>
+ &mdash;
+ <span class="container"><%= method.parent.full_name %></span>
+<% end %>
+</ul>
+</main>
diff --git a/lib/rdoc/generator/template/json_index/.document b/lib/rdoc/generator/template/json_index/.document
new file mode 100644
index 0000000000..1713b67654
--- /dev/null
+++ b/lib/rdoc/generator/template/json_index/.document
@@ -0,0 +1 @@
+# ignore all files in this directory
diff --git a/lib/rdoc/generator/template/json_index/js/navigation.js b/lib/rdoc/generator/template/json_index/js/navigation.js
new file mode 100644
index 0000000000..e41268123e
--- /dev/null
+++ b/lib/rdoc/generator/template/json_index/js/navigation.js
@@ -0,0 +1,142 @@
+/*
+ * Navigation allows movement using the arrow keys through the search results.
+ *
+ * When using this library you will need to set scrollIntoView to the
+ * appropriate function for your layout. Use scrollInWindow if the container
+ * is not scrollable and scrollInElement if the container is a separate
+ * scrolling region.
+ */
+Navigation = new function() {
+ this.initNavigation = function() {
+ var _this = this;
+
+ $(document).keydown(function(e) {
+ _this.onkeydown(e);
+ }).keyup(function(e) {
+ _this.onkeyup(e);
+ });
+
+ this.navigationActive = true;
+ }
+
+ this.setNavigationActive = function(state) {
+ this.navigationActive = state;
+ this.clearMoveTimeout();
+ }
+
+ this.onkeyup = function(e) {
+ if (!this.navigationActive) return;
+
+ switch(e.keyCode) {
+ case 37: //Event.KEY_LEFT:
+ case 38: //Event.KEY_UP:
+ case 39: //Event.KEY_RIGHT:
+ case 40: //Event.KEY_DOWN:
+ this.clearMoveTimeout();
+ break;
+ }
+ }
+
+ this.onkeydown = function(e) {
+ if (!this.navigationActive) return;
+ switch(e.keyCode) {
+ case 37: //Event.KEY_LEFT:
+ if (this.moveLeft()) e.preventDefault();
+ break;
+ case 38: //Event.KEY_UP:
+ if (e.keyCode == 38 || e.ctrlKey) {
+ if (this.moveUp()) e.preventDefault();
+ this.startMoveTimeout(false);
+ }
+ break;
+ case 39: //Event.KEY_RIGHT:
+ if (this.moveRight()) e.preventDefault();
+ break;
+ case 40: //Event.KEY_DOWN:
+ if (e.keyCode == 40 || e.ctrlKey) {
+ if (this.moveDown()) e.preventDefault();
+ this.startMoveTimeout(true);
+ }
+ break;
+ case 13: //Event.KEY_RETURN:
+ if (this.$current)
+ e.preventDefault();
+ this.select(this.$current);
+ break;
+ }
+ if (e.ctrlKey && e.shiftKey) this.select(this.$current);
+ }
+
+ this.clearMoveTimeout = function() {
+ clearTimeout(this.moveTimeout);
+ this.moveTimeout = null;
+ }
+
+ this.startMoveTimeout = function(isDown) {
+ if (!$.browser.mozilla && !$.browser.opera) return;
+ if (this.moveTimeout) this.clearMoveTimeout();
+ var _this = this;
+
+ var go = function() {
+ if (!_this.moveTimeout) return;
+ _this[isDown ? 'moveDown' : 'moveUp']();
+ _this.moveTimout = setTimeout(go, 100);
+ }
+ this.moveTimeout = setTimeout(go, 200);
+ }
+
+ this.moveRight = function() {
+ }
+
+ this.moveLeft = function() {
+ }
+
+ this.move = function(isDown) {
+ }
+
+ this.moveUp = function() {
+ return this.move(false);
+ }
+
+ this.moveDown = function() {
+ return this.move(true);
+ }
+
+ /*
+ * Scrolls to the given element in the scrollable element view.
+ */
+ this.scrollInElement = function(element, view) {
+ var offset, viewHeight, viewScroll, height;
+ offset = element.offsetTop;
+ height = element.offsetHeight;
+ viewHeight = view.offsetHeight;
+ viewScroll = view.scrollTop;
+
+ if (offset - viewScroll + height > viewHeight) {
+ view.scrollTop = offset - viewHeight + height;
+ }
+ if (offset < viewScroll) {
+ view.scrollTop = offset;
+ }
+ }
+
+ /*
+ * Scrolls to the given element in the window. The second argument is
+ * ignored
+ */
+ this.scrollInWindow = function(element, ignored) {
+ var offset, viewHeight, viewScroll, height;
+ offset = element.offsetTop;
+ height = element.offsetHeight;
+ viewHeight = window.innerHeight;
+ viewScroll = window.scrollY;
+
+ if (offset - viewScroll + height > viewHeight) {
+ window.scrollTo(window.scrollX, offset - viewHeight + height);
+ }
+ if (offset < viewScroll) {
+ window.scrollTo(window.scrollX, offset);
+ }
+ }
+}
+
diff --git a/lib/rdoc/generator/template/json_index/js/searcher.js b/lib/rdoc/generator/template/json_index/js/searcher.js
new file mode 100644
index 0000000000..f854b541d0
--- /dev/null
+++ b/lib/rdoc/generator/template/json_index/js/searcher.js
@@ -0,0 +1,228 @@
+Searcher = function(data) {
+ this.data = data;
+ this.handlers = [];
+}
+
+Searcher.prototype = new function() {
+ // search is performed in chunks of 1000 for non-blocking user input
+ var CHUNK_SIZE = 1000;
+ // do not try to find more than 100 results
+ var MAX_RESULTS = 100;
+ var huid = 1;
+ var suid = 1;
+ var runs = 0;
+
+ this.find = function(query) {
+ var queries = splitQuery(query);
+ var regexps = buildRegexps(queries);
+ var highlighters = buildHilighters(queries);
+ var state = { from: 0, pass: 0, limit: MAX_RESULTS, n: suid++};
+ var _this = this;
+
+ this.currentSuid = state.n;
+
+ if (!query) return;
+
+ var run = function() {
+ // stop current search thread if new search started
+ if (state.n != _this.currentSuid) return;
+
+ var results =
+ performSearch(_this.data, regexps, queries, highlighters, state);
+ var hasMore = (state.limit > 0 && state.pass < 4);
+
+ triggerResults.call(_this, results, !hasMore);
+ if (hasMore) {
+ setTimeout(run, 2);
+ }
+ runs++;
+ };
+ runs = 0;
+
+ // start search thread
+ run();
+ }
+
+ /* ----- Events ------ */
+ this.ready = function(fn) {
+ fn.huid = huid;
+ this.handlers.push(fn);
+ }
+
+ /* ----- Utilities ------ */
+ function splitQuery(query) {
+ return jQuery.grep(query.split(/(\s+|::?|\(\)?)/), function(string) {
+ return string.match(/\S/)
+ });
+ }
+
+ function buildRegexps(queries) {
+ return jQuery.map(queries, function(query) {
+ return new RegExp(query.replace(/(.)/g, '([$1])([^$1]*?)'), 'i')
+ });
+ }
+
+ function buildHilighters(queries) {
+ return jQuery.map(queries, function(query) {
+ return jQuery.map(query.split(''), function(l, i) {
+ return '\u0001$' + (i*2+1) + '\u0002$' + (i*2+2);
+ }).join('');
+ });
+ }
+
+ // function longMatchRegexp(index, longIndex, regexps) {
+ // for (var i = regexps.length - 1; i >= 0; i--){
+ // if (!index.match(regexps[i]) && !longIndex.match(regexps[i])) return false;
+ // };
+ // return true;
+ // }
+
+
+ /* ----- Mathchers ------ */
+
+ /*
+ * This record matches if the index starts with queries[0] and the record
+ * matches all of the regexps
+ */
+ function matchPassBeginning(index, longIndex, queries, regexps) {
+ if (index.indexOf(queries[0]) != 0) return false;
+ for (var i=1, l = regexps.length; i < l; i++) {
+ if (!index.match(regexps[i]) && !longIndex.match(regexps[i]))
+ return false;
+ };
+ return true;
+ }
+
+ /*
+ * This record matches if the longIndex starts with queries[0] and the
+ * longIndex matches all of the regexps
+ */
+ function matchPassLongIndex(index, longIndex, queries, regexps) {
+ if (longIndex.indexOf(queries[0]) != 0) return false;
+ for (var i=1, l = regexps.length; i < l; i++) {
+ if (!longIndex.match(regexps[i]))
+ return false;
+ };
+ return true;
+ }
+
+ /*
+ * This record matches if the index contains queries[0] and the record
+ * matches all of the regexps
+ */
+ function matchPassContains(index, longIndex, queries, regexps) {
+ if (index.indexOf(queries[0]) == -1) return false;
+ for (var i=1, l = regexps.length; i < l; i++) {
+ if (!index.match(regexps[i]) && !longIndex.match(regexps[i]))
+ return false;
+ };
+ return true;
+ }
+
+ /*
+ * This record matches if regexps[0] matches the index and the record
+ * matches all of the regexps
+ */
+ function matchPassRegexp(index, longIndex, queries, regexps) {
+ if (!index.match(regexps[0])) return false;
+ for (var i=1, l = regexps.length; i < l; i++) {
+ if (!index.match(regexps[i]) && !longIndex.match(regexps[i]))
+ return false;
+ };
+ return true;
+ }
+
+
+ /* ----- Highlighters ------ */
+ function highlightRegexp(info, queries, regexps, highlighters) {
+ var result = createResult(info);
+ for (var i=0, l = regexps.length; i < l; i++) {
+ result.title = result.title.replace(regexps[i], highlighters[i]);
+ result.namespace = result.namespace.replace(regexps[i], highlighters[i]);
+ };
+ return result;
+ }
+
+ function hltSubstring(string, pos, length) {
+ return string.substring(0, pos) + '\u0001' + string.substring(pos, pos + length) + '\u0002' + string.substring(pos + length);
+ }
+
+ function highlightQuery(info, queries, regexps, highlighters) {
+ var result = createResult(info);
+ var pos = 0;
+ var lcTitle = result.title.toLowerCase();
+
+ pos = lcTitle.indexOf(queries[0]);
+ if (pos != -1) {
+ result.title = hltSubstring(result.title, pos, queries[0].length);
+ }
+
+ result.namespace = result.namespace.replace(regexps[0], highlighters[0]);
+ for (var i=1, l = regexps.length; i < l; i++) {
+ result.title = result.title.replace(regexps[i], highlighters[i]);
+ result.namespace = result.namespace.replace(regexps[i], highlighters[i]);
+ };
+ return result;
+ }
+
+ function createResult(info) {
+ var result = {};
+ result.title = info[0];
+ result.namespace = info[1];
+ result.path = info[2];
+ result.params = info[3];
+ result.snippet = info[4];
+ return result;
+ }
+
+ /* ----- Searching ------ */
+ function performSearch(data, regexps, queries, highlighters, state) {
+ var searchIndex = data.searchIndex;
+ var longSearchIndex = data.longSearchIndex;
+ var info = data.info;
+ var result = [];
+ var i = state.from;
+ var l = searchIndex.length;
+ var togo = CHUNK_SIZE;
+ var matchFunc, hltFunc;
+
+ while (state.pass < 4 && state.limit > 0 && togo > 0) {
+ if (state.pass == 0) {
+ matchFunc = matchPassBeginning;
+ hltFunc = highlightQuery;
+ } else if (state.pass == 1) {
+ matchFunc = matchPassLongIndex;
+ hltFunc = highlightQuery;
+ } else if (state.pass == 2) {
+ matchFunc = matchPassContains;
+ hltFunc = highlightQuery;
+ } else if (state.pass == 3) {
+ matchFunc = matchPassRegexp;
+ hltFunc = highlightRegexp;
+ }
+
+ for (; togo > 0 && i < l && state.limit > 0; i++, togo--) {
+ if (info[i].n == state.n) continue;
+ if (matchFunc(searchIndex[i], longSearchIndex[i], queries, regexps)) {
+ info[i].n = state.n;
+ result.push(hltFunc(info[i], queries, regexps, highlighters));
+ state.limit--;
+ }
+ };
+ if (searchIndex.length <= i) {
+ state.pass++;
+ i = state.from = 0;
+ } else {
+ state.from = i;
+ }
+ }
+ return result;
+ }
+
+ function triggerResults(results, isLast) {
+ jQuery.each(this.handlers, function(i, fn) {
+ fn.call(this, results, isLast)
+ })
+ }
+}
+
diff --git a/lib/rdoc/ghost_method.rb b/lib/rdoc/ghost_method.rb
index 192b46f51f..7eb2d93167 100644
--- a/lib/rdoc/ghost_method.rb
+++ b/lib/rdoc/ghost_method.rb
@@ -1,5 +1,3 @@
-require 'rdoc/any_method'
-
##
# GhostMethod represents a method referenced only by a comment
diff --git a/lib/rdoc/include.rb b/lib/rdoc/include.rb
index 9cebd3d8ef..75ed9c7bff 100644
--- a/lib/rdoc/include.rb
+++ b/lib/rdoc/include.rb
@@ -1,100 +1,9 @@
-require 'rdoc/code_object'
-
##
-# A Module include in a class with \#include
-
-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.class and
- self.name == other.name
- end
-
- ##
- # Full name based on #module
-
- def full_name
- m = self.module
- RDoc::ClassModule === m ? m.full_name : @name
- 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.
-
- def module
- return @module if @module
-
- # search the current context
- return @name unless parent
- full_name = parent.child_name(@name)
- @module = RDoc::TopLevel.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 = RDoc::TopLevel.modules_hash[full_name]
- return @module if @module
- end
-
- # go up the hierarchy of names
- p = parent.parent
- while p
- full_name = p.child_name(@name)
- @module = RDoc::TopLevel.modules_hash[full_name]
- return @module if @module
- p = p.parent
- end
-
- @name
- end
+# A Module included in a class with \#include
+#
+# RDoc::Include.new 'Enumerable', 'comment ...'
- 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
new file mode 100644
index 0000000000..63c9a9076f
--- /dev/null
+++ b/lib/rdoc/markdown.rb
@@ -0,0 +1,15961 @@
+# coding: UTF-8
+# :markup: markdown
+
+##
+# RDoc::Markdown as described by the [markdown syntax][syntax].
+#
+# To choose Markdown as your only default format see
+# 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
+# are used in RDoc output by default.
+#
+# ### RDoc
+#
+# The RDoc Markdown parser has the following built-in behaviors that cannot be
+# disabled.
+#
+# Underscores embedded in words are never interpreted as emphasis. (While the
+# [markdown dingus][dingus] emphasizes in-word underscores, neither the
+# Markdown syntax nor MarkdownTest mention this behavior.)
+#
+# For HTML output, RDoc always auto-links bare URLs.
+#
+# ### Break on Newline
+#
+# The break_on_newline extension converts all newlines into hard line breaks
+# as in [Github Flavored Markdown][GFM]. This extension is disabled by
+# default.
+#
+# ### CSS
+#
+# The #css extension enables CSS blocks to be included in the output, but they
+# are not used for any built-in RDoc output format. This extension is disabled
+# by default.
+#
+# Example:
+#
+# <style type="text/css">
+# h1 { font-size: 3em }
+# </style>
+#
+# ### Definition Lists
+#
+# The definition_lists extension allows definition lists using the [PHP
+# Markdown Extra syntax][PHPE], but only one label and definition are supported
+# at this time. This extension is enabled by default.
+#
+# Example:
+#
+# ```
+# cat
+# : A small furry mammal
+# that seems to sleep a lot
+#
+# ant
+# : A little insect that is known
+# to enjoy picnics
+#
+# ```
+#
+# Produces:
+#
+# cat
+# : A small furry mammal
+# that seems to sleep a lot
+#
+# ant
+# : A little insect that is known
+# to enjoy picnics
+#
+# ### Github
+#
+# The #github extension enables a partial set of [Github Flavored Markdown]
+# [GFM]. This extension is enabled by default.
+#
+# Supported github extensions include:
+#
+# #### Fenced code blocks
+#
+# Use ` ``` ` around a block of code instead of indenting it four spaces.
+#
+# #### Syntax highlighting
+#
+# Use ` ``` ruby ` as the start of a code fence to add syntax highlighting.
+# (Currently only `ruby` syntax is supported).
+#
+# ### HTML
+#
+# Enables raw HTML to be included in the output. This extension is enabled by
+# default.
+#
+# Example:
+#
+# <table>
+# ...
+# </table>
+#
+# ### Notes
+#
+# The #notes extension enables footnote support. This extension is enabled by
+# default.
+#
+# Example:
+#
+# Here is some text[^1] including an inline footnote ^[for short footnotes]
+#
+# ...
+#
+# [^1]: With the footnote text down at the bottom
+#
+# Produces:
+#
+# Here is some text[^1] including an inline footnote ^[for short footnotes]
+#
+# [^1]: With the footnote text down at the bottom
+#
+# ## Limitations
+#
+# * Link titles are not used
+# * Footnotes are collapsed into a single paragraph
+#
+# ## Author
+#
+# This markdown parser is a port to kpeg from [peg-markdown][pegmarkdown] by
+# John MacFarlane.
+#
+# It is used 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.
+#
+# The port to kpeg was performed by Eric Hodel and Evan Phoenix
+#
+# [dingus]: http://daringfireball.net/projects/markdown/dingus
+# [GFM]: http://github.github.com/github-flavored-markdown/
+# [pegmarkdown]: https://github.com/jgm/peg-markdown
+# [PHPE]: http://michelf.com/projects/php-markdown/extra/#def-list
+# [syntax]: http://daringfireball.net/projects/markdown/syntax
+#--
+# Last updated to jgm/peg-markdown commit 8f8fc22ef0
+class RDoc::Markdown
+ # :stopdoc:
+
+ # This is distinct from setup_parser so that a standalone parser
+ # can redefine #initialize and still have access to the proper
+ # parser setup code.
+ def initialize(str, debug=false)
+ setup_parser(str, debug)
+ end
+
+
+
+ # Prepares for parsing +str+. If you define a custom initialize you must
+ # call this method before #parse
+ def setup_parser(str, debug=false)
+ set_string str, 0
+ @memoizations = Hash.new { |h,k| h[k] = {} }
+ @result = nil
+ @failed_rule = nil
+ @failing_rule_offset = -1
+
+ setup_foreign_grammar
+ end
+
+ attr_reader :string
+ 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
+ end
+
+ target + 1
+ end
+
+ def current_line(target=pos)
+ cur_offset = 0
+ cur_line = 0
+
+ string.each_line do |line|
+ cur_line += 1
+ cur_offset += line.size
+ return cur_line if cur_offset >= target
+ end
+
+ -1
+ end
+
+ def lines
+ lines = []
+ string.each_line { |l| lines << l }
+ lines
+ end
+
+
+
+ def get_text(start)
+ @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
+ "#{@pos} (\"#{@string[0,@pos]}\" @ \"#{@string[@pos,width]}\")"
+ else
+ "#{@pos} (\"... #{@string[@pos - width, width]}\" @ \"#{@string[@pos,width]}\")"
+ end
+ end
+
+ def failure_info
+ l = current_line @failing_rule_offset
+ c = current_column @failing_rule_offset
+
+ if @failed_rule.kind_of? Symbol
+ info = self.class::Rules[@failed_rule]
+ "line #{l}, column #{c}: failed rule '#{info.name}' = '#{info.rendered}'"
+ else
+ "line #{l}, column #{c}: failed rule '#{@failed_rule}'"
+ end
+ end
+
+ def failure_caret
+ l = current_line @failing_rule_offset
+ c = current_column @failing_rule_offset
+
+ line = lines[l-1]
+ "#{line}\n#{' ' * (c - 1)}^"
+ end
+
+ def failure_character
+ l = current_line @failing_rule_offset
+ c = current_column @failing_rule_offset
+ lines[l-1][c-1, 1]
+ end
+
+ def failure_oneline
+ l = current_line @failing_rule_offset
+ c = current_column @failing_rule_offset
+
+ char = lines[l-1][c-1, 1]
+
+ if @failed_rule.kind_of? Symbol
+ info = self.class::Rules[@failed_rule]
+ "@#{l}:#{c} failed rule '#{info.name}', got '#{char}'"
+ else
+ "@#{l}:#{c} failed rule '#{@failed_rule}', got '#{char}'"
+ end
+ end
+
+ class ParseError < RuntimeError
+ end
+
+ def raise_error
+ raise ParseError, failure_oneline
+ end
+
+ def show_error(io=STDOUT)
+ error_pos = @failing_rule_offset
+ line_no = current_line(error_pos)
+ col_no = current_column(error_pos)
+
+ io.puts "On line #{line_no}, column #{col_no}:"
+
+ if @failed_rule.kind_of? Symbol
+ info = self.class::Rules[@failed_rule]
+ io.puts "Failed to match '#{info.rendered}' (rule '#{info.name}')"
+ else
+ io.puts "Failed to match rule '#{@failed_rule}'"
+ end
+
+ io.puts "Got: #{string[error_pos,1].inspect}"
+ line = lines[line_no-1]
+ io.puts "=> #{line}"
+ io.print(" " * (col_no + 3))
+ io.puts "^"
+ end
+
+ def set_failed_rule(name)
+ if @pos > @failing_rule_offset
+ @failed_rule = name
+ @failing_rule_offset = @pos
+ end
+ end
+
+ attr_reader :failed_rule
+
+ def match_string(str)
+ len = str.size
+ if @string[pos,len] == str
+ @pos += len
+ return str
+ end
+
+ return nil
+ end
+
+ def scan(reg)
+ if m = reg.match(@string[@pos..-1])
+ width = m.end(0)
+ @pos += width
+ return true
+ end
+
+ return nil
+ end
+
+ if "".respond_to? :ord
+ def get_byte
+ if @pos >= @string_size
+ return nil
+ end
+
+ s = @string[@pos].ord
+ @pos += 1
+ s
+ end
+ else
+ def get_byte
+ if @pos >= @string_size
+ return nil
+ end
+
+ s = @string[@pos]
+ @pos += 1
+ s
+ end
+ end
+
+ def parse(rule=nil)
+ # We invoke the rules indirectly via apply
+ # instead of by just calling them as methods because
+ # if the rules use left recursion, apply needs to
+ # manage that.
+
+ if !rule
+ apply(:_root)
+ else
+ method = rule.gsub("-","_hyphen_")
+ apply :"_#{method}"
+ end
+ end
+
+ class MemoEntry
+ def initialize(ans, pos)
+ @ans = ans
+ @pos = pos
+ @result = nil
+ @set = false
+ @left_rec = false
+ end
+
+ attr_reader :ans, :pos, :result, :set
+ attr_accessor :left_rec
+
+ def move!(ans, pos, result)
+ @ans = ans
+ @pos = pos
+ @result = result
+ @set = true
+ @left_rec = false
+ end
+ end
+
+ def external_invoke(other, rule, *args)
+ old_pos = @pos
+ old_string = @string
+
+ set_string other.string, other.pos
+
+ begin
+ if val = __send__(rule, *args)
+ other.pos = @pos
+ other.result = @result
+ else
+ other.set_failed_rule "#{self.class}##{rule}"
+ end
+ val
+ ensure
+ set_string old_string, old_pos
+ end
+ end
+
+ def apply_with_args(rule, *args)
+ memo_key = [rule, args]
+ if m = @memoizations[memo_key][@pos]
+ @pos = m.pos
+ if !m.set
+ m.left_rec = true
+ return nil
+ end
+
+ @result = m.result
+
+ return m.ans
+ else
+ m = MemoEntry.new(nil, @pos)
+ @memoizations[memo_key][@pos] = m
+ start_pos = @pos
+
+ ans = __send__ rule, *args
+
+ lr = m.left_rec
+
+ m.move! ans, @pos, @result
+
+ # Don't bother trying to grow the left recursion
+ # if it's failing straight away (thus there is no seed)
+ if ans and lr
+ return grow_lr(rule, args, start_pos, m)
+ else
+ return ans
+ end
+
+ return ans
+ end
+ end
+
+ def apply(rule)
+ if m = @memoizations[rule][@pos]
+ @pos = m.pos
+ if !m.set
+ m.left_rec = true
+ return nil
+ end
+
+ @result = m.result
+
+ return m.ans
+ else
+ m = MemoEntry.new(nil, @pos)
+ @memoizations[rule][@pos] = m
+ start_pos = @pos
+
+ ans = __send__ rule
+
+ lr = m.left_rec
+
+ m.move! ans, @pos, @result
+
+ # Don't bother trying to grow the left recursion
+ # if it's failing straight away (thus there is no seed)
+ if ans and lr
+ return grow_lr(rule, nil, start_pos, m)
+ else
+ return ans
+ end
+
+ return ans
+ end
+ end
+
+ def grow_lr(rule, args, start_pos, m)
+ while true
+ @pos = start_pos
+ @result = m.result
+
+ if args
+ ans = __send__ rule, *args
+ else
+ ans = __send__ rule
+ end
+ return nil unless ans
+
+ break if @pos <= m.pos
+
+ m.move! ans, @pos, @result
+ end
+
+ @result = m.result
+ @pos = m.pos
+ return m.ans
+ end
+
+ class RuleInfo
+ def initialize(name, rendered)
+ @name = name
+ @rendered = rendered
+ end
+
+ attr_reader :name, :rendered
+ end
+
+ def self.rule_info(name, rendered)
+ RuleInfo.new(name, rendered)
+ end
+
+
+ # :startdoc:
+
+
+
+ require 'rubygems'
+ require 'rdoc'
+ require 'rdoc/markup/to_joined_paragraph'
+ require 'rdoc/markdown/entities'
+
+ if RUBY_VERSION > '1.9' then
+ require 'rdoc/markdown/literals_1_9'
+ else
+ require 'rdoc/markdown/literals_1_8'
+ end
+
+ ##
+ # Supported extensions
+
+ EXTENSIONS = []
+
+ ##
+ # Extensions enabled by default
+
+ DEFAULT_EXTENSIONS = [
+ :definition_lists,
+ :github,
+ :html,
+ :notes,
+ ]
+
+ # :section: Extensions
+
+ ##
+ # Creates extension methods for the `name` extension to enable and disable
+ # the extension and to query if they are active.
+
+ def self.extension name
+ EXTENSIONS << name
+
+ define_method "#{name}?" do
+ extension? name
+ end
+
+ define_method "#{name}=" do |enable|
+ extension name, enable
+ end
+ end
+
+ ##
+ # Converts all newlines into hard breaks
+
+ extension :break_on_newline
+
+ ##
+ # Allow style blocks
+
+ extension :css
+
+ ##
+ # Allow PHP Markdown Extras style definition lists
+
+ extension :definition_lists
+
+ ##
+ # Allow Github Flavored Markdown
+
+ extension :github
+
+ ##
+ # Allow HTML
+
+ extension :html
+
+ ##
+ # Enables the notes extension
+
+ extension :notes
+
+ # :section:
+
+ ##
+ # Parses the `markdown` document into an RDoc::Document using the default
+ # extensions.
+
+ def self.parse markdown
+ parser = new
+
+ parser.parse markdown
+ end
+
+ # TODO remove when kpeg 0.10 is released
+ alias orig_initialize initialize # :nodoc:
+
+ ##
+ # Creates a new markdown parser that enables the given +extensions+.
+
+ def initialize extensions = DEFAULT_EXTENSIONS, debug = false
+ @debug = debug
+ @formatter = RDoc::Markup::ToJoinedParagraph.new
+ @extensions = extensions
+
+ @references = nil
+ @unlinked_references = nil
+
+ @footnotes = nil
+ @note_order = nil
+ end
+
+ ##
+ # Wraps `text` in emphasis for rdoc inline formatting
+
+ def emphasis text
+ if text =~ /\A[a-z\d.\/]+\z/i then
+ "_#{text}_"
+ else
+ "<em>#{text}</em>"
+ end
+ end
+
+ ##
+ # :category: Extensions
+ #
+ # Is the extension `name` enabled?
+
+ def extension? name
+ @extensions.include? name
+ end
+
+ ##
+ # :category: Extensions
+ #
+ # Enables or disables the extension with `name`
+
+ def extension name, enable
+ if enable then
+ @extensions |= [name]
+ else
+ @extensions -= [name]
+ end
+ end
+
+ ##
+ # Parses `text` in a clone of this parser. This is used for handling nested
+ # lists the same way as markdown_parser.
+
+ def inner_parse text # :nodoc:
+ parser = clone
+
+ parser.setup_parser text, @debug
+
+ parser.peg_parse
+
+ doc = parser.result
+
+ doc.accept @formatter
+
+ doc.parts
+ end
+
+ ##
+ # Finds a link reference for `label` and creates a new link to it with
+ # `content` as the link text. If `label` was not encountered in the
+ # reference-gathering parser pass the label and content are reconstructed
+ # with the linking `text` (usually whitespace).
+
+ def link_to content, label = content, text = nil
+ raise 'enable notes extension' if
+ content.start_with? '^' and label.equal? content
+
+ if ref = @references[label] then
+ "{#{content}}[#{ref}]"
+ elsif label.equal? content then
+ "[#{content}]#{text}"
+ else
+ "[#{content}]#{text}[#{label}]"
+ end
+ end
+
+ ##
+ # Creates an RDoc::Markup::ListItem by parsing the `unparsed` content from
+ # the first parsing pass.
+
+ def list_item_from unparsed
+ parsed = inner_parse unparsed.join
+ RDoc::Markup::ListItem.new nil, *parsed
+ end
+
+ ##
+ # Stores `label` as a note and fills in previously unknown note references.
+
+ def note label
+ #foottext = "rdoc-label:foottext-#{label}:footmark-#{label}"
+
+ #ref.replace foottext if ref = @unlinked_notes.delete(label)
+
+ @notes[label] = foottext
+
+ #"{^1}[rdoc-label:footmark-#{label}:foottext-#{label}] "
+ end
+
+ ##
+ # Creates a new link for the footnote `reference` and adds the reference to
+ # the note order list for proper display at the end of the document.
+
+ def note_for ref
+ @note_order << ref
+
+ label = @note_order.length
+
+ "{*#{label}}[rdoc-label:foottext-#{label}:footmark-#{label}]"
+ end
+
+ ##
+ # The internal kpeg parse method
+
+ alias peg_parse parse # :nodoc:
+
+ ##
+ # Creates an RDoc::Markup::Paragraph from `parts` and including
+ # extension-specific behavior
+
+ def paragraph parts
+ parts = parts.map do |part|
+ if "\n" == part then
+ RDoc::Markup::HardBreak.new
+ else
+ part
+ end
+ end if break_on_newline?
+
+ RDoc::Markup::Paragraph.new(*parts)
+ end
+
+ ##
+ # Parses `markdown` into an RDoc::Document
+
+ def parse markdown
+ @references = {}
+ @unlinked_references = {}
+
+ markdown += "\n\n"
+
+ setup_parser markdown, @debug
+ peg_parse 'References'
+
+ if notes? then
+ @footnotes = {}
+
+ setup_parser markdown, @debug
+ peg_parse 'Notes'
+
+ # using note_order on the first pass would be a bug
+ @note_order = []
+ end
+
+ setup_parser markdown, @debug
+ peg_parse
+
+ doc = result
+
+ if notes? and not @footnotes.empty? then
+ doc << RDoc::Markup::Rule.new(1)
+
+ @note_order.each_with_index do |ref, index|
+ label = index + 1
+ note = @footnotes[ref]
+
+ link = "{^#{label}}[rdoc-label:footmark-#{label}:foottext-#{label}] "
+ note.parts.unshift link
+
+ doc << note
+ end
+ end
+
+ doc.accept @formatter
+
+ doc
+ end
+
+ ##
+ # Stores `label` as a reference to `link` and fills in previously unknown
+ # link references.
+
+ def reference label, link
+ if ref = @unlinked_references.delete(label) then
+ ref.replace link
+ end
+
+ @references[label] = link
+ end
+
+ ##
+ # Wraps `text` in strong markup for rdoc inline formatting
+
+ def strong text
+ if text =~ /\A[a-z\d.\/-]+\z/i then
+ "*#{text}*"
+ else
+ "<b>#{text}</b>"
+ end
+ end
+
+
+ # :stopdoc:
+ def setup_foreign_grammar
+ @_grammar_literals = RDoc::Markdown::Literals.new(nil)
+ end
+
+ # root = Doc
+ def _root
+ _tmp = apply(:_Doc)
+ set_failed_rule :_root unless _tmp
+ return _tmp
+ end
+
+ # Doc = BOM? Block*:a { RDoc::Markup::Document.new(*a.compact) }
+ def _Doc
+
+ _save = self.pos
+ while true # sequence
+ _save1 = self.pos
+ _tmp = apply(:_BOM)
+ unless _tmp
+ _tmp = true
+ self.pos = _save1
+ end
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _ary = []
+ while true
+ _tmp = apply(:_Block)
+ _ary << @result if _tmp
+ break unless _tmp
+ end
+ _tmp = true
+ @result = _ary
+ a = @result
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ @result = begin; RDoc::Markup::Document.new(*a.compact) ; end
+ _tmp = true
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_Doc unless _tmp
+ return _tmp
+ end
+
+ # 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 = _BlankLine()
+ break unless _tmp
+ end
+ _tmp = true
+ unless _tmp
+ self.pos = _save
+ break
+ end
+
+ _save2 = self.pos
+ while true # choice
+ _tmp = apply(:_BlockQuote)
+ break if _tmp
+ self.pos = _save2
+ _tmp = apply(:_Verbatim)
+ break if _tmp
+ self.pos = _save2
+ _tmp = apply(:_CodeFence)
+ break if _tmp
+ self.pos = _save2
+ _tmp = apply(:_Note)
+ break if _tmp
+ self.pos = _save2
+ _tmp = apply(:_Reference)
+ break if _tmp
+ self.pos = _save2
+ _tmp = apply(:_HorizontalRule)
+ break if _tmp
+ self.pos = _save2
+ _tmp = apply(:_Heading)
+ break if _tmp
+ self.pos = _save2
+ _tmp = apply(:_OrderedList)
+ break if _tmp
+ self.pos = _save2
+ _tmp = apply(:_BulletList)
+ break if _tmp
+ self.pos = _save2
+ _tmp = apply(:_DefinitionList)
+ break if _tmp
+ self.pos = _save2
+ _tmp = apply(:_HtmlBlock)
+ break if _tmp
+ self.pos = _save2
+ _tmp = apply(:_StyleBlock)
+ break if _tmp
+ self.pos = _save2
+ _tmp = apply(:_Para)
+ break if _tmp
+ self.pos = _save2
+ _tmp = apply(:_Plain)
+ break if _tmp
+ self.pos = _save2
+ break
+ end # end choice
+
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_Block unless _tmp
+ return _tmp
+ end
+
+ # Para = @NonindentSpace Inlines:a @BlankLine+ { paragraph a }
+ def _Para
+
+ _save = self.pos
+ while true # sequence
+ _tmp = _NonindentSpace()
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_Inlines)
+ a = @result
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _save1 = self.pos
+ _tmp = _BlankLine()
+ if _tmp
+ while true
+ _tmp = _BlankLine()
+ break unless _tmp
+ end
+ _tmp = true
+ else
+ self.pos = _save1
+ end
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ @result = begin; paragraph a ; end
+ _tmp = true
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_Para unless _tmp
+ return _tmp
+ end
+
+ # Plain = Inlines:a { paragraph a }
+ def _Plain
+
+ _save = self.pos
+ while true # sequence
+ _tmp = apply(:_Inlines)
+ a = @result
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ @result = begin; paragraph a ; end
+ _tmp = true
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_Plain unless _tmp
+ return _tmp
+ end
+
+ # AtxInline = !@Newline !(@Sp? /#*/ @Sp @Newline) Inline
+ def _AtxInline
+
+ _save = self.pos
+ while true # sequence
+ _save1 = self.pos
+ _tmp = _Newline()
+ _tmp = _tmp ? nil : true
+ self.pos = _save1
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _save2 = self.pos
+
+ _save3 = self.pos
+ while true # sequence
+ _save4 = self.pos
+ _tmp = _Sp()
+ unless _tmp
+ _tmp = true
+ self.pos = _save4
+ end
+ unless _tmp
+ self.pos = _save3
+ break
+ end
+ _tmp = scan(/\A(?-mix:#*)/)
+ unless _tmp
+ self.pos = _save3
+ break
+ end
+ _tmp = _Sp()
+ unless _tmp
+ self.pos = _save3
+ break
+ end
+ _tmp = _Newline()
+ unless _tmp
+ self.pos = _save3
+ end
+ break
+ end # end sequence
+
+ _tmp = _tmp ? nil : true
+ self.pos = _save2
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_Inline)
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_AtxInline unless _tmp
+ return _tmp
+ end
+
+ # AtxStart = < /\#{1,6}/ > { text.length }
+ def _AtxStart
+
+ _save = self.pos
+ while true # sequence
+ _text_start = self.pos
+ _tmp = scan(/\A(?-mix:\#{1,6})/)
+ if _tmp
+ text = get_text(_text_start)
+ end
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ @result = begin; text.length ; end
+ _tmp = true
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_AtxStart unless _tmp
+ return _tmp
+ end
+
+ # AtxHeading = AtxStart:s @Sp? AtxInline+:a (@Sp? /#*/ @Sp)? @Newline { RDoc::Markup::Heading.new(s, a.join) }
+ def _AtxHeading
+
+ _save = self.pos
+ while true # sequence
+ _tmp = apply(:_AtxStart)
+ s = @result
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _save1 = self.pos
+ _tmp = _Sp()
+ unless _tmp
+ _tmp = true
+ self.pos = _save1
+ end
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _save2 = self.pos
+ _ary = []
+ _tmp = apply(:_AtxInline)
+ if _tmp
+ _ary << @result
+ while true
+ _tmp = apply(:_AtxInline)
+ _ary << @result if _tmp
+ break unless _tmp
+ end
+ _tmp = true
+ @result = _ary
+ else
+ self.pos = _save2
+ end
+ a = @result
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _save3 = self.pos
+
+ _save4 = self.pos
+ while true # sequence
+ _save5 = self.pos
+ _tmp = _Sp()
+ unless _tmp
+ _tmp = true
+ self.pos = _save5
+ end
+ unless _tmp
+ self.pos = _save4
+ break
+ end
+ _tmp = scan(/\A(?-mix:#*)/)
+ unless _tmp
+ self.pos = _save4
+ break
+ end
+ _tmp = _Sp()
+ unless _tmp
+ self.pos = _save4
+ end
+ break
+ end # end sequence
+
+ unless _tmp
+ _tmp = true
+ self.pos = _save3
+ end
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = _Newline()
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ @result = begin; RDoc::Markup::Heading.new(s, a.join) ; end
+ _tmp = true
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_AtxHeading unless _tmp
+ return _tmp
+ end
+
+ # SetextHeading = (SetextHeading1 | SetextHeading2)
+ def _SetextHeading
+
+ _save = self.pos
+ while true # choice
+ _tmp = apply(:_SetextHeading1)
+ break if _tmp
+ self.pos = _save
+ _tmp = apply(:_SetextHeading2)
+ break if _tmp
+ self.pos = _save
+ break
+ end # end choice
+
+ set_failed_rule :_SetextHeading unless _tmp
+ return _tmp
+ end
+
+ # SetextBottom1 = /={3,}/ @Newline
+ def _SetextBottom1
+
+ _save = self.pos
+ while true # sequence
+ _tmp = scan(/\A(?-mix:={3,})/)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = _Newline()
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_SetextBottom1 unless _tmp
+ return _tmp
+ end
+
+ # SetextBottom2 = /-{3,}/ @Newline
+ def _SetextBottom2
+
+ _save = self.pos
+ while true # sequence
+ _tmp = scan(/\A(?-mix:-{3,})/)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = _Newline()
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_SetextBottom2 unless _tmp
+ return _tmp
+ end
+
+ # 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
+ while true # sequence
+ _save1 = self.pos
+
+ _save2 = self.pos
+ while true # sequence
+ _tmp = _RawLine()
+ unless _tmp
+ self.pos = _save2
+ break
+ end
+ _tmp = apply(:_SetextBottom1)
+ unless _tmp
+ self.pos = _save2
+ end
+ break
+ end # end sequence
+
+ self.pos = _save1
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = _StartList()
+ a = @result
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _save3 = self.pos
+
+ _save4 = self.pos
+ while true # sequence
+ _save5 = self.pos
+ _tmp = _Endline()
+ _tmp = _tmp ? nil : true
+ self.pos = _save5
+ unless _tmp
+ self.pos = _save4
+ break
+ end
+ _tmp = apply(:_Inline)
+ b = @result
+ unless _tmp
+ self.pos = _save4
+ break
+ end
+ @result = begin; a << b ; end
+ _tmp = true
+ unless _tmp
+ self.pos = _save4
+ end
+ break
+ end # end sequence
+
+ if _tmp
+ while true
+
+ _save6 = self.pos
+ while true # sequence
+ _save7 = self.pos
+ _tmp = _Endline()
+ _tmp = _tmp ? nil : true
+ self.pos = _save7
+ unless _tmp
+ self.pos = _save6
+ break
+ end
+ _tmp = apply(:_Inline)
+ b = @result
+ unless _tmp
+ self.pos = _save6
+ break
+ end
+ @result = begin; a << b ; end
+ _tmp = true
+ unless _tmp
+ self.pos = _save6
+ end
+ break
+ end # end sequence
+
+ break unless _tmp
+ end
+ _tmp = true
+ else
+ self.pos = _save3
+ end
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _save8 = self.pos
+ _tmp = _Sp()
+ unless _tmp
+ _tmp = true
+ self.pos = _save8
+ end
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = _Newline()
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_SetextBottom1)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ @result = begin; RDoc::Markup::Heading.new(1, a.join) ; end
+ _tmp = true
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_SetextHeading1 unless _tmp
+ return _tmp
+ end
+
+ # 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
+ while true # sequence
+ _save1 = self.pos
+
+ _save2 = self.pos
+ while true # sequence
+ _tmp = _RawLine()
+ unless _tmp
+ self.pos = _save2
+ break
+ end
+ _tmp = apply(:_SetextBottom2)
+ unless _tmp
+ self.pos = _save2
+ end
+ break
+ end # end sequence
+
+ self.pos = _save1
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = _StartList()
+ a = @result
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _save3 = self.pos
+
+ _save4 = self.pos
+ while true # sequence
+ _save5 = self.pos
+ _tmp = _Endline()
+ _tmp = _tmp ? nil : true
+ self.pos = _save5
+ unless _tmp
+ self.pos = _save4
+ break
+ end
+ _tmp = apply(:_Inline)
+ b = @result
+ unless _tmp
+ self.pos = _save4
+ break
+ end
+ @result = begin; a << b ; end
+ _tmp = true
+ unless _tmp
+ self.pos = _save4
+ end
+ break
+ end # end sequence
+
+ if _tmp
+ while true
+
+ _save6 = self.pos
+ while true # sequence
+ _save7 = self.pos
+ _tmp = _Endline()
+ _tmp = _tmp ? nil : true
+ self.pos = _save7
+ unless _tmp
+ self.pos = _save6
+ break
+ end
+ _tmp = apply(:_Inline)
+ b = @result
+ unless _tmp
+ self.pos = _save6
+ break
+ end
+ @result = begin; a << b ; end
+ _tmp = true
+ unless _tmp
+ self.pos = _save6
+ end
+ break
+ end # end sequence
+
+ break unless _tmp
+ end
+ _tmp = true
+ else
+ self.pos = _save3
+ end
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _save8 = self.pos
+ _tmp = _Sp()
+ unless _tmp
+ _tmp = true
+ self.pos = _save8
+ end
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = _Newline()
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_SetextBottom2)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ @result = begin; RDoc::Markup::Heading.new(2, a.join) ; end
+ _tmp = true
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_SetextHeading2 unless _tmp
+ return _tmp
+ end
+
+ # Heading = (SetextHeading | AtxHeading)
+ def _Heading
+
+ _save = self.pos
+ while true # choice
+ _tmp = apply(:_SetextHeading)
+ break if _tmp
+ self.pos = _save
+ _tmp = apply(:_AtxHeading)
+ break if _tmp
+ self.pos = _save
+ break
+ end # end choice
+
+ set_failed_rule :_Heading unless _tmp
+ return _tmp
+ end
+
+ # BlockQuote = BlockQuoteRaw:a { RDoc::Markup::BlockQuote.new(*a) }
+ def _BlockQuote
+
+ _save = self.pos
+ while true # sequence
+ _tmp = apply(:_BlockQuoteRaw)
+ a = @result
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ @result = begin; RDoc::Markup::BlockQuote.new(*a) ; end
+ _tmp = true
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_BlockQuote unless _tmp
+ return _tmp
+ end
+
+ # 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 = _StartList()
+ a = @result
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _save1 = self.pos
+
+ _save2 = self.pos
+ while true # sequence
+ _tmp = match_string(">")
+ unless _tmp
+ self.pos = _save2
+ break
+ end
+ _save3 = self.pos
+ _tmp = match_string(" ")
+ unless _tmp
+ _tmp = true
+ self.pos = _save3
+ end
+ unless _tmp
+ self.pos = _save2
+ break
+ end
+ _tmp = apply(:_Line)
+ l = @result
+ unless _tmp
+ self.pos = _save2
+ break
+ end
+ @result = begin; a << l ; end
+ _tmp = true
+ unless _tmp
+ self.pos = _save2
+ break
+ end
+ while true
+
+ _save5 = self.pos
+ while true # sequence
+ _save6 = self.pos
+ _tmp = match_string(">")
+ _tmp = _tmp ? nil : true
+ self.pos = _save6
+ unless _tmp
+ self.pos = _save5
+ break
+ end
+ _save7 = self.pos
+ _tmp = _BlankLine()
+ _tmp = _tmp ? nil : true
+ self.pos = _save7
+ unless _tmp
+ self.pos = _save5
+ break
+ end
+ _tmp = apply(:_Line)
+ c = @result
+ unless _tmp
+ self.pos = _save5
+ break
+ end
+ @result = begin; a << c ; end
+ _tmp = true
+ unless _tmp
+ self.pos = _save5
+ end
+ break
+ end # end sequence
+
+ break unless _tmp
+ end
+ _tmp = true
+ unless _tmp
+ self.pos = _save2
+ break
+ end
+ while true
+
+ _save9 = self.pos
+ while true # sequence
+ _tmp = _BlankLine()
+ n = @result
+ unless _tmp
+ self.pos = _save9
+ break
+ end
+ @result = begin; a << n ; end
+ _tmp = true
+ unless _tmp
+ self.pos = _save9
+ end
+ break
+ end # end sequence
+
+ break unless _tmp
+ end
+ _tmp = true
+ unless _tmp
+ self.pos = _save2
+ end
+ break
+ end # end sequence
+
+ if _tmp
+ while true
+
+ _save10 = self.pos
+ while true # sequence
+ _tmp = match_string(">")
+ unless _tmp
+ self.pos = _save10
+ break
+ end
+ _save11 = self.pos
+ _tmp = match_string(" ")
+ unless _tmp
+ _tmp = true
+ self.pos = _save11
+ end
+ unless _tmp
+ self.pos = _save10
+ break
+ end
+ _tmp = apply(:_Line)
+ l = @result
+ unless _tmp
+ self.pos = _save10
+ break
+ end
+ @result = begin; a << l ; end
+ _tmp = true
+ unless _tmp
+ self.pos = _save10
+ break
+ end
+ while true
+
+ _save13 = self.pos
+ while true # sequence
+ _save14 = self.pos
+ _tmp = match_string(">")
+ _tmp = _tmp ? nil : true
+ self.pos = _save14
+ unless _tmp
+ self.pos = _save13
+ break
+ end
+ _save15 = self.pos
+ _tmp = _BlankLine()
+ _tmp = _tmp ? nil : true
+ self.pos = _save15
+ unless _tmp
+ self.pos = _save13
+ break
+ end
+ _tmp = apply(:_Line)
+ c = @result
+ unless _tmp
+ self.pos = _save13
+ break
+ end
+ @result = begin; a << c ; end
+ _tmp = true
+ unless _tmp
+ self.pos = _save13
+ end
+ break
+ end # end sequence
+
+ break unless _tmp
+ end
+ _tmp = true
+ unless _tmp
+ self.pos = _save10
+ break
+ end
+ while true
+
+ _save17 = self.pos
+ while true # sequence
+ _tmp = _BlankLine()
+ n = @result
+ unless _tmp
+ self.pos = _save17
+ break
+ end
+ @result = begin; a << n ; end
+ _tmp = true
+ unless _tmp
+ self.pos = _save17
+ end
+ break
+ end # end sequence
+
+ break unless _tmp
+ end
+ _tmp = true
+ unless _tmp
+ self.pos = _save10
+ end
+ break
+ end # end sequence
+
+ break unless _tmp
+ end
+ _tmp = true
+ else
+ self.pos = _save1
+ end
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ @result = begin; inner_parse a.join ; end
+ _tmp = true
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_BlockQuoteRaw unless _tmp
+ return _tmp
+ end
+
+ # NonblankIndentedLine = !@BlankLine IndentedLine
+ def _NonblankIndentedLine
+
+ _save = self.pos
+ while true # sequence
+ _save1 = self.pos
+ _tmp = _BlankLine()
+ _tmp = _tmp ? nil : true
+ self.pos = _save1
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_IndentedLine)
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_NonblankIndentedLine unless _tmp
+ return _tmp
+ end
+
+ # VerbatimChunk = @BlankLine*:a NonblankIndentedLine+:b { a.concat b }
+ def _VerbatimChunk
+
+ _save = self.pos
+ while true # sequence
+ _ary = []
+ while true
+ _tmp = _BlankLine()
+ _ary << @result if _tmp
+ break unless _tmp
+ end
+ _tmp = true
+ @result = _ary
+ a = @result
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _save2 = self.pos
+ _ary = []
+ _tmp = apply(:_NonblankIndentedLine)
+ if _tmp
+ _ary << @result
+ while true
+ _tmp = apply(:_NonblankIndentedLine)
+ _ary << @result if _tmp
+ break unless _tmp
+ end
+ _tmp = true
+ @result = _ary
+ else
+ self.pos = _save2
+ end
+ b = @result
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ @result = begin; a.concat b ; end
+ _tmp = true
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_VerbatimChunk unless _tmp
+ return _tmp
+ end
+
+ # Verbatim = VerbatimChunk+:a { RDoc::Markup::Verbatim.new(*a.flatten) }
+ def _Verbatim
+
+ _save = self.pos
+ while true # sequence
+ _save1 = self.pos
+ _ary = []
+ _tmp = apply(:_VerbatimChunk)
+ if _tmp
+ _ary << @result
+ while true
+ _tmp = apply(:_VerbatimChunk)
+ _ary << @result if _tmp
+ break unless _tmp
+ end
+ _tmp = true
+ @result = _ary
+ else
+ self.pos = _save1
+ end
+ a = @result
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ @result = begin; RDoc::Markup::Verbatim.new(*a.flatten) ; end
+ _tmp = true
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_Verbatim unless _tmp
+ return _tmp
+ end
+
+ # 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 = _NonindentSpace()
+ unless _tmp
+ self.pos = _save
+ break
+ end
+
+ _save1 = self.pos
+ while true # choice
+
+ _save2 = self.pos
+ while true # sequence
+ _tmp = match_string("*")
+ unless _tmp
+ self.pos = _save2
+ break
+ end
+ _tmp = _Sp()
+ unless _tmp
+ self.pos = _save2
+ break
+ end
+ _tmp = match_string("*")
+ unless _tmp
+ self.pos = _save2
+ break
+ end
+ _tmp = _Sp()
+ unless _tmp
+ self.pos = _save2
+ break
+ end
+ _tmp = match_string("*")
+ unless _tmp
+ self.pos = _save2
+ break
+ end
+ while true
+
+ _save4 = self.pos
+ while true # sequence
+ _tmp = _Sp()
+ unless _tmp
+ self.pos = _save4
+ break
+ end
+ _tmp = match_string("*")
+ unless _tmp
+ self.pos = _save4
+ end
+ break
+ end # end sequence
+
+ break unless _tmp
+ end
+ _tmp = true
+ unless _tmp
+ self.pos = _save2
+ end
+ break
+ end # end sequence
+
+ break if _tmp
+ self.pos = _save1
+
+ _save5 = self.pos
+ while true # sequence
+ _tmp = match_string("-")
+ unless _tmp
+ self.pos = _save5
+ break
+ end
+ _tmp = _Sp()
+ unless _tmp
+ self.pos = _save5
+ break
+ end
+ _tmp = match_string("-")
+ unless _tmp
+ self.pos = _save5
+ break
+ end
+ _tmp = _Sp()
+ unless _tmp
+ self.pos = _save5
+ break
+ end
+ _tmp = match_string("-")
+ unless _tmp
+ self.pos = _save5
+ break
+ end
+ while true
+
+ _save7 = self.pos
+ while true # sequence
+ _tmp = _Sp()
+ unless _tmp
+ self.pos = _save7
+ break
+ end
+ _tmp = match_string("-")
+ unless _tmp
+ self.pos = _save7
+ end
+ break
+ end # end sequence
+
+ break unless _tmp
+ end
+ _tmp = true
+ unless _tmp
+ self.pos = _save5
+ end
+ break
+ end # end sequence
+
+ break if _tmp
+ self.pos = _save1
+
+ _save8 = self.pos
+ while true # sequence
+ _tmp = match_string("_")
+ unless _tmp
+ self.pos = _save8
+ break
+ end
+ _tmp = _Sp()
+ unless _tmp
+ self.pos = _save8
+ break
+ end
+ _tmp = match_string("_")
+ unless _tmp
+ self.pos = _save8
+ break
+ end
+ _tmp = _Sp()
+ unless _tmp
+ self.pos = _save8
+ break
+ end
+ _tmp = match_string("_")
+ unless _tmp
+ self.pos = _save8
+ break
+ end
+ while true
+
+ _save10 = self.pos
+ while true # sequence
+ _tmp = _Sp()
+ unless _tmp
+ self.pos = _save10
+ break
+ end
+ _tmp = match_string("_")
+ unless _tmp
+ self.pos = _save10
+ end
+ break
+ end # end sequence
+
+ break unless _tmp
+ end
+ _tmp = true
+ unless _tmp
+ self.pos = _save8
+ end
+ break
+ end # end sequence
+
+ break if _tmp
+ self.pos = _save1
+ break
+ end # end choice
+
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = _Sp()
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = _Newline()
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _save11 = self.pos
+ _tmp = _BlankLine()
+ if _tmp
+ while true
+ _tmp = _BlankLine()
+ break unless _tmp
+ end
+ _tmp = true
+ else
+ self.pos = _save11
+ end
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ @result = begin; RDoc::Markup::Rule.new 1 ; end
+ _tmp = true
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_HorizontalRule unless _tmp
+ return _tmp
+ end
+
+ # Bullet = !HorizontalRule @NonindentSpace /[+*-]/ @Spacechar+
+ def _Bullet
+
+ _save = self.pos
+ while true # sequence
+ _save1 = self.pos
+ _tmp = apply(:_HorizontalRule)
+ _tmp = _tmp ? nil : true
+ self.pos = _save1
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = _NonindentSpace()
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = scan(/\A(?-mix:[+*-])/)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _save2 = self.pos
+ _tmp = _Spacechar()
+ if _tmp
+ while true
+ _tmp = _Spacechar()
+ break unless _tmp
+ end
+ _tmp = true
+ else
+ self.pos = _save2
+ end
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_Bullet unless _tmp
+ return _tmp
+ end
+
+ # BulletList = &Bullet (ListTight | ListLoose):a { RDoc::Markup::List.new(:BULLET, *a) }
+ def _BulletList
+
+ _save = self.pos
+ while true # sequence
+ _save1 = self.pos
+ _tmp = apply(:_Bullet)
+ self.pos = _save1
+ unless _tmp
+ self.pos = _save
+ break
+ end
+
+ _save2 = self.pos
+ while true # choice
+ _tmp = apply(:_ListTight)
+ break if _tmp
+ self.pos = _save2
+ _tmp = apply(:_ListLoose)
+ break if _tmp
+ self.pos = _save2
+ break
+ end # end choice
+
+ a = @result
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ @result = begin; RDoc::Markup::List.new(:BULLET, *a) ; end
+ _tmp = true
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_BulletList unless _tmp
+ return _tmp
+ end
+
+ # ListTight = ListItemTight+:a @BlankLine* !(Bullet | Enumerator) { a }
+ def _ListTight
+
+ _save = self.pos
+ while true # sequence
+ _save1 = self.pos
+ _ary = []
+ _tmp = apply(:_ListItemTight)
+ if _tmp
+ _ary << @result
+ while true
+ _tmp = apply(:_ListItemTight)
+ _ary << @result if _tmp
+ break unless _tmp
+ end
+ _tmp = true
+ @result = _ary
+ else
+ self.pos = _save1
+ end
+ a = @result
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ while true
+ _tmp = _BlankLine()
+ break unless _tmp
+ end
+ _tmp = true
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _save3 = self.pos
+
+ _save4 = self.pos
+ while true # choice
+ _tmp = apply(:_Bullet)
+ break if _tmp
+ self.pos = _save4
+ _tmp = apply(:_Enumerator)
+ break if _tmp
+ self.pos = _save4
+ break
+ end # end choice
+
+ _tmp = _tmp ? nil : true
+ self.pos = _save3
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ @result = begin; a ; end
+ _tmp = true
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_ListTight unless _tmp
+ return _tmp
+ end
+
+ # ListLoose = @StartList:a (ListItem:b @BlankLine* { a << b })+ { a }
+ def _ListLoose
+
+ _save = self.pos
+ while true # sequence
+ _tmp = _StartList()
+ a = @result
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _save1 = self.pos
+
+ _save2 = self.pos
+ while true # sequence
+ _tmp = apply(:_ListItem)
+ b = @result
+ unless _tmp
+ self.pos = _save2
+ break
+ end
+ while true
+ _tmp = _BlankLine()
+ break unless _tmp
+ end
+ _tmp = true
+ unless _tmp
+ self.pos = _save2
+ break
+ end
+ @result = begin; a << b ; end
+ _tmp = true
+ unless _tmp
+ self.pos = _save2
+ end
+ break
+ end # end sequence
+
+ if _tmp
+ while true
+
+ _save4 = self.pos
+ while true # sequence
+ _tmp = apply(:_ListItem)
+ b = @result
+ unless _tmp
+ self.pos = _save4
+ break
+ end
+ while true
+ _tmp = _BlankLine()
+ break unless _tmp
+ end
+ _tmp = true
+ unless _tmp
+ self.pos = _save4
+ break
+ end
+ @result = begin; a << b ; end
+ _tmp = true
+ unless _tmp
+ self.pos = _save4
+ end
+ break
+ end # end sequence
+
+ break unless _tmp
+ end
+ _tmp = true
+ else
+ self.pos = _save1
+ end
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ @result = begin; a ; end
+ _tmp = true
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_ListLoose unless _tmp
+ return _tmp
+ end
+
+ # ListItem = (Bullet | Enumerator) @StartList:a ListBlock:b { a << b } (ListContinuationBlock:c { a.push(*c) })* { list_item_from a }
+ def _ListItem
+
+ _save = self.pos
+ while true # sequence
+
+ _save1 = self.pos
+ while true # choice
+ _tmp = apply(:_Bullet)
+ break if _tmp
+ self.pos = _save1
+ _tmp = apply(:_Enumerator)
+ break if _tmp
+ self.pos = _save1
+ break
+ end # end choice
+
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = _StartList()
+ a = @result
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_ListBlock)
+ b = @result
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ @result = begin; a << b ; end
+ _tmp = true
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ while true
+
+ _save3 = self.pos
+ while true # sequence
+ _tmp = apply(:_ListContinuationBlock)
+ c = @result
+ unless _tmp
+ self.pos = _save3
+ break
+ end
+ @result = begin; a.push(*c) ; end
+ _tmp = true
+ unless _tmp
+ self.pos = _save3
+ end
+ break
+ end # end sequence
+
+ break unless _tmp
+ end
+ _tmp = true
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ @result = begin; list_item_from a ; end
+ _tmp = true
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_ListItem unless _tmp
+ return _tmp
+ end
+
+ # ListItemTight = (Bullet | Enumerator) ListBlock:a (!@BlankLine ListContinuationBlock:b { a.push(*b) })* !ListContinuationBlock { list_item_from a }
+ def _ListItemTight
+
+ _save = self.pos
+ while true # sequence
+
+ _save1 = self.pos
+ while true # choice
+ _tmp = apply(:_Bullet)
+ break if _tmp
+ self.pos = _save1
+ _tmp = apply(:_Enumerator)
+ break if _tmp
+ self.pos = _save1
+ break
+ end # end choice
+
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_ListBlock)
+ a = @result
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ while true
+
+ _save3 = self.pos
+ while true # sequence
+ _save4 = self.pos
+ _tmp = _BlankLine()
+ _tmp = _tmp ? nil : true
+ self.pos = _save4
+ unless _tmp
+ self.pos = _save3
+ break
+ end
+ _tmp = apply(:_ListContinuationBlock)
+ b = @result
+ unless _tmp
+ self.pos = _save3
+ break
+ end
+ @result = begin; a.push(*b) ; end
+ _tmp = true
+ unless _tmp
+ self.pos = _save3
+ end
+ break
+ end # end sequence
+
+ break unless _tmp
+ end
+ _tmp = true
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _save5 = self.pos
+ _tmp = apply(:_ListContinuationBlock)
+ _tmp = _tmp ? nil : true
+ self.pos = _save5
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ @result = begin; list_item_from a ; end
+ _tmp = true
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_ListItemTight unless _tmp
+ return _tmp
+ end
+
+ # ListBlock = !@BlankLine Line:a ListBlockLine*:c { [a, *c] }
+ def _ListBlock
+
+ _save = self.pos
+ while true # sequence
+ _save1 = self.pos
+ _tmp = _BlankLine()
+ _tmp = _tmp ? nil : true
+ self.pos = _save1
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_Line)
+ a = @result
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _ary = []
+ while true
+ _tmp = apply(:_ListBlockLine)
+ _ary << @result if _tmp
+ break unless _tmp
+ end
+ _tmp = true
+ @result = _ary
+ c = @result
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ @result = begin; [a, *c] ; end
+ _tmp = true
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_ListBlock unless _tmp
+ return _tmp
+ end
+
+ # ListContinuationBlock = @StartList:a @BlankLine* { a << "\n" } (Indent ListBlock:b { a.concat b })+ { a }
+ def _ListContinuationBlock
+
+ _save = self.pos
+ while true # sequence
+ _tmp = _StartList()
+ a = @result
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ while true
+ _tmp = _BlankLine()
+ break unless _tmp
+ end
+ _tmp = true
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ @result = begin; a << "\n" ; end
+ _tmp = true
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _save2 = self.pos
+
+ _save3 = self.pos
+ while true # sequence
+ _tmp = apply(:_Indent)
+ unless _tmp
+ self.pos = _save3
+ break
+ end
+ _tmp = apply(:_ListBlock)
+ b = @result
+ unless _tmp
+ self.pos = _save3
+ break
+ end
+ @result = begin; a.concat b ; end
+ _tmp = true
+ unless _tmp
+ self.pos = _save3
+ end
+ break
+ end # end sequence
+
+ if _tmp
+ while true
+
+ _save4 = self.pos
+ while true # sequence
+ _tmp = apply(:_Indent)
+ unless _tmp
+ self.pos = _save4
+ break
+ end
+ _tmp = apply(:_ListBlock)
+ b = @result
+ unless _tmp
+ self.pos = _save4
+ break
+ end
+ @result = begin; a.concat b ; end
+ _tmp = true
+ unless _tmp
+ self.pos = _save4
+ end
+ break
+ end # end sequence
+
+ break unless _tmp
+ end
+ _tmp = true
+ else
+ self.pos = _save2
+ end
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ @result = begin; a ; end
+ _tmp = true
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_ListContinuationBlock unless _tmp
+ return _tmp
+ end
+
+ # Enumerator = @NonindentSpace [0-9]+ "." @Spacechar+
+ def _Enumerator
+
+ _save = self.pos
+ while true # sequence
+ _tmp = _NonindentSpace()
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _save1 = self.pos
+ _save2 = self.pos
+ _tmp = get_byte
+ if _tmp
+ unless _tmp >= 48 and _tmp <= 57
+ self.pos = _save2
+ _tmp = nil
+ end
+ end
+ if _tmp
+ while true
+ _save3 = self.pos
+ _tmp = get_byte
+ if _tmp
+ unless _tmp >= 48 and _tmp <= 57
+ self.pos = _save3
+ _tmp = nil
+ end
+ end
+ break unless _tmp
+ end
+ _tmp = true
+ else
+ self.pos = _save1
+ end
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = match_string(".")
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _save4 = self.pos
+ _tmp = _Spacechar()
+ if _tmp
+ while true
+ _tmp = _Spacechar()
+ break unless _tmp
+ end
+ _tmp = true
+ else
+ self.pos = _save4
+ end
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_Enumerator unless _tmp
+ return _tmp
+ end
+
+ # OrderedList = &Enumerator (ListTight | ListLoose):a { RDoc::Markup::List.new(:NUMBER, *a) }
+ def _OrderedList
+
+ _save = self.pos
+ while true # sequence
+ _save1 = self.pos
+ _tmp = apply(:_Enumerator)
+ self.pos = _save1
+ unless _tmp
+ self.pos = _save
+ break
+ end
+
+ _save2 = self.pos
+ while true # choice
+ _tmp = apply(:_ListTight)
+ break if _tmp
+ self.pos = _save2
+ _tmp = apply(:_ListLoose)
+ break if _tmp
+ self.pos = _save2
+ break
+ end # end choice
+
+ a = @result
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ @result = begin; RDoc::Markup::List.new(:NUMBER, *a) ; end
+ _tmp = true
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_OrderedList unless _tmp
+ return _tmp
+ end
+
+ # ListBlockLine = !@BlankLine !(Indent? (Bullet | Enumerator)) !HorizontalRule OptionallyIndentedLine
+ def _ListBlockLine
+
+ _save = self.pos
+ while true # sequence
+ _save1 = self.pos
+ _tmp = _BlankLine()
+ _tmp = _tmp ? nil : true
+ self.pos = _save1
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _save2 = self.pos
+
+ _save3 = self.pos
+ while true # sequence
+ _save4 = self.pos
+ _tmp = apply(:_Indent)
+ unless _tmp
+ _tmp = true
+ self.pos = _save4
+ end
+ unless _tmp
+ self.pos = _save3
+ break
+ end
+
+ _save5 = self.pos
+ while true # choice
+ _tmp = apply(:_Bullet)
+ break if _tmp
+ self.pos = _save5
+ _tmp = apply(:_Enumerator)
+ break if _tmp
+ self.pos = _save5
+ break
+ end # end choice
+
+ unless _tmp
+ self.pos = _save3
+ end
+ break
+ end # end sequence
+
+ _tmp = _tmp ? nil : true
+ self.pos = _save2
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _save6 = self.pos
+ _tmp = apply(:_HorizontalRule)
+ _tmp = _tmp ? nil : true
+ self.pos = _save6
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_OptionallyIndentedLine)
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_ListBlockLine unless _tmp
+ return _tmp
+ end
+
+ # HtmlBlockOpenAddress = "<" Spnl ("address" | "ADDRESS") Spnl HtmlAttribute* ">"
+ def _HtmlBlockOpenAddress
+
+ _save = self.pos
+ while true # sequence
+ _tmp = match_string("<")
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_Spnl)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+
+ _save1 = self.pos
+ while true # choice
+ _tmp = match_string("address")
+ break if _tmp
+ self.pos = _save1
+ _tmp = match_string("ADDRESS")
+ break if _tmp
+ self.pos = _save1
+ break
+ end # end choice
+
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_Spnl)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ while true
+ _tmp = apply(:_HtmlAttribute)
+ break unless _tmp
+ end
+ _tmp = true
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = match_string(">")
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_HtmlBlockOpenAddress unless _tmp
+ return _tmp
+ end
+
+ # HtmlBlockCloseAddress = "<" Spnl "/" ("address" | "ADDRESS") Spnl ">"
+ def _HtmlBlockCloseAddress
+
+ _save = self.pos
+ while true # sequence
+ _tmp = match_string("<")
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_Spnl)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = match_string("/")
+ unless _tmp
+ self.pos = _save
+ break
+ end
+
+ _save1 = self.pos
+ while true # choice
+ _tmp = match_string("address")
+ break if _tmp
+ self.pos = _save1
+ _tmp = match_string("ADDRESS")
+ break if _tmp
+ self.pos = _save1
+ break
+ end # end choice
+
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_Spnl)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = match_string(">")
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_HtmlBlockCloseAddress unless _tmp
+ return _tmp
+ end
+
+ # HtmlBlockAddress = HtmlBlockOpenAddress (HtmlBlockAddress | !HtmlBlockCloseAddress .)* HtmlBlockCloseAddress
+ def _HtmlBlockAddress
+
+ _save = self.pos
+ while true # sequence
+ _tmp = apply(:_HtmlBlockOpenAddress)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ while true
+
+ _save2 = self.pos
+ while true # choice
+ _tmp = apply(:_HtmlBlockAddress)
+ break if _tmp
+ self.pos = _save2
+
+ _save3 = self.pos
+ while true # sequence
+ _save4 = self.pos
+ _tmp = apply(:_HtmlBlockCloseAddress)
+ _tmp = _tmp ? nil : true
+ self.pos = _save4
+ unless _tmp
+ self.pos = _save3
+ break
+ end
+ _tmp = get_byte
+ unless _tmp
+ self.pos = _save3
+ end
+ break
+ end # end sequence
+
+ break if _tmp
+ self.pos = _save2
+ break
+ end # end choice
+
+ break unless _tmp
+ end
+ _tmp = true
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_HtmlBlockCloseAddress)
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_HtmlBlockAddress unless _tmp
+ return _tmp
+ end
+
+ # HtmlBlockOpenBlockquote = "<" Spnl ("blockquote" | "BLOCKQUOTE") Spnl HtmlAttribute* ">"
+ def _HtmlBlockOpenBlockquote
+
+ _save = self.pos
+ while true # sequence
+ _tmp = match_string("<")
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_Spnl)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+
+ _save1 = self.pos
+ while true # choice
+ _tmp = match_string("blockquote")
+ break if _tmp
+ self.pos = _save1
+ _tmp = match_string("BLOCKQUOTE")
+ break if _tmp
+ self.pos = _save1
+ break
+ end # end choice
+
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_Spnl)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ while true
+ _tmp = apply(:_HtmlAttribute)
+ break unless _tmp
+ end
+ _tmp = true
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = match_string(">")
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_HtmlBlockOpenBlockquote unless _tmp
+ return _tmp
+ end
+
+ # HtmlBlockCloseBlockquote = "<" Spnl "/" ("blockquote" | "BLOCKQUOTE") Spnl ">"
+ def _HtmlBlockCloseBlockquote
+
+ _save = self.pos
+ while true # sequence
+ _tmp = match_string("<")
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_Spnl)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = match_string("/")
+ unless _tmp
+ self.pos = _save
+ break
+ end
+
+ _save1 = self.pos
+ while true # choice
+ _tmp = match_string("blockquote")
+ break if _tmp
+ self.pos = _save1
+ _tmp = match_string("BLOCKQUOTE")
+ break if _tmp
+ self.pos = _save1
+ break
+ end # end choice
+
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_Spnl)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = match_string(">")
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_HtmlBlockCloseBlockquote unless _tmp
+ return _tmp
+ end
+
+ # HtmlBlockBlockquote = HtmlBlockOpenBlockquote (HtmlBlockBlockquote | !HtmlBlockCloseBlockquote .)* HtmlBlockCloseBlockquote
+ def _HtmlBlockBlockquote
+
+ _save = self.pos
+ while true # sequence
+ _tmp = apply(:_HtmlBlockOpenBlockquote)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ while true
+
+ _save2 = self.pos
+ while true # choice
+ _tmp = apply(:_HtmlBlockBlockquote)
+ break if _tmp
+ self.pos = _save2
+
+ _save3 = self.pos
+ while true # sequence
+ _save4 = self.pos
+ _tmp = apply(:_HtmlBlockCloseBlockquote)
+ _tmp = _tmp ? nil : true
+ self.pos = _save4
+ unless _tmp
+ self.pos = _save3
+ break
+ end
+ _tmp = get_byte
+ unless _tmp
+ self.pos = _save3
+ end
+ break
+ end # end sequence
+
+ break if _tmp
+ self.pos = _save2
+ break
+ end # end choice
+
+ break unless _tmp
+ end
+ _tmp = true
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_HtmlBlockCloseBlockquote)
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_HtmlBlockBlockquote unless _tmp
+ return _tmp
+ end
+
+ # HtmlBlockOpenCenter = "<" Spnl ("center" | "CENTER") Spnl HtmlAttribute* ">"
+ def _HtmlBlockOpenCenter
+
+ _save = self.pos
+ while true # sequence
+ _tmp = match_string("<")
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_Spnl)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+
+ _save1 = self.pos
+ while true # choice
+ _tmp = match_string("center")
+ break if _tmp
+ self.pos = _save1
+ _tmp = match_string("CENTER")
+ break if _tmp
+ self.pos = _save1
+ break
+ end # end choice
+
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_Spnl)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ while true
+ _tmp = apply(:_HtmlAttribute)
+ break unless _tmp
+ end
+ _tmp = true
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = match_string(">")
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_HtmlBlockOpenCenter unless _tmp
+ return _tmp
+ end
+
+ # HtmlBlockCloseCenter = "<" Spnl "/" ("center" | "CENTER") Spnl ">"
+ def _HtmlBlockCloseCenter
+
+ _save = self.pos
+ while true # sequence
+ _tmp = match_string("<")
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_Spnl)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = match_string("/")
+ unless _tmp
+ self.pos = _save
+ break
+ end
+
+ _save1 = self.pos
+ while true # choice
+ _tmp = match_string("center")
+ break if _tmp
+ self.pos = _save1
+ _tmp = match_string("CENTER")
+ break if _tmp
+ self.pos = _save1
+ break
+ end # end choice
+
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_Spnl)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = match_string(">")
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_HtmlBlockCloseCenter unless _tmp
+ return _tmp
+ end
+
+ # HtmlBlockCenter = HtmlBlockOpenCenter (HtmlBlockCenter | !HtmlBlockCloseCenter .)* HtmlBlockCloseCenter
+ def _HtmlBlockCenter
+
+ _save = self.pos
+ while true # sequence
+ _tmp = apply(:_HtmlBlockOpenCenter)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ while true
+
+ _save2 = self.pos
+ while true # choice
+ _tmp = apply(:_HtmlBlockCenter)
+ break if _tmp
+ self.pos = _save2
+
+ _save3 = self.pos
+ while true # sequence
+ _save4 = self.pos
+ _tmp = apply(:_HtmlBlockCloseCenter)
+ _tmp = _tmp ? nil : true
+ self.pos = _save4
+ unless _tmp
+ self.pos = _save3
+ break
+ end
+ _tmp = get_byte
+ unless _tmp
+ self.pos = _save3
+ end
+ break
+ end # end sequence
+
+ break if _tmp
+ self.pos = _save2
+ break
+ end # end choice
+
+ break unless _tmp
+ end
+ _tmp = true
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_HtmlBlockCloseCenter)
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_HtmlBlockCenter unless _tmp
+ return _tmp
+ end
+
+ # HtmlBlockOpenDir = "<" Spnl ("dir" | "DIR") Spnl HtmlAttribute* ">"
+ def _HtmlBlockOpenDir
+
+ _save = self.pos
+ while true # sequence
+ _tmp = match_string("<")
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_Spnl)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+
+ _save1 = self.pos
+ while true # choice
+ _tmp = match_string("dir")
+ break if _tmp
+ self.pos = _save1
+ _tmp = match_string("DIR")
+ break if _tmp
+ self.pos = _save1
+ break
+ end # end choice
+
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_Spnl)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ while true
+ _tmp = apply(:_HtmlAttribute)
+ break unless _tmp
+ end
+ _tmp = true
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = match_string(">")
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_HtmlBlockOpenDir unless _tmp
+ return _tmp
+ end
+
+ # HtmlBlockCloseDir = "<" Spnl "/" ("dir" | "DIR") Spnl ">"
+ def _HtmlBlockCloseDir
+
+ _save = self.pos
+ while true # sequence
+ _tmp = match_string("<")
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_Spnl)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = match_string("/")
+ unless _tmp
+ self.pos = _save
+ break
+ end
+
+ _save1 = self.pos
+ while true # choice
+ _tmp = match_string("dir")
+ break if _tmp
+ self.pos = _save1
+ _tmp = match_string("DIR")
+ break if _tmp
+ self.pos = _save1
+ break
+ end # end choice
+
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_Spnl)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = match_string(">")
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_HtmlBlockCloseDir unless _tmp
+ return _tmp
+ end
+
+ # HtmlBlockDir = HtmlBlockOpenDir (HtmlBlockDir | !HtmlBlockCloseDir .)* HtmlBlockCloseDir
+ def _HtmlBlockDir
+
+ _save = self.pos
+ while true # sequence
+ _tmp = apply(:_HtmlBlockOpenDir)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ while true
+
+ _save2 = self.pos
+ while true # choice
+ _tmp = apply(:_HtmlBlockDir)
+ break if _tmp
+ self.pos = _save2
+
+ _save3 = self.pos
+ while true # sequence
+ _save4 = self.pos
+ _tmp = apply(:_HtmlBlockCloseDir)
+ _tmp = _tmp ? nil : true
+ self.pos = _save4
+ unless _tmp
+ self.pos = _save3
+ break
+ end
+ _tmp = get_byte
+ unless _tmp
+ self.pos = _save3
+ end
+ break
+ end # end sequence
+
+ break if _tmp
+ self.pos = _save2
+ break
+ end # end choice
+
+ break unless _tmp
+ end
+ _tmp = true
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_HtmlBlockCloseDir)
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_HtmlBlockDir unless _tmp
+ return _tmp
+ end
+
+ # HtmlBlockOpenDiv = "<" Spnl ("div" | "DIV") Spnl HtmlAttribute* ">"
+ def _HtmlBlockOpenDiv
+
+ _save = self.pos
+ while true # sequence
+ _tmp = match_string("<")
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_Spnl)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+
+ _save1 = self.pos
+ while true # choice
+ _tmp = match_string("div")
+ break if _tmp
+ self.pos = _save1
+ _tmp = match_string("DIV")
+ break if _tmp
+ self.pos = _save1
+ break
+ end # end choice
+
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_Spnl)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ while true
+ _tmp = apply(:_HtmlAttribute)
+ break unless _tmp
+ end
+ _tmp = true
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = match_string(">")
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_HtmlBlockOpenDiv unless _tmp
+ return _tmp
+ end
+
+ # HtmlBlockCloseDiv = "<" Spnl "/" ("div" | "DIV") Spnl ">"
+ def _HtmlBlockCloseDiv
+
+ _save = self.pos
+ while true # sequence
+ _tmp = match_string("<")
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_Spnl)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = match_string("/")
+ unless _tmp
+ self.pos = _save
+ break
+ end
+
+ _save1 = self.pos
+ while true # choice
+ _tmp = match_string("div")
+ break if _tmp
+ self.pos = _save1
+ _tmp = match_string("DIV")
+ break if _tmp
+ self.pos = _save1
+ break
+ end # end choice
+
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_Spnl)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = match_string(">")
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_HtmlBlockCloseDiv unless _tmp
+ return _tmp
+ end
+
+ # HtmlBlockDiv = HtmlBlockOpenDiv (HtmlBlockDiv | !HtmlBlockCloseDiv .)* HtmlBlockCloseDiv
+ def _HtmlBlockDiv
+
+ _save = self.pos
+ while true # sequence
+ _tmp = apply(:_HtmlBlockOpenDiv)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ while true
+
+ _save2 = self.pos
+ while true # choice
+ _tmp = apply(:_HtmlBlockDiv)
+ break if _tmp
+ self.pos = _save2
+
+ _save3 = self.pos
+ while true # sequence
+ _save4 = self.pos
+ _tmp = apply(:_HtmlBlockCloseDiv)
+ _tmp = _tmp ? nil : true
+ self.pos = _save4
+ unless _tmp
+ self.pos = _save3
+ break
+ end
+ _tmp = get_byte
+ unless _tmp
+ self.pos = _save3
+ end
+ break
+ end # end sequence
+
+ break if _tmp
+ self.pos = _save2
+ break
+ end # end choice
+
+ break unless _tmp
+ end
+ _tmp = true
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_HtmlBlockCloseDiv)
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_HtmlBlockDiv unless _tmp
+ return _tmp
+ end
+
+ # HtmlBlockOpenDl = "<" Spnl ("dl" | "DL") Spnl HtmlAttribute* ">"
+ def _HtmlBlockOpenDl
+
+ _save = self.pos
+ while true # sequence
+ _tmp = match_string("<")
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_Spnl)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+
+ _save1 = self.pos
+ while true # choice
+ _tmp = match_string("dl")
+ break if _tmp
+ self.pos = _save1
+ _tmp = match_string("DL")
+ break if _tmp
+ self.pos = _save1
+ break
+ end # end choice
+
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_Spnl)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ while true
+ _tmp = apply(:_HtmlAttribute)
+ break unless _tmp
+ end
+ _tmp = true
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = match_string(">")
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_HtmlBlockOpenDl unless _tmp
+ return _tmp
+ end
+
+ # HtmlBlockCloseDl = "<" Spnl "/" ("dl" | "DL") Spnl ">"
+ def _HtmlBlockCloseDl
+
+ _save = self.pos
+ while true # sequence
+ _tmp = match_string("<")
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_Spnl)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = match_string("/")
+ unless _tmp
+ self.pos = _save
+ break
+ end
+
+ _save1 = self.pos
+ while true # choice
+ _tmp = match_string("dl")
+ break if _tmp
+ self.pos = _save1
+ _tmp = match_string("DL")
+ break if _tmp
+ self.pos = _save1
+ break
+ end # end choice
+
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_Spnl)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = match_string(">")
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_HtmlBlockCloseDl unless _tmp
+ return _tmp
+ end
+
+ # HtmlBlockDl = HtmlBlockOpenDl (HtmlBlockDl | !HtmlBlockCloseDl .)* HtmlBlockCloseDl
+ def _HtmlBlockDl
+
+ _save = self.pos
+ while true # sequence
+ _tmp = apply(:_HtmlBlockOpenDl)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ while true
+
+ _save2 = self.pos
+ while true # choice
+ _tmp = apply(:_HtmlBlockDl)
+ break if _tmp
+ self.pos = _save2
+
+ _save3 = self.pos
+ while true # sequence
+ _save4 = self.pos
+ _tmp = apply(:_HtmlBlockCloseDl)
+ _tmp = _tmp ? nil : true
+ self.pos = _save4
+ unless _tmp
+ self.pos = _save3
+ break
+ end
+ _tmp = get_byte
+ unless _tmp
+ self.pos = _save3
+ end
+ break
+ end # end sequence
+
+ break if _tmp
+ self.pos = _save2
+ break
+ end # end choice
+
+ break unless _tmp
+ end
+ _tmp = true
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_HtmlBlockCloseDl)
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_HtmlBlockDl unless _tmp
+ return _tmp
+ end
+
+ # HtmlBlockOpenFieldset = "<" Spnl ("fieldset" | "FIELDSET") Spnl HtmlAttribute* ">"
+ def _HtmlBlockOpenFieldset
+
+ _save = self.pos
+ while true # sequence
+ _tmp = match_string("<")
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_Spnl)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+
+ _save1 = self.pos
+ while true # choice
+ _tmp = match_string("fieldset")
+ break if _tmp
+ self.pos = _save1
+ _tmp = match_string("FIELDSET")
+ break if _tmp
+ self.pos = _save1
+ break
+ end # end choice
+
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_Spnl)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ while true
+ _tmp = apply(:_HtmlAttribute)
+ break unless _tmp
+ end
+ _tmp = true
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = match_string(">")
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_HtmlBlockOpenFieldset unless _tmp
+ return _tmp
+ end
+
+ # HtmlBlockCloseFieldset = "<" Spnl "/" ("fieldset" | "FIELDSET") Spnl ">"
+ def _HtmlBlockCloseFieldset
+
+ _save = self.pos
+ while true # sequence
+ _tmp = match_string("<")
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_Spnl)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = match_string("/")
+ unless _tmp
+ self.pos = _save
+ break
+ end
+
+ _save1 = self.pos
+ while true # choice
+ _tmp = match_string("fieldset")
+ break if _tmp
+ self.pos = _save1
+ _tmp = match_string("FIELDSET")
+ break if _tmp
+ self.pos = _save1
+ break
+ end # end choice
+
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_Spnl)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = match_string(">")
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_HtmlBlockCloseFieldset unless _tmp
+ return _tmp
+ end
+
+ # HtmlBlockFieldset = HtmlBlockOpenFieldset (HtmlBlockFieldset | !HtmlBlockCloseFieldset .)* HtmlBlockCloseFieldset
+ def _HtmlBlockFieldset
+
+ _save = self.pos
+ while true # sequence
+ _tmp = apply(:_HtmlBlockOpenFieldset)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ while true
+
+ _save2 = self.pos
+ while true # choice
+ _tmp = apply(:_HtmlBlockFieldset)
+ break if _tmp
+ self.pos = _save2
+
+ _save3 = self.pos
+ while true # sequence
+ _save4 = self.pos
+ _tmp = apply(:_HtmlBlockCloseFieldset)
+ _tmp = _tmp ? nil : true
+ self.pos = _save4
+ unless _tmp
+ self.pos = _save3
+ break
+ end
+ _tmp = get_byte
+ unless _tmp
+ self.pos = _save3
+ end
+ break
+ end # end sequence
+
+ break if _tmp
+ self.pos = _save2
+ break
+ end # end choice
+
+ break unless _tmp
+ end
+ _tmp = true
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_HtmlBlockCloseFieldset)
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_HtmlBlockFieldset unless _tmp
+ return _tmp
+ end
+
+ # HtmlBlockOpenForm = "<" Spnl ("form" | "FORM") Spnl HtmlAttribute* ">"
+ def _HtmlBlockOpenForm
+
+ _save = self.pos
+ while true # sequence
+ _tmp = match_string("<")
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_Spnl)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+
+ _save1 = self.pos
+ while true # choice
+ _tmp = match_string("form")
+ break if _tmp
+ self.pos = _save1
+ _tmp = match_string("FORM")
+ break if _tmp
+ self.pos = _save1
+ break
+ end # end choice
+
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_Spnl)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ while true
+ _tmp = apply(:_HtmlAttribute)
+ break unless _tmp
+ end
+ _tmp = true
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = match_string(">")
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_HtmlBlockOpenForm unless _tmp
+ return _tmp
+ end
+
+ # HtmlBlockCloseForm = "<" Spnl "/" ("form" | "FORM") Spnl ">"
+ def _HtmlBlockCloseForm
+
+ _save = self.pos
+ while true # sequence
+ _tmp = match_string("<")
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_Spnl)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = match_string("/")
+ unless _tmp
+ self.pos = _save
+ break
+ end
+
+ _save1 = self.pos
+ while true # choice
+ _tmp = match_string("form")
+ break if _tmp
+ self.pos = _save1
+ _tmp = match_string("FORM")
+ break if _tmp
+ self.pos = _save1
+ break
+ end # end choice
+
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_Spnl)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = match_string(">")
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_HtmlBlockCloseForm unless _tmp
+ return _tmp
+ end
+
+ # HtmlBlockForm = HtmlBlockOpenForm (HtmlBlockForm | !HtmlBlockCloseForm .)* HtmlBlockCloseForm
+ def _HtmlBlockForm
+
+ _save = self.pos
+ while true # sequence
+ _tmp = apply(:_HtmlBlockOpenForm)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ while true
+
+ _save2 = self.pos
+ while true # choice
+ _tmp = apply(:_HtmlBlockForm)
+ break if _tmp
+ self.pos = _save2
+
+ _save3 = self.pos
+ while true # sequence
+ _save4 = self.pos
+ _tmp = apply(:_HtmlBlockCloseForm)
+ _tmp = _tmp ? nil : true
+ self.pos = _save4
+ unless _tmp
+ self.pos = _save3
+ break
+ end
+ _tmp = get_byte
+ unless _tmp
+ self.pos = _save3
+ end
+ break
+ end # end sequence
+
+ break if _tmp
+ self.pos = _save2
+ break
+ end # end choice
+
+ break unless _tmp
+ end
+ _tmp = true
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_HtmlBlockCloseForm)
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_HtmlBlockForm unless _tmp
+ return _tmp
+ end
+
+ # HtmlBlockOpenH1 = "<" Spnl ("h1" | "H1") Spnl HtmlAttribute* ">"
+ def _HtmlBlockOpenH1
+
+ _save = self.pos
+ while true # sequence
+ _tmp = match_string("<")
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_Spnl)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+
+ _save1 = self.pos
+ while true # choice
+ _tmp = match_string("h1")
+ break if _tmp
+ self.pos = _save1
+ _tmp = match_string("H1")
+ break if _tmp
+ self.pos = _save1
+ break
+ end # end choice
+
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_Spnl)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ while true
+ _tmp = apply(:_HtmlAttribute)
+ break unless _tmp
+ end
+ _tmp = true
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = match_string(">")
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_HtmlBlockOpenH1 unless _tmp
+ return _tmp
+ end
+
+ # HtmlBlockCloseH1 = "<" Spnl "/" ("h1" | "H1") Spnl ">"
+ def _HtmlBlockCloseH1
+
+ _save = self.pos
+ while true # sequence
+ _tmp = match_string("<")
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_Spnl)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = match_string("/")
+ unless _tmp
+ self.pos = _save
+ break
+ end
+
+ _save1 = self.pos
+ while true # choice
+ _tmp = match_string("h1")
+ break if _tmp
+ self.pos = _save1
+ _tmp = match_string("H1")
+ break if _tmp
+ self.pos = _save1
+ break
+ end # end choice
+
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_Spnl)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = match_string(">")
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_HtmlBlockCloseH1 unless _tmp
+ return _tmp
+ end
+
+ # HtmlBlockH1 = HtmlBlockOpenH1 (HtmlBlockH1 | !HtmlBlockCloseH1 .)* HtmlBlockCloseH1
+ def _HtmlBlockH1
+
+ _save = self.pos
+ while true # sequence
+ _tmp = apply(:_HtmlBlockOpenH1)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ while true
+
+ _save2 = self.pos
+ while true # choice
+ _tmp = apply(:_HtmlBlockH1)
+ break if _tmp
+ self.pos = _save2
+
+ _save3 = self.pos
+ while true # sequence
+ _save4 = self.pos
+ _tmp = apply(:_HtmlBlockCloseH1)
+ _tmp = _tmp ? nil : true
+ self.pos = _save4
+ unless _tmp
+ self.pos = _save3
+ break
+ end
+ _tmp = get_byte
+ unless _tmp
+ self.pos = _save3
+ end
+ break
+ end # end sequence
+
+ break if _tmp
+ self.pos = _save2
+ break
+ end # end choice
+
+ break unless _tmp
+ end
+ _tmp = true
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_HtmlBlockCloseH1)
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_HtmlBlockH1 unless _tmp
+ return _tmp
+ end
+
+ # HtmlBlockOpenH2 = "<" Spnl ("h2" | "H2") Spnl HtmlAttribute* ">"
+ def _HtmlBlockOpenH2
+
+ _save = self.pos
+ while true # sequence
+ _tmp = match_string("<")
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_Spnl)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+
+ _save1 = self.pos
+ while true # choice
+ _tmp = match_string("h2")
+ break if _tmp
+ self.pos = _save1
+ _tmp = match_string("H2")
+ break if _tmp
+ self.pos = _save1
+ break
+ end # end choice
+
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_Spnl)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ while true
+ _tmp = apply(:_HtmlAttribute)
+ break unless _tmp
+ end
+ _tmp = true
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = match_string(">")
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_HtmlBlockOpenH2 unless _tmp
+ return _tmp
+ end
+
+ # HtmlBlockCloseH2 = "<" Spnl "/" ("h2" | "H2") Spnl ">"
+ def _HtmlBlockCloseH2
+
+ _save = self.pos
+ while true # sequence
+ _tmp = match_string("<")
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_Spnl)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = match_string("/")
+ unless _tmp
+ self.pos = _save
+ break
+ end
+
+ _save1 = self.pos
+ while true # choice
+ _tmp = match_string("h2")
+ break if _tmp
+ self.pos = _save1
+ _tmp = match_string("H2")
+ break if _tmp
+ self.pos = _save1
+ break
+ end # end choice
+
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_Spnl)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = match_string(">")
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_HtmlBlockCloseH2 unless _tmp
+ return _tmp
+ end
+
+ # HtmlBlockH2 = HtmlBlockOpenH2 (HtmlBlockH2 | !HtmlBlockCloseH2 .)* HtmlBlockCloseH2
+ def _HtmlBlockH2
+
+ _save = self.pos
+ while true # sequence
+ _tmp = apply(:_HtmlBlockOpenH2)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ while true
+
+ _save2 = self.pos
+ while true # choice
+ _tmp = apply(:_HtmlBlockH2)
+ break if _tmp
+ self.pos = _save2
+
+ _save3 = self.pos
+ while true # sequence
+ _save4 = self.pos
+ _tmp = apply(:_HtmlBlockCloseH2)
+ _tmp = _tmp ? nil : true
+ self.pos = _save4
+ unless _tmp
+ self.pos = _save3
+ break
+ end
+ _tmp = get_byte
+ unless _tmp
+ self.pos = _save3
+ end
+ break
+ end # end sequence
+
+ break if _tmp
+ self.pos = _save2
+ break
+ end # end choice
+
+ break unless _tmp
+ end
+ _tmp = true
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_HtmlBlockCloseH2)
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_HtmlBlockH2 unless _tmp
+ return _tmp
+ end
+
+ # HtmlBlockOpenH3 = "<" Spnl ("h3" | "H3") Spnl HtmlAttribute* ">"
+ def _HtmlBlockOpenH3
+
+ _save = self.pos
+ while true # sequence
+ _tmp = match_string("<")
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_Spnl)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+
+ _save1 = self.pos
+ while true # choice
+ _tmp = match_string("h3")
+ break if _tmp
+ self.pos = _save1
+ _tmp = match_string("H3")
+ break if _tmp
+ self.pos = _save1
+ break
+ end # end choice
+
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_Spnl)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ while true
+ _tmp = apply(:_HtmlAttribute)
+ break unless _tmp
+ end
+ _tmp = true
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = match_string(">")
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_HtmlBlockOpenH3 unless _tmp
+ return _tmp
+ end
+
+ # HtmlBlockCloseH3 = "<" Spnl "/" ("h3" | "H3") Spnl ">"
+ def _HtmlBlockCloseH3
+
+ _save = self.pos
+ while true # sequence
+ _tmp = match_string("<")
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_Spnl)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = match_string("/")
+ unless _tmp
+ self.pos = _save
+ break
+ end
+
+ _save1 = self.pos
+ while true # choice
+ _tmp = match_string("h3")
+ break if _tmp
+ self.pos = _save1
+ _tmp = match_string("H3")
+ break if _tmp
+ self.pos = _save1
+ break
+ end # end choice
+
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_Spnl)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = match_string(">")
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_HtmlBlockCloseH3 unless _tmp
+ return _tmp
+ end
+
+ # HtmlBlockH3 = HtmlBlockOpenH3 (HtmlBlockH3 | !HtmlBlockCloseH3 .)* HtmlBlockCloseH3
+ def _HtmlBlockH3
+
+ _save = self.pos
+ while true # sequence
+ _tmp = apply(:_HtmlBlockOpenH3)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ while true
+
+ _save2 = self.pos
+ while true # choice
+ _tmp = apply(:_HtmlBlockH3)
+ break if _tmp
+ self.pos = _save2
+
+ _save3 = self.pos
+ while true # sequence
+ _save4 = self.pos
+ _tmp = apply(:_HtmlBlockCloseH3)
+ _tmp = _tmp ? nil : true
+ self.pos = _save4
+ unless _tmp
+ self.pos = _save3
+ break
+ end
+ _tmp = get_byte
+ unless _tmp
+ self.pos = _save3
+ end
+ break
+ end # end sequence
+
+ break if _tmp
+ self.pos = _save2
+ break
+ end # end choice
+
+ break unless _tmp
+ end
+ _tmp = true
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_HtmlBlockCloseH3)
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_HtmlBlockH3 unless _tmp
+ return _tmp
+ end
+
+ # HtmlBlockOpenH4 = "<" Spnl ("h4" | "H4") Spnl HtmlAttribute* ">"
+ def _HtmlBlockOpenH4
+
+ _save = self.pos
+ while true # sequence
+ _tmp = match_string("<")
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_Spnl)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+
+ _save1 = self.pos
+ while true # choice
+ _tmp = match_string("h4")
+ break if _tmp
+ self.pos = _save1
+ _tmp = match_string("H4")
+ break if _tmp
+ self.pos = _save1
+ break
+ end # end choice
+
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_Spnl)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ while true
+ _tmp = apply(:_HtmlAttribute)
+ break unless _tmp
+ end
+ _tmp = true
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = match_string(">")
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_HtmlBlockOpenH4 unless _tmp
+ return _tmp
+ end
+
+ # HtmlBlockCloseH4 = "<" Spnl "/" ("h4" | "H4") Spnl ">"
+ def _HtmlBlockCloseH4
+
+ _save = self.pos
+ while true # sequence
+ _tmp = match_string("<")
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_Spnl)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = match_string("/")
+ unless _tmp
+ self.pos = _save
+ break
+ end
+
+ _save1 = self.pos
+ while true # choice
+ _tmp = match_string("h4")
+ break if _tmp
+ self.pos = _save1
+ _tmp = match_string("H4")
+ break if _tmp
+ self.pos = _save1
+ break
+ end # end choice
+
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_Spnl)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = match_string(">")
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_HtmlBlockCloseH4 unless _tmp
+ return _tmp
+ end
+
+ # HtmlBlockH4 = HtmlBlockOpenH4 (HtmlBlockH4 | !HtmlBlockCloseH4 .)* HtmlBlockCloseH4
+ def _HtmlBlockH4
+
+ _save = self.pos
+ while true # sequence
+ _tmp = apply(:_HtmlBlockOpenH4)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ while true
+
+ _save2 = self.pos
+ while true # choice
+ _tmp = apply(:_HtmlBlockH4)
+ break if _tmp
+ self.pos = _save2
+
+ _save3 = self.pos
+ while true # sequence
+ _save4 = self.pos
+ _tmp = apply(:_HtmlBlockCloseH4)
+ _tmp = _tmp ? nil : true
+ self.pos = _save4
+ unless _tmp
+ self.pos = _save3
+ break
+ end
+ _tmp = get_byte
+ unless _tmp
+ self.pos = _save3
+ end
+ break
+ end # end sequence
+
+ break if _tmp
+ self.pos = _save2
+ break
+ end # end choice
+
+ break unless _tmp
+ end
+ _tmp = true
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_HtmlBlockCloseH4)
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_HtmlBlockH4 unless _tmp
+ return _tmp
+ end
+
+ # HtmlBlockOpenH5 = "<" Spnl ("h5" | "H5") Spnl HtmlAttribute* ">"
+ def _HtmlBlockOpenH5
+
+ _save = self.pos
+ while true # sequence
+ _tmp = match_string("<")
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_Spnl)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+
+ _save1 = self.pos
+ while true # choice
+ _tmp = match_string("h5")
+ break if _tmp
+ self.pos = _save1
+ _tmp = match_string("H5")
+ break if _tmp
+ self.pos = _save1
+ break
+ end # end choice
+
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_Spnl)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ while true
+ _tmp = apply(:_HtmlAttribute)
+ break unless _tmp
+ end
+ _tmp = true
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = match_string(">")
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_HtmlBlockOpenH5 unless _tmp
+ return _tmp
+ end
+
+ # HtmlBlockCloseH5 = "<" Spnl "/" ("h5" | "H5") Spnl ">"
+ def _HtmlBlockCloseH5
+
+ _save = self.pos
+ while true # sequence
+ _tmp = match_string("<")
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_Spnl)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = match_string("/")
+ unless _tmp
+ self.pos = _save
+ break
+ end
+
+ _save1 = self.pos
+ while true # choice
+ _tmp = match_string("h5")
+ break if _tmp
+ self.pos = _save1
+ _tmp = match_string("H5")
+ break if _tmp
+ self.pos = _save1
+ break
+ end # end choice
+
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_Spnl)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = match_string(">")
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_HtmlBlockCloseH5 unless _tmp
+ return _tmp
+ end
+
+ # HtmlBlockH5 = HtmlBlockOpenH5 (HtmlBlockH5 | !HtmlBlockCloseH5 .)* HtmlBlockCloseH5
+ def _HtmlBlockH5
+
+ _save = self.pos
+ while true # sequence
+ _tmp = apply(:_HtmlBlockOpenH5)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ while true
+
+ _save2 = self.pos
+ while true # choice
+ _tmp = apply(:_HtmlBlockH5)
+ break if _tmp
+ self.pos = _save2
+
+ _save3 = self.pos
+ while true # sequence
+ _save4 = self.pos
+ _tmp = apply(:_HtmlBlockCloseH5)
+ _tmp = _tmp ? nil : true
+ self.pos = _save4
+ unless _tmp
+ self.pos = _save3
+ break
+ end
+ _tmp = get_byte
+ unless _tmp
+ self.pos = _save3
+ end
+ break
+ end # end sequence
+
+ break if _tmp
+ self.pos = _save2
+ break
+ end # end choice
+
+ break unless _tmp
+ end
+ _tmp = true
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_HtmlBlockCloseH5)
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_HtmlBlockH5 unless _tmp
+ return _tmp
+ end
+
+ # HtmlBlockOpenH6 = "<" Spnl ("h6" | "H6") Spnl HtmlAttribute* ">"
+ def _HtmlBlockOpenH6
+
+ _save = self.pos
+ while true # sequence
+ _tmp = match_string("<")
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_Spnl)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+
+ _save1 = self.pos
+ while true # choice
+ _tmp = match_string("h6")
+ break if _tmp
+ self.pos = _save1
+ _tmp = match_string("H6")
+ break if _tmp
+ self.pos = _save1
+ break
+ end # end choice
+
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_Spnl)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ while true
+ _tmp = apply(:_HtmlAttribute)
+ break unless _tmp
+ end
+ _tmp = true
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = match_string(">")
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_HtmlBlockOpenH6 unless _tmp
+ return _tmp
+ end
+
+ # HtmlBlockCloseH6 = "<" Spnl "/" ("h6" | "H6") Spnl ">"
+ def _HtmlBlockCloseH6
+
+ _save = self.pos
+ while true # sequence
+ _tmp = match_string("<")
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_Spnl)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = match_string("/")
+ unless _tmp
+ self.pos = _save
+ break
+ end
+
+ _save1 = self.pos
+ while true # choice
+ _tmp = match_string("h6")
+ break if _tmp
+ self.pos = _save1
+ _tmp = match_string("H6")
+ break if _tmp
+ self.pos = _save1
+ break
+ end # end choice
+
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_Spnl)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = match_string(">")
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_HtmlBlockCloseH6 unless _tmp
+ return _tmp
+ end
+
+ # HtmlBlockH6 = HtmlBlockOpenH6 (HtmlBlockH6 | !HtmlBlockCloseH6 .)* HtmlBlockCloseH6
+ def _HtmlBlockH6
+
+ _save = self.pos
+ while true # sequence
+ _tmp = apply(:_HtmlBlockOpenH6)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ while true
+
+ _save2 = self.pos
+ while true # choice
+ _tmp = apply(:_HtmlBlockH6)
+ break if _tmp
+ self.pos = _save2
+
+ _save3 = self.pos
+ while true # sequence
+ _save4 = self.pos
+ _tmp = apply(:_HtmlBlockCloseH6)
+ _tmp = _tmp ? nil : true
+ self.pos = _save4
+ unless _tmp
+ self.pos = _save3
+ break
+ end
+ _tmp = get_byte
+ unless _tmp
+ self.pos = _save3
+ end
+ break
+ end # end sequence
+
+ break if _tmp
+ self.pos = _save2
+ break
+ end # end choice
+
+ break unless _tmp
+ end
+ _tmp = true
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_HtmlBlockCloseH6)
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_HtmlBlockH6 unless _tmp
+ return _tmp
+ end
+
+ # HtmlBlockOpenMenu = "<" Spnl ("menu" | "MENU") Spnl HtmlAttribute* ">"
+ def _HtmlBlockOpenMenu
+
+ _save = self.pos
+ while true # sequence
+ _tmp = match_string("<")
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_Spnl)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+
+ _save1 = self.pos
+ while true # choice
+ _tmp = match_string("menu")
+ break if _tmp
+ self.pos = _save1
+ _tmp = match_string("MENU")
+ break if _tmp
+ self.pos = _save1
+ break
+ end # end choice
+
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_Spnl)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ while true
+ _tmp = apply(:_HtmlAttribute)
+ break unless _tmp
+ end
+ _tmp = true
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = match_string(">")
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_HtmlBlockOpenMenu unless _tmp
+ return _tmp
+ end
+
+ # HtmlBlockCloseMenu = "<" Spnl "/" ("menu" | "MENU") Spnl ">"
+ def _HtmlBlockCloseMenu
+
+ _save = self.pos
+ while true # sequence
+ _tmp = match_string("<")
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_Spnl)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = match_string("/")
+ unless _tmp
+ self.pos = _save
+ break
+ end
+
+ _save1 = self.pos
+ while true # choice
+ _tmp = match_string("menu")
+ break if _tmp
+ self.pos = _save1
+ _tmp = match_string("MENU")
+ break if _tmp
+ self.pos = _save1
+ break
+ end # end choice
+
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_Spnl)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = match_string(">")
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_HtmlBlockCloseMenu unless _tmp
+ return _tmp
+ end
+
+ # HtmlBlockMenu = HtmlBlockOpenMenu (HtmlBlockMenu | !HtmlBlockCloseMenu .)* HtmlBlockCloseMenu
+ def _HtmlBlockMenu
+
+ _save = self.pos
+ while true # sequence
+ _tmp = apply(:_HtmlBlockOpenMenu)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ while true
+
+ _save2 = self.pos
+ while true # choice
+ _tmp = apply(:_HtmlBlockMenu)
+ break if _tmp
+ self.pos = _save2
+
+ _save3 = self.pos
+ while true # sequence
+ _save4 = self.pos
+ _tmp = apply(:_HtmlBlockCloseMenu)
+ _tmp = _tmp ? nil : true
+ self.pos = _save4
+ unless _tmp
+ self.pos = _save3
+ break
+ end
+ _tmp = get_byte
+ unless _tmp
+ self.pos = _save3
+ end
+ break
+ end # end sequence
+
+ break if _tmp
+ self.pos = _save2
+ break
+ end # end choice
+
+ break unless _tmp
+ end
+ _tmp = true
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_HtmlBlockCloseMenu)
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_HtmlBlockMenu unless _tmp
+ return _tmp
+ end
+
+ # HtmlBlockOpenNoframes = "<" Spnl ("noframes" | "NOFRAMES") Spnl HtmlAttribute* ">"
+ def _HtmlBlockOpenNoframes
+
+ _save = self.pos
+ while true # sequence
+ _tmp = match_string("<")
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_Spnl)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+
+ _save1 = self.pos
+ while true # choice
+ _tmp = match_string("noframes")
+ break if _tmp
+ self.pos = _save1
+ _tmp = match_string("NOFRAMES")
+ break if _tmp
+ self.pos = _save1
+ break
+ end # end choice
+
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_Spnl)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ while true
+ _tmp = apply(:_HtmlAttribute)
+ break unless _tmp
+ end
+ _tmp = true
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = match_string(">")
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_HtmlBlockOpenNoframes unless _tmp
+ return _tmp
+ end
+
+ # HtmlBlockCloseNoframes = "<" Spnl "/" ("noframes" | "NOFRAMES") Spnl ">"
+ def _HtmlBlockCloseNoframes
+
+ _save = self.pos
+ while true # sequence
+ _tmp = match_string("<")
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_Spnl)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = match_string("/")
+ unless _tmp
+ self.pos = _save
+ break
+ end
+
+ _save1 = self.pos
+ while true # choice
+ _tmp = match_string("noframes")
+ break if _tmp
+ self.pos = _save1
+ _tmp = match_string("NOFRAMES")
+ break if _tmp
+ self.pos = _save1
+ break
+ end # end choice
+
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_Spnl)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = match_string(">")
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_HtmlBlockCloseNoframes unless _tmp
+ return _tmp
+ end
+
+ # HtmlBlockNoframes = HtmlBlockOpenNoframes (HtmlBlockNoframes | !HtmlBlockCloseNoframes .)* HtmlBlockCloseNoframes
+ def _HtmlBlockNoframes
+
+ _save = self.pos
+ while true # sequence
+ _tmp = apply(:_HtmlBlockOpenNoframes)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ while true
+
+ _save2 = self.pos
+ while true # choice
+ _tmp = apply(:_HtmlBlockNoframes)
+ break if _tmp
+ self.pos = _save2
+
+ _save3 = self.pos
+ while true # sequence
+ _save4 = self.pos
+ _tmp = apply(:_HtmlBlockCloseNoframes)
+ _tmp = _tmp ? nil : true
+ self.pos = _save4
+ unless _tmp
+ self.pos = _save3
+ break
+ end
+ _tmp = get_byte
+ unless _tmp
+ self.pos = _save3
+ end
+ break
+ end # end sequence
+
+ break if _tmp
+ self.pos = _save2
+ break
+ end # end choice
+
+ break unless _tmp
+ end
+ _tmp = true
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_HtmlBlockCloseNoframes)
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_HtmlBlockNoframes unless _tmp
+ return _tmp
+ end
+
+ # HtmlBlockOpenNoscript = "<" Spnl ("noscript" | "NOSCRIPT") Spnl HtmlAttribute* ">"
+ def _HtmlBlockOpenNoscript
+
+ _save = self.pos
+ while true # sequence
+ _tmp = match_string("<")
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_Spnl)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+
+ _save1 = self.pos
+ while true # choice
+ _tmp = match_string("noscript")
+ break if _tmp
+ self.pos = _save1
+ _tmp = match_string("NOSCRIPT")
+ break if _tmp
+ self.pos = _save1
+ break
+ end # end choice
+
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_Spnl)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ while true
+ _tmp = apply(:_HtmlAttribute)
+ break unless _tmp
+ end
+ _tmp = true
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = match_string(">")
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_HtmlBlockOpenNoscript unless _tmp
+ return _tmp
+ end
+
+ # HtmlBlockCloseNoscript = "<" Spnl "/" ("noscript" | "NOSCRIPT") Spnl ">"
+ def _HtmlBlockCloseNoscript
+
+ _save = self.pos
+ while true # sequence
+ _tmp = match_string("<")
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_Spnl)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = match_string("/")
+ unless _tmp
+ self.pos = _save
+ break
+ end
+
+ _save1 = self.pos
+ while true # choice
+ _tmp = match_string("noscript")
+ break if _tmp
+ self.pos = _save1
+ _tmp = match_string("NOSCRIPT")
+ break if _tmp
+ self.pos = _save1
+ break
+ end # end choice
+
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_Spnl)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = match_string(">")
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_HtmlBlockCloseNoscript unless _tmp
+ return _tmp
+ end
+
+ # HtmlBlockNoscript = HtmlBlockOpenNoscript (HtmlBlockNoscript | !HtmlBlockCloseNoscript .)* HtmlBlockCloseNoscript
+ def _HtmlBlockNoscript
+
+ _save = self.pos
+ while true # sequence
+ _tmp = apply(:_HtmlBlockOpenNoscript)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ while true
+
+ _save2 = self.pos
+ while true # choice
+ _tmp = apply(:_HtmlBlockNoscript)
+ break if _tmp
+ self.pos = _save2
+
+ _save3 = self.pos
+ while true # sequence
+ _save4 = self.pos
+ _tmp = apply(:_HtmlBlockCloseNoscript)
+ _tmp = _tmp ? nil : true
+ self.pos = _save4
+ unless _tmp
+ self.pos = _save3
+ break
+ end
+ _tmp = get_byte
+ unless _tmp
+ self.pos = _save3
+ end
+ break
+ end # end sequence
+
+ break if _tmp
+ self.pos = _save2
+ break
+ end # end choice
+
+ break unless _tmp
+ end
+ _tmp = true
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_HtmlBlockCloseNoscript)
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_HtmlBlockNoscript unless _tmp
+ return _tmp
+ end
+
+ # HtmlBlockOpenOl = "<" Spnl ("ol" | "OL") Spnl HtmlAttribute* ">"
+ def _HtmlBlockOpenOl
+
+ _save = self.pos
+ while true # sequence
+ _tmp = match_string("<")
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_Spnl)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+
+ _save1 = self.pos
+ while true # choice
+ _tmp = match_string("ol")
+ break if _tmp
+ self.pos = _save1
+ _tmp = match_string("OL")
+ break if _tmp
+ self.pos = _save1
+ break
+ end # end choice
+
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_Spnl)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ while true
+ _tmp = apply(:_HtmlAttribute)
+ break unless _tmp
+ end
+ _tmp = true
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = match_string(">")
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_HtmlBlockOpenOl unless _tmp
+ return _tmp
+ end
+
+ # HtmlBlockCloseOl = "<" Spnl "/" ("ol" | "OL") Spnl ">"
+ def _HtmlBlockCloseOl
+
+ _save = self.pos
+ while true # sequence
+ _tmp = match_string("<")
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_Spnl)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = match_string("/")
+ unless _tmp
+ self.pos = _save
+ break
+ end
+
+ _save1 = self.pos
+ while true # choice
+ _tmp = match_string("ol")
+ break if _tmp
+ self.pos = _save1
+ _tmp = match_string("OL")
+ break if _tmp
+ self.pos = _save1
+ break
+ end # end choice
+
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_Spnl)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = match_string(">")
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_HtmlBlockCloseOl unless _tmp
+ return _tmp
+ end
+
+ # HtmlBlockOl = HtmlBlockOpenOl (HtmlBlockOl | !HtmlBlockCloseOl .)* HtmlBlockCloseOl
+ def _HtmlBlockOl
+
+ _save = self.pos
+ while true # sequence
+ _tmp = apply(:_HtmlBlockOpenOl)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ while true
+
+ _save2 = self.pos
+ while true # choice
+ _tmp = apply(:_HtmlBlockOl)
+ break if _tmp
+ self.pos = _save2
+
+ _save3 = self.pos
+ while true # sequence
+ _save4 = self.pos
+ _tmp = apply(:_HtmlBlockCloseOl)
+ _tmp = _tmp ? nil : true
+ self.pos = _save4
+ unless _tmp
+ self.pos = _save3
+ break
+ end
+ _tmp = get_byte
+ unless _tmp
+ self.pos = _save3
+ end
+ break
+ end # end sequence
+
+ break if _tmp
+ self.pos = _save2
+ break
+ end # end choice
+
+ break unless _tmp
+ end
+ _tmp = true
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_HtmlBlockCloseOl)
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_HtmlBlockOl unless _tmp
+ return _tmp
+ end
+
+ # HtmlBlockOpenP = "<" Spnl ("p" | "P") Spnl HtmlAttribute* ">"
+ def _HtmlBlockOpenP
+
+ _save = self.pos
+ while true # sequence
+ _tmp = match_string("<")
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_Spnl)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+
+ _save1 = self.pos
+ while true # choice
+ _tmp = match_string("p")
+ break if _tmp
+ self.pos = _save1
+ _tmp = match_string("P")
+ break if _tmp
+ self.pos = _save1
+ break
+ end # end choice
+
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_Spnl)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ while true
+ _tmp = apply(:_HtmlAttribute)
+ break unless _tmp
+ end
+ _tmp = true
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = match_string(">")
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_HtmlBlockOpenP unless _tmp
+ return _tmp
+ end
+
+ # HtmlBlockCloseP = "<" Spnl "/" ("p" | "P") Spnl ">"
+ def _HtmlBlockCloseP
+
+ _save = self.pos
+ while true # sequence
+ _tmp = match_string("<")
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_Spnl)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = match_string("/")
+ unless _tmp
+ self.pos = _save
+ break
+ end
+
+ _save1 = self.pos
+ while true # choice
+ _tmp = match_string("p")
+ break if _tmp
+ self.pos = _save1
+ _tmp = match_string("P")
+ break if _tmp
+ self.pos = _save1
+ break
+ end # end choice
+
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_Spnl)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = match_string(">")
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_HtmlBlockCloseP unless _tmp
+ return _tmp
+ end
+
+ # HtmlBlockP = HtmlBlockOpenP (HtmlBlockP | !HtmlBlockCloseP .)* HtmlBlockCloseP
+ def _HtmlBlockP
+
+ _save = self.pos
+ while true # sequence
+ _tmp = apply(:_HtmlBlockOpenP)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ while true
+
+ _save2 = self.pos
+ while true # choice
+ _tmp = apply(:_HtmlBlockP)
+ break if _tmp
+ self.pos = _save2
+
+ _save3 = self.pos
+ while true # sequence
+ _save4 = self.pos
+ _tmp = apply(:_HtmlBlockCloseP)
+ _tmp = _tmp ? nil : true
+ self.pos = _save4
+ unless _tmp
+ self.pos = _save3
+ break
+ end
+ _tmp = get_byte
+ unless _tmp
+ self.pos = _save3
+ end
+ break
+ end # end sequence
+
+ break if _tmp
+ self.pos = _save2
+ break
+ end # end choice
+
+ break unless _tmp
+ end
+ _tmp = true
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_HtmlBlockCloseP)
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_HtmlBlockP unless _tmp
+ return _tmp
+ end
+
+ # HtmlBlockOpenPre = "<" Spnl ("pre" | "PRE") Spnl HtmlAttribute* ">"
+ def _HtmlBlockOpenPre
+
+ _save = self.pos
+ while true # sequence
+ _tmp = match_string("<")
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_Spnl)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+
+ _save1 = self.pos
+ while true # choice
+ _tmp = match_string("pre")
+ break if _tmp
+ self.pos = _save1
+ _tmp = match_string("PRE")
+ break if _tmp
+ self.pos = _save1
+ break
+ end # end choice
+
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_Spnl)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ while true
+ _tmp = apply(:_HtmlAttribute)
+ break unless _tmp
+ end
+ _tmp = true
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = match_string(">")
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_HtmlBlockOpenPre unless _tmp
+ return _tmp
+ end
+
+ # HtmlBlockClosePre = "<" Spnl "/" ("pre" | "PRE") Spnl ">"
+ def _HtmlBlockClosePre
+
+ _save = self.pos
+ while true # sequence
+ _tmp = match_string("<")
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_Spnl)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = match_string("/")
+ unless _tmp
+ self.pos = _save
+ break
+ end
+
+ _save1 = self.pos
+ while true # choice
+ _tmp = match_string("pre")
+ break if _tmp
+ self.pos = _save1
+ _tmp = match_string("PRE")
+ break if _tmp
+ self.pos = _save1
+ break
+ end # end choice
+
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_Spnl)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = match_string(">")
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_HtmlBlockClosePre unless _tmp
+ return _tmp
+ end
+
+ # HtmlBlockPre = HtmlBlockOpenPre (HtmlBlockPre | !HtmlBlockClosePre .)* HtmlBlockClosePre
+ def _HtmlBlockPre
+
+ _save = self.pos
+ while true # sequence
+ _tmp = apply(:_HtmlBlockOpenPre)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ while true
+
+ _save2 = self.pos
+ while true # choice
+ _tmp = apply(:_HtmlBlockPre)
+ break if _tmp
+ self.pos = _save2
+
+ _save3 = self.pos
+ while true # sequence
+ _save4 = self.pos
+ _tmp = apply(:_HtmlBlockClosePre)
+ _tmp = _tmp ? nil : true
+ self.pos = _save4
+ unless _tmp
+ self.pos = _save3
+ break
+ end
+ _tmp = get_byte
+ unless _tmp
+ self.pos = _save3
+ end
+ break
+ end # end sequence
+
+ break if _tmp
+ self.pos = _save2
+ break
+ end # end choice
+
+ break unless _tmp
+ end
+ _tmp = true
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_HtmlBlockClosePre)
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_HtmlBlockPre unless _tmp
+ return _tmp
+ end
+
+ # HtmlBlockOpenTable = "<" Spnl ("table" | "TABLE") Spnl HtmlAttribute* ">"
+ def _HtmlBlockOpenTable
+
+ _save = self.pos
+ while true # sequence
+ _tmp = match_string("<")
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_Spnl)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+
+ _save1 = self.pos
+ while true # choice
+ _tmp = match_string("table")
+ break if _tmp
+ self.pos = _save1
+ _tmp = match_string("TABLE")
+ break if _tmp
+ self.pos = _save1
+ break
+ end # end choice
+
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_Spnl)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ while true
+ _tmp = apply(:_HtmlAttribute)
+ break unless _tmp
+ end
+ _tmp = true
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = match_string(">")
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_HtmlBlockOpenTable unless _tmp
+ return _tmp
+ end
+
+ # HtmlBlockCloseTable = "<" Spnl "/" ("table" | "TABLE") Spnl ">"
+ def _HtmlBlockCloseTable
+
+ _save = self.pos
+ while true # sequence
+ _tmp = match_string("<")
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_Spnl)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = match_string("/")
+ unless _tmp
+ self.pos = _save
+ break
+ end
+
+ _save1 = self.pos
+ while true # choice
+ _tmp = match_string("table")
+ break if _tmp
+ self.pos = _save1
+ _tmp = match_string("TABLE")
+ break if _tmp
+ self.pos = _save1
+ break
+ end # end choice
+
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_Spnl)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = match_string(">")
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_HtmlBlockCloseTable unless _tmp
+ return _tmp
+ end
+
+ # HtmlBlockTable = HtmlBlockOpenTable (HtmlBlockTable | !HtmlBlockCloseTable .)* HtmlBlockCloseTable
+ def _HtmlBlockTable
+
+ _save = self.pos
+ while true # sequence
+ _tmp = apply(:_HtmlBlockOpenTable)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ while true
+
+ _save2 = self.pos
+ while true # choice
+ _tmp = apply(:_HtmlBlockTable)
+ break if _tmp
+ self.pos = _save2
+
+ _save3 = self.pos
+ while true # sequence
+ _save4 = self.pos
+ _tmp = apply(:_HtmlBlockCloseTable)
+ _tmp = _tmp ? nil : true
+ self.pos = _save4
+ unless _tmp
+ self.pos = _save3
+ break
+ end
+ _tmp = get_byte
+ unless _tmp
+ self.pos = _save3
+ end
+ break
+ end # end sequence
+
+ break if _tmp
+ self.pos = _save2
+ break
+ end # end choice
+
+ break unless _tmp
+ end
+ _tmp = true
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_HtmlBlockCloseTable)
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_HtmlBlockTable unless _tmp
+ return _tmp
+ end
+
+ # HtmlBlockOpenUl = "<" Spnl ("ul" | "UL") Spnl HtmlAttribute* ">"
+ def _HtmlBlockOpenUl
+
+ _save = self.pos
+ while true # sequence
+ _tmp = match_string("<")
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_Spnl)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+
+ _save1 = self.pos
+ while true # choice
+ _tmp = match_string("ul")
+ break if _tmp
+ self.pos = _save1
+ _tmp = match_string("UL")
+ break if _tmp
+ self.pos = _save1
+ break
+ end # end choice
+
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_Spnl)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ while true
+ _tmp = apply(:_HtmlAttribute)
+ break unless _tmp
+ end
+ _tmp = true
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = match_string(">")
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_HtmlBlockOpenUl unless _tmp
+ return _tmp
+ end
+
+ # HtmlBlockCloseUl = "<" Spnl "/" ("ul" | "UL") Spnl ">"
+ def _HtmlBlockCloseUl
+
+ _save = self.pos
+ while true # sequence
+ _tmp = match_string("<")
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_Spnl)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = match_string("/")
+ unless _tmp
+ self.pos = _save
+ break
+ end
+
+ _save1 = self.pos
+ while true # choice
+ _tmp = match_string("ul")
+ break if _tmp
+ self.pos = _save1
+ _tmp = match_string("UL")
+ break if _tmp
+ self.pos = _save1
+ break
+ end # end choice
+
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_Spnl)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = match_string(">")
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_HtmlBlockCloseUl unless _tmp
+ return _tmp
+ end
+
+ # HtmlBlockUl = HtmlBlockOpenUl (HtmlBlockUl | !HtmlBlockCloseUl .)* HtmlBlockCloseUl
+ def _HtmlBlockUl
+
+ _save = self.pos
+ while true # sequence
+ _tmp = apply(:_HtmlBlockOpenUl)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ while true
+
+ _save2 = self.pos
+ while true # choice
+ _tmp = apply(:_HtmlBlockUl)
+ break if _tmp
+ self.pos = _save2
+
+ _save3 = self.pos
+ while true # sequence
+ _save4 = self.pos
+ _tmp = apply(:_HtmlBlockCloseUl)
+ _tmp = _tmp ? nil : true
+ self.pos = _save4
+ unless _tmp
+ self.pos = _save3
+ break
+ end
+ _tmp = get_byte
+ unless _tmp
+ self.pos = _save3
+ end
+ break
+ end # end sequence
+
+ break if _tmp
+ self.pos = _save2
+ break
+ end # end choice
+
+ break unless _tmp
+ end
+ _tmp = true
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_HtmlBlockCloseUl)
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_HtmlBlockUl unless _tmp
+ return _tmp
+ end
+
+ # HtmlBlockOpenDd = "<" Spnl ("dd" | "DD") Spnl HtmlAttribute* ">"
+ def _HtmlBlockOpenDd
+
+ _save = self.pos
+ while true # sequence
+ _tmp = match_string("<")
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_Spnl)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+
+ _save1 = self.pos
+ while true # choice
+ _tmp = match_string("dd")
+ break if _tmp
+ self.pos = _save1
+ _tmp = match_string("DD")
+ break if _tmp
+ self.pos = _save1
+ break
+ end # end choice
+
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_Spnl)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ while true
+ _tmp = apply(:_HtmlAttribute)
+ break unless _tmp
+ end
+ _tmp = true
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = match_string(">")
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_HtmlBlockOpenDd unless _tmp
+ return _tmp
+ end
+
+ # HtmlBlockCloseDd = "<" Spnl "/" ("dd" | "DD") Spnl ">"
+ def _HtmlBlockCloseDd
+
+ _save = self.pos
+ while true # sequence
+ _tmp = match_string("<")
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_Spnl)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = match_string("/")
+ unless _tmp
+ self.pos = _save
+ break
+ end
+
+ _save1 = self.pos
+ while true # choice
+ _tmp = match_string("dd")
+ break if _tmp
+ self.pos = _save1
+ _tmp = match_string("DD")
+ break if _tmp
+ self.pos = _save1
+ break
+ end # end choice
+
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_Spnl)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = match_string(">")
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_HtmlBlockCloseDd unless _tmp
+ return _tmp
+ end
+
+ # HtmlBlockDd = HtmlBlockOpenDd (HtmlBlockDd | !HtmlBlockCloseDd .)* HtmlBlockCloseDd
+ def _HtmlBlockDd
+
+ _save = self.pos
+ while true # sequence
+ _tmp = apply(:_HtmlBlockOpenDd)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ while true
+
+ _save2 = self.pos
+ while true # choice
+ _tmp = apply(:_HtmlBlockDd)
+ break if _tmp
+ self.pos = _save2
+
+ _save3 = self.pos
+ while true # sequence
+ _save4 = self.pos
+ _tmp = apply(:_HtmlBlockCloseDd)
+ _tmp = _tmp ? nil : true
+ self.pos = _save4
+ unless _tmp
+ self.pos = _save3
+ break
+ end
+ _tmp = get_byte
+ unless _tmp
+ self.pos = _save3
+ end
+ break
+ end # end sequence
+
+ break if _tmp
+ self.pos = _save2
+ break
+ end # end choice
+
+ break unless _tmp
+ end
+ _tmp = true
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_HtmlBlockCloseDd)
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_HtmlBlockDd unless _tmp
+ return _tmp
+ end
+
+ # HtmlBlockOpenDt = "<" Spnl ("dt" | "DT") Spnl HtmlAttribute* ">"
+ def _HtmlBlockOpenDt
+
+ _save = self.pos
+ while true # sequence
+ _tmp = match_string("<")
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_Spnl)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+
+ _save1 = self.pos
+ while true # choice
+ _tmp = match_string("dt")
+ break if _tmp
+ self.pos = _save1
+ _tmp = match_string("DT")
+ break if _tmp
+ self.pos = _save1
+ break
+ end # end choice
+
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_Spnl)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ while true
+ _tmp = apply(:_HtmlAttribute)
+ break unless _tmp
+ end
+ _tmp = true
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = match_string(">")
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_HtmlBlockOpenDt unless _tmp
+ return _tmp
+ end
+
+ # HtmlBlockCloseDt = "<" Spnl "/" ("dt" | "DT") Spnl ">"
+ def _HtmlBlockCloseDt
+
+ _save = self.pos
+ while true # sequence
+ _tmp = match_string("<")
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_Spnl)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = match_string("/")
+ unless _tmp
+ self.pos = _save
+ break
+ end
+
+ _save1 = self.pos
+ while true # choice
+ _tmp = match_string("dt")
+ break if _tmp
+ self.pos = _save1
+ _tmp = match_string("DT")
+ break if _tmp
+ self.pos = _save1
+ break
+ end # end choice
+
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_Spnl)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = match_string(">")
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_HtmlBlockCloseDt unless _tmp
+ return _tmp
+ end
+
+ # HtmlBlockDt = HtmlBlockOpenDt (HtmlBlockDt | !HtmlBlockCloseDt .)* HtmlBlockCloseDt
+ def _HtmlBlockDt
+
+ _save = self.pos
+ while true # sequence
+ _tmp = apply(:_HtmlBlockOpenDt)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ while true
+
+ _save2 = self.pos
+ while true # choice
+ _tmp = apply(:_HtmlBlockDt)
+ break if _tmp
+ self.pos = _save2
+
+ _save3 = self.pos
+ while true # sequence
+ _save4 = self.pos
+ _tmp = apply(:_HtmlBlockCloseDt)
+ _tmp = _tmp ? nil : true
+ self.pos = _save4
+ unless _tmp
+ self.pos = _save3
+ break
+ end
+ _tmp = get_byte
+ unless _tmp
+ self.pos = _save3
+ end
+ break
+ end # end sequence
+
+ break if _tmp
+ self.pos = _save2
+ break
+ end # end choice
+
+ break unless _tmp
+ end
+ _tmp = true
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_HtmlBlockCloseDt)
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_HtmlBlockDt unless _tmp
+ return _tmp
+ end
+
+ # HtmlBlockOpenFrameset = "<" Spnl ("frameset" | "FRAMESET") Spnl HtmlAttribute* ">"
+ def _HtmlBlockOpenFrameset
+
+ _save = self.pos
+ while true # sequence
+ _tmp = match_string("<")
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_Spnl)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+
+ _save1 = self.pos
+ while true # choice
+ _tmp = match_string("frameset")
+ break if _tmp
+ self.pos = _save1
+ _tmp = match_string("FRAMESET")
+ break if _tmp
+ self.pos = _save1
+ break
+ end # end choice
+
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_Spnl)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ while true
+ _tmp = apply(:_HtmlAttribute)
+ break unless _tmp
+ end
+ _tmp = true
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = match_string(">")
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_HtmlBlockOpenFrameset unless _tmp
+ return _tmp
+ end
+
+ # HtmlBlockCloseFrameset = "<" Spnl "/" ("frameset" | "FRAMESET") Spnl ">"
+ def _HtmlBlockCloseFrameset
+
+ _save = self.pos
+ while true # sequence
+ _tmp = match_string("<")
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_Spnl)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = match_string("/")
+ unless _tmp
+ self.pos = _save
+ break
+ end
+
+ _save1 = self.pos
+ while true # choice
+ _tmp = match_string("frameset")
+ break if _tmp
+ self.pos = _save1
+ _tmp = match_string("FRAMESET")
+ break if _tmp
+ self.pos = _save1
+ break
+ end # end choice
+
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_Spnl)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = match_string(">")
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_HtmlBlockCloseFrameset unless _tmp
+ return _tmp
+ end
+
+ # HtmlBlockFrameset = HtmlBlockOpenFrameset (HtmlBlockFrameset | !HtmlBlockCloseFrameset .)* HtmlBlockCloseFrameset
+ def _HtmlBlockFrameset
+
+ _save = self.pos
+ while true # sequence
+ _tmp = apply(:_HtmlBlockOpenFrameset)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ while true
+
+ _save2 = self.pos
+ while true # choice
+ _tmp = apply(:_HtmlBlockFrameset)
+ break if _tmp
+ self.pos = _save2
+
+ _save3 = self.pos
+ while true # sequence
+ _save4 = self.pos
+ _tmp = apply(:_HtmlBlockCloseFrameset)
+ _tmp = _tmp ? nil : true
+ self.pos = _save4
+ unless _tmp
+ self.pos = _save3
+ break
+ end
+ _tmp = get_byte
+ unless _tmp
+ self.pos = _save3
+ end
+ break
+ end # end sequence
+
+ break if _tmp
+ self.pos = _save2
+ break
+ end # end choice
+
+ break unless _tmp
+ end
+ _tmp = true
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_HtmlBlockCloseFrameset)
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_HtmlBlockFrameset unless _tmp
+ return _tmp
+ end
+
+ # HtmlBlockOpenLi = "<" Spnl ("li" | "LI") Spnl HtmlAttribute* ">"
+ def _HtmlBlockOpenLi
+
+ _save = self.pos
+ while true # sequence
+ _tmp = match_string("<")
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_Spnl)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+
+ _save1 = self.pos
+ while true # choice
+ _tmp = match_string("li")
+ break if _tmp
+ self.pos = _save1
+ _tmp = match_string("LI")
+ break if _tmp
+ self.pos = _save1
+ break
+ end # end choice
+
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_Spnl)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ while true
+ _tmp = apply(:_HtmlAttribute)
+ break unless _tmp
+ end
+ _tmp = true
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = match_string(">")
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_HtmlBlockOpenLi unless _tmp
+ return _tmp
+ end
+
+ # HtmlBlockCloseLi = "<" Spnl "/" ("li" | "LI") Spnl ">"
+ def _HtmlBlockCloseLi
+
+ _save = self.pos
+ while true # sequence
+ _tmp = match_string("<")
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_Spnl)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = match_string("/")
+ unless _tmp
+ self.pos = _save
+ break
+ end
+
+ _save1 = self.pos
+ while true # choice
+ _tmp = match_string("li")
+ break if _tmp
+ self.pos = _save1
+ _tmp = match_string("LI")
+ break if _tmp
+ self.pos = _save1
+ break
+ end # end choice
+
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_Spnl)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = match_string(">")
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_HtmlBlockCloseLi unless _tmp
+ return _tmp
+ end
+
+ # HtmlBlockLi = HtmlBlockOpenLi (HtmlBlockLi | !HtmlBlockCloseLi .)* HtmlBlockCloseLi
+ def _HtmlBlockLi
+
+ _save = self.pos
+ while true # sequence
+ _tmp = apply(:_HtmlBlockOpenLi)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ while true
+
+ _save2 = self.pos
+ while true # choice
+ _tmp = apply(:_HtmlBlockLi)
+ break if _tmp
+ self.pos = _save2
+
+ _save3 = self.pos
+ while true # sequence
+ _save4 = self.pos
+ _tmp = apply(:_HtmlBlockCloseLi)
+ _tmp = _tmp ? nil : true
+ self.pos = _save4
+ unless _tmp
+ self.pos = _save3
+ break
+ end
+ _tmp = get_byte
+ unless _tmp
+ self.pos = _save3
+ end
+ break
+ end # end sequence
+
+ break if _tmp
+ self.pos = _save2
+ break
+ end # end choice
+
+ break unless _tmp
+ end
+ _tmp = true
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_HtmlBlockCloseLi)
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_HtmlBlockLi unless _tmp
+ return _tmp
+ end
+
+ # HtmlBlockOpenTbody = "<" Spnl ("tbody" | "TBODY") Spnl HtmlAttribute* ">"
+ def _HtmlBlockOpenTbody
+
+ _save = self.pos
+ while true # sequence
+ _tmp = match_string("<")
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_Spnl)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+
+ _save1 = self.pos
+ while true # choice
+ _tmp = match_string("tbody")
+ break if _tmp
+ self.pos = _save1
+ _tmp = match_string("TBODY")
+ break if _tmp
+ self.pos = _save1
+ break
+ end # end choice
+
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_Spnl)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ while true
+ _tmp = apply(:_HtmlAttribute)
+ break unless _tmp
+ end
+ _tmp = true
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = match_string(">")
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_HtmlBlockOpenTbody unless _tmp
+ return _tmp
+ end
+
+ # HtmlBlockCloseTbody = "<" Spnl "/" ("tbody" | "TBODY") Spnl ">"
+ def _HtmlBlockCloseTbody
+
+ _save = self.pos
+ while true # sequence
+ _tmp = match_string("<")
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_Spnl)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = match_string("/")
+ unless _tmp
+ self.pos = _save
+ break
+ end
+
+ _save1 = self.pos
+ while true # choice
+ _tmp = match_string("tbody")
+ break if _tmp
+ self.pos = _save1
+ _tmp = match_string("TBODY")
+ break if _tmp
+ self.pos = _save1
+ break
+ end # end choice
+
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_Spnl)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = match_string(">")
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_HtmlBlockCloseTbody unless _tmp
+ return _tmp
+ end
+
+ # HtmlBlockTbody = HtmlBlockOpenTbody (HtmlBlockTbody | !HtmlBlockCloseTbody .)* HtmlBlockCloseTbody
+ def _HtmlBlockTbody
+
+ _save = self.pos
+ while true # sequence
+ _tmp = apply(:_HtmlBlockOpenTbody)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ while true
+
+ _save2 = self.pos
+ while true # choice
+ _tmp = apply(:_HtmlBlockTbody)
+ break if _tmp
+ self.pos = _save2
+
+ _save3 = self.pos
+ while true # sequence
+ _save4 = self.pos
+ _tmp = apply(:_HtmlBlockCloseTbody)
+ _tmp = _tmp ? nil : true
+ self.pos = _save4
+ unless _tmp
+ self.pos = _save3
+ break
+ end
+ _tmp = get_byte
+ unless _tmp
+ self.pos = _save3
+ end
+ break
+ end # end sequence
+
+ break if _tmp
+ self.pos = _save2
+ break
+ end # end choice
+
+ break unless _tmp
+ end
+ _tmp = true
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_HtmlBlockCloseTbody)
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_HtmlBlockTbody unless _tmp
+ return _tmp
+ end
+
+ # HtmlBlockOpenTd = "<" Spnl ("td" | "TD") Spnl HtmlAttribute* ">"
+ def _HtmlBlockOpenTd
+
+ _save = self.pos
+ while true # sequence
+ _tmp = match_string("<")
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_Spnl)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+
+ _save1 = self.pos
+ while true # choice
+ _tmp = match_string("td")
+ break if _tmp
+ self.pos = _save1
+ _tmp = match_string("TD")
+ break if _tmp
+ self.pos = _save1
+ break
+ end # end choice
+
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_Spnl)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ while true
+ _tmp = apply(:_HtmlAttribute)
+ break unless _tmp
+ end
+ _tmp = true
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = match_string(">")
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_HtmlBlockOpenTd unless _tmp
+ return _tmp
+ end
+
+ # HtmlBlockCloseTd = "<" Spnl "/" ("td" | "TD") Spnl ">"
+ def _HtmlBlockCloseTd
+
+ _save = self.pos
+ while true # sequence
+ _tmp = match_string("<")
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_Spnl)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = match_string("/")
+ unless _tmp
+ self.pos = _save
+ break
+ end
+
+ _save1 = self.pos
+ while true # choice
+ _tmp = match_string("td")
+ break if _tmp
+ self.pos = _save1
+ _tmp = match_string("TD")
+ break if _tmp
+ self.pos = _save1
+ break
+ end # end choice
+
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_Spnl)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = match_string(">")
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_HtmlBlockCloseTd unless _tmp
+ return _tmp
+ end
+
+ # HtmlBlockTd = HtmlBlockOpenTd (HtmlBlockTd | !HtmlBlockCloseTd .)* HtmlBlockCloseTd
+ def _HtmlBlockTd
+
+ _save = self.pos
+ while true # sequence
+ _tmp = apply(:_HtmlBlockOpenTd)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ while true
+
+ _save2 = self.pos
+ while true # choice
+ _tmp = apply(:_HtmlBlockTd)
+ break if _tmp
+ self.pos = _save2
+
+ _save3 = self.pos
+ while true # sequence
+ _save4 = self.pos
+ _tmp = apply(:_HtmlBlockCloseTd)
+ _tmp = _tmp ? nil : true
+ self.pos = _save4
+ unless _tmp
+ self.pos = _save3
+ break
+ end
+ _tmp = get_byte
+ unless _tmp
+ self.pos = _save3
+ end
+ break
+ end # end sequence
+
+ break if _tmp
+ self.pos = _save2
+ break
+ end # end choice
+
+ break unless _tmp
+ end
+ _tmp = true
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_HtmlBlockCloseTd)
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_HtmlBlockTd unless _tmp
+ return _tmp
+ end
+
+ # HtmlBlockOpenTfoot = "<" Spnl ("tfoot" | "TFOOT") Spnl HtmlAttribute* ">"
+ def _HtmlBlockOpenTfoot
+
+ _save = self.pos
+ while true # sequence
+ _tmp = match_string("<")
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_Spnl)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+
+ _save1 = self.pos
+ while true # choice
+ _tmp = match_string("tfoot")
+ break if _tmp
+ self.pos = _save1
+ _tmp = match_string("TFOOT")
+ break if _tmp
+ self.pos = _save1
+ break
+ end # end choice
+
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_Spnl)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ while true
+ _tmp = apply(:_HtmlAttribute)
+ break unless _tmp
+ end
+ _tmp = true
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = match_string(">")
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_HtmlBlockOpenTfoot unless _tmp
+ return _tmp
+ end
+
+ # HtmlBlockCloseTfoot = "<" Spnl "/" ("tfoot" | "TFOOT") Spnl ">"
+ def _HtmlBlockCloseTfoot
+
+ _save = self.pos
+ while true # sequence
+ _tmp = match_string("<")
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_Spnl)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = match_string("/")
+ unless _tmp
+ self.pos = _save
+ break
+ end
+
+ _save1 = self.pos
+ while true # choice
+ _tmp = match_string("tfoot")
+ break if _tmp
+ self.pos = _save1
+ _tmp = match_string("TFOOT")
+ break if _tmp
+ self.pos = _save1
+ break
+ end # end choice
+
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_Spnl)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = match_string(">")
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_HtmlBlockCloseTfoot unless _tmp
+ return _tmp
+ end
+
+ # HtmlBlockTfoot = HtmlBlockOpenTfoot (HtmlBlockTfoot | !HtmlBlockCloseTfoot .)* HtmlBlockCloseTfoot
+ def _HtmlBlockTfoot
+
+ _save = self.pos
+ while true # sequence
+ _tmp = apply(:_HtmlBlockOpenTfoot)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ while true
+
+ _save2 = self.pos
+ while true # choice
+ _tmp = apply(:_HtmlBlockTfoot)
+ break if _tmp
+ self.pos = _save2
+
+ _save3 = self.pos
+ while true # sequence
+ _save4 = self.pos
+ _tmp = apply(:_HtmlBlockCloseTfoot)
+ _tmp = _tmp ? nil : true
+ self.pos = _save4
+ unless _tmp
+ self.pos = _save3
+ break
+ end
+ _tmp = get_byte
+ unless _tmp
+ self.pos = _save3
+ end
+ break
+ end # end sequence
+
+ break if _tmp
+ self.pos = _save2
+ break
+ end # end choice
+
+ break unless _tmp
+ end
+ _tmp = true
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_HtmlBlockCloseTfoot)
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_HtmlBlockTfoot unless _tmp
+ return _tmp
+ end
+
+ # HtmlBlockOpenTh = "<" Spnl ("th" | "TH") Spnl HtmlAttribute* ">"
+ def _HtmlBlockOpenTh
+
+ _save = self.pos
+ while true # sequence
+ _tmp = match_string("<")
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_Spnl)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+
+ _save1 = self.pos
+ while true # choice
+ _tmp = match_string("th")
+ break if _tmp
+ self.pos = _save1
+ _tmp = match_string("TH")
+ break if _tmp
+ self.pos = _save1
+ break
+ end # end choice
+
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_Spnl)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ while true
+ _tmp = apply(:_HtmlAttribute)
+ break unless _tmp
+ end
+ _tmp = true
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = match_string(">")
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_HtmlBlockOpenTh unless _tmp
+ return _tmp
+ end
+
+ # HtmlBlockCloseTh = "<" Spnl "/" ("th" | "TH") Spnl ">"
+ def _HtmlBlockCloseTh
+
+ _save = self.pos
+ while true # sequence
+ _tmp = match_string("<")
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_Spnl)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = match_string("/")
+ unless _tmp
+ self.pos = _save
+ break
+ end
+
+ _save1 = self.pos
+ while true # choice
+ _tmp = match_string("th")
+ break if _tmp
+ self.pos = _save1
+ _tmp = match_string("TH")
+ break if _tmp
+ self.pos = _save1
+ break
+ end # end choice
+
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_Spnl)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = match_string(">")
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_HtmlBlockCloseTh unless _tmp
+ return _tmp
+ end
+
+ # HtmlBlockTh = HtmlBlockOpenTh (HtmlBlockTh | !HtmlBlockCloseTh .)* HtmlBlockCloseTh
+ def _HtmlBlockTh
+
+ _save = self.pos
+ while true # sequence
+ _tmp = apply(:_HtmlBlockOpenTh)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ while true
+
+ _save2 = self.pos
+ while true # choice
+ _tmp = apply(:_HtmlBlockTh)
+ break if _tmp
+ self.pos = _save2
+
+ _save3 = self.pos
+ while true # sequence
+ _save4 = self.pos
+ _tmp = apply(:_HtmlBlockCloseTh)
+ _tmp = _tmp ? nil : true
+ self.pos = _save4
+ unless _tmp
+ self.pos = _save3
+ break
+ end
+ _tmp = get_byte
+ unless _tmp
+ self.pos = _save3
+ end
+ break
+ end # end sequence
+
+ break if _tmp
+ self.pos = _save2
+ break
+ end # end choice
+
+ break unless _tmp
+ end
+ _tmp = true
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_HtmlBlockCloseTh)
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_HtmlBlockTh unless _tmp
+ return _tmp
+ end
+
+ # HtmlBlockOpenThead = "<" Spnl ("thead" | "THEAD") Spnl HtmlAttribute* ">"
+ def _HtmlBlockOpenThead
+
+ _save = self.pos
+ while true # sequence
+ _tmp = match_string("<")
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_Spnl)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+
+ _save1 = self.pos
+ while true # choice
+ _tmp = match_string("thead")
+ break if _tmp
+ self.pos = _save1
+ _tmp = match_string("THEAD")
+ break if _tmp
+ self.pos = _save1
+ break
+ end # end choice
+
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_Spnl)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ while true
+ _tmp = apply(:_HtmlAttribute)
+ break unless _tmp
+ end
+ _tmp = true
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = match_string(">")
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_HtmlBlockOpenThead unless _tmp
+ return _tmp
+ end
+
+ # HtmlBlockCloseThead = "<" Spnl "/" ("thead" | "THEAD") Spnl ">"
+ def _HtmlBlockCloseThead
+
+ _save = self.pos
+ while true # sequence
+ _tmp = match_string("<")
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_Spnl)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = match_string("/")
+ unless _tmp
+ self.pos = _save
+ break
+ end
+
+ _save1 = self.pos
+ while true # choice
+ _tmp = match_string("thead")
+ break if _tmp
+ self.pos = _save1
+ _tmp = match_string("THEAD")
+ break if _tmp
+ self.pos = _save1
+ break
+ end # end choice
+
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_Spnl)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = match_string(">")
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_HtmlBlockCloseThead unless _tmp
+ return _tmp
+ end
+
+ # HtmlBlockThead = HtmlBlockOpenThead (HtmlBlockThead | !HtmlBlockCloseThead .)* HtmlBlockCloseThead
+ def _HtmlBlockThead
+
+ _save = self.pos
+ while true # sequence
+ _tmp = apply(:_HtmlBlockOpenThead)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ while true
+
+ _save2 = self.pos
+ while true # choice
+ _tmp = apply(:_HtmlBlockThead)
+ break if _tmp
+ self.pos = _save2
+
+ _save3 = self.pos
+ while true # sequence
+ _save4 = self.pos
+ _tmp = apply(:_HtmlBlockCloseThead)
+ _tmp = _tmp ? nil : true
+ self.pos = _save4
+ unless _tmp
+ self.pos = _save3
+ break
+ end
+ _tmp = get_byte
+ unless _tmp
+ self.pos = _save3
+ end
+ break
+ end # end sequence
+
+ break if _tmp
+ self.pos = _save2
+ break
+ end # end choice
+
+ break unless _tmp
+ end
+ _tmp = true
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_HtmlBlockCloseThead)
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_HtmlBlockThead unless _tmp
+ return _tmp
+ end
+
+ # HtmlBlockOpenTr = "<" Spnl ("tr" | "TR") Spnl HtmlAttribute* ">"
+ def _HtmlBlockOpenTr
+
+ _save = self.pos
+ while true # sequence
+ _tmp = match_string("<")
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_Spnl)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+
+ _save1 = self.pos
+ while true # choice
+ _tmp = match_string("tr")
+ break if _tmp
+ self.pos = _save1
+ _tmp = match_string("TR")
+ break if _tmp
+ self.pos = _save1
+ break
+ end # end choice
+
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_Spnl)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ while true
+ _tmp = apply(:_HtmlAttribute)
+ break unless _tmp
+ end
+ _tmp = true
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = match_string(">")
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_HtmlBlockOpenTr unless _tmp
+ return _tmp
+ end
+
+ # HtmlBlockCloseTr = "<" Spnl "/" ("tr" | "TR") Spnl ">"
+ def _HtmlBlockCloseTr
+
+ _save = self.pos
+ while true # sequence
+ _tmp = match_string("<")
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_Spnl)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = match_string("/")
+ unless _tmp
+ self.pos = _save
+ break
+ end
+
+ _save1 = self.pos
+ while true # choice
+ _tmp = match_string("tr")
+ break if _tmp
+ self.pos = _save1
+ _tmp = match_string("TR")
+ break if _tmp
+ self.pos = _save1
+ break
+ end # end choice
+
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_Spnl)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = match_string(">")
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_HtmlBlockCloseTr unless _tmp
+ return _tmp
+ end
+
+ # HtmlBlockTr = HtmlBlockOpenTr (HtmlBlockTr | !HtmlBlockCloseTr .)* HtmlBlockCloseTr
+ def _HtmlBlockTr
+
+ _save = self.pos
+ while true # sequence
+ _tmp = apply(:_HtmlBlockOpenTr)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ while true
+
+ _save2 = self.pos
+ while true # choice
+ _tmp = apply(:_HtmlBlockTr)
+ break if _tmp
+ self.pos = _save2
+
+ _save3 = self.pos
+ while true # sequence
+ _save4 = self.pos
+ _tmp = apply(:_HtmlBlockCloseTr)
+ _tmp = _tmp ? nil : true
+ self.pos = _save4
+ unless _tmp
+ self.pos = _save3
+ break
+ end
+ _tmp = get_byte
+ unless _tmp
+ self.pos = _save3
+ end
+ break
+ end # end sequence
+
+ break if _tmp
+ self.pos = _save2
+ break
+ end # end choice
+
+ break unless _tmp
+ end
+ _tmp = true
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_HtmlBlockCloseTr)
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_HtmlBlockTr unless _tmp
+ return _tmp
+ end
+
+ # HtmlBlockOpenScript = "<" Spnl ("script" | "SCRIPT") Spnl HtmlAttribute* ">"
+ def _HtmlBlockOpenScript
+
+ _save = self.pos
+ while true # sequence
+ _tmp = match_string("<")
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_Spnl)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+
+ _save1 = self.pos
+ while true # choice
+ _tmp = match_string("script")
+ break if _tmp
+ self.pos = _save1
+ _tmp = match_string("SCRIPT")
+ break if _tmp
+ self.pos = _save1
+ break
+ end # end choice
+
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_Spnl)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ while true
+ _tmp = apply(:_HtmlAttribute)
+ break unless _tmp
+ end
+ _tmp = true
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = match_string(">")
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_HtmlBlockOpenScript unless _tmp
+ return _tmp
+ end
+
+ # HtmlBlockCloseScript = "<" Spnl "/" ("script" | "SCRIPT") Spnl ">"
+ def _HtmlBlockCloseScript
+
+ _save = self.pos
+ while true # sequence
+ _tmp = match_string("<")
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_Spnl)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = match_string("/")
+ unless _tmp
+ self.pos = _save
+ break
+ end
+
+ _save1 = self.pos
+ while true # choice
+ _tmp = match_string("script")
+ break if _tmp
+ self.pos = _save1
+ _tmp = match_string("SCRIPT")
+ break if _tmp
+ self.pos = _save1
+ break
+ end # end choice
+
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_Spnl)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = match_string(">")
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_HtmlBlockCloseScript unless _tmp
+ return _tmp
+ end
+
+ # HtmlBlockScript = HtmlBlockOpenScript (!HtmlBlockCloseScript .)* HtmlBlockCloseScript
+ def _HtmlBlockScript
+
+ _save = self.pos
+ while true # sequence
+ _tmp = apply(:_HtmlBlockOpenScript)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ while true
+
+ _save2 = self.pos
+ while true # sequence
+ _save3 = self.pos
+ _tmp = apply(:_HtmlBlockCloseScript)
+ _tmp = _tmp ? nil : true
+ self.pos = _save3
+ unless _tmp
+ self.pos = _save2
+ break
+ end
+ _tmp = get_byte
+ unless _tmp
+ self.pos = _save2
+ end
+ break
+ end # end sequence
+
+ break unless _tmp
+ end
+ _tmp = true
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_HtmlBlockCloseScript)
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_HtmlBlockScript unless _tmp
+ return _tmp
+ end
+
+ # HtmlBlockInTags = (HtmlBlockAddress | HtmlBlockBlockquote | HtmlBlockCenter | HtmlBlockDir | HtmlBlockDiv | HtmlBlockDl | HtmlBlockFieldset | HtmlBlockForm | HtmlBlockH1 | HtmlBlockH2 | HtmlBlockH3 | HtmlBlockH4 | HtmlBlockH5 | HtmlBlockH6 | HtmlBlockMenu | HtmlBlockNoframes | HtmlBlockNoscript | HtmlBlockOl | HtmlBlockP | HtmlBlockPre | HtmlBlockTable | HtmlBlockUl | HtmlBlockDd | HtmlBlockDt | HtmlBlockFrameset | HtmlBlockLi | HtmlBlockTbody | HtmlBlockTd | HtmlBlockTfoot | HtmlBlockTh | HtmlBlockThead | HtmlBlockTr | HtmlBlockScript)
+ def _HtmlBlockInTags
+
+ _save = self.pos
+ while true # choice
+ _tmp = apply(:_HtmlBlockAddress)
+ break if _tmp
+ self.pos = _save
+ _tmp = apply(:_HtmlBlockBlockquote)
+ break if _tmp
+ self.pos = _save
+ _tmp = apply(:_HtmlBlockCenter)
+ break if _tmp
+ self.pos = _save
+ _tmp = apply(:_HtmlBlockDir)
+ break if _tmp
+ self.pos = _save
+ _tmp = apply(:_HtmlBlockDiv)
+ break if _tmp
+ self.pos = _save
+ _tmp = apply(:_HtmlBlockDl)
+ break if _tmp
+ self.pos = _save
+ _tmp = apply(:_HtmlBlockFieldset)
+ break if _tmp
+ self.pos = _save
+ _tmp = apply(:_HtmlBlockForm)
+ break if _tmp
+ self.pos = _save
+ _tmp = apply(:_HtmlBlockH1)
+ break if _tmp
+ self.pos = _save
+ _tmp = apply(:_HtmlBlockH2)
+ break if _tmp
+ self.pos = _save
+ _tmp = apply(:_HtmlBlockH3)
+ break if _tmp
+ self.pos = _save
+ _tmp = apply(:_HtmlBlockH4)
+ break if _tmp
+ self.pos = _save
+ _tmp = apply(:_HtmlBlockH5)
+ break if _tmp
+ self.pos = _save
+ _tmp = apply(:_HtmlBlockH6)
+ break if _tmp
+ self.pos = _save
+ _tmp = apply(:_HtmlBlockMenu)
+ break if _tmp
+ self.pos = _save
+ _tmp = apply(:_HtmlBlockNoframes)
+ break if _tmp
+ self.pos = _save
+ _tmp = apply(:_HtmlBlockNoscript)
+ break if _tmp
+ self.pos = _save
+ _tmp = apply(:_HtmlBlockOl)
+ break if _tmp
+ self.pos = _save
+ _tmp = apply(:_HtmlBlockP)
+ break if _tmp
+ self.pos = _save
+ _tmp = apply(:_HtmlBlockPre)
+ break if _tmp
+ self.pos = _save
+ _tmp = apply(:_HtmlBlockTable)
+ break if _tmp
+ self.pos = _save
+ _tmp = apply(:_HtmlBlockUl)
+ break if _tmp
+ self.pos = _save
+ _tmp = apply(:_HtmlBlockDd)
+ break if _tmp
+ self.pos = _save
+ _tmp = apply(:_HtmlBlockDt)
+ break if _tmp
+ self.pos = _save
+ _tmp = apply(:_HtmlBlockFrameset)
+ break if _tmp
+ self.pos = _save
+ _tmp = apply(:_HtmlBlockLi)
+ break if _tmp
+ self.pos = _save
+ _tmp = apply(:_HtmlBlockTbody)
+ break if _tmp
+ self.pos = _save
+ _tmp = apply(:_HtmlBlockTd)
+ break if _tmp
+ self.pos = _save
+ _tmp = apply(:_HtmlBlockTfoot)
+ break if _tmp
+ self.pos = _save
+ _tmp = apply(:_HtmlBlockTh)
+ break if _tmp
+ self.pos = _save
+ _tmp = apply(:_HtmlBlockThead)
+ break if _tmp
+ self.pos = _save
+ _tmp = apply(:_HtmlBlockTr)
+ break if _tmp
+ self.pos = _save
+ _tmp = apply(:_HtmlBlockScript)
+ break if _tmp
+ self.pos = _save
+ break
+ end # end choice
+
+ set_failed_rule :_HtmlBlockInTags unless _tmp
+ return _tmp
+ end
+
+ # HtmlBlock = < (HtmlBlockInTags | HtmlComment | HtmlBlockSelfClosing | HtmlUnclosed) > @BlankLine+ { if html? then RDoc::Markup::Raw.new text end }
+ def _HtmlBlock
+
+ _save = self.pos
+ while true # sequence
+ _text_start = self.pos
+
+ _save1 = self.pos
+ while true # choice
+ _tmp = apply(:_HtmlBlockInTags)
+ break if _tmp
+ self.pos = _save1
+ _tmp = apply(:_HtmlComment)
+ break if _tmp
+ self.pos = _save1
+ _tmp = apply(:_HtmlBlockSelfClosing)
+ break if _tmp
+ self.pos = _save1
+ _tmp = apply(:_HtmlUnclosed)
+ break if _tmp
+ self.pos = _save1
+ break
+ end # end choice
+
+ if _tmp
+ text = get_text(_text_start)
+ end
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _save2 = self.pos
+ _tmp = _BlankLine()
+ if _tmp
+ while true
+ _tmp = _BlankLine()
+ break unless _tmp
+ end
+ _tmp = true
+ else
+ self.pos = _save2
+ end
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ @result = begin; if html? then
+ RDoc::Markup::Raw.new text
+ end ; end
+ _tmp = true
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_HtmlBlock unless _tmp
+ return _tmp
+ end
+
+ # HtmlUnclosed = "<" Spnl HtmlUnclosedType Spnl HtmlAttribute* Spnl ">"
+ def _HtmlUnclosed
+
+ _save = self.pos
+ while true # sequence
+ _tmp = match_string("<")
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_Spnl)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_HtmlUnclosedType)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_Spnl)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ while true
+ _tmp = apply(:_HtmlAttribute)
+ break unless _tmp
+ end
+ _tmp = true
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_Spnl)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = match_string(">")
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_HtmlUnclosed unless _tmp
+ return _tmp
+ end
+
+ # HtmlUnclosedType = ("HR" | "hr")
+ def _HtmlUnclosedType
+
+ _save = self.pos
+ while true # choice
+ _tmp = match_string("HR")
+ break if _tmp
+ self.pos = _save
+ _tmp = match_string("hr")
+ break if _tmp
+ self.pos = _save
+ break
+ end # end choice
+
+ set_failed_rule :_HtmlUnclosedType unless _tmp
+ return _tmp
+ end
+
+ # HtmlBlockSelfClosing = "<" Spnl HtmlBlockType Spnl HtmlAttribute* "/" Spnl ">"
+ def _HtmlBlockSelfClosing
+
+ _save = self.pos
+ while true # sequence
+ _tmp = match_string("<")
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_Spnl)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_HtmlBlockType)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_Spnl)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ while true
+ _tmp = apply(:_HtmlAttribute)
+ break unless _tmp
+ end
+ _tmp = true
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = match_string("/")
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_Spnl)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = match_string(">")
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_HtmlBlockSelfClosing unless _tmp
+ return _tmp
+ end
+
+ # HtmlBlockType = ("ADDRESS" | "BLOCKQUOTE" | "CENTER" | "DD" | "DIR" | "DIV" | "DL" | "DT" | "FIELDSET" | "FORM" | "FRAMESET" | "H1" | "H2" | "H3" | "H4" | "H5" | "H6" | "HR" | "ISINDEX" | "LI" | "MENU" | "NOFRAMES" | "NOSCRIPT" | "OL" | "P" | "PRE" | "SCRIPT" | "TABLE" | "TBODY" | "TD" | "TFOOT" | "TH" | "THEAD" | "TR" | "UL" | "address" | "blockquote" | "center" | "dd" | "dir" | "div" | "dl" | "dt" | "fieldset" | "form" | "frameset" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "hr" | "isindex" | "li" | "menu" | "noframes" | "noscript" | "ol" | "p" | "pre" | "script" | "table" | "tbody" | "td" | "tfoot" | "th" | "thead" | "tr" | "ul")
+ def _HtmlBlockType
+
+ _save = self.pos
+ while true # choice
+ _tmp = match_string("ADDRESS")
+ break if _tmp
+ self.pos = _save
+ _tmp = match_string("BLOCKQUOTE")
+ break if _tmp
+ self.pos = _save
+ _tmp = match_string("CENTER")
+ break if _tmp
+ self.pos = _save
+ _tmp = match_string("DD")
+ break if _tmp
+ self.pos = _save
+ _tmp = match_string("DIR")
+ break if _tmp
+ self.pos = _save
+ _tmp = match_string("DIV")
+ break if _tmp
+ self.pos = _save
+ _tmp = match_string("DL")
+ break if _tmp
+ self.pos = _save
+ _tmp = match_string("DT")
+ break if _tmp
+ self.pos = _save
+ _tmp = match_string("FIELDSET")
+ break if _tmp
+ self.pos = _save
+ _tmp = match_string("FORM")
+ break if _tmp
+ self.pos = _save
+ _tmp = match_string("FRAMESET")
+ break if _tmp
+ self.pos = _save
+ _tmp = match_string("H1")
+ break if _tmp
+ self.pos = _save
+ _tmp = match_string("H2")
+ break if _tmp
+ self.pos = _save
+ _tmp = match_string("H3")
+ break if _tmp
+ self.pos = _save
+ _tmp = match_string("H4")
+ break if _tmp
+ self.pos = _save
+ _tmp = match_string("H5")
+ break if _tmp
+ self.pos = _save
+ _tmp = match_string("H6")
+ break if _tmp
+ self.pos = _save
+ _tmp = match_string("HR")
+ break if _tmp
+ self.pos = _save
+ _tmp = match_string("ISINDEX")
+ break if _tmp
+ self.pos = _save
+ _tmp = match_string("LI")
+ break if _tmp
+ self.pos = _save
+ _tmp = match_string("MENU")
+ break if _tmp
+ self.pos = _save
+ _tmp = match_string("NOFRAMES")
+ break if _tmp
+ self.pos = _save
+ _tmp = match_string("NOSCRIPT")
+ break if _tmp
+ self.pos = _save
+ _tmp = match_string("OL")
+ break if _tmp
+ self.pos = _save
+ _tmp = match_string("P")
+ break if _tmp
+ self.pos = _save
+ _tmp = match_string("PRE")
+ break if _tmp
+ self.pos = _save
+ _tmp = match_string("SCRIPT")
+ break if _tmp
+ self.pos = _save
+ _tmp = match_string("TABLE")
+ break if _tmp
+ self.pos = _save
+ _tmp = match_string("TBODY")
+ break if _tmp
+ self.pos = _save
+ _tmp = match_string("TD")
+ break if _tmp
+ self.pos = _save
+ _tmp = match_string("TFOOT")
+ break if _tmp
+ self.pos = _save
+ _tmp = match_string("TH")
+ break if _tmp
+ self.pos = _save
+ _tmp = match_string("THEAD")
+ break if _tmp
+ self.pos = _save
+ _tmp = match_string("TR")
+ break if _tmp
+ self.pos = _save
+ _tmp = match_string("UL")
+ break if _tmp
+ self.pos = _save
+ _tmp = match_string("address")
+ break if _tmp
+ self.pos = _save
+ _tmp = match_string("blockquote")
+ break if _tmp
+ self.pos = _save
+ _tmp = match_string("center")
+ break if _tmp
+ self.pos = _save
+ _tmp = match_string("dd")
+ break if _tmp
+ self.pos = _save
+ _tmp = match_string("dir")
+ break if _tmp
+ self.pos = _save
+ _tmp = match_string("div")
+ break if _tmp
+ self.pos = _save
+ _tmp = match_string("dl")
+ break if _tmp
+ self.pos = _save
+ _tmp = match_string("dt")
+ break if _tmp
+ self.pos = _save
+ _tmp = match_string("fieldset")
+ break if _tmp
+ self.pos = _save
+ _tmp = match_string("form")
+ break if _tmp
+ self.pos = _save
+ _tmp = match_string("frameset")
+ break if _tmp
+ self.pos = _save
+ _tmp = match_string("h1")
+ break if _tmp
+ self.pos = _save
+ _tmp = match_string("h2")
+ break if _tmp
+ self.pos = _save
+ _tmp = match_string("h3")
+ break if _tmp
+ self.pos = _save
+ _tmp = match_string("h4")
+ break if _tmp
+ self.pos = _save
+ _tmp = match_string("h5")
+ break if _tmp
+ self.pos = _save
+ _tmp = match_string("h6")
+ break if _tmp
+ self.pos = _save
+ _tmp = match_string("hr")
+ break if _tmp
+ self.pos = _save
+ _tmp = match_string("isindex")
+ break if _tmp
+ self.pos = _save
+ _tmp = match_string("li")
+ break if _tmp
+ self.pos = _save
+ _tmp = match_string("menu")
+ break if _tmp
+ self.pos = _save
+ _tmp = match_string("noframes")
+ break if _tmp
+ self.pos = _save
+ _tmp = match_string("noscript")
+ break if _tmp
+ self.pos = _save
+ _tmp = match_string("ol")
+ break if _tmp
+ self.pos = _save
+ _tmp = match_string("p")
+ break if _tmp
+ self.pos = _save
+ _tmp = match_string("pre")
+ break if _tmp
+ self.pos = _save
+ _tmp = match_string("script")
+ break if _tmp
+ self.pos = _save
+ _tmp = match_string("table")
+ break if _tmp
+ self.pos = _save
+ _tmp = match_string("tbody")
+ break if _tmp
+ self.pos = _save
+ _tmp = match_string("td")
+ break if _tmp
+ self.pos = _save
+ _tmp = match_string("tfoot")
+ break if _tmp
+ self.pos = _save
+ _tmp = match_string("th")
+ break if _tmp
+ self.pos = _save
+ _tmp = match_string("thead")
+ break if _tmp
+ self.pos = _save
+ _tmp = match_string("tr")
+ break if _tmp
+ self.pos = _save
+ _tmp = match_string("ul")
+ break if _tmp
+ self.pos = _save
+ break
+ end # end choice
+
+ set_failed_rule :_HtmlBlockType unless _tmp
+ return _tmp
+ end
+
+ # StyleOpen = "<" Spnl ("style" | "STYLE") Spnl HtmlAttribute* ">"
+ def _StyleOpen
+
+ _save = self.pos
+ while true # sequence
+ _tmp = match_string("<")
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_Spnl)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+
+ _save1 = self.pos
+ while true # choice
+ _tmp = match_string("style")
+ break if _tmp
+ self.pos = _save1
+ _tmp = match_string("STYLE")
+ break if _tmp
+ self.pos = _save1
+ break
+ end # end choice
+
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_Spnl)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ while true
+ _tmp = apply(:_HtmlAttribute)
+ break unless _tmp
+ end
+ _tmp = true
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = match_string(">")
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_StyleOpen unless _tmp
+ return _tmp
+ end
+
+ # StyleClose = "<" Spnl "/" ("style" | "STYLE") Spnl ">"
+ def _StyleClose
+
+ _save = self.pos
+ while true # sequence
+ _tmp = match_string("<")
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_Spnl)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = match_string("/")
+ unless _tmp
+ self.pos = _save
+ break
+ end
+
+ _save1 = self.pos
+ while true # choice
+ _tmp = match_string("style")
+ break if _tmp
+ self.pos = _save1
+ _tmp = match_string("STYLE")
+ break if _tmp
+ self.pos = _save1
+ break
+ end # end choice
+
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_Spnl)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = match_string(">")
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_StyleClose unless _tmp
+ return _tmp
+ end
+
+ # InStyleTags = StyleOpen (!StyleClose .)* StyleClose
+ def _InStyleTags
+
+ _save = self.pos
+ while true # sequence
+ _tmp = apply(:_StyleOpen)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ while true
+
+ _save2 = self.pos
+ while true # sequence
+ _save3 = self.pos
+ _tmp = apply(:_StyleClose)
+ _tmp = _tmp ? nil : true
+ self.pos = _save3
+ unless _tmp
+ self.pos = _save2
+ break
+ end
+ _tmp = get_byte
+ unless _tmp
+ self.pos = _save2
+ end
+ break
+ end # end sequence
+
+ break unless _tmp
+ end
+ _tmp = true
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_StyleClose)
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_InStyleTags unless _tmp
+ return _tmp
+ end
+
+ # StyleBlock = < InStyleTags > @BlankLine* { if css? then RDoc::Markup::Raw.new text end }
+ def _StyleBlock
+
+ _save = self.pos
+ while true # sequence
+ _text_start = self.pos
+ _tmp = apply(:_InStyleTags)
+ if _tmp
+ text = get_text(_text_start)
+ end
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ while true
+ _tmp = _BlankLine()
+ break unless _tmp
+ end
+ _tmp = true
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ @result = begin; if css? then
+ RDoc::Markup::Raw.new text
+ end ; end
+ _tmp = true
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_StyleBlock unless _tmp
+ return _tmp
+ end
+
+ # Inlines = (!@Endline Inline:i { i } | @Endline:c &Inline { c })+:chunks @Endline? { chunks }
+ def _Inlines
+
+ _save = self.pos
+ while true # sequence
+ _save1 = self.pos
+ _ary = []
+
+ _save2 = self.pos
+ while true # choice
+
+ _save3 = self.pos
+ while true # sequence
+ _save4 = self.pos
+ _tmp = _Endline()
+ _tmp = _tmp ? nil : true
+ self.pos = _save4
+ unless _tmp
+ self.pos = _save3
+ break
+ end
+ _tmp = apply(:_Inline)
+ i = @result
+ unless _tmp
+ self.pos = _save3
+ break
+ end
+ @result = begin; i ; end
+ _tmp = true
+ unless _tmp
+ self.pos = _save3
+ end
+ break
+ end # end sequence
+
+ break if _tmp
+ self.pos = _save2
+
+ _save5 = self.pos
+ while true # sequence
+ _tmp = _Endline()
+ c = @result
+ unless _tmp
+ self.pos = _save5
+ break
+ end
+ _save6 = self.pos
+ _tmp = apply(:_Inline)
+ self.pos = _save6
+ unless _tmp
+ self.pos = _save5
+ break
+ end
+ @result = begin; c ; end
+ _tmp = true
+ unless _tmp
+ self.pos = _save5
+ end
+ break
+ end # end sequence
+
+ break if _tmp
+ self.pos = _save2
+ break
+ end # end choice
+
+ if _tmp
+ _ary << @result
+ while true
+
+ _save7 = self.pos
+ while true # choice
+
+ _save8 = self.pos
+ while true # sequence
+ _save9 = self.pos
+ _tmp = _Endline()
+ _tmp = _tmp ? nil : true
+ self.pos = _save9
+ unless _tmp
+ self.pos = _save8
+ break
+ end
+ _tmp = apply(:_Inline)
+ i = @result
+ unless _tmp
+ self.pos = _save8
+ break
+ end
+ @result = begin; i ; end
+ _tmp = true
+ unless _tmp
+ self.pos = _save8
+ end
+ break
+ end # end sequence
+
+ break if _tmp
+ self.pos = _save7
+
+ _save10 = self.pos
+ while true # sequence
+ _tmp = _Endline()
+ c = @result
+ unless _tmp
+ self.pos = _save10
+ break
+ end
+ _save11 = self.pos
+ _tmp = apply(:_Inline)
+ self.pos = _save11
+ unless _tmp
+ self.pos = _save10
+ break
+ end
+ @result = begin; c ; end
+ _tmp = true
+ unless _tmp
+ self.pos = _save10
+ end
+ break
+ end # end sequence
+
+ break if _tmp
+ self.pos = _save7
+ break
+ end # end choice
+
+ _ary << @result if _tmp
+ break unless _tmp
+ end
+ _tmp = true
+ @result = _ary
+ else
+ self.pos = _save1
+ end
+ chunks = @result
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _save12 = self.pos
+ _tmp = _Endline()
+ unless _tmp
+ _tmp = true
+ self.pos = _save12
+ end
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ @result = begin; chunks ; end
+ _tmp = true
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_Inlines unless _tmp
+ return _tmp
+ end
+
+ # Inline = (Str | @Endline | UlOrStarLine | @Space | Strong | Emph | Image | Link | NoteReference | InlineNote | Code | RawHtml | Entity | EscapedChar | Symbol)
+ def _Inline
+
+ _save = self.pos
+ while true # choice
+ _tmp = apply(:_Str)
+ break if _tmp
+ self.pos = _save
+ _tmp = _Endline()
+ break if _tmp
+ self.pos = _save
+ _tmp = apply(:_UlOrStarLine)
+ break if _tmp
+ self.pos = _save
+ _tmp = _Space()
+ break if _tmp
+ self.pos = _save
+ _tmp = apply(:_Strong)
+ break if _tmp
+ self.pos = _save
+ _tmp = apply(:_Emph)
+ break if _tmp
+ self.pos = _save
+ _tmp = apply(:_Image)
+ break if _tmp
+ self.pos = _save
+ _tmp = apply(:_Link)
+ break if _tmp
+ self.pos = _save
+ _tmp = apply(:_NoteReference)
+ break if _tmp
+ self.pos = _save
+ _tmp = apply(:_InlineNote)
+ break if _tmp
+ self.pos = _save
+ _tmp = apply(:_Code)
+ break if _tmp
+ self.pos = _save
+ _tmp = apply(:_RawHtml)
+ break if _tmp
+ self.pos = _save
+ _tmp = apply(:_Entity)
+ break if _tmp
+ self.pos = _save
+ _tmp = apply(:_EscapedChar)
+ break if _tmp
+ self.pos = _save
+ _tmp = apply(:_Symbol)
+ break if _tmp
+ self.pos = _save
+ break
+ end # end choice
+
+ set_failed_rule :_Inline unless _tmp
+ return _tmp
+ end
+
+ # Space = @Spacechar+ { " " }
+ def _Space
+
+ _save = self.pos
+ while true # sequence
+ _save1 = self.pos
+ _tmp = _Spacechar()
+ if _tmp
+ while true
+ _tmp = _Spacechar()
+ break unless _tmp
+ end
+ _tmp = true
+ else
+ self.pos = _save1
+ end
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ @result = begin; " " ; end
+ _tmp = true
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_Space unless _tmp
+ return _tmp
+ end
+
+ # Str = @StartList:a < @NormalChar+ > { a = text } (StrChunk:c { a << c })* { a }
+ def _Str
+
+ _save = self.pos
+ while true # sequence
+ _tmp = _StartList()
+ a = @result
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _text_start = self.pos
+ _save1 = self.pos
+ _tmp = _NormalChar()
+ if _tmp
+ while true
+ _tmp = _NormalChar()
+ break unless _tmp
+ end
+ _tmp = true
+ else
+ self.pos = _save1
+ end
+ if _tmp
+ text = get_text(_text_start)
+ end
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ @result = begin; a = text ; end
+ _tmp = true
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ while true
+
+ _save3 = self.pos
+ while true # sequence
+ _tmp = apply(:_StrChunk)
+ c = @result
+ unless _tmp
+ self.pos = _save3
+ break
+ end
+ @result = begin; a << c ; end
+ _tmp = true
+ unless _tmp
+ self.pos = _save3
+ end
+ break
+ end # end sequence
+
+ break unless _tmp
+ end
+ _tmp = true
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ @result = begin; a ; end
+ _tmp = true
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_Str unless _tmp
+ return _tmp
+ end
+
+ # StrChunk = < (@NormalChar | /_+/ &Alphanumeric)+ > { text }
+ def _StrChunk
+
+ _save = self.pos
+ while true # sequence
+ _text_start = self.pos
+ _save1 = self.pos
+
+ _save2 = self.pos
+ while true # choice
+ _tmp = _NormalChar()
+ break if _tmp
+ self.pos = _save2
+
+ _save3 = self.pos
+ while true # sequence
+ _tmp = scan(/\A(?-mix:_+)/)
+ unless _tmp
+ self.pos = _save3
+ break
+ end
+ _save4 = self.pos
+ _tmp = apply(:_Alphanumeric)
+ self.pos = _save4
+ unless _tmp
+ self.pos = _save3
+ end
+ break
+ end # end sequence
+
+ break if _tmp
+ self.pos = _save2
+ break
+ end # end choice
+
+ if _tmp
+ while true
+
+ _save5 = self.pos
+ while true # choice
+ _tmp = _NormalChar()
+ break if _tmp
+ self.pos = _save5
+
+ _save6 = self.pos
+ while true # sequence
+ _tmp = scan(/\A(?-mix:_+)/)
+ unless _tmp
+ self.pos = _save6
+ break
+ end
+ _save7 = self.pos
+ _tmp = apply(:_Alphanumeric)
+ self.pos = _save7
+ unless _tmp
+ self.pos = _save6
+ end
+ break
+ end # end sequence
+
+ break if _tmp
+ self.pos = _save5
+ break
+ end # end choice
+
+ break unless _tmp
+ end
+ _tmp = true
+ else
+ self.pos = _save1
+ end
+ if _tmp
+ text = get_text(_text_start)
+ end
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ @result = begin; text ; end
+ _tmp = true
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_StrChunk unless _tmp
+ return _tmp
+ end
+
+ # EscapedChar = "\\" !@Newline < /[:\\`|*_{}\[\]()#+.!><-]/ > { text }
+ def _EscapedChar
+
+ _save = self.pos
+ while true # sequence
+ _tmp = match_string("\\")
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _save1 = self.pos
+ _tmp = _Newline()
+ _tmp = _tmp ? nil : true
+ self.pos = _save1
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _text_start = self.pos
+ _tmp = scan(/\A(?-mix:[:\\`|*_{}\[\]()#+.!><-])/)
+ if _tmp
+ text = get_text(_text_start)
+ end
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ @result = begin; text ; end
+ _tmp = true
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_EscapedChar unless _tmp
+ return _tmp
+ end
+
+ # Entity = (HexEntity | DecEntity | CharEntity):a { a }
+ def _Entity
+
+ _save = self.pos
+ while true # sequence
+
+ _save1 = self.pos
+ while true # choice
+ _tmp = apply(:_HexEntity)
+ break if _tmp
+ self.pos = _save1
+ _tmp = apply(:_DecEntity)
+ break if _tmp
+ self.pos = _save1
+ _tmp = apply(:_CharEntity)
+ break if _tmp
+ self.pos = _save1
+ break
+ end # end choice
+
+ a = @result
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ @result = begin; a ; end
+ _tmp = true
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_Entity unless _tmp
+ return _tmp
+ end
+
+ # Endline = (@LineBreak | @TerminalEndline | @NormalEndline)
+ def _Endline
+
+ _save = self.pos
+ while true # choice
+ _tmp = _LineBreak()
+ break if _tmp
+ self.pos = _save
+ _tmp = _TerminalEndline()
+ break if _tmp
+ self.pos = _save
+ _tmp = _NormalEndline()
+ break if _tmp
+ self.pos = _save
+ break
+ end # end choice
+
+ set_failed_rule :_Endline unless _tmp
+ return _tmp
+ end
+
+ # NormalEndline = @Sp @Newline !@BlankLine !">" !AtxStart !(Line /={3,}|-{3,}=/ @Newline) { "\n" }
+ def _NormalEndline
+
+ _save = self.pos
+ while true # sequence
+ _tmp = _Sp()
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = _Newline()
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _save1 = self.pos
+ _tmp = _BlankLine()
+ _tmp = _tmp ? nil : true
+ self.pos = _save1
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _save2 = self.pos
+ _tmp = match_string(">")
+ _tmp = _tmp ? nil : true
+ self.pos = _save2
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _save3 = self.pos
+ _tmp = apply(:_AtxStart)
+ _tmp = _tmp ? nil : true
+ self.pos = _save3
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _save4 = self.pos
+
+ _save5 = self.pos
+ while true # sequence
+ _tmp = apply(:_Line)
+ unless _tmp
+ self.pos = _save5
+ break
+ end
+ _tmp = scan(/\A(?-mix:={3,}|-{3,}=)/)
+ unless _tmp
+ self.pos = _save5
+ break
+ end
+ _tmp = _Newline()
+ unless _tmp
+ self.pos = _save5
+ end
+ break
+ end # end sequence
+
+ _tmp = _tmp ? nil : true
+ self.pos = _save4
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ @result = begin; "\n" ; end
+ _tmp = true
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_NormalEndline unless _tmp
+ return _tmp
+ end
+
+ # TerminalEndline = @Sp @Newline @Eof
+ def _TerminalEndline
+
+ _save = self.pos
+ while true # sequence
+ _tmp = _Sp()
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = _Newline()
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = _Eof()
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_TerminalEndline unless _tmp
+ return _tmp
+ end
+
+ # LineBreak = " " @NormalEndline { RDoc::Markup::HardBreak.new }
+ def _LineBreak
+
+ _save = self.pos
+ while true # sequence
+ _tmp = match_string(" ")
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = _NormalEndline()
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ @result = begin; RDoc::Markup::HardBreak.new ; end
+ _tmp = true
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_LineBreak unless _tmp
+ return _tmp
+ end
+
+ # Symbol = < @SpecialChar > { text }
+ def _Symbol
+
+ _save = self.pos
+ while true # sequence
+ _text_start = self.pos
+ _tmp = _SpecialChar()
+ if _tmp
+ text = get_text(_text_start)
+ end
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ @result = begin; text ; end
+ _tmp = true
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_Symbol unless _tmp
+ return _tmp
+ end
+
+ # UlOrStarLine = (UlLine | StarLine):a { a }
+ def _UlOrStarLine
+
+ _save = self.pos
+ while true # sequence
+
+ _save1 = self.pos
+ while true # choice
+ _tmp = apply(:_UlLine)
+ break if _tmp
+ self.pos = _save1
+ _tmp = apply(:_StarLine)
+ break if _tmp
+ self.pos = _save1
+ break
+ end # end choice
+
+ a = @result
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ @result = begin; a ; end
+ _tmp = true
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_UlOrStarLine unless _tmp
+ return _tmp
+ end
+
+ # StarLine = (< /\*{4,}/ > { text } | < @Spacechar /\*+/ &@Spacechar > { text })
+ def _StarLine
+
+ _save = self.pos
+ while true # choice
+
+ _save1 = self.pos
+ while true # sequence
+ _text_start = self.pos
+ _tmp = scan(/\A(?-mix:\*{4,})/)
+ if _tmp
+ text = get_text(_text_start)
+ end
+ unless _tmp
+ self.pos = _save1
+ break
+ end
+ @result = begin; text ; end
+ _tmp = true
+ unless _tmp
+ self.pos = _save1
+ end
+ break
+ end # end sequence
+
+ break if _tmp
+ self.pos = _save
+
+ _save2 = self.pos
+ while true # sequence
+ _text_start = self.pos
+
+ _save3 = self.pos
+ while true # sequence
+ _tmp = _Spacechar()
+ unless _tmp
+ self.pos = _save3
+ break
+ end
+ _tmp = scan(/\A(?-mix:\*+)/)
+ unless _tmp
+ self.pos = _save3
+ break
+ end
+ _save4 = self.pos
+ _tmp = _Spacechar()
+ self.pos = _save4
+ unless _tmp
+ self.pos = _save3
+ end
+ break
+ end # end sequence
+
+ if _tmp
+ text = get_text(_text_start)
+ end
+ unless _tmp
+ self.pos = _save2
+ break
+ end
+ @result = begin; text ; end
+ _tmp = true
+ unless _tmp
+ self.pos = _save2
+ end
+ break
+ end # end sequence
+
+ break if _tmp
+ self.pos = _save
+ break
+ end # end choice
+
+ set_failed_rule :_StarLine unless _tmp
+ return _tmp
+ end
+
+ # UlLine = (< /_{4,}/ > { text } | < @Spacechar /_+/ &@Spacechar > { text })
+ def _UlLine
+
+ _save = self.pos
+ while true # choice
+
+ _save1 = self.pos
+ while true # sequence
+ _text_start = self.pos
+ _tmp = scan(/\A(?-mix:_{4,})/)
+ if _tmp
+ text = get_text(_text_start)
+ end
+ unless _tmp
+ self.pos = _save1
+ break
+ end
+ @result = begin; text ; end
+ _tmp = true
+ unless _tmp
+ self.pos = _save1
+ end
+ break
+ end # end sequence
+
+ break if _tmp
+ self.pos = _save
+
+ _save2 = self.pos
+ while true # sequence
+ _text_start = self.pos
+
+ _save3 = self.pos
+ while true # sequence
+ _tmp = _Spacechar()
+ unless _tmp
+ self.pos = _save3
+ break
+ end
+ _tmp = scan(/\A(?-mix:_+)/)
+ unless _tmp
+ self.pos = _save3
+ break
+ end
+ _save4 = self.pos
+ _tmp = _Spacechar()
+ self.pos = _save4
+ unless _tmp
+ self.pos = _save3
+ end
+ break
+ end # end sequence
+
+ if _tmp
+ text = get_text(_text_start)
+ end
+ unless _tmp
+ self.pos = _save2
+ break
+ end
+ @result = begin; text ; end
+ _tmp = true
+ unless _tmp
+ self.pos = _save2
+ end
+ break
+ end # end sequence
+
+ break if _tmp
+ self.pos = _save
+ break
+ end # end choice
+
+ set_failed_rule :_UlLine unless _tmp
+ return _tmp
+ end
+
+ # Emph = (EmphStar | EmphUl)
+ def _Emph
+
+ _save = self.pos
+ while true # choice
+ _tmp = apply(:_EmphStar)
+ break if _tmp
+ self.pos = _save
+ _tmp = apply(:_EmphUl)
+ break if _tmp
+ self.pos = _save
+ break
+ end # end choice
+
+ set_failed_rule :_Emph unless _tmp
+ return _tmp
+ end
+
+ # OneStarOpen = !StarLine "*" !@Spacechar !@Newline
+ def _OneStarOpen
+
+ _save = self.pos
+ while true # sequence
+ _save1 = self.pos
+ _tmp = apply(:_StarLine)
+ _tmp = _tmp ? nil : true
+ self.pos = _save1
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = match_string("*")
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _save2 = self.pos
+ _tmp = _Spacechar()
+ _tmp = _tmp ? nil : true
+ self.pos = _save2
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _save3 = self.pos
+ _tmp = _Newline()
+ _tmp = _tmp ? nil : true
+ self.pos = _save3
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_OneStarOpen unless _tmp
+ return _tmp
+ end
+
+ # OneStarClose = !@Spacechar !@Newline Inline:a "*" { a }
+ def _OneStarClose
+
+ _save = self.pos
+ while true # sequence
+ _save1 = self.pos
+ _tmp = _Spacechar()
+ _tmp = _tmp ? nil : true
+ self.pos = _save1
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _save2 = self.pos
+ _tmp = _Newline()
+ _tmp = _tmp ? nil : true
+ self.pos = _save2
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_Inline)
+ a = @result
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = match_string("*")
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ @result = begin; a ; end
+ _tmp = true
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_OneStarClose unless _tmp
+ return _tmp
+ end
+
+ # EmphStar = OneStarOpen @StartList:a (!OneStarClose Inline:l { a << l })* OneStarClose:l { a << l } { emphasis a.join }
+ def _EmphStar
+
+ _save = self.pos
+ while true # sequence
+ _tmp = apply(:_OneStarOpen)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = _StartList()
+ a = @result
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ while true
+
+ _save2 = self.pos
+ while true # sequence
+ _save3 = self.pos
+ _tmp = apply(:_OneStarClose)
+ _tmp = _tmp ? nil : true
+ self.pos = _save3
+ unless _tmp
+ self.pos = _save2
+ break
+ end
+ _tmp = apply(:_Inline)
+ l = @result
+ unless _tmp
+ self.pos = _save2
+ break
+ end
+ @result = begin; a << l ; end
+ _tmp = true
+ unless _tmp
+ self.pos = _save2
+ end
+ break
+ end # end sequence
+
+ break unless _tmp
+ end
+ _tmp = true
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_OneStarClose)
+ l = @result
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ @result = begin; a << l ; end
+ _tmp = true
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ @result = begin; emphasis a.join ; end
+ _tmp = true
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_EmphStar unless _tmp
+ return _tmp
+ end
+
+ # OneUlOpen = !UlLine "_" !@Spacechar !@Newline
+ def _OneUlOpen
+
+ _save = self.pos
+ while true # sequence
+ _save1 = self.pos
+ _tmp = apply(:_UlLine)
+ _tmp = _tmp ? nil : true
+ self.pos = _save1
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = match_string("_")
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _save2 = self.pos
+ _tmp = _Spacechar()
+ _tmp = _tmp ? nil : true
+ self.pos = _save2
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _save3 = self.pos
+ _tmp = _Newline()
+ _tmp = _tmp ? nil : true
+ self.pos = _save3
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_OneUlOpen unless _tmp
+ return _tmp
+ end
+
+ # OneUlClose = !@Spacechar !@Newline Inline:a "_" { a }
+ def _OneUlClose
+
+ _save = self.pos
+ while true # sequence
+ _save1 = self.pos
+ _tmp = _Spacechar()
+ _tmp = _tmp ? nil : true
+ self.pos = _save1
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _save2 = self.pos
+ _tmp = _Newline()
+ _tmp = _tmp ? nil : true
+ self.pos = _save2
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_Inline)
+ a = @result
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = match_string("_")
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ @result = begin; a ; end
+ _tmp = true
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_OneUlClose unless _tmp
+ return _tmp
+ end
+
+ # EmphUl = OneUlOpen @StartList:a (!OneUlClose Inline:l { a << l })* OneUlClose:l { a << l } { emphasis a.join }
+ def _EmphUl
+
+ _save = self.pos
+ while true # sequence
+ _tmp = apply(:_OneUlOpen)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = _StartList()
+ a = @result
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ while true
+
+ _save2 = self.pos
+ while true # sequence
+ _save3 = self.pos
+ _tmp = apply(:_OneUlClose)
+ _tmp = _tmp ? nil : true
+ self.pos = _save3
+ unless _tmp
+ self.pos = _save2
+ break
+ end
+ _tmp = apply(:_Inline)
+ l = @result
+ unless _tmp
+ self.pos = _save2
+ break
+ end
+ @result = begin; a << l ; end
+ _tmp = true
+ unless _tmp
+ self.pos = _save2
+ end
+ break
+ end # end sequence
+
+ break unless _tmp
+ end
+ _tmp = true
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_OneUlClose)
+ l = @result
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ @result = begin; a << l ; end
+ _tmp = true
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ @result = begin; emphasis a.join ; end
+ _tmp = true
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_EmphUl unless _tmp
+ return _tmp
+ end
+
+ # Strong = (StrongStar | StrongUl)
+ def _Strong
+
+ _save = self.pos
+ while true # choice
+ _tmp = apply(:_StrongStar)
+ break if _tmp
+ self.pos = _save
+ _tmp = apply(:_StrongUl)
+ break if _tmp
+ self.pos = _save
+ break
+ end # end choice
+
+ set_failed_rule :_Strong unless _tmp
+ return _tmp
+ end
+
+ # TwoStarOpen = !StarLine "**" !@Spacechar !@Newline
+ def _TwoStarOpen
+
+ _save = self.pos
+ while true # sequence
+ _save1 = self.pos
+ _tmp = apply(:_StarLine)
+ _tmp = _tmp ? nil : true
+ self.pos = _save1
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = match_string("**")
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _save2 = self.pos
+ _tmp = _Spacechar()
+ _tmp = _tmp ? nil : true
+ self.pos = _save2
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _save3 = self.pos
+ _tmp = _Newline()
+ _tmp = _tmp ? nil : true
+ self.pos = _save3
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_TwoStarOpen unless _tmp
+ return _tmp
+ end
+
+ # TwoStarClose = !@Spacechar !@Newline Inline:a "**" { a }
+ def _TwoStarClose
+
+ _save = self.pos
+ while true # sequence
+ _save1 = self.pos
+ _tmp = _Spacechar()
+ _tmp = _tmp ? nil : true
+ self.pos = _save1
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _save2 = self.pos
+ _tmp = _Newline()
+ _tmp = _tmp ? nil : true
+ self.pos = _save2
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_Inline)
+ a = @result
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = match_string("**")
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ @result = begin; a ; end
+ _tmp = true
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_TwoStarClose unless _tmp
+ return _tmp
+ end
+
+ # StrongStar = TwoStarOpen @StartList:a (!TwoStarClose Inline:l { a << l })* TwoStarClose:l { a << l } { strong a.join }
+ def _StrongStar
+
+ _save = self.pos
+ while true # sequence
+ _tmp = apply(:_TwoStarOpen)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = _StartList()
+ a = @result
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ while true
+
+ _save2 = self.pos
+ while true # sequence
+ _save3 = self.pos
+ _tmp = apply(:_TwoStarClose)
+ _tmp = _tmp ? nil : true
+ self.pos = _save3
+ unless _tmp
+ self.pos = _save2
+ break
+ end
+ _tmp = apply(:_Inline)
+ l = @result
+ unless _tmp
+ self.pos = _save2
+ break
+ end
+ @result = begin; a << l ; end
+ _tmp = true
+ unless _tmp
+ self.pos = _save2
+ end
+ break
+ end # end sequence
+
+ break unless _tmp
+ end
+ _tmp = true
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_TwoStarClose)
+ l = @result
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ @result = begin; a << l ; end
+ _tmp = true
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ @result = begin; strong a.join ; end
+ _tmp = true
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_StrongStar unless _tmp
+ return _tmp
+ end
+
+ # TwoUlOpen = !UlLine "__" !@Spacechar !@Newline
+ def _TwoUlOpen
+
+ _save = self.pos
+ while true # sequence
+ _save1 = self.pos
+ _tmp = apply(:_UlLine)
+ _tmp = _tmp ? nil : true
+ self.pos = _save1
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = match_string("__")
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _save2 = self.pos
+ _tmp = _Spacechar()
+ _tmp = _tmp ? nil : true
+ self.pos = _save2
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _save3 = self.pos
+ _tmp = _Newline()
+ _tmp = _tmp ? nil : true
+ self.pos = _save3
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_TwoUlOpen unless _tmp
+ return _tmp
+ end
+
+ # TwoUlClose = !@Spacechar !@Newline Inline:a "__" { a }
+ def _TwoUlClose
+
+ _save = self.pos
+ while true # sequence
+ _save1 = self.pos
+ _tmp = _Spacechar()
+ _tmp = _tmp ? nil : true
+ self.pos = _save1
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _save2 = self.pos
+ _tmp = _Newline()
+ _tmp = _tmp ? nil : true
+ self.pos = _save2
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_Inline)
+ a = @result
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = match_string("__")
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ @result = begin; a ; end
+ _tmp = true
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_TwoUlClose unless _tmp
+ return _tmp
+ end
+
+ # StrongUl = TwoUlOpen @StartList:a (!TwoUlClose Inline:i { a << i })* TwoUlClose:l { a << l } { strong a.join }
+ def _StrongUl
+
+ _save = self.pos
+ while true # sequence
+ _tmp = apply(:_TwoUlOpen)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = _StartList()
+ a = @result
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ while true
+
+ _save2 = self.pos
+ while true # sequence
+ _save3 = self.pos
+ _tmp = apply(:_TwoUlClose)
+ _tmp = _tmp ? nil : true
+ self.pos = _save3
+ unless _tmp
+ self.pos = _save2
+ break
+ end
+ _tmp = apply(:_Inline)
+ i = @result
+ unless _tmp
+ self.pos = _save2
+ break
+ end
+ @result = begin; a << i ; end
+ _tmp = true
+ unless _tmp
+ self.pos = _save2
+ end
+ break
+ end # end sequence
+
+ break unless _tmp
+ end
+ _tmp = true
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_TwoUlClose)
+ l = @result
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ @result = begin; a << l ; end
+ _tmp = true
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ @result = begin; strong a.join ; end
+ _tmp = true
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_StrongUl unless _tmp
+ return _tmp
+ end
+
+ # Image = "!" (ExplicitLink | ReferenceLink):a { "rdoc-image:#{a[/\[(.*)\]/, 1]}" }
+ def _Image
+
+ _save = self.pos
+ while true # sequence
+ _tmp = match_string("!")
+ unless _tmp
+ self.pos = _save
+ break
+ end
+
+ _save1 = self.pos
+ while true # choice
+ _tmp = apply(:_ExplicitLink)
+ break if _tmp
+ self.pos = _save1
+ _tmp = apply(:_ReferenceLink)
+ break if _tmp
+ self.pos = _save1
+ break
+ end # end choice
+
+ a = @result
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ @result = begin; "rdoc-image:#{a[/\[(.*)\]/, 1]}" ; end
+ _tmp = true
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_Image unless _tmp
+ return _tmp
+ end
+
+ # Link = (ExplicitLink | ReferenceLink | AutoLink)
+ def _Link
+
+ _save = self.pos
+ while true # choice
+ _tmp = apply(:_ExplicitLink)
+ break if _tmp
+ self.pos = _save
+ _tmp = apply(:_ReferenceLink)
+ break if _tmp
+ self.pos = _save
+ _tmp = apply(:_AutoLink)
+ break if _tmp
+ self.pos = _save
+ break
+ end # end choice
+
+ set_failed_rule :_Link unless _tmp
+ return _tmp
+ end
+
+ # ReferenceLink = (ReferenceLinkDouble | ReferenceLinkSingle)
+ def _ReferenceLink
+
+ _save = self.pos
+ while true # choice
+ _tmp = apply(:_ReferenceLinkDouble)
+ break if _tmp
+ self.pos = _save
+ _tmp = apply(:_ReferenceLinkSingle)
+ break if _tmp
+ self.pos = _save
+ break
+ end # end choice
+
+ set_failed_rule :_ReferenceLink unless _tmp
+ return _tmp
+ end
+
+ # ReferenceLinkDouble = Label:content < Spnl > !"[]" Label:label { link_to content, label, text }
+ def _ReferenceLinkDouble
+
+ _save = self.pos
+ while true # sequence
+ _tmp = apply(:_Label)
+ content = @result
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _text_start = self.pos
+ _tmp = apply(:_Spnl)
+ if _tmp
+ text = get_text(_text_start)
+ end
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _save1 = self.pos
+ _tmp = match_string("[]")
+ _tmp = _tmp ? nil : true
+ self.pos = _save1
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_Label)
+ label = @result
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ @result = begin; link_to content, label, text ; end
+ _tmp = true
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_ReferenceLinkDouble unless _tmp
+ return _tmp
+ end
+
+ # ReferenceLinkSingle = Label:content < (Spnl "[]")? > { link_to content, content, text }
+ def _ReferenceLinkSingle
+
+ _save = self.pos
+ while true # sequence
+ _tmp = apply(:_Label)
+ content = @result
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _text_start = self.pos
+ _save1 = self.pos
+
+ _save2 = self.pos
+ while true # sequence
+ _tmp = apply(:_Spnl)
+ unless _tmp
+ self.pos = _save2
+ break
+ end
+ _tmp = match_string("[]")
+ unless _tmp
+ self.pos = _save2
+ end
+ break
+ end # end sequence
+
+ unless _tmp
+ _tmp = true
+ self.pos = _save1
+ end
+ if _tmp
+ text = get_text(_text_start)
+ end
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ @result = begin; link_to content, content, text ; end
+ _tmp = true
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_ReferenceLinkSingle unless _tmp
+ return _tmp
+ end
+
+ # ExplicitLink = Label:l Spnl "(" @Sp Source:s Spnl Title @Sp ")" { "{#{l}}[#{s}]" }
+ def _ExplicitLink
+
+ _save = self.pos
+ while true # sequence
+ _tmp = apply(:_Label)
+ l = @result
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_Spnl)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = match_string("(")
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = _Sp()
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_Source)
+ s = @result
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_Spnl)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_Title)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = _Sp()
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = match_string(")")
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ @result = begin; "{#{l}}[#{s}]" ; end
+ _tmp = true
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_ExplicitLink unless _tmp
+ return _tmp
+ end
+
+ # Source = ("<" < SourceContents > ">" | < SourceContents >) { text }
+ def _Source
+
+ _save = self.pos
+ while true # sequence
+
+ _save1 = self.pos
+ while true # choice
+
+ _save2 = self.pos
+ while true # sequence
+ _tmp = match_string("<")
+ unless _tmp
+ self.pos = _save2
+ break
+ end
+ _text_start = self.pos
+ _tmp = apply(:_SourceContents)
+ if _tmp
+ text = get_text(_text_start)
+ end
+ unless _tmp
+ self.pos = _save2
+ break
+ end
+ _tmp = match_string(">")
+ unless _tmp
+ self.pos = _save2
+ end
+ break
+ end # end sequence
+
+ break if _tmp
+ self.pos = _save1
+ _text_start = self.pos
+ _tmp = apply(:_SourceContents)
+ if _tmp
+ text = get_text(_text_start)
+ end
+ break if _tmp
+ self.pos = _save1
+ break
+ end # end choice
+
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ @result = begin; text ; end
+ _tmp = true
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_Source unless _tmp
+ return _tmp
+ end
+
+ # SourceContents = (((!"(" !")" !">" Nonspacechar)+ | "(" SourceContents ")")* | "")
+ def _SourceContents
+
+ _save = self.pos
+ while true # choice
+ while true
+
+ _save2 = self.pos
+ while true # choice
+ _save3 = self.pos
+
+ _save4 = self.pos
+ while true # sequence
+ _save5 = self.pos
+ _tmp = match_string("(")
+ _tmp = _tmp ? nil : true
+ self.pos = _save5
+ unless _tmp
+ self.pos = _save4
+ break
+ end
+ _save6 = self.pos
+ _tmp = match_string(")")
+ _tmp = _tmp ? nil : true
+ self.pos = _save6
+ unless _tmp
+ self.pos = _save4
+ break
+ end
+ _save7 = self.pos
+ _tmp = match_string(">")
+ _tmp = _tmp ? nil : true
+ self.pos = _save7
+ unless _tmp
+ self.pos = _save4
+ break
+ end
+ _tmp = apply(:_Nonspacechar)
+ unless _tmp
+ self.pos = _save4
+ end
+ break
+ end # end sequence
+
+ if _tmp
+ while true
+
+ _save8 = self.pos
+ while true # sequence
+ _save9 = self.pos
+ _tmp = match_string("(")
+ _tmp = _tmp ? nil : true
+ self.pos = _save9
+ unless _tmp
+ self.pos = _save8
+ break
+ end
+ _save10 = self.pos
+ _tmp = match_string(")")
+ _tmp = _tmp ? nil : true
+ self.pos = _save10
+ unless _tmp
+ self.pos = _save8
+ break
+ end
+ _save11 = self.pos
+ _tmp = match_string(">")
+ _tmp = _tmp ? nil : true
+ self.pos = _save11
+ unless _tmp
+ self.pos = _save8
+ break
+ end
+ _tmp = apply(:_Nonspacechar)
+ unless _tmp
+ self.pos = _save8
+ end
+ break
+ end # end sequence
+
+ break unless _tmp
+ end
+ _tmp = true
+ else
+ self.pos = _save3
+ end
+ break if _tmp
+ self.pos = _save2
+
+ _save12 = self.pos
+ while true # sequence
+ _tmp = match_string("(")
+ unless _tmp
+ self.pos = _save12
+ break
+ end
+ _tmp = apply(:_SourceContents)
+ unless _tmp
+ self.pos = _save12
+ break
+ end
+ _tmp = match_string(")")
+ unless _tmp
+ self.pos = _save12
+ end
+ break
+ end # end sequence
+
+ break if _tmp
+ self.pos = _save2
+ break
+ end # end choice
+
+ break unless _tmp
+ end
+ _tmp = true
+ break if _tmp
+ self.pos = _save
+ _tmp = match_string("")
+ break if _tmp
+ self.pos = _save
+ break
+ end # end choice
+
+ set_failed_rule :_SourceContents unless _tmp
+ return _tmp
+ end
+
+ # Title = (TitleSingle | TitleDouble | ""):a { a }
+ def _Title
+
+ _save = self.pos
+ while true # sequence
+
+ _save1 = self.pos
+ while true # choice
+ _tmp = apply(:_TitleSingle)
+ break if _tmp
+ self.pos = _save1
+ _tmp = apply(:_TitleDouble)
+ break if _tmp
+ self.pos = _save1
+ _tmp = match_string("")
+ break if _tmp
+ self.pos = _save1
+ break
+ end # end choice
+
+ a = @result
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ @result = begin; a ; end
+ _tmp = true
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_Title unless _tmp
+ return _tmp
+ end
+
+ # TitleSingle = "'" (!("'" @Sp (")" | @Newline)) .)* "'"
+ def _TitleSingle
+
+ _save = self.pos
+ while true # sequence
+ _tmp = match_string("'")
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ while true
+
+ _save2 = self.pos
+ while true # sequence
+ _save3 = self.pos
+
+ _save4 = self.pos
+ while true # sequence
+ _tmp = match_string("'")
+ unless _tmp
+ self.pos = _save4
+ break
+ end
+ _tmp = _Sp()
+ unless _tmp
+ self.pos = _save4
+ break
+ end
+
+ _save5 = self.pos
+ while true # choice
+ _tmp = match_string(")")
+ break if _tmp
+ self.pos = _save5
+ _tmp = _Newline()
+ break if _tmp
+ self.pos = _save5
+ break
+ end # end choice
+
+ unless _tmp
+ self.pos = _save4
+ end
+ break
+ end # end sequence
+
+ _tmp = _tmp ? nil : true
+ self.pos = _save3
+ unless _tmp
+ self.pos = _save2
+ break
+ end
+ _tmp = get_byte
+ unless _tmp
+ self.pos = _save2
+ end
+ break
+ end # end sequence
+
+ break unless _tmp
+ end
+ _tmp = true
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = match_string("'")
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_TitleSingle unless _tmp
+ return _tmp
+ end
+
+ # TitleDouble = "\"" (!("\"" @Sp (")" | @Newline)) .)* "\""
+ def _TitleDouble
+
+ _save = self.pos
+ while true # sequence
+ _tmp = match_string("\"")
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ while true
+
+ _save2 = self.pos
+ while true # sequence
+ _save3 = self.pos
+
+ _save4 = self.pos
+ while true # sequence
+ _tmp = match_string("\"")
+ unless _tmp
+ self.pos = _save4
+ break
+ end
+ _tmp = _Sp()
+ unless _tmp
+ self.pos = _save4
+ break
+ end
+
+ _save5 = self.pos
+ while true # choice
+ _tmp = match_string(")")
+ break if _tmp
+ self.pos = _save5
+ _tmp = _Newline()
+ break if _tmp
+ self.pos = _save5
+ break
+ end # end choice
+
+ unless _tmp
+ self.pos = _save4
+ end
+ break
+ end # end sequence
+
+ _tmp = _tmp ? nil : true
+ self.pos = _save3
+ unless _tmp
+ self.pos = _save2
+ break
+ end
+ _tmp = get_byte
+ unless _tmp
+ self.pos = _save2
+ end
+ break
+ end # end sequence
+
+ break unless _tmp
+ end
+ _tmp = true
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = match_string("\"")
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_TitleDouble unless _tmp
+ return _tmp
+ end
+
+ # AutoLink = (AutoLinkUrl | AutoLinkEmail)
+ def _AutoLink
+
+ _save = self.pos
+ while true # choice
+ _tmp = apply(:_AutoLinkUrl)
+ break if _tmp
+ self.pos = _save
+ _tmp = apply(:_AutoLinkEmail)
+ break if _tmp
+ self.pos = _save
+ break
+ end # end choice
+
+ set_failed_rule :_AutoLink unless _tmp
+ return _tmp
+ end
+
+ # AutoLinkUrl = "<" < /[A-Za-z]+/ "://" (!@Newline !">" .)+ > ">" { text }
+ def _AutoLinkUrl
+
+ _save = self.pos
+ while true # sequence
+ _tmp = match_string("<")
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _text_start = self.pos
+
+ _save1 = self.pos
+ while true # sequence
+ _tmp = scan(/\A(?-mix:[A-Za-z]+)/)
+ unless _tmp
+ self.pos = _save1
+ break
+ end
+ _tmp = match_string("://")
+ unless _tmp
+ self.pos = _save1
+ break
+ end
+ _save2 = self.pos
+
+ _save3 = self.pos
+ while true # sequence
+ _save4 = self.pos
+ _tmp = _Newline()
+ _tmp = _tmp ? nil : true
+ self.pos = _save4
+ unless _tmp
+ self.pos = _save3
+ break
+ end
+ _save5 = self.pos
+ _tmp = match_string(">")
+ _tmp = _tmp ? nil : true
+ self.pos = _save5
+ unless _tmp
+ self.pos = _save3
+ break
+ end
+ _tmp = get_byte
+ unless _tmp
+ self.pos = _save3
+ end
+ break
+ end # end sequence
+
+ if _tmp
+ while true
+
+ _save6 = self.pos
+ while true # sequence
+ _save7 = self.pos
+ _tmp = _Newline()
+ _tmp = _tmp ? nil : true
+ self.pos = _save7
+ unless _tmp
+ self.pos = _save6
+ break
+ end
+ _save8 = self.pos
+ _tmp = match_string(">")
+ _tmp = _tmp ? nil : true
+ self.pos = _save8
+ unless _tmp
+ self.pos = _save6
+ break
+ end
+ _tmp = get_byte
+ unless _tmp
+ self.pos = _save6
+ end
+ break
+ end # end sequence
+
+ break unless _tmp
+ end
+ _tmp = true
+ else
+ self.pos = _save2
+ end
+ unless _tmp
+ self.pos = _save1
+ end
+ break
+ end # end sequence
+
+ if _tmp
+ text = get_text(_text_start)
+ end
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = match_string(">")
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ @result = begin; text ; end
+ _tmp = true
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_AutoLinkUrl unless _tmp
+ return _tmp
+ end
+
+ # AutoLinkEmail = "<" "mailto:"? < /[\w+.\/!%~$-]+/i "@" (!@Newline !">" .)+ > ">" { "mailto:#{text}" }
+ def _AutoLinkEmail
+
+ _save = self.pos
+ while true # sequence
+ _tmp = match_string("<")
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _save1 = self.pos
+ _tmp = match_string("mailto:")
+ unless _tmp
+ _tmp = true
+ self.pos = _save1
+ end
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _text_start = self.pos
+
+ _save2 = self.pos
+ while true # sequence
+ _tmp = scan(/\A(?i-mx:[\w+.\/!%~$-]+)/)
+ unless _tmp
+ self.pos = _save2
+ break
+ end
+ _tmp = match_string("@")
+ unless _tmp
+ self.pos = _save2
+ break
+ end
+ _save3 = self.pos
+
+ _save4 = self.pos
+ while true # sequence
+ _save5 = self.pos
+ _tmp = _Newline()
+ _tmp = _tmp ? nil : true
+ self.pos = _save5
+ unless _tmp
+ self.pos = _save4
+ break
+ end
+ _save6 = self.pos
+ _tmp = match_string(">")
+ _tmp = _tmp ? nil : true
+ self.pos = _save6
+ unless _tmp
+ self.pos = _save4
+ break
+ end
+ _tmp = get_byte
+ unless _tmp
+ self.pos = _save4
+ end
+ break
+ end # end sequence
+
+ if _tmp
+ while true
+
+ _save7 = self.pos
+ while true # sequence
+ _save8 = self.pos
+ _tmp = _Newline()
+ _tmp = _tmp ? nil : true
+ self.pos = _save8
+ unless _tmp
+ self.pos = _save7
+ break
+ end
+ _save9 = self.pos
+ _tmp = match_string(">")
+ _tmp = _tmp ? nil : true
+ self.pos = _save9
+ unless _tmp
+ self.pos = _save7
+ break
+ end
+ _tmp = get_byte
+ unless _tmp
+ self.pos = _save7
+ end
+ break
+ end # end sequence
+
+ break unless _tmp
+ end
+ _tmp = true
+ else
+ self.pos = _save3
+ end
+ unless _tmp
+ self.pos = _save2
+ end
+ break
+ end # end sequence
+
+ if _tmp
+ text = get_text(_text_start)
+ end
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = match_string(">")
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ @result = begin; "mailto:#{text}" ; end
+ _tmp = true
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_AutoLinkEmail unless _tmp
+ return _tmp
+ end
+
+ # 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 = _NonindentSpace()
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _save1 = self.pos
+ _tmp = match_string("[]")
+ _tmp = _tmp ? nil : true
+ self.pos = _save1
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_Label)
+ label = @result
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = match_string(":")
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_Spnl)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_RefSrc)
+ link = @result
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_RefTitle)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _save2 = self.pos
+ _tmp = _BlankLine()
+ if _tmp
+ while true
+ _tmp = _BlankLine()
+ break unless _tmp
+ end
+ _tmp = true
+ else
+ self.pos = _save2
+ end
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ @result = begin; # TODO use title
+ reference label, link
+ nil
+ ; end
+ _tmp = true
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_Reference unless _tmp
+ return _tmp
+ end
+
+ # Label = "[" (!"^" &{ notes? } | &. &{ !notes? }) @StartList:a (!"]" Inline:l { a << l })* "]" { a.join.gsub(/\s+/, ' ') }
+ def _Label
+
+ _save = self.pos
+ while true # sequence
+ _tmp = match_string("[")
+ unless _tmp
+ self.pos = _save
+ break
+ end
+
+ _save1 = self.pos
+ while true # choice
+
+ _save2 = self.pos
+ while true # sequence
+ _save3 = self.pos
+ _tmp = match_string("^")
+ _tmp = _tmp ? nil : true
+ self.pos = _save3
+ unless _tmp
+ self.pos = _save2
+ break
+ end
+ _save4 = self.pos
+ _tmp = begin; notes? ; end
+ self.pos = _save4
+ unless _tmp
+ self.pos = _save2
+ end
+ break
+ end # end sequence
+
+ break if _tmp
+ self.pos = _save1
+
+ _save5 = self.pos
+ while true # sequence
+ _save6 = self.pos
+ _tmp = get_byte
+ self.pos = _save6
+ unless _tmp
+ self.pos = _save5
+ break
+ end
+ _save7 = self.pos
+ _tmp = begin; !notes? ; end
+ self.pos = _save7
+ unless _tmp
+ self.pos = _save5
+ end
+ break
+ end # end sequence
+
+ break if _tmp
+ self.pos = _save1
+ break
+ end # end choice
+
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = _StartList()
+ a = @result
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ while true
+
+ _save9 = self.pos
+ while true # sequence
+ _save10 = self.pos
+ _tmp = match_string("]")
+ _tmp = _tmp ? nil : true
+ self.pos = _save10
+ unless _tmp
+ self.pos = _save9
+ break
+ end
+ _tmp = apply(:_Inline)
+ l = @result
+ unless _tmp
+ self.pos = _save9
+ break
+ end
+ @result = begin; a << l ; end
+ _tmp = true
+ unless _tmp
+ self.pos = _save9
+ end
+ break
+ end # end sequence
+
+ break unless _tmp
+ end
+ _tmp = true
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = match_string("]")
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ @result = begin; a.join.gsub(/\s+/, ' ') ; end
+ _tmp = true
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_Label unless _tmp
+ return _tmp
+ end
+
+ # RefSrc = < Nonspacechar+ > { text }
+ def _RefSrc
+
+ _save = self.pos
+ while true # sequence
+ _text_start = self.pos
+ _save1 = self.pos
+ _tmp = apply(:_Nonspacechar)
+ if _tmp
+ while true
+ _tmp = apply(:_Nonspacechar)
+ break unless _tmp
+ end
+ _tmp = true
+ else
+ self.pos = _save1
+ end
+ if _tmp
+ text = get_text(_text_start)
+ end
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ @result = begin; text ; end
+ _tmp = true
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_RefSrc unless _tmp
+ return _tmp
+ end
+
+ # RefTitle = (RefTitleSingle | RefTitleDouble | RefTitleParens | EmptyTitle)
+ def _RefTitle
+
+ _save = self.pos
+ while true # choice
+ _tmp = apply(:_RefTitleSingle)
+ break if _tmp
+ self.pos = _save
+ _tmp = apply(:_RefTitleDouble)
+ break if _tmp
+ self.pos = _save
+ _tmp = apply(:_RefTitleParens)
+ break if _tmp
+ self.pos = _save
+ _tmp = apply(:_EmptyTitle)
+ break if _tmp
+ self.pos = _save
+ break
+ end # end choice
+
+ set_failed_rule :_RefTitle unless _tmp
+ return _tmp
+ end
+
+ # EmptyTitle = ""
+ def _EmptyTitle
+ _tmp = match_string("")
+ set_failed_rule :_EmptyTitle unless _tmp
+ return _tmp
+ end
+
+ # RefTitleSingle = Spnl "'" < (!("'" @Sp @Newline | @Newline) .)* > "'" { text }
+ def _RefTitleSingle
+
+ _save = self.pos
+ while true # sequence
+ _tmp = apply(:_Spnl)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = match_string("'")
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _text_start = self.pos
+ while true
+
+ _save2 = self.pos
+ while true # sequence
+ _save3 = self.pos
+
+ _save4 = self.pos
+ while true # choice
+
+ _save5 = self.pos
+ while true # sequence
+ _tmp = match_string("'")
+ unless _tmp
+ self.pos = _save5
+ break
+ end
+ _tmp = _Sp()
+ unless _tmp
+ self.pos = _save5
+ break
+ end
+ _tmp = _Newline()
+ unless _tmp
+ self.pos = _save5
+ end
+ break
+ end # end sequence
+
+ break if _tmp
+ self.pos = _save4
+ _tmp = _Newline()
+ break if _tmp
+ self.pos = _save4
+ break
+ end # end choice
+
+ _tmp = _tmp ? nil : true
+ self.pos = _save3
+ unless _tmp
+ self.pos = _save2
+ break
+ end
+ _tmp = get_byte
+ unless _tmp
+ self.pos = _save2
+ end
+ break
+ end # end sequence
+
+ break unless _tmp
+ end
+ _tmp = true
+ if _tmp
+ text = get_text(_text_start)
+ end
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = match_string("'")
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ @result = begin; text ; end
+ _tmp = true
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_RefTitleSingle unless _tmp
+ return _tmp
+ end
+
+ # RefTitleDouble = Spnl "\"" < (!("\"" @Sp @Newline | @Newline) .)* > "\"" { text }
+ def _RefTitleDouble
+
+ _save = self.pos
+ while true # sequence
+ _tmp = apply(:_Spnl)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = match_string("\"")
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _text_start = self.pos
+ while true
+
+ _save2 = self.pos
+ while true # sequence
+ _save3 = self.pos
+
+ _save4 = self.pos
+ while true # choice
+
+ _save5 = self.pos
+ while true # sequence
+ _tmp = match_string("\"")
+ unless _tmp
+ self.pos = _save5
+ break
+ end
+ _tmp = _Sp()
+ unless _tmp
+ self.pos = _save5
+ break
+ end
+ _tmp = _Newline()
+ unless _tmp
+ self.pos = _save5
+ end
+ break
+ end # end sequence
+
+ break if _tmp
+ self.pos = _save4
+ _tmp = _Newline()
+ break if _tmp
+ self.pos = _save4
+ break
+ end # end choice
+
+ _tmp = _tmp ? nil : true
+ self.pos = _save3
+ unless _tmp
+ self.pos = _save2
+ break
+ end
+ _tmp = get_byte
+ unless _tmp
+ self.pos = _save2
+ end
+ break
+ end # end sequence
+
+ break unless _tmp
+ end
+ _tmp = true
+ if _tmp
+ text = get_text(_text_start)
+ end
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = match_string("\"")
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ @result = begin; text ; end
+ _tmp = true
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_RefTitleDouble unless _tmp
+ return _tmp
+ end
+
+ # RefTitleParens = Spnl "(" < (!(")" @Sp @Newline | @Newline) .)* > ")" { text }
+ def _RefTitleParens
+
+ _save = self.pos
+ while true # sequence
+ _tmp = apply(:_Spnl)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = match_string("(")
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _text_start = self.pos
+ while true
+
+ _save2 = self.pos
+ while true # sequence
+ _save3 = self.pos
+
+ _save4 = self.pos
+ while true # choice
+
+ _save5 = self.pos
+ while true # sequence
+ _tmp = match_string(")")
+ unless _tmp
+ self.pos = _save5
+ break
+ end
+ _tmp = _Sp()
+ unless _tmp
+ self.pos = _save5
+ break
+ end
+ _tmp = _Newline()
+ unless _tmp
+ self.pos = _save5
+ end
+ break
+ end # end sequence
+
+ break if _tmp
+ self.pos = _save4
+ _tmp = _Newline()
+ break if _tmp
+ self.pos = _save4
+ break
+ end # end choice
+
+ _tmp = _tmp ? nil : true
+ self.pos = _save3
+ unless _tmp
+ self.pos = _save2
+ break
+ end
+ _tmp = get_byte
+ unless _tmp
+ self.pos = _save2
+ end
+ break
+ end # end sequence
+
+ break unless _tmp
+ end
+ _tmp = true
+ if _tmp
+ text = get_text(_text_start)
+ end
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = match_string(")")
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ @result = begin; text ; end
+ _tmp = true
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_RefTitleParens unless _tmp
+ return _tmp
+ end
+
+ # References = (Reference | SkipBlock)*
+ def _References
+ while true
+
+ _save1 = self.pos
+ while true # choice
+ _tmp = apply(:_Reference)
+ break if _tmp
+ self.pos = _save1
+ _tmp = apply(:_SkipBlock)
+ break if _tmp
+ self.pos = _save1
+ break
+ end # end choice
+
+ break unless _tmp
+ end
+ _tmp = true
+ set_failed_rule :_References unless _tmp
+ return _tmp
+ end
+
+ # Ticks1 = "`" !"`"
+ def _Ticks1
+
+ _save = self.pos
+ while true # sequence
+ _tmp = match_string("`")
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _save1 = self.pos
+ _tmp = match_string("`")
+ _tmp = _tmp ? nil : true
+ self.pos = _save1
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_Ticks1 unless _tmp
+ return _tmp
+ end
+
+ # Ticks2 = "``" !"`"
+ def _Ticks2
+
+ _save = self.pos
+ while true # sequence
+ _tmp = match_string("``")
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _save1 = self.pos
+ _tmp = match_string("`")
+ _tmp = _tmp ? nil : true
+ self.pos = _save1
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_Ticks2 unless _tmp
+ return _tmp
+ end
+
+ # Ticks3 = "```" !"`"
+ def _Ticks3
+
+ _save = self.pos
+ while true # sequence
+ _tmp = match_string("```")
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _save1 = self.pos
+ _tmp = match_string("`")
+ _tmp = _tmp ? nil : true
+ self.pos = _save1
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_Ticks3 unless _tmp
+ return _tmp
+ end
+
+ # Ticks4 = "````" !"`"
+ def _Ticks4
+
+ _save = self.pos
+ while true # sequence
+ _tmp = match_string("````")
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _save1 = self.pos
+ _tmp = match_string("`")
+ _tmp = _tmp ? nil : true
+ self.pos = _save1
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_Ticks4 unless _tmp
+ return _tmp
+ end
+
+ # Ticks5 = "`````" !"`"
+ def _Ticks5
+
+ _save = self.pos
+ while true # sequence
+ _tmp = match_string("`````")
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _save1 = self.pos
+ _tmp = match_string("`")
+ _tmp = _tmp ? nil : true
+ self.pos = _save1
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_Ticks5 unless _tmp
+ 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>" }
+ def _Code
+
+ _save = self.pos
+ while true # sequence
+
+ _save1 = self.pos
+ while true # choice
+
+ _save2 = self.pos
+ while true # sequence
+ _tmp = apply(:_Ticks1)
+ unless _tmp
+ self.pos = _save2
+ break
+ end
+ _tmp = _Sp()
+ unless _tmp
+ self.pos = _save2
+ break
+ end
+ _text_start = self.pos
+ _save3 = self.pos
+
+ _save4 = self.pos
+ while true # choice
+ _save5 = self.pos
+
+ _save6 = self.pos
+ while true # sequence
+ _save7 = self.pos
+ _tmp = match_string("`")
+ _tmp = _tmp ? nil : true
+ self.pos = _save7
+ unless _tmp
+ self.pos = _save6
+ break
+ end
+ _tmp = apply(:_Nonspacechar)
+ unless _tmp
+ self.pos = _save6
+ end
+ break
+ end # end sequence
+
+ if _tmp
+ while true
+
+ _save8 = self.pos
+ while true # sequence
+ _save9 = self.pos
+ _tmp = match_string("`")
+ _tmp = _tmp ? nil : true
+ self.pos = _save9
+ unless _tmp
+ self.pos = _save8
+ break
+ end
+ _tmp = apply(:_Nonspacechar)
+ unless _tmp
+ self.pos = _save8
+ end
+ break
+ end # end sequence
+
+ break unless _tmp
+ end
+ _tmp = true
+ else
+ self.pos = _save5
+ end
+ break if _tmp
+ self.pos = _save4
+
+ _save10 = self.pos
+ while true # sequence
+ _save11 = self.pos
+ _tmp = apply(:_Ticks1)
+ _tmp = _tmp ? nil : true
+ self.pos = _save11
+ unless _tmp
+ self.pos = _save10
+ break
+ end
+ _tmp = scan(/\A(?-mix:`+)/)
+ unless _tmp
+ self.pos = _save10
+ end
+ break
+ end # end sequence
+
+ break if _tmp
+ self.pos = _save4
+
+ _save12 = self.pos
+ while true # sequence
+ _save13 = self.pos
+
+ _save14 = self.pos
+ while true # sequence
+ _tmp = _Sp()
+ unless _tmp
+ self.pos = _save14
+ break
+ end
+ _tmp = apply(:_Ticks1)
+ unless _tmp
+ self.pos = _save14
+ end
+ break
+ end # end sequence
+
+ _tmp = _tmp ? nil : true
+ self.pos = _save13
+ unless _tmp
+ self.pos = _save12
+ break
+ end
+
+ _save15 = self.pos
+ while true # choice
+ _tmp = _Spacechar()
+ break if _tmp
+ self.pos = _save15
+
+ _save16 = self.pos
+ while true # sequence
+ _tmp = _Newline()
+ unless _tmp
+ self.pos = _save16
+ break
+ end
+ _save17 = self.pos
+ _tmp = _BlankLine()
+ _tmp = _tmp ? nil : true
+ self.pos = _save17
+ unless _tmp
+ self.pos = _save16
+ end
+ break
+ end # end sequence
+
+ break if _tmp
+ self.pos = _save15
+ break
+ end # end choice
+
+ unless _tmp
+ self.pos = _save12
+ end
+ break
+ end # end sequence
+
+ break if _tmp
+ self.pos = _save4
+ break
+ end # end choice
+
+ if _tmp
+ while true
+
+ _save18 = self.pos
+ while true # choice
+ _save19 = self.pos
+
+ _save20 = self.pos
+ while true # sequence
+ _save21 = self.pos
+ _tmp = match_string("`")
+ _tmp = _tmp ? nil : true
+ self.pos = _save21
+ unless _tmp
+ self.pos = _save20
+ break
+ end
+ _tmp = apply(:_Nonspacechar)
+ unless _tmp
+ self.pos = _save20
+ end
+ break
+ end # end sequence
+
+ if _tmp
+ while true
+
+ _save22 = self.pos
+ while true # sequence
+ _save23 = self.pos
+ _tmp = match_string("`")
+ _tmp = _tmp ? nil : true
+ self.pos = _save23
+ unless _tmp
+ self.pos = _save22
+ break
+ end
+ _tmp = apply(:_Nonspacechar)
+ unless _tmp
+ self.pos = _save22
+ end
+ break
+ end # end sequence
+
+ break unless _tmp
+ end
+ _tmp = true
+ else
+ self.pos = _save19
+ end
+ break if _tmp
+ self.pos = _save18
+
+ _save24 = self.pos
+ while true # sequence
+ _save25 = self.pos
+ _tmp = apply(:_Ticks1)
+ _tmp = _tmp ? nil : true
+ self.pos = _save25
+ unless _tmp
+ self.pos = _save24
+ break
+ end
+ _tmp = scan(/\A(?-mix:`+)/)
+ unless _tmp
+ self.pos = _save24
+ end
+ break
+ end # end sequence
+
+ break if _tmp
+ self.pos = _save18
+
+ _save26 = self.pos
+ while true # sequence
+ _save27 = self.pos
+
+ _save28 = self.pos
+ while true # sequence
+ _tmp = _Sp()
+ unless _tmp
+ self.pos = _save28
+ break
+ end
+ _tmp = apply(:_Ticks1)
+ unless _tmp
+ self.pos = _save28
+ end
+ break
+ end # end sequence
+
+ _tmp = _tmp ? nil : true
+ self.pos = _save27
+ unless _tmp
+ self.pos = _save26
+ break
+ end
+
+ _save29 = self.pos
+ while true # choice
+ _tmp = _Spacechar()
+ break if _tmp
+ self.pos = _save29
+
+ _save30 = self.pos
+ while true # sequence
+ _tmp = _Newline()
+ unless _tmp
+ self.pos = _save30
+ break
+ end
+ _save31 = self.pos
+ _tmp = _BlankLine()
+ _tmp = _tmp ? nil : true
+ self.pos = _save31
+ unless _tmp
+ self.pos = _save30
+ end
+ break
+ end # end sequence
+
+ break if _tmp
+ self.pos = _save29
+ break
+ end # end choice
+
+ unless _tmp
+ self.pos = _save26
+ end
+ break
+ end # end sequence
+
+ break if _tmp
+ self.pos = _save18
+ break
+ end # end choice
+
+ break unless _tmp
+ end
+ _tmp = true
+ else
+ self.pos = _save3
+ end
+ if _tmp
+ text = get_text(_text_start)
+ end
+ unless _tmp
+ self.pos = _save2
+ break
+ end
+ _tmp = _Sp()
+ unless _tmp
+ self.pos = _save2
+ break
+ end
+ _tmp = apply(:_Ticks1)
+ unless _tmp
+ self.pos = _save2
+ end
+ break
+ end # end sequence
+
+ break if _tmp
+ self.pos = _save1
+
+ _save32 = self.pos
+ while true # sequence
+ _tmp = apply(:_Ticks2)
+ unless _tmp
+ self.pos = _save32
+ break
+ end
+ _tmp = _Sp()
+ unless _tmp
+ self.pos = _save32
+ break
+ end
+ _text_start = self.pos
+ _save33 = self.pos
+
+ _save34 = self.pos
+ while true # choice
+ _save35 = self.pos
+
+ _save36 = self.pos
+ while true # sequence
+ _save37 = self.pos
+ _tmp = match_string("`")
+ _tmp = _tmp ? nil : true
+ self.pos = _save37
+ unless _tmp
+ self.pos = _save36
+ break
+ end
+ _tmp = apply(:_Nonspacechar)
+ unless _tmp
+ self.pos = _save36
+ end
+ break
+ end # end sequence
+
+ if _tmp
+ while true
+
+ _save38 = self.pos
+ while true # sequence
+ _save39 = self.pos
+ _tmp = match_string("`")
+ _tmp = _tmp ? nil : true
+ self.pos = _save39
+ unless _tmp
+ self.pos = _save38
+ break
+ end
+ _tmp = apply(:_Nonspacechar)
+ unless _tmp
+ self.pos = _save38
+ end
+ break
+ end # end sequence
+
+ break unless _tmp
+ end
+ _tmp = true
+ else
+ self.pos = _save35
+ end
+ break if _tmp
+ self.pos = _save34
+
+ _save40 = self.pos
+ while true # sequence
+ _save41 = self.pos
+ _tmp = apply(:_Ticks2)
+ _tmp = _tmp ? nil : true
+ self.pos = _save41
+ unless _tmp
+ self.pos = _save40
+ break
+ end
+ _tmp = scan(/\A(?-mix:`+)/)
+ unless _tmp
+ self.pos = _save40
+ end
+ break
+ end # end sequence
+
+ break if _tmp
+ self.pos = _save34
+
+ _save42 = self.pos
+ while true # sequence
+ _save43 = self.pos
+
+ _save44 = self.pos
+ while true # sequence
+ _tmp = _Sp()
+ unless _tmp
+ self.pos = _save44
+ break
+ end
+ _tmp = apply(:_Ticks2)
+ unless _tmp
+ self.pos = _save44
+ end
+ break
+ end # end sequence
+
+ _tmp = _tmp ? nil : true
+ self.pos = _save43
+ unless _tmp
+ self.pos = _save42
+ break
+ end
+
+ _save45 = self.pos
+ while true # choice
+ _tmp = _Spacechar()
+ break if _tmp
+ self.pos = _save45
+
+ _save46 = self.pos
+ while true # sequence
+ _tmp = _Newline()
+ unless _tmp
+ self.pos = _save46
+ break
+ end
+ _save47 = self.pos
+ _tmp = _BlankLine()
+ _tmp = _tmp ? nil : true
+ self.pos = _save47
+ unless _tmp
+ self.pos = _save46
+ end
+ break
+ end # end sequence
+
+ break if _tmp
+ self.pos = _save45
+ break
+ end # end choice
+
+ unless _tmp
+ self.pos = _save42
+ end
+ break
+ end # end sequence
+
+ break if _tmp
+ self.pos = _save34
+ break
+ end # end choice
+
+ if _tmp
+ while true
+
+ _save48 = self.pos
+ while true # choice
+ _save49 = self.pos
+
+ _save50 = self.pos
+ while true # sequence
+ _save51 = self.pos
+ _tmp = match_string("`")
+ _tmp = _tmp ? nil : true
+ self.pos = _save51
+ unless _tmp
+ self.pos = _save50
+ break
+ end
+ _tmp = apply(:_Nonspacechar)
+ unless _tmp
+ self.pos = _save50
+ end
+ break
+ end # end sequence
+
+ if _tmp
+ while true
+
+ _save52 = self.pos
+ while true # sequence
+ _save53 = self.pos
+ _tmp = match_string("`")
+ _tmp = _tmp ? nil : true
+ self.pos = _save53
+ unless _tmp
+ self.pos = _save52
+ break
+ end
+ _tmp = apply(:_Nonspacechar)
+ unless _tmp
+ self.pos = _save52
+ end
+ break
+ end # end sequence
+
+ break unless _tmp
+ end
+ _tmp = true
+ else
+ self.pos = _save49
+ end
+ break if _tmp
+ self.pos = _save48
+
+ _save54 = self.pos
+ while true # sequence
+ _save55 = self.pos
+ _tmp = apply(:_Ticks2)
+ _tmp = _tmp ? nil : true
+ self.pos = _save55
+ unless _tmp
+ self.pos = _save54
+ break
+ end
+ _tmp = scan(/\A(?-mix:`+)/)
+ unless _tmp
+ self.pos = _save54
+ end
+ break
+ end # end sequence
+
+ break if _tmp
+ self.pos = _save48
+
+ _save56 = self.pos
+ while true # sequence
+ _save57 = self.pos
+
+ _save58 = self.pos
+ while true # sequence
+ _tmp = _Sp()
+ unless _tmp
+ self.pos = _save58
+ break
+ end
+ _tmp = apply(:_Ticks2)
+ unless _tmp
+ self.pos = _save58
+ end
+ break
+ end # end sequence
+
+ _tmp = _tmp ? nil : true
+ self.pos = _save57
+ unless _tmp
+ self.pos = _save56
+ break
+ end
+
+ _save59 = self.pos
+ while true # choice
+ _tmp = _Spacechar()
+ break if _tmp
+ self.pos = _save59
+
+ _save60 = self.pos
+ while true # sequence
+ _tmp = _Newline()
+ unless _tmp
+ self.pos = _save60
+ break
+ end
+ _save61 = self.pos
+ _tmp = _BlankLine()
+ _tmp = _tmp ? nil : true
+ self.pos = _save61
+ unless _tmp
+ self.pos = _save60
+ end
+ break
+ end # end sequence
+
+ break if _tmp
+ self.pos = _save59
+ break
+ end # end choice
+
+ unless _tmp
+ self.pos = _save56
+ end
+ break
+ end # end sequence
+
+ break if _tmp
+ self.pos = _save48
+ break
+ end # end choice
+
+ break unless _tmp
+ end
+ _tmp = true
+ else
+ self.pos = _save33
+ end
+ if _tmp
+ text = get_text(_text_start)
+ end
+ unless _tmp
+ self.pos = _save32
+ break
+ end
+ _tmp = _Sp()
+ unless _tmp
+ self.pos = _save32
+ break
+ end
+ _tmp = apply(:_Ticks2)
+ unless _tmp
+ self.pos = _save32
+ end
+ break
+ end # end sequence
+
+ break if _tmp
+ self.pos = _save1
+
+ _save62 = self.pos
+ while true # sequence
+ _tmp = apply(:_Ticks3)
+ unless _tmp
+ self.pos = _save62
+ break
+ end
+ _tmp = _Sp()
+ unless _tmp
+ self.pos = _save62
+ break
+ end
+ _text_start = self.pos
+ _save63 = self.pos
+
+ _save64 = self.pos
+ while true # choice
+ _save65 = self.pos
+
+ _save66 = self.pos
+ while true # sequence
+ _save67 = self.pos
+ _tmp = match_string("`")
+ _tmp = _tmp ? nil : true
+ self.pos = _save67
+ unless _tmp
+ self.pos = _save66
+ break
+ end
+ _tmp = apply(:_Nonspacechar)
+ unless _tmp
+ self.pos = _save66
+ end
+ break
+ end # end sequence
+
+ if _tmp
+ while true
+
+ _save68 = self.pos
+ while true # sequence
+ _save69 = self.pos
+ _tmp = match_string("`")
+ _tmp = _tmp ? nil : true
+ self.pos = _save69
+ unless _tmp
+ self.pos = _save68
+ break
+ end
+ _tmp = apply(:_Nonspacechar)
+ unless _tmp
+ self.pos = _save68
+ end
+ break
+ end # end sequence
+
+ break unless _tmp
+ end
+ _tmp = true
+ else
+ self.pos = _save65
+ end
+ break if _tmp
+ self.pos = _save64
+
+ _save70 = self.pos
+ while true # sequence
+ _save71 = self.pos
+ _tmp = apply(:_Ticks3)
+ _tmp = _tmp ? nil : true
+ self.pos = _save71
+ unless _tmp
+ self.pos = _save70
+ break
+ end
+ _tmp = scan(/\A(?-mix:`+)/)
+ unless _tmp
+ self.pos = _save70
+ end
+ break
+ end # end sequence
+
+ break if _tmp
+ self.pos = _save64
+
+ _save72 = self.pos
+ while true # sequence
+ _save73 = self.pos
+
+ _save74 = self.pos
+ while true # sequence
+ _tmp = _Sp()
+ unless _tmp
+ self.pos = _save74
+ break
+ end
+ _tmp = apply(:_Ticks3)
+ unless _tmp
+ self.pos = _save74
+ end
+ break
+ end # end sequence
+
+ _tmp = _tmp ? nil : true
+ self.pos = _save73
+ unless _tmp
+ self.pos = _save72
+ break
+ end
+
+ _save75 = self.pos
+ while true # choice
+ _tmp = _Spacechar()
+ break if _tmp
+ self.pos = _save75
+
+ _save76 = self.pos
+ while true # sequence
+ _tmp = _Newline()
+ unless _tmp
+ self.pos = _save76
+ break
+ end
+ _save77 = self.pos
+ _tmp = _BlankLine()
+ _tmp = _tmp ? nil : true
+ self.pos = _save77
+ unless _tmp
+ self.pos = _save76
+ end
+ break
+ end # end sequence
+
+ break if _tmp
+ self.pos = _save75
+ break
+ end # end choice
+
+ unless _tmp
+ self.pos = _save72
+ end
+ break
+ end # end sequence
+
+ break if _tmp
+ self.pos = _save64
+ break
+ end # end choice
+
+ if _tmp
+ while true
+
+ _save78 = self.pos
+ while true # choice
+ _save79 = self.pos
+
+ _save80 = self.pos
+ while true # sequence
+ _save81 = self.pos
+ _tmp = match_string("`")
+ _tmp = _tmp ? nil : true
+ self.pos = _save81
+ unless _tmp
+ self.pos = _save80
+ break
+ end
+ _tmp = apply(:_Nonspacechar)
+ unless _tmp
+ self.pos = _save80
+ end
+ break
+ end # end sequence
+
+ if _tmp
+ while true
+
+ _save82 = self.pos
+ while true # sequence
+ _save83 = self.pos
+ _tmp = match_string("`")
+ _tmp = _tmp ? nil : true
+ self.pos = _save83
+ unless _tmp
+ self.pos = _save82
+ break
+ end
+ _tmp = apply(:_Nonspacechar)
+ unless _tmp
+ self.pos = _save82
+ end
+ break
+ end # end sequence
+
+ break unless _tmp
+ end
+ _tmp = true
+ else
+ self.pos = _save79
+ end
+ break if _tmp
+ self.pos = _save78
+
+ _save84 = self.pos
+ while true # sequence
+ _save85 = self.pos
+ _tmp = apply(:_Ticks3)
+ _tmp = _tmp ? nil : true
+ self.pos = _save85
+ unless _tmp
+ self.pos = _save84
+ break
+ end
+ _tmp = scan(/\A(?-mix:`+)/)
+ unless _tmp
+ self.pos = _save84
+ end
+ break
+ end # end sequence
+
+ break if _tmp
+ self.pos = _save78
+
+ _save86 = self.pos
+ while true # sequence
+ _save87 = self.pos
+
+ _save88 = self.pos
+ while true # sequence
+ _tmp = _Sp()
+ unless _tmp
+ self.pos = _save88
+ break
+ end
+ _tmp = apply(:_Ticks3)
+ unless _tmp
+ self.pos = _save88
+ end
+ break
+ end # end sequence
+
+ _tmp = _tmp ? nil : true
+ self.pos = _save87
+ unless _tmp
+ self.pos = _save86
+ break
+ end
+
+ _save89 = self.pos
+ while true # choice
+ _tmp = _Spacechar()
+ break if _tmp
+ self.pos = _save89
+
+ _save90 = self.pos
+ while true # sequence
+ _tmp = _Newline()
+ unless _tmp
+ self.pos = _save90
+ break
+ end
+ _save91 = self.pos
+ _tmp = _BlankLine()
+ _tmp = _tmp ? nil : true
+ self.pos = _save91
+ unless _tmp
+ self.pos = _save90
+ end
+ break
+ end # end sequence
+
+ break if _tmp
+ self.pos = _save89
+ break
+ end # end choice
+
+ unless _tmp
+ self.pos = _save86
+ end
+ break
+ end # end sequence
+
+ break if _tmp
+ self.pos = _save78
+ break
+ end # end choice
+
+ break unless _tmp
+ end
+ _tmp = true
+ else
+ self.pos = _save63
+ end
+ if _tmp
+ text = get_text(_text_start)
+ end
+ unless _tmp
+ self.pos = _save62
+ break
+ end
+ _tmp = _Sp()
+ unless _tmp
+ self.pos = _save62
+ break
+ end
+ _tmp = apply(:_Ticks3)
+ unless _tmp
+ self.pos = _save62
+ end
+ break
+ end # end sequence
+
+ break if _tmp
+ self.pos = _save1
+
+ _save92 = self.pos
+ while true # sequence
+ _tmp = apply(:_Ticks4)
+ unless _tmp
+ self.pos = _save92
+ break
+ end
+ _tmp = _Sp()
+ unless _tmp
+ self.pos = _save92
+ break
+ end
+ _text_start = self.pos
+ _save93 = self.pos
+
+ _save94 = self.pos
+ while true # choice
+ _save95 = self.pos
+
+ _save96 = self.pos
+ while true # sequence
+ _save97 = self.pos
+ _tmp = match_string("`")
+ _tmp = _tmp ? nil : true
+ self.pos = _save97
+ unless _tmp
+ self.pos = _save96
+ break
+ end
+ _tmp = apply(:_Nonspacechar)
+ unless _tmp
+ self.pos = _save96
+ end
+ break
+ end # end sequence
+
+ if _tmp
+ while true
+
+ _save98 = self.pos
+ while true # sequence
+ _save99 = self.pos
+ _tmp = match_string("`")
+ _tmp = _tmp ? nil : true
+ self.pos = _save99
+ unless _tmp
+ self.pos = _save98
+ break
+ end
+ _tmp = apply(:_Nonspacechar)
+ unless _tmp
+ self.pos = _save98
+ end
+ break
+ end # end sequence
+
+ break unless _tmp
+ end
+ _tmp = true
+ else
+ self.pos = _save95
+ end
+ break if _tmp
+ self.pos = _save94
+
+ _save100 = self.pos
+ while true # sequence
+ _save101 = self.pos
+ _tmp = apply(:_Ticks4)
+ _tmp = _tmp ? nil : true
+ self.pos = _save101
+ unless _tmp
+ self.pos = _save100
+ break
+ end
+ _tmp = scan(/\A(?-mix:`+)/)
+ unless _tmp
+ self.pos = _save100
+ end
+ break
+ end # end sequence
+
+ break if _tmp
+ self.pos = _save94
+
+ _save102 = self.pos
+ while true # sequence
+ _save103 = self.pos
+
+ _save104 = self.pos
+ while true # sequence
+ _tmp = _Sp()
+ unless _tmp
+ self.pos = _save104
+ break
+ end
+ _tmp = apply(:_Ticks4)
+ unless _tmp
+ self.pos = _save104
+ end
+ break
+ end # end sequence
+
+ _tmp = _tmp ? nil : true
+ self.pos = _save103
+ unless _tmp
+ self.pos = _save102
+ break
+ end
+
+ _save105 = self.pos
+ while true # choice
+ _tmp = _Spacechar()
+ break if _tmp
+ self.pos = _save105
+
+ _save106 = self.pos
+ while true # sequence
+ _tmp = _Newline()
+ unless _tmp
+ self.pos = _save106
+ break
+ end
+ _save107 = self.pos
+ _tmp = _BlankLine()
+ _tmp = _tmp ? nil : true
+ self.pos = _save107
+ unless _tmp
+ self.pos = _save106
+ end
+ break
+ end # end sequence
+
+ break if _tmp
+ self.pos = _save105
+ break
+ end # end choice
+
+ unless _tmp
+ self.pos = _save102
+ end
+ break
+ end # end sequence
+
+ break if _tmp
+ self.pos = _save94
+ break
+ end # end choice
+
+ if _tmp
+ while true
+
+ _save108 = self.pos
+ while true # choice
+ _save109 = self.pos
+
+ _save110 = self.pos
+ while true # sequence
+ _save111 = self.pos
+ _tmp = match_string("`")
+ _tmp = _tmp ? nil : true
+ self.pos = _save111
+ unless _tmp
+ self.pos = _save110
+ break
+ end
+ _tmp = apply(:_Nonspacechar)
+ unless _tmp
+ self.pos = _save110
+ end
+ break
+ end # end sequence
+
+ if _tmp
+ while true
+
+ _save112 = self.pos
+ while true # sequence
+ _save113 = self.pos
+ _tmp = match_string("`")
+ _tmp = _tmp ? nil : true
+ self.pos = _save113
+ unless _tmp
+ self.pos = _save112
+ break
+ end
+ _tmp = apply(:_Nonspacechar)
+ unless _tmp
+ self.pos = _save112
+ end
+ break
+ end # end sequence
+
+ break unless _tmp
+ end
+ _tmp = true
+ else
+ self.pos = _save109
+ end
+ break if _tmp
+ self.pos = _save108
+
+ _save114 = self.pos
+ while true # sequence
+ _save115 = self.pos
+ _tmp = apply(:_Ticks4)
+ _tmp = _tmp ? nil : true
+ self.pos = _save115
+ unless _tmp
+ self.pos = _save114
+ break
+ end
+ _tmp = scan(/\A(?-mix:`+)/)
+ unless _tmp
+ self.pos = _save114
+ end
+ break
+ end # end sequence
+
+ break if _tmp
+ self.pos = _save108
+
+ _save116 = self.pos
+ while true # sequence
+ _save117 = self.pos
+
+ _save118 = self.pos
+ while true # sequence
+ _tmp = _Sp()
+ unless _tmp
+ self.pos = _save118
+ break
+ end
+ _tmp = apply(:_Ticks4)
+ unless _tmp
+ self.pos = _save118
+ end
+ break
+ end # end sequence
+
+ _tmp = _tmp ? nil : true
+ self.pos = _save117
+ unless _tmp
+ self.pos = _save116
+ break
+ end
+
+ _save119 = self.pos
+ while true # choice
+ _tmp = _Spacechar()
+ break if _tmp
+ self.pos = _save119
+
+ _save120 = self.pos
+ while true # sequence
+ _tmp = _Newline()
+ unless _tmp
+ self.pos = _save120
+ break
+ end
+ _save121 = self.pos
+ _tmp = _BlankLine()
+ _tmp = _tmp ? nil : true
+ self.pos = _save121
+ unless _tmp
+ self.pos = _save120
+ end
+ break
+ end # end sequence
+
+ break if _tmp
+ self.pos = _save119
+ break
+ end # end choice
+
+ unless _tmp
+ self.pos = _save116
+ end
+ break
+ end # end sequence
+
+ break if _tmp
+ self.pos = _save108
+ break
+ end # end choice
+
+ break unless _tmp
+ end
+ _tmp = true
+ else
+ self.pos = _save93
+ end
+ if _tmp
+ text = get_text(_text_start)
+ end
+ unless _tmp
+ self.pos = _save92
+ break
+ end
+ _tmp = _Sp()
+ unless _tmp
+ self.pos = _save92
+ break
+ end
+ _tmp = apply(:_Ticks4)
+ unless _tmp
+ self.pos = _save92
+ end
+ break
+ end # end sequence
+
+ break if _tmp
+ self.pos = _save1
+
+ _save122 = self.pos
+ while true # sequence
+ _tmp = apply(:_Ticks5)
+ unless _tmp
+ self.pos = _save122
+ break
+ end
+ _tmp = _Sp()
+ unless _tmp
+ self.pos = _save122
+ break
+ end
+ _text_start = self.pos
+ _save123 = self.pos
+
+ _save124 = self.pos
+ while true # choice
+ _save125 = self.pos
+
+ _save126 = self.pos
+ while true # sequence
+ _save127 = self.pos
+ _tmp = match_string("`")
+ _tmp = _tmp ? nil : true
+ self.pos = _save127
+ unless _tmp
+ self.pos = _save126
+ break
+ end
+ _tmp = apply(:_Nonspacechar)
+ unless _tmp
+ self.pos = _save126
+ end
+ break
+ end # end sequence
+
+ if _tmp
+ while true
+
+ _save128 = self.pos
+ while true # sequence
+ _save129 = self.pos
+ _tmp = match_string("`")
+ _tmp = _tmp ? nil : true
+ self.pos = _save129
+ unless _tmp
+ self.pos = _save128
+ break
+ end
+ _tmp = apply(:_Nonspacechar)
+ unless _tmp
+ self.pos = _save128
+ end
+ break
+ end # end sequence
+
+ break unless _tmp
+ end
+ _tmp = true
+ else
+ self.pos = _save125
+ end
+ break if _tmp
+ self.pos = _save124
+
+ _save130 = self.pos
+ while true # sequence
+ _save131 = self.pos
+ _tmp = apply(:_Ticks5)
+ _tmp = _tmp ? nil : true
+ self.pos = _save131
+ unless _tmp
+ self.pos = _save130
+ break
+ end
+ _tmp = scan(/\A(?-mix:`+)/)
+ unless _tmp
+ self.pos = _save130
+ end
+ break
+ end # end sequence
+
+ break if _tmp
+ self.pos = _save124
+
+ _save132 = self.pos
+ while true # sequence
+ _save133 = self.pos
+
+ _save134 = self.pos
+ while true # sequence
+ _tmp = _Sp()
+ unless _tmp
+ self.pos = _save134
+ break
+ end
+ _tmp = apply(:_Ticks5)
+ unless _tmp
+ self.pos = _save134
+ end
+ break
+ end # end sequence
+
+ _tmp = _tmp ? nil : true
+ self.pos = _save133
+ unless _tmp
+ self.pos = _save132
+ break
+ end
+
+ _save135 = self.pos
+ while true # choice
+ _tmp = _Spacechar()
+ break if _tmp
+ self.pos = _save135
+
+ _save136 = self.pos
+ while true # sequence
+ _tmp = _Newline()
+ unless _tmp
+ self.pos = _save136
+ break
+ end
+ _save137 = self.pos
+ _tmp = _BlankLine()
+ _tmp = _tmp ? nil : true
+ self.pos = _save137
+ unless _tmp
+ self.pos = _save136
+ end
+ break
+ end # end sequence
+
+ break if _tmp
+ self.pos = _save135
+ break
+ end # end choice
+
+ unless _tmp
+ self.pos = _save132
+ end
+ break
+ end # end sequence
+
+ break if _tmp
+ self.pos = _save124
+ break
+ end # end choice
+
+ if _tmp
+ while true
+
+ _save138 = self.pos
+ while true # choice
+ _save139 = self.pos
+
+ _save140 = self.pos
+ while true # sequence
+ _save141 = self.pos
+ _tmp = match_string("`")
+ _tmp = _tmp ? nil : true
+ self.pos = _save141
+ unless _tmp
+ self.pos = _save140
+ break
+ end
+ _tmp = apply(:_Nonspacechar)
+ unless _tmp
+ self.pos = _save140
+ end
+ break
+ end # end sequence
+
+ if _tmp
+ while true
+
+ _save142 = self.pos
+ while true # sequence
+ _save143 = self.pos
+ _tmp = match_string("`")
+ _tmp = _tmp ? nil : true
+ self.pos = _save143
+ unless _tmp
+ self.pos = _save142
+ break
+ end
+ _tmp = apply(:_Nonspacechar)
+ unless _tmp
+ self.pos = _save142
+ end
+ break
+ end # end sequence
+
+ break unless _tmp
+ end
+ _tmp = true
+ else
+ self.pos = _save139
+ end
+ break if _tmp
+ self.pos = _save138
+
+ _save144 = self.pos
+ while true # sequence
+ _save145 = self.pos
+ _tmp = apply(:_Ticks5)
+ _tmp = _tmp ? nil : true
+ self.pos = _save145
+ unless _tmp
+ self.pos = _save144
+ break
+ end
+ _tmp = scan(/\A(?-mix:`+)/)
+ unless _tmp
+ self.pos = _save144
+ end
+ break
+ end # end sequence
+
+ break if _tmp
+ self.pos = _save138
+
+ _save146 = self.pos
+ while true # sequence
+ _save147 = self.pos
+
+ _save148 = self.pos
+ while true # sequence
+ _tmp = _Sp()
+ unless _tmp
+ self.pos = _save148
+ break
+ end
+ _tmp = apply(:_Ticks5)
+ unless _tmp
+ self.pos = _save148
+ end
+ break
+ end # end sequence
+
+ _tmp = _tmp ? nil : true
+ self.pos = _save147
+ unless _tmp
+ self.pos = _save146
+ break
+ end
+
+ _save149 = self.pos
+ while true # choice
+ _tmp = _Spacechar()
+ break if _tmp
+ self.pos = _save149
+
+ _save150 = self.pos
+ while true # sequence
+ _tmp = _Newline()
+ unless _tmp
+ self.pos = _save150
+ break
+ end
+ _save151 = self.pos
+ _tmp = _BlankLine()
+ _tmp = _tmp ? nil : true
+ self.pos = _save151
+ unless _tmp
+ self.pos = _save150
+ end
+ break
+ end # end sequence
+
+ break if _tmp
+ self.pos = _save149
+ break
+ end # end choice
+
+ unless _tmp
+ self.pos = _save146
+ end
+ break
+ end # end sequence
+
+ break if _tmp
+ self.pos = _save138
+ break
+ end # end choice
+
+ break unless _tmp
+ end
+ _tmp = true
+ else
+ self.pos = _save123
+ end
+ if _tmp
+ text = get_text(_text_start)
+ end
+ unless _tmp
+ self.pos = _save122
+ break
+ end
+ _tmp = _Sp()
+ unless _tmp
+ self.pos = _save122
+ break
+ end
+ _tmp = apply(:_Ticks5)
+ unless _tmp
+ self.pos = _save122
+ end
+ break
+ end # end sequence
+
+ break if _tmp
+ self.pos = _save1
+ break
+ end # end choice
+
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ @result = begin; "<code>#{text}</code>" ; end
+ _tmp = true
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_Code unless _tmp
+ return _tmp
+ end
+
+ # RawHtml = < (HtmlComment | HtmlBlockScript | HtmlTag) > { if html? then text else '' end }
+ def _RawHtml
+
+ _save = self.pos
+ while true # sequence
+ _text_start = self.pos
+
+ _save1 = self.pos
+ while true # choice
+ _tmp = apply(:_HtmlComment)
+ break if _tmp
+ self.pos = _save1
+ _tmp = apply(:_HtmlBlockScript)
+ break if _tmp
+ self.pos = _save1
+ _tmp = apply(:_HtmlTag)
+ break if _tmp
+ self.pos = _save1
+ break
+ end # end choice
+
+ if _tmp
+ text = get_text(_text_start)
+ end
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ @result = begin; if html? then text else '' end ; end
+ _tmp = true
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_RawHtml unless _tmp
+ return _tmp
+ end
+
+ # BlankLine = @Sp @Newline { "\n" }
+ def _BlankLine
+
+ _save = self.pos
+ while true # sequence
+ _tmp = _Sp()
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = _Newline()
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ @result = begin; "\n" ; end
+ _tmp = true
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_BlankLine unless _tmp
+ return _tmp
+ end
+
+ # Quoted = ("\"" (!"\"" .)* "\"" | "'" (!"'" .)* "'")
+ def _Quoted
+
+ _save = self.pos
+ while true # choice
+
+ _save1 = self.pos
+ while true # sequence
+ _tmp = match_string("\"")
+ unless _tmp
+ self.pos = _save1
+ break
+ end
+ while true
+
+ _save3 = self.pos
+ while true # sequence
+ _save4 = self.pos
+ _tmp = match_string("\"")
+ _tmp = _tmp ? nil : true
+ self.pos = _save4
+ unless _tmp
+ self.pos = _save3
+ break
+ end
+ _tmp = get_byte
+ unless _tmp
+ self.pos = _save3
+ end
+ break
+ end # end sequence
+
+ break unless _tmp
+ end
+ _tmp = true
+ unless _tmp
+ self.pos = _save1
+ break
+ end
+ _tmp = match_string("\"")
+ unless _tmp
+ self.pos = _save1
+ end
+ break
+ end # end sequence
+
+ break if _tmp
+ self.pos = _save
+
+ _save5 = self.pos
+ while true # sequence
+ _tmp = match_string("'")
+ unless _tmp
+ self.pos = _save5
+ break
+ end
+ while true
+
+ _save7 = self.pos
+ while true # sequence
+ _save8 = self.pos
+ _tmp = match_string("'")
+ _tmp = _tmp ? nil : true
+ self.pos = _save8
+ unless _tmp
+ self.pos = _save7
+ break
+ end
+ _tmp = get_byte
+ unless _tmp
+ self.pos = _save7
+ end
+ break
+ end # end sequence
+
+ break unless _tmp
+ end
+ _tmp = true
+ unless _tmp
+ self.pos = _save5
+ break
+ end
+ _tmp = match_string("'")
+ unless _tmp
+ self.pos = _save5
+ end
+ break
+ end # end sequence
+
+ break if _tmp
+ self.pos = _save
+ break
+ end # end choice
+
+ set_failed_rule :_Quoted unless _tmp
+ return _tmp
+ end
+
+ # HtmlAttribute = (AlphanumericAscii | "-")+ Spnl ("=" Spnl (Quoted | (!">" Nonspacechar)+))? Spnl
+ def _HtmlAttribute
+
+ _save = self.pos
+ while true # sequence
+ _save1 = self.pos
+
+ _save2 = self.pos
+ while true # choice
+ _tmp = apply(:_AlphanumericAscii)
+ break if _tmp
+ self.pos = _save2
+ _tmp = match_string("-")
+ break if _tmp
+ self.pos = _save2
+ break
+ end # end choice
+
+ if _tmp
+ while true
+
+ _save3 = self.pos
+ while true # choice
+ _tmp = apply(:_AlphanumericAscii)
+ break if _tmp
+ self.pos = _save3
+ _tmp = match_string("-")
+ break if _tmp
+ self.pos = _save3
+ break
+ end # end choice
+
+ break unless _tmp
+ end
+ _tmp = true
+ else
+ self.pos = _save1
+ end
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_Spnl)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _save4 = self.pos
+
+ _save5 = self.pos
+ while true # sequence
+ _tmp = match_string("=")
+ unless _tmp
+ self.pos = _save5
+ break
+ end
+ _tmp = apply(:_Spnl)
+ unless _tmp
+ self.pos = _save5
+ break
+ end
+
+ _save6 = self.pos
+ while true # choice
+ _tmp = apply(:_Quoted)
+ break if _tmp
+ self.pos = _save6
+ _save7 = self.pos
+
+ _save8 = self.pos
+ while true # sequence
+ _save9 = self.pos
+ _tmp = match_string(">")
+ _tmp = _tmp ? nil : true
+ self.pos = _save9
+ unless _tmp
+ self.pos = _save8
+ break
+ end
+ _tmp = apply(:_Nonspacechar)
+ unless _tmp
+ self.pos = _save8
+ end
+ break
+ end # end sequence
+
+ if _tmp
+ while true
+
+ _save10 = self.pos
+ while true # sequence
+ _save11 = self.pos
+ _tmp = match_string(">")
+ _tmp = _tmp ? nil : true
+ self.pos = _save11
+ unless _tmp
+ self.pos = _save10
+ break
+ end
+ _tmp = apply(:_Nonspacechar)
+ unless _tmp
+ self.pos = _save10
+ end
+ break
+ end # end sequence
+
+ break unless _tmp
+ end
+ _tmp = true
+ else
+ self.pos = _save7
+ end
+ break if _tmp
+ self.pos = _save6
+ break
+ end # end choice
+
+ unless _tmp
+ self.pos = _save5
+ end
+ break
+ end # end sequence
+
+ unless _tmp
+ _tmp = true
+ self.pos = _save4
+ end
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_Spnl)
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_HtmlAttribute unless _tmp
+ return _tmp
+ end
+
+ # HtmlComment = "<!--" (!"-->" .)* "-->"
+ def _HtmlComment
+
+ _save = self.pos
+ while true # sequence
+ _tmp = match_string("<!--")
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ while true
+
+ _save2 = self.pos
+ while true # sequence
+ _save3 = self.pos
+ _tmp = match_string("-->")
+ _tmp = _tmp ? nil : true
+ self.pos = _save3
+ unless _tmp
+ self.pos = _save2
+ break
+ end
+ _tmp = get_byte
+ unless _tmp
+ self.pos = _save2
+ end
+ break
+ end # end sequence
+
+ break unless _tmp
+ end
+ _tmp = true
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = match_string("-->")
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_HtmlComment unless _tmp
+ return _tmp
+ end
+
+ # HtmlTag = "<" Spnl "/"? AlphanumericAscii+ Spnl HtmlAttribute* "/"? Spnl ">"
+ def _HtmlTag
+
+ _save = self.pos
+ while true # sequence
+ _tmp = match_string("<")
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_Spnl)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _save1 = self.pos
+ _tmp = match_string("/")
+ unless _tmp
+ _tmp = true
+ self.pos = _save1
+ end
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _save2 = self.pos
+ _tmp = apply(:_AlphanumericAscii)
+ if _tmp
+ while true
+ _tmp = apply(:_AlphanumericAscii)
+ break unless _tmp
+ end
+ _tmp = true
+ else
+ self.pos = _save2
+ end
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_Spnl)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ while true
+ _tmp = apply(:_HtmlAttribute)
+ break unless _tmp
+ end
+ _tmp = true
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _save4 = self.pos
+ _tmp = match_string("/")
+ unless _tmp
+ _tmp = true
+ self.pos = _save4
+ end
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_Spnl)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = match_string(">")
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_HtmlTag unless _tmp
+ return _tmp
+ end
+
+ # Eof = !.
+ def _Eof
+ _save = self.pos
+ _tmp = get_byte
+ _tmp = _tmp ? nil : true
+ self.pos = _save
+ set_failed_rule :_Eof unless _tmp
+ return _tmp
+ end
+
+ # Nonspacechar = !@Spacechar !@Newline .
+ def _Nonspacechar
+
+ _save = self.pos
+ while true # sequence
+ _save1 = self.pos
+ _tmp = _Spacechar()
+ _tmp = _tmp ? nil : true
+ self.pos = _save1
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _save2 = self.pos
+ _tmp = _Newline()
+ _tmp = _tmp ? nil : true
+ self.pos = _save2
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = get_byte
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_Nonspacechar unless _tmp
+ return _tmp
+ end
+
+ # Sp = @Spacechar*
+ def _Sp
+ while true
+ _tmp = _Spacechar()
+ break unless _tmp
+ end
+ _tmp = true
+ set_failed_rule :_Sp unless _tmp
+ return _tmp
+ end
+
+ # Spnl = @Sp (@Newline @Sp)?
+ def _Spnl
+
+ _save = self.pos
+ while true # sequence
+ _tmp = _Sp()
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _save1 = self.pos
+
+ _save2 = self.pos
+ while true # sequence
+ _tmp = _Newline()
+ unless _tmp
+ self.pos = _save2
+ break
+ end
+ _tmp = _Sp()
+ unless _tmp
+ self.pos = _save2
+ end
+ break
+ end # end sequence
+
+ unless _tmp
+ _tmp = true
+ self.pos = _save1
+ end
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_Spnl unless _tmp
+ return _tmp
+ end
+
+ # SpecialChar = (/[*_`&\[\]()<!#\\'"]/ | @ExtendedSpecialChar)
+ def _SpecialChar
+
+ _save = self.pos
+ while true # choice
+ _tmp = scan(/\A(?-mix:[*_`&\[\]()<!#\\'"])/)
+ break if _tmp
+ self.pos = _save
+ _tmp = _ExtendedSpecialChar()
+ break if _tmp
+ self.pos = _save
+ break
+ end # end choice
+
+ set_failed_rule :_SpecialChar unless _tmp
+ return _tmp
+ end
+
+ # NormalChar = !(@SpecialChar | @Spacechar | @Newline) .
+ def _NormalChar
+
+ _save = self.pos
+ while true # sequence
+ _save1 = self.pos
+
+ _save2 = self.pos
+ while true # choice
+ _tmp = _SpecialChar()
+ break if _tmp
+ self.pos = _save2
+ _tmp = _Spacechar()
+ break if _tmp
+ self.pos = _save2
+ _tmp = _Newline()
+ break if _tmp
+ self.pos = _save2
+ break
+ end # end choice
+
+ _tmp = _tmp ? nil : true
+ self.pos = _save1
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = get_byte
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_NormalChar unless _tmp
+ return _tmp
+ end
+
+ # Digit = [0-9]
+ def _Digit
+ _save = self.pos
+ _tmp = get_byte
+ if _tmp
+ unless _tmp >= 48 and _tmp <= 57
+ self.pos = _save
+ _tmp = nil
+ end
+ end
+ set_failed_rule :_Digit unless _tmp
+ return _tmp
+ end
+
+ # Alphanumeric = %literals.Alphanumeric
+ def _Alphanumeric
+ _tmp = @_grammar_literals.external_invoke(self, :_Alphanumeric)
+ set_failed_rule :_Alphanumeric unless _tmp
+ return _tmp
+ end
+
+ # AlphanumericAscii = %literals.AlphanumericAscii
+ def _AlphanumericAscii
+ _tmp = @_grammar_literals.external_invoke(self, :_AlphanumericAscii)
+ set_failed_rule :_AlphanumericAscii unless _tmp
+ return _tmp
+ end
+
+ # BOM = %literals.BOM
+ def _BOM
+ _tmp = @_grammar_literals.external_invoke(self, :_BOM)
+ set_failed_rule :_BOM unless _tmp
+ return _tmp
+ end
+
+ # Newline = %literals.Newline
+ def _Newline
+ _tmp = @_grammar_literals.external_invoke(self, :_Newline)
+ set_failed_rule :_Newline unless _tmp
+ return _tmp
+ end
+
+ # NonAlphanumeric = %literals.NonAlphanumeric
+ def _NonAlphanumeric
+ _tmp = @_grammar_literals.external_invoke(self, :_NonAlphanumeric)
+ set_failed_rule :_NonAlphanumeric unless _tmp
+ return _tmp
+ end
+
+ # Spacechar = %literals.Spacechar
+ def _Spacechar
+ _tmp = @_grammar_literals.external_invoke(self, :_Spacechar)
+ set_failed_rule :_Spacechar unless _tmp
+ return _tmp
+ end
+
+ # HexEntity = /&#x/i < /[0-9a-fA-F]+/ > ";" { [text.to_i(16)].pack 'U' }
+ def _HexEntity
+
+ _save = self.pos
+ while true # sequence
+ _tmp = scan(/\A(?i-mx:&#x)/)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _text_start = self.pos
+ _tmp = scan(/\A(?-mix:[0-9a-fA-F]+)/)
+ if _tmp
+ text = get_text(_text_start)
+ end
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = match_string(";")
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ @result = begin; [text.to_i(16)].pack 'U' ; end
+ _tmp = true
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_HexEntity unless _tmp
+ return _tmp
+ end
+
+ # 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
+ _text_start = self.pos
+ _tmp = scan(/\A(?-mix:[0-9]+)/)
+ if _tmp
+ text = get_text(_text_start)
+ end
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = match_string(";")
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ @result = begin; [text.to_i].pack 'U' ; end
+ _tmp = true
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_DecEntity unless _tmp
+ return _tmp
+ end
+
+ # CharEntity = "&" < /[A-Za-z0-9]+/ > ";" { if entity = HTML_ENTITIES[text] then entity.pack 'U*' else "&#{text};" end }
+ def _CharEntity
+
+ _save = self.pos
+ while true # sequence
+ _tmp = match_string("&")
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _text_start = self.pos
+ _tmp = scan(/\A(?-mix:[A-Za-z0-9]+)/)
+ if _tmp
+ text = get_text(_text_start)
+ end
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = match_string(";")
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ @result = begin; if entity = HTML_ENTITIES[text] then
+ entity.pack 'U*'
+ else
+ "&#{text};"
+ end
+ ; end
+ _tmp = true
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_CharEntity unless _tmp
+ return _tmp
+ end
+
+ # NonindentSpace = / {0,3}/
+ def _NonindentSpace
+ _tmp = scan(/\A(?-mix: {0,3})/)
+ set_failed_rule :_NonindentSpace unless _tmp
+ return _tmp
+ end
+
+ # Indent = /\t| /
+ def _Indent
+ _tmp = scan(/\A(?-mix:\t| )/)
+ set_failed_rule :_Indent unless _tmp
+ return _tmp
+ end
+
+ # IndentedLine = Indent Line
+ def _IndentedLine
+
+ _save = self.pos
+ while true # sequence
+ _tmp = apply(:_Indent)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_Line)
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_IndentedLine unless _tmp
+ return _tmp
+ end
+
+ # OptionallyIndentedLine = Indent? Line
+ def _OptionallyIndentedLine
+
+ _save = self.pos
+ while true # sequence
+ _save1 = self.pos
+ _tmp = apply(:_Indent)
+ unless _tmp
+ _tmp = true
+ self.pos = _save1
+ end
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_Line)
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_OptionallyIndentedLine unless _tmp
+ return _tmp
+ end
+
+ # StartList = &. { [] }
+ def _StartList
+
+ _save = self.pos
+ while true # sequence
+ _save1 = self.pos
+ _tmp = get_byte
+ self.pos = _save1
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ @result = begin; [] ; end
+ _tmp = true
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_StartList unless _tmp
+ return _tmp
+ end
+
+ # Line = @RawLine:a { a }
+ def _Line
+
+ _save = self.pos
+ while true # sequence
+ _tmp = _RawLine()
+ a = @result
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ @result = begin; a ; end
+ _tmp = true
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_Line unless _tmp
+ return _tmp
+ end
+
+ # RawLine = (< (!"\r" !"\n" .)* @Newline > | < .+ > @Eof) { text }
+ def _RawLine
+
+ _save = self.pos
+ while true # sequence
+
+ _save1 = self.pos
+ while true # choice
+ _text_start = self.pos
+
+ _save2 = self.pos
+ while true # sequence
+ while true
+
+ _save4 = self.pos
+ while true # sequence
+ _save5 = self.pos
+ _tmp = match_string("\r")
+ _tmp = _tmp ? nil : true
+ self.pos = _save5
+ unless _tmp
+ self.pos = _save4
+ break
+ end
+ _save6 = self.pos
+ _tmp = match_string("\n")
+ _tmp = _tmp ? nil : true
+ self.pos = _save6
+ unless _tmp
+ self.pos = _save4
+ break
+ end
+ _tmp = get_byte
+ unless _tmp
+ self.pos = _save4
+ end
+ break
+ end # end sequence
+
+ break unless _tmp
+ end
+ _tmp = true
+ unless _tmp
+ self.pos = _save2
+ break
+ end
+ _tmp = _Newline()
+ unless _tmp
+ self.pos = _save2
+ end
+ break
+ end # end sequence
+
+ if _tmp
+ text = get_text(_text_start)
+ end
+ break if _tmp
+ self.pos = _save1
+
+ _save7 = self.pos
+ while true # sequence
+ _text_start = self.pos
+ _save8 = self.pos
+ _tmp = get_byte
+ if _tmp
+ while true
+ _tmp = get_byte
+ break unless _tmp
+ end
+ _tmp = true
+ else
+ self.pos = _save8
+ end
+ if _tmp
+ text = get_text(_text_start)
+ end
+ unless _tmp
+ self.pos = _save7
+ break
+ end
+ _tmp = _Eof()
+ unless _tmp
+ self.pos = _save7
+ end
+ break
+ end # end sequence
+
+ break if _tmp
+ self.pos = _save1
+ break
+ end # end choice
+
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ @result = begin; text ; end
+ _tmp = true
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_RawLine unless _tmp
+ return _tmp
+ end
+
+ # SkipBlock = (HtmlBlock | (!"#" !SetextBottom1 !SetextBottom2 !@BlankLine @RawLine)+ @BlankLine* | @BlankLine+ | @RawLine)
+ def _SkipBlock
+
+ _save = self.pos
+ while true # choice
+ _tmp = apply(:_HtmlBlock)
+ break if _tmp
+ self.pos = _save
+
+ _save1 = self.pos
+ while true # sequence
+ _save2 = self.pos
+
+ _save3 = self.pos
+ while true # sequence
+ _save4 = self.pos
+ _tmp = match_string("#")
+ _tmp = _tmp ? nil : true
+ self.pos = _save4
+ unless _tmp
+ self.pos = _save3
+ break
+ end
+ _save5 = self.pos
+ _tmp = apply(:_SetextBottom1)
+ _tmp = _tmp ? nil : true
+ self.pos = _save5
+ unless _tmp
+ self.pos = _save3
+ break
+ end
+ _save6 = self.pos
+ _tmp = apply(:_SetextBottom2)
+ _tmp = _tmp ? nil : true
+ self.pos = _save6
+ unless _tmp
+ self.pos = _save3
+ break
+ end
+ _save7 = self.pos
+ _tmp = _BlankLine()
+ _tmp = _tmp ? nil : true
+ self.pos = _save7
+ unless _tmp
+ self.pos = _save3
+ break
+ end
+ _tmp = _RawLine()
+ unless _tmp
+ self.pos = _save3
+ end
+ break
+ end # end sequence
+
+ if _tmp
+ while true
+
+ _save8 = self.pos
+ while true # sequence
+ _save9 = self.pos
+ _tmp = match_string("#")
+ _tmp = _tmp ? nil : true
+ self.pos = _save9
+ unless _tmp
+ self.pos = _save8
+ break
+ end
+ _save10 = self.pos
+ _tmp = apply(:_SetextBottom1)
+ _tmp = _tmp ? nil : true
+ self.pos = _save10
+ unless _tmp
+ self.pos = _save8
+ break
+ end
+ _save11 = self.pos
+ _tmp = apply(:_SetextBottom2)
+ _tmp = _tmp ? nil : true
+ self.pos = _save11
+ unless _tmp
+ self.pos = _save8
+ break
+ end
+ _save12 = self.pos
+ _tmp = _BlankLine()
+ _tmp = _tmp ? nil : true
+ self.pos = _save12
+ unless _tmp
+ self.pos = _save8
+ break
+ end
+ _tmp = _RawLine()
+ unless _tmp
+ self.pos = _save8
+ end
+ break
+ end # end sequence
+
+ break unless _tmp
+ end
+ _tmp = true
+ else
+ self.pos = _save2
+ end
+ unless _tmp
+ self.pos = _save1
+ break
+ end
+ while true
+ _tmp = _BlankLine()
+ break unless _tmp
+ end
+ _tmp = true
+ unless _tmp
+ self.pos = _save1
+ end
+ break
+ end # end sequence
+
+ break if _tmp
+ self.pos = _save
+ _save14 = self.pos
+ _tmp = _BlankLine()
+ if _tmp
+ while true
+ _tmp = _BlankLine()
+ break unless _tmp
+ end
+ _tmp = true
+ else
+ self.pos = _save14
+ end
+ break if _tmp
+ self.pos = _save
+ _tmp = _RawLine()
+ break if _tmp
+ self.pos = _save
+ break
+ end # end choice
+
+ set_failed_rule :_SkipBlock unless _tmp
+ return _tmp
+ end
+
+ # ExtendedSpecialChar = &{ notes? } "^"
+ def _ExtendedSpecialChar
+
+ _save = self.pos
+ while true # sequence
+ _save1 = self.pos
+ _tmp = begin; notes? ; end
+ self.pos = _save1
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = match_string("^")
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_ExtendedSpecialChar unless _tmp
+ return _tmp
+ end
+
+ # NoteReference = &{ notes? } RawNoteReference:ref { note_for ref }
+ def _NoteReference
+
+ _save = self.pos
+ while true # sequence
+ _save1 = self.pos
+ _tmp = begin; notes? ; end
+ self.pos = _save1
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_RawNoteReference)
+ ref = @result
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ @result = begin; note_for ref ; end
+ _tmp = true
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_NoteReference unless _tmp
+ return _tmp
+ end
+
+ # RawNoteReference = "[^" < (!@Newline !"]" .)+ > "]" { text }
+ def _RawNoteReference
+
+ _save = self.pos
+ while true # sequence
+ _tmp = match_string("[^")
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _text_start = self.pos
+ _save1 = self.pos
+
+ _save2 = self.pos
+ while true # sequence
+ _save3 = self.pos
+ _tmp = _Newline()
+ _tmp = _tmp ? nil : true
+ self.pos = _save3
+ unless _tmp
+ self.pos = _save2
+ break
+ end
+ _save4 = self.pos
+ _tmp = match_string("]")
+ _tmp = _tmp ? nil : true
+ self.pos = _save4
+ unless _tmp
+ self.pos = _save2
+ break
+ end
+ _tmp = get_byte
+ unless _tmp
+ self.pos = _save2
+ end
+ break
+ end # end sequence
+
+ if _tmp
+ while true
+
+ _save5 = self.pos
+ while true # sequence
+ _save6 = self.pos
+ _tmp = _Newline()
+ _tmp = _tmp ? nil : true
+ self.pos = _save6
+ unless _tmp
+ self.pos = _save5
+ break
+ end
+ _save7 = self.pos
+ _tmp = match_string("]")
+ _tmp = _tmp ? nil : true
+ self.pos = _save7
+ unless _tmp
+ self.pos = _save5
+ break
+ end
+ _tmp = get_byte
+ unless _tmp
+ self.pos = _save5
+ end
+ break
+ end # end sequence
+
+ break unless _tmp
+ end
+ _tmp = true
+ else
+ self.pos = _save1
+ end
+ if _tmp
+ text = get_text(_text_start)
+ end
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = match_string("]")
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ @result = begin; text ; end
+ _tmp = true
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_RawNoteReference unless _tmp
+ return _tmp
+ end
+
+ # 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
+ while true # sequence
+ _save1 = self.pos
+ _tmp = begin; notes? ; end
+ self.pos = _save1
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = _NonindentSpace()
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_RawNoteReference)
+ ref = @result
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = match_string(":")
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = _Sp()
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _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
+ end
+ while true
+
+ _save3 = self.pos
+ while true # sequence
+ _save4 = self.pos
+ _tmp = apply(:_Indent)
+ self.pos = _save4
+ unless _tmp
+ self.pos = _save3
+ break
+ end
+ _tmp = apply(:_RawNoteBlock)
+ i = @result
+ unless _tmp
+ self.pos = _save3
+ break
+ end
+ @result = begin; a.concat i ; end
+ _tmp = true
+ unless _tmp
+ self.pos = _save3
+ end
+ break
+ end # end sequence
+
+ break unless _tmp
+ end
+ _tmp = true
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ @result = begin; @footnotes[ref] = paragraph a
+
+ nil
+ ; end
+ _tmp = true
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_Note unless _tmp
+ return _tmp
+ end
+
+ # 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
+ while true # sequence
+ _save1 = self.pos
+ _tmp = begin; notes? ; end
+ self.pos = _save1
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = match_string("^[")
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = _StartList()
+ a = @result
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _save2 = self.pos
+
+ _save3 = self.pos
+ while true # sequence
+ _save4 = self.pos
+ _tmp = match_string("]")
+ _tmp = _tmp ? nil : true
+ self.pos = _save4
+ unless _tmp
+ self.pos = _save3
+ break
+ end
+ _tmp = apply(:_Inline)
+ l = @result
+ unless _tmp
+ self.pos = _save3
+ break
+ end
+ @result = begin; a << l ; end
+ _tmp = true
+ unless _tmp
+ self.pos = _save3
+ end
+ break
+ end # end sequence
+
+ if _tmp
+ while true
+
+ _save5 = self.pos
+ while true # sequence
+ _save6 = self.pos
+ _tmp = match_string("]")
+ _tmp = _tmp ? nil : true
+ self.pos = _save6
+ unless _tmp
+ self.pos = _save5
+ break
+ end
+ _tmp = apply(:_Inline)
+ l = @result
+ unless _tmp
+ self.pos = _save5
+ break
+ end
+ @result = begin; a << l ; end
+ _tmp = true
+ unless _tmp
+ self.pos = _save5
+ end
+ break
+ end # end sequence
+
+ break unless _tmp
+ end
+ _tmp = true
+ else
+ self.pos = _save2
+ end
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = match_string("]")
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ @result = begin;
+ ref = [:inline, @note_order.length]
+ @footnotes[ref] = paragraph a
+
+ note_for ref
+ ; end
+ _tmp = true
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_InlineNote unless _tmp
+ return _tmp
+ end
+
+ # Notes = (Note | SkipBlock)*
+ def _Notes
+ while true
+
+ _save1 = self.pos
+ while true # choice
+ _tmp = apply(:_Note)
+ break if _tmp
+ self.pos = _save1
+ _tmp = apply(:_SkipBlock)
+ break if _tmp
+ self.pos = _save1
+ break
+ end # end choice
+
+ break unless _tmp
+ end
+ _tmp = true
+ set_failed_rule :_Notes unless _tmp
+ return _tmp
+ end
+
+ # RawNoteBlock = @StartList:a (!@BlankLine OptionallyIndentedLine:l { a << l })+ < @BlankLine* > { a << text } { a }
+ def _RawNoteBlock
+
+ _save = self.pos
+ while true # sequence
+ _tmp = _StartList()
+ a = @result
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _save1 = self.pos
+
+ _save2 = self.pos
+ while true # sequence
+ _save3 = self.pos
+ _tmp = _BlankLine()
+ _tmp = _tmp ? nil : true
+ self.pos = _save3
+ unless _tmp
+ self.pos = _save2
+ break
+ end
+ _tmp = apply(:_OptionallyIndentedLine)
+ l = @result
+ unless _tmp
+ self.pos = _save2
+ break
+ end
+ @result = begin; a << l ; end
+ _tmp = true
+ unless _tmp
+ self.pos = _save2
+ end
+ break
+ end # end sequence
+
+ if _tmp
+ while true
+
+ _save4 = self.pos
+ while true # sequence
+ _save5 = self.pos
+ _tmp = _BlankLine()
+ _tmp = _tmp ? nil : true
+ self.pos = _save5
+ unless _tmp
+ self.pos = _save4
+ break
+ end
+ _tmp = apply(:_OptionallyIndentedLine)
+ l = @result
+ unless _tmp
+ self.pos = _save4
+ break
+ end
+ @result = begin; a << l ; end
+ _tmp = true
+ unless _tmp
+ self.pos = _save4
+ end
+ break
+ end # end sequence
+
+ break unless _tmp
+ end
+ _tmp = true
+ else
+ self.pos = _save1
+ end
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _text_start = self.pos
+ while true
+ _tmp = _BlankLine()
+ break unless _tmp
+ end
+ _tmp = true
+ if _tmp
+ text = get_text(_text_start)
+ end
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ @result = begin; a << text ; end
+ _tmp = true
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ @result = begin; a ; end
+ _tmp = true
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_RawNoteBlock unless _tmp
+ 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 }
+ def _CodeFence
+
+ _save = self.pos
+ while true # sequence
+ _save1 = self.pos
+ _tmp = begin; github? ; end
+ self.pos = _save1
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_Ticks3)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _save2 = self.pos
+
+ _save3 = self.pos
+ while true # sequence
+ _tmp = _Sp()
+ unless _tmp
+ self.pos = _save3
+ break
+ end
+ _tmp = apply(:_StrChunk)
+ format = @result
+ unless _tmp
+ self.pos = _save3
+ end
+ break
+ end # end sequence
+
+ unless _tmp
+ _tmp = true
+ self.pos = _save2
+ end
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_Spnl)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _text_start = self.pos
+ _save4 = self.pos
+
+ _save5 = self.pos
+ while true # choice
+ _save6 = self.pos
+
+ _save7 = self.pos
+ while true # sequence
+ _save8 = self.pos
+ _tmp = match_string("`")
+ _tmp = _tmp ? nil : true
+ self.pos = _save8
+ unless _tmp
+ self.pos = _save7
+ break
+ end
+ _tmp = apply(:_Nonspacechar)
+ unless _tmp
+ self.pos = _save7
+ end
+ break
+ end # end sequence
+
+ if _tmp
+ while true
+
+ _save9 = self.pos
+ while true # sequence
+ _save10 = self.pos
+ _tmp = match_string("`")
+ _tmp = _tmp ? nil : true
+ self.pos = _save10
+ unless _tmp
+ self.pos = _save9
+ break
+ end
+ _tmp = apply(:_Nonspacechar)
+ unless _tmp
+ self.pos = _save9
+ end
+ break
+ end # end sequence
+
+ break unless _tmp
+ end
+ _tmp = true
+ else
+ self.pos = _save6
+ end
+ break if _tmp
+ self.pos = _save5
+
+ _save11 = self.pos
+ while true # sequence
+ _save12 = self.pos
+ _tmp = apply(:_Ticks3)
+ _tmp = _tmp ? nil : true
+ self.pos = _save12
+ unless _tmp
+ self.pos = _save11
+ break
+ end
+ _tmp = scan(/\A(?-mix:`+)/)
+ unless _tmp
+ self.pos = _save11
+ end
+ break
+ end # end sequence
+
+ break if _tmp
+ self.pos = _save5
+ _tmp = apply(:_Spacechar)
+ break if _tmp
+ self.pos = _save5
+ _tmp = _Newline()
+ break if _tmp
+ self.pos = _save5
+ break
+ end # end choice
+
+ if _tmp
+ while true
+
+ _save13 = self.pos
+ while true # choice
+ _save14 = self.pos
+
+ _save15 = self.pos
+ while true # sequence
+ _save16 = self.pos
+ _tmp = match_string("`")
+ _tmp = _tmp ? nil : true
+ self.pos = _save16
+ unless _tmp
+ self.pos = _save15
+ break
+ end
+ _tmp = apply(:_Nonspacechar)
+ unless _tmp
+ self.pos = _save15
+ end
+ break
+ end # end sequence
+
+ if _tmp
+ while true
+
+ _save17 = self.pos
+ while true # sequence
+ _save18 = self.pos
+ _tmp = match_string("`")
+ _tmp = _tmp ? nil : true
+ self.pos = _save18
+ unless _tmp
+ self.pos = _save17
+ break
+ end
+ _tmp = apply(:_Nonspacechar)
+ unless _tmp
+ self.pos = _save17
+ end
+ break
+ end # end sequence
+
+ break unless _tmp
+ end
+ _tmp = true
+ else
+ self.pos = _save14
+ end
+ break if _tmp
+ self.pos = _save13
+
+ _save19 = self.pos
+ while true # sequence
+ _save20 = self.pos
+ _tmp = apply(:_Ticks3)
+ _tmp = _tmp ? nil : true
+ self.pos = _save20
+ unless _tmp
+ self.pos = _save19
+ break
+ end
+ _tmp = scan(/\A(?-mix:`+)/)
+ unless _tmp
+ self.pos = _save19
+ end
+ break
+ end # end sequence
+
+ break if _tmp
+ self.pos = _save13
+ _tmp = apply(:_Spacechar)
+ break if _tmp
+ self.pos = _save13
+ _tmp = _Newline()
+ break if _tmp
+ self.pos = _save13
+ break
+ end # end choice
+
+ break unless _tmp
+ end
+ _tmp = true
+ else
+ self.pos = _save4
+ end
+ if _tmp
+ text = get_text(_text_start)
+ end
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_Ticks3)
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = _Sp()
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ while true
+ _tmp = _Newline()
+ break unless _tmp
+ end
+ _tmp = true
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ @result = begin; verbatim = RDoc::Markup::Verbatim.new text
+ verbatim.format = format.intern if format
+ verbatim
+ ; end
+ _tmp = true
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_CodeFence unless _tmp
+ return _tmp
+ end
+
+ # DefinitionList = &{ definition_lists? } DefinitionListItem+:list { RDoc::Markup::List.new :NOTE, *list.flatten }
+ def _DefinitionList
+
+ _save = self.pos
+ while true # sequence
+ _save1 = self.pos
+ _tmp = begin; definition_lists? ; end
+ self.pos = _save1
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _save2 = self.pos
+ _ary = []
+ _tmp = apply(:_DefinitionListItem)
+ if _tmp
+ _ary << @result
+ while true
+ _tmp = apply(:_DefinitionListItem)
+ _ary << @result if _tmp
+ break unless _tmp
+ end
+ _tmp = true
+ @result = _ary
+ else
+ self.pos = _save2
+ end
+ list = @result
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ @result = begin; RDoc::Markup::List.new :NOTE, *list.flatten ; end
+ _tmp = true
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_DefinitionList unless _tmp
+ return _tmp
+ end
+
+ # 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 }
+ def _DefinitionListItem
+
+ _save = self.pos
+ while true # sequence
+ _save1 = self.pos
+ _ary = []
+ _tmp = apply(:_DefinitionListLabel)
+ if _tmp
+ _ary << @result
+ while true
+ _tmp = apply(:_DefinitionListLabel)
+ _ary << @result if _tmp
+ break unless _tmp
+ end
+ _tmp = true
+ @result = _ary
+ else
+ self.pos = _save1
+ end
+ label = @result
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _save2 = self.pos
+ _ary = []
+ _tmp = apply(:_DefinitionListDefinition)
+ if _tmp
+ _ary << @result
+ while true
+ _tmp = apply(:_DefinitionListDefinition)
+ _ary << @result if _tmp
+ break unless _tmp
+ end
+ _tmp = true
+ @result = _ary
+ else
+ self.pos = _save2
+ end
+ defns = @result
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ @result = begin; 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
+ ; end
+ _tmp = true
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_DefinitionListItem unless _tmp
+ return _tmp
+ end
+
+ # DefinitionListLabel = StrChunk:label @Sp @Newline { label }
+ def _DefinitionListLabel
+
+ _save = self.pos
+ while true # sequence
+ _tmp = apply(:_StrChunk)
+ label = @result
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = _Sp()
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = _Newline()
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ @result = begin; label ; end
+ _tmp = true
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_DefinitionListLabel unless _tmp
+ return _tmp
+ end
+
+ # DefinitionListDefinition = @NonindentSpace ":" @Space Inlines:a @BlankLine+ { paragraph a }
+ def _DefinitionListDefinition
+
+ _save = self.pos
+ while true # sequence
+ _tmp = _NonindentSpace()
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = match_string(":")
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = _Space()
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _tmp = apply(:_Inlines)
+ a = @result
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ _save1 = self.pos
+ _tmp = _BlankLine()
+ if _tmp
+ while true
+ _tmp = _BlankLine()
+ break unless _tmp
+ end
+ _tmp = true
+ else
+ self.pos = _save1
+ end
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ @result = begin; paragraph a ; end
+ _tmp = true
+ unless _tmp
+ self.pos = _save
+ end
+ break
+ end # end sequence
+
+ set_failed_rule :_DefinitionListDefinition unless _tmp
+ return _tmp
+ end
+
+ 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[:_Plain] = rule_info("Plain", "Inlines:a { paragraph a }")
+ 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", "/={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[:_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[:_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[:_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[:_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")
+ Rules[:_HtmlBlockOpenBlockquote] = rule_info("HtmlBlockOpenBlockquote", "\"<\" Spnl (\"blockquote\" | \"BLOCKQUOTE\") Spnl HtmlAttribute* \">\"")
+ Rules[:_HtmlBlockCloseBlockquote] = rule_info("HtmlBlockCloseBlockquote", "\"<\" Spnl \"/\" (\"blockquote\" | \"BLOCKQUOTE\") Spnl \">\"")
+ Rules[:_HtmlBlockBlockquote] = rule_info("HtmlBlockBlockquote", "HtmlBlockOpenBlockquote (HtmlBlockBlockquote | !HtmlBlockCloseBlockquote .)* HtmlBlockCloseBlockquote")
+ Rules[:_HtmlBlockOpenCenter] = rule_info("HtmlBlockOpenCenter", "\"<\" Spnl (\"center\" | \"CENTER\") Spnl HtmlAttribute* \">\"")
+ Rules[:_HtmlBlockCloseCenter] = rule_info("HtmlBlockCloseCenter", "\"<\" Spnl \"/\" (\"center\" | \"CENTER\") Spnl \">\"")
+ Rules[:_HtmlBlockCenter] = rule_info("HtmlBlockCenter", "HtmlBlockOpenCenter (HtmlBlockCenter | !HtmlBlockCloseCenter .)* HtmlBlockCloseCenter")
+ Rules[:_HtmlBlockOpenDir] = rule_info("HtmlBlockOpenDir", "\"<\" Spnl (\"dir\" | \"DIR\") Spnl HtmlAttribute* \">\"")
+ Rules[:_HtmlBlockCloseDir] = rule_info("HtmlBlockCloseDir", "\"<\" Spnl \"/\" (\"dir\" | \"DIR\") Spnl \">\"")
+ Rules[:_HtmlBlockDir] = rule_info("HtmlBlockDir", "HtmlBlockOpenDir (HtmlBlockDir | !HtmlBlockCloseDir .)* HtmlBlockCloseDir")
+ Rules[:_HtmlBlockOpenDiv] = rule_info("HtmlBlockOpenDiv", "\"<\" Spnl (\"div\" | \"DIV\") Spnl HtmlAttribute* \">\"")
+ Rules[:_HtmlBlockCloseDiv] = rule_info("HtmlBlockCloseDiv", "\"<\" Spnl \"/\" (\"div\" | \"DIV\") Spnl \">\"")
+ Rules[:_HtmlBlockDiv] = rule_info("HtmlBlockDiv", "HtmlBlockOpenDiv (HtmlBlockDiv | !HtmlBlockCloseDiv .)* HtmlBlockCloseDiv")
+ Rules[:_HtmlBlockOpenDl] = rule_info("HtmlBlockOpenDl", "\"<\" Spnl (\"dl\" | \"DL\") Spnl HtmlAttribute* \">\"")
+ Rules[:_HtmlBlockCloseDl] = rule_info("HtmlBlockCloseDl", "\"<\" Spnl \"/\" (\"dl\" | \"DL\") Spnl \">\"")
+ Rules[:_HtmlBlockDl] = rule_info("HtmlBlockDl", "HtmlBlockOpenDl (HtmlBlockDl | !HtmlBlockCloseDl .)* HtmlBlockCloseDl")
+ Rules[:_HtmlBlockOpenFieldset] = rule_info("HtmlBlockOpenFieldset", "\"<\" Spnl (\"fieldset\" | \"FIELDSET\") Spnl HtmlAttribute* \">\"")
+ Rules[:_HtmlBlockCloseFieldset] = rule_info("HtmlBlockCloseFieldset", "\"<\" Spnl \"/\" (\"fieldset\" | \"FIELDSET\") Spnl \">\"")
+ Rules[:_HtmlBlockFieldset] = rule_info("HtmlBlockFieldset", "HtmlBlockOpenFieldset (HtmlBlockFieldset | !HtmlBlockCloseFieldset .)* HtmlBlockCloseFieldset")
+ Rules[:_HtmlBlockOpenForm] = rule_info("HtmlBlockOpenForm", "\"<\" Spnl (\"form\" | \"FORM\") Spnl HtmlAttribute* \">\"")
+ Rules[:_HtmlBlockCloseForm] = rule_info("HtmlBlockCloseForm", "\"<\" Spnl \"/\" (\"form\" | \"FORM\") Spnl \">\"")
+ Rules[:_HtmlBlockForm] = rule_info("HtmlBlockForm", "HtmlBlockOpenForm (HtmlBlockForm | !HtmlBlockCloseForm .)* HtmlBlockCloseForm")
+ Rules[:_HtmlBlockOpenH1] = rule_info("HtmlBlockOpenH1", "\"<\" Spnl (\"h1\" | \"H1\") Spnl HtmlAttribute* \">\"")
+ Rules[:_HtmlBlockCloseH1] = rule_info("HtmlBlockCloseH1", "\"<\" Spnl \"/\" (\"h1\" | \"H1\") Spnl \">\"")
+ Rules[:_HtmlBlockH1] = rule_info("HtmlBlockH1", "HtmlBlockOpenH1 (HtmlBlockH1 | !HtmlBlockCloseH1 .)* HtmlBlockCloseH1")
+ Rules[:_HtmlBlockOpenH2] = rule_info("HtmlBlockOpenH2", "\"<\" Spnl (\"h2\" | \"H2\") Spnl HtmlAttribute* \">\"")
+ Rules[:_HtmlBlockCloseH2] = rule_info("HtmlBlockCloseH2", "\"<\" Spnl \"/\" (\"h2\" | \"H2\") Spnl \">\"")
+ Rules[:_HtmlBlockH2] = rule_info("HtmlBlockH2", "HtmlBlockOpenH2 (HtmlBlockH2 | !HtmlBlockCloseH2 .)* HtmlBlockCloseH2")
+ Rules[:_HtmlBlockOpenH3] = rule_info("HtmlBlockOpenH3", "\"<\" Spnl (\"h3\" | \"H3\") Spnl HtmlAttribute* \">\"")
+ Rules[:_HtmlBlockCloseH3] = rule_info("HtmlBlockCloseH3", "\"<\" Spnl \"/\" (\"h3\" | \"H3\") Spnl \">\"")
+ Rules[:_HtmlBlockH3] = rule_info("HtmlBlockH3", "HtmlBlockOpenH3 (HtmlBlockH3 | !HtmlBlockCloseH3 .)* HtmlBlockCloseH3")
+ Rules[:_HtmlBlockOpenH4] = rule_info("HtmlBlockOpenH4", "\"<\" Spnl (\"h4\" | \"H4\") Spnl HtmlAttribute* \">\"")
+ Rules[:_HtmlBlockCloseH4] = rule_info("HtmlBlockCloseH4", "\"<\" Spnl \"/\" (\"h4\" | \"H4\") Spnl \">\"")
+ Rules[:_HtmlBlockH4] = rule_info("HtmlBlockH4", "HtmlBlockOpenH4 (HtmlBlockH4 | !HtmlBlockCloseH4 .)* HtmlBlockCloseH4")
+ Rules[:_HtmlBlockOpenH5] = rule_info("HtmlBlockOpenH5", "\"<\" Spnl (\"h5\" | \"H5\") Spnl HtmlAttribute* \">\"")
+ Rules[:_HtmlBlockCloseH5] = rule_info("HtmlBlockCloseH5", "\"<\" Spnl \"/\" (\"h5\" | \"H5\") Spnl \">\"")
+ Rules[:_HtmlBlockH5] = rule_info("HtmlBlockH5", "HtmlBlockOpenH5 (HtmlBlockH5 | !HtmlBlockCloseH5 .)* HtmlBlockCloseH5")
+ Rules[:_HtmlBlockOpenH6] = rule_info("HtmlBlockOpenH6", "\"<\" Spnl (\"h6\" | \"H6\") Spnl HtmlAttribute* \">\"")
+ Rules[:_HtmlBlockCloseH6] = rule_info("HtmlBlockCloseH6", "\"<\" Spnl \"/\" (\"h6\" | \"H6\") Spnl \">\"")
+ Rules[:_HtmlBlockH6] = rule_info("HtmlBlockH6", "HtmlBlockOpenH6 (HtmlBlockH6 | !HtmlBlockCloseH6 .)* HtmlBlockCloseH6")
+ Rules[:_HtmlBlockOpenMenu] = rule_info("HtmlBlockOpenMenu", "\"<\" Spnl (\"menu\" | \"MENU\") Spnl HtmlAttribute* \">\"")
+ Rules[:_HtmlBlockCloseMenu] = rule_info("HtmlBlockCloseMenu", "\"<\" Spnl \"/\" (\"menu\" | \"MENU\") Spnl \">\"")
+ Rules[:_HtmlBlockMenu] = rule_info("HtmlBlockMenu", "HtmlBlockOpenMenu (HtmlBlockMenu | !HtmlBlockCloseMenu .)* HtmlBlockCloseMenu")
+ Rules[:_HtmlBlockOpenNoframes] = rule_info("HtmlBlockOpenNoframes", "\"<\" Spnl (\"noframes\" | \"NOFRAMES\") Spnl HtmlAttribute* \">\"")
+ Rules[:_HtmlBlockCloseNoframes] = rule_info("HtmlBlockCloseNoframes", "\"<\" Spnl \"/\" (\"noframes\" | \"NOFRAMES\") Spnl \">\"")
+ Rules[:_HtmlBlockNoframes] = rule_info("HtmlBlockNoframes", "HtmlBlockOpenNoframes (HtmlBlockNoframes | !HtmlBlockCloseNoframes .)* HtmlBlockCloseNoframes")
+ Rules[:_HtmlBlockOpenNoscript] = rule_info("HtmlBlockOpenNoscript", "\"<\" Spnl (\"noscript\" | \"NOSCRIPT\") Spnl HtmlAttribute* \">\"")
+ Rules[:_HtmlBlockCloseNoscript] = rule_info("HtmlBlockCloseNoscript", "\"<\" Spnl \"/\" (\"noscript\" | \"NOSCRIPT\") Spnl \">\"")
+ Rules[:_HtmlBlockNoscript] = rule_info("HtmlBlockNoscript", "HtmlBlockOpenNoscript (HtmlBlockNoscript | !HtmlBlockCloseNoscript .)* HtmlBlockCloseNoscript")
+ Rules[:_HtmlBlockOpenOl] = rule_info("HtmlBlockOpenOl", "\"<\" Spnl (\"ol\" | \"OL\") Spnl HtmlAttribute* \">\"")
+ Rules[:_HtmlBlockCloseOl] = rule_info("HtmlBlockCloseOl", "\"<\" Spnl \"/\" (\"ol\" | \"OL\") Spnl \">\"")
+ Rules[:_HtmlBlockOl] = rule_info("HtmlBlockOl", "HtmlBlockOpenOl (HtmlBlockOl | !HtmlBlockCloseOl .)* HtmlBlockCloseOl")
+ Rules[:_HtmlBlockOpenP] = rule_info("HtmlBlockOpenP", "\"<\" Spnl (\"p\" | \"P\") Spnl HtmlAttribute* \">\"")
+ Rules[:_HtmlBlockCloseP] = rule_info("HtmlBlockCloseP", "\"<\" Spnl \"/\" (\"p\" | \"P\") Spnl \">\"")
+ Rules[:_HtmlBlockP] = rule_info("HtmlBlockP", "HtmlBlockOpenP (HtmlBlockP | !HtmlBlockCloseP .)* HtmlBlockCloseP")
+ Rules[:_HtmlBlockOpenPre] = rule_info("HtmlBlockOpenPre", "\"<\" Spnl (\"pre\" | \"PRE\") Spnl HtmlAttribute* \">\"")
+ Rules[:_HtmlBlockClosePre] = rule_info("HtmlBlockClosePre", "\"<\" Spnl \"/\" (\"pre\" | \"PRE\") Spnl \">\"")
+ Rules[:_HtmlBlockPre] = rule_info("HtmlBlockPre", "HtmlBlockOpenPre (HtmlBlockPre | !HtmlBlockClosePre .)* HtmlBlockClosePre")
+ Rules[:_HtmlBlockOpenTable] = rule_info("HtmlBlockOpenTable", "\"<\" Spnl (\"table\" | \"TABLE\") Spnl HtmlAttribute* \">\"")
+ Rules[:_HtmlBlockCloseTable] = rule_info("HtmlBlockCloseTable", "\"<\" Spnl \"/\" (\"table\" | \"TABLE\") Spnl \">\"")
+ Rules[:_HtmlBlockTable] = rule_info("HtmlBlockTable", "HtmlBlockOpenTable (HtmlBlockTable | !HtmlBlockCloseTable .)* HtmlBlockCloseTable")
+ Rules[:_HtmlBlockOpenUl] = rule_info("HtmlBlockOpenUl", "\"<\" Spnl (\"ul\" | \"UL\") Spnl HtmlAttribute* \">\"")
+ Rules[:_HtmlBlockCloseUl] = rule_info("HtmlBlockCloseUl", "\"<\" Spnl \"/\" (\"ul\" | \"UL\") Spnl \">\"")
+ Rules[:_HtmlBlockUl] = rule_info("HtmlBlockUl", "HtmlBlockOpenUl (HtmlBlockUl | !HtmlBlockCloseUl .)* HtmlBlockCloseUl")
+ Rules[:_HtmlBlockOpenDd] = rule_info("HtmlBlockOpenDd", "\"<\" Spnl (\"dd\" | \"DD\") Spnl HtmlAttribute* \">\"")
+ Rules[:_HtmlBlockCloseDd] = rule_info("HtmlBlockCloseDd", "\"<\" Spnl \"/\" (\"dd\" | \"DD\") Spnl \">\"")
+ Rules[:_HtmlBlockDd] = rule_info("HtmlBlockDd", "HtmlBlockOpenDd (HtmlBlockDd | !HtmlBlockCloseDd .)* HtmlBlockCloseDd")
+ Rules[:_HtmlBlockOpenDt] = rule_info("HtmlBlockOpenDt", "\"<\" Spnl (\"dt\" | \"DT\") Spnl HtmlAttribute* \">\"")
+ Rules[:_HtmlBlockCloseDt] = rule_info("HtmlBlockCloseDt", "\"<\" Spnl \"/\" (\"dt\" | \"DT\") Spnl \">\"")
+ Rules[:_HtmlBlockDt] = rule_info("HtmlBlockDt", "HtmlBlockOpenDt (HtmlBlockDt | !HtmlBlockCloseDt .)* HtmlBlockCloseDt")
+ Rules[:_HtmlBlockOpenFrameset] = rule_info("HtmlBlockOpenFrameset", "\"<\" Spnl (\"frameset\" | \"FRAMESET\") Spnl HtmlAttribute* \">\"")
+ Rules[:_HtmlBlockCloseFrameset] = rule_info("HtmlBlockCloseFrameset", "\"<\" Spnl \"/\" (\"frameset\" | \"FRAMESET\") Spnl \">\"")
+ Rules[:_HtmlBlockFrameset] = rule_info("HtmlBlockFrameset", "HtmlBlockOpenFrameset (HtmlBlockFrameset | !HtmlBlockCloseFrameset .)* HtmlBlockCloseFrameset")
+ Rules[:_HtmlBlockOpenLi] = rule_info("HtmlBlockOpenLi", "\"<\" Spnl (\"li\" | \"LI\") Spnl HtmlAttribute* \">\"")
+ Rules[:_HtmlBlockCloseLi] = rule_info("HtmlBlockCloseLi", "\"<\" Spnl \"/\" (\"li\" | \"LI\") Spnl \">\"")
+ Rules[:_HtmlBlockLi] = rule_info("HtmlBlockLi", "HtmlBlockOpenLi (HtmlBlockLi | !HtmlBlockCloseLi .)* HtmlBlockCloseLi")
+ Rules[:_HtmlBlockOpenTbody] = rule_info("HtmlBlockOpenTbody", "\"<\" Spnl (\"tbody\" | \"TBODY\") Spnl HtmlAttribute* \">\"")
+ Rules[:_HtmlBlockCloseTbody] = rule_info("HtmlBlockCloseTbody", "\"<\" Spnl \"/\" (\"tbody\" | \"TBODY\") Spnl \">\"")
+ Rules[:_HtmlBlockTbody] = rule_info("HtmlBlockTbody", "HtmlBlockOpenTbody (HtmlBlockTbody | !HtmlBlockCloseTbody .)* HtmlBlockCloseTbody")
+ Rules[:_HtmlBlockOpenTd] = rule_info("HtmlBlockOpenTd", "\"<\" Spnl (\"td\" | \"TD\") Spnl HtmlAttribute* \">\"")
+ Rules[:_HtmlBlockCloseTd] = rule_info("HtmlBlockCloseTd", "\"<\" Spnl \"/\" (\"td\" | \"TD\") Spnl \">\"")
+ Rules[:_HtmlBlockTd] = rule_info("HtmlBlockTd", "HtmlBlockOpenTd (HtmlBlockTd | !HtmlBlockCloseTd .)* HtmlBlockCloseTd")
+ Rules[:_HtmlBlockOpenTfoot] = rule_info("HtmlBlockOpenTfoot", "\"<\" Spnl (\"tfoot\" | \"TFOOT\") Spnl HtmlAttribute* \">\"")
+ Rules[:_HtmlBlockCloseTfoot] = rule_info("HtmlBlockCloseTfoot", "\"<\" Spnl \"/\" (\"tfoot\" | \"TFOOT\") Spnl \">\"")
+ Rules[:_HtmlBlockTfoot] = rule_info("HtmlBlockTfoot", "HtmlBlockOpenTfoot (HtmlBlockTfoot | !HtmlBlockCloseTfoot .)* HtmlBlockCloseTfoot")
+ Rules[:_HtmlBlockOpenTh] = rule_info("HtmlBlockOpenTh", "\"<\" Spnl (\"th\" | \"TH\") Spnl HtmlAttribute* \">\"")
+ Rules[:_HtmlBlockCloseTh] = rule_info("HtmlBlockCloseTh", "\"<\" Spnl \"/\" (\"th\" | \"TH\") Spnl \">\"")
+ Rules[:_HtmlBlockTh] = rule_info("HtmlBlockTh", "HtmlBlockOpenTh (HtmlBlockTh | !HtmlBlockCloseTh .)* HtmlBlockCloseTh")
+ Rules[:_HtmlBlockOpenThead] = rule_info("HtmlBlockOpenThead", "\"<\" Spnl (\"thead\" | \"THEAD\") Spnl HtmlAttribute* \">\"")
+ Rules[:_HtmlBlockCloseThead] = rule_info("HtmlBlockCloseThead", "\"<\" Spnl \"/\" (\"thead\" | \"THEAD\") Spnl \">\"")
+ Rules[:_HtmlBlockThead] = rule_info("HtmlBlockThead", "HtmlBlockOpenThead (HtmlBlockThead | !HtmlBlockCloseThead .)* HtmlBlockCloseThead")
+ Rules[:_HtmlBlockOpenTr] = rule_info("HtmlBlockOpenTr", "\"<\" Spnl (\"tr\" | \"TR\") Spnl HtmlAttribute* \">\"")
+ Rules[:_HtmlBlockCloseTr] = rule_info("HtmlBlockCloseTr", "\"<\" Spnl \"/\" (\"tr\" | \"TR\") Spnl \">\"")
+ Rules[:_HtmlBlockTr] = rule_info("HtmlBlockTr", "HtmlBlockOpenTr (HtmlBlockTr | !HtmlBlockCloseTr .)* HtmlBlockCloseTr")
+ Rules[:_HtmlBlockOpenScript] = rule_info("HtmlBlockOpenScript", "\"<\" Spnl (\"script\" | \"SCRIPT\") Spnl HtmlAttribute* \">\"")
+ Rules[:_HtmlBlockCloseScript] = rule_info("HtmlBlockCloseScript", "\"<\" Spnl \"/\" (\"script\" | \"SCRIPT\") Spnl \">\"")
+ Rules[:_HtmlBlockScript] = rule_info("HtmlBlockScript", "HtmlBlockOpenScript (!HtmlBlockCloseScript .)* HtmlBlockCloseScript")
+ Rules[:_HtmlBlockInTags] = rule_info("HtmlBlockInTags", "(HtmlBlockAddress | HtmlBlockBlockquote | HtmlBlockCenter | HtmlBlockDir | HtmlBlockDiv | HtmlBlockDl | HtmlBlockFieldset | HtmlBlockForm | HtmlBlockH1 | HtmlBlockH2 | HtmlBlockH3 | HtmlBlockH4 | HtmlBlockH5 | HtmlBlockH6 | HtmlBlockMenu | HtmlBlockNoframes | HtmlBlockNoscript | HtmlBlockOl | HtmlBlockP | HtmlBlockPre | HtmlBlockTable | HtmlBlockUl | HtmlBlockDd | HtmlBlockDt | HtmlBlockFrameset | HtmlBlockLi | HtmlBlockTbody | HtmlBlockTd | HtmlBlockTfoot | HtmlBlockTh | HtmlBlockThead | HtmlBlockTr | HtmlBlockScript)")
+ Rules[:_HtmlBlock] = rule_info("HtmlBlock", "< (HtmlBlockInTags | HtmlComment | HtmlBlockSelfClosing | HtmlUnclosed) > @BlankLine+ { if html? then RDoc::Markup::Raw.new text end }")
+ Rules[:_HtmlUnclosed] = rule_info("HtmlUnclosed", "\"<\" Spnl HtmlUnclosedType Spnl HtmlAttribute* Spnl \">\"")
+ Rules[:_HtmlUnclosedType] = rule_info("HtmlUnclosedType", "(\"HR\" | \"hr\")")
+ Rules[:_HtmlBlockSelfClosing] = rule_info("HtmlBlockSelfClosing", "\"<\" Spnl HtmlBlockType Spnl HtmlAttribute* \"/\" Spnl \">\"")
+ Rules[:_HtmlBlockType] = rule_info("HtmlBlockType", "(\"ADDRESS\" | \"BLOCKQUOTE\" | \"CENTER\" | \"DD\" | \"DIR\" | \"DIV\" | \"DL\" | \"DT\" | \"FIELDSET\" | \"FORM\" | \"FRAMESET\" | \"H1\" | \"H2\" | \"H3\" | \"H4\" | \"H5\" | \"H6\" | \"HR\" | \"ISINDEX\" | \"LI\" | \"MENU\" | \"NOFRAMES\" | \"NOSCRIPT\" | \"OL\" | \"P\" | \"PRE\" | \"SCRIPT\" | \"TABLE\" | \"TBODY\" | \"TD\" | \"TFOOT\" | \"TH\" | \"THEAD\" | \"TR\" | \"UL\" | \"address\" | \"blockquote\" | \"center\" | \"dd\" | \"dir\" | \"div\" | \"dl\" | \"dt\" | \"fieldset\" | \"form\" | \"frameset\" | \"h1\" | \"h2\" | \"h3\" | \"h4\" | \"h5\" | \"h6\" | \"hr\" | \"isindex\" | \"li\" | \"menu\" | \"noframes\" | \"noscript\" | \"ol\" | \"p\" | \"pre\" | \"script\" | \"table\" | \"tbody\" | \"td\" | \"tfoot\" | \"th\" | \"thead\" | \"tr\" | \"ul\")")
+ 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[:_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 /={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", "(< /\\*{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[:_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 { \"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[:_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[:_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[:_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[:_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[:_RawHtml] = rule_info("RawHtml", "< (HtmlComment | HtmlBlockScript | HtmlTag) > { if html? then text else '' end }")
+ 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[:_Digit] = rule_info("Digit", "[0-9]")
+ Rules[:_Alphanumeric] = rule_info("Alphanumeric", "%literals.Alphanumeric")
+ Rules[:_AlphanumericAscii] = rule_info("AlphanumericAscii", "%literals.AlphanumericAscii")
+ Rules[:_BOM] = rule_info("BOM", "%literals.BOM")
+ 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", "/&\#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", "/ {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[:_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: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[:_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 }")
+ # :startdoc:
+end
diff --git a/lib/rdoc/markdown/entities.rb b/lib/rdoc/markdown/entities.rb
new file mode 100644
index 0000000000..0661abab78
--- /dev/null
+++ b/lib/rdoc/markdown/entities.rb
@@ -0,0 +1,2131 @@
+##
+# HTML entity name map for RDoc::Markdown
+
+RDoc::Markdown::HTML_ENTITIES = {
+ "AElig" => [0x000C6],
+ "AMP" => [0x00026],
+ "Aacute" => [0x000C1],
+ "Abreve" => [0x00102],
+ "Acirc" => [0x000C2],
+ "Acy" => [0x00410],
+ "Afr" => [0x1D504],
+ "Agrave" => [0x000C0],
+ "Alpha" => [0x00391],
+ "Amacr" => [0x00100],
+ "And" => [0x02A53],
+ "Aogon" => [0x00104],
+ "Aopf" => [0x1D538],
+ "ApplyFunction" => [0x02061],
+ "Aring" => [0x000C5],
+ "Ascr" => [0x1D49C],
+ "Assign" => [0x02254],
+ "Atilde" => [0x000C3],
+ "Auml" => [0x000C4],
+ "Backslash" => [0x02216],
+ "Barv" => [0x02AE7],
+ "Barwed" => [0x02306],
+ "Bcy" => [0x00411],
+ "Because" => [0x02235],
+ "Bernoullis" => [0x0212C],
+ "Beta" => [0x00392],
+ "Bfr" => [0x1D505],
+ "Bopf" => [0x1D539],
+ "Breve" => [0x002D8],
+ "Bscr" => [0x0212C],
+ "Bumpeq" => [0x0224E],
+ "CHcy" => [0x00427],
+ "COPY" => [0x000A9],
+ "Cacute" => [0x00106],
+ "Cap" => [0x022D2],
+ "CapitalDifferentialD" => [0x02145],
+ "Cayleys" => [0x0212D],
+ "Ccaron" => [0x0010C],
+ "Ccedil" => [0x000C7],
+ "Ccirc" => [0x00108],
+ "Cconint" => [0x02230],
+ "Cdot" => [0x0010A],
+ "Cedilla" => [0x000B8],
+ "CenterDot" => [0x000B7],
+ "Cfr" => [0x0212D],
+ "Chi" => [0x003A7],
+ "CircleDot" => [0x02299],
+ "CircleMinus" => [0x02296],
+ "CirclePlus" => [0x02295],
+ "CircleTimes" => [0x02297],
+ "ClockwiseContourIntegral" => [0x02232],
+ "CloseCurlyDoubleQuote" => [0x0201D],
+ "CloseCurlyQuote" => [0x02019],
+ "Colon" => [0x02237],
+ "Colone" => [0x02A74],
+ "Congruent" => [0x02261],
+ "Conint" => [0x0222F],
+ "ContourIntegral" => [0x0222E],
+ "Copf" => [0x02102],
+ "Coproduct" => [0x02210],
+ "CounterClockwiseContourIntegral" => [0x02233],
+ "Cross" => [0x02A2F],
+ "Cscr" => [0x1D49E],
+ "Cup" => [0x022D3],
+ "CupCap" => [0x0224D],
+ "DD" => [0x02145],
+ "DDotrahd" => [0x02911],
+ "DJcy" => [0x00402],
+ "DScy" => [0x00405],
+ "DZcy" => [0x0040F],
+ "Dagger" => [0x02021],
+ "Darr" => [0x021A1],
+ "Dashv" => [0x02AE4],
+ "Dcaron" => [0x0010E],
+ "Dcy" => [0x00414],
+ "Del" => [0x02207],
+ "Delta" => [0x00394],
+ "Dfr" => [0x1D507],
+ "DiacriticalAcute" => [0x000B4],
+ "DiacriticalDot" => [0x002D9],
+ "DiacriticalDoubleAcute" => [0x002DD],
+ "DiacriticalGrave" => [0x00060],
+ "DiacriticalTilde" => [0x002DC],
+ "Diamond" => [0x022C4],
+ "DifferentialD" => [0x02146],
+ "Dopf" => [0x1D53B],
+ "Dot" => [0x000A8],
+ "DotDot" => [0x020DC],
+ "DotEqual" => [0x02250],
+ "DoubleContourIntegral" => [0x0222F],
+ "DoubleDot" => [0x000A8],
+ "DoubleDownArrow" => [0x021D3],
+ "DoubleLeftArrow" => [0x021D0],
+ "DoubleLeftRightArrow" => [0x021D4],
+ "DoubleLeftTee" => [0x02AE4],
+ "DoubleLongLeftArrow" => [0x027F8],
+ "DoubleLongLeftRightArrow" => [0x027FA],
+ "DoubleLongRightArrow" => [0x027F9],
+ "DoubleRightArrow" => [0x021D2],
+ "DoubleRightTee" => [0x022A8],
+ "DoubleUpArrow" => [0x021D1],
+ "DoubleUpDownArrow" => [0x021D5],
+ "DoubleVerticalBar" => [0x02225],
+ "DownArrow" => [0x02193],
+ "DownArrowBar" => [0x02913],
+ "DownArrowUpArrow" => [0x021F5],
+ "DownBreve" => [0x00311],
+ "DownLeftRightVector" => [0x02950],
+ "DownLeftTeeVector" => [0x0295E],
+ "DownLeftVector" => [0x021BD],
+ "DownLeftVectorBar" => [0x02956],
+ "DownRightTeeVector" => [0x0295F],
+ "DownRightVector" => [0x021C1],
+ "DownRightVectorBar" => [0x02957],
+ "DownTee" => [0x022A4],
+ "DownTeeArrow" => [0x021A7],
+ "Downarrow" => [0x021D3],
+ "Dscr" => [0x1D49F],
+ "Dstrok" => [0x00110],
+ "ENG" => [0x0014A],
+ "ETH" => [0x000D0],
+ "Eacute" => [0x000C9],
+ "Ecaron" => [0x0011A],
+ "Ecirc" => [0x000CA],
+ "Ecy" => [0x0042D],
+ "Edot" => [0x00116],
+ "Efr" => [0x1D508],
+ "Egrave" => [0x000C8],
+ "Element" => [0x02208],
+ "Emacr" => [0x00112],
+ "EmptySmallSquare" => [0x025FB],
+ "EmptyVerySmallSquare" => [0x025AB],
+ "Eogon" => [0x00118],
+ "Eopf" => [0x1D53C],
+ "Epsilon" => [0x00395],
+ "Equal" => [0x02A75],
+ "EqualTilde" => [0x02242],
+ "Equilibrium" => [0x021CC],
+ "Escr" => [0x02130],
+ "Esim" => [0x02A73],
+ "Eta" => [0x00397],
+ "Euml" => [0x000CB],
+ "Exists" => [0x02203],
+ "ExponentialE" => [0x02147],
+ "Fcy" => [0x00424],
+ "Ffr" => [0x1D509],
+ "FilledSmallSquare" => [0x025FC],
+ "FilledVerySmallSquare" => [0x025AA],
+ "Fopf" => [0x1D53D],
+ "ForAll" => [0x02200],
+ "Fouriertrf" => [0x02131],
+ "Fscr" => [0x02131],
+ "GJcy" => [0x00403],
+ "GT" => [0x0003E],
+ "Gamma" => [0x00393],
+ "Gammad" => [0x003DC],
+ "Gbreve" => [0x0011E],
+ "Gcedil" => [0x00122],
+ "Gcirc" => [0x0011C],
+ "Gcy" => [0x00413],
+ "Gdot" => [0x00120],
+ "Gfr" => [0x1D50A],
+ "Gg" => [0x022D9],
+ "Gopf" => [0x1D53E],
+ "GreaterEqual" => [0x02265],
+ "GreaterEqualLess" => [0x022DB],
+ "GreaterFullEqual" => [0x02267],
+ "GreaterGreater" => [0x02AA2],
+ "GreaterLess" => [0x02277],
+ "GreaterSlantEqual" => [0x02A7E],
+ "GreaterTilde" => [0x02273],
+ "Gscr" => [0x1D4A2],
+ "Gt" => [0x0226B],
+ "HARDcy" => [0x0042A],
+ "Hacek" => [0x002C7],
+ "Hat" => [0x0005E],
+ "Hcirc" => [0x00124],
+ "Hfr" => [0x0210C],
+ "HilbertSpace" => [0x0210B],
+ "Hopf" => [0x0210D],
+ "HorizontalLine" => [0x02500],
+ "Hscr" => [0x0210B],
+ "Hstrok" => [0x00126],
+ "HumpDownHump" => [0x0224E],
+ "HumpEqual" => [0x0224F],
+ "IEcy" => [0x00415],
+ "IJlig" => [0x00132],
+ "IOcy" => [0x00401],
+ "Iacute" => [0x000CD],
+ "Icirc" => [0x000CE],
+ "Icy" => [0x00418],
+ "Idot" => [0x00130],
+ "Ifr" => [0x02111],
+ "Igrave" => [0x000CC],
+ "Im" => [0x02111],
+ "Imacr" => [0x0012A],
+ "ImaginaryI" => [0x02148],
+ "Implies" => [0x021D2],
+ "Int" => [0x0222C],
+ "Integral" => [0x0222B],
+ "Intersection" => [0x022C2],
+ "InvisibleComma" => [0x02063],
+ "InvisibleTimes" => [0x02062],
+ "Iogon" => [0x0012E],
+ "Iopf" => [0x1D540],
+ "Iota" => [0x00399],
+ "Iscr" => [0x02110],
+ "Itilde" => [0x00128],
+ "Iukcy" => [0x00406],
+ "Iuml" => [0x000CF],
+ "Jcirc" => [0x00134],
+ "Jcy" => [0x00419],
+ "Jfr" => [0x1D50D],
+ "Jopf" => [0x1D541],
+ "Jscr" => [0x1D4A5],
+ "Jsercy" => [0x00408],
+ "Jukcy" => [0x00404],
+ "KHcy" => [0x00425],
+ "KJcy" => [0x0040C],
+ "Kappa" => [0x0039A],
+ "Kcedil" => [0x00136],
+ "Kcy" => [0x0041A],
+ "Kfr" => [0x1D50E],
+ "Kopf" => [0x1D542],
+ "Kscr" => [0x1D4A6],
+ "LJcy" => [0x00409],
+ "LT" => [0x0003C],
+ "Lacute" => [0x00139],
+ "Lambda" => [0x0039B],
+ "Lang" => [0x027EA],
+ "Laplacetrf" => [0x02112],
+ "Larr" => [0x0219E],
+ "Lcaron" => [0x0013D],
+ "Lcedil" => [0x0013B],
+ "Lcy" => [0x0041B],
+ "LeftAngleBracket" => [0x027E8],
+ "LeftArrow" => [0x02190],
+ "LeftArrowBar" => [0x021E4],
+ "LeftArrowRightArrow" => [0x021C6],
+ "LeftCeiling" => [0x02308],
+ "LeftDoubleBracket" => [0x027E6],
+ "LeftDownTeeVector" => [0x02961],
+ "LeftDownVector" => [0x021C3],
+ "LeftDownVectorBar" => [0x02959],
+ "LeftFloor" => [0x0230A],
+ "LeftRightArrow" => [0x02194],
+ "LeftRightVector" => [0x0294E],
+ "LeftTee" => [0x022A3],
+ "LeftTeeArrow" => [0x021A4],
+ "LeftTeeVector" => [0x0295A],
+ "LeftTriangle" => [0x022B2],
+ "LeftTriangleBar" => [0x029CF],
+ "LeftTriangleEqual" => [0x022B4],
+ "LeftUpDownVector" => [0x02951],
+ "LeftUpTeeVector" => [0x02960],
+ "LeftUpVector" => [0x021BF],
+ "LeftUpVectorBar" => [0x02958],
+ "LeftVector" => [0x021BC],
+ "LeftVectorBar" => [0x02952],
+ "Leftarrow" => [0x021D0],
+ "Leftrightarrow" => [0x021D4],
+ "LessEqualGreater" => [0x022DA],
+ "LessFullEqual" => [0x02266],
+ "LessGreater" => [0x02276],
+ "LessLess" => [0x02AA1],
+ "LessSlantEqual" => [0x02A7D],
+ "LessTilde" => [0x02272],
+ "Lfr" => [0x1D50F],
+ "Ll" => [0x022D8],
+ "Lleftarrow" => [0x021DA],
+ "Lmidot" => [0x0013F],
+ "LongLeftArrow" => [0x027F5],
+ "LongLeftRightArrow" => [0x027F7],
+ "LongRightArrow" => [0x027F6],
+ "Longleftarrow" => [0x027F8],
+ "Longleftrightarrow" => [0x027FA],
+ "Longrightarrow" => [0x027F9],
+ "Lopf" => [0x1D543],
+ "LowerLeftArrow" => [0x02199],
+ "LowerRightArrow" => [0x02198],
+ "Lscr" => [0x02112],
+ "Lsh" => [0x021B0],
+ "Lstrok" => [0x00141],
+ "Lt" => [0x0226A],
+ "Map" => [0x02905],
+ "Mcy" => [0x0041C],
+ "MediumSpace" => [0x0205F],
+ "Mellintrf" => [0x02133],
+ "Mfr" => [0x1D510],
+ "MinusPlus" => [0x02213],
+ "Mopf" => [0x1D544],
+ "Mscr" => [0x02133],
+ "Mu" => [0x0039C],
+ "NJcy" => [0x0040A],
+ "Nacute" => [0x00143],
+ "Ncaron" => [0x00147],
+ "Ncedil" => [0x00145],
+ "Ncy" => [0x0041D],
+ "NegativeMediumSpace" => [0x0200B],
+ "NegativeThickSpace" => [0x0200B],
+ "NegativeThinSpace" => [0x0200B],
+ "NegativeVeryThinSpace" => [0x0200B],
+ "NestedGreaterGreater" => [0x0226B],
+ "NestedLessLess" => [0x0226A],
+ "NewLine" => [0x0000A],
+ "Nfr" => [0x1D511],
+ "NoBreak" => [0x02060],
+ "NonBreakingSpace" => [0x000A0],
+ "Nopf" => [0x02115],
+ "Not" => [0x02AEC],
+ "NotCongruent" => [0x02262],
+ "NotCupCap" => [0x0226D],
+ "NotDoubleVerticalBar" => [0x02226],
+ "NotElement" => [0x02209],
+ "NotEqual" => [0x02260],
+ "NotEqualTilde" => [0x02242, 0x00338],
+ "NotExists" => [0x02204],
+ "NotGreater" => [0x0226F],
+ "NotGreaterEqual" => [0x02271],
+ "NotGreaterFullEqual" => [0x02267, 0x00338],
+ "NotGreaterGreater" => [0x0226B, 0x00338],
+ "NotGreaterLess" => [0x02279],
+ "NotGreaterSlantEqual" => [0x02A7E, 0x00338],
+ "NotGreaterTilde" => [0x02275],
+ "NotHumpDownHump" => [0x0224E, 0x00338],
+ "NotHumpEqual" => [0x0224F, 0x00338],
+ "NotLeftTriangle" => [0x022EA],
+ "NotLeftTriangleBar" => [0x029CF, 0x00338],
+ "NotLeftTriangleEqual" => [0x022EC],
+ "NotLess" => [0x0226E],
+ "NotLessEqual" => [0x02270],
+ "NotLessGreater" => [0x02278],
+ "NotLessLess" => [0x0226A, 0x00338],
+ "NotLessSlantEqual" => [0x02A7D, 0x00338],
+ "NotLessTilde" => [0x02274],
+ "NotNestedGreaterGreater" => [0x02AA2, 0x00338],
+ "NotNestedLessLess" => [0x02AA1, 0x00338],
+ "NotPrecedes" => [0x02280],
+ "NotPrecedesEqual" => [0x02AAF, 0x00338],
+ "NotPrecedesSlantEqual" => [0x022E0],
+ "NotReverseElement" => [0x0220C],
+ "NotRightTriangle" => [0x022EB],
+ "NotRightTriangleBar" => [0x029D0, 0x00338],
+ "NotRightTriangleEqual" => [0x022ED],
+ "NotSquareSubset" => [0x0228F, 0x00338],
+ "NotSquareSubsetEqual" => [0x022E2],
+ "NotSquareSuperset" => [0x02290, 0x00338],
+ "NotSquareSupersetEqual" => [0x022E3],
+ "NotSubset" => [0x02282, 0x020D2],
+ "NotSubsetEqual" => [0x02288],
+ "NotSucceeds" => [0x02281],
+ "NotSucceedsEqual" => [0x02AB0, 0x00338],
+ "NotSucceedsSlantEqual" => [0x022E1],
+ "NotSucceedsTilde" => [0x0227F, 0x00338],
+ "NotSuperset" => [0x02283, 0x020D2],
+ "NotSupersetEqual" => [0x02289],
+ "NotTilde" => [0x02241],
+ "NotTildeEqual" => [0x02244],
+ "NotTildeFullEqual" => [0x02247],
+ "NotTildeTilde" => [0x02249],
+ "NotVerticalBar" => [0x02224],
+ "Nscr" => [0x1D4A9],
+ "Ntilde" => [0x000D1],
+ "Nu" => [0x0039D],
+ "OElig" => [0x00152],
+ "Oacute" => [0x000D3],
+ "Ocirc" => [0x000D4],
+ "Ocy" => [0x0041E],
+ "Odblac" => [0x00150],
+ "Ofr" => [0x1D512],
+ "Ograve" => [0x000D2],
+ "Omacr" => [0x0014C],
+ "Omega" => [0x003A9],
+ "Omicron" => [0x0039F],
+ "Oopf" => [0x1D546],
+ "OpenCurlyDoubleQuote" => [0x0201C],
+ "OpenCurlyQuote" => [0x02018],
+ "Or" => [0x02A54],
+ "Oscr" => [0x1D4AA],
+ "Oslash" => [0x000D8],
+ "Otilde" => [0x000D5],
+ "Otimes" => [0x02A37],
+ "Ouml" => [0x000D6],
+ "OverBar" => [0x0203E],
+ "OverBrace" => [0x023DE],
+ "OverBracket" => [0x023B4],
+ "OverParenthesis" => [0x023DC],
+ "PartialD" => [0x02202],
+ "Pcy" => [0x0041F],
+ "Pfr" => [0x1D513],
+ "Phi" => [0x003A6],
+ "Pi" => [0x003A0],
+ "PlusMinus" => [0x000B1],
+ "Poincareplane" => [0x0210C],
+ "Popf" => [0x02119],
+ "Pr" => [0x02ABB],
+ "Precedes" => [0x0227A],
+ "PrecedesEqual" => [0x02AAF],
+ "PrecedesSlantEqual" => [0x0227C],
+ "PrecedesTilde" => [0x0227E],
+ "Prime" => [0x02033],
+ "Product" => [0x0220F],
+ "Proportion" => [0x02237],
+ "Proportional" => [0x0221D],
+ "Pscr" => [0x1D4AB],
+ "Psi" => [0x003A8],
+ "QUOT" => [0x00022],
+ "Qfr" => [0x1D514],
+ "Qopf" => [0x0211A],
+ "Qscr" => [0x1D4AC],
+ "RBarr" => [0x02910],
+ "REG" => [0x000AE],
+ "Racute" => [0x00154],
+ "Rang" => [0x027EB],
+ "Rarr" => [0x021A0],
+ "Rarrtl" => [0x02916],
+ "Rcaron" => [0x00158],
+ "Rcedil" => [0x00156],
+ "Rcy" => [0x00420],
+ "Re" => [0x0211C],
+ "ReverseElement" => [0x0220B],
+ "ReverseEquilibrium" => [0x021CB],
+ "ReverseUpEquilibrium" => [0x0296F],
+ "Rfr" => [0x0211C],
+ "Rho" => [0x003A1],
+ "RightAngleBracket" => [0x027E9],
+ "RightArrow" => [0x02192],
+ "RightArrowBar" => [0x021E5],
+ "RightArrowLeftArrow" => [0x021C4],
+ "RightCeiling" => [0x02309],
+ "RightDoubleBracket" => [0x027E7],
+ "RightDownTeeVector" => [0x0295D],
+ "RightDownVector" => [0x021C2],
+ "RightDownVectorBar" => [0x02955],
+ "RightFloor" => [0x0230B],
+ "RightTee" => [0x022A2],
+ "RightTeeArrow" => [0x021A6],
+ "RightTeeVector" => [0x0295B],
+ "RightTriangle" => [0x022B3],
+ "RightTriangleBar" => [0x029D0],
+ "RightTriangleEqual" => [0x022B5],
+ "RightUpDownVector" => [0x0294F],
+ "RightUpTeeVector" => [0x0295C],
+ "RightUpVector" => [0x021BE],
+ "RightUpVectorBar" => [0x02954],
+ "RightVector" => [0x021C0],
+ "RightVectorBar" => [0x02953],
+ "Rightarrow" => [0x021D2],
+ "Ropf" => [0x0211D],
+ "RoundImplies" => [0x02970],
+ "Rrightarrow" => [0x021DB],
+ "Rscr" => [0x0211B],
+ "Rsh" => [0x021B1],
+ "RuleDelayed" => [0x029F4],
+ "SHCHcy" => [0x00429],
+ "SHcy" => [0x00428],
+ "SOFTcy" => [0x0042C],
+ "Sacute" => [0x0015A],
+ "Sc" => [0x02ABC],
+ "Scaron" => [0x00160],
+ "Scedil" => [0x0015E],
+ "Scirc" => [0x0015C],
+ "Scy" => [0x00421],
+ "Sfr" => [0x1D516],
+ "ShortDownArrow" => [0x02193],
+ "ShortLeftArrow" => [0x02190],
+ "ShortRightArrow" => [0x02192],
+ "ShortUpArrow" => [0x02191],
+ "Sigma" => [0x003A3],
+ "SmallCircle" => [0x02218],
+ "Sopf" => [0x1D54A],
+ "Sqrt" => [0x0221A],
+ "Square" => [0x025A1],
+ "SquareIntersection" => [0x02293],
+ "SquareSubset" => [0x0228F],
+ "SquareSubsetEqual" => [0x02291],
+ "SquareSuperset" => [0x02290],
+ "SquareSupersetEqual" => [0x02292],
+ "SquareUnion" => [0x02294],
+ "Sscr" => [0x1D4AE],
+ "Star" => [0x022C6],
+ "Sub" => [0x022D0],
+ "Subset" => [0x022D0],
+ "SubsetEqual" => [0x02286],
+ "Succeeds" => [0x0227B],
+ "SucceedsEqual" => [0x02AB0],
+ "SucceedsSlantEqual" => [0x0227D],
+ "SucceedsTilde" => [0x0227F],
+ "SuchThat" => [0x0220B],
+ "Sum" => [0x02211],
+ "Sup" => [0x022D1],
+ "Superset" => [0x02283],
+ "SupersetEqual" => [0x02287],
+ "Supset" => [0x022D1],
+ "THORN" => [0x000DE],
+ "TRADE" => [0x02122],
+ "TSHcy" => [0x0040B],
+ "TScy" => [0x00426],
+ "Tab" => [0x00009],
+ "Tau" => [0x003A4],
+ "Tcaron" => [0x00164],
+ "Tcedil" => [0x00162],
+ "Tcy" => [0x00422],
+ "Tfr" => [0x1D517],
+ "Therefore" => [0x02234],
+ "Theta" => [0x00398],
+ "ThickSpace" => [0x0205F, 0x0200A],
+ "ThinSpace" => [0x02009],
+ "Tilde" => [0x0223C],
+ "TildeEqual" => [0x02243],
+ "TildeFullEqual" => [0x02245],
+ "TildeTilde" => [0x02248],
+ "Topf" => [0x1D54B],
+ "TripleDot" => [0x020DB],
+ "Tscr" => [0x1D4AF],
+ "Tstrok" => [0x00166],
+ "Uacute" => [0x000DA],
+ "Uarr" => [0x0219F],
+ "Uarrocir" => [0x02949],
+ "Ubrcy" => [0x0040E],
+ "Ubreve" => [0x0016C],
+ "Ucirc" => [0x000DB],
+ "Ucy" => [0x00423],
+ "Udblac" => [0x00170],
+ "Ufr" => [0x1D518],
+ "Ugrave" => [0x000D9],
+ "Umacr" => [0x0016A],
+ "UnderBar" => [0x0005F],
+ "UnderBrace" => [0x023DF],
+ "UnderBracket" => [0x023B5],
+ "UnderParenthesis" => [0x023DD],
+ "Union" => [0x022C3],
+ "UnionPlus" => [0x0228E],
+ "Uogon" => [0x00172],
+ "Uopf" => [0x1D54C],
+ "UpArrow" => [0x02191],
+ "UpArrowBar" => [0x02912],
+ "UpArrowDownArrow" => [0x021C5],
+ "UpDownArrow" => [0x02195],
+ "UpEquilibrium" => [0x0296E],
+ "UpTee" => [0x022A5],
+ "UpTeeArrow" => [0x021A5],
+ "Uparrow" => [0x021D1],
+ "Updownarrow" => [0x021D5],
+ "UpperLeftArrow" => [0x02196],
+ "UpperRightArrow" => [0x02197],
+ "Upsi" => [0x003D2],
+ "Upsilon" => [0x003A5],
+ "Uring" => [0x0016E],
+ "Uscr" => [0x1D4B0],
+ "Utilde" => [0x00168],
+ "Uuml" => [0x000DC],
+ "VDash" => [0x022AB],
+ "Vbar" => [0x02AEB],
+ "Vcy" => [0x00412],
+ "Vdash" => [0x022A9],
+ "Vdashl" => [0x02AE6],
+ "Vee" => [0x022C1],
+ "Verbar" => [0x02016],
+ "Vert" => [0x02016],
+ "VerticalBar" => [0x02223],
+ "VerticalLine" => [0x0007C],
+ "VerticalSeparator" => [0x02758],
+ "VerticalTilde" => [0x02240],
+ "VeryThinSpace" => [0x0200A],
+ "Vfr" => [0x1D519],
+ "Vopf" => [0x1D54D],
+ "Vscr" => [0x1D4B1],
+ "Vvdash" => [0x022AA],
+ "Wcirc" => [0x00174],
+ "Wedge" => [0x022C0],
+ "Wfr" => [0x1D51A],
+ "Wopf" => [0x1D54E],
+ "Wscr" => [0x1D4B2],
+ "Xfr" => [0x1D51B],
+ "Xi" => [0x0039E],
+ "Xopf" => [0x1D54F],
+ "Xscr" => [0x1D4B3],
+ "YAcy" => [0x0042F],
+ "YIcy" => [0x00407],
+ "YUcy" => [0x0042E],
+ "Yacute" => [0x000DD],
+ "Ycirc" => [0x00176],
+ "Ycy" => [0x0042B],
+ "Yfr" => [0x1D51C],
+ "Yopf" => [0x1D550],
+ "Yscr" => [0x1D4B4],
+ "Yuml" => [0x00178],
+ "ZHcy" => [0x00416],
+ "Zacute" => [0x00179],
+ "Zcaron" => [0x0017D],
+ "Zcy" => [0x00417],
+ "Zdot" => [0x0017B],
+ "ZeroWidthSpace" => [0x0200B],
+ "Zeta" => [0x00396],
+ "Zfr" => [0x02128],
+ "Zopf" => [0x02124],
+ "Zscr" => [0x1D4B5],
+ "aacute" => [0x000E1],
+ "abreve" => [0x00103],
+ "ac" => [0x0223E],
+ "acE" => [0x0223E, 0x00333],
+ "acd" => [0x0223F],
+ "acirc" => [0x000E2],
+ "acute" => [0x000B4],
+ "acy" => [0x00430],
+ "aelig" => [0x000E6],
+ "af" => [0x02061],
+ "afr" => [0x1D51E],
+ "agrave" => [0x000E0],
+ "alefsym" => [0x02135],
+ "aleph" => [0x02135],
+ "alpha" => [0x003B1],
+ "amacr" => [0x00101],
+ "amalg" => [0x02A3F],
+ "amp" => [0x00026],
+ "and" => [0x02227],
+ "andand" => [0x02A55],
+ "andd" => [0x02A5C],
+ "andslope" => [0x02A58],
+ "andv" => [0x02A5A],
+ "ang" => [0x02220],
+ "ange" => [0x029A4],
+ "angle" => [0x02220],
+ "angmsd" => [0x02221],
+ "angmsdaa" => [0x029A8],
+ "angmsdab" => [0x029A9],
+ "angmsdac" => [0x029AA],
+ "angmsdad" => [0x029AB],
+ "angmsdae" => [0x029AC],
+ "angmsdaf" => [0x029AD],
+ "angmsdag" => [0x029AE],
+ "angmsdah" => [0x029AF],
+ "angrt" => [0x0221F],
+ "angrtvb" => [0x022BE],
+ "angrtvbd" => [0x0299D],
+ "angsph" => [0x02222],
+ "angst" => [0x000C5],
+ "angzarr" => [0x0237C],
+ "aogon" => [0x00105],
+ "aopf" => [0x1D552],
+ "ap" => [0x02248],
+ "apE" => [0x02A70],
+ "apacir" => [0x02A6F],
+ "ape" => [0x0224A],
+ "apid" => [0x0224B],
+ "apos" => [0x00027],
+ "approx" => [0x02248],
+ "approxeq" => [0x0224A],
+ "aring" => [0x000E5],
+ "ascr" => [0x1D4B6],
+ "ast" => [0x0002A],
+ "asymp" => [0x02248],
+ "asympeq" => [0x0224D],
+ "atilde" => [0x000E3],
+ "auml" => [0x000E4],
+ "awconint" => [0x02233],
+ "awint" => [0x02A11],
+ "bNot" => [0x02AED],
+ "backcong" => [0x0224C],
+ "backepsilon" => [0x003F6],
+ "backprime" => [0x02035],
+ "backsim" => [0x0223D],
+ "backsimeq" => [0x022CD],
+ "barvee" => [0x022BD],
+ "barwed" => [0x02305],
+ "barwedge" => [0x02305],
+ "bbrk" => [0x023B5],
+ "bbrktbrk" => [0x023B6],
+ "bcong" => [0x0224C],
+ "bcy" => [0x00431],
+ "bdquo" => [0x0201E],
+ "becaus" => [0x02235],
+ "because" => [0x02235],
+ "bemptyv" => [0x029B0],
+ "bepsi" => [0x003F6],
+ "bernou" => [0x0212C],
+ "beta" => [0x003B2],
+ "beth" => [0x02136],
+ "between" => [0x0226C],
+ "bfr" => [0x1D51F],
+ "bigcap" => [0x022C2],
+ "bigcirc" => [0x025EF],
+ "bigcup" => [0x022C3],
+ "bigodot" => [0x02A00],
+ "bigoplus" => [0x02A01],
+ "bigotimes" => [0x02A02],
+ "bigsqcup" => [0x02A06],
+ "bigstar" => [0x02605],
+ "bigtriangledown" => [0x025BD],
+ "bigtriangleup" => [0x025B3],
+ "biguplus" => [0x02A04],
+ "bigvee" => [0x022C1],
+ "bigwedge" => [0x022C0],
+ "bkarow" => [0x0290D],
+ "blacklozenge" => [0x029EB],
+ "blacksquare" => [0x025AA],
+ "blacktriangle" => [0x025B4],
+ "blacktriangledown" => [0x025BE],
+ "blacktriangleleft" => [0x025C2],
+ "blacktriangleright" => [0x025B8],
+ "blank" => [0x02423],
+ "blk12" => [0x02592],
+ "blk14" => [0x02591],
+ "blk34" => [0x02593],
+ "block" => [0x02588],
+ "bne" => [0x0003D, 0x020E5],
+ "bnequiv" => [0x02261, 0x020E5],
+ "bnot" => [0x02310],
+ "bopf" => [0x1D553],
+ "bot" => [0x022A5],
+ "bottom" => [0x022A5],
+ "bowtie" => [0x022C8],
+ "boxDL" => [0x02557],
+ "boxDR" => [0x02554],
+ "boxDl" => [0x02556],
+ "boxDr" => [0x02553],
+ "boxH" => [0x02550],
+ "boxHD" => [0x02566],
+ "boxHU" => [0x02569],
+ "boxHd" => [0x02564],
+ "boxHu" => [0x02567],
+ "boxUL" => [0x0255D],
+ "boxUR" => [0x0255A],
+ "boxUl" => [0x0255C],
+ "boxUr" => [0x02559],
+ "boxV" => [0x02551],
+ "boxVH" => [0x0256C],
+ "boxVL" => [0x02563],
+ "boxVR" => [0x02560],
+ "boxVh" => [0x0256B],
+ "boxVl" => [0x02562],
+ "boxVr" => [0x0255F],
+ "boxbox" => [0x029C9],
+ "boxdL" => [0x02555],
+ "boxdR" => [0x02552],
+ "boxdl" => [0x02510],
+ "boxdr" => [0x0250C],
+ "boxh" => [0x02500],
+ "boxhD" => [0x02565],
+ "boxhU" => [0x02568],
+ "boxhd" => [0x0252C],
+ "boxhu" => [0x02534],
+ "boxminus" => [0x0229F],
+ "boxplus" => [0x0229E],
+ "boxtimes" => [0x022A0],
+ "boxuL" => [0x0255B],
+ "boxuR" => [0x02558],
+ "boxul" => [0x02518],
+ "boxur" => [0x02514],
+ "boxv" => [0x02502],
+ "boxvH" => [0x0256A],
+ "boxvL" => [0x02561],
+ "boxvR" => [0x0255E],
+ "boxvh" => [0x0253C],
+ "boxvl" => [0x02524],
+ "boxvr" => [0x0251C],
+ "bprime" => [0x02035],
+ "breve" => [0x002D8],
+ "brvbar" => [0x000A6],
+ "bscr" => [0x1D4B7],
+ "bsemi" => [0x0204F],
+ "bsim" => [0x0223D],
+ "bsime" => [0x022CD],
+ "bsol" => [0x0005C],
+ "bsolb" => [0x029C5],
+ "bsolhsub" => [0x027C8],
+ "bull" => [0x02022],
+ "bullet" => [0x02022],
+ "bump" => [0x0224E],
+ "bumpE" => [0x02AAE],
+ "bumpe" => [0x0224F],
+ "bumpeq" => [0x0224F],
+ "cacute" => [0x00107],
+ "cap" => [0x02229],
+ "capand" => [0x02A44],
+ "capbrcup" => [0x02A49],
+ "capcap" => [0x02A4B],
+ "capcup" => [0x02A47],
+ "capdot" => [0x02A40],
+ "caps" => [0x02229, 0x0FE00],
+ "caret" => [0x02041],
+ "caron" => [0x002C7],
+ "ccaps" => [0x02A4D],
+ "ccaron" => [0x0010D],
+ "ccedil" => [0x000E7],
+ "ccirc" => [0x00109],
+ "ccups" => [0x02A4C],
+ "ccupssm" => [0x02A50],
+ "cdot" => [0x0010B],
+ "cedil" => [0x000B8],
+ "cemptyv" => [0x029B2],
+ "cent" => [0x000A2],
+ "centerdot" => [0x000B7],
+ "cfr" => [0x1D520],
+ "chcy" => [0x00447],
+ "check" => [0x02713],
+ "checkmark" => [0x02713],
+ "chi" => [0x003C7],
+ "cir" => [0x025CB],
+ "cirE" => [0x029C3],
+ "circ" => [0x002C6],
+ "circeq" => [0x02257],
+ "circlearrowleft" => [0x021BA],
+ "circlearrowright" => [0x021BB],
+ "circledR" => [0x000AE],
+ "circledS" => [0x024C8],
+ "circledast" => [0x0229B],
+ "circledcirc" => [0x0229A],
+ "circleddash" => [0x0229D],
+ "cire" => [0x02257],
+ "cirfnint" => [0x02A10],
+ "cirmid" => [0x02AEF],
+ "cirscir" => [0x029C2],
+ "clubs" => [0x02663],
+ "clubsuit" => [0x02663],
+ "colon" => [0x0003A],
+ "colone" => [0x02254],
+ "coloneq" => [0x02254],
+ "comma" => [0x0002C],
+ "commat" => [0x00040],
+ "comp" => [0x02201],
+ "compfn" => [0x02218],
+ "complement" => [0x02201],
+ "complexes" => [0x02102],
+ "cong" => [0x02245],
+ "congdot" => [0x02A6D],
+ "conint" => [0x0222E],
+ "copf" => [0x1D554],
+ "coprod" => [0x02210],
+ "copy" => [0x000A9],
+ "copysr" => [0x02117],
+ "crarr" => [0x021B5],
+ "cross" => [0x02717],
+ "cscr" => [0x1D4B8],
+ "csub" => [0x02ACF],
+ "csube" => [0x02AD1],
+ "csup" => [0x02AD0],
+ "csupe" => [0x02AD2],
+ "ctdot" => [0x022EF],
+ "cudarrl" => [0x02938],
+ "cudarrr" => [0x02935],
+ "cuepr" => [0x022DE],
+ "cuesc" => [0x022DF],
+ "cularr" => [0x021B6],
+ "cularrp" => [0x0293D],
+ "cup" => [0x0222A],
+ "cupbrcap" => [0x02A48],
+ "cupcap" => [0x02A46],
+ "cupcup" => [0x02A4A],
+ "cupdot" => [0x0228D],
+ "cupor" => [0x02A45],
+ "cups" => [0x0222A, 0x0FE00],
+ "curarr" => [0x021B7],
+ "curarrm" => [0x0293C],
+ "curlyeqprec" => [0x022DE],
+ "curlyeqsucc" => [0x022DF],
+ "curlyvee" => [0x022CE],
+ "curlywedge" => [0x022CF],
+ "curren" => [0x000A4],
+ "curvearrowleft" => [0x021B6],
+ "curvearrowright" => [0x021B7],
+ "cuvee" => [0x022CE],
+ "cuwed" => [0x022CF],
+ "cwconint" => [0x02232],
+ "cwint" => [0x02231],
+ "cylcty" => [0x0232D],
+ "dArr" => [0x021D3],
+ "dHar" => [0x02965],
+ "dagger" => [0x02020],
+ "daleth" => [0x02138],
+ "darr" => [0x02193],
+ "dash" => [0x02010],
+ "dashv" => [0x022A3],
+ "dbkarow" => [0x0290F],
+ "dblac" => [0x002DD],
+ "dcaron" => [0x0010F],
+ "dcy" => [0x00434],
+ "dd" => [0x02146],
+ "ddagger" => [0x02021],
+ "ddarr" => [0x021CA],
+ "ddotseq" => [0x02A77],
+ "deg" => [0x000B0],
+ "delta" => [0x003B4],
+ "demptyv" => [0x029B1],
+ "dfisht" => [0x0297F],
+ "dfr" => [0x1D521],
+ "dharl" => [0x021C3],
+ "dharr" => [0x021C2],
+ "diam" => [0x022C4],
+ "diamond" => [0x022C4],
+ "diamondsuit" => [0x02666],
+ "diams" => [0x02666],
+ "die" => [0x000A8],
+ "digamma" => [0x003DD],
+ "disin" => [0x022F2],
+ "div" => [0x000F7],
+ "divide" => [0x000F7],
+ "divideontimes" => [0x022C7],
+ "divonx" => [0x022C7],
+ "djcy" => [0x00452],
+ "dlcorn" => [0x0231E],
+ "dlcrop" => [0x0230D],
+ "dollar" => [0x00024],
+ "dopf" => [0x1D555],
+ "dot" => [0x002D9],
+ "doteq" => [0x02250],
+ "doteqdot" => [0x02251],
+ "dotminus" => [0x02238],
+ "dotplus" => [0x02214],
+ "dotsquare" => [0x022A1],
+ "doublebarwedge" => [0x02306],
+ "downarrow" => [0x02193],
+ "downdownarrows" => [0x021CA],
+ "downharpoonleft" => [0x021C3],
+ "downharpoonright" => [0x021C2],
+ "drbkarow" => [0x02910],
+ "drcorn" => [0x0231F],
+ "drcrop" => [0x0230C],
+ "dscr" => [0x1D4B9],
+ "dscy" => [0x00455],
+ "dsol" => [0x029F6],
+ "dstrok" => [0x00111],
+ "dtdot" => [0x022F1],
+ "dtri" => [0x025BF],
+ "dtrif" => [0x025BE],
+ "duarr" => [0x021F5],
+ "duhar" => [0x0296F],
+ "dwangle" => [0x029A6],
+ "dzcy" => [0x0045F],
+ "dzigrarr" => [0x027FF],
+ "eDDot" => [0x02A77],
+ "eDot" => [0x02251],
+ "eacute" => [0x000E9],
+ "easter" => [0x02A6E],
+ "ecaron" => [0x0011B],
+ "ecir" => [0x02256],
+ "ecirc" => [0x000EA],
+ "ecolon" => [0x02255],
+ "ecy" => [0x0044D],
+ "edot" => [0x00117],
+ "ee" => [0x02147],
+ "efDot" => [0x02252],
+ "efr" => [0x1D522],
+ "eg" => [0x02A9A],
+ "egrave" => [0x000E8],
+ "egs" => [0x02A96],
+ "egsdot" => [0x02A98],
+ "el" => [0x02A99],
+ "elinters" => [0x023E7],
+ "ell" => [0x02113],
+ "els" => [0x02A95],
+ "elsdot" => [0x02A97],
+ "emacr" => [0x00113],
+ "empty" => [0x02205],
+ "emptyset" => [0x02205],
+ "emptyv" => [0x02205],
+ "emsp" => [0x02003],
+ "emsp13" => [0x02004],
+ "emsp14" => [0x02005],
+ "eng" => [0x0014B],
+ "ensp" => [0x02002],
+ "eogon" => [0x00119],
+ "eopf" => [0x1D556],
+ "epar" => [0x022D5],
+ "eparsl" => [0x029E3],
+ "eplus" => [0x02A71],
+ "epsi" => [0x003B5],
+ "epsilon" => [0x003B5],
+ "epsiv" => [0x003F5],
+ "eqcirc" => [0x02256],
+ "eqcolon" => [0x02255],
+ "eqsim" => [0x02242],
+ "eqslantgtr" => [0x02A96],
+ "eqslantless" => [0x02A95],
+ "equals" => [0x0003D],
+ "equest" => [0x0225F],
+ "equiv" => [0x02261],
+ "equivDD" => [0x02A78],
+ "eqvparsl" => [0x029E5],
+ "erDot" => [0x02253],
+ "erarr" => [0x02971],
+ "escr" => [0x0212F],
+ "esdot" => [0x02250],
+ "esim" => [0x02242],
+ "eta" => [0x003B7],
+ "eth" => [0x000F0],
+ "euml" => [0x000EB],
+ "euro" => [0x020AC],
+ "excl" => [0x00021],
+ "exist" => [0x02203],
+ "expectation" => [0x02130],
+ "exponentiale" => [0x02147],
+ "fallingdotseq" => [0x02252],
+ "fcy" => [0x00444],
+ "female" => [0x02640],
+ "ffilig" => [0x0FB03],
+ "fflig" => [0x0FB00],
+ "ffllig" => [0x0FB04],
+ "ffr" => [0x1D523],
+ "filig" => [0x0FB01],
+ "fjlig" => [0x00066, 0x0006A],
+ "flat" => [0x0266D],
+ "fllig" => [0x0FB02],
+ "fltns" => [0x025B1],
+ "fnof" => [0x00192],
+ "fopf" => [0x1D557],
+ "forall" => [0x02200],
+ "fork" => [0x022D4],
+ "forkv" => [0x02AD9],
+ "fpartint" => [0x02A0D],
+ "frac12" => [0x000BD],
+ "frac13" => [0x02153],
+ "frac14" => [0x000BC],
+ "frac15" => [0x02155],
+ "frac16" => [0x02159],
+ "frac18" => [0x0215B],
+ "frac23" => [0x02154],
+ "frac25" => [0x02156],
+ "frac34" => [0x000BE],
+ "frac35" => [0x02157],
+ "frac38" => [0x0215C],
+ "frac45" => [0x02158],
+ "frac56" => [0x0215A],
+ "frac58" => [0x0215D],
+ "frac78" => [0x0215E],
+ "frasl" => [0x02044],
+ "frown" => [0x02322],
+ "fscr" => [0x1D4BB],
+ "gE" => [0x02267],
+ "gEl" => [0x02A8C],
+ "gacute" => [0x001F5],
+ "gamma" => [0x003B3],
+ "gammad" => [0x003DD],
+ "gap" => [0x02A86],
+ "gbreve" => [0x0011F],
+ "gcirc" => [0x0011D],
+ "gcy" => [0x00433],
+ "gdot" => [0x00121],
+ "ge" => [0x02265],
+ "gel" => [0x022DB],
+ "geq" => [0x02265],
+ "geqq" => [0x02267],
+ "geqslant" => [0x02A7E],
+ "ges" => [0x02A7E],
+ "gescc" => [0x02AA9],
+ "gesdot" => [0x02A80],
+ "gesdoto" => [0x02A82],
+ "gesdotol" => [0x02A84],
+ "gesl" => [0x022DB, 0x0FE00],
+ "gesles" => [0x02A94],
+ "gfr" => [0x1D524],
+ "gg" => [0x0226B],
+ "ggg" => [0x022D9],
+ "gimel" => [0x02137],
+ "gjcy" => [0x00453],
+ "gl" => [0x02277],
+ "glE" => [0x02A92],
+ "gla" => [0x02AA5],
+ "glj" => [0x02AA4],
+ "gnE" => [0x02269],
+ "gnap" => [0x02A8A],
+ "gnapprox" => [0x02A8A],
+ "gne" => [0x02A88],
+ "gneq" => [0x02A88],
+ "gneqq" => [0x02269],
+ "gnsim" => [0x022E7],
+ "gopf" => [0x1D558],
+ "grave" => [0x00060],
+ "gscr" => [0x0210A],
+ "gsim" => [0x02273],
+ "gsime" => [0x02A8E],
+ "gsiml" => [0x02A90],
+ "gt" => [0x0003E],
+ "gtcc" => [0x02AA7],
+ "gtcir" => [0x02A7A],
+ "gtdot" => [0x022D7],
+ "gtlPar" => [0x02995],
+ "gtquest" => [0x02A7C],
+ "gtrapprox" => [0x02A86],
+ "gtrarr" => [0x02978],
+ "gtrdot" => [0x022D7],
+ "gtreqless" => [0x022DB],
+ "gtreqqless" => [0x02A8C],
+ "gtrless" => [0x02277],
+ "gtrsim" => [0x02273],
+ "gvertneqq" => [0x02269, 0x0FE00],
+ "gvnE" => [0x02269, 0x0FE00],
+ "hArr" => [0x021D4],
+ "hairsp" => [0x0200A],
+ "half" => [0x000BD],
+ "hamilt" => [0x0210B],
+ "hardcy" => [0x0044A],
+ "harr" => [0x02194],
+ "harrcir" => [0x02948],
+ "harrw" => [0x021AD],
+ "hbar" => [0x0210F],
+ "hcirc" => [0x00125],
+ "hearts" => [0x02665],
+ "heartsuit" => [0x02665],
+ "hellip" => [0x02026],
+ "hercon" => [0x022B9],
+ "hfr" => [0x1D525],
+ "hksearow" => [0x02925],
+ "hkswarow" => [0x02926],
+ "hoarr" => [0x021FF],
+ "homtht" => [0x0223B],
+ "hookleftarrow" => [0x021A9],
+ "hookrightarrow" => [0x021AA],
+ "hopf" => [0x1D559],
+ "horbar" => [0x02015],
+ "hscr" => [0x1D4BD],
+ "hslash" => [0x0210F],
+ "hstrok" => [0x00127],
+ "hybull" => [0x02043],
+ "hyphen" => [0x02010],
+ "iacute" => [0x000ED],
+ "ic" => [0x02063],
+ "icirc" => [0x000EE],
+ "icy" => [0x00438],
+ "iecy" => [0x00435],
+ "iexcl" => [0x000A1],
+ "iff" => [0x021D4],
+ "ifr" => [0x1D526],
+ "igrave" => [0x000EC],
+ "ii" => [0x02148],
+ "iiiint" => [0x02A0C],
+ "iiint" => [0x0222D],
+ "iinfin" => [0x029DC],
+ "iiota" => [0x02129],
+ "ijlig" => [0x00133],
+ "imacr" => [0x0012B],
+ "image" => [0x02111],
+ "imagline" => [0x02110],
+ "imagpart" => [0x02111],
+ "imath" => [0x00131],
+ "imof" => [0x022B7],
+ "imped" => [0x001B5],
+ "in" => [0x02208],
+ "incare" => [0x02105],
+ "infin" => [0x0221E],
+ "infintie" => [0x029DD],
+ "inodot" => [0x00131],
+ "int" => [0x0222B],
+ "intcal" => [0x022BA],
+ "integers" => [0x02124],
+ "intercal" => [0x022BA],
+ "intlarhk" => [0x02A17],
+ "intprod" => [0x02A3C],
+ "iocy" => [0x00451],
+ "iogon" => [0x0012F],
+ "iopf" => [0x1D55A],
+ "iota" => [0x003B9],
+ "iprod" => [0x02A3C],
+ "iquest" => [0x000BF],
+ "iscr" => [0x1D4BE],
+ "isin" => [0x02208],
+ "isinE" => [0x022F9],
+ "isindot" => [0x022F5],
+ "isins" => [0x022F4],
+ "isinsv" => [0x022F3],
+ "isinv" => [0x02208],
+ "it" => [0x02062],
+ "itilde" => [0x00129],
+ "iukcy" => [0x00456],
+ "iuml" => [0x000EF],
+ "jcirc" => [0x00135],
+ "jcy" => [0x00439],
+ "jfr" => [0x1D527],
+ "jmath" => [0x00237],
+ "jopf" => [0x1D55B],
+ "jscr" => [0x1D4BF],
+ "jsercy" => [0x00458],
+ "jukcy" => [0x00454],
+ "kappa" => [0x003BA],
+ "kappav" => [0x003F0],
+ "kcedil" => [0x00137],
+ "kcy" => [0x0043A],
+ "kfr" => [0x1D528],
+ "kgreen" => [0x00138],
+ "khcy" => [0x00445],
+ "kjcy" => [0x0045C],
+ "kopf" => [0x1D55C],
+ "kscr" => [0x1D4C0],
+ "lAarr" => [0x021DA],
+ "lArr" => [0x021D0],
+ "lAtail" => [0x0291B],
+ "lBarr" => [0x0290E],
+ "lE" => [0x02266],
+ "lEg" => [0x02A8B],
+ "lHar" => [0x02962],
+ "lacute" => [0x0013A],
+ "laemptyv" => [0x029B4],
+ "lagran" => [0x02112],
+ "lambda" => [0x003BB],
+ "lang" => [0x027E8],
+ "langd" => [0x02991],
+ "langle" => [0x027E8],
+ "lap" => [0x02A85],
+ "laquo" => [0x000AB],
+ "larr" => [0x02190],
+ "larrb" => [0x021E4],
+ "larrbfs" => [0x0291F],
+ "larrfs" => [0x0291D],
+ "larrhk" => [0x021A9],
+ "larrlp" => [0x021AB],
+ "larrpl" => [0x02939],
+ "larrsim" => [0x02973],
+ "larrtl" => [0x021A2],
+ "lat" => [0x02AAB],
+ "latail" => [0x02919],
+ "late" => [0x02AAD],
+ "lates" => [0x02AAD, 0x0FE00],
+ "lbarr" => [0x0290C],
+ "lbbrk" => [0x02772],
+ "lbrace" => [0x0007B],
+ "lbrack" => [0x0005B],
+ "lbrke" => [0x0298B],
+ "lbrksld" => [0x0298F],
+ "lbrkslu" => [0x0298D],
+ "lcaron" => [0x0013E],
+ "lcedil" => [0x0013C],
+ "lceil" => [0x02308],
+ "lcub" => [0x0007B],
+ "lcy" => [0x0043B],
+ "ldca" => [0x02936],
+ "ldquo" => [0x0201C],
+ "ldquor" => [0x0201E],
+ "ldrdhar" => [0x02967],
+ "ldrushar" => [0x0294B],
+ "ldsh" => [0x021B2],
+ "le" => [0x02264],
+ "leftarrow" => [0x02190],
+ "leftarrowtail" => [0x021A2],
+ "leftharpoondown" => [0x021BD],
+ "leftharpoonup" => [0x021BC],
+ "leftleftarrows" => [0x021C7],
+ "leftrightarrow" => [0x02194],
+ "leftrightarrows" => [0x021C6],
+ "leftrightharpoons" => [0x021CB],
+ "leftrightsquigarrow" => [0x021AD],
+ "leftthreetimes" => [0x022CB],
+ "leg" => [0x022DA],
+ "leq" => [0x02264],
+ "leqq" => [0x02266],
+ "leqslant" => [0x02A7D],
+ "les" => [0x02A7D],
+ "lescc" => [0x02AA8],
+ "lesdot" => [0x02A7F],
+ "lesdoto" => [0x02A81],
+ "lesdotor" => [0x02A83],
+ "lesg" => [0x022DA, 0x0FE00],
+ "lesges" => [0x02A93],
+ "lessapprox" => [0x02A85],
+ "lessdot" => [0x022D6],
+ "lesseqgtr" => [0x022DA],
+ "lesseqqgtr" => [0x02A8B],
+ "lessgtr" => [0x02276],
+ "lesssim" => [0x02272],
+ "lfisht" => [0x0297C],
+ "lfloor" => [0x0230A],
+ "lfr" => [0x1D529],
+ "lg" => [0x02276],
+ "lgE" => [0x02A91],
+ "lhard" => [0x021BD],
+ "lharu" => [0x021BC],
+ "lharul" => [0x0296A],
+ "lhblk" => [0x02584],
+ "ljcy" => [0x00459],
+ "ll" => [0x0226A],
+ "llarr" => [0x021C7],
+ "llcorner" => [0x0231E],
+ "llhard" => [0x0296B],
+ "lltri" => [0x025FA],
+ "lmidot" => [0x00140],
+ "lmoust" => [0x023B0],
+ "lmoustache" => [0x023B0],
+ "lnE" => [0x02268],
+ "lnap" => [0x02A89],
+ "lnapprox" => [0x02A89],
+ "lne" => [0x02A87],
+ "lneq" => [0x02A87],
+ "lneqq" => [0x02268],
+ "lnsim" => [0x022E6],
+ "loang" => [0x027EC],
+ "loarr" => [0x021FD],
+ "lobrk" => [0x027E6],
+ "longleftarrow" => [0x027F5],
+ "longleftrightarrow" => [0x027F7],
+ "longmapsto" => [0x027FC],
+ "longrightarrow" => [0x027F6],
+ "looparrowleft" => [0x021AB],
+ "looparrowright" => [0x021AC],
+ "lopar" => [0x02985],
+ "lopf" => [0x1D55D],
+ "loplus" => [0x02A2D],
+ "lotimes" => [0x02A34],
+ "lowast" => [0x02217],
+ "lowbar" => [0x0005F],
+ "loz" => [0x025CA],
+ "lozenge" => [0x025CA],
+ "lozf" => [0x029EB],
+ "lpar" => [0x00028],
+ "lparlt" => [0x02993],
+ "lrarr" => [0x021C6],
+ "lrcorner" => [0x0231F],
+ "lrhar" => [0x021CB],
+ "lrhard" => [0x0296D],
+ "lrm" => [0x0200E],
+ "lrtri" => [0x022BF],
+ "lsaquo" => [0x02039],
+ "lscr" => [0x1D4C1],
+ "lsh" => [0x021B0],
+ "lsim" => [0x02272],
+ "lsime" => [0x02A8D],
+ "lsimg" => [0x02A8F],
+ "lsqb" => [0x0005B],
+ "lsquo" => [0x02018],
+ "lsquor" => [0x0201A],
+ "lstrok" => [0x00142],
+ "lt" => [0x0003C],
+ "ltcc" => [0x02AA6],
+ "ltcir" => [0x02A79],
+ "ltdot" => [0x022D6],
+ "lthree" => [0x022CB],
+ "ltimes" => [0x022C9],
+ "ltlarr" => [0x02976],
+ "ltquest" => [0x02A7B],
+ "ltrPar" => [0x02996],
+ "ltri" => [0x025C3],
+ "ltrie" => [0x022B4],
+ "ltrif" => [0x025C2],
+ "lurdshar" => [0x0294A],
+ "luruhar" => [0x02966],
+ "lvertneqq" => [0x02268, 0x0FE00],
+ "lvnE" => [0x02268, 0x0FE00],
+ "mDDot" => [0x0223A],
+ "macr" => [0x000AF],
+ "male" => [0x02642],
+ "malt" => [0x02720],
+ "maltese" => [0x02720],
+ "map" => [0x021A6],
+ "mapsto" => [0x021A6],
+ "mapstodown" => [0x021A7],
+ "mapstoleft" => [0x021A4],
+ "mapstoup" => [0x021A5],
+ "marker" => [0x025AE],
+ "mcomma" => [0x02A29],
+ "mcy" => [0x0043C],
+ "mdash" => [0x02014],
+ "measuredangle" => [0x02221],
+ "mfr" => [0x1D52A],
+ "mho" => [0x02127],
+ "micro" => [0x000B5],
+ "mid" => [0x02223],
+ "midast" => [0x0002A],
+ "midcir" => [0x02AF0],
+ "middot" => [0x000B7],
+ "minus" => [0x02212],
+ "minusb" => [0x0229F],
+ "minusd" => [0x02238],
+ "minusdu" => [0x02A2A],
+ "mlcp" => [0x02ADB],
+ "mldr" => [0x02026],
+ "mnplus" => [0x02213],
+ "models" => [0x022A7],
+ "mopf" => [0x1D55E],
+ "mp" => [0x02213],
+ "mscr" => [0x1D4C2],
+ "mstpos" => [0x0223E],
+ "mu" => [0x003BC],
+ "multimap" => [0x022B8],
+ "mumap" => [0x022B8],
+ "nGg" => [0x022D9, 0x00338],
+ "nGt" => [0x0226B, 0x020D2],
+ "nGtv" => [0x0226B, 0x00338],
+ "nLeftarrow" => [0x021CD],
+ "nLeftrightarrow" => [0x021CE],
+ "nLl" => [0x022D8, 0x00338],
+ "nLt" => [0x0226A, 0x020D2],
+ "nLtv" => [0x0226A, 0x00338],
+ "nRightarrow" => [0x021CF],
+ "nVDash" => [0x022AF],
+ "nVdash" => [0x022AE],
+ "nabla" => [0x02207],
+ "nacute" => [0x00144],
+ "nang" => [0x02220, 0x020D2],
+ "nap" => [0x02249],
+ "napE" => [0x02A70, 0x00338],
+ "napid" => [0x0224B, 0x00338],
+ "napos" => [0x00149],
+ "napprox" => [0x02249],
+ "natur" => [0x0266E],
+ "natural" => [0x0266E],
+ "naturals" => [0x02115],
+ "nbsp" => [0x000A0],
+ "nbump" => [0x0224E, 0x00338],
+ "nbumpe" => [0x0224F, 0x00338],
+ "ncap" => [0x02A43],
+ "ncaron" => [0x00148],
+ "ncedil" => [0x00146],
+ "ncong" => [0x02247],
+ "ncongdot" => [0x02A6D, 0x00338],
+ "ncup" => [0x02A42],
+ "ncy" => [0x0043D],
+ "ndash" => [0x02013],
+ "ne" => [0x02260],
+ "neArr" => [0x021D7],
+ "nearhk" => [0x02924],
+ "nearr" => [0x02197],
+ "nearrow" => [0x02197],
+ "nedot" => [0x02250, 0x00338],
+ "nequiv" => [0x02262],
+ "nesear" => [0x02928],
+ "nesim" => [0x02242, 0x00338],
+ "nexist" => [0x02204],
+ "nexists" => [0x02204],
+ "nfr" => [0x1D52B],
+ "ngE" => [0x02267, 0x00338],
+ "nge" => [0x02271],
+ "ngeq" => [0x02271],
+ "ngeqq" => [0x02267, 0x00338],
+ "ngeqslant" => [0x02A7E, 0x00338],
+ "nges" => [0x02A7E, 0x00338],
+ "ngsim" => [0x02275],
+ "ngt" => [0x0226F],
+ "ngtr" => [0x0226F],
+ "nhArr" => [0x021CE],
+ "nharr" => [0x021AE],
+ "nhpar" => [0x02AF2],
+ "ni" => [0x0220B],
+ "nis" => [0x022FC],
+ "nisd" => [0x022FA],
+ "niv" => [0x0220B],
+ "njcy" => [0x0045A],
+ "nlArr" => [0x021CD],
+ "nlE" => [0x02266, 0x00338],
+ "nlarr" => [0x0219A],
+ "nldr" => [0x02025],
+ "nle" => [0x02270],
+ "nleftarrow" => [0x0219A],
+ "nleftrightarrow" => [0x021AE],
+ "nleq" => [0x02270],
+ "nleqq" => [0x02266, 0x00338],
+ "nleqslant" => [0x02A7D, 0x00338],
+ "nles" => [0x02A7D, 0x00338],
+ "nless" => [0x0226E],
+ "nlsim" => [0x02274],
+ "nlt" => [0x0226E],
+ "nltri" => [0x022EA],
+ "nltrie" => [0x022EC],
+ "nmid" => [0x02224],
+ "nopf" => [0x1D55F],
+ "not" => [0x000AC],
+ "notin" => [0x02209],
+ "notinE" => [0x022F9, 0x00338],
+ "notindot" => [0x022F5, 0x00338],
+ "notinva" => [0x02209],
+ "notinvb" => [0x022F7],
+ "notinvc" => [0x022F6],
+ "notni" => [0x0220C],
+ "notniva" => [0x0220C],
+ "notnivb" => [0x022FE],
+ "notnivc" => [0x022FD],
+ "npar" => [0x02226],
+ "nparallel" => [0x02226],
+ "nparsl" => [0x02AFD, 0x020E5],
+ "npart" => [0x02202, 0x00338],
+ "npolint" => [0x02A14],
+ "npr" => [0x02280],
+ "nprcue" => [0x022E0],
+ "npre" => [0x02AAF, 0x00338],
+ "nprec" => [0x02280],
+ "npreceq" => [0x02AAF, 0x00338],
+ "nrArr" => [0x021CF],
+ "nrarr" => [0x0219B],
+ "nrarrc" => [0x02933, 0x00338],
+ "nrarrw" => [0x0219D, 0x00338],
+ "nrightarrow" => [0x0219B],
+ "nrtri" => [0x022EB],
+ "nrtrie" => [0x022ED],
+ "nsc" => [0x02281],
+ "nsccue" => [0x022E1],
+ "nsce" => [0x02AB0, 0x00338],
+ "nscr" => [0x1D4C3],
+ "nshortmid" => [0x02224],
+ "nshortparallel" => [0x02226],
+ "nsim" => [0x02241],
+ "nsime" => [0x02244],
+ "nsimeq" => [0x02244],
+ "nsmid" => [0x02224],
+ "nspar" => [0x02226],
+ "nsqsube" => [0x022E2],
+ "nsqsupe" => [0x022E3],
+ "nsub" => [0x02284],
+ "nsubE" => [0x02AC5, 0x00338],
+ "nsube" => [0x02288],
+ "nsubset" => [0x02282, 0x020D2],
+ "nsubseteq" => [0x02288],
+ "nsubseteqq" => [0x02AC5, 0x00338],
+ "nsucc" => [0x02281],
+ "nsucceq" => [0x02AB0, 0x00338],
+ "nsup" => [0x02285],
+ "nsupE" => [0x02AC6, 0x00338],
+ "nsupe" => [0x02289],
+ "nsupset" => [0x02283, 0x020D2],
+ "nsupseteq" => [0x02289],
+ "nsupseteqq" => [0x02AC6, 0x00338],
+ "ntgl" => [0x02279],
+ "ntilde" => [0x000F1],
+ "ntlg" => [0x02278],
+ "ntriangleleft" => [0x022EA],
+ "ntrianglelefteq" => [0x022EC],
+ "ntriangleright" => [0x022EB],
+ "ntrianglerighteq" => [0x022ED],
+ "nu" => [0x003BD],
+ "num" => [0x00023],
+ "numero" => [0x02116],
+ "numsp" => [0x02007],
+ "nvDash" => [0x022AD],
+ "nvHarr" => [0x02904],
+ "nvap" => [0x0224D, 0x020D2],
+ "nvdash" => [0x022AC],
+ "nvge" => [0x02265, 0x020D2],
+ "nvgt" => [0x0003E, 0x020D2],
+ "nvinfin" => [0x029DE],
+ "nvlArr" => [0x02902],
+ "nvle" => [0x02264, 0x020D2],
+ "nvlt" => [0x0003C, 0x020D2],
+ "nvltrie" => [0x022B4, 0x020D2],
+ "nvrArr" => [0x02903],
+ "nvrtrie" => [0x022B5, 0x020D2],
+ "nvsim" => [0x0223C, 0x020D2],
+ "nwArr" => [0x021D6],
+ "nwarhk" => [0x02923],
+ "nwarr" => [0x02196],
+ "nwarrow" => [0x02196],
+ "nwnear" => [0x02927],
+ "oS" => [0x024C8],
+ "oacute" => [0x000F3],
+ "oast" => [0x0229B],
+ "ocir" => [0x0229A],
+ "ocirc" => [0x000F4],
+ "ocy" => [0x0043E],
+ "odash" => [0x0229D],
+ "odblac" => [0x00151],
+ "odiv" => [0x02A38],
+ "odot" => [0x02299],
+ "odsold" => [0x029BC],
+ "oelig" => [0x00153],
+ "ofcir" => [0x029BF],
+ "ofr" => [0x1D52C],
+ "ogon" => [0x002DB],
+ "ograve" => [0x000F2],
+ "ogt" => [0x029C1],
+ "ohbar" => [0x029B5],
+ "ohm" => [0x003A9],
+ "oint" => [0x0222E],
+ "olarr" => [0x021BA],
+ "olcir" => [0x029BE],
+ "olcross" => [0x029BB],
+ "oline" => [0x0203E],
+ "olt" => [0x029C0],
+ "omacr" => [0x0014D],
+ "omega" => [0x003C9],
+ "omicron" => [0x003BF],
+ "omid" => [0x029B6],
+ "ominus" => [0x02296],
+ "oopf" => [0x1D560],
+ "opar" => [0x029B7],
+ "operp" => [0x029B9],
+ "oplus" => [0x02295],
+ "or" => [0x02228],
+ "orarr" => [0x021BB],
+ "ord" => [0x02A5D],
+ "order" => [0x02134],
+ "orderof" => [0x02134],
+ "ordf" => [0x000AA],
+ "ordm" => [0x000BA],
+ "origof" => [0x022B6],
+ "oror" => [0x02A56],
+ "orslope" => [0x02A57],
+ "orv" => [0x02A5B],
+ "oscr" => [0x02134],
+ "oslash" => [0x000F8],
+ "osol" => [0x02298],
+ "otilde" => [0x000F5],
+ "otimes" => [0x02297],
+ "otimesas" => [0x02A36],
+ "ouml" => [0x000F6],
+ "ovbar" => [0x0233D],
+ "par" => [0x02225],
+ "para" => [0x000B6],
+ "parallel" => [0x02225],
+ "parsim" => [0x02AF3],
+ "parsl" => [0x02AFD],
+ "part" => [0x02202],
+ "pcy" => [0x0043F],
+ "percnt" => [0x00025],
+ "period" => [0x0002E],
+ "permil" => [0x02030],
+ "perp" => [0x022A5],
+ "pertenk" => [0x02031],
+ "pfr" => [0x1D52D],
+ "phi" => [0x003C6],
+ "phiv" => [0x003D5],
+ "phmmat" => [0x02133],
+ "phone" => [0x0260E],
+ "pi" => [0x003C0],
+ "pitchfork" => [0x022D4],
+ "piv" => [0x003D6],
+ "planck" => [0x0210F],
+ "planckh" => [0x0210E],
+ "plankv" => [0x0210F],
+ "plus" => [0x0002B],
+ "plusacir" => [0x02A23],
+ "plusb" => [0x0229E],
+ "pluscir" => [0x02A22],
+ "plusdo" => [0x02214],
+ "plusdu" => [0x02A25],
+ "pluse" => [0x02A72],
+ "plusmn" => [0x000B1],
+ "plussim" => [0x02A26],
+ "plustwo" => [0x02A27],
+ "pm" => [0x000B1],
+ "pointint" => [0x02A15],
+ "popf" => [0x1D561],
+ "pound" => [0x000A3],
+ "pr" => [0x0227A],
+ "prE" => [0x02AB3],
+ "prap" => [0x02AB7],
+ "prcue" => [0x0227C],
+ "pre" => [0x02AAF],
+ "prec" => [0x0227A],
+ "precapprox" => [0x02AB7],
+ "preccurlyeq" => [0x0227C],
+ "preceq" => [0x02AAF],
+ "precnapprox" => [0x02AB9],
+ "precneqq" => [0x02AB5],
+ "precnsim" => [0x022E8],
+ "precsim" => [0x0227E],
+ "prime" => [0x02032],
+ "primes" => [0x02119],
+ "prnE" => [0x02AB5],
+ "prnap" => [0x02AB9],
+ "prnsim" => [0x022E8],
+ "prod" => [0x0220F],
+ "profalar" => [0x0232E],
+ "profline" => [0x02312],
+ "profsurf" => [0x02313],
+ "prop" => [0x0221D],
+ "propto" => [0x0221D],
+ "prsim" => [0x0227E],
+ "prurel" => [0x022B0],
+ "pscr" => [0x1D4C5],
+ "psi" => [0x003C8],
+ "puncsp" => [0x02008],
+ "qfr" => [0x1D52E],
+ "qint" => [0x02A0C],
+ "qopf" => [0x1D562],
+ "qprime" => [0x02057],
+ "qscr" => [0x1D4C6],
+ "quaternions" => [0x0210D],
+ "quatint" => [0x02A16],
+ "quest" => [0x0003F],
+ "questeq" => [0x0225F],
+ "quot" => [0x00022],
+ "rAarr" => [0x021DB],
+ "rArr" => [0x021D2],
+ "rAtail" => [0x0291C],
+ "rBarr" => [0x0290F],
+ "rHar" => [0x02964],
+ "race" => [0x0223D, 0x00331],
+ "racute" => [0x00155],
+ "radic" => [0x0221A],
+ "raemptyv" => [0x029B3],
+ "rang" => [0x027E9],
+ "rangd" => [0x02992],
+ "range" => [0x029A5],
+ "rangle" => [0x027E9],
+ "raquo" => [0x000BB],
+ "rarr" => [0x02192],
+ "rarrap" => [0x02975],
+ "rarrb" => [0x021E5],
+ "rarrbfs" => [0x02920],
+ "rarrc" => [0x02933],
+ "rarrfs" => [0x0291E],
+ "rarrhk" => [0x021AA],
+ "rarrlp" => [0x021AC],
+ "rarrpl" => [0x02945],
+ "rarrsim" => [0x02974],
+ "rarrtl" => [0x021A3],
+ "rarrw" => [0x0219D],
+ "ratail" => [0x0291A],
+ "ratio" => [0x02236],
+ "rationals" => [0x0211A],
+ "rbarr" => [0x0290D],
+ "rbbrk" => [0x02773],
+ "rbrace" => [0x0007D],
+ "rbrack" => [0x0005D],
+ "rbrke" => [0x0298C],
+ "rbrksld" => [0x0298E],
+ "rbrkslu" => [0x02990],
+ "rcaron" => [0x00159],
+ "rcedil" => [0x00157],
+ "rceil" => [0x02309],
+ "rcub" => [0x0007D],
+ "rcy" => [0x00440],
+ "rdca" => [0x02937],
+ "rdldhar" => [0x02969],
+ "rdquo" => [0x0201D],
+ "rdquor" => [0x0201D],
+ "rdsh" => [0x021B3],
+ "real" => [0x0211C],
+ "realine" => [0x0211B],
+ "realpart" => [0x0211C],
+ "reals" => [0x0211D],
+ "rect" => [0x025AD],
+ "reg" => [0x000AE],
+ "rfisht" => [0x0297D],
+ "rfloor" => [0x0230B],
+ "rfr" => [0x1D52F],
+ "rhard" => [0x021C1],
+ "rharu" => [0x021C0],
+ "rharul" => [0x0296C],
+ "rho" => [0x003C1],
+ "rhov" => [0x003F1],
+ "rightarrow" => [0x02192],
+ "rightarrowtail" => [0x021A3],
+ "rightharpoondown" => [0x021C1],
+ "rightharpoonup" => [0x021C0],
+ "rightleftarrows" => [0x021C4],
+ "rightleftharpoons" => [0x021CC],
+ "rightrightarrows" => [0x021C9],
+ "rightsquigarrow" => [0x0219D],
+ "rightthreetimes" => [0x022CC],
+ "ring" => [0x002DA],
+ "risingdotseq" => [0x02253],
+ "rlarr" => [0x021C4],
+ "rlhar" => [0x021CC],
+ "rlm" => [0x0200F],
+ "rmoust" => [0x023B1],
+ "rmoustache" => [0x023B1],
+ "rnmid" => [0x02AEE],
+ "roang" => [0x027ED],
+ "roarr" => [0x021FE],
+ "robrk" => [0x027E7],
+ "ropar" => [0x02986],
+ "ropf" => [0x1D563],
+ "roplus" => [0x02A2E],
+ "rotimes" => [0x02A35],
+ "rpar" => [0x00029],
+ "rpargt" => [0x02994],
+ "rppolint" => [0x02A12],
+ "rrarr" => [0x021C9],
+ "rsaquo" => [0x0203A],
+ "rscr" => [0x1D4C7],
+ "rsh" => [0x021B1],
+ "rsqb" => [0x0005D],
+ "rsquo" => [0x02019],
+ "rsquor" => [0x02019],
+ "rthree" => [0x022CC],
+ "rtimes" => [0x022CA],
+ "rtri" => [0x025B9],
+ "rtrie" => [0x022B5],
+ "rtrif" => [0x025B8],
+ "rtriltri" => [0x029CE],
+ "ruluhar" => [0x02968],
+ "rx" => [0x0211E],
+ "sacute" => [0x0015B],
+ "sbquo" => [0x0201A],
+ "sc" => [0x0227B],
+ "scE" => [0x02AB4],
+ "scap" => [0x02AB8],
+ "scaron" => [0x00161],
+ "sccue" => [0x0227D],
+ "sce" => [0x02AB0],
+ "scedil" => [0x0015F],
+ "scirc" => [0x0015D],
+ "scnE" => [0x02AB6],
+ "scnap" => [0x02ABA],
+ "scnsim" => [0x022E9],
+ "scpolint" => [0x02A13],
+ "scsim" => [0x0227F],
+ "scy" => [0x00441],
+ "sdot" => [0x022C5],
+ "sdotb" => [0x022A1],
+ "sdote" => [0x02A66],
+ "seArr" => [0x021D8],
+ "searhk" => [0x02925],
+ "searr" => [0x02198],
+ "searrow" => [0x02198],
+ "sect" => [0x000A7],
+ "semi" => [0x0003B],
+ "seswar" => [0x02929],
+ "setminus" => [0x02216],
+ "setmn" => [0x02216],
+ "sext" => [0x02736],
+ "sfr" => [0x1D530],
+ "sfrown" => [0x02322],
+ "sharp" => [0x0266F],
+ "shchcy" => [0x00449],
+ "shcy" => [0x00448],
+ "shortmid" => [0x02223],
+ "shortparallel" => [0x02225],
+ "shy" => [0x000AD],
+ "sigma" => [0x003C3],
+ "sigmaf" => [0x003C2],
+ "sigmav" => [0x003C2],
+ "sim" => [0x0223C],
+ "simdot" => [0x02A6A],
+ "sime" => [0x02243],
+ "simeq" => [0x02243],
+ "simg" => [0x02A9E],
+ "simgE" => [0x02AA0],
+ "siml" => [0x02A9D],
+ "simlE" => [0x02A9F],
+ "simne" => [0x02246],
+ "simplus" => [0x02A24],
+ "simrarr" => [0x02972],
+ "slarr" => [0x02190],
+ "smallsetminus" => [0x02216],
+ "smashp" => [0x02A33],
+ "smeparsl" => [0x029E4],
+ "smid" => [0x02223],
+ "smile" => [0x02323],
+ "smt" => [0x02AAA],
+ "smte" => [0x02AAC],
+ "smtes" => [0x02AAC, 0x0FE00],
+ "softcy" => [0x0044C],
+ "sol" => [0x0002F],
+ "solb" => [0x029C4],
+ "solbar" => [0x0233F],
+ "sopf" => [0x1D564],
+ "spades" => [0x02660],
+ "spadesuit" => [0x02660],
+ "spar" => [0x02225],
+ "sqcap" => [0x02293],
+ "sqcaps" => [0x02293, 0x0FE00],
+ "sqcup" => [0x02294],
+ "sqcups" => [0x02294, 0x0FE00],
+ "sqsub" => [0x0228F],
+ "sqsube" => [0x02291],
+ "sqsubset" => [0x0228F],
+ "sqsubseteq" => [0x02291],
+ "sqsup" => [0x02290],
+ "sqsupe" => [0x02292],
+ "sqsupset" => [0x02290],
+ "sqsupseteq" => [0x02292],
+ "squ" => [0x025A1],
+ "square" => [0x025A1],
+ "squarf" => [0x025AA],
+ "squf" => [0x025AA],
+ "srarr" => [0x02192],
+ "sscr" => [0x1D4C8],
+ "ssetmn" => [0x02216],
+ "ssmile" => [0x02323],
+ "sstarf" => [0x022C6],
+ "star" => [0x02606],
+ "starf" => [0x02605],
+ "straightepsilon" => [0x003F5],
+ "straightphi" => [0x003D5],
+ "strns" => [0x000AF],
+ "sub" => [0x02282],
+ "subE" => [0x02AC5],
+ "subdot" => [0x02ABD],
+ "sube" => [0x02286],
+ "subedot" => [0x02AC3],
+ "submult" => [0x02AC1],
+ "subnE" => [0x02ACB],
+ "subne" => [0x0228A],
+ "subplus" => [0x02ABF],
+ "subrarr" => [0x02979],
+ "subset" => [0x02282],
+ "subseteq" => [0x02286],
+ "subseteqq" => [0x02AC5],
+ "subsetneq" => [0x0228A],
+ "subsetneqq" => [0x02ACB],
+ "subsim" => [0x02AC7],
+ "subsub" => [0x02AD5],
+ "subsup" => [0x02AD3],
+ "succ" => [0x0227B],
+ "succapprox" => [0x02AB8],
+ "succcurlyeq" => [0x0227D],
+ "succeq" => [0x02AB0],
+ "succnapprox" => [0x02ABA],
+ "succneqq" => [0x02AB6],
+ "succnsim" => [0x022E9],
+ "succsim" => [0x0227F],
+ "sum" => [0x02211],
+ "sung" => [0x0266A],
+ "sup" => [0x02283],
+ "sup1" => [0x000B9],
+ "sup2" => [0x000B2],
+ "sup3" => [0x000B3],
+ "supE" => [0x02AC6],
+ "supdot" => [0x02ABE],
+ "supdsub" => [0x02AD8],
+ "supe" => [0x02287],
+ "supedot" => [0x02AC4],
+ "suphsol" => [0x027C9],
+ "suphsub" => [0x02AD7],
+ "suplarr" => [0x0297B],
+ "supmult" => [0x02AC2],
+ "supnE" => [0x02ACC],
+ "supne" => [0x0228B],
+ "supplus" => [0x02AC0],
+ "supset" => [0x02283],
+ "supseteq" => [0x02287],
+ "supseteqq" => [0x02AC6],
+ "supsetneq" => [0x0228B],
+ "supsetneqq" => [0x02ACC],
+ "supsim" => [0x02AC8],
+ "supsub" => [0x02AD4],
+ "supsup" => [0x02AD6],
+ "swArr" => [0x021D9],
+ "swarhk" => [0x02926],
+ "swarr" => [0x02199],
+ "swarrow" => [0x02199],
+ "swnwar" => [0x0292A],
+ "szlig" => [0x000DF],
+ "target" => [0x02316],
+ "tau" => [0x003C4],
+ "tbrk" => [0x023B4],
+ "tcaron" => [0x00165],
+ "tcedil" => [0x00163],
+ "tcy" => [0x00442],
+ "tdot" => [0x020DB],
+ "telrec" => [0x02315],
+ "tfr" => [0x1D531],
+ "there4" => [0x02234],
+ "therefore" => [0x02234],
+ "theta" => [0x003B8],
+ "thetasym" => [0x003D1],
+ "thetav" => [0x003D1],
+ "thickapprox" => [0x02248],
+ "thicksim" => [0x0223C],
+ "thinsp" => [0x02009],
+ "thkap" => [0x02248],
+ "thksim" => [0x0223C],
+ "thorn" => [0x000FE],
+ "tilde" => [0x002DC],
+ "times" => [0x000D7],
+ "timesb" => [0x022A0],
+ "timesbar" => [0x02A31],
+ "timesd" => [0x02A30],
+ "tint" => [0x0222D],
+ "toea" => [0x02928],
+ "top" => [0x022A4],
+ "topbot" => [0x02336],
+ "topcir" => [0x02AF1],
+ "topf" => [0x1D565],
+ "topfork" => [0x02ADA],
+ "tosa" => [0x02929],
+ "tprime" => [0x02034],
+ "trade" => [0x02122],
+ "triangle" => [0x025B5],
+ "triangledown" => [0x025BF],
+ "triangleleft" => [0x025C3],
+ "trianglelefteq" => [0x022B4],
+ "triangleq" => [0x0225C],
+ "triangleright" => [0x025B9],
+ "trianglerighteq" => [0x022B5],
+ "tridot" => [0x025EC],
+ "trie" => [0x0225C],
+ "triminus" => [0x02A3A],
+ "triplus" => [0x02A39],
+ "trisb" => [0x029CD],
+ "tritime" => [0x02A3B],
+ "trpezium" => [0x023E2],
+ "tscr" => [0x1D4C9],
+ "tscy" => [0x00446],
+ "tshcy" => [0x0045B],
+ "tstrok" => [0x00167],
+ "twixt" => [0x0226C],
+ "twoheadleftarrow" => [0x0219E],
+ "twoheadrightarrow" => [0x021A0],
+ "uArr" => [0x021D1],
+ "uHar" => [0x02963],
+ "uacute" => [0x000FA],
+ "uarr" => [0x02191],
+ "ubrcy" => [0x0045E],
+ "ubreve" => [0x0016D],
+ "ucirc" => [0x000FB],
+ "ucy" => [0x00443],
+ "udarr" => [0x021C5],
+ "udblac" => [0x00171],
+ "udhar" => [0x0296E],
+ "ufisht" => [0x0297E],
+ "ufr" => [0x1D532],
+ "ugrave" => [0x000F9],
+ "uharl" => [0x021BF],
+ "uharr" => [0x021BE],
+ "uhblk" => [0x02580],
+ "ulcorn" => [0x0231C],
+ "ulcorner" => [0x0231C],
+ "ulcrop" => [0x0230F],
+ "ultri" => [0x025F8],
+ "umacr" => [0x0016B],
+ "uml" => [0x000A8],
+ "uogon" => [0x00173],
+ "uopf" => [0x1D566],
+ "uparrow" => [0x02191],
+ "updownarrow" => [0x02195],
+ "upharpoonleft" => [0x021BF],
+ "upharpoonright" => [0x021BE],
+ "uplus" => [0x0228E],
+ "upsi" => [0x003C5],
+ "upsih" => [0x003D2],
+ "upsilon" => [0x003C5],
+ "upuparrows" => [0x021C8],
+ "urcorn" => [0x0231D],
+ "urcorner" => [0x0231D],
+ "urcrop" => [0x0230E],
+ "uring" => [0x0016F],
+ "urtri" => [0x025F9],
+ "uscr" => [0x1D4CA],
+ "utdot" => [0x022F0],
+ "utilde" => [0x00169],
+ "utri" => [0x025B5],
+ "utrif" => [0x025B4],
+ "uuarr" => [0x021C8],
+ "uuml" => [0x000FC],
+ "uwangle" => [0x029A7],
+ "vArr" => [0x021D5],
+ "vBar" => [0x02AE8],
+ "vBarv" => [0x02AE9],
+ "vDash" => [0x022A8],
+ "vangrt" => [0x0299C],
+ "varepsilon" => [0x003F5],
+ "varkappa" => [0x003F0],
+ "varnothing" => [0x02205],
+ "varphi" => [0x003D5],
+ "varpi" => [0x003D6],
+ "varpropto" => [0x0221D],
+ "varr" => [0x02195],
+ "varrho" => [0x003F1],
+ "varsigma" => [0x003C2],
+ "varsubsetneq" => [0x0228A, 0x0FE00],
+ "varsubsetneqq" => [0x02ACB, 0x0FE00],
+ "varsupsetneq" => [0x0228B, 0x0FE00],
+ "varsupsetneqq" => [0x02ACC, 0x0FE00],
+ "vartheta" => [0x003D1],
+ "vartriangleleft" => [0x022B2],
+ "vartriangleright" => [0x022B3],
+ "vcy" => [0x00432],
+ "vdash" => [0x022A2],
+ "vee" => [0x02228],
+ "veebar" => [0x022BB],
+ "veeeq" => [0x0225A],
+ "vellip" => [0x022EE],
+ "verbar" => [0x0007C],
+ "vert" => [0x0007C],
+ "vfr" => [0x1D533],
+ "vltri" => [0x022B2],
+ "vnsub" => [0x02282, 0x020D2],
+ "vnsup" => [0x02283, 0x020D2],
+ "vopf" => [0x1D567],
+ "vprop" => [0x0221D],
+ "vrtri" => [0x022B3],
+ "vscr" => [0x1D4CB],
+ "vsubnE" => [0x02ACB, 0x0FE00],
+ "vsubne" => [0x0228A, 0x0FE00],
+ "vsupnE" => [0x02ACC, 0x0FE00],
+ "vsupne" => [0x0228B, 0x0FE00],
+ "vzigzag" => [0x0299A],
+ "wcirc" => [0x00175],
+ "wedbar" => [0x02A5F],
+ "wedge" => [0x02227],
+ "wedgeq" => [0x02259],
+ "weierp" => [0x02118],
+ "wfr" => [0x1D534],
+ "wopf" => [0x1D568],
+ "wp" => [0x02118],
+ "wr" => [0x02240],
+ "wreath" => [0x02240],
+ "wscr" => [0x1D4CC],
+ "xcap" => [0x022C2],
+ "xcirc" => [0x025EF],
+ "xcup" => [0x022C3],
+ "xdtri" => [0x025BD],
+ "xfr" => [0x1D535],
+ "xhArr" => [0x027FA],
+ "xharr" => [0x027F7],
+ "xi" => [0x003BE],
+ "xlArr" => [0x027F8],
+ "xlarr" => [0x027F5],
+ "xmap" => [0x027FC],
+ "xnis" => [0x022FB],
+ "xodot" => [0x02A00],
+ "xopf" => [0x1D569],
+ "xoplus" => [0x02A01],
+ "xotime" => [0x02A02],
+ "xrArr" => [0x027F9],
+ "xrarr" => [0x027F6],
+ "xscr" => [0x1D4CD],
+ "xsqcup" => [0x02A06],
+ "xuplus" => [0x02A04],
+ "xutri" => [0x025B3],
+ "xvee" => [0x022C1],
+ "xwedge" => [0x022C0],
+ "yacute" => [0x000FD],
+ "yacy" => [0x0044F],
+ "ycirc" => [0x00177],
+ "ycy" => [0x0044B],
+ "yen" => [0x000A5],
+ "yfr" => [0x1D536],
+ "yicy" => [0x00457],
+ "yopf" => [0x1D56A],
+ "yscr" => [0x1D4CE],
+ "yucy" => [0x0044E],
+ "yuml" => [0x000FF],
+ "zacute" => [0x0017A],
+ "zcaron" => [0x0017E],
+ "zcy" => [0x00437],
+ "zdot" => [0x0017C],
+ "zeetrf" => [0x02128],
+ "zeta" => [0x003B6],
+ "zfr" => [0x1D537],
+ "zhcy" => [0x00436],
+ "zigrarr" => [0x021DD],
+ "zopf" => [0x1D56B],
+ "zscr" => [0x1D4CF],
+ "zwj" => [0x0200D],
+ "zwnj" => [0x0200C],
+}
+
diff --git a/lib/rdoc/markdown/literals_1_9.rb b/lib/rdoc/markdown/literals_1_9.rb
new file mode 100644
index 0000000000..f7bfbe27a1
--- /dev/null
+++ b/lib/rdoc/markdown/literals_1_9.rb
@@ -0,0 +1,420 @@
+# coding: UTF-8
+# :markup: markdown
+
+##
+#--
+# 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
+# characters, newlines and spaces.
+class RDoc::Markdown::Literals
+ # :stopdoc:
+
+ # This is distinct from setup_parser so that a standalone parser
+ # can redefine #initialize and still have access to the proper
+ # parser setup code.
+ def initialize(str, debug=false)
+ setup_parser(str, debug)
+ end
+
+
+
+ # Prepares for parsing +str+. If you define a custom initialize you must
+ # call this method before #parse
+ def setup_parser(str, debug=false)
+ set_string str, 0
+ @memoizations = Hash.new { |h,k| h[k] = {} }
+ @result = nil
+ @failed_rule = nil
+ @failing_rule_offset = -1
+
+ setup_foreign_grammar
+ end
+
+ attr_reader :string
+ 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
+ end
+
+ target + 1
+ end
+
+ def current_line(target=pos)
+ cur_offset = 0
+ cur_line = 0
+
+ string.each_line do |line|
+ cur_line += 1
+ cur_offset += line.size
+ return cur_line if cur_offset >= target
+ end
+
+ -1
+ end
+
+ def lines
+ lines = []
+ string.each_line { |l| lines << l }
+ lines
+ end
+
+
+
+ def get_text(start)
+ @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
+ "#{@pos} (\"#{@string[0,@pos]}\" @ \"#{@string[@pos,width]}\")"
+ else
+ "#{@pos} (\"... #{@string[@pos - width, width]}\" @ \"#{@string[@pos,width]}\")"
+ end
+ end
+
+ def failure_info
+ l = current_line @failing_rule_offset
+ c = current_column @failing_rule_offset
+
+ if @failed_rule.kind_of? Symbol
+ info = self.class::Rules[@failed_rule]
+ "line #{l}, column #{c}: failed rule '#{info.name}' = '#{info.rendered}'"
+ else
+ "line #{l}, column #{c}: failed rule '#{@failed_rule}'"
+ end
+ end
+
+ def failure_caret
+ l = current_line @failing_rule_offset
+ c = current_column @failing_rule_offset
+
+ line = lines[l-1]
+ "#{line}\n#{' ' * (c - 1)}^"
+ end
+
+ def failure_character
+ l = current_line @failing_rule_offset
+ c = current_column @failing_rule_offset
+ lines[l-1][c-1, 1]
+ end
+
+ def failure_oneline
+ l = current_line @failing_rule_offset
+ c = current_column @failing_rule_offset
+
+ char = lines[l-1][c-1, 1]
+
+ if @failed_rule.kind_of? Symbol
+ info = self.class::Rules[@failed_rule]
+ "@#{l}:#{c} failed rule '#{info.name}', got '#{char}'"
+ else
+ "@#{l}:#{c} failed rule '#{@failed_rule}', got '#{char}'"
+ end
+ end
+
+ class ParseError < RuntimeError
+ end
+
+ def raise_error
+ raise ParseError, failure_oneline
+ end
+
+ def show_error(io=STDOUT)
+ error_pos = @failing_rule_offset
+ line_no = current_line(error_pos)
+ col_no = current_column(error_pos)
+
+ io.puts "On line #{line_no}, column #{col_no}:"
+
+ if @failed_rule.kind_of? Symbol
+ info = self.class::Rules[@failed_rule]
+ io.puts "Failed to match '#{info.rendered}' (rule '#{info.name}')"
+ else
+ io.puts "Failed to match rule '#{@failed_rule}'"
+ end
+
+ io.puts "Got: #{string[error_pos,1].inspect}"
+ line = lines[line_no-1]
+ io.puts "=> #{line}"
+ io.print(" " * (col_no + 3))
+ io.puts "^"
+ end
+
+ def set_failed_rule(name)
+ if @pos > @failing_rule_offset
+ @failed_rule = name
+ @failing_rule_offset = @pos
+ end
+ end
+
+ attr_reader :failed_rule
+
+ def match_string(str)
+ len = str.size
+ if @string[pos,len] == str
+ @pos += len
+ return str
+ end
+
+ return nil
+ end
+
+ def scan(reg)
+ if m = reg.match(@string[@pos..-1])
+ width = m.end(0)
+ @pos += width
+ return true
+ end
+
+ return nil
+ end
+
+ if "".respond_to? :ord
+ def get_byte
+ if @pos >= @string_size
+ return nil
+ end
+
+ s = @string[@pos].ord
+ @pos += 1
+ s
+ end
+ else
+ def get_byte
+ if @pos >= @string_size
+ return nil
+ end
+
+ s = @string[@pos]
+ @pos += 1
+ s
+ end
+ end
+
+ def parse(rule=nil)
+ # We invoke the rules indirectly via apply
+ # instead of by just calling them as methods because
+ # if the rules use left recursion, apply needs to
+ # manage that.
+
+ if !rule
+ apply(:_root)
+ else
+ method = rule.gsub("-","_hyphen_")
+ apply :"_#{method}"
+ end
+ end
+
+ class MemoEntry
+ def initialize(ans, pos)
+ @ans = ans
+ @pos = pos
+ @result = nil
+ @set = false
+ @left_rec = false
+ end
+
+ attr_reader :ans, :pos, :result, :set
+ attr_accessor :left_rec
+
+ def move!(ans, pos, result)
+ @ans = ans
+ @pos = pos
+ @result = result
+ @set = true
+ @left_rec = false
+ end
+ end
+
+ def external_invoke(other, rule, *args)
+ old_pos = @pos
+ old_string = @string
+
+ set_string other.string, other.pos
+
+ begin
+ if val = __send__(rule, *args)
+ other.pos = @pos
+ other.result = @result
+ else
+ other.set_failed_rule "#{self.class}##{rule}"
+ end
+ val
+ ensure
+ set_string old_string, old_pos
+ end
+ end
+
+ def apply_with_args(rule, *args)
+ memo_key = [rule, args]
+ if m = @memoizations[memo_key][@pos]
+ @pos = m.pos
+ if !m.set
+ m.left_rec = true
+ return nil
+ end
+
+ @result = m.result
+
+ return m.ans
+ else
+ m = MemoEntry.new(nil, @pos)
+ @memoizations[memo_key][@pos] = m
+ start_pos = @pos
+
+ ans = __send__ rule, *args
+
+ lr = m.left_rec
+
+ m.move! ans, @pos, @result
+
+ # Don't bother trying to grow the left recursion
+ # if it's failing straight away (thus there is no seed)
+ if ans and lr
+ return grow_lr(rule, args, start_pos, m)
+ else
+ return ans
+ end
+
+ return ans
+ end
+ end
+
+ def apply(rule)
+ if m = @memoizations[rule][@pos]
+ @pos = m.pos
+ if !m.set
+ m.left_rec = true
+ return nil
+ end
+
+ @result = m.result
+
+ return m.ans
+ else
+ m = MemoEntry.new(nil, @pos)
+ @memoizations[rule][@pos] = m
+ start_pos = @pos
+
+ ans = __send__ rule
+
+ lr = m.left_rec
+
+ m.move! ans, @pos, @result
+
+ # Don't bother trying to grow the left recursion
+ # if it's failing straight away (thus there is no seed)
+ if ans and lr
+ return grow_lr(rule, nil, start_pos, m)
+ else
+ return ans
+ end
+
+ return ans
+ end
+ end
+
+ def grow_lr(rule, args, start_pos, m)
+ while true
+ @pos = start_pos
+ @result = m.result
+
+ if args
+ ans = __send__ rule, *args
+ else
+ ans = __send__ rule
+ end
+ return nil unless ans
+
+ break if @pos <= m.pos
+
+ m.move! ans, @pos, @result
+ end
+
+ @result = m.result
+ @pos = m.pos
+ return m.ans
+ end
+
+ class RuleInfo
+ def initialize(name, rendered)
+ @name = name
+ @rendered = rendered
+ end
+
+ attr_reader :name, :rendered
+ end
+
+ def self.rule_info(name, rendered)
+ RuleInfo.new(name, rendered)
+ end
+
+
+ # :startdoc:
+ # :stopdoc:
+ def setup_foreign_grammar; end
+
+ # Alphanumeric = /\p{Word}/
+ def _Alphanumeric
+ _tmp = scan(/\A(?-mix:\p{Word})/)
+ set_failed_rule :_Alphanumeric unless _tmp
+ return _tmp
+ end
+
+ # AlphanumericAscii = /[A-Za-z0-9]/
+ def _AlphanumericAscii
+ _tmp = scan(/\A(?-mix:[A-Za-z0-9])/)
+ set_failed_rule :_AlphanumericAscii unless _tmp
+ return _tmp
+ end
+
+ # BOM = "uFEFF"
+ def _BOM
+ _tmp = match_string("uFEFF")
+ set_failed_rule :_BOM unless _tmp
+ return _tmp
+ end
+
+ # Newline = /\n|\r\n?|\p{Zl}|\p{Zp}/
+ def _Newline
+ _tmp = scan(/\A(?-mix:\n|\r\n?|\p{Zl}|\p{Zp})/)
+ set_failed_rule :_Newline unless _tmp
+ return _tmp
+ end
+
+ # NonAlphanumeric = /\p{^Word}/
+ def _NonAlphanumeric
+ _tmp = scan(/\A(?-mix:\p{^Word})/)
+ set_failed_rule :_NonAlphanumeric unless _tmp
+ return _tmp
+ end
+
+ # Spacechar = /\t|\p{Zs}/
+ def _Spacechar
+ _tmp = scan(/\A(?-mix:\t|\p{Zs})/)
+ set_failed_rule :_Spacechar unless _tmp
+ return _tmp
+ end
+
+ Rules = {}
+ Rules[:_Alphanumeric] = rule_info("Alphanumeric", "/\\p{Word}/")
+ Rules[:_AlphanumericAscii] = rule_info("AlphanumericAscii", "/[A-Za-z0-9]/")
+ Rules[:_BOM] = rule_info("BOM", "\"uFEFF\"")
+ Rules[:_Newline] = rule_info("Newline", "/\\n|\\r\\n?|\\p{Zl}|\\p{Zp}/")
+ Rules[:_NonAlphanumeric] = rule_info("NonAlphanumeric", "/\\p{^Word}/")
+ Rules[:_Spacechar] = rule_info("Spacechar", "/\\t|\\p{Zs}/")
+ # :startdoc:
+end
diff --git a/lib/rdoc/markup.rb b/lib/rdoc/markup.rb
index 07fd5493c8..e1d75fa52b 100644
--- a/lib/rdoc/markup.rb
+++ b/lib/rdoc/markup.rb
@@ -1,5 +1,3 @@
-require 'rdoc'
-
##
# RDoc::Markup parses plain text documents and attempts to decompose them into
# their constituent parts. Some of these parts are high-level: paragraphs,
@@ -8,11 +6,44 @@ require 'rdoc'
# is similar in spirit to that used on WikiWiki webs, where folks create web
# pages using a simple set of formatting rules.
#
-# RDoc::Markup itself does no output formatting: this is left to a different
-# set of classes.
+# RDoc::Markup and other markup formats do no output formatting, this is
+# handled by the RDoc::Markup::Formatter subclasses.
+#
+# = Supported Formats
+#
+# Besides the RDoc::Markup format, the following formats are built in to RDoc:
+#
+# markdown::
+# The markdown format as described by
+# http://daringfireball.net/projects/markdown/. See RDoc::Markdown for
+# details on the parser and supported extensions.
+# rd::
+# The rdtool format. See RDoc::RD for details on the parser and format.
+# tomdoc::
+# The TomDoc format as described by http://tomdoc.org/. See RDoc::TomDoc
+# for details on the parser and supported extensions.
+#
+# You can choose a markup format using the following methods:
+#
+# per project::
+# If you build your documentation with rake use RDoc::Task#markup.
+#
+# If you build your documentation by hand run:
+#
+# rdoc --markup your_favorite_format --write-options
#
-# RDoc::Markup is extendable at runtime: you can add \new markup elements to
-# be recognised in the documents that RDoc::Markup parses.
+# and commit <tt>.rdoc_options</tt> and ship it with your packaged gem.
+# per file::
+# At the top of the file use the <tt>:markup:</tt> directive to set the
+# default format for the rest of the file.
+# per comment::
+# Use the <tt>:markup:</tt> directive at the top of a comment you want
+# to write in a different format.
+#
+# = RDoc::Markup
+#
+# RDoc::Markup is extensible at runtime: you can add \new markup elements to
+# be recognized in the documents that RDoc::Markup parses.
#
# RDoc::Markup is intended to be the basis for a family of tools which share
# the common requirement that simple, plain-text should be rendered in a
@@ -26,21 +57,20 @@ require 'rdoc'
# the +convert+ method, so you can use the same RDoc::Markup converter to
# convert multiple input strings.
#
-# require 'rdoc/markup/to_html'
+# require 'rdoc'
#
-# h = RDoc::Markup::ToHtml.new
+# h = RDoc::Markup::ToHtml.new(RDoc::Options.new)
#
# puts h.convert(input_string)
#
-# You can extend the RDoc::Markup parser to recognise new markup
+# You can extend the RDoc::Markup parser to recognize new markup
# sequences, and to add special processing for text that matches a
# regular expression. Here we make WikiWords significant to the parser,
# and also make the sequences {word} and \<no>text...</no> signify
# strike-through text. We then subclass the HTML output class to deal
# with these:
#
-# require 'rdoc/markup'
-# require 'rdoc/markup/to_html'
+# require 'rdoc'
#
# class WikiHtml < RDoc::Markup::ToHtml
# def handle_special_WIKIWORD(special)
@@ -96,7 +126,12 @@ require 'rdoc'
# have been removed. In addition, the verbatim text has been shifted
# left, so the amount of indentation of verbatim text is unimportant.
#
-# === Headers and Rules
+# 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
+# HTML. Triggers include "def", "class", "module", "require", the "hash
+# rocket"# (=>) or a block call with a parameter.
+#
+# === Headers
#
# A line starting with an equal sign (=) is treated as a
# heading. Level one headings have one equals sign, level two headings
@@ -104,25 +139,45 @@ require 'rdoc'
# (seven hyphens or more result in a level six heading).
#
# For example, the above header was obtained with:
-# == Headers and 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).
+# === Headers
#
-# 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:
+# In HTML output headers have an id matching their name. The above example's
+# HTML is:
+#
+# <h3 id="label-Headers">Headers</h3>
+#
+# If a heading is inside a method body the id will be prefixed with the
+# method's id. If the above header where in the documentation for a method
+# such as:
+#
+# ##
+# # This method does fun things
+# #
+# # = Example
+# #
+# # Example of fun things goes here ...
+#
+# def do_fun_things
+# end
+#
+# The header's id would be:
+#
+# <h1 id="method-i-do_fun_things-label-Example">Example</h3>
+#
+# The label can be linked-to using <tt>SomeClass@Headers</tt>. See
+# {Links}[RDoc::Markup@Links] for further details.
+#
+# === Rules
+#
+# A line starting with three or more hyphens (at the current indent)
+# generates a horizontal rule.
#
# ---
-# -----
-# -----------------------------------------------------
#
# produces:
#
# ---
-# -----
-# -----------------------------------------------------
#
# === Simple Lists
#
@@ -240,7 +295,6 @@ require 'rdoc'
# verbatim text outside of the list (the list is therefore closed)
# regular paragraph after the list
#
-#
# == Text Markup
#
# === Bold, Italic, Typewriter Text
@@ -272,15 +326,29 @@ require 'rdoc'
# === Links
#
# Links to starting with +http:+, +https:+, +mailto:+, +ftp:+ or +www.+
-# are recognized. An HTTP url that references an external image file is
-# converted into an inline image element.
-#
-# Links starting with <tt>rdoc-ref:</tt> will link to the referenced class,
-# module, method, file, etc. If the referenced item is not documented the
-# text will be and no link will be generated.
-#
-# Links starting with +link:+ refer to local files whose path is relative to
-# the <tt>--op</tt> directory.
+# are recognized. An HTTP url that references an external image is converted
+# into an inline image element.
+#
+# Classes and methods will be automatically linked to their definition. For
+# example, <tt>RDoc::Markup</tt> will link to this documentation. By default
+# methods will only be automatically linked if they contain an <tt>_</tt> (all
+# methods can be automatically linked through the <tt>--hyperlink-all</tt>
+# command line option).
+#
+# Single-word methods can be linked by using the <tt>#</tt> character for
+# instance methods or <tt>::</tt> for class methods. For example,
+# <tt>#convert</tt> links to #convert. A class or method may be combined like
+# <tt>RDoc::Markup#convert</tt>.
+#
+# A heading inside the documentation can be linked by following the class
+# or method by an <tt>@</tt> then the heading name.
+# <tt>RDoc::Markup@Links</tt> will link to this section like this:
+# RDoc::Markup@Links. Spaces in headings with multiple words must be escaped
+# 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+
@@ -288,11 +356,19 @@ require 'rdoc'
# 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
# resulting text.
#
+# Links starting with <tt>rdoc-label:label_name</tt> will link to the
+# +label_name+. You can create a label for the current link (for
+# bidirectional links) by supplying a name for the current link like
+# <tt>rdoc-label:label-other:label-mine</tt>.
+#
# Links starting with +link:+ refer to local files whose path is relative to
# the <tt>--op</tt> directory. Use <tt>rdoc-ref:</tt> instead of
# <tt>link:</tt> to link to files generated by RDoc as the link target may
@@ -492,27 +568,54 @@ require 'rdoc'
# so you won't see the documentation unless you use the +-a+ command line
# option.
#
-# === Other directives
+# === Method arguments
#
-# [+:include:+ _filename_]
-# Include the contents of the named file at this point. This directive
-# must appear alone on one line, possibly preceded by spaces. In this
-# position, it can be escaped with a \ in front of the first colon.
+# [+:arg:+ or +:args:+ _parameters_]
+# Overrides the default argument handling with exactly these parameters.
#
-# The file will be searched for in the directories listed by the +--include+
-# option, or in the current directory by default. The contents of the file
-# will be shifted to have the same indentation as the ':' at the start of
-# the +:include:+ directive.
+# ##
+# # :args: a, b
#
-# [+:title:+ _text_]
-# Sets the title for the document. Equivalent to the <tt>--title</tt>
-# command line parameter. (The command line parameter overrides any :title:
-# directive in the source).
+# def some_method(*a)
+# end
#
-# [+:main:+ _name_]
-# Equivalent to the <tt>--main</tt> command line parameter.
+# [+:yield:+ or +:yields:+ _parameters_]
+# Overrides the default yield discovery with these parameters.
+#
+# ##
+# # :yields: key, value
+#
+# def each_thing &block
+# @things.each(&block)
+# end
+#
+# [+:call-seq:+]
+# Lines up to the next blank line or lines with a common prefix in the
+# comment are treated as the method's calling sequence, overriding the
+# default parsing of method parameters and yield arguments.
+#
+# Multiple lines may be used.
+#
+# # :call-seq:
+# # ARGF.readlines(sep=$/) -> array
+# # ARGF.readlines(limit) -> array
+# # ARGF.readlines(sep, limit) -> array
+# #
+# # ARGF.to_a(sep=$/) -> array
+# # ARGF.to_a(limit) -> array
+# # ARGF.to_a(sep, limit) -> array
+# #
+# # The remaining lines are documentation ...
#
-# [<tt>:category: section</tt>]
+# === Sections
+#
+# Sections allow you to group methods in a class into sensible containers. If
+# you use the sections 'Public', 'Internal' and 'Deprecated' (the three
+# allowed method statuses from TomDoc) the sections will be displayed in that
+# order placing the most useful methods at the top. Otherwise, sections will
+# be displayed in alphabetical order.
+#
+# [+:category:+ _section_]
# Adds this item to the named +section+ overriding the current section. Use
# this to group methods by section in RDoc output while maintaining a
# sensible ordering (like alphabetical).
@@ -541,7 +644,7 @@ require 'rdoc'
# Use the :section: directive to provide introductory text for a section of
# documentation.
#
-# [<tt>:section: title</tt>]
+# [+:section:+ _title_]
# Provides section introductory text in RDoc output. The title following
# +:section:+ is used as the section name and the remainder of the comment
# containing the section is used as introductory text. A section's comment
@@ -573,12 +676,60 @@ require 'rdoc'
# # ...
# end
#
-# [+:call-seq:+]
-# Lines up to the next blank line in the comment are treated as the method's
-# calling sequence, overriding the default parsing of method parameters and
-# yield arguments.
+# === Other directives
+#
+# [+: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
+# it is applied automatically to all comments in the file.
+#
+# Unless you are converting between markup formats you should use a
+# <code>.rdoc_options</code> file to specify the default documentation
+# format for your entire project. See RDoc::Options@Saved+Options for
+# instructions.
+#
+# At the top of a file the +:markup:+ directive applies to the entire file:
+#
+# # coding: UTF-8
+# # :markup: TomDoc
+#
+# # TomDoc comment here ...
+#
+# class MyClass
+# # ...
+#
+# For just one comment:
+#
+# # ...
+# end
+#
+# # :markup: RDoc
+# #
+# # This is a comment in RDoc markup format ...
+#
+# def some_method
+# # ...
+#
+# 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
+# must appear alone on one line, possibly preceded by spaces. In this
+# position, it can be escaped with a \ in front of the first colon.
+#
+# The file will be searched for in the directories listed by the +--include+
+# option, or in the current directory by default. The contents of the file
+# will be shifted to have the same indentation as the ':' at the start of
+# the +:include:+ directive.
+#
+# [+:title:+ _text_]
+# Sets the title for the document. Equivalent to the <tt>--title</tt>
+# command line parameter. (The command line parameter overrides any :title:
+# directive in the source).
+#
+# [+:main:+ _name_]
+# Equivalent to the <tt>--main</tt> command line parameter.
#
-# Further directives can be found in RDoc::Parser::Ruby and RDoc::Parser::C.
#--
# Original Author:: Dave Thomas, dave@pragmaticprogrammer.com
# License:: Ruby license
@@ -591,6 +742,34 @@ class RDoc::Markup
attr_reader :attribute_manager
##
+ # Parses +str+ into an RDoc::Markup::Document.
+
+ def self.parse str
+ RDoc::Markup::Parser.parse str
+ rescue RDoc::Markup::Parser::Error => e
+ $stderr.puts <<-EOF
+While parsing markup, RDoc encountered a #{e.class}:
+
+#{e}
+\tfrom #{e.backtrace.join "\n\tfrom "}
+
+---8<---
+#{text}
+---8<---
+
+RDoc #{RDoc::VERSION}
+
+Ruby #{RUBY_VERSION}-p#{RUBY_PATCHLEVEL} #{RUBY_RELEASE_DATE}
+
+Please file a bug report with the above information at:
+
+https://github.com/rdoc/rdoc/issues
+
+ EOF
+ raise
+ end
+
+ ##
# Take a block of text and use various heuristics to determine its
# structure (paragraphs, lists, and so on). Invoke an event handler as we
# identify significant chunks.
@@ -644,9 +823,47 @@ class RDoc::Markup
document.accept formatter
end
-end
+ autoload :Parser, 'rdoc/markup/parser'
+ autoload :PreProcess, 'rdoc/markup/pre_process'
+
+ # Inline markup classes
+ autoload :AttrChanger, 'rdoc/markup/attr_changer'
+ autoload :AttrSpan, 'rdoc/markup/attr_span'
+ autoload :Attributes, 'rdoc/markup/attributes'
+ autoload :AttributeManager, 'rdoc/markup/attribute_manager'
+ autoload :Special, 'rdoc/markup/special'
+
+ # RDoc::Markup AST
+ autoload :BlankLine, 'rdoc/markup/blank_line'
+ autoload :BlockQuote, 'rdoc/markup/block_quote'
+ autoload :Document, 'rdoc/markup/document'
+ autoload :HardBreak, 'rdoc/markup/hard_break'
+ autoload :Heading, 'rdoc/markup/heading'
+ autoload :Include, 'rdoc/markup/include'
+ autoload :IndentedParagraph, 'rdoc/markup/indented_paragraph'
+ autoload :List, 'rdoc/markup/list'
+ autoload :ListItem, 'rdoc/markup/list_item'
+ autoload :Paragraph, 'rdoc/markup/paragraph'
+ autoload :Raw, 'rdoc/markup/raw'
+ autoload :Rule, 'rdoc/markup/rule'
+ autoload :Verbatim, 'rdoc/markup/verbatim'
-require 'rdoc/markup/parser'
-require 'rdoc/markup/attribute_manager'
-require 'rdoc/markup/inline'
+ # Formatters
+ autoload :Formatter, 'rdoc/markup/formatter'
+ autoload :FormatterTestCase, 'rdoc/markup/formatter_test_case'
+ autoload :TextFormatterTestCase, 'rdoc/markup/text_formatter_test_case'
+
+ autoload :ToAnsi, 'rdoc/markup/to_ansi'
+ autoload :ToBs, 'rdoc/markup/to_bs'
+ autoload :ToHtml, 'rdoc/markup/to_html'
+ autoload :ToHtmlCrossref, 'rdoc/markup/to_html_crossref'
+ autoload :ToHtmlSnippet, 'rdoc/markup/to_html_snippet'
+ autoload :ToLabel, 'rdoc/markup/to_label'
+ autoload :ToMarkdown, 'rdoc/markup/to_markdown'
+ autoload :ToRdoc, 'rdoc/markup/to_rdoc'
+ autoload :ToTableOfContents, 'rdoc/markup/to_table_of_contents'
+ autoload :ToTest, 'rdoc/markup/to_test'
+ autoload :ToTtOnly, 'rdoc/markup/to_tt_only'
+
+end
diff --git a/lib/rdoc/markup/attr_changer.rb b/lib/rdoc/markup/attr_changer.rb
new file mode 100644
index 0000000000..1772f18b2b
--- /dev/null
+++ b/lib/rdoc/markup/attr_changer.rb
@@ -0,0 +1,22 @@
+class RDoc::Markup
+
+ AttrChanger = Struct.new :turn_on, :turn_off # :nodoc:
+
+end
+
+##
+# An AttrChanger records a change in attributes. It contains a bitmap of the
+# attributes to turn on, and a bitmap of those to turn off.
+
+class RDoc::Markup::AttrChanger
+
+ def to_s # :nodoc:
+ "Attr: +#{turn_on}/-#{turn_off}"
+ end
+
+ def inspect # :nodoc:
+ '+%d/-%d' % [turn_on, turn_off]
+ end
+
+end
+
diff --git a/lib/rdoc/markup/attr_span.rb b/lib/rdoc/markup/attr_span.rb
new file mode 100644
index 0000000000..b5c1b3b7b7
--- /dev/null
+++ b/lib/rdoc/markup/attr_span.rb
@@ -0,0 +1,29 @@
+##
+# An array of attributes which parallels the characters in a string.
+
+class RDoc::Markup::AttrSpan
+
+ ##
+ # Creates a new AttrSpan for +length+ characters
+
+ def initialize(length)
+ @attrs = Array.new(length, 0)
+ end
+
+ ##
+ # Toggles +bits+ from +start+ to +length+
+ def set_attrs(start, length, bits)
+ for i in start ... (start+length)
+ @attrs[i] |= bits
+ end
+ end
+
+ ##
+ # Accesses flags for character +n+
+
+ def [](n)
+ @attrs[n]
+ end
+
+end
+
diff --git a/lib/rdoc/markup/attribute_manager.rb b/lib/rdoc/markup/attribute_manager.rb
index d2402f1b1d..c5a50d519c 100644
--- a/lib/rdoc/markup/attribute_manager.rb
+++ b/lib/rdoc/markup/attribute_manager.rb
@@ -23,6 +23,11 @@ class RDoc::Markup::AttributeManager
PROTECT_ATTR = A_PROTECT.chr # :nodoc:
##
+ # The attributes enabled for this markup object.
+
+ attr_reader :attributes
+
+ ##
# This maps delimiters that occur around words (such as *bold* or +tt+)
# where the start and end delimiters and the same. This lets us optimize
# the regexp
@@ -60,8 +65,9 @@ class RDoc::Markup::AttributeManager
@html_tags = {}
@matching_word_pairs = {}
@protectable = %w[<]
- @special = {}
+ @special = []
@word_pair_map = {}
+ @attributes = RDoc::Markup::Attributes.new
add_word_pair "*", "*", :BOLD
add_word_pair "_", "_", :EM
@@ -96,11 +102,11 @@ class RDoc::Markup::AttributeManager
def changed_attribute_by_name current_set, new_set
current = new = 0
current_set.each do |name|
- current |= RDoc::Markup::Attribute.bitmap_for(name)
+ current |= @attributes.bitmap_for(name)
end
new_set.each do |name|
- new |= RDoc::Markup::Attribute.bitmap_for(name)
+ new |= @attributes.bitmap_for(name)
end
change_attribute(current, new)
@@ -161,13 +167,14 @@ class RDoc::Markup::AttributeManager
##
# Converts special sequences to RDoc attributes
- def convert_specials(str, attrs)
- unless @special.empty?
- @special.each do |regexp, attr|
- str.scan(regexp) do
- attrs.set_attrs($`.length, $&.length,
- attr | RDoc::Markup::Attribute::SPECIAL)
- end
+ def convert_specials str, attrs
+ @special.each do |regexp, attribute|
+ str.scan(regexp) do
+ capture = $~.size == 1 ? 0 : 1
+
+ s, e = $~.offset capture
+
+ attrs.set_attrs s, e - s, attribute | @attributes.special
end
end
end
@@ -179,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
##
@@ -200,7 +208,7 @@ class RDoc::Markup::AttributeManager
raise ArgumentError, "Word flags may not start with '<'" if
start[0,1] == '<'
- bitmap = RDoc::Markup::Attribute.bitmap_for name
+ bitmap = @attributes.bitmap_for name
if start == stop then
@matching_word_pairs[start] = bitmap
@@ -220,7 +228,7 @@ class RDoc::Markup::AttributeManager
# am.add_html 'em', :EM
def add_html(tag, name)
- @html_tags[tag.downcase] = RDoc::Markup::Attribute.bitmap_for name
+ @html_tags[tag.downcase] = @attributes.bitmap_for name
end
##
@@ -229,14 +237,14 @@ class RDoc::Markup::AttributeManager
#
# @am.add_special(/((https?:)\S+\w)/, :HYPERLINK)
- def add_special(pattern, name)
- @special[pattern] = RDoc::Markup::Attribute.bitmap_for name
+ def add_special pattern, name
+ @special << [pattern, @attributes.bitmap_for(name)]
end
##
# Processes +str+ converting attributes, HTML and specials
- def flow(str)
+ def flow str
@str = str
mask_protected_sequences
@@ -303,9 +311,9 @@ class RDoc::Markup::AttributeManager
res << change_attribute(current_attr, new_attr)
current_attr = new_attr
- if (current_attr & RDoc::Markup::Attribute::SPECIAL) != 0 then
+ if (current_attr & @attributes.special) != 0 then
i += 1 while
- i < str_len and (@attrs[i] & RDoc::Markup::Attribute::SPECIAL) != 0
+ i < str_len and (@attrs[i] & @attributes.special) != 0
res << RDoc::Markup::Special.new(current_attr,
copy_string(start_pos, i))
diff --git a/lib/rdoc/markup/attributes.rb b/lib/rdoc/markup/attributes.rb
new file mode 100644
index 0000000000..3423f10ca7
--- /dev/null
+++ b/lib/rdoc/markup/attributes.rb
@@ -0,0 +1,70 @@
+##
+# We manage a set of attributes. Each attribute has a symbol name and a bit
+# value.
+
+class RDoc::Markup::Attributes
+
+ ##
+ # The special attribute type. See RDoc::Markup#add_special
+
+ attr_reader :special
+
+ ##
+ # Creates a new attributes set.
+
+ def initialize
+ @special = 1
+
+ @name_to_bitmap = [
+ [:_SPECIAL_, @special],
+ ]
+
+ @next_bitmap = @special << 1
+ end
+
+ ##
+ # Returns a unique bit for +name+
+
+ def bitmap_for name
+ bitmap = @name_to_bitmap.assoc name
+
+ unless bitmap then
+ bitmap = @next_bitmap
+ @next_bitmap <<= 1
+ @name_to_bitmap << [name, bitmap]
+ else
+ bitmap = bitmap.last
+ end
+
+ bitmap
+ end
+
+ ##
+ # Returns a string representation of +bitmap+
+
+ def as_string bitmap
+ return 'none' if bitmap.zero?
+ res = []
+
+ @name_to_bitmap.each do |name, bit|
+ res << name if (bitmap & bit) != 0
+ end
+
+ res.join ','
+ end
+
+ ##
+ # yields each attribute name in +bitmap+
+
+ def each_name_of bitmap
+ return enum_for __method__, bitmap unless block_given?
+
+ @name_to_bitmap.each do |name, bit|
+ next if bit == @special
+
+ yield name.to_s if (bitmap & bit) != 0
+ end
+ end
+
+end
+
diff --git a/lib/rdoc/markup/block_quote.rb b/lib/rdoc/markup/block_quote.rb
new file mode 100644
index 0000000000..552f0c4baa
--- /dev/null
+++ b/lib/rdoc/markup/block_quote.rb
@@ -0,0 +1,14 @@
+##
+# A quoted section which contains markup items.
+
+class RDoc::Markup::BlockQuote < RDoc::Markup::Raw
+
+ ##
+ # Calls #accept_block_quote on +visitor+
+
+ def accept visitor
+ visitor.accept_block_quote self
+ end
+
+end
+
diff --git a/lib/rdoc/markup/document.rb b/lib/rdoc/markup/document.rb
index 7077f357d3..be93d80eec 100644
--- a/lib/rdoc/markup/document.rb
+++ b/lib/rdoc/markup/document.rb
@@ -3,11 +3,19 @@
class RDoc::Markup::Document
+ include Enumerable
+
##
# The file this document was created from. See also
# RDoc::ClassModule#add_comment
- attr_accessor :file
+ attr_reader :file
+
+ ##
+ # If a heading is below the given level it will be omitted from the
+ # table_of_contents
+
+ attr_accessor :omit_headings_below
##
# The parts of the Document
@@ -19,9 +27,10 @@ class RDoc::Markup::Document
def initialize *parts
@parts = []
- @parts.push(*parts)
+ @parts.concat parts
@file = nil
+ @omit_headings_from_table_of_contents_below = nil
end
##
@@ -31,7 +40,7 @@ class RDoc::Markup::Document
case part
when RDoc::Markup::Document then
unless part.empty? then
- parts.push(*part.parts)
+ parts.concat part.parts
parts << RDoc::Markup::BlankLine.new
end
when String then
@@ -55,19 +64,26 @@ class RDoc::Markup::Document
def accept visitor
visitor.start_accepting
- @parts.each do |item|
- case item
- when RDoc::Markup::Document then # HACK
- visitor.accept_document item
- else
- item.accept visitor
- end
- end
+ visitor.accept_document self
visitor.end_accepting
end
##
+ # Concatenates the given +parts+ onto the document
+
+ def concat parts
+ self.parts.concat parts
+ end
+
+ ##
+ # Enumerator for the parts of this document
+
+ def each &block
+ @parts.each(&block)
+ end
+
+ ##
# Does this document have no parts?
def empty?
@@ -75,6 +91,18 @@ class RDoc::Markup::Document
end
##
+ # The file this Document was created from.
+
+ def file= location
+ @file = case location
+ when RDoc::TopLevel then
+ location.relative_name
+ else
+ location
+ end
+ end
+
+ ##
# When this is a collection of documents (#file is not set and this document
# contains only other documents as its direct children) #merge replaces
# documents in this class with documents from +other+ when the file matches
@@ -120,7 +148,16 @@ class RDoc::Markup::Document
# Appends +parts+ to the document
def push *parts
- self.parts.push(*parts)
+ self.parts.concat parts
+ end
+
+ ##
+ # Returns an Array of headings in the document.
+ #
+ # Require 'rdoc/markup/formatter' before calling this method.
+
+ def table_of_contents
+ accept RDoc::Markup::ToTableOfContents.to_toc
end
end
diff --git a/lib/rdoc/markup/formatter.rb b/lib/rdoc/markup/formatter.rb
index f42b3fc6ea..7661c95239 100644
--- a/lib/rdoc/markup/formatter.rb
+++ b/lib/rdoc/markup/formatter.rb
@@ -1,9 +1,9 @@
-require 'rdoc/markup'
-
##
# Base class for RDoc markup formatters
#
-# Formatters use a visitor pattern to convert content into output.
+# Formatters are a visitor that converts an RDoc::Markup tree (from a comment)
+# into some kind of output. RDoc ships with formatters for converting back to
+# rdoc, ANSI text, HTML, a Table of Contents and other formats.
#
# If you'd like to write your own Formatter use
# RDoc::Markup::FormatterTestCase. If you're writing a text-output formatter
@@ -18,16 +18,48 @@ class RDoc::Markup::Formatter
InlineTag = Struct.new(:bit, :on, :off)
##
+ # Converts a target url to one that is relative to a given path
+
+ def self.gen_relative_url path, target
+ from = File.dirname path
+ to, to_file = File.split target
+
+ from = from.split "/"
+ to = to.split "/"
+
+ from.delete '.'
+ to.delete '.'
+
+ while from.size > 0 and to.size > 0 and from[0] == to[0] do
+ from.shift
+ to.shift
+ end
+
+ from.fill ".."
+ from.concat to
+ from << to_file
+ File.join(*from)
+ end
+
+ ##
# Creates a new Formatter
- def initialize markup = nil
+ def initialize options, markup = nil
+ @options = options
+
@markup = markup || RDoc::Markup.new
@am = @markup.attribute_manager
+ @am.add_special(/<br>/, :HARD_BREAK)
+
+ @attributes = @am.attributes
@attr_tags = []
@in_tt = 0
- @tt_bit = RDoc::Markup::Attribute.bitmap_for :TT
+ @tt_bit = @attributes.bitmap_for :TT
+
+ @hard_break = ''
+ @from_path = '.'
end
##
@@ -35,16 +67,41 @@ class RDoc::Markup::Formatter
def accept_document document
document.parts.each do |item|
- item.accept self
+ case item
+ when RDoc::Markup::Document then # HACK
+ accept_document item
+ else
+ item.accept self
+ end
end
end
##
+ # Adds a special for links of the form rdoc-...:
+
+ def add_special_RDOCLINK
+ @markup.add_special(/rdoc-[a-z]+:[^\s\]]+/, :RDOCLINK)
+ end
+
+ ##
+ # Adds a special for links of the form {<text>}[<url>] and <word>[<url>]
+
+ def add_special_TIDYLINK
+ @markup.add_special(/(?:
+ \{.*?\} | # multi-word label
+ \b[^\s{}]+? # single-word label
+ )
+
+ \[\S+?\] # link target
+ /x, :TIDYLINK)
+ end
+
+ ##
# Add a new set of tags for an attribute. We allow separate start and end
# tags for flexibility
def add_tag(name, start, stop)
- attr = RDoc::Markup::Attribute.bitmap_for name
+ attr = @attributes.bitmap_for name
@attr_tags << InlineTag.new(attr, start, stop)
end
@@ -58,7 +115,7 @@ class RDoc::Markup::Formatter
##
# Marks up +content+
- def convert(content)
+ def convert content
@markup.convert content, self
end
@@ -93,7 +150,7 @@ class RDoc::Markup::Formatter
handled = false
- RDoc::Markup::Attribute.each_name_of special.type do |name|
+ @attributes.each_name_of special.type do |name|
method_name = "handle_special_#{name}"
if respond_to? method_name then
@@ -102,7 +159,11 @@ class RDoc::Markup::Formatter
end
end
- raise "Unhandled special: #{special}" unless handled
+ unless handled then
+ special_name = @attributes.as_string special.type
+
+ raise RDoc::Error, "Unhandled special #{special_name}: #{special}"
+ end
special.text
end
@@ -115,6 +176,17 @@ class RDoc::Markup::Formatter
end
##
+ # Use ignore in your subclass to ignore the content of a node.
+ #
+ # ##
+ # # We don't support raw nodes in ToNoRaw
+ #
+ # alias accept_raw ignore
+
+ def ignore *node
+ end
+
+ ##
# Are we currently inside tt tags?
def in_tt?
@@ -152,6 +224,36 @@ class RDoc::Markup::Formatter
end
##
+ # Extracts and a scheme, url and an anchor id from +url+ and returns them.
+
+ def parse_url url
+ case url
+ when /^rdoc-label:([^:]*)(?::(.*))?/ then
+ scheme = 'link'
+ path = "##{$1}"
+ id = " id=\"#{$2}\"" if $2
+ when /([A-Za-z]+):(.*)/ then
+ scheme = $1.downcase
+ path = $2
+ when /^#/ then
+ else
+ scheme = 'http'
+ path = url
+ url = url
+ end
+
+ if scheme == 'link' then
+ url = if path[0, 1] == '#' then # is this meaningful?
+ path
+ else
+ self.class.gen_relative_url @from_path, path
+ end
+ end
+
+ [scheme, url, id]
+ end
+
+ ##
# Is +tag+ a tt tag?
def tt? tag
@@ -160,10 +262,3 @@ class RDoc::Markup::Formatter
end
-class RDoc::Markup
- autoload :ToAnsi, 'rdoc/markup/to_ansi'
- autoload :ToBs, 'rdoc/markup/to_bs'
- autoload :ToHtml, 'rdoc/markup/to_html'
- autoload :ToHtmlCrossref, 'rdoc/markup/to_html_crossref'
- autoload :ToRdoc, 'rdoc/markup/to_rdoc'
-end
diff --git a/lib/rdoc/markup/formatter_test_case.rb b/lib/rdoc/markup/formatter_test_case.rb
index c739f990b3..6616a75898 100644
--- a/lib/rdoc/markup/formatter_test_case.rb
+++ b/lib/rdoc/markup/formatter_test_case.rb
@@ -1,5 +1,4 @@
require 'minitest/unit'
-require 'rdoc/markup/formatter'
##
# Test case for creating new RDoc::Markup formatters. See
@@ -35,7 +34,7 @@ require 'rdoc/markup/formatter'
#
# end
-class RDoc::Markup::FormatterTestCase < MiniTest::Unit::TestCase
+class RDoc::Markup::FormatterTestCase < RDoc::TestCase
##
# Call #setup when inheriting from this test case.
@@ -54,8 +53,9 @@ class RDoc::Markup::FormatterTestCase < MiniTest::Unit::TestCase
def setup
super
- @m = RDoc::Markup.new
- @RM = RDoc::Markup
+ @options = RDoc::Options.new
+
+ @m = @RM.new
@bullet_list = @RM::List.new(:BULLET,
@RM::ListItem.new(nil, @RM::Paragraph.new('l1')),
@@ -86,7 +86,7 @@ class RDoc::Markup::FormatterTestCase < MiniTest::Unit::TestCase
# Call to add the visitor tests to your test case
def self.add_visitor_tests
- self.class_eval do
+ class_eval do
##
# Calls start_accepting which needs to verify startup state
@@ -120,6 +120,16 @@ class RDoc::Markup::FormatterTestCase < MiniTest::Unit::TestCase
end
##
+ # Calls accept_block_quote
+
+ def test_accept_block_quote
+ @to.start_accepting
+
+ @to.accept_block_quote block para 'quote'
+
+ accept_block_quote
+ end
+ ##
# Test case that calls <tt>@to.accept_document</tt>
def test_accept_document
@@ -234,6 +244,29 @@ class RDoc::Markup::FormatterTestCase < MiniTest::Unit::TestCase
end
##
+ # Calls accept_paragraph_br with a RDoc::Markup::Paragraph containing
+ # a \<br>
+
+ def test_accept_paragraph_br
+ @to.start_accepting
+
+ @to.accept_paragraph para 'one<br>two'
+
+ accept_paragraph_br
+ end
+
+ ##
+ # Calls accept_paragraph with a Paragraph containing a hard break
+
+ def test_accept_paragraph_break
+ @to.start_accepting
+
+ @to.accept_paragraph para('hello', hard_break, 'world')
+
+ accept_paragraph_break
+ end
+
+ ##
# Calls accept_paragraph_i with a RDoc::Markup::Paragraph containing
# emphasized words
@@ -374,9 +407,9 @@ class RDoc::Markup::FormatterTestCase < MiniTest::Unit::TestCase
# Calls accept_list_item_start_note_2
def test_accept_list_item_start_note_2
- list = @RM::List.new(:NOTE,
- @RM::ListItem.new('<tt>teletype</tt>',
- @RM::Paragraph.new('teletype description')))
+ list = list(:NOTE,
+ item('<tt>teletype</tt>',
+ para('teletype description')))
@to.start_accepting
@@ -388,6 +421,41 @@ class RDoc::Markup::FormatterTestCase < MiniTest::Unit::TestCase
end
##
+ # Calls accept_list_item_start_note_multi_description
+
+ def test_accept_list_item_start_note_multi_description
+ list = list(:NOTE,
+ item(%w[label],
+ para('description one')),
+ item(nil, para('description two')))
+
+ @to.start_accepting
+
+ list.accept @to
+
+ @to.end_accepting
+
+ accept_list_item_start_note_multi_description
+ end
+
+ ##
+ # Calls accept_list_item_start_note_multi_label
+
+ def test_accept_list_item_start_note_multi_label
+ list = list(:NOTE,
+ item(%w[one two],
+ para('two headers')))
+
+ @to.start_accepting
+
+ list.accept @to
+
+ @to.end_accepting
+
+ accept_list_item_start_note_multi_label
+ end
+
+ ##
# Calls accept_list_item_start_number
def test_accept_list_item_start_number
@@ -635,7 +703,7 @@ class RDoc::Markup::FormatterTestCase < MiniTest::Unit::TestCase
end
##
- # Calls accept_list_end_ulpha
+ # Calls accept_list_end_ualpha
def test_accept_list_end_ualpha
@to.start_accepting
@@ -670,28 +738,28 @@ class RDoc::Markup::FormatterTestCase < MiniTest::Unit::TestCase
# Calls list_verbatim with a list containing a verbatim block
def test_list_verbatim # HACK overblown
- doc = @RM::Document.new(
- @RM::List.new(:BULLET,
- @RM::ListItem.new(nil,
- @RM::Paragraph.new('list', 'stuff'),
- @RM::BlankLine.new,
- @RM::Verbatim.new("* list\n",
- " with\n",
- "\n",
- " second\n",
- "\n",
- " 1. indented\n",
- " 2. numbered\n",
- "\n",
- " third\n",
- "\n",
- "* second\n"))))
+ doc =
+ doc(
+ list(:BULLET,
+ item(nil,
+ para('list stuff'),
+ blank_line,
+ verb("* list\n",
+ " with\n",
+ "\n",
+ " second\n",
+ "\n",
+ " 1. indented\n",
+ " 2. numbered\n",
+ "\n",
+ " third\n",
+ "\n",
+ "* second\n"))))
doc.accept @to
list_verbatim
end
-
end
end
diff --git a/lib/rdoc/markup/hard_break.rb b/lib/rdoc/markup/hard_break.rb
new file mode 100644
index 0000000000..8445ad26e7
--- /dev/null
+++ b/lib/rdoc/markup/hard_break.rb
@@ -0,0 +1,31 @@
+##
+# A hard-break in the middle of a paragraph.
+
+class RDoc::Markup::HardBreak
+
+ @instance = new
+
+ ##
+ # RDoc::Markup::HardBreak is a singleton
+
+ def self.new
+ @instance
+ end
+
+ ##
+ # Calls #accept_hard_break on +visitor+
+
+ def accept visitor
+ visitor.accept_hard_break self
+ end
+
+ def == other # :nodoc:
+ self.class === other
+ end
+
+ def pretty_print q # :nodoc:
+ q.text "[break]"
+ end
+
+end
+
diff --git a/lib/rdoc/markup/heading.rb b/lib/rdoc/markup/heading.rb
index 3bda77a1e1..535e310e54 100644
--- a/lib/rdoc/markup/heading.rb
+++ b/lib/rdoc/markup/heading.rb
@@ -1,7 +1,37 @@
##
# A heading with a level (1-6) and text
-class RDoc::Markup::Heading < Struct.new :level, :text
+RDoc::Markup::Heading =
+ Struct.new :level, :text do
+
+ @to_html = nil
+ @to_label = nil
+
+ ##
+ # A singleton RDoc::Markup::ToLabel formatter for headings.
+
+ def self.to_label
+ @to_label ||= RDoc::Markup::ToLabel.new
+ end
+
+ ##
+ # A singleton plain HTML formatter for headings. Used for creating labels
+ # for the Table of Contents
+
+ def self.to_html
+ return @to_html if @to_html
+
+ markup = RDoc::Markup.new
+ markup.add_special RDoc::CrossReference::CROSSREF_REGEXP, :CROSSREF
+
+ @to_html = RDoc::Markup::ToHtml.new nil
+
+ def @to_html.handle_special_CROSSREF special
+ special.text.sub(/^\\/, '')
+ end
+
+ @to_html
+ end
##
# Calls #accept_heading on +visitor+
@@ -10,6 +40,34 @@ class RDoc::Markup::Heading < Struct.new :level, :text
visitor.accept_heading self
end
+ ##
+ # An HTML-safe anchor reference for this header.
+
+ def aref
+ "label-#{self.class.to_label.convert text.dup}"
+ 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.
+
+ def plain_html
+ self.class.to_html.to_html(text.dup)
+ end
+
def pretty_print q # :nodoc:
q.group 2, "[head: #{level} ", ']' do
q.pp text
diff --git a/lib/rdoc/markup/include.rb b/lib/rdoc/markup/include.rb
new file mode 100644
index 0000000000..a2e8903279
--- /dev/null
+++ b/lib/rdoc/markup/include.rb
@@ -0,0 +1,42 @@
+##
+# A file included at generation time. Objects of this class are created by
+# RDoc::RD for an extension-less include.
+#
+# This implementation in incomplete.
+
+class RDoc::Markup::Include
+
+ ##
+ # The filename to be included, without extension
+
+ attr_reader :file
+
+ ##
+ # Directories to search for #file
+
+ attr_reader :include_path
+
+ ##
+ # Creates a new include that will import +file+ from +include_path+
+
+ def initialize file, include_path
+ @file = file
+ @include_path = include_path
+ end
+
+ def == other # :nodoc:
+ self.class === other and
+ @file == other.file and @include_path == other.include_path
+ end
+
+ def pretty_print q # :nodoc:
+ q.group 2, '[incl ', ']' do
+ q.text file
+ q.breakable
+ q.text 'from '
+ q.pp include_path
+ end
+ end
+
+end
+
diff --git a/lib/rdoc/markup/indented_paragraph.rb b/lib/rdoc/markup/indented_paragraph.rb
index d995c7d8ed..1b8a8c725d 100644
--- a/lib/rdoc/markup/indented_paragraph.rb
+++ b/lib/rdoc/markup/indented_paragraph.rb
@@ -29,5 +29,19 @@ class RDoc::Markup::IndentedParagraph < RDoc::Markup::Raw
visitor.accept_indented_paragraph self
end
+ ##
+ # Joins the raw paragraph text and converts inline HardBreaks to the
+ # +hard_break+ text followed by the indent.
+
+ def text hard_break = nil
+ @parts.map do |part|
+ if RDoc::Markup::HardBreak === part then
+ '%1$s%3$*2$s' % [hard_break, @indent, ' '] if hard_break
+ else
+ part
+ end
+ end.join
+ end
+
end
diff --git a/lib/rdoc/markup/inline.rb b/lib/rdoc/markup/inline.rb
index cf598d1583..fb3ab5c74d 100644
--- a/lib/rdoc/markup/inline.rb
+++ b/lib/rdoc/markup/inline.rb
@@ -1,144 +1 @@
-require 'rdoc'
-class RDoc::Markup
-
- ##
- # We manage a set of attributes. Each attribute has a symbol name and a bit
- # value.
-
- class Attribute
-
- ##
- # Special attribute type. See RDoc::Markup#add_special
-
- SPECIAL = 1
-
- @@name_to_bitmap = { :_SPECIAL_ => SPECIAL }
- @@next_bitmap = 2
-
- ##
- # Returns a unique bit for +name+
-
- def self.bitmap_for(name)
- bitmap = @@name_to_bitmap[name]
- unless bitmap then
- bitmap = @@next_bitmap
- @@next_bitmap <<= 1
- @@name_to_bitmap[name] = bitmap
- end
- bitmap
- end
-
- ##
- # Returns a string representation of +bitmap+
-
- def self.as_string(bitmap)
- return "none" if bitmap.zero?
- res = []
- @@name_to_bitmap.each do |name, bit|
- res << name if (bitmap & bit) != 0
- end
- res.join(",")
- end
-
- ##
- # yields each attribute name in +bitmap+
-
- def self.each_name_of(bitmap)
- @@name_to_bitmap.each do |name, bit|
- next if bit == SPECIAL
- yield name.to_s if (bitmap & bit) != 0
- end
- end
-
- end
-
- AttrChanger = Struct.new :turn_on, :turn_off # :nodoc:
-
- ##
- # An AttrChanger records a change in attributes. It contains a bitmap of the
- # attributes to turn on, and a bitmap of those to turn off.
-
- class AttrChanger
- def to_s # :nodoc:
- "Attr: +#{Attribute.as_string turn_on}/-#{Attribute.as_string turn_off}"
- end
-
- def inspect # :nodoc:
- "+%s/-%s" % [
- Attribute.as_string(turn_on),
- Attribute.as_string(turn_off),
- ]
- end
- end
-
- ##
- # An array of attributes which parallels the characters in a string.
-
- class AttrSpan
-
- ##
- # Creates a new AttrSpan for +length+ characters
-
- def initialize(length)
- @attrs = Array.new(length, 0)
- end
-
- ##
- # Toggles +bits+ from +start+ to +length+
- def set_attrs(start, length, bits)
- for i in start ... (start+length)
- @attrs[i] |= bits
- end
- end
-
- ##
- # Accesses flags for character +n+
-
- def [](n)
- @attrs[n]
- end
-
- end
-
- ##
- # Hold details of a special sequence
-
- class Special
-
- ##
- # Special type
-
- attr_reader :type
-
- ##
- # Special text
-
- attr_accessor :text
-
- ##
- # Creates a new special sequence of +type+ with +text+
-
- def initialize(type, text)
- @type, @text = type, text
- end
-
- ##
- # Specials are equal when the have the same text and type
-
- def ==(o)
- self.text == o.text && self.type == o.type
- end
-
- def inspect # :nodoc:
- "#<RDoc::Markup::Special:0x%x @type=%p, name=%p @text=%p>" % [
- object_id, @type, RDoc::Markup::Attribute.as_string(type), text.dump]
- end
-
- def to_s # :nodoc:
- "Special: type=#{type}, name=#{RDoc::Markup::Attribute.as_string type}, text=#{text.dump}"
- end
-
- end
-
-end
-
+warn "requiring rdoc/markup/inline is deprecated and will be removed in RDoc 4." if $-w
diff --git a/lib/rdoc/markup/list.rb b/lib/rdoc/markup/list.rb
index 820b4c9645..89b7fc20fa 100644
--- a/lib/rdoc/markup/list.rb
+++ b/lib/rdoc/markup/list.rb
@@ -1,5 +1,24 @@
##
-# A List of ListItems
+# A List is a homogeneous set of ListItems.
+#
+# The supported list types include:
+#
+# :BULLET::
+# An unordered list
+# :LABEL::
+# An unordered definition list, but using an alternate RDoc::Markup syntax
+# :LALPHA::
+# An ordered list using increasing lowercase English letters
+# :NOTE::
+# An unordered definition list
+# :NUMBER::
+# An ordered list using increasing Arabic numerals
+# :UALPHA::
+# An ordered list using increasing uppercase English letters
+#
+# Definition lists behave like HTML definition lists. Each list item can
+# describe multiple terms. See RDoc::Markup::ListItem for how labels and
+# definition are stored as list items.
class RDoc::Markup::List
@@ -14,12 +33,13 @@ class RDoc::Markup::List
attr_reader :items
##
- # Creates a new list of +type+ with +items+
+ # Creates a new list of +type+ with +items+. Valid list types are:
+ # +:BULLET+, +:LABEL+, +:LALPHA+, +:NOTE+, +:NUMBER+, +:UALPHA+
def initialize type = nil, *items
@type = type
@items = []
- @items.push(*items)
+ @items.concat items
end
##
@@ -74,7 +94,7 @@ class RDoc::Markup::List
# Appends +items+ to the list
def push *items
- @items.push(*items)
+ @items.concat items
end
end
diff --git a/lib/rdoc/markup/list_item.rb b/lib/rdoc/markup/list_item.rb
index d719c352ec..c5e59fe167 100644
--- a/lib/rdoc/markup/list_item.rb
+++ b/lib/rdoc/markup/list_item.rb
@@ -1,5 +1,12 @@
##
# An item within a List that contains paragraphs, headings, etc.
+#
+# For BULLET, NUMBER, LALPHA and UALPHA lists, the label will always be nil.
+# For NOTE and LABEL lists, the list label may contain:
+#
+# * a single String for a single label
+# * an Array of Strings for a list item with multiple terms
+# * nil for an extra description attached to a previously labeled list item
class RDoc::Markup::ListItem
@@ -19,7 +26,7 @@ class RDoc::Markup::ListItem
def initialize label = nil, *parts
@label = label
@parts = []
- @parts.push(*parts)
+ @parts.concat parts
end
##
@@ -64,8 +71,14 @@ class RDoc::Markup::ListItem
def pretty_print q # :nodoc:
q.group 2, '[item: ', ']' do
- if @label then
- q.text @label
+ case @label
+ when Array then
+ q.pp @label
+ q.text ';'
+ q.breakable
+ when String then
+ q.pp @label
+ q.text ';'
q.breakable
end
@@ -79,7 +92,7 @@ class RDoc::Markup::ListItem
# Adds +parts+ to the ListItem
def push *parts
- @parts.push(*parts)
+ @parts.concat parts
end
end
diff --git a/lib/rdoc/markup/paragraph.rb b/lib/rdoc/markup/paragraph.rb
index 808430d576..7180729f75 100644
--- a/lib/rdoc/markup/paragraph.rb
+++ b/lib/rdoc/markup/paragraph.rb
@@ -10,5 +10,19 @@ class RDoc::Markup::Paragraph < RDoc::Markup::Raw
visitor.accept_paragraph self
end
+ ##
+ # Joins the raw paragraph text and converts inline HardBreaks to the
+ # +hard_break+ text.
+
+ def text hard_break = ''
+ @parts.map do |part|
+ if RDoc::Markup::HardBreak === part then
+ hard_break
+ else
+ part
+ end
+ end.join
+ end
+
end
diff --git a/lib/rdoc/markup/parser.rb b/lib/rdoc/markup/parser.rb
index c18ce821fb..cc828a4513 100644
--- a/lib/rdoc/markup/parser.rb
+++ b/lib/rdoc/markup/parser.rb
@@ -1,5 +1,4 @@
require 'strscan'
-require 'rdoc/text'
##
# A recursive-descent parser for RDoc markup.
@@ -52,7 +51,9 @@ class RDoc::Markup::Parser
attr_reader :tokens
##
- # Parses +str+ into a Document
+ # Parses +str+ into a Document.
+ #
+ # Use RDoc::Markup#parse instead of this method.
def self.parse str
parser = new
@@ -74,12 +75,17 @@ class RDoc::Markup::Parser
# Creates a new Parser. See also ::parse
def initialize
- @tokens = []
- @current_token = nil
- @debug = false
-
- @line = 0
- @line_pos = 0
+ @binary_input = nil
+ @current_token = nil
+ @debug = false
+ @have_encoding = Object.const_defined? :Encoding
+ @have_byteslice = ''.respond_to? :byteslice
+ @input = nil
+ @input_encoding = nil
+ @line = 0
+ @line_pos = 0
+ @s = nil
+ @tokens = []
end
##
@@ -107,13 +113,13 @@ class RDoc::Markup::Parser
p :list_start => margin if @debug
list = RDoc::Markup::List.new
+ label = nil
until @tokens.empty? do
type, data, column, = get
case type
- when :BULLET, :LABEL, :LALPHA, :NOTE, :NUMBER, :UALPHA then
-
+ when *LIST_TOKENS then
if column < margin || (list.type && list.type != type) then
unget
break
@@ -124,6 +130,8 @@ class RDoc::Markup::Parser
case type
when :NOTE, :LABEL then
+ label = [] unless label
+
if peek_type == :NEWLINE then
# description not on the same line as LABEL/NOTE
# skip the trailing newline & any blank lines below
@@ -146,32 +154,35 @@ class RDoc::Markup::Parser
# In all cases, we have an empty description.
# In the last case only, we continue.
if peek_type.nil? || column < margin then
- empty = 1
+ empty = true
elsif column == margin then
case peek_type
when type
- empty = 2 # continue
+ empty = :continue
when *LIST_TOKENS
- empty = 1
+ empty = true
else
- empty = 0
+ empty = false
end
else
- empty = 0
+ empty = false
end
- if empty > 0 then
- item = RDoc::Markup::ListItem.new(data)
- item << RDoc::Markup::BlankLine.new
- list << item
- break if empty == 1
- next
+ if empty then
+ label << data
+ next if empty == :continue
+ break
end
end
else
data = nil
end
+ if label then
+ data = label << data
+ label = nil
+ end
+
list_item = RDoc::Markup::ListItem.new data
parse list_item, column
list << list_item
@@ -184,7 +195,13 @@ class RDoc::Markup::Parser
p :list_end => margin if @debug
- return nil if list.empty?
+ if list.empty? then
+ return nil unless label
+ return nil unless [:LABEL, :NOTE].include? list.type
+
+ list_item = RDoc::Markup::ListItem.new label, RDoc::Markup::BlankLine.new
+ list << list_item
+ end
list
end
@@ -200,15 +217,20 @@ class RDoc::Markup::Parser
until @tokens.empty? do
type, data, column, = get
- if type == :TEXT && column == margin then
+ if type == :TEXT and column == margin then
paragraph << data
- skip :NEWLINE
+
+ break if peek_token.first == :BREAK
+
+ data << ' ' if skip :NEWLINE
else
unget
break
end
end
+ paragraph.parts.last.sub!(/ \z/, '') # cleanup
+
p :paragraph_end => margin if @debug
paragraph
@@ -267,7 +289,7 @@ class RDoc::Markup::Parser
peek_column ||= column + width
indent = peek_column - column - width
line << ' ' * indent
- when :TEXT then
+ when :BREAK, :TEXT then
line << data
else # *LIST_TOKENS
list_marker = case type
@@ -298,6 +320,21 @@ class RDoc::Markup::Parser
end
##
+ # The character offset for the input string at the given +byte_offset+
+
+ def char_pos byte_offset
+ if @have_byteslice then
+ @input.byteslice(0, byte_offset).length
+ elsif @have_encoding then
+ matched = @binary_input[0, byte_offset]
+ matched.force_encoding @input_encoding
+ matched.length
+ else
+ byte_offset
+ end
+ end
+
+ ##
# Pulls the next token from the stream.
def get
@@ -321,7 +358,12 @@ class RDoc::Markup::Parser
until @tokens.empty? do
type, data, column, = get
- if type == :NEWLINE then
+ case type
+ when :BREAK then
+ parent << RDoc::Markup::BlankLine.new
+ skip :NEWLINE, false
+ next
+ when :NEWLINE then
# trailing newlines are skipped below, so this is a blank line
parent << RDoc::Markup::BlankLine.new
skip :NEWLINE, false
@@ -347,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)
@@ -364,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
@@ -373,6 +422,22 @@ class RDoc::Markup::Parser
end
##
+ # Creates the StringScanner
+
+ def setup_scanner input
+ @line = 0
+ @line_pos = 0
+ @input = input.dup
+
+ if @have_encoding and not @have_byteslice then
+ @input_encoding = @input.encoding
+ @binary_input = @input.force_encoding Encoding::BINARY
+ end
+
+ @s = StringScanner.new input
+ end
+
+ ##
# Skips the next token if its type is +token_type+.
#
# Optionally raises an error if the next token is not of the expected type.
@@ -389,58 +454,55 @@ class RDoc::Markup::Parser
# Turns text +input+ into a stream of tokens
def tokenize input
- s = StringScanner.new input
-
- @line = 0
- @line_pos = 0
+ setup_scanner input
- until s.eos? do
- pos = s.pos
+ until @s.eos? do
+ pos = @s.pos
# leading spaces will be reflected by the column of the next token
# the only thing we loose are trailing spaces at the end of the file
- next if s.scan(/ +/)
+ next if @s.scan(/ +/)
# note: after BULLET, LABEL, etc.,
# indent will be the column of the next non-newline token
@tokens << case
# [CR]LF => :NEWLINE
- when s.scan(/\r?\n/) then
- token = [:NEWLINE, s.matched, *token_pos(pos)]
- @line_pos = s.pos
+ when @s.scan(/\r?\n/) then
+ token = [:NEWLINE, @s.matched, *token_pos(pos)]
+ @line_pos = char_pos @s.pos
@line += 1
token
# === text => :HEADER then :TEXT
- when s.scan(/(=+)(\s*)/) then
- level = s[1].length
+ when @s.scan(/(=+)(\s*)/) then
+ level = @s[1].length
header = [:HEADER, level, *token_pos(pos)]
- if s[2] =~ /^\r?\n/ then
- s.pos -= s[2].length
+ if @s[2] =~ /^\r?\n/ then
+ @s.pos -= @s[2].length
header
else
- pos = s.pos
- s.scan(/.*/)
+ pos = @s.pos
+ @s.scan(/.*/)
@tokens << header
- [:TEXT, s.matched.sub(/\r$/, ''), *token_pos(pos)]
+ [:TEXT, @s.matched.sub(/\r$/, ''), *token_pos(pos)]
end
# --- (at least 3) and nothing else on the line => :RULE
- when s.scan(/(-{3,}) *$/) then
- [:RULE, s[1].length - 2, *token_pos(pos)]
+ when @s.scan(/(-{3,}) *\r?$/) then
+ [:RULE, @s[1].length - 2, *token_pos(pos)]
# * or - followed by white space and text => :BULLET
- when s.scan(/([*-]) +(\S)/) then
- s.pos -= s[2].bytesize # unget \S
- [:BULLET, s[1], *token_pos(pos)]
+ when @s.scan(/([*-]) +(\S)/) then
+ @s.pos -= @s[2].bytesize # unget \S
+ [:BULLET, @s[1], *token_pos(pos)]
# A. text, a. text, 12. text => :UALPHA, :LALPHA, :NUMBER
- when s.scan(/([a-z]|\d+)\. +(\S)/i) then
+ when @s.scan(/([a-z]|\d+)\. +(\S)/i) then
# FIXME if tab(s), the column will be wrong
# either support tabs everywhere by first expanding them to
# spaces, or assume that they will have been replaced
# before (and provide a check for that at least in debug
# mode)
- list_label = s[1]
- s.pos -= s[2].bytesize # unget \S
+ list_label = @s[1]
+ @s.pos -= @s[2].bytesize # unget \S
list_type =
case list_label
when /[a-z]/ then :LALPHA
@@ -451,14 +513,21 @@ class RDoc::Markup::Parser
end
[list_type, list_label, *token_pos(pos)]
# [text] followed by spaces or end of line => :LABEL
- when s.scan(/\[(.*?)\]( +|$)/) then
- [:LABEL, s[1], *token_pos(pos)]
+ when @s.scan(/\[(.*?)\]( +|\r?$)/) then
+ [:LABEL, @s[1], *token_pos(pos)]
# text:: followed by spaces or end of line => :NOTE
- when s.scan(/(.*?)::( +|$)/) then
- [:NOTE, s[1], *token_pos(pos)]
+ when @s.scan(/(.*?)::( +|\r?$)/) then
+ [:NOTE, @s[1], *token_pos(pos)]
# anything else: :TEXT
- else s.scan(/.*/)
- [:TEXT, s.matched.sub(/\r$/, ''), *token_pos(pos)]
+ else @s.scan(/(.*?)( )?\r?$/)
+ token = [:TEXT, @s[1], *token_pos(pos)]
+
+ if @s[2] then
+ @tokens << token
+ [:BREAK, @s[2], *token_pos(pos + @s[1].length)]
+ else
+ token
+ end
end
end
@@ -466,9 +535,12 @@ class RDoc::Markup::Parser
end
##
- # Calculates the column and line of the current token based on +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
- def token_pos offset
[offset - @line_pos, @line]
end
@@ -484,14 +556,3 @@ class RDoc::Markup::Parser
end
-require 'rdoc/markup/blank_line'
-require 'rdoc/markup/document'
-require 'rdoc/markup/heading'
-require 'rdoc/markup/list'
-require 'rdoc/markup/list_item'
-require 'rdoc/markup/raw'
-require 'rdoc/markup/paragraph'
-require 'rdoc/markup/indented_paragraph'
-require 'rdoc/markup/rule'
-require 'rdoc/markup/verbatim'
-
diff --git a/lib/rdoc/markup/pre_process.rb b/lib/rdoc/markup/pre_process.rb
index 53e8e38ec1..01fb293462 100644
--- a/lib/rdoc/markup/pre_process.rb
+++ b/lib/rdoc/markup/pre_process.rb
@@ -1,6 +1,3 @@
-require 'rdoc/markup'
-require 'rdoc/encoding'
-
##
# Handle common directives that can occur in a block of text:
#
@@ -9,18 +6,48 @@ require 'rdoc/encoding'
# Directives can be escaped by preceding them with a backslash.
#
# RDoc plugin authors can register additional directives to be handled by
-# using RDoc::Markup::PreProcess::register
+# using RDoc::Markup::PreProcess::register.
+#
+# Any directive that is not built-in to RDoc (including those registered via
+# plugins) will be stored in the metadata hash on the CodeObject the comment
+# is attached to. See RDoc::Markup@Directives for the list of built-in
+# directives.
class RDoc::Markup::PreProcess
+ ##
+ # An RDoc::Options instance that will be filled in with overrides from
+ # directives
+
attr_accessor :options
- @registered = {}
+ ##
+ # Adds a post-process handler for directives. The handler will be called
+ # with the result RDoc::Comment (or text String) and the code object for the
+ # comment (if any).
+
+ def self.post_process &block
+ @post_processors << block
+ end
+
+ ##
+ # Registered post-processors
+
+ def self.post_processors
+ @post_processors
+ end
##
# Registers +directive+ as one handled by RDoc. If a block is given the
# directive will be replaced by the result of the block, otherwise the
# directive will be removed from the processed text.
+ #
+ # The block will be called with the directive name and the directive
+ # parameter:
+ #
+ # RDoc::Markup::PreProcess.register 'my-directive' do |directive, param|
+ # # replace text, etc.
+ # end
def self.register directive, &block
@registered[directive] = block
@@ -34,6 +61,16 @@ class RDoc::Markup::PreProcess
end
##
+ # Clears all registered directives and post-processors
+
+ def self.reset
+ @post_processors = []
+ @registered = {}
+ end
+
+ reset
+
+ ##
# Creates a new pre-processor for +input_file_name+ that will look for
# included files in +include_path+
@@ -44,7 +81,7 @@ class RDoc::Markup::PreProcess
end
##
- # Look for directives in a chunk of +text+.
+ # Look for directives in the given +text+.
#
# Options that we don't handle are yielded. If the block returns false the
# directive is restored to the text. If the block returns nil or no block
@@ -54,27 +91,56 @@ class RDoc::Markup::PreProcess
# If no matching directive was registered the directive is restored to the
# text.
#
- # If +code_object+ is given and the param is set as metadata on the
- # +code_object+. See RDoc::CodeObject#metadata
+ # If +code_object+ is given and the directive is unknown then the
+ # directive's parameter is set as metadata on the +code_object+. See
+ # RDoc::CodeObject#metadata for details.
def handle text, code_object = nil, &block
- encoding = if defined?(Encoding) then text.encoding else nil end
+ if RDoc::Comment === text then
+ comment = text
+ text = text.text
+ end
+
+ encoding = text.encoding if defined?(Encoding)
+
# regexp helper (square brackets for optional)
# $1 $2 $3 $4 $5
# [prefix][\]:directive:[spaces][param]newline
- text.gsub!(/^([ \t]*(?:#|\/?\*)?[ \t]*)(\\?):(\w+):([ \t]*)(.+)?\n/) do
+ text.gsub!(/^([ \t]*(?:#|\/?\*)?[ \t]*)(\\?):(\w+):([ \t]*)(.+)?(\r?\n|$)/) do
# skip something like ':toto::'
next $& if $4.empty? and $5 and $5[0, 1] == ':'
# skip if escaped
next "#$1:#$3:#$4#$5\n" unless $2.empty?
+ # This is not in handle_directive because I didn't want to pass another
+ # argument into it
+ if comment and $3 == 'markup' then
+ next "#{$1.strip}\n" unless $5
+ comment.format = $5.downcase
+ next "#{$1.strip}\n"
+ end
+
handle_directive $1, $3, $5, code_object, encoding, &block
end
+ comment = text unless comment
+
+ self.class.post_processors.each do |handler|
+ handler.call comment, code_object
+ end
+
text
end
+ ##
+ # Performs the actions described by +directive+ and its parameter +param+.
+ #
+ # +code_object+ is used for directives that operate on a class or module.
+ # +prefix+ is used to ensure the replacement for handled directives is
+ # correct. +encoding+ is used for the <tt>include</tt> directive.
+ #
+ # For a list of directives in RDoc see RDoc::Markup.
#--
# When 1.8.7 support is ditched prefix can be defaulted to ''
@@ -85,14 +151,14 @@ 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
blankline
when 'category' then
if RDoc::Context === code_object then
- section = code_object.add_section param, ''
+ section = code_object.add_section param
code_object.temporary_section = section
end
diff --git a/lib/rdoc/markup/raw.rb b/lib/rdoc/markup/raw.rb
index ca877c79af..e11e8efff4 100644
--- a/lib/rdoc/markup/raw.rb
+++ b/lib/rdoc/markup/raw.rb
@@ -13,7 +13,7 @@ class RDoc::Markup::Raw
def initialize *parts
@parts = []
- @parts.push(*parts)
+ @parts.concat parts
end
##
@@ -24,7 +24,7 @@ class RDoc::Markup::Raw
end
def == other # :nodoc:
- self.class == other.class and text == other.text
+ self.class == other.class and @parts == other.parts
end
##
@@ -38,11 +38,11 @@ class RDoc::Markup::Raw
# Appends +other+'s parts
def merge other
- @parts.push(*other.parts)
+ @parts.concat other.parts
end
def pretty_print q # :nodoc:
- self.class.name =~ /.*::(\w{4})/i
+ self.class.name =~ /.*::(\w{1,4})/i
q.group 2, "[#{$1.downcase}: ", ']' do
q.seplist @parts do |part|
@@ -55,7 +55,7 @@ class RDoc::Markup::Raw
# Appends +texts+ onto this Paragraph
def push *texts
- self.parts.push(*texts)
+ self.parts.concat texts
end
##
diff --git a/lib/rdoc/markup/special.rb b/lib/rdoc/markup/special.rb
new file mode 100644
index 0000000000..1c0fc03eea
--- /dev/null
+++ b/lib/rdoc/markup/special.rb
@@ -0,0 +1,40 @@
+##
+# Hold details of a special sequence
+
+class RDoc::Markup::Special
+
+ ##
+ # Special type
+
+ attr_reader :type
+
+ ##
+ # Special text
+
+ attr_accessor :text
+
+ ##
+ # Creates a new special sequence of +type+ with +text+
+
+ def initialize(type, text)
+ @type, @text = type, text
+ end
+
+ ##
+ # Specials are equal when the have the same text and type
+
+ def ==(o)
+ self.text == o.text && self.type == o.type
+ end
+
+ def inspect # :nodoc:
+ "#<RDoc::Markup::Special:0x%x @type=%p, @text=%p>" % [
+ object_id, @type, text.dump]
+ end
+
+ def to_s # :nodoc:
+ "Special: type=#{type} text=#{text.dump}"
+ end
+
+end
+
diff --git a/lib/rdoc/markup/text_formatter_test_case.rb b/lib/rdoc/markup/text_formatter_test_case.rb
index ba9e7c6187..4abf42563b 100644
--- a/lib/rdoc/markup/text_formatter_test_case.rb
+++ b/lib/rdoc/markup/text_formatter_test_case.rb
@@ -1,5 +1,3 @@
-require 'rdoc/markup/formatter_test_case'
-
##
# Test case for creating new plain-text RDoc::Markup formatters. See also
# RDoc::Markup::FormatterTestCase
diff --git a/lib/rdoc/markup/to_ansi.rb b/lib/rdoc/markup/to_ansi.rb
index 1e8a0289d9..4d439ce88d 100644
--- a/lib/rdoc/markup/to_ansi.rb
+++ b/lib/rdoc/markup/to_ansi.rb
@@ -1,5 +1,3 @@
-require 'rdoc/markup/to_rdoc'
-
##
# Outputs RDoc markup with vibrant ANSI color!
@@ -34,6 +32,11 @@ class RDoc::Markup::ToAnsi < RDoc::Markup::ToRdoc
when :BULLET then
2
when :NOTE, :LABEL then
+ if @prefix then
+ @res << @prefix.strip
+ @prefix = nil
+ end
+
@res << "\n" unless res.length == 1
2
else
@@ -53,7 +56,13 @@ class RDoc::Markup::ToAnsi < RDoc::Markup::ToRdoc
when :BULLET then
'*'
when :NOTE, :LABEL then
- attributes(list_item.label) + ":\n"
+ labels = Array(list_item.label).map do |label|
+ attributes(label).strip
+ end.join "\n"
+
+ labels << ":\n" unless labels.empty?
+
+ labels
else
@list_index.last.to_s + '.'
end
diff --git a/lib/rdoc/markup/to_bs.rb b/lib/rdoc/markup/to_bs.rb
index 32b1bbb9eb..10c31854d2 100644
--- a/lib/rdoc/markup/to_bs.rb
+++ b/lib/rdoc/markup/to_bs.rb
@@ -1,5 +1,3 @@
-require 'rdoc/markup/to_rdoc'
-
##
# Outputs RDoc markup with hot backspace action! You will probably need a
# pager to use this output format.
diff --git a/lib/rdoc/markup/to_html.rb b/lib/rdoc/markup/to_html.rb
index bd5fdb493e..823b023e72 100644
--- a/lib/rdoc/markup/to_html.rb
+++ b/lib/rdoc/markup/to_html.rb
@@ -1,10 +1,7 @@
-require 'rdoc/markup/formatter'
-require 'rdoc/markup/inline'
-
require 'cgi'
##
-# Outputs RDoc markup as HTML
+# Outputs RDoc markup as HTML.
class RDoc::Markup::ToHtml < RDoc::Markup::Formatter
@@ -16,12 +13,12 @@ class RDoc::Markup::ToHtml < RDoc::Markup::Formatter
# Maps RDoc::Markup::Parser::LIST_TOKENS types to HTML tags
LIST_TYPE_TO_HTML = {
- :BULLET => ['<ul>', '</ul>'],
- :LABEL => ['<dl class="rdoc-list">', '</dl>'],
- :LALPHA => ['<ol style="display: lower-alpha">', '</ol>'],
- :NOTE => ['<table class="rdoc-list">', '</table>'],
- :NUMBER => ['<ol>', '</ol>'],
- :UALPHA => ['<ol style="display: upper-alpha">', '</ol>'],
+ :BULLET => ['<ul>', '</ul>'],
+ :LABEL => ['<dl class="rdoc-list label-list">', '</dl>'],
+ :LALPHA => ['<ol style="list-style-type: lower-alpha">', '</ol>'],
+ :NOTE => ['<dl class="rdoc-list note-list">', '</dl>'],
+ :NUMBER => ['<ol>', '</ol>'],
+ :UALPHA => ['<ol style="list-style-type: upper-alpha">', '</ol>'],
}
attr_reader :res # :nodoc:
@@ -29,52 +26,37 @@ class RDoc::Markup::ToHtml < RDoc::Markup::Formatter
attr_reader :list # :nodoc:
##
- # Path to this document for relative links
+ # The RDoc::CodeObject HTML is being generated for. This is used to
+ # generate namespaced URI fragments
- attr_accessor :from_path
+ attr_accessor :code_object
##
- # Converts a target url to one that is relative to a given path
-
- def self.gen_relative_url(path, target)
- from = File.dirname path
- to, to_file = File.split target
-
- from = from.split "/"
- to = to.split "/"
-
- from.delete '.'
- to.delete '.'
-
- while from.size > 0 and to.size > 0 and from[0] == to[0] do
- from.shift
- to.shift
- end
+ # Path to this document for relative links
- from.fill ".."
- from.concat to
- from << to_file
- File.join(*from)
- end
+ attr_accessor :from_path
# :section:
##
# Creates a new formatter that will output HTML
- def initialize markup = nil
+ def initialize options, markup = nil
super
- @th = nil
+ @code_object = nil
+ @from_path = ''
@in_list_entry = nil
@list = nil
- @from_path = ''
+ @th = nil
+ @hard_break = "<br>\n"
# external links
- @markup.add_special(/((link:|https?:|mailto:|ftp:|www\.)\S+\w)/, :HYPERLINK)
+ @markup.add_special(/(?:link:|https?:|mailto:|ftp:|irc:|www\.)\S+\w/,
+ :HYPERLINK)
- # and links of the form <text>[<url>]
- @markup.add_special(/(((\{.*?\})|\b\S+?)\[\S+?\])/, :TIDYLINK)
+ add_special_RDOCLINK
+ add_special_TIDYLINK
init_tags
end
@@ -83,6 +65,37 @@ 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>
+
+ def handle_special_HARD_BREAK special
+ '<br>'
+ end
+
##
# +special+ is a potential link. The following schemes are handled:
#
@@ -102,16 +115,33 @@ class RDoc::Markup::ToHtml < RDoc::Markup::Formatter
end
##
+ # +special+ is an rdoc-schemed link that will be converted into a hyperlink.
+ #
+ # For the +rdoc-ref+ scheme the named reference will be returned without
+ # creating a link.
+ #
+ # For the +rdoc-label+ scheme the footnote and label prefixes are stripped
+ # when creating a link. All other contents will be linked verbatim.
+
+ def handle_special_RDOCLINK special
+ handle_RDOCLINK special.text
+ end
+
+ ##
# This +special+ is a link where the label is different from the URL
# <tt>label[url]</tt> or <tt>{long label}[url]</tt>
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
@@ -136,30 +166,62 @@ class RDoc::Markup::ToHtml < RDoc::Markup::Formatter
end
##
+ # Adds +block_quote+ to the output
+
+ def accept_block_quote block_quote
+ @res << "\n<blockquote>"
+
+ block_quote.parts.each do |part|
+ part.accept self
+ end
+
+ @res << "</blockquote>\n"
+ end
+
+ ##
# Adds +paragraph+ to the output
- def accept_paragraph(paragraph)
+ def accept_paragraph paragraph
@res << "\n<p>"
- @res << wrap(to_html(paragraph.text))
+ text = paragraph.text @hard_break
+ text = text.gsub(/\r?\n/, ' ')
+ @res << wrap(to_html(text))
@res << "</p>\n"
end
##
# Adds +verbatim+ to the output
- def accept_verbatim(verbatim)
- @res << "\n<pre>"
- @res << CGI.escapeHTML(verbatim.text.rstrip)
- @res << "</pre>\n"
+ def accept_verbatim verbatim
+ text = verbatim.text.rstrip
+
+ klass = nil
+
+ content = if verbatim.ruby? or parseable? text then
+ begin
+ tokens = RDoc::RubyLex.tokenize text, @options
+ klass = ' class="ruby"'
+
+ RDoc::TokenStream.to_html tokens
+ rescue RDoc::RubyLex::Error
+ CGI.escapeHTML text
+ end
+ else
+ CGI.escapeHTML text
+ 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
##
@@ -208,12 +270,25 @@ class RDoc::Markup::ToHtml < RDoc::Markup::Formatter
end
##
- # Adds +heading+ to the output
+ # Adds +heading+ to the output. The headings greater than 6 are trimmed to
+ # level 6.
+
+ def accept_heading heading
+ level = [6, heading.level].min
- def accept_heading(heading)
- @res << "\n<h#{heading.level}>"
+ label = heading.label @code_object
+
+ @res << if @options.output_decoration
+ "\n<h#{level} id=\"#{label}\">"
+ else
+ "\n<h#{level}>"
+ end
@res << to_html(heading.text)
- @res << "</h#{heading.level}>\n"
+ unless @options.pipe then
+ @res << "<span><a href=\"##{label}\">&para;</a>"
+ @res << " <a href=\"#documentation\">&uarr;</a></span>"
+ end
+ @res << "</h#{level}>\n"
end
##
@@ -226,39 +301,31 @@ class RDoc::Markup::ToHtml < RDoc::Markup::Formatter
# :section: Utilities
##
- # CGI escapes +text+
+ # CGI-escapes +text+
def convert_string(text)
CGI.escapeHTML text
end
##
- # Generate a link for +url+, labeled with +text+. Handles the special cases
+ # Generate a link to +url+ with content +text+. Handles the special cases
# for img: and link: described under handle_special_HYPERLINK
- def gen_url(url, text)
- if url =~ /([A-Za-z]+):(.*)/ then
- type = $1
- path = $2
- else
- type = "http"
- path = url
- url = "http://#{url}"
- end
-
- if type == "link" then
- url = if path[0, 1] == '#' then # is this meaningful?
- path
- else
- self.class.gen_relative_url @from_path, path
- end
- end
+ def gen_url url, text
+ scheme, url, id = parse_url url
- if (type == "http" or type == "https" or type == "link") and
+ if %w[http https link].include?(scheme) and
url =~ /\.(gif|png|jpg|jpeg|bmp)$/ then
"<img src=\"#{url}\" />"
else
- "<a href=\"#{url}\">#{text.sub(%r{^#{type}:/*}, '')}</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
@@ -275,9 +342,9 @@ class RDoc::Markup::ToHtml < RDoc::Markup::Formatter
# Maps attributes to HTML tags
def init_tags
- add_tag :BOLD, "<b>", "</b>"
- add_tag :TT, "<tt>", "</tt>"
- add_tag :EM, "<em>", "</em>"
+ add_tag :BOLD, "<strong>", "</strong>"
+ add_tag :TT, "<code>", "</code>"
+ add_tag :EM, "<em>", "</em>"
end
##
@@ -288,10 +355,10 @@ class RDoc::Markup::ToHtml < RDoc::Markup::Formatter
case list_type
when :BULLET, :LALPHA, :NUMBER, :UALPHA then
"<li>"
- when :LABEL then
- "<dt>#{to_html list_item.label}</dt>\n<dd>"
- when :NOTE then
- "<tr><td class=\"rdoc-term\"><p>#{to_html list_item.label}</p></td>\n<td>"
+ when :LABEL, :NOTE then
+ Array(list_item.label).map do |label|
+ "<dt>#{to_html label}\n"
+ end.join << "<dd>"
else
raise RDoc::Error, "Invalid list type: #{list_type.inspect}"
end
@@ -304,16 +371,22 @@ class RDoc::Markup::ToHtml < RDoc::Markup::Formatter
case list_type
when :BULLET, :LALPHA, :NUMBER, :UALPHA then
"</li>"
- when :LABEL then
+ when :LABEL, :NOTE then
"</dd>"
- when :NOTE then
- "</td></tr>"
else
raise RDoc::Error, "Invalid list type: #{list_type.inspect}"
end
end
##
+ # Returns true if Ripper is available it can create a sexp from +text+
+
+ def parseable? text
+ text =~ /\b(def|class|module|require) |=>|\{\s?\||do \|/ and
+ text !~ /<%|%>/
+ end
+
+ ##
# Converts +item+ to HTML using RDoc::Text#to_html
def to_html item
diff --git a/lib/rdoc/markup/to_html_crossref.rb b/lib/rdoc/markup/to_html_crossref.rb
index 450ea960b5..d27e0ab627 100644
--- a/lib/rdoc/markup/to_html_crossref.rb
+++ b/lib/rdoc/markup/to_html_crossref.rb
@@ -1,6 +1,3 @@
-require 'rdoc/markup/to_html'
-require 'rdoc/cross_reference'
-
##
# Subclass of the RDoc::Markup::ToHtml class that supports looking up method
# names, classes, etc to create links. RDoc::CrossReference is used to
@@ -31,21 +28,20 @@ class RDoc::Markup::ToHtmlCrossref < RDoc::Markup::ToHtml
# references are removed unless +show_hash+ is true. Only method names
# preceded by '#' or '::' are linked, unless +hyperlink_all+ is true.
- def initialize(from_path, context, show_hash, hyperlink_all = false,
- markup = nil)
+ def initialize(options, from_path, context, markup = nil)
raise ArgumentError, 'from_path cannot be nil' if from_path.nil?
- super markup
- crossref_re = hyperlink_all ? ALL_CROSSREF_REGEXP : CROSSREF_REGEXP
+ super options, markup
- @cross_reference = RDoc::CrossReference.new context
+ @context = context
+ @from_path = from_path
+ @hyperlink_all = @options.hyperlink_all
+ @show_hash = @options.show_hash
+ crossref_re = @hyperlink_all ? ALL_CROSSREF_REGEXP : CROSSREF_REGEXP
@markup.add_special crossref_re, :CROSSREF
- @markup.add_special(/rdoc-ref:\S+\w/, :HYPERLINK)
- @from_path = from_path
- @hyperlink_all = hyperlink_all
- @show_hash = show_hash
+ @cross_reference = RDoc::CrossReference.new @context
end
##
@@ -57,6 +53,8 @@ class RDoc::Markup::ToHtmlCrossref < RDoc::Markup::ToHtml
name = name[1..-1] unless @show_hash if name[0, 1] == '#'
+ name = "#{CGI.unescape $'} at #{$1}" if name =~ /(.*[^#:])@/
+
text = name unless text
link lookup, text
@@ -72,6 +70,8 @@ class RDoc::Markup::ToHtmlCrossref < RDoc::Markup::ToHtml
def handle_special_CROSSREF(special)
name = special.text
+ return name if name =~ /@[\w-]+\.[\w-]/ # labels that look like emails
+
unless @hyperlink_all then
# This ensures that words entirely consisting of lowercase letters will
# not have cross-references generated (to suppress lots of erroneous
@@ -93,6 +93,25 @@ class RDoc::Markup::ToHtmlCrossref < RDoc::Markup::ToHtml
end
##
+ # +special+ is an rdoc-schemed link that will be converted into a hyperlink.
+ # For the rdoc-ref scheme the cross-reference will be looked up and the
+ # given name will be used.
+ #
+ # All other contents are handled by
+ # {the superclass}[rdoc-ref:RDoc::Markup::ToHtml#handle_special_RDOCLINK]
+
+ def handle_special_RDOCLINK special
+ url = special.text
+
+ case url
+ when /\Ardoc-ref:/ then
+ cross_reference $'
+ else
+ super
+ end
+ end
+
+ ##
# Generates links for <tt>rdoc-ref:</tt> scheme URLs and allows
# RDoc::Markup::ToHtml to handle other schemes.
@@ -106,13 +125,34 @@ class RDoc::Markup::ToHtmlCrossref < RDoc::Markup::ToHtml
# Creates an HTML link to +name+ with the given +text+.
def link name, text
+ original_name = name
+
+ if name =~ /(.*[^#:])@/ then
+ name = $1
+ label = $'
+ end
+
ref = @cross_reference.resolve name, text
+ text = ref.output_name @context if
+ RDoc::MethodAttr === ref and text == original_name
+
case ref
when String then
ref
else
- "<a href=\"#{ref.as_href @from_path}\">#{text}</a>"
+ path = ref.as_href @from_path
+
+ 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
+
+ "<a href=\"#{path}\">#{text}</a>"
end
end
diff --git a/lib/rdoc/markup/to_html_snippet.rb b/lib/rdoc/markup/to_html_snippet.rb
new file mode 100644
index 0000000000..4ad0a9a4b9
--- /dev/null
+++ b/lib/rdoc/markup/to_html_snippet.rb
@@ -0,0 +1,284 @@
+##
+# Outputs RDoc markup as paragraphs with inline markup only.
+
+class RDoc::Markup::ToHtmlSnippet < RDoc::Markup::ToHtml
+
+ ##
+ # After this many characters the input will be cut off.
+
+ attr_reader :character_limit
+
+ ##
+ # The number of characters seen so far.
+
+ attr_reader :characters # :nodoc:
+
+ ##
+ # The attribute bitmask
+
+ attr_reader :mask
+
+ ##
+ # After this many paragraphs the input will be cut off.
+
+ attr_reader :paragraph_limit
+
+ ##
+ # Count of paragraphs found
+
+ attr_reader :paragraphs
+
+ ##
+ # Creates a new ToHtmlSnippet formatter that will cut off the input on the
+ # next word boundary after the given number of +characters+ or +paragraphs+
+ # of text have been encountered.
+
+ def initialize options, characters = 100, paragraphs = 3, markup = nil
+ super options, markup
+
+ @character_limit = characters
+ @paragraph_limit = paragraphs
+
+ @characters = 0
+ @mask = 0
+ @paragraphs = 0
+
+ @markup.add_special RDoc::CrossReference::CROSSREF_REGEXP, :CROSSREF
+ end
+
+ ##
+ # Adds +heading+ to the output as a paragraph
+
+ def accept_heading heading
+ @res << "<p>#{to_html heading.text}\n"
+
+ add_paragraph
+ end
+
+ ##
+ # Raw sections are untrusted and ignored
+
+ alias accept_raw ignore
+
+ ##
+ # Rules are ignored
+
+ alias accept_rule ignore
+
+ def accept_paragraph paragraph
+ para = @in_list_entry.last || "<p>"
+
+ text = paragraph.text @hard_break
+
+ @res << "#{para}#{wrap to_html text}\n"
+
+ add_paragraph
+ end
+
+ ##
+ # Finishes consumption of +list_item+
+
+ def accept_list_item_end list_item
+ end
+
+ ##
+ # Prepares the visitor for consuming +list_item+
+
+ def accept_list_item_start list_item
+ @res << list_item_start(list_item, @list.last)
+ end
+
+ ##
+ # Prepares the visitor for consuming +list+
+
+ def accept_list_start list
+ @list << list.type
+ @res << html_list_name(list.type, true)
+ @in_list_entry.push ''
+ end
+
+ ##
+ # Adds +verbatim+ to the output
+
+ def accept_verbatim verbatim
+ throw :done if @characters >= @character_limit
+ input = verbatim.text.rstrip
+
+ text = truncate input
+ text << ' ...' unless text == input
+
+ super RDoc::Markup::Verbatim.new text
+
+ add_paragraph
+ end
+
+ ##
+ # Prepares the visitor for HTML snippet generation
+
+ def start_accepting
+ super
+
+ @characters = 0
+ end
+
+ ##
+ # Removes escaping from the cross-references in +special+
+
+ def handle_special_CROSSREF special
+ special.text.sub(/\A\\/, '')
+ end
+
+ ##
+ # +special+ is a <code><br></code>
+
+ def handle_special_HARD_BREAK special
+ @characters -= 4
+ '<br>'
+ end
+
+ ##
+ # Lists are paragraphs, but notes and labels have a separator
+
+ def list_item_start list_item, list_type
+ throw :done if @characters >= @character_limit
+
+ case list_type
+ when :BULLET, :LALPHA, :NUMBER, :UALPHA then
+ "<p>"
+ when :LABEL, :NOTE then
+ labels = Array(list_item.label).map do |label|
+ to_html label
+ end.join ', '
+
+ labels << " &mdash; " unless labels.empty?
+
+ start = "<p>#{labels}"
+ @characters += 1 # try to include the label
+ start
+ else
+ raise RDoc::Error, "Invalid list type: #{list_type.inspect}"
+ end
+ end
+
+ ##
+ # Returns just the text of +link+, +url+ is only used to determine the link
+ # type.
+
+ def gen_url url, text
+ if url =~ /^rdoc-label:([^:]*)(?::(.*))?/ then
+ type = "link"
+ elsif url =~ /([A-Za-z]+):(.*)/ then
+ type = $1
+ else
+ type = "http"
+ end
+
+ if (type == "http" or type == "https" or type == "link") and
+ url =~ /\.(gif|png|jpg|jpeg|bmp)$/ then
+ ''
+ else
+ text.sub(%r%^#{type}:/*%, '')
+ end
+ end
+
+ ##
+ # In snippets, there are no lists
+
+ def html_list_name list_type, open_tag
+ ''
+ end
+
+ ##
+ # Throws +:done+ when paragraph_limit paragraphs have been encountered
+
+ def add_paragraph
+ @paragraphs += 1
+
+ throw :done if @paragraphs >= @paragraph_limit
+ end
+
+ ##
+ # Marks up +content+
+
+ def convert content
+ catch :done do
+ return super
+ end
+
+ end_accepting
+ end
+
+ ##
+ # Converts flow items +flow+
+
+ def convert_flow flow
+ throw :done if @characters >= @character_limit
+
+ res = []
+ @mask = 0
+
+ flow.each do |item|
+ case item
+ when RDoc::Markup::AttrChanger then
+ off_tags res, item
+ on_tags res, item
+ when String then
+ text = convert_string item
+ res << truncate(text)
+ when RDoc::Markup::Special then
+ text = convert_special item
+ res << truncate(text)
+ else
+ raise "Unknown flow element: #{item.inspect}"
+ end
+
+ if @characters >= @character_limit then
+ off_tags res, RDoc::Markup::AttrChanger.new(0, @mask)
+ break
+ end
+ end
+
+ res << ' ...' if @characters >= @character_limit
+
+ res.join
+ end
+
+ ##
+ # Maintains a bitmask to allow HTML elements to be closed properly. See
+ # RDoc::Markup::Formatter.
+
+ def on_tags res, item
+ @mask ^= item.turn_on
+
+ super
+ end
+
+ ##
+ # Maintains a bitmask to allow HTML elements to be closed properly. See
+ # RDoc::Markup::Formatter.
+
+ def off_tags res, item
+ @mask ^= item.turn_off
+
+ super
+ end
+
+ ##
+ # Truncates +text+ at the end of the first word after the character_limit.
+
+ def truncate text
+ length = text.length
+ characters = @characters
+ @characters += length
+
+ return text if @characters < @character_limit
+
+ remaining = @character_limit - characters
+
+ text =~ /\A(.{#{remaining},}?)(\s|$)/m # TODO word-break instead of \s?
+
+ $1
+ end
+
+end
+
diff --git a/lib/rdoc/markup/to_joined_paragraph.rb b/lib/rdoc/markup/to_joined_paragraph.rb
new file mode 100644
index 0000000000..835841071d
--- /dev/null
+++ b/lib/rdoc/markup/to_joined_paragraph.rb
@@ -0,0 +1,71 @@
+##
+# Joins the parts of an RDoc::Markup::Paragraph into a single String.
+#
+# This allows for easier maintenance and testing of Markdown support.
+#
+# This formatter only works on Paragraph instances. Attempting to process
+# other markup syntax items will not work.
+
+class RDoc::Markup::ToJoinedParagraph < RDoc::Markup::Formatter
+
+ def initialize # :nodoc:
+ super nil
+ end
+
+ def start_accepting # :nodoc:
+ end
+
+ def end_accepting # :nodoc:
+ end
+
+ ##
+ # Converts the parts of +paragraph+ to a single entry.
+
+ def accept_paragraph paragraph
+ parts = []
+ string = false
+
+ paragraph.parts.each do |part|
+ if String === part then
+ if string then
+ string << part
+ else
+ parts << part
+ string = part
+ end
+ else
+ parts << part
+ string = false
+ end
+ end
+
+ parts = parts.map do |part|
+ if String === part then
+ part.rstrip
+ else
+ part
+ end
+ end
+
+ # TODO use Enumerable#chunk when Ruby 1.8 support is dropped
+ #parts = paragraph.parts.chunk do |part|
+ # String === part
+ #end.map do |string, chunk|
+ # string ? chunk.join.rstrip : chunk
+ #end.flatten
+
+ paragraph.parts.replace parts
+ end
+
+ alias accept_block_quote ignore
+ alias accept_heading ignore
+ alias accept_list_end ignore
+ alias accept_list_item_end ignore
+ alias accept_list_item_start ignore
+ alias accept_list_start ignore
+ alias accept_raw ignore
+ alias accept_rule ignore
+ alias accept_verbatim ignore
+
+end
+
diff --git a/lib/rdoc/markup/to_label.rb b/lib/rdoc/markup/to_label.rb
new file mode 100644
index 0000000000..ace89c324a
--- /dev/null
+++ b/lib/rdoc/markup/to_label.rb
@@ -0,0 +1,74 @@
+require 'cgi'
+
+##
+# Creates HTML-safe labels suitable for use in id attributes. Tidylinks are
+# converted to their link part and cross-reference links have the suppression
+# marks removed (\\SomeClass is converted to SomeClass).
+
+class RDoc::Markup::ToLabel < RDoc::Markup::Formatter
+
+ attr_reader :res # :nodoc:
+
+ ##
+ # Creates a new formatter that will output HTML-safe labels
+
+ def initialize markup = nil
+ super nil, markup
+
+ @markup.add_special RDoc::CrossReference::CROSSREF_REGEXP, :CROSSREF
+ @markup.add_special(/(((\{.*?\})|\b\S+?)\[\S+?\])/, :TIDYLINK)
+
+ add_tag :BOLD, '', ''
+ add_tag :TT, '', ''
+ add_tag :EM, '', ''
+
+ @res = []
+ end
+
+ ##
+ # Converts +text+ to an HTML-safe label
+
+ def convert text
+ label = convert_flow @am.flow text
+
+ CGI.escape label
+ end
+
+ ##
+ # Converts the CROSSREF +special+ to plain text, removing the suppression
+ # marker, if any
+
+ def handle_special_CROSSREF special
+ text = special.text
+
+ text.sub(/^\\/, '')
+ end
+
+ ##
+ # Converts the TIDYLINK +special+ to just the text part
+
+ def handle_special_TIDYLINK special
+ text = special.text
+
+ return text unless text =~ /\{(.*?)\}\[(.*?)\]/ or text =~ /(\S+)\[(.*?)\]/
+
+ $1
+ end
+
+ alias accept_blank_line ignore
+ alias accept_block_quote ignore
+ alias accept_heading ignore
+ alias accept_list_end ignore
+ alias accept_list_item_end ignore
+ alias accept_list_item_start ignore
+ alias accept_list_start ignore
+ alias accept_paragraph ignore
+ alias accept_raw ignore
+ alias accept_rule ignore
+ alias accept_verbatim ignore
+ alias end_accepting ignore
+ alias handle_special_HARD_BREAK ignore
+ alias start_accepting ignore
+
+end
+
diff --git a/lib/rdoc/markup/to_markdown.rb b/lib/rdoc/markup/to_markdown.rb
new file mode 100644
index 0000000000..d4b15bf41b
--- /dev/null
+++ b/lib/rdoc/markup/to_markdown.rb
@@ -0,0 +1,191 @@
+# :markup: markdown
+
+##
+# Outputs parsed markup as Markdown
+
+class RDoc::Markup::ToMarkdown < RDoc::Markup::ToRdoc
+
+ ##
+ # Creates a new formatter that will output Markdown format text
+
+ def initialize markup = nil
+ super
+
+ @headings[1] = ['# ', '']
+ @headings[2] = ['## ', '']
+ @headings[3] = ['### ', '']
+ @headings[4] = ['#### ', '']
+ @headings[5] = ['##### ', '']
+ @headings[6] = ['###### ', '']
+
+ add_special_RDOCLINK
+ add_special_TIDYLINK
+
+ @hard_break = " \n"
+ end
+
+ ##
+ # Maps attributes to HTML sequences
+
+ def init_tags
+ add_tag :BOLD, '**', '**'
+ add_tag :EM, '*', '*'
+ add_tag :TT, '`', '`'
+ end
+
+ ##
+ # Adds a newline to the output
+
+ def handle_special_HARD_BREAK special
+ " \n"
+ end
+
+ ##
+ # Finishes consumption of `list`
+
+ def accept_list_end list
+ @res << "\n"
+
+ super
+ end
+
+ ##
+ # Finishes consumption of `list_item`
+
+ def accept_list_item_end list_item
+ width = case @list_type.last
+ when :BULLET then
+ 4
+ when :NOTE, :LABEL then
+ use_prefix
+
+ 4
+ else
+ @list_index[-1] = @list_index.last.succ
+ 4
+ end
+
+ @indent -= width
+ end
+
+ ##
+ # Prepares the visitor for consuming `list_item`
+
+ def accept_list_item_start list_item
+ type = @list_type.last
+
+ case type
+ when :NOTE, :LABEL then
+ bullets = Array(list_item.label).map do |label|
+ attributes(label).strip
+ end.join "\n"
+
+ bullets << "\n:"
+
+ @prefix = ' ' * @indent
+ @indent += 4
+ @prefix << bullets + (' ' * (@indent - 1))
+ else
+ bullet = type == :BULLET ? '*' : @list_index.last.to_s + '.'
+ @prefix = (' ' * @indent) + bullet.ljust(4)
+
+ @indent += 4
+ end
+ end
+
+ ##
+ # Prepares the visitor for consuming `list`
+
+ def accept_list_start list
+ case list.type
+ when :BULLET, :LABEL, :NOTE then
+ @list_index << nil
+ when :LALPHA, :NUMBER, :UALPHA then
+ @list_index << 1
+ else
+ raise RDoc::Error, "invalid list type #{list.type}"
+ end
+
+ @list_width << 4
+ @list_type << list.type
+ end
+
+ ##
+ # Adds `rule` to the output
+
+ def accept_rule rule
+ use_prefix or @res << ' ' * @indent
+ @res << '-' * 3
+ @res << "\n"
+ end
+
+ ##
+ # Outputs `verbatim` indented 4 columns
+
+ def accept_verbatim verbatim
+ indent = ' ' * (@indent + 4)
+
+ verbatim.parts.each do |part|
+ @res << indent unless part == "\n"
+ @res << part
+ end
+
+ @res << "\n" unless @res =~ /\n\z/
+ end
+
+ ##
+ # Creates a Markdown-style URL from +url+ with +text+.
+
+ def gen_url url, text
+ scheme, url, = parse_url url
+
+ "[#{text.sub(%r{^#{scheme}:/*}i, '')}](#{url})"
+ end
+
+ ##
+ # Handles <tt>rdoc-</tt> type links for footnotes.
+
+ def handle_rdoc_link url
+ case url
+ when /^rdoc-ref:/ then
+ $'
+ when /^rdoc-label:footmark-(\d+)/ then
+ "[^#{$1}]:"
+ when /^rdoc-label:foottext-(\d+)/ then
+ "[^#{$1}]"
+ when /^rdoc-label:label-/ then
+ gen_url url, $'
+ when /^rdoc-image:/ then
+ "![](#{$'})"
+ when /^rdoc-[a-z]+:/ then
+ $'
+ end
+ end
+
+ ##
+ # Converts the RDoc markup tidylink into a Markdown.style link.
+
+ def handle_special_TIDYLINK special
+ text = special.text
+
+ return text unless text =~ /\{(.*?)\}\[(.*?)\]/ or text =~ /(\S+)\[(.*?)\]/
+
+ label = $1
+ url = $2
+
+ if url =~ /^rdoc-label:foot/ then
+ handle_rdoc_link url
+ else
+ gen_url url, label
+ end
+ end
+
+ ##
+ # Converts the rdoc-...: links into a Markdown.style links.
+
+ def handle_special_RDOCLINK special
+ handle_rdoc_link special.text
+ end
+
+end
+
diff --git a/lib/rdoc/markup/to_rdoc.rb b/lib/rdoc/markup/to_rdoc.rb
index 6f2faac2f6..f16b4ed5a3 100644
--- a/lib/rdoc/markup/to_rdoc.rb
+++ b/lib/rdoc/markup/to_rdoc.rb
@@ -1,6 +1,3 @@
-require 'rdoc/markup/formatter'
-require 'rdoc/markup/inline'
-
##
# Outputs RDoc markup as RDoc markup! (mostly)
@@ -45,7 +42,7 @@ class RDoc::Markup::ToRdoc < RDoc::Markup::Formatter
# Creates a new formatter that will output (mostly) \RDoc markup
def initialize markup = nil
- super
+ super nil, markup
@markup.add_special(/\\\S/, :SUPPRESSED_CROSSREF)
@width = 78
@@ -60,6 +57,8 @@ class RDoc::Markup::ToRdoc < RDoc::Markup::Formatter
@headings[4] = ['==== ', '']
@headings[5] = ['===== ', '']
@headings[6] = ['====== ', '']
+
+ @hard_break = "\n"
end
##
@@ -79,6 +78,21 @@ class RDoc::Markup::ToRdoc < RDoc::Markup::Formatter
end
##
+ # Adds +paragraph+ to the output
+
+ def accept_block_quote block_quote
+ @indent += 2
+
+ block_quote.parts.each do |part|
+ @prefix = '> '
+
+ part.accept self
+ end
+
+ @indent -= 2
+ end
+
+ ##
# Adds +heading+ to the output
def accept_heading heading
@@ -106,6 +120,11 @@ class RDoc::Markup::ToRdoc < RDoc::Markup::Formatter
when :BULLET then
2
when :NOTE, :LABEL then
+ if @prefix then
+ @res << @prefix.strip
+ @prefix = nil
+ end
+
@res << "\n"
2
else
@@ -125,10 +144,15 @@ class RDoc::Markup::ToRdoc < RDoc::Markup::Formatter
case type
when :NOTE, :LABEL then
- bullet = attributes(list_item.label) + ":\n"
+ bullets = Array(list_item.label).map do |label|
+ attributes(label).strip
+ end.join "\n"
+
+ bullets << ":\n" unless bullets.empty?
+
@prefix = ' ' * @indent
@indent += 2
- @prefix << bullet + (' ' * @indent)
+ @prefix << bullets + (' ' * @indent)
else
bullet = type == :BULLET ? '*' : @list_index.last.to_s + '.'
@prefix = (' ' * @indent) + bullet.ljust(bullet.length + 1)
@@ -168,7 +192,8 @@ class RDoc::Markup::ToRdoc < RDoc::Markup::Formatter
# Adds +paragraph+ to the output
def accept_paragraph paragraph
- wrap attributes(paragraph.text)
+ text = paragraph.text @hard_break
+ wrap attributes text
end
##
@@ -176,7 +201,8 @@ class RDoc::Markup::ToRdoc < RDoc::Markup::Formatter
def accept_indented_paragraph paragraph
@indent += paragraph.indent
- wrap attributes(paragraph.text)
+ text = paragraph.text @hard_break
+ wrap attributes text
@indent -= paragraph.indent
end
@@ -235,6 +261,13 @@ class RDoc::Markup::ToRdoc < RDoc::Markup::Formatter
end
##
+ # Adds a newline to the output
+
+ def handle_special_HARD_BREAK special
+ "\n"
+ end
+
+ ##
# Prepares the visitor for text generation
def start_accepting
@@ -252,8 +285,7 @@ class RDoc::Markup::ToRdoc < RDoc::Markup::Formatter
# prefix for later consumption.
def use_prefix
- prefix = @prefix
- @prefix = nil
+ prefix, @prefix = @prefix, nil
@res << prefix if prefix
prefix
diff --git a/lib/rdoc/markup/to_table_of_contents.rb b/lib/rdoc/markup/to_table_of_contents.rb
new file mode 100644
index 0000000000..2e0f98cfeb
--- /dev/null
+++ b/lib/rdoc/markup/to_table_of_contents.rb
@@ -0,0 +1,87 @@
+##
+# Extracts just the RDoc::Markup::Heading elements from a
+# RDoc::Markup::Document to help build a table of contents
+
+class RDoc::Markup::ToTableOfContents < RDoc::Markup::Formatter
+
+ @to_toc = nil
+
+ ##
+ # Singleton for table-of-contents generation
+
+ def self.to_toc
+ @to_toc ||= new
+ end
+
+ ##
+ # Output accumulator
+
+ attr_reader :res
+
+ ##
+ # Omits headings with a level less than the given level.
+
+ attr_accessor :omit_headings_below
+
+ def initialize # :nodoc:
+ super nil
+
+ @omit_headings_below = nil
+ end
+
+ ##
+ # Adds +document+ to the output, using its heading cutoff if present
+
+ def accept_document document
+ @omit_headings_below = document.omit_headings_below
+
+ super
+ end
+
+ ##
+ # Adds +heading+ to the table of contents
+
+ def accept_heading heading
+ @res << heading unless suppressed? heading
+ end
+
+ ##
+ # Returns the table of contents
+
+ def end_accepting
+ @res
+ end
+
+ ##
+ # Prepares the visitor for text generation
+
+ def start_accepting
+ @omit_headings_below = nil
+ @res = []
+ end
+
+ ##
+ # Returns true if +heading+ is below the display threshold
+
+ def suppressed? heading
+ return false unless @omit_headings_below
+
+ heading.level > @omit_headings_below
+ end
+
+ # :stopdoc:
+ alias accept_block_quote ignore
+ alias accept_raw ignore
+ alias accept_rule ignore
+ alias accept_blank_line ignore
+ alias accept_paragraph ignore
+ alias accept_verbatim ignore
+ alias accept_list_end ignore
+ alias accept_list_item_start ignore
+ alias accept_list_item_end ignore
+ alias accept_list_end_bullet ignore
+ alias accept_list_start ignore
+ # :startdoc:
+
+end
+
diff --git a/lib/rdoc/markup/to_test.rb b/lib/rdoc/markup/to_test.rb
index 4847fd29f7..c51f64b917 100644
--- a/lib/rdoc/markup/to_test.rb
+++ b/lib/rdoc/markup/to_test.rb
@@ -1,6 +1,3 @@
-require 'rdoc/markup'
-require 'rdoc/markup/formatter'
-
##
# This Markup outputter is used for testing purposes.
diff --git a/lib/rdoc/markup/to_tt_only.rb b/lib/rdoc/markup/to_tt_only.rb
index 078e87db98..e2da20c6f3 100644
--- a/lib/rdoc/markup/to_tt_only.rb
+++ b/lib/rdoc/markup/to_tt_only.rb
@@ -1,6 +1,3 @@
-require 'rdoc/markup/formatter'
-require 'rdoc/markup/inline'
-
##
# Extracts sections of text enclosed in plus, tt or code. Used to discover
# undocumented parameters.
@@ -21,12 +18,19 @@ class RDoc::Markup::ToTtOnly < RDoc::Markup::Formatter
# Creates a new tt-only formatter.
def initialize markup = nil
- super
+ super nil, markup
add_tag :TT, nil, nil
end
##
+ # Adds tts from +block_quote+ to the output
+
+ def accept_block_quote block_quote
+ tt_sections block_quote.text
+ end
+
+ ##
# Pops the list type for +list+ from #list_type
def accept_list_end list
@@ -46,7 +50,9 @@ class RDoc::Markup::ToTtOnly < RDoc::Markup::Formatter
def accept_list_item_start list_item
case @list_type.last
when :NOTE, :LABEL then
- tt_sections(list_item.label)
+ Array(list_item.label).map do |label|
+ tt_sections label
+ end.flatten
end
end
diff --git a/lib/rdoc/markup/verbatim.rb b/lib/rdoc/markup/verbatim.rb
index 8fe2184699..0ddde675e3 100644
--- a/lib/rdoc/markup/verbatim.rb
+++ b/lib/rdoc/markup/verbatim.rb
@@ -4,6 +4,21 @@
class RDoc::Markup::Verbatim < RDoc::Markup::Raw
##
+ # Format of this verbatim section
+
+ attr_accessor :format
+
+ def initialize *parts # :nodoc:
+ super
+
+ @format = nil
+ end
+
+ def == other # :nodoc:
+ super and @format == other.format
+ end
+
+ ##
# Calls #accept_verbatim on +visitor+
def accept visitor
@@ -34,6 +49,29 @@ class RDoc::Markup::Verbatim < RDoc::Markup::Raw
@parts = parts
end
+ def pretty_print q # :nodoc:
+ self.class.name =~ /.*::(\w{1,4})/i
+
+ q.group 2, "[#{$1.downcase}: ", ']' do
+ if @format then
+ q.text "format: #{@format}"
+ q.breakable
+ end
+
+ q.seplist @parts do |part|
+ q.pp part
+ end
+ end
+ end
+
+ ##
+ # Is this verbatim section Ruby code?
+
+ def ruby?
+ @format ||= nil # TODO for older ri data, switch the tree to marshal_dump
+ @format == :ruby
+ end
+
##
# The text of the section
diff --git a/lib/rdoc/meta_method.rb b/lib/rdoc/meta_method.rb
index e0c065c2ba..68ba8109e0 100644
--- a/lib/rdoc/meta_method.rb
+++ b/lib/rdoc/meta_method.rb
@@ -1,5 +1,3 @@
-require 'rdoc/any_method'
-
##
# MetaMethod represents a meta-programmed method
diff --git a/lib/rdoc/method_attr.rb b/lib/rdoc/method_attr.rb
index a4cd3c5fff..8bde102640 100644
--- a/lib/rdoc/method_attr.rb
+++ b/lib/rdoc/method_attr.rb
@@ -1,5 +1,3 @@
-require 'rdoc/code_object'
-
##
# Abstract class representing either a method or an attribute.
@@ -97,10 +95,27 @@ 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)
- [@singleton ? 0 : 1, name] <=> [other.singleton ? 0 : 1, other.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
end
##
@@ -135,6 +150,15 @@ class RDoc::MethodAttr < RDoc::CodeObject
@see
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 find_see # :nodoc:
return nil if singleton || is_alias_for
@@ -151,7 +175,7 @@ class RDoc::MethodAttr < RDoc::CodeObject
return nil unless parent.respond_to? :ancestors
searched = parent.ancestors
- kernel = RDoc::TopLevel.all_modules_hash['Kernel']
+ kernel = @store.modules_hash['Kernel']
searched << kernel if kernel &&
parent != kernel && !searched.include?(kernel)
@@ -173,10 +197,10 @@ class RDoc::MethodAttr < RDoc::CodeObject
# Abstract method. Contexts in their building phase call this
# to register a new alias for this known method/attribute.
#
- # - creates a new AnyMethod/Attribute +newa+ named an_alias.new_name;
- # - adds +self+ as +newa.is_alias_for+;
- # - adds +newa+ to #aliases
- # - adds +newa+ to the methods/attributes of +context+.
+ # - creates a new AnyMethod/Attribute named <tt>an_alias.new_name</tt>;
+ # - adds +self+ as an alias for the new method or attribute
+ # - adds the method or attribute to #aliases
+ # - adds the method or attribute to +context+.
def add_alias(an_alias, context)
raise NotImplementedError
@@ -199,7 +223,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)
@@ -261,6 +285,8 @@ class RDoc::MethodAttr < RDoc::CodeObject
# HTML id-friendly method/attribute name
def html_name
+ require 'cgi'
+
CGI.escape(@name.gsub('-', '-2D')).gsub('%','-').sub(/^-/, '')
end
@@ -268,14 +294,39 @@ class RDoc::MethodAttr < RDoc::CodeObject
# Full method/attribute name including namespace
def full_name
- @full_name || "#{parent_name}#{pretty_name}"
+ @full_name ||= "#{parent_name}#{pretty_name}"
+ end
+
+ def inspect # :nodoc:
+ alias_for = @is_alias_for ? " (alias for #{@is_alias_for.name})" : nil
+ visibility = self.visibility
+ visibility = "forced #{visibility}" if force_documentation
+ "#<%s:0x%x %s (%s)%s>" % [
+ self.class, object_id,
+ full_name,
+ visibility,
+ alias_for,
+ ]
end
##
# '::' for a class method/attribute, '#' for an instance method.
def name_prefix
- singleton ? '::' : '#'
+ @singleton ? '::' : '#'
+ end
+
+ ##
+ # Name for output to HTML. For class methods the full name with a "." is
+ # used like +SomeClass.method_name+. For instance methods the class name is
+ # used if +context+ does not match the parent.
+ #
+ # This is to help prevent people from using :: to call class methods.
+
+ def output_name context
+ return "#{name_prefix}#{@name}" if context == parent
+
+ "#{parent_name}#{@singleton ? '.' : '#'}#{@name}"
end
##
@@ -293,7 +344,7 @@ class RDoc::MethodAttr < RDoc::CodeObject
end
##
- # Path to this method
+ # Path to this method for use with HTML generator output.
def path
"#{@parent.path}##{aref}"
@@ -331,15 +382,19 @@ class RDoc::MethodAttr < RDoc::CodeObject
end
end
- def inspect # :nodoc:
- alias_for = @is_alias_for ? " (alias for #{@is_alias_for.name})" : nil
- visibility = self.visibility
- visibility = "forced #{visibility}" if force_documentation
- "#<%s:0x%x %s (%s)%s>" % [
- self.class, object_id,
+ ##
+ # Used by RDoc::Generator::JsonIndex to create a record for the search
+ # engine.
+
+ def search_record
+ [
+ @name,
full_name,
- visibility,
- alias_for,
+ @name,
+ @parent.full_name,
+ path,
+ params,
+ snippet(@comment),
]
end
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 f67380e783..7589e2686c 100644
--- a/lib/rdoc/normal_class.rb
+++ b/lib/rdoc/normal_class.rb
@@ -1,15 +1,27 @@
-require 'rdoc/class_module'
-
##
# A normal class, neither singleton nor anonymous
class RDoc::NormalClass < RDoc::ClassModule
##
- # Appends the superclass, if any, to the included modules.
+ # The ancestors of this class including modules. Unlike Module#ancestors,
+ # this class is not included in the result. The result will contain both
+ # RDoc::ClassModules and Strings.
def ancestors
- superclass ? super + [superclass] : super
+ if String === superclass then
+ super << superclass
+ elsif superclass then
+ ancestors = super
+ ancestors << superclass
+ ancestors.concat superclass.ancestors
+ else
+ super
+ end
+ end
+
+ def aref_prefix # :nodoc:
+ 'class'
end
##
@@ -19,11 +31,15 @@ class RDoc::NormalClass < RDoc::ClassModule
"class #{full_name}"
end
+ def direct_ancestors
+ superclass ? super + [superclass] : super
+ end
+
def inspect # :nodoc:
superclass = @superclass ? " < #{@superclass}" : nil
- "<%s:0x%x class %s%s includes: %p attributes: %p methods: %p aliases: %p>" % [
+ "<%s:0x%x class %s%s includes: %p extends: %p attributes: %p methods: %p aliases: %p>" % [
self.class, object_id,
- full_name, superclass, @includes, @attributes, @method_list, @aliases
+ full_name, superclass, @includes, @extends, @attributes, @method_list, @aliases
]
end
@@ -46,19 +62,24 @@ class RDoc::NormalClass < RDoc::ClassModule
q.seplist @includes do |inc| q.pp inc end
q.breakable
+ q.text "constants:"
+ q.breakable
+ q.seplist @constants do |const| q.pp const end
+
+ q.breakable
q.text "attributes:"
q.breakable
- q.seplist @attributes do |inc| q.pp inc end
+ q.seplist @attributes do |attr| q.pp attr end
q.breakable
q.text "methods:"
q.breakable
- q.seplist @method_list do |inc| q.pp inc end
+ q.seplist @method_list do |meth| q.pp meth end
q.breakable
q.text "aliases:"
q.breakable
- q.seplist @aliases do |inc| q.pp inc end
+ q.seplist @aliases do |aliaz| q.pp aliaz end
q.breakable
q.text "comment:"
diff --git a/lib/rdoc/normal_module.rb b/lib/rdoc/normal_module.rb
index 0fa7223547..961c431ed6 100644
--- a/lib/rdoc/normal_module.rb
+++ b/lib/rdoc/normal_module.rb
@@ -1,14 +1,16 @@
-require 'rdoc/class_module'
-
##
# A normal module, like NormalClass
class RDoc::NormalModule < RDoc::ClassModule
+ def aref_prefix # :nodoc:
+ 'module'
+ end
+
def inspect # :nodoc:
- "#<%s:0x%x module %s includes: %p attributes: %p methods: %p aliases: %p>" % [
+ "#<%s:0x%x module %s includes: %p extends: %p attributes: %p methods: %p aliases: %p>" % [
self.class, object_id,
- full_name, @includes, @attributes, @method_list, @aliases
+ full_name, @includes, @extends, @attributes, @method_list, @aliases
]
end
@@ -34,19 +36,24 @@ class RDoc::NormalModule < RDoc::ClassModule
q.seplist @includes do |inc| q.pp inc end
q.breakable
+ q.breakable
+ q.text "constants:"
+ q.breakable
+ q.seplist @constants do |const| q.pp const end
+
q.text "attributes:"
q.breakable
- q.seplist @attributes do |inc| q.pp inc end
+ q.seplist @attributes do |attr| q.pp attr end
q.breakable
q.text "methods:"
q.breakable
- q.seplist @method_list do |inc| q.pp inc end
+ q.seplist @method_list do |meth| q.pp meth end
q.breakable
q.text "aliases:"
q.breakable
- q.seplist @aliases do |inc| q.pp inc end
+ q.seplist @aliases do |aliaz| q.pp aliaz end
q.breakable
q.text "comment:"
diff --git a/lib/rdoc/options.rb b/lib/rdoc/options.rb
index bab5463897..e27be89dbf 100644
--- a/lib/rdoc/options.rb
+++ b/lib/rdoc/options.rb
@@ -1,9 +1,75 @@
require 'optparse'
-
-require 'rdoc/ri/paths'
+require 'pathname'
##
# RDoc::Options handles the parsing and storage of options
+#
+# == Saved Options
+#
+# You can save some options like the markup format in the
+# <tt>.rdoc_options</tt> file in your gem. The easiest way to do this is:
+#
+# rdoc --markup tomdoc --write-options
+#
+# Which will automatically create the file and fill it with the options you
+# specified.
+#
+# The following options will not be saved since they interfere with the user's
+# preferences or with the normal operation of RDoc:
+#
+# * +--coverage-report+
+# * +--dry-run+
+# * +--encoding+
+# * +--force-update+
+# * +--format+
+# * +--pipe+
+# * +--quiet+
+# * +--template+
+# * +--verbose+
+#
+# == Custom Options
+#
+# Generators can hook into RDoc::Options to add generator-specific command
+# line options.
+#
+# When <tt>--format</tt> is encountered in ARGV, RDoc calls ::setup_options on
+# the generator class to add extra options to the option parser. Options for
+# custom generators must occur after <tt>--format</tt>. <tt>rdoc --help</tt>
+# will list options for all installed generators.
+#
+# Example:
+#
+# class RDoc::Generator::Spellcheck
+# RDoc::RDoc.add_generator self
+#
+# def self.setup_options rdoc_options
+# op = rdoc_options.option_parser
+#
+# op.on('--spell-dictionary DICTIONARY',
+# RDoc::Options::Path) do |dictionary|
+# rdoc_options.spell_dictionary = dictionary
+# end
+# 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
+# addition to the validators that ship with OptionParser (String, Integer,
+# Float, TrueClass, FalseClass, Array, Regexp, Date, Time, URI, etc.),
+# RDoc::Options adds Path, PathArray and Template.
class RDoc::Options
@@ -25,9 +91,57 @@ class RDoc::Options
}
##
- # Template option validator for OptionParser
+ # RDoc options ignored (or handled specially) by --write-options
+
+ SPECIAL = %w[
+ coverage_report
+ dry_run
+ encoding
+ files
+ force_output
+ force_update
+ generator
+ generator_name
+ generator_options
+ generators
+ op_dir
+ option_parser
+ pipe
+ rdoc_include
+ root
+ static_path
+ stylesheet_url
+ template
+ template_dir
+ update_output_dir
+ verbosity
+ write_options
+ ]
+
+ ##
+ # Option validator for OptionParser that matches a directory that exists on
+ # the filesystem.
+
+ Directory = Object.new
+
+ ##
+ # Option validator for OptionParser that matches a file or directory that
+ # exists on the filesystem.
- Template = nil
+ Path = Object.new
+
+ ##
+ # Option validator for OptionParser that matches a comma-separated list of
+ # files or directories that exist on the filesystem.
+
+ PathArray = Object.new
+
+ ##
+ # Option validator for OptionParser that matches a template directory for an
+ # installed generator that lives in
+ # <tt>"rdoc/generator/template/#{template_name}"</tt>
+
+ Template = Object.new
##
# Character-set for HTML output. #encoding is preferred over #charset
@@ -40,9 +154,11 @@ class RDoc::Options
attr_accessor :dry_run
##
- # Encoding of output where. This is set via --encoding.
+ # The output encoding. All input files will be transcoded to this encoding.
+ #
+ # The default encoding is UTF-8. This is set via --encoding.
- attr_accessor :encoding if Object.const_defined? :Encoding
+ attr_accessor :encoding
##
# Files matching this pattern will be excluded
@@ -71,11 +187,16 @@ class RDoc::Options
attr_accessor :formatter
##
- # Description of the output generator (set with the <tt>--fmt</tt> option)
+ # Description of the output generator (set with the <tt>--format</tt> option)
attr_accessor :generator
##
+ # For #==
+
+ attr_reader :generator_name # :nodoc:
+
+ ##
# Loaded generator options. Used to prevent --help from loading the same
# options multiple times.
@@ -99,6 +220,12 @@ class RDoc::Options
attr_accessor :main_page
##
+ # The default markup format. The default is 'rdoc'. 'markdown', 'tomdoc'
+ # and 'rd' are also built-in.
+
+ attr_accessor :markup
+
+ ##
# If true, only report on undocumented files
attr_accessor :coverage_report
@@ -114,6 +241,16 @@ 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.
+
+ attr_accessor :page_dir
+
+ ##
# Is RDoc in pipe mode?
attr_accessor :pipe
@@ -124,11 +261,23 @@ class RDoc::Options
attr_accessor :rdoc_include
##
+ # Root of the source documentation will be generated for. Set this when
+ # building documentation outside the source directory. Defaults to the
+ # current directory.
+
+ attr_accessor :root
+
+ ##
# Include the '#' at the front of hyperlinked instance method names
attr_accessor :show_hash
##
+ # Directory to copy static files from
+
+ attr_accessor :static_path
+
+ ##
# The number of columns in a tab
attr_accessor :tab_width
@@ -144,6 +293,11 @@ class RDoc::Options
attr_accessor :template_dir
##
+ # Additional template stylesheets
+
+ attr_accessor :template_stylesheets
+
+ ##
# Documentation title
attr_accessor :title
@@ -164,16 +318,23 @@ 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
def initialize # :nodoc:
- require 'rdoc/rdoc'
+ init_ivars
+ end
+
+ def init_ivars # :nodoc:
@dry_run = false
@exclude = []
+ @files = nil
@force_output = false
@force_update = true
@generator = nil
@@ -183,29 +344,87 @@ class RDoc::Options
@hyperlink_all = false
@line_numbers = false
@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
- @stylesheet_url = nil
+ @static_path = []
+ @stylesheet_url = nil # TODO remove in RDoc 4
@tab_width = 8
@template = nil
@template_dir = nil
+ @template_stylesheets = []
@title = nil
@update_output_dir = true
@verbosity = 1
@visibility = :protected
@webcvs = nil
+ @write_options = false
if Object.const_defined? :Encoding then
- @encoding = Encoding.default_external
- @charset = @encoding.to_s
+ @encoding = Encoding::UTF_8
+ @charset = @encoding.name
else
+ @encoding = nil
@charset = 'UTF-8'
end
end
+ def init_with map # :nodoc:
+ init_ivars
+
+ encoding = map['encoding']
+ @encoding = if Object.const_defined? :Encoding then
+ encoding ? Encoding.find(encoding) : encoding
+ end
+
+ @charset = map['charset']
+ @exclude = map['exclude']
+ @generator_name = map['generator_name']
+ @hyperlink_all = map['hyperlink_all']
+ @line_numbers = map['line_numbers']
+ @main_page = map['main_page']
+ @markup = map['markup']
+ @op_dir = map['op_dir']
+ @show_hash = map['show_hash']
+ @tab_width = map['tab_width']
+ @template_dir = map['template_dir']
+ @title = map['title']
+ @visibility = map['visibility']
+ @webcvs = map['webcvs']
+
+ @rdoc_include = sanitize_path map['rdoc_include']
+ @static_path = sanitize_path map['static_path']
+ end
+
+ def yaml_initialize tag, map # :nodoc:
+ init_with map
+ end
+
+ def == other # :nodoc:
+ self.class === other and
+ @encoding == other.encoding and
+ @generator_name == other.generator_name and
+ @hyperlink_all == other.hyperlink_all and
+ @line_numbers == other.line_numbers and
+ @main_page == other.main_page and
+ @markup == other.markup and
+ @op_dir == other.op_dir and
+ @rdoc_include == other.rdoc_include and
+ @show_hash == other.show_hash and
+ @static_path == other.static_path and
+ @tab_width == other.tab_width and
+ @template == other.template and
+ @title == other.title and
+ @visibility == other.visibility and
+ @webcvs == other.webcvs
+ end
+
##
# Check that the files on the command line exist
@@ -247,6 +466,24 @@ class RDoc::Options
end
##
+ # For dumping YAML
+
+ def encode_with coder # :nodoc:
+ encoding = @encoding ? @encoding.name : nil
+
+ coder.add 'encoding', encoding
+ coder.add 'static_path', sanitize_path(@static_path)
+ coder.add 'rdoc_include', sanitize_path(@rdoc_include)
+
+ ivars = instance_variables.map { |ivar| ivar.to_s[1..-1] }
+ ivars -= SPECIAL
+
+ ivars.sort.each do |ivar|
+ coder.add ivar, instance_variable_get("@#{ivar}")
+ end
+ end
+
+ ##
# Completes any unfinished option setup business such as filtering for
# existent files, creating a regexp for #exclude and setting a default
# #template.
@@ -255,6 +492,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
@@ -264,6 +503,8 @@ class RDoc::Options
@exclude = Regexp.new(@exclude.join("|"))
end
+ finish_page_dir
+
check_files
# If no template was specified, use the default template for the output
@@ -278,6 +519,20 @@ class RDoc::Options
end
##
+ # Fixes the page_dir to be relative to the root_dir and adds the page_dir to
+ # the files list.
+
+ def finish_page_dir
+ return unless @page_dir
+
+ @files << @page_dir.to_s
+
+ page_dir = @page_dir.expand_path.relative_path_from @root
+
+ @page_dir = page_dir
+ end
+
+ ##
# Returns a properly-space list of generators and their descriptions.
def generator_descriptions
@@ -306,7 +561,7 @@ class RDoc::Options
##
# Parses command line options.
- def parse(argv)
+ def parse argv
ignore_invalid = true
argv.insert(0, *ENV['RDOCOPT'].split) if ENV['RDOCOPT']
@@ -354,6 +609,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"
@@ -367,13 +623,43 @@ Usage: #{opt.program_name} [options] [names...]
template_dir = template_dir_for template
unless template_dir then
- warn "could not find template #{template}"
+ $stderr.puts "could not find template #{template}"
nil
else
[template, template_dir]
end
end
+ opt.accept Directory do |directory|
+ directory = File.expand_path directory
+
+ raise OptionParser::InvalidArgument unless File.directory? directory
+
+ directory
+ end
+
+ opt.accept Path do |path|
+ path = File.expand_path path
+
+ raise OptionParser::InvalidArgument unless File.exist? path
+
+ path
+ end
+
+ opt.accept PathArray do |paths,|
+ paths = if paths then
+ paths.split(',').map { |d| d unless d.empty? }
+ end
+
+ paths.map do |path|
+ path = File.expand_path path
+
+ raise OptionParser::InvalidArgument unless File.exist? path
+
+ path
+ end
+ end
+
opt.separator nil
opt.separator "Parsing options:"
opt.separator nil
@@ -382,9 +668,10 @@ Usage: #{opt.program_name} [options] [names...]
opt.on("--encoding=ENCODING", "-e", Encoding.list.map { |e| e.name },
"Specifies the output encoding. All files",
"read will be converted to this encoding.",
- "Preferred over --charset") do |value|
+ "The default encoding is UTF-8.",
+ "--encoding is preferred over --charset") do |value|
@encoding = Encoding.find value
- @charset = @encoding.to_s # may not be valid value
+ @charset = @encoding.name # may not be valid value
end
opt.separator nil
@@ -430,28 +717,64 @@ Usage: #{opt.program_name} [options] [names...]
opt.separator nil
- opt.on("--pipe",
+ opt.on("--pipe", "-p",
"Convert RDoc on stdin to HTML") do
@pipe = true
end
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
opt.separator nil
+
+ markup_formats = RDoc::Text::MARKUP_FORMAT.keys.sort
+
+ opt.on("--markup=MARKUP", markup_formats,
+ "The markup format for the named files.",
+ "The default is rdoc. Valid values are:",
+ markup_formats.join(', ')) do |value|
+ @markup = value
+ end
+
+ opt.separator nil
+
+ opt.on("--root=ROOT", Directory,
+ "Root of the source tree documentation",
+ "will be generated for. Set this when",
+ "building documentation outside the",
+ "source directory. Default is the",
+ "current directory.") do |root|
+ @root = Pathname(root)
+ end
+
+ opt.separator nil
+
+ opt.on("--page-dir=DIR", Directory,
+ "Directory where guides, your FAQ or",
+ "other pages not associated with a class",
+ "live. Set this when you don't store",
+ "such files at your project root.",
+ "NOTE: Do not use the same file name in",
+ "the page dir and the root of your project") do |page_dir|
+ @page_dir = Pathname(page_dir)
+ end
+
+ opt.separator nil
opt.separator "Common generator options:"
opt.separator nil
@@ -477,7 +800,7 @@ Usage: #{opt.program_name} [options] [names...]
opt.separator nil
- opt.on("--include=DIRECTORIES", "-i", Array,
+ opt.on("--include=DIRECTORIES", "-i", PathArray,
"Set (or add to) the list of directories to",
"be searched when satisfying :include:",
"requests. Can be used more than once.") do |value|
@@ -569,6 +892,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
@@ -576,6 +907,18 @@ Usage: #{opt.program_name} [options] [names...]
opt.separator nil
+ opt.on("--copy-files=PATH", Path,
+ "Specify a file or directory to copy static",
+ "files from.",
+ "If a file is given it will be copied into",
+ "the output dir. If a directory is given the",
+ "entire directory will be copied.",
+ "You can use this multiple times") do |value|
+ @static_path << value
+ end
+
+ opt.separator nil
+
opt.on("--webcvs=URL", "-W",
"Specify a URL for linking to a web frontend",
"to CVS. If the URL contains a '\%s', the",
@@ -612,7 +955,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
@@ -620,32 +963,59 @@ Usage: #{opt.program_name} [options] [names...]
opt.separator "Generic options:"
opt.separator nil
+ opt.on("--write-options",
+ "Write .rdoc_options to the current",
+ "directory with the given options. Not all",
+ "options will be used. See RDoc::Options",
+ "for details.") do |value|
+ @write_options = true
+ end
+
+ opt.separator nil
+
opt.on("--[no-]dry-run",
"Don't write any files") do |value|
@dry_run = value
end
+ opt.separator nil
+
opt.on("-D", "--[no-]debug",
"Displays lots on internal stuff.") do |value|
$DEBUG_RDOC = value
end
+ opt.separator nil
+
opt.on("--[no-]ignore-invalid",
"Ignore invalid options and continue",
"(default true).") do |value|
ignore_invalid = value
end
+ opt.separator nil
+
opt.on("--quiet", "-q",
"Don't show progress as we parse.") do |value|
@verbosity = 0
end
- opt.on("--verbose", "-v",
+ opt.separator nil
+
+ opt.on("--verbose", "-V",
"Display extra progress as RDoc parses") do |value|
@verbosity = 2
end
+ opt.separator nil
+
+ opt.on("--version", "-v", "print the version") do
+ puts opt.version
+ exit
+ end
+
+ opt.separator nil
+
opt.on("--help",
"Display this help") do
RDoc::RDoc::GENERATORS.each_key do |generator|
@@ -667,7 +1037,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
@@ -693,24 +1063,35 @@ 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
@files = argv.dup
finish
+
+ if @write_options then
+ write_options
+ exit
+ end
+
+ self
end
##
@@ -728,6 +1109,20 @@ Usage: #{opt.program_name} [options] [names...]
end
##
+ # Removes directories from +path+ that are outside the current directory
+
+ def sanitize_path path
+ require 'pathname'
+ dot = Pathname.new('.').expand_path
+
+ path.reject do |item|
+ path = Pathname.new(item).expand_path
+ relative = path.relative_path_from(dot).to_s
+ relative.start_with? '..'
+ end
+ end
+
+ ##
# Set up an output generator for the named +generator_name+.
#
# If the found generator responds to :setup_options it will be called with
@@ -766,5 +1161,39 @@ Usage: #{opt.program_name} [options] [names...]
end
end
+ ##
+ # This is compatibility code for syck
+
+ def to_yaml opts = {} # :nodoc:
+ return super if YAML.const_defined?(:ENGINE) and not YAML::ENGINE.syck?
+
+ YAML.quick_emit self, opts do |out|
+ out.map taguri, to_yaml_style do |map|
+ encode_with map
+ end
+ end
+ end
+
+ ##
+ # Displays a warning using Kernel#warn if we're being verbose
+
+ def warn message
+ super message if @verbosity > 1
+ end
+
+ ##
+ # Writes the YAML file .rdoc_options to the current directory containing the
+ # parsed options.
+
+ def write_options
+ RDoc.load_yaml
+
+ open '.rdoc_options', 'w' do |io|
+ io.set_encoding Encoding::UTF_8 if Object.const_defined? :Encoding
+
+ YAML.dump self, io
+ end
+ end
+
end
diff --git a/lib/rdoc/parser.rb b/lib/rdoc/parser.rb
index 27267f3d81..5c6a0a8983 100644
--- a/lib/rdoc/parser.rb
+++ b/lib/rdoc/parser.rb
@@ -1,41 +1,33 @@
-require 'rdoc'
-require 'rdoc/code_objects'
-require 'rdoc/markup/pre_process'
-require 'rdoc/stats'
+# -*- coding: us-ascii -*-
##
-# A parser is a class that subclasses RDoc::Parser and implements
+# A parser is simple a class that subclasses RDoc::Parser and implements #scan
+# to fill in an RDoc::TopLevel with parsed data.
#
-# #initialize top_level, file_name, body, options, stats
+# The initialize method takes an RDoc::TopLevel to fill with parsed content,
+# the name of the file to be parsed, the content of the file, an RDoc::Options
+# object and an RDoc::Stats object to inform the user of parsed items. The
+# scan method is then called to parse the file and must return the
+# RDoc::TopLevel object. By calling super these items will be set for you.
#
-# and
+# In order to be used by RDoc the parser needs to register the file extensions
+# it can parse. Use ::parse_files_matching to register extensions.
#
-# #scan
-#
-# The initialize method takes a file name to be used, the body of the file,
-# and an RDoc::Options object. The scan method is then called to return an
-# appropriately parsed TopLevel code object.
-#
-# RDoc::Parser::for is a factory that creates the correct parser for a
-# given filename extension. Parsers have to register themselves RDoc::Parser
-# using parse_files_matching as when they are loaded:
-#
-# require "rdoc/parser"
+# require 'rdoc'
#
# class RDoc::Parser::Xyz < RDoc::Parser
-# parse_files_matching /\.xyz$/ # <<<<
+# parse_files_matching /\.xyz$/
+#
+# def initialize top_level, file_name, content, options, stats
+# super
#
-# def initialize top_level, file_name, body, options, stats
-# ...
+# # extra initialization if needed
# end
#
# def scan
-# ...
+# # parse file and fill in @top_level
# end
# end
-#
-# If a plain text file is detected, RDoc also looks for a shebang line in case
-# the file is a shell script.
class RDoc::Parser
@@ -54,6 +46,11 @@ class RDoc::Parser
end
##
+ # The name of the file being parsed
+
+ attr_reader :file_name
+
+ ##
# Alias an extension to another extension. After this call, files ending
# "new_ext" will be parsed using the same parser as "old_ext"
@@ -61,7 +58,7 @@ class RDoc::Parser
old_ext = old_ext.sub(/^\.(.*)/, '\1')
new_ext = new_ext.sub(/^\.(.*)/, '\1')
- parser = can_parse "xxx.#{old_ext}"
+ parser = can_parse_by_name "xxx.#{old_ext}"
return false unless parser
RDoc::Parser.parsers.unshift [/\.#{new_ext}$/, parser]
@@ -80,14 +77,14 @@ class RDoc::Parser
have_encoding = s.respond_to? :encoding
- if have_encoding then
- return false if s.encoding != Encoding::ASCII_8BIT and s.valid_encoding?
- end
-
return true if s[0, 2] == Marshal.dump('')[0, 2] or s.index("\x00")
if have_encoding then
- s.force_encoding Encoding.default_external
+ 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
+ s = File.open(file, mode) {|f| f.gets(nil, 1024)}
not s.valid_encoding?
else
@@ -134,46 +131,98 @@ class RDoc::Parser
zip_signature == "PK\x03\x04" or
zip_signature == "PK\x05\x06" or
zip_signature == "PK\x07\x08"
+ rescue
+ false
end
##
# Return a parser that can handle a particular extension
- def self.can_parse(file_name)
- parser = RDoc::Parser.parsers.find { |regexp,| regexp =~ file_name }.last
+ def self.can_parse file_name
+ parser = can_parse_by_name file_name
# HACK Selenium hides a jar file using a .txt extension
return if parser == RDoc::Parser::Simple and zip? file_name
+ parser
+ end
+
+ ##
+ # Returns a parser that can handle the extension for +file_name+. This does
+ # not depend upon the file being readable.
+
+ def self.can_parse_by_name file_name
+ _, parser = RDoc::Parser.parsers.find { |regexp,| regexp =~ file_name }
+
# The default parser must not parse binary files
ext_name = File.extname file_name
return parser if ext_name.empty?
- return if parser == RDoc::Parser::Simple and ext_name !~ /txt|rdoc/
+
+ if parser == RDoc::Parser::Simple and ext_name !~ /txt|rdoc/ then
+ case check_modeline file_name
+ when nil, 'rdoc' then # continue
+ else return nil
+ end
+ end
parser
+ rescue Errno::EACCES
+ end
+
+ ##
+ # Returns the file type from the modeline in +file_name+
+
+ def self.check_modeline file_name
+ line = open file_name do |io|
+ io.gets
+ end
+
+ /-\*-\s*(.*?\S)\s*-\*-/ =~ line
+
+ return nil unless type = $1
+
+ if /;/ =~ type then
+ return nil unless /(?:\s|\A)mode:\s*([^\s;]+)/i =~ type
+ type = $1
+ end
+
+ return nil if /coding:/i =~ type
+
+ type.downcase
+ rescue ArgumentError # invalid byte sequence, etc.
end
##
- # Find the correct parser for a particular file name. Return a SimpleParser
- # for ones that we don't know
+ # Finds and instantiates the correct parser for the given +file_name+ and
+ # +content+.
- def self.for(top_level, file_name, body, options, stats)
+ def self.for top_level, file_name, content, options, stats
return if binary? file_name
- # If no extension, look for shebang
- if file_name !~ /\.\w+$/ && body =~ %r{\A#!(.+)} then
- shebang = $1
- case shebang
- when %r{env\s+ruby}, %r{/ruby}
- file_name = "dummy.rb"
+ parser = use_markup content
+
+ unless parser then
+ parse_name = file_name
+
+ # If no extension, look for shebang
+ if file_name !~ /\.\w+$/ && content =~ %r{\A#!(.+)} then
+ shebang = $1
+ case shebang
+ when %r{env\s+ruby}, %r{/ruby}
+ parse_name = 'dummy.rb'
+ end
end
- end
- parser = can_parse file_name
+ parser = can_parse parse_name
+ end
return unless parser
- parser.new top_level, file_name, body, options, stats
+ content = remove_modeline content
+
+ parser.new top_level, file_name, content, options, stats
+ rescue SystemCallError
+ nil
end
##
@@ -186,13 +235,55 @@ class RDoc::Parser
end
##
- # Creates a new Parser storing +top_level+, +file_name+, +content+,
- # +options+ and +stats+ in instance variables.
+ # 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:
+ #
+ # # markup: rdoc
+ # # Class comment can go here
#
- # Usually invoked by +super+
+ # class C
+ # end
+ #
+ # The comment should appear as the first line of the +content+.
+ #
+ # If the content contains a shebang or editor modeline the comment may
+ # appear on the second or third line.
+ #
+ # Any comment style may be used to hide the markup comment.
+
+ def self.use_markup content
+ markup = content.lines.first(3).grep(/markup:\s+(\w+)/) { $1 }.first
+
+ return unless markup
+
+ # TODO Ruby should be returned only when the filename is correct
+ return RDoc::Parser::Ruby if %w[tomdoc markdown].include? markup
+
+ markup = Regexp.escape markup
- def initialize(top_level, file_name, content, options, stats)
+ RDoc::Parser.parsers.find do |_, parser|
+ /^#{markup}$/i =~ parser.name.sub(/.*:/, '')
+ end.last
+ end
+
+ ##
+ # Creates a new Parser storing +top_level+, +file_name+, +content+,
+ # +options+ and +stats+ in instance variables. In +@preprocess+ an
+ # RDoc::Markup::PreProcess object is created which allows processing of
+ # directives.
+
+ def initialize top_level, file_name, content, options, stats
@top_level = top_level
+ @top_level.parser = self.class
+ @store = @top_level.store
+
@file_name = file_name
@content = content
@options = options
@@ -202,7 +293,16 @@ class RDoc::Parser
@preprocess.options = @options
end
+ autoload :RubyTools, 'rdoc/parser/ruby_tools'
+ autoload :Text, 'rdoc/parser/text'
+
end
+# simple must come first in order to show up last in the parsers list
require 'rdoc/parser/simple'
+require 'rdoc/parser/c'
+require 'rdoc/parser/changelog'
+require 'rdoc/parser/markdown'
+require 'rdoc/parser/rd'
+require 'rdoc/parser/ruby'
diff --git a/lib/rdoc/parser/c.rb b/lib/rdoc/parser/c.rb
index 3da1820c50..f7d0a9afa0 100644
--- a/lib/rdoc/parser/c.rb
+++ b/lib/rdoc/parser/c.rb
@@ -1,6 +1,4 @@
-
-require 'rdoc/parser/ruby'
-require 'rdoc/known_classes'
+require 'tsort'
##
# RDoc::Parser::C attempts to parse C extension files. It looks for
@@ -58,6 +56,13 @@ require 'rdoc/known_classes'
# [Document-const: +name+]
# Documentation for the named +rb_define_const+.
#
+# Constant values can be supplied on the first line of the comment like so:
+#
+# /* 300: The highest possible score in bowling */
+# rb_define_const(cFoo, "PERFECT", INT2FIX(300));
+#
+# The value can contain internal colons so long as they are escaped with a \
+#
# [Document-global: +name+]
# Documentation for the named +rb_define_global_const+
#
@@ -118,43 +123,131 @@ class RDoc::Parser::C < RDoc::Parser
include RDoc::Text
##
+ # Maps C variable names to names of Ruby classes or modules
+
+ attr_reader :classes
+
+ ##
# C file the parser is parsing
attr_accessor :content
+ ##
+ # Dependencies from a missing enclosing class to the classes in
+ # missing_dependencies that depend upon it.
+
+ attr_reader :enclosure_dependencies
##
- # Maps C variable names to names of ruby classes (andsingleton classes)
+ # Maps C variable names to names of Ruby classes (and singleton classes)
attr_reader :known_classes
##
- # Maps C variable names to names of ruby singleton classes
+ # Classes found while parsing the C file that were not yet registered due to
+ # a missing enclosing class. These are processed by do_missing
- attr_reader :singleton_classes
+ attr_reader :missing_dependencies
##
- # Resets cross-file state. Call when parsing different projects that need
- # separate documentation.
+ # Maps C variable names to names of Ruby singleton classes
- def self.reset
- @@enclosure_classes = {}
- @@known_bodies = {}
- end
+ attr_reader :singleton_classes
- reset
+ ##
+ # The TopLevel items in the parsed file belong to
+
+ attr_reader :top_level
##
- # Prepare to parse a C file
+ # Prepares for parsing a C file. See RDoc::Parser#initialize for details on
+ # the arguments.
- def initialize(top_level, file_name, content, options, stats)
+ def initialize top_level, file_name, content, options, stats
super
@known_classes = RDoc::KNOWN_CLASSES.dup
- @content = handle_tab_width handle_ifdefs_in(@content)
- @classes = {}
- @singleton_classes = {}
- @file_dir = File.dirname(@file_name)
+ @content = handle_tab_width handle_ifdefs_in @content
+ @file_dir = File.dirname @file_name
+
+ @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 = {}
+
+ # missing enclosure variable => [dependent handle_class_module arguments]
+ @enclosure_dependencies = Hash.new { |h, k| h[k] = [] }
+ @enclosure_dependencies.instance_variable_set :@missing_dependencies,
+ @missing_dependencies
+
+ @enclosure_dependencies.extend TSort
+
+ def @enclosure_dependencies.tsort_each_node &block
+ each_key(&block)
+ rescue TSort::Cyclic => e
+ cycle_vars = e.message.scan(/"(.*?)"/).flatten
+
+ cycle = cycle_vars.sort.map do |var_name|
+ delete var_name
+
+ var_name, type, mod_name, = @missing_dependencies[var_name]
+
+ "#{type} #{mod_name} (#{var_name})"
+ end.join ', '
+
+ warn "Unable to create #{cycle} due to a cyclic class or module creation"
+
+ retry
+ end
+
+ def @enclosure_dependencies.tsort_each_child node, &block
+ fetch(node, []).each(&block)
+ end
+ 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
##
@@ -169,7 +262,7 @@ class RDoc::Parser::C < RDoc::Parser
class_name = @known_classes[var_name]
unless class_name then
- warn "Enclosing class/module %p for alias %s %s not known" % [
+ @options.warn "Enclosing class or module %p for alias %s %s is not known" % [
var_name, new_name, old_name]
next
end
@@ -180,7 +273,9 @@ class RDoc::Parser::C < RDoc::Parser
al.singleton = @singleton_classes.key? var_name
comment = find_alias_comment var_name, new_name, old_name
- comment = strip_stars comment
+
+ comment.normalize
+
al.comment = comment
al.record_location @top_level
@@ -214,62 +309,26 @@ class RDoc::Parser::C < RDoc::Parser
end
##
- # Scans #content for rb_define_module, rb_define_class, boot_defclass,
- # rb_define_module_under, rb_define_class_under and rb_singleton_class
-
- def do_classes
- @content.scan(/(\w+)\s* = \s*rb_define_module\s*\(\s*"(\w+)"\s*\)/mx) do
- |var_name, class_name|
- handle_class_module(var_name, "module", class_name, nil, nil)
- end
-
- # The '.' lets us handle SWIG-generated files
- @content.scan(/([\w\.]+)\s* = \s*rb_define_class\s*
- \(
- \s*"(\w+)",
- \s*(\w+)\s*
- \)/mx) do |var_name, class_name, parent|
- handle_class_module(var_name, "class", class_name, parent, nil)
- end
+ # Scans #content for boot_defclass
+ def do_boot_defclass
@content.scan(/(\w+)\s*=\s*boot_defclass\s*\(\s*"(\w+?)",\s*(\w+?)\s*\)/) do
|var_name, class_name, parent|
parent = nil if parent == "0"
- handle_class_module(var_name, "class", class_name, parent, nil)
+ handle_class_module(var_name, :class, class_name, parent, nil)
end
+ end
- @content.scan(/(\w+)\s* = \s*rb_define_module_under\s*
- \(
- \s*(\w+),
- \s*"(\w+)"
- \s*\)/mx) do |var_name, in_module, class_name|
- handle_class_module(var_name, "module", class_name, nil, in_module)
- end
-
- @content.scan(/([\w\.]+)\s* = # var_name
- \s*rb_define_class_under\s*
- \(
- \s* (\w+), # under
- \s* "(\w+)", # class_name
- \s*
- (?:
- ([\w\*\s\(\)\.\->]+) | # parent_name
- rb_path2class\("([\w:]+)"\) # path
- )
- \s*
- \)
- /mx) do |var_name, under, class_name, parent_name, path|
- parent = path || parent_name
-
- handle_class_module var_name, 'class', class_name, parent, under
- end
+ ##
+ # Scans #content for rb_define_class, boot_defclass, rb_define_class_under
+ # and rb_singleton_class
- @content.scan(/([\w\.]+)\s* = \s*rb_singleton_class\s*
- \(
- \s*(\w+)
- \s*\)/mx) do |sclass_var, class_var|
- handle_singleton sclass_var, class_var
- end
+ def do_classes
+ do_boot_defclass
+ do_define_class
+ do_define_class_under
+ do_singleton_class
+ do_struct_define_without_accessor
end
##
@@ -300,8 +359,82 @@ class RDoc::Parser::C < RDoc::Parser
\)
\s*;%xm) do |consts|
const = consts.first
+
handle_constants 'const', 'mCurses', const, "UINT2NUM(#{const})"
end
+
+ @content.scan(%r%
+ \Wrb_file_const
+ \s*\(
+ \s*
+ "([^"]+)",
+ \s*
+ (.*?)
+ \s*
+ \)
+ \s*;%xm) do |name, value|
+ handle_constants 'const', 'rb_mFConst', name, value
+ end
+ end
+
+ ##
+ # Scans #content for rb_define_class
+
+ def do_define_class
+ # The '.' lets us handle SWIG-generated files
+ @content.scan(/([\w\.]+)\s* = \s*rb_define_class\s*
+ \(
+ \s*"(\w+)",
+ \s*(\w+)\s*
+ \)/mx) do |var_name, class_name, parent|
+ handle_class_module(var_name, :class, class_name, parent, nil)
+ end
+ end
+
+ ##
+ # Scans #content for rb_define_class_under
+
+ def do_define_class_under
+ @content.scan(/([\w\.]+)\s* = # var_name
+ \s*rb_define_class_under\s*
+ \(
+ \s* (\w+), # under
+ \s* "(\w+)", # class_name
+ \s*
+ (?:
+ ([\w\*\s\(\)\.\->]+) | # parent_name
+ rb_path2class\("([\w:]+)"\) # path
+ )
+ \s*
+ \)
+ /mx) do |var_name, under, class_name, parent_name, path|
+ parent = path || parent_name
+
+ handle_class_module var_name, :class, class_name, parent, under
+ end
+ end
+
+ ##
+ # Scans #content for rb_define_module
+
+ def do_define_module
+ @content.scan(/(\w+)\s* = \s*rb_define_module\s*\(\s*"(\w+)"\s*\)/mx) do
+ |var_name, class_name|
+ handle_class_module(var_name, :module, class_name, nil, nil)
+ end
+ end
+
+ ##
+ # Scans #content for rb_define_module_under
+
+ def do_define_module_under
+ @content.scan(/(\w+)\s* = \s*rb_define_module_under\s*
+ \(
+ \s*(\w+),
+ \s*"(\w+)"
+ \s*\)/mx) do |var_name, in_module, class_name|
+ handle_class_module(var_name, :module, class_name, nil, in_module)
+ end
end
##
@@ -309,11 +442,12 @@ class RDoc::Parser::C < RDoc::Parser
def do_includes
@content.scan(/rb_include_module\s*\(\s*(\w+?),\s*(\w+?)\s*\)/) do |c,m|
- if cls = @classes[c]
- m = @known_classes[m] || m
- incl = cls.add_include RDoc::Include.new(m, "")
- incl.record_location @top_level
- end
+ next unless cls = @classes[c]
+ m = @known_classes[m] || m
+
+ comment = RDoc::Comment.new '', @top_level
+ incl = cls.add_include RDoc::Include.new(m, comment)
+ incl.record_location @top_level
end
end
@@ -332,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|
@@ -368,6 +502,58 @@ class RDoc::Parser::C < RDoc::Parser
end
##
+ # Creates classes and module that were missing were defined due to the file
+ # order being different than the declaration order.
+
+ def do_missing
+ return if @missing_dependencies.empty?
+
+ @enclosure_dependencies.tsort.each do |in_module|
+ arguments = @missing_dependencies.delete in_module
+
+ next unless arguments # dependency on existing class
+
+ handle_class_module(*arguments)
+ end
+ end
+
+ ##
+ # Scans #content for rb_define_module and rb_define_module_under
+
+ def do_modules
+ do_define_module
+ do_define_module_under
+ end
+
+ ##
+ # Scans #content for rb_singleton_class
+
+ def do_singleton_class
+ @content.scan(/([\w\.]+)\s* = \s*rb_singleton_class\s*
+ \(
+ \s*(\w+)
+ \s*\)/mx) do |sclass_var, class_var|
+ handle_singleton sclass_var, class_var
+ end
+ end
+
+ ##
+ # Scans #content for struct_define_without_accessor
+
+ def do_struct_define_without_accessor
+ @content.scan(/([\w\.]+)\s* = \s*rb_struct_define_without_accessor\s*
+ \(
+ \s*"(\w+)", # Class name
+ \s*(\w+), # Parent class
+ \s*\w+, # Allocation function
+ (\s*"\w+",)* # Attributes
+ \s*NULL
+ \)/mx) do |var_name, class_name, parent|
+ handle_class_module(var_name, :class, class_name, parent, nil)
+ end
+ end
+
+ ##
# Finds the comment for an alias on +class_name+ from +new_name+ to
# +old_name+
@@ -377,7 +563,7 @@ class RDoc::Parser::C < RDoc::Parser
\s*"#{Regexp.escape new_name}"\s*,
\s*"#{Regexp.escape old_name}"\s*\);%xm
- $1 || ''
+ RDoc::Comment.new($1 || '', @top_level)
end
##
@@ -398,22 +584,24 @@ class RDoc::Parser::C < RDoc::Parser
/.*?/m
end
- if @content =~ %r%((?>/\*.*?\*/\s+))
- rb_define_attr\((?:\s*#{var_name},)?\s*
- "#{attr_name}"\s*,
- #{rw}\)\s*;%xm then
- $1
- elsif @content =~ %r%((?>/\*.*?\*/\s+))
- rb_attr\(\s*#{var_name}\s*,
- \s*#{attr_name}\s*,
- #{rw},.*?\)\s*;%xm then
- $1
- elsif @content =~ %r%Document-attr:\s#{attr_name}\s*?\n
- ((?>.*?\*/))%xm then
- $1
- else
- ''
- end
+ comment = if @content =~ %r%((?>/\*.*?\*/\s+))
+ rb_define_attr\((?:\s*#{var_name},)?\s*
+ "#{attr_name}"\s*,
+ #{rw}\)\s*;%xm then
+ $1
+ elsif @content =~ %r%((?>/\*.*?\*/\s+))
+ rb_attr\(\s*#{var_name}\s*,
+ \s*#{attr_name}\s*,
+ #{rw},.*?\)\s*;%xm then
+ $1
+ elsif @content =~ %r%Document-attr:\s#{attr_name}\s*?\n
+ ((?>.*?\*/))%xm then
+ $1
+ else
+ ''
+ end
+
+ RDoc::Comment.new comment, @top_level
end
##
@@ -425,11 +613,11 @@ class RDoc::Parser::C < RDoc::Parser
((?:(?:static|SWIGINTERN)\s+)?
(?:intern\s+)?VALUE\s+#{meth_name}
\s*(\([^)]*\))([^;]|$))%xm then
- comment = $1
+ comment = RDoc::Comment.new $1, @top_level
body = $2
- offset = $~.offset(2).first
+ offset, = $~.offset(2)
- remove_private_comments comment if comment
+ comment.remove_private if comment
# try to find the whole body
body = $& if /#{Regexp.escape body}[^(]*?\{.*?^\}/m =~ file_content
@@ -443,6 +631,7 @@ class RDoc::Parser::C < RDoc::Parser
override_comment = find_override_comment class_name, meth_obj
comment = override_comment if override_comment
+ comment.normalize
find_modifiers comment, meth_obj if comment
#meth_obj.params = params
@@ -450,24 +639,26 @@ class RDoc::Parser::C < RDoc::Parser
tk = RDoc::RubyToken::Token.new nil, 1, 1
tk.set_text body
meth_obj.add_token tk
- meth_obj.comment = strip_stars comment
+ meth_obj.comment = comment
meth_obj.offset = offset
meth_obj.line = file_content[0, offset].count("\n") + 1
body
when %r%((?>/\*.*?\*/\s*))^\s*(\#\s*define\s+#{meth_name}\s+(\w+))%m then
- comment = $1
+ comment = RDoc::Comment.new $1, @top_level
body = $2
offset = $~.offset(2).first
find_body class_name, $3, meth_obj, file_content, true
+
+ comment.normalize
find_modifiers comment, meth_obj
meth_obj.start_collecting_tokens
tk = RDoc::RubyToken::Token.new nil, 1, 1
tk.set_text body
meth_obj.add_token tk
- meth_obj.comment = strip_stars(comment) + meth_obj.comment.to_s
+ meth_obj.comment = comment
meth_obj.offset = offset
meth_obj.line = file_content[0, offset].count("\n") + 1
@@ -480,18 +671,19 @@ class RDoc::Parser::C < RDoc::Parser
return body if body
- warn "No definition for #{meth_name}" if @options.verbosity > 1
+ @options.warn "No definition for #{meth_name}"
false
else # No body, but might still have an override comment
comment = find_override_comment class_name, meth_obj
if comment then
+ comment.normalize
find_modifiers comment, meth_obj
- meth_obj.comment = strip_stars comment
+ meth_obj.comment = comment
''
else
- warn "No definition for #{meth_name}" if @options.verbosity > 1
+ @options.warn "No definition for #{meth_name}"
false
end
end
@@ -540,7 +732,7 @@ class RDoc::Parser::C < RDoc::Parser
# */
# VALUE cFoo = rb_define_class("Foo", rb_cObject);
- def find_class_comment(class_name, class_mod)
+ def find_class_comment class_name, class_mod
comment = nil
if @content =~ %r%
@@ -551,17 +743,21 @@ class RDoc::Parser::C < RDoc::Parser
comment = $1.sub(%r%Document-(?:class|module):\s+#{class_name}%, '')
elsif @content =~ %r%Document-(?:class|module):\s+#{class_name}\s*?
(?:<\s+[:,\w]+)?\n((?>.*?\*/))%xm then
- comment = $1
- elsif @content =~ %r%((?>/\*.*?\*/\s+))
+ comment = "/*\n#{$1}"
+ elsif @content =~ %r%.*((?>/\*.*?\*/\s+))
([\w\.\s]+\s* = \s+)?rb_define_(class|module).*?"(#{class_name})"%xm then
comment = $1
+ elsif @content =~ %r%.*((?>/\*.*?\*/\s+))
+ ([\w\.\s]+\s* = \s+)?rb_define_(class|module)_under.*?"(#{class_name.split('::').last})"%xm then
+ comment = $1
+ else
+ comment = ''
end
- return unless comment
-
- comment = strip_stars comment
+ comment = RDoc::Comment.new comment, @top_level
+ comment.normalize
- comment = look_for_directives_in class_mod, comment
+ look_for_directives_in class_mod, comment
class_mod.add_comment comment, @top_level
end
@@ -571,79 +767,33 @@ class RDoc::Parser::C < RDoc::Parser
# comment or in the matching Document- section.
def find_const_comment(type, const_name, class_name = nil)
- if @content =~ %r%((?>^\s*/\*.*?\*/\s+))
- rb_define_#{type}\((?:\s*(\w+),)?\s*
- "#{const_name}"\s*,
- .*?\)\s*;%xmi then
- $1
- elsif class_name and
- @content =~ %r%Document-(?:const|global|variable):\s
- #{class_name}::#{const_name}
- \s*?\n((?>.*?\*/))%xm then
- $1
- elsif @content =~ %r%Document-(?:const|global|variable):\s#{const_name}
- \s*?\n((?>.*?\*/))%xm then
- $1
- else
- ''
- end
+ comment = if @content =~ %r%((?>^\s*/\*.*?\*/\s+))
+ rb_define_#{type}\((?:\s*(\w+),)?\s*
+ "#{const_name}"\s*,
+ .*?\)\s*;%xmi then
+ $1
+ elsif class_name and
+ @content =~ %r%Document-(?:const|global|variable):\s
+ #{class_name}::#{const_name}
+ \s*?\n((?>.*?\*/))%xm then
+ "/*\n#{$1}"
+ elsif @content =~ %r%Document-(?:const|global|variable):
+ \s#{const_name}
+ \s*?\n((?>.*?\*/))%xm then
+ "/*\n#{$1}"
+ else
+ ''
+ end
+
+ RDoc::Comment.new comment, @top_level
end
##
# Handles modifiers in +comment+ and updates +meth_obj+ as appropriate.
- #
- # If <tt>:nodoc:</tt> is found, documentation on +meth_obj+ is suppressed.
- #
- # If <tt>:yields:</tt> is followed by an argument list it is used for the
- # #block_params of +meth_obj+.
- #
- # If the comment block contains a <tt>call-seq:</tt> section like:
- #
- # call-seq:
- # ARGF.readlines(sep=$/) -> array
- # ARGF.readlines(limit) -> array
- # ARGF.readlines(sep, limit) -> array
- #
- # ARGF.to_a(sep=$/) -> array
- # ARGF.to_a(limit) -> array
- # ARGF.to_a(sep, limit) -> array
- #
- # it is used for the parameters of +meth_obj+.
def find_modifiers comment, meth_obj
- # we must handle situations like the above followed by an unindented first
- # comment. The difficulty is to make sure not to match lines starting
- # with ARGF at the same indent, but that are after the first description
- # paragraph.
-
- if comment =~ /call-seq:(.*?(?:\S|\*\/?).*?)^\s*(?:\*\/?)?\s*$/m then
- all_start, all_stop = $~.offset(0)
- seq_start, seq_stop = $~.offset(1)
-
- # we get the following lines that start with the leading word at the
- # same indent, even if they have blank lines before
- if $1 =~ /(^\s*\*?\s*\n)+^(\s*\*?\s*\w+)/m then
- leading = $2 # ' * ARGF' in the example above
- re = %r%
- \A(
- (^\s*\*?\s*\n)+
- (^#{Regexp.escape leading}.*?\n)+
- )+
- ^\s*\*?\s*$
- %xm
- if comment[seq_stop..-1] =~ re then
- all_stop = seq_stop + $~.offset(0).last
- seq_stop = seq_stop + $~.offset(1).last
- end
- end
-
- seq = comment[seq_start..seq_stop]
- seq.gsub!(/^(\s*\*?\s*?)(\S|\n)/m, '\2')
- comment.slice! all_start...all_stop
- meth_obj.call_seq = seq
- elsif comment.sub!(/\A\/\*\s*call-seq:(.*?)\*\/\Z/, '') then
- meth_obj.call_seq = $1.strip
- end
+ comment.normalize
+ comment.extract_call_seq meth_obj
look_for_directives_in meth_obj, comment
end
@@ -655,11 +805,18 @@ class RDoc::Parser::C < RDoc::Parser
name = Regexp.escape meth_obj.name
prefix = Regexp.escape meth_obj.name_prefix
- if @content =~ %r%Document-method:\s+#{class_name}#{prefix}#{name}\s*?\n((?>.*?\*/))%m then
- $1
- elsif @content =~ %r%Document-method:\s#{name}\s*?\n((?>.*?\*/))%m then
- $1
- end
+ comment = if @content =~ %r%Document-method:
+ \s+#{class_name}#{prefix}#{name}
+ \s*?\n((?>.*?\*/))%xm then
+ "/*#{$1}"
+ elsif @content =~ %r%Document-method:
+ \s#{name}\s*?\n((?>.*?\*/))%xm then
+ "/*#{$1}"
+ end
+
+ return unless comment
+
+ RDoc::Comment.new comment, @top_level
end
##
@@ -680,7 +837,7 @@ class RDoc::Parser::C < RDoc::Parser
return unless class_obj
comment = find_attr_comment var_name, attr_name
- comment = strip_stars comment
+ comment.normalize
name = attr_name.gsub(/rb_intern\("([^"]+)"\)/, '\1')
@@ -699,23 +856,26 @@ class RDoc::Parser::C < RDoc::Parser
parent_name = @known_classes[parent] || parent
if in_module then
- enclosure = @classes[in_module] || @@enclosure_classes[in_module]
+ enclosure = @classes[in_module] || @store.find_c_enclosure(in_module)
if enclosure.nil? and enclosure = @known_classes[in_module] then
- enc_type = /^rb_m/ =~ in_module ? "module" : "class"
+ enc_type = /^rb_m/ =~ in_module ? :module : :class
handle_class_module in_module, enc_type, enclosure, nil, nil
enclosure = @classes[in_module]
end
unless enclosure then
- warn "Enclosing class/module '#{in_module}' for #{type} #{class_name} not known"
+ @enclosure_dependencies[in_module] << var_name
+ @missing_dependencies[var_name] =
+ [var_name, type, class_name, parent, in_module]
+
return
end
else
enclosure = @top_level
end
- if type == "class" then
+ if type == :class then
full_name = if RDoc::ClassModule === enclosure then
enclosure.full_name + "::#{class_name}"
else
@@ -743,8 +903,8 @@ class RDoc::Parser::C < RDoc::Parser
end
@classes[var_name] = cm
- @@enclosure_classes[var_name] = cm
@known_classes[var_name] = cm.full_name
+ @store.add_c_enclosure var_name, cm
end
##
@@ -765,25 +925,20 @@ class RDoc::Parser::C < RDoc::Parser
class_obj = find_class var_name, class_name
unless class_obj then
- warn "Enclosing class/module #{const_name.inspect} not known"
+ @options.warn 'Enclosing class or module %p is not known' % [const_name]
return
end
comment = find_const_comment type, const_name, class_name
- comment = strip_stars comment
- comment = normalize_comment comment
+ comment.normalize
# In the case of rb_define_const, the definition and comment are in
# "/* definition: comment */" form. The literal ':' and '\' characters
# can be escaped with a backslash.
if type.downcase == 'const' then
- elements = comment.split ':'
-
- if elements.nil? or elements.empty? then
- con = RDoc::Constant.new const_name, definition, comment
- else
- new_definition = elements[0..-2].join(':')
+ no_match, new_definition, new_comment = comment.text.split(/(\A.*):/)
+ if no_match and no_match.empty? then
if new_definition.empty? then # Default to literal C definition
new_definition = definition
else
@@ -793,13 +948,13 @@ class RDoc::Parser::C < RDoc::Parser
new_definition.sub!(/\A(\s+)/, '')
- new_comment = if $1.nil? then
- elements.last.lstrip
- else
- "#{$1}#{elements.last.lstrip}"
- end
+ new_comment = "#{$1}#{new_comment.lstrip}"
+
+ new_comment = RDoc::Comment.new new_comment, @top_level
con = RDoc::Constant.new const_name, new_definition, new_comment
+ else
+ con = RDoc::Constant.new const_name, definition, comment
end
else
con = RDoc::Constant.new const_name, definition, comment
@@ -827,6 +982,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
@@ -849,9 +1006,9 @@ class RDoc::Parser::C < RDoc::Parser
file_name = File.join @file_dir, source_file
if File.exist? file_name then
- file_content = (@@known_bodies[file_name] ||= File.read(file_name))
+ file_content = File.read file_name
else
- warn "unknown source #{source_file} for #{meth_name} in #{@file_name}"
+ @options.warn "unknown source #{source_file} for #{meth_name} in #{@file_name}"
end
else
file_content = @content
@@ -905,6 +1062,30 @@ class RDoc::Parser::C < RDoc::Parser
end
##
+ # Loads the variable map with the given +name+ from the RDoc::Store, if
+ # present.
+
+ def load_variable_map map_name
+ return {} unless files = @store.cache[map_name]
+ return {} unless name_map = files[@file_name]
+
+ class_map = {}
+
+ name_map.each do |variable, name|
+ next unless mod = @store.find_class_or_module(name)
+
+ class_map[variable] = if map_name == :c_class_variables then
+ mod
+ else
+ name
+ end
+ @known_classes[variable] = name
+ end
+
+ class_map
+ end
+
+ ##
# Look for directives in a normal comment block:
#
# /*
@@ -1021,25 +1202,26 @@ class RDoc::Parser::C < RDoc::Parser
end
##
- # Removes private comments from +comment+
-
- def remove_private_comments(comment)
- comment.gsub!(/\/?\*--\n(.*?)\/?\*\+\+/m, '')
- comment.sub!(/\/?\*--\n.*/m, '')
- end
-
- ##
# Extracts the classes, modules, methods, attributes, constants and aliases
# from a C file and returns an RDoc::TopLevel for this file
def scan
remove_commented_out_lines
+
+ do_modules
do_classes
+ do_missing
+
do_constants
do_methods
do_includes
do_aliases
do_attrs
+
+ deduplicate_call_seq
+
+ @store.add_c_variables self
+
@top_level
end
diff --git a/lib/rdoc/parser/changelog.rb b/lib/rdoc/parser/changelog.rb
new file mode 100644
index 0000000000..782d8f09bf
--- /dev/null
+++ b/lib/rdoc/parser/changelog.rb
@@ -0,0 +1,194 @@
+require 'time'
+
+##
+# A ChangeLog file parser.
+#
+# This parser converts a ChangeLog into an RDoc::Markup::Document. When
+# viewed as HTML a ChangeLog page will have an entry for each day's entries in
+# the sidebar table of contents.
+#
+# This parser is meant to parse the MRI ChangeLog, but can be used to parse any
+# {GNU style Change
+# Log}[http://www.gnu.org/prep/standards/html_node/Style-of-Change-Logs.html].
+
+class RDoc::Parser::ChangeLog < RDoc::Parser
+
+ include RDoc::Parser::Text
+
+ parse_files_matching(/(\/|\\|\A)ChangeLog[^\/\\]*\z/)
+
+ ##
+ # Attaches the +continuation+ of the previous line to the +entry_body+.
+ #
+ # Continued function listings are joined together as a single entry.
+ # Continued descriptions are joined to make a single paragraph.
+
+ def continue_entry_body entry_body, continuation
+ return unless last = entry_body.last
+
+ if last =~ /\)\s*\z/ and continuation =~ /\A\(/ then
+ last.sub!(/\)\s*\z/, ',')
+ continuation.sub!(/\A\(/, '')
+ end
+
+ if last =~ /\s\z/ then
+ last << continuation
+ else
+ last << ' ' << continuation
+ end
+ end
+
+ ##
+ # Creates an RDoc::Markup::Document given the +groups+ of ChangeLog entries.
+
+ def create_document groups
+ doc = RDoc::Markup::Document.new
+ doc.omit_headings_below = 2
+ doc.file = @top_level
+
+ doc << RDoc::Markup::Heading.new(1, File.basename(@file_name))
+ doc << RDoc::Markup::BlankLine.new
+
+ groups.sort_by do |day,| day end.reverse_each do |day, entries|
+ doc << RDoc::Markup::Heading.new(2, day.dup)
+ doc << RDoc::Markup::BlankLine.new
+
+ doc.concat create_entries entries
+ end
+
+ doc
+ end
+
+ ##
+ # Returns a list of ChangeLog entries an RDoc::Markup nodes for the given
+ # +entries+.
+
+ def create_entries entries
+ out = []
+
+ entries.each do |entry, items|
+ out << RDoc::Markup::Heading.new(3, entry)
+ out << RDoc::Markup::BlankLine.new
+
+ out << create_items(items)
+ end
+
+ out
+ end
+
+ ##
+ # Returns an RDoc::Markup::List containing the given +items+ in the
+ # ChangeLog
+
+ def create_items items
+ list = RDoc::Markup::List.new :NOTE
+
+ items.each do |item|
+ item =~ /\A(.*?(?:\([^)]+\))?):\s*/
+
+ title = $1
+ body = $'
+
+ paragraph = RDoc::Markup::Paragraph.new body
+ list_item = RDoc::Markup::ListItem.new title, paragraph
+ list << list_item
+ end
+
+ list
+ end
+
+ ##
+ # Groups +entries+ by date.
+
+ def group_entries entries
+ entries.group_by do |title, _|
+ begin
+ Time.parse(title).strftime '%Y-%m-%d'
+ rescue NoMethodError, ArgumentError
+ time, = title.split ' ', 2
+ Time.parse(time).strftime '%Y-%m-%d'
+ end
+ end
+ end
+
+ ##
+ # Parses the entries in the ChangeLog.
+ #
+ # Returns an Array of each ChangeLog entry in order of parsing.
+ #
+ # A ChangeLog entry is an Array containing the ChangeLog title (date and
+ # committer) and an Array of ChangeLog items (file and function changed with
+ # description).
+ #
+ # An example result would be:
+ #
+ # [ 'Tue Dec 4 08:33:46 2012 Eric Hodel <drbrain@segment7.net>',
+ # [ 'README.EXT: Converted to RDoc format',
+ # 'README.EXT.ja: ditto']]
+
+ def parse_entries
+ entries = []
+ entry_name = nil
+ entry_body = []
+
+ @content.each_line do |line|
+ case line
+ when /^\s*$/ then
+ next
+ when /^\w.*/ then
+ entries << [entry_name, entry_body] if entry_name
+
+ entry_name = $&
+
+ begin
+ time = Time.parse entry_name
+ # 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
+ rescue ArgumentError
+ entry_name = nil
+ end
+
+ entry_body = []
+ when /^(\t| {8})?\*\s*(.*)/ then # "\t* file.c (func): ..."
+ entry_body << $2
+ when /^(\t| {8})?\s*(\(.*)/ then # "\t(func): ..."
+ entry = $2
+
+ if entry_body.last =~ /:/ then
+ entry_body << entry
+ else
+ continue_entry_body entry_body, entry
+ end
+ when /^(\t| {8})?\s*(.*)/ then
+ continue_entry_body entry_body, $2
+ end
+ end
+
+ entries << [entry_name, entry_body] if entry_name
+
+ entries.reject! do |(entry,_)|
+ entry == nil
+ end
+
+ entries
+ end
+
+ ##
+ # Converts the ChangeLog into an RDoc::Markup::Document
+
+ def scan
+ entries = parse_entries
+ grouped_entries = group_entries entries
+
+ doc = create_document grouped_entries
+
+ @top_level.comment = doc
+
+ @top_level
+ end
+
+end
+
diff --git a/lib/rdoc/parser/markdown.rb b/lib/rdoc/parser/markdown.rb
new file mode 100644
index 0000000000..6fd88cf614
--- /dev/null
+++ b/lib/rdoc/parser/markdown.rb
@@ -0,0 +1,23 @@
+##
+# Parse a Markdown format file. The parsed RDoc::Markup::Document is attached
+# as a file comment.
+
+class RDoc::Parser::Markdown < RDoc::Parser
+
+ include RDoc::Parser::Text
+
+ parse_files_matching(/\.(md|markdown)(?:\.[^.]+)?$/)
+
+ ##
+ # Creates an Markdown-format TopLevel for the given file.
+
+ def scan
+ comment = RDoc::Comment.new @content, @top_level
+ comment.format = 'markdown'
+
+ @top_level.comment = comment
+ end
+
+end
+
+
diff --git a/lib/rdoc/parser/rd.rb b/lib/rdoc/parser/rd.rb
new file mode 100644
index 0000000000..09069ae297
--- /dev/null
+++ b/lib/rdoc/parser/rd.rb
@@ -0,0 +1,22 @@
+##
+# Parse a RD format file. The parsed RDoc::Markup::Document is attached as a
+# file comment.
+
+class RDoc::Parser::RD < RDoc::Parser
+
+ include RDoc::Parser::Text
+
+ parse_files_matching(/\.rd(?:\.[^.]+)?$/)
+
+ ##
+ # Creates an rd-format TopLevel for the given file.
+
+ def scan
+ comment = RDoc::Comment.new @content, @top_level
+ comment.format = 'rd'
+
+ @top_level.comment = comment
+ end
+
+end
+
diff --git a/lib/rdoc/parser/ruby.rb b/lib/rdoc/parser/ruby.rb
index c9a12a8fe8..1c4b637640 100644
--- a/lib/rdoc/parser/ruby.rb
+++ b/lib/rdoc/parser/ruby.rb
@@ -7,15 +7,6 @@
# by Keiju ISHITSUKA (Nippon Rational Inc.)
#
-require 'rdoc/ruby_token'
-require 'rdoc/ruby_lex'
-
-require 'rdoc/code_objects'
-require 'rdoc/token_stream'
-require 'rdoc/markup/pre_process'
-require 'rdoc/parser'
-require 'rdoc/parser/ruby_tools'
-
$TOKEN_DEBUG ||= nil
##
@@ -103,7 +94,7 @@ $TOKEN_DEBUG ||= nil
# You can force the name of a method using the :method: directive:
#
# ##
-# # :method: woo_hoo!
+# # :method: some_method!
#
# By default, meta-methods are instance methods. To indicate that a method is
# a singleton method instead use the :singleton-method: directive:
@@ -114,7 +105,10 @@ $TOKEN_DEBUG ||= nil
# You can also use the :singleton-method: directive with a name:
#
# ##
-# # :singleton-method: woo_hoo!
+# # :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
@@ -173,6 +167,8 @@ class RDoc::Parser::Ruby < RDoc::Parser
@scanner = RDoc::RubyLex.new content, @options
@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
@@ -181,6 +177,48 @@ 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+.
+ #
+ # 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 # :nodoc:
+ vis_type = tk.name
+ singleton = false
+
+ 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
@@ -213,32 +251,51 @@ class RDoc::Parser::Ruby < RDoc::Parser
unget_tk tk
- comment
+ new_comment comment
end
##
- # Aborts with +msg+
+ # Consumes trailing whitespace from the token stream
- def error(msg)
- msg = make_message msg
+ def consume_trailing_spaces # :nodoc:
+ get_tkread
+ skip_tkspace false
+ end
- abort msg
+ ##
+ # 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
##
- # Look for a 'call-seq' in the comment, and override the normal parameter
- # stuff
- #--
- # TODO handle undent
+ # Creates a module alias in +container+ at +rhs_name+ (or at the top-level
+ # for "::") with the name from +constant+.
- def extract_call_seq(comment, meth)
- if comment.sub!(/:?call-seq:(.*?)(^\s*#?\s*$|\z)/m, '') then
- seq = $1
- seq.gsub!(/^\s*\#\s*/, '')
- meth.call_seq = seq
- end
+ 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
- meth
+ container.add_module_alias mod, constant.name, @top_level if mod
+ end
+
+ ##
+ # Aborts with +msg+
+
+ def error(msg)
+ msg = make_message msg
+
+ abort msg
end
##
@@ -264,7 +321,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
# with :: separated named) and return the ultimate name, the associated
# container, and the given name (with the ::).
- def get_class_or_module(container)
+ def get_class_or_module container, ignore_constants = false
skip_tkspace
name_t = get_tk
given_name = ''
@@ -283,14 +340,26 @@ class RDoc::Parser::Ruby < RDoc::Parser
while TkCOLON2 === peek_tk do
prev_container = container
container = container.find_module_named name_t.name
- unless container then
- container = prev_container.add_module RDoc::NormalModule, name_t.name
- end
+ container ||=
+ if ignore_constants then
+ RDoc::Context.new
+ 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
+
+ record_location container
+
get_tk
+ skip_tkspace false
name_t = get_tk
given_name << '::' << name_t.name
end
+
skip_tkspace false
+
return [container, name_t, given_name]
end
@@ -298,16 +367,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
-
- 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
@@ -338,9 +404,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
@@ -371,6 +434,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
@@ -397,6 +522,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:
#
@@ -412,8 +551,8 @@ class RDoc::Parser::Ruby < RDoc::Parser
'attr', 'attr_accessor', 'attr_reader', 'attr_writer' then
false # handled elsewhere
when 'section' then
- context.set_current_section param, comment
- comment.replace ''
+ context.set_current_section param, comment.dup
+ comment.text = ''
break
end
end
@@ -433,6 +572,15 @@ class RDoc::Parser::Ruby < RDoc::Parser
end
##
+ # Creates a comment with the correct format
+
+ def new_comment comment
+ c = RDoc::Comment.new comment, @top_level
+ c.format = @markup
+ c
+ end
+
+ ##
# Creates an RDoc::Attr for the name following +tk+, setting the comment to
# +comment+.
@@ -453,16 +601,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
@@ -483,7 +626,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"
@@ -494,13 +637,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
@@ -520,7 +659,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
@@ -536,7 +675,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
@@ -570,7 +709,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
@@ -582,87 +721,127 @@ 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
##
# Parses a class in +context+ with +comment+
- def parse_class(container, single, tk, comment)
+ def parse_class container, single, tk, comment
offset = tk.seek
line_no = tk.line_no
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 TkLT === peek_tk then
- get_tk
- skip_tkspace
- superclass = get_class_specification
- superclass = '(unknown)' if superclass.empty?
+ 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
- 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.offset = offset
+ cls.line = line_no
- read_documentation_modifiers cls, RDoc::CLASS_MODIFIERS
- cls.record_location @top_level
- cls.offset = offset
- cls.line = line_no
+ cls
+ end
- cls.add_comment comment, @top_level
+ ##
+ # Parses and creates a regular class
- @top_level.add_to_classes_or_modules cls
- @stats.add_class cls
+ def parse_class_regular container, declaration_context, single, # :nodoc:
+ name_t, given_name, comment
+ superclass = '::Object'
- parse_statements cls
- when TkLSHFT
- case name = get_class_specification
- when "self", container.name
- parse_statements container, SINGLE
- else
- other = RDoc::TopLevel.find_class_named name
+ if given_name =~ /^::/ then
+ declaration_context = @top_level
+ given_name = $'
+ end
- unless other then
- other = container.add_module RDoc::NormalModule, name
- other.record_location @top_level
- other.offset = offset
- other.line = line_no
+ if TkLT === peek_tk then
+ get_tk
+ skip_tkspace
+ superclass = get_class_specification
+ superclass = '(unknown)' if superclass.empty?
+ end
- other.add_comment comment, @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
- # 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
+ read_documentation_modifiers cls, RDoc::CLASS_MODIFIERS
+ record_location cls
+
+ cls.add_comment comment, @top_level
+
+ @top_level.add_to_classes_or_modules cls
+ @stats.add_class cls
+
+ 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
##
- # Parses a constant in +context+ with +comment+
+ # Parses a constant in +context+ with +comment+. If +ignore_constants+ is
+ # true, no found constants will be added to RDoc.
- def parse_constant container, tk, comment
+ def parse_constant container, tk, comment, ignore_constants = false
+ prev_container = container
offset = tk.seek
line_no = tk.line_no
@@ -673,24 +852,56 @@ class RDoc::Parser::Ruby < RDoc::Parser
eq_tk = get_tk
- unless TkASSIGN === eq_tk then
+ if TkCOLON2 === eq_tk then
unget_tk eq_tk
- return false
- end
+ unget_tk tk
- nest = 0
- get_tkread
+ container, name_t, = get_class_or_module container, ignore_constants
- tk = get_tk
+ name = name_t.name
+
+ eq_tk = get_tk
+ end
+
+ unless TkASSIGN === eq_tk then
+ suppress_parents container, prev_container
- if TkGT === tk then
- unget_tk tk
unget_tk eq_tk
return false
end
+ if TkGT === peek_tk then
+ unget_tk eq_tk
+ return
+ end
+
+ value = ''
+ con = RDoc::Constant.new name, value, comment
+
+ body = parse_constant_body container, con
+
+ 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
+ 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
@@ -701,27 +912,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 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
- RDoc::TopLevel.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
@@ -733,94 +939,141 @@ class RDoc::Parser::Ruby < RDoc::Parser
tk = get_tk
end
- res = get_tkread.gsub(/^[ \t]+/, '').strip
- res = "" if res == ";"
-
- con = RDoc::Constant.new name, res, comment
- con.record_location @top_level
- con.offset = offset
- con.line = line_no
- read_documentation_modifiers con, RDoc::CONSTANT_MODIFIERS
-
- @stats.add_constant con
- container.add_constant con
- true
+ get_tkread_clean(/^[ \t]+/, '')
end
##
# Generates an RDoc::Method or RDoc::Attr from +comment+ by looking for
# :method: or :attr: directives in +comment+.
- def parse_comment(container, tk, comment)
+ def parse_comment container, tk, comment
+ return parse_comment_tomdoc container, tk, comment if @markup == 'tomdoc'
column = tk.char_no
offset = tk.seek
line_no = tk.line_no
- singleton = !!comment.sub!(/(^# +:?)(singleton-)(method:)/, '\1\3')
+ text = comment.text
- # REFACTOR
- if comment.sub!(/^# +:?method: *(\S*).*?\n/i, '') then
- name = $1 unless $1.empty?
+ singleton = !!text.sub!(/(^# +:?)(singleton-)(method:)/, '\1\3')
- meth = RDoc::GhostMethod.new get_tkread, name
- meth.record_location @top_level
- meth.singleton = singleton
- meth.offset = offset
- meth.line = line_no
+ 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.start_collecting_tokens
- indent = TkSPACE.new nil, 1, 1
- indent.set_text " " * column
+ if co then
+ co.singleton = singleton
+ co.offset = offset
+ co.line = line_no
+ end
- position_comment = TkCOMMENT.new nil, line_no, 1
- position_comment.set_text "# File #{@top_level.absolute_name}, line #{line_no}"
- meth.add_tokens [position_comment, NEWLINE_TOKEN, indent]
+ true
+ end
- meth.params = ''
+ ##
+ # Parse a comment that is describing an attribute in +container+ with the
+ # given +name+ and +comment+.
- extract_call_seq comment, meth
+ def parse_comment_attr container, type, name, comment # :nodoc:
+ return if name.empty?
- return unless meth.name
+ rw = case type
+ when 'attr_reader' then 'R'
+ when 'attr_writer' then 'W'
+ else 'RW'
+ end
- container.add_method meth
+ create_attr container, NORMAL, name, rw, comment
+ end
- meth.comment = comment
+ def parse_comment_ghost container, text, name, column, line_no, # :nodoc:
+ comment
+ name = nil if name.empty?
- @stats.add_method meth
- elsif comment.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 = RDoc::GhostMethod.new get_tkread, name
+ record_location meth
- name = $3 unless $3.empty?
+ meth.start_collecting_tokens
+ indent = TkSPACE.new 0, 1, 1
+ indent.set_text " " * column
- # 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
+ 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]
- container.add_attribute att
- @stats.add_attribute att
- end
+ meth.params =
+ if text.sub!(/^#\s+:?args?:\s*(.*?)\s*$/i, '') then
+ $1
+ else
+ ''
+ end
- true
+ comment.normalize
+ comment.extract_call_seq meth
+
+ return unless meth.name
+
+ container.add_method meth
+
+ meth.comment = comment
+
+ @stats.add_method meth
+
+ meth
end
##
- # Parses an +include+ in +context+ with +comment+
+ # Creates an RDoc::Method on +container+ from +comment+ if there is a
+ # Signature section in the comment
+
+ def parse_comment_tomdoc container, tk, comment
+ return unless signature = RDoc::TomDoc.signature(comment)
+ offset = tk.seek
+ line_no = tk.line_no
+
+ name, = signature.split %r%[ \(]%, 2
+
+ meth = RDoc::GhostMethod.new get_tkread, name
+ record_location meth
+ meth.offset = offset
+ meth.line = line_no
+
+ meth.start_collecting_tokens
+ indent = TkSPACE.new 0, 1, 1
+ indent.set_text " " * offset
- def parse_include context, comment
+ 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.call_seq = signature
+
+ comment.normalize
+
+ return unless meth.name
+
+ container.add_method meth
+
+ meth.comment = comment
+
+ @stats.add_method meth
+ end
+
+ ##
+ # Parses an +include+ or +extend+, indicated by the +klass+ and adds it to
+ # +container+ # with +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
@@ -830,6 +1083,43 @@ class RDoc::Parser::Ruby < RDoc::Parser
end
##
+ # Parses identifiers that can create new methods or change visibility.
+ #
+ # Returns true if the comment was not consumed.
+
+ 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
+ end
+
+ false
+ end
+
+ ##
# Parses a meta-programmed attribute and creates an RDoc::Attr.
#
# To create foo and bar attributes on class C with comment "My attributes":
@@ -867,7 +1157,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
tmp = RDoc::CodeObject.new
read_documentation_modifiers tmp, RDoc::ATTR_MODIFIERS
- if comment.sub!(/^# +:?(attr(_reader|_writer|_accessor)?): *(\S*).*?\n/i, '') then
+ if comment.text.sub!(/^# +:?(attr(_reader|_writer|_accessor)?): *(\S*).*?\n/i, '') then
rw = case $1
when 'attr_reader' then 'R'
when 'attr_writer' then 'W'
@@ -877,21 +1167,14 @@ 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
+
+ att
end
##
@@ -908,30 +1191,14 @@ class RDoc::Parser::Ruby < RDoc::Parser
skip_tkspace false
- singleton = !!comment.sub!(/(^# +:?)(singleton-)(method:)/, '\1\3')
+ singleton = !!comment.text.sub!(/(^# +:?)(singleton-)(method:)/, '\1\3')
- if comment.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
@@ -939,18 +1206,59 @@ class RDoc::Parser::Ruby < RDoc::Parser
remove_token_listener self
meth.start_collecting_tokens
- indent = TkSPACE.new nil, 1, 1
+ indent = TkSPACE.new 0, 1, 1
indent.set_text " " * column
- position_comment = TkCOMMENT.new nil, line_no, 1
- position_comment.value = "# File #{@top_level.absolute_name}, line #{line_no}"
+ position_comment = TkCOMMENT.new 0, line_no, 1
+ position_comment.value = "# File #{@top_level.relative_name}, line #{line_no}"
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 = ''
- extract_call_seq comment, meth
+ comment.normalize
+ comment.extract_call_seq meth
container.add_method meth
@@ -965,7 +1273,6 @@ class RDoc::Parser::Ruby < RDoc::Parser
when TkSPACE then
# expression continues
when TkDO then
- unget_tk tk
parse_statements container, single, meth
break
else
@@ -973,18 +1280,14 @@ class RDoc::Parser::Ruby < RDoc::Parser
end
end
end
-
- meth.comment = comment
-
- @stats.add_method 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
@@ -994,109 +1297,48 @@ 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
-
- dot = get_tk
- if TkDOT === dot or TkCOLON2 === dot then
- @scanner.instance_eval do @lex_state = EXPR_FNAME end
- skip_tkspace
- name_t2 = get_tk
-
- case name_t
- when TkSELF, TkMOD then
- name = name_t2.name
- when TkCONSTANT then
- name = name_t2.name
- prev_container = container
- container = container.find_module_named(name_t.name)
- 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
- dummy = RDoc::Context.new
- dummy.parent = container
- skip_method dummy
- return
- when TkTRUE, TkFALSE, TkNIL then
- klass_name = "#{name_t.name.capitalize}Class"
- container = RDoc::TopLevel.find_class_named klass_name
- container ||= @top_level.add_class RDoc::NormalClass, klass_name
-
- name = name_t2.name
- else
- warn "unexpected method name token #{name_t.inspect}"
- # break
- skip_method container
- return
- end
+ prev_container = container
+ name, container, singleton = parse_method_name container
+ added_container = container != prev_container
+ end
- meth = RDoc::AnyMethod.new(get_tkread, name)
- meth.singleton = true
- else
- unget_tk dot
- back_tk.reverse_each do |token|
- unget_tk token
- end
+ return unless name
- 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 = RDoc::AnyMethod.new get_tkread, name
+ meth.singleton = singleton
- meth.record_location @top_level
+ record_location meth
meth.offset = offset
meth.line = line_no
meth.start_collecting_tokens
- indent = TkSPACE.new nil, 1, 1
+ indent = TkSPACE.new 0, 1, 1
indent.set_text " " * column
- token = TkCOMMENT.new nil, line_no, 1
- token.set_text "# File #{@top_level.absolute_name}, line #{line_no}"
+ token = TkCOMMENT.new 0, line_no, 1
+ token.set_text "# File #{@top_level.relative_name}, line #{line_no}"
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
@@ -1105,7 +1347,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
@@ -1117,12 +1359,116 @@ class RDoc::Parser::Ruby < RDoc::Parser
parse_statements container, single, meth
end
+ end
- extract_call_seq comment, meth
+ ##
+ # Parses a method that needs to be ignored.
- meth.comment = comment
+ def parse_method_dummy container
+ dummy = RDoc::Context.new
+ dummy.parent = container
+ dummy.store = container.store
+ skip_method dummy
+ end
- @stats.add_method meth
+ ##
+ # 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
##
@@ -1132,20 +1478,9 @@ class RDoc::Parser::Ruby < RDoc::Parser
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
@@ -1166,7 +1501,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 <= 0
+ break if nest <= 0
else
break unless @scanner.continue
end
@@ -1184,9 +1519,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
##
@@ -1197,34 +1530,34 @@ class RDoc::Parser::Ruby < RDoc::Parser
#
# and add this as the block_params for the method
- def parse_method_parameters(method)
+ def parse_method_parameters method
res = parse_method_or_yield_parameters method
res = "(#{res})" unless res =~ /\A\(/
method.params = res unless method.params
- if method.block_params.nil? then
- skip_tkspace false
- read_documentation_modifiers method, RDoc::METHOD_MODIFIERS
- end
+ return if method.block_params
+
+ skip_tkspace false
+ read_documentation_modifiers method, RDoc::METHOD_MODIFIERS
end
##
# Parses an RDoc::NormalModule in +container+ with +comment+
- def parse_module(container, single, tk, comment)
+ def parse_module container, single, tk, comment
container, name_t, = get_class_or_module container
name = name_t.name
mod = container.add_module RDoc::NormalModule, name
- mod.record_location @top_level
+ mod.ignore unless container.document_children
+ record_location mod
read_documentation_modifiers mod, RDoc::CLASS_MODIFIERS
mod.add_comment comment, @top_level
- parse_statements(mod)
+ parse_statements mod
- @top_level.add_to_classes_or_modules mod
@stats.add_module mod
end
@@ -1250,10 +1583,31 @@ class RDoc::Parser::Ruby < RDoc::Parser
end
##
- # The core of the ruby parser.
+ # Parses a rescue
+
+ def parse_rescue
+ skip_tkspace false
+
+ while tk = get_tk
+ case tk
+ when TkNL, TkSEMICOLON then
+ break
+ when TkCOMMA then
+ skip_tkspace false
+
+ get_tk if TkNL === peek_tk
+ end
+
+ skip_tkspace false
+ end
+ end
+
+ ##
+ # The core of the Ruby parser.
def parse_statements(container, single = NORMAL, current_method = nil,
- comment = '')
+ comment = new_comment(''))
+ raise 'no' unless RDoc::Comment === comment
comment.force_encoding @encoding if @encoding
nest = 1
@@ -1293,10 +1647,13 @@ class RDoc::Parser::Ruby < RDoc::Parser
end
end
+ comment = new_comment comment
+
unless comment.empty? then
look_for_directives_in container, comment
if container.done_documenting then
+ throw :eof if RDoc::TopLevel === container
container.ongoing_visibility = save_visibility
end
end
@@ -1306,24 +1663,20 @@ class RDoc::Parser::Ruby < RDoc::Parser
non_comment_seen = true
end
- unget_tk tk # TODO peek instead of get then unget
+ unget_tk tk
keep_comment = true
when TkCLASS then
parse_class container, single, tk, comment
when TkMODULE then
- if container.document_children then
- parse_module container, single, tk, comment
- else
- nest += 1
- end
+ parse_module container, single, tk, comment
when TkDEF then
parse_method container, single, tk, comment
when TkCONSTANT then
- unless parse_constant container, tk, comment then
+ unless parse_constant container, tk, comment, current_method then
try_parse_comment = true
end
@@ -1354,38 +1707,24 @@ class RDoc::Parser::Ruby < RDoc::Parser
when TkCASE, TkDO, TkIF, TkUNLESS, TkBEGIN then
nest += 1
+ when TkSUPER then
+ current_method.calls_super = true if current_method
+
+ when TkRESCUE then
+ parse_rescue
+
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 =~ /\A#\#$/ then
- case comment
- when /^# +:?attr(_reader|_writer|_accessor)?:/ then
- parse_meta_attr container, single, tk, comment
- else
- parse_meta_method container, single, tk, comment
- 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_or_include RDoc::Extend, container, comment
end
when TkEND then
@@ -1410,65 +1749,87 @@ class RDoc::Parser::Ruby < RDoc::Parser
end
unless keep_comment then
- comment = ''
+ comment = new_comment ''
comment.force_encoding @encoding if @encoding
+ container.params = nil
+ container.block_params = nil
end
- begin
- get_tkread
- skip_tkspace false
- end while peek_tk == TkNL
+ consume_trailing_spaces
end
+
+ container.params = nil
+ container.block_params = nil
end
##
# 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
@@ -1497,8 +1858,13 @@ class RDoc::Parser::Ruby < RDoc::Parser
def parse_top_level_statements container
comment = collect_first_comment
+
look_for_directives_in container, comment
+ throw :eof if container.done_documenting
+
+ @markup = comment.format
+
# HACK move if to RDoc::Context#comment=
container.comment = comment if container.document_self unless comment.empty?
@@ -1511,24 +1877,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
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
skip_tkspace_comment false
@@ -1541,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
@@ -1590,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
@@ -1604,28 +1915,45 @@ class RDoc::Parser::Ruby < RDoc::Parser
#
# class MyClass # :nodoc:
#
- # We return the directive name and any parameters as a two element array
+ # We return the directive name and any parameters as a two element array if
+ # the name is in +allowed+. A directive can be found anywhere up to the end
+ # of the current line.
def read_directive allowed
- tk = get_tk
+ tokens = []
+
+ while tk = get_tk do
+ tokens << tk
- if TkCOMMENT === tk then
- return unless tk.text =~ /\s*:?(\w+):\s*(.*)/
+ case tk
+ when TkNL, TkDEF then
+ return
+ when TkCOMMENT then
+ return unless tk.text =~ /\s*:?([\w-]+):\s*(.*)/
- directive = $1.downcase
+ directive = $1.downcase
- return [directive, $2] if allowed.include? directive
- else
- unget_tk tk
+ return [directive, $2] if allowed.include? directive
+
+ return
+ end
+ end
+ ensure
+ unless tokens.length == 1 and TkCOMMENT === tokens.first then
+ tokens.reverse_each do |token|
+ unget_tk token
+ end
end
end
##
- # Handles the directive for +context+ if the directive is listed in +allow+.
- # This method is called for directives following a definition.
+ # Handles directives following the definition for +context+ (any
+ # RDoc::CodeObject) if the directives are +allowed+ at this point.
+ #
+ # See also RDoc::Markup::PreProcess#handle_directive
- def read_documentation_modifiers context, allow
- directive, value = read_directive allow
+ def read_documentation_modifiers context, allowed
+ directive, value = read_directive allowed
return unless directive
@@ -1639,18 +1967,29 @@ class RDoc::Parser::Ruby < RDoc::Parser
end
##
- # Removes private comments from +comment+
+ # 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
- def remove_private_comments(comment)
- empty = ''
- empty.force_encoding comment.encoding if Object.const_defined? :Encoding
+ ##
+ # Removes private comments from +comment+
+ #--
+ # TODO remove
- comment.gsub!(/^#--.*?^#\+\+\n?/m, empty)
- comment.sub!(/^#--.*/m, '')
+ def remove_private_comments comment
+ comment.remove_private
end
##
- # Scans this ruby file for ruby constructs
+ # Scans this Ruby file for Ruby constructs
def scan
reset
@@ -1658,6 +1997,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
catch :eof do
begin
parse_top_level_statements @top_level
+
rescue StandardError => e
bytes = ''
@@ -1697,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
@@ -1723,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
@@ -1770,12 +2105,55 @@ class RDoc::Parser::Ruby < RDoc::Parser
end
##
- # Prints +msg+ to +$stderr+ unless we're being quiet
+ # Updates visibility in +container+ from +vis_type+ and +vis+.
- def warn(msg)
- return if @options.quiet
- msg = make_message msg
- $stderr.puts msg
+ 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
+ @options.warn make_message message
end
end
diff --git a/lib/rdoc/parser/ruby_tools.rb b/lib/rdoc/parser/ruby_tools.rb
index 678f721624..654431ea30 100644
--- a/lib/rdoc/parser/ruby_tools.rb
+++ b/lib/rdoc/parser/ruby_tools.rb
@@ -43,8 +43,7 @@ module RDoc::Parser::RubyTools
tk = Token(TkSYMBOL).set_text(":" + tk1.text)
end
- # remove the identifier we just read (we're about to replace it with a
- # symbol)
+ # remove the identifier we just read to replace it with a symbol
@token_listeners.each do |obj|
obj.pop_token
end if @token_listeners
@@ -70,7 +69,13 @@ module RDoc::Parser::RubyTools
loop do
tk = get_tk
- case tk when *tokens then unget_tk tk; break end
+
+ case tk
+ when *tokens then
+ unget_tk tk
+ break
+ end
+
read << tk
end
diff --git a/lib/rdoc/parser/simple.rb b/lib/rdoc/parser/simple.rb
index 1e82eb5097..65cfc1b2e7 100644
--- a/lib/rdoc/parser/simple.rb
+++ b/lib/rdoc/parser/simple.rb
@@ -4,6 +4,8 @@
class RDoc::Parser::Simple < RDoc::Parser
+ include RDoc::Parser::Text
+
parse_files_matching(//)
attr_reader :content # :nodoc:
@@ -24,26 +26,36 @@ class RDoc::Parser::Simple < RDoc::Parser
def scan
comment = remove_coding_comment @content
- comment = remove_private_comments comment
+ comment = remove_private_comment comment
+
+ comment = RDoc::Comment.new comment, @top_level
@top_level.comment = comment
- @top_level.parser = self.class
@top_level
end
##
- # Removes comments wrapped in <tt>--/++</tt>
-
- def remove_private_comments text
- text.gsub(/^--\n.*?^\+\+/m, '').sub(/^--\n.*/m, '')
- end
-
- ##
# Removes the encoding magic comment from +text+
def remove_coding_comment text
text.sub(/\A# .*coding[=:].*$/, '')
end
+ ##
+ # Removes private comments.
+ #
+ # Unlike RDoc::Comment#remove_private this implementation only looks for two
+ # dashes at the beginning of the line. Three or more dashes are considered
+ # to be a rule and ignored.
+
+ def remove_private_comment comment
+ # Workaround for gsub encoding for Ruby 1.9.2 and earlier
+ empty = ''
+ empty.force_encoding comment.encoding if Object.const_defined? :Encoding
+
+ comment = comment.gsub(%r%^--\n.*?^\+\+\n?%m, empty)
+ comment.sub(%r%^--\n.*%m, empty)
+ end
+
end
diff --git a/lib/rdoc/parser/text.rb b/lib/rdoc/parser/text.rb
new file mode 100644
index 0000000000..f973313551
--- /dev/null
+++ b/lib/rdoc/parser/text.rb
@@ -0,0 +1,11 @@
+##
+# Indicates this parser is text and doesn't contain code constructs.
+#
+# Include this module in a RDoc::Parser subclass to make it show up as a file,
+# not as part of a class or module.
+#--
+# This is not named File to avoid overriding ::File
+
+module RDoc::Parser::Text
+end
+
diff --git a/lib/rdoc/rd.rb b/lib/rdoc/rd.rb
new file mode 100644
index 0000000000..28c5d286e0
--- /dev/null
+++ b/lib/rdoc/rd.rb
@@ -0,0 +1,99 @@
+##
+# RDoc::RD implements the RD format from the rdtool gem.
+#
+# To choose RD as your only default format see
+# RDoc::Options@Saved+Options for instructions on setting up a
+# <code>.doc_options</code> file to store your project default.
+#
+# == LICENSE
+#
+# The grammar that produces RDoc::RD::BlockParser and RDoc::RD::InlineParser
+# is included in RDoc under the Ruby License.
+#
+# You can find the original source for rdtool at
+# https://github.com/uwabami/rdtool/
+#
+# You can use, re-distribute or change these files under Ruby's License or GPL.
+#
+# 1. You may make and give away verbatim copies of the source form of the
+# software without restriction, provided that you duplicate all of the
+# original copyright notices and associated disclaimers.
+#
+# 2. You may modify your copy of the software in any way, provided that
+# you do at least ONE of the following:
+#
+# a. place your modifications in the Public Domain or otherwise
+# make them Freely Available, such as by posting said
+# modifications to Usenet or an equivalent medium, or by allowing
+# the author to include your modifications in the software.
+#
+# b. use the modified software only within your corporation or
+# organization.
+#
+# c. give non-standard binaries non-standard names, with
+# instructions on where to get the original software distribution.
+#
+# d. make other distribution arrangements with the author.
+#
+# 3. You may distribute the software in object code or binary form,
+# provided that you do at least ONE of the following:
+#
+# a. distribute the binaries and library files of the software,
+# together with instructions (in the manual page or equivalent)
+# on where to get the original distribution.
+#
+# b. accompany the distribution with the machine-readable source of
+# the software.
+#
+# c. give non-standard binaries non-standard names, with
+# instructions on where to get the original software distribution.
+#
+# d. make other distribution arrangements with the author.
+#
+# 4. You may modify and include the part of the software into any other
+# software (possibly commercial). But some files in the distribution
+# are not written by the author, so that they are not under these terms.
+#
+# For the list of those files and their copying conditions, see the
+# file LEGAL.
+#
+# 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.
+
+class RDoc::RD
+
+ ##
+ # Parses +rd+ source and returns an RDoc::Markup::Document. If the
+ # <tt>=begin</tt> or <tt>=end</tt> lines are missing they will be added.
+
+ def self.parse rd
+ rd = rd.lines.to_a
+
+ if rd.find { |i| /\S/ === i } and !rd.find{|i| /^=begin\b/ === i } then
+ rd.unshift("=begin\n").push("=end\n")
+ end
+
+ parser = RDoc::RD::BlockParser.new
+ document = parser.parse rd
+
+ # isn't this always true?
+ document.parts.shift if RDoc::Markup::BlankLine === document.parts.first
+ document.parts.pop if RDoc::Markup::BlankLine === document.parts.last
+
+ document
+ end
+
+ autoload :BlockParser, 'rdoc/rd/block_parser'
+ autoload :InlineParser, 'rdoc/rd/inline_parser'
+ autoload :Inline, 'rdoc/rd/inline'
+
+end
+
diff --git a/lib/rdoc/rd/block_parser.rb b/lib/rdoc/rd/block_parser.rb
new file mode 100644
index 0000000000..dd15e1262e
--- /dev/null
+++ b/lib/rdoc/rd/block_parser.rb
@@ -0,0 +1,1055 @@
+#
+# DO NOT MODIFY!!!!
+# This file is automatically generated by Racc 1.4.9
+# from Racc grammer file "".
+#
+
+require 'racc/parser.rb'
+
+class RDoc::RD
+
+##
+# RD format parser for headings, paragraphs, lists, verbatim sections that
+# exist as blocks.
+
+class BlockParser < Racc::Parser
+
+
+# :stopdoc:
+
+TMPFILE = ["rdtmp", $$, 0]
+
+MARK_TO_LEVEL = {
+ '=' => 1,
+ '==' => 2,
+ '===' => 3,
+ '====' => 4,
+ '+' => 5,
+ '++' => 6,
+}
+
+# :startdoc:
+
+##
+# Footnotes for this document
+
+attr_reader :footnotes
+
+##
+# Labels for items in this document
+
+attr_reader :labels
+
+##
+# Path to find included files in
+
+attr_accessor :include_path
+
+##
+# Creates a new RDoc::RD::BlockParser. Use #parse to parse an rd-format
+# document.
+
+def initialize
+ @inline_parser = RDoc::RD::InlineParser.new self
+ @include_path = []
+
+ # for testing
+ @footnotes = []
+ @labels = {}
+end
+
+##
+# Parses +src+ and returns an RDoc::Markup::Document.
+
+def parse src
+ @src = src
+ @src.push false
+
+ @footnotes = []
+ @labels = {}
+
+ # @i: index(line no.) of src
+ @i = 0
+
+ # stack for current indentation
+ @indent_stack = []
+
+ # how indented.
+ @current_indent = @indent_stack.join("")
+
+ # RDoc::RD::BlockParser for tmp src
+ @subparser = nil
+
+ # which part is in now
+ @in_part = nil
+ @part_content = []
+
+ @in_verbatim = false
+
+ @yydebug = true
+
+ document = do_parse
+
+ unless @footnotes.empty? then
+ blankline = document.parts.pop
+
+ document.parts << RDoc::Markup::Rule.new(1)
+ document.parts.concat @footnotes
+
+ document.parts.push blankline
+ end
+
+ document
+end
+
+##
+# Returns the next token from the document
+
+def next_token # :nodoc:
+ # preprocessing
+ # if it is not in RD part
+ # => method
+ while @in_part != "rd"
+ line = @src[@i]
+ @i += 1 # next line
+
+ case line
+ # src end
+ when false
+ return [false, false]
+ # RD part begin
+ when /^=begin\s*(?:\bRD\b.*)?\s*$/
+ if @in_part # if in non-RD part
+ @part_content.push(line)
+ else
+ @in_part = "rd"
+ return [:WHITELINE, "=begin\n"] # <= for textblockand
+ end
+ # non-RD part begin
+ when /^=begin\s+(\w+)/
+ part = $1
+ if @in_part # if in non-RD part
+ @part_content.push(line)
+ else
+ @in_part = part if @tree.filter[part] # if filter exists
+# p "BEGIN_PART: #{@in_part}" # DEBUG
+ end
+ # non-RD part end
+ when /^=end/
+ if @in_part # if in non-RD part
+# p "END_PART: #{@in_part}" # DEBUG
+ # make Part-in object
+ part = RDoc::RD::Part.new(@part_content.join(""), @tree, "r")
+ @part_content.clear
+ # 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
+ subtree = parse_subtree(part_out.to_a)
+ else # if output is target formated
+ basename = TMPFILE.join('.')
+ TMPFILE[-1] += 1
+ tmpfile = open(@tree.tmp_dir + "/" + basename + ".#{@in_part}", "w")
+ tmpfile.print(part_out)
+ tmpfile.close
+ subtree = parse_subtree(["=begin\n", "<<< #{basename}\n", "=end\n"])
+ end
+ @in_part = nil
+ return [:SUBTREE, subtree]
+ end
+ else
+ if @in_part # if in non-RD part
+ @part_content.push(line)
+ end
+ end
+ end
+
+ @current_indent = @indent_stack.join("")
+ line = @src[@i]
+ case line
+ when false
+ if_current_indent_equal("") do
+ [false, false]
+ end
+ when /^=end/
+ if_current_indent_equal("") do
+ @in_part = nil
+ [:WHITELINE, "=end"] # MUST CHANGE??
+ end
+ when /^\s*$/
+ @i += 1 # next line
+ return [:WHITELINE, ':WHITELINE']
+ when /^\#/ # comment line
+ @i += 1 # next line
+ self.next_token()
+ when /^(={1,4})(?!=)\s*(?=\S)/, /^(\+{1,2})(?!\+)\s*(?=\S)/
+ rest = $' # '
+ rest.strip!
+ mark = $1
+ if_current_indent_equal("") do
+ return [:HEADLINE, [MARK_TO_LEVEL[mark], rest]]
+ end
+ when /^<<<\s*(\S+)/
+ file = $1
+ if_current_indent_equal("") do
+ suffix = file[-3 .. -1]
+ if suffix == ".rd" or suffix == ".rb"
+ subtree = parse_subtree(get_included(file))
+ [:SUBTREE, subtree]
+ else
+ [:INCLUDE, file]
+ end
+ end
+ when /^(\s*)\*(\s*)/
+ rest = $' # '
+ newIndent = $2
+ if_current_indent_equal($1) do
+ if @in_verbatim
+ [:STRINGLINE, line]
+ else
+ @indent_stack.push("\s" << newIndent)
+ [:ITEMLISTLINE, rest]
+ end
+ end
+ when /^(\s*)(\(\d+\))(\s*)/
+ rest = $' # '
+ mark = $2
+ newIndent = $3
+ if_current_indent_equal($1) do
+ if @in_verbatim
+ [:STRINGLINE, line]
+ else
+ @indent_stack.push("\s" * mark.size << newIndent)
+ [:ENUMLISTLINE, rest]
+ end
+ end
+ when /^(\s*):(\s*)/
+ rest = $' # '
+ newIndent = $2
+ if_current_indent_equal($1) do
+ if @in_verbatim
+ [:STRINGLINE, line]
+ else
+ @indent_stack.push("\s#{$2}")
+ [:DESCLISTLINE, rest]
+ end
+ end
+ when /^(\s*)---(?!-|\s*$)/
+ indent = $1
+ rest = $'
+ /\s*/ === rest
+ term = $'
+ new_indent = $&
+ if_current_indent_equal(indent) do
+ if @in_verbatim
+ [:STRINGLINE, line]
+ else
+ @indent_stack.push("\s\s\s" + new_indent)
+ [:METHODLISTLINE, term]
+ end
+ end
+ when /^(\s*)/
+ if_current_indent_equal($1) do
+ [:STRINGLINE, line]
+ end
+ else
+ raise "[BUG] parsing error may occured."
+ end
+end
+
+##
+# Yields to the given block if +indent+ matches the current indent, otherwise
+# an indentation token is processed.
+
+def if_current_indent_equal(indent)
+ indent = indent.sub(/\t/, "\s" * 8)
+ if @current_indent == indent
+ @i += 1 # next line
+ yield
+ elsif indent.index(@current_indent) == 0
+ @indent_stack.push(indent[@current_indent.size .. -1])
+ [:INDENT, ":INDENT"]
+ else
+ @indent_stack.pop
+ [:DEDENT, ":DEDENT"]
+ end
+end
+private :if_current_indent_equal
+
+##
+# Cuts off excess whitespace in +src+
+
+def cut_off(src)
+ ret = []
+ whiteline_buf = []
+
+ line = src.shift
+ /^\s*/ =~ line
+
+ indent = Regexp.quote($&)
+ ret.push($')
+
+ while line = src.shift
+ if /^(\s*)$/ =~ line
+ whiteline_buf.push(line)
+ elsif /^#{indent}/ =~ line
+ unless whiteline_buf.empty?
+ ret.concat(whiteline_buf)
+ whiteline_buf.clear
+ end
+ ret.push($')
+ else
+ raise "[BUG]: probably Parser Error while cutting off.\n"
+ end
+ end
+ ret
+end
+private :cut_off
+
+def set_term_to_element(parent, term)
+# parent.set_term_under_document_struct(term, @tree.document_struct)
+ parent.set_term_without_document_struct(term)
+end
+private :set_term_to_element
+
+##
+# Raises a ParseError when invalid formatting is found
+
+def on_error(et, ev, _values)
+ prv, cur, nxt = format_line_num(@i, @i+1, @i+2)
+
+ raise ParseError, <<Msg
+
+RD syntax error: line #{@i+1}:
+ #{prv} |#{@src[@i-1].chomp}
+ #{cur}=>|#{@src[@i].chomp}
+ #{nxt} |#{@src[@i+1].chomp}
+
+Msg
+end
+
+##
+# Current line number
+
+def line_index
+ @i
+end
+
+##
+# Parses subtree +src+
+
+def parse_subtree src
+ @subparser ||= RDoc::RD::BlockParser.new
+
+ @subparser.parse src
+end
+private :parse_subtree
+
+##
+# Retrieves the content for +file+ from the include_path
+
+def get_included(file)
+ included = []
+
+ @include_path.each do |dir|
+ file_name = File.join dir, file
+
+ if File.exist? file_name then
+ included = IO.readlines file_name
+ break
+ end
+ end
+
+ included
+end
+private :get_included
+
+##
+# Formats line numbers +line_numbers+ prettily
+
+def format_line_num(*line_numbers)
+ width = line_numbers.collect{|i| i.to_s.length }.max
+ line_numbers.collect{|i| sprintf("%#{width}d", i) }
+end
+private :format_line_num
+
+##
+# Retrieves the content of +values+ as a single String
+
+def content values
+ values.map { |value| value.content }.join
+end
+
+##
+# Creates a paragraph for +value+
+
+def paragraph value
+ content = cut_off(value).join(' ').rstrip
+ contents = @inline_parser.parse content
+
+ RDoc::Markup::Paragraph.new(*contents)
+end
+
+##
+# Adds footnote +content+ to the document
+
+def add_footnote content
+ index = @footnotes.length / 2 + 1
+
+ footmark_link = "{^#{index}}[rdoc-label:footmark-#{index}:foottext-#{index}]"
+
+ @footnotes << RDoc::Markup::Paragraph.new(footmark_link, ' ', *content)
+ @footnotes << RDoc::Markup::BlankLine.new
+
+ index
+end
+
+##
+# Adds label +label+ to the document
+
+def add_label label
+ @labels[label] = true
+
+ label
+end
+
+# :stopdoc:
+
+##### State transition tables begin ###
+
+racc_action_table = [
+ 34, 35, 30, 33, 14, 73, 38, 33, 76, 15,
+ 88, 34, 35, 30, 33, 40, 34, 35, 30, 33,
+ 40, 65, 34, 35, 30, 33, 14, 73, 77, 14,
+ 54, 15, 34, 35, 30, 33, 14, 9, 10, 11,
+ 12, 15, 34, 35, 30, 33, 14, 73, 81, 54,
+ 38, 15, 34, 35, 30, 33, 14, 73, 40, 67,
+ 83, 15, 34, 35, 30, 33, 14, 73, 54, 30,
+ 35, 15, 34, 35, 30, 33, 34, 47, 36, 14,
+ 59, 15, 34, 35, 30, 33, 14, 73, 38, nil,
+ nil, 15, 34, 35, 30, 33, nil, 47, nil, nil,
+ nil, 15, 34, 35, 30, 33, 14, 73, nil, nil,
+ nil, 15, 34, 35, 30, 33, 14, 73, nil, nil,
+ nil, 15, 34, 35, 30, 33, 14, 9, 10, 11,
+ 12, 15, 34, 35, 30, 33, 14, 73, nil, nil,
+ nil, 15, 34, 35, 30, 33, 14, 73, 61, 63,
+ nil, 15, nil, 62, 60, 61, 63, 61, 63, 14,
+ 62, 87, 62, nil, 79, 34, 35, 30, 33 ]
+
+racc_action_check = [
+ 86, 86, 86, 86, 86, 86, 57, 31, 49, 86,
+ 86, 41, 41, 41, 41, 41, 15, 15, 15, 15,
+ 15, 41, 45, 45, 45, 45, 45, 45, 51, 34,
+ 54, 45, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 85, 85, 85, 85, 85, 85, 56, 33,
+ 58, 85, 79, 79, 79, 79, 79, 79, 62, 44,
+ 66, 79, 78, 78, 78, 78, 78, 78, 30, 28,
+ 25, 78, 24, 24, 24, 24, 22, 24, 1, 35,
+ 36, 24, 75, 75, 75, 75, 75, 75, 13, nil,
+ nil, 75, 27, 27, 27, 27, nil, 27, nil, nil,
+ nil, 27, 74, 74, 74, 74, 74, 74, nil, nil,
+ nil, 74, 68, 68, 68, 68, 68, 68, nil, nil,
+ nil, 68, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 46, 46, 46, 46, 46, 46, nil, nil,
+ nil, 46, 47, 47, 47, 47, 47, 47, 39, 39,
+ nil, 47, nil, 39, 39, 82, 82, 64, 64, 52,
+ 82, 82, 64, nil, 52, 20, 20, 20, 20 ]
+
+racc_action_pointer = [
+ 29, 78, 119, nil, nil, nil, nil, nil, nil, nil,
+ nil, nil, nil, 81, nil, 13, nil, nil, nil, nil,
+ 162, nil, 73, nil, 69, 66, nil, 89, 64, nil,
+ 60, 1, nil, 41, 22, 72, 80, nil, nil, 141,
+ nil, 8, nil, nil, 46, 19, 129, 139, nil, -5,
+ nil, 15, 152, nil, 22, nil, 35, -1, 43, nil,
+ nil, nil, 51, nil, 150, nil, 47, nil, 109, nil,
+ nil, nil, nil, nil, 99, 79, nil, nil, 59, 49,
+ nil, nil, 148, nil, nil, 39, -3, nil, nil ]
+
+racc_action_default = [
+ -2, -73, -1, -4, -5, -6, -7, -8, -9, -10,
+ -11, -12, -13, -14, -16, -73, -23, -24, -25, -26,
+ -27, -31, -32, -34, -72, -36, -38, -72, -40, -42,
+ -59, -44, -46, -59, -63, -65, -73, -3, -15, -73,
+ -22, -73, -30, -33, -73, -69, -70, -71, -37, -73,
+ -41, -73, -51, -58, -61, -45, -73, -62, -64, 89,
+ -17, -19, -73, -21, -18, -28, -73, -35, -66, -53,
+ -54, -55, -56, -57, -67, -68, -39, -43, -49, -73,
+ -60, -47, -73, -29, -52, -48, -73, -20, -50 ]
+
+racc_goto_table = [
+ 4, 39, 4, 68, 74, 75, 5, 6, 5, 6,
+ 51, 42, 44, 56, 3, 49, 37, 57, 58, 41,
+ 43, 48, 84, 50, 66, 55, 1, 64, 84, 84,
+ 45, 46, 42, 45, 46, 2, 85, 86, 80, 84,
+ 84, nil, nil, nil, nil, nil, nil, nil, 82, nil,
+ nil, nil, 78 ]
+
+racc_goto_check = [
+ 4, 10, 4, 31, 31, 31, 5, 6, 5, 6,
+ 27, 12, 21, 27, 3, 21, 3, 9, 9, 17,
+ 19, 23, 32, 26, 11, 29, 1, 10, 32, 32,
+ 5, 6, 12, 5, 6, 2, 31, 31, 33, 32,
+ 32, nil, nil, nil, nil, nil, nil, nil, 10, nil,
+ nil, nil, 4 ]
+
+racc_goto_pointer = [
+ nil, 26, 35, 14, 0, 6, 7, nil, nil, -17,
+ -14, -17, -9, nil, nil, nil, nil, 4, nil, -2,
+ nil, -12, nil, -4, nil, nil, -5, -20, nil, -6,
+ nil, -42, -46, -16 ]
+
+racc_goto_default = [
+ nil, nil, nil, nil, 70, 71, 72, 7, 8, 13,
+ nil, nil, 21, 16, 17, 18, 19, 20, 22, 23,
+ 24, nil, 25, 26, 27, 28, 29, nil, 31, 32,
+ 52, nil, 69, 53 ]
+
+racc_reduce_table = [
+ 0, 0, :racc_error,
+ 1, 15, :_reduce_1,
+ 0, 15, :_reduce_2,
+ 2, 16, :_reduce_3,
+ 1, 16, :_reduce_4,
+ 1, 17, :_reduce_5,
+ 1, 17, :_reduce_6,
+ 1, 17, :_reduce_none,
+ 1, 17, :_reduce_8,
+ 1, 17, :_reduce_9,
+ 1, 17, :_reduce_10,
+ 1, 17, :_reduce_11,
+ 1, 21, :_reduce_12,
+ 1, 22, :_reduce_13,
+ 1, 18, :_reduce_14,
+ 2, 23, :_reduce_15,
+ 1, 23, :_reduce_16,
+ 3, 19, :_reduce_17,
+ 1, 25, :_reduce_18,
+ 2, 24, :_reduce_19,
+ 4, 24, :_reduce_20,
+ 2, 24, :_reduce_21,
+ 1, 24, :_reduce_22,
+ 1, 26, :_reduce_none,
+ 1, 26, :_reduce_none,
+ 1, 26, :_reduce_none,
+ 1, 26, :_reduce_none,
+ 1, 20, :_reduce_27,
+ 3, 20, :_reduce_28,
+ 4, 20, :_reduce_29,
+ 2, 31, :_reduce_30,
+ 1, 31, :_reduce_31,
+ 1, 27, :_reduce_32,
+ 2, 32, :_reduce_33,
+ 1, 32, :_reduce_34,
+ 3, 33, :_reduce_35,
+ 1, 28, :_reduce_36,
+ 2, 36, :_reduce_37,
+ 1, 36, :_reduce_38,
+ 3, 37, :_reduce_39,
+ 1, 29, :_reduce_40,
+ 2, 39, :_reduce_41,
+ 1, 39, :_reduce_42,
+ 3, 40, :_reduce_43,
+ 1, 30, :_reduce_44,
+ 2, 42, :_reduce_45,
+ 1, 42, :_reduce_46,
+ 3, 43, :_reduce_47,
+ 3, 41, :_reduce_48,
+ 2, 41, :_reduce_49,
+ 4, 41, :_reduce_50,
+ 1, 41, :_reduce_51,
+ 2, 45, :_reduce_52,
+ 1, 45, :_reduce_none,
+ 1, 46, :_reduce_54,
+ 1, 46, :_reduce_55,
+ 1, 46, :_reduce_none,
+ 1, 46, :_reduce_57,
+ 1, 44, :_reduce_none,
+ 0, 44, :_reduce_none,
+ 2, 47, :_reduce_none,
+ 1, 47, :_reduce_none,
+ 2, 34, :_reduce_62,
+ 1, 34, :_reduce_63,
+ 2, 38, :_reduce_64,
+ 1, 38, :_reduce_65,
+ 2, 35, :_reduce_66,
+ 2, 35, :_reduce_67,
+ 2, 35, :_reduce_68,
+ 1, 35, :_reduce_69,
+ 1, 35, :_reduce_none,
+ 1, 35, :_reduce_71,
+ 0, 35, :_reduce_72 ]
+
+racc_reduce_n = 73
+
+racc_shift_n = 89
+
+racc_token_table = {
+ false => 0,
+ :error => 1,
+ :DUMMY => 2,
+ :ITEMLISTLINE => 3,
+ :ENUMLISTLINE => 4,
+ :DESCLISTLINE => 5,
+ :METHODLISTLINE => 6,
+ :STRINGLINE => 7,
+ :WHITELINE => 8,
+ :SUBTREE => 9,
+ :HEADLINE => 10,
+ :INCLUDE => 11,
+ :INDENT => 12,
+ :DEDENT => 13 }
+
+racc_nt_base = 14
+
+racc_use_result_var = true
+
+Racc_arg = [
+ racc_action_table,
+ racc_action_check,
+ racc_action_default,
+ racc_action_pointer,
+ racc_goto_table,
+ racc_goto_check,
+ racc_goto_default,
+ racc_goto_pointer,
+ racc_nt_base,
+ racc_reduce_table,
+ racc_token_table,
+ racc_shift_n,
+ racc_reduce_n,
+ racc_use_result_var ]
+
+Racc_token_to_s_table = [
+ "$end",
+ "error",
+ "DUMMY",
+ "ITEMLISTLINE",
+ "ENUMLISTLINE",
+ "DESCLISTLINE",
+ "METHODLISTLINE",
+ "STRINGLINE",
+ "WHITELINE",
+ "SUBTREE",
+ "HEADLINE",
+ "INCLUDE",
+ "INDENT",
+ "DEDENT",
+ "$start",
+ "document",
+ "blocks",
+ "block",
+ "textblock",
+ "verbatim",
+ "lists",
+ "headline",
+ "include",
+ "textblockcontent",
+ "verbatimcontent",
+ "verbatim_after_lists",
+ "list",
+ "itemlist",
+ "enumlist",
+ "desclist",
+ "methodlist",
+ "lists2",
+ "itemlistitems",
+ "itemlistitem",
+ "first_textblock_in_itemlist",
+ "other_blocks_in_list",
+ "enumlistitems",
+ "enumlistitem",
+ "first_textblock_in_enumlist",
+ "desclistitems",
+ "desclistitem",
+ "description_part",
+ "methodlistitems",
+ "methodlistitem",
+ "whitelines",
+ "blocks_in_list",
+ "block_in_list",
+ "whitelines2" ]
+
+Racc_debug_parser = false
+
+##### State transition tables end #####
+
+# reduce 0 omitted
+
+def _reduce_1(val, _values, result)
+ result = RDoc::Markup::Document.new(*val[0])
+ result
+end
+
+def _reduce_2(val, _values, result)
+ raise ParseError, "file empty"
+ result
+end
+
+def _reduce_3(val, _values, result)
+ result = val[0].concat val[1]
+ result
+end
+
+def _reduce_4(val, _values, result)
+ result = val[0]
+ result
+end
+
+def _reduce_5(val, _values, result)
+ result = val
+ result
+end
+
+def _reduce_6(val, _values, result)
+ result = val
+ result
+end
+
+# reduce 7 omitted
+
+def _reduce_8(val, _values, result)
+ result = val
+ result
+end
+
+def _reduce_9(val, _values, result)
+ result = val
+ result
+end
+
+def _reduce_10(val, _values, result)
+ result = [RDoc::Markup::BlankLine.new]
+ result
+end
+
+def _reduce_11(val, _values, result)
+ result = val[0].parts
+ result
+end
+
+def _reduce_12(val, _values, result)
+ # val[0] is like [level, title]
+ title = @inline_parser.parse(val[0][1])
+ result = RDoc::Markup::Heading.new(val[0][0], title)
+
+ result
+end
+
+def _reduce_13(val, _values, result)
+ result = RDoc::Markup::Include.new val[0], @include_path
+
+ result
+end
+
+def _reduce_14(val, _values, result)
+ # val[0] is Array of String
+ result = paragraph val[0]
+
+ result
+end
+
+def _reduce_15(val, _values, result)
+ result << val[1].rstrip
+ result
+end
+
+def _reduce_16(val, _values, result)
+ result = [val[0].rstrip]
+ result
+end
+
+def _reduce_17(val, _values, result)
+ # val[1] is Array of String
+ content = cut_off val[1]
+ result = RDoc::Markup::Verbatim.new(*content)
+
+ # imform to lexer.
+ @in_verbatim = false
+
+ result
+end
+
+def _reduce_18(val, _values, result)
+ # val[0] is Array of String
+ content = cut_off val[0]
+ result = RDoc::Markup::Verbatim.new(*content)
+
+ # imform to lexer.
+ @in_verbatim = false
+
+ result
+end
+
+def _reduce_19(val, _values, result)
+ result << val[1]
+
+ result
+end
+
+def _reduce_20(val, _values, result)
+ result.concat val[2]
+
+ result
+end
+
+def _reduce_21(val, _values, result)
+ result << "\n"
+
+ result
+end
+
+def _reduce_22(val, _values, result)
+ result = val
+ # inform to lexer.
+ @in_verbatim = true
+
+ result
+end
+
+# reduce 23 omitted
+
+# reduce 24 omitted
+
+# reduce 25 omitted
+
+# reduce 26 omitted
+
+def _reduce_27(val, _values, result)
+ result = val[0]
+
+ result
+end
+
+def _reduce_28(val, _values, result)
+ result = val[1]
+
+ result
+end
+
+def _reduce_29(val, _values, result)
+ result = val[1].push(val[2])
+
+ result
+end
+
+def _reduce_30(val, _values, result)
+ result = val[0] << val[1]
+ result
+end
+
+def _reduce_31(val, _values, result)
+ result = [val[0]]
+ result
+end
+
+def _reduce_32(val, _values, result)
+ result = RDoc::Markup::List.new :BULLET, *val[0]
+
+ result
+end
+
+def _reduce_33(val, _values, result)
+ result.push(val[1])
+ result
+end
+
+def _reduce_34(val, _values, result)
+ result = val
+ result
+end
+
+def _reduce_35(val, _values, result)
+ result = RDoc::Markup::ListItem.new nil, val[0], *val[1]
+
+ result
+end
+
+def _reduce_36(val, _values, result)
+ result = RDoc::Markup::List.new :NUMBER, *val[0]
+
+ result
+end
+
+def _reduce_37(val, _values, result)
+ result.push(val[1])
+ result
+end
+
+def _reduce_38(val, _values, result)
+ result = val
+ result
+end
+
+def _reduce_39(val, _values, result)
+ result = RDoc::Markup::ListItem.new nil, val[0], *val[1]
+
+ result
+end
+
+def _reduce_40(val, _values, result)
+ result = RDoc::Markup::List.new :NOTE, *val[0]
+
+ result
+end
+
+def _reduce_41(val, _values, result)
+ result.push(val[1])
+ result
+end
+
+def _reduce_42(val, _values, result)
+ result = val
+ result
+end
+
+def _reduce_43(val, _values, result)
+ term = @inline_parser.parse val[0].strip
+
+ result = RDoc::Markup::ListItem.new term, *val[1]
+
+ result
+end
+
+def _reduce_44(val, _values, result)
+ result = RDoc::Markup::List.new :LABEL, *val[0]
+
+ result
+end
+
+def _reduce_45(val, _values, result)
+ result.push(val[1])
+ result
+end
+
+def _reduce_46(val, _values, result)
+ result = val
+ result
+end
+
+def _reduce_47(val, _values, result)
+ result = RDoc::Markup::ListItem.new "<tt>#{val[0].strip}</tt>", *val[1]
+
+ result
+end
+
+def _reduce_48(val, _values, result)
+ result = [val[1]].concat(val[2])
+
+ result
+end
+
+def _reduce_49(val, _values, result)
+ result = [val[1]]
+
+ result
+end
+
+def _reduce_50(val, _values, result)
+ result = val[2]
+
+ result
+end
+
+def _reduce_51(val, _values, result)
+ result = []
+
+ result
+end
+
+def _reduce_52(val, _values, result)
+ result.concat val[1]
+ result
+end
+
+# reduce 53 omitted
+
+def _reduce_54(val, _values, result)
+ result = val
+ result
+end
+
+def _reduce_55(val, _values, result)
+ result = val
+ result
+end
+
+# reduce 56 omitted
+
+def _reduce_57(val, _values, result)
+ result = []
+ result
+end
+
+# reduce 58 omitted
+
+# reduce 59 omitted
+
+# reduce 60 omitted
+
+# reduce 61 omitted
+
+def _reduce_62(val, _values, result)
+ result = paragraph [val[0]].concat(val[1])
+
+ result
+end
+
+def _reduce_63(val, _values, result)
+ result = paragraph [val[0]]
+
+ result
+end
+
+def _reduce_64(val, _values, result)
+ result = paragraph [val[0]].concat(val[1])
+
+ result
+end
+
+def _reduce_65(val, _values, result)
+ result = paragraph [val[0]]
+
+ result
+end
+
+def _reduce_66(val, _values, result)
+ result = [val[0]].concat(val[1])
+
+ result
+end
+
+def _reduce_67(val, _values, result)
+ result.concat val[1]
+ result
+end
+
+def _reduce_68(val, _values, result)
+ result = val[1]
+ result
+end
+
+def _reduce_69(val, _values, result)
+ result = val
+ result
+end
+
+# reduce 70 omitted
+
+def _reduce_71(val, _values, result)
+ result = []
+ result
+end
+
+def _reduce_72(val, _values, result)
+ result = []
+ result
+end
+
+def _reduce_none(val, _values, result)
+ val[0]
+end
+
+end # class BlockParser
+
+end
diff --git a/lib/rdoc/rd/inline.rb b/lib/rdoc/rd/inline.rb
new file mode 100644
index 0000000000..ee724fb80f
--- /dev/null
+++ b/lib/rdoc/rd/inline.rb
@@ -0,0 +1,71 @@
+##
+# Inline keeps track of markup and labels to create proper links.
+
+class RDoc::RD::Inline
+
+ ##
+ # The text of the reference
+
+ attr_reader :reference
+
+ ##
+ # The markup of this reference in RDoc format
+
+ attr_reader :rdoc
+
+ ##
+ # Creates a new Inline for +rdoc+ and +reference+.
+ #
+ # +rdoc+ may be another Inline or a String. If +reference+ is not given it
+ # will use the text from +rdoc+.
+
+ def self.new rdoc, reference = rdoc
+ if self === rdoc and reference.equal? rdoc then
+ rdoc
+ else
+ super
+ end
+ end
+
+ ##
+ # Initializes the Inline with +rdoc+ and +inline+
+
+ def initialize rdoc, reference # :not-new:
+ @reference = reference.equal?(rdoc) ? reference.dup : reference
+
+ # unpack
+ @reference = @reference.reference if self.class === @reference
+ @rdoc = rdoc
+ end
+
+ def == other # :nodoc:
+ self.class === other and
+ @reference == other.reference and @rdoc == other.rdoc
+ end
+
+ ##
+ # Appends +more+ to this inline. +more+ may be a String or another Inline.
+
+ def append more
+ case more
+ when String then
+ @reference << more
+ @rdoc << more
+ when RDoc::RD::Inline then
+ @reference << more.reference
+ @rdoc << more.rdoc
+ else
+ raise "unknown thingy #{more}"
+ end
+
+ self
+ end
+
+ def inspect # :nodoc:
+ "(inline: #{self})"
+ end
+
+ alias to_s rdoc # :nodoc:
+
+end
+
diff --git a/lib/rdoc/rd/inline_parser.rb b/lib/rdoc/rd/inline_parser.rb
new file mode 100644
index 0000000000..c3c1f4b030
--- /dev/null
+++ b/lib/rdoc/rd/inline_parser.rb
@@ -0,0 +1,1207 @@
+#
+# DO NOT MODIFY!!!!
+# This file is automatically generated by Racc 1.4.9
+# from Racc grammer file "".
+#
+
+require 'racc/parser.rb'
+
+require 'strscan'
+
+class RDoc::RD
+
+##
+# RD format parser for inline markup such as emphasis, links, footnotes, etc.
+
+class InlineParser < Racc::Parser
+
+
+# :stopdoc:
+
+EM_OPEN = '((*'
+EM_OPEN_RE = /\A#{Regexp.quote(EM_OPEN)}/
+EM_CLOSE = '*))'
+EM_CLOSE_RE = /\A#{Regexp.quote(EM_CLOSE)}/
+CODE_OPEN = '(({'
+CODE_OPEN_RE = /\A#{Regexp.quote(CODE_OPEN)}/
+CODE_CLOSE = '}))'
+CODE_CLOSE_RE = /\A#{Regexp.quote(CODE_CLOSE)}/
+VAR_OPEN = '((|'
+VAR_OPEN_RE = /\A#{Regexp.quote(VAR_OPEN)}/
+VAR_CLOSE = '|))'
+VAR_CLOSE_RE = /\A#{Regexp.quote(VAR_CLOSE)}/
+KBD_OPEN = '((%'
+KBD_OPEN_RE = /\A#{Regexp.quote(KBD_OPEN)}/
+KBD_CLOSE = '%))'
+KBD_CLOSE_RE = /\A#{Regexp.quote(KBD_CLOSE)}/
+INDEX_OPEN = '((:'
+INDEX_OPEN_RE = /\A#{Regexp.quote(INDEX_OPEN)}/
+INDEX_CLOSE = ':))'
+INDEX_CLOSE_RE = /\A#{Regexp.quote(INDEX_CLOSE)}/
+REF_OPEN = '((<'
+REF_OPEN_RE = /\A#{Regexp.quote(REF_OPEN)}/
+REF_CLOSE = '>))'
+REF_CLOSE_RE = /\A#{Regexp.quote(REF_CLOSE)}/
+FOOTNOTE_OPEN = '((-'
+FOOTNOTE_OPEN_RE = /\A#{Regexp.quote(FOOTNOTE_OPEN)}/
+FOOTNOTE_CLOSE = '-))'
+FOOTNOTE_CLOSE_RE = /\A#{Regexp.quote(FOOTNOTE_CLOSE)}/
+VERB_OPEN = "(('"
+VERB_OPEN_RE = /\A#{Regexp.quote(VERB_OPEN)}/
+VERB_CLOSE = "'))"
+VERB_CLOSE_RE = /\A#{Regexp.quote(VERB_CLOSE)}/
+
+BAR = "|"
+BAR_RE = /\A#{Regexp.quote(BAR)}/
+QUOTE = '"'
+QUOTE_RE = /\A#{Regexp.quote(QUOTE)}/
+SLASH = "/"
+SLASH_RE = /\A#{Regexp.quote(SLASH)}/
+BACK_SLASH = "\\"
+BACK_SLASH_RE = /\A#{Regexp.quote(BACK_SLASH)}/
+URL = "URL:"
+URL_RE = /\A#{Regexp.quote(URL)}/
+
+other_re_mode = Regexp::EXTENDED
+other_re_mode |= Regexp::MULTILINE
+
+OTHER_RE = Regexp.new(
+ "\\A.+?(?=#{Regexp.quote(EM_OPEN)}|#{Regexp.quote(EM_CLOSE)}|
+ #{Regexp.quote(CODE_OPEN)}|#{Regexp.quote(CODE_CLOSE)}|
+ #{Regexp.quote(VAR_OPEN)}|#{Regexp.quote(VAR_CLOSE)}|
+ #{Regexp.quote(KBD_OPEN)}|#{Regexp.quote(KBD_CLOSE)}|
+ #{Regexp.quote(INDEX_OPEN)}|#{Regexp.quote(INDEX_CLOSE)}|
+ #{Regexp.quote(REF_OPEN)}|#{Regexp.quote(REF_CLOSE)}|
+ #{Regexp.quote(FOOTNOTE_OPEN)}|#{Regexp.quote(FOOTNOTE_CLOSE)}|
+ #{Regexp.quote(VERB_OPEN)}|#{Regexp.quote(VERB_CLOSE)}|
+ #{Regexp.quote(BAR)}|
+ #{Regexp.quote(QUOTE)}|
+ #{Regexp.quote(SLASH)}|
+ #{Regexp.quote(BACK_SLASH)}|
+ #{Regexp.quote(URL)})", other_re_mode)
+
+# :startdoc:
+
+##
+# Creates a new parser for inline markup in the rd format. The +block_parser+
+# is used to for footnotes and labels in the inline text.
+
+def initialize block_parser
+ @block_parser = block_parser
+end
+
+##
+# Parses the +inline+ text from RD format into RDoc format.
+
+def parse inline
+ @inline = inline
+ @src = StringScanner.new inline
+ @pre = ""
+ @yydebug = true
+ do_parse.to_s
+end
+
+##
+# Returns the next token from the inline text
+
+def next_token
+ return [false, false] if @src.eos?
+# p @src.rest if @yydebug
+ if ret = @src.scan(EM_OPEN_RE)
+ @pre << ret
+ [:EM_OPEN, ret]
+ elsif ret = @src.scan(EM_CLOSE_RE)
+ @pre << ret
+ [:EM_CLOSE, ret]
+ elsif ret = @src.scan(CODE_OPEN_RE)
+ @pre << ret
+ [:CODE_OPEN, ret]
+ elsif ret = @src.scan(CODE_CLOSE_RE)
+ @pre << ret
+ [:CODE_CLOSE, ret]
+ elsif ret = @src.scan(VAR_OPEN_RE)
+ @pre << ret
+ [:VAR_OPEN, ret]
+ elsif ret = @src.scan(VAR_CLOSE_RE)
+ @pre << ret
+ [:VAR_CLOSE, ret]
+ elsif ret = @src.scan(KBD_OPEN_RE)
+ @pre << ret
+ [:KBD_OPEN, ret]
+ elsif ret = @src.scan(KBD_CLOSE_RE)
+ @pre << ret
+ [:KBD_CLOSE, ret]
+ elsif ret = @src.scan(INDEX_OPEN_RE)
+ @pre << ret
+ [:INDEX_OPEN, ret]
+ elsif ret = @src.scan(INDEX_CLOSE_RE)
+ @pre << ret
+ [:INDEX_CLOSE, ret]
+ elsif ret = @src.scan(REF_OPEN_RE)
+ @pre << ret
+ [:REF_OPEN, ret]
+ elsif ret = @src.scan(REF_CLOSE_RE)
+ @pre << ret
+ [:REF_CLOSE, ret]
+ elsif ret = @src.scan(FOOTNOTE_OPEN_RE)
+ @pre << ret
+ [:FOOTNOTE_OPEN, ret]
+ elsif ret = @src.scan(FOOTNOTE_CLOSE_RE)
+ @pre << ret
+ [:FOOTNOTE_CLOSE, ret]
+ elsif ret = @src.scan(VERB_OPEN_RE)
+ @pre << ret
+ [:VERB_OPEN, ret]
+ elsif ret = @src.scan(VERB_CLOSE_RE)
+ @pre << ret
+ [:VERB_CLOSE, ret]
+ elsif ret = @src.scan(BAR_RE)
+ @pre << ret
+ [:BAR, ret]
+ elsif ret = @src.scan(QUOTE_RE)
+ @pre << ret
+ [:QUOTE, ret]
+ elsif ret = @src.scan(SLASH_RE)
+ @pre << ret
+ [:SLASH, ret]
+ elsif ret = @src.scan(BACK_SLASH_RE)
+ @pre << ret
+ [:BACK_SLASH, ret]
+ elsif ret = @src.scan(URL_RE)
+ @pre << ret
+ [:URL, ret]
+ elsif ret = @src.scan(OTHER_RE)
+ @pre << ret
+ [:OTHER, ret]
+ else
+ ret = @src.rest
+ @pre << ret
+ @src.terminate
+ [:OTHER, ret]
+ end
+end
+
+##
+# Raises a ParseError when invalid formatting is found
+
+def on_error(et, ev, values)
+ lines_of_rest = @src.rest.lines.to_a.length
+ prev_words = prev_words_on_error(ev)
+ at = 4 + prev_words.length
+
+ message = <<-MSG
+RD syntax error: line #{@block_parser.line_index - lines_of_rest}:
+...#{prev_words} #{(ev||'')} #{next_words_on_error()} ...
+ MSG
+
+ message << " " * at + "^" * (ev ? ev.length : 0) + "\n"
+ raise ParseError, message
+end
+
+##
+# Returns words before the error
+
+def prev_words_on_error(ev)
+ pre = @pre
+ if ev and /#{Regexp.quote(ev)}$/ =~ pre
+ pre = $`
+ end
+ last_line(pre)
+end
+
+##
+# Returns the last line of +src+
+
+def last_line(src)
+ if n = src.rindex("\n")
+ src[(n+1) .. -1]
+ else
+ src
+ end
+end
+private :last_line
+
+##
+# Returns words following an error
+
+def next_words_on_error
+ if n = @src.rest.index("\n")
+ @src.rest[0 .. (n-1)]
+ else
+ @src.rest
+ end
+end
+
+##
+# Creates a new RDoc::RD::Inline for the +rdoc+ markup and the raw +reference+
+
+def inline rdoc, reference = rdoc
+ RDoc::RD::Inline.new rdoc, reference
+end
+
+# :stopdoc:
+##### State transition tables begin ###
+
+racc_action_table = [
+ 63, 64, 65, 153, 81, 62, 76, 78, 79, 87,
+ 66, 67, 68, 69, 70, 71, 72, 73, 74, 75,
+ 77, 80, 152, 63, 64, 65, 61, 81, 62, 76,
+ 78, 79, 124, 66, 67, 68, 69, 70, 71, 72,
+ 73, 74, 75, 77, 80, 149, 104, 103, 102, 100,
+ 101, 99, 115, 116, 117, 164, 105, 106, 107, 108,
+ 109, 110, 111, 112, 113, 114, 96, 118, 119, 104,
+ 103, 102, 100, 101, 99, 115, 116, 117, 89, 105,
+ 106, 107, 108, 109, 110, 111, 112, 113, 114, 88,
+ 118, 119, 104, 103, 102, 100, 101, 99, 115, 116,
+ 117, 161, 105, 106, 107, 108, 109, 110, 111, 112,
+ 113, 114, 86, 118, 119, 104, 103, 102, 100, 101,
+ 99, 115, 116, 117, 85, 105, 106, 107, 108, 109,
+ 110, 111, 112, 113, 114, 137, 118, 119, 63, 64,
+ 65, 61, 81, 62, 76, 78, 79, 84, 66, 67,
+ 68, 69, 70, 71, 72, 73, 74, 75, 77, 80,
+ 22, 23, 24, 25, 26, 21, 18, 19, 176, 177,
+ 13, 173, 14, 154, 15, 175, 16, 137, 17, 42,
+ 148, 20, 54, 38, 53, 55, 56, 57, 29, 13,
+ 177, 14, nil, 15, nil, 16, nil, 17, nil, nil,
+ 20, 22, 23, 24, 25, 26, 21, 18, 19, nil,
+ nil, 13, nil, 14, nil, 15, nil, 16, nil, 17,
+ nil, nil, 20, 22, 23, 24, 25, 26, 21, 18,
+ 19, nil, nil, 13, nil, 14, nil, 15, nil, 16,
+ nil, 17, nil, nil, 20, 22, 23, 24, 25, 26,
+ 21, 18, 19, nil, nil, 13, nil, 14, nil, 15,
+ nil, 16, nil, 17, 145, nil, 20, 54, 133, 53,
+ 55, 56, 57, nil, 13, nil, 14, nil, 15, nil,
+ 16, nil, 17, nil, nil, 20, 22, 23, 24, 25,
+ 26, 21, 18, 19, nil, nil, 13, nil, 14, nil,
+ 15, nil, 16, nil, 17, 145, nil, 20, 54, 133,
+ 53, 55, 56, 57, nil, 13, nil, 14, nil, 15,
+ nil, 16, nil, 17, nil, nil, 20, 22, 23, 24,
+ 25, 26, 21, 18, 19, nil, nil, 13, nil, 14,
+ nil, 15, nil, 16, nil, 17, 145, nil, 20, 54,
+ 133, 53, 55, 56, 57, nil, 13, nil, 14, nil,
+ 15, nil, 16, nil, 17, 145, nil, 20, 54, 133,
+ 53, 55, 56, 57, nil, 13, nil, 14, nil, 15,
+ nil, 16, nil, 17, nil, nil, 20, 22, 23, 24,
+ 25, 26, 21, 18, 19, nil, nil, 13, nil, 14,
+ nil, 15, nil, 16, 122, 17, nil, 54, 20, 53,
+ 55, 56, 57, nil, 13, nil, 14, nil, 15, nil,
+ 16, nil, 17, nil, nil, 20, 22, 23, 24, 25,
+ 26, 21, 18, 19, nil, nil, 13, nil, 14, nil,
+ 15, nil, 16, nil, 17, nil, nil, 20, 135, 136,
+ 54, 133, 53, 55, 56, 57, nil, 13, nil, 14,
+ nil, 15, nil, 16, nil, 17, nil, nil, 20, 135,
+ 136, 54, 133, 53, 55, 56, 57, nil, 13, nil,
+ 14, nil, 15, nil, 16, nil, 17, nil, nil, 20,
+ 135, 136, 54, 133, 53, 55, 56, 57, nil, 13,
+ nil, 14, nil, 15, nil, 16, nil, 17, nil, nil,
+ 20, 172, 135, 136, 54, 133, 53, 55, 56, 57,
+ 165, 135, 136, 54, 133, 53, 55, 56, 57, 95,
+ nil, nil, 54, 91, 53, 55, 56, 57, 174, 135,
+ 136, 54, 133, 53, 55, 56, 57, 158, nil, nil,
+ 54, nil, 53, 55, 56, 57, 178, 135, 136, 54,
+ 133, 53, 55, 56, 57, 145, nil, nil, 54, 133,
+ 53, 55, 56, 57, 145, nil, nil, 54, 133, 53,
+ 55, 56, 57, 135, 136, 54, 133, 53, 55, 56,
+ 57, 135, 136, 54, 133, 53, 55, 56, 57, 135,
+ 136, 54, 133, 53, 55, 56, 57, 22, 23, 24,
+ 25, 26, 21 ]
+
+racc_action_check = [
+ 61, 61, 61, 61, 61, 61, 61, 61, 61, 33,
+ 61, 61, 61, 61, 61, 61, 61, 61, 61, 61,
+ 61, 61, 61, 59, 59, 59, 59, 59, 59, 59,
+ 59, 59, 41, 59, 59, 59, 59, 59, 59, 59,
+ 59, 59, 59, 59, 59, 59, 97, 97, 97, 97,
+ 97, 97, 97, 97, 97, 125, 97, 97, 97, 97,
+ 97, 97, 97, 97, 97, 97, 37, 97, 97, 38,
+ 38, 38, 38, 38, 38, 38, 38, 38, 35, 38,
+ 38, 38, 38, 38, 38, 38, 38, 38, 38, 34,
+ 38, 38, 155, 155, 155, 155, 155, 155, 155, 155,
+ 155, 100, 155, 155, 155, 155, 155, 155, 155, 155,
+ 155, 155, 32, 155, 155, 91, 91, 91, 91, 91,
+ 91, 91, 91, 91, 31, 91, 91, 91, 91, 91,
+ 91, 91, 91, 91, 91, 43, 91, 91, 20, 20,
+ 20, 20, 20, 20, 20, 20, 20, 29, 20, 20,
+ 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
+ 17, 17, 17, 17, 17, 17, 17, 17, 165, 165,
+ 17, 162, 17, 90, 17, 164, 17, 94, 17, 18,
+ 58, 17, 18, 18, 18, 18, 18, 18, 1, 18,
+ 172, 18, nil, 18, nil, 18, nil, 18, nil, nil,
+ 18, 19, 19, 19, 19, 19, 19, 19, 19, nil,
+ nil, 19, nil, 19, nil, 19, nil, 19, nil, 19,
+ nil, nil, 19, 16, 16, 16, 16, 16, 16, 16,
+ 16, nil, nil, 16, nil, 16, nil, 16, nil, 16,
+ nil, 16, nil, nil, 16, 15, 15, 15, 15, 15,
+ 15, 15, 15, nil, nil, 15, nil, 15, nil, 15,
+ nil, 15, nil, 15, 45, nil, 15, 45, 45, 45,
+ 45, 45, 45, nil, 45, nil, 45, nil, 45, nil,
+ 45, nil, 45, nil, nil, 45, 14, 14, 14, 14,
+ 14, 14, 14, 14, nil, nil, 14, nil, 14, nil,
+ 14, nil, 14, nil, 14, 146, nil, 14, 146, 146,
+ 146, 146, 146, 146, nil, 146, nil, 146, nil, 146,
+ nil, 146, nil, 146, nil, nil, 146, 13, 13, 13,
+ 13, 13, 13, 13, 13, nil, nil, 13, nil, 13,
+ nil, 13, nil, 13, nil, 13, 138, nil, 13, 138,
+ 138, 138, 138, 138, 138, nil, 138, nil, 138, nil,
+ 138, nil, 138, nil, 138, 44, nil, 138, 44, 44,
+ 44, 44, 44, 44, nil, 44, nil, 44, nil, 44,
+ nil, 44, nil, 44, nil, nil, 44, 2, 2, 2,
+ 2, 2, 2, 2, 2, nil, nil, 2, nil, 2,
+ nil, 2, nil, 2, 39, 2, nil, 39, 2, 39,
+ 39, 39, 39, nil, 39, nil, 39, nil, 39, nil,
+ 39, nil, 39, nil, nil, 39, 0, 0, 0, 0,
+ 0, 0, 0, 0, nil, nil, 0, nil, 0, nil,
+ 0, nil, 0, nil, 0, nil, nil, 0, 122, 122,
+ 122, 122, 122, 122, 122, 122, nil, 122, nil, 122,
+ nil, 122, nil, 122, nil, 122, nil, nil, 122, 127,
+ 127, 127, 127, 127, 127, 127, 127, nil, 127, nil,
+ 127, nil, 127, nil, 127, nil, 127, nil, nil, 127,
+ 42, 42, 42, 42, 42, 42, 42, 42, nil, 42,
+ nil, 42, nil, 42, nil, 42, nil, 42, nil, nil,
+ 42, 159, 159, 159, 159, 159, 159, 159, 159, 159,
+ 126, 126, 126, 126, 126, 126, 126, 126, 126, 36,
+ nil, nil, 36, 36, 36, 36, 36, 36, 163, 163,
+ 163, 163, 163, 163, 163, 163, 163, 92, nil, nil,
+ 92, nil, 92, 92, 92, 92, 171, 171, 171, 171,
+ 171, 171, 171, 171, 171, 142, nil, nil, 142, 142,
+ 142, 142, 142, 142, 52, nil, nil, 52, 52, 52,
+ 52, 52, 52, 95, 95, 95, 95, 95, 95, 95,
+ 95, 168, 168, 168, 168, 168, 168, 168, 168, 158,
+ 158, 158, 158, 158, 158, 158, 158, 27, 27, 27,
+ 27, 27, 27 ]
+
+racc_action_pointer = [
+ 423, 188, 384, nil, nil, nil, nil, nil, nil, nil,
+ nil, nil, nil, 324, 283, 242, 220, 157, 176, 198,
+ 135, nil, nil, nil, nil, nil, nil, 604, nil, 147,
+ nil, 110, 96, -9, 69, 56, 526, 43, 66, 401,
+ nil, 28, 486, 130, 362, 261, nil, nil, nil, nil,
+ nil, nil, 571, nil, nil, nil, nil, nil, 169, 20,
+ nil, -3, nil, nil, nil, nil, nil, nil, nil, nil,
+ nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
+ nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
+ 150, 112, 544, nil, 172, 579, nil, 43, nil, nil,
+ 95, nil, nil, nil, nil, nil, nil, nil, nil, nil,
+ nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
+ nil, nil, 444, nil, nil, 52, 517, 465, nil, nil,
+ nil, nil, nil, nil, nil, nil, nil, nil, 343, nil,
+ nil, nil, 562, nil, nil, nil, 302, nil, nil, nil,
+ nil, nil, nil, nil, nil, 89, nil, nil, 595, 508,
+ nil, nil, 168, 535, 171, 164, nil, nil, 587, nil,
+ nil, 553, 185, nil, nil, nil, nil, nil, nil ]
+
+racc_action_default = [
+ -138, -138, -1, -3, -4, -5, -6, -7, -8, -9,
+ -10, -11, -12, -138, -138, -138, -138, -138, -138, -138,
+ -138, -103, -104, -105, -106, -107, -108, -111, -110, -138,
+ -2, -138, -138, -138, -138, -138, -138, -138, -138, -27,
+ -26, -35, -138, -58, -41, -40, -47, -48, -49, -50,
+ -51, -52, -63, -66, -67, -68, -69, -70, -138, -138,
+ -112, -138, -116, -117, -118, -119, -120, -121, -122, -123,
+ -124, -125, -126, -127, -128, -129, -130, -131, -132, -133,
+ -134, -135, -137, -109, 179, -13, -14, -15, -16, -17,
+ -138, -138, -23, -22, -33, -138, -19, -24, -79, -80,
+ -138, -82, -83, -84, -85, -86, -87, -88, -89, -90,
+ -91, -92, -93, -94, -95, -96, -97, -98, -99, -100,
+ -25, -35, -138, -58, -28, -138, -59, -42, -46, -55,
+ -56, -65, -71, -72, -75, -76, -77, -31, -38, -44,
+ -53, -54, -57, -61, -73, -74, -39, -62, -101, -102,
+ -136, -113, -114, -115, -18, -20, -21, -33, -138, -138,
+ -78, -81, -138, -59, -36, -37, -64, -45, -59, -43,
+ -60, -138, -34, -36, -37, -29, -30, -32, -34 ]
+
+racc_goto_table = [
+ 126, 44, 125, 43, 144, 144, 160, 93, 97, 52,
+ 166, 82, 144, 41, 40, 39, 138, 146, 169, 147,
+ 167, 94, 44, 1, 123, 129, 169, 52, 36, 37,
+ 52, 90, 59, 92, 121, 120, 31, 32, 33, 34,
+ 35, 170, 58, 166, 83, 30, 170, 166, 151, nil,
+ 150, nil, 166, 159, 8, 166, 8, nil, nil, nil,
+ nil, 155, nil, 156, 160, nil, nil, 8, 8, 8,
+ 8, 8, nil, 8, 4, nil, 4, 157, nil, nil,
+ 163, nil, 162, 52, nil, 168, nil, 4, 4, 4,
+ 4, 4, nil, 4, nil, nil, nil, nil, 144, nil,
+ nil, nil, 144, nil, nil, 129, 144, 144, nil, 5,
+ 129, 5, nil, nil, nil, nil, 171, 6, nil, 6,
+ nil, nil, 5, 5, 5, 5, 5, 11, 5, 11,
+ 6, 6, 6, 6, 6, 7, 6, 7, nil, nil,
+ 11, 11, 11, 11, 11, nil, 11, nil, 7, 7,
+ 7, 7, 7, nil, 7 ]
+
+racc_goto_check = [
+ 22, 24, 21, 23, 36, 36, 37, 18, 16, 34,
+ 35, 41, 36, 20, 19, 17, 25, 25, 28, 32,
+ 29, 23, 24, 1, 23, 24, 28, 34, 13, 15,
+ 34, 14, 38, 17, 20, 19, 1, 1, 1, 1,
+ 1, 33, 1, 35, 39, 3, 33, 35, 42, nil,
+ 41, nil, 35, 22, 8, 35, 8, nil, nil, nil,
+ nil, 16, nil, 18, 37, nil, nil, 8, 8, 8,
+ 8, 8, nil, 8, 4, nil, 4, 23, nil, nil,
+ 22, nil, 21, 34, nil, 22, nil, 4, 4, 4,
+ 4, 4, nil, 4, nil, nil, nil, nil, 36, nil,
+ nil, nil, 36, nil, nil, 24, 36, 36, nil, 5,
+ 24, 5, nil, nil, nil, nil, 22, 6, nil, 6,
+ nil, nil, 5, 5, 5, 5, 5, 11, 5, 11,
+ 6, 6, 6, 6, 6, 7, 6, 7, nil, nil,
+ 11, 11, 11, 11, 11, nil, 11, nil, 7, 7,
+ 7, 7, 7, nil, 7 ]
+
+racc_goto_pointer = [
+ nil, 23, nil, 43, 74, 109, 117, 135, 54, nil,
+ nil, 127, nil, 10, -5, 11, -30, -3, -29, -4,
+ -5, -40, -42, -15, -17, -28, nil, nil, -120, -107,
+ nil, nil, -33, -101, -9, -116, -40, -91, 12, 17,
+ nil, -9, -13 ]
+
+racc_goto_default = [
+ nil, nil, 2, 3, 46, 47, 48, 49, 50, 9,
+ 10, 51, 12, nil, nil, nil, nil, nil, nil, nil,
+ nil, nil, nil, nil, 140, nil, 45, 127, 139, 128,
+ 141, 130, 142, 143, 132, 131, 134, 98, nil, 28,
+ 27, nil, 60 ]
+
+racc_reduce_table = [
+ 0, 0, :racc_error,
+ 1, 27, :_reduce_none,
+ 2, 28, :_reduce_2,
+ 1, 28, :_reduce_3,
+ 1, 29, :_reduce_none,
+ 1, 29, :_reduce_none,
+ 1, 29, :_reduce_none,
+ 1, 29, :_reduce_none,
+ 1, 29, :_reduce_none,
+ 1, 29, :_reduce_none,
+ 1, 29, :_reduce_none,
+ 1, 29, :_reduce_none,
+ 1, 29, :_reduce_none,
+ 3, 30, :_reduce_13,
+ 3, 31, :_reduce_14,
+ 3, 32, :_reduce_15,
+ 3, 33, :_reduce_16,
+ 3, 34, :_reduce_17,
+ 4, 35, :_reduce_18,
+ 3, 35, :_reduce_19,
+ 2, 40, :_reduce_20,
+ 2, 40, :_reduce_21,
+ 1, 40, :_reduce_22,
+ 1, 40, :_reduce_23,
+ 2, 41, :_reduce_24,
+ 2, 41, :_reduce_25,
+ 1, 41, :_reduce_26,
+ 1, 41, :_reduce_27,
+ 2, 39, :_reduce_none,
+ 4, 39, :_reduce_29,
+ 4, 39, :_reduce_30,
+ 2, 43, :_reduce_31,
+ 4, 43, :_reduce_32,
+ 1, 44, :_reduce_33,
+ 3, 44, :_reduce_34,
+ 1, 45, :_reduce_none,
+ 3, 45, :_reduce_36,
+ 3, 45, :_reduce_37,
+ 2, 46, :_reduce_38,
+ 2, 46, :_reduce_39,
+ 1, 46, :_reduce_40,
+ 1, 46, :_reduce_41,
+ 1, 47, :_reduce_none,
+ 2, 51, :_reduce_43,
+ 1, 51, :_reduce_44,
+ 2, 53, :_reduce_45,
+ 1, 53, :_reduce_46,
+ 1, 50, :_reduce_none,
+ 1, 50, :_reduce_none,
+ 1, 50, :_reduce_none,
+ 1, 50, :_reduce_none,
+ 1, 50, :_reduce_none,
+ 1, 50, :_reduce_none,
+ 1, 54, :_reduce_none,
+ 1, 54, :_reduce_none,
+ 1, 55, :_reduce_none,
+ 1, 55, :_reduce_none,
+ 1, 56, :_reduce_57,
+ 1, 52, :_reduce_58,
+ 1, 57, :_reduce_59,
+ 2, 58, :_reduce_60,
+ 1, 58, :_reduce_none,
+ 2, 49, :_reduce_62,
+ 1, 49, :_reduce_none,
+ 2, 48, :_reduce_64,
+ 1, 48, :_reduce_none,
+ 1, 60, :_reduce_none,
+ 1, 60, :_reduce_none,
+ 1, 60, :_reduce_none,
+ 1, 60, :_reduce_none,
+ 1, 60, :_reduce_none,
+ 1, 62, :_reduce_none,
+ 1, 62, :_reduce_none,
+ 1, 59, :_reduce_none,
+ 1, 59, :_reduce_none,
+ 1, 61, :_reduce_none,
+ 1, 61, :_reduce_none,
+ 1, 61, :_reduce_none,
+ 2, 42, :_reduce_78,
+ 1, 42, :_reduce_none,
+ 1, 63, :_reduce_none,
+ 2, 63, :_reduce_none,
+ 1, 63, :_reduce_none,
+ 1, 63, :_reduce_none,
+ 1, 63, :_reduce_none,
+ 1, 63, :_reduce_none,
+ 1, 63, :_reduce_none,
+ 1, 63, :_reduce_none,
+ 1, 63, :_reduce_none,
+ 1, 63, :_reduce_none,
+ 1, 63, :_reduce_none,
+ 1, 63, :_reduce_none,
+ 1, 63, :_reduce_none,
+ 1, 63, :_reduce_none,
+ 1, 63, :_reduce_none,
+ 1, 63, :_reduce_none,
+ 1, 63, :_reduce_none,
+ 1, 63, :_reduce_none,
+ 1, 63, :_reduce_none,
+ 1, 63, :_reduce_none,
+ 1, 63, :_reduce_none,
+ 3, 36, :_reduce_101,
+ 3, 37, :_reduce_102,
+ 1, 65, :_reduce_none,
+ 1, 65, :_reduce_none,
+ 1, 65, :_reduce_none,
+ 1, 65, :_reduce_none,
+ 1, 65, :_reduce_none,
+ 1, 65, :_reduce_none,
+ 2, 66, :_reduce_109,
+ 1, 66, :_reduce_none,
+ 1, 38, :_reduce_111,
+ 1, 67, :_reduce_none,
+ 2, 67, :_reduce_113,
+ 2, 67, :_reduce_114,
+ 2, 67, :_reduce_115,
+ 1, 68, :_reduce_none,
+ 1, 68, :_reduce_none,
+ 1, 68, :_reduce_none,
+ 1, 68, :_reduce_none,
+ 1, 68, :_reduce_none,
+ 1, 68, :_reduce_none,
+ 1, 68, :_reduce_none,
+ 1, 68, :_reduce_none,
+ 1, 68, :_reduce_none,
+ 1, 68, :_reduce_none,
+ 1, 68, :_reduce_none,
+ 1, 68, :_reduce_none,
+ 1, 68, :_reduce_none,
+ 1, 68, :_reduce_none,
+ 1, 68, :_reduce_none,
+ 1, 68, :_reduce_none,
+ 1, 68, :_reduce_none,
+ 1, 68, :_reduce_none,
+ 1, 68, :_reduce_none,
+ 1, 68, :_reduce_none,
+ 2, 64, :_reduce_136,
+ 1, 64, :_reduce_none ]
+
+racc_reduce_n = 138
+
+racc_shift_n = 179
+
+racc_token_table = {
+ false => 0,
+ :error => 1,
+ :EX_LOW => 2,
+ :QUOTE => 3,
+ :BAR => 4,
+ :SLASH => 5,
+ :BACK_SLASH => 6,
+ :URL => 7,
+ :OTHER => 8,
+ :REF_OPEN => 9,
+ :FOOTNOTE_OPEN => 10,
+ :FOOTNOTE_CLOSE => 11,
+ :EX_HIGH => 12,
+ :EM_OPEN => 13,
+ :EM_CLOSE => 14,
+ :CODE_OPEN => 15,
+ :CODE_CLOSE => 16,
+ :VAR_OPEN => 17,
+ :VAR_CLOSE => 18,
+ :KBD_OPEN => 19,
+ :KBD_CLOSE => 20,
+ :INDEX_OPEN => 21,
+ :INDEX_CLOSE => 22,
+ :REF_CLOSE => 23,
+ :VERB_OPEN => 24,
+ :VERB_CLOSE => 25 }
+
+racc_nt_base = 26
+
+racc_use_result_var = true
+
+Racc_arg = [
+ racc_action_table,
+ racc_action_check,
+ racc_action_default,
+ racc_action_pointer,
+ racc_goto_table,
+ racc_goto_check,
+ racc_goto_default,
+ racc_goto_pointer,
+ racc_nt_base,
+ racc_reduce_table,
+ racc_token_table,
+ racc_shift_n,
+ racc_reduce_n,
+ racc_use_result_var ]
+
+Racc_token_to_s_table = [
+ "$end",
+ "error",
+ "EX_LOW",
+ "QUOTE",
+ "BAR",
+ "SLASH",
+ "BACK_SLASH",
+ "URL",
+ "OTHER",
+ "REF_OPEN",
+ "FOOTNOTE_OPEN",
+ "FOOTNOTE_CLOSE",
+ "EX_HIGH",
+ "EM_OPEN",
+ "EM_CLOSE",
+ "CODE_OPEN",
+ "CODE_CLOSE",
+ "VAR_OPEN",
+ "VAR_CLOSE",
+ "KBD_OPEN",
+ "KBD_CLOSE",
+ "INDEX_OPEN",
+ "INDEX_CLOSE",
+ "REF_CLOSE",
+ "VERB_OPEN",
+ "VERB_CLOSE",
+ "$start",
+ "content",
+ "elements",
+ "element",
+ "emphasis",
+ "code",
+ "var",
+ "keyboard",
+ "index",
+ "reference",
+ "footnote",
+ "verb",
+ "normal_str_ele",
+ "substitute",
+ "ref_label",
+ "ref_label2",
+ "ref_url_strings",
+ "filename",
+ "element_label",
+ "element_label2",
+ "ref_subst_content",
+ "ref_subst_content_q",
+ "ref_subst_strings_q",
+ "ref_subst_strings_first",
+ "ref_subst_ele2",
+ "ref_subst_eles",
+ "ref_subst_str_ele_first",
+ "ref_subst_eles_q",
+ "ref_subst_ele",
+ "ref_subst_ele_q",
+ "ref_subst_str_ele",
+ "ref_subst_str_ele_q",
+ "ref_subst_strings",
+ "ref_subst_string3",
+ "ref_subst_string",
+ "ref_subst_string_q",
+ "ref_subst_string2",
+ "ref_url_string",
+ "verb_strings",
+ "normal_string",
+ "normal_strings",
+ "verb_string",
+ "verb_normal_string" ]
+
+Racc_debug_parser = false
+
+##### State transition tables end #####
+
+# reduce 0 omitted
+
+# reduce 1 omitted
+
+def _reduce_2(val, _values, result)
+ result.append val[1]
+ result
+end
+
+def _reduce_3(val, _values, result)
+ result = val[0]
+ result
+end
+
+# reduce 4 omitted
+
+# reduce 5 omitted
+
+# reduce 6 omitted
+
+# reduce 7 omitted
+
+# reduce 8 omitted
+
+# reduce 9 omitted
+
+# reduce 10 omitted
+
+# reduce 11 omitted
+
+# reduce 12 omitted
+
+def _reduce_13(val, _values, result)
+ content = val[1]
+ result = inline "<em>#{content}</em>", content
+
+ result
+end
+
+def _reduce_14(val, _values, result)
+ content = val[1]
+ result = inline "<code>#{content}</code>", content
+
+ result
+end
+
+def _reduce_15(val, _values, result)
+ content = val[1]
+ result = inline "+#{content}+", content
+
+ result
+end
+
+def _reduce_16(val, _values, result)
+ content = val[1]
+ result = inline "<tt>#{content}</tt>", content
+
+ result
+end
+
+def _reduce_17(val, _values, result)
+ label = val[1]
+ @block_parser.add_label label.reference
+ result = "<span id=\"label-#{label}\">#{label}</span>"
+
+ result
+end
+
+def _reduce_18(val, _values, result)
+ result = "{#{val[1]}}[#{val[2].join}]"
+
+ result
+end
+
+def _reduce_19(val, _values, result)
+ scheme, inline = val[1]
+
+ result = "{#{inline}}[#{scheme}#{inline.reference}]"
+
+ result
+end
+
+def _reduce_20(val, _values, result)
+ result = [nil, inline(val[1])]
+
+ result
+end
+
+def _reduce_21(val, _values, result)
+ result = [
+ 'rdoc-label:',
+ inline("#{val[0].reference}/#{val[1].reference}")
+ ]
+
+ result
+end
+
+def _reduce_22(val, _values, result)
+ result = ['rdoc-label:', val[0].reference]
+
+ result
+end
+
+def _reduce_23(val, _values, result)
+ result = ['rdoc-label:', "#{val[0].reference}/"]
+
+ result
+end
+
+def _reduce_24(val, _values, result)
+ result = [nil, inline(val[1])]
+
+ result
+end
+
+def _reduce_25(val, _values, result)
+ result = [
+ 'rdoc-label:',
+ inline("#{val[0].reference}/#{val[1].reference}")
+ ]
+
+ result
+end
+
+def _reduce_26(val, _values, result)
+ result = ['rdoc-label:', val[0]]
+
+ result
+end
+
+def _reduce_27(val, _values, result)
+ ref = val[0].reference
+ result = ['rdoc-label:', inline(ref, "#{ref}/")]
+
+ result
+end
+
+# reduce 28 omitted
+
+def _reduce_29(val, _values, result)
+ result = val[1]
+ result
+end
+
+def _reduce_30(val, _values, result)
+ result = val[1]
+ result
+end
+
+def _reduce_31(val, _values, result)
+ result = inline val[0]
+
+ result
+end
+
+def _reduce_32(val, _values, result)
+ result = inline "\"#{val[1]}\""
+
+ result
+end
+
+def _reduce_33(val, _values, result)
+ result = inline val[0]
+
+ result
+end
+
+def _reduce_34(val, _values, result)
+ result = inline "\"#{val[1]}\""
+
+ result
+end
+
+# reduce 35 omitted
+
+def _reduce_36(val, _values, result)
+ result = val[1]
+ result
+end
+
+def _reduce_37(val, _values, result)
+ result = inline val[1]
+ result
+end
+
+def _reduce_38(val, _values, result)
+ result = val[0].append val[1]
+
+ result
+end
+
+def _reduce_39(val, _values, result)
+ result = val[0].append val[1]
+
+ result
+end
+
+def _reduce_40(val, _values, result)
+ result = val[0]
+
+ result
+end
+
+def _reduce_41(val, _values, result)
+ result = inline val[0]
+
+ result
+end
+
+# reduce 42 omitted
+
+def _reduce_43(val, _values, result)
+ result = val[0].append val[1]
+
+ result
+end
+
+def _reduce_44(val, _values, result)
+ result = inline val[0]
+
+ result
+end
+
+def _reduce_45(val, _values, result)
+ result = val[0].append val[1]
+
+ result
+end
+
+def _reduce_46(val, _values, result)
+ result = val[0]
+
+ result
+end
+
+# reduce 47 omitted
+
+# reduce 48 omitted
+
+# reduce 49 omitted
+
+# reduce 50 omitted
+
+# reduce 51 omitted
+
+# reduce 52 omitted
+
+# reduce 53 omitted
+
+# reduce 54 omitted
+
+# reduce 55 omitted
+
+# reduce 56 omitted
+
+def _reduce_57(val, _values, result)
+ result = val[0]
+
+ result
+end
+
+def _reduce_58(val, _values, result)
+ result = inline val[0]
+
+ result
+end
+
+def _reduce_59(val, _values, result)
+ result = inline val[0]
+
+ result
+end
+
+def _reduce_60(val, _values, result)
+ result << val[1]
+ result
+end
+
+# reduce 61 omitted
+
+def _reduce_62(val, _values, result)
+ result << val[1]
+
+ result
+end
+
+# reduce 63 omitted
+
+def _reduce_64(val, _values, result)
+ result << val[1]
+
+ result
+end
+
+# reduce 65 omitted
+
+# reduce 66 omitted
+
+# reduce 67 omitted
+
+# reduce 68 omitted
+
+# reduce 69 omitted
+
+# reduce 70 omitted
+
+# reduce 71 omitted
+
+# reduce 72 omitted
+
+# reduce 73 omitted
+
+# reduce 74 omitted
+
+# reduce 75 omitted
+
+# reduce 76 omitted
+
+# reduce 77 omitted
+
+def _reduce_78(val, _values, result)
+ result << val[1]
+ result
+end
+
+# reduce 79 omitted
+
+# reduce 80 omitted
+
+# reduce 81 omitted
+
+# reduce 82 omitted
+
+# reduce 83 omitted
+
+# reduce 84 omitted
+
+# reduce 85 omitted
+
+# reduce 86 omitted
+
+# reduce 87 omitted
+
+# reduce 88 omitted
+
+# reduce 89 omitted
+
+# reduce 90 omitted
+
+# reduce 91 omitted
+
+# reduce 92 omitted
+
+# reduce 93 omitted
+
+# reduce 94 omitted
+
+# reduce 95 omitted
+
+# reduce 96 omitted
+
+# reduce 97 omitted
+
+# reduce 98 omitted
+
+# reduce 99 omitted
+
+# reduce 100 omitted
+
+def _reduce_101(val, _values, result)
+ index = @block_parser.add_footnote val[1].rdoc
+ result = "{*#{index}}[rdoc-label:foottext-#{index}:footmark-#{index}]"
+
+ result
+end
+
+def _reduce_102(val, _values, result)
+ result = inline "<tt>#{val[1]}</tt>", val[1]
+
+ result
+end
+
+# reduce 103 omitted
+
+# reduce 104 omitted
+
+# reduce 105 omitted
+
+# reduce 106 omitted
+
+# reduce 107 omitted
+
+# reduce 108 omitted
+
+def _reduce_109(val, _values, result)
+ result << val[1]
+ result
+end
+
+# reduce 110 omitted
+
+def _reduce_111(val, _values, result)
+ result = inline val[0]
+
+ result
+end
+
+# reduce 112 omitted
+
+def _reduce_113(val, _values, result)
+ result = val[1]
+ result
+end
+
+def _reduce_114(val, _values, result)
+ result = val[1]
+ result
+end
+
+def _reduce_115(val, _values, result)
+ result = val[1]
+ result
+end
+
+# reduce 116 omitted
+
+# reduce 117 omitted
+
+# reduce 118 omitted
+
+# reduce 119 omitted
+
+# reduce 120 omitted
+
+# reduce 121 omitted
+
+# reduce 122 omitted
+
+# reduce 123 omitted
+
+# reduce 124 omitted
+
+# reduce 125 omitted
+
+# reduce 126 omitted
+
+# reduce 127 omitted
+
+# reduce 128 omitted
+
+# reduce 129 omitted
+
+# reduce 130 omitted
+
+# reduce 131 omitted
+
+# reduce 132 omitted
+
+# reduce 133 omitted
+
+# reduce 134 omitted
+
+# reduce 135 omitted
+
+def _reduce_136(val, _values, result)
+ result << val[1]
+ result
+end
+
+# reduce 137 omitted
+
+def _reduce_none(val, _values, result)
+ val[0]
+end
+
+end # class InlineParser
+
+end
diff --git a/lib/rdoc/rdoc.rb b/lib/rdoc/rdoc.rb
index 95ba9ae8ab..b41434ba39 100644
--- a/lib/rdoc/rdoc.rb
+++ b/lib/rdoc/rdoc.rb
@@ -1,53 +1,39 @@
require 'rdoc'
-require 'rdoc/encoding'
-require 'rdoc/parser'
-
-# Simple must come first
-require 'rdoc/parser/simple'
-require 'rdoc/parser/ruby'
-require 'rdoc/parser/c'
-
-require 'rdoc/stats'
-require 'rdoc/options'
-
require 'find'
require 'fileutils'
+require 'pathname'
require 'time'
##
-# Encapsulate the production of rdoc documentation. Basically you can use this
-# as you would invoke rdoc from the command line:
-#
-# rdoc = RDoc::RDoc.new
-# rdoc.document(args)
-#
-# Where +args+ is an array of strings, each corresponding to an argument you'd
-# give rdoc on the command line. See <tt>rdoc --help<tt> for details.
+# This is the driver for generating RDoc output. It handles file parsing and
+# generation of output.
#
-# = Plugins
+# To use this class to generate RDoc output via the API, the recommended way
+# is:
#
-# When you <tt>require 'rdoc/rdoc'</tt> RDoc looks for 'rdoc/discover' files
-# in your installed gems. This can be used to load alternate generators or
-# add additional preprocessor directives.
-#
-# You will want to wrap your plugin loading in an RDoc version check.
-# Something like:
+# rdoc = RDoc::RDoc.new
+# options = rdoc.load_options # returns an RDoc::Options instance
+# # set extra options
+# rdoc.document options
#
-# begin
-# gem 'rdoc', '~> 3'
-# require 'path/to/my/awesome/rdoc/plugin'
-# rescue Gem::LoadError
-# end
+# You can also generate output like the +rdoc+ executable:
#
-# The most obvious plugin type is a new output generator. See RDoc::Generator
-# for details.
+# rdoc = RDoc::RDoc.new
+# rdoc.document argv
#
-# You can also hook into RDoc::Markup to add new directives (:nodoc: is a
-# directive). See RDoc::Markup::PreProcess::register for details.
+# Where +argv+ is an array of strings, each corresponding to an argument you'd
+# give rdoc on the command line. See <tt>rdoc --help<tt> for details.
class RDoc::RDoc
+ @current = nil
+
+ ##
+ # This is the list of supported output generators
+
+ GENERATORS = {}
+
##
# File pattern to exclude
@@ -74,9 +60,9 @@ class RDoc::RDoc
attr_reader :stats
##
- # This is the list of supported output generators
+ # The current documentation store
- GENERATORS = {}
+ attr_reader :store
##
# Add +klass+ that can generate output after parsing
@@ -96,19 +82,11 @@ class RDoc::RDoc
##
# Sets the active RDoc::RDoc instance
- def self.current=(rdoc)
+ def self.current= rdoc
@current = rdoc
end
##
- # Resets all internal state
-
- def self.reset
- RDoc::TopLevel.reset
- RDoc::Parser::C.reset
- end
-
- ##
# Creates a new RDoc::RDoc instance. Call #document to parse files and
# generate documentation.
@@ -120,6 +98,7 @@ class RDoc::RDoc
@old_siginfo = nil
@options = nil
@stats = nil
+ @store = nil
end
##
@@ -141,15 +120,21 @@ class RDoc::RDoc
file_list = file_list.uniq
file_list = remove_unparseable file_list
+
+ file_list.sort
end
##
# Turns RDoc from stdin into HTML
def handle_pipe
- @html = RDoc::Markup::ToHtml.new
+ @html = RDoc::Markup::ToHtml.new @options
- out = @html.convert $stdin.read
+ parser = RDoc::Text::MARKUP_FORMAT[@options.markup]
+
+ document = parser.parse $stdin.read
+
+ out = @html.convert document
$stdout.write out
end
@@ -166,6 +151,33 @@ class RDoc::RDoc
end
##
+ # Loads options from .rdoc_options if the file exists, otherwise creates a
+ # new RDoc::Options instance.
+
+ def load_options
+ options_file = File.expand_path '.rdoc_options'
+ return RDoc::Options.new unless File.exist? options_file
+
+ RDoc.load_yaml
+
+ parse_error = if Object.const_defined? :Psych then
+ Psych::SyntaxError
+ else
+ ArgumentError
+ end
+
+ begin
+ options = YAML.load_file '.rdoc_options'
+ rescue *parse_error
+ end
+
+ raise RDoc::Error, "#{options_file} is not a valid rdoc options file" unless
+ RDoc::Options === options
+
+ options
+ end
+
+ ##
# Create an output dir if it doesn't exist. If it does exist, but doesn't
# contain the flag file <tt>created.rid</tt> then we refuse to use it, as
# we may clobber some manually generated documentation
@@ -205,13 +217,22 @@ option)
end unless @options.force_output
else
FileUtils.mkdir_p dir
- FileUtils.touch output_flag_file dir
+ FileUtils.touch flag_file
end
last
end
##
+ # Sets the current documentation tree to +store+ and sets the store's rdoc
+ # driver to this instance.
+
+ def store= store
+ @store = store
+ @store.rdoc = self
+ end
+
+ ##
# Update the flag file in an output directory.
def update_output_dir(op_dir, time, last = {})
@@ -268,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
@@ -291,7 +313,7 @@ option)
file_list << list_files_in_directory(rel_file_name)
end
else
- raise RDoc::Error, "I can't deal with a #{type} #{rel_file_name}"
+ warn "rdoc can't parse the #{type} #{rel_file_name}"
end
end
@@ -321,11 +343,22 @@ option)
@stats.add_file filename
+ return if RDoc::Parser.binary? filename
+
content = RDoc::Encoding.read_file filename, encoding
return unless content
- top_level = RDoc::TopLevel.new filename
+ filename_path = Pathname(filename).expand_path
+ relative_path = filename_path.relative_path_from @options.root
+
+ if @options.page_dir and
+ relative_path.to_s.start_with? @options.page_dir.to_s then
+ relative_path =
+ relative_path.relative_path_from @options.page_dir
+ end
+
+ top_level = @store.add_file filename, relative_path.to_s
parser = RDoc::Parser.for top_level, filename, content, @options, @stats
@@ -340,6 +373,14 @@ option)
top_level
+ rescue Errno::EACCES => e
+ $stderr.puts <<-EOF
+Unable to read #{filename}, #{e.message}
+
+Please check the permissions for this file. Perhaps you do not have access to
+it or perhaps the original author's permissions are to restrictive. If the
+this is not your library please report a bug to the author.
+ EOF
rescue => e
$stderr.puts <<-EOF
Before reporting this, could you check that the file you're documenting
@@ -366,7 +407,7 @@ The internal error was:
def parse_files files
file_list = gather_files files
- @stats = RDoc::Stats.new file_list.size, @options.verbosity
+ @stats = RDoc::Stats.new @store, file_list.length, @options.verbosity
return [] if file_list.empty?
@@ -385,11 +426,16 @@ The internal error was:
end
##
- # Removes file extensions known to be unparseable from +files+
+ # Removes file extensions known to be unparseable from +files+ and TAGS
+ # files for emacs and vim.
def remove_unparseable files
files.reject do |file|
- file =~ /\.(?:class|eps|erb|scpt\.txt|ttf|yml)$/i
+ file =~ /\.(?:class|eps|erb|scpt\.txt|ttf|yml)$/i or
+ (file =~ /tags$/i and
+ open(file, 'rb') { |io|
+ io.read(100) =~ /\A(\f\n[^,]+,\d+$|!_TAG_)/
+ })
end
end
@@ -408,13 +454,13 @@ The internal error was:
# current directory, so make sure you're somewhere writable before invoking.
def document options
- RDoc::RDoc.reset
+ self.store = RDoc::Store.new
if RDoc::Options === options then
@options = options
@options.finish
else
- @options = RDoc::Options.new
+ @options = load_options
@options.parse options
end
@@ -429,33 +475,41 @@ The internal error was:
@last_modified = setup_output_dir @options.op_dir, @options.force_update
end
+ @store.encoding = @options.encoding if @options.respond_to? :encoding
+ @store.dry_run = @options.dry_run
+ @store.main = @options.main_page
+ @store.title = @options.title
+ @store.path = @options.op_dir
+
@start_time = Time.now
+ @store.load_cache
+
file_info = parse_files @options.files
@options.default_title = "RDoc Documentation"
- RDoc::TopLevel.complete @options.visibility
+ @store.complete @options.visibility
@stats.coverage_level = @options.coverage_report
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
gen_klass = @options.generator
- @generator = gen_klass.new @options
+ @generator = gen_klass.new @store, @options
- generate file_info
+ generate
end
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
@@ -466,20 +520,14 @@ The internal error was:
# output dir using the generator selected
# by the RDoc options
- def generate file_info
+ def generate
Dir.chdir @options.op_dir do
- begin
- self.class.current = self
-
- unless @options.quiet then
- $stderr.puts "\nGenerating #{@generator.class.name.sub(/^.*::/, '')} format into #{Dir.pwd}..."
- end
-
- @generator.generate file_info
- update_output_dir '.', @start_time, @last_modified
- ensure
- self.class.current = nil
+ unless @options.quiet then
+ $stderr.puts "\nGenerating #{@generator.class.name.sub(/^.*::/, '')} format into #{Dir.pwd}..."
end
+
+ @generator.generate
+ update_output_dir '.', @start_time, @last_modified
end
end
diff --git a/lib/rdoc/require.rb b/lib/rdoc/require.rb
index 65d3d464da..a3d4bd18c0 100644
--- a/lib/rdoc/require.rb
+++ b/lib/rdoc/require.rb
@@ -1,5 +1,3 @@
-require 'rdoc/code_object'
-
##
# A file loaded by \#require
diff --git a/lib/rdoc/ri.rb b/lib/rdoc/ri.rb
index 17da3fbe83..8b35e0fa2f 100644
--- a/lib/rdoc/ri.rb
+++ b/lib/rdoc/ri.rb
@@ -12,7 +12,9 @@ module RDoc::RI
class Error < RDoc::Error; end
-end
+ autoload :Driver, 'rdoc/ri/driver'
+ autoload :Paths, 'rdoc/ri/paths'
+ autoload :Store, 'rdoc/ri/store'
-require 'rdoc/ri/store'
+end
diff --git a/lib/rdoc/ri/driver.rb b/lib/rdoc/ri/driver.rb
index 26304dca96..39064c1384 100644
--- a/lib/rdoc/ri/driver.rb
+++ b/lib/rdoc/ri/driver.rb
@@ -11,11 +11,7 @@ begin
rescue LoadError
end
-require 'rdoc/ri'
-require 'rdoc/ri/paths'
-require 'rdoc/markup'
-require 'rdoc/markup/formatter'
-require 'rdoc/text'
+require 'rdoc'
##
# For RubyGems backwards compatibility
@@ -61,6 +57,11 @@ class RDoc::RI::Driver
end
##
+ # Show all method documentation following a class or module
+
+ attr_accessor :show_all
+
+ ##
# An RDoc::RI::Store for each entry in the RI path
attr_accessor :stores
@@ -75,17 +76,18 @@ class RDoc::RI::Driver
def self.default_options
options = {}
- options[:use_stdout] = !$stdout.tty?
- options[:width] = 72
options[:interactive] = false
- options[:use_cache] = true
- options[:profile] = false
+ options[:profile] = false
+ options[:show_all] = false
+ options[:use_cache] = true
+ options[:use_stdout] = !$stdout.tty?
+ options[:width] = 72
# By default all standard paths are used.
- options[:use_system] = true
- options[:use_site] = true
- options[:use_home] = true
- options[:use_gems] = true
+ options[:use_system] = true
+ options[:use_site] = true
+ options[:use_home] = true
+ options[:use_gems] = true
options[:extra_doc_dirs] = []
return options
@@ -123,7 +125,11 @@ Usage: #{opt.program_name} [options] [names...]
Where name can be:
- Class | Class::method | Class#method | Class.method | method
+ Class | Module | Module::Class
+
+ Class::method | Class#method | Class.method | method
+
+ gem_name: | gem_name:README | gem_name:History
All class names may be abbreviated to their minimum unambiguous form. If a name
is ambiguous, all valid options will be listed.
@@ -131,12 +137,18 @@ is ambiguous, all valid options will be listed.
A '.' matches either class or instance methods, while #method
matches only instance and ::method matches only class methods.
+README and other files may be displayed by prefixing them with the gem name
+they're contained in. If the gem name is followed by a ':' all files in the
+gem will be shown. The file name extension may be omitted where it is
+unambiguous.
+
For example:
#{opt.program_name} Fil
#{opt.program_name} File
#{opt.program_name} File.new
#{opt.program_name} zip
+ #{opt.program_name} rdoc:README
Note that shell quoting or escaping may be required for method names containing
punctuation:
@@ -151,7 +163,10 @@ To see the default directories ri will search, run:
Specifying the --system, --site, --home, --gems or --doc-dir options will
limit ri to searching only the specified directories.
-Options may also be set in the 'RI' environment variable.
+ri options may be set in the 'RI' environment variable.
+
+The ri pager can be set with the 'RI_PAGER' environment variable or the
+'PAGER' environment variable.
EOT
opt.separator nil
@@ -159,64 +174,81 @@ Options may also be set in the 'RI' environment variable.
opt.separator nil
- formatters = RDoc::Markup.constants.grep(/^To[A-Z][a-z]+$/).sort
- formatters = formatters.sort.map do |formatter|
- formatter.to_s.sub('To', '').downcase
+ opt.on("--[no-]interactive", "-i",
+ "In interactive mode you can repeatedly",
+ "look up methods with autocomplete.") do |interactive|
+ options[:interactive] = interactive
end
- opt.on("--format=NAME", "-f",
- "Uses the selected formatter. The default",
- "formatter is bs for paged output and ansi",
- "otherwise. Valid formatters are:",
- formatters.join(' '), formatters) do |value|
- options[:formatter] = RDoc::Markup.const_get "To#{value.capitalize}"
+ opt.separator nil
+
+ opt.on("--[no-]all", "-a",
+ "Show all documentation for a class or",
+ "module.") do |show_all|
+ options[:show_all] = show_all
+ end
+
+ opt.separator nil
+
+ opt.on("--[no-]list", "-l",
+ "List classes ri knows about.") do |list|
+ options[:list] = list
end
opt.separator nil
- opt.on("--no-pager", "-T",
+ opt.on("--[no-]pager",
"Send output directly to stdout,",
- "rather than to a pager.") do
- options[:use_stdout] = true
+ "rather than to a pager.") do |use_pager|
+ options[:use_stdout] = !use_pager
end
opt.separator nil
- opt.on("--width=WIDTH", "-w", OptionParser::DecimalInteger,
- "Set the width of the output.") do |value|
- options[:width] = value
+ opt.on("-T",
+ "Synonym for --no-pager") do
+ options[:use_stdout] = true
end
opt.separator nil
- opt.on("--interactive", "-i",
- "In interactive mode you can repeatedly",
- "look up methods with autocomplete.") do
- options[:interactive] = true
+ opt.on("--width=WIDTH", "-w", OptionParser::DecimalInteger,
+ "Set the width of the output.") do |width|
+ options[:width] = width
end
opt.separator nil
- opt.on("--list", "-l",
- "List classes ri knows about.") do
- options[:list] = true
+ opt.on("--server [PORT]", Integer,
+ "Run RDoc server on the given port.",
+ "The default port is 8214.") do |port|
+ options[:server] = port || 8214
end
opt.separator nil
- opt.on("--[no-]profile",
- "Run with the ruby profiler") do |value|
- options[:profile] = value
+ formatters = RDoc::Markup.constants.grep(/^To[A-Z][a-z]+$/).sort
+ formatters = formatters.sort.map do |formatter|
+ formatter.to_s.sub('To', '').downcase
+ end
+ formatters -= %w[html label test] # remove useless output formats
+
+ opt.on("--format=NAME", "-f",
+ "Uses the selected formatter. The default",
+ "formatter is bs for paged output and ansi",
+ "otherwise. Valid formatters are:",
+ formatters.join(' '), formatters) do |value|
+ options[:formatter] = RDoc::Markup.const_get "To#{value.capitalize}"
end
opt.separator nil
opt.separator "Data source options:"
opt.separator nil
- opt.on("--list-doc-dirs",
+ opt.on("--[no-]list-doc-dirs",
"List the directories from which ri will",
- "source documentation on stdout and exit.") do
- options[:list_doc_dirs] = true
+ "source documentation on stdout and exit.") do |list_doc_dirs|
+ options[:list_doc_dirs] = list_doc_dirs
end
opt.separator nil
@@ -284,6 +316,13 @@ Options may also be set in the 'RI' environment variable.
opt.separator "Debug options:"
opt.separator nil
+ opt.on("--[no-]profile",
+ "Run with the ruby profiler") do |value|
+ options[:profile] = value
+ end
+
+ opt.separator nil
+
opt.on("--dump=CACHE", File,
"Dumps data from an ri cache or data file") do |value|
options[:dump_path] = value
@@ -356,7 +395,12 @@ Options may also be set in the 'RI' environment variable.
@list_doc_dirs = options[:list_doc_dirs]
@interactive = options[:interactive]
+ @server = options[:server]
@use_stdout = options[:use_stdout]
+ @show_all = options[:show_all]
+
+ # pager process for jruby
+ @jruby_pager_process = nil
end
##
@@ -404,47 +448,99 @@ Options may also be set in the 'RI' environment variable.
end
##
- # Adds +includes+ to +out+
+ # Adds +extends+ to +out+
- def add_includes out, includes
- return if includes.empty?
+ def add_extends out, extends
+ add_extension_modules out, 'Extended by', extends
+ end
+
+ ##
+ # Adds a list of +extensions+ to this module of the given +type+ to +out+.
+ # add_includes and add_extends call this, so you should use those directly.
+
+ def add_extension_modules out, type, extensions
+ return if extensions.empty?
out << RDoc::Markup::Rule.new(1)
- out << RDoc::Markup::Heading.new(1, "Includes:")
+ out << RDoc::Markup::Heading.new(1, "#{type}:")
- includes.each do |modules, store|
+ 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
+
+ ##
+ # Renders multiple included +modules+ from +store+ to +out+.
- wout, with = modules.partition { |incl| incl.comment.empty? }
+ def add_extension_modules_multiple out, store, modules # :nodoc:
+ out << RDoc::Markup::Paragraph.new("(from #{store.friendly_path})")
- out << RDoc::Markup::BlankLine.new unless with.empty?
+ wout, with = modules.partition { |incl| incl.comment.empty? }
- with.each do |incl|
- out << RDoc::Markup::Paragraph.new(incl.name)
- out << RDoc::Markup::BlankLine.new
- out << incl.comment
- end
+ out << RDoc::Markup::BlankLine.new unless with.empty?
- unless wout.empty? then
- verb = RDoc::Markup::Verbatim.new
+ with.each do |incl|
+ out << RDoc::Markup::Paragraph.new(incl.name)
+ out << RDoc::Markup::BlankLine.new
+ out << incl.comment
+ end
- wout.each do |incl|
- verb.push incl.name, "\n"
- end
+ unless wout.empty? then
+ verb = RDoc::Markup::Verbatim.new
- out << verb
- end
+ 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
+
+ ##
+ # Adds +includes+ to +out+
+
+ def add_includes out, includes
+ add_extension_modules out, 'Includes', includes
+ end
+
+ ##
+ # Looks up the method +name+ and adds it to +out+
+
+ def add_method out, name
+ filtered = lookup_method name
+
+ method_out = method_document name, filtered
+
+ out.concat method_out.parts
+ end
+
+ ##
+ # Adds documentation for all methods in +klass+ to +out+
+
+ def add_method_documentation out, klass
+ klass.method_list.each do |method|
+ begin
+ add_method out, method.full_name
+ rescue NotFoundError
+ next
end
end
end
@@ -458,10 +554,10 @@ Options may also be set in the 'RI' environment variable.
out << RDoc::Markup::Heading.new(1, "#{name}:")
out << RDoc::Markup::BlankLine.new
- if @use_stdout and !@interactive
- out.push(*methods.map do |method|
+ if @use_stdout and !@interactive then
+ out.concat methods.map { |method|
RDoc::Markup::Verbatim.new method
- end)
+ }
else
out << RDoc::Markup::IndentedParagraph.new(2, methods.join(', '))
end
@@ -493,8 +589,8 @@ Options may also be set in the 'RI' environment variable.
klasses = klasses - seen
- ancestors.push(*klasses)
- unexamined.push(*klasses)
+ ancestors.concat klasses
+ unexamined.concat klasses
end
ancestors.reverse
@@ -509,7 +605,7 @@ Options may also be set in the 'RI' environment variable.
##
# Builds a RDoc::Markup::Document from +found+, +klasess+ and +includes+
- def class_document name, found, klasses, includes
+ def class_document name, found, klasses, includes, extends
also_in = []
out = RDoc::Markup::Document.new
@@ -517,68 +613,59 @@ Options may also be set in the 'RI' environment variable.
add_class out, name, klasses
add_includes out, includes
+ 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
+ render_class out, store, klass, also_in
+ end
- add_from out, store
+ add_also_in out, also_in
+
+ out
+ end
- unless comment.empty? then
- out << RDoc::Markup::Rule.new(1)
+ ##
+ # Adds the class +comment+ to +out+.
- if comment.merged? then
- parts = comment.parts
- parts = parts.zip [RDoc::Markup::BlankLine.new] * parts.length
- parts.flatten!
- parts.pop
+ def class_document_comment out, comment # :nodoc:
+ unless comment.empty? then
+ out << RDoc::Markup::Rule.new(1)
- out.push(*parts)
- else
- out << comment
- end
- end
+ if comment.merged? then
+ parts = comment.parts
+ parts = parts.zip [RDoc::Markup::BlankLine.new] * parts.length
+ parts.flatten!
+ parts.pop
- if class_methods or instance_methods or not klass.constants.empty? then
- out << RDoc::Markup::Rule.new(1)
+ out.concat parts
+ else
+ out << comment
end
+ end
+ end
- unless klass.constants.empty? then
- out << RDoc::Markup::Heading.new(1, "Constants:")
- out << RDoc::Markup::BlankLine.new
- list = RDoc::Markup::List.new :NOTE
-
- constants = klass.constants.sort_by { |constant| constant.name }
+ ##
+ # Adds the constants from +klass+ to the Document +out+.
- list.push(*constants.map do |constant|
- parts = constant.comment.parts if constant.comment
- parts << RDoc::Markup::Paragraph.new('[not documented]') if
- parts.empty?
+ def class_document_constants out, klass # :nodoc:
+ return if klass.constants.empty?
- RDoc::Markup::ListItem.new(constant.name, *parts)
- end)
+ out << RDoc::Markup::Heading.new(1, "Constants:")
+ out << RDoc::Markup::BlankLine.new
+ list = RDoc::Markup::List.new :NOTE
- out << list
- out << RDoc::Markup::BlankLine.new
- end
+ constants = klass.constants.sort_by { |constant| constant.name }
- add_method_list out, class_methods, 'Class methods'
- add_method_list out, instance_methods, 'Instance methods'
- add_method_list out, attributes, 'Attributes'
- 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
##
@@ -601,42 +688,53 @@ Options may also be set in the 'RI' environment variable.
end
##
- # Returns the stores wherin +name+ is found along with the classes and
- # includes that match it
+ # Returns the stores wherein +name+ is found along with the classes,
+ # extends and includes that match it
- def classes_and_includes_for name
+ def classes_and_includes_and_extends_for name
klasses = []
+ extends = []
includes = []
found = @stores.map do |store|
begin
klass = store.load_class name
klasses << klass
+ extends << [klass.extends, store] if klass.extends
includes << [klass.includes, store] if klass.includes
[store, klass]
- rescue Errno::ENOENT
+ rescue RDoc::Store::MissingFileError
end
end.compact
+ extends.reject! do |modules,| modules.empty? end
includes.reject! do |modules,| modules.empty? end
- [found, klasses, includes]
+ [found, klasses, includes, extends]
end
##
# 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 =~ /::$/
@@ -646,7 +744,9 @@ Options may also be set in the 'RI' environment variable.
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
@@ -659,10 +759,8 @@ Options may also be set in the 'RI' environment variable.
completions << "#{klass}#{selector}"
end
- completions.push(*methods)
+ completions.concat methods
end
-
- completions.sort.uniq
end
##
@@ -682,11 +780,12 @@ Options may also be set in the 'RI' environment variable.
def display_class name
return if name =~ /#|\./
- found, klasses, includes = classes_and_includes_for name
+ found, klasses, includes, extends =
+ classes_and_includes_and_extends_for name
return if found.empty?
- out = class_document name, found, klasses, includes
+ out = class_document name, found, klasses, includes, extends
display out
end
@@ -695,13 +794,9 @@ Options may also be set in the 'RI' environment variable.
# Outputs formatted RI data for method +name+
def display_method name
- found = load_methods_matching name
-
- raise NotFoundError, name if found.empty?
-
- filtered = filter_methods found, name
+ out = RDoc::Markup::Document.new
- out = method_document name, filtered
+ add_method out, name
display out
end
@@ -713,6 +808,11 @@ Options may also be set in the 'RI' environment variable.
# be guessed, raises an error if +name+ couldn't be guessed.
def display_name name
+ if name =~ /\w:(\w|$)/ then
+ display_page name
+ return true
+ end
+
return true if display_class name
display_method name if name =~ /::|#|\./
@@ -720,14 +820,14 @@ Options may also be set in the 'RI' environment variable.
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?
page do |io|
io.puts "#{name} not found, maybe you meant:"
io.puts
- io.puts matches.join("\n")
+ io.puts matches.sort.join("\n")
end
false
@@ -745,6 +845,63 @@ Options may also be set in the 'RI' environment variable.
end
##
+ # Outputs formatted RI data for page +name+.
+
+ def display_page name
+ store_name, page_name = name.split ':', 2
+
+ store = @stores.find { |s| s.source == store_name }
+
+ return display_page_list store if page_name.empty?
+
+ pages = store.cache[:pages]
+
+ unless pages.include? page_name then
+ found_names = pages.select do |n|
+ n =~ /#{Regexp.escape page_name}\.[^.]+$/
+ end
+
+ if found_names.length.zero? then
+ return display_page_list store, pages
+ elsif found_names.length > 1 then
+ return display_page_list store, found_names, page_name
+ end
+
+ page_name = found_names.first
+ end
+
+ page = store.load_page page_name
+
+ display page.comment
+ end
+
+ ##
+ # Outputs a formatted RI page list for the pages in +store+.
+
+ def display_page_list store, pages = store.cache[:pages], search = nil
+ out = RDoc::Markup::Document.new
+
+ title = if search then
+ "#{search} pages"
+ else
+ 'Pages'
+ end
+
+ out << RDoc::Markup::Heading.new(1, "#{title} in #{store.friendly_path}")
+ out << RDoc::Markup::BlankLine.new
+
+ list = RDoc::Markup::List.new(:BULLET)
+
+ pages.each do |page|
+ list << RDoc::Markup::Paragraph.new(page)
+ end
+
+ out << list
+
+ display out
+ end
+
+ ##
# Expands abbreviated klass +klass+ into a fully-qualified class. "Zl::Da"
# will be expanded to Zlib::DataError.
@@ -776,7 +933,12 @@ Options may also be set in the 'RI' environment variable.
return [selector, method].join if klass.empty?
- "#{expand_class klass}#{selector}#{method}"
+ case selector
+ when ':' then
+ [find_store(klass), selector, method]
+ else
+ [expand_class(klass), selector, method]
+ end.join
end
##
@@ -841,6 +1003,55 @@ Options may also be set in the 'RI' environment variable.
end
##
+ # Finds the given +pager+ for jruby. Returns an IO if +pager+ was found.
+ #
+ # Returns false if +pager+ does not exist.
+ #
+ # Returns nil if the jruby JVM doesn't support ProcessBuilder redirection
+ # (1.6 and older).
+
+ def find_pager_jruby pager
+ require 'java'
+ require 'shellwords'
+
+ return nil unless java.lang.ProcessBuilder.constants.include? :Redirect
+
+ pager = Shellwords.split pager
+
+ pb = java.lang.ProcessBuilder.new(*pager)
+ pb = pb.redirect_output java.lang.ProcessBuilder::Redirect::INHERIT
+
+ @jruby_pager_process = pb.start
+
+ input = @jruby_pager_process.output_stream
+
+ io = input.to_io
+ io.sync = true
+ io
+ rescue java.io.IOException
+ false
+ end
+
+ ##
+ # Finds a store that matches +name+ which can be the name of a gem, "ruby",
+ # "home" or "site".
+ #
+ # See also RDoc::Store#source
+
+ def find_store name
+ @stores.each do |store|
+ source = store.source
+
+ return source if source == name
+
+ return source if
+ store.type == :gem and source =~ /^#{Regexp.escape name}-\d/
+ end
+
+ raise RDoc::RI::Driver::NotFoundError, name
+ end
+
+ ##
# Creates a new RDoc::Markup::Formatter. If a formatter is given with -f,
# use it. If we're outputting to a pager, use bs, otherwise ansi.
@@ -909,7 +1120,7 @@ Options may also be set in the 'RI' environment variable.
classes = []
stores.each do |store|
- classes << store.modules
+ classes << store.module_names
end
classes = classes.flatten.uniq.sort
@@ -951,7 +1162,7 @@ Options may also be set in the 'RI' environment variable.
"#{klass}##{match}"
end
- found.push(*matches)
+ found.concat matches
end
end
@@ -965,7 +1176,7 @@ Options may also be set in the 'RI' environment variable.
"#{klass}::#{match}"
end
- found.push(*matches)
+ found.concat matches
end
end
@@ -988,6 +1199,12 @@ Options may also be set in the 'RI' environment variable.
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
##
@@ -1012,7 +1229,18 @@ Options may also be set in the 'RI' environment variable.
end
##
- # Builds a RDoc::Markup::Document from +found+, +klasess+ and +includes+
+ # Returns a filtered list of methods matching +name+
+
+ def lookup_method name
+ found = load_methods_matching name
+
+ raise NotFoundError, name if found.empty?
+
+ filter_methods found, name
+ end
+
+ ##
+ # Builds a RDoc::Markup::Document from +found+, +klasses+ and +includes+
def method_document name, filtered
out = RDoc::Markup::Document.new
@@ -1022,23 +1250,7 @@ Options may also be set in the 'RI' environment variable.
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
-
- out << RDoc::Markup::BlankLine.new
- out << method.comment
- out << RDoc::Markup::BlankLine.new
+ render_method out, store, method, name
end
end
@@ -1080,6 +1292,7 @@ Options may also be set in the 'RI' environment variable.
yield pager
ensure
pager.close
+ @jruby_pager_process.wait_for if @jruby_pager_process
end
else
yield $stdout
@@ -1101,10 +1314,10 @@ Options may also be set in the 'RI' environment variable.
# Foo::Bar#baz.
#
# NOTE: Given Foo::Bar, Bar is considered a class even though it may be a
- # method
+ # method
def parse_name name
- parts = name.split(/(::|#|\.)/)
+ parts = name.split(/(::?|#|\.)/)
if parts.length == 1 then
if parts.first =~ /^[a-z]|^([%&*+\/<>^`|~-]|\+@|-@|<<|<=>?|===?|=>|=~|>>|\[\]=?|~@)$/ then
@@ -1117,17 +1330,93 @@ Options may also be set in the 'RI' environment variable.
elsif parts.length == 2 or parts.last =~ /::|#|\./ then
type = parts.pop
meth = nil
+ elsif parts[1] == ':' then
+ klass = parts.shift
+ type = parts.shift
+ meth = parts.join
elsif parts[-2] != '::' or parts.last !~ /^[A-Z]/ then
meth = parts.pop
type = parts.pop
end
- klass = parts.join
+ klass ||= parts.join
[klass, type, meth]
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
@@ -1135,6 +1424,8 @@ Options may also be set in the 'RI' environment variable.
puts @doc_dirs
elsif @list then
list_known_classes @names
+ elsif @server then
+ start_server
elsif @interactive or @names.empty? then
interactive
else
@@ -1151,6 +1442,8 @@ Options may also be set in the 'RI' environment variable.
def setup_pager
return if @use_stdout
+ jruby = Object.const_defined?(:RUBY_ENGINE) && RUBY_ENGINE == 'jruby'
+
pagers = [ENV['RI_PAGER'], ENV['PAGER'], 'pager', 'less', 'more']
pagers.compact.uniq.each do |pager|
@@ -1160,9 +1453,17 @@ Options may also be set in the 'RI' environment variable.
next unless in_path? pager_cmd
- io = IO.popen(pager, 'w') rescue next
+ if jruby then
+ case io = find_pager_jruby(pager)
+ when nil then break
+ when false then next
+ else io
+ end
+ else
+ io = IO.popen(pager, 'w') rescue next
+ end
- next if $? and $?.exited? # pager didn't work
+ next if $? and $?.pid == io.pid and $?.exited? # pager didn't work
@paging = true
@@ -1174,5 +1475,23 @@ Options may also be set in the 'RI' environment variable.
nil
end
+ ##
+ # Starts a WEBrick server for ri.
+
+ def start_server
+ require 'webrick'
+
+ server = WEBrick::HTTPServer.new :Port => @server
+
+ 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
+
+ server.start
+ end
+
end
diff --git a/lib/rdoc/ri/paths.rb b/lib/rdoc/ri/paths.rb
index a3c65bf928..970cb91461 100644
--- a/lib/rdoc/ri/paths.rb
+++ b/lib/rdoc/ri/paths.rb
@@ -1,7 +1,8 @@
require 'rdoc/ri'
##
-# The directories where ri data lives.
+# The directories where ri data lives. Paths can be enumerated via ::each, or
+# queried individually via ::system_dir, ::site_dir, ::home_dir and ::gem_dir.
module RDoc::RI::Paths
@@ -10,15 +11,12 @@ module RDoc::RI::Paths
version = RbConfig::CONFIG['ruby_version']
- base = if RbConfig::CONFIG.key? 'ridir' then
+ BASE = if RbConfig::CONFIG.key? 'ridir' then
File.join RbConfig::CONFIG['ridir'], version
else
File.join RbConfig::CONFIG['datadir'], 'ri', version
end
- SYSDIR = File.join base, "system"
- SITEDIR = File.join base, "site"
-
homedir = begin
File.expand_path('~')
rescue ArgumentError
@@ -32,8 +30,6 @@ module RDoc::RI::Paths
end
#:startdoc:
- @gemdirs = nil
-
##
# Iterates over each selected path yielding the directory and type.
#
@@ -47,16 +43,19 @@ module RDoc::RI::Paths
# :extra:: ri data directory from the command line. Yielded for each
# entry in +extra_dirs+
- def self.each system, site, home, gems, *extra_dirs # :yields: directory, type
+ def self.each system = true, site = true, home = true, gems = :latest, *extra_dirs # :yields: directory, type
+ return enum_for __method__, system, site, home, gems, *extra_dirs unless
+ block_given?
+
extra_dirs.each do |dir|
yield dir, :extra
end
- yield SYSDIR, :system if system
- yield SITEDIR, :site if site
- yield HOMEDIR, :home if home and HOMEDIR
+ yield system_dir, :system if system
+ yield site_dir, :site if site
+ yield home_dir, :home if home and HOMEDIR
- gemdirs.each do |dir|
+ gemdirs(gems).each do |dir|
yield dir, :gem
end if gems
@@ -64,36 +63,72 @@ module RDoc::RI::Paths
end
##
- # The latest installed gems' ri directories
+ # The ri directory for the gem with +gem_name+.
- def self.gemdirs
- return @gemdirs if @gemdirs
+ def self.gem_dir name, version
+ req = Gem::Requirement.new "= #{version}"
- require 'rubygems' unless defined?(Gem)
+ spec = Gem::Specification.find_by_name name, req
- # HACK dup'd from Gem.latest_partials and friends
- all_paths = []
+ File.join spec.doc_dir, 'ri'
+ end
- all_paths = Gem.path.map do |dir|
- Dir[File.join(dir, 'doc', '*', 'ri')]
- end.flatten
+ ##
+ # The latest installed gems' ri directories. +filter+ can be :all or
+ # :latest.
+ #
+ # A +filter+ :all includes all versions of gems and includes gems without
+ # ri documentation.
+
+ def self.gemdirs filter = :latest
+ require 'rubygems' unless defined?(Gem)
ri_paths = {}
- all_paths.each do |dir|
- base = File.basename File.dirname(dir)
- if base =~ /(.*)-((\d+\.)*\d+)/ then
- name, version = $1, $2
- ver = Gem::Version.new version
- if ri_paths[name].nil? or ver > ri_paths[name][0] then
- ri_paths[name] = [ver, dir]
+ all = Gem::Specification.map do |spec|
+ [File.join(spec.doc_dir, 'ri'), spec.name, spec.version]
+ end
+
+ if filter == :all then
+ gemdirs = []
+
+ all.group_by do |_, name, _|
+ name
+ end.sort_by do |group, _|
+ group
+ end.map do |group, items|
+ items.sort_by do |_, _, version|
+ version
+ end.reverse_each do |dir,|
+ gemdirs << dir
end
end
+
+ return gemdirs
+ end
+
+ all.each do |dir, name, ver|
+ next unless File.exist? dir
+
+ if ri_paths[name].nil? or ver > ri_paths[name].first then
+ ri_paths[name] = [ver, name, dir]
+ end
end
- @gemdirs = ri_paths.map { |k,v| v.last }.sort
+ ri_paths.sort_by { |_, (_, name, _)| name }.map { |k, v| v.last }
rescue LoadError
- @gemdirs = []
+ []
+ end
+
+ ##
+ # The location of the rdoc data in the user's home directory.
+ #
+ # Like ::system, ri data in the user's home directory is rare and predates
+ # libraries distributed via RubyGems. ri data is rarely generated into this
+ # directory.
+
+ def self.home_dir
+ HOMEDIR
end
##
@@ -102,7 +137,7 @@ module RDoc::RI::Paths
#
# See also ::each
- def self.path(system, site, home, gems, *extra_dirs)
+ def self.path(system = true, site = true, home = true, gems = :latest, *extra_dirs)
path = raw_path system, site, home, gems, *extra_dirs
path.select { |directory| File.directory? directory }
@@ -124,5 +159,29 @@ module RDoc::RI::Paths
path.compact
end
+ ##
+ # The location of ri data installed into the site dir.
+ #
+ # Historically this was available for documentation installed by Ruby
+ # libraries predating RubyGems. It is unlikely to contain any content for
+ # modern Ruby installations.
+
+ def self.site_dir
+ File.join BASE, 'site'
+ end
+
+ ##
+ # 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
+ # 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.
+
+ def self.system_dir
+ File.join BASE, 'system'
+ end
+
end
diff --git a/lib/rdoc/ri/store.rb b/lib/rdoc/ri/store.rb
index fe4ccc244d..9fa9bbb03c 100644
--- a/lib/rdoc/ri/store.rb
+++ b/lib/rdoc/ri/store.rb
@@ -1,358 +1,6 @@
-require 'rdoc/code_objects'
-require 'fileutils'
+module RDoc::RI
-##
-# A set of ri data.
-#
-# The store manages reading and writing ri data for a project (gem, path,
-# etc.) and maintains a cache of methods, classes and ancestors in the
-# store.
-#
-# The store maintains a #cache of its contents for faster lookup. After
-# adding items to the store it must be flushed using #save_cache. The cache
-# contains the following structures:
-#
-# @cache = {
-# :class_methods => {}, # class name => class methods
-# :instance_methods => {}, # class name => instance methods
-# :attributes => {}, # class name => attributes
-# :modules => [], # classes and modules in this store
-# :ancestors => {}, # class name => ancestor names
-# }
-#--
-# TODO need to store the list of files and prune classes
-
-class RDoc::RI::Store
-
- ##
- # If true this Store will not write any files
-
- attr_accessor :dry_run
-
- ##
- # Path this store reads or writes
-
- attr_accessor :path
-
- ##
- # Type of ri datastore this was loaded from. See RDoc::RI::Driver,
- # RDoc::RI::Paths.
-
- attr_accessor :type
-
- ##
- # The contents of the Store
-
- attr_reader :cache
-
- ##
- # The encoding of the contents in the Store
-
- attr_accessor :encoding
-
- ##
- # Creates a new Store of +type+ that will load or save to +path+
-
- def initialize path, type = nil
- @dry_run = false
- @type = type
- @path = path
- @encoding = nil
-
- @cache = {
- :ancestors => {},
- :attributes => {},
- :class_methods => {},
- :encoding => @encoding,
- :instance_methods => {},
- :modules => [],
- }
- end
-
- ##
- # Ancestors cache accessor. Maps a klass name to an Array of its ancestors
- # in this store. If Foo in this store inherits from Object, Kernel won't be
- # listed (it will be included from ruby's ri store).
-
- def ancestors
- @cache[:ancestors]
- end
-
- ##
- # Attributes cache accessor. Maps a class to an Array of its attributes.
-
- def attributes
- @cache[:attributes]
- end
-
- ##
- # Path to the cache file
-
- def cache_path
- File.join @path, 'cache.ri'
- end
-
- ##
- # Path to the ri data for +klass_name+
-
- def class_file klass_name
- name = klass_name.split('::').last
- File.join class_path(klass_name), "cdesc-#{name}.ri"
- end
-
- ##
- # Class methods cache accessor. Maps a class to an Array of its class
- # methods (not full name).
-
- def class_methods
- @cache[:class_methods]
- end
-
- ##
- # Path where data for +klass_name+ will be stored (methods or class data)
-
- def class_path klass_name
- File.join @path, *klass_name.split('::')
- end
-
- ##
- # Removes empty items and ensures item in each collection are unique and
- # sorted
-
- def clean_cache_collection collection # :nodoc:
- collection.each do |name, item|
- if item.empty? then
- collection.delete name
- else
- # HACK mongrel-1.1.5 documents its files twice
- item.uniq!
- item.sort!
- end
- end
- end
-
- ##
- # Friendly rendition of #path
-
- def friendly_path
- case type
- when :gem then
- sep = Regexp.union(*['/', File::ALT_SEPARATOR].compact)
- @path =~ /#{sep}doc#{sep}(.*?)#{sep}ri$/
- "gem #{$1}"
- when :home then '~/.ri'
- when :site then 'ruby site'
- when :system then 'ruby core'
- else @path
- end
- end
-
- def inspect # :nodoc:
- "#<%s:0x%x %s %p>" % [self.class, object_id, @path, modules.sort]
- end
-
- ##
- # Instance methods cache accessor. Maps a class to an Array of its
- # instance methods (not full name).
-
- def instance_methods
- @cache[:instance_methods]
- end
-
- ##
- # Loads cache file for this store
-
- def load_cache
- #orig_enc = @encoding
-
- open cache_path, 'rb' do |io|
- @cache = Marshal.load io.read
- end
-
- load_enc = @cache[:encoding]
-
- # TODO this feature will be time-consuming to add:
- # a) Encodings may be incompatible but transcodeable
- # b) Need to warn in the appropriate spots, wherever they may be
- # c) Need to handle cross-cache differences in encodings
- # d) Need to warn when generating into a cache with diffent encodings
- #
- #if orig_enc and load_enc != orig_enc then
- # warn "Cached encoding #{load_enc} is incompatible with #{orig_enc}\n" \
- # "from #{path}/cache.ri" unless
- # Encoding.compatible? orig_enc, load_enc
- #end
-
- @encoding = load_enc unless @encoding
-
- @cache
- rescue Errno::ENOENT
- end
-
- ##
- # Loads ri data for +klass_name+
-
- def load_class klass_name
- open class_file(klass_name), 'rb' do |io|
- Marshal.load io.read
- end
- end
-
- ##
- # Loads ri data for +method_name+ in +klass_name+
-
- def load_method klass_name, method_name
- open method_file(klass_name, method_name), 'rb' do |io|
- Marshal.load io.read
- end
- end
-
- ##
- # Path to the ri data for +method_name+ in +klass_name+
-
- def method_file klass_name, method_name
- method_name = method_name.split('::').last
- method_name =~ /#(.*)/
- method_type = $1 ? 'i' : 'c'
- method_name = $1 if $1
-
- method_name = if ''.respond_to? :ord then
- method_name.gsub(/\W/) { "%%%02x" % $&[0].ord }
- else
- method_name.gsub(/\W/) { "%%%02x" % $&[0] }
- end
-
- File.join class_path(klass_name), "#{method_name}-#{method_type}.ri"
- end
-
- ##
- # Modules cache accessor. An Array of all the modules (and classes) in the
- # store.
-
- def modules
- @cache[:modules]
- end
-
- ##
- # Writes the cache file for this store
-
- def save_cache
- clean_cache_collection @cache[:ancestors]
- clean_cache_collection @cache[:attributes]
- clean_cache_collection @cache[:class_methods]
- clean_cache_collection @cache[:instance_methods]
-
- @cache[:modules].uniq!
- @cache[:modules].sort!
- @cache[:encoding] = @encoding # this gets set twice due to assert_cache
-
- return if @dry_run
-
- marshal = Marshal.dump @cache
-
- open cache_path, 'wb' do |io|
- io.write marshal
- end
- end
-
- ##
- # Writes the ri data for +klass+
-
- def save_class klass
- full_name = klass.full_name
-
- FileUtils.mkdir_p class_path(full_name) unless @dry_run
-
- @cache[:modules] << full_name
-
- path = class_file full_name
-
- begin
- disk_klass = load_class full_name
-
- klass = disk_klass.merge klass
- rescue Errno::ENOENT
- end
-
- # BasicObject has no ancestors
- ancestors = klass.ancestors.compact.map do |ancestor|
- # HACK for classes we don't know about (class X < RuntimeError)
- String === ancestor ? ancestor : ancestor.full_name
- end
-
- @cache[:ancestors][full_name] ||= []
- @cache[:ancestors][full_name].push(*ancestors)
-
- attributes = klass.attributes.map do |attribute|
- "#{attribute.definition} #{attribute.name}"
- end
-
- unless attributes.empty? then
- @cache[:attributes][full_name] ||= []
- @cache[:attributes][full_name].push(*attributes)
- end
-
- to_delete = []
-
- unless klass.method_list.empty? then
- @cache[:class_methods][full_name] ||= []
- @cache[:instance_methods][full_name] ||= []
-
- class_methods, instance_methods =
- klass.method_list.partition { |meth| meth.singleton }
-
- class_methods = class_methods. map { |method| method.name }
- instance_methods = instance_methods.map { |method| method.name }
-
- old = @cache[:class_methods][full_name] - class_methods
- to_delete.concat old.map { |method|
- method_file full_name, "#{full_name}::#{method}"
- }
-
- old = @cache[:instance_methods][full_name] - instance_methods
- to_delete.concat old.map { |method|
- method_file full_name, "#{full_name}##{method}"
- }
-
- @cache[:class_methods][full_name] = class_methods
- @cache[:instance_methods][full_name] = instance_methods
- end
-
- return if @dry_run
-
- FileUtils.rm_f to_delete
-
- marshal = Marshal.dump klass
-
- open path, 'wb' do |io|
- io.write marshal
- end
- end
-
- ##
- # Writes the ri data for +method+ on +klass+
-
- def save_method klass, method
- full_name = klass.full_name
-
- FileUtils.mkdir_p class_path(full_name) unless @dry_run
-
- cache = if method.singleton then
- @cache[:class_methods]
- else
- @cache[:instance_methods]
- end
- cache[full_name] ||= []
- cache[full_name] << method.name
-
- return if @dry_run
-
- marshal = Marshal.dump method
-
- open method_file(full_name, method.full_name), 'wb' do |io|
- io.write marshal
- end
- end
+ Store = RDoc::Store # :nodoc:
end
diff --git a/lib/rdoc/ruby_lex.rb b/lib/rdoc/ruby_lex.rb
index 4392cea9cf..d470d2b5f8 100644
--- a/lib/rdoc/ruby_lex.rb
+++ b/lib/rdoc/ruby_lex.rb
@@ -11,7 +11,6 @@
require "e2mmap"
require "irb/slex"
-require "rdoc/ruby_token"
require "stringio"
##
@@ -21,6 +20,12 @@ require "stringio"
class RDoc::RubyLex
+ ##
+ # Raised upon invalid input
+
+ class Error < RDoc::Error
+ end
+
# :stopdoc:
extend Exception2MessageMapper
@@ -37,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
@@ -51,6 +56,29 @@ class RDoc::RubyLex
self.debug_level = 0
+ # :startdoc:
+
+ ##
+ # Returns an Array of +ruby+ tokens. See ::new for a description of
+ # +options+.
+
+ def self.tokenize ruby, options
+ tokens = []
+
+ scanner = RDoc::RubyLex.new ruby, options
+ scanner.exception_on_syntax_error = true
+
+ while token = scanner.token do
+ tokens << token
+ end
+
+ tokens
+ end
+
+ ##
+ # Creates a new lexer for +content+. +options+ is an RDoc::Options, only
+ # +tab_width is used.
+
def initialize(content, options)
lex_init
@@ -79,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
@@ -91,8 +119,11 @@ class RDoc::RubyLex
@prompt = nil
@prev_seek = nil
+ @ltype = nil
end
+ # :stopdoc:
+
def inspect # :nodoc:
"#<%s:0x%x pos %d lex_state %p space_seen %p>" % [
self.class, object_id,
@@ -122,8 +153,8 @@ class RDoc::RubyLex
end
def get_readed
- if idx = @readed.reverse.index("\n")
- @base_char_no = idx
+ if idx = @readed.rindex("\n")
+ @base_char_no = @readed.size - (idx + 1)
else
@base_char_no += @readed.size
end
@@ -188,8 +219,8 @@ class RDoc::RubyLex
@seek -= 1
if c == "\n"
@line_no -= 1
- if idx = @readed.reverse.index("\n")
- @char_no = @readed.size - idx
+ if idx = @readed.rindex("\n")
+ @char_no = idx + 1
else
@char_no = @base_char_no + @readed.size
end
@@ -249,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
@@ -323,7 +354,7 @@ class RDoc::RubyLex
tk = @OP.match(self)
@space_seen = tk.kind_of?(TkSPACE)
rescue SyntaxError => e
- raise RDoc::Error, "syntax error: #{e.message}" if
+ raise Error, "syntax error: #{e.message}" if
@exception_on_syntax_error
tk = TkError.new(@seek, @line_no, @char_no)
@@ -381,7 +412,7 @@ class RDoc::RubyLex
def lex_init()
@OP = IRB::SLex.new
@OP.def_rules("\0", "\004", "\032") do |op, io|
- Token(TkEND_OF_SCRIPT)
+ Token(TkEND_OF_SCRIPT, '')
end
@OP.def_rules(" ", "\t", "\f", "\r", "\13") do |op, io|
@@ -413,17 +444,17 @@ class RDoc::RubyLex
gets # consume =end
@ltype = nil
- Token(TkCOMMENT, res)
+ Token(TkRD_COMMENT, res)
end
@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))
@@ -442,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
@@ -469,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
@@ -485,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)
@@ -495,66 +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
- str = ch
- if ch == '\\'
- str << read_escape
- end
- @lex_state = EXPR_END
- str << (ch.respond_to?(:ord) ? ch.ord : ch[0])
- Token(TkINTEGER, str)
+ @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
@@ -562,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
@@ -585,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)
@@ -593,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
@@ -605,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))
@@ -660,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)
@@ -718,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
@@ -742,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
@@ -773,16 +799,17 @@ 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
- Token(TkEND_OF_SCRIPT)
+ if peek_match?(/_END__/) and @lex_state == :EXPR_BEG then
+ 6.times { getc }
+ Token(TkEND_OF_SCRIPT, '__END__')
else
ungetc
identify_identifier
@@ -805,7 +832,7 @@ class RDoc::RubyLex
end
def identify_gvar
- @lex_state = EXPR_END
+ @lex_state = :EXPR_END
case ch = getc
when /[~_*$?!@\/\\;,=:<>".]/ #"
@@ -830,7 +857,7 @@ class RDoc::RubyLex
end
IDENT_RE = if defined? Encoding then
- /[\w\u0080-\uFFFF]/u
+ eval '/[\w\u{0080}-\u{FFFFF}]/u' # 1.8 can't parse \u{}
else
/[\w\x80-\xFF]/
end
@@ -861,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|::)/)
@@ -898,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)
@@ -909,6 +938,8 @@ class RDoc::RubyLex
@indent += 1
@indent_stack.push token_c
end
+ else
+ token_c = TkIDENTIFIER
end
elsif DEINDENT_CLAUSE.include?(token)
@@ -917,22 +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
+ 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]/
@@ -952,12 +984,13 @@ class RDoc::RubyLex
indent = true
end
if /['"`]/ =~ ch
- lt = ch
+ user_quote = lt = ch
quoted = ""
while (c = getc) && c != lt
quoted.concat c
end
else
+ user_quote = nil
lt = '"'
quoted = ch.dup
while (c = getc) && c =~ /\w/
@@ -977,35 +1010,54 @@ class RDoc::RubyLex
end
end
+ output_heredoc = reserve.join =~ /\A\r?\n\z/
+
+ if output_heredoc then
+ doc = '<<'
+ doc << '-' if indent
+ doc << "#{user_quote}#{quoted}#{user_quote}\n"
+ else
+ doc = '"'
+ end
+
@here_header = false
- doc = ''
while l = gets
- l = l.sub(/(:?\r)?\n\z/, '')
- if (indent ? l.strip : l) == quoted
+ l = l.sub(/(:?\r)?\n\z/, "\n")
+ if (indent ? l.strip : l.chomp) == quoted
break
end
doc << l
end
+ if output_heredoc then
+ raise Error, "Missing terminating #{quoted} for string" unless l
+
+ doc << l.chomp
+ else
+ doc << '"'
+ end
+
@here_header = true
@here_readed.concat reserve
while ch = reserve.pop
ungetc ch
end
+ token_class = output_heredoc ? RDoc::RubyLex::TkHEREDOC : Ltype2Token[lt]
@ltype = ltback
- @lex_state = EXPR_END
- Token(Ltype2Token[lt], doc)
+ @lex_state = :EXPR_END
+ Token(token_class, doc)
end
def identify_quotation
- ch = getc
- if lt = PERCENT_LTYPE[ch]
+ type = ch = getc
+ if lt = PERCENT_LTYPE[type]
ch = getc
- elsif ch =~ /\W/
+ elsif type =~ /\W/
+ type = nil
lt = "\""
else
- raise RDoc::Error, "unknown type of %string #{ch.inspect}"
+ return Token(TkMOD, '%')
end
# if ch !~ /\W/
# ungetc
@@ -1013,11 +1065,11 @@ class RDoc::RubyLex
# end
#@ltype = lt
@quoted = ch unless @quoted = PERCENT_PAREN[ch]
- identify_string(lt, @quoted)
+ identify_string(lt, @quoted, type)
end
def identify_number(op = "")
- @lex_state = EXPR_END
+ @lex_state = :EXPR_END
num = op
@@ -1040,7 +1092,7 @@ class RDoc::RubyLex
when /[0-7]/
match = /[0-7_]/
when /[89]/
- raise RDoc::Error, "Illegal octal digit"
+ raise Error, "Illegal octal digit"
else
return Token(TkINTEGER, num)
end
@@ -1054,7 +1106,7 @@ class RDoc::RubyLex
if match =~ ch
if ch == "_"
if non_digit
- raise RDoc::Error, "trailing `#{ch}' in number"
+ raise Error, "trailing `#{ch}' in number"
else
non_digit = ch
end
@@ -1066,10 +1118,10 @@ class RDoc::RubyLex
ungetc
num[-1, 1] = ''
if len0
- raise RDoc::Error, "numeric literal without digits"
+ raise Error, "numeric literal without digits"
end
if non_digit
- raise RDoc::Error, "trailing `#{non_digit}' in number"
+ raise Error, "trailing `#{non_digit}' in number"
end
break
end
@@ -1090,7 +1142,7 @@ class RDoc::RubyLex
non_digit = ch
when allow_point && "."
if non_digit
- raise RDoc::Error, "trailing `#{non_digit}' in number"
+ raise Error, "trailing `#{non_digit}' in number"
end
type = TkFLOAT
if peek(0) !~ /[0-9]/
@@ -1102,7 +1154,7 @@ class RDoc::RubyLex
allow_point = false
when allow_e && "e", allow_e && "E"
if non_digit
- raise RDoc::Error, "trailing `#{non_digit}' in number"
+ raise Error, "trailing `#{non_digit}' in number"
end
type = TkFLOAT
if peek(0) =~ /[+-]/
@@ -1113,7 +1165,7 @@ class RDoc::RubyLex
non_digit = ch
else
if non_digit
- raise RDoc::Error, "trailing `#{non_digit}' in number"
+ raise Error, "trailing `#{non_digit}' in number"
end
ungetc
num[-1, 1] = ''
@@ -1124,14 +1176,17 @@ class RDoc::RubyLex
Token(type, num)
end
- def identify_string(ltype, quoted = ltype)
+ def identify_string(ltype, quoted = ltype, type = nil)
+ close = PERCENT_PAREN.values.include?(quoted)
@ltype = ltype
@quoted = quoted
- str = if ltype == quoted then
+ 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]}"
else
- "%#{PERCENT_PAREN_REV[quoted]}"
+ "%#{type or PERCENT_LTYPE.index ltype}#{PERCENT_PAREN_REV[quoted]}"
end
subtype = nil
@@ -1141,7 +1196,7 @@ class RDoc::RubyLex
while ch = getc
str << ch
- if @quoted == ch and nest == 0
+ if @quoted == ch and nest <= 0
break
elsif @ltype != "'" && @ltype != "]" && @ltype != ":" and ch == "#"
ch = getc
@@ -1152,17 +1207,21 @@ class RDoc::RubyLex
else
ungetc
end
- elsif ch == '\\' and @ltype == "'" #'
- case ch = getc
- when "\\", "\n", "'"
+ elsif ch == '\\'
+ if %w[' /].include? @ltype then
+ case ch = getc
+ when "\\", "\n", "'"
+ when @ltype
+ str << ch
+ else
+ ungetc
+ end
else
- ungetc
+ str << read_escape
end
- elsif ch == '\\' #'
- str << read_escape
end
- if PERCENT_PAREN.values.include?(@quoted)
+ if close then
if PERCENT_PAREN[ch] == @quoted
nest += 1
elsif ch == @quoted
@@ -1172,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
@@ -1185,7 +1244,7 @@ class RDoc::RubyLex
ensure
@ltype = nil
@quoted = nil
- @lex_state = EXPR_END
+ @lex_state = :EXPR_END
end
end
@@ -1228,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
@@ -1249,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
@@ -1263,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 93b7a5cbc8..8010475b92 100644
--- a/lib/rdoc/ruby_token.rb
+++ b/lib/rdoc/ruby_token.rb
@@ -60,6 +60,11 @@ module RDoc::RubyToken
self
end
+ def inspect # :nodoc:
+ klass = self.class.name.split('::').last
+ "{%s %d, %d:%d %p}" % [klass, @seek, @line_no, @char_no, @text]
+ end
+
end
class TkNode < Token
@@ -83,6 +88,12 @@ module RDoc::RubyToken
end
alias text node
+
+ def inspect # :nodoc:
+ klass = self.class.name.split('::').last
+ "{%s %d, %d:%d %p}" % [klass, @seek, @line_no, @char_no, @node]
+ end
+
end
class TkId < Token
@@ -105,6 +116,12 @@ module RDoc::RubyToken
end
alias text name
+
+ def inspect # :nodoc:
+ klass = self.class.name.split('::').last
+ "{%s %d, %d:%d %p}" % [klass, @seek, @line_no, @char_no, @name]
+ end
+
end
class TkKW < TkId
@@ -130,6 +147,12 @@ module RDoc::RubyToken
end
alias text value
+
+ def inspect # :nodoc:
+ klass = self.class.name.split('::').last
+ "{%s %s, %d:%d %p}" % [klass, @seek, @line_no, @char_no, @value]
+ end
+
end
class TkOp < Token
@@ -153,6 +176,12 @@ module RDoc::RubyToken
end
alias text name
+
+ def inspect # :nodoc:
+ klass = self.class.name.split('::').last
+ "{%s %d, %d:%d %p}" % [klass, @seek, @line_no, @char_no, @name]
+ end
+
end
class TkOPASGN < TkOp
@@ -175,6 +204,12 @@ module RDoc::RubyToken
def text
@text ||= "#{TkToken2Reading[op]}="
end
+
+ def inspect # :nodoc:
+ klass = self.class.name.split('::').last
+ "{%s %d, %d:%d %p}" % [klass, @seek, @line_no, @char_no, @op]
+ end
+
end
class TkUnknownChar < Token
@@ -197,6 +232,12 @@ module RDoc::RubyToken
end
alias text name
+
+ def inspect # :nodoc:
+ klass = self.class.name.split('::').last
+ "{%s %d, %d:%d %p}" % [klass, @seek, @line_no, @char_no, @name]
+ end
+
end
class TkError < Token
@@ -235,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],
@@ -290,9 +331,11 @@ module RDoc::RubyToken
[:TkINTEGER, TkVal],
[:TkFLOAT, TkVal],
[:TkSTRING, TkVal],
+ [:TkHEREDOC, TkVal],
[:TkXSTRING, TkVal],
[:TkREGEXP, TkVal],
[:TkSYMBOL, TkVal],
+ [:TkCHAR, TkVal],
[:TkDSTRING, TkNode],
[:TkDXSTRING, TkNode],
@@ -329,13 +372,13 @@ module RDoc::RubyToken
[:TkfLPAREN, Token, "("], # func( #
[:TkfLBRACK, Token, "["], # func[ #
[:TkfLBRACE, Token, "{"], # func{ #
- [:TkSTAR, Token, "*"], # *arg
- [:TkAMPER, Token, "&"], # &arg #
[:TkSYMBEG, Token, ":"], # :SYMBOL
+ [:TkAMPER, TkOp, "&"],
[:TkGT, TkOp, ">"],
[:TkLT, TkOp, "<"],
[:TkPLUS, TkOp, "+"],
+ [:TkSTAR, TkOp, "*"],
[:TkMINUS, TkOp, "-"],
[:TkMULT, TkOp, "*"],
[:TkDIV, TkOp, "/"],
@@ -360,7 +403,6 @@ module RDoc::RubyToken
[:TkSEMICOLON, Token, ";"],
[:TkCOMMENT, TkVal],
- [:TkRD_COMMENT],
[:TkSPACE, Token, " "],
[:TkNL, Token, "\n"],
[:TkEND_OF_SCRIPT],
@@ -401,7 +443,9 @@ module RDoc::RubyToken
def_token(*defs)
end
- NEWLINE_TOKEN = TkNL.new nil, 0, 0, "\n"
+ def_token :TkRD_COMMENT, TkCOMMENT
+
+ NEWLINE_TOKEN = TkNL.new 0, 0, 0, "\n"
class TkSYMBOL
diff --git a/lib/rdoc/rubygems_hook.rb b/lib/rdoc/rubygems_hook.rb
index 178ca1d2ae..b4393114f1 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
##
@@ -68,12 +77,13 @@ class RDoc::RubygemsHook
##
# Creates a new documentation generator for +spec+. RDoc and ri data
- # generation can be disabled through +generate_rdoc+ and +generate_ri+
- # respectively.
+ # generation can be enabled or disabled through +generate_rdoc+ and
+ # +generate_ri+ respectively.
+ #
+ # Only +generate_ri+ is enabled by default.
- def initialize spec, generate_rdoc = true, generate_ri = true
+ def initialize spec, generate_rdoc = false, generate_ri = true
@doc_dir = spec.doc_dir
- @file_info = nil
@force = false
@rdoc = nil
@spec = spec
@@ -104,23 +114,27 @@ class RDoc::RubygemsHook
# Documentation will be generated into +destination+
def document generator, options, destination
+ generator_name = generator
+
options = options.dup
options.exclude ||= [] # TODO maybe move to RDoc::Options#finish
options.setup_generator generator
options.op_dir = destination
options.finish
+ generator = options.generator.new @rdoc.store, options
+
@rdoc.options = options
- @rdoc.generator = options.generator.new options
+ @rdoc.generator = generator
- say "Installing #{generator} documentation for #{@spec.full_name}"
+ say "Installing #{generator_name} documentation for #{@spec.full_name}"
FileUtils.mkdir_p options.op_dir
Dir.chdir options.op_dir do
begin
@rdoc.class.current = @rdoc
- @rdoc.generator.generate @file_info
+ @rdoc.generator.generate
ensure
@rdoc.class.current = nil
end
@@ -131,19 +145,16 @@ class RDoc::RubygemsHook
# Generates RDoc and ri data
def generate
+ return if @spec.default_gem?
return unless @generate_ri or @generate_rdoc
setup
- ::RDoc::RDoc.reset
-
- options = ::RDoc::Options.new
- options.default_title = "#{@spec.full_name} Documentation"
- options.files = []
- options.files.push(*@spec.require_paths)
- options.files.push(*@spec.extra_rdoc_files)
+ options = nil
args = @spec.rdoc_options
+ args.concat @spec.require_paths
+ args.concat @spec.extra_rdoc_files
case config_args = Gem.configuration[:rdoc]
when String then
@@ -153,14 +164,30 @@ class RDoc::RubygemsHook
end
delete_legacy_args args
- options.parse args
+
+ Dir.chdir @spec.full_gem_path do
+ options = ::RDoc::Options.new
+ options.default_title = "#{@spec.full_name} Documentation"
+ options.parse args
+ end
+
options.quiet = !Gem.configuration.really_verbose
@rdoc = new_rdoc
@rdoc.options = options
+ store = RDoc::Store.new
+ store.encoding = options.encoding if options.respond_to? :encoding
+ store.dry_run = options.dry_run
+ store.main = options.main_page
+ store.title = options.title
+
+ @rdoc.store = store
+
+ say "Parsing documentation for #{@spec.full_name}"
+
Dir.chdir @spec.full_gem_path do
- @file_info = @rdoc.parse_files options.files
+ @rdoc.parse_files options.files
end
document 'ri', options, @ri_dir if
diff --git a/lib/rdoc/servlet.rb b/lib/rdoc/servlet.rb
new file mode 100644
index 0000000000..ec8fd739f1
--- /dev/null
+++ b/lib/rdoc/servlet.rb
@@ -0,0 +1,441 @@
+require 'rdoc'
+require 'time'
+require 'webrick'
+
+##
+# This is a WEBrick servlet that allows you to browse ri documentation.
+#
+# You can show documentation through either `ri --server` or, with RubyGems
+# 2.0 or newer, `gem server`. For ri, the server runs on port 8214 by
+# default. For RubyGems the server runs on port 8808 by default.
+#
+# You can use this servlet in your own project by mounting it on a WEBrick
+# server:
+#
+# require 'webrick'
+#
+# server = WEBrick::HTTPServer.new Port: 8000
+#
+# server.mount '/', RDoc::Servlet
+#
+# If you want to mount the servlet some other place than the root, provide the
+# base path when mounting:
+#
+# server.mount '/rdoc', RDoc::Servlet, '/rdoc'
+
+class RDoc::Servlet < WEBrick::HTTPServlet::AbstractServlet
+
+ @server_stores = Hash.new { |hash, server| hash[server] = {} }
+ @cache = Hash.new { |hash, store| hash[store] = {} }
+
+ ##
+ # Maps an asset type to its path on the filesystem
+
+ attr_reader :asset_dirs
+
+ ##
+ # An RDoc::Options instance used for rendering options
+
+ attr_reader :options
+
+ ##
+ # Creates an instance of this servlet that shares cached data between
+ # requests.
+
+ def self.get_instance server, *options # :nodoc:
+ stores = @server_stores[server]
+
+ new server, stores, @cache, *options
+ end
+
+ ##
+ # Creates a new WEBrick servlet.
+ #
+ # 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, extra_doc_dirs = []
+ super server
+
+ @cache = cache
+ @mount_path = mount_path
+ @extra_doc_dirs = extra_doc_dirs
+ @stores = stores
+
+ @options = RDoc::Options.new
+ @options.op_dir = '.'
+
+ darkfish_dir = nil
+
+ # HACK dup
+ $LOAD_PATH.each do |path|
+ darkfish_dir = File.join path, 'rdoc/generator/template/darkfish/'
+ next unless File.directory? darkfish_dir
+ @options.template_dir = darkfish_dir
+ break
+ end
+
+ @asset_dirs = {
+ :darkfish => darkfish_dir,
+ :json_index =>
+ File.expand_path('../generator/template/json_index/', __FILE__),
+ }
+ end
+
+ ##
+ # Serves the asset at the path in +req+ for +generator_name+ via +res+.
+
+ def asset generator_name, req, res
+ asset_dir = @asset_dirs[generator_name]
+
+ asset_path = File.join asset_dir, req.path
+
+ if_modified_since req, res, asset_path
+
+ res.body = File.read asset_path
+
+ res.content_type = case req.path
+ when /css$/ then 'text/css'
+ when /js$/ then 'application/javascript'
+ else 'application/octet-stream'
+ end
+ end
+
+ ##
+ # GET request entry point. Fills in +res+ for the path, etc. in +req+.
+
+ def do_GET req, res
+ req.path.sub!(/^#{Regexp.escape @mount_path}/o, '') if @mount_path
+
+ case req.path
+ when '/' then
+ root req, res
+ when '/rdoc.css', '/js/darkfish.js', '/js/jquery.js', '/js/search.js',
+ %r%^/images/% then
+ asset :darkfish, req, res
+ when '/js/navigation.js', '/js/searcher.js' then
+ asset :json_index, req, res
+ when '/js/search_index.js' then
+ root_search req, res
+ 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
+ error e, req, res
+ end
+
+ ##
+ # Fills in +res+ with the class, module or page for +req+ from +store+.
+ #
+ # +path+ is relative to the mount_path and is used to determine the class,
+ # module or page name (/RDoc/Servlet.html becomes RDoc::Servlet).
+ # +generator+ is used to create the page.
+
+ def documentation_page store, generator, path, req, res
+ name = path.sub(/.html$/, '').gsub '/', '::'
+
+ if klass = store.find_class_or_module(name) then
+ res.body = generator.generate_class klass
+ elsif page = store.find_text_page(name.sub(/_([^_]*)$/, '.\1')) then
+ res.body = generator.generate_page page
+ else
+ not_found generator, req, res
+ end
+ end
+
+ ##
+ # Creates the JSON search index on +res+ for the given +store+. +generator+
+ # must respond to \#json_index to build. +req+ is ignored.
+
+ def documentation_search store, generator, req, res
+ json_index = @cache[store].fetch :json_index do
+ @cache[store][:json_index] =
+ JSON.dump generator.json_index.build_index
+ end
+
+ res.content_type = 'application/javascript'
+ res.body = "var search_data = #{json_index}"
+ end
+
+ ##
+ # Returns the RDoc::Store and path relative to +mount_path+ for
+ # documentation at +path+.
+
+ def documentation_source path
+ _, source_name, path = path.split '/', 3
+
+ store = @stores[source_name]
+ return store, path if store
+
+ store = store_for source_name
+
+ store.load_all
+
+ @stores[source_name] = store
+
+ return store, path
+ end
+
+ ##
+ # Generates an error page for the +exception+ while handling +req+ on +res+.
+
+ def error exception, req, res
+ backtrace = exception.backtrace.join "\n"
+
+ res.content_type = 'text/html'
+ res.status = 500
+ res.body = <<-BODY
+<!DOCTYPE html>
+<html>
+<head>
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+
+<title>Error - #{ERB::Util.html_escape exception.class}</title>
+
+<link type="text/css" media="screen" href="#{@mount_path}/rdoc.css" rel="stylesheet">
+</head>
+<body>
+<h1>Error</h1>
+
+<p>While processing <code>#{ERB::Util.html_escape req.request_uri}</code> the
+RDoc (#{ERB::Util.html_escape RDoc::VERSION}) server has encountered a
+<code>#{ERB::Util.html_escape exception.class}</code>
+exception:
+
+<pre>#{ERB::Util.html_escape exception.message}</pre>
+
+<p>Please report this to the
+<a href="https://github.com/rdoc/rdoc/issues">RDoc issues tracker</a>. Please
+include the RDoc version, the URI above and exception class, message and
+backtrace. If you're viewing a gem's documentation, include the gem name and
+version. If you're viewing Ruby's documentation, include the version of ruby.
+
+<p>Backtrace:
+
+<pre>#{ERB::Util.html_escape backtrace}</pre>
+
+</body>
+</html>
+ BODY
+ end
+
+ ##
+ # Instantiates a Darkfish generator for +store+
+
+ def generator_for store
+ generator = RDoc::Generator::Darkfish.new store, @options
+ generator.file_output = false
+ generator.asset_rel_path = '..'
+
+ rdoc = RDoc::RDoc.new
+ rdoc.store = store
+ rdoc.generator = generator
+ rdoc.options = @options
+
+ @options.main_page = store.main
+ @options.title = store.title
+
+ generator
+ end
+
+ ##
+ # Handles the If-Modified-Since HTTP header on +req+ for +path+. If the
+ # file has not been modified a Not Modified response is returned. If the
+ # file has been modified a Last-Modified header is added to +res+.
+
+ def if_modified_since req, res, path = nil
+ last_modified = File.stat(path).mtime if path
+
+ res['last-modified'] = last_modified.httpdate
+
+ return unless ims = req['if-modified-since']
+
+ ims = Time.parse ims
+
+ unless ims < last_modified then
+ res.body = ''
+ raise WEBrick::HTTPStatus::NotModified
+ end
+ end
+
+ ##
+ # Returns an Array of installed documentation.
+ #
+ # Each entry contains the documentation name (gem name, 'Ruby
+ # Documentation', etc.), the path relative to the mount point, whether the
+ # documentation exists, the type of documentation (See RDoc::RI::Paths#each)
+ # 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
+
+ case type
+ when :gem then
+ gem_path = path[%r%/([^/]*)/ri$%, 1]
+ [gem_path, "#{gem_path}/", exists, type, path]
+ when :system then
+ ['Ruby Documentation', 'ruby/', exists, type, path]
+ when :site then
+ ['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
+
+ ##
+ # Returns a 404 page built by +generator+ for +req+ on +res+.
+
+ 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
+
+ ##
+ # Enumerates the ri paths. See RDoc::RI::Paths#each
+
+ def ri_paths &block
+ RDoc::RI::Paths.each true, true, true, :all, *@extra_doc_dirs, &block #TODO: pass extra_dirs
+ end
+
+ ##
+ # Generates the root page on +res+. +req+ is ignored.
+
+ def root req, res
+ generator = RDoc::Generator::Darkfish.new nil, @options
+
+ res.body = generator.generate_servlet_root installed_docs
+
+ res.content_type = 'text/html'
+ end
+
+ ##
+ # Generates a search index for the root page on +res+. +req+ is ignored.
+
+ def root_search req, res
+ search_index = []
+ info = []
+
+ installed_docs.map do |name, href, exists, type, path|
+ next unless exists
+
+ search_index << name
+
+ case type
+ when :gem
+ gemspec = path.gsub(%r%/doc/([^/]*?)/ri$%,
+ '/specifications/\1.gemspec')
+
+ spec = Gem::Specification.load gemspec
+
+ path = spec.full_name
+ comment = spec.summary
+ when :system then
+ path = 'ruby'
+ comment = 'Documentation for the Ruby standard library'
+ when :site then
+ path = 'site'
+ comment = 'Documentation for non-gem libraries'
+ when :home then
+ path = 'home'
+ comment = 'Documentation from your home directory'
+ when :extra
+ comment = name
+ end
+
+ info << [name, '', path, '', comment]
+ end
+
+ index = {
+ :index => {
+ :searchIndex => search_index,
+ :longSearchIndex => search_index,
+ :info => info,
+ }
+ }
+
+ res.body = "var search_data = #{JSON.dump index};"
+ res.content_type = 'application/javascript'
+ end
+
+ ##
+ # Displays documentation for +req+ on +res+, whether that be HTML or some
+ # asset.
+
+ def show_documentation req, res
+ store, path = documentation_source req.path
+
+ if_modified_since req, res, store.cache_path
+
+ generator = generator_for store
+
+ case path
+ when nil, '', 'index.html' then
+ res.body = generator.generate_index
+ when 'table_of_contents.html' then
+ res.body = generator.generate_table_of_contents
+ when 'js/search_index.js' then
+ documentation_search store, generator, req, res
+ else
+ documentation_page store, generator, path, req, res
+ end
+ ensure
+ res.content_type ||= 'text/html'
+ end
+
+ ##
+ # Returns an RDoc::Store for the given +source_name+ ('ruby' or a gem name).
+
+ def store_for source_name
+ case source_name
+ when 'home' then
+ RDoc::Store.new RDoc::RI::Paths.home_dir, :home
+ when 'ruby' then
+ 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
+
+ source_name == dir[%r%/([^/]*)/ri$%, 1]
+ end
+
+ 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`"
+
+ end
+ end
+
+end
+
diff --git a/lib/rdoc/single_class.rb b/lib/rdoc/single_class.rb
index e48758d9c8..9e77a65c73 100644
--- a/lib/rdoc/single_class.rb
+++ b/lib/rdoc/single_class.rb
@@ -1,5 +1,3 @@
-require 'rdoc/class_module'
-
##
# A singleton class
diff --git a/lib/rdoc/stats.rb b/lib/rdoc/stats.rb
index e6101bb457..b5a21915b4 100644
--- a/lib/rdoc/stats.rb
+++ b/lib/rdoc/stats.rb
@@ -1,5 +1,3 @@
-require 'rdoc'
-
##
# RDoc statistics collector which prints a summary and report of a project's
# documentation totals.
@@ -25,17 +23,18 @@ class RDoc::Stats
# Creates a new Stats that will have +num_files+. +verbosity+ defaults to 1
# which will create an RDoc::Stats::Normal outputter.
- def initialize num_files, verbosity = 1
- @files_so_far = 0
+ def initialize store, num_files, verbosity = 1
@num_files = num_files
+ @store = store
- @coverage_level = 0
- @doc_items = nil
+ @coverage_level = 0
+ @doc_items = nil
+ @files_so_far = 0
@fully_documented = false
- @num_params = 0
- @percent_doc = nil
- @start = Time.now
- @undoc_params = 0
+ @num_params = 0
+ @percent_doc = nil
+ @start = Time.now
+ @undoc_params = 0
@display = case verbosity
when 0 then Quiet.new num_files
@@ -108,7 +107,10 @@ class RDoc::Stats
def calculate
return if @doc_items
- ucm = RDoc::TopLevel.unique_classes_and_modules
+ ucm = @store.unique_classes_and_modules
+
+ classes = @store.unique_classes.reject { |cm| cm.full_name == 'Object' }
+
constants = []
ucm.each { |cm| constants.concat cm.constants }
@@ -119,10 +121,10 @@ class RDoc::Stats
ucm.each { |cm| attributes.concat cm.attributes }
@num_attributes, @undoc_attributes = doc_stats attributes
- @num_classes, @undoc_classes = doc_stats RDoc::TopLevel.unique_classes
+ @num_classes, @undoc_classes = doc_stats classes
@num_constants, @undoc_constants = doc_stats constants
@num_methods, @undoc_methods = doc_stats methods
- @num_modules, @undoc_modules = doc_stats RDoc::TopLevel.unique_modules
+ @num_modules, @undoc_modules = doc_stats @store.unique_modules
@num_items =
@num_attributes +
@@ -160,7 +162,8 @@ class RDoc::Stats
# Returns the length and number of undocumented items in +collection+.
def doc_stats collection
- [collection.length, collection.count { |item| not item.documented? }]
+ visible = collection.select { |item| item.display? }
+ [visible.length, visible.count { |item| not item.documented? }]
end
##
@@ -184,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
##
@@ -211,30 +214,31 @@ class RDoc::Stats
def report
if @coverage_level > 0 then
- require 'rdoc/markup/to_tt_only'
- require 'rdoc/generator/markup'
- require 'rdoc/text'
extend RDoc::Text
end
- report = []
-
if @coverage_level.zero? then
calculate
return great_job if @num_items == @doc_items
end
- ucm = RDoc::TopLevel.unique_classes_and_modules
+ 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
##
@@ -259,8 +260,9 @@ class RDoc::Stats
cm.each_attribute do |attr|
next if attr.documented?
- report << " #{attr.definition} :#{attr.name} " \
- "# in file #{attr.file.full_name}"
+ line = attr.line ? ":#{attr.line}" : nil
+ report << " #{attr.definition} :#{attr.name} # in file #{attr.file.full_name}#{line}\n"
+ report << "\n"
end
report
@@ -271,40 +273,49 @@ class RDoc::Stats
def report_class_module cm
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
@@ -321,8 +332,11 @@ class RDoc::Stats
# TODO constant aliases are listed in the summary but not reported
# figure out what to do here
next if constant.documented? || constant.is_alias_for
- report << " # in file #{constant.file.full_name}"
- report << " #{constant.name} = nil"
+
+ line = constant.line ? ":#{constant.line}" : line
+ report << " # in file #{constant.file.full_name}#{line}\n"
+ report << " #{constant.name} = nil\n"
+ report << "\n"
end
report
@@ -348,15 +362,19 @@ 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
next if method.documented? and not param_report
- report << " # in file #{method.file.full_name}"
+
+ line = method.line ? ":#{method.line}" : nil
+ scope = method.singleton ? 'self.' : nil
+
+ report << " # in file #{method.file.full_name}#{line}\n"
report << param_report if param_report
- report << " def #{method.name}#{method.params}; end"
- report << nil
+ report << " def #{scope}#{method.name}#{method.params}; end\n"
+ report << "\n"
end
report
@@ -379,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/store.rb b/lib/rdoc/store.rb
new file mode 100644
index 0000000000..fde6f0695b
--- /dev/null
+++ b/lib/rdoc/store.rb
@@ -0,0 +1,979 @@
+require 'fileutils'
+
+##
+# A set of rdoc data for a single project (gem, path, etc.).
+#
+# The store manages reading and writing ri data for a project and maintains a
+# cache of methods, classes and ancestors in the store.
+#
+# The store maintains a #cache of its contents for faster lookup. After
+# adding items to the store it must be flushed using #save_cache. The cache
+# contains the following structures:
+#
+# @cache = {
+# :ancestors => {}, # class name => ancestor names
+# :attributes => {}, # class name => attributes
+# :class_methods => {}, # class name => class methods
+# :instance_methods => {}, # class name => instance methods
+# :modules => [], # classes and modules in this store
+# :pages => [], # page names
+# }
+#--
+# TODO need to prune classes
+
+class RDoc::Store
+
+ ##
+ # Errors raised from loading or saving the store
+
+ class Error < RDoc::Error
+ end
+
+ ##
+ # Raised when a stored file for a class, module, page or method is missing.
+
+ class MissingFileError < Error
+
+ ##
+ # The store the file should exist in
+
+ attr_reader :store
+
+ ##
+ # The file the #name should be saved as
+
+ attr_reader :file
+
+ ##
+ # The name of the object the #file would be loaded from
+
+ attr_reader :name
+
+ ##
+ # Creates a new MissingFileError for the missing +file+ for the given
+ # +name+ that should have been in the +store+.
+
+ def initialize store, file, name
+ @store = store
+ @file = file
+ @name = name
+ end
+
+ def message # :nodoc:
+ "store at #{@store.path} missing file #{@file} for #{@name}"
+ end
+
+ end
+
+ ##
+ # Stores the name of the C variable a class belongs to. This helps wire up
+ # classes defined from C across files.
+
+ attr_reader :c_enclosure_classes # :nodoc:
+
+ attr_reader :c_enclosure_names # :nodoc:
+
+ ##
+ # Maps C variables to class or module names for each parsed C file.
+
+ attr_reader :c_class_variables
+
+ ##
+ # Maps C variables to singleton class names for each parsed C file.
+
+ attr_reader :c_singleton_class_variables
+
+ ##
+ # If true this Store will not write any files
+
+ attr_accessor :dry_run
+
+ ##
+ # Path this store reads or writes
+
+ attr_accessor :path
+
+ ##
+ # The RDoc::RDoc driver for this parse tree. This allows classes consulting
+ # the documentation tree to access user-set options, for example.
+
+ attr_accessor :rdoc
+
+ ##
+ # Type of ri datastore this was loaded from. See RDoc::RI::Driver,
+ # RDoc::RI::Paths.
+
+ attr_accessor :type
+
+ ##
+ # The contents of the Store
+
+ attr_reader :cache
+
+ ##
+ # The encoding of the contents in the Store
+
+ attr_accessor :encoding
+
+ ##
+ # Creates a new Store of +type+ that will load or save to +path+
+
+ def initialize path = nil, type = nil
+ @dry_run = false
+ @encoding = nil
+ @path = path
+ @rdoc = nil
+ @type = type
+
+ @cache = {
+ :ancestors => {},
+ :attributes => {},
+ :class_methods => {},
+ :c_class_variables => {},
+ :c_singleton_class_variables => {},
+ :encoding => @encoding,
+ :instance_methods => {},
+ :main => nil,
+ :modules => [],
+ :pages => [],
+ :title => nil,
+ }
+
+ @classes_hash = {}
+ @modules_hash = {}
+ @files_hash = {}
+
+ @c_enclosure_classes = {}
+ @c_enclosure_names = {}
+
+ @c_class_variables = {}
+ @c_singleton_class_variables = {}
+
+ @unique_classes = nil
+ @unique_modules = nil
+ end
+
+ ##
+ # Adds +module+ as an enclosure (namespace) for the given +variable+ for C
+ # files.
+
+ def add_c_enclosure variable, namespace
+ @c_enclosure_classes[variable] = namespace
+ end
+
+ ##
+ # Adds C variables from an RDoc::Parser::C
+
+ def add_c_variables c_parser
+ filename = c_parser.top_level.relative_name
+
+ @c_class_variables[filename] = make_variable_map c_parser.classes
+
+ @c_singleton_class_variables[filename] = c_parser.singleton_classes
+ end
+
+ ##
+ # Adds the file with +name+ as an RDoc::TopLevel to the store. Returns the
+ # created RDoc::TopLevel.
+
+ def add_file absolute_name, relative_name = absolute_name
+ unless top_level = @files_hash[relative_name] then
+ top_level = RDoc::TopLevel.new absolute_name, relative_name
+ top_level.store = self
+ @files_hash[relative_name] = top_level
+ end
+
+ top_level
+ end
+
+ ##
+ # Returns all classes discovered by RDoc
+
+ def all_classes
+ @classes_hash.values
+ end
+
+ ##
+ # Returns all classes and modules discovered by RDoc
+
+ def all_classes_and_modules
+ @classes_hash.values + @modules_hash.values
+ end
+
+ ##
+ # All TopLevels known to RDoc
+
+ def all_files
+ @files_hash.values
+ end
+
+ ##
+ # Returns all modules discovered by RDoc
+
+ def all_modules
+ modules_hash.values
+ end
+
+ ##
+ # Ancestors cache accessor. Maps a klass name to an Array of its ancestors
+ # in this store. If Foo in this store inherits from Object, Kernel won't be
+ # listed (it will be included from ruby's ri store).
+
+ def ancestors
+ @cache[:ancestors]
+ end
+
+ ##
+ # Attributes cache accessor. Maps a class to an Array of its attributes.
+
+ def attributes
+ @cache[:attributes]
+ end
+
+ ##
+ # Path to the cache file
+
+ def cache_path
+ File.join @path, 'cache.ri'
+ end
+
+ ##
+ # Path to the ri data for +klass_name+
+
+ def class_file klass_name
+ name = klass_name.split('::').last
+ File.join class_path(klass_name), "cdesc-#{name}.ri"
+ end
+
+ ##
+ # Class methods cache accessor. Maps a class to an Array of its class
+ # methods (not full name).
+
+ def class_methods
+ @cache[:class_methods]
+ end
+
+ ##
+ # Path where data for +klass_name+ will be stored (methods or class data)
+
+ def class_path klass_name
+ File.join @path, *klass_name.split('::')
+ end
+
+ ##
+ # Hash of all classes known to RDoc
+
+ def classes_hash
+ @classes_hash
+ end
+
+ ##
+ # Removes empty items and ensures item in each collection are unique and
+ # sorted
+
+ def clean_cache_collection collection # :nodoc:
+ collection.each do |name, item|
+ if item.empty? then
+ collection.delete name
+ else
+ # HACK mongrel-1.1.5 documents its files twice
+ item.uniq!
+ item.sort!
+ end
+ end
+ end
+
+ ##
+ # Prepares the RDoc code object tree for use by a generator.
+ #
+ # It finds unique classes/modules defined, and replaces classes/modules that
+ # are aliases for another one by a copy with RDoc::ClassModule#is_alias_for
+ # set.
+ #
+ # It updates the RDoc::ClassModule#constant_aliases attribute of "real"
+ # classes or modules.
+ #
+ # It also completely removes the classes and modules that should be removed
+ # from the documentation and the methods that have a visibility below
+ # +min_visibility+, which is the <tt>--visibility</tt> option.
+ #
+ # See also RDoc::Context#remove_from_documentation?
+
+ def complete min_visibility
+ fix_basic_object_inheritance
+
+ # cache included modules before they are removed from the documentation
+ all_classes_and_modules.each { |cm| cm.ancestors }
+
+ 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
+
+ unique_classes_and_modules.each do |cm|
+ cm.complete min_visibility
+ end
+
+ @files_hash.each_key do |file_name|
+ tl = @files_hash[file_name]
+
+ unless tl.text? then
+ tl.modules_hash.clear
+ tl.classes_hash.clear
+
+ tl.classes_or_modules.each do |cm|
+ name = cm.full_name
+ if cm.type == 'class' then
+ tl.classes_hash[name] = cm if @classes_hash[name]
+ else
+ tl.modules_hash[name] = cm if @modules_hash[name]
+ end
+ end
+ end
+ end
+ end
+
+ ##
+ # Hash of all files known to RDoc
+
+ def files_hash
+ @files_hash
+ end
+
+ ##
+ # Finds the enclosure (namespace) for the given C +variable+.
+
+ def find_c_enclosure variable
+ @c_enclosure_classes.fetch variable do
+ break unless name = @c_enclosure_names[variable]
+
+ mod = find_class_or_module name
+
+ unless mod then
+ loaded_mod = load_class_data name
+
+ file = loaded_mod.in_files.first
+
+ return unless file # legacy data source
+
+ file.store = self
+
+ mod = file.add_module RDoc::NormalModule, name
+ end
+
+ @c_enclosure_classes[variable] = mod
+ end
+ end
+
+ ##
+ # Finds the class with +name+ in all discovered classes
+
+ def find_class_named name
+ @classes_hash[name]
+ end
+
+ ##
+ # Finds the class with +name+ starting in namespace +from+
+
+ def find_class_named_from name, from
+ from = find_class_named from unless RDoc::Context === from
+
+ until RDoc::TopLevel === from do
+ return nil unless from
+
+ klass = from.find_class_named name
+ return klass if klass
+
+ from = from.parent
+ end
+
+ find_class_named name
+ end
+
+ ##
+ # Finds the class or module with +name+
+
+ def find_class_or_module name
+ name = $' if name =~ /^::/
+ @classes_hash[name] || @modules_hash[name]
+ end
+
+ ##
+ # Finds the file with +name+ in all discovered files
+
+ def find_file_named name
+ @files_hash[name]
+ end
+
+ ##
+ # Finds the module with +name+ in all discovered modules
+
+ def find_module_named name
+ @modules_hash[name]
+ end
+
+ ##
+ # Returns the RDoc::TopLevel that is a text file and has the given
+ # +file_name+
+
+ def find_text_page file_name
+ @files_hash.each_value.find do |file|
+ file.text? and file.full_name == file_name
+ end
+ end
+
+ ##
+ # Finds unique classes/modules defined in +all_hash+,
+ # and returns them as an array. Performs the alias
+ # updates in +all_hash+: see ::complete.
+ #--
+ # TODO aliases should be registered by Context#add_module_alias
+
+ def find_unique all_hash
+ unique = []
+
+ all_hash.each_pair do |full_name, cm|
+ unique << cm if full_name == cm.full_name
+ end
+
+ unique
+ end
+
+ ##
+ # Fixes the erroneous <tt>BasicObject < Object</tt> in 1.9.
+ #
+ # Because we assumed all classes without a stated superclass
+ # inherit from Object, we have the above wrong inheritance.
+ #
+ # We fix BasicObject right away if we are running in a Ruby
+ # version >= 1.9. If not, we may be documenting 1.9 source
+ # while running under 1.8: we search the files of BasicObject
+ # for "object.c", and fix the inheritance if we find it.
+
+ def fix_basic_object_inheritance
+ basic = classes_hash['BasicObject']
+ return unless basic
+ if RUBY_VERSION >= '1.9'
+ basic.superclass = nil
+ elsif basic.in_files.any? { |f| File.basename(f.full_name) == 'object.c' }
+ basic.superclass = nil
+ end
+ end
+
+ ##
+ # Friendly rendition of #path
+
+ def friendly_path
+ case type
+ when :gem then
+ parent = File.expand_path '..', @path
+ "gem #{File.basename parent}"
+ when :home then '~/.rdoc'
+ when :site then 'ruby site'
+ when :system then 'ruby core'
+ else @path
+ end
+ end
+
+ def inspect # :nodoc:
+ "#<%s:0x%x %s %p>" % [self.class, object_id, @path, module_names.sort]
+ end
+
+ ##
+ # Instance methods cache accessor. Maps a class to an Array of its
+ # instance methods (not full name).
+
+ def instance_methods
+ @cache[:instance_methods]
+ end
+
+ ##
+ # Loads all items from this store into memory. This recreates a
+ # documentation tree for use by a generator
+
+ def load_all
+ load_cache
+
+ module_names.each do |module_name|
+ mod = find_class_or_module(module_name) || load_class(module_name)
+
+ # load method documentation since the loaded class/module does not have
+ # it
+ loaded_methods = mod.method_list.map do |method|
+ load_method module_name, method.full_name
+ end
+
+ mod.method_list.replace loaded_methods
+
+ loaded_attributes = mod.attributes.map do |attribute|
+ load_method module_name, attribute.full_name
+ end
+
+ mod.attributes.replace loaded_attributes
+ end
+
+ all_classes_and_modules.each do |mod|
+ descendent_re = /^#{mod.full_name}::[^:]+$/
+
+ module_names.each do |name|
+ next unless name =~ descendent_re
+
+ descendent = find_class_or_module name
+
+ case descendent
+ when RDoc::NormalClass then
+ mod.classes_hash[name] = descendent
+ when RDoc::NormalModule then
+ mod.modules_hash[name] = descendent
+ end
+ end
+ end
+
+ @cache[:pages].each do |page_name|
+ page = load_page page_name
+ @files_hash[page_name] = page
+ end
+ end
+
+ ##
+ # Loads cache file for this store
+
+ def load_cache
+ #orig_enc = @encoding
+
+ open cache_path, 'rb' do |io|
+ @cache = Marshal.load io.read
+ end
+
+ load_enc = @cache[:encoding]
+
+ # TODO this feature will be time-consuming to add:
+ # a) Encodings may be incompatible but transcodeable
+ # b) Need to warn in the appropriate spots, wherever they may be
+ # c) Need to handle cross-cache differences in encodings
+ # d) Need to warn when generating into a cache with different encodings
+ #
+ #if orig_enc and load_enc != orig_enc then
+ # warn "Cached encoding #{load_enc} is incompatible with #{orig_enc}\n" \
+ # "from #{path}/cache.ri" unless
+ # Encoding.compatible? orig_enc, load_enc
+ #end
+
+ @encoding = load_enc unless @encoding
+
+ @cache[:pages] ||= []
+ @cache[:main] ||= nil
+ @cache[:c_class_variables] ||= {}
+ @cache[:c_singleton_class_variables] ||= {}
+
+ @cache[:c_class_variables].each do |_, map|
+ map.each do |variable, name|
+ @c_enclosure_names[variable] = name
+ end
+ end
+
+ @cache
+ rescue Errno::ENOENT
+ end
+
+ ##
+ # Loads ri data for +klass_name+ and hooks it up to this store.
+
+ def load_class klass_name
+ obj = load_class_data klass_name
+
+ obj.store = self
+
+ case obj
+ when RDoc::NormalClass then
+ @classes_hash[klass_name] = obj
+ when RDoc::NormalModule then
+ @modules_hash[klass_name] = obj
+ end
+ end
+
+ ##
+ # Loads ri data for +klass_name+
+
+ def load_class_data klass_name
+ file = class_file klass_name
+
+ open file, 'rb' do |io|
+ Marshal.load io.read
+ end
+ rescue Errno::ENOENT => e
+ error = MissingFileError.new(self, file, klass_name)
+ error.set_backtrace e.backtrace
+ raise error
+ end
+
+ ##
+ # Loads ri data for +method_name+ in +klass_name+
+
+ def load_method klass_name, method_name
+ file = method_file klass_name, method_name
+
+ open file, 'rb' do |io|
+ obj = Marshal.load io.read
+ obj.store = self
+ obj.parent =
+ find_class_or_module(klass_name) || load_class(klass_name) unless
+ obj.parent
+ obj
+ end
+ rescue Errno::ENOENT => e
+ error = MissingFileError.new(self, file, klass_name + method_name)
+ error.set_backtrace e.backtrace
+ raise error
+ end
+
+ ##
+ # Loads ri data for +page_name+
+
+ def load_page page_name
+ file = page_file page_name
+
+ open file, 'rb' do |io|
+ obj = Marshal.load io.read
+ obj.store = self
+ obj
+ end
+ rescue Errno::ENOENT => e
+ error = MissingFileError.new(self, file, page_name)
+ error.set_backtrace e.backtrace
+ raise error
+ end
+
+ ##
+ # Gets the main page for this RDoc store. This page is used as the root of
+ # the RDoc server.
+
+ def main
+ @cache[:main]
+ end
+
+ ##
+ # Sets the main page for this RDoc store.
+
+ def main= page
+ @cache[:main] = page
+ end
+
+ ##
+ # Converts the variable => ClassModule map +variables+ from a C parser into
+ # a variable => class name map.
+
+ def make_variable_map variables
+ map = {}
+
+ variables.each { |variable, class_module|
+ map[variable] = class_module.full_name
+ }
+
+ map
+ end
+
+ ##
+ # Path to the ri data for +method_name+ in +klass_name+
+
+ def method_file klass_name, method_name
+ method_name = method_name.split('::').last
+ method_name =~ /#(.*)/
+ method_type = $1 ? 'i' : 'c'
+ method_name = $1 if $1
+
+ method_name = if ''.respond_to? :ord then
+ method_name.gsub(/\W/) { "%%%02x" % $&[0].ord }
+ else
+ method_name.gsub(/\W/) { "%%%02x" % $&[0] }
+ end
+
+ File.join class_path(klass_name), "#{method_name}-#{method_type}.ri"
+ end
+
+ ##
+ # Modules cache accessor. An Array of all the module (and class) names in
+ # the store.
+
+ def module_names
+ @cache[:modules]
+ end
+
+ ##
+ # Hash of all modules known to RDoc
+
+ def modules_hash
+ @modules_hash
+ end
+
+ ##
+ # Returns the RDoc::TopLevel that is a text file and has the given +name+
+
+ def page name
+ @files_hash.each_value.find do |file|
+ file.text? and file.page_name == name
+ end
+ end
+
+ ##
+ # Path to the ri data for +page_name+
+
+ def page_file page_name
+ file_name = File.basename(page_name).gsub('.', '_')
+
+ File.join @path, File.dirname(page_name), "page-#{file_name}.ri"
+ end
+
+ ##
+ # Removes from +all_hash+ the contexts that are nodoc or have no content.
+ #
+ # See RDoc::Context#remove_from_documentation?
+
+ def remove_nodoc all_hash
+ all_hash.keys.each do |name|
+ context = all_hash[name]
+ all_hash.delete(name) if context.remove_from_documentation?
+ end
+ end
+
+ ##
+ # Saves all entries in the store
+
+ def save
+ load_cache
+
+ all_classes_and_modules.each do |klass|
+ save_class klass
+
+ klass.each_method do |method|
+ save_method klass, method
+ end
+
+ klass.each_attribute do |attribute|
+ save_method klass, attribute
+ end
+ end
+
+ all_files.each do |file|
+ save_page file
+ end
+
+ save_cache
+ end
+
+ ##
+ # Writes the cache file for this store
+
+ def save_cache
+ clean_cache_collection @cache[:ancestors]
+ clean_cache_collection @cache[:attributes]
+ clean_cache_collection @cache[:class_methods]
+ clean_cache_collection @cache[:instance_methods]
+
+ @cache[:modules].uniq!
+ @cache[:modules].sort!
+
+ @cache[:pages].uniq!
+ @cache[:pages].sort!
+
+ @cache[:encoding] = @encoding # this gets set twice due to assert_cache
+
+ @cache[:c_class_variables].merge! @c_class_variables
+ @cache[:c_singleton_class_variables].merge! @c_singleton_class_variables
+
+ return if @dry_run
+
+ marshal = Marshal.dump @cache
+
+ open cache_path, 'wb' do |io|
+ io.write marshal
+ end
+ end
+
+ ##
+ # Writes the ri data for +klass+ (or module)
+
+ def save_class klass
+ full_name = klass.full_name
+
+ FileUtils.mkdir_p class_path(full_name) unless @dry_run
+
+ @cache[:modules] << full_name
+
+ path = class_file full_name
+
+ begin
+ disk_klass = load_class full_name
+
+ klass = disk_klass.merge klass
+ rescue MissingFileError
+ end
+
+ # BasicObject has no ancestors
+ ancestors = klass.direct_ancestors.compact.map do |ancestor|
+ # HACK for classes we don't know about (class X < RuntimeError)
+ String === ancestor ? ancestor : ancestor.full_name
+ end
+
+ @cache[:ancestors][full_name] ||= []
+ @cache[:ancestors][full_name].concat ancestors
+
+ attribute_definitions = klass.attributes.map do |attribute|
+ "#{attribute.definition} #{attribute.name}"
+ end
+
+ unless attribute_definitions.empty? then
+ @cache[:attributes][full_name] ||= []
+ @cache[:attributes][full_name].concat attribute_definitions
+ end
+
+ to_delete = []
+
+ unless klass.method_list.empty? then
+ @cache[:class_methods][full_name] ||= []
+ @cache[:instance_methods][full_name] ||= []
+
+ class_methods, instance_methods =
+ klass.method_list.partition { |meth| meth.singleton }
+
+ class_methods = class_methods. map { |method| method.name }
+ instance_methods = instance_methods.map { |method| method.name }
+ attribute_names = klass.attributes.map { |attr| attr.name }
+
+ old = @cache[:class_methods][full_name] - class_methods
+ to_delete.concat old.map { |method|
+ method_file full_name, "#{full_name}::#{method}"
+ }
+
+ old = @cache[:instance_methods][full_name] -
+ instance_methods - attribute_names
+ to_delete.concat old.map { |method|
+ method_file full_name, "#{full_name}##{method}"
+ }
+
+ @cache[:class_methods][full_name] = class_methods
+ @cache[:instance_methods][full_name] = instance_methods
+ end
+
+ return if @dry_run
+
+ FileUtils.rm_f to_delete
+
+ marshal = Marshal.dump klass
+
+ open path, 'wb' do |io|
+ io.write marshal
+ end
+ end
+
+ ##
+ # Writes the ri data for +method+ on +klass+
+
+ def save_method klass, method
+ full_name = klass.full_name
+
+ FileUtils.mkdir_p class_path(full_name) unless @dry_run
+
+ cache = if method.singleton then
+ @cache[:class_methods]
+ else
+ @cache[:instance_methods]
+ end
+ cache[full_name] ||= []
+ cache[full_name] << method.name
+
+ return if @dry_run
+
+ marshal = Marshal.dump method
+
+ open method_file(full_name, method.full_name), 'wb' do |io|
+ io.write marshal
+ end
+ end
+
+ ##
+ # Writes the ri data for +page+
+
+ def save_page page
+ return unless page.text?
+
+ path = page_file page.full_name
+
+ FileUtils.mkdir_p File.dirname(path) unless @dry_run
+
+ cache[:pages] ||= []
+ cache[:pages] << page.full_name
+
+ return if @dry_run
+
+ marshal = Marshal.dump page
+
+ open path, 'wb' do |io|
+ io.write marshal
+ end
+ end
+
+ ##
+ # Source of the contents of this store.
+ #
+ # For a store from a gem the source is the gem name. For a store from the
+ # home directory the source is "home". For system ri store (the standard
+ # library documentation) the source is"ruby". For a store from the site
+ # ri directory the store is "site". For other stores the source is the
+ # #path.
+
+ def source
+ case type
+ when :gem then File.basename File.expand_path '..', @path
+ when :home then 'home'
+ when :site then 'site'
+ when :system then 'ruby'
+ else @path
+ end
+ end
+
+ ##
+ # Gets the title for this RDoc store. This is used as the title in each
+ # page on the RDoc server
+
+ def title
+ @cache[:title]
+ end
+
+ ##
+ # Sets the title page for this RDoc store.
+
+ def title= title
+ @cache[:title] = title
+ end
+
+ ##
+ # Returns the unique classes discovered by RDoc.
+ #
+ # ::complete must have been called prior to using this method.
+
+ def unique_classes
+ @unique_classes
+ end
+
+ ##
+ # Returns the unique classes and modules discovered by RDoc.
+ # ::complete must have been called prior to using this method.
+
+ def unique_classes_and_modules
+ @unique_classes + @unique_modules
+ end
+
+ ##
+ # Returns the unique modules discovered by RDoc.
+ # ::complete must have been called prior to using this method.
+
+ def unique_modules
+ @unique_modules
+ end
+
+end
+
diff --git a/lib/rdoc/task.rb b/lib/rdoc/task.rb
index ec7459729a..d347e4d6ab 100644
--- a/lib/rdoc/task.rb
+++ b/lib/rdoc/task.rb
@@ -25,12 +25,12 @@ require 'rubygems'
begin
gem 'rdoc'
rescue Gem::LoadError
-end
+end unless defined?(RDoc)
begin
gem 'rake'
rescue Gem::LoadError
-end
+end unless defined?(Rake)
require 'rdoc'
require 'rake'
@@ -52,7 +52,6 @@ require 'rake/tasklib'
#
# Simple Example:
#
-# gem 'rdoc'
# require 'rdoc/task'
#
# RDoc::Task.new do |rdoc|
@@ -69,7 +68,6 @@ require 'rake/tasklib'
# generating two sets of documentation. For instance, if you want to have a
# development set of documentation including private methods:
#
-# gem 'rdoc'
# require 'rdoc/task'
#
# RDoc::Task.new :rdoc_dev do |rdoc|
@@ -87,7 +85,6 @@ require 'rake/tasklib'
#
# For example:
#
-# gem 'rdoc'
# require 'rdoc/task'
#
# RDoc::Task.new(:rdoc => "rdoc", :clobber_rdoc => "rdoc:clean",
@@ -104,6 +101,12 @@ class RDoc::Task < Rake::TaskLib
attr_accessor :name
##
+ # Comment markup format. rdoc, rd and tomdoc are supported. (default is
+ # 'rdoc')
+
+ attr_accessor :markup
+
+ ##
# Name of directory to receive the html output files. (default is "html")
attr_accessor :rdoc_dir
@@ -125,7 +128,8 @@ class RDoc::Task < Rake::TaskLib
attr_accessor :template
##
- # Name of format generator (--fmt) used by rdoc. (defaults to rdoc's default)
+ # Name of format generator (<tt>--format<tt>) used by rdoc. (defaults to
+ # rdoc's default)
attr_accessor :generator
@@ -241,7 +245,6 @@ class RDoc::Task < Rake::TaskLib
args = option_list + @rdoc_files
$stderr.puts "rdoc #{args.join ' '}" if Rake.application.options.trace
- require 'rdoc/rdoc'
RDoc::RDoc.new.document args
end
@@ -253,11 +256,12 @@ class RDoc::Task < Rake::TaskLib
def option_list
result = @options.dup
- result << "-o" << @rdoc_dir
- result << "--main" << main if main
- result << "--title" << title if title
- result << "-T" << template if template
- result << '-f' << generator if generator
+ result << "-o" << @rdoc_dir
+ result << "--main" << main if main
+ result << "--markup" << markup if markup
+ result << "--title" << title if title
+ result << "-T" << template if template
+ result << '-f' << generator if generator
result
end
diff --git a/lib/rdoc/test_case.rb b/lib/rdoc/test_case.rb
new file mode 100644
index 0000000000..245e4ef1c5
--- /dev/null
+++ b/lib/rdoc/test_case.rb
@@ -0,0 +1,217 @@
+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']
+
+require 'fileutils'
+require 'pp'
+require 'tempfile'
+require 'tmpdir'
+require 'stringio'
+
+require 'rdoc'
+
+##
+# RDoc::TestCase is an abstract TestCase to provide common setup and teardown
+# across all RDoc tests. The test case uses minitest, so all the assertions
+# of minitest may be used.
+#
+# The testcase provides the following:
+#
+# * A reset code-object tree
+# * A reset markup preprocessor (RDoc::Markup::PreProcess)
+# * The <code>@RM</code> alias of RDoc::Markup (for less typing)
+# * <code>@pwd</code> containing the current working directory
+# * FileUtils, pp, Tempfile, Dir.tmpdir and StringIO
+
+class RDoc::TestCase < MiniTest::Unit::TestCase
+
+ ##
+ # Abstract test-case setup
+
+ def setup
+ super
+
+ @top_level = nil
+
+ @have_encoding = Object.const_defined? :Encoding
+
+ @RM = RDoc::Markup
+
+ RDoc::Markup::PreProcess.reset
+
+ @pwd = Dir.pwd
+
+ @store = RDoc::Store.new
+
+ @rdoc = RDoc::RDoc.new
+ @rdoc.store = @store
+ @rdoc.options = RDoc::Options.new
+
+ g = Object.new
+ def g.class_dir() end
+ def g.file_dir() end
+ @rdoc.generator = g
+ 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
+ @RM::BlankLine.new
+ end
+
+ ##
+ # Shortcut for RDoc::Markup::BlockQuote.new with +contents+
+
+ def block *contents
+ @RM::BlockQuote.new(*contents)
+ end
+
+ ##
+ # Creates an RDoc::Comment with +text+ which was defined on +top_level+.
+ # By default the comment has the 'rdoc' format.
+
+ def comment text, top_level = @top_level
+ RDoc::Comment.new text, top_level
+ end
+
+ ##
+ # Shortcut for RDoc::Markup::Document.new with +contents+
+
+ def doc *contents
+ @RM::Document.new(*contents)
+ end
+
+ ##
+ # Shortcut for RDoc::Markup::HardBreak.new
+
+ def hard_break
+ @RM::HardBreak.new
+ end
+
+ ##
+ # Shortcut for RDoc::Markup::Heading.new with +level+ and +text+
+
+ def head level, text
+ @RM::Heading.new level, text
+ end
+
+ ##
+ # Shortcut for RDoc::Markup::ListItem.new with +label+ and +parts+
+
+ def item label = nil, *parts
+ @RM::ListItem.new label, *parts
+ end
+
+ ##
+ # Shortcut for RDoc::Markup::List.new with +type+ and +items+
+
+ def list type = nil, *items
+ @RM::List.new type, *items
+ 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
+ @RM::Paragraph.new(*a)
+ end
+
+ ##
+ # Shortcut for RDoc::Markup::Rule.new with +weight+
+
+ def rule weight
+ @RM::Rule.new weight
+ end
+
+ ##
+ # Shortcut for RDoc::Markup::Raw.new with +contents+
+
+ def raw *contents
+ @RM::Raw.new(*contents)
+ end
+
+ ##
+ # Creates a temporary directory changes the current directory to it for the
+ # duration of the block.
+ #
+ # Depends upon Dir.mktmpdir
+
+ def temp_dir
+ skip "No Dir::mktmpdir, upgrade your ruby" unless Dir.respond_to? :mktmpdir
+
+ Dir.mktmpdir do |temp_dir|
+ Dir.chdir temp_dir do
+ yield temp_dir
+ end
+ end
+ end
+
+ ##
+ # Shortcut for RDoc::Markup::Verbatim.new with +parts+
+
+ def verb *parts
+ @RM::Verbatim.new(*parts)
+ end
+
+ ##
+ # run capture_io with setting $VERBOSE = true
+
+ def verbose_capture_io
+ capture_io do
+ begin
+ orig_verbose = $VERBOSE
+ $VERBOSE = true
+ yield
+ ensure
+ $VERBOSE = orig_verbose
+ end
+ end
+ end
+end
+
+# This hack allows autoload to work when Dir.pwd is changed for Ruby 1.8 since
+# -I paths are not expanded.
+$LOAD_PATH.each do |load_path|
+ break if load_path[0] == ?/
+ load_path.replace File.expand_path load_path
+end if RUBY_VERSION < '1.9'
+
diff --git a/lib/rdoc/text.rb b/lib/rdoc/text.rb
index 3ac55ed560..0fda72e3ae 100644
--- a/lib/rdoc/text.rb
+++ b/lib/rdoc/text.rb
@@ -6,11 +6,34 @@
require 'strscan'
##
+# For RDoc::Text#snippet
+
+begin
+ gem 'json'
+rescue Gem::LoadError
+end
+
+require 'json'
+
+##
# Methods for manipulating comment text
module RDoc::Text
##
+ # Maps markup formats to classes that can parse them. If the format is
+ # unknown, "rdoc" format is used.
+
+ MARKUP_FORMAT = {
+ 'markdown' => RDoc::Markdown,
+ 'rdoc' => RDoc::Markup,
+ 'rd' => RDoc::RD,
+ 'tomdoc' => RDoc::TomDoc,
+ }
+
+ MARKUP_FORMAT.default = RDoc::Markup
+
+ ##
# Maps an encoding to a Hash of characters properly transcoded for that
# encoding.
#
@@ -45,7 +68,7 @@ module RDoc::Text
expanded = []
text.each_line do |line|
- line.gsub!(/^(.{8}*?)([^\t\r\n]{0,7})\t/) do
+ line.gsub!(/^((?:.{8})*?)([^\t\r\n]{0,7})\t/) do
r = "#{$1}#{$2}#{' ' * (8 - $2.size)}"
r.force_encoding text.encoding if Object.const_defined? :Encoding
r
@@ -80,9 +103,7 @@ module RDoc::Text
# Requires the including class to implement #formatter
def markup text
- document = parse text
-
- document.accept formatter
+ parse(text).accept formatter
end
##
@@ -91,9 +112,10 @@ module RDoc::Text
def normalize_comment text
return text if text.empty?
- text = strip_hashes text
- text = expand_tabs text
- text = flush_left text
+ text = strip_stars text
+ text = strip_hashes text
+ text = expand_tabs text
+ text = flush_left text
text = strip_newlines text
text
end
@@ -101,35 +123,24 @@ module RDoc::Text
##
# Normalizes +text+ then builds a RDoc::Markup::Document from it
- def parse text
+ def parse text, format = 'rdoc'
return text if RDoc::Markup::Document === text
+ return text.parse if RDoc::Comment === text
- text = normalize_comment text
+ text = normalize_comment text # TODO remove, should not be necessary
return RDoc::Markup::Document.new if text =~ /\A\n*\z/
- RDoc::Markup::Parser.parse text
- rescue RDoc::Markup::Parser::Error => e
- $stderr.puts <<-EOF
-While parsing markup, RDoc encountered a #{e.class}:
-
-#{e}
-\tfrom #{e.backtrace.join "\n\tfrom "}
-
----8<---
-#{text}
----8<---
-
-RDoc #{RDoc::VERSION}
-
-Ruby #{RUBY_VERSION}-p#{RUBY_PATCHLEVEL} #{RUBY_RELEASE_DATE}
+ MARKUP_FORMAT[format].parse text
+ end
-Please file a bug report with the above information at:
+ ##
+ # The first +limit+ characters of +text+ as HTML
-https://github.com/rdoc/rdoc/issues
+ def snippet text, limit = 100
+ document = parse text
- EOF
- raise
+ RDoc::Markup::ToHtmlSnippet.new(options, limit).convert document
end
##
@@ -155,6 +166,8 @@ https://github.com/rdoc/rdoc/issues
# Strips /* */ style comments
def strip_stars text
+ return text unless text =~ %r%/\*.*\*/%m
+
encoding = text.encoding if Object.const_defined? :Encoding
text = text.gsub %r%Document-method:\s+[\w:.#=!?]+%, ''
@@ -202,10 +215,10 @@ https://github.com/rdoc/rdoc/issues
until s.eos? do
case
- when s.scan(/<tt>.*?<\/tt>/) then # skip contents of tt
+ when s.scan(/<(tt|code)>.*?<\/\1>/) then # skip contents of tt
html << s.matched.gsub('\\\\', '\\')
- when s.scan(/<tt>.*?/) then
- warn 'mismatched <tt> tag' # TODO signal file/line
+ when s.scan(/<(tt|code)>.*?/) then
+ warn "mismatched <#{s[1]}> tag" # TODO signal file/line
html << s.matched
when s.scan(/<[^>]+\/?s*>/) then # skip HTML tags
html << s.matched
diff --git a/lib/rdoc/token_stream.rb b/lib/rdoc/token_stream.rb
index fb887f2fa4..851bc05bf5 100644
--- a/lib/rdoc/token_stream.rb
+++ b/lib/rdoc/token_stream.rb
@@ -8,6 +8,51 @@
module RDoc::TokenStream
##
+ # Converts +token_stream+ to HTML wrapping various tokens with
+ # <tt><span></tt> elements. The following tokens types are wrapped in spans
+ # with the given class names:
+ #
+ # TkCONSTANT :: 'ruby-constant'
+ # TkKW :: 'ruby-keyword'
+ # TkIVAR :: 'ruby-ivar'
+ # TkOp :: 'ruby-operator'
+ # TkId :: 'ruby-identifier'
+ # TkNode :: 'ruby-node'
+ # TkCOMMENT :: 'ruby-comment'
+ # TkREGEXP :: 'ruby-regexp'
+ # TkSTRING :: 'ruby-string'
+ # TkVal :: 'ruby-value'
+ #
+ # Other token types are not wrapped in spans.
+
+ def self.to_html token_stream
+ token_stream.map do |t|
+ next unless t
+
+ style = case t
+ when RDoc::RubyToken::TkCONSTANT then 'ruby-constant'
+ when RDoc::RubyToken::TkKW then 'ruby-keyword'
+ when RDoc::RubyToken::TkIVAR then 'ruby-ivar'
+ when RDoc::RubyToken::TkOp then 'ruby-operator'
+ when RDoc::RubyToken::TkId then 'ruby-identifier'
+ when RDoc::RubyToken::TkNode then 'ruby-node'
+ when RDoc::RubyToken::TkCOMMENT then 'ruby-comment'
+ when RDoc::RubyToken::TkREGEXP then 'ruby-regexp'
+ when RDoc::RubyToken::TkSTRING then 'ruby-string'
+ when RDoc::RubyToken::TkVal then 'ruby-value'
+ end
+
+ text = CGI.escapeHTML t.text
+
+ if style then
+ "<span class=\"#{style}\">#{text}</span>"
+ else
+ text
+ end
+ end.join
+ end
+
+ ##
# Adds +tokens+ to the collected tokens
def add_tokens(*tokens)
diff --git a/lib/rdoc/tom_doc.rb b/lib/rdoc/tom_doc.rb
new file mode 100644
index 0000000000..2b62243525
--- /dev/null
+++ b/lib/rdoc/tom_doc.rb
@@ -0,0 +1,257 @@
+# :markup: tomdoc
+
+# A parser for TomDoc based on TomDoc 1.0.0-rc1 (02adef9b5a)
+#
+# The TomDoc specification can be found at:
+#
+# http://tomdoc.org
+#
+# The latest version of the TomDoc specification can be found at:
+#
+# https://github.com/mojombo/tomdoc/blob/master/tomdoc.md
+#
+# To choose TomDoc as your only default format see RDoc::Options@Saved+Options
+# for instructions on setting up a <code>.rdoc_options</code> file to store
+# your project default.
+#
+# There are a few differences between this parser and the specification. A
+# best-effort was made to follow the specification as closely as possible but
+# some choices to deviate were made.
+#
+# A future version of RDoc will warn when a MUST or MUST NOT is violated and
+# may warn when a SHOULD or SHOULD NOT is violated. RDoc will always try
+# to emit documentation even if given invalid TomDoc.
+#
+# Here are some implementation choices this parser currently makes:
+#
+# This parser allows rdoc-style inline markup but you should not depended on
+# it.
+#
+# This parser allows a space between the comment and the method body.
+#
+# This parser does not require the default value to be described for an
+# optional argument.
+#
+# This parser does not examine the order of sections. An Examples section may
+# precede the Arguments section.
+#
+# This class is documented in TomDoc format. Since this is a subclass of the
+# RDoc markup parser there isn't much to see here, unfortunately.
+
+class RDoc::TomDoc < RDoc::Markup::Parser
+
+ # Internal: Token accessor
+
+ attr_reader :tokens
+
+ # Internal: Adds a post-processor which sets the RDoc section based on the
+ # comment's status.
+ #
+ # Returns nothing.
+
+ def self.add_post_processor # :nodoc:
+ RDoc::Markup::PreProcess.post_process do |comment, code_object|
+ next unless code_object and
+ RDoc::Comment === comment and comment.format == 'tomdoc'
+
+ comment.text.gsub!(/(\A\s*# )(Public|Internal|Deprecated):\s+/) do
+ section = code_object.add_section $2
+ code_object.temporary_section = section
+
+ $1
+ end
+ end
+ end
+
+ add_post_processor
+
+ # Public: Parses TomDoc from text
+ #
+ # text - A String containing TomDoc-format text.
+ #
+ # Examples
+ #
+ # RDoc::TomDoc.parse <<-TOMDOC
+ # This method does some things
+ #
+ # Returns nothing.
+ # TOMDOC
+ # # => #<RDoc::Markup::Document:0xXXX @parts=[...], @file=nil>
+ #
+ # Returns an RDoc::Markup::Document representing the TomDoc format.
+
+ def self.parse text
+ parser = new
+
+ parser.tokenize text
+ doc = RDoc::Markup::Document.new
+ parser.parse doc
+ doc
+ end
+
+ # Internal: Extracts the Signature section's method signature
+ #
+ # comment - An RDoc::Comment that will be parsed and have the signature
+ # extracted
+ #
+ # Returns a String containing the signature and nil if not
+
+ def self.signature comment
+ return unless comment.tomdoc?
+
+ document = comment.parse
+
+ signature = nil
+ found_heading = false
+ found_signature = false
+
+ document.parts.delete_if do |part|
+ next false if found_signature
+
+ found_heading ||=
+ RDoc::Markup::Heading === part && part.text == 'Signature'
+
+ next false unless found_heading
+
+ next true if RDoc::Markup::BlankLine === part
+
+ if RDoc::Markup::Verbatim === part then
+ signature = part
+ found_signature = true
+ end
+ end
+
+ signature and signature.text
+ end
+
+ # Public: Creates a new TomDoc parser. See also RDoc::Markup::parse
+
+ def initialize
+ super
+
+ @section = nil
+ @seen_returns = false
+ end
+
+ # Internal: Builds a heading from the token stream
+ #
+ # level - The level of heading to create
+ #
+ # Returns an RDoc::Markup::Heading
+
+ def build_heading level
+ heading = super
+
+ @section = heading.text
+
+ heading
+ end
+
+ # Internal: Builds a verbatim from the token stream. A verbatim in the
+ # Examples section will be marked as in Ruby format.
+ #
+ # margin - The indentation from the margin for lines that belong to this
+ # verbatim section.
+ #
+ # Returns an RDoc::Markup::Verbatim
+
+ def build_verbatim margin
+ verbatim = super
+
+ verbatim.format = :ruby if @section == 'Examples'
+
+ verbatim
+ end
+
+ # Internal: Builds a paragraph from the token stream
+ #
+ # margin - Unused
+ #
+ # Returns an RDoc::Markup::Paragraph.
+
+ def build_paragraph margin
+ p :paragraph_start => margin if @debug
+
+ paragraph = RDoc::Markup::Paragraph.new
+
+ until @tokens.empty? do
+ type, data, = get
+
+ case type
+ when :TEXT then
+ @section = 'Returns' if data =~ /\AReturns/
+
+ paragraph << data
+ when :NEWLINE then
+ if :TEXT == peek_token[0] then
+ paragraph << ' '
+ else
+ break
+ end
+ else
+ unget
+ break
+ end
+ end
+
+ p :paragraph_end => margin if @debug
+
+ 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.
+ #
+ # Returns self.
+
+ def tokenize text
+ text.sub!(/\A(Public|Internal|Deprecated):\s+/, '')
+
+ setup_scanner text
+
+ until @s.eos? do
+ pos = @s.pos
+
+ # leading spaces will be reflected by the column of the next token
+ # the only thing we loose are trailing spaces at the end of the file
+ next if @s.scan(/ +/)
+
+ @tokens << case
+ when @s.scan(/\r?\n/) then
+ token = [:NEWLINE, @s.matched, *token_pos(pos)]
+ @line_pos = char_pos @s.pos
+ @line += 1
+ token
+ when @s.scan(/(Examples|Signature)$/) then
+ @tokens << [:HEADER, 3, *token_pos(pos)]
+
+ [:TEXT, @s[1], *token_pos(pos)]
+ when @s.scan(/([:\w][\w\[\]]*)[ ]+- /) then
+ [:NOTE, @s[1], *token_pos(pos)]
+ else
+ @s.scan(/.*/)
+ [:TEXT, @s.matched.sub(/\r$/, ''), *token_pos(pos)]
+ end
+ end
+
+ self
+ end
+
+end
+
diff --git a/lib/rdoc/top_level.rb b/lib/rdoc/top_level.rb
index 3825a091fe..64d81d20c1 100644
--- a/lib/rdoc/top_level.rb
+++ b/lib/rdoc/top_level.rb
@@ -1,10 +1,10 @@
-require 'rdoc/context'
-
##
# A TopLevel context is a representation of the contents of a single file
class RDoc::TopLevel < RDoc::Context
+ MARSHAL_VERSION = 0 # :nodoc:
+
##
# This TopLevel's File::Stat struct
@@ -30,290 +30,32 @@ 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
##
- # Returns all classes discovered by RDoc
-
- def self.all_classes
- @all_classes_hash.values
- end
-
- ##
- # Returns all classes and modules discovered by RDoc
-
- def self.all_classes_and_modules
- @all_classes_hash.values + @all_modules_hash.values
- end
-
- ##
- # Hash of all classes known to RDoc
-
- def self.all_classes_hash
- @all_classes_hash
- end
-
- ##
- # All TopLevels known to RDoc
-
- def self.all_files
- @all_files_hash.values
- end
-
- ##
- # Hash of all files known to RDoc
-
- def self.all_files_hash
- @all_files_hash
- end
-
- ##
- # Returns all modules discovered by RDoc
-
- def self.all_modules
- all_modules_hash.values
- end
-
- ##
- # Hash of all modules known to RDoc
-
- def self.all_modules_hash
- @all_modules_hash
- end
-
- ##
- # Prepares the RDoc code object tree for use by a generator.
- #
- # It finds unique classes/modules defined, and replaces classes/modules that
- # are aliases for another one by a copy with RDoc::ClassModule#is_alias_for
- # set.
- #
- # It updates the RDoc::ClassModule#constant_aliases attribute of "real"
- # classes or modules.
- #
- # It also completely removes the classes and modules that should be removed
- # from the documentation and the methods that have a visibility below
- # +min_visibility+, which is the <tt>--visibility</tt> option.
- #
- # See also RDoc::Context#remove_from_documentation?
-
- def self.complete min_visibility
- fix_basic_object_inheritance
-
- # cache included modules before they are removed from the documentation
- all_classes_and_modules.each { |cm| cm.ancestors }
-
- remove_nodoc @all_classes_hash
- remove_nodoc @all_modules_hash
-
- @unique_classes = find_unique @all_classes_hash
- @unique_modules = find_unique @all_modules_hash
-
- unique_classes_and_modules.each do |cm|
- cm.complete min_visibility
- end
-
- @all_files_hash.each_key do |file_name|
- tl = @all_files_hash[file_name]
-
- unless RDoc::Parser::Simple === tl.parser then
- tl.modules_hash.clear
- tl.classes_hash.clear
-
- tl.classes_or_modules.each do |cm|
- name = cm.full_name
- if cm.type == 'class' then
- tl.classes_hash[name] = cm if @all_classes_hash[name]
- else
- tl.modules_hash[name] = cm if @all_modules_hash[name]
- end
- end
- end
- end
- end
-
- ##
- # Finds the class with +name+ in all discovered classes
-
- def self.find_class_named(name)
- @all_classes_hash[name]
- end
-
- ##
- # Finds the class with +name+ starting in namespace +from+
-
- def self.find_class_named_from name, from
- from = find_class_named from unless RDoc::Context === from
-
- until RDoc::TopLevel === from do
- return nil unless from
-
- klass = from.find_class_named name
- return klass if klass
-
- from = from.parent
- end
-
- find_class_named name
- end
-
- ##
- # Finds the class or module with +name+
-
- def self.find_class_or_module(name)
- name = $' if name =~ /^::/
- RDoc::TopLevel.classes_hash[name] || RDoc::TopLevel.modules_hash[name]
- end
-
- ##
- # Finds the file with +name+ in all discovered files
-
- def self.find_file_named(name)
- @all_files_hash[name]
- end
-
- ##
- # Finds the module with +name+ in all discovered modules
-
- def self.find_module_named(name)
- modules_hash[name]
- end
-
- ##
- # Finds unique classes/modules defined in +all_hash+,
- # and returns them as an array. Performs the alias
- # updates in +all_hash+: see ::complete.
- #--
- # TODO aliases should be registered by Context#add_module_alias
-
- def self.find_unique(all_hash)
- unique = []
-
- all_hash.each_pair do |full_name, cm|
- unique << cm if full_name == cm.full_name
- end
+ # Creates a new TopLevel for the file at +absolute_name+. If documentation
+ # is being generated outside the source dir +relative_name+ is relative to
+ # the source directory.
- unique
- end
-
- ##
- # Fixes the erroneous <tt>BasicObject < Object</tt> in 1.9.
- #
- # Because we assumed all classes without a stated superclass
- # inherit from Object, we have the above wrong inheritance.
- #
- # We fix BasicObject right away if we are running in a Ruby
- # version >= 1.9. If not, we may be documenting 1.9 source
- # while running under 1.8: we search the files of BasicObject
- # for "object.c", and fix the inheritance if we find it.
-
- def self.fix_basic_object_inheritance
- basic = all_classes_hash['BasicObject']
- return unless basic
- if RUBY_VERSION >= '1.9'
- basic.superclass = nil
- elsif basic.in_files.any? { |f| File.basename(f.full_name) == 'object.c' }
- basic.superclass = nil
- end
- end
-
- ##
- # Creates a new RDoc::TopLevel with +file_name+ only if one with the same
- # name does not exist in all_files.
-
- def self.new file_name
- if top_level = @all_files_hash[file_name] then
- top_level
- else
- top_level = super
- @all_files_hash[file_name] = top_level
- top_level
- end
- end
-
- ##
- # Removes from +all_hash+ the contexts that are nodoc or have no content.
- #
- # See RDoc::Context#remove_from_documentation?
-
- def self.remove_nodoc(all_hash)
- all_hash.keys.each do |name|
- context = all_hash[name]
- all_hash.delete(name) if context.remove_from_documentation?
- end
- end
-
- ##
- # Empties RDoc of stored class, module and file information
-
- def self.reset
- @all_classes_hash = {}
- @all_modules_hash = {}
- @all_files_hash = {}
- end
-
- ##
- # Returns the unique classes discovered by RDoc.
- #
- # ::complete must have been called prior to using this method.
-
- def self.unique_classes
- @unique_classes
- end
-
- ##
- # Returns the unique classes and modules discovered by RDoc.
- # ::complete must have been called prior to using this method.
-
- def self.unique_classes_and_modules
- @unique_classes + @unique_modules
- end
-
- ##
- # Returns the unique modules discovered by RDoc.
- # ::complete must have been called prior to using this method.
-
- def self.unique_modules
- @unique_modules
- end
-
- class << self
- alias classes all_classes
- alias classes_hash all_classes_hash
-
- alias files all_files
- alias files_hash all_files_hash
-
- alias modules all_modules
- alias modules_hash all_modules_hash
- end
-
- reset
-
- ##
- # Creates a new TopLevel for +file_name+
-
- def initialize(file_name)
+ def initialize absolute_name, relative_name = absolute_name
super()
@name = nil
- @relative_name = file_name
- @absolute_name = file_name
- @file_stat = File.stat(file_name) rescue nil # HACK for testing
+ @absolute_name = absolute_name
+ @relative_name = relative_name
+ @file_stat = File.stat(absolute_name) rescue nil # HACK for testing
@diagram = nil
@parser = nil
@classes_or_modules = []
-
- RDoc::TopLevel.files_hash[file_name] = self
end
##
- # An RDoc::TopLevel is equal to another with the same absolute_name
+ # An RDoc::TopLevel is equal to another with the same relative_name
def == other
- other.class === self and @absolute_name == other.absolute_name
+ self.class === other and @relative_name == other.relative_name
end
alias eql? ==
@@ -330,7 +72,7 @@ class RDoc::TopLevel < RDoc::Context
##
# Adds +constant+ to +Object+ instead of +self+.
- def add_constant(constant)
+ def add_constant constant
object_class.record_location self
return constant unless @document_self
object_class.add_constant constant
@@ -356,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
@@ -366,19 +108,27 @@ class RDoc::TopLevel < RDoc::Context
# Base name of this file
def base_name
- File.basename @absolute_name
+ File.basename @relative_name
end
alias name base_name
##
+ # Only a TopLevel that contains text file) will be displayed. See also
+ # RDoc::CodeObject#display?
+
+ def display?
+ text? and super
+ end
+
+ ##
# See RDoc::TopLevel::find_class_or_module
#--
# TODO Why do we search through all classes/modules found, not just the
# ones of this instance?
def find_class_or_module name
- RDoc::TopLevel.find_class_or_module name
+ @store.find_class_or_module name
end
##
@@ -404,10 +154,10 @@ class RDoc::TopLevel < RDoc::Context
##
# An RDoc::TopLevel has the same hash as another with the same
- # absolute_name
+ # relative_name
def hash
- @absolute_name.hash
+ @relative_name.hash
end
##
@@ -436,23 +186,57 @@ class RDoc::TopLevel < RDoc::Context
end
##
+ # Dumps this TopLevel for use by ri. See also #marshal_load
+
+ def marshal_dump
+ [
+ MARSHAL_VERSION,
+ @relative_name,
+ @parser,
+ parse(@comment),
+ ]
+ end
+
+ ##
+ # Loads this TopLevel from +array+.
+
+ def marshal_load array # :nodoc:
+ initialize array[1]
+
+ @parser = array[2]
+ @comment = array[3]
+
+ @file_stat = nil
+ end
+
+ ##
# Returns the NormalClass "Object", creating it if not found.
#
# Records +self+ as a location in "Object".
def object_class
@object_class ||= begin
- oc = self.class.find_class_named('Object') || add_class(RDoc::NormalClass, 'Object')
+ oc = @store.find_class_named('Object') || add_class(RDoc::NormalClass, 'Object')
oc.record_location self
oc
end
end
##
- # Path to this file
+ # Base name of this file without the extension
+
+ def page_name
+ basename = File.basename @relative_name
+ basename =~ /\.(rb|rdoc|txt|md)$/i
+
+ $` || basename
+ end
+
+ ##
+ # Path to this file for use with HTML generator output.
def path
- http_url RDoc::RDoc.current.generator.file_dir
+ http_url @store.rdoc.generator.file_dir
end
def pretty_print q # :nodoc:
@@ -461,11 +245,35 @@ class RDoc::TopLevel < RDoc::Context
q.breakable
items = @modules.map { |n,m| m }
- items.push(*@modules.map { |n,c| c })
+ items.concat @modules.map { |n,c| c }
q.seplist items do |mod| q.pp mod end
end
end
+ ##
+ # Search record used by RDoc::Generator::JsonIndex
+
+ def search_record
+ return unless @parser < RDoc::Parser::Text
+
+ [
+ page_name,
+ '',
+ page_name,
+ '',
+ path,
+ '',
+ snippet(@comment),
+ ]
+ end
+
+ ##
+ # Is this TopLevel from a text file instead of a source code file?
+
+ def text?
+ @parser and @parser.ancestors.include? RDoc::Parser::Text
+ end
+
def to_s # :nodoc:
"file #{full_name}"
end
diff --git a/lib/resolv-replace.rb b/lib/resolv-replace.rb
index ff34f90db4..3e28a843fd 100644
--- a/lib/resolv-replace.rb
+++ b/lib/resolv-replace.rb
@@ -19,7 +19,7 @@ class TCPSocket < IPSocket
alias original_resolv_initialize initialize
# :startdoc:
def initialize(host, serv, *rest)
- rest[0] = IPSocket.getaddress(rest[0]) unless rest.empty?
+ rest[0] = IPSocket.getaddress(rest[0]) if rest[0]
original_resolv_initialize(IPSocket.getaddress(host), serv, *rest)
end
end
diff --git a/lib/resolv.rb b/lib/resolv.rb
index 1e1889370a..d8ee487cfc 100644
--- a/lib/resolv.rb
+++ b/lib/resolv.rb
@@ -9,7 +9,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 +165,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
@@ -336,6 +337,21 @@ class Resolv
@initialized = nil
end
+ # Sets the resolver timeouts. This may be a single positive number
+ # or an array of positive numbers representing timeouts in seconds.
+ # If an array is specified, a DNS request will retry and wait for
+ # each successive interval in the array until a successful response
+ # is received. Specifying +nil+ reverts to the default timeouts:
+ # [ 5, second = 5 * 2 / nameserver_count, 2 * second, 4 * second ]
+ #
+ # Example:
+ #
+ # dns.timeouts = 3
+ #
+ def timeouts=(values)
+ @config.timeouts = values
+ end
+
def lazy_initialize # :nodoc:
@mutex.synchronize {
unless @initialized
@@ -491,6 +507,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 = {}
@@ -517,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
@@ -630,7 +652,7 @@ class Resolv
begin
port = rangerand(1024..65535)
udpsock.bind(bind_host, port)
- rescue Errno::EADDRINUSE
+ rescue Errno::EADDRINUSE, Errno::EACCES
retry
end
end
@@ -642,16 +664,24 @@ class Resolv
end
def request(sender, tout)
- timelimit = Time.now + tout
- sender.send
+ start = Time.now
+ timelimit = start + tout
+ begin
+ sender.send
+ rescue Errno::EHOSTUNREACH
+ # multi-homed IPv6 may generate this
+ raise ResolvTimeout
+ end
while true
- now = Time.now
- timeout = timelimit - now
+ before_select = Time.now
+ timeout = timelimit - before_select
if timeout <= 0
raise ResolvTimeout
end
select_result = IO.select(@socks, nil, nil, timeout)
if !select_result
+ after_select = Time.now
+ next if after_select < timelimit
raise ResolvTimeout
end
begin
@@ -667,7 +697,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
@@ -676,6 +706,10 @@ class Resolv
return msg, s.data
end
+ def sender_for(addr, msg)
+ @senders[[addr,msg.id]]
+ end
+
def close
socks = @socks
@socks = nil
@@ -796,6 +830,21 @@ class Resolv
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()
@@ -851,6 +900,20 @@ class Resolv
@mutex = Mutex.new
@config_info = config_info
@initialized = nil
+ @timeouts = nil
+ end
+
+ def timeouts=(values)
+ if values
+ 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"
+ end
+ @timeouts = values
+ else
+ @timeouts = nil
+ end
end
def Config.parse_resolv_conf(filename)
@@ -1013,7 +1076,7 @@ class Resolv
def resolv(name)
candidates = generate_candidates(name)
- timeouts = generate_timeouts
+ timeouts = @timeouts || generate_timeouts
begin
candidates.each {|candidate|
begin
@@ -1917,6 +1980,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
@@ -1924,7 +2078,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
]
##
@@ -2350,11 +2504,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.to_s}>"
+ 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.to_s}>"
+ 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.to_s}>"
+ 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..803d0217b1 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
diff --git a/lib/rexml/document.rb b/lib/rexml/document.rb
index b945a5b76c..1e18263dda 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"
@@ -144,6 +145,10 @@ module REXML
xml_decl().stand_alone?
end
+ # :call-seq:
+ # doc.write(output=$stdout, indent=-1, transtive=false, ie_hack=false, encoding=nil)
+ # doc.write(options={:output => $stdout, :indent => -1, :transtive => false, :ie_hack => false, :encoding => nil})
+ #
# Write the XML tree out, optionally with indent. This writes out the
# entire XML document, including XML declarations, doctype declarations,
# and processing instructions (if any are given).
@@ -154,18 +159,30 @@ module REXML
# specified, because it adds unnecessary bandwidth to applications such
# as XML-RPC.
#
+ # Accept Nth argument style and options Hash style as argument.
+ # The recommended style is options Hash style for one or more
+ # arguments case.
+ #
+ # _Examples_
+ # Document.new("<a><b/></a>").write
+ #
+ # output = ""
+ # Document.new("<a><b/></a>").write(output)
+ #
+ # output = ""
+ # Document.new("<a><b/></a>").write(:output => output, :indent => 2)
+ #
# See also the classes in the rexml/formatters package for the proper way
- # to change the default formatting of XML output
+ # to change the default formatting of XML output.
#
# _Examples_
- # Document.new("<a><b/></a>").serialize
#
- # output_string = ""
- # tr = Transitive.new( output_string )
- # Document.new("<a><b/></a>").serialize( tr )
+ # output = ""
+ # tr = Transitive.new
+ # tr.write(Document.new("<a><b/></a>"), output)
#
# output::
- # output an object which supports '<< string'; this is where the
+ # output an object which supports '<< string'; this is where the
# document will be written.
# indent::
# An integer. If -1, no indenting will be used; otherwise, the
@@ -178,14 +195,33 @@ 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
- def write( output=$stdout, indent=-1, transitive=false, ie_hack=false )
- if xml_decl.encoding != 'UTF-8' && !output.kind_of?(Output)
- output = Output.new( output, xml_decl.encoding )
+ # 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.
+ # Defaults to nil. It means encoding in XML declaration is used.
+ def write(*arguments)
+ if arguments.size == 1 and arguments[0].class == Hash
+ options = arguments[0]
+
+ output = options[:output]
+ indent = options[:indent]
+ transitive = options[:transitive]
+ ie_hack = options[:ie_hack]
+ encoding = options[:encoding]
+ else
+ output, indent, transitive, ie_hack, encoding, = *arguments
+ end
+
+ output ||= $stdout
+ indent ||= -1
+ transitive = false if transitive.nil?
+ ie_hack = false if ie_hack.nil?
+ encoding ||= xml_decl.encoding
+
+ if encoding != 'UTF-8' && !output.kind_of?(Output)
+ output = Output.new( output, encoding )
end
formatter = if indent > -1
if transitive
@@ -205,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 10000.
+ # 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/element.rb b/lib/rexml/element.rb
index 5991859a78..c30b150c0b 100644
--- a/lib/rexml/element.rb
+++ b/lib/rexml/element.rb
@@ -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'
@@ -895,17 +892,17 @@ module REXML
# that XPaths are automatically filtered for Elements, so that
# non-Element children will not be yielded
# doc = Document.new '<a><b/><c/><d/>sean<b/><c/><d/></a>'
- # doc.root.each {|e|p e} #-> Yields b, c, d, b, c, d elements
- # doc.root.each('b') {|e|p e} #-> Yields b, b elements
- # doc.root.each('child::node()') {|e|p e}
+ # doc.root.elements.each {|e|p e} #-> Yields b, c, d, b, c, d elements
+ # doc.root.elements.each('b') {|e|p e} #-> Yields b, b elements
+ # doc.root.elements.each('child::node()') {|e|p e}
# #-> Yields <b/>, <c/>, <d/>, <b/>, <c/>, <d/>
# XPath.each(doc.root, 'child::node()', &block)
# #-> Yields <b/>, <c/>, <d/>, sean, <b/>, <c/>, <d/>
- def each( xpath=nil, &block)
+ def each( xpath=nil )
XPath::each( @element, xpath ) {|e| yield e if e.kind_of? Element }
end
- def collect( xpath=nil, &block )
+ def collect( xpath=nil )
collection = []
XPath::each( @element, xpath ) {|e|
collection << yield(e) if e.kind_of?(Element)
@@ -913,7 +910,7 @@ module REXML
collection
end
- def inject( xpath=nil, initial=nil, &block )
+ def inject( xpath=nil, initial=nil )
first = true
XPath::each( @element, xpath ) {|e|
if (e.kind_of? Element)
@@ -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.
diff --git a/lib/rexml/encoding.rb b/lib/rexml/encoding.rb
index d1d5172841..1c7e79a124 100644
--- a/lib/rexml/encoding.rb
+++ b/lib/rexml/encoding.rb
@@ -1,3 +1,4 @@
+# coding: US-ASCII
module REXML
module Encoding
# ID ---> Encoding name
@@ -20,19 +21,6 @@ module REXML
true
end
- def check_encoding(xml)
- # We have to recognize UTF-16BE, UTF-16LE, and UTF-8
- if xml[0, 2] == "\xfe\xff"
- xml[0, 2] = ""
- return 'UTF-16BE'
- elsif xml[0, 2] == "\xff\xfe"
- xml[0, 2] = ""
- return 'UTF-16LE'
- end
- xml =~ /^\s*<\?xml\s+version\s*=\s*(['"]).*?\1\s+encoding\s*=\s*(["'])(.*?)\2/m
- return $3 ? $3.upcase : 'UTF-8'
- end
-
def encode(string)
string.encode(@encoding)
end
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/light/node.rb b/lib/rexml/light/node.rb
index 0a896c83dc..b33f78f7ce 100644
--- a/lib/rexml/light/node.rb
+++ b/lib/rexml/light/node.rb
@@ -40,7 +40,7 @@ module REXML
end
end
- def each( &block )
+ def each
size.times { |x| yield( at(x+4) ) }
end
diff --git a/lib/rexml/output.rb b/lib/rexml/output.rb
index 50333ba177..0c6cc7a7f8 100644
--- a/lib/rexml/output.rb
+++ b/lib/rexml/output.rb
@@ -10,7 +10,12 @@ module REXML
@output = real_IO
self.encoding = encd
- @to_utf = encd != 'UTF-8'
+ @to_utf = encoding != 'UTF-8'
+
+ if encoding == "UTF-16"
+ @output << "\ufeff".encode("UTF-16BE")
+ self.encoding = "UTF-16BE"
+ end
end
def <<( content )
diff --git a/lib/rexml/parsers/baseparser.rb b/lib/rexml/parsers/baseparser.rb
index 2df26b82f9..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
@@ -212,7 +213,12 @@ module REXML
version = version[1] unless version.nil?
encoding = ENCODING.match(results)
encoding = encoding[1] unless encoding.nil?
- @source.encoding = encoding
+ if need_source_encoding_update?(encoding)
+ @source.encoding = encoding
+ end
+ if encoding.nil? and /\AUTF-16(?:BE|LE)\z/i =~ @source.encoding
+ encoding = "UTF-16"
+ end
standalone = STANDALONE.match(results)
standalone = standalone[1] unless standalone.nil?
return [ :xmldecl, version, encoding, standalone ]
@@ -277,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
@@ -317,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
@@ -373,31 +380,31 @@ module REXML
if md[4].size > 0
attrs = md[4].scan( ATTRIBUTE_PATTERN )
raise REXML::ParseException.new( "error parsing attributes: [#{attrs.join ', '}], excess = \"#$'\"", @source) if $' and $'.strip.size > 0
- attrs.each { |a,b,c,d,e|
- if b == "xmlns"
- if c == "xml"
- if e != "http://www.w3.org/XML/1998/namespace"
+ attrs.each do |attr_name, prefix, local_part, quote, value|
+ if prefix == "xmlns"
+ if local_part == "xml"
+ if value != "http://www.w3.org/XML/1998/namespace"
msg = "The 'xml' prefix must not be bound to any other namespace "+
"(http://www.w3.org/TR/REC-xml-names/#ns-decl)"
raise REXML::ParseException.new( msg, @source, self )
end
- elsif c == "xmlns"
+ elsif local_part == "xmlns"
msg = "The 'xmlns' prefix must not be declared "+
"(http://www.w3.org/TR/REC-xml-names/#ns-decl)"
raise REXML::ParseException.new( msg, @source, self)
end
- curr_ns << c
- elsif b
- prefixes << b unless b == "xml"
+ curr_ns << local_part
+ elsif prefix
+ prefixes << prefix unless prefix == "xml"
end
- if attributes.has_key? a
- msg = "Duplicate attribute #{a.inspect}"
- raise REXML::ParseException.new( msg, @source, self)
+ if attributes.has_key?(attr_name)
+ msg = "Duplicate attribute #{attr_name.inspect}"
+ raise REXML::ParseException.new(msg, @source, self)
end
- attributes[a] = e
- }
+ attributes[attr_name] = value
+ end
end
# Verify that all of the prefixes have been defined
@@ -493,6 +500,13 @@ module REXML
end
rv
end
+
+ private
+ def need_source_encoding_update?(xml_declaration_encoding)
+ return false if xml_declaration_encoding.nil?
+ return false if /\AUTF-16\z/i =~ xml_declaration_encoding
+ true
+ end
end
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/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 112393cfd4..b653714b2f 100644
--- a/lib/rexml/source.rb
+++ b/lib/rexml/source.rb
@@ -1,3 +1,4 @@
+# coding: US-ASCII
require 'rexml/encoding'
module REXML
@@ -43,7 +44,7 @@ module REXML
if encoding
self.encoding = encoding
else
- self.encoding = check_encoding( @buffer )
+ detect_encoding
end
@line = 0
end
@@ -53,14 +54,7 @@ module REXML
# Overridden to support optimized en/decoding
def encoding=(enc)
return unless super
- @line_break = encode( '>' )
- if @encoding != 'UTF-8'
- @buffer = decode(@buffer)
- @to_utf = true
- else
- @to_utf = false
- @buffer.force_encoding ::Encoding::UTF_8
- end
+ encoding_updated
end
# Scans the source for a given pattern. Note, that this is not your
@@ -125,6 +119,38 @@ module REXML
res = res[-1] if res.kind_of? Array
lines.index( res ) if res
end
+
+ private
+ def detect_encoding
+ buffer_encoding = @buffer.encoding
+ detected_encoding = "UTF-8"
+ begin
+ @buffer.force_encoding("ASCII-8BIT")
+ if @buffer[0, 2] == "\xfe\xff"
+ @buffer[0, 2] = ""
+ detected_encoding = "UTF-16BE"
+ elsif @buffer[0, 2] == "\xff\xfe"
+ @buffer[0, 2] = ""
+ detected_encoding = "UTF-16LE"
+ elsif @buffer[0, 3] == "\xef\xbb\xbf"
+ @buffer[0, 3] = ""
+ detected_encoding = "UTF-8"
+ end
+ ensure
+ @buffer.force_encoding(buffer_encoding)
+ end
+ self.encoding = detected_encoding
+ end
+
+ def encoding_updated
+ if @encoding != 'UTF-8'
+ @buffer = decode(@buffer)
+ @to_utf = true
+ else
+ @to_utf = false
+ @buffer.force_encoding ::Encoding::UTF_8
+ end
+ end
end
# A Source that wraps an IO. See the Source class for method
@@ -136,30 +162,13 @@ module REXML
def initialize(arg, block_size=500, encoding=nil)
@er_source = @source = arg
@to_utf = false
+ @pending_buffer = nil
- # Determining the encoding is a deceptively difficult issue to resolve.
- # First, we check the first two bytes for UTF-16. Then we
- # assume that the encoding is at least ASCII enough for the '>', and
- # we read until we get one of those. This gives us the XML declaration,
- # if there is one. If there isn't one, the file MUST be UTF-8, as per
- # the XML spec. If there is one, we can determine the encoding from
- # it.
- @buffer = ""
- str = @source.read( 2 ) || ''
if encoding
- self.encoding = encoding
- elsif str[0,2] == "\xfe\xff"
- @line_break = "\000>"
- elsif str[0,2] == "\xff\xfe"
- @line_break = ">\000"
- elsif str[0,2] == "\xef\xbb"
- str += @source.read(1)
- str = '' if (str[2,1] == "\xBF")
- @line_break = ">"
+ super("", encoding)
else
- @line_break = ">"
+ super(@source.read(3) || "")
end
- super( @source.eof? ? str : str+@source.readline( @line_break ) )
if !@to_utf and
@buffer.respond_to?(:force_encoding) and
@@ -254,6 +263,14 @@ module REXML
private
def readline
str = @source.readline(@line_break)
+ if @pending_buffer
+ if str.nil?
+ str = @pending_buffer
+ else
+ str = @pending_buffer + str
+ end
+ @pending_buffer = nil
+ end
return nil if str.nil?
if @to_utf
@@ -263,5 +280,17 @@ module REXML
str
end
end
+
+ def encoding_updated
+ case @encoding
+ when "UTF-16BE", "UTF-16LE"
+ @source.binmode
+ @source.set_encoding(@encoding)
+ end
+ @line_break = encode(">")
+ @pending_buffer, @buffer = @buffer, ""
+ @pending_buffer.force_encoding(@encoding)
+ super
+ end
end
end
diff --git a/lib/rexml/streamlistener.rb b/lib/rexml/streamlistener.rb
index 619c529578..8805ffba4d 100644
--- a/lib/rexml/streamlistener.rb
+++ b/lib/rexml/streamlistener.rb
@@ -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/xmldecl.rb b/lib/rexml/xmldecl.rb
index 361e4b7106..465e6abeb7 100644
--- a/lib/rexml/xmldecl.rb
+++ b/lib/rexml/xmldecl.rb
@@ -46,11 +46,7 @@ module REXML
def write(writer, indent=-1, transitive=false, ie_hack=false)
return nil unless @writethis or writer.kind_of? Output
writer << START.sub(/\\/u, '')
- if writer.kind_of? Output
- writer << " #{content writer.encoding}"
- else
- writer << " #{content encoding}"
- end
+ writer << " #{content encoding}"
writer << STOP.sub(/\\/u, '')
end
@@ -111,7 +107,7 @@ module REXML
private
def content(enc)
rv = "version='#@version'"
- rv << " encoding='#{enc}'" if @writeencoding || enc !~ /utf-8/i
+ rv << " encoding='#{enc}'" if @writeencoding || enc !~ /\Autf-8\z/i
rv << " standalone='#@standalone'" if @standalone
rv
end
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 3ff4606e2a..29ea5f0ff6 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,28 @@ module Rinda
# address of the local TupleSpace.
def do_reply
- tuple = @ts.take([:lookup_ring, DRbObject])
+ tuple = @ts.take([:lookup_ring, DRbObject], @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
+ end
+
+ @sockets.each do |socket|
+ socket.close
+ end
+
+ @r_service.kill
+ end
+
end
##
@@ -92,6 +241,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 +307,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 +331,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 +372,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
@@ -203,16 +389,58 @@ module Rinda
queue.push(ts)
end
queue.push(nil)
+ end
+
+ @primary = queue.pop
+ raise('RingNotFound') if @primary.nil?
+
+ Thread.new do
while it = queue.pop
@rings.push(it)
end
end
- @primary = queue.pop
- raise('RingNotFound') if @primary.nil?
@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)
+
+ if addrinfo.ipv4_multicast? then
+ soc.setsockopt(:IPPROTO_IP, :IP_MULTICAST_LOOP, true)
+ soc.setsockopt(:IPPROTO_IP, :IP_MULTICAST_TTL,
+ [@multicast_hops].pack('c'))
+ elsif addrinfo.ipv6_multicast? then
+ soc.setsockopt(:IPPROTO_IPV6, :IPV6_MULTICAST_LOOP, true)
+ soc.setsockopt(:IPPROTO_IPV6, :IPV6_MULTICAST_HOPS,
+ [@multicast_hops].pack('I'))
+ soc.setsockopt(:IPPROTO_IPV6, :IPV6_MULTICAST_IF,
+ [@multicast_interface].pack('I'))
+ else
+ soc.setsockopt(:SOL_SOCKET, :SO_BROADCAST, true)
+ end
+
+ soc.connect(addrinfo)
+
+ soc
+ end
+
+ def send_message(address, message) # :nodoc:
+ soc = make_socket(address)
+
+ soc.send(message, 0)
+ rescue
+ nil
+ ensure
+ soc.close if soc
+ end
+
end
##
diff --git a/lib/rinda/tuplespace.rb b/lib/rinda/tuplespace.rb
index 113aa0de15..ee2bef1769 100644
--- a/lib/rinda/tuplespace.rb
+++ b/lib/rinda/tuplespace.rb
@@ -305,7 +305,7 @@ module Rinda
@bin.delete_at(idx) if idx
end
- def find(&blk)
+ def find
@bin.reverse_each do |x|
return x if yield(x)
end
@@ -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 f6fea386ba..d3524231ff 100644
--- a/lib/rss/atom.rb
+++ b/lib/rss/atom.rb
@@ -1,6 +1,14 @@
require 'rss/parser'
module RSS
+ ##
+ # Atom is an XML-based document format that is used to describe 'feeds' of related information.
+ # A typical use is in a news feed where the information is periodically updated and which users
+ # can subscribe to. The Atom format is described in http://tools.ietf.org/html/rfc4287
+ #
+ # The Atom module provides support in reading and creating feeds.
+ #
+ # See the RSS module for examples consuming and creating feeds.
module Atom
##
@@ -82,6 +90,10 @@ module RSS
end
end
+ # The TextConstruct module is used to define a Text construct Atom element,
+ # which is used to store small quantities of human-readable text
+ #
+ # The TextConstruct has a type attribute, e.g. text, html, xhtml
module TextConstruct
def self.append_features(klass)
super
@@ -108,6 +120,7 @@ module RSS
end
attr_writer :xhtml
+
def xhtml
return @xhtml if @xhtml.nil?
if @xhtml.is_a?(XML::Element) and
@@ -121,6 +134,7 @@ module RSS
{"xmlns" => XHTML_URI}, children)
end
+ # Returns true if type is "xhtml"
def have_xml_content?
@type == "xhtml"
end
@@ -148,7 +162,13 @@ module RSS
end
end
+ # The PersonConstruct module is used to define a Person Atom element that can be
+ # used to describe a person, corporation, or similar entity
+ #
+ # The PersonConstruct has a Name, Uri, and Email child elements
module PersonConstruct
+
+ # Adds attributes for name, uri, and email to the +klass+
def self.append_features(klass)
super
klass.class_eval do
@@ -166,22 +186,30 @@ module RSS
target.__send__("new_#{self.class.name.split(/::/).last.downcase}")
end
+ # The name of the person or entity
class Name < RSS::Element
include CommonModel
include ContentModel
end
+ # The URI of the person or entity
class Uri < RSS::Element
include CommonModel
include URIContentModel
end
+ # The email of the person or entity
class Email < RSS::Element
include CommonModel
include ContentModel
end
end
+ # Element used to describe an Atom date and time in the ISO 8601 format
+ #
+ # Examples:
+ # * 2013-03-04T15:30:02Z
+ # * 2013-03-04T10:30:02-05:00
module DateConstruct
def self.append_features(klass)
super
@@ -191,12 +219,17 @@ module RSS
end
end
+ # Raises NotAvailableValueError if element content is nil
def atom_validate(ignore_unknown_element, tags, uri)
raise NotAvailableValueError.new(tag_name, "") if content.nil?
end
end
module DuplicateLinkChecker
+ # Checks if there are duplicate links with the same type and hreflang attributes
+ # that have an alternate (or empty) rel attribute
+ #
+ # Raises a TooMuchTagError if there are duplicates found
def validate_duplicate_links(links)
link_infos = {}
links.each do |link|
@@ -211,6 +244,9 @@ module RSS
end
end
+ # Atom feed element
+ #
+ # A Feed has several metadata attributes in addition to a number of Entry child elements
class Feed < RSS::Element
include RootElementMixin
include CommonModel
@@ -238,6 +274,7 @@ module RSS
tag, URI, occurs, tag, *args)
end
+ # Creates a new Atom feed
def initialize(version=nil, encoding=nil, standalone=nil)
super("1.0", version, encoding, standalone)
@feed_type = "atom"
@@ -246,6 +283,8 @@ module RSS
alias_method :items, :entries
+ # Returns true if there are any authors for the feed or any of the Entry
+ # child elements have an author
def have_author?
authors.any? {|author| !author.to_s.empty?} or
entries.any? {|entry| entry.have_author?(false)}
@@ -329,16 +368,32 @@ module RSS
end
end
+ # Atom Icon element
+ #
+ # Image that provides a visual identification for the Feed. Image should have an aspect
+ # ratio of 1:1
class Icon < RSS::Element
include CommonModel
include URIContentModel
end
+ # Atom ID element
+ #
+ # Universally Unique Identifier (UUID) for the Feed
class Id < RSS::Element
include CommonModel
include URIContentModel
end
+ # Defines an Atom Link element
+ #
+ # A Link has the following attributes:
+ # * href
+ # * rel
+ # * type
+ # * hreflang
+ # * title
+ # * length
class Link < RSS::Element
include CommonModel
@@ -359,6 +414,10 @@ module RSS
end
end
+ # Atom Logo element
+ #
+ # Image that provides a visual identification for the Feed. Image should have an aspect
+ # ratio of 2:1 (horizontal:vertical)
class Logo < RSS::Element
include CommonModel
include URIContentModel
@@ -373,26 +432,40 @@ module RSS
end
end
+ # Atom Rights element
+ #
+ # TextConstruct that contains copyright information regarding the content in an Entry or Feed
class Rights < RSS::Element
include CommonModel
include TextConstruct
end
+ # Atom Subtitle element
+ #
+ # TextConstruct that conveys a description or subtitle for a Feed
class Subtitle < RSS::Element
include CommonModel
include TextConstruct
end
+ # Atom Title element
+ #
+ # TextConstruct that conveys a description or title for a feed or Entry
class Title < RSS::Element
include CommonModel
include TextConstruct
end
+ # Atom Updated element
+ #
+ # DateConstruct indicating the most recent time when an Entry or Feed was modified
+ # in a way the publisher considers significant
class Updated < RSS::Element
include CommonModel
include DateConstruct
end
+ # Defines a child Atom Entry element for an Atom Feed
class Entry < RSS::Element
include CommonModel
include DuplicateLinkChecker
@@ -416,6 +489,10 @@ module RSS
tag, URI, occurs, tag, *args)
end
+ # Returns whether any of the following are true
+ # * There are any authors in the feed
+ # * If the parent element has an author and the +check_parent+ parameter was given.
+ # * There is a source element that has an author
def have_author?(check_parent=true)
authors.any? {|author| !author.to_s.empty?} or
(check_parent and @parent and @parent.have_author?) or
@@ -642,6 +719,8 @@ module RSS
end
end
+ # Defines a top-level Atom Entry element
+ #
class Entry < RSS::Element
include RootElementMixin
include CommonModel
@@ -666,21 +745,25 @@ module RSS
tag, URI, occurs, tag, *args)
end
+ # Creates a new Atom Entry element
def initialize(version=nil, encoding=nil, standalone=nil)
super("1.0", version, encoding, standalone)
@feed_type = "atom"
@feed_subtype = "entry"
end
+ # Returns the Entry in an array
def items
[self]
end
+ # sets up the +maker+ for constructing Entry elements
def setup_maker(maker)
maker = maker.maker if maker.respond_to?("maker")
super(maker)
end
+ # Returns where there are any authors present or there is a source with an author
def have_author?
authors.any? {|author| !author.to_s.empty?} or
(source and source.have_author?)
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.rb b/lib/rss/maker.rb
index a7ee200b32..824b2b2dcd 100644
--- a/lib/rss/maker.rb
+++ b/lib/rss/maker.rb
@@ -1,32 +1,56 @@
require "rss/rss"
module RSS
+ ##
+ #
+ # Provides a set of builders for various RSS objects
+ #
+ # * Feeds
+ # * RSS 0.91
+ # * RSS 1.0
+ # * RSS 2.0
+ # * Atom 1.0
+ #
+ # * Elements
+ # * Atom::Entry
+
module Maker
+
+ # Collection of supported makers
MAKERS = {}
class << self
+ # Builder for an RSS object
+ # Creates an object of the type passed in +args+
+ #
+ # Executes the +block+ to populate elements of the created RSS object
def make(version, &block)
self[version].make(&block)
end
+ # Returns the maker for the +version+
def [](version)
maker_info = maker(version)
raise UnsupportedMakerVersionError.new(version) if maker_info.nil?
maker_info[:maker]
end
+ # Adds a maker to the set of supported makers
def add_maker(version, normalized_version, maker)
MAKERS[version] = {:maker => maker, :version => normalized_version}
end
+ # Returns collection of supported maker versions
def versions
MAKERS.keys.uniq.sort
end
+ # Returns collection of supported makers
def makers
- MAKERS.values.collect {|info| info[:maker]}.uniq
+ MAKERS.values.collect { |info| info[:maker] }.uniq
end
+ # Returns true if the version is supported
def supported?(version)
versions.include?(version)
end
diff --git a/lib/rss/maker/base.rb b/lib/rss/maker/base.rb
index fa2b02d101..36860032da 100644
--- a/lib/rss/maker/base.rb
+++ b/lib/rss/maker/base.rb
@@ -23,8 +23,8 @@ module RSS
end
def inherited(subclass)
- subclass.const_set("OTHER_ELEMENTS", [])
- subclass.const_set("NEED_INITIALIZE_VARIABLES", [])
+ subclass.const_set(:OTHER_ELEMENTS, [])
+ subclass.const_set(:NEED_INITIALIZE_VARIABLES, [])
end
def add_other_element(variable_name)
@@ -353,7 +353,7 @@ module RSS
module SetupDefaultDate
private
- def _set_default_values(&block)
+ def _set_default_values
keep = {
:date => date,
:dc_dates => dc_dates.to_a.dup,
@@ -365,7 +365,7 @@ module RSS
dc_dates.unshift(dc_date)
end
self.date ||= self.dc_date
- super(&block)
+ super
ensure
date = keep[:date]
dc_dates.replace(keep[:dc_dates])
@@ -379,7 +379,7 @@ module RSS
module SetupDefaultLanguage
private
- def _set_default_values(&block)
+ def _set_default_values
keep = {
:dc_languages => dc_languages.to_a.dup,
}
@@ -390,7 +390,7 @@ module RSS
dc_language.value = _language.dup
dc_languages.unshift(dc_language)
end
- super(&block)
+ super
ensure
dc_languages.replace(keep[:dc_languages])
end
diff --git a/lib/rss/maker/entry.rb b/lib/rss/maker/entry.rb
index b35936b208..f8f5469f2c 100644
--- a/lib/rss/maker/entry.rb
+++ b/lib/rss/maker/entry.rb
@@ -99,7 +99,7 @@ module RSS
end
end
- def _set_default_values(&block)
+ def _set_default_values
keep = {
:authors => authors.to_a.dup,
:contributors => contributors.to_a.dup,
@@ -126,7 +126,7 @@ module RSS
@maker.channel.title {|t| @title = t}
end
self.updated ||= @maker.channel.updated
- super(&block)
+ super
ensure
authors.replace(keep[:authors])
contributors.replace(keep[:contributors])
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 3d90d54912..6c89598e2d 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)
@@ -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 occurances 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)
@@ -701,18 +711,18 @@ EOC
end
def inherited(klass)
- klass.const_set("MUST_CALL_VALIDATORS", {})
- klass.const_set("MODELS", [])
- klass.const_set("GET_ATTRIBUTES", [])
- klass.const_set("HAVE_CHILDREN_ELEMENTS", [])
- klass.const_set("TO_ELEMENT_METHODS", [])
- klass.const_set("NEED_INITIALIZE_VARIABLES", [])
- klass.const_set("PLURAL_FORMS", {})
+ klass.const_set(:MUST_CALL_VALIDATORS, {})
+ klass.const_set(:MODELS, [])
+ klass.const_set(:GET_ATTRIBUTES, [])
+ klass.const_set(:HAVE_CHILDREN_ELEMENTS, [])
+ klass.const_set(:TO_ELEMENT_METHODS, [])
+ klass.const_set(:NEED_INITIALIZE_VARIABLES, [])
+ klass.const_set(:PLURAL_FORMS, {})
tag_name = klass.name.split(/::/).last
tag_name[0, 1] = tag_name[0, 1].downcase
- klass.instance_variable_set("@tag_name", tag_name)
- klass.instance_variable_set("@have_content", false)
+ klass.instance_variable_set(:@tag_name, tag_name)
+ klass.instance_variable_set(:@have_content, false)
end
def install_must_call_validator(prefix, uri)
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..5ed214159f 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 particuarly 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..6af157a2f2 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 erorr 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 7ed27461bb..8a0d992141 100644
--- a/lib/rubygems.rb
+++ b/lib/rubygems.rb
@@ -5,31 +5,18 @@
# See LICENSE.txt for permissions.
#++
-module Gem
- QUICKLOADER_SUCKAGE = RUBY_VERSION =~ /^1\.9\.1/
+require 'rbconfig'
- # Only MRI 1.9.2 has the custom prelude.
- GEM_PRELUDE_SUCKAGE = RUBY_VERSION =~ /^1\.9\.2/ && RUBY_ENGINE == "ruby"
+module Gem
+ VERSION = '2.2.0'
end
-if Gem::GEM_PRELUDE_SUCKAGE and defined?(Gem::QuickLoader) then
- Gem::QuickLoader.remove
-
- $LOADED_FEATURES.delete Gem::QuickLoader.path_to_full_rubygems_library
-
- if $LOADED_FEATURES.any? do |path| path.end_with? '/rubygems.rb' end then
- # TODO path does not exist here
- raise LoadError, "another rubygems is already loaded from #{path}"
- end
-
- class << Gem
- remove_method :try_activate if Gem.respond_to?(:try_activate, true)
- end
-end
+# Must be first since it unloads the prelude from 1.9.2
+require 'rubygems/compatibility'
require 'rubygems/defaults'
-require 'rbconfig'
-require "rubygems/deprecate"
+require 'rubygems/deprecate'
+require 'rubygems/errors'
##
# RubyGems is the Ruby standard for publishing and managing third party
@@ -49,9 +36,9 @@ require "rubygems/deprecate"
#
# Further RubyGems documentation can be found at:
#
+# * {RubyGems Guides}[http://guides.rubygems.org]
# * {RubyGems API}[http://rubygems.rubyforge.org/rdoc] (also available from
# <tt>gem server</tt>)
-# * {RubyGems Bookshelf}[http://rubygem.org]
#
# == RubyGems Plugins
#
@@ -72,8 +59,8 @@ require "rubygems/deprecate"
# For RubyGems packagers, provide lib/rubygems/operating_system.rb and
# override any defaults from lib/rubygems/defaults.rb.
#
-# For Ruby implementers, provide lib/rubygems/#{RUBY_ENGINE}.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.
#
# If you need RubyGems to perform extra work on install or uninstall, your
# defaults override file can set pre and post install and uninstall hooks.
@@ -83,8 +70,8 @@ require "rubygems/deprecate"
# == Bugs
#
# You can submit bugs to the
-# {RubyGems bug tracker}[http://rubyforge.org/tracker/?atid=575&group_id=126]
-# on RubyForge
+# {RubyGems bug tracker}[https://github.com/rubygems/rubygems/issues]
+# on GitHub
#
# == Credits
#
@@ -112,59 +99,23 @@ require "rubygems/deprecate"
# * Daniel Berger -- djberg96(at)gmail.com
# * Phil Hagelberg -- technomancy(at)gmail.com
# * Ryan Davis -- ryand-ruby(at)zenspider.com
-# * Evan Phoenix -- evan@phx.io
+# * Evan Phoenix -- evan(at)fallingsnow.net
+# * Steve Klabnik -- steve(at)steveklabnik.com
#
# (If your name is missing, PLEASE let us know!)
#
+# See {LICENSE.txt}[rdoc-ref:lib/rubygems/LICENSE.txt] for permissions.
+#
# Thanks!
#
# -The RubyGems Team
-module Gem
- VERSION = '1.8.23'
-
- ##
- # Raised when RubyGems is unable to load or activate a gem. Contains the
- # name and version requirements of the gem that either conflicts with
- # already activated gems or that RubyGems is otherwise unable to activate.
-
- class LoadError < ::LoadError
- # Name of gem
- attr_accessor :name
-
- # Version requirement of gem
- attr_accessor :requirement
- end
-
- # :stopdoc:
-
- RubyGemsVersion = VERSION
-
- RbConfigPriorities = %w[
- EXEEXT RUBY_SO_NAME arch bindir datadir libdir ruby_install_name
- ruby_version rubylibprefix sitedir sitelibdir vendordir vendorlibdir
- ]
-
- unless defined?(ConfigMap)
- ##
- # Configuration settings from ::RbConfig
- ConfigMap = Hash.new do |cm, key|
- cm[key] = RbConfig::CONFIG[key.to_s]
- end
- else
- RbConfigPriorities.each do |key|
- ConfigMap[key.to_sym] = RbConfig::CONFIG[key]
- end
- end
-
- RubyGemsPackageVersion = VERSION
+module Gem
RUBYGEMS_DIR = File.dirname File.expand_path(__FILE__)
- # :startdoc:
-
##
- # An Array of Regexps that match windows ruby platforms.
+ # An Array of Regexps that match windows Ruby platforms.
WIN_PATTERNS = [
/bccwin/i,
@@ -175,13 +126,40 @@ module Gem
/wince/i,
]
- @@source_index = nil
+ GEM_DEP_FILES = %w[
+ gem.deps.rb
+ Gemfile
+ Isolate
+ ]
+
+ ##
+ # Subdirectories in a gem repository
+
+ REPOSITORY_SUBDIRECTORIES = %w[
+ 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 = {}
+ @path_to_default_spec_map = {}
@platforms = []
@ruby = nil
+ @ruby_api_version = nil
@sources = nil
@post_build_hooks ||= []
@@ -198,13 +176,19 @@ module Gem
# activated. Returns false if it can't find the path in a gem.
def self.try_activate path
- # TODO: deprecate when 1.9.3 comes out.
# 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
+ # require will try to activate the more specific version.
- # TODO: use find_all and bork if ambiguous
+ spec = Gem::Specification.find_inactive_by_path path
- spec = Gem::Specification.find_by_path path
- return false unless spec
+ unless spec
+ spec = Gem::Specification.find_by_path path
+ return true if spec && spec.activated?
+ return false
+ end
begin
spec.activate
@@ -215,77 +199,20 @@ module Gem
return true
end
- ##
- # Activates an installed gem matching +dep+. The gem must satisfy
- # +requirements+.
- #
- # Returns true if the gem is activated, false if it is already
- # loaded, or an exception otherwise.
- #
- # Gem#activate adds the library paths in +dep+ to $LOAD_PATH. Before a Gem
- # is activated its required Gems are activated. If the version information
- # is omitted, the highest version Gem of the supplied name is loaded. If a
- # Gem is not found that meets the version requirements or a required Gem is
- # not found, a Gem::LoadError is raised.
- #
- # More information on version requirements can be found in the
- # Gem::Requirement and Gem::Version documentation.
-
- def self.activate(dep, *requirements)
- raise ArgumentError, "Deprecated use of Gem.activate(dep)" if
- Gem::Dependency === dep
-
- Gem::Specification.find_by_name(dep, *requirements).activate
- end
-
- def self.activate_dep dep, *requirements # :nodoc:
- dep.to_spec.activate
- end
-
- def self.activate_spec spec # :nodoc:
- spec.activate
- end
-
- def self.unresolved_deps
- @unresolved_deps ||= Hash.new { |h, n| h[n] = Gem::Dependency.new n }
- end
-
- ##
- # An Array of all possible load paths for all versions of all gems in the
- # Gem installation.
-
- def self.all_load_paths
- result = []
+ def self.needs
+ rs = Gem::RequestSet.new
- Gem.path.each do |gemdir|
- each_load_path all_partials(gemdir) do |load_path|
- result << load_path
- end
- end
-
- result
- end
-
- ##
- # Return all the partial paths in +gemdir+.
+ yield rs
- def self.all_partials(gemdir)
- Dir[File.join(gemdir, "gems/*")]
+ finish_resolve rs
end
- private_class_method :all_partials
-
- ##
- # See if a given gem is available.
+ def self.finish_resolve(request_set=Gem::RequestSet.new)
+ request_set.import Gem::Specification.unresolved_deps.values
- def self.available?(dep, *requirements)
- requirements = Gem::Requirement.default if requirements.empty?
-
- unless dep.respond_to?(:name) and dep.respond_to?(:requirement) then
- dep = Gem::Dependency.new dep, requirements
+ request_set.resolve_current.each do |s|
+ s.full_spec.activate
end
-
- not dep.matching_specs(true).empty?
end
##
@@ -331,7 +258,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
@@ -343,11 +269,10 @@ module Gem
# mainly used by the unit tests to provide test isolation.
def self.clear_paths
- @@source_index = nil
@paths = nil
@user_home = nil
- @searcher = nil
Gem::Specification.reset
+ Gem::Security.reset if defined?(Gem::Security)
end
##
@@ -377,7 +302,8 @@ module Gem
# package is not available as a gem, return nil.
def self.datadir(gem_name)
-# TODO: deprecate
+# TODO: deprecate and move to Gem::Specification
+# and drop the extra ", gem_name" which is uselessly redundant
spec = @loaded_specs[gem_name]
return nil if spec.nil?
File.join spec.full_gem_path, "data", gem_name
@@ -391,14 +317,21 @@ module Gem
Zlib::Deflate.deflate data
end
+ # Retrieve the PathSupport object that RubyGems uses to
+ # lookup files.
+
def self.paths
@paths ||= Gem::PathSupport.new
end
+ # 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
##
@@ -407,59 +340,75 @@ 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
- ##
- # Expand each partial gem path with each of the required paths specified
- # in the Gem spec. Each expanded path is yielded.
-
- def self.each_load_path(partials)
- partials.each do |gp|
- base = File.basename gp
- specfn = File.join(dir, "specifications", "#{base}.gemspec")
- if File.exists? specfn
- spec = eval(File.read(specfn))
- spec.require_paths.each do |rp|
- yield File.join(gp,rp)
- end
- else
- filename = File.join(gp, 'lib')
- yield(filename) if File.exists? filename
- end
- end
+ def self.spec_cache_dir
+ paths.spec_cache_dir
end
- private_class_method :each_load_path
-
-
##
- # Quietly ensure the named Gem directory contains all the proper
+ # Quietly ensure the Gem directory +dir+ contains all the proper
# subdirectories. 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_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_gem_subdirectories dir = Gem.dir
+ def self.ensure_subdirectories dir, mode, subdirs # :nodoc:
old_umask = File.umask
File.umask old_umask | 002
require 'fileutils'
- %w[cache doc gems specifications].each do |name|
+ options = {}
+
+ options[:mode] = mode if mode
+
+ subdirs.each do |name|
subdir = File.join dir, name
next if File.exist? subdir
- FileUtils.mkdir_p subdir rescue nil # in case of perms issues -- lame
+ FileUtils.mkdir_p subdir, options rescue nil
end
ensure
File.umask old_umask
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:
#
@@ -469,16 +418,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}")
@@ -491,6 +436,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.
#--
@@ -531,39 +510,45 @@ 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
-
- Zlib::GzipReader.new(data).read
+ 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
-
- 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
+
+ ##
+ # Top level install helper method. Allows you to install gems interactively:
+ #
+ # % irb
+ # >> Gem.install "minitest"
+ # Fetching: minitest-3.0.1.gem (100%)
+ # => [#<Gem::Specification:0x1013b4528 @name="minitest", ...>]
+
+ def self.install name, version = Gem::Requirement.default
+ require "rubygems/dependency_installer"
+ inst = Gem::DependencyInstaller.new
+ inst.install name, version
+ inst.installed_gems
end
##
@@ -572,7 +557,7 @@ module Gem
def self.host
# TODO: move to utils
- @host ||= "https://rubygems.org"
+ @host ||= Gem::DEFAULT_HOST
end
## Set the default RubyGems API host.
@@ -583,43 +568,6 @@ module Gem
end
##
- # Return a list of all possible load paths for the latest version for all
- # gems in the Gem installation.
-
- def self.latest_load_paths
- result = []
-
- Gem.path.each do |gemdir|
- each_load_path(latest_partials(gemdir)) do |load_path|
- result << load_path
- end
- end
-
- result
- end
-
- ##
- # Return only the latest partial paths in the given +gemdir+.
-
- def self.latest_partials(gemdir)
- latest = {}
- all_partials(gemdir).each do |gp|
- base = File.basename gp
-
- if base.to_s =~ /(.*)-((\d+\.)*\d+)/ then
- name, version = $1, $2
- ver = Gem::Version.new(version)
- if latest[name].nil? || ver > latest[name][0]
- latest[name] = [ver, gp]
- end
- end
- end
- latest.collect { |k,v| v[1] }
- end
-
- private_class_method :latest_partials
-
- ##
# The index to insert activated gem paths into the $LOAD_PATH.
#
# Defaults to the site lib directory unless gem_prelude.rb has loaded paths,
@@ -629,16 +577,6 @@ module Gem
def self.load_path_insert_index
index = $LOAD_PATH.index ConfigMap[:sitelibdir]
- if QUICKLOADER_SUCKAGE then
- $LOAD_PATH.each_with_index do |path, i|
- if path.instance_variables.include?(:@gem_prelude_index) or
- path.instance_variables.include?('@gem_prelude_index') then
- index = i
- break
- end
- end
- end
-
index
end
@@ -649,6 +587,7 @@ module Gem
def self.load_yaml
return if @yaml_loaded
+ return unless defined?(gem)
test_syck = ENV['TEST_SYCK']
@@ -700,7 +639,6 @@ module Gem
file = $1
lineno = $2.to_i
- # TODO: it is ALWAYS joined! STUPID!
[file, lineno]
end
@@ -712,27 +650,6 @@ module Gem
end
##
- # Get the appropriate cache path.
- #
- # Pass a string to use a different base path, or nil/false (default) for
- # Gem.dir.
- #
-
- def self.cache_dir(custom_dir=false)
- File.join(custom_dir || Gem.dir, "cache")
- end
-
- ##
- # Given a gem path, find the gem in cache.
- #
- # Pass a string as the second argument to use a different base path, or
- # nil/false (default) for Gem.dir.
-
- def self.cache_gem(filename, user_dir=false)
- cache_dir(user_dir).add(filename)
- end
-
- ##
# Set array of platforms this RubyGems supports (primarily for testing).
def self.platforms=(platforms)
@@ -770,6 +687,15 @@ module Gem
end
##
+ # Adds a post-installs hook that will be passed a Gem::DependencyInstaller
+ # and a list of installed specifications when
+ # Gem::DependencyInstaller#install is complete
+
+ def self.done_installing(&hook)
+ @done_installing_hooks << hook
+ end
+
+ ##
# Adds a hook that will get run after Gem::Specification.reset is
# run.
@@ -828,39 +754,10 @@ module Gem
end
##
- # Promotes the load paths of the +gem_name+ over the load paths of
- # +over_name+. Useful for allowing one gem to override features in another
- # using #find_files.
-
- def self.promote_load_path(gem_name, over_name)
- gem = Gem.loaded_specs[gem_name]
- over = Gem.loaded_specs[over_name]
-
- raise ArgumentError, "gem #{gem_name} is not activated" if gem.nil?
- raise ArgumentError, "gem #{over_name} is not activated" if over.nil?
-
- last_gem_path = Gem::Path.path(gem.full_gem_path).add(gem.require_paths.last)
-
- over_paths = over.require_paths.map do |path|
- Gem::Path.path(over.full_gem_path).add(path).to_s
- end
-
- over_paths.each do |path|
- $LOAD_PATH.delete path
- end
-
- gem = $LOAD_PATH.index(last_gem_path) + 1
-
- $LOAD_PATH.insert(gem, *over_paths)
- end
-
- ##
- # Refresh source_index from disk and clear searcher.
+ # Refresh available gems from disk.
def self.refresh
Gem::Specification.reset
- @source_index = nil
- @searcher = nil
end
##
@@ -871,88 +768,58 @@ module Gem
end
##
- # Report a load error during activation. The message of load error
- # depends on whether it was a version mismatch or if there are not gems of
- # any version by the requested name.
+ # The path to the running Ruby interpreter.
- def self.report_activate_error(gem)
- matches = Gem::Specification.find_by_name(gem.name)
+ def self.ruby
+ if @ruby.nil? then
+ @ruby = File.join(ConfigMap[:bindir],
+ "#{ConfigMap[:ruby_install_name]}#{ConfigMap[:EXEEXT]}")
- if matches.empty? then
- error = Gem::LoadError.new(
- "Could not find RubyGem #{gem.name} (#{gem.requirement})\n")
- else
- error = Gem::LoadError.new(
- "RubyGem version error: " +
- "#{gem.name}(#{matches.first.version} not #{gem.requirement})\n")
+ @ruby = "\"#{@ruby}\"" if @ruby =~ /\s/
end
- error.name = gem.name
- error.requirement = gem.requirement
- raise error
+ @ruby
end
- private_class_method :report_activate_error
-
##
- # Full path to +libfile+ in +gemname+. Searches for the latest gem unless
- # +requirements+ is given.
-
- def self.required_location(gemname, libfile, *requirements)
- requirements = Gem::Requirement.default if requirements.empty?
-
- matches = Gem::Specification.find_all_by_name gemname, *requirements
-
- return nil if matches.empty?
-
- spec = matches.last
- spec.require_paths.each do |path|
- result = Gem::Path.path(spec.full_gem_path).add(path, libfile)
- return result if result.exist?
- end
+ # Returns a String containing the API compatibility version of Ruby
- nil
+ def self.ruby_api_version
+ @ruby_api_version ||=
+ "#{ConfigMap[:MAJOR]}.#{ConfigMap[:MINOR]}.#{ConfigMap[:TEENY]}"
end
##
- # The path to the running Ruby interpreter.
+ # Returns the latest release-version specification for the gem +name+.
- def self.ruby
- if @ruby.nil? then
- @ruby = File.join(ConfigMap[:bindir],
- "#{ConfigMap[:ruby_install_name]}#{ConfigMap[:EXEEXT]}")
+ def self.latest_spec_for name
+ dependency = Gem::Dependency.new name
+ fetcher = Gem::SpecFetcher.fetcher
+ spec_tuples, = fetcher.spec_for_dependency dependency
- @ruby = "\"#{@ruby}\"" if @ruby =~ /\s/
- end
+ spec, = spec_tuples.first
- @ruby
+ spec
end
- def self.latest_spec_for name
- dependency = Gem::Dependency.new name
- fetcher = Gem::SpecFetcher.fetcher
- spec_tuples = fetcher.find_matching dependency
-
- match = spec_tuples.select { |(n, _, p), _|
- n == name and Gem::Platform.match p
- }.sort_by { |(_, version, _), _|
- version
- }.last
+ ##
+ # Returns the latest release version of RubyGems.
- match and fetcher.fetch_spec(*match)
+ def self.latest_rubygems_version
+ latest_version_for('rubygems-update') or
+ raise "Can't find 'rubygems-update' in any repo. Check `gem source list`."
end
+ ##
+ # Returns the version of the latest release-version of gem +name+
+
def self.latest_version_for name
spec = latest_spec_for name
spec and spec.version
end
- def self.latest_rubygems_version
- latest_version_for "rubygems-update"
- 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
@@ -968,36 +835,34 @@ module Gem
end
##
- # The GemPathSearcher object used to search for matching installed gems.
+ # A Gem::Version for the currently running RubyGems
- def self.searcher
- @searcher ||= Gem::GemPathSearcher.new
+ def self.rubygems_version
+ return @rubygems_version if defined? @rubygems_version
+ @rubygems_version = Gem::Version.new Gem::VERSION
end
##
- # Returns the Gem::SourceIndex of specifications that are in the Gem.path
-
- def self.source_index
- @@source_index ||= Gem::Deprecate.skip_during do
- SourceIndex.new Gem::Specification.dirs
- end
- end
-
- ##
- # Returns an Array of sources to fetch remote gems from. If the sources
- # list is empty, attempts to load the "sources" gem, then uses
- # default_sources if it is not installed.
+ # Returns an Array of sources to fetch remote gems from. Uses
+ # default_sources if the sources list is empty.
def self.sources
- @sources ||= default_sources
+ @sources ||= Gem::SourceList.from(default_sources)
end
##
# Need to be able to set the sources without calling
# Gem.sources.replace since that would cause an infinite loop.
+ #
+ # DOC: This comment is not documentation about the method itself, it's
+ # more of a code comment about the implementation.
def self.sources= new_sources
- @sources = new_sources
+ if !new_sources
+ @sources = nil
+ else
+ @sources = Gem::SourceList.from(new_sources)
+ end
end
##
@@ -1007,12 +872,6 @@ module Gem
@suffix_pattern ||= "{#{suffixes.join(',')}}"
end
- def self.loaded_path? path
- # TODO: ruby needs a feature to let us query what's loaded in 1.8 and 1.9
- re = /(^|\/)#{Regexp.escape path}#{Regexp.union(*Gem.suffixes)}$/
- $LOADED_FEATURES.any? { |s| s =~ re }
- end
-
##
# Suffixes for require-able paths.
@@ -1060,14 +919,13 @@ 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
##
# The home directory for the user.
def self.user_home
- @user_home ||= find_home
+ @user_home ||= find_home.untaint
end
##
@@ -1075,16 +933,17 @@ module Gem
def self.win_platform?
if @@win_platform.nil? then
- @@win_platform = !!WIN_PATTERNS.find { |r| RUBY_PLATFORM =~ r }
+ ruby_platform = RbConfig::CONFIG['host_os']
+ @@win_platform = !!WIN_PATTERNS.find { |r| ruby_platform =~ r }
end
@@win_platform
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
@@ -1102,10 +961,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
##
@@ -1126,6 +991,68 @@ module Gem
load_plugin_files files
end
+ ##
+ # Looks for gem dependency files (gem.deps.rb, Gemfile, Isolate) from the
+ # current directory up and activates the gems in the first file found.
+ #
+ # You can run this automatically when rubygems starts. To enable, set
+ # the <code>RUBYGEMS_GEMDEPS</code> environment variable to either the path
+ # of your Gemfile or "-" to auto-discover in parent directories.
+ #
+ # NOTE: Enabling automatic discovery on multiuser systems can lead to
+ # execution of arbitrary code when used from directories outside your
+ # control.
+
+ def self.use_gemdeps
+ return unless 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
+
+ class << self
+ 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.
class << self
##
@@ -1134,29 +1061,94 @@ module Gem
attr_reader :loaded_specs
##
- # The list of hooks to be run before Gem::Install#install finishes
- # installation
+ # 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
+
+ ##
+ # Find a Gem::Specification of default gem from +path+
+
+ def find_unresolved_default_spec(path)
+ Gem.suffixes.each do |suffix|
+ spec = @path_to_default_spec_map["#{path}#{suffix}"]
+ return spec if spec
+ end
+ nil
+ end
+
+ ##
+ # Remove needless Gem::Specification of default gem from
+ # unresolved default gem list
+
+ def remove_unresolved_default_spec(spec)
+ spec.files.each do |file|
+ @path_to_default_spec_map.delete(file)
+ end
+ end
+
+ ##
+ # Clear default gem related varibles. It is for test
+
+ def clear_default_specs
+ @path_to_default_spec_map.clear
+ end
+
+ ##
+ # The list of hooks to be run after Gem::Installer#install extracts files
+ # and builds extensions
attr_reader :post_build_hooks
##
- # The list of hooks to be run before Gem::Install#install does any work
+ # The list of hooks to be run after Gem::Installer#install completes
+ # installation
attr_reader :post_install_hooks
##
+ # The list of hooks to be run after Gem::DependencyInstaller installs a
+ # set of gems
+
+ attr_reader :done_installing_hooks
+
+ ##
# The list of hooks to be run after Gem::Specification.reset is run.
attr_reader :post_reset_hooks
##
- # The list of hooks to be run before Gem::Uninstall#uninstall does any
- # work
+ # The list of hooks to be run after Gem::Uninstaller#uninstall completes
+ # installation
attr_reader :post_uninstall_hooks
##
- # The list of hooks to be run after Gem::Install#install is finished
+ # The list of hooks to be run before Gem::Installer#install does any work
attr_reader :pre_install_hooks
@@ -1166,95 +1158,38 @@ module Gem
attr_reader :pre_reset_hooks
##
- # The list of hooks to be run after Gem::Uninstall#uninstall is finished
+ # The list of hooks to be run before Gem::Uninstaller#uninstall does any
+ # work
attr_reader :pre_uninstall_hooks
end
- def self.cache # :nodoc:
- source_index
- end
-
##
# Location of Marshal quick gemspecs on remote repositories
MARSHAL_SPEC_DIR = "quick/Marshal.#{Gem.marshal_version}/"
- autoload :Version, 'rubygems/version'
- autoload :Requirement, 'rubygems/requirement'
- autoload :Dependency, 'rubygems/dependency'
- autoload :DependencyList, 'rubygems/dependency_list'
- autoload :GemPathSearcher, 'rubygems/gem_path_searcher'
- autoload :SpecFetcher, 'rubygems/spec_fetcher'
- autoload :Specification, 'rubygems/specification'
- autoload :Cache, 'rubygems/source_index'
- autoload :SourceIndex, 'rubygems/source_index'
- autoload :PathSupport, 'rubygems/path_support'
- autoload :Platform, 'rubygems/platform'
- autoload :Builder, 'rubygems/builder'
- autoload :ConfigFile, 'rubygems/config_file'
-end
-
-module Kernel
-
- remove_method :gem if 'method' == defined? gem # from gem_prelude.rb on 1.9
-
- ##
- # Use Kernel#gem to activate a specific version of +gem_name+.
- #
- # +requirements+ is a list of version requirements that the
- # specified gem must match, most commonly "= example.version.number". See
- # Gem::Requirement for how to specify a version requirement.
- #
- # If you will be activating the latest version of a gem, there is no need to
- # call Kernel#gem, Kernel#require will do the right thing for you.
- #
- # Kernel#gem returns true if the gem was activated, otherwise false. If the
- # gem could not be found, didn't match the version requirements, or a
- # different version was already activated, an exception will be raised.
- #
- # Kernel#gem should be called *before* any require statements (otherwise
- # RubyGems may load a conflicting library version).
- #
- # 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
- # RUBYLIB environment variable to skip activation of a gem.
- #
- # Example:
- #
- # GEM_SKIP=libA:libB ruby -I../libA -I../libB ./mycode.rb
-
- def gem(gem_name, *requirements) # :doc:
- skip_list = (ENV['GEM_SKIP'] || "").split(/:/)
- raise Gem::LoadError, "skipping #{gem_name}" if skip_list.include? gem_name
- spec = Gem::Dependency.new(gem_name, *requirements).to_spec
- spec.activate if spec
- end
-
- private :gem
-
-end
-
-##
-# Return the path to the data directory associated with the named package. If
-# the package is loaded as a gem, return the gem specific data directory.
-# Otherwise return a path to the share area as define by
-# "#{ConfigMap[:datadir]}/#{package_name}".
-
-def RbConfig.datadir(package_name) # :nodoc:
- warn "#{Gem.location_of_caller.join ':'}:Warning: " \
- "RbConfig.datadir is deprecated and will be removed on or after " \
- "August 2011. " \
- "Use Gem::datadir."
-
- require 'rbconfig/datadir'
-
- Gem.datadir(package_name) || File.join(Gem::ConfigMap[:datadir], package_name)
+ autoload :ConfigFile, 'rubygems/config_file'
+ autoload :Dependency, 'rubygems/dependency'
+ autoload :DependencyList, 'rubygems/dependency_list'
+ autoload :Resolver, 'rubygems/resolver'
+ autoload :DependencyResolver, 'rubygems/resolver'
+ autoload :PathSupport, 'rubygems/path_support'
+ autoload :Platform, 'rubygems/platform'
+ autoload :RequestSet, 'rubygems/request_set'
+ autoload :Requirement, 'rubygems/requirement'
+ 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
require 'rubygems/exceptions'
+# REFACTOR: This should be pulled out into some kind of hacks file.
gem_preluded = Gem::GEM_PRELUDE_SUCKAGE and defined? Gem
unless gem_preluded then # TODO: remove guard after 1.9.2 dropped
begin
@@ -1268,7 +1203,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
@@ -1277,29 +1212,10 @@ unless gem_preluded then # TODO: remove guard after 1.9.2 dropped
end
##
-# Enables the require hook for RubyGems.
+# Loads the default specs.
+Gem::Specification.load_defaults
-require 'rubygems/custom_require'
+require 'rubygems/core_ext/kernel_gem'
+require 'rubygems/core_ext/kernel_require'
-module Gem
- class << self
- extend Gem::Deprecate
- deprecate :activate_dep, "Specification#activate", 2011, 6
- deprecate :activate_spec, "Specification#activate", 2011, 6
- deprecate :cache, "Gem::source_index", 2011, 8
- deprecate :activate, "Specification#activate", 2011, 10
- deprecate :all_load_paths, :none, 2011, 10
- deprecate :all_partials, :none, 2011, 10
- deprecate :latest_load_paths, :none, 2011, 10
- deprecate :promote_load_path, :none, 2011, 10
- deprecate :available?, "Specification::find_by_name", 2011, 11
- deprecate :cache_dir, "Specification#cache_dir", 2011, 11
- deprecate :cache_gem, "Specification#cache_file", 2011, 11
- deprecate :default_system_source_cache_dir, :none, 2011, 11
- deprecate :default_user_source_cache_dir, :none, 2011, 11
- deprecate :report_activate_error, :none, 2011, 11
- deprecate :required_location, :none, 2011, 11
- deprecate :searcher, "Specification", 2011, 11
- deprecate :source_index, "Specification", 2011, 11
- end
-end
+Gem.detect_gemdeps
diff --git a/lib/rubygems/LICENSE.txt b/lib/rubygems/LICENSE.txt
new file mode 100644
index 0000000000..8a0a51dec1
--- /dev/null
+++ b/lib/rubygems/LICENSE.txt
@@ -0,0 +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 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.
+
+2. You may modify your copy of the software in any way, provided that
+ you do at least ONE of the following:
+
+ a. place your modifications in the Public Domain or otherwise
+ make them Freely Available, such as by posting said
+ modifications to Usenet or an equivalent medium, or by allowing
+ the author to include your modifications in the software.
+
+ b. use the modified software only within your corporation or
+ organization.
+
+ c. 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.
+
+3. You may distribute the software in object code or executable
+ form, provided that you do at least ONE of the following:
+
+ a. distribute the executables and library files of the software,
+ together with instructions (in the manual page or equivalent)
+ on where to get the original distribution.
+
+ b. accompany the distribution with the machine-readable source of
+ the software.
+
+ c. give non-standard executables non-standard names, with
+ instructions on where to get the original software distribution.
+
+ d. make other distribution arrangements with the author.
+
+4. You may modify and include the part of the software into any other
+ software (possibly commercial).
+
+5. 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.
+
diff --git a/lib/rubygems/available_set.rb b/lib/rubygems/available_set.rb
new file mode 100644
index 0000000000..4ab4d77716
--- /dev/null
+++ b/lib/rubygems/available_set.rb
@@ -0,0 +1,161 @@
+class Gem::AvailableSet
+
+ include Enumerable
+
+ Tuple = Struct.new(:spec, :source)
+
+ def initialize
+ @set = []
+ @sorted = nil
+ end
+
+ attr_reader :set
+
+ def add(spec, source)
+ @set << Tuple.new(spec, source)
+ @sorted = nil
+ self
+ end
+
+ def <<(o)
+ case o
+ when Gem::AvailableSet
+ s = o.set
+ when Array
+ s = o.map do |sp,so|
+ if !sp.kind_of?(Gem::Specification) or !so.kind_of?(Gem::Source)
+ raise TypeError, "Array must be in [[spec, source], ...] form"
+ end
+
+ Tuple.new(sp,so)
+ end
+ else
+ raise TypeError, "must be a Gem::AvailableSet"
+ end
+
+ @set += s
+ @sorted = nil
+
+ 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
+
+ def all_specs
+ @set.map { |t| t.spec }
+ end
+
+ def match_platform!
+ @set.reject! { |t| !Gem::Platform.match(t.spec.platform) }
+ @sorted = nil
+ self
+ end
+
+ def sorted
+ @sorted ||= @set.sort do |a,b|
+ i = b.spec <=> a.spec
+ i != 0 ? i : (a.source <=> b.source)
+ end
+ end
+
+ def size
+ @set.size
+ end
+
+ def source_for(spec)
+ f = @set.find { |t| t.spec == spec }
+ 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.matches_spec? t.spec
+ end
+
+ match.map do |t|
+ Gem::Resolver::InstalledSpecification.new(self, t.spec, t.source)
+ end
+ end
+
+ def prefetch(reqs)
+ end
+
+ def pick_best!
+ return self if empty?
+
+ @set = [sorted.first]
+ @sorted = nil
+ self
+ end
+
+ def remove_installed!(dep)
+ @set.reject! do |t|
+ # already locally installed
+ Gem::Specification.any? do |installed_spec|
+ dep.name == installed_spec.name and
+ dep.requirement.satisfied_by? installed_spec.version
+ end
+ end
+
+ @sorted = nil
+ self
+ end
+
+ def inject_into_list(dep_list)
+ @set.each { |t| dep_list.add t.spec }
+ end
+end
diff --git a/lib/rubygems/basic_specification.rb b/lib/rubygems/basic_specification.rb
new file mode 100644
index 0000000000..4f96fcac3d
--- /dev/null
+++ b/lib/rubygems/basic_specification.rb
@@ -0,0 +1,212 @@
+##
+# BasicSpecification is an abstract class which implements some common code
+# used by both Specification and StubSpecification.
+
+class Gem::BasicSpecification
+
+ ##
+ # The path this gemspec was loaded from. This attribute is not persisted.
+
+ attr_reader :loaded_from
+
+ 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
+ build_extensions
+
+ 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
+
+ ##
+ # The directory the named +extension+ was installed into after being built.
+ #
+ # Usage:
+ #
+ # spec.extensions.each do |ext|
+ # puts spec.extension_install_dir ext
+ # end
+
+ def extension_install_dir
+ File.join base_dir, 'extensions', Gem::Platform.local.to_s,
+ Gem.extension_api_version, full_name
+ end
+
+ def find_full_gem_path # :nodoc:
+ # TODO: also, shouldn't it default to full_name if it hasn't been written?
+ path = File.expand_path File.join(gems_dir, full_name)
+ path.untaint
+ path 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 = @require_paths.map do |path|
+ File.join full_gem_path, path
+ end
+
+ full_paths.unshift extension_install_dir unless @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
+
+ @full_gem_path = 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:
+ @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 @require_paths if @extensions.empty?
+
+ relative_extension_install_dir =
+ File.join '..', '..', 'extensions', Gem::Platform.local.to_s,
+ Gem.extension_api_version, full_name
+
+ [relative_extension_install_dir].concat @require_paths
+ 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/builder.rb b/lib/rubygems/builder.rb
deleted file mode 100644
index 25e8fc8321..0000000000
--- a/lib/rubygems/builder.rb
+++ /dev/null
@@ -1,99 +0,0 @@
-#--
-# Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others.
-# All rights reserved.
-# See LICENSE.txt for permissions.
-#++
-
-require 'rubygems'
-require 'rubygems/user_interaction'
-
-Gem.load_yaml
-
-require 'rubygems/package'
-
-##
-# The Builder class processes RubyGem specification files
-# to produce a .gem file.
-
-class Gem::Builder
-
- include Gem::UserInteraction
-
- ##
- # Constructs a builder instance for the provided specification
- #
- # spec:: [Gem::Specification] The specification instance
-
- def initialize(spec)
- @spec = spec
- end
-
- ##
- # Builds the gem from the specification. Returns the name of the file
- # written.
-
- def build(skip_validation=false)
- @spec.mark_version
- @spec.validate unless skip_validation
- @signer = sign
- write_package
- say success if Gem.configuration.verbose
- File.basename @spec.cache_file
- end
-
- def success
- <<-EOM
- Successfully built RubyGem
- Name: #{@spec.name}
- Version: #{@spec.version}
- File: #{File.basename @spec.cache_file}
-EOM
- end
-
- private
-
- ##
- # If the signing key was specified, then load the file, and swap to the
- # public key (TODO: we should probably just omit the signing key in favor of
- # the signing certificate, but that's for the future, also the signature
- # algorithm should be configurable)
-
- def sign
- signer = nil
-
- if @spec.respond_to?(:signing_key) and @spec.signing_key then
- require 'rubygems/security'
-
- signer = Gem::Security::Signer.new @spec.signing_key, @spec.cert_chain
- @spec.signing_key = nil
- @spec.cert_chain = signer.cert_chain.map { |cert| cert.to_s }
- end
-
- signer
- end
-
- def write_package
- file_name = File.basename @spec.cache_file
- open file_name, 'wb' do |gem_io|
- Gem::Package.open gem_io, 'w', @signer do |pkg|
- yaml = @spec.to_yaml
- pkg.metadata = yaml
-
- @spec.files.each do |file|
- next if File.directory?(file)
- next if file == file_name # Don't add gem onto itself
-
- stat = File.stat(file)
- mode = stat.mode & 0777
- size = stat.size
-
- pkg.add_file_simple file, mode, size do |tar_io|
- tar_io.write open(file, "rb") { |f| f.read }
- end
- end
- end
- end
- end
-
-end
-
diff --git a/lib/rubygems/command.rb b/lib/rubygems/command.rb
index 49253ef56b..cba79b9196 100644
--- a/lib/rubygems/command.rb
+++ b/lib/rubygems/command.rb
@@ -5,11 +5,12 @@
#++
require 'optparse'
+require 'rubygems/requirement'
require 'rubygems/user_interaction'
##
# Base class for all Gem commands. When creating a new gem command, define
-# #new, #execute, #arguments, #defaults_str, #description and #usage
+# #initialize, #execute, #arguments, #defaults_str, #description and #usage
# (as appropriate). See the above mentioned methods for details.
#
# A very good example to look at is Gem::Commands::ContentsCommand
@@ -150,8 +151,9 @@ class Gem::Command
def show_lookup_failure(gem_name, version, errors, domain)
if errors and !errors.empty?
- alert_error "Could not find a valid gem '#{gem_name}' (#{version}), here is why:"
- errors.each { |x| say " #{x.wordy}" }
+ msg = "Could not find a valid gem '#{gem_name}' (#{version}), here is why:\n"
+ errors.each { |x| msg << " #{x.wordy}\n" }
+ alert_error msg
else
alert_error "Could not find a valid gem '#{gem_name}' (#{version}) in any repository"
end
@@ -180,6 +182,21 @@ class Gem::Command
end
##
+ # Get all [gem, version] from the command line.
+ #
+ # An argument in the form gem:ver is pull apart into the gen name and version,
+ # respectively.
+ def get_all_gem_names_and_versions
+ get_all_gem_names.map do |name|
+ if /\A(.*):(#{Gem::Requirement::PATTERN_RAW})\z/ =~ name
+ [$1, $2]
+ else
+ [name]
+ end
+ end
+ end
+
+ ##
# Get a single gem name from the command line. Fail if there is no gem name
# or if there is more than one gem name given.
@@ -268,8 +285,18 @@ class Gem::Command
# Invoke the command with the given list of arguments.
def invoke(*args)
+ invoke_with_build_args args, nil
+ end
+
+ ##
+ # Invoke the command with the given list of normal arguments
+ # and additional build arguments.
+
+ def invoke_with_build_args(args, build_args)
handle_options args
+ options[:build_args] = build_args
+
if options[:help] then
show_help
elsif @when_invoked then
@@ -344,7 +371,7 @@ class Gem::Command
def handle_options(args)
args = add_extra_args(args)
- @options = @defaults.clone
+ @options = Marshal.load Marshal.dump @defaults # deep copy
parser.parse!(args)
@options[:args] = args
end
@@ -372,18 +399,23 @@ class Gem::Command
private
- ##
- # Create on demand parser.
+ def add_parser_description # :nodoc:
+ return unless description
- def parser
- create_option_parser if @parser.nil?
- @parser
- end
+ formatted = description.split("\n\n").map do |chunk|
+ wrap chunk, 80 - 4
+ end.join "\n"
- def create_option_parser
- @parser = OptionParser.new
+ @parser.separator nil
+ @parser.separator " Description:"
+ formatted.split("\n").each do |line|
+ @parser.separator " #{line.rstrip}"
+ end
+ end
+ def add_parser_options # :nodoc:
@parser.separator nil
+
regular_options = @option_groups.delete :options
configure_options "", regular_options
@@ -392,45 +424,56 @@ class Gem::Command
@parser.separator nil
configure_options group_name, option_list
end
+ end
- @parser.separator nil
- configure_options "Common", Gem::Command.common_options
+ ##
+ # Adds a section with +title+ and +content+ to the parser help view. Used
+ # for adding command arguments and default arguments.
- unless arguments.empty?
- @parser.separator nil
- @parser.separator " Arguments:"
- arguments.split(/\n/).each do |arg_desc|
- @parser.separator " #{arg_desc}"
- end
- end
+ def add_parser_run_info title, content
+ return if content.empty?
- if @summary then
- @parser.separator nil
- @parser.separator " Summary:"
- wrap(@summary, 80 - 4).split("\n").each do |line|
- @parser.separator " #{line.strip}"
- end
+ @parser.separator nil
+ @parser.separator " #{title}:"
+ content.split(/\n/).each do |line|
+ @parser.separator " #{line}"
end
+ end
- if description then
- formatted = description.split("\n\n").map do |chunk|
- wrap chunk, 80 - 4
- end.join "\n"
+ def add_parser_summary # :nodoc:
+ return unless @summary
- @parser.separator nil
- @parser.separator " Description:"
- formatted.split("\n").each do |line|
- @parser.separator " #{line.rstrip}"
- end
+ @parser.separator nil
+ @parser.separator " Summary:"
+ wrap(@summary, 80 - 4).split("\n").each do |line|
+ @parser.separator " #{line.strip}"
end
+ end
- unless defaults_str.empty?
- @parser.separator nil
- @parser.separator " Defaults:"
- defaults_str.split(/\n/).each do |line|
- @parser.separator " #{line}"
- end
- end
+ ##
+ # Create on demand parser.
+
+ def parser
+ create_option_parser if @parser.nil?
+ @parser
+ end
+
+ ##
+ # Creates an option parser and fills it in with the help info for the
+ # command.
+
+ def create_option_parser
+ @parser = OptionParser.new
+
+ add_parser_options
+
+ @parser.separator nil
+ configure_options "Common", Gem::Command.common_options
+
+ add_parser_run_info "Arguments", arguments
+ add_parser_summary
+ add_parser_description
+ add_parser_run_info "Defaults", defaults_str
end
def configure_options(header, option_list)
@@ -521,7 +564,7 @@ basic help message containing pointers to more information.
http://localhost:8808/
with info about installed gems
Further information:
- http://rubygems.rubyforge.org
+ http://guides.rubygems.org
HELP
# :startdoc:
@@ -529,7 +572,7 @@ basic help message containing pointers to more information.
end
##
-# This is where Commands will be placed in the namespace
+# \Commands will be placed in this namespace
module Gem::Commands
end
diff --git a/lib/rubygems/command_manager.rb b/lib/rubygems/command_manager.rb
index 9edd550136..fdee064fed 100644
--- a/lib/rubygems/command_manager.rb
+++ b/lib/rubygems/command_manager.rb
@@ -18,18 +18,54 @@ require 'rubygems/user_interaction'
# # file rubygems_plugin.rb
# require 'rubygems/command_manager'
#
+# Gem::CommandManager.instance.register_command :edit
+#
+# You should put the implementation of your command in rubygems/commands.
+#
+# # file rubygems/commands/edit_command.rb
# class Gem::Commands::EditCommand < Gem::Command
# # ...
# end
#
-# Gem::CommandManager.instance.register_command :edit
-#
# See Gem::Command for instructions on writing gem commands.
class Gem::CommandManager
include Gem::UserInteraction
+ BUILTIN_COMMANDS = [ # :nodoc:
+ :build,
+ :cert,
+ :check,
+ :cleanup,
+ :contents,
+ :dependency,
+ :environment,
+ :fetch,
+ :generate_index,
+ :help,
+ :install,
+ :list,
+ :lock,
+ :mirror,
+ :outdated,
+ :owner,
+ :pristine,
+ :push,
+ :query,
+ :rdoc,
+ :search,
+ :server,
+ :sources,
+ :specification,
+ :stale,
+ :uninstall,
+ :unpack,
+ :update,
+ :which,
+ :yank,
+ ]
+
##
# Return the authoritative instance of the command manager.
@@ -38,6 +74,14 @@ class Gem::CommandManager
end
##
+ # Returns self. Allows a CommandManager instance to stand
+ # in for the class itself.
+
+ def instance
+ self
+ end
+
+ ##
# Reset the authoritative instance of the command manager.
def self.reset
@@ -50,41 +94,17 @@ 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 :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
+
+ BUILTIN_COMMANDS.each do |name|
+ register_command name
+ end
end
##
# Register the Symbol +command+ as a gem command.
- def register_command(command)
- @commands[command] = false
+ def register_command(command, obj=false)
+ @commands[command] = obj
end
##
@@ -95,7 +115,7 @@ class Gem::CommandManager
end
##
- # Return the registered command from the command name.
+ # Returns a Command instance for +command_name+
def [](command_name)
command_name = command_name.intern
@@ -104,56 +124,58 @@ class Gem::CommandManager
end
##
- # Return a sorted list of all command names (as strings).
+ # Return a sorted list of all command names as strings.
def command_names
@commands.keys.collect {|key| key.to_s}.sort
end
##
- # Run the config specified by +args+.
+ # Run the command specified by +args+.
- def run(args)
- process_args(args)
+ 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}"
- ui.errs.puts "\t#{ex.backtrace.join "\n\t"}" if
- Gem.configuration.backtrace
+ ui.backtrace ex
+
terminate_interaction(1)
rescue Interrupt
alert_error "Interrupted"
terminate_interaction(1)
end
- def process_args(args)
- args = args.to_str.split(/\s+/) if args.respond_to?(:to_str)
- if args.size == 0
+ def process_args(args, build_args=nil)
+ if args.empty? then
say Gem::Command::HELP
- terminate_interaction(1)
+ terminate_interaction 1
end
- case args[0]
- when '-h', '--help'
+
+ case args.first
+ when '-h', '--help' then
say Gem::Command::HELP
- terminate_interaction(0)
- when '-v', '--version'
+ terminate_interaction 0
+ when '-v', '--version' then
say Gem::VERSION
- terminate_interaction(0)
- when /^-/
- alert_error "Invalid option: #{args[0]}. See 'gem --help'."
- terminate_interaction(1)
+ terminate_interaction 0
+ when /^-/ then
+ alert_error "Invalid option: #{args.first}. See 'gem --help'."
+ terminate_interaction 1
else
cmd_name = args.shift.downcase
- cmd = find_command(cmd_name)
- cmd.invoke(*args)
+ cmd = find_command cmd_name
+ cmd.invoke_with_build_args args, build_args
end
end
def find_command(cmd_name)
possibilities = find_command_possibilities cmd_name
+
if possibilities.size > 1 then
- raise "Ambiguous command #{cmd_name} matches [#{possibilities.join(', ')}]"
- elsif possibilities.size < 1 then
- raise "Unknown command #{cmd_name}"
+ raise Gem::CommandLineError,
+ "Ambiguous command #{cmd_name} matches [#{possibilities.join(', ')}]"
+ elsif possibilities.empty? then
+ raise Gem::CommandLineError, "Unknown command #{cmd_name}"
end
self[possibilities.first]
@@ -162,7 +184,11 @@ class Gem::CommandManager
def find_command_possibilities(cmd_name)
len = cmd_name.length
- command_names.select { |n| cmd_name == n[0, len] }
+ found = command_names.select { |name| cmd_name == name[0, len] }
+
+ exact = found.find { |name| name == cmd_name }
+
+ exact ? [exact] : found
end
private
@@ -170,23 +196,20 @@ class Gem::CommandManager
def load_and_instantiate(command_name)
command_name = command_name.to_s
const_name = command_name.capitalize.gsub(/_(.)/) { $1.upcase } << "Command"
- commands = Gem::Commands
- retried = false
+ load_error = nil
begin
- commands.const_get(const_name).new
- rescue NameError
- raise if retried
-
- retried = true
begin
require "rubygems/commands/#{command_name}_command"
- rescue Exception => e
- alert_error "Loading command: #{command_name} (#{e.class})\n #{e}"
- ui.errs.puts "\t#{e.backtrace.join "\n\t"}" if
- Gem.configuration.backtrace
+ rescue LoadError => e
+ load_error = e
end
- retry
+ Gem::Commands.const_get(const_name).new
+ rescue Exception => e
+ e = load_error if load_error
+
+ alert_error "Loading command: #{command_name} (#{e.class})\n\t#{e}"
+ ui.backtrace e
end
end
diff --git a/lib/rubygems/commands/build_command.rb b/lib/rubygems/commands/build_command.rb
index 36a6fe48f2..d975429fe8 100644
--- a/lib/rubygems/commands/build_command.rb
+++ b/lib/rubygems/commands/build_command.rb
@@ -1,5 +1,5 @@
require 'rubygems/command'
-require 'rubygems/builder'
+require 'rubygems/package'
class Gem::Commands::BuildCommand < Gem::Command
@@ -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
@@ -22,11 +41,11 @@ class Gem::Commands::BuildCommand < Gem::Command
def execute
gemspec = get_one_gem_name
- if File.exist? gemspec
- spec = load_gemspec gemspec
+ if File.exist? gemspec then
+ spec = Gem::Specification.load gemspec
if spec then
- Gem::Builder.new(spec).build options[:force]
+ Gem::Package.build spec, options[:force]
else
alert_error "Error loading gemspec. Aborting."
terminate_interaction 1
@@ -37,23 +56,5 @@ class Gem::Commands::BuildCommand < Gem::Command
end
end
- def load_gemspec filename
- if yaml?(filename)
- open(filename) do |f|
- begin
- Gem::Specification.from_yaml(f)
- rescue Gem::EndOfYAMLException
- nil
- end
- end
- else
- Gem::Specification.load(filename) # can return nil
- end
- end
-
- def yaml?(filename)
- line = open(filename) { |f| line = f.gets }
- result = line =~ %r{!ruby/object:Gem::Specification}
- result
- end
end
+
diff --git a/lib/rubygems/commands/cert_command.rb b/lib/rubygems/commands/cert_command.rb
index b416b3863d..e417193bca 100644
--- a/lib/rubygems/commands/cert_command.rb
+++ b/lib/rubygems/commands/cert_command.rb
@@ -1,86 +1,278 @@
require 'rubygems/command'
require 'rubygems/security'
+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
def initialize
- super 'cert', 'Manage RubyGems certificates and signing settings'
-
- add_option('-a', '--add CERT',
- 'Add a trusted certificate.') do |value, options|
- cert = OpenSSL::X509::Certificate.new(File.read(value))
- Gem::Security.add_trusted_cert(cert)
- say "Added '#{cert.subject.to_s}'"
- end
-
- add_option('-l', '--list',
- 'List trusted certificates.') do |value, options|
- glob_str = File::join(Gem::Security::OPT[:trust_dir], '*.pem')
- Dir::glob(glob_str) do |path|
- begin
- cert = OpenSSL::X509::Certificate.new(File.read(path))
- # this could probably be formatted more gracefully
- say cert.subject.to_s
- rescue OpenSSL::X509::CertificateError
- next
- end
+ super 'cert', 'Manage RubyGems certificates and signing settings',
+ :add => [], :remove => [], :list => [], :build => [], :sign => []
+
+ OptionParser.accept OpenSSL::X509::Certificate do |certificate|
+ begin
+ OpenSSL::X509::Certificate.new File.read certificate
+ rescue Errno::ENOENT
+ raise OptionParser::InvalidArgument, "#{certificate}: does not exist"
+ rescue OpenSSL::X509::CertificateError
+ raise OptionParser::InvalidArgument,
+ "#{certificate}: invalid X509 certificate"
end
end
- add_option('-r', '--remove STRING',
- 'Remove trusted certificates containing',
- 'STRING.') do |value, options|
- trust_dir = Gem::Security::OPT[:trust_dir]
- glob_str = File::join(trust_dir, '*.pem')
-
- Dir::glob(glob_str) do |path|
- begin
- cert = OpenSSL::X509::Certificate.new(File.read(path))
- if cert.subject.to_s.downcase.index(value)
- say "Removed '#{cert.subject.to_s}'"
- File.unlink(path)
- end
- rescue OpenSSL::X509::CertificateError
- next
- end
+ OptionParser.accept OpenSSL::PKey::RSA do |key_file|
+ begin
+ 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
+ raise OptionParser::InvalidArgument, "#{key_file}: invalid RSA key"
end
+
+ raise OptionParser::InvalidArgument,
+ "#{key_file}: private key not found" unless key.private?
+
+ key
+ end
+
+ add_option('-a', '--add CERT', OpenSSL::X509::Certificate,
+ 'Add a trusted certificate.') do |cert, options|
+ options[:add] << cert
+ end
+
+ add_option('-l', '--list [FILTER]',
+ 'List trusted certificates where the',
+ 'subject contains FILTER') do |filter, options|
+ filter ||= ''
+
+ options[:list] << filter
+ end
+
+ add_option('-r', '--remove FILTER',
+ 'Remove trusted certificates where the',
+ 'subject contains FILTER') do |filter, options|
+ options[:remove] << filter
end
add_option('-b', '--build EMAIL_ADDR',
'Build private key and self-signed',
- 'certificate for EMAIL_ADDR.') do |value, options|
- vals = Gem::Security.build_self_signed_cert(value)
- FileUtils.chmod 0600, vals[:key_path]
- say "Public Cert: #{vals[:cert_path]}"
- say "Private Key: #{vals[:key_path]}"
- say "Don't forget to move the key file to somewhere private..."
+ 'certificate for EMAIL_ADDR') do |email_address, options|
+ options[:build] << email_address
end
- add_option('-C', '--certificate CERT',
- 'Certificate for --sign command.') do |value, options|
- cert = OpenSSL::X509::Certificate.new(File.read(value))
+ add_option('-C', '--certificate CERT', OpenSSL::X509::Certificate,
+ 'Signing certificate for --sign') do |cert, options|
options[:issuer_cert] = cert
end
- add_option('-K', '--private-key KEY',
- 'Private key for --sign command.') do |value, options|
- key = OpenSSL::PKey::RSA.new(File.read(value))
- options[:issuer_key] = key
+ add_option('-K', '--private-key KEY', OpenSSL::PKey::RSA,
+ 'Key for --sign or --build') do |key, options|
+ options[:key] = key
end
- add_option('-s', '--sign NEWCERT',
- 'Sign a certificate with my key and',
- 'certificate.') do |value, options|
- cert = OpenSSL::X509::Certificate.new(File.read(value))
- my_cert = options[:issuer_cert]
- my_key = options[:issuer_key]
- cert = Gem::Security.sign_cert(cert, my_key, my_cert)
- File.open(value, 'wb') { |file| file.write(cert.to_pem) }
+ add_option('-s', '--sign CERT',
+ 'Signs CERT with the key from -K',
+ 'and the certificate from -C') do |cert_file, options|
+ raise OptionParser::InvalidArgument, "#{cert_file}: does not exist" unless
+ File.file? cert_file
+
+ options[:sign] << cert_file
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|
+ add_certificate certificate
+ end
+
+ options[:remove].each do |filter|
+ remove_certificates_matching filter
+ end
+
+ options[:list].each do |filter|
+ list_certificates_matching filter
+ end
+
+ options[:build].each do |name|
+ build name
+ end
+
+ sign_certificates unless options[:sign].empty?
end
-end
+ def build name
+ 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
+
+ def build_key # :nodoc:
+ if options[:key] then
+ options[:key]
+ else
+ 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
+ end
+
+ def certificates_matching filter
+ return enum_for __method__, filter unless block_given?
+
+ Gem::Security.trusted_certificates.select do |certificate, _|
+ subject = certificate.subject.to_s
+ subject.downcase.index filter
+ end.sort_by do |certificate, _|
+ certificate.subject.to_a.map { |name, data,| [name, data] }
+ end.each do |certificate, path|
+ yield certificate, path
+ end
+ end
+
+ def description # :nodoc:
+ <<-EOF
+The cert command manages signing keys and certificates for creating signed
+gems. Your signing certificate and private key are typically stored in
+~/.gem/gem-public_cert.pem and ~/.gem/gem-private_key.pem respectively.
+
+To build a certificate for signing gems:
+
+ gem cert --build you@example
+
+If you already have an RSA key, or are creating a new certificate for an
+existing key:
+
+ gem cert --build you@example --private-key /path/to/key.pem
+
+If you wish to trust a certificate you can add it to the trust list with:
+
+ gem cert --add /path/to/cert.pem
+
+You can list trusted certificates with:
+
+ gem cert --list
+
+or:
+
+ gem cert --list cert_subject_substring
+
+If you wish to remove a previously trusted certificate:
+
+ gem cert --remove cert_subject_substring
+
+To sign another gem author's certificate:
+
+ gem cert --sign /path/to/other_cert.pem
+
+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
+ options[:issuer_cert] = OpenSSL::X509::Certificate.new cert
+ rescue Errno::ENOENT
+ alert_error \
+ "--certificate not specified and ~/.gem/gem-public_cert.pem does not exist"
+
+ terminate_interaction 1
+ rescue OpenSSL::X509::CertificateError
+ alert_error \
+ "--certificate not specified and ~/.gem/gem-public_cert.pem is not valid"
+
+ terminate_interaction 1
+ end
+
+ def load_default_key
+ key_file = File.join Gem.default_key_path
+ key = File.read key_file
+ 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"
+
+ terminate_interaction 1
+ rescue OpenSSL::PKey::RSAError
+ alert_error \
+ "--private-key not specified and ~/.gem/gem-private_key.pem is not valid"
+
+ 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
+
+ permissions = File.stat(cert_file).mode & 0777
+
+ issuer_cert = options[:issuer_cert]
+ issuer_key = options[:key]
+
+ cert = Gem::Security.sign cert, issuer_key, issuer_cert
+
+ Gem::Security.write cert, cert_file, permissions
+ 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 5a1bfd4f12..8893b9c3b2 100644
--- a/lib/rubygems/commands/check_command.rb
+++ b/lib/rubygems/commands/check_command.rb
@@ -1,65 +1,93 @@
require 'rubygems/command'
require 'rubygems/version_option'
require 'rubygems/validator'
+require 'rubygems/doctor'
class Gem::Commands::CheckCommand < Gem::Command
include Gem::VersionOption
def initialize
- super 'check', 'Check installed gems',
- :verify => false, :alien => false
+ super 'check', 'Check a gem repository for added or missing files',
+ :alien => true, :doctor => false, :dry_run => false, :gems => true
- add_option( '--verify FILE',
- 'Verify gem file against its internal',
- 'checksum') do |value, options|
- options[:verify] = value
+ add_option('-a', '--[no-]alien',
+ 'Report "unmanaged" or rogue files in the',
+ 'gem repository') do |value, options|
+ options[:alien] = value
end
- add_option('-a', '--alien', "Report 'unmanaged' or rogue files in the",
- "gem repository") do |value, options|
- options[:alien] = true
+ add_option('--[no-]doctor',
+ 'Clean up uninstalled gems and broken',
+ 'specifications') do |value, options|
+ options[:doctor] = value
+ end
+
+ add_option('--[no-]dry-run',
+ 'Do not remove files, only report what',
+ 'would be removed') do |value, options|
+ options[:dry_run] = value
+ end
+
+ add_option('--[no-]gems',
+ 'Check installed gems for problems') do |value, options|
+ options[:gems] = value
end
add_version_option 'check'
end
- def execute
- if options[:alien]
- say "Performing the 'alien' operation"
- say
- gems = get_all_gem_names rescue []
- Gem::Validator.new.alien(gems).sort.each do |key, val|
- unless val.empty? then
- say "#{key} has #{val.size} problems"
- val.each do |error_entry|
- say " #{error_entry.path}:"
- say " #{error_entry.problem}"
- end
- else
- say "#{key} is error-free" if Gem.configuration.verbose
+ def check_gems
+ say 'Checking gems...'
+ say
+ gems = get_all_gem_names rescue []
+
+ Gem::Validator.new.alien(gems).sort.each do |key, val|
+ unless val.empty? then
+ say "#{key} has #{val.size} problems"
+ val.each do |error_entry|
+ say " #{error_entry.path}:"
+ say " #{error_entry.problem}"
end
- say
+ else
+ say "#{key} is error-free" if Gem.configuration.verbose
end
+ say
end
+ end
- if options[:verify]
- gem_name = options[:verify]
- unless gem_name
- alert_error "Must specify a .gem file with --verify NAME"
- return
- end
- unless File.exist?(gem_name)
- alert_error "Unknown file: #{gem_name}."
- return
- end
- say "Verifying gem: '#{gem_name}'"
- begin
- Gem::Validator.new.verify_gem_file(gem_name)
- rescue Exception
- alert_error "#{gem_name} is invalid."
- end
+ def doctor
+ say 'Checking for files from uninstalled gems...'
+ say
+
+ Gem.path.each do |gem_repo|
+ doctor = Gem::Doctor.new gem_repo, options[:dry_run]
+ doctor.doctor
end
end
+ def execute
+ check_gems if options[:gems]
+ doctor if options[:doctor]
+ end
+
+ def arguments # :nodoc:
+ 'GEMNAME name of gem to check'
+ end
+
+ def defaults_str # :nodoc:
+ '--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
+
end
diff --git a/lib/rubygems/commands/cleanup_command.rb b/lib/rubygems/commands/cleanup_command.rb
index 124c4c203a..c8f0082bfb 100644
--- a/lib/rubygems/commands/cleanup_command.rb
+++ b/lib/rubygems/commands/cleanup_command.rb
@@ -6,12 +6,21 @@ 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
+
+ @candidate_gems = nil
+ @default_gems = []
+ @full = nil
+ @gems_to_cleanup = nil
+ @original_home = nil
+ @original_path = nil
+ @primary_gems = nil
end
def arguments # :nodoc:
@@ -24,8 +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.
+
+If no gems are named all gems in GEM_HOME are cleaned.
EOF
end
@@ -35,66 +47,119 @@ installed elsewhere in GEM_PATH the cleanup command won't touch it.
def execute
say "Cleaning up installed gems..."
- primary_gems = {}
- Gem::Specification.each do |spec|
- if primary_gems[spec.name].nil? or
- primary_gems[spec.name].version < spec.version then
- primary_gems[spec.name] = spec
+ if options[:args].empty? then
+ done = false
+ last_set = nil
+
+ until done do
+ clean_gems
+
+ this_set = @gems_to_cleanup.map { |spec| spec.full_name }.sort
+
+ done = this_set.empty? || last_set == this_set
+
+ last_set = this_set
end
+ else
+ clean_gems
+ end
+
+ say "Clean Up Complete"
+
+ if Gem.configuration.really_verbose then
+ skipped = @default_gems.map { |spec| spec.full_name }
+
+ say "Skipped default gems: #{skipped.join ', '}"
+ end
+ end
+
+ def clean_gems
+ get_primary_gems
+ get_candidate_gems
+ get_gems_to_cleanup
+
+ @full = Gem::DependencyList.from_specs
+
+ deplist = Gem::DependencyList.new
+ @gems_to_cleanup.each do |spec| deplist.add spec end
+
+ deps = deplist.strongly_connected_components.flatten
+
+ @original_home = Gem.dir
+ @original_path = Gem.path
+
+ deps.reverse_each do |spec|
+ uninstall_dep spec
end
- gems_to_cleanup = unless options[:args].empty? then
+ Gem::Specification.reset
+ end
+
+ def get_candidate_gems
+ @candidate_gems = unless options[:args].empty? then
options[:args].map do |gem_name|
Gem::Specification.find_all_by_name gem_name
end.flatten
else
Gem::Specification.to_a
end
+ end
- gems_to_cleanup = gems_to_cleanup.select { |spec|
- primary_gems[spec.name].version != spec.version
+ def get_gems_to_cleanup
+ gems_to_cleanup = @candidate_gems.select { |spec|
+ @primary_gems[spec.name].version != spec.version
}
- deplist = Gem::DependencyList.new
- gems_to_cleanup.uniq.each do |spec| deplist.add spec end
+ default_gems, gems_to_cleanup = gems_to_cleanup.partition { |spec|
+ spec.default_gem?
+ }
- deps = deplist.strongly_connected_components.flatten.reverse
+ @default_gems += default_gems
+ @default_gems.uniq!
+ @gems_to_cleanup = gems_to_cleanup.uniq
+ end
- original_path = Gem.path
+ def get_primary_gems
+ @primary_gems = {}
- deps.each do |spec|
- if options[:dryrun] then
- say "Dry Run Mode: Would uninstall #{spec.full_name}"
- else
- say "Attempting to uninstall #{spec.full_name}"
+ Gem::Specification.each do |spec|
+ if @primary_gems[spec.name].nil? or
+ @primary_gems[spec.name].version < spec.version then
+ @primary_gems[spec.name] = spec
+ end
+ end
+ end
- options[:args] = [spec.name]
+ def uninstall_dep spec
+ return unless @full.ok_to_remove?(spec.full_name)
- uninstall_options = {
- :executables => false,
- :version => "= #{spec.version}",
- }
+ if options[:dryrun] then
+ say "Dry Run Mode: Would uninstall #{spec.full_name}"
+ return
+ end
- uninstall_options[:user_install] = Gem.user_dir == spec.base_dir
+ say "Attempting to uninstall #{spec.full_name}"
- uninstaller = Gem::Uninstaller.new spec.name, uninstall_options
+ uninstall_options = {
+ :executables => false,
+ :version => "= #{spec.version}",
+ }
- begin
- uninstaller.uninstall
- rescue Gem::DependencyRemovalException, Gem::InstallError,
- Gem::GemNotInHomeException, Gem::FilePermissionError => e
- say "Unable to uninstall #{spec.full_name}:"
- say "\t#{e.class}: #{e.message}"
- end
- end
+ uninstall_options[:user_install] = Gem.user_dir == spec.base_dir
- # Restore path Gem::Uninstaller may have change
- Gem.use_paths(*original_path)
- end
+ uninstaller = Gem::Uninstaller.new spec.name, uninstall_options
- say "Clean Up Complete"
+ begin
+ uninstaller.uninstall
+ rescue Gem::DependencyRemovalException, Gem::InstallError,
+ Gem::GemNotInHomeException, Gem::FilePermissionError => e
+ say "Unable to uninstall #{spec.full_name}:"
+ say "\t#{e.class}: #{e.message}"
+ end
+ ensure
+ # Restore path Gem::Uninstaller may have changed
+ Gem.use_paths @original_home, *@original_path
end
end
-
diff --git a/lib/rubygems/commands/contents_command.rb b/lib/rubygems/commands/contents_command.rb
index e483484615..97218848ed 100644
--- a/lib/rubygems/commands/contents_command.rb
+++ b/lib/rubygems/commands/contents_command.rb
@@ -1,3 +1,4 @@
+require 'English'
require 'rubygems/command'
require 'rubygems/version_option'
@@ -30,6 +31,10 @@ class Gem::Commands::ContentsCommand < Gem::Command
"Don't include installed path prefix") do |prefix, options|
options[:prefix] = prefix
end
+
+ @path_kind = nil
+ @spec_dirs = nil
+ @version = nil
end
def arguments # :nodoc:
@@ -40,62 +45,126 @@ 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.each { |dir| say dir }
- end
-
- terminate_interaction 1 if gem_names.length == 1
+ names.each do |name|
+ found = gem_contents name
+
+ terminate_interaction 1 unless found or names.length > 1
+ 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}\//
+ [Gem::ConfigMap[:bindir], $POSTMATCH]
+ when /\.so\z/
+ [Gem::ConfigMap[:archdir], file]
+ else
+ [Gem::ConfigMap[:rubylibdir], file]
end
+ end
+ end
+
+ def gem_contents name
+ spec = spec_for name
- gem_path = spec.full_gem_path
- extra = "/{#{spec.require_paths.join ','}}" if options[:lib_only]
- glob = "#{gem_path}#{extra}/**/*"
- files = Dir[glob]
+ return false unless spec
- gem_path = File.join gem_path, '' # add trailing / if missing
+ files = files_in spec
- files.sort.each do |file|
- next if File.directory? file
+ show_files files
- file = file.sub gem_path, '' unless options[:prefix]
+ 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
- say file
+ 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 67cbbc1d5e..c5d6dd7d70 100644
--- a/lib/rubygems/commands/dependency_command.rb
+++ b/lib/rubygems/commands/dependency_command.rb
@@ -38,94 +38,121 @@ class Gem::Commands::DependencyCommand < Gem::Command
"--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"
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
+
+ ss, = fetcher.spec_for_dependency dependency
+
+ 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
- options[:args] << '' if options[:args].empty?
+ specs.uniq.sort
+ end
+
+ def gem_dependency args, version, prerelease # :nodoc:
+ args << '' if args.empty?
- pattern = if options[:args].length == 1 and
- options[:args].first =~ /\A\/(.*)\/(i)?\z/m then
+ 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
- # REFACTOR: fetcher.find_specs_matching => specs
- specs_and_sources = fetcher.find_matching(dependency,
- dependency.specific?, true,
- dependency.prerelease?)
+ def display_readable specs, reverse # :nodoc:
+ response = ''
- specs.concat specs_and_sources.map { |spec_tuple, source_uri|
- fetcher.fetch_spec spec_tuple, URI.parse(source_uri)
- }
+ 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
@@ -136,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 9585c71250..d32d12b757 100644
--- a/lib/rubygems/commands/environment_command.rb
+++ b/lib/rubygems/commands/environment_command.rb
@@ -21,36 +21,44 @@ 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
-~/.gemrc file for individual users and a /etc/gemrc for all users. A gemrc
-is a YAML file with the following YAML keys:
+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:
:sources: A YAML array of remote gem repositories to install gems from
- :verbose: Verbosity of the gem command. false, true, and :really are the
+ :verbose: Verbosity of the gem command. false, true, and :really are the
levels
:update_sources: Enable/disable automatic updating of repository metadata
:backtrace: Print backtrace when RubyGems encounters an error
:gempath: The paths in which to look for gems
- gem_command: A string containing arguments for the specified gem command
+ :disable_default_gem_server: Force specification of gem server host on push
+ <gem_command>: A string containing arguments for the specified gem command
Example:
:verbose: false
install: --no-wrappers
update: --no-wrappers
+ :disable_default_gem_server: true
RubyGems' default local repository can be overridden with the GEM_PATH and
-GEM_HOME environment variables. GEM_HOME sets the default repository to
-install into. GEM_PATH allows multiple local repositories to be searched for
+GEM_HOME environment variables. GEM_HOME sets the default repository to
+install into. GEM_PATH allows multiple local repositories to be searched for
gems.
If you are behind a proxy server, RubyGems uses the HTTP_PROXY,
HTTP_PROXY_USER and HTTP_PROXY_PASS environment variables to discover the
proxy server.
+If you would like to push gems to a private gem server the RUBYGEMS_HOST
+environment variable can be set to the URI for that server.
+
If you are packaging RubyGems all of RubyGems' defaults are in
lib/rubygems/defaults.rb. You may override these in
lib/rubygems/defaults/operating_system.rb
@@ -64,66 +72,83 @@ 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.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"
- else
- raise Gem::CommandLineError, "Unknown environment option [#{arg}]"
+ out << " - EXECUTABLE DIRECTORY: #{Gem.bindir}\n"
+
+ out << " - SPEC CACHE DIRECTORY: #{Gem.spec_cache_dir}\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 e7c9cc9525..c57ab0089a 100644
--- a/lib/rubygems/commands/fetch_command.rb
+++ b/lib/rubygems/commands/fetch_command.rb
@@ -28,13 +28,22 @@ 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
def execute
version = options[:version] || Gem::Requirement.default
- all = Gem::Requirement.default != version
platform = Gem.platforms.last
gem_names = get_all_gem_names
@@ -44,31 +53,21 @@ class Gem::Commands::FetchCommand < Gem::Command
dep.prerelease = options[:prerelease]
specs_and_sources, errors =
- Gem::SpecFetcher.fetcher.fetch_with_errors(dep, all, true,
- dep.prerelease?)
+ Gem::SpecFetcher.fetcher.spec_for_dependency dep
if platform then
filtered = specs_and_sources.select { |s,| s.platform == platform }
specs_and_sources = filtered unless filtered.empty?
end
- spec, source_uri = specs_and_sources.sort_by { |s,| s.version }.last
+ spec, source = specs_and_sources.max_by { |s,| s.version }
if spec.nil? then
show_lookup_failure gem_name, version, errors, options[:domain]
next
end
- file = "#{spec.full_name}.gem"
- remote_path = URI.parse(source_uri) + "gems/#{file}"
-
- fetch = Gem::RemoteFetcher.fetcher
-
- gem = fetch.fetch_path remote_path.to_s
-
- File.open file, "wb" do |f|
- f.write gem
- end
+ source.download spec
say "Downloaded #{spec.full_name}"
end
diff --git a/lib/rubygems/commands/generate_index_command.rb b/lib/rubygems/commands/generate_index_command.rb
index d4b4790649..a7db013caf 100644
--- a/lib/rubygems/commands/generate_index_command.rb
+++ b/lib/rubygems/commands/generate_index_command.rb
@@ -11,29 +11,16 @@ class Gem::Commands::GenerateIndexCommand < Gem::Command
def initialize
super 'generate_index',
'Generates the index files for a gem server directory',
- :directory => '.', :build_legacy => true, :build_modern => true
+ :directory => '.', :build_modern => true
add_option '-d', '--directory=DIRNAME',
'repository base dir containing gems subdir' do |dir, options|
options[:directory] = File.expand_path dir
end
- add_option '--[no-]legacy',
- 'Generate Marshal.4.8' do |value, options|
- unless options[:build_modern] or value then
- raise OptionParser::InvalidOption, 'no indicies will be built'
- end
-
- options[:build_legacy] = value
- end
-
add_option '--[no-]modern',
- 'Generate indexes for RubyGems newer',
- 'than 1.2.0' do |value, options|
- unless options[:build_legacy] or value then
- raise OptionParser::InvalidOption, 'no indicies will be built'
- end
-
+ 'Generate indexes for RubyGems',
+ '(always true)' do |value, options|
options[:build_modern] = value
end
@@ -42,27 +29,10 @@ class Gem::Commands::GenerateIndexCommand < Gem::Command
'since the last update' do |value, options|
options[:update] = value
end
-
- add_option :RSS, '--rss-gems-host=GEM_HOST',
- 'Host name where gems are served from,',
- 'used for GUID and enclosure values' do |value, options|
- options[:rss_gems_host] = value
- end
-
- add_option :RSS, '--rss-host=HOST',
- 'Host name for more gems information,',
- 'used for RSS feed link' do |value, options|
- options[:rss_host] = value
- end
-
- add_option :RSS, '--rss-title=TITLE',
- 'Set title for RSS feed' do |value, options|
- options[:rss_title] = value
- end
end
def defaults_str # :nodoc:
- "--directory . --legacy --modern"
+ "--directory . --modern"
end
def description # :nodoc:
@@ -85,25 +55,15 @@ When done, it will generate a set of files like this:
prerelease_specs.<version>.gz # prerelease specs index
quick/Marshal.<version>/<gemname>.gemspec.rz # Marshal quick index file
- # these files support legacy RubyGems
- Marshal.<version>
- Marshal.<version>.Z # Marshal full index
-
-The .Z and .rz extension files are compressed with the inflate algorithm.
+The .rz extension files are compressed with the inflate algorithm.
The Marshal version number comes from ruby's Marshal::MAJOR_VERSION and
Marshal::MINOR_VERSION constants. It is used to ensure compatibility.
-
-If --rss-host and --rss-gem-host are given an RSS feed will be generated at
-index.rss containing gems released in the last two days.
EOF
end
def execute
- if options[:update] and
- (options[:rss_host] or options[:rss_gems_host]) then
- alert_error '--update not compatible with RSS generation'
- terminate_interaction 1
- end
+ # This is always true becasue it's the only way now.
+ options[:build_modern] = true
if not File.exist?(options[:directory]) or
not File.directory?(options[:directory]) then
diff --git a/lib/rubygems/commands/help_command.rb b/lib/rubygems/commands/help_command.rb
index 20b52429b2..ed7be903ac 100644
--- a/lib/rubygems/commands/help_command.rb
+++ b/lib/rubygems/commands/help_command.rb
@@ -37,7 +37,7 @@ Some examples of 'gem' usage.
* Create a gem:
- See http://rubygems.rubyforge.org/wiki/wiki.pl?CreateAGemInTenMinutes
+ See http://guides.rubygems.org/make-your-own-gem/
* See information about RubyGems:
@@ -46,6 +46,10 @@ Some examples of 'gem' usage.
* Update all gems on your system:
gem update
+
+* Update your local version of RubyGems
+
+ gem update --system
EOF
PLATFORMS = <<-'EOF'
@@ -55,8 +59,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,11 +71,20 @@ 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
@@ -80,6 +94,8 @@ platform.
def initialize
super 'help', "Provide help on the 'gem' command"
+
+ @command_manager = Gem::CommandManager.instance
end
def arguments # :nodoc:
@@ -96,38 +112,10 @@ 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
-
- desc_width = command_manager.command_names.map { |n| n.size }.max + 4
-
- summary_width = 80 - margin_width - desc_width
- wrap_indent = ' ' * (margin_width + desc_width)
- format = "#{' ' * margin_width}%-#{desc_width}s%s"
-
- command_manager.command_names.each do |cmd_name|
- summary = command_manager[cmd_name].summary
- 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
-
- 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")
+ show_commands
elsif begins? "options", arg then
say Gem::Command::HELP
@@ -139,29 +127,79 @@ platform.
say PLATFORMS
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'"
- end
+ show_help
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
+ show_command_help arg
else
say Gem::Command::HELP
end
end
+ def show_commands # :nodoc:
+ out = []
+ out << "GEM commands are:"
+ out << nil
+
+ margin_width = 4
+
+ desc_width = @command_manager.command_names.map { |n| n.size }.max + 4
+
+ summary_width = 80 - margin_width - desc_width
+ wrap_indent = ' ' * (margin_width + desc_width)
+ format = "#{' ' * margin_width}%-#{desc_width}s%s"
+
+ @command_manager.command_names.each do |cmd_name|
+ command = @command_manager[cmd_name]
+
+ summary =
+ if command then
+ command.summary
+ else
+ "[No command found for #{cmd_name}]"
+ 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
+
+ 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
+ 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
+
end
diff --git a/lib/rubygems/commands/install_command.rb b/lib/rubygems/commands/install_command.rb
index 003ba8601c..68a2fad129 100644
--- a/lib/rubygems/commands/install_command.rb
+++ b/lib/rubygems/commands/install_command.rb
@@ -1,5 +1,4 @@
require 'rubygems/command'
-require 'rubygems/doc_manager'
require 'rubygems/install_update_options'
require 'rubygems/dependency_installer'
require 'rubygems/local_remote_options'
@@ -13,16 +12,17 @@ require 'rubygems/version_option'
class Gem::Commands::InstallCommand < Gem::Command
+ attr_reader :installed_specs # :nodoc:
+
include Gem::VersionOption
include Gem::LocalRemoteOptions
include Gem::InstallUpdateOptions
def initialize
defaults = Gem::DependencyInstaller::DEFAULT_OPTIONS.merge({
- :generate_rdoc => true,
- :generate_ri => true,
:format_executable => false,
:version => Gem::Requirement.default,
+ :without_groups => [],
})
super 'install', 'Install a gem into the local repository', defaults
@@ -32,6 +32,37 @@ class Gem::Commands::InstallCommand < Gem::Command
add_platform_option
add_version_option
add_prerelease_option "to be installed. (Only for listed gems)"
+
+ 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
+
+ o[:gemdeps] = v
+ end
+
+ 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
+
+ @installed_specs = nil
end
def arguments # :nodoc:
@@ -39,7 +70,7 @@ class Gem::Commands::InstallCommand < Gem::Command
end
def defaults_str # :nodoc:
- "--both --version '#{Gem::Requirement.default}' --rdoc --ri --no-force\n" \
+ "--both --version '#{Gem::Requirement.default}' --document --no-force\n" +
"--install-dir #{Gem.dir}"
end
@@ -100,31 +131,97 @@ to write the specification by hand. For example:
"#{program_name} GEMNAME [GEMNAME ...] [options] -- --build-flags"
end
+ 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_dependencies] then
- alert "`gem install -y` is now default and will be removed"
- alert "use --ignore-dependencies to install only the gems you list"
+ if options.include? :gemdeps then
+ install_from_gemdeps
+ return # not reached
end
- installed_gems = []
+ @installed_specs = []
ENV.delete 'GEM_PATH' if options[:install_dir].nil? and RUBY_VERSION > '1.9'
- exit_code = 0
+ check_install_dir
+ check_version
- get_all_gem_names.each do |gem_name|
- begin
- next if options[:conservative] and
- not Gem::Dependency.new(gem_name, options[:version]).matching_specs.empty?
+ 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
+
+ specs = rs.install_from_gemdeps options do |req, inst|
+ s = req.full_spec
+
+ if inst
+ say "Installing #{s.name} (#{s.version})"
+ else
+ say "Using #{s.name} (#{s.version})"
+ end
+ end
+
+ @installed_specs = specs
+
+ terminate_interaction
+ end
+
+ def install_gem name, version # :nodoc:
+ return if options[:conservative] and
+ not Gem::Dependency.new(name, version).matching_specs.empty?
+
+ req = Gem::Requirement.create(version)
+
+ inst = Gem::DependencyInstaller.new options
- inst = Gem::DependencyInstaller.new options
- inst.install gem_name, options[:version]
+ if options[:explain]
+ request_set = inst.resolve_dependencies name, req
- inst.installed_gems.each do |spec|
- say "Successfully installed #{spec.full_name}"
- end
+ puts "Gems to install:"
+
+ request_set.specs.map { |s| s.full_name }.sort.each do |s|
+ puts " #{s}"
+ end
+
+ return
+ else
+ inst.install name, req
+ end
+
+ @installed_specs.push(*inst.installed_gems)
+
+ show_install_errors inst.errors
+ end
- installed_gems.push(*inst.installed_gems)
+ def install_gems # :nodoc:
+ exit_code = 0
+
+ get_all_gem_names_and_versions.each do |gem_name, gem_version|
+ gem_version ||= options[:version]
+
+ begin
+ install_gem gem_name, gem_version
rescue Gem::InstallError => e
alert_error "Error installing #{gem_name}:\n\t#{e.message}"
exit_code |= 1
@@ -135,30 +232,38 @@ to write the specification by hand. For example:
end
end
- unless installed_gems.empty? then
- gems = installed_gems.length == 1 ? 'gem' : 'gems'
- say "#{installed_gems.length} #{gems} installed"
+ exit_code
+ end
- # NOTE: *All* of the RI documents must be generated first. For some
- # reason, RI docs cannot be generated after any RDoc documents are
- # generated.
+ ##
+ # Loads post-install hooks
- if options[:generate_ri] then
- installed_gems.each do |gem|
- Gem::DocManager.new(gem, options[:rdoc_args]).generate_ri
- end
+ def load_hooks # :nodoc:
+ if options[:install_as_default]
+ require 'rubygems/install_default_message'
+ else
+ require 'rubygems/install_message'
+ end
+ require 'rubygems/rdoc'
+ end
- Gem::DocManager.update_ri_cache
- end
+ def show_install_errors errors # :nodoc:
+ return unless errors
- if options[:generate_rdoc] then
- installed_gems.each do |gem|
- Gem::DocManager.new(gem, options[:rdoc_args]).generate_rdoc
- end
- end
+ 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..4edeabef02 100644
--- a/lib/rubygems/commands/list_command.rb
+++ b/lib/rubygems/commands/list_command.rb
@@ -8,7 +8,7 @@ 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 starts with STRING'
remove_option('--name-matches')
end
@@ -21,14 +21,19 @@ class Gem::Commands::ListCommand < Gem::Commands::QueryCommand
"--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/lock_command.rb b/lib/rubygems/commands/lock_command.rb
index a6dca320ef..6b4b25a281 100644
--- a/lib/rubygems/commands/lock_command.rb
+++ b/lib/rubygems/commands/lock_command.rb
@@ -30,7 +30,7 @@ generated.
Example:
- gemlock rails-1.0.0 > lockdown.rb
+ gem lock rails-1.0.0 > lockdown.rb
will produce in lockdown.rb:
diff --git a/lib/rubygems/commands/mirror_command.rb b/lib/rubygems/commands/mirror_command.rb
new file mode 100644
index 0000000000..75419c857a
--- /dev/null
+++ b/lib/rubygems/commands/mirror_command.rb
@@ -0,0 +1,23 @@
+require 'rubygems/command'
+
+class Gem::Commands::MirrorCommand < Gem::Command
+ def initialize
+ super('mirror', 'Mirror all gem files (requires rubygems-mirror)')
+ begin
+ Gem::Specification.find_by_name('rubygems-mirror').activate
+ rescue Gem::LoadError
+ # no-op
+ end
+ end
+
+ def description # :nodoc:
+ <<-EOF
+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
+
+end
diff --git a/lib/rubygems/commands/outdated_command.rb b/lib/rubygems/commands/outdated_command.rb
index ea6b9f0abf..f51bc5e93f 100644
--- a/lib/rubygems/commands/outdated_command.rb
+++ b/lib/rubygems/commands/outdated_command.rb
@@ -15,16 +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.fetch dep
+ def description # :nodoc:
+ <<-EOF
+The outdated command lists gems you way wish to upgrade to a newer version.
- next if remotes.empty?
+You can check for dependency mismatches using the dependency command and
+update the gems with the update or install commands.
+ EOF
+ end
- remote = remotes.last.first
- say "#{local.name} (#{local.version} < #{remote.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 6ebf9aa1aa..13b8793021 100644
--- a/lib/rubygems/commands/owner_command.rb
+++ b/lib/rubygems/commands/owner_command.rb
@@ -7,15 +7,26 @@ 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:
"GEM gem to manage owners for"
end
+ def usage # :nodoc:
+ "#{program_name} GEM"
+ 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 => []
@@ -27,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
@@ -63,12 +80,16 @@ class Gem::Commands::OwnerCommand < Gem::Command
def manage_owners method, name, owners
owners.each do |owner|
- response = rubygems_api_request method, "api/v1/gems/#{name}/owners" do |request|
- request.set_form_data 'email' => owner
- request.add_field "Authorization", api_key
+ begin
+ response = rubygems_api_request method, "api/v1/gems/#{name}/owners" do |request|
+ request.set_form_data 'email' => owner
+ request.add_field "Authorization", api_key
+ end
+
+ with_response response, "Removing #{owner}"
+ rescue
+ # ignore
end
-
- with_response response
end
end
diff --git a/lib/rubygems/commands/pristine_command.rb b/lib/rubygems/commands/pristine_command.rb
index 83e6cc7a67..b54e7eac93 100644
--- a/lib/rubygems/commands/pristine_command.rb
+++ b/lib/rubygems/commands/pristine_command.rb
@@ -1,5 +1,5 @@
require 'rubygems/command'
-require 'rubygems/format'
+require 'rubygems/package'
require 'rubygems/installer'
require 'rubygems/version_option'
@@ -10,7 +10,9 @@ class Gem::Commands::PristineCommand < Gem::Command
def initialize
super 'pristine',
'Restores installed gems to pristine condition from files located in the gem cache',
- :version => Gem::Requirement.default, :extensions => true,
+ :version => Gem::Requirement.default,
+ :extensions => true,
+ :extensions_set => false,
:all => false
add_option('--all',
@@ -20,8 +22,21 @@ class Gem::Commands::PristineCommand < Gem::Command
end
add_option('--[no-]extensions',
- 'Restore gems with extensions') do |value, options|
- options[:extensions] = value
+ 'Restore gems with extensions',
+ 'in addition to regular gems') do |value, options|
+ options[:extensions_set] = true
+ options[:extensions] = value
+ end
+
+ add_option('--only-executables',
+ 'Only restore executables') do |value, options|
+ 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')
@@ -32,33 +47,44 @@ class Gem::Commands::PristineCommand < Gem::Command
end
def defaults_str # :nodoc:
- "--all --extensions"
+ '--extensions'
end
def description # :nodoc:
<<-EOF
-The pristine command compares the installed gems with the contents of the
-cached gem and restores any files that don't match the cached gem's copy.
+The pristine command compares an installed gem with the contents of its
+cached .gem file and restores any files that don't match the cached .gem's
+copy.
+
+If you have made modifications to an installed gem, the pristine command
+will revert them. All extensions are rebuilt and all bin stubs for the gem
+are regenerated after checking for modifications.
-If you have made modifications to your installed gems, the pristine command
-will revert them. After all the gem's files have been checked all bin stubs
-for the gem are regenerated.
+If the cached gem cannot be found it will be downloaded.
-If the cached gem cannot be found, you will need to use `gem install` to
-revert the gem.
+If --no-extensions is provided pristine will not attempt to restore a gem
+with an extension.
-If --no-extensions is provided pristine will not attempt to restore gems with
-extensions.
+If --extensions is given (but not --all or gem names) only gems with
+extensions will be restored.
EOF
end
def usage # :nodoc:
- "#{program_name} [args]"
+ "#{program_name} [GEMNAME ...]"
end
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]
@@ -78,6 +104,11 @@ extensions.
say "Restoring gems to pristine condition..."
specs.each do |spec|
+ if spec.default_gem?
+ say "Skipped #{spec.full_name}, it is a default gem"
+ next
+ end
+
unless spec.extensions.empty? or options[:extensions] then
say "Skipped #{spec.full_name}, it needs to compile an extension"
next
@@ -93,16 +124,26 @@ extensions.
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)
- installer.install
+ :env_shebang => env_shebang,
+ :build_args => spec.build_args)
+
+ if options[:only_executables] then
+ installer.generate_bin
+ else
+ installer.install
+ end
say "Restored #{spec.full_name}"
end
diff --git a/lib/rubygems/commands/push_command.rb b/lib/rubygems/commands/push_command.rb
index a7663edf4a..6899b489ad 100644
--- a/lib/rubygems/commands/push_command.rb
+++ b/lib/rubygems/commands/push_command.rb
@@ -1,13 +1,20 @@
require 'rubygems/command'
require 'rubygems/local_remote_options'
require 'rubygems/gemcutter_utilities'
+require 'rubygems/package'
class Gem::Commands::PushCommand < Gem::Command
include Gem::LocalRemoteOptions
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:
@@ -19,33 +26,64 @@ class Gem::Commands::PushCommand < Gem::Command
end
def initialize
- super 'push', description
+ super 'push', 'Push a gem up to the gem server', :host => self.host
+
add_proxy_option
add_key_option
- add_option(
- '--host HOST',
- 'Push to another gemcutter-compatible host'
- ) do |value, options|
+ add_option('--host HOST',
+ 'Push to another gemcutter-compatible host') do |value, options|
options[:host] = value
end
+
+ @host = nil
end
def execute
- sign_in
+ @host = options[:host]
+
+ sign_in @host
+
send_gem get_one_gem_name
end
def send_gem name
args = [:post, "api/v1/gems"]
- args << options[:host] if options[:host]
+ latest_rubygems_version = Gem.latest_rubygems_version
+
+ if latest_rubygems_version < Gem.rubygems_version and
+ Gem.rubygems_version.prerelease? and
+ Gem::Version.new('2.0.0.rc.2') != Gem.rubygems_version then
+ alert_error <<-ERROR
+You are using a beta release of RubyGems (#{Gem::VERSION}) which is not
+allowed to push gems. Please downgrade or upgrade to a release version.
+
+The latest released RubyGems version is #{latest_rubygems_version}
+
+You can upgrade or downgrade to the latest release version with:
- if Gem.latest_rubygems_version < Gem::Version.new(Gem::VERSION) then
- alert_error "Using beta/unreleased version of rubygems. Not pushing."
+ gem update --system=#{latest_rubygems_version}
+
+ ERROR
terminate_interaction 1
end
+ gem_data = Gem::Package.new(name)
+
+ unless @host then
+ @host = gem_data.spec.metadata['default_gem_server']
+ end
+
+ # 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}..."
+
response = rubygems_api_request(*args) do |request|
request.body = Gem.read_binary name
request.add_field "Content-Length", request.body.size
diff --git a/lib/rubygems/commands/query_command.rb b/lib/rubygems/commands/query_command.rb
index 725da8787b..432250e033 100644
--- a/lib/rubygems/commands/query_command.rb
+++ b/lib/rubygems/commands/query_command.rb
@@ -14,13 +14,17 @@ class Gem::Commands::QueryCommand < Gem::Command
summary = 'Query gem information in local or remote repositories')
super name, summary,
:name => //, :domain => :local, :details => false, :versions => true,
- :installed => false, :version => Gem::Requirement.default
+ :installed => nil, :version => Gem::Requirement.default
add_option('-i', '--[no-]installed',
'Check for installed gem') do |value, options|
options[:installed] = value
end
+ add_option('-I', 'Equivalent to --no-installed') do |value, options|
+ options[:installed] = false
+ end
+
add_version_option command, "for use with --installed"
add_option('-n', '--name-matches REGEXP',
@@ -57,73 +61,118 @@ 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]
- if options[:installed] then
- if name.source.empty? then
+ unless options[:installed].nil? then
+ if no_name then
alert_error "You must specify a gem name"
exit_code |= 4
- elsif installed? name, options[:version] then
- say "true"
+ elsif name.count > 1
+ alert_error "You must specify only ONE gem!"
+ exit_code |= 4
else
- say "false"
- exit_code |= 1
+ installed = installed? name.first, options[:version]
+ installed = !installed unless options[:installed]
+
+ if installed then
+ say "true"
+ else
+ say "false"
+ exit_code |= 1
+ end
end
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 }
+ dep.prerelease = prerelease
if local? then
if prerelease and not both? then
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
}
spec_tuples = specs.map do |spec|
- [[spec.name, spec.version, spec.original_platform, spec], :local]
+ [spec.name_tuple, spec]
end
output_query_results spec_tuples
end
if remote? then
- if ui.outs.tty? or both? then
- say
- say "*** REMOTE GEMS ***"
- say
- end
-
- all = options[:all]
+ display_header 'REMOTE'
fetcher = Gem::SpecFetcher.fetcher
- spec_tuples = fetcher.find_matching dep, all, false, prerelease
- spec_tuples += fetcher.find_matching dep, false, false, true if
- prerelease and all
+ type = if options[:all]
+ if options[:prerelease]
+ :complete
+ else
+ :released
+ end
+ elsif options[:prerelease]
+ :prerelease
+ else
+ :latest
+ end
+
+ if name.source.empty?
+ spec_tuples = fetcher.detect(type) { true }
+ else
+ spec_tuples = fetcher.detect(type) do |name_tuple|
+ name === name_tuple.name
+ end
+ end
output_query_results spec_tuples
end
end
- private
-
##
# Check if gem +name+ version +version+ is installed.
@@ -135,128 +184,159 @@ class Gem::Commands::QueryCommand < Gem::Command
output = []
versions = Hash.new { |h,name| h[name] = [] }
- spec_tuples.each do |spec_tuple, source_uri|
- versions[spec_tuple.first] << [spec_tuple, source_uri]
+ spec_tuples.each do |spec_tuple, source|
+ versions[spec_tuple.name] << [spec_tuple, source]
end
- versions = versions.sort_by do |(name,_),_|
- name.downcase
+ versions = versions.sort_by do |(n,_),_|
+ n.downcase
end
+ output_versions output, versions
+
+ say output.join(options[:details] ? "\n\n" : "\n")
+ end
+
+ def output_versions output, versions
versions.each do |gem_name, matching_tuples|
- matching_tuples = matching_tuples.sort_by do |(_, version,_),_|
- version
- end.reverse
+ matching_tuples = matching_tuples.sort_by { |n,_| n.version }.reverse
platforms = Hash.new { |h,version| h[version] = [] }
- matching_tuples.map do |(_, version, platform,_),_|
- platforms[version] << platform if platform
+ matching_tuples.each do |n, _|
+ platforms[n.version] << n.platform if n.platform
end
seen = {}
- matching_tuples.delete_if do |(_, version,_),_|
- if seen[version] then
+ matching_tuples.delete_if do |n,_|
+ if seen[n.version] then
true
else
- seen[version] = true
+ seen[n.version] = true
false
end
end
- entry = gem_name.dup
+ output << make_entry(matching_tuples, platforms)
+ end
+ end
- if options[:versions] then
- list = if platforms.empty? or options[:details] then
- matching_tuples.map { |(_, version,_),_| version }.uniq
- else
- platforms.sort.reverse.map do |version, pls|
- if pls == [Gem::Platform::RUBY] then
- version
- else
- ruby = pls.delete Gem::Platform::RUBY
- platform_list = [ruby, *pls.sort].compact
- "#{version} #{platform_list.join ' '}"
- end
- end
- end.join ', '
-
- entry << " (#{list})"
- end
+ def entry_details entry, detail_tuple, specs, platforms
+ return unless options[:details]
- if options[:details] then
- detail_tuple = matching_tuples.first
+ name_tuple, spec = detail_tuple
- spec = if detail_tuple.first.length == 4 then
- detail_tuple.first.last
- else
- uri = URI.parse detail_tuple.last
- Gem::SpecFetcher.fetcher.fetch_spec detail_tuple.first, uri
- end
+ spec = spec.fetch_spec name_tuple unless Gem::Specification === spec
- entry << "\n"
+ entry << "\n"
- non_ruby = platforms.any? do |_, pls|
- pls.any? { |pl| pl != Gem::Platform::RUBY }
- end
+ spec_platforms entry, platforms
+ spec_authors entry, spec
+ spec_homepage entry, spec
+ spec_license entry, spec
+ spec_loaded_from entry, spec, specs
+ spec_summary entry, spec
+ end
+
+ def entry_versions entry, name_tuples, platforms
+ return unless options[:versions]
- if non_ruby then
- if platforms.length == 1 then
- title = platforms.values.length == 1 ? 'Platform' : 'Platforms'
- entry << " #{title}: #{platforms.values.sort.join ', '}\n"
+ list =
+ if platforms.empty? or options[:details] then
+ name_tuples.map { |n| n.version }.uniq
+ else
+ platforms.sort.reverse.map do |version, pls|
+ if pls == [Gem::Platform::RUBY] then
+ version
else
- entry << " Platforms:\n"
- platforms.sort_by do |version,|
- version
- end.each do |version, pls|
- label = " #{version}: "
- data = format_text pls.sort.join(', '), 68, label.length
- data[0, label.length] = label
- entry << data << "\n"
- end
+ ruby = pls.delete Gem::Platform::RUBY
+ platform_list = [ruby, *pls.sort].compact
+ "#{version} #{platform_list.join ' '}"
end
end
+ end
- authors = "Author#{spec.authors.length > 1 ? 's' : ''}: "
- authors << spec.authors.join(', ')
- entry << format_text(authors, 68, 4)
+ entry << " (#{list.join ', '})"
+ end
- if spec.rubyforge_project and not spec.rubyforge_project.empty? then
- rubyforge = "Rubyforge: http://rubyforge.org/projects/#{spec.rubyforge_project}"
- entry << "\n" << format_text(rubyforge, 68, 4)
- end
+ def make_entry entry_tuples, platforms
+ detail_tuple = entry_tuples.first
- if spec.homepage and not spec.homepage.empty? then
- entry << "\n" << format_text("Homepage: #{spec.homepage}", 68, 4)
- end
+ name_tuples, specs = entry_tuples.flatten.partition do |item|
+ Gem::NameTuple === item
+ end
- if spec.license and not spec.license.empty? then
- licenses = "License#{spec.licenses.length > 1 ? 's' : ''}: "
- licenses << spec.licenses.join(', ')
- entry << "\n" << format_text(licenses, 68, 4)
- end
+ entry = [name_tuples.first.name]
- if spec.loaded_from then
- if matching_tuples.length == 1 then
- loaded_from = File.dirname File.dirname(spec.loaded_from)
- entry << "\n" << " Installed at: #{loaded_from}"
- else
- label = 'Installed at'
- matching_tuples.each do |(_,version,_,s),|
- loaded_from = File.dirname File.dirname(s.loaded_from)
- entry << "\n" << " #{label} (#{version}): #{loaded_from}"
- label = ' ' * label.length
- end
- end
- end
+ entry_versions entry, name_tuples, platforms
+ entry_details entry, detail_tuple, specs, platforms
+
+ entry.join
+ end
- entry << "\n\n" << format_text(spec.summary, 68, 4)
+ def spec_authors entry, spec
+ authors = "Author#{spec.authors.length > 1 ? 's' : ''}: "
+ authors << spec.authors.join(', ')
+ entry << format_text(authors, 68, 4)
+ end
+
+ def spec_homepage entry, spec
+ return if spec.homepage.nil? or spec.homepage.empty?
+
+ entry << "\n" << format_text("Homepage: #{spec.homepage}", 68, 4)
+ end
+
+ def spec_license entry, spec
+ return if spec.license.nil? or spec.license.empty?
+
+ licenses = "License#{spec.licenses.length > 1 ? 's' : ''}: "
+ licenses << spec.licenses.join(', ')
+ entry << "\n" << format_text(licenses, 68, 4)
+ end
+
+ def spec_loaded_from entry, spec, specs
+ return unless spec.loaded_from
+
+ if specs.length == 1 then
+ default = spec.default_gem? ? ' (default)' : nil
+ entry << "\n" << " Installed at#{default}: #{spec.base_dir}"
+ else
+ label = 'Installed at'
+ specs.each do |s|
+ version = s.version.to_s
+ version << ', default' if s.default_gem?
+ entry << "\n" << " #{label} (#{version}): #{s.base_dir}"
+ label = ' ' * label.length
end
- output << entry
end
+ end
- say output.join(options[:details] ? "\n\n" : "\n")
+ def spec_platforms entry, platforms
+ non_ruby = platforms.any? do |_, pls|
+ pls.any? { |pl| pl != Gem::Platform::RUBY }
+ end
+
+ return unless non_ruby
+
+ if platforms.length == 1 then
+ title = platforms.values.length == 1 ? 'Platform' : 'Platforms'
+ entry << " #{title}: #{platforms.values.sort.join ', '}\n"
+ else
+ entry << " Platforms:\n"
+ platforms.sort_by do |version,|
+ version
+ end.each do |version, pls|
+ label = " #{version}: "
+ data = format_text pls.sort.join(', '), 68, label.length
+ data[0, label.length] = label
+ entry << data << "\n"
+ end
+ end
+ end
+
+ def spec_summary entry, spec
+ entry << "\n\n" << format_text(spec.summary, 68, 4)
end
end
diff --git a/lib/rubygems/commands/rdoc_command.rb b/lib/rubygems/commands/rdoc_command.rb
index ea0f3ad592..86597f99a6 100644
--- a/lib/rubygems/commands/rdoc_command.rb
+++ b/lib/rubygems/commands/rdoc_command.rb
@@ -1,6 +1,7 @@
require 'rubygems/command'
require 'rubygems/version_option'
-require 'rubygems/doc_manager'
+require 'rubygems/rdoc'
+require 'fileutils'
class Gem::Commands::RdocCommand < Gem::Command
include Gem::VersionOption
@@ -8,7 +9,7 @@ class Gem::Commands::RdocCommand < Gem::Command
def initialize
super 'rdoc', 'Generates RDoc for pre-installed gems',
:version => Gem::Requirement.default,
- :include_rdoc => true, :include_ri => true, :overwrite => false
+ :include_rdoc => false, :include_ri => true, :overwrite => false
add_option('--all',
'Generate RDoc/RI documentation for all',
@@ -39,13 +40,17 @@ class Gem::Commands::RdocCommand < Gem::Command
end
def defaults_str # :nodoc:
- "--version '#{Gem::Requirement.default}' --rdoc --ri --no-overwrite"
+ "--version '#{Gem::Requirement.default}' --ri --no-overwrite"
end
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
@@ -54,37 +59,37 @@ The rdoc command builds RDoc and RI documentation for installed gems. Use
end
def execute
- if options[:all] then
- specs = Gem::SourceIndex.from_installed_gems.collect { |name, spec|
- spec
- }
- else
- gem_name = get_one_gem_name
- dep = Gem::Dependency.new gem_name, options[:version]
- specs = Gem::SourceIndex.from_installed_gems.search dep
+ specs = if options[:all] then
+ Gem::Specification.to_a
+ else
+ get_all_gem_names.map do |name|
+ Gem::Specification.find_by_name name, options[:version]
+ end.flatten.uniq
+ end
+
+ if specs.empty? then
+ alert_error 'No matching gems found'
+ terminate_interaction 1
end
- if specs.empty?
- raise "Failed to find gem #{gem_name} to generate RDoc for #{options[:version]}"
- end
+ specs.each do |spec|
+ doc = Gem::RDoc.new spec, options[:include_rdoc], options[:include_ri]
- if options[:include_ri]
- specs.sort.each do |spec|
- doc = Gem::DocManager.new(spec)
- doc.generate_ri if options[:overwrite] || !doc.ri_installed?
- end
+ doc.force = options[:overwrite]
- Gem::DocManager.update_ri_cache
- end
+ if options[:overwrite] then
+ FileUtils.rm_rf File.join(spec.doc_dir, 'ri')
+ FileUtils.rm_rf File.join(spec.doc_dir, 'rdoc')
+ end
- if options[:include_rdoc]
- specs.sort.each do |spec|
- doc = Gem::DocManager.new(spec)
- doc.generate_rdoc if options[:overwrite] || !doc.rdoc_installed?
+ begin
+ doc.generate
+ rescue Errno::ENOENT => e
+ e.message =~ / - /
+ alert_error "Unable to document #{spec.full_name}, #{$'} is missing, skipping"
+ terminate_interaction 1 if specs.length == 1
end
end
-
- true
end
end
diff --git a/lib/rubygems/commands/search_command.rb b/lib/rubygems/commands/search_command.rb
index 52e96fd1ef..5809690735 100644
--- a/lib/rubygems/commands/search_command.rb
+++ b/lib/rubygems/commands/search_command.rb
@@ -4,9 +4,11 @@ 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 contains STRING'
remove_option '--name-matches'
+
+ defaults[:domain] = :remote
end
def arguments # :nodoc:
@@ -14,17 +16,24 @@ class Gem::Commands::SearchCommand < Gem::Commands::QueryCommand
end
def defaults_str # :nodoc:
- "--local --no-details"
+ "--remote --no-details"
end
- def usage # :nodoc:
- "#{program_name} [STRING]"
+ def description # :nodoc:
+ <<-EOF
+The search command displays remote gems whose name contains the given
+string.
+
+The --details option displays additional details from the gem but will
+take a little longer to complete as it must download the information
+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} [STRING]"
end
end
diff --git a/lib/rubygems/commands/server_command.rb b/lib/rubygems/commands/server_command.rb
index b65d48c4fc..4796ce2ad6 100644
--- a/lib/rubygems/commands/server_command.rb
+++ b/lib/rubygems/commands/server_command.rb
@@ -78,7 +78,7 @@ You can set up a shortcut to gem server documentation using the URL:
end
def execute
- options[:gemdir] << Gem.dir if options[:gemdir].empty?
+ options[:gemdir] = Gem.path if options[:gemdir].empty?
Gem::Server.run options
end
diff --git a/lib/rubygems/commands/setup_command.rb b/lib/rubygems/commands/setup_command.rb
index 0c957393d9..face77fae9 100644
--- a/lib/rubygems/commands/setup_command.rb
+++ b/lib/rubygems/commands/setup_command.rb
@@ -5,14 +5,22 @@ require 'rubygems/command'
# RubyGems checkout or tarball.
class Gem::Commands::SetupCommand < Gem::Command
+ HISTORY_HEADER = /^===\s*[\d.]+\s*\/\s*\d{4}-\d{2}-\d{2}\s*$/
+ VERSION_MATCHER = /^===\s*([\d.]+)\s*\/\s*\d{4}-\d{2}-\d{2}\s*$/
def initialize
require 'tmpdir'
super 'setup', 'Install RubyGems',
- :format_executable => true, :rdoc => true, :ri => true,
+ :format_executable => true, :document => %w[ri],
:site_or_vendor => :sitelibdir,
- :destdir => '', :prefix => ''
+ :destdir => '', :prefix => '', :previous_version => ''
+
+ add_option '--previous-version=VERSION',
+ 'Previous version of rubygems',
+ 'Used for changelog processing' do |version, options|
+ options[:previous_version] = version
+ end
add_option '--prefix=PREFIX',
'Prefix path for installing RubyGems',
@@ -37,15 +45,40 @@ class Gem::Commands::SetupCommand < Gem::Command
options[:format_executable] = value
end
+ add_option '--[no-]document [TYPES]', Array,
+ 'Generate documentation for RubyGems.',
+ 'List the documentation types you wish to',
+ 'generate. For example: rdoc,ri' do |value, options|
+ options[:document] = case value
+ when nil then %w[rdoc ri]
+ when false then []
+ else value
+ end
+ end
+
add_option '--[no-]rdoc',
'Generate RDoc documentation for RubyGems' do |value, options|
- options[:rdoc] = value
+ if value then
+ options[:document] << 'rdoc'
+ else
+ options[:document].delete 'rdoc'
+ end
+
+ options[:document].uniq!
end
add_option '--[no-]ri',
'Generate RI documentation for RubyGems' do |value, options|
- options[:ri] = value
+ if value then
+ options[:document] << 'ri'
+ else
+ options[:document].delete 'ri'
+ end
+
+ options[:document].uniq!
end
+
+ @verbose = nil
end
def check_ruby_version
@@ -58,7 +91,7 @@ class Gem::Commands::SetupCommand < Gem::Command
end
def defaults_str # :nodoc:
- "--format-executable --rdoc --ri"
+ "--format-executable --document ri"
end
def description # :nodoc:
@@ -106,11 +139,13 @@ By default, this RubyGems will install gem as:
remove_old_bin_files bin_dir
+ remove_old_lib_files lib_dir
+
say "RubyGems #{Gem::VERSION} installed"
uninstall_old_gemcutter
- install_rdoc
+ documentation_success = install_rdoc
say
if @verbose then
@@ -118,19 +153,13 @@ By default, this RubyGems will install gem as:
say
end
- release_notes = File.join Dir.pwd, 'History.txt'
+ if options[:previous_version].empty?
+ options[:previous_version] = Gem::VERSION.sub(/[0-9]+$/, '0')
+ end
- release_notes = if File.exist? release_notes then
- open release_notes do |io|
- text = io.gets '==='
- text << io.gets('===')
- text[0...-3].sub(/^# coding:.*?^=/m, '')
- end
- else
- "Oh-no! Unable to find release notes!"
- end
+ options[:previous_version] = Gem::Version.new(options[:previous_version])
- say release_notes
+ show_release_notes
say
say "-" * 78
@@ -145,6 +174,31 @@ By default, this RubyGems will install gem as:
say "to remove it by hand."
say
end
+
+ if documentation_success
+ if options[:document].include? 'rdoc' then
+ say "Rdoc documentation was installed. You may now invoke:"
+ say " gem server"
+ say "and then peruse beautifully formatted documentation for your gems"
+ say "with your web browser."
+ say "If you do not wish to install this documentation in the future, use the"
+ say "--no-document flag, or set it as the default in your ~/.gemrc file. See"
+ say "'gem help env' for details."
+ say
+ end
+
+ if options[:document].include? 'ri' then
+ say "Ruby Interactive (ri) documentation was installed. ri is kind of like man "
+ say "pages for ruby libraries. You may access it like this:"
+ say " ri Classname"
+ say " ri Classname.class_method"
+ say " ri Classname#instance_method"
+ say "If you do not wish to install this documentation in the future, use the"
+ say "--no-document flag, or set it as the default in your ~/.gemrc file. See"
+ say "'gem help env' for details."
+ say
+ end
+ end
end
def install_executables(bin_dir)
@@ -165,7 +219,7 @@ By default, this RubyGems will install gem as:
end
dest_file = File.join bin_dir, bin_file_formatted
- bin_tmp_file = File.join Dir.tmpdir, bin_file
+ bin_tmp_file = File.join Dir.tmpdir, "#{bin_file}.#{$$}"
begin
bin = File.readlines bin_file
@@ -205,18 +259,27 @@ TEXT
end
end
+ def install_file file, dest_dir
+ dest_file = File.join dest_dir, file
+ dest_dir = File.dirname dest_file
+ mkdir_p dest_dir unless File.directory? dest_dir
+
+ install file, dest_file, :mode => 0644
+ end
+
def install_lib(lib_dir)
say "Installing RubyGems" if @verbose
- Dir.chdir 'lib' do
- lib_files = Dir[File.join('**', '*rb')]
+ lib_files = rb_files_in 'lib'
+ pem_files = pem_files_in 'lib'
+ Dir.chdir 'lib' do
lib_files.each do |lib_file|
- dest_file = File.join lib_dir, lib_file
- dest_dir = File.dirname dest_file
- mkdir_p dest_dir unless File.directory? dest_dir
+ install_file lib_file, lib_dir
+ end
- install lib_file, dest_file, :mode => 0644
+ pem_files.each do |pem_file|
+ install_file pem_file, lib_dir
end
end
end
@@ -226,6 +289,12 @@ TEXT
rubygems_name = "rubygems-#{Gem::VERSION}"
rubygems_doc_dir = File.join gem_doc_dir, rubygems_name
+ begin
+ Gem.ensure_gem_subdirectories Gem.dir
+ rescue SystemCallError
+ # ignore
+ end
+
if File.writable? gem_doc_dir and
(not File.exist? rubygems_doc_dir or
File.writable? rubygems_doc_dir) then
@@ -234,21 +303,26 @@ TEXT
rm_rf dir
end
- if options[:ri] then
- ri_dir = File.join rubygems_doc_dir, 'ri'
- say "Installing #{rubygems_name} ri into #{ri_dir}" if @verbose
- run_rdoc '--ri', '--op', ri_dir
- end
+ require 'rubygems/rdoc'
- if options[:rdoc] then
- rdoc_dir = File.join rubygems_doc_dir, 'rdoc'
- say "Installing #{rubygems_name} rdoc into #{rdoc_dir}" if @verbose
- run_rdoc '--op', rdoc_dir
+ fake_spec = Gem::Specification.new 'rubygems', Gem::VERSION
+ def fake_spec.full_gem_path
+ File.expand_path '../../../..', __FILE__
end
+
+ generate_ri = options[:document].include? 'ri'
+ generate_rdoc = options[:document].include? 'rdoc'
+
+ rdoc = Gem::RDoc.new fake_spec, generate_rdoc, generate_ri
+ rdoc.generate
+
+ return true
elsif @verbose then
say "Skipping RDoc generation, #{gem_doc_dir} not writable"
say "Set the GEM_HOME environment variable if you want RDoc generated"
end
+
+ return false
end
def make_destination_dirs(install_destdir)
@@ -296,6 +370,18 @@ TEXT
[lib_dir, bin_dir]
end
+ def pem_files_in dir
+ Dir.chdir dir do
+ Dir[File.join('**', '*pem')]
+ end
+ end
+
+ def rb_files_in dir
+ Dir.chdir dir do
+ Dir[File.join('**', '*rb')]
+ end
+ end
+
def remove_old_bin_files(bin_dir)
old_bin_files = {
'gem_mirror' => 'gem mirror',
@@ -328,21 +414,60 @@ abort "#{deprecation_message}"
end
end
- def run_rdoc(*args)
- begin
- gem 'rdoc'
- rescue Gem::LoadError
+ def remove_old_lib_files lib_dir
+ rubygems_dir = File.join lib_dir, 'rubygems'
+ lib_files = rb_files_in 'lib/rubygems'
+
+ old_lib_files = rb_files_in rubygems_dir
+
+ to_remove = old_lib_files - lib_files
+
+ to_remove.delete_if do |file|
+ file.start_with? 'defaults'
+ end
+
+ Dir.chdir rubygems_dir do
+ to_remove.each do |file|
+ FileUtils.rm_f file
+
+ warn "unable to remove old file #{file} please remove it by hand" if
+ File.exist? file
+ end
end
+ end
+
+ def show_release_notes
+ release_notes = File.join Dir.pwd, 'History.txt'
+
+ release_notes =
+ if File.exist? release_notes then
+ history = File.read release_notes
- require 'rdoc/rdoc'
+ history.force_encoding Encoding::UTF_8 if
+ Object.const_defined? :Encoding
- args << '--main' << 'README.rdoc' << '--quiet'
- args << '.'
- args << 'README.rdoc' << 'UPGRADING.rdoc'
- args << 'LICENSE.txt' << 'MIT.txt' << 'History.txt'
+ history = history.sub(/^# coding:.*?^=/m, '')
+
+ text = history.split(HISTORY_HEADER)
+ text.shift # correct an off-by-one generated by split
+ version_lines = history.scan(HISTORY_HEADER)
+ versions = history.scan(VERSION_MATCHER).flatten.map do |x|
+ Gem::Version.new(x)
+ end
- r = RDoc::RDoc.new
- r.document args
+ history_string = ""
+
+ until versions.length == 0 or
+ versions.shift < options[:previous_version] do
+ history_string += version_lines.shift + text.shift
+ end
+
+ history_string
+ else
+ "Oh-no! Unable to find release notes!"
+ end
+
+ say release_notes
end
def uninstall_old_gemcutter
diff --git a/lib/rubygems/commands/sources_command.rb b/lib/rubygems/commands/sources_command.rb
index ac14313e9d..81ff07babc 100644
--- a/lib/rubygems/commands/sources_command.rb
+++ b/lib/rubygems/commands/sources_command.rb
@@ -37,90 +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 = Gem::SpecFetcher.fetcher.dir
- 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 options[:add] then
- source_uri = options[:add]
- uri = URI.parse source_uri
+ def check_rubygems_https source_uri # :nodoc:
+ uri = URI source_uri
- begin
- Gem::SpecFetcher.fetcher.load_specs uri, 'specs'
- Gem.sources << source_uri
- Gem.configuration.write
+ 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}
- say "#{source_uri} added to sources"
- 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
+Do you want to add this insecure source?
+ QUESTION
+
+ 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
- fetcher = Gem::SpecFetcher.fetcher
+ def defaults_str # :nodoc:
+ '--list'
+ end
- Gem.sources.each do |update_uri|
- update_uri = URI.parse update_uri
- fetcher.load_specs update_uri, 'specs'
- fetcher.load_specs update_uri, 'latest_specs'
- 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.
- say "source cache successfully updated"
+RubyGems has been configured to serve gems via the following URLs through
+its history:
+
+* 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
+
+ def list? # :nodoc:
+ !(options[:add] ||
+ options[:clear_all] ||
+ options[:remove] ||
+ options[:update])
+ end
+
+ def execute
+ clear_all if options[:clear_all]
- if options[:list] then
- say "*** CURRENT SOURCES ***"
- say
+ source_uri = options[:add]
+ add_source source_uri if source_uri
- Gem.sources.each do |source|
- say source
- end
+ 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 566a9cc66e..3bc02a9c14 100644
--- a/lib/rubygems/commands/specification_command.rb
+++ b/lib/rubygems/commands/specification_command.rb
@@ -1,7 +1,7 @@
require 'rubygems/command'
require 'rubygems/local_remote_options'
require 'rubygems/version_option'
-require 'rubygems/format'
+require 'rubygems/package'
class Gem::Commands::SpecificationCommand < Gem::Command
@@ -17,6 +17,7 @@ class Gem::Commands::SpecificationCommand < Gem::Command
add_version_option('examine')
add_platform_option
+ add_prerelease_option
add_option('--all', 'Output specifications for all versions of',
'the gem') do |value, options|
@@ -27,7 +28,7 @@ class Gem::Commands::SpecificationCommand < Gem::Command
options[:format] = :ruby
end
- add_option('--yaml', 'Output RUBY format') do |value, options|
+ add_option('--yaml', 'Output YAML format') do |value, options|
options[:format] = :yaml
end
@@ -49,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
@@ -62,13 +79,13 @@ FIELD name of gemspec field to show
"Please specify a gem name or file on the command line"
end
- case options[:version]
+ case v = options[:version]
when String
- req = Gem::Requirement.parse options[:version]
+ req = Gem::Requirement.create v
when Gem::Requirement
- req = options[:version]
+ req = v
else
- raise Gem::CommandLineError, "Unsupported version type: #{options[:version]}"
+ raise Gem::CommandLineError, "Unsupported version type: '#{v}'"
end
if !req.none? and options[:all]
@@ -79,7 +96,7 @@ FIELD name of gemspec field to show
if options[:all]
dep = Gem::Dependency.new gem
else
- dep = Gem::Dependency.new gem, options[:version]
+ dep = Gem::Dependency.new gem, req
end
field = get_one_optional_argument
@@ -89,7 +106,7 @@ FIELD name of gemspec field to show
if local? then
if File.exist? gem then
- specs << Gem::Format.from_file_by_path(gem).spec rescue nil
+ specs << Gem::Package.new(gem).spec rescue nil
end
if specs.empty? then
@@ -98,22 +115,19 @@ FIELD name of gemspec field to show
end
if remote? then
- found = Gem::SpecFetcher.fetcher.fetch dep, true
-
- if dep.prerelease? or options[:prerelease]
- found += Gem::SpecFetcher.fetcher.fetch dep, false, true, true
- end
+ dep.prerelease = options[:prerelease]
+ found, _ = Gem::SpecFetcher.fetcher.spec_for_dependency dep
specs.push(*found.map { |spec,| spec })
end
if specs.empty? then
- alert_error "Unknown gem '#{gem}'"
+ alert_error "No gem matching '#{dep}' found"
terminate_interaction 1
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 aaadb762b5..e62095a336 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
@@ -13,7 +14,8 @@ class Gem::Commands::UninstallCommand < Gem::Command
def initialize
super 'uninstall', 'Uninstall gems from the local repository',
- :version => Gem::Requirement.default, :user_install => true
+ :version => Gem::Requirement.default, :user_install => true,
+ :check_dev => false
add_option('-a', '--[no-]all',
'Uninstall all matching versions'
@@ -27,6 +29,12 @@ class Gem::Commands::UninstallCommand < Gem::Command
options[:ignore] = value
end
+ add_option('-D', '--[no-]-check-development',
+ 'Check development dependencies while uninstalling',
+ '(default: false)') do |value, options|
+ options[:check_dev] = value
+ end
+
add_option('-x', '--[no-]executables',
'Uninstall applicable executables without',
'confirmation') do |value, options|
@@ -54,6 +62,18 @@ class Gem::Commands::UninstallCommand < Gem::Command
options[:format_executable] = value
end
+ add_option('--[no-]force',
+ 'Uninstall all versions of the named gems',
+ 'ignoring dependencies') do |value, options|
+ 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
end
@@ -63,29 +83,67 @@ class Gem::Commands::UninstallCommand < Gem::Command
end
def defaults_str # :nodoc:
- "--version '#{Gem::Requirement.default}' --no-force " \
- "--install-dir #{Gem.dir}\n" \
+ "--version '#{Gem::Requirement.default}' --no-force " +
"--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
- original_path = Gem.path
+ 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
+ end
+ end
+
+ deps = deplist.strongly_connected_components.flatten.reverse
- get_all_gem_names.each do |gem_name|
+ deps.map(&:name).uniq.each do |gem_name|
begin
Gem::Uninstaller.new(gem_name, options).uninstall
- rescue Gem::InstallError => e
- alert e.message
rescue Gem::GemNotInHomeException => e
spec = e.spec
- alert("In order to remove #{spec.name}, please execute:\n" \
+ alert("In order to remove #{spec.name}, please execute:\n" +
"\tgem uninstall #{spec.name} --install-dir=#{spec.installation_path}")
- ensure
- Gem.use_paths(*original_path)
end
end
end
diff --git a/lib/rubygems/commands/unpack_command.rb b/lib/rubygems/commands/unpack_command.rb
index 64b8ad64f8..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
@@ -69,8 +87,10 @@ class Gem::Commands::UnpackCommand < Gem::Command
else
basename = File.basename path, '.gem'
target_dir = File.expand_path basename, options[:target]
- FileUtils.mkdir_p target_dir
- Gem::Installer.new(path, :unpack => true).unpack target_dir
+
+ package = Gem::Package.new path
+ package.extract_files target_dir
+
say "Unpacked gem: '#{target_dir}'"
end
end
@@ -114,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
@@ -134,9 +154,11 @@ class Gem::Commands::UnpackCommand < Gem::Command
##
# Extracts the Gem::Specification and raw metadata from the .gem file at
# +path+.
+ #--
+ # TODO move to Gem::Package as #raw_spec or something
def get_metadata path
- format = Gem::Format.from_file_by_path path
+ format = Gem::Package.new path
spec = format.spec
metadata = nil
diff --git a/lib/rubygems/commands/update_command.rb b/lib/rubygems/commands/update_command.rb
index d63b943c56..b4ee59b3bb 100644
--- a/lib/rubygems/commands/update_command.rb
+++ b/lib/rubygems/commands/update_command.rb
@@ -1,10 +1,12 @@
require 'rubygems/command'
require 'rubygems/command_manager'
+require 'rubygems/dependency_installer'
require 'rubygems/install_update_options'
require 'rubygems/local_remote_options'
require 'rubygems/spec_fetcher'
require 'rubygems/version_option'
-require 'rubygems/commands/install_command'
+require 'rubygems/install_message' # must come before rdoc for messaging
+require 'rubygems/rdoc'
class Gem::Commands::UpdateCommand < Gem::Command
@@ -12,12 +14,12 @@ class Gem::Commands::UpdateCommand < Gem::Command
include Gem::LocalRemoteOptions
include Gem::VersionOption
+ attr_reader :installer # :nodoc:
+
def initialize
- super 'update',
- 'Update the named gems (or all installed gems) in the local repository',
- :generate_rdoc => true,
- :generate_ri => true,
- :force => false
+ super 'update', 'Update installed gems to the latest version',
+ :document => %w[rdoc ri],
+ :force => false
add_install_update_options
@@ -37,6 +39,9 @@ class Gem::Commands::UpdateCommand < Gem::Command
add_local_remote_options
add_platform_option
add_prerelease_option "as update targets"
+
+ @updated = []
+ @installer = nil
end
def arguments # :nodoc:
@@ -44,33 +49,49 @@ class Gem::Commands::UpdateCommand < Gem::Command
end
def defaults_str # :nodoc:
- "--rdoc --ri --no-force --install-dir #{Gem.dir}"
+ "--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 comamnd does not remove the previous version. Use the cleanup
+command to remove old versions.
+ EOF
end
def usage # :nodoc:
"#{program_name} GEMNAME [GEMNAME ...]"
end
- def execute
- @installer = Gem::DependencyInstaller.new options
- @updated = []
+ 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
hig = {}
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
@@ -79,67 +100,73 @@ class Gem::Commands::UpdateCommand < Gem::Command
if updated.empty? then
say "Nothing to update"
else
- say "Gems updated: #{updated.map { |spec| spec.name }.join ', '}"
+ say "Gems updated: #{updated.map { |spec| spec.name }.join ' '}"
+ end
+ end
- if options[:generate_ri] then
- updated.each do |gem|
- Gem::DocManager.new(gem, options[:rdoc_args]).generate_ri
- end
+ def fetch_remote_gems spec # :nodoc:
+ dependency = Gem::Dependency.new spec.name, "> #{spec.version}"
+ dependency.prerelease = options[:prerelease]
- Gem::DocManager.update_ri_cache
- end
+ fetcher = Gem::SpecFetcher.fetcher
- if options[:generate_rdoc] then
- updated.each do |gem|
- Gem::DocManager.new(gem, options[:rdoc_args]).generate_rdoc
- end
- end
- end
+ spec_tuples, errors = fetcher.search_for_dependency dependency
+
+ error = errors.find { |e| e.respond_to? :exception }
+
+ raise error if error
+
+ spec_tuples
end
- def update_gem name, version = Gem::Requirement.default
- return if @updated.any? { |spec| spec.name == name }
- success = false
+ def highest_installed_gems # :nodoc:
+ hig = {} # highest installed gems
- say "Updating #{name}"
- begin
- @installer.install name, version
- success = true
- rescue Gem::InstallError => e
- alert_error "Error installing #{name}:\n\t#{e.message}"
- success = false
+ Gem::Specification.each do |spec|
+ if hig[spec.name].nil? or hig[spec.name].version < spec.version then
+ hig[spec.name] = spec
+ end
end
- @installer.installed_gems.each do |spec|
- @updated << spec
- say "Successfully installed #{spec.full_name}" if success
- end
+ hig
end
- def update_gems gems_to_update
- gems_to_update.uniq.sort.each do |(name, version)|
- update_gem name, version
+ def highest_remote_version spec # :nodoc:
+ spec_tuples = fetch_remote_gems spec
+
+ matching_gems = spec_tuples.select do |g,_|
+ g.name == spec.name and g.match_platform?
end
- @updated
+ highest_remote_gem = matching_gems.max_by { |g,_| g.version }
+
+ highest_remote_gem ||= [Gem::NameTuple.null]
+
+ highest_remote_gem.first.version
end
- ##
- # Update RubyGems software to the latest version.
+ def install_rubygems version # :nodoc:
+ args = update_rubygems_arguments
- def update_rubygems
- unless options[:args].empty? then
- alert_error "Gem names are not allowed with the --system option"
- terminate_interaction 1
- end
+ update_dir = File.join Gem.dir, 'gems', "rubygems-update-#{version}"
- options[:user_install] = false
+ 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
@@ -156,45 +183,75 @@ 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::Version.new Gem::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
+
+ success = false
+
+ 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
- update_gem name, target
+ @installer.installed_gems.each do |spec|
+ @updated << spec
+ end
+ end
+
+ 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
- args << '--no-rdoc' unless options[:generate_rdoc]
- args << '--no-ri' unless options[:generate_ri]
+ # 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
@@ -204,21 +261,7 @@ class Gem::Commands::UpdateCommand < Gem::Command
next if not gem_names.empty? and
gem_names.all? { |name| /#{name}/ !~ l_spec.name }
- dependency = Gem::Dependency.new l_spec.name, "> #{l_spec.version}"
-
- fetcher = Gem::SpecFetcher.fetcher
- spec_tuples = fetcher.find_matching dependency
-
- matching_gems = spec_tuples.select do |(name, _, platform),|
- name == l_name and Gem::Platform.match platform
- end
-
- highest_remote_gem = matching_gems.sort_by do |(_, version),|
- version
- end.last
-
- highest_remote_gem ||= [[nil, Gem::Version.new(0), nil]] # "null" object
- highest_remote_ver = highest_remote_gem.first[1]
+ 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]
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
new file mode 100644
index 0000000000..2285bb4017
--- /dev/null
+++ b/lib/rubygems/commands/yank_command.rb
@@ -0,0 +1,112 @@
+require 'rubygems/command'
+require 'rubygems/local_remote_options'
+require 'rubygems/version_option'
+require 'rubygems/gemcutter_utilities'
+
+class Gem::Commands::YankCommand < Gem::Command
+ include Gem::LocalRemoteOptions
+ include Gem::VersionOption
+ include Gem::GemcutterUtilities
+
+ def description # :nodoc:
+ <<-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:
+ "GEM name of gem"
+ end
+
+ def usage # :nodoc:
+ "#{program_name} GEM -v VERSION [-p PLATFORM] [--undo] [--key KEY_NAME]"
+ end
+
+ def initialize
+ super 'yank', 'Remove a pushed gem from the index'
+
+ add_version_option("remove")
+ add_platform_option("remove")
+
+ add_option('--undo') do |value, options|
+ 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
+ end
+
+ def execute
+ sign_in
+
+ version = get_version_from_requirements(options[:version])
+ platform = get_platform_from_requirements(options)
+ api_key = Gem.configuration.rubygems_api_key
+ api_key = Gem.configuration.api_keys[options[:key].to_sym] if options[:key]
+
+ if version then
+ if options[:undo] then
+ unyank_gem(version, platform, api_key)
+ else
+ yank_gem(version, platform, api_key)
+ end
+ else
+ say "A version argument is required: #{usage}"
+ terminate_interaction
+ end
+ end
+
+ def yank_gem(version, platform, api_key)
+ say "Yanking gem from #{self.host}..."
+ yank_api_request(:delete, version, platform, "api/v1/gems/yank", api_key)
+ end
+
+ def unyank_gem(version, platform, api_key)
+ say "Unyanking gem from #{host}..."
+ yank_api_request(:put, version, platform, "api/v1/gems/unyank", api_key)
+ end
+
+ private
+
+ def yank_api_request(method, version, platform, api, api_key)
+ name = get_one_gem_name
+ response = rubygems_api_request(method, api) do |request|
+ request.add_field("Authorization", api_key)
+
+ data = {
+ 'gem_name' => name,
+ 'version' => version,
+ }
+ data['platform'] = platform if platform
+
+ request.set_form_data data
+ end
+ say response.body
+ end
+
+ def get_version_from_requirements(requirements)
+ requirements.requirements.first[1].version
+ rescue
+ nil
+ end
+
+ def get_platform_from_requirements(requirements)
+ Gem.platforms[1].to_s if requirements.key? :added_platform
+ end
+
+end
+
diff --git a/lib/rubygems/compatibility.rb b/lib/rubygems/compatibility.rb
new file mode 100644
index 0000000000..5e8618fe39
--- /dev/null
+++ b/lib/rubygems/compatibility.rb
@@ -0,0 +1,58 @@
+# :stopdoc:
+
+#--
+# This file contains all sorts of little compatibility hacks that we've
+# had to introduce over the years. Quarantining them into one file helps
+# us know when we can get rid of them.
+#
+# Ruby 1.9.x has introduced some things that are awkward, and we need to
+# support them, so we define some constants to use later.
+#++
+module Gem
+ # Only MRI 1.9.2 has the custom prelude.
+ GEM_PRELUDE_SUCKAGE = RUBY_VERSION =~ /^1\.9\.2/ and RUBY_ENGINE == "ruby"
+end
+
+# Gem::QuickLoader exists in the gem prelude code in ruby 1.9.2 itself.
+# We gotta get rid of it if it's there, before we do anything else.
+if Gem::GEM_PRELUDE_SUCKAGE and defined?(Gem::QuickLoader) then
+ Gem::QuickLoader.remove
+
+ $LOADED_FEATURES.delete Gem::QuickLoader.path_to_full_rubygems_library
+
+ if $LOADED_FEATURES.any? do |path| path.end_with? '/rubygems.rb' end then
+ # TODO path does not exist here
+ raise LoadError, "another rubygems is already loaded from #{path}"
+ end
+
+ class << Gem
+ remove_method :try_activate if Gem.respond_to?(:try_activate, true)
+ end
+end
+
+module Gem
+ RubyGemsVersion = VERSION
+
+ RbConfigPriorities = %w[
+ MAJOR
+ MINOR
+ TEENY
+ EXEEXT RUBY_SO_NAME arch bindir datadir libdir ruby_install_name
+ ruby_version rubylibprefix sitedir sitelibdir vendordir vendorlibdir
+ rubylibdir
+ ]
+
+ unless defined?(ConfigMap)
+ ##
+ # Configuration settings from ::RbConfig
+ ConfigMap = Hash.new do |cm, key|
+ cm[key] = RbConfig::CONFIG[key.to_s]
+ end
+ else
+ RbConfigPriorities.each do |key|
+ ConfigMap[key.to_sym] = RbConfig::CONFIG[key]
+ end
+ end
+
+ RubyGemsPackageVersion = VERSION
+end
diff --git a/lib/rubygems/config_file.rb b/lib/rubygems/config_file.rb
index 136e8b4610..1acae9b529 100644
--- a/lib/rubygems/config_file.rb
+++ b/lib/rubygems/config_file.rb
@@ -4,10 +4,13 @@
# See LICENSE.txt for permissions.
#++
+require 'rubygems/user_interaction'
+require 'rbconfig'
+
##
-# Gem::ConfigFile RubyGems options and gem command options from ~/.gemrc.
+# Gem::ConfigFile RubyGems options and gem command options from gemrc.
#
-# ~/.gemrc is a YAML file that uses strings to match gem command arguments and
+# gemrc is a YAML file that uses strings to match gem command arguments and
# symbols to match RubyGems options.
#
# Gem command arguments use a String key that matches the command name and
@@ -21,16 +24,21 @@
# RubyGems options use symbol keys. Valid options are:
#
# +:backtrace+:: See #backtrace
-# +:benchmark+:: See #benchmark
# +:sources+:: Sets Gem::sources
# +:verbose+:: See #verbose
-
-require 'rbconfig'
+#
+# gemrc files may exist in various locations and are read and merged in
+# the following order:
+#
+# - system wide (/etc/gemrc)
+# - per user (~/.gemrc)
+# - per environment (gemrc files listed in the GEMRC environment variable)
class Gem::ConfigFile
+ include Gem::UserInteraction
+
DEFAULT_BACKTRACE = false
- DEFAULT_BENCHMARK = false
DEFAULT_BULK_THRESHOLD = 1000
DEFAULT_VERBOSITY = true
DEFAULT_UPDATE_SOURCES = true
@@ -47,6 +55,8 @@ class Gem::ConfigFile
PLATFORM_DEFAULTS = {}
+ # :stopdoc:
+
system_config_path =
begin
require "etc"
@@ -74,6 +84,8 @@ class Gem::ConfigFile
end
end
+ # :startdoc:
+
SYSTEM_WIDE_CONFIG_FILE = File.join system_config_path, 'gemrc'
##
@@ -97,11 +109,6 @@ class Gem::ConfigFile
attr_writer :backtrace
##
- # True if we are benchmarking this run.
-
- attr_accessor :benchmark
-
- ##
# Bulk threshold value. If the number of missing gems are above this
# threshold value, then a bulk download technique is used. (deprecated)
@@ -121,16 +128,10 @@ class Gem::ConfigFile
attr_accessor :update_sources
##
- # API key for RubyGems.org
-
- attr_reader :rubygems_api_key
-
- ##
- # Hash of RubyGems.org and alternate API keys
+ # True if we want to force specification of gem server when pushing a gem
- attr_reader :api_keys
+ attr_accessor :disable_default_gem_server
- ##
# openssl verify mode value, used for remote https connection
attr_reader :ssl_verify_mode
@@ -141,6 +142,11 @@ class Gem::ConfigFile
attr_reader :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
# from the command line.
#
@@ -158,29 +164,29 @@ class Gem::ConfigFile
# <tt>--debug</tt>::
# Enable Ruby level debug messages. Handled early for the same reason as
# --backtrace.
+ #--
+ # TODO: parse options upstream, pass in options directly
- def initialize(arg_list)
+ def initialize(args)
@config_file_name = nil
need_config_file_name = false
- arg_list = arg_list.map do |arg|
+ arg_list = []
+
+ args.each do |arg|
if need_config_file_name then
@config_file_name = arg
need_config_file_name = false
- nil
elsif arg =~ /^--config-file=(.*)/ then
@config_file_name = $1
- nil
elsif arg =~ /^--config-file$/ then
need_config_file_name = true
- nil
else
- arg
+ arg_list << arg
end
- end.compact
+ end
@backtrace = DEFAULT_BACKTRACE
- @benchmark = DEFAULT_BENCHMARK
@bulk_threshold = DEFAULT_BULK_THRESHOLD
@verbose = DEFAULT_VERBOSITY
@update_sources = DEFAULT_UPDATE_SOURCES
@@ -189,29 +195,79 @@ class Gem::ConfigFile
platform_config = Marshal.load Marshal.dump(PLATFORM_DEFAULTS)
system_config = load_file SYSTEM_WIDE_CONFIG_FILE
user_config = load_file config_file_name.dup.untaint
+ environment_config = (ENV['GEMRC'] || '').split(/[:;]/).inject({}) do |result, file|
+ result.merge load_file file
+ end
+
@hash = operating_system_config.merge platform_config
@hash = @hash.merge system_config
@hash = @hash.merge user_config
+ @hash = @hash.merge environment_config
# HACK these override command-line args, which is bad
- @backtrace = @hash[:backtrace] if @hash.key? :backtrace
- @benchmark = @hash[:benchmark] if @hash.key? :benchmark
- @bulk_threshold = @hash[:bulk_threshold] if @hash.key? :bulk_threshold
- @home = @hash[:gemhome] if @hash.key? :gemhome
- @path = @hash[:gempath] if @hash.key? :gempath
- @update_sources = @hash[:update_sources] if @hash.key? :update_sources
- @verbose = @hash[:verbose] if @hash.key? :verbose
+ @backtrace = @hash[:backtrace] if @hash.key? :backtrace
+ @bulk_threshold = @hash[:bulk_threshold] if @hash.key? :bulk_threshold
+ @home = @hash[:gemhome] if @hash.key? :gemhome
+ @path = @hash[:gempath] if @hash.key? :gempath
+ @update_sources = @hash[:update_sources] if @hash.key? :update_sources
+ @verbose = @hash[:verbose] if @hash.key? :verbose
+ @disable_default_gem_server = @hash[:disable_default_gem_server] if @hash.key? :disable_default_gem_server
+
@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
- load_api_keys
+ @api_keys = nil
+ @rubygems_api_key = nil
Gem.sources = @hash[:sources] if @hash.key? :sources
handle_arguments arg_list
end
##
+ # Hash of RubyGems.org and alternate API keys
+
+ def api_keys
+ load_api_keys unless @api_keys
+
+ @api_keys
+ end
+
+ ##
+ # Checks the permissions of the credentials file. If they are not 0600 an
+ # error message is displayed and RubyGems aborts.
+
+ def check_credentials_permissions
+ return if Gem.win_platform? # windows doesn't write 0600 as 0600
+ return unless File.exist? credentials_path
+
+ existing_permissions = File.stat(credentials_path).mode & 0777
+
+ return if existing_permissions == 0600
+
+ alert_error <<-ERROR
+Your gem push credentials file located at:
+
+\t#{credentials_path}
+
+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
+
+if you believe they were disclosed to a third party.
+ ERROR
+
+ terminate_interaction 1
+ end
+
+ ##
# Location of RubyGems.org credentials
def credentials_path
@@ -219,18 +275,36 @@ class Gem::ConfigFile
end
def load_api_keys
+ check_credentials_permissions
+
@api_keys = if File.exist? credentials_path then
load_file(credentials_path)
else
@hash
end
+
if @api_keys.key? :rubygems_api_key then
- @rubygems_api_key = @api_keys[:rubygems_api_key]
- @api_keys[:rubygems] = @api_keys.delete :rubygems_api_key unless @api_keys.key? :rubygems
+ @rubygems_api_key = @api_keys[:rubygems_api_key]
+ @api_keys[:rubygems] = @api_keys.delete :rubygems_api_key unless
+ @api_keys.key? :rubygems
end
end
- def rubygems_api_key=(api_key)
+ ##
+ # Returns the RubyGems.org API key
+
+ def rubygems_api_key
+ load_api_keys unless @rubygems_api_key
+
+ @rubygems_api_key
+ end
+
+ ##
+ # Sets the RubyGems.org API key to +api_key+
+
+ def rubygems_api_key= api_key
+ check_credentials_permissions
+
config = load_file(credentials_path).merge(:rubygems_api_key => api_key)
dirname = File.dirname credentials_path
@@ -238,24 +312,36 @@ class Gem::ConfigFile
Gem.load_yaml
- File.open(credentials_path, 'w') do |f|
+ permissions = 0600 & (~File.umask)
+ File.open(credentials_path, 'w', permissions) do |f|
f.write config.to_yaml
end
@rubygems_api_key = api_key
end
+ YAMLErrors = [ArgumentError]
+ YAMLErrors << Psych::SyntaxError if defined?(Psych::SyntaxError)
+
def load_file(filename)
Gem.load_yaml
return {} unless filename and File.exist? filename
+
begin
- YAML.load(File.read(filename))
- rescue ArgumentError
- warn "Failed to load #{config_file_name}"
+ content = YAML.load(File.read(filename))
+ unless content.kind_of? Hash
+ warn "Failed to load #{filename} because it doesn't contain valid YAML hash"
+ return {}
+ end
+ return content
+ rescue *YAMLErrors => e
+ warn "Failed to load #{filename}, #{e.to_s}"
rescue Errno::EACCES
- warn "Failed to load #{config_file_name} due to permissions problem."
- end or {}
+ warn "Failed to load #{filename} due to permissions problem."
+ end
+
+ {}
end
# True if the backtrace option has been specified, or debug is on.
@@ -273,13 +359,11 @@ class Gem::ConfigFile
hash = @hash.dup
hash.delete :update_sources
hash.delete :verbose
- hash.delete :benchmark
hash.delete :backtrace
hash.delete :bulk_threshold
yield :update_sources, @update_sources
yield :verbose, @verbose
- yield :benchmark, @benchmark
yield :backtrace, @backtrace
yield :bulk_threshold, @bulk_threshold
@@ -296,8 +380,6 @@ class Gem::ConfigFile
case arg
when /^--(backtrace|traceback)$/ then
@backtrace = true
- when /^--bench(mark)?$/ then
- @benchmark = true
when /^--debug$/ then
$DEBUG = true
else
@@ -309,25 +391,41 @@ class Gem::ConfigFile
# Really verbose mode gives you extra output.
def really_verbose
case verbose
- when true, false, nil then false
- else true
+ when true, false, nil then
+ false
+ else
+ true
end
end
# to_yaml only overwrites things you can't override on the command line.
def to_yaml # :nodoc:
yaml_hash = {}
- yaml_hash[:backtrace] = @hash.key?(:backtrace) ? @hash[:backtrace] :
- DEFAULT_BACKTRACE
- yaml_hash[:benchmark] = @hash.key?(:benchmark) ? @hash[:benchmark] :
- DEFAULT_BENCHMARK
- yaml_hash[:bulk_threshold] = @hash.key?(:bulk_threshold) ?
- @hash[:bulk_threshold] : DEFAULT_BULK_THRESHOLD
- yaml_hash[:sources] = Gem.sources
- yaml_hash[:update_sources] = @hash.key?(:update_sources) ?
- @hash[:update_sources] : DEFAULT_UPDATE_SOURCES
- yaml_hash[:verbose] = @hash.key?(:verbose) ? @hash[:verbose] :
- DEFAULT_VERBOSITY
+ yaml_hash[:backtrace] = if @hash.key?(:backtrace)
+ @hash[:backtrace]
+ else
+ DEFAULT_BACKTRACE
+ end
+
+ yaml_hash[:bulk_threshold] = if @hash.key?(:bulk_threshold)
+ @hash[:bulk_threshold]
+ else
+ DEFAULT_BULK_THRESHOLD
+ end
+
+ yaml_hash[:sources] = Gem.sources.to_a
+
+ yaml_hash[:update_sources] = if @hash.key?(:update_sources)
+ @hash[:update_sources]
+ else
+ DEFAULT_UPDATE_SOURCES
+ end
+
+ yaml_hash[:verbose] = if @hash.key?(:verbose)
+ @hash[:verbose]
+ else
+ DEFAULT_VERBOSITY
+ end
keys = yaml_hash.keys.map { |key| key.to_s }
keys << 'debug'
@@ -361,15 +459,13 @@ class Gem::ConfigFile
def ==(other) # :nodoc:
self.class === other and
- @backtrace == other.backtrace and
- @benchmark == other.benchmark and
- @bulk_threshold == other.bulk_threshold and
- @verbose == other.verbose and
- @update_sources == other.update_sources and
- @hash == other.hash
+ @backtrace == other.backtrace and
+ @bulk_threshold == other.bulk_threshold and
+ @verbose == other.verbose and
+ @update_sources == other.update_sources and
+ @hash == other.hash
end
- protected
-
attr_reader :hash
+ protected :hash
end
diff --git a/lib/rubygems/core_ext/kernel_gem.rb b/lib/rubygems/core_ext/kernel_gem.rb
new file mode 100644
index 0000000000..3405233ab1
--- /dev/null
+++ b/lib/rubygems/core_ext/kernel_gem.rb
@@ -0,0 +1,59 @@
+##
+# 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.
+ remove_method :gem if 'method' == defined? gem # from gem_prelude.rb on 1.9
+
+ ##
+ # Use Kernel#gem to activate a specific version of +gem_name+.
+ #
+ # +requirements+ is a list of version requirements that the
+ # specified gem must match, most commonly "= example.version.number". See
+ # Gem::Requirement for how to specify a version requirement.
+ #
+ # If you will be activating the latest version of a gem, there is no need to
+ # call Kernel#gem, Kernel#require will do the right thing for you.
+ #
+ # Kernel#gem returns true if the gem was activated, otherwise false. If the
+ # gem could not be found, didn't match the version requirements, or a
+ # different version was already activated, an exception will be raised.
+ #
+ # Kernel#gem should be called *before* any require statements (otherwise
+ # RubyGems may load a conflicting library version).
+ #
+ # 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
+ # RUBYLIB environment variable to skip activation of a gem.
+ #
+ # Example:
+ #
+ # GEM_SKIP=libA:libB ruby -I../libA -I../libB ./mycode.rb
+
+ def gem(gem_name, *requirements) # :doc:
+ skip_list = (ENV['GEM_SKIP'] || "").split(/:/)
+ raise Gem::LoadError, "skipping #{gem_name}" if skip_list.include? gem_name
+
+ if gem_name.kind_of? Gem::Dependency
+ unless Gem::Deprecate.skip
+ warn "#{Gem.location_of_caller.join ':'}:Warning: Kernel.gem no longer "\
+ "accepts a Gem::Dependency object, please pass the name "\
+ "and requirements directly"
+ end
+
+ requirements = gem_name.requirement
+ gem_name = gem_name.name
+ end
+
+ spec = Gem::Dependency.new(gem_name, *requirements).to_spec
+ spec.activate if spec
+ end
+
+ private :gem
+
+end
diff --git a/lib/rubygems/core_ext/kernel_require.rb b/lib/rubygems/core_ext/kernel_require.rb
new file mode 100755
index 0000000000..84bb03f67d
--- /dev/null
+++ b/lib/rubygems/core_ext/kernel_require.rb
@@ -0,0 +1,149 @@
+#--
+# Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others.
+# All rights reserved.
+# See LICENSE.txt for permissions.
+#++
+
+require 'monitor'
+
+module Kernel
+
+ RUBYGEMS_ACTIVATION_MONITOR = Monitor.new # :nodoc:
+
+ if defined?(gem_original_require) then
+ # Ruby ships with a custom_require, override its require
+ remove_method :require
+ else
+ ##
+ # The Kernel#require from before RubyGems was loaded.
+
+ alias gem_original_require require
+ private :gem_original_require
+ end
+
+ ##
+ # When RubyGems is required, Kernel#require is replaced with our own which
+ # is capable of loading gems on demand.
+ #
+ # When you call <tt>require 'x'</tt>, this is what happens:
+ # * If the file can be loaded from the existing Ruby loadpath, it
+ # is.
+ # * Otherwise, installed gems are searched for a file that matches.
+ # If it's found in gem 'y', that gem is activated (added to the
+ # loadpath).
+ #
+ # The normal <tt>require</tt> functionality of returning false if
+ # that file has already been loaded is preserved.
+
+ def require path
+ RUBYGEMS_ACTIVATION_MONITOR.enter
+
+ path = path.to_path if path.respond_to? :to_path
+
+ spec = Gem.find_unresolved_default_spec(path)
+ if spec
+ Gem.remove_unresolved_default_spec(spec)
+ gem(spec.name)
+ end
+
+ # If there are no unresolved deps, then we can use just try
+ # normal require handle loading a gem from the rescue below.
+
+ if Gem::Specification.unresolved_deps.empty? then
+ begin
+ RUBYGEMS_ACTIVATION_MONITOR.exit
+ return gem_original_require(path)
+ ensure
+ RUBYGEMS_ACTIVATION_MONITOR.enter
+ end
+ end
+
+ # If +path+ is for a gem that has already been loaded, don't
+ # bother trying to find it in an unresolved gem, just go straight
+ # to normal require.
+ #--
+ # TODO request access to the C implementation of this to speed up RubyGems
+
+ spec = Gem::Specification.stubs.find { |s|
+ s.activated? and s.contains_requirable_file? path
+ }
+
+ begin
+ RUBYGEMS_ACTIVATION_MONITOR.exit
+ return gem_original_require(path)
+ ensure
+ RUBYGEMS_ACTIVATION_MONITOR.enter
+ end if spec
+
+ # Attempt to find +path+ in any unresolved gems...
+
+ found_specs = Gem::Specification.find_in_unresolved path
+
+ # If there are no directly unresolved gems, then try and find +path+
+ # in any gems that are available via the currently unresolved gems.
+ # For example, given:
+ #
+ # a => b => c => d
+ #
+ # If a and b are currently active with c being unresolved and d.rb is
+ # requested, then find_in_unresolved_tree will find d.rb in d because
+ # it's a dependency of c.
+ #
+ if found_specs.empty? then
+ found_specs = Gem::Specification.find_in_unresolved_tree path
+
+ found_specs.each do |found_spec|
+ found_spec.activate
+ end
+
+ # We found +path+ directly in an unresolved gem. Now we figure out, of
+ # the possible found specs, which one we should activate.
+ else
+
+ # Check that all the found specs are just different
+ # versions of the same gem
+ names = found_specs.map(&:name).uniq
+
+ if names.size > 1 then
+ raise Gem::LoadError, "#{path} found in multiple gems: #{names.join ', '}"
+ end
+
+ # Ok, now find a gem that has no conflicts, starting
+ # at the highest version.
+ valid = found_specs.select { |s| s.conflicts.empty? }.last
+
+ unless valid then
+ le = Gem::LoadError.new "unable to find a version of '#{names.first}' to activate"
+ le.name = names.first
+ raise le
+ end
+
+ valid.activate
+ end
+
+ begin
+ RUBYGEMS_ACTIVATION_MONITOR.exit
+ return gem_original_require(path)
+ ensure
+ RUBYGEMS_ACTIVATION_MONITOR.enter
+ end
+ rescue LoadError => load_error
+ if load_error.message.start_with?("Could not find") or
+ (load_error.message.end_with?(path) and Gem.try_activate(path)) then
+ begin
+ RUBYGEMS_ACTIVATION_MONITOR.exit
+ return gem_original_require(path)
+ ensure
+ RUBYGEMS_ACTIVATION_MONITOR.enter
+ end
+ end
+
+ raise load_error
+ ensure
+ RUBYGEMS_ACTIVATION_MONITOR.exit
+ end
+
+ private :require
+
+end
+
diff --git a/lib/rubygems/custom_require.rb b/lib/rubygems/custom_require.rb
deleted file mode 100644
index c813e3aaa2..0000000000
--- a/lib/rubygems/custom_require.rb
+++ /dev/null
@@ -1,69 +0,0 @@
-#--
-# Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others.
-# All rights reserved.
-# See LICENSE.txt for permissions.
-#++
-
-module Kernel
-
- if defined?(gem_original_require) then
- # Ruby ships with a custom_require, override its require
- remove_method :require
- else
- ##
- # The Kernel#require from before RubyGems was loaded.
-
- alias gem_original_require require
- private :gem_original_require
- end
-
- ##
- # When RubyGems is required, Kernel#require is replaced with our own which
- # is capable of loading gems on demand.
- #
- # When you call <tt>require 'x'</tt>, this is what happens:
- # * If the file can be loaded from the existing Ruby loadpath, it
- # is.
- # * Otherwise, installed gems are searched for a file that matches.
- # If it's found in gem 'y', that gem is activated (added to the
- # loadpath).
- #
- # The normal <tt>require</tt> functionality of returning false if
- # that file has already been loaded is preserved.
-
- def require path
- if Gem.unresolved_deps.empty? then
- gem_original_require path
- else
- spec = Gem::Specification.find { |s|
- s.activated? and s.contains_requirable_file? path
- }
-
- unless spec then
- found_specs = Gem::Specification.find_in_unresolved path
- unless found_specs.empty? then
- found_specs = [found_specs.last]
- else
- found_specs = Gem::Specification.find_in_unresolved_tree path
- end
-
- found_specs.each do |found_spec|
- found_spec.activate
- end
- end
-
- return gem_original_require path
- end
- rescue LoadError => load_error
- if load_error.message.start_with?("Could not find") or
- (load_error.message.end_with?(path) and Gem.try_activate(path)) then
- return gem_original_require(path)
- end
-
- raise load_error
- end
-
- private :require
-
-end
-
diff --git a/lib/rubygems/defaults.rb b/lib/rubygems/defaults.rb
index d6732adbfa..591580b7da 100644
--- a/lib/rubygems/defaults.rb
+++ b/lib/rubygems/defaults.rb
@@ -1,8 +1,8 @@
module Gem
-
- # TODO: move this whole file back into rubygems.rb
+ DEFAULT_HOST = "https://rubygems.org"
@post_install_hooks ||= []
+ @done_installing_hooks ||= []
@post_uninstall_hooks ||= []
@pre_uninstall_hooks ||= []
@pre_install_hooks ||= []
@@ -11,7 +11,15 @@ module Gem
# An Array of the default sources that come with RubyGems
def self.default_sources
- %w[http://rubygems.org/]
+ %w[https://rubygems.org/]
+ 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
##
@@ -54,14 +62,23 @@ module Gem
# Path for gems in the user's home directory
def self.user_dir
- File.join Gem.user_home, '.gem', ruby_engine, ConfigMap[:ruby_version]
+ parts = [Gem.user_home, '.gem', ruby_engine]
+ parts << ConfigMap[:ruby_version] unless ConfigMap[:ruby_version].empty?
+ File.join parts
+ end
+
+ ##
+ # How String Gem paths should be split. Overridable for esoteric platforms.
+
+ def self.path_separator
+ File::PATH_SEPARATOR
end
##
# Default gem load path
def self.default_path
- if File.exist? Gem.user_home then
+ if Gem.user_home && File.exist?(Gem.user_home) then
[user_dir, default_dir]
else
[default_dir]
@@ -94,24 +111,6 @@ module Gem
end
##
- # The default system-wide source info cache directory
-
- def self.default_system_source_cache_dir
- File.join(Gem.dir, 'source_cache')
- end
-
- ##
- # The default user-specific source info cache directory
-
- def self.default_user_source_cache_dir
- #
- # NOTE Probably an argument for moving this to per-ruby supported dirs like
- # user_dir
- #
- File.join(Gem.user_home, '.gem', 'source_cache')
- end
-
- ##
# A wrapper around RUBY_ENGINE const that may not be defined
def self.ruby_engine
@@ -121,4 +120,25 @@ module Gem
'ruby'
end
end
+
+ ##
+ # The default signing key path
+
+ def self.default_key_path
+ File.join Gem.user_home, ".gem", "gem-private_key.pem"
+ end
+
+ ##
+ # The default signing certificate chain path
+
+ 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
end
diff --git a/lib/rubygems/dependency.rb b/lib/rubygems/dependency.rb
index 0caf65c6c4..a96d67c3e5 100644
--- a/lib/rubygems/dependency.rb
+++ b/lib/rubygems/dependency.rb
@@ -1,8 +1,8 @@
-require "rubygems/requirement"
-
##
# The Dependency class holds a Gem name and a Gem::Requirement.
+require "rubygems/requirement"
+
class Gem::Dependency
##
@@ -10,11 +10,14 @@ class Gem::Dependency
#--
# When this list is updated, be sure to change
# Gem::Specification::CURRENT_SPECIFICATION_VERSION as well.
+ #
+ # REFACTOR: This type of constant, TYPES, indicates we might want
+ # two classes, used via inheritance or duck typing.
TYPES = [
- :development,
- :runtime,
- ]
+ :development,
+ :runtime,
+ ]
##
# Dependency name or regular expression.
@@ -32,18 +35,23 @@ class Gem::Dependency
# <tt>:runtime</tt>.
def initialize name, *requirements
- if Regexp === name then
+ case name
+ when String then # ok
+ when Regexp then
msg = ["NOTE: Dependency.new w/ a regexp is deprecated.",
"Dependency.new called from #{Gem.location_of_caller.join(":")}"]
warn msg.join("\n") unless Gem::Deprecate.skip
+ else
+ raise ArgumentError,
+ "dependency name must be a String, was #{name.inspect}"
end
type = Symbol === requirements.last ? requirements.pop : :runtime
requirements = requirements.first if 1 == requirements.length # unpack
unless TYPES.include? type
- raise ArgumentError, "Valid types are #{TYPES.inspect}, "
- + "not #{type.inspect}"
+ raise ArgumentError, "Valid types are #{TYPES.inspect}, " +
+ "not #{type.inspect}"
end
@name = name
@@ -66,8 +74,13 @@ class Gem::Dependency
end
def inspect # :nodoc:
- "<%s type=%p name=%p requirements=%p>" %
- [self.class, self.type, self.name, requirement.to_s]
+ if @prerelease
+ "<%s type=%p name=%p requirements=%p prerelease=ok>" %
+ [self.class, self.type, self.name, requirement.to_s]
+ else
+ "<%s type=%p name=%p requirements=%p>" %
+ [self.class, self.type, self.name, requirement.to_s]
+ end
end
##
@@ -77,6 +90,14 @@ class Gem::Dependency
@prerelease || requirement.prerelease?
end
+ ##
+ # Is this dependency simply asking for the latest version
+ # of a gem?
+
+ def latest_version?
+ @requirement.none?
+ end
+
def pretty_print q # :nodoc:
q.group 1, 'Gem::Dependency.new(', ')' do
q.pp name
@@ -113,6 +134,8 @@ class Gem::Dependency
# Children, define explicit marshal and unmarshal behavior for
# public classes. Marshal formats are part of your public API.
+ # REFACTOR: See above
+
if defined?(@version_requirement) && @version_requirement
version = @version_requirement.instance_variable_get :@version
@version_requirement = nil
@@ -122,6 +145,7 @@ class Gem::Dependency
@requirement = @version_requirements if defined?(@version_requirements)
end
+ # DOC: this method needs documentation or :nodoc''d
def requirements_list
requirement.as_list
end
@@ -179,13 +203,26 @@ class Gem::Dependency
requirement.satisfied_by? version
end
- def match? name, version
+ alias === =~
+
+ # DOC: this method needs either documented or :nodoc'd
+
+ def match? obj, version=nil
+ if !version
+ name = obj.name
+ version = obj.version
+ else
+ name = obj
+ end
+
return false unless self.name === name
return true if requirement.none?
requirement.satisfied_by? Gem::Version.new(version)
end
+ # DOC: this method needs either documented or :nodoc'd
+
def matches_spec? spec
return false unless name === spec.name
return true if requirement.none?
@@ -212,11 +249,13 @@ 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|
@@ -234,14 +273,26 @@ class Gem::Dependency
@requirement.specific?
end
+ # DOC: this method needs either documented or :nodoc'd
+
def to_specs
matches = matching_specs true
# TODO: check Gem.activated_spec[self.name] in case matches falls outside
if matches.empty? then
- specs = Gem::Specification.all_names.join ", "
- error = Gem::LoadError.new "Could not find #{name} (#{requirement}) amongst [#{specs}]"
+ specs = Gem::Specification.find_all { |s|
+ s.name == name
+ }.map { |x| x.full_name }
+
+ if specs.empty?
+ total = Gem::Specification.to_a.size
+ error = Gem::LoadError.new \
+ "Could not find '#{name}' (#{requirement}) among #{total} total gem(s)"
+ else
+ error = Gem::LoadError.new \
+ "Could not find '#{name}' (#{requirement}) - did find: [#{specs.join ','}]"
+ end
error.name = self.name
error.requirement = self.requirement
raise error
@@ -252,6 +303,8 @@ class Gem::Dependency
matches
end
+ # DOC: this method needs either documented or :nodoc'd
+
def to_spec
matches = self.to_specs
diff --git a/lib/rubygems/dependency_installer.rb b/lib/rubygems/dependency_installer.rb
index 6303e8e9ac..e404d42b3a 100644
--- a/lib/rubygems/dependency_installer.rb
+++ b/lib/rubygems/dependency_installer.rb
@@ -1,8 +1,11 @@
require 'rubygems'
require 'rubygems/dependency_list'
+require 'rubygems/package'
require 'rubygems/installer'
require 'rubygems/spec_fetcher'
require 'rubygems/user_interaction'
+require 'rubygems/source'
+require 'rubygems/available_set'
##
# Installs a gem along with all its dependencies from local and remote gems.
@@ -11,11 +14,9 @@ class Gem::DependencyInstaller
include Gem::UserInteraction
- attr_reader :gems_to_install
- attr_reader :installed_gems
-
- DEFAULT_OPTIONS = {
+ DEFAULT_OPTIONS = { # :nodoc:
:env_shebang => false,
+ :document => %w[ri],
:domain => :both, # HACK dup
:force => false,
:format_executable => false, # HACK dup
@@ -23,7 +24,31 @@ class Gem::DependencyInstaller
:prerelease => false,
:security_policy => nil, # HACK NoSecurity requires OpenSSL. AlmostNo? Low?
: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.
@@ -42,20 +67,18 @@ class Gem::DependencyInstaller
# :security_policy:: See Gem::Installer::new and Gem::Security.
# :user_install:: See Gem::Installer.new
# :wrappers:: See Gem::Installer::new
+ # :build_args:: See Gem::Installer::new
- def initialize(options = {})
- if options[:install_dir] then
- @gem_home = options[:install_dir]
-
- Gem::Specification.dirs = @gem_home
- Gem.ensure_gem_subdirectories @gem_home
- options[:install_dir] = @gem_home # FIX: because we suck and reuse below
- end
+ def initialize options = {}
+ @only_install_dir = !!options[:install_dir]
+ @install_dir = options[:install_dir] || Gem.dir
options = DEFAULT_OPTIONS.merge options
@bin_dir = options[:bin_dir]
+ @dev_shallow = options[:dev_shallow]
@development = options[:development]
+ @document = options[:document]
@domain = options[:domain]
@env_shebang = options[:env_shebang]
@force = options[:force]
@@ -65,53 +88,161 @@ class Gem::DependencyInstaller
@security_policy = options[:security_policy]
@user_install = options[:user_install]
@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.
+ @minimal_deps = options[:minimal_deps]
+ @available = nil
@installed_gems = []
+ @toplevel_specs = nil
- @install_dir = options[:install_dir] || Gem.dir
@cache_dir = options[:cache_dir] || @install_dir
- # Set with any errors that SpecFetcher finds while search through
- # gemspecs for a dep
@errors = nil
end
##
+ #--
+ # 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
+ # +version+
+
+ def available_set_for dep_or_name, version # :nodoc:
+ if String === dep_or_name then
+ find_spec_by_name_and_version dep_or_name, version, @prerelease
+ else
+ dep = dep_or_name.dup
+ dep.prerelease = @prerelease
+ @available = find_gems_with_sources dep
+ end
+
+ @available.pick_best!
+ end
+
+ ##
+ # Indicated, based on the requested domain, if local
+ # gems should be considered.
+
+ def consider_local?
+ @domain == :both or @domain == :local
+ end
+
+ ##
+ # Indicated, based on the requested domain, if remote
+ # gems should be considered.
+
+ def consider_remote?
+ @domain == :both or @domain == :remote
+ end
+
+ ##
# Returns a list of pairs of gemspecs and source_uris that match
# Gem::Dependency +dep+ from both local (Dir.pwd) and remote (Gem.sources)
# sources. Gems are sorted with newer gems preferred over older gems, and
# local gems preferred over remote gems.
- def find_gems_with_sources(dep)
- # Reset the errors
- @errors = nil
- gems_and_sources = []
+ def find_gems_with_sources dep, best_only=false # :nodoc:
+ set = Gem::AvailableSet.new
- if @domain == :both or @domain == :local then
- Dir[File.join(Dir.pwd, "#{dep.name}-[0-9]*.gem")].each do |gem_file|
- spec = Gem::Format.from_file_by_path(gem_file).spec
- gems_and_sources << [spec, gem_file] if spec.name == dep.name
+ if consider_local?
+ sl = Gem::Source::Local.new
+
+ if spec = sl.find_gem(dep.name)
+ if dep.matches_spec? spec
+ set.add spec, sl
+ end
end
end
- if @domain == :both or @domain == :remote then
+ if consider_remote?
begin
- # REFACTOR: all = dep.requirement.needs_all?
- requirements = dep.requirement.requirements.map do |req, ver|
- req
+ # 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
- all = !dep.prerelease? &&
- # we only need latest if there's one requirement and it is
- # guaranteed to match the newest specs
- (requirements.length > 1 or
- (requirements.first != ">=" and requirements.first != ">"))
+ 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
- found, @errors = Gem::SpecFetcher.fetcher.fetch_with_errors dep, all, true, dep.prerelease?
+ if @errors
+ @errors += errors
+ else
+ @errors = errors
+ end
- gems_and_sources.push(*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"
@@ -120,27 +251,78 @@ class Gem::DependencyInstaller
end
end
- gems_and_sources.sort_by do |gem, source|
- [gem, source =~ /^http:\/\// ? 0 : 1] # local gems win
+ set
+ 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,
+ version = Gem::Requirement.default,
+ prerelease = false
+ set = Gem::AvailableSet.new
+
+ if consider_local?
+ if gem_name =~ /\.gem$/ and File.file? gem_name then
+ src = Gem::Source::SpecificFile.new(gem_name)
+ set.add src.spec, src
+ elsif gem_name =~ /\.gem$/ then
+ Dir[gem_name].each do |name|
+ begin
+ src = Gem::Source::SpecificFile.new name
+ set.add src.spec, src
+ rescue Gem::Package::FormatError
+ end
+ end
+ else
+ local = Gem::Source::Local.new
+
+ if s = local.find_gem(gem_name, version)
+ set.add s, local
+ end
+ end
+ end
+
+ if set.empty?
+ dep = Gem::Dependency.new gem_name, version
+ dep.prerelease = true if prerelease
+
+ set = find_gems_with_sources(dep, true)
+ set.match_platform!
end
+
+ if set.empty?
+ raise Gem::SpecificGemNotFoundException.new(gem_name, version, @errors)
+ end
+
+ @available = set
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
- specs = @specs_and_sources.map { |spec,_| spec }
+ 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)
@@ -156,88 +338,19 @@ class Gem::DependencyInstaller
@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
- next if spec.nil? or seen[spec.name]
- seen[spec.name] = true
-
- deps = spec.runtime_dependencies
- deps |= spec.development_dependencies if @development
-
- deps.each do |dep|
- dependencies[dep.name] = dependencies[dep.name].merge dep
-
- results = find_gems_with_sources(dep).reverse
-
- results.reject! do |dep_spec,|
- to_do.push dep_spec
-
- # already locally installed
- Gem::Specification.any? do |installed_spec|
- dep.name == installed_spec.name and
- dep.requirement.satisfied_by? installed_spec.version
- end
- end
-
- results.each do |dep_spec, source_uri|
- @specs_and_sources << [dep_spec, source_uri]
-
- dependency_list.add dep_spec
- end
- 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,
- version = Gem::Requirement.default,
- prerelease = false)
- spec_and_source = nil
-
- glob = if File::ALT_SEPARATOR then
- gem_name.gsub File::ALT_SEPARATOR, File::SEPARATOR
- else
- gem_name
- end
-
- local_gems = Dir["#{glob}*"].sort.reverse
-
- local_gems.each do |gem_file|
- next unless gem_file =~ /gem$/
+ def in_background what # :nodoc:
+ fork_happened = false
+ if @build_docs_in_background and Process.respond_to?(:fork)
begin
- spec = Gem::Format.from_file_by_path(gem_file).spec
- spec_and_source = [spec, gem_file]
- break
- rescue SystemCallError, Gem::Package::FormatError
+ Process.fork do
+ yield
+ end
+ fork_happened = true
+ say "#{what} in a background process."
+ rescue NotImplementedError
end
end
-
- unless spec_and_source then
- dep = Gem::Dependency.new gem_name, version
- dep.prerelease = true if prerelease
- spec_and_sources = find_gems_with_sources(dep).reverse
- spec_and_source = spec_and_sources.find { |spec, source|
- Gem::Platform.match spec.platform
- }
- end
-
- if spec_and_source.nil? then
- raise Gem::GemNotFoundException.new(
- "Could not find a valid gem '#{gem_name}' (#{version}) locally or in a repository",
- gem_name, version, @errors)
- end
-
- @specs_and_sources = [spec_and_source]
+ yield unless fork_happened
end
##
@@ -255,50 +368,72 @@ class Gem::DependencyInstaller
# separately.
def install dep_or_name, version = Gem::Requirement.default
- if String === dep_or_name then
- find_spec_by_name_and_version dep_or_name, version, @prerelease
- else
- dep_or_name.prerelease = @prerelease
- @specs_and_sources = [find_gems_with_sources(dep_or_name).last]
- end
+ request_set = resolve_dependencies dep_or_name, version
@installed_gems = []
- gather_dependencies
+ options = {
+ :bin_dir => @bin_dir,
+ :build_args => @build_args,
+ :env_shebang => @env_shebang,
+ :force => @force,
+ :format_executable => @format_executable,
+ :ignore_dependencies => @ignore_dependencies,
+ :security_policy => @security_policy,
+ :user_install => @user_install,
+ :wrappers => @wrappers,
+ :install_as_default => @install_as_default
+ }
+ options[:install_dir] = @install_dir if @only_install_dir
- last = @gems_to_install.size - 1
- @gems_to_install.each_with_index do |spec, index|
- next if Gem::Specification.include?(spec) and index != last
+ request_set.install options do |_, installer|
+ @installed_gems << installer.spec if installer
+ end
- # TODO: make this sorta_verbose so other users can benefit from it
- say "Installing gem #{spec.full_name}" if Gem.configuration.really_verbose
+ @installed_gems.sort!
- _, source_uri = @specs_and_sources.assoc spec
- begin
- local_gem_path = Gem::RemoteFetcher.fetcher.download spec, source_uri,
- @cache_dir
- rescue Gem::RemoteFetcher::FetchError
- next if @force
- raise
+ # 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.
+ in_background "Installing documentation" do
+ Gem.done_installing_hooks.each do |hook|
+ hook.call self, @installed_gems
end
+ end unless Gem.done_installing_hooks.empty?
+
+ @installed_gems
+ end
+
+ 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:
+ as = available_set_for dep_or_name, version
+
+ request_set = as.to_request_set install_development_deps
+ request_set.soft_missing = @force
- inst = Gem::Installer.new local_gem_path,
- :bin_dir => @bin_dir,
- :development => @development,
- :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
-
- spec = inst.install
-
- @installed_gems << spec
+ installer_set = Gem::Resolver::InstallerSet.new @domain
+ installer_set.always_install.concat request_set.always_install
+ installer_set.ignore_installed = @only_install_dir
+
+ if @ignore_dependencies then
+ installer_set.ignore_dependencies = true
+ request_set.soft_missing = true
end
- @installed_gems
+ composed_set = Gem::Resolver.compose_sets as, installer_set
+
+ request_set.resolve composed_set
+
+ request_set
end
+
end
diff --git a/lib/rubygems/dependency_list.rb b/lib/rubygems/dependency_list.rb
index 9f1da9166c..3e40325527 100644
--- a/lib/rubygems/dependency_list.rb
+++ b/lib/rubygems/dependency_list.rb
@@ -10,6 +10,10 @@ require 'rubygems/deprecate'
##
# Gem::DependencyList is used for installing and uninstalling gems in the
# correct order to avoid conflicts.
+#--
+# TODO: It appears that all but topo-sort functionality is being duplicated
+# (or is planned to be duplicated) elsewhere in rubygems. Is the majority of
+# this class necessary anymore? Especially #ok?, #why_not_ok?
class Gem::DependencyList
attr_reader :specs
@@ -27,20 +31,11 @@ class Gem::DependencyList
def self.from_specs
list = new
- list.add(*Gem::Specification.map)
+ list.add(*Gem::Specification.to_a)
list
end
##
- # Creates a DependencyList from a Gem::SourceIndex +source_index+
-
- def self.from_source_index(ignored=nil)
- warn "NOTE: DependencyList.from_source_index ignores it's arg" if ignored
-
- from_specs
- end
-
- ##
# Creates a new DependencyList. If +development+ is true, development
# dependencies will be included.
@@ -54,7 +49,7 @@ class Gem::DependencyList
# Adds +gemspecs+ to the dependency list.
def add(*gemspecs)
- @specs.push(*gemspecs)
+ @specs.concat gemspecs
end
def clear
@@ -143,7 +138,7 @@ class Gem::DependencyList
# If removing the gemspec creates breaks a currently ok dependency, then it
# is NOT ok to remove the gemspec.
- def ok_to_remove?(full_name)
+ def ok_to_remove?(full_name, check_dev=true)
gem_to_remove = find_name full_name
siblings = @specs.find_all { |s|
@@ -154,7 +149,9 @@ class Gem::DependencyList
deps = []
@specs.each do |spec|
- spec.dependencies.each do |dep|
+ check = check_dev ? spec.dependencies : spec.runtime_dependencies
+
+ check.each do |dep|
deps << dep if gem_to_remove.satisfies_requirement?(dep)
end
end
@@ -213,7 +210,7 @@ class Gem::DependencyList
@specs.each(&block)
end
- def tsort_each_child(node, &block)
+ def tsort_each_child(node)
specs = @specs.sort.reverse
dependencies = node.runtime_dependencies
@@ -242,11 +239,6 @@ class Gem::DependencyList
def active_count(specs, ignored)
specs.count { |spec| ignored[spec.full_name].nil? }
end
-end
-class Gem::DependencyList
- class << self
- extend Gem::Deprecate
- deprecate :from_source_index, "from_specs", 2011, 11
- end
end
+
diff --git a/lib/rubygems/deprecate.rb b/lib/rubygems/deprecate.rb
index a78208ec24..274d6a5c12 100644
--- a/lib/rubygems/deprecate.rb
+++ b/lib/rubygems/deprecate.rb
@@ -20,51 +20,51 @@
# end
# end
-module Gem
- module Deprecate
+module Gem::Deprecate
- def self.skip # :nodoc:
- @skip ||= false
- end
-
- def self.skip= v # :nodoc:
- @skip = v
- end
+ def self.skip # :nodoc:
+ @skip ||= false
+ end
- ##
- # Temporarily turn off warnings. Intended for tests only.
+ def self.skip= v # :nodoc:
+ @skip = v
+ end
- def skip_during
- Gem::Deprecate.skip, original = true, Gem::Deprecate.skip
- yield
- ensure
- Gem::Deprecate.skip = original
- end
+ ##
+ # Temporarily turn off warnings. Intended for tests only.
- ##
- # Simple deprecation method that deprecates +name+ by wrapping it up
- # in a dummy method. It warns on each call to the dummy method
- # telling the user of +repl+ (unless +repl+ is :none) and the
- # year/month that it is planned to go away.
+ def skip_during
+ Gem::Deprecate.skip, original = true, Gem::Deprecate.skip
+ yield
+ ensure
+ Gem::Deprecate.skip = original
+ end
- def deprecate name, repl, year, month
- class_eval {
- old = "_deprecated_#{name}"
- alias_method old, name
- define_method name do |*args, &block| # TODO: really works on 1.8.7?
- klass = self.kind_of? Module
- target = klass ? "#{self}." : "#{self.class}#"
- msg = [ "NOTE: #{target}#{name} is deprecated",
- repl == :none ? " with no replacement" : ", use #{repl}",
- ". It will be removed on or after %4d-%02d-01." % [year, month],
- "\n#{target}#{name} called from #{Gem.location_of_caller.join(":")}",
- ]
- warn "#{msg.join}." unless Gem::Deprecate.skip
- send old, *args, &block
- end
- }
- end
+ ##
+ # Simple deprecation method that deprecates +name+ by wrapping it up
+ # in a dummy method. It warns on each call to the dummy method
+ # telling the user of +repl+ (unless +repl+ is :none) and the
+ # year/month that it is planned to go away.
- module_function :deprecate, :skip_during
+ def deprecate name, repl, year, month
+ class_eval {
+ old = "_deprecated_#{name}"
+ alias_method old, name
+ define_method name do |*args, &block| # TODO: really works on 1.8.7?
+ klass = self.kind_of? Module
+ target = klass ? "#{self}." : "#{self.class}#"
+ msg = [ "NOTE: #{target}#{name} is deprecated",
+ repl == :none ? " with no replacement" : "; use #{repl} instead",
+ ". It will be removed on or after %4d-%02d-01." % [year, month],
+ "\n#{target}#{name} called from #{Gem.location_of_caller.join(":")}",
+ ]
+ warn "#{msg.join}." unless Gem::Deprecate.skip
+ send old, *args, &block
+ end
+ }
end
+
+ module_function :deprecate, :skip_during
+
end
+
diff --git a/lib/rubygems/doc_manager.rb b/lib/rubygems/doc_manager.rb
deleted file mode 100644
index 826f57d9dd..0000000000
--- a/lib/rubygems/doc_manager.rb
+++ /dev/null
@@ -1,243 +0,0 @@
-#--
-# Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others.
-# All rights reserved.
-# See LICENSE.txt for permissions.
-#++
-
-require 'rubygems'
-
-##
-# The documentation manager generates RDoc and RI for RubyGems.
-
-class Gem::DocManager
-
- include Gem::UserInteraction
-
- @configured_args = []
-
- def self.configured_args
- @configured_args ||= []
- end
-
- def self.configured_args=(args)
- case args
- when Array
- @configured_args = args
- when String
- @configured_args = args.split
- end
- end
-
- ##
- # Load RDoc from a gem if it is available, otherwise from Ruby's stdlib
-
- def self.load_rdoc
- begin
- gem 'rdoc'
- rescue Gem::LoadError
- # use built-in RDoc
- end
-
- begin
- require 'rdoc/rdoc'
-
- @rdoc_version = if defined? RDoc::VERSION then
- Gem::Version.new RDoc::VERSION
- else
- Gem::Version.new '1.0.1' # HACK parsing is hard
- end
-
- rescue LoadError => e
- raise Gem::DocumentError,
- "ERROR: RDoc documentation generator not installed: #{e}"
- end
- end
-
- def self.rdoc_version
- @rdoc_version
- end
-
- ##
- # Updates the RI cache for RDoc 2 if it is installed
-
- def self.update_ri_cache
- load_rdoc rescue return
-
- return unless defined? RDoc::VERSION # RDoc 1 does not have VERSION
-
- require 'rdoc/ri/driver'
-
- options = {
- :use_cache => true,
- :use_system => true,
- :use_site => true,
- :use_home => true,
- :use_gems => true,
- :formatter => RDoc::RI::Formatter,
- }
-
- RDoc::RI::Driver.new(options).class_cache
- end
-
- ##
- # Create a document manager for +spec+. +rdoc_args+ contains arguments for
- # RDoc (template etc.) as a String.
-
- def initialize(spec, rdoc_args="")
- require 'fileutils'
- @spec = spec
- @doc_dir = spec.doc_dir
- @rdoc_args = rdoc_args.nil? ? [] : rdoc_args.split
- end
-
- ##
- # Is the RDoc documentation installed?
-
- def rdoc_installed?
- File.exist?(File.join(@doc_dir, "rdoc"))
- end
-
- ##
- # Is the RI documentation installed?
-
- def ri_installed?
- File.exist?(File.join(@doc_dir, "ri"))
- end
-
- ##
- # Generate the RI documents for this gem spec.
- #
- # Note that if both RI and RDoc documents are generated from the same
- # process, the RI docs should be done first (a likely bug in RDoc will cause
- # RI docs generation to fail if run after RDoc).
-
- def generate_ri
- setup_rdoc
- install_ri # RDoc bug, ri goes first
-
- FileUtils.mkdir_p @doc_dir unless File.exist?(@doc_dir)
- end
-
- ##
- # Generate the RDoc documents for this gem spec.
- #
- # Note that if both RI and RDoc documents are generated from the same
- # process, the RI docs should be done first (a likely bug in RDoc will cause
- # RI docs generation to fail if run after RDoc).
-
- def generate_rdoc
- setup_rdoc
- install_rdoc
-
- FileUtils.mkdir_p @doc_dir unless File.exist?(@doc_dir)
- end
-
- ##
- # Generate and install RDoc into the documentation directory
-
- def install_rdoc
- rdoc_dir = File.join @doc_dir, 'rdoc'
-
- FileUtils.rm_rf rdoc_dir
-
- say "Installing RDoc documentation for #{@spec.full_name}..."
- run_rdoc '--op', rdoc_dir
- end
-
- ##
- # Generate and install RI into the documentation directory
-
- def install_ri
- ri_dir = File.join @doc_dir, 'ri'
-
- FileUtils.rm_rf ri_dir
-
- say "Installing ri documentation for #{@spec.full_name}..."
- run_rdoc '--ri', '--op', ri_dir
- end
-
- ##
- # Run RDoc with +args+, which is an ARGV style argument list
-
- def run_rdoc(*args)
- args << @spec.rdoc_options
- args << self.class.configured_args
- args << @spec.require_paths.clone
- args << @spec.extra_rdoc_files
- args << '--title' << "#{@spec.full_name} Documentation"
- args << '--quiet'
- args = args.flatten.map do |arg| arg.to_s end
-
- if self.class.rdoc_version >= Gem::Version.new('2.4.0') then
- args.delete '--inline-source'
- args.delete '--promiscuous'
- args.delete '-p'
- args.delete '--one-file'
- # HACK more
- end
-
- debug_args = args.dup
-
- r = RDoc::RDoc.new
-
- old_pwd = Dir.pwd
- Dir.chdir @spec.full_gem_path
-
- say "rdoc #{args.join ' '}" if Gem.configuration.really_verbose
-
- begin
- r.document args
- rescue Errno::EACCES => e
- dirname = File.dirname e.message.split("-")[1].strip
- raise Gem::FilePermissionError.new(dirname)
- rescue Interrupt => e
- raise e
- rescue Exception => ex
- alert_error "While generating documentation for #{@spec.full_name}"
- ui.errs.puts "... MESSAGE: #{ex}"
- ui.errs.puts "... RDOC args: #{debug_args.join(' ')}"
- ui.errs.puts "\t#{ex.backtrace.join "\n\t"}" if
- Gem.configuration.backtrace
- terminate_interaction 1
- ensure
- Dir.chdir old_pwd
- end
- end
-
- def setup_rdoc
- if File.exist?(@doc_dir) && !File.writable?(@doc_dir) then
- raise Gem::FilePermissionError.new(@doc_dir)
- end
-
- FileUtils.mkdir_p @doc_dir unless File.exist?(@doc_dir)
-
- self.class.load_rdoc
- end
-
- ##
- # Remove RDoc and RI documentation
-
- def uninstall_doc
- base_dir = @spec.base_dir
- raise Gem::FilePermissionError.new base_dir unless File.writable? base_dir
-
- # TODO: ok... that's twice... ugh
- old_name = [
- @spec.name, @spec.version, @spec.original_platform].join '-'
-
- doc_dir = @spec.doc_dir
- unless File.directory? doc_dir then
- doc_dir = File.join File.dirname(doc_dir), old_name
- end
-
- ri_dir = @spec.ri_dir
- unless File.directory? ri_dir then
- ri_dir = File.join File.dirname(ri_dir), old_name
- end
-
- FileUtils.rm_rf doc_dir
- FileUtils.rm_rf ri_dir
- end
-
-end
-
diff --git a/lib/rubygems/doctor.rb b/lib/rubygems/doctor.rb
new file mode 100644
index 0000000000..0aa0f7b79f
--- /dev/null
+++ b/lib/rubygems/doctor.rb
@@ -0,0 +1,131 @@
+require 'rubygems'
+require 'rubygems/user_interaction'
+
+##
+# Cleans up after a partially-failed uninstall or for an invalid
+# Gem::Specification.
+#
+# If a specification was removed by hand this will remove any remaining files.
+#
+# If a corrupt specification was installed this will clean up warnings by
+# removing the bogus specification.
+
+class Gem::Doctor
+
+ include Gem::UserInteraction
+
+ ##
+ # Maps a gem subdirectory to the files that are expected to exist in the
+ # subdirectory.
+
+ REPOSITORY_EXTENSION_MAP = [ # :nodoc:
+ ['specifications', '.gemspec'],
+ ['build_info', '.info'],
+ ['cache', '.gem'],
+ ['doc', ''],
+ ['extensions', ''],
+ ['gems', ''],
+ ]
+
+ 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.
+ #
+ # If +dry_run+ is true no files or directories will be removed.
+
+ def initialize gem_repository, dry_run = false
+ @gem_repository = gem_repository
+ @dry_run = dry_run
+
+ @installed_specs = nil
+ end
+
+ ##
+ # Specs installed in this gem repository
+
+ def installed_specs # :nodoc:
+ @installed_specs ||= Gem::Specification.map { |s| s.full_name }
+ end
+
+ ##
+ # Are we doctoring a gem repository?
+
+ def gem_repository?
+ not installed_specs.empty?
+ end
+
+ ##
+ # Cleans up uninstalled files and invalid gem specifications
+
+ def doctor
+ @orig_home = Gem.dir
+ @orig_path = Gem.path
+
+ say "Checking #{@gem_repository}"
+
+ Gem.use_paths @gem_repository.to_s
+
+ unless gem_repository? then
+ say 'This directory does not appear to be a RubyGems repository, ' +
+ 'skipping'
+ say
+ return
+ end
+
+ doctor_children
+
+ say
+ ensure
+ Gem.use_paths @orig_home, *@orig_path
+ end
+
+ ##
+ # Cleans up children of this gem repository
+
+ def doctor_children # :nodoc:
+ REPOSITORY_EXTENSION_MAP.each do |sub_directory, extension|
+ doctor_child sub_directory, extension
+ end
+ end
+
+ ##
+ # Removes files in +sub_directory+ with +extension+
+
+ def doctor_child sub_directory, extension # :nodoc:
+ directory = File.join(@gem_repository, sub_directory)
+
+ Dir.entries(directory).sort.each do |ent|
+ next if ent == "." || ent == ".."
+
+ child = File.join(directory, ent)
+ next unless File.exists?(child)
+
+ 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 = File.directory?(child) ? 'directory' : 'file'
+
+ action = if @dry_run then
+ 'Extra'
+ else
+ FileUtils.rm_r(child)
+ 'Removed'
+ end
+
+ say "#{action} #{type} #{sub_directory}/#{File.basename(child)}"
+ end
+ rescue Errno::ENOENT
+ # ignore
+ end
+
+end
+
diff --git a/lib/rubygems/errors.rb b/lib/rubygems/errors.rb
index 950b34d744..fc9bfbc0dc 100644
--- a/lib/rubygems/errors.rb
+++ b/lib/rubygems/errors.rb
@@ -1,35 +1,107 @@
-class Gem::ErrorReason; end
-
-# Generated when trying to lookup a gem to indicate that the gem
-# was found, but that it isn't usable on the current platform.
-#
-# fetch and install read these and report them to the user to aid
-# in figuring out why a gem couldn't be installed.
+#--
+# This file contains all the various exceptions and other errors that are used
+# inside of RubyGems.
#
-class Gem::PlatformMismatch < Gem::ErrorReason
+# DOC: Confirm _all_
+#++
- attr_reader :name
- attr_reader :version
- attr_reader :platforms
+module Gem
+ ##
+ # Raised when RubyGems is unable to load or activate a gem. Contains the
+ # name and version requirements of the gem that either conflicts with
+ # already activated gems or that RubyGems is otherwise unable to activate.
- def initialize(name, version)
- @name = name
- @version = version
- @platforms = []
- end
+ class LoadError < ::LoadError
+ # Name of gem
+ attr_accessor :name
- def add_platform(platform)
- @platforms << platform
+ # Version requirement of gem
+ attr_accessor :requirement
end
- def wordy
- prefix = "Found #{@name} (#{@version})"
+ class ErrorReason; end
+
+ # Generated when trying to lookup a gem to indicate that the gem
+ # was found, but that it isn't usable on the current platform.
+ #
+ # fetch and install read these and report them to the user to aid
+ # in figuring out why a gem couldn't be installed.
+ #
+ class PlatformMismatch < ErrorReason
+
+ ##
+ # the name of the gem
+ attr_reader :name
+
+ ##
+ # the version
+ attr_reader :version
+
+ ##
+ # The platforms that are mismatched
+ attr_reader :platforms
- if @platforms.size == 1
- "#{prefix}, but was for platform #{@platforms[0]}"
- else
- "#{prefix}, but was for platforms #{@platforms.join(' ,')}"
+ def initialize(name, version)
+ @name = name
+ @version = version
+ @platforms = []
+ end
+
+ ##
+ # append a platform to the list of mismatched platforms.
+ #
+ # Platforms are added via this instead of injected via the constructor
+ # so that we can loop over a list of mismatches and just add them rather
+ # than perform some kind of calculation mismatch summary before creation.
+ def add_platform(platform)
+ @platforms << platform
+ end
+
+ ##
+ # A wordy description of the error.
+ def wordy
+ "Found %s (%s), but was for platform%s %s" %
+ [@name,
+ @version,
+ @platforms.size == 1 ? '' : 's',
+ @platforms.join(' ,')]
end
end
+ ##
+ # An error that indicates we weren't able to fetch some
+ # 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
+
+ ##
+ # 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 55d67f9125..6bd50eca2c 100644
--- a/lib/rubygems/exceptions.rb
+++ b/lib/rubygems/exceptions.rb
@@ -1,7 +1,20 @@
+# TODO: the documentation in here is terrible.
+#
+# Each exception needs a brief description and the scenarios where it is
+# likely to be raised
+
##
# Base exception class for RubyGems. All exception raised by RubyGems are a
# subclass of this one.
-class Gem::Exception < RuntimeError; end
+class Gem::Exception < RuntimeError
+
+ ##
+ #--
+ # TODO: remove in RubyGems 3, nobody sets this
+
+ attr_accessor :source_exception # :nodoc:
+
+end
class Gem::CommandLineError < Gem::Exception; end
@@ -10,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::Exception
+
+ 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
@@ -24,11 +59,18 @@ class Gem::EndOfYAMLException < Gem::Exception; end
##
# Signals that a file permission error is preventing the user from
-# installing in the requested directories.
+# operating on the given directory.
+
class Gem::FilePermissionError < Gem::Exception
- def initialize(path)
- super("You don't have write permissions into the #{path} directory.")
+
+ attr_reader :directory
+
+ def initialize directory
+ @directory = directory
+
+ super "You don't have write permissions for the #{directory} directory."
end
+
end
##
@@ -37,15 +79,77 @@ class Gem::FormatException < Gem::Exception
attr_accessor :file_path
end
-class Gem::GemNotFoundException < Gem::Exception
- def initialize(msg, name=nil, version=nil, errors=nil)
- super msg
+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"
+
@name = name
@version = version
@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
@@ -73,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
##
@@ -80,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
@@ -89,3 +209,42 @@ class Gem::SystemExitException < SystemExit
end
end
+
+##
+# Raised by Resolver when a dependency requests a gem for which
+# there is no spec.
+
+class Gem::UnsatisfiableDependencyError < Gem::Exception
+
+ ##
+ # The unsatisfiable dependency. This is a
+ # Gem::Resolver::DependencyRequest, not a Gem::Dependency
+
+ attr_reader :dependency
+
+ ##
+ # 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
+ 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 97ee762a4a..5af6bbf39e 100644
--- a/lib/rubygems/ext.rb
+++ b/lib/rubygems/ext.rb
@@ -4,15 +4,15 @@
# 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'
require 'rubygems/ext/rake_builder'
+require 'rubygems/ext/cmake_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 5e518962ce..e9244c760c 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,29 +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
- mf = File.read('Makefile')
- mf = mf.gsub(/^RUBYARCHDIR\s*=\s*\$[^$]*/, "RUBYARCHDIR = #{dest_path}")
- mf = mf.gsub(/^RUBYLIBDIR\s*=\s*\$[^$]*/, "RUBYLIBDIR = #{dest_path}")
-
- File.open('Makefile', 'wb') {|f| f.print mf}
-
# try to find make program from Ruby configure arguments first
RbConfig::CONFIG['configure_args'] =~ /with-make-prog\=(\w+)/
- make_program = $1 || ENV['make']
+ make_program = ENV['MAKE'] || ENV['make'] || $1
unless make_program then
make_program = (/mswin/ =~ RUBY_PLATFORM) ? 'nmake' : 'make'
end
- ['', ' install'].each do |target|
- cmd = "#{make_program}#{target}"
- results << cmd
- results << `#{cmd} #{redirector}`
+ destdir = '"DESTDIR=%s"' % ENV['DESTDIR'] if RUBY_VERSION > '2.0'
- raise Gem::InstallError, "make#{target} failed:\n\n#{results}" unless
- $?.success?
+ ['clean', '', 'install'].each do |target|
+ # Pass DESTDIR via command line to override what's in MAKEFLAGS
+ cmd = [
+ make_program,
+ destdir,
+ target
+ ].join(' ').rstrip
+ begin
+ run(cmd, results, "make #{target}".rstrip)
+ rescue Gem::InstallError
+ raise unless target == 'clean' # ignore clean failure
+ end
end
end
@@ -43,13 +59,159 @@ class Gem::Ext::Builder
'2>&1'
end
- def self.run(command, results)
- results << command
- results << `#{command} #{redirector}`
+ def self.run(command, results, command_name = nil)
+ verbose = Gem.configuration.really_verbose
+
+ begin
+ # TODO use Process.spawn when ruby 1.8 support is dropped.
+ rubygems_gemdeps, ENV['RUBYGEMS_GEMDEPS'] = ENV['RUBYGEMS_GEMDEPS'], nil
+ if verbose
+ puts(command)
+ system(command)
+ else
+ results << command
+ results << `#{command} #{redirector}`
+ end
+ ensure
+ ENV['RUBYGEMS_GEMDEPS'] = rubygems_gemdeps
+ end
unless $?.success? then
- raise Gem::InstallError, "#{class_name} failed:\n\n#{results.join "\n"}"
+ results << "Building has failed. See above output for more information on the failure." if verbose
+
+ 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.gem_dir
+
+ @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)
+
+ say results.join("\n") if Gem.configuration.really_verbose
+ 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_install_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_install_dir, 'gem_make.out'
+
+ FileUtils.mkdir_p @spec.extension_install_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
new file mode 100644
index 0000000000..24531bc75c
--- /dev/null
+++ b/lib/rubygems/ext/cmake_builder.rb
@@ -0,0 +1,16 @@
+require 'rubygems/command'
+
+class Gem::Ext::CmakeBuilder < Gem::Ext::Builder
+ 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?
+
+ run cmd, results
+ end
+
+ make dest_path, results
+
+ results
+ end
+end
diff --git a/lib/rubygems/ext/configure_builder.rb b/lib/rubygems/ext/configure_builder.rb
index c2087eb5ad..f66e39387a 100644
--- a/lib/rubygems/ext/configure_builder.rb
+++ b/lib/rubygems/ext/configure_builder.rb
@@ -4,14 +4,12 @@
# See LICENSE.txt for permissions.
#++
-require 'rubygems/ext/builder'
-
class Gem::Ext::ConfigureBuilder < 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 = "sh ./configure --prefix=#{dest_path}"
- cmd << " #{Gem::Command.build_args.join ' '}" unless Gem::Command.build_args.empty?
+ cmd << " #{args.join ' '}" unless args.empty?
run cmd, results
end
diff --git a/lib/rubygems/ext/ext_conf_builder.rb b/lib/rubygems/ext/ext_conf_builder.rb
index b3d588dc9c..6e736d8062 100644
--- a/lib/rubygems/ext/ext_conf_builder.rb
+++ b/lib/rubygems/ext/ext_conf_builder.rb
@@ -4,20 +4,66 @@
# 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)
- cmd = "#{Gem.ruby} #{File.basename extension}"
- cmd << " #{Gem::Command.build_args.join ' '}" unless Gem::Command.build_args.empty?
+ def self.build(extension, directory, dest_path, results, args=[], lib_dir=nil)
+ tmp_dest = Dir.mktmpdir(".gem.", ".")
- run cmd, results
+ t = nil
+ Tempfile.open %w"siteconf .rb", "." do |siteconf|
+ t = siteconf
+ siteconf.puts "require 'rbconfig'"
+ siteconf.puts "dest_path = #{(tmp_dest || dest_path).dump}"
+ %w[sitearchdir sitelibdir].each do |dir|
+ siteconf.puts "RbConfig::MAKEFILE_CONFIG['#{dir}'] = dest_path"
+ siteconf.puts "RbConfig::CONFIG['#{dir}'] = dest_path"
+ end
- make dest_path, results
+ 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 ' '
+
+ run cmd, results
+
+ ENV["DESTDIR"] = nil
+ ENV["RUBYOPT"] = rubyopt
+ siteconf.unlink
+
+ make dest_path, results
+
+ if tmp_dest
+ FileEntry.new(tmp_dest).traverse do |ent|
+ # TODO remove in RubyGems 3
+ if lib_dir then
+ libent = ent.class.new lib_dir, ent.rel
+ libent.exist? or ent.copy libent.path
+ end
+
+ destent = ent.class.new(dest_path, ent.rel)
+ destent.exist? or File.rename(ent.path, destent.path)
+ end
+ end
+ ensure
+ ENV["RUBYOPT"] = rubyopt
+ ENV["DESTDIR"] = destdir
+ end
+ end
+ t.unlink if t and t.path
results
+ ensure
+ FileUtils.rm_rf tmp_dest if tmp_dest
end
end
diff --git a/lib/rubygems/ext/rake_builder.rb b/lib/rubygems/ext/rake_builder.rb
index a1df694366..2093bcabdd 100644
--- a/lib/rubygems/ext/rake_builder.rb
+++ b/lib/rubygems/ext/rake_builder.rb
@@ -4,15 +4,12 @@
# 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)
+ 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 << " #{Gem::Command.build_args.join " "}" unless Gem::Command.build_args.empty?
+ cmd << " #{args.join " "}" unless args.empty?
run cmd, results
end
diff --git a/lib/rubygems/format.rb b/lib/rubygems/format.rb
deleted file mode 100644
index 9644f6ab8e..0000000000
--- a/lib/rubygems/format.rb
+++ /dev/null
@@ -1,82 +0,0 @@
-#--
-# Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others.
-# All rights reserved.
-# See LICENSE.txt for permissions.
-#++
-
-require 'rubygems/package'
-
-##
-# Gem::Format knows the guts of the RubyGem .gem file format and provides the
-# capability to read gem files
-
-class Gem::Format
-
- attr_accessor :spec
- attr_accessor :file_entries
- attr_accessor :gem_path
-
- ##
- # Constructs a Format representing the gem's data which came from +gem_path+
-
- def initialize(gem_path)
- @gem_path = gem_path
- end
-
- ##
- # Reads the gem +file_path+ using +security_policy+ and returns a Format
- # representing the data in the gem
-
- def self.from_file_by_path(file_path, security_policy = nil)
- unless File.file?(file_path)
- raise Gem::Exception, "Cannot load gem at [#{file_path}] in #{Dir.pwd}"
- end
-
- start = File.read file_path, 20
-
- if start.nil? or start.length < 20 then
- nil
- elsif start.include?("MD5SUM =") # old version gems
- require 'rubygems/old_format'
-
- Gem::OldFormat.from_file_by_path file_path
- else
- begin
- open file_path, Gem.binary_mode do |io|
- from_io io, file_path, security_policy
- end
- rescue Gem::Package::TarInvalidError => e
- message = "corrupt gem (#{e.class}: #{e.message})"
- raise Gem::Package::FormatError.new(message, file_path)
- end
- end
- end
-
- ##
- # Reads a gem from +io+ at +gem_path+ using +security_policy+ and returns a
- # Format representing the data from the gem
-
- def self.from_io(io, gem_path="(io)", security_policy = nil)
- format = new gem_path
-
- Gem::Package.open io, 'r', security_policy do |pkg|
- format.spec = pkg.metadata
- format.file_entries = []
-
- pkg.each do |entry|
- size = entry.header.size
- mode = entry.header.mode
-
- format.file_entries << [{
- "size" => size, "mode" => mode, "path" => entry.full_name,
- },
- entry.read
- ]
- end
- end
-
- format
- end
-
-end
-
diff --git a/lib/rubygems/gem_openssl.rb b/lib/rubygems/gem_openssl.rb
deleted file mode 100644
index 682058f2c1..0000000000
--- a/lib/rubygems/gem_openssl.rb
+++ /dev/null
@@ -1,90 +0,0 @@
-#--
-# Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others.
-# All rights reserved.
-# See LICENSE.txt for permissions.
-#++
-
-#--
-# Some system might not have OpenSSL installed, therefore the core
-# library file openssl might not be available. We localize testing
-# for the presence of OpenSSL in this file.
-#++
-
-module Gem
- class << self
- ##
- # Is SSL (used by the signing commands) available on this
- # platform?
-
- def ssl_available?
- @ssl_available
- end
-
- ##
- # Is SSL available?
-
- attr_writer :ssl_available
-
- ##
- # Ensure that SSL is available. Throw an exception if it is not.
-
- def ensure_ssl_available
- unless ssl_available?
- raise Gem::Exception, "SSL is not installed on this system"
- end
- end
- end
-end
-
-# :stopdoc:
-
-begin
- require 'openssl'
-
- # Reference a constant defined in the .rb portion of ssl (just to
- # make sure that part is loaded too).
-
- Gem.ssl_available = !!OpenSSL::Digest::SHA1
-
- class OpenSSL::X509::Certificate
- # Check the validity of this certificate.
- def check_validity(issuer_cert = nil, time = Time.now)
- ret = if @not_before && @not_before > time
- [false, :expired, "not valid before '#@not_before'"]
- elsif @not_after && @not_after < time
- [false, :expired, "not valid after '#@not_after'"]
- elsif issuer_cert && !verify(issuer_cert.public_key)
- [false, :issuer, "#{issuer_cert.subject} is not issuer"]
- else
- [true, :ok, 'Valid certificate']
- end
-
- # return hash
- { :is_valid => ret[0], :error => ret[1], :desc => ret[2] }
- end
- end
-
-rescue LoadError, StandardError
- Gem.ssl_available = false
-end
-
-module Gem::SSL
-
- # We make our own versions of the constants here. This allows us
- # to reference the constants, even though some systems might not
- # have SSL installed in the Ruby core package.
- #
- # These constants are only used during load time. At runtime, any
- # method that makes a direct reference to SSL software must be
- # protected with a Gem.ensure_ssl_available call.
-
- if Gem.ssl_available? then
- PKEY_RSA = OpenSSL::PKey::RSA
- DIGEST_SHA1 = OpenSSL::Digest::SHA1
- else
- PKEY_RSA = :rsa
- DIGEST_SHA1 = :sha1
- end
-
-end
-
diff --git a/lib/rubygems/gem_path_searcher.rb b/lib/rubygems/gem_path_searcher.rb
deleted file mode 100644
index 814b5fb0e5..0000000000
--- a/lib/rubygems/gem_path_searcher.rb
+++ /dev/null
@@ -1,172 +0,0 @@
-require "rubygems"
-require "rubygems/deprecate"
-
-##
-# GemPathSearcher has the capability to find loadable files inside
-# gems. It generates data up front to speed up searches later.
-
-class Gem::GemPathSearcher
-
- ##
- # Initialise the data we need to make searches later.
-
- def initialize
- # We want a record of all the installed gemspecs, in the order we wish to
- # examine them.
- # TODO: remove this stupid method
- @gemspecs = init_gemspecs
-
- # Map gem spec to glob of full require_path directories. Preparing this
- # information may speed up searches later.
- @lib_dirs = {}
-
- @gemspecs.each do |spec|
- @lib_dirs[spec.object_id] = lib_dirs_for spec
- end
- end
-
- ##
- # Look in all the installed gems until a matching +glob+ is found.
- # Return the _gemspec_ of the gem where it was found. If no match
- # is found, return nil.
- #
- # The gems are searched in alphabetical order, and in reverse
- # version order.
- #
- # For example:
- #
- # find('log4r') # -> (log4r-1.1 spec)
- # find('log4r.rb') # -> (log4r-1.1 spec)
- # find('rake/rdoctask') # -> (rake-0.4.12 spec)
- # find('foobarbaz') # -> nil
- #
- # Matching paths can have various suffixes ('.rb', '.so', and
- # others), which may or may not already be attached to _file_.
- # This method doesn't care about the full filename that matches;
- # only that there is a match.
-
- def find(glob)
- # HACK violation of encapsulation
- @gemspecs.find do |spec|
- # TODO: inverted responsibility
- matching_file? spec, glob
- end
- end
-
- # Looks through the available gemspecs and finds the first
- # one that contains +file+ as a requirable file.
-
- def find_spec_for_file(file)
- @gemspecs.find do |spec|
- return spec if spec.contains_requirable_file?(file)
- end
- end
-
- def find_active(glob)
- # HACK violation of encapsulation
- @gemspecs.find do |spec|
- # TODO: inverted responsibility
- spec.loaded? and matching_file? spec, glob
- end
- end
-
- ##
- # Works like #find, but finds all gemspecs matching +glob+.
-
- def find_all(glob)
- # HACK violation of encapsulation
- @gemspecs.select do |spec|
- # TODO: inverted responsibility
- matching_file? spec, glob
- end || []
- end
-
- def find_in_unresolved(glob)
- # HACK violation
- specs = Gem.unresolved_deps.values.map { |dep|
- Gem.source_index.search dep, true
- }.flatten
-
- specs.select do |spec|
- # TODO: inverted responsibility
- matching_file? spec, glob
- end || []
- end
-
- def find_in_unresolved_tree glob
- # HACK violation
- # TODO: inverted responsibility
- specs = Gem.unresolved_deps.values.map { |dep|
- Gem.source_index.search dep, true
- }.flatten
-
- specs.reverse_each do |spec|
- trails = matching_paths(spec, glob)
- next if trails.empty?
- return trails.map(&:reverse).sort.first.reverse
- end
-
- []
- end
-
- ##
- # Attempts to find a matching path using the require_paths of the given
- # +spec+.
-
- def matching_file?(spec, path)
- not matching_files(spec, path).empty?
- end
-
- def matching_paths(spec, path)
- trails = []
-
- spec.traverse do |from_spec, dep, to_spec, trail|
- next unless to_spec.conflicts.empty?
- trails << trail unless matching_files(to_spec, path).empty?
- end
-
- trails
- end
-
- ##
- # Returns files matching +path+ in +spec+.
- #--
- # Some of the intermediate results are cached in @lib_dirs for speed.
-
- def matching_files(spec, path)
- return [] unless @lib_dirs[spec.object_id] # case no paths
- glob = File.join @lib_dirs[spec.object_id], "#{path}#{Gem.suffix_pattern}"
- Dir[glob].select { |f| File.file? f.untaint }
- end
-
- ##
- # Return a list of all installed gemspecs, sorted by alphabetical order and
- # in reverse version order. (bar-2, bar-1, foo-2)
-
- def init_gemspecs
- Gem::Specification.sort { |a, b|
- names = a.name <=> b.name
- next names if names.nonzero?
- b.version <=> a.version
- }
- end
-
- ##
- # Returns library directories glob for a gemspec. For example,
- # '/usr/local/lib/ruby/gems/1.8/gems/foobar-1.0/{lib,ext}'
-
- def lib_dirs_for(spec)
- "#{spec.full_gem_path}/{#{spec.require_paths.join(',')}}" if
- spec.require_paths
- end
-
- extend Gem::Deprecate
-
- deprecate :initialize, :none, 2011, 10
- deprecate :find, :none, 2011, 10
- deprecate :find_active, :none, 2011, 10
- deprecate :find_all, :none, 2011, 10
- deprecate :find_in_unresolved, :none, 2011, 10
- deprecate :find_in_unresolved_tree, :none, 2011, 10
- deprecate :find_spec_for_file, :none, 2011, 10
-end
diff --git a/lib/rubygems/gem_runner.rb b/lib/rubygems/gem_runner.rb
index 6197036f81..7a3fd6b116 100644
--- a/lib/rubygems/gem_runner.rb
+++ b/lib/rubygems/gem_runner.rb
@@ -4,10 +4,9 @@
# See LICENSE.txt for permissions.
#++
-require "rubygems"
+require 'rubygems'
require 'rubygems/command_manager'
require 'rubygems/config_file'
-require 'rubygems/doc_manager'
##
# Load additional plugins from $LOAD_PATH
@@ -29,26 +28,16 @@ class Gem::GemRunner
# TODO: nuke these options
@command_manager_class = options[:command_manager] || Gem::CommandManager
@config_file_class = options[:config_file] || Gem::ConfigFile
- @doc_manager_class = options[:doc_manager] || Gem::DocManager
end
##
# Run the gem command with the following arguments.
- def run(args)
- start_time = Time.now
-
- 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.
- build_args = args[args.index("--") + 1...args.length]
- args = args[0...args.index("--")]
- end
-
- Gem::Command.build_args = build_args if build_args
+ def run args
+ build_args = extract_build_args args
do_configuration args
+
cmd = @command_manager_class.instance
cmd.command_names.each do |command_name|
@@ -62,14 +51,21 @@ class Gem::GemRunner
Gem::Command.add_specific_extra_args command_name, config_args
end
- cmd.run Gem.configuration.args
- end_time = Time.now
+ cmd.run Gem.configuration.args, build_args
+ end
- if Gem.configuration.benchmark then
- printf "\nExecution time: %0.2f seconds.\n", end_time - start_time
- puts "Press Enter to finish"
- STDIN.gets
- 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
@@ -78,7 +74,6 @@ class Gem::GemRunner
Gem.configuration = @config_file_class.new(args)
Gem.use_paths Gem.configuration[:gemhome], Gem.configuration[:gempath]
Gem::Command.extra_args = Gem.configuration[:gem]
- @doc_manager_class.configured_args = Gem.configuration[:rdoc]
end
end
diff --git a/lib/rubygems/gemcutter_utilities.rb b/lib/rubygems/gemcutter_utilities.rb
index c0e7ee99e9..6a4da9e983 100644
--- a/lib/rubygems/gemcutter_utilities.rb
+++ b/lib/rubygems/gemcutter_utilities.rb
@@ -1,10 +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
@@ -16,25 +23,87 @@ 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]
+ elsif Gem.configuration.api_keys.key?(host)
+ Gem.configuration.api_keys[host]
else
Gem.configuration.rubygems_api_key
end
end
- def sign_in
+ ##
+ # 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
- say "Enter your RubyGems.org credentials."
- say "Don't have an account yet? Create one at http://rubygems.org/sign_up"
+ pretty_host = if Gem::DEFAULT_HOST == sign_in_host then
+ 'RubyGems.org'
+ else
+ sign_in_host
+ end
+
+ say "Enter your #{pretty_host} credentials."
+ say "Don't have an account yet? " +
+ "Create one at #{sign_in_host}/sign_up"
email = ask " Email: "
password = ask_for_password "Password: "
say "\n"
- response = rubygems_api_request :get, "api/v1/api_key" do |request|
+ response = rubygems_api_request(:get, "api/v1/api_key",
+ sign_in_host) do |request|
request.basic_auth email, password
end
@@ -44,39 +113,42 @@ module Gem::GemcutterUtilities
end
end
- def rubygems_api_request(method, path, host = Gem.host, &block)
- require 'net/http'
- host = ENV['RUBYGEMS_HOST'] if ENV['RUBYGEMS_HOST']
- uri = URI.parse "#{host}/#{path}"
-
- say "Pushing gem to #{host}..."
-
- request_method = Net::HTTP.const_get method.to_s.capitalize
+ ##
+ # Retrieves the pre-configured API key +key+ or terminates interaction with
+ # an error.
- Gem::RemoteFetcher.fetcher.request(uri, request_method, &block)
+ 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
- def with_response(resp)
- 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
- say resp.body
- terminate_interaction 1
- end
- end
+ message = response.body
+ message = "#{error_prefix}: #{message}" if error_prefix
- 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. You can add it with gem keys --add #{key}"
- terminate_interaction 1
+ say message
+ terminate_interaction 1 # TODO: question this
end
end
end
+
diff --git a/lib/rubygems/indexer.rb b/lib/rubygems/indexer.rb
index e87e5a3632..1c7f8e709f 100644
--- a/lib/rubygems/indexer.rb
+++ b/lib/rubygems/indexer.rb
@@ -1,5 +1,5 @@
require 'rubygems'
-require 'rubygems/format'
+require 'rubygems/package'
require 'time'
begin
@@ -16,11 +16,6 @@ class Gem::Indexer
include Gem::UserInteraction
##
- # Build indexes for RubyGems older than 1.2.0 when true
-
- attr_accessor :build_legacy
-
- ##
# Build indexes for RubyGems 1.2.0 and newer when true
attr_accessor :build_modern
@@ -59,19 +54,14 @@ class Gem::Indexer
require 'zlib'
unless defined?(Builder::XChar) then
- raise "Gem::Indexer requires that the XML Builder library be installed:" \
- "\n\tgem install builder"
+ raise "Gem::Indexer requires that the XML Builder library be installed:" +
+ "\n\tgem install builder"
end
- options = { :build_legacy => true, :build_modern => true }.merge options
+ options = { :build_modern => true }.merge options
- @build_legacy = options[:build_legacy]
@build_modern = options[:build_modern]
- @rss_title = options[:rss_title]
- @rss_host = options[:rss_host]
- @rss_gems_host = options[:rss_gems_host]
-
@dest_directory = directory
@directory = File.join(Dir.tmpdir, "gem_generate_index_#{$$}")
@@ -99,8 +89,6 @@ class Gem::Indexer
@dest_prerelease_specs_index =
File.join(@dest_directory, "prerelease_specs.#{Gem.marshal_version}")
- @rss_index = File.join @directory, 'index.rss'
-
@files = []
end
@@ -109,6 +97,8 @@ class Gem::Indexer
# searching, downloading and related activities and do not need deployment
# specific information (e.g. list of files). So we abbreviate the spec,
# making it much smaller for quicker downloads.
+ #--
+ # TODO move to Gem::Specification
def abbreviate(spec)
spec.files = []
@@ -123,42 +113,20 @@ class Gem::Indexer
# Build various indicies
def build_indicies
- # Marshal gemspecs are used by both modern and legacy RubyGems
-
Gem::Specification.dirs = []
Gem::Specification.add_specs(*map_gems_to_specs(gem_file_list))
build_marshal_gemspecs
- build_legacy_indicies if @build_legacy
build_modern_indicies if @build_modern
- build_rss
compress_indicies
end
##
- # Builds indicies for RubyGems older than 1.2.x
-
- def build_legacy_indicies
- index = collect_specs
-
- say "Generating Marshal master index"
-
- Gem.time 'Generated Marshal master index' do
- open @marshal_index, 'wb' do |io|
- io.write index.dump
- end
- end
-
- @files << @marshal_index
- @files << "#{@marshal_index}.Z"
- end
-
- ##
# 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"
@@ -167,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
@@ -220,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')
@@ -238,104 +210,6 @@ class Gem::Indexer
"#{@prerelease_specs_index}.gz"]
end
- ##
- # Builds an RSS feed for past two days gem releases according to the gem's
- # date.
-
- def build_rss
- if @rss_host.nil? or @rss_gems_host.nil? then
- if Gem.configuration.really_verbose then
- alert_warning "no --rss-host or --rss-gems-host, RSS generation disabled"
- end
- return
- end
-
- require 'cgi'
- require 'rubygems/text'
-
- extend Gem::Text
-
- Gem.time 'Generated rss' do
- open @rss_index, 'wb' do |io|
- rss_host = CGI.escapeHTML @rss_host
- rss_title = CGI.escapeHTML(@rss_title || 'gems')
-
- io.puts <<-HEADER
-<?xml version="1.0"?>
-<rss version="2.0">
- <channel>
- <title>#{rss_title}</title>
- <link>http://#{rss_host}</link>
- <description>Recently released gems from http://#{rss_host}</description>
- <generator>RubyGems v#{Gem::VERSION}</generator>
- <docs>http://cyber.law.harvard.edu/rss/rss.html</docs>
- HEADER
-
- today = Gem::Specification::TODAY
- yesterday = today - 86400
-
- index = Gem::Specification.select do |spec|
- spec_date = spec.date
- # TODO: remove this and make YAML based specs properly normalized
- spec_date = Time.parse(spec_date.to_s) if Date === spec_date
-
- spec_date >= yesterday && spec_date <= today
- end
-
- index.sort_by { |spec| [-spec.date.to_i, spec] }.each do |spec|
- file_name = File.basename spec.cache_file
- gem_path = CGI.escapeHTML "http://#{@rss_gems_host}/gems/#{file_name}"
- size = File.stat(spec.loaded_from).size # rescue next
-
- description = spec.description || spec.summary || ''
- authors = Array spec.authors
- emails = Array spec.email
- authors = emails.zip(authors).map do |email, author|
- email += " (#{author})" if author and not author.empty?
- end.join ', '
-
- description = description.split(/\n\n+/).map do |chunk|
- format_text chunk, 78
- end
-
- description = description.join "\n\n"
-
- item = ''
-
- item << <<-ITEM
- <item>
- <title>#{CGI.escapeHTML spec.full_name}</title>
- <description>
-&lt;pre&gt;#{CGI.escapeHTML description.chomp}&lt;/pre&gt;
- </description>
- <author>#{CGI.escapeHTML authors}</author>
- <guid>#{CGI.escapeHTML spec.full_name}</guid>
- <enclosure url=\"#{gem_path}\"
- length=\"#{size}\" type=\"application/octet-stream\" />
- <pubDate>#{spec.date.rfc2822}</pubDate>
- ITEM
-
- item << <<-ITEM if spec.homepage
- <link>#{CGI.escapeHTML spec.homepage}</link>
- ITEM
-
- item << <<-ITEM
- </item>
- ITEM
-
- io.puts item
- end
-
- io.puts <<-FOOTER
- </channel>
-</rss>
- FOOTER
- end
- end
-
- @files << @rss_index
- end
-
def map_gems_to_specs gems
gems.map { |gemfile|
if File.size(gemfile) == 0 then
@@ -344,7 +218,7 @@ class Gem::Indexer
end
begin
- spec = Gem::Format.from_file_by_path(gemfile).spec
+ spec = Gem::Package.new(gemfile).spec
spec.loaded_from = gemfile
# HACK: fuck this shit - borks all tests that use pl1
@@ -374,21 +248,6 @@ class Gem::Indexer
end
##
- # Collect specifications from .gem files from the gem directory.
-
- def collect_specs(gems = gem_file_list)
- Gem::Deprecate.skip_during do
- index = Gem::SourceIndex.new
-
- map_gems_to_specs(gems).each do |spec|
- index.add_spec spec, spec.original_name
- end
-
- index
- end
- end
-
- ##
# Compresses indicies on disk
#--
# All future files should be compressed using gzip, not deflate
@@ -397,11 +256,6 @@ class Gem::Indexer
say "Compressing indicies"
Gem.time 'Compressed indicies' do
- if @build_legacy then
- compress @marshal_index, 'Z'
- paranoid @marshal_index, 'Z'
- end
-
if @build_modern then
gzip @specs_index
gzip @latest_specs_index
@@ -559,12 +413,9 @@ class Gem::Indexer
end
##
- # Perform an in-place update of the repository from newly added gems. Only
- # works for modern indicies, and sets #build_legacy to false when run.
+ # Perform an in-place update of the repository from newly added gems.
def update_index
- @build_legacy = false
-
make_temp_directories
specs_mtime = File.stat(@dest_specs_index).mtime
@@ -584,6 +435,9 @@ class Gem::Indexer
specs = map_gems_to_specs updated_gems
prerelease, released = specs.partition { |s| s.version.prerelease? }
+ Gem::Specification.dirs = []
+ Gem::Specification.add_specs(*specs)
+
files = build_marshal_gemspecs
Gem.time 'Updated indexes' do
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_message.rb b/lib/rubygems/install_message.rb
new file mode 100644
index 0000000000..c1979c1549
--- /dev/null
+++ b/lib/rubygems/install_message.rb
@@ -0,0 +1,12 @@
+require 'rubygems'
+require 'rubygems/user_interaction'
+
+##
+# A default post-install hook that displays "Successfully installed
+# some_gem-1.0"
+
+Gem.post_install do |installer|
+ ui = Gem::DefaultUserInteraction.ui
+ ui.say "Successfully installed #{installer.spec.full_name}"
+end
+
diff --git a/lib/rubygems/install_update_options.rb b/lib/rubygems/install_update_options.rb
index 3ee6432b4c..d3f55cd5ea 100644
--- a/lib/rubygems/install_update_options.rb
+++ b/lib/rubygems/install_update_options.rb
@@ -22,9 +22,13 @@ module Gem::InstallUpdateOptions
# Add the install/update options to the option parser.
def add_install_update_options
+ # TODO: use @parser.accept
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)"
@@ -39,21 +43,49 @@ module Gem::InstallUpdateOptions
end
add_option(:"Install/Update", '-n', '--bindir DIR',
- 'Directory where binary files are',
- 'located') do |value, options|
+ 'Directory where binary files are',
+ 'located') do |value, options|
options[:bin_dir] = File.expand_path(value)
end
- add_option(:"Install/Update", '-d', '--[no-]rdoc',
- 'Generate RDoc documentation for the gem on',
- 'install') do |value, options|
- options[:generate_rdoc] = value
+ add_option(:"Install/Update", '--[no-]document [TYPES]', Array,
+ 'Generate documentation for installed gems',
+ 'List the documentation types you wish to',
+ 'generate. For example: rdoc,ri') do |value, options|
+ options[:document] = case value
+ when nil then %w[ri]
+ when false then []
+ else value
+ end
+ end
+
+ add_option(:"Install/Update", '-N', '--no-document',
+ 'Disable documentation generation') do |value, options|
+ options[:document] = []
end
- add_option(:"Install/Update", '--[no-]ri',
- 'Generate RI documentation for the gem on',
- 'install') do |value, options|
- options[:generate_ri] = value
+ add_option(:Deprecated, '--[no-]rdoc',
+ 'Generate RDoc for installed gems',
+ 'Use --document instead') do |value, options|
+ if value then
+ options[:document] << 'rdoc'
+ else
+ options[:document].delete 'rdoc'
+ end
+
+ options[:document].uniq!
+ end
+
+ add_option(:Deprecated, '--[no-]ri',
+ 'Generate ri data for installed gems.',
+ 'Use --document instead') do |value, options|
+ if value then
+ options[:document] << 'ri'
+ else
+ options[:document].delete 'ri'
+ end
+
+ options[:document].uniq!
end
add_option(:"Install/Update", '-E', '--[no-]env-shebang',
@@ -85,12 +117,6 @@ module Gem::InstallUpdateOptions
options[:ignore_dependencies] = value
end
- add_option(:"Install/Update", '-y', '--include-dependencies',
- 'Unconditionally install the required',
- 'dependent gems') do |value, options|
- options[:include_dependencies] = value
- end
-
add_option(:"Install/Update", '--[no-]format-executable',
'Make installed executable names match ruby.',
'If ruby is ruby18, foo_exec will be',
@@ -105,15 +131,30 @@ module Gem::InstallUpdateOptions
end
add_option(:"Install/Update", "--development",
- "Install any additional development",
+ "Install additional development",
"dependencies") do |value, options|
options[:development] = true
+ options[:dev_shallow] = true
+ end
+
+ add_option(:"Install/Update", "--development-all",
+ "Install development dependencies for all",
+ "gems (including dev deps themselves)") do |value, options|
+ options[:development] = true
+ options[:dev_shallow] = false
end
add_option(:"Install/Update", "--conservative",
"Don't attempt to upgrade gems already",
"meeting version requirement") do |value, options|
options[:conservative] = true
+ options[:minimal_deps] = true
+ end
+
+ add_option(:"Install/Update", "--minimal-deps",
+ "Don't upgrade any dependencies that already",
+ "meet version requirements") do |value, options|
+ options[:minimal_deps] = true
end
end
@@ -121,7 +162,7 @@ module Gem::InstallUpdateOptions
# Default options for the gem install command.
def install_update_defaults_str
- '--rdoc --no-force --wrappers'
+ '--document=rdoc,ri --wrappers'
end
end
diff --git a/lib/rubygems/installer.rb b/lib/rubygems/installer.rb
index 514316f099..214652a241 100644
--- a/lib/rubygems/installer.rb
+++ b/lib/rubygems/installer.rb
@@ -4,15 +4,15 @@
# See LICENSE.txt for permissions.
#++
-require 'rubygems/format'
+require 'rubygems/command'
require 'rubygems/exceptions'
+require 'rubygems/package'
require 'rubygems/ext'
-require 'rubygems/require_paths_builder'
require 'rubygems/user_interaction'
+require 'fileutils'
##
-# The installer class processes RubyGem .gem files and installs the files
-# contained in the .gem into the Gem.path.
+# The installer installs the files contained in the .gem into the Gem.home.
#
# Gem::Installer does the work of putting files in all the right places on the
# filesystem including unpacking the gem into its gem dir, installing the
@@ -33,14 +33,13 @@ class Gem::Installer
ENV_PATHS = %w[/usr/bin/env /bin/env]
##
- # Raised when there is an error while building extensions.
- #
- class ExtensionBuildError < Gem::InstallError; end
+ # Deprecated in favor of Gem::Ext::BuildError
- include Gem::UserInteraction
+ ExtensionBuildError = Gem::Ext::BuildError # :nodoc:
- include Gem::RequirePathsBuilder if Gem::QUICKLOADER_SUCKAGE
+ include Gem::UserInteraction
+ # DOC: Missing docs or :nodoc:.
attr_reader :gem
##
@@ -67,6 +66,7 @@ class Gem::Installer
attr_accessor :path_warning
+ # DOC: Missing docs or :nodoc:.
attr_writer :exec_format
# Defaults to use Ruby's program prefix and suffix.
@@ -80,53 +80,117 @@ class Gem::Installer
# Constructs an Installer instance that will install the gem located at
# +gem+. +options+ is a Hash with the following keys:
#
+ # :bin_dir:: Where to put a bin wrapper if needed.
+ # :development:: Whether or not development dependencies should be installed.
# :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
+ # foo_exec18.
# :ignore_dependencies:: Don't raise if a dependency is missing.
# :install_dir:: The directory to install the gem into.
- # :format_executable:: Format the executable the same as the ruby executable.
- # If your ruby is ruby18, foo_exec will be installed as
- # foo_exec18.
# :security_policy:: Use the specified security policy. See Gem::Security
+ # :user_install:: Indicate that the gem should be unpacked into the users
+ # personal gem directory.
+ # :only_install_dir:: Only validate dependencies against what is in the
+ # install_dir
# :wrappers:: Install wrappers if true, symlinks if false.
+ # :build_args:: An Array of arguments to pass to the extension builder
+ # process. If not set, then Gem::Command.build_args is used
def initialize(gem, options={})
require 'fileutils'
@gem = gem
@options = options
+ @package = Gem::Package.new @gem
+
process_options
+ @package.security_policy = @security_policy
+
if options[:user_install] and not options[:unpack] then
@gem_home = Gem.user_dir
+ @bin_dir = Gem.bindir gem_home unless options[:bin_dir]
check_that_user_bin_dir_is_in_path
end
end
##
- # Lazy accessor for the spec's gem directory.
+ # Checks if +filename+ exists in +@bin_dir+.
+ #
+ # If +@force+ is set +filename+ is overwritten.
+ #
+ # If +filename+ exists and is a RubyGems wrapper for different gem the user
+ # is consulted.
+ #
+ # If +filename+ exists and +@bin_dir+ is Gem.default_bindir (/usr/local) the
+ # user is consulted.
+ #
+ # Otherwise +filename+ is overwritten.
- def gem_dir
- @gem_dir ||= spec.gem_dir.dup.untaint
+ def check_executable_overwrite filename # :nodoc:
+ return if @force
+
+ generated_bin = File.join @bin_dir, formatted_program_filename(filename)
+
+ return unless File.exist? generated_bin
+
+ ruby_executable = false
+ existing = nil
+
+ open generated_bin, 'rb' do |io|
+ next unless io.gets =~ /^#!/ # shebang
+ io.gets # blankline
+
+ # TODO detect a specially formatted comment instead of trying
+ # to run a regexp against Ruby code.
+ next unless io.gets =~ /This file was generated by RubyGems/
+
+ ruby_executable = true
+ existing = io.read.slice(/^gem (['"])(.*?)(\1),/, 2)
+ end
+
+ return if spec.name == existing
+
+ # somebody has written to RubyGems' directory, overwrite, too bad
+ return if Gem.default_bindir != @bin_dir and not ruby_executable
+
+ question = "#{spec.name}'s executable \"#{filename}\" conflicts with "
+
+ if ruby_executable then
+ question << existing
+
+ return if ask_yes_no "#{question}\nOverwrite the executable?", false
+
+ conflict = "installed executable from #{existing}"
+ else
+ question << generated_bin
+
+ return if ask_yes_no "#{question}\nOverwrite the executable?", false
+
+ conflict = generated_bin
+ end
+
+ raise Gem::InstallError,
+ "\"#{filename}\" from #{spec.name} conflicts with #{conflict}"
end
##
- # Lazy accessor for the installer's Gem::Format instance.
+ # Lazy accessor for the spec's gem directory.
- def format
- begin
- @format ||= Gem::Format.from_file_by_path gem, @security_policy
- rescue Gem::Package::FormatError
- raise Gem::InstallError, "invalid gem format for #{gem}"
- end
+ def gem_dir
+ @gem_dir ||= File.join(gem_home, "gems", spec.full_name)
end
##
# Lazy accessor for the installer's spec.
def spec
- @spec ||= format.spec
+ @spec ||= @package.spec
+ rescue Gem::Package::Error => e
+ raise Gem::InstallError, "invalid gem: #{e.message}"
end
##
@@ -141,48 +205,60 @@ class Gem::Installer
# specifications/<gem-version>.gemspec #=> the Gem::Specification
def install
- current_home = Gem.dir
- current_path = Gem.paths.path
+ pre_install_checks
- verify_gem_home(options[:unpack])
- Gem.use_paths gem_home, current_path # HACK: shouldn't need Gem.paths.path
+ run_pre_install_hooks
- # If we're forcing the install then disable security unless the security
- # policy says that we only install signed gems.
- @security_policy = nil if @force and @security_policy and
- not @security_policy.only_signed
+ # Completely remove any previous gem files
+ FileUtils.rm_rf gem_dir
+
+ FileUtils.mkdir_p gem_dir
- unless @force
- ensure_required_ruby_version_met
- ensure_required_rubygems_version_met
- ensure_dependencies_met unless @ignore_dependencies
+ spec.loaded_from = spec_file
+
+ if @options[:install_as_default]
+ extract_bin
+ write_default_spec
+ else
+ extract_files
+
+ build_extensions
+ write_build_info_file
+ run_post_build_hooks
+
+ generate_bin
+ write_spec
+ write_cache_file
end
- Gem.pre_install_hooks.each do |hook|
- result = hook.call self
+ say spec.post_install_message unless spec.post_install_message.nil?
+
+ Gem::Specification.add_spec spec unless Gem::Specification.include? spec
- if result == false then
+ run_post_install_hooks
+
+ spec
+
+ # TODO This rescue is in the wrong place. What is raising this exception?
+ # move this rescue to around the code that actually might raise it.
+ rescue Zlib::GzipFile::Error
+ raise Gem::InstallError, "gzip error installing #{gem}"
+ end
+
+ def run_pre_install_hooks # :nodoc:
+ Gem.pre_install_hooks.each do |hook|
+ if hook.call(self) == false then
location = " at #{$1}" if hook.inspect =~ /@(.*:\d+)/
message = "pre-install hook#{location} failed for #{spec.full_name}"
raise Gem::InstallError, message
end
end
+ end
- Gem.ensure_gem_subdirectories gem_home
-
- # Completely remove any previous gem files
- FileUtils.rm_rf(gem_dir) if File.exist? gem_dir
-
- FileUtils.mkdir_p gem_dir
-
- extract_files
- build_extensions
-
+ def run_post_build_hooks # :nodoc:
Gem.post_build_hooks.each do |hook|
- result = hook.call self
-
- if result == false then
+ if hook.call(self) == false then
FileUtils.rm_rf gem_dir
location = " at #{$1}" if hook.inspect =~ /@(.*:\d+)/
@@ -191,32 +267,29 @@ class Gem::Installer
raise Gem::InstallError, message
end
end
+ end
- generate_bin
- write_spec
-
- write_require_paths_file_if_needed if Gem::QUICKLOADER_SUCKAGE
-
- cache_file = spec.cache_file
- FileUtils.cp gem, cache_file unless File.exist? cache_file
-
- say spec.post_install_message unless spec.post_install_message.nil?
-
- spec.loaded_from = spec.spec_file
-
- Gem::Specification.add_spec spec unless Gem::Specification.include? spec
-
+ def run_post_install_hooks # :nodoc:
Gem.post_install_hooks.each do |hook|
hook.call self
end
+ end
- return spec
- rescue Zlib::GzipFile::Error
- raise Gem::InstallError, "gzip error installing #{gem}"
- ensure
- # conditional since we might be here because we're erroring out early.
- if current_path
- Gem.use_paths current_home, current_path
+ ##
+ #
+ # Return an Array of Specifications contained within the gem_home
+ # we'll be installing into.
+
+ def installed_specs
+ @specs ||= begin
+ specs = []
+
+ Dir[File.join(gem_home, "specifications", "*.gemspec")].each do |path|
+ spec = Gem::Specification.load path.untaint
+ specs << spec if spec
+ end
+
+ specs
end
end
@@ -235,9 +308,11 @@ class Gem::Installer
end
##
- # True if the gems in the source_index satisfy +dependency+.
+ # True if the gems in the system satisfy +dependency+.
def installation_satisfies_dependency?(dependency)
+ return true if installed_specs.detect { |s| dependency.matches_spec? s }
+ return false if @only_install_dir
not dependency.matching_specs.empty?
end
@@ -246,19 +321,46 @@ class Gem::Installer
def unpack(directory)
@gem_dir = directory
- @format = Gem::Format.from_file_by_path gem, @security_policy
extract_files
end
##
+ # The location of of the spec file that is installed.
+ #
+
+ def spec_file
+ File.join gem_home, "specifications", "#{spec.full_name}.gemspec"
+ 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
- file_name = spec.spec_file.untaint
+ open spec_file, 'w' do |file|
+ spec.installed_by_version = Gem.rubygems_version
- File.open(file_name, "w") do |file|
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
@@ -277,34 +379,34 @@ class Gem::Installer
end
end
+ # DOC: Missing docs or :nodoc:.
def generate_bin
return if spec.executables.nil? or spec.executables.empty?
- # If the user has asked for the gem to be installed in a directory that is
- # the system gem directory, then use the system bin directory, else create
- # (or use) a new bin dir under the gem_home.
- bindir = @bin_dir || Gem.bindir(gem_home)
-
- Dir.mkdir bindir unless File.exist? bindir
- raise Gem::FilePermissionError.new(bindir) unless File.writable? bindir
+ Dir.mkdir @bin_dir unless File.exist? @bin_dir
+ raise Gem::FilePermissionError.new(@bin_dir) unless File.writable? @bin_dir
spec.executables.each do |filename|
filename.untaint
- bin_path = File.expand_path File.join(gem_dir, spec.bindir, filename)
+ bin_path = File.join gem_dir, spec.bindir, filename
- unless File.exist? bin_path
- warn "Hey?!?! Where did #{bin_path} go??"
+ unless File.exist? bin_path then
+ # TODO change this to a more useful warning
+ warn "#{bin_path} maybe `gem pristine #{spec.name}` will fix it?"
next
end
mode = File.stat(bin_path).mode | 0111
FileUtils.chmod mode, bin_path
+ check_executable_overwrite filename
+
if @wrappers then
- generate_bin_script filename, bindir
+ generate_bin_script filename, @bin_dir
else
- generate_bin_symlink filename, bindir
+ generate_bin_symlink filename, @bin_dir
end
+
end
end
@@ -358,10 +460,21 @@ class Gem::Installer
##
# Generates a #! line for +bin_file_name+'s wrapper copying arguments if
# necessary.
+ #
+ # If the :custom_shebang config is set, then it is used as a template
+ # for how to create the shebang used for to run a gem's executables.
+ #
+ # The template supports 4 expansions:
+ #
+ # $env the path to the unix env utility
+ # $ruby the path to the currently running ruby interpreter
+ # $exec the path to the gem's executable
+ # $name the name of the gem the executable is for
+ #
def shebang(bin_file_name)
ruby_name = Gem::ConfigMap[:ruby_install_name] if @env_shebang
- path = spec.bin_file bin_file_name
+ path = File.join gem_dir, spec.bindir, bin_file_name
first_line = File.open(path, "rb") {|file| file.gets}
if /\A#!/ =~ first_line then
@@ -371,7 +484,25 @@ class Gem::Installer
shebang.strip! # Avoid nasty ^M issues.
end
- if not ruby_name then
+ 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(/\$(\w+)/) do
+ case $1
+ when "env"
+ @env_path ||= ENV_PATHS.find {|env_path| File.executable? env_path }
+ when "ruby"
+ "#{Gem.ruby}#{opts}"
+ when "exec"
+ bin_file_name
+ when "name"
+ spec.name
+ end
+ end
+
+ "#!#{which}"
+ elsif not ruby_name then
"#!#{Gem.ruby}#{opts}"
elsif opts then
"#!/bin/sh\n'exec' #{ruby_name.dump} '-x' \"$0\" \"$@\"\n#{shebang}"
@@ -382,6 +513,23 @@ class Gem::Installer
end
end
+ ##
+ # Ensures the Gem::Specification written out for this gem is loadable upon
+ # installation.
+
+ def ensure_loadable_spec
+ ruby = spec.to_ruby_for_cache
+ ruby.untaint
+
+ begin
+ eval ruby
+ rescue StandardError, SyntaxError => e
+ raise Gem::InstallError,
+ "The specification for #{spec.full_name} is corrupt (#{e.class})"
+ end
+ end
+
+ # DOC: Missing docs or :nodoc:.
def ensure_required_ruby_version_met
if rrv = spec.required_ruby_version then
unless rrv.satisfied_by? Gem.ruby_version then
@@ -390,9 +538,10 @@ class Gem::Installer
end
end
+ # DOC: Missing docs or :nodoc:.
def ensure_required_rubygems_version_met
if rrgv = spec.required_rubygems_version then
- unless rrgv.satisfied_by? Gem::Version.new(Gem::VERSION) then
+ unless rrgv.satisfied_by? Gem.rubygems_version then
raise Gem::InstallError,
"#{spec.name} requires RubyGems version #{rrgv}. " +
"Try 'gem update --system' to update RubyGems itself."
@@ -400,6 +549,7 @@ class Gem::Installer
end
end
+ # DOC: Missing docs or :nodoc:.
def ensure_dependencies_met
deps = spec.runtime_dependencies
deps |= spec.development_dependencies if @development
@@ -409,32 +559,40 @@ class Gem::Installer
end
end
+ # DOC: Missing docs or :nodoc:.
def process_options
@options = {
:bin_dir => nil,
:env_shebang => false,
- :exec_format => 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]
@wrappers = options[:wrappers]
- @bin_dir = options[:bin_dir]
+ @only_install_dir = options[:only_install_dir]
+
+ # If the user has asked for the gem to be installed in a directory that is
+ # the system gem directory, then use the system bin directory, else create
+ # (or use) a new bin dir under the gem_home.
+ @bin_dir = options[:bin_dir] || Gem.bindir(gem_home)
@development = options[:development]
- raise "NOTE: Installer option :source_index is dead" if
- options[:source_index]
+ @build_args = options[:build_args] || Gem::Command.build_args
end
+ # DOC: Missing docs or :nodoc:.
def check_that_user_bin_dir_is_in_path
user_bin_dir = @bin_dir || Gem.bindir(gem_home)
- user_bin_dir.gsub!(File::SEPARATOR, File::ALT_SEPARATOR) if File::ALT_SEPARATOR
+ user_bin_dir = user_bin_dir.gsub(File::SEPARATOR, File::ALT_SEPARATOR) if
+ File::ALT_SEPARATOR
+
path = ENV['PATH']
if Gem.win_platform? then
path = path.downcase
@@ -449,6 +607,7 @@ class Gem::Installer
end
end
+ # DOC: Missing docs or :nodoc:.
def verify_gem_home(unpack = false)
FileUtils.mkdir_p gem_home
raise Gem::FilePermissionError, gem_home unless
@@ -487,7 +646,7 @@ 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('"')
@@ -499,7 +658,6 @@ GOTO :EOF
:WinNT
@"#{ruby}" "%~dpn0" %*
TEXT
-
end
##
@@ -507,61 +665,20 @@ TEXT
# configure scripts and rakefiles or mkrf_conf files.
def build_extensions
- return if spec.extensions.empty?
- say "Building native extensions. This could take a while..."
- 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 = []
-
- 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
- else
- results = ["No builder for extension '#{extension}'"]
- nil
- end
-
-
- extension_dir = begin
- File.join gem_dir, File.dirname(extension)
- rescue TypeError # extension == nil
- gem_dir
- end
-
-
- begin
- Dir.chdir extension_dir do
- results = builder.build(extension, gem_dir, dest_path, results)
-
- say results.join("\n") if Gem.configuration.really_verbose
- end
- rescue
- results = results.join "\n"
-
- gem_make_out = File.join extension_dir, 'gem_make.out'
+ builder = Gem::Ext::Builder.new spec, @build_args
- open gem_make_out, 'wb' do |io| io.puts results end
-
- message = <<-EOF
-ERROR: Failed to build gem native extension.
+ builder.build_extensions
+ end
- #{results}
+ ##
+ # 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
- end
- end
+ builder.build_error build_dir, output, backtrace
end
##
@@ -570,36 +687,16 @@ EOF
# Ensures that files can't be installed outside the gem directory.
def extract_files
- raise ArgumentError, "format required to extract from" if @format.nil?
-
- @format.file_entries.each do |entry, file_data|
- path = entry['path'].untaint
-
- if path.start_with? "/" then # for extra sanity
- raise Gem::InstallError, "attempt to install file into #{entry['path']}"
- end
-
- path = File.expand_path File.join(gem_dir, path)
-
- unless path.start_with? gem_dir then
- msg = "attempt to install file into %p under %s" %
- [entry['path'], gem_dir]
- raise Gem::InstallError, msg
- end
-
- FileUtils.rm_rf(path) if File.exist? path
-
- dir = File.dirname path
- FileUtils.mkdir_p dir unless File.exist? dir
-
- File.open(path, "wb") do |out|
- out.write file_data
- end
+ @package.extract_files gem_dir
+ end
- FileUtils.chmod entry['mode'], path
+ ##
+ # 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.
- say path if Gem.configuration.really_verbose
- end
+ def extract_bin
+ @package.extract_files gem_dir, "bin/*"
end
##
@@ -622,5 +719,69 @@ EOF
def dir
gem_dir.to_s
end
+
+ ##
+ # Performs various checks before installing the gem such as the install
+ # 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.
+ #
+ # The dependent check will be skipped this install is ignoring dependencies.
+
+ def pre_install_checks
+ verify_gem_home options[:unpack]
+
+ # If we're forcing the install then disable security unless the security
+ # policy says that we only install signed gems.
+ @security_policy = nil if
+ @force and @security_policy and not @security_policy.only_signed
+
+ ensure_loadable_spec
+
+ if options[:install_as_default]
+ Gem.ensure_default_gem_subdirectories gem_home
+ else
+ Gem.ensure_gem_subdirectories gem_home
+ end
+
+ return true if @force
+
+ ensure_required_ruby_version_met
+ ensure_required_rubygems_version_met
+ ensure_dependencies_met unless @ignore_dependencies
+
+ true
+ end
+
+ ##
+ # Writes the file containing the arguments for building this gem's
+ # extensions.
+
+ def write_build_info_file
+ return if @build_args.empty?
+
+ build_info_dir = File.join gem_home, 'build_info'
+
+ FileUtils.mkdir_p build_info_dir
+
+ build_info_file = File.join build_info_dir, "#{spec.full_name}.info"
+
+ open build_info_file, 'w' do |io|
+ @build_args.each do |arg|
+ io.puts arg
+ end
+ end
+ end
+
+ ##
+ # Writes the .gem file to the cache directory
+
+ def write_cache_file
+ cache_file = File.join gem_home, 'cache', spec.file_name
+
+ FileUtils.cp @gem, cache_file unless File.exist? cache_file
+ end
+
end
diff --git a/lib/rubygems/installer_test_case.rb b/lib/rubygems/installer_test_case.rb
index 96a5156995..62a468a8a2 100644
--- a/lib/rubygems/installer_test_case.rb
+++ b/lib/rubygems/installer_test_case.rb
@@ -6,11 +6,26 @@ class Gem::Installer
##
# Available through requiring rubygems/installer_test_case
+ attr_writer :bin_dir
+
+ ##
+ # Available through requiring rubygems/installer_test_case
+
+ attr_writer :build_args
+
+ ##
+ # Available through requiring rubygems/installer_test_case
+
attr_writer :gem_dir
##
# Available through requiring rubygems/installer_test_case
+ attr_writer :force
+
+ ##
+ # Available through requiring rubygems/installer_test_case
+
attr_writer :format
##
@@ -54,47 +69,68 @@ end
class Gem::InstallerTestCase < Gem::TestCase
+ ##
+ # Creates the following instance variables:
+ #
+ # @spec::
+ # a spec named 'a', intended for regular installs
+ # @user_spec::
+ # a spec named 'b', intended for user installs
+
+ # @gem::
+ # the path to a built gem from @spec
+ # @user_spec::
+ # the path to a built gem from @user_spec
+ #
+ # @installer::
+ # a Gem::Installer for the @spec that installs into @gemhome
+ # @user_installer::
+ # a Gem::Installer for the @user_spec that installs into Gem.user_dir
+
def setup
super
- @installer_tmp = File.join @tempdir, 'installer'
- FileUtils.mkdir_p @installer_tmp
+ @spec = quick_gem 'a' do |spec|
+ util_make_exec spec
+ end
- Gem.use_paths @installer_tmp
- Gem.ensure_gem_subdirectories @installer_tmp
+ @user_spec = quick_gem 'b' do |spec|
+ util_make_exec spec
+ end
- @spec = quick_gem 'a'
- util_make_exec @spec
util_build_gem @spec
- @gem = @spec.cache_file
-
- @user_spec = quick_gem 'b'
- util_make_exec @user_spec
util_build_gem @user_spec
- @user_gem = @user_spec.cache_file
- Gem.use_paths @gemhome
+ @gem = @spec.cache_file
+ @user_gem = @user_spec.cache_file
@installer = util_installer @spec, @gemhome
@user_installer = util_installer @user_spec, Gem.user_dir, :user
-
- Gem.use_paths @gemhome
end
- def util_gem_bindir spec = @spec
+ def util_gem_bindir spec = @spec # :nodoc:
# TODO: deprecate
spec.bin_dir
end
- def util_gem_dir spec = @spec
+ def util_gem_dir spec = @spec # :nodoc:
# TODO: deprecate
spec.gem_dir
end
+ ##
+ # The path where installed executables live
+
def util_inst_bindir
File.join @gemhome, "bin"
end
+ ##
+ # Adds an executable named "executable" to +spec+ with the given +shebang+.
+ #
+ # The executable is also written to the bin dir in @tmpdir and the installed
+ # gem directory for +spec+.
+
def util_make_exec(spec = @spec, shebang = "#!/usr/bin/ruby")
spec.executables = %w[executable]
spec.files << 'bin/executable'
@@ -110,6 +146,14 @@ class Gem::InstallerTestCase < Gem::TestCase
end
end
+ ##
+ # Builds the @spec gem and returns an installer for it. The built gem
+ # includes:
+ #
+ # bin/executable
+ # lib/code.rb
+ # ext/a/mkrf_conf.rb
+
def util_setup_gem(ui = @ui) # HACK fix use_ui to make this automatic
@spec.files << File.join('lib', 'code.rb')
@spec.extensions << File.join('ext', 'a', 'mkrf_conf.rb')
@@ -129,16 +173,24 @@ class Gem::InstallerTestCase < Gem::TestCase
end
use_ui ui do
- FileUtils.rm @gem
+ FileUtils.rm_f @gem
- @gem = Gem::Builder.new(@spec).build
+ @gem = Gem::Package.build @spec
end
end
@installer = Gem::Installer.new @gem
end
+ ##
+ # Creates an installer for +spec+ that will install into +gem_home+. If
+ # +user+ is true a user-install will be performed.
+
def util_installer(spec, gem_home, user=false)
- Gem::Installer.new spec.cache_file, :user_install => user
+ Gem::Installer.new(spec.cache_file,
+ :install_dir => gem_home,
+ :user_install => user)
end
+
end
+
diff --git a/lib/rubygems/mock_gem_ui.rb b/lib/rubygems/mock_gem_ui.rb
index 13f0bf564b..76a9389676 100644
--- a/lib/rubygems/mock_gem_ui.rb
+++ b/lib/rubygems/mock_gem_ui.rb
@@ -6,6 +6,17 @@ require 'rubygems/user_interaction'
# retrieval during tests.
class Gem::MockGemUi < Gem::StreamUI
+ ##
+ # Raised when you haven't provided enough input to your MockGemUi
+
+ class InputEOFError < RuntimeError
+
+ def initialize question
+ super "Out of input for MockGemUi on #{question.inspect}"
+ end
+
+ end
+
class TermError < RuntimeError
attr_reader :exit_code
@@ -44,6 +55,12 @@ class Gem::MockGemUi < Gem::StreamUI
@terminated = false
end
+ def ask question
+ raise InputEOFError, question if @ins.eof?
+
+ super
+ end
+
def input
@ins.string
end
diff --git a/lib/rubygems/name_tuple.rb b/lib/rubygems/name_tuple.rb
new file mode 100644
index 0000000000..f16ab369fa
--- /dev/null
+++ b/lib/rubygems/name_tuple.rb
@@ -0,0 +1,121 @@
+##
+#
+# Represents a gem of name +name+ at +version+ of +platform+. These
+# wrap the data returned from the indexes.
+
+require 'rubygems/platform'
+
+class Gem::NameTuple
+ def initialize(name, version, platform="ruby")
+ @name = name
+ @version = version
+
+ unless platform.kind_of? Gem::Platform
+ platform = "ruby" if !platform or platform.empty?
+ end
+
+ @platform = platform
+ end
+
+ attr_reader :name, :version, :platform
+
+ ##
+ # Turn an array of [name, version, platform] into an array of
+ # NameTuple objects.
+
+ def self.from_list list
+ list.map { |t| new(*t) }
+ end
+
+ ##
+ # Turn an array of NameTuple objects back into an array of
+ # [name, version, platform] tuples.
+
+ def self.to_basic list
+ list.map { |t| t.to_a }
+ end
+
+ ##
+ # A null NameTuple, ie name=nil, version=0
+
+ def self.null
+ new nil, Gem::Version.new(0), nil
+ 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
+ end
+
+ ##
+ # Indicate if this NameTuple matches the current platform.
+
+ def match_platform?
+ Gem::Platform.match @platform
+ end
+
+ ##
+ # Indicate if this NameTuple is for a prerelease version.
+ def prerelease?
+ @version.prerelease?
+ end
+
+ ##
+ # Return the name that the gemspec file would be
+
+ def spec_name
+ "#{full_name}.gemspec"
+ end
+
+ ##
+ # Convert back to the [name, version, platform] tuple
+
+ def to_a
+ [@name, @version, @platform]
+ end
+
+ def inspect # :nodoc:
+ "#<Gem::NameTuple #{@name}, #{@version}, #{@platform}>"
+ end
+
+ alias to_s inspect # :nodoc:
+
+ def <=> other
+ to_a <=> other.to_a
+ end
+
+ include Comparable
+
+ ##
+ # Compare with +other+. Supports another NameTuple or an Array
+ # in the [name, version, platform] format.
+
+ def == other
+ case other
+ when self.class
+ @name == other.name and
+ @version == other.version and
+ @platform == other.platform
+ when Array
+ to_a == other
+ else
+ false
+ end
+ end
+
+ alias_method :eql?, :==
+
+ def hash
+ to_a.hash
+ end
+
+end
diff --git a/lib/rubygems/old_format.rb b/lib/rubygems/old_format.rb
deleted file mode 100644
index a44fd533a5..0000000000
--- a/lib/rubygems/old_format.rb
+++ /dev/null
@@ -1,153 +0,0 @@
-#--
-# Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others.
-# All rights reserved.
-# See LICENSE.txt for permissions.
-#++
-
-require 'rubygems'
-
-##
-# The format class knows the guts of the RubyGem .gem file format and provides
-# the capability to read gem files
-
-class Gem::OldFormat
-
- attr_accessor :spec, :file_entries, :gem_path
-
- ##
- # Constructs an instance of a Format object, representing the gem's data
- # structure.
- #
- # gem:: [String] The file name of the gem
-
- def initialize(gem_path)
- require 'fileutils'
- require 'zlib'
- Gem.load_yaml
-
- @gem_path = gem_path
- end
-
- ##
- # Reads the named gem file and returns a Format object, representing the
- # data from the gem file
- #
- # file_path:: [String] Path to the gem file
-
- def self.from_file_by_path(file_path)
- unless File.exist?(file_path)
- raise Gem::Exception, "Cannot load gem file [#{file_path}]"
- end
-
- File.open(file_path, 'rb') do |file|
- from_io(file, file_path)
- end
- end
-
- ##
- # Reads a gem from an io stream and returns a Format object, representing
- # the data from the gem file
- #
- # io:: [IO] Stream from which to read the gem
-
- def self.from_io(io, gem_path="(io)")
- format = self.new(gem_path)
- skip_ruby(io)
- format.spec = read_spec(io)
- format.file_entries = []
- read_files_from_gem(io) do |entry, file_data|
- format.file_entries << [entry, file_data]
- end
- format
- end
-
- private
-
- ##
- # Skips the Ruby self-install header. After calling this method, the
- # IO index will be set after the Ruby code.
- #
- # file:: [IO] The IO to process (skip the Ruby code)
-
- def self.skip_ruby(file)
- end_seen = false
- loop {
- line = file.gets
- if(line == nil || line.chomp == "__END__") then
- end_seen = true
- break
- end
- }
-
- if end_seen == false then
- raise Gem::Exception.new("Failed to find end of ruby script while reading gem")
- end
- end
-
- ##
- # Reads the specification YAML from the supplied IO and constructs
- # a Gem::Specification from it. After calling this method, the
- # IO index will be set after the specification header.
- #
- # file:: [IO] The IO to process
-
- def self.read_spec(file)
- yaml = ''
-
- read_until_dashes file do |line|
- yaml << line
- end
-
- Gem::Specification.from_yaml yaml
- rescue YAML::Error => e
- raise Gem::Exception, "Failed to parse gem specification out of gem file"
- rescue ArgumentError => e
- raise Gem::Exception, "Failed to parse gem specification out of gem file"
- end
-
- ##
- # Reads lines from the supplied IO until a end-of-yaml (---) is
- # reached
- #
- # file:: [IO] The IO to process
- # block:: [String] The read line
-
- def self.read_until_dashes(file)
- while((line = file.gets) && line.chomp.strip != "---") do
- yield line
- end
- end
-
- ##
- # Reads the embedded file data from a gem file, yielding an entry
- # containing metadata about the file and the file contents themselves
- # for each file that's archived in the gem.
- # NOTE: Many of these methods should be extracted into some kind of
- # Gem file read/writer
- #
- # gem_file:: [IO] The IO to process
-
- def self.read_files_from_gem(gem_file)
- errstr = "Error reading files from gem"
- header_yaml = ''
- begin
- self.read_until_dashes(gem_file) do |line|
- header_yaml << line
- end
- header = YAML.load(header_yaml)
- raise Gem::Exception, errstr unless header
-
- header.each do |entry|
- file_data = ''
- self.read_until_dashes(gem_file) do |line|
- file_data << line
- end
- yield [entry, Zlib::Inflate.inflate(file_data.strip.unpack("m")[0])]
- end
- rescue Zlib::DataError
- raise Gem::Exception, errstr
- end
- end
-
-end
-
diff --git a/lib/rubygems/package.rb b/lib/rubygems/package.rb
index 2b50c588ee..0ed6e1b91f 100644
--- a/lib/rubygems/package.rb
+++ b/lib/rubygems/package.rb
@@ -3,16 +3,54 @@
# Copyright (C) 2004 Mauricio Julio Fernández Pradier
# See LICENSE.txt for additional licensing information.
#++
+#
+# Example using a Gem::Package
+#
+# Builds a .gem file given a Gem::Specification. A .gem file is a tarball
+# which contains a data.tar.gz and metadata.gz, and possibly signatures.
+#
+# require 'rubygems'
+# require 'rubygems/package'
+#
+# spec = Gem::Specification.new do |s|
+# s.summary = "Ruby based make-like utility."
+# s.name = 'rake'
+# s.version = PKG_VERSION
+# s.requirements << 'none'
+# s.files = PKG_FILES
+# s.description = <<-EOF
+# Rake is a Make-like program implemented in Ruby. Tasks
+# and dependencies are specified in standard Ruby syntax.
+# EOF
+# end
+#
+# Gem::Package.build spec
+#
+# Reads a .gem file.
+#
+# require 'rubygems'
+# require 'rubygems/package'
+#
+# the_gem = Gem::Package.new(path_to_dot_gem)
+# the_gem.contents # get the files in the gem
+# the_gem.extract_files destination_directory # extract the gem into a directory
+# 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
+# #extract_files and #contents automatically call #verify
+require 'rubygems/security'
require 'rubygems/specification'
+require 'rubygems/user_interaction'
+require 'zlib'
-module Gem::Package
+class Gem::Package
+
+ include Gem::UserInteraction
+
+ class Error < Gem::Exception; end
- class Error < StandardError; end
- class NonSeekableIO < Error; end
- class ClosedIO < Error; end
- class BadCheckSum < Error; end
- class TooLongFileName < Error; end
class FormatError < Error
attr_reader :path
@@ -26,57 +64,536 @@ module Gem::Package
end
+ class PathError < Error
+ def initialize destination, destination_dir
+ super "installing into parent path %s of %s is not allowed" %
+ [destination, destination_dir]
+ end
+ end
+
+ class NonSeekableIO < Error; end
+
+ class TooLongFileName < Error; end
+
##
# Raised when a tar file is corrupt
class TarInvalidError < Error; end
- # FIX: zenspider said: does it really take an IO?
- # passed to a method called open?!? that seems stupid.
- def self.open(io, mode = "r", signer = nil, &block)
- tar_type = case mode
- when 'r' then TarInput
- when 'w' then TarOutput
- else
- raise "Unknown Package open mode"
- end
-
- tar_type.open(io, signer, &block)
- end
-
- def self.pack(src, destname, signer = nil)
- TarOutput.open(destname, signer) do |outp|
- dir_class.chdir(src) do
- outp.metadata = (file_class.read("RPA/metadata") rescue nil)
- find_class.find('.') do |entry|
- case
- when file_class.file?(entry)
- entry.sub!(%r{\./}, "")
- next if entry =~ /\ARPA\//
- stat = File.stat(entry)
- outp.add_file_simple(entry, stat.mode, stat.size) do |os|
- file_class.open(entry, "rb") do |f|
- os.write(f.read(4096)) until f.eof?
- end
- end
- when file_class.dir?(entry)
- entry.sub!(%r{\./}, "")
- next if entry == "RPA"
- outp.mkdir(entry, file_class.stat(entry).mode)
+ attr_accessor :build_time # :nodoc:
+
+ ##
+ # Checksums for the contents of the package
+
+ attr_reader :checksums
+
+ ##
+ # The files in this package. This is not the contents of the gem, just the
+ # files in the top-level container.
+
+ attr_reader :files
+
+ ##
+ # The security policy used for verifying the contents of this package.
+
+ attr_accessor :security_policy
+
+ ##
+ # Sets the Gem::Specification to use to build this package.
+
+ attr_writer :spec
+
+ def self.build spec, skip_validation=false
+ gem_file = spec.file_name
+
+ package = new gem_file
+ package.spec = spec
+ package.build skip_validation
+
+ gem_file
+ end
+
+ ##
+ # Creates a new Gem::Package for the file at +gem+.
+ #
+ # If +gem+ is an existing file in the old format a Gem::Package::Old will be
+ # returned.
+
+ def self.new gem
+ return super unless Gem::Package == self
+ return super unless File.exist? gem
+
+ start = File.read gem, 20
+
+ return super unless start
+ return super unless start.include? 'MD5SUM ='
+
+ Gem::Package::Old.new gem
+ end
+
+ ##
+ # Creates a new package that will read or write to the file +gem+.
+
+ def initialize gem # :notnew:
+ @gem = gem
+
+ @build_time = Time.now
+ @checksums = {}
+ @contents = nil
+ @digests = Hash.new { |h, algorithm| h[algorithm] = {} }
+ @files = nil
+ @security_policy = nil
+ @signatures = {}
+ @signer = nil
+ @spec = nil
+ end
+
+ ##
+ # Adds a checksum for each entry in the gem to checksums.yaml.gz.
+
+ def add_checksums tar
+ Gem.load_yaml
+
+ checksums_by_algorithm = Hash.new { |h, algorithm| h[algorithm] = {} }
+
+ @checksums.each do |name, digests|
+ digests.each do |algorithm, digest|
+ checksums_by_algorithm[algorithm][name] = digest.hexdigest
+ end
+ end
+
+ tar.add_file_signed 'checksums.yaml.gz', 0444, @signer do |io|
+ gzip_to io do |gz_io|
+ YAML.dump checksums_by_algorithm, gz_io
+ end
+ end
+ end
+
+ ##
+ # Adds the files listed in the packages's Gem::Specification to data.tar.gz
+ # and adds this file to the +tar+.
+
+ def add_contents tar # :nodoc:
+ digests = tar.add_file_signed 'data.tar.gz', 0444, @signer do |io|
+ gzip_to io do |gz_io|
+ Gem::Package::TarWriter.new gz_io do |data_tar|
+ add_files data_tar
+ end
+ end
+ end
+
+ @checksums['data.tar.gz'] = digests
+ end
+
+ ##
+ # Adds files included the package's Gem::Specification to the +tar+ file
+
+ def add_files tar # :nodoc:
+ @spec.files.each do |file|
+ stat = File.stat file
+
+ next unless stat.file?
+
+ tar.add_file_simple file, stat.mode, stat.size do |dst_io|
+ open file, 'rb' do |src_io|
+ dst_io.write src_io.read 16384 until src_io.eof?
+ end
+ end
+ end
+ end
+
+ ##
+ # Adds the package's Gem::Specification to the +tar+ file
+
+ def add_metadata tar # :nodoc:
+ digests = tar.add_file_signed 'metadata.gz', 0444, @signer do |io|
+ gzip_to io do |gz_io|
+ gz_io.write @spec.to_yaml
+ end
+ end
+
+ @checksums['metadata.gz'] = digests
+ end
+
+ ##
+ # Builds this package based on the specification set by #spec=
+
+ def build skip_validation = false
+ Gem.load_yaml
+ require 'rubygems/security'
+
+ @spec.mark_version
+ @spec.validate unless skip_validation
+
+ setup_signer
+
+ open @gem, 'wb' do |gem_io|
+ Gem::Package::TarWriter.new gem_io do |gem|
+ add_metadata gem
+ add_contents gem
+ add_checksums gem
+ end
+ end
+
+ say <<-EOM
+ Successfully built RubyGem
+ Name: #{@spec.name}
+ Version: #{@spec.version}
+ File: #{File.basename @spec.cache_file}
+EOM
+ ensure
+ @signer = nil
+ end
+
+ ##
+ # A list of file names contained in this gem
+
+ def contents
+ return @contents if @contents
+
+ verify unless @spec
+
+ @contents = []
+
+ open @gem, 'rb' do |io|
+ gem_tar = Gem::Package::TarReader.new io
+
+ gem_tar.each do |entry|
+ next unless entry.full_name == 'data.tar.gz'
+
+ open_tar_gz entry do |pkg_tar|
+ pkg_tar.each do |contents_entry|
+ @contents << contents_entry.full_name
+ end
+ end
+
+ return @contents
+ end
+ end
+ end
+
+ ##
+ # Creates a digest of the TarEntry +entry+ from the digest algorithm set by
+ # the security policy.
+
+ def digest entry # :nodoc:
+ algorithms = if @checksums then
+ @checksums.keys
+ else
+ [Gem::Security::DIGEST_NAME].compact
+ end
+
+ algorithms.each do |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?
+
+ entry.rewind
+
+ @digests[algorithm][entry.full_name] = digester
+ end
+
+ @digests
+ end
+
+ ##
+ # 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, pattern = "*"
+ verify unless @spec
+
+ FileUtils.mkdir_p destination_dir
+
+ open @gem, 'rb' 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, pattern
+
+ return # ignore further entries
+ end
+ end
+ end
+
+ ##
+ # Extracts all the files in the gzipped tar archive +io+ into
+ # +destination_dir+.
+ #
+ # 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, 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
+
+ mkdir_options = {}
+ mkdir_options[:mode] = entry.header.mode if entry.directory?
+ mkdir =
+ if entry.directory? then
+ destination
else
- raise "Don't know how to pack this yet!"
+ File.dirname destination
end
+
+ FileUtils.mkdir_p mkdir, mkdir_options
+
+ open destination, 'wb', entry.header.mode do |out|
+ out.write entry.read
+ end if entry.file?
+
+ say destination if Gem.configuration.really_verbose
+ end
+ end
+ end
+
+ ##
+ # Gzips content written to +gz_io+ to +io+.
+ #--
+ # Also sets the gzip modification time to the package build time to ease
+ # testing.
+
+ def gzip_to io # :yields: gz_io
+ gz_io = Zlib::GzipWriter.new io, Zlib::BEST_COMPRESSION
+ gz_io.mtime = @build_time
+
+ yield gz_io
+ ensure
+ gz_io.close
+ end
+
+ ##
+ # Returns the full path for installing +filename+.
+ #
+ # If +filename+ is not inside +destination_dir+ an exception is raised.
+
+ def install_location filename, destination_dir # :nodoc:
+ raise Gem::Package::PathError.new(filename, destination_dir) if
+ filename.start_with? '/'
+
+ 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
+
+ raise Gem::Package::PathError.new(destination, destination_dir) unless
+ destination.start_with? destination_dir
+
+ destination.untaint
+ destination
+ end
+
+ ##
+ # Loads a Gem::Specification from the TarEntry +entry+
+
+ def load_spec entry # :nodoc:
+ case entry.full_name
+ when 'metadata' then
+ @spec = Gem::Specification.from_yaml entry.read
+ when 'metadata.gz' then
+ args = [entry]
+ args << { :external_encoding => Encoding::UTF_8 } if
+ Object.const_defined?(:Encoding) &&
+ Zlib::GzipReader.method(:wrap).arity != 1
+
+ Zlib::GzipReader.wrap(*args) do |gzio|
+ @spec = Gem::Specification.from_yaml gzio.read
+ end
+ end
+ end
+
+ ##
+ # Opens +io+ as a gzipped tar archive
+
+ def open_tar_gz io # :nodoc:
+ Zlib::GzipReader.wrap io do |gzio|
+ tar = Gem::Package::TarReader.new gzio
+
+ yield tar
+ end
+ end
+
+ ##
+ # Reads and loads checksums.yaml.gz from the tar file +gem+
+
+ def read_checksums gem
+ Gem.load_yaml
+
+ @checksums = gem.seek 'checksums.yaml.gz' do |entry|
+ Zlib::GzipReader.wrap entry do |gz_io|
+ YAML.load gz_io.read
+ end
+ end
+ end
+
+ ##
+ # Prepares the gem for signing and checksum generation. If a signing
+ # 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, passphrase
+ @spec.signing_key = nil
+ @spec.cert_chain = @signer.cert_chain.map { |cert| cert.to_s }
+ else
+ @signer = Gem::Security::Signer.new nil, nil, passphrase
+ @spec.cert_chain = @signer.cert_chain.map { |cert| cert.to_pem } if
+ @signer.cert_chain
+ end
+ end
+
+ ##
+ # The spec for this gem.
+ #
+ # If this is a package for a built gem the spec is loaded from the
+ # gem and returned. If this is a package for a gem being built the provided
+ # spec is returned.
+
+ def spec
+ verify unless @spec
+
+ @spec
+ end
+
+ ##
+ # Verifies that this gem:
+ #
+ # * Contains a valid gem specification
+ # * Contains a contents archive
+ # * The contents archive is not corrupt
+ #
+ # After verification the gem specification from the gem is available from
+ # #spec
+
+ def verify
+ @files = []
+ @spec = nil
+
+ open @gem, 'rb' do |io|
+ Gem::Package::TarReader.new io do |reader|
+ read_checksums reader
+
+ verify_files reader
+ end
+ end
+
+ verify_checksums @digests, @checksums
+
+ @security_policy.verify_signatures @spec, @digests, @signatures if
+ @security_policy
+
+ true
+ rescue Gem::Security::Exception
+ @spec = nil
+ @files = []
+ raise
+ rescue Errno::ENOENT => e
+ raise Gem::Package::FormatError.new e.message
+ rescue Gem::Package::TarInvalidError => e
+ raise Gem::Package::FormatError.new e.message, @gem
+ end
+
+ ##
+ # Verifies the +checksums+ against the +digests+. This check is not
+ # cryptographically secure. Missing checksums are ignored.
+
+ def verify_checksums digests, checksums # :nodoc:
+ return unless checksums
+
+ checksums.sort.each do |algorithm, gem_digests|
+ gem_digests.sort.each do |file_name, gem_hexdigest|
+ computed_digest = digests[algorithm][file_name]
+
+ unless computed_digest.hexdigest == gem_hexdigest then
+ raise Gem::Package::FormatError.new \
+ "#{algorithm} checksum mismatch for #{file_name}", @gem
end
end
end
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|
+ verify_entry entry
+ end
+
+ unless @spec then
+ raise Gem::Package::FormatError.new 'package metadata is missing', @gem
+ end
+
+ unless @files.include? 'data.tar.gz' then
+ raise Gem::Package::FormatError.new \
+ 'package content (data.tar.gz) is missing', @gem
+ end
+ end
+
+ ##
+ # Verifies that +entry+ is a valid gzipped file.
+
+ def verify_gz entry # :nodoc:
+ Zlib::GzipReader.wrap entry do |gzio|
+ gzio.read 16384 until gzio.eof? # gzip checksum verification
+ end
+ rescue Zlib::GzipFile::Error => e
+ raise Gem::Package::FormatError.new(e.message, entry.full_name)
+ end
+
end
-require 'rubygems/package/f_sync_dir'
+require 'rubygems/package/digest_io'
+require 'rubygems/package/old'
require 'rubygems/package/tar_header'
-require 'rubygems/package/tar_input'
-require 'rubygems/package/tar_output'
require 'rubygems/package/tar_reader'
require 'rubygems/package/tar_reader/entry'
require 'rubygems/package/tar_writer'
diff --git a/lib/rubygems/package/digest_io.rb b/lib/rubygems/package/digest_io.rb
new file mode 100644
index 0000000000..f8bde0f557
--- /dev/null
+++ b/lib/rubygems/package/digest_io.rb
@@ -0,0 +1,64 @@
+##
+# IO wrapper that creates digests of contents written to the IO it wraps.
+
+class Gem::Package::DigestIO
+
+ ##
+ # Collected digests for wrapped writes.
+ #
+ # {
+ # 'SHA1' => #<OpenSSL::Digest: [...]>,
+ # 'SHA512' => #<OpenSSL::Digest: [...]>,
+ # }
+
+ attr_reader :digests
+
+ ##
+ # Wraps +io+ and updates digest for each of the digest algorithms in
+ # the +digests+ Hash. Returns the digests hash. Example:
+ #
+ # io = StringIO.new
+ # digests = {
+ # 'SHA1' => OpenSSL::Digest.new('SHA1'),
+ # 'SHA512' => OpenSSL::Digest.new('SHA512'),
+ # }
+ #
+ # Gem::Package::DigestIO.wrap io, digests do |digest_io|
+ # digest_io.write "hello"
+ # end
+ #
+ # digests['SHA1'].hexdigest #=> "aaf4c61d[...]"
+ # digests['SHA512'].hexdigest #=> "9b71d224[...]"
+
+ def self.wrap io, digests
+ digest_io = new io, digests
+
+ yield digest_io
+
+ return digests
+ end
+
+ ##
+ # Creates a new DigestIO instance. Using ::wrap is recommended, see the
+ # ::wrap documentation for documentation of +io+ and +digests+.
+
+ def initialize io, digests
+ @io = io
+ @digests = digests
+ end
+
+ ##
+ # Writes +data+ to the underlying IO and updates the digests
+
+ def write data
+ result = @io.write data
+
+ @digests.each do |_, digest|
+ digest << data
+ end
+
+ result
+ end
+
+end
+
diff --git a/lib/rubygems/package/f_sync_dir.rb b/lib/rubygems/package/f_sync_dir.rb
deleted file mode 100644
index f7eb7f3ce3..0000000000
--- a/lib/rubygems/package/f_sync_dir.rb
+++ /dev/null
@@ -1,23 +0,0 @@
-# -*- coding: utf-8 -*-
-#--
-# Copyright (C) 2004 Mauricio Julio Fernández Pradier
-# See LICENSE.txt for additional licensing information.
-#++
-
-module Gem::Package::FSyncDir
-
- private
-
- ##
- # make sure this hits the disc
-
- def fsync_dir(dirname)
- dir = open dirname, 'r'
- dir.fsync
- rescue # ignore IOError if it's an unpatched (old) Ruby
- ensure
- dir.close if dir rescue nil
- end
-
-end
-
diff --git a/lib/rubygems/package/old.rb b/lib/rubygems/package/old.rb
new file mode 100644
index 0000000000..d74753fa90
--- /dev/null
+++ b/lib/rubygems/package/old.rb
@@ -0,0 +1,178 @@
+#--
+# Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others.
+# All rights reserved.
+# See LICENSE.txt for permissions.
+#++
+
+##
+# The format class knows the guts of the ancient .gem file format and provides
+# the capability to read such ancient gems.
+#
+# Please pretend this doesn't exist.
+
+class Gem::Package::Old < Gem::Package
+
+ undef_method :spec=
+
+ ##
+ # Creates a new old-format package reader for +gem+. Old-format packages
+ # cannot be written.
+
+ def initialize gem
+ require 'fileutils'
+ require 'zlib'
+ Gem.load_yaml
+
+ @contents = nil
+ @gem = gem
+ @security_policy = nil
+ @spec = nil
+ end
+
+ ##
+ # A list of file names contained in this gem
+
+ def contents
+ verify
+
+ return @contents if @contents
+
+ open @gem, 'rb' do |io|
+ read_until_dashes io # spec
+ header = file_list io
+
+ @contents = header.map { |file| file['path'] }
+ end
+ end
+
+ ##
+ # Extracts the files in this package into +destination_dir+
+
+ def extract_files destination_dir
+ verify
+
+ errstr = "Error reading files from gem"
+
+ open @gem, 'rb' do |io|
+ read_until_dashes io # spec
+ header = file_list io
+ raise Gem::Exception, errstr unless header
+
+ header.each do |entry|
+ full_name = entry['path']
+
+ destination = install_location full_name, destination_dir
+
+ file_data = ''
+
+ read_until_dashes io do |line|
+ file_data << line
+ end
+
+ file_data = file_data.strip.unpack("m")[0]
+ file_data = Zlib::Inflate.inflate file_data
+
+ raise Gem::Package::FormatError, "#{full_name} in #{@gem} is corrupt" if
+ file_data.length != entry['size'].to_i
+
+ FileUtils.rm_rf destination
+
+ FileUtils.mkdir_p File.dirname destination
+
+ open destination, 'wb', entry['mode'] do |out|
+ out.write file_data
+ end
+
+ say destination if Gem.configuration.really_verbose
+ end
+ end
+ rescue Zlib::DataError
+ raise Gem::Exception, errstr
+ end
+
+ ##
+ # Reads the file list section from the old-format gem +io+
+
+ def file_list io # :nodoc:
+ header = ''
+
+ read_until_dashes io do |line|
+ header << line
+ end
+
+ YAML.load header
+ end
+
+ ##
+ # Reads lines until a "---" separator is found
+
+ def read_until_dashes io # :nodoc:
+ while (line = io.gets) && line.chomp.strip != "---" do
+ yield line if block_given?
+ end
+ end
+
+ ##
+ # Skips the Ruby self-install header in +io+.
+
+ def skip_ruby io # :nodoc:
+ loop do
+ line = io.gets
+
+ return if line.chomp == '__END__'
+ break unless line
+ end
+
+ raise Gem::Exception, "Failed to find end of ruby script while reading gem"
+ end
+
+ ##
+ # The specification for this gem
+
+ def spec
+ verify
+
+ return @spec if @spec
+
+ yaml = ''
+
+ open @gem, 'rb' do |io|
+ skip_ruby io
+ read_until_dashes io do |line|
+ yaml << line
+ end
+ end
+
+ yaml_error = if RUBY_VERSION < '1.9' then
+ YAML::ParseError
+ elsif YAML::ENGINE.yamler == 'syck' then
+ YAML::ParseError
+ else
+ YAML::SyntaxError
+ end
+
+ begin
+ @spec = Gem::Specification.from_yaml yaml
+ rescue yaml_error => e
+ raise Gem::Exception, "Failed to parse gem specification out of gem file"
+ end
+ rescue ArgumentError => e
+ raise Gem::Exception, "Failed to parse gem specification out of gem file"
+ end
+
+ ##
+ # Raises an exception if a security policy that verifies data is active.
+ # Old format gems cannot be verified as signed.
+
+ def verify
+ return true unless @security_policy
+
+ raise Gem::Security::Exception,
+ 'old format gems do not contain signatures and cannot be verified' if
+ @security_policy.verify_data
+
+ true
+ end
+
+end
+
diff --git a/lib/rubygems/package/tar_header.rb b/lib/rubygems/package/tar_header.rb
index 4f923b9b5e..28da1db0b5 100644
--- a/lib/rubygems/package/tar_header.rb
+++ b/lib/rubygems/package/tar_header.rb
@@ -102,61 +102,24 @@ class Gem::Package::TarHeader
fields = header.unpack UNPACK_FORMAT
- name = fields.shift
- mode = fields.shift.oct
- uid = fields.shift.oct
- gid = fields.shift.oct
- size = fields.shift.oct
- mtime = fields.shift.oct
- checksum = fields.shift.oct
- typeflag = fields.shift
- linkname = fields.shift
- magic = fields.shift
- version = fields.shift.oct
- uname = fields.shift
- gname = fields.shift
- devmajor = fields.shift.oct
- devminor = fields.shift.oct
- prefix = fields.shift
-
- new :name => name,
- :mode => mode,
- :uid => uid,
- :gid => gid,
- :size => size,
- :mtime => mtime,
- :checksum => checksum,
- :typeflag => typeflag,
- :linkname => linkname,
- :magic => magic,
- :version => version,
- :uname => uname,
- :gname => gname,
- :devmajor => devmajor,
- :devminor => devminor,
- :prefix => prefix,
-
- :empty => empty
-
- # HACK unfactor for Rubinius
- #new :name => fields.shift,
- # :mode => fields.shift.oct,
- # :uid => fields.shift.oct,
- # :gid => fields.shift.oct,
- # :size => fields.shift.oct,
- # :mtime => fields.shift.oct,
- # :checksum => fields.shift.oct,
- # :typeflag => fields.shift,
- # :linkname => fields.shift,
- # :magic => fields.shift,
- # :version => fields.shift.oct,
- # :uname => fields.shift,
- # :gname => fields.shift,
- # :devmajor => fields.shift.oct,
- # :devminor => fields.shift.oct,
- # :prefix => fields.shift,
-
- # :empty => empty
+ new :name => fields.shift,
+ :mode => fields.shift.oct,
+ :uid => fields.shift.oct,
+ :gid => fields.shift.oct,
+ :size => fields.shift.oct,
+ :mtime => fields.shift.oct,
+ :checksum => fields.shift.oct,
+ :typeflag => fields.shift,
+ :linkname => fields.shift,
+ :magic => fields.shift,
+ :version => fields.shift.oct,
+ :uname => fields.shift,
+ :gname => fields.shift,
+ :devmajor => fields.shift.oct,
+ :devminor => fields.shift.oct,
+ :prefix => fields.shift,
+
+ :empty => empty
end
##
diff --git a/lib/rubygems/package/tar_input.rb b/lib/rubygems/package/tar_input.rb
deleted file mode 100644
index 77b4d698da..0000000000
--- a/lib/rubygems/package/tar_input.rb
+++ /dev/null
@@ -1,235 +0,0 @@
-# -*- coding: iso-8859-1 -*-
-#++
-# Copyright (C) 2004 Mauricio Julio Fernández Pradier
-# See LICENSE.txt for additional licensing information.
-#--
-
-require 'zlib'
-Gem.load_yaml
-
-class Gem::Package::TarInput
-
- include Gem::Package::FSyncDir
- include Enumerable
-
- attr_reader :metadata
-
- private_class_method :new
-
- def self.open(io, security_policy = nil, &block)
- is = new io, security_policy
-
- yield is
- ensure
- is.close if is
- end
-
- def initialize(io, security_policy = nil)
- @io = io
- @tarreader = Gem::Package::TarReader.new @io
- has_meta = false
-
- data_sig, meta_sig, data_dgst, meta_dgst = nil, nil, nil, nil
- dgst_algo = security_policy ? Gem::Security::OPT[:dgst_algo] : nil
-
- @tarreader.each do |entry|
- case entry.full_name
- when "metadata"
- @metadata = load_gemspec entry.read
- has_meta = true
- when "metadata.gz"
- begin
- # if we have a security_policy, then pre-read the metadata file
- # and calculate it's digest
- sio = nil
- if security_policy
- Gem.ensure_ssl_available
- sio = StringIO.new(entry.read)
- meta_dgst = dgst_algo.digest(sio.string)
- sio.rewind
- end
-
- # Ruby 1.8 doesn't have encoding and YAML is UTF-8
- args = [sio || entry]
- args << { :external_encoding => Encoding::UTF_8 } if
- Object.const_defined?(:Encoding)
-
- gzis = Zlib::GzipReader.new(*args)
-
- # YAML wants an instance of IO
- @metadata = load_gemspec(gzis)
- has_meta = true
- ensure
- gzis.close unless gzis.nil?
- end
- when 'metadata.gz.sig'
- meta_sig = entry.read
- when 'data.tar.gz.sig'
- data_sig = entry.read
- when 'data.tar.gz'
- if security_policy
- Gem.ensure_ssl_available
- data_dgst = dgst_algo.digest(entry.read)
- end
- end
- end
-
- if security_policy then
- Gem.ensure_ssl_available
-
- # map trust policy from string to actual class (or a serialized YAML
- # file, if that exists)
- if String === security_policy then
- if Gem::Security::Policies.key? security_policy then
- # load one of the pre-defined security policies
- security_policy = Gem::Security::Policies[security_policy]
- elsif File.exist? security_policy then
- # FIXME: this doesn't work yet
- security_policy = YAML.load File.read(security_policy)
- else
- raise Gem::Exception, "Unknown trust policy '#{security_policy}'"
- end
- end
-
- if data_sig && data_dgst && meta_sig && meta_dgst then
- # the user has a trust policy, and we have a signed gem
- # file, so use the trust policy to verify the gem signature
-
- begin
- security_policy.verify_gem(data_sig, data_dgst, @metadata.cert_chain)
- rescue Exception => e
- raise "Couldn't verify data signature: #{e}"
- end
-
- begin
- security_policy.verify_gem(meta_sig, meta_dgst, @metadata.cert_chain)
- rescue Exception => e
- raise "Couldn't verify metadata signature: #{e}"
- end
- elsif security_policy.only_signed
- raise Gem::Exception, "Unsigned gem"
- else
- # FIXME: should display warning here (trust policy, but
- # either unsigned or badly signed gem file)
- end
- end
-
- @tarreader.rewind
-
- unless has_meta then
- path = io.path if io.respond_to? :path
- error = Gem::Package::FormatError.new 'no metadata found', path
- raise error
- end
- end
-
- def close
- @io.close
- @tarreader.close
- end
-
- def each(&block)
- @tarreader.each do |entry|
- next unless entry.full_name == "data.tar.gz"
- is = zipped_stream entry
-
- begin
- Gem::Package::TarReader.new is do |inner|
- inner.each(&block)
- end
- ensure
- is.close if is
- end
- end
-
- @tarreader.rewind
- end
-
- def extract_entry(destdir, entry, expected_md5sum = nil)
- if entry.directory? then
- dest = File.join destdir, entry.full_name
-
- if File.directory? dest then
- FileUtils.chmod entry.header.mode, dest, :verbose => false
- else
- FileUtils.mkdir_p dest, :mode => entry.header.mode, :verbose => false
- end
-
- fsync_dir dest
- fsync_dir File.join(dest, "..")
-
- return
- end
-
- # it's a file
- md5 = Digest::MD5.new if expected_md5sum
- destdir = File.join destdir, File.dirname(entry.full_name)
- FileUtils.mkdir_p destdir, :mode => 0755, :verbose => false
- destfile = File.join destdir, File.basename(entry.full_name)
- FileUtils.chmod 0600, destfile, :verbose => false rescue nil # Errno::ENOENT
-
- open destfile, "wb", entry.header.mode do |os|
- loop do
- data = entry.read 4096
- break unless data
- # HACK shouldn't we check the MD5 before writing to disk?
- md5 << data if expected_md5sum
- os.write(data)
- end
-
- os.fsync
- end
-
- FileUtils.chmod entry.header.mode, destfile, :verbose => false
- fsync_dir File.dirname(destfile)
- fsync_dir File.join(File.dirname(destfile), "..")
-
- if expected_md5sum && expected_md5sum != md5.hexdigest then
- raise Gem::Package::BadCheckSum
- end
- end
-
- # Attempt to YAML-load a gemspec from the given _io_ parameter. Return
- # nil if it fails.
- def load_gemspec(io)
- Gem::Specification.from_yaml io
- rescue Gem::Exception
- nil
- end
-
- ##
- # Return an IO stream for the zipped entry.
- #
- # NOTE: Originally this method used two approaches, Return a GZipReader
- # directly, or read the GZipReader into a string and return a StringIO on
- # the string. The string IO approach was used for versions of ZLib before
- # 1.2.1 to avoid buffer errors on windows machines. Then we found that
- # errors happened with 1.2.1 as well, so we changed the condition. Then
- # we discovered errors occurred with versions as late as 1.2.3. At this
- # point (after some benchmarking to show we weren't seriously crippling
- # the unpacking speed) we threw our hands in the air and declared that
- # this method would use the String IO approach on all platforms at all
- # times. And that's the way it is.
- #
- # Revisited. Here's the beginning of the long story.
- # http://osdir.com/ml/lang.ruby.gems.devel/2007-06/msg00045.html
- #
- # StringIO wraping has never worked as a workaround by definition. Skipping
- # initial 10 bytes and passing -MAX_WBITS to Zlib::Inflate luckily works as
- # gzip reader, but it only works if the GZip header is 10 bytes long (see
- # below) and it does not check inflated stream consistency (CRC value in the
- # Gzip trailer.)
- #
- # RubyGems generated Gzip Header: 10 bytes
- # magic(2) + method(1) + flag(1) + mtime(4) + exflag(1) + os(1) +
- # orig_name(0) + comment(0)
- #
- # Ideally, it must return a GZipReader without meaningless buffering. We
- # have lots of CRuby committers around so let's fix windows build when we
- # received an error.
- def zipped_stream(entry)
- Zlib::GzipReader.new entry
- end
-
-end
-
diff --git a/lib/rubygems/package/tar_output.rb b/lib/rubygems/package/tar_output.rb
deleted file mode 100644
index fdc8f4fb7c..0000000000
--- a/lib/rubygems/package/tar_output.rb
+++ /dev/null
@@ -1,146 +0,0 @@
-# -*- coding: utf-8 -*-
-#--
-# Copyright (C) 2004 Mauricio Julio Fernández Pradier
-# See LICENSE.txt for additional licensing information.
-#++
-
-##
-# TarOutput is a wrapper to TarWriter that builds gem-format tar file.
-#
-# Gem-format tar files contain the following files:
-# [data.tar.gz] A gzipped tar file containing the files that compose the gem
-# which will be extracted into the gem/ dir on installation.
-# [metadata.gz] A YAML format Gem::Specification.
-# [data.tar.gz.sig] A signature for the gem's data.tar.gz.
-# [metadata.gz.sig] A signature for the gem's metadata.gz.
-#
-# See TarOutput::open for usage details.
-
-class Gem::Package::TarOutput
-
- ##
- # Creates a new TarOutput which will yield a TarWriter object for the
- # data.tar.gz portion of a gem-format tar file.
- #
- # See #initialize for details on +io+ and +signer+.
- #
- # See #add_gem_contents for details on adding metadata to the tar file.
-
- def self.open(io, signer = nil, &block) # :yield: data_tar_writer
- tar_outputter = new io, signer
- tar_outputter.add_gem_contents(&block)
- tar_outputter.add_metadata
- tar_outputter.add_signatures
-
- ensure
- tar_outputter.close
- end
-
- ##
- # Creates a new TarOutput that will write a gem-format tar file to +io+. If
- # +signer+ is given, the data.tar.gz and metadata.gz will be signed and
- # the signatures will be added to the tar file.
-
- def initialize(io, signer)
- @io = io
- @signer = signer
-
- @tar_writer = Gem::Package::TarWriter.new @io
-
- @metadata = nil
-
- @data_signature = nil
- @meta_signature = nil
- end
-
- ##
- # Yields a TarWriter for the data.tar.gz inside a gem-format tar file.
- # The yielded TarWriter has been extended with a #metadata= method for
- # attaching a YAML format Gem::Specification which will be written by
- # add_metadata.
-
- def add_gem_contents
- @tar_writer.add_file "data.tar.gz", 0644 do |inner|
- sio = @signer ? StringIO.new : nil
- Zlib::GzipWriter.wrap(sio || inner) do |os|
-
- Gem::Package::TarWriter.new os do |data_tar_writer|
- # :stopdoc:
- def data_tar_writer.metadata() @metadata end
- def data_tar_writer.metadata=(metadata) @metadata = metadata end
- # :startdoc:
-
- yield data_tar_writer
-
- @metadata = data_tar_writer.metadata
- end
- end
-
- # if we have a signing key, then sign the data
- # digest and return the signature
- if @signer then
- require 'rubygems/security'
- digest = Gem::Security::OPT[:dgst_algo].digest sio.string
- @data_signature = @signer.sign digest
- inner.write sio.string
- end
- end
-
- self
- end
-
- ##
- # Adds metadata.gz to the gem-format tar file which was saved from a
- # previous #add_gem_contents call.
-
- def add_metadata
- return if @metadata.nil?
-
- @tar_writer.add_file "metadata.gz", 0644 do |io|
- begin
- sio = @signer ? StringIO.new : nil
- gzos = Zlib::GzipWriter.new(sio || io)
- gzos.write @metadata
- ensure
- gzos.flush
- gzos.finish
-
- # if we have a signing key, then sign the metadata digest and return
- # the signature
- if @signer then
- require 'rubygems/security'
- digest = Gem::Security::OPT[:dgst_algo].digest sio.string
- @meta_signature = @signer.sign digest
- io.write sio.string
- end
- end
- end
- end
-
- ##
- # Adds data.tar.gz.sig and metadata.gz.sig to the gem-format tar files if
- # a Gem::Security::Signer was sent to initialize.
-
- def add_signatures
- if @data_signature then
- @tar_writer.add_file 'data.tar.gz.sig', 0644 do |io|
- io.write @data_signature
- end
- end
-
- if @meta_signature then
- @tar_writer.add_file 'metadata.gz.sig', 0644 do |io|
- io.write @meta_signature
- end
- end
- end
-
- ##
- # Closes the TarOutput.
-
- def close
- @tar_writer.close
- end
-
-end
-
diff --git a/lib/rubygems/package/tar_reader.rb b/lib/rubygems/package/tar_reader.rb
index e6a71d386c..e257fdd846 100644
--- a/lib/rubygems/package/tar_reader.rb
+++ b/lib/rubygems/package/tar_reader.rb
@@ -9,7 +9,7 @@
class Gem::Package::TarReader
- include Gem::Package
+ include Enumerable
##
# Raised if the tar IO is not seekable
@@ -52,9 +52,9 @@ class Gem::Package::TarReader
# Iterates over files in the tarball yielding each entry
def each
- loop do
- return if @io.eof?
+ return enum_for __method__ unless block_given?
+ until @io.eof? do
header = Gem::Package::TarHeader.from @io
return if header.empty?
@@ -100,6 +100,23 @@ class Gem::Package::TarReader
end
end
+ ##
+ # Seeks through the tar file until it finds the +entry+ with +name+ and
+ # yields it. Rewinds the tar file to the beginning when the block
+ # terminates.
+
+ def seek name # :yields: entry
+ found = find do |entry|
+ entry.full_name == name
+ end
+
+ return unless found
+
+ return yield found
+ ensure
+ rewind
+ end
+
end
require 'rubygems/package/tar_reader/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 a73b5e5cab..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
@@ -40,12 +42,12 @@ class Gem::Package::TarWriter
# number of bytes will be more than #limit
def write(data)
- if data.size + @written > @limit
+ if data.bytesize + @written > @limit
raise FileOverflow, "You tried to feed more data than fits in the file."
end
@io.write data
- @written += data.size
- data.size
+ @written += data.bytesize
+ data.bytesize
end
end
@@ -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
@@ -130,6 +133,80 @@ class Gem::Package::TarWriter
end
##
+ # Adds +name+ with permissions +mode+ to the tar, yielding +io+ for writing
+ # the file. The +digest_algorithm+ is written to a read-only +name+.sum
+ # file following the given file contents containing the digest name and
+ # hexdigest separated by a tab.
+ #
+ # The created digest object is returned.
+
+ def add_file_digest name, mode, digest_algorithms # :yields: io
+ digests = digest_algorithms.map do |digest_algorithm|
+ digest = digest_algorithm.new
+ digest_name =
+ if digest.respond_to? :name then
+ digest.name
+ else
+ /::([^:]+)$/ =~ digest_algorithm.name
+ $1
+ end
+
+ [digest_name, digest]
+ end
+
+ digests = Hash[*digests.flatten]
+
+ add_file name, mode do |io|
+ Gem::Package::DigestIO.wrap io, digests do |digest_io|
+ yield digest_io
+ end
+ end
+
+ digests
+ end
+
+ ##
+ # Adds +name+ with permissions +mode+ to the tar, yielding +io+ for writing
+ # the file. The +signer+ is used to add a digest file using its
+ # digest_algorithm per add_file_digest and a cryptographic signature in
+ # +name+.sig. If the signer has no key only the checksum file is added.
+ #
+ # Returns the digest.
+
+ def add_file_signed name, mode, signer
+ digest_algorithms = [
+ signer.digest_algorithm,
+ Digest::SHA512,
+ ].compact.uniq
+
+ digests = add_file_digest name, mode, digest_algorithms do |io|
+ yield io
+ end
+
+ 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
+
+ if signer.key then
+ signature = signer.sign signature_digest.digest
+
+ add_file_simple "#{name}.sig", 0444, signature.length do |io|
+ io.write signature
+ end
+ end
+
+ digests
+ end
+
+ ##
# Add file +name+ with permissions +mode+ +size+ bytes long. Yields an IO
# to write the file to.
@@ -139,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
@@ -200,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
@@ -211,9 +290,9 @@ class Gem::Package::TarWriter
# Splits +name+ into a name and prefix that can fit in the TarHeader
def split_name(name) # :nodoc:
- raise Gem::Package::TooLongFileName if name.size > 256
+ raise Gem::Package::TooLongFileName if name.bytesize > 256
- if name.size <= 100 then
+ if name.bytesize <= 100 then
prefix = ""
else
parts = name.split(/\//)
@@ -222,14 +301,14 @@ class Gem::Package::TarWriter
loop do
nxt = parts.pop
- break if newname.size + 1 + nxt.size > 100
+ break if newname.bytesize + 1 + nxt.bytesize > 100
newname = nxt + "/" + newname
end
prefix = (parts + [nxt]).join "/"
name = newname
- if name.size > 100 or prefix.size > 155 then
+ if name.bytesize > 100 or prefix.bytesize > 155 then
raise Gem::Package::TooLongFileName
end
end
diff --git a/lib/rubygems/package_task.rb b/lib/rubygems/package_task.rb
index fe32a03b27..09384cc0e7 100644
--- a/lib/rubygems/package_task.rb
+++ b/lib/rubygems/package_task.rb
@@ -20,6 +20,7 @@
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
require 'rubygems'
+require 'rubygems/package'
begin
gem 'rake'
rescue Gem::LoadError
@@ -43,13 +44,10 @@ require 'rake/packagetask'
# require 'rubygems/package_task'
#
# spec = Gem::Specification.new do |s|
-# s.platform = Gem::Platform::RUBY
# s.summary = "Ruby based make-like utility."
# s.name = 'rake'
# s.version = PKG_VERSION
# s.requirements << 'none'
-# s.require_path = 'lib'
-# s.autorequire = 'rake'
# s.files = PKG_FILES
# s.description = <<-EOF
# Rake is a Make-like program implemented in Ruby. Tasks
@@ -98,12 +96,15 @@ class Gem::PackageTask < Rake::PackageTask
def define
super
- task :package => [:gem]
-
gem_file = File.basename gem_spec.cache_file
gem_path = File.join package_dir, gem_file
gem_dir = File.join package_dir, gem_spec.full_name
+ task :package => [:gem]
+
+ directory package_dir
+ directory gem_dir
+
desc "Build the gem file #{gem_file}"
task :gem => [gem_path]
@@ -113,7 +114,8 @@ class Gem::PackageTask < Rake::PackageTask
file gem_path => [package_dir, gem_dir] + @gem_spec.files do
chdir(gem_dir) do
when_writing "Creating #{gem_spec.file_name}" do
- Gem::Builder.new(gem_spec).build
+ Gem::Package.build gem_spec
+
verbose trace do
mv gem_file, '..'
end
diff --git a/lib/rubygems/path_support.rb b/lib/rubygems/path_support.rb
index 0aaf2c1bed..2af303eecf 100644
--- a/lib/rubygems/path_support.rb
+++ b/lib/rubygems/path_support.rb
@@ -1,4 +1,5 @@
##
+#
# Gem::PathSupport facilitates the GEM_HOME and GEM_PATH environment settings
# to the rest of RubyGems.
#
@@ -12,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.
@@ -27,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
@@ -42,16 +53,18 @@ class Gem::PathSupport
# Set the Gem search path (as reported by Gem.path).
def path=(gpaths)
- gem_path = [@home]
+ # FIX: it should be [home, *path], not [*path, home]
+
+ gem_path = []
# FIX: I can't tell wtf this is doing.
gpaths ||= (ENV['GEM_PATH'] || "").empty? ? nil : ENV["GEM_PATH"]
- if gpaths then
- if gpaths.kind_of?(Array) then
- gem_path.push(*gpaths)
+ if gpaths
+ if gpaths.kind_of?(Array)
+ gem_path = gpaths.dup
else
- gem_path.push(*gpaths.split(File::PATH_SEPARATOR))
+ gem_path = gpaths.split(Gem.path_separator)
end
if File::ALT_SEPARATOR then
@@ -59,10 +72,14 @@ class Gem::PathSupport
this_path.gsub File::ALT_SEPARATOR, File::SEPARATOR
end
end
+
+ gem_path << @home
else
- gem_path.push(*Gem.default_path)
+ gem_path = Gem.default_path + [@home]
- gem_path << APPLE_GEM_HOME if defined?(APPLE_GEM_HOME)
+ if defined?(APPLE_GEM_HOME)
+ gem_path << APPLE_GEM_HOME
+ end
end
@path = gem_path.uniq
diff --git a/lib/rubygems/platform.rb b/lib/rubygems/platform.rb
index 682714a5de..e050959dc6 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
@@ -21,11 +23,20 @@ class Gem::Platform
def self.match(platform)
Gem.platforms.any? do |local_platform|
- platform.nil? or local_platform == platform or
+ platform.nil? or
+ local_platform == platform or
(local_platform != Gem::Platform::RUBY and local_platform =~ 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
@@ -65,28 +76,29 @@ class Gem::Platform
@cpu, os = nil, cpu if os.nil? # legacy jruby
@os, @version = case os
- when /aix(\d+)/ then [ 'aix', $1 ]
- when /cygwin/ then [ 'cygwin', nil ]
- when /darwin(\d+)?/ then [ 'darwin', $1 ]
- when /^macruby$/ then [ 'macruby', nil ]
- when /freebsd(\d+)/ then [ 'freebsd', $1 ]
- when /hpux(\d+)/ then [ 'hpux', $1 ]
- when /^java$/, /^jruby$/ then [ 'java', nil ]
- when /^java([\d.]*)/ then [ 'java', $1 ]
- when /^dotnet$/ then [ 'dotnet', nil ]
- when /^dotnet([\d.]*)/ then [ 'dotnet', $1 ]
- when /linux/ then [ 'linux', $1 ]
- when /mingw32/ then [ 'mingw32', nil ]
+ when /aix(\d+)?/ then [ 'aix', $1 ]
+ when /cygwin/ then [ 'cygwin', nil ]
+ when /darwin(\d+)?/ then [ 'darwin', $1 ]
+ when /^macruby$/ then [ 'macruby', nil ]
+ when /freebsd(\d+)?/ then [ 'freebsd', $1 ]
+ when /hpux(\d+)?/ then [ 'hpux', $1 ]
+ when /^java$/, /^jruby$/ then [ 'java', nil ]
+ when /^java([\d.]*)/ then [ 'java', $1 ]
+ when /^dalvik(\d+)?$/ then [ 'dalvik', $1 ]
+ when /^dotnet$/ then [ 'dotnet', nil ]
+ when /^dotnet([\d.]*)/ then [ 'dotnet', $1 ]
+ when /linux/ then [ 'linux', $1 ]
+ when /mingw32/ then [ 'mingw32', nil ]
when /(mswin\d+)(\_(\d+))?/ then
os, version = $1, $3
@cpu = 'x86' if @cpu.nil? and os =~ /32$/
[os, version]
- when /netbsdelf/ then [ 'netbsdelf', nil ]
- when /openbsd(\d+\.\d+)/ then [ 'openbsd', $1 ]
- when /solaris(\d+\.\d+)/ then [ 'solaris', $1 ]
+ when /netbsdelf/ then [ 'netbsdelf', nil ]
+ when /openbsd(\d+\.\d+)?/ then [ 'openbsd', $1 ]
+ when /solaris(\d+\.\d+)?/ then [ 'solaris', $1 ]
# test
- when /^(\w+_platform)(\d+)/ then [ $1, $2 ]
- else [ 'unknown', nil ]
+ when /^(\w+_platform)(\d+)?/ then [ $1, $2 ]
+ else [ 'unknown', nil ]
end
when Gem::Platform then
@cpu = arch.cpu
@@ -109,10 +121,6 @@ class Gem::Platform
to_a.compact.join '-'
end
- def empty?
- to_s.empty?
- end
-
##
# Is +other+ equal to this platform? Two platforms are equal if they have
# the same CPU, OS and version.
@@ -131,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
@@ -158,6 +170,7 @@ class Gem::Platform
when /^i686-darwin(\d)/ then ['x86', 'darwin', $1 ]
when /^i\d86-linux/ then ['x86', 'linux', nil ]
when 'java', 'jruby' then [nil, 'java', nil ]
+ when /^dalvik(\d+)?$/ then [nil, 'dalvik', $1 ]
when /dotnet(\-(\d+\.\d+))?/ then ['universal','dotnet', $2 ]
when /mswin32(\_(\d+))?/ then ['x86', 'mswin32', $2 ]
when 'powerpc-darwin' then ['powerpc', 'darwin', nil ]
@@ -176,19 +189,15 @@ 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'
-
- extend Gem::Deprecate
-
- deprecate :empty?, :none, 2011, 11
end
diff --git a/lib/rubygems/psych_additions.rb b/lib/rubygems/psych_additions.rb
index 6a46bdaf3c..0e4ebbd50c 100644
--- a/lib/rubygems/psych_additions.rb
+++ b/lib/rubygems/psych_additions.rb
@@ -3,16 +3,7 @@
# in Specification._load, but if we don't have the constant, Marshal
# blows up.
-module Psych
- class PrivateType
- end
-end
-# This exists just to satify bugs in marshal'd gemspecs that
-# contain a reference to YAML::PrivateType. We prune these out
-# in Specification._load, but if we don't have the constant, Marshal
-# blows up.
-
-module Psych
- class PrivateType
+module Psych # :nodoc:
+ class PrivateType # :nodoc:
end
end
diff --git a/lib/rubygems/psych_tree.rb b/lib/rubygems/psych_tree.rb
index d73541e4f2..e3f1d1a08a 100644
--- a/lib/rubygems/psych_tree.rb
+++ b/lib/rubygems/psych_tree.rb
@@ -1,33 +1,10 @@
module Gem
if defined? ::Psych::Visitors
class NoAliasYAMLTree < Psych::Visitors::YAMLTree
- def visit_String(str)
- return super unless str == '=' # or whatever you want
-
- quote = Psych::Nodes::Scalar::SINGLE_QUOTED
- @emitter.scalar str, nil, nil, false, true, quote
- end
-
- # Noop this out so there are no anchors
- def register(target, obj)
- end
-
- # This is ported over from the yaml_tree in 1.9.3
- def format_time time
- if time.utc?
- time.strftime("%Y-%m-%d %H:%M:%S.%9N Z")
- else
- time.strftime("%Y-%m-%d %H:%M:%S.%9N %:z")
- end
- end
+ def self.create
+ new({})
+ end unless respond_to? :create
- private :format_time
- end
- end
-end
-module Gem
- if defined? ::Psych::Visitors
- class NoAliasYAMLTree < Psych::Visitors::YAMLTree
def visit_String(str)
return super unless str == '=' # or whatever you want
diff --git a/lib/rubygems/rdoc.rb b/lib/rubygems/rdoc.rb
new file mode 100644
index 0000000000..f16c8696f0
--- /dev/null
+++ b/lib/rubygems/rdoc.rb
@@ -0,0 +1,336 @@
+require 'rubygems'
+require 'rubygems/user_interaction'
+require 'fileutils'
+
+begin
+ gem 'rdoc'
+rescue Gem::LoadError
+ # swallow
+else
+ # This will force any deps that 'rdoc' might have
+ # (such as json) that are ambigious to be activated, which
+ # is important because we end up using Specification.reset
+ # and we don't want the warning it pops out.
+ Gem.finish_resolve
+end
+
+loaded_hook = false
+
+begin
+ require 'rdoc/rubygems_hook'
+ loaded_hook = true
+ module Gem
+ RDoc = RDoc::RubygemsHook
+ end
+rescue LoadError
+end
+
+##
+# Gem::RDoc provides methods to generate RDoc and ri data for installed gems.
+# It works for RDoc 1.0.1 (in Ruby 1.8) up to RDoc 3.6.
+#
+# This implementation is considered obsolete. The RDoc project is the
+# appropriate location to find this functionality. This file provides the
+# hooks to load RDoc generation code from the "rdoc" gem and a fallback in
+# case the installed version of RDoc does not have them.
+
+class Gem::RDoc # :nodoc: all
+
+ include Gem::UserInteraction
+ extend Gem::UserInteraction
+
+ @rdoc_version = nil
+ @specs = []
+
+ ##
+ # Force installation of documentation?
+
+ attr_accessor :force
+
+ ##
+ # Generate rdoc?
+
+ attr_accessor :generate_rdoc
+
+ ##
+ # Generate ri data?
+
+ attr_accessor :generate_ri
+
+ class << self
+
+ ##
+ # Loaded version of RDoc. Set by ::load_rdoc
+
+ attr_reader :rdoc_version
+
+ end
+
+ ##
+ # Post installs hook that generates documentation for each specification in
+ # +specs+
+
+ def self.generation_hook installer, specs
+ start = Time.now
+ types = installer.document
+
+ generate_rdoc = types.include? 'rdoc'
+ generate_ri = types.include? 'ri'
+
+ 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
+
+ ##
+ # Loads the RDoc generator
+
+ def self.load_rdoc
+ return if @rdoc_version
+
+ require 'rdoc/rdoc'
+
+ @rdoc_version = if ::RDoc.const_defined? :VERSION then
+ Gem::Version.new ::RDoc::VERSION
+ else
+ Gem::Version.new '1.0.1'
+ end
+
+ rescue LoadError => e
+ raise Gem::DocumentError, "RDoc is not installed: #{e}"
+ end
+
+ ##
+ # Creates a new documentation generator for +spec+. RDoc and ri data
+ # generation can be enabled or disabled through +generate_rdoc+ and
+ # +generate_ri+ respectively.
+ #
+ # Only +generate_ri+ is enabled by default.
+
+ def initialize spec, generate_rdoc = true, generate_ri = true
+ @doc_dir = spec.doc_dir
+ @file_info = nil
+ @force = false
+ @rdoc = nil
+ @spec = spec
+
+ @generate_rdoc = generate_rdoc
+ @generate_ri = generate_ri
+
+ @rdoc_dir = spec.doc_dir 'rdoc'
+ @ri_dir = spec.doc_dir 'ri'
+ end
+
+ ##
+ # Removes legacy rdoc arguments from +args+
+ #--
+ # TODO move to RDoc::Options
+
+ def delete_legacy_args args
+ args.delete '--inline-source'
+ args.delete '--promiscuous'
+ args.delete '-p'
+ args.delete '--one-file'
+ end
+
+ ##
+ # Generates documentation using the named +generator+ ("darkfish" or "ri")
+ # and following the given +options+.
+ #
+ # Documentation will be generated into +destination+
+
+ def document generator, options, destination
+ generator_name = generator
+
+ options = options.dup
+ options.exclude ||= [] # TODO maybe move to RDoc::Options#finish
+ options.setup_generator generator
+ options.op_dir = destination
+ options.finish
+
+ generator = options.generator.new @rdoc.store, options
+
+ @rdoc.options = options
+ @rdoc.generator = generator
+
+ say "Installing #{generator_name} documentation for #{@spec.full_name}"
+
+ FileUtils.mkdir_p options.op_dir
+
+ Dir.chdir options.op_dir do
+ begin
+ @rdoc.class.current = @rdoc
+ @rdoc.generator.generate @file_info
+ ensure
+ @rdoc.class.current = nil
+ end
+ end
+ end
+
+ ##
+ # Generates RDoc and ri data
+
+ def generate
+ return unless @generate_ri or @generate_rdoc
+
+ setup
+
+ options = nil
+
+ if Gem::Requirement.new('< 3').satisfied_by? self.class.rdoc_version then
+ generate_legacy
+ return
+ end
+
+ ::RDoc::TopLevel.reset # TODO ::RDoc::RDoc.reset
+ ::RDoc::Parser::C.reset
+
+ args = @spec.rdoc_options
+ args.concat @spec.require_paths
+ args.concat @spec.extra_rdoc_files
+
+ case config_args = Gem.configuration[:rdoc]
+ when String then
+ args = args.concat config_args.split
+ when Array then
+ args = args.concat config_args
+ end
+
+ delete_legacy_args args
+
+ Dir.chdir @spec.full_gem_path do
+ options = ::RDoc::Options.new
+ options.default_title = "#{@spec.full_name} Documentation"
+ options.parse args
+ end
+
+ options.quiet = !Gem.configuration.really_verbose
+
+ @rdoc = new_rdoc
+ @rdoc.options = options
+
+ say "Parsing documentation for #{@spec.full_name}"
+
+ Dir.chdir @spec.full_gem_path do
+ @file_info = @rdoc.parse_files options.files
+ end
+
+ document 'ri', options, @ri_dir if
+ @generate_ri and (@force or not File.exist? @ri_dir)
+
+ document 'darkfish', options, @rdoc_dir if
+ @generate_rdoc and (@force or not File.exist? @rdoc_dir)
+ end
+
+ ##
+ # Generates RDoc and ri data for legacy RDoc versions. This method will not
+ # exist in future versions.
+
+ def generate_legacy
+ if @generate_rdoc then
+ FileUtils.rm_rf @rdoc_dir
+ say "Installing RDoc documentation for #{@spec.full_name}"
+ legacy_rdoc '--op', @rdoc_dir
+ end
+
+ if @generate_ri then
+ FileUtils.rm_rf @ri_dir
+ say "Installing ri documentation for #{@spec.full_name}"
+ legacy_rdoc '--ri', '--op', @ri_dir
+ end
+ end
+
+ ##
+ # Generates RDoc using a legacy version of RDoc from the ARGV-like +args+.
+ # This method will not exist in future versions.
+
+ def legacy_rdoc *args
+ args << @spec.rdoc_options
+ args << '--quiet'
+ args << @spec.require_paths.clone
+ args << @spec.extra_rdoc_files
+ args << '--title' << "#{@spec.full_name} Documentation"
+ args = args.flatten.map do |arg| arg.to_s end
+
+ delete_legacy_args args if
+ Gem::Requirement.new('>= 2.4.0') =~ self.class.rdoc_version
+
+ r = new_rdoc
+ say "rdoc #{args.join ' '}" if Gem.configuration.really_verbose
+
+ Dir.chdir @spec.full_gem_path do
+ begin
+ r.document args
+ rescue Errno::EACCES => e
+ dirname = File.dirname e.message.split("-")[1].strip
+ raise Gem::FilePermissionError, dirname
+ rescue Interrupt => e
+ raise e
+ rescue Exception => ex
+ alert_error "While generating documentation for #{@spec.full_name}"
+ ui.errs.puts "... MESSAGE: #{ex}"
+ ui.errs.puts "... RDOC args: #{args.join(' ')}"
+ ui.backtrace ex
+ ui.errs.puts "(continuing with the rest of the installation)"
+ ensure
+ end
+ end
+ end
+
+ ##
+ # #new_rdoc creates a new RDoc instance. This method is provided only to
+ # make testing easier.
+
+ def new_rdoc # :nodoc:
+ ::RDoc::RDoc.new
+ end
+
+ ##
+ # Is rdoc documentation installed?
+
+ def rdoc_installed?
+ File.exist? @rdoc_dir
+ end
+
+ ##
+ # Removes generated RDoc and ri data
+
+ def remove
+ base_dir = @spec.base_dir
+
+ raise Gem::FilePermissionError, base_dir unless File.writable? base_dir
+
+ FileUtils.rm_rf @rdoc_dir
+ FileUtils.rm_rf @ri_dir
+ end
+
+ ##
+ # Is ri data installed?
+
+ def ri_installed?
+ File.exist? @ri_dir
+ end
+
+ ##
+ # Prepares the spec for documentation generation
+
+ def setup
+ self.class.load_rdoc
+
+ raise Gem::FilePermissionError, @doc_dir if
+ File.exist?(@doc_dir) and not File.writable?(@doc_dir)
+
+ FileUtils.mkdir_p @doc_dir unless File.exist? @doc_dir
+ end
+
+end unless loaded_hook
+
+Gem.done_installing(&Gem::RDoc.method(:generation_hook))
+
diff --git a/lib/rubygems/remote_fetcher.rb b/lib/rubygems/remote_fetcher.rb
index 9827e66f34..c6816e8f0f 100644
--- a/lib/rubygems/remote_fetcher.rb
+++ b/lib/rubygems/remote_fetcher.rb
@@ -1,6 +1,8 @@
require 'rubygems'
+require 'rubygems/request'
+require 'rubygems/uri_formatter'
require 'rubygems/user_interaction'
-require 'uri'
+require 'resolv'
##
# RemoteFetcher handles the details of fetching gems and gem information from
@@ -8,8 +10,6 @@ require 'uri'
class Gem::RemoteFetcher
- BuiltinSSLCerts = File.expand_path("./ssl_certs/*.pem", File.dirname(__FILE__))
-
include Gem::UserInteraction
##
@@ -34,6 +34,13 @@ class Gem::RemoteFetcher
end
+ ##
+ # A FetchError that indicates that the reason for not being
+ # able to fetch data was that the host could not be contacted
+
+ class UnknownHostError < FetchError
+ end
+
@fetcher = nil
##
@@ -53,8 +60,11 @@ class Gem::RemoteFetcher
# * nil: respect environment variables (HTTP_PROXY, HTTP_PROXY_USER,
# HTTP_PROXY_PASS)
# * <tt>:no_proxy</tt>: ignore environment variables and _don't_ use a proxy
+ #
+ # +dns+: An object to use for DNS resolution of the API endpoint.
+ # By default, use Resolv::DNS.
- def initialize(proxy = nil)
+ def initialize(proxy=nil, dns=Resolv::DNS.new)
require 'net/http'
require 'stringio'
require 'time'
@@ -62,16 +72,26 @@ class Gem::RemoteFetcher
Socket.do_not_reverse_lookup = true
- @connections = {}
- @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
+ @proxy = proxy
+
+ @dns = dns
+ end
+
+ ##
+ # Given a source at +uri+, calculate what hostname to actually
+ # connect to query the data for it.
+
+ def api_endpoint(uri)
+ host = uri.host
+
+ begin
+ res = @dns.getresource "_rubygems._tcp.#{host}",
+ Resolv::DNS::Resource::IN::SRV
+ rescue Resolv::ResolvError
+ uri
+ else
+ URI.parse "#{uri.scheme}://#{res.target}#{uri.path}"
+ end
end
##
@@ -82,14 +102,13 @@ class Gem::RemoteFetcher
# larger, more emcompassing effort. -erikh
def download_to_cache dependency
- found = Gem::SpecFetcher.fetcher.fetch dependency, true, true,
- dependency.prerelease?
+ found, _ = Gem::SpecFetcher.fetcher.spec_for_dependency dependency
return if found.empty?
- spec, source_uri = found.sort_by { |(s,_)| s.version }.last
+ spec, source = found.max_by { |(s,_)| s.version }
- download spec, source_uri
+ download spec, source.uri.to_s
end
##
@@ -98,13 +117,14 @@ class Gem::RemoteFetcher
# always replaced.
def download(spec, source_uri, install_dir = Gem.dir)
- Gem.ensure_gem_subdirectories(install_dir) rescue nil
-
- if File.writable?(install_dir)
- cache_dir = File.join install_dir, "cache"
- else
- cache_dir = File.join Gem.user_dir, "cache"
- end
+ cache_dir =
+ if Dir.pwd == install_dir then # see fetch_command
+ install_dir
+ elsif File.writable? install_dir then
+ File.join install_dir, "cache"
+ else
+ File.join Gem.user_dir, "cache"
+ end
gem_file_name = File.basename spec.cache_file
local_gem_path = File.join cache_dir, gem_file_name
@@ -123,6 +143,8 @@ class Gem::RemoteFetcher
# URI.parse gets confused by MS Windows paths with forward slashes.
scheme = nil if scheme =~ /^[a-z]$/i
+ # 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
unless File.exist? local_gem_path then
@@ -132,7 +154,7 @@ class Gem::RemoteFetcher
remote_gem_path = source_uri + "gems/#{gem_file_name}"
- gem = self.fetch_path remote_gem_path
+ self.cache_update_path remote_gem_path, local_gem_path
rescue Gem::RemoteFetcher::FetchError
raise if spec.original_platform == spec.platform
@@ -143,11 +165,7 @@ class Gem::RemoteFetcher
remote_gem_path = source_uri + "gems/#{alternate_name}"
- gem = self.fetch_path remote_gem_path
- end
-
- File.open local_gem_path, 'wb' do |fp|
- fp.write gem
+ self.cache_update_path remote_gem_path, local_gem_path
end
end
when 'file' then
@@ -172,11 +190,11 @@ 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
- File.expand_path(source_path) == File.expand_path(local_gem_path)
+ File.identical?(source_path, local_gem_path)
rescue Errno::EACCES
local_gem_path = source_uri.to_s
end
@@ -184,7 +202,7 @@ class Gem::RemoteFetcher
say "Using local gem #{local_gem_path}" if
Gem.configuration.really_verbose
else
- raise Gem::InstallError, "unsupported URI scheme #{source_uri.scheme}"
+ raise ArgumentError, "unsupported URI scheme #{source_uri.scheme}"
end
local_gem_path
@@ -232,131 +250,63 @@ class Gem::RemoteFetcher
uri = URI.parse uri unless URI::Generic === uri
raise ArgumentError, "bad uri: #{uri}" unless uri
- raise ArgumentError, "uri scheme is invalid: #{uri.scheme.inspect}" unless
- uri.scheme
+
+ unless uri.scheme
+ raise ArgumentError, "uri scheme is invalid: #{uri.scheme.inspect}"
+ end
data = send "fetch_#{uri.scheme}", uri, mtime, head
- data = Gem.gunzip data if data and not head and uri.to_s =~ /gz$/
+
+ if data and !head and uri.to_s =~ /gz$/
+ begin
+ data = Gem.gunzip data
+ rescue Zlib::GzipFile::Error
+ raise FetchError.new("server did not return a valid file", uri.to_s)
+ end
+ end
+
data
rescue FetchError
raise
rescue Timeout::Error
- raise FetchError.new('timed out', uri.to_s)
+ raise UnknownHostError.new('timed out', uri.to_s)
rescue IOError, SocketError, SystemCallError => e
- raise FetchError.new("#{e.class}: #{e}", uri.to_s)
- end
-
- ##
- # Returns the size of +uri+ in bytes.
-
- def fetch_size(uri) # TODO: phase this out
- response = fetch_path(uri, nil, true)
-
- response['content-length'].to_i
- 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 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(ENV['http_proxy_user'] || ENV['HTTP_PROXY_USER'])
- uri.password = escape(ENV['http_proxy_pass'] || ENV['HTTP_PROXY_PASS'])
+ if e.message =~ /getaddrinfo/
+ raise UnknownHostError.new('no such name', uri.to_s)
+ else
+ raise FetchError.new("#{e.class}: #{e}", uri.to_s)
end
-
- uri
end
##
- # Normalize the URI by adding "http://" if it is missing.
+ # Downloads +uri+ to +path+ if necessary. If no path is given, it just
+ # passes the data.
- def normalize_uri(uri)
- (uri =~ /^(https?|ftp|file):/) ? uri : "http://#{uri}"
- end
+ def cache_update_path uri, path = nil, update = true
+ mtime = path && File.stat(path).mtime rescue nil
- ##
- # 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 then
- net_http_args += [
- @proxy_uri.host,
- @proxy_uri.port,
- @proxy_uri.user,
- @proxy_uri.password
- ]
- end
+ if mtime && Net::HTTPNotModified === fetch_path(uri, mtime, true)
+ Gem.read_binary(path)
+ else
+ data = fetch_path(uri)
- connection_id = [Thread.current.object_id, *net_http_args].join ':'
- @connections[connection_id] ||= Net::HTTP.new(*net_http_args)
- connection = @connections[connection_id]
+ if update and path then
+ open(path, 'wb') do |io|
+ io.write data
+ end
+ end
- if https?(uri) and !connection.started? then
- configure_connection_for_https(connection)
+ data
end
-
- connection.start unless connection.started?
-
- connection
- rescue OpenSSL::SSL::SSLError, 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
+ ##
+ # Returns the size of +uri+ in bytes.
- connection.cert_store = store
- end
+ def fetch_size(uri) # TODO: phase this out
+ response = fetch_path(uri, nil, true)
- def add_rubygems_trusted_certs(store)
- Dir.glob(BuiltinSSLCerts).each do |ssl_cert_file|
- store.add_file ssl_cert_file
- end
+ response['content-length'].to_i
end
def correct_for_windows_path(path)
@@ -368,135 +318,16 @@ class Gem::RemoteFetcher
end
##
- # Read the data from the (source based) URI, but if it is a file:// URI,
- # read from the filesystem instead.
-
- def open_uri_or_path(uri, last_modified = nil, head = false, depth = 0)
- raise "NO: Use fetch_path instead"
- # TODO: deprecate for fetch_path
- 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
-
- 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, @proxy
- 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
-
- 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
-
- raise FetchError.new('too many connection resets', uri) if retried
-
- reset connection
-
- retried = true
- retry
- end
-
- response
- 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
def https?(uri)
diff --git a/lib/rubygems/request.rb b/lib/rubygems/request.rb
new file mode 100644
index 0000000000..e8707630c5
--- /dev/null
+++ b/lib/rubygems/request.rb
@@ -0,0 +1,274 @@
+require 'net/http'
+require 'thread'
+require 'time'
+require 'rubygems/user_interaction'
+
+class Gem::Request
+
+ include Gem::UserInteraction
+
+ attr_reader :proxy_uri
+
+ def initialize(uri, request_class, last_modified, proxy)
+ @uri = uri
+ @request_class = request_class
+ @last_modified = last_modified
+ @requests = Hash.new 0
+ @connections = {}
+ @connections_mutex = Mutex.new
+ @user_agent = user_agent
+
+ @proxy_uri =
+ case proxy
+ when :no_proxy then nil
+ when nil then get_proxy_from_env uri.scheme
+ when URI::HTTP then proxy
+ else URI.parse(proxy)
+ end
+ @env_no_proxy = get_no_proxy_from_env
+ end
+
+ def 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 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_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
+
+ 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
+
+ ##
+ # 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,
+ Gem::UriFormatter.new(@proxy_uri.user).unescape,
+ Gem::UriFormatter.new(@proxy_uri.password).unescape,
+ ]
+ end
+
+ connection_id = [Thread.current.object_id, *net_http_args].join ':'
+
+ connection = @connections_mutex.synchronize do
+ @connections[connection_id] ||= Net::HTTP.new(*net_http_args)
+ @connections[connection_id]
+ end
+
+ if https?(uri) and not connection.started? then
+ configure_connection_for_https(connection)
+ end
+
+ connection.start unless connection.started?
+
+ connection
+ rescue defined?(OpenSSL::SSL) ? OpenSSL::SSL::SSLError : Errno::EHOSTDOWN,
+ Errno::EHOSTDOWN => e
+ raise Gem::RemoteFetcher::FetchError.new(e.message, uri)
+ end
+
+ def fetch
+ request = @request_class.new @uri.request_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'
+
+ if @last_modified then
+ request.add_field 'If-Modified-Since', @last_modified.httpdate
+ 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 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]
+ say "connection reset after #{requests} requests, retrying" if
+ Gem.configuration.really_verbose
+
+ raise Gem::RemoteFetcher::FetchError.new('too many connection resets', @uri) if retried
+
+ reset connection
+
+ retried = true
+ retry
+ end
+
+ response
+ end
+
+ ##
+ # Returns list of no_proxy entries (if any) from the environment
+
+ def get_no_proxy_from_env
+ env_no_proxy = ENV['no_proxy'] || ENV['NO_PROXY']
+
+ return [] if env_no_proxy.nil? or env_no_proxy.empty?
+
+ env_no_proxy.split(/\s*,\s*/)
+ end
+
+ ##
+ # Returns a proxy URI for the given +scheme+ if one is set in the
+ # environment variables.
+
+ def get_proxy_from_env scheme = 'http'
+ _scheme = scheme.downcase
+ _SCHEME = scheme.upcase
+ env_proxy = ENV["#{_scheme}_proxy"] || ENV["#{_SCHEME}_PROXY"]
+
+ no_env_proxy = env_proxy.nil? || env_proxy.empty?
+
+ return get_proxy_from_env 'http' if no_env_proxy and _scheme != 'http'
+ return nil if no_env_proxy
+
+ uri = URI(Gem::UriFormatter.new(env_proxy).normalize)
+
+ if uri and uri.user.nil? and uri.password.nil? then
+ user = ENV["#{_scheme}_proxy_user"] || ENV["#{_SCHEME}_PROXY_USER"]
+ password = ENV["#{_scheme}_proxy_pass"] || ENV["#{_SCHEME}_PROXY_PASS"]
+
+ uri.user = Gem::UriFormatter.new(user).escape
+ uri.password = Gem::UriFormatter.new(password).escape
+ end
+
+ uri
+ end
+
+ def https?(uri)
+ uri.scheme.downcase == 'https'
+ end
+
+ def no_proxy? host
+ host = host.downcase
+ @env_no_proxy.each do |pattern|
+ pattern = pattern.downcase
+ return true if host[-pattern.length, pattern.length ] == pattern
+ end
+ return false
+ end
+
+ ##
+ # 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
+
diff --git a/lib/rubygems/request_set.rb b/lib/rubygems/request_set.rb
new file mode 100644
index 0000000000..d91a39cb22
--- /dev/null
+++ b/lib/rubygems/request_set.rb
@@ -0,0 +1,273 @@
+require 'rubygems'
+require 'rubygems/dependency'
+require 'rubygems/dependency_list'
+require 'rubygems/installer'
+require 'rubygems/resolver'
+require 'tsort'
+
+##
+# 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"]
+
+class Gem::RequestSet
+
+ include TSort
+
+ ##
+ # Array of gems to install even if already installed
+
+ attr_reader :always_install
+
+ attr_reader :dependencies
+
+ attr_accessor :development
+
+ ##
+ # The set of git gems imported via load_gemdeps.
+
+ attr_reader :git_set # :nodoc:
+
+ ##
+ # Sets used for resolution
+
+ attr_reader :sets # :nodoc:
+
+ ##
+ # Treat missing dependencies as silent errors
+
+ attr_accessor :soft_missing
+
+ ##
+ # 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 = []
+ @dependency_names = {}
+ @development = false
+ @git_set = nil
+ @requests = []
+ @sets = []
+ @soft_missing = false
+ @sorted = nil
+ @specs = nil
+ @vendor_set = nil
+
+ yield self if block_given?
+ end
+
+ ##
+ # 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
+
+ ##
+ # 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]
+ return install_into dir, false, options, &block
+ end
+
+ cache_dir = options[:cache_dir] || Gem.dir
+
+ specs = []
+
+ 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
+
+ path = req.download cache_dir
+
+ inst = Gem::Installer.new path, options
+
+ yield req, inst if block_given?
+
+ specs << inst.install
+ end
+
+ specs
+ end
+
+ ##
+ # 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+.
+
+ def install_from_gemdeps options, &block
+ load_gemdeps options[:gemdeps], options[:without_groups]
+
+ resolve
+
+ if options[:explain]
+ puts "Gems to install:"
+
+ specs.map { |s| s.full_name }.sort.each do |s|
+ puts " #{s}"
+ end
+ else
+ install options, &block
+ end
+ end
+
+ def install_into dir, force = true, options = {}
+ existing = force ? [] : specs_in(dir)
+ existing.delete_if { |s| @always_install.include? s }
+
+ dir = File.expand_path dir
+
+ installed = []
+
+ sorted_requests.each do |req|
+ if existing.find { |s| s.full_name == req.spec.full_name }
+ yield req, nil if block_given?
+ next
+ end
+
+ path = req.download(dir)
+
+ unless path then # already installed
+ yield req, nil if block_given?
+ next
+ end
+
+ options[:install_dir] = dir
+ options[:only_install_dir] = true
+
+ inst = Gem::Installer.new path, options
+
+ yield req, inst if block_given?
+
+ inst.install
+
+ installed << req
+ end
+
+ installed
+ end
+
+ ##
+ # Load a dependency management file.
+
+ def load_gemdeps path, without_groups = []
+ @git_set = Gem::Resolver::GitSet.new
+ @vendor_set = Gem::Resolver::VendorSet.new
+
+ gf = Gem::RequestSet::GemDependencyAPI.new self, path
+ gf.without_groups = without_groups if without_groups
+ gf.load
+ 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)
+
+ resolver = Gem::Resolver.new @dependencies, set
+ resolver.development = @development
+ resolver.soft_missing = @soft_missing
+
+ @requests = resolver.resolve
+ 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 }
+ if match
+ begin
+ yield match
+ rescue TSort::Cyclic
+ end
+ else
+ unless @soft_missing
+ raise Gem::DependencyError, "Unresolved dependency found during sorting - #{dep} (requested by #{node.spec.full_name})"
+ end
+ end
+ end
+ end
+
+end
+
+require 'rubygems/request_set/gem_dependency_api'
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..0c27b1a61a
--- /dev/null
+++ b/lib/rubygems/request_set/gem_dependency_api.rb
@@ -0,0 +1,513 @@
+##
+# A semi-compatible DSL for the Bundler Gemfile and Isolate formats.
+
+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],
+ }
+
+ 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 => Gem::Platform::RUBY,
+ :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,
+ :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,
+ :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,
+ }
+
+ ##
+ # 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_platform = nil
+ @current_repository = nil
+ @default_sources = true
+ @git_set = @set.git_set
+ @requires = Hash.new { |h, name| h[name] = [] }
+ @vendor_set = @set.vendor_set
+ @gem_sources = {}
+ @without_groups = []
+ 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
+
+ ##
+ # Loads the gem dependency file
+
+ def load
+ instance_eval File.read(@path).untaint, @path, 1
+ 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+
+
+ 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_github name, options
+
+ return unless gem_platforms options
+
+ groups = gem_group name, options
+
+ return unless (groups & @without_groups).empty?
+
+ unless source_set then
+ raise ArgumentError,
+ "duplicate source (default) for gem #{name}" if
+ @gem_sources.include? name
+
+ @gem_sources[name] = :default
+ end
+
+ gem_requires name, options
+
+ @set.gem name, *requirements
+ end
+
+ ##
+ # Handles the git: option from +options+ for gem +name+.
+ #
+ # Returns +true+ if the 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)
+
+ raise ArgumentError,
+ "duplicate source git: #{repository} for gem #{name}" if
+ @gem_sources.include? name
+
+ 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
+
+ @gem_sources[name] = repository
+
+ true
+ end
+
+ private :gem_git
+
+ ##
+ # Handles the github: option from +options+ for gem +name+.
+ #
+ # Returns +true+ if the path option was handled.
+
+ def gem_github name, options # :nodoc:
+ return unless path = options.delete(:github)
+
+ options[:git] = "git://github.com/#{path}.git"
+
+ gem_git name, options
+
+ true
+ end
+
+ private :gem_github
+
+ ##
+ # 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)
+
+ raise ArgumentError,
+ "duplicate source path: #{directory} for gem #{name}" if
+ @gem_sources.include? name
+
+ @vendor_set.add_vendor_gem name, directory
+
+ @gem_sources[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 :platforms)
+ platform_names << @current_platform if @current_platform
+
+ 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
+
+ ##
+ # Handles the require: option from +options+ and adds those files, or the
+ # default file to the require list for +name+.
+
+ def gem_requires name, options # :nodoc:
+ 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+.
+
+ def git repository
+ @current_repository = repository
+
+ yield
+
+ ensure
+ @current_repository = nil
+ 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.
+
+ 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+.
+
+ def group *groups
+ @current_groups = groups
+
+ yield
+
+ ensure
+ @current_groups = nil
+ end
+
+ ##
+ # :category: Gem Dependencies DSL
+ #
+ # Block form for restricting gems to a particular platform.
+
+ def platform what
+ @current_platform = what
+
+ yield
+
+ ensure
+ @current_platform = nil
+ end
+
+ ##
+ # :category: Gem Dependencies DSL
+ #
+ # Block form for restricting gems to a particular platform.
+
+ alias :platforms :platform
+
+ ##
+ # :category: Gem Dependencies DSL
+ # Restricts this gem dependencies file to the given ruby +version+. The
+ # +:engine+ options from Bundler are currently ignored.
+
+ 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
+
+ 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.
+
+ 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..0073bfdcc5
--- /dev/null
+++ b/lib/rubygems/request_set/lockfile.rb
@@ -0,0 +1,356 @@
+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, line, column, path
+ @line = line
+ @column = column
+ @path = path
+ super "#{message} (at #{line}:#{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
+ @set = request_set
+ @gem_deps_file = File.expand_path(gem_deps_file)
+ @gem_deps_dir = File.dirname(@gem_deps_file)
+
+ @current_token = nil
+ @line = 0
+ @line_pos = 0
+ @platforms = []
+ @tokens = []
+ end
+
+ def add_DEPENDENCIES out # :nodoc:
+ out << "DEPENDENCIES"
+
+ @set.dependencies.sort.map do |dependency|
+ source = @requests.find do |req|
+ req.name == dependency.name and
+ req.spec.class == Gem::Resolver::VendorSpecification
+ end
+
+ source_dep = '!' if source
+
+ requirement = dependency.requirement
+
+ out << " #{dependency.name}#{source_dep}#{requirement.for_lockfile}"
+ end
+
+ out << nil
+ end
+
+ def add_GEM out # :nodoc:
+ out << "GEM"
+
+ source_groups = @spec_groups.values.flatten.group_by do |request|
+ request.spec.source.uri
+ end
+
+ source_groups.map do |group, requests|
+ out << " remote: #{group}"
+ out << " specs:"
+
+ requests.sort_by { |request| request.name }.each do |request|
+ 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|
+ requirement = dependency.requirement
+ out << " #{dependency.name}#{requirement.for_lockfile}"
+ end
+ end
+ end
+
+ out << nil
+ end
+
+ def relative_path_from(dest, base)
+ 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.delete Gem::Platform::RUBY if platforms.length > 1
+
+ platforms.each do |platform|
+ out << " #{platform}"
+ end
+
+ out << nil
+ end
+
+ ##
+ # Gets the next token for a Lockfile
+
+ def get expected_type = nil, expected_value = nil # :nodoc:
+ @current_token = @tokens.shift
+
+ type, value, line, column = @current_token
+
+ if expected_type and expected_type != type then
+ unget
+
+ message = "unexpected token [#{type.inspect}, #{value.inspect}], " +
+ "expected #{expected_type.inspect}"
+
+ raise ParseError.new message, line, column, "#{@gem_deps_file}.lock"
+ end
+
+ if expected_value and expected_value != value then
+ unget
+
+ message = "unexpected token [#{type.inspect}, #{value.inspect}], " +
+ "expected [#{expected_type.inspect}, #{expected_value.inspect}]"
+
+ raise ParseError.new message, line, column, "#{@gem_deps_file}.lock"
+ end
+
+ @current_token
+ end
+
+ def parse # :nodoc:
+ tokenize
+
+ until @tokens.empty? do
+ type, data, column, line = get
+
+ case type
+ when :section then
+ skip :newline
+
+ case data
+ when 'DEPENDENCIES' then
+ parse_DEPENDENCIES
+ when 'GEM' then
+ parse_GEM
+ when 'PLATFORMS' then
+ parse_PLATFORMS
+ else
+ type, = get until @tokens.empty? or peek.first == :section
+ end
+ else
+ raise "BUG: unhandled token #{type} (#{data.inspect}) at #{line}:#{column}"
+ end
+ end
+ end
+
+ def parse_DEPENDENCIES # :nodoc:
+ while not @tokens.empty? and :text == peek.first do
+ _, name, = get :text
+
+ @set.gem name
+
+ skip :newline
+ end
+ end
+
+ def parse_GEM # :nodoc:
+ get :entry, 'remote'
+ _, data, = get :text
+
+ source = Gem::Source.new data
+
+ skip :newline
+
+ get :entry, 'specs'
+
+ skip :newline
+
+ set = Gem::Resolver::LockSet.new source
+
+ while not @tokens.empty? and :text == peek.first do
+ _, name, = get :text
+
+ case peek[0]
+ when :newline then # ignore
+ when :l_paren then
+ get :l_paren
+
+ _, version, = get :text
+
+ get :r_paren
+
+ set.add name, version, Gem::Platform::RUBY
+ else
+ raise "BUG: unknown token #{peek}"
+ end
+
+ skip :newline
+ end
+
+ @set.sets << set
+ end
+
+ def parse_PLATFORMS # :nodoc:
+ while not @tokens.empty? and :text == peek.first do
+ _, name, = get :text
+
+ @platforms << name
+
+ skip :newline
+ end
+ end
+
+ ##
+ # Peeks at the next token for Lockfile
+
+ def peek # :nodoc:
+ @tokens.first
+ end
+
+ def skip type # :nodoc:
+ get while not @tokens.empty? and peek.first == type
+ end
+
+ def to_s
+ @set.resolve
+
+ out = []
+
+ @requests = @set.sorted_requests
+
+ @spec_groups = @requests.group_by do |request|
+ request.spec.class
+ end
+
+ add_PATH 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
+
+ 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
+
+ # leading whitespace is for the user's convenience
+ next if s.scan(/ +/)
+
+ if s.scan(/[<|=>]{7}/) then
+ message = "your #{lock_file} contains merge conflict markers"
+ line, column = token_pos pos
+
+ raise ParseError.new message, line, column, lock_file
+ end
+
+ @tokens <<
+ case
+ when s.scan(/\r?\n/) then
+ token = [:newline, nil, *token_pos(pos)]
+ @line_pos = s.pos
+ @line += 1
+ token
+ when s.scan(/[A-Z]+/) then
+ [:section, s.matched, *token_pos(pos)]
+ when s.scan(/([a-z]+):\s/) then
+ s.pos -= 1 # rewind for possible newline
+ [:entry, s[1], *token_pos(pos)]
+ when s.scan(/\(/) then
+ [:l_paren, nil, *token_pos(pos)]
+ when s.scan(/\)/) then
+ [:r_paren, nil, *token_pos(pos)]
+ when s.scan(/[^\s)]*/) then
+ [:text, s.matched, *token_pos(pos)]
+ else
+ raise "BUG: can't create token for: #{s.string[s.pos..-1].inspect}"
+ end
+ end
+
+ @tokens
+ end
+
+ ##
+ # Ungets the last token retrieved by #get
+
+ def unget # :nodoc:
+ @tokens.unshift @current_token
+ end
+
+end
+
diff --git a/lib/rubygems/require_paths_builder.rb b/lib/rubygems/require_paths_builder.rb
deleted file mode 100644
index 23e974639f..0000000000
--- a/lib/rubygems/require_paths_builder.rb
+++ /dev/null
@@ -1,18 +0,0 @@
-require 'rubygems'
-
-# TODO: remove after 1.9.1 dropped
-module Gem::RequirePathsBuilder
- def write_require_paths_file_if_needed(spec = @spec, gem_home = @gem_home)
- return if spec.require_paths == ["lib"] &&
- (spec.bindir.nil? || spec.bindir == "bin")
- file_name = File.join(gem_home, 'gems', "#{@spec.full_name}", ".require_paths")
- file_name.untaint
- File.open(file_name, "w") do |file|
- spec.require_paths.each do |path|
- file.puts path
- end
- file.puts spec.bindir if spec.bindir
- end
- end
-end if Gem::QUICKLOADER_SUCKAGE
-
diff --git a/lib/rubygems/requirement.rb b/lib/rubygems/requirement.rb
index 7abff01c39..2b112a8022 100644
--- a/lib/rubygems/requirement.rb
+++ b/lib/rubygems/requirement.rb
@@ -1,33 +1,42 @@
require "rubygems/version"
+require "rubygems/deprecate"
+
+# If we're being loaded after yaml was already required, then
+# 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.
-# 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"
-
class Gem::Requirement
- include Comparable
-
OPS = { #:nodoc:
"=" => lambda { |v, r| v == r },
"!=" => lambda { |v, r| v != r },
- ">" => lambda { |v, r| v > r },
- "<" => lambda { |v, r| v < r },
+ ">" => lambda { |v, r| v > r },
+ "<" => lambda { |v, r| v < r },
">=" => lambda { |v, r| v >= r },
"<=" => lambda { |v, r| v <= r },
"~>" => lambda { |v, r| v >= r && v.release < r.bump }
}
quoted = OPS.keys.map { |k| Regexp.quote k }.join "|"
- PATTERN = /\A\s*(#{quoted})?\s*(#{Gem::Version::VERSION_PATTERN})\s*\z/
+ 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
##
# Factory method to create a Gem::Requirement object. Input may be
@@ -53,10 +62,6 @@ class Gem::Requirement
##
# A default "version requirement" can surely _only_ be '>= 0'.
- #--
- # This comment once said:
- #
- # "A default "version requirement" can surely _only_ be '> 0'."
def self.default
new '>= 0'
@@ -78,10 +83,14 @@ class Gem::Requirement
return ["=", obj] if Gem::Version === obj
unless PATTERN =~ obj.to_s
- raise ArgumentError, "Illformed requirement [#{obj.inspect}]"
+ raise BadRequirementError, "Illformed requirement [#{obj.inspect}]"
end
- [$1 || "=", Gem::Version.new($2)]
+ if $1 == ">=" && $2 == "0"
+ DefaultRequirement
+ else
+ [$1 || "=", Gem::Version.new($2)]
+ end
end
##
@@ -101,13 +110,41 @@ class Gem::Requirement
requirements.compact!
requirements.uniq!
- requirements << ">= 0" if requirements.empty?
- @none = (requirements == ">= 0")
- @requirements = requirements.map! { |r| self.class.parse r }
+ if requirements.empty?
+ @requirements = [DefaultRequirement]
+ else
+ @requirements = requirements.map! { |r| self.class.parse r }
+ end
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:
+ " (#{to_s})" unless [DefaultRequirement] == @requirements
+ end
+
+ ##
+ # true if this gem has no requirements.
+
def none?
- @none ||= (to_s == ">= 0")
+ if @requirements.size == 1
+ @requirements[0] == DefaultRequirement
+ else
+ false
+ end
end
def as_list # :nodoc:
@@ -135,6 +172,7 @@ class Gem::Requirement
instance_variable_set "@#{ivar}", val
end
+ Gem.load_yaml
fix_syck_default_key_in_requirements
end
@@ -142,6 +180,18 @@ class Gem::Requirement
yaml_initialize coder.tag, coder.map
end
+ def to_yaml_properties # :nodoc:
+ ["@requirements"]
+ end
+
+ def encode_with coder # :nodoc:
+ coder.add 'requirements', @requirements
+ end
+
+ ##
+ # A requirement is a prerelease if any of the versions inside of it
+ # are prereleases
+
def prerelease?
requirements.any? { |r| r.last.prerelease? }
end
@@ -156,6 +206,8 @@ class Gem::Requirement
# True if +version+ satisfies this Requirement.
def satisfied_by? version
+ raise ArgumentError, "Need a Gem::Version: #{version.inspect}" unless
+ Gem::Version === version
# #28965: syck has a bug with unquoted '=' YAML.loading as YAML::DefaultKey
requirements.all? { |op, rv| (OPS[op] || OPS["="]).call version, rv }
end
@@ -176,13 +228,13 @@ class Gem::Requirement
as_list.join ", "
end
- def <=> other # :nodoc:
- to_s <=> other.to_s
+ def == other # :nodoc:
+ Gem::Requirement === other and to_s == other.to_s
end
private
- def fix_syck_default_key_in_requirements
+ def fix_syck_default_key_in_requirements # :nodoc:
Gem.load_yaml
# Fixup the Syck DefaultKey bug
@@ -194,11 +246,9 @@ class Gem::Requirement
end
end
-# :stopdoc:
-# Gem::Version::Requirement is used in a lot of old YAML specs. It's aliased
-# here for backwards compatibility. I'd like to remove this, maybe in RubyGems
-# 2.0.
-
-::Gem::Version::Requirement = ::Gem::Requirement
-# :startdoc:
+class Gem::Version
+ # 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..828c61de01
--- /dev/null
+++ b/lib/rubygems/resolver.rb
@@ -0,0 +1,415 @@
+require 'rubygems'
+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
+
+ ##
+ # Contains all the conflicts encountered while doing resolution
+
+ attr_reader :conflicts
+
+ attr_accessor :development
+
+ attr_reader :missing
+
+ ##
+ # 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::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
+
+ ##
+ # Provide a Resolver that queries only against the already
+ # installed gems.
+
+ 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
+ @missing = []
+ @soft_missing = false
+ end
+
+ DEBUG_RESOLVER = !ENV['DEBUG_RESOLVER'].nil?
+
+ def explain(stage, *data)
+ if DEBUG_RESOLVER
+ d = data.map { |x| x.inspect }.join(", ")
+ STDOUT.printf "%20s %s\n", stage.to_s.upcase, d
+ end
+ end
+
+ def explain_list(stage, data)
+ if DEBUG_RESOLVER
+ STDOUT.printf "%20s (%d entries)\n", stage.to_s.upcase, data.size
+ data.each do |d|
+ STDOUT.printf "%20s %s\n", "", d
+ end
+ end
+ end
+
+ ##
+ # 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]
+
+ activation_request =
+ Gem::Resolver::ActivationRequest.new spec, dep, possible
+
+ return spec, activation_request
+ end
+
+ def requests s, act, reqs=nil
+ s.dependencies.reverse_each do |d|
+ next if d.type == :development and not @development
+ reqs.add Gem::Resolver::DependencyRequest.new(d, act)
+ end
+
+ @set.prefetch reqs
+
+ reqs
+ end
+
+ ##
+ # Proceed with resolution! Returns an array of ActivationRequest objects.
+
+ def resolve
+ @conflicts = []
+
+ needed = RequirementList.new
+
+ @needed.reverse_each do |n|
+ request = Gem::Resolver::DependencyRequest.new n, nil
+
+ needed.add request
+ end
+
+ res = resolve_for needed, nil
+
+ raise Gem::DependencyResolutionError, res if
+ res.kind_of? Gem::Resolver::Conflict
+
+ res.to_a
+ end
+
+ ##
+ # Finds the State in +states+ that matches the +conflict+ so that we can try
+ # other possible sets.
+ #
+ # If no good candidate is found, the first state is tried.
+
+ def find_conflict_state conflict, states # :nodoc:
+ until states.empty? do
+ state = states.pop
+
+ explain :consider, state.dep, conflict.failed_dep
+
+ if conflict.for_spec? state.spec
+ state.conflicts << [state.spec, conflict]
+ return state
+ end
+ end
+
+ nil
+ end
+
+ ##
+ # 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
+ matching_platform = select_local_platforms all
+
+ return matching_platform, all
+ end
+
+ def handle_conflict(dep, existing)
+ # There is a conflict! We return the conflict object which will be seen by
+ # the caller and be handled at the right level.
+
+ # If the existing activation indicates that there are other possibles for
+ # it, then issue the conflict on the dependency for the activation itself.
+ # Otherwise, if there was a requester, issue it on the requester's
+ # request itself.
+ # Finally, if the existing request has no requester (toplevel) unwind to
+ # it anyway.
+
+ if existing.others_possible?
+ conflict =
+ Gem::Resolver::Conflict.new dep, existing
+ elsif dep.requester
+ depreq = dep.requester.request
+ conflict =
+ Gem::Resolver::Conflict.new depreq, existing, dep
+ elsif existing.request.requester.nil?
+ conflict =
+ Gem::Resolver::Conflict.new dep, existing
+ else
+ raise Gem::DependencyError, "Unable to figure out how to unwind conflict"
+ end
+
+ @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
+ # The State objects that are used to attempt the activation tree.
+ states = []
+
+ while !needed.empty?
+ dep = needed.remove
+ explain :try, [dep, dep.requester ? dep.requester.request : :toplevel]
+ explain_list :next5, needed.next5
+ explain_list :specs, Array(specs).map { |x| x.full_name }.sort
+
+ # If there is already a spec activated for the requested name...
+ if specs && existing = specs.find { |s| dep.name == s.name }
+ # then we're done since this new dep matches the existing spec.
+ next if dep.matches_spec? existing
+
+ conflict = handle_conflict dep, existing
+ explain :conflict, conflict.explain
+
+ state = find_conflict_state conflict, states
+
+ return conflict unless state
+
+ needed, specs = resolve_for_conflict needed, specs, state
+
+ states << state unless state.possibles.empty?
+
+ next
+ end
+
+ matching, all = find_possible dep
+
+ case matching.size
+ when 0
+ resolve_for_zero dep, all
+ when 1
+ needed, specs =
+ resolve_for_single needed, specs, dep, matching
+ else
+ needed, specs =
+ resolve_for_multiple needed, specs, states, dep, matching
+ end
+ end
+
+ 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, [])
+
+ 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
+ raise Gem::UnsatisfiableDependencyError.new(dep, platform_mismatch)
+ end
+ end
+
+ ##
+ # Returns the gems in +specs+ that match the local platform.
+
+ def select_local_platforms specs # :nodoc:
+ specs.select do |spec|
+ Gem::Platform.installable? spec
+ end
+ end
+
+end
+
+##
+# 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/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/vendor_specification'
+
diff --git a/lib/rubygems/resolver/activation_request.rb b/lib/rubygems/resolver/activation_request.rb
new file mode 100644
index 0000000000..ca82ac408a
--- /dev/null
+++ b/lib/rubygems/resolver/activation_request.rb
@@ -0,0 +1,138 @@
+##
+# Specifies a Specification object that should be activated.
+# Also contains a dependency that was used to introduce this
+# activation.
+
+class Gem::Resolver::ActivationRequest
+
+ attr_reader :request
+
+ attr_reader :spec
+
+ def initialize spec, req, others_possible = true
+ @spec = spec
+ @request = req
+ @others_possible = others_possible
+ end
+
+ def == other
+ case other
+ when Gem::Specification
+ @spec == other
+ when Gem::Resolver::ActivationRequest
+ @spec == other.spec && @request == other.request
+ else
+ false
+ end
+ 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 full_name
+ @spec.full_name
+ end
+
+ 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
+
+ ##
+ # Indicates 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
+
+ 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
+
+ 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..89ee3c9b15
--- /dev/null
+++ b/lib/rubygems/resolver/api_set.rb
@@ -0,0 +1,110 @@
+##
+# 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'
+ 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
+ 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 << 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
+ names = reqs.map { |r| r.dependency.name }
+ needed = names - @data.keys
+
+ return if needed.empty?
+
+ 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..0ab8e830c6
--- /dev/null
+++ b/lib/rubygems/resolver/api_specification.rb
@@ -0,0 +1,75 @@
+##
+# 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 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..533a0db58f
--- /dev/null
+++ b/lib/rubygems/resolver/best_set.rb
@@ -0,0 +1,21 @@
+##
+# 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.each_source do |source|
+ @sets << source.dependency_resolver_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..19227e095b
--- /dev/null
+++ b/lib/rubygems/resolver/composed_set.rb
@@ -0,0 +1,39 @@
+##
+# 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
+ @sets = sets
+ 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..20c6eced31
--- /dev/null
+++ b/lib/rubygems/resolver/conflict.rb
@@ -0,0 +1,123 @@
+##
+# 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
+ requirement = @failed_dep.dependency.requirement
+
+ " Activated %s via:\n %s\n instead of (%s) via:\n %s\n" % [
+ activated, request_path(@activated).join(', '),
+ requirement, request_path(requester).join(', '),
+ ]
+ 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
+ spec_name = current.spec.full_name
+ requirement = current.request.dependency.requirement
+ path << "#{current.spec.full_name} (#{requirement})"
+
+ current = current.parent
+ 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..e63b443c62
--- /dev/null
+++ b/lib/rubygems/resolver/dependency_request.rb
@@ -0,0 +1,71 @@
+##
+# Used Internally. Wraps a Dependency object to also track which spec
+# contained the Dependency.
+
+class Gem::Resolver::DependencyRequest
+
+ attr_reader :dependency
+
+ attr_reader :requester
+
+ def initialize(dep, act)
+ @dependency = dep
+ @requester = act
+ end
+
+ def ==(other)
+ case other
+ when Gem::Dependency
+ @dependency == other
+ when Gem::Resolver::DependencyRequest
+ @dependency == other.dependency && @requester == other.requester
+ else
+ false
+ end
+ end
+
+ def matches_spec?(spec)
+ @dependency.matches_spec? spec
+ end
+
+ 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 requset is for a gem requested as a dependency of another gem
+ def implicit?
+ !explicit?
+ end
+
+ # Return a String indicating who caused this request to be added (only
+ # valid for implicit requests)
+ def request_context
+ @requester ? @requester.request : "(unknown)"
+ end
+
+ 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
+
+ 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..c912e367d9
--- /dev/null
+++ b/lib/rubygems/resolver/git_set.rb
@@ -0,0 +1,70 @@
+##
+# 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
+
+ ##
+ # 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:
+ @git = ENV['git'] || 'git'
+ @need_submodules = {}
+ @repositories = {}
+ @specs = {}
+ end
+
+ def add_git_gem name, repository, reference, submodules # :nodoc:
+ @repositories[name] = [repository, reference]
+ @need_submodules[repository] = submodules
+ end
+
+ ##
+ # Finds all git gems matching +req+
+
+ def find_all req
+ prefetch nil
+
+ specs.values.select do |spec|
+ req.matches_spec? 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.specs.each do |spec|
+ git_spec = Gem::Resolver::GitSpecification.new self, spec, source
+
+ @specs[spec.name] = git_spec
+ 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..ac8d4e9aeb
--- /dev/null
+++ b/lib/rubygems/resolver/git_specification.rb
@@ -0,0 +1,16 @@
+##
+# 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
+
+end
+
diff --git a/lib/rubygems/resolver/index_set.rb b/lib/rubygems/resolver/index_set.rb
new file mode 100644
index 0000000000..0ba3c78a44
--- /dev/null
+++ b/lib/rubygems/resolver/index_set.rb
@@ -0,0 +1,50 @@
+##
+# The global rubygems pool represented via the traditional
+# source index.
+
+class Gem::Resolver::IndexSet < Gem::Resolver::Set
+
+ def initialize source = nil # :nodoc:
+ @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, = @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 then
+ res << Gem::Resolver::IndexSpecification.new(
+ self, n.name, n.version, uri, n.platform)
+ end
+ end
+
+ res
+ 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..647ff7499a
--- /dev/null
+++ b/lib/rubygems/resolver/installed_specification.rb
@@ -0,0 +1,34 @@
+##
+# 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
+
+ ##
+ # 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.
+ if @source.kind_of? Gem::Source::SpecificFile
+ return true
+ else
+ Gem::Platform.match @spec.platform
+ 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..73d9e39651
--- /dev/null
+++ b/lib/rubygems/resolver/installer_set.rb
@@ -0,0 +1,152 @@
+##
+# 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:
+
+ def initialize domain
+ @domain = domain
+
+ @f = Gem::SpecFetcher.fetcher
+
+ @all = Hash.new { |h,k| h[k] = [] }
+ @always_install = []
+ @ignore_dependencies = false
+ @ignore_installed = false
+ @loaded_remote_specs = []
+ @specs = {}
+ 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
+
+ ##
+ # 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.matches_spec? spec }
+
+ name = dep.name
+
+ dep.matching_specs.each do |gemspec|
+ next if @always_install.include? gemspec
+
+ res << Gem::Resolver::InstalledSpecification.new(self, gemspec)
+ end unless @ignore_installed
+
+ if consider_local? then
+ local_source = Gem::Source::Local.new
+
+ if spec = local_source.find_gem(name, dep.requirement) then
+ res << Gem::Resolver::IndexSpecification.new(
+ self, spec.name, spec.version, local_source, spec.platform)
+ end
+ end
+
+ if consider_remote? then
+ load_remote_specs dep
+
+ @all[name].each do |remote_source, n|
+ if dep.match? n then
+ res << Gem::Resolver::IndexSpecification.new(
+ self, n.name, n.version, remote_source, n.platform)
+ end
+ end
+ end
+
+ res
+ end
+
+ def 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
+
+ ##
+ # Loads remote prerelease specs if +dep+ is a prerelease dependency
+
+ def load_remote_specs dep # :nodoc:
+ types = [:released]
+ types << :prerelease if dep.prerelease?
+
+ types.each do |type|
+ next if @loaded_remote_specs.include? type
+ @loaded_remote_specs << type
+
+ list, = @f.available_specs type
+
+ list.each do |uri, specs|
+ specs.each do |n|
+ @all[n.name] << [uri, n]
+ end
+ end
+ end
+ end
+
+ ##
+ # Called from IndexSpecification to get a true Specification
+ # object.
+
+ 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
+
+ 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
+
+end
+
diff --git a/lib/rubygems/resolver/lock_set.rb b/lib/rubygems/resolver/lock_set.rb
new file mode 100644
index 0000000000..6885e70945
--- /dev/null
+++ b/lib/rubygems/resolver/lock_set.rb
@@ -0,0 +1,60 @@
+##
+# 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 +source+
+
+ def initialize source
+ @source = source
+ @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
+
+ spec =
+ Gem::Resolver::IndexSpecification.new self, name, version, @source,
+ platform
+
+ @specs << spec
+ end
+
+ ##
+ # Returns an Array of IndexSpecification objects matching the
+ # DependencyRequest +req+.
+
+ def find_all req
+ @specs.select do |spec|
+ req.matches_spec? 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
+
+end
+
diff --git a/lib/rubygems/resolver/requirement_list.rb b/lib/rubygems/resolver/requirement_list.rb
new file mode 100644
index 0000000000..04e437b2a9
--- /dev/null
+++ b/lib/rubygems/resolver/requirement_list.rb
@@ -0,0 +1,44 @@
+##
+# Used internally to hold the requirements being considered
+# while attempting to find a proper activation set.
+
+class Gem::Resolver::RequirementList
+
+ include Enumerable
+
+ def initialize
+ @list = []
+ end
+
+ def initialize_copy(other)
+ @list = @list.dup
+ end
+
+ def add(req)
+ @list.push req
+ req
+ end
+
+ ##
+ # Enumerates requirements in the list
+
+ def each # :nodoc:
+ return enum_for __method__ unless block_given?
+
+ @list.each do |requirement|
+ yield requirement
+ end
+ end
+
+ def empty?
+ @list.empty?
+ end
+
+ def remove
+ @list.shift
+ end
+
+ def next5
+ @list[0,5]
+ end
+end
diff --git a/lib/rubygems/resolver/set.rb b/lib/rubygems/resolver/set.rb
new file mode 100644
index 0000000000..32c137ef6b
--- /dev/null
+++ b/lib/rubygems/resolver/set.rb
@@ -0,0 +1,27 @@
+##
+# Resolver sets are used to look up specifications (and their
+# dependencies) used in resolution. This set is abstract.
+
+class Gem::Resolver::Set
+
+ ##
+ # 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
+
+end
+
diff --git a/lib/rubygems/resolver/spec_specification.rb b/lib/rubygems/resolver/spec_specification.rb
new file mode 100644
index 0000000000..0c411bdf5f
--- /dev/null
+++ b/lib/rubygems/resolver/spec_specification.rb
@@ -0,0 +1,58 @@
+##
+# The Resolver::SpecSpecification contains common functionality for
+# Resolver specifications that are backed by a Gem::Specification.
+
+class Gem::Resolver::SpecSpecification < Gem::Resolver::Specification
+
+ attr_reader :spec # :nodoc:
+
+ ##
+ # A SpecSpecification is created for a +set+ for a Gem::Specification in
+ # +spec+. The +source+ is either where the +spec+ came from, or should be
+ # 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..7dd4c2e829
--- /dev/null
+++ b/lib/rubygems/resolver/specification.rb
@@ -0,0 +1,60 @@
+##
+# 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 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
+
+ ##
+ # The name and version of the specification.
+ #
+ # Unlike Gem::Specification#full_name, the platform is not included.
+
+ def full_name
+ "#{@name}-#{@version}"
+ end
+
+end
+
diff --git a/lib/rubygems/resolver/vendor_set.rb b/lib/rubygems/resolver/vendor_set.rb
new file mode 100644
index 0000000000..e9cbcd8303
--- /dev/null
+++ b/lib/rubygems/resolver/vendor_set.rb
@@ -0,0 +1,66 @@
+##
+# 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
+
+ def initialize # :nodoc:
+ @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
+
+ key = "#{spec.name}-#{spec.version}-#{spec.platform}"
+
+ @specs[key] = spec
+ @directories[spec] = directory
+ end
+
+ ##
+ # Returns an Array of VendorSpecification objects matching the
+ # DependencyRequest +req+.
+
+ def find_all req
+ @specs.values.select do |spec|
+ req.matches_spec? 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+ and +platform+. Since the
+ # +source+ is defined when the specification was added to index it is not
+ # used.
+
+ def load_spec name, version, platform, source # :nodoc:
+ key = "#{name}-#{version}-#{platform}"
+
+ @specs.fetch key
+ end
+
+end
+
diff --git a/lib/rubygems/resolver/vendor_specification.rb b/lib/rubygems/resolver/vendor_specification.rb
new file mode 100644
index 0000000000..24e033d084
--- /dev/null
+++ b/lib/rubygems/resolver/vendor_specification.rb
@@ -0,0 +1,16 @@
+##
+# 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
+
+end
+
diff --git a/lib/rubygems/security.rb b/lib/rubygems/security.rb
index f51da65b4b..bfd6fd225b 100644
--- a/lib/rubygems/security.rb
+++ b/lib/rubygems/security.rb
@@ -5,80 +5,95 @@
#++
require 'rubygems/exceptions'
-require 'rubygems/gem_openssl'
require 'fileutils'
+begin
+ require 'openssl'
+rescue LoadError => e
+ raise unless (e.respond_to?(:path) && e.path == 'openssl') ||
+ e.message =~ / -- openssl$/
+end
+
+##
+# = Signing gems
#
-# = Signed Gems README
-#
-# == Table of Contents
-# * Overview
-# * Walkthrough
-# * Command-Line Options
-# * OpenSSL Reference
-# * Bugs/TODO
-# * About the Author
-#
-# == Overview
-#
-# Gem::Security implements cryptographic signatures in RubyGems. The section
+# The Gem::Security implements cryptographic signatures for gems. The section
# below is a step-by-step guide to using signed gems and generating your own.
#
# == Walkthrough
#
+# === Building your certificate
+#
# In order to start signing your gems, you'll need to build a private key and
# a self-signed certificate. Here's how:
#
-# # build a private key and certificate for gemmaster@example.com
-# $ gem cert --build gemmaster@example.com
+# # build a private key and certificate for yourself:
+# $ gem cert --build you@example.com
#
-# This could take anywhere from 5 seconds to 10 minutes, depending on the
-# speed of your computer (public key algorithms aren't exactly the speediest
-# crypto algorithms in the world). When it's finished, you'll see the files
-# "gem-private_key.pem" and "gem-public_cert.pem" in the current directory.
+# This could take anywhere from a few seconds to a minute or two, depending on
+# the speed of your computer (public key algorithms aren't exactly the
+# speediest crypto algorithms in the world). When it's finished, you'll see
+# the files "gem-private_key.pem" and "gem-public_cert.pem" in the current
+# directory.
#
-# First things first: take the "gem-private_key.pem" file and move it
-# somewhere private, preferably a directory only you have access to, a floppy
-# (yuck!), a CD-ROM, or something comparably secure. Keep your private key
-# hidden; if it's compromised, someone can sign packages as you (note: PKI has
-# ways of mitigating the risk of stolen keys; more on that later).
+# First things first: Move both files to ~/.gem if you don't already have a
+# key and certificate in that directory. Ensure the file permissions make the
+# key unreadable by others (by default the file is saved securely).
#
-# Now, let's sign an existing gem. I'll be using my Imlib2-Ruby bindings, but
-# you can use whatever gem you'd like. Open up your existing gemspec file and
-# add the following lines:
+# Keep your private key hidden; if it's compromised, someone can sign packages
+# as you (note: PKI has ways of mitigating the risk of stolen keys; more on
+# that later).
#
-# # signing key and certificate chain
-# s.signing_key = '/mnt/floppy/gem-private_key.pem'
-# s.cert_chain = ['gem-public_cert.pem']
+# === Signing Gems
#
-# (Be sure to replace "/mnt/floppy" with the ultra-secret path to your private
-# key).
+# In RubyGems 2 and newer there is no extra work to sign a gem. RubyGems will
+# automatically find your key and certificate in your home directory and use
+# them to sign newly packaged gems.
#
-# After that, go ahead and build your gem as usual. Congratulations, you've
-# just built your first signed gem! If you peek inside your gem file, you'll
-# see a couple of new files have been added:
+# If your certificate is not self-signed (signed by a third party) RubyGems
+# will attempt to load the certificate chain from the trusted certificates.
+# Use <code>gem cert --add signing_cert.pem</code> to add your signers as
+# trusted certificates. See below for further information on certificate
+# chains.
#
-# $ tar tf tar tf Imlib2-Ruby-0.5.0.gem
-# data.tar.gz
-# data.tar.gz.sig
+# If you build your gem it will automatically be signed. If you peek inside
+# your gem file, you'll see a couple of new files have been added:
+#
+# $ tar tf your-gem-1.0.gem
# metadata.gz
-# metadata.gz.sig
+# metadata.gz.sum
+# metadata.gz.sig # metadata signature
+# data.tar.gz
+# data.tar.gz.sum
+# data.tar.gz.sig # data signature
+#
+# === Manually signing gems
+#
+# If you wish to store your key in a separate secure location you'll need to
+# set your gems up for signing by hand. To do this, set the
+# <code>signing_key</code> and <code>cert_chain</code> in the gemspec before
+# packaging your gem:
+#
+# s.signing_key = '/secure/path/to/gem-private_key.pem'
+# s.cert_chain = %w[/secure/path/to/gem-public_cert.pem]
+#
+# When you package your gem with these options set RubyGems will automatically
+# load your key and certificate from the secure paths.
+#
+# === Signed gems and security policies
#
# Now let's verify the signature. Go ahead and install the gem, but add the
-# following options: "-P HighSecurity", like this:
+# following options: <code>-P HighSecurity</code>, like this:
#
# # install the gem with using the security policy "HighSecurity"
-# $ sudo gem install Imlib2-Ruby-0.5.0.gem -P HighSecurity
+# $ sudo gem install your.gem -P HighSecurity
#
-# The -P option sets your security policy -- we'll talk about that in just a
-# minute. Eh, what's this?
+# The <code>-P</code> option sets your security policy -- we'll talk about
+# that in just a minute. Eh, what's this?
#
-# Attempting local installation of 'Imlib2-Ruby-0.5.0.gem'
-# ERROR: Error installing gem Imlib2-Ruby-0.5.0.gem[.gem]: Couldn't
-# verify data signature: Untrusted Signing Chain Root: cert =
-# '/CN=gemmaster/DC=example/DC=com', error = 'path
-# "/root/.rubygems/trust/cert-15dbb43a6edf6a70a85d4e784e2e45312cff7030.pem"
-# does not exist'
+# $ gem install -P HighSecurity your-gem-1.0.gem
+# ERROR: While executing gem ... (Gem::Security::Exception)
+# root cert /CN=you/DC=example is not trusted
#
# The culprit here is the security policy. RubyGems has several different
# security policies. Let's take a short break and go over the security
@@ -111,46 +126,48 @@ require 'fileutils'
# RubyGems will simply refuse to install the package. Oh well, maybe
# he'll have better luck causing problems for CPAN users instead :).
#
-# So, the reason RubyGems refused to install our shiny new signed gem was
-# because it was from an untrusted source. Well, my code is infallible
-# (hah!), so I'm going to add myself as a trusted source.
-#
-# Here's how:
+# 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),
+# so you need to add yourself as a trusted source:
#
-# # add trusted certificate
-# gem cert --add gem-public_cert.pem
+# # add trusted certificate
+# gem cert --add ~/.gem/gem-public_cert.pem
#
-# I've added my public certificate as a trusted source. Now I can install
-# packages signed my private key without any hassle. Let's try the install
-# command above again:
+# You've now added your public certificate as a trusted source. Now you can
+# install packages signed by your private key without any hassle. Let's try
+# the install command above again:
#
# # install the gem with using the HighSecurity policy (and this time
# # without any shenanigans)
-# $ sudo gem install Imlib2-Ruby-0.5.0.gem -P HighSecurity
+# $ gem install -P HighSecurity your-gem-1.0.gem
+# Successfully installed your-gem-1.0
+# 1 gem installed
#
-# This time RubyGems should accept your signed package and begin installing.
-# While you're waiting for RubyGems to work it's magic, have a look at some of
-# the other security commands:
+# This time RubyGems will accept your signed package and begin installing.
#
-# Usage: gem cert [options]
+# While you're waiting for RubyGems to work it's magic, have a look at some of
+# the other security commands by running <code>gem help cert</code>:
#
# Options:
-# -a, --add CERT Add a trusted certificate.
-# -l, --list List trusted certificates.
-# -r, --remove STRING Remove trusted certificates containing STRING.
-# -b, --build EMAIL_ADDR Build private key and self-signed certificate
-# for EMAIL_ADDR.
-# -C, --certificate CERT Certificate for --sign command.
-# -K, --private-key KEY Private key for --sign command.
-# -s, --sign NEWCERT Sign a certificate with my key and certificate.
-#
-# (By the way, you can pull up this list any time you'd like by typing "gem
-# cert --help")
-#
-# Hmm. We've already covered the "--build" option, and the "--add", "--list",
-# and "--remove" commands seem fairly straightforward; they allow you to add,
-# list, and remove the certificates in your trusted certificate list. But
-# what's with this "--sign" option?
+# -a, --add CERT Add a trusted certificate.
+# -l, --list [FILTER] List trusted certificates where the
+# subject contains FILTER
+# -r, --remove FILTER Remove trusted certificates where the
+# subject contains FILTER
+# -b, --build EMAIL_ADDR Build private key and self-signed
+# certificate for EMAIL_ADDR
+# -C, --certificate CERT Signing certificate for --sign
+# -K, --private-key KEY Key for --sign or --build
+# -s, --sign CERT Signs CERT with the key from -K
+# and the certificate from -C
+#
+# We've already covered the <code>--build</code> option, and the
+# <code>--add</code>, <code>--list</code>, and <code>--remove</code> commands
+# seem fairly straightforward; they allow you to add, list, and remove the
+# certificates in your trusted certificate list. But what's with this
+# <code>--sign</code> option?
+#
+# === Certificate chains
#
# To answer that question, let's take a look at "certificate chains", a
# concept I mentioned earlier. There are a couple of problems with
@@ -172,134 +189,102 @@ require 'fileutils'
# trust. Here's a hypothetical example of a trust hierarchy based (roughly)
# on geography:
#
-#
# --------------------------
-# | rubygems@rubyforge.org |
+# | rubygems@rubygems.org |
# --------------------------
# |
# -----------------------------------
# | |
# ---------------------------- -----------------------------
-# | seattle.rb@zenspider.com | | dcrubyists@richkilmer.com |
+# | seattlerb@seattlerb.org | | dcrubyists@richkilmer.com |
# ---------------------------- -----------------------------
# | | | |
# --------------- ---------------- ----------- --------------
-# | alf@seattle | | bob@portland | | pabs@dc | | tomcope@dc |
+# | drbrain | | zenspider | | pabs@dc | | tomcope@dc |
# --------------- ---------------- ----------- --------------
#
#
-# Now, rather than having 4 trusted certificates (one for alf@seattle,
-# bob@portland, pabs@dc, and tomecope@dc), a user could actually get by with 1
-# certificate: the "rubygems@rubyforge.org" certificate. Here's how it works:
+# Now, rather than having 4 trusted certificates (one for drbrain, zenspider,
+# pabs@dc, and tomecope@dc), a user could actually get by with one
+# certificate, the "rubygems@rubygems.org" certificate.
+#
+# Here's how it works:
#
-# I install "Alf2000-Ruby-0.1.0.gem", a package signed by "alf@seattle". I've
-# never heard of "alf@seattle", but his certificate has a valid signature from
-# the "seattle.rb@zenspider.com" certificate, which in turn has a valid
-# signature from the "rubygems@rubyforge.org" certificate. Voila! At this
-# point, it's much more reasonable for me to trust a package signed by
-# "alf@seattle", because I can establish a chain to "rubygems@rubyforge.org",
-# which I do trust.
+# I install "rdoc-3.12.gem", a package signed by "drbrain". I've never heard
+# of "drbrain", but his certificate has a valid signature from the
+# "seattle.rb@seattlerb.org" certificate, which in turn has a valid signature
+# from the "rubygems@rubygems.org" certificate. Voila! At this point, it's
+# much more reasonable for me to trust a package signed by "drbrain", because
+# I can establish a chain to "rubygems@rubygems.org", which I do trust.
#
-# And the "--sign" option allows all this to happen. A developer creates
-# their build certificate with the "--build" option, then has their
-# certificate signed by taking it with them to their next regional Ruby meetup
-# (in our hypothetical example), and it's signed there by the person holding
-# the regional RubyGems signing certificate, which is signed at the next
-# RubyConf by the holder of the top-level RubyGems certificate. At each point
-# the issuer runs the same command:
+# === Signing certificates
+#
+# The <code>--sign</code> option allows all this to happen. A developer
+# creates their build certificate with the <code>--build</code> option, then
+# has their certificate signed by taking it with them to their next regional
+# Ruby meetup (in our hypothetical example), and it's signed there by the
+# person holding the regional RubyGems signing certificate, which is signed at
+# the next RubyConf by the holder of the top-level RubyGems certificate. At
+# each point the issuer runs the same command:
#
# # sign a certificate with the specified key and certificate
# # (note that this modifies client_cert.pem!)
# $ gem cert -K /mnt/floppy/issuer-priv_key.pem -C issuer-pub_cert.pem
# --sign client_cert.pem
#
-# Then the holder of issued certificate (in this case, our buddy
-# "alf@seattle"), can start using this signed certificate to sign RubyGems.
-# By the way, in order to let everyone else know about his new fancy signed
-# certificate, "alf@seattle" would change his gemspec file to look like this:
-#
-# # signing key (still kept in an undisclosed location!)
-# s.signing_key = '/mnt/floppy/alf-private_key.pem'
-#
-# # certificate chain (includes the issuer certificate now too)
-# s.cert_chain = ['/home/alf/doc/seattlerb-public_cert.pem',
-# '/home/alf/doc/alf_at_seattle-public_cert.pem']
+# Then the holder of issued certificate (in this case, your buddy "drbrain"),
+# can start using this signed certificate to sign RubyGems. By the way, in
+# order to let everyone else know about his new fancy signed certificate,
+# "drbrain" would save his newly signed certificate as
+# <code>~/.gem/gem-public_cert.pem</code>
#
-# Obviously, this RubyGems trust infrastructure doesn't exist yet. Also, in
-# the "real world" issuers actually generate the child certificate from a
+# Obviously this RubyGems trust infrastructure doesn't exist yet. Also, in
+# the "real world", issuers actually generate the child certificate from a
# certificate request, rather than sign an existing certificate. And our
# hypothetical infrastructure is missing a certificate revocation system.
# These are that can be fixed in the future...
#
-# I'm sure your new signed gem has finished installing by now (unless you're
-# installing rails and all it's dependencies, that is ;D). At this point you
-# should know how to do all of these new and interesting things:
+# At this point you should know how to do all of these new and interesting
+# things:
#
# * build a gem signing key and certificate
-# * modify your existing gems to support signing
# * adjust your security policy
# * modify your trusted certificate list
# * sign a certificate
#
-# If you've got any questions, feel free to contact me at the email address
-# below. The next couple of sections
-#
-#
-# == Command-Line Options
-#
-# Here's a brief summary of the certificate-related command line options:
-#
-# gem install
-# -P, --trust-policy POLICY Specify gem trust policy.
-#
-# gem cert
-# -a, --add CERT Add a trusted certificate.
-# -l, --list List trusted certificates.
-# -r, --remove STRING Remove trusted certificates containing
-# STRING.
-# -b, --build EMAIL_ADDR Build private key and self-signed
-# certificate for EMAIL_ADDR.
-# -C, --certificate CERT Certificate for --sign command.
-# -K, --private-key KEY Private key for --sign command.
-# -s, --sign NEWCERT Sign a certificate with my key and
-# certificate.
-#
-# A more detailed description of each options is available in the walkthrough
-# above.
-#
# == Manually verifying signatures
#
# In case you don't trust RubyGems you can verify gem signatures manually:
#
# 1. Fetch and unpack the gem
#
-# gem fetch some_signed_gem
-# tar -xf some_signed_gem-1.0.gem
+# gem fetch some_signed_gem
+# tar -xf some_signed_gem-1.0.gem
#
# 2. Grab the public key from the gemspec
#
-# gem spec some_signed_gem-1.0.gem cert_chain | \
-# ruby -pe 'sub(/^ +/, "")' > public_key.crt
+# gem spec some_signed_gem-1.0.gem cert_chain | \
+# ruby -ryaml -e 'puts YAML.load_documents($stdin)' > public_key.crt
#
# 3. Generate a SHA1 hash of the data.tar.gz
#
-# openssl dgst -sha1 < data.tar.gz > my.hash
+# openssl dgst -sha1 < data.tar.gz > my.hash
#
# 4. Verify the signature
#
-# openssl rsautl -verify -inkey public_key.crt -certin \
-# -in data.tar.gz.sig > verified.hash
+# openssl rsautl -verify -inkey public_key.crt -certin \
+# -in data.tar.gz.sig > verified.hash
#
# 5. Compare your hash to the verified hash
#
-# diff -s verified.hash my.hash
+# diff -s verified.hash my.hash
#
# 6. Repeat 5 and 6 with metadata.gz
#
# == OpenSSL Reference
#
-# The .pem files generated by --build and --sign are just basic OpenSSL PEM
-# files. Here's a couple of useful commands for manipulating them:
+# The .pem files generated by --build and --sign are PEM files. Here's a
+# couple of useful OpenSSL commands for manipulating them:
#
# # convert a PEM format X509 certificate into DER format:
# # (note: Windows .cer files are X509 certificates in DER format)
@@ -321,8 +306,8 @@ require 'fileutils'
# * There's no way to define a system-wide trust list.
# * custom security policies (from a YAML file, etc)
# * Simple method to generate a signed certificate request
-# * Support for OCSP, SCVP, CRLs, or some other form of cert
-# status check (list is in order of preference)
+# * Support for OCSP, SCVP, CRLs, or some other form of cert status check
+# (list is in order of preference)
# * Support for encrypted private keys
# * Some sort of semi-formal trust hierarchy (see long-winded explanation
# above)
@@ -332,17 +317,13 @@ require 'fileutils'
# MediumSecurity and HighSecurity policies)
# * Better explanation of X509 naming (ie, we don't have to use email
# addresses)
-# * Possible alternate signing mechanisms (eg, via PGP). this could be done
-# pretty easily by adding a :signing_type attribute to the gemspec, then add
-# the necessary support in other places
# * Honor AIA field (see note about OCSP above)
-# * Maybe honor restriction extensions?
+# * Honor extension restrictions
# * Might be better to store the certificate chain as a PKCS#7 or PKCS#12
-# file, instead of an array embedded in the metadata. ideas?
-# * Possibly embed signature and key algorithms into metadata (right now
-# they're assumed to be the same as what's set in Gem::Security::OPT)
+# file, instead of an array embedded in the metadata.
+# * Flexible signature and key algorithms, not hard-coded to RSA and SHA1.
#
-# == About the Author
+# == Original author
#
# Paul Duncan <pabs@pablotron.org>
# http://pablotron.org/
@@ -355,472 +336,260 @@ module Gem::Security
class Exception < Gem::Exception; end
##
- # Default options for most of the methods below
-
- OPT = {
- # private key options
- :key_algo => Gem::SSL::PKEY_RSA,
- :key_size => 2048,
-
- # public cert options
- :cert_age => 365 * 24 * 3600, # 1 year
- :dgst_algo => Gem::SSL::DIGEST_SHA1,
-
- # x509 certificate extensions
- :cert_exts => {
- 'basicConstraints' => 'CA:FALSE',
- 'subjectKeyIdentifier' => 'hash',
- 'keyUsage' => 'keyEncipherment,dataEncipherment,digitalSignature',
- },
-
- # save the key and cert to a file in build_self_signed_cert()?
- :save_key => true,
- :save_cert => true,
-
- # if you define either of these, then they'll be used instead of
- # the output_fmt macro below
- :save_key_path => nil,
- :save_cert_path => nil,
-
- # output name format for self-signed certs
- :output_fmt => 'gem-%s.pem',
- :munge_re => Regexp.new(/[^a-z0-9_.-]+/),
-
- # output directory for trusted certificate checksums
- :trust_dir => File.join(Gem.user_home, '.gem', 'trust'),
-
- # default permissions for trust directory and certs
- :perms => {
- :trust_dir => 0700,
- :trusted_cert => 0600,
- :signing_cert => 0600,
- :signing_key => 0600,
- },
- }
+ # Digest algorithm used to sign gems
- ##
- # A Gem::Security::Policy object encapsulates the settings for verifying
- # signed gem files. This is the base class. You can either declare an
- # instance of this or use one of the preset security policies below.
-
- class Policy
- attr_accessor :verify_data, :verify_signer, :verify_chain,
- :verify_root, :only_trusted, :only_signed
-
- #
- # Create a new Gem::Security::Policy object with the given mode and
- # options.
- #
- def initialize(policy = {}, opt = {})
- # set options
- @opt = Gem::Security::OPT.merge(opt)
-
- # build policy
- policy.each_pair do |key, val|
- case key
- when :verify_data then @verify_data = val
- when :verify_signer then @verify_signer = val
- when :verify_chain then @verify_chain = val
- when :verify_root then @verify_root = val
- when :only_trusted then @only_trusted = val
- when :only_signed then @only_signed = val
- end
- end
+ DIGEST_ALGORITHM =
+ if defined?(OpenSSL::Digest) then
+ OpenSSL::Digest::SHA1
end
- #
- # Get the path to the file for this cert.
- #
- def self.trusted_cert_path(cert, opt = {})
- opt = Gem::Security::OPT.merge(opt)
-
- # get digest algorithm, calculate checksum of root.subject
- algo = opt[:dgst_algo]
- dgst = algo.hexdigest(cert.subject.to_s)
-
- # build path to trusted cert file
- name = "cert-#{dgst}.pem"
+ ##
+ # Used internally to select the signing digest from all computed digests
- # join and return path components
- File::join(opt[:trust_dir], name)
+ DIGEST_NAME = # :nodoc:
+ if DIGEST_ALGORITHM then
+ DIGEST_ALGORITHM.new.name
end
- #
- # Verify that the gem data with the given signature and signing chain
- # matched this security policy at the specified time.
- #
- def verify_gem(signature, data, chain, time = Time.now)
- Gem.ensure_ssl_available
- cert_class = OpenSSL::X509::Certificate
- exc = Gem::Security::Exception
- chain ||= []
-
- chain = chain.map{ |str| cert_class.new(str) }
- signer, ch_len = chain[-1], chain.size
-
- # make sure signature is valid
- if @verify_data
- # get digest algorithm (TODO: this should be configurable)
- dgst = @opt[:dgst_algo]
-
- # verify the data signature (this is the most important part, so don't
- # screw it up :D)
- v = signer.public_key.verify(dgst.new, signature, data)
- raise exc, "Invalid Gem Signature" unless v
-
- # make sure the signer is valid
- if @verify_signer
- # make sure the signing cert is valid right now
- v = signer.check_validity(nil, time)
- raise exc, "Invalid Signature: #{v[:desc]}" unless v[:is_valid]
- end
- end
+ ##
+ # Algorithm for creating the key pair used to sign gems
- # make sure the certificate chain is valid
- if @verify_chain
- # iterate down over the chain and verify each certificate against it's
- # issuer
- (ch_len - 1).downto(1) do |i|
- issuer, cert = chain[i - 1, 2]
- v = cert.check_validity(issuer, time)
- raise exc, "%s: cert = '%s', error = '%s'" % [
- 'Invalid Signing Chain', cert.subject, v[:desc]
- ] unless v[:is_valid]
- end
-
- # verify root of chain
- if @verify_root
- # make sure root is self-signed
- root = chain[0]
- raise exc, "%s: %s (subject = '%s', issuer = '%s')" % [
- 'Invalid Signing Chain Root',
- 'Subject does not match Issuer for Gem Signing Chain',
- root.subject.to_s,
- root.issuer.to_s,
- ] unless root.issuer.to_s == root.subject.to_s
-
- # make sure root is valid
- v = root.check_validity(root, time)
- raise exc, "%s: cert = '%s', error = '%s'" % [
- 'Invalid Signing Chain Root', root.subject, v[:desc]
- ] unless v[:is_valid]
-
- # verify that the chain root is trusted
- if @only_trusted
- # get digest algorithm, calculate checksum of root.subject
- algo = @opt[:dgst_algo]
- path = Gem::Security::Policy.trusted_cert_path(root, @opt)
-
- # check to make sure trusted path exists
- raise exc, "%s: cert = '%s', error = '%s'" % [
- 'Untrusted Signing Chain Root',
- root.subject.to_s,
- "path \"#{path}\" does not exist",
- ] unless File.exist?(path)
-
- # load calculate digest from saved cert file
- save_cert = OpenSSL::X509::Certificate.new(File.read(path))
- save_dgst = algo.digest(save_cert.public_key.to_s)
-
- # create digest of public key
- pkey_str = root.public_key.to_s
- cert_dgst = algo.digest(pkey_str)
-
- # now compare the two digests, raise exception
- # if they don't match
- raise exc, "%s: %s (saved = '%s', root = '%s')" % [
- 'Invalid Signing Chain Root',
- "Saved checksum doesn't match root checksum",
- save_dgst, cert_dgst,
- ] unless save_dgst == cert_dgst
- end
- end
-
- # return the signing chain
- chain.map { |cert| cert.subject }
- end
+ KEY_ALGORITHM =
+ if defined?(OpenSSL::PKey) then
+ OpenSSL::PKey::RSA
end
- end
##
- # No security policy: all package signature checks are disabled.
+ # Length of keys created by KEY_ALGORITHM
- NoSecurity = Policy.new(
- :verify_data => false,
- :verify_signer => false,
- :verify_chain => false,
- :verify_root => false,
- :only_trusted => false,
- :only_signed => false
- )
+ KEY_LENGTH = 2048
##
- # AlmostNo security policy: only verify that the signing certificate is the
- # one that actually signed the data. Make no attempt to verify the signing
- # certificate chain.
- #
- # This policy is basically useless. better than nothing, but can still be
- # easily spoofed, and is not recommended.
-
- AlmostNoSecurity = Policy.new(
- :verify_data => true,
- :verify_signer => false,
- :verify_chain => false,
- :verify_root => false,
- :only_trusted => false,
- :only_signed => false
- )
+ # Cipher used to encrypt the key pair used to sign gems.
+ # Must be in the list returned by OpenSSL::Cipher.ciphers
- ##
- # Low security policy: only verify that the signing certificate is actually
- # the gem signer, and that the signing certificate is valid.
- #
- # This policy is better than nothing, but can still be easily spoofed, and
- # is not recommended.
-
- LowSecurity = Policy.new(
- :verify_data => true,
- :verify_signer => true,
- :verify_chain => false,
- :verify_root => false,
- :only_trusted => false,
- :only_signed => false
- )
+ KEY_CIPHER = OpenSSL::Cipher.new('AES-256-CBC') if defined?(OpenSSL::Cipher)
##
- # Medium security policy: verify the signing certificate, verify the signing
- # certificate chain all the way to the root certificate, and only trust root
- # certificates that we have explicitly allowed trust for.
- #
- # This security policy is reasonable, but it allows unsigned packages, so a
- # malicious person could simply delete the package signature and pass the
- # gem off as unsigned.
-
- MediumSecurity = Policy.new(
- :verify_data => true,
- :verify_signer => true,
- :verify_chain => true,
- :verify_root => true,
- :only_trusted => true,
- :only_signed => false
- )
+ # One year in seconds
- ##
- # High security policy: only allow signed gems to be installed, verify the
- # signing certificate, verify the signing certificate chain all the way to
- # the root certificate, and only trust root certificates that we have
- # explicitly allowed trust for.
- #
- # This security policy is significantly more difficult to bypass, and offers
- # a reasonable guarantee that the contents of the gem have not been altered.
-
- HighSecurity = Policy.new(
- :verify_data => true,
- :verify_signer => true,
- :verify_chain => true,
- :verify_root => true,
- :only_trusted => true,
- :only_signed => true
- )
+ ONE_YEAR = 86400 * 365
##
- # Hash of configured security policies
-
- Policies = {
- 'NoSecurity' => NoSecurity,
- 'AlmostNoSecurity' => AlmostNoSecurity,
- 'LowSecurity' => LowSecurity,
- 'MediumSecurity' => MediumSecurity,
- 'HighSecurity' => HighSecurity,
+ # The default set of extensions are:
+ #
+ # * The certificate is not a certificate authority
+ # * The key for the certificate may be used for key and data encipherment
+ # and digital signatures
+ # * The certificate contains a subject key identifier
+
+ EXTENSIONS = {
+ 'basicConstraints' => 'CA:FALSE',
+ 'keyUsage' =>
+ 'keyEncipherment,dataEncipherment,digitalSignature',
+ 'subjectKeyIdentifier' => 'hash',
}
- ##
- # Sign the cert cert with @signing_key and @signing_cert, using the digest
- # algorithm opt[:dgst_algo]. Returns the newly signed certificate.
-
- def self.sign_cert(cert, signing_key, signing_cert, opt = {})
- opt = OPT.merge(opt)
+ def self.alt_name_or_x509_entry certificate, x509_entry
+ alt_name = certificate.extensions.find do |extension|
+ extension.oid == "#{x509_entry}AltName"
+ end
- cert.issuer = signing_cert.subject
- cert.sign signing_key, opt[:dgst_algo].new
+ return alt_name.value if alt_name
- cert
+ certificate.send x509_entry
end
##
- # Make sure the trust directory exists. If it does exist, make sure it's
- # actually a directory. If not, then create it with the appropriate
- # permissions.
-
- def self.verify_trust_dir(path, perms)
- # if the directory exists, then make sure it is in fact a directory. if
- # it doesn't exist, then create it with the appropriate permissions
- if File.exist?(path)
- # verify that the trust directory is actually a directory
- unless File.directory?(path)
- err = "trust directory #{path} isn't a directory"
- raise Gem::Security::Exception, err
- end
- else
- # trust directory doesn't exist, so create it with permissions
- FileUtils.mkdir_p(path)
- FileUtils.chmod(perms, path)
- end
- end
-
- ##
- # Build a certificate from the given DN and private key.
-
- def self.build_cert(name, key, opt = {})
- Gem.ensure_ssl_available
- opt = OPT.merge opt
+ # Creates an unsigned certificate for +subject+ and +key+. The lifetime of
+ # the key is from the current time to +age+ which defaults to one year.
+ #
+ # The +extensions+ restrict the key to the indicated uses.
+ def self.create_cert subject, key, age = ONE_YEAR, extensions = EXTENSIONS,
+ serial = 1
cert = OpenSSL::X509::Certificate.new
- cert.not_after = Time.now + opt[:cert_age]
- cert.not_before = Time.now
cert.public_key = key.public_key
- cert.serial = 0
- cert.subject = name
cert.version = 2
+ cert.serial = serial
+
+ cert.not_before = Time.now
+ cert.not_after = Time.now + age
+
+ cert.subject = subject
ef = OpenSSL::X509::ExtensionFactory.new nil, cert
- cert.extensions = opt[:cert_exts].map do |ext_name, value|
+ cert.extensions = extensions.map do |ext_name, value|
ef.create_extension ext_name, value
end
- i_key = opt[:issuer_key] || key
- i_cert = opt[:issuer_cert] || cert
-
- cert = sign_cert cert, i_key, i_cert, opt
-
cert
end
##
- # Build a self-signed certificate for the given email address.
+ # Creates a self-signed certificate with an issuer and subject from +email+,
+ # a subject alternative name of +email+ and the given +extensions+ for the
+ # +key+.
- def self.build_self_signed_cert(email_addr, opt = {})
- Gem.ensure_ssl_available
- opt = OPT.merge(opt)
- path = { :key => nil, :cert => nil }
+ def self.create_cert_email email, key, age = ONE_YEAR, extensions = EXTENSIONS
+ subject = email_to_name email
- name = email_to_name email_addr, opt[:munge_re]
+ extensions = extensions.merge "subjectAltName" => "email:#{email}"
- key = opt[:key_algo].new opt[:key_size]
-
- verify_trust_dir opt[:trust_dir], opt[:perms][:trust_dir]
-
- if opt[:save_key] then
- path[:key] = opt[:save_key_path] || (opt[:output_fmt] % 'private_key')
+ create_cert_self_signed subject, key, age, extensions
+ end
- open path[:key], 'wb' do |io|
- io.chmod opt[:perms][:signing_key]
- io.write key.to_pem
- end
- end
+ ##
+ # Creates a self-signed certificate with an issuer and subject of +subject+
+ # and the given +extensions+ for the +key+.
- cert = build_cert name, key, opt
+ def self.create_cert_self_signed subject, key, age = ONE_YEAR,
+ extensions = EXTENSIONS, serial = 1
+ certificate = create_cert subject, key, age, extensions
- if opt[:save_cert] then
- path[:cert] = opt[:save_cert_path] || (opt[:output_fmt] % 'public_cert')
+ sign certificate, key, certificate, age, extensions, serial
+ end
- open path[:cert], 'wb' do |file|
- file.chmod opt[:perms][:signing_cert]
- file.write cert.to_pem
- end
- end
+ ##
+ # Creates a new key pair of the specified +length+ and +algorithm+. The
+ # default is a 2048 bit RSA key.
- { :key => key, :cert => cert,
- :key_path => path[:key], :cert_path => path[:cert] }
+ def self.create_key length = KEY_LENGTH, algorithm = KEY_ALGORITHM
+ algorithm.new length
end
##
# Turns +email_address+ into an OpenSSL::X509::Name
- def self.email_to_name email_address, munge_re
+ def self.email_to_name email_address
+ email_address = email_address.gsub(/[^\w@.-]+/i, '_')
+
cn, dcs = email_address.split '@'
dcs = dcs.split '.'
- cn = cn.gsub munge_re, '_'
+ name = "CN=#{cn}/#{dcs.map { |dc| "DC=#{dc}" }.join '/'}"
- dcs = dcs.map do |dc|
- dc.gsub munge_re, '_'
+ OpenSSL::X509::Name.parse name
+ end
+
+ ##
+ # Signs +expired_certificate+ with +private_key+ if the keys match and the
+ # expired certificate was self-signed.
+ #--
+ # TODO increment serial
+
+ def self.re_sign expired_certificate, private_key, age = ONE_YEAR,
+ extensions = EXTENSIONS
+ raise Gem::Security::Exception,
+ "incorrect signing key for re-signing " +
+ "#{expired_certificate.subject}" unless
+ expired_certificate.public_key.to_pem == private_key.public_key.to_pem
+
+ unless expired_certificate.subject.to_s ==
+ expired_certificate.issuer.to_s then
+ subject = alt_name_or_x509_entry expired_certificate, :subject
+ issuer = alt_name_or_x509_entry expired_certificate, :issuer
+
+ raise Gem::Security::Exception,
+ "#{subject} is not self-signed, contact #{issuer} " +
+ "to obtain a valid certificate"
end
- name = "CN=#{cn}/" << dcs.map { |dc| "DC=#{dc}" }.join('/')
+ serial = expired_certificate.serial + 1
- OpenSSL::X509::Name.parse name
+ create_cert_self_signed(expired_certificate.subject, private_key, age,
+ extensions, serial)
end
##
- # Add certificate to trusted cert list.
+ # Resets the trust directory for verifying gems.
+
+ def self.reset
+ @trust_dir = nil
+ end
+
+ ##
+ # Sign the public key from +certificate+ with the +signing_key+ and
+ # +signing_cert+, using the Gem::Security::DIGEST_ALGORITHM. Uses the
+ # default certificate validity range and extensions.
#
- # Note: At the moment these are stored in OPT[:trust_dir], although that
- # directory may change in the future.
+ # Returns the newly signed certificate.
- def self.add_trusted_cert(cert, opt = {})
- opt = OPT.merge(opt)
+ def self.sign certificate, signing_key, signing_cert,
+ age = ONE_YEAR, extensions = EXTENSIONS, serial = 1
+ signee_subject = certificate.subject
+ signee_key = certificate.public_key
- # get destination path
- path = Gem::Security::Policy.trusted_cert_path(cert, opt)
+ alt_name = certificate.extensions.find do |extension|
+ extension.oid == 'subjectAltName'
+ end
- # verify trust directory (can't write to nowhere, you know)
- verify_trust_dir(opt[:trust_dir], opt[:perms][:trust_dir])
+ extensions = extensions.merge 'subjectAltName' => alt_name.value if
+ alt_name
- # write cert to output file
- File.open(path, 'wb') do |file|
- file.chmod(opt[:perms][:trusted_cert])
- file.write(cert.to_pem)
+ issuer_alt_name = signing_cert.extensions.find do |extension|
+ extension.oid == 'subjectAltName'
end
- # return nil
- nil
+ extensions = extensions.merge 'issuerAltName' => issuer_alt_name.value if
+ issuer_alt_name
+
+ signed = create_cert signee_subject, signee_key, age, extensions, serial
+ signed.issuer = signing_cert.subject
+
+ signed.sign signing_key, Gem::Security::DIGEST_ALGORITHM.new
end
##
- # Basic OpenSSL-based package signing class.
+ # Returns a Gem::Security::TrustDir which wraps the directory where trusted
+ # certificates live.
- class Signer
+ def self.trust_dir
+ return @trust_dir if @trust_dir
- attr_accessor :cert_chain
- attr_accessor :key
+ dir = File.join Gem.user_home, '.gem', 'trust'
- def initialize(key, cert_chain)
- Gem.ensure_ssl_available
- @algo = Gem::Security::OPT[:dgst_algo]
- @key, @cert_chain = key, cert_chain
+ @trust_dir ||= Gem::Security::TrustDir.new dir
+ end
- # check key, if it's a file, and if it's key, leave it alone
- if @key && !@key.kind_of?(OpenSSL::PKey::PKey)
- @key = OpenSSL::PKey::RSA.new(File.read(@key))
- end
+ ##
+ # Enumerates the trusted certificates via Gem::Security::TrustDir.
+
+ def self.trusted_certificates &block
+ trust_dir.each_certificate(&block)
+ end
- # check cert chain, if it's a file, load it, if it's cert data, convert
- # it into a cert object, and if it's a cert object, leave it alone
- if @cert_chain
- @cert_chain = @cert_chain.map do |cert|
- # check cert, if it's a file, load it, if it's cert data, convert it
- # into a cert object, and if it's a cert object, leave it alone
- if cert && !cert.kind_of?(OpenSSL::X509::Certificate)
- cert = File.read(cert) if File::exist?(cert)
- cert = OpenSSL::X509::Certificate.new(cert)
- end
- cert
- end
+ ##
+ # Writes +pemmable+, which must respond to +to_pem+ to +path+ with the given
+ # +permissions+. If passed +cipher+ and +passphrase+ those arguments will be
+ # passed to +to_pem+.
+
+ def self.write pemmable, path, permissions = 0600, passphrase = nil, cipher = KEY_CIPHER
+ path = File.expand_path path
+
+ open path, 'wb', permissions do |io|
+ if passphrase and cipher
+ io.write pemmable.to_pem cipher, passphrase
+ else
+ io.write pemmable.to_pem
end
end
- ##
- # Sign data with given digest algorithm
+ path
+ end
- def sign(data)
- @key.sign(@algo.new, data)
- end
+ reset
- end
+end
+if defined?(OpenSSL::SSL) then
+ require 'rubygems/security/policy'
+ require 'rubygems/security/policies'
+ require 'rubygems/security/trust_dir'
end
+require 'rubygems/security/signer'
+
diff --git a/lib/rubygems/security/policies.rb b/lib/rubygems/security/policies.rb
new file mode 100644
index 0000000000..a976ecaf59
--- /dev/null
+++ b/lib/rubygems/security/policies.rb
@@ -0,0 +1,115 @@
+module Gem::Security
+
+ ##
+ # No security policy: all package signature checks are disabled.
+
+ NoSecurity = Policy.new(
+ 'No Security',
+ :verify_data => false,
+ :verify_signer => false,
+ :verify_chain => false,
+ :verify_root => false,
+ :only_trusted => false,
+ :only_signed => false
+ )
+
+ ##
+ # AlmostNo security policy: only verify that the signing certificate is the
+ # one that actually signed the data. Make no attempt to verify the signing
+ # certificate chain.
+ #
+ # This policy is basically useless. better than nothing, but can still be
+ # easily spoofed, and is not recommended.
+
+ AlmostNoSecurity = Policy.new(
+ 'Almost No Security',
+ :verify_data => true,
+ :verify_signer => false,
+ :verify_chain => false,
+ :verify_root => false,
+ :only_trusted => false,
+ :only_signed => false
+ )
+
+ ##
+ # Low security policy: only verify that the signing certificate is actually
+ # the gem signer, and that the signing certificate is valid.
+ #
+ # This policy is better than nothing, but can still be easily spoofed, and
+ # is not recommended.
+
+ LowSecurity = Policy.new(
+ 'Low Security',
+ :verify_data => true,
+ :verify_signer => true,
+ :verify_chain => false,
+ :verify_root => false,
+ :only_trusted => false,
+ :only_signed => false
+ )
+
+ ##
+ # Medium security policy: verify the signing certificate, verify the signing
+ # certificate chain all the way to the root certificate, and only trust root
+ # certificates that we have explicitly allowed trust for.
+ #
+ # This security policy is reasonable, but it allows unsigned packages, so a
+ # malicious person could simply delete the package signature and pass the
+ # gem off as unsigned.
+
+ MediumSecurity = Policy.new(
+ 'Medium Security',
+ :verify_data => true,
+ :verify_signer => true,
+ :verify_chain => true,
+ :verify_root => true,
+ :only_trusted => true,
+ :only_signed => false
+ )
+
+ ##
+ # High security policy: only allow signed gems to be installed, verify the
+ # signing certificate, verify the signing certificate chain all the way to
+ # the root certificate, and only trust root certificates that we have
+ # explicitly allowed trust for.
+ #
+ # This security policy is significantly more difficult to bypass, and offers
+ # a reasonable guarantee that the contents of the gem have not been altered.
+
+ HighSecurity = Policy.new(
+ 'High Security',
+ :verify_data => true,
+ :verify_signer => true,
+ :verify_chain => true,
+ :verify_root => true,
+ :only_trusted => true,
+ :only_signed => true
+ )
+
+ ##
+ # Policy used to verify a certificate and key when signing a gem
+
+ SigningPolicy = Policy.new(
+ 'Signing Policy',
+ :verify_data => false,
+ :verify_signer => true,
+ :verify_chain => true,
+ :verify_root => true,
+ :only_trusted => false,
+ :only_signed => false
+ )
+
+ ##
+ # Hash of configured security policies
+
+ Policies = {
+ 'NoSecurity' => NoSecurity,
+ 'AlmostNoSecurity' => AlmostNoSecurity,
+ 'LowSecurity' => LowSecurity,
+ 'MediumSecurity' => MediumSecurity,
+ 'HighSecurity' => HighSecurity,
+ # SigningPolicy is not intended for use by `gem -P` so do not list it
+ }
+
+end
+
diff --git a/lib/rubygems/security/policy.rb b/lib/rubygems/security/policy.rb
new file mode 100644
index 0000000000..7238b2e477
--- /dev/null
+++ b/lib/rubygems/security/policy.rb
@@ -0,0 +1,294 @@
+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
+# instance of this or use one of the preset security policies in
+# Gem::Security::Policies.
+
+class Gem::Security::Policy
+
+ include Gem::UserInteraction
+
+ attr_reader :name
+
+ attr_accessor :only_signed
+ attr_accessor :only_trusted
+ attr_accessor :verify_chain
+ attr_accessor :verify_data
+ attr_accessor :verify_root
+ attr_accessor :verify_signer
+
+ ##
+ # Create a new Gem::Security::Policy object with the given mode and
+ # options.
+
+ def initialize name, policy = {}, opt = {}
+ require 'openssl'
+
+ @name = name
+
+ @opt = opt
+
+ # Default to security
+ @only_signed = true
+ @only_trusted = true
+ @verify_chain = true
+ @verify_data = true
+ @verify_root = true
+ @verify_signer = true
+
+ policy.each_pair do |key, val|
+ case key
+ when :verify_data then @verify_data = val
+ when :verify_signer then @verify_signer = val
+ when :verify_chain then @verify_chain = val
+ when :verify_root then @verify_root = val
+ when :only_trusted then @only_trusted = val
+ when :only_signed then @only_signed = val
+ end
+ end
+ end
+
+ ##
+ # Verifies each certificate in +chain+ has signed the following certificate
+ # and is valid for the given +time+.
+
+ def check_chain chain, time
+ raise Gem::Security::Exception, 'missing signing chain' unless chain
+ raise Gem::Security::Exception, 'empty signing chain' if chain.empty?
+
+ begin
+ chain.each_cons 2 do |issuer, cert|
+ check_cert cert, issuer, time
+ end
+
+ true
+ rescue Gem::Security::Exception => e
+ raise Gem::Security::Exception, "invalid signing chain: #{e.message}"
+ end
+ end
+
+ ##
+ # Verifies that +data+ matches the +signature+ created by +public_key+ and
+ # the +digest+ algorithm.
+
+ def check_data public_key, digest, signature, data
+ raise Gem::Security::Exception, "invalid signature" unless
+ public_key.verify digest.new, signature, data.digest
+
+ true
+ end
+
+ ##
+ # Ensures that +signer+ is valid for +time+ and was signed by the +issuer+.
+ # If the +issuer+ is +nil+ no verification is performed.
+
+ def check_cert signer, issuer, time
+ raise Gem::Security::Exception, 'missing signing certificate' unless
+ signer
+
+ message = "certificate #{signer.subject}"
+
+ if not_before = signer.not_before and not_before > time then
+ raise Gem::Security::Exception,
+ "#{message} not valid before #{not_before}"
+ end
+
+ if not_after = signer.not_after and not_after < time then
+ raise Gem::Security::Exception, "#{message} not valid after #{not_after}"
+ end
+
+ if issuer and not signer.verify issuer.public_key then
+ raise Gem::Security::Exception,
+ "#{message} was not issued by #{issuer.subject}"
+ end
+
+ true
+ end
+
+ ##
+ # Ensures the public key of +key+ matches the public key in +signer+
+
+ def check_key signer, key
+ unless signer and key then
+ return true unless @only_signed
+
+ raise Gem::Security::Exception, 'missing key or signature'
+ end
+
+ raise Gem::Security::Exception,
+ "certificate #{signer.subject} does not match the signing key" unless
+ signer.public_key.to_pem == key.public_key.to_pem
+
+ true
+ end
+
+ ##
+ # Ensures the root certificate in +chain+ is self-signed and valid for
+ # +time+.
+
+ def check_root chain, time
+ raise Gem::Security::Exception, 'missing signing chain' unless chain
+
+ root = chain.first
+
+ raise Gem::Security::Exception, 'missing root certificate' unless root
+
+ raise Gem::Security::Exception,
+ "root certificate #{root.subject} is not self-signed " +
+ "(issuer #{root.issuer})" if
+ root.issuer.to_s != root.subject.to_s # HACK to_s is for ruby 1.8
+
+ check_cert root, root, time
+ end
+
+ ##
+ # Ensures the root of +chain+ has a trusted certificate in +trust_dir+ and
+ # the digests of the two certificates match according to +digester+
+
+ def check_trust chain, digester, trust_dir
+ raise Gem::Security::Exception, 'missing signing chain' unless chain
+
+ root = chain.first
+
+ raise Gem::Security::Exception, 'missing root certificate' unless root
+
+ path = Gem::Security.trust_dir.cert_path root
+
+ unless File.exist? path then
+ message = "root cert #{root.subject} is not trusted"
+
+ message << " (root of signing cert #{chain.last.subject})" if
+ chain.length > 1
+
+ raise Gem::Security::Exception, message
+ end
+
+ save_cert = OpenSSL::X509::Certificate.new File.read path
+ save_dgst = digester.digest save_cert.public_key.to_s
+
+ pkey_str = root.public_key.to_s
+ cert_dgst = digester.digest pkey_str
+
+ raise Gem::Security::Exception,
+ "trusted root certificate #{root.subject} checksum " +
+ "does not match signing root certificate checksum" unless
+ save_dgst == cert_dgst
+
+ 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]") % [
+ @name, @verify_chain, @verify_data, @verify_root, @verify_signer,
+ @only_signed, @only_trusted,
+ ]
+ end
+
+ ##
+ # 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 = {},
+ 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"
+ end
+ end
+
+ opt = @opt
+ digester = Gem::Security::DIGEST_ALGORITHM
+ trust_dir = opt[:trust_dir]
+ time = Time.now
+
+ _, signer_digests = digests.find do |algorithm, file_digests|
+ file_digests.values.first.name == Gem::Security::DIGEST_NAME
+ end
+
+ if @verify_data then
+ raise Gem::Security::Exception, 'no digests provided (probable bug)' if
+ signer_digests.nil? or signer_digests.empty?
+ else
+ signer_digests = {}
+ end
+
+ signer = chain.last
+
+ check_key signer, key if key
+
+ check_cert signer, nil, time if @verify_signer
+
+ check_chain chain, time if @verify_chain
+
+ check_root chain, time if @verify_root
+
+ 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]
+
+ raise Gem::Security::Exception, "missing digest for #{file}" unless
+ digest
+ end
+
+ signer_digests.each do |file, digest|
+ signature = signatures[file]
+
+ raise Gem::Security::Exception, "missing signature for #{file}" unless
+ signature
+
+ check_data signer.public_key, digester, signature, digest if @verify_data
+ end
+
+ true
+ end
+
+ ##
+ # Extracts the certificate chain from the +spec+ and calls #verify to ensure
+ # the signatures and certificate chain is valid according to the policy..
+
+ def verify_signatures spec, digests, signatures
+ chain = spec.cert_chain.map do |cert_pem|
+ OpenSSL::X509::Certificate.new cert_pem
+ end
+
+ verify chain, nil, digests, signatures, spec.full_name
+
+ true
+ end
+
+ alias to_s name # :nodoc:
+
+end
+
diff --git a/lib/rubygems/security/signer.rb b/lib/rubygems/security/signer.rb
new file mode 100644
index 0000000000..bb1eae7cf2
--- /dev/null
+++ b/lib/rubygems/security/signer.rb
@@ -0,0 +1,154 @@
+##
+# Basic OpenSSL-based package signing class.
+
+class Gem::Security::Signer
+
+ ##
+ # The chain of certificates for signing including the signing certificate
+
+ attr_accessor :cert_chain
+
+ ##
+ # The private key for the signing certificate
+
+ attr_accessor :key
+
+ ##
+ # The digest algorithm used to create the signature
+
+ attr_reader :digest_algorithm
+
+ ##
+ # The name of the digest algorithm, used to pull digests out of the hash by
+ # name.
+
+ attr_reader :digest_name # :nodoc:
+
+ ##
+ # Creates a new signer with an RSA +key+ or path to a key, and a certificate
+ # +chain+ containing X509 certificates, encoding certificates or paths to
+ # certificates.
+
+ def initialize key, cert_chain, passphrase = nil
+ @cert_chain = cert_chain
+ @key = key
+
+ unless @key then
+ default_key = File.join Gem.default_key_path
+ @key = default_key if File.exist? default_key
+ end
+
+ unless @cert_chain then
+ default_cert = File.join Gem.default_cert_path
+ @cert_chain = [default_cert] if File.exist? default_cert
+ end
+
+ @digest_algorithm = Gem::Security::DIGEST_ALGORITHM
+ @digest_name = Gem::Security::DIGEST_NAME
+
+ @key = OpenSSL::PKey::RSA.new File.read(@key), passphrase if
+ @key and not OpenSSL::PKey::RSA === @key
+
+ if @cert_chain then
+ @cert_chain = @cert_chain.compact.map do |cert|
+ next cert if OpenSSL::X509::Certificate === cert
+
+ cert = File.read cert if File.exist? cert
+
+ OpenSSL::X509::Certificate.new cert
+ end
+
+ load_cert_chain
+ end
+ 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.
+
+ def load_cert_chain # :nodoc:
+ return if @cert_chain.empty?
+
+ while @cert_chain.first.issuer.to_s != @cert_chain.first.subject.to_s do
+ issuer = Gem::Security.trust_dir.issuer_of @cert_chain.first
+
+ break unless issuer # cert chain is verified later
+
+ @cert_chain.unshift issuer
+ end
+ end
+
+ ##
+ # Sign data with given digest algorithm
+
+ def sign data
+ return unless @key
+
+ if @cert_chain.length == 1 and @cert_chain.last.not_after < Time.now then
+ re_sign_key
+ end
+
+ full_name = extract_name @cert_chain.last
+
+ Gem::Security::SigningPolicy.verify @cert_chain, @key, {}, {}, full_name
+
+ @key.sign @digest_algorithm.new, data
+ end
+
+ ##
+ # Attempts to re-sign the private key if the signing certificate is expired.
+ #
+ # The key will be re-signed if:
+ # * The expired certificate is self-signed
+ # * The expired certificate is saved at ~/.gem/gem-public_cert.pem
+ # * There is no file matching the expiry date at
+ # ~/.gem/gem-public_cert.pem.expired.%Y%m%d%H%M%S
+ #
+ # If the signing certificate can be re-signed the expired certificate will
+ # be saved as ~/.gem/gem-pubilc_cert.pem.expired.%Y%m%d%H%M%S where the
+ # expiry time (not after) is used for the timestamp.
+
+ def re_sign_key # :nodoc:
+ old_cert = @cert_chain.last
+
+ disk_cert_path = File.join Gem.default_cert_path
+ disk_cert = File.read disk_cert_path rescue nil
+ disk_key =
+ File.read File.join(Gem.default_key_path) rescue nil
+
+ if disk_key == @key.to_pem and disk_cert == old_cert.to_pem then
+ expiry = old_cert.not_after.strftime '%Y%m%d%H%M%S'
+ old_cert_file = "gem-public_cert.pem.expired.#{expiry}"
+ old_cert_path = File.join Gem.user_home, ".gem", old_cert_file
+
+ unless File.exist? old_cert_path then
+ Gem::Security.write old_cert, old_cert_path
+
+ cert = Gem::Security.re_sign old_cert, @key
+
+ Gem::Security.write cert, disk_cert_path
+
+ @cert_chain = [cert]
+ end
+ end
+ end
+
+end
+
diff --git a/lib/rubygems/security/trust_dir.rb b/lib/rubygems/security/trust_dir.rb
new file mode 100644
index 0000000000..dd51308ee5
--- /dev/null
+++ b/lib/rubygems/security/trust_dir.rb
@@ -0,0 +1,104 @@
+class Gem::Security::TrustDir
+
+ DEFAULT_PERMISSIONS = {
+ :trust_dir => 0700,
+ :trusted_cert => 0600,
+ }
+
+ def initialize dir, permissions = DEFAULT_PERMISSIONS
+ @dir = dir
+ @permissions = permissions
+
+ @digester = Gem::Security::DIGEST_ALGORITHM
+ end
+
+ attr_reader :dir
+
+ ##
+ # Returns the path to the trusted +certificate+
+
+ def cert_path certificate
+ name_path certificate.subject
+ end
+
+ ##
+ # Enumerates trusted certificates.
+
+ def each_certificate
+ return enum_for __method__ unless block_given?
+
+ glob = File.join @dir, '*.pem'
+
+ Dir[glob].each do |certificate_file|
+ begin
+ certificate = load_certificate certificate_file
+
+ yield certificate, certificate_file
+ rescue OpenSSL::X509::CertificateError
+ next # HACK warn
+ end
+ end
+ end
+
+ ##
+ # Returns the issuer certificate of the given +certificate+ if it exists in
+ # the trust directory.
+
+ def issuer_of certificate
+ path = name_path certificate.issuer
+
+ return unless File.exist? path
+
+ load_certificate path
+ end
+
+ ##
+ # Returns the path to the trusted certificate with the given ASN.1 +name+
+
+ def name_path name
+ digest = @digester.hexdigest name.to_s
+
+ File.join @dir, "cert-#{digest}.pem"
+ end
+
+ ##
+ # Loads the given +certificate_file+
+
+ def load_certificate certificate_file
+ pem = File.read certificate_file
+
+ OpenSSL::X509::Certificate.new pem
+ end
+
+ ##
+ # Add a certificate to trusted certificate list.
+
+ def trust_cert certificate
+ verify
+
+ destination = cert_path certificate
+
+ open destination, 'wb', @permissions[:trusted_cert] do |io|
+ io.write certificate.to_pem
+ end
+ end
+
+ ##
+ # Make sure the trust directory exists. If it does exist, make sure it's
+ # actually a directory. If not, then create it with the appropriate
+ # permissions.
+
+ def verify
+ if File.exist? @dir then
+ raise Gem::Security::Exception,
+ "trust directory #{@dir} is not a directory" unless
+ File.directory? @dir
+
+ FileUtils.chmod 0700, @dir
+ else
+ FileUtils.mkdir_p @dir, :mode => @permissions[:trust_dir]
+ end
+ end
+
+end
+
diff --git a/lib/rubygems/server.rb b/lib/rubygems/server.rb
index 47fa7c562d..ca6dc683f5 100644
--- a/lib/rubygems/server.rb
+++ b/lib/rubygems/server.rb
@@ -3,7 +3,7 @@ require 'zlib'
require 'erb'
require 'rubygems'
-require 'rubygems/doc_manager'
+require 'rubygems/rdoc'
##
# Gem::Server and allows users to serve gems for consumption by
@@ -17,9 +17,6 @@ require 'rubygems/doc_manager'
# * "/quick/" - Individual gemspecs
# * "/gems" - Direct access to download the installable gems
# * "/rdoc?q=" - Search for installed rdoc documentation
-# * legacy indexes:
-# * "/Marshal.#{Gem.marshal_version}" - Full SourceIndex dump of metadata
-# for installed gems
#
# == Usage
#
@@ -82,7 +79,9 @@ class Gem::Server
<b><%=spec["name"]%> <%=spec["version"]%></b>
- <% if spec["rdoc_installed"] then %>
+ <% if spec["ri_installed"] then %>
+ <a href="<%=spec["doc_path"]%>">[rdoc]</a>
+ <% elsif spec["rdoc_installed"] then %>
<a href="<%=spec["doc_path"]%>">[rdoc]</a>
<% else %>
<span title="rdoc not installed">[rdoc]</span>
@@ -430,63 +429,48 @@ div.method-source-code pre { color: #ffdead; overflow: hidden; }
options[:launch], options[:addresses]).run
end
- ##
- # Only the first directory in gem_dirs is used for serving gems
-
def initialize(gem_dirs, port, daemon, launch = nil, addresses = nil)
+ Gem::RDoc.load_rdoc
Socket.do_not_reverse_lookup = true
- @gem_dirs = Array gem_dirs
- @port = port
- @daemon = daemon
- @launch = launch
+ @gem_dirs = Array gem_dirs
+ @port = port
+ @daemon = daemon
+ @launch = launch
@addresses = addresses
- logger = WEBrick::Log.new nil, WEBrick::BasicLog::FATAL
- @server = WEBrick::HTTPServer.new :DoNotListen => true, :Logger => logger
- @spec_dirs = @gem_dirs.map do |gem_dir|
- spec_dir = File.join gem_dir, 'specifications'
+ logger = WEBrick::Log.new nil, WEBrick::BasicLog::FATAL
+ @server = WEBrick::HTTPServer.new :DoNotListen => true, :Logger => logger
- unless File.directory? spec_dir then
- raise ArgumentError, "#{gem_dir} does not appear to be a gem repository"
- end
+ @spec_dirs = @gem_dirs.map { |gem_dir| File.join gem_dir, 'specifications' }
+ @spec_dirs.reject! { |spec_dir| !File.directory? spec_dir }
- spec_dir
- end
+ reset_gems
- Gem::Specification.dirs = @gem_dirs
+ @have_rdoc_4_plus = nil
end
- def Marshal(req, res)
- Gem::Specification.reset
-
- add_date res
-
- index = Gem::Deprecate.skip_during { Marshal.dump Gem.source_index }
-
- if req.request_method == 'HEAD' then
- res['content-length'] = index.length
- return
- end
+ def add_date res
+ res['date'] = @spec_dirs.map do |spec_dir|
+ File.stat(spec_dir).mtime
+ end.max
+ end
- if req.path =~ /Z$/ then
- res['content-type'] = 'application/x-deflate'
- index = Gem.deflate index
+ def doc_root gem_name
+ if have_rdoc_4_plus? then
+ "/doc_root/#{gem_name}/"
else
- res['content-type'] = 'application/octet-stream'
+ "/doc_root/#{gem_name}/rdoc/index.html"
end
-
- res.body << index
end
- def add_date res
- res['date'] = @spec_dirs.map do |spec_dir|
- File.stat(spec_dir).mtime
- end.max
+ def have_rdoc_4_plus?
+ @have_rdoc_4_plus ||=
+ Gem::Requirement.new('>= 4.0.0.preview2').satisfied_by? Gem::RDoc.rdoc_version
end
def latest_specs(req, res)
- Gem::Specification.reset
+ reset_gems
res['content-type'] = 'application/x-gzip'
@@ -547,7 +531,7 @@ div.method-source-code pre { color: #ffdead; overflow: hidden; }
end
def quick(req, res)
- Gem::Specification.reset
+ reset_gems
res['content-type'] = 'text/plain'
add_date res
@@ -583,7 +567,8 @@ div.method-source-code pre { color: #ffdead; overflow: hidden; }
end
def root(req, res)
- Gem::Specification.reset
+ reset_gems
+
add_date res
raise WEBrick::HTTPStatus::NotFound, "`#{req.path}' not found." unless
@@ -614,14 +599,15 @@ div.method-source-code pre { color: #ffdead; overflow: hidden; }
"authors" => spec.authors.sort.join(", "),
"date" => spec.date.to_s,
"dependencies" => deps,
- "doc_path" => "/doc_root/#{spec.full_name}/rdoc/index.html",
+ "doc_path" => doc_root(spec.full_name),
"executables" => executables,
"only_one_executable" => (executables && executables.size == 1),
"full_name" => spec.full_name,
"has_deps" => !deps.empty?,
"homepage" => spec.homepage,
"name" => spec.name,
- "rdoc_installed" => Gem::DocManager.new(spec).rdoc_installed?,
+ "rdoc_installed" => Gem::RDoc.new(spec).rdoc_installed?,
+ "ri_installed" => Gem::RDoc.new(spec).ri_installed?,
"summary" => spec.summary,
"version" => spec.version.to_s,
}
@@ -630,14 +616,14 @@ div.method-source-code pre { color: #ffdead; overflow: hidden; }
specs << {
"authors" => "Chad Fowler, Rich Kilmer, Jim Weirich, Eric Hodel and others",
"dependencies" => [],
- "doc_path" => "/doc_root/rubygems-#{Gem::VERSION}/rdoc/index.html",
+ "doc_path" => doc_root("rubygems-#{Gem::VERSION}"),
"executables" => [{"executable" => 'gem', "is_last" => true}],
"only_one_executable" => true,
"full_name" => "rubygems-#{Gem::VERSION}",
"has_deps" => false,
"homepage" => "http://docs.rubygems.org/",
"name" => 'rubygems',
- "rdoc_installed" => true,
+ "ri_installed" => true,
"summary" => "RubyGems itself",
"version" => Gem::VERSION,
}
@@ -685,13 +671,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
#
@@ -713,11 +699,18 @@ div.method-source-code pre { color: #ffdead; overflow: hidden; }
end
##
+ # Updates the server to use the latest installed gems.
+
+ def reset_gems # :nodoc:
+ Gem::Specification.dirs = @gem_dirs
+ end
+
+ ##
# Returns true and prepares http response, if rdoc for the requested gem
# 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)
@@ -730,15 +723,15 @@ div.method-source-code pre { color: #ffdead; overflow: hidden; }
when 1
new_path = File.basename(found_gems[0])
res.status = 302
- res['Location'] = "/doc_root/#{new_path}/rdoc/index.html"
+ res['Location'] = doc_root new_path
return true
else
doc_items = []
found_gems.each do |file_name|
base_name = File.basename(file_name)
doc_items << {
- :name => base_name,
- :url => "/doc_root/#{base_name}/rdoc/index.html",
+ :name => base_name,
+ :url => doc_root(new_path),
:summary => ''
}
end
@@ -756,9 +749,6 @@ div.method-source-code pre { color: #ffdead; overflow: hidden; }
WEBrick::Daemon.start if @daemon
- @server.mount_proc "/Marshal.#{Gem.marshal_version}", method(:Marshal)
- @server.mount_proc "/Marshal.#{Gem.marshal_version}.Z", method(:Marshal)
-
@server.mount_proc "/specs.#{Gem.marshal_version}", method(:specs)
@server.mount_proc "/specs.#{Gem.marshal_version}.gz", method(:specs)
@@ -779,10 +769,21 @@ div.method-source-code pre { color: #ffdead; overflow: hidden; }
@server.mount_proc "/rdoc", method(:rdoc)
- paths = { "/gems" => "/cache/", "/doc_root" => "/doc/" }
- paths.each do |mount_point, mount_dir|
- @server.mount(mount_point, WEBrick::HTTPServlet::FileHandler,
- File.join(@gem_dirs.first, mount_dir), true)
+ file_handlers = {
+ '/gems' => '/cache/',
+ }
+
+ if have_rdoc_4_plus? then
+ @server.mount '/doc_root', RDoc::Servlet, '/doc_root'
+ else
+ file_handlers['/doc_root'] = '/doc/'
+ end
+
+ @gem_dirs.each do |gem_dir|
+ file_handlers.each do |mount_point, mount_dir|
+ @server.mount(mount_point, WEBrick::HTTPServlet::FileHandler,
+ File.join(gem_dir, mount_dir), true)
+ end
end
trap("INT") { @server.shutdown; exit! }
@@ -794,7 +795,7 @@ div.method-source-code pre { color: #ffdead; overflow: hidden; }
end
def specs(req, res)
- Gem::Specification.reset
+ reset_gems
add_date res
diff --git a/lib/rubygems/source.rb b/lib/rubygems/source.rb
new file mode 100644
index 0000000000..b6e2d97523
--- /dev/null
+++ b/lib/rubygems/source.rb
@@ -0,0 +1,217 @@
+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
+
+ 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)
+ end
+
+ @uri = uri
+ @api_uri = nil
+ end
+
+ ##
+ # Use an SRV record on the host to look up the true endpoint for the index.
+
+ 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)
+ case other
+ when Gem::Source::Installed,
+ Gem::Source::Local,
+ 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
+
+ @uri.to_s <=> other.uri.to_s
+ else
+ nil
+ end
+ end
+
+ def == other # :nodoc:
+ self.class === other and @uri == other.uri
+ end
+
+ alias_method :eql?, :== # :nodoc:
+
+ ##
+ # Returns a Set that can fetch specifications from this source.
+
+ def dependency_resolver_set # :nodoc:
+ bundler_api_uri = api_uri + './api/v1/dependencies'
+
+ begin
+ fetcher = Gem::RemoteFetcher.fetcher
+ fetcher.fetch_path bundler_api_uri, nil, true
+ rescue Gem::RemoteFetcher::FetchError
+ Gem::Resolver::IndexSet.new self
+ else
+ Gem::Resolver::APISet.new bundler_api_uri
+ end
+ end
+
+ def hash # :nodoc:
+ @uri.hash
+ end
+
+ ##
+ # Returns the local directory to write +uri+ to.
+
+ def cache_dir(uri)
+ # Correct for windows paths
+ escaped_path = uri.path.sub(/^\/([a-z]):\//i, '/\\1-/')
+ 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
+ File.stat(Gem.user_home).uid == Process.uid
+ rescue Errno::ENOENT
+ false
+ end
+ end
+
+ ##
+ # Fetches a specification for the given +name_tuple+.
+
+ def fetch_spec name_tuple
+ fetcher = Gem::RemoteFetcher.fetcher
+
+ spec_file_name = name_tuple.spec_name
+
+ uri = api_uri + "#{Gem::MARSHAL_SPEC_DIR}#{spec_file_name}"
+
+ cache_dir = cache_dir uri
+
+ local_spec = File.join cache_dir, spec_file_name
+
+ if File.exist? local_spec then
+ spec = Gem.read_binary local_spec
+ spec = Marshal.load(spec) rescue nil
+ return spec if spec
+ end
+
+ uri.path << '.rz'
+
+ spec = fetcher.fetch_path uri
+ spec = Gem.inflate spec
+
+ if update_cache? then
+ FileUtils.mkdir_p cache_dir
+
+ open local_spec, 'wb' do |io|
+ io.write spec
+ end
+ end
+
+ # TODO: Investigate setting Gem::Specification#loaded_from to a URI
+ Marshal.load spec
+ end
+
+ ##
+ # Loads +type+ kind of specs fetching from +@uri+ if the on-disk cache is
+ # out of date.
+ #
+ # +type+ is one of the following:
+ #
+ # :released => Return the list of all released specs
+ # :latest => Return the list of only the highest version of each gem
+ # :prerelease => Return the list of all prerelease only specs
+ #
+
+ def load_specs(type)
+ file = FILES[type]
+ fetcher = Gem::RemoteFetcher.fetcher
+ file_name = "#{file}.#{Gem.marshal_version}"
+ spec_path = api_uri + "#{file_name}.gz"
+ cache_dir = cache_dir spec_path
+ local_file = File.join(cache_dir, file_name)
+ retried = false
+
+ FileUtils.mkdir_p cache_dir if update_cache?
+
+ spec_dump = fetcher.cache_update_path spec_path, local_file, update_cache?
+
+ begin
+ Gem::NameTuple.from_list Marshal.load(spec_dump)
+ rescue ArgumentError
+ if update_cache? && !retried
+ FileUtils.rm local_file
+ retried = true
+ retry
+ else
+ raise Gem::Exception.new("Invalid spec cache file in #{local_file}")
+ end
+ 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, 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.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/vendor'
+
diff --git a/lib/rubygems/source/git.rb b/lib/rubygems/source/git.rb
new file mode 100644
index 0000000000..c4f2724645
--- /dev/null
+++ b/lib/rubygems/source/git.rb
@@ -0,0 +1,186 @@
+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
+#
+# spec = source.load_spec 'rake'
+#
+# source.checkout
+
+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
+
+ ##
+ # The git repository this gem is sourced from.
+
+ attr_reader :repository
+
+ ##
+ # 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(nil)
+
+ @name = name
+ @repository = repository
+ @reference = reference
+ @need_submodules = submodules
+
+ @git = ENV['git'] || 'git'
+ end
+
+ def <=> other
+ case other
+ when Gem::Source::Git then
+ 0
+ when Gem::Source::Installed 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
+
+ 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', @reference
+
+ success &&=
+ system @git, 'submodule', 'update',
+ '--quiet', '--init', '--recursive', out: IO::NULL if @need_submodules
+
+ success
+ end
+ end
+
+ ##
+ # Creates a local cache repository for the git gem.
+
+ def cache # :nodoc:
+ 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
+
+ ##
+ # 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:
+ File.join Gem.dir, 'bundler', 'gems', "#{@name}-#{dir_shortref}"
+ end
+
+ ##
+ # The directory where the git gem's repository will be cached.
+
+ def repo_cache_dir # :nodoc:
+ File.join Gem.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
+
+ 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
+ Gem::Specification.load file
+ 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..2661dd6844
--- /dev/null
+++ b/lib/rubygems/source/installed.rb
@@ -0,0 +1,34 @@
+##
+# 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::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
+
+end
+
diff --git a/lib/rubygems/source/local.rb b/lib/rubygems/source/local.rb
new file mode 100644
index 0000000000..3aae20c8ed
--- /dev/null
+++ b/lib/rubygems/source/local.rb
@@ -0,0 +1,128 @@
+##
+# 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 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/specific_file.rb b/lib/rubygems/source/specific_file.rb
new file mode 100644
index 0000000000..a7b6c53542
--- /dev/null
+++ b/lib/rubygems/source/specific_file.rb
@@ -0,0 +1,67 @@
+##
+# A source representing a single .gem file. This is used for installation of
+# local gems.
+
+class Gem::Source::SpecificFile < Gem::Source
+
+ ##
+ # 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, '[Local:', ']' 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..244c4201d8
--- /dev/null
+++ b/lib/rubygems/source/vendor.rb
@@ -0,0 +1,25 @@
+##
+# 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::Vendor then
+ 0
+ when Gem::Source then
+ 1
+ else
+ nil
+ end
+ end
+
+end
+
diff --git a/lib/rubygems/source_index.rb b/lib/rubygems/source_index.rb
deleted file mode 100644
index 1fe92c0a80..0000000000
--- a/lib/rubygems/source_index.rb
+++ /dev/null
@@ -1,406 +0,0 @@
-#--
-# Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others.
-# All rights reserved.
-# See LICENSE.txt for permissions.
-#++
-
-require 'rubygems/specification'
-require 'rubygems/deprecate'
-
-##
-# The SourceIndex object indexes all the gems available from a
-# particular source (e.g. a list of gem directories, or a remote
-# source). A SourceIndex maps a gem full name to a gem
-# specification.
-#
-# NOTE:: The class used to be named Cache, but that became
-# confusing when cached source fetchers where introduced. The
-# constant Gem::Cache is an alias for this class to allow old
-# YAMLized source index objects to load properly.
-
-class Gem::SourceIndex
-
- include Enumerable
-
- attr_reader :gems # :nodoc:
-
- ##
- # Directories to use to refresh this SourceIndex when calling refresh!
-
- attr_accessor :spec_dirs
-
- ##
- # Factory method to construct a source index instance for a given
- # path.
- #
- # deprecated::
- # If supplied, from_installed_gems will act just like
- # +from_gems_in+. This argument is deprecated and is provided
- # just for backwards compatibility, and should not generally
- # be used.
- #
- # return::
- # SourceIndex instance
-
- def self.from_installed_gems(*deprecated)
- if deprecated.empty?
- from_gems_in(*installed_spec_directories)
- else
- warn "NOTE: from_installed_gems(arg) is deprecated. From #{caller.first}"
- from_gems_in(*deprecated) # HACK warn
- end
- end
-
- ##
- # Returns a list of directories from Gem.path that contain specifications.
-
- def self.installed_spec_directories
- # TODO: move to Gem::Utils
- Gem.path.collect { |dir| File.join(dir, "specifications") }
- end
-
- ##
- # Creates a new SourceIndex from the ruby format gem specifications in
- # +spec_dirs+.
-
- def self.from_gems_in(*spec_dirs)
- new spec_dirs
- end
-
- ##
- # Loads a ruby-format specification from +file_name+ and returns the
- # loaded spec.
-
- def self.load_specification(file_name)
- Gem::Deprecate.skip_during do
- Gem::Specification.load Gem::Path.new(file_name)
- end
- end
-
- ##
- # Constructs a source index instance from the provided specifications, which
- # is a Hash of gem full names and Gem::Specifications.
-
- def initialize specs_or_dirs = []
- @gems = {}
- @spec_dirs = nil
-
- case specs_or_dirs
- when Hash then
- specs_or_dirs.each do |full_name, spec|
- add_spec spec
- end
- when Array, String then
- self.spec_dirs = Array(specs_or_dirs)
- refresh!
- else
- arg = specs_or_dirs.inspect
- warn "NOTE: SourceIndex.new(#{arg}) is deprecated; From #{caller.first}."
- end
- end
-
- def all_gems
- gems
- end
-
- def prerelease_gems
- @gems.reject { |name, gem| !gem.version.prerelease? }
- end
-
- def released_gems
- @gems.reject { |name, gem| gem.version.prerelease? }
- end
-
- ##
- # Reconstruct the source index from the specifications in +spec_dirs+.
-
- def load_gems_in(*spec_dirs)
- @gems.clear
-
- spec_dirs.reverse_each do |spec_dir|
- spec_files = Dir[File.join(spec_dir, "*.gemspec")]
-
- spec_files.each do |spec_file|
- gemspec = Gem::Deprecate.skip_during do
- Gem::Specification.load spec_file
- end
- add_spec gemspec if gemspec
- end
- end
-
- self
- end
-
- ##
- # Returns an Array specifications for the latest released versions
- # of each gem in this index.
-
- def latest_specs(include_prerelease=false)
- result = Hash.new { |h,k| h[k] = [] }
- latest = {}
-
- sort.each do |_, spec|
- name = spec.name
- curr_ver = spec.version
- prev_ver = latest.key?(name) ? latest[name].version : nil
-
- next if !include_prerelease && curr_ver.prerelease?
- next unless prev_ver.nil? or curr_ver >= prev_ver or
- latest[name].platform != Gem::Platform::RUBY
-
- if prev_ver.nil? or
- (curr_ver > prev_ver and spec.platform == Gem::Platform::RUBY) then
- result[name].clear
- latest[name] = spec
- end
-
- if spec.platform != Gem::Platform::RUBY then
- result[name].delete_if do |result_spec|
- result_spec.platform == spec.platform
- end
- end
-
- result[name] << spec
- end
-
- result.values.flatten
- end
-
- ##
- # An array including only the prerelease gemspecs
-
- def prerelease_specs
- prerelease_gems.values
- end
-
- ##
- # An array including only the released gemspecs
-
- def released_specs
- released_gems.values
- end
-
- ##
- # Add a gem specification to the source index.
-
- def add_spec(gem_spec, name = gem_spec.full_name)
- # No idea why, but the Indexer wants to insert them using original_name
- # instead of full_name. So we make it an optional arg.
- @gems[name] = gem_spec
- end
-
- ##
- # Add gem specifications to the source index.
-
- def add_specs(*gem_specs)
- Gem::Deprecate.skip_during do
- gem_specs.each do |spec|
- add_spec spec
- end
- end
- end
-
- ##
- # Remove a gem specification named +full_name+.
-
- def remove_spec(full_name)
- @gems.delete full_name
- end
-
- ##
- # Iterate over the specifications in the source index.
-
- def each(&block) # :yields: gem.full_name, gem
- @gems.each(&block)
- end
-
- ##
- # The gem specification given a full gem spec name.
-
- def specification(full_name)
- @gems[full_name]
- end
-
- ##
- # The signature for the source index. Changes in the signature indicate a
- # change in the index.
-
- def index_signature
- require 'digest'
-
- Digest::SHA256.new.hexdigest(@gems.keys.sort.join(',')).to_s
- end
-
- ##
- # The signature for the given gem specification.
-
- def gem_signature(gem_full_name)
- require 'digest'
-
- Digest::SHA256.new.hexdigest(@gems[gem_full_name].to_yaml).to_s
- end
-
- def size
- @gems.size
- end
- alias length size
-
- ##
- # Find a gem by an exact match on the short name.
-
- def find_name(gem_name, requirement = Gem::Requirement.default)
- dep = Gem::Dependency.new gem_name, requirement
-
- Gem::Deprecate.skip_during do
- search dep
- end
- end
-
- ##
- # Search for a gem by Gem::Dependency +gem_pattern+. If +only_platform+
- # is true, only gems matching Gem::Platform.local will be returned. An
- # Array of matching Gem::Specification objects is returned.
- #
- # For backwards compatibility, a String or Regexp pattern may be passed as
- # +gem_pattern+, and a Gem::Requirement for +platform_only+. This
- # behavior is deprecated and will be removed.
-
- def search(gem_pattern, platform_or_requirement = false)
- requirement = nil
- only_platform = false # FIX: WTF is this?!?
-
- # TODO - Remove support and warning for legacy arguments after 2008/11
- unless Gem::Dependency === gem_pattern
- warn "#{Gem.location_of_caller.join ':'}:Warning: Gem::SourceIndex#search support for #{gem_pattern.class} patterns is deprecated, use #find_name"
- end
-
- case gem_pattern
- when Regexp then
- requirement = platform_or_requirement || Gem::Requirement.default
- when Gem::Dependency then
- only_platform = platform_or_requirement
- requirement = gem_pattern.requirement
-
- gem_pattern = if Regexp === gem_pattern.name then
- gem_pattern.name
- elsif gem_pattern.name.empty? then
- //
- else
- /^#{Regexp.escape gem_pattern.name}$/
- end
- else
- requirement = platform_or_requirement || Gem::Requirement.default
- gem_pattern = /#{gem_pattern}/i
- end
-
- unless Gem::Requirement === requirement then
- requirement = Gem::Requirement.create requirement
- end
-
- specs = @gems.values.select do |spec|
- spec.name =~ gem_pattern and
- requirement.satisfied_by? spec.version
- end
-
- if only_platform then
- specs = specs.select do |spec|
- Gem::Platform.match spec.platform
- end
- end
-
- specs.sort_by { |s| s.sort_obj }
- end
-
- ##
- # Replaces the gems in the source index from specifications in the
- # directories this source index was created from. Raises an exception if
- # this source index wasn't created from a directory (via from_gems_in or
- # from_installed_gems, or having spec_dirs set).
-
- def refresh!
- raise 'source index not created from disk' if @spec_dirs.nil?
- load_gems_in(*@spec_dirs)
- end
-
- ##
- # Returns an Array of Gem::Specifications that are not up to date.
-
- def outdated
- outdateds = []
-
- latest_specs.each do |local|
- dependency = Gem::Dependency.new local.name, ">= #{local.version}"
-
- fetcher = Gem::SpecFetcher.fetcher
- remotes = fetcher.find_matching dependency
- remotes = remotes.map { |(_, version, _), _| version }
-
- latest = remotes.sort.last
-
- outdateds << local.name if latest and local.version < latest
- end
-
- outdateds
- end
-
- def ==(other) # :nodoc:
- self.class === other and @gems == other.gems
- end
-
- def dump
- Marshal.dump(self)
- end
-end
-
-# :stopdoc:
-module Gem
-
- ##
- # Cache is an alias for SourceIndex to allow older YAMLized source index
- # objects to load properly.
-
- Cache = SourceIndex
-
-end
-
-class Gem::SourceIndex
- extend Gem::Deprecate
-
- deprecate :all_gems, :none, 2011, 10
-
- deprecate :==, :none, 2011, 11 # noisy
- deprecate :add_specs, :none, 2011, 11 # noisy
- deprecate :each, :none, 2011, 11
- deprecate :gems, :none, 2011, 11
- deprecate :load_gems_in, :none, 2011, 11
- deprecate :refresh!, :none, 2011, 11
- deprecate :spec_dirs=, "Specification.dirs=", 2011, 11 # noisy
- deprecate :add_spec, "Specification.add_spec", 2011, 11
- deprecate :find_name, "Specification.find_by_name", 2011, 11
- deprecate :gem_signature, :none, 2011, 11
- deprecate :index_signature, :none, 2011, 11
- deprecate :initialize, :none, 2011, 11
- deprecate :latest_specs, "Specification.latest_specs", 2011, 11
- deprecate :length, "Specification.all.length", 2011, 11
- deprecate :outdated, :none, 2011, 11
- deprecate :prerelease_gems, :none, 2011, 11
- deprecate :prerelease_specs, :none, 2011, 11
- deprecate :released_gems, :none, 2011, 11
- deprecate :released_specs, :none, 2011, 11
- deprecate :remove_spec, "Specification.remove_spec", 2011, 11
- deprecate :search, :none, 2011, 11
- deprecate :size, "Specification.all.size", 2011, 11
- deprecate :spec_dirs, "Specification.dirs", 2011, 11
- deprecate :specification, "Specification.find", 2011, 11
-
- class << self
- extend Gem::Deprecate
-
- deprecate :from_gems_in, :none, 2011, 10
- deprecate :from_installed_gems, :none, 2011, 10
- deprecate :installed_spec_directories, "Specification.dirs", 2011, 11
- deprecate :load_specification, :none, 2011, 10
- end
-end
-
-# :startdoc:
diff --git a/lib/rubygems/source_list.rb b/lib/rubygems/source_list.rb
new file mode 100644
index 0000000000..e01f11cc1e
--- /dev/null
+++ b/lib/rubygems/source_list.rb
@@ -0,0 +1,149 @@
+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
+
+ list.replace ary
+
+ return list
+ end
+
+ 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
+ Gem::Source.new(obj)
+ when Gem::Source
+ obj
+ else
+ Gem::Source.new(URI.parse(obj))
+ end
+
+ @sources << src
+ src
+ end
+
+ ##
+ # Replaces this SourceList with the sources in +other+ See #<< for
+ # acceptable items in +other+.
+
+ def replace(other)
+ clear
+
+ other.each do |x|
+ self << x
+ end
+
+ 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
+
+ ##
+ # 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
+ else
+ @sources.find { |x| x.uri.to_s == other.to_s }
+ end
+ end
+
+ ##
+ # 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 == source.to_s }
+ end
+ end
+end
diff --git a/lib/rubygems/source_local.rb b/lib/rubygems/source_local.rb
new file mode 100644
index 0000000000..0808f4694a
--- /dev/null
+++ b/lib/rubygems/source_local.rb
@@ -0,0 +1,5 @@
+require 'rubygems/source'
+require 'rubygems/source_local'
+
+# TODO warn upon require, this file is deprecated.
+
diff --git a/lib/rubygems/source_specific_file.rb b/lib/rubygems/source_specific_file.rb
new file mode 100644
index 0000000000..f785c2667c
--- /dev/null
+++ b/lib/rubygems/source_specific_file.rb
@@ -0,0 +1,4 @@
+require 'rubygems/source/specific_file'
+
+# TODO warn upon require, this file is deprecated.
+
diff --git a/lib/rubygems/spec_fetcher.rb b/lib/rubygems/spec_fetcher.rb
index 7302ad9ffa..12b8fb27d8 100644
--- a/lib/rubygems/spec_fetcher.rb
+++ b/lib/rubygems/spec_fetcher.rb
@@ -2,6 +2,7 @@ require 'rubygems/remote_fetcher'
require 'rubygems/user_interaction'
require 'rubygems/errors'
require 'rubygems/text'
+require 'rubygems/name_tuple'
##
# SpecFetcher handles metadata updates from remote gem repositories.
@@ -11,21 +12,15 @@ class Gem::SpecFetcher
include Gem::UserInteraction
include Gem::Text
- FILES = {
- :all => 'specs',
- :latest => 'latest_specs',
- :prerelease => 'prerelease_specs',
- }
-
##
- # The SpecFetcher cache dir.
+ # Cache of latest specs
- attr_reader :dir # :nodoc:
+ attr_reader :latest_specs # :nodoc:
##
- # Cache of latest specs
+ # Sources for this SpecFetcher
- attr_reader :latest_specs # :nodoc:
+ attr_reader :sources # :nodoc:
##
# Cache of all released specs
@@ -39,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
@@ -47,11 +46,22 @@ class Gem::SpecFetcher
@fetcher = fetcher
end
- def initialize
- require 'fileutils'
+ ##
+ # 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.
- @dir = File.join Gem.user_home, '.gem', 'specs'
- @update_cache = File.stat(Gem.user_home).uid == Process.uid
+ def initialize sources = nil
+ @sources = sources || Gem.sources
+
+ @update_cache =
+ begin
+ File.stat(Gem.user_home).uid == Process.uid
+ rescue Errno::EACCES, Errno::ENOENT
+ false
+ end
@specs = {}
@latest_specs = {}
@@ -60,144 +70,134 @@ class Gem::SpecFetcher
@caches = {
:latest => @latest_specs,
:prerelease => @prerelease_specs,
- :all => @specs
+ :released => @specs,
}
@fetcher = Gem::RemoteFetcher.fetcher
end
##
- # Returns the local directory to write +uri+ to.
+ #
+ # Find and fetch gem name tuples that match +dependency+.
+ #
+ # If +matching_platform+ is false, gems for all platforms are returned.
- def cache_dir(uri)
- # Correct for windows paths
- escaped_path = uri.path.sub(/^\/([a-z]):\//i, '/\\1-/')
- File.join @dir, "#{uri.host}%#{uri.port}", File.dirname(escaped_path)
- end
+ def search_for_dependency(dependency, matching_platform=true)
+ found = {}
- ##
- # Fetch specs matching +dependency+. If +all+ is true, all matching
- # (released) versions are returned. If +matching_platform+ is
- # false, all platforms are returned. If +prerelease+ is true,
- # prerelease versions are included.
-
- def fetch_with_errors(dependency,
- all = false,
- matching_platform = true,
- prerelease = false)
-
- specs_and_sources, errors = find_matching_with_errors(dependency,
- all,
- matching_platform,
- prerelease)
-
- ss = specs_and_sources.map do |spec_tuple, source_uri|
- [fetch_spec(spec_tuple, URI.parse(source_uri)), source_uri]
+ rejected_specs = {}
+
+ if dependency.prerelease?
+ if dependency.specific?
+ type = :complete
+ else
+ type = :abs_latest
+ end
+ elsif dependency.latest_version?
+ type = :latest
+ else
+ type = :released
end
- return [ss, errors]
- end
+ 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
- def fetch(*args)
- fetch_with_errors(*args).first
- end
+ found[source] = specs.select do |tup|
+ if dependency.match?(tup)
+ if matching_platform and !Gem::Platform.match(tup.platform)
+ pm = (
+ rejected_specs[dependency] ||= \
+ Gem::PlatformMismatch.new(tup.name, tup.version))
+ pm.add_platform tup.platform
+ false
+ else
+ true
+ end
+ end
+ end
+ end
- def fetch_spec(spec, source_uri)
- source_uri = URI.parse source_uri if String === source_uri
- spec = spec - [nil, 'ruby', '']
- spec_file_name = "#{spec.join '-'}.gemspec"
+ errors += rejected_specs.values
- uri = source_uri + "#{Gem::MARSHAL_SPEC_DIR}#{spec_file_name}"
+ tuples = []
- cache_dir = cache_dir uri
+ found.each do |source, specs|
+ specs.each do |s|
+ tuples << [s, source]
+ end
+ end
- local_spec = File.join cache_dir, spec_file_name
+ tuples = tuples.sort_by { |x| x[0] }
- if File.exist? local_spec then
- spec = Gem.read_binary local_spec
- else
- uri.path << '.rz'
+ return [tuples, errors]
+ end
- spec = @fetcher.fetch_path uri
- spec = Gem.inflate spec
- if @update_cache then
- FileUtils.mkdir_p cache_dir
+ ##
+ # Return all gem name tuples who's names match +obj+
- open local_spec, 'wb' do |io|
- io.write spec
+ def detect(type=:complete)
+ tuples = []
+
+ list, _ = available_specs(type)
+ list.each do |source, specs|
+ specs.each do |tup|
+ if yield(tup)
+ tuples << [tup, source]
end
end
end
- # TODO: Investigate setting Gem::Specification#loaded_from to a URI
- Marshal.load spec
+ tuples
end
+
##
- # Find spec names that match +dependency+. If +all+ is true, all
- # matching released versions are returned. If +matching_platform+
- # is false, gems for all platforms are returned.
-
- def find_matching_with_errors(dependency,
- all = false,
- matching_platform = true,
- prerelease = false)
- found = {}
+ # Find and fetch specs that match +dependency+.
+ #
+ # If +matching_platform+ is false, gems for all platforms are returned.
- rejected_specs = {}
+ def spec_for_dependency(dependency, matching_platform=true)
+ tuples, errors = search_for_dependency(dependency, matching_platform)
- list(all, prerelease).each do |source_uri, specs|
- found[source_uri] = specs.select do |spec_name, version, spec_platform|
- if dependency.match?(spec_name, version)
- if matching_platform and !Gem::Platform.match(spec_platform)
- pm = (rejected_specs[dependency] ||= Gem::PlatformMismatch.new(spec_name, version))
- pm.add_platform spec_platform
- false
- else
- true
- end
- 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
- errors = rejected_specs.values
-
- specs_and_sources = []
-
- found.each do |source_uri, specs|
- uri_str = source_uri.to_s
- specs_and_sources.concat(specs.map { |spec| [spec, uri_str] })
- end
-
- [specs_and_sources, errors]
- end
-
- def find_matching(*args)
- find_matching_with_errors(*args).first
+ return [specs, errors]
end
##
- # Suggests a gem based on the supplied +gem_name+. Returns a string
- # of the gem name if an approximate match can be found or nil
- # otherwise. NOTE: for performance reasons only gems which exactly
- # match the first character of +gem_name+ are considered.
+ # Suggests gems based on the supplied +gem_name+. Returns an array of
+ # alternative gem names.
def suggest_gems_from_name gem_name
- gem_name = gem_name.downcase
+ gem_name = gem_name.downcase.tr('_-', '')
max = gem_name.size / 2
- specs = list.values.flatten 1
+ names = available_specs(:complete).first.values.flatten(1)
- matches = specs.map { |name, version, platform|
- next unless Gem::Platform.match platform
+ matches = names.map { |n|
+ next unless n.match_platform?
- distance = levenshtein_distance gem_name, name.downcase
+ distance = levenshtein_distance gem_name, n.name.downcase.tr('_-', '')
next if distance >= max
- return [name] if distance == 0
+ return [n.name] if distance == 0
- [name, distance]
+ [n.name, distance]
}.compact
matches = matches.uniq.sort_by { |name, dist| dist }
@@ -206,91 +206,70 @@ class Gem::SpecFetcher
end
##
- # Returns a list of gems available for each source in Gem::sources. If
- # +all+ is true, all released versions are returned instead of only latest
- # versions. If +prerelease+ is true, include prerelease versions.
-
- def list(all = false, prerelease = false)
- # TODO: make type the only argument
- type = if all
- :all
- elsif prerelease
- :prerelease
- else
- :latest
- end
-
- list = {}
- file = FILES[type]
- cache = @caches[type]
-
- Gem.sources.each do |source_uri|
- source_uri = URI.parse source_uri
-
- unless cache.include? source_uri
- cache[source_uri] = load_specs source_uri, file
- end
-
- list[source_uri] = cache[source_uri]
- end
-
- if type == :all
- list.values.map do |gems|
- gems.reject! { |g| !g[1] || g[1].prerelease? }
+ # Returns a list of gems available for each source in Gem::sources.
+ #
+ # +type+ can be one of 3 values:
+ # :released => Return the list of all released specs
+ # :complete => Return the list of all specs
+ # :latest => Return the list of only the highest version of each gem
+ # :prerelease => Return the list of all prerelease only specs
+ #
+
+ def available_specs(type)
+ errors = []
+ list = {}
+
+ @sources.each_source do |source|
+ begin
+ names = case type
+ when :latest
+ tuples_for source, :latest
+ when :released
+ tuples_for source, :released
+ when :complete
+ 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
+ raise Gem::Exception, "Unknown type - :#{type}"
+ end
+ rescue Gem::RemoteFetcher::FetchError => e
+ errors << Gem::SourceFetchProblem.new(source, e)
+ else
+ list[source] = names
end
end
- list
+ [list, errors]
end
##
- # Loads specs in +file+, fetching from +source_uri+ if the on-disk cache is
- # out of date.
-
- def load_specs(source_uri, file)
- file_name = "#{file}.#{Gem.marshal_version}"
- spec_path = source_uri + "#{file_name}.gz"
- cache_dir = cache_dir spec_path
- local_file = File.join(cache_dir, file_name)
- loaded = false
-
- if File.exist? local_file then
- begin
- spec_dump =
- @fetcher.fetch_path(spec_path, File.mtime(local_file))
- rescue Gem::RemoteFetcher::FetchError => e
- alert_warning "Error fetching data: #{e.message}"
- end
+ # Retrieves NameTuples from +source+ of the given +type+ (:prerelease,
+ # etc.). If +gracefully_ignore+ is true, errors are ignored.
- loaded = true if spec_dump
-
- spec_dump ||= Gem.read_binary local_file
- else
- spec_dump = @fetcher.fetch_path spec_path
- loaded = true
- end
-
- specs = begin
- Marshal.load spec_dump
- rescue ArgumentError
- spec_dump = @fetcher.fetch_path spec_path
- loaded = true
-
- Marshal.load spec_dump
- end
+ def tuples_for(source, type, gracefully_ignore=false) # :nodoc:
+ cache = @caches[type]
- if loaded and @update_cache then
+ tuples =
begin
- FileUtils.mkdir_p cache_dir
-
- open local_file, 'wb' do |io|
- io << spec_dump
- end
- rescue
+ cache[source.uri] ||=
+ source.load_specs(type).sort_by { |tup| tup.name }
+ rescue Gem::RemoteFetcher::FetchError
+ raise unless gracefully_ignore
+ []
end
- end
- specs
+ tuples
end
end
diff --git a/lib/rubygems/specification.rb b/lib/rubygems/specification.rb
index 70a3fd09b4..2bcc2c0ef2 100644
--- a/lib/rubygems/specification.rb
+++ b/lib/rubygems/specification.rb
@@ -1,35 +1,53 @@
+# -*- coding: utf-8 -*-
#--
# Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others.
# All rights reserved.
# See LICENSE.txt for permissions.
#++
+
require 'rubygems/version'
require 'rubygems/requirement'
require 'rubygems/platform'
-require "rubygems/deprecate"
+require 'rubygems/deprecate'
+require 'rubygems/basic_specification'
+require 'rubygems/stub_specification'
+require 'rubygems/util/stringio'
# :stopdoc:
-class Date; end # for ruby_code if date.rb wasn't required
+# date.rb can't be loaded for `make install` due to miniruby
+# Date is needed for old gems that stored #date as Date instead of Time.
+class Date; end
# :startdoc:
##
-# The Specification class contains the metadata for a Gem. Typically
+# The Specification class contains the information for a Gem. Typically
# defined in a .gemspec file or a Rakefile, and looks like this:
#
-# spec = Gem::Specification.new do |s|
-# s.name = 'example'
-# s.version = '1.0'
-# s.summary = 'Example gem specification'
-# ...
+# 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"]
+# s.email = 'rubycoder@example.com'
+# s.files = ["lib/example.rb"]
+# s.homepage = 'https://rubygems.org/gems/example'
# end
#
-# For a great way to package gems, use Hoe.
+# 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 < Gem::BasicSpecification
-class Gem::Specification
+ # REFACTOR: Consider breaking out this version stuff into a separate
+ # module. There's enough special stuff around it that it may justify
+ # a separate class.
##
- # The the version number of a specification that does not specify one
+ # The version number of a specification that does not specify one
# (i.e. RubyGems 0.7 or earlier).
NONEXISTENT_SPECIFICATION_VERSION = -1
@@ -49,20 +67,50 @@ class Gem::Specification
# 2 0.9.5 2007-10-01 Added "required_rubygems_version"
# Now forward-compatible with future versions
# 3 1.3.2 2009-01-03 Added Fixnum validation to specification_version
+ # 4 1.9.0 2011-06-07 Added metadata
#--
# When updating this number, be sure to also update #to_ruby.
#
# NOTE RubyGems < 1.2 cannot load specification versions > 2.
- CURRENT_SPECIFICATION_VERSION = 3
-
- # :stopdoc:
+ 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 = { # :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"',
+ '"test_file=x" is a shortcut for "test_files=[x]"'
+ ],
+ 2 => [
+ 'Added "required_rubygems_version"',
+ 'Now forward-compatible with future versions',
+ ],
+ 3 => [
+ 'Added Fixnum validation to the specification_version'
+ ],
+ 4 => [
+ 'Added sandboxed freeform metadata to the specification version.'
+ ]
+ }
- # version => # of fields
- MARSHAL_FIELDS = { -1 => 16, 1 => 16, 2 => 16, 3 => 17 }
+ 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:
@@ -95,6 +143,7 @@ class Gem::Specification
:files => [],
:homepage => nil,
:licenses => [],
+ :metadata => {},
:name => nil,
:platform => Gem::Platform::RUBY,
:post_install_message => nil,
@@ -112,6 +161,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|
@@ -122,21 +182,45 @@ class Gem::Specification
# :section: Required gemspec attributes
##
- # This gem's name
+ # This gem's name.
+ #
+ # Usage:
+ #
+ # spec.name = 'rake'
attr_accessor :name
##
- # This gem's version
+ # This gem's version.
+ #
+ # The version string can contain numbers and periods, such as +1.0.0+.
+ # A gem is a 'prerelease' gem if the version has a letter in it, such as
+ # +1.0.0.pre+.
+ #
+ # Usage:
+ #
+ # spec.version = '0.4.1'
attr_reader :version
##
- # Paths in the gem to add to $LOAD_PATH when this gem is activated.
+ # 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 ['lib'] is typically sufficient.
+ # The default value is <code>"lib"</code>
+ #
+ # Usage:
+ #
+ # # If all library files are in the root directory...
+ # spec.require_path = '.'
- attr_accessor :require_paths
+ attr_writer :require_paths
##
# The version of RubyGems used to create this gem.
@@ -146,32 +230,115 @@ class Gem::Specification
attr_accessor :rubygems_version
##
- # The Gem::Specification version of this gemspec.
+ # A short summary of this gem's description. Displayed in `gem list -d`.
#
- # Do not set this, it is set automatically when the gem is packaged.
+ # The #description should be more detailed than the summary.
+ #
+ # Usage:
+ #
+ # spec.summary = "This is a small summary of my gem"
- attr_accessor :specification_version
+ attr_reader :summary
##
- # A short summary of this gem's description. Displayed in `gem list -d`.
+ # The platform this gem runs on.
+ #
+ # This is usually Gem::Platform::RUBY or Gem::Platform::CURRENT.
#
- # The description should be more detailed than the summary. For example,
- # you might wish to copy the entire README into the description.
+ # Most gems contain pure Ruby code; they should simply leave the default
+ # value in place. Some gems contain C (or other) code to be compiled into a
+ # Ruby "extension". The should leave the default value in place unless
+ # their code will only compile on a certain type of system. Some gems
+ # consist of pre-compiled code ("binary gems"). It's especially important
+ # that they set the platform attribute appropriately. A shortcut is to set
+ # the platform to Gem::Platform::CURRENT, which will cause the gem builder
+ # to set the platform to the appropriate value for the system on which the
+ # build is being performed.
+ #
+ # If this attribute is set to a non-default value, it will be included in
+ # the filename of the gem when it is built such as:
+ # nokogiri-1.6.0-x86-mingw32.gem
+ #
+ # Usage:
+ #
+ # spec.platform = Gem::Platform.local
- attr_reader :summary
+ def platform= platform
+ if @original_platform.nil? or
+ @original_platform == Gem::Platform::RUBY then
+ @original_platform = platform
+ end
- ######################################################################
- # :section: Optional gemspec attributes
+ case platform
+ when Gem::Platform::CURRENT then
+ @new_platform = Gem::Platform.local
+ @original_platform = @new_platform.to_s
+
+ when Gem::Platform then
+ @new_platform = platform
+
+ # legacy constants
+ when nil, Gem::Platform::RUBY then
+ @new_platform = Gem::Platform::RUBY
+ when 'mswin32' then # was Gem::Platform::WIN32
+ @new_platform = Gem::Platform.new 'x86-mswin32'
+ when 'i586-linux' then # was Gem::Platform::LINUX_586
+ @new_platform = Gem::Platform.new 'x86-linux'
+ when 'powerpc-darwin' then # was Gem::Platform::DARWIN
+ @new_platform = Gem::Platform.new 'ppc-darwin'
+ else
+ @new_platform = Gem::Platform.new platform
+ end
+
+ @platform = @new_platform.to_s
+
+ invalidate_memoized_attributes
+
+ @new_platform
+ end
##
- # Autorequire was used by old RubyGems to automatically require a file.
+ # Files included in this gem. You cannot append to this accessor, you must
+ # assign to it.
#
- # Deprecated: It is neither supported nor functional.
+ # Only add files you can require to this list, not directories, etc.
+ #
+ # Directories are automatically stripped from this list when building a gem,
+ # other non-files cause an error.
+ #
+ # Usage:
+ #
+ # require 'rake'
+ # spec.files = FileList['lib/**/*.rb',
+ # 'bin/*',
+ # '[A-Z]*',
+ # 'test/**/*'].to_a
+ #
+ # # or without Rake...
+ # spec.files = Dir['lib/**/*.rb'] + Dir['bin/*']
+ # spec.files += Dir['[A-Z]*'] + Dir['test/**/*']
+ # spec.files.reject! { |fn| fn.include? "CVS" }
- attr_accessor :autorequire
+ def files
+ # DO NOT CHANGE TO ||= ! This is not a normal accessor. (yes, it sucks)
+ # DOC: Why isn't it normal? Why does it suck? How can we fix this?
+ @files = [@files,
+ @test_files,
+ add_bindir(@executables),
+ @extra_rdoc_files,
+ @extensions,
+ ].flatten.sort.uniq.compact
+ end
+
+ ######################################################################
+ # :section: Optional gemspec attributes
##
# The path in the gem for executable scripts. Usually 'bin'
+ #
+ # Usage:
+ #
+ # spec.bindir = 'bin'
attr_accessor :bindir
@@ -183,39 +350,290 @@ class Gem::Specification
##
# A long description of this gem
+ #
+ # The description should be more detailed than the summary.
+ #
+ # Usage:
+ #
+ # spec.description = <<-EOF
+ # Rake is a Make-like program implemented in Ruby. Tasks and
+ # dependencies are specified in standard Ruby syntax.
+ # EOF
attr_reader :description
##
- # Sets the default executable for this gem.
+ # A contact email address (or addresses) for this gem
#
- # Deprecated: You must now specify the executable name to Gem.bin_path.
+ # Usage:
+ #
+ # spec.email = 'john.jones@example.com'
+ # spec.email = ['jack@example.com', 'jill@example.com']
- attr_writer :default_executable
+ attr_accessor :email
##
- # A contact email for this gem
+ # The URL of this gem's home page
#
- # If you are providing multiple authors and multiple emails they should be
- # in the same order such that:
+ # Usage:
#
- # Hash[*spec.authors.zip(spec.emails).flatten]
+ # spec.homepage = 'http://rake.rubyforge.org'
+
+ attr_accessor :homepage
+
+ ##
+ # A message that gets displayed after the gem is installed.
+ #
+ # Usage:
#
- # Gives a hash of author name to email address.
+ # spec.post_install_message = "Thanks for installing!"
- attr_accessor :email
+ attr_accessor :post_install_message
##
- # The URL of this gem's home page
+ # The key used to sign this gem. See Gem::Security for details.
- attr_accessor :homepage
+ attr_accessor :signing_key
##
- # True when this gemspec has been activated. This attribute is not persisted.
+ # :attr_accessor: metadata
+ #
+ # 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:
+ #
+ # * 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
+
+ ##
+ # Adds a development dependency named +gem+ with +requirements+ to this
+ # gem.
+ #
+ # Usage:
+ #
+ # spec.add_development_dependency 'example', '~> 1.1', '>= 1.1.4'
+ #
+ # Development dependencies aren't installed by default and aren't
+ # activated when a gem is required.
- attr_accessor :loaded # :nodoc:
+ def add_development_dependency(gem, *requirements)
+ add_dependency_with_type(gem, :development, *requirements)
+ end
- alias :loaded? :loaded # :nodoc:
+ ##
+ # Adds a runtime dependency named +gem+ with +requirements+ to this gem.
+ #
+ # Usage:
+ #
+ # spec.add_runtime_dependency 'example', '~> 1.1', '>= 1.1.4'
+
+ def add_runtime_dependency(gem, *requirements)
+ add_dependency_with_type(gem, :runtime, *requirements)
+ 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
+ # use bash or other interpreters will not work.
+ #
+ # Usage:
+ #
+ # spec.executables << 'rake'
+
+ def executables
+ @executables ||= []
+ end
+
+ ##
+ # Extensions to build when installing the gem, specifically the paths to
+ # extconf.rb-style files used to compile extensions.
+ #
+ # These files will be run when the gem is installed, causing the C (or
+ # whatever) code to be compiled on the user’s machine.
+ #
+ # Usage:
+ #
+ # spec.extensions << 'ext/rmagic/extconf.rb'
+ #
+ # See Gem::Ext::Builder for information about writing extensions for gems.
+
+ def extensions
+ @extensions ||= []
+ end
+
+ ##
+ # Extra files to add to RDoc such as README or doc/examples.txt
+ #
+ # When the user elects to generate the RDoc documentation for a gem (typically
+ # at install time), all the library files are sent to RDoc for processing.
+ # This option allows you to have some non-code files included for a more
+ # complete set of documentation.
+ #
+ # Usage:
+ #
+ # spec.extra_rdoc_files = ['README', 'doc/user-guide.txt']
+
+ def extra_rdoc_files
+ @extra_rdoc_files ||= []
+ 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.
+ #
+ # 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 http://opensource.org/licenses/alphabetical for a list of licenses and
+ # their abbreviations (or short names). GitHub also provides a
+ # license picker at http://choosealicense.com/
+ #
+ # According to copyright law, not having an OSI-approved open source license
+ # means you have no rights to use the code for any purpose-- in other words,
+ # "all rights reserved".
+ #
+ # You can set multiple licenses with #licenses=
+ #
+ # Usage:
+ # spec.license = 'MIT'
+
+ def license=o
+ self.licenses = [o]
+ end
+
+ ##
+ # :category: Recommended gemspec attributes
+ # The license(s) for the library.
+ #
+ # Each license must be a short name, 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.
+ #
+ # See #license= for more discussion
+ #
+ # Usage:
+ # spec.licenses = ['MIT', 'GPL-2']
+
+ def licenses= licenses
+ @licenses = Array licenses
+ end
+
+ ##
+ # Specifies the rdoc options to be used when generating API documentation.
+ #
+ # Usage:
+ #
+ # spec.rdoc_options << '--title' << 'Rake -- Ruby Make' <<
+ # '--main' << 'README' <<
+ # '--line-numbers'
+
+ def rdoc_options
+ @rdoc_options ||= []
+ end
+
+ ##
+ # The version of Ruby required by this gem. The ruby version can be
+ # specified to the patch-level:
+ #
+ # $ ruby -v -e 'p Gem.ruby_version'
+ # ruby 2.0.0p247 (2013-06-27 revision 41674) [x86_64-darwin12.4.0]
+ # #<Gem::Version "2.0.0.247">
+ #
+ # Usage:
+ #
+ # # This gem will work with 1.8.6 or greater...
+ # spec.required_ruby_version = '>= 1.8.6'
+ #
+ # # Only with ruby 2.0.x
+ # spec.required_ruby_version = '~> 2.0'
+
+ def required_ruby_version= req
+ @required_ruby_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.
+ #
+ # Usage:
+ #
+ # spec.requirements << 'libmagick, v6.0'
+ # spec.requirements << 'A good graphics card'
+
+ def requirements
+ @requirements ||= []
+ end
+
+ ##
+ # A collection of unit test files. They will be loaded as unit tests when
+ # the user requests a gem to be unit tested.
+ #
+ # Usage:
+ # spec.test_files = Dir.glob('test/tc_*.rb')
+ # spec.test_files = ['tests/test-suite.rb']
+
+ def test_files= files
+ @test_files = Array files
+ end
+
+ ######################################################################
+ # :section: Specification internals
##
# True when this gemspec has been activated. This attribute is not persisted.
@@ -225,22 +643,26 @@ class Gem::Specification
alias :activated? :activated
##
- # Path this gemspec was loaded from. This attribute is not persisted.
+ # Autorequire was used by old RubyGems to automatically require a file.
+ #
+ # Deprecated: It is neither supported nor functional.
- attr_reader :loaded_from
+ attr_accessor :autorequire # :nodoc:
##
- # Allows deinstallation of gems with legacy platforms.
+ # Sets the default executable for this gem.
+ #
+ # Deprecated: You must now specify the executable name to Gem.bin_path.
- attr_writer :original_platform # :nodoc:
+ attr_writer :default_executable
##
- # A message that gets displayed after the gem is installed
+ # Allows deinstallation of gems with legacy platforms.
- attr_accessor :post_install_message
+ attr_writer :original_platform # :nodoc:
##
- # The version of ruby required by this gem
+ # The version of Ruby required by this gem
attr_reader :required_ruby_version
@@ -252,36 +674,77 @@ class Gem::Specification
##
# The rubyforge project this gem lives under. i.e. RubyGems'
# rubyforge_project is "rubygems".
+ #
+ # This option is deprecated.
attr_accessor :rubyforge_project
##
- # The key used to sign this gem. See Gem::Security for details.
+ # The Gem::Specification version of this gemspec.
+ #
+ # Do not set this, it is set automatically when the gem is packaged.
- attr_accessor :signing_key
+ attr_accessor :specification_version
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]}
- self.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
- specs[spec.full_name] ||= spec if spec
- }
- }
+ _resort!(@@all)
+ end
+ @@all
+ end
+
+ def self._clear_load_cache # :nodoc:
+ LOAD_CACHE.clear
+ end
- @@all = specs.values
+ def self.each_gemspec(dirs) # :nodoc:
+ dirs.each do |dir|
+ Dir[File.join(dir, "*.gemspec")].each do |path|
+ yield path.untaint
+ end
+ end
+ end
- _resort!
+ def self.each_stub(dirs) # :nodoc:
+ each_gemspec(dirs) do |path|
+ stub = Gem::StubSpecification.new(path)
+ yield stub if stub.valid?
+ end
+ end
+
+ def self.each_spec(dirs) # :nodoc:
+ each_gemspec(dirs) do |path|
+ spec = self.load path
+ yield spec if spec
+ end
+ end
+
+ ##
+ # Returns a Gem::StubSpecification for every installed gem
+
+ def self.stubs
+ @@stubs ||= begin
+ stubs = {}
+ each_stub([default_specifications_dir] + dirs) do |stub|
+ stubs[stub.full_name] ||= stub
+ end
+
+ 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
@@ -289,6 +752,17 @@ class Gem::Specification
end
##
+ # Loads the default specifications. It should be called only once.
+
+ def self.load_defaults
+ 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
+
+ ##
# Adds +spec+ to the known specifications, keeping the collection
# properly sorted.
@@ -306,7 +780,9 @@ class Gem::Specification
return if _all.include? spec
_all << spec
- _resort!
+ stubs << spec
+ _resort!(_all)
+ _resort!(stubs)
end
##
@@ -347,7 +823,7 @@ class Gem::Specification
# -- wilsonb
def self.all= specs
- @@all = specs
+ @@all = @@stubs = specs
end
##
@@ -380,7 +856,7 @@ class Gem::Specification
def self.dirs
@@dirs ||= Gem.path.collect { |dir|
- File.join dir, "specifications"
+ File.join dir.dup.untaint, "specifications"
}
end
@@ -389,12 +865,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
@@ -445,11 +917,22 @@ class Gem::Specification
end
##
+ # Return the best specification that contains the file matching +path+
+ # amongst the specs that are not activated.
+
+ def self.find_inactive_by_path path
+ stub = stubs.find { |s|
+ s.contains_requirable_file? path unless s.activated?
+ }
+ stub && stub.to_spec
+ end
+
+ ##
# Return currently unresolved specs that contain the file matching +path+.
def self.find_in_unresolved path
# TODO: do we need these?? Kill it
- specs = Gem.unresolved_deps.values.map { |dep| dep.to_specs }.flatten
+ specs = unresolved_deps.values.map { |dep| dep.to_specs }.flatten
specs.find_all { |spec| spec.contains_requirable_file? path }
end
@@ -459,7 +942,7 @@ class Gem::Specification
# specs that contain the file matching +path+.
def self.find_in_unresolved_tree path
- specs = Gem.unresolved_deps.values.map { |dep| dep.to_specs }.flatten
+ specs = unresolved_deps.values.map { |dep| dep.to_specs }.flatten
specs.reverse_each do |spec|
trails = []
@@ -498,12 +981,8 @@ class Gem::Specification
raise Gem::Exception, "YAML data doesn't evaluate to gem specification"
end
- unless (spec.instance_variables.include? '@specification_version' or
- spec.instance_variables.include? :@specification_version) and
- spec.instance_variable_get :@specification_version
- spec.instance_variable_set :@specification_version,
- NONEXISTENT_SPECIFICATION_VERSION
- end
+ spec.specification_version ||= NONEXISTENT_SPECIFICATION_VERSION
+ spec.reset_nil_attributes_to_default
spec
end
@@ -516,7 +995,7 @@ class Gem::Specification
result = Hash.new { |h,k| h[k] = {} }
native = {}
- Gem::Specification._all.reverse_each do |spec|
+ Gem::Specification.reverse_each do |spec|
next if spec.version.prerelease? unless prerelease
native[spec.name] = spec.version if spec.platform == Gem::Platform::RUBY
@@ -526,16 +1005,19 @@ 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
##
# Loads Ruby format gemspec from +file+.
def self.load file
- return unless file && File.file?(file)
-
+ return unless file
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:-'
@@ -550,6 +1032,7 @@ class Gem::Specification
if Gem::Specification === spec
spec.loaded_from = file.to_s
+ LOAD_CACHE[file] = spec
return spec
end
@@ -584,35 +1067,51 @@ 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.each do |local|
- dependency = Gem::Dependency.new local.name, ">= #{local.version}"
- remotes = fetcher.find_matching dependency
- remotes = remotes.map { |(_, version, _), _| 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
##
# Removes +spec+ from the known specs.
def self.remove_spec spec
- # TODO: beat on the tests
- raise "wtf: #{spec.full_name} not in #{all_names.inspect}" unless
- _all.include? spec
_all.delete spec
+ stubs.delete_if { |s| s.full_name == spec.full_name }
end
##
@@ -635,14 +1134,29 @@ class Gem::Specification
def self.reset
@@dirs = nil
- # from = caller.first(10).reject { |s| s =~ /minitest/ }
- # warn ""
- # warn "NOTE: Specification.reset from #{from.inspect}"
- Gem.pre_reset_hooks.each { |hook| hook.call }
+ 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"
+ warn "#{w}: Unresolved specs during Gem::Specification.reset:"
+ unresolved.values.each do |dep|
+ warn " #{dep}"
+ end
+ warn "#{w}: Clearing out unresolved specs."
+ warn "Please report a bug if this causes problems."
+ unresolved.clear
+ end
Gem.post_reset_hooks.each { |hook| hook.call }
end
+ # DOC: This method needs documented or nodoc'd
+ def self.unresolved_deps
+ @unresolved_deps ||= Hash.new { |h, n| h[n] = Gem::Dependency.new n }
+ end
+
##
# Load custom marshal format, re-initializing defaults as needed
@@ -690,6 +1204,7 @@ class Gem::Specification
spec.instance_variable_set :@new_platform, array[16]
spec.instance_variable_set :@platform, array[16].to_s
spec.instance_variable_set :@license, array[17]
+ spec.instance_variable_set :@metadata, array[18]
spec.instance_variable_set :@loaded, false
spec.instance_variable_set :@activated, false
@@ -732,7 +1247,8 @@ class Gem::Specification
@homepage,
true, # has_rdoc
@new_platform,
- @licenses
+ @licenses,
+ @metadata
]
end
@@ -763,6 +1279,8 @@ class Gem::Specification
# resolved later, as needed.
def activate_dependencies
+ unresolved = Gem::Specification.unresolved_deps
+
self.runtime_dependencies.each do |spec_dep|
if loaded = Gem.loaded_specs[spec_dep.name]
next if spec_dep.matches_spec? loaded
@@ -780,11 +1298,11 @@ class Gem::Specification
specs.first.activate
else
name = spec_dep.name
- Gem.unresolved_deps[name] = Gem.unresolved_deps[name].merge spec_dep
+ unresolved[name] = unresolved[name].merge spec_dep
end
end
- Gem.unresolved_deps.delete self.name
+ unresolved.delete self.name
end
##
@@ -816,9 +1334,8 @@ class Gem::Specification
end
unless dependency.respond_to?(:name) &&
- dependency.respond_to?(:version_requirements)
-
- dependency = Gem::Dependency.new(dependency, requirements, type)
+ dependency.respond_to?(:version_requirements)
+ dependency = Gem::Dependency.new(dependency.to_s, requirements, type)
end
dependencies << dependency
@@ -826,38 +1343,15 @@ class Gem::Specification
private :add_dependency_with_type
- ##
- # Adds a development dependency named +gem+ with +requirements+ to this
- # Gem. For example:
- #
- # spec.add_development_dependency 'example', '~> 1.1', '>= 1.1.4'
- #
- # Development dependencies aren't installed by default and aren't
- # activated when a gem is required.
-
- def add_development_dependency(gem, *requirements)
- add_dependency_with_type(gem, :development, *requirements)
- end
-
- ##
- # Adds a runtime dependency named +gem+ with +requirements+ to this Gem.
- # For example:
- #
- # spec.add_runtime_dependency 'example', '~> 1.1', '>= 1.1.4'
-
- def add_runtime_dependency(gem, *requirements)
- add_dependency_with_type(gem, :runtime, *requirements)
- end
-
alias add_dependency add_runtime_dependency
##
# Adds this spec's require paths to LOAD_PATH, in the proper location.
def add_self_to_load_path
- paths = require_paths.map do |path|
- File.join full_gem_path, path
- end
+ return if default_gem?
+
+ paths = full_require_paths
# gem directories must come after -I and ENV['RUBYLIB']
insert_index = Gem.load_path_insert_index
@@ -872,51 +1366,22 @@ class Gem::Specification
end
##
- # Singular reader for #authors
+ # Singular reader for #authors. Returns the first author in the list
def author
val = authors and val.first
end
##
- # Singular writer for #authors
-
- def author= o
- self.authors = [o]
- end
-
- ##
# The list of author names who wrote this gem.
#
- # If you are providing multiple authors and multiple emails they should be
- # in the same order such that:
- #
- # Hash[*spec.authors.zip(spec.emails).flatten]
- #
- # Gives a hash of author name to email address.
+ # spec.authors = ['Chad Fowler', 'Jim Weirich', 'Rich Kilmer']
def authors
@authors ||= []
end
##
- # Sets the list of authors, ensuring it is an array.
-
- def authors= value
- @authors = Array(value).flatten.grep(String)
- 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 ||= File.dirname File.dirname loaded_from
- end
-
- ##
# Returns the full path to installed gem's bin directory.
#
# NOTE: do not confuse this with +bindir+, which is just 'bin', not
@@ -934,6 +1399,63 @@ class Gem::Specification
end
##
+ # Returns the build_args used to install the gem
+
+ def build_args
+ if File.exist? build_info_file
+ File.readlines(build_info_file).map { |x| x.strip }
+ 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) &&
+ !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'
+
+ Gem::DefaultUserInteraction.use_ui Gem::SilentUI.new do
+ builder = Gem::Ext::Builder.new self
+ builder.build_extensions
+ end
+ ensure
+ Gem::Specification.unresolved_deps.replace unresolved_deps
+ end
+ end
+
+ ##
+ # Returns the full path to the build info directory
+
+ def build_info_dir
+ File.join base_dir, "build_info"
+ end
+
+ ##
+ # Returns the full path to the file containing the build
+ # information generated when the gem was installed
+
+ def build_info_file
+ File.join build_info_dir, "#{full_name}.info"
+ end
+
+ ##
# Returns the full path to the cache directory containing this
# spec's cached gem.
@@ -948,8 +1470,6 @@ class Gem::Specification
@cache_file ||= File.join cache_dir, "#{full_name}.gem"
end
- alias :cache_gem :cache_file
-
##
# Return any possible conflicts against the currently loaded specs.
@@ -966,33 +1486,24 @@ class Gem::Specification
end
##
- # Return true if this spec can require +file+.
-
- def contains_requirable_file? file
- root = full_gem_path
-
- require_paths.each do |lib|
- base = "#{root}/#{lib}/#{file}"
- Gem.suffixes.each do |suf|
- path = "#{base}#{suf}"
- return true if File.file? path
- end
- end
-
- return false
- end
-
- ##
- # The date this gem was created. Lazily defaults to TODAY.
+ # The date this gem was created. Lazily defaults to the current UTC date.
+ #
+ # There is no need to set this in your gem specification.
def date
@date ||= TODAY
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
#
- # Do not set this, it is set automatically when the gem is packaged.
+ # DO NOT set this, it is set automatically when the gem is packaged.
def date= date
# We want to end up with a Time object with one-day resolution.
@@ -1000,7 +1511,7 @@ class Gem::Specification
# way to do it.
@date = case date
when String then
- if /\A(\d{4})-(\d{2})-(\d{2})\Z/ =~ date then
+ if DateTimeFormat =~ date then
Time.utc($1.to_i, $2.to_i, $3.to_i)
# Workaround for where the date format output from psych isn't
@@ -1025,7 +1536,7 @@ class Gem::Specification
# Deprecated: The name of the gem is assumed to be the name of the
# executable now. See Gem.bin_path.
- def default_executable
+ def default_executable # :nodoc:
if defined?(@default_executable) and @default_executable
result = @default_executable
elsif @executables and @executables.size == 1
@@ -1083,7 +1594,7 @@ class Gem::Specification
end
##
- # A long description of this gem
+ # A detailed description of this gem. See also #summary
def description= str
@description = str.to_s
@@ -1097,10 +1608,21 @@ class Gem::Specification
end
##
- # Returns the full path to this spec's documentation directory.
+ # Returns the full path to this spec's documentation directory. If +type+
+ # is given it will be appended to the end. For examlpe:
+ #
+ # spec.doc_dir # => "/path/to/gem_repo/doc/a-1"
+ #
+ # spec.doc_dir 'ri' # => "/path/to/gem_repo/doc/a-1/ri"
- def doc_dir
+ def doc_dir type = nil
@doc_dir ||= File.join base_dir, 'doc', full_name
+
+ if type then
+ File.join @doc_dir, type
+ else
+ @doc_dir
+ end
end
def encode_with coder # :nodoc:
@@ -1143,13 +1665,6 @@ class Gem::Specification
end
##
- # Executables included in the gem.
-
- def executables
- @executables ||= []
- end
-
- ##
# Sets executables to +value+, ensuring it is an array. Don't
# use this, push onto the array instead.
@@ -1159,14 +1674,6 @@ class Gem::Specification
end
##
- # Extensions to build when installing the gem. See
- # Gem::Installer#build_extensions for valid values.
-
- def extensions
- @extensions ||= []
- end
-
- ##
# Sets extensions to +extensions+, ensuring it is an array. Don't
# use this, push onto the array instead.
@@ -1176,13 +1683,6 @@ class Gem::Specification
end
##
- # Extra files to add to RDoc such as README or doc/examples.txt
-
- def extra_rdoc_files
- @extra_rdoc_files ||= []
- end
-
- ##
# Sets extra_rdoc_files to +files+, ensuring it is an array. Don't
# use this, push onto the array instead.
@@ -1201,25 +1701,6 @@ class Gem::Specification
end
##
- # Files included in this gem. You cannot append to this accessor, you must
- # assign to it.
- #
- # Only add files you can require to this list, not directories, etc.
- #
- # Directories are automatically stripped from this list when building a gem,
- # other non-files cause an error.
-
- def files
- # DO NOT CHANGE TO ||= ! This is not a normal accessor. (yes, it sucks)
- @files = [@files,
- @test_files,
- add_bindir(@executables),
- @extra_rdoc_files,
- @extensions,
- ].flatten.uniq.compact
- end
-
- ##
# Sets files to +files+, ensuring it is an array.
def files= files
@@ -1249,49 +1730,28 @@ class Gem::Specification
spec
end
- ##
- # The full path to the gem (install path + full name).
-
- def full_gem_path
- # TODO: try to get rid of this... or the awkward
- # 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)
-
- 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
- if platform == Gem::Platform::RUBY or platform.nil? then
- "#{@name}-#{@version}"
- else
- "#{@name}-#{@version}-#{platform}"
- 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_install_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
##
@@ -1299,7 +1759,7 @@ class Gem::Specification
#
# Formerly used to indicate this gem was RDoc-capable.
- def has_rdoc
+ def has_rdoc # :nodoc:
true
end
@@ -1308,11 +1768,11 @@ class Gem::Specification
#
# Formerly used to indicate this gem was RDoc-capable.
- def has_rdoc= ignored
+ def has_rdoc= ignored # :nodoc:
@has_rdoc = true
end
- alias :has_rdoc? :has_rdoc
+ alias :has_rdoc? :has_rdoc # :nodoc:
##
# True if this gem has files in test_files
@@ -1326,12 +1786,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
@@ -1343,8 +1802,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
@@ -1352,11 +1812,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
@@ -1372,13 +1828,9 @@ class Gem::Specification
# Duplicates array_attributes from +other_spec+ so state isn't shared.
def initialize_copy other_spec
- other_ivars = other_spec.instance_variables
- other_ivars = other_ivars.map { |ivar| ivar.intern } if # for 1.9
- String === other_ivars.first
-
self.class.array_attributes.each do |name|
name = :"@#{name}"
- next unless other_ivars.include? name
+ next unless other_spec.instance_variable_defined? name
begin
val = other_spec.instance_variable_get(name)
@@ -1398,11 +1850,22 @@ class Gem::Specification
end
##
- # The directory that this gem was installed into.
- # TODO: rename - horrible. this is the base_dir for a gem path
+ # Expire memoized instance variables that can incorrectly generate, replace
+ # or miss files due changes in certain attributes used to compute them.
- def installation_path
- loaded_from && base_dir
+ def invalidate_memoized_attributes
+ @full_name = nil
+ @cache_file = nil
+ end
+
+ private :invalidate_memoized_attributes
+
+ def inspect # :nodoc:
+ if $DEBUG
+ super
+ else
+ "#<#{self.class}:0x#{__id__.to_s(16)} #{full_name}>"
+ end
end
##
@@ -1425,7 +1888,7 @@ class Gem::Specification
def lib_files
@files.select do |file|
require_paths.any? do |path|
- file.index(path) == 0
+ file.start_with? path
end
end
end
@@ -1438,33 +1901,25 @@ class Gem::Specification
end
##
- # Singular accessor for #licenses
-
- def license=o
- self.licenses = [o]
- end
-
- ##
- # The license(s) for the library. Each license must be a short name, no
- # more than 64 characters.
+ # Plural accessor for setting licenses
+ #
+ # See #license= for details
def licenses
@licenses ||= []
end
- ##
- # Set licenses to +licenses+, ensuring it is an array.
-
- def licenses= licenses
- @licenses = Array licenses
- end
-
- ##
- # Set the location a Specification was loaded from. +obj+ is converted
- # to a String.
+ def loaded_from= path # :nodoc:
+ super
- def loaded_from= path
- @loaded_from = path.to_s
+ @bin_dir = nil
+ @cache_dir = nil
+ @cache_file = nil
+ @doc_dir = nil
+ @gem_dir = nil
+ @ri_dir = nil
+ @spec_dir = nil
+ @spec_file = nil
end
##
@@ -1517,6 +1972,13 @@ class Gem::Specification
end
##
+ # Return a NameTuple that represents this Specification
+
+ def name_tuple
+ Gem::NameTuple.new name, version, original_platform
+ end
+
+ ##
# Returns the full name (name-version) of this gemspec using the original
# platform. For use with legacy gems.
@@ -1542,50 +2004,16 @@ class Gem::Specification
@new_platform ||= Gem::Platform::RUBY
end
- ##
- # The platform this gem runs on. See Gem::Platform for details.
- #
- # Setting this to any value other than Gem::Platform::RUBY or
- # Gem::Platform::CURRENT is probably wrong.
-
- def platform= platform
- if @original_platform.nil? or
- @original_platform == Gem::Platform::RUBY then
- @original_platform = platform
- end
-
- case platform
- when Gem::Platform::CURRENT then
- @new_platform = Gem::Platform.local
- @original_platform = @new_platform.to_s
-
- when Gem::Platform then
- @new_platform = platform
-
- # legacy constants
- when nil, Gem::Platform::RUBY then
- @new_platform = Gem::Platform::RUBY
- when 'mswin32' then # was Gem::Platform::WIN32
- @new_platform = Gem::Platform.new 'x86-mswin32'
- when 'i586-linux' then # was Gem::Platform::LINUX_586
- @new_platform = Gem::Platform.new 'x86-linux'
- when 'powerpc-darwin' then # was Gem::Platform::DARWIN
- @new_platform = Gem::Platform.new 'ppc-darwin'
- else
- @new_platform = Gem::Platform.new platform
- end
-
- @platform = @new_platform.to_s
-
- @new_platform
- end
-
def pretty_print(q) # :nodoc:
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
@@ -1639,13 +2067,6 @@ class Gem::Specification
end
##
- # An ARGV style array of options to RDoc
-
- def rdoc_options
- @rdoc_options ||= []
- end
-
- ##
# Sets rdoc_options to +value+, ensuring it is an array. Don't
# use this, push onto the array instead.
@@ -1669,13 +2090,6 @@ class Gem::Specification
end
##
- # The version of ruby required by this gem
-
- def required_ruby_version= req
- @required_ruby_version = Gem::Requirement.create req
- end
-
- ##
# The RubyGems version required by this gem
def required_rubygems_version= req
@@ -1683,14 +2097,6 @@ class Gem::Specification
end
##
- # An array or things required by this gem. Not used by anything
- # presently.
-
- def requirements
- @requirements ||= []
- end
-
- ##
# Set requirements to +req+, ensuring it is an array. Don't
# use this, push onto the array instead.
@@ -1699,6 +2105,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.
@@ -1714,13 +2124,18 @@ class Gem::Specification
case obj
when String then obj.dump
when Array then '[' + obj.map { |x| ruby_code x }.join(", ") + ']'
+ when Hash then
+ seg = obj.keys.sort.map { |k| "#{k.to_s.dump} => #{obj[k].to_s.dump}" }
+ "{ #{seg.join(', ')} }"
when Gem::Version then obj.to_s.dump
when Date then obj.strftime('%Y-%m-%d').dump
when Time then obj.strftime('%Y-%m-%d').dump
when Numeric then obj.inspect
when true, false, nil then obj.inspect
when Gem::Platform then "Gem::Platform.new(#{obj.to_a.inspect})"
- when Gem::Requirement then "Gem::Requirement.new(#{obj.to_s.inspect})"
+ when Gem::Requirement then
+ list = obj.as_list
+ "Gem::Requirement.new(#{ruby_code(list.size == 1 ? obj.to_s : list)})"
else raise Gem::Exception, "ruby_code case not handled: #{obj.class}"
end
end
@@ -1755,11 +2170,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
@@ -1800,7 +2221,7 @@ class Gem::Specification
end
##
- # Singular accessor for #test_files
+ # Singular mutator for #test_files
def test_file= file
self.test_files = [file]
@@ -1826,24 +2247,6 @@ class Gem::Specification
end
##
- # Set test_files to +files+, ensuring it is an array.
-
- def test_files= files
- @test_files = Array files
- end
-
- def test_suite_file # :nodoc:
- # TODO: deprecate
- test_files.first
- end
-
- def test_suite_file= file # :nodoc:
- # TODO: deprecate
- @test_files = [] unless defined? @test_files
- @test_files << file
- end
-
- ##
# 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.
@@ -1852,6 +2255,9 @@ class Gem::Specification
mark_version
result = []
result << "# -*- encoding: utf-8 -*-"
+ result << "#{Gem::StubSpecification::PREFIX}#{name} #{version} #{platform} #{@require_paths.join("\0")}"
+ result << "#{Gem::StubSpecification::PREFIX}#{extensions.join "\0"}" unless
+ extensions.empty?
result << nil
result << "Gem::Specification.new do |s|"
@@ -1863,15 +2269,22 @@ class Gem::Specification
result << ""
result << " s.required_rubygems_version = #{ruby_code required_rubygems_version} if s.respond_to? :required_rubygems_version="
+ if metadata and !metadata.empty?
+ result << " s.metadata = #{ruby_code metadata} if s.respond_to? :metadata="
+ end
+ result << " s.require_paths = #{ruby_code @require_paths}"
+
handled = [
:dependencies,
:name,
:platform,
+ :require_paths,
:required_rubygems_version,
:specification_version,
:version,
:has_rdoc,
:default_executable,
+ :metadata
]
@@attributes.each do |attr_name|
@@ -1883,34 +2296,41 @@ class Gem::Specification
end
end
- result << nil
- result << " if s.respond_to? :specification_version then"
- result << " s.specification_version = #{specification_version}"
- result << nil
+ if @installed_by_version then
+ result << nil
+ result << " s.installed_by_version = \"#{Gem::VERSION}\" if s.respond_to? :installed_by_version"
+ end
- result << " if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then"
+ unless dependencies.empty? then
+ result << nil
+ result << " if s.respond_to? :specification_version then"
+ result << " s.specification_version = #{specification_version}"
+ result << nil
- dependencies.each do |dep|
- req = dep.requirements_list.inspect
- dep.instance_variable_set :@type, :runtime if dep.type.nil? # HACK
- result << " s.add_#{dep.type}_dependency(%q<#{dep.name}>, #{req})"
- end
+ result << " if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then"
- result << " else"
+ dependencies.each do |dep|
+ req = dep.requirements_list.inspect
+ dep.instance_variable_set :@type, :runtime if dep.type.nil? # HACK
+ result << " s.add_#{dep.type}_dependency(%q<#{dep.name}>, #{req})"
+ end
- dependencies.each do |dep|
- version_reqs_param = dep.requirements_list.inspect
- result << " s.add_dependency(%q<#{dep.name}>, #{version_reqs_param})"
- end
+ result << " else"
+
+ dependencies.each do |dep|
+ version_reqs_param = dep.requirements_list.inspect
+ result << " s.add_dependency(%q<#{dep.name}>, #{version_reqs_param})"
+ end
- result << ' end'
+ result << ' end'
- result << " else"
+ result << " else"
dependencies.each do |dep|
version_reqs_param = dep.requirements_list.inspect
result << " s.add_dependency(%q<#{dep.name}>, #{version_reqs_param})"
end
- result << " end"
+ result << " end"
+ end
result << "end"
result << nil
@@ -1932,6 +2352,13 @@ 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
# Because the user can switch the YAML engine behind our
@@ -1941,11 +2368,12 @@ class Gem::Specification
require 'rubygems/psych_tree'
end
- builder = Gem::NoAliasYAMLTree.new({})
+ builder = Gem::NoAliasYAMLTree.create
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)
@@ -1982,6 +2410,7 @@ class Gem::Specification
# checks..
def validate packaging = true
+ @warnings = 0
require 'rubygems/user_interaction'
extend Gem::UserInteraction
normalize
@@ -2012,7 +2441,7 @@ class Gem::Specification
"invalid value for attribute name: \"#{name.inspect}\""
end
- if require_paths.empty? then
+ if @require_paths.empty? then
raise Gem::InvalidSpecificationException,
'specification must have at least one require_path'
end
@@ -2030,6 +2459,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?)'
@@ -2063,6 +2497,35 @@ class Gem::Specification
val.empty?
end
+ unless Hash === metadata
+ raise Gem::InvalidSpecificationException,
+ 'metadata must be a hash'
+ end
+
+ metadata.keys.each do |k|
+ if !k.kind_of?(String)
+ raise Gem::InvalidSpecificationException,
+ 'metadata keys must be a String'
+ end
+
+ if k.size > 128
+ raise Gem::InvalidSpecificationException,
+ "metadata key too large (#{k.size} > 128)"
+ end
+ end
+
+ metadata.values.each do |k|
+ if !k.kind_of?(String)
+ raise Gem::InvalidSpecificationException,
+ 'metadata values must be a String'
+ end
+
+ if k.size > 1024
+ raise Gem::InvalidSpecificationException,
+ "metadata value too large (#{k.size} > 1024)"
+ end
+ end
+
licenses.each { |license|
if license.length > 64
raise Gem::InvalidSpecificationException,
@@ -2070,6 +2533,13 @@ class Gem::Specification
end
}
+ 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:
lazy = '"FIxxxXME" or "TOxxxDO"'.gsub(/xxx/, '')
@@ -2100,24 +2570,116 @@ 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
+
+ warning "prerelease dependency on #{dep} is not recommended" if
+ prerelease_dep
+
+ overly_strict = dep.requirement.requirements.length == 1 &&
+ dep.requirement.requirements.any? do |op, version|
+ op == '~>' and
+ not version.prerelease? and
+ version.segments.length > 2
+ 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
+
+ ##
+ # Checks to see if the files to be packaged are world-readable.
+
+ def validate_permissions
+ return if Gem.win_platform?
+
+ files.each do |file|
+ next if File.stat(file).mode & 0444 == 0444
+ warning "#{file} is not world-readable"
+ end
+
+ executables.each do |name|
+ exec = File.join @bindir, name
+ next if File.stat(exec).executable?
+ warning "#{exec} is not executable"
+ end
end
##
@@ -2128,10 +2690,15 @@ class Gem::Specification
def version= version
@version = Gem::Version.create(version)
self.required_rubygems_version = '> 1.3.1' if @version.prerelease?
+ invalidate_memoized_attributes
+
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
@@ -2147,25 +2714,45 @@ class Gem::Specification
self.platform = Gem::Platform.new @platform
end
+ ##
+ # Reset nil attributes to their default values to make the spec valid
+
+ def reset_nil_attributes_to_default
+ nil_attributes = self.class.non_nil_attributes.find_all do |name|
+ !instance_variable_defined?("@#{name}") || instance_variable_get("@#{name}").nil?
+ end
+
+ nil_attributes.each do |attribute|
+ default = self.default_value attribute
+
+ value = case default
+ when Time, Numeric, Symbol, true, false, nil then default
+ else default.dup
+ end
+
+ instance_variable_set "@#{attribute}", value
+ end
+
+ @installed_by_version ||= nil
+ end
+
+ def warning statement # :nodoc:
+ @warnings += 1
+
+ alert_warning statement
+ end
+
extend Gem::Deprecate
- deprecate :test_suite_file, :test_file, 2011, 10
- deprecate :test_suite_file=, :test_file=, 2011, 10
- deprecate :loaded, :activated, 2011, 10
- deprecate :loaded?, :activated?, 2011, 10
- deprecate :loaded=, :activated=, 2011, 10
- deprecate :installation_path, :base_dir, 2011, 10
- deprecate :cache_gem, :cache_file, 2011, 10
# TODO:
# deprecate :has_rdoc, :none, 2011, 10
# deprecate :has_rdoc?, :none, 2011, 10
# deprecate :has_rdoc=, :none, 2011, 10
# deprecate :default_executable, :none, 2011, 10
# deprecate :default_executable=, :none, 2011, 10
- # deprecate :spec_name, :spec_file, 2011, 10
# deprecate :file_name, :cache_file, 2011, 10
# deprecate :full_gem_path, :cache_file, 2011, 10
end
+# DOC: What is this and why is it here, randomly, at the end of this file?
Gem.clear_paths
-
diff --git a/lib/rubygems/ssl_certs/.document b/lib/rubygems/ssl_certs/.document
new file mode 100644
index 0000000000..fb66f13c33
--- /dev/null
+++ b/lib/rubygems/ssl_certs/.document
@@ -0,0 +1 @@
+# Ignore all files in this directory
diff --git a/lib/rubygems/ssl_certs/Class3PublicPrimaryCertificationAuthority.pem b/lib/rubygems/ssl_certs/Class3PublicPrimaryCertificationAuthority.pem
new file mode 100644
index 0000000000..87676acf5f
--- /dev/null
+++ b/lib/rubygems/ssl_certs/Class3PublicPrimaryCertificationAuthority.pem
@@ -0,0 +1,14 @@
+-----BEGIN CERTIFICATE-----
+MIICPDCCAaUCEHC65B0Q2Sk0tjjKewPMur8wDQYJKoZIhvcNAQECBQAwXzELMAkG
+A1UEBhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMTcwNQYDVQQLEy5DbGFz
+cyAzIFB1YmxpYyBQcmltYXJ5IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MB4XDTk2
+MDEyOTAwMDAwMFoXDTI4MDgwMTIzNTk1OVowXzELMAkGA1UEBhMCVVMxFzAVBgNV
+BAoTDlZlcmlTaWduLCBJbmMuMTcwNQYDVQQLEy5DbGFzcyAzIFB1YmxpYyBQcmlt
+YXJ5IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIGfMA0GCSqGSIb3DQEBAQUAA4GN
+ADCBiQKBgQDJXFme8huKARS0EN8EQNvjV69qRUCPhAwL0TPZ2RHP7gJYHyX3KqhE
+BarsAx94f56TuZoAqiN91qyFomNFx3InzPRMxnVx0jnvT0Lwdd8KkMaOIG+YD/is
+I19wKTakyYbnsZogy1Olhec9vn2a/iRFM9x2Fe0PonFkTGUugWhFpwIDAQABMA0G
+CSqGSIb3DQEBAgUAA4GBALtMEivPLCYATxQT3ab7/AoRhIzzKBxnki98tsX63/Do
+lbwdj2wsqFHMc9ikwFPwTtYmwHYBV4GSXiHx0bH/59AhWM1pF+NEHJwZRDmJXNyc
+AA9WjQKZ7aKQRUzkuxCkPfAyAw7xzvjoyVGM5mKf5p/AfbdynMk2OmufTqj/ZA1k
+-----END CERTIFICATE-----
diff --git a/lib/rubygems/ssl_certs/DigiCertHighAssuranceEVRootCA.pem b/lib/rubygems/ssl_certs/DigiCertHighAssuranceEVRootCA.pem
new file mode 100644
index 0000000000..9e6810ab70
--- /dev/null
+++ b/lib/rubygems/ssl_certs/DigiCertHighAssuranceEVRootCA.pem
@@ -0,0 +1,23 @@
+-----BEGIN CERTIFICATE-----
+MIIDxTCCAq2gAwIBAgIQAqxcJmoLQJuPC3nyrkYldzANBgkqhkiG9w0BAQUFADBs
+MQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3
+d3cuZGlnaWNlcnQuY29tMSswKQYDVQQDEyJEaWdpQ2VydCBIaWdoIEFzc3VyYW5j
+ZSBFViBSb290IENBMB4XDTA2MTExMDAwMDAwMFoXDTMxMTExMDAwMDAwMFowbDEL
+MAkGA1UEBhMCVVMxFTATBgNVBAoTDERpZ2lDZXJ0IEluYzEZMBcGA1UECxMQd3d3
+LmRpZ2ljZXJ0LmNvbTErMCkGA1UEAxMiRGlnaUNlcnQgSGlnaCBBc3N1cmFuY2Ug
+RVYgUm9vdCBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMbM5XPm
++9S75S0tMqbf5YE/yc0lSbZxKsPVlDRnogocsF9ppkCxxLeyj9CYpKlBWTrT3JTW
+PNt0OKRKzE0lgvdKpVMSOO7zSW1xkX5jtqumX8OkhPhPYlG++MXs2ziS4wblCJEM
+xChBVfvLWokVfnHoNb9Ncgk9vjo4UFt3MRuNs8ckRZqnrG0AFFoEt7oT61EKmEFB
+Ik5lYYeBQVCmeVyJ3hlKV9Uu5l0cUyx+mM0aBhakaHPQNAQTXKFx01p8VdteZOE3
+hzBWBOURtCmAEvF5OYiiAhF8J2a3iLd48soKqDirCmTCv2ZdlYTBoSUeh10aUAsg
+EsxBu24LUTi4S8sCAwEAAaNjMGEwDgYDVR0PAQH/BAQDAgGGMA8GA1UdEwEB/wQF
+MAMBAf8wHQYDVR0OBBYEFLE+w2kD+L9HAdSYJhoIAu9jZCvDMB8GA1UdIwQYMBaA
+FLE+w2kD+L9HAdSYJhoIAu9jZCvDMA0GCSqGSIb3DQEBBQUAA4IBAQAcGgaX3Nec
+nzyIZgYIVyHbIUf4KmeqvxgydkAQV8GK83rZEWWONfqe/EW1ntlMMUu4kehDLI6z
+eM7b41N5cdblIZQB2lWHmiRk9opmzN6cN82oNLFpmyPInngiK3BD41VHMWEZ71jF
+hS9OMPagMRYjyOfiZRYzy78aG6A9+MpeizGLYAiJLQwGXFK3xPkKmNEVX58Svnw2
+Yzi9RKR/5CYrCsSXaQ3pjOLAEFe4yHYSkVXySGnYvCoCWw9E1CAx2/S6cCZdkGCe
+vEsXCS+0yx5DaMkHJ8HSXPfqIbloEpw8nL+e/IBcm2PN7EeqJSdnoDfzAIJ9VNep
++OkuE6N36B9K
+-----END CERTIFICATE-----
diff --git a/lib/rubygems/ssl_certs/EntrustnetSecureServerCertificationAuthority.pem b/lib/rubygems/ssl_certs/EntrustnetSecureServerCertificationAuthority.pem
new file mode 100644
index 0000000000..4b8939ccba
--- /dev/null
+++ b/lib/rubygems/ssl_certs/EntrustnetSecureServerCertificationAuthority.pem
@@ -0,0 +1,28 @@
+-----BEGIN CERTIFICATE-----
+MIIE2DCCBEGgAwIBAgIEN0rSQzANBgkqhkiG9w0BAQUFADCBwzELMAkGA1UEBhMC
+VVMxFDASBgNVBAoTC0VudHJ1c3QubmV0MTswOQYDVQQLEzJ3d3cuZW50cnVzdC5u
+ZXQvQ1BTIGluY29ycC4gYnkgcmVmLiAobGltaXRzIGxpYWIuKTElMCMGA1UECxMc
+KGMpIDE5OTkgRW50cnVzdC5uZXQgTGltaXRlZDE6MDgGA1UEAxMxRW50cnVzdC5u
+ZXQgU2VjdXJlIFNlcnZlciBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw05OTA1
+MjUxNjA5NDBaFw0xOTA1MjUxNjM5NDBaMIHDMQswCQYDVQQGEwJVUzEUMBIGA1UE
+ChMLRW50cnVzdC5uZXQxOzA5BgNVBAsTMnd3dy5lbnRydXN0Lm5ldC9DUFMgaW5j
+b3JwLiBieSByZWYuIChsaW1pdHMgbGlhYi4pMSUwIwYDVQQLExwoYykgMTk5OSBF
+bnRydXN0Lm5ldCBMaW1pdGVkMTowOAYDVQQDEzFFbnRydXN0Lm5ldCBTZWN1cmUg
+U2VydmVyIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIGdMA0GCSqGSIb3DQEBAQUA
+A4GLADCBhwKBgQDNKIM0VBuJ8w+vN5Ex/68xYMmo6LIQaO2f55M28Qpku0f1BBc/
+I0dNxScZgSYMVHINiC3ZH5oSn7yzcdOAGT9HZnuMNSjSuQrfJNqc1lB5gXpa0zf3
+wkrYKZImZNHkmGw6AIr1NJtl+O3jEP/9uElY3KDegjlrgbEWGWG5VLbmQwIBA6OC
+AdcwggHTMBEGCWCGSAGG+EIBAQQEAwIABzCCARkGA1UdHwSCARAwggEMMIHeoIHb
+oIHYpIHVMIHSMQswCQYDVQQGEwJVUzEUMBIGA1UEChMLRW50cnVzdC5uZXQxOzA5
+BgNVBAsTMnd3dy5lbnRydXN0Lm5ldC9DUFMgaW5jb3JwLiBieSByZWYuIChsaW1p
+dHMgbGlhYi4pMSUwIwYDVQQLExwoYykgMTk5OSBFbnRydXN0Lm5ldCBMaW1pdGVk
+MTowOAYDVQQDEzFFbnRydXN0Lm5ldCBTZWN1cmUgU2VydmVyIENlcnRpZmljYXRp
+b24gQXV0aG9yaXR5MQ0wCwYDVQQDEwRDUkwxMCmgJ6AlhiNodHRwOi8vd3d3LmVu
+dHJ1c3QubmV0L0NSTC9uZXQxLmNybDArBgNVHRAEJDAigA8xOTk5MDUyNTE2MDk0
+MFqBDzIwMTkwNTI1MTYwOTQwWjALBgNVHQ8EBAMCAQYwHwYDVR0jBBgwFoAU8Bdi
+E1U9s/8KAGv7UISX8+1i0BowHQYDVR0OBBYEFPAXYhNVPbP/CgBr+1CEl/PtYtAa
+MAwGA1UdEwQFMAMBAf8wGQYJKoZIhvZ9B0EABAwwChsEVjQuMAMCBJAwDQYJKoZI
+hvcNAQEFBQADgYEAkNwwAvpkdMKnCqV8IY00F6j7Rw7/JXyNEwr75Ji174z4xRAN
+95K+8cPV1ZVqBLssziY2ZcgxxufuP+NXdYR6Ee9GTxj005i7qIcyunL2POI9n9cd
+2cNgQ4xYDiKWL2KjLB+6rQXvqzJ4h6BUcxm1XAX5Uj5tLUUL9wqT6u0G+bI=
+-----END CERTIFICATE-----
diff --git a/lib/rubygems/ssl_certs/GeoTrustGlobalCA.pem b/lib/rubygems/ssl_certs/GeoTrustGlobalCA.pem
new file mode 100644
index 0000000000..bcb2529761
--- /dev/null
+++ b/lib/rubygems/ssl_certs/GeoTrustGlobalCA.pem
@@ -0,0 +1,20 @@
+-----BEGIN CERTIFICATE-----
+MIIDVDCCAjygAwIBAgIDAjRWMA0GCSqGSIb3DQEBBQUAMEIxCzAJBgNVBAYTAlVT
+MRYwFAYDVQQKEw1HZW9UcnVzdCBJbmMuMRswGQYDVQQDExJHZW9UcnVzdCBHbG9i
+YWwgQ0EwHhcNMDIwNTIxMDQwMDAwWhcNMjIwNTIxMDQwMDAwWjBCMQswCQYDVQQG
+EwJVUzEWMBQGA1UEChMNR2VvVHJ1c3QgSW5jLjEbMBkGA1UEAxMSR2VvVHJ1c3Qg
+R2xvYmFsIENBMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA2swYYzD9
+9BcjGlZ+W988bDjkcbd4kdS8odhM+KhDtgPpTSEHCIjaWC9mOSm9BXiLnTjoBbdq
+fnGk5sRgprDvgOSJKA+eJdbtg/OtppHHmMlCGDUUna2YRpIuT8rxh0PBFpVXLVDv
+iS2Aelet8u5fa9IAjbkU+BQVNdnARqN7csiRv8lVK83Qlz6cJmTM386DGXHKTubU
+1XupGc1V3sjs0l44U+VcT4wt/lAjNvxm5suOpDkZALeVAjmRCw7+OC7RHQWa9k0+
+bw8HHa8sHo9gOeL6NlMTOdReJivbPagUvTLrGAMoUgRx5aszPeE4uwc2hGKceeoW
+MPRfwCvocWvk+QIDAQABo1MwUTAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBTA
+ephojYn7qwVkDBF9qn1luMrMTjAfBgNVHSMEGDAWgBTAephojYn7qwVkDBF9qn1l
+uMrMTjANBgkqhkiG9w0BAQUFAAOCAQEANeMpauUvXVSOKVCUn5kaFOSPeCpilKIn
+Z57QzxpeR+nBsqTP3UEaBU6bS+5Kb1VSsyShNwrrZHYqLizz/Tt1kL/6cdjHPTfS
+tQWVYrmm3ok9Nns4d0iXrKYgjy6myQzCsplFAMfOEVEiIuCl6rYVSAlk6l5PdPcF
+PseKUgzbFbS9bZvlxrFUaKnjaZC2mqUPuLk/IH2uSrW4nOQdtqvmlKXBx4Ot2/Un
+hw4EbNX/3aBd7YdStysVAq45pmp06drE57xNNB6pXE0zX5IJL4hmXXeXxx12E6nV
+5fEWCRE11azbJHFwLJhWC9kXtNHjUStedejV0NxPNO3CBWaAocvmMw==
+-----END CERTIFICATE-----
diff --git a/lib/rubygems/ssl_certs/ca-bundle.pem b/lib/rubygems/ssl_certs/ca-bundle.pem
deleted file mode 100644
index b4dac9112f..0000000000
--- a/lib/rubygems/ssl_certs/ca-bundle.pem
+++ /dev/null
@@ -1,3366 +0,0 @@
-##
-## ca-bundle.crt -- Bundle of CA Root Certificates
-##
-## Certificate data from Mozilla as of: Sun Feb 19 04:03:37 2012
-##
-## This is a bundle of X.509 certificates of public Certificate Authorities
-## (CA). These were automatically extracted from Mozilla's root certificates
-## file (certdata.txt). This file can be found in the mozilla source tree:
-## https://mxr.mozilla.org/mozilla/source/security/nss/lib/ckfw/builtins/certdata.txt?raw=1
-##
-## It contains the certificates in PEM format and therefore
-## can be directly used with curl / libcurl / php_curl, or with
-## an Apache+mod_ssl webserver for SSL client authentication.
-## Just configure this file as the SSLCACertificateFile.
-##
-
-# ***** BEGIN LICENSE BLOCK *****
-# Version: MPL 1.1/GPL 2.0/LGPL 2.1
-#
-# The contents of this file are subject to the Mozilla Public License Version
-# 1.1 (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-# http://www.mozilla.org/MPL/
-#
-# Software distributed under the License is distributed on an "AS IS" basis,
-# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
-# for the specific language governing rights and limitations under the
-# License.
-#
-# The Original Code is the Netscape security libraries.
-#
-# The Initial Developer of the Original Code is
-# Netscape Communications Corporation.
-# Portions created by the Initial Developer are Copyright (C) 1994-2000
-# the Initial Developer. All Rights Reserved.
-#
-# Contributor(s):
-#
-# Alternatively, the contents of this file may be used under the terms of
-# either the GNU General Public License Version 2 or later (the "GPL"), or
-# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
-# in which case the provisions of the GPL or the LGPL are applicable instead
-# of those above. If you wish to allow use of your version of this file only
-# under the terms of either the GPL or the LGPL, and not to allow others to
-# use your version of this file under the terms of the MPL, indicate your
-# decision by deleting the provisions above and replace them with the notice
-# and other provisions required by the GPL or the LGPL. If you do not delete
-# the provisions above, a recipient may use your version of this file under
-# the terms of any one of the MPL, the GPL or the LGPL.
-#
-# ***** END LICENSE BLOCK *****
-# @(#) $RCSfile: certdata.txt,v $ $Revision: 1.82 $ $Date: 2012/02/18 21:41:46 $
-
-GTE CyberTrust Global Root
-==========================
------BEGIN CERTIFICATE-----
-MIICWjCCAcMCAgGlMA0GCSqGSIb3DQEBBAUAMHUxCzAJBgNVBAYTAlVTMRgwFgYDVQQKEw9HVEUg
-Q29ycG9yYXRpb24xJzAlBgNVBAsTHkdURSBDeWJlclRydXN0IFNvbHV0aW9ucywgSW5jLjEjMCEG
-A1UEAxMaR1RFIEN5YmVyVHJ1c3QgR2xvYmFsIFJvb3QwHhcNOTgwODEzMDAyOTAwWhcNMTgwODEz
-MjM1OTAwWjB1MQswCQYDVQQGEwJVUzEYMBYGA1UEChMPR1RFIENvcnBvcmF0aW9uMScwJQYDVQQL
-Ex5HVEUgQ3liZXJUcnVzdCBTb2x1dGlvbnMsIEluYy4xIzAhBgNVBAMTGkdURSBDeWJlclRydXN0
-IEdsb2JhbCBSb290MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCVD6C28FCc6HrHiM3dFw4u
-sJTQGz0O9pTAipTHBsiQl8i4ZBp6fmw8U+E3KHNgf7KXUwefU/ltWJTSr41tiGeA5u2ylc9yMcql
-HHK6XALnZELn+aks1joNrI1CqiQBOeacPwGFVw1Yh0X404Wqk2kmhXBIgD8SFcd5tB8FLztimQID
-AQABMA0GCSqGSIb3DQEBBAUAA4GBAG3rGwnpXtlR22ciYaQqPEh346B8pt5zohQDhT37qw4wxYMW
-M4ETCJ57NE7fQMh017l93PR2VX2bY1QY6fDq81yx2YtCHrnAlU66+tXifPVoYb+O7AWXX1uw16OF
-NMQkpw0PlZPvy5TYnh+dXIVtx6quTx8itc2VrbqnzPmrC3p/
------END CERTIFICATE-----
-
-Thawte Server CA
-================
------BEGIN CERTIFICATE-----
-MIIDEzCCAnygAwIBAgIBATANBgkqhkiG9w0BAQQFADCBxDELMAkGA1UEBhMCWkExFTATBgNVBAgT
-DFdlc3Rlcm4gQ2FwZTESMBAGA1UEBxMJQ2FwZSBUb3duMR0wGwYDVQQKExRUaGF3dGUgQ29uc3Vs
-dGluZyBjYzEoMCYGA1UECxMfQ2VydGlmaWNhdGlvbiBTZXJ2aWNlcyBEaXZpc2lvbjEZMBcGA1UE
-AxMQVGhhd3RlIFNlcnZlciBDQTEmMCQGCSqGSIb3DQEJARYXc2VydmVyLWNlcnRzQHRoYXd0ZS5j
-b20wHhcNOTYwODAxMDAwMDAwWhcNMjAxMjMxMjM1OTU5WjCBxDELMAkGA1UEBhMCWkExFTATBgNV
-BAgTDFdlc3Rlcm4gQ2FwZTESMBAGA1UEBxMJQ2FwZSBUb3duMR0wGwYDVQQKExRUaGF3dGUgQ29u
-c3VsdGluZyBjYzEoMCYGA1UECxMfQ2VydGlmaWNhdGlvbiBTZXJ2aWNlcyBEaXZpc2lvbjEZMBcG
-A1UEAxMQVGhhd3RlIFNlcnZlciBDQTEmMCQGCSqGSIb3DQEJARYXc2VydmVyLWNlcnRzQHRoYXd0
-ZS5jb20wgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBANOkUG7I/1Zr5s9dtuoMaHVHoqrC2oQl
-/Kj0R1HahbUgdJSGHg91yekIYfUGbTBuFRkC6VLAYttNmZ7iagxEOM3+vuNkCXDF/rFrKbYvScg7
-1CcEJRCXL+eQbcAoQpnXTEPew/UhbVSfXcNY4cDk2VuwuNy0e982OsK1ZiIS1ocNAgMBAAGjEzAR
-MA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQEEBQADgYEAB/pMaVz7lcxG7oWDTSEwjsrZqG9J
-GubaUeNgcGyEYRGhGshIPllDfU+VPaGLtwtimHp1it2ITk6eQNuozDJ0uW8NxuOzRAvZim+aKZuZ
-GCg70eNAKJpaPNW15yAbi8qkq43pUdniTCxZqdq5snUb9kLy78fyGPmJvKP/iiMucEc=
------END CERTIFICATE-----
-
-Thawte Premium Server CA
-========================
------BEGIN CERTIFICATE-----
-MIIDJzCCApCgAwIBAgIBATANBgkqhkiG9w0BAQQFADCBzjELMAkGA1UEBhMCWkExFTATBgNVBAgT
-DFdlc3Rlcm4gQ2FwZTESMBAGA1UEBxMJQ2FwZSBUb3duMR0wGwYDVQQKExRUaGF3dGUgQ29uc3Vs
-dGluZyBjYzEoMCYGA1UECxMfQ2VydGlmaWNhdGlvbiBTZXJ2aWNlcyBEaXZpc2lvbjEhMB8GA1UE
-AxMYVGhhd3RlIFByZW1pdW0gU2VydmVyIENBMSgwJgYJKoZIhvcNAQkBFhlwcmVtaXVtLXNlcnZl
-ckB0aGF3dGUuY29tMB4XDTk2MDgwMTAwMDAwMFoXDTIwMTIzMTIzNTk1OVowgc4xCzAJBgNVBAYT
-AlpBMRUwEwYDVQQIEwxXZXN0ZXJuIENhcGUxEjAQBgNVBAcTCUNhcGUgVG93bjEdMBsGA1UEChMU
-VGhhd3RlIENvbnN1bHRpbmcgY2MxKDAmBgNVBAsTH0NlcnRpZmljYXRpb24gU2VydmljZXMgRGl2
-aXNpb24xITAfBgNVBAMTGFRoYXd0ZSBQcmVtaXVtIFNlcnZlciBDQTEoMCYGCSqGSIb3DQEJARYZ
-cHJlbWl1bS1zZXJ2ZXJAdGhhd3RlLmNvbTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEA0jY2
-aovXwlue2oFBYo847kkEVdbQ7xwblRZH7xhINTpS9CtqBo87L+pW46+GjZ4X9560ZXUCTe/LCaIh
-Udib0GfQug2SBhRz1JPLlyoAnFxODLz6FVL88kRu2hFKbgifLy3j+ao6hnO2RlNYyIkFvYMRuHM/
-qgeN9EJN50CdHDcCAwEAAaMTMBEwDwYDVR0TAQH/BAUwAwEB/zANBgkqhkiG9w0BAQQFAAOBgQAm
-SCwWwlj66BZ0DKqqX1Q/8tfJeGBeXm43YyJ3Nn6yF8Q0ufUIhfzJATj/Tb7yFkJD57taRvvBxhEf
-8UqwKEbJw8RCfbz6q1lu1bdRiBHjpIUZa4JMpAwSremkrj/xw0llmozFyD4lt5SZu5IycQfwhl7t
-UCemDaYj+bvLpgcUQg==
------END CERTIFICATE-----
-
-Equifax Secure CA
-=================
------BEGIN CERTIFICATE-----
-MIIDIDCCAomgAwIBAgIENd70zzANBgkqhkiG9w0BAQUFADBOMQswCQYDVQQGEwJVUzEQMA4GA1UE
-ChMHRXF1aWZheDEtMCsGA1UECxMkRXF1aWZheCBTZWN1cmUgQ2VydGlmaWNhdGUgQXV0aG9yaXR5
-MB4XDTk4MDgyMjE2NDE1MVoXDTE4MDgyMjE2NDE1MVowTjELMAkGA1UEBhMCVVMxEDAOBgNVBAoT
-B0VxdWlmYXgxLTArBgNVBAsTJEVxdWlmYXggU2VjdXJlIENlcnRpZmljYXRlIEF1dGhvcml0eTCB
-nzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEAwV2xWGcIYu6gmi0fCG2RFGiYCh7+2gRvE4RiIcPR
-fM6fBeC4AfBONOziipUEZKzxa1NfBbPLZ4C/QgKO/t0BCezhABRP/PvwDN1Dulsr4R+AcJkVV5MW
-8Q+XarfCaCMczE1ZMKxRHjuvK9buY0V7xdlfUNLjUA86iOe/FP3gx7kCAwEAAaOCAQkwggEFMHAG
-A1UdHwRpMGcwZaBjoGGkXzBdMQswCQYDVQQGEwJVUzEQMA4GA1UEChMHRXF1aWZheDEtMCsGA1UE
-CxMkRXF1aWZheCBTZWN1cmUgQ2VydGlmaWNhdGUgQXV0aG9yaXR5MQ0wCwYDVQQDEwRDUkwxMBoG
-A1UdEAQTMBGBDzIwMTgwODIyMTY0MTUxWjALBgNVHQ8EBAMCAQYwHwYDVR0jBBgwFoAUSOZo+SvS
-spXXR9gjIBBPM5iQn9QwHQYDVR0OBBYEFEjmaPkr0rKV10fYIyAQTzOYkJ/UMAwGA1UdEwQFMAMB
-Af8wGgYJKoZIhvZ9B0EABA0wCxsFVjMuMGMDAgbAMA0GCSqGSIb3DQEBBQUAA4GBAFjOKer89961
-zgK5F7WF0bnj4JXMJTENAKaSbn+2kmOeUJXRmm/kEd5jhW6Y7qj/WsjTVbJmcVfewCHrPSqnI0kB
-BIZCe/zuf6IWUrVnZ9NA2zsmWLIodz2uFHdh1voqZiegDfqnc1zqcPGUIWVEX/r87yloqaKHee95
-70+sB3c4
------END CERTIFICATE-----
-
-Digital Signature Trust Co. Global CA 1
-=======================================
------BEGIN CERTIFICATE-----
-MIIDKTCCApKgAwIBAgIENnAVljANBgkqhkiG9w0BAQUFADBGMQswCQYDVQQGEwJVUzEkMCIGA1UE
-ChMbRGlnaXRhbCBTaWduYXR1cmUgVHJ1c3QgQ28uMREwDwYDVQQLEwhEU1RDQSBFMTAeFw05ODEy
-MTAxODEwMjNaFw0xODEyMTAxODQwMjNaMEYxCzAJBgNVBAYTAlVTMSQwIgYDVQQKExtEaWdpdGFs
-IFNpZ25hdHVyZSBUcnVzdCBDby4xETAPBgNVBAsTCERTVENBIEUxMIGdMA0GCSqGSIb3DQEBAQUA
-A4GLADCBhwKBgQCgbIGpzzQeJN3+hijM3oMv+V7UQtLodGBmE5gGHKlREmlvMVW5SXIACH7TpWJE
-NySZj9mDSI+ZbZUTu0M7LklOiDfBu1h//uG9+LthzfNHwJmm8fOR6Hh8AMthyUQncWlVSn5JTe2i
-o74CTADKAqjuAQIxZA9SLRN0dja1erQtcQIBA6OCASQwggEgMBEGCWCGSAGG+EIBAQQEAwIABzBo
-BgNVHR8EYTBfMF2gW6BZpFcwVTELMAkGA1UEBhMCVVMxJDAiBgNVBAoTG0RpZ2l0YWwgU2lnbmF0
-dXJlIFRydXN0IENvLjERMA8GA1UECxMIRFNUQ0EgRTExDTALBgNVBAMTBENSTDEwKwYDVR0QBCQw
-IoAPMTk5ODEyMTAxODEwMjNagQ8yMDE4MTIxMDE4MTAyM1owCwYDVR0PBAQDAgEGMB8GA1UdIwQY
-MBaAFGp5fpFpRhgTCgJ3pVlbYJglDqL4MB0GA1UdDgQWBBRqeX6RaUYYEwoCd6VZW2CYJQ6i+DAM
-BgNVHRMEBTADAQH/MBkGCSqGSIb2fQdBAAQMMAobBFY0LjADAgSQMA0GCSqGSIb3DQEBBQUAA4GB
-ACIS2Hod3IEGtgllsofIH160L+nEHvI8wbsEkBFKg05+k7lNQseSJqBcNJo4cvj9axY+IO6CizEq
-kzaFI4iKPANo08kJD038bKTaKHKTDomAsH3+gG9lbRgzl4vCa4nuYD3Im+9/KzJic5PLPON74nZ4
-RbyhkwS7hp86W0N6w4pl
------END CERTIFICATE-----
-
-Digital Signature Trust Co. Global CA 3
-=======================================
------BEGIN CERTIFICATE-----
-MIIDKTCCApKgAwIBAgIENm7TzjANBgkqhkiG9w0BAQUFADBGMQswCQYDVQQGEwJVUzEkMCIGA1UE
-ChMbRGlnaXRhbCBTaWduYXR1cmUgVHJ1c3QgQ28uMREwDwYDVQQLEwhEU1RDQSBFMjAeFw05ODEy
-MDkxOTE3MjZaFw0xODEyMDkxOTQ3MjZaMEYxCzAJBgNVBAYTAlVTMSQwIgYDVQQKExtEaWdpdGFs
-IFNpZ25hdHVyZSBUcnVzdCBDby4xETAPBgNVBAsTCERTVENBIEUyMIGdMA0GCSqGSIb3DQEBAQUA
-A4GLADCBhwKBgQC/k48Xku8zExjrEH9OFr//Bo8qhbxe+SSmJIi2A7fBw18DW9Fvrn5C6mYjuGOD
-VvsoLeE4i7TuqAHhzhy2iCoiRoX7n6dwqUcUP87eZfCocfdPJmyMvMa1795JJ/9IKn3oTQPMx7JS
-xhcxEzu1TdvIxPbDDyQq2gyd55FbgM2UnQIBA6OCASQwggEgMBEGCWCGSAGG+EIBAQQEAwIABzBo
-BgNVHR8EYTBfMF2gW6BZpFcwVTELMAkGA1UEBhMCVVMxJDAiBgNVBAoTG0RpZ2l0YWwgU2lnbmF0
-dXJlIFRydXN0IENvLjERMA8GA1UECxMIRFNUQ0EgRTIxDTALBgNVBAMTBENSTDEwKwYDVR0QBCQw
-IoAPMTk5ODEyMDkxOTE3MjZagQ8yMDE4MTIwOTE5MTcyNlowCwYDVR0PBAQDAgEGMB8GA1UdIwQY
-MBaAFB6CTShlgDzJQW6sNS5ay97u+DlbMB0GA1UdDgQWBBQegk0oZYA8yUFurDUuWsve7vg5WzAM
-BgNVHRMEBTADAQH/MBkGCSqGSIb2fQdBAAQMMAobBFY0LjADAgSQMA0GCSqGSIb3DQEBBQUAA4GB
-AEeNg61i8tuwnkUiBbmi1gMOOHLnnvx75pO2mqWilMg0HZHRxdf0CiUPPXiBng+xZ8SQTGPdXqfi
-up/1902lMXucKS1M/mQ+7LZT/uqb7YLbdHVLB3luHtgZg3Pe9T7Qtd7nS2h9Qy4qIOF+oHhEngj1
-mPnHfxsb1gYgAlihw6ID
------END CERTIFICATE-----
-
-Verisign Class 3 Public Primary Certification Authority
-=======================================================
------BEGIN CERTIFICATE-----
-MIICPDCCAaUCEHC65B0Q2Sk0tjjKewPMur8wDQYJKoZIhvcNAQECBQAwXzELMAkGA1UEBhMCVVMx
-FzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMTcwNQYDVQQLEy5DbGFzcyAzIFB1YmxpYyBQcmltYXJ5
-IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MB4XDTk2MDEyOTAwMDAwMFoXDTI4MDgwMTIzNTk1OVow
-XzELMAkGA1UEBhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMTcwNQYDVQQLEy5DbGFzcyAz
-IFB1YmxpYyBQcmltYXJ5IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIGfMA0GCSqGSIb3DQEBAQUA
-A4GNADCBiQKBgQDJXFme8huKARS0EN8EQNvjV69qRUCPhAwL0TPZ2RHP7gJYHyX3KqhEBarsAx94
-f56TuZoAqiN91qyFomNFx3InzPRMxnVx0jnvT0Lwdd8KkMaOIG+YD/isI19wKTakyYbnsZogy1Ol
-hec9vn2a/iRFM9x2Fe0PonFkTGUugWhFpwIDAQABMA0GCSqGSIb3DQEBAgUAA4GBALtMEivPLCYA
-TxQT3ab7/AoRhIzzKBxnki98tsX63/Dolbwdj2wsqFHMc9ikwFPwTtYmwHYBV4GSXiHx0bH/59Ah
-WM1pF+NEHJwZRDmJXNycAA9WjQKZ7aKQRUzkuxCkPfAyAw7xzvjoyVGM5mKf5p/AfbdynMk2Omuf
-Tqj/ZA1k
------END CERTIFICATE-----
-
-Verisign Class 3 Public Primary Certification Authority - G2
-============================================================
------BEGIN CERTIFICATE-----
-MIIDAjCCAmsCEH3Z/gfPqB63EHln+6eJNMYwDQYJKoZIhvcNAQEFBQAwgcExCzAJBgNVBAYTAlVT
-MRcwFQYDVQQKEw5WZXJpU2lnbiwgSW5jLjE8MDoGA1UECxMzQ2xhc3MgMyBQdWJsaWMgUHJpbWFy
-eSBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSAtIEcyMTowOAYDVQQLEzEoYykgMTk5OCBWZXJpU2ln
-biwgSW5jLiAtIEZvciBhdXRob3JpemVkIHVzZSBvbmx5MR8wHQYDVQQLExZWZXJpU2lnbiBUcnVz
-dCBOZXR3b3JrMB4XDTk4MDUxODAwMDAwMFoXDTI4MDgwMTIzNTk1OVowgcExCzAJBgNVBAYTAlVT
-MRcwFQYDVQQKEw5WZXJpU2lnbiwgSW5jLjE8MDoGA1UECxMzQ2xhc3MgMyBQdWJsaWMgUHJpbWFy
-eSBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSAtIEcyMTowOAYDVQQLEzEoYykgMTk5OCBWZXJpU2ln
-biwgSW5jLiAtIEZvciBhdXRob3JpemVkIHVzZSBvbmx5MR8wHQYDVQQLExZWZXJpU2lnbiBUcnVz
-dCBOZXR3b3JrMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDMXtERXVxp0KvTuWpMmR9ZmDCO
-FoUgRm1HP9SFIIThbbP4pO0M8RcPO/mn+SXXwc+EY/J8Y8+iR/LGWzOOZEAEaMGAuWQcRXfH2G71
-lSk8UOg013gfqLptQ5GVj0VXXn7F+8qkBOvqlzdUMG+7AUcyM83cV5tkaWH4mx0ciU9cZwIDAQAB
-MA0GCSqGSIb3DQEBBQUAA4GBAFFNzb5cy5gZnBWyATl4Lk0PZ3BwmcYQWpSkU01UbSuvDV1Ai2TT
-1+7eVmGSX6bEHRBhNtMsJzzoKQm5EWR0zLVznxxIqbxhAe7iF6YM40AIOw7n60RzKprxaZLvcRTD
-Oaxxp5EJb+RxBrO6WVcmeQD2+A2iMzAo1KpYoJ2daZH9
------END CERTIFICATE-----
-
-GlobalSign Root CA
-==================
------BEGIN CERTIFICATE-----
-MIIDdTCCAl2gAwIBAgILBAAAAAABFUtaw5QwDQYJKoZIhvcNAQEFBQAwVzELMAkGA1UEBhMCQkUx
-GTAXBgNVBAoTEEdsb2JhbFNpZ24gbnYtc2ExEDAOBgNVBAsTB1Jvb3QgQ0ExGzAZBgNVBAMTEkds
-b2JhbFNpZ24gUm9vdCBDQTAeFw05ODA5MDExMjAwMDBaFw0yODAxMjgxMjAwMDBaMFcxCzAJBgNV
-BAYTAkJFMRkwFwYDVQQKExBHbG9iYWxTaWduIG52LXNhMRAwDgYDVQQLEwdSb290IENBMRswGQYD
-VQQDExJHbG9iYWxTaWduIFJvb3QgQ0EwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDa
-DuaZjc6j40+Kfvvxi4Mla+pIH/EqsLmVEQS98GPR4mdmzxzdzxtIK+6NiY6arymAZavpxy0Sy6sc
-THAHoT0KMM0VjU/43dSMUBUc71DuxC73/OlS8pF94G3VNTCOXkNz8kHp1Wrjsok6Vjk4bwY8iGlb
-Kk3Fp1S4bInMm/k8yuX9ifUSPJJ4ltbcdG6TRGHRjcdGsnUOhugZitVtbNV4FpWi6cgKOOvyJBNP
-c1STE4U6G7weNLWLBYy5d4ux2x8gkasJU26Qzns3dLlwR5EiUWMWea6xrkEmCMgZK9FGqkjWZCrX
-gzT/LCrBbBlDSgeF59N89iFo7+ryUp9/k5DPAgMBAAGjQjBAMA4GA1UdDwEB/wQEAwIBBjAPBgNV
-HRMBAf8EBTADAQH/MB0GA1UdDgQWBBRge2YaRQ2XyolQL30EzTSo//z9SzANBgkqhkiG9w0BAQUF
-AAOCAQEA1nPnfE920I2/7LqivjTFKDK1fPxsnCwrvQmeU79rXqoRSLblCKOzyj1hTdNGCbM+w6Dj
-Y1Ub8rrvrTnhQ7k4o+YviiY776BQVvnGCv04zcQLcFGUl5gE38NflNUVyRRBnMRddWQVDf9VMOyG
-j/8N7yy5Y0b2qvzfvGn9LhJIZJrglfCm7ymPAbEVtQwdpf5pLGkkeB6zpxxxYu7KyJesF12KwvhH
-hm4qxFYxldBniYUr+WymXUadDKqC5JlR3XC321Y9YeRq4VzW9v493kHMB65jUr9TU/Qr6cf9tveC
-X4XSQRjbgbMEHMUfpIBvFSDJ3gyICh3WZlXi/EjJKSZp4A==
------END CERTIFICATE-----
-
-GlobalSign Root CA - R2
-=======================
------BEGIN CERTIFICATE-----
-MIIDujCCAqKgAwIBAgILBAAAAAABD4Ym5g0wDQYJKoZIhvcNAQEFBQAwTDEgMB4GA1UECxMXR2xv
-YmFsU2lnbiBSb290IENBIC0gUjIxEzARBgNVBAoTCkdsb2JhbFNpZ24xEzARBgNVBAMTCkdsb2Jh
-bFNpZ24wHhcNMDYxMjE1MDgwMDAwWhcNMjExMjE1MDgwMDAwWjBMMSAwHgYDVQQLExdHbG9iYWxT
-aWduIFJvb3QgQ0EgLSBSMjETMBEGA1UEChMKR2xvYmFsU2lnbjETMBEGA1UEAxMKR2xvYmFsU2ln
-bjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKbPJA6+Lm8omUVCxKs+IVSbC9N/hHD6
-ErPLv4dfxn+G07IwXNb9rfF73OX4YJYJkhD10FPe+3t+c4isUoh7SqbKSaZeqKeMWhG8eoLrvozp
-s6yWJQeXSpkqBy+0Hne/ig+1AnwblrjFuTosvNYSuetZfeLQBoZfXklqtTleiDTsvHgMCJiEbKjN
-S7SgfQx5TfC4LcshytVsW33hoCmEofnTlEnLJGKRILzdC9XZzPnqJworc5HGnRusyMvo4KD0L5CL
-TfuwNhv2GXqF4G3yYROIXJ/gkwpRl4pazq+r1feqCapgvdzZX99yqWATXgAByUr6P6TqBwMhAo6C
-ygPCm48CAwEAAaOBnDCBmTAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4E
-FgQUm+IHV2ccHsBqBt5ZtJot39wZhi4wNgYDVR0fBC8wLTAroCmgJ4YlaHR0cDovL2NybC5nbG9i
-YWxzaWduLm5ldC9yb290LXIyLmNybDAfBgNVHSMEGDAWgBSb4gdXZxwewGoG3lm0mi3f3BmGLjAN
-BgkqhkiG9w0BAQUFAAOCAQEAmYFThxxol4aR7OBKuEQLq4GsJ0/WwbgcQ3izDJr86iw8bmEbTUsp
-9Z8FHSbBuOmDAGJFtqkIk7mpM0sYmsL4h4hO291xNBrBVNpGP+DTKqttVCL1OmLNIG+6KYnX3ZHu
-01yiPqFbQfXf5WRDLenVOavSot+3i9DAgBkcRcAtjOj4LaR0VknFBbVPFd5uRHg5h6h+u/N5GJG7
-9G+dwfCMNYxdAfvDbbnvRG15RjF+Cv6pgsH/76tuIMRQyV+dTZsXjAzlAcmgQWpzU/qlULRuJQ/7
-TBj0/VLZjmmx6BEP3ojY+x1J96relc8geMJgEtslQIxq/H5COEBkEveegeGTLg==
------END CERTIFICATE-----
-
-ValiCert Class 1 VA
-===================
------BEGIN CERTIFICATE-----
-MIIC5zCCAlACAQEwDQYJKoZIhvcNAQEFBQAwgbsxJDAiBgNVBAcTG1ZhbGlDZXJ0IFZhbGlkYXRp
-b24gTmV0d29yazEXMBUGA1UEChMOVmFsaUNlcnQsIEluYy4xNTAzBgNVBAsTLFZhbGlDZXJ0IENs
-YXNzIDEgUG9saWN5IFZhbGlkYXRpb24gQXV0aG9yaXR5MSEwHwYDVQQDExhodHRwOi8vd3d3LnZh
-bGljZXJ0LmNvbS8xIDAeBgkqhkiG9w0BCQEWEWluZm9AdmFsaWNlcnQuY29tMB4XDTk5MDYyNTIy
-MjM0OFoXDTE5MDYyNTIyMjM0OFowgbsxJDAiBgNVBAcTG1ZhbGlDZXJ0IFZhbGlkYXRpb24gTmV0
-d29yazEXMBUGA1UEChMOVmFsaUNlcnQsIEluYy4xNTAzBgNVBAsTLFZhbGlDZXJ0IENsYXNzIDEg
-UG9saWN5IFZhbGlkYXRpb24gQXV0aG9yaXR5MSEwHwYDVQQDExhodHRwOi8vd3d3LnZhbGljZXJ0
-LmNvbS8xIDAeBgkqhkiG9w0BCQEWEWluZm9AdmFsaWNlcnQuY29tMIGfMA0GCSqGSIb3DQEBAQUA
-A4GNADCBiQKBgQDYWYJ6ibiWuqYvaG9YLqdUHAZu9OqNSLwxlBfw8068srg1knaw0KWlAdcAAxIi
-GQj4/xEjm84H9b9pGib+TunRf50sQB1ZaG6m+FiwnRqP0z/x3BkGgagO4DrdyFNFCQbmD3DD+kCm
-DuJWBQ8YTfwggtFzVXSNdnKgHZ0dwN0/cQIDAQABMA0GCSqGSIb3DQEBBQUAA4GBAFBoPUn0LBwG
-lN+VYH+Wexf+T3GtZMjdd9LvWVXoP+iOBSoh8gfStadS/pyxtuJbdxdA6nLWI8sogTLDAHkY7FkX
-icnGah5xyf23dKUlRWnFSKsZ4UWKJWsZ7uW7EvV/96aNUcPwnXS3qT6gpf+2SQMT2iLM7XGCK5nP
-Orf1LXLI
------END CERTIFICATE-----
-
-ValiCert Class 2 VA
-===================
------BEGIN CERTIFICATE-----
-MIIC5zCCAlACAQEwDQYJKoZIhvcNAQEFBQAwgbsxJDAiBgNVBAcTG1ZhbGlDZXJ0IFZhbGlkYXRp
-b24gTmV0d29yazEXMBUGA1UEChMOVmFsaUNlcnQsIEluYy4xNTAzBgNVBAsTLFZhbGlDZXJ0IENs
-YXNzIDIgUG9saWN5IFZhbGlkYXRpb24gQXV0aG9yaXR5MSEwHwYDVQQDExhodHRwOi8vd3d3LnZh
-bGljZXJ0LmNvbS8xIDAeBgkqhkiG9w0BCQEWEWluZm9AdmFsaWNlcnQuY29tMB4XDTk5MDYyNjAw
-MTk1NFoXDTE5MDYyNjAwMTk1NFowgbsxJDAiBgNVBAcTG1ZhbGlDZXJ0IFZhbGlkYXRpb24gTmV0
-d29yazEXMBUGA1UEChMOVmFsaUNlcnQsIEluYy4xNTAzBgNVBAsTLFZhbGlDZXJ0IENsYXNzIDIg
-UG9saWN5IFZhbGlkYXRpb24gQXV0aG9yaXR5MSEwHwYDVQQDExhodHRwOi8vd3d3LnZhbGljZXJ0
-LmNvbS8xIDAeBgkqhkiG9w0BCQEWEWluZm9AdmFsaWNlcnQuY29tMIGfMA0GCSqGSIb3DQEBAQUA
-A4GNADCBiQKBgQDOOnHK5avIWZJV16vYdA757tn2VUdZZUcOBVXc65g2PFxTXdMwzzjsvUGJ7SVC
-CSRrCl6zfN1SLUzm1NZ9WlmpZdRJEy0kTRxQb7XBhVQ7/nHk01xC+YDgkRoKWzk2Z/M/VXwbP7Rf
-ZHM047QSv4dk+NoS/zcnwbNDu+97bi5p9wIDAQABMA0GCSqGSIb3DQEBBQUAA4GBADt/UG9vUJSZ
-SWI4OB9L+KXIPqeCgfYrx+jFzug6EILLGACOTb2oWH+heQC1u+mNr0HZDzTuIYEZoDJJKPTEjlbV
-UjP9UNV+mWwD5MlM/Mtsq2azSiGM5bUMMj4QssxsodyamEwCW/POuZ6lcg5Ktz885hZo+L7tdEy8
-W9ViH0Pd
------END CERTIFICATE-----
-
-RSA Root Certificate 1
-======================
------BEGIN CERTIFICATE-----
-MIIC5zCCAlACAQEwDQYJKoZIhvcNAQEFBQAwgbsxJDAiBgNVBAcTG1ZhbGlDZXJ0IFZhbGlkYXRp
-b24gTmV0d29yazEXMBUGA1UEChMOVmFsaUNlcnQsIEluYy4xNTAzBgNVBAsTLFZhbGlDZXJ0IENs
-YXNzIDMgUG9saWN5IFZhbGlkYXRpb24gQXV0aG9yaXR5MSEwHwYDVQQDExhodHRwOi8vd3d3LnZh
-bGljZXJ0LmNvbS8xIDAeBgkqhkiG9w0BCQEWEWluZm9AdmFsaWNlcnQuY29tMB4XDTk5MDYyNjAw
-MjIzM1oXDTE5MDYyNjAwMjIzM1owgbsxJDAiBgNVBAcTG1ZhbGlDZXJ0IFZhbGlkYXRpb24gTmV0
-d29yazEXMBUGA1UEChMOVmFsaUNlcnQsIEluYy4xNTAzBgNVBAsTLFZhbGlDZXJ0IENsYXNzIDMg
-UG9saWN5IFZhbGlkYXRpb24gQXV0aG9yaXR5MSEwHwYDVQQDExhodHRwOi8vd3d3LnZhbGljZXJ0
-LmNvbS8xIDAeBgkqhkiG9w0BCQEWEWluZm9AdmFsaWNlcnQuY29tMIGfMA0GCSqGSIb3DQEBAQUA
-A4GNADCBiQKBgQDjmFGWHOjVsQaBalfDcnWTq8+epvzzFlLWLU2fNUSoLgRNB0mKOCn1dzfnt6td
-3zZxFJmP3MKS8edgkpfs2Ejcv8ECIMYkpChMMFp2bbFc893enhBxoYjHW5tBbcqwuI4V7q0zK89H
-BFx1cQqYJJgpp0lZpd34t0NiYfPT4tBVPwIDAQABMA0GCSqGSIb3DQEBBQUAA4GBAFa7AliEZwgs
-3x/be0kz9dNnnfS0ChCzycUs4pJqcXgn8nCDQtM+z6lU9PHYkhaM0QTLS6vJn0WuPIqpsHEzXcjF
-V9+vqDWzf4mH6eglkrh/hXqu1rweN1gqZ8mRzyqBPu3GOd/APhmcGcwTTYJBtYze4D1gCCAPRX5r
-on+jjBXu
------END CERTIFICATE-----
-
-Verisign Class 3 Public Primary Certification Authority - G3
-============================================================
------BEGIN CERTIFICATE-----
-MIIEGjCCAwICEQCbfgZJoz5iudXukEhxKe9XMA0GCSqGSIb3DQEBBQUAMIHKMQswCQYDVQQGEwJV
-UzEXMBUGA1UEChMOVmVyaVNpZ24sIEluYy4xHzAdBgNVBAsTFlZlcmlTaWduIFRydXN0IE5ldHdv
-cmsxOjA4BgNVBAsTMShjKSAxOTk5IFZlcmlTaWduLCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNl
-IG9ubHkxRTBDBgNVBAMTPFZlcmlTaWduIENsYXNzIDMgUHVibGljIFByaW1hcnkgQ2VydGlmaWNh
-dGlvbiBBdXRob3JpdHkgLSBHMzAeFw05OTEwMDEwMDAwMDBaFw0zNjA3MTYyMzU5NTlaMIHKMQsw
-CQYDVQQGEwJVUzEXMBUGA1UEChMOVmVyaVNpZ24sIEluYy4xHzAdBgNVBAsTFlZlcmlTaWduIFRy
-dXN0IE5ldHdvcmsxOjA4BgNVBAsTMShjKSAxOTk5IFZlcmlTaWduLCBJbmMuIC0gRm9yIGF1dGhv
-cml6ZWQgdXNlIG9ubHkxRTBDBgNVBAMTPFZlcmlTaWduIENsYXNzIDMgUHVibGljIFByaW1hcnkg
-Q2VydGlmaWNhdGlvbiBBdXRob3JpdHkgLSBHMzCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC
-ggEBAMu6nFL8eB8aHm8bN3O9+MlrlBIwT/A2R/XQkQr1F8ilYcEWQE37imGQ5XYgwREGfassbqb1
-EUGO+i2tKmFZpGcmTNDovFJbcCAEWNF6yaRpvIMXZK0Fi7zQWM6NjPXr8EJJC52XJ2cybuGukxUc
-cLwgTS8Y3pKI6GyFVxEa6X7jJhFUokWWVYPKMIno3Nij7SqAP395ZVc+FSBmCC+Vk7+qRy+oRpfw
-EuL+wgorUeZ25rdGt+INpsyow0xZVYnm6FNcHOqd8GIWC6fJXwzw3sJ2zq/3avL6QaaiMxTJ5Xpj
-055iN9WFZZ4O5lMkdBteHRJTW8cs54NJOxWuimi5V5cCAwEAATANBgkqhkiG9w0BAQUFAAOCAQEA
-ERSWwauSCPc/L8my/uRan2Te2yFPhpk0djZX3dAVL8WtfxUfN2JzPtTnX84XA9s1+ivbrmAJXx5f
-j267Cz3qWhMeDGBvtcC1IyIuBwvLqXTLR7sdwdela8wv0kL9Sd2nic9TutoAWii/gt/4uhMdUIaC
-/Y4wjylGsB49Ndo4YhYYSq3mtlFs3q9i6wHQHiT+eo8SGhJouPtmmRQURVyu565pF4ErWjfJXir0
-xuKhXFSbplQAz/DxwceYMBo7Nhbbo27q/a2ywtrvAkcTisDxszGtTxzhT5yvDwyd93gN2PQ1VoDa
-t20Xj50egWTh/sVFuq1ruQp6Tk9LhO5L8X3dEQ==
------END CERTIFICATE-----
-
-Verisign Class 4 Public Primary Certification Authority - G3
-============================================================
------BEGIN CERTIFICATE-----
-MIIEGjCCAwICEQDsoKeLbnVqAc/EfMwvlF7XMA0GCSqGSIb3DQEBBQUAMIHKMQswCQYDVQQGEwJV
-UzEXMBUGA1UEChMOVmVyaVNpZ24sIEluYy4xHzAdBgNVBAsTFlZlcmlTaWduIFRydXN0IE5ldHdv
-cmsxOjA4BgNVBAsTMShjKSAxOTk5IFZlcmlTaWduLCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNl
-IG9ubHkxRTBDBgNVBAMTPFZlcmlTaWduIENsYXNzIDQgUHVibGljIFByaW1hcnkgQ2VydGlmaWNh
-dGlvbiBBdXRob3JpdHkgLSBHMzAeFw05OTEwMDEwMDAwMDBaFw0zNjA3MTYyMzU5NTlaMIHKMQsw
-CQYDVQQGEwJVUzEXMBUGA1UEChMOVmVyaVNpZ24sIEluYy4xHzAdBgNVBAsTFlZlcmlTaWduIFRy
-dXN0IE5ldHdvcmsxOjA4BgNVBAsTMShjKSAxOTk5IFZlcmlTaWduLCBJbmMuIC0gRm9yIGF1dGhv
-cml6ZWQgdXNlIG9ubHkxRTBDBgNVBAMTPFZlcmlTaWduIENsYXNzIDQgUHVibGljIFByaW1hcnkg
-Q2VydGlmaWNhdGlvbiBBdXRob3JpdHkgLSBHMzCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC
-ggEBAK3LpRFpxlmr8Y+1GQ9Wzsy1HyDkniYlS+BzZYlZ3tCD5PUPtbut8XzoIfzk6AzufEUiGXaS
-tBO3IFsJ+mGuqPKljYXCKtbeZjbSmwL0qJJgfJxptI8kHtCGUvYynEFYHiK9zUVilQhu0GbdU6LM
-8BDcVHOLBKFGMzNcF0C5nk3T875Vg+ixiY5afJqWIpA7iCXy0lOIAgwLePLmNxdLMEYH5IBtptiW
-Lugs+BGzOA1mppvqySNb247i8xOOGlktqgLw7KSHZtzBP/XYufTsgsbSPZUd5cBPhMnZo0QoBmrX
-Razwa2rvTl/4EYIeOGM0ZlDUPpNz+jDDZq3/ky2X7wMCAwEAATANBgkqhkiG9w0BAQUFAAOCAQEA
-j/ola09b5KROJ1WrIhVZPMq1CtRK26vdoV9TxaBXOcLORyu+OshWv8LZJxA6sQU8wHcxuzrTBXtt
-mhwwjIDLk5Mqg6sFUYICABFna/OIYUdfA5PVWw3g8dShMjWFsjrbsIKr0csKvE+MW8VLADsfKoKm
-fjaF3H48ZwC15DtS4KjrXRX5xm3wrR0OhbepmnMUWluPQSjA1egtTaRezarZ7c7c2NU8Qh0XwRJd
-RTjDOPP8hS6DRkiy1yBfkjaP53kPmF6Z6PDQpLv1U70qzlmwr25/bLvSHgCwIe34QWKCudiyxLtG
-UPMxxY8BqHTr9Xgn2uf3ZkPznoM+IKrDNWCRzg==
------END CERTIFICATE-----
-
-Entrust.net Secure Server CA
-============================
------BEGIN CERTIFICATE-----
-MIIE2DCCBEGgAwIBAgIEN0rSQzANBgkqhkiG9w0BAQUFADCBwzELMAkGA1UEBhMCVVMxFDASBgNV
-BAoTC0VudHJ1c3QubmV0MTswOQYDVQQLEzJ3d3cuZW50cnVzdC5uZXQvQ1BTIGluY29ycC4gYnkg
-cmVmLiAobGltaXRzIGxpYWIuKTElMCMGA1UECxMcKGMpIDE5OTkgRW50cnVzdC5uZXQgTGltaXRl
-ZDE6MDgGA1UEAxMxRW50cnVzdC5uZXQgU2VjdXJlIFNlcnZlciBDZXJ0aWZpY2F0aW9uIEF1dGhv
-cml0eTAeFw05OTA1MjUxNjA5NDBaFw0xOTA1MjUxNjM5NDBaMIHDMQswCQYDVQQGEwJVUzEUMBIG
-A1UEChMLRW50cnVzdC5uZXQxOzA5BgNVBAsTMnd3dy5lbnRydXN0Lm5ldC9DUFMgaW5jb3JwLiBi
-eSByZWYuIChsaW1pdHMgbGlhYi4pMSUwIwYDVQQLExwoYykgMTk5OSBFbnRydXN0Lm5ldCBMaW1p
-dGVkMTowOAYDVQQDEzFFbnRydXN0Lm5ldCBTZWN1cmUgU2VydmVyIENlcnRpZmljYXRpb24gQXV0
-aG9yaXR5MIGdMA0GCSqGSIb3DQEBAQUAA4GLADCBhwKBgQDNKIM0VBuJ8w+vN5Ex/68xYMmo6LIQ
-aO2f55M28Qpku0f1BBc/I0dNxScZgSYMVHINiC3ZH5oSn7yzcdOAGT9HZnuMNSjSuQrfJNqc1lB5
-gXpa0zf3wkrYKZImZNHkmGw6AIr1NJtl+O3jEP/9uElY3KDegjlrgbEWGWG5VLbmQwIBA6OCAdcw
-ggHTMBEGCWCGSAGG+EIBAQQEAwIABzCCARkGA1UdHwSCARAwggEMMIHeoIHboIHYpIHVMIHSMQsw
-CQYDVQQGEwJVUzEUMBIGA1UEChMLRW50cnVzdC5uZXQxOzA5BgNVBAsTMnd3dy5lbnRydXN0Lm5l
-dC9DUFMgaW5jb3JwLiBieSByZWYuIChsaW1pdHMgbGlhYi4pMSUwIwYDVQQLExwoYykgMTk5OSBF
-bnRydXN0Lm5ldCBMaW1pdGVkMTowOAYDVQQDEzFFbnRydXN0Lm5ldCBTZWN1cmUgU2VydmVyIENl
-cnRpZmljYXRpb24gQXV0aG9yaXR5MQ0wCwYDVQQDEwRDUkwxMCmgJ6AlhiNodHRwOi8vd3d3LmVu
-dHJ1c3QubmV0L0NSTC9uZXQxLmNybDArBgNVHRAEJDAigA8xOTk5MDUyNTE2MDk0MFqBDzIwMTkw
-NTI1MTYwOTQwWjALBgNVHQ8EBAMCAQYwHwYDVR0jBBgwFoAU8BdiE1U9s/8KAGv7UISX8+1i0Bow
-HQYDVR0OBBYEFPAXYhNVPbP/CgBr+1CEl/PtYtAaMAwGA1UdEwQFMAMBAf8wGQYJKoZIhvZ9B0EA
-BAwwChsEVjQuMAMCBJAwDQYJKoZIhvcNAQEFBQADgYEAkNwwAvpkdMKnCqV8IY00F6j7Rw7/JXyN
-Ewr75Ji174z4xRAN95K+8cPV1ZVqBLssziY2ZcgxxufuP+NXdYR6Ee9GTxj005i7qIcyunL2POI9
-n9cd2cNgQ4xYDiKWL2KjLB+6rQXvqzJ4h6BUcxm1XAX5Uj5tLUUL9wqT6u0G+bI=
------END CERTIFICATE-----
-
-Entrust.net Premium 2048 Secure Server CA
-=========================================
------BEGIN CERTIFICATE-----
-MIIEXDCCA0SgAwIBAgIEOGO5ZjANBgkqhkiG9w0BAQUFADCBtDEUMBIGA1UEChMLRW50cnVzdC5u
-ZXQxQDA+BgNVBAsUN3d3dy5lbnRydXN0Lm5ldC9DUFNfMjA0OCBpbmNvcnAuIGJ5IHJlZi4gKGxp
-bWl0cyBsaWFiLikxJTAjBgNVBAsTHChjKSAxOTk5IEVudHJ1c3QubmV0IExpbWl0ZWQxMzAxBgNV
-BAMTKkVudHJ1c3QubmV0IENlcnRpZmljYXRpb24gQXV0aG9yaXR5ICgyMDQ4KTAeFw05OTEyMjQx
-NzUwNTFaFw0xOTEyMjQxODIwNTFaMIG0MRQwEgYDVQQKEwtFbnRydXN0Lm5ldDFAMD4GA1UECxQ3
-d3d3LmVudHJ1c3QubmV0L0NQU18yMDQ4IGluY29ycC4gYnkgcmVmLiAobGltaXRzIGxpYWIuKTEl
-MCMGA1UECxMcKGMpIDE5OTkgRW50cnVzdC5uZXQgTGltaXRlZDEzMDEGA1UEAxMqRW50cnVzdC5u
-ZXQgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgKDIwNDgpMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8A
-MIIBCgKCAQEArU1LqRKGsuqjIAcVFmQqK0vRvwtKTY7tgHalZ7d4QMBzQshowNtTK91euHaYNZOL
-Gp18EzoOH1u3Hs/lJBQesYGpjX24zGtLA/ECDNyrpUAkAH90lKGdCCmziAv1h3edVc3kw37XamSr
-hRSGlVuXMlBvPci6Zgzj/L24ScF2iUkZ/cCovYmjZy/Gn7xxGWC4LeksyZB2ZnuU4q941mVTXTzW
-nLLPKQP5L6RQstRIzgUyVYr9smRMDuSYB3Xbf9+5CFVghTAp+XtIpGmG4zU/HoZdenoVve8AjhUi
-VBcAkCaTvA5JaJG/+EfTnZVCwQ5N328mz8MYIWJmQ3DW1cAH4QIDAQABo3QwcjARBglghkgBhvhC
-AQEEBAMCAAcwHwYDVR0jBBgwFoAUVeSB0RGAvtiJuQijMfmhJAkWuXAwHQYDVR0OBBYEFFXkgdER
-gL7YibkIozH5oSQJFrlwMB0GCSqGSIb2fQdBAAQQMA4bCFY1LjA6NC4wAwIEkDANBgkqhkiG9w0B
-AQUFAAOCAQEAWUesIYSKF8mciVMeuoCFGsY8Tj6xnLZ8xpJdGGQC49MGCBFhfGPjK50xA3B20qMo
-oPS7mmNz7W3lKtvtFKkrxjYR0CvrB4ul2p5cGZ1WEvVUKcgF7bISKo30Axv/55IQh7A6tcOdBTcS
-o8f0FbnVpDkWm1M6I5HxqIKiaohowXkCIryqptau37AUX7iH0N18f3v/rxzP5tsHrV7bhZ3QKw0z
-2wTR5klAEyt2+z7pnIkPFc4YsIV4IU9rTw76NmfNB/L/CNDi3tm/Kq+4h4YhPATKt5Rof8886ZjX
-OP/swNlQ8C5LWK5Gb9Auw2DaclVyvUxFnmG6v4SBkgPR0ml8xQ==
------END CERTIFICATE-----
-
-Baltimore CyberTrust Root
-=========================
------BEGIN CERTIFICATE-----
-MIIDdzCCAl+gAwIBAgIEAgAAuTANBgkqhkiG9w0BAQUFADBaMQswCQYDVQQGEwJJRTESMBAGA1UE
-ChMJQmFsdGltb3JlMRMwEQYDVQQLEwpDeWJlclRydXN0MSIwIAYDVQQDExlCYWx0aW1vcmUgQ3li
-ZXJUcnVzdCBSb290MB4XDTAwMDUxMjE4NDYwMFoXDTI1MDUxMjIzNTkwMFowWjELMAkGA1UEBhMC
-SUUxEjAQBgNVBAoTCUJhbHRpbW9yZTETMBEGA1UECxMKQ3liZXJUcnVzdDEiMCAGA1UEAxMZQmFs
-dGltb3JlIEN5YmVyVHJ1c3QgUm9vdDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKME
-uyKrmD1X6CZymrV51Cni4eiVgLGw41uOKymaZN+hXe2wCQVt2yguzmKiYv60iNoS6zjrIZ3AQSsB
-UnuId9Mcj8e6uYi1agnnc+gRQKfRzMpijS3ljwumUNKoUMMo6vWrJYeKmpYcqWe4PwzV9/lSEy/C
-G9VwcPCPwBLKBsua4dnKM3p31vjsufFoREJIE9LAwqSuXmD+tqYF/LTdB1kC1FkYmGP1pWPgkAx9
-XbIGevOF6uvUA65ehD5f/xXtabz5OTZydc93Uk3zyZAsuT3lySNTPx8kmCFcB5kpvcY67Oduhjpr
-l3RjM71oGDHweI12v/yejl0qhqdNkNwnGjkCAwEAAaNFMEMwHQYDVR0OBBYEFOWdWTCCR1jMrPoI
-VDaGezq1BE3wMBIGA1UdEwEB/wQIMAYBAf8CAQMwDgYDVR0PAQH/BAQDAgEGMA0GCSqGSIb3DQEB
-BQUAA4IBAQCFDF2O5G9RaEIFoN27TyclhAO992T9Ldcw46QQF+vaKSm2eT929hkTI7gQCvlYpNRh
-cL0EYWoSihfVCr3FvDB81ukMJY2GQE/szKN+OMY3EU/t3WgxjkzSswF07r51XgdIGn9w/xZchMB5
-hbgF/X++ZRGjD8ACtPhSNzkE1akxehi/oCr0Epn3o0WC4zxe9Z2etciefC7IpJ5OCBRLbf1wbWsa
-Y71k5h+3zvDyny67G7fyUIhzksLi4xaNmjICq44Y3ekQEe5+NauQrz4wlHrQMz2nZQ/1/I6eYs9H
-RCwBXbsdtTLSR9I4LtD+gdwyah617jzV/OeBHRnDJELqYzmp
------END CERTIFICATE-----
-
-Equifax Secure Global eBusiness CA
-==================================
------BEGIN CERTIFICATE-----
-MIICkDCCAfmgAwIBAgIBATANBgkqhkiG9w0BAQQFADBaMQswCQYDVQQGEwJVUzEcMBoGA1UEChMT
-RXF1aWZheCBTZWN1cmUgSW5jLjEtMCsGA1UEAxMkRXF1aWZheCBTZWN1cmUgR2xvYmFsIGVCdXNp
-bmVzcyBDQS0xMB4XDTk5MDYyMTA0MDAwMFoXDTIwMDYyMTA0MDAwMFowWjELMAkGA1UEBhMCVVMx
-HDAaBgNVBAoTE0VxdWlmYXggU2VjdXJlIEluYy4xLTArBgNVBAMTJEVxdWlmYXggU2VjdXJlIEds
-b2JhbCBlQnVzaW5lc3MgQ0EtMTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEAuucXkAJlsTRV
-PEnCUdXfp9E3j9HngXNBUmCbnaEXJnitx7HoJpQytd4zjTov2/KaelpzmKNc6fuKcxtc58O/gGzN
-qfTWK8D3+ZmqY6KxRwIP1ORROhI8bIpaVIRw28HFkM9yRcuoWcDNM50/o5brhTMhHD4ePmBudpxn
-hcXIw2ECAwEAAaNmMGQwEQYJYIZIAYb4QgEBBAQDAgAHMA8GA1UdEwEB/wQFMAMBAf8wHwYDVR0j
-BBgwFoAUvqigdHJQa0S3ySPY+6j/s1draGwwHQYDVR0OBBYEFL6ooHRyUGtEt8kj2Puo/7NXa2hs
-MA0GCSqGSIb3DQEBBAUAA4GBADDiAVGqx+pf2rnQZQ8w1j7aDRRJbpGTJxQx78T3LUX47Me/okEN
-I7SS+RkAZ70Br83gcfxaz2TE4JaY0KNA4gGK7ycH8WUBikQtBmV1UsCGECAhX2xrD2yuCRyv8qIY
-NMR1pHMc8Y3c7635s3a0kr/clRAevsvIO1qEYBlWlKlV
------END CERTIFICATE-----
-
-Equifax Secure eBusiness CA 1
-=============================
------BEGIN CERTIFICATE-----
-MIICgjCCAeugAwIBAgIBBDANBgkqhkiG9w0BAQQFADBTMQswCQYDVQQGEwJVUzEcMBoGA1UEChMT
-RXF1aWZheCBTZWN1cmUgSW5jLjEmMCQGA1UEAxMdRXF1aWZheCBTZWN1cmUgZUJ1c2luZXNzIENB
-LTEwHhcNOTkwNjIxMDQwMDAwWhcNMjAwNjIxMDQwMDAwWjBTMQswCQYDVQQGEwJVUzEcMBoGA1UE
-ChMTRXF1aWZheCBTZWN1cmUgSW5jLjEmMCQGA1UEAxMdRXF1aWZheCBTZWN1cmUgZUJ1c2luZXNz
-IENBLTEwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAM4vGbwXt3fek6lfWg0XTzQaDJj0ItlZ
-1MRoRvC0NcWFAyDGr0WlIVFFQesWWDYyb+JQYmT5/VGcqiTZ9J2DKocKIdMSODRsjQBuWqDZQu4a
-IZX5UkxVWsUPOE9G+m34LjXWHXzr4vCwdYDIqROsvojvOm6rXyo4YgKwEnv+j6YDAgMBAAGjZjBk
-MBEGCWCGSAGG+EIBAQQEAwIABzAPBgNVHRMBAf8EBTADAQH/MB8GA1UdIwQYMBaAFEp4MlIR21kW
-Nl7fwRQ2QGpHfEyhMB0GA1UdDgQWBBRKeDJSEdtZFjZe38EUNkBqR3xMoTANBgkqhkiG9w0BAQQF
-AAOBgQB1W6ibAxHm6VZMzfmpTMANmvPMZWnmJXbMWbfWVMMdzZmsGd20hdXgPfxiIKeES1hl8eL5
-lSE/9dR+WB5Hh1Q+WKG1tfgq73HnvMP2sUlG4tega+VWeponmHxGYhTnyfxuAxJ5gDgdSIKN/Bf+
-KpYrtWKmpj29f5JZzVoqgrI3eQ==
------END CERTIFICATE-----
-
-Equifax Secure eBusiness CA 2
-=============================
------BEGIN CERTIFICATE-----
-MIIDIDCCAomgAwIBAgIEN3DPtTANBgkqhkiG9w0BAQUFADBOMQswCQYDVQQGEwJVUzEXMBUGA1UE
-ChMORXF1aWZheCBTZWN1cmUxJjAkBgNVBAsTHUVxdWlmYXggU2VjdXJlIGVCdXNpbmVzcyBDQS0y
-MB4XDTk5MDYyMzEyMTQ0NVoXDTE5MDYyMzEyMTQ0NVowTjELMAkGA1UEBhMCVVMxFzAVBgNVBAoT
-DkVxdWlmYXggU2VjdXJlMSYwJAYDVQQLEx1FcXVpZmF4IFNlY3VyZSBlQnVzaW5lc3MgQ0EtMjCB
-nzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEA5Dk5kx5SBhsoNviyoynF7Y6yEb3+6+e0dMKP/wXn
-2Z0GvxLIPw7y1tEkshHe0XMJitSxLJgJDR5QRrKDpkWNYmi7hRsgcDKqQM2mll/EcTc/BPO3QSQ5
-BxoeLmFYoBIL5aXfxavqN3HMHMg3OrmXUqesxWoklE6ce8/AatbfIb0CAwEAAaOCAQkwggEFMHAG
-A1UdHwRpMGcwZaBjoGGkXzBdMQswCQYDVQQGEwJVUzEXMBUGA1UEChMORXF1aWZheCBTZWN1cmUx
-JjAkBgNVBAsTHUVxdWlmYXggU2VjdXJlIGVCdXNpbmVzcyBDQS0yMQ0wCwYDVQQDEwRDUkwxMBoG
-A1UdEAQTMBGBDzIwMTkwNjIzMTIxNDQ1WjALBgNVHQ8EBAMCAQYwHwYDVR0jBBgwFoAUUJ4L6q9e
-uSBIplBqy/3YIHqngnYwHQYDVR0OBBYEFFCeC+qvXrkgSKZQasv92CB6p4J2MAwGA1UdEwQFMAMB
-Af8wGgYJKoZIhvZ9B0EABA0wCxsFVjMuMGMDAgbAMA0GCSqGSIb3DQEBBQUAA4GBAAyGgq3oThr1
-jokn4jVYPSm0B482UJW/bsGe68SQsoWou7dC4A8HOd/7npCy0cE+U58DRLB+S/Rv5Hwf5+Kx5Lia
-78O9zt4LMjTZ3ijtM2vE1Nc9ElirfQkty3D1E4qUoSek1nDFbZS1yX2doNLGCEnZZpum0/QL3MUm
-V+GRMOrN
------END CERTIFICATE-----
-
-AddTrust Low-Value Services Root
-================================
------BEGIN CERTIFICATE-----
-MIIEGDCCAwCgAwIBAgIBATANBgkqhkiG9w0BAQUFADBlMQswCQYDVQQGEwJTRTEUMBIGA1UEChML
-QWRkVHJ1c3QgQUIxHTAbBgNVBAsTFEFkZFRydXN0IFRUUCBOZXR3b3JrMSEwHwYDVQQDExhBZGRU
-cnVzdCBDbGFzcyAxIENBIFJvb3QwHhcNMDAwNTMwMTAzODMxWhcNMjAwNTMwMTAzODMxWjBlMQsw
-CQYDVQQGEwJTRTEUMBIGA1UEChMLQWRkVHJ1c3QgQUIxHTAbBgNVBAsTFEFkZFRydXN0IFRUUCBO
-ZXR3b3JrMSEwHwYDVQQDExhBZGRUcnVzdCBDbGFzcyAxIENBIFJvb3QwggEiMA0GCSqGSIb3DQEB
-AQUAA4IBDwAwggEKAoIBAQCWltQhSWDia+hBBwzexODcEyPNwTXH+9ZOEQpnXvUGW2ulCDtbKRY6
-54eyNAbFvAWlA3yCyykQruGIgb3WntP+LVbBFc7jJp0VLhD7Bo8wBN6ntGO0/7Gcrjyvd7ZWxbWr
-oulpOj0OM3kyP3CCkplhbY0wCI9xP6ZIVxn4JdxLZlyldI+Yrsj5wAYi56xz36Uu+1LcsRVlIPo1
-Zmne3yzxbrww2ywkEtvrNTVokMsAsJchPXQhI2U0K7t4WaPW4XY5mqRJjox0r26kmqPZm9I4XJui
-GMx1I4S+6+JNM3GOGvDC+Mcdoq0Dlyz4zyXG9rgkMbFjXZJ/Y/AlyVMuH79NAgMBAAGjgdIwgc8w
-HQYDVR0OBBYEFJWxtPCUtr3H2tERCSG+wa9J/RB7MAsGA1UdDwQEAwIBBjAPBgNVHRMBAf8EBTAD
-AQH/MIGPBgNVHSMEgYcwgYSAFJWxtPCUtr3H2tERCSG+wa9J/RB7oWmkZzBlMQswCQYDVQQGEwJT
-RTEUMBIGA1UEChMLQWRkVHJ1c3QgQUIxHTAbBgNVBAsTFEFkZFRydXN0IFRUUCBOZXR3b3JrMSEw
-HwYDVQQDExhBZGRUcnVzdCBDbGFzcyAxIENBIFJvb3SCAQEwDQYJKoZIhvcNAQEFBQADggEBACxt
-ZBsfzQ3duQH6lmM0MkhHma6X7f1yFqZzR1r0693p9db7RcwpiURdv0Y5PejuvE1Uhh4dbOMXJ0Ph
-iVYrqW9yTkkz43J8KiOavD7/KCrto/8cI7pDVwlnTUtiBi34/2ydYB7YHEt9tTEv2dB8Xfjea4MY
-eDdXL+gzB2ffHsdrKpV2ro9Xo/D0UrSpUwjP4E/TelOL/bscVjby/rK25Xa71SJlpz/+0WatC7xr
-mYbvP33zGDLKe8bjq2RGlfgmadlVg3sslgf/WSxEo8bl6ancoWOAWiFeIc9TVPC6b4nbqKqVz4vj
-ccweGyBECMB6tkD9xOQ14R0WHNC8K47Wcdk=
------END CERTIFICATE-----
-
-AddTrust External Root
-======================
------BEGIN CERTIFICATE-----
-MIIENjCCAx6gAwIBAgIBATANBgkqhkiG9w0BAQUFADBvMQswCQYDVQQGEwJTRTEUMBIGA1UEChML
-QWRkVHJ1c3QgQUIxJjAkBgNVBAsTHUFkZFRydXN0IEV4dGVybmFsIFRUUCBOZXR3b3JrMSIwIAYD
-VQQDExlBZGRUcnVzdCBFeHRlcm5hbCBDQSBSb290MB4XDTAwMDUzMDEwNDgzOFoXDTIwMDUzMDEw
-NDgzOFowbzELMAkGA1UEBhMCU0UxFDASBgNVBAoTC0FkZFRydXN0IEFCMSYwJAYDVQQLEx1BZGRU
-cnVzdCBFeHRlcm5hbCBUVFAgTmV0d29yazEiMCAGA1UEAxMZQWRkVHJ1c3QgRXh0ZXJuYWwgQ0Eg
-Um9vdDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALf3GjPm8gAELTngTlvtH7xsD821
-+iO2zt6bETOXpClMfZOfvUq8k+0DGuOPz+VtUFrWlymUWoCwSXrbLpX9uMq/NzgtHj6RQa1wVsfw
-Tz/oMp50ysiQVOnGXw94nZpAPA6sYapeFI+eh6FqUNzXmk6vBbOmcZSccbNQYArHE504B4YCqOmo
-aSYYkKtMsE8jqzpPhNjfzp/haW+710LXa0Tkx63ubUFfclpxCDezeWWkWaCUN/cALw3CknLa0Dhy
-2xSoRcRdKn23tNbE7qzNE0S3ySvdQwAl+mG5aWpYIxG3pzOPVnVZ9c0p10a3CitlttNCbxWyuHv7
-7+ldU9U0WicCAwEAAaOB3DCB2TAdBgNVHQ4EFgQUrb2YejS0Jvf6xCZU7wO94CTLVBowCwYDVR0P
-BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wgZkGA1UdIwSBkTCBjoAUrb2YejS0Jvf6xCZU7wO94CTL
-VBqhc6RxMG8xCzAJBgNVBAYTAlNFMRQwEgYDVQQKEwtBZGRUcnVzdCBBQjEmMCQGA1UECxMdQWRk
-VHJ1c3QgRXh0ZXJuYWwgVFRQIE5ldHdvcmsxIjAgBgNVBAMTGUFkZFRydXN0IEV4dGVybmFsIENB
-IFJvb3SCAQEwDQYJKoZIhvcNAQEFBQADggEBALCb4IUlwtYj4g+WBpKdQZic2YR5gdkeWxQHIzZl
-j7DYd7usQWxHYINRsPkyPef89iYTx4AWpb9a/IfPeHmJIZriTAcKhjW88t5RxNKWt9x+Tu5w/Rw5
-6wwCURQtjr0W4MHfRnXnJK3s9EK0hZNwEGe6nQY1ShjTK3rMUUKhemPR5ruhxSvCNr4TDea9Y355
-e6cJDUCrat2PisP29owaQgVR1EX1n6diIWgVIEM8med8vSTYqZEXc4g/VhsxOBi0cQ+azcgOno4u
-G+GMmIPLHzHxREzGBHNJdmAPx/i9F4BrLunMTA5amnkPIAou1Z5jJh5VkpTYghdae9C8x49OhgQ=
------END CERTIFICATE-----
-
-AddTrust Public Services Root
-=============================
------BEGIN CERTIFICATE-----
-MIIEFTCCAv2gAwIBAgIBATANBgkqhkiG9w0BAQUFADBkMQswCQYDVQQGEwJTRTEUMBIGA1UEChML
-QWRkVHJ1c3QgQUIxHTAbBgNVBAsTFEFkZFRydXN0IFRUUCBOZXR3b3JrMSAwHgYDVQQDExdBZGRU
-cnVzdCBQdWJsaWMgQ0EgUm9vdDAeFw0wMDA1MzAxMDQxNTBaFw0yMDA1MzAxMDQxNTBaMGQxCzAJ
-BgNVBAYTAlNFMRQwEgYDVQQKEwtBZGRUcnVzdCBBQjEdMBsGA1UECxMUQWRkVHJ1c3QgVFRQIE5l
-dHdvcmsxIDAeBgNVBAMTF0FkZFRydXN0IFB1YmxpYyBDQSBSb290MIIBIjANBgkqhkiG9w0BAQEF
-AAOCAQ8AMIIBCgKCAQEA6Rowj4OIFMEg2Dybjxt+A3S72mnTRqX4jsIMEZBRpS9mVEBV6tsfSlbu
-nyNu9DnLoblv8n75XYcmYZ4c+OLspoH4IcUkzBEMP9smcnrHAZcHF/nXGCwwfQ56HmIexkvA/X1i
-d9NEHif2P0tEs7c42TkfYNVRknMDtABp4/MUTu7R3AnPdzRGULD4EfL+OHn3Bzn+UZKXC1sIXzSG
-Aa2Il+tmzV7R/9x98oTaunet3IAIx6eH1lWfl2royBFkuucZKT8Rs3iQhCBSWxHveNCD9tVIkNAw
-HM+A+WD+eeSI8t0A65RF62WUaUC6wNW0uLp9BBGo6zEFlpROWCGOn9Bg/QIDAQABo4HRMIHOMB0G
-A1UdDgQWBBSBPjfYkrAfd59ctKtzquf2NGAv+jALBgNVHQ8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB
-/zCBjgYDVR0jBIGGMIGDgBSBPjfYkrAfd59ctKtzquf2NGAv+qFopGYwZDELMAkGA1UEBhMCU0Ux
-FDASBgNVBAoTC0FkZFRydXN0IEFCMR0wGwYDVQQLExRBZGRUcnVzdCBUVFAgTmV0d29yazEgMB4G
-A1UEAxMXQWRkVHJ1c3QgUHVibGljIENBIFJvb3SCAQEwDQYJKoZIhvcNAQEFBQADggEBAAP3FUr4
-JNojVhaTdt02KLmuG7jD8WS6IBh4lSknVwW8fCr0uVFV2ocC3g8WFzH4qnkuCRO7r7IgGRLlk/lL
-+YPoRNWyQSW/iHVv/xD8SlTQX/D67zZzfRs2RcYhbbQVuE7PnFylPVoAjgbjPGsye/Kf8Lb93/Ao
-GEjwxrzQvzSAlsJKsW2Ox5BF3i9nrEUEo3rcVZLJR2bYGozH7ZxOmuASu7VqTITh4SINhwBk/ox9
-Yjllpu9CtoAlEmEBqCQTcAARJl/6NVDFSMwGR+gn2HCNX2TmoUQmXiLsks3/QppEIW1cxeMiHV9H
-EufOX1362KqxMy3ZdvJOOjMMK7MtkAY=
------END CERTIFICATE-----
-
-AddTrust Qualified Certificates Root
-====================================
------BEGIN CERTIFICATE-----
-MIIEHjCCAwagAwIBAgIBATANBgkqhkiG9w0BAQUFADBnMQswCQYDVQQGEwJTRTEUMBIGA1UEChML
-QWRkVHJ1c3QgQUIxHTAbBgNVBAsTFEFkZFRydXN0IFRUUCBOZXR3b3JrMSMwIQYDVQQDExpBZGRU
-cnVzdCBRdWFsaWZpZWQgQ0EgUm9vdDAeFw0wMDA1MzAxMDQ0NTBaFw0yMDA1MzAxMDQ0NTBaMGcx
-CzAJBgNVBAYTAlNFMRQwEgYDVQQKEwtBZGRUcnVzdCBBQjEdMBsGA1UECxMUQWRkVHJ1c3QgVFRQ
-IE5ldHdvcmsxIzAhBgNVBAMTGkFkZFRydXN0IFF1YWxpZmllZCBDQSBSb290MIIBIjANBgkqhkiG
-9w0BAQEFAAOCAQ8AMIIBCgKCAQEA5B6a/twJWoekn0e+EV+vhDTbYjx5eLfpMLXsDBwqxBb/4Oxx
-64r1EW7tTw2R0hIYLUkVAcKkIhPHEWT/IhKauY5cLwjPcWqzZwFZ8V1G87B4pfYOQnrjfxvM0PC3
-KP0q6p6zsLkEqv32x7SxuCqg+1jxGaBvcCV+PmlKfw8i2O+tCBGaKZnhqkRFmhJePp1tUvznoD1o
-L/BLcHwTOK28FSXx1s6rosAx1i+f4P8UWfyEk9mHfExUE+uf0S0R+Bg6Ot4l2ffTQO2kBhLEO+GR
-wVY18BTcZTYJbqukB8c10cIDMzZbdSZtQvESa0NvS3GU+jQd7RNuyoB/mC9suWXY6QIDAQABo4HU
-MIHRMB0GA1UdDgQWBBQ5lYtii1zJ1IC6WA+XPxUIQ8yYpzALBgNVHQ8EBAMCAQYwDwYDVR0TAQH/
-BAUwAwEB/zCBkQYDVR0jBIGJMIGGgBQ5lYtii1zJ1IC6WA+XPxUIQ8yYp6FrpGkwZzELMAkGA1UE
-BhMCU0UxFDASBgNVBAoTC0FkZFRydXN0IEFCMR0wGwYDVQQLExRBZGRUcnVzdCBUVFAgTmV0d29y
-azEjMCEGA1UEAxMaQWRkVHJ1c3QgUXVhbGlmaWVkIENBIFJvb3SCAQEwDQYJKoZIhvcNAQEFBQAD
-ggEBABmrder4i2VhlRO6aQTvhsoToMeqT2QbPxj2qC0sVY8FtzDqQmodwCVRLae/DLPt7wh/bDxG
-GuoYQ992zPlmhpwsaPXpF/gxsxjE1kh9I0xowX67ARRvxdlu3rsEQmr49lx95dr6h+sNNVJn0J6X
-dgWTP5XHAeZpVTh/EGGZyeNfpso+gmNIquIISD6q8rKFYqa0p9m9N5xotS1WfbC3P6CxB9bpT9ze
-RXEwMn8bLgn5v1Kh7sKAPgZcLlVAwRv1cEWw3F369nJad9Jjzc9YiQBCYz95OdBEsIJuQRno3eDB
-iFrRHnGTHyQwdOUeqN48Jzd/g66ed8/wMLH/S5noxqE=
------END CERTIFICATE-----
-
-Entrust Root Certification Authority
-====================================
------BEGIN CERTIFICATE-----
-MIIEkTCCA3mgAwIBAgIERWtQVDANBgkqhkiG9w0BAQUFADCBsDELMAkGA1UEBhMCVVMxFjAUBgNV
-BAoTDUVudHJ1c3QsIEluYy4xOTA3BgNVBAsTMHd3dy5lbnRydXN0Lm5ldC9DUFMgaXMgaW5jb3Jw
-b3JhdGVkIGJ5IHJlZmVyZW5jZTEfMB0GA1UECxMWKGMpIDIwMDYgRW50cnVzdCwgSW5jLjEtMCsG
-A1UEAxMkRW50cnVzdCBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MB4XDTA2MTEyNzIwMjM0
-MloXDTI2MTEyNzIwNTM0MlowgbAxCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1FbnRydXN0LCBJbmMu
-MTkwNwYDVQQLEzB3d3cuZW50cnVzdC5uZXQvQ1BTIGlzIGluY29ycG9yYXRlZCBieSByZWZlcmVu
-Y2UxHzAdBgNVBAsTFihjKSAyMDA2IEVudHJ1c3QsIEluYy4xLTArBgNVBAMTJEVudHJ1c3QgUm9v
-dCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEB
-ALaVtkNC+sZtKm9I35RMOVcF7sN5EUFoNu3s/poBj6E4KPz3EEZmLk0eGrEaTsbRwJWIsMn/MYsz
-A9u3g3s+IIRe7bJWKKf44LlAcTfFy0cOlypowCKVYhXbR9n10Cv/gkvJrT7eTNuQgFA/CYqEAOww
-Cj0Yzfv9KlmaI5UXLEWeH25DeW0MXJj+SKfFI0dcXv1u5x609mhF0YaDW6KKjbHjKYD+JXGIrb68
-j6xSlkuqUY3kEzEZ6E5Nn9uss2rVvDlUccp6en+Q3X0dgNmBu1kmwhH+5pPi94DkZfs0Nw4pgHBN
-rziGLp5/V6+eF67rHMsoIV+2HNjnogQi+dPa2MsCAwEAAaOBsDCBrTAOBgNVHQ8BAf8EBAMCAQYw
-DwYDVR0TAQH/BAUwAwEB/zArBgNVHRAEJDAigA8yMDA2MTEyNzIwMjM0MlqBDzIwMjYxMTI3MjA1
-MzQyWjAfBgNVHSMEGDAWgBRokORnpKZTgMeGZqTx90tD+4S9bTAdBgNVHQ4EFgQUaJDkZ6SmU4DH
-hmak8fdLQ/uEvW0wHQYJKoZIhvZ9B0EABBAwDhsIVjcuMTo0LjADAgSQMA0GCSqGSIb3DQEBBQUA
-A4IBAQCT1DCw1wMgKtD5Y+iRDAUgqV8ZyntyTtSx29CW+1RaGSwMCPeyvIWonX9tO1KzKtvn1ISM
-Y/YPyyYBkVBs9F8U4pN0wBOeMDpQ47RgxRzwIkSNcUesyBrJ6ZuaAGAT/3B+XxFNSRuzFVJ7yVTa
-v52Vr2ua2J7p8eRDjeIRRDq/r72DQnNSi6q7pynP9WQcCk3RvKqsnyrQ/39/2n3qse0wJcGE2jTS
-W3iDVuycNsMm4hH2Z0kdkquM++v/eu6FSqdQgPCnXEqULl8FmTxSQeDNtGPPAUO6nIPcj2A781q0
-tHuu2guQOHXvgR1m0vdXcDazv/wor3ElhVsT/h5/WrQ8
------END CERTIFICATE-----
-
-RSA Security 2048 v3
-====================
------BEGIN CERTIFICATE-----
-MIIDYTCCAkmgAwIBAgIQCgEBAQAAAnwAAAAKAAAAAjANBgkqhkiG9w0BAQUFADA6MRkwFwYDVQQK
-ExBSU0EgU2VjdXJpdHkgSW5jMR0wGwYDVQQLExRSU0EgU2VjdXJpdHkgMjA0OCBWMzAeFw0wMTAy
-MjIyMDM5MjNaFw0yNjAyMjIyMDM5MjNaMDoxGTAXBgNVBAoTEFJTQSBTZWN1cml0eSBJbmMxHTAb
-BgNVBAsTFFJTQSBTZWN1cml0eSAyMDQ4IFYzMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKC
-AQEAt49VcdKA3XtpeafwGFAyPGJn9gqVB93mG/Oe2dJBVGutn3y+Gc37RqtBaB4Y6lXIL5F4iSj7
-Jylg/9+PjDvJSZu1pJTOAeo+tWN7fyb9Gd3AIb2E0S1PRsNO3Ng3OTsor8udGuorryGlwSMiuLgb
-WhOHV4PR8CDn6E8jQrAApX2J6elhc5SYcSa8LWrg903w8bYqODGBDSnhAMFRD0xS+ARaqn1y07iH
-KrtjEAMqs6FPDVpeRrc9DvV07Jmf+T0kgYim3WBU6JU2PcYJk5qjEoAAVZkZR73QpXzDuvsf9/UP
-+Ky5tfQ3mBMY3oVbtwyCO4dvlTlYMNpuAWgXIszACwIDAQABo2MwYTAPBgNVHRMBAf8EBTADAQH/
-MA4GA1UdDwEB/wQEAwIBBjAfBgNVHSMEGDAWgBQHw1EwpKrpRa41JPr/JCwz0LGdjDAdBgNVHQ4E
-FgQUB8NRMKSq6UWuNST6/yQsM9CxnYwwDQYJKoZIhvcNAQEFBQADggEBAF8+hnZuuDU8TjYcHnmY
-v/3VEhF5Ug7uMYm83X/50cYVIeiKAVQNOvtUudZj1LGqlk2iQk3UUx+LEN5/Zb5gEydxiKRz44Rj
-0aRV4VCT5hsOedBnvEbIvz8XDZXmxpBp3ue0L96VfdASPz0+f00/FGj1EVDVwfSQpQgdMWD/YIwj
-VAqv/qFuxdF6Kmh4zx6CCiC0H63lhbJqaHVOrSU3lIW+vaHU6rcMSzyd6BIA8F+sDeGscGNz9395
-nzIlQnQFgCi/vcEkllgVsRch6YlL2weIZ/QVrXA+L02FO8K32/6YaCOJ4XQP3vTFhGMpG8zLB8kA
-pKnXwiJPZ9d37CAFYd4=
------END CERTIFICATE-----
-
-GeoTrust Global CA
-==================
------BEGIN CERTIFICATE-----
-MIIDVDCCAjygAwIBAgIDAjRWMA0GCSqGSIb3DQEBBQUAMEIxCzAJBgNVBAYTAlVTMRYwFAYDVQQK
-Ew1HZW9UcnVzdCBJbmMuMRswGQYDVQQDExJHZW9UcnVzdCBHbG9iYWwgQ0EwHhcNMDIwNTIxMDQw
-MDAwWhcNMjIwNTIxMDQwMDAwWjBCMQswCQYDVQQGEwJVUzEWMBQGA1UEChMNR2VvVHJ1c3QgSW5j
-LjEbMBkGA1UEAxMSR2VvVHJ1c3QgR2xvYmFsIENBMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIB
-CgKCAQEA2swYYzD99BcjGlZ+W988bDjkcbd4kdS8odhM+KhDtgPpTSEHCIjaWC9mOSm9BXiLnTjo
-BbdqfnGk5sRgprDvgOSJKA+eJdbtg/OtppHHmMlCGDUUna2YRpIuT8rxh0PBFpVXLVDviS2Aelet
-8u5fa9IAjbkU+BQVNdnARqN7csiRv8lVK83Qlz6cJmTM386DGXHKTubU1XupGc1V3sjs0l44U+Vc
-T4wt/lAjNvxm5suOpDkZALeVAjmRCw7+OC7RHQWa9k0+bw8HHa8sHo9gOeL6NlMTOdReJivbPagU
-vTLrGAMoUgRx5aszPeE4uwc2hGKceeoWMPRfwCvocWvk+QIDAQABo1MwUTAPBgNVHRMBAf8EBTAD
-AQH/MB0GA1UdDgQWBBTAephojYn7qwVkDBF9qn1luMrMTjAfBgNVHSMEGDAWgBTAephojYn7qwVk
-DBF9qn1luMrMTjANBgkqhkiG9w0BAQUFAAOCAQEANeMpauUvXVSOKVCUn5kaFOSPeCpilKInZ57Q
-zxpeR+nBsqTP3UEaBU6bS+5Kb1VSsyShNwrrZHYqLizz/Tt1kL/6cdjHPTfStQWVYrmm3ok9Nns4
-d0iXrKYgjy6myQzCsplFAMfOEVEiIuCl6rYVSAlk6l5PdPcFPseKUgzbFbS9bZvlxrFUaKnjaZC2
-mqUPuLk/IH2uSrW4nOQdtqvmlKXBx4Ot2/Unhw4EbNX/3aBd7YdStysVAq45pmp06drE57xNNB6p
-XE0zX5IJL4hmXXeXxx12E6nV5fEWCRE11azbJHFwLJhWC9kXtNHjUStedejV0NxPNO3CBWaAocvm
-Mw==
------END CERTIFICATE-----
-
-GeoTrust Global CA 2
-====================
------BEGIN CERTIFICATE-----
-MIIDZjCCAk6gAwIBAgIBATANBgkqhkiG9w0BAQUFADBEMQswCQYDVQQGEwJVUzEWMBQGA1UEChMN
-R2VvVHJ1c3QgSW5jLjEdMBsGA1UEAxMUR2VvVHJ1c3QgR2xvYmFsIENBIDIwHhcNMDQwMzA0MDUw
-MDAwWhcNMTkwMzA0MDUwMDAwWjBEMQswCQYDVQQGEwJVUzEWMBQGA1UEChMNR2VvVHJ1c3QgSW5j
-LjEdMBsGA1UEAxMUR2VvVHJ1c3QgR2xvYmFsIENBIDIwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAw
-ggEKAoIBAQDvPE1APRDfO1MA4Wf+lGAVPoWI8YkNkMgoI5kF6CsgncbzYEbYwbLVjDHZ3CB5JIG/
-NTL8Y2nbsSpr7iFY8gjpeMtvy/wWUsiRxP89c96xPqfCfWbB9X5SJBri1WeR0IIQ13hLTytCOb1k
-LUCgsBDTOEhGiKEMuzozKmKY+wCdE1l/bztyqu6mD4b5BWHqZ38MN5aL5mkWRxHCJ1kDs6ZgwiFA
-Vvqgx306E+PsV8ez1q6diYD3Aecs9pYrEw15LNnA5IZ7S4wMcoKK+xfNAGw6EzywhIdLFnopsk/b
-HdQL82Y3vdj2V7teJHq4PIu5+pIaGoSe2HSPqht/XvT+RSIhAgMBAAGjYzBhMA8GA1UdEwEB/wQF
-MAMBAf8wHQYDVR0OBBYEFHE4NvICMVNHK266ZUapEBVYIAUJMB8GA1UdIwQYMBaAFHE4NvICMVNH
-K266ZUapEBVYIAUJMA4GA1UdDwEB/wQEAwIBhjANBgkqhkiG9w0BAQUFAAOCAQEAA/e1K6tdEPx7
-srJerJsOflN4WT5CBP51o62sgU7XAotexC3IUnbHLB/8gTKY0UvGkpMzNTEv/NgdRN3ggX+d6Yvh
-ZJFiCzkIjKx0nVnZellSlxG5FntvRdOW2TF9AjYPnDtuzywNA0ZF66D0f0hExghAzN4bcLUprbqL
-OzRldRtxIR0sFAqwlpW41uryZfspuk/qkZN0abby/+Ea0AzRdoXLiiW9l14sbxWZJue2Kf8i7MkC
-x1YAzUm5s2x7UwQa4qjJqhIFI8LO57sEAszAR6LkxCkvW0VXiVHuPOtSCP8HNR6fNWpHSlaY0VqF
-H4z1Ir+rzoPz4iIprn2DQKi6bA==
------END CERTIFICATE-----
-
-GeoTrust Universal CA
-=====================
------BEGIN CERTIFICATE-----
-MIIFaDCCA1CgAwIBAgIBATANBgkqhkiG9w0BAQUFADBFMQswCQYDVQQGEwJVUzEWMBQGA1UEChMN
-R2VvVHJ1c3QgSW5jLjEeMBwGA1UEAxMVR2VvVHJ1c3QgVW5pdmVyc2FsIENBMB4XDTA0MDMwNDA1
-MDAwMFoXDTI5MDMwNDA1MDAwMFowRTELMAkGA1UEBhMCVVMxFjAUBgNVBAoTDUdlb1RydXN0IElu
-Yy4xHjAcBgNVBAMTFUdlb1RydXN0IFVuaXZlcnNhbCBDQTCCAiIwDQYJKoZIhvcNAQEBBQADggIP
-ADCCAgoCggIBAKYVVaCjxuAfjJ0hUNfBvitbtaSeodlyWL0AG0y/YckUHUWCq8YdgNY96xCcOq9t
-JPi8cQGeBvV8Xx7BDlXKg5pZMK4ZyzBIle0iN430SppyZj6tlcDgFgDgEB8rMQ7XlFTTQjOgNB0e
-RXbdT8oYN+yFFXoZCPzVx5zw8qkuEKmS5j1YPakWaDwvdSEYfyh3peFhF7em6fgemdtzbvQKoiFs
-7tqqhZJmr/Z6a4LauiIINQ/PQvE1+mrufislzDoR5G2vc7J2Ha3QsnhnGqQ5HFELZ1aD/ThdDc7d
-8Lsrlh/eezJS/R27tQahsiFepdaVaH/wmZ7cRQg+59IJDTWU3YBOU5fXtQlEIGQWFwMCTFMNaN7V
-qnJNk22CDtucvc+081xdVHppCZbW2xHBjXWotM85yM48vCR85mLK4b19p71XZQvk/iXttmkQ3Cga
-Rr0BHdCXteGYO8A3ZNY9lO4L4fUorgtWv3GLIylBjobFS1J72HGrH4oVpjuDWtdYAVHGTEHZf9hB
-Z3KiKN9gg6meyHv8U3NyWfWTehd2Ds735VzZC1U0oqpbtWpU5xPKV+yXbfReBi9Fi1jUIxaS5BZu
-KGNZMN9QAZxjiRqf2xeUgnA3wySemkfWWspOqGmJch+RbNt+nhutxx9z3SxPGWX9f5NAEC7S8O08
-ni4oPmkmM8V7AgMBAAGjYzBhMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFNq7LqqwDLiIJlF0
-XG0D08DYj3rWMB8GA1UdIwQYMBaAFNq7LqqwDLiIJlF0XG0D08DYj3rWMA4GA1UdDwEB/wQEAwIB
-hjANBgkqhkiG9w0BAQUFAAOCAgEAMXjmx7XfuJRAyXHEqDXsRh3ChfMoWIawC/yOsjmPRFWrZIRc
-aanQmjg8+uUfNeVE44B5lGiku8SfPeE0zTBGi1QrlaXv9z+ZhP015s8xxtxqv6fXIwjhmF7DWgh2
-qaavdy+3YL1ERmrvl/9zlcGO6JP7/TG37FcREUWbMPEaiDnBTzynANXH/KttgCJwpQzgXQQpAvvL
-oJHRfNbDflDVnVi+QTjruXU8FdmbyUqDWcDaU/0zuzYYm4UPFd3uLax2k7nZAY1IEKj79TiG8dsK
-xr2EoyNB3tZ3b4XUhRxQ4K5RirqNPnbiucon8l+f725ZDQbYKxek0nxru18UGkiPGkzns0ccjkxF
-KyDuSN/n3QmOGKjaQI2SJhFTYXNd673nxE0pN2HrrDktZy4W1vUAg4WhzH92xH3kt0tm7wNFYGm2
-DFKWkoRepqO1pD4r2czYG0eq8kTaT/kD6PAUyz/zg97QwVTjt+gKN02LIFkDMBmhLMi9ER/frslK
-xfMnZmaGrGiR/9nmUxwPi1xpZQomyB40w11Re9epnAahNt3ViZS82eQtDF4JbAiXfKM9fJP/P6EU
-p8+1Xevb2xzEdt+Iub1FBZUbrvxGakyvSOPOrg/SfuvmbJxPgWp6ZKy7PtXny3YuxadIwVyQD8vI
-P/rmMuGNG2+k5o7Y+SlIis5z/iw=
------END CERTIFICATE-----
-
-GeoTrust Universal CA 2
-=======================
------BEGIN CERTIFICATE-----
-MIIFbDCCA1SgAwIBAgIBATANBgkqhkiG9w0BAQUFADBHMQswCQYDVQQGEwJVUzEWMBQGA1UEChMN
-R2VvVHJ1c3QgSW5jLjEgMB4GA1UEAxMXR2VvVHJ1c3QgVW5pdmVyc2FsIENBIDIwHhcNMDQwMzA0
-MDUwMDAwWhcNMjkwMzA0MDUwMDAwWjBHMQswCQYDVQQGEwJVUzEWMBQGA1UEChMNR2VvVHJ1c3Qg
-SW5jLjEgMB4GA1UEAxMXR2VvVHJ1c3QgVW5pdmVyc2FsIENBIDIwggIiMA0GCSqGSIb3DQEBAQUA
-A4ICDwAwggIKAoICAQCzVFLByT7y2dyxUxpZKeexw0Uo5dfR7cXFS6GqdHtXr0om/Nj1XqduGdt0
-DE81WzILAePb63p3NeqqWuDW6KFXlPCQo3RWlEQwAx5cTiuFJnSCegx2oG9NzkEtoBUGFF+3Qs17
-j1hhNNwqCPkuwwGmIkQcTAeC5lvO0Ep8BNMZcyfwqph/Lq9O64ceJHdqXbboW0W63MOhBW9Wjo8Q
-JqVJwy7XQYci4E+GymC16qFjwAGXEHm9ADwSbSsVsaxLse4YuU6W3Nx2/zu+z18DwPw76L5GG//a
-QMJS9/7jOvdqdzXQ2o3rXhhqMcceujwbKNZrVMaqW9eiLBsZzKIC9ptZvTdrhrVtgrrY6slWvKk2
-WP0+GfPtDCapkzj4T8FdIgbQl+rhrcZV4IErKIM6+vR7IVEAvlI4zs1meaj0gVbi0IMJR1FbUGrP
-20gaXT73y/Zl92zxlfgCOzJWgjl6W70viRu/obTo/3+NjN8D8WBOWBFM66M/ECuDmgFz2ZRthAAn
-ZqzwcEAJQpKtT5MNYQlRJNiS1QuUYbKHsu3/mjX/hVTK7URDrBs8FmtISgocQIgfksILAAX/8sgC
-SqSqqcyZlpwvWOB94b67B9xfBHJcMTTD7F8t4D1kkCLm0ey4Lt1ZrtmhN79UNdxzMk+MBB4zsslG
-8dhcyFVQyWi9qLo2CQIDAQABo2MwYTAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBR281Xh+qQ2
-+/CfXGJx7Tz0RzgQKzAfBgNVHSMEGDAWgBR281Xh+qQ2+/CfXGJx7Tz0RzgQKzAOBgNVHQ8BAf8E
-BAMCAYYwDQYJKoZIhvcNAQEFBQADggIBAGbBxiPz2eAubl/oz66wsCVNK/g7WJtAJDday6sWSf+z
-dXkzoS9tcBc0kf5nfo/sm+VegqlVHy/c1FEHEv6sFj4sNcZj/NwQ6w2jqtB8zNHQL1EuxBRa3ugZ
-4T7GzKQp5y6EqgYweHZUcyiYWTjgAA1i00J9IZ+uPTqM1fp3DRgrFg5fNuH8KrUwJM/gYwx7WBr+
-mbpCErGR9Hxo4sjoryzqyX6uuyo9DRXcNJW2GHSoag/HtPQTxORb7QrSpJdMKu0vbBKJPfEncKpq
-A1Ihn0CoZ1Dy81of398j9tx4TuaYT1U6U+Pv8vSfx3zYWK8pIpe44L2RLrB27FcRz+8pRPPphXpg
-Y+RdM4kX2TGq2tbzGDVyz4crL2MjhF2EjD9XoIj8mZEoJmmZ1I+XRL6O1UixpCgp8RW04eWe3fiP
-pm8m1wk8OhwRDqZsN/etRIcsKMfYdIKz0G9KV7s1KSegi+ghp4dkNl3M2Basx7InQJJVOCiNUW7d
-FGdTbHFcJoRNdVq2fmBWqU2t+5sel/MN2dKXVHfaPRK34B7vCAas+YWH6aLcr34YEoP9VhdBLtUp
-gn2Z9DH2canPLAEnpQW5qrJITirvn5NSUZU8UnOOVkwXQMAJKOSLakhT2+zNVVXxxvjpoixMptEm
-X36vWkzaH6byHCx+rgIW0lbQL1dTR+iS
------END CERTIFICATE-----
-
-America Online Root Certification Authority 1
-=============================================
------BEGIN CERTIFICATE-----
-MIIDpDCCAoygAwIBAgIBATANBgkqhkiG9w0BAQUFADBjMQswCQYDVQQGEwJVUzEcMBoGA1UEChMT
-QW1lcmljYSBPbmxpbmUgSW5jLjE2MDQGA1UEAxMtQW1lcmljYSBPbmxpbmUgUm9vdCBDZXJ0aWZp
-Y2F0aW9uIEF1dGhvcml0eSAxMB4XDTAyMDUyODA2MDAwMFoXDTM3MTExOTIwNDMwMFowYzELMAkG
-A1UEBhMCVVMxHDAaBgNVBAoTE0FtZXJpY2EgT25saW5lIEluYy4xNjA0BgNVBAMTLUFtZXJpY2Eg
-T25saW5lIFJvb3QgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgMTCCASIwDQYJKoZIhvcNAQEBBQAD
-ggEPADCCAQoCggEBAKgv6KRpBgNHw+kqmP8ZonCaxlCyfqXfaE0bfA+2l2h9LaaLl+lkhsmj76CG
-v2BlnEtUiMJIxUo5vxTjWVXlGbR0yLQFOVwWpeKVBeASrlmLojNoWBym1BW32J/X3HGrfpq/m44z
-DyL9Hy7nBzbvYjnF3cu6JRQj3gzGPTzOggjmZj7aUTsWOqMFf6Dch9Wc/HKpoH145LcxVR5lu9Rh
-sCFg7RAycsWSJR74kEoYeEfffjA3PlAb2xzTa5qGUwew76wGePiEmf4hjUyAtgyC9mZweRrTT6PP
-8c9GsEsPPt2IYriMqQkoO3rHl+Ee5fSfwMCuJKDIodkP1nsmgmkyPacCAwEAAaNjMGEwDwYDVR0T
-AQH/BAUwAwEB/zAdBgNVHQ4EFgQUAK3Zo/Z59m50qX8zPYEX10zPM94wHwYDVR0jBBgwFoAUAK3Z
-o/Z59m50qX8zPYEX10zPM94wDgYDVR0PAQH/BAQDAgGGMA0GCSqGSIb3DQEBBQUAA4IBAQB8itEf
-GDeC4Liwo+1WlchiYZwFos3CYiZhzRAW18y0ZTTQEYqtqKkFZu90821fnZmv9ov761KyBZiibyrF
-VL0lvV+uyIbqRizBs73B6UlwGBaXCBOMIOAbLjpHyx7kADCVW/RFo8AasAFOq73AI25jP4BKxQft
-3OJvx8Fi8eNy1gTIdGcL+oiroQHIb/AUr9KZzVGTfu0uOMe9zkZQPXLjeSWdm4grECDdpbgyn43g
-Kd8hdIaC2y+CMMbHNYaz+ZZfRtsMRf3zUMNvxsNIrUam4SdHCh0Om7bCd39j8uB9Gr784N/Xx6ds
-sPmuujz9dLQR6FgNgLzTqIA6me11zEZ7
------END CERTIFICATE-----
-
-America Online Root Certification Authority 2
-=============================================
------BEGIN CERTIFICATE-----
-MIIFpDCCA4ygAwIBAgIBATANBgkqhkiG9w0BAQUFADBjMQswCQYDVQQGEwJVUzEcMBoGA1UEChMT
-QW1lcmljYSBPbmxpbmUgSW5jLjE2MDQGA1UEAxMtQW1lcmljYSBPbmxpbmUgUm9vdCBDZXJ0aWZp
-Y2F0aW9uIEF1dGhvcml0eSAyMB4XDTAyMDUyODA2MDAwMFoXDTM3MDkyOTE0MDgwMFowYzELMAkG
-A1UEBhMCVVMxHDAaBgNVBAoTE0FtZXJpY2EgT25saW5lIEluYy4xNjA0BgNVBAMTLUFtZXJpY2Eg
-T25saW5lIFJvb3QgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgMjCCAiIwDQYJKoZIhvcNAQEBBQAD
-ggIPADCCAgoCggIBAMxBRR3pPU0Q9oyxQcngXssNt79Hc9PwVU3dxgz6sWYFas14tNwC206B89en
-fHG8dWOgXeMHDEjsJcQDIPT/DjsS/5uN4cbVG7RtIuOx238hZK+GvFciKtZHgVdEglZTvYYUAQv8
-f3SkWq7xuhG1m1hagLQ3eAkzfDJHA1zEpYNI9FdWboE2JxhP7JsowtS013wMPgwr38oE18aO6lhO
-qKSlGBxsRZijQdEt0sdtjRnxrXm3gT+9BoInLRBYBbV4Bbkv2wxrkJB+FFk4u5QkE+XRnRTf04JN
-RvCAOVIyD+OEsnpD8l7eXz8d3eOyG6ChKiMDbi4BFYdcpnV1x5dhvt6G3NRI270qv0pV2uh9UPu0
-gBe4lL8BPeraunzgWGcXuVjgiIZGZ2ydEEdYMtA1fHkqkKJaEBEjNa0vzORKW6fIJ/KD3l67Xnfn
-6KVuY8INXWHQjNJsWiEOyiijzirplcdIz5ZvHZIlyMbGwcEMBawmxNJ10uEqZ8A9W6Wa6897Gqid
-FEXlD6CaZd4vKL3Ob5Rmg0gp2OpljK+T2WSfVVcmv2/LNzGZo2C7HK2JNDJiuEMhBnIMoVxtRsX6
-Kc8w3onccVvdtjc+31D1uAclJuW8tf48ArO3+L5DwYcRlJ4jbBeKuIonDFRH8KmzwICMoCfrHRnj
-B453cMor9H124HhnAgMBAAGjYzBhMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFE1FwWg4u3Op
-aaEg5+31IqEjFNeeMB8GA1UdIwQYMBaAFE1FwWg4u3OpaaEg5+31IqEjFNeeMA4GA1UdDwEB/wQE
-AwIBhjANBgkqhkiG9w0BAQUFAAOCAgEAZ2sGuV9FOypLM7PmG2tZTiLMubekJcmnxPBUlgtk87FY
-T15R/LKXeydlwuXK5w0MJXti4/qftIe3RUavg6WXSIylvfEWK5t2LHo1YGwRgJfMqZJS5ivmae2p
-+DYtLHe/YUjRYwu5W1LtGLBDQiKmsXeu3mnFzcccobGlHBD7GL4acN3Bkku+KVqdPzW+5X1R+FXg
-JXUjhx5c3LqdsKyzadsXg8n33gy8CNyRnqjQ1xU3c6U1uPx+xURABsPr+CKAXEfOAuMRn0T//Zoy
-zH1kUQ7rVyZ2OuMeIjzCpjbdGe+n/BLzJsBZMYVMnNjP36TMzCmT/5RtdlwTCJfy7aULTd3oyWgO
-ZtMADjMSW7yV5TKQqLPGbIOtd+6Lfn6xqavT4fG2wLHqiMDn05DpKJKUe2h7lyoKZy2FAjgQ5ANh
-1NolNscIWC2hp1GvMApJ9aZphwctREZ2jirlmjvXGKL8nDgQzMY70rUXOm/9riW99XJZZLF0Kjhf
-GEzfz3EEWjbUvy+ZnOjZurGV5gJLIaFb1cFPj65pbVPbAZO1XB4Y3WRayhgoPmMEEf0cjQAPuDff
-Z4qdZqkCapH/E8ovXYO8h5Ns3CRRFgQlZvqz2cK6Kb6aSDiCmfS/O0oxGfm/jiEzFMpPVF/7zvuP
-cX/9XhmgD0uRuMRUvAawRY8mkaKO/qk=
------END CERTIFICATE-----
-
-Visa eCommerce Root
-===================
------BEGIN CERTIFICATE-----
-MIIDojCCAoqgAwIBAgIQE4Y1TR0/BvLB+WUF1ZAcYjANBgkqhkiG9w0BAQUFADBrMQswCQYDVQQG
-EwJVUzENMAsGA1UEChMEVklTQTEvMC0GA1UECxMmVmlzYSBJbnRlcm5hdGlvbmFsIFNlcnZpY2Ug
-QXNzb2NpYXRpb24xHDAaBgNVBAMTE1Zpc2EgZUNvbW1lcmNlIFJvb3QwHhcNMDIwNjI2MDIxODM2
-WhcNMjIwNjI0MDAxNjEyWjBrMQswCQYDVQQGEwJVUzENMAsGA1UEChMEVklTQTEvMC0GA1UECxMm
-VmlzYSBJbnRlcm5hdGlvbmFsIFNlcnZpY2UgQXNzb2NpYXRpb24xHDAaBgNVBAMTE1Zpc2EgZUNv
-bW1lcmNlIFJvb3QwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCvV95WHm6h2mCxlCfL
-F9sHP4CFT8icttD0b0/Pmdjh28JIXDqsOTPHH2qLJj0rNfVIsZHBAk4ElpF7sDPwsRROEW+1QK8b
-RaVK7362rPKgH1g/EkZgPI2h4H3PVz4zHvtH8aoVlwdVZqW1LS7YgFmypw23RuwhY/81q6UCzyr0
-TP579ZRdhE2o8mCP2w4lPJ9zcc+U30rq299yOIzzlr3xF7zSujtFWsan9sYXiwGd/BmoKoMWuDpI
-/k4+oKsGGelT84ATB+0tvz8KPFUgOSwsAGl0lUq8ILKpeeUYiZGo3BxN77t+Nwtd/jmliFKMAGzs
-GHxBvfaLdXe6YJ2E5/4tAgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEG
-MB0GA1UdDgQWBBQVOIMPPyw/cDMezUb+B4wg4NfDtzANBgkqhkiG9w0BAQUFAAOCAQEAX/FBfXxc
-CLkr4NWSR/pnXKUTwwMhmytMiUbPWU3J/qVAtmPN3XEolWcRzCSs00Rsca4BIGsDoo8Ytyk6feUW
-YFN4PMCvFYP3j1IzJL1kk5fui/fbGKhtcbP3LBfQdCVp9/5rPJS+TUtBjE7ic9DjkCJzQ83z7+pz
-zkWKsKZJ/0x9nXGIxHYdkFsd7v3M9+79YKWxehZx0RbQfBI8bGmX265fOZpwLwU8GUYEmSA20GBu
-YQa7FkKMcPcw++DbZqMAAb3mLNqRX6BGi01qnD093QVG/na/oAo85ADmJ7f/hC3euiInlhBx6yLt
-398znM/jra6O1I7mT1GvFpLgXPYHDw==
------END CERTIFICATE-----
-
-Certum Root CA
-==============
------BEGIN CERTIFICATE-----
-MIIDDDCCAfSgAwIBAgIDAQAgMA0GCSqGSIb3DQEBBQUAMD4xCzAJBgNVBAYTAlBMMRswGQYDVQQK
-ExJVbml6ZXRvIFNwLiB6IG8uby4xEjAQBgNVBAMTCUNlcnR1bSBDQTAeFw0wMjA2MTExMDQ2Mzla
-Fw0yNzA2MTExMDQ2MzlaMD4xCzAJBgNVBAYTAlBMMRswGQYDVQQKExJVbml6ZXRvIFNwLiB6IG8u
-by4xEjAQBgNVBAMTCUNlcnR1bSBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAM6x
-wS7TT3zNJc4YPk/EjG+AanPIW1H4m9LcuwBcsaD8dQPugfCI7iNS6eYVM42sLQnFdvkrOYCJ5JdL
-kKWoePhzQ3ukYbDYWMzhbGZ+nPMJXlVjhNWo7/OxLjBos8Q82KxujZlakE403Daaj4GIULdtlkIJ
-89eVgw1BS7Bqa/j8D35in2fE7SZfECYPCE/wpFcozo+47UX2bu4lXapuOb7kky/ZR6By6/qmW6/K
-Uz/iDsaWVhFu9+lmqSbYf5VT7QqFiLpPKaVCjF62/IUgAKpoC6EahQGcxEZjgoi2IrHu/qpGWX7P
-NSzVttpd90gzFFS269lvzs2I1qsb2pY7HVkCAwEAAaMTMBEwDwYDVR0TAQH/BAUwAwEB/zANBgkq
-hkiG9w0BAQUFAAOCAQEAuI3O7+cUus/usESSbLQ5PqKEbq24IXfS1HeCh+YgQYHu4vgRt2PRFze+
-GXYkHAQaTOs9qmdvLdTN/mUxcMUbpgIKumB7bVjCmkn+YzILa+M6wKyrO7Do0wlRjBCDxjTgxSvg
-GrZgFCdsMneMvLJymM/NzD+5yCRCFNZX/OYmQ6kd5YCQzgNUKD73P9P4Te1qCjqTE5s7FCMTY5w/
-0YcneeVMUeMBrYVdGjux1XMQpNPyvG5k9VpWkKjHDkx0Dy5xO/fIR/RpbxXyEV6DHpx8Uq79AtoS
-qFlnGNu8cN2bsWntgM6JQEhqDjXKKWYVIZQs6GAqm4VKQPNriiTsBhYscw==
------END CERTIFICATE-----
-
-Comodo AAA Services root
-========================
------BEGIN CERTIFICATE-----
-MIIEMjCCAxqgAwIBAgIBATANBgkqhkiG9w0BAQUFADB7MQswCQYDVQQGEwJHQjEbMBkGA1UECAwS
-R3JlYXRlciBNYW5jaGVzdGVyMRAwDgYDVQQHDAdTYWxmb3JkMRowGAYDVQQKDBFDb21vZG8gQ0Eg
-TGltaXRlZDEhMB8GA1UEAwwYQUFBIENlcnRpZmljYXRlIFNlcnZpY2VzMB4XDTA0MDEwMTAwMDAw
-MFoXDTI4MTIzMTIzNTk1OVowezELMAkGA1UEBhMCR0IxGzAZBgNVBAgMEkdyZWF0ZXIgTWFuY2hl
-c3RlcjEQMA4GA1UEBwwHU2FsZm9yZDEaMBgGA1UECgwRQ29tb2RvIENBIExpbWl0ZWQxITAfBgNV
-BAMMGEFBQSBDZXJ0aWZpY2F0ZSBTZXJ2aWNlczCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC
-ggEBAL5AnfRu4ep2hxxNRUSOvkbIgwadwSr+GB+O5AL686tdUIoWMQuaBtDFcCLNSS1UY8y2bmhG
-C1Pqy0wkwLxyTurxFa70VJoSCsN6sjNg4tqJVfMiWPPe3M/vg4aijJRPn2jymJBGhCfHdr/jzDUs
-i14HZGWCwEiwqJH5YZ92IFCokcdmtet4YgNW8IoaE+oxox6gmf049vYnMlhvB/VruPsUK6+3qszW
-Y19zjNoFmag4qMsXeDZRrOme9Hg6jc8P2ULimAyrL58OAd7vn5lJ8S3frHRNG5i1R8XlKdH5kBjH
-Ypy+g8cmez6KJcfA3Z3mNWgQIJ2P2N7Sw4ScDV7oL8kCAwEAAaOBwDCBvTAdBgNVHQ4EFgQUoBEK
-Iz6W8Qfs4q8p74Klf9AwpLQwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wewYDVR0f
-BHQwcjA4oDagNIYyaHR0cDovL2NybC5jb21vZG9jYS5jb20vQUFBQ2VydGlmaWNhdGVTZXJ2aWNl
-cy5jcmwwNqA0oDKGMGh0dHA6Ly9jcmwuY29tb2RvLm5ldC9BQUFDZXJ0aWZpY2F0ZVNlcnZpY2Vz
-LmNybDANBgkqhkiG9w0BAQUFAAOCAQEACFb8AvCb6P+k+tZ7xkSAzk/ExfYAWMymtrwUSWgEdujm
-7l3sAg9g1o1QGE8mTgHj5rCl7r+8dFRBv/38ErjHT1r0iWAFf2C3BUrz9vHCv8S5dIa2LX1rzNLz
-Rt0vxuBqw8M0Ayx9lt1awg6nCpnBBYurDC/zXDrPbDdVCYfeU0BsWO/8tqtlbgT2G9w84FoVxp7Z
-8VlIMCFlA2zs6SFz7JsDoeA3raAVGI/6ugLOpyypEBMs1OUIJqsil2D4kF501KKaU73yqWjgom7C
-12yxow+ev+to51byrvLjKzg6CYG1a4XXvi3tPxq3smPi9WIsgtRqAEFQ8TmDn5XpNpaYbg==
------END CERTIFICATE-----
-
-Comodo Secure Services root
-===========================
------BEGIN CERTIFICATE-----
-MIIEPzCCAyegAwIBAgIBATANBgkqhkiG9w0BAQUFADB+MQswCQYDVQQGEwJHQjEbMBkGA1UECAwS
-R3JlYXRlciBNYW5jaGVzdGVyMRAwDgYDVQQHDAdTYWxmb3JkMRowGAYDVQQKDBFDb21vZG8gQ0Eg
-TGltaXRlZDEkMCIGA1UEAwwbU2VjdXJlIENlcnRpZmljYXRlIFNlcnZpY2VzMB4XDTA0MDEwMTAw
-MDAwMFoXDTI4MTIzMTIzNTk1OVowfjELMAkGA1UEBhMCR0IxGzAZBgNVBAgMEkdyZWF0ZXIgTWFu
-Y2hlc3RlcjEQMA4GA1UEBwwHU2FsZm9yZDEaMBgGA1UECgwRQ29tb2RvIENBIExpbWl0ZWQxJDAi
-BgNVBAMMG1NlY3VyZSBDZXJ0aWZpY2F0ZSBTZXJ2aWNlczCCASIwDQYJKoZIhvcNAQEBBQADggEP
-ADCCAQoCggEBAMBxM4KK0HDrc4eCQNUd5MvJDkKQ+d40uaG6EfQlhfPMcm3ye5drswfxdySRXyWP
-9nQ95IDC+DwN879A6vfIUtFyb+/Iq0G4bi4XKpVpDM3SHpR7LZQdqnXXs5jLrLxkU0C8j6ysNstc
-rbvd4JQX7NFc0L/vpZXJkMWwrPsbQ996CF23uPJAGysnnlDOXmWCiIxe004MeuoIkbY2qitC++rC
-oznl2yY4rYsK7hljxxwk3wN42ubqwUcaCwtGCd0C/N7Lh1/XMGNooa7cMqG6vv5Eq2i2pRcV/b3V
-p6ea5EQz6YiO/O1R65NxTq0B50SOqy3LqP4BSUjwwN3HaNiS/j0CAwEAAaOBxzCBxDAdBgNVHQ4E
-FgQUPNiTiMLAggnMAZkGkyDpnnAJY08wDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8w
-gYEGA1UdHwR6MHgwO6A5oDeGNWh0dHA6Ly9jcmwuY29tb2RvY2EuY29tL1NlY3VyZUNlcnRpZmlj
-YXRlU2VydmljZXMuY3JsMDmgN6A1hjNodHRwOi8vY3JsLmNvbW9kby5uZXQvU2VjdXJlQ2VydGlm
-aWNhdGVTZXJ2aWNlcy5jcmwwDQYJKoZIhvcNAQEFBQADggEBAIcBbSMdflsXfcFhMs+P5/OKlFlm
-4J4oqF7Tt/Q05qo5spcWxYJvMqTpjOev/e/C6LlLqqP05tqNZSH7uoDrJiiFGv45jN5bBAS0VPmj
-Z55B+glSzAVIqMk/IQQezkhr/IXownuvf7fM+F86/TXGDe+X3EyrEeFryzHRbPtIgKvcnDe4IRRL
-DXE97IMzbtFuMhbsmMcWi1mmNKsFVy2T96oTy9IT4rcuO81rUBcJaD61JlfutuC23bkpgHl9j6Pw
-pCikFcSF9CfUa7/lXORlAnZUtOM3ZiTTGWHIUhDlizeauan5Hb/qmZJhlv8BzaFfDbxxvA6sCx1H
-RR3B7Hzs/Sk=
------END CERTIFICATE-----
-
-Comodo Trusted Services root
-============================
------BEGIN CERTIFICATE-----
-MIIEQzCCAyugAwIBAgIBATANBgkqhkiG9w0BAQUFADB/MQswCQYDVQQGEwJHQjEbMBkGA1UECAwS
-R3JlYXRlciBNYW5jaGVzdGVyMRAwDgYDVQQHDAdTYWxmb3JkMRowGAYDVQQKDBFDb21vZG8gQ0Eg
-TGltaXRlZDElMCMGA1UEAwwcVHJ1c3RlZCBDZXJ0aWZpY2F0ZSBTZXJ2aWNlczAeFw0wNDAxMDEw
-MDAwMDBaFw0yODEyMzEyMzU5NTlaMH8xCzAJBgNVBAYTAkdCMRswGQYDVQQIDBJHcmVhdGVyIE1h
-bmNoZXN0ZXIxEDAOBgNVBAcMB1NhbGZvcmQxGjAYBgNVBAoMEUNvbW9kbyBDQSBMaW1pdGVkMSUw
-IwYDVQQDDBxUcnVzdGVkIENlcnRpZmljYXRlIFNlcnZpY2VzMIIBIjANBgkqhkiG9w0BAQEFAAOC
-AQ8AMIIBCgKCAQEA33FvNlhTWvI2VFeAxHQIIO0Yfyod5jWaHiWsnOWWfnJSoBVC21ndZHoa0Lh7
-3TkVvFVIxO06AOoxEbrycXQaZ7jPM8yoMa+j49d/vzMtTGo87IvDktJTdyR0nAducPy9C1t2ul/y
-/9c3S0pgePfw+spwtOpZqqPOSC+pw7ILfhdyFgymBwwbOM/JYrc/oJOlh0Hyt3BAd9i+FHzjqMB6
-juljatEPmsbS9Is6FARW1O24zG71++IsWL1/T2sr92AkWCTOJu80kTrV44HQsvAEAtdbtz6SrGsS
-ivnkBbA7kUlcsutT6vifR4buv5XAwAaf0lteERv0xwQ1KdJVXOTt6wIDAQABo4HJMIHGMB0GA1Ud
-DgQWBBTFe1i97doladL3WRaoszLAeydb9DAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB
-/zCBgwYDVR0fBHwwejA8oDqgOIY2aHR0cDovL2NybC5jb21vZG9jYS5jb20vVHJ1c3RlZENlcnRp
-ZmljYXRlU2VydmljZXMuY3JsMDqgOKA2hjRodHRwOi8vY3JsLmNvbW9kby5uZXQvVHJ1c3RlZENl
-cnRpZmljYXRlU2VydmljZXMuY3JsMA0GCSqGSIb3DQEBBQUAA4IBAQDIk4E7ibSvuIQSTI3S8Ntw
-uleGFTQQuS9/HrCoiWChisJ3DFBKmwCL2Iv0QeLQg4pKHBQGsKNoBXAxMKdTmw7pSqBYaWcOrp32
-pSxBvzwGa+RZzG0Q8ZZvH9/0BAKkn0U+yNj6NkZEUD+Cl5EfKNsYEYwq5GWDVxISjBc/lDb+XbDA
-BHcTuPQV1T84zJQ6VdCsmPW6AF/ghhmBeC8owH7TzEIK9a5QoNE+xqFx7D+gIIxmOom0jtTYsU0l
-R+4viMi14QVFwL4Ucd56/Y57fU0IlqUSc/AtyjcndBInTMu2l+nZrghtWjlA3QVHdWpaIbOjGM9O
-9y5Xt5hwXsjEeLBi
------END CERTIFICATE-----
-
-QuoVadis Root CA
-================
------BEGIN CERTIFICATE-----
-MIIF0DCCBLigAwIBAgIEOrZQizANBgkqhkiG9w0BAQUFADB/MQswCQYDVQQGEwJCTTEZMBcGA1UE
-ChMQUXVvVmFkaXMgTGltaXRlZDElMCMGA1UECxMcUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0
-eTEuMCwGA1UEAxMlUXVvVmFkaXMgUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw0wMTAz
-MTkxODMzMzNaFw0yMTAzMTcxODMzMzNaMH8xCzAJBgNVBAYTAkJNMRkwFwYDVQQKExBRdW9WYWRp
-cyBMaW1pdGVkMSUwIwYDVQQLExxSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MS4wLAYDVQQD
-EyVRdW9WYWRpcyBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIIBIjANBgkqhkiG9w0BAQEF
-AAOCAQ8AMIIBCgKCAQEAv2G1lVO6V/z68mcLOhrfEYBklbTRvM16z/Ypli4kVEAkOPcahdxYTMuk
-J0KX0J+DisPkBgNbAKVRHnAEdOLB1Dqr1607BxgFjv2DrOpm2RgbaIr1VxqYuvXtdj182d6UajtL
-F8HVj71lODqV0D1VNk7feVcxKh7YWWVJWCCYfqtffp/p1k3sg3Spx2zY7ilKhSoGFPlU5tPaZQeL
-YzcS19Dsw3sgQUSj7cugF+FxZc4dZjH3dgEZyH0DWLaVSR2mEiboxgx24ONmy+pdpibu5cxfvWen
-AScOospUxbF6lR1xHkopigPcakXBpBlebzbNw6Kwt/5cOOJSvPhEQ+aQuwIDAQABo4ICUjCCAk4w
-PQYIKwYBBQUHAQEEMTAvMC0GCCsGAQUFBzABhiFodHRwczovL29jc3AucXVvdmFkaXNvZmZzaG9y
-ZS5jb20wDwYDVR0TAQH/BAUwAwEB/zCCARoGA1UdIASCAREwggENMIIBCQYJKwYBBAG+WAABMIH7
-MIHUBggrBgEFBQcCAjCBxxqBxFJlbGlhbmNlIG9uIHRoZSBRdW9WYWRpcyBSb290IENlcnRpZmlj
-YXRlIGJ5IGFueSBwYXJ0eSBhc3N1bWVzIGFjY2VwdGFuY2Ugb2YgdGhlIHRoZW4gYXBwbGljYWJs
-ZSBzdGFuZGFyZCB0ZXJtcyBhbmQgY29uZGl0aW9ucyBvZiB1c2UsIGNlcnRpZmljYXRpb24gcHJh
-Y3RpY2VzLCBhbmQgdGhlIFF1b1ZhZGlzIENlcnRpZmljYXRlIFBvbGljeS4wIgYIKwYBBQUHAgEW
-Fmh0dHA6Ly93d3cucXVvdmFkaXMuYm0wHQYDVR0OBBYEFItLbe3TKbkGGew5Oanwl4Rqy+/fMIGu
-BgNVHSMEgaYwgaOAFItLbe3TKbkGGew5Oanwl4Rqy+/foYGEpIGBMH8xCzAJBgNVBAYTAkJNMRkw
-FwYDVQQKExBRdW9WYWRpcyBMaW1pdGVkMSUwIwYDVQQLExxSb290IENlcnRpZmljYXRpb24gQXV0
-aG9yaXR5MS4wLAYDVQQDEyVRdW9WYWRpcyBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5ggQ6
-tlCLMA4GA1UdDwEB/wQEAwIBBjANBgkqhkiG9w0BAQUFAAOCAQEAitQUtf70mpKnGdSkfnIYj9lo
-fFIk3WdvOXrEql494liwTXCYhGHoG+NpGA7O+0dQoE7/8CQfvbLO9Sf87C9TqnN7Az10buYWnuul
-LsS/VidQK2K6vkscPFVcQR0kvoIgR13VRH56FmjffU1RcHhXHTMe/QKZnAzNCgVPx7uOpHX6Sm2x
-gI4JVrmcGmD+XcHXetwReNDWXcG31a0ymQM6isxUJTkxgXsTIlG6Rmyhu576BGxJJnSP0nPrzDCi
-5upZIof4l/UO/erMkqQWxFIY6iHOsfHmhIHluqmGKPJDWl0Snawe2ajlCmqnf6CHKc/yiU3U7MXi
-5nrQNiOKSnQ2+Q==
------END CERTIFICATE-----
-
-QuoVadis Root CA 2
-==================
------BEGIN CERTIFICATE-----
-MIIFtzCCA5+gAwIBAgICBQkwDQYJKoZIhvcNAQEFBQAwRTELMAkGA1UEBhMCQk0xGTAXBgNVBAoT
-EFF1b1ZhZGlzIExpbWl0ZWQxGzAZBgNVBAMTElF1b1ZhZGlzIFJvb3QgQ0EgMjAeFw0wNjExMjQx
-ODI3MDBaFw0zMTExMjQxODIzMzNaMEUxCzAJBgNVBAYTAkJNMRkwFwYDVQQKExBRdW9WYWRpcyBM
-aW1pdGVkMRswGQYDVQQDExJRdW9WYWRpcyBSb290IENBIDIwggIiMA0GCSqGSIb3DQEBAQUAA4IC
-DwAwggIKAoICAQCaGMpLlA0ALa8DKYrwD4HIrkwZhR0In6spRIXzL4GtMh6QRr+jhiYaHv5+HBg6
-XJxgFyo6dIMzMH1hVBHL7avg5tKifvVrbxi3Cgst/ek+7wrGsxDp3MJGF/hd/aTa/55JWpzmM+Yk
-lvc/ulsrHHo1wtZn/qtmUIttKGAr79dgw8eTvI02kfN/+NsRE8Scd3bBrrcCaoF6qUWD4gXmuVbB
-lDePSHFjIuwXZQeVikvfj8ZaCuWw419eaxGrDPmF60Tp+ARz8un+XJiM9XOva7R+zdRcAitMOeGy
-lZUtQofX1bOQQ7dsE/He3fbE+Ik/0XX1ksOR1YqI0JDs3G3eicJlcZaLDQP9nL9bFqyS2+r+eXyt
-66/3FsvbzSUr5R/7mp/iUcw6UwxI5g69ybR2BlLmEROFcmMDBOAENisgGQLodKcftslWZvB1Jdxn
-wQ5hYIizPtGo/KPaHbDRsSNU30R2be1B2MGyIrZTHN81Hdyhdyox5C315eXbyOD/5YDXC2Og/zOh
-D7osFRXql7PSorW+8oyWHhqPHWykYTe5hnMz15eWniN9gqRMgeKh0bpnX5UHoycR7hYQe7xFSkyy
-BNKr79X9DFHOUGoIMfmR2gyPZFwDwzqLID9ujWc9Otb+fVuIyV77zGHcizN300QyNQliBJIWENie
-J0f7OyHj+OsdWwIDAQABo4GwMIGtMA8GA1UdEwEB/wQFMAMBAf8wCwYDVR0PBAQDAgEGMB0GA1Ud
-DgQWBBQahGK8SEwzJQTU7tD2A8QZRtGUazBuBgNVHSMEZzBlgBQahGK8SEwzJQTU7tD2A8QZRtGU
-a6FJpEcwRTELMAkGA1UEBhMCQk0xGTAXBgNVBAoTEFF1b1ZhZGlzIExpbWl0ZWQxGzAZBgNVBAMT
-ElF1b1ZhZGlzIFJvb3QgQ0EgMoICBQkwDQYJKoZIhvcNAQEFBQADggIBAD4KFk2fBluornFdLwUv
-Z+YTRYPENvbzwCYMDbVHZF34tHLJRqUDGCdViXh9duqWNIAXINzng/iN/Ae42l9NLmeyhP3ZRPx3
-UIHmfLTJDQtyU/h2BwdBR5YM++CCJpNVjP4iH2BlfF/nJrP3MpCYUNQ3cVX2kiF495V5+vgtJodm
-VjB3pjd4M1IQWK4/YY7yarHvGH5KWWPKjaJW1acvvFYfzznB4vsKqBUsfU16Y8Zsl0Q80m/DShcK
-+JDSV6IZUaUtl0HaB0+pUNqQjZRG4T7wlP0QADj1O+hA4bRuVhogzG9Yje0uRY/W6ZM/57Es3zrW
-IozchLsib9D45MY56QSIPMO661V6bYCZJPVsAfv4l7CUW+v90m/xd2gNNWQjrLhVoQPRTUIZ3Ph1
-WVaj+ahJefivDrkRoHy3au000LYmYjgahwz46P0u05B/B5EqHdZ+XIWDmbA4CD/pXvk1B+TJYm5X
-f6dQlfe6yJvmjqIBxdZmv3lh8zwc4bmCXF2gw+nYSL0ZohEUGW6yhhtoPkg3Goi3XZZenMfvJ2II
-4pEZXNLxId26F0KCl3GBUzGpn/Z9Yr9y4aOTHcyKJloJONDO1w2AFrR4pTqHTI2KpdVGl/IsELm8
-VCLAAVBpQ570su9t+Oza8eOx79+Rj1QqCyXBJhnEUhAFZdWCEOrCMc0u
------END CERTIFICATE-----
-
-QuoVadis Root CA 3
-==================
------BEGIN CERTIFICATE-----
-MIIGnTCCBIWgAwIBAgICBcYwDQYJKoZIhvcNAQEFBQAwRTELMAkGA1UEBhMCQk0xGTAXBgNVBAoT
-EFF1b1ZhZGlzIExpbWl0ZWQxGzAZBgNVBAMTElF1b1ZhZGlzIFJvb3QgQ0EgMzAeFw0wNjExMjQx
-OTExMjNaFw0zMTExMjQxOTA2NDRaMEUxCzAJBgNVBAYTAkJNMRkwFwYDVQQKExBRdW9WYWRpcyBM
-aW1pdGVkMRswGQYDVQQDExJRdW9WYWRpcyBSb290IENBIDMwggIiMA0GCSqGSIb3DQEBAQUAA4IC
-DwAwggIKAoICAQDMV0IWVJzmmNPTTe7+7cefQzlKZbPoFog02w1ZkXTPkrgEQK0CSzGrvI2RaNgg
-DhoB4hp7Thdd4oq3P5kazethq8Jlph+3t723j/z9cI8LoGe+AaJZz3HmDyl2/7FWeUUrH556VOij
-KTVopAFPD6QuN+8bv+OPEKhyq1hX51SGyMnzW9os2l2ObjyjPtr7guXd8lyyBTNvijbO0BNO/79K
-DDRMpsMhvVAEVeuxu537RR5kFd5VAYwCdrXLoT9CabwvvWhDFlaJKjdhkf2mrk7AyxRllDdLkgbv
-BNDInIjbC3uBr7E9KsRlOni27tyAsdLTmZw67mtaa7ONt9XOnMK+pUsvFrGeaDsGb659n/je7Mwp
-p5ijJUMv7/FfJuGITfhebtfZFG4ZM2mnO4SJk8RTVROhUXhA+LjJou57ulJCg54U7QVSWllWp5f8
-nT8KKdjcT5EOE7zelaTfi5m+rJsziO+1ga8bxiJTyPbH7pcUsMV8eFLI8M5ud2CEpukqdiDtWAEX
-MJPpGovgc2PZapKUSU60rUqFxKMiMPwJ7Wgic6aIDFUhWMXhOp8q3crhkODZc6tsgLjoC2SToJyM
-Gf+z0gzskSaHirOi4XCPLArlzW1oUevaPwV/izLmE1xr/l9A4iLItLRkT9a6fUg+qGkM17uGcclz
-uD87nSVL2v9A6wIDAQABo4IBlTCCAZEwDwYDVR0TAQH/BAUwAwEB/zCB4QYDVR0gBIHZMIHWMIHT
-BgkrBgEEAb5YAAMwgcUwgZMGCCsGAQUFBwICMIGGGoGDQW55IHVzZSBvZiB0aGlzIENlcnRpZmlj
-YXRlIGNvbnN0aXR1dGVzIGFjY2VwdGFuY2Ugb2YgdGhlIFF1b1ZhZGlzIFJvb3QgQ0EgMyBDZXJ0
-aWZpY2F0ZSBQb2xpY3kgLyBDZXJ0aWZpY2F0aW9uIFByYWN0aWNlIFN0YXRlbWVudC4wLQYIKwYB
-BQUHAgEWIWh0dHA6Ly93d3cucXVvdmFkaXNnbG9iYWwuY29tL2NwczALBgNVHQ8EBAMCAQYwHQYD
-VR0OBBYEFPLAE+CCQz777i9nMpY1XNu4ywLQMG4GA1UdIwRnMGWAFPLAE+CCQz777i9nMpY1XNu4
-ywLQoUmkRzBFMQswCQYDVQQGEwJCTTEZMBcGA1UEChMQUXVvVmFkaXMgTGltaXRlZDEbMBkGA1UE
-AxMSUXVvVmFkaXMgUm9vdCBDQSAzggIFxjANBgkqhkiG9w0BAQUFAAOCAgEAT62gLEz6wPJv92ZV
-qyM07ucp2sNbtrCD2dDQ4iH782CnO11gUyeim/YIIirnv6By5ZwkajGxkHon24QRiSemd1o417+s
-hvzuXYO8BsbRd2sPbSQvS3pspweWyuOEn62Iix2rFo1bZhfZFvSLgNLd+LJ2w/w4E6oM3kJpK27z
-POuAJ9v1pkQNn1pVWQvVDVJIxa6f8i+AxeoyUDUSly7B4f/xI4hROJ/yZlZ25w9Rl6VSDE1JUZU2
-Pb+iSwwQHYaZTKrzchGT5Or2m9qoXadNt54CrnMAyNojA+j56hl0YgCUyyIgvpSnWbWCar6ZeXqp
-8kokUvd0/bpO5qgdAm6xDYBEwa7TIzdfu4V8K5Iu6H6li92Z4b8nby1dqnuH/grdS/yO9SbkbnBC
-bjPsMZ57k8HkyWkaPcBrTiJt7qtYTcbQQcEr6k8Sh17rRdhs9ZgC06DYVYoGmRmioHfRMJ6szHXu
-g/WwYjnPbFfiTNKRCw51KBuav/0aQ/HKd/s7j2G4aSgWQgRecCocIdiP4b0jWy10QJLZYxkNc91p
-vGJHvOB0K7Lrfb5BG7XARsWhIstfTsEokt4YutUqKLsRixeTmJlglFwjz1onl14LBQaTNx47aTbr
-qZ5hHY8y2o4M1nQ+ewkk2gF3R8Q7zTSMmfXK4SVhM7JZG+Ju1zdXtg2pEto=
------END CERTIFICATE-----
-
-Security Communication Root CA
-==============================
------BEGIN CERTIFICATE-----
-MIIDWjCCAkKgAwIBAgIBADANBgkqhkiG9w0BAQUFADBQMQswCQYDVQQGEwJKUDEYMBYGA1UEChMP
-U0VDT00gVHJ1c3QubmV0MScwJQYDVQQLEx5TZWN1cml0eSBDb21tdW5pY2F0aW9uIFJvb3RDQTEw
-HhcNMDMwOTMwMDQyMDQ5WhcNMjMwOTMwMDQyMDQ5WjBQMQswCQYDVQQGEwJKUDEYMBYGA1UEChMP
-U0VDT00gVHJ1c3QubmV0MScwJQYDVQQLEx5TZWN1cml0eSBDb21tdW5pY2F0aW9uIFJvb3RDQTEw
-ggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCzs/5/022x7xZ8V6UMbXaKL0u/ZPtM7orw
-8yl89f/uKuDp6bpbZCKamm8sOiZpUQWZJtzVHGpxxpp9Hp3dfGzGjGdnSj74cbAZJ6kJDKaVv0uM
-DPpVmDvY6CKhS3E4eayXkmmziX7qIWgGmBSWh9JhNrxtJ1aeV+7AwFb9Ms+k2Y7CI9eNqPPYJayX
-5HA49LY6tJ07lyZDo6G8SVlyTCMwhwFY9k6+HGhWZq/NQV3Is00qVUarH9oe4kA92819uZKAnDfd
-DJZkndwi92SL32HeFZRSFaB9UslLqCHJxrHty8OVYNEP8Ktw+N/LTX7s1vqr2b1/VPKl6Xn62dZ2
-JChzAgMBAAGjPzA9MB0GA1UdDgQWBBSgc0mZaNyFW2XjmygvV5+9M7wHSDALBgNVHQ8EBAMCAQYw
-DwYDVR0TAQH/BAUwAwEB/zANBgkqhkiG9w0BAQUFAAOCAQEAaECpqLvkT115swW1F7NgE+vGkl3g
-0dNq/vu+m22/xwVtWSDEHPC32oRYAmP6SBbvT6UL90qY8j+eG61Ha2POCEfrUj94nK9NrvjVT8+a
-mCoQQTlSxN3Zmw7vkwGusi7KaEIkQmywszo+zenaSMQVy+n5Bw+SUEmK3TGXX8npN6o7WWWXlDLJ
-s58+OmJYxUmtYg5xpTKqL8aJdkNAExNnPaJUJRDL8Try2frbSVa7pv6nQTXD4IhhyYjH3zYQIphZ
-6rBK+1YWc26sTfcioU+tHXotRSflMMFe8toTyyVCUZVHA4xsIcx0Qu1T/zOLjw9XARYvz6buyXAi
-FL39vmwLAw==
------END CERTIFICATE-----
-
-Sonera Class 2 Root CA
-======================
------BEGIN CERTIFICATE-----
-MIIDIDCCAgigAwIBAgIBHTANBgkqhkiG9w0BAQUFADA5MQswCQYDVQQGEwJGSTEPMA0GA1UEChMG
-U29uZXJhMRkwFwYDVQQDExBTb25lcmEgQ2xhc3MyIENBMB4XDTAxMDQwNjA3Mjk0MFoXDTIxMDQw
-NjA3Mjk0MFowOTELMAkGA1UEBhMCRkkxDzANBgNVBAoTBlNvbmVyYTEZMBcGA1UEAxMQU29uZXJh
-IENsYXNzMiBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAJAXSjWdyvANlsdE+hY3
-/Ei9vX+ALTU74W+oZ6m/AxxNjG8yR9VBaKQTBME1DJqEQ/xcHf+Js+gXGM2RX/uJ4+q/Tl18GybT
-dXnt5oTjV+WtKcT0OijnpXuENmmz/V52vaMtmdOQTiMofRhj8VQ7Jp12W5dCsv+u8E7s3TmVToMG
-f+dJQMjFAbJUWmYdPfz56TwKnoG4cPABi+QjVHzIrviQHgCWctRUz2EjvOr7nQKV0ba5cTppCD8P
-tOFCx4j1P5iop7oc4HFx71hXgVB6XGt0Rg6DA5jDjqhu8nYybieDwnPz3BjotJPqdURrBGAgcVeH
-nfO+oJAjPYok4doh28MCAwEAAaMzMDEwDwYDVR0TAQH/BAUwAwEB/zARBgNVHQ4ECgQISqCqWITT
-XjwwCwYDVR0PBAQDAgEGMA0GCSqGSIb3DQEBBQUAA4IBAQBazof5FnIVV0sd2ZvnoiYw7JNn39Yt
-0jSv9zilzqsWuasvfDXLrNAPtEwr/IDva4yRXzZ299uzGxnq9LIR/WFxRL8oszodv7ND6J+/3DEI
-cbCdjdY0RzKQxmUk96BKfARzjzlvF4xytb1LyHr4e4PDKE6cCepnP7JnBBvDFNr450kkkdAdavph
-Oe9r5yF1BgfYErQhIHBCcYHaPJo2vqZbDWpsmh+Re/n570K6Tk6ezAyNlNzZRZxe7EJQY670XcSx
-EtzKO6gunRRaBXW37Ndj4ro1tgQIkejanZz2ZrUYrAqmVCY0M9IbwdR/GjqOC6oybtv8TyWf2TLH
-llpwrN9M
------END CERTIFICATE-----
-
-Staat der Nederlanden Root CA
-=============================
------BEGIN CERTIFICATE-----
-MIIDujCCAqKgAwIBAgIEAJiWijANBgkqhkiG9w0BAQUFADBVMQswCQYDVQQGEwJOTDEeMBwGA1UE
-ChMVU3RhYXQgZGVyIE5lZGVybGFuZGVuMSYwJAYDVQQDEx1TdGFhdCBkZXIgTmVkZXJsYW5kZW4g
-Um9vdCBDQTAeFw0wMjEyMTcwOTIzNDlaFw0xNTEyMTYwOTE1MzhaMFUxCzAJBgNVBAYTAk5MMR4w
-HAYDVQQKExVTdGFhdCBkZXIgTmVkZXJsYW5kZW4xJjAkBgNVBAMTHVN0YWF0IGRlciBOZWRlcmxh
-bmRlbiBSb290IENBMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAmNK1URF6gaYUmHFt
-vsznExvWJw56s2oYHLZhWtVhCb/ekBPHZ+7d89rFDBKeNVU+LCeIQGv33N0iYfXCxw719tV2U02P
-jLwYdjeFnejKScfST5gTCaI+Ioicf9byEGW07l8Y1Rfj+MX94p2i71MOhXeiD+EwR+4A5zN9RGca
-C1Hoi6CeUJhoNFIfLm0B8mBF8jHrqTFoKbt6QZ7GGX+UtFE5A3+y3qcym7RHjm+0Sq7lr7HcsBth
-vJly3uSJt3omXdozSVtSnA71iq3DuD3oBmrC1SoLbHuEvVYFy4ZlkuxEK7COudxwC0barbxjiDn6
-22r+I/q85Ej0ZytqERAhSQIDAQABo4GRMIGOMAwGA1UdEwQFMAMBAf8wTwYDVR0gBEgwRjBEBgRV
-HSAAMDwwOgYIKwYBBQUHAgEWLmh0dHA6Ly93d3cucGtpb3ZlcmhlaWQubmwvcG9saWNpZXMvcm9v
-dC1wb2xpY3kwDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBSofeu8Y6R0E3QA7Jbg0zTBLL9s+DAN
-BgkqhkiG9w0BAQUFAAOCAQEABYSHVXQ2YcG70dTGFagTtJ+k/rvuFbQvBgwp8qiSpGEN/KtcCFtR
-EytNwiphyPgJWPwtArI5fZlmgb9uXJVFIGzmeafR2Bwp/MIgJ1HI8XxdNGdphREwxgDS1/PTfLbw
-MVcoEoJz6TMvplW0C5GUR5z6u3pCMuiufi3IvKwUv9kP2Vv8wfl6leF9fpb8cbDCTMjfRTTJzg3y
-nGQI0DvDKcWy7ZAEwbEpkcUwb8GpcjPM/l0WFywRaed+/sWDCN+83CI6LiBpIzlWYGeQiy52OfsR
-iJf2fL1LuCAWZwWN4jvBcj+UlTfHXbme2JOhF4//DGYVwSR8MnwDHTuhWEUykw==
------END CERTIFICATE-----
-
-TDC Internet Root CA
-====================
------BEGIN CERTIFICATE-----
-MIIEKzCCAxOgAwIBAgIEOsylTDANBgkqhkiG9w0BAQUFADBDMQswCQYDVQQGEwJESzEVMBMGA1UE
-ChMMVERDIEludGVybmV0MR0wGwYDVQQLExRUREMgSW50ZXJuZXQgUm9vdCBDQTAeFw0wMTA0MDUx
-NjMzMTdaFw0yMTA0MDUxNzAzMTdaMEMxCzAJBgNVBAYTAkRLMRUwEwYDVQQKEwxUREMgSW50ZXJu
-ZXQxHTAbBgNVBAsTFFREQyBJbnRlcm5ldCBSb290IENBMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8A
-MIIBCgKCAQEAxLhAvJHVYx/XmaCLDEAedLdInUaMArLgJF/wGROnN4NrXceO+YQwzho7+vvOi20j
-xsNuZp+Jpd/gQlBn+h9sHvTQBda/ytZO5GhgbEaqHF1j4QeGDmUApy6mcca8uYGoOn0a0vnRrEvL
-znWv3Hv6gXPU/Lq9QYjUdLP5Xjg6PEOo0pVOd20TDJ2PeAG3WiAfAzc14izbSysseLlJ28TQx5yc
-5IogCSEWVmb/Bexb4/DPqyQkXsN/cHoSxNK1EKC2IeGNeGlVRGn1ypYcNIUXJXfi9i8nmHj9eQY6
-otZaQ8H/7AQ77hPv01ha/5Lr7K7a8jcDR0G2l8ktCkEiu7vmpwIDAQABo4IBJTCCASEwEQYJYIZI
-AYb4QgEBBAQDAgAHMGUGA1UdHwReMFwwWqBYoFakVDBSMQswCQYDVQQGEwJESzEVMBMGA1UEChMM
-VERDIEludGVybmV0MR0wGwYDVQQLExRUREMgSW50ZXJuZXQgUm9vdCBDQTENMAsGA1UEAxMEQ1JM
-MTArBgNVHRAEJDAigA8yMDAxMDQwNTE2MzMxN1qBDzIwMjEwNDA1MTcwMzE3WjALBgNVHQ8EBAMC
-AQYwHwYDVR0jBBgwFoAUbGQBx/2FbazI2p5QCIUItTxWqFAwHQYDVR0OBBYEFGxkAcf9hW2syNqe
-UAiFCLU8VqhQMAwGA1UdEwQFMAMBAf8wHQYJKoZIhvZ9B0EABBAwDhsIVjUuMDo0LjADAgSQMA0G
-CSqGSIb3DQEBBQUAA4IBAQBOQ8zR3R0QGwZ/t6T609lN+yOfI1Rb5osvBCiLtSdtiaHsmGnc540m
-gwV5dOy0uaOXwTUA/RXaOYE6lTGQ3pfphqiZdwzlWqCE/xIWrG64jcN7ksKsLtB9KOy282A4aW8+
-2ARVPp7MVdK6/rtHBNcK2RYKNCn1WBPVT8+PVkuzHu7TmHnaCB4Mb7j4Fifvwm899qNLPg7kbWzb
-O0ESm70NRyN/PErQr8Cv9u8btRXE64PECV90i9kR+8JWsTz4cMo0jUNAE4z9mQNUecYu6oah9jrU
-Cbz0vGbMPVjQV0kK7iXiQe4T+Zs4NNEA9X7nlB38aQNiuJkFBT1reBK9sG9l
------END CERTIFICATE-----
-
-TDC OCES Root CA
-================
------BEGIN CERTIFICATE-----
-MIIFGTCCBAGgAwIBAgIEPki9xDANBgkqhkiG9w0BAQUFADAxMQswCQYDVQQGEwJESzEMMAoGA1UE
-ChMDVERDMRQwEgYDVQQDEwtUREMgT0NFUyBDQTAeFw0wMzAyMTEwODM5MzBaFw0zNzAyMTEwOTA5
-MzBaMDExCzAJBgNVBAYTAkRLMQwwCgYDVQQKEwNUREMxFDASBgNVBAMTC1REQyBPQ0VTIENBMIIB
-IjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEArGL2YSCyz8DGhdfjeebM7fI5kqSXLmSjhFuH
-nEz9pPPEXyG9VhDr2y5h7JNp46PMvZnDBfwGuMo2HP6QjklMxFaaL1a8z3sM8W9Hpg1DTeLpHTk0
-zY0s2RKY+ePhwUp8hjjEqcRhiNJerxomTdXkoCJHhNlktxmW/OwZ5LKXJk5KTMuPJItUGBxIYXvV
-iGjaXbXqzRowwYCDdlCqT9HU3Tjw7xb04QxQBr/q+3pJoSgrHPb8FTKjdGqPqcNiKXEx5TukYBde
-dObaE+3pHx8b0bJoc8YQNHVGEBDjkAB2QMuLt0MJIf+rTpPGWOmlgtt3xDqZsXKVSQTwtyv6e1mO
-3QIDAQABo4ICNzCCAjMwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwgewGA1UdIASB
-5DCB4TCB3gYIKoFQgSkBAQEwgdEwLwYIKwYBBQUHAgEWI2h0dHA6Ly93d3cuY2VydGlmaWthdC5k
-ay9yZXBvc2l0b3J5MIGdBggrBgEFBQcCAjCBkDAKFgNUREMwAwIBARqBgUNlcnRpZmlrYXRlciBm
-cmEgZGVubmUgQ0EgdWRzdGVkZXMgdW5kZXIgT0lEIDEuMi4yMDguMTY5LjEuMS4xLiBDZXJ0aWZp
-Y2F0ZXMgZnJvbSB0aGlzIENBIGFyZSBpc3N1ZWQgdW5kZXIgT0lEIDEuMi4yMDguMTY5LjEuMS4x
-LjARBglghkgBhvhCAQEEBAMCAAcwgYEGA1UdHwR6MHgwSKBGoESkQjBAMQswCQYDVQQGEwJESzEM
-MAoGA1UEChMDVERDMRQwEgYDVQQDEwtUREMgT0NFUyBDQTENMAsGA1UEAxMEQ1JMMTAsoCqgKIYm
-aHR0cDovL2NybC5vY2VzLmNlcnRpZmlrYXQuZGsvb2Nlcy5jcmwwKwYDVR0QBCQwIoAPMjAwMzAy
-MTEwODM5MzBagQ8yMDM3MDIxMTA5MDkzMFowHwYDVR0jBBgwFoAUYLWF7FZkfhIZJ2cdUBVLc647
-+RIwHQYDVR0OBBYEFGC1hexWZH4SGSdnHVAVS3OuO/kSMB0GCSqGSIb2fQdBAAQQMA4bCFY2LjA6
-NC4wAwIEkDANBgkqhkiG9w0BAQUFAAOCAQEACromJkbTc6gJ82sLMJn9iuFXehHTuJTXCRBuo7E4
-A9G28kNBKWKnctj7fAXmMXAnVBhOinxO5dHKjHiIzxvTkIvmI/gLDjNDfZziChmPyQE+dF10yYsc
-A+UYyAFMP8uXBV2YcaaYb7Z8vTd/vuGTJW1v8AqtFxjhA7wHKcitJuj4YfD9IQl+mo6paH1IYnK9
-AOoBmbgGglGBTvH1tJFUuSN6AJqfXY3gPGS5GhKSKseCRHI53OI8xthV9RVOyAUO28bQYqbsFbS1
-AoLbrIyigfCbmTH1ICCoiGEKB5+U/NDXG8wuF/MEJ3Zn61SD/aSQfgY9BKNDLdr8C2LqL19iUw==
------END CERTIFICATE-----
-
-UTN DATACorp SGC Root CA
-========================
------BEGIN CERTIFICATE-----
-MIIEXjCCA0agAwIBAgIQRL4Mi1AAIbQR0ypoBqmtaTANBgkqhkiG9w0BAQUFADCBkzELMAkGA1UE
-BhMCVVMxCzAJBgNVBAgTAlVUMRcwFQYDVQQHEw5TYWx0IExha2UgQ2l0eTEeMBwGA1UEChMVVGhl
-IFVTRVJUUlVTVCBOZXR3b3JrMSEwHwYDVQQLExhodHRwOi8vd3d3LnVzZXJ0cnVzdC5jb20xGzAZ
-BgNVBAMTElVUTiAtIERBVEFDb3JwIFNHQzAeFw05OTA2MjQxODU3MjFaFw0xOTA2MjQxOTA2MzBa
-MIGTMQswCQYDVQQGEwJVUzELMAkGA1UECBMCVVQxFzAVBgNVBAcTDlNhbHQgTGFrZSBDaXR5MR4w
-HAYDVQQKExVUaGUgVVNFUlRSVVNUIE5ldHdvcmsxITAfBgNVBAsTGGh0dHA6Ly93d3cudXNlcnRy
-dXN0LmNvbTEbMBkGA1UEAxMSVVROIC0gREFUQUNvcnAgU0dDMIIBIjANBgkqhkiG9w0BAQEFAAOC
-AQ8AMIIBCgKCAQEA3+5YEKIrblXEjr8uRgnn4AgPLit6E5Qbvfa2gI5lBZMAHryv4g+OGQ0SR+ys
-raP6LnD43m77VkIVni5c7yPeIbkFdicZD0/Ww5y0vpQZY/KmEQrrU0icvvIpOxboGqBMpsn0GFlo
-wHDyUwDAXlCCpVZvNvlK4ESGoE1O1kduSUrLZ9emxAW5jh70/P/N5zbgnAVssjMiFdC04MwXwLLA
-9P4yPykqlXvY8qdOD1R8oQ2AswkDwf9c3V6aPryuvEeKaq5xyh+xKrhfQgUL7EYw0XILyulWbfXv
-33i+Ybqypa4ETLyorGkVl73v67SMvzX41MPRKA5cOp9wGDMgd8SirwIDAQABo4GrMIGoMAsGA1Ud
-DwQEAwIBxjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBRTMtGzz3/64PGgXYVOktKeRR20TzA9
-BgNVHR8ENjA0MDKgMKAuhixodHRwOi8vY3JsLnVzZXJ0cnVzdC5jb20vVVROLURBVEFDb3JwU0dD
-LmNybDAqBgNVHSUEIzAhBggrBgEFBQcDAQYKKwYBBAGCNwoDAwYJYIZIAYb4QgQBMA0GCSqGSIb3
-DQEBBQUAA4IBAQAnNZcAiosovcYzMB4p/OL31ZjUQLtgyr+rFywJNn9Q+kHcrpY6CiM+iVnJowft
-Gzet/Hy+UUla3joKVAgWRcKZsYfNjGjgaQPpxE6YsjuMFrMOoAyYUJuTqXAJyCyjj98C5OBxOvG0
-I3KgqgHf35g+FFCgMSa9KOlaMCZ1+XtgHI3zzVAmbQQnmt/VDUVHKWss5nbZqSl9Mt3JNjy9rjXx
-EZ4du5A/EkdOjtd+D2JzHVImOBwYSf0wdJrE5SIv2MCN7ZF6TACPcn9d2t0bi0Vr591pl6jFVkwP
-DPafepE39peC4N1xaf92P2BNPM/3mfnGV/TJVTl4uix5yaaIK/QI
------END CERTIFICATE-----
-
-UTN USERFirst Hardware Root CA
-==============================
------BEGIN CERTIFICATE-----
-MIIEdDCCA1ygAwIBAgIQRL4Mi1AAJLQR0zYq/mUK/TANBgkqhkiG9w0BAQUFADCBlzELMAkGA1UE
-BhMCVVMxCzAJBgNVBAgTAlVUMRcwFQYDVQQHEw5TYWx0IExha2UgQ2l0eTEeMBwGA1UEChMVVGhl
-IFVTRVJUUlVTVCBOZXR3b3JrMSEwHwYDVQQLExhodHRwOi8vd3d3LnVzZXJ0cnVzdC5jb20xHzAd
-BgNVBAMTFlVUTi1VU0VSRmlyc3QtSGFyZHdhcmUwHhcNOTkwNzA5MTgxMDQyWhcNMTkwNzA5MTgx
-OTIyWjCBlzELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAlVUMRcwFQYDVQQHEw5TYWx0IExha2UgQ2l0
-eTEeMBwGA1UEChMVVGhlIFVTRVJUUlVTVCBOZXR3b3JrMSEwHwYDVQQLExhodHRwOi8vd3d3LnVz
-ZXJ0cnVzdC5jb20xHzAdBgNVBAMTFlVUTi1VU0VSRmlyc3QtSGFyZHdhcmUwggEiMA0GCSqGSIb3
-DQEBAQUAA4IBDwAwggEKAoIBAQCx98M4P7Sof885glFn0G2f0v9Y8+efK+wNiVSZuTiZFvfgIXlI
-wrthdBKWHTxqctU8EGc6Oe0rE81m65UJM6Rsl7HoxuzBdXmcRl6Nq9Bq/bkqVRcQVLMZ8Jr28bFd
-tqdt++BxF2uiiPsA3/4aMXcMmgF6sTLjKwEHOG7DpV4jvEWbe1DByTCP2+UretNb+zNAHqDVmBe8
-i4fDidNdoI6yqqr2jmmIBsX6iSHzCJ1pLgkzmykNRg+MzEk0sGlRvfkGzWitZky8PqxhvQqIDsjf
-Pe58BEydCl5rkdbux+0ojatNh4lz0G6k0B4WixThdkQDf2Os5M1JnMWS9KsyoUhbAgMBAAGjgbkw
-gbYwCwYDVR0PBAQDAgHGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFKFyXyYbKJhDlV0HN9WF
-lp1L0sNFMEQGA1UdHwQ9MDswOaA3oDWGM2h0dHA6Ly9jcmwudXNlcnRydXN0LmNvbS9VVE4tVVNF
-UkZpcnN0LUhhcmR3YXJlLmNybDAxBgNVHSUEKjAoBggrBgEFBQcDAQYIKwYBBQUHAwUGCCsGAQUF
-BwMGBggrBgEFBQcDBzANBgkqhkiG9w0BAQUFAAOCAQEARxkP3nTGmZev/K0oXnWO6y1n7k57K9cM
-//bey1WiCuFMVGWTYGufEpytXoMs61quwOQt9ABjHbjAbPLPSbtNk28GpgoiskliCE7/yMgUsogW
-XecB5BKV5UU0s4tpvc+0hY91UZ59Ojg6FEgSxvunOxqNDYJAB+gECJChicsZUN/KHAG8HQQZexB2
-lzvukJDKxA4fFm517zP4029bHpbj4HR3dHuKom4t3XbWOTCC8KucUvIqx69JXn7HaOWCgchqJ/kn
-iCrVWFCVH/A7HFe7fRQ5YiuayZSSKqMiDP+JJn1fIytH1xUdqWqeUQ0qUZ6B+dQ7XnASfxAynB67
-nfhmqA==
------END CERTIFICATE-----
-
-Camerfirma Chambers of Commerce Root
-====================================
------BEGIN CERTIFICATE-----
-MIIEvTCCA6WgAwIBAgIBADANBgkqhkiG9w0BAQUFADB/MQswCQYDVQQGEwJFVTEnMCUGA1UEChMe
-QUMgQ2FtZXJmaXJtYSBTQSBDSUYgQTgyNzQzMjg3MSMwIQYDVQQLExpodHRwOi8vd3d3LmNoYW1i
-ZXJzaWduLm9yZzEiMCAGA1UEAxMZQ2hhbWJlcnMgb2YgQ29tbWVyY2UgUm9vdDAeFw0wMzA5MzAx
-NjEzNDNaFw0zNzA5MzAxNjEzNDRaMH8xCzAJBgNVBAYTAkVVMScwJQYDVQQKEx5BQyBDYW1lcmZp
-cm1hIFNBIENJRiBBODI3NDMyODcxIzAhBgNVBAsTGmh0dHA6Ly93d3cuY2hhbWJlcnNpZ24ub3Jn
-MSIwIAYDVQQDExlDaGFtYmVycyBvZiBDb21tZXJjZSBSb290MIIBIDANBgkqhkiG9w0BAQEFAAOC
-AQ0AMIIBCAKCAQEAtzZV5aVdGDDg2olUkfzIx1L4L1DZ77F1c2VHfRtbunXF/KGIJPov7coISjlU
-xFF6tdpg6jg8gbLL8bvZkSM/SAFwdakFKq0fcfPJVD0dBmpAPrMMhe5cG3nCYsS4No41XQEMIwRH
-NaqbYE6gZj3LJgqcQKH0XZi/caulAGgq7YN6D6IUtdQis4CwPAxaUWktWBiP7Zme8a7ileb2R6jW
-DA+wWFjbw2Y3npuRVDM30pQcakjJyfKl2qUMI/cjDpwyVV5xnIQFUZot/eZOKjRa3spAN2cMVCFV
-d9oKDMyXroDclDZK9D7ONhMeU+SsTjoF7Nuucpw4i9A5O4kKPnf+dQIBA6OCAUQwggFAMBIGA1Ud
-EwEB/wQIMAYBAf8CAQwwPAYDVR0fBDUwMzAxoC+gLYYraHR0cDovL2NybC5jaGFtYmVyc2lnbi5v
-cmcvY2hhbWJlcnNyb290LmNybDAdBgNVHQ4EFgQU45T1sU3p26EpW1eLTXYGduHRooowDgYDVR0P
-AQH/BAQDAgEGMBEGCWCGSAGG+EIBAQQEAwIABzAnBgNVHREEIDAegRxjaGFtYmVyc3Jvb3RAY2hh
-bWJlcnNpZ24ub3JnMCcGA1UdEgQgMB6BHGNoYW1iZXJzcm9vdEBjaGFtYmVyc2lnbi5vcmcwWAYD
-VR0gBFEwTzBNBgsrBgEEAYGHLgoDATA+MDwGCCsGAQUFBwIBFjBodHRwOi8vY3BzLmNoYW1iZXJz
-aWduLm9yZy9jcHMvY2hhbWJlcnNyb290Lmh0bWwwDQYJKoZIhvcNAQEFBQADggEBAAxBl8IahsAi
-fJ/7kPMa0QOx7xP5IV8EnNrJpY0nbJaHkb5BkAFyk+cefV/2icZdp0AJPaxJRUXcLo0waLIJuvvD
-L8y6C98/d3tGfToSJI6WjzwFCm/SlCgdbQzALogi1djPHRPH8EjX1wWnz8dHnjs8NMiAT9QUu/wN
-UPf6s+xCX6ndbcj0dc97wXImsQEcXCz9ek60AcUFV7nnPKoF2YjpB0ZBzu9Bga5Y34OirsrXdx/n
-ADydb47kMgkdTXg0eDQ8lJsm7U9xxhl6vSAiSFr+S30Dt+dYvsYyTnQeaN2oaFuzPu5ifdmA6Ap1
-erfutGWaIZDgqtCYvDi1czyL+Nw=
------END CERTIFICATE-----
-
-Camerfirma Global Chambersign Root
-==================================
------BEGIN CERTIFICATE-----
-MIIExTCCA62gAwIBAgIBADANBgkqhkiG9w0BAQUFADB9MQswCQYDVQQGEwJFVTEnMCUGA1UEChMe
-QUMgQ2FtZXJmaXJtYSBTQSBDSUYgQTgyNzQzMjg3MSMwIQYDVQQLExpodHRwOi8vd3d3LmNoYW1i
-ZXJzaWduLm9yZzEgMB4GA1UEAxMXR2xvYmFsIENoYW1iZXJzaWduIFJvb3QwHhcNMDMwOTMwMTYx
-NDE4WhcNMzcwOTMwMTYxNDE4WjB9MQswCQYDVQQGEwJFVTEnMCUGA1UEChMeQUMgQ2FtZXJmaXJt
-YSBTQSBDSUYgQTgyNzQzMjg3MSMwIQYDVQQLExpodHRwOi8vd3d3LmNoYW1iZXJzaWduLm9yZzEg
-MB4GA1UEAxMXR2xvYmFsIENoYW1iZXJzaWduIFJvb3QwggEgMA0GCSqGSIb3DQEBAQUAA4IBDQAw
-ggEIAoIBAQCicKLQn0KuWxfH2H3PFIP8T8mhtxOviteePgQKkotgVvq0Mi+ITaFgCPS3CU6gSS9J
-1tPfnZdan5QEcOw/Wdm3zGaLmFIoCQLfxS+EjXqXd7/sQJ0lcqu1PzKY+7e3/HKE5TWH+VX6ox8O
-by4o3Wmg2UIQxvi1RMLQQ3/bvOSiPGpVeAp3qdjqGTK3L/5cPxvusZjsyq16aUXjlg9V9ubtdepl
-6DJWk0aJqCWKZQbua795B9Dxt6/tLE2Su8CoX6dnfQTyFQhwrJLWfQTSM/tMtgsL+xrJxI0DqX5c
-8lCrEqWhz0hQpe/SyBoT+rB/sYIcd2oPX9wLlY/vQ37mRQklAgEDo4IBUDCCAUwwEgYDVR0TAQH/
-BAgwBgEB/wIBDDA/BgNVHR8EODA2MDSgMqAwhi5odHRwOi8vY3JsLmNoYW1iZXJzaWduLm9yZy9j
-aGFtYmVyc2lnbnJvb3QuY3JsMB0GA1UdDgQWBBRDnDafsJ4wTcbOX60Qq+UDpfqpFDAOBgNVHQ8B
-Af8EBAMCAQYwEQYJYIZIAYb4QgEBBAQDAgAHMCoGA1UdEQQjMCGBH2NoYW1iZXJzaWducm9vdEBj
-aGFtYmVyc2lnbi5vcmcwKgYDVR0SBCMwIYEfY2hhbWJlcnNpZ25yb290QGNoYW1iZXJzaWduLm9y
-ZzBbBgNVHSAEVDBSMFAGCysGAQQBgYcuCgEBMEEwPwYIKwYBBQUHAgEWM2h0dHA6Ly9jcHMuY2hh
-bWJlcnNpZ24ub3JnL2Nwcy9jaGFtYmVyc2lnbnJvb3QuaHRtbDANBgkqhkiG9w0BAQUFAAOCAQEA
-PDtwkfkEVCeR4e3t/mh/YV3lQWVPMvEYBZRqHN4fcNs+ezICNLUMbKGKfKX0j//U2K0X1S0E0T9Y
-gOKBWYi+wONGkyT+kL0mojAt6JcmVzWJdJYY9hXiryQZVgICsroPFOrGimbBhkVVi76SvpykBMdJ
-PJ7oKXqJ1/6v/2j1pReQvayZzKWGVwlnRtvWFsJG8eSpUPWP0ZIV018+xgBJOm5YstHRJw0lyDL4
-IBHNfTIzSJRUTN3cecQwn+uOuFW114hcxWokPbLTBQNRxgfvzBRydD1ucs4YKIxKoHflCStFREes
-t2d/AYoFWpO+ocH/+OcOZ6RHSXZddZAa9SaP8A==
------END CERTIFICATE-----
-
-NetLock Notary (Class A) Root
-=============================
------BEGIN CERTIFICATE-----
-MIIGfTCCBWWgAwIBAgICAQMwDQYJKoZIhvcNAQEEBQAwga8xCzAJBgNVBAYTAkhVMRAwDgYDVQQI
-EwdIdW5nYXJ5MREwDwYDVQQHEwhCdWRhcGVzdDEnMCUGA1UEChMeTmV0TG9jayBIYWxvemF0Yml6
-dG9uc2FnaSBLZnQuMRowGAYDVQQLExFUYW51c2l0dmFueWtpYWRvazE2MDQGA1UEAxMtTmV0TG9j
-ayBLb3pqZWd5em9pIChDbGFzcyBBKSBUYW51c2l0dmFueWtpYWRvMB4XDTk5MDIyNDIzMTQ0N1oX
-DTE5MDIxOTIzMTQ0N1owga8xCzAJBgNVBAYTAkhVMRAwDgYDVQQIEwdIdW5nYXJ5MREwDwYDVQQH
-EwhCdWRhcGVzdDEnMCUGA1UEChMeTmV0TG9jayBIYWxvemF0Yml6dG9uc2FnaSBLZnQuMRowGAYD
-VQQLExFUYW51c2l0dmFueWtpYWRvazE2MDQGA1UEAxMtTmV0TG9jayBLb3pqZWd5em9pIChDbGFz
-cyBBKSBUYW51c2l0dmFueWtpYWRvMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAvHSM
-D7tM9DceqQWC2ObhbHDqeLVu0ThEDaiDzl3S1tWBxdRL51uUcCbbO51qTGL3cfNk1mE7PetzozfZ
-z+qMkjvN9wfcZnSX9EUi3fRc4L9t875lM+QVOr/bmJBVOMTtplVjC7B4BPTjbsE/jvxReB+SnoPC
-/tmwqcm8WgD/qaiYdPv2LD4VOQ22BFWoDpggQrOxJa1+mm9dU7GrDPzr4PN6s6iz/0b2Y6LYOph7
-tqyF/7AlT3Rj5xMHpQqPBffAZG9+pyeAlt7ULoZgx2srXnN7F+eRP2QM2EsiNCubMvJIH5+hCoR6
-4sKtlz2O1cH5VqNQ6ca0+pii7pXmKgOM3wIDAQABo4ICnzCCApswDgYDVR0PAQH/BAQDAgAGMBIG
-A1UdEwEB/wQIMAYBAf8CAQQwEQYJYIZIAYb4QgEBBAQDAgAHMIICYAYJYIZIAYb4QgENBIICURaC
-Ak1GSUdZRUxFTSEgRXplbiB0YW51c2l0dmFueSBhIE5ldExvY2sgS2Z0LiBBbHRhbGFub3MgU3pv
-bGdhbHRhdGFzaSBGZWx0ZXRlbGVpYmVuIGxlaXJ0IGVsamFyYXNvayBhbGFwamFuIGtlc3p1bHQu
-IEEgaGl0ZWxlc2l0ZXMgZm9seWFtYXRhdCBhIE5ldExvY2sgS2Z0LiB0ZXJtZWtmZWxlbG9zc2Vn
-LWJpenRvc2l0YXNhIHZlZGkuIEEgZGlnaXRhbGlzIGFsYWlyYXMgZWxmb2dhZGFzYW5hayBmZWx0
-ZXRlbGUgYXogZWxvaXJ0IGVsbGVub3J6ZXNpIGVsamFyYXMgbWVndGV0ZWxlLiBBeiBlbGphcmFz
-IGxlaXJhc2EgbWVndGFsYWxoYXRvIGEgTmV0TG9jayBLZnQuIEludGVybmV0IGhvbmxhcGphbiBh
-IGh0dHBzOi8vd3d3Lm5ldGxvY2submV0L2RvY3MgY2ltZW4gdmFneSBrZXJoZXRvIGF6IGVsbGVu
-b3J6ZXNAbmV0bG9jay5uZXQgZS1tYWlsIGNpbWVuLiBJTVBPUlRBTlQhIFRoZSBpc3N1YW5jZSBh
-bmQgdGhlIHVzZSBvZiB0aGlzIGNlcnRpZmljYXRlIGlzIHN1YmplY3QgdG8gdGhlIE5ldExvY2sg
-Q1BTIGF2YWlsYWJsZSBhdCBodHRwczovL3d3dy5uZXRsb2NrLm5ldC9kb2NzIG9yIGJ5IGUtbWFp
-bCBhdCBjcHNAbmV0bG9jay5uZXQuMA0GCSqGSIb3DQEBBAUAA4IBAQBIJEb3ulZv+sgoA0BO5TE5
-ayZrU3/b39/zcT0mwBQOxmd7I6gMc90Bu8bKbjc5VdXHjFYgDigKDtIqpLBJUsY4B/6+CgmM0ZjP
-ytoUMaFP0jn8DxEsQ8Pdq5PHVT5HfBgaANzze9jyf1JsIPQLX2lS9O74silg6+NJMSEN1rUQQeJB
-CWziGppWS3cC9qCbmieH6FUpccKQn0V4GuEVZD3QDtigdp+uxdAu6tYPVuxkf1qbFFgBJ34TUMdr
-KuZoPL9coAob4Q566eKAw+np9v1sEZ7Q5SgnK1QyQhSCdeZK8CtmdWOMovsEPoMOmzbwGOQmIMOM
-8CgHrTwXZoi1/baI
------END CERTIFICATE-----
-
-NetLock Business (Class B) Root
-===============================
------BEGIN CERTIFICATE-----
-MIIFSzCCBLSgAwIBAgIBaTANBgkqhkiG9w0BAQQFADCBmTELMAkGA1UEBhMCSFUxETAPBgNVBAcT
-CEJ1ZGFwZXN0MScwJQYDVQQKEx5OZXRMb2NrIEhhbG96YXRiaXp0b25zYWdpIEtmdC4xGjAYBgNV
-BAsTEVRhbnVzaXR2YW55a2lhZG9rMTIwMAYDVQQDEylOZXRMb2NrIFV6bGV0aSAoQ2xhc3MgQikg
-VGFudXNpdHZhbnlraWFkbzAeFw05OTAyMjUxNDEwMjJaFw0xOTAyMjAxNDEwMjJaMIGZMQswCQYD
-VQQGEwJIVTERMA8GA1UEBxMIQnVkYXBlc3QxJzAlBgNVBAoTHk5ldExvY2sgSGFsb3phdGJpenRv
-bnNhZ2kgS2Z0LjEaMBgGA1UECxMRVGFudXNpdHZhbnlraWFkb2sxMjAwBgNVBAMTKU5ldExvY2sg
-VXpsZXRpIChDbGFzcyBCKSBUYW51c2l0dmFueWtpYWRvMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCB
-iQKBgQCx6gTsIKAjwo84YM/HRrPVG/77uZmeBNwcf4xKgZjupNTKihe5In+DCnVMm8Bp2GQ5o+2S
-o/1bXHQawEfKOml2mrriRBf8TKPV/riXiK+IA4kfpPIEPsgHC+b5sy96YhQJRhTKZPWLgLViqNhr
-1nGTLbO/CVRY7QbrqHvcQ7GhaQIDAQABo4ICnzCCApswEgYDVR0TAQH/BAgwBgEB/wIBBDAOBgNV
-HQ8BAf8EBAMCAAYwEQYJYIZIAYb4QgEBBAQDAgAHMIICYAYJYIZIAYb4QgENBIICURaCAk1GSUdZ
-RUxFTSEgRXplbiB0YW51c2l0dmFueSBhIE5ldExvY2sgS2Z0LiBBbHRhbGFub3MgU3pvbGdhbHRh
-dGFzaSBGZWx0ZXRlbGVpYmVuIGxlaXJ0IGVsamFyYXNvayBhbGFwamFuIGtlc3p1bHQuIEEgaGl0
-ZWxlc2l0ZXMgZm9seWFtYXRhdCBhIE5ldExvY2sgS2Z0LiB0ZXJtZWtmZWxlbG9zc2VnLWJpenRv
-c2l0YXNhIHZlZGkuIEEgZGlnaXRhbGlzIGFsYWlyYXMgZWxmb2dhZGFzYW5hayBmZWx0ZXRlbGUg
-YXogZWxvaXJ0IGVsbGVub3J6ZXNpIGVsamFyYXMgbWVndGV0ZWxlLiBBeiBlbGphcmFzIGxlaXJh
-c2EgbWVndGFsYWxoYXRvIGEgTmV0TG9jayBLZnQuIEludGVybmV0IGhvbmxhcGphbiBhIGh0dHBz
-Oi8vd3d3Lm5ldGxvY2submV0L2RvY3MgY2ltZW4gdmFneSBrZXJoZXRvIGF6IGVsbGVub3J6ZXNA
-bmV0bG9jay5uZXQgZS1tYWlsIGNpbWVuLiBJTVBPUlRBTlQhIFRoZSBpc3N1YW5jZSBhbmQgdGhl
-IHVzZSBvZiB0aGlzIGNlcnRpZmljYXRlIGlzIHN1YmplY3QgdG8gdGhlIE5ldExvY2sgQ1BTIGF2
-YWlsYWJsZSBhdCBodHRwczovL3d3dy5uZXRsb2NrLm5ldC9kb2NzIG9yIGJ5IGUtbWFpbCBhdCBj
-cHNAbmV0bG9jay5uZXQuMA0GCSqGSIb3DQEBBAUAA4GBAATbrowXr/gOkDFOzT4JwG06sPgzTEdM
-43WIEJessDgVkcYplswhwG08pXTP2IKlOcNl40JwuyKQ433bNXbhoLXan3BukxowOR0w2y7jfLKR
-stE3Kfq51hdcR0/jHTjrn9V7lagonhVK0dHQKwCXoOKSNitjrFgBazMpUIaD8QFI
------END CERTIFICATE-----
-
-NetLock Express (Class C) Root
-==============================
------BEGIN CERTIFICATE-----
-MIIFTzCCBLigAwIBAgIBaDANBgkqhkiG9w0BAQQFADCBmzELMAkGA1UEBhMCSFUxETAPBgNVBAcT
-CEJ1ZGFwZXN0MScwJQYDVQQKEx5OZXRMb2NrIEhhbG96YXRiaXp0b25zYWdpIEtmdC4xGjAYBgNV
-BAsTEVRhbnVzaXR2YW55a2lhZG9rMTQwMgYDVQQDEytOZXRMb2NrIEV4cHJlc3N6IChDbGFzcyBD
-KSBUYW51c2l0dmFueWtpYWRvMB4XDTk5MDIyNTE0MDgxMVoXDTE5MDIyMDE0MDgxMVowgZsxCzAJ
-BgNVBAYTAkhVMREwDwYDVQQHEwhCdWRhcGVzdDEnMCUGA1UEChMeTmV0TG9jayBIYWxvemF0Yml6
-dG9uc2FnaSBLZnQuMRowGAYDVQQLExFUYW51c2l0dmFueWtpYWRvazE0MDIGA1UEAxMrTmV0TG9j
-ayBFeHByZXNzeiAoQ2xhc3MgQykgVGFudXNpdHZhbnlraWFkbzCBnzANBgkqhkiG9w0BAQEFAAOB
-jQAwgYkCgYEA6+ywbGGKIyWvYCDj2Z/8kwvbXY2wobNAOoLO/XXgeDIDhlqGlZHtU/qdQPzm6N3Z
-W3oDvV3zOwzDUXmbrVWg6dADEK8KuhRC2VImESLH0iDMgqSaqf64gXadarfSNnU+sYYJ9m5tfk63
-euyucYT2BDMIJTLrdKwWRMbkQJMdf60CAwEAAaOCAp8wggKbMBIGA1UdEwEB/wQIMAYBAf8CAQQw
-DgYDVR0PAQH/BAQDAgAGMBEGCWCGSAGG+EIBAQQEAwIABzCCAmAGCWCGSAGG+EIBDQSCAlEWggJN
-RklHWUVMRU0hIEV6ZW4gdGFudXNpdHZhbnkgYSBOZXRMb2NrIEtmdC4gQWx0YWxhbm9zIFN6b2xn
-YWx0YXRhc2kgRmVsdGV0ZWxlaWJlbiBsZWlydCBlbGphcmFzb2sgYWxhcGphbiBrZXN6dWx0LiBB
-IGhpdGVsZXNpdGVzIGZvbHlhbWF0YXQgYSBOZXRMb2NrIEtmdC4gdGVybWVrZmVsZWxvc3NlZy1i
-aXp0b3NpdGFzYSB2ZWRpLiBBIGRpZ2l0YWxpcyBhbGFpcmFzIGVsZm9nYWRhc2FuYWsgZmVsdGV0
-ZWxlIGF6IGVsb2lydCBlbGxlbm9yemVzaSBlbGphcmFzIG1lZ3RldGVsZS4gQXogZWxqYXJhcyBs
-ZWlyYXNhIG1lZ3RhbGFsaGF0byBhIE5ldExvY2sgS2Z0LiBJbnRlcm5ldCBob25sYXBqYW4gYSBo
-dHRwczovL3d3dy5uZXRsb2NrLm5ldC9kb2NzIGNpbWVuIHZhZ3kga2VyaGV0byBheiBlbGxlbm9y
-emVzQG5ldGxvY2submV0IGUtbWFpbCBjaW1lbi4gSU1QT1JUQU5UISBUaGUgaXNzdWFuY2UgYW5k
-IHRoZSB1c2Ugb2YgdGhpcyBjZXJ0aWZpY2F0ZSBpcyBzdWJqZWN0IHRvIHRoZSBOZXRMb2NrIENQ
-UyBhdmFpbGFibGUgYXQgaHR0cHM6Ly93d3cubmV0bG9jay5uZXQvZG9jcyBvciBieSBlLW1haWwg
-YXQgY3BzQG5ldGxvY2submV0LjANBgkqhkiG9w0BAQQFAAOBgQAQrX/XDDKACtiG8XmYta3UzbM2
-xJZIwVzNmtkFLp++UOv0JhQQLdRmF/iewSf98e3ke0ugbLWrmldwpu2gpO0u9f38vf5NNwgMvOOW
-gyL1SRt/Syu0VMGAfJlOHdCM7tCs5ZL6dVb+ZKATj7i4Fp1hBWeAyNDYpQcCNJgEjTME1A==
------END CERTIFICATE-----
-
-XRamp Global CA Root
-====================
------BEGIN CERTIFICATE-----
-MIIEMDCCAxigAwIBAgIQUJRs7Bjq1ZxN1ZfvdY+grTANBgkqhkiG9w0BAQUFADCBgjELMAkGA1UE
-BhMCVVMxHjAcBgNVBAsTFXd3dy54cmFtcHNlY3VyaXR5LmNvbTEkMCIGA1UEChMbWFJhbXAgU2Vj
-dXJpdHkgU2VydmljZXMgSW5jMS0wKwYDVQQDEyRYUmFtcCBHbG9iYWwgQ2VydGlmaWNhdGlvbiBB
-dXRob3JpdHkwHhcNMDQxMTAxMTcxNDA0WhcNMzUwMTAxMDUzNzE5WjCBgjELMAkGA1UEBhMCVVMx
-HjAcBgNVBAsTFXd3dy54cmFtcHNlY3VyaXR5LmNvbTEkMCIGA1UEChMbWFJhbXAgU2VjdXJpdHkg
-U2VydmljZXMgSW5jMS0wKwYDVQQDEyRYUmFtcCBHbG9iYWwgQ2VydGlmaWNhdGlvbiBBdXRob3Jp
-dHkwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCYJB69FbS638eMpSe2OAtp87ZOqCwu
-IR1cRN8hXX4jdP5efrRKt6atH67gBhbim1vZZ3RrXYCPKZ2GG9mcDZhtdhAoWORlsH9KmHmf4MMx
-foArtYzAQDsRhtDLooY2YKTVMIJt2W7QDxIEM5dfT2Fa8OT5kavnHTu86M/0ay00fOJIYRyO82FE
-zG+gSqmUsE3a56k0enI4qEHMPJQRfevIpoy3hsvKMzvZPTeL+3o+hiznc9cKV6xkmxnr9A8ECIqs
-AxcZZPRaJSKNNCyy9mgdEm3Tih4U2sSPpuIjhdV6Db1q4Ons7Be7QhtnqiXtRYMh/MHJfNViPvry
-xS3T/dRlAgMBAAGjgZ8wgZwwEwYJKwYBBAGCNxQCBAYeBABDAEEwCwYDVR0PBAQDAgGGMA8GA1Ud
-EwEB/wQFMAMBAf8wHQYDVR0OBBYEFMZPoj0GY4QJnM5i5ASsjVy16bYbMDYGA1UdHwQvMC0wK6Ap
-oCeGJWh0dHA6Ly9jcmwueHJhbXBzZWN1cml0eS5jb20vWEdDQS5jcmwwEAYJKwYBBAGCNxUBBAMC
-AQEwDQYJKoZIhvcNAQEFBQADggEBAJEVOQMBG2f7Shz5CmBbodpNl2L5JFMn14JkTpAuw0kbK5rc
-/Kh4ZzXxHfARvbdI4xD2Dd8/0sm2qlWkSLoC295ZLhVbO50WfUfXN+pfTXYSNrsf16GBBEYgoyxt
-qZ4Bfj8pzgCT3/3JknOJiWSe5yvkHJEs0rnOfc5vMZnT5r7SHpDwCRR5XCOrTdLaIR9NmXmd4c8n
-nxCbHIgNsIpkQTG4DmyQJKSbXHGPurt+HBvbaoAPIbzp26a3QPSyi6mx5O+aGtA9aZnuqCij4Tyz
-8LIRnM98QObd50N9otg6tamN8jSZxNQQ4Qb9CYQQO+7ETPTsJ3xCwnR8gooJybQDJbw=
------END CERTIFICATE-----
-
-Go Daddy Class 2 CA
-===================
------BEGIN CERTIFICATE-----
-MIIEADCCAuigAwIBAgIBADANBgkqhkiG9w0BAQUFADBjMQswCQYDVQQGEwJVUzEhMB8GA1UEChMY
-VGhlIEdvIERhZGR5IEdyb3VwLCBJbmMuMTEwLwYDVQQLEyhHbyBEYWRkeSBDbGFzcyAyIENlcnRp
-ZmljYXRpb24gQXV0aG9yaXR5MB4XDTA0MDYyOTE3MDYyMFoXDTM0MDYyOTE3MDYyMFowYzELMAkG
-A1UEBhMCVVMxITAfBgNVBAoTGFRoZSBHbyBEYWRkeSBHcm91cCwgSW5jLjExMC8GA1UECxMoR28g
-RGFkZHkgQ2xhc3MgMiBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTCCASAwDQYJKoZIhvcNAQEBBQAD
-ggENADCCAQgCggEBAN6d1+pXGEmhW+vXX0iG6r7d/+TvZxz0ZWizV3GgXne77ZtJ6XCAPVYYYwhv
-2vLM0D9/AlQiVBDYsoHUwHU9S3/Hd8M+eKsaA7Ugay9qK7HFiH7Eux6wwdhFJ2+qN1j3hybX2C32
-qRe3H3I2TqYXP2WYktsqbl2i/ojgC95/5Y0V4evLOtXiEqITLdiOr18SPaAIBQi2XKVlOARFmR6j
-YGB0xUGlcmIbYsUfb18aQr4CUWWoriMYavx4A6lNf4DD+qta/KFApMoZFv6yyO9ecw3ud72a9nmY
-vLEHZ6IVDd2gWMZEewo+YihfukEHU1jPEX44dMX4/7VpkI+EdOqXG68CAQOjgcAwgb0wHQYDVR0O
-BBYEFNLEsNKR1EwRcbNhyz2h/t2oatTjMIGNBgNVHSMEgYUwgYKAFNLEsNKR1EwRcbNhyz2h/t2o
-atTjoWekZTBjMQswCQYDVQQGEwJVUzEhMB8GA1UEChMYVGhlIEdvIERhZGR5IEdyb3VwLCBJbmMu
-MTEwLwYDVQQLEyhHbyBEYWRkeSBDbGFzcyAyIENlcnRpZmljYXRpb24gQXV0aG9yaXR5ggEAMAwG
-A1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEFBQADggEBADJL87LKPpH8EsahB4yOd6AzBhRckB4Y9wim
-PQoZ+YeAEW5p5JYXMP80kWNyOO7MHAGjHZQopDH2esRU1/blMVgDoszOYtuURXO1v0XJJLXVggKt
-I3lpjbi2Tc7PTMozI+gciKqdi0FuFskg5YmezTvacPd+mSYgFFQlq25zheabIZ0KbIIOqPjCDPoQ
-HmyW74cNxA9hi63ugyuV+I6ShHI56yDqg+2DzZduCLzrTia2cyvk0/ZM/iZx4mERdEr/VxqHD3VI
-Ls9RaRegAhJhldXRQLIQTO7ErBBDpqWeCtWVYpoNz4iCxTIM5CufReYNnyicsbkqWletNw+vHX/b
-vZ8=
------END CERTIFICATE-----
-
-Starfield Class 2 CA
-====================
------BEGIN CERTIFICATE-----
-MIIEDzCCAvegAwIBAgIBADANBgkqhkiG9w0BAQUFADBoMQswCQYDVQQGEwJVUzElMCMGA1UEChMc
-U3RhcmZpZWxkIFRlY2hub2xvZ2llcywgSW5jLjEyMDAGA1UECxMpU3RhcmZpZWxkIENsYXNzIDIg
-Q2VydGlmaWNhdGlvbiBBdXRob3JpdHkwHhcNMDQwNjI5MTczOTE2WhcNMzQwNjI5MTczOTE2WjBo
-MQswCQYDVQQGEwJVUzElMCMGA1UEChMcU3RhcmZpZWxkIFRlY2hub2xvZ2llcywgSW5jLjEyMDAG
-A1UECxMpU3RhcmZpZWxkIENsYXNzIDIgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwggEgMA0GCSqG
-SIb3DQEBAQUAA4IBDQAwggEIAoIBAQC3Msj+6XGmBIWtDBFk385N78gDGIc/oav7PKaf8MOh2tTY
-bitTkPskpD6E8J7oX+zlJ0T1KKY/e97gKvDIr1MvnsoFAZMej2YcOadN+lq2cwQlZut3f+dZxkqZ
-JRRU6ybH838Z1TBwj6+wRir/resp7defqgSHo9T5iaU0X9tDkYI22WY8sbi5gv2cOj4QyDvvBmVm
-epsZGD3/cVE8MC5fvj13c7JdBmzDI1aaK4UmkhynArPkPw2vCHmCuDY96pzTNbO8acr1zJ3o/WSN
-F4Azbl5KXZnJHoe0nRrA1W4TNSNe35tfPe/W93bC6j67eA0cQmdrBNj41tpvi/JEoAGrAgEDo4HF
-MIHCMB0GA1UdDgQWBBS/X7fRzt0fhvRbVazc1xDCDqmI5zCBkgYDVR0jBIGKMIGHgBS/X7fRzt0f
-hvRbVazc1xDCDqmI56FspGowaDELMAkGA1UEBhMCVVMxJTAjBgNVBAoTHFN0YXJmaWVsZCBUZWNo
-bm9sb2dpZXMsIEluYy4xMjAwBgNVBAsTKVN0YXJmaWVsZCBDbGFzcyAyIENlcnRpZmljYXRpb24g
-QXV0aG9yaXR5ggEAMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEFBQADggEBAAWdP4id0ckaVaGs
-afPzWdqbAYcaT1epoXkJKtv3L7IezMdeatiDh6GX70k1PncGQVhiv45YuApnP+yz3SFmH8lU+nLM
-PUxA2IGvd56Deruix/U0F47ZEUD0/CwqTRV/p2JdLiXTAAsgGh1o+Re49L2L7ShZ3U0WixeDyLJl
-xy16paq8U4Zt3VekyvggQQto8PT7dL5WXXp59fkdheMtlb71cZBDzI0fmgAKhynpVSJYACPq4xJD
-KVtHCN2MQWplBqjlIapBtJUhlbl90TSrE9atvNziPTnNvT51cKEYWQPJIrSPnNVeKtelttQKbfi3
-QBFGmh95DmK/D5fs4C8fF5Q=
------END CERTIFICATE-----
-
-StartCom Certification Authority
-================================
------BEGIN CERTIFICATE-----
-MIIHyTCCBbGgAwIBAgIBATANBgkqhkiG9w0BAQUFADB9MQswCQYDVQQGEwJJTDEWMBQGA1UEChMN
-U3RhcnRDb20gTHRkLjErMCkGA1UECxMiU2VjdXJlIERpZ2l0YWwgQ2VydGlmaWNhdGUgU2lnbmlu
-ZzEpMCcGA1UEAxMgU3RhcnRDb20gQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwHhcNMDYwOTE3MTk0
-NjM2WhcNMzYwOTE3MTk0NjM2WjB9MQswCQYDVQQGEwJJTDEWMBQGA1UEChMNU3RhcnRDb20gTHRk
-LjErMCkGA1UECxMiU2VjdXJlIERpZ2l0YWwgQ2VydGlmaWNhdGUgU2lnbmluZzEpMCcGA1UEAxMg
-U3RhcnRDb20gQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAw
-ggIKAoICAQDBiNsJvGxGfHiflXu1M5DycmLWwTYgIiRezul38kMKogZkpMyONvg45iPwbm2xPN1y
-o4UcodM9tDMr0y+v/uqwQVlntsQGfQqedIXWeUyAN3rfOQVSWff0G0ZDpNKFhdLDcfN1YjS6LIp/
-Ho/u7TTQEceWzVI9ujPW3U3eCztKS5/CJi/6tRYccjV3yjxd5srhJosaNnZcAdt0FCX+7bWgiA/d
-eMotHweXMAEtcnn6RtYTKqi5pquDSR3l8u/d5AGOGAqPY1MWhWKpDhk6zLVmpsJrdAfkK+F2PrRt
-2PZE4XNiHzvEvqBTViVsUQn3qqvKv3b9bZvzndu/PWa8DFaqr5hIlTpL36dYUNk4dalb6kMMAv+Z
-6+hsTXBbKWWc3apdzK8BMewM69KN6Oqce+Zu9ydmDBpI125C4z/eIT574Q1w+2OqqGwaVLRcJXrJ
-osmLFqa7LH4XXgVNWG4SHQHuEhANxjJ/GP/89PrNbpHoNkm+Gkhpi8KWTRoSsmkXwQqQ1vp5Iki/
-untp+HDH+no32NgN0nZPV/+Qt+OR0t3vwmC3Zzrd/qqc8NSLf3Iizsafl7b4r4qgEKjZ+xjGtrVc
-UjyJthkqcwEKDwOzEmDyei+B26Nu/yYwl/WL3YlXtq09s68rxbd2AvCl1iuahhQqcvbjM4xdCUsT
-37uMdBNSSwIDAQABo4ICUjCCAk4wDAYDVR0TBAUwAwEB/zALBgNVHQ8EBAMCAa4wHQYDVR0OBBYE
-FE4L7xqkQFulF2mHMMo0aEPQQa7yMGQGA1UdHwRdMFswLKAqoCiGJmh0dHA6Ly9jZXJ0LnN0YXJ0
-Y29tLm9yZy9zZnNjYS1jcmwuY3JsMCugKaAnhiVodHRwOi8vY3JsLnN0YXJ0Y29tLm9yZy9zZnNj
-YS1jcmwuY3JsMIIBXQYDVR0gBIIBVDCCAVAwggFMBgsrBgEEAYG1NwEBATCCATswLwYIKwYBBQUH
-AgEWI2h0dHA6Ly9jZXJ0LnN0YXJ0Y29tLm9yZy9wb2xpY3kucGRmMDUGCCsGAQUFBwIBFilodHRw
-Oi8vY2VydC5zdGFydGNvbS5vcmcvaW50ZXJtZWRpYXRlLnBkZjCB0AYIKwYBBQUHAgIwgcMwJxYg
-U3RhcnQgQ29tbWVyY2lhbCAoU3RhcnRDb20pIEx0ZC4wAwIBARqBl0xpbWl0ZWQgTGlhYmlsaXR5
-LCByZWFkIHRoZSBzZWN0aW9uICpMZWdhbCBMaW1pdGF0aW9ucyogb2YgdGhlIFN0YXJ0Q29tIENl
-cnRpZmljYXRpb24gQXV0aG9yaXR5IFBvbGljeSBhdmFpbGFibGUgYXQgaHR0cDovL2NlcnQuc3Rh
-cnRjb20ub3JnL3BvbGljeS5wZGYwEQYJYIZIAYb4QgEBBAQDAgAHMDgGCWCGSAGG+EIBDQQrFilT
-dGFydENvbSBGcmVlIFNTTCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTANBgkqhkiG9w0BAQUFAAOC
-AgEAFmyZ9GYMNPXQhV59CuzaEE44HF7fpiUFS5Eyweg78T3dRAlbB0mKKctmArexmvclmAk8jhvh
-3TaHK0u7aNM5Zj2gJsfyOZEdUauCe37Vzlrk4gNXcGmXCPleWKYK34wGmkUWFjgKXlf2Ysd6AgXm
-vB618p70qSmD+LIU424oh0TDkBreOKk8rENNZEXO3SipXPJzewT4F+irsfMuXGRuczE6Eri8sxHk
-fY+BUZo7jYn0TZNmezwD7dOaHZrzZVD1oNB1ny+v8OqCQ5j4aZyJecRDjkZy42Q2Eq/3JR44iZB3
-fsNrarnDy0RLrHiQi+fHLB5LEUTINFInzQpdn4XBidUaePKVEFMy3YCEZnXZtWgo+2EuvoSoOMCZ
-EoalHmdkrQYuL6lwhceWD3yJZfWOQ1QOq92lgDmUYMA0yZZwLKMS9R9Ie70cfmu3nZD0Ijuu+Pwq
-yvqCUqDvr0tVk+vBtfAii6w0TiYiBKGHLHVKt+V9E9e4DGTANtLJL4YSjCMJwRuCO3NJo2pXh5Tl
-1njFmUNj403gdy3hZZlyaQQaRwnmDwFWJPsfvw55qVguucQJAX6Vum0ABj6y6koQOdjQK/W/7HW/
-lwLFCRsI3FU34oH7N4RDYiDK51ZLZer+bMEkkyShNOsF/5oirpt9P/FlUQqmMGqz9IgcgA38coro
-g14=
------END CERTIFICATE-----
-
-Taiwan GRCA
-===========
------BEGIN CERTIFICATE-----
-MIIFcjCCA1qgAwIBAgIQH51ZWtcvwgZEpYAIaeNe9jANBgkqhkiG9w0BAQUFADA/MQswCQYDVQQG
-EwJUVzEwMC4GA1UECgwnR292ZXJubWVudCBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MB4X
-DTAyMTIwNTEzMjMzM1oXDTMyMTIwNTEzMjMzM1owPzELMAkGA1UEBhMCVFcxMDAuBgNVBAoMJ0dv
-dmVybm1lbnQgUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTCCAiIwDQYJKoZIhvcNAQEBBQAD
-ggIPADCCAgoCggIBAJoluOzMonWoe/fOW1mKydGGEghU7Jzy50b2iPN86aXfTEc2pBsBHH8eV4qN
-w8XRIePaJD9IK/ufLqGU5ywck9G/GwGHU5nOp/UKIXZ3/6m3xnOUT0b3EEk3+qhZSV1qgQdW8or5
-BtD3cCJNtLdBuTK4sfCxw5w/cP1T3YGq2GN49thTbqGsaoQkclSGxtKyyhwOeYHWtXBiCAEuTk8O
-1RGvqa/lmr/czIdtJuTJV6L7lvnM4T9TjGxMfptTCAtsF/tnyMKtsc2AtJfcdgEWFelq16TheEfO
-htX7MfP6Mb40qij7cEwdScevLJ1tZqa2jWR+tSBqnTuBto9AAGdLiYa4zGX+FVPpBMHWXx1E1wov
-J5pGfaENda1UhhXcSTvxls4Pm6Dso3pdvtUqdULle96ltqqvKKyskKw4t9VoNSZ63Pc78/1Fm9G7
-Q3hub/FCVGqY8A2tl+lSXunVanLeavcbYBT0peS2cWeqH+riTcFCQP5nRhc4L0c/cZyu5SHKYS1t
-B6iEfC3uUSXxY5Ce/eFXiGvviiNtsea9P63RPZYLhY3Naye7twWb7LuRqQoHEgKXTiCQ8P8NHuJB
-O9NAOueNXdpm5AKwB1KYXA6OM5zCppX7VRluTI6uSw+9wThNXo+EHWbNxWCWtFJaBYmOlXqYwZE8
-lSOyDvR5tMl8wUohAgMBAAGjajBoMB0GA1UdDgQWBBTMzO/MKWCkO7GStjz6MmKPrCUVOzAMBgNV
-HRMEBTADAQH/MDkGBGcqBwAEMTAvMC0CAQAwCQYFKw4DAhoFADAHBgVnKgMAAAQUA5vwIhP/lSg2
-09yewDL7MTqKUWUwDQYJKoZIhvcNAQEFBQADggIBAECASvomyc5eMN1PhnR2WPWus4MzeKR6dBcZ
-TulStbngCnRiqmjKeKBMmo4sIy7VahIkv9Ro04rQ2JyftB8M3jh+Vzj8jeJPXgyfqzvS/3WXy6Tj
-Zwj/5cAWtUgBfen5Cv8b5Wppv3ghqMKnI6mGq3ZW6A4M9hPdKmaKZEk9GhiHkASfQlK3T8v+R0F2
-Ne//AHY2RTKbxkaFXeIksB7jSJaYV0eUVXoPQbFEJPPB/hprv4j9wabak2BegUqZIJxIZhm1AHlU
-D7gsL0u8qV1bYH+Mh6XgUmMqvtg7hUAV/h62ZT/FS9p+tXo1KaMuephgIqP0fSdOLeq0dDzpD6Qz
-DxARvBMB1uUO07+1EqLhRSPAzAhuYbeJq4PjJB7mXQfnHyA+z2fI56wwbSdLaG5LKlwCCDTb+Hbk
-Z6MmnD+iMsJKxYEYMRBWqoTvLQr/uB930r+lWKBi5NdLkXWNiYCYfm3LU05er/ayl4WXudpVBrkk
-7tfGOB5jGxI7leFYrPLfhNVfmS8NVVvmONsuP3LpSIXLuykTjx44VbnzssQwmSNOXfJIoRIM3BKQ
-CZBUkQM8R+XVyWXgt0t97EfTsws+rZ7QdAAO671RrcDeLMDDav7v3Aun+kbfYNucpllQdSNpc5Oy
-+fwC00fmcc4QAu4njIT/rEUNE1yDMuAlpYYsfPQS
------END CERTIFICATE-----
-
-Firmaprofesional Root CA
-========================
------BEGIN CERTIFICATE-----
-MIIEVzCCAz+gAwIBAgIBATANBgkqhkiG9w0BAQUFADCBnTELMAkGA1UEBhMCRVMxIjAgBgNVBAcT
-GUMvIE11bnRhbmVyIDI0NCBCYXJjZWxvbmExQjBABgNVBAMTOUF1dG9yaWRhZCBkZSBDZXJ0aWZp
-Y2FjaW9uIEZpcm1hcHJvZmVzaW9uYWwgQ0lGIEE2MjYzNDA2ODEmMCQGCSqGSIb3DQEJARYXY2FA
-ZmlybWFwcm9mZXNpb25hbC5jb20wHhcNMDExMDI0MjIwMDAwWhcNMTMxMDI0MjIwMDAwWjCBnTEL
-MAkGA1UEBhMCRVMxIjAgBgNVBAcTGUMvIE11bnRhbmVyIDI0NCBCYXJjZWxvbmExQjBABgNVBAMT
-OUF1dG9yaWRhZCBkZSBDZXJ0aWZpY2FjaW9uIEZpcm1hcHJvZmVzaW9uYWwgQ0lGIEE2MjYzNDA2
-ODEmMCQGCSqGSIb3DQEJARYXY2FAZmlybWFwcm9mZXNpb25hbC5jb20wggEiMA0GCSqGSIb3DQEB
-AQUAA4IBDwAwggEKAoIBAQDnIwNvbyOlXnjOlSztlB5uCp4Bx+ow0Syd3Tfom5h5VtP8c9/Qit5V
-j1H5WuretXDE7aTt/6MNbg9kUDGvASdYrv5sp0ovFy3Tc9UTHI9ZpTQsHVQERc1ouKDAA6XPhUJH
-lShbz++AbOCQl4oBPB3zhxAwJkh91/zpnZFx/0GaqUC1N5wpIE8fUuOgfRNtVLcK3ulqTgesrBlf
-3H5idPayBQC6haD9HThuy1q7hryUZzM1gywfI834yJFxzJeL764P3CkDG8A563DtwW4O2GcLiam8
-NeTvtjS0pbbELaW+0MOUJEjb35bTALVmGotmBQ/dPz/LP6pemkr4tErvlTcbAgMBAAGjgZ8wgZww
-KgYDVR0RBCMwIYYfaHR0cDovL3d3dy5maXJtYXByb2Zlc2lvbmFsLmNvbTASBgNVHRMBAf8ECDAG
-AQH/AgEBMCsGA1UdEAQkMCKADzIwMDExMDI0MjIwMDAwWoEPMjAxMzEwMjQyMjAwMDBaMA4GA1Ud
-DwEB/wQEAwIBBjAdBgNVHQ4EFgQUMwugZtHq2s7eYpMEKFK1FH84aLcwDQYJKoZIhvcNAQEFBQAD
-ggEBAEdz/o0nVPD11HecJ3lXV7cVVuzH2Fi3AQL0M+2TUIiefEaxvT8Ub/GzR0iLjJcG1+p+o1wq
-u00vR+L4OQbJnC4xGgN49Lw4xiKLMzHwFgQEffl25EvXwOaD7FnMP97/T2u3Z36mhoEyIwOdyPdf
-wUpgpZKpsaSgYMN4h7Mi8yrrW6ntBas3D7Hi05V2Y1Z0jFhyGzflZKG+TQyTmAyX9odtsz/ny4Cm
-7YjHX1BiAuiZdBbQ5rQ58SfLyEDW44YQqSMSkuBpQWOnryULwMWSyx6Yo1q6xTMPoJcB3X/ge9YG
-VM+h4k0460tQtcsm9MracEpqoeJ5quGnM/b9Sh/22WA=
------END CERTIFICATE-----
-
-Wells Fargo Root CA
-===================
------BEGIN CERTIFICATE-----
-MIID5TCCAs2gAwIBAgIEOeSXnjANBgkqhkiG9w0BAQUFADCBgjELMAkGA1UEBhMCVVMxFDASBgNV
-BAoTC1dlbGxzIEZhcmdvMSwwKgYDVQQLEyNXZWxscyBGYXJnbyBDZXJ0aWZpY2F0aW9uIEF1dGhv
-cml0eTEvMC0GA1UEAxMmV2VsbHMgRmFyZ28gUm9vdCBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkwHhcN
-MDAxMDExMTY0MTI4WhcNMjEwMTE0MTY0MTI4WjCBgjELMAkGA1UEBhMCVVMxFDASBgNVBAoTC1dl
-bGxzIEZhcmdvMSwwKgYDVQQLEyNXZWxscyBGYXJnbyBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTEv
-MC0GA1UEAxMmV2VsbHMgRmFyZ28gUm9vdCBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkwggEiMA0GCSqG
-SIb3DQEBAQUAA4IBDwAwggEKAoIBAQDVqDM7Jvk0/82bfuUER84A4n135zHCLielTWi5MbqNQ1mX
-x3Oqfz1cQJ4F5aHiidlMuD+b+Qy0yGIZLEWukR5zcUHESxP9cMIlrCL1dQu3U+SlK93OvRw6esP3
-E48mVJwWa2uv+9iWsWCaSOAlIiR5NM4OJgALTqv9i86C1y8IcGjBqAr5dE8Hq6T54oN+J3N0Prj5
-OEL8pahbSCOz6+MlsoCultQKnMJ4msZoGK43YjdeUXWoWGPAUe5AeH6orxqg4bB4nVCMe+ez/I4j
-sNtlAHCEAQgAFG5Uhpq6zPk3EPbg3oQtnaSFN9OH4xXQwReQfhkhahKpdv0SAulPIV4XAgMBAAGj
-YTBfMA8GA1UdEwEB/wQFMAMBAf8wTAYDVR0gBEUwQzBBBgtghkgBhvt7hwcBCzAyMDAGCCsGAQUF
-BwIBFiRodHRwOi8vd3d3LndlbGxzZmFyZ28uY29tL2NlcnRwb2xpY3kwDQYJKoZIhvcNAQEFBQAD
-ggEBANIn3ZwKdyu7IvICtUpKkfnRLb7kuxpo7w6kAOnu5+/u9vnldKTC2FJYxHT7zmu1Oyl5GFrv
-m+0fazbuSCUlFLZWohDo7qd/0D+j0MNdJu4HzMPBJCGHHt8qElNvQRbn7a6U+oxy+hNH8Dx+rn0R
-OhPs7fpvcmR7nX1/Jv16+yWt6j4pf0zjAFcysLPp7VMX2YuyFA4w6OXVE8Zkr8QA1dhYJPz1j+zx
-x32l2w8n0cbyQIjmH/ZhqPRCyLk306m+LFZ4wnKbWV01QIroTmMatukgalHizqSQ33ZwmVxwQ023
-tqcZZE6St8WRPH9IFmV7Fv3L/PvZ1dZPIWU7Sn9Ho/s=
------END CERTIFICATE-----
-
-Swisscom Root CA 1
-==================
------BEGIN CERTIFICATE-----
-MIIF2TCCA8GgAwIBAgIQXAuFXAvnWUHfV8w/f52oNjANBgkqhkiG9w0BAQUFADBkMQswCQYDVQQG
-EwJjaDERMA8GA1UEChMIU3dpc3Njb20xJTAjBgNVBAsTHERpZ2l0YWwgQ2VydGlmaWNhdGUgU2Vy
-dmljZXMxGzAZBgNVBAMTElN3aXNzY29tIFJvb3QgQ0EgMTAeFw0wNTA4MTgxMjA2MjBaFw0yNTA4
-MTgyMjA2MjBaMGQxCzAJBgNVBAYTAmNoMREwDwYDVQQKEwhTd2lzc2NvbTElMCMGA1UECxMcRGln
-aXRhbCBDZXJ0aWZpY2F0ZSBTZXJ2aWNlczEbMBkGA1UEAxMSU3dpc3Njb20gUm9vdCBDQSAxMIIC
-IjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA0LmwqAzZuz8h+BvVM5OAFmUgdbI9m2BtRsiM
-MW8Xw/qabFbtPMWRV8PNq5ZJkCoZSx6jbVfd8StiKHVFXqrWW/oLJdihFvkcxC7mlSpnzNApbjyF
-NDhhSbEAn9Y6cV9Nbc5fuankiX9qUvrKm/LcqfmdmUc/TilftKaNXXsLmREDA/7n29uj/x2lzZAe
-AR81sH8A25Bvxn570e56eqeqDFdvpG3FEzuwpdntMhy0XmeLVNxzh+XTF3xmUHJd1BpYwdnP2IkC
-b6dJtDZd0KTeByy2dbcokdaXvij1mB7qWybJvbCXc9qukSbraMH5ORXWZ0sKbU/Lz7DkQnGMU3nn
-7uHbHaBuHYwadzVcFh4rUx80i9Fs/PJnB3r1re3WmquhsUvhzDdf/X/NTa64H5xD+SpYVUNFvJbN
-cA78yeNmuk6NO4HLFWR7uZToXTNShXEuT46iBhFRyePLoW4xCGQMwtI89Tbo19AOeCMgkckkKmUp
-WyL3Ic6DXqTz3kvTaI9GdVyDCW4pa8RwjPWd1yAv/0bSKzjCL3UcPX7ape8eYIVpQtPM+GP+HkM5
-haa2Y0EQs3MevNP6yn0WR+Kn1dCjigoIlmJWbjTb2QK5MHXjBNLnj8KwEUAKrNVxAmKLMb7dxiNY
-MUJDLXT5xp6mig/p/r+D5kNXJLrvRjSq1xIBOO0CAwEAAaOBhjCBgzAOBgNVHQ8BAf8EBAMCAYYw
-HQYDVR0hBBYwFDASBgdghXQBUwABBgdghXQBUwABMBIGA1UdEwEB/wQIMAYBAf8CAQcwHwYDVR0j
-BBgwFoAUAyUv3m+CATpcLNwroWm1Z9SM0/0wHQYDVR0OBBYEFAMlL95vggE6XCzcK6FptWfUjNP9
-MA0GCSqGSIb3DQEBBQUAA4ICAQA1EMvspgQNDQ/NwNurqPKIlwzfky9NfEBWMXrrpA9gzXrzvsMn
-jgM+pN0S734edAY8PzHyHHuRMSG08NBsl9Tpl7IkVh5WwzW9iAUPWxAaZOHHgjD5Mq2eUCzneAXQ
-MbFamIp1TpBcahQq4FJHgmDmHtqBsfsUC1rxn9KVuj7QG9YVHaO+htXbD8BJZLsuUBlL0iT43R4H
-VtA4oJVwIHaM190e3p9xxCPvgxNcoyQVTSlAPGrEqdi3pkSlDfTgnXceQHAm/NrZNuR55LU/vJtl
-vrsRls/bxig5OgjOR1tTWsWZ/l2p3e9M1MalrQLmjAcSHm8D0W+go/MpvRLHUKKwf4ipmXeascCl
-OS5cfGniLLDqN2qk4Vrh9VDlg++luyqI54zb/W1elxmofmZ1a3Hqv7HHb6D0jqTsNFFbjCYDcKF3
-1QESVwA12yPeDooomf2xEG9L/zgtYE4snOtnta1J7ksfrK/7DZBaZmBwXarNeNQk7shBoJMBkpxq
-nvy5JMWzFYJ+vq6VK+uxwNrjAWALXmmshFZhvnEX/h0TD/7Gh0Xp/jKgGg0TpJRVcaUWi7rKibCy
-x/yP2FS1k2Kdzs9Z+z0YzirLNRWCXf9UIltxUvu3yf5gmwBBZPCqKuy2QkPOiWaByIufOVQDJdMW
-NY6E0F/6MBr1mmz0DlP5OlvRHA==
------END CERTIFICATE-----
-
-DigiCert Assured ID Root CA
-===========================
------BEGIN CERTIFICATE-----
-MIIDtzCCAp+gAwIBAgIQDOfg5RfYRv6P5WD8G/AwOTANBgkqhkiG9w0BAQUFADBlMQswCQYDVQQG
-EwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSQw
-IgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgQ0EwHhcNMDYxMTEwMDAwMDAwWhcNMzEx
-MTEwMDAwMDAwWjBlMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQL
-ExB3d3cuZGlnaWNlcnQuY29tMSQwIgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgQ0Ew
-ggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCtDhXO5EOAXLGH87dg+XESpa7cJpSIqvTO
-9SA5KFhgDPiA2qkVlTJhPLWxKISKityfCgyDF3qPkKyK53lTXDGEKvYPmDI2dsze3Tyoou9q+yHy
-UmHfnyDXH+Kx2f4YZNISW1/5WBg1vEfNoTb5a3/UsDg+wRvDjDPZ2C8Y/igPs6eD1sNuRMBhNZYW
-/lmci3Zt1/GiSw0r/wty2p5g0I6QNcZ4VYcgoc/lbQrISXwxmDNsIumH0DJaoroTghHtORedmTpy
-oeb6pNnVFzF1roV9Iq4/AUaG9ih5yLHa5FcXxH4cDrC0kqZWs72yl+2qp/C3xag/lRbQ/6GW6whf
-GHdPAgMBAAGjYzBhMA4GA1UdDwEB/wQEAwIBhjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBRF
-66Kv9JLLgjEtUYunpyGd823IDzAfBgNVHSMEGDAWgBRF66Kv9JLLgjEtUYunpyGd823IDzANBgkq
-hkiG9w0BAQUFAAOCAQEAog683+Lt8ONyc3pklL/3cmbYMuRCdWKuh+vy1dneVrOfzM4UKLkNl2Bc
-EkxY5NM9g0lFWJc1aRqoR+pWxnmrEthngYTffwk8lOa4JiwgvT2zKIn3X/8i4peEH+ll74fg38Fn
-SbNd67IJKusm7Xi+fT8r87cmNW1fiQG2SVufAQWbqz0lwcy2f8Lxb4bG+mRo64EtlOtCt/qMHt1i
-8b5QZ7dsvfPxH2sMNgcWfzd8qVttevESRmCD1ycEvkvOl77DZypoEd+A5wwzZr8TDRRu838fYxAe
-+o0bJW1sj6W3YQGx0qMmoRBxna3iw/nDmVG3KwcIzi7mULKn+gpFL6Lw8g==
------END CERTIFICATE-----
-
-DigiCert Global Root CA
-=======================
------BEGIN CERTIFICATE-----
-MIIDrzCCApegAwIBAgIQCDvgVpBCRrGhdWrJWZHHSjANBgkqhkiG9w0BAQUFADBhMQswCQYDVQQG
-EwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSAw
-HgYDVQQDExdEaWdpQ2VydCBHbG9iYWwgUm9vdCBDQTAeFw0wNjExMTAwMDAwMDBaFw0zMTExMTAw
-MDAwMDBaMGExCzAJBgNVBAYTAlVTMRUwEwYDVQQKEwxEaWdpQ2VydCBJbmMxGTAXBgNVBAsTEHd3
-dy5kaWdpY2VydC5jb20xIDAeBgNVBAMTF0RpZ2lDZXJ0IEdsb2JhbCBSb290IENBMIIBIjANBgkq
-hkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA4jvhEXLeqKTTo1eqUKKPC3eQyaKl7hLOllsBCSDMAZOn
-TjC3U/dDxGkAV53ijSLdhwZAAIEJzs4bg7/fzTtxRuLWZscFs3YnFo97nh6Vfe63SKMI2tavegw5
-BmV/Sl0fvBf4q77uKNd0f3p4mVmFaG5cIzJLv07A6Fpt43C/dxC//AH2hdmoRBBYMql1GNXRor5H
-4idq9Joz+EkIYIvUX7Q6hL+hqkpMfT7PT19sdl6gSzeRntwi5m3OFBqOasv+zbMUZBfHWymeMr/y
-7vrTC0LUq7dBMtoM1O/4gdW7jVg/tRvoSSiicNoxBN33shbyTApOB6jtSj1etX+jkMOvJwIDAQAB
-o2MwYTAOBgNVHQ8BAf8EBAMCAYYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUA95QNVbRTLtm
-8KPiGxvDl7I90VUwHwYDVR0jBBgwFoAUA95QNVbRTLtm8KPiGxvDl7I90VUwDQYJKoZIhvcNAQEF
-BQADggEBAMucN6pIExIK+t1EnE9SsPTfrgT1eXkIoyQY/EsrhMAtudXH/vTBH1jLuG2cenTnmCmr
-EbXjcKChzUyImZOMkXDiqw8cvpOp/2PV5Adg06O/nVsJ8dWO41P0jmP6P6fbtGbfYmbW0W5BjfIt
-tep3Sp+dWOIrWcBAI+0tKIJFPnlUkiaY4IBIqDfv8NZ5YBberOgOzW6sRBc4L0na4UU+Krk2U886
-UAb3LujEV0lsYSEY1QSteDwsOoBrp+uvFRTp2InBuThs4pFsiv9kuXclVzDAGySj4dzp30d8tbQk
-CAUw7C29C79Fv1C5qfPrmAESrciIxpg0X40KPMbp1ZWVbd4=
------END CERTIFICATE-----
-
-DigiCert High Assurance EV Root CA
-==================================
------BEGIN CERTIFICATE-----
-MIIDxTCCAq2gAwIBAgIQAqxcJmoLQJuPC3nyrkYldzANBgkqhkiG9w0BAQUFADBsMQswCQYDVQQG
-EwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSsw
-KQYDVQQDEyJEaWdpQ2VydCBIaWdoIEFzc3VyYW5jZSBFViBSb290IENBMB4XDTA2MTExMDAwMDAw
-MFoXDTMxMTExMDAwMDAwMFowbDELMAkGA1UEBhMCVVMxFTATBgNVBAoTDERpZ2lDZXJ0IEluYzEZ
-MBcGA1UECxMQd3d3LmRpZ2ljZXJ0LmNvbTErMCkGA1UEAxMiRGlnaUNlcnQgSGlnaCBBc3N1cmFu
-Y2UgRVYgUm9vdCBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMbM5XPm+9S75S0t
-Mqbf5YE/yc0lSbZxKsPVlDRnogocsF9ppkCxxLeyj9CYpKlBWTrT3JTWPNt0OKRKzE0lgvdKpVMS
-OO7zSW1xkX5jtqumX8OkhPhPYlG++MXs2ziS4wblCJEMxChBVfvLWokVfnHoNb9Ncgk9vjo4UFt3
-MRuNs8ckRZqnrG0AFFoEt7oT61EKmEFBIk5lYYeBQVCmeVyJ3hlKV9Uu5l0cUyx+mM0aBhakaHPQ
-NAQTXKFx01p8VdteZOE3hzBWBOURtCmAEvF5OYiiAhF8J2a3iLd48soKqDirCmTCv2ZdlYTBoSUe
-h10aUAsgEsxBu24LUTi4S8sCAwEAAaNjMGEwDgYDVR0PAQH/BAQDAgGGMA8GA1UdEwEB/wQFMAMB
-Af8wHQYDVR0OBBYEFLE+w2kD+L9HAdSYJhoIAu9jZCvDMB8GA1UdIwQYMBaAFLE+w2kD+L9HAdSY
-JhoIAu9jZCvDMA0GCSqGSIb3DQEBBQUAA4IBAQAcGgaX3NecnzyIZgYIVyHbIUf4KmeqvxgydkAQ
-V8GK83rZEWWONfqe/EW1ntlMMUu4kehDLI6zeM7b41N5cdblIZQB2lWHmiRk9opmzN6cN82oNLFp
-myPInngiK3BD41VHMWEZ71jFhS9OMPagMRYjyOfiZRYzy78aG6A9+MpeizGLYAiJLQwGXFK3xPkK
-mNEVX58Svnw2Yzi9RKR/5CYrCsSXaQ3pjOLAEFe4yHYSkVXySGnYvCoCWw9E1CAx2/S6cCZdkGCe
-vEsXCS+0yx5DaMkHJ8HSXPfqIbloEpw8nL+e/IBcm2PN7EeqJSdnoDfzAIJ9VNep+OkuE6N36B9K
------END CERTIFICATE-----
-
-Certplus Class 2 Primary CA
-===========================
------BEGIN CERTIFICATE-----
-MIIDkjCCAnqgAwIBAgIRAIW9S/PY2uNp9pTXX8OlRCMwDQYJKoZIhvcNAQEFBQAwPTELMAkGA1UE
-BhMCRlIxETAPBgNVBAoTCENlcnRwbHVzMRswGQYDVQQDExJDbGFzcyAyIFByaW1hcnkgQ0EwHhcN
-OTkwNzA3MTcwNTAwWhcNMTkwNzA2MjM1OTU5WjA9MQswCQYDVQQGEwJGUjERMA8GA1UEChMIQ2Vy
-dHBsdXMxGzAZBgNVBAMTEkNsYXNzIDIgUHJpbWFyeSBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEP
-ADCCAQoCggEBANxQltAS+DXSCHh6tlJw/W/uz7kRy1134ezpfgSN1sxvc0NXYKwzCkTsA18cgCSR
-5aiRVhKC9+Ar9NuuYS6JEI1rbLqzAr3VNsVINyPi8Fo3UjMXEuLRYE2+L0ER4/YXJQyLkcAbmXuZ
-Vg2v7tK8R1fjeUl7NIknJITesezpWE7+Tt9avkGtrAjFGA7v0lPubNCdEgETjdyAYveVqUSISnFO
-YFWe2yMZeVYHDD9jC1yw4r5+FfyUM1hBOHTE4Y+L3yasH7WLO7dDWWuwJKZtkIvEcupdM5i3y95e
-e++U8Rs+yskhwcWYAqqi9lt3m/V+llU0HGdpwPFC40es/CgcZlUCAwEAAaOBjDCBiTAPBgNVHRME
-CDAGAQH/AgEKMAsGA1UdDwQEAwIBBjAdBgNVHQ4EFgQU43Mt38sOKAze3bOkynm4jrvoMIkwEQYJ
-YIZIAYb4QgEBBAQDAgEGMDcGA1UdHwQwMC4wLKAqoCiGJmh0dHA6Ly93d3cuY2VydHBsdXMuY29t
-L0NSTC9jbGFzczIuY3JsMA0GCSqGSIb3DQEBBQUAA4IBAQCnVM+IRBnL39R/AN9WM2K191EBkOvD
-P9GIROkkXe/nFL0gt5o8AP5tn9uQ3Nf0YtaLcF3n5QRIqWh8yfFC82x/xXp8HVGIutIKPidd3i1R
-TtMTZGnkLuPT55sJmabglZvOGtd/vjzOUrMRFcEPF80Du5wlFbqidon8BvEY0JNLDnyCt6X09l/+
-7UCmnYR0ObncHoUW2ikbhiMAybuJfm6AiB4vFLQDJKgybwOaRywwvlbGp0ICcBvqQNi6BQNwB6SW
-//1IMwrh3KWBkJtN3X3n57LNXMhqlfil9o3EXXgIvnsG1knPGTZQIy4I5p4FTUcY1Rbpsda2ENW7
-l7+ijrRU
------END CERTIFICATE-----
-
-DST Root CA X3
-==============
------BEGIN CERTIFICATE-----
-MIIDSjCCAjKgAwIBAgIQRK+wgNajJ7qJMDmGLvhAazANBgkqhkiG9w0BAQUFADA/MSQwIgYDVQQK
-ExtEaWdpdGFsIFNpZ25hdHVyZSBUcnVzdCBDby4xFzAVBgNVBAMTDkRTVCBSb290IENBIFgzMB4X
-DTAwMDkzMDIxMTIxOVoXDTIxMDkzMDE0MDExNVowPzEkMCIGA1UEChMbRGlnaXRhbCBTaWduYXR1
-cmUgVHJ1c3QgQ28uMRcwFQYDVQQDEw5EU1QgUm9vdCBDQSBYMzCCASIwDQYJKoZIhvcNAQEBBQAD
-ggEPADCCAQoCggEBAN+v6ZdQCINXtMxiZfaQguzH0yxrMMpb7NnDfcdAwRgUi+DoM3ZJKuM/IUmT
-rE4Orz5Iy2Xu/NMhD2XSKtkyj4zl93ewEnu1lcCJo6m67XMuegwGMoOifooUMM0RoOEqOLl5CjH9
-UL2AZd+3UWODyOKIYepLYYHsUmu5ouJLGiifSKOeDNoJjj4XLh7dIN9bxiqKqy69cK3FCxolkHRy
-xXtqqzTWMIn/5WgTe1QLyNau7Fqckh49ZLOMxt+/yUFw7BZy1SbsOFU5Q9D8/RhcQPGX69Wam40d
-utolucbY38EVAjqr2m7xPi71XAicPNaDaeQQmxkqtilX4+U9m5/wAl0CAwEAAaNCMEAwDwYDVR0T
-AQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFMSnsaR7LHH62+FLkHX/xBVghYkQ
-MA0GCSqGSIb3DQEBBQUAA4IBAQCjGiybFwBcqR7uKGY3Or+Dxz9LwwmglSBd49lZRNI+DT69ikug
-dB/OEIKcdBodfpga3csTS7MgROSR6cz8faXbauX+5v3gTt23ADq1cEmv8uXrAvHRAosZy5Q6XkjE
-GB5YGV8eAlrwDPGxrancWYaLbumR9YbK+rlmM6pZW87ipxZzR8srzJmwN0jP41ZL9c8PDHIyh8bw
-RLtTcm1D9SZImlJnt1ir/md2cXjbDaJWFBM5JDGFoqgCWjBH4d1QB7wCCZAA62RjYJsWvIjJEubS
-fZGL+T0yjWW06XyxV3bqxbYoOb8VZRzI9neWagqNdwvYkQsEjgfbKbYK7p2CNTUQ
------END CERTIFICATE-----
-
-DST ACES CA X6
-==============
------BEGIN CERTIFICATE-----
-MIIECTCCAvGgAwIBAgIQDV6ZCtadt3js2AdWO4YV2TANBgkqhkiG9w0BAQUFADBbMQswCQYDVQQG
-EwJVUzEgMB4GA1UEChMXRGlnaXRhbCBTaWduYXR1cmUgVHJ1c3QxETAPBgNVBAsTCERTVCBBQ0VT
-MRcwFQYDVQQDEw5EU1QgQUNFUyBDQSBYNjAeFw0wMzExMjAyMTE5NThaFw0xNzExMjAyMTE5NTha
-MFsxCzAJBgNVBAYTAlVTMSAwHgYDVQQKExdEaWdpdGFsIFNpZ25hdHVyZSBUcnVzdDERMA8GA1UE
-CxMIRFNUIEFDRVMxFzAVBgNVBAMTDkRTVCBBQ0VTIENBIFg2MIIBIjANBgkqhkiG9w0BAQEFAAOC
-AQ8AMIIBCgKCAQEAuT31LMmU3HWKlV1j6IR3dma5WZFcRt2SPp/5DgO0PWGSvSMmtWPuktKe1jzI
-DZBfZIGxqAgNTNj50wUoUrQBJcWVHAx+PhCEdc/BGZFjz+iokYi5Q1K7gLFViYsx+tC3dr5BPTCa
-pCIlF3PoHuLTrCq9Wzgh1SpL11V94zpVvddtawJXa+ZHfAjIgrrep4c9oW24MFbCswKBXy314pow
-GCi4ZtPLAZZv6opFVdbgnf9nKxcCpk4aahELfrd755jWjHZvwTvbUJN+5dCOHze4vbrGn2zpfDPy
-MjwmR/onJALJfh1biEITajV8fTXpLmaRcpPVMibEdPVTo7NdmvYJywIDAQABo4HIMIHFMA8GA1Ud
-EwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgHGMB8GA1UdEQQYMBaBFHBraS1vcHNAdHJ1c3Rkc3Qu
-Y29tMGIGA1UdIARbMFkwVwYKYIZIAWUDAgEBATBJMEcGCCsGAQUFBwIBFjtodHRwOi8vd3d3LnRy
-dXN0ZHN0LmNvbS9jZXJ0aWZpY2F0ZXMvcG9saWN5L0FDRVMtaW5kZXguaHRtbDAdBgNVHQ4EFgQU
-CXIGThhDD+XWzMNqizF7eI+og7gwDQYJKoZIhvcNAQEFBQADggEBAKPYjtay284F5zLNAdMEA+V2
-5FYrnJmQ6AgwbN99Pe7lv7UkQIRJ4dEorsTCOlMwiPH1d25Ryvr/ma8kXxug/fKshMrfqfBfBC6t
-Fr8hlxCBPeP/h40y3JTlR4peahPJlJU90u7INJXQgNStMgiAVDzgvVJT11J8smk/f3rPanTK+gQq
-nExaBqXpIK1FZg9p8d2/6eMyi/rgwYZNcjwu2JN4Cir42NInPRmJX1p7ijvMDNpRrscL9yuwNwXs
-vFcj4jjSm2jzVhKIT0J8uDHEtdvkyCE06UgRNe76x5JXxZ805Mf29w4LTJxoeHtxMcfrHuBnQfO3
-oKfN5XozNmr6mis=
------END CERTIFICATE-----
-
-TURKTRUST Certificate Services Provider Root 1
-==============================================
------BEGIN CERTIFICATE-----
-MIID+zCCAuOgAwIBAgIBATANBgkqhkiG9w0BAQUFADCBtzE/MD0GA1UEAww2VMOcUktUUlVTVCBF
-bGVrdHJvbmlrIFNlcnRpZmlrYSBIaXptZXQgU2HEn2xhecSxY8Sxc8SxMQswCQYDVQQGDAJUUjEP
-MA0GA1UEBwwGQU5LQVJBMVYwVAYDVQQKDE0oYykgMjAwNSBUw5xSS1RSVVNUIEJpbGdpIMSwbGV0
-acWfaW0gdmUgQmlsacWfaW0gR8O8dmVubGnEn2kgSGl6bWV0bGVyaSBBLsWeLjAeFw0wNTA1MTMx
-MDI3MTdaFw0xNTAzMjIxMDI3MTdaMIG3MT8wPQYDVQQDDDZUw5xSS1RSVVNUIEVsZWt0cm9uaWsg
-U2VydGlmaWthIEhpem1ldCBTYcSfbGF5xLFjxLFzxLExCzAJBgNVBAYMAlRSMQ8wDQYDVQQHDAZB
-TktBUkExVjBUBgNVBAoMTShjKSAyMDA1IFTDnFJLVFJVU1QgQmlsZ2kgxLBsZXRpxZ9pbSB2ZSBC
-aWxpxZ9pbSBHw7x2ZW5sacSfaSBIaXptZXRsZXJpIEEuxZ4uMIIBIjANBgkqhkiG9w0BAQEFAAOC
-AQ8AMIIBCgKCAQEAylIF1mMD2Bxf3dJ7XfIMYGFbazt0K3gNfUW9InTojAPBxhEqPZW8qZSwu5GX
-yGl8hMW0kWxsE2qkVa2kheiVfrMArwDCBRj1cJ02i67L5BuBf5OI+2pVu32Fks66WJ/bMsW9Xe8i
-Si9BB35JYbOG7E6mQW6EvAPs9TscyB/C7qju6hJKjRTP8wrgUDn5CDX4EVmt5yLqS8oUBt5CurKZ
-8y1UiBAG6uEaPj1nH/vO+3yC6BFdSsG5FOpU2WabfIl9BJpiyelSPJ6c79L1JuTm5Rh8i27fbMx4
-W09ysstcP4wFjdFMjK2Sx+F4f2VsSQZQLJ4ywtdKxnWKWU51b0dewQIDAQABoxAwDjAMBgNVHRME
-BTADAQH/MA0GCSqGSIb3DQEBBQUAA4IBAQAV9VX/N5aAWSGk/KEVTCD21F/aAyT8z5Aa9CEKmu46
-sWrv7/hg0Uw2ZkUd82YCdAR7kjCo3gp2D++Vbr3JN+YaDayJSFvMgzbC9UZcWYJWtNX+I7TYVBxE
-q8Sn5RTOPEFhfEPmzcSBCYsk+1Ql1haolgxnB2+zUEfjHCQo3SqYpGH+2+oSN7wBGjSFvW5P55Fy
-B0SFHljKVETd96y5y4khctuPwGkplyqjrhgjlxxBKot8KsF8kOipKMDTkcatKIdAaLX/7KfS0zgY
-nNN9aV3wxqUeJBujR/xpB2jn5Jq07Q+hh4cCzofSSE7hvP/L8XKSRGQDJereW26fyfJOrN3H
------END CERTIFICATE-----
-
-TURKTRUST Certificate Services Provider Root 2
-==============================================
------BEGIN CERTIFICATE-----
-MIIEPDCCAySgAwIBAgIBATANBgkqhkiG9w0BAQUFADCBvjE/MD0GA1UEAww2VMOcUktUUlVTVCBF
-bGVrdHJvbmlrIFNlcnRpZmlrYSBIaXptZXQgU2HEn2xhecSxY8Sxc8SxMQswCQYDVQQGEwJUUjEP
-MA0GA1UEBwwGQW5rYXJhMV0wWwYDVQQKDFRUw5xSS1RSVVNUIEJpbGdpIMSwbGV0acWfaW0gdmUg
-QmlsacWfaW0gR8O8dmVubGnEn2kgSGl6bWV0bGVyaSBBLsWeLiAoYykgS2FzxLFtIDIwMDUwHhcN
-MDUxMTA3MTAwNzU3WhcNMTUwOTE2MTAwNzU3WjCBvjE/MD0GA1UEAww2VMOcUktUUlVTVCBFbGVr
-dHJvbmlrIFNlcnRpZmlrYSBIaXptZXQgU2HEn2xhecSxY8Sxc8SxMQswCQYDVQQGEwJUUjEPMA0G
-A1UEBwwGQW5rYXJhMV0wWwYDVQQKDFRUw5xSS1RSVVNUIEJpbGdpIMSwbGV0acWfaW0gdmUgQmls
-acWfaW0gR8O8dmVubGnEn2kgSGl6bWV0bGVyaSBBLsWeLiAoYykgS2FzxLFtIDIwMDUwggEiMA0G
-CSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCpNn7DkUNMwxmYCMjHWHtPFoylzkkBH3MOrHUTpvqe
-LCDe2JAOCtFp0if7qnefJ1Il4std2NiDUBd9irWCPwSOtNXwSadktx4uXyCcUHVPr+G1QRT0mJKI
-x+XlZEdhR3n9wFHxwZnn3M5q+6+1ATDcRhzviuyV79z/rxAc653YsKpqhRgNF8k+v/Gb0AmJQv2g
-QrSdiVFVKc8bcLyEVK3BEx+Y9C52YItdP5qtygy/p1Zbj3e41Z55SZI/4PGXJHpsmxcPbe9TmJEr
-5A++WXkHeLuXlfSfadRYhwqp48y2WBmfJiGxxFmNskF1wK1pzpwACPI2/z7woQ8arBT9pmAPAgMB
-AAGjQzBBMB0GA1UdDgQWBBTZN7NOBf3Zz58SFq62iS/rJTqIHDAPBgNVHQ8BAf8EBQMDBwYAMA8G
-A1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQEFBQADggEBAHJglrfJ3NgpXiOFX7KzLXb7iNcX/ntt
-Rbj2hWyfIvwqECLsqrkw9qtY1jkQMZkpAL2JZkH7dN6RwRgLn7Vhy506vvWolKMiVW4XSf/SKfE4
-Jl3vpao6+XF75tpYHdN0wgH6PmlYX63LaL4ULptswLbcoCb6dxriJNoaN+BnrdFzgw2lGh1uEpJ+
-hGIAF728JRhX8tepb1mIvDS3LoV4nZbcFMMsilKbloxSZj2GFotHuFEJjOp9zYhys2AzsfAKRO8P
-9Qk3iCQOLGsgOqL6EfJANZxEaGM7rDNvY7wsu/LSy3Z9fYjYHcgFHW68lKlmjHdxx/qR+i9Rnuk5
-UrbnBEI=
------END CERTIFICATE-----
-
-SwissSign Gold CA - G2
-======================
------BEGIN CERTIFICATE-----
-MIIFujCCA6KgAwIBAgIJALtAHEP1Xk+wMA0GCSqGSIb3DQEBBQUAMEUxCzAJBgNVBAYTAkNIMRUw
-EwYDVQQKEwxTd2lzc1NpZ24gQUcxHzAdBgNVBAMTFlN3aXNzU2lnbiBHb2xkIENBIC0gRzIwHhcN
-MDYxMDI1MDgzMDM1WhcNMzYxMDI1MDgzMDM1WjBFMQswCQYDVQQGEwJDSDEVMBMGA1UEChMMU3dp
-c3NTaWduIEFHMR8wHQYDVQQDExZTd2lzc1NpZ24gR29sZCBDQSAtIEcyMIICIjANBgkqhkiG9w0B
-AQEFAAOCAg8AMIICCgKCAgEAr+TufoskDhJuqVAtFkQ7kpJcyrhdhJJCEyq8ZVeCQD5XJM1QiyUq
-t2/876LQwB8CJEoTlo8jE+YoWACjR8cGp4QjK7u9lit/VcyLwVcfDmJlD909Vopz2q5+bbqBHH5C
-jCA12UNNhPqE21Is8w4ndwtrvxEvcnifLtg+5hg3Wipy+dpikJKVyh+c6bM8K8vzARO/Ws/BtQpg
-vd21mWRTuKCWs2/iJneRjOBiEAKfNA+k1ZIzUd6+jbqEemA8atufK+ze3gE/bk3lUIbLtK/tREDF
-ylqM2tIrfKjuvqblCqoOpd8FUrdVxyJdMmqXl2MT28nbeTZ7hTpKxVKJ+STnnXepgv9VHKVxaSvR
-AiTysybUa9oEVeXBCsdtMDeQKuSeFDNeFhdVxVu1yzSJkvGdJo+hB9TGsnhQ2wwMC3wLjEHXuend
-jIj3o02yMszYF9rNt85mndT9Xv+9lz4pded+p2JYryU0pUHHPbwNUMoDAw8IWh+Vc3hiv69yFGkO
-peUDDniOJihC8AcLYiAQZzlG+qkDzAQ4embvIIO1jEpWjpEA/I5cgt6IoMPiaG59je883WX0XaxR
-7ySArqpWl2/5rX3aYT+YdzylkbYcjCbaZaIJbcHiVOO5ykxMgI93e2CaHt+28kgeDrpOVG2Y4OGi
-GqJ3UM/EY5LsRxmd6+ZrzsECAwEAAaOBrDCBqTAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUw
-AwEB/zAdBgNVHQ4EFgQUWyV7lqRlUX64OfPAeGZe6Drn8O4wHwYDVR0jBBgwFoAUWyV7lqRlUX64
-OfPAeGZe6Drn8O4wRgYDVR0gBD8wPTA7BglghXQBWQECAQEwLjAsBggrBgEFBQcCARYgaHR0cDov
-L3JlcG9zaXRvcnkuc3dpc3NzaWduLmNvbS8wDQYJKoZIhvcNAQEFBQADggIBACe645R88a7A3hfm
-5djV9VSwg/S7zV4Fe0+fdWavPOhWfvxyeDgD2StiGwC5+OlgzczOUYrHUDFu4Up+GC9pWbY9ZIEr
-44OE5iKHjn3g7gKZYbge9LgriBIWhMIxkziWMaa5O1M/wySTVltpkuzFwbs4AOPsF6m43Md8AYOf
-Mke6UiI0HTJ6CVanfCU2qT1L2sCCbwq7EsiHSycR+R4tx5M/nttfJmtS2S6K8RTGRI0Vqbe/vd6m
-Gu6uLftIdxf+u+yvGPUqUfA5hJeVbG4bwyvEdGB5JbAKJ9/fXtI5z0V9QkvfsywexcZdylU6oJxp
-mo/a77KwPJ+HbBIrZXAVUjEaJM9vMSNQH4xPjyPDdEFjHFWoFN0+4FFQz/EbMFYOkrCChdiDyyJk
-vC24JdVUorgG6q2SpCSgwYa1ShNqR88uC1aVVMvOmttqtKay20EIhid392qgQmwLOM7XdVAyksLf
-KzAiSNDVQTglXaTpXZ/GlHXQRf0wl0OPkKsKx4ZzYEppLd6leNcG2mqeSz53OiATIgHQv2ieY2Br
-NU0LbbqhPcCT4H8js1WtciVORvnSFu+wZMEBnunKoGqYDs/YYPIvSbjkQuE4NRb0yG5P94FW6Lqj
-viOvrv1vA+ACOzB2+httQc8Bsem4yWb02ybzOqR08kkkW8mw0FfB+j564ZfJ
------END CERTIFICATE-----
-
-SwissSign Silver CA - G2
-========================
------BEGIN CERTIFICATE-----
-MIIFvTCCA6WgAwIBAgIITxvUL1S7L0swDQYJKoZIhvcNAQEFBQAwRzELMAkGA1UEBhMCQ0gxFTAT
-BgNVBAoTDFN3aXNzU2lnbiBBRzEhMB8GA1UEAxMYU3dpc3NTaWduIFNpbHZlciBDQSAtIEcyMB4X
-DTA2MTAyNTA4MzI0NloXDTM2MTAyNTA4MzI0NlowRzELMAkGA1UEBhMCQ0gxFTATBgNVBAoTDFN3
-aXNzU2lnbiBBRzEhMB8GA1UEAxMYU3dpc3NTaWduIFNpbHZlciBDQSAtIEcyMIICIjANBgkqhkiG
-9w0BAQEFAAOCAg8AMIICCgKCAgEAxPGHf9N4Mfc4yfjDmUO8x/e8N+dOcbpLj6VzHVxumK4DV644
-N0MvFz0fyM5oEMF4rhkDKxD6LHmD9ui5aLlV8gREpzn5/ASLHvGiTSf5YXu6t+WiE7brYT7QbNHm
-+/pe7R20nqA1W6GSy/BJkv6FCgU+5tkL4k+73JU3/JHpMjUi0R86TieFnbAVlDLaYQ1HTWBCrpJH
-6INaUFjpiou5XaHc3ZlKHzZnu0jkg7Y360g6rw9njxcH6ATK72oxh9TAtvmUcXtnZLi2kUpCe2Uu
-MGoM9ZDulebyzYLs2aFK7PayS+VFheZteJMELpyCbTapxDFkH4aDCyr0NQp4yVXPQbBH6TCfmb5h
-qAaEuSh6XzjZG6k4sIN/c8HDO0gqgg8hm7jMqDXDhBuDsz6+pJVpATqJAHgE2cn0mRmrVn5bi4Y5
-FZGkECwJMoBgs5PAKrYYC51+jUnyEEp/+dVGLxmSo5mnJqy7jDzmDrxHB9xzUfFwZC8I+bRHHTBs
-ROopN4WSaGa8gzj+ezku01DwH/teYLappvonQfGbGHLy9YR0SslnxFSuSGTfjNFusB3hB48IHpmc
-celM2KX3RxIfdNFRnobzwqIjQAtz20um53MGjMGg6cFZrEb65i/4z3GcRm25xBWNOHkDRUjvxF3X
-CO6HOSKGsg0PWEP3calILv3q1h8CAwEAAaOBrDCBqTAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/
-BAUwAwEB/zAdBgNVHQ4EFgQUF6DNweRBtjpbO8tFnb0cwpj6hlgwHwYDVR0jBBgwFoAUF6DNweRB
-tjpbO8tFnb0cwpj6hlgwRgYDVR0gBD8wPTA7BglghXQBWQEDAQEwLjAsBggrBgEFBQcCARYgaHR0
-cDovL3JlcG9zaXRvcnkuc3dpc3NzaWduLmNvbS8wDQYJKoZIhvcNAQEFBQADggIBAHPGgeAn0i0P
-4JUw4ppBf1AsX19iYamGamkYDHRJ1l2E6kFSGG9YrVBWIGrGvShpWJHckRE1qTodvBqlYJ7YH39F
-kWnZfrt4csEGDyrOj4VwYaygzQu4OSlWhDJOhrs9xCrZ1x9y7v5RoSJBsXECYxqCsGKrXlcSH9/L
-3XWgwF15kIwb4FDm3jH+mHtwX6WQ2K34ArZv02DdQEsixT2tOnqfGhpHkXkzuoLcMmkDlm4fS/Bx
-/uNncqCxv1yL5PqZIseEuRuNI5c/7SXgz2W79WEE790eslpBIlqhn10s6FvJbakMDHiqYMZWjwFa
-DGi8aRl5xB9+lwW/xekkUV7U1UtT7dkjWjYDZaPBA61BMPNGG4WQr2W11bHkFlt4dR2Xem1ZqSqP
-e97Dh4kQmUlzeMg9vVE1dCrV8X5pGyq7O70luJpaPXJhkGaH7gzWTdQRdAtq/gsD/KNVV4n+Ssuu
-WxcFyPKNIzFTONItaj+CuY0IavdeQXRuwxF+B6wpYJE/OMpXEA29MC/HpeZBoNquBYeaoKRlbEwJ
-DIm6uNO5wJOKMPqN5ZprFQFOZ6raYlY+hAhm0sQ2fac+EPyI4NSA5QC9qvNOBqN6avlicuMJT+ub
-DgEj8Z+7fNzcbBGXJbLytGMU0gYqZ4yD9c7qB9iaah7s5Aq7KkzrCWA5zspi2C5u
------END CERTIFICATE-----
-
-GeoTrust Primary Certification Authority
-========================================
------BEGIN CERTIFICATE-----
-MIIDfDCCAmSgAwIBAgIQGKy1av1pthU6Y2yv2vrEoTANBgkqhkiG9w0BAQUFADBYMQswCQYDVQQG
-EwJVUzEWMBQGA1UEChMNR2VvVHJ1c3QgSW5jLjExMC8GA1UEAxMoR2VvVHJ1c3QgUHJpbWFyeSBD
-ZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw0wNjExMjcwMDAwMDBaFw0zNjA3MTYyMzU5NTlaMFgx
-CzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1HZW9UcnVzdCBJbmMuMTEwLwYDVQQDEyhHZW9UcnVzdCBQ
-cmltYXJ5IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIB
-CgKCAQEAvrgVe//UfH1nrYNke8hCUy3f9oQIIGHWAVlqnEQRr+92/ZV+zmEwu3qDXwK9AWbK7hWN
-b6EwnL2hhZ6UOvNWiAAxz9juapYC2e0DjPt1befquFUWBRaa9OBesYjAZIVcFU2Ix7e64HXprQU9
-nceJSOC7KMgD4TCTZF5SwFlwIjVXiIrxlQqD17wxcwE07e9GceBrAqg1cmuXm2bgyxx5X9gaBGge
-RwLmnWDiNpcB3841kt++Z8dtd1k7j53WkBWUvEI0EME5+bEnPn7WinXFsq+W06Lem+SYvn3h6YGt
-tm/81w7a4DSwDRp35+MImO9Y+pyEtzavwt+s0vQQBnBxNQIDAQABo0IwQDAPBgNVHRMBAf8EBTAD
-AQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQULNVQQZcVi/CPNmFbSvtr2ZnJM5IwDQYJKoZI
-hvcNAQEFBQADggEBAFpwfyzdtzRP9YZRqSa+S7iq8XEN3GHHoOo0Hnp3DwQ16CePbJC/kRYkRj5K
-Ts4rFtULUh38H2eiAkUxT87z+gOneZ1TatnaYzr4gNfTmeGl4b7UVXGYNTq+k+qurUKykG/g/CFN
-NWMziUnWm07Kx+dOCQD32sfvmWKZd7aVIl6KoKv0uHiYyjgZmclynnjNS6yvGaBzEi38wkG6gZHa
-Floxt/m0cYASSJlyc1pZU8FjUjPtp8nSOQJw+uCxQmYpqptR7TBUIhRf2asdweSU8Pj1K/fqynhG
-1riR/aYNKxoUAT6A8EKglQdebc3MS6RFjasS6LPeWuWgfOgPIh1a6Vk=
------END CERTIFICATE-----
-
-thawte Primary Root CA
-======================
------BEGIN CERTIFICATE-----
-MIIEIDCCAwigAwIBAgIQNE7VVyDV7exJ9C/ON9srbTANBgkqhkiG9w0BAQUFADCBqTELMAkGA1UE
-BhMCVVMxFTATBgNVBAoTDHRoYXd0ZSwgSW5jLjEoMCYGA1UECxMfQ2VydGlmaWNhdGlvbiBTZXJ2
-aWNlcyBEaXZpc2lvbjE4MDYGA1UECxMvKGMpIDIwMDYgdGhhd3RlLCBJbmMuIC0gRm9yIGF1dGhv
-cml6ZWQgdXNlIG9ubHkxHzAdBgNVBAMTFnRoYXd0ZSBQcmltYXJ5IFJvb3QgQ0EwHhcNMDYxMTE3
-MDAwMDAwWhcNMzYwNzE2MjM1OTU5WjCBqTELMAkGA1UEBhMCVVMxFTATBgNVBAoTDHRoYXd0ZSwg
-SW5jLjEoMCYGA1UECxMfQ2VydGlmaWNhdGlvbiBTZXJ2aWNlcyBEaXZpc2lvbjE4MDYGA1UECxMv
-KGMpIDIwMDYgdGhhd3RlLCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxHzAdBgNVBAMT
-FnRoYXd0ZSBQcmltYXJ5IFJvb3QgQ0EwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCs
-oPD7gFnUnMekz52hWXMJEEUMDSxuaPFsW0hoSVk3/AszGcJ3f8wQLZU0HObrTQmnHNK4yZc2AreJ
-1CRfBsDMRJSUjQJib+ta3RGNKJpchJAQeg29dGYvajig4tVUROsdB58Hum/u6f1OCyn1PoSgAfGc
-q/gcfomk6KHYcWUNo1F77rzSImANuVud37r8UVsLr5iy6S7pBOhih94ryNdOwUxkHt3Ph1i6Sk/K
-aAcdHJ1KxtUvkcx8cXIcxcBn6zL9yZJclNqFwJu/U30rCfSMnZEfl2pSy94JNqR32HuHUETVPm4p
-afs5SSYeCaWAe0At6+gnhcn+Yf1+5nyXHdWdAgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYD
-VR0PAQH/BAQDAgEGMB0GA1UdDgQWBBR7W0XPr87Lev0xkhpqtvNG61dIUDANBgkqhkiG9w0BAQUF
-AAOCAQEAeRHAS7ORtvzw6WfUDW5FvlXok9LOAz/t2iWwHVfLHjp2oEzsUHboZHIMpKnxuIvW1oeE
-uzLlQRHAd9mzYJ3rG9XRbkREqaYB7FViHXe4XI5ISXycO1cRrK1zN44veFyQaEfZYGDm/Ac9IiAX
-xPcW6cTYcvnIc3zfFi8VqT79aie2oetaupgf1eNNZAqdE8hhuvU5HIe6uL17In/2/qxAeeWsEG89
-jxt5dovEN7MhGITlNgDrYyCZuen+MwS7QcjBAvlEYyCegc5C09Y/LHbTY5xZ3Y+m4Q6gLkH3LpVH
-z7z9M/P2C2F+fpErgUfCJzDupxBdN49cOSvkBPB7jVaMaA==
------END CERTIFICATE-----
-
-VeriSign Class 3 Public Primary Certification Authority - G5
-============================================================
------BEGIN CERTIFICATE-----
-MIIE0zCCA7ugAwIBAgIQGNrRniZ96LtKIVjNzGs7SjANBgkqhkiG9w0BAQUFADCByjELMAkGA1UE
-BhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQLExZWZXJpU2lnbiBUcnVzdCBO
-ZXR3b3JrMTowOAYDVQQLEzEoYykgMjAwNiBWZXJpU2lnbiwgSW5jLiAtIEZvciBhdXRob3JpemVk
-IHVzZSBvbmx5MUUwQwYDVQQDEzxWZXJpU2lnbiBDbGFzcyAzIFB1YmxpYyBQcmltYXJ5IENlcnRp
-ZmljYXRpb24gQXV0aG9yaXR5IC0gRzUwHhcNMDYxMTA4MDAwMDAwWhcNMzYwNzE2MjM1OTU5WjCB
-yjELMAkGA1UEBhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQLExZWZXJpU2ln
-biBUcnVzdCBOZXR3b3JrMTowOAYDVQQLEzEoYykgMjAwNiBWZXJpU2lnbiwgSW5jLiAtIEZvciBh
-dXRob3JpemVkIHVzZSBvbmx5MUUwQwYDVQQDEzxWZXJpU2lnbiBDbGFzcyAzIFB1YmxpYyBQcmlt
-YXJ5IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IC0gRzUwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAw
-ggEKAoIBAQCvJAgIKXo1nmAMqudLO07cfLw8RRy7K+D+KQL5VwijZIUVJ/XxrcgxiV0i6CqqpkKz
-j/i5Vbext0uz/o9+B1fs70PbZmIVYc9gDaTY3vjgw2IIPVQT60nKWVSFJuUrjxuf6/WhkcIzSdhD
-Y2pSS9KP6HBRTdGJaXvHcPaz3BJ023tdS1bTlr8Vd6Gw9KIl8q8ckmcY5fQGBO+QueQA5N06tRn/
-Arr0PO7gi+s3i+z016zy9vA9r911kTMZHRxAy3QkGSGT2RT+rCpSx4/VBEnkjWNHiDxpg8v+R70r
-fk/Fla4OndTRQ8Bnc+MUCH7lP59zuDMKz10/NIeWiu5T6CUVAgMBAAGjgbIwga8wDwYDVR0TAQH/
-BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwbQYIKwYBBQUHAQwEYTBfoV2gWzBZMFcwVRYJaW1hZ2Uv
-Z2lmMCEwHzAHBgUrDgMCGgQUj+XTGoasjY5rw8+AatRIGCx7GS4wJRYjaHR0cDovL2xvZ28udmVy
-aXNpZ24uY29tL3ZzbG9nby5naWYwHQYDVR0OBBYEFH/TZafC3ey78DAJ80M5+gKvMzEzMA0GCSqG
-SIb3DQEBBQUAA4IBAQCTJEowX2LP2BqYLz3q3JktvXf2pXkiOOzEp6B4Eq1iDkVwZMXnl2YtmAl+
-X6/WzChl8gGqCBpH3vn5fJJaCGkgDdk+bW48DW7Y5gaRQBi5+MHt39tBquCWIMnNZBU4gcmU7qKE
-KQsTb47bDN0lAtukixlE0kF6BWlKWE9gyn6CagsCqiUXObXbf+eEZSqVir2G3l6BFoMtEMze/aiC
-Km0oHw0LxOXnGiYZ4fQRbxC1lfznQgUy286dUV4otp6F01vvpX1FQHKOtw5rDgb7MzVIcbidJ4vE
-ZV8NhnacRHr2lVz2XTIIM6RUthg/aFzyQkqFOFSDX9HoLPKsEdao7WNq
------END CERTIFICATE-----
-
-SecureTrust CA
-==============
------BEGIN CERTIFICATE-----
-MIIDuDCCAqCgAwIBAgIQDPCOXAgWpa1Cf/DrJxhZ0DANBgkqhkiG9w0BAQUFADBIMQswCQYDVQQG
-EwJVUzEgMB4GA1UEChMXU2VjdXJlVHJ1c3QgQ29ycG9yYXRpb24xFzAVBgNVBAMTDlNlY3VyZVRy
-dXN0IENBMB4XDTA2MTEwNzE5MzExOFoXDTI5MTIzMTE5NDA1NVowSDELMAkGA1UEBhMCVVMxIDAe
-BgNVBAoTF1NlY3VyZVRydXN0IENvcnBvcmF0aW9uMRcwFQYDVQQDEw5TZWN1cmVUcnVzdCBDQTCC
-ASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKukgeWVzfX2FI7CT8rU4niVWJxB4Q2ZQCQX
-OZEzZum+4YOvYlyJ0fwkW2Gz4BERQRwdbvC4u/jep4G6pkjGnx29vo6pQT64lO0pGtSO0gMdA+9t
-DWccV9cGrcrI9f4Or2YlSASWC12juhbDCE/RRvgUXPLIXgGZbf2IzIaowW8xQmxSPmjL8xk037uH
-GFaAJsTQ3MBv396gwpEWoGQRS0S8Hvbn+mPeZqx2pHGj7DaUaHp3pLHnDi+BeuK1cobvomuL8A/b
-01k/unK8RCSc43Oz969XL0Imnal0ugBS8kvNU3xHCzaFDmapCJcWNFfBZveA4+1wVMeT4C4oFVmH
-ursCAwEAAaOBnTCBmjATBgkrBgEEAYI3FAIEBh4EAEMAQTALBgNVHQ8EBAMCAYYwDwYDVR0TAQH/
-BAUwAwEB/zAdBgNVHQ4EFgQUQjK2FvoE/f5dS3rD/fdMQB1aQ68wNAYDVR0fBC0wKzApoCegJYYj
-aHR0cDovL2NybC5zZWN1cmV0cnVzdC5jb20vU1RDQS5jcmwwEAYJKwYBBAGCNxUBBAMCAQAwDQYJ
-KoZIhvcNAQEFBQADggEBADDtT0rhWDpSclu1pqNlGKa7UTt36Z3q059c4EVlew3KW+JwULKUBRSu
-SceNQQcSc5R+DCMh/bwQf2AQWnL1mA6s7Ll/3XpvXdMc9P+IBWlCqQVxyLesJugutIxq/3HcuLHf
-mbx8IVQr5Fiiu1cprp6poxkmD5kuCLDv/WnPmRoJjeOnnyvJNjR7JLN4TJUXpAYmHrZkUjZfYGfZ
-nMUFdAvnZyPSCPyI6a6Lf+Ew9Dd+/cYy2i2eRDAwbO4H3tI0/NL/QPZL9GZGBlSm8jIKYyYwa5vR
-3ItHuuG51WLQoqD0ZwV4KWMabwTW+MZMo5qxN7SN5ShLHZ4swrhovO0C7jE=
------END CERTIFICATE-----
-
-Secure Global CA
-================
------BEGIN CERTIFICATE-----
-MIIDvDCCAqSgAwIBAgIQB1YipOjUiolN9BPI8PjqpTANBgkqhkiG9w0BAQUFADBKMQswCQYDVQQG
-EwJVUzEgMB4GA1UEChMXU2VjdXJlVHJ1c3QgQ29ycG9yYXRpb24xGTAXBgNVBAMTEFNlY3VyZSBH
-bG9iYWwgQ0EwHhcNMDYxMTA3MTk0MjI4WhcNMjkxMjMxMTk1MjA2WjBKMQswCQYDVQQGEwJVUzEg
-MB4GA1UEChMXU2VjdXJlVHJ1c3QgQ29ycG9yYXRpb24xGTAXBgNVBAMTEFNlY3VyZSBHbG9iYWwg
-Q0EwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCvNS7YrGxVaQZx5RNoJLNP2MwhR/jx
-YDiJiQPpvepeRlMJ3Fz1Wuj3RSoC6zFh1ykzTM7HfAo3fg+6MpjhHZevj8fcyTiW89sa/FHtaMbQ
-bqR8JNGuQsiWUGMu4P51/pinX0kuleM5M2SOHqRfkNJnPLLZ/kG5VacJjnIFHovdRIWCQtBJwB1g
-8NEXLJXr9qXBkqPFwqcIYA1gBBCWeZ4WNOaptvolRTnIHmX5k/Wq8VLcmZg9pYYaDDUz+kulBAYV
-HDGA76oYa8J719rO+TMg1fW9ajMtgQT7sFzUnKPiXB3jqUJ1XnvUd+85VLrJChgbEplJL4hL/VBi
-0XPnj3pDAgMBAAGjgZ0wgZowEwYJKwYBBAGCNxQCBAYeBABDAEEwCwYDVR0PBAQDAgGGMA8GA1Ud
-EwEB/wQFMAMBAf8wHQYDVR0OBBYEFK9EBMJBfkiD2045AuzshHrmzsmkMDQGA1UdHwQtMCswKaAn
-oCWGI2h0dHA6Ly9jcmwuc2VjdXJldHJ1c3QuY29tL1NHQ0EuY3JsMBAGCSsGAQQBgjcVAQQDAgEA
-MA0GCSqGSIb3DQEBBQUAA4IBAQBjGghAfaReUw132HquHw0LURYD7xh8yOOvaliTFGCRsoTciE6+
-OYo68+aCiV0BN7OrJKQVDpI1WkpEXk5X+nXOH0jOZvQ8QCaSmGwb7iRGDBezUqXbpZGRzzfTb+cn
-CDpOGR86p1hcF895P4vkp9MmI50mD1hp/Ed+stCNi5O/KU9DaXR2Z0vPB4zmAve14bRDtUstFJ/5
-3CYNv6ZHdAbYiNE6KTCEztI5gGIbqMdXSbxqVVFnFUq+NQfk1XWYN3kwFNspnWzFacxHVaIw98xc
-f8LDmBxrThaA63p4ZUWiABqvDA1VZDRIuJK58bRQKfJPIx/abKwfROHdI3hRW8cW
------END CERTIFICATE-----
-
-COMODO Certification Authority
-==============================
------BEGIN CERTIFICATE-----
-MIIEHTCCAwWgAwIBAgIQToEtioJl4AsC7j41AkblPTANBgkqhkiG9w0BAQUFADCBgTELMAkGA1UE
-BhMCR0IxGzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UEBxMHU2FsZm9yZDEaMBgG
-A1UEChMRQ09NT0RPIENBIExpbWl0ZWQxJzAlBgNVBAMTHkNPTU9ETyBDZXJ0aWZpY2F0aW9uIEF1
-dGhvcml0eTAeFw0wNjEyMDEwMDAwMDBaFw0yOTEyMzEyMzU5NTlaMIGBMQswCQYDVQQGEwJHQjEb
-MBkGA1UECBMSR3JlYXRlciBNYW5jaGVzdGVyMRAwDgYDVQQHEwdTYWxmb3JkMRowGAYDVQQKExFD
-T01PRE8gQ0EgTGltaXRlZDEnMCUGA1UEAxMeQ09NT0RPIENlcnRpZmljYXRpb24gQXV0aG9yaXR5
-MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA0ECLi3LjkRv3UcEbVASY06m/weaKXTuH
-+7uIzg3jLz8GlvCiKVCZrts7oVewdFFxze1CkU1B/qnI2GqGd0S7WWaXUF601CxwRM/aN5VCaTww
-xHGzUvAhTaHYujl8HJ6jJJ3ygxaYqhZ8Q5sVW7euNJH+1GImGEaaP+vB+fGQV+useg2L23IwambV
-4EajcNxo2f8ESIl33rXp+2dtQem8Ob0y2WIC8bGoPW43nOIv4tOiJovGuFVDiOEjPqXSJDlqR6sA
-1KGzqSX+DT+nHbrTUcELpNqsOO9VUCQFZUaTNE8tja3G1CEZ0o7KBWFxB3NH5YoZEr0ETc5OnKVI
-rLsm9wIDAQABo4GOMIGLMB0GA1UdDgQWBBQLWOWLxkwVN6RAqTCpIb5HNlpW/zAOBgNVHQ8BAf8E
-BAMCAQYwDwYDVR0TAQH/BAUwAwEB/zBJBgNVHR8EQjBAMD6gPKA6hjhodHRwOi8vY3JsLmNvbW9k
-b2NhLmNvbS9DT01PRE9DZXJ0aWZpY2F0aW9uQXV0aG9yaXR5LmNybDANBgkqhkiG9w0BAQUFAAOC
-AQEAPpiem/Yb6dc5t3iuHXIYSdOH5EOC6z/JqvWote9VfCFSZfnVDeFs9D6Mk3ORLgLETgdxb8CP
-OGEIqB6BCsAvIC9Bi5HcSEW88cbeunZrM8gALTFGTO3nnc+IlP8zwFboJIYmuNg4ON8qa90SzMc/
-RxdMosIGlgnW2/4/PEZB31jiVg88O8EckzXZOFKs7sjsLjBOlDW0JB9LeGna8gI4zJVSk/BwJVmc
-IGfE7vmLV2H0knZ9P4SNVbfo5azV8fUZVqZa+5Acr5Pr5RzUZ5ddBA6+C4OmF4O5MBKgxTMVBbkN
-+8cFduPYSo38NBejxiEovjBFMR7HeL5YYTisO+IBZQ==
------END CERTIFICATE-----
-
-Network Solutions Certificate Authority
-=======================================
------BEGIN CERTIFICATE-----
-MIID5jCCAs6gAwIBAgIQV8szb8JcFuZHFhfjkDFo4DANBgkqhkiG9w0BAQUFADBiMQswCQYDVQQG
-EwJVUzEhMB8GA1UEChMYTmV0d29yayBTb2x1dGlvbnMgTC5MLkMuMTAwLgYDVQQDEydOZXR3b3Jr
-IFNvbHV0aW9ucyBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkwHhcNMDYxMjAxMDAwMDAwWhcNMjkxMjMx
-MjM1OTU5WjBiMQswCQYDVQQGEwJVUzEhMB8GA1UEChMYTmV0d29yayBTb2x1dGlvbnMgTC5MLkMu
-MTAwLgYDVQQDEydOZXR3b3JrIFNvbHV0aW9ucyBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkwggEiMA0G
-CSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDkvH6SMG3G2I4rC7xGzuAnlt7e+foS0zwzc7MEL7xx
-jOWftiJgPl9dzgn/ggwbmlFQGiaJ3dVhXRncEg8tCqJDXRfQNJIg6nPPOCwGJgl6cvf6UDL4wpPT
-aaIjzkGxzOTVHzbRijr4jGPiFFlp7Q3Tf2vouAPlT2rlmGNpSAW+Lv8ztumXWWn4Zxmuk2GWRBXT
-crA/vGp97Eh/jcOrqnErU2lBUzS1sLnFBgrEsEX1QV1uiUV7PTsmjHTC5dLRfbIR1PtYMiKagMnc
-/Qzpf14Dl847ABSHJ3A4qY5usyd2mFHgBeMhqxrVhSI8KbWaFsWAqPS7azCPL0YCorEMIuDTAgMB
-AAGjgZcwgZQwHQYDVR0OBBYEFCEwyfsA106Y2oeqKtCnLrFAMadMMA4GA1UdDwEB/wQEAwIBBjAP
-BgNVHRMBAf8EBTADAQH/MFIGA1UdHwRLMEkwR6BFoEOGQWh0dHA6Ly9jcmwubmV0c29sc3NsLmNv
-bS9OZXR3b3JrU29sdXRpb25zQ2VydGlmaWNhdGVBdXRob3JpdHkuY3JsMA0GCSqGSIb3DQEBBQUA
-A4IBAQC7rkvnt1frf6ott3NHhWrB5KUd5Oc86fRZZXe1eltajSU24HqXLjjAV2CDmAaDn7l2em5Q
-4LqILPxFzBiwmZVRDuwduIj/h1AcgsLj4DKAv6ALR8jDMe+ZZzKATxcheQxpXN5eNK4CtSbqUN9/
-GGUsyfJj4akH/nxxH2szJGoeBfcFaMBqEssuXmHLrijTfsK0ZpEmXzwuJF/LWA/rKOyvEZbz3Htv
-wKeI8lN3s2Berq4o2jUsbzRF0ybh3uxbTydrFny9RAQYgrOJeRcQcT16ohZO9QHNpGxlaKFJdlxD
-ydi8NmdspZS11My5vWo1ViHe2MPr+8ukYEywVaCge1ey
------END CERTIFICATE-----
-
-WellsSecure Public Root Certificate Authority
-=============================================
------BEGIN CERTIFICATE-----
-MIIEvTCCA6WgAwIBAgIBATANBgkqhkiG9w0BAQUFADCBhTELMAkGA1UEBhMCVVMxIDAeBgNVBAoM
-F1dlbGxzIEZhcmdvIFdlbGxzU2VjdXJlMRwwGgYDVQQLDBNXZWxscyBGYXJnbyBCYW5rIE5BMTYw
-NAYDVQQDDC1XZWxsc1NlY3VyZSBQdWJsaWMgUm9vdCBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkwHhcN
-MDcxMjEzMTcwNzU0WhcNMjIxMjE0MDAwNzU0WjCBhTELMAkGA1UEBhMCVVMxIDAeBgNVBAoMF1dl
-bGxzIEZhcmdvIFdlbGxzU2VjdXJlMRwwGgYDVQQLDBNXZWxscyBGYXJnbyBCYW5rIE5BMTYwNAYD
-VQQDDC1XZWxsc1NlY3VyZSBQdWJsaWMgUm9vdCBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkwggEiMA0G
-CSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDub7S9eeKPCCGeOARBJe+rWxxTkqxtnt3CxC5FlAM1
-iGd0V+PfjLindo8796jE2yljDpFoNoqXjopxaAkH5OjUDk/41itMpBb570OYj7OeUt9tkTmPOL13
-i0Nj67eT/DBMHAGTthP796EfvyXhdDcsHqRePGj4S78NuR4uNuip5Kf4D8uCdXw1LSLWwr8L87T8
-bJVhHlfXBIEyg1J55oNjz7fLY4sR4r1e6/aN7ZVyKLSsEmLpSjPmgzKuBXWVvYSV2ypcm44uDLiB
-K0HmOFafSZtsdvqKXfcBeYF8wYNABf5x/Qw/zE5gCQ5lRxAvAcAFP4/4s0HvWkJ+We/SlwxlAgMB
-AAGjggE0MIIBMDAPBgNVHRMBAf8EBTADAQH/MDkGA1UdHwQyMDAwLqAsoCqGKGh0dHA6Ly9jcmwu
-cGtpLndlbGxzZmFyZ28uY29tL3dzcHJjYS5jcmwwDgYDVR0PAQH/BAQDAgHGMB0GA1UdDgQWBBQm
-lRkQ2eihl5H/3BnZtQQ+0nMKajCBsgYDVR0jBIGqMIGngBQmlRkQ2eihl5H/3BnZtQQ+0nMKaqGB
-i6SBiDCBhTELMAkGA1UEBhMCVVMxIDAeBgNVBAoMF1dlbGxzIEZhcmdvIFdlbGxzU2VjdXJlMRww
-GgYDVQQLDBNXZWxscyBGYXJnbyBCYW5rIE5BMTYwNAYDVQQDDC1XZWxsc1NlY3VyZSBQdWJsaWMg
-Um9vdCBDZXJ0aWZpY2F0ZSBBdXRob3JpdHmCAQEwDQYJKoZIhvcNAQEFBQADggEBALkVsUSRzCPI
-K0134/iaeycNzXK7mQDKfGYZUMbVmO2rvwNa5U3lHshPcZeG1eMd/ZDJPHV3V3p9+N701NX3leZ0
-bh08rnyd2wIDBSxxSyU+B+NemvVmFymIGjifz6pBA4SXa5M4esowRBskRDPQ5NHcKDj0E0M1NSlj
-qHyita04pO2t/caaH/+Xc/77szWnk4bGdpEA5qxRFsQnMlzbc9qlk1eOPm01JghZ1edE13YgY+es
-E2fDbbFwRnzVlhE9iW9dqKHrjQrawx0zbKPqZxmamX9LPYNRKh3KL4YMon4QLSvUFpULB6ouFJJJ
-tylv2G0xffX8oRAHh84vWdw+WNs=
------END CERTIFICATE-----
-
-COMODO ECC Certification Authority
-==================================
------BEGIN CERTIFICATE-----
-MIICiTCCAg+gAwIBAgIQH0evqmIAcFBUTAGem2OZKjAKBggqhkjOPQQDAzCBhTELMAkGA1UEBhMC
-R0IxGzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UEBxMHU2FsZm9yZDEaMBgGA1UE
-ChMRQ09NT0RPIENBIExpbWl0ZWQxKzApBgNVBAMTIkNPTU9ETyBFQ0MgQ2VydGlmaWNhdGlvbiBB
-dXRob3JpdHkwHhcNMDgwMzA2MDAwMDAwWhcNMzgwMTE4MjM1OTU5WjCBhTELMAkGA1UEBhMCR0Ix
-GzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UEBxMHU2FsZm9yZDEaMBgGA1UEChMR
-Q09NT0RPIENBIExpbWl0ZWQxKzApBgNVBAMTIkNPTU9ETyBFQ0MgQ2VydGlmaWNhdGlvbiBBdXRo
-b3JpdHkwdjAQBgcqhkjOPQIBBgUrgQQAIgNiAAQDR3svdcmCFYX7deSRFtSrYpn1PlILBs5BAH+X
-4QokPB0BBO490o0JlwzgdeT6+3eKKvUDYEs2ixYjFq0JcfRK9ChQtP6IHG4/bC8vCVlbpVsLM5ni
-wz2J+Wos77LTBumjQjBAMB0GA1UdDgQWBBR1cacZSBm8nZ3qQUfflMRId5nTeTAOBgNVHQ8BAf8E
-BAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAKBggqhkjOPQQDAwNoADBlAjEA7wNbeqy3eApyt4jf/7VG
-FAkK+qDmfQjGGoe9GKhzvSbKYAydzpmfz1wPMOG+FDHqAjAU9JM8SaczepBGR7NjfRObTrdvGDeA
-U/7dIOA1mjbRxwG55tzd8/8dLDoWV9mSOdY=
------END CERTIFICATE-----
-
-IGC/A
-=====
------BEGIN CERTIFICATE-----
-MIIEAjCCAuqgAwIBAgIFORFFEJQwDQYJKoZIhvcNAQEFBQAwgYUxCzAJBgNVBAYTAkZSMQ8wDQYD
-VQQIEwZGcmFuY2UxDjAMBgNVBAcTBVBhcmlzMRAwDgYDVQQKEwdQTS9TR0ROMQ4wDAYDVQQLEwVE
-Q1NTSTEOMAwGA1UEAxMFSUdDL0ExIzAhBgkqhkiG9w0BCQEWFGlnY2FAc2dkbi5wbS5nb3V2LmZy
-MB4XDTAyMTIxMzE0MjkyM1oXDTIwMTAxNzE0MjkyMlowgYUxCzAJBgNVBAYTAkZSMQ8wDQYDVQQI
-EwZGcmFuY2UxDjAMBgNVBAcTBVBhcmlzMRAwDgYDVQQKEwdQTS9TR0ROMQ4wDAYDVQQLEwVEQ1NT
-STEOMAwGA1UEAxMFSUdDL0ExIzAhBgkqhkiG9w0BCQEWFGlnY2FAc2dkbi5wbS5nb3V2LmZyMIIB
-IjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAsh/R0GLFMzvABIaIs9z4iPf930Pfeo2aSVz2
-TqrMHLmh6yeJ8kbpO0px1R2OLc/mratjUMdUC24SyZA2xtgv2pGqaMVy/hcKshd+ebUyiHDKcMCW
-So7kVc0dJ5S/znIq7Fz5cyD+vfcuiWe4u0dzEvfRNWk68gq5rv9GQkaiv6GFGvm/5P9JhfejcIYy
-HF2fYPepraX/z9E0+X1bF8bc1g4oa8Ld8fUzaJ1O/Id8NhLWo4DoQw1VYZTqZDdH6nfK0LJYBcNd
-frGoRpAxVs5wKpayMLh35nnAvSk7/ZR3TL0gzUEl4C7HG7vupARB0l2tEmqKm0f7yd1GQOGdPDPQ
-tQIDAQABo3cwdTAPBgNVHRMBAf8EBTADAQH/MAsGA1UdDwQEAwIBRjAVBgNVHSAEDjAMMAoGCCqB
-egF5AQEBMB0GA1UdDgQWBBSjBS8YYFDCiQrdKyFP/45OqDAxNjAfBgNVHSMEGDAWgBSjBS8YYFDC
-iQrdKyFP/45OqDAxNjANBgkqhkiG9w0BAQUFAAOCAQEABdwm2Pp3FURo/C9mOnTgXeQp/wYHE4RK
-q89toB9RlPhJy3Q2FLwV3duJL92PoF189RLrn544pEfMs5bZvpwlqwN+Mw+VgQ39FuCIvjfwbF3Q
-MZsyK10XZZOYYLxuj7GoPB7ZHPOpJkL5ZB3C55L29B5aqhlSXa/oovdgoPaN8In1buAKBQGVyYsg
-Crpa/JosPL3Dt8ldeCUFP1YUmwza+zpI/pdpXsoQhvdOlgQITeywvl3cO45Pwf2aNjSaTFR+FwNI
-lQgRHAdvhQh+XU3Endv7rs6y0bO4g2wdsrN58dhwmX7wEwLOXt1R0982gaEbeC9xs/FZTEYYKKuF
-0mBWWg==
------END CERTIFICATE-----
-
-Security Communication EV RootCA1
-=================================
------BEGIN CERTIFICATE-----
-MIIDfTCCAmWgAwIBAgIBADANBgkqhkiG9w0BAQUFADBgMQswCQYDVQQGEwJKUDElMCMGA1UEChMc
-U0VDT00gVHJ1c3QgU3lzdGVtcyBDTy4sTFRELjEqMCgGA1UECxMhU2VjdXJpdHkgQ29tbXVuaWNh
-dGlvbiBFViBSb290Q0ExMB4XDTA3MDYwNjAyMTIzMloXDTM3MDYwNjAyMTIzMlowYDELMAkGA1UE
-BhMCSlAxJTAjBgNVBAoTHFNFQ09NIFRydXN0IFN5c3RlbXMgQ08uLExURC4xKjAoBgNVBAsTIVNl
-Y3VyaXR5IENvbW11bmljYXRpb24gRVYgUm9vdENBMTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCC
-AQoCggEBALx/7FebJOD+nLpCeamIivqA4PUHKUPqjgo0No0c+qe1OXj/l3X3L+SqawSERMqm4miO
-/VVQYg+kcQ7OBzgtQoVQrTyWb4vVog7P3kmJPdZkLjjlHmy1V4qe70gOzXppFodEtZDkBp2uoQSX
-WHnvIEqCa4wiv+wfD+mEce3xDuS4GBPMVjZd0ZoeUWs5bmB2iDQL87PRsJ3KYeJkHcFGB7hj3R4z
-ZbOOCVVSPbW9/wfrrWFVGCypaZhKqkDFMxRldAD5kd6vA0jFQFTcD4SQaCDFkpbcLuUCRarAX1T4
-bepJz11sS6/vmsJWXMY1VkJqMF/Cq/biPT+zyRGPMUzXn0kCAwEAAaNCMEAwHQYDVR0OBBYEFDVK
-9U2vP9eCOKyrcWUXdYydVZPmMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MA0GCSqG
-SIb3DQEBBQUAA4IBAQCoh+ns+EBnXcPBZsdAS5f8hxOQWsTvoMpfi7ent/HWtWS3irO4G8za+6xm
-iEHO6Pzk2x6Ipu0nUBsCMCRGef4Eh3CXQHPRwMFXGZpppSeZq51ihPZRwSzJIxXYKLerJRO1RuGG
-Av8mjMSIkh1W/hln8lXkgKNrnKt34VFxDSDbEJrbvXZ5B3eZKK2aXtqxT0QsNY6llsf9g/BYxnnW
-mHyojf6GPgcWkuF75x3sM3Z+Qi5KhfmRiWiEA4Glm5q+4zfFVKtWOxgtQaQM+ELbmaDgcm+7XeEW
-T1MKZPlO9L9OVL14bIjqv5wTJMJwaaJ/D8g8rQjJsJhAoyrniIPtd490
------END CERTIFICATE-----
-
-OISTE WISeKey Global Root GA CA
-===============================
------BEGIN CERTIFICATE-----
-MIID8TCCAtmgAwIBAgIQQT1yx/RrH4FDffHSKFTfmjANBgkqhkiG9w0BAQUFADCBijELMAkGA1UE
-BhMCQ0gxEDAOBgNVBAoTB1dJU2VLZXkxGzAZBgNVBAsTEkNvcHlyaWdodCAoYykgMjAwNTEiMCAG
-A1UECxMZT0lTVEUgRm91bmRhdGlvbiBFbmRvcnNlZDEoMCYGA1UEAxMfT0lTVEUgV0lTZUtleSBH
-bG9iYWwgUm9vdCBHQSBDQTAeFw0wNTEyMTExNjAzNDRaFw0zNzEyMTExNjA5NTFaMIGKMQswCQYD
-VQQGEwJDSDEQMA4GA1UEChMHV0lTZUtleTEbMBkGA1UECxMSQ29weXJpZ2h0IChjKSAyMDA1MSIw
-IAYDVQQLExlPSVNURSBGb3VuZGF0aW9uIEVuZG9yc2VkMSgwJgYDVQQDEx9PSVNURSBXSVNlS2V5
-IEdsb2JhbCBSb290IEdBIENBMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAy0+zAJs9
-Nt350UlqaxBJH+zYK7LG+DKBKUOVTJoZIyEVRd7jyBxRVVuuk+g3/ytr6dTqvirdqFEr12bDYVxg
-Asj1znJ7O7jyTmUIms2kahnBAbtzptf2w93NvKSLtZlhuAGio9RN1AU9ka34tAhxZK9w8RxrfvbD
-d50kc3vkDIzh2TbhmYsFmQvtRTEJysIA2/dyoJaqlYfQjse2YXMNdmaM3Bu0Y6Kff5MTMPGhJ9vZ
-/yxViJGg4E8HsChWjBgbl0SOid3gF27nKu+POQoxhILYQBRJLnpB5Kf+42TMwVlxSywhp1t94B3R
-LoGbw9ho972WG6xwsRYUC9tguSYBBQIDAQABo1EwTzALBgNVHQ8EBAMCAYYwDwYDVR0TAQH/BAUw
-AwEB/zAdBgNVHQ4EFgQUswN+rja8sHnR3JQmthG+IbJphpQwEAYJKwYBBAGCNxUBBAMCAQAwDQYJ
-KoZIhvcNAQEFBQADggEBAEuh/wuHbrP5wUOxSPMowB0uyQlB+pQAHKSkq0lPjz0e701vvbyk9vIm
-MMkQyh2I+3QZH4VFvbBsUfk2ftv1TDI6QU9bR8/oCy22xBmddMVHxjtqD6wU2zz0c5ypBd8A3HR4
-+vg1YFkCExh8vPtNsCBtQ7tgMHpnM1zFmdH4LTlSc/uMqpclXHLZCB6rTjzjgTGfA6b7wP4piFXa
-hNVQA7bihKOmNqoROgHhGEvWRGizPflTdISzRpFGlgC3gCy24eMQ4tui5yiPAZZiFj4A4xylNoEY
-okxSdsARo27mHbrjWr42U8U+dY+GaSlYU7Wcu2+fXMUY7N0v4ZjJ/L7fCg0=
------END CERTIFICATE-----
-
-Microsec e-Szigno Root CA
-=========================
------BEGIN CERTIFICATE-----
-MIIHqDCCBpCgAwIBAgIRAMy4579OKRr9otxmpRwsDxEwDQYJKoZIhvcNAQEFBQAwcjELMAkGA1UE
-BhMCSFUxETAPBgNVBAcTCEJ1ZGFwZXN0MRYwFAYDVQQKEw1NaWNyb3NlYyBMdGQuMRQwEgYDVQQL
-EwtlLVN6aWdubyBDQTEiMCAGA1UEAxMZTWljcm9zZWMgZS1Temlnbm8gUm9vdCBDQTAeFw0wNTA0
-MDYxMjI4NDRaFw0xNzA0MDYxMjI4NDRaMHIxCzAJBgNVBAYTAkhVMREwDwYDVQQHEwhCdWRhcGVz
-dDEWMBQGA1UEChMNTWljcm9zZWMgTHRkLjEUMBIGA1UECxMLZS1Temlnbm8gQ0ExIjAgBgNVBAMT
-GU1pY3Jvc2VjIGUtU3ppZ25vIFJvb3QgQ0EwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIB
-AQDtyADVgXvNOABHzNuEwSFpLHSQDCHZU4ftPkNEU6+r+ICbPHiN1I2uuO/TEdyB5s87lozWbxXG
-d36hL+BfkrYn13aaHUM86tnsL+4582pnS4uCzyL4ZVX+LMsvfUh6PXX5qqAnu3jCBspRwn5mS6/N
-oqdNAoI/gqyFxuEPkEeZlApxcpMqyabAvjxWTHOSJ/FrtfX9/DAFYJLG65Z+AZHCabEeHXtTRbjc
-QR/Ji3HWVBTji1R4P770Yjtb9aPs1ZJ04nQw7wHb4dSrmZsqa/i9phyGI0Jf7Enemotb9HI6QMVJ
-PqW+jqpx62z69Rrkav17fVVA71hu5tnVvCSrwe+3AgMBAAGjggQ3MIIEMzBnBggrBgEFBQcBAQRb
-MFkwKAYIKwYBBQUHMAGGHGh0dHBzOi8vcmNhLmUtc3ppZ25vLmh1L29jc3AwLQYIKwYBBQUHMAKG
-IWh0dHA6Ly93d3cuZS1zemlnbm8uaHUvUm9vdENBLmNydDAPBgNVHRMBAf8EBTADAQH/MIIBcwYD
-VR0gBIIBajCCAWYwggFiBgwrBgEEAYGoGAIBAQEwggFQMCgGCCsGAQUFBwIBFhxodHRwOi8vd3d3
-LmUtc3ppZ25vLmh1L1NaU1ovMIIBIgYIKwYBBQUHAgIwggEUHoIBEABBACAAdABhAG4A+gBzAO0A
-dAB2AOEAbgB5ACAA6QByAHQAZQBsAG0AZQB6AOkAcwDpAGgAZQB6ACAA6QBzACAAZQBsAGYAbwBn
-AGEAZADhAHMA4QBoAG8AegAgAGEAIABTAHoAbwBsAGcA4QBsAHQAYQB0APMAIABTAHoAbwBsAGcA
-4QBsAHQAYQB0AOEAcwBpACAAUwB6AGEAYgDhAGwAeQB6AGEAdABhACAAcwB6AGUAcgBpAG4AdAAg
-AGsAZQBsAGwAIABlAGwAagDhAHIAbgBpADoAIABoAHQAdABwADoALwAvAHcAdwB3AC4AZQAtAHMA
-egBpAGcAbgBvAC4AaAB1AC8AUwBaAFMAWgAvMIHIBgNVHR8EgcAwgb0wgbqggbeggbSGIWh0dHA6
-Ly93d3cuZS1zemlnbm8uaHUvUm9vdENBLmNybIaBjmxkYXA6Ly9sZGFwLmUtc3ppZ25vLmh1L0NO
-PU1pY3Jvc2VjJTIwZS1Temlnbm8lMjBSb290JTIwQ0EsT1U9ZS1Temlnbm8lMjBDQSxPPU1pY3Jv
-c2VjJTIwTHRkLixMPUJ1ZGFwZXN0LEM9SFU/Y2VydGlmaWNhdGVSZXZvY2F0aW9uTGlzdDtiaW5h
-cnkwDgYDVR0PAQH/BAQDAgEGMIGWBgNVHREEgY4wgYuBEGluZm9AZS1zemlnbm8uaHWkdzB1MSMw
-IQYDVQQDDBpNaWNyb3NlYyBlLVN6aWduw7MgUm9vdCBDQTEWMBQGA1UECwwNZS1TemlnbsOzIEhT
-WjEWMBQGA1UEChMNTWljcm9zZWMgS2Z0LjERMA8GA1UEBxMIQnVkYXBlc3QxCzAJBgNVBAYTAkhV
-MIGsBgNVHSMEgaQwgaGAFMegSXUWYYTbMUuE0vE3QJDvTtz3oXakdDByMQswCQYDVQQGEwJIVTER
-MA8GA1UEBxMIQnVkYXBlc3QxFjAUBgNVBAoTDU1pY3Jvc2VjIEx0ZC4xFDASBgNVBAsTC2UtU3pp
-Z25vIENBMSIwIAYDVQQDExlNaWNyb3NlYyBlLVN6aWdubyBSb290IENBghEAzLjnv04pGv2i3Gal
-HCwPETAdBgNVHQ4EFgQUx6BJdRZhhNsxS4TS8TdAkO9O3PcwDQYJKoZIhvcNAQEFBQADggEBANMT
-nGZjWS7KXHAM/IO8VbH0jgdsZifOwTsgqRy7RlRw7lrMoHfqaEQn6/Ip3Xep1fvj1KcExJW4C+FE
-aGAHQzAxQmHl7tnlJNUb3+FKG6qfx1/4ehHqE5MAyopYse7tDk2016g2JnzgOsHVV4Lxdbb9iV/a
-86g4nzUGCM4ilb7N1fy+W955a9x6qWVmvrElWl/tftOsRm1M9DKHtCAE4Gx4sHfRhUZLphK3dehK
-yVZs15KrnfVJONJPU+NVkBHbmJbGSfI+9J8b4PeI3CVimUTYc78/MPMMNz7UwiiAc7EBt51alhQB
-S6kRnSlqLtBdgcDPsiBDxwPgN05dCtxZICU=
------END CERTIFICATE-----
-
-Certigna
-========
------BEGIN CERTIFICATE-----
-MIIDqDCCApCgAwIBAgIJAP7c4wEPyUj/MA0GCSqGSIb3DQEBBQUAMDQxCzAJBgNVBAYTAkZSMRIw
-EAYDVQQKDAlEaGlteW90aXMxETAPBgNVBAMMCENlcnRpZ25hMB4XDTA3MDYyOTE1MTMwNVoXDTI3
-MDYyOTE1MTMwNVowNDELMAkGA1UEBhMCRlIxEjAQBgNVBAoMCURoaW15b3RpczERMA8GA1UEAwwI
-Q2VydGlnbmEwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDIaPHJ1tazNHUmgh7stL7q
-XOEm7RFHYeGifBZ4QCHkYJ5ayGPhxLGWkv8YbWkj4Sti993iNi+RB7lIzw7sebYs5zRLcAglozyH
-GxnygQcPOJAZ0xH+hrTy0V4eHpbNgGzOOzGTtvKg0KmVEn2lmsxryIRWijOp5yIVUxbwzBfsV1/p
-ogqYCd7jX5xv3EjjhQsVWqa6n6xI4wmy9/Qy3l40vhx4XUJbzg4ij02Q130yGLMLLGq/jj8UEYkg
-DncUtT2UCIf3JR7VsmAA7G8qKCVuKj4YYxclPz5EIBb2JsglrgVKtOdjLPOMFlN+XPsRGgjBRmKf
-Irjxwo1p3Po6WAbfAgMBAAGjgbwwgbkwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUGu3+QTmQ
-tCRZvgHyUtVF9lo53BEwZAYDVR0jBF0wW4AUGu3+QTmQtCRZvgHyUtVF9lo53BGhOKQ2MDQxCzAJ
-BgNVBAYTAkZSMRIwEAYDVQQKDAlEaGlteW90aXMxETAPBgNVBAMMCENlcnRpZ25hggkA/tzjAQ/J
-SP8wDgYDVR0PAQH/BAQDAgEGMBEGCWCGSAGG+EIBAQQEAwIABzANBgkqhkiG9w0BAQUFAAOCAQEA
-hQMeknH2Qq/ho2Ge6/PAD/Kl1NqV5ta+aDY9fm4fTIrv0Q8hbV6lUmPOEvjvKtpv6zf+EwLHyzs+
-ImvaYS5/1HI93TDhHkxAGYwP15zRgzB7mFncfca5DClMoTOi62c6ZYTTluLtdkVwj7Ur3vkj1klu
-PBS1xp81HlDQwY9qcEQCYsuuHWhBp6pX6FOqB9IG9tUUBguRA3UsbHK1YZWaDYu5Def131TN3ubY
-1gkIl2PlwS6wt0QmwCbAr1UwnjvVNioZBPRcHv/PLLf/0P2HQBHVESO7SMAhqaQoLf0V+LBOK/Qw
-WyH8EZE0vkHve52Xdf+XlcCWWC/qu0bXu+TZLg==
------END CERTIFICATE-----
-
-AC Ra\xC3\xADz Certic\xC3\xA1mara S.A.
-======================================
------BEGIN CERTIFICATE-----
-MIIGZjCCBE6gAwIBAgIPB35Sk3vgFeNX8GmMy+wMMA0GCSqGSIb3DQEBBQUAMHsxCzAJBgNVBAYT
-AkNPMUcwRQYDVQQKDD5Tb2NpZWRhZCBDYW1lcmFsIGRlIENlcnRpZmljYWNpw7NuIERpZ2l0YWwg
-LSBDZXJ0aWPDoW1hcmEgUy5BLjEjMCEGA1UEAwwaQUMgUmHDrXogQ2VydGljw6FtYXJhIFMuQS4w
-HhcNMDYxMTI3MjA0NjI5WhcNMzAwNDAyMjE0MjAyWjB7MQswCQYDVQQGEwJDTzFHMEUGA1UECgw+
-U29jaWVkYWQgQ2FtZXJhbCBkZSBDZXJ0aWZpY2FjacOzbiBEaWdpdGFsIC0gQ2VydGljw6FtYXJh
-IFMuQS4xIzAhBgNVBAMMGkFDIFJhw616IENlcnRpY8OhbWFyYSBTLkEuMIICIjANBgkqhkiG9w0B
-AQEFAAOCAg8AMIICCgKCAgEAq2uJo1PMSCMI+8PPUZYILrgIem08kBeGqentLhM0R7LQcNzJPNCN
-yu5LF6vQhbCnIwTLqKL85XXbQMpiiY9QngE9JlsYhBzLfDe3fezTf3MZsGqy2IiKLUV0qPezuMDU
-2s0iiXRNWhU5cxh0T7XrmafBHoi0wpOQY5fzp6cSsgkiBzPZkc0OnB8OIMfuuzONj8LSWKdf/WU3
-4ojC2I+GdV75LaeHM/J4Ny+LvB2GNzmxlPLYvEqcgxhaBvzz1NS6jBUJJfD5to0EfhcSM2tXSExP
-2yYe68yQ54v5aHxwD6Mq0Do43zeX4lvegGHTgNiRg0JaTASJaBE8rF9ogEHMYELODVoqDA+bMMCm
-8Ibbq0nXl21Ii/kDwFJnmxL3wvIumGVC2daa49AZMQyth9VXAnow6IYm+48jilSH5L887uvDdUhf
-HjlvgWJsxS3EF1QZtzeNnDeRyPYL1epjb4OsOMLzP96a++EjYfDIJss2yKHzMI+ko6Kh3VOz3vCa
-Mh+DkXkwwakfU5tTohVTP92dsxA7SH2JD/ztA/X7JWR1DhcZDY8AFmd5ekD8LVkH2ZD6mq093ICK
-5lw1omdMEWux+IBkAC1vImHFrEsm5VoQgpukg3s0956JkSCXjrdCx2bD0Omk1vUgjcTDlaxECp1b
-czwmPS9KvqfJpxAe+59QafMCAwEAAaOB5jCB4zAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQE
-AwIBBjAdBgNVHQ4EFgQU0QnQ6dfOeXRU+Tows/RtLAMDG2gwgaAGA1UdIASBmDCBlTCBkgYEVR0g
-ADCBiTArBggrBgEFBQcCARYfaHR0cDovL3d3dy5jZXJ0aWNhbWFyYS5jb20vZHBjLzBaBggrBgEF
-BQcCAjBOGkxMaW1pdGFjaW9uZXMgZGUgZ2FyYW507WFzIGRlIGVzdGUgY2VydGlmaWNhZG8gc2Ug
-cHVlZGVuIGVuY29udHJhciBlbiBsYSBEUEMuMA0GCSqGSIb3DQEBBQUAA4ICAQBclLW4RZFNjmEf
-AygPU3zmpFmps4p6xbD/CHwso3EcIRNnoZUSQDWDg4902zNc8El2CoFS3UnUmjIz75uny3XlesuX
-EpBcunvFm9+7OSPI/5jOCk0iAUgHforA1SBClETvv3eiiWdIG0ADBaGJ7M9i4z0ldma/Jre7Ir5v
-/zlXdLp6yQGVwZVR6Kss+LGGIOk/yzVb0hfpKv6DExdA7ohiZVvVO2Dpezy4ydV/NgIlqmjCMRW3
-MGXrfx1IebHPOeJCgBbT9ZMj/EyXyVo3bHwi2ErN0o42gzmRkBDI8ck1fj+404HGIGQatlDCIaR4
-3NAvO2STdPCWkPHv+wlaNECW8DYSwaN0jJN+Qd53i+yG2dIPPy3RzECiiWZIHiCznCNZc6lEc7wk
-eZBWN7PGKX6jD/EpOe9+XCgycDWs2rjIdWb8m0w5R44bb5tNAlQiM+9hup4phO9OSzNHdpdqy35f
-/RWmnkJDW2ZaiogN9xa5P1FlK2Zqi9E4UqLWRhH6/JocdJ6PlwsCT2TG9WjTSy3/pDceiz+/RL5h
-RqGEPQgnTIEgd4kI6mdAXmwIUV80WoyWaM3X94nCHNMyAK9Sy9NgWyo6R35rMDOhYil/SrnhLecU
-Iw4OGEfhefwVVdCx/CVxY3UzHCMrr1zZ7Ud3YA47Dx7SwNxkBYn8eNZcLCZDqQ==
------END CERTIFICATE-----
-
-TC TrustCenter Class 2 CA II
-============================
------BEGIN CERTIFICATE-----
-MIIEqjCCA5KgAwIBAgIOLmoAAQACH9dSISwRXDswDQYJKoZIhvcNAQEFBQAwdjELMAkGA1UEBhMC
-REUxHDAaBgNVBAoTE1RDIFRydXN0Q2VudGVyIEdtYkgxIjAgBgNVBAsTGVRDIFRydXN0Q2VudGVy
-IENsYXNzIDIgQ0ExJTAjBgNVBAMTHFRDIFRydXN0Q2VudGVyIENsYXNzIDIgQ0EgSUkwHhcNMDYw
-MTEyMTQzODQzWhcNMjUxMjMxMjI1OTU5WjB2MQswCQYDVQQGEwJERTEcMBoGA1UEChMTVEMgVHJ1
-c3RDZW50ZXIgR21iSDEiMCAGA1UECxMZVEMgVHJ1c3RDZW50ZXIgQ2xhc3MgMiBDQTElMCMGA1UE
-AxMcVEMgVHJ1c3RDZW50ZXIgQ2xhc3MgMiBDQSBJSTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCC
-AQoCggEBAKuAh5uO8MN8h9foJIIRszzdQ2Lu+MNF2ujhoF/RKrLqk2jftMjWQ+nEdVl//OEd+DFw
-IxuInie5e/060smp6RQvkL4DUsFJzfb95AhmC1eKokKguNV/aVyQMrKXDcpK3EY+AlWJU+MaWss2
-xgdW94zPEfRMuzBwBJWl9jmM/XOBCH2JXjIeIqkiRUuwZi4wzJ9l/fzLganx4Duvo4bRierERXlQ
-Xa7pIXSSTYtZgo+U4+lK8edJsBTj9WLL1XK9H7nSn6DNqPoByNkN39r8R52zyFTfSUrxIan+GE7u
-SNQZu+995OKdy1u2bv/jzVrndIIFuoAlOMvkaZ6vQaoahPUCAwEAAaOCATQwggEwMA8GA1UdEwEB
-/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBTjq1RMgKHbVkO3kUrL84J6E1wIqzCB
-7QYDVR0fBIHlMIHiMIHfoIHcoIHZhjVodHRwOi8vd3d3LnRydXN0Y2VudGVyLmRlL2NybC92Mi90
-Y19jbGFzc18yX2NhX0lJLmNybIaBn2xkYXA6Ly93d3cudHJ1c3RjZW50ZXIuZGUvQ049VEMlMjBU
-cnVzdENlbnRlciUyMENsYXNzJTIwMiUyMENBJTIwSUksTz1UQyUyMFRydXN0Q2VudGVyJTIwR21i
-SCxPVT1yb290Y2VydHMsREM9dHJ1c3RjZW50ZXIsREM9ZGU/Y2VydGlmaWNhdGVSZXZvY2F0aW9u
-TGlzdD9iYXNlPzANBgkqhkiG9w0BAQUFAAOCAQEAjNfffu4bgBCzg/XbEeprS6iSGNn3Bzn1LL4G
-dXpoUxUc6krtXvwjshOg0wn/9vYua0Fxec3ibf2uWWuFHbhOIprtZjluS5TmVfwLG4t3wVMTZonZ
-KNaL80VKY7f9ewthXbhtvsPcW3nS7Yblok2+XnR8au0WOB9/WIFaGusyiC2y8zl3gK9etmF1Kdsj
-TYjKUCjLhdLTEKJZbtOTVAB6okaVhgWcqRmY5TFyDADiZ9lA4CQze28suVyrZZ0srHbqNZn1l7kP
-JOzHdiEoZa5X6AeIdUpWoNIFOqTmjZKILPPy4cHGYdtBxceb9w4aUUXCYWvcZCcXjFq32nQozZfk
-vQ==
------END CERTIFICATE-----
-
-TC TrustCenter Class 3 CA II
-============================
------BEGIN CERTIFICATE-----
-MIIEqjCCA5KgAwIBAgIOSkcAAQAC5aBd1j8AUb8wDQYJKoZIhvcNAQEFBQAwdjELMAkGA1UEBhMC
-REUxHDAaBgNVBAoTE1RDIFRydXN0Q2VudGVyIEdtYkgxIjAgBgNVBAsTGVRDIFRydXN0Q2VudGVy
-IENsYXNzIDMgQ0ExJTAjBgNVBAMTHFRDIFRydXN0Q2VudGVyIENsYXNzIDMgQ0EgSUkwHhcNMDYw
-MTEyMTQ0MTU3WhcNMjUxMjMxMjI1OTU5WjB2MQswCQYDVQQGEwJERTEcMBoGA1UEChMTVEMgVHJ1
-c3RDZW50ZXIgR21iSDEiMCAGA1UECxMZVEMgVHJ1c3RDZW50ZXIgQ2xhc3MgMyBDQTElMCMGA1UE
-AxMcVEMgVHJ1c3RDZW50ZXIgQ2xhc3MgMyBDQSBJSTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCC
-AQoCggEBALTgu1G7OVyLBMVMeRwjhjEQY0NVJz/GRcekPewJDRoeIMJWHt4bNwcwIi9v8Qbxq63W
-yKthoy9DxLCyLfzDlml7forkzMA5EpBCYMnMNWju2l+QVl/NHE1bWEnrDgFPZPosPIlY2C8u4rBo
-6SI7dYnWRBpl8huXJh0obazovVkdKyT21oQDZogkAHhg8fir/gKya/si+zXmFtGt9i4S5Po1auUZ
-uV3bOx4a+9P/FRQI2AlqukWdFHlgfa9Aigdzs5OW03Q0jTo3Kd5c7PXuLjHCINy+8U9/I1LZW+Jk
-2ZyqBwi1Rb3R0DHBq1SfqdLDYmAD8bs5SpJKPQq5ncWg/jcCAwEAAaOCATQwggEwMA8GA1UdEwEB
-/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBTUovyfs8PYA9NXXAek0CSnwPIA1DCB
-7QYDVR0fBIHlMIHiMIHfoIHcoIHZhjVodHRwOi8vd3d3LnRydXN0Y2VudGVyLmRlL2NybC92Mi90
-Y19jbGFzc18zX2NhX0lJLmNybIaBn2xkYXA6Ly93d3cudHJ1c3RjZW50ZXIuZGUvQ049VEMlMjBU
-cnVzdENlbnRlciUyMENsYXNzJTIwMyUyMENBJTIwSUksTz1UQyUyMFRydXN0Q2VudGVyJTIwR21i
-SCxPVT1yb290Y2VydHMsREM9dHJ1c3RjZW50ZXIsREM9ZGU/Y2VydGlmaWNhdGVSZXZvY2F0aW9u
-TGlzdD9iYXNlPzANBgkqhkiG9w0BAQUFAAOCAQEANmDkcPcGIEPZIxpC8vijsrlNirTzwppVMXzE
-O2eatN9NDoqTSheLG43KieHPOh6sHfGcMrSOWXaiQYUlN6AT0PV8TtXqluJucsG7Kv5sbviRmEb8
-yRtXW+rIGjs/sFGYPAfaLFkB2otE6OF0/ado3VS6g0bsyEa1+K+XwDsJHI/OcpY9M1ZwvJbL2NV9
-IJqDnxrcOfHFcqMRA/07QlIp2+gB95tejNaNhk4Z+rwcvsUhpYeeeC422wlxo3I0+GzjBgnyXlal
-092Y+tTmBvTwtiBjS+opvaqCZh77gaqnN60TGOaSw4HBM7uIHqHn4rS9MWwOUT1v+5ZWgOI2F9Hc
-5A==
------END CERTIFICATE-----
-
-TC TrustCenter Universal CA I
-=============================
------BEGIN CERTIFICATE-----
-MIID3TCCAsWgAwIBAgIOHaIAAQAC7LdggHiNtgYwDQYJKoZIhvcNAQEFBQAweTELMAkGA1UEBhMC
-REUxHDAaBgNVBAoTE1RDIFRydXN0Q2VudGVyIEdtYkgxJDAiBgNVBAsTG1RDIFRydXN0Q2VudGVy
-IFVuaXZlcnNhbCBDQTEmMCQGA1UEAxMdVEMgVHJ1c3RDZW50ZXIgVW5pdmVyc2FsIENBIEkwHhcN
-MDYwMzIyMTU1NDI4WhcNMjUxMjMxMjI1OTU5WjB5MQswCQYDVQQGEwJERTEcMBoGA1UEChMTVEMg
-VHJ1c3RDZW50ZXIgR21iSDEkMCIGA1UECxMbVEMgVHJ1c3RDZW50ZXIgVW5pdmVyc2FsIENBMSYw
-JAYDVQQDEx1UQyBUcnVzdENlbnRlciBVbml2ZXJzYWwgQ0EgSTCCASIwDQYJKoZIhvcNAQEBBQAD
-ggEPADCCAQoCggEBAKR3I5ZEr5D0MacQ9CaHnPM42Q9e3s9B6DGtxnSRJJZ4Hgmgm5qVSkr1YnwC
-qMqs+1oEdjneX/H5s7/zA1hV0qq34wQi0fiU2iIIAI3TfCZdzHd55yx4Oagmcw6iXSVphU9VDprv
-xrlE4Vc93x9UIuVvZaozhDrzznq+VZeujRIPFDPiUHDDSYcTvFHe15gSWu86gzOSBnWLknwSaHtw
-ag+1m7Z3W0hZneTvWq3zwZ7U10VOylY0Ibw+F1tvdwxIAUMpsN0/lm7mlaoMwCC2/T42J5zjXM9O
-gdwZu5GQfezmlwQek8wiSdeXhrYTCjxDI3d+8NzmzSQfO4ObNDqDNOMCAwEAAaNjMGEwHwYDVR0j
-BBgwFoAUkqR1LKSevoFE63n8isWVpesQdXMwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMC
-AYYwHQYDVR0OBBYEFJKkdSyknr6BROt5/IrFlaXrEHVzMA0GCSqGSIb3DQEBBQUAA4IBAQAo0uCG
-1eb4e/CX3CJrO5UUVg8RMKWaTzqwOuAGy2X17caXJ/4l8lfmXpWMPmRgFVp/Lw0BxbFg/UU1z/Cy
-vwbZ71q+s2IhtNerNXxTPqYn8aEt2hojnczd7Dwtnic0XQ/CNnm8yUpiLe1r2X1BQ3y2qsrtYbE3
-ghUJGooWMNjsydZHcnhLEEYUjl8Or+zHL6sQ17bxbuyGssLoDZJz3KL0Dzq/YSMQiZxIQG5wALPT
-ujdEWBF6AmqI8Dc08BnprNRlc/ZpjGSUOnmFKbAWKwyCPwacx/0QK54PLLae4xW/2TYcuiUaUj0a
-7CIMHOCkoj3w6DnPgcB77V0fb8XQC9eY
------END CERTIFICATE-----
-
-Deutsche Telekom Root CA 2
-==========================
------BEGIN CERTIFICATE-----
-MIIDnzCCAoegAwIBAgIBJjANBgkqhkiG9w0BAQUFADBxMQswCQYDVQQGEwJERTEcMBoGA1UEChMT
-RGV1dHNjaGUgVGVsZWtvbSBBRzEfMB0GA1UECxMWVC1UZWxlU2VjIFRydXN0IENlbnRlcjEjMCEG
-A1UEAxMaRGV1dHNjaGUgVGVsZWtvbSBSb290IENBIDIwHhcNOTkwNzA5MTIxMTAwWhcNMTkwNzA5
-MjM1OTAwWjBxMQswCQYDVQQGEwJERTEcMBoGA1UEChMTRGV1dHNjaGUgVGVsZWtvbSBBRzEfMB0G
-A1UECxMWVC1UZWxlU2VjIFRydXN0IENlbnRlcjEjMCEGA1UEAxMaRGV1dHNjaGUgVGVsZWtvbSBS
-b290IENBIDIwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCrC6M14IspFLEUha88EOQ5
-bzVdSq7d6mGNlUn0b2SjGmBmpKlAIoTZ1KXleJMOaAGtuU1cOs7TuKhCQN/Po7qCWWqSG6wcmtoI
-KyUn+WkjR/Hg6yx6m/UTAtB+NHzCnjwAWav12gz1MjwrrFDa1sPeg5TKqAyZMg4ISFZbavva4VhY
-AUlfckE8FQYBjl2tqriTtM2e66foai1SNNs671x1Udrb8zH57nGYMsRUFUQM+ZtV7a3fGAigo4aK
-Se5TBY8ZTNXeWHmb0mocQqvF1afPaA+W5OFhmHZhyJF81j4A4pFQh+GdCuatl9Idxjp9y7zaAzTV
-jlsB9WoHtxa2bkp/AgMBAAGjQjBAMB0GA1UdDgQWBBQxw3kbuvVT1xfgiXotF2wKsyudMzAPBgNV
-HRMECDAGAQH/AgEFMA4GA1UdDwEB/wQEAwIBBjANBgkqhkiG9w0BAQUFAAOCAQEAlGRZrTlk5ynr
-E/5aw4sTV8gEJPB0d8Bg42f76Ymmg7+Wgnxu1MM9756AbrsptJh6sTtU6zkXR34ajgv8HzFZMQSy
-zhfzLMdiNlXiItiJVbSYSKpk+tYcNthEeFpaIzpXl/V6ME+un2pMSyuOoAPjPuCp1NJ70rOo4nI8
-rZ7/gFnkm0W09juwzTkZmDLl6iFhkOQxIY40sfcvNUqFENrnijchvllj4PKFiDFT1FQUhXB59C4G
-dyd1Lx+4ivn+xbrYNuSD7Odlt79jWvNGr4GUN9RBjNYj1h7P9WgbRGOiWrqnNVmh5XAFmw4jV5mU
-Cm26OWMohpLzGITY+9HPBVZkVw==
------END CERTIFICATE-----
-
-ComSign Secured CA
-==================
------BEGIN CERTIFICATE-----
-MIIDqzCCApOgAwIBAgIRAMcoRwmzuGxFjB36JPU2TukwDQYJKoZIhvcNAQEFBQAwPDEbMBkGA1UE
-AxMSQ29tU2lnbiBTZWN1cmVkIENBMRAwDgYDVQQKEwdDb21TaWduMQswCQYDVQQGEwJJTDAeFw0w
-NDAzMjQxMTM3MjBaFw0yOTAzMTYxNTA0NTZaMDwxGzAZBgNVBAMTEkNvbVNpZ24gU2VjdXJlZCBD
-QTEQMA4GA1UEChMHQ29tU2lnbjELMAkGA1UEBhMCSUwwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAw
-ggEKAoIBAQDGtWhfHZQVw6QIVS3joFd67+l0Kru5fFdJGhFeTymHDEjWaueP1H5XJLkGieQcPOqs
-49ohgHMhCu95mGwfCP+hUH3ymBvJVG8+pSjsIQQPRbsHPaHA+iqYHU4Gk/v1iDurX8sWv+bznkqH
-7Rnqwp9D5PGBpX8QTz7RSmKtUxvLg/8HZaWSLWapW7ha9B20IZFKF3ueMv5WJDmyVIRD9YTC2LxB
-kMyd1mja6YJQqTtoz7VdApRgFrFD2UNd3V2Hbuq7s8lr9gOUCXDeFhF6K+h2j0kQmHe5Y1yLM5d1
-9guMsqtb3nQgJT/j8xH5h2iGNXHDHYwt6+UarA9z1YJZQIDTAgMBAAGjgacwgaQwDAYDVR0TBAUw
-AwEB/zBEBgNVHR8EPTA7MDmgN6A1hjNodHRwOi8vZmVkaXIuY29tc2lnbi5jby5pbC9jcmwvQ29t
-U2lnblNlY3VyZWRDQS5jcmwwDgYDVR0PAQH/BAQDAgGGMB8GA1UdIwQYMBaAFMFL7XC29z58ADsA
-j8c+DkWfHl3sMB0GA1UdDgQWBBTBS+1wtvc+fAA7AI/HPg5Fnx5d7DANBgkqhkiG9w0BAQUFAAOC
-AQEAFs/ukhNQq3sUnjO2QiBq1BW9Cav8cujvR3qQrFHBZE7piL1DRYHjZiM/EoZNGeQFsOY3wo3a
-BijJD4mkU6l1P7CW+6tMM1X5eCZGbxs2mPtCdsGCuY7e+0X5YxtiOzkGynd6qDwJz2w2PQ8KRUtp
-FhpFfTMDZflScZAmlaxMDPWLkz/MdXSFmLr/YnpNH4n+rr2UAJm/EaXc4HnFFgt9AmEd6oX5AhVP
-51qJThRv4zdLhfXBPGHg/QVBspJ/wx2g0K5SZGBrGMYmnNj1ZOQ2GmKfig8+/21OGVZOIJFsnzQz
-OjRXUDpvgV4GxvU+fE6OK85lBi5d0ipTdF7Tbieejw==
------END CERTIFICATE-----
-
-Cybertrust Global Root
-======================
------BEGIN CERTIFICATE-----
-MIIDoTCCAomgAwIBAgILBAAAAAABD4WqLUgwDQYJKoZIhvcNAQEFBQAwOzEYMBYGA1UEChMPQ3li
-ZXJ0cnVzdCwgSW5jMR8wHQYDVQQDExZDeWJlcnRydXN0IEdsb2JhbCBSb290MB4XDTA2MTIxNTA4
-MDAwMFoXDTIxMTIxNTA4MDAwMFowOzEYMBYGA1UEChMPQ3liZXJ0cnVzdCwgSW5jMR8wHQYDVQQD
-ExZDeWJlcnRydXN0IEdsb2JhbCBSb290MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA
-+Mi8vRRQZhP/8NN57CPytxrHjoXxEnOmGaoQ25yiZXRadz5RfVb23CO21O1fWLE3TdVJDm71aofW
-0ozSJ8bi/zafmGWgE07GKmSb1ZASzxQG9Dvj1Ci+6A74q05IlG2OlTEQXO2iLb3VOm2yHLtgwEZL
-AfVJrn5GitB0jaEMAs7u/OePuGtm839EAL9mJRQr3RAwHQeWP032a7iPt3sMpTjr3kfb1V05/Iin
-89cqdPHoWqI7n1C6poxFNcJQZZXcY4Lv3b93TZxiyWNzFtApD0mpSPCzqrdsxacwOUBdrsTiXSZT
-8M4cIwhhqJQZugRiQOwfOHB3EgZxpzAYXSUnpQIDAQABo4GlMIGiMA4GA1UdDwEB/wQEAwIBBjAP
-BgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBS2CHsNesysIEyGVjJez6tuhS1wVzA/BgNVHR8EODA2
-MDSgMqAwhi5odHRwOi8vd3d3Mi5wdWJsaWMtdHJ1c3QuY29tL2NybC9jdC9jdHJvb3QuY3JsMB8G
-A1UdIwQYMBaAFLYIew16zKwgTIZWMl7Pq26FLXBXMA0GCSqGSIb3DQEBBQUAA4IBAQBW7wojoFRO
-lZfJ+InaRcHUowAl9B8Tq7ejhVhpwjCt2BWKLePJzYFa+HMjWqd8BfP9IjsO0QbE2zZMcwSO5bAi
-5MXzLqXZI+O4Tkogp24CJJ8iYGd7ix1yCcUxXOl5n4BHPa2hCwcUPUf/A2kaDAtE52Mlp3+yybh2
-hO0j9n0Hq0V+09+zv+mKts2oomcrUtW3ZfA5TGOgkXmTUg9U3YO7n9GPp1Nzw8v/MOx8BLjYRB+T
-X3EJIrduPuocA06dGiBh+4E37F78CkWr1+cXVdCg6mCbpvbjjFspwgZgFJ0tl0ypkxWdYcQBX0jW
-WL1WMRJOEcgh4LMRkWXbtKaIOM5V
------END CERTIFICATE-----
-
-ePKI Root Certification Authority
-=================================
------BEGIN CERTIFICATE-----
-MIIFsDCCA5igAwIBAgIQFci9ZUdcr7iXAF7kBtK8nTANBgkqhkiG9w0BAQUFADBeMQswCQYDVQQG
-EwJUVzEjMCEGA1UECgwaQ2h1bmdod2EgVGVsZWNvbSBDby4sIEx0ZC4xKjAoBgNVBAsMIWVQS0kg
-Um9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw0wNDEyMjAwMjMxMjdaFw0zNDEyMjAwMjMx
-MjdaMF4xCzAJBgNVBAYTAlRXMSMwIQYDVQQKDBpDaHVuZ2h3YSBUZWxlY29tIENvLiwgTHRkLjEq
-MCgGA1UECwwhZVBLSSBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIICIjANBgkqhkiG9w0B
-AQEFAAOCAg8AMIICCgKCAgEA4SUP7o3biDN1Z82tH306Tm2d0y8U82N0ywEhajfqhFAHSyZbCUNs
-IZ5qyNUD9WBpj8zwIuQf5/dqIjG3LBXy4P4AakP/h2XGtRrBp0xtInAhijHyl3SJCRImHJ7K2RKi
-lTza6We/CKBk49ZCt0Xvl/T29de1ShUCWH2YWEtgvM3XDZoTM1PRYfl61dd4s5oz9wCGzh1NlDiv
-qOx4UXCKXBCDUSH3ET00hl7lSM2XgYI1TBnsZfZrxQWh7kcT1rMhJ5QQCtkkO7q+RBNGMD+XPNjX
-12ruOzjjK9SXDrkb5wdJfzcq+Xd4z1TtW0ado4AOkUPB1ltfFLqfpo0kR0BZv3I4sjZsN/+Z0V0O
-WQqraffAsgRFelQArr5T9rXn4fg8ozHSqf4hUmTFpmfwdQcGlBSBVcYn5AGPF8Fqcde+S/uUWH1+
-ETOxQvdibBjWzwloPn9s9h6PYq2lY9sJpx8iQkEeb5mKPtf5P0B6ebClAZLSnT0IFaUQAS2zMnao
-lQ2zepr7BxB4EW/hj8e6DyUadCrlHJhBmd8hh+iVBmoKs2pHdmX2Os+PYhcZewoozRrSgx4hxyy/
-vv9haLdnG7t4TY3OZ+XkwY63I2binZB1NJipNiuKmpS5nezMirH4JYlcWrYvjB9teSSnUmjDhDXi
-Zo1jDiVN1Rmy5nk3pyKdVDECAwEAAaNqMGgwHQYDVR0OBBYEFB4M97Zn8uGSJglFwFU5Lnc/Qkqi
-MAwGA1UdEwQFMAMBAf8wOQYEZyoHAAQxMC8wLQIBADAJBgUrDgMCGgUAMAcGBWcqAwAABBRFsMLH
-ClZ87lt4DJX5GFPBphzYEDANBgkqhkiG9w0BAQUFAAOCAgEACbODU1kBPpVJufGBuvl2ICO1J2B0
-1GqZNF5sAFPZn/KmsSQHRGoqxqWOeBLoR9lYGxMqXnmbnwoqZ6YlPwZpVnPDimZI+ymBV3QGypzq
-KOg4ZyYr8dW1P2WT+DZdjo2NQCCHGervJ8A9tDkPJXtoUHRVnAxZfVo9QZQlUgjgRywVMRnVvwdV
-xrsStZf0X4OFunHB2WyBEXYKCrC/gpf36j36+uwtqSiUO1bd0lEursC9CBWMd1I0ltabrNMdjmEP
-NXubrjlpC2JgQCA2j6/7Nu4tCEoduL+bXPjqpRugc6bY+G7gMwRfaKonh+3ZwZCc7b3jajWvY9+r
-GNm65ulK6lCKD2GTHuItGeIwlDWSXQ62B68ZgI9HkFFLLk3dheLSClIKF5r8GrBQAuUBo2M3IUxE
-xJtRmREOc5wGj1QupyheRDmHVi03vYVElOEMSyycw5KFNGHLD7ibSkNS/jQ6fbjpKdx2qcgw+BRx
-gMYeNkh0IkFch4LoGHGLQYlE535YW6i4jRPpp2zDR+2zGp1iro2C6pSe3VkQw63d4k3jMdXH7Ojy
-sP6SHhYKGvzZ8/gntsm+HbRsZJB/9OTEW9c3rkIO3aQab3yIVMUWbuF6aC74Or8NpDyJO3inTmOD
-BCEIZ43ygknQW/2xzQ+DhNQ+IIX3Sj0rnP0qCglN6oH4EZw=
------END CERTIFICATE-----
-
-T\xc3\x9c\x42\xC4\xB0TAK UEKAE K\xC3\xB6k Sertifika Hizmet Sa\xC4\x9Flay\xc4\xb1\x63\xc4\xb1s\xc4\xb1 - S\xC3\xBCr\xC3\xBCm 3
-=============================================================================================================================
------BEGIN CERTIFICATE-----
-MIIFFzCCA/+gAwIBAgIBETANBgkqhkiG9w0BAQUFADCCASsxCzAJBgNVBAYTAlRSMRgwFgYDVQQH
-DA9HZWJ6ZSAtIEtvY2FlbGkxRzBFBgNVBAoMPlTDvHJraXllIEJpbGltc2VsIHZlIFRla25vbG9q
-aWsgQXJhxZ90xLFybWEgS3VydW11IC0gVMOcQsSwVEFLMUgwRgYDVQQLDD9VbHVzYWwgRWxla3Ry
-b25payB2ZSBLcmlwdG9sb2ppIEFyYcWfdMSxcm1hIEVuc3RpdMO8c8O8IC0gVUVLQUUxIzAhBgNV
-BAsMGkthbXUgU2VydGlmaWthc3lvbiBNZXJrZXppMUowSAYDVQQDDEFUw5xCxLBUQUsgVUVLQUUg
-S8O2ayBTZXJ0aWZpa2EgSGl6bWV0IFNhxJ9sYXnEsWPEsXPEsSAtIFPDvHLDvG0gMzAeFw0wNzA4
-MjQxMTM3MDdaFw0xNzA4MjExMTM3MDdaMIIBKzELMAkGA1UEBhMCVFIxGDAWBgNVBAcMD0dlYnpl
-IC0gS29jYWVsaTFHMEUGA1UECgw+VMO8cmtpeWUgQmlsaW1zZWwgdmUgVGVrbm9sb2ppayBBcmHF
-n3TEsXJtYSBLdXJ1bXUgLSBUw5xCxLBUQUsxSDBGBgNVBAsMP1VsdXNhbCBFbGVrdHJvbmlrIHZl
-IEtyaXB0b2xvamkgQXJhxZ90xLFybWEgRW5zdGl0w7xzw7wgLSBVRUtBRTEjMCEGA1UECwwaS2Ft
-dSBTZXJ0aWZpa2FzeW9uIE1lcmtlemkxSjBIBgNVBAMMQVTDnELEsFRBSyBVRUtBRSBLw7ZrIFNl
-cnRpZmlrYSBIaXptZXQgU2HEn2xhecSxY8Sxc8SxIC0gU8O8csO8bSAzMIIBIjANBgkqhkiG9w0B
-AQEFAAOCAQ8AMIIBCgKCAQEAim1L/xCIOsP2fpTo6iBkcK4hgb46ezzb8R1Sf1n68yJMlaCQvEhO
-Eav7t7WNeoMojCZG2E6VQIdhn8WebYGHV2yKO7Rm6sxA/OOqbLLLAdsyv9Lrhc+hDVXDWzhXcLh1
-xnnRFDDtG1hba+818qEhTsXOfJlfbLm4IpNQp81McGq+agV/E5wrHur+R84EpW+sky58K5+eeROR
-6Oqeyjh1jmKwlZMq5d/pXpduIF9fhHpEORlAHLpVK/swsoHvhOPc7Jg4OQOFCKlUAwUp8MmPi+oL
-hmUZEdPpCSPeaJMDyTYcIW7OjGbxmTDY17PDHfiBLqi9ggtm/oLL4eAagsNAgQIDAQABo0IwQDAd
-BgNVHQ4EFgQUvYiHyY/2pAoLquvF/pEjnatKijIwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQF
-MAMBAf8wDQYJKoZIhvcNAQEFBQADggEBAB18+kmPNOm3JpIWmgV050vQbTlswyb2zrgxvMTfvCr4
-N5EY3ATIZJkrGG2AA1nJrvhY0D7twyOfaTyGOBye79oneNGEN3GKPEs5z35FBtYt2IpNeBLWrcLT
-y9LQQfMmNkqblWwM7uXRQydmwYj3erMgbOqwaSvHIOgMA8RBBZniP+Rr+KCGgceExh/VS4ESshYh
-LBOhgLJeDEoTniDYYkCrkOpkSi+sDQESeUWoL4cZaMjihccwsnX5OD+ywJO0a+IDRM5noN+J1q2M
-dqMTw5RhK2vZbMEHCiIHhWyFJEapvj+LeISCfiQMnf2BN+MlqO02TpUsyZyQ2uypQjyttgI=
------END CERTIFICATE-----
-
-Buypass Class 2 CA 1
-====================
------BEGIN CERTIFICATE-----
-MIIDUzCCAjugAwIBAgIBATANBgkqhkiG9w0BAQUFADBLMQswCQYDVQQGEwJOTzEdMBsGA1UECgwU
-QnV5cGFzcyBBUy05ODMxNjMzMjcxHTAbBgNVBAMMFEJ1eXBhc3MgQ2xhc3MgMiBDQSAxMB4XDTA2
-MTAxMzEwMjUwOVoXDTE2MTAxMzEwMjUwOVowSzELMAkGA1UEBhMCTk8xHTAbBgNVBAoMFEJ1eXBh
-c3MgQVMtOTgzMTYzMzI3MR0wGwYDVQQDDBRCdXlwYXNzIENsYXNzIDIgQ0EgMTCCASIwDQYJKoZI
-hvcNAQEBBQADggEPADCCAQoCggEBAIs8B0XY9t/mx8q6jUPFR42wWsE425KEHK8T1A9vNkYgxC7M
-cXA0ojTTNy7Y3Tp3L8DrKehc0rWpkTSHIln+zNvnma+WwajHQN2lFYxuyHyXA8vmIPLXl18xoS83
-0r7uvqmtqEyeIWZDO6i88wmjONVZJMHCR3axiFyCO7srpgTXjAePzdVBHfCuuCkslFJgNJQ72uA4
-0Z0zPhX0kzLFANq1KWYOOngPIVJfAuWSeyXTkh4vFZ2B5J2O6O+JzhRMVB0cgRJNcKi+EAUXfh/R
-uFdV7c27UsKwHnjCTTZoy1YmwVLBvXb3WNVyfh9EdrsAiR0WnVE1703CVu9r4Iw7DekCAwEAAaNC
-MEAwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUP42aWYv8e3uco684sDntkHGA1sgwDgYDVR0P
-AQH/BAQDAgEGMA0GCSqGSIb3DQEBBQUAA4IBAQAVGn4TirnoB6NLJzKyQJHyIdFkhb5jatLPgcIV
-1Xp+DCmsNx4cfHZSldq1fyOhKXdlyTKdqC5Wq2B2zha0jX94wNWZUYN/Xtm+DKhQ7SLHrQVMdvvt
-7h5HZPb3J31cKA9FxVxiXqaakZG3Uxcu3K1gnZZkOb1naLKuBctN518fV4bVIJwo+28TOPX2EZL2
-fZleHwzoq0QkKXJAPTZSr4xYkHPB7GEseaHsh7U/2k3ZIQAw3pDaDtMaSKk+hQsUi4y8QZ5q9w5w
-wDX3OaJdZtB7WZ+oRxKaJyOkLY4ng5IgodcVf/EuGO70SH8vf/GhGLWhC5SgYiAynB321O+/TIho
------END CERTIFICATE-----
-
-Buypass Class 3 CA 1
-====================
------BEGIN CERTIFICATE-----
-MIIDUzCCAjugAwIBAgIBAjANBgkqhkiG9w0BAQUFADBLMQswCQYDVQQGEwJOTzEdMBsGA1UECgwU
-QnV5cGFzcyBBUy05ODMxNjMzMjcxHTAbBgNVBAMMFEJ1eXBhc3MgQ2xhc3MgMyBDQSAxMB4XDTA1
-MDUwOTE0MTMwM1oXDTE1MDUwOTE0MTMwM1owSzELMAkGA1UEBhMCTk8xHTAbBgNVBAoMFEJ1eXBh
-c3MgQVMtOTgzMTYzMzI3MR0wGwYDVQQDDBRCdXlwYXNzIENsYXNzIDMgQ0EgMTCCASIwDQYJKoZI
-hvcNAQEBBQADggEPADCCAQoCggEBAKSO13TZKWTeXx+HgJHqTjnmGcZEC4DVC69TB4sSveZn8AKx
-ifZgisRbsELRwCGoy+Gb72RRtqfPFfV0gGgEkKBYouZ0plNTVUhjP5JW3SROjvi6K//zNIqeKNc0
-n6wv1g/xpC+9UrJJhW05NfBEMJNGJPO251P7vGGvqaMU+8IXF4Rs4HyI+MkcVyzwPX6UvCWThOia
-AJpFBUJXgPROztmuOfbIUxAMZTpHe2DC1vqRycZxbL2RhzyRhkmr8w+gbCZ2Xhysm3HljbybIR6c
-1jh+JIAVMYKWsUnTYjdbiAwKYjT+p0h+mbEwi5A3lRyoH6UsjfRVyNvdWQrCrXig9IsCAwEAAaNC
-MEAwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUOBTmyPCppAP0Tj4io1vy1uCtQHQwDgYDVR0P
-AQH/BAQDAgEGMA0GCSqGSIb3DQEBBQUAA4IBAQABZ6OMySU9E2NdFm/soT4JXJEVKirZgCFPBdy7
-pYmrEzMqnji3jG8CcmPHc3ceCQa6Oyh7pEfJYWsICCD8igWKH7y6xsL+z27sEzNxZy5p+qksP2bA
-EllNC1QCkoS72xLvg3BweMhT+t/Gxv/ciC8HwEmdMldg0/L2mSlf56oBzKwzqBwKu5HEA6BvtjT5
-htOzdlSY9EqBs1OdTUDs5XcTRa9bqh/YL0yCe/4qxFi7T/ye/QNlGioOw6UgFpRreaaiErS7GqQj
-el/wroQk5PMr+4okoyeYZdowdXb8GZHo2+ubPzK/QJcHJrrM85SFSnonk8+QQtS4Wxam58tAA915
------END CERTIFICATE-----
-
-EBG Elektronik Sertifika Hizmet Sa\xC4\x9Flay\xc4\xb1\x63\xc4\xb1s\xc4\xb1
-==========================================================================
------BEGIN CERTIFICATE-----
-MIIF5zCCA8+gAwIBAgIITK9zQhyOdAIwDQYJKoZIhvcNAQEFBQAwgYAxODA2BgNVBAMML0VCRyBF
-bGVrdHJvbmlrIFNlcnRpZmlrYSBIaXptZXQgU2HEn2xhecSxY8Sxc8SxMTcwNQYDVQQKDC5FQkcg
-QmlsacWfaW0gVGVrbm9sb2ppbGVyaSB2ZSBIaXptZXRsZXJpIEEuxZ4uMQswCQYDVQQGEwJUUjAe
-Fw0wNjA4MTcwMDIxMDlaFw0xNjA4MTQwMDMxMDlaMIGAMTgwNgYDVQQDDC9FQkcgRWxla3Ryb25p
-ayBTZXJ0aWZpa2EgSGl6bWV0IFNhxJ9sYXnEsWPEsXPEsTE3MDUGA1UECgwuRUJHIEJpbGnFn2lt
-IFRla25vbG9qaWxlcmkgdmUgSGl6bWV0bGVyaSBBLsWeLjELMAkGA1UEBhMCVFIwggIiMA0GCSqG
-SIb3DQEBAQUAA4ICDwAwggIKAoICAQDuoIRh0DpqZhAy2DE4f6en5f2h4fuXd7hxlugTlkaDT7by
-X3JWbhNgpQGR4lvFzVcfd2NR/y8927k/qqk153nQ9dAktiHq6yOU/im/+4mRDGSaBUorzAzu8T2b
-gmmkTPiab+ci2hC6X5L8GCcKqKpE+i4stPtGmggDg3KriORqcsnlZR9uKg+ds+g75AxuetpX/dfr
-eYteIAbTdgtsApWjluTLdlHRKJ2hGvxEok3MenaoDT2/F08iiFD9rrbskFBKW5+VQarKD7JK/oCZ
-TqNGFav4c0JqwmZ2sQomFd2TkuzbqV9UIlKRcF0T6kjsbgNs2d1s/OsNA/+mgxKb8amTD8UmTDGy
-Y5lhcucqZJnSuOl14nypqZoaqsNW2xCaPINStnuWt6yHd6i58mcLlEOzrz5z+kI2sSXFCjEmN1Zn
-uqMLfdb3ic1nobc6HmZP9qBVFCVMLDMNpkGMvQQxahByCp0OLna9XvNRiYuoP1Vzv9s6xiQFlpJI
-qkuNKgPlV5EQ9GooFW5Hd4RcUXSfGenmHmMWOeMRFeNYGkS9y8RsZteEBt8w9DeiQyJ50hBs37vm
-ExH8nYQKE3vwO9D8owrXieqWfo1IhR5kX9tUoqzVegJ5a9KK8GfaZXINFHDk6Y54jzJ0fFfy1tb0
-Nokb+Clsi7n2l9GkLqq+CxnCRelwXQIDAJ3Zo2MwYTAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB
-/wQEAwIBBjAdBgNVHQ4EFgQU587GT/wWZ5b6SqMHwQSny2re2kcwHwYDVR0jBBgwFoAU587GT/wW
-Z5b6SqMHwQSny2re2kcwDQYJKoZIhvcNAQEFBQADggIBAJuYml2+8ygjdsZs93/mQJ7ANtyVDR2t
-FcU22NU57/IeIl6zgrRdu0waypIN30ckHrMk2pGI6YNw3ZPX6bqz3xZaPt7gyPvT/Wwp+BVGoGgm
-zJNSroIBk5DKd8pNSe/iWtkqvTDOTLKBtjDOWU/aWR1qeqRFsIImgYZ29fUQALjuswnoT4cCB64k
-XPBfrAowzIpAoHMEwfuJJPaaHFy3PApnNgUIMbOv2AFoKuB4j3TeuFGkjGwgPaL7s9QJ/XvCgKqT
-bCmYIai7FvOpEl90tYeY8pUm3zTvilORiF0alKM/fCL414i6poyWqD1SNGKfAB5UVUJnxk1Gj7sU
-RT0KlhaOEKGXmdXTMIXM3rRyt7yKPBgpaP3ccQfuJDlq+u2lrDgv+R4QDgZxGhBM/nV+/x5XOULK
-1+EVoVZVWRvRo68R2E7DpSvvkL/A7IITW43WciyTTo9qKd+FPNMN4KIYEsxVL0e3p5sC/kH2iExt
-2qkBR4NkJ2IQgtYSe14DHzSpyZH+r11thie3I6p1GMog57AP14kOpmciY/SDQSsGS7tY1dHXt7kQ
-Y9iJSrSq3RZj9W6+YKH47ejWkE8axsWgKdOnIaj1Wjz3x0miIZpKlVIglnKaZsv30oZDfCK+lvm9
-AahH3eU7QPl1K5srRmSGjR70j/sHd9DqSaIcjVIUpgqT
------END CERTIFICATE-----
-
-certSIGN ROOT CA
-================
------BEGIN CERTIFICATE-----
-MIIDODCCAiCgAwIBAgIGIAYFFnACMA0GCSqGSIb3DQEBBQUAMDsxCzAJBgNVBAYTAlJPMREwDwYD
-VQQKEwhjZXJ0U0lHTjEZMBcGA1UECxMQY2VydFNJR04gUk9PVCBDQTAeFw0wNjA3MDQxNzIwMDRa
-Fw0zMTA3MDQxNzIwMDRaMDsxCzAJBgNVBAYTAlJPMREwDwYDVQQKEwhjZXJ0U0lHTjEZMBcGA1UE
-CxMQY2VydFNJR04gUk9PVCBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALczuX7I
-JUqOtdu0KBuqV5Do0SLTZLrTk+jUrIZhQGpgV2hUhE28alQCBf/fm5oqrl0Hj0rDKH/v+yv6efHH
-rfAQUySQi2bJqIirr1qjAOm+ukbuW3N7LBeCgV5iLKECZbO9xSsAfsT8AzNXDe3i+s5dRdY4zTW2
-ssHQnIFKquSyAVwdj1+ZxLGt24gh65AIgoDzMKND5pCCrlUoSe1b16kQOA7+j0xbm0bqQfWwCHTD
-0IgztnzXdN/chNFDDnU5oSVAKOp4yw4sLjmdjItuFhwvJoIQ4uNllAoEwF73XVv4EOLQunpL+943
-AAAaWyjj0pxzPjKHmKHJUS/X3qwzs08CAwEAAaNCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8B
-Af8EBAMCAcYwHQYDVR0OBBYEFOCMm9slSbPxfIbWskKHC9BroNnkMA0GCSqGSIb3DQEBBQUAA4IB
-AQA+0hyJLjX8+HXd5n9liPRyTMks1zJO890ZeUe9jjtbkw9QSSQTaxQGcu8J06Gh40CEyecYMnQ8
-SG4Pn0vU9x7Tk4ZkVJdjclDVVc/6IJMCopvDI5NOFlV2oHB5bc0hH88vLbwZ44gx+FkagQnIl6Z0
-x2DEW8xXjrJ1/RsCCdtZb3KTafcxQdaIOL+Hsr0Wefmq5L6IJd1hJyMctTEHBDa0GpC9oHRxUIlt
-vBTjD4au8as+x6AJzKNI0eDbZOeStc+vckNwi/nDhDwTqn6Sm1dTk/pwwpEOMfmbZ13pljheX7Nz
-TogVZ96edhBiIL5VaZVDADlN9u6wWk5JRFRYX0KD
------END CERTIFICATE-----
-
-CNNIC ROOT
-==========
------BEGIN CERTIFICATE-----
-MIIDVTCCAj2gAwIBAgIESTMAATANBgkqhkiG9w0BAQUFADAyMQswCQYDVQQGEwJDTjEOMAwGA1UE
-ChMFQ05OSUMxEzARBgNVBAMTCkNOTklDIFJPT1QwHhcNMDcwNDE2MDcwOTE0WhcNMjcwNDE2MDcw
-OTE0WjAyMQswCQYDVQQGEwJDTjEOMAwGA1UEChMFQ05OSUMxEzARBgNVBAMTCkNOTklDIFJPT1Qw
-ggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDTNfc/c3et6FtzF8LRb+1VvG7q6KR5smzD
-o+/hn7E7SIX1mlwhIhAsxYLO2uOabjfhhyzcuQxauohV3/2q2x8x6gHx3zkBwRP9SFIhxFXf2tiz
-VHa6dLG3fdfA6PZZxU3Iva0fFNrfWEQlMhkqx35+jq44sDB7R3IJMfAw28Mbdim7aXZOV/kbZKKT
-VrdvmW7bCgScEeOAH8tjlBAKqeFkgjH5jCftppkA9nCTGPihNIaj3XrCGHn2emU1z5DrvTOTn1Or
-czvmmzQgLx3vqR1jGqCA2wMv+SYahtKNu6m+UjqHZ0gNv7Sg2Ca+I19zN38m5pIEo3/PIKe38zrK
-y5nLAgMBAAGjczBxMBEGCWCGSAGG+EIBAQQEAwIABzAfBgNVHSMEGDAWgBRl8jGtKvf33VKWCscC
-wQ7vptU7ETAPBgNVHRMBAf8EBTADAQH/MAsGA1UdDwQEAwIB/jAdBgNVHQ4EFgQUZfIxrSr3991S
-lgrHAsEO76bVOxEwDQYJKoZIhvcNAQEFBQADggEBAEs17szkrr/Dbq2flTtLP1se31cpolnKOOK5
-Gv+e5m4y3R6u6jW39ZORTtpC4cMXYFDy0VwmuYK36m3knITnA3kXr5g9lNvHugDnuL8BV8F3RTIM
-O/G0HAiw/VGgod2aHRM2mm23xzy54cXZF/qD1T0VoDy7HgviyJA/qIYM/PmLXoXLT1tLYhFHxUV8
-BS9BsZ4QaRuZluBVeftOhpm4lNqGOGqTo+fLbuXf6iFViZx9fX+Y9QCJ7uOEwFyWtcVG6kbghVW2
-G8kS1sHNzYDzAgE8yGnLRUhj2JTQ7IUOO04RZfSCjKY9ri4ilAnIXOo8gV0WKgOXFlUJ24pBgp5m
-mxE=
------END CERTIFICATE-----
-
-ApplicationCA - Japanese Government
-===================================
------BEGIN CERTIFICATE-----
-MIIDoDCCAoigAwIBAgIBMTANBgkqhkiG9w0BAQUFADBDMQswCQYDVQQGEwJKUDEcMBoGA1UEChMT
-SmFwYW5lc2UgR292ZXJubWVudDEWMBQGA1UECxMNQXBwbGljYXRpb25DQTAeFw0wNzEyMTIxNTAw
-MDBaFw0xNzEyMTIxNTAwMDBaMEMxCzAJBgNVBAYTAkpQMRwwGgYDVQQKExNKYXBhbmVzZSBHb3Zl
-cm5tZW50MRYwFAYDVQQLEw1BcHBsaWNhdGlvbkNBMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIB
-CgKCAQEAp23gdE6Hj6UG3mii24aZS2QNcfAKBZuOquHMLtJqO8F6tJdhjYq+xpqcBrSGUeQ3DnR4
-fl+Kf5Sk10cI/VBaVuRorChzoHvpfxiSQE8tnfWuREhzNgaeZCw7NCPbXCbkcXmP1G55IrmTwcrN
-wVbtiGrXoDkhBFcsovW8R0FPXjQilbUfKW1eSvNNcr5BViCH/OlQR9cwFO5cjFW6WY2H/CPek9AE
-jP3vbb3QesmlOmpyM8ZKDQUXKi17safY1vC+9D/qDihtQWEjdnjDuGWk81quzMKq2edY3rZ+nYVu
-nyoKb58DKTCXKB28t89UKU5RMfkntigm/qJj5kEW8DOYRwIDAQABo4GeMIGbMB0GA1UdDgQWBBRU
-WssmP3HMlEYNllPqa0jQk/5CdTAOBgNVHQ8BAf8EBAMCAQYwWQYDVR0RBFIwUKROMEwxCzAJBgNV
-BAYTAkpQMRgwFgYDVQQKDA/ml6XmnKzlm73mlL/lupwxIzAhBgNVBAsMGuOCouODl+ODquOCseOD
-vOOCt+ODp+ODs0NBMA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQEFBQADggEBADlqRHZ3ODrs
-o2dGD/mLBqj7apAxzn7s2tGJfHrrLgy9mTLnsCTWw//1sogJhyzjVOGjprIIC8CFqMjSnHH2HZ9g
-/DgzE+Ge3Atf2hZQKXsvcJEPmbo0NI2VdMV+eKlmXb3KIXdCEKxmJj3ekav9FfBv7WxfEPjzFvYD
-io+nEhEMy/0/ecGc/WLuo89UDNErXxc+4z6/wCs+CZv+iKZ+tJIX/COUgb1up8WMwusRRdv4QcmW
-dupwX3kSa+SjB1oF7ydJzyGfikwJcGapJsErEU4z0g781mzSDjJkaP+tBXhfAx2o45CsJOAPQKdL
-rosot4LKGAfmt1t06SAZf7IbiVQ=
------END CERTIFICATE-----
-
-GeoTrust Primary Certification Authority - G3
-=============================================
------BEGIN CERTIFICATE-----
-MIID/jCCAuagAwIBAgIQFaxulBmyeUtB9iepwxgPHzANBgkqhkiG9w0BAQsFADCBmDELMAkGA1UE
-BhMCVVMxFjAUBgNVBAoTDUdlb1RydXN0IEluYy4xOTA3BgNVBAsTMChjKSAyMDA4IEdlb1RydXN0
-IEluYy4gLSBGb3IgYXV0aG9yaXplZCB1c2Ugb25seTE2MDQGA1UEAxMtR2VvVHJ1c3QgUHJpbWFy
-eSBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSAtIEczMB4XDTA4MDQwMjAwMDAwMFoXDTM3MTIwMTIz
-NTk1OVowgZgxCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1HZW9UcnVzdCBJbmMuMTkwNwYDVQQLEzAo
-YykgMjAwOCBHZW9UcnVzdCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxNjA0BgNVBAMT
-LUdlb1RydXN0IFByaW1hcnkgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgLSBHMzCCASIwDQYJKoZI
-hvcNAQEBBQADggEPADCCAQoCggEBANziXmJYHTNXOTIz+uvLh4yn1ErdBojqZI4xmKU4kB6Yzy5j
-K/BGvESyiaHAKAxJcCGVn2TAppMSAmUmhsalifD614SgcK9PGpc/BkTVyetyEH3kMSj7HGHmKAdE
-c5IiaacDiGydY8hS2pgn5whMcD60yRLBxWeDXTPzAxHsatBT4tG6NmCUgLthY2xbF37fQJQeqw3C
-IShwiP/WJmxsYAQlTlV+fe+/lEjetx3dcI0FX4ilm/LC7urRQEFtYjgdVgbFA0dRIBn8exALDmKu
-dlW/X3e+PkkBUz2YJQN2JFodtNuJ6nnltrM7P7pMKEF/BqxqjsHQ9gUdfeZChuOl1UcCAwEAAaNC
-MEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFMR5yo6hTgMdHNxr
-2zFblD4/MH8tMA0GCSqGSIb3DQEBCwUAA4IBAQAtxRPPVoB7eni9n64smefv2t+UXglpp+duaIy9
-cr5HqQ6XErhK8WTTOd8lNNTBzU6B8A8ExCSzNJbGpqow32hhc9f5joWJ7w5elShKKiePEI4ufIbE
-Ap7aDHdlDkQNkv39sxY2+hENHYwOB4lqKVb3cvTdFZx3NWZXqxNT2I7BQMXXExZacse3aQHEerGD
-AWh9jUGhlBjBJVz88P6DAod8DQ3PLghcSkANPuyBYeYk28rgDi0Hsj5W3I31QYUHSJsMC8tJP33s
-t/3LjWeJGqvtux6jAAgIFyqCXDFdRootD4abdNlF+9RAsXqqaC2Gspki4cErx5z481+oghLrGREt
------END CERTIFICATE-----
-
-thawte Primary Root CA - G2
-===========================
------BEGIN CERTIFICATE-----
-MIICiDCCAg2gAwIBAgIQNfwmXNmET8k9Jj1Xm67XVjAKBggqhkjOPQQDAzCBhDELMAkGA1UEBhMC
-VVMxFTATBgNVBAoTDHRoYXd0ZSwgSW5jLjE4MDYGA1UECxMvKGMpIDIwMDcgdGhhd3RlLCBJbmMu
-IC0gRm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxJDAiBgNVBAMTG3RoYXd0ZSBQcmltYXJ5IFJvb3Qg
-Q0EgLSBHMjAeFw0wNzExMDUwMDAwMDBaFw0zODAxMTgyMzU5NTlaMIGEMQswCQYDVQQGEwJVUzEV
-MBMGA1UEChMMdGhhd3RlLCBJbmMuMTgwNgYDVQQLEy8oYykgMjAwNyB0aGF3dGUsIEluYy4gLSBG
-b3IgYXV0aG9yaXplZCB1c2Ugb25seTEkMCIGA1UEAxMbdGhhd3RlIFByaW1hcnkgUm9vdCBDQSAt
-IEcyMHYwEAYHKoZIzj0CAQYFK4EEACIDYgAEotWcgnuVnfFSeIf+iha/BebfowJPDQfGAFG6DAJS
-LSKkQjnE/o/qycG+1E3/n3qe4rF8mq2nhglzh9HnmuN6papu+7qzcMBniKI11KOasf2twu8x+qi5
-8/sIxpHR+ymVo0IwQDAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQU
-mtgAMADna3+FGO6Lts6KDPgR4bswCgYIKoZIzj0EAwMDaQAwZgIxAN344FdHW6fmCsO99YCKlzUN
-G4k8VIZ3KMqh9HneteY4sPBlcIx/AlTCv//YoT7ZzwIxAMSNlPzcU9LcnXgWHxUzI1NS41oxXZ3K
-rr0TKUQNJ1uo52icEvdYPy5yAlejj6EULg==
------END CERTIFICATE-----
-
-thawte Primary Root CA - G3
-===========================
------BEGIN CERTIFICATE-----
-MIIEKjCCAxKgAwIBAgIQYAGXt0an6rS0mtZLL/eQ+zANBgkqhkiG9w0BAQsFADCBrjELMAkGA1UE
-BhMCVVMxFTATBgNVBAoTDHRoYXd0ZSwgSW5jLjEoMCYGA1UECxMfQ2VydGlmaWNhdGlvbiBTZXJ2
-aWNlcyBEaXZpc2lvbjE4MDYGA1UECxMvKGMpIDIwMDggdGhhd3RlLCBJbmMuIC0gRm9yIGF1dGhv
-cml6ZWQgdXNlIG9ubHkxJDAiBgNVBAMTG3RoYXd0ZSBQcmltYXJ5IFJvb3QgQ0EgLSBHMzAeFw0w
-ODA0MDIwMDAwMDBaFw0zNzEyMDEyMzU5NTlaMIGuMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMdGhh
-d3RlLCBJbmMuMSgwJgYDVQQLEx9DZXJ0aWZpY2F0aW9uIFNlcnZpY2VzIERpdmlzaW9uMTgwNgYD
-VQQLEy8oYykgMjAwOCB0aGF3dGUsIEluYy4gLSBGb3IgYXV0aG9yaXplZCB1c2Ugb25seTEkMCIG
-A1UEAxMbdGhhd3RlIFByaW1hcnkgUm9vdCBDQSAtIEczMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8A
-MIIBCgKCAQEAsr8nLPvb2FvdeHsbnndmgcs+vHyu86YnmjSjaDFxODNi5PNxZnmxqWWjpYvVj2At
-P0LMqmsywCPLLEHd5N/8YZzic7IilRFDGF/Eth9XbAoFWCLINkw6fKXRz4aviKdEAhN0cXMKQlkC
-+BsUa0Lfb1+6a4KinVvnSr0eAXLbS3ToO39/fR8EtCab4LRarEc9VbjXsCZSKAExQGbY2SS99irY
-7CFJXJv2eul/VTV+lmuNk5Mny5K76qxAwJ/C+IDPXfRa3M50hqY+bAtTyr2SzhkGcuYMXDhpxwTW
-vGzOW/b3aJzcJRVIiKHpqfiYnODz1TEoYRFsZ5aNOZnLwkUkOQIDAQABo0IwQDAPBgNVHRMBAf8E
-BTADAQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUrWyqlGCc7eT/+j4KdCtjA/e2Wb8wDQYJ
-KoZIhvcNAQELBQADggEBABpA2JVlrAmSicY59BDlqQ5mU1143vokkbvnRFHfxhY0Cu9qRFHqKweK
-A3rD6z8KLFIWoCtDuSWQP3CpMyVtRRooOyfPqsMpQhvfO0zAMzRbQYi/aytlryjvsvXDqmbOe1bu
-t8jLZ8HJnBoYuMTDSQPxYA5QzUbF83d597YV4Djbxy8ooAw/dyZ02SUS2jHaGh7cKUGRIjxpp7sC
-8rZcJwOJ9Abqm+RyguOhCcHpABnTPtRwa7pxpqpYrvS76Wy274fMm7v/OeZWYdMKp8RcTGB7BXcm
-er/YB1IsYvdwY9k5vG8cwnncdimvzsUsZAReiDZuMdRAGmI0Nj81Aa6sY6A=
------END CERTIFICATE-----
-
-GeoTrust Primary Certification Authority - G2
-=============================================
------BEGIN CERTIFICATE-----
-MIICrjCCAjWgAwIBAgIQPLL0SAoA4v7rJDteYD7DazAKBggqhkjOPQQDAzCBmDELMAkGA1UEBhMC
-VVMxFjAUBgNVBAoTDUdlb1RydXN0IEluYy4xOTA3BgNVBAsTMChjKSAyMDA3IEdlb1RydXN0IElu
-Yy4gLSBGb3IgYXV0aG9yaXplZCB1c2Ugb25seTE2MDQGA1UEAxMtR2VvVHJ1c3QgUHJpbWFyeSBD
-ZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSAtIEcyMB4XDTA3MTEwNTAwMDAwMFoXDTM4MDExODIzNTk1
-OVowgZgxCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1HZW9UcnVzdCBJbmMuMTkwNwYDVQQLEzAoYykg
-MjAwNyBHZW9UcnVzdCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxNjA0BgNVBAMTLUdl
-b1RydXN0IFByaW1hcnkgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgLSBHMjB2MBAGByqGSM49AgEG
-BSuBBAAiA2IABBWx6P0DFUPlrOuHNxFi79KDNlJ9RVcLSo17VDs6bl8VAsBQps8lL33KSLjHUGMc
-KiEIfJo22Av+0SbFWDEwKCXzXV2juLaltJLtbCyf691DiaI8S0iRHVDsJt/WYC69IaNCMEAwDwYD
-VR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFBVfNVdRVfslsq0DafwBo/q+
-EVXVMAoGCCqGSM49BAMDA2cAMGQCMGSWWaboCd6LuvpaiIjwH5HTRqjySkwCY/tsXzjbLkGTqQ7m
-ndwxHLKgpxgceeHHNgIwOlavmnRs9vuD4DPTCF+hnMJbn0bWtsuRBmOiBuczrD6ogRLQy7rQkgu2
-npaqBA+K
------END CERTIFICATE-----
-
-VeriSign Universal Root Certification Authority
-===============================================
------BEGIN CERTIFICATE-----
-MIIEuTCCA6GgAwIBAgIQQBrEZCGzEyEDDrvkEhrFHTANBgkqhkiG9w0BAQsFADCBvTELMAkGA1UE
-BhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQLExZWZXJpU2lnbiBUcnVzdCBO
-ZXR3b3JrMTowOAYDVQQLEzEoYykgMjAwOCBWZXJpU2lnbiwgSW5jLiAtIEZvciBhdXRob3JpemVk
-IHVzZSBvbmx5MTgwNgYDVQQDEy9WZXJpU2lnbiBVbml2ZXJzYWwgUm9vdCBDZXJ0aWZpY2F0aW9u
-IEF1dGhvcml0eTAeFw0wODA0MDIwMDAwMDBaFw0zNzEyMDEyMzU5NTlaMIG9MQswCQYDVQQGEwJV
-UzEXMBUGA1UEChMOVmVyaVNpZ24sIEluYy4xHzAdBgNVBAsTFlZlcmlTaWduIFRydXN0IE5ldHdv
-cmsxOjA4BgNVBAsTMShjKSAyMDA4IFZlcmlTaWduLCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNl
-IG9ubHkxODA2BgNVBAMTL1ZlcmlTaWduIFVuaXZlcnNhbCBSb290IENlcnRpZmljYXRpb24gQXV0
-aG9yaXR5MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAx2E3XrEBNNti1xWb/1hajCMj
-1mCOkdeQmIN65lgZOIzF9uVkhbSicfvtvbnazU0AtMgtc6XHaXGVHzk8skQHnOgO+k1KxCHfKWGP
-MiJhgsWHH26MfF8WIFFE0XBPV+rjHOPMee5Y2A7Cs0WTwCznmhcrewA3ekEzeOEz4vMQGn+HLL72
-9fdC4uW/h2KJXwBL38Xd5HVEMkE6HnFuacsLdUYI0crSK5XQz/u5QGtkjFdN/BMReYTtXlT2NJ8I
-AfMQJQYXStrxHXpma5hgZqTZ79IugvHw7wnqRMkVauIDbjPTrJ9VAMf2CGqUuV/c4DPxhGD5WycR
-tPwW8rtWaoAljQIDAQABo4GyMIGvMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMG0G
-CCsGAQUFBwEMBGEwX6FdoFswWTBXMFUWCWltYWdlL2dpZjAhMB8wBwYFKw4DAhoEFI/l0xqGrI2O
-a8PPgGrUSBgsexkuMCUWI2h0dHA6Ly9sb2dvLnZlcmlzaWduLmNvbS92c2xvZ28uZ2lmMB0GA1Ud
-DgQWBBS2d/ppSEefUxLVwuoHMnYH0ZcHGTANBgkqhkiG9w0BAQsFAAOCAQEASvj4sAPmLGd75JR3
-Y8xuTPl9Dg3cyLk1uXBPY/ok+myDjEedO2Pzmvl2MpWRsXe8rJq+seQxIcaBlVZaDrHC1LGmWazx
-Y8u4TB1ZkErvkBYoH1quEPuBUDgMbMzxPcP1Y+Oz4yHJJDnp/RVmRvQbEdBNc6N9Rvk97ahfYtTx
-P/jgdFcrGJ2BtMQo2pSXpXDrrB2+BxHw1dvd5Yzw1TKwg+ZX4o+/vqGqvz0dtdQ46tewXDpPaj+P
-wGZsY6rp2aQW9IHRlRQOfc2VNNnSj3BzgXucfr2YYdhFh5iQxeuGMMY1v/D/w1WIg0vvBZIGcfK4
-mJO37M2CYfE45k+XmCpajQ==
------END CERTIFICATE-----
-
-VeriSign Class 3 Public Primary Certification Authority - G4
-============================================================
------BEGIN CERTIFICATE-----
-MIIDhDCCAwqgAwIBAgIQL4D+I4wOIg9IZxIokYesszAKBggqhkjOPQQDAzCByjELMAkGA1UEBhMC
-VVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQLExZWZXJpU2lnbiBUcnVzdCBOZXR3
-b3JrMTowOAYDVQQLEzEoYykgMjAwNyBWZXJpU2lnbiwgSW5jLiAtIEZvciBhdXRob3JpemVkIHVz
-ZSBvbmx5MUUwQwYDVQQDEzxWZXJpU2lnbiBDbGFzcyAzIFB1YmxpYyBQcmltYXJ5IENlcnRpZmlj
-YXRpb24gQXV0aG9yaXR5IC0gRzQwHhcNMDcxMTA1MDAwMDAwWhcNMzgwMTE4MjM1OTU5WjCByjEL
-MAkGA1UEBhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQLExZWZXJpU2lnbiBU
-cnVzdCBOZXR3b3JrMTowOAYDVQQLEzEoYykgMjAwNyBWZXJpU2lnbiwgSW5jLiAtIEZvciBhdXRo
-b3JpemVkIHVzZSBvbmx5MUUwQwYDVQQDEzxWZXJpU2lnbiBDbGFzcyAzIFB1YmxpYyBQcmltYXJ5
-IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IC0gRzQwdjAQBgcqhkjOPQIBBgUrgQQAIgNiAASnVnp8
-Utpkmw4tXNherJI9/gHmGUo9FANL+mAnINmDiWn6VMaaGF5VKmTeBvaNSjutEDxlPZCIBIngMGGz
-rl0Bp3vefLK+ymVhAIau2o970ImtTR1ZmkGxvEeA3J5iw/mjgbIwga8wDwYDVR0TAQH/BAUwAwEB
-/zAOBgNVHQ8BAf8EBAMCAQYwbQYIKwYBBQUHAQwEYTBfoV2gWzBZMFcwVRYJaW1hZ2UvZ2lmMCEw
-HzAHBgUrDgMCGgQUj+XTGoasjY5rw8+AatRIGCx7GS4wJRYjaHR0cDovL2xvZ28udmVyaXNpZ24u
-Y29tL3ZzbG9nby5naWYwHQYDVR0OBBYEFLMWkf3upm7ktS5Jj4d4gYDs5bG1MAoGCCqGSM49BAMD
-A2gAMGUCMGYhDBgmYFo4e1ZC4Kf8NoRRkSAsdk1DPcQdhCPQrNZ8NQbOzWm9kA3bbEhCHQ6qQgIx
-AJw9SDkjOVgaFRJZap7v1VmyHVIsmXHNxynfGyphe3HR3vPA5Q06Sqotp9iGKt0uEA==
------END CERTIFICATE-----
-
-NetLock Arany (Class Gold) Főtanúsítvány
-============================================
------BEGIN CERTIFICATE-----
-MIIEFTCCAv2gAwIBAgIGSUEs5AAQMA0GCSqGSIb3DQEBCwUAMIGnMQswCQYDVQQGEwJIVTERMA8G
-A1UEBwwIQnVkYXBlc3QxFTATBgNVBAoMDE5ldExvY2sgS2Z0LjE3MDUGA1UECwwuVGFuw7pzw610
-dsOhbnlraWFkw7NrIChDZXJ0aWZpY2F0aW9uIFNlcnZpY2VzKTE1MDMGA1UEAwwsTmV0TG9jayBB
-cmFueSAoQ2xhc3MgR29sZCkgRsWRdGFuw7pzw610dsOhbnkwHhcNMDgxMjExMTUwODIxWhcNMjgx
-MjA2MTUwODIxWjCBpzELMAkGA1UEBhMCSFUxETAPBgNVBAcMCEJ1ZGFwZXN0MRUwEwYDVQQKDAxO
-ZXRMb2NrIEtmdC4xNzA1BgNVBAsMLlRhbsO6c8OtdHbDoW55a2lhZMOzayAoQ2VydGlmaWNhdGlv
-biBTZXJ2aWNlcykxNTAzBgNVBAMMLE5ldExvY2sgQXJhbnkgKENsYXNzIEdvbGQpIEbFkXRhbsO6
-c8OtdHbDoW55MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAxCRec75LbRTDofTjl5Bu
-0jBFHjzuZ9lk4BqKf8owyoPjIMHj9DrTlF8afFttvzBPhCf2nx9JvMaZCpDyD/V/Q4Q3Y1GLeqVw
-/HpYzY6b7cNGbIRwXdrzAZAj/E4wqX7hJ2Pn7WQ8oLjJM2P+FpD/sLj916jAwJRDC7bVWaaeVtAk
-H3B5r9s5VA1lddkVQZQBr17s9o3x/61k/iCa11zr/qYfCGSji3ZVrR47KGAuhyXoqq8fxmRGILdw
-fzzeSNuWU7c5d+Qa4scWhHaXWy+7GRWF+GmF9ZmnqfI0p6m2pgP8b4Y9VHx2BJtr+UBdADTHLpl1
-neWIA6pN+APSQnbAGwIDAKiLo0UwQzASBgNVHRMBAf8ECDAGAQH/AgEEMA4GA1UdDwEB/wQEAwIB
-BjAdBgNVHQ4EFgQUzPpnk/C2uNClwB7zU/2MU9+D15YwDQYJKoZIhvcNAQELBQADggEBAKt/7hwW
-qZw8UQCgwBEIBaeZ5m8BiFRhbvG5GK1Krf6BQCOUL/t1fC8oS2IkgYIL9WHxHG64YTjrgfpioTta
-YtOUZcTh5m2C+C8lcLIhJsFyUR+MLMOEkMNaj7rP9KdlpeuY0fsFskZ1FSNqb4VjMIDw1Z4fKRzC
-bLBQWV2QWzuoDTDPv31/zvGdg73JRm4gpvlhUbohL3u+pRVjodSVh/GeufOJ8z2FuLjbvrW5Kfna
-NwUASZQDhETnv0Mxz3WLJdH0pmT1kvarBes96aULNmLazAZfNou2XjG4Kvte9nHfRCaexOYNkbQu
-dZWAUWpLMKawYqGT8ZvYzsRjdT9ZR7E=
------END CERTIFICATE-----
-
-Staat der Nederlanden Root CA - G2
-==================================
------BEGIN CERTIFICATE-----
-MIIFyjCCA7KgAwIBAgIEAJiWjDANBgkqhkiG9w0BAQsFADBaMQswCQYDVQQGEwJOTDEeMBwGA1UE
-CgwVU3RhYXQgZGVyIE5lZGVybGFuZGVuMSswKQYDVQQDDCJTdGFhdCBkZXIgTmVkZXJsYW5kZW4g
-Um9vdCBDQSAtIEcyMB4XDTA4MDMyNjExMTgxN1oXDTIwMDMyNTExMDMxMFowWjELMAkGA1UEBhMC
-TkwxHjAcBgNVBAoMFVN0YWF0IGRlciBOZWRlcmxhbmRlbjErMCkGA1UEAwwiU3RhYXQgZGVyIE5l
-ZGVybGFuZGVuIFJvb3QgQ0EgLSBHMjCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAMVZ
-5291qj5LnLW4rJ4L5PnZyqtdj7U5EILXr1HgO+EASGrP2uEGQxGZqhQlEq0i6ABtQ8SpuOUfiUtn
-vWFI7/3S4GCI5bkYYCjDdyutsDeqN95kWSpGV+RLufg3fNU254DBtvPUZ5uW6M7XxgpT0GtJlvOj
-CwV3SPcl5XCsMBQgJeN/dVrlSPhOewMHBPqCYYdu8DvEpMfQ9XQ+pV0aCPKbJdL2rAQmPlU6Yiil
-e7Iwr/g3wtG61jj99O9JMDeZJiFIhQGp5Rbn3JBV3w/oOM2ZNyFPXfUib2rFEhZgF1XyZWampzCR
-OME4HYYEhLoaJXhena/MUGDWE4dS7WMfbWV9whUYdMrhfmQpjHLYFhN9C0lK8SgbIHRrxT3dsKpI
-CT0ugpTNGmXZK4iambwYfp/ufWZ8Pr2UuIHOzZgweMFvZ9C+X+Bo7d7iscksWXiSqt8rYGPy5V65
-48r6f1CGPqI0GAwJaCgRHOThuVw+R7oyPxjMW4T182t0xHJ04eOLoEq9jWYv6q012iDTiIJh8BIi
-trzQ1aTsr1SIJSQ8p22xcik/Plemf1WvbibG/ufMQFxRRIEKeN5KzlW/HdXZt1bv8Hb/C3m1r737
-qWmRRpdogBQ2HbN/uymYNqUg+oJgYjOk7Na6B6duxc8UpufWkjTYgfX8HV2qXB72o007uPc5AgMB
-AAGjgZcwgZQwDwYDVR0TAQH/BAUwAwEB/zBSBgNVHSAESzBJMEcGBFUdIAAwPzA9BggrBgEFBQcC
-ARYxaHR0cDovL3d3dy5wa2lvdmVyaGVpZC5ubC9wb2xpY2llcy9yb290LXBvbGljeS1HMjAOBgNV
-HQ8BAf8EBAMCAQYwHQYDVR0OBBYEFJFoMocVHYnitfGsNig0jQt8YojrMA0GCSqGSIb3DQEBCwUA
-A4ICAQCoQUpnKpKBglBu4dfYszk78wIVCVBR7y29JHuIhjv5tLySCZa59sCrI2AGeYwRTlHSeYAz
-+51IvuxBQ4EffkdAHOV6CMqqi3WtFMTC6GY8ggen5ieCWxjmD27ZUD6KQhgpxrRW/FYQoAUXvQwj
-f/ST7ZwaUb7dRUG/kSS0H4zpX897IZmflZ85OkYcbPnNe5yQzSipx6lVu6xiNGI1E0sUOlWDuYaN
-kqbG9AclVMwWVxJKgnjIFNkXgiYtXSAfea7+1HAWFpWD2DU5/1JddRwWxRNVz0fMdWVSSt7wsKfk
-CpYL+63C4iWEst3kvX5ZbJvw8NjnyvLplzh+ib7M+zkXYT9y2zqR2GUBGR2tUKRXCnxLvJxxcypF
-URmFzI79R6d0lR2o0a9OF7FpJsKqeFdbxU2n5Z4FF5TKsl+gSRiNNOkmbEgeqmiSBeGCc1qb3Adb
-CG19ndeNIdn8FCCqwkXfP+cAslHkwvgFuXkajDTznlvkN1trSt8sV4pAWja63XVECDdCcAz+3F4h
-oKOKwJCcaNpQ5kUQR3i2TtJlycM33+FCY7BXN0Ute4qcvwXqZVUz9zkQxSgqIXobisQk+T8VyJoV
-IPVVYpbtbZNQvOSqeK3Zywplh6ZmwcSBo3c6WB4L7oOLnR7SUqTMHW+wmG2UMbX4cQrcufx9MmDm
-66+KAQ==
------END CERTIFICATE-----
-
-CA Disig
-========
------BEGIN CERTIFICATE-----
-MIIEDzCCAvegAwIBAgIBATANBgkqhkiG9w0BAQUFADBKMQswCQYDVQQGEwJTSzETMBEGA1UEBxMK
-QnJhdGlzbGF2YTETMBEGA1UEChMKRGlzaWcgYS5zLjERMA8GA1UEAxMIQ0EgRGlzaWcwHhcNMDYw
-MzIyMDEzOTM0WhcNMTYwMzIyMDEzOTM0WjBKMQswCQYDVQQGEwJTSzETMBEGA1UEBxMKQnJhdGlz
-bGF2YTETMBEGA1UEChMKRGlzaWcgYS5zLjERMA8GA1UEAxMIQ0EgRGlzaWcwggEiMA0GCSqGSIb3
-DQEBAQUAA4IBDwAwggEKAoIBAQCS9jHBfYj9mQGp2HvycXXxMcbzdWb6UShGhJd4NLxs/LxFWYgm
-GErENx+hSkS943EE9UQX4j/8SFhvXJ56CbpRNyIjZkMhsDxkovhqFQ4/61HhVKndBpnXmjxUizkD
-Pw/Fzsbrg3ICqB9x8y34dQjbYkzo+s7552oftms1grrijxaSfQUMbEYDXcDtab86wYqg6I7ZuUUo
-hwjstMoVvoLdtUSLLa2GDGhibYVW8qwUYzrG0ZmsNHhWS8+2rT+MitcE5eN4TPWGqvWP+j1scaMt
-ymfraHtuM6kMgiioTGohQBUgDCZbg8KpFhXAJIJdKxatymP2dACw30PEEGBWZ2NFAgMBAAGjgf8w
-gfwwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUjbJJaJ1yCCW5wCf1UJNWSEZx+Y8wDgYDVR0P
-AQH/BAQDAgEGMDYGA1UdEQQvMC2BE2Nhb3BlcmF0b3JAZGlzaWcuc2uGFmh0dHA6Ly93d3cuZGlz
-aWcuc2svY2EwZgYDVR0fBF8wXTAtoCugKYYnaHR0cDovL3d3dy5kaXNpZy5zay9jYS9jcmwvY2Ff
-ZGlzaWcuY3JsMCygKqAohiZodHRwOi8vY2EuZGlzaWcuc2svY2EvY3JsL2NhX2Rpc2lnLmNybDAa
-BgNVHSAEEzARMA8GDSuBHpGT5goAAAABAQEwDQYJKoZIhvcNAQEFBQADggEBAF00dGFMrzvY/59t
-WDYcPQuBDRIrRhCA/ec8J9B6yKm2fnQwM6M6int0wHl5QpNt/7EpFIKrIYwvF/k/Ji/1WcbvgAa3
-mkkp7M5+cTxqEEHA9tOasnxakZzArFvITV734VP/Q3f8nktnbNfzg9Gg4H8l37iYC5oyOGwwoPP/
-CBUz91BKez6jPiCp3C9WgArtQVCwyfTssuMmRAAOb54GvCKWU3BlxFAKRmukLyeBEicTXxChds6K
-ezfqwzlhA5WYOudsiCUI/HloDYd9Yvi0X/vF2Ey9WLw/Q1vUHgFNPGO+I++MzVpQuGhU+QqZMxEA
-4Z7CRneC9VkGjCFMhwnN5ag=
------END CERTIFICATE-----
-
-Juur-SK
-=======
------BEGIN CERTIFICATE-----
-MIIE5jCCA86gAwIBAgIEO45L/DANBgkqhkiG9w0BAQUFADBdMRgwFgYJKoZIhvcNAQkBFglwa2lA
-c2suZWUxCzAJBgNVBAYTAkVFMSIwIAYDVQQKExlBUyBTZXJ0aWZpdHNlZXJpbWlza2Vza3VzMRAw
-DgYDVQQDEwdKdXVyLVNLMB4XDTAxMDgzMDE0MjMwMVoXDTE2MDgyNjE0MjMwMVowXTEYMBYGCSqG
-SIb3DQEJARYJcGtpQHNrLmVlMQswCQYDVQQGEwJFRTEiMCAGA1UEChMZQVMgU2VydGlmaXRzZWVy
-aW1pc2tlc2t1czEQMA4GA1UEAxMHSnV1ci1TSzCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC
-ggEBAIFxNj4zB9bjMI0TfncyRsvPGbJgMUaXhvSYRqTCZUXP00B841oiqBB4M8yIsdOBSvZiF3tf
-TQou0M+LI+5PAk676w7KvRhj6IAcjeEcjT3g/1tf6mTll+g/mX8MCgkzABpTpyHhOEvWgxutr2TC
-+Rx6jGZITWYfGAriPrsfB2WThbkasLnE+w0R9vXW+RvHLCu3GFH+4Hv2qEivbDtPL+/40UceJlfw
-UR0zlv/vWT3aTdEVNMfqPxZIe5EcgEMPPbgFPtGzlc3Yyg/CQ2fbt5PgIoIuvvVoKIO5wTtpeyDa
-Tpxt4brNj3pssAki14sL2xzVWiZbDcDq5WDQn/413z8CAwEAAaOCAawwggGoMA8GA1UdEwEB/wQF
-MAMBAf8wggEWBgNVHSAEggENMIIBCTCCAQUGCisGAQQBzh8BAQEwgfYwgdAGCCsGAQUFBwICMIHD
-HoHAAFMAZQBlACAAcwBlAHIAdABpAGYAaQBrAGEAYQB0ACAAbwBuACAAdgDkAGwAagBhAHMAdABh
-AHQAdQBkACAAQQBTAC0AaQBzACAAUwBlAHIAdABpAGYAaQB0AHMAZQBlAHIAaQBtAGkAcwBrAGUA
-cwBrAHUAcwAgAGEAbABhAG0ALQBTAEsAIABzAGUAcgB0AGkAZgBpAGsAYQBhAHQAaQBkAGUAIABr
-AGkAbgBuAGkAdABhAG0AaQBzAGUAawBzMCEGCCsGAQUFBwIBFhVodHRwOi8vd3d3LnNrLmVlL2Nw
-cy8wKwYDVR0fBCQwIjAgoB6gHIYaaHR0cDovL3d3dy5zay5lZS9qdXVyL2NybC8wHQYDVR0OBBYE
-FASqekej5ImvGs8KQKcYP2/v6X2+MB8GA1UdIwQYMBaAFASqekej5ImvGs8KQKcYP2/v6X2+MA4G
-A1UdDwEB/wQEAwIB5jANBgkqhkiG9w0BAQUFAAOCAQEAe8EYlFOiCfP+JmeaUOTDBS8rNXiRTHyo
-ERF5TElZrMj3hWVcRrs7EKACr81Ptcw2Kuxd/u+gkcm2k298gFTsxwhwDY77guwqYHhpNjbRxZyL
-abVAyJRld/JXIWY7zoVAtjNjGr95HvxcHdMdkxuLDF2FvZkwMhgJkVLpfKG6/2SSmuz+Ne6ML678
-IIbsSt4beDI3poHSna9aEhbKmVv8b20OxaAehsmR0FyYgl9jDIpaq9iVpszLita/ZEuOyoqysOkh
-Mp6qqIWYNIE5ITuoOlIyPfZrN4YGWhWY3PARZv40ILcD9EEQfTmEeZZyY7aWAuVrua0ZTbvGRNs2
-yyqcjg==
------END CERTIFICATE-----
-
-Hongkong Post Root CA 1
-=======================
------BEGIN CERTIFICATE-----
-MIIDMDCCAhigAwIBAgICA+gwDQYJKoZIhvcNAQEFBQAwRzELMAkGA1UEBhMCSEsxFjAUBgNVBAoT
-DUhvbmdrb25nIFBvc3QxIDAeBgNVBAMTF0hvbmdrb25nIFBvc3QgUm9vdCBDQSAxMB4XDTAzMDUx
-NTA1MTMxNFoXDTIzMDUxNTA0NTIyOVowRzELMAkGA1UEBhMCSEsxFjAUBgNVBAoTDUhvbmdrb25n
-IFBvc3QxIDAeBgNVBAMTF0hvbmdrb25nIFBvc3QgUm9vdCBDQSAxMIIBIjANBgkqhkiG9w0BAQEF
-AAOCAQ8AMIIBCgKCAQEArP84tulmAknjorThkPlAj3n54r15/gK97iSSHSL22oVyaf7XPwnU3ZG1
-ApzQjVrhVcNQhrkpJsLj2aDxaQMoIIBFIi1WpztUlVYiWR8o3x8gPW2iNr4joLFutbEnPzlTCeqr
-auh0ssJlXI6/fMN4hM2eFvz1Lk8gKgifd/PFHsSaUmYeSF7jEAaPIpjhZY4bXSNmO7ilMlHIhqqh
-qZ5/dpTCpmy3QfDVyAY45tQM4vM7TG1QjMSDJ8EThFk9nnV0ttgCXjqQesBCNnLsak3c78QA3xMY
-V18meMjWCnl3v/evt3a5pQuEF10Q6m/hq5URX208o1xNg1vysxmKgIsLhwIDAQABoyYwJDASBgNV
-HRMBAf8ECDAGAQH/AgEDMA4GA1UdDwEB/wQEAwIBxjANBgkqhkiG9w0BAQUFAAOCAQEADkbVPK7i
-h9legYsCmEEIjEy82tvuJxuC52pF7BaLT4Wg87JwvVqWuspube5Gi27nKi6Wsxkz67SfqLI37pio
-l7Yutmcn1KZJ/RyTZXaeQi/cImyaT/JaFTmxcdcrUehtHJjA2Sr0oYJ71clBoiMBdDhViw+5Lmei
-IAQ32pwL0xch4I+XeTRvhEgCIDMb5jREn5Fw9IBehEPCKdJsEhTkYY2sEJCehFC78JZvRZ+K88ps
-T/oROhUVRsPNH4NbLUES7VBnQRM9IauUiqpOfMGx+6fWtScvl6tu4B3i0RwsH0Ti/L6RoZz71ilT
-c4afU9hDDl3WY4JxHYB0yvbiAmvZWg==
------END CERTIFICATE-----
-
-SecureSign RootCA11
-===================
------BEGIN CERTIFICATE-----
-MIIDbTCCAlWgAwIBAgIBATANBgkqhkiG9w0BAQUFADBYMQswCQYDVQQGEwJKUDErMCkGA1UEChMi
-SmFwYW4gQ2VydGlmaWNhdGlvbiBTZXJ2aWNlcywgSW5jLjEcMBoGA1UEAxMTU2VjdXJlU2lnbiBS
-b290Q0ExMTAeFw0wOTA0MDgwNDU2NDdaFw0yOTA0MDgwNDU2NDdaMFgxCzAJBgNVBAYTAkpQMSsw
-KQYDVQQKEyJKYXBhbiBDZXJ0aWZpY2F0aW9uIFNlcnZpY2VzLCBJbmMuMRwwGgYDVQQDExNTZWN1
-cmVTaWduIFJvb3RDQTExMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA/XeqpRyQBTvL
-TJszi1oURaTnkBbR31fSIRCkF/3frNYfp+TbfPfs37gD2pRY/V1yfIw/XwFndBWW4wI8h9uuywGO
-wvNmxoVF9ALGOrVisq/6nL+k5tSAMJjzDbaTj6nU2DbysPyKyiyhFTOVMdrAG/LuYpmGYz+/3ZMq
-g6h2uRMft85OQoWPIucuGvKVCbIFtUROd6EgvanyTgp9UK31BQ1FT0Zx/Sg+U/sE2C3XZR1KG/rP
-O7AxmjVuyIsG0wCR8pQIZUyxNAYAeoni8McDWc/V1uinMrPmmECGxc0nEovMe863ETxiYAcjPitA
-bpSACW22s293bzUIUPsCh8U+iQIDAQABo0IwQDAdBgNVHQ4EFgQUW/hNT7KlhtQ60vFjmqC+CfZX
-t94wDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQEFBQADggEBAKCh
-OBZmLqdWHyGcBvod7bkixTgm2E5P7KN/ed5GIaGHd48HCJqypMWvDzKYC3xmKbabfSVSSUOrTC4r
-bnpwrxYO4wJs+0LmGJ1F2FXI6Dvd5+H0LgscNFxsWEr7jIhQX5Ucv+2rIrVls4W6ng+4reV6G4pQ
-Oh29Dbx7VFALuUKvVaAYga1lme++5Jy/xIWrQbJUb9wlze144o4MjQlJ3WN7WmmWAiGovVJZ6X01
-y8hSyn+B/tlr0/cR7SXf+Of5pPpyl4RTDaXQMhhRdlkUbA/r7F+AjHVDg8OFmP9Mni0N5HeDk061
-lgeLKBObjBmNQSdJQO7e5iNEOdyhIta6A/I=
------END CERTIFICATE-----
-
-ACEDICOM Root
-=============
------BEGIN CERTIFICATE-----
-MIIFtTCCA52gAwIBAgIIYY3HhjsBggUwDQYJKoZIhvcNAQEFBQAwRDEWMBQGA1UEAwwNQUNFRElD
-T00gUm9vdDEMMAoGA1UECwwDUEtJMQ8wDQYDVQQKDAZFRElDT00xCzAJBgNVBAYTAkVTMB4XDTA4
-MDQxODE2MjQyMloXDTI4MDQxMzE2MjQyMlowRDEWMBQGA1UEAwwNQUNFRElDT00gUm9vdDEMMAoG
-A1UECwwDUEtJMQ8wDQYDVQQKDAZFRElDT00xCzAJBgNVBAYTAkVTMIICIjANBgkqhkiG9w0BAQEF
-AAOCAg8AMIICCgKCAgEA/5KV4WgGdrQsyFhIyv2AVClVYyT/kGWbEHV7w2rbYgIB8hiGtXxaOLHk
-WLn709gtn70yN78sFW2+tfQh0hOR2QetAQXW8713zl9CgQr5auODAKgrLlUTY4HKRxx7XBZXehuD
-YAQ6PmXDzQHe3qTWDLqO3tkE7hdWIpuPY/1NFgu3e3eM+SW10W2ZEi5PGrjm6gSSrj0RuVFCPYew
-MYWveVqc/udOXpJPQ/yrOq2lEiZmueIM15jO1FillUAKt0SdE3QrwqXrIhWYENiLxQSfHY9g5QYb
-m8+5eaA9oiM/Qj9r+hwDezCNzmzAv+YbX79nuIQZ1RXve8uQNjFiybwCq0Zfm/4aaJQ0PZCOrfbk
-HQl/Sog4P75n/TSW9R28MHTLOO7VbKvU/PQAtwBbhTIWdjPp2KOZnQUAqhbm84F9b32qhm2tFXTT
-xKJxqvQUfecyuB+81fFOvW8XAjnXDpVCOscAPukmYxHqC9FK/xidstd7LzrZlvvoHpKuE1XI2Sf2
-3EgbsCTBheN3nZqk8wwRHQ3ItBTutYJXCb8gWH8vIiPYcMt5bMlL8qkqyPyHK9caUPgn6C9D4zq9
-2Fdx/c6mUlv53U3t5fZvie27k5x2IXXwkkwp9y+cAS7+UEaeZAwUswdbxcJzbPEHXEUkFDWug/Fq
-TYl6+rPYLWbwNof1K1MCAwEAAaOBqjCBpzAPBgNVHRMBAf8EBTADAQH/MB8GA1UdIwQYMBaAFKaz
-4SsrSbbXc6GqlPUB53NlTKxQMA4GA1UdDwEB/wQEAwIBhjAdBgNVHQ4EFgQUprPhKytJttdzoaqU
-9QHnc2VMrFAwRAYDVR0gBD0wOzA5BgRVHSAAMDEwLwYIKwYBBQUHAgEWI2h0dHA6Ly9hY2VkaWNv
-bS5lZGljb21ncm91cC5jb20vZG9jMA0GCSqGSIb3DQEBBQUAA4ICAQDOLAtSUWImfQwng4/F9tqg
-aHtPkl7qpHMyEVNEskTLnewPeUKzEKbHDZ3Ltvo/Onzqv4hTGzz3gvoFNTPhNahXwOf9jU8/kzJP
-eGYDdwdY6ZXIfj7QeQCM8htRM5u8lOk6e25SLTKeI6RF+7YuE7CLGLHdztUdp0J/Vb77W7tH1Pwk
-zQSulgUV1qzOMPPKC8W64iLgpq0i5ALudBF/TP94HTXa5gI06xgSYXcGCRZj6hitoocf8seACQl1
-ThCojz2GuHURwCRiipZ7SkXp7FnFvmuD5uHorLUwHv4FB4D54SMNUI8FmP8sX+g7tq3PgbUhh8oI
-KiMnMCArz+2UW6yyetLHKKGKC5tNSixthT8Jcjxn4tncB7rrZXtaAWPWkFtPF2Y9fwsZo5NjEFIq
-nxQWWOLcpfShFosOkYuByptZ+thrkQdlVV9SH686+5DdaaVbnG0OLLb6zqylfDJKZ0DcMDQj3dcE
-I2bw/FWAp/tmGYI1Z2JwOV5vx+qQQEQIHriy1tvuWacNGHk0vFQYXlPKNFHtRQrmjseCNj6nOGOp
-MCwXEGCSn1WHElkQwg9naRHMTh5+Spqtr0CodaxWkHS4oJyleW/c6RrIaQXpuvoDs3zk4E7Czp3o
-tkYNbn5XOmeUwssfnHdKZ05phkOTOPu220+DkdRgfks+KzgHVZhepA==
------END CERTIFICATE-----
-
-Verisign Class 3 Public Primary Certification Authority
-=======================================================
------BEGIN CERTIFICATE-----
-MIICPDCCAaUCEDyRMcsf9tAbDpq40ES/Er4wDQYJKoZIhvcNAQEFBQAwXzELMAkGA1UEBhMCVVMx
-FzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMTcwNQYDVQQLEy5DbGFzcyAzIFB1YmxpYyBQcmltYXJ5
-IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MB4XDTk2MDEyOTAwMDAwMFoXDTI4MDgwMjIzNTk1OVow
-XzELMAkGA1UEBhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMTcwNQYDVQQLEy5DbGFzcyAz
-IFB1YmxpYyBQcmltYXJ5IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIGfMA0GCSqGSIb3DQEBAQUA
-A4GNADCBiQKBgQDJXFme8huKARS0EN8EQNvjV69qRUCPhAwL0TPZ2RHP7gJYHyX3KqhEBarsAx94
-f56TuZoAqiN91qyFomNFx3InzPRMxnVx0jnvT0Lwdd8KkMaOIG+YD/isI19wKTakyYbnsZogy1Ol
-hec9vn2a/iRFM9x2Fe0PonFkTGUugWhFpwIDAQABMA0GCSqGSIb3DQEBBQUAA4GBABByUqkFFBky
-CEHwxWsKzH4PIRnN5GfcX6kb5sroc50i2JhucwNhkcV8sEVAbkSdjbCxlnRhLQ2pRdKkkirWmnWX
-bj9T/UWZYB2oK0z5XqcJ2HUw19JlYD1n1khVdWk/kfVIC0dpImmClr7JyDiGSnoscxlIaU5rfGW/
-D/xwzoiQ
------END CERTIFICATE-----
-
-Microsec e-Szigno Root CA 2009
-==============================
------BEGIN CERTIFICATE-----
-MIIECjCCAvKgAwIBAgIJAMJ+QwRORz8ZMA0GCSqGSIb3DQEBCwUAMIGCMQswCQYDVQQGEwJIVTER
-MA8GA1UEBwwIQnVkYXBlc3QxFjAUBgNVBAoMDU1pY3Jvc2VjIEx0ZC4xJzAlBgNVBAMMHk1pY3Jv
-c2VjIGUtU3ppZ25vIFJvb3QgQ0EgMjAwOTEfMB0GCSqGSIb3DQEJARYQaW5mb0BlLXN6aWduby5o
-dTAeFw0wOTA2MTYxMTMwMThaFw0yOTEyMzAxMTMwMThaMIGCMQswCQYDVQQGEwJIVTERMA8GA1UE
-BwwIQnVkYXBlc3QxFjAUBgNVBAoMDU1pY3Jvc2VjIEx0ZC4xJzAlBgNVBAMMHk1pY3Jvc2VjIGUt
-U3ppZ25vIFJvb3QgQ0EgMjAwOTEfMB0GCSqGSIb3DQEJARYQaW5mb0BlLXN6aWduby5odTCCASIw
-DQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAOn4j/NjrdqG2KfgQvvPkd6mJviZpWNwrZuuyjNA
-fW2WbqEORO7hE52UQlKavXWFdCyoDh2Tthi3jCyoz/tccbna7P7ofo/kLx2yqHWH2Leh5TvPmUpG
-0IMZfcChEhyVbUr02MelTTMuhTlAdX4UfIASmFDHQWe4oIBhVKZsTh/gnQ4H6cm6M+f+wFUoLAKA
-pxn1ntxVUwOXewdI/5n7N4okxFnMUBBjjqqpGrCEGob5X7uxUG6k0QrM1XF+H6cbfPVTbiJfyyvm
-1HxdrtbCxkzlBQHZ7Vf8wSN5/PrIJIOV87VqUQHQd9bpEqH5GoP7ghu5sJf0dgYzQ0mg/wu1+rUC
-AwEAAaOBgDB+MA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBTLD8bf
-QkPMPcu1SCOhGnqmKrs0aDAfBgNVHSMEGDAWgBTLD8bfQkPMPcu1SCOhGnqmKrs0aDAbBgNVHREE
-FDASgRBpbmZvQGUtc3ppZ25vLmh1MA0GCSqGSIb3DQEBCwUAA4IBAQDJ0Q5eLtXMs3w+y/w9/w0o
-lZMEyL/azXm4Q5DwpL7v8u8hmLzU1F0G9u5C7DBsoKqpyvGvivo/C3NqPuouQH4frlRheesuCDfX
-I/OMn74dseGkddug4lQUsbocKaQY9hK6ohQU4zE1yED/t+AFdlfBHFny+L/k7SViXITwfn4fs775
-tyERzAMBVnCnEJIeGzSBHq2cGsMEPO0CYdYeBvNfOofyK/FFh+U9rNHHV4S9a67c2Pm2G2JwCz02
-yULyMtd6YebS2z3PyKnJm9zbWETXbzivf3jTo60adbocwTZ8jx5tHMN1Rq41Bab2XD0h7lbwyYIi
-LXpUq3DDfSJlgnCW
------END CERTIFICATE-----
-
-E-Guven Kok Elektronik Sertifika Hizmet Saglayicisi
-===================================================
------BEGIN CERTIFICATE-----
-MIIDtjCCAp6gAwIBAgIQRJmNPMADJ72cdpW56tustTANBgkqhkiG9w0BAQUFADB1MQswCQYDVQQG
-EwJUUjEoMCYGA1UEChMfRWxla3Ryb25payBCaWxnaSBHdXZlbmxpZ2kgQS5TLjE8MDoGA1UEAxMz
-ZS1HdXZlbiBLb2sgRWxla3Ryb25payBTZXJ0aWZpa2EgSGl6bWV0IFNhZ2xheWljaXNpMB4XDTA3
-MDEwNDExMzI0OFoXDTE3MDEwNDExMzI0OFowdTELMAkGA1UEBhMCVFIxKDAmBgNVBAoTH0VsZWt0
-cm9uaWsgQmlsZ2kgR3V2ZW5saWdpIEEuUy4xPDA6BgNVBAMTM2UtR3V2ZW4gS29rIEVsZWt0cm9u
-aWsgU2VydGlmaWthIEhpem1ldCBTYWdsYXlpY2lzaTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCC
-AQoCggEBAMMSIJ6wXgBljU5Gu4Bc6SwGl9XzcslwuedLZYDBS75+PNdUMZTe1RK6UxYC6lhj71vY
-8+0qGqpxSKPcEC1fX+tcS5yWCEIlKBHMilpiAVDV6wlTL/jDj/6z/P2douNffb7tC+Bg62nsM+3Y
-jfsSSYMAyYuXjDtzKjKzEve5TfL0TW3H5tYmNwjy2f1rXKPlSFxYvEK+A1qBuhw1DADT9SN+cTAI
-JjjcJRFHLfO6IxClv7wC90Nex/6wN1CZew+TzuZDLMN+DfIcQ2Zgy2ExR4ejT669VmxMvLz4Bcpk
-9Ok0oSy1c+HCPujIyTQlCFzz7abHlJ+tiEMl1+E5YP6sOVkCAwEAAaNCMEAwDgYDVR0PAQH/BAQD
-AgEGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFJ/uRLOU1fqRTy7ZVZoEVtstxNulMA0GCSqG
-SIb3DQEBBQUAA4IBAQB/X7lTW2M9dTLn+sR0GstG30ZpHFLPqk/CaOv/gKlR6D1id4k9CnU58W5d
-F4dvaAXBlGzZXd/aslnLpRCKysw5zZ/rTt5S/wzw9JKp8mxTq5vSR6AfdPebmvEvFZ96ZDAYBzwq
-D2fK/A+JYZ1lpTzlvBNbCNvj/+27BrtqBrF6T2XGgv0enIu1De5Iu7i9qgi0+6N8y5/NkHZchpZ4
-Vwpm+Vganf2XKWDeEaaQHBkc7gGWIjQ0LpH5t8Qn0Xvmv/uARFoW5evg1Ao4vOSR49XrXMGs3xtq
-fJ7lddK2l4fbzIcrQzqECK+rPNv3PGYxhrCdU3nt+CPeQuMtgvEP5fqX
------END CERTIFICATE-----
-
-GlobalSign Root CA - R3
-=======================
------BEGIN CERTIFICATE-----
-MIIDXzCCAkegAwIBAgILBAAAAAABIVhTCKIwDQYJKoZIhvcNAQELBQAwTDEgMB4GA1UECxMXR2xv
-YmFsU2lnbiBSb290IENBIC0gUjMxEzARBgNVBAoTCkdsb2JhbFNpZ24xEzARBgNVBAMTCkdsb2Jh
-bFNpZ24wHhcNMDkwMzE4MTAwMDAwWhcNMjkwMzE4MTAwMDAwWjBMMSAwHgYDVQQLExdHbG9iYWxT
-aWduIFJvb3QgQ0EgLSBSMzETMBEGA1UEChMKR2xvYmFsU2lnbjETMBEGA1UEAxMKR2xvYmFsU2ln
-bjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMwldpB5BngiFvXAg7aEyiie/QV2EcWt
-iHL8RgJDx7KKnQRfJMsuS+FggkbhUqsMgUdwbN1k0ev1LKMPgj0MK66X17YUhhB5uzsTgHeMCOFJ
-0mpiLx9e+pZo34knlTifBtc+ycsmWQ1z3rDI6SYOgxXG71uL0gRgykmmKPZpO/bLyCiR5Z2KYVc3
-rHQU3HTgOu5yLy6c+9C7v/U9AOEGM+iCK65TpjoWc4zdQQ4gOsC0p6Hpsk+QLjJg6VfLuQSSaGjl
-OCZgdbKfd/+RFO+uIEn8rUAVSNECMWEZXriX7613t2Saer9fwRPvm2L7DWzgVGkWqQPabumDk3F2
-xmmFghcCAwEAAaNCMEAwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYE
-FI/wS3+oLkUkrk1Q+mOai97i3Ru8MA0GCSqGSIb3DQEBCwUAA4IBAQBLQNvAUKr+yAzv95ZURUm7
-lgAJQayzE4aGKAczymvmdLm6AC2upArT9fHxD4q/c2dKg8dEe3jgr25sbwMpjjM5RcOO5LlXbKr8
-EpbsU8Yt5CRsuZRj+9xTaGdWPoO4zzUhw8lo/s7awlOqzJCK6fBdRoyV3XpYKBovHd7NADdBj+1E
-bddTKJd+82cEHhXXipa0095MJ6RMG3NzdvQXmcIfeg7jLQitChws/zyrVQ4PkX4268NXSb7hLi18
-YIvDQVETI53O9zJrlAGomecsMx86OyXShkDOOyyGeMlhLxS67ttVb9+E7gUJTb0o2HLO02JQZR7r
-kpeDMdmztcpHWD9f
------END CERTIFICATE-----
-
-TC TrustCenter Universal CA III
-===============================
------BEGIN CERTIFICATE-----
-MIID4TCCAsmgAwIBAgIOYyUAAQACFI0zFQLkbPQwDQYJKoZIhvcNAQEFBQAwezELMAkGA1UEBhMC
-REUxHDAaBgNVBAoTE1RDIFRydXN0Q2VudGVyIEdtYkgxJDAiBgNVBAsTG1RDIFRydXN0Q2VudGVy
-IFVuaXZlcnNhbCBDQTEoMCYGA1UEAxMfVEMgVHJ1c3RDZW50ZXIgVW5pdmVyc2FsIENBIElJSTAe
-Fw0wOTA5MDkwODE1MjdaFw0yOTEyMzEyMzU5NTlaMHsxCzAJBgNVBAYTAkRFMRwwGgYDVQQKExNU
-QyBUcnVzdENlbnRlciBHbWJIMSQwIgYDVQQLExtUQyBUcnVzdENlbnRlciBVbml2ZXJzYWwgQ0Ex
-KDAmBgNVBAMTH1RDIFRydXN0Q2VudGVyIFVuaXZlcnNhbCBDQSBJSUkwggEiMA0GCSqGSIb3DQEB
-AQUAA4IBDwAwggEKAoIBAQDC2pxisLlxErALyBpXsq6DFJmzNEubkKLF5+cvAqBNLaT6hdqbJYUt
-QCggbergvbFIgyIpRJ9Og+41URNzdNW88jBmlFPAQDYvDIRlzg9uwliT6CwLOunBjvvya8o84pxO
-juT5fdMnnxvVZ3iHLX8LR7PH6MlIfK8vzArZQe+f/prhsq75U7Xl6UafYOPfjdN/+5Z+s7Vy+Eut
-CHnNaYlAJ/Uqwa1D7KRTyGG299J5KmcYdkhtWyUB0SbFt1dpIxVbYYqt8Bst2a9c8SaQaanVDED1
-M4BDj5yjdipFtK+/fz6HP3bFzSreIMUWWMv5G/UPyw0RUmS40nZid4PxWJ//AgMBAAGjYzBhMB8G
-A1UdIwQYMBaAFFbn4VslQ4Dg9ozhcbyO5YAvxEjiMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/
-BAQDAgEGMB0GA1UdDgQWBBRW5+FbJUOA4PaM4XG8juWAL8RI4jANBgkqhkiG9w0BAQUFAAOCAQEA
-g8ev6n9NCjw5sWi+e22JLumzCecYV42FmhfzdkJQEw/HkG8zrcVJYCtsSVgZ1OK+t7+rSbyUyKu+
-KGwWaODIl0YgoGhnYIg5IFHYaAERzqf2EQf27OysGh+yZm5WZ2B6dF7AbZc2rrUNXWZzwCUyRdhK
-BgePxLcHsU0GDeGl6/R1yrqc0L2z0zIkTO5+4nYES0lT2PLpVDP85XEfPRRclkvxOvIAu2y0+pZV
-CIgJwcyRGSmwIC3/yzikQOEXvnlhgP8HA4ZMTnsGnxGGjYnuJ8Tb4rwZjgvDwxPHLQNjO9Po5KIq
-woIIlBZU8O8fJ5AluA0OKBtHd0e9HKgl8ZS0Zg==
------END CERTIFICATE-----
-
-Autoridad de Certificacion Firmaprofesional CIF A62634068
-=========================================================
------BEGIN CERTIFICATE-----
-MIIGFDCCA/ygAwIBAgIIU+w77vuySF8wDQYJKoZIhvcNAQEFBQAwUTELMAkGA1UEBhMCRVMxQjBA
-BgNVBAMMOUF1dG9yaWRhZCBkZSBDZXJ0aWZpY2FjaW9uIEZpcm1hcHJvZmVzaW9uYWwgQ0lGIEE2
-MjYzNDA2ODAeFw0wOTA1MjAwODM4MTVaFw0zMDEyMzEwODM4MTVaMFExCzAJBgNVBAYTAkVTMUIw
-QAYDVQQDDDlBdXRvcmlkYWQgZGUgQ2VydGlmaWNhY2lvbiBGaXJtYXByb2Zlc2lvbmFsIENJRiBB
-NjI2MzQwNjgwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDKlmuO6vj78aI14H9M2uDD
-Utd9thDIAl6zQyrET2qyyhxdKJp4ERppWVevtSBC5IsP5t9bpgOSL/UR5GLXMnE42QQMcas9UX4P
-B99jBVzpv5RvwSmCwLTaUbDBPLutN0pcyvFLNg4kq7/DhHf9qFD0sefGL9ItWY16Ck6WaVICqjaY
-7Pz6FIMMNx/Jkjd/14Et5cS54D40/mf0PmbR0/RAz15iNA9wBj4gGFrO93IbJWyTdBSTo3OxDqqH
-ECNZXyAFGUftaI6SEspd/NYrspI8IM/hX68gvqB2f3bl7BqGYTM+53u0P6APjqK5am+5hyZvQWyI
-plD9amML9ZMWGxmPsu2bm8mQ9QEM3xk9Dz44I8kvjwzRAv4bVdZO0I08r0+k8/6vKtMFnXkIoctX
-MbScyJCyZ/QYFpM6/EfY0XiWMR+6KwxfXZmtY4laJCB22N/9q06mIqqdXuYnin1oKaPnirjaEbsX
-LZmdEyRG98Xi2J+Of8ePdG1asuhy9azuJBCtLxTa/y2aRnFHvkLfuwHb9H/TKI8xWVvTyQKmtFLK
-bpf7Q8UIJm+K9Lv9nyiqDdVF8xM6HdjAeI9BZzwelGSuewvF6NkBiDkal4ZkQdU7hwxu+g/GvUgU
-vzlN1J5Bto+WHWOWk9mVBngxaJ43BjuAiUVhOSPHG0SjFeUc+JIwuwIDAQABo4HvMIHsMBIGA1Ud
-EwEB/wQIMAYBAf8CAQEwDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBRlzeurNR4APn7VdMActHNH
-DhpkLzCBpgYDVR0gBIGeMIGbMIGYBgRVHSAAMIGPMC8GCCsGAQUFBwIBFiNodHRwOi8vd3d3LmZp
-cm1hcHJvZmVzaW9uYWwuY29tL2NwczBcBggrBgEFBQcCAjBQHk4AUABhAHMAZQBvACAAZABlACAA
-bABhACAAQgBvAG4AYQBuAG8AdgBhACAANAA3ACAAQgBhAHIAYwBlAGwAbwBuAGEAIAAwADgAMAAx
-ADcwDQYJKoZIhvcNAQEFBQADggIBABd9oPm03cXF661LJLWhAqvdpYhKsg9VSytXjDvlMd3+xDLx
-51tkljYyGOylMnfX40S2wBEqgLk9am58m9Ot/MPWo+ZkKXzR4Tgegiv/J2Wv+xYVxC5xhOW1//qk
-R71kMrv2JYSiJ0L1ILDCExARzRAVukKQKtJE4ZYm6zFIEv0q2skGz3QeqUvVhyj5eTSSPi5E6PaP
-T481PyWzOdxjKpBrIF/EUhJOlywqrJ2X3kjyo2bbwtKDlaZmp54lD+kLM5FlClrD2VQS3a/DTg4f
-Jl4N3LON7NWBcN7STyQF82xO9UxJZo3R/9ILJUFI/lGExkKvgATP0H5kSeTy36LssUzAKh3ntLFl
-osS88Zj0qnAHY7S42jtM+kAiMFsRpvAFDsYCA0irhpuF3dvd6qJ2gHN99ZwExEWN57kci57q13XR
-crHedUTnQn3iV2t93Jm8PYMo6oCTjcVMZcFwgbg4/EMxsvYDNEeyrPsiBsse3RdHHF9mudMaotoR
-saS8I8nkvof/uZS2+F0gStRf571oe2XyFR7SOqkt6dhrJKyXWERHrVkY8SFlcN7ONGCoQPHzPKTD
-KCOM/iczQ0CgFzzr6juwcqajuUpLXhZI9LK8yIySxZ2frHI2vDSANGupi5LAuBft7HZT9SQBjLMi
-6Et8Vcad+qMUu2WFbm5PEn4KPJ2V
------END CERTIFICATE-----
-
-Izenpe.com
-==========
------BEGIN CERTIFICATE-----
-MIIF8TCCA9mgAwIBAgIQALC3WhZIX7/hy/WL1xnmfTANBgkqhkiG9w0BAQsFADA4MQswCQYDVQQG
-EwJFUzEUMBIGA1UECgwLSVpFTlBFIFMuQS4xEzARBgNVBAMMCkl6ZW5wZS5jb20wHhcNMDcxMjEz
-MTMwODI4WhcNMzcxMjEzMDgyNzI1WjA4MQswCQYDVQQGEwJFUzEUMBIGA1UECgwLSVpFTlBFIFMu
-QS4xEzARBgNVBAMMCkl6ZW5wZS5jb20wggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDJ
-03rKDx6sp4boFmVqscIbRTJxldn+EFvMr+eleQGPicPK8lVx93e+d5TzcqQsRNiekpsUOqHnJJAK
-ClaOxdgmlOHZSOEtPtoKct2jmRXagaKH9HtuJneJWK3W6wyyQXpzbm3benhB6QiIEn6HLmYRY2xU
-+zydcsC8Lv/Ct90NduM61/e0aL6i9eOBbsFGb12N4E3GVFWJGjMxCrFXuaOKmMPsOzTFlUFpfnXC
-PCDFYbpRR6AgkJOhkEvzTnyFRVSa0QUmQbC1TR0zvsQDyCV8wXDbO/QJLVQnSKwv4cSsPsjLkkxT
-OTcj7NMB+eAJRE1NZMDhDVqHIrytG6P+JrUV86f8hBnp7KGItERphIPzidF0BqnMC9bC3ieFUCbK
-F7jJeodWLBoBHmy+E60QrLUk9TiRodZL2vG70t5HtfG8gfZZa88ZU+mNFctKy6lvROUbQc/hhqfK
-0GqfvEyNBjNaooXlkDWgYlwWTvDjovoDGrQscbNYLN57C9saD+veIR8GdwYDsMnvmfzAuU8Lhij+
-0rnq49qlw0dpEuDb8PYZi+17cNcC1u2HGCgsBCRMd+RIihrGO5rUD8r6ddIBQFqNeb+Lz0vPqhbB
-leStTIo+F5HUsWLlguWABKQDfo2/2n+iD5dPDNMN+9fR5XJ+HMh3/1uaD7euBUbl8agW7EekFwID
-AQABo4H2MIHzMIGwBgNVHREEgagwgaWBD2luZm9AaXplbnBlLmNvbaSBkTCBjjFHMEUGA1UECgw+
-SVpFTlBFIFMuQS4gLSBDSUYgQTAxMzM3MjYwLVJNZXJjLlZpdG9yaWEtR2FzdGVpeiBUMTA1NSBG
-NjIgUzgxQzBBBgNVBAkMOkF2ZGEgZGVsIE1lZGl0ZXJyYW5lbyBFdG9yYmlkZWEgMTQgLSAwMTAx
-MCBWaXRvcmlhLUdhc3RlaXowDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0O
-BBYEFB0cZQ6o8iV7tJHP5LGx5r1VdGwFMA0GCSqGSIb3DQEBCwUAA4ICAQB4pgwWSp9MiDrAyw6l
-Fn2fuUhfGI8NYjb2zRlrrKvV9pF9rnHzP7MOeIWblaQnIUdCSnxIOvVFfLMMjlF4rJUT3sb9fbga
-kEyrkgPH7UIBzg/YsfqikuFgba56awmqxinuaElnMIAkejEWOVt+8Rwu3WwJrfIxwYJOubv5vr8q
-hT/AQKM6WfxZSzwoJNu0FXWuDYi6LnPAvViH5ULy617uHjAimcs30cQhbIHsvm0m5hzkQiCeR7Cs
-g1lwLDXWrzY0tM07+DKo7+N4ifuNRSzanLh+QBxh5z6ikixL8s36mLYp//Pye6kfLqCTVyvehQP5
-aTfLnnhqBbTFMXiJ7HqnheG5ezzevh55hM6fcA5ZwjUukCox2eRFekGkLhObNA5me0mrZJfQRsN5
-nXJQY6aYWwa9SG3YOYNw6DXwBdGqvOPbyALqfP2C2sJbUjWumDqtujWTI6cfSN01RpiyEGjkpTHC
-ClguGYEQyVB1/OpaFs4R1+7vUIgtYf8/QnMFlEPVjjxOAToZpR9GTnfQXeWBIiGH/pR9hNiTrdZo
-Q0iy2+tzJOeRf1SktoA+naM8THLCV8Sg1Mw4J87VBp6iSNnpn86CcDaTmjvfliHjWbcM2pE38P1Z
-WrOZyGlsQyYBNWNgVYkDOnXYukrZVP/u3oDYLdE41V4tC5h9Pmzb/CaIxw==
------END CERTIFICATE-----
-
-Chambers of Commerce Root - 2008
-================================
------BEGIN CERTIFICATE-----
-MIIHTzCCBTegAwIBAgIJAKPaQn6ksa7aMA0GCSqGSIb3DQEBBQUAMIGuMQswCQYDVQQGEwJFVTFD
-MEEGA1UEBxM6TWFkcmlkIChzZWUgY3VycmVudCBhZGRyZXNzIGF0IHd3dy5jYW1lcmZpcm1hLmNv
-bS9hZGRyZXNzKTESMBAGA1UEBRMJQTgyNzQzMjg3MRswGQYDVQQKExJBQyBDYW1lcmZpcm1hIFMu
-QS4xKTAnBgNVBAMTIENoYW1iZXJzIG9mIENvbW1lcmNlIFJvb3QgLSAyMDA4MB4XDTA4MDgwMTEy
-Mjk1MFoXDTM4MDczMTEyMjk1MFowga4xCzAJBgNVBAYTAkVVMUMwQQYDVQQHEzpNYWRyaWQgKHNl
-ZSBjdXJyZW50IGFkZHJlc3MgYXQgd3d3LmNhbWVyZmlybWEuY29tL2FkZHJlc3MpMRIwEAYDVQQF
-EwlBODI3NDMyODcxGzAZBgNVBAoTEkFDIENhbWVyZmlybWEgUy5BLjEpMCcGA1UEAxMgQ2hhbWJl
-cnMgb2YgQ29tbWVyY2UgUm9vdCAtIDIwMDgwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoIC
-AQCvAMtwNyuAWko6bHiUfaN/Gh/2NdW928sNRHI+JrKQUrpjOyhYb6WzbZSm891kDFX29ufyIiKA
-XuFixrYp4YFs8r/lfTJqVKAyGVn+H4vXPWCGhSRv4xGzdz4gljUha7MI2XAuZPeEklPWDrCQiorj
-h40G072QDuKZoRuGDtqaCrsLYVAGUvGef3bsyw/QHg3PmTA9HMRFEFis1tPo1+XqxQEHd9ZR5gN/
-ikilTWh1uem8nk4ZcfUyS5xtYBkL+8ydddy/Js2Pk3g5eXNeJQ7KXOt3EgfLZEFHcpOrUMPrCXZk
-NNI5t3YRCQ12RcSprj1qr7V9ZS+UWBDsXHyvfuK2GNnQm05aSd+pZgvMPMZ4fKecHePOjlO+Bd5g
-D2vlGts/4+EhySnB8esHnFIbAURRPHsl18TlUlRdJQfKFiC4reRB7noI/plvg6aRArBsNlVq5331
-lubKgdaX8ZSD6e2wsWsSaR6s+12pxZjptFtYer49okQ6Y1nUCyXeG0+95QGezdIp1Z8XGQpvvwyQ
-0wlf2eOKNcx5Wk0ZN5K3xMGtr/R5JJqyAQuxr1yW84Ay+1w9mPGgP0revq+ULtlVmhduYJ1jbLhj
-ya6BXBg14JC7vjxPNyK5fuvPnnchpj04gftI2jE9K+OJ9dC1vX7gUMQSibMjmhAxhduub+84Mxh2
-EQIDAQABo4IBbDCCAWgwEgYDVR0TAQH/BAgwBgEB/wIBDDAdBgNVHQ4EFgQU+SSsD7K1+HnA+mCI
-G8TZTQKeFxkwgeMGA1UdIwSB2zCB2IAU+SSsD7K1+HnA+mCIG8TZTQKeFxmhgbSkgbEwga4xCzAJ
-BgNVBAYTAkVVMUMwQQYDVQQHEzpNYWRyaWQgKHNlZSBjdXJyZW50IGFkZHJlc3MgYXQgd3d3LmNh
-bWVyZmlybWEuY29tL2FkZHJlc3MpMRIwEAYDVQQFEwlBODI3NDMyODcxGzAZBgNVBAoTEkFDIENh
-bWVyZmlybWEgUy5BLjEpMCcGA1UEAxMgQ2hhbWJlcnMgb2YgQ29tbWVyY2UgUm9vdCAtIDIwMDiC
-CQCj2kJ+pLGu2jAOBgNVHQ8BAf8EBAMCAQYwPQYDVR0gBDYwNDAyBgRVHSAAMCowKAYIKwYBBQUH
-AgEWHGh0dHA6Ly9wb2xpY3kuY2FtZXJmaXJtYS5jb20wDQYJKoZIhvcNAQEFBQADggIBAJASryI1
-wqM58C7e6bXpeHxIvj99RZJe6dqxGfwWPJ+0W2aeaufDuV2I6A+tzyMP3iU6XsxPpcG1Lawk0lgH
-3qLPaYRgM+gQDROpI9CF5Y57pp49chNyM/WqfcZjHwj0/gF/JM8rLFQJ3uIrbZLGOU8W6jx+ekbU
-RWpGqOt1glanq6B8aBMz9p0w8G8nOSQjKpD9kCk18pPfNKXG9/jvjA9iSnyu0/VU+I22mlaHFoI6
-M6taIgj3grrqLuBHmrS1RaMFO9ncLkVAO+rcf+g769HsJtg1pDDFOqxXnrN2pSB7+R5KBWIBpih1
-YJeSDW4+TTdDDZIVnBgizVGZoCkaPF+KMjNbMMeJL0eYD6MDxvbxrN8y8NmBGuScvfaAFPDRLLmF
-9dijscilIeUcE5fuDr3fKanvNFNb0+RqE4QGtjICxFKuItLcsiFCGtpA8CnJ7AoMXOLQusxI0zcK
-zBIKinmwPQN/aUv0NCB9szTqjktk9T79syNnFQ0EuPAtwQlRPLJsFfClI9eDdOTlLsn+mCdCxqvG
-nrDQWzilm1DefhiYtUU79nm06PcaewaD+9CL2rvHvRirCG88gGtAPxkZumWK5r7VXNM21+9AUiRg
-OGcEMeyP84LG3rlV8zsxkVrctQgVrXYlCg17LofiDKYGvCYQbTed7N14jHyAxfDZd0jQ
------END CERTIFICATE-----
-
-Global Chambersign Root - 2008
-==============================
------BEGIN CERTIFICATE-----
-MIIHSTCCBTGgAwIBAgIJAMnN0+nVfSPOMA0GCSqGSIb3DQEBBQUAMIGsMQswCQYDVQQGEwJFVTFD
-MEEGA1UEBxM6TWFkcmlkIChzZWUgY3VycmVudCBhZGRyZXNzIGF0IHd3dy5jYW1lcmZpcm1hLmNv
-bS9hZGRyZXNzKTESMBAGA1UEBRMJQTgyNzQzMjg3MRswGQYDVQQKExJBQyBDYW1lcmZpcm1hIFMu
-QS4xJzAlBgNVBAMTHkdsb2JhbCBDaGFtYmVyc2lnbiBSb290IC0gMjAwODAeFw0wODA4MDExMjMx
-NDBaFw0zODA3MzExMjMxNDBaMIGsMQswCQYDVQQGEwJFVTFDMEEGA1UEBxM6TWFkcmlkIChzZWUg
-Y3VycmVudCBhZGRyZXNzIGF0IHd3dy5jYW1lcmZpcm1hLmNvbS9hZGRyZXNzKTESMBAGA1UEBRMJ
-QTgyNzQzMjg3MRswGQYDVQQKExJBQyBDYW1lcmZpcm1hIFMuQS4xJzAlBgNVBAMTHkdsb2JhbCBD
-aGFtYmVyc2lnbiBSb290IC0gMjAwODCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAMDf
-VtPkOpt2RbQT2//BthmLN0EYlVJH6xedKYiONWwGMi5HYvNJBL99RDaxccy9Wglz1dmFRP+RVyXf
-XjaOcNFccUMd2drvXNL7G706tcuto8xEpw2uIRU/uXpbknXYpBI4iRmKt4DS4jJvVpyR1ogQC7N0
-ZJJ0YPP2zxhPYLIj0Mc7zmFLmY/CDNBAspjcDahOo7kKrmCgrUVSY7pmvWjg+b4aqIG7HkF4ddPB
-/gBVsIdU6CeQNR1MM62X/JcumIS/LMmjv9GYERTtY/jKmIhYF5ntRQOXfjyGHoiMvvKRhI9lNNgA
-TH23MRdaKXoKGCQwoze1eqkBfSbW+Q6OWfH9GzO1KTsXO0G2Id3UwD2ln58fQ1DJu7xsepeY7s2M
-H/ucUa6LcL0nn3HAa6x9kGbo1106DbDVwo3VyJ2dwW3Q0L9R5OP4wzg2rtandeavhENdk5IMagfe
-Ox2YItaswTXbo6Al/3K1dh3ebeksZixShNBFks4c5eUzHdwHU1SjqoI7mjcv3N2gZOnm3b2u/GSF
-HTynyQbehP9r6GsaPMWis0L7iwk+XwhSx2LE1AVxv8Rk5Pihg+g+EpuoHtQ2TS9x9o0o9oOpE9Jh
-wZG7SMA0j0GMS0zbaRL/UJScIINZc+18ofLx/d33SdNDWKBWY8o9PeU1VlnpDsogzCtLkykPAgMB
-AAGjggFqMIIBZjASBgNVHRMBAf8ECDAGAQH/AgEMMB0GA1UdDgQWBBS5CcqcHtvTbDprru1U8VuT
-BjUuXjCB4QYDVR0jBIHZMIHWgBS5CcqcHtvTbDprru1U8VuTBjUuXqGBsqSBrzCBrDELMAkGA1UE
-BhMCRVUxQzBBBgNVBAcTOk1hZHJpZCAoc2VlIGN1cnJlbnQgYWRkcmVzcyBhdCB3d3cuY2FtZXJm
-aXJtYS5jb20vYWRkcmVzcykxEjAQBgNVBAUTCUE4Mjc0MzI4NzEbMBkGA1UEChMSQUMgQ2FtZXJm
-aXJtYSBTLkEuMScwJQYDVQQDEx5HbG9iYWwgQ2hhbWJlcnNpZ24gUm9vdCAtIDIwMDiCCQDJzdPp
-1X0jzjAOBgNVHQ8BAf8EBAMCAQYwPQYDVR0gBDYwNDAyBgRVHSAAMCowKAYIKwYBBQUHAgEWHGh0
-dHA6Ly9wb2xpY3kuY2FtZXJmaXJtYS5jb20wDQYJKoZIhvcNAQEFBQADggIBAICIf3DekijZBZRG
-/5BXqfEv3xoNa/p8DhxJJHkn2EaqbylZUohwEurdPfWbU1Rv4WCiqAm57OtZfMY18dwY6fFn5a+6
-ReAJ3spED8IXDneRRXozX1+WLGiLwUePmJs9wOzL9dWCkoQ10b42OFZyMVtHLaoXpGNR6woBrX/s
-dZ7LoR/xfxKxueRkf2fWIyr0uDldmOghp+G9PUIadJpwr2hsUF1Jz//7Dl3mLEfXgTpZALVza2Mg
-9jFFCDkO9HB+QHBaP9BrQql0PSgvAm11cpUJjUhjxsYjV5KTXjXBjfkK9yydYhz2rXzdpjEetrHH
-foUm+qRqtdpjMNHvkzeyZi99Bffnt0uYlDXA2TopwZ2yUDMdSqlapskD7+3056huirRXhOukP9Du
-qqqHW2Pok+JrqNS4cnhrG+055F3Lm6qH1U9OAP7Zap88MQ8oAgF9mOinsKJknnn4SPIVqczmyETr
-P3iZ8ntxPjzxmKfFGBI/5rsoM0LpRQp8bfKGeS/Fghl9CYl8slR2iK7ewfPM4W7bMdaTrpmg7yVq
-c5iJWzouE4gev8CSlDQb4ye3ix5vQv/n6TebUB0tovkC7stYWDpxvGjjqsGvHCgfotwjZT+B6q6Z
-09gwzxMNTxXJhLynSC34MCN32EZLeW32jO06f2ARePTpm67VVMB0gNELQp/B
------END CERTIFICATE-----
-
-Go Daddy Root Certificate Authority - G2
-========================================
------BEGIN CERTIFICATE-----
-MIIDxTCCAq2gAwIBAgIBADANBgkqhkiG9w0BAQsFADCBgzELMAkGA1UEBhMCVVMxEDAOBgNVBAgT
-B0FyaXpvbmExEzARBgNVBAcTClNjb3R0c2RhbGUxGjAYBgNVBAoTEUdvRGFkZHkuY29tLCBJbmMu
-MTEwLwYDVQQDEyhHbyBEYWRkeSBSb290IENlcnRpZmljYXRlIEF1dGhvcml0eSAtIEcyMB4XDTA5
-MDkwMTAwMDAwMFoXDTM3MTIzMTIzNTk1OVowgYMxCzAJBgNVBAYTAlVTMRAwDgYDVQQIEwdBcml6
-b25hMRMwEQYDVQQHEwpTY290dHNkYWxlMRowGAYDVQQKExFHb0RhZGR5LmNvbSwgSW5jLjExMC8G
-A1UEAxMoR28gRGFkZHkgUm9vdCBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkgLSBHMjCCASIwDQYJKoZI
-hvcNAQEBBQADggEPADCCAQoCggEBAL9xYgjx+lk09xvJGKP3gElY6SKDE6bFIEMBO4Tx5oVJnyfq
-9oQbTqC023CYxzIBsQU+B07u9PpPL1kwIuerGVZr4oAH/PMWdYA5UXvl+TW2dE6pjYIT5LY/qQOD
-+qK+ihVqf94Lw7YZFAXK6sOoBJQ7RnwyDfMAZiLIjWltNowRGLfTshxgtDj6AozO091GB94KPutd
-fMh8+7ArU6SSYmlRJQVhGkSBjCypQ5Yj36w6gZoOKcUcqeldHraenjAKOc7xiID7S13MMuyFYkMl
-NAJWJwGRtDtwKj9useiciAF9n9T521NtYJ2/LOdYq7hfRvzOxBsDPAnrSTFcaUaz4EcCAwEAAaNC
-MEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFDqahQcQZyi27/a9
-BUFuIMGU2g/eMA0GCSqGSIb3DQEBCwUAA4IBAQCZ21151fmXWWcDYfF+OwYxdS2hII5PZYe096ac
-vNjpL9DbWu7PdIxztDhC2gV7+AJ1uP2lsdeu9tfeE8tTEH6KRtGX+rcuKxGrkLAngPnon1rpN5+r
-5N9ss4UXnT3ZJE95kTXWXwTrgIOrmgIttRD02JDHBHNA7XIloKmf7J6raBKZV8aPEjoJpL1E/QYV
-N8Gb5DKj7Tjo2GTzLH4U/ALqn83/B2gX2yKQOC16jdFU8WnjXzPKej17CuPKf1855eJ1usV2GDPO
-LPAvTK33sefOT6jEm0pUBsV/fdUID+Ic/n4XuKxe9tQWskMJDE32p2u0mYRlynqI4uJEvlz36hz1
------END CERTIFICATE-----
-
-Starfield Root Certificate Authority - G2
-=========================================
------BEGIN CERTIFICATE-----
-MIID3TCCAsWgAwIBAgIBADANBgkqhkiG9w0BAQsFADCBjzELMAkGA1UEBhMCVVMxEDAOBgNVBAgT
-B0FyaXpvbmExEzARBgNVBAcTClNjb3R0c2RhbGUxJTAjBgNVBAoTHFN0YXJmaWVsZCBUZWNobm9s
-b2dpZXMsIEluYy4xMjAwBgNVBAMTKVN0YXJmaWVsZCBSb290IENlcnRpZmljYXRlIEF1dGhvcml0
-eSAtIEcyMB4XDTA5MDkwMTAwMDAwMFoXDTM3MTIzMTIzNTk1OVowgY8xCzAJBgNVBAYTAlVTMRAw
-DgYDVQQIEwdBcml6b25hMRMwEQYDVQQHEwpTY290dHNkYWxlMSUwIwYDVQQKExxTdGFyZmllbGQg
-VGVjaG5vbG9naWVzLCBJbmMuMTIwMAYDVQQDEylTdGFyZmllbGQgUm9vdCBDZXJ0aWZpY2F0ZSBB
-dXRob3JpdHkgLSBHMjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAL3twQP89o/8ArFv
-W59I2Z154qK3A2FWGMNHttfKPTUuiUP3oWmb3ooa/RMgnLRJdzIpVv257IzdIvpy3Cdhl+72WoTs
-bhm5iSzchFvVdPtrX8WJpRBSiUZV9Lh1HOZ/5FSuS/hVclcCGfgXcVnrHigHdMWdSL5stPSksPNk
-N3mSwOxGXn/hbVNMYq/NHwtjuzqd+/x5AJhhdM8mgkBj87JyahkNmcrUDnXMN/uLicFZ8WJ/X7Nf
-ZTD4p7dNdloedl40wOiWVpmKs/B/pM293DIxfJHP4F8R+GuqSVzRmZTRouNjWwl2tVZi4Ut0HZbU
-JtQIBFnQmA4O5t78w+wfkPECAwEAAaNCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMC
-AQYwHQYDVR0OBBYEFHwMMh+n2TB/xH1oo2Kooc6rB1snMA0GCSqGSIb3DQEBCwUAA4IBAQARWfol
-TwNvlJk7mh+ChTnUdgWUXuEok21iXQnCoKjUsHU48TRqneSfioYmUeYs0cYtbpUgSpIB7LiKZ3sx
-4mcujJUDJi5DnUox9g61DLu34jd/IroAow57UvtruzvE03lRTs2Q9GcHGcg8RnoNAX3FWOdt5oUw
-F5okxBDgBPfg8n/Uqgr/Qh037ZTlZFkSIHc40zI+OIF1lnP6aI+xy84fxez6nH7PfrHxBy22/L/K
-pL/QlwVKvOoYKAKQvVR4CSFx09F9HdkWsKlhPdAKACL8x3vLCWRFCztAgfd9fDL1mMpYjn0q7pBZ
-c2T5NnReJaH1ZgUufzkVqSr7UIuOhWn0
------END CERTIFICATE-----
-
-Starfield Services Root Certificate Authority - G2
-==================================================
------BEGIN CERTIFICATE-----
-MIID7zCCAtegAwIBAgIBADANBgkqhkiG9w0BAQsFADCBmDELMAkGA1UEBhMCVVMxEDAOBgNVBAgT
-B0FyaXpvbmExEzARBgNVBAcTClNjb3R0c2RhbGUxJTAjBgNVBAoTHFN0YXJmaWVsZCBUZWNobm9s
-b2dpZXMsIEluYy4xOzA5BgNVBAMTMlN0YXJmaWVsZCBTZXJ2aWNlcyBSb290IENlcnRpZmljYXRl
-IEF1dGhvcml0eSAtIEcyMB4XDTA5MDkwMTAwMDAwMFoXDTM3MTIzMTIzNTk1OVowgZgxCzAJBgNV
-BAYTAlVTMRAwDgYDVQQIEwdBcml6b25hMRMwEQYDVQQHEwpTY290dHNkYWxlMSUwIwYDVQQKExxT
-dGFyZmllbGQgVGVjaG5vbG9naWVzLCBJbmMuMTswOQYDVQQDEzJTdGFyZmllbGQgU2VydmljZXMg
-Um9vdCBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkgLSBHMjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCC
-AQoCggEBANUMOsQq+U7i9b4Zl1+OiFOxHz/Lz58gE20pOsgPfTz3a3Y4Y9k2YKibXlwAgLIvWX/2
-h/klQ4bnaRtSmpDhcePYLQ1Ob/bISdm28xpWriu2dBTrz/sm4xq6HZYuajtYlIlHVv8loJNwU4Pa
-hHQUw2eeBGg6345AWh1KTs9DkTvnVtYAcMtS7nt9rjrnvDH5RfbCYM8TWQIrgMw0R9+53pBlbQLP
-LJGmpufehRhJfGZOozptqbXuNC66DQO4M99H67FrjSXZm86B0UVGMpZwh94CDklDhbZsc7tk6mFB
-rMnUVN+HL8cisibMn1lUaJ/8viovxFUcdUBgF4UCVTmLfwUCAwEAAaNCMEAwDwYDVR0TAQH/BAUw
-AwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFJxfAN+qAdcwKziIorhtSpzyEZGDMA0GCSqG
-SIb3DQEBCwUAA4IBAQBLNqaEd2ndOxmfZyMIbw5hyf2E3F/YNoHN2BtBLZ9g3ccaaNnRbobhiCPP
-E95Dz+I0swSdHynVv/heyNXBve6SbzJ08pGCL72CQnqtKrcgfU28elUSwhXqvfdqlS5sdJ/PHLTy
-xQGjhdByPq1zqwubdQxtRbeOlKyWN7Wg0I8VRw7j6IPdj/3vQQF3zCepYoUz8jcI73HPdwbeyBkd
-iEDPfUYd/x7H4c7/I9vG+o1VTqkC50cRRj70/b17KSa7qWFiNyi2LSr2EIZkyXCn0q23KXB56jza
-YyWf/Wi3MOxw+3WKt21gZ7IeyLnp2KhvAotnDU0mV3HaIPzBSlCNsSi6
------END CERTIFICATE-----
-
-AffirmTrust Commercial
-======================
------BEGIN CERTIFICATE-----
-MIIDTDCCAjSgAwIBAgIId3cGJyapsXwwDQYJKoZIhvcNAQELBQAwRDELMAkGA1UEBhMCVVMxFDAS
-BgNVBAoMC0FmZmlybVRydXN0MR8wHQYDVQQDDBZBZmZpcm1UcnVzdCBDb21tZXJjaWFsMB4XDTEw
-MDEyOTE0MDYwNloXDTMwMTIzMTE0MDYwNlowRDELMAkGA1UEBhMCVVMxFDASBgNVBAoMC0FmZmly
-bVRydXN0MR8wHQYDVQQDDBZBZmZpcm1UcnVzdCBDb21tZXJjaWFsMIIBIjANBgkqhkiG9w0BAQEF
-AAOCAQ8AMIIBCgKCAQEA9htPZwcroRX1BiLLHwGy43NFBkRJLLtJJRTWzsO3qyxPxkEylFf6Eqdb
-DuKPHx6GGaeqtS25Xw2Kwq+FNXkyLbscYjfysVtKPcrNcV/pQr6U6Mje+SJIZMblq8Yrba0F8PrV
-C8+a5fBQpIs7R6UjW3p6+DM/uO+Zl+MgwdYoic+U+7lF7eNAFxHUdPALMeIrJmqbTFeurCA+ukV6
-BfO9m2kVrn1OIGPENXY6BwLJN/3HR+7o8XYdcxXyl6S1yHp52UKqK39c/s4mT6NmgTWvRLpUHhww
-MmWd5jyTXlBOeuM61G7MGvv50jeuJCqrVwMiKA1JdX+3KNp1v47j3A55MQIDAQABo0IwQDAdBgNV
-HQ4EFgQUnZPGU4teyq8/nx4P5ZmVvCT2lI8wDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMC
-AQYwDQYJKoZIhvcNAQELBQADggEBAFis9AQOzcAN/wr91LoWXym9e2iZWEnStB03TX8nfUYGXUPG
-hi4+c7ImfU+TqbbEKpqrIZcUsd6M06uJFdhrJNTxFq7YpFzUf1GO7RgBsZNjvbz4YYCanrHOQnDi
-qX0GJX0nof5v7LMeJNrjS1UaADs1tDvZ110w/YETifLCBivtZ8SOyUOyXGsViQK8YvxO8rUzqrJv
-0wqiUOP2O+guRMLbZjipM1ZI8W0bM40NjD9gN53Tym1+NH4Nn3J2ixufcv1SNUFFApYvHLKac0kh
-sUlHRUe072o0EclNmsxZt9YCnlpOZbWUrhvfKbAW8b8Angc6F2S1BLUjIZkKlTuXfO8=
------END CERTIFICATE-----
-
-AffirmTrust Networking
-======================
------BEGIN CERTIFICATE-----
-MIIDTDCCAjSgAwIBAgIIfE8EORzUmS0wDQYJKoZIhvcNAQEFBQAwRDELMAkGA1UEBhMCVVMxFDAS
-BgNVBAoMC0FmZmlybVRydXN0MR8wHQYDVQQDDBZBZmZpcm1UcnVzdCBOZXR3b3JraW5nMB4XDTEw
-MDEyOTE0MDgyNFoXDTMwMTIzMTE0MDgyNFowRDELMAkGA1UEBhMCVVMxFDASBgNVBAoMC0FmZmly
-bVRydXN0MR8wHQYDVQQDDBZBZmZpcm1UcnVzdCBOZXR3b3JraW5nMIIBIjANBgkqhkiG9w0BAQEF
-AAOCAQ8AMIIBCgKCAQEAtITMMxcua5Rsa2FSoOujz3mUTOWUgJnLVWREZY9nZOIG41w3SfYvm4SE
-Hi3yYJ0wTsyEheIszx6e/jarM3c1RNg1lho9Nuh6DtjVR6FqaYvZ/Ls6rnla1fTWcbuakCNrmreI
-dIcMHl+5ni36q1Mr3Lt2PpNMCAiMHqIjHNRqrSK6mQEubWXLviRmVSRLQESxG9fhwoXA3hA/Pe24
-/PHxI1Pcv2WXb9n5QHGNfb2V1M6+oF4nI979ptAmDgAp6zxG8D1gvz9Q0twmQVGeFDdCBKNwV6gb
-h+0t+nvujArjqWaJGctB+d1ENmHP4ndGyH329JKBNv3bNPFyfvMMFr20FQIDAQABo0IwQDAdBgNV
-HQ4EFgQUBx/S55zawm6iQLSwelAQUHTEyL0wDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMC
-AQYwDQYJKoZIhvcNAQEFBQADggEBAIlXshZ6qML91tmbmzTCnLQyFE2npN/svqe++EPbkTfOtDIu
-UFUaNU52Q3Eg75N3ThVwLofDwR1t3Mu1J9QsVtFSUzpE0nPIxBsFZVpikpzuQY0x2+c06lkh1QF6
-12S4ZDnNye2v7UsDSKegmQGA3GWjNq5lWUhPgkvIZfFXHeVZLgo/bNjR9eUJtGxUAArgFU2HdW23
-WJZa3W3SAKD0m0i+wzekujbgfIeFlxoVot4uolu9rxj5kFDNcFn4J2dHy8egBzp90SxdbBk6ZrV9
-/ZFvgrG+CJPbFEfxojfHRZ48x3evZKiT3/Zpg4Jg8klCNO1aAFSFHBY2kgxc+qatv9s=
------END CERTIFICATE-----
-
-AffirmTrust Premium
-===================
------BEGIN CERTIFICATE-----
-MIIFRjCCAy6gAwIBAgIIbYwURrGmCu4wDQYJKoZIhvcNAQEMBQAwQTELMAkGA1UEBhMCVVMxFDAS
-BgNVBAoMC0FmZmlybVRydXN0MRwwGgYDVQQDDBNBZmZpcm1UcnVzdCBQcmVtaXVtMB4XDTEwMDEy
-OTE0MTAzNloXDTQwMTIzMTE0MTAzNlowQTELMAkGA1UEBhMCVVMxFDASBgNVBAoMC0FmZmlybVRy
-dXN0MRwwGgYDVQQDDBNBZmZpcm1UcnVzdCBQcmVtaXVtMIICIjANBgkqhkiG9w0BAQEFAAOCAg8A
-MIICCgKCAgEAxBLfqV/+Qd3d9Z+K4/as4Tx4mrzY8H96oDMq3I0gW64tb+eT2TZwamjPjlGjhVtn
-BKAQJG9dKILBl1fYSCkTtuG+kU3fhQxTGJoeJKJPj/CihQvL9Cl/0qRY7iZNyaqoe5rZ+jjeRFcV
-5fiMyNlI4g0WJx0eyIOFJbe6qlVBzAMiSy2RjYvmia9mx+n/K+k8rNrSs8PhaJyJ+HoAVt70VZVs
-+7pk3WKL3wt3MutizCaam7uqYoNMtAZ6MMgpv+0GTZe5HMQxK9VfvFMSF5yZVylmd2EhMQcuJUmd
-GPLu8ytxjLW6OQdJd/zvLpKQBY0tL3d770O/Nbua2Plzpyzy0FfuKE4mX4+QaAkvuPjcBukumj5R
-p9EixAqnOEhss/n/fauGV+O61oV4d7pD6kh/9ti+I20ev9E2bFhc8e6kGVQa9QPSdubhjL08s9NI
-S+LI+H+SqHZGnEJlPqQewQcDWkYtuJfzt9WyVSHvutxMAJf7FJUnM7/oQ0dG0giZFmA7mn7S5u04
-6uwBHjxIVkkJx0w3AJ6IDsBz4W9m6XJHMD4Q5QsDyZpCAGzFlH5hxIrff4IaC1nEWTJ3s7xgaVY5
-/bQGeyzWZDbZvUjthB9+pSKPKrhC9IK31FOQeE4tGv2Bb0TXOwF0lkLgAOIua+rF7nKsu7/+6qqo
-+Nz2snmKtmcCAwEAAaNCMEAwHQYDVR0OBBYEFJ3AZ6YMItkm9UWrpmVSESfYRaxjMA8GA1UdEwEB
-/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMA0GCSqGSIb3DQEBDAUAA4ICAQCzV00QYk465KzquByv
-MiPIs0laUZx2KI15qldGF9X1Uva3ROgIRL8YhNILgM3FEv0AVQVhh0HctSSePMTYyPtwni94loMg
-Nt58D2kTiKV1NpgIpsbfrM7jWNa3Pt668+s0QNiigfV4Py/VpfzZotReBA4Xrf5B8OWycvpEgjNC
-6C1Y91aMYj+6QrCcDFx+LmUmXFNPALJ4fqENmS2NuB2OosSw/WDQMKSOyARiqcTtNd56l+0OOF6S
-L5Nwpamcb6d9Ex1+xghIsV5n61EIJenmJWtSKZGc0jlzCFfemQa0W50QBuHCAKi4HEoCChTQwUHK
-+4w1IX2COPKpVJEZNZOUbWo6xbLQu4mGk+ibyQ86p3q4ofB4Rvr8Ny/lioTz3/4E2aFooC8k4gmV
-BtWVyuEklut89pMFu+1z6S3RdTnX5yTb2E5fQ4+e0BQ5v1VwSJlXMbSc7kqYA5YwH2AG7hsj/oFg
-IxpHYoWlzBk0gG+zrBrjn/B7SK3VAdlntqlyk+otZrWyuOQ9PLLvTIzq6we/qzWaVYa8GKa1qF60
-g2xraUDTn9zxw2lrueFtCfTxqlB2Cnp9ehehVZZCmTEJ3WARjQUwfuaORtGdFNrHF+QFlozEJLUb
-zxQHskD4o55BhrwE0GuWyCqANP2/7waj3VjFhT0+j/6eKeC2uAloGRwYQw==
------END CERTIFICATE-----
-
-AffirmTrust Premium ECC
-=======================
------BEGIN CERTIFICATE-----
-MIIB/jCCAYWgAwIBAgIIdJclisc/elQwCgYIKoZIzj0EAwMwRTELMAkGA1UEBhMCVVMxFDASBgNV
-BAoMC0FmZmlybVRydXN0MSAwHgYDVQQDDBdBZmZpcm1UcnVzdCBQcmVtaXVtIEVDQzAeFw0xMDAx
-MjkxNDIwMjRaFw00MDEyMzExNDIwMjRaMEUxCzAJBgNVBAYTAlVTMRQwEgYDVQQKDAtBZmZpcm1U
-cnVzdDEgMB4GA1UEAwwXQWZmaXJtVHJ1c3QgUHJlbWl1bSBFQ0MwdjAQBgcqhkjOPQIBBgUrgQQA
-IgNiAAQNMF4bFZ0D0KF5Nbc6PJJ6yhUczWLznCZcBz3lVPqj1swS6vQUX+iOGasvLkjmrBhDeKzQ
-N8O9ss0s5kfiGuZjuD0uL3jET9v0D6RoTFVya5UdThhClXjMNzyR4ptlKymjQjBAMB0GA1UdDgQW
-BBSaryl6wBE1NSZRMADDav5A1a7WPDAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBBjAK
-BggqhkjOPQQDAwNnADBkAjAXCfOHiFBar8jAQr9HX/VsaobgxCd05DhT1wV/GzTjxi+zygk8N53X
-57hG8f2h4nECMEJZh0PUUd+60wkyWs6Iflc9nF9Ca/UHLbXwgpP5WW+uZPpY5Yse42O+tYHNbwKM
-eQ==
------END CERTIFICATE-----
-
-Certum Trusted Network CA
-=========================
------BEGIN CERTIFICATE-----
-MIIDuzCCAqOgAwIBAgIDBETAMA0GCSqGSIb3DQEBBQUAMH4xCzAJBgNVBAYTAlBMMSIwIAYDVQQK
-ExlVbml6ZXRvIFRlY2hub2xvZ2llcyBTLkEuMScwJQYDVQQLEx5DZXJ0dW0gQ2VydGlmaWNhdGlv
-biBBdXRob3JpdHkxIjAgBgNVBAMTGUNlcnR1bSBUcnVzdGVkIE5ldHdvcmsgQ0EwHhcNMDgxMDIy
-MTIwNzM3WhcNMjkxMjMxMTIwNzM3WjB+MQswCQYDVQQGEwJQTDEiMCAGA1UEChMZVW5pemV0byBU
-ZWNobm9sb2dpZXMgUy5BLjEnMCUGA1UECxMeQ2VydHVtIENlcnRpZmljYXRpb24gQXV0aG9yaXR5
-MSIwIAYDVQQDExlDZXJ0dW0gVHJ1c3RlZCBOZXR3b3JrIENBMIIBIjANBgkqhkiG9w0BAQEFAAOC
-AQ8AMIIBCgKCAQEA4/t9o3K6wvDJFIf1awFO4W5AB7ptJ11/91sts1rHUV+rpDKmYYe2bg+G0jAC
-l/jXaVehGDldamR5xgFZrDwxSjh80gTSSyjoIF87B6LMTXPb865Px1bVWqeWifrzq2jUI4ZZJ88J
-J7ysbnKDHDBy3+Ci6dLhdHUZvSqeexVUBBvXQzmtVSjF4hq79MDkrjhJM8x2hZ85RdKknvISjFH4
-fOQtf/WsX+sWn7Et0brMkUJ3TCXJkDhv2/DM+44el1k+1WBO5gUo7Ul5E0u6SNsv+XLTOcr+H9g0
-cvW0QM8xAcPs3hEtF10fuFDRXhmnad4HMyjKUJX5p1TLVIZQRan5SQIDAQABo0IwQDAPBgNVHRMB
-Af8EBTADAQH/MB0GA1UdDgQWBBQIds3LB/8k9sXN7buQvOKEN0Z19zAOBgNVHQ8BAf8EBAMCAQYw
-DQYJKoZIhvcNAQEFBQADggEBAKaorSLOAT2mo/9i0Eidi15ysHhE49wcrwn9I0j6vSrEuVUEtRCj
-jSfeC4Jj0O7eDDd5QVsisrCaQVymcODU0HfLI9MA4GxWL+FpDQ3Zqr8hgVDZBqWo/5U30Kr+4rP1
-mS1FhIrlQgnXdAIv94nYmem8J9RHjboNRhx3zxSkHLmkMcScKHQDNP8zGSal6Q10tz6XxnboJ5aj
-Zt3hrvJBW8qYVoNzcOSGGtIxQbovvi0TWnZvTuhOgQ4/WwMioBK+ZlgRSssDxLQqKi2WF+A5VLxI
-03YnnZotBqbJ7DnSq9ufmgsnAjUpsUCV5/nonFWIGUbWtzT1fs45mtk48VH3Tyw=
------END CERTIFICATE-----
-
-Certinomis - Autorité Racine
-=============================
------BEGIN CERTIFICATE-----
-MIIFnDCCA4SgAwIBAgIBATANBgkqhkiG9w0BAQUFADBjMQswCQYDVQQGEwJGUjETMBEGA1UEChMK
-Q2VydGlub21pczEXMBUGA1UECxMOMDAwMiA0MzM5OTg5MDMxJjAkBgNVBAMMHUNlcnRpbm9taXMg
-LSBBdXRvcml0w6kgUmFjaW5lMB4XDTA4MDkxNzA4Mjg1OVoXDTI4MDkxNzA4Mjg1OVowYzELMAkG
-A1UEBhMCRlIxEzARBgNVBAoTCkNlcnRpbm9taXMxFzAVBgNVBAsTDjAwMDIgNDMzOTk4OTAzMSYw
-JAYDVQQDDB1DZXJ0aW5vbWlzIC0gQXV0b3JpdMOpIFJhY2luZTCCAiIwDQYJKoZIhvcNAQEBBQAD
-ggIPADCCAgoCggIBAJ2Fn4bT46/HsmtuM+Cet0I0VZ35gb5j2CN2DpdUzZlMGvE5x4jYF1AMnmHa
-wE5V3udauHpOd4cN5bjr+p5eex7Ezyh0x5P1FMYiKAT5kcOrJ3NqDi5N8y4oH3DfVS9O7cdxbwly
-Lu3VMpfQ8Vh30WC8Tl7bmoT2R2FFK/ZQpn9qcSdIhDWerP5pqZ56XjUl+rSnSTV3lqc2W+HN3yNw
-2F1MpQiD8aYkOBOo7C+ooWfHpi2GR+6K/OybDnT0K0kCe5B1jPyZOQE51kqJ5Z52qz6WKDgmi92N
-jMD2AR5vpTESOH2VwnHu7XSu5DaiQ3XV8QCb4uTXzEIDS3h65X27uK4uIJPT5GHfceF2Z5c/tt9q
-c1pkIuVC28+BA5PY9OMQ4HL2AHCs8MF6DwV/zzRpRbWT5BnbUhYjBYkOjUjkJW+zeL9i9Qf6lSTC
-lrLooyPCXQP8w9PlfMl1I9f09bze5N/NgL+RiH2nE7Q5uiy6vdFrzPOlKO1Enn1So2+WLhl+HPNb
-xxaOu2B9d2ZHVIIAEWBsMsGoOBvrbpgT1u449fCfDu/+MYHB0iSVL1N6aaLwD4ZFjliCK0wi1F6g
-530mJ0jfJUaNSih8hp75mxpZuWW/Bd22Ql095gBIgl4g9xGC3srYn+Y3RyYe63j3YcNBZFgCQfna
-4NH4+ej9Uji29YnfAgMBAAGjWzBZMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0G
-A1UdDgQWBBQNjLZh2kS40RR9w759XkjwzspqsDAXBgNVHSAEEDAOMAwGCiqBegFWAgIAAQEwDQYJ
-KoZIhvcNAQEFBQADggIBACQ+YAZ+He86PtvqrxyaLAEL9MW12Ukx9F1BjYkMTv9sov3/4gbIOZ/x
-WqndIlgVqIrTseYyCYIDbNc/CMf4uboAbbnW/FIyXaR/pDGUu7ZMOH8oMDX/nyNTt7buFHAAQCva
-R6s0fl6nVjBhK4tDrP22iCj1a7Y+YEq6QpA0Z43q619FVDsXrIvkxmUP7tCMXWY5zjKn2BCXwH40
-nJ+U8/aGH88bc62UeYdocMMzpXDn2NU4lG9jeeu/Cg4I58UvD0KgKxRA/yHgBcUn4YQRE7rWhh1B
-CxMjidPJC+iKunqjo3M3NYB9Ergzd0A4wPpeMNLytqOx1qKVl4GbUu1pTP+A5FPbVFsDbVRfsbjv
-JL1vnxHDx2TCDyhihWZeGnuyt++uNckZM6i4J9szVb9o4XVIRFb7zdNIu0eJOqxp9YDG5ERQL1TE
-qkPFMTFYvZbF6nVsmnWxTfj3l/+WFvKXTej28xH5On2KOG4Ey+HTRRWqpdEdnV1j6CTmNhTih60b
-WfVEm/vXd3wfAXBioSAaosUaKPQhA+4u2cGA6rnZgtZbdsLLO7XSAPCjDuGtbkD326C00EauFddE
-wk01+dIL8hf2rGbVJLJP0RyZwG71fet0BLj5TXcJ17TPBzAJ8bgAVtkXFhYKK4bfjwEZGuW7gmP/
-vgt2Fl43N+bYdJeimUV5
------END CERTIFICATE-----
-
-Root CA Generalitat Valenciana
-==============================
------BEGIN CERTIFICATE-----
-MIIGizCCBXOgAwIBAgIEO0XlaDANBgkqhkiG9w0BAQUFADBoMQswCQYDVQQGEwJFUzEfMB0GA1UE
-ChMWR2VuZXJhbGl0YXQgVmFsZW5jaWFuYTEPMA0GA1UECxMGUEtJR1ZBMScwJQYDVQQDEx5Sb290
-IENBIEdlbmVyYWxpdGF0IFZhbGVuY2lhbmEwHhcNMDEwNzA2MTYyMjQ3WhcNMjEwNzAxMTUyMjQ3
-WjBoMQswCQYDVQQGEwJFUzEfMB0GA1UEChMWR2VuZXJhbGl0YXQgVmFsZW5jaWFuYTEPMA0GA1UE
-CxMGUEtJR1ZBMScwJQYDVQQDEx5Sb290IENBIEdlbmVyYWxpdGF0IFZhbGVuY2lhbmEwggEiMA0G
-CSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDGKqtXETcvIorKA3Qdyu0togu8M1JAJke+WmmmO3I2
-F0zo37i7L3bhQEZ0ZQKQUgi0/6iMweDHiVYQOTPvaLRfX9ptI6GJXiKjSgbwJ/BXufjpTjJ3Cj9B
-ZPPrZe52/lSqfR0grvPXdMIKX/UIKFIIzFVd0g/bmoGlu6GzwZTNVOAydTGRGmKy3nXiz0+J2ZGQ
-D0EbtFpKd71ng+CT516nDOeB0/RSrFOyA8dEJvt55cs0YFAQexvba9dHq198aMpunUEDEO5rmXte
-JajCq+TA81yc477OMUxkHl6AovWDfgzWyoxVjr7gvkkHD6MkQXpYHYTqWBLI4bft75PelAgxAgMB
-AAGjggM7MIIDNzAyBggrBgEFBQcBAQQmMCQwIgYIKwYBBQUHMAGGFmh0dHA6Ly9vY3NwLnBraS5n
-dmEuZXMwEgYDVR0TAQH/BAgwBgEB/wIBAjCCAjQGA1UdIASCAiswggInMIICIwYKKwYBBAG/VQIB
-ADCCAhMwggHoBggrBgEFBQcCAjCCAdoeggHWAEEAdQB0AG8AcgBpAGQAYQBkACAAZABlACAAQwBl
-AHIAdABpAGYAaQBjAGEAYwBpAPMAbgAgAFIAYQDtAHoAIABkAGUAIABsAGEAIABHAGUAbgBlAHIA
-YQBsAGkAdABhAHQAIABWAGEAbABlAG4AYwBpAGEAbgBhAC4ADQAKAEwAYQAgAEQAZQBjAGwAYQBy
-AGEAYwBpAPMAbgAgAGQAZQAgAFAAcgDhAGMAdABpAGMAYQBzACAAZABlACAAQwBlAHIAdABpAGYA
-aQBjAGEAYwBpAPMAbgAgAHEAdQBlACAAcgBpAGcAZQAgAGUAbAAgAGYAdQBuAGMAaQBvAG4AYQBt
-AGkAZQBuAHQAbwAgAGQAZQAgAGwAYQAgAHAAcgBlAHMAZQBuAHQAZQAgAEEAdQB0AG8AcgBpAGQA
-YQBkACAAZABlACAAQwBlAHIAdABpAGYAaQBjAGEAYwBpAPMAbgAgAHMAZQAgAGUAbgBjAHUAZQBu
-AHQAcgBhACAAZQBuACAAbABhACAAZABpAHIAZQBjAGMAaQDzAG4AIAB3AGUAYgAgAGgAdAB0AHAA
-OgAvAC8AdwB3AHcALgBwAGsAaQAuAGcAdgBhAC4AZQBzAC8AYwBwAHMwJQYIKwYBBQUHAgEWGWh0
-dHA6Ly93d3cucGtpLmd2YS5lcy9jcHMwHQYDVR0OBBYEFHs100DSHHgZZu90ECjcPk+yeAT8MIGV
-BgNVHSMEgY0wgYqAFHs100DSHHgZZu90ECjcPk+yeAT8oWykajBoMQswCQYDVQQGEwJFUzEfMB0G
-A1UEChMWR2VuZXJhbGl0YXQgVmFsZW5jaWFuYTEPMA0GA1UECxMGUEtJR1ZBMScwJQYDVQQDEx5S
-b290IENBIEdlbmVyYWxpdGF0IFZhbGVuY2lhbmGCBDtF5WgwDQYJKoZIhvcNAQEFBQADggEBACRh
-TvW1yEICKrNcda3FbcrnlD+laJWIwVTAEGmiEi8YPyVQqHxK6sYJ2fR1xkDar1CdPaUWu20xxsdz
-Ckj+IHLtb8zog2EWRpABlUt9jppSCS/2bxzkoXHPjCpaF3ODR00PNvsETUlR4hTJZGH71BTg9J63
-NI8KJr2XXPR5OkowGcytT6CYirQxlyric21+eLj4iIlPsSKRZEv1UN4D2+XFducTZnV+ZfsBn5OH
-iJ35Rld8TWCvmHMTI6QgkYH60GFmuH3Rr9ZvHmw96RH9qfmCIoaZM3Fa6hlXPZHNqcCjbgcTpsnt
-+GijnsNacgmHKNHEc8RzGF9QdRYxn7fofMM=
------END CERTIFICATE-----
-
-A-Trust-nQual-03
-================
------BEGIN CERTIFICATE-----
-MIIDzzCCAregAwIBAgIDAWweMA0GCSqGSIb3DQEBBQUAMIGNMQswCQYDVQQGEwJBVDFIMEYGA1UE
-Cgw/QS1UcnVzdCBHZXMuIGYuIFNpY2hlcmhlaXRzc3lzdGVtZSBpbSBlbGVrdHIuIERhdGVudmVy
-a2VociBHbWJIMRkwFwYDVQQLDBBBLVRydXN0LW5RdWFsLTAzMRkwFwYDVQQDDBBBLVRydXN0LW5R
-dWFsLTAzMB4XDTA1MDgxNzIyMDAwMFoXDTE1MDgxNzIyMDAwMFowgY0xCzAJBgNVBAYTAkFUMUgw
-RgYDVQQKDD9BLVRydXN0IEdlcy4gZi4gU2ljaGVyaGVpdHNzeXN0ZW1lIGltIGVsZWt0ci4gRGF0
-ZW52ZXJrZWhyIEdtYkgxGTAXBgNVBAsMEEEtVHJ1c3QtblF1YWwtMDMxGTAXBgNVBAMMEEEtVHJ1
-c3QtblF1YWwtMDMwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCtPWFuA/OQO8BBC4SA
-zewqo51ru27CQoT3URThoKgtUaNR8t4j8DRE/5TrzAUjlUC5B3ilJfYKvUWG6Nm9wASOhURh73+n
-yfrBJcyFLGM/BWBzSQXgYHiVEEvc+RFZznF/QJuKqiTfC0Li21a8StKlDJu3Qz7dg9MmEALP6iPE
-SU7l0+m0iKsMrmKS1GWH2WrX9IWf5DMiJaXlyDO6w8dB3F/GaswADm0yqLaHNgBid5seHzTLkDx4
-iHQF63n1k3Flyp3HaxgtPVxO59X4PzF9j4fsCiIvI+n+u33J4PTs63zEsMMtYrWacdaxaujs2e3V
-cuy+VwHOBVWf3tFgiBCzAgMBAAGjNjA0MA8GA1UdEwEB/wQFMAMBAf8wEQYDVR0OBAoECERqlWdV
-eRFPMA4GA1UdDwEB/wQEAwIBBjANBgkqhkiG9w0BAQUFAAOCAQEAVdRU0VlIXLOThaq/Yy/kgM40
-ozRiPvbY7meIMQQDbwvUB/tOdQ/TLtPAF8fGKOwGDREkDg6lXb+MshOWcdzUzg4NCmgybLlBMRmr
-sQd7TZjTXLDR8KdCoLXEjq/+8T/0709GAHbrAvv5ndJAlseIOrifEXnzgGWovR/TeIGgUUw3tKZd
-JXDRZslo+S4RFGjxVJgIrCaSD96JntT6s3kr0qN51OyLrIdTaEJMUVF0HhsnLuP1Hyl0Te2v9+GS
-mYHovjrHF1D2t8b8m7CKa9aIA5GPBnc6hQLdmNVDeD/GMBWsm2vLV7eJUYs66MmEDNuxUCAKGkq6
-ahq97BvIxYSazQ==
------END CERTIFICATE-----
-
-TWCA Root Certification Authority
-=================================
------BEGIN CERTIFICATE-----
-MIIDezCCAmOgAwIBAgIBATANBgkqhkiG9w0BAQUFADBfMQswCQYDVQQGEwJUVzESMBAGA1UECgwJ
-VEFJV0FOLUNBMRAwDgYDVQQLDAdSb290IENBMSowKAYDVQQDDCFUV0NBIFJvb3QgQ2VydGlmaWNh
-dGlvbiBBdXRob3JpdHkwHhcNMDgwODI4MDcyNDMzWhcNMzAxMjMxMTU1OTU5WjBfMQswCQYDVQQG
-EwJUVzESMBAGA1UECgwJVEFJV0FOLUNBMRAwDgYDVQQLDAdSb290IENBMSowKAYDVQQDDCFUV0NB
-IFJvb3QgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEK
-AoIBAQCwfnK4pAOU5qfeCTiRShFAh6d8WWQUe7UREN3+v9XAu1bihSX0NXIP+FPQQeFEAcK0HMMx
-QhZHhTMidrIKbw/lJVBPhYa+v5guEGcevhEFhgWQxFnQfHgQsIBct+HHK3XLfJ+utdGdIzdjp9xC
-oi2SBBtQwXu4PhvJVgSLL1KbralW6cH/ralYhzC2gfeXRfwZVzsrb+RH9JlF/h3x+JejiB03HFyP
-4HYlmlD4oFT/RJB2I9IyxsOrBr/8+7/zrX2SYgJbKdM1o5OaQ2RgXbL6Mv87BK9NQGr5x+PvI/1r
-y+UPizgN7gr8/g+YnzAx3WxSZfmLgb4i4RxYA7qRG4kHAgMBAAGjQjBAMA4GA1UdDwEB/wQEAwIB
-BjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBRqOFsmjd6LWvJPelSDGRjjCDWmujANBgkqhkiG
-9w0BAQUFAAOCAQEAPNV3PdrfibqHDAhUaiBQkr6wQT25JmSDCi/oQMCXKCeCMErJk/9q56YAf4lC
-mtYR5VPOL8zy2gXE/uJQxDqGfczafhAJO5I1KlOy/usrBdlsXebQ79NqZp4VKIV66IIArB6nCWlW
-QtNoURi+VJq/REG6Sb4gumlc7rh3zc5sH62Dlhh9DrUUOYTxKOkto557HnpyWoOzeW/vtPzQCqVY
-T0bf+215WfKEIlKuD8z7fDvnaspHYcN6+NOSBB+4IIThNlQWx0DeO4pz3N/GCUzf7Nr/1FNCocny
-Yh0igzyXxfkZYiesZSLX0zzG5Y6yU8xJzrww/nsOM5D77dIUkR8Hrw==
------END CERTIFICATE-----
-
-Security Communication RootCA2
-==============================
------BEGIN CERTIFICATE-----
-MIIDdzCCAl+gAwIBAgIBADANBgkqhkiG9w0BAQsFADBdMQswCQYDVQQGEwJKUDElMCMGA1UEChMc
-U0VDT00gVHJ1c3QgU3lzdGVtcyBDTy4sTFRELjEnMCUGA1UECxMeU2VjdXJpdHkgQ29tbXVuaWNh
-dGlvbiBSb290Q0EyMB4XDTA5MDUyOTA1MDAzOVoXDTI5MDUyOTA1MDAzOVowXTELMAkGA1UEBhMC
-SlAxJTAjBgNVBAoTHFNFQ09NIFRydXN0IFN5c3RlbXMgQ08uLExURC4xJzAlBgNVBAsTHlNlY3Vy
-aXR5IENvbW11bmljYXRpb24gUm9vdENBMjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEB
-ANAVOVKxUrO6xVmCxF1SrjpDZYBLx/KWvNs2l9amZIyoXvDjChz335c9S672XewhtUGrzbl+dp++
-+T42NKA7wfYxEUV0kz1XgMX5iZnK5atq1LXaQZAQwdbWQonCv/Q4EpVMVAX3NuRFg3sUZdbcDE3R
-3n4MqzvEFb46VqZab3ZpUql6ucjrappdUtAtCms1FgkQhNBqyjoGADdH5H5XTz+L62e4iKrFvlNV
-spHEfbmwhRkGeC7bYRr6hfVKkaHnFtWOojnflLhwHyg/i/xAXmODPIMqGplrz95Zajv8bxbXH/1K
-EOtOghY6rCcMU/Gt1SSwawNQwS08Ft1ENCcadfsCAwEAAaNCMEAwHQYDVR0OBBYEFAqFqXdlBZh8
-QIH4D5csOPEK7DzPMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MA0GCSqGSIb3DQEB
-CwUAA4IBAQBMOqNErLlFsceTfsgLCkLfZOoc7llsCLqJX2rKSpWeeo8HxdpFcoJxDjrSzG+ntKEj
-u/Ykn8sX/oymzsLS28yN/HH8AynBbF0zX2S2ZTuJbxh2ePXcokgfGT+Ok+vx+hfuzU7jBBJV1uXk
-3fs+BXziHV7Gp7yXT2g69ekuCkO2r1dcYmh8t/2jioSgrGK+KwmHNPBqAbubKVY8/gA3zyNs8U6q
-tnRGEmyR7jTV7JqR50S+kDFy1UkC9gLl9B/rfNmWVan/7Ir5mUf/NVoCqgTLiluHcSmRvaS0eg29
-mvVXIwAHIRc/SjnRBUkLp7Y3gaVdjKozXoEofKd9J+sAro03
------END CERTIFICATE-----
-
-EC-ACC
-======
------BEGIN CERTIFICATE-----
-MIIFVjCCBD6gAwIBAgIQ7is969Qh3hSoYqwE893EATANBgkqhkiG9w0BAQUFADCB8zELMAkGA1UE
-BhMCRVMxOzA5BgNVBAoTMkFnZW5jaWEgQ2F0YWxhbmEgZGUgQ2VydGlmaWNhY2lvIChOSUYgUS0w
-ODAxMTc2LUkpMSgwJgYDVQQLEx9TZXJ2ZWlzIFB1YmxpY3MgZGUgQ2VydGlmaWNhY2lvMTUwMwYD
-VQQLEyxWZWdldSBodHRwczovL3d3dy5jYXRjZXJ0Lm5ldC92ZXJhcnJlbCAoYykwMzE1MDMGA1UE
-CxMsSmVyYXJxdWlhIEVudGl0YXRzIGRlIENlcnRpZmljYWNpbyBDYXRhbGFuZXMxDzANBgNVBAMT
-BkVDLUFDQzAeFw0wMzAxMDcyMzAwMDBaFw0zMTAxMDcyMjU5NTlaMIHzMQswCQYDVQQGEwJFUzE7
-MDkGA1UEChMyQWdlbmNpYSBDYXRhbGFuYSBkZSBDZXJ0aWZpY2FjaW8gKE5JRiBRLTA4MDExNzYt
-SSkxKDAmBgNVBAsTH1NlcnZlaXMgUHVibGljcyBkZSBDZXJ0aWZpY2FjaW8xNTAzBgNVBAsTLFZl
-Z2V1IGh0dHBzOi8vd3d3LmNhdGNlcnQubmV0L3ZlcmFycmVsIChjKTAzMTUwMwYDVQQLEyxKZXJh
-cnF1aWEgRW50aXRhdHMgZGUgQ2VydGlmaWNhY2lvIENhdGFsYW5lczEPMA0GA1UEAxMGRUMtQUND
-MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAsyLHT+KXQpWIR4NA9h0X84NzJB5R85iK
-w5K4/0CQBXCHYMkAqbWUZRkiFRfCQ2xmRJoNBD45b6VLeqpjt4pEndljkYRm4CgPukLjbo73FCeT
-ae6RDqNfDrHrZqJyTxIThmV6PttPB/SnCWDaOkKZx7J/sxaVHMf5NLWUhdWZXqBIoH7nF2W4onW4
-HvPlQn2v7fOKSGRdghST2MDk/7NQcvJ29rNdQlB50JQ+awwAvthrDk4q7D7SzIKiGGUzE3eeml0a
-E9jD2z3Il3rucO2n5nzbcc8tlGLfbdb1OL4/pYUKGbio2Al1QnDE6u/LDsg0qBIimAy4E5S2S+zw
-0JDnJwIDAQABo4HjMIHgMB0GA1UdEQQWMBSBEmVjX2FjY0BjYXRjZXJ0Lm5ldDAPBgNVHRMBAf8E
-BTADAQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUoMOLRKo3pUW/l4Ba0fF4opvpXY0wfwYD
-VR0gBHgwdjB0BgsrBgEEAfV4AQMBCjBlMCwGCCsGAQUFBwIBFiBodHRwczovL3d3dy5jYXRjZXJ0
-Lm5ldC92ZXJhcnJlbDA1BggrBgEFBQcCAjApGidWZWdldSBodHRwczovL3d3dy5jYXRjZXJ0Lm5l
-dC92ZXJhcnJlbCAwDQYJKoZIhvcNAQEFBQADggEBAKBIW4IB9k1IuDlVNZyAelOZ1Vr/sXE7zDkJ
-lF7W2u++AVtd0x7Y/X1PzaBB4DSTv8vihpw3kpBWHNzrKQXlxJ7HNd+KDM3FIUPpqojlNcAZQmNa
-Al6kSBg6hW/cnbw/nZzBh7h6YQjpdwt/cKt63dmXLGQehb+8dJahw3oS7AwaboMMPOhyRp/7SNVe
-l+axofjk70YllJyJ22k4vuxcDlbHZVHlUIiIv0LVKz3l+bqeLrPK9HOSAgu+TGbrIP65y7WZf+a2
-E/rKS03Z7lNGBjvGTq2TWoF+bCpLagVFjPIhpDGQh2xlnJ2lYJU6Un/10asIbvPuW/mIPX64b24D
-5EI=
------END CERTIFICATE-----
diff --git a/lib/rubygems/stub_specification.rb b/lib/rubygems/stub_specification.rb
new file mode 100644
index 0000000000..221dc1d404
--- /dev/null
+++ b/lib/rubygems/stub_specification.rb
@@ -0,0 +1,176 @@
+##
+# 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
+
+ ##
+ # 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::Specification.load(loaded_from)
+ 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 1971165452..1229fe7c7a 100644
--- a/lib/rubygems/syck_hack.rb
+++ b/lib/rubygems/syck_hack.rb
@@ -10,7 +10,7 @@
# 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
# well.
@@ -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
@@ -46,77 +46,8 @@ module YAML
end
end
end
-end
-
-# Sometime in the 1.9 dev cycle, the Syck constant was moved from under YAML
-# to be a toplevel constant. So gemspecs created under these versions of Syck
-# will have references to Syck::DefaultKey.
-#
-# So we need to be sure that we reference Syck at the toplevel too so that
-# we can always load these kind of gemspecs.
-#
-if !defined?(Syck)
- Syck = YAML::Syck
-end
-
-# Now that we've got Syck setup in all the right places, store
-# a reference to the DefaultKey class inside Gem. We do this so that
-# if later on YAML, etc are redefined, we've still got a consistent
-# place to find the DefaultKey class for comparison.
-
-module Gem
- # for tests that change YAML::ENGINE
- remove_const :SyckDefaultKey if const_defined? :SyckDefaultKey
-
- SyckDefaultKey = YAML::Syck::DefaultKey
-end
-
-# :startdoc:
-# :stopdoc:
-
-# Hack to handle syck's DefaultKey bug
-#
-# This file is always loaded AFTER either syck or psych are already
-# loaded. It then looks at what constants are available and creates
-# a consistent view on all rubys.
-#
-# All this is so that there is always a YAML::Syck::DefaultKey
-# class no matter if the full yaml library has loaded or not.
-#
-module YAML
- # 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
- # well.
- if defined? ::Syck
- # for tests that change YAML::ENGINE
- remove_const :Syck if const_defined? :Syck, false
-
- Syck = ::Syck
-
- # JRuby's "Syck" is called "Yecht"
- elsif defined? YAML::Yecht
- Syck = YAML::Yecht
-
- # Otherwise, if there is no YAML::Syck, then we've got just psych
- # loaded, so lets define a stub for DefaultKey.
- elsif !defined? YAML::Syck
- module Syck
- class DefaultKey
- end
- end
- end
-
- # Now that we've got something that is always here, define #to_s
- # so when code tries to use this, it at least just shows up like it
- # should.
- module Syck
- class DefaultKey
- def to_s
- '='
- end
- end
- end
+ SyntaxError = Error unless defined? SyntaxError
end
# Sometime in the 1.9 dev cycle, the Syck constant was moved from under YAML
diff --git a/lib/rubygems/test_case.rb b/lib/rubygems/test_case.rb
index 9fbdfca52e..f3967aba8b 100644
--- a/lib/rubygems/test_case.rb
+++ b/lib/rubygems/test_case.rb
@@ -1,4 +1,10 @@
-at_exit { $SAFE = 1 }
+# TODO: $SAFE = 1
+
+begin
+ gem 'minitest', '~> 4.0'
+rescue NoMethodError
+ # for ruby tests
+end
if defined? Gem::QuickLoader
Gem::QuickLoader.load_full_rubygems_library
@@ -11,16 +17,23 @@ begin
rescue Gem::LoadError
end
-require "rubygems/deprecate"
+# We have to load these up front because otherwise we'll try to load
+# them while we're testing rubygems, and thus we can't actually load them.
+unless Gem::Dependency.new('rdoc', '>= 3.10').matching_specs.empty?
+ gem 'rdoc'
+ gem 'json'
+end
+
+require 'rubygems/deprecate'
require 'minitest/autorun'
require 'fileutils'
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'
@@ -36,16 +49,6 @@ module Gem
end
##
- # Allows setting the default SourceIndex. This method is available when
- # requiring 'rubygems/test_case'
-
- def self.source_index=(si)
- raise "This method is not supported"
- Gem::Specification.reset if si # HACK
- @@source_index = si
- end
-
- ##
# Allows toggling Windows behavior. This method is available when requiring
# 'rubygems/test_case'
@@ -54,7 +57,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
@@ -80,6 +83,25 @@ end
class Gem::TestCase < MiniTest::Unit::TestCase
+ attr_accessor :fetcher # :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" }
@@ -92,12 +114,71 @@ class Gem::TestCase < MiniTest::Unit::TestCase
refute File.exist?(path), msg
end
+ def scan_make_command_lines(output)
+ output.scan(/^#{Regexp.escape make_command}(?:[[:blank:]].*)?$/)
+ end
+
+ def parse_make_command_line(line)
+ command, *args = line.shellsplit
+
+ targets = []
+ macros = {}
+
+ args.each do |arg|
+ case arg
+ when /\A(\w+)=/
+ macros[$1] = $'
+ else
+ targets << arg
+ end
+ end
+
+ targets << '' if targets.empty?
+
+ {
+ :command => command,
+ :targets => targets,
+ :macros => macros,
+ }
+ end
+
+ def assert_contains_make_command(target, output, msg = nil)
+ if output.match(/\n/)
+ msg = message(msg) {
+ 'Expected output containing make command "%s": %s' % [
+ ('%s %s' % [make_command, target]).rstrip,
+ output.inspect
+ ]
+ }
+ else
+ msg = message(msg) {
+ 'Expected make command "%s": %s' % [
+ ('%s %s' % [make_command, target]).rstrip,
+ output.inspect
+ ]
+ }
+ end
+
+ assert scan_make_command_lines(output).any? { |line|
+ make = parse_make_command_line(line)
+
+ if make[:targets].include?(target)
+ yield make, line if block_given?
+ true
+ else
+ false
+ end
+ }, msg
+ end
+
include Gem::DefaultUserInteraction
undef_method :default_test if instance_methods.include? 'default_test' or
instance_methods.include? :default_test
- @@project_dir = Dir.pwd unless defined?(@@project_dir)
+ @@project_dir = Dir.pwd.untaint unless defined?(@@project_dir)
+
+ @@initial_reset = false
##
# #setup prepares a sandboxed location to install gems. All installs are
@@ -117,10 +198,11 @@ class Gem::TestCase < MiniTest::Unit::TestCase
@orig_gem_path = ENV['GEM_PATH']
@current_dir = Dir.pwd
- @ui = Gem::MockGemUi.new
+ @fetcher = nil
+ @ui = Gem::MockGemUi.new
- tmpdir = nil
- Dir.chdir Dir.tmpdir do tmpdir = Dir.pwd end # HACK OSX /private/tmp
+ tmpdir = File.expand_path Dir.tmpdir
+ tmpdir.untaint
if ENV['KEEP_FILES'] then
@tempdir = File.join(tmpdir, "test_rubygems_#{$$}.#{Time.now.to_i}")
@@ -128,43 +210,83 @@ class Gem::TestCase < MiniTest::Unit::TestCase
@tempdir = File.join(tmpdir, "test_rubygems_#{$$}")
end
@tempdir.untaint
+
+ FileUtils.mkdir_p @tempdir
+
+ # This makes the tempdir consistent on OS X.
+ # File.expand_path Dir.tmpdir #=> "/var/..."
+ # Dir.chdir Dir.tmpdir do File.expand_path '.' end #=> "/private/var/..."
+ # TODO use File#realpath above instead of #expand_path once 1.8 support is
+ # dropped.
+ Dir.chdir @tempdir do
+ @tempdir = File.expand_path '.'
+ @tempdir.untaint
+ end
+
@gemhome = File.join @tempdir, 'gemhome'
@userhome = File.join @tempdir, 'userhome'
+ ENV["GEM_SPEC_CACHE"] = File.join @tempdir, 'spec_cache'
- @orig_ruby = if ruby = ENV['RUBY'] then
- Gem.class_eval { ruby, @ruby = @ruby, ruby }
+ @orig_ruby = if ENV['RUBY'] then
+ ruby = Gem.ruby
+ Gem.ruby = ENV['RUBY']
ruby
end
+ @git = ENV['GIT'] || 'git'
+
Gem.ensure_gem_subdirectories @gemhome
@orig_LOAD_PATH = $LOAD_PATH.dup
- $LOAD_PATH.map! { |s| File.expand_path s }
+ $LOAD_PATH.map! { |s| File.expand_path(s).untaint }
Dir.chdir @tempdir
@orig_ENV_HOME = ENV['HOME']
ENV['HOME'] = @userhome
Gem.instance_variable_set :@user_home, nil
+ Gem.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
+ FileUtils.mkdir_p @default_spec_dir
+
+ # We use Gem::Specification.reset the first time only so that if there
+ # are unresolved deps that leak into the whole test suite, they're at least
+ # reported once.
+ if @@initial_reset
+ Gem::Specification.unresolved_deps.clear # done to avoid cross-test warnings
+ else
+ @@initial_reset = true
+ Gem::Specification.reset
+ end
Gem.use_paths(@gemhome)
+ Gem::Security.reset
+
Gem.loaded_specs.clear
- Gem.unresolved_deps.clear
+ Gem.clear_default_specs
+ Gem::Specification.unresolved_deps.clear
Gem.configuration.verbose = true
Gem.configuration.update_sources = true
+ Gem::RemoteFetcher.fetcher = Gem::FakeFetcher.new
+
@gem_repo = "http://gems.example.com/"
@uri = URI.parse @gem_repo
Gem.sources.replace [@gem_repo]
Gem.searcher = nil
Gem::SpecFetcher.fetcher = nil
-
@orig_BASERUBY = Gem::ConfigMap[:BASERUBY]
Gem::ConfigMap[:BASERUBY] = Gem::ConfigMap[:ruby_install_name]
@@ -177,15 +299,47 @@ 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.post_uninstall_hooks.clear
- Gem.pre_install_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
+
+ Gem::ConfigMap[:BASERUBY] = @orig_BASERUBY
+ Gem::ConfigMap[: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
+
+ 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
@@ -209,34 +363,72 @@ 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
+ 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.class_eval { @ruby = _ } if _
+ 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
+
+ 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
@@ -246,13 +438,17 @@ class Gem::TestCase < MiniTest::Unit::TestCase
def install_gem spec, options = {}
require 'rubygems/installer'
- use_ui Gem::MockGemUi.new do
- Dir.chdir @tempdir do
- Gem::Builder.new(spec).build
+ gem = File.join @tempdir, "gems", "#{spec.full_name}.gem"
+
+ unless File.exist? gem then
+ use_ui Gem::MockGemUi.new do
+ Dir.chdir @tempdir do
+ Gem::Package.build spec
+ end
end
- end
- gem = File.join(@tempdir, File.basename(spec.cache_file)).untaint
+ gem = File.join(@tempdir, File.basename(spec.cache_file)).untaint
+ end
Gem::Installer.new(gem, options.merge({:wrappers => true})).install
end
@@ -275,6 +471,7 @@ class Gem::TestCase < MiniTest::Unit::TestCase
##
# creates a temporary directory with hax
+ # TODO: deprecate and remove
def create_tmpdir
tmpdir = nil
@@ -335,8 +532,7 @@ class Gem::TestCase < MiniTest::Unit::TestCase
# homepage, summary and description are defaulted. The specification is
# yielded for customization.
#
- # The gem is added to the installed gems in +@gemhome+ and to the current
- # source_index.
+ # The gem is added to the installed gems in +@gemhome+ and the runtime.
#
# Use this with #write_file to build an installed gem.
@@ -369,28 +565,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
##
@@ -409,7 +588,7 @@ class Gem::TestCase < MiniTest::Unit::TestCase
end
use_ui Gem::MockGemUi.new do
- Gem::Builder.new(spec).build
+ Gem::Package.build spec
end
cache = spec.cache_file
@@ -417,12 +596,19 @@ class Gem::TestCase < MiniTest::Unit::TestCase
end
end
+ def util_remove_gem(spec)
+ FileUtils.rm_rf spec.cache_file
+ FileUtils.rm_rf spec.spec_file
+ end
+
##
# Removes all installed gems from +@gemhome+.
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
@@ -435,10 +621,49 @@ class Gem::TestCase < MiniTest::Unit::TestCase
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.
+ # Installs the provided default specs including writing the spec file
+
+ def install_default_gems(*specs)
+ install_default_specs(*specs)
+
+ specs.each do |spec|
+ open spec.loaded_from, 'w' do |io|
+ io.write spec.to_ruby_for_cache
+ end
+ end
+ end
+
+ ##
+ # Install the provided default specs
+
+ def install_default_specs(*specs)
+ install_specs(*specs)
+ specs.each do |spec|
+ Gem.register_default_spec(spec)
+ 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
+
+ ##
+ # 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|
@@ -478,25 +703,58 @@ class Gem::TestCase < MiniTest::Unit::TestCase
spec
end
+ def new_default_spec(name, version, deps = nil, *files)
+ spec = util_spec name, version, deps
+
+ spec.loaded_from = File.join(@default_spec_dir, spec.spec_name)
+ spec.files = files
+
+ lib_dir = File.join(@tempdir, "default_gems", "lib")
+ $LOAD_PATH.unshift(lib_dir)
+ files.each do |file|
+ rb_path = File.join(lib_dir, file)
+ FileUtils.mkdir_p(File.dirname(rb_path))
+ File.open(rb_path, "w") do |rb|
+ rb << "# #{file}"
+ end
+ end
+
+ spec
+ 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
##
@@ -513,7 +771,7 @@ class Gem::TestCase < MiniTest::Unit::TestCase
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.
+ # deterministic on all implementations.
deps.keys.sort.each do |n|
s.add_dependency n, (deps[n] || '>= 0')
end
@@ -592,6 +850,12 @@ 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)
+ @dep_x = quick_gem('dep_x', '1') do |s|
+ s.files = %w[lib/code.rb]
+ s.require_paths = %w[lib]
+ s.add_dependency 'x', '>= 1'
+ end
@pl1 = quick_gem 'pl', '1' do |s| # l for legacy
s.files = %w[lib/code.rb]
@@ -606,14 +870,17 @@ 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])
-
- [@a1, @a2, @a3a, @a_evil9, @b2, @c1_2, @pl1].each do |spec|
+ 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
end
@@ -659,6 +926,15 @@ Also, a list:
end
##
+ # Add +spec+ to +@fetcher+ serving the data in the file +path+.
+ # +repo+ indicates which repo to make +spec+ appear to be in.
+
+ def add_to_fetcher(spec, path=nil, repo=@gem_repo)
+ path ||= spec.cache_file
+ @fetcher.data["#{@gem_repo}gems/#{spec.file_name}"] = read_binary(path)
+ end
+
+ ##
# Sets up Gem::SpecFetcher to return information from the gems in +specs+.
# Best used with +@all_gems+ from #util_setup_fake_fetcher.
@@ -668,36 +944,54 @@ Also, a list:
spec_fetcher = Gem::SpecFetcher.fetcher
- prerelease, _ = Gem::Specification.partition { |spec|
+ prerelease, all = Gem::Specification.partition { |spec|
spec.version.prerelease?
}
spec_fetcher.specs[@uri] = []
- Gem::Specification.each do |spec|
- spec_tuple = [spec.name, spec.version, spec.original_platform]
- spec_fetcher.specs[@uri] << spec_tuple
+ all.each do |spec|
+ spec_fetcher.specs[@uri] << spec.name_tuple
end
spec_fetcher.latest_specs[@uri] = []
Gem::Specification.latest_specs.each do |spec|
- spec_tuple = [spec.name, spec.version, spec.original_platform]
- spec_fetcher.latest_specs[@uri] << spec_tuple
+ spec_fetcher.latest_specs[@uri] << spec.name_tuple
end
spec_fetcher.prerelease_specs[@uri] = []
prerelease.each do |spec|
- spec_tuple = [spec.name, spec.version, spec.original_platform]
- spec_fetcher.prerelease_specs[@uri] << spec_tuple
+ 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
- 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
+ @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
+ end
nil # force errors
end
@@ -764,6 +1058,14 @@ Also, a list:
system('nmake /? 1>NUL 2>&1')
end
+ # In case we're building docs in a background process, this method waits for
+ # that process to exit (or if it's already been reaped, or never happened,
+ # swallows the Errno::ECHILD error).
+ def wait_for_child_process_to_exit
+ Process.wait if Process.respond_to?(:fork)
+ rescue Errno::ECHILD
+ end
+
##
# Allows tests to use a random (but controlled) port number instead of
# a hardcoded one. This helps CI tools when running parallels builds on
@@ -783,12 +1085,13 @@ Also, a list:
##
# Allows the proper version of +rake+ to be used for the test.
- def build_rake_in
+ def build_rake_in(good=true)
gem_ruby = Gem.ruby
Gem.ruby = @@ruby
env_rake = ENV["rake"]
- ENV["rake"] = @@rake
- yield @@rake
+ rake = (good ? @@good_rake : @@bad_rake)
+ ENV["rake"] = rake
+ yield rake
ensure
Gem.ruby = gem_ruby
if env_rake
@@ -799,7 +1102,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"]
@@ -828,15 +1131,8 @@ Also, a list:
end
@@ruby = rubybin
- env_rake = ENV['rake']
- ruby19_rake = File.expand_path("bin/rake", @@project_dir)
- @@rake = if env_rake then
- ENV["rake"]
- elsif File.exist? ruby19_rake then
- @@ruby + " " + ruby19_rake
- else
- 'rake'
- end
+ @@good_rake = "#{rubybin} #{File.expand_path('../../../test/rubygems/good_rake.rb', __FILE__)}"
+ @@bad_rake = "#{rubybin} #{File.expand_path('../../../test/rubygems/bad_rake.rb', __FILE__)}"
##
# Construct a new Gem::Dependency.
@@ -846,6 +1142,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
@@ -861,10 +1177,182 @@ 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
+ Gem::TestCase::SpecFetcherSetup.declare self 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
+ ##
+ # 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
+
+ ##
+ # Creates a new StaticSet for the given +specs+
+
+ def initialize(specs)
+ @specs = specs
+ 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 }
+ 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 # :nodoc:
+ end
+ end
+
+ ##
+ # Loads certificate named +cert_name+ from <tt>test/rubygems/</tt>.
+
+ def self.load_cert cert_name
+ cert_file = cert_path cert_name
+
+ cert = File.read cert_file
+
+ OpenSSL::X509::Certificate.new cert
+ end
+
+ ##
+ # Returns the path to the certificate named +cert_name+ from
+ # <tt>test/rubygems/</tt>.
+
+ def self.cert_path cert_name
+ if 32 == (Time.at(2**32) rescue 32) then
+ cert_file =
+ File.expand_path "../../../test/rubygems/#{cert_name}_cert_32.pem",
+ __FILE__
+
+ return cert_file if File.exist? cert_file
+ end
+
+ File.expand_path "../../../test/rubygems/#{cert_name}_cert.pem", __FILE__
+ end
+
+ ##
+ # Loads an RSA private key named +key_name+ with +passphrase+ in <tt>test/rubygems/</tt>
+
+ def self.load_key key_name, passphrase = nil
+ key_file = key_path key_name
+
+ key = File.read key_file
+
+ OpenSSL::PKey::RSA.new key, passphrase
+ end
+
+ ##
+ # 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__
+ end
+
+ # :stopdoc:
+ # only available in RubyGems tests
+
+ PRIVATE_KEY_PASSPHRASE = 'Foo bar'
+
+ begin
+ 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_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 if defined?(OpenSSL::SSL)
+
end
+
+require 'rubygems/test_utilities'
+
diff --git a/lib/rubygems/test_utilities.rb b/lib/rubygems/test_utilities.rb
index 1a8fb5a0ad..37f54e601e 100644
--- a/lib/rubygems/test_utilities.rb
+++ b/lib/rubygems/test_utilities.rb
@@ -24,14 +24,25 @@ class Gem::FakeFetcher
attr_reader :data
attr_reader :last_request
+ attr_reader :api_endpoints
attr_accessor :paths
def initialize
@data = {}
@paths = []
+ @api_endpoints = {}
+ end
+
+ def api_endpoint(uri)
+ @api_endpoints[uri] || uri
end
def find_data(path)
+ if URI === path and "URI::#{path.scheme.upcase}" != path.class.name then
+ raise ArgumentError,
+ "mismatch for scheme #{path.scheme} and class #{path.class}"
+ end
+
path = path.to_s
@paths << path
raise ArgumentError, 'need full URI' unless path =~ %r'^https?://'
@@ -43,7 +54,7 @@ class Gem::FakeFetcher
@data[path]
end
- def fetch_path path, mtime = nil
+ def fetch_path path, mtime = nil, head = false
data = find_data(path)
if data.respond_to?(:call) then
@@ -57,6 +68,15 @@ class Gem::FakeFetcher
end
end
+ def cache_update_path uri, path = nil, update = true
+ if data = fetch_path(uri)
+ open(path, 'wb') { |io| io.write data } if path and update
+ data
+ else
+ Gem.read_binary(path) if path
+ end
+ end
+
# Thanks, FakeWeb!
def open_uri_or_path(path)
data = find_data(path)
@@ -98,9 +118,13 @@ class Gem::FakeFetcher
def download spec, source_uri, install_dir = Gem.dir
name = File.basename spec.cache_file
- path = File.join install_dir, "cache", name
+ path = if Dir.pwd == install_dir then # see fetch_command
+ install_dir
+ else
+ File.join install_dir, "cache"
+ end
- Gem.ensure_gem_subdirectories install_dir
+ path = File.join path, name
if source_uri =~ /^http/ then
File.open(path, "wb") do |f|
@@ -114,14 +138,13 @@ class Gem::FakeFetcher
end
def download_to_cache dependency
- found = Gem::SpecFetcher.fetcher.fetch dependency, true, true,
- dependency.prerelease?
+ found, _ = Gem::SpecFetcher.fetcher.spec_for_dependency dependency
return if found.empty?
- spec, source_uri = found.first
+ spec, source = found.first
- download spec, source_uri
+ download spec, source.uri.to_s
end
end
@@ -137,6 +160,164 @@ 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
+ setup = new test
+
+ yield setup
+
+ setup.execute
+ end
+
+ def initialize test # :nodoc:
+ @test = test
+
+ @gems = {}
+ @installed = []
+ @operations = []
+ end
+
+ ##
+ # Removes any created gems or specifications from Gem.dir (the default
+ # install location).
+
+ def clear
+ @operations << [:clear]
+ end
+
+ 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'
+
+ @test.fetcher = Gem::FakeFetcher.new
+ Gem::RemoteFetcher.fetcher = @test.fetcher
+
+ Gem::Specification.reset
+
+ @test.util_setup_spec_fetcher(*@gems.keys)
+
+ # 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["http://gems.example.com/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.
#
@@ -145,6 +326,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
@@ -152,6 +337,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/uninstaller.rb b/lib/rubygems/uninstaller.rb
index cc32ea48c4..a1caacb10d 100644
--- a/lib/rubygems/uninstaller.rb
+++ b/lib/rubygems/uninstaller.rb
@@ -7,7 +7,7 @@
require 'fileutils'
require 'rubygems'
require 'rubygems/dependency_list'
-require 'rubygems/doc_manager'
+require 'rubygems/rdoc'
require 'rubygems/user_interaction'
##
@@ -42,24 +42,30 @@ class Gem::Uninstaller
# Constructs an uninstaller that will uninstall +gem+
def initialize(gem, 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]
+ # 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]
+ @abort_on_dependent = options[:abort_on_dependent]
+
+ # Indicate if development dependencies should be checked when
+ # uninstalling. (default: false)
+ #
+ @check_dev = options[:check_dev]
+
+ if options[:force]
+ @force_all = true
+ @force_ignore = true
+ end
# only add user directory if install_dir is not set
@user_install = false
@user_install = options[:user_install] unless options[:install_dir]
-
- if @user_install then
- Gem.use_paths Gem.user_dir, @gem_home
- else
- Gem.use_paths @gem_home
- end
end
##
@@ -67,12 +73,50 @@ class Gem::Uninstaller
# directory, and the cached .gem file.
def uninstall
- list = Gem::Specification.find_all_by_name(@gem, @version)
+ dependency = Gem::Dependency.new @gem, @version
+
+ list = []
+
+ dirs =
+ Gem::Specification.dirs +
+ [Gem::Specification.default_specifications_dir]
+
+ Gem::Specification.each_spec dirs do |spec|
+ next unless dependency.matches_spec? spec
+
+ list << spec
+ end
+
+ default_specs, list = list.partition do |spec|
+ spec.default_gem?
+ end
+
+ list, other_repo_specs = list.partition do |spec|
+ @gem_home == spec.base_dir or
+ (@user_install and spec.base_dir == Gem.user_dir)
+ end
if list.empty? then
- raise Gem::InstallError, "gem #{@gem.inspect} is not installed"
+ if other_repo_specs.empty?
+ if default_specs.empty?
+ raise Gem::InstallError, "gem #{@gem.inspect} is not installed"
+ else
+ message =
+ "gem #{@gem.inspect} cannot be uninstalled " +
+ "because it is a default gem"
+ raise Gem::InstallError, message
+ end
+ end
+
+ other_repos = other_repo_specs.map { |spec| spec.base_dir }.uniq
- elsif list.size > 1 and @force_all then
+ message = ["#{@gem} is not installed in GEM_HOME, try:"]
+ message.concat other_repos.map { |repo|
+ "\tgem uninstall -i #{repo} #{@gem}"
+ }
+
+ raise Gem::InstallError, message.join("\n")
+ elsif @force_all then
remove_all list
elsif list.size > 1 then
@@ -100,7 +144,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
@@ -127,12 +171,15 @@ class Gem::Uninstaller
def remove_executables(spec)
return if spec.nil? or spec.executables.empty?
+ executables = spec.executables.clone
+
+ # Leave any executables created by other installed versions
+ # of this gem installed.
+
list = Gem::Specification.find_all { |s|
s.name == spec.name && s.version != spec.version
}
- executables = spec.executables.clone
-
list.each do |s|
s.executables.each do |exe_name|
executables.delete exe_name
@@ -144,17 +191,15 @@ class Gem::Uninstaller
executables = executables.map { |exec| formatted_program_filename exec }
remove = if @force_executables.nil? then
- ask_yes_no("Remove executables:\n" \
- "\t#{executables.join ', '}\n\n" \
+ ask_yes_no("Remove executables:\n" +
+ "\t#{executables.join ', '}\n\n" +
"in addition to the gem?",
true)
else
@force_executables
end
- unless remove then
- say "Executables and scripts will remain installed."
- else
+ if remove then
bin_dir = @bin_dir || Gem.bindir(spec.base_dir)
raise Gem::FilePermissionError, bin_dir unless File.writable? bin_dir
@@ -167,6 +212,8 @@ class Gem::Uninstaller
FileUtils.rm_f exe_file
FileUtils.rm_f "#{exe_file}.bat"
end
+ else
+ say "Executables and scripts will remain installed."
end
end
@@ -200,13 +247,10 @@ class Gem::Uninstaller
File.writable?(spec.base_dir)
FileUtils.rm_rf spec.full_gem_path
+ FileUtils.rm_rf spec.extension_install_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")
@@ -220,7 +264,7 @@ class Gem::Uninstaller
FileUtils.rm_rf gem
- Gem::DocManager.new(spec).uninstall_doc
+ Gem::RDoc.new(spec).remove
say "Successfully uninstalled #{spec.full_name}"
@@ -237,30 +281,57 @@ 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)
+ 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}"
+ msg << ''
+
+ siblings = Gem::Specification.select do |s|
+ s.name == spec.name && s.full_name != spec.full_name
+ end
spec.dependent_gems.each do |dep_spec, dep, satlist|
- msg <<
- ("#{dep_spec.name}-#{dep_spec.version} depends on " +
- "[#{dep.name} (#{dep.requirement})]")
+ unless siblings.any? { |s| s.satisfies_requirement? dep }
+ msg << "#{dep_spec.name}-#{dep_spec.version} depends on #{dep}"
+ end
end
- msg << 'If you remove this gems, one or more dependencies will not be met.'
+ msg << 'If you remove this gem, these dependencies will not be met.'
msg << 'Continue with Uninstall?'
- return ask_yes_no(msg.join("\n"), true)
+ 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.
if @format_executable then
require 'rubygems/installer'
Gem::Installer.exec_format % File.basename(filename)
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 8024d37287..0e4449a2ec 100644
--- a/lib/rubygems/user_interaction.rb
+++ b/lib/rubygems/user_interaction.rb
@@ -66,9 +66,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 +88,69 @@ 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
- def terminate_interaction(*args)
- ui.terminate_interaction(*args)
+ ##
+ # Terminates the RubyGems process with the given +exit_code+
+
+ def terminate_interaction exit_code = 0
+ ui.terminate_interaction exit_code
end
end
@@ -126,7 +159,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 +187,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
@@ -144,6 +199,16 @@ class Gem::StreamUI
end
##
+ # Prints a formatted backtrace to the errors stream if backtraces are
+ # enabled.
+
+ def backtrace exception
+ return unless Gem.configuration.backtrace
+
+ @errs.puts "\t#{exception.backtrace.join "\n\t"}"
+ end
+
+ ##
# Choose from a list of options. +question+ is a prompt displayed above
# the list. +list+ is a list of option strings. Returns the pair
# [option_name, option_index].
@@ -300,8 +365,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}"
@@ -354,14 +418,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
@@ -373,8 +452,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
@@ -410,8 +497,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
@@ -458,15 +553,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
@@ -475,13 +585,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
@@ -490,6 +622,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
@@ -503,6 +638,9 @@ class Gem::StreamUI
update_display
end
+ ##
+ # Indicates the download is complete.
+
def done
@progress = 100 if @units == '%'
update_display(true, true)
@@ -510,7 +648,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
diff --git a/lib/rubygems/util.rb b/lib/rubygems/util.rb
new file mode 100644
index 0000000000..42663974a5
--- /dev/null
+++ b/lib/rubygems/util.rb
@@ -0,0 +1,63 @@
+module Gem::Util
+ ##
+ # 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
+
+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 ffeed88660..1436a93ae6 100644
--- a/lib/rubygems/validator.rb
+++ b/lib/rubygems/validator.rb
@@ -4,7 +4,7 @@
# See LICENSE.txt for permissions.
#++
-require 'rubygems/format'
+require 'rubygems/package'
require 'rubygems/installer'
##
@@ -14,9 +14,8 @@ class Gem::Validator
include Gem::UserInteraction
- def initialize
+ def initialize # :nodoc:
require 'find'
- require 'digest'
end
##
@@ -24,20 +23,8 @@ class Gem::Validator
# gem_data:: [String] Contents of the gem file
def verify_gem(gem_data)
- raise Gem::VerificationError, 'empty gem file' if gem_data.size == 0
-
- unless gem_data =~ /MD5SUM/ then
- return # Don't worry about it...this sucks. Need to fix MD5 stuff for
- # new format
- # FIXME
- end
-
- sum_data = gem_data.gsub(/MD5SUM = "([a-z0-9]+)"/,
- "MD5SUM = \"#{"F" * 32}\"")
-
- unless Digest::MD5.hexdigest(sum_data) == $1.to_s then
- raise Gem::VerificationError, 'invalid checksum for gem file'
- end
+ # TODO remove me? The code here only validate an MD5SUM that was
+ # in some old formatted gems, but hasn't been for a long time.
end
##
@@ -58,17 +45,28 @@ class Gem::Validator
def find_files_for_gem(gem_directory)
installed_files = []
+
Find.find gem_directory do |file_name|
fn = file_name[gem_directory.size..file_name.size-1].sub(/^\//, "")
installed_files << fn unless
fn =~ /CVS/ || fn.empty? || File.directory?(file_name)
end
+
installed_files
end
public
- ErrorData = Struct.new :path, :problem
+ ##
+ # Describes a problem with a file in a gem.
+
+ ErrorData = Struct.new :path, :problem do
+ def <=> other # :nodoc:
+ return nil unless self.class === other
+
+ [path, problem] <=> [other.path, other.problem]
+ end
+ end
##
# Checks the gem directory for the following potential
@@ -80,20 +78,22 @@ class Gem::Validator
# * 1 cache - 1 spec - 1 directory.
#
# returns a hash of ErrorData objects, keyed on the problem gem's name.
+ #--
+ # TODO needs further cleanup
def alien(gems=[])
errors = Hash.new { |h,k| h[k] = {} }
- Gem::SourceIndex.from_installed_gems.each do |gem_name, gem_spec|
- next unless gems.include? gem_spec.name unless gems.empty?
+ Gem::Specification.each do |spec|
+ next unless gems.include? spec.name unless gems.empty?
- install_dir = gem_spec.installation_path
- gem_path = Gem.cache_gem(gem_spec.file_name, install_dir)
- spec_path = File.join install_dir, "specifications", gem_spec.spec_name
- gem_directory = gem_spec.full_gem_path
+ gem_name = spec.file_name
+ gem_path = spec.cache_file
+ spec_path = spec.spec_file
+ gem_directory = spec.full_gem_path
unless File.directory? gem_directory then
- errors[gem_name][gem_spec.full_name] =
+ errors[gem_name][spec.full_name] =
"Gem registered but doesn't exist at #{gem_directory}"
next
end
@@ -108,22 +108,20 @@ class Gem::Validator
good, gone, unreadable = nil, nil, nil, nil
open gem_path, Gem.binary_mode do |file|
- format = Gem::Format.from_file_by_path(gem_path)
+ package = Gem::Package.new gem_path
- good, gone = format.file_entries.partition { |entry, _|
- File.exist? File.join(gem_directory, entry['path'])
+ good, gone = package.contents.partition { |file_name|
+ File.exist? File.join(gem_directory, file_name)
}
- gone.map! { |entry, _| entry['path'] }
gone.sort.each do |path|
errors[gem_name][path] = "Missing file"
end
- good, unreadable = good.partition { |entry, _|
- File.readable? File.join(gem_directory, entry['path'])
+ good, unreadable = good.partition { |file_name|
+ File.readable? File.join(gem_directory, file_name)
}
- unreadable.map! { |entry, _| entry['path'] }
unreadable.sort.each do |path|
errors[gem_name][path] = "Unreadable file"
end
@@ -132,9 +130,10 @@ class Gem::Validator
begin
next unless data # HACK `gem check -a mkrf`
- open File.join(gem_directory, entry['path']), Gem.binary_mode do |f|
- unless Digest::MD5.hexdigest(f.read).to_s ==
- Digest::MD5.hexdigest(data).to_s then
+ source = File.join gem_directory, entry['path']
+
+ open source, Gem.binary_mode do |f|
+ unless f.read == data then
errors[gem_name][entry['path']] = "Modified from original"
end
end
@@ -143,7 +142,6 @@ class Gem::Validator
end
installed_files = find_files_for_gem(gem_directory)
- good.map! { |entry, _| entry['path'] }
extras = installed_files - good - unreadable
extras.each do |extra|
@@ -155,15 +153,12 @@ class Gem::Validator
end
errors.each do |name, subhash|
- errors[name] = subhash.map { |path, msg| ErrorData.new(path, msg) }
+ errors[name] = subhash.map do |path, msg|
+ ErrorData.new path, msg
+ end.sort
end
errors
end
-
- def remove_leading_dot_dir(path)
- path.sub(/^\.\//, "")
- end
-
end
diff --git a/lib/rubygems/version.rb b/lib/rubygems/version.rb
index 2ced9ccdfb..fda8b0b5d4 100644
--- a/lib/rubygems/version.rb
+++ b/lib/rubygems/version.rb
@@ -129,8 +129,8 @@
# specify your dependency as ">= 2.0.0" then, you're good, right? What
# happens if fnord 3.0 comes out and it isn't backwards compatible
# with 2.y.z? Your stuff will break as a result of using ">=". The
-# better route is to specify your dependency with a "spermy" version
-# specifier. They're a tad confusing, so here is how the dependency
+# better route is to specify your dependency with an "approximate" version
+# specifier ("~>"). They're a tad confusing, so here is how the dependency
# specifiers work:
#
# Specification From ... To (exclusive)
@@ -145,13 +145,16 @@ class Gem::Version
include Comparable
- VERSION_PATTERN = '[0-9]+(\.[0-9a-zA-Z]+)*' # :nodoc:
- ANCHORED_VERSION_PATTERN = /\A\s*(#{VERSION_PATTERN})*\s*\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
##
@@ -170,7 +173,7 @@ class Gem::Version
# ver3 = Version.create(nil) # -> nil
def self.create input
- if input.respond_to? :version then
+ if self === input then # check yourself before you wreck yourself
input
elsif input.nil? then
nil
@@ -179,6 +182,12 @@ class Gem::Version
end
end
+ @@all = {}
+
+ def self.new version # :nodoc:
+ @@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.
@@ -187,8 +196,8 @@ class Gem::Version
raise ArgumentError, "Malformed version number string #{version}" unless
self.class.correct?(version)
- @version = version.to_s
- @version.strip!
+ @version = version.to_s.strip.gsub("-",".pre.")
+ @segments = nil
end
##
@@ -242,17 +251,25 @@ 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 # :nodoc:
+ ["@version"]
+ end
+
+ def encode_with coder # :nodoc:
+ coder.add 'version', @version
+ end
+
##
# A version is considered a prerelease if it contains a letter.
def prerelease?
- @prerelease ||= @version =~ /[a-zA-Z]/
+ @prerelease ||= !!(@version =~ /[a-zA-Z]/)
end
def pretty_print q # :nodoc:
@@ -284,7 +301,7 @@ class Gem::Version
##
# A recommended version for use with a ~> Requirement.
- def spermy_recommendation
+ def approximate_recommendation
segments = self.segments.dup
segments.pop while segments.any? { |s| String === s }
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 6d67627f39..199eb16cce 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
@@ -745,7 +745,7 @@ class String
# See Scanf for details on creating a format string.
#
# You will need to require 'scanf' to use String#block_scanf
- def block_scanf(fstr,&b) #:yield: current_match
+ def block_scanf(fstr) #:yield: current_match
fs = Scanf::FormatString.new(fstr)
str = self.dup
final = []
diff --git a/lib/securerandom.rb b/lib/securerandom.rb
index d4ab947f54..4f2c35cabd 100644
--- a/lib/securerandom.rb
+++ b/lib/securerandom.rb
@@ -1,4 +1,9 @@
-# = 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.
@@ -9,41 +14,30 @@
# * /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=="
-# ...
+# p SecureRandom.hex(10) #=> "52750b30ffbc7de3b362"
+# p SecureRandom.hex(10) #=> "92b15d6c8dc4beb5f559"
+# p SecureRandom.hex(13) #=> "39b290146bea6ce975c37cfc23"
#
-# # 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
-
+# 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 +51,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)
@@ -78,8 +72,8 @@ module SecureRandom
raise Errno::ENOENT
end
@has_urandom = true
- ret = f.readpartial(n)
- if ret.length != n
+ ret = f.read(n)
+ unless ret.length == n
raise NotImplementedError, "Unexpected partial read from random device: only #{ret.length} for #{n} bytes"
end
return ret
@@ -89,21 +83,22 @@ module SecureRandom
end
end
- if !defined?(@has_win32)
+ unless defined?(@has_win32)
begin
require 'Win32API'
crypt_acquire_context = Win32API.new("advapi32", "CryptAcquireContext", 'PPPII', 'L')
- @crypt_gen_random = Win32API.new("advapi32", "CryptGenRandom", 'LIP', 'L')
+ @crypt_gen_random = Win32API.new("advapi32", "CryptGenRandom", 'VIP', 'L')
- hProvStr = " " * 4
+ hProvStr = " " * DL::SIZEOF_VOIDP
prov_rsa_full = 1
crypt_verifycontext = 0xF0000000
if crypt_acquire_context.call(hProvStr, nil, nil, prov_rsa_full, crypt_verifycontext) == 0
raise SystemCallError, "CryptAcquireContext failed: #{lastWin32ErrorMessage}"
end
- @hProv, = hProvStr.unpack('L')
+ type = DL::SIZEOF_VOIDP == DL::SIZEOF_LONG_LONG ? 'q' : 'l'
+ @hProv, = hProvStr.unpack(type)
@has_win32 = true
rescue LoadError
@@ -121,12 +116,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.
@@ -142,10 +137,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 "=".
@@ -163,10 +158,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.
@@ -191,7 +186,7 @@ module SecureRandom
s = [random_bytes(n)].pack("m*")
s.delete!("\n")
s.tr!("+/", "-_")
- s.delete!("=") if !padding
+ s.delete!("=") unless padding
s
end
@@ -260,6 +255,6 @@ module SecureRandom
code = get_last_error.call
msg = "\0" * 1024
len = format_message.call(format_message_ignore_inserts + format_message_from_system, 0, code, 0, msg, 1024, nil, nil, nil, nil, nil, nil, nil, nil)
- msg[0, len].tr("\r", '').chomp
+ msg[0, len].force_encoding("filesystem").tr("\r", '').chomp
end
end
diff --git a/lib/set.rb b/lib/set.rb
index 07031bf894..cc068f0a52 100755..100644
--- a/lib/set.rb
+++ b/lib/set.rb
@@ -1,8 +1,7 @@
-#!/usr/bin/env ruby
#--
# 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.
#
@@ -16,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.
#
@@ -28,14 +27,28 @@
# 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
+# shorthand for the {proper_,}{subset?,superset?} methods. However,
+# the <=> operator is intentionally left out because not every pair of
+# sets is comparable. ({x,y} vs. {x,z} for example)
+#
# == Example
#
# require 'set'
@@ -43,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
#
@@ -89,25 +102,22 @@ class Set
# Copy internal hash.
def initialize_copy(orig)
- @hash = orig.instance_eval{@hash}.dup
+ @hash = orig.instance_variable_get(:@hash).dup
end
def freeze # :nodoc:
- super
@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.
@@ -145,6 +155,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)
@@ -192,6 +212,7 @@ class Set
return false if size < set.size
set.all? { |o| include?(o) }
end
+ alias >= superset?
# Returns true if the set is a proper superset of the given set.
def proper_superset?(set)
@@ -199,6 +220,7 @@ class Set
return false if size <= set.size
set.all? { |o| include?(o) }
end
+ alias > proper_superset?
# Returns true if the set is a subset of the given set.
def subset?(set)
@@ -206,6 +228,7 @@ class Set
return false if set.size < size
all? { |o| set.include?(o) }
end
+ alias <= subset?
# Returns true if the set is a proper subset of the given set.
def proper_subset?(set)
@@ -213,13 +236,31 @@ class Set
return false if set.size <= size
all? { |o| set.include?(o) }
end
+ alias < proper_subset?
+
+ # Returns true if the set and the given set have at least one
+ # element in common.
+ 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?+.
+ 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.
- def each
- block_given? or return enum_for(__method__)
- @hash.each_key { |o| yield(o) }
+ def each(&block)
+ block or return enum_for(__method__)
+ @hash.each_key(&block)
self
end
@@ -262,7 +303,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
@@ -270,7 +313,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
@@ -285,19 +330,19 @@ class Set
# Equivalent to Set#delete_if, but returns nil if no changes were
# made.
- def reject!
- block_given? or return enum_for(__method__)
+ def reject!(&block)
+ block or return enum_for(__method__)
n = size
- delete_if { |o| yield(o) }
+ delete_if(&block)
size == n ? nil : self
end
# Equivalent to Set#keep_if, but returns nil if no changes were
# made.
- def select!
- block_given? or return enum_for(__method__)
+ def select!(&block)
+ block or return enum_for(__method__)
n = size
- keep_if { |o| yield(o) }
+ keep_if(&block)
size == n ? nil : self
end
@@ -373,7 +418,7 @@ class Set
def eql?(o) # :nodoc:
return false unless o.is_a?(Set)
- @hash.eql?(o.instance_eval{@hash})
+ @hash.eql?(o.instance_variable_get(:@hash))
end
# Classifies the set by the return value of the given block and
@@ -530,7 +575,7 @@ class SortedSet < Set
require 'rbtree'
module_eval %{
- def initialize(*args, &block)
+ def initialize(*args)
@hash = RBTree.new
super
end
@@ -543,7 +588,7 @@ class SortedSet < Set
}
rescue LoadError
module_eval %{
- def initialize(*args, &block)
+ def initialize(*args)
@keys = nil
super
end
@@ -592,9 +637,9 @@ class SortedSet < Set
super
end
- def each
- block_given? or return enum_for(__method__)
- to_a.each { |o| yield(o) }
+ def each(&block)
+ block or return enum_for(__method__)
+ to_a.each(&block)
self
end
@@ -719,634 +764,4 @@ end
# end
# end
-if $0 == __FILE__
- eval DATA.read, nil, $0, __LINE__+4
-end
-
-__END__
-
-require 'test/unit'
-
-class TC_Set < Test::Unit::TestCase
- def test_aref
- assert_nothing_raised {
- Set[]
- Set[nil]
- Set[1,2,3]
- }
-
- assert_equal(0, Set[].size)
- assert_equal(1, Set[nil].size)
- assert_equal(1, Set[[]].size)
- assert_equal(1, Set[[nil]].size)
-
- set = Set[2,4,6,4]
- assert_equal(Set.new([2,4,6]), set)
- end
-
- def test_s_new
- assert_nothing_raised {
- Set.new()
- Set.new(nil)
- Set.new([])
- Set.new([1,2])
- Set.new('a'..'c')
- }
- assert_raises(ArgumentError) {
- Set.new(false)
- }
- assert_raises(ArgumentError) {
- Set.new(1)
- }
- assert_raises(ArgumentError) {
- Set.new(1,2)
- }
-
- assert_equal(0, Set.new().size)
- assert_equal(0, Set.new(nil).size)
- assert_equal(0, Set.new([]).size)
- assert_equal(1, Set.new([nil]).size)
-
- ary = [2,4,6,4]
- set = Set.new(ary)
- ary.clear
- assert_equal(false, set.empty?)
- assert_equal(3, set.size)
-
- ary = [1,2,3]
-
- s = Set.new(ary) { |o| o * 2 }
- assert_equal([2,4,6], s.sort)
- end
-
- def test_clone
- set1 = Set.new
- set2 = set1.clone
- set1 << 'abc'
- assert_equal(Set.new, set2)
- end
-
- def test_dup
- set1 = Set[1,2]
- set2 = set1.dup
-
- assert_not_same(set1, set2)
-
- assert_equal(set1, set2)
-
- set1.add(3)
-
- assert_not_equal(set1, set2)
- end
-
- def test_size
- assert_equal(0, Set[].size)
- assert_equal(2, Set[1,2].size)
- assert_equal(2, Set[1,2,1].size)
- end
-
- def test_empty?
- assert_equal(true, Set[].empty?)
- assert_equal(false, Set[1, 2].empty?)
- end
-
- def test_clear
- set = Set[1,2]
- ret = set.clear
-
- assert_same(set, ret)
- assert_equal(true, set.empty?)
- end
-
- def test_replace
- set = Set[1,2]
- ret = set.replace('a'..'c')
-
- assert_same(set, ret)
- assert_equal(Set['a','b','c'], set)
- end
-
- def test_to_a
- set = Set[1,2,3,2]
- ary = set.to_a
-
- assert_equal([1,2,3], ary.sort)
- end
-
- def test_flatten
- # test1
- set1 = Set[
- 1,
- Set[
- 5,
- Set[7,
- Set[0]
- ],
- Set[6,2],
- 1
- ],
- 3,
- Set[3,4]
- ]
-
- set2 = set1.flatten
- set3 = Set.new(0..7)
-
- assert_not_same(set2, set1)
- assert_equal(set3, set2)
-
- # test2; destructive
- orig_set1 = set1
- set1.flatten!
-
- assert_same(orig_set1, set1)
- assert_equal(set3, set1)
-
- # test3; multiple occurrences of a set in an set
- set1 = Set[1, 2]
- set2 = Set[set1, Set[set1, 4], 3]
-
- assert_nothing_raised {
- set2.flatten!
- }
-
- assert_equal(Set.new(1..4), set2)
-
- # test4; recursion
- set2 = Set[]
- set1 = Set[1, set2]
- set2.add(set1)
-
- assert_raises(ArgumentError) {
- set1.flatten!
- }
-
- # test5; miscellaneous
- empty = Set[]
- set = Set[Set[empty, "a"],Set[empty, "b"]]
-
- assert_nothing_raised {
- set.flatten
- }
-
- set1 = empty.merge(Set["no_more", set])
-
- assert_nil(Set.new(0..31).flatten!)
-
- x = Set[Set[],Set[1,2]].flatten!
- y = Set[1,2]
-
- assert_equal(x, y)
- end
-
- def test_include?
- set = Set[1,2,3]
-
- assert_equal(true, set.include?(1))
- assert_equal(true, set.include?(2))
- assert_equal(true, set.include?(3))
- assert_equal(false, set.include?(0))
- assert_equal(false, set.include?(nil))
-
- set = Set["1",nil,"2",nil,"0","1",false]
- assert_equal(true, set.include?(nil))
- assert_equal(true, set.include?(false))
- assert_equal(true, set.include?("1"))
- assert_equal(false, set.include?(0))
- assert_equal(false, set.include?(true))
- end
-
- def test_superset?
- set = Set[1,2,3]
-
- assert_raises(ArgumentError) {
- set.superset?()
- }
-
- assert_raises(ArgumentError) {
- set.superset?(2)
- }
-
- assert_raises(ArgumentError) {
- set.superset?([2])
- }
-
- assert_equal(true, set.superset?(Set[]))
- assert_equal(true, set.superset?(Set[1,2]))
- assert_equal(true, set.superset?(Set[1,2,3]))
- assert_equal(false, set.superset?(Set[1,2,3,4]))
- assert_equal(false, set.superset?(Set[1,4]))
-
- assert_equal(true, Set[].superset?(Set[]))
- end
-
- def test_proper_superset?
- set = Set[1,2,3]
-
- assert_raises(ArgumentError) {
- set.proper_superset?()
- }
-
- assert_raises(ArgumentError) {
- set.proper_superset?(2)
- }
-
- assert_raises(ArgumentError) {
- set.proper_superset?([2])
- }
-
- assert_equal(true, set.proper_superset?(Set[]))
- assert_equal(true, set.proper_superset?(Set[1,2]))
- assert_equal(false, set.proper_superset?(Set[1,2,3]))
- assert_equal(false, set.proper_superset?(Set[1,2,3,4]))
- assert_equal(false, set.proper_superset?(Set[1,4]))
-
- assert_equal(false, Set[].proper_superset?(Set[]))
- end
-
- def test_subset?
- set = Set[1,2,3]
-
- assert_raises(ArgumentError) {
- set.subset?()
- }
-
- assert_raises(ArgumentError) {
- set.subset?(2)
- }
-
- assert_raises(ArgumentError) {
- set.subset?([2])
- }
-
- assert_equal(true, set.subset?(Set[1,2,3,4]))
- assert_equal(true, set.subset?(Set[1,2,3]))
- assert_equal(false, set.subset?(Set[1,2]))
- assert_equal(false, set.subset?(Set[]))
-
- assert_equal(true, Set[].subset?(Set[1]))
- assert_equal(true, Set[].subset?(Set[]))
- end
-
- def test_proper_subset?
- set = Set[1,2,3]
-
- assert_raises(ArgumentError) {
- set.proper_subset?()
- }
-
- assert_raises(ArgumentError) {
- set.proper_subset?(2)
- }
-
- assert_raises(ArgumentError) {
- set.proper_subset?([2])
- }
-
- assert_equal(true, set.proper_subset?(Set[1,2,3,4]))
- assert_equal(false, set.proper_subset?(Set[1,2,3]))
- assert_equal(false, set.proper_subset?(Set[1,2]))
- assert_equal(false, set.proper_subset?(Set[]))
-
- assert_equal(false, Set[].proper_subset?(Set[]))
- end
-
- def test_each
- ary = [1,3,5,7,10,20]
- set = Set.new(ary)
-
- ret = set.each { |o| }
- assert_same(set, ret)
-
- e = set.each
- assert_instance_of(Enumerator, e)
-
- assert_nothing_raised {
- set.each { |o|
- ary.delete(o) or raise "unexpected element: #{o}"
- }
-
- ary.empty? or raise "forgotten elements: #{ary.join(', ')}"
- }
- end
-
- def test_add
- set = Set[1,2,3]
-
- ret = set.add(2)
- assert_same(set, ret)
- assert_equal(Set[1,2,3], set)
-
- ret = set.add?(2)
- assert_nil(ret)
- assert_equal(Set[1,2,3], set)
-
- ret = set.add(4)
- assert_same(set, ret)
- assert_equal(Set[1,2,3,4], set)
-
- ret = set.add?(5)
- assert_same(set, ret)
- assert_equal(Set[1,2,3,4,5], set)
- end
-
- def test_delete
- set = Set[1,2,3]
-
- ret = set.delete(4)
- assert_same(set, ret)
- assert_equal(Set[1,2,3], set)
-
- ret = set.delete?(4)
- assert_nil(ret)
- assert_equal(Set[1,2,3], set)
-
- ret = set.delete(2)
- assert_equal(set, ret)
- assert_equal(Set[1,3], set)
-
- ret = set.delete?(1)
- assert_equal(set, ret)
- assert_equal(Set[3], set)
- end
-
- def test_delete_if
- set = Set.new(1..10)
- ret = set.delete_if { |i| i > 10 }
- assert_same(set, ret)
- assert_equal(Set.new(1..10), set)
-
- set = Set.new(1..10)
- ret = set.delete_if { |i| i % 3 == 0 }
- assert_same(set, ret)
- assert_equal(Set[1,2,4,5,7,8,10], set)
- end
-
- def test_collect!
- set = Set[1,2,3,'a','b','c',-1..1,2..4]
-
- ret = set.collect! { |i|
- case i
- when Numeric
- i * 2
- when String
- i.upcase
- else
- nil
- end
- }
-
- assert_same(set, ret)
- assert_equal(Set[2,4,6,'A','B','C',nil], set)
- end
-
- def test_reject!
- set = Set.new(1..10)
-
- ret = set.reject! { |i| i > 10 }
- assert_nil(ret)
- assert_equal(Set.new(1..10), set)
-
- ret = set.reject! { |i| i % 3 == 0 }
- assert_same(set, ret)
- assert_equal(Set[1,2,4,5,7,8,10], set)
- end
-
- def test_merge
- set = Set[1,2,3]
-
- ret = set.merge([2,4,6])
- assert_same(set, ret)
- assert_equal(Set[1,2,3,4,6], set)
- end
-
- def test_subtract
- set = Set[1,2,3]
-
- ret = set.subtract([2,4,6])
- assert_same(set, ret)
- assert_equal(Set[1,3], set)
- end
-
- def test_plus
- set = Set[1,2,3]
-
- ret = set + [2,4,6]
- assert_not_same(set, ret)
- assert_equal(Set[1,2,3,4,6], ret)
- end
-
- def test_minus
- set = Set[1,2,3]
-
- ret = set - [2,4,6]
- assert_not_same(set, ret)
- assert_equal(Set[1,3], ret)
- end
-
- def test_and
- set = Set[1,2,3,4]
-
- ret = set & [2,4,6]
- assert_not_same(set, ret)
- assert_equal(Set[2,4], ret)
- end
-
- def test_xor
- set = Set[1,2,3,4]
- ret = set ^ [2,4,5,5]
- assert_not_same(set, ret)
- assert_equal(Set[1,3,5], ret)
- end
-
- def test_eq
- set1 = Set[2,3,1]
- set2 = Set[1,2,3]
-
- assert_equal(set1, set1)
- assert_equal(set1, set2)
- assert_not_equal(Set[1], [1])
-
- set1 = Class.new(Set)["a", "b"]
- set2 = Set["a", "b", set1]
- set1 = set1.add(set1.clone)
-
-# assert_equal(set1, set2)
-# assert_equal(set2, set1)
- assert_equal(set2, set2.clone)
- assert_equal(set1.clone, set1)
-
- assert_not_equal(Set[Exception.new,nil], Set[Exception.new,Exception.new], "[ruby-dev:26127]")
- end
-
- # def test_hash
- # end
-
- # def test_eql?
- # end
-
- def test_classify
- set = Set.new(1..10)
- ret = set.classify { |i| i % 3 }
-
- assert_equal(3, ret.size)
- assert_instance_of(Hash, ret)
- ret.each_value { |value| assert_instance_of(Set, value) }
- assert_equal(Set[3,6,9], ret[0])
- assert_equal(Set[1,4,7,10], ret[1])
- assert_equal(Set[2,5,8], ret[2])
- end
-
- def test_divide
- set = Set.new(1..10)
- ret = set.divide { |i| i % 3 }
-
- assert_equal(3, ret.size)
- n = 0
- ret.each { |s| n += s.size }
- assert_equal(set.size, n)
- assert_equal(set, ret.flatten)
-
- set = Set[7,10,5,11,1,3,4,9,0]
- ret = set.divide { |a,b| (a - b).abs == 1 }
-
- assert_equal(4, ret.size)
- n = 0
- ret.each { |s| n += s.size }
- assert_equal(set.size, n)
- assert_equal(set, ret.flatten)
- ret.each { |s|
- if s.include?(0)
- assert_equal(Set[0,1], s)
- elsif s.include?(3)
- assert_equal(Set[3,4,5], s)
- elsif s.include?(7)
- assert_equal(Set[7], s)
- elsif s.include?(9)
- assert_equal(Set[9,10,11], s)
- else
- raise "unexpected group: #{s.inspect}"
- end
- }
- end
-
- def test_inspect
- set1 = Set[1]
-
- assert_equal('#<Set: {1}>', set1.inspect)
-
- set2 = Set[Set[0], 1, 2, set1]
- assert_equal(false, set2.inspect.include?('#<Set: {...}>'))
-
- set1.add(set2)
- assert_equal(true, set1.inspect.include?('#<Set: {...}>'))
- end
-
- # def test_pretty_print
- # end
-
- # def test_pretty_print_cycle
- # end
-end
-
-class TC_SortedSet < Test::Unit::TestCase
- def test_sortedset
- s = SortedSet[4,5,3,1,2]
-
- assert_equal([1,2,3,4,5], s.to_a)
-
- prev = nil
- s.each { |o| assert(prev < o) if prev; prev = o }
- assert_not_nil(prev)
-
- s.map! { |o| -2 * o }
-
- assert_equal([-10,-8,-6,-4,-2], s.to_a)
-
- prev = nil
- ret = s.each { |o| assert(prev < o) if prev; prev = o }
- assert_not_nil(prev)
- assert_same(s, ret)
-
- s = SortedSet.new([2,1,3]) { |o| o * -2 }
- assert_equal([-6,-4,-2], s.to_a)
-
- s = SortedSet.new(['one', 'two', 'three', 'four'])
- a = []
- ret = s.delete_if { |o| a << o; o.start_with?('t') }
- assert_same(s, ret)
- assert_equal(['four', 'one'], s.to_a)
- assert_equal(['four', 'one', 'three', 'two'], a)
-
- s = SortedSet.new(['one', 'two', 'three', 'four'])
- a = []
- ret = s.reject! { |o| a << o; o.start_with?('t') }
- assert_same(s, ret)
- assert_equal(['four', 'one'], s.to_a)
- assert_equal(['four', 'one', 'three', 'two'], a)
-
- s = SortedSet.new(['one', 'two', 'three', 'four'])
- a = []
- ret = s.reject! { |o| a << o; false }
- assert_same(nil, ret)
- assert_equal(['four', 'one', 'three', 'two'], s.to_a)
- assert_equal(['four', 'one', 'three', 'two'], a)
- end
-end
-
-class TC_Enumerable < Test::Unit::TestCase
- def test_to_set
- ary = [2,5,4,3,2,1,3]
-
- set = ary.to_set
- assert_instance_of(Set, set)
- assert_equal([1,2,3,4,5], set.sort)
-
- set = ary.to_set { |o| o * -2 }
- assert_instance_of(Set, set)
- assert_equal([-10,-8,-6,-4,-2], set.sort)
-
- set = ary.to_set(SortedSet)
- assert_instance_of(SortedSet, set)
- assert_equal([1,2,3,4,5], set.to_a)
-
- set = ary.to_set(SortedSet) { |o| o * -2 }
- assert_instance_of(SortedSet, set)
- assert_equal([-10,-8,-6,-4,-2], set.sort)
- end
-end
-
-# class TC_RestricedSet < Test::Unit::TestCase
-# def test_s_new
-# assert_raises(ArgumentError) { RestricedSet.new }
-#
-# s = RestricedSet.new([-1,2,3]) { |o| o > 0 }
-# assert_equal([2,3], s.sort)
-# end
-#
-# def test_restriction_proc
-# s = RestricedSet.new([-1,2,3]) { |o| o > 0 }
-#
-# f = s.restriction_proc
-# assert_instance_of(Proc, f)
-# assert(f[1])
-# assert(!f[0])
-# end
-#
-# def test_replace
-# s = RestricedSet.new(-3..3) { |o| o > 0 }
-# assert_equal([1,2,3], s.sort)
-#
-# s.replace([-2,0,3,4,5])
-# assert_equal([3,4,5], s.sort)
-# end
-#
-# def test_merge
-# s = RestricedSet.new { |o| o > 0 }
-# s.merge(-5..5)
-# assert_equal([1,2,3,4,5], s.sort)
-#
-# s.merge([10,-10,-8,8])
-# assert_equal([1,2,3,4,5,8,10], s.sort)
-# end
-# end
+# Tests have been moved to test/test_set.rb.
diff --git a/lib/shell.rb b/lib/shell.rb
index 9e409a1004..76af3b6f86 100644
--- a/lib/shell.rb
+++ b/lib/shell.rb
@@ -19,6 +19,73 @@ require "shell/error"
require "shell/command-processor"
require "shell/process-controller"
+# Shell implements an idiomatic Ruby interface for common UNIX shell commands.
+#
+# It provides users the ability to execute commands with filters and pipes,
+# like +sh+/+csh+ by using native facilities of Ruby.
+#
+# == Examples
+#
+# === Temp file creation
+#
+# In this example we will create three +tmpFile+'s in three different folders
+# under the +/tmp+ directory.
+#
+# sh = Shell.cd("/tmp") # Change to the /tmp directory
+# sh.mkdir "shell-test-1" unless sh.exists?("shell-test-1")
+# # make the 'shell-test-1' directory if it doesn't already exist
+# 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.cd(dir) do
+# # change to the `dir` directory
+# f = sh.open("tmpFile", "w") # open a new file in write mode
+# f.print "TEST\n" # write to the file
+# f.close # close the file handler
+# end
+# print sh.pwd # output the process working directory
+# end
+# end
+#
+# === Temp file creation with self
+#
+# This example is identical to the first, except we're using
+# CommandProcessor#transact.
+#
+# CommandProcessor#transact executes the given block against self, in this case
+# +sh+; our Shell object. Within the block we can substitute +sh.cd+ to +cd+,
+# because the scope within the block uses +sh+ already.
+#
+# sh = Shell.cd("/tmp")
+# sh.transact do
+# mkdir "shell-test-1" unless exists?("shell-test-1")
+# cd("shell-test-1")
+# for dir in ["dir1", "dir3", "dir5"]
+# if !exists?(dir)
+# mkdir dir
+# cd(dir) do
+# f = open("tmpFile", "w")
+# f.print "TEST\n"
+# f.close
+# end
+# print pwd
+# end
+# end
+# end
+#
+# === Pipe /etc/printcap into a file
+#
+# In this example we will read the operating system file +/etc/printcap+,
+# generated by +cupsd+, and then output it to a new file relative to the +pwd+
+# of +sh+.
+#
+# sh = Shell.new
+# sh.cat("/etc/printcap") | sh.tee("tee1") > "tee2"
+# (sh.cat < "/etc/printcap") | sh.tee("tee11") > "tee12"
+# sh.cat("/etc/printcap") | sh.tee("tee1") >> "tee2"
+# (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 $-'
@@ -51,10 +118,29 @@ class Shell
@verbose = val if val
end
+
+ # call-seq:
+ # Shell.cd(path)
+ #
+ # Creates a new Shell instance with the current working directory
+ # set to +path+.
def cd(path)
new(path)
end
+ # Returns the directories in the current shell's PATH environment variable
+ # as an array of directory names. This sets the system_path for all
+ # instances of Shell.
+ #
+ # Example: If in your current shell, you did:
+ #
+ # $ echo $PATH
+ # /usr/bin:/bin:/usr/local/bin
+ #
+ # Running this method in the above shell would then return:
+ #
+ # ["/usr/bin", "/bin", "/usr/local/bin"]
+ #
def default_system_path
if @default_system_path
@default_system_path
@@ -63,6 +149,10 @@ class Shell
end
end
+ # Sets the system_path that new instances of Shell should have as their
+ # initial system_path.
+ #
+ # +path+ should be an array of directory name strings.
def default_system_path=(path)
@default_system_path = path
end
@@ -87,6 +177,11 @@ class Shell
end
+ # call-seq:
+ # Shell.new(pwd, umask) -> obj
+ #
+ # Creates a Shell object which current directory is set to the process
+ # current directory, unless otherwise specified by the +pwd+ argument.
def initialize(pwd = Dir.pwd, umask = nil)
@cwd = File.expand_path(pwd)
@dir_stack = []
@@ -102,14 +197,21 @@ class Shell
@debug = Shell.debug
end
+ # Returns the command search path in an array
attr_reader :system_path
+ # Sets the system path (the Shell instance's PATH environment variable).
+ #
+ # +path+ should be an array of directory name strings.
def system_path=(path)
@system_path = path
rehash
end
- attr_accessor :umask, :record_separator
+
+ # Returns the umask
+ attr_accessor :umask
+ attr_accessor :record_separator
attr_accessor :verbose, :debug
def debug=(val)
@@ -139,6 +241,7 @@ class Shell
# Shell#mkdir
# Shell#rmdir
+ # Returns the current working directory.
attr_reader :cwd
alias dir cwd
alias getwd cwd
@@ -147,6 +250,13 @@ class Shell
attr_reader :dir_stack
alias dirs dir_stack
+ # call-seq:
+ # Shell.chdir(path)
+ #
+ # Creates a Shell object which current directory is set to +path+.
+ #
+ # If a block is given, it restores the current directory when the block ends.
+ #
# If called as iterator, it restores the current directory when the
# block ends.
def chdir(path = nil, verbose = @verbose)
@@ -172,6 +282,17 @@ class Shell
end
alias cd chdir
+ # call-seq:
+ # pushdir(path)
+ # pushdir(path) { &block }
+ #
+ # Pushes the current directory to the directory stack, changing the current
+ # directory to +path+.
+ #
+ # If +path+ is omitted, it exchanges its current directory and the top of its
+ # directory stack.
+ #
+ # If a block is given, it restores the current directory when the block ends.
def pushdir(path = nil, verbose = @verbose)
check_point
@@ -204,6 +325,8 @@ class Shell
end
alias pushd pushdir
+ # Pops a directory from the directory stack, and sets the current directory
+ # to it.
def popdir
check_point
@@ -219,36 +342,40 @@ class Shell
end
alias popd popdir
- #
- # process management
- #
+ # Returns a list of scheduled jobs.
def jobs
@process_controller.jobs
end
+ # call-seq:
+ # kill(signal, job)
+ #
+ # Sends the given +signal+ to the given +job+
def kill(sig, command)
@process_controller.kill_job(sig, command)
end
- #
- # command definitions
- #
+ # Convenience method for Shell::CommandProcessor.def_system_command
def Shell.def_system_command(command, path = command)
CommandProcessor.def_system_command(command, path)
end
+ # Convenience method for Shell::CommandProcessor.undef_system_command
def Shell.undef_system_command(command)
CommandProcessor.undef_system_command(command)
end
+ # Convenience method for Shell::CommandProcessor.alias_command
def Shell.alias_command(ali, command, *opts, &block)
CommandProcessor.alias_command(ali, command, *opts, &block)
end
+ # Convenience method for Shell::CommandProcessor.unalias_command
def Shell.unalias_command(ali)
CommandProcessor.unalias_command(ali)
end
+ # Convenience method for Shell::CommandProcessor.install_system_commands
def Shell.install_system_commands(pre = "sys_")
CommandProcessor.install_system_commands(pre)
end
@@ -262,7 +389,7 @@ class Shell
end
end
- def self.notify(*opts, &block)
+ def self.notify(*opts)
Shell::debug_output_synchronize do
if opts[-1].kind_of?(String)
yorn = verbose?
diff --git a/lib/shell/command-processor.rb b/lib/shell/command-processor.rb
index ae157eba5c..8a9ab55e73 100644
--- a/lib/shell/command-processor.rb
+++ b/lib/shell/command-processor.rb
@@ -18,6 +18,11 @@ require "shell/system-command"
require "shell/builtin-command"
class Shell
+ # In order to execute a command on your OS, you need to define it as a
+ # Shell method.
+ #
+ # Alternatively, you can execute any command via
+ # Shell::CommandProcessor#system even if it is not defined.
class CommandProcessor
# include Error
@@ -76,23 +81,13 @@ class Shell
@shell.expand_path(path)
end
+ # call-seq:
+ # foreach(path, record_separator) -> Enumerator
+ # foreach(path, record_separator) { block }
#
- # File related commands
- # Shell#foreach
- # Shell#open
- # Shell#unlink
- # Shell#test
+ # See IO.foreach when +path+ is a file.
#
- # -
- #
- # CommandProcessor#foreach(path, rs)
- # path: String
- # rs: String - record separator
- # iterator
- # Same as:
- # File#foreach (when path is file)
- # Dir#foreach (when path is directory)
- # path is relative to pwd
+ # See Dir.foreach when +path+ is a directory.
#
def foreach(path = nil, *rs)
path = "." unless path
@@ -105,15 +100,13 @@ class Shell
end
end
+ # call-seq:
+ # open(path, mode, permissions) -> Enumerator
+ # open(path, mode, permissions) { block }
#
- # CommandProcessor#open(path, mode)
- # path: String
- # mode: String
- # return: File or Dir
- # Same as:
- # File#open (when path is file)
- # Dir#open (when path is directory)
- # mode has an effect only when path is a file
+ # See IO.open when +path+ is a file.
+ #
+ # See Dir.open when +path+ is a directory.
#
def open(path, mode = nil, perm = 0666, &b)
path = expand_path(path)
@@ -134,11 +127,12 @@ class Shell
end
# public :open
+ # call-seq:
+ # unlink(path)
#
- # CommandProcessor#unlink(path)
- # same as:
- # Dir#unlink (when path is directory)
- # File#unlink (when path is file)
+ # See IO.unlink when +path+ is a file.
+ #
+ # See Dir.unlink when +path+ is a directory.
#
def unlink(path)
@shell.check_point
@@ -152,24 +146,21 @@ class Shell
Void.new(@shell)
end
+ # See Shell::CommandProcessor#test
+ alias top_level_test test
+ # call-seq:
+ # test(command, file1, file2) -> true or false
+ # [command, file1, file2] -> true or false
#
- # CommandProcessor#test(command, file1, file2)
- # CommandProcessor#[command, file1, file2]
- # command: char or String or Symbol
- # file1: String
- # file2: String(optional)
- # return: Boolean
- # same as:
- # test() (when command is char or length 1 string or symbol)
- # FileTest.command (others)
- # example:
+ # Tests if the given +command+ exists in +file1+, or optionally +file2+.
+ #
+ # Example:
# sh[?e, "foo"]
# sh[:e, "foo"]
# sh["e", "foo"]
# sh[:exists?, "foo"]
# sh["exists?", "foo"]
#
- alias top_level_test test
def test(command, file1, file2=nil)
file1 = expand_path(file1)
file2 = expand_path(file2) if file2
@@ -198,20 +189,13 @@ class Shell
end
end
end
+ # See Shell::CommandProcessor#test
alias [] test
+ # call-seq:
+ # mkdir(path)
#
- # Dir related methods
- #
- # Shell#mkdir
- # Shell#rmdir
- #
- #--
- #
- # CommandProcessor#mkdir(*path)
- # path: String
- # same as Dir.mkdir()
- #
+ # Same as Dir.mkdir, except multiple directories are allowed.
def mkdir(*path)
@shell.check_point
notify("mkdir #{path.join(' ')}")
@@ -232,11 +216,10 @@ class Shell
Void.new(@shell)
end
+ # call-seq:
+ # rmdir(path)
#
- # CommandProcessor#rmdir(*path)
- # path: String
- # same as Dir.rmdir()
- #
+ # Same as Dir.rmdir, except multiple directories are allowed.
def rmdir(*path)
@shell.check_point
notify("rmdir #{path.join(' ')}")
@@ -247,13 +230,12 @@ class Shell
Void.new(@shell)
end
+ # call-seq:
+ # system(command, *options) -> SystemCommand
+ #
+ # Executes the given +command+ with the +options+ parameter.
#
- # CommandProcessor#system(command, *opts)
- # command: String
- # opts: String
- # return: SystemCommand
- # Same as system() function
- # example:
+ # Example:
# print sh.system("ls", "-l")
# sh.system("ls", "-l") | sh.head > STDOUT
#
@@ -268,22 +250,26 @@ class Shell
SystemCommand.new(@shell, find_system_command(command), *opts)
end
+ # call-seq:
+ # rehash
#
- # ProcessCommand#rehash
- # clear command hash table.
- #
+ # Clears the command hash table.
def rehash
@system_commands = {}
end
- #
- # ProcessCommand#transact
- #
- def check_point
+ def check_point # :nodoc:
@shell.process_controller.wait_all_jobs_execution
end
- alias finish_all_jobs check_point
+ alias finish_all_jobs check_point # :nodoc:
+ # call-seq:
+ # transact { block }
+ #
+ # Executes a block as self
+ #
+ # Example:
+ # sh.transact { system("ls", "-l") | head > STDOUT }
def transact(&block)
begin
@shell.instance_eval(&block)
@@ -292,17 +278,27 @@ class Shell
end
end
+ # call-seq:
+ # out(device) { block }
#
- # internal commands
- #
+ # Calls <code>device.print</code> on the result passing the _block_ to
+ # #transact
def out(dev = STDOUT, &block)
dev.print transact(&block)
end
+ # call-seq:
+ # echo(*strings) -> Echo
+ #
+ # Returns a Echo object, for the given +strings+
def echo(*strings)
Echo.new(@shell, *strings)
end
+ # call-seq:
+ # cat(*filename) -> Cat
+ #
+ # Returns a Cat object, for the given +filenames+
def cat(*filenames)
Cat.new(@shell, *filenames)
end
@@ -310,7 +306,10 @@ class Shell
# def sort(*filenames)
# Sort.new(self, *filenames)
# end
-
+ # call-seq:
+ # glob(pattern) -> Glob
+ #
+ # Returns a Glob filter object, with the given +pattern+ object
def glob(pattern)
Glob.new(@shell, pattern)
end
@@ -326,16 +325,24 @@ class Shell
end
end
+ # call-seq:
+ # tee(file) -> Tee
+ #
+ # Returns a Tee filter object, with the given +file+ command
def tee(file)
Tee.new(@shell, file)
end
+ # call-seq:
+ # concat(*jobs) -> Concat
+ #
+ # Returns a Concat object, for the given +jobs+
def concat(*jobs)
Concat.new(@shell, *jobs)
end
# %pwd, %cwd -> @pwd
- def notify(*opts, &block)
+ def notify(*opts)
Shell.notify(*opts) {|mes|
yield mes if iterator?
@@ -362,7 +369,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
@@ -371,11 +383,17 @@ class Shell
Shell.Fail Error::CommandNotFound, command
end
+ # call-seq:
+ # def_system_command(command, path) -> Shell::SystemCommand
+ #
+ # Defines a command, registering +path+ as a Shell method for the given
+ # +command+.
+ #
+ # Shell::CommandProcessor.def_system_command "ls"
+ # #=> Defines ls.
#
- # CommandProcessor.def_system_command(command, path)
- # command: String
- # path: String
- # define 'command()' method as method.
+ # Shell::CommandProcessor.def_system_command "sys_sort", "sort"
+ # #=> Defines sys_sort as sort
#
def self.def_system_command(command, path = command)
begin
@@ -390,6 +408,10 @@ class Shell
Shell.debug.kind_of?(Integer) && Shell.debug > 1)
end
+ # call-seq:
+ # undef_system_command(command) -> self
+ #
+ # Undefines a command
def self.undef_system_command(command)
command = command.id2name if command.kind_of?(Symbol)
remove_method(command)
@@ -398,16 +420,21 @@ class Shell
self
end
- # define command alias
- # ex)
- # def_alias_command("ls_c", "ls", "-C", "-F")
- # def_alias_command("ls_c", "ls"){|*opts| ["-C", "-F", *opts]}
- #
@alias_map = {}
+ # Returns a list of aliased commands
def self.alias_map
@alias_map
end
- def self.alias_command(ali, command, *opts, &block)
+ # call-seq:
+ # alias_command(alias, command, *options) -> self
+ #
+ # Creates a command alias at the given +alias+ for the given +command+,
+ # passing any +options+ along with it.
+ #
+ # Shell::CommandProcessor.alias_command "lsC", "ls", "-CBF", "--show-control-chars"
+ # Shell::CommandProcessor.alias_command("lsC", "ls"){|*opts| ["-CBF", "--show-control-chars", *opts]}
+ #
+ def self.alias_command(ali, command, *opts)
ali = ali.id2name if ali.kind_of?(Symbol)
command = command.id2name if command.kind_of?(Symbol)
begin
@@ -436,22 +463,57 @@ class Shell
self
end
+ # call-seq:
+ # unalias_command(alias) -> self
+ #
+ # Unaliases the given +alias+ command.
def self.unalias_command(ali)
ali = ali.id2name if ali.kind_of?(Symbol)
@alias_map.delete ali.intern
undef_system_command(ali)
end
- #
- # CommandProcessor.def_builtin_commands(delegation_class, command_specs)
- # delegation_class: Class or Module
- # command_specs: [[command_name, [argument,...]],...]
- # command_name: String
- # arguments: String
- # FILENAME?? -> expand_path(filename??)
- # *FILENAME?? -> filename??.collect{|f|expand_path(f)}.join(", ")
- # define command_name(argument,...) as
- # delegation_class.command_name(argument,...)
+ # :nodoc:
+ #
+ # Delegates File and FileTest methods into Shell, including the following
+ # commands:
+ #
+ # * Shell#blockdev?(file)
+ # * Shell#chardev?(file)
+ # * Shell#directory?(file)
+ # * Shell#executable?(file)
+ # * Shell#executable_real?(file)
+ # * Shell#exist?(file)/Shell#exists?(file)
+ # * Shell#file?(file)
+ # * Shell#grpowned?(file)
+ # * Shell#owned?(file)
+ # * Shell#pipe?(file)
+ # * Shell#readable?(file)
+ # * Shell#readable_real?(file)
+ # * Shell#setgid?(file)
+ # * Shell#setuid?(file)
+ # * Shell#size(file)/Shell#size?(file)
+ # * Shell#socket?(file)
+ # * Shell#sticky?(file)
+ # * Shell#symlink?(file)
+ # * Shell#writable?(file)
+ # * Shell#writable_real?(file)
+ # * Shell#zero?(file)
+ # * Shell#syscopy(filename_from, filename_to)
+ # * Shell#copy(filename_from, filename_to)
+ # * Shell#move(filename_from, filename_to)
+ # * Shell#compare(filename_from, filename_to)
+ # * Shell#safe_unlink(*filenames)
+ # * Shell#makedirs(*filenames)
+ # * Shell#install(filename_from, filename_to, mode)
+ #
+ # And also, there are some aliases for convenience:
+ #
+ # * Shell#cmp <- Shell#compare
+ # * Shell#mv <- Shell#move
+ # * Shell#cp <- Shell#copy
+ # * Shell#rm_f <- Shell#safe_unlink
+ # * Shell#mkpath <- Shell#makedirs
#
def self.def_builtin_commands(delegation_class, command_specs)
for meth, args in command_specs
@@ -478,15 +540,16 @@ class Shell
end
end
+ # call-seq:
+ # install_system_commands(prefix = "sys_")
#
- # CommandProcessor.install_system_commands(pre)
- # pre: String - command name prefix
- # defines every command which belongs in default_system_path via
- # CommandProcessor.command(). It doesn't define already defined
- # methods twice. By default, "pre_" is prefixes to each method
- # name. Characters that may not be used in a method name are
- # all converted to '_'. Definition errors are just ignored.
+ # Defines all commands in the Shell.default_system_path as Shell method,
+ # all with given +prefix+ appended to their names.
#
+ # Any invalid character names are converted to +_+, and errors are passed
+ # to Shell.notify.
+ #
+ # Methods already defined are skipped.
def self.install_system_commands(pre = "sys_")
defined_meth = {}
for m in Shell.methods
@@ -511,12 +574,7 @@ class Shell
end
end
- #----------------------------------------------------------------------
- #
- # class initializing methods -
- #
- #----------------------------------------------------------------------
- def self.add_delegate_command_to_shell(id)
+ def self.add_delegate_command_to_shell(id) # :nodoc:
id = id.intern if id.kind_of?(String)
name = id.id2name
if Shell.method_defined?(id)
@@ -552,8 +610,27 @@ class Shell
end], __FILE__, __LINE__)
end
- #
- # define default builtin commands
+ # Delegates File methods into Shell, including the following commands:
+ #
+ # * Shell#atime(file)
+ # * Shell#basename(file, *opt)
+ # * Shell#chmod(mode, *files)
+ # * Shell#chown(owner, group, *file)
+ # * Shell#ctime(file)
+ # * Shell#delete(*file)
+ # * Shell#dirname(file)
+ # * Shell#ftype(file)
+ # * Shell#join(*file)
+ # * Shell#link(file_from, file_to)
+ # * Shell#lstat(file)
+ # * Shell#mtime(file)
+ # * Shell#readlink(file)
+ # * Shell#rename(file_from, file_to)
+ # * Shell#split(file)
+ # * Shell#stat(file)
+ # * Shell#symlink(file_from, file_to)
+ # * Shell#truncate(file, length)
+ # * Shell#utime(atime, mtime, *file)
#
def self.install_builtin_commands
# method related File.
diff --git a/lib/shell/filter.rb b/lib/shell/filter.rb
index df41b420ea..d53ed06315 100644
--- a/lib/shell/filter.rb
+++ b/lib/shell/filter.rb
@@ -9,11 +9,12 @@
#
#
-class Shell
+class Shell #:nodoc:
+ # Any result of command exection is a Filter.
#
- # Filter
- # A method to require
- # each()
+ # This class includes Enumerable, therefore a Filter object can use all
+ # Enumerable
+ # facilities.
#
class Filter
include Enumerable
@@ -29,6 +30,10 @@ class Shell
@input = filter
end
+ # call-seq:
+ # each(record_separator=nil) { block }
+ #
+ # Iterates a block for each line.
def each(rs = nil)
rs = @shell.record_separator unless rs
if @input
@@ -36,6 +41,11 @@ class Shell
end
end
+ # call-seq:
+ # < source
+ #
+ # Inputs from +source+, which is either a string of a file name or an IO
+ # object.
def < (src)
case src
when String
@@ -49,6 +59,11 @@ class Shell
end
end
+ # call-seq:
+ # > source
+ #
+ # Outputs from +source+, which is either a string of a file name or an IO
+ # object.
def > (to)
case to
when String
@@ -66,6 +81,11 @@ class Shell
self
end
+ # call-seq:
+ # >> source
+ #
+ # Appends the output to +source+, which is either a string of a file name
+ # or an IO object.
def >> (to)
begin
Shell.cd(@shell.pwd).append(to, self)
@@ -74,6 +94,10 @@ class Shell
end
end
+ # call-seq:
+ # | filter
+ #
+ # Processes a pipeline.
def | (filter)
filter.input = self
if active?
@@ -82,6 +106,10 @@ class Shell
filter
end
+ # call-seq:
+ # filter1 + filter2
+ #
+ # Outputs +filter1+, and then +filter2+ using Join.new
def + (filter)
Join.new(@shell, self, filter)
end
diff --git a/lib/shell/process-controller.rb b/lib/shell/process-controller.rb
index 30f2229d39..b973539b4b 100644
--- a/lib/shell/process-controller.rb
+++ b/lib/shell/process-controller.rb
@@ -234,7 +234,7 @@ class Shell
end
# simple fork
- def sfork(command, &block)
+ def sfork(command)
pipe_me_in, pipe_peer_out = IO.pipe
pipe_peer_in, pipe_me_out = IO.pipe
diff --git a/lib/shell/system-command.rb b/lib/shell/system-command.rb
index 50d994bb20..1a8bb1a90f 100644
--- a/lib/shell/system-command.rb
+++ b/lib/shell/system-command.rb
@@ -145,7 +145,7 @@ class Shell
# then
# mes: "job(%id) close pipe-out."
# yorn: Boolean(@shell.debug? or @shell.verbose?)
- def notify(*opts, &block)
+ def notify(*opts)
@shell.notify(*opts) do |mes|
yield mes if iterator?
diff --git a/lib/shell/version.rb b/lib/shell/version.rb
index cbdb0e5e96..2568627e2b 100644
--- a/lib/shell/version.rb
+++ b/lib/shell/version.rb
@@ -9,7 +9,7 @@
#
#
-class Shell
+class Shell # :nodoc:
@RELEASE_VERSION = "0.7"
@LAST_UPDATE_DATE = "07/03/20"
end
diff --git a/lib/shellwords.rb b/lib/shellwords.rb
index abc4e80ad4..c3586d29fa 100644
--- a/lib/shellwords.rb
+++ b/lib/shellwords.rb
@@ -1,21 +1,61 @@
-#
-# shellwords.rb: Manipulates strings a la UNIX Bourne shell
-#
-
+##
+# == Manipulates strings like the UNIX Bourne shell
#
# This module manipulates strings according to the word parsing rules
# of the UNIX Bourne shell.
#
# The shellwords() function was originally a port of shellwords.pl,
-# but modified to conform to POSIX / SUSv3 (IEEE Std 1003.1-2001).
+# but modified to conform to POSIX / SUSv3 (IEEE Std 1003.1-2001 [1]).
+#
+# === Usage
+#
+# You can use shellwords to parse a string into a Bourne shell friendly Array.
+#
+# require 'shellwords'
+#
+# argv = Shellwords.split('three blind "mice"')
+# argv #=> ["three", "blind", "mice"]
+#
+# Once you've required Shellwords, you can use the #split alias
+# String#shellsplit.
+#
+# argv = "see how they run".shellsplit
+# argv #=> ["see", "how", "they", "run"]
+#
+# Be careful you don't leave a quote unmatched.
#
-# Authors:
-# - Wakou Aoyama
-# - Akinori MUSHA <knu@iDaemons.org>
+# argv = "they all ran after the farmer's wife".shellsplit
+# #=> ArgumentError: Unmatched double quote: ...
#
-# Contact:
-# - Akinori MUSHA <knu@iDaemons.org> (current maintainer)
+# In this case, you might want to use Shellwords.escape, or it's alias
+# String#shellescape.
#
+# This method will escape the String for you to safely use with a Bourne shell.
+#
+# argv = Shellwords.escape("special's.txt")
+# argv #=> "special\\s.txt"
+# system("cat " + argv)
+#
+# Shellwords also comes with a core extension for Array, Array#shelljoin.
+#
+# argv = %w{ls -lta lib}
+# 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
+# Array.new.
+#
+# === Authors
+# * Wakou Aoyama
+# * Akinori MUSHA <knu@iDaemons.org>
+#
+# === Contact
+# * Akinori MUSHA <knu@iDaemons.org> (current maintainer)
+#
+# === Resources
+#
+# 1: {IEEE Std 1003.1-2004}[http://pubs.opengroup.org/onlinepubs/009695399/toc.htm]
+
module Shellwords
# Splits a string into an array of tokens in the same way the UNIX
# Bourne shell does.
@@ -23,7 +63,7 @@ module Shellwords
# argv = Shellwords.split('here are "two words"')
# argv #=> ["here", "are", "two words"]
#
- # String#shellsplit is a shorthand for this function.
+ # String#shellsplit is a shortcut for this function.
#
# argv = 'here are "two words"'.shellsplit
# argv #=> ["here", "are", "two words"]
@@ -51,26 +91,38 @@ module Shellwords
end
# Escapes a string so that it can be safely used in a Bourne shell
- # command line.
+ # command line. +str+ can be a non-string object that responds to
+ # +to_s+.
#
# Note that a resulted string should be used unquoted and is not
# intended for use in double quotes nor in single quotes.
#
- # open("| grep #{Shellwords.escape(pattern)} file") { |pipe|
- # # ...
- # }
+ # argv = Shellwords.escape("It's better to give than to receive")
+ # argv #=> "It\\'s\\ better\\ to\\ give\\ than\\ to\\ receive"
#
# String#shellescape is a shorthand for this function.
#
- # open("| grep #{pattern.shellescape} file") { |pipe|
- # # ...
+ # argv = "It's better to give than to receive".shellescape
+ # argv #=> "It\\'s\\ better\\ to\\ give\\ than\\ to\\ receive"
+ #
+ # # Search files in lib for method definitions
+ # pattern = "^[ \t]*def "
+ # open("| grep -Ern #{pattern.shellescape} lib") { |grep|
+ # grep.each_line { |line|
+ # file, lineno, matched_line = line.split(':', 3)
+ # # ...
+ # }
# }
#
- # It is caller's responsibility to encode the string in the right
+ # 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 bytes.
+ #
+ # Returns an empty quoted String if +str+ has a length of zero.
def shellescape(str)
+ str = str.to_s
+
# An empty argument will be skipped, so return empty quotes.
return "''" if str.empty?
@@ -94,18 +146,25 @@ module Shellwords
alias escape shellescape
end
- # Builds a command line string from an argument list +array+ joining
- # all elements escaped for Bourne shell and separated by a space.
+ # Builds a command line string from an argument list, +array+.
#
- # open('|' + Shellwords.join(['grep', pattern, *files])) { |pipe|
- # # ...
- # }
+ # 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+.
#
- # Array#shelljoin is a shorthand for this function.
+ # ary = ["There's", "a", "time", "and", "place", "for", "everything"]
+ # argv = Shellwords.join(ary)
+ # argv #=> "There\\'s a time and place for everything"
#
- # open('|' + ['grep', pattern, *files].shelljoin) { |pipe|
- # # ...
- # }
+ # Array#shelljoin is a shortcut for this function.
+ #
+ # ary = ["Don't", "rock", "the", "boat"]
+ # argv = ary.shelljoin
+ # argv #=> "Don\\'t rock the boat"
+ #
+ # You can also mix non-string objects in the elements as allowed in Array#join.
+ #
+ # output = `#{['ps', '-p', $$].shelljoin}`
#
def shelljoin(array)
array.map { |arg| shellescape(arg) }.join(' ')
@@ -123,7 +182,9 @@ class String
# str.shellsplit => array
#
# Splits +str+ into an array of tokens in the same way the UNIX
- # Bourne shell does. See Shellwords::shellsplit for details.
+ # Bourne shell does.
+ #
+ # See Shellwords.shellsplit for details.
def shellsplit
Shellwords.split(self)
end
@@ -132,7 +193,9 @@ class String
# str.shellescape => string
#
# Escapes +str+ so that it can be safely used in a Bourne shell
- # command line. See Shellwords::shellescape for details.
+ # command line.
+ #
+ # See Shellwords.shellescape for details.
def shellescape
Shellwords.escape(self)
end
@@ -144,7 +207,8 @@ class Array
#
# Builds a command line string from an argument list +array+ joining
# all elements escaped for Bourne shell and separated by a space.
- # See Shellwords::shelljoin for details.
+ #
+ # See Shellwords.shelljoin for details.
def shelljoin
Shellwords.join(self)
end
diff --git a/lib/sync.rb b/lib/sync.rb
index bae05a4a99..09542d59f9 100644
--- a/lib/sync.rb
+++ b/lib/sync.rb
@@ -45,8 +45,6 @@ end
# A module that provides a two-phase lock with a counter.
module Sync_m
- RCS_ID='-$Id$-'
-
# lock mode
UN = :UN
SH = :SH
@@ -137,19 +135,26 @@ module Sync_m
def sync_lock(m = EX)
return unlock if m == UN
-
- while true
- @sync_mutex.synchronize do
- if sync_try_lock_sub(m)
- return self
- else
- if sync_sh_locker[Thread.current]
- sync_upgrade_waiting.push [Thread.current, sync_sh_locker[Thread.current]]
- sync_sh_locker.delete(Thread.current)
- else
- sync_waiting.push Thread.current
+ Thread.handle_interrupt(StandardError => :on_blocking) do
+ while true
+ @sync_mutex.synchronize do
+ begin
+ if sync_try_lock_sub(m)
+ return self
+ else
+ if sync_sh_locker[Thread.current]
+ sync_upgrade_waiting.push [Thread.current, sync_sh_locker[Thread.current]]
+ sync_sh_locker.delete(Thread.current)
+ else
+ unless sync_waiting.include?(Thread.current) || sync_upgrade_waiting.reverse_each.any?{|w| w.first == Thread.current }
+ sync_waiting.push Thread.current
+ end
+ end
+ @sync_mutex.sleep
+ end
+ ensure
+ sync_waiting.delete(Thread.current)
end
- @sync_mutex.sleep
end
end
end
@@ -222,11 +227,13 @@ module Sync_m
end
def sync_synchronize(mode = EX)
- sync_lock(mode)
- begin
- yield
- ensure
- sync_unlock
+ Thread.handle_interrupt(StandardError => :on_blocking) do
+ sync_lock(mode)
+ begin
+ yield
+ ensure
+ sync_unlock
+ end
end
end
@@ -308,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 b34251ebb6..5f4e8eedf1 100644
--- a/lib/tempfile.rb
+++ b/lib/tempfile.rb
@@ -79,7 +79,6 @@ require 'thread'
# same Tempfile object from multiple threads then you should protect it with a
# mutex.
class Tempfile < DelegateClass(File)
- MAX_TRY = 10 # :nodoc:
include Dir::Tmpname
# call-seq:
@@ -127,11 +126,14 @@ class Tempfile < DelegateClass(File)
# If Tempfile.new cannot find a unique filename within a limited
# number of tries, then it will raise an exception.
def initialize(basename, *rest)
+ if block_given?
+ warn "Tempfile.new doesn't call the given block."
+ end
@data = []
@clean_proc = Remover.new(@data)
ObjectSpace.define_finalizer(self, @clean_proc)
- 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
@@ -141,10 +143,8 @@ class Tempfile < DelegateClass(File)
else
opts = perm
end
- self.class.locking(tmpname) do
- @data[1] = @tmpfile = File.open(tmpname, mode, opts)
- @data[0] = @tmpname = tmpname
- end
+ @data[1] = @tmpfile = File.open(tmpname, mode, opts)
+ @data[0] = @tmpname = tmpname
@mode = mode & ~(File::CREAT|File::EXCL)
perm or opts.freeze
@opts = opts
@@ -190,7 +190,6 @@ class Tempfile < DelegateClass(File)
def close!
_close
unlink
- ObjectSpace.undefine_finalizer(self)
end
# Unlinks (deletes) the file from the filesystem. One should always unlink
@@ -238,6 +237,7 @@ class Tempfile < DelegateClass(File)
# remove tmpname from remover
@data[0] = @data[1] = nil
@tmpname = nil
+ ObjectSpace.undefine_finalizer(self)
end
alias delete unlink
@@ -262,6 +262,10 @@ class Tempfile < DelegateClass(File)
alias length size
# :stopdoc:
+ def inspect
+ "#<#{self.class}:#{path}>"
+ end
+
class Remover
def initialize(data)
@pid = $$
@@ -296,7 +300,7 @@ class Tempfile < DelegateClass(File)
#
# If a block is given, then a Tempfile object will be constructed,
# and the block is run with said object as argument. The Tempfile
- # oject will be automatically closed after the block terminates.
+ # object will be automatically closed after the block terminates.
# The call returns the value of the block.
#
# In any case, all arguments (+*args+) will be passed to Tempfile.new.
@@ -325,26 +329,52 @@ class Tempfile < DelegateClass(File)
tempfile
end
end
+ end
+end
- # :stopdoc:
-
- # yields with locking for +tmpname+ and returns the result of the
- # block.
- def locking(tmpname)
- lock = tmpname + '.lock'
- mkdir(lock)
- yield
- ensure
- rmdir(lock) if lock
- end
-
- def mkdir(*args)
- Dir.mkdir(*args)
+# 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
-
- def rmdir(*args)
- Dir.rmdir(*args)
+ 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.rb b/lib/test/unit.rb
index 09708d14df..13a993fc6c 100644
--- a/lib/test/unit.rb
+++ b/lib/test/unit.rb
@@ -1,15 +1,21 @@
-# test/unit compatibility layer using minitest.
-
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 +35,7 @@ module Test
module_function :run_once
end
- module Options
+ module Options # :nodoc: all
def initialize(*, &block)
@init_hook = block
@options = nil
@@ -64,6 +70,9 @@ module Test
opts.separator 'minitest options:'
opts.version = MiniTest::Unit::VERSION
+ options[:retry] = true
+ options[:job_status] = nil
+
opts.on '-h', '--help', 'Display this help.' do
puts opts
exit
@@ -96,8 +105,17 @@ module Test
end
end
- opts.on '--no-retry', "Don't retry running testcase when --jobs specified" do
- options[:no_retry] = true
+ opts.on '--separate', "Restart job process after one testcase has done" do
+ options[:parallel] ||= 1
+ options[:separate] = true
+ end
+
+ opts.on '--retry', "Retry running testcase when --jobs specified" do
+ options[:retry] = true
+ end
+
+ opts.on '--no-retry', "Disable --retry" do
+ options[:retry] = false
end
opts.on '--ruby VAL', "Path to ruby; It'll have used at -j option" do |a|
@@ -107,6 +125,22 @@ module Test
opts.on '-q', '--hide-skip', 'Hide skipped tests' do
options[:hide_skip] = true
end
+
+ opts.on '--show-skip', 'Show skipped tests' do
+ options[:hide_skip] = false
+ end
+
+ opts.on '--color[=WHEN]',
+ [:always, :never, :auto],
+ "colorize the output. WHEN defaults to 'always'", "or can be 'never' or 'auto'." do |c|
+ options[:color] = c || :always
+ end
+
+ opts.on '--tty[=WHEN]',
+ [:yes, :no],
+ "force to output tty control. WHEN defaults to 'yes'", "or can be 'no'." do |c|
+ @tty = c != :no
+ end
end
def non_options(files, options)
@@ -116,16 +150,14 @@ module Test
warn "#{caller(1)[0]}: warning: Parallel running disabled because can't get path to ruby; run specify with --ruby argument"
options[:parallel] = nil
else
- options[:ruby] ||= RbConfig.ruby
+ options[:ruby] ||= [RbConfig.ruby]
end
true
end
end
- module GlobOption
- include Options
-
+ module GlobOption # :nodoc: all
@@testfile_prefix = "test"
def setup_options(parser, options)
@@ -171,9 +203,7 @@ module Test
end
end
- module LoadPathOption
- include Options
-
+ module LoadPathOption # :nodoc: all
def setup_options(parser, options)
super
parser.on '-Idirectory', 'Add library load path' do |dirs|
@@ -182,7 +212,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|
@@ -208,12 +238,12 @@ module Test
end
end
- module RequireFiles
+ module RequireFiles # :nodoc: all
def non_options(files, options)
return false if !super
result = false
files.each {|f|
- d = File.dirname(path = File.expand_path(f))
+ d = File.dirname(path = File.realpath(f))
unless $:.include? d
$: << d
end
@@ -228,7 +258,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
@@ -243,6 +273,8 @@ module Test
new(io, io.pid, :waiting)
end
+ attr_reader :quit_called
+
def initialize(io, pid, status)
@io = io
@pid = pid
@@ -251,6 +283,7 @@ module Test
@real_file = nil
@loadpath = []
@hooks = {}
+ @quit_called = false
end
def puts(*args)
@@ -258,10 +291,10 @@ module Test
end
def run(task,type)
- @file = File.basename(task).gsub(/\.rb/,"")
+ @file = File.basename(task, ".rb")
@real_file = task
begin
- puts "loadpath #{[Marshal.dump($:-@loadpath)].pack("m").gsub("\n","")}"
+ puts "loadpath #{[Marshal.dump($:-@loadpath)].pack("m0")}"
@loadpath = $:.dup
puts "run #{task} #{type}"
@status = :prepare
@@ -285,8 +318,21 @@ module Test
end
def close
- @io.close
+ @io.close unless @io.closed?
self
+ rescue IOError
+ end
+
+ def quit
+ return if @io.closed?
+ @quit_called = true
+ @io.puts "quit"
+ @io.close
+ end
+
+ def kill
+ Process.kill(:KILL, @pid)
+ rescue Errno::ESRCH
end
def died(*additional)
@@ -332,11 +378,7 @@ module Test
def after_worker_down(worker, e=nil, c=false)
return unless @options[:parallel]
return if @interrupt
- if e
- b = e.backtrace
- warn "#{b.shift}: #{e.message} (#{e.class})"
- STDERR.print b.map{|s| "\tfrom #{s}"}.join("\n")
- end
+ warn e if e
@need_quit = true
warn ""
warn "Some worker was crashed. It seems ruby interpreter's bug"
@@ -347,32 +389,67 @@ module Test
exit c
end
+ def terminal_width
+ unless @terminal_width ||= nil
+ begin
+ require 'io/console'
+ width = $stdout.winsize[1]
+ rescue LoadError, NoMethodError, Errno::ENOTTY, Errno::EBADF
+ width = ENV["COLUMNS"].to_i.nonzero? || 80
+ end
+ width -= 1 if /mswin|mingw/ =~ RUBY_PLATFORM
+ @terminal_width = width
+ end
+ @terminal_width
+ end
+
+ def del_status_line
+ @status_line_size ||= 0
+ unless @options[:job_status] == :replace
+ $stdout.puts
+ return
+ end
+ print "\r"+" "*@status_line_size+"\r"
+ $stdout.flush
+ @status_line_size = 0
+ end
+
+ def put_status(line)
+ unless @options[:job_status] == :replace
+ print(line)
+ return
+ end
+ @status_line_size ||= 0
+ del_status_line
+ $stdout.flush
+ line = line[0...terminal_width]
+ print line
+ $stdout.flush
+ @status_line_size = line.size
+ end
+
+ def add_status(line)
+ unless @options[:job_status] == :replace
+ print(line)
+ return
+ end
+ @status_line_size ||= 0
+ line = line[0...(terminal_width-@status_line_size)]
+ print line
+ $stdout.flush
+ @status_line_size += line.size
+ end
+
def jobs_status
return unless @options[:job_status]
- puts "" unless @options[:verbose]
+ puts "" unless @options[:verbose] or @options[:job_status] == :replace
status_line = @workers.map(&:to_s).join(" ")
- if @options[:job_status] == :replace and $stdout.tty?
- @terminal_width ||=
- begin
- require 'io/console'
- $stdout.winsize[1]
- rescue LoadError, NoMethodError
- ENV["COLUMNS"].to_i.nonzero? || 80
- end
- @jstr_size ||= 0
- del_jobs_status
- $stdout.flush
- print status_line[0...@terminal_width]
- $stdout.flush
- @jstr_size = [status_line.size, @terminal_width].min
- else
- puts status_line
- end
+ update_status(status_line) or (puts; nil)
end
def del_jobs_status
- return unless @options[:job_status] == :replace && @jstr_size.nonzero?
- print "\r"+" "*@jstr_size+"\r"
+ return unless @options[:job_status] == :replace && @status_line_size.nonzero?
+ del_status_line
end
def after_worker_quit(worker)
@@ -383,169 +460,188 @@ module Test
@ios = @workers.map(&:io)
end
+ def launch_worker
+ begin
+ worker = Worker.launch(@options[:ruby],@args)
+ rescue => e
+ abort "ERROR: Failed to launch job process - #{e.class}: #{e.message}"
+ end
+ worker.hook(:dead) do |w,info|
+ after_worker_quit w
+ after_worker_down w, *info if !info.empty? && !worker.quit_called
+ end
+ @workers << worker
+ @ios << worker.io
+ @workers_hash[worker.io] = worker
+ worker
+ end
+
+ def delete_worker(worker)
+ @workers_hash.delete worker.io
+ @workers.delete worker
+ @ios.delete worker.io
+ end
+
+ def quit_workers
+ return if @workers.empty?
+ @workers.reject! do |worker|
+ begin
+ timeout(1) do
+ worker.quit
+ end
+ rescue Errno::EPIPE
+ rescue Timeout::Error
+ end
+ worker.close
+ end
+
+ return if @workers.empty?
+ begin
+ timeout(0.2 * @workers.size) do
+ Process.waitall
+ end
+ rescue Timeout::Error
+ @workers.each do |worker|
+ worker.kill
+ end
+ @worker.clear
+ end
+ end
+
+ def start_watchdog
+ Thread.new do
+ while stat = Process.wait2
+ break if @interrupt # Break when interrupt
+ pid, stat = stat
+ w = (@workers + @dead_workers).find{|x| pid == x.pid }
+ next unless w
+ w = w.dup
+ if w.status != :quit && !w.quit_called?
+ # Worker down
+ w.died(nil, !stat.signaled? && stat.exitstatus)
+ end
+ end
+ end
+ end
+
+ def deal(io, type, result, rep, shutting_down = false)
+ worker = @workers_hash[io]
+ case worker.read
+ when /^okay$/
+ worker.status = :running
+ jobs_status
+ when /^ready(!)?$/
+ bang = $1
+ worker.status = :ready
+
+ return nil unless task = @tasks.shift
+ if @options[:separate] and not bang
+ worker.quit
+ worker = add_worker
+ end
+ worker.run(task, type)
+ @test_count += 1
+
+ jobs_status
+ when /^done (.+?)$/
+ r = Marshal.load($1.unpack("m")[0])
+ result << r[0..1] unless r[0..1] == [nil,nil]
+ rep << {file: worker.real_file, report: r[2], result: r[3], testcase: r[5]}
+ $:.push(*r[4]).uniq!
+ return true
+ when /^p (.+?)$/
+ del_jobs_status
+ print $1.unpack("m")[0]
+ jobs_status if @options[:job_status] == :replace
+ when /^after (.+?)$/
+ @warnings << Marshal.load($1.unpack("m")[0])
+ when /^bye (.+?)$/
+ after_worker_down worker, Marshal.load($1.unpack("m")[0])
+ when /^bye$/, nil
+ if shutting_down || worker.quit_called
+ after_worker_quit worker
+ else
+ after_worker_down worker
+ end
+ end
+ return false
+ end
+
def _run_parallel suites, type, result
if @options[:parallel] < 1
warn "Error: parameter of -j option should be greater than 0."
return
end
- begin
- # Require needed things for parallel running
- require 'thread'
- require 'timeout'
- @tasks = @files.dup # Array of filenames.
- @need_quit = false
- @dead_workers = [] # Array of dead workers.
- @warnings = []
- shutting_down = false
- rep = [] # FIXME: more good naming
-
- # Array of workers.
- @workers = @options[:parallel].times.map {
- worker = Worker.launch(@options[:ruby],@args)
- worker.hook(:dead) do |w,info|
- after_worker_quit w
- after_worker_down w, *info unless info.empty?
- end
- worker
- }
+ # Require needed things for parallel running
+ require 'thread'
+ require 'timeout'
+ @tasks = @files.dup # Array of filenames.
+ @need_quit = false
+ @dead_workers = [] # Array of dead workers.
+ @warnings = []
+ @total_tests = @tasks.size.to_s(10)
+ rep = [] # FIXME: more good naming
+ @workers = [] # Array of workers.
+ @workers_hash = {} # out-IO => worker
+ @ios = [] # Array of worker IOs
+ begin
# Thread: watchdog
- watchdog = Thread.new do
- while stat = Process.wait2
- break if @interrupt # Break when interrupt
- pid, stat = stat
- w = (@workers + @dead_workers).find{|x| pid == x.pid }.dup
- next unless w
- unless w.status == :quit
- # Worker down
- w.died(nil, !stat.signaled? && stat.exitstatus)
- end
- end
- end
+ watchdog = start_watchdog
- @workers_hash = Hash[@workers.map {|w| [w.io,w] }] # out-IO => worker
- @ios = @workers.map{|w| w.io } # Array of worker IOs
+ @options[:parallel].times {launch_worker}
while _io = IO.select(@ios)[0]
- break unless _io.each do |io|
- break if @need_quit
- worker = @workers_hash[io]
- case worker.read
- when /^okay$/
- worker.status = :running
- jobs_status
- when /^ready$/
- worker.status = :ready
- if @tasks.empty?
- break unless @workers.find{|x| x.status == :running }
- else
- worker.run(@tasks.shift, type)
- end
-
- jobs_status
- when /^done (.+?)$/
- r = Marshal.load($1.unpack("m")[0])
- result << r[0..1] unless r[0..1] == [nil,nil]
- rep << {file: worker.real_file,
- report: r[2], result: r[3], testcase: r[5]}
- $:.push(*r[4]).uniq!
- when /^p (.+?)$/
- del_jobs_status
- print $1.unpack("m")[0]
- jobs_status if @options[:job_status] == :replace
- when /^after (.+?)$/
- @warnings << Marshal.load($1.unpack("m")[0])
- when /^bye (.+?)$/
- after_worker_down worker, Marshal.load($1.unpack("m")[0])
- when /^bye$/
- if shutting_down
- after_worker_quit worker
- else
- after_worker_down worker
- end
- end
- break if @need_quit
+ break if _io.any? do |io|
+ @need_quit or
+ (deal(io, type, result, rep).nil? and
+ !@workers.any? {|x| [:running, :prepare].include? x.status})
end
end
- rescue Interrupt => e
- @interrupt = e
+ rescue Interrupt => ex
+ @interrupt = ex
return result
ensure
- shutting_down = true
-
watchdog.kill if watchdog
if @interrupt
@ios.select!{|x| @workers_hash[x].status == :running }
while !@ios.empty? && (__io = IO.select(@ios,[],[],10))
- _io = __io[0]
- _io.each do |io|
- worker = @workers_hash[io]
- case worker.read
- when /^done (.+?)$/
- r = Marshal.load($1.unpack("m")[0])
- result << r[0..1] unless r[0..1] == [nil,nil]
- rep << {file: worker.real_file,
- report: r[2], result: r[3], testcase: r[5]}
- $:.push(*r[4]).uniq!
- @ios.delete(io)
- end
- end
+ __io[0].reject! {|io| deal(io, type, result, rep, true)}
end
end
- @workers.each do |worker|
- begin
- timeout(1) do
- worker.puts "quit"
- end
- rescue Errno::EPIPE
- rescue Timeout::Error
+
+ quit_workers
+
+ unless @interrupt || !@options[:retry] || @need_quit
+ @options[:parallel] = false
+ suites, rep = rep.partition {|r| r[:testcase] && r[:file] && r[:report].any? {|e| !e[2].is_a?(MiniTest::Skip)}}
+ suites.map {|r| r[:file]}.uniq.each {|file| require file}
+ suites.map! {|r| eval("::"+r[:testcase])}
+ del_status_line or puts
+ unless suites.empty?
+ puts "Retrying..."
+ _run_suites(suites, type)
end
- worker.close
end
- begin
- timeout(0.2*@workers.size) do
- Process.waitall
- end
- rescue Timeout::Error
- @workers.each do |worker|
- begin
- Process.kill(:KILL,worker.pid)
- rescue Errno::ESRCH; end
- end
+ unless @options[:retry]
+ del_status_line or puts
end
-
- if @interrupt || @options[:no_retry] || @need_quit
- rep.each do |r|
- report.push(*r[:report])
- end
- @errors += rep.map{|x| x[:result][0] }.inject(:+)
- @failures += rep.map{|x| x[:result][1] }.inject(:+)
- @skips += rep.map{|x| x[:result][2] }.inject(:+)
- else
- puts ""
- puts "Retrying..."
- puts ""
+ unless rep.empty?
rep.each do |r|
- if r[:testcase] && r[:file] && !r[:report].empty?
- require r[:file]
- _run_suite(eval(r[:testcase]),type)
- else
- report.push(*r[:report])
- @errors += r[:result][0]
- @failures += r[:result][1]
- @skips += r[:result][2]
+ r[:report].each do |f|
+ puke(*f) if f
end
end
+ if @options[:retry]
+ @errors += rep.map{|x| x[:result][0] }.inject(:+)
+ @failures += rep.map{|x| x[:result][1] }.inject(:+)
+ @skips += rep.map{|x| x[:result][2] }.inject(:+)
+ end
end
- if @warnings
+ unless @warnings.empty?
warn ""
- ary = []
- @warnings.reject! do |w|
- r = ary.include?(w[1].message)
- ary << w[1].message
- r
- end
+ @warnings.uniq! {|w| w[1].message}
@warnings.each do |w|
warn "#{w[0]}: #{w[1].message} (#{w[1].class})"
end
@@ -555,8 +651,10 @@ module Test
end
def _run_suites suites, type
+ _prepare_run(suites, type)
@interrupt = nil
result = []
+ GC.start
if @options[:parallel]
_run_parallel suites, type, result
else
@@ -570,28 +668,106 @@ module Test
}
end
report.reject!{|r| r.start_with? "Skipped:" } if @options[:hide_skip]
+ report.sort_by!{|r| r.start_with?("Skipped:") ? 0 : \
+ (r.start_with?("Failure:") ? 1 : 2) }
result
end
+ alias mini_run_suite _run_suite
+
+ def output
+ (@output ||= nil) || super
+ end
+
+ def _prepare_run(suites, type)
+ options[:job_status] ||= :replace if @tty && !@verbose
+ case options[:color]
+ when :always
+ color = true
+ when :auto, nil
+ color = @options[:job_status] == :replace && /dumb/ !~ ENV["TERM"]
+ else
+ color = false
+ end
+ if color
+ # dircolors-like style
+ colors = (colors = ENV['TEST_COLORS']) ? Hash[colors.scan(/(\w+)=([^:]*)/)] : {}
+ @passed_color = "\e[#{colors["pass"] || "32"}m"
+ @failed_color = "\e[#{colors["fail"] || "31"}m"
+ @skipped_color = "\e[#{colors["skip"] || "33"}m"
+ @reset_color = "\e[m"
+ else
+ @passed_color = @failed_color = @skipped_color = @reset_color = ""
+ end
+ if color or @options[:job_status] == :replace
+ @verbose = !options[:parallel]
+ @output = StatusLineOutput.new(self)
+ end
+ if /\A\/(.*)\/\z/ =~ (filter = options[:filter])
+ filter = Regexp.new($1)
+ end
+ type = "#{type}_methods"
+ total = if filter
+ suites.inject(0) {|n, suite| n + suite.send(type).grep(filter).size}
+ else
+ suites.inject(0) {|n, suite| n + suite.send(type).size}
+ end
+ @test_count = 0
+ @total_tests = total.to_s(10)
+ end
+
+ def new_test(s)
+ @test_count += 1
+ update_status(s)
+ end
+
+ def update_status(s)
+ count = @test_count.to_s(10).rjust(@total_tests.size)
+ put_status("#{@passed_color}[#{count}/#{@total_tests}]#{@reset_color} #{s}")
+ end
+
+ def _print(s); $stdout.print(s); end
+ def succeed; del_status_line; end
+
+ def failed(s)
+ sep = "\n"
+ @report_count ||= 0
+ report.each do |msg|
+ if msg.start_with? "Skipped:"
+ if @options[:hide_skip]
+ del_status_line
+ next
+ end
+ color = @skipped_color
+ else
+ color = @failed_color
+ end
+ msg = msg.split(/$/, 2)
+ $stdout.printf("%s%s%3d) %s%s%s\n",
+ sep, color, @report_count += 1,
+ msg[0], @reset_color, msg[1])
+ sep = nil
+ end
+ report.clear
+ end
+
# Overriding of MiniTest::Unit#puke
def puke klass, meth, e
# TODO:
# this overriding is for minitest feature that skip messages are
# hidden when not verbose (-v), note this is temporally.
- e = case e
- when MiniTest::Skip then
- @skips += 1
- "Skipped:\n#{meth}(#{klass}) [#{location e}]:\n#{e.message}\n"
- when MiniTest::Assertion then
- @failures += 1
- "Failure:\n#{meth}(#{klass}) [#{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"
- end
- @report << e
- e[0, 1]
+ n = report.size
+ rep = super
+ if MiniTest::Skip === e and /no message given\z/ =~ e.message
+ report.slice!(n..-1)
+ rep = "."
+ end
+ rep
+ end
+
+ def initialize
+ super
+ @tty = $stdout.tty?
end
def status(*args)
@@ -599,9 +775,36 @@ module Test
raise @interrupt if @interrupt
result
end
+
+ def run(*args)
+ result = super
+ puts "\nruby -v: #{RUBY_DESCRIPTION}"
+ result
+ end
+ end
+
+ class StatusLineOutput < Struct.new(:runner) # :nodoc: all
+ def puts(*a) $stdout.puts(*a) unless a.empty? end
+ def respond_to_missing?(*a) $stdout.respond_to?(*a) end
+ def method_missing(*a, &b) $stdout.__send__(*a, &b) end
+
+ def print(s)
+ case s
+ when /\A(.*\#.*) = \z/
+ runner.new_test($1)
+ when /\A(.* s) = \z/
+ runner.add_status(" = "+$1.chomp)
+ when /\A\.+\z/
+ runner.succeed
+ when /\A[EFS]\z/
+ runner.failed(s)
+ else
+ $stdout.print(s)
+ end
+ end
end
- class AutoRunner
+ class AutoRunner # :nodoc: all
class Runner < Test::Unit::Runner
include Test::Unit::RequireFiles
end
@@ -609,6 +812,7 @@ module Test
attr_accessor :to_run, :options
def initialize(force_standalone = false, default_dir = nil, argv = ARGV)
+ @force_standalone = force_standalone
@runner = Runner.new do |files, options|
options[:base_directory] ||= default_dir
files << default_dir if files.empty? and default_dir
@@ -618,6 +822,9 @@ module Test
end
Runner.runner = @runner
@options = @runner.option_parser
+ if @force_standalone
+ @options.banner.sub!(/\[options\]/, '\& tests...')
+ end
@argv = argv
end
@@ -627,6 +834,9 @@ module Test
end
def run
+ if @force_standalone and not process_args(@argv)
+ abort @options.banner
+ end
@runner.run(@argv) || true
end
@@ -634,6 +844,32 @@ module Test
new(*args).run
end
end
+
+ class ProxyError < StandardError # :nodoc: all
+ def initialize(ex)
+ @message = ex.message
+ @backtrace = ex.backtrace
+ end
+
+ attr_accessor :message, :backtrace
+ end
+ end
+end
+
+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)
+ progname, $0 = $0, "#{$0}: #{self.class}##{name}"
+ self.__send__(name)
+ ensure
+ $@.delete(RUN_TEST_TRACE) if $@
+ $0 = progname
end
end
diff --git a/lib/test/unit/assertions.rb b/lib/test/unit/assertions.rb
index 39a3c85600..7da0c4e1eb 100644
--- a/lib/test/unit/assertions.rb
+++ b/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
@@ -70,6 +68,43 @@ module Test
end
# :call-seq:
+ # assert_raise_with_message(exception, expected, msg = nil, &block)
+ #
+ #Tests if the given block raises an exception with the expected
+ #message.
+ #
+ # assert_raise_with_message(RuntimeError, "foo") do
+ # nil #Fails, no Exceptions are raised
+ # end
+ #
+ # assert_raise_with_message(RuntimeError, "foo") do
+ # raise ArgumentError, "foo" #Fails, different Exception is raised
+ # end
+ #
+ # assert_raise_with_message(RuntimeError, "foo") do
+ # raise "bar" #Fails, RuntimeError is raised but the message differs
+ # end
+ #
+ # assert_raise_with_message(RuntimeError, "foo") do
+ # raise "foo" #Raises RuntimeError with the message, so assertion succeeds
+ # end
+ def assert_raise_with_message(exception, expected, msg = nil)
+ case expected
+ when String
+ assert = :assert_equal
+ when Regexp
+ assert = :assert_match
+ else
+ raise TypeError, "Expected #{expected.inspect} to be a kind of String or Regexp, not #{expected.class}"
+ end
+
+ ex = assert_raise(exception, *msg) {yield}
+ msg = message(msg, "") {"Expected Exception(#{exception}) was raised, but the message doesn't match"}
+ __send__(assert, expected, ex.message, msg)
+ ex
+ end
+
+ # :call-seq:
# assert_nothing_raised( *args, &block )
#
#If any exceptions are given as arguments, the assertion will
@@ -117,7 +152,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 +162,33 @@ 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)
+ catch(tag) do
+ yield(tag)
+ assert(false, message(msg) {"Expected #{mu_pp(tag)} to have been thrown"})
+ end
end
# :call-seq:
@@ -250,7 +306,13 @@ EOT
#
# assert_respond_to("hello", :reverse) #Succeeds
# assert_respond_to("hello", :does_not_exist) #Fails
- def assert_respond_to obj, meth, msg = nil
+ def assert_respond_to obj, (meth, priv), msg = nil
+ if priv
+ msg = message(msg) {
+ "Expected #{mu_pp(obj)} (#{obj.class}) to respond to ##{meth}#{" privately" if priv}"
+ }
+ return assert obj.respond_to?(meth, priv), msg
+ end
#get rid of overcounting
super if !caller[0].rindex(MINI_DIR, 0) || !obj.respond_to?(meth)
end
@@ -266,8 +328,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) {
@@ -319,6 +381,16 @@ EOT
template &&= template.chomp
template.gsub(/\G((?:[^\\]|\\.)*?)(\\)?\?/) { $1 + ($2 ? "?" : mu_pp(arguments.shift)) }
end
+
+ def message(msg = nil, *args, &default) # :nodoc:
+ if Proc === msg
+ super(nil, *args) do
+ [msg.call, (default.call if default)].compact.reject(&:empty?).join(".\n")
+ end
+ else
+ super
+ end
+ end
end
end
end
diff --git a/lib/test/unit/parallel.rb b/lib/test/unit/parallel.rb
index bb95a54f78..c1ecf29263 100644
--- a/lib/test/unit/parallel.rb
+++ b/lib/test/unit/parallel.rb
@@ -2,30 +2,30 @@ require 'test/unit'
module Test
module Unit
- class Worker < Runner
+ class Worker < Runner # :nodoc:
class << self
undef autorun
end
- alias orig_run_suite _run_suite
+ alias orig_run_suite mini_run_suite
undef _run_suite
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)
- r = report.dup
+ def _run_suite(suite, type) # :nodoc:
+ @partial_report = []
orig_testout = MiniTest::Unit.output
i,o = IO.pipe
@@ -35,7 +35,7 @@ module Test
th = Thread.new do
begin
while buf = (self.verbose ? i.gets : i.read(5))
- @stdout.puts "p #{[buf].pack("m").gsub("\n","")}"
+ _report "p", buf
end
rescue IOError
rescue Errno::EPIPE
@@ -63,13 +63,14 @@ module Test
end
i.close
- result << (report - r)
+ result << @partial_report
+ @partial_report = nil
result << [@errors-e,@failures-f,@skips-s]
result << ($: - @old_loadpath)
result << suite.name
begin
- @stdout.puts "done #{[Marshal.dump(result)].pack("m").gsub("\n","")}"
+ _report "done", Marshal.dump(result)
rescue Errno::EPIPE; end
return result
ensure
@@ -80,7 +81,7 @@ module Test
i.close if i && !i.closed?
end
- def run(args = [])
+ def run(args = []) # :nodoc:
process_args args
@@stop_auto_run = true
@opts = @options.dup
@@ -88,17 +89,23 @@ module Test
@old_loadpath = []
begin
- @stdout = increment_io(STDOUT)
- @stdin = increment_io(STDIN)
+ begin
+ @stdout = increment_io(STDOUT)
+ @stdin = increment_io(STDIN)
+ rescue
+ exit 2
+ end
+ exit 2 unless @stdout && @stdin
+
@stdout.sync = true
- @stdout.puts "ready"
+ _report "ready!"
while buf = @stdin.gets
case buf.chomp
when /^loadpath (.+?)$/
@old_loadpath = $:.dup
$:.push(*Marshal.load($1.unpack("m")[0].force_encoding("ASCII-8BIT"))).uniq!
when /^run (.+?) (.+?)$/
- @stdout.puts "okay"
+ _report "okay"
@options = @opts.dup
suites = MiniTest::Unit::TestCase.test_suites
@@ -106,23 +113,23 @@ module Test
begin
require $1
rescue LoadError
- @stdout.puts "after #{[Marshal.dump([$1, $!])].pack("m").gsub("\n","")}"
- @stdout.puts "ready"
+ _report "after", Marshal.dump([$1, ProxyError.new($!)])
+ _report "ready"
next
end
_run_suites MiniTest::Unit::TestCase.test_suites-suites, $2.to_sym
if @need_exit
begin
- @stdout.puts "bye"
+ _report "bye"
rescue Errno::EPIPE; end
exit
else
- @stdout.puts "ready"
+ _report "ready"
end
when /^quit$/
begin
- @stdout.puts "bye"
+ _report "bye"
rescue Errno::EPIPE; end
exit
end
@@ -130,14 +137,27 @@ module Test
rescue Errno::EPIPE
rescue Exception => e
begin
- @stdout.puts "bye #{[Marshal.dump(e)].pack("m").gsub("\n","")}"
+ trace = e.backtrace
+ err = ["#{trace.shift}: #{e.message} (#{e.class})"] + trace.map{|t| t.prepend("\t") }
+
+ _report "bye", Marshal.dump(err.join("\n"))
rescue Errno::EPIPE;end
exit
ensure
- @stdin.close
- @stdout.close
+ @stdin.close if @stdin
+ @stdout.close if @stdout
end
end
+
+ def _report(res, *args) # :nodoc:
+ res = "#{res} #{args.pack("m0")}" unless args.empty?
+ @stdout.puts(res)
+ end
+
+ def puke(klass, meth, e) # :nodoc:
+ @partial_report << [klass.name, meth, e.is_a?(MiniTest::Assertion) ? e : ProxyError.new(e)]
+ super
+ end
end
end
end
@@ -145,7 +165,8 @@ 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
end
@@ -153,7 +174,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/test-unit.gemspec b/lib/test/unit/test-unit.gemspec
new file mode 100644
index 0000000000..6c7d22379d
--- /dev/null
+++ b/lib/test/unit/test-unit.gemspec
@@ -0,0 +1,14 @@
+# -*- ruby -*-
+
+Gem::Specification.new do |s|
+ s.name = "test-unit"
+ s.version = "#{RUBY_VERSION}.0"
+ s.homepage = "http://www.ruby-lang.org"
+ s.author = "Shota Fukumori"
+ s.email = "sorah@tubusu.net"
+ s.summary = "test/unit compatible API testing framework"
+ s.description =
+ "This library implements test/unit compatible API on minitest. " +
+ "The test/unit means that test/unit which was bundled with Ruby 1.8."
+ s.executables = ["testrb"]
+end
diff --git a/lib/test/unit/testcase.rb b/lib/test/unit/testcase.rb
index 02f0f97987..984f08dd32 100644
--- a/lib/test/unit/testcase.rb
+++ b/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?
@@ -20,6 +20,15 @@ module Test
def self.test_order
:sorted
end
+
+ def self.method_added(name)
+ return unless name.to_s.start_with?("test_")
+ @test_methods ||= {}
+ if @test_methods[name]
+ warn "test/unit warning: method #{ self }##{ name } is redefined"
+ end
+ @test_methods[name] = true
+ end
end
end
end
diff --git a/lib/thread.rb b/lib/thread.rb
deleted file mode 100644
index 58c4f6b9e6..0000000000
--- a/lib/thread.rb
+++ /dev/null
@@ -1,361 +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)
- begin
- # TODO: mutex should not be used
- @waiters_mutex.synchronize do
- @waiters.push(Thread.current)
- end
- mutex.sleep timeout
- ensure
- @waiters_mutex.synchronize do
- @waiters.delete(Thread.current)
- end
- end
- self
- end
-
- #
- # Wakes up the first thread in line waiting for this lock.
- #
- def signal
- begin
- t = @waiters_mutex.synchronize { @waiters.shift }
- t.run if t
- rescue ThreadError
- retry
- end
- self
- end
-
- #
- # Wakes up all threads waiting for this lock.
- #
- def broadcast
- # TODO: incomplete
- waiters0 = nil
- @waiters_mutex.synchronize do
- waiters0 = @waiters.dup
- @waiters.clear
- end
- for t in waiters0
- begin
- t.run
- rescue ThreadError
- 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 = []
- @waiting = []
- @que.taint # enable tainted communication
- @waiting.taint
- self.taint
- @mutex = Mutex.new
- end
-
- #
- # Pushes +obj+ to the queue.
- #
- def push(obj)
- @mutex.synchronize{
- @que.push obj
- begin
- t = @waiting.shift
- t.wakeup if t
- rescue ThreadError
- retry
- 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)
- @mutex.synchronize{
- while true
- if @que.empty?
- raise ThreadError, "queue empty" if non_block
- @waiting.push Thread.current
- @mutex.sleep
- else
- return @que.shift
- 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
- @waiting.size
- 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
- @queue_wait = []
- @queue_wait.taint # enable tainted comunication
- super()
- end
-
- #
- # Returns the maximum size of the queue.
- #
- def max
- @max
- end
-
- #
- # Sets the maximum size of the queue.
- #
- def max=(max)
- diff = nil
- @mutex.synchronize {
- if max <= @max
- @max = max
- else
- diff = max - @max
- @max = max
- end
- }
- if diff
- diff.times do
- begin
- t = @queue_wait.shift
- t.run if t
- rescue ThreadError
- retry
- 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)
- @mutex.synchronize{
- while true
- break if @que.length < @max
- @queue_wait.push Thread.current
- @mutex.sleep
- end
-
- @que.push obj
- begin
- t = @waiting.shift
- t.wakeup if t
- rescue ThreadError
- retry
- 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 {
- if @que.length < @max
- begin
- t = @queue_wait.shift
- t.wakeup if t
- rescue ThreadError
- retry
- 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
- @waiting.size + @queue_wait.size
- 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..f6bf314b4b 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
#
diff --git a/lib/time.rb b/lib/time.rb
index 1663af8e76..0b55480334 100644
--- a/lib/time.rb
+++ b/lib/time.rb
@@ -1,55 +1,98 @@
+require 'date'
+# = time.rb
#
-# == Introduction
+# When 'time' is required, Time is extended with additional methods for parsing
+# and converting Times.
#
-# This library extends the Time class:
-# * conversion between date string and time object.
-# * date-time defined by RFC 2822
-# * HTTP-date defined by RFC 2616
-# * dateTime defined by XML Schema Part 2: Datatypes (ISO 8601)
-# * various formats handled by Date._parse (string to time only)
+# == Features
#
-# == Design Issues
+# This library extends the Time class with the following conversions between
+# date strings and Time objects:
#
-# === Specialized interface
+# * date-time defined by {RFC 2822}[http://www.ietf.org/rfc/rfc2822.txt]
+# * HTTP-date defined by {RFC 2616}[http://www.ietf.org/rfc/rfc2616.txt]
+# * dateTime defined by XML Schema Part 2: Datatypes ({ISO
+# 8601}[http://www.iso.org/iso/date_and_time_format])
+# * various formats handled by Date._parse
+# * custom formats handled by Date._strptime
#
-# This library provides methods dedicated to special purposes:
-# * RFC 2822, RFC 2616 and XML Schema.
-# * They makes usual life easier.
+# == Examples
#
-# === Doesn't depend on strftime
+# All examples assume you have loaded Time with:
#
-# This library doesn't use +Time#strftime+. Especially #rfc2822 doesn't depend
-# on +strftime+ because:
+# require 'time'
#
-# * %a and %b are locale sensitive
+# All of these examples were done using the EST timezone which is GMT-5.
#
-# Since they are locale sensitive, they may be replaced to
-# invalid weekday/month name in some locales.
-# Since ruby-1.6 doesn't invoke setlocale by default,
-# the problem doesn't arise until some external library invokes setlocale.
-# Ruby/GTK is the example of such library.
+# === Converting to a String
#
-# * %z is not portable
+# t = Time.now
+# t.iso8601 # => "2011-10-05T22:26:12-04:00"
+# t.rfc2822 # => "Wed, 05 Oct 2011 22:26:12 -0400"
+# t.httpdate # => "Thu, 06 Oct 2011 02:26:12 GMT"
#
-# %z is required to generate zone in date-time of RFC 2822
-# but it is not portable.
+# === Time.parse
#
-# Note that +Time#strftime+ doesn't use +strftime()+ function in libc since Ruby 1.9.
-# This means +Time#strftime+ is locale-insensitive since Ruby 1.9.
-# The above statements are not valid now.
+# #parse takes a string representation of a Time and attempts to parse it
+# using a heuristic.
#
-
-require 'date'
-
+# Date.parse("2010-10-31") #=> 2010-10-31 00:00:00 -0500
+#
+# Any missing pieces of the date are inferred based on the current date.
+#
+# # assuming the current date is "2011-10-31"
+# Time.parse("12:00") #=> 2011-10-31 12:00:00 -0500
+#
+# We can change the date used to infer our missing elements by passing a second
+# object that responds to #mon, #day and #year, such as Date, Time or DateTime.
+# We can also use our own object.
+#
+# class MyDate
+# attr_reader :mon, :day, :year
+#
+# def initialize(mon, day, year)
+# @mon, @day, @year = mon, day, year
+# end
+# end
+#
+# d = Date.parse("2010-10-28")
+# t = Time.parse("2010-10-29")
+# dt = DateTime.parse("2010-10-30")
+# md = MyDate.new(10,31,2010)
#
-# Implements the extensions to the Time class that are described in the
-# documentation for the time.rb library.
+# Time.parse("12:00", d) #=> 2010-10-28 12:00:00 -0500
+# Time.parse("12:00", t) #=> 2010-10-29 12:00:00 -0500
+# Time.parse("12:00", dt) #=> 2010-10-30 12:00:00 -0500
+# Time.parse("12:00", md) #=> 2010-10-31 12:00:00 -0500
#
+# #parse also accepts an optional block. You can use this block to specify how
+# to handle the year component of the date. This is specifically designed for
+# handling two digit years. For example, if you wanted to treat all two digit
+# years prior to 70 as the year 2000+ you could write this:
+#
+# Time.parse("01-10-31") {|year| year + (year < 70 ? 2000 : 1900)}
+# #=> 2001-10-31 00:00:00 -0500
+# Time.parse("70-10-31") {|year| year + (year < 70 ? 2000 : 1900)}
+# #=> 1970-10-31 00:00:00 -0500
+#
+# === Time.strptime
+#
+# #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
+# describes the format of the string. For example:
+#
+# Time.strptime("2000-10-31", "%Y-%m-%d") #=> 2000-10-31 00:00:00 -0500
+
class Time
class << Time
- ZoneOffset = {
+ #
+ # A hash of timezones mapped to hour differences from UTC. The
+ # set of time zones corresponds to the ones specified by RFC 2822
+ # and ISO 8601.
+ #
+ ZoneOffset = { # :nodoc:
'UTC' => 0,
# ISO 8601
'Z' => 0,
@@ -66,6 +109,26 @@ class Time
'N' => -1, 'O' => -2, 'P' => -3, 'Q' => -4, 'R' => -5, 'S' => -6,
'T' => -7, 'U' => -8, 'V' => -9, 'W' => -10, 'X' => -11, 'Y' => -12,
}
+
+ #
+ # Return the number of seconds the specified time zone differs
+ # from UTC.
+ #
+ # Numeric time zones that include minutes, such as
+ # <code>-10:00</code> or <code>+1330</code> will work, as will
+ # simpler hour-only time zones like <code>-10</code> or
+ # <code>+13</code>.
+ #
+ # Textual time zones listed in ZoneOffset are also supported.
+ #
+ # If the time zone does not match any of the above, +zone_offset+
+ # will check if the local time zone (both with and without
+ # potential Daylight Saving \Time changes being in effect) matches
+ # +zone+. Specifying a value for +year+ will change the year used
+ # to find the local time zone.
+ #
+ # If +zone_offset+ is unable to determine the offset, nil will be
+ # returned.
def zone_offset(zone, year=self.now.year)
off = nil
zone = zone.upcase
@@ -86,7 +149,6 @@ class Time
def zone_utc?(zone)
# * +0000
# In RFC 2822, +0000 indicate a time zone at Universal Time.
- # Europe/London is "a time zone at Universal Time" in Winter.
# Europe/Lisbon is "a time zone at Universal Time" in Winter.
# Atlantic/Reykjavik is "a time zone at Universal Time".
# Africa/Dakar is "a time zone at Universal Time".
@@ -112,8 +174,8 @@ 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]
+ 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]
@@ -217,15 +279,15 @@ class Time
# 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 timezone is GMT:
+ # # your time zone is GMT:
# now = Time.parse("Thu Nov 29 14:33:20 GMT 2001")
# Time.parse("16:30", now) #=> 2001-11-29 16:30:00 +0900
# Time.parse("7/23", now) #=> 2001-07-23 00:00:00 +0900
# Time.parse("Aug 31", now) #=> 2001-08-31 00:00:00 +0900
# Time.parse("Aug 2000", now) #=> 2000-08-01 00:00:00 +0900
#
- # Since there are numerous conflicts among locally defined timezone
- # abbreviations all over the world, this method is not made to
+ # Since there are numerous conflicts among locally defined time zone
+ # abbreviations all over the world, this method is not intended to
# understand all of them. For example, the abbreviation "CST" is
# used variously as:
#
@@ -236,29 +298,27 @@ class Time
# +10:30 in Australia/Adelaide,
# etc.
#
- # Based on the fact, this method only understands the timezone
- # abbreviations described in RFC 822 and the system timezone, in the
+ # Based on this fact, this method only understands the time zone
+ # abbreviations described in RFC 822 and the system time zone, in the
# order named. (i.e. a definition in RFC 822 overrides the system
- # timezone definition.) The system timezone is taken from
+ # time zone definition.) The system time zone is taken from
# <tt>Time.local(year, 1, 1).zone</tt> and
# <tt>Time.local(year, 7, 1).zone</tt>.
- # If the extracted timezone abbreviation does not match any of them,
+ # If the extracted time zone abbreviation does not match any of them,
# it is ignored and the given time is regarded as a local time.
#
# ArgumentError is raised if Date._parse cannot extract information from
- # +date+ or Time class cannot represent specified date.
+ # +date+ or if the Time class cannot represent specified date.
#
- # This method can be used as fail-safe for other parsing methods as:
+ # This method can be used as a fail-safe for other parsing methods as:
#
# Time.rfc2822(date) rescue Time.parse(date)
# Time.httpdate(date) rescue Time.parse(date)
# Time.xmlschema(date) rescue Time.parse(date)
#
- # A failure for Time.parse should be checked, though.
+ # A failure of Time.parse should be checked, though.
#
- # time library should be required to use this method as follows.
- #
- # require 'time'
+ # You must require 'time' to use this method.
#
def parse(date, now=self.now)
comp = !block_given?
@@ -277,12 +337,67 @@ class Time
# If a block is given, the year described in +date+ is converted by the
# block. For example:
#
- # Time.strptime(...) {|y| y < 100 ? (y >= 69 ? y + 1900 : y + 2000) : y}
+ # Time.strptime(...) {|y| y < 100 ? (y >= 69 ? y + 1900 : y + 2000) : y}
+ #
+ # Below is a list of the formating options:
+ #
+ # %a :: The abbreviated weekday name ("Sun")
+ # %A :: The full weekday name ("Sunday")
+ # %b :: The abbreviated month name ("Jan")
+ # %B :: The full month name ("January")
+ # %c :: The preferred local date and time representation
+ # %C :: Century (20 in 2009)
+ # %d :: Day of the month (01..31)
+ # %D :: Date (%m/%d/%y)
+ # %e :: Day of the month, blank-padded ( 1..31)
+ # %F :: Equivalent to %Y-%m-%d (the ISO 8601 date format)
+ # %h :: Equivalent to %b
+ # %H :: Hour of the day, 24-hour clock (00..23)
+ # %I :: Hour of the day, 12-hour clock (01..12)
+ # %j :: Day of the year (001..366)
+ # %k :: hour, 24-hour clock, blank-padded ( 0..23)
+ # %l :: hour, 12-hour clock, blank-padded ( 0..12)
+ # %L :: Millisecond of the second (000..999)
+ # %m :: Month of the year (01..12)
+ # %M :: Minute of the hour (00..59)
+ # %n :: Newline (\n)
+ # %N :: Fractional seconds digits, default is 9 digits (nanosecond)
+ # %3N :: millisecond (3 digits)
+ # %6N :: microsecond (6 digits)
+ # %9N :: nanosecond (9 digits)
+ # %p :: Meridian indicator ("AM" or "PM")
+ # %P :: Meridian indicator ("am" or "pm")
+ # %r :: time, 12-hour (same as %I:%M:%S %p)
+ # %R :: time, 24-hour (%H:%M)
+ # %s :: Number of seconds since 1970-01-01 00:00:00 UTC.
+ # %S :: Second of the minute (00..60)
+ # %t :: Tab character (\t)
+ # %T :: time, 24-hour (%H:%M:%S)
+ # %u :: Day of the week as a decimal, Monday being 1. (1..7)
+ # %U :: Week number of the current year, starting with the first Sunday as
+ # the first day of the first week (00..53)
+ # %v :: VMS date (%e-%b-%Y)
+ # %V :: Week number of year according to ISO 8601 (01..53)
+ # %W :: Week number of the current year, starting with the first Monday
+ # as the first day of the first week (00..53)
+ # %w :: Day of the week (Sunday is 0, 0..6)
+ # %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
+ # %z :: Time zone as hour offset from UTC (e.g. +0900)
+ # %Z :: Time zone name
+ # %% :: Literal "%" character
+
def strptime(date, format, now=self.now)
d = Date._strptime(date, format)
raise ArgumentError, "invalid strptime format - `#{format}'" unless d
if seconds = d[:seconds]
- Time.at(seconds)
+ if offset = d[:offset]
+ Time.at(seconds).localtime(offset)
+ else
+ Time.at(seconds)
+ end
else
year = d[:year]
year = yield(year) if year && block_given?
@@ -290,7 +405,7 @@ class Time
end
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
}
@@ -301,13 +416,11 @@ class Time
# updated by RFC 1123.
#
# ArgumentError is raised if +date+ is not compliant with RFC 2822
- # or Time class cannot represent specified date.
+ # or if the Time class cannot represent specified date.
#
# See #rfc2822 for more information on this format.
#
- # time library should be required to use this method as follows.
- #
- # require 'time'
+ # You must require 'time' to use this method.
#
def rfc2822(date)
if /\A\s*
@@ -350,17 +463,15 @@ class Time
alias rfc822 rfc2822
#
- # Parses +date+ as HTTP-date defined by RFC 2616 and converts it to a Time
- # object.
+ # Parses +date+ as an HTTP-date defined by RFC 2616 and converts it to a
+ # Time object.
#
- # ArgumentError is raised if +date+ is not compliant with RFC 2616 or Time
- # class cannot represent specified date.
+ # ArgumentError is raised if +date+ is not compliant with RFC 2616 or if
+ # the Time class cannot represent specified date.
#
# See #httpdate for more information on this format.
#
- # time library should be required to use this method as follows.
- #
- # require 'time'
+ # You must require 'time' to use this method.
#
def httpdate(date)
if /\A\s*
@@ -400,18 +511,16 @@ class Time
end
#
- # Parses +date+ as dateTime defined by XML Schema and converts it to a Time
- # object. The format is restricted version of the format defined by ISO
- # 8601.
+ # Parses +date+ as a dateTime defined by the XML Schema and converts it to
+ # a Time object. The format is a restricted version of the format defined
+ # by ISO 8601.
#
- # ArgumentError is raised if +date+ is not compliant with the format or Time
- # class cannot represent specified date.
+ # ArgumentError is raised if +date+ is not compliant with the format or if
+ # the Time class cannot represent specified date.
#
# See #xmlschema for more information on this format.
#
- # time library should be required to use this method as follows.
- #
- # require 'time'
+ # You must require 'time' to use this method.
#
def xmlschema(date)
if /\A\s*
@@ -455,9 +564,7 @@ class Time
#
# If +self+ is a UTC time, -0000 is used as zone.
#
- # time library should be required to use this method as follows.
- #
- # require 'time'
+ # You must require 'time' to use this method.
#
def rfc2822
sprintf('%s, %02d %s %0*d %02d:%02d:%02d ',
@@ -474,25 +581,25 @@ 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'
]
#
- # Returns a string which represents the time as rfc1123-date of HTTP-date
+ # Returns a string which represents the time as RFC 1123 date of HTTP-date
# defined by RFC 2616:
#
# day-of-week, DD month-name CCYY hh:mm:ss GMT
#
# Note that the result is always UTC (GMT).
#
- # time library should be required to use this method as follows.
- #
- # require 'time'
+ # You must require 'time' to use this method.
#
def httpdate
t = dup.utc
@@ -503,7 +610,7 @@ class Time
end
#
- # Returns a string which represents the time as dateTime defined by XML
+ # Returns a string which represents the time as a dateTime defined by XML
# Schema:
#
# CCYY-MM-DDThh:mm:ssTZD
@@ -513,28 +620,18 @@ class Time
#
# If self is a UTC time, Z is used as TZD. [+-]hh:mm is used otherwise.
#
- # +fractional_seconds+ specifies a number of digits of fractional seconds.
- # Its default value is 0.
- #
- # time library should be required to use this method as follows.
+ # +fractional_digits+ specifies a number of digits to use for fractional
+ # seconds. Its default value is 0.
#
- # require 'time'
+ # You must require 'time' to use this method.
#
def xmlschema(fraction_digits=0)
- sprintf('%0*d-%02d-%02dT%02d:%02d:%02d',
- year < 0 ? 5 : 4, year, mon, day, hour, min, sec) +
- if fraction_digits <= 0
- ''
- else
- '.' + sprintf('%0*d', fraction_digits, (subsec * 10**fraction_digits).floor)
- end +
- if utc?
- 'Z'
- else
- off = utc_offset
- sign = off < 0 ? '-' : '+'
- sprintf('%s%02d:%02d', sign, *(off.abs / 60).divmod(60))
+ fraction_digits = fraction_digits.to_i
+ s = strftime("%FT%T")
+ if fraction_digits > 0
+ s << strftime(".%#{fraction_digits}N")
end
+ s << (utc? ? 'Z' : strftime("%:z"))
end
alias iso8601 xmlschema
end
diff --git a/lib/timeout.rb b/lib/timeout.rb
index 16a168d205..ad951d2ffa 100644
--- a/lib/timeout.rb
+++ b/lib/timeout.rb
@@ -26,6 +26,18 @@ module Timeout
class Error < RuntimeError
end
class ExitException < ::Exception # :nodoc:
+ attr_reader :klass, :thread
+
+ def initialize(*)
+ super
+ @thread = Thread.current
+ freeze
+ end
+
+ def exception(*)
+ throw(self, caller) if self.thread == Thread.current
+ self
+ end
end
# :stopdoc:
@@ -42,19 +54,20 @@ module Timeout
# +klass+:: Exception Class to raise if the block fails to terminate
# in +sec+ seconds. Omitting will use the default, Timeout::Error
#
- # The block will be executed on another thread and will be given one
- # argument: +sec+.
- #
# 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
+ bt = catch((klass||ExitException).new) do |exception|
begin
x = Thread.current
y = Thread.start {
@@ -63,28 +76,26 @@ module Timeout
rescue => e
x.raise e
else
- x.raise exception, "execution expired"
+ x.raise exception, message
end
}
return yield(sec)
+ rescue (klass||ExitException) => e
+ e.backtrace
ensure
if y
y.kill
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
- raise if klass # if exception class is specified, it
- # would be expected outside.
- raise Error, e.message, e.backtrace
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 d7f68272e8..2161768576 100644
--- a/lib/tmpdir.rb
+++ b/lib/tmpdir.rb
@@ -18,23 +18,28 @@ class Dir
# Returns the operating system's temporary file path.
def Dir::tmpdir
- tmp = '.'
if $SAFE > 0
tmp = @@systmpdir
else
- for dir in [ENV['TMPDIR'], ENV['TMP'], ENV['TEMP'], @@systmpdir, '/tmp']
- if dir and stat = File.stat(dir) and stat.directory? and stat.writable?
+ tmp = nil
+ for dir in [ENV['TMPDIR'], ENV['TMP'], ENV['TEMP'], @@systmpdir, '/tmp', '.']
+ next if !dir
+ dir = File.expand_path(dir)
+ if stat = File.stat(dir) and stat.directory? and stat.writable? and
+ (!stat.world_writable? or stat.sticky?)
tmp = dir
break
end rescue nil
end
- File.expand_path(tmp)
+ raise ArgumentError, "could not find a temporary directory" if !tmp
+ tmp
end
end
# Dir.mktmpdir creates a temporary directory.
#
# The directory is created with 0700 permission.
+ # 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>.
@@ -55,7 +60,7 @@ class Dir
# If a block is given,
# it is yielded with the path of the directory.
# The directory and its contents are removed
- # using FileUtils.remove_entry_secure before Dir.mktmpdir returns.
+ # using FileUtils.remove_entry before Dir.mktmpdir returns.
# The value of the block is returned.
#
# Dir.mktmpdir {|dir|
@@ -73,7 +78,7 @@ class Dir
# open("#{dir}/foo", "w") { ... }
# ensure
# # remove the directory.
- # FileUtils.remove_entry_secure dir
+ # FileUtils.remove_entry dir
# end
#
def Dir.mktmpdir(prefix_suffix=nil, *rest)
@@ -82,7 +87,11 @@ class Dir
begin
yield path
ensure
- FileUtils.remove_entry_secure path
+ stat = File.stat(File.dirname(path))
+ if stat.world_writable? and !stat.sticky?
+ raise ArgumentError, "parent directory is world writable but not sticky"
+ end
+ FileUtils.remove_entry path
end
else
path
@@ -129,7 +138,7 @@ class Dir
end
n = nil
begin
- path = File.expand_path(make_tmpname(basename, n), tmpdir)
+ path = File.join(tmpdir, make_tmpname(basename, n))
yield(path, n, *opts)
rescue Errno::EEXIST
n ||= 0
diff --git a/lib/tracer.rb b/lib/tracer.rb
index 4b2429508d..1d6b019bcf 100644
--- a/lib/tracer.rb
+++ b/lib/tracer.rb
@@ -1,14 +1,18 @@
+#--
+# $Release Version: 0.3$
+# $Revision: 1.12 $
+require "thread"
+
##
-# = Tracer
+# Outputs a source level execution trace of a Ruby program.
#
-# Tracer outputs a source level execution trace of a Ruby program. It does
-# this by registering an event handler with <code>Kernel#set_trace_func</code>
-# for processing incoming events. It also provides methods for filtering
-# unwanted trace output (see Tracer.add_filter, Tracer.on, and Tracer.off).
+# It does this by registering an event handler with Kernel#set_trace_func for
+# processing incoming events. It also provides methods for filtering unwanted
+# trace output (see Tracer.add_filter, Tracer.on, and Tracer.off).
#
# == Example
#
-# Consider the following ruby script
+# Consider the following Ruby script
#
# class A
# def square(a)
@@ -42,27 +46,19 @@
#
# Symbol table used for displaying incoming events:
#
-# <tt>}</tt>:: call a C-language routine
-# <tt>{</tt>:: return from a C-language routine
-# <tt>></tt>:: call a Ruby method
-# <tt>C</tt>:: start a class or module definition
-# <tt>E</tt>:: finish a class or module definition
-# <tt>-</tt>:: execute code on a new line
-# <tt>^</tt>:: raise an exception
-# <tt><</tt>:: return from a Ruby method
+# +}+:: call a C-language routine
+# +{+:: return from a C-language routine
+# +>+:: call a Ruby method
+# +C+:: start a class or module definition
+# +E+:: finish a class or module definition
+# +-+:: execute code on a new line
+# +^+:: raise an exception
+# +<+:: return from a Ruby method
#
# == Copyright
#
# by Keiju ISHITSUKA(keiju@ishitsuka.com)
#
-#--
-# $Release Version: 0.3$
-# $Revision: 1.12 $
-require "thread"
-
-#
-# tracer main class
-#
class Tracer
class << self
# display additional debug information (defaults to false)
@@ -159,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]
@@ -205,7 +193,7 @@ class Tracer
else
source = get_line(file, line)
end
- printf("%s:%d:%s:%s: %s",
+ stdout.printf("%s:%d:%s:%s: %s",
file,
line,
klass || '',
@@ -289,7 +277,7 @@ if $0 == __FILE__
require $0
else
# call Tracer.on only if required by -r command-line option
- count = caller.count {|bt| /\/rubygems\/custom_require.rb:/ !~ bt}
+ count = caller.count {|bt| %r%/rubygems/core_ext/kernel_require\.rb:% !~ bt}
if (defined?(Gem) and count == 0) or
(!defined?(Gem) and count <= 1)
Tracer.on
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 0a2e37277a..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
@@ -311,16 +319,17 @@ def httpd
[:Port, :MaxClients].each do |name|
opt = options[name] and (options[name] = Integer(opt)) rescue nil
end
- unless argv.empty?
- options[:DocumentRoot] = argv.shift
+ unless argv.size == 1
+ raise ArgumentError, "DocumentRoot is mandatory"
end
+ options[:DocumentRoot] = argv.shift
s = WEBrick::HTTPServer.new(options)
shut = proc {s.shutdown}
- Signal.trap("TERM", shut)
- Signal.trap("QUIT", shut) if Signal.list.has_key?("QUIT")
- if STDIN.tty?
- Signal.trap("HUP", shut) if Signal.list.has_key?("HUP")
- Signal.trap("INT", shut)
+ siglist = %w"TERM QUIT"
+ siglist.concat(%w"HUP INT") if STDIN.tty?
+ siglist &= Signal.list.keys
+ siglist.each do |sig|
+ Signal.trap(sig, shut)
end
s.start
end
@@ -334,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 288bbe191e..771be971a5 100644
--- a/lib/uri/common.rb
+++ b/lib/uri/common.rb
@@ -258,7 +258,7 @@ module URI
#
# see also URI::Parser.make_regexp
#
- def extract(str, schemes = nil, &block)
+ def extract(str, schemes = nil)
if block_given?
str.scan(make_regexp(schemes)) { yield $& }
nil
@@ -873,30 +873,33 @@ 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/forms.html#url-encoded-form-data
+ # http://www.w3.org/TR/html5/association-of-controls-and-forms.html#url-encoded-form-data
#
# See URI.decode_www_form_component, URI.encode_www_form
- def self.encode_www_form_component(str)
- 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
# Decode given +str+ of URL-encoded form data.
#
- # This decods + to SP.
+ # This decodes + to SP.
#
# 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.gsub(/\+|%\h\h/, TBLDECWWWCOMP_).force_encoding(enc)
+ str.b.gsub(/\+|%\h\h/, TBLDECWWWCOMP_).force_encoding(enc)
end
# Generate URL-encoded form data from given +enum+.
@@ -914,8 +917,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"
@@ -927,39 +929,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']]
@@ -969,17 +965,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 971684a545..0c5b13a1b7 100644
--- a/lib/uri/ftp.rb
+++ b/lib/uri/ftp.rb
@@ -45,16 +45,11 @@ module URI
# ';type='
TYPECODE_PREFIX = ';type='.freeze
- # alternate initialization
- # Creates a new URI::FTP object.
- #
- # Unlike build(), this method does not escape the path component as
- # required by RFC1738; instead it is treated as per RFC2396.
- #
- # Arguments are user, password, host, port, path, typecode,
- # and arg_check, in that order.
def self.new2(user, password, host, port, path,
- typecode = nil, arg_check = true)
+ typecode = nil, arg_check = true) # :nodoc:
+ # Do not use this method! Not tested. [Bug #7301]
+ # This methods remains just for compatibility,
+ # Keep it undocumented until the active maintainer is assigned.
typecode = nil if typecode.size == 0
if typecode && !TYPECODE.include?(typecode)
raise ArgumentError,
@@ -170,7 +165,7 @@ module URI
end
private :check_typecode
- # private setter for the typecode +v+
+ # Private setter for the typecode +v+
#
# see also URI::FTP.typecode=
#
@@ -239,11 +234,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 1056cfe3bc..b1195fdf0b 100644
--- a/lib/uri/generic.rb
+++ b/lib/uri/generic.rb
@@ -86,8 +86,8 @@ module URI
rescue InvalidComponentError
if args.kind_of?(Array)
return self.build(args.collect{|x|
- if x
- parser.escape(x)
+ if x.is_a?(String)
+ DEFAULT_PARSER.escape(x)
else
x
end
@@ -96,7 +96,7 @@ module URI
tmp = {}
args.each do |key, value|
tmp[key] = if value
- parser.escape(value)
+ DEFAULT_PARSER.escape(value)
else
value
end
@@ -121,7 +121,7 @@ module URI
def self.build(args)
if args.kind_of?(Array) &&
args.size == ::URI::Generic::COMPONENT.size
- tmp = args
+ tmp = args.dup
elsif args.kind_of?(Hash)
tmp = ::URI::Generic::COMPONENT.collect do |c|
if args.include?(c)
@@ -131,8 +131,9 @@ module URI
end
end
else
+ component = self.class.component rescue ::URI::Generic::COMPONENT
raise ArgumentError,
- "expected Array of or Hash of components of #{self.class} (#{self.class.component.join(', ')})"
+ "expected Array of or Hash of components of #{self.class} (#{component.join(', ')})"
end
tmp << nil
@@ -339,7 +340,7 @@ module URI
# see also URI::Generic.scheme=
#
def set_scheme(v)
- @scheme = v
+ @scheme = v ? v.downcase : v
end
protected :set_scheme
@@ -1595,5 +1596,80 @@ module URI
return oth, self
end
+
+ # returns a proxy URI.
+ # The proxy URI is obtained from environment variables such as http_proxy,
+ # ftp_proxy, no_proxy, etc.
+ # If there is no proper proxy, nil is returned.
+ #
+ # Note that capitalized variables (HTTP_PROXY, FTP_PROXY, NO_PROXY, etc.)
+ # are examined too.
+ #
+ # But http_proxy and HTTP_PROXY is treated specially under CGI environment.
+ # It's because HTTP_PROXY may be set by Proxy: header.
+ # So HTTP_PROXY is not used.
+ # http_proxy is not used too if the variable is case insensitive.
+ # CGI_HTTP_PROXY can be used instead.
+ def find_proxy
+ raise BadURIError, "relative URI: #{self}" if self.relative?
+ name = self.scheme.downcase + '_proxy'
+ proxy_uri = nil
+ if name == 'http_proxy' && ENV.include?('REQUEST_METHOD') # CGI?
+ # HTTP_PROXY conflicts with *_proxy for proxy settings and
+ # HTTP_* for header information in CGI.
+ # So it should be careful to use it.
+ pairs = ENV.reject {|k, v| /\Ahttp_proxy\z/i !~ k }
+ case pairs.length
+ when 0 # no proxy setting anyway.
+ proxy_uri = nil
+ when 1
+ k, _ = pairs.shift
+ if k == 'http_proxy' && ENV[k.upcase] == nil
+ # http_proxy is safe to use because ENV is case sensitive.
+ proxy_uri = ENV[name]
+ else
+ proxy_uri = nil
+ end
+ else # http_proxy is safe to use because ENV is case sensitive.
+ proxy_uri = ENV.to_hash[name]
+ end
+ if !proxy_uri
+ # Use CGI_HTTP_PROXY. cf. libwww-perl.
+ proxy_uri = ENV["CGI_#{name.upcase}"]
+ end
+ elsif name == 'http_proxy'
+ unless proxy_uri = ENV[name]
+ if proxy_uri = ENV[name.upcase]
+ warn 'The environment variable HTTP_PROXY is discouraged. Use http_proxy.'
+ end
+ end
+ else
+ proxy_uri = ENV[name] || ENV[name.upcase]
+ end
+
+ if proxy_uri.nil? || proxy_uri.empty?
+ return nil
+ end
+
+ if self.hostname
+ require 'socket'
+ begin
+ addr = IPSocket.getaddress(self.hostname)
+ return nil if /\A127\.|\A::1\z/ =~ addr
+ rescue SocketError
+ end
+ end
+
+ name = 'no_proxy'
+ if no_proxy = ENV[name] || ENV[name.upcase]
+ no_proxy.scan(/([^:,]*)(?::(\d+))?/) {|host, port|
+ if /(\A|\.)#{Regexp.quote host}\z/i =~ self.host &&
+ (!port || self.port == port.to_i)
+ return nil
+ end
+ }
+ end
+ URI.parse(proxy_uri)
+ end
end
end
diff --git a/lib/uri/http.rb b/lib/uri/http.rb
index 3b03405765..9877b1ee59 100644
--- a/lib/uri/http.rb
+++ b/lib/uri/http.rb
@@ -49,7 +49,7 @@ module URI
# Example:
#
# newuri = URI::HTTP.build({:host => 'www.example.com',
- # :path> => '/foo/bar'})
+ # :path => '/foo/bar'})
#
# newuri = URI::HTTP.build([nil, "www.example.com", nil, "/path",
# "query", 'fragment'])
diff --git a/lib/uri/mailto.rb b/lib/uri/mailto.rb
index 765528fb7f..079340cf58 100644
--- a/lib/uri/mailto.rb
+++ b/lib/uri/mailto.rb
@@ -103,7 +103,7 @@ module URI
if tmp[:headers].kind_of?(Array)
tmp[:opaque] << tmp[:headers].collect { |x|
if x.kind_of?(Array)
- x[0] + '=' + x[1..-1].to_s
+ x[0] + '=' + x[1..-1].join
else
x.to_s
end
diff --git a/lib/weakref.rb b/lib/weakref.rb
index ee5444a584..9a256e9c25 100644
--- a/lib/weakref.rb
+++ b/lib/weakref.rb
@@ -1,19 +1,66 @@
require "delegate"
-require 'thread'
# Weak Reference class that allows a referenced object to be
-# garbage-collected. A WeakRef may be used exactly like the object it
-# references.
+# garbage-collected.
+#
+# A WeakRef may be used exactly like the object it references.
#
# Usage:
#
-# foo = Object.new
-# foo = Object.new
+# foo = Object.new # create a new object instance
# p foo.to_s # original's class
-# foo = WeakRef.new(foo)
+# foo = WeakRef.new(foo) # reassign foo with WeakRef instance
# p foo.to_s # should be same class
-# ObjectSpace.garbage_collect
+# GC.start # start the garbage collector
# p foo.to_s # should raise exception (recycled)
+#
+# == Example
+#
+# 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.
+#
+# require 'weakref'
+#
+# class WeakHash < Hash
+# def []= key, obj
+# super WeakRef.new(key), WeakRef.new(obj)
+# end
+# end
+#
+# This is just a simple implementation, we've opened the Hash class and changed
+# 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 keys, otherwise you
+# will get an ArgumentError because WeakRef cannot create a finalizer for a
+# Symbol. Symbols are immutable and cannot be garbage collected.
+#
+# Let's see it in action:
+#
+# omg = "lol"
+# c = WeakHash.new
+# c['foo'] = "bar"
+# c['baz'] = Object.new
+# c['qux'] = omg
+# puts c.inspect
+# #=> {"foo"=>"bar", "baz"=>#<Object:0x007f4ddfc6cb48>, "qux"=>"lol"}
+#
+# # Now run the garbage collector
+# GC.start
+# c['foo'] #=> nil
+# c['baz'] #=> nil
+# c['qux'] #=> nil
+# omg #=> "lol"
+#
+# puts c.inspect
+# #=> WeakRef::RefError: Invalid Reference - probably recycled
+#
+# 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.
class WeakRef < Delegator
@@ -24,51 +71,27 @@ class WeakRef < Delegator
class RefError < StandardError
end
- @@id_map = {} # obj -> [ref,...]
- @@id_rev_map = {} # ref -> obj
- @@mutex = Mutex.new
- @@final = lambda {|id|
- @@mutex.synchronize {
- rids = @@id_map[id]
- if rids
- for rid in rids
- @@id_rev_map.delete(rid)
- end
- @@id_map.delete(id)
- end
- rid = @@id_rev_map[id]
- if rid
- @@id_rev_map.delete(id)
- @@id_map[rid].delete(id)
- @@id_map.delete(rid) if @@id_map[rid].empty?
- end
- }
- }
+ @@__map = ::ObjectSpace::WeakMap.new
##
# Creates a weak reference to +orig+
+ #
+ # Raises an ArgumentError if the given +orig+ is immutable, such as Symbol,
+ # Fixnum, or Float.
def initialize(orig)
- @__id = orig.object_id
- ObjectSpace.define_finalizer orig, @@final
- ObjectSpace.define_finalizer self, @@final
- @@mutex.synchronize {
- @@id_map[@__id] = [] unless @@id_map[@__id]
- }
- @@id_map[@__id].push self.object_id
- @@id_rev_map[self.object_id] = @__id
+ case orig
+ when true, false, nil
+ @delegate_sd_obj = orig
+ else
+ @@__map[self] = orig
+ end
super
end
def __getobj__ # :nodoc:
- unless @@id_rev_map[self.object_id] == @__id
- Kernel::raise RefError, "Invalid Reference - probably recycled", Kernel::caller(2)
- end
- begin
- ObjectSpace._id2ref(@__id)
- rescue RangeError
- Kernel::raise RefError, "Invalid Reference - probably recycled", Kernel::caller(2)
- end
+ @@__map[self] or defined?(@delegate_sd_obj) ? @delegate_sd_obj :
+ Kernel::raise(RefError, "Invalid Reference - probably recycled", Kernel::caller(2))
end
def __setobj__(obj) # :nodoc:
@@ -78,7 +101,7 @@ class WeakRef < Delegator
# Returns true if the referenced object is still alive.
def weakref_alive?
- @@id_rev_map[self.object_id] == @__id
+ @@__map.key?(self) or defined?(@delegate_sd_obj)
end
end
diff --git a/lib/webrick.rb b/lib/webrick.rb
index 842bda21ef..fd8522a6c5 100644
--- a/lib/webrick.rb
+++ b/lib/webrick.rb
@@ -6,9 +6,9 @@
# logging of both server operations and HTTP access. WEBrick supports both
# basic and digest authentication in addition to algorithms not in RFC 2617.
#
-# A WEBrick servers can be composed of multiple WEBrick servers or servlets to
+# 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
#
@@ -129,9 +129,8 @@
#
# trap 'INT' do proxy.shutdown end
#
-# Proxies may modifier the content of the response through the
-# +:ProxyContentHandler+ callback which will be invoked with the request and
-# respone after the remote content has been fetched.
+# See WEBrick::HTTPProxy for further details including modifying proxied
+# responses.
#
# == Basic and Digest authentication
#
diff --git a/lib/webrick/accesslog.rb b/lib/webrick/accesslog.rb
index 029b5a4902..0a3c380406 100644
--- a/lib/webrick/accesslog.rb
+++ b/lib/webrick/accesslog.rb
@@ -115,6 +115,10 @@ module WEBrick
params
end
+ ##
+ # Formats +params+ according to +format_string+ which is described in
+ # setup_params.
+
def format(format_string, params)
format_string.gsub(/\%(?:\{(.*?)\})?>?([a-zA-Z%])/){
param, spec = $1, $2
@@ -140,6 +144,9 @@ module WEBrick
}
end
+ ##
+ # Escapes control characters in +data+
+
def escape(data)
if data.tainted?
data.gsub(/[[:cntrl:]\\]+/) {$&.dump[1...-1]}.untaint
diff --git a/lib/webrick/cgi.rb b/lib/webrick/cgi.rb
index 806d050bc9..80f636edc3 100644
--- a/lib/webrick/cgi.rb
+++ b/lib/webrick/cgi.rb
@@ -13,10 +13,44 @@ require "webrick/config"
require "stringio"
module WEBrick
+
+ # A CGI library using WEBrick requests and responses.
+ #
+ # Example:
+ #
+ # class MyCGI < WEBrick::CGI
+ # def do_GET req, res
+ # res.body = 'it worked!'
+ # res.status = 200
+ # end
+ # end
+ #
+ # MyCGI.new.start
+
class CGI
+
+ # The CGI error exception class
+
CGIError = Class.new(StandardError)
- attr_reader :config, :logger
+ ##
+ # The CGI configuration. This is based on WEBrick::Config::HTTP
+
+ attr_reader :config
+
+ ##
+ # The CGI logger
+
+ attr_reader :logger
+
+ ##
+ # Creates a new CGI interface.
+ #
+ # The first argument in +args+ is a configuration hash which would update
+ # WEBrick::Config::HTTP.
+ #
+ # Any remaining arguments are stored in the <code>@options</code> instance
+ # variable for use by a subclass.
def initialize(*args)
if defined?(MOD_RUBY)
@@ -41,10 +75,17 @@ module WEBrick
@options = args
end
+ ##
+ # Reads +key+ from the configuration
+
def [](key)
@config[key]
end
+ ##
+ # Starts the CGI process with the given environment +env+ and standard
+ # input and output +stdin+ and +stdout+.
+
def start(env=ENV, stdin=$stdin, stdout=$stdout)
sock = WEBrick::CGI::Socket.new(@config, env, stdin, stdout)
req = HTTPRequest.new(@config)
@@ -108,6 +149,10 @@ module WEBrick
end
end
+ ##
+ # Services the request +req+ which will fill in the response +res+. See
+ # WEBrick::HTTPServlet::AbstractServlet#service for details.
+
def service(req, res)
method_name = "do_" + req.request_method.gsub(/-/, "_")
if respond_to?(method_name)
@@ -118,7 +163,10 @@ module WEBrick
end
end
- class Socket
+ ##
+ # Provides HTTP socket emulation from the CGI environment
+
+ class Socket # :nodoc:
include Enumerable
private
diff --git a/lib/webrick/config.rb b/lib/webrick/config.rb
index 8c6427020d..c347da4be6 100644
--- a/lib/webrick/config.rb
+++ b/lib/webrick/config.rb
@@ -16,7 +16,7 @@ require 'webrick/log'
module WEBrick
module Config
- LIBDIR = File::dirname(__FILE__)
+ LIBDIR = File::dirname(__FILE__) # :nodoc:
# for GenericServer
General = {
@@ -67,6 +67,30 @@ module WEBrick
:Escape8bitURI => false
)
+ ##
+ # Default configuration for WEBrick::HTTPServlet::FileHandler
+ #
+ # :AcceptableLanguages::
+ # Array of languages allowed for accept-language. There is no default
+ # :DirectoryCallback::
+ # Allows preprocessing of directory requests. There is no default
+ # callback.
+ # :FancyIndexing::
+ # If true, show an index for directories. The default is true.
+ # :FileCallback::
+ # Allows preprocessing of file requests. There is no default callback.
+ # :HandlerCallback::
+ # Allows preprocessing of requests. There is no default callback.
+ # :HandlerTable::
+ # Maps file suffixes to file handlers. DefaultFileHandler is used by
+ # default but any servlet can be used.
+ # :NondisclosureName::
+ # Do not show files matching this array of globs. .ht* and *~ are
+ # excluded by default.
+ # :UserDir::
+ # Directory inside ~user to serve content from for /~user requests.
+ # Only works if mounted on /. Disabled by default.
+
FileHandler = {
:NondisclosureName => [".ht*", "*~"],
:FancyIndexing => false,
@@ -78,6 +102,12 @@ module WEBrick
:AcceptableLanguages => [] # ["en", "ja", ... ]
}
+ ##
+ # Default configuration for WEBrick::HTTPAuth::BasicAuth
+ #
+ # :AutoReloadUserDB:: Reload the user database provided by :UserDB
+ # automatically?
+
BasicAuth = {
:AutoReloadUserDB => true,
}
diff --git a/lib/webrick/cookie.rb b/lib/webrick/cookie.rb
index 814e6645a3..d8df23133d 100644
--- a/lib/webrick/cookie.rb
+++ b/lib/webrick/cookie.rb
@@ -12,14 +12,56 @@ require 'time'
require 'webrick/httputils'
module WEBrick
+
+ ##
+ # Processes HTTP cookies
+
class Cookie
+ ##
+ # The cookie name
+
attr_reader :name
- attr_accessor :value, :version
- attr_accessor :domain, :path, :secure
- attr_accessor :comment, :max_age
+
+ ##
+ # The cookie value
+
+ attr_accessor :value
+
+ ##
+ # The cookie version
+
+ attr_accessor :version
+
+ ##
+ # The cookie domain
+ attr_accessor :domain
+
+ ##
+ # The cookie path
+
+ attr_accessor :path
+
+ ##
+ # Is this a secure cookie?
+
+ attr_accessor :secure
+
+ ##
+ # The cookie comment
+
+ attr_accessor :comment
+
+ ##
+ # The maximum age of the cookie
+
+ attr_accessor :max_age
+
#attr_accessor :comment_url, :discard, :port
+ ##
+ # Creates a new cookie with the given +name+ and +value+
+
def initialize(name, value)
@name = name
@value = value
@@ -29,14 +71,25 @@ module WEBrick
@expires = @comment_url = @discard = @port = nil
end
+ ##
+ # Sets the cookie expiration to the time +t+. The expiration time may be
+ # a false value to disable expiration or a Time or HTTP format time string
+ # to set the expiration date.
+
def expires=(t)
@expires = t && (t.is_a?(Time) ? t.httpdate : t.to_s)
end
+ ##
+ # Retrieves the expiration time as a Time
+
def expires
@expires && Time.parse(@expires)
end
+ ##
+ # The cookie string suitable for use in an HTTP header
+
def to_s
ret = ""
ret << @name << "=" << @value
@@ -50,8 +103,10 @@ module WEBrick
ret
end
- # Cookie::parse()
- # It parses Cookie field sent from the user agent.
+ ##
+ # Parses a Cookie field sent from the user-agent. Returns an array of
+ # cookies.
+
def self.parse(str)
if str
ret = []
@@ -76,6 +131,9 @@ module WEBrick
end
end
+ ##
+ # Parses the cookie in +str+
+
def self.parse_set_cookie(str)
cookie_elem = str.split(/;/)
first_elem = cookie_elem.shift
@@ -101,6 +159,9 @@ module WEBrick
return cookie
end
+ ##
+ # Parses the cookies in +str+
+
def self.parse_set_cookies(str)
return str.split(/,(?=[^;,]*=)|,$/).collect{|c|
parse_set_cookie(c)
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/authenticator.rb b/lib/webrick/httpauth/authenticator.rb
index 9b9beeceba..f6d4ab844f 100644
--- a/lib/webrick/httpauth/authenticator.rb
+++ b/lib/webrick/httpauth/authenticator.rb
@@ -16,10 +16,10 @@ module WEBrick
module Authenticator
- RequestField = "Authorization"
- ResponseField = "WWW-Authenticate"
- ResponseInfoField = "Authentication-Info"
- AuthException = HTTPStatus::Unauthorized
+ RequestField = "Authorization" # :nodoc:
+ ResponseField = "WWW-Authenticate" # :nodoc:
+ ResponseInfoField = "Authentication-Info" # :nodoc:
+ AuthException = HTTPStatus::Unauthorized # :nodoc:
##
# Method of authentication, must be overridden by the including class
@@ -43,6 +43,8 @@ module WEBrick
private
+ # :stopdoc:
+
##
# Initializes the authenticator from +config+
@@ -96,6 +98,8 @@ module WEBrick
log(:info, fmt, *args)
end
end
+
+ # :startdoc:
end
##
@@ -103,10 +107,10 @@ module WEBrick
# authentication schemes for proxies.
module ProxyAuthenticator
- RequestField = "Proxy-Authorization"
- ResponseField = "Proxy-Authenticate"
- InfoField = "Proxy-Authentication-Info"
- AuthException = HTTPStatus::ProxyAuthenticationRequired
+ RequestField = "Proxy-Authorization" # :nodoc:
+ ResponseField = "Proxy-Authenticate" # :nodoc:
+ InfoField = "Proxy-Authentication-Info" # :nodoc:
+ AuthException = HTTPStatus::ProxyAuthenticationRequired # :nodoc:
end
end
end
diff --git a/lib/webrick/httpauth/basicauth.rb b/lib/webrick/httpauth/basicauth.rb
index 4c51e53199..3ff20b56d2 100644
--- a/lib/webrick/httpauth/basicauth.rb
+++ b/lib/webrick/httpauth/basicauth.rb
@@ -34,7 +34,7 @@ module WEBrick
class BasicAuth
include Authenticator
- AuthScheme = "Basic"
+ AuthScheme = "Basic" # :nodoc:
##
# Used by UserDB to create a basic password entry
diff --git a/lib/webrick/httpauth/digestauth.rb b/lib/webrick/httpauth/digestauth.rb
index 4e47fe163f..78ad45b233 100644
--- a/lib/webrick/httpauth/digestauth.rb
+++ b/lib/webrick/httpauth/digestauth.rb
@@ -45,9 +45,22 @@ module WEBrick
class DigestAuth
include Authenticator
- AuthScheme = "Digest"
- OpaqueInfo = Struct.new(:time, :nonce, :nc)
- attr_reader :algorithm, :qop
+ AuthScheme = "Digest" # :nodoc:
+
+ ##
+ # Struct containing the opaque portion of the digest authentication
+
+ OpaqueInfo = Struct.new(:time, :nonce, :nc) # :nodoc:
+
+ ##
+ # Digest authentication algorithm
+
+ attr_reader :algorithm
+
+ ##
+ # Quality of protection. RFC 2617 defines "auth" and "auth-int"
+
+ attr_reader :qop
##
# Used by UserDB to create a digest password entry
@@ -142,6 +155,8 @@ module WEBrick
private
+ # :stopdoc:
+
MustParams = ['username','realm','nonce','uri','response']
MustParamsAuth = ['cnonce','nc']
@@ -375,6 +390,7 @@ module WEBrick
@h.hexdigest(args.join(":"))
end
+ # :startdoc:
end
##
@@ -384,7 +400,7 @@ module WEBrick
include ProxyAuthenticator
private
- def check_uri(req, auth_req)
+ def check_uri(req, auth_req) # :nodoc:
return true
end
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 33ce17b2d4..7c34d33df0 100644
--- a/lib/webrick/httpproxy.rb
+++ b/lib/webrick/httpproxy.rb
@@ -15,16 +15,17 @@ require "net/http"
Net::HTTP::version_1_2 if RUBY_VERSION < "1.7"
module WEBrick
- NullReader = Object.new
- class << NullReader
+
+ NullReader = Object.new # :nodoc:
+ class << NullReader # :nodoc:
def read(*args)
nil
end
alias gets read
end
- FakeProxyURI = Object.new
- class << FakeProxyURI
+ FakeProxyURI = Object.new # :nodoc:
+ class << FakeProxyURI # :nodoc:
def method_missing(meth, *args)
if %w(scheme host port path query userinfo).member?(meth.to_s)
return nil
@@ -33,8 +34,38 @@ module WEBrick
end
end
+ # :startdoc:
+
##
# An HTTP Proxy server which proxies GET, HEAD and POST requests.
+ #
+ # To create a simple proxy server:
+ #
+ # require 'webrick'
+ # require 'webrick/httpproxy'
+ #
+ # proxy = WEBrick::HTTPProxyServer.new Port: 8000
+ #
+ # trap 'INT' do proxy.shutdown end
+ # trap 'TERM' do proxy.shutdown end
+ #
+ # proxy.start
+ #
+ # See ::new for proxy-specific configuration items.
+ #
+ # == Modifying proxied responses
+ #
+ # To modify content the proxy server returns use the +:ProxyContentHandler+
+ # option:
+ #
+ # handler = proc do |req, res|
+ # if res['content-type'] == 'text/plain' then
+ # res.body << "\nThis content was proxied!\n"
+ # end
+ # end
+ #
+ # proxy =
+ # WEBrick::HTTPProxyServer.new Port: 8000, ProxyContentHandler: handler
class HTTPProxyServer < HTTPServer
@@ -46,7 +77,7 @@ module WEBrick
# request
# :ProxyVia:: Appended to the via header
# :ProxyURI:: The proxy server's URI
- # :ProxyContentHandler:: Called with a request and resopnse and allows
+ # :ProxyContentHandler:: Called with a request and response and allows
# modification of the response
# :ProxyTimeout:: Sets the proxy timeouts to 30 seconds for open and 60
# seconds for read operations
@@ -57,6 +88,7 @@ module WEBrick
@via = "#{c[:HTTPVersion]} #{c[:ServerName]}:#{c[:Port]}"
end
+ # :stopdoc:
def service(req, res)
if req.request_method == "CONNECT"
do_CONNECT(req, res)
@@ -154,7 +186,7 @@ module WEBrick
res.send_response(ua)
access_log(@config, req, res)
- # Should clear request-line not to send the sesponse twice.
+ # Should clear request-line not to send the response twice.
# see: HTTPServer#run
req.parse(NullReader) rescue nil
end
@@ -301,5 +333,7 @@ module WEBrick
set_via(res)
res.body = response.body
end
+
+ # :stopdoc:
end
end
diff --git a/lib/webrick/httprequest.rb b/lib/webrick/httprequest.rb
index 050b5ed45b..76420730b1 100644
--- a/lib/webrick/httprequest.rb
+++ b/lib/webrick/httprequest.rb
@@ -17,31 +17,137 @@ require 'webrick/cookie'
module WEBrick
##
- # An HTTP request.
+ # An HTTP request. This is consumed by service and do_* methods in
+ # WEBrick servlets
+
class HTTPRequest
- BODY_CONTAINABLE_METHODS = [ "POST", "PUT" ]
+ BODY_CONTAINABLE_METHODS = [ "POST", "PUT" ] # :nodoc:
# :section: Request line
+
+ ##
+ # The complete request line such as:
+ #
+ # GET / HTTP/1.1
+
attr_reader :request_line
- attr_reader :request_method, :unparsed_uri, :http_version
+
+ ##
+ # The request method, GET, POST, PUT, etc.
+
+ attr_reader :request_method
+
+ ##
+ # The unparsed URI of the request
+
+ attr_reader :unparsed_uri
+
+ ##
+ # The HTTP version of the request
+
+ attr_reader :http_version
# :section: Request-URI
- attr_reader :request_uri, :path
- attr_accessor :script_name, :path_info, :query_string
+
+ ##
+ # The parsed URI of the request
+
+ attr_reader :request_uri
+
+ ##
+ # The request path
+
+ attr_reader :path
+
+ ##
+ # The script name (CGI variable)
+
+ attr_accessor :script_name
+
+ ##
+ # The path info (CGI variable)
+
+ attr_accessor :path_info
+
+ ##
+ # The query from the URI of the request
+
+ attr_accessor :query_string
# :section: Header and entity body
- attr_reader :raw_header, :header, :cookies
- attr_reader :accept, :accept_charset
- attr_reader :accept_encoding, :accept_language
+
+ ##
+ # The raw header of the request
+
+ attr_reader :raw_header
+
+ ##
+ # The parsed header of the request
+
+ attr_reader :header
+
+ ##
+ # The parsed request cookies
+
+ attr_reader :cookies
+
+ ##
+ # The Accept header value
+
+ attr_reader :accept
+
+ ##
+ # The Accept-Charset header value
+
+ attr_reader :accept_charset
+
+ ##
+ # The Accept-Encoding header value
+
+ attr_reader :accept_encoding
+
+ ##
+ # The Accept-Language header value
+
+ attr_reader :accept_language
# :section:
+
+ ##
+ # The remote user (CGI variable)
+
attr_accessor :user
- attr_reader :addr, :peeraddr
+
+ ##
+ # The socket address of the server
+
+ attr_reader :addr
+
+ ##
+ # The socket address of the client
+
+ attr_reader :peeraddr
+
+ ##
+ # Hash of request attributes
+
attr_reader :attributes
+
+ ##
+ # Is this a keep-alive connection?
+
attr_reader :keep_alive
+
+ ##
+ # The local time this request was received
+
attr_reader :request_time
+ ##
+ # Creates a new HTTP request. WEBrick::Config::HTTP is the default
+ # configuration.
+
def initialize(config)
@config = config
@buffer_size = @config[:InputBufferSize]
@@ -78,6 +184,10 @@ module WEBrick
@forwarded_server = @forwarded_for = nil
end
+ ##
+ # Parses a request from +socket+. This is called internally by
+ # WEBrick::HTTPServer.
+
def parse(socket=nil)
@socket = socket
begin
@@ -126,16 +236,21 @@ module WEBrick
end
end
+ ##
# Generate HTTP/1.1 100 continue response if the client expects it,
# otherwise does nothing.
- def continue
+
+ def continue # :nodoc:
if self['expect'] == '100-continue' && @config[:HTTPVersion] >= "1.1"
@socket << "HTTP/#{@config[:HTTPVersion]} 100 continue#{CRLF}#{CRLF}"
@header.delete('expect')
end
end
- def body(&block)
+ ##
+ # Returns the request body.
+
+ def body(&block) # :yields: body_chunk
block ||= Proc.new{|chunk| @body << chunk }
read_body(@socket, block)
@body.empty? ? nil : @body
@@ -237,11 +352,14 @@ module WEBrick
ret
end
- def fixup()
+ ##
+ # Consumes any remaining body and updates keep-alive status
+
+ def fixup() # :nodoc:
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)
@@ -290,6 +408,8 @@ module WEBrick
private
+ # :stopdoc:
+
MAX_URI_LENGTH = 2083 # :nodoc:
def read_request_line(socket)
@@ -457,5 +577,7 @@ module WEBrick
@forwarded_for = addrs.first
end
end
+
+ # :startdoc:
end
end
diff --git a/lib/webrick/httpresponse.rb b/lib/webrick/httpresponse.rb
index 0d36c0747e..044b8dfcaf 100644
--- a/lib/webrick/httpresponse.rb
+++ b/lib/webrick/httpresponse.rb
@@ -16,25 +16,81 @@ require 'webrick/httpstatus'
module WEBrick
##
- # An HTTP response.
+ # An HTTP response. This is filled in by the service or do_* methods of a
+ # WEBrick HTTP Servlet.
class HTTPResponse
- attr_reader :http_version, :status, :header
+
+ ##
+ # HTTP Response version
+
+ attr_reader :http_version
+
+ ##
+ # Response status code (200)
+
+ attr_reader :status
+
+ ##
+ # Response header
+
+ attr_reader :header
+
+ ##
+ # Response cookies
+
attr_reader :cookies
+
+ ##
+ # Response reason phrase ("OK")
+
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
- attr_accessor :request_method, :request_uri, :request_http_version
+ ##
+ # Request method for this response
+
+ attr_accessor :request_method
+
+ ##
+ # Request URI for this response
+
+ attr_accessor :request_uri
+
+ ##
+ # Request HTTP version for this response
+
+ attr_accessor :request_http_version
+
+ ##
+ # Filename of the static file in this response. Only used by the
+ # FileHandler servlet.
+
attr_accessor :filename
+
+ ##
+ # Is this a keep-alive response?
+
attr_accessor :keep_alive
- attr_reader :config, :sent_size
##
- # Creates a new HTTP response object
+ # Configuration for this response
+
+ attr_reader :config
+
+ ##
+ # Bytes sent in this response
+
+ attr_reader :sent_size
+
+ ##
+ # Creates a new HTTP response object. WEBrick::Config::HTTP is the
+ # default configuration.
def initialize(config)
@config = config
@@ -145,7 +201,7 @@ module WEBrick
##
# Sends the response on +socket+
- def send_response(socket)
+ def send_response(socket) # :nodoc:
begin
setup_header()
send_header(socket)
@@ -162,7 +218,7 @@ module WEBrick
##
# Sets up the headers for sending
- def setup_header()
+ def setup_header() # :nodoc:
@reason_phrase ||= HTTPStatus::reason_phrase(@status)
@header['server'] ||= @config[:ServerSoftware]
@header['date'] ||= Time.now.httpdate
@@ -202,7 +258,7 @@ module WEBrick
if @header['connection'] == "close"
@keep_alive = false
elsif keep_alive?
- if chunked? || @header['content-length']
+ if chunked? || @header['content-length'] || @status == 304 || @status == 204 || HTTPStatus.info?(@status)
@header['connection'] = "Keep-Alive"
else
msg = "Could not determine content-length of response body. Set content-length of the response or set Response#chunked = true"
@@ -225,7 +281,7 @@ module WEBrick
##
# Sends the headers on +socket+
- def send_header(socket)
+ def send_header(socket) # :nodoc:
if @http_version.major > 0
data = status_line()
@header.each{|key, value|
@@ -243,10 +299,11 @@ module WEBrick
##
# Sends the body on +socket+
- def send_body(socket)
- case @body
- when IO then send_body_io(socket)
- else send_body_string(socket)
+ def send_body(socket) # :nodoc:
+ if @body.respond_to? :readpartial then
+ send_body_io(socket)
+ else
+ send_body_string(socket)
end
end
@@ -325,18 +382,25 @@ module WEBrick
private
+ # :stopdoc:
+
def send_body_io(socket)
begin
if @request_method == "HEAD"
# do nothing
elsif chunked?
- while buf = @body.read(@buffer_size)
- next if buf.empty?
- data = ""
- data << format("%x", buf.bytesize) << CRLF
- data << buf << CRLF
- _write_data(socket, data)
- @sent_size += buf.bytesize
+ begin
+ buf = ''
+ data = ''
+ while true
+ @body.readpartial( @buffer_size, buf ) # there is no need to clear buf?
+ data << format("%x", buf.bytesize) << CRLF
+ data << buf << CRLF
+ _write_data(socket, data)
+ data.clear
+ @sent_size += buf.bytesize
+ end
+ rescue EOFError # do nothing
end
_write_data(socket, "0#{CRLF}#{CRLF}")
else
@@ -395,5 +459,8 @@ module WEBrick
def _write_data(socket, data)
socket << data
end
+
+ # :startdoc:
end
+
end
diff --git a/lib/webrick/https.rb b/lib/webrick/https.rb
index abb428451f..9194f9411c 100644
--- a/lib/webrick/https.rb
+++ b/lib/webrick/https.rb
@@ -15,8 +15,28 @@ module WEBrick
HTTP.update(SSL)
end
+ ##
+ #--
+ # Adds SSL functionality to WEBrick::HTTPRequest
+
class HTTPRequest
- attr_reader :cipher, :server_cert, :client_cert
+
+ ##
+ # HTTP request SSL cipher
+
+ attr_reader :cipher
+
+ ##
+ # HTTP request server certificate
+
+ attr_reader :server_cert
+
+ ##
+ # HTTP request client certificate
+
+ attr_reader :client_cert
+
+ # :stopdoc:
alias orig_parse parse
@@ -60,5 +80,7 @@ module WEBrick
end
meta
end
+
+ # :startdoc:
end
end
diff --git a/lib/webrick/httpserver.rb b/lib/webrick/httpserver.rb
index ddf1ac7404..7a7b931dad 100644
--- a/lib/webrick/httpserver.rb
+++ b/lib/webrick/httpserver.rb
@@ -138,6 +138,10 @@ module WEBrick
si.service(req, res)
end
+ ##
+ # The default OPTIONS request handler says GET, HEAD, POST and OPTIONS
+ # requests are allowed.
+
def do_OPTIONS(req, res)
res["allow"] = "GET,HEAD,POST,OPTIONS"
end
@@ -207,6 +211,10 @@ module WEBrick
}
end
+ ##
+ # Logs +req+ and +res+ in the access logs. +config+ is used for the
+ # server name.
+
def access_log(config, req, res)
param = AccessLog::setup_params(config, req, res)
@config[:AccessLog].each{|logger, fmt|
@@ -214,7 +222,13 @@ module WEBrick
}
end
- class MountTable
+ ##
+ # Mount table for the path a servlet is mounted on in the directory space
+ # of the server. Users of WEBrick can only access this indirectly via
+ # WEBrick::HTTPServer#mount, WEBrick::HTTPServer#unmount and
+ # WEBrick::HTTPServer#search_servlet
+
+ class MountTable # :nodoc:
def initialize
@tab = Hash.new
compile
diff --git a/lib/webrick/httpservlet/abstract.rb b/lib/webrick/httpservlet/abstract.rb
index 0d5c5ae48d..d3b00ab4e1 100644
--- a/lib/webrick/httpservlet/abstract.rb
+++ b/lib/webrick/httpservlet/abstract.rb
@@ -54,7 +54,7 @@ module WEBrick
# Servlets can be configured via initialize. The first argument is the
# HTTP server the servlet is being initialized for.
#
- # class Configureable < Simple
+ # class Configurable < Simple
# def initialize server, color, size
# super server
# @color = color
diff --git a/lib/webrick/httpservlet/cgihandler.rb b/lib/webrick/httpservlet/cgihandler.rb
index 1976ae6948..7c012ca64b 100644
--- a/lib/webrick/httpservlet/cgihandler.rb
+++ b/lib/webrick/httpservlet/cgihandler.rb
@@ -16,9 +16,20 @@ require 'webrick/httpservlet/abstract'
module WEBrick
module HTTPServlet
+ ##
+ # Servlet for handling CGI scripts
+ #
+ # Example:
+ #
+ # server.mount('/cgi/my_script', WEBrick::HTTPServlet::CGIHandler,
+ # '/path/to/my_script')
+
class CGIHandler < AbstractServlet
- Ruby = RbConfig.ruby
- CGIRunner = "\"#{Ruby}\" \"#{WEBrick::Config::LIBDIR}/httpservlet/cgi_runner.rb\""
+ Ruby = RbConfig.ruby # :nodoc:
+ CGIRunner = "\"#{Ruby}\" \"#{WEBrick::Config::LIBDIR}/httpservlet/cgi_runner.rb\"" # :nodoc:
+
+ ##
+ # Creates a new CGI script servlet for the script at +name+
def initialize(server, name)
super(server, name)
@@ -27,6 +38,8 @@ module WEBrick
@cgicmd = "#{CGIRunner} #{server[:CGIInterpreter]}"
end
+ # :stopdoc:
+
def do_GET(req, res)
data = nil
status = -1
@@ -102,6 +115,8 @@ module WEBrick
res.body = body
end
alias do_POST do_GET
+
+ # :startdoc:
end
end
diff --git a/lib/webrick/httpservlet/filehandler.rb b/lib/webrick/httpservlet/filehandler.rb
index 8736f5773a..467b64f0c3 100644
--- a/lib/webrick/httpservlet/filehandler.rb
+++ b/lib/webrick/httpservlet/filehandler.rb
@@ -18,12 +18,29 @@ require 'webrick/httpstatus'
module WEBrick
module HTTPServlet
+ ##
+ # Servlet for serving a single file. You probably want to use the
+ # FileHandler servlet instead as it handles directories and fancy indexes.
+ #
+ # Example:
+ #
+ # server.mount('/my_page.txt', WEBrick::HTTPServlet::DefaultFileHandler,
+ # '/path/to/my_page.txt')
+ #
+ # This servlet handles If-Modified-Since and Range requests.
+
class DefaultFileHandler < AbstractServlet
+
+ ##
+ # Creates a DefaultFileHandler instance for the file at +local_path+.
+
def initialize(server, local_path)
super(server, local_path)
@local_path = local_path
end
+ # :stopdoc:
+
def do_GET(req, res)
st = File::stat(@local_path)
mtime = st.mtime
@@ -123,13 +140,20 @@ module WEBrick
last = filesize - 1 if last >= filesize
return first, last
end
+
+ # :startdoc:
end
##
- # Serves files from a directory
+ # Serves a directory including fancy indexing and a variety of other
+ # options.
+ #
+ # Example:
+ #
+ # server.mount '/assets', WEBrick::FileHandler, '/path/to/assets'
class FileHandler < AbstractServlet
- HandlerTable = Hash.new
+ HandlerTable = Hash.new # :nodoc:
##
# Allow custom handling of requests for files with +suffix+ by class
@@ -150,19 +174,8 @@ module WEBrick
# Creates a FileHandler servlet on +server+ that serves files starting
# at directory +root+
#
- # If +options+ is a Hash the following keys are allowed:
- #
- # :AcceptableLanguages:: Array of languages allowed for accept-language
- # :DirectoryCallback:: Allows preprocessing of directory requests
- # :FancyIndexing:: If true, show an index for directories
- # :FileCallback:: Allows preprocessing of file requests
- # :HandlerCallback:: Allows preprocessing of requests
- # :HandlerTable:: Maps file suffixes to file handlers.
- # DefaultFileHandler is used by default but any servlet
- # can be used.
- # :NondisclosureName:: Do not show files matching this array of globs
- # :UserDir:: Directory inside ~user to serve content from for /~user
- # requests. Only works if mounted on /
+ # +options+ may be a Hash containing keys from
+ # WEBrick::Config::FileHandler or +true+ or +false+.
#
# If +options+ is true or false then +:FancyIndexing+ is enabled or
# disabled respectively.
@@ -177,6 +190,8 @@ module WEBrick
@options = default.dup.update(options)
end
+ # :stopdoc:
+
def service(req, res)
# if this class is mounted on "/" and /~username is requested.
# we're going to override path informations before invoking service.
@@ -409,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"
@@ -422,38 +444,65 @@ 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"
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)}\">#{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>
@@ -465,6 +514,7 @@ module WEBrick
_end_of_html_
end
+ # :startdoc:
end
end
end
diff --git a/lib/webrick/httpservlet/prochandler.rb b/lib/webrick/httpservlet/prochandler.rb
index 2be3c854c1..2f5aa66f45 100644
--- a/lib/webrick/httpservlet/prochandler.rb
+++ b/lib/webrick/httpservlet/prochandler.rb
@@ -13,7 +13,19 @@ require 'webrick/httpservlet/abstract.rb'
module WEBrick
module HTTPServlet
+ ##
+ # Mounts a proc at a path that accepts a request and response.
+ #
+ # Instead of mounting this servlet with WEBrick::HTTPServer#mount use
+ # WEBrick::HTTPServer#mount_proc:
+ #
+ # server.mount_proc '/' do |req, res|
+ # res.body = 'it worked!'
+ # res.status = 200
+ # end
+
class ProcHandler < AbstractServlet
+ # :stopdoc:
def get_instance(server, *options)
self
end
@@ -27,6 +39,7 @@ module WEBrick
end
alias do_POST do_GET
+ # :startdoc:
end
end
diff --git a/lib/webrick/httpstatus.rb b/lib/webrick/httpstatus.rb
index 9eee38a40f..afc8e75a47 100644
--- a/lib/webrick/httpstatus.rb
+++ b/lib/webrick/httpstatus.rb
@@ -27,13 +27,13 @@ module WEBrick
class << self
attr_reader :code, :reason_phrase # :nodoc:
end
-
+
# Returns the HTTP status code
def code() self::class::code end
-
+
# Returns the HTTP status description
def reason_phrase() self::class::reason_phrase end
-
+
alias to_i code # :nodoc:
end
@@ -63,6 +63,7 @@ module WEBrick
204 => 'No Content',
205 => 'Reset Content',
206 => 'Partial Content',
+ 207 => 'Multi-Status',
300 => 'Multiple Choices',
301 => 'Moved Permanently',
302 => 'Found',
@@ -88,12 +89,21 @@ module WEBrick
415 => 'Unsupported Media Type',
416 => 'Request Range Not Satisfiable',
417 => 'Expectation Failed',
+ 422 => 'Unprocessable Entity',
+ 423 => 'Locked',
+ 424 => 'Failed Dependency',
+ 426 => 'Upgrade Required',
+ 428 => 'Precondition Required',
+ 429 => 'Too Many Requests',
+ 431 => 'Request Header Fields Too Large',
500 => 'Internal Server Error',
501 => 'Not Implemented',
502 => 'Bad Gateway',
503 => 'Service Unavailable',
504 => 'Gateway Timeout',
- 505 => 'HTTP Version Not Supported'
+ 505 => 'HTTP Version Not Supported',
+ 507 => 'Insufficient Storage',
+ 511 => 'Network Authentication Required',
}
# Maps a status code to the corresponding Status class
@@ -136,31 +146,31 @@ module WEBrick
def info?(code)
code.to_i >= 100 and code.to_i < 200
end
-
+
##
# Is +code+ a successful status?
def success?(code)
code.to_i >= 200 and code.to_i < 300
end
-
+
##
# Is +code+ a redirection status?
def redirect?(code)
code.to_i >= 300 and code.to_i < 400
end
-
+
##
# Is +code+ an error status?
def error?(code)
code.to_i >= 400 and code.to_i < 600
end
-
+
##
# Is +code+ a client error status?
def client_error?(code)
code.to_i >= 400 and code.to_i < 500
end
-
+
##
# Is +code+ a server error status?
def server_error?(code)
diff --git a/lib/webrick/httputils.rb b/lib/webrick/httputils.rb
index f029dacb56..a5f0632b86 100644
--- a/lib/webrick/httputils.rb
+++ b/lib/webrick/httputils.rb
@@ -12,12 +12,21 @@ require 'socket'
require 'tempfile'
module WEBrick
- CR = "\x0d"
- LF = "\x0a"
- CRLF = "\x0d\x0a"
+ CR = "\x0d" # :nodoc:
+ LF = "\x0a" # :nodoc:
+ CRLF = "\x0d\x0a" # :nodoc:
+
+ ##
+ # HTTPUtils provides utility methods for working with the HTTP protocol.
+ #
+ # This module is generally used internally by WEBrick
module HTTPUtils
+ ##
+ # Normalizes a request path. Raises an exception if the path cannot be
+ # normalized.
+
def normalize_path(path)
raise "abnormal path `#{path}'" if path[0] != ?/
ret = path.dup
@@ -31,7 +40,8 @@ module WEBrick
end
module_function :normalize_path
- #####
+ ##
+ # Default mime types
DefaultMimeTypes = {
"ai" => "application/postscript",
@@ -57,6 +67,7 @@ module WEBrick
"jpe" => "image/jpeg",
"jpeg" => "image/jpeg",
"jpg" => "image/jpeg",
+ "js" => "application/javascript",
"lha" => "application/octet-stream",
"lzh" => "application/octet-stream",
"mov" => "video/quicktime",
@@ -78,6 +89,7 @@ module WEBrick
"rtf" => "application/rtf",
"sgm" => "text/sgml",
"sgml" => "text/sgml",
+ "svg" => "image/svg+xml",
"tif" => "image/tiff",
"tiff" => "image/tiff",
"txt" => "text/plain",
@@ -90,7 +102,9 @@ module WEBrick
"zip" => "application/zip",
}
- # Load Apache compatible mime.types file.
+ ##
+ # Loads Apache-compatible mime.types in +file+.
+
def load_mime_types(file)
open(file){ |io|
hash = Hash.new
@@ -107,6 +121,10 @@ module WEBrick
end
module_function :load_mime_types
+ ##
+ # Returns the mime type of +filename+ from the list in +mime_tab+. If no
+ # mime type was found application/octet-stream is returned.
+
def mime_type(filename, mime_tab)
suffix1 = (/\.(\w+)$/ =~ filename && $1.downcase)
suffix2 = (/\.(\w+)\.[\w\-]+$/ =~ filename && $1.downcase)
@@ -114,7 +132,9 @@ module WEBrick
end
module_function :mime_type
- #####
+ ##
+ # Parses an HTTP header +raw+ into a hash of header fields with an Array
+ # of values.
def parse_header(raw)
header = Hash.new([].freeze)
@@ -146,12 +166,18 @@ module WEBrick
end
module_function :parse_header
+ ##
+ # Splits a header value +str+ according to HTTP specification.
+
def split_header_value(str)
str.scan(%r'\G((?:"(?:\\.|[^"])+?"|[^",]+)+)
(?:,\s*|\Z)'xn).flatten
end
module_function :split_header_value
+ ##
+ # Parses a Range header value +ranges_specifier+
+
def parse_range_header(ranges_specifier)
if /^bytes=(.*)/ =~ ranges_specifier
byte_range_set = split_header_value($1)
@@ -167,6 +193,9 @@ module WEBrick
end
module_function :parse_range_header
+ ##
+ # Parses q values in +value+ as used in Accept headers.
+
def parse_qvalues(value)
tmp = []
if value
@@ -185,7 +214,8 @@ module WEBrick
end
module_function :parse_qvalues
- #####
+ ##
+ # Removes quotes and escapes from +str+
def dequote(str)
ret = (/\A"(.*)"\Z/ =~ str) ? $1 : str.dup
@@ -194,20 +224,43 @@ module WEBrick
end
module_function :dequote
+ ##
+ # Quotes and escapes quotes in +str+
+
def quote(str)
'"' << str.gsub(/[\\\"]/o, "\\\1") << '"'
end
module_function :quote
- #####
+ ##
+ # Stores multipart form data. FormData objects are created when
+ # WEBrick::HTTPUtils.parse_form_data is called.
class FormData < String
- EmptyRawHeader = [].freeze
- EmptyHeader = {}.freeze
+ EmptyRawHeader = [].freeze # :nodoc:
+ EmptyHeader = {}.freeze # :nodoc:
+
+ ##
+ # The name of the form data part
+
+ attr_accessor :name
- attr_accessor :name, :filename, :next_data
+ ##
+ # The filename of the form data part
+
+ attr_accessor :filename
+
+ attr_accessor :next_data # :nodoc:
protected :next_data
+ ##
+ # Creates a new FormData object.
+ #
+ # +args+ is an Array of form data entries. One FormData will be created
+ # for each entry.
+ #
+ # This is called by WEBrick::HTTPUtils.parse_form_data for you
+
def initialize(*args)
@name = @filename = @next_data = nil
if args.empty?
@@ -224,6 +277,9 @@ module WEBrick
end
end
+ ##
+ # Retrieves the header at the first entry in +key+
+
def [](*key)
begin
@header[key[0].downcase].join(", ")
@@ -232,6 +288,12 @@ module WEBrick
end
end
+ ##
+ # Adds +str+ to this FormData which may be the body, a header or a
+ # header entry.
+ #
+ # This is called by WEBrick::HTTPUtils.parse_form_data for you
+
def <<(str)
if @header
super
@@ -247,6 +309,11 @@ module WEBrick
self
end
+ ##
+ # Adds +data+ at the end of the chain of entries
+ #
+ # This is called by WEBrick::HTTPUtils.parse_form_data for you.
+
def append_data(data)
tmp = self
while tmp
@@ -259,6 +326,9 @@ module WEBrick
self
end
+ ##
+ # Yields each entry in this FormData
+
def each_data
tmp = self
while tmp
@@ -268,6 +338,9 @@ module WEBrick
end
end
+ ##
+ # Returns all the FormData as an Array
+
def list
ret = []
each_data{|data|
@@ -276,13 +349,22 @@ module WEBrick
ret
end
+ ##
+ # A FormData will behave like an Array
+
alias :to_ary :list
+ ##
+ # This FormData's body
+
def to_s
String.new(self)
end
end
+ ##
+ # Parses the query component of a URI in +str+
+
def parse_query(str)
query = Hash.new
if str
@@ -304,6 +386,9 @@ module WEBrick
end
module_function :parse_query
+ ##
+ # Parses form data in +io+ with the given +boundary+
+
def parse_form_data(io, boundary)
boundary_regexp = /\A--#{Regexp.quote(boundary)}(--)?#{CRLF}\z/
form_data = Hash.new
@@ -348,10 +433,22 @@ module WEBrick
module_function
+ # :stopdoc:
+
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)
@@ -359,24 +456,41 @@ module WEBrick
ESCAPED = /%([0-9a-fA-F]{2})/
UNESCAPED_PCHAR = _make_regex!(unreserved+":@&=+$,")
+ # :startdoc:
+
+ ##
+ # Escapes HTTP reserved and unwise characters in +str+
+
def escape(str)
_escape(str, UNESCAPED)
end
+ ##
+ # Unescapes HTTP reserved and unwise characters in +str+
+
def unescape(str)
_unescape(str, ESCAPED)
end
+ ##
+ # Escapes form reserved characters in +str+
+
def escape_form(str)
ret = _escape(str, UNESCAPED_FORM)
ret.gsub!(/ /, "+")
ret
end
+ ##
+ # Unescapes form reserved characters in +str+
+
def unescape_form(str)
_unescape(str.gsub(/\+/, " "), ESCAPED)
end
+ ##
+ # Escapes path +str+
+
def escape_path(str)
result = ""
str.scan(%r{/([^/]*)}).each{|i|
@@ -385,6 +499,9 @@ module WEBrick
return result
end
+ ##
+ # Escapes 8 bit characters in +str+
+
def escape8bit(str)
_escape(str, NONASCII)
end
diff --git a/lib/webrick/httpversion.rb b/lib/webrick/httpversion.rb
index 5cf0ee400d..cdfb957296 100644
--- a/lib/webrick/httpversion.rb
+++ b/lib/webrick/httpversion.rb
@@ -8,15 +8,33 @@
# $IPR: httpversion.rb,v 1.5 2002/09/21 12:23:37 gotoyuzo Exp $
module WEBrick
+
+ ##
+ # Represents an HTTP protocol version
+
class HTTPVersion
include Comparable
- attr_accessor :major, :minor
+ ##
+ # The major protocol version number
+
+ attr_accessor :major
+
+ ##
+ # The minor protocol version number
+
+ attr_accessor :minor
+
+ ##
+ # Converts +version+ into an HTTPVersion
def self.convert(version)
version.is_a?(self) ? version : new(version)
end
+ ##
+ # Creates a new HTTPVersion from +version+.
+
def initialize(version)
case version
when HTTPVersion
@@ -32,6 +50,10 @@ module WEBrick
end
end
+ ##
+ # Compares this version with +other+ according to the HTTP specification
+ # rules.
+
def <=>(other)
unless other.is_a?(self.class)
other = self.class.new(other)
@@ -42,6 +64,10 @@ module WEBrick
return ret
end
+ ##
+ # The HTTP version as show in the HTTP request and response. For example,
+ # "1.1"
+
def to_s
format("%d.%d", @major, @minor)
end
diff --git a/lib/webrick/log.rb b/lib/webrick/log.rb
index 546e52700b..41cde4a740 100644
--- a/lib/webrick/log.rb
+++ b/lib/webrick/log.rb
@@ -14,8 +14,27 @@ module WEBrick
# A generic logging class
class BasicLog
- # log-level constants
- FATAL, ERROR, WARN, INFO, DEBUG = 1, 2, 3, 4, 5
+
+ # Fatal log level which indicates a server crash
+
+ FATAL = 1
+
+ # Error log level which indicates a recoverable error
+
+ ERROR = 2
+
+ # Warning log level which indicates a possible problem
+
+ WARN = 3
+
+ # Information log level which indicates possibly useful information
+
+ INFO = 4
+
+ # Debugging error level for messages used in server development or
+ # debugging
+
+ DEBUG = 5
# log-level, messages above this level will be logged
attr_accessor :level
diff --git a/lib/webrick/server.rb b/lib/webrick/server.rb
index 30f4dc3143..3f5371ba47 100644
--- a/lib/webrick/server.rb
+++ b/lib/webrick/server.rb
@@ -15,9 +15,19 @@ require 'webrick/log'
module WEBrick
+ ##
+ # Server error exception
+
class ServerError < StandardError; end
+ ##
+ # Base server class
+
class SimpleServer
+
+ ##
+ # A SimpleServer only yields when you start it
+
def SimpleServer.start
yield
end
@@ -45,8 +55,41 @@ module WEBrick
end
end
+ ##
+ # Base TCP server class. You must subclass GenericServer and provide a #run
+ # method.
+
class GenericServer
- attr_reader :status, :config, :logger, :tokens, :listeners
+
+ ##
+ # The server status. One of :Stop, :Running or :Shutdown
+
+ attr_reader :status
+
+ ##
+ # The server configuration
+
+ attr_reader :config
+
+ ##
+ # The server logger. This is independent from the HTTP access log.
+
+ attr_reader :logger
+
+ ##
+ # Tokens control the number of outstanding clients. The
+ # <code>:MaxClients</code> configuration sets this.
+
+ attr_reader :tokens
+
+ ##
+ # Sockets listening for connections.
+
+ attr_reader :listeners
+
+ ##
+ # Creates a new generic server from +config+. The default configuration
+ # comes from +default+.
def initialize(config={}, default=Config::General)
@config = default.dup.update(config)
@@ -74,14 +117,42 @@ module WEBrick
end
end
+ ##
+ # Retrieves +key+ from the configuration
+
def [](key)
@config[key]
end
+ ##
+ # Adds listeners from +address+ and +port+ to the server. See
+ # WEBrick::Utils::create_listeners for details.
+
def listen(address, port)
@listeners += Utils::create_listeners(address, port, @logger)
end
+ ##
+ # Starts the server and runs the +block+ for each connection. This method
+ # does not return until the server is stopped from a signal handler or
+ # another thread using #stop or #shutdown.
+ #
+ # If the block raises a subclass of StandardError the exception is logged
+ # and ignored. If an IOError or Errno::EBADF exception is raised the
+ # exception is ignored. If an Exception subclass is raised the exception
+ # is logged and re-raised which stops the server.
+ #
+ # To completely shut down a server call #shutdown from ensure:
+ #
+ # server = WEBrick::GenericServer.new
+ # # or WEBrick::HTTPServer.new
+ #
+ # begin
+ # server.start
+ # ensure
+ # server.shutdown
+ # end
+
def start(&block)
raise ServerError, "already started." if @status != :Stop
server_type = @config[:ServerType] || SimpleServer
@@ -93,44 +164,58 @@ module WEBrick
thgroup = ThreadGroup.new
@status = :Running
- while @status == :Running
- begin
- if svrs = IO.select(@listeners, nil, nil, 2.0)
- svrs[0].each{|svr|
- @tokens.pop # blocks while no token is there.
- if sock = accept_client(svr)
- sock.do_not_reverse_lookup = config[:DoNotReverseLookup]
- th = start_thread(sock, &block)
- th[:WEBrickThread] = true
- thgroup.add(th)
- else
- @tokens.push(nil)
- end
- }
+ begin
+ while @status == :Running
+ begin
+ if svrs = IO.select(@listeners, nil, nil, 2.0)
+ svrs[0].each{|svr|
+ @tokens.pop # blocks while no token is there.
+ if sock = accept_client(svr)
+ sock.do_not_reverse_lookup = config[:DoNotReverseLookup]
+ th = start_thread(sock, &block)
+ th[:WEBrickThread] = true
+ thgroup.add(th)
+ else
+ @tokens.push(nil)
+ end
+ }
+ end
+ rescue Errno::EBADF, IOError => ex
+ # if the listening socket was closed in GenericServer#shutdown,
+ # IO::select raise it.
+ rescue StandardError => ex
+ msg = "#{ex.class}: #{ex.message}\n\t#{ex.backtrace[0]}"
+ @logger.error msg
+ rescue Exception => ex
+ @logger.fatal ex
+ raise
end
- rescue Errno::EBADF, IOError => ex
- # if the listening socket was closed in GenericServer#shutdown,
- # IO::select raise it.
- rescue Exception => ex
- msg = "#{ex.class}: #{ex.message}\n\t#{ex.backtrace[0]}"
- @logger.error msg
end
- end
- @logger.info "going to shutdown ..."
- thgroup.list.each{|th| th.join if th[:WEBrickThread] }
- call_callback(:StopCallback)
- @logger.info "#{self.class}#start done."
- @status = :Stop
+ ensure
+ @status = :Shutdown
+ @logger.info "going to shutdown ..."
+ thgroup.list.each{|th| th.join if th[:WEBrickThread] }
+ call_callback(:StopCallback)
+ @logger.info "#{self.class}#start done."
+ @status = :Stop
+ end
}
end
+ ##
+ # Stops the server from accepting new connections.
+
def stop
if @status == :Running
@status = :Shutdown
end
end
+ ##
+ # Shuts down the server and all listening sockets. New listeners must be
+ # provided to restart the server.
+
def shutdown
stop
@listeners.each{|s|
@@ -154,12 +239,22 @@ module WEBrick
@listeners.clear
end
+ ##
+ # You must subclass GenericServer and implement \#run which accepts a TCP
+ # client socket
+
def run(sock)
@logger.fatal "run() must be provided by user."
end
private
+ # :stopdoc:
+
+ ##
+ # Accepts a TCP client socket from the TCP server socket +svr+ and returns
+ # the client socket.
+
def accept_client(svr)
sock = nil
begin
@@ -169,13 +264,22 @@ module WEBrick
Utils::set_close_on_exec(sock)
rescue Errno::ECONNRESET, Errno::ECONNABORTED,
Errno::EPROTO, Errno::EINVAL => ex
- rescue Exception => ex
+ rescue StandardError => ex
msg = "#{ex.class}: #{ex.message}\n\t#{ex.backtrace[0]}"
@logger.error msg
end
return sock
end
+ ##
+ # Starts a server thread for the client socket +sock+ that runs the given
+ # +block+.
+ #
+ # Sets the socket to the <code>:WEBrickSocket</code> thread local variable
+ # in the thread.
+ #
+ # If any errors occur in the block they are logged and handled.
+
def start_thread(sock, &block)
Thread.start{
begin
@@ -204,11 +308,14 @@ module WEBrick
else
@logger.debug "close: <address unknown>"
end
- sock.close
+ sock.close unless sock.closed?
end
}
end
+ ##
+ # Calls the callback +callback_name+ from the configuration with +args+
+
def call_callback(callback_name, *args)
if cb = @config[callback_name]
cb.call(*args)
diff --git a/lib/webrick/ssl.rb b/lib/webrick/ssl.rb
index b3cc7aaf01..cf0f3ddb23 100644
--- a/lib/webrick/ssl.rb
+++ b/lib/webrick/ssl.rb
@@ -12,6 +12,53 @@ module WEBrick
module Config
svrsoft = General[:ServerSoftware]
osslv = ::OpenSSL::OPENSSL_VERSION.split[1]
+
+ ##
+ # Default SSL server configuration.
+ #
+ # WEBrick can automatically create a self-signed certificate if
+ # <code>:SSLCertName</code> is set. For more information on the various
+ # SSL options see OpenSSL::SSL::SSLContext.
+ #
+ # :ServerSoftware ::
+ # The server software name used in the Server: header.
+ # :SSLEnable :: false,
+ # Enable SSL for this server. Defaults to false.
+ # :SSLCertificate ::
+ # The SSL certificate for the server.
+ # :SSLPrivateKey ::
+ # The SSL private key for the server certificate.
+ # :SSLClientCA :: nil,
+ # Array of certificates that will be sent to the client.
+ # :SSLExtraChainCert :: nil,
+ # Array of certificates that willbe added to the certificate chain
+ # :SSLCACertificateFile :: nil,
+ # Path to a CA certificate file
+ # :SSLCACertificatePath :: nil,
+ # Path to a directory containing CA certificates
+ # :SSLCertificateStore :: nil,
+ # OpenSSL::X509::Store used for certificate validation of the client
+ # :SSLTmpDhCallback :: nil,
+ # Callback invoked when DH parameters are required.
+ # :SSLVerifyClient ::
+ # Sets whether the client is verified. This defaults to VERIFY_NONE
+ # which is typical for an HTTPS server.
+ # :SSLVerifyDepth ::
+ # Number of CA certificates to walk when verifying a certificate chain
+ # :SSLVerifyCallback ::
+ # Custom certificate verification callback
+ # :SSLTimeout ::
+ # Maximum session lifetime
+ # :SSLOptions ::
+ # Various SSL options
+ # :SSLStartImmediately ::
+ # Immediately start SSL upon connection? Defaults to true
+ # :SSLCertName ::
+ # SSL certificate name. Must be set to enable automatic certificate
+ # creation.
+ # :SSLCertComment ::
+ # Comment used during automatic certificate creation.
+
SSL = {
:ServerSoftware => "#{svrsoft} OpenSSL/#{osslv}",
:SSLEnable => false,
@@ -22,6 +69,7 @@ module WEBrick
:SSLCACertificateFile => nil,
:SSLCACertificatePath => nil,
:SSLCertificateStore => nil,
+ :SSLTmpDhCallback => nil,
:SSLVerifyClient => ::OpenSSL::SSL::VERIFY_NONE,
:SSLVerifyDepth => nil,
:SSLVerifyCallback => nil, # custom verification
@@ -36,6 +84,10 @@ module WEBrick
end
module Utils
+ ##
+ # Creates a self-signed certificate with the given number of +bits+,
+ # the issuer +cn+ and a +comment+ to be stored in the certificate.
+
def create_self_signed_cert(bits, cn, comment)
rsa = OpenSSL::PKey::RSA.new(bits){|p, n|
case p
@@ -78,13 +130,25 @@ module WEBrick
module_function :create_self_signed_cert
end
+ ##
+ #--
+ # Updates WEBrick::GenericServer with SSL functionality
+
class GenericServer
- def ssl_context
+
+ ##
+ # SSL context for the server when run in SSL mode
+
+ def ssl_context # :nodoc:
@ssl_context ||= nil
end
undef listen
- def listen(address, port)
+
+ ##
+ # Updates +listen+ to enable SSL when the SSL configuration is active.
+
+ def listen(address, port) # :nodoc:
listeners = Utils::create_listeners(address, port, @logger)
if @config[:SSLEnable]
unless ssl_context
@@ -100,7 +164,10 @@ module WEBrick
@listeners += listeners
end
- def setup_ssl_context(config)
+ ##
+ # Sets up an SSL context for +config+
+
+ def setup_ssl_context(config) # :nodoc:
unless config[:SSLCertificate]
cn = config[:SSLCertName]
comment = config[:SSLCertComment]
@@ -116,6 +183,7 @@ module WEBrick
ctx.ca_file = config[:SSLCACertificateFile]
ctx.ca_path = config[:SSLCACertificatePath]
ctx.cert_store = config[:SSLCertificateStore]
+ ctx.tmp_dh_callback = config[:SSLTmpDhCallback]
ctx.verify_mode = config[:SSLVerifyClient]
ctx.verify_depth = config[:SSLVerifyDepth]
ctx.verify_callback = config[:SSLVerifyCallback]
diff --git a/lib/webrick/utils.rb b/lib/webrick/utils.rb
index 157c530cc9..a6b5cc6a9c 100644
--- a/lib/webrick/utils.rb
+++ b/lib/webrick/utils.rb
@@ -72,26 +72,11 @@ 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
+ TCPServer.for_fd(s.fileno)
}
- raise last_error if sockets.empty?
return sockets
end
module_function :create_listeners
@@ -170,12 +155,17 @@ module WEBrick
}
end
+ ##
+ # Creates a new TimeoutHandler. You should use ::register and ::cancel
+ # instead of creating the timeout handler directly.
def initialize
@timeout_info = Hash.new
Thread.start{
while true
now = Time.now
- @timeout_info.each{|thread, ary|
+ @timeout_info.keys.each{|thread|
+ ary = @timeout_info[thread]
+ next unless ary
ary.dup.each{|info|
time, exception = *info
interrupt(thread, info.object_id, exception) if time < now
diff --git a/lib/webrick/version.rb b/lib/webrick/version.rb
index a49090828d..48bdc6d94d 100644
--- a/lib/webrick/version.rb
+++ b/lib/webrick/version.rb
@@ -9,5 +9,9 @@
# $IPR: version.rb,v 1.74 2003/07/22 19:20:43 gotoyuzo Exp $
module WEBrick
+
+ ##
+ # The WEBrick version
+
VERSION = "1.3.1"
end
diff --git a/lib/xmlrpc.rb b/lib/xmlrpc.rb
new file mode 100644
index 0000000000..d8208d02a8
--- /dev/null
+++ b/lib/xmlrpc.rb
@@ -0,0 +1,301 @@
+# == Author and Copyright
+#
+# Copyright (C) 2001-2004 by Michael Neumann (mailto:mneumann@ntecs.de)
+#
+# Released under the same term of license as Ruby.
+#
+# == Overview
+#
+# XMLRPC is a lightweight protocol that enables remote procedure calls over
+# HTTP. It is defined at http://www.xmlrpc.com.
+#
+# XMLRPC allows you to create simple distributed computing solutions that span
+# computer languages. Its distinctive feature is its simplicity compared to
+# other approaches like SOAP and CORBA.
+#
+# The Ruby standard library package 'xmlrpc' enables you to create a server that
+# implements remote procedures and a client that calls them. Very little code
+# is required to achieve either of these.
+#
+# == Example
+#
+# Try the following code. It calls a standard demonstration remote procedure.
+#
+# require 'xmlrpc/client'
+# require 'pp'
+#
+# server = XMLRPC::Client.new2("http://xmlrpc-c.sourceforge.net/api/sample.php")
+# result = server.call("sample.sumAndDifference", 5, 3)
+# pp result
+#
+# == Documentation
+#
+# See http://www.ntecs.de/projects/xmlrpc4r. There is plenty of detail there to
+# use the client and implement a server.
+#
+# == Features of XMLRPC for Ruby
+#
+# * Extensions
+# * Introspection
+# * multiCall
+# * optionally nil values and integers larger than 32 Bit
+#
+# * Server
+# * Standalone XML-RPC server
+# * CGI-based (works with FastCGI)
+# * Apache mod_ruby server
+# * WEBrick servlet
+#
+# * Client
+# * synchronous/asynchronous calls
+# * Basic HTTP-401 Authentification
+# * HTTPS protocol (SSL)
+#
+# * Parsers
+# * NQXML (XMLParser::NQXMLStreamParser, XMLParser::NQXMLTreeParser)
+# * Expat (XMLParser::XMLStreamParser, XMLParser::XMLTreeParser)
+# * REXML (XMLParser::REXMLStreamParser)
+# * xml-scan (XMLParser::XMLScanStreamParser)
+# * Fastest parser is Expat's XMLParser::XMLStreamParser!
+#
+# * General
+# * possible to choose between XMLParser module (Expat wrapper) and REXML/NQXML (pure Ruby) parsers
+# * Marshalling Ruby objects to Hashs and reconstruct them later from a Hash
+# * SandStorm component architecture XMLRPC::Client interface
+#
+# == Howto
+#
+# === Client
+#
+# require "xmlrpc/client"
+#
+# # Make an object to represent the XML-RPC server.
+# server = XMLRPC::Client.new( "xmlrpc-c.sourceforge.net", "/api/sample.php")
+#
+# # Call the remote server and get our result
+# result = server.call("sample.sumAndDifference", 5, 3)
+#
+# sum = result["sum"]
+# difference = result["difference"]
+#
+# puts "Sum: #{sum}, Difference: #{difference}"
+#
+# === XMLRPC::Client with XML-RPC fault-structure handling
+#
+# There are two possible ways, of handling a fault-structure:
+#
+# ==== by catching a XMLRPC::FaultException exception
+#
+# require "xmlrpc/client"
+#
+# # Make an object to represent the XML-RPC server.
+# server = XMLRPC::Client.new( "xmlrpc-c.sourceforge.net", "/api/sample.php")
+#
+# begin
+# # Call the remote server and get our result
+# result = server.call("sample.sumAndDifference", 5, 3)
+#
+# sum = result["sum"]
+# difference = result["difference"]
+#
+# puts "Sum: #{sum}, Difference: #{difference}"
+#
+# rescue XMLRPC::FaultException => e
+# puts "Error: "
+# puts e.faultCode
+# puts e.faultString
+# end
+#
+# ==== by calling "call2" which returns a boolean
+#
+# require "xmlrpc/client"
+#
+# # Make an object to represent the XML-RPC server.
+# server = XMLRPC::Client.new( "xmlrpc-c.sourceforge.net", "/api/sample.php")
+#
+# # Call the remote server and get our result
+# ok, result = server.call2("sample.sumAndDifference", 5, 3)
+#
+# if ok
+# sum = result["sum"]
+# difference = result["difference"]
+#
+# puts "Sum: #{sum}, Difference: #{difference}"
+# else
+# puts "Error: "
+# puts result.faultCode
+# puts result.faultString
+# end
+#
+# === Using XMLRPC::Client::Proxy
+#
+# You can create a Proxy object onto which you can call methods. This way it
+# looks nicer. Both forms, _call_ and _call2_ are supported through _proxy_ and
+# _proxy2_. You can additionally give arguments to the Proxy, which will be
+# given to each XML-RPC call using that Proxy.
+#
+# require "xmlrpc/client"
+#
+# # Make an object to represent the XML-RPC server.
+# server = XMLRPC::Client.new( "xmlrpc-c.sourceforge.net", "/api/sample.php")
+#
+# # Create a Proxy object
+# sample = server.proxy("sample")
+#
+# # Call the remote server and get our result
+# result = sample.sumAndDifference(5,3)
+#
+# sum = result["sum"]
+# difference = result["difference"]
+#
+# puts "Sum: #{sum}, Difference: #{difference}"
+#
+# === CGI-based server using XMLRPC::CGIServer
+#
+# There are also two ways to define handler, the first is
+# like C/PHP, the second like Java, of course both ways
+# can be mixed:
+#
+# ==== C/PHP-like (handler functions)
+#
+# require "xmlrpc/server"
+#
+# s = XMLRPC::CGIServer.new
+#
+# s.add_handler("sample.sumAndDifference") do |a,b|
+# { "sum" => a + b, "difference" => a - b }
+# end
+#
+# s.serve
+#
+# ==== Java-like (handler classes)
+#
+# require "xmlrpc/server"
+#
+# s = XMLRPC::CGIServer.new
+#
+# class MyHandler
+# def sumAndDifference(a, b)
+# { "sum" => a + b, "difference" => a - b }
+# end
+# end
+#
+# # NOTE: Security Hole (read below)!!!
+# s.add_handler("sample", MyHandler.new)
+# s.serve
+#
+#
+# To return a fault-structure you have to raise an XMLRPC::FaultException e.g.:
+#
+# raise XMLRPC::FaultException.new(3, "division by Zero")
+#
+# ===== Security Note
+#
+# From Brian Candler:
+#
+# Above code sample has an extremely nasty security hole, in that you can now call
+# any method of 'MyHandler' remotely, including methods inherited from Object
+# and Kernel! For example, in the client code, you can use
+#
+# puts server.call("sample.send","`","ls")
+#
+# (backtick being the method name for running system processes). Needless to
+# say, 'ls' can be replaced with something else.
+#
+# The version which binds proc objects (or the version presented below in the next section)
+# doesn't have this problem, but people may be tempted to use the second version because it's
+# so nice and 'Rubyesque'. I think it needs a big red disclaimer.
+#
+#
+# From Michael:
+#
+# A solution is to undef insecure methods or to use
+# XMLRPC::Service::PublicInstanceMethodsInterface as shown below:
+#
+# class MyHandler
+# def sumAndDifference(a, b)
+# { "sum" => a + b, "difference" => a - b }
+# end
+# end
+#
+# # ... server initialization ...
+#
+# s.add_handler(XMLRPC::iPIMethods("sample"), MyHandler.new)
+#
+# # ...
+#
+# This adds only public instance methods explicitly declared in class MyHandler
+# (and not those inherited from any other class).
+#
+# ==== With interface declarations
+#
+# Code sample from the book Ruby Developer's Guide:
+#
+# require "xmlrpc/server"
+#
+# class Num
+# INTERFACE = XMLRPC::interface("num") {
+# meth 'int add(int, int)', 'Add two numbers', 'add'
+# meth 'int div(int, int)', 'Divide two numbers'
+# }
+#
+# def add(a, b) a + b end
+# def div(a, b) a / b end
+# end
+#
+#
+# s = XMLRPC::CGIServer.new
+# s.add_handler(Num::INTERFACE, Num.new)
+# s.serve
+#
+# === Standalone XMLRPC::Server
+#
+# Same as CGI-based server, the only difference being
+#
+# server = XMLRPC::CGIServer.new
+#
+# must be changed to
+#
+# server = XMLRPC::Server.new(8080)
+#
+# if you want a server listening on port 8080.
+# The rest is the same.
+#
+# === Choosing a different XMLParser or XMLWriter
+#
+# The examples above all use the default parser (which is now since 1.8
+# XMLParser::REXMLStreamParser) and a default XMLRPC::XMLWriter.
+# If you want to use a different XMLParser, then you have to call the
+# ParserWriterChooseMixin#set_parser method of XMLRPC::Client instances
+# or instances of subclasses of XMLRPC::BasicServer or by editing
+# xmlrpc/config.rb.
+#
+# XMLRPC::Client Example:
+#
+# # ...
+# server = XMLRPC::Client.new( "xmlrpc-c.sourceforge.net", "/api/sample.php")
+# server.set_parser(XMLRPC::XMLParser::XMLParser.new)
+# # ...
+#
+# XMLRPC::Server Example:
+#
+# # ...
+# s = XMLRPC::CGIServer.new
+# s.set_parser(XMLRPC::XMLParser::XMLStreamParser.new)
+# # ...
+#
+# or:
+#
+# # ...
+# server = XMLRPC::Server.new(8080)
+# server.set_parser(XMLRPC::XMLParser::NQXMLParser.new)
+# # ...
+#
+#
+# Note that XMLParser::XMLStreamParser is incredible faster (and uses less memory) than any
+# other parser and scales well for large documents. For example for a 0.5 MB XML
+# document with many tags, XMLParser::XMLStreamParser is ~350 (!) times faster than
+# XMLParser::NQXMLTreeParser and still ~18 times as fast as XMLParser::XMLTreeParser.
+#
+# You can change the XML-writer by calling method ParserWriterChooseMixin#set_writer.
+module XMLRPC; end
diff --git a/lib/xmlrpc/README.rdoc b/lib/xmlrpc/README.rdoc
deleted file mode 100644
index 2faed28cb9..0000000000
--- a/lib/xmlrpc/README.rdoc
+++ /dev/null
@@ -1,300 +0,0 @@
-= XMLRPC for Ruby
-
-== Author and Copyright
-
-Copyright (C) 2001-2004 by Michael Neumann (mailto:mneumann@ntecs.de)
-
-Released under the same term of license as Ruby.
-
-== Overview
-
-XMLRPC is a lightweight protocol that enables remote procedure calls over
-HTTP. It is defined at http://www.xmlrpc.com.
-
-XMLRPC allows you to create simple distributed computing solutions that span
-computer languages. Its distinctive feature is its simplicity compared to
-other approaches like SOAP and CORBA.
-
-The Ruby standard library package 'xmlrpc' enables you to create a server that
-implements remote procedures and a client that calls them. Very little code
-is required to achieve either of these.
-
-== Example
-
-Try the following code. It calls a standard demonstration remote procedure.
-
- require 'xmlrpc/client'
- require 'pp'
-
- server = XMLRPC::Client.new2("http://xmlrpc-c.sourceforge.net/api/sample.php")
- result = server.call("sample.sumAndDifference", 5, 3)
- pp result
-
-== Documentation
-
-See http://www.ntecs.de/projects/xmlrpc4r. There is plenty of detail there to
-use the client and implement a server.
-
-== Features of XMLRPC for Ruby
-
-* Extensions
- * Introspection
- * multiCall
- * optionally nil values and integers larger than 32 Bit
-
-* Server
- * Standalone XML-RPC server
- * CGI-based (works with FastCGI)
- * Apache mod_ruby server
- * WEBrick servlet
-
-* Client
- * synchronous/asynchronous calls
- * Basic HTTP-401 Authentification
- * HTTPS protocol (SSL)
-
-* Parsers
- * NQXML (NQXMLStreamParser, NQXMLTreeParser)
- * Expat (XMLStreamParser, XMLTreeParser)
- * REXML (REXMLStreamParser)
- * xml-scan (XMLScanStreamParser)
- * Fastest parser is Expat's XMLStreamParser!
-
-* General
- * possible to choose between XMLParser module (Expat wrapper) and REXML/NQXML (pure Ruby) parsers
- * Marshalling Ruby objects to Hashs and reconstruct them later from a Hash
- * SandStorm component architecture Client interface
-
-== Howto
-
-=== Client
-
- require "xmlrpc/client"
-
- # Make an object to represent the XML-RPC server.
- server = XMLRPC::Client.new( "xmlrpc-c.sourceforge.net", "/api/sample.php")
-
- # Call the remote server and get our result
- result = server.call("sample.sumAndDifference", 5, 3)
-
- sum = result["sum"]
- difference = result["difference"]
-
- puts "Sum: #{sum}, Difference: #{difference}"
-
-=== Client with XML-RPC fault-structure handling
-
-There are two possible ways, of handling a fault-structure:
-
-==== by catching a XMLRPC::FaultException exception
-
- require "xmlrpc/client"
-
- # Make an object to represent the XML-RPC server.
- server = XMLRPC::Client.new( "xmlrpc-c.sourceforge.net", "/api/sample.php")
-
- begin
- # Call the remote server and get our result
- result = server.call("sample.sumAndDifference", 5, 3)
-
- sum = result["sum"]
- difference = result["difference"]
-
- puts "Sum: #{sum}, Difference: #{difference}"
-
- rescue XMLRPC::FaultException => e
- puts "Error: "
- puts e.faultCode
- puts e.faultString
- end
-
-==== by calling "call2" which returns a boolean
-
- require "xmlrpc/client"
-
- # Make an object to represent the XML-RPC server.
- server = XMLRPC::Client.new( "xmlrpc-c.sourceforge.net", "/api/sample.php")
-
- # Call the remote server and get our result
- ok, result = server.call2("sample.sumAndDifference", 5, 3)
-
- if ok
- sum = result["sum"]
- difference = result["difference"]
-
- puts "Sum: #{sum}, Difference: #{difference}"
- else
- puts "Error: "
- puts result.faultCode
- puts result.faultString
- end
-
-=== Client using Proxy
-
-You can create a +Proxy+ object onto which you can call methods. This way it
-looks nicer. Both forms, _call_ and _call2_ are supported through _proxy_ and
-<i>proxy2</i>. You can additionally give arguments to the Proxy, which will be
-given to each XML-RPC call using that Proxy.
-
- require "xmlrpc/client"
-
- # Make an object to represent the XML-RPC server.
- server = XMLRPC::Client.new( "xmlrpc-c.sourceforge.net", "/api/sample.php")
-
- # Create a Proxy object
- sample = server.proxy("sample")
-
- # Call the remote server and get our result
- result = sample.sumAndDifference(5,3)
-
- sum = result["sum"]
- difference = result["difference"]
-
- puts "Sum: #{sum}, Difference: #{difference}"
-
-=== CGI-based Server
-
-There are also two ways to define handler, the first is
-like C/PHP, the second like Java, of course both ways
-can be mixed:
-
-==== C/PHP-like (handler functions)
-
- require "xmlrpc/server"
-
- s = XMLRPC::CGIServer.new
-
- s.add_handler("sample.sumAndDifference") do |a,b|
- { "sum" => a + b, "difference" => a - b }
- end
-
- s.serve
-
-==== Java-like (handler classes)
-
- require "xmlrpc/server"
-
- s = XMLRPC::CGIServer.new
-
- class MyHandler
- def sumAndDifference(a, b)
- { "sum" => a + b, "difference" => a - b }
- end
- end
-
- # NOTE: Security Hole (read below)!!!
- s.add_handler("sample", MyHandler.new)
- s.serve
-
-
-To return a fault-structure you have to raise an FaultException e.g.:
-
- raise XMLRPC::FaultException.new(3, "division by Zero")
-
-===== Security Note
-
-From Brian Candler:
-
- Above code sample has an extremely nasty security hole, in that you can now call
- any method of 'MyHandler' remotely, including methods inherited from Object
- and Kernel! For example, in the client code, you can use
-
- puts server.call("sample.send","`","ls")
-
- (backtick being the method name for running system processes). Needless to
- say, 'ls' can be replaced with something else.
-
- The version which binds proc objects (or the version presented below in the next section)
- doesn't have this problem, but people may be tempted to use the second version because it's
- so nice and 'Rubyesque'. I think it needs a big red disclaimer.
-
-
-From Michael:
-
-A solution is to undef insecure methods or to use (({XMLRPC::iPIMethods})) as shown below:
-
- class MyHandler
- def sumAndDifference(a, b)
- { "sum" => a + b, "difference" => a - b }
- end
- end
-
- # ... server initialization ...
-
- s.add_handler(XMLRPC::iPIMethods("sample"), MyHandler.new)
-
- # ...
-
-This adds only public instance methods explicitly declared in class MyHandler
-(and not those inherited from any other class).
-
-==== With interface declarations
-
-Code sample from the book Ruby Developer's Guide:
-
- require "xmlrpc/server"
-
- class Num
- INTERFACE = XMLRPC::interface("num") {
- meth 'int add(int, int)', 'Add two numbers', 'add'
- meth 'int div(int, int)', 'Divide two numbers'
- }
-
- def add(a, b) a + b end
- def div(a, b) a / b end
- end
-
-
- s = XMLRPC::CGIServer.new
- s.add_handler(Num::INTERFACE, Num.new)
- s.serve
-
-=== Standalone server
-
-Same as CGI-based server, only that the line
-
- server = XMLRPC::CGIServer.new
-
-must be changed to
-
- server = XMLRPC::Server.new(8080)
-
-if you want a server listening on port 8080.
-The rest is the same.
-
-=== Choosing a different XML Parser or XML Writer
-
-The examples above all use the default parser (which is now since 1.8
-REXMLStreamParser) and a default XML writer. If you want to use a different
-XML parser, then you have to call the <i>set_parser</i> method of
-<tt>XMLRPC::Client</tt> instances or instances of subclasses of
-<tt>XMLRPC::BasicServer</tt> or by editing xmlrpc/config.rb.
-
-Client Example:
-
- # ...
- server = XMLRPC::Client.new( "xmlrpc-c.sourceforge.net", "/api/sample.php")
- server.set_parser(XMLRPC::XMLParser::XMLParser.new)
- # ...
-
-Server Example:
-
- # ...
- s = XMLRPC::CGIServer.new
- s.set_parser(XMLRPC::XMLParser::XMLStreamParser.new)
- # ...
-
-or:
-
- # ...
- server = XMLRPC::Server.new(8080)
- server.set_parser(XMLRPC::XMLParser::NQXMLParser.new)
- # ...
-
-
-Note that XMLStreamParser is incredible faster (and uses less memory) than any
-other parser and scales well for large documents. For example for a 0.5 MB XML
-document with many tags, XMLStreamParser is ~350 (!) times faster than
-NQXMLTreeParser and still ~18 times as fast as XMLTreeParser.
-
-You can change the XML-writer by calling method <i>set_writer</i>.
diff --git a/lib/xmlrpc/README.txt b/lib/xmlrpc/README.txt
deleted file mode 100644
index ade842d8b1..0000000000
--- a/lib/xmlrpc/README.txt
+++ /dev/null
@@ -1,31 +0,0 @@
-= XMLRPC for Ruby, Standard Library Documentation
-
-== Overview
-
-XMLRPC is a lightweight protocol that enables remote procedure calls over
-HTTP. It is defined at http://www.xmlrpc.com.
-
-XMLRPC allows you to create simple distributed computing solutions that span
-computer languages. Its distinctive feature is its simplicity compared to
-other approaches like SOAP and CORBA.
-
-The Ruby standard library package 'xmlrpc' enables you to create a server that
-implements remote procedures and a client that calls them. Very little code
-is required to achieve either of these.
-
-== Example
-
-Try the following code. It calls a standard demonstration remote procedure.
-
- require 'xmlrpc/client'
- require 'pp'
-
- server = XMLRPC::Client.new2("http://xmlrpc-c.sourceforge.net/api/sample.php")
- result = server.call("sample.sumAndDifference", 5, 3)
- pp result
-
-== Documentation
-
-See http://www.ntecs.de/projects/xmlrpc4r. There is plenty of detail there to
-use the client and implement a server.
-
diff --git a/lib/xmlrpc/base64.rb b/lib/xmlrpc/base64.rb
index bfa8c0a2d5..4aac3520c5 100644
--- a/lib/xmlrpc/base64.rb
+++ b/lib/xmlrpc/base64.rb
@@ -1,46 +1,23 @@
-=begin
-= xmlrpc/base64.rb
-Copyright (C) 2001, 2002, 2003 by Michael Neumann (mneumann@ntecs.de)
-
-Released under the same term of license as Ruby.
-
-= Classes
-* ((<XMLRPC::Base64>))
-
-= XMLRPC::Base64
-== Description
-This class is necessary for (('xmlrpc4r')) to determine that a string should
-be transmitted base64-encoded and not as a raw-string.
-You can use (({XMLRPC::Base64})) on the client and server-side as a
-parameter and/or return-value.
-
-== Class Methods
---- XMLRPC::Base64.new( str, state = :dec )
- Creates a new (({XMLRPC::Base64})) instance with string ((|str|)) as the
- internal string. When ((|state|)) is (({:dec})) it assumes that the
- string ((|str|)) is not in base64 format (perhaps already decoded),
- otherwise if ((|state|)) is (({:enc})) it decodes ((|str|))
- and stores it as the internal string.
-
---- XMLRPC::Base64.decode( str )
- Decodes string ((|str|)) with base64 and returns that value.
-
---- XMLRPC::Base64.encode( str )
- Encodes string ((|str|)) with base64 and returns that value.
-
-== Instance Methods
---- XMLRPC::Base64#decoded
- Returns the internal string decoded.
-
---- XMLRPC::Base64#encoded
- Returns the internal string encoded with base64.
-
-=end
-
-module XMLRPC
-
+#
+# xmlrpc/base64.rb
+# Copyright (C) 2001, 2002, 2003 by Michael Neumann (mneumann@ntecs.de)
+#
+# Released under the same term of license as Ruby.
+
+module XMLRPC # :nodoc:
+
+# This class is necessary for 'xmlrpc4r' to determine that a string should
+# be transmitted base64-encoded and not as a raw-string.
+#
+# You can use XMLRPC::Base64 on the client and server-side as a
+# parameter and/or return-value.
class Base64
+ # Creates a new XMLRPC::Base64 instance with string +str+ as the
+ # internal string. When +state+ is +:dec+ it assumes that the
+ # string +str+ is not in base64 format (perhaps already decoded),
+ # otherwise if +state+ is +:enc+ it decodes +str+
+ # and stores it as the internal string.
def initialize(str, state = :dec)
case state
when :enc
@@ -52,19 +29,23 @@ class Base64
end
end
+ # Returns the decoded internal string.
def decoded
@str
end
+ # Returns the base64 encoded internal string.
def encoded
Base64.encode(@str)
end
+ # Decodes string +str+ with base64 and returns that value.
def Base64.decode(str)
str.gsub(/\s+/, "").unpack("m")[0]
end
+ # Encodes string +str+ with base64 and returns that value.
def Base64.encode(str)
[str].pack("m")
end
diff --git a/lib/xmlrpc/client.rb b/lib/xmlrpc/client.rb
index 968292b077..ced3d0183f 100644
--- a/lib/xmlrpc/client.rb
+++ b/lib/xmlrpc/client.rb
@@ -1,287 +1,55 @@
-=begin
-= xmlrpc/client.rb
-Copyright (C) 2001, 2002, 2003 by Michael Neumann (mneumann@ntecs.de)
-
-Released under the same term of license as Ruby.
-
-= Classes
-* ((<XMLRPC::Client>))
-* ((<XMLRPC::Client::Proxy>))
-
-
-= XMLRPC::Client
-== Synopsis
- require "xmlrpc/client"
-
- server = XMLRPC::Client.new("www.ruby-lang.org", "/RPC2", 80)
- begin
- param = server.call("michael.add", 4, 5)
- puts "4 + 5 = #{param}"
- rescue XMLRPC::FaultException => e
- puts "Error:"
- puts e.faultCode
- puts e.faultString
- end
-
-or
-
- require "xmlrpc/client"
-
- server = XMLRPC::Client.new("www.ruby-lang.org", "/RPC2", 80)
- ok, param = server.call2("michael.add", 4, 5)
- if ok then
- puts "4 + 5 = #{param}"
- else
- puts "Error:"
- puts param.faultCode
- puts param.faultString
- end
-
-== Description
-Class (({XMLRPC::Client})) provides remote procedure calls to a XML-RPC server.
-After setting the connection-parameters with ((<XMLRPC::Client.new>)) which
-creates a new (({XMLRPC::Client})) instance, you can execute a remote procedure
-by sending the ((<call|XMLRPC::Client#call>)) or ((<call2|XMLRPC::Client#call2>))
-message to this new instance. The given parameters indicate which method to
-call on the remote-side and of course the parameters for the remote procedure.
-
-== Class Methods
---- XMLRPC::Client.new( host=nil, path=nil, port=nil, proxy_host=nil, proxy_port=nil, user=nil, password=nil, use_ssl=false, timeout =nil)
- Creates an object which represents the remote XML-RPC server on the
- given host ((|host|)). If the server is CGI-based, ((|path|)) is the
- path to the CGI-script, which will be called, otherwise (in the
- case of a standalone server) ((|path|)) should be (({"/RPC2"})).
- ((|port|)) is the port on which the XML-RPC server listens.
- If ((|proxy_host|)) is given, then a proxy server listening at
- ((|proxy_host|)) is used. ((|proxy_port|)) is the port of the
- proxy server.
-
- Default values for ((|host|)), ((|path|)) and ((|port|)) are 'localhost', '/RPC2' and
- '80' respectively using SSL '443'.
-
- If ((|user|)) and ((|password|)) are given, each time a request is send,
- a Authorization header is send. Currently only Basic Authentification is
- implemented no Digest.
-
- If ((|use_ssl|)) is set to (({true})), comunication 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.
-
---- XMLRPC::Client.new2( uri, proxy=nil, timeout=nil)
---- XMLRPC::Client.new_from_uri( uri, proxy=nil, timeout=nil)
-: uri
- URI specifying protocol (http or https), host, port, path, user and password.
- Example: https://user:password@host:port/path
-
-: proxy
- Is of the form "host:port".
-
-: timeout
- Defaults to 30.
-
---- XMLRPC::Client.new3( hash={} )
---- XMLRPC::Client.new_from_hash( hash={} )
- Parameter ((|hash|)) has following case-insensitive keys:
- * host
- * path
- * port
- * proxy_host
- * proxy_port
- * user
- * password
- * use_ssl
- * timeout
-
- Calls ((<XMLRPC::Client.new>)) with the corresponding values.
-
-== Instance Methods
---- XMLRPC::Client#call( method, *args )
- Invokes the method named ((|method|)) with the parameters given by
- ((|args|)) on the XML-RPC server.
- The parameter ((|method|)) is converted into a (({String})) and should
- be a valid XML-RPC method-name.
- Each parameter of ((|args|)) must be of one of the following types,
- where (({Hash})), (({Struct})) and (({Array})) can contain any of these listed ((:types:)):
- * (({Fixnum})), (({Bignum}))
- * (({TrueClass})), (({FalseClass})) ((({true})), (({false})))
- * (({String})), (({Symbol}))
- * (({Float}))
- * (({Hash})), (({Struct}))
- * (({Array}))
- * (({Date})), (({Time})), (({XMLRPC::DateTime}))
- * (({XMLRPC::Base64}))
- * A Ruby object which class includes XMLRPC::Marshallable (only if Config::ENABLE_MARSHALLABLE is (({true}))).
- That object is converted into a hash, with one additional key/value pair "___class___" which contains the class name
- for restoring later that object.
-
- The method returns the return-value from the RPC
- ((-stands for Remote Procedure Call-)).
- The type of the return-value is one of the above shown,
- only that a (({Bignum})) is only allowed when it fits in 32-bit and
- that a XML-RPC (('dateTime.iso8601')) type is always returned as
- a ((<(({XMLRPC::DateTime}))|URL:datetime.html>)) object and
- a (({Struct})) is never returned, only a (({Hash})), the same for a (({Symbol})), where
- always a (({String})) is returned.
- A (({XMLRPC::Base64})) is returned as a (({String})) from xmlrpc4r version 1.6.1 on.
-
- If the remote procedure returned a fault-structure, then a
- (({XMLRPC::FaultException})) exception is raised, which has two accessor-methods
- (({faultCode})) and (({faultString})) of type (({Integer})) and (({String})).
-
---- XMLRPC::Client#call2( method, *args )
- The difference between this method and ((<call|XMLRPC::Client#call>)) is, that
- this method do ((*not*)) raise a (({XMLRPC::FaultException})) exception.
- The method returns an array of two values. The first value indicates if
- the second value is a return-value ((({true}))) or an object of type
- (({XMLRPC::FaultException})).
- Both are explained in ((<call|XMLRPC::Client#call>)).
-
- Simple to remember: The "2" in "call2" denotes the number of values it returns.
-
---- XMLRPC::Client#multicall( *methods )
- You can use this method to execute several methods on a XMLRPC server which supports
- the multi-call extension.
- Example:
-
- s.multicall(
- ['michael.add', 3, 4],
- ['michael.sub', 4, 5]
- )
- # => [7, -1]
-
---- XMLRPC::Client#multicall2( *methods )
- Same as ((<XMLRPC::Client#multicall>)), but returns like ((<XMLRPC::Client#call2>)) two parameters
- instead of raising an (({XMLRPC::FaultException})).
-
---- XMLRPC::Client#proxy( prefix, *args )
- Returns an object of class (({XMLRPC::Client::Proxy})), initialized with
- ((|prefix|)) and ((|args|)). A proxy object returned by this method behaves
- like ((<XMLRPC::Client#call>)), i.e. a call on that object will raise a
- (({XMLRPC::FaultException})) when a fault-structure is returned by that call.
-
---- XMLRPC::Client#proxy2( prefix, *args )
- Almost the same like ((<XMLRPC::Client#proxy>)) only that a call on the returned
- (({XMLRPC::Client::Proxy})) object behaves like ((<XMLRPC::Client#call2>)), i.e.
- a call on that object will return two parameters.
-
-
-
-
---- XMLRPC::Client#call_async(...)
---- XMLRPC::Client#call2_async(...)
---- XMLRPC::Client#multicall_async(...)
---- XMLRPC::Client#multicall2_async(...)
---- XMLRPC::Client#proxy_async(...)
---- XMLRPC::Client#proxy2_async(...)
- In contrast to corresponding methods without "_async", these can be
- called concurrently and use for each request a new connection, where the
- non-asynchronous counterparts use connection-alive (one connection for all requests)
- if possible.
-
- Note, that you have to use Threads to call these methods concurrently.
- The following example calls two methods concurrently:
-
- Thread.new {
- p client.call_async("michael.add", 4, 5)
- }
-
- Thread.new {
- p client.call_async("michael.div", 7, 9)
- }
-
-
---- XMLRPC::Client#timeout
---- XMLRPC::Client#user
---- XMLRPC::Client#password
- Return the corresponding attributes.
-
---- XMLRPC::Client#timeout= (new_timeout)
---- XMLRPC::Client#user= (new_user)
---- XMLRPC::Client#password= (new_password)
- Set the corresponding attributes.
-
-
---- XMLRPC::Client#set_writer( writer )
- Sets the XML writer to use for generating XML output.
- Should be an instance of a class from module (({XMLRPC::XMLWriter})).
- If this method is not called, then (({XMLRPC::Config::DEFAULT_WRITER})) is used.
-
---- XMLRPC::Client#set_parser( parser )
- Sets the XML parser to use for parsing XML documents.
- Should be an instance of a class from module (({XMLRPC::XMLParser})).
- If this method is not called, then (({XMLRPC::Config::DEFAULT_PARSER})) is used.
-
---- XMLRPC::Client#cookie
---- XMLRPC::Client#cookie= (cookieString)
- Get and set the HTTP Cookie header.
-
---- XMLRPC::Client#http_header_extra= (additionalHeaders)
- Set extra HTTP headers that are included in the request.
-
---- XMLRPC::Client#http_header_extra
- Access the via ((<XMLRPC::Client#http_header_extra=>)) assigned header.
-
---- XMLRPC::Client#http_last_response
- Returns the (({Net::HTTPResponse})) object of the last RPC.
-
-= XMLRPC::Client::Proxy
-== Synopsis
- require "xmlrpc/client"
-
- server = XMLRPC::Client.new("www.ruby-lang.org", "/RPC2", 80)
-
- michael = server.proxy("michael")
- michael2 = server.proxy("michael", 4)
-
- # both calls should return the same value '9'.
- p michael.add(4,5)
- p michael2.add(5)
-
-== Description
-Class (({XMLRPC::Client::Proxy})) makes XML-RPC calls look nicer!
-You can call any method onto objects of that class - the object handles
-(({method_missing})) and will forward the method call to a XML-RPC server.
-Don't use this class directly, but use instead method ((<XMLRPC::Client#proxy>)) or
-((<XMLRPC::Client#proxy2>)).
-
-== Class Methods
---- XMLRPC::Client::Proxy.new( server, prefix, args=[], meth=:call, delim="." )
- Creates an object which provides (({method_missing})).
-
- ((|server|)) must be of type (({XMLRPC::Client})), which is the XML-RPC server to be used
- for a XML-RPC call. ((|prefix|)) and ((|delim|)) will be prepended to the methodname
- called onto this object.
-
- Parameter ((|meth|)) is the method (call, call2, call_async, call2_async) to use for
- a RPC.
-
- ((|args|)) are arguments which are automatically given
- to every XML-RPC call before the arguments provides through (({method_missing})).
-
-== Instance Methods
-Every method call is forwarded to the XML-RPC server defined in ((<new|XMLRPC::Client::Proxy#new>)).
-
-Note: Inherited methods from class (({Object})) cannot be used as XML-RPC names, because they get around
-(({method_missing})).
-
-
-
-= History
- $Id$
-
-=end
-
-
-
+# xmlrpc/client.rb
+# Copyright (C) 2001, 2002, 2003 by Michael Neumann (mneumann@ntecs.de)
+#
+# Released under the same term of license as Ruby.
+#
+# History
+# $Id$
+#
require "xmlrpc/parser"
require "xmlrpc/create"
require "xmlrpc/config"
require "xmlrpc/utils" # ParserWriterChooseMixin
require "net/http"
-
-module XMLRPC
-
+require "uri"
+
+module XMLRPC # :nodoc:
+
+ # Provides remote procedure calls to a XML-RPC server.
+ #
+ # After setting the connection-parameters with XMLRPC::Client.new which
+ # creates a new XMLRPC::Client instance, you can execute a remote procedure
+ # by sending the XMLRPC::Client#call or XMLRPC::Client#call2
+ # message to this new instance.
+ #
+ # The given parameters indicate which method to call on the remote-side and
+ # of course the parameters for the remote procedure.
+ #
+ # require "xmlrpc/client"
+ #
+ # server = XMLRPC::Client.new("www.ruby-lang.org", "/RPC2", 80)
+ # begin
+ # param = server.call("michael.add", 4, 5)
+ # puts "4 + 5 = #{param}"
+ # rescue XMLRPC::FaultException => e
+ # puts "Error:"
+ # puts e.faultCode
+ # puts e.faultString
+ # end
+ #
+ # or
+ #
+ # require "xmlrpc/client"
+ #
+ # server = XMLRPC::Client.new("www.ruby-lang.org", "/RPC2", 80)
+ # ok, param = server.call2("michael.add", 4, 5)
+ # if ok then
+ # puts "4 + 5 = #{param}"
+ # else
+ # puts "Error:"
+ # puts param.faultCode
+ # puts param.faultString
+ # end
class Client
USER_AGENT = "XMLRPC::Client (Ruby #{RUBY_VERSION})"
@@ -290,8 +58,28 @@ module XMLRPC
include ParseContentType
- # Constructors -------------------------------------------------------------------
-
+ # Creates an object which represents the remote XML-RPC server on the
+ # given +host+. If the server is CGI-based, +path+ is the
+ # path to the CGI-script, which will be called, otherwise (in the
+ # case of a standalone server) +path+ should be <tt>"/RPC2"</tt>.
+ # +port+ is the port on which the XML-RPC server listens.
+ #
+ # If +proxy_host+ is given, then a proxy server listening at
+ # +proxy_host+ is used. +proxy_port+ is the port of the
+ # proxy server.
+ #
+ # Default values for +host+, +path+ and +port+ are 'localhost', '/RPC2' and
+ # '80' respectively using SSL '443'.
+ #
+ # If +user+ and +password+ are given, each time a request is sent,
+ # an Authorization header is sent. Currently only Basic Authentication is
+ # implemented, no Digest.
+ #
+ # 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)
@@ -324,8 +112,7 @@ module XMLRPC
@proxy_port = @proxy_port.to_i if @proxy_port != nil
# HTTP object for synchronous calls
- Net::HTTP.version_1_2
- @http = Net::HTTP.new(@host, @port, @proxy_host, @proxy_port)
+ @http = net_http(@host, @port, @proxy_host, @proxy_port)
@http.use_ssl = @use_ssl if @use_ssl
@http.read_timeout = @timeout
@http.open_timeout = @timeout
@@ -337,28 +124,55 @@ module XMLRPC
class << self
+ # Creates an object which represents the remote XML-RPC server at the
+ # given +uri+. The URI should have a host, port, path, user and password.
+ # Example: https://user:password@host:port/path
+ #
+ # Raises an ArgumentError if the +uri+ is invalid,
+ # or if the protocol isn't http or https.
+ #
+ # If a +proxy+ is given it should be in the form of "host:port".
+ #
+ # The optional +timeout+ defaults to 30 seconds.
def new2(uri, proxy=nil, timeout=nil)
- if match = /^([^:]+):\/\/(([^@]+)@)?([^\/]+)(\/.*)?$/.match(uri)
- proto = match[1]
- user, passwd = (match[3] || "").split(":")
- host, port = match[4].split(":")
- path = match[5]
-
- if proto != "http" and proto != "https"
- raise "Wrong protocol specified. Only http or https allowed!"
- end
+ begin
+ url = URI(uri)
+ rescue URI::InvalidURIError => e
+ raise ArgumentError, e.message, e.backtrace
+ end
- else
- raise "Wrong URI as parameter!"
+ unless URI::HTTP === url
+ raise ArgumentError, "Wrong protocol specified. Only http or https allowed!"
end
+ proto = url.scheme
+ user = url.user
+ passwd = url.password
+ host = url.host
+ port = url.port
+ path = url.path.empty? ? nil : url.request_uri
+
proxy_host, proxy_port = (proxy || "").split(":")
+ proxy_port = proxy_port.to_i if proxy_port
self.new(host, path, port, proxy_host, proxy_port, user, passwd, (proto == "https"), timeout)
end
alias new_from_uri new2
+ # Receives a Hash and calls XMLRPC::Client.new
+ # with the corresponding values.
+ #
+ # The +hash+ parameter has following case-insensitive keys:
+ # * host
+ # * path
+ # * port
+ # * proxy_host
+ # * proxy_port
+ # * user
+ # * password
+ # * use_ssl
+ # * timeout
def new3(hash={})
# convert all keys into lowercase strings
@@ -374,38 +188,83 @@ module XMLRPC
end
- # Attribute Accessors -------------------------------------------------------------------
+ # 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
+ # Add additional HTTP headers to the request
attr_accessor :http_header_extra
- # makes last HTTP response accessible
+ # Returns the Net::HTTPResponse object of the last RPC.
attr_reader :http_last_response
- # Cookie support
+ # Get and set the HTTP Cookie header.
attr_accessor :cookie
+ # Return the corresponding attributes.
attr_reader :timeout, :user, :password
+ # Sets the Net::HTTP#read_timeout and Net::HTTP#open_timeout to
+ # +new_timeout+
def timeout=(new_timeout)
@timeout = new_timeout
@http.read_timeout = @timeout
@http.open_timeout = @timeout
end
+ # Changes the user for the Basic Authentication header to +new_user+
def user=(new_user)
@user = new_user
set_auth
end
+ # Changes the password for the Basic Authentication header to
+ # +new_password+
def password=(new_password)
@password = new_password
set_auth
end
- # Call methods --------------------------------------------------------------
-
+ # Invokes the method named +method+ with the parameters given by
+ # +args+ on the XML-RPC server.
+ #
+ # The +method+ parameter is converted into a String and should
+ # be a valid XML-RPC method-name.
+ #
+ # Each parameter of +args+ must be of one of the following types,
+ # where Hash, Struct and Array can contain any of these listed _types_:
+ #
+ # * Fixnum, Bignum
+ # * TrueClass, FalseClass, +true+, +false+
+ # * String, Symbol
+ # * Float
+ # * Hash, Struct
+ # * Array
+ # * Date, Time, XMLRPC::DateTime
+ # * XMLRPC::Base64
+ # * A Ruby object which class includes XMLRPC::Marshallable
+ # (only if Config::ENABLE_MARSHALLABLE is +true+).
+ # That object is converted into a hash, with one additional key/value
+ # pair <code>___class___</code> which contains the class name
+ # for restoring that object later.
+ #
+ # The method returns the return-value from the Remote Procedure Call.
+ #
+ # The type of the return-value is one of the types shown above.
+ #
+ # A Bignum is only allowed when it fits in 32-bit. A XML-RPC
+ # +dateTime.iso8601+ type is always returned as a XMLRPC::DateTime object.
+ # Struct is never returned, only a Hash, the same for a Symbol, where as a
+ # String is always returned. XMLRPC::Base64 is returned as a String from
+ # xmlrpc4r version 1.6.1 on.
+ #
+ # If the remote procedure returned a fault-structure, then a
+ # XMLRPC::FaultException exception is raised, which has two accessor-methods
+ # +faultCode+ an Integer, and +faultString+ a String.
def call(method, *args)
ok, param = call2(method, *args)
if ok
@@ -415,12 +274,37 @@ module XMLRPC
end
end
+ # The difference between this method and XMLRPC::Client#call is, that
+ # this method will <b>NOT</b> raise a XMLRPC::FaultException exception.
+ #
+ # The method returns an array of two values. The first value indicates if
+ # the second value is +true+ or an XMLRPC::FaultException.
+ #
+ # Both are explained in XMLRPC::Client#call.
+ #
+ # Simple to remember: The "2" in "call2" denotes the number of values it returns.
def call2(method, *args)
request = create().methodCall(method, *args)
data = do_rpc(request, false)
parser().parseMethodResponse(data)
end
+ # Similar to XMLRPC::Client#call, however can be called concurrently and
+ # use a new connection for each request. In contrast to the corresponding
+ # method without the +_async+ suffix, which use connect-alive (one
+ # connection for all requests).
+ #
+ # Note, that you have to use Thread to call these methods concurrently.
+ # The following example calls two methods concurrently:
+ #
+ # Thread.new {
+ # p client.call_async("michael.add", 4, 5)
+ # }
+ #
+ # Thread.new {
+ # p client.call_async("michael.div", 7, 9)
+ # }
+ #
def call_async(method, *args)
ok, param = call2_async(method, *args)
if ok
@@ -430,6 +314,9 @@ module XMLRPC
end
end
+ # Same as XMLRPC::Client#call2, but can be called concurrently.
+ #
+ # See also XMLRPC::Client#call_async
def call2_async(method, *args)
request = create().methodCall(method, *args)
data = do_rpc(request, true)
@@ -437,8 +324,14 @@ module XMLRPC
end
- # Multicall methods --------------------------------------------------------------
-
+ # You can use this method to execute several methods on a XMLRPC server
+ # which support the multi-call extension.
+ #
+ # s.multicall(
+ # ['michael.add', 3, 4],
+ # ['michael.sub', 4, 5]
+ # )
+ # # => [7, -1]
def multicall(*methods)
ok, params = multicall2(*methods)
if ok
@@ -448,10 +341,30 @@ module XMLRPC
end
end
+ # Same as XMLRPC::Client#multicall, but returns two parameters instead of
+ # raising an XMLRPC::FaultException.
+ #
+ # See XMLRPC::Client#call2
def multicall2(*methods)
gen_multicall(methods, false)
end
+ # Similar to XMLRPC::Client#multicall, however can be called concurrently and
+ # use a new connection for each request. In contrast to the corresponding
+ # method without the +_async+ suffix, which use connect-alive (one
+ # connection for all requests).
+ #
+ # Note, that you have to use Thread to call these methods concurrently.
+ # The following example calls two methods concurrently:
+ #
+ # Thread.new {
+ # p client.multicall_async("michael.add", 4, 5)
+ # }
+ #
+ # Thread.new {
+ # p client.multicall_async("michael.div", 7, 9)
+ # }
+ #
def multicall_async(*methods)
ok, params = multicall2_async(*methods)
if ok
@@ -461,31 +374,65 @@ module XMLRPC
end
end
+ # Same as XMLRPC::Client#multicall2, but can be called concurrently.
+ #
+ # See also XMLRPC::Client#multicall_async
def multicall2_async(*methods)
gen_multicall(methods, true)
end
- # Proxy generating methods ------------------------------------------
-
+ # Returns an object of class XMLRPC::Client::Proxy, initialized with
+ # +prefix+ and +args+.
+ #
+ # A proxy object returned by this method behaves like XMLRPC::Client#call,
+ # i.e. a call on that object will raise a XMLRPC::FaultException when a
+ # fault-structure is returned by that call.
def proxy(prefix=nil, *args)
Proxy.new(self, prefix, args, :call)
end
+ # Almost the same like XMLRPC::Client#proxy only that a call on the returned
+ # XMLRPC::Client::Proxy object will return two parameters.
+ #
+ # See XMLRPC::Client#call2
def proxy2(prefix=nil, *args)
Proxy.new(self, prefix, args, :call2)
end
+ # Similar to XMLRPC::Client#proxy, however can be called concurrently and
+ # use a new connection for each request. In contrast to the corresponding
+ # method without the +_async+ suffix, which use connect-alive (one
+ # connection for all requests).
+ #
+ # Note, that you have to use Thread to call these methods concurrently.
+ # The following example calls two methods concurrently:
+ #
+ # Thread.new {
+ # p client.proxy_async("michael.add", 4, 5)
+ # }
+ #
+ # Thread.new {
+ # p client.proxy_async("michael.div", 7, 9)
+ # }
+ #
def proxy_async(prefix=nil, *args)
Proxy.new(self, prefix, args, :call_async)
end
+ # Same as XMLRPC::Client#proxy2, but can be called concurrently.
+ #
+ # See also XMLRPC::Client#proxy_async
def proxy2_async(prefix=nil, *args)
Proxy.new(self, prefix, args, :call2_async)
end
- private # ----------------------------------------------------------
+ private
+
+ def net_http(host, port, proxy_host, proxy_port)
+ Net::HTTP.new host, port, proxy_host, proxy_port
+ end
def set_auth
if @user.nil?
@@ -518,15 +465,14 @@ module XMLRPC
if async
# use a new HTTP object for each call
- Net::HTTP.version_1_2
- http = Net::HTTP.new(@host, @port, @proxy_host, @proxy_port)
+ http = net_http(@host, @port, @proxy_host, @proxy_port)
http.use_ssl = @use_ssl if @use_ssl
http.read_timeout = @timeout
http.open_timeout = @timeout
# post request
http.start {
- resp = http.post2(@path, request, header)
+ resp = http.request_post(@path, request, header)
}
else
# reuse the HTTP object for each call => connection alive is possible
@@ -535,7 +481,7 @@ module XMLRPC
@http.start if not @http.started?
# post request
- resp = @http.post2(@path, request, header)
+ resp = @http.request_post(@path, request, header)
end
@http_last_response = resp
@@ -549,7 +495,9 @@ module XMLRPC
raise "HTTP-Error: #{resp.code} #{resp.message}"
end
- ct = parse_content_type(resp["Content-Type"]).first
+ # assume text/xml on instances where Content-Type header is not set
+ ct_expected = resp["Content-Type"] || 'text/xml'
+ ct = parse_content_type(ct_expected).first
if ct != "text/xml"
if ct == "text/html"
raise "Wrong content-type (received '#{ct}' but expected 'text/xml'): \n#{data}"
@@ -565,18 +513,27 @@ module XMLRPC
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
@@ -602,8 +559,39 @@ module XMLRPC
+ # XML-RPC calls look nicer!
+ #
+ # You can call any method onto objects of that class - the object handles
+ # XMLRPC::Client::Proxy#method_missing and will forward the method call to
+ # a XML-RPC server.
+ #
+ # Don't use this class directly, instead use the public instance method
+ # XMLRPC::Client#proxy or XMLRPC::Client#proxy2.
+ #
+ # require "xmlrpc/client"
+ #
+ # server = XMLRPC::Client.new("www.ruby-lang.org", "/RPC2", 80)
+ #
+ # michael = server.proxy("michael")
+ # michael2 = server.proxy("michael", 4)
+ #
+ # # both calls should return the same value '9'.
+ # p michael.add(4,5)
+ # p michael2.add(5)
class Proxy
+ # Creates an object which provides XMLRPC::Client::Proxy#method_missing.
+ #
+ # The given +server+ must be an instance of XMLRPC::Client, which is the
+ # XML-RPC server to be used for a XML-RPC call.
+ #
+ # +prefix+ and +delim+ will be prepended to the method name called onto this object.
+ #
+ # An optional parameter +meth+ is the method to use for a RPC.
+ # It can be either, call, call2, call_async, call2_async
+ #
+ # +args+ are arguments which are automatically given to every XML-RPC
+ # call before being provided through +method_missing+.
def initialize(server, prefix, args=[], meth=:call, delim=".")
@server = server
@prefix = prefix ? prefix + delim : ""
@@ -611,6 +599,11 @@ module XMLRPC
@meth = meth
end
+ # Every method call is forwarded to the XML-RPC server defined in
+ # XMLRPC::Client::Proxy#new.
+ #
+ # Note: Inherited methods from class Object cannot be used as XML-RPC
+ # names, because they get around +method_missing+.
def method_missing(mid, *args)
pre = @prefix + mid.to_s
arg = @args + args
diff --git a/lib/xmlrpc/config.rb b/lib/xmlrpc/config.rb
index 34c3bbaf1b..98081473b4 100644
--- a/lib/xmlrpc/config.rb
+++ b/lib/xmlrpc/config.rb
@@ -3,29 +3,31 @@
# Configuration file for XML-RPC for Ruby
#
-module XMLRPC
+module XMLRPC # :nodoc:
module Config
- DEFAULT_WRITER = XMLWriter::Simple # or XMLWriter::XMLParser
-
- # available parser:
- # * XMLParser::NQXMLTreeParser
- # * XMLParser::NQXMLStreamParser
- # * XMLParser::XMLTreeParser
- # * XMLParser::XMLStreamParser (fastest)
- # * XMLParser::REXMLStreamParser
- # * XMLParser::XMLScanStreamParser
+ # or XMLWriter::XMLParser
+ DEFAULT_WRITER = XMLWriter::Simple
+
+ # === Available parsers
+ #
+ # * XMLParser::NQXMLTreeParser
+ # * XMLParser::NQXMLStreamParser
+ # * XMLParser::XMLTreeParser
+ # * XMLParser::XMLStreamParser (fastest)
+ # * XMLParser::REXMLStreamParser
+ # * XMLParser::XMLScanStreamParser
DEFAULT_PARSER = XMLParser::REXMLStreamParser
- # enable <nil/> tag
+ # enable <code><nil/></code> tag
ENABLE_NIL_CREATE = false
ENABLE_NIL_PARSER = false
- # allows integers greater than 32-bit if true
+ # 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/create.rb b/lib/xmlrpc/create.rb
index 7aa0873590..13c9cd8faa 100644
--- a/lib/xmlrpc/create.rb
+++ b/lib/xmlrpc/create.rb
@@ -1,6 +1,4 @@
#
-# Creates XML-RPC call/response documents
-#
# Copyright (C) 2001, 2002, 2003 by Michael Neumann (mneumann@ntecs.de)
#
# $Id$
@@ -9,7 +7,7 @@
require "date"
require "xmlrpc/base64"
-module XMLRPC
+module XMLRPC # :nodoc:
module XMLWriter
@@ -100,6 +98,8 @@ module XMLRPC
end # module XMLWriter
+ # Creates XML-RPC call/response documents
+ #
class Create
def initialize(xml_writer = nil)
@@ -132,14 +132,14 @@ module XMLRPC
#
- # generates a XML-RPC methodResponse document
+ # Generates a XML-RPC methodResponse document
#
- # if is_ret == false then the params array must
+ # When +is_ret+ is +false+ then the +params+ array must
# contain only one element, which is a structure
# of a fault return-value.
#
- # if is_ret == true then a normal
- # return-value of all the given params is created.
+ # When +is_ret+ is +true+ then a normal
+ # return-value of all the given +params+ is created.
#
def methodResponse(is_ret, *params)
@@ -167,15 +167,12 @@ module XMLRPC
- #####################################
private
- #####################################
#
- # converts a Ruby object into
- # a XML-RPC <value> tag
+ # Converts a Ruby object into a XML-RPC <code><value></code> tag
#
- def conv2value(param)
+ def conv2value(param) # :doc:
val = case param
when Fixnum, Bignum
diff --git a/lib/xmlrpc/datetime.rb b/lib/xmlrpc/datetime.rb
index d6c80a2cb9..dff2304f92 100644
--- a/lib/xmlrpc/datetime.rb
+++ b/lib/xmlrpc/datetime.rb
@@ -1,115 +1,95 @@
-=begin
-= xmlrpc/datetime.rb
-Copyright (C) 2001, 2002, 2003 by Michael Neumann (mneumann@ntecs.de)
-
-Released under the same term of license as Ruby.
-
-= Classes
-* ((<XMLRPC::DateTime>))
-
-= XMLRPC::DateTime
-== Description
-This class is important to handle XMLRPC (('dateTime.iso8601')) values,
-correcly, because normal UNIX-dates (class (({Date}))) only handle dates
-from year 1970 on, and class (({Time})) handles dates without the time
-component. (({XMLRPC::DateTime})) is able to store a XMLRPC
-(('dateTime.iso8601')) value correctly.
-
-== Class Methods
---- XMLRPC::DateTime.new( year, month, day, hour, min, sec )
- Creates a new (({XMLRPC::DateTime})) instance with the
- parameters ((|year|)), ((|month|)), ((|day|)) as date and
- ((|hour|)), ((|min|)), ((|sec|)) as time.
- Raises (({ArgumentError})) if a parameter is out of range, or ((|year|)) is not
- of type (({Integer})).
-
-== Instance Methods
---- XMLRPC::DateTime#year
---- XMLRPC::DateTime#month
---- XMLRPC::DateTime#day
---- XMLRPC::DateTime#hour
---- XMLRPC::DateTime#min
---- XMLRPC::DateTime#sec
- Return the value of the specified date/time component.
-
---- XMLRPC::DateTime#mon
- Alias for ((<XMLRPC::DateTime#month>)).
-
---- XMLRPC::DateTime#year=( value )
---- XMLRPC::DateTime#month=( value )
---- XMLRPC::DateTime#day=( value )
---- XMLRPC::DateTime#hour=( value )
---- XMLRPC::DateTime#min=( value )
---- XMLRPC::DateTime#sec=( value )
- Set ((|value|)) as the new date/time component.
- Raises (({ArgumentError})) if ((|value|)) is out of range, or in the case
- of (({XMLRPC::DateTime#year=})) if ((|value|)) is not of type (({Integer})).
-
---- XMLRPC::DateTime#mon=( value )
- Alias for ((<XMLRPC::DateTime#month=>)).
-
---- XMLRPC::DateTime#to_time
- Return a (({Time})) object of the date/time which (({self})) represents.
- If the (('year')) is below 1970, this method returns (({nil})),
- because (({Time})) cannot handle years below 1970.
- The used timezone is GMT.
-
---- XMLRPC::DateTime#to_date
- Return a (({Date})) object of the date which (({self})) represents.
- The (({Date})) object do ((*not*)) contain the time component (only date).
-
---- XMLRPC::DateTime#to_a
- Returns all date/time components in an array.
- Returns (({[year, month, day, hour, min, sec]})).
-=end
-
+#
+# xmlrpc/datetime.rb
+# Copyright (C) 2001, 2002, 2003 by Michael Neumann (mneumann@ntecs.de)
+#
+# Released under the same term of license as Ruby.
+#
require "date"
-module XMLRPC
+module XMLRPC # :nodoc:
+# This class is important to handle XMLRPC +dateTime.iso8601+ values,
+# correcly, because normal UNIX-dates, ie: Date, only handle dates
+# from year 1970 on, and ruby's native Time class handles dates without the
+# time component.
+#
+# XMLRPC::DateTime is able to store a XMLRPC +dateTime.iso8601+ value correctly.
class DateTime
+ # Return the value of the specified date/time component.
attr_reader :year, :month, :day, :hour, :min, :sec
+ # Set +value+ as the new date/time component.
+ #
+ # Raises ArgumentError if the given +value+ is out of range, or in the case
+ # of XMLRPC::DateTime#year= if +value+ is not of type Integer.
def year= (value)
raise ArgumentError, "date/time out of range" unless value.is_a? Integer
@year = value
end
+ # Set +value+ as the new date/time component.
+ #
+ # Raises an ArgumentError if the given +value+ isn't between 1 and 12.
def month= (value)
raise ArgumentError, "date/time out of range" unless (1..12).include? value
@month = value
end
+ # Set +value+ as the new date/time component.
+ #
+ # Raises an ArgumentError if the given +value+ isn't between 1 and 31.
def day= (value)
raise ArgumentError, "date/time out of range" unless (1..31).include? value
@day = value
end
+ # Set +value+ as the new date/time component.
+ #
+ # Raises an ArgumentError if the given +value+ isn't between 0 and 24.
def hour= (value)
raise ArgumentError, "date/time out of range" unless (0..24).include? value
@hour = value
end
+ # Set +value+ as the new date/time component.
+ #
+ # Raises an ArgumentError if the given +value+ isn't between 0 and 59.
def min= (value)
raise ArgumentError, "date/time out of range" unless (0..59).include? value
@min = value
end
+ # Set +value+ as the new date/time component.
+ #
+ # Raises an ArgumentError if the given +value+ isn't between 0 and 59.
def sec= (value)
raise ArgumentError, "date/time out of range" unless (0..59).include? value
@sec = value
end
+ # Alias for XMLRPC::DateTime#month.
alias mon month
+ # Alias for XMLRPC::DateTime#month=.
alias mon= month=
+ # Creates a new XMLRPC::DateTime instance with the
+ # parameters +year+, +month+, +day+ as date and
+ # +hour+, +min+, +sec+ as time.
+ #
+ # Raises an ArgumentError if a parameter is out of range,
+ # or if +year+ is not of the Integer type.
def initialize(year, month, day, hour, min, sec)
self.year, self.month, self.day = year, month, day
self.hour, self.min, self.sec = hour, min, sec
end
+ # Return a Time object of the date/time which represents +self+.
+ # If the <code>@year</code> is below 1970, this method returns +nil+,
+ # because Time cannot handle years below 1970.
+ #
+ # The timezone used is GMT.
def to_time
if @year >= 1970
Time.gm(*to_a)
@@ -118,14 +98,21 @@ class DateTime
end
end
+ # Return a Date object of the date which represents +self+.
+ #
+ # The Date object do _not_ contain the time component (only date).
def to_date
Date.new(*to_a[0,3])
end
+ # Returns all date/time components in an array.
+ #
+ # Returns +[year, month, day, hour, min, sec]+.
def to_a
[@year, @month, @day, @hour, @min, @sec]
end
+ # Returns whether or not all date/time components are an array.
def ==(o)
self.to_a == Array(o) rescue false
end
diff --git a/lib/xmlrpc/httpserver.rb b/lib/xmlrpc/httpserver.rb
index a9605efa7a..dd0d7417c1 100644
--- a/lib/xmlrpc/httpserver.rb
+++ b/lib/xmlrpc/httpserver.rb
@@ -1,7 +1,3 @@
-#
-# Implements a simple HTTP-server by using John W. Small's (jsmall@laser.net)
-# ruby-generic-server.
-#
# Copyright (C) 2001, 2002, 2003 by Michael Neumann (mneumann@ntecs.de)
#
# $Id$
@@ -10,11 +6,13 @@
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 to request_handler
- # and ip_auth_handler
+ # +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
@@ -23,19 +21,16 @@ class HttpServer < GServer
private
- # Constants -----------------------------------------------
-
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 code and error message
- #
+ # Mapping of status codes and error messages
StatusCodeMapping = {
200 => "OK",
400 => "Bad Request",
@@ -45,8 +40,6 @@ private
500 => "Internal Server Error"
}
- # Classes -------------------------------------------------
-
class Request
attr_reader :data, :header, :method, :path, :proto
@@ -74,10 +67,7 @@ private
end
end
-
- ##
- # a case-insensitive Hash class for HTTP header
- #
+ # A case-insensitive Hash class for HTTP header
class Table
include Enumerable
@@ -103,15 +93,15 @@ private
@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
- # Helper Methods ------------------------------------------
-
- def http_header(header=nil)
+ # 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?
@@ -121,11 +111,14 @@ private
new_header
end
- def http_date( aTime )
+ # 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
- def http_resp(status_code, status_message=nil, header=nil, body=nil)
+ # 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 = ""
@@ -136,9 +129,11 @@ private
str
end
- # Main Serve Loop -----------------------------------------
-
- def serve(io)
+ # 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")
diff --git a/lib/xmlrpc/marshal.rb b/lib/xmlrpc/marshal.rb
index d121828312..ef1234f801 100644
--- a/lib/xmlrpc/marshal.rb
+++ b/lib/xmlrpc/marshal.rb
@@ -1,6 +1,4 @@
#
-# Marshalling of XML-RPC methodCall and methodResponse
-#
# Copyright (C) 2001, 2002, 2003 by Michael Neumann (mneumann@ntecs.de)
#
# $Id$
@@ -11,13 +9,12 @@ require "xmlrpc/create"
require "xmlrpc/config"
require "xmlrpc/utils"
-module XMLRPC
+module XMLRPC # :nodoc:
+ # Marshalling of XMLRPC::Create#methodCall and XMLRPC::Create#methodResponse
class Marshal
include ParserWriterChooseMixin
- # class methods -------------------------------
-
class << self
def dump_call( methodName, *params )
@@ -41,8 +38,6 @@ module XMLRPC
end # class self
- # instance methods ----------------------------
-
def initialize( parser = nil, writer = nil )
set_parser( parser )
set_writer( writer )
@@ -56,16 +51,12 @@ module XMLRPC
create.methodResponse( ! param.kind_of?( XMLRPC::FaultException ) , param )
end
- ##
- # returns [ methodname, params ]
- #
+ # Returns <code>[ methodname, params ]</code>
def load_call( stringOrReadable )
parser.parseMethodCall( stringOrReadable )
end
- ##
- # returns paramOrFault
- #
+ # Returns +paramOrFault+
def load_response( stringOrReadable )
parser.parseMethodResponse( stringOrReadable )[1]
end
@@ -73,4 +64,3 @@ module XMLRPC
end # class Marshal
end
-
diff --git a/lib/xmlrpc/parser.rb b/lib/xmlrpc/parser.rb
index eb3c9b3441..0afbd07e6b 100644
--- a/lib/xmlrpc/parser.rb
+++ b/lib/xmlrpc/parser.rb
@@ -1,6 +1,3 @@
-#
-# Parser for XML-RPC call and response
-#
# Copyright (C) 2001, 2002, 2003 by Michael Neumann (mneumann@ntecs.de)
#
# $Id$
@@ -12,7 +9,6 @@ require "xmlrpc/base64"
require "xmlrpc/datetime"
-# add some methods to NQXML::Node
module NQXML
class Node
@@ -49,28 +45,41 @@ module NQXML
end # class Node
end # module NQXML
-module XMLRPC
+module XMLRPC # :nodoc:
+ # Raised when the remote procedure returns a fault-structure, which has two
+ # accessor-methods +faultCode+ an Integer, and +faultString+ a String.
class FaultException < StandardError
attr_reader :faultCode, :faultString
+ # Creates a new XMLRPC::FaultException instance.
+ #
+ # +faultString+ is passed to StandardError as the +msg+ of the Exception.
def initialize(faultCode, faultString)
@faultCode = faultCode
@faultString = faultString
super(@faultString)
end
- # returns a hash
+ # The +faultCode+ and +faultString+ of the exception in a Hash.
def to_h
{"faultCode" => @faultCode, "faultString" => @faultString}
end
end
+ # Helper class used to convert types.
module Convert
+
+ # Converts a String to an Integer
+ #
+ # See also String.to_i
def self.int(str)
str.to_i
end
+ # Converts a String to +true+ or +false+
+ #
+ # Raises an exception if +str+ is not +0+ or +1+
def self.boolean(str)
case str
when "0" then false
@@ -80,10 +89,18 @@ module XMLRPC
end
end
+ # Converts a String to a Float
+ #
+ # See also String.to_f
def self.double(str)
str.to_f
end
+ # Converts a the given +str+ to a +dateTime.iso8601+ formatted date.
+ #
+ # Raises an exception if the String isn't in +dateTime.iso8601+ format.
+ #
+ # See also, XMLRPC::DateTime
def self.dateTime(str)
case str
when /^(-?\d\d\d\d)-?(\d\d)-?(\d\d)T(\d\d):(\d\d):(\d\d)(?:Z|([+-])(\d\d):?(\d\d))?$/
@@ -114,12 +131,16 @@ module XMLRPC
end
end
+ # Decodes the given +str+ using XMLRPC::Base64.decode
def self.base64(str)
XMLRPC::Base64.decode(str)
end
+ # Converts the given +hash+ to a marshalled object.
+ #
+ # Returns the given +hash+ if an exception occurs.
def self.struct(hash)
- # convert to marhalled object
+ # convert to marshalled object
klass = hash["___class___"]
if klass.nil? or Config::ENABLE_MARSHALLING == false
hash
@@ -141,6 +162,15 @@ module XMLRPC
end
end
+ # Converts the given +hash+ to an XMLRPC::FaultException object by passing
+ # the +faultCode+ and +faultString+ attributes of the Hash to
+ # XMLRPC::FaultException.new
+ #
+ # Raises an Exception if the given +hash+ doesn't meet the requirements.
+ # Those requirements being:
+ # * 2 keys
+ # * <code>'faultCode'</code> key is an Integer
+ # * <code>'faultString'</code> key is a String
def self.fault(hash)
if hash.kind_of? Hash and hash.size == 2 and
hash.has_key? "faultCode" and hash.has_key? "faultString" and
@@ -154,6 +184,7 @@ module XMLRPC
end # module Convert
+ # Parser for XML-RPC call and response
module XMLParser
class AbstractTreeParser
@@ -168,10 +199,8 @@ module XMLRPC
private
- #
- # remove all whitespaces but in the tags i4, int, boolean....
+ # Removes all whitespaces but in the tags i4, i8, int, boolean....
# and all comments
- #
def removeWhitespacesAndComments(node)
remove = []
childs = node.childNodes.to_a
@@ -179,7 +208,7 @@ module XMLRPC
case _nodeType(nd)
when :TEXT
# TODO: add nil?
- unless %w(i4 int boolean string double dateTime.iso8601 base64).include? node.nodeName
+ unless %w(i4 i8 int boolean string double dateTime.iso8601 base64).include? node.nodeName
if node.nodeName == "value"
if not node.childNodes.to_a.detect {|n| _nodeType(n) == :ELEMENT}.nil?
@@ -217,9 +246,7 @@ module XMLRPC
node
end
- #
- # returns, when successfully the only child-node
- #
+ # Returns, when successfully the only child-node
def hasOnlyOneChild(node, name=nil)
if node.childNodes.to_a.size != 1
raise "wrong xml-rpc (size)"
@@ -236,7 +263,7 @@ module XMLRPC
end
end
- # the node `node` has empty string or string
+ # The node `node` has empty string or string
def text_zero_one(node)
nodes = node.childNodes.to_a.size
@@ -253,7 +280,7 @@ module XMLRPC
def integer(node)
#TODO: check string for float because to_i returnsa
# 0 when wrong string
- nodeMustBe(node, %w(i4 int))
+ nodeMustBe(node, %w(i4 i8 int))
hasOnlyOneChild(node)
Convert.int(text(node.firstChild))
@@ -415,7 +442,7 @@ module XMLRPC
text_zero_one(node)
when :ELEMENT
case child.nodeName
- when "i4", "int" then integer(child)
+ when "i4", "i8", "int" then integer(child)
when "boolean" then boolean(child)
when "string" then string(child)
when "double" then double(child)
@@ -525,7 +552,7 @@ module XMLRPC
case name
when "string"
@value = @data
- when "i4", "int"
+ when "i4", "i8", "int"
@value = Convert.int(@data)
when "boolean"
@value = Convert.boolean(@data)
@@ -575,7 +602,6 @@ module XMLRPC
end # module StreamParserMixin
- # ---------------------------------------------------------------------------
class XMLStreamParser < AbstractStreamParser
def initialize
require "xmlparser"
@@ -584,7 +610,7 @@ module XMLRPC
}
end
end # class XMLStreamParser
- # ---------------------------------------------------------------------------
+
class NQXMLStreamParser < AbstractStreamParser
def initialize
require "nqxml/streamingparser"
@@ -613,7 +639,7 @@ module XMLRPC
end # class XMLRPCParser
end # class NQXMLStreamParser
- # ---------------------------------------------------------------------------
+
class XMLTreeParser < AbstractTreeParser
def initialize
@@ -624,10 +650,10 @@ module XMLRPC
if defined? XML::DOM::Builder
return if defined? XML::DOM::Node::DOCUMENT # code below has been already executed
klass = XML::DOM::Node
- klass.const_set("DOCUMENT", klass::DOCUMENT_NODE)
- klass.const_set("TEXT", klass::TEXT_NODE)
- klass.const_set("COMMENT", klass::COMMENT_NODE)
- klass.const_set("ELEMENT", klass::ELEMENT_NODE)
+ klass.const_set(:DOCUMENT, klass::DOCUMENT_NODE)
+ klass.const_set(:TEXT, klass::TEXT_NODE)
+ klass.const_set(:COMMENT, klass::COMMENT_NODE)
+ klass.const_set(:ELEMENT, klass::ELEMENT_NODE)
end
end
@@ -665,7 +691,7 @@ module XMLRPC
end
end # class XMLParser
- # ---------------------------------------------------------------------------
+
class NQXMLTreeParser < AbstractTreeParser
def initialize
@@ -693,7 +719,7 @@ module XMLRPC
end
end # class NQXMLTreeParser
- # ---------------------------------------------------------------------------
+
class REXMLStreamParser < AbstractStreamParser
def initialize
require "rexml/document"
@@ -718,7 +744,7 @@ module XMLRPC
end
end
- # ---------------------------------------------------------------------------
+
class XMLScanStreamParser < AbstractStreamParser
def initialize
require "xmlscan/parser"
@@ -787,7 +813,7 @@ module XMLRPC
end
end
- # ---------------------------------------------------------------------------
+
XMLParser = XMLTreeParser
NQXMLParser = NQXMLTreeParser
diff --git a/lib/xmlrpc/server.rb b/lib/xmlrpc/server.rb
index b7215385ad..c16375b405 100644
--- a/lib/xmlrpc/server.rb
+++ b/lib/xmlrpc/server.rb
@@ -1,146 +1,7 @@
-=begin
-= xmlrpc/server.rb
-Copyright (C) 2001, 2002, 2003, 2005 by Michael Neumann (mneumann@ntecs.de)
-
-Released under the same term of license as Ruby.
-
-= Classes
-* ((<XMLRPC::BasicServer>))
-* ((<XMLRPC::CGIServer>))
-* ((<XMLRPC::ModRubyServer>))
-* ((<XMLRPC::Server>))
-* ((<XMLRPC::WEBrickServlet>))
-
-= XMLRPC::BasicServer
-== Description
-Is the base class for all XML-RPC server-types (CGI, standalone).
-You can add handler and set a default handler.
-Do not use this server, as this is/should be an abstract class.
-
-=== How the method to call is found
-The arity (number of accepted arguments) of a handler (method or (({Proc})) object) is
-compared to the given arguments submitted by the client for a RPC ((-Remote Procedure Call-)).
-A handler is only called if it accepts the number of arguments, otherwise the search
-for another handler will go on. When at the end no handler was found,
-the ((<default_handler|XMLRPC::BasicServer#set_default_handler>)) will be called.
-With this technique it is possible to do overloading by number of parameters, but
-only for (({Proc})) handler, because you cannot define two methods of the same name in
-the same class.
-
-
-== Class Methods
---- XMLRPC::BasicServer.new( class_delim="." )
- Creates a new (({XMLRPC::BasicServer})) instance, which should not be
- done, because (({XMLRPC::BasicServer})) is an abstract class. This
- method should be called from a subclass indirectly by a (({super})) call
- in the method (({initialize})). The paramter ((|class_delim|)) is used
- in ((<add_handler|XMLRPC::BasicServer#add_handler>)) when an object is
- added as handler, to delimit the object-prefix and the method-name.
-
-== Instance Methods
---- XMLRPC::BasicServer#add_handler( name, signature=nil, help=nil ) { aBlock }
- Adds ((|aBlock|)) to the list of handlers, with ((|name|)) as the name of the method.
- Parameters ((|signature|)) and ((|help|)) are used by the Introspection method if specified,
- where ((|signature|)) is either an Array containing strings each representing a type of it's
- signature (the first is the return value) or an Array of Arrays if the method has multiple
- signatures. Value type-names are "int, boolean, double, string, dateTime.iso8601, base64, array, struct".
-
- Parameter ((|help|)) is a String with informations about how to call this method etc.
-
- A handler method or code-block can return the types listed at
- ((<XMLRPC::Client#call|URL:client.html#index:0>)).
- When a method fails, it can tell it the client by throwing an
- (({XMLRPC::FaultException})) like in this example:
- s.add_handler("michael.div") do |a,b|
- if b == 0
- raise XMLRPC::FaultException.new(1, "division by zero")
- else
- a / b
- end
- end
- The client gets in the case of (({b==0})) an object back of type
- (({XMLRPC::FaultException})) that has a ((|faultCode|)) and ((|faultString|))
- field.
-
---- XMLRPC::BasicServer#add_handler( prefix, obj )
- This is the second form of ((<add_handler|XMLRPC::BasicServer#add_handler>)).
- To add an object write:
- server.add_handler("michael", MyHandlerClass.new)
- All public methods of (({MyHandlerClass})) are accessible to
- the XML-RPC clients by (('michael."name of method"')). This is
- where the ((|class_delim|)) in ((<new|XMLRPC::BasicServer.new>))
- has it's role, a XML-RPC method-name is defined by
- ((|prefix|)) + ((|class_delim|)) + (('"name of method"')).
-
---- XMLRPC::BasicServer#add_handler( interface, obj )
- This is the third form of ((<add_handler|XMLRPC::BasicServer#add_handler>)).
-
- Use (({XMLRPC::interface})) to generate an ServiceInterface object, which
- represents an interface (with signature and help text) for a handler class.
-
- Parameter ((|interface|)) must be of type (({XMLRPC::ServiceInterface})).
- Adds all methods of ((|obj|)) which are defined in ((|interface|)) to the
- server.
-
- This is the recommended way of adding services to a server!
-
-
---- XMLRPC::BasicServer#get_default_handler
- Returns the default-handler, which is called when no handler for
- a method-name is found.
- It is a (({Proc})) object or (({nil})).
-
---- XMLRPC::BasicServer#set_default_handler ( &handler )
- Sets ((|handler|)) as the default-handler, which is called when
- no handler for a method-name is found. ((|handler|)) is a code-block.
- The default-handler is called with the (XML-RPC) method-name as first argument, and
- the other arguments are the parameters given by the client-call.
-
- If no block is specified the default of (({XMLRPC::BasicServer})) is used, which raises a
- XMLRPC::FaultException saying "method missing".
-
-
---- XMLRPC::BasicServer#set_writer( writer )
- Sets the XML writer to use for generating XML output.
- Should be an instance of a class from module (({XMLRPC::XMLWriter})).
- If this method is not called, then (({XMLRPC::Config::DEFAULT_WRITER})) is used.
-
---- XMLRPC::BasicServer#set_parser( parser )
- Sets the XML parser to use for parsing XML documents.
- Should be an instance of a class from module (({XMLRPC::XMLParser})).
- If this method is not called, then (({XMLRPC::Config::DEFAULT_PARSER})) is used.
-
---- XMLRPC::BasicServer#add_introspection
- Adds the introspection handlers "system.listMethods", "system.methodSignature" and "system.methodHelp",
- where only the first one works.
-
---- XMLRPC::BasicServer#add_multicall
- Adds the multi-call handler "system.multicall".
-
---- XMLRPC::BasicServer#get_service_hook
- Returns the service-hook, which is called on each service request (RPC) unless it's (({nil})).
-
---- XMLRPC::BasicServer#set_service_hook ( &handler )
- A service-hook is called for each service request (RPC).
- You can use a service-hook for example to wrap existing methods and catch exceptions of them or
- convert values to values recognized by XMLRPC. You can disable it by passing (({nil})) as parameter
- ((|handler|)) .
-
- The service-hook is called with a (({Proc})) object and with the parameters for this (({Proc})).
- An example:
-
- server.set_service_hook {|obj, *args|
- begin
- ret = obj.call(*args) # call the original service-method
- # could convert the return value
- rescue
- # rescue exceptions
- end
- }
-
-=end
-
-
+# xmlrpc/server.rb
+# Copyright (C) 2001, 2002, 2003, 2005 by Michael Neumann (mneumann@ntecs.de)
+#
+# Released under the same term of license as Ruby.
require "xmlrpc/parser"
require "xmlrpc/create"
@@ -149,9 +10,26 @@ require "xmlrpc/utils" # ParserWriterChooseMixin
-module XMLRPC
+module XMLRPC # :nodoc:
+# This is the base class for all XML-RPC server-types (CGI, standalone).
+# You can add handler and set a default handler.
+# Do not use this server, as this is/should be an abstract class.
+#
+# === How the method to call is found
+# The arity (number of accepted arguments) of a handler (method or Proc
+# object) is compared to the given arguments submitted by the client for a
+# RPC, or Remote Procedure Call.
+#
+# A handler is only called if it accepts the number of arguments, otherwise
+# the search for another handler will go on. When at the end no handler was
+# found, the default_handler, XMLRPC::BasicServer#set_default_handler will be
+# called.
+#
+# With this technique it is possible to do overloading by number of parameters, but
+# only for Proc handler, because you cannot define two methods of the same name in
+# the same class.
class BasicServer
include ParserWriterChooseMixin
@@ -167,6 +45,14 @@ class BasicServer
ERR_MC_EXPECTED_STRUCT = 8
+ # Creates a new XMLRPC::BasicServer instance, which should not be
+ # done, because XMLRPC::BasicServer is an abstract class. This
+ # 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
+ # 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=".")
@handler = []
@default_handler = nil
@@ -180,6 +66,52 @@ class BasicServer
add_introspection if Config::ENABLE_INTROSPECTION
end
+ # Adds +aBlock+ to the list of handlers, with +name+ as the name of
+ # the method.
+ #
+ # Parameters +signature+ and +help+ are used by the Introspection method if
+ # specified, where +signature+ is either an Array containing strings each
+ # representing a type of it's signature (the first is the return value) or
+ # an Array of Arrays if the method has multiple signatures.
+ #
+ # Value type-names are "int, boolean, double, string, dateTime.iso8601,
+ # base64, array, struct".
+ #
+ # Parameter +help+ is a String with information about how to call this method etc.
+ #
+ # When a method fails, it can tell the client by throwing an
+ # XMLRPC::FaultException like in this example:
+ #
+ # s.add_handler("michael.div") do |a,b|
+ # if b == 0
+ # raise XMLRPC::FaultException.new(1, "division by zero")
+ # else
+ # a / b
+ # end
+ # end
+ #
+ # In the case of <code>b==0</code> the client gets an object back of type
+ # XMLRPC::FaultException that has a +faultCode+ and +faultString+ field.
+ #
+ # This is the second form of ((<add_handler|XMLRPC::BasicServer#add_handler>)).
+ # To add an object write:
+ #
+ # server.add_handler("michael", MyHandlerClass.new)
+ #
+ # All public methods of MyHandlerClass are accessible to
+ # the XML-RPC clients by <code>michael."name of method"</code>. This is
+ # where the +class_delim+ in XMLRPC::BasicServer.new plays it's role, a
+ # XML-RPC method-name is defined by +prefix+ + +class_delim+ + <code>"name
+ # of method"</code>.
+ #
+ # The third form of +add_handler is to use XMLRPC::Service::Interface to
+ # generate an object, which represents an interface (with signature and
+ # help text) for a handler class.
+ #
+ # The +interface+ parameter must be an instance of XMLRPC::Service::Interface.
+ # Adds all methods of +obj+ which are defined in the +interface+ to the server.
+ #
+ # This is the recommended way of adding services to a server!
def add_handler(prefix, obj_or_signature=nil, help=nil, &block)
if block_given?
# proc-handler
@@ -200,24 +132,62 @@ class BasicServer
self
end
+ # Returns the service-hook, which is called on each service request (RPC)
+ # unless it's +nil+.
def get_service_hook
@service_hook
end
+ # A service-hook is called for each service request (RPC).
+ #
+ # You can use a service-hook for example to wrap existing methods and catch
+ # exceptions of them or convert values to values recognized by XMLRPC.
+ #
+ # You can disable it by passing +nil+ as the +handler+ parameter.
+ #
+ # The service-hook is called with a Proc object along with any parameters.
+ #
+ # An example:
+ #
+ # server.set_service_hook {|obj, *args|
+ # begin
+ # ret = obj.call(*args) # call the original service-method
+ # # could convert the return value
+ # rescue
+ # # rescue exceptions
+ # end
+ # }
+ #
def set_service_hook(&handler)
@service_hook = handler
self
end
+ # Returns the default-handler, which is called when no handler for
+ # a method-name is found.
+ #
+ # It is either a Proc object or +nil+.
def get_default_handler
@default_handler
end
- def set_default_handler (&handler)
+ # Sets +handler+ as the default-handler, which is called when
+ # no handler for a method-name is found.
+ #
+ # +handler+ is a code-block.
+ #
+ # The default-handler is called with the (XML-RPC) method-name as first
+ # argument, and the other arguments are the parameters given by the
+ # client-call.
+ #
+ # If no block is specified the default of XMLRPC::BasicServer is
+ # used, which raises a XMLRPC::FaultException saying "method missing".
+ def set_default_handler(&handler)
@default_handler = handler
self
end
+ # Adds the multi-call handler <code>"system.multicall"</code>.
def add_multicall
add_handler("system.multicall", %w(array array), "Multicall Extension") do |arrStructs|
unless arrStructs.is_a? Array
@@ -260,6 +230,9 @@ class BasicServer
self
end
+ # Adds the introspection handlers <code>"system.listMethods"</code>,
+ # <code>"system.methodSignature"</code> and
+ # <code>"system.methodHelp"</code>, where only the first one works.
def add_introspection
add_handler("system.listMethods",%w(array), "List methods available on this XML-RPC server") do
methods = []
@@ -312,15 +285,12 @@ class BasicServer
handle(method, *params)
end
- private # --------------------------------------------------------------
+ private
def multicall_fault(nr, str)
{"faultCode" => nr, "faultString" => str}
end
- #
- # method dispatch
- #
def dispatch(methodname, *args)
for name, obj in @handler
if obj.kind_of? Proc
@@ -348,9 +318,7 @@ class BasicServer
end
- #
- # returns true, if the arity of "obj" matches
- #
+ # Returns +true+, if the arity of +obj+ matches +n_args+
def check_arity(obj, n_args)
ary = obj.arity
@@ -373,9 +341,6 @@ class BasicServer
end
end
- #
- #
- #
def handle(methodname, *args)
create().methodResponse(*call_method(methodname, *args))
end
@@ -384,57 +349,44 @@ class BasicServer
end
-=begin
-= XMLRPC::CGIServer
-== Synopsis
- require "xmlrpc/server"
-
- s = XMLRPC::CGIServer.new
-
- s.add_handler("michael.add") do |a,b|
- a + b
- end
-
- s.add_handler("michael.div") do |a,b|
- if b == 0
- raise XMLRPC::FaultException.new(1, "division by zero")
- else
- a / b
- end
- end
-
- s.set_default_handler do |name, *args|
- raise XMLRPC::FaultException.new(-99, "Method #{name} missing" +
- " or wrong number of parameters!")
- end
-
- s.serve
-
-== Description
-Implements a CGI-based XML-RPC server.
-
-== Superclass
-((<XMLRPC::BasicServer>))
-
-== Class Methods
---- XMLRPC::CGIServer.new( *a )
- Creates a new (({XMLRPC::CGIServer})) instance. All parameters given
- are by-passed to ((<XMLRPC::BasicServer.new>)). You can only create
- ((*one*)) (({XMLRPC::CGIServer})) instance, because more than one makes
- no sense.
-
-== Instance Methods
---- XMLRPC::CGIServer#serve
- Call this after you have added all you handlers to the server.
- This method processes a XML-RPC methodCall and sends the answer
- back to the client.
- Make sure that you don't write to standard-output in a handler, or in
- any other part of your program, this would case a CGI-based server to fail!
-=end
-
+# Implements a CGI-based XML-RPC server.
+#
+# require "xmlrpc/server"
+#
+# s = XMLRPC::CGIServer.new
+#
+# s.add_handler("michael.add") do |a,b|
+# a + b
+# end
+#
+# s.add_handler("michael.div") do |a,b|
+# if b == 0
+# raise XMLRPC::FaultException.new(1, "division by zero")
+# else
+# a / b
+# end
+# end
+#
+# s.set_default_handler do |name, *args|
+# raise XMLRPC::FaultException.new(-99, "Method #{name} missing" +
+# " or wrong number of parameters!")
+# end
+#
+# s.serve
+#
+#
+# <b>Note:</b> Make sure that you don't write to standard-output in a
+# handler, or in any other part of your program, this would cause a CGI-based
+# server to fail!
class CGIServer < BasicServer
@@obj = nil
+ # Creates a new XMLRPC::CGIServer instance.
+ #
+ # All parameters given are by-passed to XMLRPC::BasicServer.new.
+ #
+ # You can only create <b>one</b> XMLRPC::CGIServer instance, because more
+ # than one makes no sense.
def CGIServer.new(*a)
@@obj = super(*a) if @@obj.nil?
@@obj
@@ -444,6 +396,10 @@ class CGIServer < BasicServer
super(*a)
end
+ # Call this after you have added all you handlers to the server.
+ #
+ # This method processes a XML-RPC method call and sends the answer
+ # back to the client.
def serve
catch(:exit_serve) {
length = ENV['CONTENT_LENGTH'].to_i
@@ -474,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
@@ -498,24 +454,24 @@ class CGIServer < BasicServer
end
-=begin
-= XMLRPC::ModRubyServer
-== Description
-Implements a XML-RPC server, which works with Apache mod_ruby.
-
-Use it in the same way as CGIServer!
-
-== Superclass
-((<XMLRPC::BasicServer>))
-=end
+# Implements a XML-RPC server, which works with Apache mod_ruby.
+#
+# Use it in the same way as XMLRPC::CGIServer!
class ModRubyServer < BasicServer
+ # Creates a new XMLRPC::ModRubyServer instance.
+ #
+ # All parameters given are by-passed to XMLRPC::BasicServer.new.
def initialize(*a)
@ap = Apache::request
super(*a)
end
+ # Call this after you have added all you handlers to the server.
+ #
+ # This method processes a XML-RPC method call and sends the answer
+ # back to the client.
def serve
catch(:exit_serve) {
header = {}
@@ -549,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
@@ -574,63 +530,47 @@ class ModRubyServer < BasicServer
end
-=begin
-= XMLRPC::Server
-== Synopsis
- require "xmlrpc/server"
-
- s = XMLRPC::Server.new(8080)
-
- s.add_handler("michael.add") do |a,b|
- a + b
- end
-
- s.add_handler("michael.div") do |a,b|
- if b == 0
- raise XMLRPC::FaultException.new(1, "division by zero")
- else
- a / b
- end
- end
-
- s.set_default_handler do |name, *args|
- raise XMLRPC::FaultException.new(-99, "Method #{name} missing" +
- " or wrong number of parameters!")
- end
-
- s.serve
-
-== Description
-Implements a standalone XML-RPC server. The method (({serve}))) is left if a SIGHUP is sent to the
-program.
-
-== Superclass
-((<XMLRPC::WEBrickServlet>))
-
-== Class Methods
---- XMLRPC::Server.new( port=8080, host="127.0.0.1", maxConnections=4, stdlog=$stdout, audit=true, debug=true, *a )
- Creates a new (({XMLRPC::Server})) instance, which is a XML-RPC server listening on
- port ((|port|)) and accepts requests for the host ((|host|)), which is by default only the localhost.
- The server is not started, to start it you have to call ((<serve|XMLRPC::Server#serve>)).
-
- Parameters ((|audit|)) and ((|debug|)) are obsolete!
-
- All additionally given parameters in ((|*a|)) are by-passed to ((<XMLRPC::BasicServer.new>)).
-
-== Instance Methods
---- XMLRPC::Server#serve
- Call this after you have added all you handlers to the server.
- This method starts the server to listen for XML-RPC requests and answer them.
-
---- XMLRPC::Server#shutdown
- Stops and shuts the server down.
-
-=end
class WEBrickServlet < BasicServer; end # forward declaration
+# Implements a standalone XML-RPC server. The method XMLRPC::Server#serve is
+# left if a SIGHUP is sent to the program.
+#
+# require "xmlrpc/server"
+#
+# s = XMLRPC::Server.new(8080)
+#
+# s.add_handler("michael.add") do |a,b|
+# a + b
+# end
+#
+# s.add_handler("michael.div") do |a,b|
+# if b == 0
+# raise XMLRPC::FaultException.new(1, "division by zero")
+# else
+# a / b
+# end
+# end
+#
+# s.set_default_handler do |name, *args|
+# raise XMLRPC::FaultException.new(-99, "Method #{name} missing" +
+# " or wrong number of parameters!")
+# end
+#
+# s.serve
class Server < WEBrickServlet
+ # Creates a new XMLRPC::Server instance, which is a XML-RPC server
+ # listening on the given +port+ and accepts requests for the given +host+,
+ # which is +localhost+ by default.
+ #
+ # The server is not started, to start it you have to call
+ # XMLRPC::Server#serve.
+ #
+ # The optional +audit+ and +debug+ parameters are obsolete!
+ #
+ # All additionally provided parameters in <code>*a</code> are by-passed to
+ # XMLRPC::BasicServer.new.
def initialize(port=8080, host="127.0.0.1", maxConnections=4, stdlog=$stdout, audit=true, debug=true, *a)
super(*a)
require 'webrick'
@@ -639,6 +579,8 @@ class Server < WEBrickServlet
@server.mount("/", self)
end
+ # Call this after you have added all you handlers to the server.
+ # This method starts the server to listen for XML-RPC requests and answer them.
def serve
signals = %w[INT TERM HUP] & Signal.list.keys
signals.each { |signal| trap(signal) { @server.shutdown } }
@@ -646,60 +588,42 @@ class Server < WEBrickServlet
@server.start
end
+ # Stops and shuts the server down.
def shutdown
@server.shutdown
end
end
-=begin
-= XMLRPC::WEBrickServlet
-== Synopsis
-
- require "webrick"
- require "xmlrpc/server"
-
- s = XMLRPC::WEBrickServlet.new
- s.add_handler("michael.add") do |a,b|
- a + b
- end
-
- s.add_handler("michael.div") do |a,b|
- if b == 0
- raise XMLRPC::FaultException.new(1, "division by zero")
- else
- a / b
- end
- end
-
- s.set_default_handler do |name, *args|
- raise XMLRPC::FaultException.new(-99, "Method #{name} missing" +
- " or wrong number of parameters!")
- end
-
- httpserver = WEBrick::HTTPServer.new(:Port => 8080)
- httpserver.mount("/RPC2", s)
- trap("HUP") { httpserver.shutdown } # use 1 instead of "HUP" on Windows
- httpserver.start
-
-== Instance Methods
-
---- XMLRPC::WEBrickServlet#set_valid_ip( *ip_addr )
- Specifies the valid IP addresses that are allowed to connect to the server.
- Each IP is either a (({String})) or a (({Regexp})).
-
---- XMLRPC::WEBrickServlet#get_valid_ip
- Return the via method ((<set_valid_ip|XMLRPC::Server#set_valid_ip>)) specified
- valid IP addresses.
-
-== Description
-Implements a servlet for use with WEBrick, a pure Ruby (HTTP-) server framework.
-
-== Superclass
-((<XMLRPC::BasicServer>))
-
-=end
+# Implements a servlet for use with WEBrick, a pure Ruby (HTTP) server
+# framework.
+#
+# require "webrick"
+# require "xmlrpc/server"
+#
+# s = XMLRPC::WEBrickServlet.new
+# s.add_handler("michael.add") do |a,b|
+# a + b
+# end
+#
+# s.add_handler("michael.div") do |a,b|
+# if b == 0
+# raise XMLRPC::FaultException.new(1, "division by zero")
+# else
+# a / b
+# end
+# end
+#
+# s.set_default_handler do |name, *args|
+# raise XMLRPC::FaultException.new(-99, "Method #{name} missing" +
+# " or wrong number of parameters!")
+# end
+#
+# httpserver = WEBrick::HTTPServer.new(:Port => 8080)
+# httpserver.mount("/RPC2", s)
+# trap("HUP") { httpserver.shutdown } # use 1 instead of "HUP" on Windows
+# httpserver.start
class WEBrickServlet < BasicServer
def initialize(*a)
super
@@ -707,8 +631,7 @@ class WEBrickServlet < BasicServer
@valid_ip = nil
end
- # deprecated from WEBrick/1.2.2.
- # but does not break anything.
+ # Deprecated from WEBrick/1.2.2, but does not break anything.
def require_path_info?
false
end
@@ -718,6 +641,9 @@ class WEBrickServlet < BasicServer
self
end
+ # Specifies the valid IP addresses that are allowed to connect to the server.
+ #
+ # Each IP is either a String or a Regexp.
def set_valid_ip(*ip_addr)
if ip_addr.size == 1 and ip_addr[0].nil?
@valid_ip = nil
@@ -726,6 +652,9 @@ class WEBrickServlet < BasicServer
end
end
+ # Return the valid IP addresses that are allowed to connect to the server.
+ #
+ # See also, XMLRPC::Server#set_valid_ip
def get_valid_ip
@valid_ip
end
diff --git a/lib/xmlrpc/utils.rb b/lib/xmlrpc/utils.rb
index b86509cb3a..186938a56e 100644
--- a/lib/xmlrpc/utils.rb
+++ b/lib/xmlrpc/utils.rb
@@ -1,32 +1,41 @@
#
-# Defines ParserWriterChooseMixin, which makes it possible to choose a
-# different XML writer and/or XML parser then the default one.
-# The Mixin is used in client.rb (class Client) and server.rb (class
-# BasicServer)
-#
# Copyright (C) 2001, 2002, 2003 by Michael Neumann (mneumann@ntecs.de)
#
# $Id$
#
+module XMLRPC # :nodoc:
-module XMLRPC
- #
# This module enables a user-class to be marshalled
# by XML-RPC for Ruby into a Hash, with one additional
- # key/value pair "___class___" => ClassName
+ # key/value pair <code>___class___ => ClassName</code>
#
module Marshallable
end
+ # Defines ParserWriterChooseMixin, which makes it possible to choose a
+ # different XMLWriter and/or XMLParser then the default one.
+ #
+ # The Mixin is used in client.rb (class XMLRPC::Client)
+ # and server.rb (class XMLRPC::BasicServer)
module ParserWriterChooseMixin
+ # Sets the XMLWriter to use for generating XML output.
+ #
+ # Should be an instance of a class from module XMLRPC::XMLWriter.
+ #
+ # If this method is not called, then XMLRPC::Config::DEFAULT_WRITER is used.
def set_writer(writer)
@create = Create.new(writer)
self
end
+ # Sets the XMLParser to use for parsing XML documents.
+ #
+ # Should be an instance of a class from module XMLRPC::XMLParser.
+ #
+ # If this method is not called, then XMLRPC::Config::DEFAULT_PARSER is used.
def set_parser(parser)
@parser = parser
self
@@ -55,11 +64,8 @@ module XMLRPC
module Service
- #
- # base class for Service Interface definitions, used
- # by BasicServer#add_handler
- #
-
+ # Base class for XMLRPC::Service::Interface definitions, used
+ # by XMLRPC::BasicServer#add_handler
class BasicInterface
attr_reader :prefix, :methods
@@ -82,7 +88,7 @@ module XMLRPC
@methods << [mname, meth_name || mname, sig, help]
end
- private # ---------------------------------
+ private
def parse_sig(sig)
# sig is a String
@@ -99,8 +105,8 @@ module XMLRPC
end # class BasicInterface
#
- # class which wraps a Service Interface definition, used
- # by BasicServer#add_handler
+ # Class which wraps a XMLRPC::Service::Interface definition, used
+ # by XMLRPC::BasicServer#add_handler
#
class Interface < BasicInterface
def initialize(prefix, &p)
@@ -116,7 +122,7 @@ module XMLRPC
}
end
- private # ---------------------------------
+ private
def meth(*a)
add_method(*a)
@@ -142,13 +148,13 @@ module XMLRPC
#
- # short-form to create a Service::Interface
+ # Short-form to create a XMLRPC::Service::Interface
#
def self.interface(prefix, &p)
Service::Interface.new(prefix, &p)
end
- # short-cut for creating a PublicInstanceMethodsInterface
+ # Short-cut for creating a XMLRPC::Service::PublicInstanceMethodsInterface
def self.iPIMethods(prefix)
Service::PublicInstanceMethodsInterface.new(prefix)
end
diff --git a/lib/yaml.rb b/lib/yaml.rb
index 3461f68606..f9f8e6d665 100644
--- a/lib/yaml.rb
+++ b/lib/yaml.rb
@@ -1,9 +1,56 @@
+##
+# The YAML module is an alias of Psych, the YAML engine for Ruby.
+
+begin
+ require 'psych'
+rescue LoadError
+ warn "#{caller[0]}:"
+ warn "It seems your ruby installation is missing psych (for YAML output)."
+ warn "To eliminate this warning, please install libyaml and reinstall your ruby."
+ raise
+end
+
+YAML = Psych # :nodoc:
+
+module Psych # :nodoc:
+ # For compatibility, deprecated
+ class EngineManager # :nodoc:
+ attr_reader :yamler # :nodoc:
+
+ def initialize # :nodoc:
+ @yamler = 'psych'
+ end
+
+ def syck? # :nodoc:
+ false
+ end
+
+ # Psych is always used and this method has no effect.
+ #
+ # This method is still present for compatibility.
+ #
+ # You may still use the Syck engine by installing
+ # the 'syck' gem and using the Syck constant.
+ def yamler= engine # :nodoc:
+ case engine
+ when 'syck' then warn "syck has been removed, psych is used instead"
+ when 'psych' then @yamler = 'psych'
+ else
+ raise(ArgumentError, "bad engine")
+ end
+
+ engine
+ end
+ end
+
+ ENGINE = EngineManager.new # :nodoc:
+end
+
# YAML Ain't Markup Language
#
# This module provides a Ruby interface for data serialization in YAML format.
#
-# You can choose from one of two YAML engines that ship with Ruby 1.9. By
-# default Psych is used but the old unmaintained Syck may chosen.
+# The underlying implementation is the libyaml wrapper Psych.
#
# == Usage
#
@@ -23,16 +70,13 @@
# malicious input to execute arbitrary code inside your application. Please see
# doc/security.rdoc for more information.
#
-# == Syck
+# == History
#
# Syck was the original for YAML implementation in Ruby's standard library
# developed by why the lucky stiff.
#
-# If you prefer, you can still use Syck by changing the YAML::ENGINE like so:
-#
-# YAML::ENGINE.yamler = 'syck'
-# # switch back to the default Psych
-# YAML::ENGINE.yamler = 'psych'
+# You can still use Syck, if you prefer, for parsing and emitting YAML, but you
+# must install the 'syck' gem now in order to use it.
#
# In older Ruby versions, ie. <= 1.9, Syck is still provided, however it was
# completely removed with the release of Ruby 2.0.0.
@@ -42,63 +86,4 @@
# For more advanced details on the implementation see Psych, and also check out
# http://yaml.org for spec details and other helpful information.
module YAML
- class EngineManager # :nodoc:
- attr_reader :yamler
-
- def initialize
- @yamler = nil
- end
-
- def syck?
- 'syck' == @yamler
- end
-
- def yamler= engine
- raise(ArgumentError, "bad engine") unless %w{syck psych}.include?(engine)
-
- require engine unless (engine == 'syck' ? Syck : Psych).const_defined?(:VERSION)
-
- Object.class_eval <<-eorb, __FILE__, __LINE__ + 1
- remove_const 'YAML'
- YAML = #{engine.capitalize}
- remove_method :to_yaml
- alias :to_yaml :#{engine}_to_yaml
- eorb
-
- @yamler = engine
- engine
- end
- end
-
- ##
- # Allows changing the current YAML engine. See YAML for details.
-
- ENGINE = YAML::EngineManager.new # :nodoc:
-end
-
-if defined?(Psych)
- engine = 'psych'
-elsif defined?(Syck)
- engine = 'syck'
-else
- begin
- require 'psych'
- engine = 'psych'
- rescue LoadError
- warn "#{caller[0]}:"
- warn "It seems your ruby installation is missing psych (for YAML output)."
- warn "To eliminate this warning, please install libyaml and reinstall your ruby."
- require 'syck'
- engine = 'syck'
- end
-end
-
-module Syck # :nodoc:
- ENGINE = YAML::ENGINE
end
-
-module Psych # :nodoc:
- ENGINE = YAML::ENGINE
-end
-
-YAML::ENGINE.yamler = engine
diff --git a/lib/yaml/dbm.rb b/lib/yaml/dbm.rb
index 07441f53ad..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 )
@@ -57,15 +66,35 @@ class DBM < ::DBM
end
# Deprecated, used YAML::DBM#key instead.
+ # ----
+ # Note:
+ # YAML::DBM#index makes warning from internal of ::DBM#index.
+ # It says 'DBM#index is deprecated; use DBM#key', but DBM#key
+ # behaves not same as DBM#index.
+ #
def index( keystr )
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+.
@@ -77,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.
#
@@ -88,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
@@ -95,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+.
@@ -103,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+.
@@ -111,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.
#
@@ -133,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.
@@ -141,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+.
#
@@ -152,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.
@@ -168,29 +224,35 @@ 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.
#
# Returns +self+.
def update( hsh )
- hsh.keys.each do |k|
- self.store( k, hsh.fetch( k ) )
+ hsh.each_pair do |k,v|
+ self.store( k, v )
end
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
@@ -200,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/lib/yaml/store.rb b/lib/yaml/store.rb
index 82d6ee1aaa..b0b580ba1a 100644
--- a/lib/yaml/store.rb
+++ b/lib/yaml/store.rb
@@ -46,20 +46,15 @@ class YAML::Store < PStore
#
# Options passed in through +yaml_opts+ will be used when converting the
# store to YAML via Hash#to_yaml().
- def initialize( *o )
- @opt = {}
- if String === o.first
- super(o.shift)
- end
- if o.last.is_a? Hash
- @opt.update(o.pop)
- end
+ def initialize file_name, yaml_opts = {}
+ @opt = yaml_opts
+ super
end
# :stopdoc:
def dump(table)
- @table.to_yaml(@opt)
+ YAML.dump @table
end
def load(content)
@@ -75,7 +70,7 @@ class YAML::Store < PStore
false
end
- EMPTY_MARSHAL_DATA = {}.to_yaml
+ EMPTY_MARSHAL_DATA = YAML.dump({})
EMPTY_MARSHAL_CHECKSUM = Digest::MD5.digest(EMPTY_MARSHAL_DATA)
def empty_marshal_data
EMPTY_MARSHAL_DATA
diff --git a/load.c b/load.c
index 163ec4c442..141c02f33b 100644
--- a/load.c
+++ b/load.c
@@ -7,6 +7,8 @@
#include "internal.h"
#include "dln.h"
#include "eval_intern.h"
+#include "probes.h"
+#include "node.h"
VALUE ruby_dln_librefs;
@@ -18,7 +20,6 @@ VALUE ruby_dln_librefs;
#define IS_DLEXT(e) (strcmp((e), DLEXT) == 0)
#endif
-
static const char *const loadable_ext[] = {
".rb", DLEXT,
#ifdef DLEXT2
@@ -34,21 +35,120 @@ rb_get_load_path(void)
return load_path;
}
-VALUE
-rb_get_expanded_load_path(void)
+enum expand_type {
+ EXPAND_ALL,
+ EXPAND_RELATIVE,
+ EXPAND_HOME,
+ EXPAND_NON_CACHE
+};
+
+/* Construct expanded load path and store it to cache.
+ We rebuild load path partially if the cache is invalid.
+ We don't cache non string object and expand it every time. We ensure that
+ string objects in $LOAD_PATH are frozen.
+ */
+static void
+rb_construct_expanded_load_path(int type, int *has_relative, int *has_non_cache)
{
- VALUE load_path = rb_get_load_path();
+ rb_vm_t *vm = GET_VM();
+ VALUE load_path = vm->load_path;
+ VALUE expanded_load_path = vm->expanded_load_path;
VALUE ary;
long i;
+ int level = rb_safe_level();
- ary = rb_ary_new2(RARRAY_LEN(load_path));
+ ary = rb_ary_tmp_new(RARRAY_LEN(load_path));
for (i = 0; i < RARRAY_LEN(load_path); ++i) {
- VALUE path = rb_file_expand_path_fast(RARRAY_PTR(load_path)[i], Qnil);
- rb_str_freeze(path);
- rb_ary_push(ary, path);
+ VALUE path, as_str, expanded_path;
+ int is_string, non_cache;
+ char *as_cstr;
+ 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);
+ as_cstr = RSTRING_PTR(as_str);
+
+ if (!non_cache) {
+ if ((type == EXPAND_RELATIVE &&
+ rb_is_absolute_path(as_cstr)) ||
+ (type == EXPAND_HOME &&
+ (!as_cstr[0] || as_cstr[0] != '~')) ||
+ (type == EXPAND_NON_CACHE)) {
+ /* Use cached expanded path. */
+ rb_ary_push(ary, RARRAY_AREF(expanded_load_path, i));
+ continue;
+ }
+ }
+ if (!*has_relative && !rb_is_absolute_path(as_cstr))
+ *has_relative = 1;
+ if (!*has_non_cache && non_cache)
+ *has_non_cache = 1;
+ /* Freeze only string object. We expand other objects every time. */
+ if (is_string)
+ rb_str_freeze(path);
+ as_str = rb_get_path_check_convert(path, as_str, level);
+ expanded_path = rb_file_expand_path_fast(as_str, Qnil);
+ rb_str_freeze(expanded_path);
+ rb_ary_push(ary, expanded_path);
}
rb_obj_freeze(ary);
- return ary;
+ vm->expanded_load_path = ary;
+ rb_ary_replace(vm->load_path_snapshot, vm->load_path);
+}
+
+static VALUE
+load_path_getcwd(void)
+{
+ char *cwd = my_getcwd();
+ VALUE cwd_str = rb_filesystem_str_new_cstr(cwd);
+ xfree(cwd);
+ return cwd_str;
+}
+
+VALUE
+rb_get_expanded_load_path(void)
+{
+ rb_vm_t *vm = GET_VM();
+ const VALUE non_cache = Qtrue;
+
+ if (!rb_ary_shared_with_p(vm->load_path_snapshot, vm->load_path)) {
+ /* The load path was modified. Rebuild the expanded load path. */
+ int has_relative = 0, has_non_cache = 0;
+ rb_construct_expanded_load_path(EXPAND_ALL, &has_relative, &has_non_cache);
+ if (has_relative) {
+ vm->load_path_check_cache = load_path_getcwd();
+ }
+ else if (has_non_cache) {
+ /* Non string object. */
+ vm->load_path_check_cache = non_cache;
+ }
+ else {
+ vm->load_path_check_cache = 0;
+ }
+ }
+ else if (vm->load_path_check_cache == non_cache) {
+ int has_relative = 1, has_non_cache = 1;
+ /* Expand only non-cacheable objects. */
+ rb_construct_expanded_load_path(EXPAND_NON_CACHE,
+ &has_relative, &has_non_cache);
+ }
+ else if (vm->load_path_check_cache) {
+ int has_relative = 1, has_non_cache = 1;
+ VALUE cwd = load_path_getcwd();
+ if (!rb_str_equal(vm->load_path_check_cache, cwd)) {
+ /* Current working directory or filesystem encoding was changed.
+ Expand relative load path and non-cacheable objects again. */
+ vm->load_path_check_cache = cwd;
+ rb_construct_expanded_load_path(EXPAND_RELATIVE,
+ &has_relative, &has_non_cache);
+ }
+ else {
+ /* Expand only tilde (User HOME) and non-cacheable objects. */
+ rb_construct_expanded_load_path(EXPAND_HOME,
+ &has_relative, &has_non_cache);
+ }
+ }
+ return vm->expanded_load_path;
}
static VALUE
@@ -63,12 +163,147 @@ get_loaded_features(void)
return GET_VM()->loaded_features;
}
+static void
+reset_loaded_features_snapshot(void)
+{
+ rb_vm_t *vm = GET_VM();
+ rb_ary_replace(vm->loaded_features_snapshot, vm->loaded_features);
+}
+
+static struct st_table *
+get_loaded_features_index_raw(void)
+{
+ return GET_VM()->loaded_features_index;
+}
+
static st_table *
get_loading_table(void)
{
return GET_VM()->loading_table;
}
+static void
+features_index_add_single(VALUE short_feature, VALUE offset)
+{
+ struct st_table *features_index;
+ VALUE this_feature_index = Qnil;
+ char *short_feature_cstr;
+
+ Check_Type(offset, T_FIXNUM);
+ Check_Type(short_feature, T_STRING);
+ short_feature_cstr = StringValueCStr(short_feature);
+
+ features_index = get_loaded_features_index_raw();
+ st_lookup(features_index, (st_data_t)short_feature_cstr, (st_data_t *)&this_feature_index);
+
+ if (NIL_P(this_feature_index)) {
+ st_insert(features_index, (st_data_t)ruby_strdup(short_feature_cstr), (st_data_t)offset);
+ }
+ else if (RB_TYPE_P(this_feature_index, T_FIXNUM)) {
+ VALUE feature_indexes[2];
+ feature_indexes[0] = this_feature_index;
+ feature_indexes[1] = offset;
+ this_feature_index = rb_ary_tmp_new(numberof(feature_indexes));
+ rb_ary_cat(this_feature_index, feature_indexes, numberof(feature_indexes));
+ st_insert(features_index, (st_data_t)short_feature_cstr, (st_data_t)this_feature_index);
+ }
+ else {
+ Check_Type(this_feature_index, T_ARRAY);
+ rb_ary_push(this_feature_index, offset);
+ }
+}
+
+/* Add to the loaded-features index all the required entries for
+ `feature`, located at `offset` in $LOADED_FEATURES. We add an
+ index entry at each string `short_feature` for which
+ feature == "#{prefix}#{short_feature}#{e}"
+ where `e` is empty or matches %r{^\.[^./]*$}, and `prefix` is empty
+ or ends in '/'. This maintains the invariant that `rb_feature_p()`
+ relies on for its fast lookup.
+*/
+static void
+features_index_add(VALUE feature, VALUE offset)
+{
+ VALUE short_feature;
+ const char *feature_str, *feature_end, *ext, *p;
+
+ feature_str = StringValuePtr(feature);
+ feature_end = feature_str + RSTRING_LEN(feature);
+
+ for (ext = feature_end; ext > feature_str; ext--)
+ if (*ext == '.' || *ext == '/')
+ break;
+ if (*ext != '.')
+ ext = NULL;
+ /* Now `ext` points to the only string matching %r{^\.[^./]*$} that is
+ at the end of `feature`, or is NULL if there is no such string. */
+
+ p = ext ? ext : feature_end;
+ while (1) {
+ p--;
+ while (p >= feature_str && *p != '/')
+ p--;
+ if (p < feature_str)
+ break;
+ /* Now *p == '/'. We reach this point for every '/' in `feature`. */
+ short_feature = rb_str_subseq(feature, p + 1 - feature_str, feature_end - p - 1);
+ features_index_add_single(short_feature, offset);
+ if (ext) {
+ short_feature = rb_str_subseq(feature, p + 1 - feature_str, ext - p - 1);
+ features_index_add_single(short_feature, offset);
+ }
+ }
+ features_index_add_single(feature, offset);
+ if (ext) {
+ short_feature = rb_str_subseq(feature, 0, ext - feature_str);
+ features_index_add_single(short_feature, offset);
+ }
+}
+
+static int
+loaded_features_index_clear_i(st_data_t key, st_data_t val, st_data_t arg)
+{
+ xfree((char *)key);
+ return ST_DELETE;
+}
+
+static st_table *
+get_loaded_features_index(void)
+{
+ VALUE features;
+ int i;
+ rb_vm_t *vm = GET_VM();
+
+ if (!rb_ary_shared_with_p(vm->loaded_features_snapshot, vm->loaded_features)) {
+ /* The sharing was broken; something (other than us in rb_provide_feature())
+ modified loaded_features. Rebuild the index. */
+ st_foreach(vm->loaded_features_index, loaded_features_index_clear_i, 0);
+ features = vm->loaded_features;
+ for (i = 0; i < RARRAY_LEN(features); i++) {
+ VALUE entry, as_str;
+ as_str = entry = rb_ary_entry(features, i);
+ StringValue(as_str);
+ if (as_str != entry)
+ rb_ary_store(features, i, as_str);
+ rb_str_freeze(as_str);
+ features_index_add(as_str, INT2FIX(i));
+ }
+ reset_loaded_features_snapshot();
+ }
+ return vm->loaded_features_index;
+}
+
+/* This searches `load_path` for a value such that
+ name == "#{load_path[i]}/#{feature}"
+ if `feature` is a suffix of `name`, or otherwise
+ name == "#{load_path[i]}/#{feature}#{ext}"
+ for an acceptable string `ext`. It returns
+ `load_path[i].to_str` if found, else 0.
+
+ If type is 's', then `ext` is acceptable only if IS_DLEXT(ext);
+ if 'r', then only if IS_RBEXT(ext); otherwise `ext` may be absent
+ or have any value matching `%r{^\.[^./]*$}`.
+*/
static VALUE
loaded_feature_path(const char *name, long vlen, const char *feature, long len,
int type, VALUE load_path)
@@ -77,34 +312,38 @@ loaded_feature_path(const char *name, long vlen, const char *feature, long len,
long plen;
const char *e;
- if(vlen < len) return 0;
- if (!strncmp(name+(vlen-len),feature,len)){
- plen = vlen - len - 1;
- } else {
+ if (vlen < len+1) return 0;
+ if (!strncmp(name+(vlen-len), feature, len)) {
+ plen = vlen - len;
+ }
+ else {
for (e = name + vlen; name != e && *e != '.' && *e != '/'; --e);
- if (*e!='.' ||
+ if (*e != '.' ||
e-name < len ||
- strncmp(e-len,feature,len) )
+ strncmp(e-len, feature, len))
return 0;
- plen = e - name - len - 1;
+ plen = e - name - len;
}
+ if (plen > 0 && name[plen-1] != '/') {
+ return 0;
+ }
+ if (type == 's' ? !IS_DLEXT(&name[plen+len]) :
+ type == 'r' ? !IS_RBEXT(&name[plen+len]) :
+ 0) {
+ return 0;
+ }
+ /* Now name == "#{prefix}/#{feature}#{ext}" where ext is acceptable
+ (possibly empty) and prefix is some string of length plen. */
+
+ 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);
- if (n != plen ) continue;
- if (n && (strncmp(name, s, n) || name[n] != '/')) continue;
- switch (type) {
- case 's':
- if (IS_DLEXT(&name[n+len+1])) return p;
- break;
- case 'r':
- if (IS_RBEXT(&name[n+len+1])) return p;
- break;
- default:
- return p;
- }
+ if (n != plen) continue;
+ if (n && strncmp(name, s, n)) continue;
+ return p;
}
return 0;
}
@@ -132,10 +371,10 @@ loaded_feature_path_i(st_data_t v, st_data_t b, st_data_t f)
static int
rb_feature_p(const char *feature, const char *ext, int rb, int expanded, const char **fn)
{
- VALUE v, features, p, load_path = 0;
+ VALUE features, this_feature_index = Qnil, v, p, load_path = 0;
const char *f, *e;
long i, len, elen, n;
- st_table *loading_tbl;
+ st_table *loading_tbl, *features_index;
st_data_t data;
int type;
@@ -151,30 +390,74 @@ rb_feature_p(const char *feature, const char *ext, int rb, int expanded, const c
type = 0;
}
features = get_loaded_features();
- for (i = 0; i < RARRAY_LEN(features); ++i) {
- v = RARRAY_PTR(features)[i];
- 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';
+ features_index = get_loaded_features_index();
+
+ st_lookup(features_index, (st_data_t)feature, (st_data_t *)&this_feature_index);
+ /* We search `features` for an entry such that either
+ "#{features[i]}" == "#{load_path[j]}/#{feature}#{e}"
+ for some j, or
+ "#{features[i]}" == "#{feature}#{e}"
+ Here `e` is an "allowed" extension -- either empty or one
+ of the extensions accepted by IS_RBEXT, IS_SOEXT, or
+ IS_DLEXT. Further, if `ext && rb` then `IS_RBEXT(e)`,
+ and if `ext && !rb` then `IS_SOEXT(e) || IS_DLEXT(e)`.
+
+ If `expanded`, then only the latter form (without load_path[j])
+ is accepted. Otherwise either form is accepted, *unless* `ext`
+ is false and an otherwise-matching entry of the first form is
+ preceded by an entry of the form
+ "#{features[i2]}" == "#{load_path[j2]}/#{feature}#{e2}"
+ where `e2` matches %r{^\.[^./]*$} but is not an allowed extension.
+ After a "distractor" entry of this form, only entries of the
+ form "#{feature}#{e}" are accepted.
+
+ In `rb_provide_feature()` and `get_loaded_features_index()` we
+ maintain an invariant that the array `this_feature_index` will
+ point to every entry in `features` which has the form
+ "#{prefix}#{feature}#{e}"
+ where `e` is empty or matches %r{^\.[^./]*$}, and `prefix` is empty
+ or ends in '/'. This includes both match forms above, as well
+ as any distractors, so we may ignore all other entries in `features`.
+ */
+ 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';
+ }
}
}
+
loading_tbl = get_loading_table();
if (loading_tbl) {
f = 0;
@@ -183,7 +466,7 @@ rb_feature_p(const char *feature, const char *ext, int rb, int expanded, const c
fs.name = feature;
fs.len = len;
fs.type = type;
- fs.load_path = load_path ? load_path : rb_get_load_path();
+ fs.load_path = load_path ? load_path : rb_get_expanded_load_path();
fs.result = 0;
st_foreach(loading_tbl, loaded_feature_path_i, (st_data_t)&fs);
if ((f = fs.result) != 0) {
@@ -200,6 +483,9 @@ rb_feature_p(const char *feature, const char *ext, int rb, int expanded, const c
else {
VALUE bufstr;
char *buf;
+ static const char so_ext[][4] = {
+ ".so", ".o",
+ };
if (ext && *ext) return 0;
bufstr = rb_str_tmp_new(len + DLEXT_MAXLEN);
@@ -213,6 +499,14 @@ rb_feature_p(const char *feature, const char *ext, int rb, int expanded, const c
return i ? 's' : 'r';
}
}
+ for (i = 0; i < numberof(so_ext); i++) {
+ strlcpy(buf + len, so_ext[i], DLEXT_MAXLEN + 1);
+ if (st_get_key(loading_tbl, (st_data_t)buf, &data)) {
+ rb_str_resize(bufstr, 0);
+ if (fn) *fn = (const char*)data;
+ return 's';
+ }
+ }
rb_str_resize(bufstr, 0);
}
}
@@ -233,7 +527,7 @@ rb_feature_provided(const char *feature, const char **loading)
if (*feature == '.' &&
(feature[1] == '/' || strncmp(feature+1, "./", 2) == 0)) {
- fullpath = rb_file_expand_path_fast(rb_str_new2(feature), Qnil);
+ fullpath = rb_file_expand_path_fast(rb_get_path(rb_str_new2(feature)), Qnil);
feature = RSTRING_PTR(fullpath);
}
if (ext && !strchr(ext, '/')) {
@@ -254,11 +548,18 @@ rb_feature_provided(const char *feature, const char **loading)
static void
rb_provide_feature(VALUE feature)
{
- if (OBJ_FROZEN(get_loaded_features())) {
+ VALUE features;
+
+ features = get_loaded_features();
+ if (OBJ_FROZEN(features)) {
rb_raise(rb_eRuntimeError,
"$LOADED_FEATURES is frozen; cannot append feature");
}
- rb_ary_push(get_loaded_features(), feature);
+ rb_str_freeze(feature);
+
+ rb_ary_push(features, feature);
+ features_index_add(feature, INT2FIX(RARRAY_LEN(features)-1));
+ reset_loaded_features_snapshot();
}
void
@@ -269,23 +570,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 {
@@ -303,7 +602,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--;
@@ -311,7 +610,7 @@ rb_load_internal(VALUE fname, int wrap)
}
POP_TAG();
-#ifndef __GNUC__
+#if !defined __GNUC__
th = th0;
fname = RB_GC_GUARD(fname);
#endif
@@ -319,20 +618,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, Qundef);
+ 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)
{
@@ -375,6 +680,13 @@ rb_f_load(int argc, VALUE *argv)
VALUE fname, wrap, path;
rb_scan_args(argc, argv, "11", &fname, &wrap);
+
+ if (RUBY_DTRACE_LOAD_ENTRY_ENABLED()) {
+ RUBY_DTRACE_LOAD_ENTRY(StringValuePtr(fname),
+ rb_sourcefile(),
+ rb_sourceline());
+ }
+
path = rb_find_file(FilePathValue(fname));
if (!path) {
if (!rb_file_load_ok(RSTRING_PTR(fname)))
@@ -382,6 +694,13 @@ rb_f_load(int argc, VALUE *argv)
path = fname;
}
rb_load_internal(path, RTEST(wrap));
+
+ if (RUBY_DTRACE_LOAD_RETURN_ENABLED()) {
+ RUBY_DTRACE_LOAD_RETURN(StringValuePtr(fname),
+ rb_sourcefile(),
+ rb_sourceline());
+ }
+
return Qtrue;
}
@@ -398,15 +717,44 @@ load_lock(const char *ftptr)
}
/* partial state */
ftptr = ruby_strdup(ftptr);
- data = (st_data_t)rb_barrier_new();
+ data = (st_data_t)rb_thread_shield_new();
st_insert(loading_tbl, (st_data_t)ftptr, data);
return (char *)ftptr;
}
+ else if (RB_TYPE_P((VALUE)data, T_NODE) && nd_type((VALUE)data) == NODE_MEMO) {
+ NODE *memo = RNODE(data);
+ void (*init)(void) = (void (*)(void))memo->nd_cfnc;
+ data = (st_data_t)rb_thread_shield_new();
+ st_insert(loading_tbl, (st_data_t)ftptr, data);
+ (*init)();
+ return (char *)"";
+ }
if (RTEST(ruby_verbose)) {
rb_warning("loading in progress, circular require considered harmful - %s", ftptr);
- rb_backtrace();
+ rb_backtrace_print_to(rb_stderr);
+ }
+ switch (rb_thread_shield_wait((VALUE)data)) {
+ case Qfalse:
+ data = (st_data_t)ftptr;
+ st_insert(loading_tbl, data, (st_data_t)rb_thread_shield_new());
+ return 0;
+ case Qnil:
+ return 0;
+ }
+ return (char *)ftptr;
+}
+
+static int
+release_thread_shield(st_data_t *key, st_data_t *value, st_data_t done, int existing)
+{
+ VALUE thread_shield = (VALUE)*value;
+ if (!existing) return ST_STOP;
+ if (done ? rb_thread_shield_destroy(thread_shield) : rb_thread_shield_release(thread_shield)) {
+ /* still in-use */
+ return ST_CONTINUE;
}
- return RTEST(rb_barrier_wait((VALUE)data)) ? (char *)ftptr : 0;
+ xfree((char *)*key);
+ return ST_DELETE;
}
static void
@@ -414,17 +762,9 @@ load_unlock(const char *ftptr, int done)
{
if (ftptr) {
st_data_t key = (st_data_t)ftptr;
- st_data_t data;
st_table *loading_tbl = get_loading_table();
- if (st_delete(loading_tbl, &key, &data)) {
- VALUE barrier = (VALUE)data;
- xfree((char *)key);
- if (done)
- rb_barrier_destroy(barrier);
- else
- rb_barrier_release(barrier);
- }
+ st_update(loading_tbl, key, release_thread_shield, done);
}
}
@@ -458,6 +798,11 @@ load_unlock(const char *ftptr, int done)
*
* require "my-library.rb"
* require "db-driver"
+ *
+ * Any constants or globals within the loaded source file will be available
+ * in the calling program's global namespace. However, local variables will
+ * not be propagated to the loading environment.
+ *
*/
VALUE
@@ -479,7 +824,7 @@ rb_f_require_relative(VALUE obj, VALUE fname)
{
VALUE base = rb_current_realfilepath();
if (NIL_P(base)) {
- rb_raise(rb_eLoadError, "cannot infer basepath");
+ rb_loaderror("cannot infer basepath");
}
base = rb_file_dirname(base);
return rb_require_safe(rb_file_absolute_path(fname, base), rb_safe_level());
@@ -556,13 +901,16 @@ search_required(VALUE fname, volatile VALUE *path, int safe_level)
switch (type) {
case 0:
if (ft)
- break;
+ goto statically_linked;
ftptr = RSTRING_PTR(tmp);
return rb_feature_p(ftptr, 0, FALSE, TRUE, 0);
default:
- if (ft)
- break;
+ if (ft) {
+ statically_linked:
+ if (loading) *path = rb_filesystem_str_new_cstr(loading);
+ return ft;
+ }
case 1:
ext = strrchr(ftptr = RSTRING_PTR(tmp), '.');
if (rb_feature_p(ftptr, ext, !--type, TRUE, &loading) && !loading)
@@ -575,9 +923,7 @@ search_required(VALUE fname, volatile VALUE *path, int safe_level)
static void
load_failed(VALUE fname)
{
- VALUE mesg = rb_str_buf_new_cstr("cannot load such file -- ");
- rb_str_append(mesg, fname); /* should be ASCII compatible */
- rb_exc_raise(rb_exc_new3(rb_eLoadError, mesg));
+ rb_load_fail(fname, "cannot load such file");
}
static VALUE
@@ -599,6 +945,12 @@ rb_require_safe(VALUE fname, int safe)
} volatile saved;
char *volatile ftptr = 0;
+ if (RUBY_DTRACE_REQUIRE_ENTRY_ENABLED()) {
+ RUBY_DTRACE_REQUIRE_ENTRY(StringValuePtr(fname),
+ rb_sourcefile(),
+ rb_sourceline());
+ }
+
PUSH_TAG();
saved.safe = rb_safe_level();
if ((state = EXEC_TAG()) == 0) {
@@ -609,11 +961,29 @@ rb_require_safe(VALUE fname, int safe)
rb_set_safe_level_force(safe);
FilePathValue(fname);
rb_set_safe_level_force(0);
- found = search_required(fname, &path, safe);
+
+ if (RUBY_DTRACE_FIND_REQUIRE_ENTRY_ENABLED()) {
+ RUBY_DTRACE_FIND_REQUIRE_ENTRY(StringValuePtr(fname),
+ rb_sourcefile(),
+ rb_sourceline());
+ }
+
+ path = rb_str_encode_ospath(fname);
+ found = search_required(path, &path, safe);
+
+ if (RUBY_DTRACE_FIND_REQUIRE_RETURN_ENABLED()) {
+ RUBY_DTRACE_FIND_REQUIRE_RETURN(StringValuePtr(fname),
+ rb_sourcefile(),
+ rb_sourceline());
+ }
if (found) {
if (!path || !(ftptr = load_lock(RSTRING_PTR(path)))) {
result = Qfalse;
}
+ else if (!*ftptr) {
+ rb_provide_feature(path);
+ result = Qtrue;
+ }
else {
switch (found) {
case 'r':
@@ -645,6 +1015,12 @@ rb_require_safe(VALUE fname, int safe)
th->errinfo = errinfo;
+ if (RUBY_DTRACE_REQUIRE_RETURN_ENABLED()) {
+ RUBY_DTRACE_REQUIRE_RETURN(StringValuePtr(fname),
+ rb_sourcefile(),
+ rb_sourceline());
+ }
+
return result;
}
@@ -656,23 +1032,30 @@ rb_require(const char *fname)
return rb_require_safe(fn, rb_safe_level());
}
-static VALUE
-init_ext_call(VALUE arg)
+static int
+register_init_ext(st_data_t *key, st_data_t *value, st_data_t init, int existing)
{
- SCOPE_SET(NOEX_PUBLIC);
- (*(void (*)(void))arg)();
- return Qnil;
+ const char *name = (char *)*key;
+ if (existing) {
+ /* already registered */
+ rb_warn("%s is already registered", name);
+ }
+ else {
+ *value = (st_data_t)NEW_MEMO(init, 0, 0);
+ *key = (st_data_t)ruby_strdup(name);
+ }
+ return ST_CONTINUE;
}
RUBY_FUNC_EXPORTED void
ruby_init_ext(const char *name, void (*init)(void))
{
- if (load_lock(name)) {
- rb_vm_call_cfunc(rb_vm_top_self(), init_ext_call, (VALUE)init,
- 0, rb_str_new2(name));
- rb_provide(name);
- load_unlock(name, 1);
+ st_table *loading_tbl = get_loading_table();
+
+ 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);
}
/*
@@ -715,7 +1098,11 @@ rb_mod_autoload(VALUE mod, VALUE sym, VALUE file)
static VALUE
rb_mod_autoload_p(VALUE mod, VALUE sym)
{
- return rb_autoload_p(mod, rb_to_id(sym));
+ ID id = rb_check_id(&sym);
+ if (!id) {
+ return Qnil;
+ }
+ return rb_autoload_p(mod, id);
}
/*
@@ -774,10 +1161,15 @@ Init_load()
rb_alias_variable(rb_intern("$-I"), id_load_path);
rb_alias_variable(rb_intern("$LOAD_PATH"), id_load_path);
vm->load_path = rb_ary_new();
+ vm->expanded_load_path = rb_ary_tmp_new(0);
+ vm->load_path_snapshot = rb_ary_tmp_new(0);
+ vm->load_path_check_cache = 0;
rb_define_virtual_variable("$\"", get_loaded_features, 0);
rb_define_virtual_variable("$LOADED_FEATURES", get_loaded_features, 0);
vm->loaded_features = rb_ary_new();
+ vm->loaded_features_snapshot = rb_ary_tmp_new(0);
+ vm->loaded_features_index = st_init_strtable();
rb_define_global_function("load", rb_f_load, -1);
rb_define_global_function("require", rb_f_require, 1);
@@ -787,6 +1179,6 @@ Init_load()
rb_define_global_function("autoload", rb_f_autoload, 2);
rb_define_global_function("autoload?", rb_f_autoload_p, 1);
- ruby_dln_librefs = rb_ary_new();
+ ruby_dln_librefs = rb_ary_tmp_new(0);
rb_gc_register_mark_object(ruby_dln_librefs);
}
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..369013fc26
--- /dev/null
+++ b/localeinit.c
@@ -0,0 +1,65 @@
+/**********************************************************************
+
+ 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
+
+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(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
+}
+
+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(int) * 8 / 3 + 4];
+ snprintf(cp, sizeof cp, "CP%d", AreFileApisANSI() ? GetACP() : GetOEMCP());
+ idx = rb_enc_find_index(cp);
+ if (idx < 0) idx = ENCINDEX_ASCII;
+#else
+ idx = rb_enc_to_index(rb_default_external_encoding());
+#endif
+ return idx;
+}
diff --git a/main.c b/main.c
index e100cddba5..16da117732 100644
--- a/main.c
+++ b/main.c
@@ -11,7 +11,7 @@
#undef RUBY_EXPORT
#include "ruby.h"
-#include "debug.h"
+#include "vm_debug.h"
#ifdef HAVE_LOCALE_H
#include <locale.h>
#endif
@@ -19,8 +19,6 @@
#include <stdlib.h>
#endif
-RUBY_GLOBAL_SETUP
-
int
main(int argc, char **argv)
{
diff --git a/man/erb.1 b/man/erb.1
index 29c21b8a88..8c47e581d3 100644
--- a/man/erb.1
+++ b/man/erb.1
@@ -1,5 +1,5 @@
.\"Ruby is copyrighted by Yukihiro Matsumoto <matz@netlab.jp>.
-.Dd December 27, 2008
+.Dd November 7, 2012
.Dt ERB(1) "" "Ruby Programmers Reference Guide"
.Os UNIX
.Sh NAME
@@ -22,8 +22,8 @@ is a command line front-end for
.Li "ERB"
library, which is an implementation of eRuby.
.Pp
-eRuby provides an easy to use but powerful templating system for Ruby.
-Using eRuby, actual Ruby code can be added to any plain text document for the
+ERB provides an easy to use but powerful templating system for Ruby.
+Using ERB, actual Ruby code can be added to any plain text document for the
purposes of generating document information details and/or flow control.
.Pp
.Nm
@@ -146,10 +146,10 @@ class.
.Li Security vulnerabilities should be reported via an email to
.Aq security@ruby-lang.org Ns
.Li .
-Reported problems will be published after fixed.
+Reported problems will be published after being fixed.
.Pp
.Li And you can report other bugs and feature requests via the
-Ruby Issue Tracking System (http://redmine.ruby-lang.org).
+Ruby Issue Tracking System (http://bugs.ruby-lang.org).
Do not report security vulnerabilities
via the system because it publishes the vulnerabilities immediately.
.El
diff --git a/man/goruby.1 b/man/goruby.1
index f69b951a06..62a7bad23f 100644
--- a/man/goruby.1
+++ b/man/goruby.1
@@ -1,10 +1,10 @@
.\"Ruby is copyrighted by Yukihiro Matsumoto <matz@netlab.jp>.
-.Dd October 25, 2008
+.Dd November 7, 2012
.Dt GORUBY(1) "" "Ruby Programmers Reference Guide"
.Os UNIX
.Sh NAME
.Nm goruby
-.Nd Code-golfer's best friend
+.Nd A code-golfer's best friend
.Sh SYNOPSIS
.Nm
.Op options ...
@@ -14,12 +14,12 @@
.Sh DESCRIPTION
.Sy goruby
is a kind of Ruby language processor
-which recognizes extremely shorten programs as bellow;
+which recognizes extremely shortened programs as below:
.Bd -literal -offset indent
rq"date";s De.td
.Ed
.Pp
-This means
+Which means:
.Bd -literal -offset indent
require"date";puts Date.today
.Ed
@@ -35,5 +35,5 @@ The stiff version of Ruby interpreter.
.El
.Pp
.Sh AUTHORS
-Originally written by Nobuyoshi Nakada and developed by
+Originally written by Nobuyoshi Nakada and developed by the
Ruby core team.
diff --git a/man/irb.1 b/man/irb.1
index 451b2d8d9b..543217e099 100644
--- a/man/irb.1
+++ b/man/irb.1
@@ -1,5 +1,5 @@
.\"Ruby is copyrighted by Yukihiro Matsumoto <matz@netlab.jp>.
-.Dd October 25, 2008
+.Dd November 7, 2012
.Dt IRB(1) "" "Ruby Programmers Reference Guide"
.Os UNIX
.Sh NAME
@@ -27,7 +27,7 @@
.Pp
.Sh DESCRIPTION
.Nm
-is the REPL(read-eval&print loop) environment for Ruby programs.
+is the REPL(read-eval-print loop) environment for Ruby programs.
.Pp
.Sh OPTIONS
.Bl -tag -width "1234567890123" -compact
@@ -162,10 +162,10 @@ Personal irb initialization.
.Li Security vulnerabilities should be reported via an email to
.Aq security@ruby-lang.org Ns
.Li .
-Reported problems will be published after fixed.
+Reported problems will be published after being fixed.
.Pp
.Li And you can report other bugs and feature requests via the
-Ruby Issue Tracking System (http://redmine.ruby-lang.org).
+Ruby Issue Tracking System (http://bugs.ruby-lang.org).
Do not report security vulnerabilities
via the system because it publishes the vulnerabilities immediately.
.El
diff --git a/man/rake.1 b/man/rake.1
index 9f5126b839..265112fca5 100644
--- a/man/rake.1
+++ b/man/rake.1
@@ -1,4 +1,4 @@
-.Dd November 30, 2008
+.Dd November 7, 2012
.Dt RAKE(1) "" "Ruby Programmers Reference Guide"
.Os UNIX
.Sh NAME
@@ -152,16 +152,52 @@ 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/
+.Pa 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>.
+.Aq Pa http://onestepback.org/redmine/projects/show/rake .
.Pp
-You will need an account to before you can post issues. Register at <\fBhttp://onestepback.org/redmine/account/register\fR>.
+You will need an account to before you can post issues. Register at
+.Aq Pa http://onestepback.org/redmine/account/register .
Or you can send an email to the author.
.Sh AUTHOR
.Nm Rake
diff --git a/man/ri.1 b/man/ri.1
index ee3463a1a9..cadf4b8e16 100644
--- a/man/ri.1
+++ b/man/ri.1
@@ -1,5 +1,5 @@
.\"Ruby is copyrighted by Yukihiro Matsumoto <matz@netlab.jp>.
-.Dd December 29, 2008
+.Dd November 7, 2012
.Dt RI(1) "" "Ruby Programmers Reference Guide"
.Os UNIX
.Sh NAME
@@ -18,7 +18,7 @@
.Op Ar target ...
.Sh DESCRIPTION
.Nm
-is a CUI front end for the Ruby API reference.
+is a CLI front end for the Ruby API reference.
You can search and read API reference for classes and methods with
.Nm .
.Pp
@@ -77,7 +77,8 @@ directories. May be repeated.
.It Fl -fmt Ar FORMAT
.It Fl -format Ns = Ns FORMAT
Format to use when displaying output:
-.Dd ansi, bs, html, plain, simple
+.Pp
+ansi, bs, html, plain, simple
.Pp
Use 'bs' (backspace) with most pager programs. To use ANSI, either disable the
pager or tell the pager to allow control characters.
@@ -168,10 +169,10 @@ Searches user-wide documents here.
.Li Security vulnerabilities should be reported via an email to
.Aq security@ruby-lang.org Ns
.Li .
-Reported problems will be published after fixed.
+Reported problems will be published after being fixed.
.Pp
.Li And you can report other bugs and feature requests via the
-Ruby Issue Tracking System (http://redmine.ruby-lang.org).
+Ruby Issue Tracking System (http://bugs.ruby-lang.org).
Do not report security vulnerabilities
via the system because it publishes the vulnerabilities immediately.
.El
diff --git a/man/ruby.1 b/man/ruby.1
index 0f6f199725..0a9ba58df1 100644
--- a/man/ruby.1
+++ b/man/ruby.1
@@ -1,5 +1,5 @@
.\"Ruby is copyrighted by Yukihiro Matsumoto <matz@netlab.jp>.
-.Dd October 25, 2008
+.Dd November 7, 2012
.Dt RUBY(1) "" "Ruby Programmers Reference Guide"
.\".Dt RUBY 1
.Os UNIX
@@ -32,7 +32,7 @@
.Sh DESCRIPTION
Ruby is an 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,
+files and to do system management tasks (like in Perl). It is simple,
straight-forward, and extensible.
.Pp
If you want a language for easy object-oriented programming, or you
@@ -123,9 +123,8 @@ on-the-fly.
Libraries called "builtin libraries" and "standard libraries" are bundled with Ruby.
And you can obtain more libraries via the package management system called `RubyGems'.
.Pp
-Moreover there are thousands of Ruby projects in Rubyforge
-.Pf ( "http://www.rubyforge.org" ) and RAA
-.Pf ( "http://raa.ruby-lang.org" ) Ns .
+Moreover there are thousands of Ruby projects on GitHub
+.Aq Pa https://github.com/languages/Ruby .
.El
.Pp
.Sh OPTIONS
@@ -164,6 +163,10 @@ Specifies the default value(s) for external encodings and internal encoding. Val
You can omit the one for internal encodings, then the value
.Pf ( Li "Encoding.default_internal" ) will be nil.
.Pp
+.It Fl -external-encoding Ns = Ns Ar encoding
+.It Fl -internal-encoding Ns = Ns Ar encoding
+Specify the default external or internal character encoding
+.Pp
.It Fl F Ar pattern
Specifies input field separator
.Pf ( Li "$;" ) .
@@ -195,7 +198,7 @@ ASCII-8BIT (BINARY)
.It Fl S
Makes Ruby use the
.Ev PATH
-environment variable to search for script, unless if its name begins
+environment variable to search for script, unless its name begins
with a slash. This is used to emulate
.Li #!
on machines that don't support it, in the following manner:
@@ -213,7 +216,7 @@ Sets the default value for internal encodings
.Pf ( Li "Encoding.default_internal" ) to UTF-8.
.Pp
.It Fl W Ns Op Ar level=2
-Turns on verbose mode at the specified level, without printing version
+Turns on verbose mode at the specified level without printing the version
message at the beginning. The level can be;
.Bl -hang -offset indent
.It Sy 0
@@ -334,8 +337,8 @@ On some systems
.Li "$0"
does not always contain the full pathname, so you need the
.Fl S
-switch to tell Ruby to search for the script if necessary. To handle
-embedded spaces or such. A better construct than
+switch to tell Ruby to search for the script if necessary (to handle embedded
+spaces and such). A better construct than
.Li "$*"
would be
.Li ${1+"$@"} ,
@@ -343,7 +346,7 @@ but it does not work if the script is being interpreted by
.Xr csh 1 .
.Pp
.It Fl v
-Enables verbose mode. Ruby will print its version at the beginning,
+Enables verbose mode. Ruby will print its version at the beginning
and set the variable
.Li "$VERBOSE"
to true. Some methods print extra messages if this variable is true.
@@ -358,11 +361,11 @@ variable to true.
.Pp
.It Fl x Ns Op Ar directory
Tells Ruby that the script is embedded in a message. Leading garbage
-will be discarded until the first that starts with
+will be discarded until the first line that starts with
.Dq #!
and contains the string,
.Dq ruby .
-Any meaningful switches on that line will applied. The end of script
+Any meaningful switches on that line will be applied. The end of the script
must be specified with either
.Li EOF ,
.Li "^D" ( Li "control-D" ) ,
@@ -377,8 +380,8 @@ before executing script.
DO NOT USE.
.Pp
Turns on compiler debug mode. Ruby will print a bunch of internal
-state messages during compiling scripts. You don't have to specify
-this switch, unless you are going to debug the Ruby interpreter.
+state messages during compilation. Only specify this switch you are going to
+debug the Ruby interpreter.
.Pp
.It Fl -disable- Ns Ar FEATURE
.It Fl -enable- Ns Ar FEATURE
@@ -417,7 +420,7 @@ disassembled instructions
.Pp
.El
.Pp
-You don't have to specify this switch, unless you are going to debug the Ruby interpreter.
+Only specify this switch if you are going to debug the Ruby interpreter.
.Pp
.It Fl -verbose
Enables verbose mode without printing version message at the
@@ -490,6 +493,8 @@ The official web site.
hosting many open source ruby projects.
.It http://raa.ruby-lang.org
Ruby Application Archive.
+.It https://github.com/languages/Ruby
+Ruby projects on Github.
.El
.Pp
.Sh REPORTING BUGS
@@ -500,7 +505,7 @@ Ruby Application Archive.
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://redmine.ruby-lang.org).
+Ruby Issue Tracking System (http://bugs.ruby-lang.org).
Do not report security vulnerabilities
via the system because it publishes the vulnerabilities immediately.
.El
@@ -508,4 +513,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://redmine.ruby-lang.org/wiki/ruby/Contributors\fR> for contributors to Ruby.
+See
+.Aq Pa http://bugs.ruby-lang.org/wiki/ruby/Contributors
+for contributors to Ruby.
diff --git a/marshal.c b/marshal.c
index 6ae3a55635..c1b6a79752 100644
--- a/marshal.c
+++ b/marshal.c
@@ -42,7 +42,7 @@ shortlen(long len, BDIGIT *ds)
num = SHORTDN(num);
offset++;
}
- return (len - 1)*sizeof(BDIGIT)/2 + offset;
+ return (len - 1)*SIZEOF_BDIGITS/2 + offset;
}
#define SHORTLEN(x) shortlen((x),d)
#endif
@@ -130,7 +130,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 {
@@ -186,6 +186,7 @@ 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 *
@@ -210,7 +211,7 @@ class2path(VALUE klass)
VALUE path = rb_class_path(klass);
const char *n;
- n = must_not_be_anonymous((TYPE(klass) == T_CLASS ? "class" : "module"), path);
+ n = must_not_be_anonymous((RB_TYPE_P(klass, T_CLASS) ? "class" : "module"), path);
if (rb_path_to_class(path) != rb_class_real(klass)) {
rb_raise(rb_eTypeError, "%s can't be referred to", n);
}
@@ -457,12 +458,17 @@ hash_each(VALUE key, VALUE value, struct dump_call_arg *arg)
return ST_CONTINUE;
}
+#define SINGLETON_DUMP_UNABLE_P(klass) \
+ (RCLASS_M_TBL(klass)->num_entries || \
+ (RCLASS_IV_TBL(klass) && RCLASS_IV_TBL(klass)->num_entries > 1))
+
static void
w_extended(VALUE klass, struct dump_arg *arg, int check)
{
if (check && FL_TEST(klass, FL_SINGLETON)) {
- if (RCLASS_M_TBL(klass)->num_entries ||
- (RCLASS_IV_TBL(klass) && RCLASS_IV_TBL(klass)->num_entries > 1)) {
+ VALUE origin = RCLASS_ORIGIN(klass);
+ if (SINGLETON_DUMP_UNABLE_P(klass) ||
+ (origin != klass && SINGLETON_DUMP_UNABLE_P(origin))) {
rb_raise(rb_eTypeError, "singleton can't be dumped");
}
klass = RCLASS_SUPER(klass);
@@ -506,8 +512,12 @@ w_uclass(VALUE obj, VALUE super, struct dump_arg *arg)
}
static int
-w_obj_each(ID id, VALUE value, struct dump_call_arg *arg)
+w_obj_each(st_data_t key, st_data_t val, st_data_t a)
{
+ ID id = (ID)key;
+ 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);
@@ -589,7 +599,7 @@ w_object(VALUE obj, struct dump_arg *arg, int limit)
st_table *ivtbl = 0;
st_data_t num;
int hasiv = 0;
-#define has_ivars(obj, ivtbl) (((ivtbl) = rb_generic_ivar_table(obj)) != 0 || \
+#define has_ivars(obj, ivtbl) ((((ivtbl) = rb_generic_ivar_table(obj)) != 0) || \
(!SPECIAL_CONST_P(obj) && !ENCODING_IS_ASCII8BIT(obj)))
if (limit == 0) {
@@ -632,31 +642,33 @@ w_object(VALUE obj, struct dump_arg *arg, int limit)
else if (SYMBOL_P(obj)) {
w_symbol(SYM2ID(obj), arg);
}
+ else if (FLONUM_P(obj)) {
+ st_add_direct(arg->data, obj, arg->data->num_entries);
+ w_byte(TYPE_FLOAT, arg);
+ w_float(RFLOAT_VALUE(obj), arg);
+ }
else {
- arg->infection |= (int)FL_TEST(obj, MARSHAL_INFECTION);
+ VALUE v;
- if (rb_respond_to(obj, s_mdump)) {
- volatile VALUE v;
+ arg->infection |= (int)FL_TEST(obj, MARSHAL_INFECTION);
- st_add_direct(arg->data, obj, arg->data->num_entries);
+ if (rb_obj_respond_to(obj, s_mdump, TRUE)) {
+ st_add_direct(arg->data, obj, arg->data->num_entries);
- v = rb_funcall(obj, s_mdump, 0, 0);
+ v = rb_funcall2(obj, s_mdump, 0, 0);
check_dump_arg(arg, s_mdump);
- hasiv = has_ivars(obj, ivtbl);
- if (hasiv) w_byte(TYPE_IVAR, arg);
w_class(TYPE_USRMARSHAL, obj, arg, FALSE);
w_object(v, arg, limit);
- if (hasiv) w_ivar(obj, ivtbl, &c_arg);
return;
}
- if (rb_respond_to(obj, s_dump)) {
- VALUE v;
+ if (rb_obj_respond_to(obj, s_dump, TRUE)) {
st_table *ivtbl2 = 0;
int hasiv2;
- v = rb_funcall(obj, s_dump, 1, INT2NUM(limit));
+ v = INT2NUM(limit);
+ v = rb_funcall2(obj, s_dump, 1, &v);
check_dump_arg(arg, s_dump);
- if (TYPE(v) != T_STRING) {
+ if (!RB_TYPE_P(v, T_STRING)) {
rb_raise(rb_eTypeError, "_dump() must return string");
}
hasiv = has_ivars(obj, ivtbl);
@@ -701,8 +713,9 @@ w_object(VALUE obj, struct dump_arg *arg, int limit)
}
w_byte(TYPE_CLASS, arg);
{
- volatile VALUE path = class2path(obj);
+ VALUE path = class2path(obj);
w_bytes(RSTRING_PTR(path), RSTRING_LEN(path), arg);
+ RB_GC_GUARD(path);
}
break;
@@ -711,6 +724,7 @@ w_object(VALUE obj, struct dump_arg *arg, int limit)
{
VALUE path = class2path(obj);
w_bytes(RSTRING_PTR(path), RSTRING_LEN(path), arg);
+ RB_GC_GUARD(path);
}
break;
@@ -770,7 +784,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");
}
@@ -807,8 +821,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(SYM2ID(RARRAY_AREF(mem, i)), arg);
+ w_object(RSTRUCT_GET(obj, i), arg, limit);
}
}
break;
@@ -822,12 +836,12 @@ w_object(VALUE obj, struct dump_arg *arg, int limit)
{
VALUE v;
- if (!rb_respond_to(obj, s_dump_data)) {
+ if (!rb_obj_respond_to(obj, s_dump_data, TRUE)) {
rb_raise(rb_eTypeError,
"no _dump_data is defined for class %s",
rb_obj_classname(obj));
}
- v = rb_funcall(obj, s_dump_data, 0);
+ v = rb_funcall2(obj, s_dump_data, 0, 0);
check_dump_arg(arg, s_dump_data);
w_class(TYPE_DATA, obj, arg, TRUE);
w_object(v, arg, limit);
@@ -839,6 +853,7 @@ w_object(VALUE obj, struct dump_arg *arg, int limit)
rb_obj_classname(obj));
break;
}
+ RB_GC_GUARD(obj);
}
if (hasiv) {
w_ivar(obj, ivtbl, &c_arg);
@@ -861,6 +876,13 @@ clear_dump_arg(struct dump_arg *arg)
}
}
+NORETURN(static inline void io_needed(void));
+static inline void
+io_needed(void)
+{
+ rb_raise(rb_eTypeError, "instance of IO needed");
+}
+
/*
* call-seq:
* dump( obj [, anIO] , limit=-1 ) -> anIO
@@ -907,15 +929,15 @@ marshal_dump(int argc, VALUE *argv)
rb_scan_args(argc, argv, "12", &obj, &a1, &a2);
if (argc == 3) {
if (!NIL_P(a2)) limit = NUM2INT(a2);
- if (NIL_P(a1)) goto type_error;
+ if (NIL_P(a1)) io_needed();
port = a1;
}
else if (argc == 2) {
if (FIXNUM_P(a1)) limit = FIX2INT(a1);
- else if (NIL_P(a1)) goto type_error;
+ else if (NIL_P(a1)) io_needed();
else port = a1;
}
- wrapper = TypedData_Make_Struct(rb_cData, struct dump_arg, &dump_arg_data, arg);
+ RB_GC_GUARD(wrapper) = TypedData_Make_Struct(rb_cData, struct dump_arg, &dump_arg_data, arg);
arg->dest = 0;
arg->symbols = st_init_numtable();
arg->data = st_init_numtable();
@@ -925,12 +947,10 @@ marshal_dump(int argc, VALUE *argv)
arg->str = rb_str_buf_new(0);
if (!NIL_P(port)) {
if (!rb_respond_to(port, s_write)) {
- type_error:
- rb_raise(rb_eTypeError, "instance of IO needed");
+ io_needed();
}
arg->dest = port;
- if (rb_respond_to(port, s_binmode)) {
- rb_funcall2(port, s_binmode, 0, 0);
+ if (rb_check_funcall(port, s_binmode, 0, 0) != Qundef) {
check_dump_arg(arg, s_binmode);
}
}
@@ -954,6 +974,9 @@ marshal_dump(int argc, VALUE *argv)
struct load_arg {
VALUE src;
+ char *buf;
+ long buflen;
+ long readable;
long offset;
st_table *symbols;
st_table *data;
@@ -999,6 +1022,7 @@ 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))
@@ -1007,6 +1031,13 @@ static VALUE r_object(struct load_arg *arg);
static ID r_symbol(struct load_arg *arg);
static VALUE path2class(VALUE path);
+NORETURN(static void too_short(void));
+static void
+too_short(void)
+{
+ rb_raise(rb_eArgError, "marshal data too short");
+}
+
static st_index_t
r_prepare(struct load_arg *arg)
{
@@ -1016,25 +1047,50 @@ r_prepare(struct load_arg *arg)
return idx;
}
+static unsigned char
+r_byte1_buffered(struct load_arg *arg)
+{
+ if (arg->buflen == 0) {
+ long readable = arg->readable < BUFSIZ ? arg->readable : BUFSIZ;
+ VALUE str, n = LONG2NUM(readable);
+
+ str = rb_funcall2(arg->src, s_read, 1, &n);
+
+ check_load_arg(arg, s_read);
+ if (NIL_P(str)) too_short();
+ StringValue(str);
+ arg->infection |= (int)FL_TEST(str, MARSHAL_INFECTION);
+ memcpy(arg->buf, RSTRING_PTR(str), RSTRING_LEN(str));
+ arg->offset = 0;
+ arg->buflen = RSTRING_LEN(str);
+ }
+ arg->buflen--;
+ return arg->buf[arg->offset++];
+}
+
static int
r_byte(struct load_arg *arg)
{
int c;
- if (TYPE(arg->src) == T_STRING) {
+ if (RB_TYPE_P(arg->src, T_STRING)) {
if (RSTRING_LEN(arg->src) > arg->offset) {
c = (unsigned char)RSTRING_PTR(arg->src)[arg->offset++];
}
else {
- rb_raise(rb_eArgError, "marshal data too short");
+ too_short();
}
}
else {
- VALUE src = arg->src;
- VALUE v = rb_funcall2(src, s_getbyte, 0, 0);
- check_load_arg(arg, s_getbyte);
- if (NIL_P(v)) rb_eof_error();
- c = (unsigned char)NUM2CHR(v);
+ if (arg->readable >0 || arg->buflen > 0) {
+ c = r_byte1_buffered(arg);
+ }
+ else {
+ VALUE v = rb_funcall2(arg->src, s_getbyte, 0, 0);
+ check_load_arg(arg, s_getbyte);
+ if (NIL_P(v)) rb_eof_error();
+ c = (unsigned char)NUM2CHR(v);
+ }
}
return c;
}
@@ -1087,6 +1143,68 @@ r_long(struct load_arg *arg)
return x;
}
+static VALUE
+r_bytes1(long len, struct load_arg *arg)
+{
+ VALUE str, n = LONG2NUM(len);
+
+ str = rb_funcall2(arg->src, s_read, 1, &n);
+ check_load_arg(arg, s_read);
+ if (NIL_P(str)) too_short();
+ StringValue(str);
+ if (RSTRING_LEN(str) != len) too_short();
+ arg->infection |= (int)FL_TEST(str, MARSHAL_INFECTION);
+
+ return str;
+}
+
+static VALUE
+r_bytes1_buffered(long len, struct load_arg *arg)
+{
+ VALUE str;
+
+ if (len <= arg->buflen) {
+ str = rb_str_new(arg->buf+arg->offset, len);
+ arg->offset += len;
+ arg->buflen -= len;
+ }
+ else {
+ long buflen = arg->buflen;
+ long readable = arg->readable + 1;
+ long tmp_len, read_len, need_len = len - buflen;
+ VALUE tmp, n;
+
+ readable = readable < BUFSIZ ? readable : BUFSIZ;
+ read_len = need_len > readable ? need_len : readable;
+ n = LONG2NUM(read_len);
+ tmp = rb_funcall2(arg->src, s_read, 1, &n);
+
+ check_load_arg(arg, s_read);
+ if (NIL_P(tmp)) too_short();
+ StringValue(tmp);
+
+ tmp_len = RSTRING_LEN(tmp);
+
+ if (tmp_len < need_len) too_short();
+ arg->infection |= (int)FL_TEST(tmp, MARSHAL_INFECTION);
+
+ str = rb_str_new(arg->buf+arg->offset, buflen);
+ rb_str_cat(str, RSTRING_PTR(tmp), need_len);
+
+ if (tmp_len > need_len) {
+ buflen = tmp_len - need_len;
+ memcpy(arg->buf, RSTRING_PTR(tmp)+need_len, buflen);
+ arg->buflen = buflen;
+ }
+ else {
+ arg->buflen = 0;
+ }
+ arg->offset = 0;
+ }
+
+ return str;
+}
+
#define r_bytes(arg) r_bytes0(r_long(arg), (arg))
static VALUE
@@ -1095,25 +1213,22 @@ r_bytes0(long len, struct load_arg *arg)
VALUE str;
if (len == 0) return rb_str_new(0, 0);
- if (TYPE(arg->src) == T_STRING) {
+ if (RB_TYPE_P(arg->src, T_STRING)) {
if (RSTRING_LEN(arg->src) - arg->offset >= len) {
str = rb_str_new(RSTRING_PTR(arg->src)+arg->offset, len);
arg->offset += len;
}
else {
- too_short:
- rb_raise(rb_eArgError, "marshal data too short");
+ too_short();
}
}
else {
- VALUE src = arg->src;
- VALUE n = LONG2NUM(len);
- str = rb_funcall2(src, s_read, 1, &n);
- check_load_arg(arg, s_read);
- if (NIL_P(str)) goto too_short;
- StringValue(str);
- if (RSTRING_LEN(str) != len) goto too_short;
- arg->infection |= (int)FL_TEST(str, MARSHAL_INFECTION);
+ if (arg->readable > 0 || arg->buflen > 0) {
+ str = r_bytes1_buffered(len, arg);
+ }
+ else {
+ str = r_bytes1(len, arg);
+ }
}
return str;
}
@@ -1139,16 +1254,16 @@ r_symlink(struct load_arg *arg)
st_data_t id;
long num = r_long(arg);
- if (st_lookup(arg->symbols, num, &id)) {
- return (ID)id;
+ if (!st_lookup(arg->symbols, num, &id)) {
+ rb_raise(rb_eArgError, "bad symbol");
}
- rb_raise(rb_eArgError, "bad symbol");
+ return (ID)id;
}
static ID
r_symreal(struct load_arg *arg, int ivar)
{
- volatile VALUE s = r_bytes(arg);
+ VALUE s = r_bytes(arg);
ID id;
int idx = -1;
st_index_t n = arg->symbols->num_entries;
@@ -1161,8 +1276,7 @@ r_symreal(struct load_arg *arg, int ivar)
idx = id2encidx(id, r_object(arg));
}
}
- if (idx < 0) idx = rb_usascii_encindex();
- rb_enc_associate_index(s, idx);
+ 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);
@@ -1176,6 +1290,8 @@ r_symbol(struct load_arg *arg)
again:
switch ((type = r_byte(arg))) {
+ default:
+ rb_raise(rb_eArgError, "dump format error for symbol(0x%x)", type);
case TYPE_IVAR:
ivar = 1;
goto again;
@@ -1186,9 +1302,6 @@ r_symbol(struct load_arg *arg)
rb_raise(rb_eArgError, "dump format error (symlink with encoding)");
}
return r_symlink(arg);
- default:
- rb_raise(rb_eArgError, "dump format error for symbol(0x%x)", type);
- break;
}
}
@@ -1215,7 +1328,7 @@ r_entry0(VALUE v, st_index_t num, struct load_arg *arg)
st_insert(arg->data, num, (st_data_t)v);
}
if (arg->infection &&
- TYPE(v) != T_CLASS && TYPE(v) != T_MODULE) {
+ !RB_TYPE_P(v, T_CLASS) && !RB_TYPE_P(v, T_MODULE)) {
FL_SET(v, arg->infection);
if ((VALUE)real_obj != Qundef)
FL_SET((VALUE)real_obj, arg->infection);
@@ -1224,7 +1337,7 @@ r_entry0(VALUE v, st_index_t num, struct load_arg *arg)
}
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)) {
@@ -1238,6 +1351,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);
@@ -1245,6 +1364,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)
{
@@ -1272,39 +1417,35 @@ path2class(VALUE path)
{
VALUE v = rb_path_to_class(path);
- if (TYPE(v) != T_CLASS) {
- rb_raise(rb_eArgError, "%.*s does not refer to class",
- (int)RSTRING_LEN(path), RSTRING_PTR(path));
+ if (!RB_TYPE_P(v, T_CLASS)) {
+ rb_raise(rb_eArgError, "%"PRIsVALUE" does not refer to class", 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 (TYPE(v) != T_MODULE) {
- rb_raise(rb_eArgError, "%.*s does not refer to module",
- (int)RSTRING_LEN(path), RSTRING_PTR(path));
+ if (!RB_TYPE_P(v, T_MODULE)) {
+ rb_raise(rb_eArgError, "%"PRIsVALUE" does not refer to module", path);
}
return v;
}
static VALUE
-obj_alloc_by_path(VALUE path, struct load_arg *arg)
+obj_alloc_by_klass(VALUE klass, struct load_arg *arg, VALUE *oldclass)
{
- VALUE klass;
st_data_t data;
rb_alloc_func_t allocator;
- klass = path2class(path);
-
allocator = rb_get_alloc_func(klass);
if (st_lookup(compat_allocator_tbl, (st_data_t)allocator, &data)) {
marshal_compat_t *compat = (marshal_compat_t*)data;
VALUE real_obj = rb_obj_alloc(klass);
VALUE obj = rb_obj_alloc(compat->oldclass);
+ if (oldclass) *oldclass = compat->oldclass;
st_insert(arg->compat_tbl, (st_data_t)obj, (st_data_t)real_obj);
return obj;
}
@@ -1313,6 +1454,30 @@ obj_alloc_by_path(VALUE path, struct load_arg *arg)
}
static VALUE
+obj_alloc_by_path(VALUE path, struct load_arg *arg)
+{
+ return obj_alloc_by_klass(path2class(path), arg, 0);
+}
+
+static VALUE
+append_extmod(VALUE obj, VALUE extmod)
+{
+ long i = RARRAY_LEN(extmod);
+ while (i > 0) {
+ VALUE m = RARRAY_AREF(extmod, --i);
+ rb_extend_object(obj, m);
+ }
+ return obj;
+}
+
+#define prohibit_ivar(type, str) do { \
+ if (!ivp || !*ivp) break; \
+ rb_raise(rb_eTypeError, \
+ "can't override instance variable of "type" `%"PRIsVALUE"'", \
+ (str)); \
+ } while (0)
+
+static VALUE
r_object0(struct load_arg *arg, int *ivp, VALUE extmod)
{
VALUE v = Qnil;
@@ -1327,10 +1492,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:
@@ -1344,16 +1506,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_new2(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;
@@ -1365,16 +1547,16 @@ r_object0(struct load_arg *arg, int *ivp, VALUE extmod)
rb_raise(rb_eTypeError, "singleton can't be loaded");
}
v = r_object0(arg, 0, extmod);
- if (rb_special_const_p(v) || TYPE(v) == T_OBJECT || TYPE(v) == T_CLASS) {
+ if (rb_special_const_p(v) || RB_TYPE_P(v, T_OBJECT) || RB_TYPE_P(v, T_CLASS)) {
format_error:
rb_raise(rb_eArgError, "dump format error (user class)");
}
- if (TYPE(v) == T_MODULE || !RTEST(rb_class_inherited_p(c, RBASIC(v)->klass))) {
+ if (RB_TYPE_P(v, T_MODULE) || !RTEST(rb_class_inherited_p(c, RBASIC(v)->klass))) {
VALUE tmp = rb_obj_alloc(c);
if (TYPE(v) != TYPE(tmp)) goto format_error;
}
- RBASIC(v)->klass = c;
+ RBASIC_SET_CLASS(v, c);
}
break;
@@ -1430,44 +1612,15 @@ r_object0(struct load_arg *arg, int *ivp, VALUE extmod)
case TYPE_BIGNUM:
{
long len;
- BDIGIT *digits;
- volatile VALUE data;
+ VALUE data;
+ int sign;
- NEWOBJ(big, struct RBignum);
- OBJSETUP(big, 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);
-#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 = rb_integer_unpack(RSTRING_PTR(data), len, 2, 0,
+ INTEGER_PACK_LITTLE_ENDIAN | (sign == '-' ? INTEGER_PACK_NEGATIVE : 0));
+ rb_str_resize(data, 0L);
v = r_entry(v, arg);
v = r_leave(v, arg);
}
@@ -1480,7 +1633,7 @@ r_object0(struct load_arg *arg, int *ivp, VALUE extmod)
case TYPE_REGEXP:
{
- volatile VALUE str = r_bytes(arg);
+ VALUE str = r_bytes(arg);
int options = r_byte(arg);
int has_encoding = FALSE;
st_index_t idx = r_prepare(arg);
@@ -1519,10 +1672,13 @@ r_object0(struct load_arg *arg, int *ivp, VALUE extmod)
v = rb_ary_new2(len);
v = r_entry(v, arg);
+ arg->readable += len - 1;
while (len--) {
rb_ary_push(v, r_object(arg));
+ arg->readable--;
}
v = r_leave(v, arg);
+ arg->readable++;
}
break;
@@ -1533,13 +1689,16 @@ r_object0(struct load_arg *arg, int *ivp, VALUE extmod)
v = rb_hash_new();
v = r_entry(v, arg);
+ arg->readable += (len - 1) * 2;
while (len--) {
VALUE key = r_object(arg);
VALUE value = r_object(arg);
rb_hash_aset(v, key, value);
+ arg->readable -= 2;
}
+ 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);
}
@@ -1555,7 +1714,7 @@ r_object0(struct load_arg *arg, int *ivp, VALUE extmod)
long len = r_long(arg);
v = rb_obj_alloc(klass);
- if (TYPE(v) != T_STRUCT) {
+ if (!RB_TYPE_P(v, T_STRUCT)) {
rb_raise(rb_eTypeError, "class %s not a struct", rb_class2name(klass));
}
mem = rb_struct_s_members(klass);
@@ -1564,21 +1723,24 @@ r_object0(struct load_arg *arg, int *ivp, VALUE extmod)
rb_class2name(klass));
}
+ arg->readable += (len - 1) * 2;
v = r_entry0(v, idx, arg);
values = rb_ary_new2(len);
for (i=0; i<len; i++) {
slot = r_symbol(arg);
- if (RARRAY_PTR(mem)[i] != ID2SYM(slot)) {
+ if (RARRAY_AREF(mem, i) != ID2SYM(slot)) {
rb_raise(rb_eTypeError, "struct %s not compatible (:%s for :%s)",
rb_class2name(klass),
rb_id2name(slot),
- rb_id2name(SYM2ID(RARRAY_PTR(mem)[i])));
+ rb_id2name(SYM2ID(RARRAY_AREF(mem, i))));
}
rb_ary_push(values, r_object(arg));
+ arg->readable -= 2;
}
rb_struct_initialize(v, values);
v = r_leave(v, arg);
+ arg->readable += 2;
}
break;
@@ -1587,7 +1749,7 @@ r_object0(struct load_arg *arg, int *ivp, VALUE extmod)
VALUE klass = path2class(r_unique(arg));
VALUE data;
- if (!rb_respond_to(klass, s_load)) {
+ if (!rb_obj_respond_to(klass, s_load, TRUE)) {
rb_raise(rb_eTypeError, "class %s needs to have method `_load'",
rb_class2name(klass));
}
@@ -1596,7 +1758,7 @@ r_object0(struct load_arg *arg, int *ivp, VALUE extmod)
r_ivar(data, NULL, arg);
*ivp = FALSE;
}
- v = rb_funcall(klass, s_load, 1, data);
+ v = rb_funcall2(klass, s_load, 1, &data);
check_load_arg(arg, s_load);
v = r_entry(v, arg);
v = r_leave(v, arg);
@@ -1606,24 +1768,29 @@ r_object0(struct load_arg *arg, int *ivp, VALUE extmod)
case TYPE_USRMARSHAL:
{
VALUE klass = path2class(r_unique(arg));
+ VALUE oldclass = 0;
VALUE data;
- v = rb_obj_alloc(klass);
+ v = obj_alloc_by_klass(klass, arg, &oldclass);
if (!NIL_P(extmod)) {
- while (RARRAY_LEN(extmod) > 0) {
- VALUE m = rb_ary_pop(extmod);
- rb_extend_object(v, m);
- }
+ /* for the case marshal_load is overridden */
+ append_extmod(v, extmod);
}
- if (!rb_respond_to(v, s_mload)) {
+ if (!rb_obj_respond_to(v, s_mload, TRUE)) {
rb_raise(rb_eTypeError, "instance of %s needs to have method `marshal_load'",
rb_class2name(klass));
}
v = r_entry(v, arg);
data = r_object(arg);
- rb_funcall(v, s_mload, 1, data);
+ 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);
+ }
}
break;
@@ -1631,7 +1798,7 @@ r_object0(struct load_arg *arg, int *ivp, VALUE extmod)
{
st_index_t idx = r_prepare(arg);
v = obj_alloc_by_path(r_unique(arg), arg);
- if (TYPE(v) != T_OBJECT) {
+ if (!RB_TYPE_P(v, T_OBJECT)) {
rb_raise(rb_eArgError, "dump format error");
}
v = r_entry0(v, idx, arg);
@@ -1641,40 +1808,34 @@ r_object0(struct load_arg *arg, int *ivp, VALUE extmod)
break;
case TYPE_DATA:
- {
- VALUE klass = path2class(r_unique(arg));
- if (rb_respond_to(klass, s_alloc)) {
- static int warn = TRUE;
- if (warn) {
- rb_warn("define `allocate' instead of `_alloc'");
- warn = FALSE;
- }
- v = rb_funcall(klass, s_alloc, 0);
- check_load_arg(arg, s_alloc);
- }
- else {
- v = rb_obj_alloc(klass);
- }
- if (TYPE(v) != T_DATA) {
- rb_raise(rb_eArgError, "dump format error");
- }
- v = r_entry(v, arg);
- if (!rb_respond_to(v, s_load_data)) {
- rb_raise(rb_eTypeError,
- "class %s needs to have instance method `_load_data'",
- rb_class2name(klass));
- }
- rb_funcall(v, s_load_data, 1, r_object0(arg, 0, extmod));
- check_load_arg(arg, s_load_data);
- v = r_leave(v, arg);
- }
- break;
+ {
+ VALUE klass = path2class(r_unique(arg));
+ VALUE oldclass = 0;
+ VALUE r;
+
+ v = obj_alloc_by_klass(klass, arg, &oldclass);
+ if (!RB_TYPE_P(v, T_DATA)) {
+ rb_raise(rb_eArgError, "dump format error");
+ }
+ v = r_entry(v, arg);
+ if (!rb_obj_respond_to(v, s_load_data, TRUE)) {
+ rb_raise(rb_eTypeError,
+ "class %s needs to have instance method `_load_data'",
+ rb_class2name(klass));
+ }
+ r = r_object0(arg, 0, extmod);
+ rb_funcall2(v, s_load_data, 1, &r);
+ check_load_arg(arg, s_load_data);
+ v = r_leave(v, arg);
+ }
+ break;
case TYPE_MODULE_OLD:
{
- volatile VALUE str = r_bytes(arg);
+ VALUE str = r_bytes(arg);
v = rb_path_to_class(str);
+ prohibit_ivar("class/module", str);
v = r_entry(v, arg);
v = r_leave(v, arg);
}
@@ -1682,9 +1843,10 @@ r_object0(struct load_arg *arg, int *ivp, VALUE extmod)
case TYPE_CLASS:
{
- volatile VALUE str = r_bytes(arg);
+ VALUE str = r_bytes(arg);
v = path2class(str);
+ prohibit_ivar("class", str);
v = r_entry(v, arg);
v = r_leave(v, arg);
}
@@ -1692,9 +1854,10 @@ r_object0(struct load_arg *arg, int *ivp, VALUE extmod)
case TYPE_MODULE:
{
- volatile VALUE str = r_bytes(arg);
+ VALUE str = r_bytes(arg);
v = path2module(str);
+ prohibit_ivar("module", str);
v = r_entry(v, arg);
v = r_leave(v, arg);
}
@@ -1731,6 +1894,13 @@ r_object(struct load_arg *arg)
static void
clear_load_arg(struct load_arg *arg)
{
+ if (arg->buf) {
+ xfree(arg->buf);
+ arg->buf = 0;
+ }
+ arg->buflen = 0;
+ arg->offset = 0;
+ arg->readable = 0;
if (!arg->symbols) return;
st_free_table(arg->symbols);
arg->symbols = 0;
@@ -1750,6 +1920,9 @@ clear_load_arg(struct load_arg *arg)
* 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.
+ *
+ * Never pass untrusted data (including user supplied input) to this method.
+ * Please see the overview for further details.
*/
static VALUE
marshal_load(int argc, VALUE *argv)
@@ -1767,15 +1940,13 @@ marshal_load(int argc, VALUE *argv)
port = v;
}
else if (rb_respond_to(port, s_getbyte) && rb_respond_to(port, s_read)) {
- if (rb_respond_to(port, s_binmode)) {
- rb_funcall2(port, s_binmode, 0, 0);
- }
- infection = (int)(FL_TAINT | FL_TEST(port, FL_UNTRUSTED));
+ rb_check_funcall(port, s_binmode, 0, 0);
+ infection = (int)FL_TAINT;
}
else {
- rb_raise(rb_eTypeError, "instance of IO needed");
+ io_needed();
}
- wrapper = TypedData_Make_Struct(rb_cData, struct load_arg, &load_arg_data, arg);
+ RB_GC_GUARD(wrapper) = TypedData_Make_Struct(rb_cData, struct load_arg, &load_arg_data, arg);
arg->infection = infection;
arg->src = port;
arg->offset = 0;
@@ -1783,6 +1954,12 @@ marshal_load(int argc, VALUE *argv)
arg->data = st_init_numtable();
arg->compat_tbl = st_init_numtable();
arg->proc = 0;
+ arg->readable = 0;
+
+ if (NIL_P(v))
+ arg->buf = xmalloc(BUFSIZ);
+ else
+ arg->buf = 0;
major = r_byte(arg);
minor = r_byte(arg);
@@ -1840,6 +2017,21 @@ marshal_load(int argc, VALUE *argv)
* precedence over _dump if both are defined. marshal_dump may result in
* smaller Marshal strings.
*
+ * == Security considerations
+ *
+ * By design, Marshal.load can deserialize almost any class loaded into the
+ * Ruby process. In many cases this can lead to remote code execution if the
+ * Marshal data is loaded from an untrusted source.
+ *
+ * As a result, Marshal.load is not suitable as a general purpose serialization
+ * format and you should never unmarshal user supplied input or other untrusted
+ * data.
+ *
+ * If you need to deserialize untrusted data, use JSON or another serialization
+ * format that is only able to load simple, 'primitive' types such as String,
+ * Array, Hash, etc. Never allow user input to specify arbitrary types to
+ * deserialize into.
+ *
* == marshal_dump and marshal_load
*
* When dumping an object the method marshal_dump will be called.
@@ -1927,7 +2119,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 276b2cbc49..e621d1af77 100644
--- a/math.c
+++ b/math.c
@@ -11,34 +11,39 @@
#include "ruby/ruby.h"
#include "internal.h"
+#include <float.h>
#include <math.h>
#include <errno.h>
-#if defined(HAVE_SIGNBIT) && defined(__GNUC__) && defined(__sun__) && \
+#if defined(HAVE_SIGNBIT) && defined(__GNUC__) && defined(__sun) && \
!defined(signbit)
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;
-#define Need_Float(x) do {if (TYPE(x) != T_FLOAT) {(x) = rb_to_float(x);}} while(0)
+#define Need_Float(x) do {if (!RB_TYPE_P(x, T_FLOAT)) {(x) = rb_to_float(x);}} while(0)
#define Need_Float2(x,y) do {\
Need_Float(x);\
Need_Float(y);\
} while (0)
#define domain_error(msg) \
- rb_raise(rb_eMathDomainError, "Numerical argument is out of domain - " #msg);
+ rb_raise(rb_eMathDomainError, "Numerical argument is out of domain - " #msg)
/*
* 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
@@ -77,10 +82,17 @@ math_atan2(VALUE obj, VALUE y, VALUE x)
/*
* 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 +104,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 +175,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 +201,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)
*
- * Computes the arc tangent of <i>x</i>. Returns -{PI/2} .. {PI/2}.
+ * Codomain: (-PI/2, PI/2)
+ *
+ * Math.atan(0) #=> 0.0
*/
static VALUE
@@ -186,16 +229,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 +258,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 +287,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 +308,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 +335,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 +356,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 +386,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
@@ -332,17 +418,22 @@ math_exp(VALUE obj, 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
*
*/
@@ -351,8 +442,19 @@ math_log(int argc, VALUE *argv)
{
VALUE x, base;
double d0, d;
+ size_t numbits;
rb_scan_args(argc, argv, "11", &x, &base);
+
+ if (RB_BIGNUM_TYPE_P(x) && RBIGNUM_POSITIVE_P(x) &&
+ DBL_MAX_EXP <= (numbits = rb_absint_numwords(x, 1, NULL))) {
+ numbits -= DBL_MANT_DIG;
+ x = rb_big_rshift(x, SIZET2NUM(numbits));
+ }
+ else {
+ numbits = 0;
+ }
+
Need_Float(x);
d0 = RFLOAT_VALUE(x);
/* check for domain error */
@@ -360,6 +462,8 @@ math_log(int argc, VALUE *argv)
/* check for pole error */
if (d0 == 0.0) return DBL2NUM(-INFINITY);
d = log(d0);
+ if (numbits)
+ d += numbits * log(2); /* log(2**numbits) */
if (argc == 2) {
Need_Float(base);
d /= log(RFLOAT_VALUE(base));
@@ -381,9 +485,13 @@ extern double log2(double);
/*
* call-seq:
- * Math.log2(numeric) -> float
+ * Math.log2(x) -> Float
*
- * Returns the base 2 logarithm of <i>numeric</i>.
+ * Returns the base 2 logarithm of +x+.
+ *
+ * Domain: (0, INFINITY)
+ *
+ * Codomain: (-INFINITY, INFINITY)
*
* Math.log2(1) #=> 0.0
* Math.log2(2) #=> 1.0
@@ -396,6 +504,16 @@ static VALUE
math_log2(VALUE obj, VALUE x)
{
double d0, d;
+ size_t numbits;
+
+ if (RB_BIGNUM_TYPE_P(x) && RBIGNUM_POSITIVE_P(x) &&
+ DBL_MAX_EXP <= (numbits = rb_absint_numwords(x, 1, NULL))) {
+ numbits -= DBL_MANT_DIG;
+ x = rb_big_rshift(x, SIZET2NUM(numbits));
+ }
+ else {
+ numbits = 0;
+ }
Need_Float(x);
d0 = RFLOAT_VALUE(x);
@@ -404,14 +522,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 +546,16 @@ static VALUE
math_log10(VALUE obj, VALUE x)
{
double d0, d;
+ size_t numbits;
+
+ if (RB_BIGNUM_TYPE_P(x) && RBIGNUM_POSITIVE_P(x) &&
+ DBL_MAX_EXP <= (numbits = rb_absint_numwords(x, 1, NULL))) {
+ numbits -= DBL_MANT_DIG;
+ x = rb_big_rshift(x, SIZET2NUM(numbits));
+ }
+ else {
+ numbits = 0;
+ }
Need_Float(x);
d0 = RFLOAT_VALUE(x);
@@ -431,31 +564,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 +611,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 +653,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 +676,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 +693,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 +710,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 +731,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 +752,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 +843,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
@@ -767,10 +922,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 +938,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 9229896b6b..9604722500 100644
--- a/method.h
+++ b/method.h
@@ -11,6 +11,16 @@
#ifndef METHOD_H
#define METHOD_H
+#include "internal.h"
+
+#ifndef END_OF_ENUMERATION
+# if defined(__GNUC__) &&! defined(__STRICT_ANSI__)
+# define END_OF_ENUMERATION(key)
+# else
+# define END_OF_ENUMERATION(key) END_OF_##key##_PLACEHOLDER = 0
+# endif
+#endif
+
typedef enum {
NOEX_PUBLIC = 0x00,
NOEX_NOSUPER = 0x01,
@@ -22,11 +32,14 @@ typedef enum {
NOEX_MODFUNC = 0x12,
NOEX_SUPER = 0x20,
NOEX_VCALL = 0x40,
- NOEX_RESPONDS = 0x80
+ NOEX_RESPONDS = 0x80,
+
+ NOEX_BIT_WIDTH = 8,
+ NOEX_SAFE_SHIFT_OFFSET = ((NOEX_BIT_WIDTH+3)/4)*4 /* round up to nibble */
} rb_method_flag_t;
-#define NOEX_SAFE(n) ((int)((n) >> 8) & 0x0F)
-#define NOEX_WITH(n, s) (((s) << 8) | (n) | (ruby_running ? 0 : NOEX_BASIC))
+#define NOEX_SAFE(n) ((int)((n) >> NOEX_SAFE_SHIFT_OFFSET) & 0x0F)
+#define NOEX_WITH(n, s) (((s) << NOEX_SAFE_SHIFT_OFFSET) | (n) | (ruby_running ? 0 : NOEX_BASIC))
#define NOEX_WITH_SAFE(n) NOEX_WITH((n), rb_safe_level())
/* method data type */
@@ -41,17 +54,23 @@ typedef enum {
VM_METHOD_TYPE_UNDEF,
VM_METHOD_TYPE_NOTIMPLEMENTED,
VM_METHOD_TYPE_OPTIMIZED, /* Kernel#send, Proc#call, etc */
- VM_METHOD_TYPE_MISSING /* wrapper for method_missing(id) */
+ VM_METHOD_TYPE_MISSING, /* wrapper for method_missing(id) */
+ VM_METHOD_TYPE_REFINED,
+
+ END_OF_ENUMERATION(VM_METHOD_TYPE)
} rb_method_type_t;
+struct rb_call_info_struct;
+
typedef struct rb_method_cfunc_struct {
VALUE (*func)(ANYARGS);
+ VALUE (*invoker)(VALUE (*func)(ANYARGS), VALUE recv, int argc, const VALUE *argv);
int argc;
} rb_method_cfunc_t;
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;
@@ -60,14 +79,17 @@ typedef struct rb_method_definition_struct {
rb_method_type_t type; /* method type */
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
+ OPTIMIZED_METHOD_TYPE_CALL,
+
+ OPTIMIZED_METHOD_TYPE__MAX
} optimize_type;
+ struct rb_method_entry_struct *orig_me;
} body;
int alias_count;
} rb_method_definition_t;
@@ -89,13 +111,27 @@ 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);
-
-rb_method_entry_t *rb_method_entry_get_without_cache(VALUE klass, ID id);
+rb_method_entry_t *rb_method_entry(VALUE klass, ID id, VALUE *define_class_ptr);
+rb_method_entry_t *rb_method_entry_at(VALUE obj, ID id);
+void rb_add_refined_method_entry(VALUE refined_class, ID mid);
+rb_method_entry_t *rb_resolve_refined_method(VALUE refinements,
+ const rb_method_entry_t *me,
+ VALUE *defined_class_ptr);
+rb_method_entry_t *rb_method_entry_with_refinements(VALUE klass, ID id,
+ VALUE *defined_class_ptr);
+rb_method_entry_t *rb_method_entry_without_refinements(VALUE klass, ID id,
+ VALUE *defined_class_ptr);
+
+rb_method_entry_t *rb_method_entry_get_without_cache(VALUE klass, ID id, VALUE *define_class_ptr);
rb_method_entry_t *rb_method_entry_set(VALUE klass, ID mid, const rb_method_entry_t *, rb_method_flag_t noex);
int rb_method_entry_arity(const rb_method_entry_t *me);
int rb_method_entry_eq(const rb_method_entry_t *m1, const rb_method_entry_t *m2);
+st_index_t rb_hash_method_entry(st_index_t hash, const rb_method_entry_t *me);
+
+VALUE rb_method_entry_location(rb_method_entry_t *me);
+VALUE rb_mod_method_location(VALUE mod, ID id);
+VALUE rb_obj_method_location(VALUE obj, ID id);
void rb_mark_method_entry(const rb_method_entry_t *me);
void rb_free_method_entry(rb_method_entry_t *me);
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/inf-ruby.el b/misc/inf-ruby.el
index c27fb635de..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)
@@ -220,9 +221,9 @@ to continue it."
(use-local-map inferior-ruby-mode-map)
(setq comint-input-filter (function ruby-input-filter))
(setq comint-get-old-input (function ruby-get-old-input))
- (compilation-shell-minor-mode t)
(make-local-variable 'compilation-error-regexp-alist)
(setq compilation-error-regexp-alist inferior-ruby-error-regexp-alist)
+ (compilation-shell-minor-mode t)
(run-hooks 'inferior-ruby-mode-hook))
(defvar inferior-ruby-filter-regexp "\\`\\s *\\S ?\\S ?\\s *\\'"
@@ -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..1bfd34bf2d 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}"
diff --git a/misc/ruby-additional.el b/misc/ruby-additional.el
new file mode 100644
index 0000000000..c06003d6da
--- /dev/null
+++ b/misc/ruby-additional.el
@@ -0,0 +1,113 @@
+;;; ruby-additional.el --- ruby-mode extensions yet to be merged into Emacs
+
+;; 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
+
+;;; 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.
+
+;;; Code:
+
+(eval-when-compile
+ (require 'ruby-mode))
+
+(eval-after-load 'ruby-mode
+ '(progn
+ (define-key ruby-mode-map "\C-c\C-e" 'ruby-insert-end)
+
+ (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"))))))))
+
+ ))
+
+(provide 'ruby-additional)
+
+;;; ruby-additional.el ends here
diff --git a/misc/ruby-electric.el b/misc/ruby-electric.el
index 6c1ad9a88a..8eb872d909 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
+
+;;; 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,184 @@ 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-char 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
- (newline))
- (insert "}")))
- ((ruby-electric-string-at-point-p)
- (if (eq last-command-event ?{)
- (save-excursion
- (when (not (char-equal ?\# (preceding-char)))
- (delete-backward-char)
- (insert "#"))))
- (save-excursion
- (backward-char 1)
- (when (char-equal ?\# (preceding-char))
- (forward-char 1)
- (insert "}")))))))
+ (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)
+ (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 "}"))))))))
-(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-char
- 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 -1))
(provide 'ruby-electric)
+
+;;; ruby-electric.el ends here
diff --git a/misc/ruby-mode.el b/misc/ruby-mode.el
index 4065f4258a..e244ae4827 100644
--- a/misc/ruby-mode.el
+++ b/misc/ruby-mode.el
@@ -104,7 +104,7 @@
(regexp-opt (append ruby-modifier-beg-keywords ruby-block-op-keywords))
"Regexp to match hanging block modifiers.")
-(defconst ruby-block-end-re "\\<end\\>")
+(defconst ruby-block-end-re "\\_<end\\_>")
(defconst ruby-here-doc-beg-re
"\\(<\\)<\\(-\\)?\\(\\([a-zA-Z0-9_]+\\)\\|[\"]\\([^\"]+\\)[\"]\\|[']\\([^']+\\)[']\\)")
@@ -132,9 +132,9 @@
(concat "-?\\([\"']\\|\\)" contents "\\1"))))))
(defconst ruby-delimiter
- (concat "[?$/%(){}#\"'`.:]\\|<<\\|\\[\\|\\]\\|\\<\\("
+ (concat "[?$/%(){}#\"'`.:]\\|<<\\|\\[\\|\\]\\|\\_<\\("
ruby-block-beg-re
- "\\)\\>\\|" ruby-block-end-re
+ "\\)\\_>\\|" ruby-block-end-re
"\\|^=begin\\|" ruby-here-doc-beg-re)
)
@@ -190,6 +190,7 @@
(modify-syntax-entry ?$ "." ruby-mode-syntax-table)
(modify-syntax-entry ?? "_" ruby-mode-syntax-table)
(modify-syntax-entry ?_ "_" ruby-mode-syntax-table)
+ (modify-syntax-entry ?: "_" ruby-mode-syntax-table)
(modify-syntax-entry ?< "." ruby-mode-syntax-table)
(modify-syntax-entry ?> "." ruby-mode-syntax-table)
(modify-syntax-entry ?& "." ruby-mode-syntax-table)
@@ -239,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
@@ -325,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
@@ -417,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))
@@ -459,8 +490,12 @@ Also ignores spaces after parenthesis when 'space."
(no-error nil)
((error "unterminated string")))))
-(defun ruby-deep-indent-paren-p (c)
- (cond ((listp ruby-deep-indent-paren)
+(defun ruby-deep-indent-paren-p (c &optional pos)
+ (cond ((save-excursion
+ (if pos (goto-char pos))
+ (ruby-expr-beg))
+ nil)
+ ((listp ruby-deep-indent-paren)
(let ((deep (assoc c ruby-deep-indent-paren)))
(cond (deep
(or (cdr deep) ruby-deep-indent-paren-style))
@@ -552,7 +587,7 @@ Also ignores spaces after parenthesis when 'space."
(progn
(and (eq deep 'space) (looking-at ".\\s +[^# \t\n]")
(setq pnt (1- (match-end 0))))
- (setq nest (cons (cons (char-after (point)) pnt) nest))
+ (setq nest (cons (cons (char-after (point)) (point)) nest))
(setq pcol (cons (cons pnt depth) pcol))
(setq depth 0))
(setq nest (cons (cons (char-after (point)) pnt) nest))
@@ -560,7 +595,13 @@ Also ignores spaces after parenthesis when 'space."
(goto-char pnt)
)
((looking-at "[])}]")
- (if (ruby-deep-indent-paren-p (matching-paren (char-after)))
+ (if (ruby-deep-indent-paren-p (matching-paren (char-after))
+ (if nest
+ (cdr (nth 0 nest))
+ (save-excursion
+ (forward-char)
+ (ruby-backward-sexp)
+ (point))))
(setq depth (cdr (car pcol)) pcol (cdr pcol))
(setq depth (1- depth)))
(setq nest (cdr nest))
@@ -591,7 +632,7 @@ Also ignores spaces after parenthesis when 'space."
(setq nest (cons (cons nil pnt) nest))
(setq depth (1+ depth))))
(goto-char (match-end 0)))
- ((looking-at (concat "\\<\\(" ruby-block-beg-re "\\)\\>"))
+ ((looking-at (concat "\\_<\\(" ruby-block-beg-re "\\)\\_>"))
(and
(save-match-data
(or (not (looking-at (concat "do" ruby-keyword-end-re)))
@@ -715,11 +756,15 @@ Also ignores spaces after parenthesis when 'space."
(setq indent nil)) ; do nothing
((car (nth 1 state)) ; in paren
(goto-char (setq begin (cdr (nth 1 state))))
- (let ((deep (ruby-deep-indent-paren-p (car (nth 1 state)))))
+ (let ((deep (ruby-deep-indent-paren-p (car (nth 1 state))
+ (1- (cdr (nth 1 state))))))
(if deep
(cond ((and (eq deep t) (eq (car (nth 1 state)) paren))
(skip-syntax-backward " ")
(setq indent (1- (current-column))))
+ ((eq deep 'space)
+ (goto-char (cdr (nth 1 state)))
+ (setq indent (1+ (current-column))))
((let ((s (ruby-parse-region (point) ruby-indent-point)))
(and (nth 2 s) (> (nth 2 s) 0)
(or (goto-char (cdr (nth 1 s))) t)))
@@ -734,7 +779,8 @@ Also ignores spaces after parenthesis when 'space."
(goto-char parse-start) (back-to-indentation))
(setq indent (ruby-indent-size (current-column) (nth 2 state))))
(and (eq (car (nth 1 state)) paren)
- (ruby-deep-indent-paren-p (matching-paren paren))
+ (ruby-deep-indent-paren-p (matching-paren paren)
+ (1- (cdr (nth 1 state))))
(search-backward (char-to-string paren))
(setq indent (current-column)))))
((and (nth 2 state) (> (nth 2 state) 0)) ; in nest
@@ -759,7 +805,9 @@ Also ignores spaces after parenthesis when 'space."
(setq eol (point))
(beginning-of-line)
(cond
- ((and (not (ruby-deep-indent-paren-p paren))
+ ((and (not (ruby-deep-indent-paren-p paren
+ (and (cdr (nth 1 state))
+ (1- (cdr (nth 1 state))))))
(re-search-forward ruby-negative eol t))
(and (not (eq ?_ (char-after (match-end 0))))
(setq indent (- indent ruby-indent-level))))
@@ -856,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)))
@@ -876,12 +924,12 @@ Also ignores spaces after parenthesis when 'space."
With argument, do this that many times.
Returns t unless search stops due to end of buffer."
(interactive "p")
- (and (re-search-backward (concat "^\\(" ruby-block-beg-re "\\)\\b")
+ (and (re-search-backward (concat "^\\(" ruby-block-beg-re "\\)\\_>")
nil 'move (or arg 1))
(progn (beginning-of-line) t)))
(defun ruby-beginning-of-indent ()
- (and (re-search-backward (concat "^\\(" ruby-indent-beg-re "\\)\\b")
+ (and (re-search-backward (concat "^\\(" ruby-indent-beg-re "\\)\\_>")
nil 'move)
(progn
(beginning-of-line)
@@ -1153,14 +1201,14 @@ balanced expression is found."
(let ((orig (point)) (end (progn (ruby-forward-sexp) (point))))
(when (eq (char-before) ?\})
(delete-char -1)
- (if (eq (char-syntax (char-before)) ?w)
+ (if (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\\||")
@@ -1170,7 +1218,7 @@ balanced expression is found."
(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))))
(backward-char 3)
@@ -1359,7 +1407,7 @@ buffer position `limit' or the end of the buffer."
1 font-lock-function-name-face)
;; keywords
(cons (concat
- "\\(^\\|[^_:.@$]\\|\\.\\.\\)\\b\\(defined\\?\\|"
+ "\\(^\\|[^_:.@$]\\|\\.\\.\\)\\_<\\(defined\\?\\|"
(regexp-opt
'("alias"
"and"
@@ -1404,7 +1452,7 @@ buffer position `limit' or the end of the buffer."
;; here-doc beginnings
(list ruby-here-doc-beg-re 0 'font-lock-string-face)
;; variables
- '("\\(^\\|[^_:.@$]\\|\\.\\.\\)\\b\\(nil\\|self\\|true\\|false\\)\\>"
+ '("\\(^\\|[^_:.@$]\\|\\.\\.\\)\\_<\\(nil\\|self\\|true\\|false\\)\\>"
2 font-lock-variable-name-face)
;; variables
'("\\(\\$\\([^a-zA-Z0-9 \n]\\|[0-9]\\)\\)\\W"
@@ -1420,7 +1468,7 @@ buffer position `limit' or the end of the buffer."
'("\\(^\\|[[ \t\n<+(,=]\\)\\(%[xrqQwW]?\\([^<[{(a-zA-Z0-9 \n]\\)[^\n\\\\]*\\(\\\\.[^\n\\\\]*\\)*\\(\\3\\)\\)"
(2 font-lock-string-face))
;; constants
- '("\\(^\\|[^_]\\)\\b\\([A-Z]+\\(\\w\\|_\\)*\\)"
+ '("\\(^\\|[^_]\\)\\_<\\([A-Z]+\\(\\w\\|_\\)*\\)"
2 font-lock-type-face)
;; symbols
'("\\(^\\|[^:]\\)\\(:\\([-+~]@?\\|[/%&|^`]\\|\\*\\*?\\|<\\(<\\|=>?\\)?\\|>[>=]?\\|===?\\|=~\\|![~=]?\\|\\[\\]=?\\|\\(\\w\\|_\\)+\\([!?=]\\|\\b_*\\)\\|#{[^}\n\\\\]*\\(\\\\.[^}\n\\\\]*\\)*}\\)\\)"
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/alloca.c b/missing/alloca.c
index efc1a77dff..96121f7647 100644
--- a/missing/alloca.c
+++ b/missing/alloca.c
@@ -30,6 +30,8 @@ static char SCCSid[] = "@(#)alloca.c 1.1"; /* for the "what" utility */
#endif
#include "ruby/config.h"
+#define X3J11 1 /* config.h should contain void if needed */
+
#ifdef C_ALLOCA
#ifdef emacs
@@ -52,12 +54,12 @@ typedef void *pointer; /* generic pointer type */
typedef char *pointer; /* generic pointer type */
#endif /* X3J11 */
+#ifndef NULL
#define NULL 0 /* null pointer constant */
+#endif
-#ifdef RUBY_LIB_PREFIX
#define xmalloc ruby_xmalloc
#define xfree ruby_xfree
-#endif
extern void xfree();
extern pointer xmalloc();
diff --git a/missing/crt_externs.h b/missing/crt_externs.h
new file mode 100644
index 0000000000..cc96d46738
--- /dev/null
+++ b/missing/crt_externs.h
@@ -0,0 +1,8 @@
+#ifndef MISSING_CRT_EXTERNS_H
+#define MISSING_CRT_EXTERNS_H
+
+char ***_NSGetEnviron();
+#undef environ
+#define environ (*_NSGetEnviron())
+
+#endif
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 763c49d675..829f431ddc 100644
--- a/missing/flock.c
+++ b/missing/flock.c
@@ -1,9 +1,10 @@
#include "ruby/config.h"
+#include "ruby/ruby.h"
#if defined _WIN32
-#elif defined HAVE_FCNTL && defined HAVE_FCNTL_H
+#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
@@ -72,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/setproctitle.c b/missing/setproctitle.c
index d35e70d534..9dcf37560b 100644
--- a/missing/setproctitle.c
+++ b/missing/setproctitle.c
@@ -49,9 +49,13 @@
#include <string.h>
#if defined(__APPLE__)
-#include <crt_externs.h>
-#undef environ
-#define environ (*_NSGetEnviron())
+# ifdef HAVE_CRT_EXTERNS_H
+# include <crt_externs.h>
+# undef environ
+# define environ (*_NSGetEnviron())
+# else
+# include "crt_externs.h"
+# endif
#endif
#define SPT_NONE 0 /* don't use it at all */
diff --git a/nacl/GNUmakefile.in b/nacl/GNUmakefile.in
new file mode 100644
index 0000000000..c1aaa36c7c
--- /dev/null
+++ b/nacl/GNUmakefile.in
@@ -0,0 +1,87 @@
+# Copyright 2012 Google Inc. All Rights Reserved.
+# Author: yugui@google.com (Yugui Sonoda)
+
+include Makefile
+-include uncommon.mk
+
+NACL_SDK_ROOT=@NACL_SDK_ROOT@
+NACL_TOOLCHAIN=@NACL_TOOLCHAIN@
+NACL_TOOLCHAIN_DIR=$(NACL_SDK_ROOT)/toolchain/$(NACL_TOOLCHAIN)
+CC:=$(NACL_TOOLCHAIN_DIR)/bin/$(CC)
+LD:=$(NACL_TOOLCHAIN_DIR)/bin/$(LD)
+NM:=$(NACL_TOOLCHAIN_DIR)/bin/$(NM)
+AR:=$(NACL_TOOLCHAIN_DIR)/bin/$(AR)
+AS:=$(NACL_TOOLCHAIN_DIR)/bin/$(AS)
+RANLIB:=$(NACL_TOOLCHAIN_DIR)/bin/$(RANLIB)
+OBJDUMP:=$(NACL_TOOLCHAIN_DIR)/bin/$(OBJDUMP)
+OBJCOPY:=$(NACL_TOOLCHAIN_DIR)/bin/$(OBJCOPY)
+PYTHON=@PYTHON@
+
+PPROGRAM=pepper-$(PROGRAM)
+PEPPER_LIBS=-lppapi
+PROGRAM_NMF=$(PROGRAM:.nexe=.nmf)
+PPROGRAM_NMF=$(PPROGRAM:.nexe=.nmf)
+
+GNUmakefile: $(srcdir)/nacl/GNUmakefile.in
+$(PPROGRAM): $(PROGRAM) pepper_main.$(OBJEXT)
+ $(Q)$(MAKE) $(MFLAGS) PROGRAM=$(PPROGRAM) MAINOBJ="pepper_main.$(OBJEXT)" LIBS="$(LIBS) $(PEPPER_LIBS)" program
+$(PROGRAM_NMF) $(PPROGRAM_NMF): $(@:.nmf=.nexe) nacl/create_nmf.rb
+
+.PHONY: pprogram package show_naclflags
+.SUFFIXES: .nexe .nmf
+.nexe.nmf:
+ $(ECHO) generating manifest $@
+ $(Q)$(MINIRUBY) $(srcdir)/nacl/create_nmf.rb --verbose=$(V) $(@:.nmf=.nexe) $@
+
+pepper_main.$(OBJEXT): $(srcdir)/nacl/pepper_main.c
+ @$(ECHO) compiling nacl/pepper_main.c
+ $(Q) $(CC) $(CFLAGS) $(XCFLAGS) $(CPPFLAGS) $(COUTFLAG)$@ -c $(srcdir)/nacl/pepper_main.c
+ruby.$(OBJEXT):
+ @$(ECHO) compiling $<
+ $(Q) $(CC) $(CFLAGS) $(XCFLAGS) $(CPPFLAGS) $(COUTFLAG)$@.tmp -c $<
+ $(Q) $(OBJCOPY) --weaken-symbol=rb_load_file $@.tmp $@
+ @-$(RM) $@.tmp
+file.$(OBJEXT):
+ @$(ECHO) compiling $<
+ $(Q) $(CC) $(CFLAGS) $(XCFLAGS) $(CPPFLAGS) $(COUTFLAG)$@.tmp -c $<
+ $(Q) $(OBJCOPY) --weaken-symbol=rb_file_load_ok $@.tmp $@
+ @-$(RM) $@.tmp
+
+.rbconfig.time:
+ @$(MAKE) .rbconfig.raw.time RBCONFIG=.rbconfig.raw.time
+ @sed \
+ -e 's!CONFIG\["CC"\] = .*!CONFIG\["CC"\] = "$(CC)"!' \
+ -e 's!CONFIG\["LD"\] = .*!CONFIG\["LD"\] = "$(LD)"!' \
+ -e 's!CONFIG\["NM"\] = .*!CONFIG\["NM"\] = "$(NM)"!' \
+ -e 's!CONFIG\["AR"\] = .*!CONFIG\["AR"\] = "$(AR)"!' \
+ -e 's!CONFIG\["AS"\] = .*!CONFIG\["AS"\] = "$(AS)"!' \
+ -e 's!CONFIG\["RANLIB"\] = .*!CONFIG\["RANLIB"\] = "$(RANLIB)"!' \
+ -e 's!CONFIG\["OBJDUMP"\] = .*!CONFIG\["OBJDUMP"\] = "$(OBJDUMP)"!' \
+ -e 's!CONFIG\["OBJCOPY"\] = .*!CONFIG\["OBJCOPY"\] = "$(OBJCOPY)"!' \
+ -i.bak rbconfig.rb
+ @touch .rbconfig.time
+
+all: pprogram
+main: $(PROGRAM_NMF)
+pprogram: showflags $(PPROGRAM) $(PPROGRAM_NMF)
+program: $(PROGRAM_NMF)
+prog: pprogram
+
+package: pprogram install-lib install-ext-comm install-ext-arch
+ $(INSTALL_DATA) $(srcdir)/nacl/example.html $(prefix)
+ $(ECHO) generating manifest $@
+ $(Q)$(MINIRUBY) $(srcdir)/nacl/package.rb $(prefix)
+
+showflags: show_naclflags
+
+show_naclflags:
+ @echo " NACL_SDK_ROOT = $(NACL_SDK_ROOT)"
+ @echo " NM = $(NM)"
+ @echo " AR = $(AR)"
+ @echo " AS = $(AS)"
+ @echo " RANLIB = $(RANLIB)"
+ @echo " OBJDUMP = $(OBJDUMP)"
+ @echo " OBJCOPY = $(OBJCOPY)"
+
+clean-local::
+ -$(RM) $(PPROGRAM) pepper_main.$(OBJEXT) $(PROGRAM_NMF) $(PPRGORAM_NMF)
diff --git a/nacl/README.nacl b/nacl/README.nacl
new file mode 100644
index 0000000000..471c3b5e5f
--- /dev/null
+++ b/nacl/README.nacl
@@ -0,0 +1,34 @@
+=begin
+= Native Client port of Ruby
+
+= How to build
+== Prerequisites
+You need to install the following things before building NaCl port of Ruby.
+* Ruby 1.9.3 or later
+* Python 2.6 or later
+* NativeClient SDK pepper 22 or later
+* GNU make
+
+== Steps
+(1) Extract all files from the tarball:
+ $ tar xzf ruby-X.Y.Z.tar.gz
+(2) Set NACL_SDK_ROOT environment variable to the path to the Native Client SDK you installed:
+ $ export NACL_SDK_ROOT=/home/yugui/src/nacl_sdk/pepper_16
+(3) Configure
+ $ ./configure --prefix=/tmp/nacl-ruby --host=x86_64-nacl --with-baseruby=/path/to/ruby-1.9.3
+(4) Make
+ $ make
+ $ make package
+
+Now you have ruby.nexe. You can run it by sel_ldr in NaCl SDK.
+
+"make package" installs "pepper-ruby.nexe", an example Pepper application that
+embeds Ruby", and libraries to $prefix. You can run it by the following steps:
+(5) Publish the $prefix directory on a web server
+(6) Visit the example.html on the web server by a browser that implements Pepper 18 or later.
+ -- e.g., Chrome 18 implements Pepper 18, Chrome 19 implements Pepper 19, ...
+
+= Copyright
+* Copyright 2012 Google Inc. All Rights Reserved.
+* Author: yugui@google.com (Yugui Sonoda)
+=end
diff --git a/nacl/create_nmf.rb b/nacl/create_nmf.rb
new file mode 100644
index 0000000000..cdfe7ad239
--- /dev/null
+++ b/nacl/create_nmf.rb
@@ -0,0 +1,70 @@
+#!/usr/bin/ruby
+# Copyright:: Copyright 2012 Google Inc.
+# License:: All Rights Reserved.
+# Original Author:: Yugui Sonoda (mailto:yugui@google.com)
+#
+# Wrapper for create_nmf.py / generate_nmf.py
+
+require File.join(File.dirname(__FILE__), 'nacl-config')
+
+include NaClConfig
+$verbosity = 0
+
+def usage_and_exit
+ $stderr.puts "Usage: #{$PROGRAM_NAME} [--verbose=N] path/to/input.nexe path/to/output.nmf"
+ exit false
+end
+
+def create_dynamically_linked(nmf, exe)
+ cmd = [
+ PYTHON, CREATE_NMF,
+ '-o', nmf,
+ '-D', OBJDUMP,
+ '-L', HOST_LIB,
+ exe
+ ]
+ puts cmd.join(' ') if $verbosity > 0
+ exec(*cmd)
+end
+
+def create_statically_linked(nmf, exe)
+ File.open(nmf, "w") {|f|
+ f.write <<-EOS.gsub(/^ {6}/, '')
+ {
+ "program": {
+ "#{ARCH}": {
+ "url": "#{exe}"
+ }
+ }
+ }
+ EOS
+ }
+end
+
+def main
+ while m = ARGV.first.match(/--([a-z-]+)(?:=(\S+))?/)
+ case m[1]
+ when 'verbose'
+ usage_and_exit unless m[2][/\A[0-9]+\z/]
+ $verbosity = m[2].to_i
+ when 'help'
+ usage_end_exit
+ end
+ ARGV.shift
+ end
+
+ usage_and_exit if ARGV.size < 2
+
+ exe, nmf = ARGV[0], ARGV[1]
+ if newlib?
+ create_statically_linked(nmf, exe)
+ else
+ create_dynamically_linked(nmf, exe)
+ end
+end
+
+if __FILE__ == $0
+ main()
+end
+
+
diff --git a/nacl/dirent.h b/nacl/dirent.h
new file mode 100644
index 0000000000..31bdad31b7
--- /dev/null
+++ b/nacl/dirent.h
@@ -0,0 +1,15 @@
+/*
+ * Copyright 2011 Google Inc. All Rights Reserved.
+ * Author: yugui@google.com (Yugui Sonoda)
+ */
+#ifndef RUBY_NACL_DIRENT_H
+#define RUBY_NACL_DIRENT_H
+
+/* NaCl SDK 0.3 has implementations of dir functions but no declaration in
+ * dirent.h */
+int readdir_r(DIR *dirp, struct dirent *entry, struct dirent **result);
+void rewinddir(DIR *dirp);
+long telldir(DIR *dirp);
+void seekdir(DIR *dirp, long offset);
+
+#endif
diff --git a/nacl/example.html b/nacl/example.html
new file mode 100644
index 0000000000..3cc33298dd
--- /dev/null
+++ b/nacl/example.html
@@ -0,0 +1,150 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <title>Ruby Example</title>
+
+ <script type="text/javascript">
+ RubyModule = null; // Global application object.
+ statusText = 'NO-STATUS';
+ rubyReady = false;
+
+ // Indicate load success.
+ function moduleDidLoad() {
+ RubyModule = document.getElementById('ruby');
+ form = document.getElementById('source-form');
+ form.style.display = "block";
+ updateStatus('SUCCESS');
+ }
+
+ function evalSource() {
+ if (rubyReady) {
+ RubyModule.postMessage('eval:' + document.getElementById("source").value);
+ } else {
+ throw "Not yet ready";
+ }
+ return false;
+ }
+
+ function RubyError(message) {
+ this.message = message;
+ this.toString = function() {
+ return message;
+ }
+ }
+
+ function FatalError(message) {
+ this.message = message;
+ }
+
+ // The 'message' event handler. This handler is fired when the NaCl module
+ // posts a message to the browser by calling PPB_Messaging.PostMessage()
+ // (in C) or pp::Instance.PostMessage() (in C++). This implementation
+ // simply displays the content of the message in an alert panel.
+ function handleMessage(message_event) {
+ var raw = message_event.data;
+ var components;
+ if (raw.indexOf("error") == 0) {
+ components = raw.split(":", 2);
+ throw new RubyError(components[1]);
+ } else if (raw.indexOf("return") == 0) {
+ components = raw.split(":", 2);
+ document.getElementById("result").value = components[1];
+ } else if (raw == "rubyReady") {
+ rubyReady = true;
+ } else {
+ throw new FatalError(raw);
+ }
+ }
+
+ // If the page loads before the Native Client module loads, then set the
+ // status message indicating that the module is still loading. Otherwise,
+ // do not change the status message.
+ function pageDidLoad() {
+ if (RubyModule == null) {
+ updateStatus('LOADING...');
+ } else {
+ // It's possible that the Native Client module onload event fired
+ // before the page's onload event. In this case, the status message
+ // will reflect 'SUCCESS', but won't be displayed. This call will
+ // display the current message.
+ updateStatus();
+ }
+ }
+
+ // Set the global status message. If the element with id 'statusField'
+ // exists, then set its HTML to the status message as well.
+ // opt_message The message test. If this is null or undefined, then
+ // attempt to set the element with id 'statusField' to the value of
+ // |statusText|.
+ function updateStatus(opt_message) {
+ if (opt_message)
+ statusText = opt_message;
+ var statusField = document.getElementById('status_field');
+ if (statusField) {
+ statusField.innerHTML = statusText;
+ }
+ }
+ </script>
+</head>
+<body onload="pageDidLoad()">
+
+<h1>Native Client Module Ruby</h1>
+<p>
+ <!-- Load the published .nexe. This includes the 'nacl' attribute which
+ shows how to load multi-architecture modules. Each entry in the "nexes"
+ object in the .nmf manifest file is a key-value pair: the key is the
+ instruction set architecture ('x86-32', 'x86-64', etc.); the value is a URL
+ for the desired NaCl module.
+ To load the debug versions of your .nexes, set the 'nacl' attribute to the
+ _dbg.nmf version of the manifest file.
+
+ Note: Since this NaCl module does not use any real-estate in the browser,
+ it's width and height are set to 0.
+
+ Note: The <EMBED> element is wrapped inside a <DIV>, which has both a 'load'
+ and a 'message' event listener attached. This wrapping method is used
+ instead of attaching the event listeners directly to the <EMBED> element to
+ ensure that the listeners are active before the NaCl module 'load' event
+ fires. This also allows you to use PPB_Messaging.PostMessage() (in C) or
+ pp::Instance.PostMessage() (in C++) from within the initialization code in
+ your NaCl module.
+ -->
+ <div id="listener">
+ <script type="text/javascript">
+ var listener = document.getElementById('listener');
+ listener.addEventListener('load', moduleDidLoad, true);
+ listener.addEventListener('message', handleMessage, true);
+ </script>
+
+ <embed name="nacl_module"
+ id="ruby"
+ width="0" height="0"
+ src="ruby.nmf"
+ type="application/x-nacl" />
+ <form id="source-form" action="#" method="post" style="display:none"
+ onsubmit="evalSource(); return false">
+ <table>
+ <tbody>
+ <tr>
+ <th>Source</th>
+ <td>
+ <textarea rows="10" cols="80" id="source"></textarea>
+ <input type="submit" />
+ </td>
+ </tr>
+ <tr>
+ <th>Result</th>
+ <td>
+ <textarea rows="10" cols="80" id="result"></textarea>
+ </td>
+ </tr>
+ </tbody>
+ </table>
+ </form>
+ </div>
+</p>
+
+<h2>Status</h2>
+<div id="status_field">NO-STATUS</div>
+</body>
+</html>
diff --git a/nacl/ioctl.h b/nacl/ioctl.h
new file mode 100644
index 0000000000..0a18eeb3f5
--- /dev/null
+++ b/nacl/ioctl.h
@@ -0,0 +1,7 @@
+// Copyright 2012 Google Inc. All Rights Reserved.
+// Author: yugui@google.com (Yugui Sonoda)
+#ifndef RUBY_NACL_IOCTL_H
+#define RUBY_NACL_IOCTL_H
+int ioctl(int fd, int request, ...);
+struct flock{};
+#endif
diff --git a/nacl/nacl-config.rb b/nacl/nacl-config.rb
new file mode 100644
index 0000000000..b90c9ed100
--- /dev/null
+++ b/nacl/nacl-config.rb
@@ -0,0 +1,61 @@
+#!/usr/bin/ruby
+#
+# Copyright:: Copyright 2012 Google Inc.
+# License:: All Rights Reserved.
+# Original Author:: Yugui Sonoda (mailto:yugui@google.com)
+#
+# Convenient functions/constants for native client specific configurations.
+require 'rbconfig'
+
+module NaClConfig
+ config = RbConfig::CONFIG
+
+ cpu_nick = config['host_alias'].sub(/-gnu$|-newlib$/, '').sub(/-nacl$/, '').sub(/i.86/, 'x86_32')
+ ARCH = cpu_nick.sub('x86_64', 'x86-64').sub('x86_32', 'x86-32')
+ HOST = ARCH.sub(/x86-../, 'x86_64') + '-nacl'
+
+ lib_suffix = config['host_cpu'][/i.86/] ? '32' : ''
+ PYTHON = config['PYTHON']
+ OBJDUMP = config['OBJDUMP']
+ SDK_ROOT = config['NACL_SDK_ROOT']
+ CREATE_NMF = [
+ File.join(SDK_ROOT, 'build_tools', 'nacl_sdk_scons', 'site_tools', 'create_nmf.py'),
+ File.join(SDK_ROOT, 'tools', 'create_nmf.py')
+ ].find{|path| File.exist?(path) } or raise "No create_nmf found"
+ HOST_LIB = File.join(SDK_ROOT, 'toolchain', config['NACL_TOOLCHAIN'], HOST, "lib#{lib_suffix}")
+
+ INSTALL_PROGRAM = config['INSTALL_PROGRAM']
+ INSTALL_LIBRARY = config['INSTALL_DATA']
+
+ SEL_LDR = [
+ File.join(SDK_ROOT, 'toolchain', config['NACL_TOOLCHAIN'], 'bin', "sel_ldr_#{cpu_nick}"),
+ File.join(SDK_ROOT, 'tools', "sel_ldr_#{cpu_nick}")
+ ].find{|path| File.executable?(path)} or raise "No sel_ldr found"
+ IRT_CORE = [
+ File.join(SDK_ROOT, 'toolchain', config['NACL_TOOLCHAIN'], 'bin', "irt_core_#{cpu_nick}.nexe"),
+ File.join(SDK_ROOT, 'tools', "irt_core_#{cpu_nick}.nexe")
+ ].find{|path| File.executable?(path)} or raise "No irt_core found"
+ RUNNABLE_LD = File.join(HOST_LIB, 'runnable-ld.so')
+
+ module_function
+
+ def newlib?
+ RbConfig::CONFIG['NACL_SDK_VARIANT'] == 'newlib'
+ end
+
+ def self.config(name)
+ if NaClConfig::const_defined?(name.upcase)
+ NaClConfig::const_get(name.upcase)
+ elsif NaClConfig::respond_to?(name) and NaClConfig::method(name).arity == 0
+ NaClConfig::send(name)
+ else
+ raise ArgumentError, "No such config: #{name}"
+ end
+ end
+end
+
+if $0 == __FILE__
+ ARGV.each do |arg|
+ puts NaClConfig::config(arg)
+ end
+end
diff --git a/nacl/package.rb b/nacl/package.rb
new file mode 100644
index 0000000000..f4f50f24ed
--- /dev/null
+++ b/nacl/package.rb
@@ -0,0 +1,109 @@
+#!/usr/bin/ruby
+# Copyright:: Copyright 2012 Google Inc.
+# License:: All Rights Reserved.
+# Original Author:: Yugui Sonoda (mailto:yugui@google.com)
+#
+# Generates a runnable package of the pepper API example.
+
+require File.join(File.dirname(__FILE__), 'nacl-config')
+require 'json'
+require 'find'
+require 'fileutils'
+
+include NaClConfig
+
+class Installation
+ include NaClConfig
+
+ SRC_DIRS = [ Dir.pwd, HOST_LIB ]
+
+ def initialize(destdir)
+ @destdir = destdir
+ @manifest = {
+ "files" => {}
+ }
+ ruby_libs.each do |path|
+ raise "Collision of #{path}" if @manifest['files'].key? path
+ @manifest['files'][path] = {
+ ARCH => {
+ "url" => path
+ }
+ }
+ if path[/\.so$/]
+ alternate_path = path.gsub('/', "_")
+ raise "Collision of #{alternate_path}" if @manifest['files'].key? alternate_path
+ @manifest['files'][alternate_path] = {
+ ARCH => {
+ "url" => path
+ }
+ }
+ end
+ end
+ end
+
+ def manifest
+ @manifest.dup
+ end
+
+ def install_program(basename)
+ do_install_binary(basename, File.join(@destdir, "bin", ARCH))
+ @manifest["program"] = {
+ ARCH => {
+ "url" => File.join("bin", ARCH, basename)
+ }
+ }
+ end
+
+ def install_library(name, basename)
+ do_install_binary(basename, File.join(@destdir, "lib", ARCH))
+ @manifest["files"][name] = {
+ ARCH => {
+ "url" => File.join("lib", ARCH, basename)
+ }
+ }
+ end
+
+ private
+ def do_install_binary(basename, dest_dir)
+ full_path = nil
+ catch(:found) {
+ SRC_DIRS.each do |path|
+ full_path = File.join(path, basename)
+ if File.exist? full_path
+ throw :found
+ end
+ end
+ raise Errno::ENOENT, "No such file to install: %s" % basename
+ }
+ FileUtils.mkdir_p dest_dir
+ system("#{INSTALL_PROGRAM} #{full_path} #{dest_dir}")
+ end
+
+ def ruby_libs
+ Find.find(RbConfig::CONFIG['rubylibdir']).select{|path| File.file?(path) }.map{|path| path.sub("#{@destdir}/", "") }
+ end
+end
+
+def install(destdir)
+ inst = Installation.new(destdir)
+ manifest = JSON.parse(File.read("pepper-ruby.nmf"))
+
+ program = File.basename(manifest['program'][ARCH]['url'])
+ inst.install_program(program)
+
+ manifest['files'].each do |name, attr|
+ inst.install_library(name, File.basename(attr[ARCH]["url"]))
+ end
+
+ File.open(File.join(destdir, "ruby.nmf"), "w") {|f|
+ f.puts JSON.pretty_generate(inst.manifest)
+ }
+end
+
+def main
+ install(ARGV[0])
+end
+
+if __FILE__ == $0
+ main()
+end
diff --git a/nacl/pepper_main.c b/nacl/pepper_main.c
new file mode 100644
index 0000000000..c0e497b387
--- /dev/null
+++ b/nacl/pepper_main.c
@@ -0,0 +1,870 @@
+/******************************************************************************
+ Copyright 2012 Google Inc. All Rights Reserved.
+ Author: yugui@google.com (Yugui Sonoda)
+ ******************************************************************************/
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <pthread.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <pthread.h>
+#include "ppapi/c/pp_errors.h"
+#include "ppapi/c/pp_module.h"
+#include "ppapi/c/pp_var.h"
+#include "ppapi/c/ppb.h"
+#include "ppapi/c/ppb_core.h"
+#include "ppapi/c/ppb_file_ref.h"
+#include "ppapi/c/ppb_instance.h"
+#include "ppapi/c/ppb_messaging.h"
+#include "ppapi/c/ppb_url_loader.h"
+#include "ppapi/c/ppb_url_request_info.h"
+#include "ppapi/c/ppb_url_response_info.h"
+#include "ppapi/c/ppb_var.h"
+#include "ppapi/c/ppp.h"
+#include "ppapi/c/ppp_instance.h"
+#include "ppapi/c/ppp_messaging.h"
+
+#include "verconf.h"
+#include "ruby/ruby.h"
+#include "version.h"
+#include "gc.h"
+
+#ifdef HAVE_STRUCT_PPB_CORE
+typedef struct PPB_Core PPB_Core;
+#endif
+#ifdef HAVE_STRUCT_PPB_MESSAGING
+typedef struct PPB_Messaging PPB_Messaging;
+#endif
+#ifdef HAVE_STRUCT_PPB_VAR
+typedef struct PPB_Var PPB_Var;
+#endif
+#ifdef HAVE_STRUCT_PPB_URLLOADER
+typedef struct PPB_URLLoader PPB_URLLoader;
+#endif
+#ifdef HAVE_STRUCT_PPB_URLREQUESTINFO
+typedef struct PPB_URLRequestInfo PPB_URLRequestInfo;
+#endif
+#ifdef HAVE_STRUCT_PPB_URLRESPONSEINFO
+typedef struct PPB_URLResponseInfo PPB_URLResponseInfo;
+#endif
+#ifdef HAVE_STRUCT_PPP_INSTANCE
+typedef struct PPP_Instance PPP_Instance;
+#endif
+
+static PP_Module module_id = 0;
+static PPB_Core* core_interface = NULL;
+static PPB_Messaging* messaging_interface = NULL;
+static PPB_Var* var_interface = NULL;
+static PPB_URLLoader* loader_interface = NULL;
+static PPB_URLRequestInfo* request_interface = NULL;
+static PPB_URLResponseInfo* response_interface = NULL;
+static PPB_FileRef* fileref_interface = NULL;
+static struct st_table* instance_data = NULL;
+
+static VALUE instance_table = Qundef;
+
+static PP_Instance current_instance = 0;
+
+/******************************************************************************
+ * State of instance
+ ******************************************************************************/
+
+static void inst_mark(void *const ptr);
+static void inst_free(void *const ptr);
+static size_t inst_memsize(void *const ptr);
+static const rb_data_type_t pepper_instance_data_type = {
+ "PepperInstance",
+ { inst_mark, inst_free, inst_memsize }
+};
+
+struct PepperInstance {
+ PP_Instance instance;
+ PP_Resource url_loader;
+ VALUE self;
+ void* async_call_args;
+ union {
+ int32_t as_int;
+ const char* as_str;
+ VALUE as_value;
+ } async_call_result;
+ char buf[1000];
+
+ pthread_t th;
+ pthread_mutex_t mutex;
+ pthread_cond_t cond;
+};
+
+struct PepperInstance*
+pruby_get_instance(PP_Instance instance)
+{
+ VALUE self = rb_hash_aref(instance_table, INT2FIX(instance));
+ if (RTEST(self)) {
+ struct PepperInstance *inst;
+ TypedData_Get_Struct(self, struct PepperInstance, &pepper_instance_data_type, inst);
+ return inst;
+ }
+ else {
+ return NULL;
+ }
+}
+
+#define GET_PEPPER_INSTANCE() (pruby_get_instance(current_instance))
+
+struct PepperInstance*
+pruby_register_instance(PP_Instance instance)
+{
+ VALUE obj;
+ struct PepperInstance *data;
+ obj = TypedData_Make_Struct(rb_cData, struct PepperInstance, &pepper_instance_data_type, data);
+ data->self = obj;
+ data->instance = instance;
+ data->url_loader = 0;
+
+ pthread_mutex_init(&data->mutex, NULL);
+ pthread_cond_init(&data->cond, NULL);
+
+ rb_hash_aset(instance_table, INT2FIX(instance), obj);
+ return data;
+}
+
+int
+pruby_unregister_instance(PP_Instance instance)
+{
+ VALUE inst = rb_hash_delete(instance_table, INT2FIX(instance));
+ return RTEST(inst);
+}
+
+static void
+inst_mark(void *const ptr)
+{
+ RUBY_MARK_ENTER("PepperInstance"0);
+ if (ptr) {
+ const struct PepperInstance* inst = (struct PepperInstance*)ptr;
+ RUBY_MARK_UNLESS_NULL(inst->async_call_result.as_value);
+ }
+ RUBY_MARK_LEAVE("PepperInstance"0);
+}
+
+static void
+inst_free(void *const ptr)
+{
+ ruby_xfree(ptr);
+}
+
+static size_t
+inst_memsize(void *const ptr)
+{
+ if (ptr) {
+ const struct PepperInstance* inst = (struct PepperInstance*)ptr;
+ return sizeof(*inst);
+ } else {
+ return 0;
+ }
+}
+
+void
+pruby_async_return_int(void* data, int32_t result)
+{
+ /* PPAPI main thread */
+ struct PepperInstance* const instance = (struct PepperInstance*)data;
+ instance->async_call_result.as_int = result;
+ if (pthread_cond_signal(&instance->cond)) {
+ perror("pepper-ruby:pthread_cond_signal");
+ }
+}
+
+void
+pruby_async_return_str(void* data, const char *result)
+{
+ /* PPAPI main thread */
+ struct PepperInstance* const instance = (struct PepperInstance*)data;
+ instance->async_call_result.as_str = result;
+ if (pthread_cond_signal(&instance->cond)) {
+ perror("pepper-ruby:pthread_cond_signal");
+ }
+}
+
+void
+pruby_async_return_value(void* data, VALUE value)
+{
+ /* PPAPI main thread */
+ struct PepperInstance* const instance = (struct PepperInstance*)data;
+ instance->async_call_result.as_value = value;
+ if (pthread_cond_signal(&instance->cond)) {
+ perror("pepper-ruby:pthread_cond_signal");
+ }
+}
+/******************************************************************************
+ * Conversion between Ruby's VALUE, Pepper's Var and C string
+ ******************************************************************************/
+
+/**
+ * Creates a new string PP_Var from C string. The resulting object will be a
+ * refcounted string object. It will be AddRef()ed for the caller. When the
+ * caller is done with it, it should be Release()d.
+ * @param[in] str C string to be converted to PP_Var
+ * @return PP_Var containing string.
+ */
+static struct PP_Var
+pruby_cstr_to_var(const char* str)
+{
+#ifdef PPB_VAR_INTERFACE_1_0
+ if (var_interface != NULL)
+ return var_interface->VarFromUtf8(module_id, str, strlen(str));
+ return PP_MakeUndefined();
+#else
+ return var_interface->VarFromUtf8(str, strlen(str));
+#endif
+}
+
+/**
+ * Returns a mutable C string contained in the @a var or NULL if @a var is not
+ * string. This makes a copy of the string in the @a var and adds a NULL
+ * terminator. Note that VarToUtf8() does not guarantee the NULL terminator on
+ * the returned string. See the comments for VarToUtf8() in ppapi/c/ppb_var.h
+ * for more info. The caller is responsible for freeing the returned memory.
+ * @param[in] var PP_Var containing string.
+ * @return a mutable C string representation of @a var.
+ * @note The caller is responsible for freeing the returned string.
+ */
+static char*
+pruby_var_to_cstr(struct PP_Var var)
+{
+ uint32_t len = 0;
+ if (var_interface != NULL) {
+ const char* var_c_str = var_interface->VarToUtf8(var, &len);
+ if (len > 0) {
+ char* c_str = (char*)malloc(len + 1);
+ memcpy(c_str, var_c_str, len);
+ c_str[len] = '\0';
+ return c_str;
+ }
+ }
+ return NULL;
+}
+
+static struct PP_Var
+pruby_str_to_var(volatile VALUE str)
+{
+ if (!RB_TYPE_P(str, T_STRING)) {
+ fprintf(stderr, "[BUG] Unexpected object type: %x\n", TYPE(str));
+ exit(EXIT_FAILURE);
+ }
+#ifdef PPB_VAR_INTERFACE_1_0
+ if (var_interface != NULL) {
+ return var_interface->VarFromUtf8(module_id, RSTRING_PTR(str), RSTRING_LEN(str));
+ }
+#else
+ return var_interface->VarFromUtf8(RSTRING_PTR(str), RSTRING_LEN(str));
+#endif
+ return PP_MakeUndefined();
+}
+
+static struct PP_Var
+pruby_obj_to_var(volatile VALUE obj)
+{
+ static const char* const error =
+ "throw 'Failed to convert the result to a JavaScript object';";
+ int state;
+ obj = rb_protect(&rb_obj_as_string, obj, &state);
+ if (!state) {
+ return pruby_str_to_var(obj);
+ }
+ else {
+ return pruby_cstr_to_var(error);
+ }
+}
+
+int
+pruby_var_equal_to_cstr_p(struct PP_Var lhs, const char* rhs)
+{
+ uint32_t len = 0;
+ if (var_interface == NULL) {
+ return 0;
+ }
+ else {
+ const char* const cstr = var_interface->VarToUtf8(lhs, &len);
+ return strncmp(cstr, rhs, len) == 0;
+ }
+}
+
+int
+pruby_var_prefixed_p(struct PP_Var var, const char* prefix)
+{
+ uint32_t len = 0;
+ if (var_interface == NULL) {
+ return 0;
+ }
+ else {
+ const char* const cstr = var_interface->VarToUtf8(var, &len);
+ const size_t prefix_len = strlen(prefix);
+ return len >= prefix_len && memcmp(cstr, prefix, len) == 0;
+ }
+}
+
+
+/******************************************************************************
+ * Messaging
+ ******************************************************************************/
+
+/* Posts the given C string as a message.
+ * @param data pointer to a NULL-terminated string */
+void
+pruby_post_cstr(void* data)
+{
+ /* PPAPI main thread */
+ struct PepperInstance* const instance = (struct PepperInstance*)data;
+ const char* const msg = (const char*)instance->async_call_args;
+ messaging_interface->PostMessage(instance->instance,
+ pruby_cstr_to_var(msg));
+}
+
+/* Posts the given Ruby VALUE as a message.
+ * @param data a VALUE casted to void* */
+void
+pruby_post_value(void* data)
+{
+ /* PPAPI main thread */
+ struct PepperInstance* const instance = (struct PepperInstance*)data;
+ volatile VALUE value = (VALUE)instance->async_call_args;
+ messaging_interface->PostMessage(instance->instance, pruby_obj_to_var(value));
+}
+
+
+
+/******************************************************************************
+ * Ruby initialization
+ ******************************************************************************/
+
+static void
+init_loadpath(void)
+{
+ ruby_incpush("lib/ruby/"RUBY_LIB_VERSION);
+ ruby_incpush("lib/ruby/"RUBY_LIB_VERSION"/"RUBY_PLATFORM);
+ ruby_incpush(".");
+}
+
+static VALUE
+init_libraries_internal(VALUE unused)
+{
+ extern void Init_enc();
+ extern void Init_ext();
+
+ init_loadpath();
+ Init_enc();
+ Init_ext();
+ return Qnil;
+}
+
+static void*
+init_libraries(void* data)
+{
+ int state;
+ struct PepperInstance* const instance = (struct PepperInstance*)data;
+ current_instance = instance->instance;
+
+ if (pthread_mutex_lock(&instance->mutex)) {
+ perror("pepper-ruby:pthread_mutex_lock");
+ return 0;
+ }
+ rb_protect(&init_libraries_internal, Qnil, &state);
+ pthread_mutex_unlock(&instance->mutex);
+
+ if (state) {
+ volatile VALUE err = rb_errinfo();
+ err = rb_obj_as_string(err);
+ } else {
+ instance->async_call_args = (void*)"rubyReady";
+ core_interface->CallOnMainThread(
+ 0, PP_MakeCompletionCallback(pruby_post_cstr, instance), 0);
+ }
+ return NULL;
+}
+
+static int
+init_libraries_if_necessary(void)
+{
+ static int initialized = 0;
+ if (!initialized) {
+ struct PepperInstance* const instance = GET_PEPPER_INSTANCE();
+ int err;
+ initialized = 1;
+ err = pthread_create(&instance->th, NULL, &init_libraries, instance);
+ if (err) {
+ fprintf(stderr, "pepper_ruby:pthread_create: %s\n", strerror(err));
+ exit(EXIT_FAILURE);
+ }
+ pthread_detach(instance->th);
+ }
+ return 0;
+}
+
+static int
+pruby_init(void)
+{
+ RUBY_INIT_STACK;
+ ruby_init();
+
+ instance_table = rb_hash_new();
+ rb_gc_register_mark_object(instance_table);
+
+ return 0;
+}
+
+
+/******************************************************************************
+ * Ruby evaluation
+ ******************************************************************************/
+
+static void*
+pruby_eval(void* data)
+{
+ extern VALUE ruby_eval_string_from_file_protect(const char* src, const char* path, int* state);
+ struct PepperInstance* const instance = (struct PepperInstance*)data;
+ volatile VALUE src = (VALUE)instance->async_call_args;
+ volatile VALUE result = Qnil;
+ volatile int state;
+
+ RUBY_INIT_STACK;
+
+ if (pthread_mutex_lock(&instance->mutex)) {
+ perror("pepper-ruby:pthread_mutex_lock");
+ return 0;
+ }
+ result = ruby_eval_string_from_file_protect(
+ RSTRING_PTR(src), "(pepper-ruby)", &state);
+ pthread_mutex_unlock(&instance->mutex);
+
+ if (!state) {
+ instance->async_call_args =
+ rb_str_concat(rb_usascii_str_new_cstr("return:"),
+ rb_obj_as_string(result));
+ core_interface->CallOnMainThread(
+ 0, PP_MakeCompletionCallback(pruby_post_value, instance), 0);
+ return NULL;
+ }
+ else {
+ rb_set_errinfo(Qnil);
+ instance->async_call_args =
+ rb_str_concat(rb_usascii_str_new_cstr("error:"),
+ rb_obj_as_string(result));
+ core_interface->CallOnMainThread(
+ 0, PP_MakeCompletionCallback(pruby_post_value, instance), 0);
+ return NULL;
+ }
+}
+
+
+/******************************************************************************
+ * Pepper Module callbacks
+ ******************************************************************************/
+
+/**
+ * Called when the NaCl module is instantiated on the web page. The identifier
+ * of the new instance will be passed in as the first argument (this value is
+ * generated by the browser and is an opaque handle). This is called for each
+ * instantiation of the NaCl module, which is each time the <embed> tag for
+ * this module is encountered.
+ *
+ * If this function reports a failure (by returning @a PP_FALSE), the NaCl
+ * module will be deleted and DidDestroy will be called.
+ * @param[in] instance The identifier of the new instance representing this
+ * NaCl module.
+ * @param[in] argc The number of arguments contained in @a argn and @a argv.
+ * @param[in] argn An array of argument names. These argument names are
+ * supplied in the <embed> tag, for example:
+ * <embed id="nacl_module" dimensions="2">
+ * will produce two arguments, one named "id" and one named "dimensions".
+ * @param[in] argv An array of argument values. These are the values of the
+ * arguments listed in the <embed> tag. In the above example, there will
+ * be two elements in this array, "nacl_module" and "2". The indices of
+ * these values match the indices of the corresponding names in @a argn.
+ * @return @a PP_TRUE on success.
+ */
+static PP_Bool
+Instance_DidCreate(PP_Instance instance,
+ uint32_t argc, const char* argn[], const char* argv[])
+{
+ struct PepperInstance* data = pruby_register_instance(instance);
+ current_instance = instance;
+ return init_libraries_if_necessary() ? PP_FALSE : PP_TRUE;
+}
+
+/**
+ * Called when the NaCl module is destroyed. This will always be called,
+ * even if DidCreate returned failure. This routine should deallocate any data
+ * associated with the instance.
+ * @param[in] instance The identifier of the instance representing this NaCl
+ * module.
+ */
+static void Instance_DidDestroy(PP_Instance instance) {
+ struct PepperInstance* data = pruby_get_instance(instance);
+ core_interface->ReleaseResource(data->url_loader);
+ pruby_unregister_instance(instance);
+}
+
+/**
+ * Called when the position, the size, or the clip rect of the element in the
+ * browser that corresponds to this NaCl module has changed.
+ * @param[in] instance The identifier of the instance representing this NaCl
+ * module.
+ * @param[in] position The location on the page of this NaCl module. This is
+ * relative to the top left corner of the viewport, which changes as the
+ * page is scrolled.
+ * @param[in] clip The visible region of the NaCl module. This is relative to
+ * the top left of the plugin's coordinate system (not the page). If the
+ * plugin is invisible, @a clip will be (0, 0, 0, 0).
+ */
+#ifdef PPP_INSTANCE_INTERFACE_1_0
+static void
+Instance_DidChangeView(PP_Instance instance,
+ const struct PP_Rect* position,
+ const struct PP_Rect* clip)
+{
+}
+#else
+static void
+Instance_DidChangeView(PP_Instance instance, PP_Resource view_resource)
+{
+}
+#endif
+
+/**
+ * Notification that the given NaCl module has gained or lost focus.
+ * Having focus means that keyboard events will be sent to the NaCl module
+ * represented by @a instance. A NaCl module's default condition is that it
+ * will not have focus.
+ *
+ * Note: clicks on NaCl modules will give focus only if you handle the
+ * click event. You signal if you handled it by returning @a true from
+ * HandleInputEvent. Otherwise the browser will bubble the event and give
+ * focus to the element on the page that actually did end up consuming it.
+ * If you're not getting focus, check to make sure you're returning true from
+ * the mouse click in HandleInputEvent.
+ * @param[in] instance The identifier of the instance representing this NaCl
+ * module.
+ * @param[in] has_focus Indicates whether this NaCl module gained or lost
+ * event focus.
+ */
+static void
+Instance_DidChangeFocus(PP_Instance instance, PP_Bool has_focus)
+{
+}
+
+/**
+ * Handler that gets called after a full-frame module is instantiated based on
+ * registered MIME types. This function is not called on NaCl modules. This
+ * function is essentially a place-holder for the required function pointer in
+ * the PPP_Instance structure.
+ * @param[in] instance The identifier of the instance representing this NaCl
+ * module.
+ * @param[in] url_loader A PP_Resource an open PPB_URLLoader instance.
+ * @return PP_FALSE.
+ */
+static PP_Bool
+Instance_HandleDocumentLoad(PP_Instance instance, PP_Resource url_loader)
+{
+ /* NaCl modules do not need to handle the document load function. */
+ return PP_FALSE;
+}
+
+
+/**
+ * Handler for messages coming in from the browser via postMessage. The
+ * @a var_message can contain anything: a JSON string; a string that encodes
+ * method names and arguments; etc. For example, you could use JSON.stringify
+ * in the browser to create a message that contains a method name and some
+ * parameters, something like this:
+ * var json_message = JSON.stringify({ "myMethod" : "3.14159" });
+ * nacl_module.postMessage(json_message);
+ * On receipt of this message in @a var_message, you could parse the JSON to
+ * retrieve the method name, match it to a function call, and then call it with
+ * the parameter.
+ * @param[in] instance The instance ID.
+ * @param[in] message The contents, copied by value, of the message sent from
+ * browser via postMessage.
+ */
+void
+Messaging_HandleMessage(PP_Instance instance, struct PP_Var var_message)
+{
+ char* const message = pruby_var_to_cstr(var_message);
+ size_t message_len = strlen(message);
+ current_instance = instance;
+
+ if (strstr(message, "eval:") != NULL) {
+ volatile VALUE src;
+ struct PepperInstance* const instance_data = GET_PEPPER_INSTANCE();
+ int err;
+#define EVAL_PREFIX_LEN 5
+ src = rb_str_new(message + EVAL_PREFIX_LEN, message_len - EVAL_PREFIX_LEN);
+ instance_data->async_call_args = (void*)src;
+ err = pthread_create(&instance_data->th, NULL, &pruby_eval, instance_data);
+ if (err) {
+ fprintf(stderr, "pepper_ruby:pthread_create: %s\n", strerror(err));
+ exit(EXIT_FAILURE);
+ }
+ pthread_detach(instance_data->th);
+ }
+ free(message);
+}
+
+/**
+ * Entry points for the module.
+ * Initialize instance interface and scriptable object class.
+ * @param[in] a_module_id Module ID
+ * @param[in] get_browser_interface Pointer to PPB_GetInterface
+ * @return PP_OK on success, any other value on failure.
+ */
+PP_EXPORT int32_t
+PPP_InitializeModule(PP_Module a_module_id, PPB_GetInterface get_browser_interface)
+{
+ module_id = a_module_id;
+ core_interface = (PPB_Core*)(get_browser_interface(PPB_CORE_INTERFACE));
+ if (core_interface == NULL) return PP_ERROR_NOINTERFACE;
+
+ var_interface = (PPB_Var*)(get_browser_interface(PPB_VAR_INTERFACE));
+ if (var_interface == NULL) return PP_ERROR_NOINTERFACE;
+
+ messaging_interface = (PPB_Messaging*)(get_browser_interface(PPB_MESSAGING_INTERFACE));
+ if (messaging_interface == NULL) return PP_ERROR_NOINTERFACE;
+
+ loader_interface = (PPB_URLLoader*)(get_browser_interface(PPB_URLLOADER_INTERFACE));
+ if (loader_interface == NULL) return PP_ERROR_NOINTERFACE;
+
+ request_interface = (PPB_URLRequestInfo*)(get_browser_interface(PPB_URLREQUESTINFO_INTERFACE));
+ if (request_interface == NULL) return PP_ERROR_NOINTERFACE;
+
+ response_interface = (PPB_URLResponseInfo*)(get_browser_interface(PPB_URLRESPONSEINFO_INTERFACE));
+ if (response_interface == NULL) return PP_ERROR_NOINTERFACE;
+
+ fileref_interface = (PPB_FileRef*)(get_browser_interface(PPB_FILEREF_INTERFACE));
+ if (fileref_interface == NULL) return PP_ERROR_NOINTERFACE;
+
+ return pruby_init() ? PP_ERROR_FAILED : PP_OK;
+}
+
+/**
+ * Returns an interface pointer for the interface of the given name, or NULL
+ * if the interface is not supported.
+ * @param[in] interface_name name of the interface
+ * @return pointer to the interface
+ */
+PP_EXPORT const void*
+PPP_GetInterface(const char* interface_name)
+{
+ if (strcmp(interface_name, PPP_INSTANCE_INTERFACE) == 0) {
+ static PPP_Instance instance_interface = {
+ &Instance_DidCreate,
+ &Instance_DidDestroy,
+ &Instance_DidChangeView,
+ &Instance_DidChangeFocus,
+ &Instance_HandleDocumentLoad
+ };
+ return &instance_interface;
+ } else if (strcmp(interface_name, PPP_MESSAGING_INTERFACE) == 0) {
+ static PPP_Messaging messaging_interface = {
+ &Messaging_HandleMessage
+ };
+ return &messaging_interface;
+ }
+ return NULL;
+}
+
+/**
+ * Called before the plugin module is unloaded.
+ */
+PP_EXPORT void
+PPP_ShutdownModule()
+{
+ ruby_cleanup(0);
+}
+
+/******************************************************************************
+ * Overwrites rb_file_load_ok
+ ******************************************************************************/
+
+static void
+load_ok_internal(void* data, int32_t unused)
+{
+ /* PPAPI main thread */
+ struct PepperInstance* const instance = (struct PepperInstance*)data;
+ const char *const path = (const char*)instance->async_call_args;
+ PP_Resource req;
+ int result;
+
+ instance->url_loader = loader_interface->Create(instance->instance);
+ req = request_interface->Create(instance->instance);
+ request_interface->SetProperty(
+ req, PP_URLREQUESTPROPERTY_METHOD, pruby_cstr_to_var("HEAD"));
+ request_interface->SetProperty(
+ req, PP_URLREQUESTPROPERTY_URL, pruby_cstr_to_var(path));
+
+ result = loader_interface->Open(
+ instance->url_loader, req,
+ PP_MakeCompletionCallback(pruby_async_return_int, instance));
+ if (result != PP_OK_COMPLETIONPENDING) {
+ pruby_async_return_int(instance, result);
+ }
+}
+
+static void
+pruby_file_fetch_check_response(void* data, int32_t unused)
+{
+ /* PPAPI main thread */
+ PP_Resource res;
+ struct PepperInstance* const instance = (struct PepperInstance*)data;
+
+ res = loader_interface->GetResponseInfo(instance->url_loader);
+ if (res) {
+ struct PP_Var status =
+ response_interface->GetProperty(res, PP_URLRESPONSEPROPERTY_STATUSCODE);
+ if (status.type == PP_VARTYPE_INT32) {
+ pruby_async_return_int(instance, status.value.as_int / 100 == 2 ? PP_OK : PP_ERROR_FAILED);
+ return;
+ }
+ else {
+ messaging_interface->PostMessage(
+ instance->instance, pruby_cstr_to_var("Unexpected type: ResponseInfoInterface::GetProperty"));
+ }
+ }
+ else {
+ messaging_interface->PostMessage(
+ instance->instance, pruby_cstr_to_var("Failed to open URL: URLLoaderInterface::GetResponseInfo"));
+ }
+ pruby_async_return_int(instance, PP_ERROR_FAILED);
+}
+
+
+int
+rb_file_load_ok(const char *path)
+{
+ struct PepperInstance* const instance = GET_PEPPER_INSTANCE();
+ if (path[0] == '.' && path[1] == '/') path += 2;
+
+ instance->async_call_args = (void*)path;
+ core_interface->CallOnMainThread(
+ 0, PP_MakeCompletionCallback(load_ok_internal, instance), 0);
+ if (pthread_cond_wait(&instance->cond, &instance->mutex)) {
+ perror("pepper-ruby:pthread_cond_wait");
+ return 0;
+ }
+ if (instance->async_call_result.as_int != PP_OK) {
+ fprintf(stderr, "Failed to open URL: %d: %s\n",
+ instance->async_call_result.as_int, path);
+ return 0;
+ }
+
+ core_interface->CallOnMainThread(
+ 0, PP_MakeCompletionCallback(pruby_file_fetch_check_response, instance), 0);
+ if (pthread_cond_wait(&instance->cond, &instance->mutex)) {
+ perror("pepper-ruby:pthread_cond_wait");
+ return 0;
+ }
+ return instance->async_call_result.as_int == PP_OK;
+}
+
+/******************************************************************************
+ * Overwrites rb_load_file
+ ******************************************************************************/
+
+static void
+load_file_internal(void* data, int32_t unused)
+{
+ /* PPAPI main thread */
+ struct PepperInstance* const instance = (struct PepperInstance*)data;
+ const char *const path = (const char*)instance->async_call_args;
+ PP_Resource req;
+ int result;
+
+ instance->url_loader = loader_interface->Create(instance->instance);
+ req = request_interface->Create(instance->instance);
+ request_interface->SetProperty(
+ req, PP_URLREQUESTPROPERTY_METHOD, pruby_cstr_to_var("GET"));
+ request_interface->SetProperty(
+ req, PP_URLREQUESTPROPERTY_URL, pruby_cstr_to_var(path));
+
+ result = loader_interface->Open(
+ instance->url_loader, req,
+ PP_MakeCompletionCallback(pruby_async_return_int, instance));
+ if (result != PP_OK_COMPLETIONPENDING) {
+ pruby_async_return_int(instance, result);
+ }
+}
+
+static void
+load_file_read_contents_callback(void *data, int result)
+{
+ struct PepperInstance* const instance = (struct PepperInstance*)data;
+ if (result > 0) {
+ rb_str_buf_cat(instance->async_call_result.as_value,
+ instance->buf, result);
+ loader_interface->ReadResponseBody(
+ instance->url_loader, instance->buf, 1000, PP_MakeCompletionCallback(load_file_read_contents_callback, instance));
+ }
+ else if (result == 0) {
+ pruby_async_return_value(data, instance->async_call_result.as_value);
+ }
+ else {
+ pruby_async_return_value(data, INT2FIX(result));
+ }
+}
+
+static void
+load_file_read_contents(void *data, int result)
+{
+ struct PepperInstance* const instance = (struct PepperInstance*)data;
+ instance->async_call_result.as_value = rb_str_new(0, 0);
+ loader_interface->ReadResponseBody(
+ instance->url_loader, instance->buf, 1000, PP_MakeCompletionCallback(load_file_read_contents_callback, instance));
+}
+
+void*
+rb_load_file(const char *path)
+{
+ const char *real_path;
+ struct PepperInstance* instance;
+ if (path[0] != '.' || path[1] != '/') path += 2;
+
+ instance = GET_PEPPER_INSTANCE();
+
+ instance->async_call_args = (void*)path;
+ core_interface->CallOnMainThread(
+ 0, PP_MakeCompletionCallback(load_file_internal, instance), 0);
+ if (pthread_cond_wait(&instance->cond, &instance->mutex)) {
+ perror("pepper-ruby:pthread_cond_wait");
+ return 0;
+ }
+ if (instance->async_call_result.as_int != PP_OK) {
+ fprintf(stderr, "Failed to open URL: %d: %s\n",
+ instance->async_call_result.as_int, path);
+ return 0;
+ }
+
+ core_interface->CallOnMainThread(
+ 0, PP_MakeCompletionCallback(pruby_file_fetch_check_response, instance), 0);
+ if (pthread_cond_wait(&instance->cond, &instance->mutex)) {
+ perror("pepper-ruby:pthread_cond_wait");
+ return 0;
+ }
+ if (instance->async_call_result.as_int != PP_OK) return 0;
+
+ core_interface->CallOnMainThread(
+ 0, PP_MakeCompletionCallback(load_file_read_contents, instance), 0);
+ if (pthread_cond_wait(&instance->cond, &instance->mutex)) {
+ perror("pepper-ruby:pthread_cond_wait");
+ return 0;
+ }
+ if (FIXNUM_P(instance->async_call_result.as_value)) {
+ return 0;
+ }
+ else if (RB_TYPE_P(instance->async_call_result.as_value, T_STRING)) {
+ VALUE str = instance->async_call_result.as_value;
+ extern void* rb_compile_cstr(const char *f, const char *s, int len, int line);
+ return rb_compile_cstr(path, RSTRING_PTR(str), RSTRING_LEN(str), 0);
+ }
+ else {
+ return 0;
+ }
+}
diff --git a/nacl/resource.h b/nacl/resource.h
new file mode 100644
index 0000000000..57ca53b093
--- /dev/null
+++ b/nacl/resource.h
@@ -0,0 +1,8 @@
+/*
+ * Copyright 2011 Google Inc. All Rights Reserved.
+ * Author: yugui@google.com (Yugui Sonoda)
+ * */
+#ifndef RUBY_NACL_RESOURCE_H
+#define RUBY_NACL_RESOURCE_H
+int getrusage(int who, struct rusage *usage);
+#endif
diff --git a/nacl/select.h b/nacl/select.h
new file mode 100644
index 0000000000..921721a2fd
--- /dev/null
+++ b/nacl/select.h
@@ -0,0 +1,7 @@
+// Copyright 2012 Google Inc. All Rights Reserved.
+// Author: yugui@google.com (Yugui Sonoda)
+#ifndef RUBY_NACL_SELECT_H
+#define RUBY_NACL_SELECT_H
+int select(int num_fds, fd_set *in_fds, fd_set *out_fds,
+ fd_set *ex_fds, struct timeval *timeout);
+#endif
diff --git a/nacl/signal.h b/nacl/signal.h
new file mode 100644
index 0000000000..54832de1fe
--- /dev/null
+++ b/nacl/signal.h
@@ -0,0 +1,6 @@
+// Copyright 2012 Google Inc. All Rights Reserved.
+// Author: yugui@google.com (Yugui Sonoda)
+#ifndef RUBY_NACL_SIGNAL_H
+#define RUBY_NACL_SIGNAL_H
+int kill(pid_t pid, int signal);
+#endif
diff --git a/nacl/stat.h b/nacl/stat.h
new file mode 100644
index 0000000000..7be40ada7c
--- /dev/null
+++ b/nacl/stat.h
@@ -0,0 +1,10 @@
+/*
+ * Copyright 2011 Google Inc. All Rights Reserved.
+ * Author: yugui@google.com (Yugui Sonoda)
+ * */
+#ifndef RUBY_NACL_STAT_H
+#define RUBY_NACL_STAT_H
+mode_t umask(mode_t mask);
+struct stat;
+int lstat(const char* path, struct stat* result);
+#endif
diff --git a/nacl/unistd.h b/nacl/unistd.h
new file mode 100644
index 0000000000..1c97390c63
--- /dev/null
+++ b/nacl/unistd.h
@@ -0,0 +1,9 @@
+// Copyright 2012 Google Inc. All Rights Reserved.
+// Author: yugui@google.com (Yugui Sonoda)
+#ifndef RUBY_NACL_UNISTD_H
+#define RUBY_NACL_UNISTD_H
+int seteuid(pid_t pid);
+int setegid(pid_t pid);
+int truncate(const char* path, off_t new_size);
+int ftruncate(int fd, off_t new_size);
+#endif
diff --git a/nacl/utime.h b/nacl/utime.h
new file mode 100644
index 0000000000..96910051e4
--- /dev/null
+++ b/nacl/utime.h
@@ -0,0 +1,11 @@
+/*
+ * Copyright 2011 Google Inc. All Rights Reserved.
+ * Author: yugui@google.com (Yugui Sonoda)
+ */
+
+#ifndef RUBY_NACL_UTIME_H
+#define RUBY_NACL_UTIME_H
+#include <utime.h>
+int utime(const char *filename, const struct utimbuf *times);
+int utimes(const char *filename, const struct timeval times[2]);
+#endif
diff --git a/node.c b/node.c
index d1f1b70832..472a959ef9 100644
--- a/node.c
+++ b/node.c
@@ -17,8 +17,8 @@
#define A_INDENT add_indent(buf, indent)
#define A_ID(id) add_id(buf, (id))
-#define A_INT(val) rb_str_catf(buf, "%d", (val));
-#define A_LONG(val) rb_str_catf(buf, "%ld", (val));
+#define A_INT(val) rb_str_catf(buf, "%d", (val))
+#define A_LONG(val) rb_str_catf(buf, "%ld", (val))
#define A_LIT(lit) AR(rb_inspect(lit))
#define A_NODE_HEADER(node) \
rb_str_catf(buf, "@ %s (line: %d)", ruby_node_name(nd_type(node)), nd_line(node))
@@ -823,6 +823,15 @@ dump_node(VALUE buf, VALUE indent, int comment, NODE *node)
F_NODE(nd_next, "next");
break;
+ case NODE_KW_ARG:
+ ANN("keyword arguments");
+ ANN("format: def method_name([nd_body=some], [nd_next..])");
+ ANN("example: def foo(a:1, b:2); end");
+ F_NODE(nd_body, "body");
+ LAST_NODE;
+ F_NODE(nd_next, "next");
+ break;
+
case NODE_POSTARG:
ANN("post arguments");
ANN("format: *[nd_1st], [nd_2nd..] = ..");
@@ -837,52 +846,21 @@ dump_node(VALUE buf, VALUE indent, int comment, NODE *node)
F_NODE(nd_2nd, "post arguments");
break;
- case NODE_ARGS_AUX:
- ANN("method parameters (cont'd)");
- F_CUSTOM1(nd_rest, "rest argument", {
- if (node->nd_rest == 1) A("nil (with last comma)");
- else A_ID(node->nd_rest);
- });
- F_CUSTOM1(nd_body, "block argument", { A_ID((ID)node->nd_body); });
- LAST_NODE;
- F_CUSTOM2(nd_next, "aux info 2", {
- node = node->nd_next;
- next_indent = "| ";
- if (!node) {
- D_NULL_NODE;
- }
- else {
- D_NODE_HEADER(node);
- ANN("method parameters (cont'd)");
- F_ID(nd_pid, "first post argument");
- F_LONG(nd_plen, "post argument length");
- LAST_NODE;
- F_CUSTOM2(nd_next, "aux info 3", {
- node = node->nd_next;
- next_indent = "| ";
- if (!node) {
- D_NULL_NODE;
- }
- else {
- D_NODE_HEADER(node);
- ANN("method parameters (cont'd)");
- F_NODE(nd_1st, "init arguments (m)");
- LAST_NODE;
- F_NODE(nd_2nd, "init arguments (p)");
- }
- });
- }
- });
- break;
-
case NODE_ARGS:
ANN("method parameters");
ANN("format: def method_name(.., [nd_opt=some], *[nd_rest], [nd_pid], .., &[nd_body])");
ANN("example: def foo(a, b, opt1=1, opt2=2, *rest, y, z, &blk); end");
- F_LONG(nd_frml, "argc");
- F_NODE(nd_next, "aux info 1");
- LAST_NODE;
- F_NODE(nd_opt, "optional arguments");
+ F_INT(nd_ainfo->pre_args_num, "count of mandatory (pre-)arguments");
+ F_NODE(nd_ainfo->pre_init, "initialization of (pre-)arguments");
+ F_INT(nd_ainfo->post_args_num, "count of mandatory post-arguments");
+ F_NODE(nd_ainfo->post_init, "initialization of post-arguments");
+ F_ID(nd_ainfo->first_post_arg, "first post argument");
+ F_ID(nd_ainfo->rest_arg, "rest argument");
+ F_ID(nd_ainfo->block_arg, "block argument");
+ F_NODE(nd_ainfo->opt_args, "optional arguments");
+ LAST_NODE;
+ F_NODE(nd_ainfo->kw_args, "keyword arguments");
+ F_NODE(nd_ainfo->kw_rest_arg, "keyword rest argument");
break;
case NODE_SCOPE:
diff --git a/node.h b/node.h
index bb96107711..9ee07048c2 100644
--- a/node.h
+++ b/node.h
@@ -88,6 +88,8 @@ enum node_type {
#define NODE_OP_ASGN_AND NODE_OP_ASGN_AND
NODE_OP_ASGN_OR,
#define NODE_OP_ASGN_OR NODE_OP_ASGN_OR
+ NODE_OP_CDECL,
+#define NODE_OP_CDECL NODE_OP_CDECL
NODE_CALL,
#define NODE_CALL NODE_CALL
NODE_FCALL,
@@ -154,6 +156,8 @@ enum node_type {
#define NODE_ARGS_AUX NODE_ARGS_AUX
NODE_OPT_ARG,
#define NODE_OPT_ARG NODE_OPT_ARG
+ NODE_KW_ARG,
+#define NODE_KW_ARG NODE_KW_ARG
NODE_POSTARG,
#define NODE_POSTARG NODE_POSTARG
NODE_ARGSCAT,
@@ -188,6 +192,8 @@ enum node_type {
#define NODE_COLON2 NODE_COLON2
NODE_COLON3,
#define NODE_COLON3 NODE_COLON3
+ NODE_CREF,
+#define NODE_CREF NODE_CREF
NODE_DOT2,
#define NODE_DOT2 NODE_DOT2
NODE_DOT3,
@@ -226,8 +232,6 @@ enum node_type {
#define NODE_PRELUDE NODE_PRELUDE
NODE_LAMBDA,
#define NODE_LAMBDA NODE_LAMBDA
- NODE_OPTBLOCK,
-#define NODE_OPTBLOCK NODE_OPTBLOCK
NODE_LAST
#define NODE_LAST NODE_LAST
};
@@ -253,6 +257,7 @@ typedef struct RNode {
ID id;
long state;
struct rb_global_entry *entry;
+ struct rb_args_info *args;
long cnt;
VALUE value;
} u3;
@@ -260,9 +265,16 @@ typedef struct RNode {
#define RNODE(obj) (R_CAST(RNode)(obj))
-/* 0..4:T_TYPES, 5:FL_MARK, 6:reserved, 7:NODE_FL_NEWLINE */
-#define NODE_FL_NEWLINE (((VALUE)1)<<7)
-#define NODE_FL_CREF_PUSHED_BY_EVAL NODE_FL_NEWLINE
+/* 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)
@@ -277,6 +289,8 @@ typedef struct RNode {
#define nd_set_line(n,l) \
RNODE(n)->flags=((RNODE(n)->flags&~(-1<<NODE_LSHIFT))|(((l)&NODE_LMASK)<<NODE_LSHIFT))
+#define nd_refinements nd_reserved
+
#define nd_head u1.node
#define nd_alen u2.argc
#define nd_next u3.node
@@ -321,6 +335,7 @@ typedef struct RNode {
#define nd_recv u1.node
#define nd_mid u2.id
#define nd_args u3.node
+#define nd_ainfo u3.args
#define nd_noex u3.id
#define nd_defn u3.node
@@ -362,7 +377,7 @@ typedef struct RNode {
#define NEW_UNTIL(c,b,n) NEW_NODE(NODE_UNTIL,c,b,n)
#define NEW_FOR(v,i,b) NEW_NODE(NODE_FOR,v,b,i)
#define NEW_ITER(a,b) NEW_NODE(NODE_ITER,0,NEW_SCOPE(a,b),0)
-#define NEW_LAMBDA(a) NEW_NODE(NODE_LAMBDA,a,0,0)
+#define NEW_LAMBDA(a,b) NEW_NODE(NODE_LAMBDA,0,NEW_SCOPE(a,b),0)
#define NEW_BREAK(s) NEW_NODE(NODE_BREAK,s,0,0)
#define NEW_NEXT(s) NEW_NODE(NODE_NEXT,s,0,0)
#define NEW_REDO() NEW_NODE(NODE_REDO,0,0,0)
@@ -372,7 +387,7 @@ typedef struct RNode {
#define NEW_RESBODY(a,ex,n) NEW_NODE(NODE_RESBODY,n,ex,a)
#define NEW_ENSURE(b,en) NEW_NODE(NODE_ENSURE,b,0,en)
#define NEW_RETURN(s) NEW_NODE(NODE_RETURN,s,0,0)
-#define NEW_YIELD(a,s) NEW_NODE(NODE_YIELD,a,0,s)
+#define NEW_YIELD(a) NEW_NODE(NODE_YIELD,a,0,0)
#define NEW_LIST(a) NEW_ARRAY(a)
#define NEW_ARRAY(a) NEW_NODE(NODE_ARRAY,a,1,0)
#define NEW_ZARRAY() NEW_NODE(NODE_ZARRAY,0,0,0)
@@ -392,6 +407,7 @@ typedef struct RNode {
#define NEW_OP_ASGN22(i,o) NEW_NODE(NODE_OP_ASGN2,i,o,rb_id_attrset(i))
#define NEW_OP_ASGN_OR(i,val) NEW_NODE(NODE_OP_ASGN_OR,i,val,0)
#define NEW_OP_ASGN_AND(i,val) NEW_NODE(NODE_OP_ASGN_AND,i,val,0)
+#define NEW_OP_CDECL(v,op,val) NEW_NODE(NODE_OP_CDECL,v,val,op)
#define NEW_GVAR(v) NEW_NODE(NODE_GVAR,v,0,rb_global_entry(v))
#define NEW_LVAR(v) NEW_NODE(NODE_LVAR,v,0,0)
#define NEW_DVAR(v) NEW_NODE(NODE_DVAR,v,0,0)
@@ -415,9 +431,9 @@ typedef struct RNode {
#define NEW_VCALL(m) NEW_NODE(NODE_VCALL,0,m,0)
#define NEW_SUPER(a) NEW_NODE(NODE_SUPER,0,0,a)
#define NEW_ZSUPER() NEW_NODE(NODE_ZSUPER,0,0,0)
-#define NEW_ARGS(m,o) NEW_NODE(NODE_ARGS,o,m,0)
#define NEW_ARGS_AUX(r,b) NEW_NODE(NODE_ARGS_AUX,r,b,0)
#define NEW_OPT_ARG(i,v) NEW_NODE(NODE_OPT_ARG,i,v,0)
+#define NEW_KW_ARG(i,v) NEW_NODE(NODE_KW_ARG,i,v,0)
#define NEW_POSTARG(i,v) NEW_NODE(NODE_POSTARG,i,v,0)
#define NEW_ARGSCAT(a,b) NEW_NODE(NODE_ARGSCAT,a,b,0)
#define NEW_ARGSPUSH(a,b) NEW_NODE(NODE_ARGSPUSH,a,b,0)
@@ -433,6 +449,7 @@ typedef struct RNode {
#define NEW_MODULE(n,b) NEW_NODE(NODE_MODULE,n,NEW_SCOPE(0,b),0)
#define NEW_COLON2(c,i) NEW_NODE(NODE_COLON2,c,i,0)
#define NEW_COLON3(i) NEW_NODE(NODE_COLON3,0,i,0)
+#define NEW_CREF(a) NEW_NODE(NODE_CREF,a,0,0)
#define NEW_DOT2(b,e) NEW_NODE(NODE_DOT2,b,e,0)
#define NEW_DOT3(b,e) NEW_NODE(NODE_DOT3,b,e,0)
#define NEW_SELF() NEW_NODE(NODE_SELF,0,0,0)
@@ -446,11 +463,16 @@ typedef struct RNode {
#define NEW_BMETHOD(b) NEW_NODE(NODE_BMETHOD,0,0,b)
#define NEW_ATTRASGN(r,m,a) NEW_NODE(NODE_ATTRASGN,r,m,a)
#define NEW_PRELUDE(p,b) NEW_NODE(NODE_PRELUDE,p,b,0)
-#define NEW_OPTBLOCK(a) NEW_NODE(NODE_OPTBLOCK,a,0,0)
+#define NEW_MEMO(a,b,c) NEW_NODE(NODE_MEMO,a,b,c)
-#if defined __GNUC__ && __GNUC__ >= 4
-#pragma GCC visibility push(default)
-#endif
+#define roomof(x, y) ((sizeof(x) + sizeof(y) - 1) / sizeof(y))
+#define MEMO_FOR(type, value) ((type *)RARRAY_PTR(value))
+#define NEW_MEMO_FOR(type, value) \
+ (rb_ary_set_len(((value) = rb_ary_tmp_new(roomof(type, VALUE))), \
+ roomof(type, VALUE)), \
+ MEMO_FOR(type, value))
+
+RUBY_SYMBOL_EXPORT_BEGIN
VALUE rb_parser_new(void);
VALUE rb_parser_end_seen_p(VALUE);
@@ -464,6 +486,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);
@@ -483,15 +507,31 @@ VALUE rb_gvar_set(struct rb_global_entry *, VALUE);
VALUE rb_gvar_defined(struct rb_global_entry *);
const struct kwtable *rb_reserved_word(const char *, unsigned int);
+struct rb_args_info {
+ NODE *pre_init;
+ NODE *post_init;
+
+ int pre_args_num; /* count of mandatory pre-arguments */
+ int post_args_num; /* count of mandatory post-arguments */
+
+ ID first_post_arg;
+
+ ID rest_arg;
+ ID block_arg;
+
+ NODE *kw_args;
+ NODE *kw_rest_arg;
+
+ NODE *opt_args;
+};
+
struct parser_params;
void *rb_parser_malloc(struct parser_params *, size_t);
void *rb_parser_realloc(struct parser_params *, void *, size_t);
void *rb_parser_calloc(struct parser_params *, size_t, size_t);
void rb_parser_free(struct parser_params *, void *);
-#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 56f08bc237..734ab3455b 100644
--- a/numeric.c
+++ b/numeric.c
@@ -13,6 +13,7 @@
#include "ruby/encoding.h"
#include "ruby/util.h"
#include "internal.h"
+#include "id.h"
#include <ctype.h>
#include <math.h>
#include <stdio.h>
@@ -29,6 +30,10 @@
#include <ieeefp.h>
#endif
+#if defined HAVE_FINITE && !defined finite && !defined _WIN32
+extern int finite(double);
+#endif
+
/* use IEEE 64bit values if not defined */
#ifndef FLT_RADIX
#define FLT_RADIX 2
@@ -66,16 +71,16 @@
#ifdef HAVE_INFINITY
#elif !defined(WORDS_BIGENDIAN) /* BYTE_ORDER == LITTLE_ENDIAN */
-const unsigned char rb_infinity[] = "\x00\x00\x80\x7f";
+const union bytesequence4_or_float rb_infinity = {{0x00, 0x00, 0x80, 0x7f}};
#else
-const unsigned char rb_infinity[] = "\x7f\x80\x00\x00";
+const union bytesequence4_or_float rb_infinity = {{0x7f, 0x80, 0x00, 0x00}};
#endif
#ifdef HAVE_NAN
#elif !defined(WORDS_BIGENDIAN) /* BYTE_ORDER == LITTLE_ENDIAN */
-const unsigned char rb_nan[] = "\x00\x00\xc0\x7f";
+const union bytesequence4_or_float rb_nan = {{0x00, 0x00, 0xc0, 0x7f}};
#else
-const unsigned char rb_nan[] = "\x7f\xc0\x00\x00";
+const union bytesequence4_or_float rb_nan = {{0x7f, 0xc0, 0x00, 0x00}};
#endif
#ifndef HAVE_ROUND
@@ -100,7 +105,7 @@ static VALUE fix_uminus(VALUE num);
static VALUE fix_mul(VALUE x, VALUE y);
static VALUE int_pow(long x, unsigned long y);
-static ID id_coerce, id_to_i, id_eq;
+static ID id_coerce, id_to_i, id_eq, id_div;
VALUE rb_cNumeric;
VALUE rb_cFloat;
@@ -110,6 +115,8 @@ VALUE rb_cFixnum;
VALUE rb_eZeroDivError;
VALUE rb_eFloatDomainError;
+static VALUE sym_to, sym_by;
+
void
rb_num_zerodiv(void)
{
@@ -133,16 +140,14 @@ rb_num_to_uint(VALUE val, unsigned int *ret)
return 0;
}
- switch (TYPE(val)) {
- case T_BIGNUM:
+ if (RB_TYPE_P(val, T_BIGNUM)) {
if (RBIGNUM_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
@@ -150,16 +155,57 @@ rb_num_to_uint(VALUE val, unsigned int *ret)
return NUMERR_TYPE;
}
+#define method_basic_p(klass) rb_method_basic_definition_p(klass, mid)
+
+static inline int
+positive_int_p(VALUE num)
+{
+ const ID mid = '>';
+
+ if (FIXNUM_P(num)) {
+ if (method_basic_p(rb_cFixnum))
+ return (SIGNED_VALUE)num > 0;
+ }
+ else if (RB_TYPE_P(num, T_BIGNUM)) {
+ if (method_basic_p(rb_cBignum))
+ return RBIGNUM_POSITIVE_P(num);
+ }
+ return RTEST(rb_funcall(num, mid, 1, INT2FIX(0)));
+}
+
+static inline int
+negative_int_p(VALUE num)
+{
+ const ID mid = '<';
+
+ if (FIXNUM_P(num)) {
+ if (method_basic_p(rb_cFixnum))
+ return (SIGNED_VALUE)num < 0;
+ }
+ else if (RB_TYPE_P(num, T_BIGNUM)) {
+ if (method_basic_p(rb_cBignum))
+ return RBIGNUM_NEGATIVE_P(num);
+ }
+ return RTEST(rb_funcall(num, mid, 1, INT2FIX(0)));
+}
+
+int
+rb_num_negative_p(VALUE num)
+{
+ return negative_int_p(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]
@@ -192,6 +238,7 @@ coerce_rescue(VALUE *x)
RSTRING_PTR(v):
rb_obj_classname(x[1]),
rb_obj_classname(x[0]));
+
return Qnil; /* dummy */
}
@@ -203,16 +250,23 @@ do_coerce(VALUE *x, VALUE *y, int err)
a[0] = *x; a[1] = *y;
- ary = rb_rescue(coerce_body, (VALUE)a, err?coerce_rescue:0, (VALUE)a);
- if (TYPE(ary) != T_ARRAY || RARRAY_LEN(ary) != 2) {
+ if (!rb_respond_to(*y, id_coerce)) {
+ if (err) {
+ coerce_rescue(a);
+ }
+ return FALSE;
+ }
+
+ ary = rb_rescue(coerce_body, (VALUE)a, err ? coerce_rescue : 0, (VALUE)a);
+ if (!RB_TYPE_P(ary, T_ARRAY) || RARRAY_LEN(ary) != 2) {
if (err) {
rb_raise(rb_eTypeError, "coerce must return [x, y]");
}
return FALSE;
}
- *x = RARRAY_PTR(ary)[0];
- *y = RARRAY_PTR(ary)[1];
+ *x = RARRAY_AREF(ary, 0);
+ *y = RARRAY_AREF(ary, 1);
return TRUE;
}
@@ -245,8 +299,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
@@ -254,22 +309,26 @@ 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));
- return Qnil; /* not reached */
+
+ 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));
- return Qnil; /* not reached */
+
+ UNREACHABLE;
}
/*
@@ -320,20 +379,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.
@@ -350,14 +395,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
@@ -374,10 +417,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
@@ -394,7 +436,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
@@ -403,10 +445,10 @@ num_remainder(VALUE x, VALUE y)
VALUE z = rb_funcall(x, '%', 1, y);
if ((!rb_equal(z, INT2FIX(0))) &&
- ((RTEST(rb_funcall(x, '<', 1, INT2FIX(0))) &&
- RTEST(rb_funcall(y, '>', 1, INT2FIX(0)))) ||
- (RTEST(rb_funcall(x, '>', 1, INT2FIX(0))) &&
- RTEST(rb_funcall(y, '<', 1, INT2FIX(0)))))) {
+ ((negative_int_p(x) &&
+ positive_int_p(y)) ||
+ (positive_int_p(x) &&
+ negative_int_p(y)))) {
return rb_funcall(z, '-', 1, y);
}
return z;
@@ -416,9 +458,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
@@ -463,8 +506,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
@@ -477,8 +519,10 @@ num_real_p(VALUE num)
* call-seq:
* num.integer? -> true or false
*
- * Returns <code>true</code> if <i>num</i> is an <code>Integer</code>
- * (including <code>Fixnum</code> and <code>Bignum</code>).
+ * Returns +true+ if +num+ is an Integer (including Fixnum and Bignum).
+ *
+ * (1.0).integer? #=> false
+ * (1).integer? #=> true
*/
static VALUE
@@ -492,17 +536,19 @@ 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
num_abs(VALUE num)
{
- if (RTEST(rb_funcall(num, '<', 1, INT2FIX(0)))) {
+ if (negative_int_p(num)) {
return rb_funcall(num, rb_intern("-@"), 0);
}
return num;
@@ -513,7 +559,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
@@ -530,8 +576,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 }
@@ -551,8 +598,11 @@ num_nonzero_p(VALUE num)
* call-seq:
* num.to_int -> integer
*
- * Invokes the child class's <code>to_i</code> method to convert
- * <i>num</i> to an integer.
+ * Invokes the child class's +to_i+ method to convert +num+ to an integer.
+ *
+ * 1.0.class => Float
+ * 1.0.to_int.class => Fixnum
+ * 1.0.to_i.class => Fixnum
*/
static VALUE
@@ -566,36 +616,34 @@ 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
- * - http://wiki.github.com/rdp/ruby_tutorials_core/ruby-talk-faq#floats_imprecise
+ * - http://wiki.github.com/rdp/ruby_tutorials_core/ruby-talk-faq#wiki-floats_imprecise
* - http://en.wikipedia.org/wiki/Floating_point#Accuracy_problems
*/
VALUE
-rb_float_new(double d)
+rb_float_new_in_heap(double d)
{
- NEWOBJ(flt, struct RFloat);
- OBJSETUP(flt, 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);
return (VALUE)flt;
}
/*
* 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
@@ -626,7 +674,7 @@ flo_to_s(VALUE flt)
buf[decpt] = '.';
rb_str_cat(s, buf, digs + 1);
}
- else if (decpt - digs < float_dig) {
+ else if (decpt <= DBL_DIG) {
long len;
char *ptr;
rb_str_cat(s, buf, digs);
@@ -669,11 +717,12 @@ flo_to_s(VALUE flt)
/*
* call-seq:
- * flt.coerce(numeric) -> array
+ * float.coerce(numeric) -> array
+ *
+ * Returns an array with both a +numeric+ and a +float+ represented as Float
+ * objects.
*
- * 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>.
+ * 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]
@@ -702,21 +751,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, '+');
}
}
@@ -725,21 +775,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, '-');
}
}
@@ -748,21 +799,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, '*');
}
}
@@ -771,8 +823,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
@@ -781,25 +832,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
@@ -814,7 +868,7 @@ flodivmod(double x, double y, double *divp, double *modp)
double div, mod;
if (y == 0.0) rb_num_zerodiv();
- if((x == 0.0) || (isinf(y) && !isinf(x)))
+ if ((x == 0.0) || (isinf(y) && !isinf(x)))
mod = x;
else {
#ifdef HAVE_FMOD
@@ -843,7 +897,9 @@ flodivmod(double x, double y, double *divp, double *modp)
* An error will be raised if y == 0.
*/
-double ruby_float_mod(double x, double y) {
+double
+ruby_float_mod(double x, double y)
+{
double mod;
flodivmod(x, y, 0, &mod);
return mod;
@@ -852,10 +908,10 @@ double ruby_float_mod(double x, double y) {
/*
* call-seq:
- * flt % other -> float
- * flt.modulo(other) -> float
+ * float % other -> float
+ * float.modulo(other) -> float
*
- * Return the modulo after division of <code>flt</code> by <code>other</code>.
+ * Return the modulo after division of +float+ by +other+.
*
* 6543.21.modulo(137) #=> 104.21
* 6543.21.modulo(137.24) #=> 92.9299999999996
@@ -866,17 +922,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));
@@ -894,9 +949,12 @@ dbl2ival(double d)
/*
* call-seq:
- * flt.divmod(numeric) -> array
+ * float.divmod(numeric) -> array
*
- * See <code>Numeric#divmod</code>.
+ * See Numeric#divmod.
+ *
+ * 42.0.divmod 6 #=> [7, 0.0]
+ * 42.0.divmod 5 #=> [8, 2.0]
*/
static VALUE
@@ -905,17 +963,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);
@@ -927,9 +984,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
*/
@@ -937,12 +994,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);
@@ -950,7 +1008,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("**"));
}
}
@@ -959,8 +1018,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
@@ -977,10 +1036,10 @@ num_eql(VALUE x, VALUE y)
/*
* call-seq:
- * num <=> other -> 0 or nil
+ * number <=> other -> 0 or nil
*
- * Returns zero if <i>num</i> equals <i>other</i>, <code>nil</code>
- * otherwise.
+ * Returns zero if +number+ equals +other+, otherwise +nil+ is returned if the
+ * two values are incomparable.
*/
static VALUE
@@ -999,11 +1058,13 @@ num_equal(VALUE x, VALUE y)
/*
* call-seq:
- * flt == obj -> true or false
+ * float == obj -> true or false
*
- * 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>.
+ * Returns +true+ only if +obj+ has the same value as +float+. Contrast this
+ * with Float#eql?, which requires obj to be a Float.
+ *
+ * The result of <code>NaN == NaN</code> is undefined, so the
+ * implementation-dependent value is returned.
*
* 1.0 == 1 #=> true
*
@@ -1014,20 +1075,16 @@ flo_eq(VALUE x, VALUE y)
{
volatile double a, b;
- switch (TYPE(y)) {
- case T_FIXNUM:
- b = (double)FIX2LONG(y);
- break;
- case T_BIGNUM:
- b = rb_big2dbl(y);
- break;
- case T_FLOAT:
+ if (RB_TYPE_P(y, T_FIXNUM) || RB_TYPE_P(y, T_BIGNUM)) {
+ return rb_integer_float_eq(y, x);
+ }
+ 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);
@@ -1039,7 +1096,7 @@ flo_eq(VALUE x, VALUE y)
/*
* call-seq:
- * flt.hash -> integer
+ * float.hash -> integer
*
* Returns a hash code for this float.
*/
@@ -1069,11 +1126,15 @@ rb_dbl_cmp(double a, double b)
/*
* call-seq:
- * flt <=> real -> -1, 0, +1 or nil
+ * float <=> real -> -1, 0, +1 or nil
*
- * Returns -1, 0, +1 or nil depending on whether <i>flt</i> is less
- * than, equal to, or greater than <i>real</i>. This is the basis for
- * the tests in <code>Comparable</code>.
+ * Returns -1, 0, +1 or nil depending on whether +float+ is less than, equal
+ * to, or greater than +real+. This is the basis for the tests in Comparable.
+ *
+ * The result of <code>NaN <=> NaN</code> is undefined, so the
+ * implementation-dependent value is returned.
+ *
+ * +nil+ is returned if the two values are incomparable.
*/
static VALUE
@@ -1084,24 +1145,16 @@ flo_cmp(VALUE x, VALUE y)
a = RFLOAT_VALUE(x);
if (isnan(a)) return Qnil;
- switch (TYPE(y)) {
- case T_FIXNUM:
- b = (double)FIX2LONG(y);
- break;
-
- case T_BIGNUM:
- if (isinf(a)) {
- if (a > 0.0) return INT2FIX(1);
- else return INT2FIX(-1);
- }
- b = rb_big2dbl(y);
- break;
-
- case T_FLOAT:
+ 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;
+ }
+ 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);
@@ -1118,9 +1171,12 @@ flo_cmp(VALUE x, VALUE y)
/*
* 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.
*/
static VALUE
@@ -1129,23 +1185,19 @@ flo_gt(VALUE x, VALUE y)
double a, b;
a = RFLOAT_VALUE(x);
- switch (TYPE(y)) {
- case T_FIXNUM:
- b = (double)FIX2LONG(y);
- break;
-
- case T_BIGNUM:
- b = rb_big2dbl(y);
- break;
-
- case T_FLOAT:
+ 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;
+ }
+ 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
@@ -1156,10 +1208,12 @@ flo_gt(VALUE x, VALUE y)
/*
* call-seq:
- * flt >= real -> true or false
+ * float >= real -> true or false
*
- * <code>true</code> if <code>flt</code> is greater than
- * or equal to <code>real</code>.
+ * Returns +true+ if +float+ is greater than or equal to +real+.
+ *
+ * The result of <code>NaN >= NaN</code> is undefined, so the
+ * implementation-dependent value is returned.
*/
static VALUE
@@ -1168,23 +1222,19 @@ flo_ge(VALUE x, VALUE y)
double a, b;
a = RFLOAT_VALUE(x);
- switch (TYPE(y)) {
- case T_FIXNUM:
- b = (double)FIX2LONG(y);
- break;
-
- case T_BIGNUM:
- b = rb_big2dbl(y);
- break;
-
- case T_FLOAT:
+ 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;
+ }
+ 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
@@ -1195,9 +1245,12 @@ 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.
*/
static VALUE
@@ -1206,23 +1259,19 @@ flo_lt(VALUE x, VALUE y)
double a, b;
a = RFLOAT_VALUE(x);
- switch (TYPE(y)) {
- case T_FIXNUM:
- b = (double)FIX2LONG(y);
- break;
-
- case T_BIGNUM:
- b = rb_big2dbl(y);
- break;
-
- case T_FLOAT:
+ 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;
+ }
+ 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
@@ -1233,10 +1282,12 @@ flo_lt(VALUE x, VALUE y)
/*
* call-seq:
- * flt <= real -> true or false
+ * float <= real -> true or false
*
- * <code>true</code> if <code>flt</code> is less than
- * or equal to <code>real</code>.
+ * Returns +true+ if +float+ is less than or equal to +real+.
+ *
+ * The result of <code>NaN <= NaN</code> is undefined, so the
+ * implementation-dependent value is returned.
*/
static VALUE
@@ -1245,23 +1296,19 @@ flo_le(VALUE x, VALUE y)
double a, b;
a = RFLOAT_VALUE(x);
- switch (TYPE(y)) {
- case T_FIXNUM:
- b = (double)FIX2LONG(y);
- break;
-
- case T_BIGNUM:
- b = rb_big2dbl(y);
- break;
-
- case T_FLOAT:
+ 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;
+ }
+ 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
@@ -1272,11 +1319,13 @@ 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.
*
* 1.0.eql?(1) #=> false
*/
@@ -1284,7 +1333,7 @@ flo_le(VALUE x, VALUE y)
static VALUE
flo_eql(VALUE x, VALUE y)
{
- if (TYPE(y) == T_FLOAT) {
+ if (RB_TYPE_P(y, T_FLOAT)) {
double a = RFLOAT_VALUE(x);
double b = RFLOAT_VALUE(y);
#if defined(_MSC_VER) && _MSC_VER < 1300
@@ -1298,9 +1347,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
@@ -1311,10 +1360,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
@@ -1330,9 +1379,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.
*
*/
@@ -1347,10 +1396,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
@@ -1368,10 +1416,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
@@ -1392,11 +1445,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+).
*
*/
@@ -1418,9 +1470,9 @@ flo_is_finite_p(VALUE num)
/*
* call-seq:
- * flt.floor -> integer
+ * 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
@@ -1443,10 +1495,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
@@ -1478,7 +1529,7 @@ int_round_0(VALUE num, int ndigits)
ID op;
/* If 10**N / 2 > num, then return 0 */
/* We have log_256(10) > 0.415241 and log_256(1/2) = -0.125, so */
- bytes = FIXNUM_P(num) ? sizeof(long) : rb_funcall(num, rb_intern("size"), 0);
+ bytes = FIXNUM_P(num) ? sizeof(long) : rb_funcall(num, idSize, 0);
if (-0.415241 * ndigits - 0.125 > bytes ) {
return INT2FIX(0);
}
@@ -1492,14 +1543,14 @@ int_round_0(VALUE num, int ndigits)
if (neg) x = -x;
return LONG2NUM(x);
}
- if (TYPE(f) == T_FLOAT) {
+ if (RB_TYPE_P(f, T_FLOAT)) {
/* then int_pow overflow */
return INT2FIX(0);
}
h = rb_funcall(f, '/', 1, INT2FIX(2));
r = rb_funcall(num, '%', 1, f);
n = rb_funcall(num, '-', 1, r);
- op = RTEST(rb_funcall(num, '<', 1, INT2FIX(0))) ? rb_intern("<=") : '<';
+ op = negative_int_p(num) ? rb_intern("<=") : '<';
if (!RTEST(rb_funcall(r, op, 1, h))) {
n = rb_funcall(n, '+', 1, f);
}
@@ -1511,10 +1562,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
@@ -1590,11 +1642,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 <i>flt</i> truncated to an <code>Integer</code>.
+ * Returns the +float+ truncated to an Integer.
+ *
+ * Synonyms are #to_i, #to_int, and #truncate.
*/
static VALUE
@@ -1617,9 +1671,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
@@ -1636,10 +1691,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
@@ -1657,10 +1713,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
@@ -1673,9 +1732,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
@@ -1684,28 +1744,50 @@ num_truncate(VALUE num)
return flo_truncate(rb_Float(num));
}
+static double
+ruby_float_step_size(double beg, double end, double unit, int excl)
+{
+ const double epsilon = DBL_EPSILON;
+ double n = (end - beg)/unit;
+ double err = (fabs(beg) + fabs(end) + fabs(end-beg)) / fabs(unit) * epsilon;
+
+ if (isinf(unit)) {
+ return unit > 0 ? beg <= end : beg >= end;
+ }
+ if (err>0.5) err=0.5;
+ if (excl) {
+ if (n<=0) return 0;
+ if (n<1)
+ n = 0;
+ else
+ n = floor(n - err);
+ }
+ else {
+ if (n<0) return 0;
+ n = floor(n + err);
+ }
+ return n+1;
+}
int
ruby_float_step(VALUE from, VALUE to, VALUE step, int excl)
{
- if (TYPE(from) == T_FLOAT || TYPE(to) == T_FLOAT || TYPE(step) == T_FLOAT) {
- const double epsilon = DBL_EPSILON;
+ if (RB_TYPE_P(from, T_FLOAT) || RB_TYPE_P(to, T_FLOAT) || RB_TYPE_P(step, T_FLOAT)) {
double beg = NUM2DBL(from);
double end = NUM2DBL(to);
double unit = NUM2DBL(step);
- double n = (end - beg)/unit;
- double err = (fabs(beg) + fabs(end) + fabs(end-beg)) / fabs(unit) * epsilon;
+ double n = ruby_float_step_size(beg, end, unit, excl);
long i;
if (isinf(unit)) {
- if (unit > 0 ? beg <= end : beg >= end) rb_yield(DBL2NUM(beg));
+ /* if unit is infinity, i*unit+beg is NaN */
+ if (n) rb_yield(DBL2NUM(beg));
}
else {
- if (err>0.5) err=0.5;
- n = floor(n + err);
- if (!excl || ((long)n)*unit+beg < end) n++;
for (i=0; i<n; i++) {
- rb_yield(DBL2NUM(i*unit+beg));
+ double d = i*unit+beg;
+ if (unit >= 0 ? end < d : d < end) d = end;
+ rb_yield(DBL2NUM(d));
}
}
return TRUE;
@@ -1713,32 +1795,132 @@ ruby_float_step(VALUE from, VALUE to, VALUE step, int excl)
return FALSE;
}
+VALUE
+ruby_num_interval_step_size(VALUE from, VALUE to, VALUE step, int excl)
+{
+ if (FIXNUM_P(from) && FIXNUM_P(to) && FIXNUM_P(step)) {
+ long delta, diff, result;
+
+ diff = FIX2LONG(step);
+ delta = FIX2LONG(to) - FIX2LONG(from);
+ if (excl) {
+ delta += (diff > 0 ? -1 : +1);
+ }
+ result = delta / diff;
+ return LONG2FIX(result >= 0 ? result + 1 : 0);
+ }
+ else if (RB_TYPE_P(from, T_FLOAT) || RB_TYPE_P(to, T_FLOAT) || RB_TYPE_P(step, T_FLOAT)) {
+ double n = ruby_float_step_size(NUM2DBL(from), NUM2DBL(to), NUM2DBL(step), excl);
+
+ if (isinf(n)) return DBL2NUM(n);
+ return LONG2FIX(n);
+ }
+ else {
+ VALUE result;
+ ID cmp = RTEST(rb_funcall(step, '>', 1, INT2FIX(0))) ? '>' : '<';
+ if (RTEST(rb_funcall(from, cmp, 1, to))) return INT2FIX(0);
+ result = rb_funcall(rb_funcall(to, '-', 1, from), id_div, 1, step);
+ if (!excl || RTEST(rb_funcall(rb_funcall(from, '+', 1, rb_funcall(result, '*', 1, step)), cmp, 1, to))) {
+ result = rb_funcall(result, '+', 1, INT2FIX(1));
+ }
+ return result;
+ }
+}
+
+#define NUM_STEP_SCAN_ARGS(argc, argv, to, step, hash, desc) do { \
+ argc = rb_scan_args(argc, argv, "02:", &to, &step, &hash); \
+ if (!NIL_P(hash)) { \
+ step = rb_hash_aref(hash, sym_by); \
+ to = rb_hash_aref(hash, sym_to); \
+ } \
+ else { \
+ /* compatibility */ \
+ if (argc > 1 && NIL_P(step)) { \
+ rb_raise(rb_eTypeError, "step must be numeric"); \
+ } \
+ if (rb_equal(step, INT2FIX(0))) { \
+ rb_raise(rb_eArgError, "step can't be 0"); \
+ } \
+ } \
+ if (NIL_P(step)) { \
+ step = INT2FIX(1); \
+ } \
+ desc = !positive_int_p(step); \
+ if (NIL_P(to)) { \
+ to = desc ? DBL2NUM(-INFINITY) : DBL2NUM(INFINITY); \
+ } \
+} while (0)
+
+#define NUM_STEP_GET_INF(to, desc, inf) do { \
+ if (RB_TYPE_P(to, T_FLOAT)) { \
+ double f = RFLOAT_VALUE(to); \
+ inf = isinf(f) && (signbit(f) ? desc : !desc); \
+ } \
+ else inf = 0; \
+} while (0)
+
+static VALUE
+num_step_size(VALUE from, VALUE args, VALUE eobj)
+{
+ VALUE to, step, hash;
+ int desc;
+ int argc = args ? RARRAY_LENINT(args) : 0;
+ VALUE *argv = args ? RARRAY_PTR(args) : 0;
+
+ NUM_STEP_SCAN_ARGS(argc, argv, to, step, hash, desc);
+
+ 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, integer 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
*/
@@ -1746,60 +1928,48 @@ ruby_float_step(VALUE from, VALUE to, VALUE step, int excl)
static VALUE
num_step(int argc, VALUE *argv, VALUE from)
{
- VALUE to, step;
+ VALUE to, step, hash;
+ int desc, inf;
- RETURN_ENUMERATOR(from, argc, argv);
- if (argc == 1) {
- to = argv[0];
- step = INT2FIX(1);
- }
- else {
- if (argc == 2) {
- to = argv[0];
- step = argv[1];
- }
- else {
- rb_raise(rb_eArgError, "wrong number of arguments (%d for 1..2)", argc);
- }
- if (rb_equal(step, INT2FIX(0))) {
- rb_raise(rb_eArgError, "step can't be 0");
- }
- }
+ RETURN_SIZED_ENUMERATOR(from, argc, argv, num_step_size);
- if (FIXNUM_P(from) && FIXNUM_P(to) && FIXNUM_P(step)) {
- long i, end, diff;
+ NUM_STEP_SCAN_ARGS(argc, argv, to, step, hash, desc);
+ NUM_STEP_GET_INF(to, desc, inf);
- i = FIX2LONG(from);
- end = FIX2LONG(to);
- diff = FIX2LONG(step);
- if (diff > 0) {
- while (i <= end) {
+ if (FIXNUM_P(from) && (inf || FIXNUM_P(to)) && FIXNUM_P(step)) {
+ long i = FIX2LONG(from);
+ long diff = FIX2LONG(step);
+
+ 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 (RTEST(rb_funcall(step, '>', 1, INT2FIX(0)))) {
- 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;
@@ -1808,6 +1978,10 @@ num_step(int argc, VALUE *argv, VALUE from)
#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
rb_num2long(VALUE val)
@@ -1819,11 +1993,10 @@ 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];
@@ -1833,31 +2006,39 @@ rb_num2long(VALUE val)
if ((s = strchr(buf, ' ')) != 0) *s = '\0';
rb_raise(rb_eRangeError, "float %s out of range of integer", buf);
}
-
- 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];
@@ -1867,17 +2048,28 @@ rb_num2ulong(VALUE val)
if ((s = strchr(buf, ' ')) != 0) *s = '\0';
rb_raise(rb_eRangeError, "float %s out of range of integer", buf);
}
-
- 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 = RBIGNUM_NEGATIVE_P(val);
+ return ul;
+ }
+ }
+ else {
+ val = rb_to_int(val);
+ goto again;
+ }
+}
+
+VALUE
+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)
{
@@ -1886,28 +2078,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, VALUE sign)
+check_uint(unsigned long num, int sign)
{
- static const VALUE mask = ~(VALUE)UINT_MAX;
-
- if (RTEST(sign)) {
+ if (sign) {
/* minus */
- if ((num & mask) != mask || (num & ~mask) <= INT_MAX + 1UL)
-#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);
}
}
@@ -1932,10 +2121,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, rb_funcall(val, '<', 1, INT2FIX(0)));
- return (unsigned long)num;
+ check_uint(num, wrap);
+ return num;
}
unsigned long
@@ -1948,7 +2138,7 @@ rb_fix2uint(VALUE val)
}
num = FIX2ULONG(val);
- check_uint(num, rb_funcall(val, '<', 1, INT2FIX(0)));
+ check_uint(num, negative_int_p(val));
return num;
}
#else
@@ -1965,16 +2155,88 @@ rb_fix2int(VALUE val)
}
#endif
+void
+rb_out_of_short(SIGNED_VALUE num)
+{
+ rb_raise(rb_eRangeError, "integer %"PRIdVALUE " too %s to convert to `short'",
+ num, num < 0 ? "small" : "big");
+}
+
+static void
+check_short(long num)
+{
+ if ((long)(short)num != num) {
+ rb_out_of_short(num);
+ }
+}
+
+static void
+check_ushort(unsigned long num, int sign)
+{
+ if (sign) {
+ /* minus */
+ if (num < (unsigned long)SHRT_MIN)
+ rb_raise(rb_eRangeError, "integer %ld too small to convert to `unsigned short'", (long)num);
+ }
+ else {
+ /* plus */
+ if (USHRT_MAX < num)
+ rb_raise(rb_eRangeError, "integer %lu too big to convert to `unsigned short'", num);
+ }
+}
+
+short
+rb_num2short(VALUE val)
+{
+ long num = rb_num2long(val);
+
+ check_short(num);
+ return num;
+}
+
+short
+rb_fix2short(VALUE val)
+{
+ long num = FIXNUM_P(val)?FIX2LONG(val):rb_num2long(val);
+
+ check_short(num);
+ return num;
+}
+
+unsigned short
+rb_num2ushort(VALUE val)
+{
+ int wrap;
+ unsigned long num = rb_num2ulong_internal(val, &wrap);
+
+ check_ushort(num, wrap);
+ return num;
+}
+
+unsigned short
+rb_fix2ushort(VALUE val)
+{
+ unsigned long num;
+
+ if (!FIXNUM_P(val)) {
+ return rb_num2ushort(val);
+ }
+ num = FIX2ULONG(val);
+
+ check_ushort(num, negative_int_p(val));
+ return num;
+}
+
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);
}
@@ -1986,6 +2248,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)
@@ -1996,10 +2262,9 @@ 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 {
@@ -2010,39 +2275,36 @@ rb_num2ll(VALUE val)
if ((s = strchr(buf, ' ')) != 0) *s = '\0';
rb_raise(rb_eRangeError, "float %s out of range of long long", buf);
}
-
- 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");
- return Qnil; /* not reached */
-
- 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");
- return Qnil; /* not reached */
-
- default:
- val = rb_to_int(val);
- return NUM2LL(val);
}
+
+ val = rb_to_int(val);
+ return NUM2LL(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];
@@ -2052,23 +2314,19 @@ rb_num2ull(VALUE val)
if ((s = strchr(buf, ' ')) != 0) *s = '\0';
rb_raise(rb_eRangeError, "float %s out of range of unsgined long long", buf);
}
-
- 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");
- return Qnil; /* not reached */
-
- 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");
- return Qnil; /* not reached */
-
- default:
- val = rb_to_int(val);
- return NUM2ULL(val);
}
+
+ val = rb_to_int(val);
+ return NUM2ULL(val);
}
#endif /* HAVE_LONG_LONG */
@@ -2076,21 +2334,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
@@ -2103,7 +2358,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
@@ -2116,7 +2371,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
@@ -2132,7 +2387,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
@@ -2146,10 +2401,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
@@ -2167,42 +2422,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)
{
@@ -2229,8 +2494,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"
@@ -2272,7 +2537,7 @@ int_chr(int argc, VALUE *argv, VALUE num)
case 1:
break;
default:
- rb_raise(rb_eArgError, "wrong number of arguments (%d for 0..1)", argc);
+ rb_check_arity(argc, 0, 1);
break;
}
enc = rb_to_encoding(argv[0]);
@@ -2285,12 +2550,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.
*/
@@ -2304,18 +2570,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.
*
- * <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>.
+ * 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.
+ *
+ * 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.
*/
@@ -2323,7 +2589,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
@@ -2365,8 +2631,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"
@@ -2396,9 +2662,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
@@ -2415,12 +2680,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, '+');
}
}
@@ -2429,9 +2695,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
@@ -2448,13 +2713,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, '-');
}
}
@@ -2467,9 +2733,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
@@ -2484,7 +2750,6 @@ fix_mul(VALUE x, VALUE y)
#if SIZEOF_LONG * 2 <= SIZEOF_LONG_LONG
LONG_LONG d;
#else
- volatile long c;
VALUE r;
#endif
@@ -2496,24 +2761,21 @@ 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);
- c = a * b;
- r = LONG2FIX(c);
-
if (a == 0) return x;
- if (FIX2LONG(r) != c || c/a != b) {
+ if (MUL_OVERFLOW_FIXNUM_P(a, b))
r = rb_big_mul(rb_int2big(a), rb_int2big(b));
- }
+ else
+ r = LONG2FIX(a * b);
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, '*');
}
}
@@ -2549,8 +2811,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
@@ -2563,12 +2824,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"));
}
}
@@ -2582,11 +2844,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;
@@ -2600,11 +2862,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);
}
}
@@ -2613,9 +2875,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
@@ -2628,7 +2889,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
@@ -2642,8 +2904,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
@@ -2655,13 +2918,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, '%');
}
}
@@ -2670,7 +2934,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)
@@ -2682,11 +2946,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;
@@ -2696,7 +2960,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"));
}
}
@@ -2726,26 +2991,31 @@ int_pow(long x, unsigned long y)
y >>= 1;
}
{
- volatile long xz = x * z;
- if (!POSFIXABLE(xz) || xz / x != z) {
+ if (MUL_OVERFLOW_FIXNUM_P(x, z)) {
goto bignum;
}
- z = xz;
+ z = x * z;
}
} while (--y);
if (neg) z = -z;
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 #=> 0.5
+ * 2 ** -1 #=> (1/2)
* 2 ** 0.5 #=> 1.4142135623731
*/
@@ -2757,6 +3027,13 @@ fix_pow(VALUE x, VALUE y)
if (FIXNUM_P(y)) {
long b = FIX2LONG(y);
+ if (a == 1) return INT2FIX(1);
+ if (a == -1) {
+ if (b % 2 == 0)
+ return INT2FIX(1);
+ else
+ return INT2FIX(-1);
+ }
if (b < 0)
return rb_funcall(rb_rational_raw1(x), rb_intern("**"), 1, y);
@@ -2766,30 +3043,21 @@ fix_pow(VALUE x, VALUE y)
if (b > 0) return INT2FIX(0);
return DBL2NUM(INFINITY);
}
- if (a == 1) return INT2FIX(1);
- if (a == -1) {
- if (b % 2 == 0)
- return INT2FIX(1);
- else
- return INT2FIX(-1);
- }
return int_pow(a, b);
}
- switch (TYPE(y)) {
- case T_BIGNUM:
-
- if (rb_funcall(y, '<', 1, INT2FIX(0)))
- return rb_funcall(rb_rational_raw1(x), rb_intern("**"), 1, y);
-
- if (a == 0) return INT2FIX(0);
+ 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);
else return INT2FIX(-1);
}
+ if (negative_int_p(y))
+ return rb_funcall(rb_rational_raw1(x), rb_intern("**"), 1, y);
+ if (a == 0) return INT2FIX(0);
x = rb_int2big(FIX2LONG(x));
return rb_big_pow(x, y);
- 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);
@@ -2801,7 +3069,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("**"));
}
}
@@ -2810,8 +3079,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
@@ -2822,12 +3090,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:
- return (double)FIX2LONG(x) == RFLOAT_VALUE(y) ? Qtrue : Qfalse;
- default:
+ }
+ else if (RB_TYPE_P(y, T_FLOAT)) {
+ return rb_integer_float_eq(x, y);
+ }
+ else {
return num_equal(x, y);
}
}
@@ -2836,10 +3105,12 @@ 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
- * <i>fix</i> is less than, equal to, or greater than
- * <i>numeric</i>. This is the basis for the tests in
- * <code>Comparable</code>.
+ * 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.
*/
static VALUE
@@ -2850,12 +3121,13 @@ 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:
- return rb_dbl_cmp((double)FIX2LONG(x), RFLOAT_VALUE(y));
- default:
+ }
+ else if (RB_TYPE_P(y, T_FLOAT)) {
+ return rb_integer_float_cmp(x, y);
+ }
+ else {
return rb_num_coerce_cmp(x, y, rb_intern("<=>"));
}
}
@@ -2864,8 +3136,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
@@ -2875,12 +3146,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:
- return (double)FIX2LONG(x) > RFLOAT_VALUE(y) ? Qtrue : Qfalse;
- default:
+ }
+ else if (RB_TYPE_P(y, T_FLOAT)) {
+ return rb_integer_float_cmp(x, y) == INT2FIX(1) ? Qtrue : Qfalse;
+ }
+ else {
return rb_num_coerce_relop(x, y, '>');
}
}
@@ -2889,8 +3161,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
@@ -2900,12 +3172,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:
- return (double)FIX2LONG(x) >= RFLOAT_VALUE(y) ? 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(">="));
}
}
@@ -2914,8 +3188,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
@@ -2925,12 +3198,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:
- return (double)FIX2LONG(x) < RFLOAT_VALUE(y) ? Qtrue : Qfalse;
- default:
+ }
+ else if (RB_TYPE_P(y, T_FLOAT)) {
+ return rb_integer_float_cmp(x, y) == INT2FIX(-1) ? Qtrue : Qfalse;
+ }
+ else {
return rb_num_coerce_relop(x, y, '<');
}
}
@@ -2939,8 +3213,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
@@ -2950,12 +3224,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:
- return (double)FIX2LONG(x) <= RFLOAT_VALUE(y) ? 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("<="));
}
}
@@ -2973,16 +3249,29 @@ fix_rev(VALUE num)
return ~num | FIXNUM_FLAG;
}
-static VALUE
-bit_coerce(VALUE x)
-{
- while (!FIXNUM_P(x) && TYPE(x) != T_BIGNUM) {
- if (TYPE(x) == T_FLOAT) {
- rb_raise(rb_eTypeError, "can't convert Float into Integer");
+static int
+bit_coerce(VALUE *x, VALUE *y, int err)
+{
+ if (!FIXNUM_P(*y) && !RB_TYPE_P(*y, T_BIGNUM)) {
+ do_coerce(x, y, err);
+ 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));
}
- x = rb_to_int(x);
}
- return x;
+ return TRUE;
+}
+
+VALUE
+rb_num_coerce_bit(VALUE x, VALUE y, ID func)
+{
+ bit_coerce(&x, &y, TRUE);
+ return rb_funcall(x, func, 1, y);
}
/*
@@ -2995,13 +3284,17 @@ bit_coerce(VALUE x)
static VALUE
fix_and(VALUE x, VALUE y)
{
- long val;
+ if (FIXNUM_P(y)) {
+ long val = FIX2LONG(x) & FIX2LONG(y);
+ return LONG2NUM(val);
+ }
- if (!FIXNUM_P(y = bit_coerce(y))) {
+ if (RB_TYPE_P(y, T_BIGNUM)) {
return rb_big_and(y, x);
}
- val = FIX2LONG(x) & FIX2LONG(y);
- return LONG2NUM(val);
+
+ bit_coerce(&x, &y, TRUE);
+ return rb_funcall(x, rb_intern("&"), 1, y);
}
/*
@@ -3014,13 +3307,17 @@ fix_and(VALUE x, VALUE y)
static VALUE
fix_or(VALUE x, VALUE y)
{
- long val;
+ if (FIXNUM_P(y)) {
+ long val = FIX2LONG(x) | FIX2LONG(y);
+ return LONG2NUM(val);
+ }
- if (!FIXNUM_P(y = bit_coerce(y))) {
+ if (RB_TYPE_P(y, T_BIGNUM)) {
return rb_big_or(y, x);
}
- val = FIX2LONG(x) | FIX2LONG(y);
- return LONG2NUM(val);
+
+ bit_coerce(&x, &y, TRUE);
+ return rb_funcall(x, rb_intern("|"), 1, y);
}
/*
@@ -3033,13 +3330,17 @@ fix_or(VALUE x, VALUE y)
static VALUE
fix_xor(VALUE x, VALUE y)
{
- long val;
+ if (FIXNUM_P(y)) {
+ long val = FIX2LONG(x) ^ FIX2LONG(y);
+ return LONG2NUM(val);
+ }
- if (!FIXNUM_P(y = bit_coerce(y))) {
+ if (RB_TYPE_P(y, T_BIGNUM)) {
return rb_big_xor(y, x);
}
- val = FIX2LONG(x) ^ FIX2LONG(y);
- return LONG2NUM(val);
+
+ bit_coerce(&x, &y, TRUE);
+ return rb_funcall(x, rb_intern("^"), 1, y);
}
static VALUE fix_lshift(long, unsigned long);
@@ -3049,7 +3350,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
@@ -3081,7 +3382,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
@@ -3114,16 +3415,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
@@ -3144,7 +3443,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);
}
@@ -3157,7 +3456,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.
*
*/
@@ -3176,7 +3475,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
@@ -3199,8 +3498,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
@@ -3215,25 +3513,69 @@ fix_size(VALUE fix)
/*
* 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
+ */
+
+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, VALUE eobj)
+{
+ return ruby_num_interval_step_size(from, RARRAY_AREF(args, 0), INT2FIX(1), FALSE);
+}
+
+/*
+ * call-seq:
* 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>.
+ * Iterates the given block, passing in integer values from +int+ up to and
+ * including +limit+.
*
- * If no block is given, an enumerator is returned instead.
- *
- * 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
int_upto(VALUE from, VALUE to)
{
- RETURN_ENUMERATOR(from, 1, &to);
+ RETURN_SIZED_ENUMERATOR(from, 1, &to, int_upto_size);
if (FIXNUM_P(from) && FIXNUM_P(to)) {
long i, end;
@@ -3254,28 +3596,31 @@ int_upto(VALUE from, VALUE to)
return from;
}
+static VALUE
+int_downto_size(VALUE from, VALUE args, VALUE eobj)
+{
+ return ruby_num_interval_step_size(from, RARRAY_AREF(args, 0), INT2FIX(-1), FALSE);
+}
+
/*
* call-seq:
* 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
int_downto(VALUE from, VALUE to)
{
- RETURN_ENUMERATOR(from, 1, &to);
+ RETURN_SIZED_ENUMERATOR(from, 1, &to, int_downto_size);
if (FIXNUM_P(from) && FIXNUM_P(to)) {
long i, end;
@@ -3296,29 +3641,38 @@ int_downto(VALUE from, VALUE to)
return from;
}
+static VALUE
+int_dotimes_size(VALUE num, VALUE args, VALUE eobj)
+{
+ if (FIXNUM_P(num)) {
+ if (NUM2LONG(num) <= 0) return INT2FIX(0);
+ }
+ else {
+ if (RTEST(rb_funcall(num, '<', 1, INT2FIX(0)))) return INT2FIX(0);
+ }
+ return num;
+}
+
/*
* call-seq:
* 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
int_dotimes(VALUE num)
{
- RETURN_ENUMERATOR(num, 0, 0);
+ RETURN_SIZED_ENUMERATOR(num, 0, 0, int_dotimes_size);
if (FIXNUM_P(num)) {
long i, end;
@@ -3344,7 +3698,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.
*
@@ -3375,7 +3730,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.
*
*/
@@ -3392,7 +3747,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
@@ -3408,7 +3763,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
@@ -3426,12 +3781,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
@@ -3441,17 +3793,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)
{
@@ -3472,6 +3823,7 @@ Init_Numeric(void)
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);
rb_eFloatDomainError = rb_define_class("FloatDomainError", rb_eRangeError);
@@ -3487,7 +3839,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);
@@ -3534,6 +3885,7 @@ Init_Numeric(void)
rb_cFixnum = rb_define_class("Fixnum", rb_cInteger);
rb_define_method(rb_cFixnum, "to_s", fix_to_s, -1);
+ rb_define_alias(rb_cFixnum, "inspect", "to_s");
rb_define_method(rb_cFixnum, "-@", fix_uminus, 0);
rb_define_method(rb_cFixnum, "+", fix_plus, 1);
@@ -3569,6 +3921,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);
@@ -3579,21 +3932,97 @@ Init_Numeric(void)
rb_undef_alloc_func(rb_cFloat);
rb_undef_method(CLASS_OF(rb_cFloat), "new");
+ /*
+ * Represents the rounding mode for floating point addition.
+ *
+ * Usually defaults to 1, rounding to the nearest number.
+ *
+ * Other modes include:
+ *
+ * -1:: Indeterminable
+ * 0:: Rounding towards zero
+ * 1:: Rounding to the nearest number
+ * 2:: Rounding towards positive infinity
+ * 3:: Rounding towards negative infinity
+ */
rb_define_const(rb_cFloat, "ROUNDS", INT2FIX(FLT_ROUNDS));
+ /*
+ * The base of the floating point, or number of unique digits used to
+ * represent the number.
+ *
+ * Usually defaults to 2 on most systems, which would represent a base-10 decimal.
+ */
rb_define_const(rb_cFloat, "RADIX", INT2FIX(FLT_RADIX));
+ /*
+ * The number of base digits for the +double+ data type.
+ *
+ * Usually defaults to 53.
+ */
rb_define_const(rb_cFloat, "MANT_DIG", INT2FIX(DBL_MANT_DIG));
+ /*
+ * The number of decimal digits in a double-precision floating point.
+ *
+ * Usually defaults to 15.
+ */
rb_define_const(rb_cFloat, "DIG", INT2FIX(DBL_DIG));
+ /*
+ * The smallest posable exponent value in a double-precision floating
+ * point.
+ *
+ * Usually defaults to -1021.
+ */
rb_define_const(rb_cFloat, "MIN_EXP", INT2FIX(DBL_MIN_EXP));
+ /*
+ * The largest possible exponent value in a double-precision floating
+ * point.
+ *
+ * Usually defaults to 1024.
+ */
rb_define_const(rb_cFloat, "MAX_EXP", INT2FIX(DBL_MAX_EXP));
+ /*
+ * The smallest negative exponent in a double-precision floating point
+ * where 10 raised to this power minus 1.
+ *
+ * Usually defaults to -307.
+ */
rb_define_const(rb_cFloat, "MIN_10_EXP", INT2FIX(DBL_MIN_10_EXP));
+ /*
+ * The largest positive exponent in a double-precision floating point where
+ * 10 raised to this power minus 1.
+ *
+ * Usually defaults to 308.
+ */
rb_define_const(rb_cFloat, "MAX_10_EXP", INT2FIX(DBL_MAX_10_EXP));
+ /*
+ * The smallest positive integer in a double-precision floating point.
+ *
+ * Usually defaults to 2.2250738585072014e-308.
+ */
rb_define_const(rb_cFloat, "MIN", DBL2NUM(DBL_MIN));
+ /*
+ * The largest possible integer in a double-precision floating point number.
+ *
+ * Usually defaults to 1.7976931348623157e+308.
+ */
rb_define_const(rb_cFloat, "MAX", DBL2NUM(DBL_MAX));
+ /*
+ * The difference between 1 and the smallest double-precision floating
+ * point number.
+ *
+ * Usually defaults to 2.2204460492503131e-16.
+ */
rb_define_const(rb_cFloat, "EPSILON", DBL2NUM(DBL_EPSILON));
+ /*
+ * An expression representing positive infinity.
+ */
rb_define_const(rb_cFloat, "INFINITY", DBL2NUM(INFINITY));
+ /*
+ * An expression representing a value which is "not a number".
+ */
rb_define_const(rb_cFloat, "NAN", DBL2NUM(NAN));
rb_define_method(rb_cFloat, "to_s", flo_to_s, 0);
+ rb_define_alias(rb_cFloat, "inspect", "to_s");
rb_define_method(rb_cFloat, "coerce", flo_coerce, 1);
rb_define_method(rb_cFloat, "-@", flo_uminus, 0);
rb_define_method(rb_cFloat, "+", flo_plus, 1);
@@ -3630,4 +4059,21 @@ 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);
+
+ sym_to = ID2SYM(rb_intern("to"));
+ sym_by = ID2SYM(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 59611fd2d6..70f6d66e5e 100644
--- a/object.c
+++ b/object.c
@@ -14,6 +14,7 @@
#include "ruby/ruby.h"
#include "ruby/st.h"
#include "ruby/util.h"
+#include "ruby/encoding.h"
#include <stdio.h>
#include <errno.h>
#include <ctype.h>
@@ -21,6 +22,8 @@
#include <float.h>
#include "constant.h"
#include "internal.h"
+#include "id.h"
+#include "probes.h"
VALUE rb_cBasicObject;
VALUE rb_mKernel;
@@ -33,16 +36,53 @@ 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;
+#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
*
- * Case Equality---For class <code>Object</code>, effectively the same
- * as calling <code>#==</code>, but typically overridden by descendants
- * to provide meaningful semantics in <code>case</code> statements.
+ * Case Equality -- For class Object, effectively the same as calling
+ * <code>#==</code>, but typically overridden by descendants to provide
+ * meaningful semantics in +case+ statements.
*/
VALUE
@@ -68,23 +108,30 @@ rb_eql(VALUE obj1, VALUE obj2)
* obj.equal?(other) -> true or false
* obj.eql?(other) -> true or false
*
- * Equality---At the <code>Object</code> level, <code>==</code> returns
- * <code>true</code> only if <i>obj</i> and <i>other</i> are the
- * same object. Typically, this method is overridden in descendant
- * classes to provide class-specific meaning.
+ * Equality --- At the <code>Object</code> level, <code>==</code> returns
+ * <code>true</code> only if +obj+ and +other+ are the same object.
+ * Typically, this method is overridden in descendant classes to provide
+ * class-specific meaning.
*
* Unlike <code>==</code>, the <code>equal?</code> method should never be
- * overridden by subclasses: it is used to determine object identity
- * (that is, <code>a.equal?(b)</code> iff <code>a</code> is the same
- * object as <code>b</code>).
- *
- * The <code>eql?</code> method returns <code>true</code> if
- * <i>obj</i> and <i>anObject</i> have the same value. Used by
- * <code>Hash</code> to test members for equality. For objects of
- * class <code>Object</code>, <code>eql?</code> is synonymous with
- * <code>==</code>. Subclasses normally continue this tradition, but
- * there are exceptions. <code>Numeric</code> types, for example,
- * perform type conversion across <code>==</code>, but not across
+ * overridden by subclasses as it is used to determine object identity
+ * (that is, <code>a.equal?(b)</code> if and only if <code>a</code> is the
+ * same object as <code>b</code>):
+ *
+ * obj = "a"
+ * other = obj.dup
+ *
+ * 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
+ * for equality. For objects of class <code>Object</code>, <code>eql?</code>
+ * is synonymous with <code>==</code>. Subclasses normally continue this
+ * tradition by aliasing <code>eql?</code> to their overridden <code>==</code>
+ * method, but there are exceptions. <code>Numeric</code> types, for
+ * example, perform type conversion across <code>==</code>, but not across
* <code>eql?</code>, so:
*
* 1 == 1.0 #=> true
@@ -99,14 +146,17 @@ rb_obj_equal(VALUE obj1, VALUE obj2)
}
/*
- * Generates a <code>Fixnum</code> hash value for this object.
- * This function must have the property that a.eql?(b) implies
- * a.hash <code>==</code> b.hash.
- * The hash value is used by class <code>Hash</code>.
- * Any hash value that exceeds the capacity of a <code>Fixnum</code> will be
- * truncated before being used.
+ * 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 along with #eql? by the Hash class to determine if
+ * two objects reference the same hash key. Any hash value that exceeds the
+ * capacity of a Fixnum will be truncated before being used.
*
- * "waffle".hash #=> -910576647
+ * The hash value for an object may not be identical across invocations or
+ * implementations of ruby. If you need a stable identifier across ruby
+ * invocations and implementations you will need to generate one with a custom
+ * method.
*/
VALUE
rb_obj_hash(VALUE obj)
@@ -209,7 +259,7 @@ 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_generic_ivar(dest, obj);
rb_gc_copy_finalizer(dest, obj);
switch (TYPE(obj)) {
@@ -245,7 +295,7 @@ init_copy(VALUE dest, VALUE obj)
RCLASS_CONST_TBL(dest) = 0;
}
if (RCLASS_IV_TBL(obj)) {
- RCLASS_IV_TBL(dest) = st_copy(RCLASS_IV_TBL(obj));
+ RCLASS_IV_TBL(dest) = rb_st_copy(dest, RCLASS_IV_TBL(obj));
}
break;
}
@@ -279,13 +329,21 @@ VALUE
rb_obj_clone(VALUE obj)
{
VALUE clone;
+ VALUE singleton;
if (rb_special_const_p(obj)) {
rb_raise(rb_eTypeError, "can't clone %s", rb_obj_classname(obj));
}
clone = rb_obj_alloc(rb_obj_class(obj));
- RBASIC(clone)->klass = rb_singleton_class_clone(obj);
- RBASIC(clone)->flags = (RBASIC(obj)->flags | FL_TEST(clone, FL_TAINT) | FL_TEST(clone, FL_UNTRUSTED)) & ~(FL_FREEZE|FL_FINALIZE|FL_MARK);
+ RBASIC(clone)->flags &= FL_TAINT;
+ RBASIC(clone)->flags |= RBASIC(obj)->flags & ~(FL_PROMOTED|FL_FREEZE|FL_FINALIZE);
+
+ singleton = rb_singleton_class_clone_and_attach(obj, clone);
+ RBASIC_SET_CLASS(clone, singleton);
+ if (FL_TEST(singleton, FL_SINGLETON)) {
+ rb_singleton_class_attached(singleton, clone);
+ }
+
init_copy(clone, obj);
rb_funcall(clone, id_init_clone, 1, obj);
RBASIC(clone)->flags |= RBASIC(obj)->flags & FL_FREEZE;
@@ -298,17 +356,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
@@ -332,6 +415,7 @@ rb_obj_init_copy(VALUE obj, VALUE orig)
{
if (obj == orig) return obj;
rb_check_frozen(obj);
+ rb_check_trusted(obj);
if (TYPE(obj) != TYPE(orig) || rb_obj_class(obj) != rb_obj_class(orig)) {
rb_raise(rb_eTypeError, "initialize_copy should take same class object");
}
@@ -359,24 +443,42 @@ rb_obj_init_dup_clone(VALUE obj, VALUE orig)
VALUE
rb_any_to_s(VALUE obj)
{
- const char *cname = rb_obj_classname(obj);
VALUE str;
+ VALUE cname = rb_class_name(CLASS_OF(obj));
- str = rb_sprintf("#<%s:%p>", cname, (void*)obj);
+ str = rb_sprintf("#<%"PRIsVALUE":%p>", cname, (void*)obj);
OBJ_INFECT(str, obj);
return str;
}
+/*
+ * If the default external encoding is ASCII compatible, the encoding of
+ * inspected result must be compatible with it.
+ * If the default external encoding is ASCII incompatible,
+ * the result must be ASCII only.
+ */
VALUE
rb_inspect(VALUE obj)
{
- return rb_obj_as_string(rb_funcall(obj, id_inspect, 0, 0));
+ VALUE str = rb_obj_as_string(rb_funcall(obj, id_inspect, 0, 0));
+ rb_encoding *ext = rb_default_external_encoding();
+ if (!rb_enc_asciicompat(ext)) {
+ if (!rb_enc_str_asciionly_p(str))
+ rb_raise(rb_eEncCompatError, "inspected result must be ASCII only if default external encoding is ASCII incompatible");
+ 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 default external encoding");
+ return str;
}
static int
-inspect_i(ID id, VALUE value, VALUE str)
+inspect_i(st_data_t k, st_data_t v, st_data_t a)
{
+ ID id = (ID)k;
+ VALUE value = (VALUE)v;
+ VALUE str = (VALUE)a;
VALUE str2;
const char *ivname;
@@ -420,44 +522,67 @@ inspect_obj(VALUE obj, VALUE str, int recur)
* call-seq:
* obj.inspect -> string
*
- * Returns a string containing a human-readable representation of
- * <i>obj</i>. If not overridden and no instance variables, uses the
- * <code>to_s</code> method to generate the string.
- * <i>obj</i>. If not overridden, uses the <code>to_s</code> method to
- * generate the string.
+ * Returns a string containing a human-readable representation of <i>obj</i>.
+ * By default, show the class name and the list of the instance variables and
+ * their values (by calling #inspect on each of them).
+ * User defined classes should override this method to make better
+ * representation of <i>obj</i>. When overriding this method, it should
+ * return a string whose encoding is compatible with the default external
+ * encoding.
*
* [ 1, 2, 3..4, 'five' ].inspect #=> "[1, 2, 3..4, \"five\"]"
* Time.new.inspect #=> "2008-03-08 19:43:39 +0900"
+ *
+ * class Foo
+ * end
+ * Foo.new.inspect #=> "#<Foo:0x0300c868>"
+ *
+ * class Bar
+ * def initialize
+ * @bar = 1
+ * end
+ * end
+ * Bar.new.inspect #=> "#<Bar:0x0300c868 @bar=1>"
+ *
+ * class Baz
+ * def to_s
+ * "baz"
+ * end
+ * end
+ * Baz.new.inspect #=> "#<Baz:0x0300c868>"
*/
static VALUE
rb_obj_inspect(VALUE obj)
{
- if (TYPE(obj) == T_OBJECT && rb_obj_basic_to_s_p(obj)) {
- int has_ivar = 0;
- VALUE *ptr = ROBJECT_IVPTR(obj);
- long len = ROBJECT_NUMIV(obj);
- long i;
-
- for (i = 0; i < len; i++) {
- if (ptr[i] != Qundef) {
- has_ivar = 1;
- break;
- }
- }
-
- if (has_ivar) {
- VALUE str;
- const char *c = rb_obj_classname(obj);
+ if (rb_ivar_count(obj) > 0) {
+ VALUE str;
+ VALUE c = rb_class_name(CLASS_OF(obj));
- str = rb_sprintf("-<%s:%p", c, (void*)obj);
- return rb_exec_recursive(inspect_obj, obj, str);
- }
+ str = rb_sprintf("-<%"PRIsVALUE":%p", c, (void*)obj);
+ return rb_exec_recursive(inspect_obj, obj, str);
+ }
+ else {
return rb_any_to_s(obj);
}
- return rb_funcall(obj, rb_intern("to_s"), 0, 0);
}
+static VALUE
+class_or_module_required(VALUE c)
+{
+ if (SPECIAL_CONST_P(c)) goto not_class;
+ switch (BUILTIN_TYPE(c)) {
+ case T_MODULE:
+ case T_CLASS:
+ case T_ICLASS:
+ break;
+
+ default:
+ not_class:
+ rb_raise(rb_eTypeError, "class or module required");
+ }
+ return c;
+}
/*
* call-seq:
@@ -479,15 +604,7 @@ rb_obj_inspect(VALUE obj)
VALUE
rb_obj_is_instance_of(VALUE obj, VALUE c)
{
- switch (TYPE(c)) {
- case T_MODULE:
- case T_CLASS:
- case T_ICLASS:
- break;
- default:
- rb_raise(rb_eTypeError, "class or module required");
- }
-
+ c = class_or_module_required(c);
if (rb_obj_class(obj) == c) return Qtrue;
return Qfalse;
}
@@ -526,16 +643,8 @@ rb_obj_is_kind_of(VALUE obj, VALUE c)
{
VALUE cl = CLASS_OF(obj);
- switch (TYPE(c)) {
- case T_MODULE:
- case T_CLASS:
- case T_ICLASS:
- break;
-
- default:
- rb_raise(rb_eTypeError, "class or module required");
- }
-
+ c = class_or_module_required(c);
+ c = RCLASS_ORIGIN(c);
while (cl) {
if (cl == c || RCLASS_M_TBL(cl) == RCLASS_M_TBL(c))
return Qtrue;
@@ -579,9 +688,9 @@ rb_obj_tap(VALUE obj)
* Example:
*
* class Foo
- * def self.inherited(subclass)
- * puts "New subclass: #{subclass}"
- * end
+ * def self.inherited(subclass)
+ * puts "New subclass: #{subclass}"
+ * end
* end
*
* class Bar < Foo
@@ -722,12 +831,30 @@ rb_obj_tap(VALUE obj)
* Undefining one
*/
+/*
+ * Document-method: extended
+ *
+ * call-seq:
+ * extended(othermod)
+ *
+ * The equivalent of <tt>included</tt>, but for extended modules.
+ *
+ * module A
+ * def self.extended(mod)
+ * puts "#{self} extended in #{mod}"
+ * end
+ * end
+ * module Enumerable
+ * extend A
+ * end
+ * # => prints "A extended in Enumerable"
+ */
/*
* Document-method: included
*
* call-seq:
- * included( othermod )
+ * included(othermod)
*
* Callback invoked whenever the receiver is included in another
* module or class. This should be used in preference to
@@ -742,6 +869,26 @@ rb_obj_tap(VALUE obj)
* module Enumerable
* include A
* end
+ * # => prints "A included in Enumerable"
+ */
+
+/*
+ * Document-method: prepended
+ *
+ * call-seq:
+ * prepended(othermod)
+ *
+ * The equivalent of <tt>included</tt>, but for prepended modules.
+ *
+ * module A
+ * def self.prepended(mod)
+ * puts "#{self} prepended to #{mod}"
+ * end
+ * end
+ * module Enumerable
+ * prepend A
+ * end
+ * # => prints "A prepended to Enumerable"
*/
/*
@@ -767,7 +914,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
@@ -782,15 +931,25 @@ 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)) {
rb_check_frozen(obj);
OBJ_TAINT(obj);
@@ -803,7 +962,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
@@ -821,33 +982,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);
}
@@ -855,18 +1011,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
@@ -902,9 +1054,6 @@ 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) {
@@ -1007,6 +1156,23 @@ nil_to_a(VALUE obj)
}
/*
+ * Document-method: to_h
+ *
+ * call-seq:
+ * nil.to_h -> {}
+ *
+ * Always returns an empty hash.
+ *
+ * nil.to_h #=> {}
+ */
+
+static VALUE
+nil_to_h(VALUE obj)
+{
+ return rb_hash_new();
+}
+
+/*
* call-seq:
* nil.inspect -> "nil"
*
@@ -1171,7 +1337,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>.
@@ -1184,7 +1350,7 @@ rb_true(VALUE obj)
}
/*
- * call_seq:
+ * call-seq:
* nil.nil? -> true
* <anything_else>.nil? -> false
*
@@ -1234,7 +1400,19 @@ rb_obj_not_match(VALUE obj1, VALUE obj2)
* call-seq:
* obj <=> other -> 0 or nil
*
- * Returns 0 if obj === other, otherwise nil.
+ * 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
+ * Enumerable#sort, Enumerable#max etc.
+ *
+ * Your implementation of <=> should return one of the following values: -1, 0,
+ * 1 or nil. -1 means self is smaller than other. 0 means self is equal to other.
+ * 1 means self is bigger than other. Nil means the two values could not be
+ * compared.
+ *
+ * When you define <=>, you can include Comparable to gain the methods <=, <,
+ * ==, >=, > and between?.
*/
static VALUE
rb_obj_cmp(VALUE obj1, VALUE obj2)
@@ -1284,23 +1462,35 @@ rb_obj_cmp(VALUE obj1, VALUE obj2)
static VALUE
rb_mod_to_s(VALUE klass)
{
+ ID id_defined_at;
+ VALUE refined_class, defined_at;
+
if (FL_TEST(klass, FL_SINGLETON)) {
- VALUE s = rb_usascii_str_new2("#<");
- VALUE v = rb_iv_get(klass, "__attached__");
+ VALUE s = rb_usascii_str_new2("#<Class:");
+ VALUE v = rb_ivar_get(klass, id__attached__);
- rb_str_cat2(s, "Class:");
- switch (TYPE(v)) {
- case T_CLASS: case T_MODULE:
+ if (CLASS_OR_MODULE_P(v)) {
rb_str_append(s, rb_inspect(v));
- break;
- default:
+ }
+ else {
rb_str_append(s, rb_any_to_s(v));
- break;
}
rb_str_cat2(s, ">");
return s;
}
+ refined_class = rb_refinement_module_get_refined_class(klass);
+ if (!NIL_P(refined_class)) {
+ VALUE s = rb_usascii_str_new2("#<refinement:");
+
+ rb_str_concat(s, rb_inspect(refined_class));
+ rb_str_cat2(s, "@");
+ CONST_ID(id_defined_at, "__defined_at__");
+ defined_at = rb_attr_get(klass, id_defined_at);
+ rb_str_concat(s, rb_inspect(defined_at));
+ rb_str_cat2(s, ">");
+ return s;
+ }
return rb_str_dup(rb_class_name(klass));
}
@@ -1354,13 +1544,10 @@ rb_class_inherited_p(VALUE mod, VALUE arg)
VALUE start = mod;
if (mod == arg) return Qtrue;
- switch (TYPE(arg)) {
- case T_MODULE:
- case T_CLASS:
- break;
- default:
+ if (!CLASS_OR_MODULE_P(arg) && !RB_TYPE_P(arg, T_ICLASS)) {
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;
@@ -1409,11 +1596,7 @@ rb_mod_lt(VALUE mod, VALUE arg)
static VALUE
rb_mod_ge(VALUE mod, VALUE arg)
{
- switch (TYPE(arg)) {
- case T_MODULE:
- case T_CLASS:
- break;
- default:
+ if (!CLASS_OR_MODULE_P(arg)) {
rb_raise(rb_eTypeError, "compared with non class/module");
}
@@ -1440,13 +1623,14 @@ rb_mod_gt(VALUE mod, VALUE arg)
/*
* call-seq:
- * mod <=> other_mod -> -1, 0, +1, or nil
+ * module <=> other_module -> -1, 0, +1, or nil
+ *
+ * Comparison---Returns -1, 0, +1 or nil depending on whether +module+
+ * includes +other_module+, they are the same, or if +module+ is included by
+ * +other_module+. This is the basis for the tests in Comparable.
*
- * Comparison---Returns -1 if <i>mod</i> includes <i>other_mod</i>, 0 if
- * <i>mod</i> is the same as <i>other_mod</i>, and +1 if <i>mod</i> is
- * included by <i>other_mod</i>. Returns <code>nil</code> if <i>mod</i>
- * has no relationship with <i>other_mod</i> or if <i>other_mod</i> is
- * not a module.
+ * Returns +nil+ if +module+ has no relationship with +other_module+, if
+ * +other_module+ is not a module, or if the two values are incomparable.
*/
static VALUE
@@ -1455,11 +1639,7 @@ rb_mod_cmp(VALUE mod, VALUE arg)
VALUE cmp;
if (mod == arg) return INT2FIX(0);
- switch (TYPE(arg)) {
- case T_MODULE:
- case T_CLASS:
- break;
- default:
+ if (!CLASS_OR_MODULE_P(arg)) {
return Qnil;
}
@@ -1476,7 +1656,7 @@ rb_module_s_alloc(VALUE klass)
{
VALUE mod = rb_module_new();
- RBASIC(mod)->klass = klass;
+ RBASIC_SET_CLASS(mod, klass);
return mod;
}
@@ -1565,8 +1745,11 @@ rb_class_initialize(int argc, VALUE *argv, VALUE klass)
else {
rb_scan_args(argc, argv, "01", &super);
rb_check_inheritable(super);
+ if (super != rb_cBasicObject && !RCLASS_SUPER(super)) {
+ 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);
@@ -1600,6 +1783,7 @@ VALUE
rb_obj_alloc(VALUE klass)
{
VALUE obj;
+ rb_alloc_func_t allocator;
if (RCLASS_SUPER(klass) == 0 && klass != rb_cBasicObject) {
rb_raise(rb_eTypeError, "can't instantiate uninitialized class");
@@ -1607,7 +1791,23 @@ rb_obj_alloc(VALUE klass)
if (FL_TEST(klass, FL_SINGLETON)) {
rb_raise(rb_eTypeError, "can't create instance of singleton class");
}
- obj = rb_funcall(klass, ID_ALLOCATOR, 0, 0);
+ allocator = rb_get_alloc_func(klass);
+ if (!allocator) {
+ rb_raise(rb_eTypeError, "allocator undefined for %"PRIsVALUE,
+ klass);
+ }
+
+#if !defined(DTRACE_PROBES_DISABLED) || !DTRACE_PROBES_DISABLED
+ if (RUBY_DTRACE_OBJECT_CREATE_ENABLED()) {
+ const char * file = rb_sourcefile();
+ RUBY_DTRACE_OBJECT_CREATE(rb_class2name(klass),
+ file ? file : "",
+ rb_sourceline());
+ }
+#endif
+
+ obj = (*allocator)(klass);
+
if (rb_obj_class(obj) != rb_class_real(klass)) {
rb_raise(rb_eTypeError, "wrong instance allocation");
}
@@ -1617,8 +1817,7 @@ rb_obj_alloc(VALUE klass)
static VALUE
rb_class_allocate_instance(VALUE klass)
{
- NEWOBJ(obj, struct RObject);
- OBJSETUP(obj, klass, T_OBJECT);
+ NEWOBJ_OF(obj, struct RObject, klass, T_OBJECT | (RGENGC_WB_PROTECTED_OBJECT ? FL_WB_PROTECTED : 0));
return (VALUE)obj;
}
@@ -1673,7 +1872,7 @@ rb_class_superclass(VALUE klass)
if (klass == rb_cBasicObject) return Qnil;
rb_raise(rb_eTypeError, "uninitialized class");
}
- while (TYPE(super) == T_ICLASS) {
+ while (RB_TYPE_P(super, T_ICLASS)) {
super = RCLASS_SUPER(super);
}
if (!super) {
@@ -1685,17 +1884,76 @@ rb_class_superclass(VALUE klass)
VALUE
rb_class_get_superclass(VALUE klass)
{
- return RCLASS_SUPER(klass);
+ return RCLASS_EXT(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
@@ -1704,7 +1962,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;
}
@@ -1714,7 +1972,7 @@ rb_mod_attr(int argc, VALUE *argv, VALUE klass)
{
if (argc == 2 && (argv[1] == Qtrue || argv[1] == Qfalse)) {
rb_warning("optional boolean argument is obsoleted");
- rb_attr(klass, 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);
@@ -1723,9 +1981,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>aSymbol</i><code>.id2name</code>.
+ * <i>symbol</i><code>.id2name</code>.
+ * String arguments are converted to symbols.
*/
static VALUE
@@ -1734,7 +1994,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;
}
@@ -1742,11 +2002,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)
@@ -1760,7 +2022,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;
}
@@ -1768,6 +2030,7 @@ rb_mod_attr_accessor(int argc, VALUE *argv, VALUE klass)
/*
* call-seq:
* mod.const_get(sym, inherit=true) -> obj
+ * mod.const_get(str, inherit=true) -> obj
*
* Checks for a constant with the given name in <i>mod</i>
* If +inherit+ is set, the lookup will also search
@@ -1777,13 +2040,41 @@ rb_mod_attr_accessor(int argc, VALUE *argv, VALUE klass)
* otherwise a +NameError+ is raised.
*
* Math.const_get(:PI) #=> 3.14159265358979
+ *
+ * This method will recursively look up constant names if a namespaced
+ * class name is provided. For example:
+ *
+ * module Foo; class Bar; end end
+ * Object.const_get 'Foo::Bar'
+ *
+ * The +inherit+ flag is respected on each lookup. For example:
+ *
+ * module Foo
+ * class Bar
+ * VAL = 10
+ * end
+ *
+ * class Baz < Bar; end
+ * end
+ *
+ * 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
rb_mod_const_get(int argc, VALUE *argv, VALUE mod)
{
VALUE name, recur;
+ rb_encoding *enc;
+ const char *pbeg, *p, *path, *pend;
ID id;
+ int nestable = 1;
if (argc == 1) {
name = argv[0];
@@ -1792,16 +2083,91 @@ rb_mod_const_get(int argc, VALUE *argv, VALUE mod)
else {
rb_scan_args(argc, argv, "11", &name, &recur);
}
- id = rb_to_id(name);
- if (!rb_is_const_id(id)) {
- rb_name_error(id, "wrong constant name %s", rb_id2name(id));
+
+ if (SYMBOL_P(name)) {
+ name = rb_sym_to_s(name);
+ nestable = 0;
+ }
+
+ name = rb_check_string_type(name);
+ Check_Type(name, T_STRING);
+
+ enc = rb_enc_get(name);
+ path = RSTRING_PTR(name);
+
+ if (!rb_enc_asciicompat(enc)) {
+ rb_raise(rb_eArgError, "invalid class path encoding (non ASCII)");
+ }
+
+ pbeg = p = path;
+ pend = path + RSTRING_LEN(name);
+
+ if (p >= pend || !*p) {
+ wrong_name:
+ rb_raise(rb_eNameError, "wrong constant name %"PRIsVALUE,
+ QUOTE(name));
}
- return RTEST(recur) ? rb_const_get(mod, id) : rb_const_get_at(mod, id);
+
+ if (p + 2 < pend && p[0] == ':' && p[1] == ':') {
+ if (!nestable) goto wrong_name;
+ 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 (!nestable) goto wrong_name;
+ if (p + 2 >= pend || p[1] != ':') goto wrong_name;
+ p += 2;
+ pbeg = p;
+ }
+
+ if (!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 (!id) {
+ if (!ISUPPER(*pbeg) || !rb_enc_symname2_p(pbeg, len, enc)) {
+ part = rb_str_subseq(name, beglen, len);
+ rb_name_error_str(part, "wrong constant name %"PRIsVALUE,
+ QUOTE(part));
+ }
+ else if (!rb_method_basic_definition_p(CLASS_OF(mod), id_const_missing)) {
+ id = rb_intern3(pbeg, len, enc);
+ }
+ 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)) {
+ rb_name_error(id, "wrong constant name %"PRIsVALUE,
+ QUOTE_ID(id));
+ }
+ mod = RTEST(recur) ? rb_const_get(mod, id) : rb_const_get_at(mod, id);
+ }
+
+ return 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
@@ -1809,16 +2175,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 %s", rb_id2name(id));
- }
+ ID id = id_for_setter(name, const, "wrong constant name %"PRIsVALUE);
rb_const_set(mod, id, value);
return value;
}
@@ -1826,6 +2194,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
@@ -1836,6 +2205,12 @@ 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
@@ -1851,9 +2226,18 @@ rb_mod_const_defined(int argc, VALUE *argv, VALUE mod)
else {
rb_scan_args(argc, argv, "11", &name, &recur);
}
- id = rb_to_id(name);
+ if (!(id = rb_check_id(&name))) {
+ if (rb_is_const_name(name)) {
+ return Qfalse;
+ }
+ else {
+ rb_name_error_str(name, "wrong constant name %"PRIsVALUE,
+ QUOTE(name));
+ }
+ }
if (!rb_is_const_id(id)) {
- rb_name_error(id, "wrong constant name %s", rb_id2name(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);
}
@@ -1861,12 +2245,14 @@ rb_mod_const_defined(int argc, VALUE *argv, VALUE mod)
/*
* 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)
@@ -1881,10 +2267,20 @@ rb_mod_const_defined(int argc, VALUE *argv, VALUE mod)
static VALUE
rb_obj_ivar_get(VALUE obj, VALUE iv)
{
- ID id = rb_to_id(iv);
+ ID id = rb_check_id(&iv);
+ if (!id) {
+ if (rb_is_instance_name(iv)) {
+ return Qnil;
+ }
+ else {
+ rb_name_error_str(iv, "`%"PRIsVALUE"' is not allowed as an instance variable name",
+ QUOTE(iv));
+ }
+ }
if (!rb_is_instance_id(id)) {
- rb_name_error(id, "`%s' is not allowed as an instance variable name", rb_id2name(id));
+ rb_name_error(id, "`%"PRIsVALUE"' is not allowed as an instance variable name",
+ QUOTE_ID(id));
}
return rb_ivar_get(obj, id);
}
@@ -1892,11 +2288,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)
@@ -1912,20 +2311,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, "`%s' is not allowed as an instance variable name", rb_id2name(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)
@@ -1941,10 +2338,20 @@ rb_obj_ivar_set(VALUE obj, VALUE iv, VALUE val)
static VALUE
rb_obj_ivar_defined(VALUE obj, VALUE iv)
{
- ID id = rb_to_id(iv);
+ ID id = rb_check_id(&iv);
+ if (!id) {
+ if (rb_is_instance_name(iv)) {
+ return Qfalse;
+ }
+ else {
+ rb_name_error_str(iv, "`%"PRIsVALUE"' is not allowed as an instance variable name",
+ QUOTE(iv));
+ }
+ }
if (!rb_is_instance_id(id)) {
- rb_name_error(id, "`%s' is not allowed as an instance variable name", rb_id2name(id));
+ rb_name_error(id, "`%"PRIsVALUE"' is not allowed as an instance variable name",
+ QUOTE_ID(id));
}
return rb_ivar_defined(obj, id);
}
@@ -1952,10 +2359,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
@@ -1966,10 +2375,21 @@ rb_obj_ivar_defined(VALUE obj, VALUE iv)
static VALUE
rb_mod_cvar_get(VALUE obj, VALUE iv)
{
- ID id = rb_to_id(iv);
+ ID id = rb_check_id(&iv);
+ if (!id) {
+ if (rb_is_class_name(iv)) {
+ rb_name_error_str(iv, "uninitialized class variable %"PRIsVALUE" in %"PRIsVALUE"",
+ iv, rb_class_name(obj));
+ }
+ else {
+ rb_name_error_str(iv, "`%"PRIsVALUE"' is not allowed as a class variable name",
+ QUOTE(iv));
+ }
+ }
if (!rb_is_class_id(id)) {
- rb_name_error(id, "`%s' is not allowed as a class variable name", rb_id2name(id));
+ rb_name_error(id, "`%"PRIsVALUE"' is not allowed as a class variable name",
+ QUOTE_ID(id));
}
return rb_cvar_get(obj, id);
}
@@ -1977,9 +2397,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
@@ -1994,11 +2417,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, "`%s' is not allowed as a class variable name", rb_id2name(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;
}
@@ -2006,9 +2425,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
@@ -2020,14 +2441,32 @@ rb_mod_cvar_set(VALUE obj, VALUE iv, VALUE val)
static VALUE
rb_mod_cvar_defined(VALUE obj, VALUE iv)
{
- ID id = rb_to_id(iv);
+ ID id = rb_check_id(&iv);
+ if (!id) {
+ if (rb_is_class_name(iv)) {
+ return Qfalse;
+ }
+ else {
+ rb_name_error_str(iv, "`%"PRIsVALUE"' is not allowed as a class variable name",
+ QUOTE(iv));
+ }
+ }
if (!rb_is_class_id(id)) {
- rb_name_error(id, "`%s' is not allowed as a class variable name", rb_id2name(id));
+ rb_name_error(id, "`%"PRIsVALUE"' is not allowed as a class variable name",
+ QUOTE_ID(id));
}
return rb_cvar_defined(obj, id);
}
+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 struct conv_method_tbl {
const char *method;
ID id;
@@ -2043,6 +2482,7 @@ static struct conv_method_tbl {
{"to_s", 0},
{NULL, 0}
};
+#define IMPLICIT_CONVERSIONS 7
static VALUE
convert_type(VALUE val, const char *tname, const char *method, int raise)
@@ -2062,7 +2502,9 @@ 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, "can't convert %s into %s",
+ 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" :
@@ -2113,7 +2555,7 @@ rb_to_integer(VALUE val, const char *method)
VALUE v;
if (FIXNUM_P(val)) return val;
- if (TYPE(val) == T_BIGNUM) return val;
+ 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);
@@ -2129,7 +2571,7 @@ rb_check_to_integer(VALUE val, const char *method)
VALUE v;
if (FIXNUM_P(val)) return val;
- if (TYPE(val) == T_BIGNUM) return val;
+ if (RB_TYPE_P(val, T_BIGNUM)) return val;
v = convert_type(val, "Integer", method, FALSE);
if (!rb_obj_is_kind_of(v, rb_cInteger)) {
return Qnil;
@@ -2143,6 +2585,12 @@ rb_to_int(VALUE val)
return rb_to_integer(val, "to_int");
}
+VALUE
+rb_check_to_int(VALUE val)
+{
+ return rb_check_to_integer(val, "to_int");
+}
+
static VALUE
rb_convert_to_integer(VALUE val, int base)
{
@@ -2370,6 +2818,8 @@ rb_Float(VALUE val)
default:
return rb_convert_type(val, T_FLOAT, "Float", "to_f");
}
+
+ UNREACHABLE;
}
/*
@@ -2393,7 +2843,7 @@ rb_f_float(VALUE obj, VALUE arg)
VALUE
rb_to_float(VALUE val)
{
- if (TYPE(val) == T_FLOAT) return val;
+ if (RB_TYPE_P(val, T_FLOAT)) return val;
if (!rb_obj_is_kind_of(val, rb_cNumeric)) {
rb_raise(rb_eTypeError, "can't convert %s into Float",
NIL_P(val) ? "nil" :
@@ -2407,7 +2857,7 @@ rb_to_float(VALUE val)
VALUE
rb_check_to_float(VALUE val)
{
- if (TYPE(val) == T_FLOAT) return val;
+ if (RB_TYPE_P(val, T_FLOAT)) return val;
if (!rb_obj_is_kind_of(val, rb_cNumeric)) {
return Qnil;
}
@@ -2482,8 +2932,9 @@ rb_Array(VALUE val)
* call-seq:
* Array(arg) -> array
*
- * Returns <i>arg</i> as an <code>Array</code>. First tries to call
- * <i>arg</i><code>.to_ary</code>, then <i>arg</i><code>.to_a</code>.
+ * Returns +arg+ as an Array.
+ *
+ * First tries to call Array#to_ary on +arg+, then Array#to_a.
*
* Array(1..5) #=> [1, 2, 3, 4, 5]
*/
@@ -2494,16 +2945,57 @@ rb_f_array(VALUE obj, VALUE arg)
return rb_Array(arg);
}
+VALUE
+rb_Hash(VALUE val)
+{
+ VALUE tmp;
+
+ if (NIL_P(val)) return rb_hash_new();
+ tmp = rb_check_hash_type(val);
+ if (NIL_P(tmp)) {
+ if (RB_TYPE_P(val, T_ARRAY) && RARRAY_LEN(val) == 0)
+ return rb_hash_new();
+ rb_raise(rb_eTypeError, "can't convert %s into Hash", rb_obj_classname(val));
+ }
+ return tmp;
+}
+
+/*
+ * call-seq:
+ * Hash(arg) -> hash
+ *
+ * Converts <i>arg</i> to a <code>Hash</code> by calling
+ * <i>arg</i><code>.to_hash</code>. Returns an empty <code>Hash</code> when
+ * <i>arg</i> is <tt>nil</tt> or <tt>[]</tt>.
+ *
+ * Hash([]) #=> {}
+ * Hash(nil) #=> {}
+ * Hash(key: :value) #=> {:key => :value}
+ * Hash([1, 2, 3]) #=> TypeError
+ */
+
+static VALUE
+rb_f_hash(VALUE obj, VALUE arg)
+{
+ return rb_Hash(arg);
+}
+
/*
* Document-class: Class
*
* Classes in Ruby are first-class objects---each is an instance of
* class <code>Class</code>.
*
- * When a new class is created (typically using <code>class Name ...
- * end</code>), an object of type <code>Class</code> is created and
- * assigned to a global constant (<code>Name</code> in this case). When
- * <code>Name.new</code> is called to create a new object, the
+ * Typically, you create a new class by using:
+ *
+ * class Name
+ * # some class describing the class behavior
+ * end
+ *
+ * When a new class is created, an object of type Class is initialized and
+ * assigned to a global constant (<code>Name</code> in this case).
+ *
+ * When <code>Name.new</code> is called to create a new object, the
* <code>new</code> method in <code>Class</code> is run by default.
* This can be demonstrated by overriding <code>new</code> in
* <code>Class</code>:
@@ -2607,7 +3099,7 @@ rb_f_array(VALUE obj, VALUE arg)
* end
*
* def respond_to_missing?(name, include_private = false)
- * DELGATE.include?(name) or super
+ * DELEGATE.include?(name) or super
* end
* end
*
@@ -2626,13 +3118,18 @@ rb_f_array(VALUE obj, VALUE arg)
/* Document-class: Object
*
- * Object is the root of Ruby's class hierarchy. Its methods are available
- * to all classes unless explicitly overridden.
+ * Object is the default root of all Ruby objects. Object inherits from
+ * BasicObject which allows creating alternate object hierarchies. Methods
+ * on object are available to all classes unless explicitly overridden.
*
* Object mixes in the Kernel module, making the built-in kernel functions
- * globally accessible. Although the instance methods of Object are defined
+ * globally accessible. Although the instance methods of Object are defined
* by the Kernel module, we have chosen to document them here for clarity.
*
+ * When referencing constants in classes inheriting from Object you do not
+ * need to use the full namespace. For example, referencing +File+ inside
+ * +YourClass+ will find the top-level File class.
+ *
* In the descriptions of Object's methods, the parameter <i>symbol</i> refers
* to a symbol, which is either a quoted string or a Symbol (such as
* <code>:name</code>).
@@ -2667,11 +3164,24 @@ Init_Object(void)
rb_define_private_method(rb_cBasicObject, "singleton_method_removed", rb_obj_dummy, 1);
rb_define_private_method(rb_cBasicObject, "singleton_method_undefined", rb_obj_dummy, 1);
+ /* Document-module: Kernel
+ *
+ * The Kernel module is included by class Object, so its methods are
+ * available in every Ruby object.
+ *
+ * The Kernel instance methods are documented in class Object while the
+ * module methods are documented here. These methods are called without a
+ * receiver and thus can be called in functional form:
+ *
+ * sprintf "%.1f", 1.234 #=> "1.2"
+ *
+ */
rb_mKernel = rb_define_module("Kernel");
rb_include_module(rb_cObject, rb_mKernel);
rb_define_private_method(rb_cClass, "inherited", rb_obj_dummy, 1);
rb_define_private_method(rb_cModule, "included", rb_obj_dummy, 1);
rb_define_private_method(rb_cModule, "extended", rb_obj_dummy, 1);
+ rb_define_private_method(rb_cModule, "prepended", rb_obj_dummy, 1);
rb_define_private_method(rb_cModule, "method_added", rb_obj_dummy, 1);
rb_define_private_method(rb_cModule, "method_removed", rb_obj_dummy, 1);
rb_define_private_method(rb_cModule, "method_undefined", rb_obj_dummy, 1);
@@ -2712,8 +3222,8 @@ Init_Object(void)
rb_define_method(rb_mKernel, "instance_variable_get", rb_obj_ivar_get, 1);
rb_define_method(rb_mKernel, "instance_variable_set", rb_obj_ivar_set, 2);
rb_define_method(rb_mKernel, "instance_variable_defined?", rb_obj_ivar_defined, 1);
- rb_define_private_method(rb_mKernel, "remove_instance_variable",
- rb_obj_remove_instance_variable, 1); /* in variable.c */
+ rb_define_method(rb_mKernel, "remove_instance_variable",
+ rb_obj_remove_instance_variable, 1); /* in variable.c */
rb_define_method(rb_mKernel, "instance_of?", rb_obj_is_instance_of, 1);
rb_define_method(rb_mKernel, "kind_of?", rb_obj_is_kind_of, 1);
@@ -2728,12 +3238,14 @@ Init_Object(void)
rb_define_global_function("String", rb_f_string, 1);
rb_define_global_function("Array", rb_f_array, 1);
+ rb_define_global_function("Hash", rb_f_hash, 1);
rb_cNilClass = rb_define_class("NilClass", rb_cObject);
rb_define_method(rb_cNilClass, "to_i", nil_to_i, 0);
rb_define_method(rb_cNilClass, "to_f", nil_to_f, 0);
rb_define_method(rb_cNilClass, "to_s", nil_to_s, 0);
rb_define_method(rb_cNilClass, "to_a", nil_to_a, 0);
+ rb_define_method(rb_cNilClass, "to_h", nil_to_h, 0);
rb_define_method(rb_cNilClass, "inspect", nil_inspect, 0);
rb_define_method(rb_cNilClass, "&", false_and, 1);
rb_define_method(rb_cNilClass, "|", false_or, 1);
@@ -2757,6 +3269,7 @@ Init_Object(void)
rb_define_method(rb_cModule, ">=", rb_mod_ge, 1);
rb_define_method(rb_cModule, "initialize_copy", rb_mod_init_copy, 1); /* in class.c */
rb_define_method(rb_cModule, "to_s", rb_mod_to_s, 0);
+ rb_define_alias(rb_cModule, "inspect", "to_s");
rb_define_method(rb_cModule, "included_modules", rb_mod_included_modules, 0); /* in class.c */
rb_define_method(rb_cModule, "include?", rb_mod_include_p, 1); /* in class.c */
rb_define_method(rb_cModule, "name", rb_mod_name, 0); /* in variable.c */
@@ -2786,14 +3299,15 @@ Init_Object(void)
rb_define_method(rb_cModule, "const_missing",
rb_mod_const_missing, 1); /* in variable.c */
rb_define_method(rb_cModule, "class_variables",
- rb_mod_class_variables, 0); /* in variable.c */
+ rb_mod_class_variables, -1); /* in variable.c */
rb_define_method(rb_cModule, "remove_class_variable",
rb_mod_remove_cvar, 1); /* in variable.c */
rb_define_method(rb_cModule, "class_variable_get", rb_mod_cvar_get, 1);
rb_define_method(rb_cModule, "class_variable_set", rb_mod_cvar_set, 2);
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);
- rb_define_method(rb_cModule, "private_constant", rb_mod_private_constant, -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);
@@ -2802,12 +3316,20 @@ Init_Object(void)
rb_define_alloc_func(rb_cClass, rb_class_s_alloc);
rb_undef_method(rb_cClass, "extend_object");
rb_undef_method(rb_cClass, "append_features");
+ rb_undef_method(rb_cClass, "prepend_features");
+ /*
+ * Document-class: Data
+ *
+ * This is a recommended base class for C extensions using Data_Make_Struct
+ * or Data_Wrap_Struct, see README.EXT for details.
+ */
rb_cData = rb_define_class("Data", rb_cObject);
rb_undef_alloc_func(rb_cData);
rb_cTrueClass = rb_define_class("TrueClass", rb_cObject);
rb_define_method(rb_cTrueClass, "to_s", true_to_s, 0);
+ rb_define_alias(rb_cTrueClass, "inspect", "to_s");
rb_define_method(rb_cTrueClass, "&", true_and, 1);
rb_define_method(rb_cTrueClass, "|", true_or, 1);
rb_define_method(rb_cTrueClass, "^", true_xor, 1);
@@ -2820,6 +3342,7 @@ Init_Object(void)
rb_cFalseClass = rb_define_class("FalseClass", rb_cObject);
rb_define_method(rb_cFalseClass, "to_s", false_to_s, 0);
+ rb_define_alias(rb_cFalseClass, "inspect", "to_s");
rb_define_method(rb_cFalseClass, "&", false_and, 1);
rb_define_method(rb_cFalseClass, "|", false_or, 1);
rb_define_method(rb_cFalseClass, "^", false_xor, 1);
@@ -2830,14 +3353,6 @@ Init_Object(void)
*/
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");
-
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 c9b24b1190..71dd6afcb3 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
@@ -82,36 +100,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) ((((x)&0xFF)<<8) | (((x)>>8)&0xFF))
-#endif
-
-#ifndef swap32
-# define swap32(x) ((((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) ((((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
@@ -237,21 +225,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 (TYPE(x) == T_BIGNUM) {
- return rb_big2ulong_pack(x);
- }
- rb_raise(rb_eTypeError, "can't convert %s to `integer'", rb_obj_classname(x));
- return 0; /* not reached */
-}
-
#define MAX_INTEGER_PACK_SIZE 8
-/* #define FORCE_BIG_PACK */
static const char toofew[] = "too few arguments";
@@ -302,24 +276,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
@@ -378,7 +358,7 @@ pack_pack(VALUE ary, VALUE fmt)
#ifdef NATINT_PACK
int natint; /* native integer */
#endif
- int signed_p, integer_size, bigendian_p;
+ int integer_size, bigendian_p;
StringValue(fmt);
p = RSTRING_PTR(fmt);
@@ -389,8 +369,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;
@@ -411,9 +391,6 @@ pack_pack(VALUE ary, VALUE fmt)
}
{
- static const char natstr[] = "sSiIlL";
- static const char endstr[] = "sSiIlLqQ";
-
modifiers:
switch (*p) {
case '_':
@@ -511,6 +488,8 @@ pack_pack(VALUE ary, VALUE fmt)
}
break;
+#define castchar(from) (char)((from) & 0xff)
+
case 'b': /* bit string (ascending) */
{
int byte = 0;
@@ -526,7 +505,7 @@ pack_pack(VALUE ary, VALUE fmt)
if (i & 7)
byte >>= 1;
else {
- char c = byte & 0xff;
+ char c = castchar(byte);
rb_str_buf_cat(res, &c, 1);
byte = 0;
}
@@ -534,7 +513,7 @@ pack_pack(VALUE ary, VALUE fmt)
if (len & 7) {
char c;
byte >>= 7 - (len & 7);
- c = byte & 0xff;
+ c = castchar(byte);
rb_str_buf_cat(res, &c, 1);
}
len = j;
@@ -556,7 +535,7 @@ pack_pack(VALUE ary, VALUE fmt)
if (i & 7)
byte <<= 1;
else {
- char c = byte & 0xff;
+ char c = castchar(byte);
rb_str_buf_cat(res, &c, 1);
byte = 0;
}
@@ -564,7 +543,7 @@ pack_pack(VALUE ary, VALUE fmt)
if (len & 7) {
char c;
byte <<= 7 - (len & 7);
- c = byte & 0xff;
+ c = castchar(byte);
rb_str_buf_cat(res, &c, 1);
}
len = j;
@@ -589,13 +568,13 @@ pack_pack(VALUE ary, VALUE fmt)
if (i & 1)
byte >>= 4;
else {
- char c = byte & 0xff;
+ char c = castchar(byte);
rb_str_buf_cat(res, &c, 1);
byte = 0;
}
}
if (len & 1) {
- char c = byte & 0xff;
+ char c = castchar(byte);
rb_str_buf_cat(res, &c, 1);
}
len = j;
@@ -620,13 +599,13 @@ pack_pack(VALUE ary, VALUE fmt)
if (i & 1)
byte <<= 4;
else {
- char c = byte & 0xff;
+ char c = castchar(byte);
rb_str_buf_cat(res, &c, 1);
byte = 0;
}
}
if (len & 1) {
- char c = byte & 0xff;
+ char c = castchar(byte);
rb_str_buf_cat(res, &c, 1);
}
len = j;
@@ -638,83 +617,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 */
- signed_p = 1;
+ 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 */
- signed_p = 0;
+ 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 */
- signed_p = 1;
+ case 'i': /* i and i! for signed int */
integer_size = (int)sizeof(int);
bigendian_p = BIGENDIAN_P();
goto pack_integer;
- case 'I': /* unsigned int */
- signed_p = 0;
+ case 'I': /* I and I! for unsigned int */
integer_size = (int)sizeof(int);
bigendian_p = BIGENDIAN_P();
goto pack_integer;
- case 'l': /* signed long */
- signed_p = 1;
+ 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 */
- signed_p = 0;
+ 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 */
- signed_p = 1;
- 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 */
- signed_p = 0;
- 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) */
- signed_p = 0;
+ 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) */
- signed_p = 0;
+ 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) */
- signed_p = 0;
+ 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) */
- signed_p = 0;
+ case 'V': /* 32 bit (4 bytes) integer (VAX byte-order) */
integer_size = 4;
bigendian_p = 0;
goto pack_integer;
@@ -723,88 +685,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 */
@@ -936,6 +827,8 @@ pack_pack(VALUE ary, VALUE fmt)
}
if (len <= 2)
len = 45;
+ else if (len > 63 && type == 'u')
+ len = 63;
else
len = len / 3 * 3;
while (plen > 0) {
@@ -990,54 +883,39 @@ pack_pack(VALUE ary, VALUE fmt)
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 (TYPE(from) == T_BIGNUM) {
- VALUE big128 = rb_uint2big(128);
- while (TYPE(from) == T_BIGNUM) {
- from = rb_big_divmod(from, big128);
- c = 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 = (char)(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;
default:
+ rb_warning("unknown pack directive '%c' in '%s'",
+ type, RSTRING_PTR(fmt));
break;
}
}
@@ -1071,7 +949,7 @@ encodes(VALUE str, const char *s, long len, int type, int tail_lf)
char buff[4096];
long i = 0;
const char *trans = type == 'u' ? uu_table : b64_table;
- int padding;
+ char padding;
if (type == 'u') {
buff[i++] = (char)len + ' ';
@@ -1169,19 +1047,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 { \
@@ -1254,10 +1124,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
@@ -1366,9 +1242,6 @@ pack_unpack(VALUE str, VALUE fmt)
star = 0;
{
- static const char natstr[] = "sSiIlL";
- static const char endstr[] = "sSiIlLqQ";
-
modifiers:
switch (*p) {
case '_':
@@ -1464,7 +1337,7 @@ pack_unpack(VALUE str, VALUE fmt)
if (p[-1] == '*' || len > (send - s) * 8)
len = (send - s) * 8;
bits = 0;
- UNPACK_PUSH(bitstr = rb_str_new(0, len));
+ UNPACK_PUSH(bitstr = rb_usascii_str_new(0, len));
t = RSTRING_PTR(bitstr);
for (i=0; i<len; i++) {
if (i & 7) bits >>= 1;
@@ -1484,7 +1357,7 @@ pack_unpack(VALUE str, VALUE fmt)
if (p[-1] == '*' || len > (send - s) * 8)
len = (send - s) * 8;
bits = 0;
- UNPACK_PUSH(bitstr = rb_str_new(0, len));
+ UNPACK_PUSH(bitstr = rb_usascii_str_new(0, len));
t = RSTRING_PTR(bitstr);
for (i=0; i<len; i++) {
if (i & 7) bits <<= 1;
@@ -1504,7 +1377,7 @@ pack_unpack(VALUE str, VALUE fmt)
if (p[-1] == '*' || len > (send - s) * 2)
len = (send - s) * 2;
bits = 0;
- UNPACK_PUSH(bitstr = rb_str_new(0, len));
+ UNPACK_PUSH(bitstr = rb_usascii_str_new(0, len));
t = RSTRING_PTR(bitstr);
for (i=0; i<len; i++) {
if (i & 1)
@@ -1526,7 +1399,7 @@ pack_unpack(VALUE str, VALUE fmt)
if (p[-1] == '*' || len > (send - s) * 2)
len = (send - s) * 2;
bits = 0;
- UNPACK_PUSH(bitstr = rb_str_new(0, len));
+ UNPACK_PUSH(bitstr = rb_usascii_str_new(0, len));
t = RSTRING_PTR(bitstr);
for (i=0; i<len; i++) {
if (i & 1)
@@ -1539,23 +1412,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;
@@ -1595,13 +1461,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;
@@ -1633,144 +1499,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 intger 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':
@@ -1922,7 +1661,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];
@@ -1934,7 +1673,7 @@ pack_unpack(VALUE str, VALUE fmt)
b64_xtable[i] = -1;
}
for (i = 0; i < 64; i++) {
- b64_xtable[(unsigned char)b64_table[i]] = i;
+ b64_xtable[(unsigned char)b64_table[i]] = (char)i;
}
}
if (len == 0) {
@@ -1953,17 +1692,17 @@ pack_unpack(VALUE str, VALUE fmt)
if (s + 1 == send && *s == '=') break;
d = b64_xtable[(unsigned char)*s++];
if (d == -1) rb_raise(rb_eArgError, "invalid base64");
- *ptr++ = a << 2 | b >> 4;
- *ptr++ = b << 4 | c >> 2;
- *ptr++ = c << 6 | d;
+ *ptr++ = castchar(a << 2 | b >> 4);
+ *ptr++ = castchar(b << 4 | c >> 2);
+ *ptr++ = castchar(c << 6 | d);
}
if (c == -1) {
- *ptr++ = a << 2 | b >> 4;
+ *ptr++ = castchar(a << 2 | b >> 4);
if (b & 0xf) rb_raise(rb_eArgError, "invalid base64");
}
else if (d == -1) {
- *ptr++ = a << 2 | b >> 4;
- *ptr++ = b << 4 | c >> 2;
+ *ptr++ = castchar(a << 2 | b >> 4);
+ *ptr++ = castchar(b << 4 | c >> 2);
if (c & 0x3) rb_raise(rb_eArgError, "invalid base64");
}
}
@@ -1982,16 +1721,17 @@ pack_unpack(VALUE str, VALUE fmt)
while ((d = b64_xtable[(unsigned char)*s]) == -1 && s < send) {if (*s == '=') break; s++;}
if (*s == '=' || s >= send) break;
s++;
- *ptr++ = a << 2 | b >> 4;
- *ptr++ = b << 4 | c >> 2;
- *ptr++ = c << 6 | d;
+ *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 == '=')
- *ptr++ = a << 2 | b >> 4;
- else if (c != -1 && *s == '=') {
- *ptr++ = a << 2 | b >> 4;
- *ptr++ = b << 4 | c >> 2;
+ if (c == -1)
+ *ptr++ = castchar(a << 2 | b >> 4);
+ else {
+ *ptr++ = castchar(a << 2 | b >> 4);
+ *ptr++ = castchar(b << 4 | c >> 2);
}
}
}
@@ -2009,13 +1749,13 @@ pack_unpack(VALUE str, VALUE fmt)
while (s < send) {
if (*s == '=') {
if (++s == send) break;
- if (s+1 < send && *s == '\r' && *(s+1) == '\n')
- s++;
+ if (s+1 < send && *s == '\r' && *(s+1) == '\n')
+ s++;
if (*s != '\n') {
if ((c1 = hex2num(*s)) == -1) break;
if (++s == send) break;
if ((c2 = hex2num(*s)) == -1) break;
- *ptr++ = c1 << 4 | c2;
+ *ptr++ = castchar(c1 << 4 | c2);
}
}
else {
@@ -2058,15 +1798,16 @@ 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))) {
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 (TYPE(*p) == T_STRING && RSTRING_PTR(*p) == t) {
+ 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);
@@ -2100,15 +1841,16 @@ 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))) {
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 (TYPE(*p) == T_STRING && RSTRING_PTR(*p) == t) {
+ if (RB_TYPE_P(*p, T_STRING) && RSTRING_PTR(*p) == t) {
tmp = *p;
break;
}
@@ -2125,36 +1867,24 @@ 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;
default:
+ rb_warning("unknown unpack directive '%c' in '%s'",
+ type, RSTRING_PTR(fmt));
break;
}
}
@@ -2172,41 +1902,43 @@ rb_uv_to_utf8(char buf[6], unsigned long uv)
return 1;
}
if (uv <= 0x7ff) {
- buf[0] = (char)((uv>>6)&0xff)|0xc0;
- buf[1] = (char)(uv&0x3f)|0x80;
+ buf[0] = castchar(((uv>>6)&0xff)|0xc0);
+ buf[1] = castchar((uv&0x3f)|0x80);
return 2;
}
if (uv <= 0xffff) {
- buf[0] = (char)((uv>>12)&0xff)|0xe0;
- buf[1] = (char)((uv>>6)&0x3f)|0x80;
- buf[2] = (char)(uv&0x3f)|0x80;
+ buf[0] = castchar(((uv>>12)&0xff)|0xe0);
+ buf[1] = castchar(((uv>>6)&0x3f)|0x80);
+ buf[2] = castchar((uv&0x3f)|0x80);
return 3;
}
if (uv <= 0x1fffff) {
- buf[0] = (char)((uv>>18)&0xff)|0xf0;
- buf[1] = (char)((uv>>12)&0x3f)|0x80;
- buf[2] = (char)((uv>>6)&0x3f)|0x80;
- buf[3] = (char)(uv&0x3f)|0x80;
+ buf[0] = castchar(((uv>>18)&0xff)|0xf0);
+ buf[1] = castchar(((uv>>12)&0x3f)|0x80);
+ buf[2] = castchar(((uv>>6)&0x3f)|0x80);
+ buf[3] = castchar((uv&0x3f)|0x80);
return 4;
}
if (uv <= 0x3ffffff) {
- buf[0] = (char)((uv>>24)&0xff)|0xf8;
- buf[1] = (char)((uv>>18)&0x3f)|0x80;
- buf[2] = (char)((uv>>12)&0x3f)|0x80;
- buf[3] = (char)((uv>>6)&0x3f)|0x80;
- buf[4] = (char)(uv&0x3f)|0x80;
+ buf[0] = castchar(((uv>>24)&0xff)|0xf8);
+ buf[1] = castchar(((uv>>18)&0x3f)|0x80);
+ buf[2] = castchar(((uv>>12)&0x3f)|0x80);
+ buf[3] = castchar(((uv>>6)&0x3f)|0x80);
+ buf[4] = castchar((uv&0x3f)|0x80);
return 5;
}
if (uv <= 0x7fffffff) {
- buf[0] = (char)((uv>>30)&0xff)|0xfc;
- buf[1] = (char)((uv>>24)&0x3f)|0x80;
- buf[2] = (char)((uv>>18)&0x3f)|0x80;
- buf[3] = (char)((uv>>12)&0x3f)|0x80;
- buf[4] = (char)((uv>>6)&0x3f)|0x80;
- buf[5] = (char)(uv&0x3f)|0x80;
+ buf[0] = castchar(((uv>>30)&0xff)|0xfc);
+ buf[1] = castchar(((uv>>24)&0x3f)|0x80);
+ buf[2] = castchar(((uv>>18)&0x3f)|0x80);
+ buf[3] = castchar(((uv>>12)&0x3f)|0x80);
+ buf[4] = castchar(((uv>>6)&0x3f)|0x80);
+ buf[5] = castchar((uv&0x3f)|0x80);
return 6;
}
rb_raise(rb_eRangeError, "pack(U): value out of range");
+
+ UNREACHABLE;
}
static const unsigned long utf8_limits[] = {
diff --git a/parse.y b/parse.y
index 3f05fd5b6b..8207ad7133 100644
--- a/parse.y
+++ b/parse.y
@@ -11,6 +11,9 @@
%{
+#ifndef PARSER_DEBUG
+#define PARSER_DEBUG 0
+#endif
#define YYDEBUG 1
#define YYERROR_VERBOSE 1
#define YYSTACK_USE_ALLOCA 0
@@ -26,8 +29,7 @@
#include <stdio.h>
#include <errno.h>
#include <ctype.h>
-
-#define numberof(array) (int)(sizeof(array) / sizeof((array)[0]))
+#include "probes.h"
#define YYMALLOC(size) rb_parser_malloc(parser, (size))
#define YYREALLOC(ptr, size) rb_parser_realloc(parser, (ptr), (size))
@@ -40,11 +42,12 @@
#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_TOKEN)
+#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)
@@ -52,26 +55,51 @@ static ID register_symid(ID, const char *, long, rb_encoding *);
#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_e {
- EXPR_BEG, /* ignore newline, +/- is a sign. */
- EXPR_END, /* newline significant, +/- is an operator. */
- EXPR_ENDARG, /* ditto, and unbound braces. */
- EXPR_ENDFN, /* ditto, and unbound braces. */
- EXPR_ARG, /* newline significant, +/- is an operator. */
- EXPR_CMDARG, /* newline significant, +/- is an operator. */
- EXPR_MID, /* newline significant, +/- is an operator. */
- EXPR_FNAME, /* ignore newline, no reserved words. */
- EXPR_DOT, /* right after `.' or `::', no reserved words. */
- EXPR_CLASS, /* immediate after `class', no here document. */
- EXPR_VALUE, /* alike EXPR_BEG but label is disallowed. */
+enum lex_state_bits {
+ EXPR_BEG_bit, /* ignore newline, +/- is a sign. */
+ EXPR_END_bit, /* newline significant, +/- is an operator. */
+ EXPR_ENDARG_bit, /* ditto, and unbound braces. */
+ EXPR_ENDFN_bit, /* ditto, and unbound braces. */
+ EXPR_ARG_bit, /* newline significant, +/- is an operator. */
+ EXPR_CMDARG_bit, /* newline significant, +/- is an operator. */
+ EXPR_MID_bit, /* newline significant, +/- is an operator. */
+ EXPR_FNAME_bit, /* ignore newline, no reserved words. */
+ EXPR_DOT_bit, /* right after `.' or `::', no reserved words. */
+ EXPR_CLASS_bit, /* immediate after `class', no here document. */
+ EXPR_VALUE_bit, /* alike EXPR_BEG but label is disallowed. */
EXPR_MAX_STATE
};
+/* examine combinations */
+enum lex_state_e {
+#define DEF_EXPR(n) EXPR_##n = (1 << EXPR_##n##_bit)
+ DEF_EXPR(BEG),
+ DEF_EXPR(END),
+ DEF_EXPR(ENDARG),
+ DEF_EXPR(ENDFN),
+ DEF_EXPR(ARG),
+ DEF_EXPR(CMDARG),
+ DEF_EXPR(MID),
+ DEF_EXPR(FNAME),
+ DEF_EXPR(DOT),
+ DEF_EXPR(CLASS),
+ DEF_EXPR(VALUE),
+ EXPR_BEG_ANY = (EXPR_BEG | EXPR_VALUE | EXPR_MID | EXPR_CLASS),
+ EXPR_ARG_ANY = (EXPR_ARG | EXPR_CMDARG),
+ EXPR_END_ANY = (EXPR_END | EXPR_ENDARG | EXPR_ENDFN)
+};
+#define IS_lex_state_for(x, ls) ((x) & (ls))
+#define IS_lex_state(ls) IS_lex_state_for(lex_state, (ls))
+
+#if PARSER_DEBUG
+static const char *lex_state_name(enum lex_state_e state);
+#endif
typedef VALUE stack_type;
@@ -212,12 +240,14 @@ struct parser_params {
int parser_lpar_beg;
int parser_in_single;
int parser_in_def;
+ int parser_brace_nest;
int parser_compile_for_eval;
VALUE parser_cur_mid;
int parser_in_defined;
char *parser_tokenbuf;
int parser_tokidx;
int parser_toksiz;
+ int parser_tokline;
VALUE parser_lex_input;
VALUE parser_lex_lastline;
VALUE parser_lex_nextline;
@@ -235,11 +265,13 @@ struct parser_params {
int has_shebang;
char *parser_ruby_sourcefile; /* current source file */
int parser_ruby_sourceline; /* current line no. */
+ VALUE parser_ruby_sourcefile_string;
rb_encoding *enc;
- rb_encoding *utf8;
int parser_yydebug;
+ int last_cr_line;
+
#ifndef RIPPER
/* Ruby core only */
NODE *parser_eval_tree_begin;
@@ -252,7 +284,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;
@@ -265,20 +296,16 @@ struct parser_params {
#endif
};
-#define UTF8_ENC() (parser->utf8 ? parser->utf8 : \
- (parser->utf8 = rb_utf8_encoding()))
-#define STR_NEW(p,n) rb_enc_str_new((p),(n),parser->enc)
-#define STR_NEW0() rb_enc_str_new(0,0,parser->enc)
-#define STR_NEW2(p) rb_enc_str_new((p),strlen(p),parser->enc)
-#define STR_NEW3(p,n,e,func) parser_str_new((p),(n),(e),(func),parser->enc)
+#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(), parser->enc)
+#define TOK_INTERN(mb) rb_intern3(tok(), toklen(), current_enc)
static int parser_yyerror(struct parser_params*, const char*);
#define yyerror(msg) parser_yyerror(parser, (msg))
-#define YYLEX_PARAM parser
-
#define lex_strterm (parser->parser_lex_strterm)
#define lex_state (parser->parser_lex_state)
#define cond_stack (parser->parser_cond_stack)
@@ -286,6 +313,7 @@ static int parser_yyerror(struct parser_params*, const char*);
#define class_nest (parser->parser_class_nest)
#define paren_nest (parser->parser_paren_nest)
#define lpar_beg (parser->parser_lpar_beg)
+#define brace_nest (parser->parser_brace_nest)
#define in_single (parser->parser_in_single)
#define in_def (parser->parser_in_def)
#define compile_for_eval (parser->parser_compile_for_eval)
@@ -294,6 +322,7 @@ static int parser_yyerror(struct parser_params*, const char*);
#define tokenbuf (parser->parser_tokenbuf)
#define tokidx (parser->parser_tokidx)
#define toksiz (parser->parser_toksiz)
+#define tokline (parser->parser_tokline)
#define lex_input (parser->parser_lex_input)
#define lex_lastline (parser->parser_lex_lastline)
#define lex_nextline (parser->parser_lex_nextline)
@@ -309,6 +338,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
@@ -319,7 +349,11 @@ static int parser_yyerror(struct parser_params*, const char*);
#define ruby_coverage (parser->coverage)
#endif
+#if YYPURE
static int yylex(void*, void*);
+#else
+static int yylex(void*);
+#endif
#ifndef RIPPER
#define yyparse ruby_yyparse
@@ -338,6 +372,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))
@@ -372,8 +407,10 @@ static NODE *call_bin_op_gen(struct parser_params*,NODE*,ID,NODE*);
static NODE *call_uni_op_gen(struct parser_params*,NODE*,ID);
#define call_uni_op(recv,id) call_uni_op_gen(parser, (recv),(id))
-static NODE *new_args_gen(struct parser_params*,NODE*,NODE*,ID,NODE*,ID);
-#define new_args(f,o,r,p,b) new_args_gen(parser, (f),(o),(r),(p),(b))
+static NODE *new_args_gen(struct parser_params*,NODE*,NODE*,ID,NODE*,NODE*);
+#define new_args(f,o,r,p,t) new_args_gen(parser, (f),(o),(r),(p),(t))
+static NODE *new_args_tail_gen(struct parser_params*,NODE*,ID,ID);
+#define new_args_tail(k,kr,b) new_args_tail_gen(parser, (k),(kr),(b))
static NODE *negate_lit(NODE*);
static NODE *ret_args_gen(struct parser_params*,NODE*);
@@ -381,6 +418,8 @@ static NODE *ret_args_gen(struct parser_params*,NODE*);
static NODE *arg_blk_pass(NODE*,NODE*);
static NODE *new_yield_gen(struct parser_params*,NODE*);
#define new_yield(node) new_yield_gen(parser, (node))
+static NODE *dsym_node_gen(struct parser_params*,NODE*);
+#define dsym_node(node) dsym_node_gen(parser, (node))
static NODE *gettable_gen(struct parser_params*,ID);
#define gettable(id) gettable_gen(parser,(id))
@@ -397,6 +436,14 @@ static void rb_backref_error_gen(struct parser_params*,NODE*);
static NODE *node_assign_gen(struct parser_params*,NODE*,NODE*);
#define node_assign(node1, node2) node_assign_gen(parser, (node1), (node2))
+static NODE *new_op_assign_gen(struct parser_params *parser, NODE *lhs, ID op, NODE *rhs);
+static NODE *new_attr_op_assign_gen(struct parser_params *parser, NODE *lhs, ID attr, ID op, NODE *rhs);
+#define new_attr_op_assign(lhs, type, attr, op, rhs) new_attr_op_assign_gen(parser, (lhs), (attr), (op), (rhs))
+static NODE *new_const_op_assign_gen(struct parser_params *parser, NODE *lhs, ID op, NODE *rhs);
+#define new_const_op_assign(lhs, op, rhs) new_const_op_assign_gen(parser, (lhs), (op), (rhs))
+
+#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))
@@ -417,6 +464,7 @@ static NODE *reg_named_capture_assign_gen(struct parser_params* parser, VALUE re
#define get_id(id) (id)
#define get_value(val) (val)
#else
+#define value_expr(node) ((void)(node))
#define remove_begin(node) (node)
#define rb_dvar_defined(id) 0
#define rb_local_defined(id) 0
@@ -428,8 +476,17 @@ static VALUE assignable_gen(struct parser_params*,VALUE);
#define assignable(lhs,node) assignable_gen(parser, (lhs))
static int id_is_var_gen(struct parser_params *parser, ID id);
#define id_is_var(id) id_is_var_gen(parser, (id))
+
+#define node_assign(node1, node2) dispatch2(assign, (node1), (node2))
+
+static VALUE new_op_assign_gen(struct parser_params *parser, VALUE lhs, VALUE op, VALUE rhs);
+static VALUE new_attr_op_assign_gen(struct parser_params *parser, VALUE lhs, VALUE type, VALUE attr, VALUE op, VALUE rhs);
+#define new_attr_op_assign(lhs, type, attr, op, rhs) new_attr_op_assign_gen(parser, (lhs), (type), (attr), (op), (rhs))
+
#endif /* !RIPPER */
+#define new_op_assign(lhs, op, rhs) new_op_assign_gen(parser, (lhs), (op), (rhs))
+
static ID formal_argument_gen(struct parser_params*, ID);
#define formal_argument(id) formal_argument_gen(parser, (id))
static ID shadowing_lvar_gen(struct parser_params*,ID);
@@ -442,7 +499,7 @@ static void local_push_gen(struct parser_params*,int);
static void local_pop_gen(struct parser_params*);
#define local_pop() local_pop_gen(parser)
static int local_var_gen(struct parser_params*, ID);
-#define local_var(id) local_var_gen(parser, (id));
+#define local_var(id) local_var_gen(parser, (id))
static int arg_var_gen(struct parser_params*, ID);
#define arg_var(id) arg_var_gen(parser, (id))
static int local_id_gen(struct parser_params*, ID);
@@ -493,7 +550,6 @@ static int lvar_defined_gen(struct parser_params*, ID);
#include "eventids1.c"
#include "eventids2.c"
-static ID ripper_id_gets;
static VALUE ripper_dispatch0(struct parser_params*,ID);
static VALUE ripper_dispatch1(struct parser_params*,ID,VALUE);
@@ -501,6 +557,7 @@ static VALUE ripper_dispatch2(struct parser_params*,ID,VALUE,VALUE);
static VALUE ripper_dispatch3(struct parser_params*,ID,VALUE,VALUE,VALUE);
static VALUE ripper_dispatch4(struct parser_params*,ID,VALUE,VALUE,VALUE,VALUE);
static VALUE ripper_dispatch5(struct parser_params*,ID,VALUE,VALUE,VALUE,VALUE,VALUE);
+static VALUE ripper_dispatch7(struct parser_params*,ID,VALUE,VALUE,VALUE,VALUE,VALUE,VALUE,VALUE);
#define dispatch0(n) ripper_dispatch0(parser, TOKEN_PASTE(ripper_id_, n))
#define dispatch1(n,a) ripper_dispatch1(parser, TOKEN_PASTE(ripper_id_, n), (a))
@@ -508,6 +565,7 @@ static VALUE ripper_dispatch5(struct parser_params*,ID,VALUE,VALUE,VALUE,VALUE,V
#define dispatch3(n,a,b,c) ripper_dispatch3(parser, TOKEN_PASTE(ripper_id_, n), (a), (b), (c))
#define dispatch4(n,a,b,c,d) ripper_dispatch4(parser, TOKEN_PASTE(ripper_id_, n), (a), (b), (c), (d))
#define dispatch5(n,a,b,c,d,e) ripper_dispatch5(parser, TOKEN_PASTE(ripper_id_, n), (a), (b), (c), (d), (e))
+#define dispatch7(n,a,b,c,d,e,f,g) ripper_dispatch7(parser, TOKEN_PASTE(ripper_id_, n), (a), (b), (c), (d), (e), (f), (g))
#define yyparse ripper_yyparse
@@ -535,8 +593,8 @@ static VALUE ripper_id2sym(ID);
#define mlhs_add(l,a) dispatch2(mlhs_add, (l), (a))
#define mlhs_add_star(l,a) dispatch2(mlhs_add_star, (l), (a))
-#define params_new(pars, opts, rest, pars2, blk) \
- dispatch5(params, (pars), (opts), (rest), (pars2), (blk))
+#define params_new(pars, opts, rest, pars2, kws, kwrest, blk) \
+ dispatch7(params, (pars), (opts), (rest), (pars2), (kws), (kwrest), (blk))
#define blockvar_new(p,v) dispatch2(block_var, (p), (v))
#define blockvar_add_star(l,a) dispatch2(block_var_add_star, (l), (a))
@@ -548,13 +606,33 @@ static VALUE ripper_id2sym(ID);
#define escape_Qundef(x) ((x)==Qundef ? Qnil : (x))
+static inline VALUE
+new_args_gen(struct parser_params *parser, VALUE f, VALUE o, VALUE r, VALUE p, VALUE tail)
+{
+ NODE *t = (NODE *)tail;
+ VALUE k = t->u1.value, kr = t->u2.value, b = t->u3.value;
+ return params_new(f, o, r, p, k, kr, escape_Qundef(b));
+}
+#define new_args(f,o,r,p,t) new_args_gen(parser, (f),(o),(r),(p),(t))
+
+static inline VALUE
+new_args_tail_gen(struct parser_params *parser, VALUE k, VALUE kr, VALUE b)
+{
+ return (VALUE)rb_node_newnode(NODE_MEMO, k, kr, b);
+}
+#define new_args_tail(k,kr,b) new_args_tail_gen(parser, (k),(kr),(b))
+
+#define new_defined(expr) dispatch1(defined, (expr))
+
#define FIXME 0
#endif /* RIPPER */
#ifndef RIPPER
+# define Qnone 0
# define ifndef_ripper(x) (x)
#else
+# define Qnone Qnil
# define ifndef_ripper(x)
#endif
@@ -562,19 +640,19 @@ static VALUE ripper_id2sym(ID);
# define rb_warn0(fmt) rb_compile_warn(ruby_sourcefile, ruby_sourceline, (fmt))
# define rb_warnI(fmt,a) rb_compile_warn(ruby_sourcefile, ruby_sourceline, (fmt), (a))
# define rb_warnS(fmt,a) rb_compile_warn(ruby_sourcefile, ruby_sourceline, (fmt), (a))
+# define rb_warn4S(file,line,fmt,a) rb_compile_warn((file), (line), (fmt), (a))
# define rb_warning0(fmt) rb_compile_warning(ruby_sourcefile, ruby_sourceline, (fmt))
# define rb_warningS(fmt,a) rb_compile_warning(ruby_sourcefile, ruby_sourceline, (fmt), (a))
#else
# define rb_warn0(fmt) ripper_warn0(parser, (fmt))
# define rb_warnI(fmt,a) ripper_warnI(parser, (fmt), (a))
# define rb_warnS(fmt,a) ripper_warnS(parser, (fmt), (a))
+# define rb_warn4S(file,line,fmt,a) ripper_warnS(parser, (fmt), (a))
# define rb_warning0(fmt) ripper_warning0(parser, (fmt))
# define rb_warningS(fmt,a) ripper_warningS(parser, (fmt), (a))
static void ripper_warn0(struct parser_params*, const char*);
static void ripper_warnI(struct parser_params*, const char*, int);
-#if 0
static void ripper_warnS(struct parser_params*, const char*, const char*);
-#endif
static void ripper_warning0(struct parser_params*, const char*);
static void ripper_warningS(struct parser_params*, const char*, const char*);
#endif
@@ -610,7 +688,8 @@ static void token_info_pop(struct parser_params*, const char *token);
#endif
%}
-%pure_parser
+%pure-parser
+%lex-param {struct parser_params *parser}
%parse-param {struct parser_params *parser}
%union {
@@ -677,65 +756,74 @@ 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 qwords word_list qword_list word
-%type <node> literal numeric dsym cpath
+%type <node> words symbols symbol_list qwords qsymbols word_list qword_list qsym_list word
+%type <node> literal numeric simple_numeric dsym cpath
%type <node> top_compstmt top_stmts top_stmt
-%type <node> bodystmt compstmt stmts stmt expr arg primary command command_call method_call
-%type <node> expr_value arg_value primary_value
+%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
%type <node> if_tail opt_else case_body cases opt_rescue exc_list exc_var opt_ensure
%type <node> args call_args opt_call_args
-%type <node> paren_args opt_paren_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
%type <node> block_param opt_block_param block_param_def f_opt
+%type <node> f_kwarg f_kw f_block_kwarg f_block_kw
%type <node> bv_decls opt_bv_decl bvar
%type <node> lambda f_larglist lambda_body
%type <node> brace_block cmd_brace_block do_block lhs none fitem
%type <node> mlhs mlhs_head mlhs_basic mlhs_item mlhs_node mlhs_post mlhs_inner
%type <id> fsym keyword_variable user_variable sym symbol operation operation2 operation3
%type <id> cname fname op f_rest_arg f_block_arg opt_f_block_arg f_norm_arg f_bad_arg
+%type <id> f_kwrest f_label
/*%%%*/
/*%
%type <val> program reswords then do dot_or_colon
%*/
-%token tUPLUS /* unary+ */
-%token tUMINUS /* unary- */
-%token tPOW /* ** */
-%token tCMP /* <=> */
-%token tEQ /* == */
-%token tEQQ /* === */
-%token tNEQ /* != */
-%token tGEQ /* >= */
-%token tLEQ /* <= */
-%token tANDOP tOROP /* && and || */
-%token tMATCH tNMATCH /* =~ and !~ */
-%token tDOT2 tDOT3 /* .. and ... */
-%token tAREF tASET /* [] and []= */
-%token tLSHFT tRSHFT /* << and >> */
-%token tCOLON2 /* :: */
-%token tCOLON3 /* :: at EXPR_BEG */
+%token END_OF_INPUT 0 "end-of-input"
+%token tUPLUS RUBY_TOKEN(UPLUS) "unary+"
+%token tUMINUS RUBY_TOKEN(UMINUS) "unary-"
+%token tPOW RUBY_TOKEN(POW) "**"
+%token tCMP RUBY_TOKEN(CMP) "<=>"
+%token tEQ RUBY_TOKEN(EQ) "=="
+%token tEQQ RUBY_TOKEN(EQQ) "==="
+%token tNEQ RUBY_TOKEN(NEQ) "!="
+%token tGEQ RUBY_TOKEN(GEQ) ">="
+%token tLEQ RUBY_TOKEN(LEQ) "<="
+%token tANDOP "&&"
+%token tOROP "||"
+%token tMATCH RUBY_TOKEN(MATCH) "=~"
+%token tNMATCH RUBY_TOKEN(NMATCH) "!~"
+%token tDOT2 RUBY_TOKEN(DOT2) ".."
+%token tDOT3 RUBY_TOKEN(DOT3) "..."
+%token tAREF RUBY_TOKEN(AREF) "[]"
+%token tASET RUBY_TOKEN(ASET) "[]="
+%token tLSHFT RUBY_TOKEN(LSHFT) "<<"
+%token tRSHFT RUBY_TOKEN(RSHFT) ">>"
+%token tCOLON2 "::"
+%token tCOLON3 ":: at EXPR_BEG"
%token <id> tOP_ASGN /* +=, -= etc. */
-%token tASSOC /* => */
-%token tLPAREN /* ( */
-%token tLPAREN_ARG /* ( */
-%token tRPAREN /* ) */
-%token tLBRACK /* [ */
-%token tLBRACE /* { */
-%token tLBRACE_ARG /* { */
-%token tSTAR /* * */
-%token tAMPER /* & */
-%token tLAMBDA /* -> */
-%token tSYMBEG tSTRING_BEG tXSTRING_BEG tREGEXP_BEG tWORDS_BEG tQWORDS_BEG
-%token tSTRING_DBEG tSTRING_DVAR tSTRING_END tLAMBEG
+%token tASSOC "=>"
+%token tLPAREN "("
+%token tLPAREN_ARG "( arg"
+%token tRPAREN ")"
+%token tLBRACK "["
+%token tLBRACE "{"
+%token tLBRACE_ARG "{ arg"
+%token tSTAR "*"
+%token tDSTAR "**arg"
+%token tAMPER "&"
+%token tLAMBDA "->"
+%token tSYMBEG tSTRING_BEG tXSTRING_BEG tREGEXP_BEG tWORDS_BEG tQWORDS_BEG tSYMBOLS_BEG tQSYMBOLS_BEG
+%token tSTRING_DBEG tSTRING_DEND tSTRING_DVAR tSTRING_END tLAMBEG
/*
* precedence table
@@ -765,17 +853,6 @@ static void token_info_pop(struct parser_params*, const char *token);
%right tPOW
%right '!' '~' tUPLUS
-%nonassoc idNULL
-%nonassoc idRespond_to
-%nonassoc idIFUNC
-%nonassoc idCFUNC
-%nonassoc id_core_set_method_alias
-%nonassoc id_core_set_variable_alias
-%nonassoc id_core_undef_method
-%nonassoc id_core_define_method
-%nonassoc id_core_define_singleton_method
-%nonassoc id_core_set_postexe
-
%token tLAST_TOKEN
%%
@@ -855,9 +932,6 @@ top_stmts : none
top_stmt : stmt
| keyword_BEGIN
{
- if (in_def || in_single) {
- yyerror("BEGIN in method");
- }
/*%%%*/
/* local_push(0); */
/*%
@@ -930,7 +1004,7 @@ stmts : none
dispatch0(void_stmt));
%*/
}
- | stmt
+ | stmt_or_begin
{
/*%%%*/
$$ = newline_node($1);
@@ -938,7 +1012,7 @@ stmts : none
$$ = dispatch2(stmts_add, dispatch0(stmts_new), $1);
%*/
}
- | stmts terms stmt
+ | stmts terms stmt_or_begin
{
/*%%%*/
$$ = block_append($1, newline_node($3));
@@ -952,6 +1026,31 @@ stmts : none
}
;
+stmt_or_begin : stmt
+ {
+ $$ = $1;
+ }
+ | keyword_BEGIN
+ {
+ yyerror("BEGIN is permitted only at toplevel");
+ /*%%%*/
+ /* local_push(0); */
+ /*%
+ %*/
+ }
+ '{' top_compstmt '}'
+ {
+ /*%%%*/
+ ruby_eval_tree_begin = block_append(ruby_eval_tree_begin,
+ $4);
+ /* NEW_PREEXE($4)); */
+ /* local_pop(); */
+ $$ = NEW_BEGIN(0);
+ /*%
+ $$ = dispatch1(BEGIN, $4);
+ %*/
+ }
+
stmt : keyword_alias fitem {lex_state = EXPR_FNAME;} fitem
{
/*%%%*/
@@ -1075,32 +1174,8 @@ stmt : keyword_alias fitem {lex_state = EXPR_FNAME;} fitem
}
| var_lhs tOP_ASGN command_call
{
- /*%%%*/
value_expr($3);
- if ($1) {
- ID vid = $1->nd_vid;
- if ($2 == tOROP) {
- $1->nd_value = $3;
- $$ = NEW_OP_ASGN_OR(gettable(vid), $1);
- if (is_asgn_or_id(vid)) {
- $$->nd_aid = vid;
- }
- }
- else if ($2 == tANDOP) {
- $1->nd_value = $3;
- $$ = NEW_OP_ASGN_AND(gettable(vid), $1);
- }
- else {
- $$ = $1;
- $$->nd_value = NEW_CALL(gettable(vid), $2, NEW_LIST($3));
- }
- }
- else {
- $$ = NEW_BEGIN(0);
- }
- /*%
- $$ = dispatch3(opassign, $1, $2, $3);
- %*/
+ $$ = new_op_assign($1, $2, $3);
}
| primary_value '[' opt_call_args rbracket tOP_ASGN command_call
{
@@ -1125,65 +1200,28 @@ stmt : keyword_alias fitem {lex_state = EXPR_FNAME;} fitem
}
| primary_value '.' tIDENTIFIER tOP_ASGN command_call
{
- /*%%%*/
value_expr($5);
- if ($4 == tOROP) {
- $4 = 0;
- }
- else if ($4 == tANDOP) {
- $4 = 1;
- }
- $$ = NEW_OP_ASGN2($1, $3, $4, $5);
- fixpos($$, $1);
- /*%
- $$ = dispatch3(field, $1, ripper_id2sym('.'), $3);
- $$ = dispatch3(opassign, $$, $4, $5);
- %*/
+ $$ = new_attr_op_assign($1, ripper_id2sym('.'), $3, $4, $5);
}
| primary_value '.' tCONSTANT tOP_ASGN command_call
{
- /*%%%*/
value_expr($5);
- if ($4 == tOROP) {
- $4 = 0;
- }
- else if ($4 == tANDOP) {
- $4 = 1;
- }
- $$ = NEW_OP_ASGN2($1, $3, $4, $5);
- fixpos($$, $1);
- /*%
- $$ = dispatch3(field, $1, ripper_id2sym('.'), $3);
- $$ = dispatch3(opassign, $$, $4, $5);
- %*/
+ $$ = new_attr_op_assign($1, ripper_id2sym('.'), $3, $4, $5);
}
| primary_value tCOLON2 tCONSTANT tOP_ASGN command_call
{
/*%%%*/
- yyerror("constant re-assignment");
- $$ = 0;
+ $$ = NEW_COLON2($1, $3);
+ $$ = new_const_op_assign($$, $4, $5);
/*%
$$ = dispatch2(const_path_field, $1, $3);
$$ = dispatch3(opassign, $$, $4, $5);
- $$ = dispatch1(assign_error, $$);
%*/
}
| primary_value tCOLON2 tIDENTIFIER tOP_ASGN command_call
{
- /*%%%*/
value_expr($5);
- if ($4 == tOROP) {
- $4 = 0;
- }
- else if ($4 == tANDOP) {
- $4 = 1;
- }
- $$ = NEW_OP_ASGN2($1, $3, $4, $5);
- fixpos($$, $1);
- /*%
- $$ = dispatch3(field, $1, ripper_intern("::"), $3);
- $$ = dispatch3(opassign, $$, $4, $5);
- %*/
+ $$ = new_attr_op_assign($1, ripper_intern("::"), $3, $4, $5);
}
| backref tOP_ASGN command_call
{
@@ -1204,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;
@@ -1299,21 +1328,12 @@ command_call : command
;
block_command : block_call
- | block_call '.' operation2 command_args
+ | block_call dot_or_colon operation2 command_args
{
/*%%%*/
$$ = NEW_CALL($1, $3, $4);
/*%
- $$ = dispatch3(call, $1, ripper_id2sym('.'), $3);
- $$ = method_arg($$, $4);
- %*/
- }
- | block_call tCOLON2 operation2 command_args
- {
- /*%%%*/
- $$ = NEW_CALL($1, $3, $4);
- /*%
- $$ = dispatch3(call, $1, ripper_intern("::"), $3);
+ $$ = dispatch3(call, $1, $2, $3);
$$ = method_arg($$, $4);
%*/
}
@@ -1341,22 +1361,33 @@ cmd_brace_block : tLBRACE_ARG
}
;
-command : operation command_args %prec tLOWEST
+fcall : operation
{
/*%%%*/
- $$ = NEW_FCALL($1, $2);
- fixpos($$, $2);
+ $$ = NEW_FCALL($1, 0);
+ nd_set_line($$, tokline);
+ /*%
+ %*/
+ }
+ ;
+
+command : fcall command_args %prec tLOWEST
+ {
+ /*%%%*/
+ $$ = $1;
+ $$->nd_args = $2;
/*%
$$ = dispatch2(command, $1, $2);
%*/
}
- | operation command_args cmd_brace_block
+ | fcall command_args cmd_brace_block
{
/*%%%*/
block_dup_check($2,$3);
- $3->nd_iter = NEW_FCALL($1, $2);
+ $1->nd_args = $2;
+ $3->nd_iter = $1;
$$ = $3;
- fixpos($$, $2);
+ fixpos($$, $1);
/*%
$$ = dispatch2(command, $1, $2);
$$ = method_add_block($$, $3);
@@ -1875,6 +1906,7 @@ op : '|' { ifndef_ripper($$ = '|'); }
| '/' { ifndef_ripper($$ = '/'); }
| '%' { ifndef_ripper($$ = '%'); }
| tPOW { ifndef_ripper($$ = tPOW); }
+ | tDSTAR { ifndef_ripper($$ = tDSTAR); }
| '!' { ifndef_ripper($$ = '!'); }
| '~' { ifndef_ripper($$ = '~'); }
| tUPLUS { ifndef_ripper($$ = tUPLUS); }
@@ -1919,63 +1951,18 @@ arg : lhs '=' arg
}
| var_lhs tOP_ASGN arg
{
- /*%%%*/
value_expr($3);
- if ($1) {
- ID vid = $1->nd_vid;
- if ($2 == tOROP) {
- $1->nd_value = $3;
- $$ = NEW_OP_ASGN_OR(gettable(vid), $1);
- if (is_asgn_or_id(vid)) {
- $$->nd_aid = vid;
- }
- }
- else if ($2 == tANDOP) {
- $1->nd_value = $3;
- $$ = NEW_OP_ASGN_AND(gettable(vid), $1);
- }
- else {
- $$ = $1;
- $$->nd_value = NEW_CALL(gettable(vid), $2, NEW_LIST($3));
- }
- }
- else {
- $$ = NEW_BEGIN(0);
- }
- /*%
- $$ = dispatch3(opassign, $1, $2, $3);
- %*/
+ $$ = new_op_assign($1, $2, $3);
}
| var_lhs tOP_ASGN arg modifier_rescue arg
{
/*%%%*/
value_expr($3);
$3 = NEW_RESCUE($3, NEW_RESBODY(0,$5,0), 0);
- if ($1) {
- ID vid = $1->nd_vid;
- if ($2 == tOROP) {
- $1->nd_value = $3;
- $$ = NEW_OP_ASGN_OR(gettable(vid), $1);
- if (is_asgn_or_id(vid)) {
- $$->nd_aid = vid;
- }
- }
- else if ($2 == tANDOP) {
- $1->nd_value = $3;
- $$ = NEW_OP_ASGN_AND(gettable(vid), $1);
- }
- else {
- $$ = $1;
- $$->nd_value = NEW_CALL(gettable(vid), $2, NEW_LIST($3));
- }
- }
- else {
- $$ = NEW_BEGIN(0);
- }
/*%
$3 = dispatch2(rescue_mod, $3, $5);
- $$ = dispatch3(opassign, $1, $2, $3);
%*/
+ $$ = new_op_assign($1, $2, $3);
}
| primary_value '[' opt_call_args rbracket tOP_ASGN arg
{
@@ -2005,75 +1992,37 @@ arg : lhs '=' arg
}
| primary_value '.' tIDENTIFIER tOP_ASGN arg
{
- /*%%%*/
value_expr($5);
- if ($4 == tOROP) {
- $4 = 0;
- }
- else if ($4 == tANDOP) {
- $4 = 1;
- }
- $$ = NEW_OP_ASGN2($1, $3, $4, $5);
- fixpos($$, $1);
- /*%
- $1 = dispatch3(field, $1, ripper_id2sym('.'), $3);
- $$ = dispatch3(opassign, $1, $4, $5);
- %*/
+ $$ = new_attr_op_assign($1, ripper_id2sym('.'), $3, $4, $5);
}
| primary_value '.' tCONSTANT tOP_ASGN arg
{
- /*%%%*/
value_expr($5);
- if ($4 == tOROP) {
- $4 = 0;
- }
- else if ($4 == tANDOP) {
- $4 = 1;
- }
- $$ = NEW_OP_ASGN2($1, $3, $4, $5);
- fixpos($$, $1);
- /*%
- $1 = dispatch3(field, $1, ripper_id2sym('.'), $3);
- $$ = dispatch3(opassign, $1, $4, $5);
- %*/
+ $$ = new_attr_op_assign($1, ripper_id2sym('.'), $3, $4, $5);
}
| primary_value tCOLON2 tIDENTIFIER tOP_ASGN arg
{
- /*%%%*/
value_expr($5);
- if ($4 == tOROP) {
- $4 = 0;
- }
- else if ($4 == tANDOP) {
- $4 = 1;
- }
- $$ = NEW_OP_ASGN2($1, $3, $4, $5);
- fixpos($$, $1);
- /*%
- $1 = dispatch3(field, $1, ripper_intern("::"), $3);
- $$ = dispatch3(opassign, $1, $4, $5);
- %*/
+ $$ = new_attr_op_assign($1, ripper_intern("::"), $3, $4, $5);
}
| primary_value tCOLON2 tCONSTANT tOP_ASGN arg
{
/*%%%*/
- yyerror("constant re-assignment");
- $$ = NEW_BEGIN(0);
+ $$ = NEW_COLON2($1, $3);
+ $$ = new_const_op_assign($$, $4, $5);
/*%
$$ = dispatch2(const_path_field, $1, $3);
$$ = dispatch3(opassign, $$, $4, $5);
- $$ = dispatch1(assign_error, $$);
%*/
}
| tCOLON3 tCONSTANT tOP_ASGN arg
{
/*%%%*/
- yyerror("constant re-assignment");
- $$ = NEW_BEGIN(0);
+ $$ = NEW_COLON3($2);
+ $$ = new_const_op_assign($$, $3, $4);
/*%
$$ = dispatch1(top_const_field, $2);
$$ = dispatch3(opassign, $$, $3, $4);
- $$ = dispatch1(assign_error, $$);
%*/
}
| backref tOP_ASGN arg
@@ -2163,16 +2112,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);
@@ -2289,7 +2229,7 @@ arg : lhs '=' arg
{
/*%%%*/
$$ = match_op($1, $3);
- if (nd_type($1) == NODE_LIT && TYPE($1->nd_lit) == T_REGEXP) {
+ if (nd_type($1) == NODE_LIT && RB_TYPE_P($1->nd_lit, T_REGEXP)) {
$$ = reg_named_capture_assign($1->nd_lit, $$);
}
/*%
@@ -2356,7 +2296,7 @@ arg : lhs '=' arg
{
/*%%%*/
in_defined = 0;
- $$ = NEW_DEFINED($4);
+ $$ = new_defined($4);
/*%
in_defined = 0;
$$ = dispatch1(defined, $4);
@@ -2574,6 +2514,10 @@ args : arg_value
}
;
+mrhs_arg : mrhs
+ | arg_value
+ ;
+
mrhs : args ',' arg_value
{
/*%%%*/
@@ -2619,6 +2563,8 @@ primary : literal
| regexp
| words
| qwords
+ | symbols
+ | qsymbols
| var_ref
| backref
| tFID
@@ -2631,6 +2577,8 @@ primary : literal
}
| k_begin
{
+ $<val>1 = cmdarg_stack;
+ cmdarg_stack = 0;
/*%%%*/
$<num>$ = ruby_sourceline;
/*%
@@ -2639,6 +2587,7 @@ primary : literal
bodystmt
k_end
{
+ cmdarg_stack = $<val>1;
/*%%%*/
if ($3 == NULL) {
$$ = NEW_NIL();
@@ -2654,9 +2603,16 @@ primary : literal
$$ = dispatch1(begin, $3);
%*/
}
+ | tLPAREN_ARG {lex_state = EXPR_ENDARG;} rparen
+ {
+ /*%%%*/
+ $$ = 0;
+ /*%
+ $$ = dispatch1(paren, 0);
+ %*/
+ }
| tLPAREN_ARG expr {lex_state = EXPR_ENDARG;} rparen
{
- rb_warning0("(...) interpreted as grouped expression");
/*%%%*/
$$ = $2;
/*%
@@ -2727,7 +2683,7 @@ primary : literal
| keyword_yield '(' rparen
{
/*%%%*/
- $$ = NEW_YIELD(0, Qfalse);
+ $$ = NEW_YIELD(0);
/*%
$$ = dispatch1(yield, dispatch1(paren, arg_new()));
%*/
@@ -2735,7 +2691,7 @@ primary : literal
| keyword_yield
{
/*%%%*/
- $$ = NEW_YIELD(0, Qfalse);
+ $$ = NEW_YIELD(0);
/*%
$$ = dispatch0(yield0);
%*/
@@ -2744,7 +2700,7 @@ primary : literal
{
/*%%%*/
in_defined = 0;
- $$ = NEW_DEFINED($5);
+ $$ = new_defined($5);
/*%
in_defined = 0;
$$ = dispatch1(defined, $5);
@@ -2766,12 +2722,11 @@ primary : literal
$$ = dispatch2(unary, ripper_intern("not"), Qnil);
%*/
}
- | operation brace_block
+ | fcall brace_block
{
/*%%%*/
- $2->nd_iter = NEW_FCALL($1, 0);
+ $2->nd_iter = $1;
$$ = $2;
- fixpos($2->nd_iter, $2);
/*%
$$ = method_arg(dispatch1(fcall, $1), arg_new());
$$ = method_add_block($$, $2);
@@ -2784,7 +2739,6 @@ primary : literal
block_dup_check($1->nd_args, $2);
$2->nd_iter = $1;
$$ = $2;
- fixpos($$, $1);
/*%
$$ = method_add_block($1, $2);
%*/
@@ -2890,17 +2844,17 @@ primary : literal
m->nd_next = block_append(
NEW_IF(
NEW_NODE(NODE_AND,
- NEW_CALL(NEW_CALL(NEW_DVAR(id), rb_intern("length"), 0),
- rb_intern("=="), one),
- NEW_CALL(NEW_CALL(NEW_DVAR(id), rb_intern("[]"), zero),
+ NEW_CALL(NEW_CALL(NEW_DVAR(id), idLength, 0),
+ idEq, one),
+ NEW_CALL(NEW_CALL(NEW_DVAR(id), idAREF, zero),
rb_intern("kind_of?"), NEW_LIST(NEW_LIT(rb_cArray))),
0),
NEW_DASGN_CURR(id,
- NEW_CALL(NEW_DVAR(id), rb_intern("[]"), zero)),
+ NEW_CALL(NEW_DVAR(id), idAREF, zero)),
0),
node_assign($2, NEW_DVAR(id)));
- args = new_args(m, 0, id, 0, 0);
+ args = new_args(m, 0, id, 0, new_args_tail(0, 0, 0));
}
else {
if (nd_type($2) == NODE_LASGN ||
@@ -2909,11 +2863,11 @@ primary : literal
$2->nd_value = NEW_DVAR(id);
m->nd_plen = 1;
m->nd_next = $2;
- args = new_args(m, 0, 0, 0, 0);
+ args = new_args(m, 0, 0, 0, new_args_tail(0, 0, 0));
}
else {
m->nd_next = node_assign(NEW_MASGN(NEW_LIST($2), 0), NEW_DVAR(id));
- args = new_args(m, 0, id, 0, 0);
+ args = new_args(m, 0, id, 0, new_args_tail(0, 0, 0));
}
}
scope = NEW_NODE(NODE_SCOPE, tbl, $8, args);
@@ -3317,126 +3271,98 @@ f_margs : f_marg_list
}
;
-block_param : f_arg ',' f_block_optarg ',' f_rest_arg opt_f_block_arg
+
+block_args_tail : f_block_kwarg ',' f_kwrest opt_f_block_arg
{
- /*%%%*/
- $$ = new_args($1, $3, $5, 0, $6);
- /*%
- $$ = params_new($1, $3, $5, Qnil, escape_Qundef($6));
- %*/
+ $$ = new_args_tail($1, $3, $4);
}
- | f_arg ',' f_block_optarg ',' f_rest_arg ',' f_arg opt_f_block_arg
+ | f_block_kwarg opt_f_block_arg
+ {
+ $$ = new_args_tail($1, Qnone, $2);
+ }
+ | f_kwrest opt_f_block_arg
+ {
+ $$ = new_args_tail(Qnone, $1, $2);
+ }
+ | f_block_arg
+ {
+ $$ = new_args_tail(Qnone, Qnone, $1);
+ }
+ ;
+
+opt_block_args_tail : ',' block_args_tail
+ {
+ $$ = $2;
+ }
+ | /* none */
+ {
+ $$ = new_args_tail(Qnone, Qnone, Qnone);
+ }
+ ;
+
+block_param : f_arg ',' f_block_optarg ',' f_rest_arg opt_block_args_tail
+ {
+ $$ = new_args($1, $3, $5, Qnone, $6);
+ }
+ | f_arg ',' f_block_optarg ',' f_rest_arg ',' f_arg opt_block_args_tail
{
- /*%%%*/
$$ = new_args($1, $3, $5, $7, $8);
- /*%
- $$ = params_new($1, $3, $5, $7, escape_Qundef($8));
- %*/
}
- | f_arg ',' f_block_optarg opt_f_block_arg
+ | f_arg ',' f_block_optarg opt_block_args_tail
{
- /*%%%*/
- $$ = new_args($1, $3, 0, 0, $4);
- /*%
- $$ = params_new($1, $3, Qnil, Qnil, escape_Qundef($4));
- %*/
+ $$ = new_args($1, $3, Qnone, Qnone, $4);
}
- | f_arg ',' f_block_optarg ',' f_arg opt_f_block_arg
+ | f_arg ',' f_block_optarg ',' f_arg opt_block_args_tail
{
- /*%%%*/
- $$ = new_args($1, $3, 0, $5, $6);
- /*%
- $$ = params_new($1, $3, Qnil, $5, escape_Qundef($6));
- %*/
+ $$ = new_args($1, $3, Qnone, $5, $6);
}
- | f_arg ',' f_rest_arg opt_f_block_arg
+ | f_arg ',' f_rest_arg opt_block_args_tail
{
- /*%%%*/
- $$ = new_args($1, 0, $3, 0, $4);
- /*%
- $$ = params_new($1, Qnil, $3, Qnil, escape_Qundef($4));
- %*/
+ $$ = new_args($1, Qnone, $3, Qnone, $4);
}
| f_arg ','
{
+ $$ = new_args($1, Qnone, 1, Qnone, new_args_tail(Qnone, Qnone, Qnone));
/*%%%*/
- $$ = new_args($1, 0, 1, 0, 0);
/*%
- $$ = params_new($1, Qnil, Qnil, Qnil, Qnil);
dispatch1(excessed_comma, $$);
%*/
}
- | f_arg ',' f_rest_arg ',' f_arg opt_f_block_arg
+ | f_arg ',' f_rest_arg ',' f_arg opt_block_args_tail
{
- /*%%%*/
- $$ = new_args($1, 0, $3, $5, $6);
- /*%
- $$ = params_new($1, Qnil, $3, $5, escape_Qundef($6));
- %*/
+ $$ = new_args($1, Qnone, $3, $5, $6);
}
- | f_arg opt_f_block_arg
+ | f_arg opt_block_args_tail
{
- /*%%%*/
- $$ = new_args($1, 0, 0, 0, $2);
- /*%
- $$ = params_new($1, Qnil,Qnil, Qnil, escape_Qundef($2));
- %*/
+ $$ = new_args($1, Qnone, Qnone, Qnone, $2);
}
- | f_block_optarg ',' f_rest_arg opt_f_block_arg
+ | f_block_optarg ',' f_rest_arg opt_block_args_tail
{
- /*%%%*/
- $$ = new_args(0, $1, $3, 0, $4);
- /*%
- $$ = params_new(Qnil, $1, $3, Qnil, escape_Qundef($4));
- %*/
+ $$ = new_args(Qnone, $1, $3, Qnone, $4);
}
- | f_block_optarg ',' f_rest_arg ',' f_arg opt_f_block_arg
+ | f_block_optarg ',' f_rest_arg ',' f_arg opt_block_args_tail
{
- /*%%%*/
- $$ = new_args(0, $1, $3, $5, $6);
- /*%
- $$ = params_new(Qnil, $1, $3, $5, escape_Qundef($6));
- %*/
+ $$ = new_args(Qnone, $1, $3, $5, $6);
}
- | f_block_optarg opt_f_block_arg
+ | f_block_optarg opt_block_args_tail
{
- /*%%%*/
- $$ = new_args(0, $1, 0, 0, $2);
- /*%
- $$ = params_new(Qnil, $1, Qnil, Qnil,escape_Qundef($2));
- %*/
+ $$ = new_args(Qnone, $1, Qnone, Qnone, $2);
}
- | f_block_optarg ',' f_arg opt_f_block_arg
+ | f_block_optarg ',' f_arg opt_block_args_tail
{
- /*%%%*/
- $$ = new_args(0, $1, 0, $3, $4);
- /*%
- $$ = params_new(Qnil, $1, Qnil, $3, escape_Qundef($4));
- %*/
+ $$ = new_args(Qnone, $1, Qnone, $3, $4);
}
- | f_rest_arg opt_f_block_arg
+ | f_rest_arg opt_block_args_tail
{
- /*%%%*/
- $$ = new_args(0, 0, $1, 0, $2);
- /*%
- $$ = params_new(Qnil, Qnil, $1, Qnil, escape_Qundef($2));
- %*/
+ $$ = new_args(Qnone, Qnone, $1, Qnone, $2);
}
- | f_rest_arg ',' f_arg opt_f_block_arg
+ | f_rest_arg ',' f_arg opt_block_args_tail
{
- /*%%%*/
- $$ = new_args(0, 0, $1, $3, $4);
- /*%
- $$ = params_new(Qnil, Qnil, $1, $3, escape_Qundef($4));
- %*/
+ $$ = new_args(Qnone, Qnone, $1, $3, $4);
}
- | f_block_arg
+ | block_args_tail
{
- /*%%%*/
- $$ = new_args(0, 0, 0, 0, $1);
- /*%
- $$ = params_new(Qnil, Qnil, Qnil, Qnil, $1);
- %*/
+ $$ = new_args(Qnone, Qnone, Qnone, Qnone, $1);
}
;
@@ -3452,7 +3378,7 @@ block_param_def : '|' opt_bv_decl '|'
/*%%%*/
$$ = 0;
/*%
- $$ = blockvar_new(params_new(Qnil,Qnil,Qnil,Qnil,Qnil),
+ $$ = blockvar_new(params_new(Qnil,Qnil,Qnil,Qnil,Qnil,Qnil,Qnil),
escape_Qundef($2));
%*/
}
@@ -3461,7 +3387,7 @@ block_param_def : '|' opt_bv_decl '|'
/*%%%*/
$$ = 0;
/*%
- $$ = blockvar_new(params_new(Qnil,Qnil,Qnil,Qnil,Qnil),
+ $$ = blockvar_new(params_new(Qnil,Qnil,Qnil,Qnil,Qnil,Qnil,Qnil),
Qnil);
%*/
}
@@ -3476,13 +3402,16 @@ block_param_def : '|' opt_bv_decl '|'
;
-opt_bv_decl : none
- | ';' bv_decls
+opt_bv_decl : opt_nl
+ {
+ $$ = 0;
+ }
+ | opt_nl ';' bv_decls opt_nl
{
/*%%%*/
$$ = 0;
/*%
- $$ = $2;
+ $$ = $3;
%*/
}
;
@@ -3498,7 +3427,7 @@ bv_decls : bvar
/*%c%*/
/*%c
{
- rb_ary_push($$, $3);
+ rb_ary_push($1, $3);
}
%*/
;
@@ -3525,34 +3454,33 @@ lambda : {
lpar_beg = ++paren_nest;
}
f_larglist
+ {
+ $<num>$ = ruby_sourceline;
+ }
lambda_body
{
lpar_beg = $<num>2;
/*%%%*/
- $$ = $3;
- $$->nd_body = NEW_SCOPE($3->nd_head, $4);
+ $$ = NEW_LAMBDA($3, $5);
+ nd_set_line($$, $<num>4);
/*%
- $$ = dispatch2(lambda, $3, $4);
+ $$ = dispatch2(lambda, $3, $5);
%*/
dyna_pop($<vars>1);
}
;
-f_larglist : '(' f_args opt_bv_decl rparen
+f_larglist : '(' f_args opt_bv_decl ')'
{
/*%%%*/
- $$ = NEW_LAMBDA($2);
+ $$ = $2;
/*%
$$ = dispatch1(paren, $2);
%*/
}
| f_args
{
- /*%%%*/
- $$ = NEW_LAMBDA($1);
- /*%
$$ = $1;
- %*/
}
;
@@ -3603,53 +3531,80 @@ block_call : command do_block
$$ = method_add_block($1, $2);
%*/
}
- | block_call '.' operation2 opt_paren_args
+ | block_call dot_or_colon operation2 opt_paren_args
{
/*%%%*/
$$ = NEW_CALL($1, $3, $4);
/*%
- $$ = dispatch3(call, $1, ripper_id2sym('.'), $3);
+ $$ = dispatch3(call, $1, $2, $3);
$$ = method_optarg($$, $4);
%*/
}
- | block_call tCOLON2 operation2 opt_paren_args
+ | block_call dot_or_colon operation2 opt_paren_args brace_block
{
/*%%%*/
- $$ = NEW_CALL($1, $3, $4);
+ block_dup_check($4, $5);
+ $5->nd_iter = NEW_CALL($1, $3, $4);
+ $$ = $5;
+ fixpos($$, $1);
/*%
- $$ = dispatch3(call, $1, ripper_intern("::"), $3);
- $$ = method_optarg($$, $4);
+ $$ = dispatch4(command_call, $1, $2, $3, $4);
+ $$ = method_add_block($$, $5);
+ %*/
+ }
+ | block_call dot_or_colon operation2 command_args do_block
+ {
+ /*%%%*/
+ block_dup_check($4, $5);
+ $5->nd_iter = NEW_CALL($1, $3, $4);
+ $$ = $5;
+ fixpos($$, $1);
+ /*%
+ $$ = dispatch4(command_call, $1, $2, $3, $4);
+ $$ = method_add_block($$, $5);
%*/
}
;
-method_call : operation paren_args
+method_call : fcall paren_args
{
/*%%%*/
- $$ = NEW_FCALL($1, $2);
- fixpos($$, $2);
+ $$ = $1;
+ $$->nd_args = $2;
/*%
$$ = method_arg(dispatch1(fcall, $1), $2);
%*/
}
- | primary_value '.' operation2 opt_paren_args
+ | primary_value '.' operation2
{
/*%%%*/
- $$ = NEW_CALL($1, $3, $4);
- fixpos($$, $1);
+ $<num>$ = ruby_sourceline;
+ /*% %*/
+ }
+ opt_paren_args
+ {
+ /*%%%*/
+ $$ = NEW_CALL($1, $3, $5);
+ nd_set_line($$, $<num>4);
/*%
$$ = dispatch3(call, $1, ripper_id2sym('.'), $3);
- $$ = method_optarg($$, $4);
+ $$ = method_optarg($$, $5);
%*/
}
- | primary_value tCOLON2 operation2 paren_args
+ | primary_value tCOLON2 operation2
{
/*%%%*/
- $$ = NEW_CALL($1, $3, $4);
- fixpos($$, $1);
+ $<num>$ = ruby_sourceline;
+ /*% %*/
+ }
+ paren_args
+ {
+ /*%%%*/
+ $$ = NEW_CALL($1, $3, $5);
+ nd_set_line($$, $<num>4);
/*%
$$ = dispatch3(call, $1, ripper_id2sym('.'), $3);
- $$ = method_optarg($$, $4);
+ $$ = method_optarg($$, $5);
%*/
}
| primary_value tCOLON2 operation3
@@ -3660,26 +3615,38 @@ method_call : operation paren_args
$$ = dispatch3(call, $1, ripper_intern("::"), $3);
%*/
}
- | primary_value '.' paren_args
+ | primary_value '.'
{
/*%%%*/
- $$ = NEW_CALL($1, rb_intern("call"), $3);
- fixpos($$, $1);
+ $<num>$ = ruby_sourceline;
+ /*% %*/
+ }
+ paren_args
+ {
+ /*%%%*/
+ $$ = NEW_CALL($1, rb_intern("call"), $4);
+ nd_set_line($$, $<num>3);
/*%
$$ = dispatch3(call, $1, ripper_id2sym('.'),
ripper_intern("call"));
- $$ = method_optarg($$, $3);
+ $$ = method_optarg($$, $4);
%*/
}
- | primary_value tCOLON2 paren_args
+ | primary_value tCOLON2
{
/*%%%*/
- $$ = NEW_CALL($1, rb_intern("call"), $3);
- fixpos($$, $1);
+ $<num>$ = ruby_sourceline;
+ /*% %*/
+ }
+ paren_args
+ {
+ /*%%%*/
+ $$ = NEW_CALL($1, rb_intern("call"), $4);
+ nd_set_line($$, $<num>3);
/*%
$$ = dispatch3(call, $1, ripper_intern("::"),
ripper_intern("call"));
- $$ = method_optarg($$, $3);
+ $$ = method_optarg($$, $4);
%*/
}
| keyword_super paren_args
@@ -4025,6 +3992,45 @@ word : string_content
}
;
+symbols : tSYMBOLS_BEG ' ' tSTRING_END
+ {
+ /*%%%*/
+ $$ = NEW_ZARRAY();
+ /*%
+ $$ = dispatch0(symbols_new);
+ $$ = dispatch1(array, $$);
+ %*/
+ }
+ | tSYMBOLS_BEG symbol_list tSTRING_END
+ {
+ /*%%%*/
+ $$ = $2;
+ /*%
+ $$ = dispatch1(array, $2);
+ %*/
+ }
+ ;
+
+symbol_list : /* none */
+ {
+ /*%%%*/
+ $$ = 0;
+ /*%
+ $$ = dispatch0(symbols_new);
+ %*/
+ }
+ | symbol_list word ' '
+ {
+ /*%%%*/
+ $2 = evstr2dstr($2);
+ nd_set_type($2, NODE_DSYM);
+ $$ = list_append($1, $2);
+ /*%
+ $$ = dispatch2(symbols_add, $1, $2);
+ %*/
+ }
+ ;
+
qwords : tQWORDS_BEG ' ' tSTRING_END
{
/*%%%*/
@@ -4044,6 +4050,25 @@ qwords : tQWORDS_BEG ' ' tSTRING_END
}
;
+qsymbols : tQSYMBOLS_BEG ' ' tSTRING_END
+ {
+ /*%%%*/
+ $$ = NEW_ZARRAY();
+ /*%
+ $$ = dispatch0(qsymbols_new);
+ $$ = dispatch1(array, $$);
+ %*/
+ }
+ | tQSYMBOLS_BEG qsym_list tSTRING_END
+ {
+ /*%%%*/
+ $$ = $2;
+ /*%
+ $$ = dispatch1(array, $2);
+ %*/
+ }
+ ;
+
qword_list : /* none */
{
/*%%%*/
@@ -4062,6 +4087,28 @@ qword_list : /* none */
}
;
+qsym_list : /* none */
+ {
+ /*%%%*/
+ $$ = 0;
+ /*%
+ $$ = dispatch0(qsymbols_new);
+ %*/
+ }
+ | qsym_list tSTRING_CONTENT ' '
+ {
+ /*%%%*/
+ VALUE lit;
+ lit = $2->nd_lit;
+ $2->nd_lit = ID2SYM(rb_intern_str(lit));
+ nd_set_type($2, NODE_LIT);
+ $$ = list_append($1, $2);
+ /*%
+ $$ = dispatch2(qsymbols_add, $1, $2);
+ %*/
+ }
+ ;
+
string_contents : /* none */
{
/*%%%*/
@@ -4164,16 +4211,21 @@ string_content : tSTRING_CONTENT
lex_strterm = 0;
lex_state = EXPR_BEG;
}
- compstmt '}'
+ {
+ $<num>$ = brace_nest;
+ brace_nest = 0;
+ }
+ compstmt tSTRING_DEND
{
cond_stack = $<val>1;
cmdarg_stack = $<val>2;
lex_strterm = $<node>3;
+ brace_nest = $<num>4;
/*%%%*/
- if ($4) $4->flags &= ~NODE_FL_NEWLINE;
- $$ = new_evstr($4);
+ if ($5) $5->flags &= ~NODE_FL_NEWLINE;
+ $$ = new_evstr($5);
/*%
- $$ = dispatch1(string_embexpr, $4);
+ $$ = dispatch1(string_embexpr, $5);
%*/
}
;
@@ -4226,43 +4278,15 @@ dsym : tSYMBEG xstring_contents tSTRING_END
{
lex_state = EXPR_END;
/*%%%*/
- if (!($$ = $2)) {
- $$ = NEW_LIT(ID2SYM(rb_intern("")));
- }
- else {
- VALUE lit;
-
- switch (nd_type($$)) {
- case NODE_DSTR:
- nd_set_type($$, NODE_DSYM);
- break;
- case NODE_STR:
- lit = $$->nd_lit;
- $$->nd_lit = ID2SYM(rb_intern_str(lit));
- nd_set_type($$, NODE_LIT);
- break;
- default:
- $$ = NEW_NODE(NODE_DSYM, Qnil, 1, NEW_LIST($$));
- break;
- }
- }
+ $$ = dsym_node($2);
/*%
$$ = dispatch1(dyna_symbol, $2);
%*/
}
;
-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);
@@ -4272,6 +4296,12 @@ numeric : tINTEGER
}
;
+simple_numeric : tINTEGER
+ | tFLOAT
+ | tRATIONAL
+ | tIMAGINARY
+ ;
+
user_variable : tIDENTIFIER
| tIVAR
| tGVAR
@@ -4344,6 +4374,7 @@ superclass : term
| '<'
{
lex_state = EXPR_BEG;
+ command_start = TRUE;
}
expr_value term
{
@@ -4379,125 +4410,94 @@ f_arglist : '(' f_args rparen
}
;
-f_args : f_arg ',' f_optarg ',' f_rest_arg opt_f_block_arg
+args_tail : f_kwarg ',' f_kwrest opt_f_block_arg
{
- /*%%%*/
- $$ = new_args($1, $3, $5, 0, $6);
- /*%
- $$ = params_new($1, $3, $5, Qnil, escape_Qundef($6));
- %*/
+ $$ = new_args_tail($1, $3, $4);
}
- | f_arg ',' f_optarg ',' f_rest_arg ',' f_arg opt_f_block_arg
+ | f_kwarg opt_f_block_arg
+ {
+ $$ = new_args_tail($1, Qnone, $2);
+ }
+ | f_kwrest opt_f_block_arg
+ {
+ $$ = new_args_tail(Qnone, $1, $2);
+ }
+ | f_block_arg
+ {
+ $$ = new_args_tail(Qnone, Qnone, $1);
+ }
+ ;
+
+opt_args_tail : ',' args_tail
+ {
+ $$ = $2;
+ }
+ | /* none */
+ {
+ $$ = new_args_tail(Qnone, Qnone, Qnone);
+ }
+ ;
+
+f_args : f_arg ',' f_optarg ',' f_rest_arg opt_args_tail
+ {
+ $$ = new_args($1, $3, $5, Qnone, $6);
+ }
+ | f_arg ',' f_optarg ',' f_rest_arg ',' f_arg opt_args_tail
{
- /*%%%*/
$$ = new_args($1, $3, $5, $7, $8);
- /*%
- $$ = params_new($1, $3, $5, $7, escape_Qundef($8));
- %*/
}
- | f_arg ',' f_optarg opt_f_block_arg
+ | f_arg ',' f_optarg opt_args_tail
{
- /*%%%*/
- $$ = new_args($1, $3, 0, 0, $4);
- /*%
- $$ = params_new($1, $3, Qnil, Qnil, escape_Qundef($4));
- %*/
+ $$ = new_args($1, $3, Qnone, Qnone, $4);
}
- | f_arg ',' f_optarg ',' f_arg opt_f_block_arg
+ | f_arg ',' f_optarg ',' f_arg opt_args_tail
{
- /*%%%*/
- $$ = new_args($1, $3, 0, $5, $6);
- /*%
- $$ = params_new($1, $3, Qnil, $5, escape_Qundef($6));
- %*/
+ $$ = new_args($1, $3, Qnone, $5, $6);
}
- | f_arg ',' f_rest_arg opt_f_block_arg
+ | f_arg ',' f_rest_arg opt_args_tail
{
- /*%%%*/
- $$ = new_args($1, 0, $3, 0, $4);
- /*%
- $$ = params_new($1, Qnil, $3, Qnil, escape_Qundef($4));
- %*/
+ $$ = new_args($1, Qnone, $3, Qnone, $4);
}
- | f_arg ',' f_rest_arg ',' f_arg opt_f_block_arg
+ | f_arg ',' f_rest_arg ',' f_arg opt_args_tail
{
- /*%%%*/
- $$ = new_args($1, 0, $3, $5, $6);
- /*%
- $$ = params_new($1, Qnil, $3, $5, escape_Qundef($6));
- %*/
+ $$ = new_args($1, Qnone, $3, $5, $6);
}
- | f_arg opt_f_block_arg
+ | f_arg opt_args_tail
{
- /*%%%*/
- $$ = new_args($1, 0, 0, 0, $2);
- /*%
- $$ = params_new($1, Qnil, Qnil, Qnil,escape_Qundef($2));
- %*/
+ $$ = new_args($1, Qnone, Qnone, Qnone, $2);
}
- | f_optarg ',' f_rest_arg opt_f_block_arg
+ | f_optarg ',' f_rest_arg opt_args_tail
{
- /*%%%*/
- $$ = new_args(0, $1, $3, 0, $4);
- /*%
- $$ = params_new(Qnil, $1, $3, Qnil, escape_Qundef($4));
- %*/
+ $$ = new_args(Qnone, $1, $3, Qnone, $4);
}
- | f_optarg ',' f_rest_arg ',' f_arg opt_f_block_arg
+ | f_optarg ',' f_rest_arg ',' f_arg opt_args_tail
{
- /*%%%*/
- $$ = new_args(0, $1, $3, $5, $6);
- /*%
- $$ = params_new(Qnil, $1, $3, $5, escape_Qundef($6));
- %*/
+ $$ = new_args(Qnone, $1, $3, $5, $6);
}
- | f_optarg opt_f_block_arg
+ | f_optarg opt_args_tail
{
- /*%%%*/
- $$ = new_args(0, $1, 0, 0, $2);
- /*%
- $$ = params_new(Qnil, $1, Qnil, Qnil,escape_Qundef($2));
- %*/
+ $$ = new_args(Qnone, $1, Qnone, Qnone, $2);
}
- | f_optarg ',' f_arg opt_f_block_arg
+ | f_optarg ',' f_arg opt_args_tail
{
- /*%%%*/
- $$ = new_args(0, $1, 0, $3, $4);
- /*%
- $$ = params_new(Qnil, $1, Qnil, $3, escape_Qundef($4));
- %*/
+ $$ = new_args(Qnone, $1, Qnone, $3, $4);
}
- | f_rest_arg opt_f_block_arg
+ | f_rest_arg opt_args_tail
{
- /*%%%*/
- $$ = new_args(0, 0, $1, 0, $2);
- /*%
- $$ = params_new(Qnil, Qnil, $1, Qnil,escape_Qundef($2));
- %*/
+ $$ = new_args(Qnone, Qnone, $1, Qnone, $2);
}
- | f_rest_arg ',' f_arg opt_f_block_arg
+ | f_rest_arg ',' f_arg opt_args_tail
{
- /*%%%*/
- $$ = new_args(0, 0, $1, $3, $4);
- /*%
- $$ = params_new(Qnil, Qnil, $1, $3, escape_Qundef($4));
- %*/
+ $$ = new_args(Qnone, Qnone, $1, $3, $4);
}
- | f_block_arg
+ | args_tail
{
- /*%%%*/
- $$ = new_args(0, 0, 0, 0, $1);
- /*%
- $$ = params_new(Qnil, Qnil, Qnil, Qnil, $1);
- %*/
+ $$ = new_args(Qnone, Qnone, Qnone, Qnone, $1);
}
| /* none */
{
- /*%%%*/
- $$ = new_args(0, 0, 0, 0, 0);
- /*%
- $$ = params_new(Qnil, Qnil, Qnil, Qnil, Qnil);
- %*/
+ $$ = new_args_tail(Qnone, Qnone, Qnone);
+ $$ = new_args(Qnone, Qnone, Qnone, Qnone, $$);
}
;
@@ -4595,9 +4595,121 @@ f_arg : f_arg_item
}
;
-f_opt : tIDENTIFIER '=' 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, $$);
+ /*%
+ $$ = rb_assoc_new($$, $2);
+ %*/
+ }
+ | f_label
+ {
+ $$ = assignable($1, (NODE *)-1);
+ /*%%%*/
+ $$ = NEW_KW_ARG(0, $$);
+ /*%
+ $$ = rb_assoc_new($$, 0);
+ %*/
+ }
+ ;
+
+f_block_kw : f_label primary_value
+ {
+ $$ = assignable($1, $2);
+ /*%%%*/
+ $$ = NEW_KW_ARG(0, $$);
+ /*%
+ $$ = rb_assoc_new($$, $2);
+ %*/
+ }
+ | f_label
+ {
+ $$ = assignable($1, (NODE *)-1);
+ /*%%%*/
+ $$ = NEW_KW_ARG(0, $$);
+ /*%
+ $$ = rb_assoc_new($$, 0);
+ %*/
+ }
+ ;
+
+f_block_kwarg : f_block_kw
+ {
+ /*%%%*/
+ $$ = $1;
+ /*%
+ $$ = rb_ary_new3(1, $1);
+ %*/
+ }
+ | f_block_kwarg ',' f_block_kw
+ {
+ /*%%%*/
+ NODE *kws = $1;
+
+ while (kws->nd_next) {
+ kws = kws->nd_next;
+ }
+ kws->nd_next = $3;
+ $$ = $1;
+ /*%
+ $$ = rb_ary_push($1, $3);
+ %*/
+ }
+ ;
+
+
+f_kwarg : f_kw
+ {
+ /*%%%*/
+ $$ = $1;
+ /*%
+ $$ = rb_ary_new3(1, $1);
+ %*/
+ }
+ | f_kwarg ',' f_kw
+ {
+ /*%%%*/
+ NODE *kws = $1;
+
+ while (kws->nd_next) {
+ kws = kws->nd_next;
+ }
+ kws->nd_next = $3;
+ $$ = $1;
+ /*%
+ $$ = rb_ary_push($1, $3);
+ %*/
+ }
+ ;
+
+kwrest_mark : tPOW
+ | tDSTAR
+ ;
+
+f_kwrest : kwrest_mark tIDENTIFIER
+ {
+ shadowing_lvar(get_id($2));
+ $$ = $2;
+ }
+ | kwrest_mark
+ {
+ $$ = internal_id();
+ }
+ ;
+
+f_opt : f_norm_arg '=' arg_value
+ {
+ arg_var(get_id($1));
$$ = assignable($1, $3);
/*%%%*/
$$ = NEW_OPT_ARG(0, $$);
@@ -4607,9 +4719,9 @@ f_opt : tIDENTIFIER '=' arg_value
}
;
-f_block_opt : tIDENTIFIER '=' primary_value
+f_block_opt : f_norm_arg '=' primary_value
{
- arg_var(formal_argument(get_id($1)));
+ arg_var(get_id($1));
$$ = assignable($1, $3);
/*%%%*/
$$ = NEW_OPT_ARG(0, $$);
@@ -4813,6 +4925,16 @@ assoc : arg_value tASSOC arg_value
$$ = dispatch2(assoc_new, $1, $2);
%*/
}
+ | tDSTAR arg_value
+ {
+ /*%%%*/
+ $$ = list_append(NEW_LIST(0), $2);
+ /*%
+ $$ = dispatch1(assoc_splat, $2);
+ %*/
+ }
+ ;
+
;
operation : tIDENTIFIER
@@ -4892,22 +5014,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))
@@ -5000,11 +5125,11 @@ ripper_dispatch_delayed_token(struct parser_params *parser, int t)
# define SIGN_EXTEND_CHAR(c) ((((unsigned char)(c)) ^ 128) - 128)
#endif
-#define parser_encoding_name() (parser->enc->name)
-#define parser_mbclen() mbclen((lex_p-1),lex_pend,parser->enc)
-#define parser_precise_mbclen() rb_enc_precise_mbclen((lex_p-1),lex_pend,parser->enc)
-#define is_identchar(p,e,enc) (rb_enc_isalnum(*(p),(enc)) || (*(p)) == '_' || !ISASCII(*(p)))
-#define parser_is_identchar() (!parser->eofp && is_identchar((lex_p-1),lex_pend,parser->enc))
+#define parser_encoding_name() (current_enc->name)
+#define parser_mbclen() mbclen((lex_p-1),lex_pend,current_enc)
+#define parser_precise_mbclen() rb_enc_precise_mbclen((lex_p-1),lex_pend,current_enc)
+#define is_identchar(p,e,enc) (rb_enc_isalnum((unsigned char)(*(p)),(enc)) || (*(p)) == '_' || !ISASCII(*(p)))
+#define parser_is_identchar() (!parser->eofp && is_identchar((lex_p-1),lex_pend,current_enc))
#define parser_isascii() ISASCII(*(lex_p-1))
@@ -5148,14 +5273,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 (TYPE(hash) == T_HASH) {
- VALUE fname = rb_external_str_new_with_enc(f, strlen(f), rb_filesystem_encoding());
+ if (RB_TYPE_P(hash, T_HASH)) {
VALUE lines = rb_ary_new();
rb_hash_aset(hash, fname, lines);
return lines;
@@ -5165,15 +5289,14 @@ 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;
+ RBASIC_CLEAR_CLASS(lines);
+ for (i = 0; i < n; i++) RARRAY_ASET(lines, i, Qnil);
RARRAY(lines)->as.heap.len = n;
rb_hash_aset(coverages, fname, lines);
return lines;
@@ -5188,14 +5311,14 @@ e_option_supplied(struct parser_params *parser)
}
static VALUE
-yycompile0(VALUE arg, int tracing)
+yycompile0(VALUE arg)
{
int n;
NODE *tree;
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;
@@ -5205,16 +5328,29 @@ yycompile0(VALUE arg, int tracing)
}
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;
#ifndef RIPPER
parser->parser_token_info_enabled = !compile_for_eval && RTEST(ruby_verbose);
#endif
+#ifndef RIPPER
+ if (RUBY_DTRACE_PARSE_BEGIN_ENABLED()) {
+ RUBY_DTRACE_PARSE_BEGIN(parser->parser_ruby_sourcefile,
+ parser->parser_ruby_sourceline);
+ }
+#endif
n = yyparse((void*)parser);
+#ifndef RIPPER
+ if (RUBY_DTRACE_PARSE_END_ENABLED()) {
+ RUBY_DTRACE_PARSE_END(parser->parser_ruby_sourcefile,
+ parser->parser_ruby_sourceline);
+ }
+#endif
ruby_debug_lines = 0;
ruby_coverage = 0;
compile_for_eval = 0;
@@ -5236,11 +5372,12 @@ yycompile0(VALUE arg, int tracing)
}
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 *)ruby_suppress_tracing(yycompile0, (VALUE)parser, TRUE);
+ return (NODE *)rb_suppress_tracing(yycompile0, (VALUE)parser);
}
#endif /* !RIPPER */
@@ -5282,7 +5419,7 @@ lex_getline(struct parser_params *parser)
must_be_ascii_compatible(line);
#ifndef RIPPER
if (ruby_debug_lines) {
- rb_enc_associate(line, parser->enc);
+ rb_enc_associate(line, current_enc);
rb_ary_push(ruby_debug_lines, line);
}
if (ruby_coverage) {
@@ -5298,11 +5435,10 @@ 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;
- volatile VALUE tmp;
TypedData_Get_Struct(vparser, struct parser_params, &parser_data_type, parser);
lex_gets = lex_get_str;
@@ -5311,8 +5447,8 @@ parser_compile_string(volatile VALUE vparser, const char *f, VALUE s, int line)
lex_pbeg = lex_p = lex_pend = 0;
compile_for_eval = rb_parse_in_eval();
- node = yycompile(parser, f, line);
- tmp = vparser; /* prohibit tail call optimization */
+ node = yycompile(parser, fname, line);
+ RB_GC_GUARD(vparser); /* prohibit tail call optimization */
return node;
}
@@ -5321,12 +5457,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);
}
@@ -5335,14 +5477,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
@@ -5362,8 +5504,13 @@ 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;
- volatile VALUE tmp;
NODE *node;
TypedData_Get_Struct(vparser, struct parser_params, &parser_data_type, parser);
@@ -5372,8 +5519,8 @@ 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);
- tmp = vparser; /* prohibit tail call optimization */
+ node = yycompile(parser, fname, start);
+ RB_GC_GUARD(vparser); /* prohibit tail call optimization */
return node;
}
@@ -5442,7 +5589,7 @@ parser_nextc(struct parser_params *parser)
if (parser->tokp < lex_pend) {
if (NIL_P(parser->delayed)) {
parser->delayed = rb_str_buf_new(1024);
- rb_enc_associate(parser->delayed, parser->enc);
+ rb_enc_associate(parser->delayed, current_enc);
rb_str_buf_cat(parser->delayed,
parser->tokp, lex_pend - parser->tokp);
parser->delayed_line = ruby_sourceline;
@@ -5467,9 +5614,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;
@@ -5496,6 +5649,7 @@ static char*
parser_newtok(struct parser_params *parser)
{
tokidx = 0;
+ tokline = ruby_sourceline;
if (!tokenbuf) {
toksiz = 60;
tokenbuf = ALLOC_N(char, 60);
@@ -5545,6 +5699,7 @@ parser_tok_hex(struct parser_params *parser, size_t *numlen)
#define tokcopy(n) memcpy(tokspace(n), lex_p - (n), (n))
+/* return value is for ?\u3042 */
static int
parser_tokadd_utf8(struct parser_params *parser, rb_encoding **encp,
int string_literal, int symbol_literal, int regexp_literal)
@@ -5579,7 +5734,7 @@ parser_tokadd_utf8(struct parser_params *parser, rb_encoding **encp,
tokcopy((int)numlen);
}
else if (codepoint >= 0x80) {
- *encp = UTF8_ENC();
+ *encp = rb_utf8_encoding();
if (string_literal) tokaddmbc(codepoint, *encp);
}
else if (string_literal) {
@@ -5606,7 +5761,7 @@ parser_tokadd_utf8(struct parser_params *parser, rb_encoding **encp,
tokcopy(4);
}
else if (codepoint >= 0x80) {
- *encp = UTF8_ENC();
+ *encp = rb_utf8_encoding();
if (string_literal) tokaddmbc(codepoint, *encp);
}
else if (string_literal) {
@@ -5830,9 +5985,7 @@ parser_regx_options(struct parser_params *parser)
static void
dispose_string(VALUE str)
{
- /* TODO: should use another API? */
- if (RBASIC(str)->flags & RSTRING_NOEMBED)
- xfree(RSTRING_PTR(str));
+ rb_str_free(str);
rb_gc_force_recycle(str);
}
@@ -5852,6 +6005,19 @@ parser_tokadd_mbchar(struct parser_params *parser, int c)
#define tokadd_mbchar(c) parser_tokadd_mbchar(parser, (c))
+static inline int
+simple_re_meta(int c)
+{
+ switch (c) {
+ case '$': case '*': case '+': case '.':
+ case '?': case '^': case '|':
+ case ')': case ']': case '}': case '>':
+ return TRUE;
+ default:
+ return FALSE;
+ }
+}
+
static int
parser_tokadd_string(struct parser_params *parser,
int func, int term, int paren, long *nest,
@@ -5932,6 +6098,10 @@ parser_tokadd_string(struct parser_params *parser,
goto non_ascii;
}
if (func & STR_FUNC_REGEXP) {
+ if (c == term && !simple_re_meta(c)) {
+ tokadd(c);
+ continue;
+ }
pushback(c);
if ((c = tokadd_escape(&enc)) < 0)
return -1;
@@ -5970,7 +6140,7 @@ parser_tokadd_string(struct parser_params *parser,
break;
}
if (c & 0x80) {
- has_nonascii = 1;
+ has_nonascii = 1;
if (enc != *encp) {
mixed_error(enc, *encp);
continue;
@@ -6004,6 +6174,70 @@ ripper_flush_string_content(struct parser_params *parser, rb_encoding *enc)
#define flush_string_content(enc) ((void)(enc))
#endif
+RUBY_FUNC_EXPORTED const unsigned int ruby_global_name_punct_bits[(0x7e - 0x20 + 31) / 32];
+/* this can be shared with ripper, since it's independent from struct
+ * parser_params. */
+#ifndef RIPPER
+#define BIT(c, idx) (((c) / 32 - 1 == idx) ? (1U << ((c) % 32)) : 0)
+#define SPECIAL_PUNCT(idx) ( \
+ BIT('~', idx) | BIT('*', idx) | BIT('$', idx) | BIT('?', idx) | \
+ BIT('!', idx) | BIT('@', idx) | BIT('/', idx) | BIT('\\', idx) | \
+ BIT(';', idx) | BIT(',', idx) | BIT('.', idx) | BIT('=', idx) | \
+ BIT(':', idx) | BIT('<', idx) | BIT('>', idx) | BIT('\"', idx) | \
+ BIT('&', idx) | BIT('`', idx) | BIT('\'', idx) | BIT('+', idx) | \
+ BIT('0', idx))
+const unsigned int ruby_global_name_punct_bits[] = {
+ SPECIAL_PUNCT(0),
+ SPECIAL_PUNCT(1),
+ SPECIAL_PUNCT(2),
+};
+#undef BIT
+#undef SPECIAL_PUNCT
+#endif
+
+static inline int
+is_global_name_punct(const int c)
+{
+ if (c <= 0x20 || 0x7e < c) return 0;
+ return (ruby_global_name_punct_bits[(c - 0x20) / 32] >> (c % 32)) & 1;
+}
+
+static int
+parser_peek_variable_name(struct parser_params *parser)
+{
+ int c;
+ const char *p = lex_p;
+
+ if (p + 1 >= lex_pend) return 0;
+ c = *p++;
+ switch (c) {
+ case '$':
+ if ((c = *p) == '-') {
+ if (++p >= lex_pend) return 0;
+ c = *p;
+ }
+ else if (is_global_name_punct(c) || ISDIGIT(c)) {
+ return tSTRING_DVAR;
+ }
+ break;
+ case '@':
+ if ((c = *p) == '@') {
+ if (++p >= lex_pend) return 0;
+ c = *p;
+ }
+ break;
+ case '{':
+ lex_p = p;
+ command_start = TRUE;
+ return tSTRING_DBEG;
+ default:
+ return 0;
+ }
+ if (!ISASCII(c) || c == '_' || ISALPHA(c))
+ return tSTRING_DVAR;
+ return 0;
+}
+
static int
parser_parse_string(struct parser_params *parser, NODE *quote)
{
@@ -6011,7 +6245,7 @@ parser_parse_string(struct parser_params *parser, NODE *quote)
int term = nd_term(quote);
int paren = nd_paren(quote);
int c, space = 0;
- rb_encoding *enc = parser->enc;
+ rb_encoding *enc = current_enc;
if (func == -1) return tSTRING_END;
c = nextc();
@@ -6034,15 +6268,10 @@ parser_parse_string(struct parser_params *parser, NODE *quote)
}
newtok();
if ((func & STR_FUNC_EXPAND) && c == '#') {
- switch (c = nextc()) {
- case '$':
- case '@':
- pushback(c);
- return tSTRING_DVAR;
- case '{':
- return tSTRING_DBEG;
- }
+ int t = parser_peek_variable_name(parser);
+ if (t) return t;
tokadd('#');
+ c = nextc();
}
pushback(c);
if (tokadd_string(func, term, paren, &quote->nd_nest,
@@ -6135,6 +6364,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);
@@ -6158,10 +6388,69 @@ 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);
+ 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)
@@ -6184,7 +6473,7 @@ parser_here_document(struct parser_params *parser, NODE *here)
const char *eos, *p, *pend;
long len;
VALUE str = 0;
- rb_encoding *enc = parser->enc;
+ rb_encoding *enc = current_enc;
eos = RSTRING_PTR(here->nd_lit);
len = RSTRING_LEN(here->nd_lit) - 1;
@@ -6209,7 +6498,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)) {
@@ -6249,15 +6537,10 @@ parser_here_document(struct parser_params *parser, NODE *here)
/* int mb = ENC_CODERANGE_7BIT, *mbp = &mb;*/
newtok();
if (c == '#') {
- switch (c = nextc()) {
- case '$':
- case '@':
- pushback(c);
- return tSTRING_DVAR;
- case '{':
- return tSTRING_DBEG;
- }
+ int t = parser_peek_variable_name(parser);
+ if (t) return t;
tokadd('#');
+ c = nextc();
}
do {
pushback(c);
@@ -6357,10 +6640,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
@@ -6621,24 +6904,23 @@ parser_prepare(struct parser_params *parser)
parser->enc = rb_enc_get(lex_lastline);
}
-#define IS_ARG() (lex_state == EXPR_ARG || lex_state == EXPR_CMDARG)
-#define IS_END() (lex_state == EXPR_END || lex_state == EXPR_ENDARG || lex_state == EXPR_ENDFN)
-#define IS_BEG() (lex_state == EXPR_BEG || lex_state == EXPR_MID || lex_state == EXPR_VALUE || lex_state == EXPR_CLASS)
+#define IS_ARG() IS_lex_state(EXPR_ARG_ANY)
+#define IS_END() IS_lex_state(EXPR_END_ANY)
+#define IS_BEG() IS_lex_state(EXPR_BEG_ANY)
#define IS_SPCARG(c) (IS_ARG() && space_seen && !ISSPACE(c))
-#define IS_LABEL_POSSIBLE() ((lex_state == EXPR_BEG && !cmd_state) || IS_ARG())
+#define IS_LABEL_POSSIBLE() ((IS_lex_state(EXPR_BEG | EXPR_ENDFN) && !cmd_state) || IS_ARG())
#define IS_LABEL_SUFFIX(n) (peek_n(':',(n)) && !peek_n(':', (n)+1))
+#define IS_AFTER_OPERATOR() IS_lex_state(EXPR_FNAME | EXPR_DOT)
#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))
#endif
#define warn_balanced(op, syn) ((void) \
- (last_state != EXPR_CLASS && last_state != EXPR_DOT && \
- last_state != EXPR_FNAME && last_state != EXPR_ENDFN && \
- last_state != EXPR_ENDARG && \
+ (!IS_lex_state_for(last_state, EXPR_CLASS|EXPR_DOT|EXPR_FNAME|EXPR_ENDFN|EXPR_ENDARG) && \
space_seen && !ISSPACE(c) && \
(ambiguous_operator(op, syn), 0)))
@@ -6719,12 +7001,7 @@ parser_yylex(struct parser_params *parser)
#endif
/* fall through */
case '\n':
- switch (lex_state) {
- case EXPR_BEG:
- case EXPR_FNAME:
- case EXPR_DOT:
- case EXPR_CLASS:
- case EXPR_VALUE:
+ if (IS_lex_state(EXPR_BEG | EXPR_VALUE | EXPR_CLASS | EXPR_FNAME | EXPR_DOT)) {
#ifdef RIPPER
if (!fallthru) {
ripper_dispatch_scan_event(parser, tIGNORED_NL);
@@ -6732,8 +7009,6 @@ parser_yylex(struct parser_params *parser)
fallthru = FALSE;
#endif
goto retry;
- default:
- break;
}
while ((c = nextc())) {
switch (c) {
@@ -6774,7 +7049,17 @@ parser_yylex(struct parser_params *parser)
return tOP_ASGN;
}
pushback(c);
- c = tPOW;
+ if (IS_SPCARG(c)) {
+ rb_warning0("`**' interpreted as argument prefix");
+ c = tDSTAR;
+ }
+ else if (IS_BEG()) {
+ c = tDSTAR;
+ }
+ else {
+ warn_balanced("**", "argument prefix");
+ c = tPOW;
+ }
}
else {
if (c == '=') {
@@ -6795,17 +7080,12 @@ parser_yylex(struct parser_params *parser)
c = '*';
}
}
- switch (lex_state) {
- case EXPR_FNAME: case EXPR_DOT:
- lex_state = EXPR_ARG; break;
- default:
- lex_state = EXPR_BEG; break;
- }
+ lex_state = IS_AFTER_OPERATOR() ? EXPR_ARG : EXPR_BEG;
return c;
case '!':
c = nextc();
- if (lex_state == EXPR_FNAME || lex_state == EXPR_DOT) {
+ if (IS_AFTER_OPERATOR()) {
lex_state = EXPR_ARG;
if (c == '@') {
return '!';
@@ -6860,12 +7140,7 @@ parser_yylex(struct parser_params *parser)
}
}
- switch (lex_state) {
- case EXPR_FNAME: case EXPR_DOT:
- lex_state = EXPR_ARG; break;
- default:
- lex_state = EXPR_BEG; break;
- }
+ lex_state = IS_AFTER_OPERATOR() ? EXPR_ARG : EXPR_BEG;
if ((c = nextc()) == '=') {
if ((c = nextc()) == '=') {
return tEQQ;
@@ -6886,18 +7161,19 @@ parser_yylex(struct parser_params *parser)
last_state = lex_state;
c = nextc();
if (c == '<' &&
- lex_state != EXPR_DOT &&
- lex_state != EXPR_CLASS &&
+ !IS_lex_state(EXPR_DOT | EXPR_CLASS) &&
!IS_END() &&
(!IS_ARG() || space_seen)) {
int token = heredoc_identifier();
if (token) return token;
}
- switch (lex_state) {
- case EXPR_FNAME: case EXPR_DOT:
- lex_state = EXPR_ARG; break;
- default:
- lex_state = EXPR_BEG; break;
+ if (IS_AFTER_OPERATOR()) {
+ lex_state = EXPR_ARG;
+ }
+ else {
+ if (IS_lex_state(EXPR_CLASS))
+ command_start = TRUE;
+ lex_state = EXPR_BEG;
}
if (c == '=') {
if ((c = nextc()) == '>') {
@@ -6920,12 +7196,7 @@ parser_yylex(struct parser_params *parser)
return '<';
case '>':
- switch (lex_state) {
- case EXPR_FNAME: case EXPR_DOT:
- lex_state = EXPR_ARG; break;
- default:
- lex_state = EXPR_BEG; break;
- }
+ lex_state = IS_AFTER_OPERATOR() ? EXPR_ARG : EXPR_BEG;
if ((c = nextc()) == '=') {
return tGEQ;
}
@@ -6946,11 +7217,11 @@ parser_yylex(struct parser_params *parser)
return tSTRING_BEG;
case '`':
- if (lex_state == EXPR_FNAME) {
+ if (IS_lex_state(EXPR_FNAME)) {
lex_state = EXPR_ENDFN;
return c;
}
- if (lex_state == EXPR_DOT) {
+ if (IS_lex_state(EXPR_DOT)) {
if (cmd_state)
lex_state = EXPR_CMDARG;
else
@@ -6974,7 +7245,7 @@ parser_yylex(struct parser_params *parser)
compile_error(PARSER_ARG "incomplete character syntax");
return 0;
}
- if (rb_enc_isspace(c, parser->enc)) {
+ if (rb_enc_isspace(c, current_enc)) {
if (!IS_ARG()) {
int c2 = 0;
switch (c) {
@@ -7007,12 +7278,12 @@ parser_yylex(struct parser_params *parser)
return '?';
}
newtok();
- enc = parser->enc;
+ enc = current_enc;
if (!parser_isascii()) {
if (tokadd_mbchar(c) == -1) return 0;
}
- else if ((rb_enc_isalnum(c, parser->enc) || c == '_') &&
- lex_p < lex_pend && is_identchar(lex_p, lex_pend, parser->enc)) {
+ 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 == '\\') {
@@ -7071,12 +7342,7 @@ parser_yylex(struct parser_params *parser)
warn_balanced("&", "argument prefix");
c = '&';
}
- switch (lex_state) {
- case EXPR_FNAME: case EXPR_DOT:
- lex_state = EXPR_ARG; break;
- default:
- lex_state = EXPR_BEG;
- }
+ lex_state = IS_AFTER_OPERATOR() ? EXPR_ARG : EXPR_BEG;
return c;
case '|':
@@ -7095,18 +7361,13 @@ parser_yylex(struct parser_params *parser)
lex_state = EXPR_BEG;
return tOP_ASGN;
}
- if (lex_state == EXPR_FNAME || lex_state == EXPR_DOT) {
- lex_state = EXPR_ARG;
- }
- else {
- lex_state = EXPR_BEG;
- }
+ lex_state = IS_AFTER_OPERATOR() ? EXPR_ARG : EXPR_BEG;
pushback(c);
return '|';
case '+':
c = nextc();
- if (lex_state == EXPR_FNAME || lex_state == EXPR_DOT) {
+ if (IS_AFTER_OPERATOR()) {
lex_state = EXPR_ARG;
if (c == '@') {
return tUPLUS;
@@ -7135,7 +7396,7 @@ parser_yylex(struct parser_params *parser)
case '-':
c = nextc();
- if (lex_state == EXPR_FNAME || lex_state == EXPR_DOT) {
+ if (IS_AFTER_OPERATOR()) {
lex_state = EXPR_ARG;
if (c == '@') {
return tUMINUS;
@@ -7149,7 +7410,7 @@ parser_yylex(struct parser_params *parser)
return tOP_ASGN;
}
if (c == '>') {
- lex_state = EXPR_ARG;
+ lex_state = EXPR_ENDFN;
return tLAMBDA;
}
if (IS_BEG() || (IS_SPCARG(c) && arg_ambiguous())) {
@@ -7186,6 +7447,7 @@ parser_yylex(struct parser_params *parser)
case '5': case '6': case '7': case '8': case '9':
{
int is_float, seen_point, seen_e, nondigit;
+ int suffix;
is_float = seen_point = seen_e = nondigit = 0;
lex_state = EXPR_END;
@@ -7219,8 +7481,8 @@ parser_yylex(struct parser_params *parser)
no_digits();
}
else if (nondigit) goto trailing_uc;
- set_yylval_literal(rb_cstr_to_inum(tok(), 16, FALSE));
- return tINTEGER;
+ 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 */
@@ -7243,8 +7505,8 @@ parser_yylex(struct parser_params *parser)
no_digits();
}
else if (nondigit) goto trailing_uc;
- set_yylval_literal(rb_cstr_to_inum(tok(), 2, FALSE));
- return tINTEGER;
+ 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 */
@@ -7267,8 +7529,8 @@ parser_yylex(struct parser_params *parser)
no_digits();
}
else if (nondigit) goto trailing_uc;
- set_yylval_literal(rb_cstr_to_inum(tok(), 10, FALSE));
- return tINTEGER;
+ suffix = number_literal_suffix(NUM_SUFFIX_ALL);
+ return set_integer_literal(rb_cstr_to_inum(tok(), 10, FALSE), suffix);
}
if (c == '_') {
/* 0_0 */
@@ -7299,8 +7561,8 @@ parser_yylex(struct parser_params *parser)
pushback(c);
tokfix();
if (nondigit) goto trailing_uc;
- set_yylval_literal(rb_cstr_to_inum(tok(), 8, FALSE));
- return tINTEGER;
+ suffix = number_literal_suffix(NUM_SUFFIX_ALL);
+ return set_integer_literal(rb_cstr_to_inum(tok(), 8, FALSE), suffix);
}
if (nondigit) {
pushback(c);
@@ -7316,8 +7578,8 @@ parser_yylex(struct parser_params *parser)
}
else {
pushback(c);
- set_yylval_literal(INT2FIX(0));
- return tINTEGER;
+ suffix = number_literal_suffix(NUM_SUFFIX_ALL);
+ return set_integer_literal(INT2FIX(0), suffix);
}
}
@@ -7342,10 +7604,10 @@ parser_yylex(struct parser_params *parser)
}
c = c0;
}
+ seen_point = toklen();
tokadd('.');
tokadd(c);
is_float++;
- seen_point++;
nondigit = 0;
break;
@@ -7359,14 +7621,18 @@ parser_yylex(struct parser_params *parser)
if (seen_e) {
goto decode_num;
}
- tokadd(c);
- seen_e++;
- is_float++;
nondigit = c;
c = nextc();
- if (c != '-' && c != '+') continue;
+ if (c != '-' && c != '+' && !ISDIGIT(c)) {
+ pushback(c);
+ nondigit = 0;
+ goto decode_num;
+ }
+ tokadd(nondigit);
+ seen_e++;
+ is_float++;
tokadd(c);
- nondigit = c;
+ nondigit = (c == '-' || c == '+') ? c : 0;
break;
case '_': /* `_' in number just ignored */
@@ -7390,16 +7656,30 @@ parser_yylex(struct parser_params *parser)
}
tokfix();
if (is_float) {
- double d = strtod(tok(), 0);
- if (errno == ERANGE) {
- rb_warningS("Float %s out of range", tok());
- errno = 0;
+ int type = tFLOAT;
+ VALUE v;
+
+ suffix = number_literal_suffix(seen_e ? NUM_SUFFIX_I : NUM_SUFFIX_ALL);
+ if (suffix & NUM_SUFFIX_R) {
+ char *point = &tok()[seen_point];
+ size_t fraclen = toklen()-seen_point-1;
+ type = tRATIONAL;
+ memmove(point, point+1, fraclen+1);
+ v = rb_cstr_to_inum(tok(), 10, FALSE);
+ v = rb_rational_new(v, rb_int_positive_pow(10, fraclen));
+ }
+ else {
+ double d = strtod(tok(), 0);
+ if (errno == ERANGE) {
+ rb_warningS("Float %s out of range", tok());
+ errno = 0;
+ }
+ v = DBL2NUM(d);
}
- set_yylval_literal(DBL2NUM(d));
- return tFLOAT;
+ return set_number_literal(v, type, suffix);
}
- set_yylval_literal(rb_cstr_to_inum(tok(), 10, FALSE));
- return tINTEGER;
+ suffix = number_literal_suffix(NUM_SUFFIX_ALL);
+ return set_integer_literal(rb_cstr_to_inum(tok(), 10, FALSE), suffix);
}
case ')':
@@ -7412,12 +7692,15 @@ parser_yylex(struct parser_params *parser)
lex_state = EXPR_ENDFN;
else
lex_state = EXPR_ENDARG;
+ if (c == '}') {
+ if (!brace_nest--) c = tSTRING_DEND;
+ }
return c;
case ':':
c = nextc();
if (c == ':') {
- if (IS_BEG() || lex_state == EXPR_CLASS || IS_SPCARG(-1)) {
+ if (IS_BEG() || IS_lex_state(EXPR_CLASS) || IS_SPCARG(-1)) {
lex_state = EXPR_BEG;
return tCOLON3;
}
@@ -7445,7 +7728,7 @@ parser_yylex(struct parser_params *parser)
return tSYMBEG;
case '/':
- if (IS_BEG()) {
+ if (IS_lex_state(EXPR_BEG_ANY)) {
lex_strterm = NEW_STRTERM(str_regexp, '/', 0);
return tREGEXP_BEG;
}
@@ -7460,12 +7743,7 @@ parser_yylex(struct parser_params *parser)
lex_strterm = NEW_STRTERM(str_regexp, '/', 0);
return tREGEXP_BEG;
}
- switch (lex_state) {
- case EXPR_FNAME: case EXPR_DOT:
- lex_state = EXPR_ARG; break;
- default:
- lex_state = EXPR_BEG; break;
- }
+ lex_state = IS_AFTER_OPERATOR() ? EXPR_ARG : EXPR_BEG;
warn_balanced("/", "regexp literal");
return '/';
@@ -7475,12 +7753,7 @@ parser_yylex(struct parser_params *parser)
lex_state = EXPR_BEG;
return tOP_ASGN;
}
- switch (lex_state) {
- case EXPR_FNAME: case EXPR_DOT:
- lex_state = EXPR_ARG; break;
- default:
- lex_state = EXPR_BEG; break;
- }
+ lex_state = IS_AFTER_OPERATOR() ? EXPR_ARG : EXPR_BEG;
pushback(c);
return '^';
@@ -7494,7 +7767,7 @@ parser_yylex(struct parser_params *parser)
return ',';
case '~':
- if (lex_state == EXPR_FNAME || lex_state == EXPR_DOT) {
+ if (IS_AFTER_OPERATOR()) {
if ((c = nextc()) != '@') {
pushback(c);
}
@@ -7520,7 +7793,7 @@ parser_yylex(struct parser_params *parser)
case '[':
paren_nest++;
- if (lex_state == EXPR_FNAME || lex_state == EXPR_DOT) {
+ if (IS_AFTER_OPERATOR()) {
lex_state = EXPR_ARG;
if ((c = nextc()) == ']') {
if ((c = nextc()) == '=') {
@@ -7544,6 +7817,7 @@ parser_yylex(struct parser_params *parser)
return c;
case '{':
+ ++brace_nest;
if (lpar_beg && lpar_beg == paren_nest) {
lex_state = EXPR_BEG;
lpar_beg = 0;
@@ -7552,9 +7826,9 @@ parser_yylex(struct parser_params *parser)
CMDARG_PUSH(0);
return tLAMBEG;
}
- if (IS_ARG() || lex_state == EXPR_END || lex_state == EXPR_ENDFN)
+ if (IS_ARG() || IS_lex_state(EXPR_END | EXPR_ENDFN))
c = '{'; /* block (primary) */
- else if (lex_state == EXPR_ENDARG)
+ else if (IS_lex_state(EXPR_ENDARG))
c = tLBRACE_ARG; /* block (expr) */
else
c = tLBRACE; /* hash */
@@ -7577,7 +7851,7 @@ parser_yylex(struct parser_params *parser)
return '\\';
case '%':
- if (IS_BEG()) {
+ if (IS_lex_state(EXPR_BEG_ANY)) {
int term;
int paren;
@@ -7589,7 +7863,7 @@ parser_yylex(struct parser_params *parser)
}
else {
term = nextc();
- if (rb_enc_isalnum(term, parser->enc) || !parser_isascii()) {
+ if (rb_enc_isalnum(term, current_enc) || !parser_isascii()) {
yyerror("unknown type of %string");
return 0;
}
@@ -7626,6 +7900,18 @@ parser_yylex(struct parser_params *parser)
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;
@@ -7652,12 +7938,7 @@ parser_yylex(struct parser_params *parser)
if (IS_SPCARG(c)) {
goto quotation;
}
- switch (lex_state) {
- case EXPR_FNAME: case EXPR_DOT:
- lex_state = EXPR_ARG; break;
- default:
- lex_state = EXPR_BEG; break;
- }
+ lex_state = IS_AFTER_OPERATOR() ? EXPR_ARG : EXPR_BEG;
pushback(c);
warn_balanced("%%", "string literal");
return '%';
@@ -7695,9 +7976,7 @@ parser_yylex(struct parser_params *parser)
case '\"': /* $": already loaded files */
tokadd('$');
tokadd(c);
- tokfix();
- set_yylval_name(rb_intern(tok()));
- return tGVAR;
+ goto gvar;
case '-':
tokadd('$');
@@ -7708,17 +7987,18 @@ parser_yylex(struct parser_params *parser)
}
else {
pushback(c);
+ pushback('-');
+ return '$';
}
gvar:
- tokfix();
- set_yylval_name(rb_intern(tok()));
+ set_yylval_name(rb_intern3(tok(), tokidx, current_enc));
return tGVAR;
case '&': /* $&: last match */
case '`': /* $`: string before last match */
case '\'': /* $': string after last match */
case '+': /* $+: string matches last paren. */
- if (last_state == EXPR_FNAME) {
+ if (IS_lex_state_for(last_state, EXPR_FNAME)) {
tokadd('$');
tokadd(c);
goto gvar;
@@ -7735,7 +8015,7 @@ parser_yylex(struct parser_params *parser)
c = nextc();
} while (c != -1 && ISDIGIT(c));
pushback(c);
- if (last_state == EXPR_FNAME) goto gvar;
+ if (IS_lex_state_for(last_state, EXPR_FNAME)) goto gvar;
tokfix();
set_yylval_node(NEW_NTH_REF(atoi(tok()+1)));
return tNTH_REF;
@@ -7743,7 +8023,8 @@ parser_yylex(struct parser_params *parser)
default:
if (!parser_is_identchar()) {
pushback(c);
- return '$';
+ compile_error(PARSER_ARG "`$%c' is not allowed as a global variable name", c);
+ return 0;
}
case '0':
tokadd('$');
@@ -7758,7 +8039,8 @@ parser_yylex(struct parser_params *parser)
tokadd('@');
c = nextc();
}
- if (c != -1 && ISDIGIT(c)) {
+ 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);
}
@@ -7767,10 +8049,6 @@ parser_yylex(struct parser_params *parser)
}
return 0;
}
- if (!parser_is_identchar()) {
- pushback(c);
- return '@';
- }
break;
case '_':
@@ -7840,7 +8118,7 @@ parser_yylex(struct parser_params *parser)
result = tFID;
}
else {
- if (lex_state == EXPR_FNAME) {
+ if (IS_lex_state(EXPR_FNAME)) {
if ((c = nextc()) == '=' && !peek('~') && !peek('>') &&
(!peek('=') || (peek_n('>', 1)))) {
result = tIDENTIFIER;
@@ -7867,7 +8145,7 @@ parser_yylex(struct parser_params *parser)
return tLABEL;
}
}
- if (mb == ENC_CODERANGE_7BIT && lex_state != EXPR_DOT) {
+ if (mb == ENC_CODERANGE_7BIT && !IS_lex_state(EXPR_DOT)) {
const struct kwtable *kw;
/* See if it is a reserved word. */
@@ -7875,25 +8153,27 @@ parser_yylex(struct parser_params *parser)
if (kw) {
enum lex_state_e state = lex_state;
lex_state = kw->state;
- if (state == EXPR_FNAME) {
+ if (IS_lex_state_for(state, EXPR_FNAME)) {
set_yylval_name(rb_intern(kw->name));
return kw->id[0];
}
- if (kw->id[0] == keyword_do) {
+ 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() && state != EXPR_CMDARG)
+ if (CMDARG_P() && !IS_lex_state_for(state, EXPR_CMDARG))
return keyword_do_block;
- if (state == EXPR_ENDARG || state == EXPR_BEG)
+ if (IS_lex_state_for(state, (EXPR_BEG | EXPR_ENDARG)))
return keyword_do_block;
return keyword_do;
}
- if (state == EXPR_BEG || state == EXPR_VALUE)
+ if (IS_lex_state_for(state, (EXPR_BEG | EXPR_VALUE)))
return kw->id[0];
else {
if (kw->id[0] != kw->id[1])
@@ -7903,9 +8183,7 @@ parser_yylex(struct parser_params *parser)
}
}
- if (IS_BEG() ||
- lex_state == EXPR_DOT ||
- IS_ARG()) {
+ if (IS_lex_state(EXPR_BEG_ANY | EXPR_ARG_ANY | EXPR_DOT)) {
if (cmd_state) {
lex_state = EXPR_CMDARG;
}
@@ -7924,7 +8202,7 @@ parser_yylex(struct parser_params *parser)
ID ident = TOK_INTERN(!ENC_SINGLE(mb));
set_yylval_name(ident);
- if (last_state != EXPR_DOT && last_state != EXPR_FNAME &&
+ if (!IS_lex_state_for(last_state, EXPR_DOT|EXPR_FNAME) &&
is_local_id(ident) && lvar_defined(ident)) {
lex_state = EXPR_END;
}
@@ -7969,13 +8247,13 @@ node_newnode(struct parser_params *parser, enum node_type type, VALUE a0, VALUE
return n;
}
-enum node_type
+static enum node_type
nodetype(NODE *node) /* for debug */
{
return (enum node_type)nd_type(node);
}
-int
+static int
nodeline(NODE *node)
{
return nd_line(node);
@@ -8050,7 +8328,7 @@ block_append_gen(struct parser_params *parser, NODE *head, NODE *tail)
case NODE_REDO:
case NODE_RETRY:
if (RTEST(ruby_verbose)) {
- parser_warning(nd, "statement not reached");
+ parser_warning(tail, "statement not reached");
}
break;
@@ -8133,6 +8411,8 @@ static NODE *
literal_concat_gen(struct parser_params *parser, NODE *head, NODE *tail)
{
enum node_type htype;
+ NODE *headlast;
+ VALUE lit;
if (!head) return tail;
if (!tail) return head;
@@ -8141,11 +8421,20 @@ literal_concat_gen(struct parser_params *parser, NODE *head, NODE *tail)
if (htype == NODE_EVSTR) {
NODE *node = NEW_DSTR(Qnil);
head = list_append(node, head);
+ htype = NODE_DSTR;
}
switch (nd_type(tail)) {
case NODE_STR:
+ if (htype == NODE_DSTR && (headlast = head->nd_next->nd_end->nd_head) &&
+ nd_type(headlast) == NODE_STR) {
+ htype = NODE_STR;
+ lit = headlast->nd_lit;
+ }
+ else {
+ lit = head->nd_lit;
+ }
if (htype == NODE_STR) {
- if (!literal_concat0(parser, head->nd_lit, tail->nd_lit)) {
+ if (!literal_concat0(parser, lit, tail->nd_lit)) {
error:
rb_gc_force_recycle((VALUE)head);
rb_gc_force_recycle((VALUE)tail);
@@ -8167,11 +8456,20 @@ literal_concat_gen(struct parser_params *parser, NODE *head, NODE *tail)
head = tail;
}
else if (NIL_P(tail->nd_lit)) {
+ append:
head->nd_alen += tail->nd_alen - 1;
head->nd_next->nd_end->nd_next = tail->nd_next;
head->nd_next->nd_end = tail->nd_next->nd_end;
rb_gc_force_recycle((VALUE)tail);
}
+ else if (htype == NODE_DSTR && (headlast = head->nd_next->nd_end->nd_head) &&
+ nd_type(headlast) == NODE_STR) {
+ lit = headlast->nd_lit;
+ if (!literal_concat0(parser, lit, tail->nd_lit))
+ goto error;
+ tail->nd_lit = Qnil;
+ goto append;
+ }
else {
nd_set_type(tail, NODE_ARRAY);
tail->nd_head = NEW_STR(tail->nd_lit);
@@ -8240,7 +8538,7 @@ match_op_gen(struct parser_params *parser, NODE *node1, NODE *node2)
return NEW_MATCH2(node1, node2);
case NODE_LIT:
- if (TYPE(node1->nd_lit) == T_REGEXP) {
+ if (RB_TYPE_P(node1->nd_lit, T_REGEXP)) {
return NEW_MATCH2(node1, node2);
}
}
@@ -8253,7 +8551,7 @@ match_op_gen(struct parser_params *parser, NODE *node1, NODE *node2)
return NEW_MATCH3(node2, node1);
case NODE_LIT:
- if (TYPE(node2->nd_lit) == T_REGEXP) {
+ if (RB_TYPE_P(node2->nd_lit, T_REGEXP)) {
return NEW_MATCH3(node2, node1);
}
}
@@ -8265,44 +8563,35 @@ match_op_gen(struct parser_params *parser, NODE *node1, NODE *node2)
static NODE*
gettable_gen(struct parser_params *parser, ID id)
{
- if (id == keyword_self) {
+ switch (id) {
+ case keyword_self:
return NEW_SELF();
- }
- else if (id == keyword_nil) {
+ case keyword_nil:
return NEW_NIL();
- }
- else if (id == keyword_true) {
+ case keyword_true:
return NEW_TRUE();
- }
- else if (id == keyword_false) {
+ case keyword_false:
return NEW_FALSE();
- }
- else if (id == keyword__FILE__) {
- return NEW_STR(rb_external_str_new_with_enc(ruby_sourcefile, strlen(ruby_sourcefile),
- rb_filesystem_encoding()));
- }
- else if (id == keyword__LINE__) {
- return NEW_LIT(INT2FIX(ruby_sourceline));
- }
- else if (id == keyword__ENCODING__) {
- return NEW_LIT(rb_enc_from_encoding(parser->enc));
- }
- else if (is_local_id(id)) {
+ case keyword__FILE__:
+ return NEW_STR(rb_str_dup(ruby_sourcefile_string));
+ case keyword__LINE__:
+ return NEW_LIT(INT2FIX(tokline));
+ case keyword__ENCODING__:
+ return NEW_LIT(rb_enc_from_encoding(current_enc));
+ }
+ switch (id_type(id)) {
+ case ID_LOCAL:
if (dyna_in_block() && dvar_defined(id)) return NEW_DVAR(id);
if (local_id(id)) return NEW_LVAR(id);
/* method call without arguments */
return NEW_VCALL(id);
- }
- else if (is_global_id(id)) {
+ case ID_GLOBAL:
return NEW_GVAR(id);
- }
- else if (is_instance_id(id)) {
+ case ID_INSTANCE:
return NEW_IVAR(id);
- }
- else if (is_const_id(id)) {
+ case ID_CONST:
return NEW_CONST(id);
- }
- else if (is_class_id(id)) {
+ case ID_CLASS:
return NEW_CVAR(id);
}
compile_error(PARSER_ARG "identifier %s is not valid to get", rb_id2name(id));
@@ -8328,6 +8617,22 @@ id_is_var_gen(struct parser_params *parser, ID id)
}
#endif /* !RIPPER */
+#if PARSER_DEBUG
+static const char *
+lex_state_name(enum lex_state_e state)
+{
+ static const char names[][12] = {
+ "EXPR_BEG", "EXPR_END", "EXPR_ENDARG", "EXPR_ENDFN", "EXPR_ARG",
+ "EXPR_CMDARG", "EXPR_MID", "EXPR_FNAME", "EXPR_DOT", "EXPR_CLASS",
+ "EXPR_VALUE",
+ };
+
+ if ((unsigned)state & ~(~0u << EXPR_MAX_STATE))
+ return names[ffs(state)];
+ return NULL;
+}
+#endif
+
#ifdef RIPPER
static VALUE
assignable_gen(struct parser_params *parser, VALUE lhs)
@@ -8344,28 +8649,31 @@ assignable_gen(struct parser_params *parser, ID id, NODE *val)
# define assignable_result(x) (x)
#endif
if (!id) return assignable_result(0);
- if (id == keyword_self) {
+ switch (id) {
+ case keyword_self:
yyerror("Can't change the value of self");
- }
- else if (id == keyword_nil) {
+ goto error;
+ case keyword_nil:
yyerror("Can't assign to nil");
- }
- else if (id == keyword_true) {
+ goto error;
+ case keyword_true:
yyerror("Can't assign to true");
- }
- else if (id == keyword_false) {
+ goto error;
+ case keyword_false:
yyerror("Can't assign to false");
- }
- else if (id == keyword__FILE__) {
+ goto error;
+ case keyword__FILE__:
yyerror("Can't assign to __FILE__");
- }
- else if (id == keyword__LINE__) {
+ goto error;
+ case keyword__LINE__:
yyerror("Can't assign to __LINE__");
- }
- else if (id == keyword__ENCODING__) {
+ goto error;
+ case keyword__ENCODING__:
yyerror("Can't assign to __ENCODING__");
+ goto error;
}
- else if (is_local_id(id)) {
+ switch (id_type(id)) {
+ case ID_LOCAL:
if (dyna_in_block()) {
if (dvar_curr(id)) {
return assignable_result(NEW_DASGN_CURR(id, val));
@@ -8387,35 +8695,44 @@ assignable_gen(struct parser_params *parser, ID id, NODE *val)
}
return assignable_result(NEW_LASGN(id, val));
}
- }
- else if (is_global_id(id)) {
+ break;
+ case ID_GLOBAL:
return assignable_result(NEW_GASGN(id, val));
- }
- else if (is_instance_id(id)) {
+ case ID_INSTANCE:
return assignable_result(NEW_IASGN(id, val));
- }
- else if (is_const_id(id)) {
+ case ID_CONST:
if (!in_def && !in_single)
return assignable_result(NEW_CDECL(id, val, 0));
yyerror("dynamic constant assignment");
- }
- else if (is_class_id(id)) {
+ break;
+ case ID_CLASS:
return assignable_result(NEW_CVASGN(id, val));
- }
- else {
+ default:
compile_error(PARSER_ARG "identifier %s is not valid to set", rb_id2name(id));
}
+ error:
return assignable_result(0);
#undef assignable_result
#undef parser_yyerror
}
-#define LVAR_USED ((int)1 << (sizeof(int) * CHAR_BIT - 1))
+static int
+is_private_local_id(ID name)
+{
+ VALUE s;
+ if (name == idUScore) return 1;
+ if (!is_local_id(name)) return 0;
+ s = rb_id2str(name);
+ if (!s) return 0;
+ return RSTRING_PTR(s)[0] == '_';
+}
+
+#define LVAR_USED ((ID)1 << (sizeof(ID) * CHAR_BIT - 1))
static ID
shadowing_lvar_gen(struct parser_params *parser, ID name)
{
- if (idUScore == name) return name;
+ if (is_private_local_id(name)) return name;
if (dyna_in_block()) {
if (dvar_curr(name)) {
yyerror("duplicated argument name");
@@ -8466,9 +8783,41 @@ block_dup_check_gen(struct parser_params *parser, NODE *node1, NODE *node2)
}
}
+static const char id_type_names[][9] = {
+ "LOCAL",
+ "INSTANCE",
+ "", /* INSTANCE2 */
+ "GLOBAL",
+ "ATTRSET",
+ "CONST",
+ "CLASS",
+ "JUNK",
+};
+
ID
rb_id_attrset(ID id)
{
+ if (!is_notop_id(id)) {
+ switch (id) {
+ case tAREF: case tASET:
+ return tASET; /* only exception */
+ }
+ rb_name_error(id, "cannot make operator ID :%s attrset", rb_id2name(id));
+ }
+ else {
+ int scope = (int)(id & ID_SCOPE_MASK);
+ switch (scope) {
+ case ID_LOCAL: case ID_INSTANCE: case ID_GLOBAL:
+ case ID_CONST: case ID_CLASS: case ID_JUNK:
+ break;
+ case ID_ATTRSET:
+ return id;
+ default:
+ rb_name_error(id, "cannot make %s ID %+"PRIsVALUE" attrset",
+ id_type_names[scope], ID2SYM(id));
+
+ }
+ }
id &= ~ID_SCOPE_MASK;
id |= ID_ATTRSET;
return id;
@@ -8587,11 +8936,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:
@@ -8752,6 +9096,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)
{
@@ -8814,6 +9168,30 @@ reduce_nodes_gen(struct parser_params *parser, NODE **body)
}
static int
+is_static_content(NODE *node)
+{
+ if (!node) return 1;
+ switch (nd_type(node)) {
+ case NODE_HASH:
+ if (!(node = node->nd_head)) break;
+ case NODE_ARRAY:
+ do {
+ if (!is_static_content(node->nd_head)) return 0;
+ } while ((node = node->nd_next) != 0);
+ case NODE_LIT:
+ case NODE_STR:
+ case NODE_NIL:
+ case NODE_TRUE:
+ case NODE_FALSE:
+ case NODE_ZARRAY:
+ break;
+ default:
+ return 0;
+ }
+ return 1;
+}
+
+static int
assign_in_cond(struct parser_params *parser, NODE *node)
{
switch (nd_type(node)) {
@@ -8833,23 +9211,9 @@ assign_in_cond(struct parser_params *parser, NODE *node)
}
if (!node->nd_value) return 1;
- switch (nd_type(node->nd_value)) {
- case NODE_LIT:
- case NODE_STR:
- case NODE_NIL:
- case NODE_TRUE:
- case NODE_FALSE:
+ if (is_static_content(node->nd_value)) {
/* reports always */
parser_warn(node->nd_value, "found = in conditional, should be ==");
- return 1;
-
- case NODE_DSTR:
- case NODE_XSTR:
- case NODE_DXSTR:
- case NODE_EVSTR:
- case NODE_DREGX:
- default:
- break;
}
return 1;
}
@@ -8978,7 +9342,7 @@ cond0(struct parser_params *parser, NODE *node)
break;
case NODE_LIT:
- if (TYPE(node->nd_lit) == T_REGEXP) {
+ if (RB_TYPE_P(node->nd_lit, T_REGEXP)) {
warn_unless_e_option(parser, node, "regex literal in condition");
nd_set_type(node, NODE_MATCH);
}
@@ -9041,18 +9405,9 @@ ret_args_gen(struct parser_params *parser, NODE *node)
static NODE *
new_yield_gen(struct parser_params *parser, NODE *node)
{
- long state = Qtrue;
+ if (node) no_blockarg(parser, node);
- if (node) {
- no_blockarg(parser, node);
- if (node && nd_type(node) == NODE_SPLAT) {
- state = Qtrue;
- }
- }
- else {
- state = Qfalse;
- }
- return NEW_YIELD(node, state);
+ return NEW_YIELD(node);
}
static NODE*
@@ -9063,12 +9418,24 @@ negate_lit(NODE *node)
node->nd_lit = LONG2FIX(-FIX2LONG(node->nd_lit));
break;
case T_BIGNUM:
+ case T_RATIONAL:
+ case T_COMPLEX:
node->nd_lit = rb_funcall(node->nd_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);
+ }
+#else
RFLOAT(node->nd_lit)->float_value = -RFLOAT_VALUE(node->nd_lit);
+#endif
break;
default:
+ rb_bug("unknown literal type passed to negate_lit");
break;
}
return node;
@@ -9084,32 +9451,161 @@ arg_blk_pass(NODE *node1, NODE *node2)
return node1;
}
+
static NODE*
-new_args_gen(struct parser_params *parser, NODE *m, NODE *o, ID r, NODE *p, ID b)
+new_args_gen(struct parser_params *parser, NODE *m, NODE *o, ID r, NODE *p, NODE *tail)
{
int saved_line = ruby_sourceline;
+ struct rb_args_info *args = tail->nd_ainfo;
+
+ args->pre_args_num = m ? rb_long2int(m->nd_plen) : 0;
+ args->pre_init = m ? m->nd_next : 0;
+
+ args->post_args_num = p ? rb_long2int(p->nd_plen) : 0;
+ args->post_init = p ? p->nd_next : 0;
+ args->first_post_arg = p ? p->nd_pid : 0;
+
+ args->rest_arg = r;
+
+ args->opt_args = o;
+
+ ruby_sourceline = saved_line;
+
+ return tail;
+}
+
+static NODE*
+new_args_tail_gen(struct parser_params *parser, NODE *k, ID kr, ID b)
+{
+ int saved_line = ruby_sourceline;
+ struct rb_args_info *args;
+ NODE *kw_rest_arg = 0;
NODE *node;
- NODE *i1, *i2 = 0;
- node = NEW_ARGS(m ? m->nd_plen : 0, o);
- i1 = m ? m->nd_next : 0;
- node->nd_next = NEW_ARGS_AUX(r, b);
+ args = ALLOC(struct rb_args_info);
+ MEMZERO(args, struct rb_args_info, 1);
+ node = NEW_NODE(NODE_ARGS, 0, 0, args);
- if (p) {
- i2 = p->nd_next;
- node->nd_next->nd_next = NEW_ARGS_AUX(p->nd_pid, p->nd_plen);
+ args->block_arg = b;
+ args->kw_args = k;
+ if (k && !kr) kr = internal_id();
+ if (kr) {
+ arg_var(kr);
+ kw_rest_arg = NEW_DVAR(kr);
}
- else if (i1) {
- node->nd_next->nd_next = NEW_ARGS_AUX(0, 0);
+ args->kw_rest_arg = kw_rest_arg;
+
+ ruby_sourceline = saved_line;
+ return node;
+}
+
+static NODE*
+dsym_node_gen(struct parser_params *parser, NODE *node)
+{
+ VALUE lit;
+
+ if (!node) {
+ return NEW_LIT(ID2SYM(idNULL));
}
- if (i1 || i2) {
- node->nd_next->nd_next->nd_next = NEW_NODE(NODE_AND, i1, i2, 0);
+
+ switch (nd_type(node)) {
+ case NODE_DSTR:
+ nd_set_type(node, NODE_DSYM);
+ break;
+ case NODE_STR:
+ lit = node->nd_lit;
+ node->nd_lit = ID2SYM(rb_intern_str(lit));
+ nd_set_type(node, NODE_LIT);
+ break;
+ default:
+ node = NEW_NODE(NODE_DSYM, Qnil, 1, NEW_LIST(node));
+ break;
}
- ruby_sourceline = saved_line;
return node;
}
#endif /* !RIPPER */
+#ifndef RIPPER
+static NODE *
+new_op_assign_gen(struct parser_params *parser, NODE *lhs, ID op, NODE *rhs)
+{
+ NODE *asgn;
+
+ if (lhs) {
+ ID vid = lhs->nd_vid;
+ 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;
+ }
+ }
+ else if (op == tANDOP) {
+ lhs->nd_value = rhs;
+ asgn = NEW_OP_ASGN_AND(gettable(vid), lhs);
+ }
+ else {
+ asgn = lhs;
+ asgn->nd_value = NEW_CALL(gettable(vid), op, NEW_LIST(rhs));
+ }
+ }
+ else {
+ asgn = NEW_BEGIN(0);
+ }
+ return asgn;
+}
+
+static NODE *
+new_attr_op_assign_gen(struct parser_params *parser, NODE *lhs, ID attr, ID op, NODE *rhs)
+{
+ NODE *asgn;
+
+ if (op == tOROP) {
+ op = 0;
+ }
+ else if (op == tANDOP) {
+ op = 1;
+ }
+ asgn = NEW_OP_ASGN2(lhs, attr, op, rhs);
+ fixpos(asgn, lhs);
+ return asgn;
+}
+
+static NODE *
+new_const_op_assign_gen(struct parser_params *parser, NODE *lhs, ID op, NODE *rhs)
+{
+ NODE *asgn;
+
+ if (op == tOROP) {
+ op = 0;
+ }
+ else if (op == tANDOP) {
+ op = 1;
+ }
+ if (lhs) {
+ asgn = NEW_OP_CDECL(lhs, op, rhs);
+ }
+ else {
+ asgn = NEW_BEGIN(0);
+ }
+ fixpos(asgn, lhs);
+ return asgn;
+}
+#else
+static VALUE
+new_op_assign_gen(struct parser_params *parser, VALUE lhs, VALUE op, VALUE rhs)
+{
+ return dispatch3(opassign, lhs, op, rhs);
+}
+
+static VALUE
+new_attr_op_assign_gen(struct parser_params *parser, VALUE lhs, VALUE type, VALUE attr, VALUE op, VALUE rhs)
+{
+ VALUE recv = dispatch3(field, lhs, type, attr);
+ return dispatch3(opassign, recv, op, rhs);
+}
+#endif
+
static void
warn_unused_var(struct parser_params *parser, struct local_vars *local)
{
@@ -9125,8 +9621,8 @@ 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 (idUScore == v[i]) continue;
- rb_compile_warn(ruby_sourcefile, (int)u[i], "assigned but unused variable - %s", rb_id2name(v[i]));
+ if (is_private_local_id(v[i])) continue;
+ rb_warn4S(ruby_sourcefile, (int)u[i], "assigned but unused variable - %s", rb_id2name(v[i]));
}
}
@@ -9139,7 +9635,9 @@ local_push_gen(struct parser_params *parser, int inherit_dvars)
local->prev = lvtbl;
local->args = vtable_alloc(0);
local->vars = vtable_alloc(inherit_dvars ? DVARS_INHERIT : DVARS_TOPSCOPE);
- local->used = !inherit_dvars && RTEST(ruby_verbose) ? vtable_alloc(0) : 0;
+ local->used = !(inherit_dvars &&
+ (ifndef_ripper(compile_for_eval || e_option_supplied(parser))+0)) &&
+ RTEST(ruby_verbose) ? vtable_alloc(0) : 0;
lvtbl = local;
}
@@ -9343,7 +9841,7 @@ reg_fragment_setenc_gen(struct parser_params* parser, VALUE str, int options)
}
rb_enc_associate(str, rb_ascii8bit_encoding());
}
- else if (parser->enc == rb_usascii_encoding()) {
+ else if (current_enc == rb_usascii_encoding()) {
if (rb_enc_str_coderange(str) != ENC_CODERANGE_7BIT) {
/* raise in re.c */
rb_enc_associate(str, rb_usascii_encoding());
@@ -9368,8 +9866,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;
@@ -9472,7 +9969,7 @@ 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;
}
@@ -9563,9 +10060,8 @@ static const struct {
} op_tbl[] = {
{tDOT2, ".."},
{tDOT3, "..."},
- {'+', "+(binary)"},
- {'-', "-(binary)"},
{tPOW, "**"},
+ {tDSTAR, "**"},
{tUPLUS, "+@"},
{tUMINUS, "-@"},
{tCMP, "<=>"},
@@ -9597,8 +10093,9 @@ static struct symbols {
st_table *ivar2_id;
st_table *id_ivar2;
#endif
- VALUE op_sym[tLAST_TOKEN];
-} global_symbols = {tLAST_ID};
+ VALUE op_sym[tLAST_OP_ID];
+ int minor_marked;
+} global_symbols = {tLAST_TOKEN};
static const struct st_hash_type symhash = {
rb_str_hash_cmp,
@@ -9642,15 +10139,25 @@ Init_sym(void)
global_symbols.id_ivar2 = st_init_numtable_with_size(1000);
#endif
+ (void)nodetype;
+ (void)nodeline;
+#if PARSER_DEBUG
+ (void)lex_state_name(-1);
+#endif
+
Init_id();
}
void
-rb_gc_mark_symbols(void)
+rb_gc_mark_symbols(int full_mark)
{
- rb_mark_tbl(global_symbols.id_str);
- rb_gc_mark_locations(global_symbols.op_sym,
- global_symbols.op_sym + tLAST_TOKEN);
+ if (full_mark || global_symbols.minor_marked == 0) {
+ rb_mark_tbl(global_symbols.id_str);
+ rb_gc_mark_locations(global_symbols.op_sym,
+ global_symbols.op_sym + numberof(global_symbols.op_sym));
+
+ if (!full_mark) global_symbols.minor_marked = 1;
+ }
}
#endif /* !RIPPER */
@@ -9669,22 +10176,17 @@ is_special_global_name(const char *m, const char *e, rb_encoding *enc)
int mb = 0;
if (m >= e) return 0;
- switch (*m) {
- case '~': case '*': case '$': case '?': case '!': case '@':
- case '/': case '\\': case ';': case ',': case '.': case '=':
- case ':': case '<': case '>': case '\"':
- case '&': case '`': case '\'': case '+':
- case '0':
+ if (is_global_name_punct(*m)) {
++m;
- break;
- case '-':
- ++m;
- if (m < e && is_identchar(m, e, enc)) {
+ }
+ 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);
}
- break;
- default:
+ }
+ else {
if (!rb_enc_isdigit(*m, enc)) return 0;
do {
if (!ISASCII(*m)) mb = 1;
@@ -9706,24 +10208,32 @@ rb_enc_symname_p(const char *name, rb_encoding *enc)
return rb_enc_symname2_p(name, strlen(name), enc);
}
-int
-rb_enc_symname2_p(const char *name, long len, rb_encoding *enc)
+#define IDSET_ATTRSET_FOR_SYNTAX ((1U<<ID_LOCAL)|(1U<<ID_CONST))
+#define IDSET_ATTRSET_FOR_INTERN (~(~0U<<ID_SCOPE_MASK) & ~(1U<<ID_ATTRSET))
+
+static int
+rb_enc_symname_type(const char *name, long len, rb_encoding *enc, unsigned int allowed_attrset)
{
const char *m = name;
const char *e = m + len;
- int localid = FALSE;
+ int type = ID_JUNK;
- if (!m || len <= 0) return FALSE;
+ if (!m || len <= 0) return -1;
switch (*m) {
case '\0':
- return FALSE;
+ return -1;
case '$':
- if (is_special_global_name(++m, e, enc)) return TRUE;
+ type = ID_GLOBAL;
+ if (is_special_global_name(++m, e, enc)) return type;
goto id;
case '@':
- if (*++m == '@') ++m;
+ type = ID_INSTANCE;
+ if (*++m == '@') {
+ ++m;
+ type = ID_CLASS;
+ }
goto id;
case '<':
@@ -9744,7 +10254,7 @@ rb_enc_symname2_p(const char *name, long len, rb_encoding *enc)
switch (*++m) {
case '~': ++m; break;
case '=': if (*++m == '=') ++m; break;
- default: return FALSE;
+ default: return -1;
}
break;
@@ -9761,73 +10271,145 @@ rb_enc_symname2_p(const char *name, long len, rb_encoding *enc)
break;
case '[':
- if (*++m != ']') return FALSE;
+ if (*++m != ']') return -1;
if (*++m == '=') ++m;
break;
case '!':
- if (len == 1) return TRUE;
+ if (len == 1) return ID_JUNK;
switch (*++m) {
case '=': case '~': ++m; break;
- default: return FALSE;
+ default: return -1;
}
break;
default:
- localid = !rb_enc_isupper(*m, enc);
+ type = rb_enc_isupper(*m, enc) ? ID_CONST : ID_LOCAL;
id:
if (m >= e || (*m != '_' && !rb_enc_isalpha(*m, enc) && ISASCII(*m)))
- return FALSE;
+ return -1;
while (m < e && is_identchar(m, e, enc)) m += rb_enc_mbclen(m, e, enc);
- if (localid) {
- switch (*m) {
- case '!': case '?': case '=': ++m;
- }
+ if (m >= e) break;
+ switch (*m) {
+ case '!': case '?':
+ if (type == ID_GLOBAL || type == ID_CLASS || type == ID_INSTANCE) return -1;
+ type = ID_JUNK;
+ ++m;
+ break;
+ case '=':
+ if (!(allowed_attrset & (1U << type))) return -1;
+ type = ID_ATTRSET;
+ ++m;
+ break;
}
break;
}
- return m == e;
+ return m == e ? type : -1;
+}
+
+int
+rb_enc_symname2_p(const char *name, long len, rb_encoding *enc)
+{
+ return rb_enc_symname_type(name, len, enc, IDSET_ATTRSET_FOR_SYNTAX) != -1;
+}
+
+static int
+rb_str_symname_type(VALUE name, unsigned int allowed_attrset)
+{
+ const char *ptr = StringValuePtr(name);
+ long len = RSTRING_LEN(name);
+ int type = rb_enc_symname_type(ptr, len, rb_enc_get(name), allowed_attrset);
+ RB_GC_GUARD(name);
+ return type;
}
static ID
register_symid(ID id, const char *name, long len, rb_encoding *enc)
{
VALUE str = rb_enc_str_new(name, len, enc);
+ return register_symid_str(id, str);
+}
+
+static ID
+register_symid_str(ID id, VALUE str)
+{
OBJ_FREEZE(str);
+
+ if (RUBY_DTRACE_SYMBOL_CREATE_ENABLED()) {
+ RUBY_DTRACE_SYMBOL_CREATE(RSTRING_PTR(str), rb_sourcefile(), rb_sourceline());
+ }
+
st_add_direct(global_symbols.sym_id, (st_data_t)str, id);
st_add_direct(global_symbols.id_str, id, (st_data_t)str);
+ global_symbols.minor_marked = 0;
return id;
}
+static int
+sym_check_asciionly(VALUE str)
+{
+ if (!rb_enc_asciicompat(rb_enc_get(str))) return FALSE;
+ switch (rb_enc_str_coderange(str)) {
+ case ENC_CODERANGE_BROKEN:
+ rb_raise(rb_eEncodingError, "invalid encoding symbol");
+ case ENC_CODERANGE_7BIT:
+ return TRUE;
+ }
+ return FALSE;
+}
+
+/*
+ * _str_ itself will be registered at the global symbol table. _str_
+ * can be modified before the registration, since the encoding will be
+ * set to ASCII-8BIT if it is a special global name.
+ */
+static ID intern_str(VALUE str);
+
+static VALUE
+setup_fake_str(struct RString *fake_str, const char *name, long len)
+{
+ fake_str->basic.flags = T_STRING|RSTRING_NOEMBED;
+ RBASIC_SET_CLASS((VALUE)fake_str, rb_cString);
+ fake_str->as.heap.len = len;
+ fake_str->as.heap.ptr = (char *)name;
+ fake_str->as.heap.aux.capa = len;
+ return (VALUE)fake_str;
+}
+
ID
rb_intern3(const char *name, long len, rb_encoding *enc)
{
- const char *m = name;
- const char *e = m + len;
- unsigned char c;
- VALUE str;
- ID id;
- long last;
- int mb;
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;
+ VALUE str = setup_fake_str(&fake_str, name, len);
rb_enc_associate(str, enc);
OBJ_FREEZE(str);
- if (rb_enc_str_coderange(str) == ENC_CODERANGE_BROKEN) {
- rb_raise(rb_eEncodingError, "invalid encoding symbol");
- }
-
if (st_lookup(global_symbols.sym_id, str, &data))
return (ID)data;
- if (rb_cString && !rb_enc_asciicompat(enc)) {
+ str = rb_enc_str_new(name, len, enc); /* make true string */
+ return intern_str(str);
+}
+
+static ID
+intern_str(VALUE str)
+{
+ const char *name, *m, *e;
+ long len, last;
+ rb_encoding *enc, *symenc;
+ unsigned char c;
+ ID id;
+ int mb;
+
+ RSTRING_GETMEM(str, name, len);
+ m = name;
+ e = m + len;
+ enc = rb_enc_get(str);
+ symenc = enc;
+
+ if (!len || (rb_cString && !rb_enc_asciicompat(enc))) {
+ junk:
id = ID_JUNK;
goto new_id;
}
@@ -9835,18 +10417,21 @@ rb_intern3(const char *name, long len, rb_encoding *enc)
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) enc = rb_ascii8bit_encoding();
+ 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++;
@@ -9869,52 +10454,42 @@ rb_intern3(const char *name, long len, rb_encoding *enc)
}
}
}
-
- if (m[last] == '=') {
- /* attribute assignment */
- id = rb_intern3(name, last, enc);
- if (id > tLAST_TOKEN && !is_attrset_id(id)) {
- enc = rb_enc_get(rb_id2str(id));
- id = rb_id_attrset(id);
- goto id_register;
- }
- id = ID_ATTRSET;
+ break;
+ }
+ if (name[last] == '=') {
+ /* attribute assignment */
+ if (last > 1 && name[last-1] == '=')
+ goto junk;
+ id = rb_intern3(name, last, enc);
+ if (id > tLAST_OP_ID && !is_attrset_id(id)) {
+ enc = rb_enc_get(rb_id2str(id));
+ id = rb_id_attrset(id);
+ goto id_register;
}
- else if (rb_enc_isupper(m[0], enc)) {
+ id = ID_ATTRSET;
+ }
+ else if (id == 0) {
+ if (rb_enc_isupper(m[0], enc)) {
id = ID_CONST;
- }
+ }
else {
id = ID_LOCAL;
}
- break;
}
- mb = 0;
if (!rb_enc_isdigit(*m, enc)) {
while (m <= name + last && is_identchar(m, e, enc)) {
if (ISASCII(*m)) {
m++;
}
else {
- mb = 1;
m += rb_enc_mbclen(m, e, enc);
}
}
}
- if (m - name < len) id = ID_JUNK;
- if (enc != rb_usascii_encoding()) {
- /*
- * this clause makes sense only when called from other than
- * rb_intern_str() taking care of code-range.
- */
- if (!mb) {
- for (; m <= name + len; ++m) {
- if (!ISASCII(*m)) goto mbstr;
- }
- enc = rb_usascii_encoding();
- }
- mbstr:;
- }
+ if (id != ID_ATTRSET && m - name < len) id = ID_JUNK;
+ if (sym_check_asciionly(str)) symenc = rb_usascii_encoding();
new_id:
+ if (symenc != enc) rb_enc_associate(str, symenc);
if (global_symbols.last_id >= ~(ID)0 >> (ID_SCOPE_SHIFT+RUBY_SPECIAL_SHIFT)) {
if (len > 20) {
rb_raise(rb_eRuntimeError, "symbol table overflow (symbol %.20s...)",
@@ -9927,7 +10502,7 @@ rb_intern3(const char *name, long len, rb_encoding *enc)
}
id |= ++global_symbols.last_id << ID_SCOPE_SHIFT;
id_register:
- return register_symid(id, name, len, enc);
+ return register_symid_str(id, str);
}
ID
@@ -9946,18 +10521,11 @@ rb_intern(const char *name)
ID
rb_intern_str(VALUE str)
{
- rb_encoding *enc;
- ID id;
+ st_data_t id;
- if (rb_enc_str_coderange(str) == ENC_CODERANGE_7BIT) {
- enc = rb_usascii_encoding();
- }
- else {
- enc = rb_enc_get(str);
- }
- id = rb_intern3(RSTRING_PTR(str), RSTRING_LEN(str), enc);
- RB_GC_GUARD(str);
- return id;
+ if (st_lookup(global_symbols.sym_id, str, &id))
+ return (ID)id;
+ return intern_str(rb_str_dup(str));
}
VALUE
@@ -9977,6 +10545,7 @@ rb_id2str(ID id)
str = rb_usascii_str_new(name, 1);
OBJ_FREEZE(str);
global_symbols.op_sym[i] = str;
+ global_symbols.minor_marked = 0;
}
return str;
}
@@ -9987,6 +10556,7 @@ rb_id2str(ID id)
str = rb_usascii_str_new2(op_tbl[i].name);
OBJ_FREEZE(str);
global_symbols.op_sym[i] = str;
+ global_symbols.minor_marked = 0;
}
return str;
}
@@ -9996,25 +10566,30 @@ rb_id2str(ID id)
if (st_lookup(global_symbols.id_str, id, &data)) {
VALUE str = (VALUE)data;
if (RBASIC(str)->klass == 0)
- RBASIC(str)->klass = rb_cString;
+ RBASIC_SET_CLASS_RAW(str, rb_cString);
return str;
}
if (is_attrset_id(id)) {
- ID id2 = (id & ~ID_SCOPE_MASK) | ID_LOCAL;
+ ID id_stem = (id & ~ID_SCOPE_MASK);
VALUE str;
- while (!(str = rb_id2str(id2))) {
- if (!is_local_id(id2)) return 0;
- id2 = (id & ~ID_SCOPE_MASK) | ID_CONST;
- }
+ 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);
- rb_intern_str(str);
+ register_symid_str(id, str);
if (st_lookup(global_symbols.id_str, id, &data)) {
VALUE str = (VALUE)data;
if (RBASIC(str)->klass == 0)
- RBASIC(str)->klass = rb_cString;
+ RBASIC_SET_CLASS_RAW(str, rb_cString);
return str;
}
}
@@ -10075,12 +10650,24 @@ rb_is_class_id(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);
@@ -10092,6 +10679,134 @@ rb_is_junk_id(ID id)
return is_junk_id(id);
}
+/**
+ * Returns ID for the given name if it is interned already, or 0.
+ *
+ * \param namep the pointer to the name object
+ * \return the ID for *namep
+ * \pre the object referred by \p namep must be a Symbol or
+ * a String, or possible to convert with to_str method.
+ * \post the object referred by \p namep is a Symbol or a
+ * String if non-zero value is returned, or is a String
+ * if 0 is returned.
+ */
+ID
+rb_check_id(volatile VALUE *namep)
+{
+ st_data_t id;
+ VALUE tmp;
+ VALUE name = *namep;
+
+ if (SYMBOL_P(name)) {
+ return SYM2ID(name);
+ }
+ else if (!RB_TYPE_P(name, T_STRING)) {
+ tmp = rb_check_string_type(name);
+ if (NIL_P(tmp)) {
+ tmp = rb_inspect(name);
+ rb_raise(rb_eTypeError, "%s is not a symbol",
+ RSTRING_PTR(tmp));
+ }
+ name = tmp;
+ *namep = name;
+ }
+
+ sym_check_asciionly(name);
+
+ if (st_lookup(global_symbols.sym_id, (st_data_t)name, &id))
+ return (ID)id;
+
+ if (rb_is_attrset_name(name)) {
+ struct RString fake_str;
+ /* make local name by chopping '=' */
+ const VALUE localname = setup_fake_str(&fake_str, RSTRING_PTR(name), RSTRING_LEN(name) - 1);
+ rb_enc_copy(localname, name);
+ OBJ_FREEZE(localname);
+
+ if (st_lookup(global_symbols.sym_id, (st_data_t)localname, &id)) {
+ return rb_id_attrset((ID)id);
+ }
+ RB_GC_GUARD(name);
+ }
+
+ return (ID)0;
+}
+
+ID
+rb_check_id_cstr(const char *ptr, long len, rb_encoding *enc)
+{
+ st_data_t id;
+ struct RString fake_str;
+ const VALUE name = setup_fake_str(&fake_str, ptr, len);
+ rb_enc_associate(name, enc);
+
+ sym_check_asciionly(name);
+
+ if (st_lookup(global_symbols.sym_id, (st_data_t)name, &id))
+ return (ID)id;
+
+ if (rb_is_attrset_name(name)) {
+ fake_str.as.heap.len = len - 1;
+ if (st_lookup(global_symbols.sym_id, (st_data_t)name, &id)) {
+ return rb_id_attrset((ID)id);
+ }
+ }
+
+ return (ID)0;
+}
+
+int
+rb_is_const_name(VALUE name)
+{
+ return rb_str_symname_type(name, 0) == ID_CONST;
+}
+
+int
+rb_is_class_name(VALUE name)
+{
+ return rb_str_symname_type(name, 0) == ID_CLASS;
+}
+
+int
+rb_is_global_name(VALUE name)
+{
+ return rb_str_symname_type(name, 0) == ID_GLOBAL;
+}
+
+int
+rb_is_instance_name(VALUE name)
+{
+ return rb_str_symname_type(name, 0) == ID_INSTANCE;
+}
+
+int
+rb_is_attrset_name(VALUE name)
+{
+ return rb_str_symname_type(name, IDSET_ATTRSET_FOR_INTERN) == ID_ATTRSET;
+}
+
+int
+rb_is_local_name(VALUE name)
+{
+ return rb_str_symname_type(name, 0) == ID_LOCAL;
+}
+
+int
+rb_is_method_name(VALUE name)
+{
+ switch (rb_str_symname_type(name, 0)) {
+ case ID_LOCAL: case ID_ATTRSET: case ID_JUNK:
+ return TRUE;
+ }
+ return FALSE;
+}
+
+int
+rb_is_junk_name(VALUE name)
+{
+ return rb_str_symname_type(name, IDSET_ATTRSET_FOR_SYNTAX) == -1;
+}
+
#endif /* !RIPPER */
static void
@@ -10105,6 +10820,7 @@ parser_initialize(struct parser_params *parser)
parser->parser_class_nest = 0;
parser->parser_paren_nest = 0;
parser->parser_lpar_beg = 0;
+ parser->parser_brace_nest = 0;
parser->parser_in_single = 0;
parser->parser_in_def = 0;
parser->parser_in_defined = 0;
@@ -10122,13 +10838,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;
@@ -10138,7 +10854,7 @@ parser_initialize(struct parser_params *parser)
#ifdef YYMALLOC
parser->heap = NULL;
#endif
- parser->enc = rb_usascii_encoding();
+ parser->enc = rb_utf8_encoding();
}
#ifdef RIPPER
@@ -10156,12 +10872,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);
@@ -10186,9 +10902,6 @@ parser_free(void *ptr)
prev = local->prev;
xfree(local);
}
-#ifndef RIPPER
- xfree(p->parser_ruby_sourcefile);
-#endif
xfree(p);
}
@@ -10205,11 +10918,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;
}
@@ -10224,6 +10932,7 @@ rb_data_type_t parser_data_type = {
parser_free,
parser_memsize,
},
+ NULL, NULL, RUBY_TYPED_FREE_IMMEDIATELY
};
#ifndef RIPPER
@@ -10281,7 +10990,7 @@ rb_parser_encoding(VALUE vparser)
struct parser_params *parser;
TypedData_Get_Struct(vparser, struct parser_params, &parser_data_type, parser);
- return rb_enc_from_encoding(parser->enc);
+ return rb_enc_from_encoding(current_enc);
}
/*
@@ -10396,12 +11105,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) {
@@ -10469,6 +11180,19 @@ ripper_dispatch5(struct parser_params *parser, ID mid, VALUE a, VALUE b, VALUE c
return rb_funcall(parser->value, mid, 5, a, b, c, d, e);
}
+static VALUE
+ripper_dispatch7(struct parser_params *parser, ID mid, VALUE a, VALUE b, VALUE c, VALUE d, VALUE e, VALUE f, VALUE g)
+{
+ validate(a);
+ validate(b);
+ validate(c);
+ validate(d);
+ validate(e);
+ validate(f);
+ validate(g);
+ return rb_funcall(parser->value, mid, 7, a, b, c, d, e, f, g);
+}
+
static const struct kw_assoc {
ID id;
const char *name;
@@ -10614,14 +11338,12 @@ ripper_warnI(struct parser_params *parser, const char *fmt, int a)
STR_NEW2(fmt), INT2NUM(a));
}
-#if 0
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_warning0(struct parser_params *parser, const char *fmt)
@@ -10639,7 +11361,7 @@ ripper_warningS(struct parser_params *parser, const char *fmt, const char *str)
static VALUE
ripper_lex_get_generic(struct parser_params *parser, VALUE src)
{
- return rb_funcall(src, ripper_id_gets, 0);
+ return rb_io_gets(src);
}
static VALUE
@@ -10675,7 +11397,7 @@ ripper_initialize(int argc, VALUE *argv, VALUE self)
TypedData_Get_Struct(self, struct parser_params, &parser_data_type, parser);
rb_scan_args(argc, argv, "12", &src, &fname, &lineno);
- if (rb_obj_respond_to(src, ripper_id_gets, 0)) {
+ if (RB_TYPE_P(src, T_FILE)) {
parser->parser_lex_gets = ripper_lex_get_generic;
}
else {
@@ -10820,7 +11542,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;
}
@@ -10835,18 +11557,26 @@ ripper_value(VALUE self, VALUE obj)
void
-InitVM_ripper(void)
+Init_ripper(void)
{
parser_data_type.parent = RTYPEDDATA_TYPE(rb_parser_new());
+
+ ripper_init_eventids1();
+ ripper_init_eventids2();
+ /* ensure existing in symbol table */
+ (void)rb_intern("||");
+ (void)rb_intern("&&");
+
+ InitVM(ripper);
}
void
-Init_ripper(void)
+InitVM_ripper(void)
{
VALUE Ripper;
- InitVM(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);
@@ -10864,12 +11594,8 @@ Init_ripper(void)
rb_define_method(rb_mKernel, "validate_object", ripper_validate_object, 1);
#endif
- ripper_id_gets = rb_intern("gets");
- ripper_init_eventids1(Ripper);
- ripper_init_eventids2(Ripper);
- /* ensure existing in symbol table */
- (void)rb_intern("||");
- (void)rb_intern("&&");
+ ripper_init_eventids1_table(Ripper);
+ ripper_init_eventids2_table(Ripper);
# if 0
/* Hack to let RDoc document SCRIPT_LINES__ */
diff --git a/prelude.rb b/prelude.rb
index 4b6ab1a677..2b371e7134 100644
--- a/prelude.rb
+++ b/prelude.rb
@@ -1,19 +1,3 @@
-class Mutex
- # call-seq:
- # mutex.synchronize { ... }
- #
- # Obtains a lock, runs the block, and releases the lock when the
- # block completes. See the example under Mutex.
- def synchronize
- self.lock
- begin
- yield
- ensure
- self.unlock rescue nil
- end
- end
-end
-
class Thread
MUTEX_FOR_THREAD_EXCLUSIVE = Mutex.new # :nodoc:
diff --git a/probes.d b/probes.d
new file mode 100644
index 0000000000..dd7a7bfcd3
--- /dev/null
+++ b/probes.d
@@ -0,0 +1,223 @@
+/* -*- c -*- */
+#include "vm_opts.h"
+
+provider ruby {
+ /*
+ 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)
+ */
+ 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 *classname, const char *methodname, const char *filename, int lineno);
+
+ /*
+ 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".
+ */
+ 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 *classname, const char *methodname, const char *filename, int lineno);
+
+ /*
+ 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).
+ */
+ probe require__entry(const char *rquiredfile, const char *filename, int lineno);
+
+ /*
+ 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.
+ */
+ probe require__return(const char *requiredfile, const char *filename, int lineno);
+
+ /*
+ 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).
+ */
+ probe find__require__entry(const char *requiredfile, const char *filename, int lineno);
+
+ /*
+ 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".
+ */
+ probe find__require__return(const char *requiredfile, const char *filename, int lineno);
+
+ /*
+ 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".
+ */
+ probe load__entry(const char *loadedfile, const char *filename, int lineno);
+
+ /*
+ ruby:::load-return(loadedfile, filename, lineno);
+
+ This probe is fired when "load" returns. The arguments are the same as
+ "ruby:::load-entry".
+ */
+ probe load__return(const char *loadedfile, const char *filename, int lineno);
+
+ /*
+ 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)
+ */
+ probe raise(const char *classname, const char *filename, int lineno);
+
+ /*
+ 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)
+ */
+ probe object__create(const char *classname, const char *filename, int lineno);
+
+ /*
+ 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)
+ */
+ probe array__create(long length, const char *filename, int lineno);
+
+ /*
+ 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)
+ */
+ probe hash__create(long length, const char *filename, int lineno);
+
+ /*
+ 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)
+ */
+ 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);
+
+ Fired just before parsing and compiling a source file.
+
+ * `sourcefile` the file being parsed (string)
+ * `lineno` the line number where the source starts (int)
+ */
+ probe parse__begin(const char *sourcefile, int lineno);
+
+ /*
+ 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)
+ */
+ probe parse__end(const char *sourcefile, int lineno);
+
+#if VM_COLLECT_USAGE_DETAILS
+ probe insn(const char *insns_name);
+ probe insn__operand(const char *val, const char *insns_name);
+#endif
+
+ /*
+ ruby:::gc-mark-begin();
+
+ Fired at the beginning of a mark phase.
+ */
+ probe gc__mark__begin();
+
+ /*
+ ruby:::gc-mark-end();
+
+ Fired at the end of a mark phase.
+ */
+ probe gc__mark__end();
+
+ /*
+ ruby:::gc-sweep-begin();
+
+ Fired at the beginning of a sweep phase.
+ */
+ probe gc__sweep__begin();
+
+ /*
+ ruby:::gc-sweep-end();
+
+ Fired at the end of a sweep phase.
+ */
+ probe gc__sweep__end();
+};
+
+#pragma D attributes Stable/Evolving/Common provider ruby provider
+#pragma D attributes Stable/Evolving/Common provider ruby module
+#pragma D attributes Stable/Evolving/Common provider ruby function
+#pragma D attributes Evolving/Evolving/Common provider ruby name
+#pragma D attributes Evolving/Evolving/Common provider ruby args
diff --git a/probes_helper.h b/probes_helper.h
new file mode 100644
index 0000000000..12a18dcb34
--- /dev/null
+++ b/probes_helper.h
@@ -0,0 +1,67 @@
+#ifndef RUBY_PROBES_HELPER_H
+#define RUBY_PROBES_HELPER_H
+
+#include "ruby/ruby.h"
+#include "probes.h"
+
+VALUE rb_class_path_no_cache(VALUE _klass);
+
+#define RUBY_DTRACE_HOOK(name, th, klazz, id) \
+do { \
+ if (RUBY_DTRACE_##name##_ENABLED()) { \
+ VALUE _klass = (klazz); \
+ VALUE _id = (id); \
+ const char * classname; \
+ const char * methodname; \
+ const char * filename; \
+ if (!_klass) { \
+ rb_thread_method_id_and_class((th), &_id, &_klass); \
+ } \
+ if (_klass) { \
+ if (RB_TYPE_P(_klass, T_ICLASS)) { \
+ _klass = RBASIC(_klass)->klass; \
+ } \
+ else if (FL_TEST(_klass, FL_SINGLETON)) { \
+ _klass = rb_iv_get(_klass, "__attached__"); \
+ } \
+ switch (TYPE(_klass)) { \
+ case T_CLASS: \
+ case T_ICLASS: \
+ case T_MODULE: \
+ { \
+ VALUE _name = rb_class_path_no_cache(_klass); \
+ if (!NIL_P(_name)) { \
+ classname = StringValuePtr(_name); \
+ } \
+ else { \
+ classname = "<unknown>"; \
+ } \
+ methodname = rb_id2name(_id); \
+ filename = rb_sourcefile(); \
+ if (classname && methodname && filename) { \
+ RUBY_DTRACE_##name( \
+ classname, \
+ methodname, \
+ filename, \
+ rb_sourceline()); \
+ } \
+ break; \
+ } \
+ } \
+ } \
+ } \
+} while (0)
+
+#define RUBY_DTRACE_METHOD_ENTRY_HOOK(th, klass, id) \
+ RUBY_DTRACE_HOOK(METHOD_ENTRY, th, klass, id)
+
+#define RUBY_DTRACE_METHOD_RETURN_HOOK(th, klass, id) \
+ RUBY_DTRACE_HOOK(METHOD_RETURN, th, klass, id)
+
+#define RUBY_DTRACE_CMETHOD_ENTRY_HOOK(th, klass, id) \
+ RUBY_DTRACE_HOOK(CMETHOD_ENTRY, th, klass, id)
+
+#define RUBY_DTRACE_CMETHOD_RETURN_HOOK(th, klass, id) \
+ RUBY_DTRACE_HOOK(CMETHOD_RETURN, th, klass, id)
+
+#endif /* RUBY_PROBES_HELPER_H */
diff --git a/proc.c b/proc.c
index ca6d3c4769..f3e38e9e02 100644
--- a/proc.c
+++ b/proc.c
@@ -17,6 +17,7 @@
struct METHOD {
VALUE recv;
VALUE rclass;
+ VALUE defined_class;
ID id;
rb_method_entry_t *me;
struct unlinked_method_entry_list_entry *ume;
@@ -29,6 +30,8 @@ VALUE rb_cProc;
static VALUE bmcall(VALUE, VALUE, int, VALUE *, VALUE);
static int method_arity(VALUE);
+static int method_min_max_arity(VALUE, int *max);
+#define attached id__attached__
/* Proc */
@@ -75,6 +78,7 @@ static const rb_data_type_t proc_data_type = {
proc_free,
proc_memsize,
},
+ NULL, NULL, RUBY_TYPED_FREE_IMMEDIATELY
};
VALUE
@@ -242,7 +246,7 @@ binding_free(void *ptr)
RUBY_FREE_ENTER("binding");
if (ptr) {
bind = ptr;
- ruby_xfree(ptr);
+ ruby_xfree(bind);
}
RUBY_FREE_LEAVE("binding");
}
@@ -255,7 +259,7 @@ binding_mark(void *ptr)
if (ptr) {
bind = ptr;
RUBY_MARK_UNLESS_NULL(bind->env);
- RUBY_MARK_UNLESS_NULL(bind->filename);
+ RUBY_MARK_UNLESS_NULL(bind->path);
}
RUBY_MARK_LEAVE("binding");
}
@@ -266,13 +270,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
@@ -280,7 +285,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;
}
@@ -293,8 +298,8 @@ binding_dup(VALUE self)
GetBindingPtr(self, src);
GetBindingPtr(bindval, dst);
dst->env = src->env;
- dst->filename = src->filename;
- dst->line_no = src->line_no;
+ dst->path = src->path;
+ dst->first_lineno = src->first_lineno;
return bindval;
}
@@ -308,24 +313,41 @@ binding_clone(VALUE self)
}
VALUE
-rb_binding_new(void)
+rb_binding_new_with_cfp(rb_thread_t *th, const rb_control_frame_t *src_cfp)
{
- rb_thread_t *th = GET_THREAD();
- rb_control_frame_t *cfp = rb_vm_get_ruby_level_next_cfp(th, th->cfp);
- VALUE bindval = binding_alloc(rb_cBinding);
+ rb_control_frame_t *cfp = rb_vm_get_binding_creatable_next_cfp(th, src_cfp);
+ rb_control_frame_t *ruby_level_cfp = rb_vm_get_ruby_level_next_cfp(th, src_cfp);
+ VALUE bindval, envval;
rb_binding_t *bind;
- if (cfp == 0) {
+ if (cfp == 0 || ruby_level_cfp == 0) {
rb_raise(rb_eRuntimeError, "Can't create Binding Object on top of Fiber.");
}
+ while (1) {
+ envval = rb_vm_make_env_object(th, cfp);
+ if (cfp == ruby_level_cfp) {
+ break;
+ }
+ cfp = rb_vm_get_binding_creatable_next_cfp(th, RUBY_VM_PREVIOUS_CONTROL_FRAME(cfp));
+ }
+
+ bindval = binding_alloc(rb_cBinding);
GetBindingPtr(bindval, bind);
- bind->env = rb_vm_make_env_object(th, cfp);
- bind->filename = cfp->iseq->filename;
- bind->line_no = rb_vm_get_sourceline(cfp);
+ bind->env = envval;
+ bind->path = ruby_level_cfp->iseq->location.path;
+ bind->first_lineno = rb_vm_get_sourceline(ruby_level_cfp);
+
return bindval;
}
+VALUE
+rb_binding_new(void)
+{
+ rb_thread_t *th = GET_THREAD();
+ return rb_binding_new_with_cfp(th, th->cfp);
+}
+
/*
* call-seq:
* binding -> a_binding
@@ -374,6 +396,164 @@ 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)
+{
+ const 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_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;
+}
+
static VALUE
proc_new(VALUE klass, int is_lambda)
{
@@ -382,17 +562,13 @@ proc_new(VALUE klass, int is_lambda)
rb_control_frame_t *cfp = th->cfp;
rb_block_t *block;
- if ((GC_GUARDED_PTR_REF(cfp->lfp[0])) != 0) {
-
- block = GC_GUARDED_PTR_REF(cfp->lfp[0]);
+ if ((block = rb_vm_control_frame_block_ptr(cfp)) != 0) {
+ /* block found */
}
else {
cfp = RUBY_VM_PREVIOUS_CONTROL_FRAME(cfp);
- if ((GC_GUARDED_PTR_REF(cfp->lfp[0])) != 0) {
-
- block = GC_GUARDED_PTR_REF(cfp->lfp[0]);
-
+ if ((block = rb_vm_control_frame_block_ptr(cfp)) != 0) {
if (is_lambda) {
rb_warn("tried to create Proc object without a block");
}
@@ -411,7 +587,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;
}
}
@@ -536,6 +712,7 @@ rb_f_lambda(void)
static VALUE
proc_call(int argc, VALUE *argv, VALUE procval)
{
+ VALUE vret;
rb_proc_t *proc;
rb_block_t *blockptr = 0;
rb_iseq_t *iseq;
@@ -552,8 +729,9 @@ proc_call(int argc, VALUE *argv, VALUE procval)
}
}
- return rb_vm_invoke_proc(GET_THREAD(), proc, proc->block.self,
- argc, argv, blockptr);
+ vret = rb_vm_invoke_proc(GET_THREAD(), proc, argc, argv, blockptr);
+ RB_GC_GUARD(procval);
+ return vret;
}
#if SIZEOF_LONG > SIZEOF_INT
@@ -573,15 +751,19 @@ check_argc(long argc)
VALUE
rb_proc_call(VALUE self, VALUE args)
{
+ VALUE vret;
rb_proc_t *proc;
GetProcPtr(self, proc);
- return rb_vm_invoke_proc(GET_THREAD(), proc, proc->block.self,
- 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;
rb_block_t *block = 0;
GetProcPtr(self, proc);
@@ -592,10 +774,13 @@ rb_proc_call_with_block(VALUE self, int argc, VALUE *argv, VALUE pass_procval)
block = &pass_proc->block;
}
- return rb_vm_invoke_proc(GET_THREAD(), proc, proc->block.self,
- argc, argv, block);
+ vret = rb_vm_invoke_proc(GET_THREAD(), proc, argc, argv, block);
+ RB_GC_GUARD(self);
+ RB_GC_GUARD(pass_procval);
+ return vret;
}
+
/*
* call-seq:
* prc.arity -> fixnum
@@ -607,14 +792,25 @@ rb_proc_call_with_block(VALUE self, int argc, VALUE *argv, VALUE pass_procval)
* arguments. A <code>proc</code> with no argument declarations
* is the same a block declaring <code>||</code> as its arguments.
*
- * Proc.new {}.arity #=> 0
- * Proc.new {||}.arity #=> 0
- * Proc.new {|a|}.arity #=> 1
- * Proc.new {|a,b|}.arity #=> 2
- * Proc.new {|a,b,c|}.arity #=> 3
- * Proc.new {|*a|}.arity #=> -1
- * Proc.new {|a,*b|}.arity #=> -2
- * Proc.new {|a,*b, c|}.arity #=> -3
+ * proc {}.arity #=> 0
+ * proc {||}.arity #=> 0
+ * proc {|a|}.arity #=> 1
+ * proc {|a,b|}.arity #=> 2
+ * proc {|a,b,c|}.arity #=> 3
+ * proc {|*a|}.arity #=> -1
+ * proc {|a,*b|}.arity #=> -2
+ * proc {|a,*b, c|}.arity #=> -3
+ *
+ * proc { |x = 0| }.arity #=> 0
+ * lambda { |a = 0| }.arity #=> -1
+ * proc { |x=0, y| }.arity #=> 1
+ * lambda { |x=0, y| }.arity #=> -2
+ * proc { |x=0, y=0| }.arity #=> 0
+ * lambda { |x=0, y=0| }.arity #=> -1
+ * proc { |x, y=0| }.arity #=> 1
+ * lambda { |x, y=0| }.arity #=> -2
+ * proc { |(x, y), z=0| }.arity #=> 1
+ * lambda { |(x, y), z=0| }.arity #=> -2
*/
static VALUE
@@ -624,31 +820,79 @@ proc_arity(VALUE self)
return INT2FIX(arity);
}
-int
-rb_proc_arity(VALUE self)
+static inline int
+rb_iseq_min_max_arity(const rb_iseq_t *iseq, int *max)
{
- rb_proc_t *proc;
- rb_iseq_t *iseq;
- GetProcPtr(self, proc);
- iseq = proc->block.iseq;
+ *max = iseq->arg_rest == -1 ?
+ iseq->argc + iseq->arg_post_len + iseq->arg_opts - (iseq->arg_opts > 0)
+ : UNLIMITED_ARGUMENTS;
+ return iseq->argc + iseq->arg_post_len;
+}
+
+static int
+rb_block_min_max_arity(rb_block_t *block, int *max)
+{
+ rb_iseq_t *iseq = block->iseq;
if (iseq) {
if (BUILTIN_TYPE(iseq) != T_NODE) {
- if (iseq->arg_rest < 0) {
- return iseq->argc;
- }
- else {
- return -(iseq->argc + 1 + iseq->arg_post_len);
- }
+ return rb_iseq_min_max_arity(iseq, max);
}
else {
NODE *node = (NODE *)iseq;
if (IS_METHOD_PROC_NODE(node)) {
- /* method(:foo).to_proc.arity */
- return method_arity(node->nd_tval);
+ /* e.g. method(:foo).to_proc.arity */
+ return method_min_max_arity(node->nd_tval, max);
}
}
}
- return -1;
+ *max = UNLIMITED_ARGUMENTS;
+ 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)
+{
+ rb_proc_t *proc;
+ int max, min = rb_proc_min_max_arity(self, &max);
+ GetProcPtr(self, proc);
+ 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
@@ -680,9 +924,9 @@ iseq_location(rb_iseq_t *iseq)
VALUE loc[2];
if (!iseq) return Qnil;
- loc[0] = iseq->filename;
- if (iseq->insn_info_table) {
- loc[1] = INT2FIX(rb_iseq_first_lineno(iseq));
+ loc[0] = iseq->location.path;
+ if (iseq->line_info_table) {
+ loc[1] = rb_iseq_first_lineno(iseq->self);
}
else {
loc[1] = Qnil;
@@ -744,35 +988,14 @@ rb_proc_parameters(VALUE self)
return rb_iseq_parameters(iseq, is_proc);
}
-/*
- * call-seq:
- * prc == other_proc -> true or false
- *
- * Returns <code>true</code> if <i>prc</i> is the same object as
- * <i>other_proc</i>, or if they are both procs with the same body.
- */
-
-static VALUE
-proc_eq(VALUE self, VALUE other)
+st_index_t
+rb_hash_proc(st_index_t hash, VALUE prc)
{
- if (self == other) {
- return Qtrue;
- }
- else {
- if (rb_obj_is_proc(other)) {
- rb_proc_t *p1, *p2;
- GetProcPtr(self, p1);
- GetProcPtr(other, p2);
- if (p1->envval == p2->envval &&
- p1->block.iseq->iseq_size == p2->block.iseq->iseq_size &&
- p1->block.iseq->local_size == p2->block.iseq->local_size &&
- MEMCMP(p1->block.iseq->iseq, p2->block.iseq->iseq, VALUE,
- p1->block.iseq->iseq_size) == 0) {
- return Qtrue;
- }
- }
- }
- return Qfalse;
+ rb_proc_t *proc;
+ GetProcPtr(prc, proc);
+ hash = rb_hash_uint(hash, (st_index_t)proc->block.iseq);
+ hash = rb_hash_uint(hash, (st_index_t)proc->envval);
+ return rb_hash_uint(hash, (st_index_t)proc->block.ep >> 16);
}
/*
@@ -786,11 +1009,8 @@ static VALUE
proc_hash(VALUE self)
{
st_index_t hash;
- rb_proc_t *proc;
- GetProcPtr(self, proc);
- hash = rb_hash_start((st_index_t)proc->block.iseq);
- hash = rb_hash_uint(hash, (st_index_t)proc->envval);
- hash = rb_hash_uint(hash, (st_index_t)proc->block.lfp >> 16);
+ hash = rb_hash_start(0);
+ hash = rb_hash_proc(hash, self);
hash = rb_hash_end(hash);
return LONG2FIX(hash);
}
@@ -817,14 +1037,13 @@ proc_to_s(VALUE self)
is_lambda = proc->is_lambda ? " (lambda)" : "";
if (RUBY_VM_NORMAL_ISEQ_P(iseq)) {
- int line_no = 0;
+ int first_lineno = 0;
- if (iseq->insn_info_table) {
- line_no = rb_iseq_first_lineno(iseq);
+ if (iseq->line_info_table) {
+ first_lineno = FIX2INT(rb_iseq_first_lineno(iseq->self));
}
- str = rb_sprintf("#<%s:%p@%s:%d%s>", cname, (void *)self,
- RSTRING_PTR(iseq->filename),
- line_no, 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,
@@ -856,6 +1075,7 @@ static void
bm_mark(void *ptr)
{
struct METHOD *data = ptr;
+ rb_gc_mark(data->defined_class);
rb_gc_mark(data->rclass);
rb_gc_mark(data->recv);
if (data->me) rb_mark_method_entry(data->me);
@@ -866,6 +1086,7 @@ bm_free(void *ptr)
{
struct METHOD *data = ptr;
struct unlinked_method_entry_list_entry *ume = data->ume;
+ data->me->mark = 0;
ume->me = data->me;
ume->next = GET_VM()->unlinked_method_entry_list;
GET_VM()->unlinked_method_entry_list = ume;
@@ -885,6 +1106,7 @@ static const rb_data_type_t method_data_type = {
bm_free,
bm_memsize,
},
+ NULL, NULL, RUBY_TYPED_FREE_IMMEDIATELY
};
VALUE
@@ -899,36 +1121,24 @@ rb_obj_is_method(VALUE m)
}
static VALUE
-mnew(VALUE klass, VALUE obj, ID id, VALUE mclass, int scope)
+mnew_from_me(rb_method_entry_t *me, VALUE defined_class, VALUE klass,
+ VALUE obj, ID id, VALUE mclass, int scope)
{
VALUE method;
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(klass, id);
if (UNDEFINED_METHOD_ENTRY_P(me)) {
- ID rmiss = rb_intern("respond_to_missing?");
+ 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;
goto gen_method;
}
@@ -944,27 +1154,28 @@ mnew(VALUE klass, VALUE obj, ID id, VALUE mclass, int scope)
case NOEX_PRIVATE: v = "private"; break;
case NOEX_PROTECTED: v = "protected"; break;
}
- rb_name_error(id, "method `%s' for %s `%s' is %s",
+ rb_name_error(id, "method `%s' for %s `% "PRIsVALUE"' is %s",
rb_id2name(id),
- (TYPE(klass) == T_MODULE) ? "module" : "class",
- rb_class2name(klass),
+ (RB_TYPE_P(klass, T_MODULE)) ? "module" : "class",
+ rb_class_name(klass),
v);
}
}
if (def && def->type == VM_METHOD_TYPE_ZSUPER) {
- klass = RCLASS_SUPER(me->klass);
+ klass = RCLASS_SUPER(defined_class);
id = def->original_id;
+ me = rb_method_entry_without_refinements(klass, id, &defined_class);
goto again;
}
- klass = me->klass;
+ klass = defined_class;
while (rclass != klass &&
- (FL_TEST(rclass, FL_SINGLETON) || TYPE(rclass) == T_ICLASS)) {
+ (FL_TEST(rclass, FL_SINGLETON) || RB_TYPE_P(rclass, T_ICLASS))) {
rclass = RCLASS_SUPER(rclass);
}
- if (TYPE(klass) == T_ICLASS) {
+ if (RB_TYPE_P(klass, T_ICLASS)) {
klass = RBASIC(klass)->klass;
}
@@ -973,17 +1184,45 @@ mnew(VALUE klass, VALUE obj, ID id, VALUE mclass, int scope)
data->recv = obj;
data->rclass = rclass;
+ 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(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);
+}
+
/**********************************************************************
*
@@ -1011,10 +1250,12 @@ 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
- * object and refer to the same method definition.
+ * object and refer to the same method definition and their owners are the
+ * same class or module.
*/
static VALUE
@@ -1056,7 +1297,7 @@ method_hash(VALUE method)
TypedData_Get_Struct(method, struct METHOD, &method_data_type, m);
hash = rb_hash_start((st_index_t)m->rclass);
hash = rb_hash_uint(hash, (st_index_t)m->recv);
- hash = rb_hash_uint(hash, (st_index_t)m->me->def);
+ hash = rb_hash_method_entry(hash, m->me);
hash = rb_hash_end(hash);
return INT2FIX(hash);
@@ -1086,6 +1327,7 @@ method_unbind(VALUE obj)
*data->me = *orig->me;
if (orig->me->def) orig->me->def->alias_count++;
data->rclass = orig->rclass;
+ data->defined_class = orig->defined_class;
data->ume = ALLOC(struct unlinked_method_entry_list_entry);
OBJ_INFECT(method, obj);
@@ -1126,6 +1368,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.
@@ -1140,6 +1398,29 @@ method_owner(VALUE obj)
return data->me->klass;
}
+void
+rb_method_name_error(VALUE klass, VALUE str)
+{
+ const char *s0 = " class";
+ VALUE c = klass;
+
+ if (FL_TEST(c, FL_SINGLETON)) {
+ VALUE obj = rb_ivar_get(klass, attached);
+
+ switch (TYPE(obj)) {
+ case T_MODULE:
+ case T_CLASS:
+ c = obj;
+ s0 = "";
+ }
+ }
+ else if (RB_TYPE_P(c, T_MODULE)) {
+ s0 = " module";
+ }
+ rb_name_error_str(str, "undefined method `%"PRIsVALUE"' for%s `%"PRIsVALUE"'",
+ QUOTE(str), s0, rb_class_name(c));
+}
+
/*
* call-seq:
* obj.method(sym) -> method
@@ -1171,7 +1452,11 @@ method_owner(VALUE obj)
VALUE
rb_obj_method(VALUE obj, VALUE vid)
{
- return mnew(CLASS_OF(obj), obj, rb_to_id(vid), rb_cMethod, FALSE);
+ ID id = rb_check_id(&vid);
+ if (!id) {
+ rb_method_name_error(CLASS_OF(obj), vid);
+ }
+ return mnew(CLASS_OF(obj), obj, id, rb_cMethod, FALSE);
}
/*
@@ -1184,7 +1469,53 @@ rb_obj_method(VALUE obj, VALUE vid)
VALUE
rb_obj_public_method(VALUE obj, VALUE vid)
{
- return mnew(CLASS_OF(obj), obj, rb_to_id(vid), rb_cMethod, TRUE);
+ ID id = rb_check_id(&vid);
+ if (!id) {
+ rb_method_name_error(CLASS_OF(obj), vid);
+ }
+ return mnew(CLASS_OF(obj), obj, id, rb_cMethod, TRUE);
+}
+
+/*
+ * 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);
}
/*
@@ -1221,7 +1552,11 @@ rb_obj_public_method(VALUE obj, VALUE vid)
static VALUE
rb_mod_instance_method(VALUE mod, VALUE vid)
{
- return mnew(mod, Qundef, rb_to_id(vid), rb_cUnboundMethod, FALSE);
+ ID id = rb_check_id(&vid);
+ if (!id) {
+ rb_method_name_error(mod, vid);
+ }
+ return mnew(mod, Qundef, id, rb_cUnboundMethod, FALSE);
}
/*
@@ -1234,13 +1569,17 @@ rb_mod_instance_method(VALUE mod, VALUE vid)
static VALUE
rb_mod_public_instance_method(VALUE mod, VALUE vid)
{
- return mnew(mod, Qundef, rb_to_id(vid), rb_cUnboundMethod, TRUE);
+ ID id = rb_check_id(&vid);
+ if (!id) {
+ rb_method_name_error(mod, vid);
+ }
+ return mnew(mod, Qundef, id, rb_cUnboundMethod, TRUE);
}
/*
* 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.
@@ -1279,13 +1618,14 @@ rb_mod_define_method(int argc, VALUE *argv, VALUE mod)
{
ID id;
VALUE body;
- int noex = NOEX_PUBLIC;
+ int noex = (int)rb_vm_cref()->nd_visi;
if (argc == 1) {
id = rb_to_id(argv[0]);
body = rb_block_lambda();
}
- else if (argc == 2) {
+ else {
+ rb_check_arity(argc, 1, 2);
id = rb_to_id(argv[0]);
body = argv[1];
if (!rb_obj_is_method(body) && !rb_obj_is_proc(body)) {
@@ -1294,25 +1634,26 @@ rb_mod_define_method(int argc, VALUE *argv, VALUE mod)
rb_obj_classname(body));
}
}
- else {
- rb_raise(rb_eArgError, "wrong number of arguments (%d for 1)", argc);
- }
if (rb_obj_is_method(body)) {
struct METHOD *method = (struct METHOD *)DATA_PTR(body);
VALUE rclass = method->rclass;
- if (rclass != mod && !RTEST(rb_class_inherited_p(mod, rclass))) {
+ if (rclass != mod && !RB_TYPE_P(rclass, T_MODULE) &&
+ !RTEST(rb_class_inherited_p(mod, rclass))) {
if (FL_TEST(rclass, FL_SINGLETON)) {
rb_raise(rb_eTypeError,
"can't bind singleton method to a different class");
}
else {
rb_raise(rb_eTypeError,
- "bind argument must be a subclass of %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;
@@ -1320,18 +1661,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;
+ 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);
}
/*
@@ -1368,9 +1713,44 @@ rb_obj_define_method(int argc, VALUE *argv, VALUE obj)
return rb_mod_define_method(argc, argv, klass);
}
+/*
+ * define_method(symbol, method) -> new_method
+ * define_method(symbol) { block } -> proc
+ *
+ * Defines a global function by _method_ or the block.
+ */
+
+static VALUE
+top_define_method(int argc, VALUE *argv, VALUE obj)
+{
+ rb_thread_t *th = GET_THREAD();
+ VALUE klass;
+
+ klass = th->top_wrapper;
+ if (klass) {
+ rb_warning("main.define_method in the wrapped load is effective only in wrapper module");
+ }
+ else {
+ klass = rb_cObject;
+ }
+ return rb_mod_define_method(argc, argv, klass);
+}
/*
- * MISSING: documentation
+ * call-seq:
+ * method.clone -> new_method
+ *
+ * Returns a clone of this method.
+ *
+ * class A
+ * def foo
+ * return "bar"
+ * end
+ * end
+ *
+ * m = A.new.method(:foo)
+ * m.call # => "bar"
+ * n = m.clone.call # => "bar"
*/
static VALUE
@@ -1425,9 +1805,10 @@ rb_method_call_with_block(int argc, VALUE *argv, VALUE method, VALUE pass_procva
}
PUSH_TAG();
if (OBJ_TAINTED(method)) {
+ const int safe_level_to_run = 4 /*SAFE_LEVEL_MAX*/;
safe = rb_safe_level();
- if (rb_safe_level() < 4) {
- rb_set_safe_level_force(4);
+ if (rb_safe_level() < safe_level_to_run) {
+ rb_set_safe_level_force(safe_level_to_run);
}
}
if ((state = EXEC_TAG()) == 0) {
@@ -1441,7 +1822,7 @@ 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);
+ result = rb_vm_call(th, data->recv, data->id, argc, argv, data->me, data->defined_class);
}
POP_TAG();
if (safe >= 0)
@@ -1546,17 +1927,20 @@ static VALUE
umethod_bind(VALUE method, VALUE recv)
{
struct METHOD *data, *bound;
+ VALUE methclass;
TypedData_Get_Struct(method, struct METHOD, &method_data_type, data);
- if (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));
}
}
@@ -1572,48 +1956,65 @@ umethod_bind(VALUE method, VALUE recv)
return method;
}
-int
-rb_method_entry_arity(const rb_method_entry_t *me)
+/*
+ * Returns the number of required parameters and stores the maximum
+ * number of parameters in max, or UNLIMITED_ARGUMENTS
+ * if there is no maximum.
+ */
+static int
+rb_method_entry_min_max_arity(const rb_method_entry_t *me, int *max)
{
const rb_method_definition_t *def = me->def;
- if (!def) return 0;
+ if (!def) return *max = 0;
switch (def->type) {
case VM_METHOD_TYPE_CFUNC:
- if (def->body.cfunc.argc < 0)
- return -1;
- return check_argc(def->body.cfunc.argc);
+ if (def->body.cfunc.argc < 0) {
+ *max = UNLIMITED_ARGUMENTS;
+ return 0;
+ }
+ return *max = check_argc(def->body.cfunc.argc);
case VM_METHOD_TYPE_ZSUPER:
- return -1;
+ *max = UNLIMITED_ARGUMENTS;
+ return 0;
case VM_METHOD_TYPE_ATTRSET:
- return 1;
+ return *max = 1;
case VM_METHOD_TYPE_IVAR:
- return 0;
+ return *max = 0;
case VM_METHOD_TYPE_BMETHOD:
- return rb_proc_arity(def->body.proc);
+ return rb_proc_min_max_arity(def->body.proc, max);
case VM_METHOD_TYPE_ISEQ: {
rb_iseq_t *iseq = def->body.iseq;
- if (iseq->arg_rest == -1 && iseq->arg_opts == 0) {
- return iseq->argc;
- }
- else {
- return -(iseq->argc + 1 + iseq->arg_post_len);
- }
+ return rb_iseq_min_max_arity(iseq, max);
}
case VM_METHOD_TYPE_UNDEF:
case VM_METHOD_TYPE_NOTIMPLEMENTED:
- return 0;
+ return *max = 0;
case VM_METHOD_TYPE_MISSING:
- return -1;
+ *max = UNLIMITED_ARGUMENTS;
+ return 0;
case VM_METHOD_TYPE_OPTIMIZED: {
switch (def->body.optimize_type) {
case OPTIMIZED_METHOD_TYPE_SEND:
- return -1;
+ *max = UNLIMITED_ARGUMENTS;
+ return 0;
default:
break;
}
+ break;
}
+ case VM_METHOD_TYPE_REFINED:
+ *max = UNLIMITED_ARGUMENTS;
+ return 0;
}
- rb_bug("rb_method_entry_arity: invalid method entry type (%d)", def->type);
+ rb_bug("rb_method_entry_min_max_arity: invalid method entry type (%d)", def->type);
+ UNREACHABLE;
+}
+
+int
+rb_method_entry_arity(const rb_method_entry_t *me)
+{
+ int max, min = rb_method_entry_min_max_arity(me, &max);
+ return min == max ? min : -min-1;
}
/*
@@ -1665,10 +2066,35 @@ method_arity(VALUE method)
return rb_method_entry_arity(data->me);
}
+static rb_method_entry_t *
+original_method_entry(VALUE mod, ID id)
+{
+ VALUE rclass;
+ rb_method_entry_t *me;
+ while ((me = rb_method_entry(mod, id, &rclass)) != 0) {
+ rb_method_definition_t *def = me->def;
+ if (!def) break;
+ if (def->type != VM_METHOD_TYPE_ZSUPER) break;
+ mod = RCLASS_SUPER(rclass);
+ id = def->original_id;
+ }
+ return me;
+}
+
+static int
+method_min_max_arity(VALUE method, int *max)
+{
+ struct METHOD *data;
+
+ TypedData_Get_Struct(method, struct METHOD, &method_data_type, data);
+ return rb_method_entry_min_max_arity(data->me, max);
+}
+
int
rb_mod_method_arity(VALUE mod, ID id)
{
- rb_method_entry_t *me = rb_method_entry(mod, id);
+ rb_method_entry_t *me = original_method_entry(mod, id);
+ if (!me) return 0; /* should raise? */
return rb_method_entry_arity(me);
}
@@ -1706,6 +2132,37 @@ rb_method_get_iseq(VALUE method)
return method_get_iseq(method_get_def(method));
}
+static VALUE
+method_def_location(rb_method_definition_t *def)
+{
+ if (def->type == VM_METHOD_TYPE_ATTRSET || def->type == VM_METHOD_TYPE_IVAR) {
+ if (!def->body.attr.location)
+ return Qnil;
+ return rb_ary_dup(def->body.attr.location);
+ }
+ return iseq_location(method_get_iseq(def));
+}
+
+VALUE
+rb_method_entry_location(rb_method_entry_t *me)
+{
+ if (!me || !me->def) return Qnil;
+ return method_def_location(me->def);
+}
+
+VALUE
+rb_mod_method_location(VALUE mod, ID id)
+{
+ rb_method_entry_t *me = original_method_entry(mod, id);
+ return rb_method_entry_location(me);
+}
+
+VALUE
+rb_obj_method_location(VALUE obj, ID id)
+{
+ return rb_mod_method_location(CLASS_OF(obj), id);
+}
+
/*
* call-seq:
* meth.source_location -> [String, Fixnum]
@@ -1718,12 +2175,7 @@ VALUE
rb_method_location(VALUE method)
{
rb_method_definition_t *def = method_get_def(method);
- if (def->type == VM_METHOD_TYPE_ATTRSET || def->type == VM_METHOD_TYPE_IVAR) {
- if (!def->body.attr.location)
- return Qnil;
- return rb_ary_dup(def->body.attr.location);
- }
- return iseq_location(method_get_iseq(def));
+ return method_def_location(def);
}
/*
@@ -1768,7 +2220,7 @@ method_inspect(VALUE method)
rb_str_buf_cat2(str, ": ");
if (FL_TEST(data->me->klass, FL_SINGLETON)) {
- VALUE v = rb_iv_get(data->me->klass, "__attached__");
+ VALUE v = rb_ivar_get(data->me->klass, attached);
if (data->recv == Qundef) {
rb_str_buf_append(str, rb_inspect(data->me->klass));
@@ -1786,15 +2238,19 @@ method_inspect(VALUE method)
}
}
else {
- rb_str_buf_cat2(str, rb_class2name(data->rclass));
+ rb_str_buf_append(str, rb_class_name(data->rclass));
if (data->rclass != data->me->klass) {
rb_str_buf_cat2(str, "(");
- rb_str_buf_cat2(str, rb_class2name(data->me->klass));
+ rb_str_buf_append(str, rb_class_name(data->me->klass));
rb_str_buf_cat2(str, ")");
}
}
rb_str_buf_cat2(str, sharp);
- rb_str_append(str, rb_id2str(data->me->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)");
}
@@ -1870,7 +2326,7 @@ method_proc(VALUE method)
}
/*
- * call_seq:
+ * call-seq:
* local_jump_error.exit_value -> obj
*
* Returns the exit value associated with this +LocalJumpError+.
@@ -1918,7 +2374,7 @@ proc_binding(VALUE self)
rb_binding_t *bind;
GetProcPtr(self, proc);
- if (TYPE(proc->block.iseq) == T_NODE) {
+ if (RB_TYPE_P((VALUE)proc->block.iseq, T_NODE)) {
if (!IS_METHOD_PROC_NODE((NODE *)proc->block.iseq)) {
rb_raise(rb_eArgError, "Can't create Binding from C level Proc");
}
@@ -1928,12 +2384,12 @@ proc_binding(VALUE self)
GetBindingPtr(bindval, bind);
bind->env = proc->envval;
if (RUBY_VM_NORMAL_ISEQ_P(proc->block.iseq)) {
- bind->filename = proc->block.iseq->filename;
- bind->line_no = rb_iseq_first_lineno(proc->block.iseq);
+ bind->path = proc->block.iseq->location.path;
+ bind->first_lineno = FIX2INT(rb_iseq_first_lineno(proc->block.iseq->self));
}
else {
- bind->filename = Qnil;
- bind->line_no = 0;
+ bind->path = Qnil;
+ bind->first_lineno = 0;
}
return bindval;
}
@@ -1961,9 +2417,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);
@@ -1976,8 +2432,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);
}
}
@@ -2026,22 +2481,17 @@ curry(VALUE dummy, VALUE args, int argc, VALUE *argv, VALUE passed_proc)
static VALUE
proc_curry(int argc, VALUE *argv, VALUE self)
{
- int sarity, marity = rb_proc_arity(self);
- VALUE arity, opt = Qfalse;
-
- if (marity < 0) {
- marity = -marity - 1;
- opt = Qtrue;
- }
+ int sarity, max_arity, min_arity = rb_proc_min_max_arity(self, &max_arity);
+ VALUE arity;
rb_scan_args(argc, argv, "01", &arity);
if (NIL_P(arity)) {
- arity = INT2FIX(marity);
+ arity = INT2FIX(min_arity);
}
else {
sarity = FIX2INT(arity);
- if (rb_proc_lambda_p(self) && (sarity < marity || (sarity > marity && !opt))) {
- rb_raise(rb_eArgError, "wrong number of arguments (%d for %d)", sarity, marity);
+ if (rb_proc_lambda_p(self)) {
+ rb_check_arity(sarity, min_arity, max_arity);
}
}
@@ -2136,10 +2586,9 @@ Init_Proc(void)
rb_define_method(rb_cProc, "arity", proc_arity, 0);
rb_define_method(rb_cProc, "clone", proc_clone, 0);
rb_define_method(rb_cProc, "dup", proc_dup, 0);
- rb_define_method(rb_cProc, "==", proc_eq, 1);
- rb_define_method(rb_cProc, "eql?", proc_eq, 1);
rb_define_method(rb_cProc, "hash", proc_hash, 0);
rb_define_method(rb_cProc, "to_s", proc_to_s, 0);
+ rb_define_alias(rb_cProc, "inspect", "to_s");
rb_define_method(rb_cProc, "lambda?", rb_proc_lambda_p, 0);
rb_define_method(rb_cProc, "binding", proc_binding, 0);
rb_define_method(rb_cProc, "curry", proc_curry, -1);
@@ -2176,12 +2625,14 @@ 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_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);
@@ -2195,6 +2646,7 @@ 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);
@@ -2207,6 +2659,9 @@ Init_Proc(void)
/* Kernel */
rb_define_method(rb_mKernel, "define_singleton_method", rb_obj_define_method, -1);
+
+ rb_define_private_method(rb_singleton_class(rb_vm_top_self()),
+ "define_method", top_define_method, -1);
}
/*
@@ -2253,6 +2708,9 @@ Init_Binding(void)
rb_define_method(rb_cBinding, "clone", binding_clone, 0);
rb_define_method(rb_cBinding, "dup", binding_dup, 0);
rb_define_method(rb_cBinding, "eval", bind_eval, -1);
+ rb_define_method(rb_cBinding, "local_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_global_function("binding", rb_f_binding, 0);
}
diff --git a/process.c b/process.c
index 99cfc69469..c12182abfe 100644
--- a/process.c
+++ b/process.c
@@ -13,6 +13,7 @@
#include "ruby/ruby.h"
#include "ruby/io.h"
+#include "ruby/thread.h"
#include "ruby/util.h"
#include "internal.h"
#include "vm_core.h"
@@ -62,15 +63,29 @@
#endif
#include <sys/stat.h>
+#if defined(__native_client__) && defined(NACL_NEWLIB)
+# include "nacl/stat.h"
+# 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
+#ifdef HAVE_PWD_H
+#include <pwd.h>
+#endif
#ifdef HAVE_GRP_H
#include <grp.h>
#endif
+#ifdef __APPLE__
+# include <mach/mach_time.h>
+#endif
+
#if defined(HAVE_TIMES) || defined(_WIN32)
static VALUE rb_cProcessTms;
#endif
@@ -94,10 +109,6 @@ static VALUE rb_cProcessTms;
#define WSTOPSIG WEXITSTATUS
#endif
-#if defined(__APPLE__) && ( defined(__MACH__) || defined(__DARWIN__) ) && !defined(__MacOS_X__)
-#define __MacOS_X__ 1
-#endif
-
#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__bsdi__)
#define HAVE_44BSD_SETUID 1
#define HAVE_44BSD_SETGID 1
@@ -117,7 +128,7 @@ int setreuid(rb_uid_t ruid, rb_uid_t euid);
int setregid(rb_gid_t rgid, rb_gid_t egid);
#endif
-#if defined(HAVE_44BSD_SETUID) || defined(__MacOS_X__)
+#if defined(HAVE_44BSD_SETUID) || defined(__APPLE__)
#if !defined(USE_SETREUID) && !defined(BROKEN_SETREUID)
#define OBSOLETE_SETREUID 1
#endif
@@ -129,6 +140,69 @@ int setregid(rb_gid_t rgid, rb_gid_t egid);
#define preserving_errno(stmts) \
do {int saved_errno = errno; stmts; errno = saved_errno;} while (0)
+static void check_uid_switch(void);
+static void check_gid_switch(void);
+
+#if 1
+#define p_uid_from_name p_uid_from_name
+#define p_gid_from_name p_gid_from_name
+#endif
+
+#if defined(HAVE_PWD_H)
+# if defined(HAVE_GETPWNAM_R) && defined(_SC_GETPW_R_SIZE_MAX)
+# define USE_GETPWNAM_R 1
+# 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);
+# else
+# define PREPARE_GETPWNAM /* do nothing */
+# define OBJ2UID(id) obj2uid((id))
+static rb_uid_t obj2uid(VALUE id);
+# endif
+#else
+# define PREPARE_GETPWNAM /* do nothing */
+# define OBJ2UID(id) NUM2UIDT(id)
+# ifdef p_uid_from_name
+# undef p_uid_from_name
+# define p_uid_from_name rb_f_notimplement
+# endif
+#endif
+
+#if defined(HAVE_GRP_H)
+# if defined(HAVE_GETGRNAM_R) && defined(_SC_GETGR_R_SIZE_MAX)
+# define USE_GETGRNAM_R
+# 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);
+# else
+# define PREPARE_GETGRNAM /* do nothing */
+# define OBJ2GID(id) obj2gid((id))
+static rb_gid_t obj2gid(VALUE id);
+# endif
+#else
+# define PREPARE_GETGRNAM /* do nothing */
+# define OBJ2GID(id) NUM2GIDT(id)
+# ifdef p_gid_from_name
+# undef p_gid_from_name
+# define p_gid_from_name rb_f_notimplement
+# 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:
@@ -219,7 +293,7 @@ rb_last_status_set(int status, rb_pid_t pid)
rb_iv_set(th->last_status, "pid", PIDT2NUM(pid));
}
-static void
+void
rb_last_status_clear(void)
{
GET_THREAD()->last_status = Qnil;
@@ -622,7 +696,7 @@ struct waitpid_arg {
};
#endif
-static VALUE
+static void *
rb_waitpid_blocking(void *data)
{
rb_pid_t result;
@@ -638,7 +712,7 @@ rb_waitpid_blocking(void *data)
result = wait4(arg->pid, arg->st, arg->flags, NULL);
#endif
- return (VALUE)result;
+ return (void *)(VALUE)result;
}
rb_pid_t
@@ -652,11 +726,11 @@ rb_waitpid(rb_pid_t pid, int *st, int flags)
arg.pid = pid;
arg.st = st;
arg.flags = flags;
- result = (rb_pid_t)rb_thread_blocking_region(rb_waitpid_blocking, &arg,
- RUBY_UBF_PROCESS, 0);
+ result = (rb_pid_t)(VALUE)rb_thread_call_without_gvl(rb_waitpid_blocking, &arg,
+ RUBY_UBF_PROCESS, 0);
if (result < 0) {
if (errno == EINTR) {
- RUBY_VM_CHECK_INTS();
+ RUBY_VM_CHECK_INTS(GET_THREAD());
goto retry;
}
return (rb_pid_t)-1;
@@ -685,8 +759,8 @@ rb_waitpid(rb_pid_t pid, int *st, int flags)
}
for (;;) {
- result = (rb_pid_t)rb_thread_blocking_region(rb_waitpid_blocking,
- st, RUBY_UBF_PROCESS, 0);
+ result = (rb_pid_t)(VALUE)rb_thread_blocking_region(rb_waitpid_blocking,
+ st, RUBY_UBF_PROCESS, 0);
if (result < 0) {
if (errno == EINTR) {
rb_thread_schedule();
@@ -752,8 +826,8 @@ rb_waitpid(rb_pid_t pid, int *st, int flags)
* haven't been reported). Not all flags are available on all
* platforms, but a flag value of zero will work on all platforms.
*
- * Calling this method raises a <code>SystemError</code> if there are
- * no child processes. Not available on all platforms.
+ * Calling this method raises a SystemCallError if there are no child
+ * processes. Not available on all platforms.
*
* include Process
* fork { exit 99 } #=> 27429
@@ -805,8 +879,7 @@ proc_wait(int argc, VALUE *argv)
* Waits for a child process to exit (see Process::waitpid for exact
* semantics) and returns an array containing the process id and the
* exit status (a <code>Process::Status</code> object) of that
- * child. Raises a <code>SystemError</code> if there are no child
- * processes.
+ * child. Raises a SystemCallError if there are no child processes.
*
* Process.fork { exit 99 } #=> 27437
* pid, status = Process.wait2
@@ -975,34 +1048,23 @@ proc_detach(VALUE obj, VALUE pid)
return rb_detach_process(NUM2PIDT(pid));
}
-#ifndef HAVE_STRING_H
-char *strtok();
-#endif
-
static int forked_child = 0;
#ifdef SIGPIPE
static RETSIGTYPE (*saved_sigpipe_handler)(int) = 0;
#endif
-#if defined(POSIX_SIGNAL)
-# define signal(a,b) posix_signal((a),(b))
-#endif
-
#ifdef SIGPIPE
-static RETSIGTYPE sig_do_nothing(int sig)
+static RETSIGTYPE
+sig_do_nothing(int sig)
{
}
#endif
-static void before_exec(void)
+/* This function should be async-signal-safe. Actually it is. */
+static void
+before_exec_async_signal_safe(void)
{
- /*
- * signalmask is inherited across exec() and almost system commands don't
- * work if signalmask is blocked.
- */
- rb_enable_interrupt();
-
#ifdef SIGPIPE
/*
* Some OS commands don't initialize signal handler properly. Thus we have
@@ -1010,34 +1072,59 @@ static void before_exec(void)
* child process interaction might fail. (e.g. ruby -e "system 'yes | ls'")
* [ruby-dev:12261]
*/
- saved_sigpipe_handler = signal(SIGPIPE, sig_do_nothing);
+ saved_sigpipe_handler = signal(SIGPIPE, sig_do_nothing); /* async-signal-safe */
#endif
+}
+static void
+before_exec_non_async_signal_safe(void)
+{
if (!forked_child) {
/*
- * On Mac OS X 10.5.x (Leopard) or earlier, exec() may return ENOTSUPP
+ * 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]
+ * 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 after_exec(void)
+static void
+before_exec(void)
{
- rb_thread_reset_timer_thread();
- rb_thread_start_timer_thread();
+ before_exec_non_async_signal_safe();
+ before_exec_async_signal_safe();
+}
+/* This function should be async-signal-safe. Actually it is. */
+static void
+after_exec_async_signal_safe(void)
+{
#ifdef SIGPIPE
- signal(SIGPIPE, saved_sigpipe_handler);
+ signal(SIGPIPE, saved_sigpipe_handler); /* async-signal-safe */
#endif
+}
+
+static void
+after_exec_non_async_signal_safe(void)
+{
+ rb_thread_reset_timer_thread();
+ rb_thread_start_timer_thread();
forked_child = 0;
- rb_disable_interrupt();
+}
+
+static void
+after_exec(void)
+{
+ after_exec_async_signal_safe();
+ after_exec_non_async_signal_safe();
}
#define before_fork() before_exec()
-#define after_fork() (GET_THREAD()->thrown_errinfo = 0, after_exec())
+#define after_fork() (rb_threadptr_pending_interrupt_clear(GET_THREAD()), after_exec())
#include "dln.h"
@@ -1051,44 +1138,49 @@ security(const char *str)
}
}
-#ifdef HAVE_FORK
-#define try_with_sh(prog, argv) ((saved_errno == ENOEXEC) ? exec_with_sh((prog), (argv)) : (void)0)
+#if defined(HAVE_FORK) && !defined(__native_client__)
+
+/* try_with_sh and exec_with_sh should be async-signal-safe. Actually it is.*/
+#define try_with_sh(prog, argv, envp) ((saved_errno == ENOEXEC) ? exec_with_sh((prog), (argv), (envp)) : (void)0)
static void
-exec_with_sh(const char *prog, char **argv)
+exec_with_sh(const char *prog, char **argv, char **envp)
{
*argv = (char *)prog;
*--argv = (char *)"sh";
- execv("/bin/sh", argv);
+ if (envp)
+ execve("/bin/sh", argv, envp); /* async-signal-safe */
+ else
+ execv("/bin/sh", argv); /* async-signal-safe */
}
-#define ARGV_COUNT(n) ((n)+1)
+
#else
-#define try_with_sh(prog, argv) (void)0
-#define ARGV_COUNT(n) (n)
+#define try_with_sh(prog, argv, envp) (void)0
#endif
-#define ARGV_SIZE(n) (sizeof(char*) * ARGV_COUNT(n))
-#define ALLOC_ARGV(n, v) ALLOCV_N(char*, (v), ARGV_COUNT(n))
-#define ALLOC_ARGV_WITH_STR(n, v, s, l) \
- (char **)(((s) = ALLOCV_N(char, (v), ARGV_SIZE(n) + (l)) + ARGV_SIZE(n)) - ARGV_SIZE(n))
+/* This function should be async-signal-safe. Actually it is. */
static int
-proc_exec_v(char **argv, const char *prog)
+proc_exec_cmd(const char *prog, VALUE argv_str, VALUE envp_str)
{
- char fbuf[MAXPATHLEN];
-#if defined(__EMX__) || defined(OS2)
+#ifdef __native_client__
+ rb_notimplement();
+ UNREACHABLE;
+#else
+ char **argv;
+ char **envp;
+# if defined(__EMX__) || defined(OS2)
char **new_argv = NULL;
-#endif
+# endif
+
+ argv = ARGVSTR2ARGV(argv_str);
- if (!prog)
- prog = argv[0];
- prog = dln_find_exe_r(prog, 0, fbuf, sizeof(fbuf));
if (!prog) {
errno = ENOENT;
return -1;
}
-#if defined(__EMX__) || defined(OS2)
+# if defined(__EMX__) || defined(OS2)
{
-#define COMMAND "cmd.exe"
+# define COMMAND "cmd.exe"
char *extension;
if ((extension = strrchr(prog, '.')) != NULL && STRCASECMP(extension, ".bat") == 0) {
@@ -1113,22 +1205,50 @@ proc_exec_v(char **argv, const char *prog)
}
}
}
-#endif /* __EMX__ */
- before_exec();
- execv(prog, argv);
- preserving_errno(try_with_sh(prog, argv); after_exec());
-#if defined(__EMX__) || defined(OS2)
+# endif /* __EMX__ */
+ envp = envp_str ? (char **)RSTRING_PTR(envp_str) : NULL;
+ if (envp_str)
+ execve(prog, argv, envp); /* async-signal-safe */
+ else
+ execv(prog, argv); /* async-signal-safe */
+ preserving_errno(try_with_sh(prog, argv, envp)); /* try_with_sh() is async-signal-safe. */
+# if defined(__EMX__) || defined(OS2)
if (new_argv) {
xfree(new_argv[0]);
xfree(new_argv);
}
+# endif
+ return -1;
#endif
+}
+
+/* deprecated */
+static int
+proc_exec_v(char **argv, const char *prog)
+{
+ char fbuf[MAXPATHLEN];
+
+ if (!prog)
+ prog = argv[0];
+ prog = dln_find_exe_r(prog, 0, fbuf, sizeof(fbuf));
+ if (!prog) {
+ errno = ENOENT;
+ return -1;
+ }
+ before_exec();
+ execv(prog, argv);
+ preserving_errno(try_with_sh(prog, argv, 0); after_exec());
return -1;
}
+/* deprecated */
int
rb_proc_exec_n(int argc, VALUE *argv, const char *prog)
{
+#define ARGV_COUNT(n) ((n)+1)
+#define ARGV_SIZE(n) (sizeof(char*) * ARGV_COUNT(n))
+#define ALLOC_ARGV(n, v) ALLOCV_N(char*, (v), ARGV_COUNT(n))
+
char **args;
int i;
int ret = -1;
@@ -1143,96 +1263,128 @@ rb_proc_exec_n(int argc, VALUE *argv, const char *prog)
ret = proc_exec_v(args, prog);
}
ALLOCV_END(v);
- return -1;
+ return ret;
+
+#undef ARGV_COUNT
+#undef ARGV_SIZE
+#undef ALLOC_ARGV
}
-int
-rb_proc_exec(const char *str)
+/* This function should be async-signal-safe. Actually it is. */
+static int
+proc_exec_sh(const char *str, VALUE envp_str)
{
-#ifndef _WIN32
- const char *s = str;
- char *ss, *t;
- char **argv, **a;
- VALUE v;
- int ret = -1;
-#endif
+#ifdef __native_client__
+ rb_notimplement();
+ UNREACHABLE;
+#else
+ const char *s;
- while (*str && ISSPACE(*str))
- str++;
+ s = str;
+ while (*s == ' ' || *s == '\t' || *s == '\n')
+ s++;
+
+ if (!*s) {
+ errno = ENOENT;
+ return -1;
+ }
#ifdef _WIN32
- before_exec();
- rb_w32_spawn(P_OVERLAY, (char *)str, 0);
- after_exec();
+ rb_w32_uspawn(P_OVERLAY, (char *)str, 0);
return -1;
#else
- for (s=str; *s; s++) {
- if (ISSPACE(*s)) {
- const char *p, *nl = NULL;
- for (p = s; ISSPACE(*p); p++) {
- if (*p == '\n') nl = p;
- }
- if (!*p) break;
- if (nl) s = nl;
- }
- if (*s != ' ' && !ISALPHA(*s) && strchr("*?{}[]<>()~&|\\$;'`\"\n",*s)) {
#if defined(__CYGWIN32__) || defined(__EMX__)
- char fbuf[MAXPATHLEN];
- char *shell = dln_find_exe_r("sh", 0, fbuf, sizeof(fbuf));
- int status = -1;
- before_exec();
- if (shell)
- execl(shell, "sh", "-c", str, (char *) NULL);
- else
- status = system(str);
- after_exec();
- if (status != -1)
- exit(status);
+ {
+ char fbuf[MAXPATHLEN];
+ char *shell = dln_find_exe_r("sh", 0, fbuf, sizeof(fbuf));
+ int status = -1;
+ if (shell)
+ execl(shell, "sh", "-c", str, (char *) NULL);
+ else
+ status = system(str);
+ if (status != -1)
+ exit(status);
+ }
#else
- before_exec();
- execl("/bin/sh", "sh", "-c", str, (char *)NULL);
- preserving_errno(after_exec());
+ if (envp_str)
+ execle("/bin/sh", "sh", "-c", str, (char *)NULL, (char **)RSTRING_PTR(envp_str)); /* async-signal-safe */
+ else
+ execl("/bin/sh", "sh", "-c", str, (char *)NULL); /* async-signal-safe */
#endif
- return -1;
- }
- }
- a = argv = ALLOC_ARGV_WITH_STR((s-str)/2+2, v, ss, s-str+1);
- memcpy(ss, str, s-str);
- ss[s-str] = '\0';
- if ((*a++ = strtok(ss, " \t")) != 0) {
- while ((t = strtok(NULL, " \t")) != 0) {
- *a++ = t;
- }
- *a = NULL;
- }
- if (argv[0]) {
- ret = proc_exec_v(argv, 0);
- }
- else {
- errno = ENOENT;
- }
- ALLOCV_END(v);
- return ret;
+ return -1;
#endif /* _WIN32 */
+#endif
+}
+
+int
+rb_proc_exec(const char *str)
+{
+ int ret;
+ before_exec();
+ ret = proc_exec_sh(str, Qfalse);
+ preserving_errno(after_exec());
+ return ret;
+}
+
+static void
+mark_exec_arg(void *ptr)
+{
+ struct rb_execarg *eargp = ptr;
+ if (eargp->use_shell)
+ rb_gc_mark(eargp->invoke.sh.shell_script);
+ else {
+ rb_gc_mark(eargp->invoke.cmd.command_name);
+ rb_gc_mark(eargp->invoke.cmd.command_abspath);
+ rb_gc_mark(eargp->invoke.cmd.argv_str);
+ rb_gc_mark(eargp->invoke.cmd.argv_buf);
+ }
+ rb_gc_mark(eargp->redirect_fds);
+ rb_gc_mark(eargp->envp_str);
+ rb_gc_mark(eargp->envp_buf);
+ rb_gc_mark(eargp->dup2_tmpbuf);
+ rb_gc_mark(eargp->rlimit_limits);
+ rb_gc_mark(eargp->fd_dup2);
+ rb_gc_mark(eargp->fd_close);
+ rb_gc_mark(eargp->fd_open);
+ rb_gc_mark(eargp->fd_dup2_child);
+ rb_gc_mark(eargp->env_modification);
+ 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;
}
-enum {
- EXEC_OPTION_PGROUP,
- EXEC_OPTION_RLIMIT,
- EXEC_OPTION_UNSETENV_OTHERS,
- EXEC_OPTION_ENV,
- EXEC_OPTION_CHDIR,
- EXEC_OPTION_UMASK,
- EXEC_OPTION_DUP2,
- EXEC_OPTION_CLOSE,
- EXEC_OPTION_OPEN,
- EXEC_OPTION_DUP2_CHILD,
- EXEC_OPTION_CLOSE_OTHERS,
- EXEC_OPTION_NEW_PGROUP
+static const rb_data_type_t exec_arg_data_type = {
+ "exec_arg",
+ {mark_exec_arg, free_exec_arg, 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)
@@ -1246,10 +1398,10 @@ enum {
#if USE_SPAWNV
#if defined(_WIN32)
-#define proc_spawn_v(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_v(char **argv, char *prog)
+proc_spawn_cmd_internal(char **argv, char *prog)
{
char fbuf[MAXPATHLEN];
rb_pid_t status;
@@ -1270,70 +1422,42 @@ proc_spawn_v(char **argv, char *prog)
after_exec();
if (status == -1) errno = ENOEXEC;
}
- rb_last_status_set(status == -1 ? 127 : status, 0);
return status;
}
#endif
static rb_pid_t
-proc_spawn_n(int argc, VALUE *argv, VALUE prog, VALUE options)
+proc_spawn_cmd(char **argv, VALUE prog, struct rb_execarg *eargp)
{
- char **args;
- int i;
- VALUE v;
rb_pid_t pid = -1;
- args = ALLOC_ARGV(argc + 1, v);
- for (i = 0; i < argc; i++) {
- args[i] = RSTRING_PTR(argv[i]);
- }
- args[i] = (char*) 0;
- if (args[0]) {
+ if (argv[0]) {
#if defined(_WIN32)
DWORD flags = 0;
- if (RTEST(rb_ary_entry(options, EXEC_OPTION_NEW_PGROUP))) {
+ 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, args, flags);
+ pid = rb_w32_uaspawn_flags(P_NOWAIT, prog ? RSTRING_PTR(prog) : 0, argv, flags);
#else
- pid = proc_spawn_v(args, prog ? RSTRING_PTR(prog) : 0);
+ pid = proc_spawn_cmd_internal(argv, prog ? RSTRING_PTR(prog) : 0);
#endif
}
- ALLOCV_END(v);
return pid;
}
#if defined(_WIN32)
-#define proc_spawn(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(char *str)
+proc_spawn_sh(char *str)
{
char fbuf[MAXPATHLEN];
- char *s, *t;
- char **argv, **a;
rb_pid_t status;
- VALUE v;
- for (s = str; *s; s++) {
- if (*s != ' ' && !ISALPHA(*s) && strchr("*?{}[]<>()~&|\\$;'`\"\n",*s)) {
- 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;
- }
- }
- a = argv = ALLOC_ARGV_WITH_STR((s - str) / 2 + 2, v, s, s - str + 1);
- strcpy(s, str);
- if (*a++ = strtok(s, " \t")) {
- while (t = strtok(NULL, " \t"))
- *a++ = t;
- *a = NULL;
- }
- status = argv[0] ? proc_spawn_v(argv, 0) : -1;
- ALLOCV_END(v);
+ 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);
+ after_exec();
return status;
}
#endif
@@ -1342,7 +1466,7 @@ proc_spawn(char *str)
static VALUE
hide_obj(VALUE obj)
{
- RBASIC(obj)->klass = 0;
+ RBASIC_CLEAR_CLASS(obj);
return obj;
}
@@ -1373,10 +1497,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
@@ -1387,32 +1511,54 @@ check_exec_redirect_fd(VALUE v, int iskey)
return INT2FIX(fd);
}
+static VALUE
+check_exec_redirect1(VALUE ary, VALUE key, VALUE param)
+{
+ if (ary == Qfalse) {
+ ary = hide_obj(rb_ary_new());
+ }
+ if (!RB_TYPE_P(key, T_ARRAY)) {
+ VALUE fd = check_exec_redirect_fd(key, !NIL_P(param));
+ rb_ary_push(ary, hide_obj(rb_assoc_new(fd, param)));
+ }
+ else {
+ int i, n=0;
+ for (i = 0 ; i < RARRAY_LEN(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++;
+ }
+ }
+ return ary;
+}
+
static void
-check_exec_redirect(VALUE key, VALUE val, VALUE options)
+check_exec_redirect(VALUE key, VALUE val, struct rb_execarg *eargp)
{
- int index;
- VALUE ary, param;
+ VALUE param;
VALUE path, flags, perm;
+ VALUE tmp;
ID id;
switch (TYPE(val)) {
case T_SYMBOL:
id = SYM2ID(val);
if (id == rb_intern("close")) {
- index = EXEC_OPTION_CLOSE;
param = Qnil;
+ eargp->fd_close = check_exec_redirect1(eargp->fd_close, key, param);
}
else if (id == rb_intern("in")) {
- index = EXEC_OPTION_DUP2;
param = INT2FIX(0);
+ eargp->fd_dup2 = check_exec_redirect1(eargp->fd_dup2, key, param);
}
else if (id == rb_intern("out")) {
- index = EXEC_OPTION_DUP2;
param = INT2FIX(1);
+ eargp->fd_dup2 = check_exec_redirect1(eargp->fd_dup2, key, param);
}
else if (id == rb_intern("err")) {
- index = EXEC_OPTION_DUP2;
param = INT2FIX(2);
+ eargp->fd_dup2 = check_exec_redirect1(eargp->fd_dup2, key, param);
}
else {
rb_raise(rb_eArgError, "wrong exec redirect symbol: %s",
@@ -1421,74 +1567,60 @@ check_exec_redirect(VALUE key, VALUE val, VALUE options)
break;
case T_FILE:
+ io:
val = check_exec_redirect_fd(val, 0);
/* fall through */
case T_FIXNUM:
- index = EXEC_OPTION_DUP2;
param = val;
+ eargp->fd_dup2 = check_exec_redirect1(eargp->fd_dup2, key, param);
break;
case T_ARRAY:
path = rb_ary_entry(val, 0);
if (RARRAY_LEN(val) == 2 && SYMBOL_P(path) &&
SYM2ID(path) == rb_intern("child")) {
- index = EXEC_OPTION_DUP2_CHILD;
param = check_exec_redirect_fd(rb_ary_entry(val, 1), 0);
+ eargp->fd_dup2_child = check_exec_redirect1(eargp->fd_dup2_child, key, param);
}
else {
- index = EXEC_OPTION_OPEN;
FilePathValue(path);
flags = rb_ary_entry(val, 1);
if (NIL_P(flags))
flags = INT2NUM(O_RDONLY);
- else if (TYPE(flags) == T_STRING)
+ else if (RB_TYPE_P(flags, T_STRING))
flags = INT2NUM(rb_io_modestr_oflags(StringValueCStr(flags)));
else
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);
}
break;
case T_STRING:
- index = EXEC_OPTION_OPEN;
path = val;
FilePathValue(path);
- if (TYPE(key) == T_FILE)
+ if (RB_TYPE_P(key, T_FILE))
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
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;
default:
+ tmp = val;
+ val = rb_io_check_io(tmp);
+ if (!NIL_P(val)) goto io;
rb_raise(rb_eArgError, "wrong exec redirect action");
}
- ary = rb_ary_entry(options, index);
- if (NIL_P(ary)) {
- ary = hide_obj(rb_ary_new());
- rb_ary_store(options, index, ary);
- }
- if (TYPE(key) != T_ARRAY) {
- VALUE fd = check_exec_redirect_fd(key, !NIL_P(param));
- rb_ary_push(ary, hide_obj(rb_assoc_new(fd, param)));
- }
- else {
- int i, n=0;
- for (i = 0 ; i < RARRAY_LEN(key); i++) {
- VALUE v = RARRAY_PTR(key)[i];
- VALUE fd = check_exec_redirect_fd(v, !NIL_P(param));
- rb_ary_push(ary, hide_obj(rb_assoc_new(fd, param)));
- n++;
- }
- }
}
#if defined(HAVE_SETRLIMIT) && defined(NUM2RLIM)
@@ -1496,9 +1628,10 @@ static int rlimit_type_by_lname(const char *name);
#endif
int
-rb_exec_arg_addopt(struct rb_exec_arg *e, VALUE key, VALUE val)
+rb_execarg_addopt(VALUE execarg_obj, VALUE key, VALUE val)
{
- VALUE options = e->options;
+ struct rb_execarg *eargp = rb_execarg_get(execarg_obj);
+
ID id;
#if defined(HAVE_SETRLIMIT) && defined(NUM2RLIM)
int rtype;
@@ -1511,43 +1644,44 @@ rb_exec_arg_addopt(struct rb_exec_arg *e, VALUE key, VALUE val)
id = SYM2ID(key);
#ifdef HAVE_SETPGID
if (id == rb_intern("pgroup")) {
- if (!NIL_P(rb_ary_entry(options, EXEC_OPTION_PGROUP))) {
+ rb_pid_t pgroup;
+ if (eargp->pgroup_given) {
rb_raise(rb_eArgError, "pgroup option specified twice");
}
if (!RTEST(val))
- val = Qfalse;
+ pgroup = -1; /* asis(-1) means "don't call setpgid()". */
else if (val == Qtrue)
- val = INT2FIX(0);
+ pgroup = 0; /* new process group. */
else {
- pid_t pgroup = NUM2PIDT(val);
+ pgroup = NUM2PIDT(val);
if (pgroup < 0) {
rb_raise(rb_eArgError, "negative process group ID : %ld", (long)pgroup);
}
- val = PIDT2NUM(pgroup);
}
- rb_ary_store(options, EXEC_OPTION_PGROUP, val);
+ eargp->pgroup_given = 1;
+ eargp->pgroup_pgid = pgroup;
}
else
#endif
#ifdef _WIN32
if (id == rb_intern("new_pgroup")) {
- if (!NIL_P(rb_ary_entry(options, EXEC_OPTION_NEW_PGROUP))) {
+ if (eargp->new_pgroup_given) {
rb_raise(rb_eArgError, "new_pgroup option specified twice");
}
- val = RTEST(val) ? Qtrue : Qfalse;
- rb_ary_store(options, EXEC_OPTION_NEW_PGROUP, val);
+ eargp->new_pgroup_given = 1;
+ eargp->new_pgroup_flag = RTEST(val) ? 1 : 0;
}
else
#endif
#if defined(HAVE_SETRLIMIT) && defined(NUM2RLIM)
if (strncmp("rlimit_", rb_id2name(id), 7) == 0 &&
(rtype = rlimit_type_by_lname(rb_id2name(id)+7)) != -1) {
- VALUE ary = rb_ary_entry(options, EXEC_OPTION_RLIMIT);
+ VALUE ary = eargp->rlimit_limits;
VALUE tmp, softlim, hardlim;
- if (NIL_P(ary)) {
- ary = hide_obj(rb_ary_new());
- rb_ary_store(options, EXEC_OPTION_RLIMIT, ary);
- }
+ if (eargp->rlimit_limits == Qfalse)
+ ary = eargp->rlimit_limits = hide_obj(rb_ary_new());
+ else
+ ary = eargp->rlimit_limits;
tmp = rb_check_array_type(val);
if (!NIL_P(tmp)) {
if (RARRAY_LEN(tmp) == 1)
@@ -1569,33 +1703,34 @@ rb_exec_arg_addopt(struct rb_exec_arg *e, VALUE key, VALUE val)
else
#endif
if (id == rb_intern("unsetenv_others")) {
- if (!NIL_P(rb_ary_entry(options, EXEC_OPTION_UNSETENV_OTHERS))) {
+ if (eargp->unsetenv_others_given) {
rb_raise(rb_eArgError, "unsetenv_others option specified twice");
}
- val = RTEST(val) ? Qtrue : Qfalse;
- rb_ary_store(options, EXEC_OPTION_UNSETENV_OTHERS, val);
+ eargp->unsetenv_others_given = 1;
+ eargp->unsetenv_others_do = RTEST(val) ? 1 : 0;
}
else if (id == rb_intern("chdir")) {
- if (!NIL_P(rb_ary_entry(options, EXEC_OPTION_CHDIR))) {
+ if (eargp->chdir_given) {
rb_raise(rb_eArgError, "chdir option specified twice");
}
FilePathValue(val);
- rb_ary_store(options, EXEC_OPTION_CHDIR,
- hide_obj(rb_str_dup(val)));
+ eargp->chdir_given = 1;
+ eargp->chdir_dir = hide_obj(EXPORT_DUP(val));
}
else if (id == rb_intern("umask")) {
mode_t cmask = NUM2MODET(val);
- if (!NIL_P(rb_ary_entry(options, EXEC_OPTION_UMASK))) {
+ if (eargp->umask_given) {
rb_raise(rb_eArgError, "umask option specified twice");
}
- rb_ary_store(options, EXEC_OPTION_UMASK, LONG2NUM(cmask));
+ eargp->umask_given = 1;
+ eargp->umask_mask = cmask;
}
else if (id == rb_intern("close_others")) {
- if (!NIL_P(rb_ary_entry(options, EXEC_OPTION_CLOSE_OTHERS))) {
+ if (eargp->close_others_given) {
rb_raise(rb_eArgError, "close_others option specified twice");
}
- val = RTEST(val) ? Qtrue : Qfalse;
- rb_ary_store(options, EXEC_OPTION_CLOSE_OTHERS, val);
+ eargp->close_others_given = 1;
+ eargp->close_others_do = RTEST(val) ? 1 : 0;
}
else if (id == rb_intern("in")) {
key = INT2FIX(0);
@@ -1609,9 +1744,40 @@ rb_exec_arg_addopt(struct rb_exec_arg *e, VALUE key, VALUE val)
key = INT2FIX(2);
goto redirect;
}
+ else if (id == rb_intern("uid")) {
+#ifdef HAVE_SETUID
+ if (eargp->uid_given) {
+ rb_raise(rb_eArgError, "uid option specified twice");
+ }
+ check_uid_switch();
+ {
+ PREPARE_GETPWNAM;
+ eargp->uid = OBJ2UID(val);
+ eargp->uid_given = 1;
+ }
+#else
+ rb_raise(rb_eNotImpError,
+ "uid option is unimplemented on this machine");
+#endif
+ }
+ else if (id == rb_intern("gid")) {
+#ifdef HAVE_SETGID
+ if (eargp->gid_given) {
+ rb_raise(rb_eArgError, "gid option specified twice");
+ }
+ check_gid_switch();
+ {
+ PREPARE_GETGRNAM;
+ eargp->gid = OBJ2GID(val);
+ eargp->gid_given = 1;
+ }
+#else
+ rb_raise(rb_eNotImpError,
+ "gid option is unimplemented on this machine");
+#endif
+ }
else {
- rb_raise(rb_eArgError, "wrong exec option symbol: %s",
- rb_id2name(id));
+ return ST_STOP;
}
break;
@@ -1619,65 +1785,102 @@ rb_exec_arg_addopt(struct rb_exec_arg *e, VALUE key, VALUE val)
case T_FILE:
case T_ARRAY:
redirect:
- check_exec_redirect(key, val, options);
+ check_exec_redirect(key, val, eargp);
break;
default:
- rb_raise(rb_eArgError, "wrong exec option");
+ return ST_STOP;
}
+ RB_GC_GUARD(execarg_obj);
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)
{
VALUE key = (VALUE)st_key;
VALUE val = (VALUE)st_val;
- struct rb_exec_arg *e = (struct rb_exec_arg *)arg;
- return rb_exec_arg_addopt(e, key, val);
+ VALUE execarg_obj = (VALUE)arg;
+ if (rb_execarg_addopt(execarg_obj, key, val) != ST_CONTINUE) {
+ if (SYMBOL_P(key))
+ rb_raise(rb_eArgError, "wrong exec option symbol: %"PRIsVALUE,
+ key);
+ rb_raise(rb_eArgError, "wrong exec option");
+ }
+ return ST_CONTINUE;
}
-static VALUE
-check_exec_fds(VALUE options)
+static int
+check_exec_options_i_extract(st_data_t st_key, st_data_t st_val, st_data_t arg)
+{
+ VALUE key = (VALUE)st_key;
+ VALUE val = (VALUE)st_val;
+ VALUE *args = (VALUE *)arg;
+ VALUE execarg_obj = args[0];
+ if (rb_execarg_addopt(execarg_obj, key, val) != ST_CONTINUE) {
+ VALUE nonopts = args[1];
+ if (NIL_P(nonopts)) args[1] = nonopts = rb_hash_new();
+ rb_hash_aset(nonopts, key, val);
+ }
+ return ST_CONTINUE;
+}
+
+static int
+check_exec_fds_1(struct rb_execarg *eargp, VALUE h, int maxhint, VALUE ary)
{
- VALUE h = rb_hash_new();
- VALUE ary;
- int index, maxhint = -1;
long i;
- for (index = EXEC_OPTION_DUP2; index <= EXEC_OPTION_DUP2_CHILD; index++) {
- ary = rb_ary_entry(options, index);
- if (NIL_P(ary))
- continue;
+ 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 (index == EXEC_OPTION_OPEN || index == EXEC_OPTION_DUP2)
+ if (ary == eargp->fd_open || ary == eargp->fd_dup2)
rb_hash_aset(h, INT2FIX(fd), Qtrue);
- else if (index == EXEC_OPTION_DUP2_CHILD)
- rb_hash_aset(h, INT2FIX(fd), RARRAY_PTR(elt)[1]);
- else /* index == EXEC_OPTION_CLOSE */
+ else if (ary == eargp->fd_dup2_child)
+ 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 (index == EXEC_OPTION_DUP2 || index == EXEC_OPTION_DUP2_CHILD) {
- fd = FIX2INT(RARRAY_PTR(elt)[1]);
+ if (ary == eargp->fd_dup2 || ary == eargp->fd_dup2_child) {
+ fd = FIX2INT(RARRAY_AREF(elt, 1));
if (maxhint < fd)
maxhint = fd;
}
}
}
+ return maxhint;
+}
- ary = rb_ary_entry(options, EXEC_OPTION_DUP2_CHILD);
- if (!NIL_P(ary)) {
+static VALUE
+check_exec_fds(struct rb_execarg *eargp)
+{
+ VALUE h = rb_hash_new();
+ VALUE ary;
+ int maxhint = -1;
+ long i;
+
+ maxhint = check_exec_fds_1(eargp, h, maxhint, eargp->fd_dup2);
+ maxhint = check_exec_fds_1(eargp, h, maxhint, eargp->fd_close);
+ maxhint = check_exec_fds_1(eargp, h, maxhint, eargp->fd_open);
+ maxhint = check_exec_fds_1(eargp, h, maxhint, eargp->fd_dup2_child);
+
+ if (eargp->fd_dup2_child) {
+ 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;
@@ -1703,18 +1906,28 @@ check_exec_fds(VALUE options)
}
}
- if (rb_ary_entry(options, EXEC_OPTION_CLOSE_OTHERS) != Qfalse) {
- rb_ary_store(options, EXEC_OPTION_CLOSE_OTHERS, INT2FIX(maxhint));
- }
+ eargp->close_others_maxhint = maxhint;
return h;
}
static void
-rb_check_exec_options(VALUE opthash, struct rb_exec_arg *e)
+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)e);
+ st_foreach(rb_hash_tbl_raw(opthash), check_exec_options_i, (st_data_t)execarg_obj);
+}
+
+VALUE
+rb_execarg_extract_options(VALUE execarg_obj, VALUE opthash)
+{
+ VALUE args[2];
+ if (RHASH_EMPTY_P(opthash))
+ return Qnil;
+ args[0] = execarg_obj;
+ args[1] = Qnil;
+ st_foreach(rb_hash_tbl_raw(opthash), check_exec_options_i_extract, (st_data_t)args);
+ return args[1];
}
static int
@@ -1732,6 +1945,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;
@@ -1743,7 +1959,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;
}
@@ -1755,9 +1971,7 @@ rb_check_argv(int argc, VALUE *argv)
int i;
const char *name = 0;
- if (argc == 0) {
- rb_raise(rb_eArgError, "wrong number of arguments");
- }
+ rb_check_arity(argc, 1, UNLIMITED_ARGUMENTS);
prog = 0;
tmp = rb_check_array_type(argv[0]);
@@ -1765,16 +1979,16 @@ 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_new4(prog);
+ prog = rb_str_new_frozen(prog);
name = RSTRING_PTR(prog);
}
for (i = 0; i < argc; i++) {
SafeStringValue(argv[i]);
- argv[i] = rb_str_new4(argv[i]);
+ argv[i] = rb_str_new_frozen(argv[i]);
StringValueCStr(argv[i]);
}
security(name ? name : RSTRING_PTR(argv[0]));
@@ -1782,12 +1996,12 @@ rb_check_argv(int argc, VALUE *argv)
}
static VALUE
-rb_exec_getargs(int *argc_p, VALUE **argv_p, int accept_shell, VALUE *env_ret, VALUE *opthash_ret, struct rb_exec_arg *e)
+rb_exec_getargs(int *argc_p, VALUE **argv_p, int accept_shell, VALUE *env_ret, VALUE *opthash_ret)
{
VALUE hash, prog;
if (0 < *argc_p) {
- hash = rb_check_convert_type((*argv_p)[*argc_p-1], T_HASH, "Hash", "to_hash");
+ hash = rb_check_hash_type((*argv_p)[*argc_p-1]);
if (!NIL_P(hash)) {
*opthash_ret = hash;
(*argc_p)--;
@@ -1795,7 +2009,7 @@ rb_exec_getargs(int *argc_p, VALUE **argv_p, int accept_shell, VALUE *env_ret, V
}
if (0 < *argc_p) {
- hash = rb_check_convert_type((*argv_p)[0], T_HASH, "Hash", "to_hash");
+ hash = rb_check_hash_type((*argv_p)[0]);
if (!NIL_P(hash)) {
*env_ret = hash;
(*argc_p)--;
@@ -1813,83 +2027,414 @@ rb_exec_getargs(int *argc_p, VALUE **argv_p, int accept_shell, VALUE *env_ret, V
return prog;
}
+#ifndef _WIN32
+struct string_part {
+ const char *ptr;
+ size_t len;
+};
+
+static int
+compare_posix_sh(const void *key, const void *el)
+{
+ const struct string_part *word = key;
+ int ret = strncmp(word->ptr, el, word->len);
+ if (!ret && ((const char *)el)[word->len]) ret = -1;
+ return ret;
+}
+#endif
+
static void
-rb_exec_fillarg(VALUE prog, int argc, VALUE *argv, VALUE env, VALUE opthash, struct rb_exec_arg *e)
+rb_exec_fillarg(VALUE prog, int argc, VALUE *argv, VALUE env, VALUE opthash, VALUE execarg_obj)
{
- VALUE options;
- MEMZERO(e, struct rb_exec_arg, 1);
- options = hide_obj(rb_ary_new());
- e->options = options;
+ struct rb_execarg *eargp = rb_execarg_get(execarg_obj);
+ char fbuf[MAXPATHLEN];
+
+ MEMZERO(eargp, struct rb_execarg, 1);
if (!NIL_P(opthash)) {
- rb_check_exec_options(opthash, e);
+ rb_check_exec_options(opthash, execarg_obj);
}
if (!NIL_P(env)) {
env = rb_check_exec_env(env);
- rb_ary_store(options, EXEC_OPTION_ENV, env);
+ eargp->env_modification = env;
+ }
+
+ prog = EXPORT_STR(prog);
+ eargp->use_shell = argc == 0;
+ if (eargp->use_shell)
+ eargp->invoke.sh.shell_script = prog;
+ else
+ eargp->invoke.cmd.command_name = prog;
+
+#ifndef _WIN32
+ if (eargp->use_shell) {
+ static const char posix_sh_cmds[][9] = {
+ "!", /* reserved */
+ ".", /* special built-in */
+ ":", /* special built-in */
+ "break", /* special built-in */
+ "case", /* reserved */
+ "continue", /* special built-in */
+ "do", /* reserved */
+ "done", /* reserved */
+ "elif", /* reserved */
+ "else", /* reserved */
+ "esac", /* reserved */
+ "eval", /* special built-in */
+ "exec", /* special built-in */
+ "exit", /* special built-in */
+ "export", /* special built-in */
+ "fi", /* reserved */
+ "for", /* reserved */
+ "if", /* reserved */
+ "in", /* reserved */
+ "readonly", /* special built-in */
+ "return", /* special built-in */
+ "set", /* special built-in */
+ "shift", /* special built-in */
+ "then", /* reserved */
+ "times", /* special built-in */
+ "trap", /* special built-in */
+ "unset", /* special built-in */
+ "until", /* reserved */
+ "while", /* reserved */
+ };
+ const char *p;
+ struct string_part first = {0, 0};
+ int has_meta = 0;
+ /*
+ * meta characters:
+ *
+ * * Pathname Expansion
+ * ? Pathname Expansion
+ * {} Grouping Commands
+ * [] Pathname Expansion
+ * <> Redirection
+ * () Grouping Commands
+ * ~ Tilde Expansion
+ * & AND Lists, Asynchronous Lists
+ * | OR Lists, Pipelines
+ * \ Escape Character
+ * $ Parameter Expansion
+ * ; Sequential Lists
+ * ' Single-Quotes
+ * ` Command Substitution
+ * " Double-Quotes
+ * \n Lists
+ *
+ * # Comment
+ * = Assignment preceding command name
+ * % (used in Parameter Expansion)
+ */
+ for (p = RSTRING_PTR(prog); *p; p++) {
+ if (*p == ' ' || *p == '\t') {
+ if (first.ptr && !first.len) first.len = p - first.ptr;
+ }
+ else {
+ if (!first.ptr) first.ptr = p;
+ }
+ if (!has_meta && strchr("*?{}[]<>()~&|\\$;'`\"\n#", *p))
+ has_meta = 1;
+ if (!first.len) {
+ if (*p == '=') {
+ has_meta = 1;
+ }
+ else if (*p == '/') {
+ first.len = 0x100; /* longer than any posix_sh_cmds */
+ }
+ }
+ if (has_meta)
+ break;
+ }
+ if (!has_meta && first.ptr) {
+ if (!first.len) first.len = p - first.ptr;
+ if (first.len > 0 && first.len <= sizeof(posix_sh_cmds[0]) &&
+ bsearch(&first, posix_sh_cmds, numberof(posix_sh_cmds), sizeof(posix_sh_cmds[0]), compare_posix_sh))
+ has_meta = 1;
+ }
+ if (!has_meta) {
+ /* avoid shell since no shell meta character found. */
+ eargp->use_shell = 0;
+ }
+ if (!eargp->use_shell) {
+ VALUE argv_buf;
+ argv_buf = hide_obj(rb_str_buf_new(0));
+ p = RSTRING_PTR(prog);
+ while (*p) {
+ while (*p == ' ' || *p == '\t')
+ p++;
+ if (*p) {
+ const char *w = p;
+ while (*p && *p != ' ' && *p != '\t')
+ p++;
+ rb_str_buf_cat(argv_buf, w, p-w);
+ rb_str_buf_cat(argv_buf, "", 1); /* append '\0' */
+ }
+ }
+ eargp->invoke.cmd.argv_buf = argv_buf;
+ eargp->invoke.cmd.command_name = hide_obj(rb_str_new_cstr(RSTRING_PTR(argv_buf)));
+ }
}
+#endif
- e->argc = argc;
- e->argv = argv;
- e->prog = prog ? RSTRING_PTR(prog) : 0;
+ if (!eargp->use_shell) {
+ const char *abspath;
+ abspath = dln_find_exe_r(RSTRING_PTR(eargp->invoke.cmd.command_name), 0, fbuf, sizeof(fbuf));
+ if (abspath)
+ eargp->invoke.cmd.command_abspath = rb_str_new_cstr(abspath);
+ else
+ eargp->invoke.cmd.command_abspath = Qnil;
+ }
+
+ if (!eargp->use_shell && !eargp->invoke.cmd.argv_buf) {
+ int i;
+ VALUE argv_buf;
+ argv_buf = rb_str_buf_new(0);
+ hide_obj(argv_buf);
+ for (i = 0; i < argc; i++) {
+ 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;
+ }
+
+ if (!eargp->use_shell) {
+ const char *p, *ep, *null=NULL;
+ VALUE argv_str;
+ argv_str = hide_obj(rb_str_buf_new(sizeof(char*) * (argc + 2)));
+ rb_str_buf_cat(argv_str, (char *)&null, sizeof(null)); /* place holder for /bin/sh of try_with_sh. */
+ p = RSTRING_PTR(eargp->invoke.cmd.argv_buf);
+ ep = p + RSTRING_LEN(eargp->invoke.cmd.argv_buf);
+ while (p < ep) {
+ rb_str_buf_cat(argv_str, (char *)&p, sizeof(p));
+ p += strlen(p) + 1;
+ }
+ rb_str_buf_cat(argv_str, (char *)&null, sizeof(null)); /* terminator for execve. */
+ eargp->invoke.cmd.argv_str = argv_str;
+ }
+ RB_GC_GUARD(execarg_obj);
}
VALUE
-rb_exec_arg_init(int argc, VALUE *argv, int accept_shell, struct rb_exec_arg *e)
+rb_execarg_new(int argc, VALUE *argv, int accept_shell)
{
- VALUE prog;
+ VALUE execarg_obj;
+ struct rb_execarg *eargp;
+ execarg_obj = TypedData_Make_Struct(rb_cData, struct rb_execarg, &exec_arg_data_type, eargp);
+ hide_obj(execarg_obj);
+ rb_execarg_init(argc, argv, accept_shell, execarg_obj);
+ return 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);
+ return eargp;
+}
+
+VALUE
+rb_execarg_init(int argc, VALUE *argv, int accept_shell, VALUE execarg_obj)
+{
+ struct rb_execarg *eargp = rb_execarg_get(execarg_obj);
+ VALUE prog, ret;
VALUE env = Qnil, opthash = Qnil;
- prog = rb_exec_getargs(&argc, &argv, accept_shell, &env, &opthash, e);
- rb_exec_fillarg(prog, argc, argv, env, opthash, e);
- return prog;
+ prog = rb_exec_getargs(&argc, &argv, accept_shell, &env, &opthash);
+ rb_exec_fillarg(prog, argc, argv, env, opthash, execarg_obj);
+ 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)
+{
+ struct rb_execarg *eargp = rb_execarg_get(execarg_obj);
+ env = !NIL_P(env) ? rb_check_exec_env(env) : Qfalse;
+ eargp->env_modification = env;
+}
+
+static int
+fill_envp_buf_i(st_data_t st_key, st_data_t st_val, st_data_t arg)
+{
+ VALUE key = (VALUE)st_key;
+ VALUE val = (VALUE)st_val;
+ VALUE envp_buf = (VALUE)arg;
+
+ rb_str_buf_cat2(envp_buf, StringValueCStr(key));
+ rb_str_buf_cat2(envp_buf, "=");
+ rb_str_buf_cat2(envp_buf, StringValueCStr(val));
+ rb_str_buf_cat(envp_buf, "", 1); /* append '\0' */
+
+ return ST_CONTINUE;
+}
+
+
+static long run_exec_dup2_tmpbuf_size(long n);
+
+void
+rb_execarg_fixup(VALUE execarg_obj)
+{
+ struct rb_execarg *eargp = rb_execarg_get(execarg_obj);
+ int unsetenv_others;
+ VALUE envopts;
+ VALUE ary;
+
+ eargp->redirect_fds = check_exec_fds(eargp);
+
+ ary = eargp->fd_dup2;
+ if (ary != Qfalse) {
+ size_t len = run_exec_dup2_tmpbuf_size(RARRAY_LEN(ary));
+ VALUE tmpbuf = hide_obj(rb_str_new(0, len));
+ rb_str_set_len(tmpbuf, len);
+ eargp->dup2_tmpbuf = tmpbuf;
+ }
+
+ unsetenv_others = eargp->unsetenv_others_given && eargp->unsetenv_others_do;
+ envopts = eargp->env_modification;
+ if (unsetenv_others || envopts != Qfalse) {
+ VALUE envtbl, envp_str, envp_buf;
+ char *p, *ep;
+ if (unsetenv_others) {
+ envtbl = rb_hash_new();
+ }
+ else {
+ envtbl = rb_const_get(rb_cObject, rb_intern("ENV"));
+ envtbl = rb_convert_type(envtbl, T_HASH, "Hash", "to_hash");
+ }
+ hide_obj(envtbl);
+ if (envopts != Qfalse) {
+ st_table *stenv = RHASH_TBL(envtbl);
+ long i;
+ for (i = 0; i < RARRAY_LEN(envopts); i++) {
+ VALUE pair = RARRAY_AREF(envopts, i);
+ VALUE key = RARRAY_AREF(pair, 0);
+ VALUE val = RARRAY_AREF(pair, 1);
+ if (NIL_P(val)) {
+ st_data_t stkey = (st_data_t)key;
+ st_delete(stenv, &stkey, NULL);
+ }
+ else {
+ st_insert(stenv, (st_data_t)key, (st_data_t)val);
+ }
+ }
+ }
+ envp_buf = rb_str_buf_new(0);
+ hide_obj(envp_buf);
+ st_foreach(RHASH_TBL(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);
+ ep = p + RSTRING_LEN(envp_buf);
+ while (p < ep) {
+ rb_str_buf_cat(envp_str, (char *)&p, sizeof(p));
+ p += strlen(p) + 1;
+ }
+ p = NULL;
+ rb_str_buf_cat(envp_str, (char *)&p, sizeof(p));
+ eargp->envp_str = envp_str;
+ eargp->envp_buf = envp_buf;
+
+ /*
+ char **tmp_envp = (char **)RSTRING_PTR(envp_str);
+ while (*tmp_envp) {
+ printf("%s\n", *tmp_envp);
+ tmp_envp++;
+ }
+ */
+ }
+ RB_GC_GUARD(execarg_obj);
}
void
rb_exec_arg_fixup(struct rb_exec_arg *e)
{
- e->redirect_fds = check_exec_fds(e->options);
+ rb_execarg_fixup(e->execarg_obj);
}
+static int rb_exec_without_timer_thread(const struct rb_execarg *eargp, char *errmsg, size_t errmsg_buflen);
+
/*
* 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.
*
- * If single string is given as the command,
- * it 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.
*
- * 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.
+ * If the string from the first form (<code>exec("command")</code>) follows
+ * these simple rules:
*
- * 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.
+ * * no meta characters
+ * * no shell reserved word and no special built-in
+ * * Ruby invokes the command directly without 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.
+ * You can force shell invocation by adding ";" to the string (because ";" is
+ * a meta character).
*
- * 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
+ * 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.
+ *
+ * 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 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.
+ *
+ * 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
*/
@@ -1897,19 +2442,25 @@ rb_exec_arg_fixup(struct rb_exec_arg *e)
VALUE
rb_f_exec(int argc, VALUE *argv)
{
- struct rb_exec_arg earg;
+ VALUE execarg_obj, fail_str;
+ struct rb_execarg *eargp;
#define CHILD_ERRMSG_BUFLEN 80
char errmsg[CHILD_ERRMSG_BUFLEN] = { '\0' };
- rb_exec_arg_init(argc, argv, TRUE, &earg);
- if (NIL_P(rb_ary_entry(earg.options, EXEC_OPTION_CLOSE_OTHERS)))
- rb_exec_arg_addopt(&earg, ID2SYM(rb_intern("close_others")), Qfalse);
- rb_exec_arg_fixup(&earg);
+ execarg_obj = rb_execarg_new(argc, argv, TRUE);
+ eargp = rb_execarg_get(execarg_obj);
+ rb_execarg_fixup(execarg_obj);
+ fail_str = eargp->use_shell ? eargp->invoke.sh.shell_script : eargp->invoke.cmd.command_name;
- rb_exec_err(&earg, errmsg, sizeof(errmsg));
+#if defined(__APPLE__) || defined(__HAIKU__)
+ rb_exec_without_timer_thread(eargp, errmsg, sizeof(errmsg));
+#else
+ rb_exec_async_signal_safe(eargp, errmsg, sizeof(errmsg));
+#endif
+ RB_GC_GUARD(execarg_obj);
if (errmsg[0])
rb_sys_fail(errmsg);
- rb_sys_fail(earg.prog);
+ rb_sys_fail_str(fail_str);
return Qnil; /* dummy */
}
@@ -1949,16 +2500,28 @@ 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)
{
@@ -1978,16 +2541,14 @@ 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
static int
-save_redirect_fd(int fd, VALUE save, char *errmsg, size_t errmsg_buflen)
+save_redirect_fd(int fd, struct rb_execarg *sargp, char *errmsg, size_t errmsg_buflen)
{
- if (!NIL_P(save)) {
+ if (sargp) {
VALUE newary;
int save_fd = redirect_dup(fd);
if (save_fd == -1) {
@@ -1997,18 +2558,18 @@ save_redirect_fd(int fd, VALUE save, char *errmsg, size_t errmsg_buflen)
return -1;
}
rb_update_max_fd(save_fd);
- newary = rb_ary_entry(save, EXEC_OPTION_DUP2);
- if (NIL_P(newary)) {
+ newary = sargp->fd_dup2;
+ if (newary == Qfalse) {
newary = hide_obj(rb_ary_new());
- rb_ary_store(save, EXEC_OPTION_DUP2, newary);
+ sargp->fd_dup2 = newary;
}
rb_ary_push(newary,
hide_obj(rb_assoc_new(INT2FIX(fd), INT2FIX(save_fd))));
- newary = rb_ary_entry(save, EXEC_OPTION_CLOSE);
- if (NIL_P(newary)) {
+ newary = sargp->fd_close;
+ if (newary == Qfalse) {
newary = hide_obj(rb_ary_new());
- rb_ary_store(save, EXEC_OPTION_CLOSE, newary);
+ sargp->fd_close = newary;
}
rb_ary_push(newary, hide_obj(rb_assoc_new(INT2FIX(save_fd), Qnil)));
}
@@ -2016,28 +2577,6 @@ save_redirect_fd(int fd, VALUE save, char *errmsg, size_t errmsg_buflen)
return 0;
}
-static VALUE
-save_env_i(VALUE i, VALUE ary, int argc, VALUE *argv)
-{
- rb_ary_push(ary, hide_obj(rb_ary_dup(argv[0])));
- return Qnil;
-}
-
-static void
-save_env(VALUE save)
-{
- if (!NIL_P(save) && NIL_P(rb_ary_entry(save, EXEC_OPTION_ENV))) {
- VALUE env = rb_const_get(rb_cObject, rb_intern("ENV"));
- if (RTEST(env)) {
- VALUE ary = hide_obj(rb_ary_new());
- rb_block_call(env, rb_intern("each"), 0, 0, save_env_i,
- (VALUE)ary);
- rb_ary_store(save, EXEC_OPTION_ENV, ary);
- }
- rb_ary_store(save, EXEC_OPTION_UNSETENV_OTHERS, Qtrue);
- }
-}
-
static int
intcmp(const void *a, const void *b)
{
@@ -2050,46 +2589,51 @@ intrcmp(const void *a, const void *b)
return *(int*)b - *(int*)a;
}
+struct run_exec_dup2_fd_pair {
+ int oldfd;
+ int newfd;
+ long older_index;
+ long num_newer;
+};
+
+static long
+run_exec_dup2_tmpbuf_size(long n)
+{
+ return sizeof(struct run_exec_dup2_fd_pair) * n;
+}
+
+/* This function should be async-signal-safe when sargp is NULL. Hopefully it is. */
static int
-run_exec_dup2(VALUE ary, VALUE save, char *errmsg, size_t errmsg_buflen)
+run_exec_dup2(VALUE ary, VALUE tmpbuf, struct rb_execarg *sargp, char *errmsg, size_t errmsg_buflen)
{
long n, i;
int ret;
int extra_fd = -1;
- struct fd_pair {
- int oldfd;
- int newfd;
- long older_index;
- long num_newer;
- } *pairs = 0;
+ struct run_exec_dup2_fd_pair *pairs = 0;
n = RARRAY_LEN(ary);
- pairs = (struct fd_pair *)malloc(sizeof(struct fd_pair) * n);
- if (pairs == NULL) {
- ERRMSG("malloc");
- return -1;
- }
+ pairs = (struct run_exec_dup2_fd_pair *)RSTRING_PTR(tmpbuf);
/* 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;
}
/* sort the table by oldfd: O(n log n) */
- if (!RTEST(save))
- qsort(pairs, n, sizeof(struct fd_pair), intcmp);
+ if (!sargp)
+ qsort(pairs, n, sizeof(struct run_exec_dup2_fd_pair), intcmp); /* hopefully async-signal-safe */
else
- qsort(pairs, n, sizeof(struct fd_pair), intrcmp);
+ qsort(pairs, n, sizeof(struct run_exec_dup2_fd_pair), intrcmp);
/* initialize older_index and num_newer: O(n log n) */
for (i = 0; i < n; i++) {
int newfd = pairs[i].newfd;
- struct fd_pair key, *found;
+ struct run_exec_dup2_fd_pair key, *found;
key.oldfd = newfd;
- found = bsearch(&key, pairs, n, sizeof(struct fd_pair), intcmp);
+ found = bsearch(&key, pairs, n, sizeof(struct run_exec_dup2_fd_pair), intcmp); /* hopefully async-signal-safe */
pairs[i].num_newer = 0;
if (found) {
while (pairs < found && (found-1)->oldfd == newfd)
@@ -2106,14 +2650,14 @@ run_exec_dup2(VALUE ary, VALUE save, char *errmsg, size_t errmsg_buflen)
for (i = 0; i < n; i++) {
long j = i;
while (j != -1 && pairs[j].oldfd != -1 && pairs[j].num_newer == 0) {
- if (save_redirect_fd(pairs[j].newfd, save, errmsg, errmsg_buflen) < 0)
+ if (save_redirect_fd(pairs[j].newfd, sargp, errmsg, errmsg_buflen) < 0) /* async-signal-safe */
goto fail;
- ret = redirect_dup2(pairs[j].oldfd, pairs[j].newfd);
+ ret = redirect_dup2(pairs[j].oldfd, pairs[j].newfd); /* async-signal-safe */
if (ret == -1) {
ERRMSG("dup2");
goto fail;
}
- rb_update_max_fd(pairs[j].newfd);
+ rb_update_max_fd(pairs[j].newfd); /* async-signal-safe but don't need to call it in a child process. */
pairs[j].oldfd = -1;
j = pairs[j].older_index;
if (j != -1)
@@ -2129,14 +2673,14 @@ run_exec_dup2(VALUE ary, VALUE save, char *errmsg, size_t errmsg_buflen)
if (pairs[i].oldfd == pairs[i].newfd) { /* self cycle */
#ifdef F_GETFD
int fd = pairs[i].oldfd;
- ret = fcntl(fd, F_GETFD);
+ ret = fcntl(fd, F_GETFD); /* async-signal-safe */
if (ret == -1) {
ERRMSG("fcntl(F_GETFD)");
goto fail;
}
if (ret & FD_CLOEXEC) {
ret &= ~FD_CLOEXEC;
- ret = fcntl(fd, F_SETFD, ret);
+ ret = fcntl(fd, F_SETFD, ret); /* async-signal-safe */
if (ret == -1) {
ERRMSG("fcntl(F_SETFD)");
goto fail;
@@ -2147,7 +2691,7 @@ run_exec_dup2(VALUE ary, VALUE save, char *errmsg, size_t errmsg_buflen)
continue;
}
if (extra_fd == -1) {
- extra_fd = redirect_dup(pairs[i].oldfd);
+ extra_fd = redirect_dup(pairs[i].oldfd); /* async-signal-safe */
if (extra_fd == -1) {
ERRMSG("dup");
goto fail;
@@ -2155,7 +2699,7 @@ run_exec_dup2(VALUE ary, VALUE save, char *errmsg, size_t errmsg_buflen)
rb_update_max_fd(extra_fd);
}
else {
- ret = redirect_dup2(pairs[i].oldfd, extra_fd);
+ ret = redirect_dup2(pairs[i].oldfd, extra_fd); /* async-signal-safe */
if (ret == -1) {
ERRMSG("dup2");
goto fail;
@@ -2166,7 +2710,7 @@ run_exec_dup2(VALUE ary, VALUE save, char *errmsg, size_t errmsg_buflen)
j = pairs[i].older_index;
pairs[i].older_index = -1;
while (j != -1) {
- ret = redirect_dup2(pairs[j].oldfd, pairs[j].newfd);
+ ret = redirect_dup2(pairs[j].oldfd, pairs[j].newfd); /* async-signal-safe */
if (ret == -1) {
ERRMSG("dup2");
goto fail;
@@ -2177,21 +2721,20 @@ run_exec_dup2(VALUE ary, VALUE save, char *errmsg, size_t errmsg_buflen)
}
}
if (extra_fd != -1) {
- ret = redirect_close(extra_fd);
+ ret = redirect_close(extra_fd); /* async-signal-safe */
if (ret == -1) {
ERRMSG("close");
goto fail;
}
}
- xfree(pairs);
return 0;
fail:
- xfree(pairs);
return -1;
}
+/* This function should be async-signal-safe. Actually it is. */
static int
run_exec_close(VALUE ary, char *errmsg, size_t errmsg_buflen)
{
@@ -2199,9 +2742,9 @@ 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]);
- ret = redirect_close(fd);
+ 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");
return -1;
@@ -2210,36 +2753,37 @@ run_exec_close(VALUE ary, char *errmsg, size_t errmsg_buflen)
return 0;
}
+/* This function should be async-signal-safe when sargp is NULL. Actually it is. */
static int
-run_exec_open(VALUE ary, VALUE save, char *errmsg, size_t errmsg_buflen)
+run_exec_open(VALUE ary, struct rb_execarg *sargp, char *errmsg, size_t errmsg_buflen)
{
long i;
int ret;
for (i = 0; i < RARRAY_LEN(ary);) {
- VALUE elt = RARRAY_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);
+ char *path = RSTRING_PTR(RARRAY_AREF(param, 0));
+ int flags = NUM2INT(RARRAY_AREF(param, 1));
+ int perm = NUM2INT(RARRAY_AREF(param, 2));
int need_close = 1;
- int fd2 = redirect_open(path, flags, perm);
+ int fd2 = redirect_open(path, flags, perm); /* async-signal-safe */
if (fd2 == -1) {
ERRMSG("open");
return -1;
}
rb_update_max_fd(fd2);
while (i < RARRAY_LEN(ary) &&
- (elt = RARRAY_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;
}
else {
- if (save_redirect_fd(fd, save, errmsg, errmsg_buflen) < 0)
+ if (save_redirect_fd(fd, sargp, errmsg, errmsg_buflen) < 0) /* async-signal-safe */
return -1;
- ret = redirect_dup2(fd2, fd);
+ ret = redirect_dup2(fd2, fd); /* async-signal-safe */
if (ret == -1) {
ERRMSG("dup2");
return -1;
@@ -2249,7 +2793,7 @@ run_exec_open(VALUE ary, VALUE save, char *errmsg, size_t errmsg_buflen)
i++;
}
if (need_close) {
- ret = redirect_close(fd2);
+ ret = redirect_close(fd2); /* async-signal-safe */
if (ret == -1) {
ERRMSG("close");
return -1;
@@ -2259,20 +2803,21 @@ run_exec_open(VALUE ary, VALUE save, char *errmsg, size_t errmsg_buflen)
return 0;
}
+/* This function should be async-signal-safe when sargp is NULL. Actually it is. */
static int
-run_exec_dup2_child(VALUE ary, VALUE save, char *errmsg, size_t errmsg_buflen)
+run_exec_dup2_child(VALUE ary, struct rb_execarg *sargp, char *errmsg, size_t errmsg_buflen)
{
long i;
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, save, errmsg, errmsg_buflen) < 0)
+ if (save_redirect_fd(newfd, sargp, errmsg, errmsg_buflen) < 0) /* async-signal-safe */
return -1;
- ret = redirect_dup2(oldfd, newfd);
+ ret = redirect_dup2(oldfd, newfd); /* async-signal-safe */
if (ret == -1) {
ERRMSG("dup2");
return -1;
@@ -2283,59 +2828,66 @@ run_exec_dup2_child(VALUE ary, VALUE save, char *errmsg, size_t errmsg_buflen)
}
#ifdef HAVE_SETPGID
+/* This function should be async-signal-safe when sargp is NULL. Actually it is. */
static int
-run_exec_pgroup(VALUE obj, VALUE save, char *errmsg, size_t errmsg_buflen)
+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.
* No race condition, even without setpgid from the parent.
- * (Is there an environment which has setpgid but FD_CLOEXEC?)
+ * (Is there an environment which has setpgid but no FD_CLOEXEC?)
*/
int ret;
- pid_t pgroup;
- if (!NIL_P(save)) {
+ rb_pid_t pgroup;
+
+ pgroup = eargp->pgroup_pgid;
+ if (pgroup == -1)
+ return 0;
+
+ if (sargp) {
/* maybe meaningless with no fork environment... */
- rb_ary_store(save, EXEC_OPTION_PGROUP, PIDT2NUM(getpgrp()));
+ sargp->pgroup_given = 1;
+ sargp->pgroup_pgid = getpgrp();
}
- pgroup = NUM2PIDT(obj);
+
if (pgroup == 0) {
- pgroup = getpid();
+ pgroup = getpid(); /* async-signal-safe */
}
- ret = setpgid(getpid(), pgroup);
+ ret = setpgid(getpid(), pgroup); /* async-signal-safe */
if (ret == -1) ERRMSG("setpgid");
return ret;
}
#endif
#if defined(HAVE_SETRLIMIT) && defined(RLIM2NUM)
+/* This function should be async-signal-safe when sargp is NULL. Hopefully it is. */
static int
-run_exec_rlimit(VALUE ary, VALUE save, char *errmsg, size_t errmsg_buflen)
+run_exec_rlimit(VALUE ary, struct rb_execarg *sargp, char *errmsg, size_t errmsg_buflen)
{
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 (!NIL_P(save)) {
+ if (sargp) {
VALUE tmp, newary;
if (getrlimit(rtype, &rlim) == -1) {
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)));
- newary = rb_ary_entry(save, EXEC_OPTION_RLIMIT);
- if (NIL_P(newary)) {
- newary = hide_obj(rb_ary_new());
- rb_ary_store(save, EXEC_OPTION_RLIMIT, newary);
- }
+ if (sargp->rlimit_limits == Qfalse)
+ newary = sargp->rlimit_limits = hide_obj(rb_ary_new());
+ else
+ 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]);
- if (setrlimit(rtype, &rlim) == -1) {
+ 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;
}
@@ -2344,179 +2896,262 @@ run_exec_rlimit(VALUE ary, VALUE save, char *errmsg, size_t errmsg_buflen)
}
#endif
+#if !defined(HAVE_FORK)
+static VALUE
+save_env_i(VALUE i, VALUE ary, int argc, VALUE *argv)
+{
+ rb_ary_push(ary, hide_obj(rb_ary_dup(argv[0])));
+ return Qnil;
+}
+
+static void
+save_env(struct rb_execarg *sargp)
+{
+ if (!sargp)
+ return;
+ if (sargp->env_modification == Qfalse) {
+ VALUE env = rb_const_get(rb_cObject, rb_intern("ENV"));
+ if (RTEST(env)) {
+ VALUE ary = hide_obj(rb_ary_new());
+ rb_block_call(env, idEach, 0, 0, save_env_i,
+ (VALUE)ary);
+ sargp->env_modification = ary;
+ }
+ sargp->unsetenv_others_given = 1;
+ sargp->unsetenv_others_do = 1;
+ }
+}
+#endif
+
+/* This function should be async-signal-safe when sargp is NULL. Hopefully it is. */
int
-rb_run_exec_options_err(const struct rb_exec_arg *e, struct rb_exec_arg *s, char *errmsg, size_t errmsg_buflen)
+rb_execarg_run_options(const struct rb_execarg *eargp, struct rb_execarg *sargp, char *errmsg, size_t errmsg_buflen)
{
- VALUE options = e->options;
- VALUE soptions = Qnil;
VALUE obj;
- if (!RTEST(options))
- return 0;
-
- if (s) {
- s->argc = 0;
- s->argv = NULL;
- s->prog = NULL;
- s->options = soptions = hide_obj(rb_ary_new());
- s->redirect_fds = Qnil;
+ if (sargp) {
+ /* assume that sargp is always NULL on fork-able environments */
+ MEMZERO(sargp, struct rb_execarg, 1);
+ sargp->redirect_fds = Qnil;
}
#ifdef HAVE_SETPGID
- obj = rb_ary_entry(options, EXEC_OPTION_PGROUP);
- if (RTEST(obj)) {
- if (run_exec_pgroup(obj, soptions, errmsg, errmsg_buflen) == -1)
+ if (eargp->pgroup_given) {
+ if (run_exec_pgroup(eargp, sargp, errmsg, errmsg_buflen) == -1) /* async-signal-safe */
return -1;
}
#endif
#if defined(HAVE_SETRLIMIT) && defined(RLIM2NUM)
- obj = rb_ary_entry(options, EXEC_OPTION_RLIMIT);
- if (!NIL_P(obj)) {
- if (run_exec_rlimit(obj, soptions, errmsg, errmsg_buflen) == -1)
+ obj = eargp->rlimit_limits;
+ if (obj != Qfalse) {
+ if (run_exec_rlimit(obj, sargp, errmsg, errmsg_buflen) == -1) /* hopefully async-signal-safe */
return -1;
}
#endif
- obj = rb_ary_entry(options, EXEC_OPTION_UNSETENV_OTHERS);
- if (RTEST(obj)) {
- save_env(soptions);
+#if !defined(HAVE_FORK)
+ if (eargp->unsetenv_others_given && eargp->unsetenv_others_do) {
+ save_env(sargp);
rb_env_clear();
}
- obj = rb_ary_entry(options, EXEC_OPTION_ENV);
- if (!NIL_P(obj)) {
+ obj = eargp->env_modification;
+ if (obj != Qfalse) {
long i;
- save_env(soptions);
+ 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
ruby_setenv(StringValueCStr(key), StringValueCStr(val));
}
}
+#endif
- obj = rb_ary_entry(options, EXEC_OPTION_CHDIR);
- if (!NIL_P(obj)) {
- if (!NIL_P(soptions)) {
- char *cwd = my_getcwd();
- rb_ary_store(soptions, EXEC_OPTION_CHDIR,
- hide_obj(rb_str_new2(cwd)));
- xfree(cwd);
+ if (eargp->umask_given) {
+ mode_t mask = eargp->umask_mask;
+ mode_t oldmask = umask(mask); /* never fail */ /* async-signal-safe */
+ if (sargp) {
+ sargp->umask_given = 1;
+ sargp->umask_mask = oldmask;
}
- if (chdir(RSTRING_PTR(obj)) == -1) {
- ERRMSG("chdir");
- return -1;
- }
- }
-
- obj = rb_ary_entry(options, EXEC_OPTION_UMASK);
- if (!NIL_P(obj)) {
- mode_t mask = NUM2MODET(obj);
- mode_t oldmask = umask(mask); /* never fail */
- if (!NIL_P(soptions))
- rb_ary_store(soptions, EXEC_OPTION_UMASK, MODET2NUM(oldmask));
}
- obj = rb_ary_entry(options, EXEC_OPTION_DUP2);
- if (!NIL_P(obj)) {
- if (run_exec_dup2(obj, soptions, errmsg, errmsg_buflen) == -1)
+ obj = eargp->fd_dup2;
+ if (obj != Qfalse) {
+ if (run_exec_dup2(obj, eargp->dup2_tmpbuf, sargp, errmsg, errmsg_buflen) == -1) /* hopefully async-signal-safe */
return -1;
}
- obj = rb_ary_entry(options, EXEC_OPTION_CLOSE);
- if (!NIL_P(obj)) {
- if (!NIL_P(soptions))
+ obj = eargp->fd_close;
+ if (obj != Qfalse) {
+ if (sargp)
rb_warn("cannot close fd before spawn");
else {
- if (run_exec_close(obj, errmsg, errmsg_buflen) == -1)
+ if (run_exec_close(obj, errmsg, errmsg_buflen) == -1) /* async-signal-safe */
return -1;
}
}
#ifdef HAVE_FORK
- obj = rb_ary_entry(options, EXEC_OPTION_CLOSE_OTHERS);
- if (obj != Qfalse) {
- rb_close_before_exec(3, FIX2INT(obj), e->redirect_fds);
+ if (!eargp->close_others_given || eargp->close_others_do) {
+ rb_close_before_exec(3, eargp->close_others_maxhint, eargp->redirect_fds); /* async-signal-safe */
}
#endif
- obj = rb_ary_entry(options, EXEC_OPTION_OPEN);
- if (!NIL_P(obj)) {
- if (run_exec_open(obj, soptions, errmsg, errmsg_buflen) == -1)
+ obj = eargp->fd_open;
+ if (obj != Qfalse) {
+ if (run_exec_open(obj, sargp, errmsg, errmsg_buflen) == -1) /* async-signal-safe */
return -1;
}
- obj = rb_ary_entry(options, EXEC_OPTION_DUP2_CHILD);
- if (!NIL_P(obj)) {
- if (run_exec_dup2_child(obj, soptions, errmsg, errmsg_buflen) == -1)
+ obj = eargp->fd_dup2_child;
+ if (obj != Qfalse) {
+ if (run_exec_dup2_child(obj, sargp, errmsg, errmsg_buflen) == -1) /* async-signal-safe */
return -1;
}
+ if (eargp->chdir_given) {
+ if (sargp) {
+ char *cwd = my_getcwd();
+ sargp->chdir_given = 1;
+ sargp->chdir_dir = hide_obj(rb_str_new2(cwd));
+ xfree(cwd);
+ }
+ if (chdir(RSTRING_PTR(eargp->chdir_dir)) == -1) { /* async-signal-safe */
+ ERRMSG("chdir");
+ return -1;
+ }
+ }
+
+#ifdef HAVE_SETGID
+ if (eargp->gid_given) {
+ if (setgid(eargp->gid) < 0) {
+ ERRMSG("setgid");
+ return -1;
+ }
+ }
+#endif
+#ifdef HAVE_SETUID
+ if (eargp->uid_given) {
+ if (setuid(eargp->uid) < 0) {
+ ERRMSG("setuid");
+ return -1;
+ }
+ }
+#endif
+
+ if (sargp) {
+ VALUE ary = sargp->fd_dup2;
+ if (ary != Qfalse) {
+ size_t len = run_exec_dup2_tmpbuf_size(RARRAY_LEN(ary));
+ VALUE tmpbuf = hide_obj(rb_str_new(0, len));
+ rb_str_set_len(tmpbuf, len);
+ sargp->dup2_tmpbuf = tmpbuf;
+ }
+ }
+
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_run_exec_options_err(e, s, NULL, 0);
+ 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_err(const struct rb_exec_arg *e, char *errmsg, size_t errmsg_buflen)
+rb_exec_async_signal_safe(const struct rb_execarg *eargp, char *errmsg, size_t errmsg_buflen)
{
- int argc = e->argc;
- VALUE *argv = e->argv;
- const char *prog = e->prog;
+#if !defined(HAVE_FORK)
+ struct rb_execarg sarg, *const sargp = &sarg;
+#else
+ struct rb_execarg *const sargp = NULL;
+#endif
- if (rb_run_exec_options_err(e, NULL, errmsg, errmsg_buflen) < 0) {
- return -1;
+ 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;
}
- if (argc == 0) {
- rb_proc_exec(prog);
+ if (eargp->use_shell) {
+ proc_exec_sh(RSTRING_PTR(eargp->invoke.sh.shell_script), eargp->envp_str); /* async-signal-safe */
}
else {
- rb_proc_exec_n(argc, argv, prog);
+ char *abspath = NULL;
+ if (!NIL_P(eargp->invoke.cmd.command_abspath))
+ 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)
+ 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;
}
+static int
+rb_exec_without_timer_thread(const struct rb_execarg *eargp, char *errmsg, size_t errmsg_buflen)
+{
+ int ret;
+ before_exec_non_async_signal_safe(); /* async-signal-safe if forked_child is true */
+ ret = rb_exec_async_signal_safe(eargp, errmsg, errmsg_buflen); /* hopefully async-signal-safe */
+ preserving_errno(after_exec_non_async_signal_safe()); /* not async-signal-safe because it calls rb_thread_start_timer_thread. */
+ return ret;
+}
+
+int
+rb_exec_err(const struct rb_exec_arg *e, char *errmsg, size_t errmsg_buflen)
+{
+ return rb_exec_without_timer_thread(rb_execarg_get(e->execarg_obj), errmsg, errmsg_buflen);
+}
+
int
rb_exec(const struct rb_exec_arg *e)
{
#if !defined FD_CLOEXEC && !defined HAVE_SPAWNV
char errmsg[80] = { '\0' };
- int ret = rb_exec_err(e, errmsg, sizeof(errmsg));
+ 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(), e->prog);
+ 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_err(e, NULL, 0);
+ return rb_exec_without_timer_thread(rb_execarg_get(e->execarg_obj), NULL, 0);
#endif
}
#ifdef HAVE_FORK
+/* This function should be async-signal-safe. Hopefully it is. */
static int
rb_exec_atfork(void* arg, char *errmsg, size_t errmsg_buflen)
{
- rb_thread_atfork_before_exec();
- return rb_exec_err(arg, errmsg, errmsg_buflen);
+ return rb_exec_async_signal_safe(arg, errmsg, errmsg_buflen); /* hopefully async-signal-safe */
}
#endif
#ifdef HAVE_FORK
-#ifdef FD_CLOEXEC
#if SIZEOF_INT == SIZEOF_LONG
#define proc_syswait (VALUE (*)(VALUE))rb_syswait
#else
@@ -2527,12 +3162,11 @@ proc_syswait(VALUE pid)
return Qnil;
}
#endif
-#endif
static int
move_fds_to_avoid_crash(int *fdp, int n, VALUE fds)
{
- long min = 0;
+ int min = 0;
int i;
for (i = 0; i < n; i++) {
int ret;
@@ -2541,7 +3175,7 @@ move_fds_to_avoid_crash(int *fdp, int n, VALUE fds)
min = fdp[i]+1;
while (RTEST(rb_hash_lookup(fds, INT2FIX(min))))
min++;
- ret = fcntl(fdp[i], F_DUPFD, min);
+ ret = rb_cloexec_fcntl_dupfd(fdp[i], min);
if (ret == -1)
return -1;
rb_update_max_fd(ret);
@@ -2595,7 +3229,9 @@ chfunc_protect(VALUE arg)
* process.
*
* If +status+ is given, protects from any exceptions and sets the
- * jump status to it.
+ * jump status to it, and returns -1. If failed to fork new process
+ * but no exceptions occurred, sets 0 to it. Otherwise, if forked
+ * successfully, the value of +status+ is undetermined.
*
* In the child process, just returns 0 if +chfunc+ is +NULL+.
* Otherwise +chfunc+ will be called with +charg+, and then the child
@@ -2613,40 +3249,43 @@ chfunc_protect(VALUE arg)
*
* +chfunc+ must not raise any exceptions.
*/
-rb_pid_t
-rb_fork_err(int *status, int (*chfunc)(void*, char *, size_t), void *charg, VALUE fds,
- char *errmsg, size_t errmsg_buflen)
+
+static rb_pid_t
+retry_fork(int *status, int *ep, int chfunc_is_async_signal_safe)
{
rb_pid_t pid;
- int err, state = 0;
-#ifdef FD_CLOEXEC
- int ep[2];
- VALUE io = Qnil;
-#endif
+ int state = 0;
+ int try_gc = 1;
#define prefork() ( \
rb_io_flush(rb_stdout), \
rb_io_flush(rb_stderr) \
)
- prefork();
-#ifdef FD_CLOEXEC
- if (chfunc) {
- if (pipe_nocrash(ep, fds)) return -1;
- if (fcntl(ep[1], F_SETFD, FD_CLOEXEC)) {
- preserving_errno((close(ep[0]), close(ep[1])));
- return -1;
- }
- }
-#endif
- for (; before_fork(), (pid = fork()) < 0; prefork()) {
- after_fork();
+ while (1) {
+ prefork();
+ if (!chfunc_is_async_signal_safe)
+ before_fork();
+ pid = fork();
+ if (pid == 0) /* fork succeed, child process */
+ return pid;
+ if (!chfunc_is_async_signal_safe)
+ preserving_errno(after_fork());
+ if (0 < pid) /* fork succeed, parent process */
+ return pid;
+ /* fork failed */
switch (errno) {
+ case ENOMEM:
+ if (try_gc-- > 0 && !rb_during_gc()) {
+ rb_gc();
+ continue;
+ }
+ break;
case EAGAIN:
#if defined(EWOULDBLOCK) && EWOULDBLOCK != EAGAIN
case EWOULDBLOCK:
#endif
- if (!status && !chfunc) {
+ if (!status && !ep) {
rb_thread_sleep(1);
continue;
}
@@ -2655,94 +3294,157 @@ rb_fork_err(int *status, int (*chfunc)(void*, char *, size_t), void *charg, VALU
if (status) *status = state;
if (!state) continue;
}
- default:
-#ifdef FD_CLOEXEC
- if (chfunc) {
- preserving_errno((close(ep[0]), close(ep[1])));
- }
-#endif
- if (state && !status) rb_jump_tag(state);
- return -1;
+ break;
+ }
+ if (ep) {
+ preserving_errno((close(ep[0]), close(ep[1])));
}
+ if (state && !status) rb_jump_tag(state);
+ return -1;
}
- if (!pid) {
- forked_child = 1;
- if (chfunc) {
- struct chfunc_protect_t arg;
- arg.chfunc = chfunc;
- arg.arg = charg;
- arg.errmsg = errmsg;
- arg.buflen = errmsg_buflen;
-#ifdef FD_CLOEXEC
- close(ep[0]);
-#endif
- if (!(int)rb_protect(chfunc_protect, (VALUE)&arg, &state)) _exit(EXIT_SUCCESS);
-#ifdef FD_CLOEXEC
- if (write(ep[1], &state, sizeof(state)) == sizeof(state) && state) {
- VALUE errinfo = rb_errinfo();
- io = rb_io_fdopen(ep[1], O_WRONLY|O_BINARY, NULL);
- rb_marshal_dump(errinfo, io);
- rb_io_flush(io);
- }
- err = errno;
- if (write(ep[1], &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(ep[1], errmsg, errmsg_buflen) < 0)
- err = errno;
+}
+
+static void
+send_child_error(int fd, int state, char *errmsg, size_t errmsg_buflen, int chfunc_is_async_signal_safe)
+{
+ VALUE io = Qnil;
+ int err;
+
+ if (!chfunc_is_async_signal_safe) {
+ if (write(fd, &state, sizeof(state)) == sizeof(state) && state) {
+ VALUE errinfo = rb_errinfo();
+ io = rb_io_fdopen(fd, O_WRONLY|O_BINARY, NULL);
+ rb_marshal_dump(errinfo, io);
+ rb_io_flush(io);
+ }
+ }
+ err = errno;
+ if (write(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)
+ 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)
+{
+ int err, state = 0;
+ VALUE io = Qnil;
+ 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) {
+ err = errno;
+ }
+ *errp = err;
+ if (size == sizeof(err) &&
+ errmsg && 0 < errmsg_buflen) {
+ ssize_t ret = READ_FROM_CHILD(errmsg, errmsg_buflen-1);
+ if (0 <= ret) {
+ errmsg[ret] = '\0';
+ }
+ }
+ if (NIL_P(io))
+ close(fd);
+ else
+ rb_io_close(io);
+ 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)
+{
+ rb_pid_t pid;
+ int err, state = 0;
+ int ep[2];
+ VALUE exc = Qnil;
+ int error_occurred;
+
+ if (status) *status = 0;
+
+ if (!chfunc) {
+ pid = retry_fork(status, NULL, FALSE);
+ if (pid < 0)
+ return pid;
+ if (!pid) {
+ forked_child = 1;
+ after_fork();
+ }
+ return pid;
+ }
+ else {
+ if (pipe_nocrash(ep, fds)) return -1;
+ pid = retry_fork(status, ep, chfunc_is_async_signal_safe);
+ if (pid < 0)
+ return pid;
+ if (!pid) {
+ int ret;
+ forked_child = 1;
+ close(ep[0]);
+ if (chfunc_is_async_signal_safe)
+ 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 (!NIL_P(io)) rb_io_close(io);
-#endif
+ if (!ret) _exit(EXIT_SUCCESS);
+ send_child_error(ep[1], state, errmsg, errmsg_buflen, chfunc_is_async_signal_safe);
#if EXIT_SUCCESS == 127
- _exit(EXIT_FAILURE);
+ _exit(EXIT_FAILURE);
#else
- _exit(127);
+ _exit(127);
#endif
- }
- }
- after_fork();
-#ifdef FD_CLOEXEC
- if (pid && chfunc) {
- ssize_t size;
- VALUE exc = Qnil;
- close(ep[1]);
- if ((read(ep[0], &state, sizeof(state))) == sizeof(state) && state) {
- io = rb_io_fdopen(ep[0], O_RDONLY|O_BINARY, NULL);
- exc = rb_marshal_load(io);
- rb_set_errinfo(exc);
- }
-#define READ_FROM_CHILD(ptr, len) \
- (NIL_P(io) ? read(ep[0], (ptr), (len)) : rb_io_bufread(io, (ptr), (len)))
- if ((size = READ_FROM_CHILD(&err, sizeof(err))) < 0) {
- err = errno;
- }
- if (size == sizeof(err) &&
- errmsg && 0 < errmsg_buflen) {
- ssize_t ret = READ_FROM_CHILD(errmsg, errmsg_buflen-1);
- if (0 <= ret) {
- errmsg[ret] = '\0';
+ }
+ close(ep[1]);
+ error_occurred = recv_child_error(ep[0], &state, &exc, &err, errmsg, errmsg_buflen, chfunc_is_async_signal_safe);
+ if (state || error_occurred) {
+ if (status) {
+ rb_protect(proc_syswait, (VALUE)pid, status);
+ if (state) *status = state;
+ }
+ else {
+ rb_syswait(pid);
+ if (state) rb_exc_raise(exc);
}
+ errno = err;
+ return -1;
}
- if (NIL_P(io))
- close(ep[0]);
- else
- rb_io_close(io);
- if (state || size) {
- if (status) {
- *status = state;
- rb_protect(proc_syswait, (VALUE)pid, status);
- }
- else {
- rb_syswait(pid);
- if (state) rb_exc_raise(exc);
- }
- errno = err;
- return -1;
- }
+ return pid;
}
-#endif
- 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);
}
struct chfunc_wrapper_t {
@@ -2764,14 +3466,20 @@ rb_fork(int *status, int (*chfunc)(void*), void *charg, VALUE fds)
struct chfunc_wrapper_t warg;
warg.chfunc = chfunc;
warg.arg = charg;
- return rb_fork_err(status, chfunc_wrapper, &warg, fds, NULL, 0);
+ return rb_fork_internal(status, chfunc_wrapper, &warg, FALSE, fds, NULL, 0);
}
else {
- return rb_fork_err(status, NULL, NULL, fds, NULL, 0);
+ return rb_fork_internal(status, NULL, NULL, FALSE, fds, NULL, 0);
}
}
+rb_pid_t
+rb_fork_ruby(int *status)
+{
+ return rb_fork_internal(status, NULL, NULL, FALSE, Qnil, NULL, 0);
+}
+
#endif
#if defined(HAVE_FORK) && !defined(CANNOT_FORK_WITH_PTHREAD)
@@ -2796,6 +3504,9 @@ rb_fork(int *status, int (*chfunc)(void*), void *charg, VALUE fds)
* fork doesn't copy other threads.
*
* If fork is not usable, Process.respond_to?(:fork) returns false.
+ *
+ * Note that fork(2) is not avaiable on some platforms like Windows and NetBSD 4.
+ * Therefore you should use spawn() instead of fork().
*/
static VALUE
@@ -2805,7 +3516,7 @@ rb_f_fork(VALUE obj)
rb_secure(2);
- switch (pid = rb_fork(0, 0, 0, Qnil)) {
+ switch (pid = rb_fork_ruby(NULL)) {
case 0:
rb_thread_atfork();
if (rb_block_given_p()) {
@@ -2828,6 +3539,29 @@ rb_f_fork(VALUE obj)
#define rb_f_fork rb_f_notimplement
#endif
+static int
+exit_status_code(VALUE status)
+{
+ int istatus;
+
+ switch (status) {
+ case Qtrue:
+ istatus = EXIT_SUCCESS;
+ break;
+ case Qfalse:
+ istatus = EXIT_FAILURE;
+ break;
+ default:
+ istatus = NUM2INT(status);
+#if EXIT_SUCCESS != 0
+ if (istatus == 0)
+ istatus = EXIT_SUCCESS;
+#endif
+ break;
+ }
+ return istatus;
+}
+
/*
* call-seq:
* Process.exit!(status=false)
@@ -2845,26 +3579,15 @@ 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) {
- switch (status) {
- case Qtrue:
- istatus = EXIT_SUCCESS;
- break;
- case Qfalse:
- istatus = EXIT_FAILURE;
- break;
- default:
- istatus = NUM2INT(status);
- break;
- }
+ istatus = exit_status_code(status);
}
else {
istatus = EXIT_FAILURE;
}
_exit(istatus);
- return Qnil; /* not reached */
+ UNREACHABLE;
}
void
@@ -2929,29 +3652,15 @@ rb_f_exit(int argc, VALUE *argv)
VALUE status;
int istatus;
- rb_secure(4);
if (argc > 0 && rb_scan_args(argc, argv, "01", &status) == 1) {
- switch (status) {
- case Qtrue:
- istatus = EXIT_SUCCESS;
- break;
- case Qfalse:
- istatus = EXIT_FAILURE;
- break;
- default:
- istatus = NUM2INT(status);
-#if EXIT_SUCCESS != 0
- if (istatus == 0)
- istatus = EXIT_SUCCESS;
-#endif
- break;
- }
+ istatus = exit_status_code(status);
}
else {
istatus = EXIT_SUCCESS;
}
rb_exit(istatus);
- return Qnil; /* not reached */
+
+ UNREACHABLE;
}
@@ -2969,7 +3678,6 @@ rb_f_exit(int argc, VALUE *argv)
VALUE
rb_f_abort(int argc, VALUE *argv)
{
- rb_secure(4);
if (argc == 0) {
if (!NIL_P(GET_THREAD()->errinfo)) {
ruby_error_print();
@@ -2985,127 +3693,93 @@ rb_f_abort(int argc, VALUE *argv)
args[0] = INT2NUM(EXIT_FAILURE);
rb_exc_raise(rb_class_new_instance(2, args, rb_eSystemExit));
}
- return Qnil; /* not reached */
+
+ UNREACHABLE;
}
void
rb_syswait(rb_pid_t pid)
{
- static int overriding;
-#ifdef SIGHUP
- RETSIGTYPE (*hfunc)(int) = 0;
-#endif
-#ifdef SIGQUIT
- RETSIGTYPE (*qfunc)(int) = 0;
-#endif
- RETSIGTYPE (*ifunc)(int) = 0;
int status;
- int i, hooked = FALSE;
- if (!overriding) {
-#ifdef SIGHUP
- hfunc = signal(SIGHUP, SIG_IGN);
-#endif
-#ifdef SIGQUIT
- qfunc = signal(SIGQUIT, SIG_IGN);
-#endif
- ifunc = signal(SIGINT, SIG_IGN);
- overriding = TRUE;
- hooked = TRUE;
- }
-
- do {
- i = rb_waitpid(pid, &status, 0);
- } while (i == -1 && errno == EINTR);
-
- if (hooked) {
-#ifdef SIGHUP
- signal(SIGHUP, hfunc);
-#endif
-#ifdef SIGQUIT
- signal(SIGQUIT, qfunc);
-#endif
- signal(SIGINT, ifunc);
- overriding = FALSE;
- }
-}
-
-static VALUE
-rb_exec_arg_prepare(struct rb_exec_arg *earg, int argc, VALUE *argv, int default_close_others)
-{
- VALUE prog = rb_exec_arg_init(argc, argv, TRUE, earg);
- if (NIL_P(rb_ary_entry(earg->options, EXEC_OPTION_CLOSE_OTHERS))) {
- VALUE v = default_close_others ? Qtrue : Qfalse;
- rb_exec_arg_addopt(earg, ID2SYM(rb_intern("close_others")), v);
- }
- rb_exec_arg_fixup(earg);
- return prog;
+ rb_waitpid(pid, &status, 0);
}
static rb_pid_t
-rb_spawn_process(struct rb_exec_arg *earg, VALUE prog, char *errmsg, size_t errmsg_buflen)
+rb_spawn_process(struct rb_execarg *eargp, char *errmsg, size_t errmsg_buflen)
{
rb_pid_t pid;
#if !USE_SPAWNV
int status;
#endif
#if !defined HAVE_FORK || USE_SPAWNV
- struct rb_exec_arg sarg;
- int argc;
- VALUE *argv;
+ VALUE prog;
+ struct rb_execarg sarg;
#endif
#if defined HAVE_FORK && !USE_SPAWNV
- pid = rb_fork_err(&status, rb_exec_atfork, earg, earg->redirect_fds, errmsg, errmsg_buflen);
+ pid = rb_fork_async_signal_safe(&status, rb_exec_atfork, eargp, eargp->redirect_fds, errmsg, errmsg_buflen);
#else
- if (rb_run_exec_options_err(earg, &sarg, errmsg, errmsg_buflen) < 0) {
+ prog = eargp->use_shell ? eargp->invoke.sh.shell_script : eargp->invoke.cmd.command_name;
+
+ if (rb_execarg_run_options(eargp, &sarg, errmsg, errmsg_buflen) < 0) {
return -1;
}
- argc = earg->argc;
- argv = earg->argv;
- if (prog && argc) argv[0] = prog;
+ if (prog && !eargp->use_shell) {
+ char **argv = ARGVSTR2ARGV(eargp->invoke.cmd.argv_str);
+ argv[0] = RSTRING_PTR(prog);
+ }
# if defined HAVE_SPAWNV
- if (!argc) {
- pid = proc_spawn(RSTRING_PTR(prog));
+ if (eargp->use_shell) {
+ pid = proc_spawn_sh(RSTRING_PTR(prog));
}
else {
- pid = proc_spawn_n(argc, argv, prog, earg->options);
+ 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 (argc) prog = rb_ary_join(rb_ary_new4(argc, argv), rb_str_new2(" "));
+ if (!eargp->use_shell) {
+ char **argv = ARGVSTR2ARGV(eargp->invoke.cmd.argv_str);
+ int argc = ARGVSTR2ARGC(eargp->invoke.cmd.argv_str);
+ prog = rb_ary_join(rb_ary_new4(argc, argv), rb_str_new2(" "));
+ }
status = system(StringValuePtr(prog));
rb_last_status_set((status & 0xff) << 8, 0);
# endif
- rb_run_exec_options_err(&sarg, NULL, errmsg, errmsg_buflen);
+ rb_execarg_run_options(&sarg, NULL, errmsg, errmsg_buflen);
#endif
return pid;
}
static rb_pid_t
-rb_spawn_internal(int argc, VALUE *argv, int default_close_others,
- char *errmsg, size_t errmsg_buflen)
+rb_spawn_internal(int argc, VALUE *argv, char *errmsg, size_t errmsg_buflen)
{
- struct rb_exec_arg earg;
- VALUE prog = rb_exec_arg_prepare(&earg, argc, argv, default_close_others);
- return rb_spawn_process(&earg, prog, errmsg, errmsg_buflen);
+ VALUE execarg_obj;
+ struct rb_execarg *eargp;
+ rb_pid_t ret;
+
+ execarg_obj = rb_execarg_new(argc, argv, TRUE);
+ eargp = rb_execarg_get(execarg_obj);
+ rb_execarg_fixup(execarg_obj);
+ ret = rb_spawn_process(eargp, errmsg, errmsg_buflen);
+ RB_GC_GUARD(execarg_obj);
+ return ret;
}
rb_pid_t
rb_spawn_err(int argc, VALUE *argv, char *errmsg, size_t errmsg_buflen)
{
- return rb_spawn_internal(argc, argv, TRUE, errmsg, errmsg_buflen);
+ return rb_spawn_internal(argc, argv, errmsg, errmsg_buflen);
}
rb_pid_t
rb_spawn(int argc, VALUE *argv)
{
- return rb_spawn_internal(argc, argv, TRUE, NULL, 0);
+ return rb_spawn_internal(argc, argv, NULL, 0);
}
/*
@@ -3154,12 +3828,16 @@ rb_f_system(int argc, VALUE *argv)
#ifdef SIGCHLD
RETSIGTYPE (*chfunc)(int);
+ rb_last_status_clear();
chfunc = signal(SIGCHLD, SIG_DFL);
#endif
- pid = rb_spawn_internal(argc, argv, FALSE, NULL, 0);
+ pid = rb_spawn_internal(argc, argv, NULL, 0);
#if defined(HAVE_FORK) || defined(HAVE_SPAWNV)
if (pid > 0) {
- rb_syswait(pid);
+ int ret, status;
+ ret = rb_waitpid(pid, &status, 0);
+ if (ret == (rb_pid_t)-1)
+ rb_sys_fail("Another thread waited the process started by system().");
}
#endif
#ifdef SIGCHLD
@@ -3180,7 +3858,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
@@ -3195,7 +3881,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:
@@ -3211,8 +3897,6 @@ rb_f_system(int argc, VALUE *argv)
* resource limit: resourcename is core, cpu, data, etc. See Process.setrlimit.
* :rlimit_resourcename => limit
* :rlimit_resourcename => [cur_limit, max_limit]
- * current directory:
- * :chdir => str
* umask:
* :umask => int
* redirection:
@@ -3234,8 +3918,17 @@ rb_f_system(int argc, VALUE *argv)
* integer : the file descriptor of specified the integer
* io : the file descriptor specified as io.fileno
* file descriptor inheritance: close non-redirected non-standard fds (3, 4, 5, ...) or not
- * :close_others => false : inherit fds (default for system and exec)
- * :close_others => true : don't inherit (default for spawn and IO.popen)
+ * :close_others => true : don't inherit
+ * 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.
@@ -3291,10 +3984,6 @@ rb_f_system(int argc, VALUE *argv)
* pid = spawn(command, :rlimit_core=>max) # enable core dump
* pid = spawn(command, :rlimit_core=>0) # never dump core.
*
- * The <code>:chdir</code> key in +options+ specifies the current directory.
- *
- * pid = spawn(command, :chdir=>"/var/tmp")
- *
* The <code>:umask</code> key in +options+ specifies the umask.
*
* pid = spawn(command, :umask=>077)
@@ -3361,7 +4050,7 @@ rb_f_system(int argc, VALUE *argv)
* This is different from fd.
* For example, :err=>:out means redirecting child stderr to parent stdout.
* But :err=>[:child, :out] means redirecting child stderr to child stdout.
- * They differs if stdout is redirected in the child process as follows.
+ * They differ if stdout is redirected in the child process as follows.
*
* # stdout and stderr is redirected to log file.
* # The file "log" is opened just once.
@@ -3374,6 +4063,10 @@ rb_f_system(int argc, VALUE *argv)
* io = IO.popen(["sh", "-c", "echo out; echo err >&2", :err=>[:child, :out]])
* p io.read #=> "out\nerr\n"
*
+ * The <code>:chdir</code> key in +options+ specifies the current directory.
+ *
+ * pid = spawn(command, :chdir=>"/var/tmp")
+ *
* spawn closes all non-standard unspecified descriptors by default.
* The "standard" descriptors are 0, 1 and 2.
* This behavior is specified by :close_others option.
@@ -3385,6 +4078,9 @@ rb_f_system(int argc, VALUE *argv)
*
* :close_others is true by default for spawn and IO.popen.
*
+ * Note that fds which close-on-exec flag is already set are closed
+ * regardless of :close_others option.
+ *
* So IO.pipe and spawn can be used as IO.popen.
*
* # similar to r = IO.popen(command)
@@ -3425,13 +4121,21 @@ rb_f_spawn(int argc, VALUE *argv)
{
rb_pid_t pid;
char errmsg[CHILD_ERRMSG_BUFLEN] = { '\0' };
- struct rb_exec_arg earg;
+ VALUE execarg_obj, fail_str;
+ struct rb_execarg *eargp;
+
+ execarg_obj = rb_execarg_new(argc, argv, TRUE);
+ eargp = rb_execarg_get(execarg_obj);
+ rb_execarg_fixup(execarg_obj);
+ fail_str = eargp->use_shell ? eargp->invoke.sh.shell_script : eargp->invoke.cmd.command_name;
+
+ pid = rb_spawn_process(eargp, errmsg, sizeof(errmsg));
+ RB_GC_GUARD(execarg_obj);
- pid = rb_spawn_process(&earg, rb_exec_arg_prepare(&earg, argc, argv, TRUE), errmsg, sizeof(errmsg));
if (pid == -1) {
const char *prog = errmsg;
- if (!prog[0] && !(prog = earg.prog) && earg.argc) {
- prog = RSTRING_PTR(earg.argv[0]);
+ if (!prog[0]) {
+ rb_sys_fail_str(fail_str);
}
rb_sys_fail(prog);
}
@@ -3468,11 +4172,9 @@ rb_f_sleep(int argc, VALUE *argv)
if (argc == 0) {
rb_thread_sleep_forever();
}
- else if (argc == 1) {
- rb_thread_wait_for(rb_time_interval(argv[0]));
- }
else {
- rb_raise(rb_eArgError, "wrong number of arguments (%d for 0..1)", argc);
+ rb_check_arity(argc, 0, 1);
+ rb_thread_wait_for(rb_time_interval(argv[0]));
}
end = time(0) - beg;
@@ -3595,6 +4297,40 @@ proc_setpgid(VALUE obj, VALUE pid, VALUE pgrp)
#endif
+#ifdef HAVE_GETSID
+/*
+ * call-seq:
+ * Process.getsid() -> integer
+ * Process.getsid(pid) -> integer
+ *
+ * Returns the session ID for for the given process id. If not give,
+ * return current process sid. Not available on all platforms.
+ *
+ * Process.getsid() #=> 27422
+ * Process.getsid(0) #=> 27422
+ * Process.getsid(Process.pid()) #=> 27422
+ */
+static VALUE
+proc_getsid(int argc, VALUE *argv)
+{
+ rb_pid_t sid;
+ VALUE pid;
+
+ rb_secure(2);
+ rb_scan_args(argc, argv, "01", &pid);
+
+ if (NIL_P(pid))
+ pid = INT2FIX(0);
+
+ sid = getsid(NUM2PIDT(pid));
+ if (sid < 0) rb_sys_fail(0);
+ return PIDT2NUM(sid);
+}
+#else
+#define proc_getsid rb_f_notimplement
+#endif
+
+
#if defined(HAVE_SETSID) || (defined(HAVE_SETPGRP) && defined(TIOCNOTTY))
#if !defined(HAVE_SETSID)
static rb_pid_t ruby_setsid(void);
@@ -3641,7 +4377,7 @@ ruby_setsid(void)
#endif
if (ret == -1) return -1;
- if ((fd = open("/dev/tty", O_RDWR)) >= 0) {
+ if ((fd = rb_cloexec_open("/dev/tty", O_RDWR, 0)) >= 0) {
rb_update_max_fd(fd);
ioctl(fd, TIOCNOTTY, NULL);
close(fd);
@@ -3876,6 +4612,8 @@ rlimit_resource_type(VALUE rtype)
return r;
rb_raise(rb_eArgError, "invalid resource name: %s", name);
+
+ UNREACHABLE;
}
static rlim_t
@@ -3914,6 +4652,8 @@ rlimit_resource_value(VALUE rval)
if (strcmp(name, "SAVED_CUR") == 0) return RLIM_SAVED_CUR;
#endif
rb_raise(rb_eArgError, "invalid resource value: %s", name);
+
+ UNREACHABLE;
}
#endif
@@ -4061,13 +4801,130 @@ check_gid_switch(void)
* <code>Process::UID</code>, and <code>Process::GID</code> modules.
*/
+#if defined(HAVE_PWD_H)
+static rb_uid_t
+obj2uid(VALUE id
+# ifdef USE_GETPWNAM_R
+ , char *getpw_buf, size_t getpw_buf_len
+# endif
+ )
+{
+ rb_uid_t uid;
+ VALUE tmp;
+
+ if (FIXNUM_P(id) || NIL_P(tmp = rb_check_string_type(id))) {
+ uid = NUM2UIDT(id);
+ }
+ else {
+ const char *usrname = StringValueCStr(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");
+#else
+ pwptr = getpwnam(usrname);
+#endif
+ if (!pwptr) {
+#ifndef USE_GETPWNAM_R
+ endpwent();
+#endif
+ rb_raise(rb_eArgError, "can't find user for %s", usrname);
+ }
+ uid = pwptr->pw_uid;
+#ifndef USE_GETPWNAM_R
+ endpwent();
+#endif
+ }
+ return uid;
+}
+
+# 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
+#endif
+
+#if defined(HAVE_GRP_H)
+static rb_gid_t
+obj2gid(VALUE id
+# ifdef USE_GETGRNAM_R
+ , char *getgr_buf, size_t getgr_buf_len
+# endif
+ )
+{
+ rb_gid_t gid;
+ VALUE tmp;
+
+ if (FIXNUM_P(id) || NIL_P(tmp = rb_check_string_type(id))) {
+ gid = NUM2GIDT(id);
+ }
+ else {
+ const char *grpname = StringValueCStr(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");
+#else
+ grptr = getgrnam(grpname);
+#endif
+ if (!grptr) {
+#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;
+#if !defined(USE_GETGRNAM_R) && defined(HAVE_ENDGRENT)
+ endgrent();
+#endif
+ }
+ return gid;
+}
+
+# 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
+#endif
#if defined HAVE_SETUID
/*
* call-seq:
- * Process::Sys.setuid(integer) -> nil
+ * Process::Sys.setuid(user) -> nil
*
- * Set the user ID of the current process to _integer_. Not
+ * Set the user ID of the current process to _user_. Not
* available on all platforms.
*
*/
@@ -4075,8 +4932,9 @@ check_gid_switch(void)
static VALUE
p_sys_setuid(VALUE obj, VALUE id)
{
+ PREPARE_GETPWNAM;
check_uid_switch();
- if (setuid(NUM2UIDT(id)) != 0) rb_sys_fail(0);
+ if (setuid(OBJ2UID(id)) != 0) rb_sys_fail(0);
return Qnil;
}
#else
@@ -4087,9 +4945,9 @@ p_sys_setuid(VALUE obj, VALUE id)
#if defined HAVE_SETRUID
/*
* call-seq:
- * Process::Sys.setruid(integer) -> nil
+ * Process::Sys.setruid(user) -> nil
*
- * Set the real user ID of the calling process to _integer_.
+ * Set the real user ID of the calling process to _user_.
* Not available on all platforms.
*
*/
@@ -4097,8 +4955,9 @@ p_sys_setuid(VALUE obj, VALUE id)
static VALUE
p_sys_setruid(VALUE obj, VALUE id)
{
+ PREPARE_GETPWNAM;
check_uid_switch();
- if (setruid(NUM2UIDT(id)) != 0) rb_sys_fail(0);
+ if (setruid(OBJ2UID(id)) != 0) rb_sys_fail(0);
return Qnil;
}
#else
@@ -4109,18 +4968,19 @@ p_sys_setruid(VALUE obj, VALUE id)
#if defined HAVE_SETEUID
/*
* call-seq:
- * Process::Sys.seteuid(integer) -> nil
+ * Process::Sys.seteuid(user) -> nil
*
* Set the effective user ID of the calling process to
- * _integer_. Not available on all platforms.
+ * _user_. Not available on all platforms.
*
*/
static VALUE
p_sys_seteuid(VALUE obj, VALUE id)
{
+ PREPARE_GETPWNAM;
check_uid_switch();
- if (seteuid(NUM2UIDT(id)) != 0) rb_sys_fail(0);
+ if (seteuid(OBJ2UID(id)) != 0) rb_sys_fail(0);
return Qnil;
}
#else
@@ -4133,7 +4993,7 @@ p_sys_seteuid(VALUE obj, VALUE id)
* call-seq:
* Process::Sys.setreuid(rid, eid) -> nil
*
- * Sets the (integer) real and/or effective user IDs of the current
+ * Sets the (user) real and/or effective user IDs of the current
* process to _rid_ and _eid_, respectively. A value of
* <code>-1</code> for either means to leave that ID unchanged. Not
* available on all platforms.
@@ -4143,8 +5003,9 @@ p_sys_seteuid(VALUE obj, VALUE id)
static VALUE
p_sys_setreuid(VALUE obj, VALUE rid, VALUE eid)
{
+ PREPARE_GETPWNAM;
check_uid_switch();
- if (setreuid(NUM2UIDT(rid),NUM2UIDT(eid)) != 0) rb_sys_fail(0);
+ if (setreuid(OBJ2UID(rid), OBJ2UID(eid)) != 0) rb_sys_fail(0);
return Qnil;
}
#else
@@ -4157,7 +5018,7 @@ p_sys_setreuid(VALUE obj, VALUE rid, VALUE eid)
* call-seq:
* Process::Sys.setresuid(rid, eid, sid) -> nil
*
- * Sets the (integer) real, effective, and saved user IDs of the
+ * Sets the (user) real, effective, and saved user IDs of the
* current process to _rid_, _eid_, and _sid_ respectively. A
* value of <code>-1</code> for any value means to
* leave that ID unchanged. Not available on all platforms.
@@ -4167,8 +5028,9 @@ p_sys_setreuid(VALUE obj, VALUE rid, VALUE eid)
static VALUE
p_sys_setresuid(VALUE obj, VALUE rid, VALUE eid, VALUE sid)
{
+ PREPARE_GETPWNAM;
check_uid_switch();
- if (setresuid(NUM2UIDT(rid),NUM2UIDT(eid),NUM2UIDT(sid)) != 0) rb_sys_fail(0);
+ if (setresuid(OBJ2UID(rid), OBJ2UID(eid), OBJ2UID(sid)) != 0) rb_sys_fail(0);
return Qnil;
}
#else
@@ -4198,9 +5060,9 @@ proc_getuid(VALUE obj)
#if defined(HAVE_SETRESUID) || defined(HAVE_SETREUID) || defined(HAVE_SETRUID) || defined(HAVE_SETUID)
/*
* call-seq:
- * Process.uid= integer -> numeric
+ * Process.uid= user -> numeric
*
- * Sets the (integer) user ID for this process. Not available on all
+ * Sets the (user) user ID for this process. Not available on all
* platforms.
*/
@@ -4208,10 +5070,11 @@ static VALUE
proc_setuid(VALUE obj, VALUE id)
{
rb_uid_t uid;
+ PREPARE_GETPWNAM;
check_uid_switch();
- uid = NUM2UIDT(id);
+ uid = OBJ2UID(id);
#if defined(HAVE_SETRESUID)
if (setresuid(uid, -1, -1) < 0) rb_sys_fail(0);
#elif defined HAVE_SETREUID
@@ -4264,10 +5127,10 @@ setreuid(rb_uid_t ruid, rb_uid_t euid)
/*
* call-seq:
- * Process::UID.change_privilege(integer) -> fixnum
+ * Process::UID.change_privilege(user) -> fixnum
*
* Change the current process's real and effective user ID to that
- * specified by _integer_. Returns the new user ID. Not
+ * specified by _user_. Returns the new user ID. Not
* available on all platforms.
*
* [Process.uid, Process.euid] #=> [0, 0]
@@ -4279,10 +5142,11 @@ static VALUE
p_uid_change_privilege(VALUE obj, VALUE id)
{
rb_uid_t uid;
+ PREPARE_GETPWNAM;
check_uid_switch();
- uid = NUM2UIDT(id);
+ uid = OBJ2UID(id);
if (geteuid() == 0) { /* root-user */
#if defined(HAVE_SETRESUID)
@@ -4295,21 +5159,24 @@ p_uid_change_privilege(VALUE obj, VALUE id)
if (getuid() == uid) {
if (SAVED_USER_ID == uid) {
if (setreuid(-1, uid) < 0) rb_sys_fail(0);
- } else {
+ }
+ else {
if (uid == 0) { /* (r,e,s) == (root, root, x) */
if (setreuid(-1, SAVED_USER_ID) < 0) rb_sys_fail(0);
if (setreuid(SAVED_USER_ID, 0) < 0) rb_sys_fail(0);
SAVED_USER_ID = 0; /* (r,e,s) == (x, root, root) */
if (setreuid(uid, uid) < 0) rb_sys_fail(0);
SAVED_USER_ID = uid;
- } else {
+ }
+ else {
if (setreuid(0, -1) < 0) rb_sys_fail(0);
SAVED_USER_ID = 0;
if (setreuid(uid, uid) < 0) rb_sys_fail(0);
SAVED_USER_ID = uid;
}
}
- } else {
+ }
+ else {
if (setreuid(uid, uid) < 0) rb_sys_fail(0);
SAVED_USER_ID = uid;
}
@@ -4317,12 +5184,14 @@ p_uid_change_privilege(VALUE obj, VALUE id)
if (getuid() == uid) {
if (SAVED_USER_ID == uid) {
if (seteuid(uid) < 0) rb_sys_fail(0);
- } else {
+ }
+ else {
if (uid == 0) {
if (setruid(SAVED_USER_ID) < 0) rb_sys_fail(0);
SAVED_USER_ID = 0;
if (setruid(0) < 0) rb_sys_fail(0);
- } else {
+ }
+ else {
if (setruid(0) < 0) rb_sys_fail(0);
SAVED_USER_ID = 0;
if (seteuid(uid) < 0) rb_sys_fail(0);
@@ -4330,15 +5199,18 @@ p_uid_change_privilege(VALUE obj, VALUE id)
SAVED_USER_ID = uid;
}
}
- } else {
+ }
+ else {
if (seteuid(uid) < 0) rb_sys_fail(0);
if (setruid(uid) < 0) rb_sys_fail(0);
SAVED_USER_ID = uid;
}
#else
+ (void)uid;
rb_notimplement();
#endif
- } else { /* unprivileged user */
+ }
+ else { /* unprivileged user */
#if defined(HAVE_SETRESUID)
if (setresuid((getuid() == uid)? (rb_uid_t)-1: uid,
(geteuid() == uid)? (rb_uid_t)-1: uid,
@@ -4349,15 +5221,18 @@ p_uid_change_privilege(VALUE obj, VALUE id)
if (setreuid((getuid() == uid)? (rb_uid_t)-1: uid,
(geteuid() == uid)? (rb_uid_t)-1: uid) < 0)
rb_sys_fail(0);
- } else if (getuid() != uid) {
+ }
+ else if (getuid() != uid) {
if (setreuid(uid, (geteuid() == uid)? (rb_uid_t)-1: uid) < 0)
rb_sys_fail(0);
SAVED_USER_ID = uid;
- } else if (/* getuid() == uid && */ geteuid() != uid) {
+ }
+ else if (/* getuid() == uid && */ geteuid() != uid) {
if (setreuid(geteuid(), uid) < 0) rb_sys_fail(0);
SAVED_USER_ID = uid;
if (setreuid(uid, -1) < 0) rb_sys_fail(0);
- } else { /* getuid() == uid && geteuid() == uid */
+ }
+ else { /* getuid() == uid && geteuid() == uid */
if (setreuid(-1, SAVED_USER_ID) < 0) rb_sys_fail(0);
if (setreuid(SAVED_USER_ID, uid) < 0) rb_sys_fail(0);
SAVED_USER_ID = uid;
@@ -4367,21 +5242,25 @@ p_uid_change_privilege(VALUE obj, VALUE id)
if (SAVED_USER_ID == uid) {
if (geteuid() != uid && seteuid(uid) < 0) rb_sys_fail(0);
if (getuid() != uid && setruid(uid) < 0) rb_sys_fail(0);
- } else if (/* SAVED_USER_ID != uid && */ geteuid() == uid) {
+ }
+ else if (/* SAVED_USER_ID != uid && */ geteuid() == uid) {
if (getuid() != uid) {
if (setruid(uid) < 0) rb_sys_fail(0);
SAVED_USER_ID = uid;
- } else {
+ }
+ else {
if (setruid(SAVED_USER_ID) < 0) rb_sys_fail(0);
SAVED_USER_ID = uid;
if (setruid(uid) < 0) rb_sys_fail(0);
}
- } else if (/* geteuid() != uid && */ getuid() == uid) {
+ }
+ else if (/* geteuid() != uid && */ getuid() == uid) {
if (seteuid(uid) < 0) rb_sys_fail(0);
if (setruid(SAVED_USER_ID) < 0) rb_sys_fail(0);
SAVED_USER_ID = uid;
if (setruid(uid) < 0) rb_sys_fail(0);
- } else {
+ }
+ else {
errno = EPERM;
rb_sys_fail(0);
}
@@ -4390,21 +5269,24 @@ p_uid_change_privilege(VALUE obj, VALUE id)
/* (r,e,s)==(uid,?,?) ==> (uid,uid,uid) */
if (setuid(uid) < 0) rb_sys_fail(0);
SAVED_USER_ID = uid;
- } else {
+ }
+ else {
errno = EPERM;
rb_sys_fail(0);
}
#elif defined HAVE_SETEUID
if (getuid() == uid && SAVED_USER_ID == uid) {
if (seteuid(uid) < 0) rb_sys_fail(0);
- } else {
+ }
+ else {
errno = EPERM;
rb_sys_fail(0);
}
#elif defined HAVE_SETUID
if (getuid() == uid && SAVED_USER_ID == uid) {
if (setuid(uid) < 0) rb_sys_fail(0);
- } else {
+ }
+ else {
errno = EPERM;
rb_sys_fail(0);
}
@@ -4420,9 +5302,9 @@ p_uid_change_privilege(VALUE obj, VALUE id)
#if defined HAVE_SETGID
/*
* call-seq:
- * Process::Sys.setgid(integer) -> nil
+ * Process::Sys.setgid(group) -> nil
*
- * Set the group ID of the current process to _integer_. Not
+ * Set the group ID of the current process to _group_. Not
* available on all platforms.
*
*/
@@ -4430,8 +5312,9 @@ p_uid_change_privilege(VALUE obj, VALUE id)
static VALUE
p_sys_setgid(VALUE obj, VALUE id)
{
+ PREPARE_GETGRNAM;
check_gid_switch();
- if (setgid(NUM2GIDT(id)) != 0) rb_sys_fail(0);
+ if (setgid(OBJ2GID(id)) != 0) rb_sys_fail(0);
return Qnil;
}
#else
@@ -4442,9 +5325,9 @@ p_sys_setgid(VALUE obj, VALUE id)
#if defined HAVE_SETRGID
/*
* call-seq:
- * Process::Sys.setrgid(integer) -> nil
+ * Process::Sys.setrgid(group) -> nil
*
- * Set the real group ID of the calling process to _integer_.
+ * Set the real group ID of the calling process to _group_.
* Not available on all platforms.
*
*/
@@ -4452,8 +5335,9 @@ p_sys_setgid(VALUE obj, VALUE id)
static VALUE
p_sys_setrgid(VALUE obj, VALUE id)
{
+ PREPARE_GETGRNAM;
check_gid_switch();
- if (setrgid(NUM2GIDT(id)) != 0) rb_sys_fail(0);
+ if (setrgid(OBJ2GID(id)) != 0) rb_sys_fail(0);
return Qnil;
}
#else
@@ -4464,18 +5348,19 @@ p_sys_setrgid(VALUE obj, VALUE id)
#if defined HAVE_SETEGID
/*
* call-seq:
- * Process::Sys.setegid(integer) -> nil
+ * Process::Sys.setegid(group) -> nil
*
* Set the effective group ID of the calling process to
- * _integer_. Not available on all platforms.
+ * _group_. Not available on all platforms.
*
*/
static VALUE
p_sys_setegid(VALUE obj, VALUE id)
{
+ PREPARE_GETGRNAM;
check_gid_switch();
- if (setegid(NUM2GIDT(id)) != 0) rb_sys_fail(0);
+ if (setegid(OBJ2GID(id)) != 0) rb_sys_fail(0);
return Qnil;
}
#else
@@ -4488,7 +5373,7 @@ p_sys_setegid(VALUE obj, VALUE id)
* call-seq:
* Process::Sys.setregid(rid, eid) -> nil
*
- * Sets the (integer) real and/or effective group IDs of the current
+ * Sets the (group) real and/or effective group IDs of the current
* process to <em>rid</em> and <em>eid</em>, respectively. A value of
* <code>-1</code> for either means to leave that ID unchanged. Not
* available on all platforms.
@@ -4498,8 +5383,9 @@ p_sys_setegid(VALUE obj, VALUE id)
static VALUE
p_sys_setregid(VALUE obj, VALUE rid, VALUE eid)
{
+ PREPARE_GETGRNAM;
check_gid_switch();
- if (setregid(NUM2GIDT(rid),NUM2GIDT(eid)) != 0) rb_sys_fail(0);
+ if (setregid(OBJ2GID(rid), OBJ2GID(eid)) != 0) rb_sys_fail(0);
return Qnil;
}
#else
@@ -4511,7 +5397,7 @@ p_sys_setregid(VALUE obj, VALUE rid, VALUE eid)
* call-seq:
* Process::Sys.setresgid(rid, eid, sid) -> nil
*
- * Sets the (integer) real, effective, and saved user IDs of the
+ * Sets the (group) real, effective, and saved user IDs of the
* current process to <em>rid</em>, <em>eid</em>, and <em>sid</em>
* respectively. A value of <code>-1</code> for any value means to
* leave that ID unchanged. Not available on all platforms.
@@ -4521,8 +5407,9 @@ p_sys_setregid(VALUE obj, VALUE rid, VALUE eid)
static VALUE
p_sys_setresgid(VALUE obj, VALUE rid, VALUE eid, VALUE sid)
{
+ PREPARE_GETGRNAM;
check_gid_switch();
- if (setresgid(NUM2GIDT(rid),NUM2GIDT(eid),NUM2GIDT(sid)) != 0) rb_sys_fail(0);
+ if (setresgid(OBJ2GID(rid), OBJ2GID(eid), OBJ2GID(sid)) != 0) rb_sys_fail(0);
return Qnil;
}
#else
@@ -4549,7 +5436,8 @@ p_sys_issetugid(VALUE obj)
rb_secure(2);
if (issetugid()) {
return Qtrue;
- } else {
+ }
+ else {
return Qfalse;
}
}
@@ -4589,10 +5477,11 @@ static VALUE
proc_setgid(VALUE obj, VALUE id)
{
rb_gid_t gid;
+ PREPARE_GETGRNAM;
check_gid_switch();
- gid = NUM2GIDT(id);
+ gid = OBJ2GID(id);
#if defined(HAVE_SETRESGID)
if (setresgid(gid, -1, -1) < 0) rb_sys_fail(0);
#elif defined HAVE_SETREGID
@@ -4637,9 +5526,9 @@ proc_setgid(VALUE obj, VALUE id)
* HP-UX 20
* Windows 1015
*/
-#define RB_MAX_GROUPS (65536)
static int _maxgroups = -1;
-static int get_sc_ngroups_max(void)
+static int
+get_sc_ngroups_max(void)
{
#ifdef _SC_NGROUPS_MAX
return (int)sysconf(_SC_NGROUPS_MAX);
@@ -4649,7 +5538,8 @@ static int get_sc_ngroups_max(void)
return -1;
#endif
}
-static int maxgroups(void)
+static int
+maxgroups(void)
{
if (_maxgroups < 0) {
_maxgroups = get_sc_ngroups_max();
@@ -4722,14 +5612,7 @@ proc_setgroups(VALUE obj, VALUE ary)
{
int ngroups, i;
rb_gid_t *groups;
-#ifdef HAVE_GETGRNAM_R
- long getgr_buf_len = sysconf(_SC_GETGR_R_SIZE_MAX);
- char* getgr_buf;
-
- if (getgr_buf_len < 0)
- getgr_buf_len = 4096;
- getgr_buf = ALLOCA_N(char, getgr_buf_len);
-#endif
+ PREPARE_GETGRNAM;
Check_Type(ary, T_ARRAY);
@@ -4740,37 +5623,9 @@ proc_setgroups(VALUE obj, VALUE ary)
groups = ALLOCA_N(rb_gid_t, ngroups);
for (i = 0; i < ngroups; i++) {
- VALUE g = RARRAY_PTR(ary)[i];
-
- if (FIXNUM_P(g)) {
- groups[i] = NUM2GIDT(g);
- }
- else {
- VALUE tmp = rb_check_string_type(g);
- struct group grp;
- struct group *p;
- int ret;
-
- if (NIL_P(tmp)) {
- groups[i] = NUM2GIDT(g);
- }
- else {
- const char *grpname = StringValueCStr(tmp);
+ VALUE g = RARRAY_AREF(ary, i);
-#ifdef HAVE_GETGRNAM_R
- ret = getgrnam_r(grpname, &grp, getgr_buf, getgr_buf_len, &p);
- if (ret)
- rb_sys_fail("getgrnam_r");
-#else
- p = getgrnam(grpname);
-#endif
- if (p == NULL) {
- rb_raise(rb_eArgError,
- "can't find group for %s", RSTRING_PTR(tmp));
- }
- groups[i] = p->gr_gid;
- }
- }
+ groups[i] = OBJ2GID(g);
}
if (setgroups(ngroups, groups) == -1) /* ngroups <= maxgroups */
@@ -4804,7 +5659,8 @@ proc_setgroups(VALUE obj, VALUE ary)
static VALUE
proc_initgroups(VALUE obj, VALUE uname, VALUE base_grp)
{
- if (initgroups(StringValuePtr(uname), NUM2GIDT(base_grp)) != 0) {
+ PREPARE_GETGRNAM;
+ if (initgroups(StringValuePtr(uname), OBJ2GID(base_grp)) != 0) {
rb_sys_fail(0);
}
return proc_getgroups(obj);
@@ -4905,34 +5761,28 @@ rb_daemon(int nochdir, int noclose)
before_fork();
err = daemon(nochdir, noclose);
after_fork();
+ rb_thread_atfork();
#else
int n;
- switch (rb_fork(0, 0, 0, Qnil)) {
- case -1:
- rb_sys_fail("daemon");
- case 0:
- break;
- default:
- _exit(EXIT_SUCCESS);
+#define fork_daemon() \
+ switch (rb_fork_ruby(NULL)) { \
+ case -1: return -1; \
+ case 0: rb_thread_atfork(); break; \
+ default: _exit(EXIT_SUCCESS); \
}
- proc_setsid();
+ fork_daemon();
+
+ if (setsid() < 0) return -1;
/* must not be process-leader */
- switch (rb_fork(0, 0, 0, Qnil)) {
- case -1:
- return -1;
- case 0:
- break;
- default:
- _exit(EXIT_SUCCESS);
- }
+ fork_daemon();
if (!nochdir)
err = chdir("/");
- if (!noclose && (n = open("/dev/null", O_RDWR, 0)) != -1) {
+ if (!noclose && (n = rb_cloexec_open("/dev/null", O_RDWR, 0)) != -1) {
rb_update_max_fd(n);
(void)dup2(n, 0);
(void)dup2(n, 1);
@@ -4976,10 +5826,10 @@ setregid(rb_gid_t rgid, rb_gid_t egid)
/*
* call-seq:
- * Process::GID.change_privilege(integer) -> fixnum
+ * Process::GID.change_privilege(group) -> fixnum
*
* Change the current process's real and effective group ID to that
- * specified by _integer_. Returns the new group ID. Not
+ * specified by _group_. Returns the new group ID. Not
* available on all platforms.
*
* [Process.gid, Process.egid] #=> [0, 0]
@@ -4991,10 +5841,11 @@ static VALUE
p_gid_change_privilege(VALUE obj, VALUE id)
{
rb_gid_t gid;
+ PREPARE_GETGRNAM;
check_gid_switch();
- gid = NUM2GIDT(id);
+ gid = OBJ2GID(id);
if (geteuid() == 0) { /* root-user */
#if defined(HAVE_SETRESGID)
@@ -5007,21 +5858,24 @@ p_gid_change_privilege(VALUE obj, VALUE id)
if (getgid() == gid) {
if (SAVED_GROUP_ID == gid) {
if (setregid(-1, gid) < 0) rb_sys_fail(0);
- } else {
+ }
+ else {
if (gid == 0) { /* (r,e,s) == (root, y, x) */
if (setregid(-1, SAVED_GROUP_ID) < 0) rb_sys_fail(0);
if (setregid(SAVED_GROUP_ID, 0) < 0) rb_sys_fail(0);
SAVED_GROUP_ID = 0; /* (r,e,s) == (x, root, root) */
if (setregid(gid, gid) < 0) rb_sys_fail(0);
SAVED_GROUP_ID = gid;
- } else { /* (r,e,s) == (z, y, x) */
+ }
+ else { /* (r,e,s) == (z, y, x) */
if (setregid(0, 0) < 0) rb_sys_fail(0);
SAVED_GROUP_ID = 0;
if (setregid(gid, gid) < 0) rb_sys_fail(0);
SAVED_GROUP_ID = gid;
}
}
- } else {
+ }
+ else {
if (setregid(gid, gid) < 0) rb_sys_fail(0);
SAVED_GROUP_ID = gid;
}
@@ -5029,13 +5883,15 @@ p_gid_change_privilege(VALUE obj, VALUE id)
if (getgid() == gid) {
if (SAVED_GROUP_ID == gid) {
if (setegid(gid) < 0) rb_sys_fail(0);
- } else {
+ }
+ else {
if (gid == 0) {
if (setegid(gid) < 0) rb_sys_fail(0);
if (setrgid(SAVED_GROUP_ID) < 0) rb_sys_fail(0);
SAVED_GROUP_ID = 0;
if (setrgid(0) < 0) rb_sys_fail(0);
- } else {
+ }
+ else {
if (setrgid(0) < 0) rb_sys_fail(0);
SAVED_GROUP_ID = 0;
if (setegid(gid) < 0) rb_sys_fail(0);
@@ -5043,7 +5899,8 @@ p_gid_change_privilege(VALUE obj, VALUE id)
SAVED_GROUP_ID = gid;
}
}
- } else {
+ }
+ else {
if (setegid(gid) < 0) rb_sys_fail(0);
if (setrgid(gid) < 0) rb_sys_fail(0);
SAVED_GROUP_ID = gid;
@@ -5051,7 +5908,8 @@ p_gid_change_privilege(VALUE obj, VALUE id)
#else
rb_notimplement();
#endif
- } else { /* unprivileged user */
+ }
+ else { /* unprivileged user */
#if defined(HAVE_SETRESGID)
if (setresgid((getgid() == gid)? (rb_gid_t)-1: gid,
(getegid() == gid)? (rb_gid_t)-1: gid,
@@ -5062,15 +5920,18 @@ p_gid_change_privilege(VALUE obj, VALUE id)
if (setregid((getgid() == gid)? (rb_uid_t)-1: gid,
(getegid() == gid)? (rb_uid_t)-1: gid) < 0)
rb_sys_fail(0);
- } else if (getgid() != gid) {
+ }
+ else if (getgid() != gid) {
if (setregid(gid, (getegid() == gid)? (rb_uid_t)-1: gid) < 0)
rb_sys_fail(0);
SAVED_GROUP_ID = gid;
- } else if (/* getgid() == gid && */ getegid() != gid) {
+ }
+ else if (/* getgid() == gid && */ getegid() != gid) {
if (setregid(getegid(), gid) < 0) rb_sys_fail(0);
SAVED_GROUP_ID = gid;
if (setregid(gid, -1) < 0) rb_sys_fail(0);
- } else { /* getgid() == gid && getegid() == gid */
+ }
+ else { /* getgid() == gid && getegid() == gid */
if (setregid(-1, SAVED_GROUP_ID) < 0) rb_sys_fail(0);
if (setregid(SAVED_GROUP_ID, gid) < 0) rb_sys_fail(0);
SAVED_GROUP_ID = gid;
@@ -5080,21 +5941,25 @@ p_gid_change_privilege(VALUE obj, VALUE id)
if (SAVED_GROUP_ID == gid) {
if (getegid() != gid && setegid(gid) < 0) rb_sys_fail(0);
if (getgid() != gid && setrgid(gid) < 0) rb_sys_fail(0);
- } else if (/* SAVED_GROUP_ID != gid && */ getegid() == gid) {
+ }
+ else if (/* SAVED_GROUP_ID != gid && */ getegid() == gid) {
if (getgid() != gid) {
if (setrgid(gid) < 0) rb_sys_fail(0);
SAVED_GROUP_ID = gid;
- } else {
+ }
+ else {
if (setrgid(SAVED_GROUP_ID) < 0) rb_sys_fail(0);
SAVED_GROUP_ID = gid;
if (setrgid(gid) < 0) rb_sys_fail(0);
+ }
}
- } else if (/* getegid() != gid && */ getgid() == gid) {
+ else if (/* getegid() != gid && */ getgid() == gid) {
if (setegid(gid) < 0) rb_sys_fail(0);
if (setrgid(SAVED_GROUP_ID) < 0) rb_sys_fail(0);
SAVED_GROUP_ID = gid;
if (setrgid(gid) < 0) rb_sys_fail(0);
- } else {
+ }
+ else {
errno = EPERM;
rb_sys_fail(0);
}
@@ -5103,25 +5968,29 @@ p_gid_change_privilege(VALUE obj, VALUE id)
/* (r,e,s)==(gid,?,?) ==> (gid,gid,gid) */
if (setgid(gid) < 0) rb_sys_fail(0);
SAVED_GROUP_ID = gid;
- } else {
+ }
+ else {
errno = EPERM;
rb_sys_fail(0);
}
#elif defined HAVE_SETEGID
if (getgid() == gid && SAVED_GROUP_ID == gid) {
if (setegid(gid) < 0) rb_sys_fail(0);
- } else {
+ }
+ else {
errno = EPERM;
rb_sys_fail(0);
}
#elif defined HAVE_SETGID
if (getgid() == gid && SAVED_GROUP_ID == gid) {
if (setgid(gid) < 0) rb_sys_fail(0);
- } else {
+ }
+ else {
errno = EPERM;
rb_sys_fail(0);
}
#else
+ (void)gid;
rb_notimplement();
#endif
}
@@ -5148,22 +6017,9 @@ proc_geteuid(VALUE obj)
}
#if defined(HAVE_SETRESUID) || defined(HAVE_SETREUID) || defined(HAVE_SETEUID) || defined(HAVE_SETUID) || defined(_POSIX_SAVED_IDS)
-/*
- * call-seq:
- * Process.euid= integer
- *
- * Sets the effective user ID for this process. Not available on all
- * platforms.
- */
-
-static VALUE
-proc_seteuid(VALUE obj, VALUE euid)
+static void
+proc_seteuid(rb_uid_t uid)
{
- rb_uid_t uid;
-
- check_uid_switch();
-
- uid = NUM2UIDT(euid);
#if defined(HAVE_SETRESUID)
if (setresuid(-1, uid, -1) < 0) rb_sys_fail(0);
#elif defined HAVE_SETREUID
@@ -5180,12 +6036,26 @@ proc_seteuid(VALUE obj, VALUE euid)
#else
rb_notimplement();
#endif
- return euid;
}
#endif
#if defined(HAVE_SETRESUID) || defined(HAVE_SETREUID) || defined(HAVE_SETEUID) || defined(HAVE_SETUID)
-#define proc_seteuid_m proc_seteuid
+/*
+ * call-seq:
+ * Process.euid= user
+ *
+ * Sets the effective user ID for this process. Not available on all
+ * platforms.
+ */
+
+static VALUE
+proc_seteuid_m(VALUE mod, VALUE euid)
+{
+ PREPARE_GETPWNAM;
+ check_uid_switch();
+ proc_seteuid(OBJ2UID(euid));
+ return euid;
+}
#else
#define proc_seteuid_m rb_f_notimplement
#endif
@@ -5193,17 +6063,22 @@ proc_seteuid(VALUE obj, VALUE euid)
static rb_uid_t
rb_seteuid_core(rb_uid_t euid)
{
+#if defined(HAVE_SETRESUID) || (defined(HAVE_SETREUID) && !defined(OBSOLETE_SETREUID))
rb_uid_t uid;
+#endif
check_uid_switch();
+#if defined(HAVE_SETRESUID) || (defined(HAVE_SETREUID) && !defined(OBSOLETE_SETREUID))
uid = getuid();
+#endif
#if defined(HAVE_SETRESUID)
if (uid != euid) {
if (setresuid(-1,euid,euid) < 0) rb_sys_fail(0);
SAVED_USER_ID = euid;
- } else {
+ }
+ else {
if (setresuid(-1,euid,-1) < 0) rb_sys_fail(0);
}
#elif defined(HAVE_SETREUID) && !defined(OBSOLETE_SETREUID)
@@ -5227,11 +6102,11 @@ rb_seteuid_core(rb_uid_t euid)
/*
* call-seq:
- * Process::UID.grant_privilege(integer) -> fixnum
- * Process::UID.eid= integer -> fixnum
+ * Process::UID.grant_privilege(user) -> fixnum
+ * Process::UID.eid= user -> fixnum
*
* Set the effective user ID, and if possible, the saved user ID of
- * the process to the given _integer_. Returns the new
+ * the process to the given _user_. Returns the new
* effective user ID. Not available on all platforms.
*
* [Process.uid, Process.euid] #=> [0, 0]
@@ -5242,7 +6117,8 @@ rb_seteuid_core(rb_uid_t euid)
static VALUE
p_uid_grant_privilege(VALUE obj, VALUE id)
{
- rb_seteuid_core(NUM2UIDT(id));
+ PREPARE_GETPWNAM;
+ rb_seteuid_core(OBJ2UID(id));
return id;
}
@@ -5279,11 +6155,17 @@ proc_getegid(VALUE obj)
static VALUE
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();
- gid = NUM2GIDT(egid);
+#if defined(HAVE_SETRESGID) || defined(HAVE_SETREGID) || defined(HAVE_SETEGID) || defined(HAVE_SETGID)
+ gid = OBJ2GID(egid);
+#endif
+
#if defined(HAVE_SETRESGID)
if (setresgid(-1, gid, -1) < 0) rb_sys_fail(0);
#elif defined HAVE_SETREGID
@@ -5313,17 +6195,22 @@ proc_setegid(VALUE obj, VALUE egid)
static rb_gid_t
rb_setegid_core(rb_gid_t egid)
{
+#if defined(HAVE_SETRESGID) || (defined(HAVE_SETREGID) && !defined(OBSOLETE_SETREGID))
rb_gid_t gid;
+#endif
check_gid_switch();
+#if defined(HAVE_SETRESGID) || (defined(HAVE_SETREGID) && !defined(OBSOLETE_SETREGID))
gid = getgid();
+#endif
#if defined(HAVE_SETRESGID)
if (gid != egid) {
if (setresgid(-1,egid,egid) < 0) rb_sys_fail(0);
SAVED_GROUP_ID = egid;
- } else {
+ }
+ else {
if (setresgid(-1,egid,-1) < 0) rb_sys_fail(0);
}
#elif defined(HAVE_SETREGID) && !defined(OBSOLETE_SETREGID)
@@ -5347,11 +6234,11 @@ rb_setegid_core(rb_gid_t egid)
/*
* call-seq:
- * Process::GID.grant_privilege(integer) -> fixnum
- * Process::GID.eid = integer -> fixnum
+ * Process::GID.grant_privilege(group) -> fixnum
+ * Process::GID.eid = group -> fixnum
*
* Set the effective group ID, and if possible, the saved group ID of
- * the process to the given _integer_. Returns the new
+ * the process to the given _group_. Returns the new
* effective group ID. Not available on all platforms.
*
* [Process.gid, Process.egid] #=> [0, 0]
@@ -5362,7 +6249,8 @@ rb_setegid_core(rb_gid_t egid)
static VALUE
p_gid_grant_privilege(VALUE obj, VALUE id)
{
- rb_setegid_core(NUM2GIDT(id));
+ PREPARE_GETGRNAM;
+ rb_setegid_core(OBJ2GID(id));
return id;
}
@@ -5404,12 +6292,17 @@ p_uid_exchangeable(void)
static VALUE
p_uid_exchange(VALUE obj)
{
- rb_uid_t uid, euid;
+ rb_uid_t uid;
+#if defined(HAVE_SETRESUID) || (defined(HAVE_SETREUID) && !defined(OBSOLETE_SETREUID))
+ rb_uid_t euid;
+#endif
check_uid_switch();
uid = getuid();
+#if defined(HAVE_SETRESUID) || (defined(HAVE_SETREUID) && !defined(OBSOLETE_SETREUID))
euid = geteuid();
+#endif
#if defined(HAVE_SETRESUID)
if (setresuid(euid, uid, uid) < 0) rb_sys_fail(0);
@@ -5461,12 +6354,17 @@ p_gid_exchangeable(void)
static VALUE
p_gid_exchange(VALUE obj)
{
- rb_gid_t gid, egid;
+ rb_gid_t gid;
+#if defined(HAVE_SETRESGID) || (defined(HAVE_SETREGID) && !defined(OBSOLETE_SETREGID))
+ rb_gid_t egid;
+#endif
check_gid_switch();
gid = getgid();
+#if defined(HAVE_SETRESGID) || (defined(HAVE_SETREGID) && !defined(OBSOLETE_SETREGID))
egid = getegid();
+#endif
#if defined(HAVE_SETRESGID)
if (setresgid(egid, gid, gid) < 0) rb_sys_fail(0);
@@ -5536,25 +6434,31 @@ p_uid_switch(VALUE obj)
euid = geteuid();
if (uid != euid) {
- proc_seteuid(obj, UIDT2NUM(uid));
+ proc_seteuid(uid);
if (rb_block_given_p()) {
under_uid_switch = 1;
return rb_ensure(rb_yield, Qnil, p_uid_sw_ensure, SAVED_USER_ID);
- } else {
+ }
+ else {
return UIDT2NUM(euid);
}
- } else if (euid != SAVED_USER_ID) {
- proc_seteuid(obj, UIDT2NUM(SAVED_USER_ID));
+ }
+ else if (euid != SAVED_USER_ID) {
+ proc_seteuid(SAVED_USER_ID);
if (rb_block_given_p()) {
under_uid_switch = 1;
return rb_ensure(rb_yield, Qnil, p_uid_sw_ensure, euid);
- } else {
+ }
+ else {
return UIDT2NUM(uid);
}
- } else {
+ }
+ else {
errno = EPERM;
rb_sys_fail(0);
}
+
+ UNREACHABLE;
}
#else
static VALUE
@@ -5582,7 +6486,8 @@ p_uid_switch(VALUE obj)
if (rb_block_given_p()) {
under_uid_switch = 1;
return rb_ensure(rb_yield, Qnil, p_uid_sw_ensure, obj);
- } else {
+ }
+ else {
return UIDT2NUM(euid);
}
}
@@ -5648,7 +6553,8 @@ p_gid_switch(VALUE obj)
if (rb_block_given_p()) {
under_gid_switch = 1;
return rb_ensure(rb_yield, Qnil, p_gid_sw_ensure, SAVED_GROUP_ID);
- } else {
+ }
+ else {
return GIDT2NUM(egid);
}
}
@@ -5657,7 +6563,8 @@ p_gid_switch(VALUE obj)
if (rb_block_given_p()) {
under_gid_switch = 1;
return rb_ensure(rb_yield, Qnil, p_gid_sw_ensure, egid);
- } else {
+ }
+ else {
return GIDT2NUM(gid);
}
}
@@ -5665,6 +6572,8 @@ p_gid_switch(VALUE obj)
errno = EPERM;
rb_sys_fail(0);
}
+
+ UNREACHABLE;
}
#else
static VALUE
@@ -5692,7 +6601,8 @@ p_gid_switch(VALUE obj)
if (rb_block_given_p()) {
under_gid_switch = 1;
return rb_ensure(rb_yield, Qnil, p_gid_sw_ensure, obj);
- } else {
+ }
+ else {
return GIDT2NUM(egid);
}
}
@@ -5700,22 +6610,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
@@ -5728,20 +6626,666 @@ 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("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
+ * [CLOCK_THREAD_CPUTIME_ID] SUSv3 to 4, Linux 2.5.63, FreeBSD 7.1
+ * [CLOCK_VIRTUAL] FreeBSD 3.0, OpenBSD 2.1
+ * [CLOCK_PROF] FreeBSD 3.0, OpenBSD 2.1
+ * [CLOCK_REALTIME_FAST] FreeBSD 8.1
+ * [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
+ * [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
+ * [: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;
@@ -5756,6 +7300,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);
@@ -5828,6 +7374,7 @@ Init_process(void)
rb_define_module_function(rb_mProcess, "getpgid", proc_getpgid, 1);
rb_define_module_function(rb_mProcess, "setpgid", proc_setpgid, 2);
+ rb_define_module_function(rb_mProcess, "getsid", proc_getsid, -1);
rb_define_module_function(rb_mProcess, "setsid", proc_setsid, 0);
rb_define_module_function(rb_mProcess, "getpriority", proc_getpriority, 2);
@@ -5999,8 +7546,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();
@@ -6027,6 +7644,12 @@ Init_process(void)
rb_define_module_function(rb_mProcGID, "sid_available?", p_gid_have_saved_id, 0);
rb_define_module_function(rb_mProcUID, "switch", p_uid_switch, 0);
rb_define_module_function(rb_mProcGID, "switch", p_gid_switch, 0);
+#ifdef p_uid_from_name
+ rb_define_module_function(rb_mProcUID, "from_name", p_uid_from_name, 1);
+#endif
+#ifdef p_gid_from_name
+ rb_define_module_function(rb_mProcGID, "from_name", p_gid_from_name, 1);
+#endif
rb_mProcID_Syscall = rb_define_module_under(rb_mProcess, "Sys");
diff --git a/random.c b/random.c
index 078d96e723..e77f56eb49 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);
}
@@ -218,8 +219,6 @@ genrand_real2(struct MT *mt)
#undef N
#undef M
-/* These real versions are due to Isaku Wada, 2002/01/09 added */
-
typedef struct {
VALUE seed;
struct MT mt;
@@ -262,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
@@ -307,27 +294,16 @@ 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);
}
VALUE rb_cRandom;
-static VALUE rb_Random_DEFAULT;
#define id_minus '-'
#define id_plus '+'
static ID id_rand, id_bytes;
@@ -359,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 *
@@ -393,80 +370,43 @@ 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;
}
/*
- * call-seq: Random.new([seed]) -> prng
- *
- * Creates new Mersenne Twister based pseudorandom number generator with
- * seed. When the argument seed is omitted, the generator is initialized
- * with Random.new_seed.
+ * call-seq:
+ * Random.new(seed = Random.new_seed) -> prng
*
- * The argument seed is used to ensure repeatable sequences of random numbers
- * between different runs of the program.
+ * Creates a new PRNG using +seed+ to set the initial state. If +seed+ is
+ * omitted, the generator is initialized with Random.new_seed.
*
- * prng = Random.new(1234)
- * [ prng.rand, prng.rand ] #=> [0.191519450378892, 0.622108771039832]
- * [ prng.integer(10), prng.integer(1000) ] #=> [4, 664]
- * prng = Random.new(1234)
- * [ prng.rand, prng.rand ] #=> [0.191519450378892, 0.622108771039832]
+ * See Random.srand for more information on the use of seed values.
*/
static VALUE
random_init(int argc, VALUE *argv, VALUE obj)
@@ -475,16 +415,18 @@ random_init(int argc, VALUE *argv, VALUE obj)
rb_random_t *rnd = get_rnd(obj);
if (argc == 0) {
+ rb_check_frozen(obj);
vseed = random_seed();
}
else {
rb_scan_args(argc, argv, "01", &vseed);
+ rb_check_copyable(obj, vseed);
}
rnd->seed = rand_init(&rnd->mt, vseed);
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
@@ -493,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;
@@ -507,14 +449,14 @@ fill_random_seed(unsigned int seed[DEFAULT_SEED_CNT])
memset(seed, 0, DEFAULT_SEED_LEN);
#if USE_DEV_URANDOM
- if ((fd = open("/dev/urandom", O_RDONLY
+ if ((fd = rb_cloexec_open("/dev/urandom", O_RDONLY
#ifdef O_NONBLOCK
|O_NONBLOCK
#endif
#ifdef O_NOCTTY
|O_NOCTTY
#endif
- )) >= 0) {
+ , 0)) >= 0) {
rb_update_max_fd(fd);
if (fstat(fd, &statbuf) == 0 && S_ISCHR(statbuf.st_mode)) {
if (read(fd, seed, DEFAULT_SEED_LEN) < DEFAULT_SEED_LEN) {
@@ -544,40 +486,41 @@ fill_random_seed(unsigned int seed[DEFAULT_SEED_CNT])
}
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(big, struct RBignum);
- OBJSETUP(big, 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;
}
/*
* call-seq: Random.new_seed -> integer
*
- * Returns arbitrary value for seed.
+ * Returns an arbitrary seed value. This is used by Random.new
+ * when no seed value is specified as an argument.
+ *
+ * Random.new_seed #=> 115032730400174366788466674494640623225
*/
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);
}
@@ -585,7 +528,16 @@ random_seed(void)
/*
* call-seq: prng.seed -> integer
*
- * Returns the seed of the generator.
+ * Returns the seed value used to initialize the generator. This may be used to
+ * initialize another generator with the same state at a later time, causing it
+ * to produce the same sequence of numbers.
+ *
+ * prng1 = Random.new(1234)
+ * prng1.seed #=> 1234
+ * prng1.rand(100) #=> 47
+ *
+ * prng2 = Random.new(prng1.seed)
+ * prng2.rand(100) #=> 47
*/
static VALUE
random_get_seed(VALUE obj)
@@ -597,9 +549,14 @@ random_get_seed(VALUE obj)
static VALUE
random_copy(VALUE obj, VALUE orig)
{
- rb_random_t *rnd1 = get_rnd(obj);
- rb_random_t *rnd2 = get_rnd(orig);
- struct MT *mt = &rnd1->mt;
+ rb_random_t *rnd1, *rnd2;
+ struct MT *mt;
+
+ if (!OBJ_INIT_COPY(obj, orig)) return obj;
+
+ rnd1 = get_rnd(obj);
+ rnd2 = get_rnd(orig);
+ mt = &rnd1->mt;
*rnd1 = *rnd2;
mt->next = mt->state + numberof(mt->state) - mt->left + 1;
@@ -609,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: */
@@ -679,11 +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];
@@ -695,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");
@@ -761,17 +654,26 @@ random_load(VALUE obj, VALUE dump)
}
/*
- * call-seq:
- * srand(number=0) -> old_seed
+ * call-seq:
+ * srand(number = Random.new_seed) -> old_seed
+ *
+ * Seeds the system pseudo-random number generator, Random::DEFAULT, with
+ * +number+. The previous seed value is returned.
+ *
+ * If +number+ is omitted, seeds the generator using a source of entropy
+ * provided by the operating system, if available (/dev/urandom on Unix systems
+ * or the RSA cryptographic provider on Windows), which is then combined with
+ * the time, the process id, and a sequence number.
+ *
+ * srand may be used to ensure repeatable sequences of pseudo-random numbers
+ * between different runs of the program. By setting the seed to a known value,
+ * programs can be made deterministic during testing.
*
- * Seeds the pseudorandom number generator to the value of
- * <i>number</i>. If <i>number</i> is omitted,
- * seeds the generator using a combination of the time, the
- * process id, and a sequence number. (This is also the behavior if
- * <code>Kernel::rand</code> is called without previously calling
- * <code>srand</code>, but without the sequence.) By setting the seed
- * to a known value, scripts can be made deterministic during testing.
- * The previous seed value is returned. Also see <code>Kernel::rand</code>.
+ * srand 1234 # => 268519324636777531569100071560086917274
+ * [ rand, rand ] # => [0.1915194503788923, 0.6221087710398319]
+ * [ rand(10), rand(1000) ] # => [4, 664]
+ * srand 1234 # => 1234
+ * [ rand, rand ] # => [0.1915194503788923, 0.6221087710398319]
*/
static VALUE
@@ -780,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();
}
@@ -830,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) {
@@ -875,15 +770,19 @@ 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;
}
/*
- * Returns random unsigned long value in [0, _limit_].
+ * Returns random unsigned long value in [0, +limit+].
*
- * Note that _limit_ is included, and the range of the argument and the
+ * Note that +limit+ is included, and the range of the argument and the
* return value depends on environments.
*/
unsigned long
@@ -898,7 +797,7 @@ rb_random_int32(VALUE obj)
rb_random_t *rnd = try_get_rnd(obj);
if (!rnd) {
#if SIZEOF_LONG * CHAR_BIT > 32
- VALUE lim = ULONG2NUM(0x100000000);
+ VALUE lim = ULONG2NUM(0x100000000UL);
#elif defined HAVE_LONG_LONG
VALUE lim = ULL2NUM((LONG_LONG)0xffffffff+1);
#else
@@ -916,7 +815,10 @@ rb_random_real(VALUE obj)
if (!rnd) {
VALUE v = rb_funcall2(obj, id_rand, 0, 0);
double d = NUM2DBL(v);
- if (d < 0.0 || d >= 1.0) {
+ if (d < 0.0) {
+ rb_raise(rb_eRangeError, "random number too small %g", d);
+ }
+ else if (d >= 1.0) {
rb_raise(rb_eRangeError, "random number too big %g", d);
}
return d;
@@ -924,11 +826,46 @@ rb_random_real(VALUE obj)
return genrand_real(&rnd->mt);
}
+static inline VALUE
+ulong_to_num_plus_1(unsigned long n)
+{
+#if HAVE_LONG_LONG
+ return ULL2NUM((LONG_LONG)n+1);
+#else
+ if (n >= ULONG_MAX) {
+ return rb_big_plus(ULONG2NUM(n), INT2FIX(1));
+ }
+ return ULONG2NUM(n+1);
+#endif
+}
+
+unsigned long
+rb_random_ulong_limited(VALUE obj, unsigned long limit)
+{
+ rb_random_t *rnd = try_get_rnd(obj);
+ if (!rnd) {
+ extern int rb_num_negative_p(VALUE);
+ VALUE lim = ulong_to_num_plus_1(limit);
+ VALUE v = rb_to_int(rb_funcall2(obj, id_rand, 1, &lim));
+ unsigned long r = NUM2ULONG(v);
+ if (rb_num_negative_p(v)) {
+ rb_raise(rb_eRangeError, "random number too small %ld", r);
+ }
+ if (r > limit) {
+ rb_raise(rb_eRangeError, "random number too big %ld", r);
+ }
+ return r;
+ }
+ return limited_rand(&rnd->mt, limit);
+}
+
/*
* call-seq: prng.bytes(size) -> a_string
*
- * Returns a random binary string. The argument size specified the length of
- * the result string.
+ * Returns a random binary string containing +size+ bytes.
+ *
+ * random_string = Random.new.bytes(10) # => "\xD7:R\xAB?\x83\xCE\xFAkO"
+ * random_string.size # => 10
*/
static VALUE
random_bytes(VALUE obj, VALUE len)
@@ -1003,8 +940,7 @@ rand_int(struct MT *mt, VALUE vmax, int restrictive)
if (rb_bigzero_p(vmax)) return Qnil;
if (!RBIGNUM_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)) {
@@ -1013,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;
}
@@ -1038,7 +974,7 @@ rand_range(struct MT* mt, VALUE range)
if ((v = vmax = range_values(range, &beg, &end, &excl)) == Qfalse)
return Qfalse;
- if (TYPE(vmax) != T_FLOAT && (v = rb_check_to_integer(vmax, "to_int"), !NIL_P(v))) {
+ if (!RB_TYPE_P(vmax, T_FLOAT) && (v = rb_check_to_integer(vmax, "to_int"), !NIL_P(v))) {
long max;
vmax = v;
v = Qnil;
@@ -1055,7 +991,7 @@ rand_range(struct MT* mt, VALUE range)
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)) {
@@ -1101,8 +1037,7 @@ rand_range(struct MT* mt, VALUE range)
case T_FLOAT: {
VALUE f = rb_check_to_float(beg);
if (!NIL_P(f)) {
- RFLOAT_VALUE(v) += RFLOAT_VALUE(f);
- return v;
+ return DBL2NUM(RFLOAT_VALUE(v) + RFLOAT_VALUE(f));
}
}
default:
@@ -1112,47 +1047,59 @@ rand_range(struct MT* mt, VALUE range)
return v;
}
+static VALUE rand_random(int argc, VALUE *argv, rb_random_t *rnd);
+
/*
* call-seq:
- * prng.rand -> float
- * prng.rand(limit) -> number
+ * prng.rand -> float
+ * prng.rand(max) -> number
+ *
+ * When +max+ is an Integer, +rand+ returns a random integer greater than
+ * or equal to zero and less than +max+. Unlike Kernel.rand, when +max+
+ * is a negative integer or zero, +rand+ raises an ArgumentError.
*
- * When the argument is an +Integer+ or a +Bignum+, it returns a
- * random integer greater than or equal to zero and less than the
- * argument. Unlike Random.rand, when the argument is a negative
- * integer or zero, it raises an ArgumentError.
+ * prng = Random.new
+ * prng.rand(100) # => 42
*
- * When the argument is a +Float+, it returns a random floating point
- * number between 0.0 and _max_, including 0.0 and excluding _max_.
+ * When +max+ is a Float, +rand+ returns a random floating point number
+ * between 0.0 and +max+, including 0.0 and excluding +max+.
*
- * When the argument _limit_ is a +Range+, it returns a random
- * number where range.member?(number) == true.
- * prng.rand(5..9) #=> one of [5, 6, 7, 8, 9]
- * prng.rand(5...9) #=> one of [5, 6, 7, 8]
- * prng.rand(5.0..9.0) #=> between 5.0 and 9.0, including 9.0
- * prng.rand(5.0...9.0) #=> between 5.0 and 9.0, excluding 9.0
+ * prng.rand(1.5) # => 1.4600282860034115
*
- * +begin+/+end+ of the range have to have subtract and add methods.
+ * When +max+ is a Range, +rand+ returns a random number where
+ * range.member?(number) == true.
*
- * Otherwise, it raises an ArgumentError.
+ * prng.rand(5..9) # => one of [5, 6, 7, 8, 9]
+ * prng.rand(5...9) # => one of [5, 6, 7, 8]
+ * prng.rand(5.0..9.0) # => between 5.0 and 9.0, including 9.0
+ * prng.rand(5.0...9.0) # => between 5.0 and 9.0, excluding 9.0
+ *
+ * Both the beginning and ending values of the range must respond to subtract
+ * (<tt>-</tt>) and add (<tt>+</tt>)methods, or rand will raise an
+ * ArgumentError.
*/
static VALUE
random_rand(int argc, VALUE *argv, VALUE obj)
{
- rb_random_t *rnd = get_rnd(obj);
+ return rand_random(argc, argv, get_rnd(obj));
+}
+
+static VALUE
+rand_random(int argc, VALUE *argv, rb_random_t *rnd)
+{
VALUE vmax, v;
if (argc == 0) {
return rb_float_new(genrand_real(&rnd->mt));
}
- else if (argc != 1) {
- rb_raise(rb_eArgError, "wrong number of arguments (%d for 0..1)", argc);
+ else {
+ rb_check_arity(argc, 0, 1);
}
vmax = argv[0];
if (NIL_P(vmax)) {
v = Qnil;
}
- else if (TYPE(vmax) != T_FLOAT && (v = rb_check_to_integer(vmax, "to_int"), !NIL_P(v))) {
+ else if (!RB_TYPE_P(vmax, T_FLOAT) && (v = rb_check_to_integer(vmax, "to_int"), !NIL_P(v))) {
v = rand_int(&rnd->mt, v, 1);
}
else if (v = rb_check_to_float(vmax), !NIL_P(v)) {
@@ -1180,9 +1127,27 @@ random_rand(int argc, VALUE *argv, VALUE obj)
/*
* call-seq:
- * prng1 == prng2 -> true or false
+ * prng1 == prng2 -> true or false
+ *
+ * Returns true if the two generators have the same internal state, otherwise
+ * false. Equivalent generators will return the same sequence of
+ * pseudo-random numbers. Two generators will generally have the same state
+ * only if they were initialized with the same seed
+ *
+ * Random.new == Random.new # => false
+ * Random.new(1234) == Random.new(1234) # => true
+ *
+ * and have the same invocation history.
*
- * Returns true if the generators' states equal.
+ * prng1 = Random.new(1234)
+ * prng2 = Random.new(1234)
+ * prng1 == prng2 # => true
+ *
+ * prng1.rand # => 0.1915194503788923
+ * prng1 == prng2 # => false
+ *
+ * prng2.rand # => 0.1915194503788923
+ * prng1 == prng2 # => true
*/
static VALUE
random_equal(VALUE self, VALUE other)
@@ -1199,31 +1164,34 @@ random_equal(VALUE self, VALUE other)
}
/*
- * call-seq:
- * rand(max=0) -> number
+ * call-seq:
+ * rand(max=0) -> number
*
+ * If called without an argument, or if <tt>max.to_i.abs == 0</tt>, rand
+ * returns a pseudo-random floating point number between 0.0 and 1.0,
+ * including 0.0 and excluding 1.0.
*
- * If <i>max</i> is +Range+, returns a pseudorandom number where
- * range.member(number) == true.
+ * rand #=> 0.2725926052826416
*
- * Or else converts _max_ to an integer using max1 =
- * max<code>.to_i.abs</code>.
+ * When +max.abs+ is greater than or equal to 1, +rand+ returns a pseudo-random
+ * integer greater than or equal to 0 and less than +max.to_i.abs+.
*
- * Then if _max_ is +nil+ the result is zero, returns a pseudorandom floating
- * point number greater than or equal to 0.0 and less than 1.0.
+ * rand(100) #=> 12
*
- * Otherwise, returns a pseudorandom integer greater than or equal to zero and
- * less than max1.
+ * When +max+ is a Range, +rand+ returns a random number where
+ * range.member?(number) == true.
*
- * <code>Kernel::srand</code> may be used to ensure repeatable sequences of
- * random numbers between different runs of the program. Ruby currently uses
- * a modified Mersenne Twister with a period of 2**19937-1.
+ * Negative or floating point values for +max+ are allowed, but may give
+ * surprising results.
*
- * srand 1234 #=> 0
- * [ rand, rand ] #=> [0.191519450163469, 0.49766366626136]
- * [ rand(10), rand(1000) ] #=> [6, 817]
- * srand 1234 #=> 1234
- * [ rand, rand ] #=> [0.191519450163469, 0.49766366626136]
+ * rand(-100) # => 87
+ * rand(-0.5) # => 0.8130921818028143
+ * rand(1.9) # equivalent to rand(1), which is always 0
+ *
+ * Kernel.srand may be used to ensure that sequences of random numbers are
+ * reproducible between different runs of a program.
+ *
+ * See also Random.rand.
*/
static VALUE
@@ -1247,19 +1215,17 @@ rb_f_rand(int argc, VALUE *argv, VALUE obj)
}
/*
- * call-seq:
- * Random.rand -> float
- * Random.rand(limit) -> number
- *
- * Alias of _Random::DEFAULT.rand_.
+ * call-seq:
+ * Random.rand -> float
+ * Random.rand(max) -> number
*
+ * Alias of Random::DEFAULT.rand.
*/
static VALUE
random_s_rand(int argc, VALUE *argv, VALUE obj)
{
- rand_start(&default_rand);
- return random_rand(argc, argv, rb_Random_DEFAULT);
+ return rand_random(argc, argv, rand_start(&default_rand));
}
#define SIP_HASH_STREAMING 0
@@ -1286,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);
@@ -1300,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;
@@ -1349,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);
}
}
@@ -1361,6 +1327,30 @@ rb_reset_random_seed(void)
r->seed = INT2FIX(0);
}
+/*
+ * Document-class: Random
+ *
+ * Random provides an interface to Ruby's pseudo-random number generator, or
+ * PRNG. The PRNG produces a deterministic sequence of bits which approximate
+ * true randomness. The sequence may be represented by integers, floats, or
+ * binary strings.
+ *
+ * The generator may be initialized with either a system-generated or
+ * user-supplied seed value by using Random.srand.
+ *
+ * The class method Random.rand provides the base functionality of Kernel.rand
+ * along with better handling of floating point values. These are both
+ * interfaces to Random::DEFAULT, the Ruby system PRNG.
+ *
+ * Random.new will create a new PRNG with a state independent of
+ * Random::DEFAULT, allowing multiple generators with different seed values or
+ * sequence positions to exist simultaneously. Random objects can be
+ * marshaled, allowing sequences to be saved and resumed.
+ *
+ * PRNGs are currently implemented as a modified Mersenne Twister with a period
+ * of 2**19937-1.
+ */
+
void
Init_Random(void)
{
@@ -1375,15 +1365,18 @@ Init_Random(void)
rb_define_method(rb_cRandom, "bytes", random_bytes, 1);
rb_define_method(rb_cRandom, "seed", random_get_seed, 0);
rb_define_method(rb_cRandom, "initialize_copy", random_copy, 1);
- rb_define_method(rb_cRandom, "marshal_dump", random_dump, 0);
- rb_define_method(rb_cRandom, "marshal_load", random_load, 1);
+ rb_define_private_method(rb_cRandom, "marshal_dump", random_dump, 0);
+ rb_define_private_method(rb_cRandom, "marshal_load", random_load, 1);
rb_define_private_method(rb_cRandom, "state", random_state, 0);
rb_define_private_method(rb_cRandom, "left", random_left, 0);
rb_define_method(rb_cRandom, "==", random_equal, 1);
- rb_Random_DEFAULT = TypedData_Wrap_Struct(rb_cRandom, &random_data_type, &default_rand);
- rb_global_variable(&rb_Random_DEFAULT);
- rb_define_const(rb_cRandom, "DEFAULT", rb_Random_DEFAULT);
+ {
+ 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);
+ }
rb_define_singleton_method(rb_cRandom, "srand", rb_f_srand, -1);
rb_define_singleton_method(rb_cRandom, "rand", random_s_rand, -1);
diff --git a/range.c b/range.c
index b7ae19118e..ebd0811a98 100644
--- a/range.c
+++ b/range.c
@@ -12,16 +12,32 @@
#include "ruby/ruby.h"
#include "ruby/encoding.h"
#include "internal.h"
+#include "id.h"
+
+#ifdef HAVE_FLOAT_H
+#include <float.h>
+#endif
+#include <math.h>
VALUE rb_cRange;
-static ID id_cmp, id_succ, id_beg, id_end, id_excl;
+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 inline VALUE
+SET_EXCL(VALUE r, VALUE v)
+{
+ v = RBOOL(RTEST(v));
+ RANGE_SET_EXCL(r, v);
+ return v;
+}
static VALUE
range_failed(void)
@@ -37,7 +53,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];
@@ -52,9 +68,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
@@ -62,16 +78,25 @@ 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(start, end, exclusive=false) -> range
+ * Range.new(begin, end, exclude_end=false) -> rng
*
- * Constructs a range using the given <i>start</i> and <i>end</i>. If the third
- * parameter is omitted or is <code>false</code>, the <i>range</i> will include
+ * Constructs a range using the given +begin+ and +end+. If the +exclude_end+
+ * parameter is omitted or is <code>false</code>, the +rng+ will include
* the end object; otherwise, it will be excluded.
*/
@@ -81,21 +106,28 @@ 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(rb_intern("initialize"), "`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:
* rng.exclude_end? -> true or false
*
- * Returns <code>true</code> if <i>rng</i> excludes its end value.
+ * Returns <code>true</code> if the range excludes its end value.
+ *
+ * (1..5).exclude_end? #=> false
+ * (1...5).exclude_end? #=> true
*/
static VALUE
@@ -123,9 +155,9 @@ recursive_equal(VALUE range, VALUE obj, int recur)
* call-seq:
* rng == obj -> true or false
*
- * Returns <code>true</code> only if <i>obj</i> is a Range, has equivalent
- * beginning and end items (by comparing them with <code>==</code>), and has
- * the same <code>exclude_end?</code> setting as <i>rng</i>.
+ * Returns <code>true</code> only if +obj+ is a Range, has equivalent
+ * begin and end items (by comparing them with <code>==</code>), and has
+ * the same #exclude_end? setting as the range.
*
* (0..2) == (0..2) #=> true
* (0..2) == Range.new(0,2) #=> true
@@ -191,9 +223,9 @@ recursive_eql(VALUE range, VALUE obj, int recur)
* call-seq:
* rng.eql?(obj) -> true or false
*
- * Returns <code>true</code> only if <i>obj</i> is a Range, has equivalent
- * beginning and end items (by comparing them with #eql?), and has the same
- * #exclude_end? setting as <i>rng</i>.
+ * Returns <code>true</code> only if +obj+ is a Range, has equivalent
+ * begin and end items (by comparing them with <code>eql?</code>),
+ * and has the same #exclude_end? setting as the range.
*
* (0..2).eql?(0..2) #=> true
* (0..2).eql?(Range.new(0,2)) #=> true
@@ -234,9 +266,9 @@ recursive_hash(VALUE range, VALUE dummy, int recur)
* call-seq:
* rng.hash -> fixnum
*
- * Generate a hash value such that two ranges with the same start and
- * end points, and the same value for the "exclude end" flag, generate
- * the same hash value.
+ * 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.
*/
static VALUE
@@ -312,35 +344,61 @@ discrete_object_p(VALUE obj)
return rb_respond_to(obj, id_succ);
}
+static VALUE
+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_AREF(args, 0);
+ if (!rb_obj_is_kind_of(step, rb_cNumeric)) {
+ step = rb_to_int(step);
+ }
+ }
+ if (rb_funcall(step, '<', 1, INT2FIX(0))) {
+ rb_raise(rb_eArgError, "step can't be negative");
+ }
+ else if (!rb_funcall(step, '>', 1, INT2FIX(0))) {
+ rb_raise(rb_eArgError, "step can't be 0");
+ }
+
+ if (rb_obj_is_kind_of(b, rb_cNumeric) && rb_obj_is_kind_of(e, rb_cNumeric)) {
+ return ruby_num_interval_step_size(b, e, step, EXCL(range));
+ }
+ return Qnil;
+}
/*
* call-seq:
* rng.step(n=1) {| obj | block } -> rng
* rng.step(n=1) -> an_enumerator
*
- * Iterates over <i>rng</i>, passing each <i>n</i>th element to the block. If
- * the range contains numbers, <i>n</i> is added for each iteration. Otherwise
- * <code>step</code> invokes <code>succ</code> to iterate through range
- * elements. The following code uses class <code>Xs</code>, which is defined
- * in the class-level documentation.
+ * Iterates over the range, passing each <code>n</code>th element to the block.
+ * If begin and end are numeric, +n+ is added for each iteration.
+ * Otherwise <code>step</code> invokes <code>succ</code> to iterate through
+ * range elements.
*
* If no block is given, an enumerator is returned instead.
*
- * range = Xs.new(1)..Xs.new(10)
- * range.step(2) {|x| puts x}
- * range.step(3) {|x| puts x}
+ * range = Xs.new(1)..Xs.new(10)
+ * range.step(2) {|x| puts x}
+ * puts
+ * range.step(3) {|x| puts x}
*
* <em>produces:</em>
*
- * 1 x
- * 3 xxx
- * 5 xxxxx
- * 7 xxxxxxx
- * 9 xxxxxxxxx
- * 1 x
- * 4 xxxx
- * 7 xxxxxxx
- * 10 xxxxxxxxxx
+ * 1 x
+ * 3 xxx
+ * 5 xxxxx
+ * 7 xxxxxxx
+ * 9 xxxxxxxxx
+ *
+ * 1 x
+ * 4 xxxx
+ * 7 xxxxxxx
+ * 10 xxxxxxxxxx
+ *
+ * See Range for the definition of class Xs.
*/
@@ -349,7 +407,7 @@ range_step(int argc, VALUE *argv, VALUE range)
{
VALUE b, e, step, tmp;
- RETURN_ENUMERATOR(range, argc, argv);
+ RETURN_SIZED_ENUMERATOR(range, argc, argv, range_step_size);
b = RANGE_BEG(range);
e = RANGE_END(range);
@@ -398,7 +456,7 @@ range_step(int argc, VALUE *argv, VALUE range)
else if (rb_obj_is_kind_of(b, rb_cNumeric) ||
!NIL_P(rb_check_to_integer(b, "to_int")) ||
!NIL_P(rb_check_to_integer(e, "to_int"))) {
- ID op = EXCL(range) ? '<' : rb_intern("<=");
+ ID op = EXCL(range) ? '<' : idLE;
VALUE v = b;
int i = 0;
@@ -436,6 +494,213 @@ range_step(int argc, VALUE *argv, VALUE range)
return range;
}
+#if SIZEOF_DOUBLE == 8 && defined(HAVE_INT64_T)
+union int64_double {
+ int64_t i;
+ double d;
+};
+
+static VALUE
+int64_as_double_to_num(int64_t i)
+{
+ union int64_double convert;
+ if (i < 0) {
+ convert.i = -i;
+ return DBL2NUM(-convert.d);
+ }
+ else {
+ convert.i = i;
+ return DBL2NUM(convert.d);
+ }
+}
+
+static int64_t
+double_as_int64(double d)
+{
+ union int64_double convert;
+ convert.d = fabs(d);
+ return d < 0 ? -convert.i : convert.i;
+}
+#endif
+
+static int
+is_integer_p(VALUE v)
+{
+ VALUE is_int = rb_check_funcall(v, id_integer_p, 0, 0);
+ return RTEST(is_int) && is_int != Qundef;
+}
+
+/*
+ * call-seq:
+ * rng.bsearch {|obj| block } -> value
+ *
+ * By using binary search, finds a value in range which meets the given
+ * condition in O(log n) where n is the size of the range.
+ *
+ * You can use this method in two use cases: a find-minimum mode and
+ * a find-any mode. In either case, the elements of the range must be
+ * monotone (or sorted) with respect to the block.
+ *
+ * In find-minimum mode (this is a good choice for typical use case),
+ * the block must return true or false, and there must be a value x
+ * so that:
+ *
+ * - 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.
+ *
+ * If x is within the range, this method returns the value x.
+ * Otherwise, it returns nil.
+ *
+ * ary = [0, 4, 7, 10, 12]
+ * (0...ary.size).bsearch {|i| ary[i] >= 4 } #=> 1
+ * (0...ary.size).bsearch {|i| ary[i] >= 6 } #=> 2
+ * (0...ary.size).bsearch {|i| ary[i] >= 8 } #=> 3
+ * (0...ary.size).bsearch {|i| ary[i] >= 100 } #=> nil
+ *
+ * (0.0...Float::INFINITY).bsearch {|x| Math.log(x) >= 0 } #=> 1.0
+ *
+ * In find-any mode (this behaves like libc's bsearch(3)), the block
+ * must return a number, and there must be two values x and y (x <= y)
+ * so that:
+ *
+ * - the block returns a positive number for v if v < x,
+ * - the block returns zero for v if x <= v < y, and
+ * - the block returns a negative number for v if y <= v.
+ *
+ * This method returns any value which is within the intersection of
+ * the given range and x...y (if any). If there is no value that
+ * satisfies the condition, it returns nil.
+ *
+ * ary = [0, 100, 100, 100, 200]
+ * (0..4).bsearch {|i| 100 - ary[i] } #=> 1, 2 or 3
+ * (0..4).bsearch {|i| 300 - ary[i] } #=> nil
+ * (0..4).bsearch {|i| 50 - ary[i] } #=> nil
+ *
+ * You must not mix the two modes at a time; the block must always
+ * return either true/false, or always return a number. It is
+ * undefined which value is actually picked up at each iteration.
+ */
+
+static VALUE
+range_bsearch(VALUE range)
+{
+ VALUE beg, end;
+ int smaller, satisfied = 0;
+
+ /* Implementation notes:
+ * Floats are handled by mapping them to 64 bits integers.
+ * Apart from sign issues, floats and their 64 bits integer have the
+ * same order, assuming they are represented as exponent followed
+ * by the mantissa. This is true with or without implicit bit.
+ *
+ * Finding the average of two ints needs to be careful about
+ * potential overflow (since float to long can use 64 bits)
+ * as well as the fact that -1/2 can be 0 or -1 in C89.
+ *
+ * Note that -0.0 is mapped to the same int as 0.0 as we don't want
+ * (-1...0.0).bsearch to yield -0.0.
+ */
+
+#define BSEARCH_CHECK(val) \
+ do { \
+ VALUE v = rb_yield(val); \
+ if (FIXNUM_P(v)) { \
+ if (FIX2INT(v) == 0) return val; \
+ smaller = FIX2INT(v) < 0; \
+ } \
+ else if (v == Qtrue) { \
+ satisfied = 1; \
+ smaller = 1; \
+ } \
+ else if (v == Qfalse || v == Qnil) { \
+ smaller = 0; \
+ } \
+ else if (rb_obj_is_kind_of(v, rb_cNumeric)) { \
+ int cmp = rb_cmpint(rb_funcall(v, id_cmp, 1, INT2FIX(0)), v, INT2FIX(0)); \
+ if (!cmp) return val; \
+ smaller = cmp < 0; \
+ } \
+ else { \
+ rb_raise(rb_eTypeError, "wrong argument type %s" \
+ " (must be numeric, true, false or nil)", \
+ rb_obj_classname(v)); \
+ } \
+ } while (0)
+
+#define BSEARCH(conv) \
+ do { \
+ RETURN_ENUMERATOR(range, 0, 0); \
+ if (EXCL(range)) high--; \
+ org_high = high; \
+ while (low < high) { \
+ mid = ((high < 0) == (low < 0)) ? low + ((high - low) / 2) \
+ : (low < -high) ? -((-1 - low - high)/2 + 1) : (low + high) / 2; \
+ BSEARCH_CHECK(conv(mid)); \
+ if (smaller) { \
+ high = mid; \
+ } \
+ else { \
+ low = mid + 1; \
+ } \
+ } \
+ if (low == org_high) { \
+ BSEARCH_CHECK(conv(low)); \
+ if (!smaller) return Qnil; \
+ } \
+ if (!satisfied) return Qnil; \
+ return conv(low); \
+ } while (0)
+
+
+ beg = RANGE_BEG(range);
+ end = RANGE_END(range);
+
+ if (FIXNUM_P(beg) && FIXNUM_P(end)) {
+ long low = FIX2LONG(beg);
+ long high = FIX2LONG(end);
+ long mid, org_high;
+ BSEARCH(INT2FIX);
+ }
+#if SIZEOF_DOUBLE == 8 && defined(HAVE_INT64_T)
+ else if (RB_TYPE_P(beg, T_FLOAT) || RB_TYPE_P(end, T_FLOAT)) {
+ int64_t low = double_as_int64(RFLOAT_VALUE(rb_Float(beg)));
+ int64_t high = double_as_int64(RFLOAT_VALUE(rb_Float(end)));
+ int64_t mid, org_high;
+ BSEARCH(int64_as_double_to_num);
+ }
+#endif
+ else if (is_integer_p(beg) && is_integer_p(end)) {
+ VALUE low = rb_to_int(beg);
+ VALUE high = rb_to_int(end);
+ VALUE mid, org_high;
+ RETURN_ENUMERATOR(range, 0, 0);
+ if (EXCL(range)) high = rb_funcall(high, '-', 1, INT2FIX(1));
+ org_high = high;
+
+ while (rb_cmpint(rb_funcall(low, id_cmp, 1, high), low, high) < 0) {
+ mid = rb_funcall(rb_funcall(high, '+', 1, low), id_div, 1, INT2FIX(2));
+ BSEARCH_CHECK(mid);
+ if (smaller) {
+ high = mid;
+ }
+ else {
+ low = rb_funcall(mid, '+', 1, INT2FIX(1));
+ }
+ }
+ if (rb_equal(low, org_high)) {
+ BSEARCH_CHECK(low);
+ if (!smaller) return Qnil;
+ }
+ if (!satisfied) return Qnil;
+ return low;
+ }
+ else {
+ rb_raise(rb_eTypeError, "can't do binary search for %s", rb_obj_classname(beg));
+ }
+ return range;
+}
+
static VALUE
each_i(VALUE v, void *arg)
{
@@ -452,23 +717,48 @@ sym_each_i(VALUE v, void *arg)
/*
* call-seq:
+ * rng.size -> num
+ *
+ * Returns the number of elements in the range.
+ *
+ * (10..20).size #=> 11
+ */
+
+static VALUE
+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 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
* rng.each -> an_enumerator
*
- * Iterates over the elements <i>rng</i>, passing each in turn to the
- * block. You can only iterate if the start object of the range
- * supports the +succ+ method (which means that you can't iterate over
- * ranges of +Float+ objects).
+ * Iterates over the elements of range, passing each in turn to the
+ * block.
*
- * If no block is given, an enumerator is returned instead.
+ * The +each+ method can only be used if the begin object of the range
+ * supports the +succ+ method. A TypeError is raised if the object
+ * does not have +succ+ method defined (like Float).
*
- * (10..15).each do |n|
- * print n, ' '
- * end
+ * If no block is given, an enumerator is returned instead.
*
- * <em>produces:</em>
+ * (10..15).each {|n| print n, ' ' }
+ * # prints: 10 11 12 13 14 15
*
- * 10 11 12 13 14 15
+ * (2.5..5).each {|n| print n, ' ' }
+ * # raises: TypeError: can't iterate from Float
*/
static VALUE
@@ -476,7 +766,7 @@ range_each(VALUE range)
{
VALUE beg, end;
- RETURN_ENUMERATOR(range, 0, 0);
+ RETURN_SIZED_ENUMERATOR(range, 0, 0, range_enum_size);
beg = RANGE_BEG(range);
end = RANGE_END(range);
@@ -523,7 +813,9 @@ range_each(VALUE range)
* call-seq:
* rng.begin -> obj
*
- * Returns the first object in <i>rng</i>.
+ * Returns the object that defines the beginning of the range.
+ *
+ * (1..10).begin #=> 1
*/
static VALUE
@@ -537,7 +829,7 @@ range_begin(VALUE range)
* call-seq:
* rng.end -> obj
*
- * Returns the object that defines the end of <i>rng</i>.
+ * Returns the object that defines the end of the range.
*
* (1..10).end #=> 10
* (1...10).end #=> 10
@@ -570,7 +862,11 @@ first_i(VALUE i, VALUE *ary)
* rng.first -> obj
* rng.first(n) -> an_array
*
- * Returns the first object in <i>rng</i>, or the first +n+ elements.
+ * Returns the first object in the range, or an array of the first +n+
+ * elements.
+ *
+ * (10..20).first #=> 10
+ * (10..20).first(3) #=> [10, 11, 12]
*/
static VALUE
@@ -583,7 +879,7 @@ range_first(int argc, VALUE *argv, VALUE range)
rb_scan_args(argc, argv, "1", &n);
ary[0] = n;
ary[1] = rb_ary_new2(NUM2LONG(n));
- rb_block_call(range, rb_intern("each"), 0, 0, first_i, (VALUE)ary);
+ rb_block_call(range, idEach, 0, 0, first_i, (VALUE)ary);
return ary[1];
}
@@ -594,7 +890,16 @@ range_first(int argc, VALUE *argv, VALUE range)
* rng.last -> obj
* rng.last(n) -> an_array
*
- * Returns the last object in <i>rng</i>, or the last +n+ elements.
+ * Returns the last object in the range,
+ * or an array of the last +n+ elements.
+ *
+ * Note that with no arguments +last+ will return the object that defines
+ * the end of the range even if #exclude_end? is +true+.
+ *
+ * (10..20).last #=> 20
+ * (10...20).last #=> 20
+ * (10..20).last(3) #=> [18, 19, 20]
+ * (10...20).last(3) #=> [17, 18, 19]
*/
static VALUE
@@ -610,10 +915,13 @@ range_last(int argc, VALUE *argv, VALUE range)
* rng.min -> obj
* rng.min {| a,b | block } -> obj
*
- * Returns the minimum value in <i>rng</i>. The second uses
- * the block to compare values. Returns nil if the first
- * value in range is larger than the last value.
+ * Returns the minimum value in the range. Returns +nil+ if the begin
+ * value of the range is larger than the end value.
*
+ * Can be given an optional block to override the default comparison
+ * method <code>a <=> b</code>.
+ *
+ * (10..20).min #=> 10
*/
@@ -639,10 +947,13 @@ range_min(VALUE range)
* rng.max -> obj
* rng.max {| a,b | block } -> obj
*
- * Returns the maximum value in <i>rng</i>. The second uses
- * the block to compare values. Returns nil if the first
- * value in range is larger than the last value.
+ * Returns the maximum value in the range. Returns +nil+ if the begin
+ * value of the range larger than the end value.
+ *
+ * Can be given an optional block to override the default comparison
+ * method <code>a <=> b</code>.
*
+ * (10..20).max #=> 20
*/
static VALUE
@@ -719,16 +1030,16 @@ rb_range_beg_len(VALUE range, long *begp, long *lenp, long len, int err)
if (beg < 0)
goto out_of_range;
}
+ if (end < 0)
+ end += len;
+ if (!excl)
+ end++; /* include end point */
if (err == 0 || err == 2) {
if (beg > len)
goto out_of_range;
if (end > len)
end = len;
}
- if (end < 0)
- end += len;
- if (!excl)
- end++; /* include end point */
len = end - beg;
if (len < 0)
len = 0;
@@ -749,7 +1060,8 @@ rb_range_beg_len(VALUE range, long *begp, long *lenp, long len, int err)
* call-seq:
* rng.to_s -> string
*
- * Convert this range object to a printable form.
+ * Convert this range object to a printable form (using #to_s to convert the
+ * begin and end objects).
*/
static VALUE
@@ -790,7 +1102,7 @@ inspect_range(VALUE range, VALUE dummy, int recur)
* rng.inspect -> string
*
* Convert this range object to a printable form (using
- * <code>inspect</code> to convert the start and end
+ * <code>inspect</code> to convert the begin and end
* objects).
*/
@@ -805,10 +1117,9 @@ range_inspect(VALUE range)
* call-seq:
* rng === obj -> true or false
*
- * Returns <code>true</code> if <i>obj</i> is an element of
- * <i>rng</i>, <code>false</code> otherwise. Conveniently,
- * <code>===</code> is the comparison operator used by
- * <code>case</code> statements.
+ * Returns <code>true</code> if +obj+ is an element of the range,
+ * <code>false</code> otherwise. Conveniently, <code>===</code> is the
+ * comparison operator used by <code>case</code> statements.
*
* case 79
* when 1..50 then print "low\n"
@@ -830,15 +1141,16 @@ range_eqq(VALUE range, VALUE val)
/*
* call-seq:
- * rng.member?(val) -> true or false
- * rng.include?(val) -> true or false
+ * rng.member?(obj) -> true or false
+ * rng.include?(obj) -> true or false
*
- * Returns <code>true</code> if <i>obj</i> is an element of
- * <i>rng</i>, <code>false</code> otherwise. If beg and end are
- * numeric, comparison is done according magnitude of values.
+ * Returns <code>true</code> if +obj+ is an element of
+ * the range, <code>false</code> otherwise. If begin and end are
+ * numeric, comparison is done according to the magnitude of the values.
*
- * ("a".."z").include?("g") # -> true
- * ("a".."z").include?("A") # -> false
+ * ("a".."z").include?("g") #=> true
+ * ("a".."z").include?("A") #=> false
+ * ("a".."z").include?("cc") #=> false
*/
static VALUE
@@ -865,10 +1177,10 @@ range_include(VALUE range, VALUE val)
}
return Qfalse;
}
- else if (TYPE(beg) == T_STRING && TYPE(end) == T_STRING &&
+ else if (RB_TYPE_P(beg, T_STRING) && RB_TYPE_P(end, T_STRING) &&
RSTRING_LEN(beg) == 1 && RSTRING_LEN(end) == 1) {
if (NIL_P(val)) return Qfalse;
- if (TYPE(val) == T_STRING) {
+ if (RB_TYPE_P(val, T_STRING)) {
if (RSTRING_LEN(val) == 0 || RSTRING_LEN(val) > 1)
return Qfalse;
else {
@@ -891,14 +1203,17 @@ range_include(VALUE range, VALUE val)
/*
* call-seq:
- * rng.cover?(val) -> true or false
+ * rng.cover?(obj) -> true or false
*
- * Returns <code>true</code> if <i>obj</i> is between beg and end,
- * i.e <code>beg <= obj <= end</code> (or <i>end</i> exclusive when
- * <code>exclude_end?</code> is true).
+ * Returns <code>true</code> if +obj+ is between the begin and end of
+ * the range.
+ *
+ * This tests <code>begin <= obj <= end</code> when #exclude_end? is +false+
+ * and <code>begin <= obj < end</code> when #exclude_end? is +true+.
*
* ("a".."z").cover?("c") #=> true
* ("a".."z").cover?("5") #=> false
+ * ("a".."z").cover?("cc") #=> true
*/
static VALUE
@@ -925,8 +1240,7 @@ static VALUE
range_dumper(VALUE range)
{
VALUE v;
- NEWOBJ(m, struct RObject);
- OBJSETUP(m, rb_cObject, T_OBJECT);
+ NEWOBJ_OF(m, struct RObject, rb_cObject, T_OBJECT | (RGENGC_WB_PROTECTED_OBJECT ? FL_WB_PROTECTED : 1));
v = (VALUE)m;
@@ -939,13 +1253,14 @@ range_dumper(VALUE range)
static VALUE
range_loader(VALUE range, VALUE obj)
{
- if (TYPE(obj) != T_OBJECT || RBASIC(obj)->klass != rb_cObject) {
+ if (!RB_TYPE_P(obj, T_OBJECT) || RBASIC(obj)->klass != rb_cObject) {
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;
}
@@ -953,16 +1268,16 @@ 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);
}
/* A <code>Range</code> represents an interval---a set of values with a
- * start and an end. Ranges may be constructed using the
+ * beginning and an end. Ranges may be constructed using the
* <em>s</em><code>..</code><em>e</em> and
* <em>s</em><code>...</code><em>e</em> literals, or with
- * <code>Range::new</code>. Ranges constructed using <code>..</code>
- * run from the start to the end inclusively. Those created using
+ * Range::new. Ranges constructed using <code>..</code>
+ * run from the beginning to the end inclusively. Those created using
* <code>...</code> exclude the end value. When used as an iterator,
* ranges return each value in the sequence.
*
@@ -971,10 +1286,20 @@ range_alloc(VALUE klass)
* ('a'..'e').to_a #=> ["a", "b", "c", "d", "e"]
* ('a'...'e').to_a #=> ["a", "b", "c", "d"]
*
- * Ranges can be constructed using objects of any type, as long as the
- * objects can be compared using their <code><=></code> operator and
- * they support the <code>succ</code> method to return the next object
- * in sequence.
+ * == Custom Objects in Ranges
+ *
+ * Ranges can be constructed using any objects that can be compared
+ * using the <code><=></code> operator.
+ * Methods that treat the range as a sequence (#each and methods inherited
+ * from Enumerable) expect the begin object to implement a
+ * <code>succ</code> method to return the next object in sequence.
+ * The #step and #include? methods require the begin
+ * object to implement <code>succ</code> or to be numeric.
+ *
+ * In the <code>Xs</code> class below both <code><=></code> and
+ * <code>succ</code> are implemented so <code>Xs</code> can be used
+ * to construct ranges. Note that the Comparable module is included
+ * so the <code>==</code> method is defined in terms of <code><=></code>.
*
* class Xs # represent a string of 'x's
* include Comparable
@@ -996,17 +1321,12 @@ range_alloc(VALUE klass)
* end
* end
*
+ * An example of using <code>Xs</code> to construct a range:
+ *
* r = Xs.new(3)..Xs.new(6) #=> xxx..xxxxxx
* r.to_a #=> [xxx, xxxx, xxxxx, xxxxxx]
* r.member?(Xs.new(5)) #=> true
*
- * In the previous code example, class <code>Xs</code> includes the
- * <code>Comparable</code> module. This is because
- * <code>Enumerable#member?</code> checks for equality using
- * <code>==</code>. Including <code>Comparable</code> ensures that the
- * <code>==</code> method is defined in terms of the <code><=></code>
- * method implemented in <code>Xs</code>.
- *
*/
void
@@ -1020,6 +1340,8 @@ Init_Range(void)
id_beg = rb_intern("begin");
id_end = rb_intern("end");
id_excl = rb_intern("excl");
+ id_integer_p = rb_intern("integer?");
+ id_div = rb_intern("div");
rb_cRange = rb_struct_define_without_accessor(
"Range", rb_cObject, range_alloc,
@@ -1035,12 +1357,14 @@ Init_Range(void)
rb_define_method(rb_cRange, "hash", range_hash, 0);
rb_define_method(rb_cRange, "each", range_each, 0);
rb_define_method(rb_cRange, "step", range_step, -1);
+ rb_define_method(rb_cRange, "bsearch", range_bsearch, 0);
rb_define_method(rb_cRange, "begin", range_begin, 0);
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, "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 8aced2aee8..53bc11c4ef 100644
--- a/rational.c
+++ b/rational.c
@@ -1,5 +1,5 @@
/*
- rational.c: Coded by Tadayoshi Funaba 2008-2011
+ rational.c: Coded by Tadayoshi Funaba 2008-2012
This implementation is based on Keiju Ishitsuka's Rational library
which is written in ruby.
@@ -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_floor, id_idiv, id_integer_p, id_negate, id_to_f,
+ id_to_i, id_truncate, id_i_num, id_i_den;
#define f_boolcast(x) ((x) ? Qtrue : Qfalse)
+#define f_inspect rb_inspect
+#define f_to_s rb_obj_as_string
#define binop(n,op) \
inline static VALUE \
@@ -106,7 +115,7 @@ f_mul(VALUE x, VALUE y)
if (FIXNUM_P(y)) {
long iy = FIX2LONG(y);
if (iy == 0) {
- if (FIXNUM_P(x) || TYPE(x) == T_BIGNUM)
+ if (FIXNUM_P(x) || RB_TYPE_P(x, T_BIGNUM))
return ZERO;
}
else if (iy == 1)
@@ -115,7 +124,7 @@ f_mul(VALUE x, VALUE y)
else if (FIXNUM_P(x)) {
long ix = FIX2LONG(x);
if (ix == 0) {
- if (FIXNUM_P(y) || TYPE(y) == T_BIGNUM)
+ if (FIXNUM_P(y) || RB_TYPE_P(y, T_BIGNUM))
return ZERO;
}
else if (ix == 1)
@@ -134,26 +143,24 @@ f_sub(VALUE x, VALUE y)
fun1(abs)
fun1(floor)
-fun1(inspect)
fun1(integer_p)
fun1(negate)
inline static VALUE
f_to_i(VALUE x)
{
- if (TYPE(x) == T_STRING)
+ if (RB_TYPE_P(x, T_STRING))
return rb_str_to_inum(x, 10, 0);
return rb_funcall(x, id_to_i, 0);
}
inline static VALUE
f_to_f(VALUE x)
{
- if (TYPE(x) == T_STRING)
+ if (RB_TYPE_P(x, T_STRING))
return DBL2NUM(rb_str_to_dbl(x, 0));
return rb_funcall(x, id_to_f, 0);
}
-fun1(to_s)
fun1(truncate)
inline static VALUE
@@ -183,17 +190,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,24 +209,42 @@ 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);
}
inline static VALUE
+f_minus_one_p(VALUE x)
+{
+ if (RB_TYPE_P(x, T_FIXNUM)) {
+ return f_boolcast(FIX2LONG(x) == -1);
+ }
+ else if (RB_TYPE_P(x, T_BIGNUM)) {
+ return Qfalse;
+ }
+ 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 rb_funcall(x, id_eqeq_p, 1, INT2FIX(-1));
+}
+
+inline static VALUE
f_kind_of_p(VALUE x, VALUE c)
{
return rb_obj_is_kind_of(x, c);
@@ -256,6 +280,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_BDIGITS)*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, RBIGNUM_LEN(x), -1, sizeof(BDIGIT), 0, nails, RBIGNUM_DIGITS(x));
+ mpz_import(my, RBIGNUM_LEN(y), -1, sizeof(BDIGIT), 0, nails, RBIGNUM_DIGITS(y));
+
+ mpz_gcd(mz, mx, my);
+
+ zn = (mpz_sizeinbase(mz, 16) + SIZEOF_BDIGITS*2 - 1) / (SIZEOF_BDIGITS*2);
+ z = rb_big_new(zn, 1);
+ mpz_export(RBIGNUM_DIGITS(z), &count, -1, sizeof(BDIGIT), 0, nails, mz);
+
+ return rb_big_norm(z);
+}
+#endif
+
#ifndef NDEBUG
#define f_gcd f_gcd_orig
#endif
@@ -282,7 +332,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;
@@ -313,6 +363,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)) {
+ long xn = RBIGNUM_LEN(x);
+ long yn = RBIGNUM_LEN(y);
+ if (GMP_GCD_DIGITS <= xn || GMP_GCD_DIGITS <= yn)
+ return rb_gcd_gmp(x, y);
+ }
+#endif
+ return f_gcd_normal(x, y);
+}
+
#ifndef NDEBUG
#undef f_gcd
@@ -348,11 +418,10 @@ f_lcm(VALUE x, VALUE y)
inline static VALUE
nurat_s_new_internal(VALUE klass, VALUE num, VALUE den)
{
- NEWOBJ(obj, struct RRational);
- OBJSETUP(obj, 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;
}
@@ -430,11 +499,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");
}
@@ -549,6 +614,25 @@ f_rational_new_no_reduce2(VALUE klass, VALUE x, VALUE y)
* Rational(x[, y]) -> numeric
*
* Returns x/y;
+ *
+ * Rational(1, 2) #=> (1/2)
+ * Rational('1/2') #=> (1/2)
+ *
+ * Syntax of string form:
+ *
+ * string form = extra spaces , rational , extra spaces ;
+ * rational = [ sign ] , unsigned rational ;
+ * unsigned rational = numerator | numerator , "/" , denominator ;
+ * numerator = integer part | fractional part | integer part , fractional part ;
+ * denominator = digits ;
+ * integer part = digits ;
+ * fractional part = "." , digits , [ ( "e" | "E" ) , [ sign ] , digits ] ;
+ * sign = "-" | "+" ;
+ * digits = digit , { digit | "_" , digit } ;
+ * digit = "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" ;
+ * extra spaces = ? \s* ? ;
+ *
+ * See String#to_r.
*/
static VALUE
nurat_f_rational(int argc, VALUE *argv, VALUE klass)
@@ -562,8 +646,6 @@ nurat_f_rational(int argc, VALUE *argv, VALUE klass)
*
* Returns the numerator.
*
- * For example:
- *
* Rational(7).numerator #=> 7
* Rational(7, 1).numerator #=> 7
* Rational(9, -4).numerator #=> -9
@@ -582,8 +664,6 @@ nurat_numerator(VALUE self)
*
* Returns the denominator (always positive).
*
- * For example:
- *
* Rational(7).denominator #=> 1
* Rational(7, 1).denominator #=> 1
* Rational(9, -4).denominator #=> 4
@@ -605,7 +685,6 @@ inline static VALUE
f_imul(long a, long b)
{
VALUE r;
- volatile long c;
if (a == 0 || b == 0)
return ZERO;
@@ -614,10 +693,10 @@ f_imul(long a, long b)
else if (b == 1)
return LONG2NUM(a);
- c = a * b;
- r = LONG2NUM(c);
- if (NUM2LONG(r) != c || (c / a) != b)
+ if (MUL_OVERFLOW_LONG_P(a, b))
r = rb_big_mul(rb_int2big(a), rb_int2big(b));
+ else
+ r = LONG2NUM(a * b);
return r;
}
@@ -688,8 +767,6 @@ f_addsub(VALUE self, VALUE anum, VALUE aden, VALUE bnum, VALUE bden, int k)
*
* Performs addition.
*
- * For example:
- *
* Rational(2, 3) + Rational(2, 3) #=> (4/3)
* Rational(900) + Rational(1) #=> (900/1)
* Rational(-2, 9) + Rational(-9, 2) #=> (-85/18)
@@ -699,9 +776,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);
@@ -709,9 +784,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);
@@ -719,7 +796,8 @@ nurat_add(VALUE self, VALUE other)
adat->num, adat->den,
bdat->num, bdat->den, '+');
}
- default:
+ }
+ else {
return rb_num_coerce_bin(self, other, '+');
}
}
@@ -730,8 +808,6 @@ nurat_add(VALUE self, VALUE other)
*
* Performs subtraction.
*
- * For example:
- *
* Rational(2, 3) - Rational(2, 3) #=> (0/1)
* Rational(900) - Rational(1) #=> (899/1)
* Rational(-2, 9) - Rational(-9, 2) #=> (77/18)
@@ -741,9 +817,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);
@@ -751,9 +825,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);
@@ -761,7 +837,8 @@ nurat_sub(VALUE self, VALUE other)
adat->num, adat->den,
bdat->num, bdat->den, '-');
}
- default:
+ }
+ else {
return rb_num_coerce_bin(self, other, '-');
}
}
@@ -811,8 +888,6 @@ f_muldiv(VALUE self, VALUE anum, VALUE aden, VALUE bnum, VALUE bden, int k)
*
* Performs multiplication.
*
- * For example:
- *
* Rational(2, 3) * Rational(2, 3) #=> (4/9)
* Rational(900) * Rational(1) #=> (900/1)
* Rational(-2, 9) * Rational(-9, 2) #=> (1/1)
@@ -822,9 +897,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);
@@ -832,9 +905,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);
@@ -842,7 +917,8 @@ nurat_mul(VALUE self, VALUE other)
adat->num, adat->den,
bdat->num, bdat->den, '*');
}
- default:
+ }
+ else {
return rb_num_coerce_bin(self, other, '*');
}
}
@@ -854,8 +930,6 @@ nurat_mul(VALUE self, VALUE other)
*
* Performs division.
*
- * For example:
- *
* Rational(2, 3) / Rational(2, 3) #=> (1/1)
* Rational(900) / Rational(1) #=> (900/1)
* Rational(-2, 9) / Rational(-9, 2) #=> (4/81)
@@ -865,9 +939,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();
{
@@ -877,19 +949,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();
{
@@ -903,7 +966,8 @@ nurat_div(VALUE self, VALUE other)
adat->num, adat->den,
bdat->num, bdat->den, '/');
}
- default:
+ }
+ else {
return rb_num_coerce_bin(self, other, '/');
}
}
@@ -914,8 +978,6 @@ nurat_div(VALUE self, VALUE other)
*
* Performs division and returns the value as a float.
*
- * For example:
- *
* Rational(2, 3).fdiv(1) #=> 0.6666666666666666
* Rational(2, 3).fdiv(0.5) #=> 1.3333333333333333
* Rational(2).fdiv(3) #=> 0.6666666666666666
@@ -928,14 +990,21 @@ nurat_fdiv(VALUE self, VALUE other)
return f_to_f(f_div(self, other));
}
+inline static VALUE
+f_odd_p(VALUE integer)
+{
+ if (rb_funcall(integer, '%', 1, INT2FIX(2)) != INT2FIX(0)) {
+ return Qtrue;
+ }
+ return Qfalse;
+}
+
/*
* call-seq:
* rat ** numeric -> numeric
*
* Performs exponentiation.
*
- * For example:
- *
* Rational(2) ** Rational(3) #=> (8/1)
* Rational(10) ** -2 #=> (1/100)
* Rational(10) ** -2.0 #=> 0.01
@@ -956,8 +1025,29 @@ nurat_expt(VALUE self, VALUE other)
other = dat->num; /* c14n */
}
- switch (TYPE(other)) {
- case T_FIXNUM:
+ /* 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)) {
+ return f_rational_new_bang1(CLASS_OF(self), ONE);
+ }
+ 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) {
+ rb_raise_zerodiv();
+ }
+ else {
+ return f_rational_new_bang1(CLASS_OF(self), ZERO);
+ }
+ }
+ }
+ }
+
+ /* General case */
+ if (RB_TYPE_P(other, T_FIXNUM)) {
{
VALUE num, den;
@@ -979,24 +1069,26 @@ 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);
}
}
/*
* call-seq:
- * rat <=> numeric -> -1, 0, +1 or nil
+ * rational <=> numeric -> -1, 0, +1 or nil
*
* Performs comparison and returns -1, 0, or +1.
*
- * For example:
+ * +nil+ is returned if the two values are incomparable.
*
* Rational(2, 3) <=> Rational(2, 3) #=> 0
* Rational(5) <=> 5 #=> 0
@@ -1007,9 +1099,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);
@@ -1017,9 +1107,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;
@@ -1036,7 +1128,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);
}
}
@@ -1047,8 +1140,6 @@ nurat_cmp(VALUE self, VALUE other)
*
* Returns true if rat equals object numerically.
*
- * For example:
- *
* Rational(2, 3) == Rational(2, 3) #=> true
* Rational(5) == 5 #=> true
* Rational(0) == 0.0 #=> true
@@ -1058,9 +1149,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);
@@ -1075,9 +1164,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);
@@ -1087,7 +1178,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);
}
}
@@ -1096,15 +1188,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);
@@ -1173,8 +1266,6 @@ nurat_ceil(VALUE self)
* Equivalent to
* rat.truncate.
*
- * For example:
- *
* Rational(2, 3).to_i #=> 0
* Rational(3).to_i #=> 3
* Rational(300.6).to_i #=> 300
@@ -1230,6 +1321,16 @@ f_round_common(int argc, VALUE *argv, VALUE self, VALUE (*func)(VALUE))
b = f_expt10(n);
s = f_mul(self, b);
+ if (k_float_p(s)) {
+ if (f_lt_p(n, ZERO))
+ return ZERO;
+ return self;
+ }
+
+ if (!k_rational_p(s)) {
+ s = f_rational_new_bang1(CLASS_OF(self), s);
+ }
+
s = (*func)(s);
s = f_div(f_rational_new_bang1(CLASS_OF(self), s), b);
@@ -1247,8 +1348,6 @@ f_round_common(int argc, VALUE *argv, VALUE self, VALUE (*func)(VALUE))
*
* Returns the truncated value (toward negative infinity).
*
- * For example:
- *
* Rational(3).floor #=> 3
* Rational(2, 3).floor #=> 0
* Rational(-3, 2).floor #=> -1
@@ -1273,8 +1372,6 @@ nurat_floor_n(int argc, VALUE *argv, VALUE self)
*
* Returns the truncated value (toward positive infinity).
*
- * For example:
- *
* Rational(3).ceil #=> 3
* Rational(2, 3).ceil #=> 1
* Rational(-3, 2).ceil #=> -1
@@ -1299,8 +1396,6 @@ nurat_ceil_n(int argc, VALUE *argv, VALUE self)
*
* Returns the truncated value (toward zero).
*
- * For example:
- *
* Rational(3).truncate #=> 3
* Rational(2, 3).truncate #=> 0
* Rational(-3, 2).truncate #=> -1
@@ -1326,8 +1421,6 @@ nurat_truncate_n(int argc, VALUE *argv, VALUE self)
* Returns the truncated value (toward the nearest integer;
* 0.5 => 1; -0.5 => -1).
*
- * For example:
- *
* Rational(3).round #=> 3
* Rational(2, 3).round #=> 1
* Rational(-3, 2).round #=> -2
@@ -1351,8 +1444,6 @@ nurat_round_n(int argc, VALUE *argv, VALUE self)
*
* Return the value as a float.
*
- * For example:
- *
* Rational(2).to_f #=> 2.0
* Rational(9, 4).to_f #=> 2.25
* Rational(-3, 4).to_f #=> -0.75
@@ -1371,8 +1462,6 @@ nurat_to_f(VALUE self)
*
* Returns self.
*
- * For example:
- *
* Rational(2).to_r #=> (2/1)
* Rational(-8, 6).to_r #=> (-4/3)
*/
@@ -1483,12 +1572,10 @@ nurat_rationalize_internal(VALUE a, VALUE b, VALUE *p, VALUE *q)
* rat.rationalize -> self
* rat.rationalize(eps) -> rational
*
- * Returns a simpler approximation of the value if an optional
+ * Returns a simpler approximation of the value if the optional
* argument eps is given (rat-|eps| <= result <= rat+|eps|), self
* otherwise.
*
- * For example:
- *
* r = Rational(5033165, 16777216)
* r.rationalize #=> (5033165/16777216)
* r.rationalize(Rational('0.01')) #=> (3/10)
@@ -1552,11 +1639,9 @@ f_format(VALUE self, VALUE (*func)(VALUE))
*
* Returns the value as a string.
*
- * For example:
- *
* Rational(2).to_s #=> "2/1"
* Rational(-8, 6).to_s #=> "-4/3"
- * Rational('0.5').to_s #=> "1/2"
+ * Rational('1/2').to_s #=> "1/2"
*/
static VALUE
nurat_to_s(VALUE self)
@@ -1570,11 +1655,9 @@ nurat_to_s(VALUE self)
*
* Returns the value as a string for inspection.
*
- * For example:
- *
* Rational(2).inspect #=> "(2/1)"
* Rational(-8, 6).inspect #=> "(-4/3)"
- * Rational('0.5').inspect #=> "(1/2)"
+ * Rational('1/2').inspect #=> "(1/2)"
*/
static VALUE
nurat_inspect(VALUE self)
@@ -1590,6 +1673,25 @@ nurat_inspect(VALUE self)
/* :nodoc: */
static VALUE
+nurat_dumper(VALUE self)
+{
+ return self;
+}
+
+/* :nodoc: */
+static VALUE
+nurat_loader(VALUE self, VALUE a)
+{
+ get_dat1(self);
+
+ RRATIONAL_SET_NUM(dat, rb_ivar_get(a, id_i_num));
+ RRATIONAL_SET_DEN(dat, rb_ivar_get(a, id_i_den));
+
+ return self;
+}
+
+/* :nodoc: */
+static VALUE
nurat_marshal_dump(VALUE self)
{
VALUE a;
@@ -1604,17 +1706,18 @@ nurat_marshal_dump(VALUE self)
static VALUE
nurat_marshal_load(VALUE self, VALUE a)
{
- get_dat1(self);
+ rb_check_frozen(self);
+ rb_check_trusted(self);
+
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));
- dat->num = RARRAY_PTR(a)[0];
- dat->den = RARRAY_PTR(a)[1];
- rb_copy_generic_ivar(self, a);
-
- if (f_zero_p(dat->den))
+ if (f_zero_p(RARRAY_AREF(a, 1)))
rb_raise_zerodiv();
+ rb_ivar_set(self, id_i_num, RARRAY_AREF(a, 0));
+ rb_ivar_set(self, id_i_den, RARRAY_AREF(a, 1));
+
return self;
}
@@ -1634,8 +1737,6 @@ rb_rational_reciprocal(VALUE x)
* Returns the greatest common divisor (always positive). 0.gcd(x)
* and x.gcd(0) return abs(x).
*
- * For example:
- *
* 2.gcd(2) #=> 2
* 3.gcd(-7) #=> 1
* ((1<<31)-1).gcd((1<<61)-1) #=> 1
@@ -1654,8 +1755,6 @@ rb_gcd(VALUE self, VALUE other)
* Returns the least common multiple (always positive). 0.lcm(x) and
* x.lcm(0) return zero.
*
- * For example:
- *
* 2.lcm(2) #=> 2
* 3.lcm(-7) #=> 21
* ((1<<31)-1).lcm((1<<61)-1) #=> 4951760154835678088235319297
@@ -1673,8 +1772,6 @@ rb_lcm(VALUE self, VALUE other)
*
* Returns an array; [int.gcd(int2), int.lcm(int2)].
*
- * For example:
- *
* 2.gcdlcm(2) #=> [2, 2]
* 3.gcdlcm(-7) #=> [1, 21]
* ((1<<31)-1).gcdlcm((1<<61)-1) #=> [1, 4951760154835678088235319297]
@@ -1742,6 +1839,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
@@ -1772,8 +1898,6 @@ integer_denominator(VALUE self)
*
* Returns the numerator. The result is machine dependent.
*
- * For example:
- *
* n = 0.3.numerator #=> 5404319552844595
* d = 0.3.denominator #=> 18014398509481984
* n.fdiv(d) #=> 0.3
@@ -1821,7 +1945,7 @@ nilclass_to_r(VALUE self)
* call-seq:
* nil.rationalize([eps]) -> (0/1)
*
- * Returns zero as a rational. An optional argument eps is always
+ * Returns zero as a rational. The optional argument eps is always
* ignored.
*/
static VALUE
@@ -1837,8 +1961,6 @@ nilclass_rationalize(int argc, VALUE *argv, VALUE self)
*
* Returns the value as a rational.
*
- * For example:
- *
* 1.to_r #=> (1/1)
* (1<<64).to_r #=> (18446744073709551616/1)
*/
@@ -1852,7 +1974,7 @@ integer_to_r(VALUE self)
* call-seq:
* int.rationalize([eps]) -> rational
*
- * Returns the value as a rational. An optional argument eps is
+ * Returns the value as a rational. The optional argument eps is
* always ignored.
*/
static VALUE
@@ -1898,12 +2020,12 @@ float_decode(VALUE self)
* NOTE: 0.3.to_r isn't the same as '0.3'.to_r. The latter is
* equivalent to '3/10'.to_r, but the former isn't so.
*
- * For example:
- *
* 2.0.to_r #=> (2/1)
* 2.5.to_r #=> (5/2)
* -0.75.to_r #=> (-3/4)
* 0.0.to_r #=> (0/1)
+ *
+ * See rationalize.
*/
static VALUE
float_to_r(VALUE self)
@@ -1927,203 +2049,308 @@ 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
*
* Returns a simpler approximation of the value (flt-|eps| <= result
- * <= flt+|eps|). if eps is not given, it will be chosen
+ * <= flt+|eps|). if the optional eps is not given, it will be chosen
* automatically.
*
- * For example:
- *
* 0.3.rationalize #=> (3/10)
* 1.333.rationalize #=> (1333/1000)
* 1.333.rationalize(0.01) #=> (4/3)
+ *
+ * See to_r.
*/
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
- a = rb_rational_new2(f_sub(f_mul(TWO, f), ONE),
- f_lshift(ONE, f_sub(ONE, n)));
- b = rb_rational_new2(f_add(f_mul(TWO, f), ONE),
- f_lshift(ONE, f_sub(ONE, n)));
-#else
- a = rb_rational_new2(f_sub(f_mul(INT2FIX(FLT_RADIX), f),
- INT2FIX(FLT_RADIX - 1)),
- f_expt(INT2FIX(FLT_RADIX), f_sub(ONE, n)));
- b = rb_rational_new2(f_add(f_mul(INT2FIX(FLT_RADIX), f),
- INT2FIX(FLT_RADIX - 1)),
- f_expt(INT2FIX(FLT_RADIX), f_sub(ONE, n)));
-#endif
+ return rb_flt_rationalize(self);
}
+}
- if (f_eqeq_p(a, b))
- return f_to_r(self);
+#include <ctype.h>
- nurat_rationalize_internal(a, b, &p, &q);
- return rb_rational_new2(p, q);
+inline static int
+issign(int c)
+{
+ return (c == '-' || c == '+');
}
-static VALUE rat_pat, an_e_pat, a_dot_pat, underscores_pat, an_underscore;
+static int
+read_sign(const char **s)
+{
+ int sign = '?';
-#define WS "\\s*"
-#define DIGITS "(?:[0-9](?:_[0-9]|[0-9])*)"
-#define NUMERATOR "(?:" DIGITS "?\\.)?" DIGITS "(?:[eE][-+]?" DIGITS ")?"
-#define DENOMINATOR DIGITS
-#define PATTERN "\\A" WS "([-+])?(" NUMERATOR ")(?:\\/(" DENOMINATOR "))?" WS
+ if (issign(**s)) {
+ sign = **s;
+ (*s)++;
+ }
+ return sign;
+}
-static void
-make_patterns(void)
+inline static int
+isdecimal(int c)
{
- static const char rat_pat_source[] = PATTERN;
- static const char an_e_pat_source[] = "[eE]";
- static const char a_dot_pat_source[] = "\\.";
- static const char underscores_pat_source[] = "_+";
-
- if (rat_pat) return;
+ return isdigit((unsigned char)c);
+}
- rat_pat = rb_reg_new(rat_pat_source, sizeof rat_pat_source - 1, 0);
- rb_gc_register_mark_object(rat_pat);
+static int
+read_digits(const char **s, int strict,
+ VALUE *num, int *count)
+{
+ char *b, *bb;
+ int us = 1, ret = 1;
- an_e_pat = rb_reg_new(an_e_pat_source, sizeof an_e_pat_source - 1, 0);
- rb_gc_register_mark_object(an_e_pat);
+ if (!isdecimal(**s)) {
+ *num = ZERO;
+ return 0;
+ }
- a_dot_pat = rb_reg_new(a_dot_pat_source, sizeof a_dot_pat_source - 1, 0);
- rb_gc_register_mark_object(a_dot_pat);
+ bb = b = ALLOCA_N(char, strlen(*s) + 1);
- underscores_pat = rb_reg_new(underscores_pat_source,
- sizeof underscores_pat_source - 1, 0);
- rb_gc_register_mark_object(underscores_pat);
+ while (isdecimal(**s) || **s == '_') {
+ if (**s == '_') {
+ if (strict) {
+ if (us) {
+ ret = 0;
+ goto conv;
+ }
+ }
+ us = 1;
+ }
+ else {
+ if (count)
+ (*count)++;
+ *b++ = **s;
+ us = 0;
+ }
+ (*s)++;
+ }
+ if (us)
+ do {
+ (*s)--;
+ } while (**s == '_');
+ conv:
+ *b = '\0';
+ *num = rb_cstr_to_inum(bb, 10, 0);
+ return ret;
+}
- an_underscore = rb_usascii_str_new2("_");
- rb_gc_register_mark_object(an_underscore);
+inline static int
+islettere(int c)
+{
+ return (c == 'e' || c == 'E');
}
-#define id_match rb_intern("match")
-#define f_match(x,y) rb_funcall((x), id_match, 1, (y))
+static int
+read_num(const char **s, int numsign, int strict,
+ VALUE *num)
+{
+ VALUE ip, fp, exp;
-#define id_split rb_intern("split")
-#define f_split(x,y) rb_funcall((x), id_split, 1, (y))
+ *num = rb_rational_new2(ZERO, ONE);
+ exp = Qnil;
-#include <ctype.h>
+ if (**s != '.') {
+ if (!read_digits(s, strict, &ip, NULL))
+ return 0;
+ *num = rb_rational_new2(ip, ONE);
+ }
-static VALUE
-string_to_r_internal(VALUE self)
-{
- VALUE s, m;
+ if (**s == '.') {
+ int count = 0;
- s = self;
+ (*s)++;
+ if (!read_digits(s, strict, &fp, &count))
+ return 0;
+ {
+ VALUE l = f_expt10(INT2NUM(count));
+ *num = f_mul(*num, l);
+ *num = f_add(*num, fp);
+ *num = f_div(*num, l);
+ }
+ }
- if (RSTRING_LEN(s) == 0)
- return rb_assoc_new(Qnil, self);
+ if (islettere(**s)) {
+ int expsign;
- m = f_match(rat_pat, s);
+ (*s)++;
+ expsign = read_sign(s);
+ if (!read_digits(s, strict, &exp, NULL))
+ return 0;
+ if (expsign == '-')
+ exp = f_negate(exp);
+ }
- if (!NIL_P(m)) {
- VALUE v, ifp, exp, ip, fp;
- VALUE si = rb_reg_nth_match(1, m);
- VALUE nu = rb_reg_nth_match(2, m);
- VALUE de = rb_reg_nth_match(3, m);
- VALUE re = rb_reg_match_post(m);
+ if (numsign == '-')
+ *num = f_negate(*num);
+ if (!NIL_P(exp)) {
+ VALUE l = f_expt10(exp);
+ *num = f_mul(*num, l);
+ }
+ return 1;
+}
- {
- VALUE a;
+inline static int
+read_den(const char **s, int strict,
+ VALUE *num)
+{
+ if (!read_digits(s, strict, num, NULL))
+ return 0;
+ return 1;
+}
- if (!strpbrk(RSTRING_PTR(nu), "eE")) {
- ifp = nu; /* not a copy */
- exp = Qnil;
- }
- else {
- a = f_split(nu, an_e_pat);
- ifp = RARRAY_PTR(a)[0];
- if (RARRAY_LEN(a) != 2)
- exp = Qnil;
- else
- exp = RARRAY_PTR(a)[1];
- }
+static int
+read_rat_nos(const char **s, int sign, int strict,
+ VALUE *num)
+{
+ VALUE den;
- if (!strchr(RSTRING_PTR(ifp), '.')) {
- ip = ifp; /* not a copy */
- fp = Qnil;
- }
- else {
- a = f_split(ifp, a_dot_pat);
- ip = RARRAY_PTR(a)[0];
- if (RARRAY_LEN(a) != 2)
- fp = Qnil;
- else
- fp = RARRAY_PTR(a)[1];
- }
- }
+ if (!read_num(s, sign, strict, num))
+ return 0;
+ if (**s == '/') {
+ (*s)++;
+ if (!read_den(s, strict, &den))
+ return 0;
+ if (!(FIXNUM_P(den) && FIX2LONG(den) == 1))
+ *num = f_div(*num, den);
+ }
+ return 1;
+}
- v = rb_rational_new1(f_to_i(ip));
+static int
+read_rat(const char **s, int strict,
+ VALUE *num)
+{
+ int sign;
- if (!NIL_P(fp)) {
- char *p = RSTRING_PTR(fp);
- long count = 0;
- VALUE l;
+ sign = read_sign(s);
+ if (!read_rat_nos(s, sign, strict, num))
+ return 0;
+ return 1;
+}
- while (*p) {
- if (rb_isdigit(*p))
- count++;
- p++;
- }
- l = f_expt10(LONG2NUM(count));
- v = f_mul(v, l);
- v = f_add(v, f_to_i(fp));
- v = f_div(v, l);
- }
- if (!NIL_P(si) && *RSTRING_PTR(si) == '-')
- v = f_negate(v);
- if (!NIL_P(exp))
- v = f_mul(v, f_expt10(f_to_i(exp)));
-#if 0
- if (!NIL_P(de) && (!NIL_P(fp) || !NIL_P(exp)))
- return rb_assoc_new(v, rb_usascii_str_new2("dummy"));
-#endif
- if (!NIL_P(de))
- v = f_div(v, f_to_i(de));
+inline static void
+skip_ws(const char **s)
+{
+ while (isspace((unsigned char)**s))
+ (*s)++;
+}
- return rb_assoc_new(v, re);
- }
- return rb_assoc_new(Qnil, self);
+static int
+parse_rat(const char *s, int strict,
+ VALUE *num)
+{
+ skip_ws(&s);
+ if (!read_rat(&s, strict, num))
+ return 0;
+ skip_ws(&s);
+
+ if (strict)
+ if (*s != '\0')
+ return 0;
+ return 1;
}
static VALUE
string_to_r_strict(VALUE self)
{
- VALUE a = string_to_r_internal(self);
- if (NIL_P(RARRAY_PTR(a)[0]) || RSTRING_LEN(RARRAY_PTR(a)[1]) > 0) {
- VALUE s = f_inspect(self);
+ char *s;
+ VALUE num;
+
+ rb_must_asciicompat(self);
+
+ s = RSTRING_PTR(self);
+
+ if (!s || memchr(s, '\0', RSTRING_LEN(self)))
+ rb_raise(rb_eArgError, "string contains null byte");
+
+ if (s && s[RSTRING_LEN(self)]) {
+ rb_str_modify(self);
+ s = RSTRING_PTR(self);
+ s[RSTRING_LEN(self)] = '\0';
+ }
+
+ if (!s)
+ s = (char *)"";
+
+ if (!parse_rat(s, 1, &num)) {
+ VALUE ins = f_inspect(self);
rb_raise(rb_eArgError, "invalid value for convert(): %s",
- StringValuePtr(s));
+ StringValuePtr(ins));
}
- return RARRAY_PTR(a)[0];
-}
-#define id_gsub rb_intern("gsub")
-#define f_gsub(x,y,z) rb_funcall((x), id_gsub, 2, (y), (z))
+ if (RB_TYPE_P(num, T_FLOAT))
+ rb_raise(rb_eFloatDomainError, "Infinity");
+ return num;
+}
/*
* call-seq:
@@ -2137,8 +2364,6 @@ string_to_r_strict(VALUE self)
* NOTE: '0.3'.to_r isn't the same as 0.3.to_r. The former is
* equivalent to '3/10'.to_r, but the latter isn't so.
*
- * For example:
- *
* ' 2 '.to_r #=> (2/1)
* '300/2'.to_r #=> (150/1)
* '-9.2'.to_r #=> (-46/5)
@@ -2147,31 +2372,46 @@ string_to_r_strict(VALUE self)
* '21 june 09'.to_r #=> (21/1)
* '21/06/09'.to_r #=> (7/2)
* 'bwv 1079'.to_r #=> (0/1)
+ *
+ * See Kernel.Rational.
*/
static VALUE
string_to_r(VALUE self)
{
- VALUE s, a, a1, backref;
+ char *s;
+ VALUE num;
- backref = rb_backref_get();
- rb_match_busy(backref);
+ rb_must_asciicompat(self);
- s = f_gsub(self, underscores_pat, an_underscore);
- a = string_to_r_internal(s);
-
- rb_backref_set(backref);
+ s = RSTRING_PTR(self);
- a1 = RARRAY_PTR(a)[0];
- if (!NIL_P(a1)) {
- if (TYPE(a1) == T_FLOAT)
- rb_raise(rb_eFloatDomainError, "Infinity");
- return a1;
+ if (s && s[RSTRING_LEN(self)]) {
+ rb_str_modify(self);
+ s = RSTRING_PTR(self);
+ s[RSTRING_LEN(self)] = '\0';
}
- return rb_rational_new1(INT2FIX(0));
+
+ if (!s)
+ s = (char *)"";
+
+ (void)parse_rat(s, 0, &num);
+
+ if (RB_TYPE_P(num, T_FLOAT))
+ rb_raise(rb_eFloatDomainError, "Infinity");
+ return num;
}
-#define id_to_r rb_intern("to_r")
-#define f_to_r(x) rb_funcall((x), id_to_r, 0)
+VALUE
+rb_cstr_to_rat(const char *s, int strict) /* for complex's internal */
+{
+ VALUE num;
+
+ (void)parse_rat(s, strict, &num);
+
+ if (RB_TYPE_P(num, T_FLOAT))
+ rb_raise(rb_eFloatDomainError, "Infinity");
+ return num;
+}
static VALUE
nurat_s_convert(int argc, VALUE *argv, VALUE klass)
@@ -2183,14 +2423,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;
}
@@ -2198,34 +2436,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;
}
@@ -2291,6 +2518,7 @@ nurat_s_convert(int argc, VALUE *argv, VALUE klass)
void
Init_Rational(void)
{
+ VALUE compat;
#undef rb_intern
#define rb_intern(str) rb_intern_const(str)
@@ -2304,13 +2532,13 @@ Init_Rational(void)
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");
rb_cRational = rb_define_class("Rational", rb_cNumeric);
@@ -2370,8 +2598,10 @@ Init_Rational(void)
rb_define_method(rb_cRational, "to_s", nurat_to_s, 0);
rb_define_method(rb_cRational, "inspect", nurat_inspect, 0);
- rb_define_method(rb_cRational, "marshal_dump", nurat_marshal_dump, 0);
- rb_define_method(rb_cRational, "marshal_load", nurat_marshal_load, 1);
+ rb_define_private_method(rb_cRational, "marshal_dump", nurat_marshal_dump, 0);
+ compat = rb_define_class_under(rb_cRational, "compatible", rb_cObject);
+ rb_define_private_method(compat, "marshal_load", nurat_marshal_load, 1);
+ rb_marshal_define_compat(rb_cRational, compat, nurat_dumper, nurat_loader);
/* --- */
@@ -2381,6 +2611,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);
@@ -2395,8 +2626,6 @@ Init_Rational(void)
rb_define_method(rb_cFloat, "to_r", float_to_r, 0);
rb_define_method(rb_cFloat, "rationalize", float_rationalize, -1);
- make_patterns();
-
rb_define_method(rb_cString, "to_r", string_to_r, 0);
rb_define_private_method(CLASS_OF(rb_cRational), "convert", nurat_s_convert, -1);
diff --git a/re.c b/re.c
index 9fdbf547aa..a7074d8282 100644
--- a/re.c
+++ b/re.c
@@ -97,6 +97,18 @@ rb_memcmp(const void *p1, const void *p2, long len)
return memcmp(p1, p2, len);
}
+#ifdef HAVE_MEMMEM
+static inline long
+rb_memsearch_ss(const unsigned char *xs, long m, const unsigned char *ys, long n)
+{
+ const unsigned char *y;
+
+ if (y = memmem(ys, n, xs, m))
+ return y - ys;
+ else
+ return -1;
+}
+#else
static inline long
rb_memsearch_ss(const unsigned char *xs, long m, const unsigned char *ys, long n)
{
@@ -114,6 +126,9 @@ rb_memsearch_ss(const unsigned char *xs, long m, const unsigned char *ys, long n
if (m > SIZEOF_VALUE)
rb_bug("!!too long pattern string!!");
+ if (!(y = memchr(y, *x, n - m + 1)))
+ return -1;
+
/* Prepare hash value */
for (hx = *x++, hy = *y++; x < xe; ++x, ++y) {
hx <<= CHAR_BIT;
@@ -132,6 +147,7 @@ rb_memsearch_ss(const unsigned char *xs, long m, const unsigned char *ys, long n
}
return y - ys - m;
}
+#endif
static inline long
rb_memsearch_qs(const unsigned char *xs, long m, const unsigned char *ys, long n)
@@ -220,12 +236,12 @@ 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 = y, *ye = ys + n;
- for (; y < ye; ++y) {
- if (*x == *y)
- return y - ys;
- }
- return -1;
+ const unsigned char *ys = memchr(y, *x, n);
+
+ if (ys)
+ return ys - y;
+ else
+ return -1;
}
else if (m <= SIZEOF_VALUE) {
return rb_memsearch_ss(x0, m, y0, n);
@@ -291,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();
@@ -555,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;
@@ -578,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);
@@ -591,7 +632,7 @@ rb_reg_raise(const char *s, long len, const char *err, VALUE re)
{
volatile 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
@@ -723,7 +764,7 @@ reg_named_captures_iter(const OnigUChar *name, const OnigUChar *name_end,
VALUE ary = rb_ary_new2(back_num);
int i;
- for(i = 0; i < back_num; i++)
+ for (i = 0; i < back_num; i++)
rb_ary_store(ary, i, INT2NUM(back_refs[i]));
rb_hash_aset(hash, rb_str_new((const char*)name, name_end-name),ary);
@@ -769,7 +810,7 @@ onig_new_with_source(regex_t** reg, const UChar* pattern, const UChar* pattern_e
{
int r;
- *reg = (regex_t* )xmalloc(sizeof(regex_t));
+ *reg = (regex_t* )malloc(sizeof(regex_t));
if (IS_NULL(*reg)) return ONIGERR_MEMORY;
r = onig_reg_init(*reg, option, ONIGENC_CASE_FOLD_DEFAULT, enc, syntax);
@@ -826,8 +867,7 @@ VALUE rb_cMatch;
static VALUE
match_alloc(VALUE klass)
{
- NEWOBJ(match, struct RMatch);
- OBJSETUP(match, klass, T_MATCH);
+ NEWOBJ_OF(match, struct RMatch, klass, T_MATCH);
match->str = 0;
match->rmatch = 0;
@@ -939,11 +979,8 @@ match_init_copy(VALUE obj, VALUE orig)
{
struct rmatch *rm;
- if (obj == orig) return obj;
+ if (!OBJ_INIT_COPY(obj, orig)) return obj;
- if (!rb_obj_is_instance_of(orig, rb_obj_class(obj))) {
- rb_raise(rb_eTypeError, "wrong argument class");
- }
RMATCH(obj)->str = RMATCH(orig)->str;
RMATCH(obj)->regexp = RMATCH(orig)->regexp;
@@ -1034,7 +1071,7 @@ match_backref_number(VALUE match, VALUE backref)
VALUE regexp = RMATCH(match)->regexp;
match_check(match);
- switch(TYPE(backref)) {
+ switch (TYPE(backref)) {
default:
return NUM2INT(backref);
@@ -1336,6 +1373,7 @@ 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)
{
@@ -1665,6 +1703,8 @@ name_to_backref_number(struct re_registers *regs, VALUE regexp, const char* name
rb_raise(rb_eIndexError, "undefined group name reference: %s",
StringValuePtr(s));
}
+
+ UNREACHABLE;
}
/*
@@ -1674,11 +1714,12 @@ name_to_backref_number(struct re_registers *regs, VALUE regexp, const char* name
* mtch[range] -> array
* mtch[name] -> str or nil
*
- * Match Reference---<code>MatchData</code> acts as an array, and may be
- * accessed using the normal array indexing techniques. <i>mtch</i>[0] is
- * equivalent to the special variable <code>$&</code>, and returns the entire
- * matched string. <i>mtch</i>[1], <i>mtch</i>[2], and so on return the values
- * of the matched backreferences (portions of the pattern between parentheses).
+ * Match Reference -- <code>MatchData</code> acts as an array, and may be
+ * accessed using the normal array indexing techniques. <code>mtch[0]</code>
+ * is equivalent to the special variable <code>$&</code>, and returns the
+ * entire matched string. <code>mtch[1]</code>, <code>mtch[2]</code>, and so
+ * on return the values of the matched backreferences (portions of the
+ * pattern between parentheses).
*
* m = /(.)(.)(\d+)(\d)/.match("THX1138.")
* m #=> #<MatchData "HX1138" 1:"H" 2:"X" 3:"113" 4:"8">
@@ -2323,7 +2364,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;
@@ -2376,8 +2417,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");
@@ -2386,8 +2425,8 @@ rb_reg_initialize(VALUE obj, const char *s, long len, rb_encoding *enc,
re->ptr = 0;
if (rb_enc_dummy_p(enc)) {
- errcpy(err, "can't make regexp with dummy encoding");
- return -1;
+ errcpy(err, "can't make regexp with dummy encoding");
+ return -1;
}
unescaped = rb_reg_preprocess(s, s+len, enc, &fixed_enc, err);
@@ -2421,7 +2460,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_WRITE(obj, &re->src, rb_enc_str_new(s, len, enc));
OBJ_FREEZE(re->src);
RB_GC_GUARD(unescaped);
return 0;
@@ -2453,11 +2492,10 @@ rb_reg_initialize_str(VALUE obj, VALUE str, int options, onig_errmsg_buffer err,
static VALUE
rb_reg_s_alloc(VALUE klass)
{
- NEWOBJ(re, struct RRegexp);
- OBJSETUP(re, 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;
+ OBJ_WRITE(re, &re->src, 0);
re->usecnt = 0;
return (VALUE)re;
@@ -2579,7 +2617,7 @@ reg_hash(VALUE re)
*
* /abc/ == /abc/x #=> false
* /abc/ == /abc/i #=> false
- * /abc/ == /abc/n #=> false
+ * /abc/ == /abc/u #=> false
* /abc/u == /abc/n #=> false
*/
@@ -2587,7 +2625,7 @@ static VALUE
rb_reg_equal(VALUE re1, VALUE re2)
{
if (re1 == re2) return Qtrue;
- if (TYPE(re2) != T_REGEXP) return Qfalse;
+ if (!RB_TYPE_P(re2, T_REGEXP)) return Qfalse;
rb_reg_check(re1); rb_reg_check(re2);
if (FL_TEST(re1, KCODE_FIXED) != FL_TEST(re2, KCODE_FIXED)) return Qfalse;
if (RREGEXP(re1)->ptr->options != RREGEXP(re2)->ptr->options) return Qfalse;
@@ -2625,6 +2663,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.
@@ -2635,7 +2674,7 @@ match_equal(VALUE match1, VALUE match2)
{
const struct re_registers *regs1, *regs2;
if (match1 == match2) return Qtrue;
- if (TYPE(match2) != T_MATCH) return Qfalse;
+ if (!RB_TYPE_P(match2, T_MATCH)) return Qfalse;
if (!rb_str_equal(RMATCH(match1)->str, RMATCH(match2)->str)) return Qfalse;
if (!rb_reg_equal(RMATCH(match1)->regexp, RMATCH(match2)->regexp)) return Qfalse;
regs1 = RMATCH_REGS(match1);
@@ -2653,12 +2692,7 @@ reg_operand(VALUE s, int check)
return rb_sym_to_s(s);
}
else {
- VALUE tmp = rb_check_string_type(s);
- if (check && NIL_P(tmp)) {
- rb_raise(rb_eTypeError, "can't convert %s to String",
- rb_obj_classname(s));
- }
- return tmp;
+ return (check ? rb_str_to_str : rb_check_string_type)(s);
}
}
@@ -2746,7 +2780,7 @@ rb_reg_match(VALUE re, VALUE str)
* call-seq:
* rxp === str -> true or false
*
- * Case Equality---Synonym for <code>Regexp#=~</code> used in case statements.
+ * Case Equality---Used in case statements.
*
* a = "HELLO"
* case a
@@ -2754,10 +2788,13 @@ rb_reg_match(VALUE re, VALUE str)
* when /^[A-Z]*$/; print "Upper case\n"
* else; print "Mixed case\n"
* end
+ * #=> "Upper case"
*
- * <em>produces:</em>
+ * Following a regular expression literal with the #=== operator allows you to
+ * compare against a String.
*
- * Upper case
+ * /^[a-z]*$/ === "HELLO" #=> false
+ * /^[A-Z]*$/ === "HELLO" #=> true
*/
VALUE
@@ -2795,7 +2832,7 @@ rb_reg_match2(VALUE re)
long start;
VALUE line = rb_lastline_get();
- if (TYPE(line) != T_STRING) {
+ if (!RB_TYPE_P(line, T_STRING)) {
rb_backref_set(Qnil);
return Qnil;
}
@@ -2872,25 +2909,27 @@ rb_reg_match_m(int argc, VALUE *argv, VALUE re)
/*
* call-seq:
- * Regexp.new(string, [options [, lang]]) -> regexp
+ * Regexp.new(string, [options [, kcode]]) -> regexp
* Regexp.new(regexp) -> regexp
- * Regexp.compile(string, [options [, lang]]) -> regexp
+ * Regexp.compile(string, [options [, kcode]]) -> regexp
* Regexp.compile(regexp) -> regexp
*
- * Constructs a new regular expression from <i>pattern</i>, which can be either
- * a <code>String</code> or a <code>Regexp</code> (in which case that regexp's
- * options are propagated, and new options may not be specified (a change as of
- * Ruby 1.8). If <i>options</i> is a <code>Fixnum</code>, it should be one or
- * more of the constants <code>Regexp::EXTENDED</code>,
- * <code>Regexp::IGNORECASE</code>, and <code>Regexp::MULTILINE</code>,
- * <em>or</em>-ed together. Otherwise, if <i>options</i> is not
- * <code>nil</code>, the regexp will be case insensitive.
- * When the <i>lang</i> parameter is `n' or `N' sets the regexp no encoding.
- *
- * r1 = Regexp.new('^a-z+:\\s+\w+') #=> /^a-z+:\s+\w+/
- * r2 = Regexp.new('cat', true) #=> /cat/i
- * r3 = Regexp.new('dog', Regexp::EXTENDED) #=> /dog/x
- * r4 = Regexp.new(r2) #=> /cat/i
+ * Constructs a new regular expression from +pattern+, which can be either a
+ * String or a Regexp (in which case that regexp's options are propagated),
+ * and new options may not be specified (a change as of Ruby 1.8).
+ *
+ * If +options+ is a Fixnum, it should be one or more of the constants
+ * Regexp::EXTENDED, Regexp::IGNORECASE, and Regexp::MULTILINE,
+ * <em>or</em>-ed together. Otherwise, if +options+ is not
+ * +nil+ or +false+, the regexp will be case insensitive.
+ *
+ * When the +kcode+ parameter is `n' or `N' sets the regexp no encoding.
+ * It means that the regexp is for binary strings.
+ *
+ * r1 = Regexp.new('^a-z+:\\s+\w+') #=> /^a-z+:\s+\w+/
+ * r2 = Regexp.new('cat', true) #=> /cat/i
+ * r3 = Regexp.new(r2) #=> /cat/i
+ * r4 = Regexp.new('dog', Regexp::EXTENDED | Regexp::IGNORECASE) #=> /dog/ix
*/
static VALUE
@@ -2903,10 +2942,8 @@ rb_reg_initialize_m(int argc, VALUE *argv, VALUE self)
const char *ptr;
long len;
- if (argc == 0 || argc > 3) {
- rb_raise(rb_eArgError, "wrong number of arguments (%d for 1..3)", argc);
- }
- if (TYPE(argv[0]) == T_REGEXP) {
+ rb_check_arity(argc, 1, 3);
+ if (RB_TYPE_P(argv[0], T_REGEXP)) {
VALUE re = argv[0];
if (argc > 1) {
@@ -3239,6 +3276,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)
@@ -3259,12 +3299,7 @@ rb_reg_init_copy(VALUE copy, VALUE re)
const char *s;
long len;
- if (copy == re) return copy;
- rb_check_frozen(copy);
- /* need better argument type check */
- if (!rb_obj_is_instance_of(re, rb_obj_class(copy))) {
- rb_raise(rb_eTypeError, "wrong argument type");
- }
+ if (!OBJ_INIT_COPY(copy, re)) return copy;
rb_reg_check(re);
s = RREGEXP_SRC_PTR(re);
len = RREGEXP_SRC_LEN(re);
@@ -3444,14 +3479,16 @@ match_setter(VALUE val)
* Regexp.last_match -> matchdata
* Regexp.last_match(n) -> str
*
- * The first form returns the <code>MatchData</code> object generated by the
- * last successful pattern match. Equivalent to reading the global variable
- * <code>$~</code>. The second form returns the <i>n</i>th field in this
- * <code>MatchData</code> object.
- * <em>n</em> can be a string or symbol to reference a named capture.
+ * The first form returns the MatchData object generated by the
+ * last successful pattern match. Equivalent to reading the special global
+ * variable <code>$~</code> (see Special global variables in Regexp for
+ * details).
+ *
+ * The second form returns the <i>n</i>th field in this MatchData object.
+ * _n_ can be a string or symbol to reference a named capture.
*
- * Note that the <code>last_match</code> is local to the thread and method scope
- * of the method that did the pattern match.
+ * Note that the last_match is local to the thread and method scope of the
+ * method that did the pattern match.
*
* /c(.)t/ =~ 'cat' #=> 0
* Regexp.last_match #=> #<MatchData "cat" 1:"a">
@@ -3506,7 +3543,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 154e2d798f..705e0faad7 100644
--- a/regcomp.c
+++ b/regcomp.c
@@ -1,8 +1,9 @@
/**********************************************************************
- regcomp.c - Oniguruma (regular expression library)
+ regcomp.c - Onigmo (Oniguruma-mod) (regular expression library)
**********************************************************************/
/*-
* Copyright (c) 2002-2008 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
+ * Copyright (c) 2011-2013 K.Takata <kentkt AT csc DOT jp>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -44,10 +45,12 @@ onig_set_default_case_fold_flag(OnigCaseFoldType case_fold_flag)
return 0;
}
+
#ifndef PLATFORM_UNALIGNED_WORD_ACCESS
static unsigned char PadBuf[WORD_ALIGNMENT_SIZE];
#endif
+#if 0
static UChar*
str_dup(UChar* s, UChar* end)
{
@@ -62,6 +65,7 @@ str_dup(UChar* s, UChar* end)
}
else return NULL;
}
+#endif
static void
swap_node(Node* a, Node* b)
@@ -114,7 +118,7 @@ static int
bitset_is_empty(BitSetRef bs)
{
int i;
- for (i = 0; i < (int )BITSET_SIZE; i++) {
+ for (i = 0; i < BITSET_SIZE; i++) {
if (bs[i] != 0) return 0;
}
return 1;
@@ -152,7 +156,7 @@ onig_bbuf_init(BBuf* buf, OnigDistance size)
if (IS_NULL(buf->p)) return(ONIGERR_MEMORY);
}
- buf->alloc = (unsigned int)size;
+ buf->alloc = (unsigned int )size;
buf->used = 0;
return 0;
}
@@ -433,7 +437,7 @@ 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 * str_len;
+ len += mb_len * (int )str_len;
return len;
}
@@ -1262,6 +1266,26 @@ compile_length_enclose_node(EncloseNode* node, regex_t* reg)
}
break;
+ case ENCLOSE_CONDITION:
+ len = SIZE_OP_CONDITION;
+ if (NTYPE(node->target) == NT_ALT) {
+ Node* x = node->target;
+
+ tlen = compile_length_tree(NCAR(x), reg); /* yes-node */
+ if (tlen < 0) return tlen;
+ len += tlen + SIZE_OP_JUMP;
+ if (NCDR(x) == NULL) return ONIGERR_PARSER_BUG;
+ x = NCDR(x);
+ tlen = compile_length_tree(NCAR(x), reg); /* no-node */
+ if (tlen < 0) return tlen;
+ len += tlen;
+ if (NCDR(x) != NULL) return ONIGERR_INVALID_CONDITION_PATTERN;
+ }
+ else {
+ return ONIGERR_PARSER_BUG;
+ }
+ break;
+
default:
return ONIGERR_TYPE_BUG;
break;
@@ -1365,6 +1389,39 @@ compile_enclose_node(EncloseNode* node, regex_t* reg)
}
break;
+ case ENCLOSE_CONDITION:
+ r = add_opcode(reg, OP_CONDITION);
+ if (r) return r;
+ r = add_mem_num(reg, node->regnum);
+ if (r) return r;
+
+ if (NTYPE(node->target) == NT_ALT) {
+ Node* x = node->target;
+ int len2;
+
+ len = compile_length_tree(NCAR(x), reg); /* yes-node */
+ if (len < 0) return len;
+ if (NCDR(x) == NULL) return ONIGERR_PARSER_BUG;
+ x = NCDR(x);
+ len2 = compile_length_tree(NCAR(x), reg); /* no-node */
+ if (len2 < 0) return len2;
+ if (NCDR(x) != NULL) return ONIGERR_INVALID_CONDITION_PATTERN;
+
+ x = node->target;
+ r = add_rel_addr(reg, len + SIZE_OP_JUMP);
+ if (r) return r;
+ r = compile_tree(NCAR(x), reg); /* yes-node */
+ if (r) return r;
+ r = add_opcode_rel_addr(reg, OP_JUMP, len2);
+ if (r) return r;
+ x = NCDR(x);
+ r = compile_tree(NCAR(x), reg); /* no-node */
+ }
+ else {
+ return ONIGERR_PARSER_BUG;
+ }
+ break;
+
default:
return ONIGERR_TYPE_BUG;
break;
@@ -1419,12 +1476,28 @@ compile_anchor_node(AnchorNode* node, regex_t* reg)
case ANCHOR_SEMI_END_BUF: r = add_opcode(reg, OP_SEMI_END_BUF); break;
case ANCHOR_BEGIN_POSITION: r = add_opcode(reg, OP_BEGIN_POSITION); break;
- case ANCHOR_WORD_BOUND: r = add_opcode(reg, OP_WORD_BOUND); break;
- case ANCHOR_NOT_WORD_BOUND: r = add_opcode(reg, OP_NOT_WORD_BOUND); break;
+ /* used for implicit anchor optimization: /.*a/ ==> /(?:^|\G).*a/ */
+ case ANCHOR_ANYCHAR_STAR: r = add_opcode(reg, OP_BEGIN_POS_OR_LINE); break;
+
+ case ANCHOR_WORD_BOUND:
+ if (node->ascii_range) r = add_opcode(reg, OP_ASCII_WORD_BOUND);
+ else r = add_opcode(reg, OP_WORD_BOUND);
+ break;
+ case ANCHOR_NOT_WORD_BOUND:
+ if (node->ascii_range) r = add_opcode(reg, OP_NOT_ASCII_WORD_BOUND);
+ else r = add_opcode(reg, OP_NOT_WORD_BOUND);
+ break;
#ifdef USE_WORD_BEGIN_END
- case ANCHOR_WORD_BEGIN: r = add_opcode(reg, OP_WORD_BEGIN); break;
- case ANCHOR_WORD_END: r = add_opcode(reg, OP_WORD_END); break;
+ case ANCHOR_WORD_BEGIN:
+ if (node->ascii_range) r = add_opcode(reg, OP_ASCII_WORD_BEGIN);
+ else r = add_opcode(reg, OP_WORD_BEGIN);
+ break;
+ case ANCHOR_WORD_END:
+ if (node->ascii_range) r = add_opcode(reg, OP_ASCII_WORD_END);
+ else r = add_opcode(reg, OP_WORD_END);
+ break;
#endif
+ case ANCHOR_KEEP: r = add_opcode(reg, OP_KEEP); break;
case ANCHOR_PREC_READ:
r = add_opcode(reg, OP_PUSH_POS);
@@ -1642,8 +1715,14 @@ compile_tree(Node* node, regex_t* reg)
switch (NCTYPE(node)->ctype) {
case ONIGENC_CTYPE_WORD:
- if (NCTYPE(node)->not != 0) op = OP_NOT_WORD;
- else op = OP_WORD;
+ if (NCTYPE(node)->ascii_range != 0) {
+ if (NCTYPE(node)->not != 0) op = OP_NOT_ASCII_WORD;
+ else op = OP_ASCII_WORD;
+ }
+ else {
+ if (NCTYPE(node)->not != 0) op = OP_NOT_WORD;
+ else op = OP_WORD;
+ }
break;
default:
return ONIGERR_TYPE_BUG;
@@ -1864,7 +1943,12 @@ renumber_by_map(Node* node, GroupNumRemap* map)
r = renumber_by_map(NQTFR(node)->target, map);
break;
case NT_ENCLOSE:
- r = renumber_by_map(NENCLOSE(node)->target, map);
+ {
+ EncloseNode* en = NENCLOSE(node);
+ if (en->type == ENCLOSE_CONDITION)
+ en->regnum = map[en->regnum].new_val;
+ r = renumber_by_map(en->target, map);
+ }
break;
case NT_BREF:
@@ -2031,6 +2115,7 @@ quantifiers_memory_node_info(Node* node)
case ENCLOSE_OPTION:
case ENCLOSE_STOP_BACKTRACK:
+ case ENCLOSE_CONDITION:
r = quantifiers_memory_node_info(en->target);
break;
default:
@@ -2162,6 +2247,7 @@ get_min_match_length(Node* node, OnigDistance *min, ScanEnv* env)
#endif
case ENCLOSE_OPTION:
case ENCLOSE_STOP_BACKTRACK:
+ case ENCLOSE_CONDITION:
r = get_min_match_length(en->target, min, env);
break;
}
@@ -2279,6 +2365,7 @@ get_max_match_length(Node* node, OnigDistance *max, ScanEnv* env)
#endif
case ENCLOSE_OPTION:
case ENCLOSE_STOP_BACKTRACK:
+ case ENCLOSE_CONDITION:
r = get_max_match_length(en->target, max, env);
break;
}
@@ -2310,7 +2397,7 @@ get_char_length_tree1(Node* node, regex_t* reg, int* len, int level)
do {
r = get_char_length_tree1(NCAR(node), reg, &tlen, level);
if (r == 0)
- *len = (int)distance_add(*len, tlen);
+ *len = (int )distance_add(*len, tlen);
} while (r == 0 && IS_NOT_NULL(node = NCDR(node)));
break;
@@ -2357,7 +2444,7 @@ get_char_length_tree1(Node* node, regex_t* reg, int* len, int level)
if (qn->lower == qn->upper) {
r = get_char_length_tree1(qn->target, reg, &tlen, level);
if (r == 0)
- *len = (int)distance_multiply(tlen, qn->lower);
+ *len = (int )distance_multiply(tlen, qn->lower);
}
else
r = GET_CHAR_LEN_VARLEN;
@@ -2401,6 +2488,7 @@ get_char_length_tree1(Node* node, regex_t* reg, int* len, int level)
#endif
case ENCLOSE_OPTION:
case ENCLOSE_STOP_BACKTRACK:
+ case ENCLOSE_CONDITION:
r = get_char_length_tree1(en->target, reg, len, level);
break;
default:
@@ -2433,7 +2521,7 @@ is_not_included(Node* x, Node* y, regex_t* reg)
int i;
OnigDistance len;
OnigCodePoint code;
- UChar *p, c;
+ UChar *p;
int ytype;
retry:
@@ -2444,7 +2532,8 @@ is_not_included(Node* x, Node* y, regex_t* reg)
switch (ytype) {
case NT_CTYPE:
if (NCTYPE(y)->ctype == NCTYPE(x)->ctype &&
- NCTYPE(y)->not != NCTYPE(x)->not)
+ NCTYPE(y)->not != NCTYPE(x)->not &&
+ NCTYPE(y)->ascii_range == NCTYPE(x)->ascii_range)
return 1;
else
return 0;
@@ -2480,7 +2569,12 @@ is_not_included(Node* x, Node* y, regex_t* reg)
if (IS_NULL(xc->mbuf) && !IS_NCCLASS_NOT(xc)) {
for (i = 0; i < SINGLE_BYTE_SIZE; i++) {
if (BITSET_AT(xc->bs, i)) {
- if (IS_CODE_SB_WORD(reg->enc, i)) return 0;
+ if (NCTYPE(y)->ascii_range) {
+ if (IS_CODE_SB_WORD(reg->enc, i)) return 0;
+ }
+ else {
+ if (ONIGENC_IS_CODE_WORD(reg->enc, i)) return 0;
+ }
}
}
return 1;
@@ -2489,7 +2583,12 @@ is_not_included(Node* x, Node* y, regex_t* reg)
}
else {
for (i = 0; i < SINGLE_BYTE_SIZE; i++) {
- if (! IS_CODE_SB_WORD(reg->enc, i)) {
+ int is_word;
+ if (NCTYPE(y)->ascii_range)
+ is_word = IS_CODE_SB_WORD(reg->enc, i);
+ else
+ is_word = ONIGENC_IS_CODE_WORD(reg->enc, i);
+ if (! is_word) {
if (!IS_NCCLASS_NOT(xc)) {
if (BITSET_AT(xc->bs, i))
return 0;
@@ -2547,15 +2646,22 @@ is_not_included(Node* x, Node* y, regex_t* reg)
if (NSTRING_LEN(x) == 0)
break;
- c = *(xs->s);
switch (ytype) {
case NT_CTYPE:
switch (NCTYPE(y)->ctype) {
case ONIGENC_CTYPE_WORD:
- if (ONIGENC_IS_MBC_WORD(reg->enc, xs->s, xs->end))
- return NCTYPE(y)->not;
- else
- return !(NCTYPE(y)->not);
+ if (NCTYPE(y)->ascii_range) {
+ if (ONIGENC_IS_MBC_ASCII_WORD(reg->enc, xs->s, xs->end))
+ return NCTYPE(y)->not;
+ else
+ return !(NCTYPE(y)->not);
+ }
+ else {
+ if (ONIGENC_IS_MBC_WORD(reg->enc, xs->s, xs->end))
+ return NCTYPE(y)->not;
+ else
+ return !(NCTYPE(y)->not);
+ }
break;
default:
break;
@@ -2583,7 +2689,7 @@ is_not_included(Node* x, Node* y, regex_t* reg)
return 0;
}
else {
- for (i = 0, p = ys->s, q = xs->s; (OnigDistance)i < len; i++, p++, q++) {
+ for (i = 0, p = ys->s, q = xs->s; (OnigDistance )i < len; i++, p++, q++) {
if (*p != *q) return 1;
}
}
@@ -2672,6 +2778,7 @@ get_head_value_node(Node* node, int exact, regex_t* reg)
case ENCLOSE_MEMORY:
case ENCLOSE_STOP_BACKTRACK:
+ case ENCLOSE_CONDITION:
n = get_head_value_node(en->target, exact, reg);
break;
}
@@ -3070,6 +3177,11 @@ setup_subexp_call(Node* node, ScanEnv* env)
cn->unset_addr_list = env->unset_addr_list;
}
#ifdef USE_NAMED_GROUP
+#ifdef USE_PERL_SUBEXP_CALL
+ else if (cn->name == cn->name_end) {
+ goto set_call_attr;
+ }
+#endif
else {
int *refs;
@@ -3080,7 +3192,8 @@ setup_subexp_call(Node* node, ScanEnv* env)
ONIGERR_UNDEFINED_NAME_REFERENCE, cn->name, cn->name_end);
return ONIGERR_UNDEFINED_NAME_REFERENCE;
}
- else if (n > 1) {
+ else if (n > 1 &&
+ ! IS_SYNTAX_BV(env->syntax, ONIG_SYN_ALLOW_MULTIPLEX_DEFINITION_NAME_CALL)) {
onig_scan_env_set_error_string(env,
ONIGERR_MULTIPLEX_DEFINITION_NAME_CALL, cn->name, cn->name_end);
return ONIGERR_MULTIPLEX_DEFINITION_NAME_CALL;
@@ -3173,7 +3286,7 @@ setup_look_behind(Node* node, regex_t* reg, ScanEnv* env)
}
static int
-next_setup(Node* node, Node* next_node, regex_t* reg)
+next_setup(Node* node, Node* next_node, int in_root, regex_t* reg)
{
int type;
@@ -3189,7 +3302,7 @@ next_setup(Node* node, Node* next_node, regex_t* reg)
qn->next_head_exact = n;
}
#endif
- /* automatic posseivation a*b ==> (?>a*)b */
+ /* automatic possessivation a*b ==> (?>a*)b */
if (qn->lower <= 1) {
int ttype = NTYPE(qn->target);
if (IS_NODE_TYPE_SIMPLE(ttype)) {
@@ -3207,10 +3320,32 @@ next_setup(Node* node, Node* next_node, regex_t* reg)
}
}
}
+
+#ifndef ONIG_DONT_OPTIMIZE
+ if (NTYPE(node) == NT_QTFR && /* the type may be changed by above block */
+ in_root && /* qn->lower == 0 && */
+ NTYPE(qn->target) == NT_CANY &&
+ ! IS_MULTILINE(reg->options)) {
+ /* implicit anchor: /.*a/ ==> /(?:^|\G).*a/ */
+ Node *np;
+ np = onig_node_new_list(NULL_NODE, NULL_NODE);
+ CHECK_NULL_RETURN_MEMERR(np);
+ swap_node(node, np);
+ NCDR(node) = onig_node_new_list(np, NULL_NODE);
+ if (IS_NULL(NCDR(node))) {
+ onig_node_free(np);
+ return ONIGERR_MEMORY;
+ }
+ np = onig_node_new_anchor(ANCHOR_ANYCHAR_STAR); /* (?:^|\G) */
+ CHECK_NULL_RETURN_MEMERR(np);
+ NCAR(node) = np;
+ }
+#endif
}
}
else if (type == NT_ENCLOSE) {
EncloseNode* en = NENCLOSE(node);
+ in_root = 0;
if (en->type == ENCLOSE_MEMORY) {
node = en->target;
goto retry;
@@ -3223,7 +3358,7 @@ next_setup(Node* node, Node* next_node, regex_t* reg)
static int
update_string_node_case_fold(regex_t* reg, Node *node)
{
- UChar *p, *q, *end, buf[ONIGENC_MBC_CASE_FOLD_MAXLEN];
+ UChar *p, *end, buf[ONIGENC_MBC_CASE_FOLD_MAXLEN];
UChar *sbuf, *ebuf, *sp;
int r, i, len;
OnigDistance sbuf_size;
@@ -3239,11 +3374,14 @@ update_string_node_case_fold(regex_t* reg, Node *node)
p = sn->s;
while (p < end) {
len = ONIGENC_MBC_CASE_FOLD(reg->enc, reg->case_fold_flag, &p, end, buf);
- q = buf;
for (i = 0; i < len; i++) {
if (sp >= ebuf) {
- sbuf = (UChar* )xrealloc(sbuf, sbuf_size * 2);
- CHECK_NULL_RETURN_MEMERR(sbuf);
+ UChar* p = (UChar* )xrealloc(sbuf, sbuf_size * 2);
+ if (IS_NULL(p)) {
+ xfree(sbuf);
+ return ONIGERR_MEMORY;
+ }
+ sbuf = p;
sp = sbuf + sbuf_size;
sbuf_size *= 2;
ebuf = sbuf + sbuf_size;
@@ -3290,18 +3428,22 @@ expand_case_fold_string_alt(int item_num, OnigCaseFoldCodeItem items[],
UChar *p, int slen, UChar *end,
regex_t* reg, Node **rnode)
{
- int r, i, j, len, varlen;
+ int r, i, j, len, varlen, varclen;
Node *anode, *var_anode, *snode, *xnode, *an;
UChar buf[ONIGENC_CODE_TO_MBC_MAXLEN];
*rnode = var_anode = NULL_NODE;
varlen = 0;
+ varclen = 0;
for (i = 0; i < item_num; i++) {
if (items[i].byte_len != slen) {
varlen = 1;
break;
}
+ if (items[i].code_len != 1) {
+ varclen = 1;
+ }
}
if (varlen != 0) {
@@ -3386,6 +3528,8 @@ expand_case_fold_string_alt(int item_num, OnigCaseFoldCodeItem items[],
}
}
+ if (varclen && !varlen)
+ return 2;
return varlen;
mem_err2:
@@ -3403,6 +3547,7 @@ expand_case_fold_string(Node* node, regex_t* reg)
#define THRESHOLD_CASE_FOLD_ALT_FOR_EXPANSION 8
int r, n, len, alt_num;
+ int varlen = 0;
UChar *start, *end, *p;
Node *top_root, *root, *snode, *prev_node;
OnigCaseFoldCodeItem items[ONIGENC_GET_CASE_FOLD_CODES_MAX_NUM];
@@ -3465,6 +3610,7 @@ expand_case_fold_string(Node* node, regex_t* reg)
r = expand_case_fold_string_alt(n, items, p, len, end, reg, &prev_node);
if (r < 0) goto mem_err;
+ if (r > 0) varlen = 1;
if (r == 1) {
if (IS_NULL(root)) {
top_root = prev_node;
@@ -3478,7 +3624,7 @@ expand_case_fold_string(Node* node, regex_t* reg)
root = NCAR(prev_node);
}
- else { /* r == 0 */
+ else { /* r == 0 || r == 2 */
if (IS_NOT_NULL(root)) {
if (IS_NULL(onig_node_list_add(root, prev_node))) {
onig_node_free(prev_node);
@@ -3521,9 +3667,20 @@ expand_case_fold_string(Node* node, regex_t* reg)
/* ending */
top_root = (IS_NOT_NULL(top_root) ? top_root : prev_node);
- swap_node(node, top_root);
+ if (!varlen) {
+ /* When all expanded strings are same length, case-insensitive
+ BM search will be used. */
+ r = update_string_node_case_fold(reg, node);
+ if (r == 0) {
+ NSTRING_SET_AMBIG(node);
+ }
+ }
+ else {
+ swap_node(node, top_root);
+ r = 0;
+ }
onig_node_free(top_root);
- return 0;
+ return r;
mem_err:
r = ONIGERR_MEMORY;
@@ -3678,6 +3835,7 @@ setup_comb_exp_check(Node* node, int state, ScanEnv* env)
#define IN_NOT (1<<1)
#define IN_REPEAT (1<<2)
#define IN_VAR_REPEAT (1<<3)
+#define IN_ROOT (1<<4)
/* setup_tree does the following work.
1. check empty loop. (set qn->target_empty_info)
@@ -3692,19 +3850,25 @@ setup_tree(Node* node, regex_t* reg, int state, ScanEnv* env)
{
int type;
int r = 0;
+ int in_root = state & IN_ROOT;
+ state &= ~IN_ROOT;
restart:
type = NTYPE(node);
switch (type) {
case NT_LIST:
{
Node* prev = NULL_NODE;
+ int prev_in_root = 0;
+ state |= in_root;
do {
r = setup_tree(NCAR(node), reg, state, env);
if (IS_NOT_NULL(prev) && r == 0) {
- r = next_setup(prev, NCAR(node), reg);
+ r = next_setup(prev, NCAR(node), prev_in_root, reg);
}
prev = NCAR(node);
+ prev_in_root = state & IN_ROOT;
+ state &= ~IN_ROOT;
} while (r == 0 && IS_NOT_NULL(node = NCDR(node)));
}
break;
@@ -3799,21 +3963,47 @@ restart:
/* expand string */
#define EXPAND_STRING_MAX_LENGTH 100
if (NTYPE(target) == NT_STR) {
- if (!IS_REPEAT_INFINITE(qn->lower) && qn->lower == qn->upper &&
- qn->lower > 1 && qn->lower <= EXPAND_STRING_MAX_LENGTH) {
+ if (qn->lower > 1) {
+ int i, n = qn->lower;
OnigDistance len = NSTRING_LEN(target);
StrNode* sn = NSTR(target);
+ Node* np;
- if (len * qn->lower <= EXPAND_STRING_MAX_LENGTH) {
- int i, n = qn->lower;
- onig_node_conv_to_str_node(node, NSTR(target)->flag);
- for (i = 0; i < n; i++) {
- r = onig_node_str_cat(node, sn->s, sn->end);
- if (r) break;
+ np = onig_node_new_str(sn->s, sn->end);
+ if (IS_NULL(np)) return ONIGERR_MEMORY;
+ NSTR(np)->flag = sn->flag;
+
+ for (i = 1; i < n && (i+1) * len <= EXPAND_STRING_MAX_LENGTH; i++) {
+ r = onig_node_str_cat(np, sn->s, sn->end);
+ if (r) {
+ onig_node_free(np);
+ return r;
}
- onig_node_free(target);
- break; /* break case NT_QTFR: */
}
+ if (i < qn->upper || IS_REPEAT_INFINITE(qn->upper)) {
+ Node *np1, *np2;
+
+ qn->lower -= i;
+ if (! IS_REPEAT_INFINITE(qn->upper))
+ qn->upper -= i;
+
+ np1 = onig_node_new_list(np, NULL);
+ if (IS_NULL(np1)) {
+ onig_node_free(np);
+ return ONIGERR_MEMORY;
+ }
+ swap_node(np1, node);
+ np2 = onig_node_list_add(node, np1);
+ if (IS_NULL(np2)) {
+ onig_node_free(np1);
+ return ONIGERR_MEMORY;
+ }
+ }
+ else {
+ swap_node(np, node);
+ onig_node_free(np);
+ }
+ break; /* break case NT_QTFR: */
}
}
@@ -3842,6 +4032,7 @@ restart:
case ENCLOSE_OPTION:
{
OnigOptionType options = reg->options;
+ state |= in_root;
reg->options = NENCLOSE(node)->option;
r = setup_tree(NENCLOSE(node)->target, reg, state, env);
reg->options = options;
@@ -3871,6 +4062,18 @@ restart:
}
}
break;
+
+ case ENCLOSE_CONDITION:
+#ifdef USE_NAMED_GROUP
+ if (! IS_ENCLOSE_NAME_REF(NENCLOSE(node)) &&
+ env->num_named > 0 &&
+ IS_SYNTAX_BV(env->syntax, ONIG_SYN_CAPTURE_ONLY_NAMED_GROUP) &&
+ !ONIG_IS_OPTION_ON(env->option, ONIG_OPTION_CAPTURE_GROUP)) {
+ return ONIGERR_NUMBERED_BACKREF_OR_CALL_NOT_ALLOWED;
+ }
+#endif
+ r = setup_tree(NENCLOSE(node)->target, reg, state, env);
+ break;
}
}
break;
@@ -3892,13 +4095,19 @@ restart:
( BIT_NT_LIST | BIT_NT_ALT | BIT_NT_STR | BIT_NT_CCLASS | BIT_NT_CTYPE | \
BIT_NT_CANY | BIT_NT_ANCHOR | BIT_NT_ENCLOSE | BIT_NT_QTFR | BIT_NT_CALL )
-#define ALLOWED_ENCLOSE_IN_LB ( ENCLOSE_MEMORY )
-#define ALLOWED_ENCLOSE_IN_LB_NOT 0
+#define ALLOWED_ENCLOSE_IN_LB ( ENCLOSE_MEMORY | ENCLOSE_OPTION )
+#define ALLOWED_ENCLOSE_IN_LB_NOT ENCLOSE_OPTION
#define ALLOWED_ANCHOR_IN_LB \
-( ANCHOR_LOOK_BEHIND | ANCHOR_BEGIN_LINE | ANCHOR_END_LINE | ANCHOR_BEGIN_BUF | ANCHOR_BEGIN_POSITION )
+( ANCHOR_LOOK_BEHIND | ANCHOR_LOOK_BEHIND_NOT | ANCHOR_BEGIN_LINE | \
+ ANCHOR_END_LINE | ANCHOR_BEGIN_BUF | ANCHOR_BEGIN_POSITION | ANCHOR_KEEP | \
+ ANCHOR_WORD_BOUND | ANCHOR_NOT_WORD_BOUND | \
+ ANCHOR_WORD_BEGIN | ANCHOR_WORD_END )
#define ALLOWED_ANCHOR_IN_LB_NOT \
-( ANCHOR_LOOK_BEHIND | ANCHOR_LOOK_BEHIND_NOT | ANCHOR_BEGIN_LINE | ANCHOR_END_LINE | ANCHOR_BEGIN_BUF | ANCHOR_BEGIN_POSITION )
+( ANCHOR_LOOK_BEHIND | ANCHOR_LOOK_BEHIND_NOT | ANCHOR_BEGIN_LINE | \
+ ANCHOR_END_LINE | ANCHOR_BEGIN_BUF | ANCHOR_BEGIN_POSITION | ANCHOR_KEEP | \
+ ANCHOR_WORD_BOUND | ANCHOR_NOT_WORD_BOUND | \
+ ANCHOR_WORD_BEGIN | ANCHOR_WORD_END )
case ANCHOR_LOOK_BEHIND:
{
@@ -3936,32 +4145,151 @@ restart:
return r;
}
-/* set skip map for Boyer-Moor search */
+#ifndef USE_SUNDAY_QUICK_SEARCH
+/* set skip map for Boyer-Moore search */
static int
-set_bm_skip(UChar* s, UChar* end, OnigEncoding enc ARG_UNUSED,
- UChar skip[], int** int_skip)
+set_bm_skip(UChar* s, UChar* end, regex_t* reg,
+ UChar skip[], int** int_skip, int ignore_case)
{
OnigDistance i, len;
+ int clen, flen, n, j, k;
+ UChar *p, buf[ONIGENC_GET_CASE_FOLD_CODES_MAX_NUM][ONIGENC_MBC_CASE_FOLD_MAXLEN];
+ OnigCaseFoldCodeItem items[ONIGENC_GET_CASE_FOLD_CODES_MAX_NUM];
+ OnigEncoding enc = reg->enc;
len = end - s;
if (len < ONIG_CHAR_TABLE_SIZE) {
- for (i = 0; i < ONIG_CHAR_TABLE_SIZE; i++) skip[i] = len;
-
- for (i = 0; i < len - 1; i++)
- skip[s[i]] = len - 1 - i;
+ for (i = 0; i < ONIG_CHAR_TABLE_SIZE; i++) skip[i] = (UChar )len;
+
+ n = 0;
+ for (i = 0; i < len - 1; i += clen) {
+ p = s + i;
+ if (ignore_case)
+ n = ONIGENC_GET_CASE_FOLD_CODES_BY_STR(enc, reg->case_fold_flag,
+ p, end, items);
+ clen = enclen(enc, p, end);
+
+ for (j = 0; j < n; j++) {
+ if ((items[j].code_len != 1) || (items[j].byte_len != clen))
+ return 1; /* different length isn't supported. */
+ flen = ONIGENC_CODE_TO_MBC(enc, items[j].code[0], buf[j]);
+ if (flen != clen)
+ return 1; /* different length isn't supported. */
+ }
+ for (j = 0; j < clen; j++) {
+ skip[s[i + j]] = (UChar )(len - 1 - i - j);
+ for (k = 0; k < n; k++) {
+ skip[buf[k][j]] = (UChar )(len - 1 - i - j);
+ }
+ }
+ }
}
else {
if (IS_NULL(*int_skip)) {
*int_skip = (int* )xmalloc(sizeof(int) * ONIG_CHAR_TABLE_SIZE);
if (IS_NULL(*int_skip)) return ONIGERR_MEMORY;
}
- for (i = 0; i < ONIG_CHAR_TABLE_SIZE; i++) (*int_skip)[i] = (int)len;
+ for (i = 0; i < ONIG_CHAR_TABLE_SIZE; i++) (*int_skip)[i] = (int )len;
+
+ n = 0;
+ for (i = 0; i < len - 1; i += clen) {
+ p = s + i;
+ if (ignore_case)
+ n = ONIGENC_GET_CASE_FOLD_CODES_BY_STR(enc, reg->case_fold_flag,
+ p, end, items);
+ clen = enclen(enc, p, end);
+
+ for (j = 0; j < n; j++) {
+ if ((items[j].code_len != 1) || (items[j].byte_len != clen))
+ return 1; /* different length isn't supported. */
+ flen = ONIGENC_CODE_TO_MBC(enc, items[j].code[0], buf[j]);
+ if (flen != clen)
+ return 1; /* different length isn't supported. */
+ }
+ for (j = 0; j < clen; j++) {
+ (*int_skip)[s[i + j]] = (int )(len - 1 - i - j);
+ for (k = 0; k < n; k++) {
+ (*int_skip)[buf[k][j]] = (int )(len - 1 - i - j);
+ }
+ }
+ }
+ }
+ return 0;
+}
- for (i = 0; i < len - 1; i++)
- (*int_skip)[s[i]] = (int)(len - 1 - i);
+#else /* USE_SUNDAY_QUICK_SEARCH */
+
+/* set skip map for Sunday's quick search */
+static int
+set_bm_skip(UChar* s, UChar* end, regex_t* reg,
+ UChar skip[], int** int_skip, int ignore_case)
+{
+ OnigDistance i, len;
+ int clen, flen, n, j, k;
+ UChar *p, buf[ONIGENC_GET_CASE_FOLD_CODES_MAX_NUM][ONIGENC_MBC_CASE_FOLD_MAXLEN];
+ OnigCaseFoldCodeItem items[ONIGENC_GET_CASE_FOLD_CODES_MAX_NUM];
+ OnigEncoding enc = reg->enc;
+
+ len = end - s;
+ if (len < ONIG_CHAR_TABLE_SIZE) {
+ for (i = 0; i < ONIG_CHAR_TABLE_SIZE; i++) skip[i] = (UChar )(len + 1);
+
+ n = 0;
+ for (i = 0; i < len; i += clen) {
+ p = s + i;
+ if (ignore_case)
+ n = ONIGENC_GET_CASE_FOLD_CODES_BY_STR(enc, reg->case_fold_flag,
+ p, end, items);
+ clen = enclen(enc, p, end);
+
+ for (j = 0; j < n; j++) {
+ if ((items[j].code_len != 1) || (items[j].byte_len != clen))
+ return 1; /* different length isn't supported. */
+ flen = ONIGENC_CODE_TO_MBC(enc, items[j].code[0], buf[j]);
+ if (flen != clen)
+ return 1; /* different length isn't supported. */
+ }
+ for (j = 0; j < clen; j++) {
+ skip[s[i + j]] = (UChar )(len - i - j);
+ for (k = 0; k < n; k++) {
+ skip[buf[k][j]] = (UChar )(len - i - j);
+ }
+ }
+ }
+ }
+ else {
+ if (IS_NULL(*int_skip)) {
+ *int_skip = (int* )xmalloc(sizeof(int) * ONIG_CHAR_TABLE_SIZE);
+ if (IS_NULL(*int_skip)) return ONIGERR_MEMORY;
+ }
+ for (i = 0; i < ONIG_CHAR_TABLE_SIZE; i++) (*int_skip)[i] = (int )(len + 1);
+
+ n = 0;
+ for (i = 0; i < len; i += clen) {
+ p = s + i;
+ if (ignore_case)
+ n = ONIGENC_GET_CASE_FOLD_CODES_BY_STR(enc, reg->case_fold_flag,
+ p, end, items);
+ clen = enclen(enc, p, end);
+
+ for (j = 0; j < n; j++) {
+ if ((items[j].code_len != 1) || (items[j].byte_len != clen))
+ return 1; /* different length isn't supported. */
+ flen = ONIGENC_CODE_TO_MBC(enc, items[j].code[0], buf[j]);
+ if (flen != clen)
+ return 1; /* different length isn't supported. */
+ }
+ for (j = 0; j < clen; j++) {
+ (*int_skip)[s[i + j]] = (int )(len - i - j);
+ for (k = 0; k < n; k++) {
+ (*int_skip)[buf[k][j]] = (int )(len - i - j);
+ }
+ }
+ }
}
return 0;
}
+#endif /* USE_SUNDAY_QUICK_SEARCH */
#define OPT_EXACT_MAXLEN 24
@@ -3988,7 +4316,7 @@ typedef struct {
OptAncInfo anc;
int reach_end;
- int ignore_case;
+ int ignore_case; /* -1: unset, 0: case sensitive, 1: ignore case */
int len;
UChar s[OPT_EXACT_MAXLEN];
} OptExactInfo;
@@ -4225,7 +4553,7 @@ clear_opt_exact_info(OptExactInfo* ex)
clear_mml(&ex->mmd);
clear_opt_anc_info(&ex->anc);
ex->reach_end = 0;
- ex->ignore_case = 0;
+ ex->ignore_case = -1; /* unset */
ex->len = 0;
ex->s[0] = '\0';
}
@@ -4243,11 +4571,10 @@ concat_opt_exact_info(OptExactInfo* to, OptExactInfo* add, OnigEncoding enc)
UChar *p, *end;
OptAncInfo tanc;
- if (! to->ignore_case && add->ignore_case) {
- if (to->len >= add->len) return ; /* avoid */
-
- to->ignore_case = 1;
- }
+ if (to->ignore_case < 0)
+ to->ignore_case = add->ignore_case;
+ else if (to->ignore_case != add->ignore_case)
+ return ; /* avoid */
p = add->s;
end = p + add->len;
@@ -4313,7 +4640,10 @@ alt_merge_opt_exact_info(OptExactInfo* to, OptExactInfo* add, OptEnv* env)
to->reach_end = 0;
}
to->len = i;
- to->ignore_case |= add->ignore_case;
+ if (to->ignore_case < 0)
+ to->ignore_case = add->ignore_case;
+ else if (add->ignore_case >= 0)
+ to->ignore_case |= add->ignore_case;
alt_merge_opt_anc_info(&to->anc, &add->anc);
if (! to->reach_end) to->anc.right_anchor = 0;
@@ -4343,8 +4673,8 @@ select_opt_exact_info(OnigEncoding enc, OptExactInfo* now, OptExactInfo* alt)
if (alt->len > 1) v2 += 5;
}
- if (now->ignore_case == 0) v1 *= 2;
- if (alt->ignore_case == 0) v2 *= 2;
+ if (now->ignore_case <= 0) v1 *= 2;
+ if (alt->ignore_case <= 0) v2 *= 2;
if (comp_distance_value(&now->mmd, &alt->mmd, v1, v2) > 0)
copy_opt_exact_info(now, alt);
@@ -4442,7 +4772,7 @@ comp_opt_exact_or_map_info(OptExactInfo* e, OptMapInfo* m)
if (m->value <= 0) return -1;
- ve = COMP_EM_BASE * e->len * (e->ignore_case ? 1 : 2);
+ ve = COMP_EM_BASE * e->len * (e->ignore_case > 0 ? 1 : 2);
vm = COMP_EM_BASE * 5 * 2 / m->value;
return comp_distance_value(&e->mmd, &m->mmd, ve, vm);
}
@@ -4541,7 +4871,7 @@ concat_left_node_opt_info(OnigEncoding enc, NodeOptInfo* to, NodeOptInfo* add)
if (to->expr.len > 0) {
if (add->len.max > 0) {
if (to->expr.len > (int )add->len.max)
- to->expr.len = (int)add->len.max;
+ to->expr.len = (int )add->len.max;
if (to->expr.mmd.max == 0)
select_opt_exact_info(enc, &to->exb, &to->expr);
@@ -4624,7 +4954,8 @@ optimize_node_left(Node* node, NodeOptInfo* opt, OptEnv* env)
if (! NSTRING_IS_AMBIG(node)) {
concat_opt_exact_info_str(&opt->exb, sn->s, sn->end,
- NSTRING_IS_RAW(node), env->enc);
+ is_raw, env->enc);
+ opt->exb.ignore_case = 0;
if (slen > 0) {
add_char_opt_map_info(&opt->map, *(sn->s), env->enc);
}
@@ -4654,7 +4985,7 @@ optimize_node_left(Node* node, NodeOptInfo* opt, OptEnv* env)
set_mml(&opt->len, slen, max);
}
- if ((OnigDistance)opt->exb.len == slen)
+ if ((OnigDistance )opt->exb.len == slen)
opt->exb.reach_end = 1;
}
break;
@@ -4664,7 +4995,7 @@ optimize_node_left(Node* node, NodeOptInfo* opt, OptEnv* env)
int i, z;
CClassNode* cc = NCCLASS(node);
- /* no need to check ignore case. (setted in setup_tree()) */
+ /* no need to check ignore case. (set in setup_tree()) */
if (IS_NOT_NULL(cc->mbuf) || IS_NCCLASS_NOT(cc)) {
OnigDistance min = ONIGENC_MBC_MINLEN(env->enc);
@@ -4687,23 +5018,25 @@ optimize_node_left(Node* node, NodeOptInfo* opt, OptEnv* env)
case NT_CTYPE:
{
int i, min, max;
+ int maxcode;
max = ONIGENC_MBC_MAXLEN_DIST(env->enc);
if (max == 1) {
min = 1;
+ maxcode = NCTYPE(node)->ascii_range ? 0x80 : SINGLE_BYTE_SIZE;
switch (NCTYPE(node)->ctype) {
case ONIGENC_CTYPE_WORD:
if (NCTYPE(node)->not != 0) {
for (i = 0; i < SINGLE_BYTE_SIZE; i++) {
- if (! ONIGENC_IS_CODE_WORD(env->enc, i)) {
+ if (! ONIGENC_IS_CODE_WORD(env->enc, i) || i >= maxcode) {
add_char_opt_map_info(&opt->map, (UChar )i, env->enc);
}
}
}
else {
- for (i = 0; i < SINGLE_BYTE_SIZE; i++) {
+ for (i = 0; i < maxcode; i++) {
if (ONIGENC_IS_CODE_WORD(env->enc, i)) {
add_char_opt_map_info(&opt->map, (UChar )i, env->enc);
}
@@ -4816,10 +5149,11 @@ optimize_node_left(Node* node, NodeOptInfo* opt, OptEnv* env)
r = optimize_node_left(qn->target, &nopt, env);
if (r) break;
- if (qn->lower == 0 && IS_REPEAT_INFINITE(qn->upper)) {
+ if (/*qn->lower == 0 &&*/ IS_REPEAT_INFINITE(qn->upper)) {
if (env->mmd.max == 0 &&
NTYPE(qn->target) == NT_CANY && qn->greedy) {
if (IS_MULTILINE(env->options))
+ /* implicit anchor: /.*a/ ==> /\A.*a/ */
add_opt_anc_info(&opt->anc, ANCHOR_ANYCHAR_STAR_ML);
else
add_opt_anc_info(&opt->anc, ANCHOR_ANYCHAR_STAR);
@@ -4899,6 +5233,7 @@ optimize_node_left(Node* node, NodeOptInfo* opt, OptEnv* env)
break;
case ENCLOSE_STOP_BACKTRACK:
+ case ENCLOSE_CONDITION:
r = optimize_node_left(en->target, opt, env);
break;
}
@@ -4921,29 +5256,38 @@ static int
set_optimize_exact_info(regex_t* reg, OptExactInfo* e)
{
int r;
+ int allow_reverse;
if (e->len == 0) return 0;
- if (e->ignore_case) {
- reg->exact = (UChar* )xmalloc(e->len);
- CHECK_NULL_RETURN_MEMERR(reg->exact);
- xmemcpy(reg->exact, e->s, e->len);
- reg->exact_end = reg->exact + e->len;
- reg->optimize = ONIG_OPTIMIZE_EXACT_IC;
- }
- else {
- int allow_reverse;
+ reg->exact = (UChar* )xmalloc(e->len);
+ CHECK_NULL_RETURN_MEMERR(reg->exact);
+ xmemcpy(reg->exact, e->s, e->len);
+ reg->exact_end = reg->exact + e->len;
- reg->exact = str_dup(e->s, e->s + e->len);
- CHECK_NULL_RETURN_MEMERR(reg->exact);
- reg->exact_end = reg->exact + e->len;
-
- allow_reverse =
+ allow_reverse =
ONIGENC_IS_ALLOWED_REVERSE_MATCH(reg->enc, reg->exact, reg->exact_end);
+ if (e->ignore_case > 0) {
+ if (e->len >= 3 || (e->len >= 2 && allow_reverse)) {
+ r = set_bm_skip(reg->exact, reg->exact_end, reg,
+ reg->map, &(reg->int_map), 1);
+ if (r == 0) {
+ reg->optimize = (allow_reverse != 0
+ ? ONIG_OPTIMIZE_EXACT_BM_IC : ONIG_OPTIMIZE_EXACT_BM_NOT_REV_IC);
+ }
+ else {
+ reg->optimize = ONIG_OPTIMIZE_EXACT_IC;
+ }
+ }
+ else {
+ reg->optimize = ONIG_OPTIMIZE_EXACT_IC;
+ }
+ }
+ else {
if (e->len >= 3 || (e->len >= 2 && allow_reverse)) {
- r = set_bm_skip(reg->exact, reg->exact_end, reg->enc,
- reg->map, &(reg->int_map));
+ r = set_bm_skip(reg->exact, reg->exact_end, reg,
+ reg->map, &(reg->int_map), 0);
if (r) return r;
reg->optimize = (allow_reverse != 0
@@ -4958,7 +5302,7 @@ set_optimize_exact_info(regex_t* reg, OptExactInfo* e)
reg->dmax = e->mmd.max;
if (reg->dmin != ONIG_INFINITE_DISTANCE) {
- reg->threshold_len = (int)(reg->dmin + (reg->exact_end - reg->exact));
+ reg->threshold_len = (int )(reg->dmin + (reg->exact_end - reg->exact));
}
return 0;
@@ -4977,7 +5321,7 @@ set_optimize_map_info(regex_t* reg, OptMapInfo* m)
reg->dmax = m->mmd.max;
if (reg->dmin != ONIG_INFINITE_DISTANCE) {
- reg->threshold_len = (int)(reg->dmin + 1);
+ reg->threshold_len = (int )(reg->dmin + 1);
}
}
@@ -5157,7 +5501,7 @@ print_anchor(FILE* f, int anchor)
}
if (anchor & ANCHOR_ANYCHAR_STAR_ML) {
if (q) fprintf(f, ", ");
- fprintf(f, "anychar-star-pl");
+ fprintf(f, "anychar-star-ml");
}
fprintf(f, "]");
@@ -5167,7 +5511,8 @@ static void
print_optimize_info(FILE* f, regex_t* reg)
{
static const char* on[] = { "NONE", "EXACT", "EXACT_BM", "EXACT_BM_NOT_REV",
- "EXACT_IC", "MAP" };
+ "EXACT_IC", "MAP",
+ "EXACT_BM_IC", "EXACT_BM_NOT_REV_IC" };
fprintf(f, "optimize: %s\n", on[reg->optimize]);
fprintf(f, " anchor: "); print_anchor(f, reg->anchor);
@@ -5247,6 +5592,7 @@ size_t
onig_memsize(const regex_t *reg)
{
size_t size = sizeof(regex_t);
+ if (IS_NULL(reg)) return 0;
if (IS_NOT_NULL(reg->p)) size += reg->alloc;
if (IS_NOT_NULL(reg->exact)) size += reg->exact_end - reg->exact;
if (IS_NOT_NULL(reg->int_map)) size += sizeof(int) * ONIG_CHAR_TABLE_SIZE;
@@ -5257,6 +5603,15 @@ onig_memsize(const regex_t *reg)
return size;
}
+size_t
+onig_region_memsize(const OnigRegion *regs)
+{
+ size_t size = sizeof(*regs);
+ if (IS_NULL(regs)) return 0;
+ size += regs->allocated * (sizeof(*regs->beg) + sizeof(*regs->end));
+ return size;
+}
+
#define REGEX_TRANSFER(to,from) do {\
(to)->state = ONIG_STATE_MODIFY;\
onig_free_body(to);\
@@ -5398,7 +5753,7 @@ onig_compile(regex_t* reg, const UChar* pattern, const UChar* pattern_end,
reg->num_call = 0;
#endif
- r = setup_tree(root, reg, 0, &scan_env);
+ r = setup_tree(root, reg, IN_ROOT, &scan_env);
if (r != 0) goto err_unset;
#ifdef ONIG_DEBUG_PARSE_TREE
@@ -5547,7 +5902,7 @@ onig_reg_init(regex_t* reg, OnigOptionType option,
return ONIGERR_INVALID_ARGUMENT;
if (ONIGENC_IS_UNDEF(enc))
- return ONIGERR_DEFAULT_ENCODING_IS_NOT_SETTED;
+ return ONIGERR_DEFAULT_ENCODING_IS_NOT_SET;
if ((option & (ONIG_OPTION_DONT_CAPTURE_GROUP|ONIG_OPTION_CAPTURE_GROUP))
== (ONIG_OPTION_DONT_CAPTURE_GROUP|ONIG_OPTION_CAPTURE_GROUP)) {
@@ -5772,19 +6127,26 @@ OnigOpInfoType OnigOpInfo[] = {
{ OP_NOT_WORD_BOUND, "not-word-bound", ARG_NON },
{ OP_WORD_BEGIN, "word-begin", ARG_NON },
{ OP_WORD_END, "word-end", ARG_NON },
+ { OP_ASCII_WORD, "ascii-word", ARG_NON },
+ { OP_NOT_ASCII_WORD, "not-ascii-word", ARG_NON },
+ { OP_ASCII_WORD_BOUND, "ascii-word-bound", ARG_NON },
+ { OP_NOT_ASCII_WORD_BOUND,"not-ascii-word-bound", ARG_NON },
+ { OP_ASCII_WORD_BEGIN, "ascii-word-begin", ARG_NON },
+ { OP_ASCII_WORD_END, "ascii-word-end", ARG_NON },
{ OP_BEGIN_BUF, "begin-buf", ARG_NON },
{ OP_END_BUF, "end-buf", ARG_NON },
{ OP_BEGIN_LINE, "begin-line", ARG_NON },
{ OP_END_LINE, "end-line", ARG_NON },
{ OP_SEMI_END_BUF, "semi-end-buf", ARG_NON },
{ OP_BEGIN_POSITION, "begin-position", ARG_NON },
+ { OP_BEGIN_POS_OR_LINE, "begin-pos-or-line", ARG_NON },
{ OP_BACKREF1, "backref1", ARG_NON },
{ OP_BACKREF2, "backref2", ARG_NON },
{ OP_BACKREFN, "backrefn", ARG_MEMNUM },
{ OP_BACKREFN_IC, "backrefn-ic", ARG_SPECIAL },
{ OP_BACKREF_MULTI, "backref_multi", ARG_SPECIAL },
{ OP_BACKREF_MULTI_IC, "backref_multi-ic", ARG_SPECIAL },
- { OP_BACKREF_WITH_LEVEL, "backref_at_level", ARG_SPECIAL },
+ { OP_BACKREF_WITH_LEVEL, "backref_at_level", ARG_SPECIAL },
{ OP_MEMORY_START_PUSH, "mem-start-push", ARG_MEMNUM },
{ OP_MEMORY_START, "mem-start", ARG_MEMNUM },
{ OP_MEMORY_END_PUSH, "mem-end-push", ARG_MEMNUM },
@@ -5793,6 +6155,7 @@ OnigOpInfoType OnigOpInfo[] = {
{ OP_MEMORY_END_REC, "mem-end-rec", ARG_MEMNUM },
{ OP_SET_OPTION_PUSH, "set-option-push", ARG_OPTION },
{ OP_SET_OPTION, "set-option", ARG_OPTION },
+ { OP_KEEP, "keep", ARG_NON },
{ OP_FAIL, "fail", ARG_NON },
{ OP_JUMP, "jump", ARG_RELADDR },
{ OP_PUSH, "push", ARG_RELADDR },
@@ -5820,6 +6183,7 @@ OnigOpInfoType OnigOpInfo[] = {
{ OP_FAIL_LOOK_BEHIND_NOT, "fail-look-behind-not", ARG_NON },
{ OP_CALL, "call", ARG_ABSADDR },
{ OP_RETURN, "return", ARG_NON },
+ { OP_CONDITION, "condition", ARG_SPECIAL },
{ OP_STATE_CHECK_PUSH, "state-check-push", ARG_SPECIAL },
{ OP_STATE_CHECK_PUSH_OR_JUMP, "state-check-push-or-jump", ARG_SPECIAL },
{ OP_STATE_CHECK, "state-check", ARG_STATE_CHECK },
@@ -6111,6 +6475,12 @@ onig_print_compiled_byte_code(FILE* f, UChar* bp, UChar* bpend, UChar** nextp,
fprintf(f, ":%d:(%d)", scn, addr);
break;
+ case OP_CONDITION:
+ GET_MEMNUM_INC(mem, bp);
+ GET_RELADDR_INC(addr, bp);
+ fprintf(f, ":%d:(%d)", mem, addr);
+ break;
+
default:
fprintf(stderr, "onig_print_compiled_byte_code: undefined code %d\n",
*--bp);
@@ -6127,17 +6497,15 @@ print_compiled_byte_code_list(FILE* f, regex_t* reg)
UChar* bp = reg->p;
UChar* end = reg->p + reg->used;
- fprintf(f, "code length: %d\n", reg->used);
+ fprintf(f, "code length: %d", reg->used);
ncode = -1;
while (bp < end) {
ncode++;
- if (bp > reg->p) {
- if (ncode % 5 == 0)
- fprintf(f, "\n%ld:", bp-reg->p);
- else
- fprintf(f, " %ld:", bp-reg->p);
- }
+ if (ncode % 5 == 0)
+ fprintf(f, "\n%ld:", bp - reg->p);
+ else
+ fprintf(f, " %ld:", bp - reg->p);
onig_print_compiled_byte_code(f, bp, end, &bp, reg->enc);
}
@@ -6193,7 +6561,7 @@ print_indent_tree(FILE* f, Node* node, int indent)
if (IS_NCCLASS_NOT(NCCLASS(node))) fputs(" not", f);
if (NCCLASS(node)->mbuf) {
BBuf* bbuf = NCCLASS(node)->mbuf;
- for (i = 0; i < (int)bbuf->used; i++) {
+ for (i = 0; i < (int )bbuf->used; i++) {
if (i > 0) fprintf(f, ",");
fprintf(f, "%0x", bbuf->p[i]);
}
@@ -6229,6 +6597,7 @@ print_indent_tree(FILE* f, Node* node, int indent)
case ANCHOR_END_LINE: fputs("end line", f); break;
case ANCHOR_SEMI_END_BUF: fputs("semi end buf", f); break;
case ANCHOR_BEGIN_POSITION: fputs("begin position", f); break;
+ case ANCHOR_ANYCHAR_STAR: fputs("begin position/line", f); break;
case ANCHOR_WORD_BOUND: fputs("word bound", f); break;
case ANCHOR_NOT_WORD_BOUND: fputs("not word bound", f); break;
@@ -6240,6 +6609,7 @@ print_indent_tree(FILE* f, Node* node, int indent)
case ANCHOR_PREC_READ_NOT: fputs("prec read not", f); container_p = TRUE; break;
case ANCHOR_LOOK_BEHIND: fputs("look_behind", f); container_p = TRUE; break;
case ANCHOR_LOOK_BEHIND_NOT: fputs("look_behind_not",f); container_p = TRUE; break;
+ case ANCHOR_KEEP: fputs("keep",f); break;
default:
fprintf(f, "ERROR: undefined anchor type.\n");
@@ -6281,8 +6651,7 @@ print_indent_tree(FILE* f, Node* node, int indent)
fprintf(f, "<enclose:%"PRIxPTR"> ", (intptr_t)node);
switch (NENCLOSE(node)->type) {
case ENCLOSE_OPTION:
- fprintf(f, "option:%d\n", NENCLOSE(node)->option);
- print_indent_tree(f, NENCLOSE(node)->target, indent + add);
+ fprintf(f, "option:%d", NENCLOSE(node)->option);
break;
case ENCLOSE_MEMORY:
fprintf(f, "memory:%d", NENCLOSE(node)->regnum);
@@ -6290,6 +6659,9 @@ print_indent_tree(FILE* f, Node* node, int indent)
case ENCLOSE_STOP_BACKTRACK:
fprintf(f, "stop-bt");
break;
+ case ENCLOSE_CONDITION:
+ fprintf(f, "condition:%d", NENCLOSE(node)->regnum);
+ break;
default:
break;
diff --git a/regenc.c b/regenc.c
index 70b56ef727..288eac433d 100644
--- a/regenc.c
+++ b/regenc.c
@@ -1,8 +1,9 @@
/**********************************************************************
- regenc.c - Oniguruma (regular expression library)
+ regenc.c - Onigmo (Oniguruma-mod) (regular expression library)
**********************************************************************/
/*-
* Copyright (c) 2002-2007 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
+ * Copyright (c) 2011 K.Takata <kentkt AT csc DOT jp>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -66,7 +67,7 @@ onigenc_get_right_adjust_char_head(OnigEncoding enc, const UChar* start, const U
{
UChar* p = ONIGENC_LEFT_ADJUST_CHAR_HEAD(enc, start, s, end);
if (p < s) {
- p += enclen(enc, p, end);
+ p += enclen(enc, p, end);
}
return p;
}
@@ -760,7 +761,7 @@ onigenc_mb2_code_to_mbc(OnigEncoding enc, OnigCodePoint code, UChar *buf)
if (enclen(enc, buf, p) != (p - buf))
return ONIGERR_INVALID_CODE_POINT_VALUE;
#endif
- return (int)(p - buf);
+ return (int )(p - buf);
}
extern int
@@ -783,7 +784,7 @@ onigenc_mb4_code_to_mbc(OnigEncoding enc, OnigCodePoint code, UChar *buf)
if (enclen(enc, buf, p) != (p - buf))
return ONIGERR_INVALID_CODE_POINT_VALUE;
#endif
- return (int)(p - buf);
+ return (int )(p - buf);
}
extern int
@@ -812,7 +813,7 @@ onigenc_minimum_property_name_to_ctype(OnigEncoding enc, UChar* p, UChar* end)
len = onigenc_strlen(enc, p, end);
for (pbe = (pb = PBS) + sizeof(PBS)/sizeof(PBS[0]); pb < pbe; ++pb) {
if (len == pb->len &&
- STRNCASECMP((char *)p, (char *)pb->name, len) == 0)
+ onigenc_with_ascii_strnicmp(enc, p, end, pb->name, pb->len) == 0)
return pb->ctype;
}
@@ -868,6 +869,27 @@ onigenc_with_ascii_strncmp(OnigEncoding enc, const UChar* p, const UChar* end,
return 0;
}
+extern int
+onigenc_with_ascii_strnicmp(OnigEncoding enc, const UChar* p, const UChar* end,
+ const UChar* sascii /* ascii */, int n)
+{
+ int x, c;
+
+ while (n-- > 0) {
+ if (p >= end) return (int )(*sascii);
+
+ c = (int )ONIGENC_MBC_TO_CODE(enc, p, end);
+ if (ONIGENC_IS_ASCII_CODE(c))
+ c = ONIGENC_ASCII_CODE_TO_LOWER_CASE(c);
+ x = ONIGENC_ASCII_CODE_TO_LOWER_CASE(*sascii) - c;
+ if (x) return x;
+
+ sascii++;
+ p += enclen(enc, p, end);
+ }
+ return 0;
+}
+
/* Property management */
static int
resize_property_list(int new_size, const OnigCodePoint*** plist, int* psize)
diff --git a/regenc.h b/regenc.h
index 16fe9db813..04a5e70db3 100644
--- a/regenc.h
+++ b/regenc.h
@@ -1,10 +1,11 @@
#ifndef ONIGURUMA_REGENC_H
#define ONIGURUMA_REGENC_H
/**********************************************************************
- regenc.h - Oniguruma (regular expression library)
+ regenc.h - Onigmo (Oniguruma-mod) (regular expression library)
**********************************************************************/
/*-
* Copyright (c) 2002-2008 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
+ * Copyright (c) 2011 K.Takata <kentkt AT csc DOT jp>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -39,9 +40,7 @@
#endif
#include "ruby/oniguruma.h"
-#if defined __GNUC__ && __GNUC__ >= 4
-#pragma GCC visibility push(default)
-#endif
+RUBY_SYMBOL_EXPORT_BEGIN
typedef struct {
OnigCodePoint from;
@@ -107,10 +106,10 @@ typedef struct {
#define PosixBracketEntryInit(name, ctype) {(const UChar *)name, ctype, (short int)(sizeof(name) - 1)}
-/* #define USE_CRNL_AS_LINE_TERMINATOR */
+#define USE_CRNL_AS_LINE_TERMINATOR
#define USE_UNICODE_PROPERTIES
/* #define USE_UNICODE_CASE_FOLD_TURKISH_AZERI */
-/* #define USE_UNICODE_ALL_LINE_TERMINATORS */ /* see Unicode.org UTF#18 */
+/* #define USE_UNICODE_ALL_LINE_TERMINATORS */ /* see Unicode.org UTS #18 */
#define ONIG_ENCODING_INIT_DEFAULT ONIG_ENCODING_ASCII
@@ -170,6 +169,8 @@ ONIG_EXTERN const UChar OnigEncISO_8859_1_ToUpperCaseTable[];
ONIG_EXTERN int
onigenc_with_ascii_strncmp P_((OnigEncoding enc, const UChar* p, const UChar* end, const UChar* sascii /* ascii */, int n));
+ONIG_EXTERN int
+onigenc_with_ascii_strnicmp P_((OnigEncoding enc, const UChar* p, const UChar* end, const UChar* sascii /* ascii */, int n));
ONIG_EXTERN UChar*
onigenc_step P_((OnigEncoding enc, const UChar* p, const UChar* end, int n));
@@ -190,6 +191,11 @@ ONIG_EXTERN const unsigned short OnigEncAsciiCtypeTable[];
(ONIGENC_IS_ASCII_CODE_CTYPE(code, ONIGENC_CTYPE_UPPER) ||\
ONIGENC_IS_ASCII_CODE_CTYPE(code, ONIGENC_CTYPE_LOWER))
+/* Check if the code is in the range. (from <= code && code <= to) */
+#define ONIGENC_IS_IN_RANGE(code, from, to) \
+ ((OnigCodePoint )((code) - (from)) <= (OnigCodePoint )((to) - (from)))
+
+
#ifdef ONIG_ENC_REGISTER
extern int ONIG_ENC_REGISTER(const char *, OnigEncodingType*);
#define OnigEncodingName(n) encoding_##n
@@ -212,8 +218,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 3c8b7371c2..9c94d23018 100644
--- a/regerror.c
+++ b/regerror.c
@@ -1,8 +1,9 @@
/**********************************************************************
- regerror.c - Oniguruma (regular expression library)
+ regerror.c - Onigmo (Oniguruma-mod) (regular expression library)
**********************************************************************/
/*-
* Copyright (c) 2002-2007 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
+ * Copyright (c) 2011 K.Takata <kentkt AT csc DOT jp>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -39,7 +40,7 @@
#endif
extern UChar*
-onig_error_code_to_format(int code)
+onig_error_code_to_format(OnigPosition code)
{
const char *p;
@@ -64,8 +65,8 @@ onig_error_code_to_format(int code)
p = "undefined bytecode (bug)"; break;
case ONIGERR_UNEXPECTED_BYTECODE:
p = "unexpected bytecode (bug)"; break;
- case ONIGERR_DEFAULT_ENCODING_IS_NOT_SETTED:
- p = "default multibyte-encoding is not setted"; 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:
p = "can't convert to wide-char on specified multibyte-encoding"; break;
case ONIGERR_INVALID_ARGUMENT:
@@ -114,6 +115,8 @@ onig_error_code_to_format(int code)
p = "invalid pattern in look-behind"; break;
case ONIGERR_INVALID_REPEAT_RANGE_PATTERN:
p = "invalid repeat range {lower,upper}"; break;
+ case ONIGERR_INVALID_CONDITION_PATTERN:
+ p = "invalid conditional pattern"; break;
case ONIGERR_TOO_BIG_NUMBER:
p = "too big number"; break;
case ONIGERR_TOO_BIG_NUMBER_FOR_REPEAT_RANGE:
@@ -140,6 +143,8 @@ onig_error_code_to_format(int code)
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:
@@ -232,7 +237,7 @@ static int to_ascii(OnigEncoding enc, UChar *s, UChar *end,
*is_over = ((p < end) ? 1 : 0);
}
else {
- len = (int)MIN((end - s), buf_size);
+ len = (int )MIN((end - s), buf_size);
xmemcpy(buf, s, (size_t )len);
*is_over = ((buf_size < (end - s)) ? 1 : 0);
}
@@ -246,11 +251,11 @@ static int to_ascii(OnigEncoding enc, UChar *s, UChar *end,
extern int
#ifdef HAVE_STDARG_PROTOTYPES
-onig_error_code_to_str(UChar* s, int code, ...)
+onig_error_code_to_str(UChar* s, OnigPosition code, ...)
#else
onig_error_code_to_str(s, code, va_alist)
UChar* s;
- int code;
+ OnigPosition code;
va_dcl
#endif
{
@@ -309,7 +314,7 @@ onig_error_code_to_str(s, code, va_alist)
}
va_end(vargs);
- return (int)len;
+ return (int )len;
}
void
@@ -325,7 +330,7 @@ onig_vsnprintf_with_pattern(UChar buf[], int bufsize, OnigEncoding enc,
need = (pat_end - pat) * 4 + 4;
- if (n + need < (size_t)bufsize) {
+ if (n + need < (size_t )bufsize) {
strcat((char* )buf, ": /");
s = buf + onigenc_str_bytelen_null(ONIG_ENCODING_ASCII, buf);
diff --git a/regexec.c b/regexec.c
index 33b4a4efa6..997849695e 100644
--- a/regexec.c
+++ b/regexec.c
@@ -1,8 +1,9 @@
/**********************************************************************
- regexec.c - Oniguruma (regular expression library)
+ regexec.c - Onigmo (Oniguruma-mod) (regular expression library)
**********************************************************************/
/*-
* Copyright (c) 2002-2008 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
+ * Copyright (c) 2011-2013 K.Takata <kentkt AT csc DOT jp>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -34,8 +35,44 @@
#ifdef USE_CRNL_AS_LINE_TERMINATOR
#define ONIGENC_IS_MBC_CRNL(enc,p,end) \
(ONIGENC_MBC_TO_CODE(enc,p,end) == 13 && \
- ONIGENC_IS_MBC_NEWLINE(enc,(p+enclen(enc,p)),end))
-#endif
+ ONIGENC_MBC_TO_CODE(enc,(p+enclen(enc,p,end)),end) == 10)
+#define ONIGENC_IS_MBC_NEWLINE_EX(enc,p,start,end,option,check_prev) \
+ is_mbc_newline_ex((enc),(p),(start),(end),(option),(check_prev))
+static int
+is_mbc_newline_ex(OnigEncoding enc, const UChar *p, const UChar *start,
+ const UChar *end, OnigOptionType option, int check_prev)
+{
+ if (IS_NEWLINE_CRLF(option)) {
+ if (ONIGENC_MBC_TO_CODE(enc, p, end) == 0x0a) {
+ if (check_prev) {
+ const UChar *prev = onigenc_get_prev_char_head(enc, start, p, end);
+ if ((prev != NULL) && ONIGENC_MBC_TO_CODE(enc, prev, end) == 0x0d)
+ return 0;
+ else
+ return 1;
+ }
+ else
+ return 1;
+ }
+ else {
+ const UChar *pnext = p + enclen(enc, p, end);
+ if (pnext < end &&
+ ONIGENC_MBC_TO_CODE(enc, p, end) == 0x0d &&
+ ONIGENC_MBC_TO_CODE(enc, pnext, end) == 0x0a)
+ return 1;
+ if (ONIGENC_IS_MBC_NEWLINE(enc, p, end))
+ return 1;
+ return 0;
+ }
+ }
+ else {
+ return ONIGENC_IS_MBC_NEWLINE(enc, p, end);
+ }
+}
+#else /* USE_CRNL_AS_LINE_TERMINATOR */
+#define ONIGENC_IS_MBC_NEWLINE_EX(enc,p,start,end,option,check_prev) \
+ ONIGENC_IS_MBC_NEWLINE((enc), (p), (end))
+#endif /* USE_CRNL_AS_LINE_TERMINATOR */
#ifdef USE_CAPTURE_HISTORY
static void history_tree_free(OnigCaptureTreeNode* node);
@@ -58,6 +95,8 @@ history_tree_clear(OnigCaptureTreeNode* node)
node->beg = ONIG_REGION_NOTPOS;
node->end = ONIG_REGION_NOTPOS;
node->group = -1;
+ xfree(node->childs);
+ node->childs = (OnigCaptureTreeNode** )0;
}
}
@@ -106,14 +145,20 @@ history_tree_add_child(OnigCaptureTreeNode* parent, OnigCaptureTreeNode* child)
n = HISTORY_TREE_INIT_ALLOC_SIZE;
parent->childs =
(OnigCaptureTreeNode** )xmalloc(sizeof(OnigCaptureTreeNode*) * n);
+ CHECK_NULL_RETURN_MEMERR(parent->childs);
}
else {
+ OnigCaptureTreeNode** tmp;
n = parent->allocated * 2;
- parent->childs =
+ tmp =
(OnigCaptureTreeNode** )xrealloc(parent->childs,
sizeof(OnigCaptureTreeNode*) * n);
+ if (tmp == 0) {
+ history_tree_clear(parent);
+ return ONIGERR_MEMORY;
+ }
+ parent->childs = tmp;
}
- CHECK_NULL_RETURN_MEMERR(parent->childs);
for (i = parent->allocated; i < n; i++) {
parent->childs[i] = (OnigCaptureTreeNode* )0;
}
@@ -128,7 +173,7 @@ history_tree_add_child(OnigCaptureTreeNode* parent, OnigCaptureTreeNode* child)
static OnigCaptureTreeNode*
history_tree_clone(OnigCaptureTreeNode* node)
{
- int i;
+ int i, r;
OnigCaptureTreeNode *clone, *child;
clone = history_node_new();
@@ -142,7 +187,12 @@ history_tree_clone(OnigCaptureTreeNode* node)
history_tree_free(clone);
return (OnigCaptureTreeNode* )0;
}
- history_tree_add_child(clone, child);
+ r = history_tree_add_child(clone, child);
+ if (r != 0) {
+ history_tree_free(child);
+ history_tree_free(clone);
+ return (OnigCaptureTreeNode* )0;
+ }
}
return clone;
@@ -177,11 +227,11 @@ onig_region_resize(OnigRegion* region, int n)
n = ONIG_NREGION;
if (region->allocated == 0) {
- region->beg = (int* )xmalloc(n * sizeof(int));
+ region->beg = (OnigPosition* )xmalloc(n * sizeof(OnigPosition));
if (region->beg == 0)
return ONIGERR_MEMORY;
- region->end = (int* )xmalloc(n * sizeof(int));
+ region->end = (OnigPosition* )xmalloc(n * sizeof(OnigPosition));
if (region->end == 0) {
xfree(region->beg);
return ONIGERR_MEMORY;
@@ -190,26 +240,24 @@ onig_region_resize(OnigRegion* region, int n)
region->allocated = n;
}
else if (region->allocated < n) {
- int *tmp;
+ OnigPosition *tmp;
region->allocated = 0;
- tmp = (int* )xrealloc(region->beg, n * sizeof(int));
+ tmp = (OnigPosition* )xrealloc(region->beg, n * sizeof(OnigPosition));
if (tmp == 0) {
xfree(region->beg);
xfree(region->end);
return ONIGERR_MEMORY;
}
region->beg = tmp;
- tmp = (int* )xrealloc(region->end, n * sizeof(int));
+ tmp = (OnigPosition* )xrealloc(region->end, n * sizeof(OnigPosition));
if (tmp == 0) {
xfree(region->beg);
+ xfree(region->end);
return ONIGERR_MEMORY;
}
region->end = tmp;
- if (region->beg == 0 || region->end == 0)
- return ONIGERR_MEMORY;
-
region->allocated = n;
}
@@ -247,8 +295,8 @@ onig_region_init(OnigRegion* region)
{
region->num_regs = 0;
region->allocated = 0;
- region->beg = (int* )0;
- region->end = (int* )0;
+ region->beg = (OnigPosition* )0;
+ region->end = (OnigPosition* )0;
region->history_root = (OnigCaptureTreeNode* )0;
}
@@ -283,11 +331,13 @@ extern void
onig_region_copy(OnigRegion* to, OnigRegion* from)
{
#define RREGC_SIZE (sizeof(int) * from->num_regs)
- int i;
+ int i, r;
if (to == from) return;
- onig_region_resize(to, from->num_regs);
+ r = onig_region_resize(to, from->num_regs);
+ if (r) return;
+
for (i = 0; i < from->num_regs; i++) {
to->beg[i] = from->beg[i];
to->end[i] = from->end[i];
@@ -334,19 +384,21 @@ onig_region_copy(OnigRegion* to, OnigRegion* from)
#define STK_MASK_MEM_END_OR_MARK 0x8000 /* MEM_END or MEM_END_MARK */
#ifdef USE_FIND_LONGEST_SEARCH_ALL_OF_RANGE
-#define MATCH_ARG_INIT(msa, arg_option, arg_region, arg_start) do {\
+#define MATCH_ARG_INIT(msa, arg_option, arg_region, arg_start, arg_gpos) do {\
(msa).stack_p = (void* )0;\
(msa).options = (arg_option);\
(msa).region = (arg_region);\
(msa).start = (arg_start);\
+ (msa).gpos = (arg_gpos);\
(msa).best_len = ONIG_MISMATCH;\
} while(0)
#else
-#define MATCH_ARG_INIT(msa, arg_option, arg_region, arg_start) do {\
+#define MATCH_ARG_INIT(msa, arg_option, arg_region, arg_start, arg_gpos) do {\
(msa).stack_p = (void* )0;\
(msa).options = (arg_option);\
(msa).region = (arg_region);\
(msa).start = (arg_start);\
+ (msa).gpos = (arg_gpos);\
} while(0)
#endif
@@ -386,24 +438,24 @@ onig_region_copy(OnigRegion* to, OnigRegion* from)
if ((msa).state_check_buff) xfree((msa).state_check_buff);\
}\
} while(0)
-#else
+#else /* USE_COMBINATION_EXPLOSION_CHECK */
#define MATCH_ARG_FREE(msa) if ((msa).stack_p) xfree((msa).stack_p)
-#endif
+#endif /* USE_COMBINATION_EXPLOSION_CHECK */
#define STACK_INIT(alloc_addr, ptr_num, stack_num) do {\
if (msa->stack_p) {\
- alloc_addr = (char* )xalloca(sizeof(char*) * (ptr_num));\
+ alloc_addr = (char* )xalloca(sizeof(OnigStackIndex) * (ptr_num));\
stk_alloc = (OnigStackType* )(msa->stack_p);\
stk_base = stk_alloc;\
stk = stk_base;\
stk_end = stk_base + msa->stack_n;\
}\
else {\
- alloc_addr = (char* )xalloca(sizeof(char*) * (ptr_num)\
+ alloc_addr = (char* )xalloca(sizeof(OnigStackIndex) * (ptr_num)\
+ sizeof(OnigStackType) * (stack_num));\
- stk_alloc = (OnigStackType* )(alloc_addr + sizeof(char*) * (ptr_num));\
+ stk_alloc = (OnigStackType* )(alloc_addr + sizeof(OnigStackIndex) * (ptr_num));\
stk_base = stk_alloc;\
stk = stk_base;\
stk_end = stk_base + (stack_num);\
@@ -510,13 +562,14 @@ stack_double(OnigStackType** arg_stk_base, OnigStackType** arg_stk_end,
state_check_buff[x/8] |= (1<<(x%8)); \
}
-#define STACK_PUSH(stack_type,pat,s,sprev) do {\
+#define STACK_PUSH(stack_type,pat,s,sprev,keep) do {\
STACK_ENSURE(1);\
stk->type = (stack_type);\
stk->u.state.pcode = (pat);\
stk->u.state.pstr = (s);\
stk->u.state.pstr_prev = (sprev);\
stk->u.state.state_check = 0;\
+ stk->u.state.pkeep = (keep);\
STACK_INC;\
} while(0)
@@ -527,13 +580,14 @@ stack_double(OnigStackType** arg_stk_base, OnigStackType** arg_stk_end,
STACK_INC;\
} while(0)
-#define STACK_PUSH_ALT_WITH_STATE_CHECK(pat,s,sprev,snum) do {\
+#define STACK_PUSH_ALT_WITH_STATE_CHECK(pat,s,sprev,snum,keep) do {\
STACK_ENSURE(1);\
stk->type = STK_ALT;\
stk->u.state.pcode = (pat);\
stk->u.state.pstr = (s);\
stk->u.state.pstr_prev = (sprev);\
stk->u.state.state_check = ((state_check_buff != NULL) ? (snum) : 0);\
+ stk->u.state.pkeep = (keep);\
STACK_INC;\
} while(0)
@@ -551,12 +605,13 @@ stack_double(OnigStackType** arg_stk_base, OnigStackType** arg_stk_end,
#define ELSE_IF_STATE_CHECK_MARK(stk)
-#define STACK_PUSH(stack_type,pat,s,sprev) do {\
+#define STACK_PUSH(stack_type,pat,s,sprev,keep) do {\
STACK_ENSURE(1);\
stk->type = (stack_type);\
stk->u.state.pcode = (pat);\
stk->u.state.pstr = (s);\
stk->u.state.pstr_prev = (sprev);\
+ stk->u.state.pkeep = (keep);\
STACK_INC;\
} while(0)
@@ -567,12 +622,12 @@ stack_double(OnigStackType** arg_stk_base, OnigStackType** arg_stk_end,
} while(0)
#endif /* USE_COMBINATION_EXPLOSION_CHECK */
-#define STACK_PUSH_ALT(pat,s,sprev) STACK_PUSH(STK_ALT,pat,s,sprev)
-#define STACK_PUSH_POS(s,sprev) STACK_PUSH(STK_POS,NULL_UCHARP,s,sprev)
-#define STACK_PUSH_POS_NOT(pat,s,sprev) STACK_PUSH(STK_POS_NOT,pat,s,sprev)
+#define STACK_PUSH_ALT(pat,s,sprev,keep) STACK_PUSH(STK_ALT,pat,s,sprev,keep)
+#define STACK_PUSH_POS(s,sprev,keep) STACK_PUSH(STK_POS,NULL_UCHARP,s,sprev,keep)
+#define STACK_PUSH_POS_NOT(pat,s,sprev,keep) STACK_PUSH(STK_POS_NOT,pat,s,sprev,keep)
#define STACK_PUSH_STOP_BT STACK_PUSH_TYPE(STK_STOP_BT)
-#define STACK_PUSH_LOOK_BEHIND_NOT(pat,s,sprev) \
- STACK_PUSH(STK_LOOK_BEHIND_NOT,pat,s,sprev)
+#define STACK_PUSH_LOOK_BEHIND_NOT(pat,s,sprev,keep) \
+ STACK_PUSH(STK_LOOK_BEHIND_NOT,pat,s,sprev,keep)
#define STACK_PUSH_REPEAT(id, pat) do {\
STACK_ENSURE(1);\
@@ -879,7 +934,7 @@ stack_double(OnigStackType** arg_stk_base, OnigStackType** arg_stk_end,
}\
k++;\
}\
- break;\
+ break;\
}\
}\
}\
@@ -920,7 +975,7 @@ stack_double(OnigStackType** arg_stk_base, OnigStackType** arg_stk_end,
}\
k++;\
}\
- break;\
+ break;\
}\
}\
else {\
@@ -983,7 +1038,7 @@ stack_double(OnigStackType** arg_stk_base, OnigStackType** arg_stk_end,
} while(0)
static int string_cmp_ic(OnigEncoding enc, int case_fold_flag,
- UChar* s1, UChar** ps2, int mblen, const UChar* text_end)
+ UChar* s1, UChar** ps2, OnigDistance mblen, const UChar* text_end)
{
UChar buf1[ONIGENC_MBC_CASE_FOLD_MAXLEN];
UChar buf2[ONIGENC_MBC_CASE_FOLD_MAXLEN];
@@ -1057,20 +1112,23 @@ make_capture_history_tree(OnigCaptureTreeNode* node, OnigStackType** kp,
child = history_node_new();
CHECK_NULL_RETURN_MEMERR(child);
child->group = n;
- child->beg = (int )(k->u.mem.pstr - str);
+ child->beg = k->u.mem.pstr - str;
r = history_tree_add_child(node, child);
- if (r != 0) return r;
+ if (r != 0) {
+ history_tree_free(child);
+ return r;
+ }
*kp = (k + 1);
r = make_capture_history_tree(child, kp, stk_top, str, reg);
if (r != 0) return r;
k = *kp;
- child->end = (int )(k->u.mem.pstr - str);
+ child->end = k->u.mem.pstr - str;
}
}
else if (k->type == STK_MEM_END) {
if (k->u.mem.num == node->group) {
- node->end = (int )(k->u.mem.pstr - str);
+ node->end = k->u.mem.pstr - str;
*kp = k;
return 0;
}
@@ -1080,7 +1138,7 @@ make_capture_history_tree(OnigCaptureTreeNode* node, OnigStackType** kp,
return 1; /* 1: root node ending. */
}
-#endif
+#endif /* USE_CAPTURE_HISTORY */
#ifdef USE_BACKREF_WITH_LEVEL
static int mem_is_in_memp(int mem, int num, UChar* memp)
@@ -1125,7 +1183,7 @@ static int backref_match_at_nested_level(regex_t* reg
if (ignore_case != 0) {
if (string_cmp_ic(reg->enc, case_fold_flag,
- pstart, &ss, (int )(pend - pstart), send) == 0)
+ pstart, &ss, pend - pstart, send) == 0)
return 0; /* or goto next_mem; */
}
else {
@@ -1168,14 +1226,14 @@ static struct timeval ts, te;
#define GETTIME(t) gettimeofday(&(t), (struct timezone* )0)
#define TIMEDIFF(te,ts) (((te).tv_usec - (ts).tv_usec) + \
(((te).tv_sec - (ts).tv_sec)*1000000))
-#else
+#else /* USE_TIMEOFDAY */
#ifdef HAVE_SYS_TIMES_H
#include <sys/times.h>
#endif
static struct tms ts, te;
#define GETTIME(t) times(&(t))
#define TIMEDIFF(te,ts) ((te).tms_utime - (ts).tms_utime)
-#endif
+#endif /* USE_TIMEOFDAY */
static int OpCounter[256];
static int OpPrevCounter[256];
@@ -1224,12 +1282,13 @@ onig_print_statistics(FILE* f)
MaxStackDepth = stk - stk_base;\
} while(0)
-#else
+#else /* ONIG_DEBUG_STATISTICS */
#define STACK_INC stk++
#define MOP_IN(opcode)
#define MOP_OUT
-#endif
+#endif /* ONIG_DEBUG_STATISTICS */
+
/* matching region of POSIX API */
@@ -1245,7 +1304,7 @@ void onig_print_compiled_byte_code(FILE* f, UChar* bp, UChar* bpend, UChar** nex
/* match data(str - end) from position (sstart). */
/* if sstart == str then set sprev to NULL. */
-static long
+static OnigPosition
match_at(regex_t* reg, const UChar* str, const UChar* end,
#ifdef USE_MATCH_RANGE_MUST_BE_INSIDE_OF_SPECIFIED_RANGE
const UChar* right_range,
@@ -1254,8 +1313,8 @@ match_at(regex_t* reg, const UChar* str, const UChar* end,
{
static const UChar FinishCode[] = { OP_FINISH };
- int i, num_mem, best_len, pop_level;
- ptrdiff_t n;
+ int i, num_mem, pop_level;
+ ptrdiff_t n, best_len;
LengthType tlen, tlen2;
MemNumType mem;
RelAddrType addr;
@@ -1264,6 +1323,7 @@ match_at(regex_t* reg, const UChar* str, const UChar* end,
OnigCaseFoldType case_fold_flag = reg->case_fold_flag;
UChar *s, *q, *sbegin;
UChar *p = reg->p;
+ UChar *pkeep;
char *alloca_base;
OnigStackType *stk_alloc, *stk_base, *stk, *stk_end;
OnigStackType *stkp; /* used as any purpose. */
@@ -1275,6 +1335,23 @@ match_at(regex_t* reg, const UChar* str, const UChar* end,
unsigned char* state_check_buff = msa->state_check_buff;
int num_comb_exp_check = reg->num_comb_exp_check;
#endif
+
+#ifdef USE_SUBEXP_CALL
+ /* Stack #0 is used to store the pattern itself and used for (?R), \g<0>, etc. */
+ n = reg->num_repeat + (reg->num_mem + 1) * 2;
+
+ STACK_INIT(alloca_base, n, INIT_MATCH_STACK_SIZE);
+ pop_level = reg->stack_pop_level;
+ num_mem = reg->num_mem;
+ repeat_stk = (OnigStackIndex* )alloca_base;
+
+ mem_start_stk = (OnigStackIndex* )(repeat_stk + reg->num_repeat);
+ mem_end_stk = mem_start_stk + (num_mem + 1);
+ for (i = 0; i <= num_mem; i++) {
+ mem_start_stk[i] = mem_end_stk[i] = INVALID_STACK_INDEX;
+ }
+#else /* USE_SUBEXP_CALL */
+ /* Stack #0 not is used. */
n = reg->num_repeat + reg->num_mem * 2;
STACK_INIT(alloca_base, n, INIT_MATCH_STACK_SIZE);
@@ -1291,10 +1368,11 @@ match_at(regex_t* reg, const UChar* str, const UChar* end,
for (i = 1; i <= num_mem; i++) {
mem_start_stk[i] = mem_end_stk[i] = INVALID_STACK_INDEX;
}
+#endif /* USE_SUBEXP_CALL */
#ifdef ONIG_DEBUG_MATCH
- fprintf(stderr, "match_at: str: %"PRIdPTR", end: %"PRIdPTR", start: %"PRIdPTR", sprev: %"PRIdPTR"\n",
- (intptr_t)str, (intptr_t)end, (intptr_t)sstart, (intptr_t)sprev);
+ 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);
fprintf(stderr, "size: %d, start offset: %d\n",
(int )(end - str), (int )(sstart - str));
#endif
@@ -1302,6 +1380,7 @@ match_at(regex_t* reg, const UChar* str, const UChar* end,
STACK_PUSH_ENSURED(STK_ALT, (UChar *)FinishCode); /* bottom stack */
best_len = ONIG_MISMATCH;
s = (UChar* )sstart;
+ pkeep = (UChar* )sstart;
while (1) {
#ifdef ONIG_DEBUG_MATCH
if (s) {
@@ -1309,9 +1388,11 @@ match_at(regex_t* reg, const UChar* str, const UChar* end,
int len;
fprintf(stderr, "%4d> \"", (int )(s - str));
bp = buf;
- for (i = 0, q = s; i < 7 && q < end; i++) {
- len = enclen(encode, q, end);
- while (len-- > 0) *bp++ = *q++;
+ if (*p != OP_FINISH) { /* s may not be a valid pointer if OP_FINISH. */
+ for (i = 0, q = s; i < 7 && q < end; i++) {
+ len = enclen(encode, q, end);
+ while (len-- > 0) *bp++ = *q++;
+ }
}
if (q < end) { xmemcpy(bp, "...\"", 4); bp += 4; }
else { xmemcpy(bp, "\"", 1); bp += 1; }
@@ -1332,32 +1413,32 @@ match_at(regex_t* reg, const UChar* str, const UChar* end,
#ifdef USE_FIND_LONGEST_SEARCH_ALL_OF_RANGE
if (IS_FIND_LONGEST(option)) {
if (n > msa->best_len) {
- msa->best_len = (int)n;
+ msa->best_len = n;
msa->best_s = (UChar* )sstart;
}
else
goto end_best_len;
}
#endif
- best_len = (int)n;
+ best_len = n;
region = msa->region;
if (region) {
#ifdef USE_POSIX_API_REGION_OPTION
if (IS_POSIX_REGION(msa->options)) {
posix_regmatch_t* rmt = (posix_regmatch_t* )region;
- rmt[0].rm_so = sstart - str;
- rmt[0].rm_eo = s - str;
+ rmt[0].rm_so = (regoff_t )(((pkeep > s) ? s : pkeep) - str);
+ rmt[0].rm_eo = (regoff_t )(s - str);
for (i = 1; i <= num_mem; i++) {
if (mem_end_stk[i] != INVALID_STACK_INDEX) {
if (BIT_STATUS_AT(reg->bt_mem_start, i))
- rmt[i].rm_so = STACK_AT(mem_start_stk[i])->u.mem.pstr - str;
+ rmt[i].rm_so = (regoff_t )(STACK_AT(mem_start_stk[i])->u.mem.pstr - str);
else
- rmt[i].rm_so = (UChar* )((void* )(mem_start_stk[i])) - str;
+ rmt[i].rm_so = (regoff_t )((UChar* )((void* )(mem_start_stk[i])) - str);
- rmt[i].rm_eo = (BIT_STATUS_AT(reg->bt_mem_end, i)
+ rmt[i].rm_eo = (regoff_t )((BIT_STATUS_AT(reg->bt_mem_end, i)
? STACK_AT(mem_end_stk[i])->u.mem.pstr
- : (UChar* )((void* )mem_end_stk[i])) - str;
+ : (UChar* )((void* )mem_end_stk[i])) - str);
}
else {
rmt[i].rm_so = rmt[i].rm_eo = ONIG_REGION_NOTPOS;
@@ -1366,16 +1447,18 @@ match_at(regex_t* reg, const UChar* str, const UChar* end,
}
else {
#endif /* USE_POSIX_API_REGION_OPTION */
- region->beg[0] = (int)(sstart - str);
- region->end[0] = (int)(s - str);
+ region->beg[0] = ((pkeep > s) ? s : pkeep) - str;
+ region->end[0] = s - str;
for (i = 1; i <= num_mem; i++) {
if (mem_end_stk[i] != INVALID_STACK_INDEX) {
- region->beg[i] = (int)((BIT_STATUS_AT(reg->bt_mem_start, i))
- ? STACK_AT(mem_start_stk[i])->u.mem.pstr - str
- : (UChar* )((void* )mem_start_stk[i]) - str);
- region->end[i] = (int)(BIT_STATUS_AT(reg->bt_mem_end, i)
- ? STACK_AT(mem_end_stk[i])->u.mem.pstr - str
- : (UChar* )((void* )mem_end_stk[i]) - str);
+ if (BIT_STATUS_AT(reg->bt_mem_start, i))
+ region->beg[i] = STACK_AT(mem_start_stk[i])->u.mem.pstr - str;
+ else
+ region->beg[i] = (UChar* )((void* )mem_start_stk[i]) - str;
+
+ region->end[i] = (BIT_STATUS_AT(reg->bt_mem_end, i)
+ ? STACK_AT(mem_end_stk[i])->u.mem.pstr
+ : (UChar* )((void* )mem_end_stk[i])) - str;
}
else {
region->beg[i] = region->end[i] = ONIG_REGION_NOTPOS;
@@ -1397,8 +1480,8 @@ match_at(regex_t* reg, const UChar* str, const UChar* end,
}
node->group = 0;
- node->beg = sstart - str;
- node->end = s - str;
+ node->beg = ((pkeep > s) ? s : pkeep) - str;
+ node->end = s - str;
stkp = stk_base;
r = make_capture_history_tree(region->history_root, &stkp,
@@ -1795,7 +1878,7 @@ match_at(regex_t* reg, const UChar* str, const UChar* end,
DATA_ENSURE(1);
n = enclen(encode, s, end);
DATA_ENSURE(n);
- if (ONIGENC_IS_MBC_NEWLINE(encode, s, end)) goto fail;
+ if (ONIGENC_IS_MBC_NEWLINE_EX(encode, s, str, end, option, 0)) goto fail;
s += n;
MOP_OUT;
break;
@@ -1810,10 +1893,10 @@ match_at(regex_t* reg, const UChar* str, const UChar* end,
case OP_ANYCHAR_STAR: MOP_IN(OP_ANYCHAR_STAR);
while (DATA_ENSURE_CHECK1) {
- STACK_PUSH_ALT(p, s, sprev);
+ STACK_PUSH_ALT(p, s, sprev, pkeep);
n = enclen(encode, s, end);
DATA_ENSURE(n);
- if (ONIGENC_IS_MBC_NEWLINE(encode, s, end)) goto fail;
+ if (ONIGENC_IS_MBC_NEWLINE_EX(encode, s, str, end, option, 0)) goto fail;
sprev = s;
s += n;
}
@@ -1822,7 +1905,7 @@ match_at(regex_t* reg, const UChar* str, const UChar* end,
case OP_ANYCHAR_ML_STAR: MOP_IN(OP_ANYCHAR_ML_STAR);
while (DATA_ENSURE_CHECK1) {
- STACK_PUSH_ALT(p, s, sprev);
+ STACK_PUSH_ALT(p, s, sprev, pkeep);
n = enclen(encode, s, end);
if (n > 1) {
DATA_ENSURE(n);
@@ -1840,11 +1923,11 @@ match_at(regex_t* reg, const UChar* str, const UChar* end,
case OP_ANYCHAR_STAR_PEEK_NEXT: MOP_IN(OP_ANYCHAR_STAR_PEEK_NEXT);
while (DATA_ENSURE_CHECK1) {
if (*p == *s) {
- STACK_PUSH_ALT(p + 1, s, sprev);
+ STACK_PUSH_ALT(p + 1, s, sprev, pkeep);
}
n = enclen(encode, s, end);
DATA_ENSURE(n);
- if (ONIGENC_IS_MBC_NEWLINE(encode, s, end)) goto fail;
+ if (ONIGENC_IS_MBC_NEWLINE_EX(encode, s, str, end, option, 0)) goto fail;
sprev = s;
s += n;
}
@@ -1855,7 +1938,7 @@ match_at(regex_t* reg, const UChar* str, const UChar* end,
case OP_ANYCHAR_ML_STAR_PEEK_NEXT:MOP_IN(OP_ANYCHAR_ML_STAR_PEEK_NEXT);
while (DATA_ENSURE_CHECK1) {
if (*p == *s) {
- STACK_PUSH_ALT(p + 1, s, sprev);
+ STACK_PUSH_ALT(p + 1, s, sprev, pkeep);
}
n = enclen(encode, s, end);
if (n > 1) {
@@ -1879,10 +1962,10 @@ match_at(regex_t* reg, const UChar* str, const UChar* end,
STATE_CHECK_VAL(scv, mem);
if (scv) goto fail;
- STACK_PUSH_ALT_WITH_STATE_CHECK(p, s, sprev, mem);
+ STACK_PUSH_ALT_WITH_STATE_CHECK(p, s, sprev, mem, pkeep);
n = enclen(encode, s, end);
DATA_ENSURE(n);
- if (ONIGENC_IS_MBC_NEWLINE(encode, s, end)) goto fail;
+ if (ONIGENC_IS_MBC_NEWLINE_EX(encode, s, str, end, option, 0)) goto fail;
sprev = s;
s += n;
}
@@ -1897,7 +1980,7 @@ match_at(regex_t* reg, const UChar* str, const UChar* end,
STATE_CHECK_VAL(scv, mem);
if (scv) goto fail;
- STACK_PUSH_ALT_WITH_STATE_CHECK(p, s, sprev, mem);
+ STACK_PUSH_ALT_WITH_STATE_CHECK(p, s, sprev, mem, pkeep);
n = enclen(encode, s, end);
if (n > 1) {
DATA_ENSURE(n);
@@ -1922,6 +2005,15 @@ match_at(regex_t* reg, const UChar* str, const UChar* end,
MOP_OUT;
break;
+ case OP_ASCII_WORD: MOP_IN(OP_ASCII_WORD);
+ DATA_ENSURE(1);
+ if (! ONIGENC_IS_MBC_ASCII_WORD(encode, s, end))
+ goto fail;
+
+ s += enclen(encode, s, end);
+ MOP_OUT;
+ break;
+
case OP_NOT_WORD: MOP_IN(OP_NOT_WORD);
DATA_ENSURE(1);
if (ONIGENC_IS_MBC_WORD(encode, s, end))
@@ -1931,6 +2023,15 @@ match_at(regex_t* reg, const UChar* str, const UChar* end,
MOP_OUT;
break;
+ case OP_NOT_ASCII_WORD: MOP_IN(OP_NOT_ASCII_WORD);
+ DATA_ENSURE(1);
+ if (ONIGENC_IS_MBC_ASCII_WORD(encode, s, end))
+ goto fail;
+
+ s += enclen(encode, s, end);
+ MOP_OUT;
+ break;
+
case OP_WORD_BOUND: MOP_IN(OP_WORD_BOUND);
if (ON_STR_BEGIN(s)) {
DATA_ENSURE(1);
@@ -1950,6 +2051,25 @@ match_at(regex_t* reg, const UChar* str, const UChar* end,
continue;
break;
+ case OP_ASCII_WORD_BOUND: MOP_IN(OP_ASCII_WORD_BOUND);
+ if (ON_STR_BEGIN(s)) {
+ DATA_ENSURE(1);
+ if (! ONIGENC_IS_MBC_ASCII_WORD(encode, s, end))
+ goto fail;
+ }
+ else if (ON_STR_END(s)) {
+ if (! ONIGENC_IS_MBC_ASCII_WORD(encode, sprev, end))
+ goto fail;
+ }
+ else {
+ if (ONIGENC_IS_MBC_ASCII_WORD(encode, s, end)
+ == ONIGENC_IS_MBC_ASCII_WORD(encode, sprev, end))
+ goto fail;
+ }
+ MOP_OUT;
+ continue;
+ break;
+
case OP_NOT_WORD_BOUND: MOP_IN(OP_NOT_WORD_BOUND);
if (ON_STR_BEGIN(s)) {
if (DATA_ENSURE_CHECK1 && ONIGENC_IS_MBC_WORD(encode, s, end))
@@ -1968,6 +2088,24 @@ match_at(regex_t* reg, const UChar* str, const UChar* end,
continue;
break;
+ case OP_NOT_ASCII_WORD_BOUND: MOP_IN(OP_NOT_ASCII_WORD_BOUND);
+ if (ON_STR_BEGIN(s)) {
+ if (DATA_ENSURE_CHECK1 && ONIGENC_IS_MBC_ASCII_WORD(encode, s, end))
+ goto fail;
+ }
+ else if (ON_STR_END(s)) {
+ if (ONIGENC_IS_MBC_ASCII_WORD(encode, sprev, end))
+ goto fail;
+ }
+ else {
+ if (ONIGENC_IS_MBC_ASCII_WORD(encode, s, end)
+ != ONIGENC_IS_MBC_ASCII_WORD(encode, sprev, end))
+ goto fail;
+ }
+ MOP_OUT;
+ continue;
+ break;
+
#ifdef USE_WORD_BEGIN_END
case OP_WORD_BEGIN: MOP_IN(OP_WORD_BEGIN);
if (DATA_ENSURE_CHECK1 && ONIGENC_IS_MBC_WORD(encode, s, end)) {
@@ -1979,6 +2117,16 @@ match_at(regex_t* reg, const UChar* str, const UChar* end,
goto fail;
break;
+ case OP_ASCII_WORD_BEGIN: MOP_IN(OP_ASCII_WORD_BEGIN);
+ if (DATA_ENSURE_CHECK1 && ONIGENC_IS_MBC_ASCII_WORD(encode, s, end)) {
+ if (ON_STR_BEGIN(s) || !ONIGENC_IS_MBC_ASCII_WORD(encode, sprev, end)) {
+ MOP_OUT;
+ continue;
+ }
+ }
+ goto fail;
+ break;
+
case OP_WORD_END: MOP_IN(OP_WORD_END);
if (!ON_STR_BEGIN(s) && ONIGENC_IS_MBC_WORD(encode, sprev, end)) {
if (ON_STR_END(s) || !ONIGENC_IS_MBC_WORD(encode, s, end)) {
@@ -1988,6 +2136,16 @@ match_at(regex_t* reg, const UChar* str, const UChar* end,
}
goto fail;
break;
+
+ case OP_ASCII_WORD_END: MOP_IN(OP_ASCII_WORD_END);
+ if (!ON_STR_BEGIN(s) && ONIGENC_IS_MBC_ASCII_WORD(encode, sprev, end)) {
+ if (ON_STR_END(s) || !ONIGENC_IS_MBC_ASCII_WORD(encode, s, end)) {
+ MOP_OUT;
+ continue;
+ }
+ }
+ goto fail;
+ break;
#endif
case OP_BEGIN_BUF: MOP_IN(OP_BEGIN_BUF);
@@ -2005,12 +2163,18 @@ match_at(regex_t* reg, const UChar* str, const UChar* end,
break;
case OP_BEGIN_LINE: MOP_IN(OP_BEGIN_LINE);
+ op_begin_line:
if (ON_STR_BEGIN(s)) {
if (IS_NOTBOL(msa->options)) goto fail;
MOP_OUT;
continue;
}
- else if (ONIGENC_IS_MBC_NEWLINE(encode, sprev, end) && !ON_STR_END(s)) {
+ else if (ONIGENC_IS_MBC_NEWLINE(encode, sprev, end)
+#ifdef USE_CRNL_AS_LINE_TERMINATOR
+ && !(IS_NEWLINE_CRLF(option)
+ && ONIGENC_IS_MBC_CRNL(encode, sprev, end))
+#endif
+ && !ON_STR_END(s)) {
MOP_OUT;
continue;
}
@@ -2020,7 +2184,7 @@ match_at(regex_t* reg, const UChar* str, const UChar* end,
case OP_END_LINE: MOP_IN(OP_END_LINE);
if (ON_STR_END(s)) {
#ifndef USE_NEWLINE_AT_END_OF_STRING_HAS_EMPTY_LINE
- if (IS_EMPTY_STR || !ONIGENC_IS_MBC_NEWLINE(encode, sprev, end)) {
+ if (IS_EMPTY_STR || !ONIGENC_IS_MBC_NEWLINE_EX(encode, sprev, str, end, option, 1)) {
#endif
if (IS_NOTEOL(msa->options)) goto fail;
MOP_OUT;
@@ -2029,23 +2193,17 @@ match_at(regex_t* reg, const UChar* str, const UChar* end,
}
#endif
}
- else if (ONIGENC_IS_MBC_NEWLINE(encode, s, end)) {
+ else if (ONIGENC_IS_MBC_NEWLINE_EX(encode, s, str, end, option, 1)) {
MOP_OUT;
continue;
}
-#ifdef USE_CRNL_AS_LINE_TERMINATOR
- else if (ONIGENC_IS_MBC_CRNL(encode, s, end)) {
- MOP_OUT;
- continue;
- }
-#endif
goto fail;
break;
case OP_SEMI_END_BUF: MOP_IN(OP_SEMI_END_BUF);
if (ON_STR_END(s)) {
#ifndef USE_NEWLINE_AT_END_OF_STRING_HAS_EMPTY_LINE
- if (IS_EMPTY_STR || !ONIGENC_IS_MBC_NEWLINE(encode, sprev, end)) {
+ if (IS_EMPTY_STR || !ONIGENC_IS_MBC_NEWLINE_EX(encode, sprev, str, end, option, 1)) {
#endif
if (IS_NOTEOL(msa->options)) goto fail;
MOP_OUT;
@@ -2054,32 +2212,42 @@ match_at(regex_t* reg, const UChar* str, const UChar* end,
}
#endif
}
- else if (ONIGENC_IS_MBC_NEWLINE(encode, s, end) &&
- ON_STR_END(s + enclen(encode, s, end))) {
- MOP_OUT;
- continue;
- }
+ else if (ONIGENC_IS_MBC_NEWLINE_EX(encode, s, str, end, option, 1)) {
+ UChar* ss = s + enclen(encode, s, end);
+ if (ON_STR_END(ss)) {
+ MOP_OUT;
+ continue;
+ }
#ifdef USE_CRNL_AS_LINE_TERMINATOR
- else if (ONIGENC_IS_MBC_CRNL(encode, s, end)) {
- UChar* ss = s + enclen(encode, s);
- ss += enclen(encode, ss);
- if (ON_STR_END(ss)) {
- MOP_OUT;
- continue;
- }
- }
+ else if (IS_NEWLINE_CRLF(option)
+ && ONIGENC_IS_MBC_CRNL(encode, s, end)) {
+ ss += enclen(encode, ss, end);
+ if (ON_STR_END(ss)) {
+ MOP_OUT;
+ continue;
+ }
+ }
#endif
+ }
goto fail;
break;
case OP_BEGIN_POSITION: MOP_IN(OP_BEGIN_POSITION);
- if (s != msa->start)
+ if (s != msa->gpos)
goto fail;
MOP_OUT;
continue;
break;
+ case OP_BEGIN_POS_OR_LINE: MOP_IN(OP_BEGIN_POS_OR_LINE);
+ if (s != msa->gpos)
+ goto op_begin_line;
+
+ MOP_OUT;
+ continue;
+ break;
+
case OP_MEMORY_START_PUSH: MOP_IN(OP_MEMORY_START_PUSH);
GET_MEMNUM_INC(mem, p);
STACK_PUSH_MEM_START(mem, s);
@@ -2108,6 +2276,12 @@ match_at(regex_t* reg, const UChar* str, const UChar* end,
continue;
break;
+ case OP_KEEP: MOP_IN(OP_KEEP);
+ pkeep = s;
+ MOP_OUT;
+ continue;
+ break;
+
#ifdef USE_SUBEXP_CALL
case OP_MEMORY_END_PUSH_REC: MOP_IN(OP_MEMORY_END_PUSH_REC);
GET_MEMNUM_INC(mem, p);
@@ -2272,7 +2446,7 @@ match_at(regex_t* reg, const UChar* str, const UChar* end,
DATA_ENSURE(n);
sprev = s;
swork = s;
- STRING_CMP_VALUE_IC(case_fold_flag, pstart, &swork, (int)n, end, is_fail);
+ STRING_CMP_VALUE_IC(case_fold_flag, pstart, &swork, n, end, is_fail);
if (is_fail) continue;
s = swork;
while (sprev + (len = enclen(encode, sprev, end)) < s)
@@ -2319,7 +2493,7 @@ match_at(regex_t* reg, const UChar* str, const UChar* end,
#if 0 /* no need: IS_DYNAMIC_OPTION() == 0 */
case OP_SET_OPTION_PUSH: MOP_IN(OP_SET_OPTION_PUSH);
GET_OPTION_INC(option, p);
- STACK_PUSH_ALT(p, s, sprev);
+ STACK_PUSH_ALT(p, s, sprev, pkeep);
p += SIZE_OP_SET_OPTION + SIZE_OP_FAIL;
MOP_OUT;
continue;
@@ -2347,8 +2521,8 @@ match_at(regex_t* reg, const UChar* str, const UChar* end,
STACK_NULL_CHECK(isnull, mem, s);
if (isnull) {
#ifdef ONIG_DEBUG_MATCH
- fprintf(stderr, "NULL_CHECK_END: skip id:%d, s:%"PRIdPTR"\n",
- (int )mem, (intptr_t )s);
+ fprintf(stderr, "NULL_CHECK_END: skip id:%d, s:%"PRIdPTR" (%p)\n",
+ (int )mem, (intptr_t )s, s);
#endif
null_check_found:
/* empty loop founded, skip next instruction */
@@ -2382,11 +2556,11 @@ match_at(regex_t* reg, const UChar* str, const UChar* end,
STACK_NULL_CHECK_MEMST(isnull, mem, s, reg);
if (isnull) {
#ifdef ONIG_DEBUG_MATCH
- fprintf(stderr, "NULL_CHECK_END_MEMST: skip id:%d, s:%"PRIdPTR"\n",
- (int )mem, (intptr_t )s);
+ fprintf(stderr, "NULL_CHECK_END_MEMST: skip id:%d, s:%"PRIdPTR" (%p)\n",
+ (int )mem, (intptr_t )s, s);
#endif
if (isnull == -1) goto fail;
- goto null_check_found;
+ goto null_check_found;
}
}
MOP_OUT;
@@ -2408,11 +2582,11 @@ match_at(regex_t* reg, const UChar* str, const UChar* end,
#endif
if (isnull) {
#ifdef ONIG_DEBUG_MATCH
- fprintf(stderr, "NULL_CHECK_END_MEMST_PUSH: skip id:%d, s:%"PRIdPTR"\n",
- (int )mem, (intptr_t )s);
+ fprintf(stderr, "NULL_CHECK_END_MEMST_PUSH: skip id:%d, s:%"PRIdPTR" (%p)\n",
+ (int )mem, (intptr_t )s, s);
#endif
if (isnull == -1) goto fail;
- goto null_check_found;
+ goto null_check_found;
}
else {
STACK_PUSH_NULL_CHECK_END(mem);
@@ -2433,7 +2607,7 @@ match_at(regex_t* reg, const UChar* str, const UChar* end,
case OP_PUSH: MOP_IN(OP_PUSH);
GET_RELADDR_INC(addr, p);
- STACK_PUSH_ALT(p + addr, s, sprev);
+ STACK_PUSH_ALT(p + addr, s, sprev, pkeep);
MOP_OUT;
continue;
break;
@@ -2445,7 +2619,7 @@ match_at(regex_t* reg, const UChar* str, const UChar* end,
if (scv) goto fail;
GET_RELADDR_INC(addr, p);
- STACK_PUSH_ALT_WITH_STATE_CHECK(p + addr, s, sprev, mem);
+ STACK_PUSH_ALT_WITH_STATE_CHECK(p + addr, s, sprev, mem, pkeep);
MOP_OUT;
continue;
break;
@@ -2458,7 +2632,7 @@ match_at(regex_t* reg, const UChar* str, const UChar* end,
p += addr;
}
else {
- STACK_PUSH_ALT_WITH_STATE_CHECK(p + addr, s, sprev, mem);
+ STACK_PUSH_ALT_WITH_STATE_CHECK(p + addr, s, sprev, mem, pkeep);
}
MOP_OUT;
continue;
@@ -2485,7 +2659,7 @@ match_at(regex_t* reg, const UChar* str, const UChar* end,
GET_RELADDR_INC(addr, p);
if (*p == *s && DATA_ENSURE_CHECK1) {
p++;
- STACK_PUSH_ALT(p + addr, s, sprev);
+ STACK_PUSH_ALT(p + addr, s, sprev, pkeep);
MOP_OUT;
continue;
}
@@ -2498,7 +2672,7 @@ match_at(regex_t* reg, const UChar* str, const UChar* end,
GET_RELADDR_INC(addr, p);
if (*p == *s) {
p++;
- STACK_PUSH_ALT(p + addr, s, sprev);
+ STACK_PUSH_ALT(p + addr, s, sprev, pkeep);
MOP_OUT;
continue;
}
@@ -2517,7 +2691,7 @@ match_at(regex_t* reg, const UChar* str, const UChar* end,
STACK_PUSH_REPEAT(mem, p);
if (reg->repeat_range[mem].lower == 0) {
- STACK_PUSH_ALT(p + addr, s, sprev);
+ STACK_PUSH_ALT(p + addr, s, sprev, pkeep);
}
}
MOP_OUT;
@@ -2534,7 +2708,7 @@ match_at(regex_t* reg, const UChar* str, const UChar* end,
STACK_PUSH_REPEAT(mem, p);
if (reg->repeat_range[mem].lower == 0) {
- STACK_PUSH_ALT(p, s, sprev);
+ STACK_PUSH_ALT(p, s, sprev, pkeep);
p += addr;
}
}
@@ -2553,7 +2727,7 @@ match_at(regex_t* reg, const UChar* str, const UChar* end,
/* end of repeat. Nothing to do. */
}
else if (stkp->u.repeat.count >= reg->repeat_range[mem].lower) {
- STACK_PUSH_ALT(p, s, sprev);
+ STACK_PUSH_ALT(p, s, sprev, pkeep);
p = STACK_AT(si)->u.repeat.pcode; /* Don't use stkp after PUSH. */
}
else {
@@ -2584,7 +2758,7 @@ match_at(regex_t* reg, const UChar* str, const UChar* end,
UChar* pcode = stkp->u.repeat.pcode;
STACK_PUSH_REPEAT_INC(si);
- STACK_PUSH_ALT(pcode, s, sprev);
+ STACK_PUSH_ALT(pcode, s, sprev, pkeep);
}
else {
p = stkp->u.repeat.pcode;
@@ -2607,7 +2781,7 @@ match_at(regex_t* reg, const UChar* str, const UChar* end,
break;
case OP_PUSH_POS: MOP_IN(OP_PUSH_POS);
- STACK_PUSH_POS(s, sprev);
+ STACK_PUSH_POS(s, sprev, pkeep);
MOP_OUT;
continue;
break;
@@ -2624,7 +2798,7 @@ match_at(regex_t* reg, const UChar* str, const UChar* end,
case OP_PUSH_POS_NOT: MOP_IN(OP_PUSH_POS_NOT);
GET_RELADDR_INC(addr, p);
- STACK_PUSH_POS_NOT(p + addr, s, sprev);
+ STACK_PUSH_POS_NOT(p + addr, s, sprev, pkeep);
MOP_OUT;
continue;
break;
@@ -2666,7 +2840,7 @@ match_at(regex_t* reg, const UChar* str, const UChar* end,
/* goto fail; */
}
else {
- STACK_PUSH_LOOK_BEHIND_NOT(p + addr, s, sprev);
+ STACK_PUSH_LOOK_BEHIND_NOT(p + addr, s, sprev, pkeep);
s = q;
sprev = (UChar* )onigenc_get_prev_char_head(encode, str, s, end);
}
@@ -2696,6 +2870,18 @@ match_at(regex_t* reg, const UChar* str, const UChar* end,
break;
#endif
+ case OP_CONDITION: MOP_IN(OP_CONDITION);
+ GET_MEMNUM_INC(mem, p);
+ GET_RELADDR_INC(addr, p);
+ if ((mem > num_mem) ||
+ (mem_end_stk[mem] == INVALID_STACK_INDEX) ||
+ (mem_start_stk[mem] == INVALID_STACK_INDEX)) {
+ p += addr;
+ }
+ MOP_OUT;
+ continue;
+ break;
+
case OP_FINISH:
goto finish;
break;
@@ -2708,6 +2894,7 @@ match_at(regex_t* reg, const UChar* str, const UChar* end,
p = stk->u.state.pcode;
s = stk->u.state.pstr;
sprev = stk->u.state.pstr_prev;
+ pkeep = stk->u.state.pkeep;
#ifdef USE_COMBINATION_EXPLOSION_CHECK
if (stk->u.state.state_check != 0) {
@@ -2772,7 +2959,7 @@ slow_search(OnigEncoding enc, UChar* target, UChar* target_end,
}
s += n;
}
- return (UChar*)NULL;
+ return (UChar* )NULL;
}
while (s < end) {
if (*s == *target) {
@@ -2890,6 +3077,8 @@ slow_search_backward_ic(OnigEncoding enc, int case_fold_flag,
return (UChar* )NULL;
}
+#ifndef USE_SUNDAY_QUICK_SEARCH
+/* Boyer-Moore-Horspool search applied to a multibyte string */
static UChar*
bm_search_notrev(regex_t* reg, const UChar* target, const UChar* target_end,
const UChar* text, const UChar* text_end,
@@ -2900,8 +3089,8 @@ bm_search_notrev(regex_t* reg, const UChar* target, const UChar* target_end,
ptrdiff_t skip, tlen1;
#ifdef ONIG_DEBUG_SEARCH
- fprintf(stderr, "bm_search_notrev: text: %"PRIuPTR", text_end: %"PRIuPTR", text_range: %"PRIuPTR"\n",
- text, text_end, text_range);
+ fprintf(stderr, "bm_search_notrev: text: %"PRIuPTR" (%p), text_end: %"PRIuPTR" (%p), text_range: %"PRIuPTR" (%p)\n",
+ text, text, text_end, text_end, text_range, text_range);
#endif
tail = target_end - 1;
@@ -2946,6 +3135,7 @@ bm_search_notrev(regex_t* reg, const UChar* target, const UChar* target_end,
return (UChar* )NULL;
}
+/* Boyer-Moore-Horspool search */
static UChar*
bm_search(regex_t* reg, const UChar* target, const UChar* target_end,
const UChar* text, const UChar* text_end, const UChar* text_range)
@@ -2993,10 +3183,315 @@ bm_search(regex_t* reg, const UChar* target, const UChar* target_end,
return (UChar* )NULL;
}
+/* Boyer-Moore-Horspool search applied to a multibyte string (ignore case) */
+static UChar*
+bm_search_notrev_ic(regex_t* reg, const UChar* target, const UChar* target_end,
+ const UChar* text, const UChar* text_end,
+ const UChar* text_range)
+{
+ const UChar *s, *se, *t, *end;
+ const UChar *tail;
+ ptrdiff_t skip, tlen1;
+ OnigEncoding enc = reg->enc;
+ 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);
+#endif
+
+ tail = target_end - 1;
+ tlen1 = tail - target;
+ end = text_range;
+ if (end + tlen1 > text_end)
+ end = text_end - tlen1;
+
+ s = text;
+
+ if (IS_NULL(reg->int_map)) {
+ while (s < end) {
+ se = s + tlen1;
+ if (str_lower_case_match(enc, case_fold_flag, target, target_end,
+ s, se + 1))
+ return (UChar* )s;
+ skip = reg->map[*se];
+ t = s;
+ do {
+ s += enclen(reg->enc, s, end);
+ } while ((s - t) < skip && s < end);
+ }
+ }
+ else {
+ while (s < end) {
+ se = s + tlen1;
+ if (str_lower_case_match(enc, case_fold_flag, target, target_end,
+ s, se + 1))
+ return (UChar* )s;
+ skip = reg->int_map[*se];
+ t = s;
+ do {
+ s += enclen(reg->enc, s, end);
+ } while ((s - t) < skip && s < end);
+ }
+ }
+
+ return (UChar* )NULL;
+}
+
+/* Boyer-Moore-Horspool search (ignore case) */
+static UChar*
+bm_search_ic(regex_t* reg, const UChar* target, const UChar* target_end,
+ const UChar* text, const UChar* text_end, const UChar* text_range)
+{
+ const UChar *s, *p, *end;
+ const UChar *tail;
+ OnigEncoding enc = reg->enc;
+ 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);
+#endif
+
+ end = text_range + (target_end - target) - 1;
+ if (end > text_end)
+ end = text_end;
+
+ tail = target_end - 1;
+ s = text + (target_end - target) - 1;
+ if (IS_NULL(reg->int_map)) {
+ while (s < end) {
+ p = s - (target_end - target) + 1;
+ if (str_lower_case_match(enc, case_fold_flag, target, target_end,
+ p, s + 1))
+ return (UChar* )p;
+ s += reg->map[*s];
+ }
+ }
+ else { /* see int_map[] */
+ while (s < end) {
+ p = s - (target_end - target) + 1;
+ if (str_lower_case_match(enc, case_fold_flag, target, target_end,
+ p, s + 1))
+ return (UChar* )p;
+ s += reg->int_map[*s];
+ }
+ }
+ return (UChar* )NULL;
+}
+
+#else /* USE_SUNDAY_QUICK_SEARCH */
+
+/* Sunday's quick search applied to a multibyte string */
+static UChar*
+bm_search_notrev(regex_t* reg, const UChar* target, const UChar* target_end,
+ const UChar* text, const UChar* text_end,
+ const UChar* text_range)
+{
+ const UChar *s, *se, *t, *p, *end;
+ const UChar *tail;
+ ptrdiff_t skip, tlen1;
+ 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);
+#endif
+
+ tail = target_end - 1;
+ tlen1 = tail - target;
+ end = text_range;
+ if (end + tlen1 > text_end)
+ end = text_end - tlen1;
+
+ s = text;
+
+ if (IS_NULL(reg->int_map)) {
+ while (s < end) {
+ p = se = s + tlen1;
+ t = tail;
+ while (*p == *t) {
+ if (t == target) return (UChar* )s;
+ p--; t--;
+ }
+ if (s + 1 >= end) break;
+ skip = reg->map[se[1]];
+ t = s;
+ do {
+ s += enclen(enc, s, end);
+ } while ((s - t) < skip && s < end);
+ }
+ }
+ else {
+ while (s < end) {
+ p = se = s + tlen1;
+ t = tail;
+ while (*p == *t) {
+ if (t == target) return (UChar* )s;
+ p--; t--;
+ }
+ if (s + 1 >= end) break;
+ skip = reg->int_map[se[1]];
+ t = s;
+ do {
+ s += enclen(enc, s, end);
+ } while ((s - t) < skip && s < end);
+ }
+ }
+
+ return (UChar* )NULL;
+}
+
+/* Sunday's quick search */
+static UChar*
+bm_search(regex_t* reg, const UChar* target, const UChar* target_end,
+ const UChar* text, const UChar* text_end, const UChar* text_range)
+{
+ const UChar *s, *t, *p, *end;
+ const UChar *tail;
+ ptrdiff_t tlen1;
+
+ tail = target_end - 1;
+ tlen1 = tail - target;
+ end = text_range + tlen1;
+ if (end > text_end)
+ end = text_end;
+
+ s = text + tlen1;
+ if (IS_NULL(reg->int_map)) {
+ while (s < end) {
+ p = s;
+ t = tail;
+ while (*p == *t) {
+ if (t == target) return (UChar* )p;
+ p--; t--;
+ }
+ if (s + 1 >= end) break;
+ s += reg->map[s[1]];
+ }
+ }
+ else { /* see int_map[] */
+ while (s < end) {
+ p = s;
+ t = tail;
+ while (*p == *t) {
+ if (t == target) return (UChar* )p;
+ p--; t--;
+ }
+ if (s + 1 >= end) break;
+ s += reg->int_map[s[1]];
+ }
+ }
+ return (UChar* )NULL;
+}
+
+/* Sunday's quick search applied to a multibyte string (ignore case) */
+static UChar*
+bm_search_notrev_ic(regex_t* reg, const UChar* target, const UChar* target_end,
+ const UChar* text, const UChar* text_end,
+ const UChar* text_range)
+{
+ const UChar *s, *se, *t, *end;
+ const UChar *tail;
+ ptrdiff_t skip, tlen1;
+ OnigEncoding enc = reg->enc;
+ 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);
+#endif
+
+ tail = target_end - 1;
+ tlen1 = tail - target;
+ end = text_range;
+ if (end + tlen1 > text_end)
+ end = text_end - tlen1;
+
+ s = text;
+
+ if (IS_NULL(reg->int_map)) {
+ while (s < end) {
+ se = s + tlen1;
+ if (str_lower_case_match(enc, case_fold_flag, target, target_end,
+ s, se + 1))
+ return (UChar* )s;
+ if (s + 1 >= end) break;
+ skip = reg->map[se[1]];
+ t = s;
+ do {
+ s += enclen(enc, s, end);
+ } while ((s - t) < skip && s < end);
+ }
+ }
+ else {
+ while (s < end) {
+ se = s + tlen1;
+ if (str_lower_case_match(enc, case_fold_flag, target, target_end,
+ s, se + 1))
+ return (UChar* )s;
+ if (s + 1 >= end) break;
+ skip = reg->int_map[se[1]];
+ t = s;
+ do {
+ s += enclen(enc, s, end);
+ } while ((s - t) < skip && s < end);
+ }
+ }
+
+ return (UChar* )NULL;
+}
+
+/* Sunday's quick search (ignore case) */
+static UChar*
+bm_search_ic(regex_t* reg, const UChar* target, const UChar* target_end,
+ const UChar* text, const UChar* text_end, const UChar* text_range)
+{
+ const UChar *s, *p, *end;
+ const UChar *tail;
+ ptrdiff_t tlen1;
+ OnigEncoding enc = reg->enc;
+ 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);
+#endif
+
+ tail = target_end - 1;
+ tlen1 = tail - target;
+ end = text_range + tlen1;
+ if (end > text_end)
+ end = text_end;
+
+ s = text + tlen1;
+ if (IS_NULL(reg->int_map)) {
+ while (s < end) {
+ p = s - tlen1;
+ if (str_lower_case_match(enc, case_fold_flag, target, target_end,
+ p, s + 1))
+ return (UChar* )p;
+ if (s + 1 >= end) break;
+ s += reg->map[s[1]];
+ }
+ }
+ else { /* see int_map[] */
+ while (s < end) {
+ p = s - tlen1;
+ if (str_lower_case_match(enc, case_fold_flag, target, target_end,
+ p, s + 1))
+ return (UChar* )p;
+ if (s + 1 >= end) break;
+ s += reg->int_map[s[1]];
+ }
+ }
+ return (UChar* )NULL;
+}
+#endif /* USE_SUNDAY_QUICK_SEARCH */
+
static int
set_bm_backward_skip(UChar* s, UChar* end, OnigEncoding enc ARG_UNUSED,
int** skip)
-
{
int i, len;
@@ -3005,7 +3500,7 @@ set_bm_backward_skip(UChar* s, UChar* end, OnigEncoding enc ARG_UNUSED,
if (IS_NULL(*skip)) return ONIGERR_MEMORY;
}
- len = (int)(end - s);
+ len = (int )(end - s);
for (i = 0; i < ONIG_CHAR_TABLE_SIZE; i++)
(*skip)[i] = len;
@@ -3073,11 +3568,11 @@ map_search_backward(OnigEncoding enc, UChar map[],
return (UChar* )NULL;
}
-extern long
+extern OnigPosition
onig_match(regex_t* reg, const UChar* str, const UChar* end, const UChar* at, OnigRegion* region,
OnigOptionType option)
{
- long r;
+ ptrdiff_t r;
UChar *prev;
OnigMatchArg msa;
@@ -3106,7 +3601,7 @@ onig_match(regex_t* reg, const UChar* str, const UChar* end, const UChar* at, On
THREAD_ATOMIC_END;
#endif /* USE_RECOMPILE_API && USE_MULTI_THREAD_SYSTEM */
- MATCH_ARG_INIT(msa, option, region, at);
+ MATCH_ARG_INIT(msa, option, region, at, at);
#ifdef USE_COMBINATION_EXPLOSION_CHECK
{
int offset = at - str;
@@ -3145,8 +3640,8 @@ forward_search_range(regex_t* reg, const UChar* str, const UChar* end, UChar* s,
UChar *p, *pprev = (UChar* )NULL;
#ifdef ONIG_DEBUG_SEARCH
- fprintf(stderr, "forward_search_range: str: %"PRIuPTR", end: %"PRIuPTR", s: %"PRIuPTR", range: %"PRIuPTR"\n",
- str, end, s, range);
+ 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);
#endif
p = s;
@@ -3178,6 +3673,14 @@ forward_search_range(regex_t* reg, const UChar* str, const UChar* end, UChar* s,
p = bm_search_notrev(reg, reg->exact, reg->exact_end, p, end, range);
break;
+ case ONIG_OPTIMIZE_EXACT_BM_IC:
+ p = bm_search_ic(reg, reg->exact, reg->exact_end, p, end, range);
+ break;
+
+ case ONIG_OPTIMIZE_EXACT_BM_NOT_REV_IC:
+ p = bm_search_notrev_ic(reg, reg->exact, reg->exact_end, p, end, range);
+ break;
+
case ONIG_OPTIMIZE_MAP:
p = map_search(reg->enc, reg->map, p, range, end);
break;
@@ -3199,7 +3702,7 @@ forward_search_range(regex_t* reg, const UChar* str, const UChar* end, UChar* s,
if (!ON_STR_BEGIN(p)) {
prev = onigenc_get_prev_char_head(reg->enc,
(pprev ? pprev : str), p, end);
- if (!ONIGENC_IS_MBC_NEWLINE(reg->enc, prev, end))
+ if (!ONIGENC_IS_MBC_NEWLINE_EX(reg->enc, prev, str, end, reg->options, 0))
goto retry_gate;
}
break;
@@ -3209,15 +3712,11 @@ forward_search_range(regex_t* reg, const UChar* str, const UChar* end, UChar* s,
#ifndef USE_NEWLINE_AT_END_OF_STRING_HAS_EMPTY_LINE
prev = (UChar* )onigenc_get_prev_char_head(reg->enc,
(pprev ? pprev : str), p);
- if (prev && ONIGENC_IS_MBC_NEWLINE(reg->enc, prev, end))
+ if (prev && ONIGENC_IS_MBC_NEWLINE_EX(reg->enc, prev, str, end, reg->options, 1))
goto retry_gate;
#endif
}
- else if (! ONIGENC_IS_MBC_NEWLINE(reg->enc, p, end)
-#ifdef USE_CRNL_AS_LINE_TERMINATOR
- && ! ONIGENC_IS_MBC_CRNL(reg->enc, p, end)
-#endif
- )
+ else if (! ONIGENC_IS_MBC_NEWLINE_EX(reg->enc, p, str, end, reg->options, 1))
goto retry_gate;
break;
}
@@ -3269,7 +3768,7 @@ static int set_bm_backward_skip P_((UChar* s, UChar* end, OnigEncoding enc,
#define BM_BACKWARD_SEARCH_LENGTH_THRESHOLD 100
-static long
+static int
backward_search_range(regex_t* reg, const UChar* str, const UChar* end,
UChar* s, const UChar* range, UChar* adjrange,
UChar** low, UChar** high)
@@ -3289,6 +3788,8 @@ backward_search_range(regex_t* reg, const UChar* str, const UChar* end,
break;
case ONIG_OPTIMIZE_EXACT_IC:
+ case ONIG_OPTIMIZE_EXACT_BM_IC:
+ case ONIG_OPTIMIZE_EXACT_BM_NOT_REV_IC:
p = slow_search_backward_ic(reg->enc, reg->case_fold_flag,
reg->exact, reg->exact_end,
range, adjrange, end, p);
@@ -3321,7 +3822,7 @@ backward_search_range(regex_t* reg, const UChar* str, const UChar* end,
case ANCHOR_BEGIN_LINE:
if (!ON_STR_BEGIN(p)) {
prev = onigenc_get_prev_char_head(reg->enc, str, p, end);
- if (!ONIGENC_IS_MBC_NEWLINE(reg->enc, prev, end)) {
+ if (!ONIGENC_IS_MBC_NEWLINE_EX(reg->enc, prev, str, end, reg->options, 0)) {
p = prev;
goto retry;
}
@@ -3333,17 +3834,13 @@ backward_search_range(regex_t* reg, const UChar* str, const UChar* end,
#ifndef USE_NEWLINE_AT_END_OF_STRING_HAS_EMPTY_LINE
prev = onigenc_get_prev_char_head(reg->enc, adjrange, p);
if (IS_NULL(prev)) goto fail;
- if (ONIGENC_IS_MBC_NEWLINE(reg->enc, prev, end)) {
+ if (ONIGENC_IS_MBC_NEWLINE_EX(reg->enc, prev, str, end, reg->options, 1)) {
p = prev;
goto retry;
}
#endif
}
- else if (! ONIGENC_IS_MBC_NEWLINE(reg->enc, p, end)
-#ifdef USE_CRNL_AS_LINE_TERMINATOR
- && ! ONIGENC_IS_MBC_CRNL(reg->enc, p, end)
-#endif
- ) {
+ else if (! ONIGENC_IS_MBC_NEWLINE_EX(reg->enc, p, str, end, reg->options, 1)) {
p = onigenc_get_prev_char_head(reg->enc, adjrange, p, end);
if (IS_NULL(p)) goto fail;
goto retry;
@@ -3374,15 +3871,23 @@ backward_search_range(regex_t* reg, const UChar* str, const UChar* end,
}
-extern long
+extern OnigPosition
onig_search(regex_t* reg, const UChar* str, const UChar* end,
const UChar* start, const UChar* range, OnigRegion* region, OnigOptionType option)
{
- long r;
+ return onig_search_gpos(reg, str, end, start, start, range, region, option);
+}
+
+extern OnigPosition
+onig_search_gpos(regex_t* reg, const UChar* str, const UChar* end,
+ const UChar* global_pos,
+ const UChar* start, const UChar* range, OnigRegion* region, OnigOptionType option)
+{
+ ptrdiff_t r;
UChar *s, *prev;
OnigMatchArg msa;
- const UChar *orig_start = start;
#ifdef USE_MATCH_RANGE_MUST_BE_INSIDE_OF_SPECIFIED_RANGE
+ const UChar *orig_start = start;
const UChar *orig_range = range;
#endif
@@ -3413,8 +3918,8 @@ onig_search(regex_t* reg, const UChar* str, const UChar* end,
#ifdef ONIG_DEBUG_SEARCH
fprintf(stderr,
- "onig_search (entry point): str: %"PRIuPTR", end: %"PRIuPTR", start: %"PRIuPTR", range: %"PRIuPTR"\n",
- str, end - str, start - str, range - str);
+ "onig_search (entry point): str: %"PRIuPTR" (%p), end: %"PRIuPTR", start: %"PRIuPTR", range: %"PRIuPTR"\n",
+ str, str, end - str, start - str, range - str);
#endif
if (region
@@ -3545,6 +4050,7 @@ onig_search(regex_t* reg, const UChar* str, const UChar* end,
#ifdef USE_CRNL_AS_LINE_TERMINATOR
pre_end = ONIGENC_STEP_BACK(reg->enc, str, pre_end, end, 1);
if (IS_NOT_NULL(pre_end) &&
+ IS_NEWLINE_CRLF(reg->options) &&
ONIGENC_IS_MBC_CRNL(reg->enc, pre_end, end)) {
min_semi_end = pre_end;
}
@@ -3559,7 +4065,7 @@ onig_search(regex_t* reg, const UChar* str, const UChar* end,
}
}
else if ((reg->anchor & ANCHOR_ANYCHAR_STAR_ML)) {
- if (!(reg->anchor & ANCHOR_LOOK_BEHIND)) {
+ if (! (reg->anchor & ANCHOR_LOOK_BEHIND)) {
goto begin_position;
}
}
@@ -3576,7 +4082,7 @@ onig_search(regex_t* reg, const UChar* str, const UChar* end,
s = (UChar* )start;
prev = (UChar* )NULL;
- MATCH_ARG_INIT(msa, option, region, start);
+ MATCH_ARG_INIT(msa, option, region, start, start);
#ifdef USE_COMBINATION_EXPLOSION_CHECK
msa.state_check_buff = (void* )0;
msa.state_check_buff_size = 0; /* NO NEED, for valgrind */
@@ -3592,7 +4098,7 @@ onig_search(regex_t* reg, const UChar* str, const UChar* end,
(int )(end - str), (int )(start - str), (int )(range - str));
#endif
- MATCH_ARG_INIT(msa, option, region, orig_start);
+ MATCH_ARG_INIT(msa, option, region, start, global_pos);
#ifdef USE_COMBINATION_EXPLOSION_CHECK
{
int offset = (MIN(start, range) - str);
@@ -3645,9 +4151,19 @@ onig_search(regex_t* reg, const UChar* str, const UChar* end,
if ((reg->anchor & ANCHOR_ANYCHAR_STAR) != 0) {
do {
+ if ((reg->anchor & ANCHOR_BEGIN_POSITION) == 0)
+ msa.gpos = s; /* move \G position */
MATCH_AND_RETURN_CHECK(orig_range);
prev = s;
s += enclen(reg->enc, s, end);
+
+ if ((reg->anchor & ANCHOR_LOOK_BEHIND) == 0) {
+ while (!ONIGENC_IS_MBC_NEWLINE_EX(reg->enc, prev, str, end, reg->options, 0)
+ && s < range) {
+ prev = s;
+ s += enclen(reg->enc, s, end);
+ }
+ }
} while (s < range);
goto mismatch;
}
@@ -3667,7 +4183,7 @@ onig_search(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 */
+ orig_start += enclen(reg->enc, orig_start, end); /* is upper range */
#endif
if (reg->optimize != ONIG_OPTIMIZE_NONE) {
@@ -3741,7 +4257,7 @@ onig_search(regex_t* reg, const UChar* str, const UChar* end,
ONIG_STATE_DEC_THREAD(reg);
/* If result is mismatch and no FIND_NOT_EMPTY option,
- then the region is not setted in match_at(). */
+ then the region is not set in match_at(). */
if (IS_FIND_NOT_EMPTY(reg->options) && region
#ifdef USE_POSIX_API_REGION_OPTION
&& !IS_POSIX_REGION(option)
diff --git a/regint.h b/regint.h
index cd3c2a1035..a3e92ee217 100644
--- a/regint.h
+++ b/regint.h
@@ -1,10 +1,11 @@
#ifndef ONIGURUMA_REGINT_H
#define ONIGURUMA_REGINT_H
/**********************************************************************
- regint.h - Oniguruma (regular expression library)
+ regint.h - Onigmo (Oniguruma-mod) (regular expression library)
**********************************************************************/
/*-
* Copyright (c) 2002-2008 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
+ * Copyright (c) 2011-2012 K.Takata <kentkt AT csc DOT jp>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -48,7 +49,7 @@
#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(__mc68020__)
#define PLATFORM_UNALIGNED_WORD_ACCESS
#endif
@@ -57,12 +58,15 @@
/* spec. config */
#define USE_NAMED_GROUP
#define USE_SUBEXP_CALL
+#define USE_PERL_SUBEXP_CALL
+#define USE_CAPITAL_P_NAMED_GROUP
#define USE_BACKREF_WITH_LEVEL /* \k<name+n>, \k<name-n> */
#define USE_MONOMANIAC_CHECK_CAPTURES_IN_ENDLESS_REPEAT /* /(?:()|())*\2/ */
#define USE_NEWLINE_AT_END_OF_STRING_HAS_EMPTY_LINE /* /\n$/ =~ "\n" */
#define USE_WARNING_REDUNDANT_NESTED_REPEAT_OPERATOR
/* #define USE_RECOMPILE_API */
/* !!! moved to regenc.h. */ /* #define USE_CRNL_AS_LINE_TERMINATOR */
+#define USE_NO_INVALID_QUANTIFIER
/* internal config */
#define USE_PARSE_TREE_NODE_RECYCLE
@@ -70,10 +74,18 @@
#define USE_QTFR_PEEK_NEXT
#define USE_ST_LIBRARY
#define USE_SHARED_CCLASS_TABLE
+#define USE_SUNDAY_QUICK_SEARCH
#define INIT_MATCH_STACK_SIZE 160
#define DEFAULT_MATCH_STACK_LIMIT_SIZE 0 /* unlimited */
+/* check config */
+#if defined(USE_PERL_SUBEXP_CALL) || defined(USE_CAPITAL_P_NAMED_GROUP)
+#if !defined(USE_NAMED_GROUP) || !defined(USE_SUBEXP_CALL)
+#error USE_NAMED_GROUP and USE_SUBEXP_CALL must be defined.
+#endif
+#endif
+
#if defined(__GNUC__)
# define ARG_UNUSED __attribute__ ((unused))
#else
@@ -92,13 +104,14 @@
#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_WORD_BEGIN_END /* "\<": word-begin, "\>": word-end */
-#define USE_POSIX_REGION_OPTION /* needed for POSIX API support */
+#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*)* */
+
/* #define USE_MULTI_THREAD_SYSTEM */
#define THREAD_SYSTEM_INIT /* depend on thread system */
#define THREAD_SYSTEM_END /* depend on thread system */
@@ -218,15 +231,38 @@
#include <sys/types.h>
#endif
+#ifdef HAVE_STDINT_H
+# include <stdint.h>
+#endif
+
+#ifdef STDC_HEADERS
+# include <stddef.h>
+#endif
+
+#ifdef __BORLANDC__
+#include <malloc.h>
+#endif
+
#ifdef ONIG_DEBUG
# include <stdio.h>
#endif
+#ifdef _WIN32
+#if defined(_MSC_VER) && (_MSC_VER < 1300)
+#ifndef _INTPTR_T_DEFINED
+#define _INTPTR_T_DEFINED
+typedef int intptr_t;
+#endif
+#ifndef _UINTPTR_T_DEFINED
+#define _UINTPTR_T_DEFINED
+typedef unsigned int uintptr_t;
+#endif
+#endif
+#endif /* _WIN32 */
+
#include "regenc.h"
-#if defined __GNUC__ && __GNUC__ >= 4
-#pragma GCC visibility push(default)
-#endif
+RUBY_SYMBOL_EXPORT_BEGIN
#ifdef MIN
#undef MIN
@@ -243,6 +279,8 @@
#define CHECK_NULL_RETURN_MEMERR(p) if (IS_NULL(p)) return ONIGERR_MEMORY
#define NULL_UCHARP ((UChar* )0)
+#define ONIG_LAST_CODE_POINT (~((OnigCodePoint )0))
+
#ifdef PLATFORM_UNALIGNED_WORD_ACCESS
#define PLATFORM_GET_INC(val,p,type) do{\
@@ -282,9 +320,11 @@
#define ONIG_OPTIMIZE_NONE 0
#define ONIG_OPTIMIZE_EXACT 1 /* Slow Search */
#define ONIG_OPTIMIZE_EXACT_BM 2 /* Boyer Moore Search */
-#define ONIG_OPTIMIZE_EXACT_BM_NOT_REV 3 /* BM (but not simple match) */
+#define ONIG_OPTIMIZE_EXACT_BM_NOT_REV 3 /* BM (applied to a multibyte string) */
#define ONIG_OPTIMIZE_EXACT_IC 4 /* Slow Search (ignore case) */
#define ONIG_OPTIMIZE_MAP 5 /* char map */
+#define ONIG_OPTIMIZE_EXACT_BM_IC 6 /* BM (ignore case) */
+#define ONIG_OPTIMIZE_EXACT_BM_NOT_REV_IC 7 /* BM (applied to a multibyte string) (ignore case) */
/* bit status */
typedef unsigned int BitStatusType;
@@ -327,6 +367,10 @@ typedef unsigned int BitStatusType;
#define IS_NOTBOL(option) ((option) & ONIG_OPTION_NOTBOL)
#define IS_NOTEOL(option) ((option) & ONIG_OPTION_NOTEOL)
#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)
+#define IS_WORD_BOUND_ALL_RANGE(option) ((option) & ONIG_OPTION_WORD_BOUND_ALL_RANGE)
+#define IS_NEWLINE_CRLF(option) ((option) & ONIG_OPTION_NEWLINE_CRLF)
/* OP_SET_OPTION is required for these options.
#define IS_DYNAMIC_OPTION(option) \
@@ -344,7 +388,7 @@ typedef unsigned int BitStatusType;
/* bitset */
#define BITS_PER_BYTE 8
#define SINGLE_BYTE_SIZE (1 << BITS_PER_BYTE)
-#define BITS_IN_ROOM (sizeof(Bits) * BITS_PER_BYTE)
+#define BITS_IN_ROOM ((int )sizeof(Bits) * BITS_PER_BYTE)
#define BITSET_SIZE (SINGLE_BYTE_SIZE / BITS_IN_ROOM)
#ifdef PLATFORM_UNALIGNED_WORD_ACCESS
@@ -355,15 +399,15 @@ typedef unsigned char Bits;
typedef Bits BitSet[BITSET_SIZE];
typedef Bits* BitSetRef;
-#define SIZE_BITSET (int)sizeof(BitSet)
+#define SIZE_BITSET (int )sizeof(BitSet)
#define BITSET_CLEAR(bs) do {\
int i;\
- for (i = 0; i < (int )BITSET_SIZE; i++) { (bs)[i] = 0; } \
+ for (i = 0; i < BITSET_SIZE; i++) { (bs)[i] = 0; } \
} while (0)
-#define BS_ROOM(bs,pos) (bs)[pos / BITS_IN_ROOM]
-#define BS_BIT(pos) (1 << (pos % BITS_IN_ROOM))
+#define BS_ROOM(bs,pos) (bs)[(int )(pos) / BITS_IN_ROOM]
+#define BS_BIT(pos) (1 << ((int )(pos) % BITS_IN_ROOM))
#define BITSET_AT(bs, pos) (BS_ROOM(bs,pos) & BS_BIT(pos))
#define BITSET_SET_BIT(bs, pos) BS_ROOM(bs,pos) |= BS_BIT(pos)
@@ -402,7 +446,7 @@ typedef struct _BBuf {
} while (0)
#define BBUF_WRITE(buf,pos,bytes,n) do{\
- int used = (pos) + (int)(n);\
+ int used = (pos) + (int )(n);\
if ((buf)->alloc < (unsigned int )used) BBUF_EXPAND((buf),used);\
xmemcpy((buf)->p + (pos), (bytes), (n));\
if ((buf)->used < (unsigned int )used) (buf)->used = used;\
@@ -411,7 +455,7 @@ typedef struct _BBuf {
#define BBUF_WRITE1(buf,pos,byte) do{\
int used = (pos) + 1;\
if ((buf)->alloc < (unsigned int )used) BBUF_EXPAND((buf),used);\
- (buf)->p[(pos)] = (byte);\
+ (buf)->p[(pos)] = (UChar )(byte);\
if ((buf)->used < (unsigned int )used) (buf)->used = used;\
} while (0)
@@ -470,6 +514,8 @@ typedef struct _BBuf {
#define ANCHOR_ANYCHAR_STAR (1<<14) /* ".*" optimize info */
#define ANCHOR_ANYCHAR_STAR_ML (1<<15) /* ".*" optimize info (multi-line) */
+#define ANCHOR_KEEP (1<<16)
+
/* operation code */
enum OpCode {
OP_FINISH = 0, /* matching process terminator (no more alternative) */
@@ -513,12 +559,20 @@ enum OpCode {
OP_WORD_BEGIN,
OP_WORD_END,
+ OP_ASCII_WORD,
+ OP_NOT_ASCII_WORD,
+ OP_ASCII_WORD_BOUND,
+ OP_NOT_ASCII_WORD_BOUND,
+ OP_ASCII_WORD_BEGIN,
+ OP_ASCII_WORD_END,
+
OP_BEGIN_BUF,
OP_END_BUF,
OP_BEGIN_LINE,
OP_END_LINE,
OP_SEMI_END_BUF,
OP_BEGIN_POSITION,
+ OP_BEGIN_POS_OR_LINE, /* used for implicit anchor optimization */
OP_BACKREF1,
OP_BACKREF2,
@@ -535,6 +589,8 @@ enum OpCode {
OP_MEMORY_END,
OP_MEMORY_END_REC, /* push marker to stack */
+ OP_KEEP,
+
OP_FAIL, /* pop stack and move */
OP_JUMP,
OP_PUSH,
@@ -565,6 +621,8 @@ enum OpCode {
OP_CALL, /* \g<name> */
OP_RETURN,
+ OP_CONDITION,
+
OP_STATE_CHECK_PUSH, /* combination explosion check and push */
OP_STATE_CHECK_PUSH_OR_JUMP, /* check ok -> push, else jump */
OP_STATE_CHECK, /* check only */
@@ -585,15 +643,15 @@ typedef short int StateCheckNumType;
typedef void* PointerType;
#define SIZE_OPCODE 1
-#define SIZE_RELADDR (int)sizeof(RelAddrType)
-#define SIZE_ABSADDR (int)sizeof(AbsAddrType)
-#define SIZE_LENGTH (int)sizeof(LengthType)
-#define SIZE_MEMNUM (int)sizeof(MemNumType)
-#define SIZE_STATE_CHECK_NUM (int)sizeof(StateCheckNumType)
-#define SIZE_REPEATNUM (int)sizeof(RepeatNumType)
-#define SIZE_OPTION (int)sizeof(OnigOptionType)
-#define SIZE_CODE_POINT (int)sizeof(OnigCodePoint)
-#define SIZE_POINTER (int)sizeof(PointerType)
+#define SIZE_RELADDR (int )sizeof(RelAddrType)
+#define SIZE_ABSADDR (int )sizeof(AbsAddrType)
+#define SIZE_LENGTH (int )sizeof(LengthType)
+#define SIZE_MEMNUM (int )sizeof(MemNumType)
+#define SIZE_STATE_CHECK_NUM (int )sizeof(StateCheckNumType)
+#define SIZE_REPEATNUM (int )sizeof(RepeatNumType)
+#define SIZE_OPTION (int )sizeof(OnigOptionType)
+#define SIZE_CODE_POINT (int )sizeof(OnigCodePoint)
+#define SIZE_POINTER (int )sizeof(PointerType)
#define GET_RELADDR_INC(addr,p) PLATFORM_GET_INC(addr, p, RelAddrType)
@@ -645,6 +703,7 @@ typedef void* PointerType;
#define SIZE_OP_FAIL_LOOK_BEHIND_NOT SIZE_OPCODE
#define SIZE_OP_CALL (SIZE_OPCODE + SIZE_ABSADDR)
#define SIZE_OP_RETURN SIZE_OPCODE
+#define SIZE_OP_CONDITION (SIZE_OPCODE + SIZE_MEMNUM + SIZE_RELADDR)
#ifdef USE_COMBINATION_EXPLOSION_CHECK
#define SIZE_OP_STATE_CHECK (SIZE_OPCODE + SIZE_STATE_CHECK_NUM)
@@ -731,6 +790,7 @@ typedef struct _OnigStackType {
#ifdef USE_COMBINATION_EXPLOSION_CHECK
unsigned int state_check;
#endif
+ UChar *pkeep; /* keep pattern position */
} state;
struct {
int count; /* for OP_REPEAT_INC, OP_REPEAT_INC_NG */
@@ -743,7 +803,7 @@ typedef struct _OnigStackType {
struct {
int num; /* memory num */
UChar *pstr; /* start/end position */
- /* Following information is setted, if this stack type is MEM-START */
+ /* Following information is set, if this stack type is MEM-START */
OnigStackIndex start; /* prev. info (for backtrack "(...)*" ) */
OnigStackIndex end; /* prev. info (for backtrack "(...)*" ) */
} mem;
@@ -766,9 +826,10 @@ typedef struct {
size_t stack_n;
OnigOptionType options;
OnigRegion* region;
- const UChar* start; /* search start position (for \G: BEGIN_POSITION) */
+ const UChar* start; /* search start position */
+ const UChar* gpos; /* global position (for \G: BEGIN_POSITION) */
#ifdef USE_FIND_LONGEST_SEARCH_ALL_OF_RANGE
- int best_len; /* for ONIG_OPTION_FIND_LONGEST */
+ OnigPosition best_len; /* for ONIG_OPTION_FIND_LONGEST */
UChar* best_s;
#endif
#ifdef USE_COMBINATION_EXPLOSION_CHECK
@@ -799,7 +860,7 @@ extern void onig_print_statistics P_((FILE* f));
#endif
#endif
-extern UChar* onig_error_code_to_format P_((int code));
+extern UChar* onig_error_code_to_format P_((OnigPosition code));
extern void onig_snprintf_with_pattern PV_((UChar buf[], int bufsize, OnigEncoding enc, UChar* pat, UChar* pat_end, const UChar *fmt, ...));
extern int onig_bbuf_init P_((BBuf* buf, OnigDistance size));
extern int onig_compile P_((regex_t* reg, const UChar* pattern, const UChar* pattern_end, OnigErrorInfo* einfo, const char *sourcefile, int sourceline));
@@ -815,7 +876,8 @@ typedef void hash_table_type;
#include "ruby/st.h"
typedef st_data_t hash_data_type;
#else
-typedef unsigned long hash_data_type;
+#include "st.h"
+typedef uintptr_t hash_data_type;
#endif
extern hash_table_type* onig_st_init_strend_table_with_size P_((st_index_t size));
@@ -842,9 +904,8 @@ typedef int (*ONIGENC_INIT_PROPERTY_LIST_FUNC_TYPE)(void);
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 40c4aa580e..774ee0a960 100644
--- a/regparse.c
+++ b/regparse.c
@@ -1,9 +1,9 @@
-/* -*- mode:c; c-file-style:"gnu" -*- */
/**********************************************************************
- regparse.c - Oniguruma (regular expression library)
+ regparse.c - Onigmo (Oniguruma-mod) (regular expression library)
**********************************************************************/
/*-
* Copyright (c) 2002-2008 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
+ * Copyright (c) 2011-2013 K.Takata <kentkt AT csc DOT jp>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -50,7 +50,11 @@ const OnigSyntaxType OnigSyntaxRuby = {
ONIG_SYN_OP2_PLUS_POSSESSIVE_REPEAT |
ONIG_SYN_OP2_CCLASS_SET_OP | ONIG_SYN_OP2_ESC_CAPITAL_C_BAR_CONTROL |
ONIG_SYN_OP2_ESC_CAPITAL_M_BAR_META | ONIG_SYN_OP2_ESC_V_VTAB |
- ONIG_SYN_OP2_ESC_H_XDIGIT )
+ ONIG_SYN_OP2_ESC_H_XDIGIT |
+ ONIG_SYN_OP2_ESC_CAPITAL_X_EXTENDED_GRAPHEME_CLUSTER |
+ ONIG_SYN_OP2_QMARK_LPAREN_CONDITION |
+ ONIG_SYN_OP2_ESC_CAPITAL_R_LINEBREAK |
+ ONIG_SYN_OP2_ESC_CAPITAL_K_KEEP )
, ( SYN_GNU_REGEX_BV |
ONIG_SYN_ALLOW_INTERVAL_LOW_ABBREV |
ONIG_SYN_DIFFERENT_LEN_ALT_LOOK_BEHIND |
@@ -60,7 +64,8 @@ const OnigSyntaxType OnigSyntaxRuby = {
ONIG_SYN_WARN_CC_OP_NOT_ESCAPED |
ONIG_SYN_WARN_CC_DUP |
ONIG_SYN_WARN_REDUNDANT_NESTED_REPEAT )
- , ONIG_OPTION_NONE
+ , ( ONIG_OPTION_ASCII_RANGE | ONIG_OPTION_POSIX_BRACKET_ALL_RANGE |
+ ONIG_OPTION_WORD_BOUND_ALL_RANGE )
,
{
(OnigCodePoint )'\\' /* esc */
@@ -133,7 +138,7 @@ bbuf_clone(BBuf** rto, BBuf* from)
(OnigCodePoint )(ONIGENC_MBC_MINLEN(enc) > 1 ? 0 : 0x80)
#define SET_ALL_MULTI_BYTE_RANGE(enc, pbuf) \
- add_code_range_to_buf(pbuf, env, MBCODE_START_POS(enc), ~((OnigCodePoint )0))
+ add_code_range_to_buf(pbuf, env, MBCODE_START_POS(enc), ONIG_LAST_CODE_POINT)
#define ADD_ALL_MULTI_BYTE_RANGE(enc, mbuf) do {\
if (! ONIGENC_IS_SINGLEBYTE(enc)) {\
@@ -151,7 +156,7 @@ bbuf_clone(BBuf** rto, BBuf* from)
#define BITSET_IS_EMPTY(bs,empty) do {\
int i;\
empty = 1;\
- for (i = 0; i < (int )BITSET_SIZE; i++) {\
+ for (i = 0; i < BITSET_SIZE; i++) {\
if ((bs)[i] != 0) {\
empty = 0; break;\
}\
@@ -180,35 +185,35 @@ static void
bitset_invert(BitSetRef bs)
{
int i;
- for (i = 0; i < (int )BITSET_SIZE; i++) { bs[i] = ~(bs[i]); }
+ for (i = 0; i < BITSET_SIZE; i++) { bs[i] = ~(bs[i]); }
}
static void
bitset_invert_to(BitSetRef from, BitSetRef to)
{
int i;
- for (i = 0; i < (int )BITSET_SIZE; i++) { to[i] = ~(from[i]); }
+ for (i = 0; i < BITSET_SIZE; i++) { to[i] = ~(from[i]); }
}
static void
bitset_and(BitSetRef dest, BitSetRef bs)
{
int i;
- for (i = 0; i < (int )BITSET_SIZE; i++) { dest[i] &= bs[i]; }
+ for (i = 0; i < BITSET_SIZE; i++) { dest[i] &= bs[i]; }
}
static void
bitset_or(BitSetRef dest, BitSetRef bs)
{
int i;
- for (i = 0; i < (int )BITSET_SIZE; i++) { dest[i] |= bs[i]; }
+ for (i = 0; i < BITSET_SIZE; i++) { dest[i] |= bs[i]; }
}
static void
bitset_copy(BitSetRef dest, BitSetRef bs)
{
int i;
- for (i = 0; i < (int )BITSET_SIZE; i++) { dest[i] = bs[i]; }
+ for (i = 0; i < BITSET_SIZE; i++) { dest[i] = bs[i]; }
}
extern int
@@ -258,7 +263,12 @@ strdup_with_null(OnigEncoding enc, UChar* s, UChar* end)
/* scan pattern methods */
#define PEND_VALUE 0
+#ifdef __GNUC__
+/* get rid of Wunused-but-set-variable and Wuninitialized */
+#define PFETCH_READY UChar* pfetch_prev = NULL; (void)pfetch_prev
+#else
#define PFETCH_READY UChar* pfetch_prev
+#endif
#define PEND (p < end ? 0 : 1)
#define PUNFETCH p = pfetch_prev
#define PINC do { \
@@ -415,9 +425,6 @@ typedef struct {
typedef st_table NameTable;
typedef st_data_t HashDataType; /* 1.6 st.h doesn't define st_data_t type */
-#define NAMEBUF_SIZE 24
-#define NAMEBUF_SIZE_1 25
-
#ifdef ONIG_DEBUG
static int
i_print_name_entry(UChar* key, NameEntry* e, void* arg)
@@ -579,7 +586,7 @@ onig_number_of_names(regex_t* reg)
NameTable* t = (NameTable* )reg->name_table;
if (IS_NOT_NULL(t))
- return (int)t->num_entries;
+ return (int )t->num_entries;
else
return 0;
}
@@ -672,7 +679,7 @@ onig_names_free(regex_t* reg)
}
static NameEntry*
-name_find(regex_t* reg, UChar* name, UChar* name_end)
+name_find(regex_t* reg, const UChar* name, const UChar* name_end)
{
int i, len;
NameEntry* e;
@@ -776,10 +783,12 @@ name_add(regex_t* reg, UChar* name, UChar* name_end, int backref, ScanEnv* env)
}
else if (t->num == t->alloc) {
int i;
+ NameEntry* p;
alloc = t->alloc * 2;
- t->e = (NameEntry* )xrealloc(t->e, sizeof(NameEntry) * alloc);
- CHECK_NULL_RETURN_MEMERR(t->e);
+ p = (NameEntry* )xrealloc(t->e, sizeof(NameEntry) * alloc);
+ CHECK_NULL_RETURN_MEMERR(p);
+ t->e = p;
t->alloc = alloc;
clear:
@@ -821,9 +830,11 @@ name_add(regex_t* reg, UChar* name, UChar* name_end, int backref, ScanEnv* env)
}
else {
if (e->back_num > e->back_alloc) {
+ int* p;
alloc = e->back_alloc * 2;
- e->back_refs = (int* )xrealloc(e->back_refs, sizeof(int) * alloc);
- CHECK_NULL_RETURN_MEMERR(e->back_refs);
+ p = (int* )xrealloc(e->back_refs, sizeof(int) * alloc);
+ CHECK_NULL_RETURN_MEMERR(p);
+ e->back_refs = p;
e->back_alloc = alloc;
}
e->back_refs[e->back_num - 1] = backref;
@@ -1204,7 +1215,7 @@ node_new_cclass_by_codepoint_range(int not, OnigCodePoint sb_out,
}
static Node*
-node_new_ctype(int type, int not)
+node_new_ctype(int type, int not, int ascii_range)
{
Node* node = node_new();
CHECK_NULL_RETURN(node);
@@ -1212,6 +1223,7 @@ node_new_ctype(int type, int not)
SET_NTYPE(node, NT_CTYPE);
NCTYPE(node)->ctype = type;
NCTYPE(node)->not = not;
+ NCTYPE(node)->ascii_range = ascii_range;
return node;
}
@@ -1283,6 +1295,7 @@ onig_node_new_anchor(int type)
NANCHOR(node)->type = type;
NANCHOR(node)->target = NULL;
NANCHOR(node)->char_len = -1;
+ NANCHOR(node)->ascii_range = 0;
return node;
}
@@ -1450,7 +1463,7 @@ onig_node_str_cat(Node* node, const UChar* s, const UChar* end)
CHECK_NULL_RETURN_MEMERR(p);
NSTR(node)->s = p;
- NSTR(node)->capa = (int)capa;
+ NSTR(node)->capa = (int )capa;
}
}
else {
@@ -1478,6 +1491,15 @@ node_str_cat_char(Node* node, UChar c)
return onig_node_str_cat(node, s, s + 1);
}
+static int
+node_str_cat_codepoint(Node* node, OnigEncoding enc, OnigCodePoint c)
+{
+ UChar buf[ONIGENC_CODE_TO_MBC_MAXLEN];
+ int num = ONIGENC_CODE_TO_MBC(enc, c, buf);
+ if (num < 0) return num;
+ return onig_node_str_cat(node, buf, buf + num);
+}
+
extern void
onig_node_conv_to_str_node(Node* node, int flag)
{
@@ -1530,7 +1552,8 @@ static Node*
node_new_str_raw(UChar* s, UChar* end)
{
Node* node = node_new_str(s, end);
- NSTRING_SET_RAW(node);
+ if (IS_NOT_NULL(node))
+ NSTRING_SET_RAW(node);
return node;
}
@@ -1557,9 +1580,9 @@ str_node_split_last_char(StrNode* sn, OnigEncoding enc)
if (sn->end > sn->s) {
p = onigenc_get_prev_char_head(enc, sn->s, sn->end, sn->end);
- if (p && p > sn->s) { /* can be splitted. */
+ if (p && p > sn->s) { /* can be split. */
n = node_new_str(p, sn->end);
- if ((sn->flag & NSTR_RAW) != 0)
+ if (IS_NOT_NULL(n) && (sn->flag & NSTR_RAW) != 0)
NSTRING_SET_RAW(n);
sn->end = (UChar* )p;
}
@@ -1622,14 +1645,16 @@ onig_scan_unsigned_number(UChar** src, const UChar* end, OnigEncoding enc)
}
static int
-scan_unsigned_hexadecimal_number(UChar** src, UChar* end, int maxlen,
- OnigEncoding enc)
+scan_unsigned_hexadecimal_number(UChar** src, UChar* end, int minlen,
+ int maxlen, OnigEncoding enc)
{
OnigCodePoint c;
unsigned int num, val;
+ int restlen;
UChar* p = *src;
PFETCH_READY;
+ restlen = maxlen - minlen;
num = 0;
while (!PEND && maxlen-- != 0) {
PFETCH(c);
@@ -1645,6 +1670,8 @@ scan_unsigned_hexadecimal_number(UChar** src, UChar* end, int maxlen,
break;
}
}
+ if (maxlen > restlen)
+ return -2; /* not enough digits */
*src = p;
return num;
}
@@ -1708,7 +1735,7 @@ add_code_range_to_buf0(BBuf** pbuf, ScanEnv* env, OnigCodePoint from, OnigCodePo
int checkdup)
{
int r, inc_n, pos;
- int low, high, bound, x;
+ OnigCodePoint low, high, bound, x;
OnigCodePoint n, *data;
BBuf* bbuf;
@@ -1729,17 +1756,19 @@ add_code_range_to_buf0(BBuf** pbuf, ScanEnv* env, OnigCodePoint from, OnigCodePo
data = (OnigCodePoint* )(bbuf->p);
data++;
- for (low = 0, bound = n; low < bound; ) {
+ bound = (from == 0) ? 0 : n;
+ for (low = 0; low < bound; ) {
x = (low + bound) >> 1;
- if (from > data[x*2 + 1])
+ if (from - 1 > data[x*2 + 1])
low = x + 1;
else
bound = x;
}
- for (high = low, bound = n; high < bound; ) {
+ high = (to == ONIG_LAST_CODE_POINT) ? n : low;
+ for (bound = n; high < bound; ) {
x = (high + bound) >> 1;
- if (to >= data[x*2] - 1)
+ if (to + 1 >= data[x*2])
high = x + 1;
else
bound = x;
@@ -1754,21 +1783,23 @@ add_code_range_to_buf0(BBuf** pbuf, ScanEnv* env, OnigCodePoint from, OnigCodePo
if (inc_n != 1) {
if (checkdup && from <= data[low*2+1]
- && (data[low*2] <= from || data[low*2+1] <= to))
- CC_DUP_WARN(env);
+ && (data[low*2] <= from || data[low*2+1] <= to))
+ CC_DUP_WARN(env);
if (from > data[low*2])
from = data[low*2];
if (to < data[(high - 1)*2 + 1])
to = data[(high - 1)*2 + 1];
}
- if (inc_n != 0 && (OnigCodePoint )high < n) {
+ if (inc_n != 0) {
int from_pos = SIZE_CODE_POINT * (1 + high * 2);
int to_pos = SIZE_CODE_POINT * (1 + (low + 1) * 2);
- int size = (n - high) * 2 * SIZE_CODE_POINT;
if (inc_n > 0) {
- BBUF_MOVE_RIGHT(bbuf, from_pos, to_pos, size);
+ if (high < n) {
+ int size = (n - high) * 2 * SIZE_CODE_POINT;
+ BBUF_MOVE_RIGHT(bbuf, from_pos, to_pos, size);
+ }
}
else {
BBUF_MOVE_LEFT_REDUCE(bbuf, from_pos, to_pos);
@@ -1836,11 +1867,11 @@ not_code_range_buf(OnigEncoding enc, BBuf* bbuf, BBuf** pbuf, ScanEnv* env)
r = add_code_range_to_buf(pbuf, env, pre, from - 1);
if (r != 0) return r;
}
- if (to == ~((OnigCodePoint )0)) break;
+ if (to == ONIG_LAST_CODE_POINT) break;
pre = to + 1;
}
- if (to < ~((OnigCodePoint )0)) {
- r = add_code_range_to_buf(pbuf, env, to + 1, ~((OnigCodePoint )0));
+ if (to < ONIG_LAST_CODE_POINT) {
+ r = add_code_range_to_buf(pbuf, env, to + 1, ONIG_LAST_CODE_POINT);
}
return r;
}
@@ -2053,8 +2084,8 @@ and_cclass(CClassNode* dest, CClassNode* cc, ScanEnv* env)
}
}
if (r != 0) {
- bbuf_free(pbuf);
- return r;
+ bbuf_free(pbuf);
+ return r;
}
dest->mbuf = pbuf;
@@ -2111,8 +2142,8 @@ or_cclass(CClassNode* dest, CClassNode* cc, ScanEnv* env)
}
}
if (r != 0) {
- bbuf_free(pbuf);
- return r;
+ bbuf_free(pbuf);
+ return r;
}
dest->mbuf = pbuf;
@@ -2151,7 +2182,9 @@ conv_backslash_value(int c, ScanEnv* env)
return c;
}
-#if 0 /* no invalid quantifier */
+#ifdef USE_NO_INVALID_QUANTIFIER
+#define is_invalid_quantifier_target(node) 0
+#else
static int
is_invalid_quantifier_target(Node* node)
{
@@ -2183,8 +2216,6 @@ is_invalid_quantifier_target(Node* node)
}
return 0;
}
-#else
-#define is_invalid_quantifier_target(node) 0
#endif
/* ?:0, *:1, +:2, ??:3, *?:4, +?:5 */
@@ -2244,7 +2275,7 @@ onig_reduce_nested_quantifier(Node* pnode, Node* cnode)
cnum = popular_quantifier_num(c);
if (pnum < 0 || cnum < 0) return ;
- switch(ReduceTypeTable[cnum][pnum]) {
+ switch (ReduceTypeTable[cnum][pnum]) {
case RQ_DEL:
*pnode = *cnode;
break;
@@ -2303,6 +2334,9 @@ enum TokenSyms {
TK_CC_OPEN,
TK_QUOTE_OPEN,
TK_CHAR_PROPERTY, /* \p{...}, \P{...} */
+ TK_LINEBREAK,
+ TK_EXTENDED_GRAPHEME_CLUSTER,
+ TK_KEEP,
/* in cc */
TK_CC_CLOSE,
TK_CC_RANGE,
@@ -2320,8 +2354,10 @@ typedef struct {
UChar* s;
int c;
OnigCodePoint code;
- int anchor;
- int subtype;
+ struct {
+ int subtype;
+ int ascii_range;
+ } anchor;
struct {
int lower;
int upper;
@@ -2342,6 +2378,7 @@ typedef struct {
UChar* name;
UChar* name_end;
int gnum;
+ int rel;
} call;
struct {
int ctype;
@@ -2523,6 +2560,8 @@ get_name_end_code_point(OnigCodePoint start)
switch (start) {
case '<': return (OnigCodePoint )'>'; break;
case '\'': return (OnigCodePoint )'\''; break;
+ case '(': return (OnigCodePoint )')'; break;
+ case '{': return (OnigCodePoint )'}'; break;
default:
break;
}
@@ -2585,7 +2624,7 @@ fetch_name_with_level(OnigCodePoint start_code, UChar** src, UChar* end,
name_end = p;
PFETCH(c);
if (c == end_code || c == ')' || c == '+' || c == '-') {
- if (is_num == 2) r = ONIGERR_INVALID_GROUP_NAME;
+ if (is_num == 2) r = ONIGERR_INVALID_GROUP_NAME;
break;
}
@@ -2648,7 +2687,7 @@ fetch_name_with_level(OnigCodePoint start_code, UChar** src, UChar* end,
#endif /* USE_BACKREF_WITH_LEVEL */
/*
- def: 0 -> define name (don't allow number name)
+ ref: 0 -> define name (don't allow number name)
1 -> reference name (allow number name)
*/
static int
@@ -2710,7 +2749,7 @@ fetch_name(OnigCodePoint start_code, UChar** src, UChar* end,
name_end = p;
PFETCH(c);
if (c == end_code || c == ')') {
- if (is_num == 2) r = ONIGERR_INVALID_GROUP_NAME;
+ if (is_num == 2) r = ONIGERR_INVALID_GROUP_NAME;
break;
}
@@ -2883,8 +2922,8 @@ CLOSE_BRACKET_WITHOUT_ESC_WARN(ScanEnv* env, UChar* c)
{
if (onig_warn == onig_null_warn) return ;
- if (IS_SYNTAX_BV((env)->syntax, ONIG_SYN_WARN_CC_OP_NOT_ESCAPED)) {
- onig_syntax_warn(env, "regular expression has '%s' without escape", c);
+ if (IS_SYNTAX_BV(env->syntax, ONIG_SYN_WARN_CC_OP_NOT_ESCAPED)) {
+ onig_syntax_warn(env, "regular expression has '%s' without escape", c);
}
}
@@ -2893,9 +2932,9 @@ CC_DUP_WARN(ScanEnv *env)
{
if (onig_warn == onig_null_warn || !RTEST(ruby_verbose)) return ;
- if (IS_SYNTAX_BV((env)->syntax, ONIG_SYN_WARN_CC_DUP) &&
- !((env)->warnings_flag & ONIG_SYN_WARN_CC_DUP)) {
- (env)->warnings_flag |= ONIG_SYN_WARN_CC_DUP;
+ if (IS_SYNTAX_BV(env->syntax, ONIG_SYN_WARN_CC_DUP) &&
+ !(env->warnings_flag & ONIG_SYN_WARN_CC_DUP)) {
+ env->warnings_flag |= ONIG_SYN_WARN_CC_DUP;
onig_syntax_warn(env, "character class has duplicated range");
}
}
@@ -3014,32 +3053,32 @@ fetch_token_in_cc(OnigToken* tok, UChar** src, UChar* end, ScanEnv* env)
switch (c) {
case 'w':
tok->type = TK_CHAR_TYPE;
- tok->u.prop.ctype = ONIGENC_CTYPE_W;
+ tok->u.prop.ctype = ONIGENC_CTYPE_WORD;
tok->u.prop.not = 0;
break;
case 'W':
tok->type = TK_CHAR_TYPE;
- tok->u.prop.ctype = ONIGENC_CTYPE_W;
+ tok->u.prop.ctype = ONIGENC_CTYPE_WORD;
tok->u.prop.not = 1;
break;
case 'd':
tok->type = TK_CHAR_TYPE;
- tok->u.prop.ctype = ONIGENC_CTYPE_D;
+ tok->u.prop.ctype = ONIGENC_CTYPE_DIGIT;
tok->u.prop.not = 0;
break;
case 'D':
tok->type = TK_CHAR_TYPE;
- tok->u.prop.ctype = ONIGENC_CTYPE_D;
+ tok->u.prop.ctype = ONIGENC_CTYPE_DIGIT;
tok->u.prop.not = 1;
break;
case 's':
tok->type = TK_CHAR_TYPE;
- tok->u.prop.ctype = ONIGENC_CTYPE_S;
+ tok->u.prop.ctype = ONIGENC_CTYPE_SPACE;
tok->u.prop.not = 0;
break;
case 'S':
tok->type = TK_CHAR_TYPE;
- tok->u.prop.ctype = ONIGENC_CTYPE_S;
+ tok->u.prop.ctype = ONIGENC_CTYPE_SPACE;
tok->u.prop.not = 1;
break;
case 'h':
@@ -3074,7 +3113,7 @@ fetch_token_in_cc(OnigToken* tok, UChar** src, UChar* end, ScanEnv* env)
}
}
else {
- onig_syntax_warn(env, "invalid Unicode Property \\%c", c);
+ onig_syntax_warn(env, "invalid Unicode Property \\%c", c);
}
break;
@@ -3084,7 +3123,7 @@ fetch_token_in_cc(OnigToken* tok, UChar** src, UChar* end, ScanEnv* env)
prev = p;
if (PPEEK_IS('{') && IS_SYNTAX_OP(syn, ONIG_SYN_OP_ESC_X_BRACE_HEX8)) {
PINC;
- num = scan_unsigned_hexadecimal_number(&p, end, 8, enc);
+ num = scan_unsigned_hexadecimal_number(&p, end, 0, 8, enc);
if (num < 0) return ONIGERR_TOO_BIG_WIDE_CHAR_VALUE;
if (!PEND) {
c2 = PPEEK;
@@ -3104,7 +3143,7 @@ fetch_token_in_cc(OnigToken* tok, UChar** src, UChar* end, ScanEnv* env)
}
}
else if (IS_SYNTAX_OP(syn, ONIG_SYN_OP_ESC_X_HEX2)) {
- num = scan_unsigned_hexadecimal_number(&p, end, 2, enc);
+ num = scan_unsigned_hexadecimal_number(&p, end, 0, 2, enc);
if (num < 0) return ONIGERR_TOO_BIG_NUMBER;
if (p == prev) { /* can't read nothing. */
num = 0; /* but, it's not error */
@@ -3120,8 +3159,9 @@ fetch_token_in_cc(OnigToken* tok, UChar** src, UChar* end, ScanEnv* env)
prev = p;
if (IS_SYNTAX_OP2(syn, ONIG_SYN_OP2_ESC_U_HEX4)) {
- num = scan_unsigned_hexadecimal_number(&p, end, 4, enc);
- if (num < 0) return ONIGERR_TOO_BIG_NUMBER;
+ num = scan_unsigned_hexadecimal_number(&p, end, 4, 4, enc);
+ if (num < -1) return ONIGERR_TOO_SHORT_DIGITS;
+ else if (num < 0) return ONIGERR_TOO_BIG_NUMBER;
if (p == prev) { /* can't read nothing. */
num = 0; /* but, it's not error */
}
@@ -3161,7 +3201,7 @@ fetch_token_in_cc(OnigToken* tok, UChar** src, UChar* end, ScanEnv* env)
else if (c == '[') {
if (IS_SYNTAX_OP(syn, ONIG_SYN_OP_POSIX_BRACKET) && (PPEEK_IS(':'))) {
OnigCodePoint send[] = { (OnigCodePoint )':', (OnigCodePoint )']' };
- tok->backp = p; /* point at '[' is readed */
+ tok->backp = p; /* point at '[' is read */
PINC;
if (str_exist_check_with_esc(send, 2, p, end,
(OnigCodePoint )']', enc, syn)) {
@@ -3195,6 +3235,81 @@ fetch_token_in_cc(OnigToken* tok, UChar** src, UChar* end, ScanEnv* env)
return tok->type;
}
+#ifdef USE_NAMED_GROUP
+static int
+fetch_named_backref_token(OnigCodePoint c, OnigToken* tok, UChar** src,
+ UChar* end, ScanEnv* env)
+{
+ int r, num;
+ const OnigSyntaxType* syn = env->syntax;
+ UChar* prev;
+ UChar* p = *src;
+ UChar* name_end;
+ int* backs;
+ int back_num;
+
+ prev = p;
+
+#ifdef USE_BACKREF_WITH_LEVEL
+ name_end = NULL_UCHARP; /* no need. escape gcc warning. */
+ r = fetch_name_with_level(c, &p, end, &name_end,
+ env, &back_num, &tok->u.backref.level);
+ if (r == 1) tok->u.backref.exist_level = 1;
+ else tok->u.backref.exist_level = 0;
+#else
+ r = fetch_name(&p, end, &name_end, env, &back_num, 1);
+#endif
+ if (r < 0) return r;
+
+ if (back_num != 0) {
+ if (back_num < 0) {
+ back_num = BACKREF_REL_TO_ABS(back_num, env);
+ if (back_num <= 0)
+ return ONIGERR_INVALID_BACKREF;
+ }
+
+ if (IS_SYNTAX_BV(syn, ONIG_SYN_STRICT_CHECK_BACKREF)) {
+ if (back_num > env->num_mem ||
+ IS_NULL(SCANENV_MEM_NODES(env)[back_num]))
+ return ONIGERR_INVALID_BACKREF;
+ }
+ tok->type = TK_BACKREF;
+ tok->u.backref.by_name = 0;
+ tok->u.backref.num = 1;
+ tok->u.backref.ref1 = back_num;
+ }
+ else {
+ num = onig_name_to_group_numbers(env->reg, prev, name_end, &backs);
+ if (num <= 0) {
+ onig_scan_env_set_error_string(env,
+ ONIGERR_UNDEFINED_NAME_REFERENCE, prev, name_end);
+ return ONIGERR_UNDEFINED_NAME_REFERENCE;
+ }
+ if (IS_SYNTAX_BV(syn, ONIG_SYN_STRICT_CHECK_BACKREF)) {
+ int i;
+ for (i = 0; i < num; i++) {
+ if (backs[i] > env->num_mem ||
+ IS_NULL(SCANENV_MEM_NODES(env)[backs[i]]))
+ return ONIGERR_INVALID_BACKREF;
+ }
+ }
+
+ tok->type = TK_BACKREF;
+ tok->u.backref.by_name = 1;
+ if (num == 1) {
+ tok->u.backref.num = 1;
+ tok->u.backref.ref1 = backs[0];
+ }
+ else {
+ tok->u.backref.num = num;
+ tok->u.backref.refs = backs;
+ }
+ }
+ *src = p;
+ return 0;
+}
+#endif
+
static int
fetch_token(OnigToken* tok, UChar** src, UChar* end, ScanEnv* env)
{
@@ -3304,68 +3419,74 @@ fetch_token(OnigToken* tok, UChar** src, UChar* end, ScanEnv* env)
case 'w':
if (! IS_SYNTAX_OP(syn, ONIG_SYN_OP_ESC_W_WORD)) break;
tok->type = TK_CHAR_TYPE;
- tok->u.prop.ctype = ONIGENC_CTYPE_W;
+ tok->u.prop.ctype = ONIGENC_CTYPE_WORD;
tok->u.prop.not = 0;
break;
case 'W':
if (! IS_SYNTAX_OP(syn, ONIG_SYN_OP_ESC_W_WORD)) break;
tok->type = TK_CHAR_TYPE;
- tok->u.prop.ctype = ONIGENC_CTYPE_W;
+ tok->u.prop.ctype = ONIGENC_CTYPE_WORD;
tok->u.prop.not = 1;
break;
case 'b':
if (! IS_SYNTAX_OP(syn, ONIG_SYN_OP_ESC_B_WORD_BOUND)) break;
tok->type = TK_ANCHOR;
- tok->u.anchor = ANCHOR_WORD_BOUND;
+ tok->u.anchor.subtype = ANCHOR_WORD_BOUND;
+ tok->u.anchor.ascii_range = IS_ASCII_RANGE(env->option)
+ && ! IS_WORD_BOUND_ALL_RANGE(env->option);
break;
case 'B':
if (! IS_SYNTAX_OP(syn, ONIG_SYN_OP_ESC_B_WORD_BOUND)) break;
tok->type = TK_ANCHOR;
- tok->u.anchor = ANCHOR_NOT_WORD_BOUND;
+ tok->u.anchor.subtype = ANCHOR_NOT_WORD_BOUND;
+ tok->u.anchor.ascii_range = IS_ASCII_RANGE(env->option)
+ && ! IS_WORD_BOUND_ALL_RANGE(env->option);
break;
#ifdef USE_WORD_BEGIN_END
case '<':
if (! IS_SYNTAX_OP(syn, ONIG_SYN_OP_ESC_LTGT_WORD_BEGIN_END)) break;
tok->type = TK_ANCHOR;
- tok->u.anchor = ANCHOR_WORD_BEGIN;
+ tok->u.anchor.subtype = ANCHOR_WORD_BEGIN;
+ tok->u.anchor.ascii_range = IS_ASCII_RANGE(env->option);
break;
case '>':
if (! IS_SYNTAX_OP(syn, ONIG_SYN_OP_ESC_LTGT_WORD_BEGIN_END)) break;
tok->type = TK_ANCHOR;
- tok->u.anchor = ANCHOR_WORD_END;
+ tok->u.anchor.subtype = ANCHOR_WORD_END;
+ tok->u.anchor.ascii_range = IS_ASCII_RANGE(env->option);
break;
#endif
case 's':
if (! IS_SYNTAX_OP(syn, ONIG_SYN_OP_ESC_S_WHITE_SPACE)) break;
tok->type = TK_CHAR_TYPE;
- tok->u.prop.ctype = ONIGENC_CTYPE_S;
+ tok->u.prop.ctype = ONIGENC_CTYPE_SPACE;
tok->u.prop.not = 0;
break;
case 'S':
if (! IS_SYNTAX_OP(syn, ONIG_SYN_OP_ESC_S_WHITE_SPACE)) break;
tok->type = TK_CHAR_TYPE;
- tok->u.prop.ctype = ONIGENC_CTYPE_S;
+ tok->u.prop.ctype = ONIGENC_CTYPE_SPACE;
tok->u.prop.not = 1;
break;
case 'd':
if (! IS_SYNTAX_OP(syn, ONIG_SYN_OP_ESC_D_DIGIT)) break;
tok->type = TK_CHAR_TYPE;
- tok->u.prop.ctype = ONIGENC_CTYPE_D;
+ tok->u.prop.ctype = ONIGENC_CTYPE_DIGIT;
tok->u.prop.not = 0;
break;
case 'D':
if (! IS_SYNTAX_OP(syn, ONIG_SYN_OP_ESC_D_DIGIT)) break;
tok->type = TK_CHAR_TYPE;
- tok->u.prop.ctype = ONIGENC_CTYPE_D;
+ tok->u.prop.ctype = ONIGENC_CTYPE_DIGIT;
tok->u.prop.not = 1;
break;
@@ -3387,26 +3508,26 @@ fetch_token(OnigToken* tok, UChar** src, UChar* end, ScanEnv* env)
if (! IS_SYNTAX_OP(syn, ONIG_SYN_OP_ESC_AZ_BUF_ANCHOR)) break;
begin_buf:
tok->type = TK_ANCHOR;
- tok->u.subtype = ANCHOR_BEGIN_BUF;
+ tok->u.anchor.subtype = ANCHOR_BEGIN_BUF;
break;
case 'Z':
if (! IS_SYNTAX_OP(syn, ONIG_SYN_OP_ESC_AZ_BUF_ANCHOR)) break;
tok->type = TK_ANCHOR;
- tok->u.subtype = ANCHOR_SEMI_END_BUF;
+ tok->u.anchor.subtype = ANCHOR_SEMI_END_BUF;
break;
case 'z':
if (! IS_SYNTAX_OP(syn, ONIG_SYN_OP_ESC_AZ_BUF_ANCHOR)) break;
end_buf:
tok->type = TK_ANCHOR;
- tok->u.subtype = ANCHOR_END_BUF;
+ tok->u.anchor.subtype = ANCHOR_END_BUF;
break;
case 'G':
if (! IS_SYNTAX_OP(syn, ONIG_SYN_OP_ESC_CAPITAL_G_BEGIN_ANCHOR)) break;
tok->type = TK_ANCHOR;
- tok->u.subtype = ANCHOR_BEGIN_POSITION;
+ tok->u.anchor.subtype = ANCHOR_BEGIN_POSITION;
break;
case '`':
@@ -3425,7 +3546,7 @@ fetch_token(OnigToken* tok, UChar** src, UChar* end, ScanEnv* env)
prev = p;
if (PPEEK_IS('{') && IS_SYNTAX_OP(syn, ONIG_SYN_OP_ESC_X_BRACE_HEX8)) {
PINC;
- num = scan_unsigned_hexadecimal_number(&p, end, 8, enc);
+ num = scan_unsigned_hexadecimal_number(&p, end, 0, 8, enc);
if (num < 0) return ONIGERR_TOO_BIG_WIDE_CHAR_VALUE;
if (!PEND) {
if (ONIGENC_IS_CODE_XDIGIT(enc, PPEEK))
@@ -3443,7 +3564,7 @@ fetch_token(OnigToken* tok, UChar** src, UChar* end, ScanEnv* env)
}
}
else if (IS_SYNTAX_OP(syn, ONIG_SYN_OP_ESC_X_HEX2)) {
- num = scan_unsigned_hexadecimal_number(&p, end, 2, enc);
+ num = scan_unsigned_hexadecimal_number(&p, end, 0, 2, enc);
if (num < 0) return ONIGERR_TOO_BIG_NUMBER;
if (p == prev) { /* can't read nothing. */
num = 0; /* but, it's not error */
@@ -3459,8 +3580,9 @@ fetch_token(OnigToken* tok, UChar** src, UChar* end, ScanEnv* env)
prev = p;
if (IS_SYNTAX_OP2(syn, ONIG_SYN_OP2_ESC_U_HEX4)) {
- num = scan_unsigned_hexadecimal_number(&p, end, 4, enc);
- if (num < 0) return ONIGERR_TOO_BIG_NUMBER;
+ num = scan_unsigned_hexadecimal_number(&p, end, 4, 4, enc);
+ if (num < -1) return ONIGERR_TOO_SHORT_DIGITS;
+ else if (num < 0) return ONIGERR_TOO_BIG_NUMBER;
if (p == prev) { /* can't read nothing. */
num = 0; /* but, it's not error */
}
@@ -3527,98 +3649,69 @@ fetch_token(OnigToken* tok, UChar** src, UChar* end, ScanEnv* env)
if (IS_SYNTAX_OP2(syn, ONIG_SYN_OP2_ESC_K_NAMED_BACKREF)) {
PFETCH(c);
if (c == '<' || c == '\'') {
- UChar* name_end;
- int* backs;
- int back_num;
-
- prev = p;
-
-#ifdef USE_BACKREF_WITH_LEVEL
- name_end = NULL_UCHARP; /* no need. escape gcc warning. */
- r = fetch_name_with_level((OnigCodePoint )c, &p, end, &name_end,
- env, &back_num, &tok->u.backref.level);
- if (r == 1) tok->u.backref.exist_level = 1;
- else tok->u.backref.exist_level = 0;
-#else
- r = fetch_name(&p, end, &name_end, env, &back_num, 1);
-#endif
+ r = fetch_named_backref_token(c, tok, &p, end, env);
if (r < 0) return r;
-
- if (back_num != 0) {
- if (back_num < 0) {
- back_num = BACKREF_REL_TO_ABS(back_num, env);
- if (back_num <= 0)
- return ONIGERR_INVALID_BACKREF;
- }
-
- if (IS_SYNTAX_BV(syn, ONIG_SYN_STRICT_CHECK_BACKREF)) {
- if (back_num > env->num_mem ||
- IS_NULL(SCANENV_MEM_NODES(env)[back_num]))
- return ONIGERR_INVALID_BACKREF;
- }
- tok->type = TK_BACKREF;
- tok->u.backref.by_name = 0;
- tok->u.backref.num = 1;
- tok->u.backref.ref1 = back_num;
- }
- else {
- num = onig_name_to_group_numbers(env->reg, prev, name_end, &backs);
- if (num <= 0) {
- onig_scan_env_set_error_string(env,
- ONIGERR_UNDEFINED_NAME_REFERENCE, prev, name_end);
- return ONIGERR_UNDEFINED_NAME_REFERENCE;
- }
- if (IS_SYNTAX_BV(syn, ONIG_SYN_STRICT_CHECK_BACKREF)) {
- int i;
- for (i = 0; i < num; i++) {
- if (backs[i] > env->num_mem ||
- IS_NULL(SCANENV_MEM_NODES(env)[backs[i]]))
- return ONIGERR_INVALID_BACKREF;
- }
- }
-
- tok->type = TK_BACKREF;
- tok->u.backref.by_name = 1;
- if (num == 1) {
- tok->u.backref.num = 1;
- tok->u.backref.ref1 = backs[0];
- }
- else {
- tok->u.backref.num = num;
- tok->u.backref.refs = backs;
- }
- }
}
else {
- PUNFETCH;
- onig_syntax_warn(env, "invalid back reference");
+ PUNFETCH;
+ onig_syntax_warn(env, "invalid back reference");
}
}
break;
#endif
-#ifdef USE_SUBEXP_CALL
+#if defined(USE_SUBEXP_CALL) || defined(USE_NAMED_GROUP)
case 'g':
+#ifdef USE_NAMED_GROUP
+ if (IS_SYNTAX_OP2(syn, ONIG_SYN_OP2_ESC_G_BRACE_BACKREF)) {
+ PFETCH(c);
+ if (c == '{') {
+ r = fetch_named_backref_token(c, tok, &p, end, env);
+ if (r < 0) return r;
+ }
+ else
+ PUNFETCH;
+ }
+#endif
+#ifdef USE_SUBEXP_CALL
if (IS_SYNTAX_OP2(syn, ONIG_SYN_OP2_ESC_G_SUBEXP_CALL)) {
PFETCH(c);
if (c == '<' || c == '\'') {
- int gnum;
+ int gnum = -1, rel = 0;
UChar* name_end;
-
+ OnigCodePoint cnext;
+
+ cnext = PPEEK;
+ if (cnext == '0') {
+ PINC;
+ if (PPEEK_IS(get_name_end_code_point(c))) { /* \g<0>, \g'0' */
+ PINC;
+ name_end = p;
+ gnum = 0;
+ }
+ }
+ else if (cnext == '+') {
+ PINC;
+ rel = 1;
+ }
prev = p;
- r = fetch_name((OnigCodePoint )c, &p, end, &name_end, env, &gnum, 1);
- if (r < 0) return r;
+ if (gnum < 0) {
+ r = fetch_name((OnigCodePoint )c, &p, end, &name_end, env, &gnum, 1);
+ if (r < 0) return r;
+ }
tok->type = TK_CALL;
tok->u.call.name = prev;
tok->u.call.name_end = name_end;
tok->u.call.gnum = gnum;
+ tok->u.call.rel = rel;
}
else {
- onig_syntax_warn(env, "invalid subexp call");
- PUNFETCH;
+ onig_syntax_warn(env, "invalid subexp call");
+ PUNFETCH;
}
}
+#endif
break;
#endif
@@ -3646,7 +3739,25 @@ fetch_token(OnigToken* tok, UChar** src, UChar* end, ScanEnv* env)
}
}
else {
- onig_syntax_warn(env, "invalid Unicode Property \\%c", c);
+ onig_syntax_warn(env, "invalid Unicode Property \\%c", c);
+ }
+ break;
+
+ case 'R':
+ if (IS_SYNTAX_OP2(syn, ONIG_SYN_OP2_ESC_CAPITAL_R_LINEBREAK)) {
+ tok->type = TK_LINEBREAK;
+ }
+ break;
+
+ case 'X':
+ if (IS_SYNTAX_OP2(syn, ONIG_SYN_OP2_ESC_CAPITAL_X_EXTENDED_GRAPHEME_CLUSTER)) {
+ tok->type = TK_EXTENDED_GRAPHEME_CLUSTER;
+ }
+ break;
+
+ case 'K':
+ if (IS_SYNTAX_OP2(syn, ONIG_SYN_OP2_ESC_CAPITAL_K_KEEP)) {
+ tok->type = TK_KEEP;
}
break;
@@ -3766,6 +3877,97 @@ fetch_token(OnigToken* tok, UChar** src, UChar* end, ScanEnv* env)
}
goto start;
}
+#ifdef USE_PERL_SUBEXP_CALL
+ /* (?&name), (?n), (?R), (?0), (?+n), (?-n) */
+ c = PPEEK;
+ if ((c == '&' || c == 'R' || ONIGENC_IS_CODE_DIGIT(enc, c)) &&
+ IS_SYNTAX_OP2(env->syntax, ONIG_SYN_OP2_QMARK_SUBEXP_CALL)) {
+ /* (?&name), (?n), (?R), (?0) */
+ int gnum;
+ UChar *name;
+ UChar *name_end;
+
+ if (c == 'R' || c == '0') {
+ PINC; /* skip 'R' / '0' */
+ if (!PPEEK_IS(')')) return ONIGERR_INVALID_GROUP_NAME;
+ PINC; /* skip ')' */
+ name_end = name = p;
+ gnum = 0;
+ }
+ else {
+ int numref = 1;
+ if (c == '&') { /* (?&name) */
+ PINC;
+ numref = 0; /* don't allow number name */
+ }
+ name = p;
+ r = fetch_name((OnigCodePoint )'(', &p, end, &name_end, env, &gnum, numref);
+ if (r < 0) return r;
+ }
+
+ tok->type = TK_CALL;
+ tok->u.call.name = name;
+ tok->u.call.name_end = name_end;
+ tok->u.call.gnum = gnum;
+ tok->u.call.rel = 0;
+ break;
+ }
+ else if ((c == '-' || c == '+') &&
+ IS_SYNTAX_OP2(env->syntax, ONIG_SYN_OP2_QMARK_SUBEXP_CALL)) {
+ /* (?+n), (?-n) */
+ int gnum;
+ UChar *name;
+ UChar *name_end;
+ OnigCodePoint cnext;
+ PFETCH_READY;
+
+ PINC; /* skip '-' / '+' */
+ cnext = PPEEK;
+ if (ONIGENC_IS_CODE_DIGIT(enc, cnext)) {
+ if (c == '-') PUNFETCH;
+ name = p;
+ r = fetch_name((OnigCodePoint )'(', &p, end, &name_end, env, &gnum, 1);
+ if (r < 0) return r;
+
+ tok->type = TK_CALL;
+ tok->u.call.name = name;
+ tok->u.call.name_end = name_end;
+ tok->u.call.gnum = gnum;
+ tok->u.call.rel = 1;
+ break;
+ }
+ }
+#endif /* USE_PERL_SUBEXP_CALL */
+#ifdef USE_CAPITAL_P_NAMED_GROUP
+ if (PPEEK_IS('P') &&
+ IS_SYNTAX_OP2(env->syntax, ONIG_SYN_OP2_QMARK_CAPITAL_P_NAMED_GROUP)) {
+ int gnum;
+ UChar *name;
+ UChar *name_end;
+ PFETCH_READY;
+
+ PINC; /* skip 'P' */
+ PFETCH(c);
+ if (c == '=') { /* (?P=name): backref */
+ r = fetch_named_backref_token((OnigCodePoint )'(', tok, &p, end, env);
+ if (r < 0) return r;
+ break;
+ }
+ else if (c == '>') { /* (?P>name): subexp call */
+ name = p;
+ r = fetch_name((OnigCodePoint )'(', &p, end, &name_end, env, &gnum, 0);
+ if (r < 0) return r;
+
+ tok->type = TK_CALL;
+ tok->u.call.name = name;
+ tok->u.call.name_end = name_end;
+ tok->u.call.gnum = gnum;
+ tok->u.call.rel = 0;
+ break;
+ }
+ PUNFETCH;
+ }
+#endif /* USE_CAPITAL_P_NAMED_GROUP */
PUNFETCH;
}
@@ -3781,15 +3983,15 @@ fetch_token(OnigToken* tok, UChar** src, UChar* end, ScanEnv* env)
case '^':
if (! IS_SYNTAX_OP(syn, ONIG_SYN_OP_LINE_ANCHOR)) break;
tok->type = TK_ANCHOR;
- tok->u.subtype = (IS_SINGLELINE(env->option)
- ? ANCHOR_BEGIN_BUF : ANCHOR_BEGIN_LINE);
+ tok->u.anchor.subtype = (IS_SINGLELINE(env->option)
+ ? ANCHOR_BEGIN_BUF : ANCHOR_BEGIN_LINE);
break;
case '$':
if (! IS_SYNTAX_OP(syn, ONIG_SYN_OP_LINE_ANCHOR)) break;
tok->type = TK_ANCHOR;
- tok->u.subtype = (IS_SINGLELINE(env->option)
- ? ANCHOR_SEMI_END_BUF : ANCHOR_END_LINE);
+ tok->u.anchor.subtype = (IS_SINGLELINE(env->option)
+ ? ANCHOR_SEMI_END_BUF : ANCHOR_END_LINE);
break;
case '[':
@@ -3906,43 +4108,56 @@ 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, ScanEnv* env)
+add_ctype_to_cc(CClassNode* cc, int ctype, int not, int char_prop, ScanEnv* env)
{
+ int maxcode, ascii_range;
int c, r;
const OnigCodePoint *ranges;
OnigCodePoint sb_out;
OnigEncoding enc = env->enc;
+ OnigOptionType option = env->option;
- switch (ctype) {
- case ONIGENC_CTYPE_D:
- case ONIGENC_CTYPE_S:
- case ONIGENC_CTYPE_W:
- ctype ^= ONIGENC_CTYPE_SPECIAL_MASK;
- if (not != 0) {
- for (c = 0; c < SINGLE_BYTE_SIZE; c++) {
- if (! ONIGENC_IS_ASCII_CODE_CTYPE((OnigCodePoint )c, ctype))
- BITSET_SET_BIT_CHKDUP(cc->bs, c);
+ ascii_range = IS_ASCII_RANGE(option) && (char_prop == 0);
+
+ r = ONIGENC_GET_CTYPE_CODE_RANGE(enc, ctype, &sb_out, &ranges);
+ if (r == 0) {
+ if (ascii_range) {
+ CClassNode ccwork;
+ initialize_cclass(&ccwork);
+ r = add_ctype_to_cc_by_range(&ccwork, ctype, not, env, sb_out,
+ ranges);
+ if (r == 0) {
+ if (not) {
+ r = add_code_range_to_buf0(&(ccwork.mbuf), env, 0x80, ONIG_LAST_CODE_POINT, FALSE);
+ }
+ else {
+ CClassNode ccascii;
+ initialize_cclass(&ccascii);
+ if (ONIGENC_MBC_MINLEN(env->enc) > 1) {
+ add_code_range(&(ccascii.mbuf), env, 0x00, 0x7F);
+ }
+ else {
+ bitset_set_range(env, ccascii.bs, 0x00, 0x7F);
+ }
+ r = and_cclass(&ccwork, &ccascii, env);
+ if (IS_NOT_NULL(ccascii.mbuf)) bbuf_free(ccascii.mbuf);
+ }
+ if (r == 0) {
+ r = or_cclass(cc, &ccwork, env);
+ }
+ if (IS_NOT_NULL(ccwork.mbuf)) bbuf_free(ccwork.mbuf);
}
- ADD_ALL_MULTI_BYTE_RANGE(enc, cc->mbuf);
}
else {
- for (c = 0; c < SINGLE_BYTE_SIZE; c++) {
- if (ONIGENC_IS_ASCII_CODE_CTYPE((OnigCodePoint )c, ctype))
- BITSET_SET_BIT_CHKDUP(cc->bs, c);
- }
+ r = add_ctype_to_cc_by_range(cc, ctype, not, env, sb_out, ranges);
}
- return 0;
- break;
- }
-
- r = ONIGENC_GET_CTYPE_CODE_RANGE(enc, ctype, &sb_out, &ranges);
- if (r == 0) {
- return add_ctype_to_cc_by_range(cc, ctype, not, env, sb_out, ranges);
+ return r;
}
else if (r != ONIG_NO_SUPPORT_CONFIG) {
return r;
}
+ maxcode = ascii_range ? 0x80 : SINGLE_BYTE_SIZE;
r = 0;
switch (ctype) {
case ONIGENC_CTYPE_ALPHA:
@@ -3975,32 +4190,39 @@ add_ctype_to_cc(CClassNode* cc, int ctype, int not, ScanEnv* env)
case ONIGENC_CTYPE_PRINT:
if (not != 0) {
for (c = 0; c < SINGLE_BYTE_SIZE; c++) {
- if (! ONIGENC_IS_CODE_CTYPE(enc, (OnigCodePoint )c, ctype))
+ if (! ONIGENC_IS_CODE_CTYPE(enc, (OnigCodePoint )c, ctype)
+ || c >= maxcode)
BITSET_SET_BIT_CHKDUP(cc->bs, c);
}
+ if (ascii_range)
+ ADD_ALL_MULTI_BYTE_RANGE(enc, cc->mbuf);
}
else {
- for (c = 0; c < SINGLE_BYTE_SIZE; c++) {
+ for (c = 0; c < maxcode; c++) {
if (ONIGENC_IS_CODE_CTYPE(enc, (OnigCodePoint )c, ctype))
BITSET_SET_BIT_CHKDUP(cc->bs, c);
}
- ADD_ALL_MULTI_BYTE_RANGE(enc, cc->mbuf);
+ if (! ascii_range)
+ ADD_ALL_MULTI_BYTE_RANGE(enc, cc->mbuf);
}
break;
case ONIGENC_CTYPE_WORD:
if (not == 0) {
- for (c = 0; c < SINGLE_BYTE_SIZE; c++) {
- if (IS_CODE_SB_WORD(enc, c)) BITSET_SET_BIT_CHKDUP(cc->bs, c);
+ for (c = 0; c < maxcode; c++) {
+ if (ONIGENC_IS_CODE_WORD(enc, c)) BITSET_SET_BIT_CHKDUP(cc->bs, c);
}
- ADD_ALL_MULTI_BYTE_RANGE(enc, cc->mbuf);
+ if (! ascii_range)
+ ADD_ALL_MULTI_BYTE_RANGE(enc, cc->mbuf);
}
else {
for (c = 0; c < SINGLE_BYTE_SIZE; c++) {
if ((ONIGENC_CODE_TO_MBCLEN(enc, c) > 0) /* check invalid code point */
- && ! ONIGENC_IS_CODE_WORD(enc, c))
+ && (! ONIGENC_IS_CODE_WORD(enc, c) || c >= maxcode))
BITSET_SET_BIT_CHKDUP(cc->bs, c);
}
+ if (ascii_range)
+ ADD_ALL_MULTI_BYTE_RANGE(enc, cc->mbuf);
}
break;
@@ -4059,7 +4281,9 @@ parse_posix_bracket(CClassNode* cc, UChar** src, UChar* end, ScanEnv* env)
if (onigenc_with_ascii_strncmp(enc, p, end, (UChar* )":]", 2) != 0)
return ONIGERR_INVALID_POSIX_BRACKET_TYPE;
- r = add_ctype_to_cc(cc, pb->ctype, not, env);
+ r = add_ctype_to_cc(cc, pb->ctype, not,
+ IS_POSIX_BRACKET_ALL_RANGE(env->option),
+ env);
if (r != 0) return r;
PINC; PINC;
@@ -4132,7 +4356,7 @@ 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, env);
+ r = add_ctype_to_cc(cc, ctype, 0, 1, env);
if (r != 0) return r;
if (tok->u.prop.not != 0) NCCLASS_SET_NOT(cc);
@@ -4347,7 +4571,7 @@ parse_char_class(Node** np, OnigToken* tok, UChar** src, UChar* end,
UChar* psave = p;
int i, base = tok->base;
- buf[0] = tok->u.c;
+ buf[0] = (UChar )tok->u.c;
for (i = 1; i < ONIGENC_MBC_MAXLEN(env->enc); i++) {
r = fetch_token_in_cc(tok, &p, end, env);
if (r < 0) goto err;
@@ -4355,7 +4579,7 @@ parse_char_class(Node** np, OnigToken* tok, UChar** src, UChar* end,
fetched = 1;
break;
}
- buf[i] = tok->u.c;
+ buf[i] = (UChar )tok->u.c;
}
if (i < ONIGENC_MBC_MINLEN(env->enc)) {
@@ -4424,7 +4648,7 @@ 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, env);
+ r = add_ctype_to_cc(cc, tok->u.prop.ctype, tok->u.prop.not, 0, env);
if (r != 0) return r;
next_class:
@@ -4438,7 +4662,7 @@ 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, env);
+ r = add_ctype_to_cc(cc, ctype, tok->u.prop.not, 1, env);
if (r != 0) return r;
goto next_class;
}
@@ -4491,7 +4715,7 @@ parse_char_class(Node** np, OnigToken* tok, UChar** src, UChar* end,
if (IS_SYNTAX_BV(env->syntax, ONIG_SYN_ALLOW_DOUBLE_RANGE_OP_IN_CC)) {
CC_ESC_WARN(env, (UChar* )"-");
- goto range_end_val; /* [0-9-a] is allowed as [0-9\-a] */
+ goto range_end_val; /* [0-9-a] is allowed as [0-9\-a] */
}
r = ONIGERR_UNMATCHED_RANGE_SPECIFIER_IN_CHAR_CLASS;
goto err;
@@ -4586,8 +4810,10 @@ parse_char_class(Node** np, OnigToken* tok, UChar** src, UChar* end,
if (ONIGENC_IS_CODE_NEWLINE(env->enc, NEWLINE_CODE)) {
if (ONIGENC_CODE_TO_MBCLEN(env->enc, NEWLINE_CODE) == 1)
BITSET_SET_BIT_CHKDUP(cc->bs, NEWLINE_CODE);
- else
- add_code_range(&(cc->mbuf), env, NEWLINE_CODE, NEWLINE_CODE);
+ else {
+ r = add_code_range(&(cc->mbuf), env, NEWLINE_CODE, NEWLINE_CODE);
+ if (r < 0) goto err;
+ }
}
}
}
@@ -4607,8 +4833,8 @@ static int
parse_enclose(Node** np, OnigToken* tok, int term, UChar** src, UChar* end,
ScanEnv* env)
{
- int r, num;
- Node *target;
+ int r = 0, num;
+ Node *target, *work1 = NULL, *work2 = NULL;
OnigOptionType option;
OnigCodePoint c;
OnigEncoding enc = env->enc;
@@ -4644,10 +4870,10 @@ parse_enclose(Node** np, OnigToken* tok, int term, UChar** src, UChar* end,
case '=':
*np = onig_node_new_anchor(ANCHOR_PREC_READ);
break;
- case '!': /* preceding read */
+ case '!': /* preceding read */
*np = onig_node_new_anchor(ANCHOR_PREC_READ_NOT);
break;
- case '>': /* (?>...) stop backtrack */
+ case '>': /* (?>...) stop backtrack */
*np = node_new_enclose(ENCLOSE_STOP_BACKTRACK);
break;
@@ -4659,6 +4885,16 @@ parse_enclose(Node** np, OnigToken* tok, int term, UChar** src, UChar* end,
else
return ONIGERR_UNDEFINED_GROUP_OPTION;
break;
+
+#ifdef USE_CAPITAL_P_NAMED_GROUP
+ case 'P': /* (?P<name>...) */
+ if (IS_SYNTAX_OP2(env->syntax, ONIG_SYN_OP2_QMARK_CAPITAL_P_NAMED_GROUP)) {
+ PFETCH(c);
+ if (c == '<') goto named_group1;
+ }
+ return ONIGERR_UNDEFINED_GROUP_OPTION;
+ break;
+#endif
#endif
case '<': /* look behind (?<=...), (?<!...) */
@@ -4668,7 +4904,7 @@ parse_enclose(Node** np, OnigToken* tok, int term, UChar** src, UChar* end,
else if (c == '!')
*np = onig_node_new_anchor(ANCHOR_LOOK_BEHIND_NOT);
#ifdef USE_NAMED_GROUP
- else {
+ else { /* (?<name>...) */
if (IS_SYNTAX_OP2(env->syntax, ONIG_SYN_OP2_QMARK_LT_NAMED_GROUP)) {
UChar *name;
UChar *name_end;
@@ -4740,10 +4976,106 @@ parse_enclose(Node** np, OnigToken* tok, int term, UChar** src, UChar* end,
}
break;
+ case '(': /* conditional expression: (?(cond)yes), (?(cond)yes|no) */
+ if (IS_SYNTAX_OP2(env->syntax, ONIG_SYN_OP2_QMARK_LPAREN_CONDITION)) {
+ UChar *name = NULL;
+ UChar *name_end;
+ PFETCH(c);
+ if (ONIGENC_IS_CODE_DIGIT(enc, c)) { /* (n) */
+ PUNFETCH;
+ r = fetch_name((OnigCodePoint )'(', &p, end, &name_end, env, &num, 1);
+ if (r < 0) return r;
+ if (num < 0) {
+ num = BACKREF_REL_TO_ABS(num, env);
+ if (num <= 0)
+ return ONIGERR_INVALID_BACKREF;
+ }
+ if (IS_SYNTAX_BV(env->syntax, ONIG_SYN_STRICT_CHECK_BACKREF)) {
+ if (num > env->num_mem ||
+ IS_NULL(SCANENV_MEM_NODES(env)[num]))
+ return ONIGERR_INVALID_BACKREF;
+ }
+ }
+#ifdef USE_NAMED_GROUP
+ else if (c == '<' || c == '\'') { /* (<name>), ('name') */
+ int nums;
+ int *backs;
+
+ name = p;
+ r = fetch_name((OnigCodePoint )c, &p, end, &name_end, env, &num, 0);
+ if (r < 0) return r;
+ PFETCH(c);
+ if (c != ')') return ONIGERR_UNDEFINED_GROUP_OPTION;
+
+ nums = onig_name_to_group_numbers(env->reg, name, name_end, &backs);
+ if (nums <= 0) {
+ onig_scan_env_set_error_string(env,
+ ONIGERR_UNDEFINED_NAME_REFERENCE, name, name_end);
+ return ONIGERR_UNDEFINED_NAME_REFERENCE;
+ }
+ if (IS_SYNTAX_BV(env->syntax, ONIG_SYN_STRICT_CHECK_BACKREF)) {
+ int i;
+ for (i = 0; i < nums; i++) {
+ if (backs[i] > env->num_mem ||
+ IS_NULL(SCANENV_MEM_NODES(env)[backs[i]]))
+ return ONIGERR_INVALID_BACKREF;
+ }
+ }
+ num = backs[0]; /* XXX: use left most named group as Perl */
+ }
+#endif
+ else
+ return ONIGERR_INVALID_CONDITION_PATTERN;
+ *np = node_new_enclose(ENCLOSE_CONDITION);
+ CHECK_NULL_RETURN_MEMERR(*np);
+ NENCLOSE(*np)->regnum = num;
+ if (IS_NOT_NULL(name)) NENCLOSE(*np)->state |= NST_NAME_REF;
+ }
+ else
+ return ONIGERR_UNDEFINED_GROUP_OPTION;
+ break;
+
+#if 0
+ case '|': /* branch reset: (?|...) */
+ if (IS_SYNTAX_OP2(env->syntax, ONIG_SYN_OP2_QMARK_VBAR_BRANCH_RESET)) {
+ /* TODO */
+ }
+ else
+ return ONIGERR_UNDEFINED_GROUP_OPTION;
+ break;
+#endif
+
+ case '^': /* loads default options */
+ if (IS_SYNTAX_OP2(env->syntax, ONIG_SYN_OP2_OPTION_PERL)) {
+ /* d-imsx */
+ ONOFF(option, ONIG_OPTION_ASCII_RANGE, 1);
+ ONOFF(option, ONIG_OPTION_IGNORECASE, 1);
+ ONOFF(option, ONIG_OPTION_SINGLELINE, 0);
+ ONOFF(option, ONIG_OPTION_MULTILINE, 1);
+ ONOFF(option, ONIG_OPTION_EXTEND, 1);
+ PFETCH(c);
+ }
+#if 0
+ else if (IS_SYNTAX_OP2(env->syntax, ONIG_SYN_OP2_OPTION_RUBY)) {
+ /* d-imx */
+ ONOFF(option, ONIG_OPTION_ASCII_RANGE, 0);
+ ONOFF(option, ONIG_OPTION_POSIX_BRACKET_ALL_RANGE, 0);
+ ONOFF(option, ONIG_OPTION_WORD_BOUND_ALL_RANGE, 0);
+ ONOFF(option, ONIG_OPTION_IGNORECASE, 1);
+ ONOFF(option, ONIG_OPTION_MULTILINE, 1);
+ ONOFF(option, ONIG_OPTION_EXTEND, 1);
+ PFETCH(c);
+ }
+#endif
+ else {
+ return ONIGERR_UNDEFINED_GROUP_OPTION;
+ }
+ /* fall through */
#ifdef USE_POSIXLINE_OPTION
case 'p':
#endif
case '-': case 'i': case 'm': case 's': case 'x':
+ case 'a': case 'd': case 'l': case 'u':
{
int neg = 0;
@@ -4779,6 +5111,54 @@ parse_enclose(Node** np, OnigToken* tok, int term, UChar** src, UChar* end,
ONOFF(option, ONIG_OPTION_MULTILINE|ONIG_OPTION_SINGLELINE, neg);
break;
#endif
+
+ case 'a': /* limits \d, \s, \w and POSIX brackets to ASCII range */
+ if ((IS_SYNTAX_OP2(env->syntax, ONIG_SYN_OP2_OPTION_PERL) ||
+ IS_SYNTAX_OP2(env->syntax, ONIG_SYN_OP2_OPTION_RUBY)) &&
+ (neg == 0)) {
+ ONOFF(option, ONIG_OPTION_ASCII_RANGE, 0);
+ ONOFF(option, ONIG_OPTION_POSIX_BRACKET_ALL_RANGE, 1);
+ ONOFF(option, ONIG_OPTION_WORD_BOUND_ALL_RANGE, 1);
+ }
+ else
+ return ONIGERR_UNDEFINED_GROUP_OPTION;
+ break;
+
+ case 'u':
+ if ((IS_SYNTAX_OP2(env->syntax, ONIG_SYN_OP2_OPTION_PERL) ||
+ IS_SYNTAX_OP2(env->syntax, ONIG_SYN_OP2_OPTION_RUBY)) &&
+ (neg == 0)) {
+ ONOFF(option, ONIG_OPTION_ASCII_RANGE, 1);
+ ONOFF(option, ONIG_OPTION_POSIX_BRACKET_ALL_RANGE, 1);
+ ONOFF(option, ONIG_OPTION_WORD_BOUND_ALL_RANGE, 1);
+ }
+ else
+ return ONIGERR_UNDEFINED_GROUP_OPTION;
+ break;
+
+ case 'd':
+ if (IS_SYNTAX_OP2(env->syntax, ONIG_SYN_OP2_OPTION_PERL) &&
+ (neg == 0)) {
+ ONOFF(option, ONIG_OPTION_ASCII_RANGE, 1);
+ }
+ else if (IS_SYNTAX_OP2(env->syntax, ONIG_SYN_OP2_OPTION_RUBY) &&
+ (neg == 0)) {
+ ONOFF(option, ONIG_OPTION_ASCII_RANGE, 0);
+ ONOFF(option, ONIG_OPTION_POSIX_BRACKET_ALL_RANGE, 0);
+ ONOFF(option, ONIG_OPTION_WORD_BOUND_ALL_RANGE, 0);
+ }
+ else
+ return ONIGERR_UNDEFINED_GROUP_OPTION;
+ break;
+
+ case 'l':
+ if (IS_SYNTAX_OP2(env->syntax, ONIG_SYN_OP2_OPTION_PERL) && (neg == 0)) {
+ ONOFF(option, ONIG_OPTION_ASCII_RANGE, 1);
+ }
+ else
+ return ONIGERR_UNDEFINED_GROUP_OPTION;
+ break;
+
default:
return ONIGERR_UNDEFINED_GROUP_OPTION;
}
@@ -4844,10 +5224,29 @@ parse_enclose(Node** np, OnigToken* tok, int term, UChar** src, UChar* end,
r = scan_env_set_mem_node(env, NENCLOSE(*np)->regnum, *np);
if (r != 0) return r;
}
+ else if (NENCLOSE(*np)->type == ENCLOSE_CONDITION) {
+ if (NTYPE(target) != NT_ALT) {
+ /* convert (?(cond)yes) to (?(cond)yes|empty) */
+ work1 = node_new_empty();
+ if (IS_NULL(work1)) goto err;
+ work2 = onig_node_new_alt(work1, NULL_NODE);
+ if (IS_NULL(work2)) goto err;
+ work1 = onig_node_new_alt(target, work2);
+ if (IS_NULL(work1)) goto err;
+ NENCLOSE(*np)->target = work1;
+ }
+ }
}
*src = p;
return 0;
+
+ err:
+ onig_node_free(work1);
+ onig_node_free(work2);
+ onig_node_free(*np);
+ *np = NULL;
+ return ONIGERR_MEMORY;
}
static const char* const PopularQStr[] = {
@@ -4894,7 +5293,7 @@ set_quantifier(Node* qnode, Node* target, int group, ScanEnv* env)
IS_SYNTAX_BV(env->syntax, ONIG_SYN_WARN_REDUNDANT_NESTED_REPEAT)) {
UChar buf[WARN_BUFSIZE];
- switch(ReduceTypeTable[targetq_num][nestq_num]) {
+ switch (ReduceTypeTable[targetq_num][nestq_num]) {
case RQ_ASIS:
break;
@@ -5141,6 +5540,207 @@ i_apply_case_fold(OnigCodePoint from, OnigCodePoint to[],
}
static int
+node_linebreak(Node** np, ScanEnv* env)
+{
+ /* same as (?>\x0D\x0A|[\x0A-\x0D\x{85}\x{2028}\x{2029}]) */
+ Node* left = NULL;
+ Node* right = NULL;
+ Node* target1 = NULL;
+ Node* target2 = NULL;
+ CClassNode* cc;
+ int num1, num2;
+ UChar buf[ONIGENC_CODE_TO_MBC_MAXLEN * 2];
+
+ /* \x0D\x0A */
+ num1 = ONIGENC_CODE_TO_MBC(env->enc, 0x0D, buf);
+ if (num1 < 0) return num1;
+ num2 = ONIGENC_CODE_TO_MBC(env->enc, 0x0A, buf + num1);
+ if (num2 < 0) return num2;
+ left = node_new_str_raw(buf, buf + num1 + num2);
+ if (IS_NULL(left)) goto err;
+
+ /* [\x0A-\x0D] or [\x0A-\x0D\x{85}\x{2028}\x{2029}] */
+ right = node_new_cclass();
+ if (IS_NULL(right)) goto err;
+ cc = NCCLASS(right);
+ if (ONIGENC_MBC_MINLEN(env->enc) > 1) {
+ add_code_range(&(cc->mbuf), env, 0x0A, 0x0D);
+ }
+ else {
+ bitset_set_range(env, cc->bs, 0x0A, 0x0D);
+ }
+
+ /* TODO: move this block to enc/unicode.c */
+ if (ONIGENC_IS_UNICODE(env->enc)) {
+ /* UTF-8, UTF-16BE/LE, UTF-32BE/LE */
+ add_code_range(&(cc->mbuf), env, 0x85, 0x85);
+ add_code_range(&(cc->mbuf), env, 0x2028, 0x2029);
+ }
+
+ /* ...|... */
+ target1 = onig_node_new_alt(right, NULL_NODE);
+ if (IS_NULL(target1)) goto err;
+ right = NULL;
+ target2 = onig_node_new_alt(left, target1);
+ if (IS_NULL(target2)) goto err;
+ left = NULL;
+ target1 = NULL;
+
+ /* (?>...) */
+ *np = node_new_enclose(ENCLOSE_STOP_BACKTRACK);
+ if (IS_NULL(*np)) goto err;
+ NENCLOSE(*np)->target = target2;
+ return ONIG_NORMAL;
+
+ err:
+ onig_node_free(left);
+ onig_node_free(right);
+ onig_node_free(target1);
+ onig_node_free(target2);
+ return ONIGERR_MEMORY;
+}
+
+static int
+node_extended_grapheme_cluster(Node** np, ScanEnv* env)
+{
+ /* same as (?>\P{M}\p{M}*) */
+ Node* np1 = NULL;
+ Node* np2 = NULL;
+ Node* qn = NULL;
+ Node* list1 = NULL;
+ Node* list2 = NULL;
+ int r = 0;
+
+#ifdef USE_UNICODE_PROPERTIES
+ if (ONIGENC_IS_UNICODE(env->enc)) {
+ /* UTF-8, UTF-16BE/LE, UTF-32BE/LE */
+ CClassNode* cc1;
+ CClassNode* cc2;
+ UChar* propname = (UChar* )"M";
+ int ctype = env->enc->property_name_to_ctype(ONIG_ENCODING_ASCII,
+ propname, propname + 1);
+ if (ctype >= 0) {
+ /* \P{M} */
+ np1 = node_new_cclass();
+ if (IS_NULL(np1)) goto err;
+ cc1 = NCCLASS(np1);
+ r = add_ctype_to_cc(cc1, ctype, 0, 1, env);
+ if (r != 0) goto err;
+ NCCLASS_SET_NOT(cc1);
+
+ /* \p{M}* */
+ np2 = node_new_cclass();
+ if (IS_NULL(np2)) goto err;
+ cc2 = NCCLASS(np2);
+ r = add_ctype_to_cc(cc2, ctype, 0, 1, env);
+ if (r != 0) goto err;
+
+ qn = node_new_quantifier(0, REPEAT_INFINITE, 0);
+ if (IS_NULL(qn)) goto err;
+ NQTFR(qn)->target = np2;
+ np2 = NULL;
+
+ /* \P{M}\p{M}* */
+ list2 = node_new_list(qn, NULL_NODE);
+ if (IS_NULL(list2)) goto err;
+ qn = NULL;
+ list1 = node_new_list(np1, list2);
+ if (IS_NULL(list1)) goto err;
+ np1 = NULL;
+ list2 = NULL;
+
+ /* (?>...) */
+ *np = node_new_enclose(ENCLOSE_STOP_BACKTRACK);
+ if (IS_NULL(*np)) goto err;
+ NENCLOSE(*np)->target = list1;
+ return ONIG_NORMAL;
+ }
+ }
+#endif /* USE_UNICODE_PROPERTIES */
+ if (IS_NULL(*np)) {
+ /* PerlSyntax: (?s:.), RubySyntax: (?m:.) */
+ OnigOptionType option;
+ np1 = node_new_anychar();
+ if (IS_NULL(np1)) goto err;
+
+ option = env->option;
+ ONOFF(option, ONIG_OPTION_MULTILINE, 0);
+ *np = node_new_option(option);
+ if (IS_NULL(*np)) goto err;
+ NENCLOSE(*np)->target = np1;
+ }
+ return ONIG_NORMAL;
+
+ err:
+ onig_node_free(np1);
+ onig_node_free(np2);
+ onig_node_free(qn);
+ onig_node_free(list1);
+ onig_node_free(list2);
+ return (r == 0) ? ONIGERR_MEMORY : r;
+}
+
+static int
+countbits(unsigned int bits)
+{
+ bits = (bits & 0x55555555) + ((bits >> 1) & 0x55555555);
+ bits = (bits & 0x33333333) + ((bits >> 2) & 0x33333333);
+ bits = (bits & 0x0f0f0f0f) + ((bits >> 4) & 0x0f0f0f0f);
+ bits = (bits & 0x00ff00ff) + ((bits >> 8) & 0x00ff00ff);
+ return (bits & 0x0000ffff) + ((bits >>16) & 0x0000ffff);
+}
+
+static int
+is_onechar_cclass(CClassNode* cc, OnigCodePoint* code)
+{
+ const OnigCodePoint not_found = ONIG_LAST_CODE_POINT;
+ OnigCodePoint c = not_found;
+ int i;
+ BBuf *bbuf = cc->mbuf;
+
+ if (IS_NCCLASS_NOT(cc)) return 0;
+
+ /* check bbuf */
+ if (IS_NOT_NULL(bbuf)) {
+ OnigCodePoint n, *data;
+ GET_CODE_POINT(n, bbuf->p);
+ data = (OnigCodePoint* )(bbuf->p) + 1;
+ if ((n == 1) && (data[0] == data[1])) {
+ /* only one char found in the bbuf, save the code point. */
+ c = data[0];
+ if (((c < SINGLE_BYTE_SIZE) && BITSET_AT(cc->bs, c))) {
+ /* skip if c is included in the bitset */
+ c = not_found;
+ }
+ }
+ else {
+ return 0; /* the bbuf contains multiple chars */
+ }
+ }
+
+ /* check bitset */
+ for (i = 0; i < BITSET_SIZE; i++) {
+ Bits b1 = cc->bs[i];
+ if (b1 != 0) {
+ if (((b1 & (b1 - 1)) == 0) && (c == not_found)) {
+ c = BITS_IN_ROOM * i + countbits(b1 - 1);
+ } else {
+ return 0; /* the character class contains multiple chars */
+ }
+ }
+ }
+
+ if (c != not_found) {
+ *code = c;
+ return 1;
+ }
+
+ /* the character class contains no char. */
+ return 0;
+}
+
+
+static int
parse_exp(Node** np, OnigToken* tok, int term,
UChar** src, UChar* end, ScanEnv* env)
{
@@ -5158,6 +5758,7 @@ parse_exp(Node** np, OnigToken* tok, int term,
end_of_token:
*np = node_new_empty();
return tok->type;
+ break;
case TK_SUBEXP_OPEN:
r = parse_enclose(np, tok, TK_SUBEXP_CLOSE, src, end, env);
@@ -5189,18 +5790,42 @@ parse_exp(Node** np, OnigToken* tok, int term,
else goto tk_byte;
break;
+ case TK_LINEBREAK:
+ r = node_linebreak(np, env);
+ if (r < 0) return r;
+ break;
+
+ case TK_EXTENDED_GRAPHEME_CLUSTER:
+ r = node_extended_grapheme_cluster(np, env);
+ if (r < 0) return r;
+ break;
+
+ case TK_KEEP:
+ *np = onig_node_new_anchor(ANCHOR_KEEP);
+ CHECK_NULL_RETURN_MEMERR(*np);
+ break;
+
case TK_STRING:
tk_byte:
{
*np = node_new_str(tok->backp, *src);
CHECK_NULL_RETURN_MEMERR(*np);
+ string_loop:
while (1) {
r = fetch_token(tok, src, end, env);
if (r < 0) return r;
- if (r != TK_STRING) break;
-
- r = onig_node_str_cat(*np, tok->backp, *src);
+ if (r == TK_STRING) {
+ r = onig_node_str_cat(*np, tok->backp, *src);
+ }
+#ifndef NUMBERED_CHAR_IS_NOT_CASE_AMBIG
+ else if (r == TK_CODE_POINT) {
+ r = node_str_cat_codepoint(*np, env->enc, tok->u.code);
+ }
+#endif
+ else {
+ break;
+ }
if (r < 0) return r;
}
@@ -5253,15 +5878,15 @@ parse_exp(Node** np, OnigToken* tok, int term,
case TK_CODE_POINT:
{
- UChar buf[ONIGENC_CODE_TO_MBC_MAXLEN];
- int num = ONIGENC_CODE_TO_MBC(env->enc, tok->u.code, buf);
- if (num < 0) return num;
+ *np = node_new_empty();
+ CHECK_NULL_RETURN_MEMERR(*np);
+ r = node_str_cat_codepoint(*np, env->enc, tok->u.code);
+ if (r != 0) return r;
#ifdef NUMBERED_CHAR_IS_NOT_CASE_AMBIG
- *np = node_new_str_raw(buf, buf + num);
+ NSTRING_SET_RAW(*np);
#else
- *np = node_new_str(buf, buf + num);
+ goto string_loop;
#endif
- CHECK_NULL_RETURN_MEMERR(*np);
}
break;
@@ -5286,21 +5911,9 @@ parse_exp(Node** np, OnigToken* tok, int term,
case TK_CHAR_TYPE:
{
switch (tok->u.prop.ctype) {
- case ONIGENC_CTYPE_D:
- case ONIGENC_CTYPE_S:
- case ONIGENC_CTYPE_W:
- {
- CClassNode* cc;
- *np = node_new_cclass();
- CHECK_NULL_RETURN_MEMERR(*np);
- cc = NCCLASS(*np);
- add_ctype_to_cc(cc, tok->u.prop.ctype, 0, env);
- if (tok->u.prop.not != 0) NCCLASS_SET_NOT(cc);
- }
- break;
-
case ONIGENC_CTYPE_WORD:
- *np = node_new_ctype(tok->u.prop.ctype, tok->u.prop.not);
+ *np = node_new_ctype(tok->u.prop.ctype, tok->u.prop.not,
+ IS_ASCII_RANGE(env->option));
CHECK_NULL_RETURN_MEMERR(*np);
break;
@@ -5317,6 +5930,7 @@ parse_exp(Node** np, OnigToken* tok, int term,
r = ONIGENC_GET_CTYPE_CODE_RANGE(env->enc, tok->u.prop.ctype,
&sb_out, &mbr);
if (r == 0 &&
+ ! IS_ASCII_RANGE(env->option) &&
ONIGENC_CODE_RANGE_NUM(mbr)
>= THRESHOLD_RANGE_NUM_FOR_SHARE_CCLASS) {
type_cclass_key key;
@@ -5365,7 +5979,8 @@ parse_exp(Node** np, OnigToken* tok, int term,
*np = node_new_cclass();
CHECK_NULL_RETURN_MEMERR(*np);
cc = NCCLASS(*np);
- add_ctype_to_cc(cc, tok->u.prop.ctype, 0, env);
+ r = add_ctype_to_cc(cc, tok->u.prop.ctype, 0, 0, env);
+ if (r != 0) return r;
if (tok->u.prop.not != 0) NCCLASS_SET_NOT(cc);
#ifdef USE_SHARED_CCLASS_TABLE
}
@@ -5388,11 +6003,20 @@ parse_exp(Node** np, OnigToken* tok, int term,
case TK_CC_OPEN:
{
CClassNode* cc;
+ OnigCodePoint code;
r = parse_char_class(np, tok, src, end, env);
if (r != 0) return r;
cc = NCCLASS(*np);
+ if (is_onechar_cclass(cc, &code)) {
+ onig_node_free(*np);
+ *np = node_new_empty();
+ CHECK_NULL_RETURN_MEMERR(*np);
+ r = node_str_cat_codepoint(*np, env->enc, code);
+ if (r != 0) return r;
+ goto string_loop;
+ }
if (IS_IGNORECASE(env->option)) {
IApplyCaseFoldArg iarg;
@@ -5451,7 +6075,8 @@ parse_exp(Node** np, OnigToken* tok, int term,
{
int gnum = tok->u.call.gnum;
- if (gnum < 0) {
+ if (gnum < 0 || tok->u.call.rel != 0) {
+ if (gnum > 0) gnum--;
gnum = BACKREF_REL_TO_ABS(gnum, env);
if (gnum <= 0)
return ONIGERR_INVALID_BACKREF;
@@ -5464,7 +6089,9 @@ parse_exp(Node** np, OnigToken* tok, int term,
#endif
case TK_ANCHOR:
- *np = onig_node_new_anchor(tok->u.anchor);
+ *np = onig_node_new_anchor(tok->u.anchor.subtype);
+ CHECK_NULL_RETURN_MEMERR(*np);
+ NANCHOR(*np)->ascii_range = tok->u.anchor.ascii_range;
break;
case TK_OP_REPEAT:
@@ -5522,7 +6149,7 @@ parse_exp(Node** np, OnigToken* tok, int term,
*targetp = qn;
}
else if (r == 1) {
- onig_node_free(qn);
+ onig_node_free(qn);
}
else if (r == 2) { /* split case: /abc+/ */
Node *tmp;
@@ -5647,6 +6274,21 @@ parse_regexp(Node** top, UChar** src, UChar* end, ScanEnv* env)
if (r < 0) return r;
r = parse_subexp(top, &tok, TK_EOT, src, end, env);
if (r < 0) return r;
+
+#ifdef USE_SUBEXP_CALL
+ if (env->num_call > 0) {
+ /* Capture the pattern itself. It is used for (?R), (?0) and \g<0>. */
+ const int num = 0;
+ Node* np;
+ np = node_new_enclose_memory(env->option, 0);
+ CHECK_NULL_RETURN_MEMERR(np);
+ NENCLOSE(np)->regnum = num;
+ NENCLOSE(np)->target = *top;
+ r = scan_env_set_mem_node(env, num, np);
+ if (r != 0) return r;
+ *top = np;
+ }
+#endif
return 0;
}
diff --git a/regparse.h b/regparse.h
index e1a00ddfda..c92babfebe 100644
--- a/regparse.h
+++ b/regparse.h
@@ -1,10 +1,11 @@
#ifndef ONIGURUMA_REGPARSE_H
#define ONIGURUMA_REGPARSE_H
/**********************************************************************
- regparse.h - Oniguruma (regular expression library)
+ regparse.h - Onigmo (Oniguruma-mod) (regular expression library)
**********************************************************************/
/*-
* Copyright (c) 2002-2007 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
+ * Copyright (c) 2011 K.Takata <kentkt AT csc DOT jp>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -31,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
@@ -91,6 +90,7 @@
#define ENCLOSE_MEMORY (1<<0)
#define ENCLOSE_OPTION (1<<1)
#define ENCLOSE_STOP_BACKTRACK (1<<2)
+#define ENCLOSE_CONDITION (1<<3)
#define NODE_STR_MARGIN 16
#define NODE_STR_BUF_SIZE 24 /* sizeof(CClassNode) - sizeof(int)*4 */
@@ -100,7 +100,7 @@
#define NSTR_AMBIG (1<<1)
#define NSTR_DONT_GET_OPT_INFO (1<<2)
-#define NSTRING_LEN(node) (OnigDistance)((node)->u.str.end - (node)->u.str.s)
+#define NSTRING_LEN(node) (OnigDistance )((node)->u.str.end - (node)->u.str.s)
#define NSTRING_SET_RAW(node) (node)->u.str.flag |= NSTR_RAW
#define NSTRING_CLEAR_RAW(node) (node)->u.str.flag &= ~NSTR_RAW
#define NSTRING_SET_AMBIG(node) (node)->u.str.flag |= NSTR_AMBIG
@@ -150,6 +150,7 @@
#define IS_ENCLOSE_STOP_BT_SIMPLE_REPEAT(en) \
(((en)->state & NST_STOP_BT_SIMPLE_REPEAT) != 0)
#define IS_ENCLOSE_NAMED_GROUP(en) (((en)->state & NST_NAMED_GROUP) != 0)
+#define IS_ENCLOSE_NAME_REF(en) (((en)->state & NST_NAME_REF) != 0)
#define SET_CALL_RECURSION(node) (node)->u.call.state |= NST_RECURSION
#define IS_CALL_RECURSION(cn) (((cn)->state & NST_RECURSION) != 0)
@@ -240,6 +241,7 @@ typedef struct {
int type;
struct _Node* target;
int char_len;
+ int ascii_range;
} AnchorNode;
typedef struct {
@@ -252,6 +254,7 @@ typedef struct {
NodeBase base;
int ctype;
int not;
+ int ascii_range;
} CtypeNode;
typedef struct _Node {
@@ -355,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/regsyntax.c b/regsyntax.c
index fc639dfcdf..7cb98f2d46 100644
--- a/regsyntax.c
+++ b/regsyntax.c
@@ -1,8 +1,9 @@
/**********************************************************************
- regsyntax.c - Oniguruma (regular expression library)
+ regsyntax.c - Onigmo (Oniguruma-mod) (regular expression library)
**********************************************************************/
/*-
* Copyright (c) 2002-2006 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
+ * Copyright (c) 2011-2012 K.Takata <kentkt AT csc DOT jp>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -153,7 +154,8 @@ const OnigSyntaxType OnigSyntaxJava = {
ONIG_SYN_OP2_ESC_V_VTAB | ONIG_SYN_OP2_ESC_U_HEX4 |
ONIG_SYN_OP2_ESC_P_BRACE_CHAR_PROPERTY )
, ( SYN_GNU_REGEX_BV | ONIG_SYN_DIFFERENT_LEN_ALT_LOOK_BEHIND )
- , ONIG_OPTION_SINGLELINE
+ , ( ONIG_OPTION_SINGLELINE | ONIG_OPTION_ASCII_RANGE |
+ ONIG_OPTION_WORD_BOUND_ALL_RANGE )
,
{
(OnigCodePoint )'\\' /* esc */
@@ -165,7 +167,8 @@ const OnigSyntaxType OnigSyntaxJava = {
}
};
-const OnigSyntaxType OnigSyntaxPerl = {
+/* Perl 5.8 */
+const OnigSyntaxType OnigSyntaxPerl58 = {
(( SYN_GNU_REGEX_OP | ONIG_SYN_OP_QMARK_NON_GREEDY |
ONIG_SYN_OP_ESC_OCTAL3 | ONIG_SYN_OP_ESC_X_HEX2 |
ONIG_SYN_OP_ESC_X_BRACE_HEX8 | ONIG_SYN_OP_ESC_CONTROL_CHARS |
@@ -174,7 +177,9 @@ const OnigSyntaxType OnigSyntaxPerl = {
, ( ONIG_SYN_OP2_ESC_CAPITAL_Q_QUOTE |
ONIG_SYN_OP2_QMARK_GROUP_EFFECT | ONIG_SYN_OP2_OPTION_PERL |
ONIG_SYN_OP2_ESC_P_BRACE_CHAR_PROPERTY |
- ONIG_SYN_OP2_ESC_P_BRACE_CIRCUMFLEX_NOT )
+ ONIG_SYN_OP2_ESC_P_BRACE_CIRCUMFLEX_NOT |
+ ONIG_SYN_OP2_ESC_CAPITAL_X_EXTENDED_GRAPHEME_CLUSTER |
+ ONIG_SYN_OP2_QMARK_LPAREN_CONDITION)
, SYN_GNU_REGEX_BV
, ONIG_OPTION_SINGLELINE
,
@@ -188,8 +193,8 @@ const OnigSyntaxType OnigSyntaxPerl = {
}
};
-/* Perl + named group */
-const OnigSyntaxType OnigSyntaxPerl_NG = {
+/* Perl 5.8 + named group */
+const OnigSyntaxType OnigSyntaxPerl58_NG = {
(( SYN_GNU_REGEX_OP | ONIG_SYN_OP_QMARK_NON_GREEDY |
ONIG_SYN_OP_ESC_OCTAL3 | ONIG_SYN_OP_ESC_X_HEX2 |
ONIG_SYN_OP_ESC_X_BRACE_HEX8 | ONIG_SYN_OP_ESC_CONTROL_CHARS |
@@ -199,6 +204,8 @@ const OnigSyntaxType OnigSyntaxPerl_NG = {
ONIG_SYN_OP2_QMARK_GROUP_EFFECT | ONIG_SYN_OP2_OPTION_PERL |
ONIG_SYN_OP2_ESC_P_BRACE_CHAR_PROPERTY |
ONIG_SYN_OP2_ESC_P_BRACE_CIRCUMFLEX_NOT |
+ ONIG_SYN_OP2_ESC_CAPITAL_X_EXTENDED_GRAPHEME_CLUSTER |
+ ONIG_SYN_OP2_QMARK_LPAREN_CONDITION |
ONIG_SYN_OP2_QMARK_LT_NAMED_GROUP |
ONIG_SYN_OP2_ESC_K_NAMED_BACKREF |
ONIG_SYN_OP2_ESC_G_SUBEXP_CALL )
@@ -217,6 +224,71 @@ const OnigSyntaxType OnigSyntaxPerl_NG = {
}
};
+/* Perl 5.10+ */
+const OnigSyntaxType OnigSyntaxPerl = {
+ (( SYN_GNU_REGEX_OP | ONIG_SYN_OP_QMARK_NON_GREEDY |
+ ONIG_SYN_OP_ESC_OCTAL3 | ONIG_SYN_OP_ESC_X_HEX2 |
+ ONIG_SYN_OP_ESC_X_BRACE_HEX8 | ONIG_SYN_OP_ESC_CONTROL_CHARS |
+ ONIG_SYN_OP_ESC_C_CONTROL )
+ & ~ONIG_SYN_OP_ESC_LTGT_WORD_BEGIN_END )
+ , ( ONIG_SYN_OP2_ESC_CAPITAL_Q_QUOTE |
+ ONIG_SYN_OP2_QMARK_GROUP_EFFECT | ONIG_SYN_OP2_OPTION_PERL |
+ ONIG_SYN_OP2_ESC_P_BRACE_CHAR_PROPERTY |
+ ONIG_SYN_OP2_ESC_P_BRACE_CIRCUMFLEX_NOT |
+ ONIG_SYN_OP2_ESC_CAPITAL_X_EXTENDED_GRAPHEME_CLUSTER |
+ ONIG_SYN_OP2_QMARK_LPAREN_CONDITION |
+ ONIG_SYN_OP2_PLUS_POSSESSIVE_REPEAT |
+ ONIG_SYN_OP2_PLUS_POSSESSIVE_INTERVAL |
+ ONIG_SYN_OP2_ESC_CAPITAL_R_LINEBREAK |
+ ONIG_SYN_OP2_ESC_CAPITAL_K_KEEP |
+ ONIG_SYN_OP2_QMARK_SUBEXP_CALL |
+ ONIG_SYN_OP2_ESC_G_BRACE_BACKREF |
+ ONIG_SYN_OP2_QMARK_CAPITAL_P_NAMED_GROUP |
+ ONIG_SYN_OP2_QMARK_LT_NAMED_GROUP |
+ ONIG_SYN_OP2_ESC_K_NAMED_BACKREF )
+ , ( SYN_GNU_REGEX_BV |
+ ONIG_SYN_ALLOW_MULTIPLEX_DEFINITION_NAME |
+ ONIG_SYN_ALLOW_MULTIPLEX_DEFINITION_NAME_CALL )
+ , ( ONIG_OPTION_SINGLELINE | ONIG_OPTION_CAPTURE_GROUP )
+ ,
+ {
+ (OnigCodePoint )'\\' /* esc */
+ , (OnigCodePoint )ONIG_INEFFECTIVE_META_CHAR /* anychar '.' */
+ , (OnigCodePoint )ONIG_INEFFECTIVE_META_CHAR /* anytime '*' */
+ , (OnigCodePoint )ONIG_INEFFECTIVE_META_CHAR /* zero or one time '?' */
+ , (OnigCodePoint )ONIG_INEFFECTIVE_META_CHAR /* one or more time '+' */
+ , (OnigCodePoint )ONIG_INEFFECTIVE_META_CHAR /* anychar anytime */
+ }
+};
+
+const OnigSyntaxType OnigSyntaxPython = {
+ (( SYN_GNU_REGEX_OP | ONIG_SYN_OP_QMARK_NON_GREEDY |
+ ONIG_SYN_OP_ESC_OCTAL3 | ONIG_SYN_OP_ESC_X_HEX2 |
+ ONIG_SYN_OP_ESC_X_BRACE_HEX8 | ONIG_SYN_OP_ESC_CONTROL_CHARS |
+ ONIG_SYN_OP_ESC_C_CONTROL )
+ & ~ONIG_SYN_OP_ESC_LTGT_WORD_BEGIN_END )
+ , ( ONIG_SYN_OP2_QMARK_GROUP_EFFECT | ONIG_SYN_OP2_OPTION_PERL |
+ ONIG_SYN_OP2_ESC_P_BRACE_CHAR_PROPERTY |
+ ONIG_SYN_OP2_ESC_P_BRACE_CIRCUMFLEX_NOT |
+ ONIG_SYN_OP2_PLUS_POSSESSIVE_REPEAT |
+ ONIG_SYN_OP2_ESC_V_VTAB |
+ ONIG_SYN_OP2_ESC_U_HEX4 |
+ ONIG_SYN_OP2_QMARK_LPAREN_CONDITION |
+ ONIG_SYN_OP2_QMARK_CAPITAL_P_NAMED_GROUP )
+ , ( SYN_GNU_REGEX_BV |
+ ONIG_SYN_ALLOW_INTERVAL_LOW_ABBREV )
+ , ( ONIG_OPTION_SINGLELINE | ONIG_OPTION_ASCII_RANGE )
+ ,
+ {
+ (OnigCodePoint )'\\' /* esc */
+ , (OnigCodePoint )ONIG_INEFFECTIVE_META_CHAR /* anychar '.' */
+ , (OnigCodePoint )ONIG_INEFFECTIVE_META_CHAR /* anytime '*' */
+ , (OnigCodePoint )ONIG_INEFFECTIVE_META_CHAR /* zero or one time '?' */
+ , (OnigCodePoint )ONIG_INEFFECTIVE_META_CHAR /* one or more time '+' */
+ , (OnigCodePoint )ONIG_INEFFECTIVE_META_CHAR /* anychar anytime */
+ }
+};
+
extern int
diff --git a/ruby.c b/ruby.c
index 3ddd96c7bb..034425e296 100644
--- a/ruby.c
+++ b/ruby.c
@@ -52,6 +52,15 @@
char *getenv();
#endif
+#ifndef DISABLE_RUBYGEMS
+# define DISABLE_RUBYGEMS 0
+#endif
+#if DISABLE_RUBYGEMS
+#define DEFAULT_RUBYGEMS_ENABLED "disabled"
+#else
+#define DEFAULT_RUBYGEMS_ENABLED "enabled"
+#endif
+
#define DISABLE_BIT(bit) (1U << disable_##bit)
enum disable_flag_bits {
disable_gems,
@@ -62,8 +71,10 @@ enum disable_flag_bits {
#define DUMP_BIT(bit) (1U << dump_##bit)
enum dump_flag_bits {
dump_version,
+ dump_version_v,
dump_copyright,
dump_usage,
+ dump_help,
dump_yydebug,
dump_syntax,
dump_parsetree,
@@ -106,13 +117,13 @@ 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;
}
-static NODE *load_file(VALUE, const char *, int, struct cmdline_options *);
+static NODE *load_file(VALUE, VALUE, int, struct cmdline_options *);
static void forbid_setid(const char *, struct cmdline_options *);
#define forbid_setid(s) forbid_setid((s), opt)
@@ -122,42 +133,78 @@ static struct {
} origarg;
static void
-usage(const char *name)
+usage(const char *name, int help)
{
/* This message really ought to be max 23 lines.
* Removed -h because the user already knows that option. Others? */
- static const char *const usage_msg[] = {
- "-0[octal] specify record separator (\\0, if no argument)",
- "-a autosplit mode with -n or -p (splits $_ into $F)",
- "-c check syntax only",
- "-Cdirectory cd to directory, before executing your script",
- "-d set debugging flags (set $DEBUG to true)",
- "-e 'command' one line of script. Several -e's allowed. Omit [programfile]",
- "-Eex[:in] specify the default external and internal character encodings",
- "-Fpattern split() pattern for autosplit (-a)",
- "-i[extension] edit ARGV files in place (make backup if extension supplied)",
- "-Idirectory specify $LOAD_PATH directory (may be used more than once)",
- "-l enable line ending processing",
- "-n assume 'while gets(); ... end' loop around your script",
- "-p assume loop like -n but print line also like sed",
- "-rlibrary require the library, before executing your script",
- "-s enable some switch parsing for switches after script name",
- "-S look for the script using PATH environment variable",
- "-T[level=1] turn on tainting checks",
- "-v print version number, then turn on verbose mode",
- "-w turn warnings on for your script",
- "-W[level=2] set warning level; 0=silence, 1=medium, 2=verbose",
- "-x[directory] strip off text before #!ruby line and perhaps cd to directory",
- "--copyright print the copyright",
- "--version print the version",
- NULL
+ struct message {
+ const char *str;
+ unsigned short namelen, secondlen;
+ };
+#define M(shortopt, longopt, desc) { \
+ shortopt " " longopt " " desc, \
+ (unsigned short)sizeof(shortopt), \
+ (unsigned short)sizeof(longopt), \
+}
+ static const struct message usage_msg[] = {
+ M("-0[octal]", "", "specify record separator (\\0, if no argument)"),
+ M("-a", "", "autosplit mode with -n or -p (splits $_ into $F)"),
+ M("-c", "", "check syntax only"),
+ M("-Cdirectory", "", "cd to directory before executing your script"),
+ M("-d", ", --debug", "set debugging flags (set $DEBUG to true)"),
+ M("-e 'command'", "", "one line of script. Several -e's allowed. Omit [programfile]"),
+ M("-Eex[:in]", ", --encoding=ex[:in]", "specify the default external and internal character encodings"),
+ M("-Fpattern", "", "split() pattern for autosplit (-a)"),
+ M("-i[extension]", "", "edit ARGV files in place (make backup if extension supplied)"),
+ M("-Idirectory", "", "specify $LOAD_PATH directory (may be used more than once)"),
+ M("-l", "", "enable line ending processing"),
+ M("-n", "", "assume 'while gets(); ... end' loop around your script"),
+ M("-p", "", "assume loop like -n but print line also like sed"),
+ M("-rlibrary", "", "require the library before executing your script"),
+ M("-s", "", "enable some switch parsing for switches after script name"),
+ M("-S", "", "look for the script using PATH environment variable"),
+ M("-T[level=1]", "", "turn on tainting checks"),
+ M("-v", ", --verbose", "print version number, then turn on verbose mode"),
+ M("-w", "", "turn warnings on for your script"),
+ M("-W[level=2]", "", "set warning level; 0=silence, 1=medium, 2=verbose"),
+ M("-x[directory]", "", "strip off text before #!ruby line and perhaps cd to directory"),
+ M("-h", "", "show this message, --help for more info"),
};
- const char *const *p = usage_msg;
+ static const struct message help_msg[] = {
+ M("--copyright", "", "print the copyright"),
+ M("--enable=feature[,...]", ", --disable=feature[,...]",
+ "enable or disable features"),
+ M("--external-encoding=encoding", ", --internal-encoding=encoding",
+ "specify the default external or internal character encoding"),
+ M("--version", "", "print the version"),
+ M("--help", "", "show this message, -h for short message"),
+ };
+ static const struct message features[] = {
+ M("gems", "", "rubygems (default: "DEFAULT_RUBYGEMS_ENABLED")"),
+ M("rubyopt", "", "RUBYOPT environment variable (default: enabled)"),
+ };
+ int i, w = 16, num = numberof(usage_msg) - (help ? 1 : 0);
+#define SHOW(m) do { \
+ int wrap = help && (m).namelen + (m).secondlen - 2 > w; \
+ printf(" %.*s%-*.*s%-*s%s\n", (m).namelen-1, (m).str, \
+ (wrap ? 0 : w - (m).namelen + 1), \
+ (help ? (m).secondlen-1 : 0), (m).str + (m).namelen, \
+ (wrap ? w + 3 : 0), (wrap ? "\n" : ""), \
+ (m).str + (m).namelen + (m).secondlen); \
+ } while (0)
printf("Usage: %s [switches] [--] [programfile] [arguments]\n", name);
- while (*p)
- printf(" %s\n", *p++);
+ for (i = 0; i < num; ++i)
+ SHOW(usage_msg[i]);
+
+ if (!help) return;
+
+ for (i = 0; i < numberof(help_msg); ++i)
+ SHOW(help_msg[i]);
+ puts("Features:");
+ for (i = 0; i < numberof(features); ++i)
+ SHOW(features[i]);
}
#ifdef MANGLED_PATH
@@ -418,15 +465,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 && !STRCASECMP(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 {
@@ -446,9 +508,10 @@ 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;
+ extern const char ruby_exec_prefix[];
+ const size_t exec_prefix_len = strlen(ruby_exec_prefix);
#define RUBY_RELATIVE(path, len) rubylib_mangled_path((path), (len))
-#define PREFIX_PATH() RUBY_RELATIVE(exec_prefix, sizeof(exec_prefix)-1)
+#define PREFIX_PATH() RUBY_RELATIVE(ruby_exec_prefix, exec_prefix_len)
#endif
load_path = GET_VM()->load_path;
@@ -480,10 +543,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);
}
@@ -494,25 +557,32 @@ require_libraries(VALUE *req_list)
VALUE self = rb_vm_top_self();
ID require;
rb_thread_t *th = GET_THREAD();
- rb_block_t *prev_base_block = th->base_block;
rb_encoding *extenc = rb_default_external_encoding();
int prev_parse_in_eval = th->parse_in_eval;
- th->base_block = 0;
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);
}
*req_list = 0;
th->parse_in_eval = prev_parse_in_eval;
- th->base_block = prev_base_block;
+}
+
+static rb_env_t*
+toplevel_context(VALUE toplevel_binding)
+{
+ rb_env_t *env;
+ rb_binding_t *bind;
+
+ GetBindingPtr(toplevel_binding, bind);
+ GetEnvPtr(bind->env, env);
+ return env;
}
static void
@@ -520,11 +590,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);
@@ -676,6 +746,7 @@ dump_option(const char *str, int len, void *arg)
SET_WHEN_DUMP(version);
SET_WHEN_DUMP(copyright);
SET_WHEN_DUMP(usage);
+ SET_WHEN_DUMP(help);
SET_WHEN_DUMP(yydebug);
SET_WHEN_DUMP(syntax);
SET_WHEN_DUMP(parsetree);
@@ -696,7 +767,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;
}
@@ -719,7 +790,7 @@ proc_options(long argc, char **argv, struct cmdline_options *opt, int envopt)
for (argc--, argv++; argc > 0; argc--, argv++) {
const char *const arg = argv[0];
- if (arg[0] != '-' || !arg[1])
+ if (!arg || arg[0] != '-' || !arg[1])
break;
s = arg + 1;
@@ -758,7 +829,7 @@ proc_options(long argc, char **argv, struct cmdline_options *opt, int envopt)
s++;
goto reswitch;
}
- ruby_show_version();
+ opt->dump |= DUMP_BIT(version_v);
opt->verbose = 1;
case 'w':
ruby_verbose = Qtrue;
@@ -985,13 +1056,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;
@@ -1060,7 +1134,7 @@ proc_options(long argc, char **argv, struct cmdline_options *opt, int envopt)
}
else if (strcmp("help", s) == 0) {
if (envopt) goto noenvopt_long;
- opt->dump |= DUMP_BIT(usage);
+ opt->dump |= DUMP_BIT(help);
goto switch_end;
}
else {
@@ -1103,6 +1177,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
}
}
@@ -1132,7 +1207,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
@@ -1156,7 +1232,7 @@ uscore_get(void)
VALUE line;
line = rb_lastline_get();
- if (TYPE(line) != T_STRING) {
+ if (!RB_TYPE_P(line, T_STRING)) {
rb_raise(rb_eTypeError, "$_ value need to be String (%s given)",
NIL_P(line) ? "nil" : rb_obj_classname(line));
}
@@ -1166,7 +1242,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.
@@ -1174,9 +1250,7 @@ uscore_get(void)
*/
static VALUE
-rb_f_sub(argc, argv)
- int argc;
- VALUE *argv;
+rb_f_sub(int argc, VALUE *argv)
{
VALUE str = rb_funcall_passing_block(uscore_get(), rb_intern("sub"), argc, argv);
rb_lastline_set(str);
@@ -1185,19 +1259,17 @@ rb_f_sub(argc, 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.
*
*/
static VALUE
-rb_f_gsub(argc, argv)
- int argc;
- VALUE *argv;
+rb_f_gsub(int argc, VALUE *argv)
{
VALUE str = rb_funcall_passing_block(uscore_get(), rb_intern("gsub"), argc, argv);
rb_lastline_set(str);
@@ -1206,7 +1278,7 @@ rb_f_gsub(argc, argv)
/*
* call-seq:
- * chop -> string
+ * chop -> $_
*
* Equivalent to <code>($_.dup).chop!</code>, except <code>nil</code>
* is never returned. See <code>String#chop!</code>.
@@ -1235,15 +1307,16 @@ rb_f_chop(void)
*/
static VALUE
-rb_f_chomp(argc, argv)
- int argc;
- VALUE *argv;
+rb_f_chomp(int argc, VALUE *argv)
{
VALUE str = rb_funcall_passing_block(uscore_get(), rb_intern("chomp"), argc, argv);
rb_lastline_set(str);
return str;
}
+/* blank function in dmyext.c or generated by enc/make_encmake.rb */
+extern void Init_enc(void);
+
static VALUE
process_options(int argc, char **argv, struct cmdline_options *opt)
{
@@ -1255,13 +1328,13 @@ process_options(int argc, char **argv, struct cmdline_options *opt)
char fbuf[MAXPATHLEN];
int i = (int)proc_options(argc, argv, opt, 0);
rb_thread_t *th = GET_THREAD();
- rb_env_t *env = 0;
+ VALUE toplevel_binding = Qundef;
argc -= i;
argv += i;
- if (opt->dump & DUMP_BIT(usage)) {
- usage(origarg.argv[0]);
+ if (opt->dump & (DUMP_BIT(usage)|DUMP_BIT(help))) {
+ usage(origarg.argv[0], (opt->dump & DUMP_BIT(help)));
return Qtrue;
}
@@ -1281,9 +1354,12 @@ process_options(int argc, char **argv, struct cmdline_options *opt)
opt->intern.enc.name = int_enc_name;
}
- if (opt->dump & DUMP_BIT(version)) {
+ if (opt->src.enc.name)
+ rb_warning("-K is specified; it is for 1.8 compatibility and may cause odd behavior");
+
+ if (opt->dump & (DUMP_BIT(version) | DUMP_BIT(version_v))) {
ruby_show_version();
- return Qtrue;
+ if (opt->dump & DUMP_BIT(version)) return Qtrue;
}
if (opt->dump & DUMP_BIT(copyright)) {
ruby_show_copyright();
@@ -1302,7 +1378,7 @@ process_options(int argc, char **argv, struct cmdline_options *opt)
}
else {
opt->script = argv[0];
- if (opt->script[0] == '\0') {
+ if (!opt->script || opt->script[0] == '\0') {
opt->script = "-";
}
else if (opt->do_search) {
@@ -1330,6 +1406,7 @@ process_options(int argc, char **argv, struct cmdline_options *opt)
#endif
ruby_init_loadpath_safe(opt->safe_level);
+ Init_enc();
rb_enc_find_index("encdb");
lenc = rb_locale_encoding();
rb_enc_associate(rb_progname, lenc);
@@ -1366,30 +1443,22 @@ 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) {
- rb_enc_associate(RARRAY_PTR(load_path)[i], lenc);
+ RARRAY_ASET(load_path, i,
+ rb_enc_associate(rb_str_dup(RARRAY_AREF(load_path, i)), lenc));
}
}
+ Init_ext(); /* load statically linked extensions before rubygems */
if (!(opt->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);
process_sflag(&opt->sflag);
- {
- /* set eval context */
- VALUE toplevel_binding = rb_const_get(rb_cObject, rb_intern("TOPLEVEL_BINDING"));
- rb_binding_t *bind;
-
- GetBindingPtr(toplevel_binding, bind);
- GetEnvPtr(bind->env, env);
- }
+ toplevel_binding = rb_const_get(rb_cObject, rb_intern("TOPLEVEL_BINDING"));
#define PREPARE_PARSE_MAIN(expr) do { \
+ rb_env_t *env = toplevel_context(toplevel_binding); \
th->parse_in_eval--; \
th->base_block = &env->block; \
expr; \
@@ -1407,9 +1476,9 @@ process_options(int argc, char **argv, struct cmdline_options *opt)
eenc = lenc;
}
rb_enc_associate(opt->e_script, eenc);
- rb_vm_set_progname(rb_progname = opt->script_name);
+ ruby_set_script_name(opt->script_name);
require_libraries(&opt->req_list);
- rb_vm_set_progname(rb_progname = progname);
+ ruby_set_script_name(progname);
PREPARE_PARSE_MAIN({
tree = rb_parser_compile_string(parser, opt->script, opt->e_script, 1);
@@ -1421,11 +1490,10 @@ process_options(int argc, char **argv, struct cmdline_options *opt)
}
PREPARE_PARSE_MAIN({
- tree = load_file(parser, opt->script, 1, opt);
+ tree = load_file(parser, opt->script_name, 1, opt);
});
}
- rb_progname = opt->script_name;
- rb_vm_set_progname(rb_progname);
+ ruby_set_script_name(opt->script_name);
if (opt->dump & DUMP_BIT(yydebug)) return Qtrue;
if (opt->ext.enc.index >= 0) {
@@ -1483,8 +1551,9 @@ process_options(int argc, char **argv, struct cmdline_options *opt)
PREPARE_PARSE_MAIN({
VALUE path = Qnil;
- if (!opt->e_script && strcmp(opt->script, "-"))
+ if (!opt->e_script && strcmp(opt->script, "-")) {
path = rb_realpath_internal(Qnil, opt->script_name, 1);
+ }
iseq = rb_iseq_new_main(tree, opt->script_name, path);
});
@@ -1499,14 +1568,14 @@ 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();
+ ruby_gc_set_params();
return iseq;
}
struct load_file_arg {
VALUE parser;
- const char *fname;
+ VALUE fname;
int script;
struct cmdline_options *opt;
};
@@ -1517,7 +1586,9 @@ load_file_internal(VALUE arg)
extern VALUE rb_stdin;
struct load_file_arg *argp = (struct load_file_arg *)arg;
VALUE parser = argp->parser;
- const char *fname = argp->fname;
+ VALUE orig_fname = argp->fname;
+ VALUE fname_v = rb_str_encode_ospath(orig_fname);
+ const char *fname = StringValueCStr(fname_v);
int script = argp->script;
struct cmdline_options *opt = argp->opt;
VALUE f;
@@ -1527,8 +1598,6 @@ load_file_internal(VALUE arg)
ID set_encoding;
int xflag = 0;
- if (!fname)
- rb_load_fail(fname);
if (strcmp(fname, "-") == 0) {
f = rb_stdin;
}
@@ -1543,11 +1612,21 @@ load_file_internal(VALUE arg)
}
}
#endif
- if ((fd = open(fname, mode)) < 0) {
- rb_load_fail(fname);
+ 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);
}
@@ -1578,7 +1657,7 @@ load_file_internal(VALUE arg)
}
}
}
- rb_raise(rb_eLoadError, "no Ruby script found in input");
+ rb_loaderror("no Ruby script found in input");
}
c = rb_io_getbyte(f);
@@ -1628,7 +1707,7 @@ load_file_internal(VALUE arg)
if (f != rb_stdin) rb_io_close(f);
f = Qnil;
}
- rb_vm_set_progname(rb_progname = opt->script_name);
+ ruby_set_script_name(opt->script_name);
require_libraries(&opt->req_list); /* Why here? unnatural */
}
if (opt->src.enc.index >= 0) {
@@ -1638,15 +1717,15 @@ load_file_internal(VALUE arg)
enc = rb_locale_encoding();
}
else {
- enc = rb_usascii_encoding();
+ enc = rb_utf8_encoding();
}
if (NIL_P(f)) {
f = rb_str_new(0, 0);
rb_enc_associate(f, enc);
- return (VALUE)rb_parser_compile_string(parser, 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, 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));
if (script && tree && rb_parser_end_seen_p(parser)) {
/*
@@ -1676,7 +1755,7 @@ restore_lineno(VALUE lineno)
}
static NODE *
-load_file(VALUE parser, const char *fname, int script, struct cmdline_options *opt)
+load_file(VALUE parser, VALUE fname, int script, struct cmdline_options *opt)
{
struct load_file_arg arg;
arg.parser = parser;
@@ -1689,37 +1768,96 @@ load_file(VALUE parser, const char *fname, int script, struct cmdline_options *o
void *
rb_load_file(const char *fname)
{
+ 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, 0, cmdline_options_init(&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 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);
}
}
+/*! Sets the current script name to this value.
+ *
+ * Same as ruby_script() but accepts a VALUE.
+ */
+void
+ruby_set_script_name(VALUE name)
+{
+ rb_orig_progname = rb_progname = rb_str_dup(name);
+ rb_vm_set_progname(rb_progname);
+}
+
static void
init_ids(struct cmdline_options *opt)
{
@@ -1765,10 +1903,12 @@ opt_W_getter(ID id, void *data)
return INT2FIX(1);
case Qtrue:
return INT2FIX(2);
+ default:
+ return Qnil;
}
- return Qnil; /* not reached */
}
+/*! Defines built-in variables */
void
ruby_prog_init(void)
{
@@ -1782,6 +1922,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.
@@ -1818,8 +1961,9 @@ ruby_process_options(int argc, char **argv)
{
struct cmdline_options opt;
VALUE iseq;
+ const char *script_name = (argc > 0 && argv[0]) ? argv[0] : "ruby";
- ruby_script(argv[0]); /* for the time being */
+ ruby_script(script_name); /* for the time being */
rb_argv0 = rb_str_new4(rb_progname);
rb_gc_register_mark_object(rb_argv0);
iseq = process_options(argc, argv, cmdline_options_init(&opt));
@@ -1864,6 +2008,12 @@ fill_standard_fds(void)
}
}
+/*! Initializes the process for ruby(1).
+ *
+ * This function assumes this process is ruby(1) and it has just started.
+ * Usually programs that embeds CRuby interpreter should not call this function,
+ * and should do their own initialization.
+ */
void
ruby_sysinit(int *argc, char ***argv)
{
diff --git a/ruby_atomic.h b/ruby_atomic.h
index 920c304116..7e16d287f8 100644
--- a/ruby_atomic.h
+++ b/ruby_atomic.h
@@ -13,6 +13,7 @@ typedef unsigned int rb_atomic_t; /* Anything OK */
# define ATOMIC_DEC(var) __sync_fetch_and_sub(&(var), 1)
# define ATOMIC_OR(var, val) __sync_or_and_fetch(&(var), (val))
# define ATOMIC_EXCHANGE(var, val) __sync_lock_test_and_set(&(var), (val))
+# define ATOMIC_CAS(var, oldval, newval) __sync_val_compare_and_swap(&(var), (oldval), (newval))
# define ATOMIC_SIZE_ADD(var, val) __sync_fetch_and_add(&(var), (val))
# define ATOMIC_SIZE_SUB(var, val) __sync_fetch_and_sub(&(var), (val))
@@ -48,16 +49,26 @@ rb_w32_atomic_or(volatile rb_atomic_t *var, rb_atomic_t val)
# define ATOMIC_OR(var, val) _InterlockedOr(&(var), (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))
@@ -72,6 +83,7 @@ typedef unsigned int rb_atomic_t;
# define ATOMIC_DEC(var) atomic_dec_uint(&(var))
# define ATOMIC_OR(var, val) atomic_or_uint(&(var), (val))
# define ATOMIC_EXCHANGE(var, val) atomic_swap_uint(&(var), (val))
+# define ATOMIC_CAS(var, oldval, newval) atomic_cas_uint(&(var), (oldval), (newval))
# if SIZEOF_SIZE_T == SIZEOF_LONG
# define ATOMIC_SIZE_ADD(var, val) atomic_add_long(&(var), (val))
@@ -79,6 +91,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))
@@ -89,14 +102,18 @@ typedef unsigned int rb_atomic_t;
#else
typedef int rb_atomic_t;
-#define NEED_RUBY_ATOMIC_EXCHANGE
+#define NEED_RUBY_ATOMIC_OPS
extern rb_atomic_t ruby_atomic_exchange(rb_atomic_t *ptr, rb_atomic_t val);
+extern rb_atomic_t ruby_atomic_compare_and_swap(rb_atomic_t *ptr,
+ rb_atomic_t cmp,
+ rb_atomic_t newval);
# define ATOMIC_SET(var, val) (void)((var) = (val))
# define ATOMIC_INC(var) ((var)++)
# define ATOMIC_DEC(var) ((var)--)
# define ATOMIC_OR(var, val) ((var) |= (val))
# define ATOMIC_EXCHANGE(var, val) ruby_atomic_exchange(&(var), (val))
+# define ATOMIC_CAS(var, oldval, newval) ruby_atomic_compare_and_swap(&(var), (oldval), (newval))
# define ATOMIC_SIZE_ADD(var, val) (void)((var) += (val))
# define ATOMIC_SIZE_SUB(var, val) (void)((var) -= (val))
@@ -112,4 +129,8 @@ atomic_size_exchange(size_t *ptr, size_t val)
}
#endif
+#ifndef ATOMIC_SIZE_CAS
+# define ATOMIC_SIZE_CAS(var, oldval, val) ATOMIC_CAS(var, oldval, val)
+#endif
+
#endif /* RUBY_ATOMIC_H */
diff --git a/safe.c b/safe.c
index e2ed5979d2..d9ded85b89 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,14 +124,13 @@ 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 (TYPE(x) != T_STRING) {
+ if (!RB_TYPE_P(x, T_STRING)) {
rb_raise(rb_eTypeError, "wrong argument type %s (expected String)",
rb_obj_classname(x));
}
diff --git a/sample/README b/sample/README
index c1b9532203..796aba1dc3 100644
--- a/sample/README
+++ b/sample/README
@@ -23,7 +23,7 @@ less.rb front end for less
list.rb stupid object sample
list2.rb stupid object sample
list3.rb stupid object sample
-mine.rb simple mine sweeper
+mine.rb simple mine sweeper
mkproto.rb extract prototype from C
mpart.rb split file int multi part
observ.rb observer design pattern sample
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/coverage.rb b/sample/coverage.rb
index 5e15f99716..8e8d6167e2 100644
--- a/sample/coverage.rb
+++ b/sample/coverage.rb
@@ -17,7 +17,7 @@ at_exit do
File.writable?(f) || File.writable?(File.dirname(f))
end
unless writable[cfile]
- cfile = cfile.gsub(File.PATH_SEPARATOR, "#")
+ cfile = cfile.gsub(File::PATH_SEPARATOR, "#")
next unless writable[cfile]
end
@@ -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/curses/hello.rb b/sample/curses/hello.rb
new file mode 100644
index 0000000000..a630fb999b
--- /dev/null
+++ b/sample/curses/hello.rb
@@ -0,0 +1,27 @@
+require "curses"
+
+def show_message(message)
+ width = message.length + 6
+ win = Curses::Window.new(5, width,
+ (Curses.lines - 5) / 2, (Curses.cols - width) / 2)
+ win.box('|', '-')
+ win.setpos(2, 3)
+ win.addstr(message)
+ win.refresh
+ win.getch
+ win.close
+end
+
+Curses.init_screen
+begin
+ Curses.crmode
+# show_message("Hit any key")
+ Curses.setpos((Curses.lines - 5) / 2, (Curses.cols - 10) / 2)
+ Curses.addstr("Hit any key")
+ Curses.refresh
+ char = Curses.getch
+ show_message("You typed: #{char}")
+ Curses.refresh
+ensure
+ Curses.close_screen
+end
diff --git a/sample/curses/mouse.rb b/sample/curses/mouse.rb
new file mode 100644
index 0000000000..cc4beeb83d
--- /dev/null
+++ b/sample/curses/mouse.rb
@@ -0,0 +1,52 @@
+require "curses"
+
+def show_message(*msgs)
+ message = msgs.join
+ width = message.length + 6
+ win = Curses::Window.new(5, width,
+ (Curses.lines - 5) / 2, (Curses.cols - width) / 2)
+ win.keypad = true
+ win.attron(Curses.color_pair(Curses::COLOR_RED)){
+ win.box(?|, ?-, ?+)
+ }
+ win.setpos(2, 3)
+ win.addstr(message)
+ win.refresh
+ win.getch
+ win.close
+end
+
+Curses.init_screen
+Curses.start_color
+Curses.init_pair(Curses::COLOR_BLUE, Curses::COLOR_BLUE, Curses::COLOR_WHITE)
+Curses.init_pair(Curses::COLOR_RED, Curses::COLOR_RED, Curses::COLOR_WHITE)
+Curses.crmode
+Curses.noecho
+Curses.stdscr.keypad(true)
+
+begin
+ Curses.mousemask(
+ Curses::BUTTON1_CLICKED|Curses::BUTTON2_CLICKED|Curses::BUTTON3_CLICKED|Curses::BUTTON4_CLICKED
+ )
+ Curses.setpos((Curses.lines - 5) / 2, (Curses.cols - 10) / 2)
+ Curses.attron(Curses.color_pair(Curses::COLOR_BLUE)|Curses::A_BOLD){
+ Curses.addstr("click")
+ }
+ Curses.refresh
+ while( true )
+ c = Curses.getch
+ case c
+ when Curses::KEY_MOUSE
+ m = Curses::getmouse
+ if( m )
+ show_message("getch = #{c.inspect}, ",
+ "mouse event = #{'0x%x' % m.bstate}, ",
+ "axis = (#{m.x},#{m.y},#{m.z})")
+ end
+ break
+ end
+ end
+ Curses.refresh
+ensure
+ Curses.close_screen
+end
diff --git a/sample/curses/rain.rb b/sample/curses/rain.rb
new file mode 100644
index 0000000000..845da2f522
--- /dev/null
+++ b/sample/curses/rain.rb
@@ -0,0 +1,74 @@
+# rain for a curses test
+
+require "curses"
+
+def onsig(sig)
+ Curses.close_screen
+ exit sig
+end
+
+def ranf
+ rand(32767).to_f / 32767
+end
+
+# main #
+for i in %w[HUP INT QUIT TERM]
+ if trap(i, "SIG_IGN") != 0 then # 0 for SIG_IGN
+ trap(i) {|sig| onsig(sig) }
+ end
+end
+
+Curses.init_screen
+Curses.nl
+Curses.noecho
+srand
+
+xpos = {}
+ypos = {}
+r = Curses.lines - 4
+c = Curses.cols - 4
+for i in 0 .. 4
+ xpos[i] = (c * ranf).to_i + 2
+ ypos[i] = (r * ranf).to_i + 2
+end
+
+i = 0
+while TRUE
+ x = (c * ranf).to_i + 2
+ y = (r * ranf).to_i + 2
+
+
+ Curses.setpos(y, x); Curses.addstr(".")
+
+ Curses.setpos(ypos[i], xpos[i]); Curses.addstr("o")
+
+ i = if i == 0 then 4 else i - 1 end
+ Curses.setpos(ypos[i], xpos[i]); Curses.addstr("O")
+
+ i = if i == 0 then 4 else i - 1 end
+ Curses.setpos(ypos[i] - 1, xpos[i]); Curses.addstr("-")
+ Curses.setpos(ypos[i], xpos[i] - 1); Curses.addstr("|.|")
+ Curses.setpos(ypos[i] + 1, xpos[i]); Curses.addstr("-")
+
+ i = if i == 0 then 4 else i - 1 end
+ Curses.setpos(ypos[i] - 2, xpos[i]); Curses.addstr("-")
+ Curses.setpos(ypos[i] - 1, xpos[i] - 1); Curses.addstr("/ \\")
+ Curses.setpos(ypos[i], xpos[i] - 2); Curses.addstr("| O |")
+ Curses.setpos(ypos[i] + 1, xpos[i] - 1); Curses.addstr("\\ /")
+ Curses.setpos(ypos[i] + 2, xpos[i]); Curses.addstr("-")
+
+ i = if i == 0 then 4 else i - 1 end
+ Curses.setpos(ypos[i] - 2, xpos[i]); Curses.addstr(" ")
+ Curses.setpos(ypos[i] - 1, xpos[i] - 1); Curses.addstr(" ")
+ Curses.setpos(ypos[i], xpos[i] - 2); Curses.addstr(" ")
+ Curses.setpos(ypos[i] + 1, xpos[i] - 1); Curses.addstr(" ")
+ Curses.setpos(ypos[i] + 2, xpos[i]); Curses.addstr(" ")
+
+
+ xpos[i] = x
+ ypos[i] = y
+ Curses.refresh
+ sleep(0.5)
+end
+
+# end of main
diff --git a/ext/curses/view.rb b/sample/curses/view.rb
index e033fd8ae2..bc54aeb9af 100644
--- a/ext/curses/view.rb
+++ b/sample/curses/view.rb
@@ -40,7 +40,7 @@ while TRUE
while i < lines
setpos(i, 0)
#clrtoeol
- addstr(data_lines[lptr + i]) #if data_lines[lptr + i]
+ addstr(data_lines[lptr + i] || '')
i += 1
end
refresh
diff --git a/ext/curses/view2.rb b/sample/curses/view2.rb
index 037771a226..037771a226 100644
--- a/ext/curses/view2.rb
+++ b/sample/curses/view2.rb
diff --git a/sample/drb/README.ja.rdoc b/sample/drb/README.ja.rdoc
new file mode 100644
index 0000000000..3ab70f3369
--- /dev/null
+++ b/sample/drb/README.ja.rdoc
@@ -0,0 +1,59 @@
+= サンプルスクリプト
+
+* Arrayをリモートã‹ã‚‰åˆ©ç”¨ã—ã¦ã‚¤ãƒ†ãƒ¬ãƒ¼ã‚¿ã‚’試ã™ã€‚
+ * darray.rb --- server
+ * darrayc.rb --- client
+
+* 簡易ãƒãƒ£ãƒƒãƒˆ
+ * dchats.rb --- server
+ * dchatc.rb --- client
+
+* 分散chasen
+ * dhasen.rb --- server
+ * dhasenc.rb --- client
+
+* 簡易ログサーãƒ
+ * dlogd.rb --- server
+ * dlogc.rb --- client
+
+* Queueサーãƒã€‚
+ クライアントdqin.rbã¯Queueサーãƒã®çŸ¥ã‚‰ãªã„オブジェクト(DQEntry)ã‚’
+ pushã™ã‚‹ãŒDRbUnknownã«ã‚ˆã‚Šã‚¯ãƒ©ã‚¤ã‚¢ãƒ³ãƒˆdqout.rbãŒpopã§ãる。
+ * dqueue.rb --- server
+ * dqin.rb --- client。DQEntryオブジェクトをpushã™ã‚‹
+ * dqout.rb --- client。DQEntryオブジェクトをpopã™ã‚‹
+ * dqlib.rb --- DQEntryを定義ã—ãŸãƒ©ã‚¤ãƒ–ラリ
+
+* åå‰ã«ã‚ˆã‚‹å‚ç…§
+ IdConvをカスタマイズã—ã¦idã§ãªãåå‰ã§å‚ç…§ã™ã‚‹ä¾‹
+ * name.rb --- server
+ * namec.rb --- client
+
+* extservã®ã‚µãƒ³ãƒ—ル
+ * extserv_test.rb
+
+* TimerIdConvã®ä½¿ç”¨ä¾‹
+ * holders.rb --- server。ruby -d hodlers.rbã¨ã™ã‚‹ã¨TimerIdConvを使用ã™ã‚‹ã€‚
+ * holderc.rb --- client
+
+* rinda.rbã®ä½¿ç”¨ä¾‹
+ * rinda_ts.rb --- TupleSpaceサーãƒã€‚
+ * rindac.rb --- TupleSpaceã®clientã§ã‚¢ãƒ—リケーションã®client
+ * rindas.rb --- TupleSpaceã®clientã§ã‚¢ãƒ—リケーションã®server
+
+* observerã®ä½¿ç”¨ä¾‹
+ cdbiff - http://namazu.org/~satoru/cdbiff/
+ * dbiff.rb --- dcdbiff server
+ * dcdbiff.rb --- dcdbiff client
+
+* drbsslã®ä½¿ç”¨ä¾‹
+ * drbssl_s.rb
+ * drbssl_c.rb
+
+* DRbProtoclã®è¿½åР例
+ * http0.rb
+ * http0serv.rb
+
+* ringã®ä½¿ç”¨ä¾‹
+ * ring_place.rb
+ * ring_echo.rb
diff --git a/sample/drb/README.rd.ja b/sample/drb/README.rd.ja
deleted file mode 100644
index 04143b9ad5..0000000000
--- a/sample/drb/README.rd.ja
+++ /dev/null
@@ -1,59 +0,0 @@
-= ¥µ¥ó¥×¥ë¥¹¥¯¥ê¥×¥È
-
-* Array¤ò¥ê¥â¡¼¥È¤«¤éÍøÍѤ·¤Æ¥¤¥Æ¥ì¡¼¥¿¤ò»î¤¹¡£
- * darray.rb --- server
- * darrayc.rb --- client
-
-* ´Ê°×¥Á¥ã¥Ã¥È
- * dchats.rb --- server
- * dchatc.rb --- client
-
-* ʬ»¶chasen
- * dhasen.rb --- server
- * dhasenc.rb --- client
-
-* ´Ê°×¥í¥°¥µ¡¼¥Ð
- * dlogd.rb --- server
- * dlogc.rb --- client
-
-* Queue¥µ¡¼¥Ð¡£
- ¥¯¥é¥¤¥¢¥ó¥Èdqin.rb¤ÏQueue¥µ¡¼¥Ð¤ÎÃΤé¤Ê¤¤¥ª¥Ö¥¸¥§¥¯¥È(DQEntry)¤ò
- push¤¹¤ë¤¬DRbUnknown¤Ë¤è¤ê¥¯¥é¥¤¥¢¥ó¥Èdqout.rb¤¬pop¤Ç¤­¤ë¡£
- * dqueue.rb --- server
- * dqin.rb --- client¡£DQEntry¥ª¥Ö¥¸¥§¥¯¥È¤òpush¤¹¤ë
- * dqout.rb --- client¡£DQEntry¥ª¥Ö¥¸¥§¥¯¥È¤òpop¤¹¤ë
- * dqlib.rb --- DQEntry¤òÄêµÁ¤·¤¿¥é¥¤¥Ö¥é¥ê
-
-* ̾Á°¤Ë¤è¤ë»²¾È
- IdConv¤ò¥«¥¹¥¿¥Þ¥¤¥º¤·¤Æid¤Ç¤Ê¤¯Ì¾Á°¤Ç»²¾È¤¹¤ëÎã
- * name.rb --- server
- * namec.rb --- client
-
-* extserv¤Î¥µ¥ó¥×¥ë
- * extserv_test.rb
-
-* TimerIdConv¤Î»ÈÍÑÎã
- * holders.rb --- server¡£ruby -d hodlers.rb¤È¤¹¤ë¤ÈTimerIdConv¤ò»ÈÍѤ¹¤ë¡£
- * holderc.rb --- client
-
-* rinda.rb¤Î»ÈÍÑÎã
- * rinda_ts.rb --- TupleSpace¥µ¡¼¥Ð¡£
- * rindac.rb --- TupleSpace¤Îclient¤Ç¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¤Îclient
- * rindas.rb --- TupleSpace¤Îclient¤Ç¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¤Îserver
-
-* observer¤Î»ÈÍÑÎã
- cdbiff - ((<URI:http://namazu.org/~satoru/cdbiff/>))
- * dbiff.rb --- dcdbiff server
- * dcdbiff.rb --- dcdbiff client
-
-* drbssl¤Î»ÈÍÑÎã
- * drbssl_s.rb
- * drbssl_c.rb
-
-* DRbProtocl¤ÎÄɲÃÎã
- * http0.rb
- * http0serv.rb
-
-* ring¤Î»ÈÍÑÎã
- * ring_place.rb
- * ring_echo.rb
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/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/dhasenc.rb b/sample/drb/dhasenc.rb
index 44e58ce096..dddac9882c 100644
--- a/sample/drb/dhasenc.rb
+++ b/sample/drb/dhasenc.rb
@@ -1,4 +1,4 @@
-# -*- encoding: euc-jp -*-
+# -*- coding: utf-8 -*-
=begin
distributed Ruby --- dRuby Sample Client -- chasen client
Copyright (c) 1999-2001 Masatoshi SEKI
@@ -10,5 +10,5 @@ there = ARGV.shift || raise("usage: #{$0} <server_uri>")
DRb.start_service
dhasen = DRbObject.new(nil, there)
-print dhasen.sparse("ËÜÆü¤Ï¡¢À²Å·¤Ê¤ê¡£", "-F", '(%BB %m %M)\n', "-j")
-print dhasen.sparse("ËÜÆü¤Ï¡¢À²Å·¤Ê¤ê¡£", "-F", '(%m %M)\n')
+print dhasen.sparse("本日ã¯ã€æ™´å¤©ãªã‚Šã€‚", "-F", '(%BB %m %M)\n', "-j")
+print dhasen.sparse("本日ã¯ã€æ™´å¤©ãªã‚Šã€‚", "-F", '(%m %M)\n')
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/gw_cu.rb b/sample/drb/gw_cu.rb
index 0e5ed36b8f..8079cbdc4f 100644
--- a/sample/drb/gw_cu.rb
+++ b/sample/drb/gw_cu.rb
@@ -13,7 +13,7 @@ class Foo
end
end
-DRb.start_service('drubyunix:', nil)
+DRb.start_service('drbunix:', nil)
puts DRb.uri
ro = DRbObject.new(nil, ARGV.shift)
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/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/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/mine.rb b/sample/mine.rb
index 4ef006685e..a841d1a60a 100644..100755
--- a/sample/mine.rb
+++ b/sample/mine.rb
@@ -1,5 +1,5 @@
-#! /usr/bin/ruby -Ke
-# -*- encoding: euc-jp -*-
+#! /usr/bin/ruby -Ku
+# -*- coding: utf-8 -*-
class Board
def clr
@@ -13,19 +13,19 @@ class Board
end
def put(x, y, col, str)
pos(x,y); colorstr(43,str)
- pos(0,@hi); print "»Ä¤ê:",@mc,"/",@total," "
+ pos(0,@hi); print "残り:",@mc,"/",@total," "
pos(x,y)
end
private :clr, :pos, :colorstr, :put
- CHR=["¡¦","£±","£²","£³","£´","£µ","£¶","£·","£¸","¡ú","¡ü","@@"]
+ CHR=["・","1","ï¼’","3","ï¼”","5","ï¼–","ï¼—","8","★","â—","@@"]
COL=[46,43,45] # default,opened,over
def initialize(h,w,m)
- # ¥²¡¼¥àÈפÎÀ¸À®(h:½Ä¡¤w:²£¡¤m:ÇúÃÆ¤Î¿ô)
+ # ゲーム盤ã®ç”Ÿæˆ(h:縦,w:横,m:çˆ†å¼¾ã®æ•°)
@hi=h; @wi=w; @m=m
reset
end
def reset
- # ¥²¡¼¥àÈפò(ºÆ)½é´ü²½¤¹¤ë
+ # ゲーム盤を(å†)åˆæœŸåŒ–ã™ã‚‹
srand()
@cx=0; @cy=0; @mc=@m
@over=false
@@ -47,7 +47,7 @@ class Board
pos(@cx,@cy)
end
def mark
- # ¸½ºß¤Î¥«¡¼¥½¥ë°ÌÃ֤˥ޡ¼¥¯¤ò¤Ä¤±¤ë
+ # ç¾åœ¨ã®ã‚«ãƒ¼ã‚½ãƒ«ä½ç½®ã«ãƒžãƒ¼ã‚¯ã‚’ã¤ã‘ã‚‹
if @state[@wi*@cy+@cx] != nil then return end
@state[@wi*@cy+@cx] = "MARK"
@mc=@mc-1;
@@ -55,8 +55,8 @@ class Board
put(@cx, @cy, COL[1], CHR[9])
end
def open(x=@cx,y=@cy)
- # ¸½ºß¤Î¥«¡¼¥½¥ë°ÌÃÖ¤ò¥ª¡¼¥×¥ó¤Ë¤¹¤ë
- # ÇúÃÆ¤¬¤¢¤ì¤Ð¥²¡¼¥à¥ª¡¼¥Ð¡¼
+ # ç¾åœ¨ã®ã‚«ãƒ¼ã‚½ãƒ«ä½ç½®ã‚’オープンã«ã™ã‚‹
+ # 爆弾ãŒã‚れã°ã‚²ãƒ¼ãƒ ã‚ªãƒ¼ãƒãƒ¼
if @state[@wi*y+x] =="OPEN" then return 0 end
if @state[@wi*y+x] == nil then @total=@total-1 end
if @state[@wi*y+x] =="MARK" then @mc=@mc+1 end
@@ -76,7 +76,7 @@ class Board
pos(@cx,@cy)
end
def fetch(x,y)
- # (x,y)¤Î°ÌÃÖ¤ÎÇúÃÆ¤Î¿ô(0 or 1)¤òÊÖ¤¹
+ # (x,y)ã®ä½ç½®ã®çˆ†å¼¾ã®æ•°(0 or 1)ã‚’è¿”ã™
if x < 0 then 0
elsif x >= @wi then 0
elsif y < 0 then 0
@@ -86,13 +86,13 @@ class Board
end
end
def count(x,y)
- # (x,y)¤ËÎÙÀܤ¹¤ëÇúÃÆ¤Î¿ô¤òÊÖ¤¹
+ # (x,y)ã«éš£æŽ¥ã™ã‚‹çˆ†å¼¾ã®æ•°ã‚’è¿”ã™
fetch(x-1,y-1)+fetch(x,y-1)+fetch(x+1,y-1)+
fetch(x-1,y) + fetch(x+1,y)+
fetch(x-1,y+1)+fetch(x,y+1)+fetch(x+1,y+1)
end
def over(win)
- # ¥²¡¼¥à¤Î½ªÎ»
+ # ゲームã®çµ‚了
quit
unless win
pos(@cx,@cy); print CHR[11]
@@ -103,8 +103,8 @@ class Board
end
end
def over?
- # ¥²¡¼¥à¤Î½ªÎ»¥Á¥§¥Ã¥¯
- # ½ªÎ»½èÍý¤â¸Æ¤Ó½Ð¤¹
+ # ゲームã®çµ‚了ãƒã‚§ãƒƒã‚¯
+ # 終了処ç†ã‚‚呼ã³å‡ºã™
remain = (@mc+@total == 0)
if @over || remain
over(remain)
@@ -114,8 +114,8 @@ class Board
end
end
def quit
- # ¥²¡¼¥à¤ÎÃæÃÇ(¤Þ¤¿¤Ï½ªÎ»)
- # È×Ì̤òÁ´¤Æ¸«¤»¤ë
+ # ゲームã®ä¸­æ–­(ã¾ãŸã¯çµ‚了)
+ # 盤é¢ã‚’å…¨ã¦è¦‹ã›ã‚‹
@hi.times do|y|
pos(0,y)
@wi.times do|x|
@@ -125,19 +125,19 @@ class Board
end
end
def down
- # ¥«¡¼¥½¥ë¤ò²¼¤Ë
+ # カーソルを下ã«
if @cy < @hi-1 then @cy=@cy+1; pos(@cx, @cy) end
end
def up
- # ¥«¡¼¥½¥ë¤ò¾å¤Ë
+ # カーソルを上ã«
if @cy > 0 then @cy=@cy-1; pos(@cx, @cy) end
end
def left
- # ¥«¡¼¥½¥ë¤òº¸¤Ë
+ # カーソルを左ã«
if @cx > 0 then @cx=@cx-1; pos(@cx, @cy) end
end
def right
- # ¥«¡¼¥½¥ë¤ò±¦¤Ë
+ # カーソルをå³ã«
if @cx < @wi-1 then @cx=@cx+1; pos(@cx, @cy) end
end
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/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/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/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/test.rb b/sample/test.rb
index 4e934f1f84..4bef6bc392 100644..100755
--- a/sample/test.rb
+++ b/sample/test.rb
@@ -4,9 +4,103 @@
$testnum=0
$ntest=0
$failed = 0
+class Progress
+ def initialize
+ @color = nil
+ @tty = nil
+ @quiet = nil
+ @verbose = nil
+ ARGV.each do |arg|
+ case arg
+ when /\A--color(?:=(?:always|(auto)|(never)|(.*)))?\z/
+ warn "unknown --color argument: #$3" if $3
+ @color = $1 ? nil : !$2
+ when /\A--tty(=(?:yes|(no)|(.*)))?\z/
+ warn "unknown --tty argument: #$3" if $3
+ @tty = !$1 || !$2
+ true
+ when /\A-(q|-quiet)\z/
+ @quiet = true
+ when /\A-(v|-verbose)\z/
+ @verbose = true
+ end
+ end
+ @tty = STDERR.tty? && !STDOUT.tty? && /dumb/ !~ ENV["TERM"] if @tty.nil?
+ @eol = @tty && !@verbose ? "\r\e[K\r" : "\n"
+ case @color
+ when nil
+ @color = @tty
+ end
+ if @color
+ # dircolors-like style
+ colors = (colors = ENV['TEST_COLORS']) ? Hash[colors.scan(/(\w+)=([^:]*)/)] : {}
+ @passed = "\e[#{colors["pass"] || "32"}m"
+ @failed = "\e[#{colors["fail"] || "31"}m"
+ @reset = "\e[m"
+ else
+ @passed = @failed = @reset = ""
+ end
+ extend(Rotator) if @tty
+ end
+
+ def passed_string
+ "."
+ end
+ def failed_string
+ "#{@failed}F#{@reset}"
+ end
+ def init_string
+ end
+ def finish_string
+ if @quiet
+ @eol
+ else
+ "#{@passed}#{@ok ? 'OK' : ''} #{$testnum}#{@reset}#{@eol}"
+ end
+ end
+ def pass
+ STDERR.print passed_string
+ end
+ def fail
+ @ok = false
+ STDERR.print failed_string
+ end
+ def init
+ @ok = true
+ STDERR.print init_string
+ end
+ def finish
+ STDERR.print finish_string
+ end
+
+ module Rotator
+ ROTATOR = %w[- \\ | /]
+ BS = "\b" * ROTATOR[0].size
+ def passed_string
+ "#{BS}#{ROTATOR[(@count += 1) % ROTATOR.size]}"
+ end
+ def failed_string
+ "#{BS}#{super}#{ROTATOR[@count % ROTATOR.size]}"
+ end
+ def init_string
+ @count = 0
+ " "
+ end
+ def finish_string
+ s = "#{BS}#{' ' * BS.size}#{BS}#{super}"
+ s.gsub!(/\n/, "\r\e[2K\r") if @quiet
+ s
+ end
+ end
+end
+PROGRESS = Progress.new
def test_check(what)
- STDERR.print "\nsample/test.rb:#{what} "
+ unless $ntest.zero?
+ PROGRESS.finish
+ end
+ STDERR.print "sample/test.rb:#{what} "
+ PROGRESS.init
$what = what
$testnum = 0
end
@@ -16,10 +110,10 @@ def test_ok(cond,n=1)
$ntest+=1
where = (st = caller(n)) ? st[0] : "caller error! (n=#{n}, trace=#{caller(0).join(', ')}"
if cond
- STDERR.print "."
+ PROGRESS.pass
printf "ok %d (%s)\n", $testnum, where
else
- STDERR.print "F"
+ PROGRESS.fail
printf "not ok %s %d -- %s\n", $what, $testnum, where
$failed+=1
end
@@ -551,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";
@@ -561,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()
@@ -573,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
@@ -583,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')
@@ -609,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
@@ -620,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
@@ -1875,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";
@@ -1897,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
@@ -1918,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
@@ -2259,6 +2355,7 @@ ObjectSpace.each_object{|o|
test_ok true # reach here or dumps core
+PROGRESS.finish
if $failed > 0
printf "not ok/test: %d failed %d\n", $ntest, $failed
else
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/signal.c b/signal.c
index cda61d3d80..b07a99db15 100644
--- a/signal.c
+++ b/signal.c
@@ -17,11 +17,30 @@
#include <stdio.h>
#include <errno.h>
#include "ruby_atomic.h"
+#include "eval_intern.h"
+#include "internal.h"
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
-#if !defined(_WIN32) && !defined(HAVE_GCC_ATOMIC_BUILTINS)
+#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"
+#endif
+
+#ifdef NEED_RUBY_ATOMIC_OPS
rb_atomic_t
ruby_atomic_exchange(rb_atomic_t *ptr, rb_atomic_t val)
{
@@ -29,18 +48,23 @@ ruby_atomic_exchange(rb_atomic_t *ptr, rb_atomic_t val)
*ptr = val;
return old;
}
+
+rb_atomic_t
+ruby_atomic_compare_and_swap(rb_atomic_t *ptr, rb_atomic_t cmp,
+ rb_atomic_t newval)
+{
+ rb_atomic_t old = *ptr;
+ if (old == cmp) {
+ *ptr = newval;
+ }
+ return old;
+}
#endif
#if defined(__BEOS__) || defined(__HAIKU__)
#undef SIGBUS
#endif
-#ifdef HAVE_PTHREAD_SIGMASK
-#define USE_TRAP_MASK 1
-#else
-#define USE_TRAP_MASK 0
-#endif
-
#ifndef NSIG
# define NSIG (_SIGMAX + 1) /* For QNX */
#endif
@@ -63,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
@@ -206,6 +230,26 @@ signo2signm(int no)
return 0;
}
+/*
+ * call-seq:
+ * Signal.signame(signo) -> string
+ *
+ * convert signal number to signal name
+ *
+ * Signal.trap("INT") { |signo| puts Signal.signame(signo) }
+ * Process.kill("INT", 0)
+ *
+ * <em>produces:</em>
+ *
+ * INT
+ */
+static VALUE
+sig_signame(VALUE recv, VALUE signo)
+{
+ const char *signame = signo2signm(NUM2INT(signo));
+ return rb_str_new_cstr(signame);
+}
+
const char *
ruby_signal_name(int no)
{
@@ -234,10 +278,7 @@ esignal_init(int argc, VALUE *argv, VALUE self)
if (!NIL_P(sig)) argnum = 2;
else sig = argv[0];
}
- if (argc < 1 || argnum < argc) {
- rb_raise(rb_eArgError, "wrong number of arguments (%d for %d)",
- argc, argnum);
- }
+ rb_check_arity(argc, 1, argnum);
if (argnum == 2) {
signo = NUM2INT(sig);
if (signo < 0 || signo > NSIG) {
@@ -306,11 +347,11 @@ ruby_default_signal(int sig)
* call-seq:
* Process.kill(signal, pid, ...) -> fixnum
*
- * Sends the given signal to the specified process id(s), or to the
- * current process if _pid_ is zero. _signal_ may be an
- * integer signal number or a POSIX signal name (either with or without
- * a +SIG+ prefix). If _signal_ is negative (or starts
- * with a minus sign), kills process groups instead of
+ * Sends the given signal to the specified process id(s) if _pid_ is positive.
+ * If _pid_ is zero _signal_ is sent to all processes whose group ID is equal
+ * to the group ID of the process. _signal_ may be an integer signal number or
+ * a POSIX signal name (either with or without a +SIG+ prefix). If _signal_ is
+ * negative (or starts with a minus sign), kills process groups instead of
* processes. Not all signals are available on all platforms.
*
* pid = fork do
@@ -339,7 +380,7 @@ ruby_default_signal(int sig)
VALUE
rb_f_kill(int argc, VALUE *argv)
{
-#ifndef HAS_KILLPG
+#ifndef HAVE_KILLPG
#define killpg(pg, sig) kill(-(pg), (sig))
#endif
int negative = 0;
@@ -349,8 +390,8 @@ rb_f_kill(int argc, VALUE *argv)
const char *s;
rb_secure(2);
- if (argc < 2)
- rb_raise(rb_eArgError, "wrong number of arguments (%d for at least 2)", argc);
+ rb_check_arity(argc, 2, UNLIMITED_ARGUMENTS);
+
switch (TYPE(argv[0])) {
case T_FIXNUM:
sig = FIX2INT(argv[0]);
@@ -370,7 +411,7 @@ rb_f_kill(int argc, VALUE *argv)
}
if (strncmp("SIG", s, 3) == 0)
s += 3;
- if((sig = signm2signo(s)) == 0)
+ if ((sig = signm2signo(s)) == 0)
rb_raise(rb_eArgError, "unsupported name `SIG%s'", s);
if (negative)
@@ -397,11 +438,11 @@ rb_f_kill(int argc, VALUE *argv)
}
else {
for (i=1; i<argc; i++) {
- if (kill(NUM2PIDT(argv[i]), sig) < 0)
- rb_sys_fail(0);
+ ruby_kill(NUM2PIDT(argv[i]), sig);
}
}
- rb_thread_polling();
+ rb_thread_execute_interrupts(rb_thread_current());
+
return INT2FIX(i-1);
}
@@ -412,6 +453,8 @@ static struct {
#ifdef __dietlibc__
#define sighandler_t sh_t
+#else
+#define sighandler_t ruby_sighandler_t
#endif
typedef RETSIGTYPE (*sighandler_t)(int);
@@ -423,9 +466,29 @@ typedef RETSIGTYPE ruby_sigaction_t(int);
#define SIGINFO_ARG
#endif
-#ifdef POSIX_SIGNAL
-
#ifdef USE_SIGALTSTACK
+int
+rb_sigaltstack_size(void)
+{
+ /* XXX: BSD_vfprintf() uses >1500KiB stack and x86-64 need >5KiB stack. */
+ int size = 8192;
+
+#ifdef MINSIGSTKSZ
+ if (size < MINSIGSTKSZ)
+ size = MINSIGSTKSZ;
+#endif
+#if defined(HAVE_SYSCONF) && defined(_SC_PAGE_SIZE)
+ {
+ int pagesize;
+ pagesize = (int)sysconf(_SC_PAGE_SIZE);
+ if (size < pagesize)
+ size = pagesize;
+ }
+#endif
+
+ return size;
+}
+
/* alternate stack for SIGSEGV */
void
rb_register_sigaltstack(rb_thread_t *th)
@@ -436,13 +499,14 @@ rb_register_sigaltstack(rb_thread_t *th)
rb_bug("rb_register_sigaltstack: th->altstack not initialized\n");
newSS.ss_sp = th->altstack;
- newSS.ss_size = ALT_STACK_SIZE;
+ newSS.ss_size = rb_sigaltstack_size();
newSS.ss_flags = 0;
sigaltstack(&newSS, &oldSS); /* ignore error. */
}
#endif /* USE_SIGALTSTACK */
+#ifdef POSIX_SIGNAL
static sighandler_t
ruby_signal(int signum, sighandler_t handler)
{
@@ -466,9 +530,14 @@ ruby_signal(int signum, sighandler_t handler)
sigact.sa_flags |= SA_NOCLDWAIT;
#endif
#if defined(SA_ONSTACK) && defined(USE_SIGALTSTACK)
- if (signum == SIGSEGV || signum == SIGBUS)
+ if (signum == SIGSEGV
+#ifdef SIGBUS
+ || signum == SIGBUS
+#endif
+ )
sigact.sa_flags |= SA_ONSTACK;
#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);
@@ -515,30 +584,24 @@ rb_signal_buff_size(void)
return signal_buff.size;
}
-#if USE_TRAP_MASK
-static sigset_t trap_last_mask;
-#endif
-
#if HAVE_PTHREAD_H
#include <pthread.h>
#endif
-void
+static void
rb_disable_interrupt(void)
{
-#if USE_TRAP_MASK
+#ifdef HAVE_PTHREAD_SIGMASK
sigset_t mask;
sigfillset(&mask);
- sigdelset(&mask, SIGVTALRM);
- sigdelset(&mask, SIGSEGV);
pthread_sigmask(SIG_SETMASK, &mask, NULL);
#endif
}
-void
+static void
rb_enable_interrupt(void)
{
-#if USE_TRAP_MASK
+#ifdef HAVE_PTHREAD_SIGMASK
sigset_t mask;
sigemptyset(&mask);
pthread_sigmask(SIG_SETMASK, &mask, NULL);
@@ -553,12 +616,8 @@ rb_get_next_signal(void)
if (signal_buff.size != 0) {
for (i=1; i<RUBY_NSIG; i++) {
if (signal_buff.cnt[i] > 0) {
- rb_disable_interrupt();
- {
- ATOMIC_DEC(signal_buff.cnt[i]);
- ATOMIC_DEC(signal_buff.size);
- }
- rb_enable_interrupt();
+ ATOMIC_DEC(signal_buff.cnt[i]);
+ ATOMIC_DEC(signal_buff.size);
sig = i;
break;
}
@@ -568,7 +627,7 @@ rb_get_next_signal(void)
}
-#ifdef USE_SIGALTSTACK
+#if defined(USE_SIGALTSTACK) || defined(_WIN32)
static void
check_stack_overflow(const void *addr)
{
@@ -579,7 +638,11 @@ check_stack_overflow(const void *addr)
ruby_thread_stack_overflow(th);
}
}
+#ifdef _WIN32
+#define CHECK_STACK_OVERFLOW() check_stack_overflow(0)
+#else
#define CHECK_STACK_OVERFLOW() check_stack_overflow(info->si_addr)
+#endif
#else
#define CHECK_STACK_OVERFLOW() (void)0
#endif
@@ -590,7 +653,7 @@ 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__
@@ -601,7 +664,8 @@ sigbus(int sig SIGINFO_ARG)
#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
@@ -621,8 +685,10 @@ static RETSIGTYPE
sigsegv(int sig SIGINFO_ARG)
{
if (segv_received) {
+ ssize_t RB_UNUSED_VAR(err);
char msg[] = "SEGV received in SEGV handler\n";
- write(2, msg, sizeof(msg));
+
+ err = write(2, msg, sizeof(msg));
ruby_abort();
}
@@ -637,8 +703,24 @@ sigsegv(int sig SIGINFO_ARG)
static void
signal_exec(VALUE cmd, int safe, int sig)
{
- VALUE signum = INT2NUM(sig);
- rb_eval_cmd(cmd, rb_ary_new3(1, signum), safe);
+ rb_thread_t *cur_th = GET_THREAD();
+ volatile unsigned long old_interrupt_mask = cur_th->interrupt_mask;
+ int state;
+
+ cur_th->interrupt_mask |= TRAP_INTERRUPT_MASK;
+ TH_PUSH_TAG(cur_th);
+ if ((state = EXEC_TAG()) == 0) {
+ VALUE signum = INT2NUM(sig);
+ rb_eval_cmd(cmd, rb_ary_new3(1, signum), safe);
+ }
+ TH_POP_TAG();
+ cur_th = GET_THREAD();
+ cur_th->interrupt_mask = old_interrupt_mask;
+
+ if (state) {
+ /* XXX: should be replaced with rb_threadptr_pending_interrupt_enque() */
+ JUMP_TAG(state);
+ }
}
void
@@ -695,15 +777,6 @@ rb_signal_exec(rb_thread_t *th, int sig)
}
}
-struct trap_arg {
-#if USE_TRAP_MASK
- sigset_t mask;
-#endif
- int sig;
- sighandler_t func;
- VALUE cmd;
-};
-
static sighandler_t
default_handler(int sig)
{
@@ -738,9 +811,6 @@ default_handler(int sig)
#ifdef SIGSEGV
case SIGSEGV:
func = (sighandler_t)sigsegv;
-# ifdef USE_SIGALTSTACK
- rb_register_sigaltstack(GET_THREAD());
-# endif
break;
#endif
#ifdef SIGPIPE
@@ -814,6 +884,7 @@ sig_dfl:
else {
rb_proc_t *proc;
GetProcPtr(*cmd, proc);
+ (void)proc;
}
}
@@ -853,13 +924,17 @@ trap_signm(VALUE vsig)
}
static VALUE
-trap(struct trap_arg *arg)
+trap(int sig, sighandler_t func, VALUE command)
{
- sighandler_t oldfunc, func = arg->func;
- VALUE oldcmd, command = arg->cmd;
- int sig = arg->sig;
+ sighandler_t oldfunc;
+ VALUE oldcmd;
rb_vm_t *vm = GET_VM();
+ /*
+ * Be careful. ruby_signal() and trap_list[sig].cmd must be changed
+ * atomically. In current implementation, we only need to don't call
+ * RUBY_VM_CHECK_INTS().
+ */
oldfunc = ruby_signal(sig, func);
oldcmd = vm->trap_list[sig].cmd;
switch (oldcmd) {
@@ -875,30 +950,38 @@ trap(struct trap_arg *arg)
vm->trap_list[sig].cmd = command;
vm->trap_list[sig].safe = rb_safe_level();
- /* enable at least specified signal. */
-#if USE_TRAP_MASK
- sigdelset(&arg->mask, sig);
-#endif
+
return oldcmd;
}
-#if USE_TRAP_MASK
-static VALUE
-trap_ensure(struct trap_arg *arg)
+static int
+reserved_signal_p(int signo)
{
- /* enable interrupt */
- pthread_sigmask(SIG_SETMASK, &arg->mask, NULL);
- trap_last_mask = arg->mask;
- return 0;
-}
+/* Synchronous signal can't deliver to main thread */
+#ifdef SIGSEGV
+ if (signo == SIGSEGV)
+ return 1;
+#endif
+#ifdef SIGBUS
+ if (signo == SIGBUS)
+ return 1;
+#endif
+#ifdef SIGILL
+ if (signo == SIGILL)
+ return 1;
+#endif
+#ifdef SIGFPE
+ if (signo == SIGFPE)
+ return 1;
#endif
-void
-rb_trap_restore_mask(void)
-{
-#if USE_TRAP_MASK
- pthread_sigmask(SIG_SETMASK, &trap_last_mask, NULL);
+/* used ubf internal see thread_pthread.c. */
+#ifdef SIGVTALRM
+ if (signo == SIGVTALRM)
+ return 1;
#endif
+
+ return 0;
}
/*
@@ -935,39 +1018,36 @@ rb_trap_restore_mask(void)
static VALUE
sig_trap(int argc, VALUE *argv)
{
- struct trap_arg arg;
+ int sig;
+ sighandler_t func;
+ VALUE cmd;
rb_secure(2);
- if (argc < 1 || argc > 2) {
- rb_raise(rb_eArgError, "wrong number of arguments (%d for 1..2)", argc);
+ rb_check_arity(argc, 1, 2);
+
+ sig = trap_signm(argv[0]);
+ if (reserved_signal_p(sig)) {
+ const char *name = signo2signm(sig);
+ if (name)
+ rb_raise(rb_eArgError, "can't trap reserved signal: SIG%s", name);
+ else
+ rb_raise(rb_eArgError, "can't trap reserved signal: %d", sig);
}
- arg.sig = trap_signm(argv[0]);
if (argc == 1) {
- arg.cmd = rb_block_proc();
- arg.func = sighandler;
+ cmd = rb_block_proc();
+ func = sighandler;
}
else {
- arg.cmd = argv[1];
- arg.func = trap_handler(&arg.cmd, arg.sig);
+ cmd = argv[1];
+ func = trap_handler(&cmd, sig);
}
- if (OBJ_TAINTED(arg.cmd)) {
+ if (OBJ_TAINTED(cmd)) {
rb_raise(rb_eSecurityError, "Insecure: tainted signal trap");
}
-#if USE_TRAP_MASK
- {
- sigset_t fullmask;
- /* disable interrupt */
- sigfillset(&fullmask);
- pthread_sigmask(SIG_BLOCK, &fullmask, &arg.mask);
-
- return rb_ensure(trap, (VALUE)&arg, trap_ensure, (VALUE)&arg);
- }
-#else
- return trap(&arg);
-#endif
+ return trap(sig, func, cmd);
}
/*
@@ -996,10 +1076,14 @@ install_sighandler(int signum, sighandler_t handler)
{
sighandler_t old;
+ /* At this time, there is no subthread. Then sigmask guarantee atomics. */
+ rb_disable_interrupt();
old = ruby_signal(signum, handler);
+ /* signal handler should be inherited during exec. */
if (old != SIG_DFL) {
ruby_signal(signum, old);
}
+ rb_enable_interrupt();
}
#if defined(SIGCLD) || defined(SIGCHLD)
@@ -1007,27 +1091,15 @@ static void
init_sigchld(int sig)
{
sighandler_t oldfunc;
-#if USE_TRAP_MASK
- sigset_t mask;
- sigset_t fullmask;
-
- /* disable interrupt */
- sigfillset(&fullmask);
- pthread_sigmask(SIG_BLOCK, &fullmask, &mask);
-#endif
+ rb_disable_interrupt();
oldfunc = ruby_signal(sig, SIG_DFL);
if (oldfunc != SIG_DFL && oldfunc != SIG_IGN) {
ruby_signal(sig, oldfunc);
} else {
GET_VM()->trap_list[sig].cmd = 0;
}
-
-#if USE_TRAP_MASK
- sigdelset(&mask, sig);
- pthread_sigmask(SIG_SETMASK, &mask, NULL);
- trap_last_mask = mask;
-#endif
+ rb_enable_interrupt();
}
#endif
@@ -1093,6 +1165,7 @@ Init_signal(void)
rb_define_global_function("trap", sig_trap, -1);
rb_define_module_function(mSignal, "trap", sig_trap, -1);
rb_define_module_function(mSignal, "list", sig_list, 0);
+ rb_define_module_function(mSignal, "signame", sig_signame, 1);
rb_define_method(rb_eSignal, "initialize", esignal_init, -1);
rb_define_method(rb_eSignal, "signo", esignal_signo, 0);
diff --git a/siphash.c b/siphash.c
index c100b14ee7..2018ade431 100644
--- a/siphash.c
+++ b/siphash.c
@@ -29,7 +29,7 @@
#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(__mc68020__)
# define UNALIGNED_WORD_ACCESS 1
# endif
diff --git a/sparc.c b/sparc.c
index e5f7985e19..dc3779035f 100644
--- a/sparc.c
+++ b/sparc.c
@@ -9,9 +9,19 @@
See http://bugs.ruby-lang.org/issues/5244 for discussion.
*********************************************************************/
-void rb_sparc_flush_register_windows(void)
+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 a23df2f25a..c4b75f614a 100644
--- a/spec/default.mspec
+++ b/spec/default.mspec
@@ -13,9 +13,9 @@ class MSpecScript
set :target, File.join(builddir, "miniruby#{config['exeext']}")
set :prefix, File.expand_path('rubyspec', File.dirname(__FILE__))
set :flags, %W[
- -I#{srcdir}/lib
- -I#{srcdir}/#{config['EXTOUT']}/common
- -I#{srcdir}/-
- #{srcdir}/tool/runruby.rb --extout=#{config['EXTOUT']}
+ -I#{File.expand_path srcdir}/lib
+ -I#{File.expand_path srcdir}/#{config['EXTOUT']}/common
+ -I#{File.expand_path srcdir}/-
+ #{File.expand_path srcdir}/tool/runruby.rb --archdir=#{Dir.pwd} --extout=#{config['EXTOUT']}
]
end
diff --git a/sprintf.c b/sprintf.c
index eb8cd73985..97b2126422 100644
--- a/sprintf.c
+++ b/sprintf.c
@@ -14,6 +14,7 @@
#include "ruby/ruby.h"
#include "ruby/re.h"
#include "ruby/encoding.h"
+#include "internal.h"
#include <math.h>
#include <stdarg.h>
@@ -22,35 +23,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)
@@ -119,19 +95,22 @@ sign_bits(int base, const char *p)
#define GETNTHARG(nth) \
(((nth) >= argc) ? (rb_raise(rb_eArgError, "too few arguments"), 0) : argv[(nth)])
-#define GETNAMEARG(id, name, len) ( \
+#define GETNAMEARG(id, name, len, enc) ( \
posarg > 0 ? \
- (rb_raise(rb_eArgError, "named%.*s after unnumbered(%d)", (len), (name), posarg), 0) : \
+ (rb_enc_raise((enc), rb_eArgError, "named%.*s after unnumbered(%d)", (len), (name), posarg), 0) : \
posarg == -1 ? \
- (rb_raise(rb_eArgError, "named%.*s after numbered", (len), (name)), 0) : \
+ (rb_enc_raise((enc), rb_eArgError, "named%.*s after numbered", (len), (name)), 0) : \
(posarg = -2, rb_hash_lookup2(get_hash(&hash, argc, argv), (id), Qundef)))
#define GETNUM(n, val) \
for (; p < end && rb_enc_isdigit(*p, enc); p++) { \
- int next_n = 10 * (n) + (*p - '0'); \
- if (next_n / 10 != (n)) {\
+ int next_n = (n); \
+ if (MUL_OVERFLOW_INT_P(10, next_n)) \
+ rb_raise(rb_eArgError, #val " too big"); \
+ next_n *= 10; \
+ if (INT_MAX - (*p - '0') < next_n) \
rb_raise(rb_eArgError, #val " too big"); \
- } \
+ next_n += *p - '0'; \
(n) = next_n; \
} \
if (p >= end) { \
@@ -161,7 +140,7 @@ get_hash(volatile VALUE *hash, int argc, const VALUE *argv)
if (argc != 2) {
rb_raise(rb_eArgError, "one hash required");
}
- tmp = rb_check_convert_type(argv[1], T_HASH, "Hash", "to_hash");
+ tmp = rb_check_hash_type(argv[1]);
if (NIL_P(tmp)) {
rb_raise(rb_eArgError, "one hash required");
}
@@ -422,7 +401,7 @@ get_hash(volatile VALUE *hash, int argc, const VALUE *argv)
* For more complex formatting, Ruby supports a reference by name.
* %<name>s style uses format style, but %{name} style doesn't.
*
- * Exapmles:
+ * Examples:
* sprintf("%<foo>d : %<bar>f", { :foo => 1, :bar => 2 })
* #=> 1 : 2.000000
* sprintf("%{foo}f", { :foo => 1 })
@@ -566,6 +545,7 @@ rb_str_format(int argc, const VALUE *argv, VALUE fmt)
{
const char *start = p;
char term = (*p == '<') ? '>' : '}';
+ int len;
for (; p < end && *p != term; ) {
p += rb_enc_mbclen(p, end, enc);
@@ -573,14 +553,27 @@ rb_str_format(int argc, const VALUE *argv, VALUE fmt)
if (p >= end) {
rb_raise(rb_eArgError, "malformed name - unmatched parenthesis");
}
+#if SIZEOF_INT < SIZEOF_SIZE_T
+ if ((size_t)(p - start) >= INT_MAX) {
+ const int message_limit = 20;
+ len = (int)(rb_enc_right_char_head(start, start + message_limit, p, enc) - start);
+ rb_enc_raise(enc, rb_eArgError,
+ "too long name (%"PRIdSIZE" bytes) - %.*s...%c",
+ (size_t)(p - start - 2), len, start, term);
+ }
+#endif
+ len = (int)(p - start + 1); /* including parenthesis */
if (id) {
- rb_raise(rb_eArgError, "name%.*s after <%s>",
- (int)(p - start + 1), start, rb_id2name(id));
+ rb_enc_raise(enc, rb_eArgError, "named%.*s after <%s>",
+ len, start, rb_id2name(id));
}
- id = rb_intern3(start + 1, p - start - 1, enc);
- nextvalue = GETNAMEARG(ID2SYM(id), start, (int)(p - start + 1));
+ nextvalue = GETNAMEARG((id = rb_check_id_cstr(start + 1,
+ len - 2 /* without parenthesis */,
+ enc),
+ ID2SYM(id)),
+ start, len, enc);
if (nextvalue == Qundef) {
- rb_raise(rb_eKeyError, "key%.*s not found", (int)(p - start + 1), start);
+ rb_enc_raise(enc, rb_eKeyError, "key%.*s not found", len, start);
}
if (term == '}') goto format_s;
p++;
@@ -740,7 +733,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;
@@ -817,96 +811,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 : RBIGNUM_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);
}
@@ -965,21 +961,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);
@@ -1132,6 +1122,11 @@ fmt_setup(char *buf, size_t size, int c, int flags, int width, int prec)
#define BSD__hdtoa ruby_hdtoa
#include "vsnprintf.c"
+typedef struct {
+ rb_printf_buffer base;
+ volatile VALUE value;
+} rb_printf_buffer_extra;
+
static int
ruby__sfvwrite(register rb_printf_buffer *fp, register struct __suio *uio)
{
@@ -1155,27 +1150,76 @@ ruby__sfvwrite(register rb_printf_buffer *fp, register struct __suio *uio)
len -= n;
}
fp->_p = (unsigned char *)buf;
+ rb_str_set_len(result, buf - RSTRING_PTR(result));
return 0;
}
+static char *
+ruby__sfvextra(rb_printf_buffer *fp, size_t valsize, void *valp, long *sz, int sign)
+{
+ VALUE value, result = (VALUE)fp->_bf._base;
+ rb_encoding *enc;
+ char *cp;
+
+ if (valsize != sizeof(VALUE)) return 0;
+ value = *(VALUE *)valp;
+ if (RBASIC(result)->klass) {
+ rb_raise(rb_eRuntimeError, "rb_vsprintf reentered");
+ }
+ if (sign == '+') {
+ value = rb_inspect(value);
+ }
+ else {
+ value = rb_obj_as_string(value);
+ if (sign == ' ') value = QUOTE(value);
+ }
+ enc = rb_enc_compatible(result, value);
+ if (enc) {
+ rb_enc_associate(result, enc);
+ }
+ else {
+ enc = rb_enc_get(result);
+ value = rb_str_conv_enc_opts(value, rb_enc_get(value), enc,
+ ECONV_UNDEF_REPLACE|ECONV_INVALID_REPLACE,
+ Qnil);
+ *(volatile VALUE *)valp = value;
+ }
+ StringValueCStr(value);
+ RSTRING_GETMEM(value, cp, *sz);
+ ((rb_printf_buffer_extra *)fp)->value = value;
+ OBJ_INFECT(result, value);
+ return cp;
+}
+
VALUE
rb_enc_vsprintf(rb_encoding *enc, const char *fmt, va_list ap)
{
- rb_printf_buffer f;
+ rb_printf_buffer_extra buffer;
+#define f buffer.base
VALUE result;
f._flags = __SWR | __SSTR;
f._bf._size = 0;
f._w = 120;
result = rb_str_buf_new(f._w);
- if (enc) rb_enc_associate(result, enc);
+ if (enc) {
+ if (rb_enc_mbminlen(enc) > 1) {
+ /* the implementation deeply depends on plain char */
+ rb_raise(rb_eArgError, "cannot construct wchar_t based encoding string: %s",
+ rb_enc_name(enc));
+ }
+ rb_enc_associate(result, enc);
+ }
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
return result;
}
@@ -1215,7 +1259,8 @@ rb_sprintf(const char *format, ...)
VALUE
rb_str_vcatf(VALUE str, const char *fmt, va_list ap)
{
- rb_printf_buffer f;
+ rb_printf_buffer_extra buffer;
+#define f buffer.base
VALUE klass;
StringValue(str);
@@ -1226,11 +1271,14 @@ 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
return str;
}
diff --git a/st.c b/st.c
index 8c238c33f8..c8f72c68c8 100644
--- a/st.c
+++ b/st.c
@@ -25,8 +25,22 @@ struct st_table_entry {
st_table_entry *fore, *back;
};
+typedef struct st_packed_entry {
+ st_index_t hash;
+ st_data_t key, val;
+} 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_PACKED_TABLE_SIZE 18
+#define PACKED_UNIT (int)(sizeof(st_packed_entry) / sizeof(st_table_entry*))
+#define MAX_PACKED_HASH (int)(ST_DEFAULT_PACKED_TABLE_SIZE * sizeof(st_table_entry*) / sizeof(st_packed_entry))
+
+STATIC_ASSERT(st_packed_entry, sizeof(st_packed_entry) == sizeof(st_table_entry*[PACKED_UNIT]))
+STATIC_ASSERT(st_packed_bins, sizeof(st_packed_entry[MAX_PACKED_HASH]) <= sizeof(st_table_entry*[ST_DEFAULT_PACKED_TABLE_SIZE]))
/*
* DEFAULT_MAX_DENSITY is the default for the largest we allow the
@@ -38,7 +52,8 @@ struct st_table_entry {
*
*/
-static const struct st_hash_type type_numhash = {
+#define type_numhash st_hashtype_num
+const struct st_hash_type st_hashtype_num = {
st_numcmp,
st_numhash,
};
@@ -52,7 +67,7 @@ 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,
};
@@ -61,20 +76,69 @@ static void rehash(st_table *);
#ifdef RUBY
#define malloc xmalloc
#define calloc xcalloc
+#define realloc xrealloc
#define free(x) xfree(x)
#endif
#define numberof(array) (int)(sizeof(array) / sizeof((array)[0]))
-#define alloc(type) (type*)malloc((size_t)sizeof(type))
-#define Calloc(n,s) (char*)calloc((n),(s))
-
#define EQUAL(table,x,y) ((x)==(y) || (*(table)->type->compare)((x),(y)) == 0)
-/* remove cast to unsigned int in the future */
-#define do_hash(key,table) (unsigned int)(st_index_t)(*(table)->type->hash)((key))
+#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)
+/* preparation for possible allocation improvements */
+#define st_alloc_entry() (st_table_entry *)malloc(sizeof(st_table_entry))
+#define st_free_entry(entry) free(entry)
+#define st_alloc_table() (st_table *)malloc(sizeof(st_table))
+#define st_dealloc_table(table) free(table)
+#define st_alloc_bins(size) (st_table_entry **)calloc(size, sizeof(st_table_entry *))
+#define st_free_bins(bins, size) free(bins)
+static inline st_table_entry**
+st_realloc_bins(st_table_entry **bins, st_index_t newsize, st_index_t oldsize)
+{
+ bins = (st_table_entry **)realloc(bins, newsize * sizeof(st_table_entry *));
+ MEMZERO(bins, st_table_entry*, newsize);
+ return bins;
+}
+
+/* Shortcut */
+#define bins as.big.bins
+#define head as.big.head
+#define tail as.big.tail
+#define real_entries as.packed.real_entries
+
+/* preparation for possible packing improvements */
+#define PACKED_BINS(table) ((table)->as.packed.entries)
+#define PACKED_ENT(table, i) PACKED_BINS(table)[i]
+#define PKEY(table, i) PACKED_ENT((table), (i)).key
+#define PVAL(table, i) PACKED_ENT((table), (i)).val
+#define PHASH(table, i) PACKED_ENT((table), (i)).hash
+#define PKEY_SET(table, i, v) (PKEY((table), (i)) = (v))
+#define PVAL_SET(table, i, v) (PVAL((table), (i)) = (v))
+#define PHASH_SET(table, i, v) (PHASH((table), (i)) = (v))
+
+/* this function depends much on packed layout, so that it placed here */
+static inline void
+remove_packed_entry(st_table *table, st_index_t i)
+{
+ table->real_entries--;
+ table->num_entries--;
+ if (i < table->real_entries) {
+ MEMMOVE(&PACKED_ENT(table, i), &PACKED_ENT(table, i+1),
+ st_packed_entry, table->real_entries - i);
+ }
+}
+
+static inline void
+remove_safe_packed_entry(st_table *table, st_index_t i, st_data_t never)
+{
+ table->num_entries--;
+ PKEY_SET(table, i, never);
+ PVAL_SET(table, i, never);
+ PHASH_SET(table, i, 0);
+}
+
/*
* MINSIZE is the minimum size of a dictionary.
*/
@@ -85,8 +149,8 @@ static void rehash(st_table *);
Table of prime numbers 2^n+a, 2<=n<=30.
*/
static const unsigned int primes[] = {
- 8 + 3,
- 16 + 3,
+ ST_DEFAULT_INIT_TABLE_SIZE,
+ ST_DEFAULT_SECOND_TABLE_SIZE,
32 + 5,
64 + 3,
128 + 3,
@@ -161,8 +225,6 @@ stat_col(void)
}
#endif
-#define MAX_PACKED_NUMHASH (ST_DEFAULT_INIT_TABLE_SIZE/2)
-
st_table*
st_init_table_with_size(const struct st_hash_type *type, st_index_t size)
{
@@ -181,14 +243,19 @@ st_init_table_with_size(const struct st_hash_type *type, st_index_t size)
}
#endif
- size = new_size(size); /* round up to prime number */
- tbl = alloc(st_table);
+ tbl = st_alloc_table();
tbl->type = type;
tbl->num_entries = 0;
- tbl->entries_packed = type == &type_numhash && size/2 <= MAX_PACKED_NUMHASH;
+ tbl->entries_packed = size <= MAX_PACKED_HASH;
+ if (tbl->entries_packed) {
+ size = ST_DEFAULT_PACKED_TABLE_SIZE;
+ }
+ else {
+ size = new_size(size); /* round up to prime number */
+ }
tbl->num_bins = size;
- tbl->bins = (st_table_entry **)Calloc(size, sizeof(st_table_entry*));
+ tbl->bins = st_alloc_bins(size);
tbl->head = 0;
tbl->tail = 0;
@@ -245,15 +312,16 @@ st_clear(st_table *table)
if (table->entries_packed) {
table->num_entries = 0;
+ table->real_entries = 0;
return;
}
- for(i = 0; i < table->num_bins; i++) {
+ for (i = 0; i < table->num_bins; i++) {
ptr = table->bins[i];
table->bins[i] = 0;
while (ptr != 0) {
next = ptr->next;
- free(ptr);
+ st_free_entry(ptr);
ptr = next;
}
}
@@ -266,8 +334,8 @@ void
st_free_table(st_table *table)
{
st_clear(table);
- free(table->bins);
- free(table);
+ st_free_bins(table->bins, table->num_bins);
+ st_dealloc_table(table);
}
size_t
@@ -306,46 +374,61 @@ count_collision(const struct st_hash_type *type)
#define FOUND_ENTRY
#endif
-#define FIND_ENTRY(table, ptr, hash_val, bin_pos) do {\
- (bin_pos) = (hash_val)%(table)->num_bins;\
- (ptr) = (table)->bins[(bin_pos)];\
- FOUND_ENTRY;\
- if (PTR_NOT_EQUAL((table), (ptr), (hash_val), key)) {\
- COLLISION;\
- while (PTR_NOT_EQUAL((table), (ptr)->next, (hash_val), key)) {\
- (ptr) = (ptr)->next;\
- }\
- (ptr) = (ptr)->next;\
- }\
-} while (0)
+#define FIND_ENTRY(table, ptr, hash_val, bin_pos) \
+ ((ptr) = find_entry((table), key, (hash_val), ((bin_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)
+{
+ register st_table_entry *ptr = table->bins[bin_pos];
+ FOUND_ENTRY;
+ if (PTR_NOT_EQUAL(table, ptr, hash_val, key)) {
+ COLLISION;
+ while (PTR_NOT_EQUAL(table, ptr->next, hash_val, key)) {
+ ptr = ptr->next;
+ }
+ ptr = ptr->next;
+ }
+ return ptr;
+}
+
+static inline st_index_t
+find_packed_index(st_table *table, st_index_t hash_val, st_data_t key)
+{
+ st_index_t i = 0;
+ while (i < table->real_entries &&
+ (PHASH(table, i) != hash_val || !EQUAL(table, key, PKEY(table, i)))) {
+ i++;
+ }
+ return i;
+}
#define collision_check 0
int
st_lookup(st_table *table, register st_data_t key, st_data_t *value)
{
- st_index_t hash_val, bin_pos;
+ st_index_t hash_val;
register st_table_entry *ptr;
+ hash_val = do_hash(key, table);
+
if (table->entries_packed) {
- st_index_t i;
- for (i = 0; i < table->num_entries; i++) {
- if ((st_data_t)table->bins[i*2] == key) {
- if (value !=0) *value = (st_data_t)table->bins[i*2+1];
- return 1;
- }
- }
+ st_index_t i = find_packed_index(table, hash_val, key);
+ if (i < table->real_entries) {
+ if (value != 0) *value = PVAL(table, i);
+ return 1;
+ }
return 0;
}
- hash_val = do_hash(key, table);
- FIND_ENTRY(table, ptr, hash_val, bin_pos);
+ ptr = find_entry(table, key, hash_val, hash_val % table->num_bins);
if (ptr == 0) {
return 0;
}
else {
- if (value != 0) *value = ptr->record;
+ if (value != 0) *value = ptr->record;
return 1;
}
}
@@ -353,22 +436,21 @@ st_lookup(st_table *table, register st_data_t key, st_data_t *value)
int
st_get_key(st_table *table, register st_data_t key, st_data_t *result)
{
- st_index_t hash_val, bin_pos;
+ st_index_t hash_val;
register st_table_entry *ptr;
+ hash_val = do_hash(key, table);
+
if (table->entries_packed) {
- st_index_t i;
- for (i = 0; i < table->num_entries; i++) {
- if ((st_data_t)table->bins[i*2] == key) {
- if (result !=0) *result = (st_data_t)table->bins[i*2];
- return 1;
- }
- }
+ st_index_t i = find_packed_index(table, hash_val, key);
+ if (i < table->real_entries) {
+ if (result != 0) *result = PKEY(table, i);
+ return 1;
+ }
return 0;
}
- hash_val = do_hash(key, table);
- FIND_ENTRY(table, ptr, hash_val, bin_pos);
+ ptr = find_entry(table, key, hash_val, hash_val % table->num_bins);
if (ptr == 0) {
return 0;
@@ -382,85 +464,120 @@ st_get_key(st_table *table, register st_data_t key, st_data_t *result)
#undef collision_check
#define collision_check 1
-#define MORE_PACKABLE_P(table) \
- ((st_index_t)((table)->num_entries+1) * 2 <= (table)->num_bins && \
- (table)->num_entries+1 <= MAX_PACKED_NUMHASH)
-
-#define ADD_DIRECT(table, key, value, hash_val, bin_pos)\
-do {\
- st_table_entry *entry;\
- if ((table)->num_entries > ST_DEFAULT_MAX_DENSITY * (table)->num_bins) {\
- rehash(table);\
- (bin_pos) = (hash_val) % (table)->num_bins;\
- }\
- \
- entry = alloc(st_table_entry);\
- \
- entry->hash = (hash_val);\
- entry->key = (key);\
- entry->record = (value);\
- entry->next = (table)->bins[(bin_pos)];\
- if ((table)->head != 0) {\
- entry->fore = 0;\
- (entry->back = (table)->tail)->fore = entry;\
- (table)->tail = entry;\
- }\
- else {\
- (table)->head = (table)->tail = entry;\
- entry->fore = entry->back = 0;\
- }\
- (table)->bins[(bin_pos)] = entry;\
- (table)->num_entries++;\
-} while (0)
+static inline st_table_entry *
+new_entry(st_table * table, st_data_t key, st_data_t value,
+ st_index_t hash_val, register st_index_t bin_pos)
+{
+ register st_table_entry *entry = st_alloc_entry();
+
+ entry->next = table->bins[bin_pos];
+ table->bins[bin_pos] = entry;
+ entry->hash = hash_val;
+ entry->key = key;
+ entry->record = value;
+
+ return entry;
+}
+
+static inline void
+add_direct(st_table *table, st_data_t key, st_data_t value,
+ st_index_t hash_val, register st_index_t bin_pos)
+{
+ 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;
+ }
+
+ entry = new_entry(table, key, value, hash_val, bin_pos);
+
+ if (table->head != 0) {
+ entry->fore = 0;
+ (entry->back = table->tail)->fore = entry;
+ table->tail = entry;
+ }
+ else {
+ table->head = table->tail = entry;
+ entry->fore = entry->back = 0;
+ }
+ table->num_entries++;
+}
static void
unpack_entries(register st_table *table)
{
st_index_t i;
- struct st_table_entry *packed_bins[MAX_PACKED_NUMHASH*2];
+ st_packed_entry packed_bins[MAX_PACKED_HASH];
+ register st_table_entry *entry, *preventry = 0, **chain;
st_table tmp_table = *table;
- memcpy(packed_bins, table->bins, sizeof(struct st_table_entry *) * table->num_entries*2);
- table->bins = packed_bins;
+ MEMCPY(packed_bins, PACKED_BINS(table), st_packed_entry, MAX_PACKED_HASH);
+ table->as.packed.entries = packed_bins;
tmp_table.entries_packed = 0;
- tmp_table.num_entries = 0;
- memset(tmp_table.bins, 0, sizeof(struct st_table_entry *) * tmp_table.num_bins);
- for (i = 0; i < table->num_entries; i++) {
- st_insert(&tmp_table, (st_data_t)packed_bins[i*2], (st_data_t)packed_bins[i*2+1]);
- }
+#if ST_DEFAULT_INIT_TABLE_SIZE == ST_DEFAULT_PACKED_TABLE_SIZE
+ MEMZERO(tmp_table.bins, st_table_entry*, tmp_table.num_bins);
+#else
+ tmp_table.bins = st_realloc_bins(tmp_table.bins, ST_DEFAULT_INIT_TABLE_SIZE, tmp_table.num_bins);
+ tmp_table.num_bins = ST_DEFAULT_INIT_TABLE_SIZE;
+#endif
+ i = 0;
+ chain = &tmp_table.head;
+ do {
+ st_data_t key = packed_bins[i].key;
+ st_data_t val = packed_bins[i].val;
+ st_index_t hash = packed_bins[i].hash;
+ entry = new_entry(&tmp_table, key, val, hash,
+ hash % ST_DEFAULT_INIT_TABLE_SIZE);
+ *chain = entry;
+ entry->back = preventry;
+ preventry = entry;
+ chain = &entry->fore;
+ } while (++i < MAX_PACKED_HASH);
+ *chain = NULL;
+ tmp_table.tail = entry;
*table = tmp_table;
}
+static void
+add_packed_direct(st_table *table, st_data_t key, st_data_t value, st_index_t hash_val)
+{
+ if (table->real_entries < MAX_PACKED_HASH) {
+ st_index_t i = table->real_entries++;
+ PKEY_SET(table, i, key);
+ PVAL_SET(table, i, value);
+ PHASH_SET(table, i, hash_val);
+ table->num_entries++;
+ }
+ else {
+ unpack_entries(table);
+ add_direct(table, key, value, hash_val, hash_val % table->num_bins);
+ }
+}
+
+
int
st_insert(register st_table *table, register st_data_t key, st_data_t value)
{
- st_index_t hash_val, bin_pos;
+ st_index_t hash_val;
+ register st_index_t bin_pos;
register st_table_entry *ptr;
+ hash_val = do_hash(key, table);
+
if (table->entries_packed) {
- st_index_t i;
- for (i = 0; i < table->num_entries; i++) {
- if ((st_data_t)table->bins[i*2] == key) {
- table->bins[i*2+1] = (struct st_table_entry*)value;
- return 1;
- }
- }
- if (MORE_PACKABLE_P(table)) {
- i = table->num_entries++;
- table->bins[i*2] = (struct st_table_entry*)key;
- table->bins[i*2+1] = (struct st_table_entry*)value;
- return 0;
- }
- else {
- unpack_entries(table);
+ st_index_t i = find_packed_index(table, hash_val, key);
+ if (i < table->real_entries) {
+ PVAL_SET(table, i, value);
+ return 1;
}
+ add_packed_direct(table, key, value, hash_val);
+ return 0;
}
- hash_val = do_hash(key, table);
FIND_ENTRY(table, ptr, hash_val, bin_pos);
if (ptr == 0) {
- ADD_DIRECT(table, key, value, hash_val, bin_pos);
+ add_direct(table, key, value, hash_val, bin_pos);
return 0;
}
else {
@@ -473,34 +590,28 @@ int
st_insert2(register st_table *table, register st_data_t key, st_data_t value,
st_data_t (*func)(st_data_t))
{
- st_index_t hash_val, bin_pos;
+ st_index_t hash_val;
+ register st_index_t bin_pos;
register st_table_entry *ptr;
+ hash_val = do_hash(key, table);
+
if (table->entries_packed) {
- st_index_t i;
- for (i = 0; i < table->num_entries; i++) {
- if ((st_data_t)table->bins[i*2] == key) {
- table->bins[i*2+1] = (struct st_table_entry*)value;
- return 1;
- }
- }
- if (MORE_PACKABLE_P(table)) {
- i = table->num_entries++;
- table->bins[i*2] = (struct st_table_entry*)key;
- table->bins[i*2+1] = (struct st_table_entry*)value;
- return 0;
- }
- else {
- unpack_entries(table);
- }
+ st_index_t i = find_packed_index(table, hash_val, key);
+ if (i < table->real_entries) {
+ PVAL_SET(table, i, value);
+ return 1;
+ }
+ key = (*func)(key);
+ add_packed_direct(table, key, value, hash_val);
+ return 0;
}
- hash_val = do_hash(key, table);
FIND_ENTRY(table, ptr, hash_val, bin_pos);
if (ptr == 0) {
key = (*func)(key);
- ADD_DIRECT(table, key, value, hash_val, bin_pos);
+ add_direct(table, key, value, hash_val, bin_pos);
return 0;
}
else {
@@ -512,36 +623,25 @@ st_insert2(register st_table *table, register st_data_t key, st_data_t value,
void
st_add_direct(st_table *table, st_data_t key, st_data_t value)
{
- st_index_t hash_val, bin_pos;
+ st_index_t hash_val;
+ hash_val = do_hash(key, table);
if (table->entries_packed) {
- st_index_t i;
- if (MORE_PACKABLE_P(table)) {
- i = table->num_entries++;
- table->bins[i*2] = (struct st_table_entry*)key;
- table->bins[i*2+1] = (struct st_table_entry*)value;
- return;
- }
- else {
- unpack_entries(table);
- }
+ add_packed_direct(table, key, value, hash_val);
+ return;
}
- hash_val = do_hash(key, table);
- bin_pos = hash_val % table->num_bins;
- ADD_DIRECT(table, key, value, hash_val, bin_pos);
+ add_direct(table, key, value, hash_val, hash_val % table->num_bins);
}
static void
rehash(register st_table *table)
{
register st_table_entry *ptr, **new_bins;
- st_index_t i, new_num_bins, hash_val;
+ st_index_t new_num_bins, hash_val;
new_num_bins = new_size(table->num_bins+1);
- new_bins = (st_table_entry**)
- xrealloc(table->bins, new_num_bins * sizeof(st_table_entry*));
- for (i = 0; i < new_num_bins; ++i) new_bins[i] = 0;
+ new_bins = st_realloc_bins(table->bins, new_num_bins, table->num_bins);
table->num_bins = new_num_bins;
table->bins = new_bins;
@@ -558,34 +658,33 @@ st_table*
st_copy(st_table *old_table)
{
st_table *new_table;
- st_table_entry *ptr, *entry, *prev, **tail;
+ st_table_entry *ptr, *entry, *prev, **tailp;
st_index_t num_bins = old_table->num_bins;
st_index_t hash_val;
- new_table = alloc(st_table);
+ new_table = st_alloc_table();
if (new_table == 0) {
return 0;
}
*new_table = *old_table;
- new_table->bins = (st_table_entry**)
- Calloc((unsigned)num_bins, sizeof(st_table_entry*));
+ new_table->bins = st_alloc_bins(num_bins);
if (new_table->bins == 0) {
- free(new_table);
+ st_dealloc_table(new_table);
return 0;
}
if (old_table->entries_packed) {
- memcpy(new_table->bins, old_table->bins, sizeof(struct st_table_entry *) * old_table->num_bins);
+ MEMCPY(new_table->bins, old_table->bins, st_table_entry*, old_table->num_bins);
return new_table;
}
if ((ptr = old_table->head) != 0) {
prev = 0;
- tail = &new_table->head;
+ tailp = &new_table->head;
do {
- entry = alloc(st_table_entry);
+ entry = st_alloc_entry();
if (entry == 0) {
st_free_table(new_table);
return 0;
@@ -595,8 +694,8 @@ st_copy(st_table *old_table)
entry->next = new_table->bins[hash_val];
new_table->bins[hash_val] = entry;
entry->back = prev;
- *tail = prev = entry;
- tail = &entry->fore;
+ *tailp = prev = entry;
+ tailp = &entry->fore;
} while ((ptr = ptr->fore) != 0);
new_table->tail = prev;
}
@@ -604,21 +703,22 @@ st_copy(st_table *old_table)
return new_table;
}
-#define REMOVE_ENTRY(table, ptr) do \
- { \
- if ((ptr)->fore == 0 && (ptr)->back == 0) { \
- (table)->head = 0; \
- (table)->tail = 0; \
- } \
- else { \
- st_table_entry *fore = (ptr)->fore, *back = (ptr)->back; \
- if (fore) fore->back = back; \
- if (back) back->fore = fore; \
- if ((ptr) == (table)->head) (table)->head = fore; \
- if ((ptr) == (table)->tail) (table)->tail = back; \
- } \
- (table)->num_entries--; \
- } while (0)
+static inline void
+remove_entry(st_table *table, st_table_entry *ptr)
+{
+ if (ptr->fore == 0 && ptr->back == 0) {
+ table->head = 0;
+ table->tail = 0;
+ }
+ else {
+ st_table_entry *fore = ptr->fore, *back = ptr->back;
+ if (fore) fore->back = back;
+ if (back) back->fore = fore;
+ if (ptr == table->head) table->head = fore;
+ if (ptr == table->tail) table->tail = back;
+ }
+ table->num_entries--;
+}
int
st_delete(register st_table *table, register st_data_t *key, st_data_t *value)
@@ -627,30 +727,28 @@ st_delete(register st_table *table, register st_data_t *key, st_data_t *value)
st_table_entry **prev;
register st_table_entry *ptr;
+ hash_val = do_hash(*key, table);
+
if (table->entries_packed) {
- st_index_t i;
- for (i = 0; i < table->num_entries; i++) {
- if ((st_data_t)table->bins[i*2] == *key) {
- if (value != 0) *value = (st_data_t)table->bins[i*2+1];
- table->num_entries--;
- memmove(&table->bins[i*2], &table->bins[(i+1)*2],
- sizeof(struct st_table_entry*) * 2*(table->num_entries-i));
- return 1;
- }
+ st_index_t i = find_packed_index(table, hash_val, *key);
+ if (i < table->real_entries) {
+ if (value != 0) *value = PVAL(table, i);
+ *key = PKEY(table, i);
+ remove_packed_entry(table, i);
+ return 1;
}
if (value != 0) *value = 0;
return 0;
}
- hash_val = do_hash_bin(*key, table);
-
- for (prev = &table->bins[hash_val]; (ptr = *prev) != 0; prev = &ptr->next) {
+ prev = &table->bins[hash_val % table->num_bins];
+ for (;(ptr = *prev) != 0; prev = &ptr->next) {
if (EQUAL(table, *key, ptr->key)) {
*prev = ptr->next;
- REMOVE_ENTRY(table, ptr);
+ remove_entry(table, ptr);
if (value != 0) *value = ptr->record;
*key = ptr->key;
- free(ptr);
+ st_free_entry(ptr);
return 1;
}
}
@@ -665,25 +763,25 @@ st_delete_safe(register st_table *table, register st_data_t *key, st_data_t *val
st_index_t hash_val;
register st_table_entry *ptr;
+ hash_val = do_hash(*key, table);
+
if (table->entries_packed) {
- st_index_t i;
- for (i = 0; i < table->num_entries; i++) {
- if ((st_data_t)table->bins[i*2] == *key) {
- if (value != 0) *value = (st_data_t)table->bins[i*2+1];
- table->bins[i*2] = (void *)never;
- return 1;
- }
+ st_index_t i = find_packed_index(table, hash_val, *key);
+ if (i < table->real_entries) {
+ if (value != 0) *value = PVAL(table, i);
+ *key = PKEY(table, i);
+ remove_safe_packed_entry(table, i, never);
+ return 1;
}
if (value != 0) *value = 0;
return 0;
}
- hash_val = do_hash_bin(*key, table);
- ptr = table->bins[hash_val];
+ ptr = table->bins[hash_val % table->num_bins];
for (; ptr != 0; ptr = ptr->next) {
if ((ptr->key != never) && EQUAL(table, ptr->key, *key)) {
- REMOVE_ENTRY(table, ptr);
+ remove_entry(table, ptr);
*key = ptr->key;
if (value != 0) *value = ptr->record;
ptr->key = ptr->record = never;
@@ -698,7 +796,6 @@ st_delete_safe(register st_table *table, register st_data_t *key, st_data_t *val
int
st_shift(register st_table *table, register st_data_t *key, st_data_t *value)
{
- st_index_t hash_val;
st_table_entry **prev;
register st_table_entry *ptr;
@@ -708,30 +805,20 @@ st_shift(register st_table *table, register st_data_t *key, st_data_t *value)
}
if (table->entries_packed) {
- if (value != 0) *value = (st_data_t)table->bins[1];
- *key = (st_data_t)table->bins[0];
- table->num_entries--;
- memmove(&table->bins[0], &table->bins[2],
- sizeof(struct st_table_entry*) * 2*table->num_entries);
+ if (value != 0) *value = PVAL(table, 0);
+ *key = PKEY(table, 0);
+ remove_packed_entry(table, 0);
return 1;
}
- hash_val = do_hash_bin(table->head->key, table);
- prev = &table->bins[hash_val];
- for (;(ptr = *prev) != 0; prev = &ptr->next) {
- if (ptr == table->head) {
- *prev = ptr->next;
- REMOVE_ENTRY(table, ptr);
- if (value != 0) *value = ptr->record;
- *key = ptr->key;
- free(ptr);
- return 1;
- }
- }
-
- /* if hash is not consistent and need to be rehashed */
- if (value != 0) *value = 0;
- return 0;
+ prev = &table->bins[table->head->hash % table->num_bins];
+ while ((ptr = *prev) != table->head) prev = &ptr->next;
+ *prev = ptr->next;
+ if (value != 0) *value = ptr->record;
+ *key = ptr->key;
+ remove_entry(table, ptr);
+ st_free_entry(ptr);
+ return 1;
}
void
@@ -742,15 +829,16 @@ st_cleanup_safe(st_table *table, st_data_t never)
if (table->entries_packed) {
st_index_t i = 0, j = 0;
- while ((st_data_t)table->bins[i*2] != never) {
- if (i++ == table->num_entries) return;
+ while (PKEY(table, i) != never) {
+ if (i++ == table->real_entries) return;
}
- for (j = i; ++i < table->num_entries;) {
- if ((st_data_t)table->bins[i*2] == never) continue;
- table->bins[j*2] = table->bins[i*2];
- table->bins[j*2+1] = table->bins[i*2+1];
+ for (j = i; ++i < table->real_entries;) {
+ if (PKEY(table, i) == never) continue;
+ PACKED_ENT(table, j) = PACKED_ENT(table, i);
j++;
}
+ table->real_entries = j;
+ /* table->num_entries really should be equal j at this moment, but let set it anyway */
table->num_entries = j;
return;
}
@@ -761,7 +849,7 @@ st_cleanup_safe(st_table *table, st_data_t never)
if (ptr->key == never) {
tmp = ptr;
*last = ptr = ptr->next;
- free(tmp);
+ st_free_entry(tmp);
}
else {
ptr = *(last = &ptr->next);
@@ -771,50 +859,124 @@ st_cleanup_safe(st_table *table, st_data_t never)
}
int
-st_foreach(st_table *table, int (*func)(ANYARGS), st_data_t arg)
+st_update(st_table *table, st_data_t key, st_update_callback_func *func, st_data_t arg)
+{
+ st_index_t hash_val, bin_pos;
+ register st_table_entry *ptr, **last, *tmp;
+ st_data_t value = 0;
+ int retval, existing = 0;
+
+ hash_val = do_hash(key, table);
+
+ if (table->entries_packed) {
+ st_index_t i = find_packed_index(table, hash_val, key);
+ if (i < table->real_entries) {
+ key = PKEY(table, i);
+ value = PVAL(table, i);
+ existing = 1;
+ }
+ {
+ retval = (*func)(&key, &value, arg, existing);
+ if (!table->entries_packed) {
+ FIND_ENTRY(table, ptr, hash_val, bin_pos);
+ goto unpacked;
+ }
+ switch (retval) {
+ case ST_CONTINUE:
+ if (!existing) {
+ add_packed_direct(table, key, value, hash_val);
+ break;
+ }
+ PVAL_SET(table, i, value);
+ break;
+ case ST_DELETE:
+ if (!existing) break;
+ remove_packed_entry(table, i);
+ }
+ }
+ return existing;
+ }
+
+ FIND_ENTRY(table, ptr, hash_val, bin_pos);
+
+ if (ptr != 0) {
+ key = ptr->key;
+ value = ptr->record;
+ existing = 1;
+ }
+ {
+ 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);
+ break;
+ }
+ ptr->record = value;
+ break;
+ case ST_DELETE:
+ if (!existing) break;
+ 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);
+ break;
+ }
+ }
+ break;
+ }
+ return existing;
+ }
+}
+
+int
+st_foreach_check(st_table *table, int (*func)(ANYARGS), st_data_t arg, st_data_t never)
{
st_table_entry *ptr, **last, *tmp;
enum st_retval retval;
st_index_t i;
if (table->entries_packed) {
- for (i = 0; i < table->num_entries; i++) {
- st_index_t j;
- st_data_t key, val;
- key = (st_data_t)table->bins[i*2];
- val = (st_data_t)table->bins[i*2+1];
- retval = (*func)(key, val, arg);
+ for (i = 0; i < table->real_entries; i++) {
+ st_data_t key, val;
+ st_index_t hash;
+ key = PKEY(table, i);
+ val = PVAL(table, i);
+ hash = PHASH(table, i);
+ if (key == never) continue;
+ retval = (*func)(key, val, arg, 0);
if (!table->entries_packed) {
- FIND_ENTRY(table, ptr, key, i);
+ FIND_ENTRY(table, ptr, hash, i);
if (retval == ST_CHECK) {
if (!ptr) goto deleted;
goto unpacked_continue;
}
goto unpacked;
}
- switch (retval) {
+ switch (retval) {
case ST_CHECK: /* check if hash is modified during iteration */
- for (j = 0; j < table->num_entries; j++) {
- if ((st_data_t)table->bins[j*2] == key)
- break;
- }
- if (j == table->num_entries) {
+ if (PHASH(table, i) == 0 && PKEY(table, i) == never) {
+ break;
+ }
+ i = find_packed_index(table, hash, key);
+ if (i == table->real_entries) {
goto deleted;
- }
+ }
/* fall through */
case ST_CONTINUE:
break;
case ST_STOP:
return 0;
case ST_DELETE:
- table->num_entries--;
- memmove(&table->bins[i*2], &table->bins[(i+1)*2],
- sizeof(struct st_table_entry*) * 2*(table->num_entries-i));
- i--;
- break;
- }
- }
- return 0;
+ remove_safe_packed_entry(table, i, never);
+ break;
+ }
+ }
+ return 0;
}
else {
ptr = table->head;
@@ -822,8 +984,10 @@ st_foreach(st_table *table, int (*func)(ANYARGS), st_data_t arg)
if (ptr != 0) {
do {
+ if (ptr->key == never)
+ goto unpacked_continue;
i = ptr->hash % table->num_bins;
- retval = (*func)(ptr->key, ptr->record, arg);
+ retval = (*func)(ptr->key, ptr->record, arg, 0);
unpacked:
switch (retval) {
case ST_CHECK: /* check if hash is modified during iteration */
@@ -847,10 +1011,76 @@ st_foreach(st_table *table, int (*func)(ANYARGS), st_data_t arg)
for (; (tmp = *last) != 0; last = &tmp->next) {
if (ptr == tmp) {
tmp = ptr->fore;
+ remove_entry(table, ptr);
+ ptr->key = ptr->record = never;
+ ptr->hash = 0;
+ ptr = tmp;
+ break;
+ }
+ }
+ }
+ } while (ptr && table->head);
+ }
+ return 0;
+}
+
+int
+st_foreach(st_table *table, int (*func)(ANYARGS), st_data_t arg)
+{
+ st_table_entry *ptr, **last, *tmp;
+ enum st_retval retval;
+ st_index_t i;
+
+ if (table->entries_packed) {
+ for (i = 0; i < table->real_entries; i++) {
+ st_data_t key, val, hash;
+ key = PKEY(table, i);
+ val = PVAL(table, i);
+ hash = PHASH(table, i);
+ retval = (*func)(key, val, arg, 0);
+ if (!table->entries_packed) {
+ FIND_ENTRY(table, ptr, hash, i);
+ if (!ptr) return 0;
+ goto unpacked;
+ }
+ switch (retval) {
+ case ST_CONTINUE:
+ break;
+ case ST_CHECK:
+ case ST_STOP:
+ return 0;
+ case ST_DELETE:
+ remove_packed_entry(table, i);
+ i--;
+ break;
+ }
+ }
+ return 0;
+ }
+ else {
+ ptr = table->head;
+ }
+
+ if (ptr != 0) {
+ do {
+ i = ptr->hash % table->num_bins;
+ retval = (*func)(ptr->key, ptr->record, arg, 0);
+ unpacked:
+ switch (retval) {
+ case ST_CONTINUE:
+ ptr = ptr->fore;
+ break;
+ case ST_CHECK:
+ case ST_STOP:
+ return 0;
+ case ST_DELETE:
+ last = &table->bins[ptr->hash % table->num_bins];
+ for (; (tmp = *last) != 0; last = &tmp->next) {
+ if (ptr == tmp) {
+ tmp = ptr->fore;
*last = ptr->next;
- REMOVE_ENTRY(table, ptr);
- free(ptr);
- if (ptr == tmp) return 0;
+ remove_entry(table, ptr);
+ st_free_entry(ptr);
ptr = tmp;
break;
}
@@ -873,13 +1103,13 @@ st_reverse_foreach(st_table *table, int (*func)(ANYARGS), st_data_t arg)
for (i = table->num_entries-1; 0 <= i; i--) {
int j;
st_data_t key, val;
- key = (st_data_t)table->bins[i*2];
- val = (st_data_t)table->bins[i*2+1];
- retval = (*func)(key, val, arg);
+ key = PKEY(table, i);
+ val = PVAL(table, i);
+ retval = (*func)(key, val, arg, 0);
switch (retval) {
case ST_CHECK: /* check if hash is modified during iteration */
for (j = 0; j < table->num_entries; j++) {
- if ((st_data_t)table->bins[j*2] == key)
+ if (PKEY(table, j) == key)
break;
}
if (j == table->num_entries) {
@@ -893,9 +1123,7 @@ st_reverse_foreach(st_table *table, int (*func)(ANYARGS), st_data_t arg)
case ST_STOP:
return 0;
case ST_DELETE:
- table->num_entries--;
- memmove(&table->bins[i*2], &table->bins[(i+1)*2],
- sizeof(struct st_table_entry*) * 2*(table->num_entries-i));
+ remove_packed_entry(table, i);
break;
}
}
@@ -928,8 +1156,8 @@ st_reverse_foreach(st_table *table, int (*func)(ANYARGS), st_data_t arg)
if (ptr == tmp) {
tmp = ptr->back;
*last = ptr->next;
- REMOVE_ENTRY(table, ptr);
- free(ptr);
+ remove_entry(table, ptr);
+ st_free_entry(ptr);
ptr = tmp;
break;
}
@@ -1042,7 +1270,7 @@ 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(__mc68020__)
# define UNALIGNED_WORD_ACCESS 1
# endif
@@ -1297,7 +1525,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;
@@ -1321,7 +1549,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;
diff --git a/strftime.c b/strftime.c
index 4222daa263..83550e9a7f 100644
--- a/strftime.c
+++ b/strftime.c
@@ -48,6 +48,7 @@
*/
#include "ruby/ruby.h"
+#include "ruby/encoding.h"
#include "timev.h"
#ifndef GAWK
@@ -126,14 +127,8 @@ extern char *strchr();
/* min --- return minimum of two numbers */
-#ifndef __STDC__
-static inline int
-min(a, b)
-int a, b;
-#else
static inline int
min(int a, int b)
-#endif
{
return (a < b ? a : b);
}
@@ -142,14 +137,8 @@ min(int a, int b)
/* max --- return maximum of two numbers */
-#ifndef __STDC__
-static inline int
-max(a, b)
-int a, b;
-#else
static inline int
max(int a, int b)
-#endif
{
return (a > b ? a : b);
}
@@ -167,20 +156,26 @@ max(int a, int b)
/* strftime --- produce formatted time */
+/*
+ * enc is the encoding of the format. It is used as the encoding of resulted
+ * string, but the name of the month and weekday are always US-ASCII. So it
+ * is only used for the timezone name on Windows.
+ */
static size_t
-rb_strftime_with_timespec(char *s, size_t maxsize, const char *format, const struct vtm *vtm, VALUE timev, struct timespec *ts, int gmt)
+rb_strftime_with_timespec(char *s, size_t maxsize, const char *format, rb_encoding *enc, const struct vtm *vtm, VALUE timev, struct timespec *ts, int gmt)
{
const char *const endp = s + maxsize;
const char *const start = s;
const char *sp, *tp;
- auto char tbuf[100];
+#define TBUFSIZE 100
+ auto char tbuf[TBUFSIZE];
long off;
ptrdiff_t i;
int w;
long y;
int precision, flags, colons;
char padding;
- enum {LEFT, CHCASE, LOWER, UPPER, LOCALE_O, LOCALE_E};
+ enum {LEFT, CHCASE, LOWER, UPPER};
#define BIT_OF(n) (1U<<(n))
#ifdef MAILHEADER_EXT
int sign;
@@ -208,9 +203,14 @@ rb_strftime_with_timespec(char *s, size_t maxsize, const char *format, const str
return 0;
}
+ if (enc && (enc == rb_usascii_encoding() ||
+ enc == rb_ascii8bit_encoding() || enc == rb_locale_encoding())) {
+ enc = NULL;
+ }
+
for (; *format && s < endp - 1; format++) {
#define FLAG_FOUND() do { \
- if (precision > 0 || flags & (BIT_OF(LOCALE_E)|BIT_OF(LOCALE_O))) \
+ if (precision > 0) \
goto unknown; \
} while (0)
#define NEEDS(n) do if (s >= endp || (n) >= endp - s - 1) goto err; while (0)
@@ -237,7 +237,7 @@ rb_strftime_with_timespec(char *s, size_t maxsize, const char *format, const str
} while (0)
#define STRFTIME(fmt) \
do { \
- i = rb_strftime_with_timespec(s, endp - s, (fmt), vtm, timev, ts, gmt); \
+ i = rb_strftime_with_timespec(s, endp - s, (fmt), enc, vtm, timev, ts, gmt); \
if (!i) return 0; \
if (precision > i) {\
NEEDS(precision); \
@@ -363,7 +363,8 @@ rb_strftime_with_timespec(char *s, size_t maxsize, const char *format, const str
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 */
@@ -438,36 +439,16 @@ rb_strftime_with_timespec(char *s, size_t maxsize, const char *format, const str
case 'Y': /* year with century */
if (FIXNUM_P(vtm->year)) {
- long y = FIX2LONG(vtm->year);
- FMT('0', 0 <= y ? 4 : 5, "ld", y);
+ long y = FIX2LONG(vtm->year);
+ FMT('0', 0 <= y ? 4 : 5, "ld", y);
}
else {
- FMTV('0', 4, "d", vtm->year);
+ FMTV('0', 4, "d", vtm->year);
}
continue;
#ifdef MAILHEADER_EXT
case 'z': /* time zone offset east of GMT e.g. -0600 */
- switch (colons) {
- case 0: /* %z -> +hhmm */
- precision = precision <= 5 ? 2 : precision-3;
- NEEDS(precision + 3);
- break;
-
- case 1: /* %:z -> +hh:mm */
- precision = precision <= 6 ? 2 : precision-4;
- NEEDS(precision + 4);
- break;
-
- case 2: /* %::z -> +hh:mm:ss */
- precision = precision <= 9 ? 2 : precision-7;
- NEEDS(precision + 7);
- break;
-
- default:
- format--;
- goto unknown;
- }
if (gmt) {
off = 0;
}
@@ -480,6 +461,41 @@ rb_strftime_with_timespec(char *s, size_t maxsize, const char *format, const str
} else {
sign = +1;
}
+ switch (colons) {
+ case 0: /* %z -> +hhmm */
+ precision = precision <= 5 ? 2 : precision-3;
+ NEEDS(precision + 3);
+ break;
+
+ case 1: /* %:z -> +hh:mm */
+ precision = precision <= 6 ? 2 : precision-4;
+ NEEDS(precision + 4);
+ break;
+
+ case 2: /* %::z -> +hh:mm:ss */
+ precision = precision <= 9 ? 2 : precision-7;
+ NEEDS(precision + 7);
+ break;
+
+ case 3: /* %:::z -> +hh[:mm[:ss]] */
+ if (off % 3600 == 0) {
+ precision = precision <= 3 ? 2 : precision-1;
+ NEEDS(precision + 3);
+ }
+ else if (off % 60 == 0) {
+ precision = precision <= 6 ? 2 : precision-4;
+ NEEDS(precision + 4);
+ }
+ else {
+ precision = precision <= 9 ? 2 : precision-7;
+ NEEDS(precision + 9);
+ }
+ break;
+
+ default:
+ format--;
+ goto unknown;
+ }
i = snprintf(s, endp - s, (padding == ' ' ? "%+*ld" : "%+.*ld"),
precision + 1, sign * (off / 3600));
if (i < 0) goto err;
@@ -488,12 +504,16 @@ rb_strftime_with_timespec(char *s, size_t maxsize, const char *format, const str
}
s += i;
off = off % 3600;
+ if (colons == 3 && off == 0)
+ continue;
if (1 <= colons)
*s++ = ':';
i = snprintf(s, endp - s, "%02d", (int)(off / 60));
if (i < 0) goto err;
s += i;
off = off % 60;
+ if (colons == 3 && off == 0)
+ continue;
if (2 <= colons) {
*s++ = ':';
i = snprintf(s, endp - s, "%02d", (int)off);
@@ -513,11 +533,24 @@ rb_strftime_with_timespec(char *s, size_t maxsize, const char *format, const str
tp = "UTC";
break;
}
- if (vtm->zone == NULL)
- tp = "";
- else
+ if (vtm->zone == NULL) {
+ i = 0;
+ }
+ else {
tp = vtm->zone;
- i = strlen(tp);
+ if (enc) {
+ for (i = 0; i < TBUFSIZE && tp[i]; i++) {
+ if ((unsigned char)tp[i] > 0x7F) {
+ VALUE str = rb_str_conv_enc_opts(rb_str_new_cstr(tp), rb_locale_encoding(), enc, ECONV_UNDEF_REPLACE|ECONV_INVALID_REPLACE, Qnil);
+ i = strlcpy(tbuf, RSTRING_PTR(str), TBUFSIZE);
+ tp = tbuf;
+ break;
+ }
+ }
+ }
+ else
+ i = strlen(tp);
+ }
break;
#ifdef SYSV_EXT
@@ -583,11 +616,13 @@ rb_strftime_with_timespec(char *s, size_t maxsize, const char *format, const str
case 'E':
/* POSIX locale extensions, ignored for now */
- flags |= BIT_OF(LOCALE_E);
+ if (!format[1] || !strchr("cCxXyY", format[1]))
+ goto unknown;
goto again;
case 'O':
/* POSIX locale extensions, ignored for now */
- flags |= BIT_OF(LOCALE_O);
+ if (!format[1] || !strchr("deHkIlmMSuUVwWy", format[1]))
+ goto unknown;
goto again;
case 'V': /* week of year according ISO 8601 */
@@ -733,8 +768,12 @@ rb_strftime_with_timespec(char *s, size_t maxsize, const char *format, const str
goto again;
case ':':
- FLAG_FOUND();
- colons++;
+ {
+ size_t l = strspn(format, ":");
+ if (l > 3 || format[l] != 'z') goto unknown;
+ colons = (int)l;
+ format += l - 1;
+ }
goto again;
case '0':
@@ -789,27 +828,21 @@ rb_strftime_with_timespec(char *s, size_t maxsize, const char *format, const str
}
size_t
-rb_strftime(char *s, size_t maxsize, const char *format, const struct vtm *vtm, VALUE timev, int gmt)
+rb_strftime(char *s, size_t maxsize, const char *format, rb_encoding *enc, const struct vtm *vtm, VALUE timev, int gmt)
{
- return rb_strftime_with_timespec(s, maxsize, format, vtm, timev, NULL, gmt);
+ return rb_strftime_with_timespec(s, maxsize, format, enc, vtm, timev, NULL, gmt);
}
size_t
-rb_strftime_timespec(char *s, size_t maxsize, const char *format, const struct vtm *vtm, struct timespec *ts, int gmt)
+rb_strftime_timespec(char *s, size_t maxsize, const char *format, rb_encoding *enc, const struct vtm *vtm, struct timespec *ts, int gmt)
{
- return rb_strftime_with_timespec(s, maxsize, format, vtm, Qnil, ts, gmt);
+ return rb_strftime_with_timespec(s, maxsize, format, enc, vtm, Qnil, ts, gmt);
}
/* isleap --- is a year a leap year? */
-#ifndef __STDC__
-static int
-isleap(year)
-long year;
-#else
static int
isleap(long year)
-#endif
{
return ((year % 4 == 0 && year % 100 != 0) || year % 400 == 0);
}
@@ -843,14 +876,8 @@ vtm2tm_noyear(const struct vtm *vtm, struct tm *result)
#ifdef POSIX2_DATE
/* iso8601wknum --- compute week number according to ISO 8601 */
-#ifndef __STDC__
-static int
-iso8601wknum(timeptr)
-const struct tm *timeptr;
-#else
static int
iso8601wknum(const struct tm *timeptr)
-#endif
{
/*
* From 1003.2:
@@ -970,15 +997,8 @@ iso8601wknum_v(const struct vtm *vtm)
/* With thanks and tip of the hatlo to ado@elsie.nci.nih.gov */
-#ifndef __STDC__
-static int
-weeknumber(timeptr, firstweekday)
-const struct tm *timeptr;
-int firstweekday;
-#else
static int
weeknumber(const struct tm *timeptr, int firstweekday)
-#endif
{
int wday = timeptr->tm_wday;
int ret;
@@ -1114,9 +1134,7 @@ static char *array[] =
/* main routine. */
int
-main(argc, argv)
-int argc;
-char **argv;
+main(int argc, char **argv)
{
long time();
diff --git a/string.c b/string.c
index 7f4c44eba6..4114f2d8b5 100644
--- a/string.c
+++ b/string.c
@@ -14,7 +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 <assert.h>
#define BEG(no) (regs->beg[(no)])
@@ -27,22 +29,16 @@
#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_cat2
#undef rb_str_cat2
@@ -53,24 +49,15 @@ 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;\
@@ -97,29 +84,82 @@ 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);\
+ REALLOC_N(RSTRING(str)->as.heap.ptr, char, (capacity)+termlen);\
if (!STR_NOCAPA_P(str))\
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 { \
+ OBJ_WRITE((str), &RSTRING(str)->as.heap.aux.shared, (shared_str)); \
+ FL_SET((str), ELTS_SHARED); \
+} while (0)
+
+#define STR_HEAP_PTR(str) (RSTRING(str)->as.heap.ptr)
+#define STR_HEAP_SIZE(str) (RSTRING(str)->as.heap.aux.capa + TERM_LEN(str))
#define STR_ENC_GET(str) rb_enc_from_index(ENCODING_GET(str))
+static int fstring_cmp(VALUE a, VALUE b);
+
+static st_table* frozen_strings;
+
+static const struct st_hash_type fstring_hash_type = {
+ fstring_cmp,
+ rb_str_hash,
+};
+
+VALUE
+rb_fstring(VALUE str)
+{
+ st_data_t fstr;
+ if (st_lookup(frozen_strings, (st_data_t)str, &fstr)) {
+ str = (VALUE)fstr;
+ /* because of lazy sweep, str may be unmaked already and swept
+ * at next time */
+ rb_gc_resurrect(str);
+ }
+ else {
+ str = rb_str_new_frozen(str);
+ RBASIC(str)->flags |= RSTRING_FSTR;
+ st_insert(frozen_strings, str, str);
+ }
+ return str;
+}
+
+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)
{
@@ -291,6 +331,13 @@ rb_enc_cr_str_copy_for_substr(VALUE dest, VALUE src)
* from src to new string "dest" which is made from the part of src.
*/
str_enc_copy(dest, src);
+ if (RSTRING_LEN(dest) == 0) {
+ if (!rb_enc_asciicompat(STR_ENC_GET(src)))
+ ENC_CODERANGE_SET(dest, ENC_CODERANGE_VALID);
+ else
+ ENC_CODERANGE_SET(dest, ENC_CODERANGE_7BIT);
+ return;
+ }
switch (ENC_CODERANGE(src)) {
case ENC_CODERANGE_7BIT:
ENC_CODERANGE_SET(dest, ENC_CODERANGE_7BIT);
@@ -303,12 +350,6 @@ rb_enc_cr_str_copy_for_substr(VALUE dest, VALUE src)
ENC_CODERANGE_SET(dest, ENC_CODERANGE_7BIT);
break;
default:
- if (RSTRING_LEN(dest) == 0) {
- if (!rb_enc_asciicompat(STR_ENC_GET(src)))
- ENC_CODERANGE_SET(dest, ENC_CODERANGE_VALID);
- else
- ENC_CODERANGE_SET(dest, ENC_CODERANGE_7BIT);
- }
break;
}
}
@@ -370,18 +411,21 @@ rb_str_capacity(VALUE str)
static inline VALUE
str_alloc(VALUE klass)
{
- NEWOBJ(str, struct RString);
- OBJSETUP(str, 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;
}
+static inline VALUE
+empty_str_alloc(VALUE klass)
+{
+ if (RUBY_DTRACE_STRING_CREATE_ENABLED()) {
+ RUBY_DTRACE_STRING_CREATE(0, rb_sourcefile(), rb_sourceline());
+ }
+ return str_alloc(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;
@@ -389,10 +433,14 @@ str_new(VALUE klass, const char *ptr, long len)
rb_raise(rb_eArgError, "negative string size (or size too big)");
}
+ if (RUBY_DTRACE_STRING_CREATE_ENABLED()) {
+ RUBY_DTRACE_STRING_CREATE(len, rb_sourcefile(), rb_sourceline());
+ }
+
str = str_alloc(klass);
if (len > RSTRING_EMBED_LEN_MAX) {
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) {
@@ -402,10 +450,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)
{
@@ -423,7 +477,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;
}
@@ -437,9 +495,6 @@ rb_str_new_cstr(const char *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)
{
@@ -448,8 +503,17 @@ rb_usascii_str_new_cstr(const char *ptr)
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)
+{
+ if (!ptr) {
+ rb_raise(rb_eArgError, "NULL pointer given");
+ }
+ if (rb_enc_mbminlen(enc) != 1) {
+ rb_raise(rb_eArgError, "wchar encoding given");
+ }
+ return rb_enc_str_new(ptr, strlen(ptr), enc);
+}
VALUE
rb_tainted_str_new(const char *ptr, long len)
@@ -469,22 +533,23 @@ rb_tainted_str_new_cstr(const char *ptr)
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)
{
+ extern VALUE rb_cEncodingConverter;
rb_econv_t *ec;
rb_econv_result_t ret;
- long len;
+ long len, olen;
+ VALUE econv_wrapper;
VALUE newstr;
- const unsigned char *sp;
- unsigned char *dp;
+ const unsigned char *start, *sp;
+ unsigned char *dest, *dp;
+ size_t converted_output = 0;
if (!to) return str;
+ if (!from) from = rb_enc_get(str);
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);
@@ -495,23 +560,40 @@ 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;
- retry:
+ econv_wrapper = rb_obj_alloc(rb_cEncodingConverter);
+ RBASIC_CLEAR_CLASS(econv_wrapper);
ec = rb_econv_open_opts(from->name, to->name, ecflags, ecopts);
if (!ec) return str;
+ DATA_PTR(econv_wrapper) = ec;
sp = (unsigned char*)RSTRING_PTR(str);
- dp = (unsigned char*)RSTRING_PTR(newstr);
- ret = rb_econv_convert(ec, &sp, (unsigned char*)RSTRING_END(str),
- &dp, (unsigned char*)RSTRING_END(newstr), 0);
+ start = sp;
+ while ((dest = (unsigned char*)RSTRING_PTR(newstr)),
+ (dp = dest + converted_output),
+ (ret = rb_econv_convert(ec, &sp, start + len, &dp, dest + olen, 0)),
+ ret == econv_destination_buffer_full) {
+ /* destination buffer short */
+ size_t converted_input = sp - start;
+ size_t rest = len - converted_input;
+ converted_output = dp - dest;
+ rb_str_set_len(newstr, converted_output);
+ if (converted_input && converted_output &&
+ rest < (LONG_MAX / converted_output)) {
+ rest = (rest * converted_output) / converted_input;
+ }
+ else {
+ rest = olen;
+ }
+ olen += rest < 2 ? 2 : rest;
+ rb_str_resize(newstr, olen);
+ }
+ DATA_PTR(econv_wrapper) = 0;
rb_econv_close(ec);
+ rb_gc_force_recycle(econv_wrapper);
switch (ret) {
- case econv_destination_buffer_full:
- /* destination buffer short */
- len = len < 2 ? 2 : len * 2;
- rb_str_resize(newstr, len);
- goto retry;
-
case econv_finished:
len = dp - (unsigned char*)RSTRING_PTR(newstr);
rb_str_set_len(newstr, len);
@@ -536,6 +618,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());
@@ -600,7 +688,7 @@ rb_str_export_to_enc(VALUE str, rb_encoding *enc)
}
static VALUE
-str_replace_shared(VALUE str2, VALUE str)
+str_replace_shared_without_enc(VALUE str2, VALUE str)
{
if (RSTRING_LEN(str) <= RSTRING_EMBED_LEN_MAX) {
STR_SET_EMBED(str2);
@@ -612,11 +700,16 @@ str_replace_shared(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);
}
- rb_enc_cr_str_exact_copy(str2, str);
+ return str2;
+}
+static VALUE
+str_replace_shared(VALUE str2, VALUE str)
+{
+ str_replace_shared_without_enc(str2, str);
+ rb_enc_cr_str_exact_copy(str2, str);
return str2;
}
@@ -641,9 +734,6 @@ rb_str_new_shared(VALUE 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)
{
@@ -656,12 +746,10 @@ str_new4(VALUE klass, VALUE 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;
+ STR_SET_SHARED(str2, shared); /* TODO: WB is not needed because str2 is *new* object */
}
else {
- FL_SET(str, ELTS_SHARED);
- RSTRING(str)->as.heap.aux.shared = str2;
+ STR_SET_SHARED(str, str2);
}
rb_enc_cr_str_exact_copy(str2, str);
OBJ_INFECT(str2, str);
@@ -680,7 +768,7 @@ rb_str_new_frozen(VALUE orig)
assert(OBJ_FROZEN(str));
ofs = RSTRING_LEN(str) - RSTRING_LEN(orig);
if ((ofs > 0) || (klass != RBASIC(str)->klass) ||
- (!OBJ_TAINTED(str) && OBJ_TAINTED(orig)) ||
+ ((RBASIC(str)->flags ^ RBASIC(orig)->flags) & FL_TAINT) ||
ENCODING_GET(str) != ENCODING_GET(orig)) {
str = str_new3(klass, str);
RSTRING(str)->as.heap.ptr += ofs;
@@ -699,7 +787,8 @@ rb_str_new_frozen(VALUE orig)
FL_UNSET(orig, STR_ASSOC);
str = str_new4(klass, orig);
FL_SET(str, STR_ASSOC);
- RSTRING(str)->as.heap.aux.shared = assoc;
+ OBJ_WRITE(str, &RSTRING(str)->as.heap.aux.shared, assoc);
+ /* TODO: WB is not needed because str is new object */
}
else {
str = str_new4(klass, orig);
@@ -708,19 +797,12 @@ rb_str_new_frozen(VALUE orig)
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)
{
@@ -760,9 +842,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)
{
@@ -788,8 +867,12 @@ rb_free_tmp_buffer(volatile VALUE *store)
void
rb_str_free(VALUE str)
{
+ if (FL_TEST(str, RSTRING_FSTR)) {
+ st_data_t fstr = (st_data_t)str;
+ st_delete(frozen_strings, &fstr, NULL);
+ }
if (!STR_EMBED_P(str) && !STR_SHARED_P(str)) {
- xfree(RSTRING(str)->as.heap.ptr);
+ ruby_sized_xfree(STR_HEAP_PTR(str), STR_HEAP_SIZE(str));
}
}
@@ -797,7 +880,7 @@ 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;
+ return STR_HEAP_SIZE(str);
}
else {
return 0;
@@ -835,8 +918,9 @@ rb_str_shared_replace(VALUE str, VALUE str2)
RSTRING(str)->as.heap.ptr = RSTRING_PTR(str2);
RSTRING(str)->as.heap.len = RSTRING_LEN(str2);
if (STR_NOCAPA_P(str2)) {
+ VALUE shared = RSTRING(str2)->as.heap.aux.shared;
FL_SET(str, RBASIC(str2)->flags & STR_NOCAPA);
- RSTRING(str)->as.heap.aux.shared = RSTRING(str2)->as.heap.aux.shared;
+ OBJ_WRITE(str, &RSTRING(str)->as.heap.aux.shared, shared);
}
else {
RSTRING(str)->as.heap.aux.capa = RSTRING(str2)->as.heap.aux.capa;
@@ -855,11 +939,11 @@ rb_obj_as_string(VALUE obj)
{
VALUE str;
- if (TYPE(obj) == T_STRING) {
+ if (RB_TYPE_P(obj, T_STRING)) {
return obj;
}
str = rb_funcall(obj, id_to_s, 0);
- if (TYPE(str) != T_STRING)
+ if (!RB_TYPE_P(str, T_STRING))
return rb_any_to_s(obj);
if (OBJ_TAINTED(obj)) OBJ_TAINT(str);
return str;
@@ -882,7 +966,7 @@ str_replace(VALUE str, VALUE str2)
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);
@@ -910,7 +994,11 @@ rb_str_dup(VALUE str)
VALUE
rb_str_resurrect(VALUE str)
{
- return str_replace(str_alloc(rb_cString), str);
+ if (RUBY_DTRACE_STRING_CREATE_ENABLED()) {
+ RUBY_DTRACE_STRING_CREATE(RSTRING_LEN(str),
+ rb_sourcefile(), rb_sourceline());
+ }
+ return str_duplicate(rb_cString, str);
}
/*
@@ -1043,7 +1131,7 @@ rb_enc_strlen_cr(const char *p, const char *e, rb_encoding *enc, int *cr)
/*
* UTF-8 leading bytes have either 0xxxxxxx or 11xxxxxx
- * bit represention. (see http://en.wikipedia.org/wiki/UTF-8)
+ * bit representation. (see http://en.wikipedia.org/wiki/UTF-8)
* Therefore, following pseudo code can detect UTF-8 leading byte.
*
* if (!(byte & 0x80))
@@ -1146,7 +1234,10 @@ rb_str_length(VALUE str)
* call-seq:
* str.bytesize -> integer
*
- * Returns the length of <i>str</i> in bytes.
+ * Returns the length of +str+ in bytes.
+ *
+ * "\x80\u3042".bytesize #=> 4
+ * "hello".bytesize #=> 5
*/
static VALUE
@@ -1162,6 +1253,7 @@ rb_str_bytesize(VALUE str)
* Returns <code>true</code> if <i>str</i> has a length of zero.
*
* "hello".empty? #=> false
+ * " ".empty? #=> false
* "".empty? #=> true
*/
@@ -1208,10 +1300,11 @@ rb_str_plus(VALUE str1, VALUE str2)
* call-seq:
* str * integer -> new_str
*
- * Copy---Returns a new <code>String</code> containing <i>integer</i> copies of
- * the receiver.
+ * Copy --- Returns a new String containing +integer+ copies of the receiver.
+ * +integer+ must be greater than or equal to 0.
*
* "Ho! " * 3 #=> "Ho! Ho! Ho! "
+ * "Ho! " * 0 #=> ""
*/
VALUE
@@ -1268,7 +1361,7 @@ rb_str_format_m(VALUE str, VALUE arg)
volatile VALUE tmp = rb_check_array_type(arg);
if (!NIL_P(tmp)) {
- return rb_str_format(RARRAY_LENINT(tmp), RARRAY_PTR(tmp), str);
+ return rb_str_format(RARRAY_LENINT(tmp), RARRAY_CONST_PTR(tmp), str);
}
return rb_str_format(1, &arg, str);
}
@@ -1280,8 +1373,6 @@ 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
@@ -1298,16 +1389,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;
+ TERM_FILL(ptr + len, termlen);
RSTRING(str)->as.heap.ptr = ptr;
RSTRING(str)->as.heap.len = len;
RSTRING(str)->as.heap.aux.capa = capa;
@@ -1335,11 +1427,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);
}
}
@@ -1362,7 +1455,7 @@ 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;
}
@@ -1394,8 +1487,8 @@ rb_str_associate(VALUE str, VALUE add)
RESIZE_CAPA(str, RSTRING_LEN(str));
}
FL_SET(str, STR_ASSOC);
- RBASIC(add)->klass = 0;
- RSTRING(str)->as.heap.aux.shared = add;
+ RBASIC_CLEAR_CLASS(add);
+ OBJ_WRITE(str, &RSTRING(str)->as.heap.aux.shared, add);
}
}
@@ -1409,11 +1502,20 @@ rb_str_associated(VALUE str)
return Qfalse;
}
+void
+rb_must_asciicompat(VALUE str)
+{
+ rb_encoding *enc = rb_enc_get(str);
+ if (!rb_enc_asciicompat(enc)) {
+ rb_raise(rb_eEncCompatError, "ASCII incompatible encoding: %s", rb_enc_name(enc));
+ }
+}
+
VALUE
rb_string_value(volatile VALUE *ptr)
{
VALUE s = *ptr;
- if (TYPE(s) != T_STRING) {
+ if (!RB_TYPE_P(s, T_STRING)) {
s = rb_str_to_str(s);
*ptr = s;
}
@@ -1427,13 +1529,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");
}
@@ -1445,6 +1592,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)
{
@@ -1492,6 +1648,7 @@ str_nth_len(const char *p, const char *e, long *nthp, rb_encoding *enc)
if (ISASCII(*p)) {
p2 = search_nonascii(p, e2);
if (!p2) {
+ nth -= e2 - p;
*nthp = nth;
return (char *)e2;
}
@@ -1616,6 +1773,7 @@ rb_str_subseq(VALUE str, long beg, long len)
}
else {
str2 = rb_str_new5(str, RSTRING_PTR(str)+beg, len);
+ RB_GC_GUARD(str);
}
rb_enc_cr_str_copy_for_substr(str2, str);
@@ -1624,32 +1782,30 @@ rb_str_subseq(VALUE str, long beg, long len)
return str2;
}
-VALUE
-rb_str_substr(VALUE str, long beg, long len)
+char *
+rb_str_subpos(VALUE str, long beg, long *lenp)
{
+ long len = *lenp;
+ long slen = -1L;
+ long blen = RSTRING_LEN(str);
rb_encoding *enc = STR_ENC_GET(str);
- VALUE str2;
- char *p, *s = RSTRING_PTR(str), *e = s + RSTRING_LEN(str);
+ char *p, *s = RSTRING_PTR(str), *e = s + blen;
- if (len < 0) return Qnil;
- if (!RSTRING_LEN(str)) {
+ if (len < 0) return 0;
+ if (!blen) {
len = 0;
}
if (single_byte_optimizable(str)) {
- if (beg > RSTRING_LEN(str)) return Qnil;
+ if (beg > blen) return 0;
if (beg < 0) {
- beg += RSTRING_LEN(str);
- if (beg < 0) return Qnil;
- }
- if (beg + len > RSTRING_LEN(str))
- len = RSTRING_LEN(str) - beg;
- if (len <= 0) {
- len = 0;
- p = 0;
+ beg += blen;
+ if (beg < 0) return 0;
}
- else
- p = s + beg;
- goto sub;
+ if (beg + len > blen)
+ len = blen - beg;
+ if (len < 0) return 0;
+ p = s + beg;
+ goto end;
}
if (beg < 0) {
if (len > -beg) len = -beg;
@@ -1657,29 +1813,32 @@ rb_str_substr(VALUE str, long beg, long len)
beg = -beg;
while (beg-- > len && (e = rb_enc_prev_char(s, e, e, enc)) != 0);
p = e;
- if (!p) return Qnil;
+ if (!p) return 0;
while (len-- > 0 && (p = rb_enc_prev_char(s, p, e, enc)) != 0);
- if (!p) return Qnil;
+ if (!p) return 0;
len = e - p;
- goto sub;
+ goto end;
}
else {
- beg += str_strlen(str, enc);
- if (beg < 0) return Qnil;
+ slen = str_strlen(str, enc);
+ beg += slen;
+ if (beg < 0) return 0;
+ p = s + beg;
+ if (len == 0) goto end;
}
}
else if (beg > 0 && beg > RSTRING_LEN(str)) {
- return Qnil;
+ return 0;
}
if (len == 0) {
- if (beg > str_strlen(str, enc)) return Qnil;
- p = 0;
+ if (beg > str_strlen(str, enc)) return 0;
+ p = s + beg;
}
#ifdef NONASCII_MASK
else if (ENC_CODERANGE(str) == ENC_CODERANGE_VALID &&
enc == rb_utf8_encoding()) {
p = str_utf8_nth(s, e, &beg);
- if (beg > 0) return Qnil;
+ if (beg > 0) return 0;
len = str_utf8_offset(p, e, len);
}
#endif
@@ -1688,7 +1847,7 @@ rb_str_substr(VALUE str, long beg, long len)
p = s + beg * char_sz;
if (p > e) {
- return Qnil;
+ return 0;
}
else if (len * char_sz > e - p)
len = e - p;
@@ -1696,14 +1855,26 @@ rb_str_substr(VALUE str, long beg, long len)
len *= char_sz;
}
else if ((p = str_nth_len(s, e, &beg, enc)) == e) {
- if (beg > 0) return Qnil;
+ if (beg > 0) return 0;
len = 0;
}
else {
len = str_offset(p, e, len, enc, 0);
}
- sub:
- if (len > RSTRING_EMBED_LEN_MAX && beg + len == RSTRING_LEN(str)) {
+ end:
+ *lenp = len;
+ RB_GC_GUARD(str);
+ return p;
+}
+
+VALUE
+rb_str_substr(VALUE str, long beg, long len)
+{
+ VALUE str2;
+ 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;
@@ -1713,6 +1884,7 @@ rb_str_substr(VALUE str, long beg, long len)
str2 = rb_str_new5(str, p, len);
rb_enc_cr_str_copy_for_substr(str2, str);
OBJ_INFECT(str2, str);
+ RB_GC_GUARD(str);
}
return str2;
@@ -1751,20 +1923,28 @@ rb_str_unlocktmp(VALUE str)
return str;
}
+VALUE
+rb_str_locktmp_ensure(VALUE str, VALUE (*func)(VALUE), VALUE arg)
+{
+ rb_str_locktmp(str);
+ return rb_ensure(func, arg, rb_str_unlocktmp, str);
+}
+
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
@@ -1781,36 +1961,38 @@ rb_str_resize(VALUE str, long len)
ENC_CODERANGE_CLEAR(str);
slen = RSTRING_LEN(str);
if (len != slen) {
+ const int termlen = TERM_LEN(str);
if (STR_EMBED_P(str)) {
- if (len <= RSTRING_EMBED_LEN_MAX) {
+ 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);
+ size_t size = STR_HEAP_SIZE(str);
STR_SET_EMBED(str);
if (slen > len) slen = len;
if (slen > 0) MEMCPY(RSTRING(str)->as.ary, ptr, char, slen);
- 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_sized_xfree(ptr, size);
return str;
}
else if (!independent) {
str_make_independent_expand(str, len - slen);
}
else if (slen < len || slen - len > 1024) {
- REALLOC_N(RSTRING(str)->as.heap.ptr, char, len+1);
+ REALLOC_N(RSTRING(str)->as.heap.ptr, char, len + termlen);
}
if (!STR_NOCAPA_P(str)) {
RSTRING(str)->as.heap.aux.capa = len;
}
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;
}
@@ -1819,6 +2001,7 @@ static VALUE
str_buf_cat(VALUE str, const char *ptr, long len)
{
long capa, total, off = -1;
+ const int termlen = TERM_LEN(str);
if (ptr >= RSTRING_PTR(str) && ptr <= RSTRING_END(str)) {
off = ptr - RSTRING_PTR(str);
@@ -1841,11 +2024,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) {
+ if (capa + termlen >= LONG_MAX / 2) {
capa = (total + 4095) / 4096;
break;
}
- capa = (capa + 1) * 2;
+ capa = (capa + termlen) * 2;
}
RESIZE_CAPA(str, capa);
}
@@ -1889,7 +2072,7 @@ rb_str_cat(VALUE str, const char *ptr, long 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 */
+ TERM_FILL(p, TERM_LEN(str)); /* sentinel */
return str;
}
@@ -1910,7 +2093,7 @@ rb_enc_cr_str_buf_cat(VALUE str, const char *ptr, long len,
int res_encindex;
int str_cr, res_cr;
- 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)
@@ -2044,13 +2227,14 @@ rb_str_append(VALUE str, VALUE str2)
StringValue(str2);
if ((len2 = RSTRING_LEN(str2)) > 0 && STR_ASSOC_P(str)) {
- long len = RSTRING_LEN(str) + len2;
+ long len1 = RSTRING(str)->as.heap.len, len = len1 + len2;
enc = rb_enc_check(str, str2);
cr = ENC_CODERANGE(str);
- if ((cr2 = ENC_CODERANGE(str2)) > cr) cr = cr2;
+ if ((cr2 = ENC_CODERANGE(str2)) > cr || RSTRING_LEN(str) == 0)
+ cr = cr2;
rb_str_modify_expand(str, len2);
- memcpy(RSTRING(str)->as.heap.ptr + RSTRING(str)->as.heap.len,
- RSTRING_PTR(str2), len2+1);
+ memcpy(RSTRING(str)->as.heap.ptr + len1, RSTRING_PTR(str2), len2);
+ TERM_FILL(RSTRING(str)->as.heap.ptr + len, rb_enc_mbminlen(enc));
RSTRING(str)->as.heap.len = len;
rb_enc_associate(str, enc);
ENC_CODERANGE_SET(str, cr);
@@ -2082,7 +2266,7 @@ rb_str_concat(VALUE str1, VALUE str2)
unsigned int code;
rb_encoding *enc = STR_ENC_GET(str1);
- if (FIXNUM_P(str2) || TYPE(str2) == T_BIGNUM) {
+ if (FIXNUM_P(str2) || RB_TYPE_P(str2, T_BIGNUM)) {
if (rb_num_to_uint(str2, &code) == 0) {
}
else if (FIXNUM_P(str2)) {
@@ -2130,7 +2314,7 @@ rb_str_concat(VALUE str1, VALUE str2)
rb_raise(rb_eRangeError, "invalid codepoint 0x%X in %s", code, rb_enc_name(enc));
}
rb_str_resize(str1, pos+len);
- strncpy(RSTRING_PTR(str1) + pos, buf, len);
+ memcpy(RSTRING_PTR(str1) + pos, buf, len);
if (cr == ENC_CODERANGE_7BIT && code > 127)
cr = ENC_CODERANGE_VALID;
ENC_CODERANGE_SET(str1, cr);
@@ -2144,9 +2328,9 @@ rb_str_concat(VALUE str1, VALUE str2)
*
* Prepend---Prepend the given string to <i>str</i>.
*
- * a = "world"
- * a.prepend("hello ") #=> "hello world"
- * a #=> "hello world"
+ * a = "world"
+ * a.prepend("hello ") #=> "hello world"
+ * a #=> "hello world"
*/
static VALUE
@@ -2263,20 +2447,27 @@ str_eql(const VALUE str1, const VALUE str2)
return Qtrue;
return Qfalse;
}
+
/*
* 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
rb_str_equal(VALUE str1, VALUE str2)
{
if (str1 == str2) return Qtrue;
- if (TYPE(str2) != T_STRING) {
+ if (!RB_TYPE_P(str2, T_STRING)) {
if (!rb_respond_to(str2, rb_intern("to_str"))) {
return Qfalse;
}
@@ -2296,26 +2487,28 @@ static VALUE
rb_str_eql(VALUE str1, VALUE str2)
{
if (str1 == str2) return Qtrue;
- if (TYPE(str2) != T_STRING) return Qfalse;
+ if (!RB_TYPE_P(str2, T_STRING)) return Qfalse;
return str_eql(str1, str2);
}
/*
* call-seq:
- * str <=> other_str -> -1, 0, +1 or nil
+ * string <=> other_string -> -1, 0, +1 or nil
+ *
*
- * Comparison---Returns -1 if <i>other_str</i> is greater than, 0 if
- * <i>other_str</i> is equal to, and +1 if <i>other_str</i> is less than
- * <i>str</i>. If the strings are of different lengths, and the strings are
- * equal when compared up to the shortest length, then the longer string is
- * considered greater than the shorter one. In older versions of Ruby, setting
- * <code>$=</code> allowed case-insensitive comparisons; this is now deprecated
- * in favor of using <code>String#casecmp</code>.
+ * Comparison---Returns -1, 0, +1 or nil depending on whether +string+ is less
+ * than, equal to, or greater than +other_string+.
+ *
+ * +nil+ is returned if the two values are incomparable.
+ *
+ * If the strings are of different lengths, and the strings are equal when
+ * compared up to the shortest length, then the longer string is considered
+ * greater than the shorter one.
*
* <code><=></code> is the basis for the methods <code><</code>,
- * <code><=</code>, <code>></code>, <code>>=</code>, and <code>between?</code>,
- * included from module <code>Comparable</code>. The method
- * <code>String#==</code> does not use <code>Comparable#==</code>.
+ * <code><=</code>, <code>></code>, <code>>=</code>, and
+ * <code>between?</code>, included from module Comparable. The method
+ * String#== does not use Comparable#==.
*
* "abcdef" <=> "abcde" #=> 1
* "abcdef" <=> "abcdef" #=> 0
@@ -2326,29 +2519,21 @@ rb_str_eql(VALUE str1, VALUE str2)
static VALUE
rb_str_cmp_m(VALUE str1, VALUE str2)
{
- long result;
+ int result;
- if (TYPE(str2) != T_STRING) {
- if (!rb_respond_to(str2, rb_intern("to_str"))) {
- return Qnil;
- }
- else if (!rb_respond_to(str2, rb_intern("<=>"))) {
- return Qnil;
+ if (!RB_TYPE_P(str2, T_STRING)) {
+ VALUE tmp = rb_check_funcall(str2, rb_intern("to_str"), 0, 0);
+ if (RB_TYPE_P(tmp, T_STRING)) {
+ result = rb_str_cmp(str1, tmp);
}
else {
- VALUE tmp = rb_funcall(str2, rb_intern("<=>"), 1, str1);
-
- if (NIL_P(tmp)) return Qnil;
- if (!FIXNUM_P(tmp)) {
- return rb_funcall(LONG2FIX(0), '-', 1, tmp);
- }
- result = -FIX2LONG(tmp);
+ return rb_invcmp(str1, str2);
}
}
else {
result = rb_str_cmp(str1, str2);
}
- return LONG2NUM(result);
+ return INT2FIX(result);
}
/*
@@ -2424,26 +2609,26 @@ rb_str_casecmp(VALUE str1, VALUE str2)
static long
rb_str_index(VALUE str, VALUE sub, long offset)
{
- long pos;
char *s, *sptr, *e;
- long len, slen;
+ 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);
+ if (is_broken_string(sub)) return -1;
+
+ len = single_byte ? RSTRING_LEN(str) : str_strlen(str, enc);
slen = str_strlen(sub, enc);
if (offset < 0) {
offset += len;
if (offset < 0) return -1;
}
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));
+ offset = str_offset(s, e, offset, enc, single_byte);
s += offset;
}
if (slen == 0) return offset;
@@ -2457,7 +2642,8 @@ rb_str_index(VALUE str, VALUE sub, long offset)
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;
}
@@ -2498,14 +2684,15 @@ rb_str_index_m(int argc, VALUE *argv, VALUE str)
if (pos < 0) {
pos += str_strlen(str, STR_ENC_GET(str));
if (pos < 0) {
- if (TYPE(sub) == T_REGEXP) {
+ if (RB_TYPE_P(sub, T_REGEXP)) {
rb_backref_set(Qnil);
}
return Qnil;
}
}
- switch (TYPE(sub)) {
+ if (SPECIAL_CONST_P(sub)) goto generic;
+ switch (BUILTIN_TYPE(sub)) {
case T_REGEXP:
if (pos > str_strlen(str, STR_ENC_GET(str)))
return Qnil;
@@ -2516,6 +2703,7 @@ rb_str_index_m(int argc, VALUE *argv, VALUE str)
pos = rb_str_sublen(str, pos);
break;
+ generic:
default: {
VALUE tmp;
@@ -2537,33 +2725,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;
@@ -2572,8 +2777,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);
+ 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);
+
+ 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);
+}
/*
@@ -2607,7 +2846,7 @@ rb_str_rindex_m(int argc, VALUE *argv, VALUE str)
if (pos < 0) {
pos += len;
if (pos < 0) {
- if (TYPE(sub) == T_REGEXP) {
+ if (RB_TYPE_P(sub, T_REGEXP)) {
rb_backref_set(Qnil);
}
return Qnil;
@@ -2619,7 +2858,8 @@ rb_str_rindex_m(int argc, VALUE *argv, VALUE str)
pos = len;
}
- switch (TYPE(sub)) {
+ if (SPECIAL_CONST_P(sub)) goto generic;
+ switch (BUILTIN_TYPE(sub)) {
case T_REGEXP:
/* enc = rb_get_check(str, sub); */
pos = str_offset(RSTRING_PTR(str), RSTRING_END(str), pos,
@@ -2632,6 +2872,7 @@ rb_str_rindex_m(int argc, VALUE *argv, VALUE str)
if (pos >= 0) return LONG2NUM(pos);
break;
+ generic:
default: {
VALUE tmp;
@@ -2661,6 +2902,10 @@ rb_str_rindex_m(int argc, VALUE *argv, VALUE str)
* <i>obj.=~</i>, passing <i>str</i> as an argument. The default
* <code>=~</code> in <code>Object</code> returns <code>nil</code>.
*
+ * Note: <code>str =~ regexp</code> is not the same as
+ * <code>regexp =~ str</code>. Strings captured from named capture groups
+ * are assigned to local variables only in the second case.
+ *
* "cat o' 9 tails" =~ /\d/ #=> 7
* "cat o' 9 tails" =~ 9 #=> nil
*/
@@ -2668,13 +2913,15 @@ rb_str_rindex_m(int argc, VALUE *argv, VALUE str)
static VALUE
rb_str_match(VALUE x, VALUE y)
{
- switch (TYPE(y)) {
+ if (SPECIAL_CONST_P(y)) goto generic;
+ switch (BUILTIN_TYPE(y)) {
case T_STRING:
rb_raise(rb_eTypeError, "type mismatch: String given");
case T_REGEXP:
return rb_reg_match(y, x);
+ generic:
default:
return rb_funcall(y, rb_intern("=~"), 1, x);
}
@@ -2718,7 +2965,7 @@ rb_str_match_m(int argc, VALUE *argv, VALUE str)
{
VALUE re, result;
if (argc < 1)
- rb_raise(rb_eArgError, "wrong number of arguments (%d for 1..2)", argc);
+ rb_check_arity(argc, 1, 2);
re = argv[0];
argv[0] = str;
result = rb_funcall2(get_pat(re, 0), rb_intern("match"), argc, argv);
@@ -2739,6 +2986,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';
@@ -2773,6 +3038,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';
@@ -2922,7 +3206,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:
@@ -2941,10 +3227,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);
@@ -3129,15 +3428,17 @@ rb_str_aref(VALUE str, VALUE indx)
{
long idx;
- switch (TYPE(indx)) {
- case T_FIXNUM:
+ if (FIXNUM_P(indx)) {
idx = FIX2LONG(indx);
num_index:
str = rb_str_substr(str, idx, 1);
if (!NIL_P(str) && RSTRING_LEN(str) == 0) return Qnil;
return str;
+ }
+ if (SPECIAL_CONST_P(indx)) goto generic;
+ switch (BUILTIN_TYPE(indx)) {
case T_REGEXP:
return rb_str_subpat(str, indx, INT2FIX(0));
@@ -3146,6 +3447,7 @@ rb_str_aref(VALUE str, VALUE indx)
return rb_str_dup(indx);
return Qnil;
+ generic:
default:
/* check if indx is Range */
{
@@ -3166,55 +3468,76 @@ rb_str_aref(VALUE str, VALUE indx)
idx = NUM2LONG(indx);
goto num_index;
}
- return Qnil; /* not reached */
+
+ UNREACHABLE;
}
/*
* call-seq:
- * str[fixnum] -> new_str or nil
- * str[fixnum, fixnum] -> new_str or nil
- * str[range] -> new_str or nil
- * str[regexp] -> new_str or nil
- * str[regexp, fixnum] -> new_str or nil
- * str[other_str] -> new_str 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
- * str.slice(regexp, fixnum) -> new_str or nil
- * str.slice(regexp, capname) -> new_str or nil
- * str.slice(other_str) -> new_str or nil
- *
- * Element Reference---If passed a single <code>Fixnum</code>, returns a
- * substring of one character at that position. If passed two <code>Fixnum</code>
- * objects, returns a substring starting at the offset given by the first, and
- * with a length given by the second. If passed a range, its beginning and end
- * are interpreted as offsets delimiting the substring to be returned. In all
- * three cases, if an offset is negative, it is counted from the end of <i>str</i>.
- * Returns <code>nil</code> if the initial offset falls outside the string or
- * the length is negative.
- *
- * If a <code>Regexp</code> is supplied, the matching portion of <i>str</i> is
- * returned. If a numeric or name parameter follows the regular expression, that
- * component of the <code>MatchData</code> is returned instead. If a
- * <code>String</code> is given, that string is returned if it occurs in
- * <i>str</i>. In both cases, <code>nil</code> is returned if there is no
- * match.
+ * str[index] -> new_str or nil
+ * str[start, length] -> new_str or nil
+ * str[range] -> new_str or nil
+ * str[regexp] -> new_str or nil
+ * str[regexp, capture] -> new_str or nil
+ * str[match_str] -> new_str or nil
+ * str.slice(index) -> new_str or nil
+ * str.slice(start, length) -> new_str or nil
+ * str.slice(range) -> new_str or nil
+ * str.slice(regexp) -> new_str or nil
+ * str.slice(regexp, capture) -> new_str or nil
+ * str.slice(match_str) -> new_str or nil
+ *
+ * Element Reference --- If passed a single +index+, returns a substring of
+ * one character at that index. If passed a +start+ index and a +length+,
+ * returns a substring containing +length+ characters starting at the
+ * +index+. If passed a +range+, its beginning and end are interpreted as
+ * offsets delimiting the substring to be returned.
+ *
+ * In these three cases, if an index is negative, it is counted from the end
+ * of the string. For the +start+ and +range+ cases the starting index
+ * is just before a character and an index matching the string's size.
+ * Additionally, an empty string is returned when the starting index for a
+ * character range is at the end of the string.
+ *
+ * Returns +nil+ if the initial index falls outside the string or the length
+ * is negative.
+ *
+ * If a +Regexp+ is supplied, the matching portion of the string is
+ * returned. If a +capture+ follows the regular expression, which may be a
+ * capture group index or name, follows the regular expression that component
+ * of the MatchData is returned instead.
+ *
+ * If a +match_str+ is given, that string is returned if it occurs in
+ * the string.
+ *
+ * Returns +nil+ if the regular expression does not match or the match string
+ * cannot be found.
*
* a = "hello there"
+ *
* a[1] #=> "e"
* a[2, 3] #=> "llo"
* a[2..3] #=> "ll"
+ *
* a[-3, 2] #=> "er"
* a[7..-2] #=> "her"
* a[-4..-2] #=> "her"
* a[-2..-4] #=> ""
+ *
+ * a[11, 0] #=> ""
+ * a[11] #=> nil
+ * a[12, 0] #=> nil
* a[12..-1] #=> nil
+ *
* a[/[aeiou](.)\1/] #=> "ell"
* a[/[aeiou](.)\1/, 0] #=> "ell"
* a[/[aeiou](.)\1/, 1] #=> "l"
* a[/[aeiou](.)\1/, 2] #=> nil
+ *
+ * a[/(?<vowel>[aeiou])(?<non_vowel>[^aeiou])/, "non_vowel"] #=> "l"
+ * a[/(?<vowel>[aeiou])(?<non_vowel>[^aeiou])/, "vowel"] #=> "e"
+ *
* a["lo"] #=> "lo"
* a["bye"] #=> nil
*/
@@ -3223,14 +3546,12 @@ static VALUE
rb_str_aref_m(int argc, VALUE *argv, VALUE str)
{
if (argc == 2) {
- if (TYPE(argv[0]) == T_REGEXP) {
+ if (RB_TYPE_P(argv[0], T_REGEXP)) {
return rb_str_subpat(str, argv[0], argv[1]);
}
return rb_str_substr(str, NUM2LONG(argv[0]), NUM2LONG(argv[1]));
}
- if (argc != 1) {
- rb_raise(rb_eArgError, "wrong number of arguments (%d for 1..2)", argc);
- }
+ rb_check_arity(argc, 1, 2);
return rb_str_aref(str, argv[0]);
}
@@ -3274,7 +3595,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) {
@@ -3387,13 +3708,15 @@ rb_str_aset(VALUE str, VALUE indx, VALUE val)
{
long idx, beg;
- switch (TYPE(indx)) {
- case T_FIXNUM:
+ if (FIXNUM_P(indx)) {
idx = FIX2LONG(indx);
num_index:
rb_str_splice(str, idx, 1, val);
return val;
+ }
+ if (SPECIAL_CONST_P(indx)) goto generic;
+ switch (TYPE(indx)) {
case T_REGEXP:
rb_str_subpat_set(str, indx, INT2FIX(0), val);
return val;
@@ -3407,6 +3730,7 @@ rb_str_aset(VALUE str, VALUE indx, VALUE val)
rb_str_splice(str, beg, str_strlen(indx, 0), val);
return val;
+ generic:
default:
/* check if indx is Range */
{
@@ -3443,14 +3767,14 @@ rb_str_aset(VALUE str, VALUE indx, VALUE val)
* <code>Fixnum</code> will raise an <code>IndexError</code> if the value is
* out of range; the <code>Range</code> form will raise a
* <code>RangeError</code>, and the <code>Regexp</code> and <code>String</code>
- * forms will silently ignore the assignment.
+ * will raise an <code>IndexError</code> on negative match.
*/
static VALUE
rb_str_aset_m(int argc, VALUE *argv, VALUE str)
{
if (argc == 3) {
- if (TYPE(argv[0]) == T_REGEXP) {
+ if (RB_TYPE_P(argv[0], T_REGEXP)) {
rb_str_subpat_set(str, argv[0], argv[1], argv[2]);
}
else {
@@ -3458,9 +3782,7 @@ rb_str_aset_m(int argc, VALUE *argv, VALUE str)
}
return argv[2];
}
- if (argc != 2) {
- rb_raise(rb_eArgError, "wrong number of arguments (%d for 2..3)", argc);
- }
+ rb_check_arity(argc, 2, 3);
return rb_str_aset(str, argv[0], argv[1]);
}
@@ -3523,9 +3845,7 @@ rb_str_slice_bang(int argc, VALUE *argv, VALUE str)
VALUE buf[3];
int i;
- if (argc < 1 || 2 < argc) {
- rb_raise(rb_eArgError, "wrong number of arguments (%d for 1..2)", argc);
- }
+ rb_check_arity(argc, 1, 2);
for (i=0; i<argc; i++) {
buf[i] = argv[i];
}
@@ -3571,9 +3891,10 @@ get_pat(VALUE pat, int quote)
* str.sub!(pattern, replacement) -> str or nil
* str.sub!(pattern) {|match| block } -> str or nil
*
- * Performs the substitutions of <code>String#sub</code> in place,
- * returning <i>str</i>, or <code>nil</code> if no substitutions were
- * performed.
+ * Performs the same substitution as String#sub in-place.
+ *
+ * Returns +str+ if a substitution was performed or +nil+ if no substitution
+ * was performed.
*/
static VALUE
@@ -3582,23 +3903,20 @@ 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;
- if (argc == 1 && rb_block_given_p()) {
+ rb_check_arity(argc, min_arity, 2);
+ if (argc == 1) {
iter = 1;
}
- else if (argc == 2) {
+ else {
repl = argv[1];
- hash = rb_check_convert_type(argv[1], T_HASH, "Hash", "to_hash");
+ hash = rb_check_hash_type(argv[1]);
if (NIL_P(hash)) {
StringValue(repl);
}
if (OBJ_TAINTED(repl)) tainted = 1;
- if (OBJ_UNTRUSTED(repl)) untrusted = 1;
- }
- else {
- rb_raise(rb_eArgError, "wrong number of arguments (%d for 1..2)", argc);
}
pat = get_pat(argv[0], 1);
@@ -3644,7 +3962,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 ||
@@ -3669,7 +3986,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;
}
@@ -3683,23 +3999,22 @@ rb_str_sub_bang(int argc, VALUE *argv, VALUE str)
* str.sub(pattern, hash) -> new_str
* str.sub(pattern) {|match| block } -> new_str
*
- * Returns a copy of <i>str</i> with the <em>first</em> occurrence of
- * <i>pattern</i> substituted for the second argument. The <i>pattern</i> is
- * typically a <code>Regexp</code>; if given as a <code>String</code>, any
- * regular expression metacharacters it contains will be interpreted
- * literally, e.g. <code>'\\\d'</code> will match a backlash followed by 'd',
- * instead of a digit.
+ * Returns a copy of +str+ with the _first_ occurrence of +pattern+
+ * replaced by the second argument. The +pattern+ is typically a Regexp; if
+ * given as a String, any regular expression metacharacters it contains will
+ * be interpreted literally, e.g. <code>'\\\d'</code> will match a backlash
+ * followed by 'd', instead of a digit.
*
- * If <i>replacement</i> is a <code>String</code> it will be substituted for
- * the matched text. It may contain back-references to the pattern's capture
- * groups of the form <code>\\\d</code>, where <i>d</i> is a group number, or
- * <code>\\\k<n></code>, where <i>n</i> is a group name. If it is a
+ * If +replacement+ is a String it will be substituted for the matched text.
+ * It may contain back-references to the pattern's capture groups of the form
+ * <code>"\\d"</code>, where <i>d</i> is a group number, or
+ * <code>"\\k<n>"</code>, where <i>n</i> is a group name. If it is a
* double-quoted string, both back-references must be preceded by an
- * additional backslash. However, within <i>replacement</i> the special match
+ * additional backslash. However, within +replacement+ the special match
* variables, such as <code>&$</code>, will not refer to the current match.
*
- * If the second argument is a <code>Hash</code>, and the matched text is one
- * of its keys, the corresponding value is the replacement string.
+ * If the second argument is a Hash, and the matched text is one of its keys,
+ * the corresponding value is the replacement string.
*
* In the block form, the current match string is passed in as a parameter,
* and variables such as <code>$1</code>, <code>$2</code>, <code>$`</code>,
@@ -3745,14 +4060,14 @@ str_gsub(int argc, VALUE *argv, VALUE str, int bang)
break;
case 2:
repl = argv[1];
- hash = rb_check_convert_type(argv[1], T_HASH, "Hash", "to_hash");
+ hash = rb_check_hash_type(argv[1]);
if (NIL_P(hash)) {
StringValue(repl);
}
if (OBJ_TAINTED(repl)) tainted = 1;
break;
default:
- rb_raise(rb_eArgError, "wrong number of arguments (%d for 1..2)", argc);
+ rb_check_arity(argc, 1, 2);
}
pat = get_pat(argv[0], 1);
@@ -3798,7 +4113,7 @@ str_gsub(int argc, VALUE *argv, VALUE str, int bang)
if (OBJ_TAINTED(val)) tainted = 1;
- len = beg - offset; /* copy pre-match substr */
+ len = beg0 - offset; /* copy pre-match substr */
if (len) {
rb_enc_str_buf_cat(dest, cp, len, str_enc);
}
@@ -3829,7 +4144,7 @@ str_gsub(int argc, VALUE *argv, VALUE str, int 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;
}
@@ -3878,7 +4193,7 @@ rb_str_gsub_bang(int argc, VALUE *argv, VALUE str)
* <code>\\\k<n></code>, where <i>n</i> is a group name. If it is a
* double-quoted string, both back-references must be preceded by an
* additional backslash. However, within <i>replacement</i> the special match
- * variables, such as <code>&$</code>, will not refer to the current match.
+ * variables, such as <code>$&</code>, will not refer to the current match.
*
* If the second argument is a <code>Hash</code>, and the matched text is one
* of its keys, the corresponding value is the replacement string.
@@ -3991,9 +4306,9 @@ rb_str_getbyte(VALUE str, VALUE index)
/*
* call-seq:
- * str.setbyte(index, int) -> int
+ * str.setbyte(index, integer) -> integer
*
- * modifies the <i>index</i>th byte as <i>int</i>.
+ * modifies the <i>index</i>th byte as <i>integer</i>.
*/
static VALUE
rb_str_setbyte(VALUE str, VALUE index, VALUE value)
@@ -4098,7 +4413,8 @@ str_byte_aref(VALUE str, VALUE indx)
idx = NUM2LONG(indx);
goto num_index;
}
- return Qnil; /* not reached */
+
+ UNREACHABLE;
}
/*
@@ -4121,7 +4437,7 @@ str_byte_aref(VALUE str, VALUE indx)
* "hello".byteslice(-1) #=> "o"
* "hello".byteslice(1, 2) #=> "el"
* "\x80\u3042".byteslice(1, 3) #=> "\u3042"
- * "\x03\u3042\xff".byteslice(1..3) #=> "\u3942"
+ * "\x03\u3042\xff".byteslice(1..3) #=> "\u3042"
*/
static VALUE
@@ -4130,9 +4446,7 @@ rb_str_byteslice(int argc, VALUE *argv, VALUE str)
if (argc == 2) {
return str_byte_substr(str, NUM2LONG(argv[0]), NUM2LONG(argv[1]));
}
- if (argc != 1) {
- rb_raise(rb_eArgError, "wrong number of arguments (%d for 1..2)", argc);
- }
+ rb_check_arity(argc, 1, 2);
return str_byte_aref(str, argv[0]);
}
@@ -4402,16 +4716,14 @@ VALUE
rb_str_inspect(VALUE str)
{
rb_encoding *enc = STR_ENC_GET(str);
+ int encidx = rb_enc_to_index(enc);
const char *p, *pend, *prev;
char buf[CHAR_ESC_LEN + 1];
VALUE result = rb_str_buf_new(0);
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);
@@ -4419,23 +4731,27 @@ rb_str_inspect(VALUE str)
p = RSTRING_PTR(str); pend = RSTRING_END(str);
prev = p;
- if (enc == utf16) {
+ if (encidx == ENCINDEX_UTF_16 && p + 2 <= pend) {
const unsigned char *q = (const unsigned char *)p;
if (q[0] == 0xFE && q[1] == 0xFF)
- enc = rb_enc_find("UTF-16BE");
+ enc = rb_enc_from_index(ENCINDEX_UTF_16BE);
else if (q[0] == 0xFF && q[1] == 0xFE)
- enc = rb_enc_find("UTF-16LE");
- else
+ enc = rb_enc_from_index(ENCINDEX_UTF_16LE);
+ else {
+ enc = rb_ascii8bit_encoding();
unicode_p = 0;
+ }
}
- else if (enc == utf32) {
+ else if (encidx == ENCINDEX_UTF_32 && p + 4 <= pend) {
const unsigned char *q = (const unsigned char *)p;
if (q[0] == 0 && q[1] == 0 && q[2] == 0xFE && q[3] == 0xFF)
- enc = rb_enc_find("UTF-32BE");
+ enc = rb_enc_from_index(ENCINDEX_UTF_32BE);
else if (q[3] == 0 && q[2] == 0 && q[1] == 0xFE && q[0] == 0xFF)
- enc = rb_enc_find("UTF-32LE");
- else
+ enc = rb_enc_from_index(ENCINDEX_UTF_32LE);
+ else {
+ enc = rb_ascii8bit_encoding();
unicode_p = 0;
+ }
}
while (p < pend) {
unsigned int c, cc;
@@ -4514,8 +4830,10 @@ rb_str_inspect(VALUE str)
* call-seq:
* str.dump -> new_str
*
- * Produces a version of <i>str</i> with all nonprinting characters replaced by
+ * Produces a version of +str+ with all non-printing characters replaced by
* <code>\nnn</code> notation and all special characters escaped.
+ *
+ * "hello \n ''".dump #=> "\"hello \\n ''\"
*/
VALUE
@@ -4549,9 +4867,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;
@@ -4973,14 +5291,15 @@ trnext(struct tr *t, rb_encoding *enc)
for (;;) {
if (!t->gen) {
+nextpart:
if (t->p == t->pend) return -1;
- if (t->p < t->pend - 1 && *t->p == '\\') {
- t->p++;
+ if (rb_enc_ascget(t->p, t->pend, &n, enc) == '\\' && t->p + n < t->pend) {
+ t->p += n;
}
t->now = rb_enc_codepoint_len(t->p, t->pend, &n, enc);
t->p += n;
- if (t->p < t->pend - 1 && *t->p == '-') {
- t->p++;
+ if (rb_enc_ascget(t->p, t->pend, &n, enc) == '-' && t->p + n < t->pend) {
+ t->p += n;
if (t->p < t->pend) {
unsigned int c = rb_enc_codepoint_len(t->p, t->pend, &n, enc);
t->p += n;
@@ -5001,12 +5320,20 @@ trnext(struct tr *t, rb_encoding *enc)
}
return t->now;
}
- else if (++t->now < t->max) {
- return t->now;
- }
else {
- t->gen = 0;
- return t->max;
+ while (ONIGENC_CODE_TO_MBCLEN(enc, ++t->now) <= 0) {
+ if (t->now == t->max) {
+ t->gen = 0;
+ goto nextpart;
+ }
+ }
+ if (t->now < t->max) {
+ return t->now;
+ }
+ else {
+ t->gen = 0;
+ return t->max;
+ }
}
}
}
@@ -5163,7 +5490,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;
@@ -5239,7 +5566,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;
@@ -5278,20 +5605,35 @@ rb_str_tr_bang(VALUE str, VALUE src, VALUE repl)
* call-seq:
* str.tr(from_str, to_str) => new_str
*
- * Returns a copy of <i>str</i> with the characters in <i>from_str</i>
- * replaced by the corresponding characters in <i>to_str</i>. If
- * <i>to_str</i> is shorter than <i>from_str</i>, it is padded with its last
- * character in order to maintain the correspondence.
+ * Returns a copy of +str+ with the characters in +from_str+ replaced by the
+ * corresponding characters in +to_str+. If +to_str+ is shorter than
+ * +from_str+, it is padded with its last character in order to maintain the
+ * correspondence.
*
* "hello".tr('el', 'ip') #=> "hippo"
* "hello".tr('aeiou', '*') #=> "h*ll*"
+ * "hello".tr('aeiou', 'AA*') #=> "hAll*"
*
- * Both strings may use the c1-c2 notation to denote ranges of characters,
- * and <i>from_str</i> may start with a <code>^</code>, which denotes all
- * characters except those listed.
+ * Both strings may use the <code>c1-c2</code> notation to denote ranges of
+ * characters, and +from_str+ may start with a <code>^</code>, which denotes
+ * all characters except those listed.
*
* "hello".tr('a-y', 'b-z') #=> "ifmmp"
* "hello".tr('^aeiou', '*') #=> "*e**o"
+ *
+ * The backslash character <code>\</code> can be used to escape
+ * <code>^</code> or <code>-</code> and is otherwise ignored unless it
+ * appears at the end of a range or the end of the +from_str+ or +to_str+:
+ *
+ * "hello^world".tr("\\^aeiou", "*") #=> "h*ll**w*rld"
+ * "hello-world".tr("a\\-eo", "*") #=> "h*ll**w*rld"
+ *
+ * "hello\r\nworld".tr("\r", "") #=> "hello\nworld"
+ * "hello\r\nworld".tr("\\r", "") #=> "hello\r\nwold"
+ * "hello\r\nworld".tr("\\\r", "") #=> "hello\nworld"
+ *
+ * "X['\\b']".tr("X\\", "") #=> "['b']"
+ * "X['\\b']".tr("X-\\]", "") #=> "'b'"
*/
static VALUE
@@ -5341,18 +5683,19 @@ tr_setup_table(VALUE str, char stable[TR_TABLE_SIZE], int first,
else {
VALUE key = UINT2NUM(c);
- if (!table) {
- table = rb_hash_new();
+ if (!table && (first || *tablep || stable[256])) {
if (cflag) {
ptable = *ctablep;
+ table = ptable ? ptable : rb_hash_new();
*ctablep = table;
}
else {
+ table = rb_hash_new();
ptable = *tablep;
*tablep = table;
}
}
- if (!ptable || !NIL_P(rb_hash_aref(ptable, key))) {
+ if (table && (!ptable || (cflag ^ !NIL_P(rb_hash_aref(ptable, key))))) {
rb_hash_aset(table, key, Qtrue);
}
}
@@ -5360,11 +5703,14 @@ tr_setup_table(VALUE str, char stable[TR_TABLE_SIZE], int first,
for (i=0; i<256; i++) {
stable[i] = stable[i] && buf[i];
}
+ if (!table && !cflag) {
+ *tablep = 0;
+ }
}
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;
@@ -5404,9 +5750,7 @@ rb_str_delete_bang(int argc, VALUE *argv, VALUE str)
int i, ascompat, cr;
if (RSTRING_LEN(str) == 0 || !RSTRING_PTR(str)) return Qnil;
- if (argc < 1) {
- rb_raise(rb_eArgError, "wrong number of arguments (at least 1)");
- }
+ rb_check_arity(argc, 1, UNLIMITED_ARGUMENTS);
for (i=0; i<argc; i++) {
VALUE s = argv[i];
@@ -5628,16 +5972,27 @@ rb_str_tr_s(VALUE str, VALUE src, VALUE repl)
* call-seq:
* str.count([other_str]+) -> fixnum
*
- * Each <i>other_str</i> parameter defines a set of characters to count. The
- * intersection of these sets defines the characters to count in
- * <i>str</i>. Any <i>other_str</i> that starts with a caret (^) is
- * negated. The sequence c1--c2 means all characters between c1 and c2.
+ * Each +other_str+ parameter defines a set of characters to count. The
+ * intersection of these sets defines the characters to count in +str+. Any
+ * +other_str+ that starts with a caret <code>^</code> is negated. The
+ * sequence <code>c1-c2</code> means all characters between c1 and c2. The
+ * backslash character <code>\</code> can be used to escape <code>^</code> or
+ * <code>-</code> and is otherwise ignored unless it appears at the end of a
+ * sequence or the end of a +other_str+.
*
* a = "hello world"
- * a.count "lo" #=> 5
- * a.count "lo", "o" #=> 2
- * a.count "hello", "^l" #=> 4
- * a.count "ej-m" #=> 4
+ * a.count "lo" #=> 5
+ * a.count "lo", "o" #=> 2
+ * a.count "hello", "^l" #=> 4
+ * a.count "ej-m" #=> 4
+ *
+ * "hello^world".count "\\^aeiou" #=> 4
+ * "hello-world".count "a\\-eo" #=> 4
+ *
+ * c = "hello world\\r\\n"
+ * c.count "\\" #=> 2
+ * c.count "\\A" #=> 0
+ * c.count "X-\\w" #=> 3
*/
static VALUE
@@ -5650,9 +6005,7 @@ rb_str_count(int argc, VALUE *argv, VALUE str)
int i;
int ascompat;
- if (argc < 1) {
- rb_raise(rb_eArgError, "wrong number of arguments (at least 1)");
- }
+ rb_check_arity(argc, 1, UNLIMITED_ARGUMENTS);
for (i=0; i<argc; i++) {
VALUE tstr = argv[i];
unsigned char c;
@@ -5750,6 +6103,9 @@ static const char isspacetable[256] = {
* limit to the number of fields returned, and trailing null fields are not
* suppressed.
*
+ * When the input +str+ is empty an empty Array is returned as the string is
+ * considered to have no fields to split.
+ *
* " now's the time".split #=> ["now's", "the", "time"]
* " now's the time".split(' ') #=> ["now's", "the", "time"]
* " now's the time".split(/ /) #=> ["", "now's", "", "the", "time"]
@@ -5762,6 +6118,8 @@ static const char isspacetable[256] = {
* "1,2,,3,4,,".split(',') #=> ["1", "2", "", "3", "4"]
* "1,2,,3,4,,".split(',', 4) #=> ["1", "2", "", "3,4,,"]
* "1,2,,3,4,,".split(',', -4) #=> ["1", "2", "", "3", "4", "", ""]
+ *
+ * "".split(',', -1) #=> []
*/
static VALUE
@@ -5796,7 +6154,7 @@ rb_str_split_m(int argc, VALUE *argv, VALUE str)
}
else {
fs_set:
- if (TYPE(spat) == T_STRING) {
+ if (RB_TYPE_P(spat, T_STRING)) {
rb_encoding *enc2 = STR_ENC_GET(spat);
split_type = string;
@@ -5972,7 +6330,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);
}
@@ -5990,18 +6348,130 @@ rb_str_split(VALUE str, const char *sep0)
}
+static VALUE
+rb_str_enumerate_lines(int argc, VALUE *argv, VALUE str, int wantarray)
+{
+ rb_encoding *enc;
+ 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)
+ rs = rb_rs;
+ else
+ rb_scan_args(argc, argv, "01", &rs);
+
+ if (rb_block_given_p()) {
+ if (wantarray) {
+#if STRING_ENUMERATORS_WANTARRAY
+ rb_warn("given block not used");
+ ary = rb_ary_new();
+#else
+ rb_warning("passing a block to String#lines is deprecated");
+ wantarray = 0;
+#endif
+ }
+ }
+ else {
+ if (wantarray)
+ ary = rb_ary_new();
+ else
+ RETURN_ENUMERATOR(str, argc, argv);
+ }
+
+ if (NIL_P(rs)) {
+ if (wantarray) {
+ rb_ary_push(ary, str);
+ return ary;
+ }
+ else {
+ rb_yield(str);
+ return orig;
+ }
+ }
+
+ str = rb_str_new4(str);
+ ptr = subptr = RSTRING_PTR(str);
+ pend = RSTRING_END(str);
+ len = RSTRING_LEN(str);
+ StringValue(rs);
+ rslen = RSTRING_LEN(rs);
+
+ if (rs == rb_default_rs)
+ enc = rb_enc_get(str);
+ else
+ enc = rb_enc_check(str, rs);
+
+ if (rslen == 0) {
+ rsptr = "\n\n";
+ rslen = 2;
+ paragraph_mode = 1;
+ }
+ else {
+ rsptr = RSTRING_PTR(rs);
+ }
+
+ 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);
+ }
+
+ 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);
+ }
+ }
+ 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);
+ }
+ subptr = subend;
+ }
+
+ if (subptr != pend) {
+ line = rb_str_subseq(str, subptr - ptr, pend - subptr);
+ if (wantarray)
+ rb_ary_push(ary, line);
+ else
+ rb_yield(line);
+ RB_GC_GUARD(str);
+ }
+
+ if (wantarray)
+ return ary;
+ else
+ return orig;
+}
+
/*
* call-seq:
* str.each_line(separator=$/) {|substr| block } -> str
* str.each_line(separator=$/) -> an_enumerator
*
- * str.lines(separator=$/) {|substr| block } -> str
- * str.lines(separator=$/) -> an_enumerator
- *
- * Splits <i>str</i> using the supplied parameter as the record separator
- * (<code>$/</code> by default), passing each substring in turn to the supplied
- * block. If a zero-length record separator is supplied, the string is split
- * into paragraphs delimited by multiple successive newlines.
+ * Splits <i>str</i> using the supplied parameter as the record
+ * separator (<code>$/</code> by default), passing each substring in
+ * turn to the supplied block. If a zero-length record separator is
+ * supplied, the string is split into paragraphs delimited by
+ * multiple successive newlines.
*
* If no block is given, an enumerator is returned instead.
*
@@ -6030,112 +6500,76 @@ rb_str_split(VALUE str, const char *sep0)
static VALUE
rb_str_each_line(int argc, VALUE *argv, VALUE str)
{
- rb_encoding *enc;
- VALUE rs;
- unsigned int newline;
- const char *p, *pend, *s, *ptr;
- long len, rslen;
- VALUE line;
- int n;
- VALUE orig = str;
-
- if (argc == 0) {
- rs = rb_rs;
- }
- else {
- rb_scan_args(argc, argv, "01", &rs);
- }
- RETURN_ENUMERATOR(str, argc, argv);
- if (NIL_P(rs)) {
- rb_yield(str);
- return orig;
- }
- str = rb_str_new4(str);
- ptr = p = s = RSTRING_PTR(str);
- pend = p + RSTRING_LEN(str);
- len = RSTRING_LEN(str);
- StringValue(rs);
- if (rs == rb_default_rs) {
- enc = rb_enc_get(str);
- while (p < pend) {
- char *p0;
+ return rb_str_enumerate_lines(argc, argv, str, 0);
+}
- 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_new5(str, s, p - s);
- OBJ_INFECT(line, str);
- rb_enc_cr_str_copy_for_substr(line, str);
- rb_yield(line);
- str_mod_check(str, ptr, len);
- s = p;
- }
- goto finish;
- }
+/*
+ * call-seq:
+ * str.lines(separator=$/) -> an_array
+ *
+ * Returns an array of lines in <i>str</i> split using the supplied
+ * record separator (<code>$/</code> by default). This is a
+ * shorthand for <code>str.each_line(separator).to_a</code>.
+ *
+ * If a block is given, which is a deprecated form, works the same as
+ * <code>each_line</code>.
+ */
- enc = rb_enc_check(str, rs);
- rslen = RSTRING_LEN(rs);
- if (rslen == 0) {
- newline = '\n';
- }
- else {
- newline = rb_enc_codepoint(RSTRING_PTR(rs), RSTRING_END(rs), enc);
- }
+static VALUE
+rb_str_lines(int argc, VALUE *argv, VALUE str)
+{
+ return rb_str_enumerate_lines(argc, argv, str, 1);
+}
- while (p < pend) {
- unsigned int c = rb_enc_codepoint_len(p, pend, &n, enc);
+static VALUE
+rb_str_each_byte_size(VALUE str, VALUE args, VALUE eobj)
+{
+ return LONG2FIX(RSTRING_LEN(str));
+}
- 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;
- }
- p -= n;
- }
- if (c == newline &&
- (rslen <= 1 ||
- (pend - p >= rslen && memcmp(RSTRING_PTR(rs), p, rslen) == 0))) {
- line = rb_str_new5(str, s, p - s + (rslen ? rslen : n));
- OBJ_INFECT(line, str);
- rb_enc_cr_str_copy_for_substr(line, str);
- rb_yield(line);
- str_mod_check(str, ptr, len);
- s = p + (rslen ? rslen : n);
+static VALUE
+rb_str_enumerate_bytes(VALUE str, int wantarray)
+{
+ long i;
+ VALUE UNINITIALIZED_VAR(ary);
+
+ if (rb_block_given_p()) {
+ if (wantarray) {
+#if STRING_ENUMERATORS_WANTARRAY
+ rb_warn("given block not used");
+ ary = rb_ary_new();
+#else
+ rb_warning("passing a block to String#bytes is deprecated");
+ wantarray = 0;
+#endif
}
- p += n;
}
-
- finish:
- if (s != pend) {
- line = rb_str_new5(str, s, pend - s);
- OBJ_INFECT(line, str);
- rb_enc_cr_str_copy_for_substr(line, str);
- rb_yield(line);
+ else {
+ if (wantarray)
+ ary = rb_ary_new2(RSTRING_LEN(str));
+ else
+ RETURN_SIZED_ENUMERATOR(str, 0, 0, rb_str_each_byte_size);
}
- return orig;
+ for (i=0; i<RSTRING_LEN(str); i++) {
+ if (wantarray)
+ rb_ary_push(ary, INT2FIX(RSTRING_PTR(str)[i] & 0xff));
+ else
+ rb_yield(INT2FIX(RSTRING_PTR(str)[i] & 0xff));
+ }
+ if (wantarray)
+ return ary;
+ else
+ return str;
}
-
/*
* call-seq:
- * str.bytes {|fixnum| block } -> str
- * str.bytes -> an_enumerator
- *
* str.each_byte {|fixnum| block } -> str
* str.each_byte -> an_enumerator
*
- * Passes each byte in <i>str</i> to the given block, or returns
- * an enumerator if no block is given.
+ * Passes each byte in <i>str</i> to the given block, or returns an
+ * enumerator if no block is given.
*
* "hello".each_byte {|c| print c, ' ' }
*
@@ -6147,108 +6581,227 @@ rb_str_each_line(int argc, VALUE *argv, VALUE str)
static VALUE
rb_str_each_byte(VALUE str)
{
- long i;
-
- RETURN_ENUMERATOR(str, 0, 0);
- for (i=0; i<RSTRING_LEN(str); i++) {
- rb_yield(INT2FIX(RSTRING_PTR(str)[i] & 0xff));
- }
- return str;
+ return rb_str_enumerate_bytes(str, 0);
}
-
/*
* call-seq:
- * str.chars {|cstr| block } -> str
- * str.chars -> an_enumerator
- *
- * str.each_char {|cstr| block } -> str
- * str.each_char -> an_enumerator
- *
- * Passes each character in <i>str</i> to the given block, or returns
- * an enumerator if no block is given.
- *
- * "hello".each_char {|c| print c, ' ' }
+ * str.bytes -> an_array
*
- * <em>produces:</em>
+ * Returns an array of bytes in <i>str</i>. This is a shorthand for
+ * <code>str.each_byte.to_a</code>.
*
- * h e l l o
+ * If a block is given, which is a deprecated form, works the same as
+ * <code>each_byte</code>.
*/
static VALUE
-rb_str_each_char(VALUE str)
+rb_str_bytes(VALUE str)
+{
+ return rb_str_enumerate_bytes(str, 1);
+}
+
+static VALUE
+rb_str_each_char_size(VALUE str, VALUE args, VALUE eobj)
+{
+ return rb_str_length(str);
+}
+
+static VALUE
+rb_str_enumerate_chars(VALUE str, int wantarray)
{
VALUE orig = str;
+ VALUE substr;
long i, len, n;
const char *ptr;
rb_encoding *enc;
+ VALUE UNINITIALIZED_VAR(ary);
- RETURN_ENUMERATOR(str, 0, 0);
str = rb_str_new4(str);
ptr = RSTRING_PTR(str);
len = RSTRING_LEN(str);
enc = rb_enc_get(str);
+
+ if (rb_block_given_p()) {
+ if (wantarray) {
+#if STRING_ENUMERATORS_WANTARRAY
+ rb_warn("given block not used");
+ ary = rb_ary_new_capa(str_strlen(str, enc));
+#else
+ rb_warning("passing a block to String#chars is deprecated");
+ wantarray = 0;
+#endif
+ }
+ }
+ else {
+ if (wantarray)
+ ary = rb_ary_new_capa(str_strlen(str, enc));
+ else
+ RETURN_SIZED_ENUMERATOR(str, 0, 0, rb_str_each_char_size);
+ }
+
switch (ENC_CODERANGE(str)) {
case ENC_CODERANGE_VALID:
case ENC_CODERANGE_7BIT:
for (i = 0; i < len; i += n) {
n = rb_enc_fast_mbclen(ptr + i, ptr + len, enc);
- rb_yield(rb_str_subseq(str, i, n));
+ substr = rb_str_subseq(str, i, n);
+ if (wantarray)
+ rb_ary_push(ary, substr);
+ else
+ rb_yield(substr);
}
break;
default:
for (i = 0; i < len; i += n) {
n = rb_enc_mbclen(ptr + i, ptr + len, enc);
- rb_yield(rb_str_subseq(str, i, n));
+ substr = rb_str_subseq(str, i, n);
+ if (wantarray)
+ rb_ary_push(ary, substr);
+ else
+ rb_yield(substr);
}
}
- return orig;
+ RB_GC_GUARD(str);
+ if (wantarray)
+ return ary;
+ else
+ return orig;
}
/*
* call-seq:
- * str.codepoints {|integer| block } -> str
- * str.codepoints -> an_enumerator
+ * str.each_char {|cstr| block } -> str
+ * str.each_char -> an_enumerator
*
- * str.each_codepoint {|integer| block } -> str
- * str.each_codepoint -> an_enumerator
+ * Passes each character in <i>str</i> to the given block, or returns
+ * an enumerator if no block is given.
*
- * Passes the <code>Integer</code> ordinal of each character in <i>str</i>,
- * also known as a <i>codepoint</i> when applied to Unicode strings to the
- * given block.
+ * "hello".each_char {|c| print c, ' ' }
*
- * If no block is given, an enumerator is returned instead.
+ * <em>produces:</em>
*
- * "hello\u0639".each_codepoint {|c| print c, ' ' }
+ * h e l l o
+ */
+
+static VALUE
+rb_str_each_char(VALUE str)
+{
+ return rb_str_enumerate_chars(str, 0);
+}
+
+/*
+ * call-seq:
+ * str.chars -> an_array
*
- * <em>produces:</em>
+ * Returns an array of characters in <i>str</i>. This is a shorthand
+ * for <code>str.each_char.to_a</code>.
*
- * 104 101 108 108 111 1593
+ * If a block is given, which is a deprecated form, works the same as
+ * <code>each_char</code>.
*/
static VALUE
-rb_str_each_codepoint(VALUE str)
+rb_str_chars(VALUE str)
+{
+ return rb_str_enumerate_chars(str, 1);
+}
+
+
+static VALUE
+rb_str_enumerate_codepoints(VALUE str, int wantarray)
{
VALUE orig = str;
int n;
unsigned int c;
const char *ptr, *end;
rb_encoding *enc;
+ VALUE UNINITIALIZED_VAR(ary);
+
+ if (single_byte_optimizable(str))
+ return rb_str_enumerate_bytes(str, wantarray);
- if (single_byte_optimizable(str)) return rb_str_each_byte(str);
- RETURN_ENUMERATOR(str, 0, 0);
str = rb_str_new4(str);
ptr = RSTRING_PTR(str);
end = RSTRING_END(str);
enc = STR_ENC_GET(str);
+
+ if (rb_block_given_p()) {
+ if (wantarray) {
+#if STRING_ENUMERATORS_WANTARRAY
+ rb_warn("given block not used");
+ ary = rb_ary_new_capa(str_strlen(str, enc));
+#else
+ rb_warning("passing a block to String#codepoints is deprecated");
+ wantarray = 0;
+#endif
+ }
+ }
+ else {
+ if (wantarray)
+ ary = rb_ary_new_capa(str_strlen(str, enc));
+ else
+ RETURN_SIZED_ENUMERATOR(str, 0, 0, rb_str_each_char_size);
+ }
+
while (ptr < end) {
c = rb_enc_codepoint_len(ptr, end, &n, enc);
- rb_yield(UINT2NUM(c));
+ if (wantarray)
+ rb_ary_push(ary, UINT2NUM(c));
+ else
+ rb_yield(UINT2NUM(c));
ptr += n;
}
- return orig;
+ RB_GC_GUARD(str);
+ if (wantarray)
+ return ary;
+ else
+ return orig;
}
+/*
+ * call-seq:
+ * str.each_codepoint {|integer| block } -> str
+ * str.each_codepoint -> an_enumerator
+ *
+ * Passes the <code>Integer</code> ordinal of each character in <i>str</i>,
+ * also known as a <i>codepoint</i> when applied to Unicode strings to the
+ * given block.
+ *
+ * If no block is given, an enumerator is returned instead.
+ *
+ * "hello\u0639".each_codepoint {|c| print c, ' ' }
+ *
+ * <em>produces:</em>
+ *
+ * 104 101 108 108 111 1593
+ */
+
+static VALUE
+rb_str_each_codepoint(VALUE str)
+{
+ return rb_str_enumerate_codepoints(str, 0);
+}
+
+/*
+ * call-seq:
+ * str.codepoints -> an_array
+ *
+ * Returns an array of the <code>Integer</code> ordinals of the
+ * characters in <i>str</i>. This is a shorthand for
+ * <code>str.each_codepoint.to_a</code>.
+ *
+ * If a block is given, which is a deprecated form, works the same as
+ * <code>each_codepoint</code>.
+ */
+
+static VALUE
+rb_str_codepoints(VALUE str)
+{
+ return rb_str_enumerate_codepoints(str, 1);
+}
+
+
static long
chopped_length(VALUE str)
{
@@ -6314,10 +6867,7 @@ rb_str_chop_bang(VALUE str)
static VALUE
rb_str_chop(VALUE str)
{
- VALUE str2 = rb_str_new5(str, RSTRING_PTR(str), chopped_length(str));
- rb_enc_cr_str_copy_for_substr(str2, str);
- OBJ_INFECT(str2, str);
- return str2;
+ return rb_str_subseq(str, 0, chopped_length(str));
}
@@ -6744,11 +7294,6 @@ rb_str_scan(VALUE str, VALUE pat)
static VALUE
rb_str_hex(VALUE str)
{
- rb_encoding *enc = rb_enc_get(str);
-
- if (!rb_enc_asciicompat(enc)) {
- rb_raise(rb_eEncCompatError, "ASCII incompatible encoding: %s", rb_enc_name(enc));
- }
return rb_str_to_inum(str, 16, FALSE);
}
@@ -6770,23 +7315,25 @@ rb_str_hex(VALUE str)
static VALUE
rb_str_oct(VALUE str)
{
- rb_encoding *enc = rb_enc_get(str);
-
- if (!rb_enc_asciicompat(enc)) {
- rb_raise(rb_eEncCompatError, "ASCII incompatible encoding: %s", rb_enc_name(enc));
- }
return rb_str_to_inum(str, -8, FALSE);
}
/*
* call-seq:
- * str.crypt(other_str) -> new_str
- *
- * Applies a one-way cryptographic hash to <i>str</i> by invoking the standard
- * library function <code>crypt</code>. The argument is the salt string, which
- * should be two characters long, each character drawn from
- * <code>[a-zA-Z0-9./]</code>.
+ * str.crypt(salt_str) -> new_str
+ *
+ * Applies a one-way cryptographic hash to <i>str</i> by invoking the
+ * standard library function <code>crypt(3)</code> with the given
+ * salt string. While the format and the result are system and
+ * implementation dependent, using a salt matching the regular
+ * expression <code>\A[a-zA-Z0-9./]{2}</code> should be valid and
+ * safe on any platform, in which only the first two characters are
+ * significant.
+ *
+ * This method is for use in system specific scripts, so if you want
+ * a cross-platform hash function consider using Digest or OpenSSL
+ * instead.
*/
static VALUE
@@ -7076,11 +7623,11 @@ rb_str_rjust(int argc, VALUE *argv, VALUE str)
/*
* call-seq:
- * str.center(integer, padstr) -> new_str
+ * str.center(width, padstr=' ') -> new_str
*
- * If <i>integer</i> is greater than the length of <i>str</i>, returns a new
- * <code>String</code> of length <i>integer</i> with <i>str</i> centered and
- * padded with <i>padstr</i>; otherwise, returns <i>str</i>.
+ * Centers +str+ in +width+. If +width+ is greater than the length of +str+,
+ * returns a new String of length +width+ with +str+ centered and padded with
+ * +padstr+; otherwise, returns +str+.
*
* "hello".center(4) #=> "hello"
* "hello".center(20) #=> " hello "
@@ -7114,7 +7661,7 @@ rb_str_partition(VALUE str, VALUE sep)
long pos;
int regex = FALSE;
- if (TYPE(sep) == T_REGEXP) {
+ if (RB_TYPE_P(sep, T_REGEXP)) {
pos = rb_reg_search(sep, str, 0, 0);
regex = TRUE;
}
@@ -7164,7 +7711,7 @@ rb_str_rpartition(VALUE str, VALUE sep)
long pos = RSTRING_LEN(str);
int regex = FALSE;
- if (TYPE(sep) == T_REGEXP) {
+ if (RB_TYPE_P(sep, T_REGEXP)) {
pos = rb_reg_search(sep, str, pos, 1);
regex = TRUE;
}
@@ -7186,25 +7733,26 @@ 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)));
}
/*
* call-seq:
- * str.start_with?([prefix]+) -> true or false
+ * str.start_with?([prefixes]+) -> true or false
*
- * Returns true if <i>str</i> starts with one of the prefixes given.
+ * Returns true if +str+ starts with one of the +prefixes+ given.
*
- * p "hello".start_with?("hell") #=> true
+ * "hello".start_with?("hell") #=> true
*
* # returns true if one of the prefixes matches.
- * p "hello".start_with?("heaven", "hell") #=> true
- * p "hello".start_with?("heaven", "paradise") #=> false
- *
- *
- *
+ * "hello".start_with?("heaven", "hell") #=> true
+ * "hello".start_with?("heaven", "paradise") #=> false
*/
static VALUE
@@ -7213,8 +7761,8 @@ rb_str_start_with(int argc, VALUE *argv, VALUE str)
int i;
for (i=0; i<argc; i++) {
- VALUE tmp = rb_check_string_type(argv[i]);
- if (NIL_P(tmp)) continue;
+ VALUE tmp = argv[i];
+ StringValue(tmp);
rb_enc_check(str, tmp);
if (RSTRING_LEN(str) < RSTRING_LEN(tmp)) continue;
if (memcmp(RSTRING_PTR(str), RSTRING_PTR(tmp), RSTRING_LEN(tmp)) == 0)
@@ -7225,9 +7773,9 @@ rb_str_start_with(int argc, VALUE *argv, VALUE str)
/*
* call-seq:
- * str.end_with?([suffix]+) -> true or false
+ * str.end_with?([suffixes]+) -> true or false
*
- * Returns true if <i>str</i> ends with one of the suffixes given.
+ * Returns true if +str+ ends with one of the +suffixes+ given.
*/
static VALUE
@@ -7238,8 +7786,8 @@ rb_str_end_with(int argc, VALUE *argv, VALUE str)
rb_encoding *enc;
for (i=0; i<argc; i++) {
- VALUE tmp = rb_check_string_type(argv[i]);
- if (NIL_P(tmp)) continue;
+ VALUE tmp = argv[i];
+ StringValue(tmp);
enc = rb_enc_check(str, tmp);
if (RSTRING_LEN(str) < RSTRING_LEN(tmp)) continue;
p = RSTRING_PTR(str);
@@ -7256,7 +7804,7 @@ rb_str_end_with(int argc, VALUE *argv, VALUE str)
void
rb_str_setter(VALUE val, ID id, VALUE *var)
{
- if (!NIL_P(val) && TYPE(val) != T_STRING) {
+ if (!NIL_P(val) && !RB_TYPE_P(val, T_STRING)) {
rb_raise(rb_eTypeError, "value of %s must be String", rb_id2name(id));
}
*var = val;
@@ -7281,6 +7829,23 @@ rb_str_force_encoding(VALUE str, VALUE enc)
/*
* call-seq:
+ * str.b -> str
+ *
+ * Returns a copied string whose encoding is ASCII-8BIT.
+ */
+
+static VALUE
+rb_str_b(VALUE str)
+{
+ VALUE str2 = str_alloc(rb_cString);
+ str_replace_shared_without_enc(str2, str);
+ OBJ_INFECT(str2, str);
+ ENC_CODERANGE_CLEAR(str2);
+ return str2;
+}
+
+/*
+ * call-seq:
* str.valid_encoding? -> true or false
*
* Returns true for a string which encoded correctly.
@@ -7326,7 +7891,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.
*/
@@ -7367,6 +7932,317 @@ 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 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
*
@@ -7430,6 +8306,52 @@ sym_printable(const char *s, const char *send, rb_encoding *enc)
return TRUE;
}
+int
+rb_str_symname_p(VALUE sym)
+{
+ rb_encoding *enc;
+ const char *ptr;
+ long len;
+ rb_encoding *resenc = rb_default_internal_encoding();
+
+ if (resenc == NULL) resenc = rb_default_external_encoding();
+ enc = STR_ENC_GET(sym);
+ ptr = RSTRING_PTR(sym);
+ len = RSTRING_LEN(sym);
+ if ((resenc != enc && !rb_str_is_ascii_only_p(sym)) || len != (long)strlen(ptr) ||
+ !rb_enc_symname_p(ptr, enc) || !sym_printable(ptr, ptr + len, enc)) {
+ return FALSE;
+ }
+ return TRUE;
+}
+
+VALUE
+rb_str_quote_unprintable(VALUE str)
+{
+ rb_encoding *enc;
+ const char *ptr;
+ long len;
+ rb_encoding *resenc;
+
+ Check_Type(str, T_STRING);
+ resenc = rb_default_internal_encoding();
+ if (resenc == NULL) resenc = rb_default_external_encoding();
+ enc = STR_ENC_GET(str);
+ ptr = RSTRING_PTR(str);
+ len = RSTRING_LEN(str);
+ if ((resenc != enc && !rb_str_is_ascii_only_p(str)) ||
+ !sym_printable(ptr, ptr + len, enc)) {
+ return rb_str_inspect(str);
+ }
+ return str;
+}
+
+VALUE
+rb_id_quote_unprintable(ID id)
+{
+ return rb_str_quote_unprintable(rb_id2str(id));
+}
+
/*
* call-seq:
* sym.inspect -> string
@@ -7443,20 +8365,13 @@ static VALUE
sym_inspect(VALUE sym)
{
VALUE str;
- ID id = SYM2ID(sym);
- rb_encoding *enc;
const char *ptr;
long len;
+ ID id = SYM2ID(sym);
char *dest;
- rb_encoding *resenc = rb_default_internal_encoding();
- if (resenc == NULL) resenc = rb_default_external_encoding();
sym = rb_id2str(id);
- enc = STR_ENC_GET(sym);
- ptr = RSTRING_PTR(sym);
- len = RSTRING_LEN(sym);
- if ((resenc != enc && !rb_str_is_ascii_only_p(sym)) || len != (long)strlen(ptr) ||
- !rb_enc_symname_p(ptr, enc) || !sym_printable(ptr, ptr + len, enc)) {
+ if (!rb_str_symname_p(sym)) {
str = rb_str_inspect(sym);
len = RSTRING_LEN(str);
rb_str_resize(str, len + 1);
@@ -7465,7 +8380,9 @@ sym_inspect(VALUE sym)
dest[0] = ':';
}
else {
- char *dest;
+ rb_encoding *enc = STR_ENC_GET(sym);
+ ptr = RSTRING_PTR(sym);
+ len = RSTRING_LEN(sym);
str = rb_enc_str_new(0, len + 1, enc);
dest = RSTRING_PTR(str);
dest[0] = ':';
@@ -7579,9 +8496,15 @@ sym_succ(VALUE sym)
/*
* call-seq:
*
- * str <=> other -> -1, 0, +1 or nil
+ * symbol <=> other_symbol -> -1, 0, +1 or nil
+ *
+ * Compares +symbol+ with +other_symbol+ after calling #to_s on each of the
+ * symbols. Returns -1, 0, +1 or nil depending on whether +symbol+ is less
+ * than, equal to, or greater than +other_symbol+.
+ *
+ * +nil+ is returned if the two values are incomparable.
*
- * Compares _sym_ with _other_ in string form.
+ * See String#<=> for more information.
*/
static VALUE
@@ -7613,6 +8536,7 @@ sym_casecmp(VALUE sym, VALUE other)
/*
* call-seq:
* sym =~ obj -> fixnum or nil
+ * sym.match(obj) -> fixnum or nil
*
* Returns <code>sym.to_s =~ obj</code>.
*/
@@ -7626,7 +8550,9 @@ sym_match(VALUE sym, VALUE 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>.
*/
@@ -7640,6 +8566,7 @@ sym_aref(int argc, VALUE *argv, VALUE sym)
/*
* call-seq:
* sym.length -> integer
+ * sym.size -> integer
*
* Same as <code>sym.to_s.length</code>.
*/
@@ -7733,23 +8660,18 @@ rb_to_id(VALUE name)
{
VALUE tmp;
- switch (TYPE(name)) {
- default:
+ if (SYMBOL_P(name)) {
+ return SYM2ID(name);
+ }
+ 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));
+ 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 SYM2ID(name);
}
- return Qnil; /* not reached */
+ return rb_intern_str(name);
}
/*
@@ -7771,9 +8693,11 @@ Init_String(void)
#undef rb_intern
#define rb_intern(str) rb_intern_const(str)
+ frozen_strings = st_init_table(&fstring_hash_type);
+
rb_cString = rb_define_class("String", rb_cObject);
rb_include_module(rb_cString, rb_mComparable);
- rb_define_alloc_func(rb_cString, str_alloc);
+ rb_define_alloc_func(rb_cString, empty_str_alloc);
rb_define_singleton_method(rb_cString, "try_convert", rb_str_s_try_convert, 1);
rb_define_method(rb_cString, "initialize", rb_str_init, -1);
rb_define_method(rb_cString, "initialize_copy", rb_str_replace, 1);
@@ -7808,6 +8732,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);
@@ -7829,10 +8756,10 @@ Init_String(void)
rb_define_method(rb_cString, "hex", rb_str_hex, 0);
rb_define_method(rb_cString, "oct", rb_str_oct, 0);
rb_define_method(rb_cString, "split", rb_str_split_m, -1);
- rb_define_method(rb_cString, "lines", rb_str_each_line, -1);
- rb_define_method(rb_cString, "bytes", rb_str_each_byte, 0);
- rb_define_method(rb_cString, "chars", rb_str_each_char, 0);
- rb_define_method(rb_cString, "codepoints", rb_str_each_codepoint, 0);
+ rb_define_method(rb_cString, "lines", rb_str_lines, -1);
+ rb_define_method(rb_cString, "bytes", rb_str_bytes, 0);
+ rb_define_method(rb_cString, "chars", rb_str_chars, 0);
+ rb_define_method(rb_cString, "codepoints", rb_str_codepoints, 0);
rb_define_method(rb_cString, "reverse", rb_str_reverse, 0);
rb_define_method(rb_cString, "reverse!", rb_str_reverse_bang, 0);
rb_define_method(rb_cString, "concat", rb_str_concat, 1);
@@ -7895,6 +8822,7 @@ Init_String(void)
rb_define_method(rb_cString, "encoding", rb_obj_encoding, 0); /* in encoding.c */
rb_define_method(rb_cString, "force_encoding", rb_str_force_encoding, 1);
+ rb_define_method(rb_cString, "b", rb_str_b, 0);
rb_define_method(rb_cString, "valid_encoding?", rb_str_valid_encoding_p, 0);
rb_define_method(rb_cString, "ascii_only?", rb_str_is_ascii_only_p, 0);
diff --git a/struct.c b/struct.c
index 136ba0acee..a961ac8600 100644
--- a/struct.c
+++ b/struct.c
@@ -43,7 +43,7 @@ rb_struct_s_members(VALUE klass)
if (NIL_P(members)) {
rb_raise(rb_eTypeError, "uninitialized struct");
}
- if (TYPE(members) != T_ARRAY) {
+ if (!RB_TYPE_P(members, T_ARRAY)) {
rb_raise(rb_eTypeError, "corrupted struct");
}
return members;
@@ -64,26 +64,16 @@ rb_struct_members(VALUE s)
static VALUE
rb_struct_s_members_m(VALUE klass)
{
- VALUE members, ary;
- VALUE *p, *pend;
+ VALUE members = rb_struct_s_members(klass);
- members = rb_struct_s_members(klass);
- ary = rb_ary_new2(RARRAY_LEN(members));
- p = RARRAY_PTR(members); pend = p + RARRAY_LEN(members);
- while (p < pend) {
- rb_ary_push(ary, *p);
- p++;
- }
-
- return ary;
+ return rb_ary_dup(members);
}
/*
* call-seq:
* struct.members -> array
*
- * Returns an array of strings 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)
@@ -99,21 +89,20 @@ rb_struct_members_m(VALUE obj)
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));
- return Qnil; /* not reached */
+
+ UNREACHABLE;
}
static VALUE
@@ -122,18 +111,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) = {
@@ -153,77 +141,83 @@ static void
rb_struct_modify(VALUE s)
{
rb_check_frozen(s);
- if (!OBJ_UNTRUSTED(s) && rb_safe_level() >= 4)
- rb_raise(rb_eSecurityError, "Insecure: can't modify Struct");
+ rb_check_trusted(s);
}
static VALUE
rb_struct_set(VALUE obj, VALUE val)
{
- VALUE members, slot, *ptr, *ptr_members;
+ VALUE members, slot;
long i, len;
members = rb_struct_members(obj);
- ptr_members = RARRAY_PTR(members);
len = RARRAY_LEN(members);
rb_struct_modify(obj);
- ptr = RSTRUCT_PTR(obj);
for (i=0; i<len; i++) {
- slot = ptr_members[i];
+ slot = RARRAY_AREF(members, i);
if (rb_id_attrset(SYM2ID(slot)) == rb_frame_this_func()) {
- return ptr[i] = val;
+ return RSTRUCT_SET(obj, i, val);
}
}
rb_name_error(rb_frame_this_func(), "`%s' is not a struct member",
rb_id2name(rb_frame_this_func()));
- return Qnil; /* not reached */
+
+ UNREACHABLE;
+}
+
+static VALUE
+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
-make_struct(VALUE name, VALUE members, VALUE klass)
+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]);
- if (rb_is_local_id(id) || rb_is_const_id(id)) {
- if (i < N_REF_FUNC) {
- rb_define_method_id(nstr, id, ref_func[i], 0);
- }
- else {
- rb_define_method_id(nstr, id, rb_struct_ref, 0);
- }
- rb_define_method_id(nstr, rb_id_attrset(id), rb_struct_set, 1);
+ if (i < N_REF_FUNC) {
+ rb_define_method_id(nstr, id, ref_func[i], 0);
+ }
+ else {
+ rb_define_method_id(nstr, id, rb_struct_ref, 0);
}
+ rb_define_method_id(nstr, rb_id_attrset(id), rb_struct_set, 1);
}
return nstr;
@@ -235,15 +229,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)));
@@ -251,35 +273,56 @@ 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;
+
+ 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);
+
+ 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;
- 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) {
@@ -288,41 +331,56 @@ rb_struct_define(const char *name, ...)
}
va_end(ar);
- return make_struct(nm, ary, rb_cStruct);
+ return setup_struct(rb_define_class_under(outer, name, rb_cStruct), ary);
}
/*
* call-seq:
- * Struct.new( [aString] [, aSym]+> ) -> 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.
- *
- * <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.
- *
- * # 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">
+ * 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
+ * "Hello #{name}!"
+ * end
+ * end
+ * Customer.new("Dave", "123 Main").greeting # => "Hello Dave!"
+ *
+ * This is the recommended way to customize a struct. Subclassing an
+ * anonymous struct creates an extra anonymous class that will never be used.
+ *
+ * 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
@@ -333,16 +391,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);
+ }
+ if (NIL_P(name)) {
+ st = anonymous_struct(klass);
+ }
+ else {
+ st = new_struct(name, klass);
}
- st = make_struct(name, rest, klass);
+ setup_struct(st, rest);
if (rb_block_given_p()) {
rb_mod_module_eval(0, 0, st);
}
@@ -355,7 +425,7 @@ num_members(VALUE klass)
{
VALUE members;
members = struct_ivar_get(klass, id_members);
- if (TYPE(members) != T_ARRAY) {
+ if (!RB_TYPE_P(members, T_ARRAY)) {
rb_raise(rb_eTypeError, "broken members");
}
return RARRAY_LEN(members);
@@ -365,19 +435,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;
}
@@ -385,26 +457,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(st, struct RStruct);
- OBJSETUP(st, 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;
}
@@ -438,21 +509,28 @@ rb_struct_new(VALUE klass, ...)
return rb_class_new_instance(size, mem, 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
@@ -464,9 +542,9 @@ rb_struct_each(VALUE s)
{
long i;
- RETURN_ENUMERATOR(s, 0, 0);
+ 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;
}
@@ -476,16 +554,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
@@ -498,10 +574,21 @@ rb_struct_each_pair(VALUE s)
VALUE members;
long i;
- RETURN_ENUMERATOR(s, 0, 0);
+ RETURN_SIZED_ENUMERATOR(s, 0, 0, struct_enum_size);
members = rb_struct_members(s);
- for (i=0; i<RSTRUCT_LEN(s); i++) {
- rb_yield_values(2, rb_ary_entry(members, i), RSTRUCT_PTR(s)[i]);
+ 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;
}
@@ -511,7 +598,6 @@ inspect_struct(VALUE s, VALUE dummy, int recur)
{
VALUE cname = rb_class_name(rb_obj_class(s));
VALUE members, str = rb_str_new2("#<struct ");
- VALUE *ptr, *ptr_members;
long i, len;
char first = RSTRING_PTR(cname)[0];
@@ -523,9 +609,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;
@@ -536,7 +621,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));
@@ -545,7 +630,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);
@@ -572,7 +657,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)
@@ -582,22 +667,47 @@ 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 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)
+ * joe.to_h[:address] #=> "123 Maple, Anytown NC"
+ */
+
+static VALUE
+rb_struct_to_h(VALUE s)
+{
+ VALUE h = rb_hash_new();
+ VALUE members = rb_struct_members(s);
+ long i;
+
+ for (i=0; i<RSTRUCT_LEN(s); i++) {
+ rb_hash_aset(h, rb_ary_entry(members, i), RSTRUCT_GET(s, i));
+ }
+ return h;
}
/* :nodoc: */
VALUE
rb_struct_init_copy(VALUE copy, VALUE s)
{
- if (copy == s) return copy;
- rb_check_frozen(copy);
- if (!rb_obj_is_instance_of(s, rb_obj_class(copy))) {
- rb_raise(rb_eTypeError, "wrong argument class");
- }
+ 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;
}
@@ -605,32 +715,27 @@ rb_struct_init_copy(VALUE copy, VALUE s)
static VALUE
rb_struct_aref_id(VALUE s, ID id)
{
- 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 (SYM2ID(RARRAY_AREF(members, i)) == id) {
+ return RSTRUCT_GET(s, i);
}
}
rb_name_error(id, "no member '%s' in struct", rb_id2name(id));
- return Qnil; /* not reached */
+
+ 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)
@@ -645,8 +750,16 @@ rb_struct_aref(VALUE s, VALUE idx)
{
long i;
- if (TYPE(idx) == T_STRING || TYPE(idx) == T_SYMBOL) {
- return rb_struct_aref_id(s, rb_to_id(idx));
+ if (RB_TYPE_P(idx, T_SYMBOL)) {
+ return rb_struct_aref_id(s, SYM2ID(idx));
+ }
+ else if (RB_TYPE_P(idx, T_STRING)) {
+ ID id = rb_check_id(&idx);
+ if (!id) {
+ rb_name_error_str(idx, "no member '%"PRIsVALUE"' in struct",
+ QUOTE(idx));
+ }
+ return rb_struct_aref_id(s, id);
}
i = NUM2LONG(idx);
@@ -657,43 +770,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)
{
- 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 (SYM2ID(RARRAY_AREF(members, i)) == id) {
+ rb_struct_modify(s);
+ RSTRUCT_SET(s, i, val);
return val;
}
}
rb_name_error(id, "no member '%s' in struct", rb_id2name(id));
+
+ UNREACHABLE;
}
/*
* call-seq:
- * struct[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)
@@ -710,8 +820,16 @@ rb_struct_aset(VALUE s, VALUE idx, VALUE val)
{
long i;
- if (TYPE(idx) == T_STRING || TYPE(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_id(s, SYM2ID(idx), val);
+ }
+ if (RB_TYPE_P(idx, T_STRING)) {
+ ID id = rb_check_id(&idx);
+ if (!id) {
+ rb_name_error_str(idx, "no member '%"PRIsVALUE"' in struct",
+ QUOTE(idx));
+ }
+ return rb_struct_aset_id(s, id, val);
}
i = NUM2LONG(idx);
@@ -725,7 +843,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
@@ -735,19 +854,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
@@ -761,10 +878,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)
@@ -777,14 +893,12 @@ rb_struct_select(int argc, VALUE *argv, VALUE s)
VALUE result;
long i;
- if (argc > 0) {
- rb_raise(rb_eArgError, "wrong number of arguments (%d for 0)", argc);
- }
- RETURN_ENUMERATOR(s, 0, 0);
+ rb_check_arity(argc, 0, 0);
+ 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));
}
}
@@ -794,12 +908,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;
@@ -809,12 +923,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)
@@ -828,7 +940,7 @@ static VALUE
rb_struct_equal(VALUE s, VALUE s2)
{
if (s == s2) return Qtrue;
- if (TYPE(s2) != T_STRUCT) return Qfalse;
+ if (!RB_TYPE_P(s2, T_STRUCT)) return Qfalse;
if (rb_obj_class(s) != rb_obj_class(s2)) return Qfalse;
if (RSTRUCT_LEN(s) != RSTRUCT_LEN(s2)) {
rb_bug("inconsistent struct"); /* should never happen */
@@ -842,11 +954,12 @@ recursive_hash(VALUE s, VALUE dummy, int recur)
{
long i, len;
st_index_t h;
- VALUE n, *ptr;
+ VALUE n;
+ const VALUE *ptr;
h = rb_hash_start(rb_hash(rb_obj_class(s)));
if (!recur) {
- ptr = RSTRUCT_PTR(s);
+ ptr = RSTRUCT_CONST_PTR(s);
len = RSTRUCT_LEN(s);
for (i = 0; i < len; i++) {
n = rb_hash(ptr[i]);
@@ -861,7 +974,7 @@ recursive_hash(VALUE s, VALUE dummy, int recur)
* 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).
*/
static VALUE
@@ -873,12 +986,12 @@ rb_struct_hash(VALUE s)
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;
@@ -887,18 +1000,19 @@ recursive_eql(VALUE s, VALUE s2, int recur)
}
/*
- * code-seq:
+ * 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
rb_struct_eql(VALUE s, VALUE s2)
{
if (s == s2) return Qtrue;
- if (TYPE(s2) != T_STRUCT) return Qfalse;
+ if (!RB_TYPE_P(s2, T_STRUCT)) return Qfalse;
if (rb_obj_class(s) != rb_obj_class(s2)) return Qfalse;
if (RSTRUCT_LEN(s) != RSTRUCT_LEN(s2)) {
rb_bug("inconsistent struct"); /* should never happen */
@@ -912,7 +1026,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)
@@ -926,19 +1040,29 @@ 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)
@@ -959,6 +1083,7 @@ Init_Struct(void)
rb_define_method(rb_cStruct, "inspect", rb_struct_inspect, 0);
rb_define_alias(rb_cStruct, "to_s", "inspect");
rb_define_method(rb_cStruct, "to_a", rb_struct_to_a, 0);
+ rb_define_method(rb_cStruct, "to_h", rb_struct_to_h, 0);
rb_define_method(rb_cStruct, "values", rb_struct_to_a, 0);
rb_define_method(rb_cStruct, "size", rb_struct_size, 0);
rb_define_method(rb_cStruct, "length", rb_struct_size, 0);
diff --git a/template/Doxyfile.tmpl b/template/Doxyfile.tmpl
index 2abf112863..6b91e20c1d 100644
--- a/template/Doxyfile.tmpl
+++ b/template/Doxyfile.tmpl
@@ -85,7 +85,6 @@ GENERATE_DEPRECATEDLIST= YES
ENABLED_SECTIONS =
MAX_INITIALIZER_LINES = 30
SHOW_USED_FILES = YES
-SHOW_DIRECTORIES = NO
SHOW_FILES = YES
SHOW_NAMESPACES = YES
LAYOUT_FILE =
@@ -103,16 +102,16 @@ WARN_LOGFILE =
# configuration options related to the input files
#---------------------------------------------------------------------------
INPUT_ENCODING = UTF-8
-FILE_PATTERNS = *.c *.h *.y *.inc
+FILE_PATTERNS = *.c *.h *.y *.def
RECURSIVE = YES
-EXCLUDE =
+EXCLUDE = ext/dl/callback
EXCLUDE_SYMLINKS = YES
-EXCLUDE_PATTERNS = *.src doc build tmp test yarvtest lib bootstraptest spec .ext .git .svn
+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 =
EXAMPLE_PATH =
EXAMPLE_PATTERNS =
EXAMPLE_RECURSIVE = NO
-IMAGE_PATH = <%= "#{srcdir}/doc/images" %>
+IMAGE_PATH = <%=srcdir%>/doc/images
FILTER_PATTERNS =
FILTER_SOURCE_FILES = YES
#---------------------------------------------------------------------------
@@ -140,7 +139,6 @@ HTML_FILE_EXTENSION = .html
HTML_HEADER =
HTML_FOOTER =
HTML_STYLESHEET =
-HTML_ALIGN_MEMBERS = YES
HTML_DYNAMIC_SECTIONS = NO
GENERATE_DOCSET = NO
DOCSET_FEEDNAME = "Doxygen generated docs"
@@ -213,19 +211,19 @@ PERLMOD_LATEX = NO
PERLMOD_PRETTY = YES
PERLMOD_MAKEVAR_PREFIX =
#---------------------------------------------------------------------------
-# Configuration options related to the preprocessor
+# Configuration options related to the preprocessor
#---------------------------------------------------------------------------
ENABLE_PREPROCESSING = YES
MACRO_EXPANSION = NO
EXPAND_ONLY_PREDEF = NO
SEARCH_INCLUDES = YES
-INCLUDE_PATH =
+INCLUDE_PATH = <%=srcdir%> <%=srcdir%>/include
INCLUDE_FILE_PATTERNS =
PREDEFINED =
EXPAND_AS_DEFINED =
SKIP_FUNCTION_MACROS = YES
#---------------------------------------------------------------------------
-# Configuration::additions related to external references
+# Configuration::additions related to external references
#---------------------------------------------------------------------------
TAGFILES =
GENERATE_TAGFILE =
@@ -233,7 +231,7 @@ ALLEXTERNALS = NO
EXTERNAL_GROUPS = YES
PERL_PATH = /usr/bin/perl
#---------------------------------------------------------------------------
-# Configuration options related to the dot tool
+# Configuration options related to the dot tool
#---------------------------------------------------------------------------
CLASS_DIAGRAMS = NO
MSCGEN_PATH =
@@ -262,6 +260,6 @@ DOT_MULTI_TARGETS = NO
GENERATE_LEGEND = YES
DOT_CLEANUP = YES
#---------------------------------------------------------------------------
-# Configuration::additions related to the search engine
+# Configuration::additions related to the search engine
#---------------------------------------------------------------------------
SEARCHENGINE = NO
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 4275a4c2f0..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)' %
@@ -61,7 +68,7 @@ encdirs.each do |encdir|
raise ArgumentError,
'%s:%d: ENC_ALIAS: %s is not defined yet. (alias %s)' %
[fn, $., $2, $1] unless defs[$2.upcase]
- when /^ENC_DUMMY\(\s*"([^"]+)"/
+ when /^ENC_DUMMY\w*\(\s*"([^"]+)"/
count += 1
else
next
@@ -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 7bfa0aef01..c94eec3516 100755..100644
--- a/template/fake.rb.in
+++ b/template/fake.rb.in
@@ -22,10 +22,11 @@ if RUBY_PLATFORM =~ /mswin|bccwin|mingw/
end
end
-$:.unshift(File.expand_path("..", __FILE__))
+builddir = File.expand_path(File.dirname(__FILE__))
+$:.unshift(builddir)
posthook = proc do
mkconfig = RbConfig::MAKEFILE_CONFIG
- extout = File.expand_path(mkconfig["EXTOUT"], mkconfig["builddir"])
+ extout = File.expand_path(mkconfig["EXTOUT"], builddir)
$arch_hdrdir = "#{extout}/include/$(arch)"
$ruby = baseruby
untrace_var(:$ruby, posthook)
@@ -34,7 +35,6 @@ prehook = proc do |extmk|
unless extmk
config = RbConfig::CONFIG
mkconfig = RbConfig::MAKEFILE_CONFIG
- builddir = File.expand_path(File.dirname(__FILE__))
mkconfig["top_srcdir"] = $top_srcdir = File.expand_path("@top_srcdir@", builddir)
mkconfig["rubyhdrdir"] = "$(top_srcdir)/include"
mkconfig["builddir"] = config["builddir"] = builddir
diff --git a/template/id.c.tmpl b/template/id.c.tmpl
new file mode 100644
index 0000000000..cac213a8fb
--- /dev/null
+++ b/template/id.c.tmpl
@@ -0,0 +1,27 @@
+%# -*- c -*-
+/* DO NOT EDIT THIS FILE DIRECTLY */
+/**********************************************************************
+
+ id.c -
+
+ $Author$
+ created at: Wed Dec 5 02:36:10 2012
+
+ Copyright (C) 2004-2007 Koichi Sasada
+
+**********************************************************************/
+<%
+defs = File.join(File.dirname(File.dirname(erb.filename)), "defs/id.def")
+ids = eval(File.read(defs), binding, defs)
+%>
+static void
+Init_id(void)
+{
+#undef rb_intern
+#define rb_intern(str) rb_intern_const(str)
+ rb_encoding *enc = rb_usascii_encoding();
+
+% ids[:predefined].each do |token, name|
+ REGISTER_SYMID(id<%=token%>, "<%=name%>");
+% end
+}
diff --git a/template/id.h.tmpl b/template/id.h.tmpl
index ae30cf98a0..9df7947214 100644
--- a/template/id.h.tmpl
+++ b/template/id.h.tmpl
@@ -12,132 +12,100 @@
**********************************************************************/
<%
require 'optparse'
-vpath = ["."]
-input = nil
-opt = OptionParser.new do |o|
- o.on('-v', '--vpath=DIR') {|dirs| vpath.concat dirs.split(File::PATH_SEPARATOR)}
- input, = o.order!(ARGV)
-end or abort opt.opt_s
-tokens = nil
-vpath.find do |dir|
- begin
- if line = File.read(File.join(dir, input))[/^\s*enum\s+yytokentype\s*\{([^{}]*)\s*\};/m, 1]
- tokens = line.scan(/\b(t(?:LAST_TOKEN|U(?:PLUS|MINUS)|POW|CMP|EQQ?|[NGL]EQ|(?:AND|OR)OP|N?MATCH|DOT\d|AREF|ASET|[LR]SHFT|LAMBDA)|id\w+)\s*=\s*(\d+),?/m)
- end
- rescue Errno::ENOENT
- nil
- else
- true
- end
-end
+op_id_offset = 128
+
+token_op_ids = %w[
+ tDOT2 tDOT3 tUPLUS tUMINUS tPOW tDSTAR tCMP tLSHFT tRSHFT
+ tLEQ tGEQ tEQ tEQQ tNEQ tMATCH tNMATCH tAREF tASET
+ tCOLON2 tCOLON3
+]
+
+defs = File.join(File.dirname(File.dirname(erb.filename)), "defs/id.def")
+ids = eval(File.read(defs), binding, defs)
+types = ids.keys.grep(/^[A-Z]/)
%>
#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_LOCAL = 0x00,
+ RUBY_ID_INSTANCE = 0x01,
+ RUBY_ID_GLOBAL = 0x03,
+ RUBY_ID_ATTRSET = 0x04,
+ RUBY_ID_CONST = 0x05,
+ RUBY_ID_CLASS = 0x06,
+ RUBY_ID_JUNK = 0x07,
+ RUBY_ID_INTERNAL = RUBY_ID_JUNK,
+ RUBY_ID_SCOPE_SHIFT = 3,
+ RUBY_ID_SCOPE_MASK = ~(~0U<<RUBY_ID_SCOPE_SHIFT)
+};
-#ifdef USE_PARSE_H
-#include "parse.h"
-#endif
+#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
-#include "vm_opts.h" /* for SUPPORT_JOKE */
+#define ID2ATTRSET(id) (((id)&~ID_SCOPE_MASK)|ID_ATTRSET)
#define symIFUNC ID2SYM(idIFUNC)
#define symCFUNC ID2SYM(idCFUNC)
-#if !defined tLAST_TOKEN && defined YYTOKENTYPE
-#define tLAST_TOKEN tLAST_TOKEN
-#endif
+% token_op_ids.each_with_index do |token, index|
+#define RUBY_TOKEN_<%=token[/\At(.+)\z/, 1]%> <%=op_id_offset + index%>
+% end
+#define RUBY_TOKEN(t) RUBY_TOKEN_##t
enum ruby_method_ids {
-#ifndef tLAST_TOKEN
-% tokens.each do |token, value|
- <%=token%> = <%=value%>,
-% end
-#endif
- idDot2 = tDOT2,
- idDot3 = tDOT3,
- idUPlus = tUPLUS,
- idUMinus = tUMINUS,
- idPow = tPOW,
- idCmp = tCMP,
+ idDot2 = RUBY_TOKEN(DOT2),
+ idDot3 = RUBY_TOKEN(DOT3),
+ idUPlus = RUBY_TOKEN(UPLUS),
+ idUMinus = RUBY_TOKEN(UMINUS),
+ idPow = RUBY_TOKEN(POW),
+ idCmp = RUBY_TOKEN(CMP),
idPLUS = '+',
idMINUS = '-',
idMULT = '*',
idDIV = '/',
idMOD = '%',
idLT = '<',
- idLTLT = tLSHFT,
- idLE = tLEQ,
+ idLTLT = RUBY_TOKEN(LSHFT),
+ idLE = RUBY_TOKEN(LEQ),
idGT = '>',
- idGE = tGEQ,
- idEq = tEQ,
- idEqq = tEQQ,
- idNeq = tNEQ,
+ idGE = RUBY_TOKEN(GEQ),
+ idEq = RUBY_TOKEN(EQ),
+ idEqq = RUBY_TOKEN(EQQ),
+ idNeq = RUBY_TOKEN(NEQ),
idNot = '!',
idBackquote = '`',
- idEqTilde = tMATCH,
- idNeqTilde = tNMATCH,
- idAREF = tAREF,
- idASET = tASET,
- idLAST_TOKEN = tLAST_TOKEN >> ID_SCOPE_SHIFT,
- tIntern,
- tMethodMissing,
- tLength,
- tSize,
- tGets,
- tSucc,
- tEach,
- tProc,
- tLambda,
- tSend,
- t__send__,
- tInitialize,
- tUScore,
-#if SUPPORT_JOKE
- tBitblt,
- tAnswer,
-#endif
- tLAST_ID,
-#define TOKEN2ID(n) id##n = ((t##n<<ID_SCOPE_SHIFT)|ID_LOCAL)
-#if SUPPORT_JOKE
- TOKEN2ID(Bitblt),
- TOKEN2ID(Answer),
-#endif
- TOKEN2ID(Intern),
- TOKEN2ID(MethodMissing),
- TOKEN2ID(Length),
- TOKEN2ID(Size),
- TOKEN2ID(Gets),
- TOKEN2ID(Succ),
- TOKEN2ID(Each),
- TOKEN2ID(Proc),
- TOKEN2ID(Lambda),
- TOKEN2ID(Send),
- TOKEN2ID(__send__),
- TOKEN2ID(Initialize),
- TOKEN2ID(UScore),
- TOKEN2ID(LAST_ID)
-};
-
-#ifdef tLAST_TOKEN
-struct ruby_method_ids_check {
-#define ruby_method_id_check_for(name, value) \
- int checking_for_##name[name == (value) ? 1 : -1]
-% tokens.map do |token, value|
-ruby_method_id_check_for(<%=token%>, <%=value%>);
+ idEqTilde = RUBY_TOKEN(MATCH),
+ idNeqTilde = RUBY_TOKEN(NMATCH),
+ idAREF = RUBY_TOKEN(AREF),
+ idASET = RUBY_TOKEN(ASET),
+ tPRESERVED_ID_BEGIN = <%=op_id_offset + token_op_ids.size - 1%>,
+% ids[:preserved].each do |token|
+ id<%=token%>,
+% end
+ tPRESERVED_ID_END,
+% ids.values_at(*types).flatten.each do |token|
+ t<%=token%>,
+% end
+% 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%>)
+% types.each do |token|
+ TOKEN2<%=type%>ID(<%=token%>),
+% end
% end
+ tLAST_OP_ID = tPRESERVED_ID_END-1,
+ idLAST_OP_ID = tLAST_OP_ID >> ID_SCOPE_SHIFT
};
-#endif
#endif /* RUBY_ID_H */
diff --git a/template/ruby.pc.in b/template/ruby.pc.in
index 2d6716c73c..8a2c066e9c 100644
--- a/template/ruby.pc.in
+++ b/template/ruby.pc.in
@@ -11,9 +11,32 @@ TEENY=@TEENY@
ruby_version=@ruby_version@
RUBY_PROGRAM_VERSION=@RUBY_PROGRAM_VERSION@
RUBY_BASE_NAME=@RUBY_BASE_NAME@
+RUBY_VERSION_NAME=@RUBY_VERSION_NAME@
RUBY_SO_NAME=@RUBY_SO_NAME@
RUBY_INSTALL_NAME=@RUBY_INSTALL_NAME@
DEFFILE=@DEFFILE@
+archlibdir=@archlibdir@
+sitearchlibdir=@sitearchlibdir@
+archincludedir=@archincludedir@
+sitearchincludedir=@sitearchincludedir@
+ruby=${bindir}/${RUBY_INSTALL_NAME}@EXEEXT@
+rubylibprefix=@rubylibprefix@
+rubyarchprefix=@rubyarchprefix@
+rubysitearchprefix=@rubysitearchprefix@
+rubylibdir=@rubylibdir@
+vendordir=@vendordir@
+sitedir=@sitedir@
+vendorlibdir=@vendorlibdir@
+sitelibdir=@sitelibdir@
+rubyarchdir=@rubyarchdir@
+vendorarchdir=@vendorarchdir@
+sitearchdir=@sitearchdir@
+rubyhdrdir=@rubyhdrdir@
+vendorhdrdir=@vendorhdrdir@
+sitehdrdir=@sitehdrdir@
+rubyarchhdrdir=@rubyarchhdrdir@
+vendorarchhdrdir=@vendorarchhdrdir@
+sitearchhdrdir=@sitearchhdrdir@
LIBPATH=@LIBPATH@
LIBRUBY_A=@LIBRUBY_A@
LIBRUBY_SO=@LIBRUBY_SO@
@@ -23,22 +46,11 @@ LIBRUBYARG_STATIC=@LIBRUBYARG_STATIC@
LIBRUBYARG=@LIBRUBYARG@
LIBS=@LIBS@
DLDFLAGS=@DLDFLAGS@
-ruby=${bindir}/${RUBY_INSTALL_NAME}@EXEEXT@
-rubylibprefix=@rubylibprefix@
-rubylibdir=${rubylibprefix}/${ruby_version}
-vendordir=${rubylibprefix}/vendor_ruby
-sitedir=${rubylibprefix}/site_ruby
-rubyarchdir=${rubylibdir}/${arch}
-vendorarchdir=${vendordir}/${sitearch}
-sitearchdir=${sitedir}/${sitearch}
-rubyhdrdir=@rubyhdrdir@
-vendorhdrdir=@vendorhdrdir@
-sitehdrdir=@sitehdrdir@
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.in b/template/verconf.h.in
new file mode 100644
index 0000000000..79c003e09f
--- /dev/null
+++ b/template/verconf.h.in
@@ -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/yarvarch.ja b/template/yarvarch.ja
index c332c20811..bb90f0c0d2 100644
--- a/template/yarvarch.ja
+++ b/template/yarvarch.ja
@@ -1,17 +1,17 @@
-#title YARVƒA[ƒLƒeƒNƒ`ƒƒ
-#set author “ú–{ Ruby ‚Ì‰ï ‚³‚³‚¾‚±‚¤‚¢‚¿
+#title YARVアーキテクãƒãƒ£
+#set author 日本 Ruby ã®ä¼š ã•ã•ã ã“ã†ã„ã¡
-- 2005-03-03(Thu) 00:31:12 +0900 ‚¢‚ë‚¢‚ë‚Æ‘‚«’¼‚µ
+- 2005-03-03(Thu) 00:31:12 +0900 ã„ã‚ã„ã‚ã¨æ›¸ãç›´ã—
----
-* ‚±‚ê‚ÍH
+* ã“れã¯ï¼Ÿ
-[[YARV: Yet Another RubyVM|http://www.atdot.net/yarv]] ‚Ì ÝŒvƒƒ‚‚Å‚·B
+[[YARV: Yet Another RubyVM|http://www.atdot.net/yarv]] 㮠設計メモã§ã™ã€‚
-YARV ‚ÍARuby ƒvƒƒOƒ‰ƒ€‚Ì‚½‚߂̎Ÿ‚Ì‹@”\‚ð’ñ‹Ÿ‚µ‚Ü‚·B
+YARV ã¯ã€Ruby プログラムã®ãŸã‚ã®æ¬¡ã®æ©Ÿèƒ½ã‚’æä¾›ã—ã¾ã™ã€‚
- Compiler
- VM Generator
@@ -22,72 +22,72 @@ YARV ‚ÍARuby ƒvƒƒOƒ‰ƒ€‚Ì‚½‚߂̎Ÿ‚Ì‹@”\‚ð’ñ‹Ÿ‚µ‚Ü‚·B
- (experimental) AOT Compiler
-Œ»Ý‚Ì YARV ‚Í Ruby ƒCƒ“ƒ^ƒvƒŠƒ^‚ÌŠg’£ƒ‰ƒCƒuƒ‰ƒŠ‚Æ‚µ‚ÄŽÀ‘•‚µ‚Ä‚¢‚Ü‚·B‚±
-‚ê‚É‚æ‚èARuby ƒCƒ“ƒ^ƒvƒŠƒ^‚Ì•K—v‚È‹@”\iƒp[ƒTAƒIƒuƒWƒFƒNƒgŠÇ—AŠù‘¶
-‚ÌŠg’£ƒ‰ƒCƒuƒ‰ƒŠj‚Ȃǂª‚Ù‚Ú‚»‚̂܂ܗ˜—p‚Å‚«‚Ü‚·B
+ç¾åœ¨ã® YARV 㯠Ruby ã‚¤ãƒ³ã‚¿ãƒ—ãƒªã‚¿ã®æ‹¡å¼µãƒ©ã‚¤ãƒ–ラリã¨ã—ã¦å®Ÿè£…ã—ã¦ã„ã¾ã™ã€‚ã“
+れã«ã‚ˆã‚Šã€Ruby インタプリタã®å¿…è¦ãªæ©Ÿèƒ½ï¼ˆãƒ‘ーサã€ã‚ªãƒ–ジェクト管ç†ã€æ—¢å­˜
+ã®æ‹¡å¼µãƒ©ã‚¤ãƒ–ラリ)ãªã©ãŒã»ã¼ãã®ã¾ã¾åˆ©ç”¨ã§ãã¾ã™ã€‚
-‚½‚¾‚µA‚¢‚­‚‚©‚̃pƒbƒ`‚ð Ruby ƒCƒ“ƒ^ƒvƒŠƒ^‚É“–‚ĂȂ¯‚ê‚΂Ȃè‚Ü‚¹‚ñB
+ãŸã ã—ã€ã„ãã¤ã‹ã®ãƒ‘ッãƒã‚’ Ruby インタプリタã«å½“ã¦ãªã‘れã°ãªã‚Šã¾ã›ã‚“。
-¡Œã‚ÍARuby –{‘̂̃Cƒ“ƒ^ƒvƒŠƒ^•”•ªieval.cj‚ð’u‚«Š·‚¦‚邱‚Æ‚ð–ÚŽw‚µ‚Ä
-ŠJ”­‚ðŒp‘±‚·‚é—\’è‚Å‚·B
+今後ã¯ã€Ruby 本体ã®ã‚¤ãƒ³ã‚¿ãƒ—リタ部分(eval.cï¼‰ã‚’ç½®ãæ›ãˆã‚‹ã“ã¨ã‚’目指ã—ã¦
+開発を継続ã™ã‚‹äºˆå®šã§ã™ã€‚
* Compiler (compile.h, compile.c)
-ƒRƒ“ƒpƒCƒ‰‚ÍARuby ƒCƒ“ƒ^ƒvƒŠƒ^‚̃p[ƒT‚É‚æ‚Á‚ͬ‚³‚ꂽ\•¶–ØiRNode
-ƒf[ƒ^‚É‚æ‚é–Øj‚ð YARV –½—ß—ñ‚ɕϊ·‚µ‚Ü‚·BYARV –½—߂ɂ‚¢‚Ă͌ãq‚µ‚Ü
-‚·B
+コンパイラã¯ã€Ruby インタプリタã®ãƒ‘ーサã«ã‚ˆã£ã¦ç”Ÿæˆã•ã‚ŒãŸæ§‹æ–‡æœ¨ï¼ˆRNode
+データã«ã‚ˆã‚‹æœ¨ï¼‰ã‚’ YARV 命令列ã«å¤‰æ›ã—ã¾ã™ã€‚YARV 命令ã«ã¤ã„ã¦ã¯å¾Œè¿°ã—ã¾
+ã™ã€‚
-‚Æ‚­‚ɓ‚¢‚±‚Ƃ͂µ‚Ä‚¢‚Ü‚¹‚ñ‚ªAƒXƒR[ƒv‚Ȃǂ̊JŽnŽž‚Ƀ[ƒJƒ‹•Ï”‚̉
-Šú‰»‚Ȃǂðs‚¢A‚ ‚Æ‚Í\•¶–Ø‚ð’H‚è•ÏŠ·‚µ‚Ä‚¢‚«‚Ü‚·B
+ã¨ãã«é›£ã—ã„ã“ã¨ã¯ã—ã¦ã„ã¾ã›ã‚“ãŒã€ã‚¹ã‚³ãƒ¼ãƒ—ãªã©ã®é–‹å§‹æ™‚ã«ãƒ­ãƒ¼ã‚«ãƒ«å¤‰æ•°ã®åˆ
+期化ãªã©ã‚’行ã„ã€ã‚ã¨ã¯æ§‹æ–‡æœ¨ã‚’辿り変æ›ã—ã¦ã„ãã¾ã™ã€‚
-•ÏŠ·’†‚Í Ruby ‚Ì Array ƒIƒuƒWƒFƒNƒg‚É YARV –½—߃IƒuƒWƒFƒNƒgA‚¨‚æ‚уIƒy
-ƒ‰ƒ“ƒh‚ðŠi”[‚µ‚Ä‚¢‚«AÅŒã‚ÉŽÀs‚Å‚«‚éŒ`‚ɕϊ·‚µ‚Ü‚·BƒRƒ“ƒpƒCƒ‰‚Å‚ÍAƒR
-ƒ“ƒpƒCƒ‹’†‚ɶ¬‚·‚郃‚ƒŠ—̈æ‚ÌŠÇ—‚ª–â‘è‚ɂȂ邱‚Æ‚ª‚ ‚è‚Ü‚·‚ªAYARV
-‚Ìê‡ARuby ƒCƒ“ƒ^ƒvƒŠƒ^‚ª‚·‚ׂĖʓ|‚ð‚݂Ă­‚ê‚é‚̂ł±‚Ì•”•ª‚Í”ñí‚ÉŠy
-‚Éì‚邱‚Æ‚ª‚Å‚«‚Ü‚µ‚½iƒK[ƒx[ƒWƒRƒŒƒNƒ^‚É‚æ‚Á‚ÄŽ©“®“I‚Ƀƒ‚ƒŠŠÇ—‚ð‚µ
-‚Ä‚­‚ê‚邽‚ßjB
+変æ›ä¸­ã¯ Ruby ã® Array オブジェクト㫠YARV 命令オブジェクトã€ãŠã‚ˆã³ã‚ªãƒš
+ランドを格ç´ã—ã¦ã„ãã€æœ€å¾Œã«å®Ÿè¡Œã§ãã‚‹å½¢ã«å¤‰æ›ã—ã¾ã™ã€‚コンパイラã§ã¯ã€ã‚³
+ンパイル中ã«ç”Ÿæˆã™ã‚‹ãƒ¡ãƒ¢ãƒªé ˜åŸŸã®ç®¡ç†ãŒå•題ã«ãªã‚‹ã“ã¨ãŒã‚りã¾ã™ãŒã€YARV
+ã®å ´åˆã€Ruby インタプリタãŒã™ã¹ã¦é¢å€’ã‚’ã¿ã¦ãれるã®ã§ã“ã®éƒ¨åˆ†ã¯éžå¸¸ã«æ¥½
+ã«ä½œã‚‹ã“ã¨ãŒã§ãã¾ã—ãŸï¼ˆã‚¬ãƒ¼ãƒ™ãƒ¼ã‚¸ã‚³ãƒ¬ã‚¯ã‚¿ã«ã‚ˆã£ã¦è‡ªå‹•çš„ã«ãƒ¡ãƒ¢ãƒªç®¡ç†ã‚’ã—
+ã¦ãれるãŸã‚)。
-YARV –½—ß‚ÍA–½—ß‚ðŽ¦‚·Ž¯•ÊŽqAƒIƒyƒ‰ƒ“ƒh‚È‚ÇA‚·‚×‚Ä 1 word iƒ}ƒVƒ“‚Å
-•\Œ»‚Å‚«‚鎩‘R‚È’lBC Œ¾Œê‚ł̓|ƒCƒ“ƒ^‚̃TƒCƒYBRuby ƒCƒ“ƒ^ƒvƒŠƒ^—pŒê‚Å
-‚Í VALUE ‚̃TƒCƒYj‚Å•\Œ»‚³‚ê‚Ü‚·B‚»‚Ì‚½‚ßAYARV –½—߂͂¢‚í‚ä‚éuƒoƒCƒg
-ƒR[ƒhv‚ł͂ ‚è‚Ü‚¹‚ñB‚»‚Ì‚½‚ßAYARV ‚Ìà–¾‚ȂǂłÍu–½—ß—ñv‚Æ‚¢‚¤—p
-Œê‚ðŽg‚Á‚Ä‚¢‚Ü‚·B
+YARV 命令ã¯ã€å‘½ä»¤ã‚’示ã™è­˜åˆ¥å­ã€ã‚ªãƒšãƒ©ãƒ³ãƒ‰ãªã©ã€ã™ã¹ã¦ 1 word (マシンã§
+表ç¾ã§ãる自然ãªå€¤ã€‚C 言語ã§ã¯ãƒã‚¤ãƒ³ã‚¿ã®ã‚µã‚¤ã‚ºã€‚Ruby インタプリタ用語ã§
+㯠VALUE ã®ã‚µã‚¤ã‚ºï¼‰ã§è¡¨ç¾ã•れã¾ã™ã€‚ãã®ãŸã‚ã€YARV 命令ã¯ã„ã‚ゆる「ãƒã‚¤ãƒˆ
+コードã€ã§ã¯ã‚りã¾ã›ã‚“。ãã®ãŸã‚ã€YARV ã®èª¬æ˜Žãªã©ã§ã¯ã€Œå‘½ä»¤åˆ—ã€ã¨ã„ã†ç”¨
+語を使ã£ã¦ã„ã¾ã™ã€‚
-1 word ‚Å‚ ‚邽‚ßAƒƒ‚ƒŠ‚Ì—˜—pŒø—¦‚Í‘½­ˆ«‚­‚È‚è‚Ü‚·‚ªAƒAƒNƒZƒX‘¬“x‚È
-‚Ç‚ðl—¶‚·‚邯A–{•ûŽ®‚ªˆê”Ô‚¢‚¢‚Æl‚¦‚Ä‚¨‚è‚Ü‚·B‚½‚Æ‚¦‚΃Iƒyƒ‰ƒ“ƒh‚ðƒR
-ƒ“ƒXƒ^ƒ“ƒgƒv[ƒ‹‚ÉŠi”[‚µAƒCƒ“ƒfƒbƒNƒX‚݂̂ðƒIƒyƒ‰ƒ“ƒh‚ÅŽ¦‚·‚±‚Æ‚à‰Â”\‚Å
-‚·‚ªAŠÔÚƒAƒNƒZƒX‚ɂȂÁ‚Ä‚µ‚Ü‚¤‚̂ū”\‚ɉe‹¿‚ªo‚邽‚ßA‹p‰º‚µ‚Ü‚µ‚½B
+1 word ã§ã‚ã‚‹ãŸã‚ã€ãƒ¡ãƒ¢ãƒªã®åˆ©ç”¨åŠ¹çŽ‡ã¯å¤šå°‘悪ããªã‚Šã¾ã™ãŒã€ã‚¢ã‚¯ã‚»ã‚¹é€Ÿåº¦ãª
+ã©ã‚’考慮ã™ã‚‹ã¨ã€æœ¬æ–¹å¼ãŒä¸€ç•ªã„ã„ã¨è€ƒãˆã¦ãŠã‚Šã¾ã™ã€‚ãŸã¨ãˆã°ã‚ªãƒšãƒ©ãƒ³ãƒ‰ã‚’コ
+ãƒ³ã‚¹ã‚¿ãƒ³ãƒˆãƒ—ãƒ¼ãƒ«ã«æ ¼ç´ã—ã€ã‚¤ãƒ³ãƒ‡ãƒƒã‚¯ã‚¹ã®ã¿ã‚’オペランドã§ç¤ºã™ã“ã¨ã‚‚å¯èƒ½ã§
+ã™ãŒã€é–“接アクセスã«ãªã£ã¦ã—ã¾ã†ã®ã§æ€§èƒ½ã«å½±éŸ¿ãŒå‡ºã‚‹ãŸã‚ã€å´ä¸‹ã—ã¾ã—ãŸã€‚
* VM Generator (rb/insns2vm.rb, insns.def)
-rb/insns2vm.rb ‚Æ‚¢‚¤ƒXƒNƒŠƒvƒg‚ÍAinsns.def ‚Æ‚¢‚¤ƒtƒ@ƒCƒ‹‚ð“ǂݞ‚ÝA
-VM ‚Ì‚½‚߂ɕK—v‚ȃtƒ@ƒCƒ‹‚𶬂µ‚Ü‚·B‹ï‘Ì“I‚É‚ÍA–½—ß‚ðŽÀs‚·‚é•”•ª‚ð
-¶¬‚µ‚Ü‚·‚ªA‚Ù‚©‚É‚àƒRƒ“ƒpƒCƒ‹‚É•K—v‚Èî•ñAÅ“K‰»‚É•K—v‚Èî•ñA‚âƒAƒZ
-ƒ“ƒuƒ‰A‹tƒAƒZƒ“ƒuƒ‰‚É•K—v‚Èî•ñ‚ðŽ¦‚·ƒtƒ@ƒCƒ‹‚ඬ‚µ‚Ü‚·B
+rb/insns2vm.rb ã¨ã„ã†ã‚¹ã‚¯ãƒªãƒ—トã¯ã€insns.def ã¨ã„ã†ãƒ•ァイルを読ã¿è¾¼ã¿ã€
+VM ã®ãŸã‚ã«å¿…è¦ãªãƒ•ァイルを生æˆã—ã¾ã™ã€‚具体的ã«ã¯ã€å‘½ä»¤ã‚’実行ã™ã‚‹éƒ¨åˆ†ã‚’
+生æˆã—ã¾ã™ãŒã€ã»ã‹ã«ã‚‚コンパイルã«å¿…è¦ãªæƒ…å ±ã€æœ€é©åŒ–ã«å¿…è¦ãªæƒ…å ±ã€ã‚„アセ
+ンブラã€é€†ã‚¢ã‚»ãƒ³ãƒ–ラã«å¿…è¦ãªæƒ…報を示ã™ãƒ•ァイルも生æˆã—ã¾ã™ã€‚
-** –½—ß‹Lq
+** 命令記述
-insns.def ‚É‚ÍAŠe–½—ß‚ª‚ǂ̂悤‚È–½—߂ł ‚é‚©‚ð‹Lq‚µ‚Ü‚·B‹ï‘Ì“I‚ɂ͎Ÿ
-‚Ìî•ñ‚ð‹Lq‚µ‚Ü‚·B
+insns.def ã«ã¯ã€å„命令ãŒã©ã®ã‚ˆã†ãªå‘½ä»¤ã§ã‚ã‚‹ã‹ã‚’記述ã—ã¾ã™ã€‚具体的ã«ã¯æ¬¡
+ã®æƒ…報を記述ã—ã¾ã™ã€‚
-- –½—߂̖¼‘O
-- ‚»‚Ì–½—߂̃JƒeƒSƒŠAƒRƒƒ“ƒgi‰pŒêA“ú–{Œêj
-- ƒIƒyƒ‰ƒ“ƒh‚Ì–¼‘O
-- ‚»‚Ì–½—ߎÀs‘O‚ɃXƒ^ƒbƒN‚©‚çƒ|ƒbƒv‚·‚é’l
-- ‚»‚Ì–½—ߎÀsŒã‚ɃXƒ^ƒbƒN‚ɃvƒbƒVƒ…‚·‚é’l
-- ‚»‚Ì–½—߂̃ƒWƒbƒNiC Œ¾Œê‚Å‹Lqj
+- 命令ã®åå‰
+- ãã®å‘½ä»¤ã®ã‚«ãƒ†ã‚´ãƒªã€ã‚³ãƒ¡ãƒ³ãƒˆï¼ˆè‹±èªžã€æ—¥æœ¬èªžï¼‰
+- オペランドã®åå‰
+- ãã®å‘½ä»¤å®Ÿè¡Œå‰ã«ã‚¹ã‚¿ãƒƒã‚¯ã‹ã‚‰ãƒãƒƒãƒ—ã™ã‚‹å€¤
+- ãã®å‘½ä»¤å®Ÿè¡Œå¾Œã«ã‚¹ã‚¿ãƒƒã‚¯ã«ãƒ—ッシュã™ã‚‹å€¤
+- ãã®å‘½ä»¤ã®ãƒ­ã‚¸ãƒƒã‚¯ï¼ˆC 言語ã§è¨˜è¿°ï¼‰
-‚½‚Æ‚¦‚ÎAƒXƒ^ƒbƒN‚É self ‚ð‚¨‚­ putself ‚Æ‚¢‚¤–½—߂͎Ÿ‚̂悤‚É‹Lq‚µ‚Ü
-‚·B
+ãŸã¨ãˆã°ã€ã‚¹ã‚¿ãƒƒã‚¯ã« self ã‚’ãŠã putself ã¨ã„ã†å‘½ä»¤ã¯æ¬¡ã®ã‚ˆã†ã«è¨˜è¿°ã—ã¾
+ã™ã€‚
#code
/**
@c put
@e put self.
- @j self ‚ð’u‚­B
+ @j self ã‚’ç½®ã。
*/
DEFINE_INSN
putself
@@ -99,36 +99,36 @@ putself
}
#end
-‚±‚Ìê‡AƒIƒyƒ‰ƒ“ƒh‚ÆAƒXƒ^ƒbƒN‚©‚çƒ|ƒbƒv‚·‚é’l‚Í–³‚¢‚±‚ƂɂȂè‚Ü‚·B–½
-—ßI—¹ŒãAself ‚ðƒXƒ^ƒbƒNƒgƒbƒv‚É’u‚«‚½‚¢‚킯‚Å‚·‚ªA‚»‚ê‚Í val ‚Æ‚¢‚¤A
-ƒXƒ^ƒbƒN‚ɃvƒbƒVƒ…‚·‚é’l‚Æ‚µ‚Ä錾‚µ‚Ä‚¨‚¢‚½•Ï”‚É‘ã“ü‚µ‚Ä‚¨‚­‚±‚Æ‚ÅA‚±
-‚ê‚ð•ÏŠ·‚·‚邯ƒXƒ^ƒbƒNƒgƒbƒv‚É’u‚­ C ƒvƒƒOƒ‰ƒ€‚ª¶¬‚³‚ê‚Ü‚·B
+ã“ã®å ´åˆã€ã‚ªãƒšãƒ©ãƒ³ãƒ‰ã¨ã€ã‚¹ã‚¿ãƒƒã‚¯ã‹ã‚‰ãƒãƒƒãƒ—ã™ã‚‹å€¤ã¯ç„¡ã„ã“ã¨ã«ãªã‚Šã¾ã™ã€‚命
+令終了後ã€self をスタックトップã«ç½®ããŸã„ã‚ã‘ã§ã™ãŒã€ãれ㯠val ã¨ã„ã†ã€
+スタックã«ãƒ—ッシュã™ã‚‹å€¤ã¨ã—ã¦å®£è¨€ã—ã¦ãŠã„ãŸå¤‰æ•°ã«ä»£å…¥ã—ã¦ãŠãã“ã¨ã§ã€ã“
+れを変æ›ã™ã‚‹ã¨ã‚¹ã‚¿ãƒƒã‚¯ãƒˆãƒƒãƒ—ã«ç½®ã C プログラムãŒç”Ÿæˆã•れã¾ã™ã€‚
-ׂ©‚¢ƒtƒH[ƒ}ƒbƒg‚Í insns.def ‚Ì–`“ª‚ðŽQÆ‚µ‚Ä‚­‚¾‚³‚¢B‚»‚ñ‚Ȃɓ‚­
-‚È‚¢‚ÆŽv‚¢‚Ü‚·B
+ç´°ã‹ã„フォーマット㯠insns.def ã®å†’é ­ã‚’å‚ç…§ã—ã¦ãã ã•ã„。ãã‚“ãªã«é›£ã—ã
+ãªã„ã¨æ€ã„ã¾ã™ã€‚
-insnhelper.h ‚Æ‚¢‚¤ƒtƒ@ƒCƒ‹‚ÉA–½—߃ƒWƒbƒN‚ð‹Lq‚·‚邽‚߂ɕK—v‚ȃ}ƒNƒ
-‚ª’è‹`‚³‚ê‚Ä‚¢‚Ü‚·B‚Ü‚½AVM ‚Ì“à•”\‘¢‚ÉŠÖ‚·‚é’è‹`‚Í vm.h ‚Æ‚¢‚¤ƒtƒ@ƒC
-ƒ‹‚É‚ ‚è‚Ü‚·B
+insnhelper.h ã¨ã„ã†ãƒ•ァイルã«ã€å‘½ä»¤ãƒ­ã‚¸ãƒƒã‚¯ã‚’記述ã™ã‚‹ãŸã‚ã«å¿…è¦ãªãƒžã‚¯ãƒ­
+ãŒå®šç¾©ã•れã¦ã„ã¾ã™ã€‚ã¾ãŸã€VM ã®å†…部構造ã«é–¢ã™ã‚‹å®šç¾©ã¯ vm.h ã¨ã„ã†ãƒ•ァイ
+ルã«ã‚りã¾ã™ã€‚
* VM (Virtual Machine, vm.h, vm.c)
-VM ‚ÍAŽÀۂɃRƒ“ƒpƒCƒ‹‚µ‚½Œ‹‰Ê¶¬‚³‚ê‚é YARV –½—ß—ñ‚ðŽÀs‚µ‚Ü‚·B‚Ü‚³
-‚ÉA‚±‚Ì•”•ª‚ª YARV ‚̃Lƒ‚‚ɂȂèA«—ˆ“I‚É‚Í eval.c ‚ð‚±‚Ì VM ‚Å’u‚«Š·‚¦
-‚½‚¢‚Æl‚¦‚Ä‚¢‚Ü‚·B
+VM ã¯ã€å®Ÿéš›ã«ã‚³ãƒ³ãƒ‘イルã—ãŸçµæžœç”Ÿæˆã•れる YARV 命令列を実行ã—ã¾ã™ã€‚ã¾ã•
+ã«ã€ã“ã®éƒ¨åˆ†ãŒ YARV ã®ã‚­ãƒ¢ã«ãªã‚Šã€å°†æ¥çš„ã«ã¯ eval.c ã‚’ã“ã® VM ã§ç½®ãæ›ãˆ
+ãŸã„ã¨è€ƒãˆã¦ã„ã¾ã™ã€‚
-Œ»Ý‚Ì Ruby ƒCƒ“ƒ^ƒvƒŠƒ^‚ÅŽÀs‚Å‚«‚é‚·‚ׂĂ̂±‚Æ‚ªA‚±‚Ì VM ‚ÅŽÀŒ»‚Å‚«‚é
-‚悤‚Éì‚Á‚Ä‚¢‚Ü‚·iŒ»’iŠK‚ł͂܂¾Š®‘S‚ł͂ ‚è‚Ü‚¹‚ñ‚ªA‚»‚¤‚È‚é‚ׂ«‚Å‚·jB
+ç¾åœ¨ã® Ruby インタプリタã§å®Ÿè¡Œã§ãã‚‹ã™ã¹ã¦ã®ã“ã¨ãŒã€ã“ã® VM ã§å®Ÿç¾ã§ãã‚‹
+よã†ã«ä½œã£ã¦ã„ã¾ã™ï¼ˆç¾æ®µéšŽã§ã¯ã¾ã å®Œå…¨ã§ã¯ã‚りã¾ã›ã‚“ãŒã€ãã†ãªã‚‹ã¹ãã§ã™ï¼‰ã€‚
-VM ‚ÍA’Pƒ‚ȃXƒ^ƒbƒNƒ}ƒVƒ“‚Æ‚µ‚ÄŽÀ‘•‚µ‚Ä‚¢‚Ü‚·BƒXƒŒƒbƒh‚ЂƂ‚ɃXƒ^ƒb
-ƒN‚ЂƂ‚ð•ÛŽ‚µ‚Ü‚·BƒXƒ^ƒbƒN‚̗̈æ‚̓q[ƒv‚©‚çŽæ“¾‚·‚é‚Ì‚ÅA_“î‚ȗ̈æ
-ݒ肪‰Â”\‚Å‚·B
+VM ã¯ã€å˜ç´”ãªã‚¹ã‚¿ãƒƒã‚¯ãƒžã‚·ãƒ³ã¨ã—ã¦å®Ÿè£…ã—ã¦ã„ã¾ã™ã€‚スレッドã²ã¨ã¤ã«ã‚¹ã‚¿ãƒƒ
+クã²ã¨ã¤ã‚’ä¿æŒã—ã¾ã™ã€‚スタックã®é ˜åŸŸã¯ãƒ’ープã‹ã‚‰å–å¾—ã™ã‚‹ã®ã§ã€æŸ”軟ãªé ˜åŸŸ
+設定ãŒå¯èƒ½ã§ã™ã€‚
-** ƒŒƒWƒXƒ^
+** レジスタ
-VM ‚Í 5 ‚‚̉¼‘z“I‚ȃŒƒWƒXƒ^‚É‚æ‚Á‚ħŒä‚³‚ê‚Ü‚·B
+VM 㯠5 ã¤ã®ä»®æƒ³çš„ãªãƒ¬ã‚¸ã‚¹ã‚¿ã«ã‚ˆã£ã¦åˆ¶å¾¡ã•れã¾ã™ã€‚
- PC (Program Counter)
- SP (Stack Pointer)
@@ -136,77 +136,77 @@ VM ‚Í 5 ‚‚̉¼‘z“I‚ȃŒƒWƒXƒ^‚É‚æ‚Á‚ħŒä‚³‚ê‚Ü‚·B
- LFP (Local Frame Pointer)
- DFP (Dynamic Frame Pointer)
-PC ‚ÍŒ»ÝŽÀs’†‚Ì–½—ß—ñ‚̈ʒu‚ðŽ¦‚µ‚Ü‚·BSP ‚̓Xƒ^ƒbƒNƒgƒbƒv‚̈ʒu‚ðŽ¦‚µ
-‚Ü‚·BCFPALFPADFP ‚Í‚»‚ꂼ‚êƒtƒŒ[ƒ€‚Ìî•ñ‚ðŽ¦‚µ‚Ü‚·BÚׂ͌ãq‚µ‚Ü‚·B
+PC ã¯ç¾åœ¨å®Ÿè¡Œä¸­ã®å‘½ä»¤åˆ—ã®ä½ç½®ã‚’示ã—ã¾ã™ã€‚SP ã¯ã‚¹ã‚¿ãƒƒã‚¯ãƒˆãƒƒãƒ—ã®ä½ç½®ã‚’示ã—
+ã¾ã™ã€‚CFPã€LFPã€DFP ã¯ãれãžã‚Œãƒ•ãƒ¬ãƒ¼ãƒ ã®æƒ…報を示ã—ã¾ã™ã€‚詳細ã¯å¾Œè¿°ã—ã¾ã™ã€‚
-** ƒXƒ^ƒbƒNƒtƒŒ[ƒ€
+** スタックフレーム
obsolete (update soon)
-** ƒtƒŒ[ƒ€ƒfƒUƒCƒ“‚ɂ‚¢‚Ă̕⑫
+** フレームデザインã«ã¤ã„ã¦ã®è£œè¶³
-Lisp ‚̈—Œn‚È‚Ç‚ð‚©‚ñ‚ª‚¦‚邯A‚í‚´‚í‚´ƒuƒƒbƒNƒ[ƒJƒ‹ƒtƒŒ[ƒ€‚ƃƒ\
-ƒbƒhƒ[ƒJƒ‹ƒtƒŒ[ƒ€‚̂悤‚È‚à‚Ì‚ð—pˆÓ‚·‚é‚̂͊ïˆÙ‚ÉŒ©‚¦‚é‚©‚à‚µ‚ê‚Ü‚¹‚ñB
-‚ ‚éƒtƒŒ[ƒ€‚ðA“ü‚êŽq\‘¢‚É‚µ‚ÄAƒ[ƒJƒ‹•Ï”‚̃AƒNƒZƒX‚Í‚»‚Ì“ü‚êŽq‚ðŠO
-‘¤‚É’H‚ê‚ΕK‚¸‚½‚ǂ蒅‚­‚±‚Æ‚ª‚Å‚«‚é‚©‚ç‚Å‚·i‚‚܂èAlfp ‚Í•K—v‚È‚¢jB
+Lisp ã®å‡¦ç†ç³»ãªã©ã‚’ã‹ã‚“ãŒãˆã‚‹ã¨ã€ã‚ã–ã‚ã–ブロックローカルフレームã¨ãƒ¡ã‚½
+ッドローカルフレームã®ã‚ˆã†ãªã‚‚ã®ã‚’用æ„ã™ã‚‹ã®ã¯å¥‡ç•°ã«è¦‹ãˆã‚‹ã‹ã‚‚ã—れã¾ã›ã‚“。
+ã‚るフレームをã€å…¥ã‚Œå­æ§‹é€ ã«ã—ã¦ã€ãƒ­ãƒ¼ã‚«ãƒ«å¤‰æ•°ã®ã‚¢ã‚¯ã‚»ã‚¹ã¯ãã®å…¥ã‚Œå­ã‚’外
+å´ã«è¾¿ã‚Œã°å¿…ãšãŸã©ã‚Šç€ãã“ã¨ãŒã§ãã‚‹ã‹ã‚‰ã§ã™ï¼ˆã¤ã¾ã‚Šã€lfp ã¯å¿…è¦ãªã„)。
-‚µ‚©‚µARuby ‚ł͂¢‚­‚‚©ó‹µ‚ªˆá‚¢‚Ü‚·B‚Ü‚¸Aƒƒ\ƒbƒhƒ[ƒJƒ‹‚Èî•ñ‚ª
-‚ ‚邱‚ÆA‹ï‘Ì“I‚ɂ̓uƒƒbƒN‚Æselficallee ‚©‚ç‚Ý‚é‚Æ recieverj‚Å‚·B‚±
-‚Ìî•ñ‚ð‚»‚ê‚¼‚ê‚̃tƒŒ[ƒ€‚É‚à‚½‚¹‚é‚͖̂³‘ʂł·B
+ã—ã‹ã—ã€Ruby ã§ã¯ã„ãã¤ã‹çжæ³ãŒé•ã„ã¾ã™ã€‚ã¾ãšã€ãƒ¡ã‚½ãƒƒãƒ‰ãƒ­ãƒ¼ã‚«ãƒ«ãªæƒ…å ±ãŒ
+ã‚ã‚‹ã“ã¨ã€å…·ä½“çš„ã«ã¯ãƒ–ロックã¨self(callee ã‹ã‚‰ã¿ã‚‹ã¨ reciever)ã§ã™ã€‚ã“
+ã®æƒ…報をãれãžã‚Œã®ãƒ•レームã«ã‚‚ãŸã›ã‚‹ã®ã¯ç„¡é§„ã§ã™ã€‚
-‚Ü‚½ARuby2.0 ‚©‚ç‚̓uƒƒbƒNƒ[ƒJƒ‹•Ï”‚͂Ȃ­‚È‚è‚Ü‚·iƒuƒƒbƒNƒ[ƒJƒ‹
-ˆø”‚ÍŽc‚é‚Ì‚ÅA\‘¢Ž©‘̂͂ ‚Ü‚è•Ï‚í‚è‚Ü‚¹‚ñjB‚»‚Ì‚½‚ßAƒƒ\ƒbƒhƒ[ƒJ
-ƒ‹•Ï”‚ւ̃AƒNƒZƒX‚ª•p”­‚·‚邱‚Æ‚ª—\‘z‚³‚ê‚Ü‚·B
+ã¾ãŸã€Ruby2.0 ã‹ã‚‰ã¯ãƒ–ロックローカル変数ã¯ãªããªã‚Šã¾ã™ï¼ˆãƒ–ロックローカル
+å¼•æ•°ã¯æ®‹ã‚‹ã®ã§ã€æ§‹é€ è‡ªä½“ã¯ã‚ã¾ã‚Šå¤‰ã‚りã¾ã›ã‚“)。ãã®ãŸã‚ã€ãƒ¡ã‚½ãƒƒãƒ‰ãƒ­ãƒ¼ã‚«
+ル変数ã¸ã®ã‚¢ã‚¯ã‚»ã‚¹ãŒé »ç™ºã™ã‚‹ã“ã¨ãŒäºˆæƒ³ã•れã¾ã™ã€‚
-‚±‚̂Ƃ«Aƒƒ\ƒbƒhƒ[ƒJƒ‹•Ï”‚ւ̃AƒNƒZƒX‚Ì‚½‚тɃtƒŒ[ƒ€iƒXƒR[ƒvj‚Ì
-ƒŠƒXƒg‚ð‚½‚Ç‚é‚͖̂³‘ʂł ‚邯”»’f‚µA–¾Ž¦“I‚Ƀƒ\ƒbƒhƒ[ƒJƒ‹ƒXƒR[ƒv‚Æ
-ƒuƒƒbƒNƒtƒŒ[ƒ€‚𕪗£‚µAƒuƒƒbƒNƒtƒŒ[ƒ€‚©‚ç‚̓ƒ\ƒbƒhƒ[ƒJƒ‹ƒtƒŒ[ƒ€
-‚ª lfpƒŒƒWƒXƒ^‚É‚æ‚Á‚Ä—eˆÕ‚ɃAƒNƒZƒX‚Å‚«‚邿‚¤‚É‚µ‚Ü‚µ‚½B
+ã“ã®ã¨ãã€ãƒ¡ã‚½ãƒƒãƒ‰ãƒ­ãƒ¼ã‚«ãƒ«å¤‰æ•°ã¸ã®ã‚¢ã‚¯ã‚»ã‚¹ã®ãŸã³ã«ãƒ•レーム(スコープ)ã®
+リストをãŸã©ã‚‹ã®ã¯ç„¡é§„ã§ã‚ã‚‹ã¨åˆ¤æ–­ã—ã€æ˜Žç¤ºçš„ã«ãƒ¡ã‚½ãƒƒãƒ‰ãƒ­ãƒ¼ã‚«ãƒ«ã‚¹ã‚³ãƒ¼ãƒ—ã¨
+ブロックフレームを分離ã—ã€ãƒ–ロックフレームã‹ã‚‰ã¯ãƒ¡ã‚½ãƒƒãƒ‰ãƒ­ãƒ¼ã‚«ãƒ«ãƒ•レーム
+㌠lfpレジスタã«ã‚ˆã£ã¦å®¹æ˜“ã«ã‚¢ã‚¯ã‚»ã‚¹ã§ãるよã†ã«ã—ã¾ã—ãŸã€‚
-** ƒƒ\ƒbƒhŒÄ‚Ño‚µ‚ɂ‚¢‚Ä
+** メソッド呼ã³å‡ºã—ã«ã¤ã„ã¦
-ƒƒ\ƒbƒhŒÄ‚Ño‚µ‚ÍAYARV –½—ß—ñ‚Å‹Lq‚³‚ꂽƒƒ\ƒbƒh‚©AC ‚Å‹Lq‚³‚ꂽƒ
-ƒ\ƒbƒh‚©‚É‚æ‚Á‚ăfƒBƒXƒpƒbƒ`Žè–@‚ª•Ï‚í‚è‚Ü‚·B
+メソッド呼ã³å‡ºã—ã¯ã€YARV 命令列ã§è¨˜è¿°ã•れãŸãƒ¡ã‚½ãƒƒãƒ‰ã‹ã€C ã§è¨˜è¿°ã•れãŸãƒ¡
+ソッドã‹ã«ã‚ˆã£ã¦ãƒ‡ã‚£ã‚¹ãƒ‘ãƒƒãƒæ‰‹æ³•ãŒå¤‰ã‚りã¾ã™ã€‚
-YARV –½—ß—ñ‚Å‚ ‚Á‚½ê‡Aãq‚µ‚½ƒXƒ^ƒbƒNƒtƒŒ[ƒ€‚ð쬂µ‚Ä–½—ß‚ðŒp‘±‚µ
-‚Ü‚·B‚Æ‚­‚É VM ‚ÌŠÖ”‚ðÄ‹AŒÄ‚Ño‚·‚·‚邱‚Æ‚Ís‚È‚¢‚Ü‚¹‚ñB
+YARV 命令列ã§ã‚ã£ãŸå ´åˆã€ä¸Šè¿°ã—ãŸã‚¹ã‚¿ãƒƒã‚¯ãƒ•レームを作æˆã—ã¦å‘½ä»¤ã‚’継続ã—
+ã¾ã™ã€‚ã¨ãã« VM ã®é–¢æ•°ã‚’å†å¸°å‘¼ã³å‡ºã™ã™ã‚‹ã“ã¨ã¯è¡Œãªã„ã¾ã›ã‚“。
-C ‚Å‹Lq‚³‚ꂽƒƒ\ƒbƒh‚¾‚Á‚½ê‡A’Pƒ‚É‚»‚ÌŠÖ”‚ðŒÄ‚Ño‚µ‚Ü‚·i‚½‚¾‚µA
-ƒoƒbƒNƒgƒŒ[ƒX‚𳂵‚­¶¬‚·‚邽‚߂Ƀƒ\ƒbƒhŒÄ‚Ño‚µ‚Ìî•ñ‚ð•t‰Á‚µ‚Ä‚©‚ç
-s‚È‚¢‚Ü‚·jB
+C ã§è¨˜è¿°ã•れãŸãƒ¡ã‚½ãƒƒãƒ‰ã ã£ãŸå ´åˆã€å˜ç´”ã«ãã®é–¢æ•°ã‚’呼ã³å‡ºã—ã¾ã™ï¼ˆãŸã ã—ã€
+ãƒãƒƒã‚¯ãƒˆãƒ¬ãƒ¼ã‚¹ã‚’æ­£ã—ã生æˆã™ã‚‹ãŸã‚ã«ãƒ¡ã‚½ãƒƒãƒ‰å‘¼ã³å‡ºã—ã®æƒ…報を付加ã—ã¦ã‹ã‚‰
+行ãªã„ã¾ã™ï¼‰ã€‚
-‚±‚Ì‚½‚ßAVM —pƒXƒ^ƒbƒN‚ð•Ê“r—pˆÓ‚µ‚½‚à‚Ì‚ÌAƒvƒƒOƒ‰ƒ€‚É‚æ‚Á‚Ă̓}ƒVƒ“
-ƒXƒ^ƒbƒN‚ðŽg‚¢Ø‚Á‚Ä‚µ‚Ü‚¤‰Â”\«‚ª‚ ‚è‚Ü‚·iC -> Ruby -> C -> ... ‚Æ‚¢‚¤
-ŒÄ‚Ño‚µ‚ª‘±‚¢‚½ê‡jB‚±‚ê‚ÍAŒ»Ý‚Å‚Í”ð‚¯‚ç‚ê‚È‚¢Žd—l‚ƂȂÁ‚Ä‚¢‚Ü‚·B
+ã“ã®ãŸã‚ã€VM 用スタックを別途用æ„ã—ãŸã‚‚ã®ã®ã€ãƒ—ログラムã«ã‚ˆã£ã¦ã¯ãƒžã‚·ãƒ³
+スタックを使ã„切ã£ã¦ã—ã¾ã†å¯èƒ½æ€§ãŒã‚りã¾ã™ï¼ˆC -> Ruby -> C -> ... ã¨ã„ã†
+呼ã³å‡ºã—ãŒç¶šã„ãŸå ´åˆï¼‰ã€‚ã“れã¯ã€ç¾åœ¨ã§ã¯é¿ã‘られãªã„仕様ã¨ãªã£ã¦ã„ã¾ã™ã€‚
-** —áŠO
+** 例外
-—áŠO‚ÍAJava ‚Ì JVM ‚Æ“¯—l‚É—áŠOƒe[ƒuƒ‹‚ð—pˆÓ‚·‚邱‚ƂŎÀŒ»‚µ‚Ü‚·B—áŠO
-‚ª”­¶‚µ‚½‚çA“–ŠYƒtƒŒ[ƒ€‚ðA—áŠOƒe[ƒuƒ‹‚ðŒŸ¸‚µ‚Ü‚·B‚»‚±‚ÅA—áŠO‚ª”­
-¶‚µ‚½‚Æ‚«‚Ì PC ‚Ì’l‚ɇ’v‚·‚éƒGƒ“ƒgƒŠ‚ª‚ ‚Á‚½ê‡A‚»‚̃Gƒ“ƒgƒŠ‚É]‚Á‚Ä
-“®ì‚µ‚Ü‚·B‚à‚µƒGƒ“ƒgƒŠ‚ªŒ©‚‚©‚ç‚È‚©‚Á‚½ê‡AƒXƒ^ƒbƒN‚ðŽT‚«–ß‚µ‚Ă܂½
-“¯—l‚É‚»‚̃XƒR[ƒv‚Ì—áŠOƒe[ƒuƒ‹‚ðŒŸ¸‚µ‚Ü‚·B
+例外ã¯ã€Java ã® JVM ã¨åŒæ§˜ã«ä¾‹å¤–テーブルを用æ„ã™ã‚‹ã“ã¨ã§å®Ÿç¾ã—ã¾ã™ã€‚例外
+ãŒç™ºç”Ÿã—ãŸã‚‰ã€å½“該フレームをã€ä¾‹å¤–テーブルを検査ã—ã¾ã™ã€‚ãã“ã§ã€ä¾‹å¤–ãŒç™º
+生ã—ãŸã¨ãã® PC ã®å€¤ã«åˆè‡´ã™ã‚‹ã‚¨ãƒ³ãƒˆãƒªãŒã‚ã£ãŸå ´åˆã€ãã®ã‚¨ãƒ³ãƒˆãƒªã«å¾“ã£ã¦
+動作ã—ã¾ã™ã€‚ã‚‚ã—エントリãŒè¦‹ã¤ã‹ã‚‰ãªã‹ã£ãŸå ´åˆã€ã‚¹ã‚¿ãƒƒã‚¯ã‚’æ’’ãæˆ»ã—ã¦ã¾ãŸ
+åŒæ§˜ã«ãã®ã‚¹ã‚³ãƒ¼ãƒ—ã®ä¾‹å¤–テーブルを検査ã—ã¾ã™ã€‚
-‚Ü‚½AbreakAreturniƒuƒƒbƒN’†jAretry ‚È‚Ç‚à“¯—l‚ÌŽd‘g‚݂ŎÀŒ»‚µ‚Ü‚·B
+ã¾ãŸã€breakã€return(ブロック中)ã€retry ãªã©ã‚‚åŒæ§˜ã®ä»•組ã¿ã§å®Ÿç¾ã—ã¾ã™ã€‚
-*** —áŠOƒe[ƒuƒ‹
+*** 例外テーブル
-—áŠOƒe[ƒuƒ‹ƒGƒ“ƒgƒŠ‚Í‹ï‘Ì“I‚ɂ͎Ÿ‚Ìî•ñ‚ªŠi”[‚³‚ê‚Ä‚¢‚Ü‚·B
+例外テーブルエントリã¯å…·ä½“çš„ã«ã¯æ¬¡ã®æƒ…å ±ãŒæ ¼ç´ã•れã¦ã„ã¾ã™ã€‚
-- ‘ÎÛ‚Æ‚·‚é PC ‚͈̔Í
-- ‘ÎÛ‚Æ‚·‚é—áŠO‚ÌŽí—Þ
-- ‚à‚µ‘ÎۂƂȂÁ‚½‚Æ‚«‚ɃWƒƒƒ“ƒv‚·‚éæiŽí—Þ‚É‚æ‚éj
-- ‚à‚µ‘ÎۂƂȂÁ‚½‚Æ‚«‚É‹N“®‚·‚éƒuƒƒbƒN‚Ì iseq
+- 対象ã¨ã™ã‚‹ PC ã®ç¯„囲
+- 対象ã¨ã™ã‚‹ä¾‹å¤–ã®ç¨®é¡ž
+- ã‚‚ã—対象ã¨ãªã£ãŸã¨ãã«ã‚¸ãƒ£ãƒ³ãƒ—ã™ã‚‹å…ˆï¼ˆç¨®é¡žã«ã‚ˆã‚‹ï¼‰
+- ã‚‚ã—対象ã¨ãªã£ãŸã¨ãã«èµ·å‹•ã™ã‚‹ãƒ–ロック㮠iseq
*** rescue
-rescue ߂̓uƒƒbƒN‚Æ‚µ‚ÄŽÀŒ»‚µ‚Ä‚¢‚Ü‚·B$! ‚Ì’l‚ð—Bˆê‚̈ø”‚Æ‚µ‚ÄŽ‚¿‚Ü
-‚·B
+rescue 節ã¯ãƒ–ロックã¨ã—ã¦å®Ÿç¾ã—ã¦ã„ã¾ã™ã€‚$! ã®å€¤ã‚’唯一ã®å¼•æ•°ã¨ã—ã¦æŒã¡ã¾
+ã™ã€‚
#code
begin
@@ -216,7 +216,7 @@ rescue C
end
#end
-‚ÍAŽŸ‚̂悤‚È Ruby ƒXƒNƒŠƒvƒg‚ɕϊ·‚³‚ê‚Ü‚·B
+ã¯ã€æ¬¡ã®ã‚ˆã†ãª Ruby スクリプトã«å¤‰æ›ã•れã¾ã™ã€‚
#code
{|err|
@@ -225,7 +225,7 @@ end
when B === err
when C === err
else
- raise # yarv ‚Ì–½—ß‚Å‚Í throw
+ raise # yarv ã®å‘½ä»¤ã§ã¯ throw
end
}
#end
@@ -233,32 +233,32 @@ end
*** ensure
-³íŒni—áŠO‚ª”­¶‚µ‚È‚©‚Á‚½ê‡j‚ƈÙíŒni—áŠO‚ª”­¶‚µ‚½‚Æ‚«‚È‚Çj‚Ì2
-Ží—Þ‚Ì–½—ß—ñ‚ª¶¬‚³‚ê‚Ü‚·B³íŒn‚Å‚ÍA‚½‚¾‚̘A‘±‚µ‚½ƒR[ƒh—Ìˆæ‚Æ‚µ‚ăR
-ƒ“ƒpƒCƒ‹‚³‚ê‚Ü‚·B‚Ü‚½AˆÙíŒn‚ł̓uƒƒbƒN‚Æ‚µ‚ÄŽÀ‘•‚µ‚Ü‚·BÅŒã‚Í•K‚¸
-throw –½—߂Œ÷‚߂邱‚ƂɂȂè‚Ü‚·B
+正常系(例外ãŒç™ºç”Ÿã—ãªã‹ã£ãŸå ´åˆï¼‰ã¨ç•°å¸¸ç³»ï¼ˆä¾‹å¤–ãŒç™ºç”Ÿã—ãŸã¨ããªã©ï¼‰ã®2
+種類ã®å‘½ä»¤åˆ—ãŒç”Ÿæˆã•れã¾ã™ã€‚正常系ã§ã¯ã€ãŸã ã®é€£ç¶šã—ãŸã‚³ãƒ¼ãƒ‰é ˜åŸŸã¨ã—ã¦ã‚³
+ンパイルã•れã¾ã™ã€‚ã¾ãŸã€ç•°å¸¸ç³»ã§ã¯ãƒ–ロックã¨ã—ã¦å®Ÿè£…ã—ã¾ã™ã€‚最後ã¯å¿…ãš
+throw 命令ã§ç· ã‚ã‚‹ã“ã¨ã«ãªã‚Šã¾ã™ã€‚
-*** break, returniƒuƒƒbƒN’†jAretry
+*** break, return(ブロック中)ã€retry
-break •¶AƒuƒƒbƒN’†‚Ì return •¶Aretry •¶‚Í throw –½—߂Ƃµ‚ăRƒ“ƒpƒCƒ‹
-‚³‚ê‚Ü‚·B‚Ç‚±‚܂Ŗ߂邩‚ÍAbreak ‚ðƒtƒbƒN‚·‚é—áŠOƒe[ƒuƒ‹‚̃Gƒ“ƒgƒŠ‚ª”»
-’f‚µ‚Ü‚·B
+break æ–‡ã€ãƒ–ロック中㮠return æ–‡ã€retry 文㯠throw 命令ã¨ã—ã¦ã‚³ãƒ³ãƒ‘イル
+ã•れã¾ã™ã€‚ã©ã“ã¾ã§æˆ»ã‚‹ã‹ã¯ã€break をフックã™ã‚‹ä¾‹å¤–テーブルã®ã‚¨ãƒ³ãƒˆãƒªãŒåˆ¤
+æ–­ã—ã¾ã™ã€‚
-** ’蔂̌Ÿõ
+** å®šæ•°ã®æ¤œç´¢
-’蔂Ƃ¢‚¤–¼‘O‚Ȃ̂ÉARuby ‚ł̓Rƒ“ƒpƒCƒ‹Žž‚ÉŒˆ’肵‚Ü‚¹‚ñB‚Æ‚¢‚¤‚©A‚¢
-‚‚܂łàÄ’è‹`‰Â”\‚ɂȂÁ‚Ä‚¢‚Ü‚·B
+定数ã¨ã„ã†åå‰ãªã®ã«ã€Ruby ã§ã¯ã‚³ãƒ³ãƒ‘ã‚¤ãƒ«æ™‚ã«æ±ºå®šã—ã¾ã›ã‚“。ã¨ã„ã†ã‹ã€ã„
+ã¤ã¾ã§ã‚‚å†å®šç¾©å¯èƒ½ã«ãªã£ã¦ã„ã¾ã™ã€‚
-’蔃AƒNƒZƒX‚Ì‚½‚ß‚ÌRuby‹Lq‚ÍŽŸ‚̂悤‚ɂȂè‚Ü‚·B
+定数アクセスã®ãŸã‚ã®Rubyè¨˜è¿°ã¯æ¬¡ã®ã‚ˆã†ã«ãªã‚Šã¾ã™ã€‚
#code
-Ruby•\Œ»:
+Ruby表ç¾:
expr::ID::...::ID
#end
-‚±‚ê‚ÍAyarv–½—߃Zƒbƒg‚ł͎Ÿ‚̂悤‚ɂȂè‚Ü‚·B
+ã“れã¯ã€yarv命令セットã§ã¯æ¬¡ã®ã‚ˆã†ã«ãªã‚Šã¾ã™ã€‚
#code
(expr)
@@ -268,161 +268,161 @@ getconstant ID
#end
-*** ’蔌ŸõƒpƒX
+*** 定数検索パス
-‚à‚µ expr ‚ª nil ‚¾‚Á‚½ê‡A’蔌ŸõƒpƒX‚É]‚Á‚Ē蔂ðŒŸõ‚µ‚Ü‚·B‚±‚Ì
-‹““®‚Í¡Œã Ruby 2.0 ‚ÉŒü‚¯‚Ä•ÏX‚³‚ê‚éꇂª‚ ‚è‚Ü‚·B
+ã‚‚ã— expr ㌠nil ã ã£ãŸå ´åˆã€å®šæ•°æ¤œç´¢ãƒ‘スã«å¾“ã£ã¦å®šæ•°ã‚’検索ã—ã¾ã™ã€‚ã“ã®
+挙動ã¯ä»Šå¾Œ Ruby 2.0 ã«å‘ã‘ã¦å¤‰æ›´ã•れる場åˆãŒã‚りã¾ã™ã€‚
-+ ƒNƒ‰ƒXAƒ‚ƒWƒ…[ƒ‹‚Ì“®“IƒlƒXƒgŠÖŒWiƒvƒƒOƒ‰ƒ€‚ÌŽš–Êãj‚ðƒ‹[ƒg‚܂ŒH‚é
-+ Œp³ŠÖŒW‚ðƒ‹[ƒgiObjectj‚܂ŒH‚é
++ クラスã€ãƒ¢ã‚¸ãƒ¥ãƒ¼ãƒ«ã®å‹•çš„ãƒã‚¹ãƒˆé–¢ä¿‚(プログラムã®å­—é¢ä¸Šï¼‰ã‚’ルートã¾ã§è¾¿ã‚‹
++ 継承関係をルート(Object)ã¾ã§è¾¿ã‚‹
-‚±‚Ì‚½‚ßAƒNƒ‰ƒXAƒ‚ƒWƒ…[ƒ‹‚Ì“®“IƒlƒXƒgŠÖŒW‚ð•Û‘¶‚µ‚È‚¯‚ê‚΂Ȃè‚Ü‚¹‚ñB
-‚±‚Ì‚½‚ß‚ÉAthread_object ‚É‚Í klass_nest_stack ‚Æ‚¢‚¤‚à‚Ì‚ð—pˆÓ‚µ‚Ü‚µ‚½B
-‚±‚ê‚ÍAŒ»Ý‚̃lƒXƒg‚Ìî•ñ‚ð•Û‘¶‚µ‚Ü‚·B
+ã“ã®ãŸã‚ã€ã‚¯ãƒ©ã‚¹ã€ãƒ¢ã‚¸ãƒ¥ãƒ¼ãƒ«ã®å‹•çš„ãƒã‚¹ãƒˆé–¢ä¿‚ã‚’ä¿å­˜ã—ãªã‘れã°ãªã‚Šã¾ã›ã‚“。
+ã“ã®ãŸã‚ã«ã€thread_object ã«ã¯ klass_nest_stack ã¨ã„ã†ã‚‚ã®ã‚’用æ„ã—ã¾ã—ãŸã€‚
+ã“れã¯ã€ç¾åœ¨ã®ãƒã‚¹ãƒˆã®æƒ…報をä¿å­˜ã—ã¾ã™ã€‚
-ƒƒ\ƒbƒh’è‹`ŽžA‚»‚ÌŒ»Ý‚̃lƒXƒgî•ñ‚ðƒƒ\ƒbƒh’è‹`Žž‚Éidup‚µ‚Äj‰Á‚¦‚é
-‚±‚Æ‚ÅA‚»‚̃ƒ\ƒbƒh‚ÌŽÀsŽžA‚»‚̃lƒXƒgî•ñ‚ðŽQÆ‚·‚邱‚Æ‚ª‰Â”\‚ɂȂè‚Ü
-‚·B
+メソッド定義時ã€ãã®ç¾åœ¨ã®ãƒã‚¹ãƒˆæƒ…報をメソッド定義時ã«ï¼ˆdupã—ã¦ï¼‰åŠ ãˆã‚‹
+ã“ã¨ã§ã€ãã®ãƒ¡ã‚½ãƒƒãƒ‰ã®å®Ÿè¡Œæ™‚ã€ãã®ãƒã‚¹ãƒˆæƒ…報をå‚ç…§ã™ã‚‹ã“ã¨ãŒå¯èƒ½ã«ãªã‚Šã¾
+ã™ã€‚
-ƒgƒbƒvƒŒƒxƒ‹‚Å‚ÍA‚»‚Ìî•ñ‚͂Ȃ¢‚±‚ƂɂȂè‚Ü‚·B
+トップレベルã§ã¯ã€ãã®æƒ…å ±ã¯ãªã„ã“ã¨ã«ãªã‚Šã¾ã™ã€‚
-ƒNƒ‰ƒX/ƒ‚ƒWƒ…[ƒ‹’è‹`•¶ŽÀsŽž‚ÍAŒ»Ý‚Ìî•ñ‚»‚Ì‚à‚Ì‚ðŽQÆ‚·‚邱‚ƂɂȂè
-‚Ü‚·B‚±‚ê‚ÍAƒNƒ‰ƒXƒXƒR[ƒv“Ë“üŽžA‚»‚Ìî•ñ‚ðƒNƒ‰ƒX’è‹`•¶‚ɃRƒs[‚µ‚Ü‚·
-i‚·‚łɃRƒs[‚³‚ê‚Ä‚¢‚ê‚ÎA‚±‚ê‚ðs‚¢‚Ü‚¹‚ñjB
+クラス/モジュール定義文実行時ã¯ã€ç¾åœ¨ã®æƒ…å ±ãã®ã‚‚ã®ã‚’å‚ç…§ã™ã‚‹ã“ã¨ã«ãªã‚Š
+ã¾ã™ã€‚ã“れã¯ã€ã‚¯ãƒ©ã‚¹ã‚¹ã‚³ãƒ¼ãƒ—çªå…¥æ™‚ã€ãã®æƒ…報をクラス定義文ã«ã‚³ãƒ”ーã—ã¾ã™
+(ã™ã§ã«ã‚³ãƒ”ーã•れã¦ã„れã°ã€ã“れを行ã„ã¾ã›ã‚“)。
-‚±‚ê‚É‚æ‚èA“®“I‚ȃlƒXƒgî•ñ‚ð“ˆê“I‚Ɉµ‚¤‚±‚Æ‚ª‚Å‚«‚Ü‚·B
+ã“れã«ã‚ˆã‚Šã€å‹•çš„ãªãƒã‚¹ãƒˆæƒ…å ±ã‚’çµ±ä¸€çš„ã«æ‰±ã†ã“ã¨ãŒã§ãã¾ã™ã€‚
-** Å“K‰»Žè–@
+** 最é©åŒ–手法
-YARV ‚ł͂‘¬‰»‚ð–Ú“I‚Æ‚µ‚Ä‚¢‚é‚Ì‚ÅA‚³‚Ü‚´‚Ü‚ÈÅ“K‰»Žè–@‚ð—˜—p‚µ‚Ä‚¢‚Ü
-‚·BÚׂ͊„ˆ¤‚µ‚Ü‚·‚ªAˆÈ‰º‚Éq‚ׂéÅ“K‰»‚Ȃǂðs‚È‚Á‚Ä‚¨‚è‚Ü‚·B
+YARV ã§ã¯é«˜é€ŸåŒ–を目的ã¨ã—ã¦ã„ã‚‹ã®ã§ã€ã•ã¾ã–ã¾ãªæœ€é©åŒ–手法を利用ã—ã¦ã„ã¾
+ã™ã€‚詳細ã¯å‰²æ„›ã—ã¾ã™ãŒã€ä»¥ä¸‹ã«è¿°ã¹ã‚‹æœ€é©åŒ–ãªã©ã‚’行ãªã£ã¦ãŠã‚Šã¾ã™ã€‚
*** threaded code
-GCC ‚Ì C Œ¾ŒêŠg’£‚Å‚ ‚é’l‚Æ‚µ‚Ẵ‰ƒxƒ‹‚ð—˜—p‚µ‚Ä direct threaded code
-‚ðŽÀŒ»‚µ‚Ä‚¢‚Ü‚·B
+GCC ã® C 言語拡張ã§ã‚る値ã¨ã—ã¦ã®ãƒ©ãƒ™ãƒ«ã‚’利用ã—㦠direct threaded code
+を実ç¾ã—ã¦ã„ã¾ã™ã€‚
*** Peephole optimization
-‚¢‚­‚‚©‚ÌŠÈ’P‚ÈÅ“K‰»‚ð‚µ‚Ä‚¢‚Ü‚·B
+ã„ãã¤ã‹ã®ç°¡å˜ãªæœ€é©åŒ–ã‚’ã—ã¦ã„ã¾ã™ã€‚
*** inline method cache
-–½—ß—ñ‚Ì’†‚Ƀƒ\ƒbƒhŒŸõŒ‹‰Ê‚ð–„‚ßž‚݂܂·B
+命令列ã®ä¸­ã«ãƒ¡ã‚½ãƒƒãƒ‰æ¤œç´¢çµæžœã‚’埋ã‚è¾¼ã¿ã¾ã™ã€‚
*** inline constant cache
-–½—ß—ñ‚Ì’†‚ɒ蔌ŸõŒ‹‰Ê‚ð–„‚ßž‚݂܂·B
+命令列ã®ä¸­ã«å®šæ•°æ¤œç´¢çµæžœã‚’埋ã‚è¾¼ã¿ã¾ã™ã€‚
-*** ƒuƒƒbƒN‚Æ Proc ƒIƒuƒWƒFƒNƒg‚Ì•ª—£
+*** ブロック㨠Proc オブジェクトã®åˆ†é›¢
-ƒuƒƒbƒN•t‚«ƒƒ\ƒbƒhŒÄ‚Ño‚µ‚ªs‚È‚í‚ꂽ‚Æ‚«‚ɂ͂·‚®‚ɂ̓uƒƒbƒN‚ð Proc
-ƒIƒuƒWƒFƒNƒg‚Æ‚µ‚ͬ‚µ‚Ü‚¹‚ñB‚±‚ê‚É‚æ‚èA•K—v‚È‚¢ Proc ƒIƒuƒWƒFƒNƒg‚Ì
-¶¬‚ð—}‚¦‚Ä‚¢‚Ü‚·B
+ブロック付ãメソッド呼ã³å‡ºã—ãŒè¡Œãªã‚れãŸã¨ãã«ã¯ã™ãã«ã¯ãƒ–ロックを Proc
+オブジェクトã¨ã—ã¦ç”Ÿæˆã—ã¾ã›ã‚“。ã“れã«ã‚ˆã‚Šã€å¿…è¦ãªã„ Proc オブジェクトã®
+生æˆã‚’抑ãˆã¦ã„ã¾ã™ã€‚
-Proc ƒƒ\ƒbƒh‚ÍAŽÀÛ‚É•K—v‚ɂȂÁ‚½Žž“_‚Åì‚ç‚êA‚»‚̂Ƃ«‚Ɋ‹«iƒXƒR[
-ƒvã‚ÉŠm•Û‚³‚ꂽ•Ï”‚È‚Çj‚ðƒq[ƒv‚ɕۑ¶‚µ‚Ü‚·B
+Proc メソッドã¯ã€å®Ÿéš›ã«å¿…è¦ã«ãªã£ãŸæ™‚点ã§ä½œã‚‰ã‚Œã€ãã®ã¨ãã«ç’°å¢ƒï¼ˆã‚¹ã‚³ãƒ¼
+プ上ã«ç¢ºä¿ã•れãŸå¤‰æ•°ãªã©ï¼‰ã‚’ヒープã«ä¿å­˜ã—ã¾ã™ã€‚
-*** “Á‰»–½—ß
+*** 特化命令
-Fixnum “¯Žm‚̉ÁŽZ‚Ȃǂ𳒼‚ÉŠÖ”ŒÄ‚Ño‚µ‚É‚æ‚Á‚Äs‚È‚¤‚ÆAƒRƒXƒg‚ª‚©‚©
-‚é‚Ì‚ÅA‚±‚ê‚ç‚̃vƒŠƒ~ƒeƒBƒu‚È‘€ì‚ðs‚È‚¤‚½‚߂̃ƒ\ƒbƒhŒÄ‚Ño‚µ‚Íê—p–½
-—ß‚ð—pˆÓ‚µ‚Ü‚µ‚½B
+Fixnum åŒå£«ã®åŠ ç®—ãªã©ã‚’正直ã«é–¢æ•°å‘¼ã³å‡ºã—ã«ã‚ˆã£ã¦è¡Œãªã†ã¨ã€ã‚³ã‚¹ãƒˆãŒã‹ã‹
+ã‚‹ã®ã§ã€ã“れらã®ãƒ—ãƒªãƒŸãƒ†ã‚£ãƒ–ãªæ“作を行ãªã†ãŸã‚ã®ãƒ¡ã‚½ãƒƒãƒ‰å‘¼ã³å‡ºã—ã¯å°‚用命
+令を用æ„ã—ã¾ã—ãŸã€‚
-*** –½—ß—Z‡
+*** 命令èžåˆ
-•¡”‚Ì–½—ß‚ð 1 –½—߂ɕϊ·‚µ‚Ü‚·B—Z‡–½—ß‚Í opt_insn_unif.def ‚Ì‹Lq‚É‚æ
-‚莩“®“I‚ɶ¬‚³‚ê‚Ü‚·B
+複数ã®å‘½ä»¤ã‚’ 1 命令ã«å¤‰æ›ã—ã¾ã™ã€‚èžåˆå‘½ä»¤ã¯ opt_insn_unif.def ã®è¨˜è¿°ã«ã‚ˆ
+り自動的ã«ç”Ÿæˆã•れã¾ã™ã€‚
-*** ƒIƒyƒ‰ƒ“ƒh—Z‡
+*** オペランドèžåˆ
-•¡”‚̃Iƒyƒ‰ƒ“ƒh‚ðŠÜ‚ß‚½–½—߂𶬂µ‚Ü‚·B—Z‡–½—ß‚Í opt_operand.def ‚Ì
-‹Lq‚É‚æ‚Á‚ÄŽ©“®“I‚ɶ¬‚³‚ê‚Ü‚·B
+複数ã®ã‚ªãƒšãƒ©ãƒ³ãƒ‰ã‚’å«ã‚ãŸå‘½ä»¤ã‚’生æˆã—ã¾ã™ã€‚èžåˆå‘½ä»¤ã¯ opt_operand.def ã®
+記述ã«ã‚ˆã£ã¦è‡ªå‹•çš„ã«ç”Ÿæˆã•れã¾ã™ã€‚
*** stack caching
-ƒXƒ^ƒbƒNƒgƒbƒv‚ð‰¼‘zƒŒƒWƒXƒ^‚ɕێ‚·‚邿‚¤‚É‚µ‚Ü‚·BŒ»Ý‚Í 2 ŒÂ‚̉¼‘zƒŒ
-ƒWƒXƒ^‚ð‘z’肵A5ó‘Ԃ̃Xƒ^ƒbƒNƒLƒƒƒbƒVƒ“ƒO‚ðs‚È‚¢‚Ü‚·BƒXƒ^ƒbƒNƒLƒƒƒb
-ƒVƒ“ƒO‚·‚é–½—߂͎©“®“I‚ɶ¬‚³‚ê‚Ü‚·B
+スタックトップを仮想レジスタã«ä¿æŒã™ã‚‹ã‚ˆã†ã«ã—ã¾ã™ã€‚ç¾åœ¨ã¯ 2 個ã®ä»®æƒ³ãƒ¬
+ジスタを想定ã—ã€5状態ã®ã‚¹ã‚¿ãƒƒã‚¯ã‚­ãƒ£ãƒƒã‚·ãƒ³ã‚°ã‚’行ãªã„ã¾ã™ã€‚スタックキャッ
+シングã™ã‚‹å‘½ä»¤ã¯è‡ªå‹•çš„ã«ç”Ÿæˆã•れã¾ã™ã€‚
*** JIT Compile
-‹@ŠBŒê‚ðØ‚è“\‚肵‚Ü‚·B”ñí‚ÉŽÀŒ±“I‚ȃR[ƒh‚à‚Ì‚µ‚©ì‚Á‚Ä‚¨‚è‚Ü‚¹‚ñB‚Ù
-‚Æ‚ñ‚ǂ̃vƒƒOƒ‰ƒ€‚Í“®‚«‚Ü‚¹‚ñB
+機械語を切り貼りã—ã¾ã™ã€‚éžå¸¸ã«å®Ÿé¨“çš„ãªã‚³ãƒ¼ãƒ‰ã‚‚ã®ã—ã‹ä½œã£ã¦ãŠã‚Šã¾ã›ã‚“。ã»
+ã¨ã‚“ã©ã®ãƒ—ログラムã¯å‹•ãã¾ã›ã‚“。
*** AOT Compile
-YARV –½—ß—ñ‚ð C Œ¾Œê‚ɕϊ·‚µ‚Ü‚·B‚Ü‚¾\•ª‚ÈÅ“K‰»‚ðs‚È‚¦‚Ä‚¨‚è‚Ü‚¹‚ñ‚ªA
-‚»‚ê‚È‚è‚É“®‚«‚Ü‚·Brb/aotc.rb ‚ªƒRƒ“ƒpƒCƒ‰‚Å‚·B
+YARV 命令列を C 言語ã«å¤‰æ›ã—ã¾ã™ã€‚ã¾ã ååˆ†ãªæœ€é©åŒ–を行ãªãˆã¦ãŠã‚Šã¾ã›ã‚“ãŒã€
+ãれãªã‚Šã«å‹•ãã¾ã™ã€‚rb/aotc.rb ãŒã‚³ãƒ³ãƒ‘イラã§ã™ã€‚
* Assembler (rb/yasm.rb)
-YARV –½—ß—ñ‚̃AƒZƒ“ƒuƒ‰‚ð—pˆÓ‚µ‚Ü‚µ‚½BŽg‚¢•û‚Í rb/yasm.rb ‚ðŽQÆ‚µ‚Ä‚­
-‚¾‚³‚¢i‚Ü‚¾A—Ꭶ‚µ‚Ä‚ ‚鶬Žè–@‚Ì‚·‚ׂĂðƒTƒ|[ƒg‚µ‚Ä‚¢‚é‚킯‚ł͂ ‚è
-‚Ü‚¹‚ñjB
+YARV 命令列ã®ã‚¢ã‚»ãƒ³ãƒ–ラを用æ„ã—ã¾ã—ãŸã€‚ä½¿ã„æ–¹ã¯ rb/yasm.rb ã‚’å‚ç…§ã—ã¦ã
+ã ã•ã„(ã¾ã ã€ä¾‹ç¤ºã—ã¦ã‚ã‚‹ç”Ÿæˆæ‰‹æ³•ã®ã™ã¹ã¦ã‚’サãƒãƒ¼ãƒˆã—ã¦ã„ã‚‹ã‚ã‘ã§ã¯ã‚り
+ã¾ã›ã‚“)。
* Dis-Assembler (disasm.c)
-YARV –½—ß—ñ‚ðŽ¦‚·ƒIƒuƒWƒFƒNƒg YARVCore::InstructionSequence ‚É‚Í disasm
-ƒƒ\ƒbƒh‚ª‚ ‚è‚Ü‚·B‚±‚ê‚ÍA–½—ß—ñ‚ð‹tƒAƒZƒ“ƒuƒ‹‚µ‚½•¶Žš—ñ‚ð•Ô‚µ‚Ü‚·B
+YARV 命令列を示ã™ã‚ªãƒ–ジェクト YARVCore::InstructionSequence ã«ã¯ disasm
+メソッドãŒã‚りã¾ã™ã€‚ã“れã¯ã€å‘½ä»¤åˆ—を逆アセンブルã—ãŸæ–‡å­—列を返ã—ã¾ã™ã€‚
-* YARV –½—߃Zƒbƒg
+* YARV 命令セット
<%= d %>
-* ‚»‚Ì‘¼
+* ãã®ä»–
-** ƒeƒXƒg
+** テスト
-test/test_* ‚ªƒeƒXƒgƒP[ƒX‚Å‚·Bˆê‰žAƒ~ƒX‚È‚­“®‚­‚Í‚¸‚Å‚·B‹t‚É‚¢‚¤‚ÆA
-‚±‚̃eƒXƒg‚É‹Lq‚³‚ê‚Ä‚¢‚é—Ⴓ͂«‚¿‚ñ‚Æ“®ì‚·‚邯‚¢‚¤‚±‚Ƃł·B
+test/test_* ãŒãƒ†ã‚¹ãƒˆã‚±ãƒ¼ã‚¹ã§ã™ã€‚一応ã€ãƒŸã‚¹ãªãå‹•ãã¯ãšã§ã™ã€‚逆ã«ã„ã†ã¨ã€
+ã“ã®ãƒ†ã‚¹ãƒˆã«è¨˜è¿°ã•れã¦ã„る例ã§ã¯ãã¡ã‚“ã¨å‹•作ã™ã‚‹ã¨ã„ã†ã“ã¨ã§ã™ã€‚
-** ƒxƒ“ƒ`ƒ}[ƒN
+** ベンãƒãƒžãƒ¼ã‚¯
-benchmark/bm_* ‚Ƀxƒ“ƒ`ƒ}[ƒNƒvƒƒOƒ‰ƒ€‚ª‚¨‚¢‚Ä‚ ‚è‚Ü‚·B
+benchmark/bm_* ã«ãƒ™ãƒ³ãƒãƒžãƒ¼ã‚¯ãƒ—ログラムãŒãŠã„ã¦ã‚りã¾ã™ã€‚
-** ¡Œã‚Ì—\’è
+** 今後ã®äºˆå®š
-‚Ü‚¾‚Ü‚¾‚â‚ç‚È‚¯‚ê‚΂¢‚¯‚È‚¢‚±‚ÆA–¢ŽÀ‘••”•ª‚ª‚½‚­‚³‚ñ‚ ‚è‚Ü‚·‚ñ‚Å‚â‚Á‚Ä
-‚¢‚©‚È‚¯‚ê‚΂Ȃè‚Ü‚¹‚ñBˆê”Ô‘å‚«‚È–Ú•W‚Í eval.c ‚ð’u‚«Š·‚¦‚邱‚Ƃłµ‚傤
-‚©B
+ã¾ã ã¾ã ã‚„らãªã‘れã°ã„ã‘ãªã„ã“ã¨ã€æœªå®Ÿè£…部分ãŒãŸãã•ã‚“ã‚りã¾ã™ã‚“ã§ã‚„ã£ã¦
+ã„ã‹ãªã‘れã°ãªã‚Šã¾ã›ã‚“。一番大ããªç›®æ¨™ã¯ eval.c ã‚’ç½®ãæ›ãˆã‚‹ã“ã¨ã§ã—ょã†
+ã‹ã€‚
*** Verifier
-YARV –½—ß—ñ‚ÍAƒ~ƒX‚ª‚ ‚Á‚Ä‚à“®‚©‚µ‚Ä‚µ‚Ü‚¤‚½‚ߊ댯‚Å‚ ‚é‰Â”\«‚ª‚ ‚è‚Ü
-‚·B‚»‚Ì‚½‚ßAƒXƒ^ƒbƒN‚Ì—˜—pó‘Ô‚ð‚«‚¿‚ñ‚ÆŽ–‘O‚ÉŒŸØ‚·‚邿‚¤‚ȃxƒŠƒtƒ@ƒC
-ƒA‚ð—pˆÓ‚µ‚È‚¯‚ê‚΂Ȃç‚È‚¢‚Æl‚¦‚Ä‚¢‚Ü‚·B
+YARV 命令列ã¯ã€ãƒŸã‚¹ãŒã‚ã£ã¦ã‚‚å‹•ã‹ã—ã¦ã—ã¾ã†ãŸã‚å±é™ºã§ã‚ã‚‹å¯èƒ½æ€§ãŒã‚りã¾
+ã™ã€‚ãã®ãŸã‚ã€ã‚¹ã‚¿ãƒƒã‚¯ã®åˆ©ç”¨çŠ¶æ…‹ã‚’ãã¡ã‚“ã¨äº‹å‰ã«æ¤œè¨¼ã™ã‚‹ã‚ˆã†ãªãƒ™ãƒªãƒ•ァイ
+アを用æ„ã—ãªã‘れã°ãªã‚‰ãªã„ã¨è€ƒãˆã¦ã„ã¾ã™ã€‚
-*** Compiled File ‚Ì\‘z
+*** Compiled File ã®æ§‹æƒ³
-Ruby ƒvƒƒOƒ‰ƒ€‚ð‚±‚Ì–½—߃Zƒbƒg‚ɃVƒŠƒAƒ‰ƒCƒY‚µ‚½ƒf[ƒ^\‘¢‚ðƒtƒ@ƒCƒ‹‚É
-o—͂ł«‚邿‚¤‚É‚µ‚½‚¢‚Æl‚¦‚Ä‚¢‚Ü‚·B‚±‚ê‚ð—˜—p‚µ‚Ĉê“xƒRƒ“ƒpƒCƒ‹‚µ‚½–½
-—ß—ñ‚ðƒtƒ@ƒCƒ‹‚ɕۑ¶‚µ‚Ä‚¨‚¯‚ÎAŽŸ‰ñƒ[ƒhŽž‚ɂ̓Rƒ“ƒpƒCƒ‹‚ÌŽèŠÔAƒRƒXƒg
-‚ðÈ‚­‚±‚Æ‚ª‚Å‚«‚Ü‚·B
+Ruby プログラムをã“ã®å‘½ä»¤ã‚»ãƒƒãƒˆã«ã‚·ãƒªã‚¢ãƒ©ã‚¤ã‚ºã—ãŸãƒ‡ãƒ¼ã‚¿æ§‹é€ ã‚’ファイルã«
+出力ã§ãるよã†ã«ã—ãŸã„ã¨è€ƒãˆã¦ã„ã¾ã™ã€‚ã“れを利用ã—ã¦ä¸€åº¦ã‚³ãƒ³ãƒ‘イルã—ãŸå‘½
+令列をファイルã«ä¿å­˜ã—ã¦ãŠã‘ã°ã€æ¬¡å›žãƒ­ãƒ¼ãƒ‰æ™‚ã«ã¯ã‚³ãƒ³ãƒ‘ã‚¤ãƒ«ã®æ‰‹é–“ã€ã‚³ã‚¹ãƒˆ
+ã‚’çœãã“ã¨ãŒã§ãã¾ã™ã€‚
-**** ‘S‘Ì\¬
+**** 全体構æˆ
-ŽŸ‚̂悤‚ȃtƒ@ƒCƒ‹\¬‚ðl‚¦‚Ä‚¢‚Ü‚·‚ªA‚Ü‚¾–¢’è‚Å‚·B
+次ã®ã‚ˆã†ãªãƒ•ァイル構æˆã‚’考ãˆã¦ã„ã¾ã™ãŒã€ã¾ã æœªå®šã§ã™ã€‚
#code
u4 : 4 byte unsigned storage
@@ -450,5 +450,5 @@ CompiledFile{
}
#end
-Java classfile ‚̃pƒNƒŠB
+Java classfile ã®ãƒ‘クリ。
diff --git a/test/-ext-/bignum/test_big2str.rb b/test/-ext-/bignum/test_big2str.rb
new file mode 100644
index 0000000000..f03d2328a1
--- /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_BDIGITS = Bignum::SIZEOF_BDIGITS
+ 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..882d2d164f
--- /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_BDIGITS = Bignum::SIZEOF_BDIGITS
+ 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..7841dfffb2
--- /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_BDIGITS = Bignum::SIZEOF_BDIGITS
+ 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..0614e1046c
--- /dev/null
+++ b/test/-ext-/bignum/test_pack.rb
@@ -0,0 +1,374 @@
+# 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))
+ }
+ }
+
+ 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..f77641b350
--- /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_BDIGITS = Bignum::SIZEOF_BDIGITS
+ 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..01f8fdc933
--- /dev/null
+++ b/test/-ext-/bug_reporter/test_bug_reporter.rb
@@ -0,0 +1,9 @@
+require 'test/unit'
+require_relative "../../ruby/envutil"
+
+class TestBugReporter < Test::Unit::TestCase
+ def test_bug_reporter_add
+ expected_stderr = /Sample bug reporter: 12345/
+ assert_in_out_err(["--disable-gems", "-r-test-/bug_reporter/bug_reporter", "-e", "register_sample_bug_reporter(12345); Process.kill :SEGV, $$"], "", [], expected_stderr, nil)
+ end
+end
diff --git a/test/-ext-/class/test_class2name.rb b/test/-ext-/class/test_class2name.rb
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
new file mode 100644
index 0000000000..ec506e0ca5
--- /dev/null
+++ b/test/-ext-/debug/test_debug.rb
@@ -0,0 +1,58 @@
+require 'test/unit'
+require '-test-/debug'
+
+class TestDebug < Test::Unit::TestCase
+
+ def binds_check(binds, msg = nil)
+ count = Hash.new(0)
+ 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, msg)
+ count[:bind] += 1
+ end
+
+ if klass
+ 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, msg)
+
+ # check same location
+ 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, msg)
+
+ }
+ 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
+ binds = Bug::Debug.inspector
+ binds_check binds
+ end
+
+ def inspector_in_eval
+ eval("Bug::Debug.inspector")
+ end
+
+ def test_inspector_open_in_eval
+ bug7635 = '[ruby-core:51640]'
+ binds = inspector_in_eval
+ 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_enc_raise.rb b/test/-ext-/exception/test_enc_raise.rb
new file mode 100644
index 0000000000..a578b167ea
--- /dev/null
+++ b/test/-ext-/exception/test_enc_raise.rb
@@ -0,0 +1,15 @@
+require 'test/unit'
+require '-test-/exception'
+
+module Bug
+ class TestException < Test::Unit::TestCase
+ def test_enc_raise
+ feature5650 = '[ruby-core:41160]'
+ Encoding.list.each do |enc|
+ next unless enc.ascii_compatible?
+ e = assert_raise(Bug::Exception) {Bug::Exception.enc_raise(enc, "[Feature #5650]")}
+ assert_equal(enc, e.message.encoding, feature5650)
+ end
+ end
+ end
+end
diff --git a/test/-ext-/exception/test_ensured.rb b/test/-ext-/exception/test_ensured.rb
new file mode 100644
index 0000000000..103250c678
--- /dev/null
+++ b/test/-ext-/exception/test_ensured.rb
@@ -0,0 +1,32 @@
+require 'test/unit'
+require_relative '../../ruby/envutil'
+
+module Bug
+ class Bug7802 < RuntimeError
+ end
+
+ class TestException < Test::Unit::TestCase
+ def test_ensured
+ assert_separately([], <<-'end;') # do
+
+ require '-test-/exception'
+
+ module Bug
+ class Bug7802 < RuntimeError
+ def try_method
+ raise self
+ end
+
+ def ensured_method
+ [1].detect {|i| true}
+ end
+ end
+ end
+
+ assert_raise(Bug::Bug7802, '[ruby-core:52022] [Bug #7802]') {
+ Bug::Exception.ensured(Bug::Bug7802.new)
+ }
+ 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-/iter/test_iter_break.rb b/test/-ext-/iter/test_iter_break.rb
new file mode 100644
index 0000000000..1ef2aad3c2
--- /dev/null
+++ b/test/-ext-/iter/test_iter_break.rb
@@ -0,0 +1,12 @@
+require 'test/unit'
+require '-test-/iter/break'
+
+class TestIterBreak < Test::Unit::TestCase
+ def test_iter_break
+ backport7896 = '[ruby-core:52607]'
+ assert_equal(nil, 1.times{Bug::Breakable.iter_break}, backport7896)
+
+ feature5895 = '[ruby-dev:45132]'
+ assert_equal(42, 1.times{Bug::Breakable.iter_break_value(42)}, feature5895)
+ end
+end
diff --git a/test/-ext-/marshal/test_usrmarshal.rb b/test/-ext-/marshal/test_usrmarshal.rb
new file mode 100644
index 0000000000..ae23223e15
--- /dev/null
+++ b/test/-ext-/marshal/test_usrmarshal.rb
@@ -0,0 +1,33 @@
+require 'test/unit'
+require_relative '../../ruby/envutil'
+require '-test-/marshal/usr'
+
+module Bug end
+
+module Bug::Marshal
+ class TestUsrMarshal < Test::Unit::TestCase
+ def old_dump
+ @old_dump ||=
+ begin
+ src = "module Bug; module Marshal; class UsrMarshal; def initialize(val) @value = val; end; end; ::Marshal.dump(UsrMarshal.new(42), STDOUT); end; end"
+ EnvUtil.invoke_ruby([], src, true)[0]
+ end
+ end
+
+ def test_marshal
+ v = ::Marshal.load(::Marshal.dump(UsrMarshal.new(42)))
+ assert_instance_of(UsrMarshal, v)
+ assert_equal(42, v.value)
+ end
+
+ def test_incompat
+ assert_raise_with_message(ArgumentError, "dump format error") {::Marshal.load(old_dump)}
+ end
+
+ def test_compat
+ out, err = EnvUtil.invoke_ruby(["-r-test-/marshal/usr", "-r-test-/marshal/compat", "-e", "::Marshal.dump(::Marshal.load(STDIN), STDOUT)"], old_dump, true, true)
+ assert_equal(::Marshal.dump(UsrMarshal.new(42)), out)
+ assert_equal("", err)
+ end
+ end
+end
diff --git a/test/-ext-/method/test_arity.rb b/test/-ext-/method/test_arity.rb
new file mode 100644
index 0000000000..79ef23b34f
--- /dev/null
+++ b/test/-ext-/method/test_arity.rb
@@ -0,0 +1,37 @@
+require '-test-/method'
+require 'test/unit'
+
+class TestMethod < Test::Unit::TestCase
+ class TestArity < Test::Unit::TestCase
+ class A
+ def foo0()
+ end
+ def foom1(*a)
+ end
+ def foom2(a,*b)
+ end
+ def foo1(a)
+ end
+ def foo2(a,b)
+ end
+ end
+
+ class B<A
+ private :foo1, :foo2
+ end
+
+ METHODS = {foo0: 0, foo1: 1, foo2: 2, foom1: -1, foom2: -2}
+
+ def test_base
+ METHODS.each do |name, arity|
+ assert_equal(arity, Bug::Method.mod_method_arity(A, name), "A##{name}")
+ end
+ end
+
+ def test_zsuper
+ METHODS.each do |name, arity|
+ assert_equal(arity, Bug::Method.mod_method_arity(B, name), "B##{name}")
+ end
+ end
+ end
+end
diff --git a/test/-ext-/num2int/test_num2int.rb b/test/-ext-/num2int/test_num2int.rb
new file mode 100644
index 0000000000..f579659929
--- /dev/null
+++ b/test/-ext-/num2int/test_num2int.rb
@@ -0,0 +1,267 @@
+require 'test/unit'
+require '-test-/num2int/num2int'
+
+class TestNum2int < Test::Unit::TestCase
+ SHRT_MIN = -32768
+ SHRT_MAX = 32767
+ USHRT_MAX = 65535
+
+ INT_MIN = -2147483648
+ INT_MAX = 2147483647
+ UINT_MAX = 4294967295
+
+ case [0].pack('L!').size
+ when 4
+ LONG_MAX = 2147483647
+ LONG_MIN = -2147483648
+ ULONG_MAX = 4294967295
+ when 8
+ LONG_MAX = 9223372036854775807
+ LONG_MIN = -9223372036854775808
+ ULONG_MAX = 18446744073709551615
+ end
+
+ LLONG_MAX = 9223372036854775807
+ LLONG_MIN = -9223372036854775808
+ ULLONG_MAX = 18446744073709551615
+
+ FIXNUM_MAX = LONG_MAX/2
+ FIXNUM_MIN = LONG_MIN/2
+
+ 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
+ if (arg = num.to_f - 0.5) != num.to_f && arg.to_int == num
+ assert_num2i_success_internal(result.to_s, func, arg)
+ end
+ if (arg = num + Rational(1,2)) && arg.to_int == num
+ assert_num2i_success_internal(result.to_s, func, arg)
+ end
+ if (arg = num - Rational(1,2)) && arg.to_int == num
+ assert_num2i_success_internal(result.to_s, func, arg)
+ end
+ end
+
+ 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
+ # 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
+ if (arg = num.to_f - 0.5) != num.to_f && arg.to_int == num
+ assert_num2i_error_internal(func, arg)
+ end
+ if (arg = num + Rational(1,2)) && arg.to_int == num
+ assert_num2i_error_internal(func, arg)
+ end
+ 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_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_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_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_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_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_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
index 5653dbc021..99a0a506bd 100644
--- a/test/-ext-/old_thread_select/test_old_thread_select.rb
+++ b/test/-ext-/old_thread_select/test_old_thread_select.rb
@@ -4,6 +4,8 @@ class TestOldThreadSelect < Test::Unit::TestCase
require '-test-/old_thread_select/old_thread_select'
ANCIENT_LINUX = RUBY_PLATFORM =~ /linux/ && `uname -r`.chomp < '2.6.32'
+ DARWIN_10 = RUBY_PLATFORM =~ /darwin10/
+ WINDOWS = RUBY_PLATFORM =~ /mswin|mingw/
def with_pipe
r, w = IO.pipe
@@ -44,8 +46,10 @@ class TestOldThreadSelect < Test::Unit::TestCase
w.syswrite '.'
rfds = [ r.fileno, r2.fileno ]
rc = IO.old_thread_select(rfds, nil, nil, nil)
+ diff = Time.now - t0
assert_equal [ r.fileno ], rfds, bug5306
assert_equal 1, rc, bug5306
+ assert_operator diff, :>=, 0, "returned too early: diff=#{diff}"
end
end
end
@@ -87,7 +91,7 @@ class TestOldThreadSelect < Test::Unit::TestCase
end
end
- unless ANCIENT_LINUX
+ unless ANCIENT_LINUX || DARWIN_10 || WINDOWS
assert_operator diff, :>=, 1, "interrupted or short wait: diff=#{diff}"
end
assert_equal 0, rc
diff --git a/test/-ext-/path_to_class/test_path_to_class.rb b/test/-ext-/path_to_class/test_path_to_class.rb
new file mode 100644
index 0000000000..fdf4097fde
--- /dev/null
+++ b/test/-ext-/path_to_class/test_path_to_class.rb
@@ -0,0 +1,12 @@
+require 'test/unit'
+
+class Test_PathToClass < Test::Unit::TestCase
+ require '-test-/path_to_class/path_to_class'
+
+ def test_path_to_class
+ bug5691 = '[ruby-core:41410]'
+ assert_raise(ArgumentError, bug5691) {
+ Test_PathToClass.path_to_class("Test_PathToClass::Object")
+ }
+ 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-/st/test_numhash.rb b/test/-ext-/st/test_numhash.rb
index 9ec072e1a5..24dc87c1d9 100644
--- a/test/-ext-/st/test_numhash.rb
+++ b/test/-ext-/st/test_numhash.rb
@@ -17,5 +17,33 @@ class Bug::StNumHash
end
assert_equal([*0..5], keys)
end
+
+ def test_update
+ assert_equal(true, @tbl.update(0) {@tbl[5] = :x})
+ assert_equal(:x, @tbl[0])
+ assert_equal(:x, @tbl[5])
+ end
+
+ def test_size_after_delete_safe
+ 10.downto(1) do |up|
+ tbl = Bug::StNumHash.new
+ 1.upto(up){|i| tbl[i] = i}
+ assert_equal(1, tbl.delete_safe(1))
+ assert_equal(up - 1, tbl.size, "delete_safe doesn't change size from #{up} to #{up-1}")
+ end
+ end
+
+ def test_delete_safe_on_iteration
+ 10.downto(1) do |up|
+ tbl = Bug::StNumHash.new
+ 1.upto(up){|i| tbl[i] = i}
+ assert_nothing_raised("delete_safe forces iteration to fail with size #{up}") do
+ tbl.each do |k, v, t|
+ assert_equal k, t.delete_safe(k)
+ true
+ end
+ end
+ end
+ end
end
end
diff --git a/test/-ext-/st/test_update.rb b/test/-ext-/st/test_update.rb
new file mode 100644
index 0000000000..1b41d2bc03
--- /dev/null
+++ b/test/-ext-/st/test_update.rb
@@ -0,0 +1,50 @@
+require 'test/unit'
+require "-test-/st/update"
+
+class Bug::StTable
+ class Test_Update < Test::Unit::TestCase
+ def setup
+ @tbl = Bug::StTable.new
+ @tbl[:a] = 1
+ @tbl[:b] = 2
+ end
+
+ def test_notfound
+ assert_equal(false, @tbl.st_update(:c) {42})
+ assert_equal({a: 1, b: 2, c: 42}, @tbl)
+ end
+
+ def test_continue
+ args = nil
+ assert_equal(true, @tbl.st_update(:a) {|*x| args = x; false})
+ assert_equal({a: 1, b: 2}, @tbl, :a)
+ assert_equal([:a, 1], args)
+ end
+
+ def test_delete
+ args = nil
+ assert_equal(true, @tbl.st_update(:a) {|*x| args = x; nil})
+ assert_equal({b: 2}, @tbl, :a)
+ assert_equal([:a, 1], args)
+ end
+
+ def test_update
+ args = nil
+ assert_equal(true, @tbl.st_update(:a) {|*x| args = x; 3})
+ assert_equal({a: 3, b: 2}, @tbl, :a)
+ assert_equal([:a, 1], args)
+ end
+
+ def test_pass_objects_in_st_table
+ bug7330 = '[ruby-core:49220]'
+ key = "abc".freeze
+ value = "def"
+ @tbl[key] = value
+ @tbl.st_update("abc") {|*args|
+ assert_same(key, args[0], bug7330)
+ assert_same(value, args[1], bug7330)
+ nil
+ }
+ end
+ 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_enc_str_buf_cat.rb b/test/-ext-/string/test_enc_str_buf_cat.rb
new file mode 100644
index 0000000000..9582fe268c
--- /dev/null
+++ b/test/-ext-/string/test_enc_str_buf_cat.rb
@@ -0,0 +1,15 @@
+require 'test/unit'
+require "-test-/string/string"
+
+class Test_StringEncStrBufCat < Test::Unit::TestCase
+ Bug6509 = '[ruby-dev:45688]'
+
+ def test_unknown
+ a8_str = "a\xBE".force_encoding(Encoding::ASCII_8BIT)
+ cr_unknown_str = [0x62].pack('C*')
+ assert_equal(true, a8_str.valid_encoding?, "an assertion for following tests")
+ assert_equal(:valid, Bug::String.new(a8_str).coderange, "an assertion for following tests")
+ assert_equal(:unknown, Bug::String.new(cr_unknown_str).coderange, "an assertion for following tests")
+ assert_equal(:valid, Bug::String.new(a8_str).enc_str_buf_cat(cr_unknown_str).coderange, Bug6509)
+ end
+end
diff --git a/test/-ext-/string/test_modify_expand.rb b/test/-ext-/string/test_modify_expand.rb
index 5fee7b3580..6a18560bd4 100644
--- a/test/-ext-/string/test_modify_expand.rb
+++ b/test/-ext-/string/test_modify_expand.rb
@@ -4,26 +4,12 @@ require_relative '../../ruby/envutil'
class Test_StringModifyExpand < Test::Unit::TestCase
def test_modify_expand_memory_leak
- before = after = nil
- args = [
- "--disable=gems", "-r-test-/string/string",
- "-I"+File.expand_path("../../..", __FILE__),
- "-rruby/memory_status",
- "-e", <<-CMD
+ assert_no_memory_leak(["-r-test-/string/string"], <<-PRE, <<-CMD, "rb_str_modify_expand()")
s=Bug::String.new
- size=Memory::Status.new.size
- puts size
+ PRE
+ size = $initial_size
10.times{s.modify_expand!(size)}
s.replace("")
- puts Memory::Status.new.size
CMD
- ]
- status = EnvUtil.invoke_ruby(args, "", true) do |in_p, out_p, err_p, pid|
- before, after = out_p.readlines.map(&:to_i)
- Process.wait(pid)
- $?
- end
- assert_equal(true, status.success?)
- assert_operator after.fdiv(before), :<, 2
end
end
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-/string/test_qsort.rb b/test/-ext-/string/test_qsort.rb
new file mode 100644
index 0000000000..3a58523200
--- /dev/null
+++ b/test/-ext-/string/test_qsort.rb
@@ -0,0 +1,19 @@
+require 'test/unit'
+require "-test-/string/string"
+
+class Test_StringQSort < Test::Unit::TestCase
+ def test_qsort
+ s = Bug::String.new("xxozfxx")
+ s.qsort!
+ assert_equal("foxxxxz", s)
+ end
+
+ def test_qsort_slice
+ s = Bug::String.new("xxofzx1")
+ s.qsort!(nil, nil, 3)
+ assert_equal("fzxxxo1", s)
+ s = Bug::String.new("xxofzx231")
+ s.qsort!(nil, nil, 3)
+ assert_equal("231fzxxxo", s)
+ end
+end
diff --git a/test/-ext-/symbol/test_inadvertent_creation.rb b/test/-ext-/symbol/test_inadvertent_creation.rb
new file mode 100644
index 0000000000..82a64034b1
--- /dev/null
+++ b/test/-ext-/symbol/test_inadvertent_creation.rb
@@ -0,0 +1,266 @@
+require 'test/unit'
+require "-test-/symbol"
+
+module Test_Symbol
+ class TestInadvertent < Test::Unit::TestCase
+ 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.interned?(name)
+ name
+ end
+
+ def setup
+ @obj = Object.new
+ end
+
+ def assert_not_interned(name, msg = nil)
+ assert_not_send([Bug::Symbol, :interned?, name], msg)
+ end
+
+ def assert_not_interned_error(obj, meth, name, msg = nil)
+ e = assert_raise(NameError, msg) {obj.__send__(meth, name)}
+ assert_not_interned(name, msg)
+ e
+ end
+
+ def assert_not_interned_false(obj, meth, name, msg = nil)
+ assert_not_send([obj, meth, name], msg)
+ assert_not_interned(name, msg)
+ end
+
+ Feature5072 = '[ruby-core:38367]'
+
+ def test_module_const_get
+ cl = Class.new
+ name = noninterned_name("A")
+
+ assert_not_interned_false(cl, :const_defined?, name, Feature5072)
+ end
+
+ def test_respond_to_missing
+ feature5072 = Feature5072
+ c = Class.new do
+ def self.respond_to_missing?(*)
+ super
+ end
+ end
+ s = noninterned_name
+
+ # assert_not_interned_false(c, :respond_to?, s, feature5072)
+ assert_not_interned_false(c, :method_defined?, s, feature5072)
+ assert_not_interned_false(c, :public_method_defined?, s, feature5072)
+ assert_not_interned_false(c, :private_method_defined?, s, feature5072)
+ assert_not_interned_false(c, :protected_method_defined?, s, feature5072)
+ assert_not_interned_false(c, :const_defined?, noninterned_name("A"), feature5072)
+ assert_not_interned_false(c, :instance_variable_defined?, noninterned_name("@"), feature5072)
+ assert_not_interned_false(c, :class_variable_defined?, noninterned_name("@@"), feature5072)
+ end
+
+ Feature5079 = '[ruby-core:38404]'
+
+ def test_undefined_instance_variable
+ feature5079 = feature5079
+ c = Class.new
+ iv = noninterned_name("@")
+
+ assert_not_interned_false(c, :instance_variable_get, iv, feature5079)
+ assert_not_interned_error(c, :remove_instance_variable, iv, feature5079)
+ end
+
+ def test_undefined_class_variable
+ feature5079 = feature5079
+ c = Class.new
+ cv = noninterned_name("@@")
+
+ assert_not_interned_error(c, :class_variable_get, cv, feature5079)
+ assert_not_interned_error(c, :remove_class_variable, cv, feature5079)
+ end
+
+
+ def test_undefined_const
+ feature5079 = feature5079
+ c = Class.new
+ s = noninterned_name("A")
+
+ assert_not_interned_error(c, :remove_const, s, feature5079)
+ end
+
+ def test_undefined_method
+ feature5079 = feature5079
+ c = Class.new
+ s = noninterned_name
+
+ assert_not_interned_error(c, :method, s, feature5079)
+ assert_not_interned_error(c, :public_method, s, feature5079)
+ assert_not_interned_error(c, :instance_method, s, feature5079)
+ assert_not_interned_error(c, :public_instance_method, s, feature5079)
+ end
+
+ Feature5089 = '[ruby-core:38447]'
+ def test_const_missing
+ feature5089 = Feature5089
+ c = Class.new do
+ def self.const_missing(const_name)
+ raise NameError, const_name.to_s
+ end
+ end
+ s = noninterned_name("A")
+
+ # assert_not_interned_error(c, :const_get, s, feature5089)
+ assert_not_interned_false(c, :autoload?, s, feature5089)
+ end
+
+ def test_aliased_method
+ feature5089 = Feature5089
+ c = Class.new do
+ def self.alias_method(str)
+ super(:puts, str)
+ end
+ end
+ s = noninterned_name
+
+ assert_not_interned_error(c, :alias_method, s, feature5089)
+ assert_not_interned_error(c, :private_class_method, s, feature5089)
+ assert_not_interned_error(c, :private_constant, s, feature5089)
+ assert_not_interned_error(c, :private, s, feature5089)
+ assert_not_interned_error(c, :protected, s, feature5089)
+ assert_not_interned_error(c, :public, s, feature5089)
+ assert_not_interned_error(c, :public_class_method, s, feature5089)
+ assert_not_interned_error(c, :public_constant, s, feature5089)
+ assert_not_interned_error(c, :remove_method, s, feature5089)
+ assert_not_interned_error(c, :undef_method, s, feature5089)
+ assert_not_interned_error(c, :untrace_var, s, feature5089)
+ end
+
+ Feature5112 = '[ruby-core:38576]'
+
+ def test_public_send
+ name = noninterned_name
+ e = assert_raise(NoMethodError) {@obj.public_send(name, Feature5112)}
+ assert_not_interned(name)
+ assert_equal(name, e.name)
+ assert_equal([Feature5112], e.args)
+ end
+
+ def test_send
+ name = noninterned_name
+ e = assert_raise(NoMethodError) {@obj.send(name, Feature5112)}
+ assert_not_interned(name)
+ assert_equal(name, e.name)
+ assert_equal([Feature5112], e.args)
+ end
+
+ def test___send__
+ name = noninterned_name
+ e = assert_raise(NoMethodError) {@obj.__send__(name, Feature5112)}
+ 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
+ end
+end
diff --git a/test/-ext-/symbol/test_type.rb b/test/-ext-/symbol/test_type.rb
new file mode 100644
index 0000000000..d6816754c8
--- /dev/null
+++ b/test/-ext-/symbol/test_type.rb
@@ -0,0 +1,110 @@
+require 'test/unit'
+require "-test-/symbol"
+
+module Test_Symbol
+ class TestType < Test::Unit::TestCase
+ 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(:[]))
+ end
+ end
+end
diff --git a/test/-ext-/test_bug-5832.rb b/test/-ext-/test_bug-5832.rb
new file mode 100644
index 0000000000..11f8a52a95
--- /dev/null
+++ b/test/-ext-/test_bug-5832.rb
@@ -0,0 +1,21 @@
+require '-test-/bug-5832/bug'
+
+class Test_BUG_5832 < Test::Unit::TestCase
+ def test_block_passing
+ bug5832 = '[ruby-dev:45071]'
+
+ c = Class.new do
+ define_method(:call_invoke_block_from_c) do
+ Bug.funcall_callback(self)
+ end
+
+ def callback
+ yield if block_given?
+ end
+ end
+
+ assert_nothing_raised(RuntimeError, bug5832) do
+ c.new.call_invoke_block_from_c { raise 'unreachable' }
+ end
+ end
+end
diff --git a/test/-ext-/test_printf.rb b/test/-ext-/test_printf.rb
new file mode 100644
index 0000000000..609af7ca7a
--- /dev/null
+++ b/test/-ext-/test_printf.rb
@@ -0,0 +1,184 @@
+require 'test/unit'
+require "-test-/printf"
+require_relative '../ruby/allpairs'
+
+class Test_SPrintf < Test::Unit::TestCase
+ def to_s
+ "#{self.class}:#{object_id}"
+ end
+
+ def inspect
+ "<#{self.class}:#{object_id}>"
+ end
+
+ def test_int
+ assert_match(/\A<-?\d+>\z/, Bug::Printf.i(self))
+ end
+
+ def test_to_str
+ assert_equal("<#{self.class}:#{object_id}>", Bug::Printf.s(self))
+ end
+
+ def test_inspect
+ 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}"
+ end
+ assert_equal("<\u{3042 3044 3046 3048 304a}>", Bug::Printf.s(self))
+ end
+
+ def test_taint
+ obj = Object.new.taint
+ assert_equal({to_s: true, inspect: true},
+ {
+ to_s: Bug::Printf.s(obj).tainted?,
+ inspect: Bug::Printf.v(obj).tainted?,
+ })
+ end
+
+ 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))
+ }
+end
diff --git a/test/-ext-/tracepoint/test_tracepoint.rb b/test/-ext-/tracepoint/test_tracepoint.rb
new file mode 100644
index 0000000000..45792042af
--- /dev/null
+++ b/test/-ext-/tracepoint/test_tracepoint.rb
@@ -0,0 +1,53 @@
+require 'test/unit'
+require '-test-/tracepoint'
+
+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_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_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_count, *_newobjs = *result
+
+ assert_operator stat2[:total_allocated_object] - stat1[:total_allocated_object], :>=, newobj_count
+ assert_operator 1_000_000, :<=, newobj_count
+
+ assert_operator stat2[:total_freed_object] + stat2[:heap_final_num] - stat1[:total_freed_object], :>=, free_count
+ assert_operator stat2[:count] - stat1[:count], :==, gc_start_count
+
+ assert_operator gc_start_count, :>=, gc_end_count
+ assert_operator stat2[:count] - stat1[:count] - 1, :<=, gc_end_count
+ end
+end
diff --git a/test/-ext-/typeddata/test_typeddata.rb b/test/-ext-/typeddata/test_typeddata.rb
new file mode 100644
index 0000000000..c24ad08004
--- /dev/null
+++ b/test/-ext-/typeddata/test_typeddata.rb
@@ -0,0 +1,16 @@
+require 'test/unit'
+require "-test-/typeddata/typeddata"
+
+class Test_TypedData < Test::Unit::TestCase
+ def test_wrong_argtype
+ assert_raise_with_message(TypeError, "wrong argument type false (expected typed_data)") {Bug::TypedData.check(false)}
+
+ assert_raise_with_message(TypeError, "wrong argument type true (expected typed_data)") {Bug::TypedData.check(true)}
+
+ assert_raise_with_message(TypeError, "wrong argument type Symbol (expected typed_data)") {Bug::TypedData.check(:e)}
+
+ assert_raise_with_message(TypeError, "wrong argument type Fixnum (expected typed_data)") {Bug::TypedData.check(0)}
+
+ 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 c7dd0909f0..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
@@ -21,10 +21,13 @@ class TestWaitForSingleFD < Test::Unit::TestCase
end
def test_wait_for_invalid_fd
+ # FreeBSD 8.2 or prior sticks this
+ # http://bugs.ruby-lang.org/issues/5524
+ skip if /freebsd[1-8]/ =~ RUBY_PLATFORM
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/base64/test_base64.rb b/test/base64/test_base64.rb
index 9ae54cb405..c5e61b31ac 100644
--- a/test/base64/test_base64.rb
+++ b/test/base64/test_base64.rb
@@ -1,3 +1,4 @@
+# coding: US-ASCII
require "test/unit"
require "base64"
diff --git a/test/benchmark/test_benchmark.rb b/test/benchmark/test_benchmark.rb
index 801da47dae..7477fa8e05 100644
--- a/test/benchmark/test_benchmark.rb
+++ b/test/benchmark/test_benchmark.rb
@@ -4,7 +4,7 @@ require 'benchmark'
MiniTest::Unit.autorun
describe Benchmark do
- BENCH_FOR_TIMES_UPTO = lambda do |x|
+ 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,21 +12,23 @@ 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 }
x.report { 1.upto(n) do ; '1'; end }
end
- LABELS = %w[first second third]
+ def labels
+ %w[first second third]
+ end
def bench(type = :bm, *args, &block)
if block
Benchmark.send(type, *args, &block)
else
Benchmark.send(type, *args) do |x|
- LABELS.each { |label|
+ labels.each { |label|
x.report(label) {}
}
end
@@ -59,12 +61,29 @@ describe Benchmark do
end
end
+ benchmark_output_with_total_avg = <<BENCH
+ user system total real
+for: --time-- --time-- --time-- ( --time--)
+times: --time-- --time-- --time-- ( --time--)
+upto: --time-- --time-- --time-- ( --time--)
+>total: --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
+first --time-- --time-- --time-- ( --time--)
+second --time-- --time-- --time-- ( --time--)
+third --time-- --time-- --time-- ( --time--)
+BENCH
+ end
+
it 'makes extra calcultations with an Array at the end of the benchmark and show the result' do
capture_bench_output(:benchmark,
Benchmark::CAPTION, 7,
Benchmark::FORMAT, ">total:", ">avg:",
- &BENCH_FOR_TIMES_UPTO).must_equal BENCHMARK_OUTPUT_WITH_TOTAL_AVG
+ &bench_for_times_upto).must_equal benchmark_output_with_total_avg
end
end
@@ -74,8 +93,8 @@ describe Benchmark do
capture_io do
results = bench(meth)
results.must_be_instance_of Array
- results.size.must_equal LABELS.size
- results.zip(LABELS).each { |tms, label|
+ results.size.must_equal labels.size
+ results.zip(labels).each { |tms, label|
tms.must_be_instance_of Benchmark::Tms
tms.label.must_equal label
}
@@ -84,26 +103,49 @@ describe Benchmark do
end
it 'correctly output when the label width is given' do
- capture_bench_output(:bm, 6).must_equal BM_OUTPUT
+ capture_bench_output(:bm, 6).must_equal <<-BENCH
+ user system total real
+first --time-- --time-- --time-- ( --time--)
+second --time-- --time-- --time-- ( --time--)
+third --time-- --time-- --time-- ( --time--)
+BENCH
end
it 'correctly output when no label is given' do
- capture_bench_output(:bm, &BENCH_FOR_TIMES_UPTO_NO_LABEL).must_equal BM_OUTPUT_NO_LABEL
+ capture_bench_output(:bm, &bench_for_times_upto_no_label).must_equal <<-BENCH
+ user system total real
+ --time-- --time-- --time-- ( --time--)
+ --time-- --time-- --time-- ( --time--)
+ --time-- --time-- --time-- ( --time--)
+BENCH
end
it 'can make extra calcultations with an array at the end of the benchmark' do
capture_bench_output(:bm, 7, ">total:", ">avg:",
- &BENCH_FOR_TIMES_UPTO).must_equal BENCHMARK_OUTPUT_WITH_TOTAL_AVG
+ &bench_for_times_upto).must_equal benchmark_output_with_total_avg
end
end
describe 'bmbm' do
+ bmbm_output = <<BENCH
+Rehearsal ------------------------------------------
+first --time-- --time-- --time-- ( --time--)
+second --time-- --time-- --time-- ( --time--)
+third --time-- --time-- --time-- ( --time--)
+--------------------------------- total: --time--sec
+
+ user system total real
+first --time-- --time-- --time-- ( --time--)
+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
+ capture_bench_output(:bmbm).must_equal bmbm_output
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
+ capture_bench_output(:bmbm, 6).must_equal bmbm_output
end
end
@@ -125,39 +167,3 @@ describe Benchmark do
end
end
end
-
-BM_OUTPUT = <<BENCH
- user system total real
-first --time-- --time-- --time-- ( --time--)
-second --time-- --time-- --time-- ( --time--)
-third --time-- --time-- --time-- ( --time--)
-BENCH
-
-BM_OUTPUT_NO_LABEL = <<BENCH
- user system total real
- --time-- --time-- --time-- ( --time--)
- --time-- --time-- --time-- ( --time--)
- --time-- --time-- --time-- ( --time--)
-BENCH
-
-BMBM_OUTPUT = <<BENCH
-Rehearsal ------------------------------------------
-first --time-- --time-- --time-- ( --time--)
-second --time-- --time-- --time-- ( --time--)
-third --time-- --time-- --time-- ( --time--)
---------------------------------- total: --time--sec
-
- user system total real
-first --time-- --time-- --time-- ( --time--)
-second --time-- --time-- --time-- ( --time--)
-third --time-- --time-- --time-- ( --time--)
-BENCH
-
-BENCHMARK_OUTPUT_WITH_TOTAL_AVG = <<BENCH
- user system total real
-for: --time-- --time-- --time-- ( --time--)
-times: --time-- --time-- --time-- ( --time--)
-upto: --time-- --time-- --time-- ( --time--)
->total: --time-- --time-- --time-- ( --time--)
->avg: --time-- --time-- --time-- ( --time--)
-BENCH
diff --git a/test/bigdecimal/test_bigdecimal.rb b/test/bigdecimal/test_bigdecimal.rb
index 055b0ff4f0..8eb732aca1 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'
@@ -44,10 +45,26 @@ class TestBigDecimal < Test::Unit::TestCase
"Expected #{x.inspect} to be negative zero")
end
+ def test_not_equal
+ assert_not_equal BigDecimal("1"), BigDecimal.allocate
+ end
+
def test_global_new
assert_equal(1, BigDecimal("1"))
assert_equal(1, BigDecimal("1", 1))
assert_raise(ArgumentError) { BigDecimal("1", -1) }
+ assert_raise(ArgumentError) { BigDecimal(4.2) }
+ begin
+ BigDecimal(4.2)
+ rescue ArgumentError => error
+ assert_match(/Float/, error.message)
+ end
+ assert_raise(ArgumentError) { BigDecimal(42.quo(7)) }
+ begin
+ BigDecimal(42.quo(7))
+ rescue ArgumentError => error
+ assert_match(/Rational/, error.message)
+ end
end
def test_global_new_with_integer
@@ -84,6 +101,13 @@ class TestBigDecimal < Test::Unit::TestCase
end
end
+ def test_global_new_with_tainted_string
+ Thread.new {
+ $SAFE = 1
+ BigDecimal('1'.taint)
+ }.join
+ end
+
def test_new
assert_equal(1, BigDecimal.new("1"))
assert_equal(1, BigDecimal.new("1", 1))
@@ -134,6 +158,13 @@ class TestBigDecimal < Test::Unit::TestCase
end
end
+ def test_new_with_tainted_string
+ Thread.new {
+ $SAFE = 1
+ BigDecimal.new('1'.taint)
+ }.join
+ end
+
def _test_mode(type)
BigDecimal.mode(type, true)
assert_raise(FloatDomainError) { yield }
@@ -536,15 +567,40 @@ class TestBigDecimal < Test::Unit::TestCase
assert_kind_of(Float, x .to_f)
assert_kind_of(Float, (-x).to_f)
+ bug6944 = '[ruby-core:47342]'
+
BigDecimal.mode(BigDecimal::EXCEPTION_UNDERFLOW, true)
- assert_raise(FloatDomainError) {
- BigDecimal("1e#{Float::MIN_10_EXP - 2*Float::DIG}").to_f }
- assert_raise(FloatDomainError) {
- BigDecimal("-1e#{Float::MIN_10_EXP - 2*Float::DIG}").to_f }
+ x = "1e#{Float::MIN_10_EXP - 2*Float::DIG}"
+ assert_raise(FloatDomainError, x) {BigDecimal(x).to_f}
+ x = "-#{x}"
+ assert_raise(FloatDomainError, x) {BigDecimal(x).to_f}
+ x = "1e#{Float::MIN_10_EXP - Float::DIG}"
+ assert_nothing_raised(FloatDomainError, x) {
+ assert_in_delta(0.0, BigDecimal(x).to_f, 10**Float::MIN_10_EXP, bug6944)
+ }
+ x = "-#{x}"
+ assert_nothing_raised(FloatDomainError, x) {
+ assert_in_delta(0.0, BigDecimal(x).to_f, 10**Float::MIN_10_EXP, bug6944)
+ }
BigDecimal.mode(BigDecimal::EXCEPTION_UNDERFLOW, false)
- assert_equal( 0.0, BigDecimal("1e#{Float::MIN_10_EXP - 2*Float::DIG}").to_f)
- assert_equal(-0.0, BigDecimal("-1e#{Float::MIN_10_EXP - 2*Float::DIG}").to_f)
+ x = "1e#{Float::MIN_10_EXP - 2*Float::DIG}"
+ assert_equal( 0.0, BigDecimal(x).to_f, x)
+ x = "-#{x}"
+ assert_equal(-0.0, BigDecimal(x).to_f, x)
+ x = "1e#{Float::MIN_10_EXP - Float::DIG}"
+ assert_nothing_raised(FloatDomainError, x) {
+ assert_in_delta(0.0, BigDecimal(x).to_f, 10**Float::MIN_10_EXP, bug6944)
+ }
+ x = "-#{x}"
+ assert_nothing_raised(FloatDomainError, x) {
+ assert_in_delta(0.0, BigDecimal(x).to_f, 10**Float::MIN_10_EXP, bug6944)
+ }
+
+ assert_equal( 0.0, BigDecimal( '9e-325').to_f)
+ assert_equal( 0.0, BigDecimal( '10e-325').to_f)
+ assert_equal(-0.0, BigDecimal( '-9e-325').to_f)
+ assert_equal(-0.0, BigDecimal('-10e-325').to_f)
end
def test_coerce
@@ -708,6 +764,10 @@ class TestBigDecimal < Test::Unit::TestCase
assert_equal(400000000000000000000000000000, x.div(3, 1))
assert_equal(420000000000000000000000000000, x.div(3, 2))
assert_equal(423000000000000000000000000000, x.div(3, 3))
+ BigDecimal.save_exception_mode do
+ BigDecimal.mode(BigDecimal::EXCEPTION_INFINITY, false)
+ assert_equal(0, BigDecimal("0").div(BigDecimal("Infinity")))
+ end
end
def test_abs_bigdecimal
@@ -744,6 +804,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)
@@ -855,6 +929,12 @@ class TestBigDecimal < Test::Unit::TestCase
assert_match(/^#<BigDecimal:[0-9a-f]+,'0.12345678E4',#{prec}\(#{maxprec}\)>$/, x.inspect)
end
+ def test_power
+ assert_nothing_raised(TypeError, '[ruby-core:47632]') do
+ 1000.times { BigDecimal.new('1001.10')**0.75 }
+ end
+ end
+
def test_power_with_nil
assert_raise(TypeError) do
BigDecimal(3) ** nil
@@ -1043,6 +1123,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
@@ -1133,28 +1216,29 @@ class TestBigDecimal < Test::Unit::TestCase
def test_split_under_gc_stress
bug3258 = '[ruby-dev:41213]'
- stress, GC.stress = GC.stress, true
+ expect = 10.upto(20).map{|i|[1, "1", 10, i+1].inspect}
+ assert_in_out_err(%w[-rbigdecimal --disable-gems], <<-EOS, expect, [], bug3258)
+ GC.stress = true
10.upto(20) do |i|
- b = BigDecimal.new("1"+"0"*i)
- assert_equal([1, "1", 10, i+1], b.split, bug3258)
+ p BigDecimal.new("1"+"0"*i).split
end
- ensure
- GC.stress = stress
+ EOS
end
def test_coerce_under_gc_stress
- expect = ":too_long_to_embed_as_string can't be coerced into BigDecimal"
- under_gc_stress do
+ assert_in_out_err(%w[-rbigdecimal --disable-gems], <<-EOS, [], [])
+ expect = ":too_long_to_embed_as_string can't be coerced into BigDecimal"
b = BigDecimal.new("1")
+ GC.stress = true
10.times do
begin
b.coerce(:too_long_to_embed_as_string)
rescue => e
- assert_instance_of TypeError, e
- assert_equal expect, e.message
+ raise unless e.is_a?(TypeError)
+ raise "'\#{expect}' is expected, but '\#{e.message}'" unless e.message == expect
end
end
- end
+ EOS
end
def test_INFINITY
@@ -1210,24 +1294,54 @@ class TestBigDecimal < Test::Unit::TestCase
end
def test_BigMath_exp
- n = 20
- assert_in_epsilon(Math.exp(n), BigMath.exp(BigDecimal("20"), n))
- assert_in_epsilon(Math.exp(40), BigMath.exp(BigDecimal("40"), n))
- assert_in_epsilon(Math.exp(-n), BigMath.exp(BigDecimal("-20"), n))
- assert_in_epsilon(Math.exp(-40), BigMath.exp(BigDecimal("-40"), n))
+ prec = 20
+ assert_in_epsilon(Math.exp(20), BigMath.exp(BigDecimal("20"), prec))
+ assert_in_epsilon(Math.exp(40), BigMath.exp(BigDecimal("40"), prec))
+ assert_in_epsilon(Math.exp(-20), BigMath.exp(BigDecimal("-20"), prec))
+ assert_in_epsilon(Math.exp(-40), BigMath.exp(BigDecimal("-40"), prec))
+ end
+
+ def test_BigMath_exp_with_float
+ prec = 20
+ assert_in_epsilon(Math.exp(20), BigMath.exp(20.0, prec))
+ assert_in_epsilon(Math.exp(40), BigMath.exp(40.0, prec))
+ assert_in_epsilon(Math.exp(-20), BigMath.exp(-20.0, prec))
+ assert_in_epsilon(Math.exp(-40), BigMath.exp(-40.0, prec))
+ end
+
+ def test_BigMath_exp_with_fixnum
+ prec = 20
+ assert_in_epsilon(Math.exp(20), BigMath.exp(20, prec))
+ assert_in_epsilon(Math.exp(40), BigMath.exp(40, prec))
+ assert_in_epsilon(Math.exp(-20), BigMath.exp(-20, prec))
+ assert_in_epsilon(Math.exp(-40), BigMath.exp(-40, prec))
+ end
+
+ def test_BigMath_exp_with_rational
+ prec = 20
+ assert_in_epsilon(Math.exp(20), BigMath.exp(Rational(40,2), prec))
+ assert_in_epsilon(Math.exp(40), BigMath.exp(Rational(80,2), prec))
+ assert_in_epsilon(Math.exp(-20), BigMath.exp(Rational(-40,2), prec))
+ assert_in_epsilon(Math.exp(-40), BigMath.exp(Rational(-80,2), prec))
end
def test_BigMath_exp_under_gc_stress
- expect = ":too_long_to_embed_as_string can't be coerced into BigDecimal"
- under_gc_stress do
+ assert_in_out_err(%w[-rbigdecimal --disable-gems], <<-EOS, [], [])
+ expect = ":too_long_to_embed_as_string can't be coerced into BigDecimal"
10.times do
begin
BigMath.exp(:too_long_to_embed_as_string, 6)
rescue => e
- assert_instance_of ArgumentError, e
- assert_equal expect, e.message
+ raise unless e.is_a?(ArgumentError)
+ raise "'\#{expect}' is expected, but '\#{e.message}'" unless e.message == expect
end
end
+ EOS
+ end
+
+ def test_BigMath_log_with_string
+ assert_raise(ArgumentError) do
+ BigMath.log("foo", 20)
end
end
@@ -1237,6 +1351,12 @@ class TestBigDecimal < Test::Unit::TestCase
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)
@@ -1249,7 +1369,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
@@ -1285,6 +1417,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))
@@ -1292,7 +1431,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
@@ -1301,8 +1440,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
@@ -1311,29 +1457,43 @@ 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-20)
+ 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))
end
def test_BigMath_log_under_gc_stress
- expect = ":too_long_to_embed_as_string can't be coerced into BigDecimal"
- under_gc_stress do
+ assert_in_out_err(%w[-rbigdecimal --disable-gems], <<-EOS, [], [])
+ expect = ":too_long_to_embed_as_string can't be coerced into BigDecimal"
10.times do
begin
BigMath.log(:too_long_to_embed_as_string, 6)
rescue => e
- assert_instance_of ArgumentError, e
- assert_equal expect, e.message
+ raise unless e.is_a?(ArgumentError)
+ raise "'\#{expect}' is expected, but '\#{e.message}'" unless e.message == expect
end
end
+ EOS
+ end
+
+ def test_dup
+ [1, -1, 2**100, -2**100].each do |i|
+ x = BigDecimal(i)
+ assert_equal(x, x.dup)
end
end
- def test_to_d
- bug6093 = '[ruby-core:42969]'
- code = "exit(BigDecimal.new('10.0') == 10.0.to_d)"
- assert_ruby_status(%w[-rbigdecimal -rbigdecimal/util -rmathn -], code, bug6093)
+ def test_dup_subclass
+ c = Class.new(BigDecimal)
+ x = c.new(1)
+ y = x.dup
+ assert_equal(1, y)
+ assert_kind_of(c, y)
end
def test_to_d
diff --git a/test/bigdecimal/test_bigdecimal_util.rb b/test/bigdecimal/test_bigdecimal_util.rb
index 301c85e417..9a5d504abd 100644
--- a/test/bigdecimal/test_bigdecimal_util.rb
+++ b/test/bigdecimal/test_bigdecimal_util.rb
@@ -14,9 +14,10 @@ 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")
end
def test_Float_to_d_with_precision
@@ -34,7 +35,7 @@ class TestBigDecimalUtil < Test::Unit::TestCase
end
def test_Rational_to_d_with_zero_precision
- assert_equal(355.quo(113).to_d, 355.quo(113).to_d(BigDecimal.double_fig*2+1))
+ assert_raise(ArgumentError) { 355.quo(113).to_d(0) }
end
def test_Rational_to_d_with_negative_precision
diff --git a/test/cgi/test_cgi_core.rb b/test/cgi/test_cgi_core.rb
index 23b8891576..123caf7acd 100644
--- a/test/cgi/test_cgi_core.rb
+++ b/test/cgi/test_cgi_core.rb
@@ -38,7 +38,7 @@ class CGICoreTest < Test::Unit::TestCase
def test_cgi_core_params_GET
@environ = {
'REQUEST_METHOD' => 'GET',
- 'QUERY_STRING' => 'id=123&id=456&id=&str=%40h+%3D%7E+%2F%5E%24%2F',
+ 'QUERY_STRING' => 'id=123&id=456&id=&id&str=%40h+%3D%7E+%2F%5E%24%2F',
'HTTP_COOKIE' => '_session_id=12345; name1=val1&val2;',
'SERVER_SOFTWARE' => 'Apache 2.2.0',
'SERVER_PROTOCOL' => 'HTTP/1.1',
@@ -183,7 +183,7 @@ class CGICoreTest < Test::Unit::TestCase
}
ENV.update(@environ)
ex = assert_raise(StandardError) do
- cgi = CGI.new
+ CGI.new
end
assert_equal("too large post data.", ex.message)
end if CGI.const_defined?(:MAX_CONTENT_LENGTH)
@@ -304,7 +304,7 @@ class CGICoreTest < Test::Unit::TestCase
HTTP_ACCEPT_LANGUAGE HTTP_CACHE_CONTROL HTTP_FROM HTTP_HOST
HTTP_NEGOTIATE HTTP_PRAGMA HTTP_REFERER HTTP_USER_AGENT
]
- list2 = %w[ CONTENT_LENGTH SERVER_PORT ]
+ # list2 = %w[ CONTENT_LENGTH SERVER_PORT ]
## string expected
list1.each do |name|
@environ[name] = "**#{name}**"
@@ -329,7 +329,7 @@ class CGICoreTest < Test::Unit::TestCase
end
- def test_cgi_core_htmltype
+ def test_cgi_core_htmltype_header
@environ = {
'REQUEST_METHOD' => 'GET',
}
@@ -337,22 +337,32 @@ class CGICoreTest < Test::Unit::TestCase
## no htmltype
cgi = CGI.new
assert_raise(NoMethodError) do cgi.doctype end
+ assert_equal("Content-Type: text/html\r\n\r\n",cgi.header)
## html3
cgi = CGI.new('html3')
expected = '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">'
assert_equal(expected, cgi.doctype)
+ assert_equal("Content-Type: text/html\r\n\r\n",cgi.header)
## html4
cgi = CGI.new('html4')
expected = '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">'
assert_equal(expected, cgi.doctype)
+ assert_equal("Content-Type: text/html\r\n\r\n",cgi.header)
## html4 transitional
cgi = CGI.new('html4Tr')
expected = '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">'
assert_equal(expected, cgi.doctype)
+ assert_equal("Content-Type: text/html\r\n\r\n",cgi.header)
## html4 frameset
cgi = CGI.new('html4Fr')
expected = '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">'
assert_equal(expected, cgi.doctype)
+ assert_equal("Content-Type: text/html\r\n\r\n",cgi.header)
+ ## html5
+ cgi = CGI.new('html5')
+ expected = '<!DOCTYPE HTML>'
+ assert_equal(expected, cgi.doctype)
+ assert_match(/^<HEADER><\/HEADER>$/i,cgi.header)
end
diff --git a/test/cgi/test_cgi_header.rb b/test/cgi/test_cgi_header.rb
index c9d939bd49..c6306eb0ff 100644
--- a/test/cgi/test_cgi_header.rb
+++ b/test/cgi/test_cgi_header.rb
@@ -21,28 +21,28 @@ class CGIHeaderTest < Test::Unit::TestCase
end
- def test_cgi_header_simple
+ def test_cgi_http_header_simple
cgi = CGI.new
## default content type
expected = "Content-Type: text/html\r\n\r\n"
- actual = cgi.header
+ actual = cgi.http_header
assert_equal(expected, actual)
## content type specified as string
expected = "Content-Type: text/xhtml; charset=utf8\r\n\r\n"
- actual = cgi.header('text/xhtml; charset=utf8')
+ actual = cgi.http_header('text/xhtml; charset=utf8')
assert_equal(expected, actual)
## content type specified as hash
expected = "Content-Type: image/png\r\n\r\n"
- actual = cgi.header('type'=>'image/png')
+ actual = cgi.http_header('type'=>'image/png')
assert_equal(expected, actual)
## charset specified
expected = "Content-Type: text/html; charset=utf8\r\n\r\n"
- actual = cgi.header('charset'=>'utf8')
+ actual = cgi.http_header('charset'=>'utf8')
assert_equal(expected, actual)
end
- def test_cgi_header_complex
+ def test_cgi_http_header_complex
cgi = CGI.new
options = {
'type' => 'text/xhtml',
@@ -64,12 +64,12 @@ class CGIHeaderTest < Test::Unit::TestCase
expected << "Expires: Sun, 23 Jan 2000 12:34:56 GMT\r\n"
expected << "location: http://www.ruby-lang.org/\r\n"
expected << "\r\n"
- actual = cgi.header(options)
+ actual = cgi.http_header(options)
assert_equal(expected, actual)
end
- def test_cgi_header_argerr
+ def test_cgi_http_header_argerr
cgi = CGI.new
#expected = NoMethodError # must be ArgumentError
if RUBY_VERSION>="1.9.0"
@@ -77,13 +77,13 @@ class CGIHeaderTest < Test::Unit::TestCase
else
expected = NoMethodError # for Ruby1.8
end
- ex = assert_raise(expected) do
- cgi.header(nil)
+ assert_raise(expected) do
+ cgi.http_header(nil)
end
end
- def test_cgi_header_cookie
+ def test_cgi_http_header_cookie
cgi = CGI.new
cookie1 = CGI::Cookie.new('name1', 'abc', '123')
cookie2 = CGI::Cookie.new('name'=>'name2', 'value'=>'value2', 'secure'=>true)
@@ -92,25 +92,25 @@ class CGIHeaderTest < Test::Unit::TestCase
c1 = "Set-Cookie: name1=abc&123; path=\r\n"
c2 = "Set-Cookie: name2=value2; path=; secure\r\n"
## CGI::Cookie object
- actual = cgi.header('cookie'=>cookie1)
+ actual = cgi.http_header('cookie'=>cookie1)
expected = ctype + c1 + sep
assert_equal(expected, actual)
## String
- actual = cgi.header('cookie'=>cookie2.to_s)
+ actual = cgi.http_header('cookie'=>cookie2.to_s)
expected = ctype + c2 + sep
assert_equal(expected, actual)
## Array
- actual = cgi.header('cookie'=>[cookie1, cookie2])
+ actual = cgi.http_header('cookie'=>[cookie1, cookie2])
expected = ctype + c1 + c2 + sep
assert_equal(expected, actual)
## Hash
- actual = cgi.header('cookie'=>{'name1'=>cookie1, 'name2'=>cookie2})
+ actual = cgi.http_header('cookie'=>{'name1'=>cookie1, 'name2'=>cookie2})
expected = ctype + c1 + c2 + sep
assert_equal(expected, actual)
end
- def test_cgi_header_output_cookies
+ def test_cgi_http_header_output_cookies
cgi = CGI.new
## output cookies
cookies = [ CGI::Cookie.new('name1', 'abc', '123'),
@@ -122,28 +122,28 @@ class CGIHeaderTest < Test::Unit::TestCase
expected << "Set-Cookie: name2=value2; path=; secure\r\n"
expected << "\r\n"
## header when string
- actual = cgi.header('text/html; charset=utf8')
+ actual = cgi.http_header('text/html; charset=utf8')
assert_equal(expected, actual)
## _header_for_string
- actual = cgi.header('type'=>'text/html', 'charset'=>'utf8')
+ actual = cgi.http_header('type'=>'text/html', 'charset'=>'utf8')
assert_equal(expected, actual)
end
- def test_cgi_header_nph
+ def test_cgi_http_header_nph
time_start = Time.now.to_i
cgi = CGI.new
## 'nph' is true
ENV['SERVER_SOFTWARE'] = 'Apache 2.2.0'
- actual1 = cgi.header('nph'=>true)
+ actual1 = cgi.http_header('nph'=>true)
## when old IIS, NPH-mode is forced
ENV['SERVER_SOFTWARE'] = 'IIS/4.0'
- actual2 = cgi.header
- actual3 = cgi.header('status'=>'REDIRECT', 'location'=>'http://www.example.com/')
+ actual2 = cgi.http_header
+ actual3 = cgi.http_header('status'=>'REDIRECT', 'location'=>'http://www.example.com/')
## newer IIS doesn't require NPH-mode ## [ruby-dev:30537]
ENV['SERVER_SOFTWARE'] = 'IIS/5.0'
- actual4 = cgi.header
- actual5 = cgi.header('status'=>'REDIRECT', 'location'=>'http://www.example.com/')
+ actual4 = cgi.http_header
+ actual5 = cgi.http_header('status'=>'REDIRECT', 'location'=>'http://www.example.com/')
time_end = Time.now.to_i
date = /^Date: ([A-Z][a-z]{2}, \d{2} [A-Z][a-z]{2} \d{4} \d\d:\d\d:\d\d GMT)\r\n/
[actual1, actual2, actual3].each do |actual|
diff --git a/test/cgi/test_cgi_modruby.rb b/test/cgi/test_cgi_modruby.rb
index 4eb02fac56..b0fc442bc9 100644
--- a/test/cgi/test_cgi_modruby.rb
+++ b/test/cgi/test_cgi_modruby.rb
@@ -30,7 +30,7 @@ class CGIModrubyTest < Test::Unit::TestCase
cgi = CGI.new
assert(req._setup_cgi_env_invoked?)
assert(! req._send_http_header_invoked?)
- actual = cgi.header
+ actual = cgi.http_header
assert_equal('', actual)
assert_equal('text/html', req.content_type)
assert(req._send_http_header_invoked?)
@@ -51,7 +51,7 @@ class CGIModrubyTest < Test::Unit::TestCase
}
assert(req._setup_cgi_env_invoked?)
assert(! req._send_http_header_invoked?)
- actual = cgi.header(options)
+ actual = cgi.http_header(options)
assert_equal('', actual)
assert_equal('image/gif', req.content_type)
assert_equal('403 Forbidden', req.status_line)
@@ -71,7 +71,7 @@ class CGIModrubyTest < Test::Unit::TestCase
'status' => '200 OK',
'location' => 'http://www.example.com/',
}
- actual = cgi.header(options)
+ cgi.http_header(options)
assert_equal('200 OK', req.status_line) # should be '302 Found' ?
assert_equal(302, req.status)
assert_equal('http://www.example.com/', req.headers_out['location'])
@@ -113,6 +113,7 @@ class Apache #:nodoc:
def hash.add(name, value)
(self[name] ||= []) << value
end
+ @http_header = nil
@headers_out = hash
@status_line = nil
@status = nil
diff --git a/test/cgi/test_cgi_multipart.rb b/test/cgi/test_cgi_multipart.rb
index b51bb7fe2c..ea40535dfd 100644
--- a/test/cgi/test_cgi_multipart.rb
+++ b/test/cgi/test_cgi_multipart.rb
@@ -2,6 +2,7 @@ require 'test/unit'
require 'cgi'
require 'tempfile'
require 'stringio'
+require_relative '../ruby/envutil'
##
@@ -107,6 +108,7 @@ class CGIMultipartTest < Test::Unit::TestCase
def setup
ENV['REQUEST_METHOD'] = 'POST'
+ @tempfiles = []
end
def teardown
@@ -115,11 +117,14 @@ class CGIMultipartTest < Test::Unit::TestCase
end
$stdin.close() if $stdin.is_a?(Tempfile)
$stdin = STDIN
+ @tempfiles.each {|t|
+ t.unlink
+ }
end
def _prepare(data)
## create multipart input
- multipart = MultiPart.new(@boundary)
+ multipart = MultiPart.new(defined?(@boundary) ? @boundary : nil)
data.each do |hash|
multipart.append(hash[:name], hash[:value], hash[:filename])
end
@@ -133,6 +138,7 @@ class CGIMultipartTest < Test::Unit::TestCase
ENV['REQUEST_METHOD'] = 'POST'
## set $stdin
tmpfile = Tempfile.new('test_cgi_multipart')
+ @tempfiles << tmpfile
tmpfile.binmode
tmpfile << input
tmpfile.rewind()
@@ -141,7 +147,7 @@ class CGIMultipartTest < Test::Unit::TestCase
def _test_multipart
caller(0).find {|s| s =~ /in `test_(.*?)'/ }
- testname = $1
+ #testname = $1
#$stderr.puts "*** debug: testname=#{testname.inspect}"
_prepare(@data)
cgi = RUBY_VERSION>="1.9" ? CGI.new(:accept_charset=>"UTF-8") : CGI.new
@@ -168,6 +174,16 @@ class CGIMultipartTest < Test::Unit::TestCase
assert_equal(hash[:filename] || '', cgi[name].original_filename) #if hash[:filename]
assert_equal(hash[:content_type] || '', cgi[name].content_type) #if hash[:content_type]
end
+ ensure
+ if cgi
+ cgi.params.each {|name, vals|
+ vals.each {|val|
+ if val.kind_of?(Tempfile) && val.path
+ val.unlink
+ end
+ }
+ }
+ end
end
@@ -270,7 +286,7 @@ class CGIMultipartTest < Test::Unit::TestCase
input2
end
ex = assert_raise(EOFError) do
- cgi = RUBY_VERSION>="1.9" ? CGI.new(:accept_charset=>"UTF-8") : CGI.new
+ RUBY_VERSION>="1.9" ? CGI.new(:accept_charset=>"UTF-8") : CGI.new
end
assert_equal("bad content body", ex.message)
#
@@ -281,7 +297,7 @@ class CGIMultipartTest < Test::Unit::TestCase
input2
end
ex = assert_raise(EOFError) do
- cgi = RUBY_VERSION>="1.9" ? CGI.new(:accept_charset=>"UTF-8") : CGI.new
+ RUBY_VERSION>="1.9" ? CGI.new(:accept_charset=>"UTF-8") : CGI.new
end
assert_equal("bad content body", ex.message)
end
@@ -314,6 +330,35 @@ class CGIMultipartTest < Test::Unit::TestCase
cgi = RUBY_VERSION>="1.9" ? CGI.new(:accept_charset=>"UTF-8") : CGI.new
assert_equal(cgi['foo'], 'bar')
assert_equal(cgi['file'].read, 'b'*10134)
+ cgi['file'].unlink if cgi['file'].kind_of? Tempfile
+ end
+
+ def test_cgi_multipart_without_tempfile
+ assert_in_out_err([], <<-'EOM')
+ require 'cgi'
+ require 'stringio'
+ ENV['REQUEST_METHOD'] = 'POST'
+ ENV['CONTENT_TYPE'] = 'multipart/form-data; boundary=foobar1234'
+ body = <<-BODY
+--foobar1234
+Content-Disposition: form-data: name=\"name1\"
+
+value1
+--foobar1234
+Content-Disposition: form-data: name=\"file1\"; filename=\"file1.html\"
+Content-Type: text/html
+
+<html>
+<body><p>Hello</p></body>
+</html>
+
+--foobar1234--
+BODY
+ body.gsub!(/\n/, "\r\n")
+ ENV['CONTENT_LENGTH'] = body.size.to_s
+ $stdin = StringIO.new(body)
+ CGI.new
+ EOM
end
###
diff --git a/test/cgi/test_cgi_session.rb b/test/cgi/test_cgi_session.rb
index 7fa7ad7acd..8bd51776ff 100644
--- a/test/cgi/test_cgi_session.rb
+++ b/test/cgi/test_cgi_session.rb
@@ -110,7 +110,7 @@ class CGISessionTest < Test::Unit::TestCase
assert_equal(value1,session["key1"])
assert_equal(value2,session["key2"])
assert_equal("foo",session.session_id)
- session_id=session.session_id
+ #session_id=session.session_id
session.close
$stdout = StringIO.new
cgi.out{""}
diff --git a/test/cgi/test_cgi_tag_helper.rb b/test/cgi/test_cgi_tag_helper.rb
index 29306578b0..c4ea477a12 100644
--- a/test/cgi/test_cgi_tag_helper.rb
+++ b/test/cgi/test_cgi_tag_helper.rb
@@ -338,4 +338,18 @@ class CGITagHelperTest < Test::Unit::TestCase
end
=end
+ def test_cgi_tag_helper_html5
+ @environ = {
+ 'REQUEST_METHOD' => 'GET',
+ }
+ ENV.update(@environ)
+ ## html5
+ cgi = CGI.new('html5')
+ assert_equal('<HEADER></HEADER>',cgi.header)
+ 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 71e8beac3d..de5cfe12bd 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'
@@ -24,15 +24,66 @@ class CGIUtilTest < Test::Unit::TestCase
assert_equal('%26%3C%3E%22+%E3%82%86%E3%82%93%E3%82%86%E3%82%93'.ascii_only?, CGI::escape(@str1).ascii_only?) if defined?(::Encoding)
end
+ 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")))
+ 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)
+ end
+
def test_cgi_unescape
assert_equal(@str1, CGI::unescape('%26%3C%3E%22+%E3%82%86%E3%82%93%E3%82%86%E3%82%93'))
assert_equal(@str1.encoding, CGI::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}", CGI.unescape("\u{30E1 30E2 30EA}%E6%A4%9C%E7%B4%A2"))
end
+ def test_cgi_unescape_preserve_encoding
+ assert_equal(Encoding::US_ASCII, CGI::unescape("%C0%3C%3C".force_encoding("US-ASCII")).encoding)
+ assert_equal(Encoding::ASCII_8BIT, CGI::unescape("%C0%3C%3C".force_encoding("ASCII-8BIT")).encoding)
+ assert_equal(Encoding::UTF_8, CGI::unescape("%C0%3C%3C".force_encoding("UTF-8")).encoding)
+ end
+
def test_cgi_pretty
assert_equal("<HTML>\n <BODY>\n </BODY>\n</HTML>\n",CGI::pretty("<HTML><BODY></BODY></HTML>"))
assert_equal("<HTML>\n\t<BODY>\n\t</BODY>\n</HTML>\n",CGI::pretty("<HTML><BODY></BODY></HTML>","\t"))
end
+ def test_cgi_escapeHTML
+ assert_equal(CGI::escapeHTML("'&\"><"),"&#39;&amp;&quot;&gt;&lt;")
+ end
+
+ def test_cgi_unescapeHTML
+ assert_equal(CGI::unescapeHTML("&#39;&amp;&quot;&gt;&lt;"),"'&\"><")
+ end
+
+ def test_cgi_unescapeHTML_uppercasecharacter
+ 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
end
diff --git a/test/coverage/test_coverage.rb b/test/coverage/test_coverage.rb
index 4d785c3c0e..f4f192a578 100644
--- a/test/coverage/test_coverage.rb
+++ b/test/coverage/test_coverage.rb
@@ -47,7 +47,7 @@ class TestCoverage < Test::Unit::TestCase
Dir.mktmpdir {|tmp|
Dir.chdir(tmp) {
File.open("test.rb", "w") do |f|
- f.puts "p\n" * 10000
+ f.puts "__id__\n" * 10000
f.puts "def ignore(x); end"
f.puts "ignore([1"
f.puts "])"
diff --git a/test/csv/test_encodings.rb b/test/csv/test_encodings.rb
index 5ff6d33821..85ed21a9d6 100755
--- a/test/csv/test_encodings.rb
+++ b/test/csv/test_encodings.rb
@@ -329,7 +329,7 @@ class TestCSV::Encodings < TestCSV
yield encoding
end
end
-
+
def no_warnings
old_verbose, $VERBOSE = $VERBOSE, nil
yield
diff --git a/test/csv/test_features.rb b/test/csv/test_features.rb
index 8610949a35..8c2b3eb2b7 100755
--- a/test/csv/test_features.rb
+++ b/test/csv/test_features.rb
@@ -7,7 +7,10 @@
# Copyright 2005 James Edward Gray II. You can redistribute or modify this code
# under the terms of Ruby's license.
-require "zlib"
+begin
+ require "zlib"
+rescue LoadError
+end
require_relative "base"
require "tempfile"
@@ -206,25 +209,25 @@ class TestCSV::Features < TestCSV
)
end
assert_equal("\r\n", zipped.row_sep)
- end
+ 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
-
- assert( Zlib::GzipReader.open(file) { |f| f.read }.
- include?($INPUT_RECORD_SEPARATOR),
- "@row_sep did not default" )
- tempfile.close(true)
- end
+ 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" )
+ }
+ end if defined?(Zlib::GzipWriter)
def test_inspect_is_smart_about_io_types
str = CSV.new("string,data").inspect
@@ -233,13 +236,13 @@ class TestCSV::Features < TestCSV
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)
+ 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(str.include?("io_type:File"), "IO type not detected.")
+ }
end
def test_inspect_shows_key_attributes
@@ -271,4 +274,37 @@ class TestCSV::Features < TestCSV
assert(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*#/
+ end
+ end
+
+ def test_accepts_comment_defaults_to_nil
+ c = CSV.new nil
+ assert_equal c.skip_lines, nil
+ end
+
+ class RegexStub
+ end
+
+ def test_requires_skip_lines_to_call_match
+ regex_stub = RegexStub.new
+ assert_raise(ArgumentError) do
+ CSV.new nil, :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"]]
+ 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"]]
+ end
end
diff --git a/test/csv/test_interface.rb b/test/csv/test_interface.rb
index 73e6ca9a4a..ad310fae49 100755
--- a/test/csv/test_interface.rb
+++ b/test/csv/test_interface.rb
@@ -40,6 +40,12 @@ 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)
diff --git a/test/csv/test_row.rb b/test/csv/test_row.rb
index 345b7a2342..697c7d56c8 100755
--- a/test/csv/test_row.rb
+++ b/test/csv/test_row.rb
@@ -78,6 +78,33 @@ class TestCSV::Row < TestCSV
assert_equal(nil, @row.field("A", 5))
end
+ def test_fetch
+ # only by name
+ assert_equal(2, @row.fetch('B'))
+
+ # missing header raises KeyError
+ assert_raise KeyError do
+ @row.fetch('foo')
+ end
+
+ # missing header yields itself to block
+ assert_equal 'bar', @row.fetch('foo') { |header|
+ header == 'foo' ? 'bar' : false }
+
+ # missing header returns the given default value
+ assert_equal 'bar', @row.fetch('foo', 'bar')
+
+ # more than one vararg raises ArgumentError
+ assert_raise ArgumentError do
+ @row.fetch('foo', 'bar', 'baz')
+ end
+ end
+
+ def test_has_key?
+ assert_equal(true, @row.has_key?('B'))
+ assert_equal(false, @row.has_key?('foo'))
+ end
+
def test_set_field
# set field by name
assert_equal(100, @row["A"] = 100)
@@ -256,7 +283,7 @@ class TestCSV::Row < TestCSV
assert_equal( [["A", 1], ["A", 4], ["A", nil]],
@row.select { |pair| pair.first == "A" } )
- assert_equal(10, @row.inject(0) { |sum, (header, n)| sum + (n || 0) })
+ assert_equal(10, @row.inject(0) { |sum, (_, n)| sum + (n || 0) })
end
def test_to_a
@@ -310,4 +337,8 @@ class TestCSV::Row < TestCSV
"Header field pair not found." )
end
end
+
+ def test_can_be_compared_with_other_classes
+ assert(CSV::Row.new([ ], [ ]) != nil, "The row was nil")
+ end
end
diff --git a/test/csv/test_serialization.rb b/test/csv/test_serialization.rb
deleted file mode 100755
index dafe12bb38..0000000000
--- a/test/csv/test_serialization.rb
+++ /dev/null
@@ -1,158 +0,0 @@
-#!/usr/bin/env ruby -w
-# encoding: UTF-8
-
-# tc_serialization.rb
-#
-# Created by James Edward Gray II on 2005-10-31.
-# Copyright 2005 James Edward Gray II. You can redistribute or modify this code
-# under the terms of Ruby's license.
-
-require_relative "base"
-require "tempfile"
-
-# An example of how to provide custom CSV serialization.
-class Hash
- def self.csv_load( meta, headers, fields )
- self[*headers.zip(fields).to_a.flatten.map { |e| eval(e) }]
- end
-
- def csv_headers
- keys.map { |key| key.inspect }
- end
-
- def csv_dump( headers )
- headers.map { |header| fetch(eval(header)).inspect }
- end
-end
-
-class TestCSV::Serialization < TestCSV
- extend DifferentOFS
-
- ### Classes Used to Test Serialization ###
-
- class ReadOnlyName
- def initialize( first, last )
- @first, @last = first, last
- end
-
- attr_reader :first, :last
-
- def ==( other )
- %w{first last}.all? { |att| send(att) == other.send(att) }
- end
- end
-
- Name = Struct.new(:first, :last)
-
- class FullName < Name
- def initialize( first, last, suffix = nil )
- super(first, last)
-
- @suffix = suffix
- end
-
- attr_accessor :suffix
-
- def ==( other )
- %w{first last suffix}.all? { |att| send(att) == other.send(att) }
- end
- end
-
- ### Tests ###
-
- def test_class_dump
- @names = [ %w{James Gray},
- %w{Dana Gray},
- %w{Greg Brown} ].map do |first, last|
- ReadOnlyName.new(first, last)
- end
-
- assert_nothing_raised(Exception) do
- @data = CSV.dump(@names)
- end
- assert_equal(<<-END_CLASS_DUMP.gsub(/^\s*/, ""), @data)
- class,TestCSV::Serialization::ReadOnlyName
- @first,@last
- James,Gray
- Dana,Gray
- Greg,Brown
- END_CLASS_DUMP
- end
-
- def test_struct_dump
- @names = [ %w{James Gray},
- %w{Dana Gray},
- %w{Greg Brown} ].map do |first, last|
- Name.new(first, last)
- end
-
- assert_nothing_raised(Exception) do
- @data = CSV.dump(@names)
- end
- assert_equal(<<-END_STRUCT_DUMP.gsub(/^\s*/, ""), @data)
- class,TestCSV::Serialization::Name
- first=,last=
- James,Gray
- Dana,Gray
- Greg,Brown
- END_STRUCT_DUMP
- end
-
- def test_inherited_struct_dump
- @names = [ %w{James Gray II},
- %w{Dana Gray},
- %w{Greg Brown} ].map do |first, last, suffix|
- FullName.new(first, last, suffix)
- end
-
- assert_nothing_raised(Exception) do
- @data = CSV.dump(@names)
- end
- assert_equal(<<-END_STRUCT_DUMP.gsub(/^\s*/, ""), @data)
- class,TestCSV::Serialization::FullName
- @suffix,first=,last=
- II,James,Gray
- ,Dana,Gray
- ,Greg,Brown
- END_STRUCT_DUMP
- end
-
- def test_load
- %w{ test_class_dump
- test_struct_dump
- test_inherited_struct_dump }.each do |test|
- send(test)
- CSV.load(@data).each do |loaded|
- assert_instance_of(@names.first.class, loaded)
- assert_equal(@names.shift, loaded)
- end
- end
- end
-
- def test_io
- test_class_dump
-
- tempfile = Tempfile.new(%w"serialization .csv")
- tempfile.close
- data_file = tempfile.path
- CSV.dump(@names, File.open(data_file, "wb"))
-
- assert(File.exist?(data_file))
- assert_equal(<<-END_IO_DUMP.gsub(/^\s*/, ""), File.read(data_file))
- class,TestCSV::Serialization::ReadOnlyName
- @first,@last
- James,Gray
- Dana,Gray
- Greg,Brown
- END_IO_DUMP
-
- assert_equal(@names, CSV.load(File.open(data_file)))
-
- tempfile.close(true)
- end
-
- def test_custom_dump_and_load
- obj = {1 => "simple", test: Hash}
- assert_equal(obj, CSV.load(CSV.dump([obj])).first)
- end
-end
diff --git a/test/csv/ts_all.rb b/test/csv/ts_all.rb
index 4fadbb46e9..389384168b 100644
--- a/test/csv/ts_all.rb
+++ b/test/csv/ts_all.rb
@@ -17,5 +17,4 @@ require "test_data_converters"
require "test_row"
require "test_table"
require "test_headers"
-require "test_serialization"
require "test_encodings"
diff --git a/test/date/test_date_marshal.rb b/test/date/test_date_marshal.rb
index 2f86a8c8c2..4ea5565716 100644
--- a/test/date/test_date_marshal.rb
+++ b/test/date/test_date_marshal.rb
@@ -24,6 +24,18 @@ class TestDateMarshal < Test::Unit::TestCase
assert_equal(d, d2)
assert_equal(d.start, d2.start)
assert_instance_of(String, d2.to_s)
+
+ d = Date.today
+ a = d.marshal_dump
+ d.freeze
+ assert(d.frozen?)
+ assert_raise(RuntimeError){d.marshal_load(a)}
+
+ d = DateTime.now
+ a = d.marshal_dump
+ d.freeze
+ assert(d.frozen?)
+ assert_raise(RuntimeError){d.marshal_load(a)}
end
end
diff --git a/test/date/test_date_parse.rb b/test/date/test_date_parse.rb
index 1504473938..30976067a4 100644
--- a/test/date/test_date_parse.rb
+++ b/test/date/test_date_parse.rb
@@ -6,471 +6,470 @@ class TestDateParse < Test::Unit::TestCase
def test__parse
[
# ctime(3), asctime(3)
- [['Sat Aug 28 02:55:50 1999',false],[1999,8,28,2,55,50,nil,nil,6]],
- [['Sat Aug 28 02:55:50 02',false],[2,8,28,2,55,50,nil,nil,6]],
- [['Sat Aug 28 02:55:50 02',true],[2002,8,28,2,55,50,nil,nil,6]],
- [['Sat Aug 28 02:55:50 0002',false],[2,8,28,2,55,50,nil,nil,6]],
- [['Sat Aug 28 02:55:50 0002',true],[2,8,28,2,55,50,nil,nil,6]],
+ [['Sat Aug 28 02:55:50 1999',false],[1999,8,28,2,55,50,nil,nil,6], __LINE__],
+ [['Sat Aug 28 02:55:50 02',false],[2,8,28,2,55,50,nil,nil,6], __LINE__],
+ [['Sat Aug 28 02:55:50 02',true],[2002,8,28,2,55,50,nil,nil,6], __LINE__],
+ [['Sat Aug 28 02:55:50 0002',false],[2,8,28,2,55,50,nil,nil,6], __LINE__],
+ [['Sat Aug 28 02:55:50 0002',true],[2,8,28,2,55,50,nil,nil,6], __LINE__],
# date(1)
- [['Sat Aug 28 02:29:34 JST 1999',false],[1999,8,28,2,29,34,'JST',9*3600,6]],
- [['Sat Aug 28 02:29:34 MET DST 1999',false],[1999,8,28,2,29,34,'MET DST',2*3600,6]],
- [['Sat Aug 28 02:29:34 AMT 1999',false],[1999,8,28,2,29,34,'AMT',nil,6]],
- [['Sat Aug 28 02:29:34 PMT 1999',false],[1999,8,28,2,29,34,'PMT',nil,6]],
- [['Sat Aug 28 02:29:34 PMT -1999',false],[-1999,8,28,2,29,34,'PMT',nil,6]],
-
- [['Sat Aug 28 02:29:34 JST 02',false],[2,8,28,2,29,34,'JST',9*3600,6]],
- [['Sat Aug 28 02:29:34 JST 02',true],[2002,8,28,2,29,34,'JST',9*3600,6]],
- [['Sat Aug 28 02:29:34 JST 0002',false],[2,8,28,2,29,34,'JST',9*3600,6]],
- [['Sat Aug 28 02:29:34 JST 0002',true],[2,8,28,2,29,34,'JST',9*3600,6]],
-
- [['Sat Aug 28 02:29:34 GMT+09 0002',false],[2,8,28,2,29,34,'GMT+09',9*3600,6]],
- [['Sat Aug 28 02:29:34 GMT+0900 0002',false],[2,8,28,2,29,34,'GMT+0900',9*3600,6]],
- [['Sat Aug 28 02:29:34 GMT+09:00 0002',false],[2,8,28,2,29,34,'GMT+09:00',9*3600,6]],
- [['Sat Aug 28 02:29:34 GMT-09 0002',false],[2,8,28,2,29,34,'GMT-09',-9*3600,6]],
- [['Sat Aug 28 02:29:34 GMT-0900 0002',false],[2,8,28,2,29,34,'GMT-0900',-9*3600,6]],
- [['Sat Aug 28 02:29:34 GMT-09:00 0002',false],[2,8,28,2,29,34,'GMT-09:00',-9*3600,6]],
- [['Sat Aug 28 02:29:34 GMT-090102 0002',false],[2,8,28,2,29,34,'GMT-090102',-9*3600-60-2,6]],
- [['Sat Aug 28 02:29:34 GMT-09:01:02 0002',false],[2,8,28,2,29,34,'GMT-09:01:02',-9*3600-60-2,6]],
-
- [['Sat Aug 28 02:29:34 GMT Standard Time 2000',false],[2000,8,28,2,29,34,'GMT Standard Time',0*3600,6]],
- [['Sat Aug 28 02:29:34 Mountain Standard Time 2000',false],[2000,8,28,2,29,34,'Mountain Standard Time',-7*3600,6]],
- [['Sat Aug 28 02:29:34 Mountain Daylight Time 2000',false],[2000,8,28,2,29,34,'Mountain Daylight Time',-6*3600,6]],
- [['Sat Aug 28 02:29:34 Mexico Standard Time 2000',false],[2000,8,28,2,29,34,'Mexico Standard Time',-6*3600,6]],
-# [['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]], # 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]],
+ [['Sat Aug 28 02:29:34 JST 1999',false],[1999,8,28,2,29,34,'JST',9*3600,6], __LINE__],
+ [['Sat Aug 28 02:29:34 MET DST 1999',false],[1999,8,28,2,29,34,'MET DST',2*3600,6], __LINE__],
+ [['Sat Aug 28 02:29:34 AMT 1999',false],[1999,8,28,2,29,34,'AMT',nil,6], __LINE__],
+ [['Sat Aug 28 02:29:34 PMT 1999',false],[1999,8,28,2,29,34,'PMT',nil,6], __LINE__],
+ [['Sat Aug 28 02:29:34 PMT -1999',false],[-1999,8,28,2,29,34,'PMT',nil,6], __LINE__],
+
+ [['Sat Aug 28 02:29:34 JST 02',false],[2,8,28,2,29,34,'JST',9*3600,6], __LINE__],
+ [['Sat Aug 28 02:29:34 JST 02',true],[2002,8,28,2,29,34,'JST',9*3600,6], __LINE__],
+ [['Sat Aug 28 02:29:34 JST 0002',false],[2,8,28,2,29,34,'JST',9*3600,6], __LINE__],
+ [['Sat Aug 28 02:29:34 JST 0002',true],[2,8,28,2,29,34,'JST',9*3600,6], __LINE__],
+
+ [['Sat Aug 28 02:29:34 GMT+09 0002',false],[2,8,28,2,29,34,'GMT+09',9*3600,6], __LINE__],
+ [['Sat Aug 28 02:29:34 GMT+0900 0002',false],[2,8,28,2,29,34,'GMT+0900',9*3600,6], __LINE__],
+ [['Sat Aug 28 02:29:34 GMT+09:00 0002',false],[2,8,28,2,29,34,'GMT+09:00',9*3600,6], __LINE__],
+ [['Sat Aug 28 02:29:34 GMT-09 0002',false],[2,8,28,2,29,34,'GMT-09',-9*3600,6], __LINE__],
+ [['Sat Aug 28 02:29:34 GMT-0900 0002',false],[2,8,28,2,29,34,'GMT-0900',-9*3600,6], __LINE__],
+ [['Sat Aug 28 02:29:34 GMT-09:00 0002',false],[2,8,28,2,29,34,'GMT-09:00',-9*3600,6], __LINE__],
+ [['Sat Aug 28 02:29:34 GMT-090102 0002',false],[2,8,28,2,29,34,'GMT-090102',-9*3600-60-2,6], __LINE__],
+ [['Sat Aug 28 02:29:34 GMT-09:01:02 0002',false],[2,8,28,2,29,34,'GMT-09:01:02',-9*3600-60-2,6], __LINE__],
+
+ [['Sat Aug 28 02:29:34 GMT Standard Time 2000',false],[2000,8,28,2,29,34,'GMT Standard Time',0*3600,6], __LINE__],
+ [['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
- [['1999-05-23 23:55:21',false],[1999,5,23,23,55,21,nil,nil,nil]],
- [['1999-05-23 23:55:21+0900',false],[1999,5,23,23,55,21,'+0900',9*3600,nil]],
- [['1999-05-23 23:55:21-0900',false],[1999,5,23,23,55,21,'-0900',-9*3600,nil]],
- [['1999-05-23 23:55:21+09:00',false],[1999,5,23,23,55,21,'+09:00',9*3600,nil]],
- [['1999-05-23T23:55:21-09:00',false],[1999,5,23,23,55,21,'-09:00',-9*3600,nil]],
- [['1999-05-23 23:55:21Z',false],[1999,5,23,23,55,21,'Z',0,nil]],
- [['1999-05-23T23:55:21Z',false],[1999,5,23,23,55,21,'Z',0,nil]],
- [['-1999-05-23T23:55:21Z',false],[-1999,5,23,23,55,21,'Z',0,nil]],
- [['-1999-05-23T23:55:21Z',true],[-1999,5,23,23,55,21,'Z',0,nil]],
- [['19990523T23:55:21Z',false],[1999,5,23,23,55,21,'Z',0,nil]],
-
- [['+011985-04-12',false],[11985,4,12,nil,nil,nil,nil,nil,nil]],
- [['+011985-04-12T10:15:30',false],[11985,4,12,10,15,30,nil,nil,nil]],
- [['-011985-04-12',false],[-11985,4,12,nil,nil,nil,nil,nil,nil]],
- [['-011985-04-12T10:15:30',false],[-11985,4,12,10,15,30,nil,nil,nil]],
-
- [['02-04-12',false],[2,4,12,nil,nil,nil,nil,nil,nil]],
- [['02-04-12',true],[2002,4,12,nil,nil,nil,nil,nil,nil]],
- [['0002-04-12',false],[2,4,12,nil,nil,nil,nil,nil,nil]],
- [['0002-04-12',true],[2,4,12,nil,nil,nil,nil,nil,nil]],
-
- [['19990523',true],[1999,5,23,nil,nil,nil,nil,nil,nil]],
- [['-19990523',true],[-1999,5,23,nil,nil,nil,nil,nil,nil]],
- [['990523',true],[1999,5,23,nil,nil,nil,nil,nil,nil]],
- [['0523',false],[nil,5,23,nil,nil,nil,nil,nil,nil]],
- [['23',false],[nil,nil,23,nil,nil,nil,nil,nil,nil]],
-
- [['19990523 235521',true],[1999,5,23,23,55,21,nil,nil,nil]],
- [['990523 235521',true],[1999,5,23,23,55,21,nil,nil,nil]],
- [['0523 2355',false],[nil,5,23,23,55,nil,nil,nil,nil]],
- [['23 2355',false],[nil,nil,23,23,55,nil,nil,nil,nil]],
-
- [['19990523T235521',true],[1999,5,23,23,55,21,nil,nil,nil]],
- [['990523T235521',true],[1999,5,23,23,55,21,nil,nil,nil]],
- [['19990523T235521.99',true],[1999,5,23,23,55,21,nil,nil,nil]],
- [['990523T235521.99',true],[1999,5,23,23,55,21,nil,nil,nil]],
- [['0523T2355',false],[nil,5,23,23,55,nil,nil,nil,nil]],
-
- [['19990523T235521+0900',true],[1999,5,23,23,55,21,'+0900',9*3600,nil]],
- [['990523T235521-0900',true],[1999,5,23,23,55,21,'-0900',-9*3600,nil]],
- [['19990523T235521.99+0900',true],[1999,5,23,23,55,21,'+0900',9*3600,nil]],
- [['990523T235521.99-0900',true],[1999,5,23,23,55,21,'-0900',-9*3600,nil]],
- [['0523T2355Z',false],[nil,5,23,23,55,nil,'Z',0,nil]],
-
- [['19990523235521.123456+0900',true],[1999,5,23,23,55,21,'+0900',9*3600,nil]],
- [['19990523235521.123456-0900',true],[1999,5,23,23,55,21,'-0900',-9*3600,nil]],
- [['19990523235521,123456+0900',true],[1999,5,23,23,55,21,'+0900',9*3600,nil]],
- [['19990523235521,123456-0900',true],[1999,5,23,23,55,21,'-0900',-9*3600,nil]],
-
- [['990523235521,123456-0900',false],[99,5,23,23,55,21,'-0900',-9*3600,nil]],
- [['0523235521,123456-0900',false],[nil,5,23,23,55,21,'-0900',-9*3600,nil]],
- [['23235521,123456-0900',false],[nil,nil,23,23,55,21,'-0900',-9*3600,nil]],
- [['235521,123456-0900',false],[nil,nil,nil,23,55,21,'-0900',-9*3600,nil]],
- [['5521,123456-0900',false],[nil,nil,nil,nil,55,21,'-0900',-9*3600,nil]],
- [['21,123456-0900',false],[nil,nil,nil,nil,nil,21,'-0900',-9*3600,nil]],
-
- [['3235521,123456-0900',false],[nil,nil,3,23,55,21,'-0900',-9*3600,nil]],
- [['35521,123456-0900',false],[nil,nil,nil,3,55,21,'-0900',-9*3600,nil]],
- [['521,123456-0900',false],[nil,nil,nil,nil,5,21,'-0900',-9*3600,nil]],
+ [['1999-05-23 23:55:21',false],[1999,5,23,23,55,21,nil,nil,nil], __LINE__],
+ [['1999-05-23 23:55:21+0900',false],[1999,5,23,23,55,21,'+0900',9*3600,nil], __LINE__],
+ [['1999-05-23 23:55:21-0900',false],[1999,5,23,23,55,21,'-0900',-9*3600,nil], __LINE__],
+ [['1999-05-23 23:55:21+09:00',false],[1999,5,23,23,55,21,'+09:00',9*3600,nil], __LINE__],
+ [['1999-05-23T23:55:21-09:00',false],[1999,5,23,23,55,21,'-09:00',-9*3600,nil], __LINE__],
+ [['1999-05-23 23:55:21Z',false],[1999,5,23,23,55,21,'Z',0,nil], __LINE__],
+ [['1999-05-23T23:55:21Z',false],[1999,5,23,23,55,21,'Z',0,nil], __LINE__],
+ [['-1999-05-23T23:55:21Z',false],[-1999,5,23,23,55,21,'Z',0,nil], __LINE__],
+ [['-1999-05-23T23:55:21Z',true],[-1999,5,23,23,55,21,'Z',0,nil], __LINE__],
+ [['19990523T23:55:21Z',false],[1999,5,23,23,55,21,'Z',0,nil], __LINE__],
+
+ [['+011985-04-12',false],[11985,4,12,nil,nil,nil,nil,nil,nil], __LINE__],
+ [['+011985-04-12T10:15:30',false],[11985,4,12,10,15,30,nil,nil,nil], __LINE__],
+ [['-011985-04-12',false],[-11985,4,12,nil,nil,nil,nil,nil,nil], __LINE__],
+ [['-011985-04-12T10:15:30',false],[-11985,4,12,10,15,30,nil,nil,nil], __LINE__],
+
+ [['02-04-12',false],[2,4,12,nil,nil,nil,nil,nil,nil], __LINE__],
+ [['02-04-12',true],[2002,4,12,nil,nil,nil,nil,nil,nil], __LINE__],
+ [['0002-04-12',false],[2,4,12,nil,nil,nil,nil,nil,nil], __LINE__],
+ [['0002-04-12',true],[2,4,12,nil,nil,nil,nil,nil,nil], __LINE__],
+
+ [['19990523',true],[1999,5,23,nil,nil,nil,nil,nil,nil], __LINE__],
+ [['-19990523',true],[-1999,5,23,nil,nil,nil,nil,nil,nil], __LINE__],
+ [['990523',true],[1999,5,23,nil,nil,nil,nil,nil,nil], __LINE__],
+ [['0523',false],[nil,5,23,nil,nil,nil,nil,nil,nil], __LINE__],
+ [['23',false],[nil,nil,23,nil,nil,nil,nil,nil,nil], __LINE__],
+
+ [['19990523 235521',true],[1999,5,23,23,55,21,nil,nil,nil], __LINE__],
+ [['990523 235521',true],[1999,5,23,23,55,21,nil,nil,nil], __LINE__],
+ [['0523 2355',false],[nil,5,23,23,55,nil,nil,nil,nil], __LINE__],
+ [['23 2355',false],[nil,nil,23,23,55,nil,nil,nil,nil], __LINE__],
+
+ [['19990523T235521',true],[1999,5,23,23,55,21,nil,nil,nil], __LINE__],
+ [['990523T235521',true],[1999,5,23,23,55,21,nil,nil,nil], __LINE__],
+ [['19990523T235521.99',true],[1999,5,23,23,55,21,nil,nil,nil], __LINE__],
+ [['990523T235521.99',true],[1999,5,23,23,55,21,nil,nil,nil], __LINE__],
+ [['0523T2355',false],[nil,5,23,23,55,nil,nil,nil,nil], __LINE__],
+
+ [['19990523T235521+0900',true],[1999,5,23,23,55,21,'+0900',9*3600,nil], __LINE__],
+ [['990523T235521-0900',true],[1999,5,23,23,55,21,'-0900',-9*3600,nil], __LINE__],
+ [['19990523T235521.99+0900',true],[1999,5,23,23,55,21,'+0900',9*3600,nil], __LINE__],
+ [['990523T235521.99-0900',true],[1999,5,23,23,55,21,'-0900',-9*3600,nil], __LINE__],
+ [['0523T2355Z',false],[nil,5,23,23,55,nil,'Z',0,nil], __LINE__],
+
+ [['19990523235521.123456+0900',true],[1999,5,23,23,55,21,'+0900',9*3600,nil], __LINE__],
+ [['19990523235521.123456-0900',true],[1999,5,23,23,55,21,'-0900',-9*3600,nil], __LINE__],
+ [['19990523235521,123456+0900',true],[1999,5,23,23,55,21,'+0900',9*3600,nil], __LINE__],
+ [['19990523235521,123456-0900',true],[1999,5,23,23,55,21,'-0900',-9*3600,nil], __LINE__],
+
+ [['990523235521,123456-0900',false],[99,5,23,23,55,21,'-0900',-9*3600,nil], __LINE__],
+ [['0523235521,123456-0900',false],[nil,5,23,23,55,21,'-0900',-9*3600,nil], __LINE__],
+ [['23235521,123456-0900',false],[nil,nil,23,23,55,21,'-0900',-9*3600,nil], __LINE__],
+ [['235521,123456-0900',false],[nil,nil,nil,23,55,21,'-0900',-9*3600,nil], __LINE__],
+ [['5521,123456-0900',false],[nil,nil,nil,nil,55,21,'-0900',-9*3600,nil], __LINE__],
+ [['21,123456-0900',false],[nil,nil,nil,nil,nil,21,'-0900',-9*3600,nil], __LINE__],
+
+ [['3235521,123456-0900',false],[nil,nil,3,23,55,21,'-0900',-9*3600,nil], __LINE__],
+ [['35521,123456-0900',false],[nil,nil,nil,3,55,21,'-0900',-9*3600,nil], __LINE__],
+ [['521,123456-0900',false],[nil,nil,nil,nil,5,21,'-0900',-9*3600,nil], __LINE__],
# reversed iso 8601 (?)
- [['23-05-1999',false],[1999,5,23,nil,nil,nil,nil,nil,nil]],
- [['23-05-1999 23:55:21',false],[1999,5,23,23,55,21,nil,nil,nil]],
- [['23-05--1999 23:55:21',false],[-1999,5,23,23,55,21,nil,nil,nil]],
- [["23-05-'99",false],[99,5,23,nil,nil,nil,nil,nil,nil]],
- [["23-05-'99",true],[1999,5,23,nil,nil,nil,nil,nil,nil]],
+ [['23-05-1999',false],[1999,5,23,nil,nil,nil,nil,nil,nil], __LINE__],
+ [['23-05-1999 23:55:21',false],[1999,5,23,23,55,21,nil,nil,nil], __LINE__],
+ [['23-05--1999 23:55:21',false],[-1999,5,23,23,55,21,nil,nil,nil], __LINE__],
+ [["23-05-'99",false],[99,5,23,nil,nil,nil,nil,nil,nil], __LINE__],
+ [["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]], # cp
- [['19990523T23:55:21Z',false],[1999,5,23,23,55,21,'Z',0,nil]],
- [['19990523235521.1234-100',true],[1999,5,23,23,55,21,'-100',-1*3600,nil]],
- [['19990523235521.1234-10',true],[1999,5,23,23,55,21,'-10',-10*3600,nil]],
+# [['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__],
# part of jis x0301
- [['M11.05.23',false],[1878,5,23,nil,nil,nil,nil,nil,nil]],
- [['T11.05.23 23:55:21+0900',false],[1922,5,23,23,55,21,'+0900',9*3600,nil]],
- [['S11.05.23 23:55:21-0900',false],[1936,5,23,23,55,21,'-0900',-9*3600,nil]],
- [['S40.05.23 23:55:21+09:00',false],[1965,5,23,23,55,21,'+09:00',9*3600,nil]],
- [['S40.05.23T23:55:21-09:00',false],[1965,5,23,23,55,21,'-09:00',-9*3600,nil]],
- [['H11.05.23 23:55:21Z',false],[1999,5,23,23,55,21,'Z',0,nil]],
- [['H11.05.23T23:55:21Z',false],[1999,5,23,23,55,21,'Z',0,nil]],
+ [['M11.05.23',false],[1878,5,23,nil,nil,nil,nil,nil,nil], __LINE__],
+ [['T11.05.23 23:55:21+0900',false],[1922,5,23,23,55,21,'+0900',9*3600,nil], __LINE__],
+ [['S11.05.23 23:55:21-0900',false],[1936,5,23,23,55,21,'-0900',-9*3600,nil], __LINE__],
+ [['S40.05.23 23:55:21+09:00',false],[1965,5,23,23,55,21,'+09:00',9*3600,nil], __LINE__],
+ [['S40.05.23T23:55:21-09:00',false],[1965,5,23,23,55,21,'-09:00',-9*3600,nil], __LINE__],
+ [['H11.05.23 23:55:21Z',false],[1999,5,23,23,55,21,'Z',0,nil], __LINE__],
+ [['H11.05.23T23:55:21Z',false],[1999,5,23,23,55,21,'Z',0,nil], __LINE__],
# ofx date
- [['19990523235521',false],[1999,5,23,23,55,21,nil,nil,nil]],
- [['19990523235521.123',false],[1999,5,23,23,55,21,nil,nil,nil]],
- [['19990523235521.123[-9]',false],[1999,5,23,23,55,21,'-9',-(9*3600),nil]],
- [['19990523235521.123[+9]',false],[1999,5,23,23,55,21,'+9',+(9*3600),nil]],
- [['19990523235521.123[9]',false],[1999,5,23,23,55,21,'9',+(9*3600),nil]],
- [['19990523235521.123[-9.50]',false],[1999,5,23,23,55,21,'-9.50',-(9*3600+30*60),nil]],
- [['19990523235521.123[+9.50]',false],[1999,5,23,23,55,21,'+9.50',+(9*3600+30*60),nil]],
- [['19990523235521.123[-5:EST]',false],[1999,5,23,23,55,21,'EST',-5*3600,nil]],
- [['19990523235521.123[+9:JST]',false],[1999,5,23,23,55,21,'JST',9*3600,nil]],
- [['19990523235521.123[+12:XXX YYY ZZZ]',false],[1999,5,23,23,55,21,'XXX YYY ZZZ',12*3600,nil]],
-# [['235521',false],[nil,nil,nil,23,55,21,nil,nil,nil]], # cp
- [['235521.123',false],[nil,nil,nil,23,55,21,nil,nil,nil]],
- [['235521.123[-9]',false],[nil,nil,nil,23,55,21,'-9',-9*3600,nil]],
- [['235521.123[+9]',false],[nil,nil,nil,23,55,21,'+9',+9*3600,nil]],
- [['235521.123[-5:EST]',false],[nil,nil,nil,23,55,21,'EST',-5*3600,nil]],
- [['235521.123[+9:JST]',false],[nil,nil,nil,23,55,21,'JST',+9*3600,nil]],
+ [['19990523235521',false],[1999,5,23,23,55,21,nil,nil,nil], __LINE__],
+ [['19990523235521.123',false],[1999,5,23,23,55,21,nil,nil,nil], __LINE__],
+ [['19990523235521.123[-9]',false],[1999,5,23,23,55,21,'-9',-(9*3600),nil], __LINE__],
+ [['19990523235521.123[+9]',false],[1999,5,23,23,55,21,'+9',+(9*3600),nil], __LINE__],
+ [['19990523235521.123[9]',false],[1999,5,23,23,55,21,'9',+(9*3600),nil], __LINE__],
+ [['19990523235521.123[-9.50]',false],[1999,5,23,23,55,21,'-9.50',-(9*3600+30*60),nil], __LINE__],
+ [['19990523235521.123[+9.50]',false],[1999,5,23,23,55,21,'+9.50',+(9*3600+30*60),nil], __LINE__],
+ [['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__],
+ [['235521.123[-5:EST]',false],[nil,nil,nil,23,55,21,'EST',-5*3600,nil], __LINE__],
+ [['235521.123[+9:JST]',false],[nil,nil,nil,23,55,21,'JST',+9*3600,nil], __LINE__],
# rfc 2822
- [['Sun, 22 Aug 1999 00:45:29 -0400',false],[1999,8,22,0,45,29,'-0400',-4*3600,0]],
- [['Sun, 22 Aug 1999 00:45:29 -9959',false],[1999,8,22,0,45,29,'-9959',-(99*3600+59*60),0]],
- [['Sun, 22 Aug 1999 00:45:29 +9959',false],[1999,8,22,0,45,29,'+9959',+(99*3600+59*60),0]],
- [['Sun, 22 Aug 05 00:45:29 -0400',true],[2005,8,22,0,45,29,'-0400',-4*3600,0]],
- [['Sun, 22 Aug 49 00:45:29 -0400',true],[2049,8,22,0,45,29,'-0400',-4*3600,0]],
-# [['Sun, 22 Aug 50 00:45:29 -0400',true],[1950,8,22,0,45,29,'-0400',-4*3600,0]],
-# [['Sun, 22 Aug 111 00:45:29 -0400',true],[2011,8,22,0,45,29,'-0400',-4*3600,0]],
- [['Sun, 22 Aug 1999 00:45:29 GMT',false],[1999,8,22,0,45,29,'GMT',0,0]],
- [["Sun,\00022\r\nAug\r\n1999\r\n00:45:29\r\nGMT",false],[1999,8,22,0,45,29,'GMT',0,0]],
- [['Sun, 22 Aug 1999 00:45 GMT',false],[1999,8,22,0,45,nil,'GMT',0,0]],
- [['Sun, 22 Aug -1999 00:45 GMT',false],[-1999,8,22,0,45,nil,'GMT',0,0]],
- [['Sun, 22 Aug 99 00:45:29 UT',true],[1999,8,22,0,45,29,'UT',0,0]],
- [['Sun, 22 Aug 0099 00:45:29 UT',true],[99,8,22,0,45,29,'UT',0,0]],
+ [['Sun, 22 Aug 1999 00:45:29 -0400',false],[1999,8,22,0,45,29,'-0400',-4*3600,0], __LINE__],
+ [['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 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__],
+ [['Sun, 22 Aug -1999 00:45 GMT',false],[-1999,8,22,0,45,nil,'GMT',0,0], __LINE__],
+ [['Sun, 22 Aug 99 00:45:29 UT',true],[1999,8,22,0,45,29,'UT',0,0], __LINE__],
+ [['Sun, 22 Aug 0099 00:45:29 UT',true],[99,8,22,0,45,29,'UT',0,0], __LINE__],
# rfc 850, obsoleted by rfc 1036
- [['Tuesday, 02-Mar-99 11:20:32 GMT',true],[1999,3,2,11,20,32,'GMT',0,2]],
+ [['Tuesday, 02-Mar-99 11:20:32 GMT',true],[1999,3,2,11,20,32,'GMT',0,2], __LINE__],
# W3C Working Draft - XForms - 4.8 Time
- [['2000-01-31 13:20:00-5',false],[2000,1,31,13,20,0,'-5',-5*3600,nil]],
+ [['2000-01-31 13:20:00-5',false],[2000,1,31,13,20,0,'-5',-5*3600,nil], __LINE__],
# [-+]\d+.\d+
- [['2000-01-31 13:20:00-5.5',false],[2000,1,31,13,20,0,'-5.5',-5*3600-30*60,nil]],
- [['2000-01-31 13:20:00-5,5',false],[2000,1,31,13,20,0,'-5,5',-5*3600-30*60,nil]],
- [['2000-01-31 13:20:00+3.5',false],[2000,1,31,13,20,0,'+3.5',3*3600+30*60,nil]],
- [['2000-01-31 13:20:00+3,5',false],[2000,1,31,13,20,0,'+3,5',3*3600+30*60,nil]],
+ [['2000-01-31 13:20:00-5.5',false],[2000,1,31,13,20,0,'-5.5',-5*3600-30*60,nil], __LINE__],
+ [['2000-01-31 13:20:00-5,5',false],[2000,1,31,13,20,0,'-5,5',-5*3600-30*60,nil], __LINE__],
+ [['2000-01-31 13:20:00+3.5',false],[2000,1,31,13,20,0,'+3.5',3*3600+30*60,nil], __LINE__],
+ [['2000-01-31 13:20:00+3,5',false],[2000,1,31,13,20,0,'+3,5',3*3600+30*60,nil], __LINE__],
# mil
- [['2000-01-31 13:20:00 Z',false],[2000,1,31,13,20,0,'Z',0*3600,nil]],
- [['2000-01-31 13:20:00 H',false],[2000,1,31,13,20,0,'H',8*3600,nil]],
- [['2000-01-31 13:20:00 M',false],[2000,1,31,13,20,0,'M',12*3600,nil]],
- [['2000-01-31 13:20 M',false],[2000,1,31,13,20,nil,'M',12*3600,nil]],
- [['2000-01-31 13:20:00 S',false],[2000,1,31,13,20,0,'S',-6*3600,nil]],
- [['2000-01-31 13:20:00 A',false],[2000,1,31,13,20,0,'A',1*3600,nil]],
- [['2000-01-31 13:20:00 P',false],[2000,1,31,13,20,0,'P',-3*3600,nil]],
+ [['2000-01-31 13:20:00 Z',false],[2000,1,31,13,20,0,'Z',0*3600,nil], __LINE__],
+ [['2000-01-31 13:20:00 H',false],[2000,1,31,13,20,0,'H',8*3600,nil], __LINE__],
+ [['2000-01-31 13:20:00 M',false],[2000,1,31,13,20,0,'M',12*3600,nil], __LINE__],
+ [['2000-01-31 13:20 M',false],[2000,1,31,13,20,nil,'M',12*3600,nil], __LINE__],
+ [['2000-01-31 13:20:00 S',false],[2000,1,31,13,20,0,'S',-6*3600,nil], __LINE__],
+ [['2000-01-31 13:20:00 A',false],[2000,1,31,13,20,0,'A',1*3600,nil], __LINE__],
+ [['2000-01-31 13:20:00 P',false],[2000,1,31,13,20,0,'P',-3*3600,nil], __LINE__],
# dot
- [['1999.5.2',false],[1999,5,2,nil,nil,nil,nil,nil,nil]],
- [['1999.05.02',false],[1999,5,2,nil,nil,nil,nil,nil,nil]],
- [['-1999.05.02',false],[-1999,5,2,nil,nil,nil,nil,nil,nil]],
-# [['05.02',false],[nil,5,2,nil,nil,nil,nil,nil,nil]], # not support
-# [[' 5. 2',false],[nil,5,2,nil,nil,nil,nil,nil,nil]], # not support
+ [['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]],
- [['0099.5.2',true],[99,5,2,nil,nil,nil,nil,nil,nil]],
+ [['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__],
- [["'99.5.2",false],[99,5,2,nil,nil,nil,nil,nil,nil]],
- [["'99.5.2",true],[1999,5,2,nil,nil,nil,nil,nil,nil]],
+ [["'99.5.2",false],[99,5,2,nil,nil,nil,nil,nil,nil], __LINE__],
+ [["'99.5.2",true],[1999,5,2,nil,nil,nil,nil,nil,nil], __LINE__],
# reversed dot
- [['2.5.1999',false],[1999,5,2,nil,nil,nil,nil,nil,nil]],
- [['02.05.1999',false],[1999,5,2,nil,nil,nil,nil,nil,nil]],
- [['02.05.-1999',false],[-1999,5,2,nil,nil,nil,nil,nil,nil]],
+ [['2.5.1999',false],[1999,5,2,nil,nil,nil,nil,nil,nil], __LINE__],
+ [['02.05.1999',false],[1999,5,2,nil,nil,nil,nil,nil,nil], __LINE__],
+ [['02.05.-1999',false],[-1999,5,2,nil,nil,nil,nil,nil,nil], __LINE__],
- [['2.5.0099',false],[99,5,2,nil,nil,nil,nil,nil,nil]],
- [['2.5.0099',true],[99,5,2,nil,nil,nil,nil,nil,nil]],
+ [['2.5.0099',false],[99,5,2,nil,nil,nil,nil,nil,nil], __LINE__],
+ [['2.5.0099',true],[99,5,2,nil,nil,nil,nil,nil,nil], __LINE__],
- [["2.5.'99",false],[99,5,2,nil,nil,nil,nil,nil,nil]],
- [["2.5.'99",true],[1999,5,2,nil,nil,nil,nil,nil,nil]],
+ [["2.5.'99",false],[99,5,2,nil,nil,nil,nil,nil,nil], __LINE__],
+ [["2.5.'99",true],[1999,5,2,nil,nil,nil,nil,nil,nil], __LINE__],
# vms
- [['08-DEC-1988',false],[1988,12,8,nil,nil,nil,nil,nil,nil]],
- [['31-JAN-1999',false],[1999,1,31,nil,nil,nil,nil,nil,nil]],
- [['31-JAN--1999',false],[-1999,1,31,nil,nil,nil,nil,nil,nil]],
+ [['08-DEC-1988',false],[1988,12,8,nil,nil,nil,nil,nil,nil], __LINE__],
+ [['31-JAN-1999',false],[1999,1,31,nil,nil,nil,nil,nil,nil], __LINE__],
+ [['31-JAN--1999',false],[-1999,1,31,nil,nil,nil,nil,nil,nil], __LINE__],
- [['08-DEC-88',false],[88,12,8,nil,nil,nil,nil,nil,nil]],
- [['08-DEC-88',true],[1988,12,8,nil,nil,nil,nil,nil,nil]],
- [['08-DEC-0088',false],[88,12,8,nil,nil,nil,nil,nil,nil]],
- [['08-DEC-0088',true],[88,12,8,nil,nil,nil,nil,nil,nil]],
+ [['08-DEC-88',false],[88,12,8,nil,nil,nil,nil,nil,nil], __LINE__],
+ [['08-DEC-88',true],[1988,12,8,nil,nil,nil,nil,nil,nil], __LINE__],
+ [['08-DEC-0088',false],[88,12,8,nil,nil,nil,nil,nil,nil], __LINE__],
+ [['08-DEC-0088',true],[88,12,8,nil,nil,nil,nil,nil,nil], __LINE__],
# swaped vms
- [['DEC-08-1988',false],[1988,12,8,nil,nil,nil,nil,nil,nil]],
- [['JAN-31-1999',false],[1999,1,31,nil,nil,nil,nil,nil,nil]],
- [['JAN-31--1999',false],[-1999,1,31,nil,nil,nil,nil,nil,nil]],
- [['JAN-1999',false],[1999,1,nil,nil,nil,nil,nil,nil,nil]],
- [['JAN--1999',false],[-1999,1,nil,nil,nil,nil,nil,nil,nil]],
+ [['DEC-08-1988',false],[1988,12,8,nil,nil,nil,nil,nil,nil], __LINE__],
+ [['JAN-31-1999',false],[1999,1,31,nil,nil,nil,nil,nil,nil], __LINE__],
+ [['JAN-31--1999',false],[-1999,1,31,nil,nil,nil,nil,nil,nil], __LINE__],
+ [['JAN-1999',false],[1999,1,nil,nil,nil,nil,nil,nil,nil], __LINE__],
+ [['JAN--1999',false],[-1999,1,nil,nil,nil,nil,nil,nil,nil], __LINE__],
# reversed vms
- [['1988-DEC-08',false],[1988,12,8,nil,nil,nil,nil,nil,nil]],
- [['1999-JAN-31',false],[1999,1,31,nil,nil,nil,nil,nil,nil]],
- [['-1999-JAN-31',false],[-1999,1,31,nil,nil,nil,nil,nil,nil]],
+ [['1988-DEC-08',false],[1988,12,8,nil,nil,nil,nil,nil,nil], __LINE__],
+ [['1999-JAN-31',false],[1999,1,31,nil,nil,nil,nil,nil,nil], __LINE__],
+ [['-1999-JAN-31',false],[-1999,1,31,nil,nil,nil,nil,nil,nil], __LINE__],
- [['0088-DEC-08',false],[88,12,8,nil,nil,nil,nil,nil,nil]],
- [['0088-DEC-08',true],[88,12,8,nil,nil,nil,nil,nil,nil]],
+ [['0088-DEC-08',false],[88,12,8,nil,nil,nil,nil,nil,nil], __LINE__],
+ [['0088-DEC-08',true],[88,12,8,nil,nil,nil,nil,nil,nil], __LINE__],
- [["'88/12/8",false],[88,12,8,nil,nil,nil,nil,nil,nil]],
- [["'88/12/8",true],[1988,12,8,nil,nil,nil,nil,nil,nil]],
+ [["'88/12/8",false],[88,12,8,nil,nil,nil,nil,nil,nil], __LINE__],
+ [["'88/12/8",true],[1988,12,8,nil,nil,nil,nil,nil,nil], __LINE__],
# non-spaced eu
- [['08/dec/1988',false],[1988,12,8,nil,nil,nil,nil,nil,nil]],
- [['31/jan/1999',false],[1999,1,31,nil,nil,nil,nil,nil,nil]],
- [['31/jan/-1999',false],[-1999,1,31,nil,nil,nil,nil,nil,nil]],
- [['08.dec.1988',false],[1988,12,8,nil,nil,nil,nil,nil,nil]],
- [['31.jan.1999',false],[1999,1,31,nil,nil,nil,nil,nil,nil]],
- [['31.jan.-1999',false],[-1999,1,31,nil,nil,nil,nil,nil,nil]],
+ [['08/dec/1988',false],[1988,12,8,nil,nil,nil,nil,nil,nil], __LINE__],
+ [['31/jan/1999',false],[1999,1,31,nil,nil,nil,nil,nil,nil], __LINE__],
+ [['31/jan/-1999',false],[-1999,1,31,nil,nil,nil,nil,nil,nil], __LINE__],
+ [['08.dec.1988',false],[1988,12,8,nil,nil,nil,nil,nil,nil], __LINE__],
+ [['31.jan.1999',false],[1999,1,31,nil,nil,nil,nil,nil,nil], __LINE__],
+ [['31.jan.-1999',false],[-1999,1,31,nil,nil,nil,nil,nil,nil], __LINE__],
# non-spaced us
- [['dec/08/1988',false],[1988,12,8,nil,nil,nil,nil,nil,nil]],
- [['jan/31/1999',false],[1999,1,31,nil,nil,nil,nil,nil,nil]],
- [['jan/31/-1999',false],[-1999,1,31,nil,nil,nil,nil,nil,nil]],
- [['jan/31',false],[nil,1,31,nil,nil,nil,nil,nil,nil]],
- [['jan/1988',false],[1988,1,nil,nil,nil,nil,nil,nil,nil]],
- [['dec.08.1988',false],[1988,12,8,nil,nil,nil,nil,nil,nil]],
- [['jan.31.1999',false],[1999,1,31,nil,nil,nil,nil,nil,nil]],
- [['jan.31.-1999',false],[-1999,1,31,nil,nil,nil,nil,nil,nil]],
- [['jan.31',false],[nil,1,31,nil,nil,nil,nil,nil,nil]],
- [['jan.1988',false],[1988,1,nil,nil,nil,nil,nil,nil,nil]],
+ [['dec/08/1988',false],[1988,12,8,nil,nil,nil,nil,nil,nil], __LINE__],
+ [['jan/31/1999',false],[1999,1,31,nil,nil,nil,nil,nil,nil], __LINE__],
+ [['jan/31/-1999',false],[-1999,1,31,nil,nil,nil,nil,nil,nil], __LINE__],
+ [['jan/31',false],[nil,1,31,nil,nil,nil,nil,nil,nil], __LINE__],
+ [['jan/1988',false],[1988,1,nil,nil,nil,nil,nil,nil,nil], __LINE__],
+ [['dec.08.1988',false],[1988,12,8,nil,nil,nil,nil,nil,nil], __LINE__],
+ [['jan.31.1999',false],[1999,1,31,nil,nil,nil,nil,nil,nil], __LINE__],
+ [['jan.31.-1999',false],[-1999,1,31,nil,nil,nil,nil,nil,nil], __LINE__],
+ [['jan.31',false],[nil,1,31,nil,nil,nil,nil,nil,nil], __LINE__],
+ [['jan.1988',false],[1988,1,nil,nil,nil,nil,nil,nil,nil], __LINE__],
# month and day of month
- [['Jan 1',false],[nil,1,1,nil,nil,nil,nil,nil,nil]],
- [['Jul 11',false],[nil,7,11,nil,nil,nil,nil,nil,nil]],
- [['July 11',false],[nil,7,11,nil,nil,nil,nil,nil,nil]],
- [['Sept 23',false],[nil,9,23,nil,nil,nil,nil,nil,nil]],
- [['Sep. 23',false],[nil,9,23,nil,nil,nil,nil,nil,nil]],
- [['Sept. 23',false],[nil,9,23,nil,nil,nil,nil,nil,nil]],
- [['September 23',false],[nil,9,23,nil,nil,nil,nil,nil,nil]],
- [['October 1st',false],[nil,10,1,nil,nil,nil,nil,nil,nil]],
- [['October 23rd',false],[nil,10,23,nil,nil,nil,nil,nil,nil]],
- [['October 25th 1999',false],[1999,10,25,nil,nil,nil,nil,nil,nil]],
- [['October 25th -1999',false],[-1999,10,25,nil,nil,nil,nil,nil,nil]],
- [['october 25th 1999',false],[1999,10,25,nil,nil,nil,nil,nil,nil]],
- [['OCTOBER 25th 1999',false],[1999,10,25,nil,nil,nil,nil,nil,nil]],
- [['oCtoBer 25th 1999',false],[1999,10,25,nil,nil,nil,nil,nil,nil]],
- [['aSep 23',false],[nil,nil,23,nil,nil,nil,nil,nil,nil]],
+ [['Jan 1',false],[nil,1,1,nil,nil,nil,nil,nil,nil], __LINE__],
+ [['Jul 11',false],[nil,7,11,nil,nil,nil,nil,nil,nil], __LINE__],
+ [['July 11',false],[nil,7,11,nil,nil,nil,nil,nil,nil], __LINE__],
+ [['Sept 23',false],[nil,9,23,nil,nil,nil,nil,nil,nil], __LINE__],
+ [['Sep. 23',false],[nil,9,23,nil,nil,nil,nil,nil,nil], __LINE__],
+ [['Sept. 23',false],[nil,9,23,nil,nil,nil,nil,nil,nil], __LINE__],
+ [['September 23',false],[nil,9,23,nil,nil,nil,nil,nil,nil], __LINE__],
+ [['October 1st',false],[nil,10,1,nil,nil,nil,nil,nil,nil], __LINE__],
+ [['October 23rd',false],[nil,10,23,nil,nil,nil,nil,nil,nil], __LINE__],
+ [['October 25th 1999',false],[1999,10,25,nil,nil,nil,nil,nil,nil], __LINE__],
+ [['October 25th -1999',false],[-1999,10,25,nil,nil,nil,nil,nil,nil], __LINE__],
+ [['october 25th 1999',false],[1999,10,25,nil,nil,nil,nil,nil,nil], __LINE__],
+ [['OCTOBER 25th 1999',false],[1999,10,25,nil,nil,nil,nil,nil,nil], __LINE__],
+ [['oCtoBer 25th 1999',false],[1999,10,25,nil,nil,nil,nil,nil,nil], __LINE__],
+ [['aSep 23',false],[nil,nil,23,nil,nil,nil,nil,nil,nil], __LINE__],
# month and year
- [['Sept 1990',false],[1990,9,nil,nil,nil,nil,nil,nil,nil]],
- [["Sept '90",false],[90,9,nil,nil,nil,nil,nil,nil,nil]],
- [["Sept '90",true],[1990,9,nil,nil,nil,nil,nil,nil,nil]],
- [['1990/09',false],[1990,9,nil,nil,nil,nil,nil,nil,nil]],
- [['09/1990',false],[1990,9,nil,nil,nil,nil,nil,nil,nil]],
- [["aSep '90",false],[90,nil,nil,nil,nil,nil,nil,nil,nil]],
+ [['Sept 1990',false],[1990,9,nil,nil,nil,nil,nil,nil,nil], __LINE__],
+ [["Sept '90",false],[90,9,nil,nil,nil,nil,nil,nil,nil], __LINE__],
+ [["Sept '90",true],[1990,9,nil,nil,nil,nil,nil,nil,nil], __LINE__],
+ [['1990/09',false],[1990,9,nil,nil,nil,nil,nil,nil,nil], __LINE__],
+ [['09/1990',false],[1990,9,nil,nil,nil,nil,nil,nil,nil], __LINE__],
+ [["aSep '90",false],[90,nil,nil,nil,nil,nil,nil,nil,nil], __LINE__],
# year
- [["'90",false],[90,nil,nil,nil,nil,nil,nil,nil,nil]],
- [["'90",true],[1990,nil,nil,nil,nil,nil,nil,nil,nil]],
+ [["'90",false],[90,nil,nil,nil,nil,nil,nil,nil,nil], __LINE__],
+ [["'90",true],[1990,nil,nil,nil,nil,nil,nil,nil,nil], __LINE__],
# month
- [['Jun',false],[nil,6,nil,nil,nil,nil,nil,nil,nil]],
- [['June',false],[nil,6,nil,nil,nil,nil,nil,nil,nil]],
- [['Sep',false],[nil,9,nil,nil,nil,nil,nil,nil,nil]],
- [['Sept',false],[nil,9,nil,nil,nil,nil,nil,nil,nil]],
- [['September',false],[nil,9,nil,nil,nil,nil,nil,nil,nil]],
- [['aSep',false],[nil,nil,nil,nil,nil,nil,nil,nil,nil]],
+ [['Jun',false],[nil,6,nil,nil,nil,nil,nil,nil,nil], __LINE__],
+ [['June',false],[nil,6,nil,nil,nil,nil,nil,nil,nil], __LINE__],
+ [['Sep',false],[nil,9,nil,nil,nil,nil,nil,nil,nil], __LINE__],
+ [['Sept',false],[nil,9,nil,nil,nil,nil,nil,nil,nil], __LINE__],
+ [['September',false],[nil,9,nil,nil,nil,nil,nil,nil,nil], __LINE__],
+ [['aSep',false],[nil,nil,nil,nil,nil,nil,nil,nil,nil], __LINE__],
# day of month
- [['1st',false],[nil,nil,1,nil,nil,nil,nil,nil,nil]],
- [['2nd',false],[nil,nil,2,nil,nil,nil,nil,nil,nil]],
- [['3rd',false],[nil,nil,3,nil,nil,nil,nil,nil,nil]],
- [['4th',false],[nil,nil,4,nil,nil,nil,nil,nil,nil]],
- [['29th',false],[nil,nil,29,nil,nil,nil,nil,nil,nil]],
- [['31st',false],[nil,nil,31,nil,nil,nil,nil,nil,nil]],
- [['1sta',false],[nil,nil,nil,nil,nil,nil,nil,nil,nil]],
+ [['1st',false],[nil,nil,1,nil,nil,nil,nil,nil,nil], __LINE__],
+ [['2nd',false],[nil,nil,2,nil,nil,nil,nil,nil,nil], __LINE__],
+ [['3rd',false],[nil,nil,3,nil,nil,nil,nil,nil,nil], __LINE__],
+ [['4th',false],[nil,nil,4,nil,nil,nil,nil,nil,nil], __LINE__],
+ [['29th',false],[nil,nil,29,nil,nil,nil,nil,nil,nil], __LINE__],
+ [['31st',false],[nil,nil,31,nil,nil,nil,nil,nil,nil], __LINE__],
+ [['1sta',false],[nil,nil,nil,nil,nil,nil,nil,nil,nil], __LINE__],
# era
- [['Sat Aug 28 02:29:34 GMT CE 2000',false],[2000,8,28,2,29,34,'GMT',0,6]],
- [['Sat Aug 28 02:29:34 GMT C.E. 2000',false],[2000,8,28,2,29,34,'GMT',0,6]],
- [['Sat Aug 28 02:29:34 GMT BCE 2000',false],[-1999,8,28,2,29,34,'GMT',0,6]],
- [['Sat Aug 28 02:29:34 GMT B.C.E. 2000',false],[-1999,8,28,2,29,34,'GMT',0,6]],
- [['Sat Aug 28 02:29:34 GMT AD 2000',false],[2000,8,28,2,29,34,'GMT',0,6]],
- [['Sat Aug 28 02:29:34 GMT A.D. 2000',false],[2000,8,28,2,29,34,'GMT',0,6]],
- [['Sat Aug 28 02:29:34 GMT BC 2000',false],[-1999,8,28,2,29,34,'GMT',0,6]],
- [['Sat Aug 28 02:29:34 GMT B.C. 2000',false],[-1999,8,28,2,29,34,'GMT',0,6]],
- [['Sat Aug 28 02:29:34 GMT 2000 BC',false],[-1999,8,28,2,29,34,'GMT',0,6]],
- [['Sat Aug 28 02:29:34 GMT 2000 BCE',false],[-1999,8,28,2,29,34,'GMT',0,6]],
- [['Sat Aug 28 02:29:34 GMT 2000 B.C.',false],[-1999,8,28,2,29,34,'GMT',0,6]],
- [['Sat Aug 28 02:29:34 GMT 2000 B.C.E.',false],[-1999,8,28,2,29,34,'GMT',0,6]],
+ [['Sat Aug 28 02:29:34 GMT CE 2000',false],[2000,8,28,2,29,34,'GMT',0,6], __LINE__],
+ [['Sat Aug 28 02:29:34 GMT C.E. 2000',false],[2000,8,28,2,29,34,'GMT',0,6], __LINE__],
+ [['Sat Aug 28 02:29:34 GMT BCE 2000',false],[-1999,8,28,2,29,34,'GMT',0,6], __LINE__],
+ [['Sat Aug 28 02:29:34 GMT B.C.E. 2000',false],[-1999,8,28,2,29,34,'GMT',0,6], __LINE__],
+ [['Sat Aug 28 02:29:34 GMT AD 2000',false],[2000,8,28,2,29,34,'GMT',0,6], __LINE__],
+ [['Sat Aug 28 02:29:34 GMT A.D. 2000',false],[2000,8,28,2,29,34,'GMT',0,6], __LINE__],
+ [['Sat Aug 28 02:29:34 GMT BC 2000',false],[-1999,8,28,2,29,34,'GMT',0,6], __LINE__],
+ [['Sat Aug 28 02:29:34 GMT B.C. 2000',false],[-1999,8,28,2,29,34,'GMT',0,6], __LINE__],
+ [['Sat Aug 28 02:29:34 GMT 2000 BC',false],[-1999,8,28,2,29,34,'GMT',0,6], __LINE__],
+ [['Sat Aug 28 02:29:34 GMT 2000 BCE',false],[-1999,8,28,2,29,34,'GMT',0,6], __LINE__],
+ [['Sat Aug 28 02:29:34 GMT 2000 B.C.',false],[-1999,8,28,2,29,34,'GMT',0,6], __LINE__],
+ [['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]], # bih 1982
-# [['30 June 1982 , 23h 59m 59s',false],[1982,6,30,23,59,59,nil,nil,nil]], # bih 1982
- [['Tuesday, May 18, 1999 Published at 13:36 GMT 14:36 UK',false],[1999,5,18,13,36,nil,'GMT',0,2]], # 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]], # cnn.com
- [['12:54 p.m. EDT, September 11, 2006',false],[2006,9,11,12,54,nil,'EDT',-4*3600,nil]], # cnn.com
- [['February 04, 2001 at 10:59 AM PST',false],[2001,2,4,10,59,nil,'PST',-8*3600,nil]], # old amazon.com
- [['Monday May 08, @01:55PM',false],[nil,5,8,13,55,nil,nil,nil,1]], # slashdot.org
- [['06.June 2005',false],[2005,6,6,nil,nil,nil,nil,nil,nil]], # dhl.com
+# [['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
+ [['February 04, 2001 at 10:59 AM PST',false],[2001,2,4,10,59,nil,'PST',-8*3600,nil], __LINE__], # old amazon.com
+ [['Monday May 08, @01:55PM',false],[nil,5,8,13,55,nil,nil,nil,1], __LINE__], # slashdot.org
+ [['06.June 2005',false],[2005,6,6,nil,nil,nil,nil,nil,nil], __LINE__], # dhl.com
# etc.
- [['8:00 pm lt',false],[nil,nil,nil,20,0,nil,'lt',nil,nil]],
- [['4:00 AM, Jan. 12, 1990',false],[1990,1,12,4,0,nil,nil,nil,nil]],
- [['Jan. 12 4:00 AM 1990',false],[1990,1,12,4,0,nil,nil,nil,nil]],
-# [['Jan. 12 4:00 -1990',false],[-1990,1,12,4,0,nil,nil,nil,nil]], # cp
- [['1990-01-12 04:00:00+00',false],[1990,1,12,4,0,0,'+00',0,nil]],
- [['1990-01-11 20:00:00-08',false],[1990,1,11,20,0,0,'-08',-8*3600,nil]],
- [['1990/01/12 04:00:00',false],[1990,1,12,4,0,0,nil,nil,nil]],
-# [['Thu Jan 11 20:00:00 1990 LT',false], [1990,1,11,20,0,0,'LT',nil,4]], # cp
- [['Thu Jan 11 20:00:00 PST 1990',false],[1990,1,11,20,0,0,'PST',-8*3600,4]],
- [['Fri Jan 12 04:00:00 GMT 1990',false],[1990,1,12,4,0,0,'GMT',0,5]],
- [['Thu, 11 Jan 1990 20:00:00 -0800',false],[1990,1,11,20,0,0,'-0800',-8*3600,4]],
- [['12-January-1990, 04:00 WET',false],[1990,1,12,4,0,nil,'WET',0*3600,nil]],
- [['jan 2 3 am +4 5',false],[5,1,2,3,nil,nil,'+4',4*3600,nil]],
- [['jan 2 3 am +4 5',true],[2005,1,2,3,nil,nil,'+4',4*3600,nil]],
- [['fri1feb3bc4pm+5',false],[-2,2,1,16,nil,nil,'+5',5*3600,5]],
- [['fri1feb3bc4pm+5',true],[-2,2,1,16,nil,nil,'+5',5*3600,5]],
- [['03 feb 1st',false],[03,2,1,nil,nil,nil,nil,nil,nil]],
+ [['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__],
+ [['12-January-1990, 04:00 WET',false],[1990,1,12,4,0,nil,'WET',0*3600,nil], __LINE__],
+ [['jan 2 3 am +4 5',false],[5,1,2,3,nil,nil,'+4',4*3600,nil], __LINE__],
+ [['jan 2 3 am +4 5',true],[2005,1,2,3,nil,nil,'+4',4*3600,nil], __LINE__],
+ [['fri1feb3bc4pm+5',false],[-2,2,1,16,nil,nil,'+5',5*3600,5], __LINE__],
+ [['fri1feb3bc4pm+5',true],[-2,2,1,16,nil,nil,'+5',5*3600,5], __LINE__],
+ [['03 feb 1st',false],[03,2,1,nil,nil,nil,nil,nil,nil], __LINE__],
# apostrophe
- [["July 4, '79",true],[1979,7,4,nil,nil,nil,nil,nil,nil]],
- [["4th July '79",true],[1979,7,4,nil,nil,nil,nil,nil,nil]],
+ [["July 4, '79",true],[1979,7,4,nil,nil,nil,nil,nil,nil], __LINE__],
+ [["4th July '79",true],[1979,7,4,nil,nil,nil,nil,nil,nil], __LINE__],
# day of week
- [['Sunday',false],[nil,nil,nil,nil,nil,nil,nil,nil,0]],
- [['Mon',false],[nil,nil,nil,nil,nil,nil,nil,nil,1]],
- [['Tue',false],[nil,nil,nil,nil,nil,nil,nil,nil,2]],
- [['Wed',false],[nil,nil,nil,nil,nil,nil,nil,nil,3]],
- [['Thurs',false],[nil,nil,nil,nil,nil,nil,nil,nil,4]],
- [['Friday',false],[nil,nil,nil,nil,nil,nil,nil,nil,5]],
- [['Sat.',false],[nil,nil,nil,nil,nil,nil,nil,nil,6]],
- [['sat.',false],[nil,nil,nil,nil,nil,nil,nil,nil,6]],
- [['SAT.',false],[nil,nil,nil,nil,nil,nil,nil,nil,6]],
- [['sAt.',false],[nil,nil,nil,nil,nil,nil,nil,nil,6]],
-# [['su',false],[nil,nil,nil,nil,nil,nil,nil,nil,0]],
-# [['mo',false],[nil,nil,nil,nil,nil,nil,nil,nil,1]],
+ [['Sunday',false],[nil,nil,nil,nil,nil,nil,nil,nil,0], __LINE__],
+ [['Mon',false],[nil,nil,nil,nil,nil,nil,nil,nil,1], __LINE__],
+ [['Tue',false],[nil,nil,nil,nil,nil,nil,nil,nil,2], __LINE__],
+ [['Wed',false],[nil,nil,nil,nil,nil,nil,nil,nil,3], __LINE__],
+ [['Thurs',false],[nil,nil,nil,nil,nil,nil,nil,nil,4], __LINE__],
+ [['Friday',false],[nil,nil,nil,nil,nil,nil,nil,nil,5], __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__],
+ [['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]],
- [['09:55:30',false],[nil,nil,nil,9,55,30,nil,nil,nil]],
- [['09:55:30am',false],[nil,nil,nil,9,55,30,nil,nil,nil]],
- [['09:55:30pm',false],[nil,nil,nil,21,55,30,nil,nil,nil]],
- [['09:55:30a.m.',false],[nil,nil,nil,9,55,30,nil,nil,nil]],
- [['09:55:30p.m.',false],[nil,nil,nil,21,55,30,nil,nil,nil]],
- [['09:55:30pm GMT',false],[nil,nil,nil,21,55,30,'GMT',0,nil]],
- [['09:55:30p.m. GMT',false],[nil,nil,nil,21,55,30,'GMT',0,nil]],
- [['09:55+0900',false],[nil,nil,nil,9,55,nil,'+0900',9*3600,nil]],
- [['09 AM',false],[nil,nil,nil,9,nil,nil,nil,nil,nil]],
- [['09am',false],[nil,nil,nil,9,nil,nil,nil,nil,nil]],
- [['09 A.M.',false],[nil,nil,nil,9,nil,nil,nil,nil,nil]],
- [['09 PM',false],[nil,nil,nil,21,nil,nil,nil,nil,nil]],
- [['09pm',false],[nil,nil,nil,21,nil,nil,nil,nil,nil]],
- [['09 P.M.',false],[nil,nil,nil,21,nil,nil,nil,nil,nil]],
-
- [['9h22m23s',false],[nil,nil,nil,9,22,23,nil,nil,nil]],
- [['9h 22m 23s',false],[nil,nil,nil,9,22,23,nil,nil,nil]],
- [['9h22m',false],[nil,nil,nil,9,22,nil,nil,nil,nil]],
- [['9h 22m',false],[nil,nil,nil,9,22,nil,nil,nil,nil]],
- [['9h',false],[nil,nil,nil,9,nil,nil,nil,nil,nil]],
- [['9h 22m 23s am',false],[nil,nil,nil,9,22,23,nil,nil,nil]],
- [['9h 22m 23s pm',false],[nil,nil,nil,21,22,23,nil,nil,nil]],
- [['9h 22m am',false],[nil,nil,nil,9,22,nil,nil,nil,nil]],
- [['9h 22m pm',false],[nil,nil,nil,21,22,nil,nil,nil,nil]],
- [['9h am',false],[nil,nil,nil,9,nil,nil,nil,nil,nil]],
- [['9h pm',false],[nil,nil,nil,21,nil,nil,nil,nil,nil]],
-
- [['00:00',false],[nil,nil,nil,0,0,nil,nil,nil,nil]],
- [['01:00',false],[nil,nil,nil,1,0,nil,nil,nil,nil]],
- [['11:00',false],[nil,nil,nil,11,0,nil,nil,nil,nil]],
- [['12:00',false],[nil,nil,nil,12,0,nil,nil,nil,nil]],
- [['13:00',false],[nil,nil,nil,13,0,nil,nil,nil,nil]],
- [['23:00',false],[nil,nil,nil,23,0,nil,nil,nil,nil]],
- [['24:00',false],[nil,nil,nil,24,0,nil,nil,nil,nil]],
-
- [['00:00 AM',false],[nil,nil,nil,0,0,nil,nil,nil,nil]],
- [['12:00 AM',false],[nil,nil,nil,0,0,nil,nil,nil,nil]],
- [['01:00 AM',false],[nil,nil,nil,1,0,nil,nil,nil,nil]],
- [['11:00 AM',false],[nil,nil,nil,11,0,nil,nil,nil,nil]],
- [['00:00 PM',false],[nil,nil,nil,12,0,nil,nil,nil,nil]],
- [['12:00 PM',false],[nil,nil,nil,12,0,nil,nil,nil,nil]],
- [['01:00 PM',false],[nil,nil,nil,13,0,nil,nil,nil,nil]],
- [['11:00 PM',false],[nil,nil,nil,23,0,nil,nil,nil,nil]],
+ [['09:55',false],[nil,nil,nil,9,55,nil,nil,nil,nil], __LINE__],
+ [['09:55:30',false],[nil,nil,nil,9,55,30,nil,nil,nil], __LINE__],
+ [['09:55:30am',false],[nil,nil,nil,9,55,30,nil,nil,nil], __LINE__],
+ [['09:55:30pm',false],[nil,nil,nil,21,55,30,nil,nil,nil], __LINE__],
+ [['09:55:30a.m.',false],[nil,nil,nil,9,55,30,nil,nil,nil], __LINE__],
+ [['09:55:30p.m.',false],[nil,nil,nil,21,55,30,nil,nil,nil], __LINE__],
+ [['09:55:30pm GMT',false],[nil,nil,nil,21,55,30,'GMT',0,nil], __LINE__],
+ [['09:55:30p.m. GMT',false],[nil,nil,nil,21,55,30,'GMT',0,nil], __LINE__],
+ [['09:55+0900',false],[nil,nil,nil,9,55,nil,'+0900',9*3600,nil], __LINE__],
+ [['09 AM',false],[nil,nil,nil,9,nil,nil,nil,nil,nil], __LINE__],
+ [['09am',false],[nil,nil,nil,9,nil,nil,nil,nil,nil], __LINE__],
+ [['09 A.M.',false],[nil,nil,nil,9,nil,nil,nil,nil,nil], __LINE__],
+ [['09 PM',false],[nil,nil,nil,21,nil,nil,nil,nil,nil], __LINE__],
+ [['09pm',false],[nil,nil,nil,21,nil,nil,nil,nil,nil], __LINE__],
+ [['09 P.M.',false],[nil,nil,nil,21,nil,nil,nil,nil,nil], __LINE__],
+
+ [['9h22m23s',false],[nil,nil,nil,9,22,23,nil,nil,nil], __LINE__],
+ [['9h 22m 23s',false],[nil,nil,nil,9,22,23,nil,nil,nil], __LINE__],
+ [['9h22m',false],[nil,nil,nil,9,22,nil,nil,nil,nil], __LINE__],
+ [['9h 22m',false],[nil,nil,nil,9,22,nil,nil,nil,nil], __LINE__],
+ [['9h',false],[nil,nil,nil,9,nil,nil,nil,nil,nil], __LINE__],
+ [['9h 22m 23s am',false],[nil,nil,nil,9,22,23,nil,nil,nil], __LINE__],
+ [['9h 22m 23s pm',false],[nil,nil,nil,21,22,23,nil,nil,nil], __LINE__],
+ [['9h 22m am',false],[nil,nil,nil,9,22,nil,nil,nil,nil], __LINE__],
+ [['9h 22m pm',false],[nil,nil,nil,21,22,nil,nil,nil,nil], __LINE__],
+ [['9h am',false],[nil,nil,nil,9,nil,nil,nil,nil,nil], __LINE__],
+ [['9h pm',false],[nil,nil,nil,21,nil,nil,nil,nil,nil], __LINE__],
+
+ [['00:00',false],[nil,nil,nil,0,0,nil,nil,nil,nil], __LINE__],
+ [['01:00',false],[nil,nil,nil,1,0,nil,nil,nil,nil], __LINE__],
+ [['11:00',false],[nil,nil,nil,11,0,nil,nil,nil,nil], __LINE__],
+ [['12:00',false],[nil,nil,nil,12,0,nil,nil,nil,nil], __LINE__],
+ [['13:00',false],[nil,nil,nil,13,0,nil,nil,nil,nil], __LINE__],
+ [['23:00',false],[nil,nil,nil,23,0,nil,nil,nil,nil], __LINE__],
+ [['24:00',false],[nil,nil,nil,24,0,nil,nil,nil,nil], __LINE__],
+
+ [['00:00 AM',false],[nil,nil,nil,0,0,nil,nil,nil,nil], __LINE__],
+ [['12:00 AM',false],[nil,nil,nil,0,0,nil,nil,nil,nil], __LINE__],
+ [['01:00 AM',false],[nil,nil,nil,1,0,nil,nil,nil,nil], __LINE__],
+ [['11:00 AM',false],[nil,nil,nil,11,0,nil,nil,nil,nil], __LINE__],
+ [['00:00 PM',false],[nil,nil,nil,12,0,nil,nil,nil,nil], __LINE__],
+ [['12:00 PM',false],[nil,nil,nil,12,0,nil,nil,nil,nil], __LINE__],
+ [['01:00 PM',false],[nil,nil,nil,13,0,nil,nil,nil,nil], __LINE__],
+ [['11:00 PM',false],[nil,nil,nil,23,0,nil,nil,nil,nil], __LINE__],
# pick up the rest
- [['2000-01-02 1',false],[2000,1,2,1,nil,nil,nil,nil,nil]],
- [['2000-01-02 23',false],[2000,1,2,23,nil,nil,nil,nil,nil]],
- [['2000-01-02 24',false],[2000,1,2,24,nil,nil,nil,nil,nil]],
- [['1 03:04:05',false],[nil,nil,1,3,4,5,nil,nil,nil]],
- [['02 03:04:05',false],[nil,nil,2,3,4,5,nil,nil,nil]],
- [['31 03:04:05',false],[nil,nil,31,3,4,5,nil,nil,nil]],
+ [['2000-01-02 1',false],[2000,1,2,1,nil,nil,nil,nil,nil], __LINE__],
+ [['2000-01-02 23',false],[2000,1,2,23,nil,nil,nil,nil,nil], __LINE__],
+ [['2000-01-02 24',false],[2000,1,2,24,nil,nil,nil,nil,nil], __LINE__],
+ [['1 03:04:05',false],[nil,nil,1,3,4,5,nil,nil,nil], __LINE__],
+ [['02 03:04:05',false],[nil,nil,2,3,4,5,nil,nil,nil], __LINE__],
+ [['31 03:04:05',false],[nil,nil,31,3,4,5,nil,nil,nil], __LINE__],
# null, space
- [['',false],[nil,nil,nil,nil,nil,nil,nil,nil,nil]],
- [["\s",false],[nil,nil,nil,nil,nil,nil,nil,nil,nil]],
- [["\s" * 10, true],[nil,nil,nil,nil,nil,nil,nil,nil,nil]],
- [["\t",false],[nil,nil,nil,nil,nil,nil,nil,nil,nil]],
- [["\n",false],[nil,nil,nil,nil,nil,nil,nil,nil,nil]],
- [["\v",false],[nil,nil,nil,nil,nil,nil,nil,nil,nil]],
- [["\f",false],[nil,nil,nil,nil,nil,nil,nil,nil,nil]],
- [["\r",false],[nil,nil,nil,nil,nil,nil,nil,nil,nil]],
- [["\t\n\v\f\r\s",false],[nil,nil,nil,nil,nil,nil,nil,nil,nil]],
- [["1999-05-23\t\n\v\f\r\s21:34:56",false],[1999,5,23,21,34,56,nil,nil,nil]],
- [["1999-05-23\n\n\n\n\n\n21:34:56",false],[1999,5,23,21,34,56,nil,nil,nil]],
- ].each do |x,y|
+ [['',false],[nil,nil,nil,nil,nil,nil,nil,nil,nil], __LINE__],
+ [["\s",false],[nil,nil,nil,nil,nil,nil,nil,nil,nil], __LINE__],
+ [["\s" * 10, true],[nil,nil,nil,nil,nil,nil,nil,nil,nil], __LINE__],
+ [["\t",false],[nil,nil,nil,nil,nil,nil,nil,nil,nil], __LINE__],
+ [["\n",false],[nil,nil,nil,nil,nil,nil,nil,nil,nil], __LINE__],
+ [["\v",false],[nil,nil,nil,nil,nil,nil,nil,nil,nil], __LINE__],
+ [["\f",false],[nil,nil,nil,nil,nil,nil,nil,nil,nil], __LINE__],
+ [["\r",false],[nil,nil,nil,nil,nil,nil,nil,nil,nil], __LINE__],
+ [["\t\n\v\f\r\s",false],[nil,nil,nil,nil,nil,nil,nil,nil,nil], __LINE__],
+ [["1999-05-23\t\n\v\f\r\s21:34:56",false],[1999,5,23,21,34,56,nil,nil,nil], __LINE__],
+ ].each do |x,y,l|
h = Date._parse(*x)
a = h.values_at(:year,:mon,:mday,:hour,:min,:sec,:zone,:offset,:wday)
if y[1] == -1
a[1] = -1
a[2] = h[:yday]
end
- assert_equal(y, a, [x, y, a].inspect)
+ assert_equal(y, a, format('<failed at line %d>', l))
end
end
def test__parse_slash_exp
[
# little
- [['2/5/1999',false],[1999,5,2,nil,nil,nil,nil,nil,nil]],
- [['02/05/1999',false],[1999,5,2,nil,nil,nil,nil,nil,nil]],
- [['02/05/-1999',false],[-1999,5,2,nil,nil,nil,nil,nil,nil]],
- [['05/02',false],[nil,5,2,nil,nil,nil,nil,nil,nil]],
- [[' 5/ 2',false],[nil,5,2,nil,nil,nil,nil,nil,nil]],
+ [['2/5/1999',false],[1999,5,2,nil,nil,nil,nil,nil,nil], __LINE__],
+ [['02/05/1999',false],[1999,5,2,nil,nil,nil,nil,nil,nil], __LINE__],
+ [['02/05/-1999',false],[-1999,5,2,nil,nil,nil,nil,nil,nil], __LINE__],
+ [['05/02',false],[nil,5,2,nil,nil,nil,nil,nil,nil], __LINE__],
+ [[' 5/ 2',false],[nil,5,2,nil,nil,nil,nil,nil,nil], __LINE__],
- [["2/5/'99",true],[1999,5,2,nil,nil,nil,nil,nil,nil]],
- [['2/5/0099',false],[99,5,2,nil,nil,nil,nil,nil,nil]],
- [['2/5/0099',true],[99,5,2,nil,nil,nil,nil,nil,nil]],
+ [["2/5/'99",true],[1999,5,2,nil,nil,nil,nil,nil,nil], __LINE__],
+ [['2/5/0099',false],[99,5,2,nil,nil,nil,nil,nil,nil], __LINE__],
+ [['2/5/0099',true],[99,5,2,nil,nil,nil,nil,nil,nil], __LINE__],
- [['2/5 1999',false],[1999,5,2,nil,nil,nil,nil,nil,nil]],
- [['2/5-1999',false],[1999,5,2,nil,nil,nil,nil,nil,nil]],
- [['2/5--1999',false],[-1999,5,2,nil,nil,nil,nil,nil,nil]],
+ [['2/5 1999',false],[1999,5,2,nil,nil,nil,nil,nil,nil], __LINE__],
+ [['2/5-1999',false],[1999,5,2,nil,nil,nil,nil,nil,nil], __LINE__],
+ [['2/5--1999',false],[-1999,5,2,nil,nil,nil,nil,nil,nil], __LINE__],
# big
- [['99/5/2',false],[99,5,2,nil,nil,nil,nil,nil,nil]],
- [['99/5/2',true],[1999,5,2,nil,nil,nil,nil,nil,nil]],
+ [['99/5/2',false],[99,5,2,nil,nil,nil,nil,nil,nil], __LINE__],
+ [['99/5/2',true],[1999,5,2,nil,nil,nil,nil,nil,nil], __LINE__],
- [['1999/5/2',false],[1999,5,2,nil,nil,nil,nil,nil,nil]],
- [['1999/05/02',false],[1999,5,2,nil,nil,nil,nil,nil,nil]],
- [['-1999/05/02',false],[-1999,5,2,nil,nil,nil,nil,nil,nil]],
+ [['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__],
- [['0099/5/2',false],[99,5,2,nil,nil,nil,nil,nil,nil]],
- [['0099/5/2',true],[99,5,2,nil,nil,nil,nil,nil,nil]],
+ [['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__],
- [["'99/5/2",false],[99,5,2,nil,nil,nil,nil,nil,nil]],
- [["'99/5/2",true],[1999,5,2,nil,nil,nil,nil,nil,nil]],
- ].each do |x,y|
+ [["'99/5/2",false],[99,5,2,nil,nil,nil,nil,nil,nil], __LINE__],
+ [["'99/5/2",true],[1999,5,2,nil,nil,nil,nil,nil,nil], __LINE__],
+ ].each do |x,y,l|
h = Date._parse(*x)
a = h.values_at(:year,:mon,:mday,:hour,:min,:sec,:zone,:offset,:wday)
if y[1] == -1
a[1] = -1
a[2] = h[:yday]
end
- assert_equal(y, a, [x, y, a].inspect)
+ assert_equal(y, a, format('<failed at line %d>', l))
end
end
@@ -541,6 +540,9 @@ class TestDateParse < Test::Unit::TestCase
assert_equal([2006, 333], h.values_at(:year, :yday))
h = Date._parse('333')
assert_equal([nil, 333], h.values_at(:year, :yday))
+
+ h = Date._parse('')
+ assert_equal({}, h)
end
def test_parse
@@ -576,6 +578,15 @@ class TestDateParse < Test::Unit::TestCase
assert_equal(d2, d1)
end
+ def test__parse_odd_offset
+ h = DateTime._parse('2001-02-03T04:05:06+1')
+ assert_equal(3600, h[:offset])
+ h = DateTime._parse('2001-02-03T04:05:06+123')
+ assert_equal(4980, h[:offset])
+ h = DateTime._parse('2001-02-03T04:05:06+12345')
+ assert_equal(5025, h[:offset])
+ end
+
require 'time'
def test_parse__time
@@ -664,6 +675,12 @@ class TestDateParse < Test::Unit::TestCase
assert_raise(ArgumentError) do
DateTime.parse('2001-02-29T23:59:60')
end
+ assert_nothing_raised(ArgumentError) do
+ DateTime.parse('2001-03-01T23:59:60')
+ end
+ assert_raise(ArgumentError) do
+ DateTime.parse('2001-03-01T23:59:61')
+ end
assert_raise(ArgumentError) do
Date.parse('23:55')
end
@@ -816,6 +833,8 @@ class TestDateParse < Test::Unit::TestCase
assert_equal([nil, nil, nil, 4, 5, 6, 3600],
h.values_at(:year, :mon, :mday, :hour, :min, :sec, :offset))
+ h = Date._iso8601('')
+ assert_equal({}, h)
end
def test__rfc3339
@@ -828,6 +847,9 @@ class TestDateParse < Test::Unit::TestCase
h = Date._rfc3339('2001-02-03T04:05:06.07+01:00')
assert_equal([2001, 2, 3, 4, 5, 6, 3600],
h.values_at(:year, :mon, :mday, :hour, :min, :sec, :offset))
+
+ h = Date._rfc3339('')
+ assert_equal({}, h)
end
def test__xmlschema
@@ -907,6 +929,9 @@ class TestDateParse < Test::Unit::TestCase
h = Date._xmlschema('-92001-02-03T04:05:06.07+01:00')
assert_equal([-92001, 2, 3, 4, 5, 6, 3600],
h.values_at(:year, :mon, :mday, :hour, :min, :sec, :offset))
+
+ h = Date._xmlschema('')
+ assert_equal({}, h)
end
def test__rfc2822
@@ -936,6 +961,9 @@ class TestDateParse < Test::Unit::TestCase
h1 = Date._rfc2822('Sat, 3 Feb 2001 04:05:06 UT')
h2 = Date._rfc822('Sat, 3 Feb 2001 04:05:06 UT')
assert_equal(h1, h2)
+
+ h = Date._rfc2822('')
+ assert_equal({}, h)
end
def test__httpdate
@@ -953,6 +981,9 @@ class TestDateParse < Test::Unit::TestCase
h = Date._httpdate('Sat Feb 03 04:05:06 2001')
assert_equal([2001, 2, 3, 4, 5, 6, nil],
h.values_at(:year, :mon, :mday, :hour, :min, :sec, :offset))
+
+ h = Date._httpdate('')
+ assert_equal({}, h)
end
def test__jisx0301
@@ -978,6 +1009,9 @@ class TestDateParse < Test::Unit::TestCase
h = Date._jisx0301('H13.02.03T04:05:06.07+0100')
assert_equal([2001, 2, 3, 4, 5, 6, 3600],
h.values_at(:year, :mon, :mday, :hour, :min, :sec, :offset))
+
+ h = Date._jisx0301('')
+ assert_equal({}, h)
end
def test_iso8601
@@ -1028,10 +1062,16 @@ class TestDateParse < Test::Unit::TestCase
d = Date.rfc2822('Sat, 3 Feb 2001 04:05:06 +0700', Date::ITALY + 10)
assert_equal(Date.new(2001,2,3), d)
assert_equal(Date::ITALY + 10, d.start)
+ d = Date.rfc2822('3 Feb 2001 04:05:06 +0700', Date::ITALY + 10)
+ assert_equal(Date.new(2001,2,3), d)
+ assert_equal(Date::ITALY + 10, d.start)
d = DateTime.rfc2822('Sat, 3 Feb 2001 04:05:06 +0700', Date::ITALY + 10)
assert_equal(DateTime.new(2001,2,3,4,5,6,'+07:00'), d)
assert_equal(Date::ITALY + 10, d.start)
+ d = DateTime.rfc2822('3 Feb 2001 04:05:06 +0700', Date::ITALY + 10)
+ assert_equal(DateTime.new(2001,2,3,4,5,6,'+07:00'), d)
+ assert_equal(Date::ITALY + 10, d.start)
end
def test_httpdate
diff --git a/test/date/test_date_strftime.rb b/test/date/test_date_strftime.rb
index 8b96f16049..0ed9215e1e 100644
--- a/test/date/test_date_strftime.rb
+++ b/test/date/test_date_strftime.rb
@@ -79,7 +79,7 @@ class TestDateStrftime < Test::Unit::TestCase
assert_equal(f2, d.strftime(f2), [f2, s].inspect)
end
case f[-1,1]
- when 'd', 'e', 'H', 'I', 'm', 'M', 'S', 'u', 'U', 'V', 'w', 'W', 'y'
+ when 'd', 'e', 'H', 'k', 'I', 'l', 'm', 'M', 'S', 'u', 'U', 'V', 'w', 'W', 'y'
f2 = f.sub(/\A%/, '%O')
assert_equal(s[0], d.strftime(f2), [f2, s].inspect)
else
@@ -336,6 +336,21 @@ class TestDateStrftime < Test::Unit::TestCase
assert_equal('+09:08:07', d.strftime('%:::z'))
end
+ def test_strftime__gnuext_complex
+ d = DateTime.parse('2001-02-03T04:05:06+09:00')
+ assert_equal('Sat Feb 3 04:05:06 2001', d.strftime('%-100c'))
+ assert_equal('Sat Feb 3 04:05:06 2001'.rjust(100), d.strftime('%100c'))
+ assert_equal('Sat Feb 3 04:05:06 2001'.rjust(100), d.strftime('%_100c'))
+ assert_equal('Sat Feb 3 04:05:06 2001'.rjust(100, '0'), d.strftime('%0100c'))
+ assert_equal('SAT FEB 3 04:05:06 2001', d.strftime('%^c'))
+
+ assert_equal('Sat Feb 3 04:05:06 +09:00 2001', d.strftime('%-100+'))
+ assert_equal('Sat Feb 3 04:05:06 +09:00 2001'.rjust(100), d.strftime('%100+'))
+ assert_equal('Sat Feb 3 04:05:06 +09:00 2001'.rjust(100), d.strftime('%_100+'))
+ assert_equal('Sat Feb 3 04:05:06 +09:00 2001'.rjust(100, '0'), d.strftime('%0100+'))
+ assert_equal('SAT FEB 3 04:05:06 +09:00 2001', d.strftime('%^+'))
+ end
+
def test__different_format
d = Date.new(2001,2,3)
@@ -367,9 +382,15 @@ class TestDateStrftime < Test::Unit::TestCase
assert_equal('2001-02-03T04:05:06.123+00:00', d2.iso8601(3))
assert_equal('2001-02-03T04:05:06.123+00:00', d2.rfc3339(3))
assert_equal('H13.02.03T04:05:06.123+00:00', d2.jisx0301(3))
+ assert_equal('2001-02-03T04:05:06.123+00:00', d2.iso8601(3.5))
+ assert_equal('2001-02-03T04:05:06.123+00:00', d2.rfc3339(3.5))
+ assert_equal('H13.02.03T04:05:06.123+00:00', d2.jisx0301(3.5))
assert_equal('2001-02-03T04:05:06.123456000+00:00', d2.iso8601(9))
assert_equal('2001-02-03T04:05:06.123456000+00:00', d2.rfc3339(9))
assert_equal('H13.02.03T04:05:06.123456000+00:00', d2.jisx0301(9))
+ assert_equal('2001-02-03T04:05:06.123456000+00:00', d2.iso8601(9.9))
+ assert_equal('2001-02-03T04:05:06.123456000+00:00', d2.rfc3339(9.9))
+ assert_equal('H13.02.03T04:05:06.123456000+00:00', d2.jisx0301(9.9))
assert_equal('1800-01-01T00:00:00+00:00', DateTime.new(1800).jisx0301)
diff --git a/test/date/test_date_strptime.rb b/test/date/test_date_strptime.rb
index ceb649031f..f8483f9e4c 100644
--- a/test/date/test_date_strptime.rb
+++ b/test/date/test_date_strptime.rb
@@ -119,63 +119,63 @@ class TestDateStrptime < Test::Unit::TestCase
def test__strptime__3
[
# iso8601
- [['2001-02-03', '%Y-%m-%d'], [2001,2,3,nil,nil,nil,nil,nil,nil]],
- [['2001-02-03T23:59:60', '%Y-%m-%dT%H:%M:%S'], [2001,2,3,23,59,60,nil,nil,nil]],
- [['2001-02-03T23:59:60+09:00', '%Y-%m-%dT%H:%M:%S%Z'], [2001,2,3,23,59,60,'+09:00',9*3600,nil]],
- [['-2001-02-03T23:59:60+09:00', '%Y-%m-%dT%H:%M:%S%Z'], [-2001,2,3,23,59,60,'+09:00',9*3600,nil]],
- [['+012345-02-03T23:59:60+09:00', '%Y-%m-%dT%H:%M:%S%Z'], [12345,2,3,23,59,60,'+09:00',9*3600,nil]],
- [['-012345-02-03T23:59:60+09:00', '%Y-%m-%dT%H:%M:%S%Z'], [-12345,2,3,23,59,60,'+09:00',9*3600,nil]],
+ [['2001-02-03', '%Y-%m-%d'], [2001,2,3,nil,nil,nil,nil,nil,nil], __LINE__],
+ [['2001-02-03T23:59:60', '%Y-%m-%dT%H:%M:%S'], [2001,2,3,23,59,60,nil,nil,nil], __LINE__],
+ [['2001-02-03T23:59:60+09:00', '%Y-%m-%dT%H:%M:%S%Z'], [2001,2,3,23,59,60,'+09:00',9*3600,nil], __LINE__],
+ [['-2001-02-03T23:59:60+09:00', '%Y-%m-%dT%H:%M:%S%Z'], [-2001,2,3,23,59,60,'+09:00',9*3600,nil], __LINE__],
+ [['+012345-02-03T23:59:60+09:00', '%Y-%m-%dT%H:%M:%S%Z'], [12345,2,3,23,59,60,'+09:00',9*3600,nil], __LINE__],
+ [['-012345-02-03T23:59:60+09:00', '%Y-%m-%dT%H:%M:%S%Z'], [-12345,2,3,23,59,60,'+09:00',9*3600,nil], __LINE__],
# ctime(3), asctime(3)
- [['Thu Jul 29 14:47:19 1999', '%c'], [1999,7,29,14,47,19,nil,nil,4]],
- [['Thu Jul 29 14:47:19 -1999', '%c'], [-1999,7,29,14,47,19,nil,nil,4]],
+ [['Thu Jul 29 14:47:19 1999', '%c'], [1999,7,29,14,47,19,nil,nil,4], __LINE__],
+ [['Thu Jul 29 14:47:19 -1999', '%c'], [-1999,7,29,14,47,19,nil,nil,4], __LINE__],
# date(1)
- [['Thu Jul 29 16:39:41 EST 1999', '%a %b %d %H:%M:%S %Z %Y'], [1999,7,29,16,39,41,'EST',-5*3600,4]],
- [['Thu Jul 29 16:39:41 MET DST 1999', '%a %b %d %H:%M:%S %Z %Y'], [1999,7,29,16,39,41,'MET DST',2*3600,4]],
- [['Thu Jul 29 16:39:41 AMT 1999', '%a %b %d %H:%M:%S %Z %Y'], [1999,7,29,16,39,41,'AMT',nil,4]],
- [['Thu Jul 29 16:39:41 AMT -1999', '%a %b %d %H:%M:%S %Z %Y'], [-1999,7,29,16,39,41,'AMT',nil,4]],
- [['Thu Jul 29 16:39:41 GMT+09 1999', '%a %b %d %H:%M:%S %Z %Y'], [1999,7,29,16,39,41,'GMT+09',9*3600,4]],
- [['Thu Jul 29 16:39:41 GMT+0908 1999', '%a %b %d %H:%M:%S %Z %Y'], [1999,7,29,16,39,41,'GMT+0908',9*3600+8*60,4]],
- [['Thu Jul 29 16:39:41 GMT+090807 1999', '%a %b %d %H:%M:%S %Z %Y'], [1999,7,29,16,39,41,'GMT+090807',9*3600+8*60+7,4]],
- [['Thu Jul 29 16:39:41 GMT-09 1999', '%a %b %d %H:%M:%S %Z %Y'], [1999,7,29,16,39,41,'GMT-09',-9*3600,4]],
- [['Thu Jul 29 16:39:41 GMT-09:08 1999', '%a %b %d %H:%M:%S %Z %Y'], [1999,7,29,16,39,41,'GMT-09:08',-9*3600-8*60,4]],
- [['Thu Jul 29 16:39:41 GMT-09:08:07 1999', '%a %b %d %H:%M:%S %Z %Y'], [1999,7,29,16,39,41,'GMT-09:08:07',-9*3600-8*60-7,4]],
- [['Thu Jul 29 16:39:41 GMT-3.5 1999', '%a %b %d %H:%M:%S %Z %Y'], [1999,7,29,16,39,41,'GMT-3.5',-3*3600-30*60,4]],
- [['Thu Jul 29 16:39:41 GMT-3,5 1999', '%a %b %d %H:%M:%S %Z %Y'], [1999,7,29,16,39,41,'GMT-3,5',-3*3600-30*60,4]],
- [['Thu Jul 29 16:39:41 Mountain Daylight Time 1999', '%a %b %d %H:%M:%S %Z %Y'], [1999,7,29,16,39,41,'Mountain Daylight Time',-6*3600,4]],
- [['Thu Jul 29 16:39:41 E. Australia Standard Time 1999', '%a %b %d %H:%M:%S %Z %Y'], [1999,7,29,16,39,41,'E. Australia Standard Time',10*3600,4]],
+ [['Thu Jul 29 16:39:41 EST 1999', '%a %b %d %H:%M:%S %Z %Y'], [1999,7,29,16,39,41,'EST',-5*3600,4], __LINE__],
+ [['Thu Jul 29 16:39:41 MET DST 1999', '%a %b %d %H:%M:%S %Z %Y'], [1999,7,29,16,39,41,'MET DST',2*3600,4], __LINE__],
+ [['Thu Jul 29 16:39:41 AMT 1999', '%a %b %d %H:%M:%S %Z %Y'], [1999,7,29,16,39,41,'AMT',nil,4], __LINE__],
+ [['Thu Jul 29 16:39:41 AMT -1999', '%a %b %d %H:%M:%S %Z %Y'], [-1999,7,29,16,39,41,'AMT',nil,4], __LINE__],
+ [['Thu Jul 29 16:39:41 GMT+09 1999', '%a %b %d %H:%M:%S %Z %Y'], [1999,7,29,16,39,41,'GMT+09',9*3600,4], __LINE__],
+ [['Thu Jul 29 16:39:41 GMT+0908 1999', '%a %b %d %H:%M:%S %Z %Y'], [1999,7,29,16,39,41,'GMT+0908',9*3600+8*60,4], __LINE__],
+ [['Thu Jul 29 16:39:41 GMT+090807 1999', '%a %b %d %H:%M:%S %Z %Y'], [1999,7,29,16,39,41,'GMT+090807',9*3600+8*60+7,4], __LINE__],
+ [['Thu Jul 29 16:39:41 GMT-09 1999', '%a %b %d %H:%M:%S %Z %Y'], [1999,7,29,16,39,41,'GMT-09',-9*3600,4], __LINE__],
+ [['Thu Jul 29 16:39:41 GMT-09:08 1999', '%a %b %d %H:%M:%S %Z %Y'], [1999,7,29,16,39,41,'GMT-09:08',-9*3600-8*60,4], __LINE__],
+ [['Thu Jul 29 16:39:41 GMT-09:08:07 1999', '%a %b %d %H:%M:%S %Z %Y'], [1999,7,29,16,39,41,'GMT-09:08:07',-9*3600-8*60-7,4], __LINE__],
+ [['Thu Jul 29 16:39:41 GMT-3.5 1999', '%a %b %d %H:%M:%S %Z %Y'], [1999,7,29,16,39,41,'GMT-3.5',-3*3600-30*60,4], __LINE__],
+ [['Thu Jul 29 16:39:41 GMT-3,5 1999', '%a %b %d %H:%M:%S %Z %Y'], [1999,7,29,16,39,41,'GMT-3,5',-3*3600-30*60,4], __LINE__],
+ [['Thu Jul 29 16:39:41 Mountain Daylight Time 1999', '%a %b %d %H:%M:%S %Z %Y'], [1999,7,29,16,39,41,'Mountain Daylight Time',-6*3600,4], __LINE__],
+ [['Thu Jul 29 16:39:41 E. Australia Standard Time 1999', '%a %b %d %H:%M:%S %Z %Y'], [1999,7,29,16,39,41,'E. Australia Standard Time',10*3600,4], __LINE__],
# rfc822
- [['Thu, 29 Jul 1999 09:54:21 UT', '%a, %d %b %Y %H:%M:%S %Z'], [1999,7,29,9,54,21,'UT',0,4]],
- [['Thu, 29 Jul 1999 09:54:21 GMT', '%a, %d %b %Y %H:%M:%S %Z'], [1999,7,29,9,54,21,'GMT',0,4]],
- [['Thu, 29 Jul 1999 09:54:21 PDT', '%a, %d %b %Y %H:%M:%S %Z'], [1999,7,29,9,54,21,'PDT',-7*3600,4]],
- [['Thu, 29 Jul 1999 09:54:21 z', '%a, %d %b %Y %H:%M:%S %Z'], [1999,7,29,9,54,21,'z',0,4]],
- [['Thu, 29 Jul 1999 09:54:21 +0900', '%a, %d %b %Y %H:%M:%S %Z'], [1999,7,29,9,54,21,'+0900',9*3600,4]],
- [['Thu, 29 Jul 1999 09:54:21 +0430', '%a, %d %b %Y %H:%M:%S %Z'], [1999,7,29,9,54,21,'+0430',4*3600+30*60,4]],
- [['Thu, 29 Jul 1999 09:54:21 -0430', '%a, %d %b %Y %H:%M:%S %Z'], [1999,7,29,9,54,21,'-0430',-4*3600-30*60,4]],
- [['Thu, 29 Jul -1999 09:54:21 -0430', '%a, %d %b %Y %H:%M:%S %Z'], [-1999,7,29,9,54,21,'-0430',-4*3600-30*60,4]],
+ [['Thu, 29 Jul 1999 09:54:21 UT', '%a, %d %b %Y %H:%M:%S %Z'], [1999,7,29,9,54,21,'UT',0,4], __LINE__],
+ [['Thu, 29 Jul 1999 09:54:21 GMT', '%a, %d %b %Y %H:%M:%S %Z'], [1999,7,29,9,54,21,'GMT',0,4], __LINE__],
+ [['Thu, 29 Jul 1999 09:54:21 PDT', '%a, %d %b %Y %H:%M:%S %Z'], [1999,7,29,9,54,21,'PDT',-7*3600,4], __LINE__],
+ [['Thu, 29 Jul 1999 09:54:21 z', '%a, %d %b %Y %H:%M:%S %Z'], [1999,7,29,9,54,21,'z',0,4], __LINE__],
+ [['Thu, 29 Jul 1999 09:54:21 +0900', '%a, %d %b %Y %H:%M:%S %Z'], [1999,7,29,9,54,21,'+0900',9*3600,4], __LINE__],
+ [['Thu, 29 Jul 1999 09:54:21 +0430', '%a, %d %b %Y %H:%M:%S %Z'], [1999,7,29,9,54,21,'+0430',4*3600+30*60,4], __LINE__],
+ [['Thu, 29 Jul 1999 09:54:21 -0430', '%a, %d %b %Y %H:%M:%S %Z'], [1999,7,29,9,54,21,'-0430',-4*3600-30*60,4], __LINE__],
+ [['Thu, 29 Jul -1999 09:54:21 -0430', '%a, %d %b %Y %H:%M:%S %Z'], [-1999,7,29,9,54,21,'-0430',-4*3600-30*60,4], __LINE__],
# etc
- [['06-DEC-99', '%d-%b-%y'], [1999,12,6,nil,nil,nil,nil,nil,nil]],
- [['sUnDay oCtoBer 31 01', '%A %B %d %y'], [2001,10,31,nil,nil,nil,nil,nil,0]],
- [["October\t\n\v\f\r 15,\t\n\v\f\r99", '%B %d, %y'], [1999,10,15,nil,nil,nil,nil,nil,nil]],
- [["October\t\n\v\f\r 15,\t\n\v\f\r99", '%B%t%d,%n%y'], [1999,10,15,nil,nil,nil,nil,nil,nil]],
-
- [['09:02:11 AM', '%I:%M:%S %p'], [nil,nil,nil,9,2,11,nil,nil,nil]],
- [['09:02:11 A.M.', '%I:%M:%S %p'], [nil,nil,nil,9,2,11,nil,nil,nil]],
- [['09:02:11 PM', '%I:%M:%S %p'], [nil,nil,nil,21,2,11,nil,nil,nil]],
- [['09:02:11 P.M.', '%I:%M:%S %p'], [nil,nil,nil,21,2,11,nil,nil,nil]],
-
- [['12:33:44 AM', '%r'], [nil,nil,nil,0,33,44,nil,nil,nil]],
- [['01:33:44 AM', '%r'], [nil,nil,nil,1,33,44,nil,nil,nil]],
- [['11:33:44 AM', '%r'], [nil,nil,nil,11,33,44,nil,nil,nil]],
- [['12:33:44 PM', '%r'], [nil,nil,nil,12,33,44,nil,nil,nil]],
- [['01:33:44 PM', '%r'], [nil,nil,nil,13,33,44,nil,nil,nil]],
- [['11:33:44 PM', '%r'], [nil,nil,nil,23,33,44,nil,nil,nil]],
-
- [['11:33:44 PM AMT', '%I:%M:%S %p %Z'], [nil,nil,nil,23,33,44,'AMT',nil,nil]],
- [['11:33:44 P.M. AMT', '%I:%M:%S %p %Z'], [nil,nil,nil,23,33,44,'AMT',nil,nil]],
+ [['06-DEC-99', '%d-%b-%y'], [1999,12,6,nil,nil,nil,nil,nil,nil], __LINE__],
+ [['sUnDay oCtoBer 31 01', '%A %B %d %y'], [2001,10,31,nil,nil,nil,nil,nil,0], __LINE__],
+ [["October\t\n\v\f\r 15,\t\n\v\f\r99", '%B %d, %y'], [1999,10,15,nil,nil,nil,nil,nil,nil], __LINE__],
+ [["October\t\n\v\f\r 15,\t\n\v\f\r99", '%B%t%d,%n%y'], [1999,10,15,nil,nil,nil,nil,nil,nil], __LINE__],
+
+ [['09:02:11 AM', '%I:%M:%S %p'], [nil,nil,nil,9,2,11,nil,nil,nil], __LINE__],
+ [['09:02:11 A.M.', '%I:%M:%S %p'], [nil,nil,nil,9,2,11,nil,nil,nil], __LINE__],
+ [['09:02:11 PM', '%I:%M:%S %p'], [nil,nil,nil,21,2,11,nil,nil,nil], __LINE__],
+ [['09:02:11 P.M.', '%I:%M:%S %p'], [nil,nil,nil,21,2,11,nil,nil,nil], __LINE__],
+
+ [['12:33:44 AM', '%r'], [nil,nil,nil,0,33,44,nil,nil,nil], __LINE__],
+ [['01:33:44 AM', '%r'], [nil,nil,nil,1,33,44,nil,nil,nil], __LINE__],
+ [['11:33:44 AM', '%r'], [nil,nil,nil,11,33,44,nil,nil,nil], __LINE__],
+ [['12:33:44 PM', '%r'], [nil,nil,nil,12,33,44,nil,nil,nil], __LINE__],
+ [['01:33:44 PM', '%r'], [nil,nil,nil,13,33,44,nil,nil,nil], __LINE__],
+ [['11:33:44 PM', '%r'], [nil,nil,nil,23,33,44,nil,nil,nil], __LINE__],
+
+ [['11:33:44 PM AMT', '%I:%M:%S %p %Z'], [nil,nil,nil,23,33,44,'AMT',nil,nil], __LINE__],
+ [['11:33:44 P.M. AMT', '%I:%M:%S %p %Z'], [nil,nil,nil,23,33,44,'AMT',nil,nil], __LINE__],
[['fri1feb034pm+5', '%a%d%b%y%H%p%Z'], [2003,2,1,16,nil,nil,'+5',5*3600,5]]
].each do |x, y|
@@ -191,45 +191,45 @@ class TestDateStrptime < Test::Unit::TestCase
def test__strptime__width
[
- [['99', '%y'], [1999,nil,nil,nil,nil,nil,nil,nil,nil]],
- [['01', '%y'], [2001,nil,nil,nil,nil,nil,nil,nil,nil]],
- [['19 99', '%C %y'], [1999,nil,nil,nil,nil,nil,nil,nil,nil]],
- [['20 01', '%C %y'], [2001,nil,nil,nil,nil,nil,nil,nil,nil]],
- [['1999', '%C%y'], [1999,nil,nil,nil,nil,nil,nil,nil,nil]],
- [['2001', '%C%y'], [2001,nil,nil,nil,nil,nil,nil,nil,nil]],
-
- [['20060806', '%Y'], [20060806,nil,nil,nil,nil,nil,nil,nil,nil]],
- [['20060806', "%Y\s"], [20060806,nil,nil,nil,nil,nil,nil,nil,nil]],
- [['20060806', '%Y%m%d'], [2006,8,6,nil,nil,nil,nil,nil,nil]],
- [['2006908906', '%Y9%m9%d'], [2006,8,6,nil,nil,nil,nil,nil,nil]],
- [['12006 08 06', '%Y %m %d'], [12006,8,6,nil,nil,nil,nil,nil,nil]],
- [['12006-08-06', '%Y-%m-%d'], [12006,8,6,nil,nil,nil,nil,nil,nil]],
- [['200608 6', '%Y%m%e'], [2006,8,6,nil,nil,nil,nil,nil,nil]],
-
- [['2006333', '%Y%j'], [2006,-1,333,nil,nil,nil,nil,nil,nil]],
- [['20069333', '%Y9%j'], [2006,-1,333,nil,nil,nil,nil,nil,nil]],
- [['12006 333', '%Y %j'], [12006,-1,333,nil,nil,nil,nil,nil,nil]],
- [['12006-333', '%Y-%j'], [12006,-1,333,nil,nil,nil,nil,nil,nil]],
-
- [['232425', '%H%M%S'], [nil,nil,nil,23,24,25,nil,nil,nil]],
- [['23924925', '%H9%M9%S'], [nil,nil,nil,23,24,25,nil,nil,nil]],
- [['23 24 25', '%H %M %S'], [nil,nil,nil,23,24,25,nil,nil,nil]],
- [['23:24:25', '%H:%M:%S'], [nil,nil,nil,23,24,25,nil,nil,nil]],
- [[' 32425', '%k%M%S'], [nil,nil,nil,3,24,25,nil,nil,nil]],
- [[' 32425', '%l%M%S'], [nil,nil,nil,3,24,25,nil,nil,nil]],
-
- [['FriAug', '%a%b'], [nil,8,nil,nil,nil,nil,nil,nil,5]],
- [['FriAug', '%A%B'], [nil,8,nil,nil,nil,nil,nil,nil,5]],
- [['FridayAugust', '%A%B'], [nil,8,nil,nil,nil,nil,nil,nil,5]],
- [['FridayAugust', '%a%b'], [nil,8,nil,nil,nil,nil,nil,nil,5]]
- ].each do |x, y|
+ [['99', '%y'], [1999,nil,nil,nil,nil,nil,nil,nil,nil], __LINE__],
+ [['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__],
+ [['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__],
+
+ [['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__],
+ [['20060806', '%Y%m%d'], [2006,8,6,nil,nil,nil,nil,nil,nil], __LINE__],
+ [['2006908906', '%Y9%m9%d'], [2006,8,6,nil,nil,nil,nil,nil,nil], __LINE__],
+ [['12006 08 06', '%Y %m %d'], [12006,8,6,nil,nil,nil,nil,nil,nil], __LINE__],
+ [['12006-08-06', '%Y-%m-%d'], [12006,8,6,nil,nil,nil,nil,nil,nil], __LINE__],
+ [['200608 6', '%Y%m%e'], [2006,8,6,nil,nil,nil,nil,nil,nil], __LINE__],
+
+ [['2006333', '%Y%j'], [2006,-1,333,nil,nil,nil,nil,nil,nil], __LINE__],
+ [['20069333', '%Y9%j'], [2006,-1,333,nil,nil,nil,nil,nil,nil], __LINE__],
+ [['12006 333', '%Y %j'], [12006,-1,333,nil,nil,nil,nil,nil,nil], __LINE__],
+ [['12006-333', '%Y-%j'], [12006,-1,333,nil,nil,nil,nil,nil,nil], __LINE__],
+
+ [['232425', '%H%M%S'], [nil,nil,nil,23,24,25,nil,nil,nil], __LINE__],
+ [['23924925', '%H9%M9%S'], [nil,nil,nil,23,24,25,nil,nil,nil], __LINE__],
+ [['23 24 25', '%H %M %S'], [nil,nil,nil,23,24,25,nil,nil,nil], __LINE__],
+ [['23:24:25', '%H:%M:%S'], [nil,nil,nil,23,24,25,nil,nil,nil], __LINE__],
+ [[' 32425', '%k%M%S'], [nil,nil,nil,3,24,25,nil,nil,nil], __LINE__],
+ [[' 32425', '%l%M%S'], [nil,nil,nil,3,24,25,nil,nil,nil], __LINE__],
+
+ [['FriAug', '%a%b'], [nil,8,nil,nil,nil,nil,nil,nil,5], __LINE__],
+ [['FriAug', '%A%B'], [nil,8,nil,nil,nil,nil,nil,nil,5], __LINE__],
+ [['FridayAugust', '%A%B'], [nil,8,nil,nil,nil,nil,nil,nil,5], __LINE__],
+ [['FridayAugust', '%a%b'], [nil,8,nil,nil,nil,nil,nil,nil,5], __LINE__],
+ ].each do |x,y,l|
h = Date._strptime(*x)
- a = h.values_at(:year,:mon,:mday,:hour,:min,:sec,:zone,:offset,:wday)
+ a = (h || {}).values_at(:year,:mon,:mday,:hour,:min,:sec,:zone,:offset,:wday)
if y[1] == -1
a[1] = -1
a[2] = h[:yday]
end
- assert_equal(y, a, [x, y, a].inspect)
+ assert_equal(y, a, format('<failed at line %d>', l))
end
end
@@ -467,6 +467,12 @@ class TestDateStrptime < Test::Unit::TestCase
assert_raise(ArgumentError) do
DateTime.strptime('2001-02-29T23:59:60', '%FT%T')
end
+ assert_nothing_raised(ArgumentError) do
+ DateTime.strptime('2001-03-01T23:59:60', '%FT%T')
+ end
+ assert_raise(ArgumentError) do
+ DateTime.strptime('2001-03-01T23:59:61', '%FT%T')
+ end
assert_raise(ArgumentError) do
Date.strptime('23:55', '%H:%M')
end
diff --git a/test/date/test_switch_hitter.rb b/test/date/test_switch_hitter.rb
index 8431d40a29..f18d76b393 100644
--- a/test/date/test_switch_hitter.rb
+++ b/test/date/test_switch_hitter.rb
@@ -292,8 +292,10 @@ class TestSH < Test::Unit::TestCase
Date.today.strftime('%100000z')
end
assert_raise(Errno::ERANGE) do
- Date.new(1 << 10000).strftime('%Y')
+ Date.new(1 << 10000).strftime('%Y')
end
+ assert_equal('-3786825600', Date.new(1850).strftime('%s'))
+ assert_equal('-3786825600000', Date.new(1850).strftime('%Q'))
end
def test_cmp
@@ -472,7 +474,90 @@ class TestSH < Test::Unit::TestCase
period2_iter(+cm_period * (1 << 64) - 3, +cm_period * (1 << 64) + 3)
end
- def test_marshal
+ def test_different_alignments
+ assert_equal(0, Date.jd(0) <=> Date.civil(-4713, 11, 24, Date::GREGORIAN))
+ assert_equal(0, Date.jd(213447717) <=> Date.civil(579687, 11, 24))
+ assert_equal(0, Date.jd(-213447717) <=> Date.civil(-589113, 11, 24, Date::GREGORIAN))
+
+ assert_equal(0, Date.jd(0) <=> DateTime.civil(-4713, 11, 24, 0, 0, 0, 0, Date::GREGORIAN))
+ assert_equal(0, Date.jd(213447717) <=> DateTime.civil(579687, 11, 24))
+ assert_equal(0, Date.jd(-213447717) <=> DateTime.civil(-589113, 11, 24, 0, 0, 0, 0, Date::GREGORIAN))
+
+ assert(Date.jd(0) == Date.civil(-4713, 11, 24, Date::GREGORIAN))
+ assert(Date.jd(213447717) == Date.civil(579687, 11, 24))
+ assert(Date.jd(-213447717) == Date.civil(-589113, 11, 24, Date::GREGORIAN))
+
+ assert(Date.jd(0) == DateTime.civil(-4713, 11, 24, 0, 0, 0, 0, Date::GREGORIAN))
+ assert(Date.jd(213447717) == DateTime.civil(579687, 11, 24))
+ assert(Date.jd(-213447717) == DateTime.civil(-589113, 11, 24, 0, 0, 0, 0, Date::GREGORIAN))
+
+ assert(Date.jd(0) === Date.civil(-4713, 11, 24, Date::GREGORIAN))
+ assert(Date.jd(213447717) === Date.civil(579687, 11, 24))
+ assert(Date.jd(-213447717) === Date.civil(-589113, 11, 24, Date::GREGORIAN))
+
+ assert(Date.jd(0) === DateTime.civil(-4713, 11, 24, 12, 0, 0, 0, Date::GREGORIAN))
+ assert(Date.jd(213447717) === DateTime.civil(579687, 11, 24, 12))
+ assert(Date.jd(-213447717) === DateTime.civil(-589113, 11, 24, 12, 0, 0, 0, Date::GREGORIAN))
+
+ a = Date.jd(0)
+ b = Date.civil(-4713, 11, 24, Date::GREGORIAN)
+ assert_equal(0, a <=> b)
+
+ a = Date.civil(-4712, 1, 1, Date::JULIAN)
+ b = Date.civil(-4713, 11, 24, Date::GREGORIAN)
+ a.jd; b.jd
+ assert_equal(0, a <=> b)
+
+ a = Date.jd(0)
+ b = Date.civil(-4713, 11, 24, Date::GREGORIAN)
+ assert(a == b)
+
+ a = Date.civil(-4712, 1, 1, Date::JULIAN)
+ b = Date.civil(-4713, 11, 24, Date::GREGORIAN)
+ a.jd; b.jd
+ assert(a == b)
+
+ a = Date.jd(0)
+ b = Date.civil(-4713, 11, 24, Date::GREGORIAN)
+ assert(a === b)
+
+ a = Date.civil(-4712, 1, 1, Date::JULIAN)
+ b = Date.civil(-4713, 11, 24, Date::GREGORIAN)
+ a.jd; b.jd
+ assert(a === b)
+ end
+
+ def test_marshal14
+ s = "\x04\x03u:\x01\x04Date\x01\v\x04\x03[\x01\x02i\x03\xE8i%T"
+ d = Marshal.load(s)
+ assert_equal(Rational(4903887,2), d.ajd)
+ assert_equal(0, d.send(:offset))
+ assert_equal(Date::GREGORIAN, d.start)
+ end
+
+ def test_marshal16
+ s = "\x04\x06u:\tDate\x0F\x04\x06[\ai\x03\xE8i%T"
+ d = Marshal.load(s)
+ assert_equal(Rational(4903887,2), d.ajd)
+ assert_equal(0, d.send(:offset))
+ assert_equal(Date::GREGORIAN, d.start)
+ end
+
+ def test_marshal18
+ s = "\x04\bu:\tDateP\x04\b[\bo:\rRational\a:\x0F@numeratori\x03\xCF\xD3J:\x11@denominatori\ai\x00o:\x13Date::Infinity\x06:\a@di\xFA"
+ d = Marshal.load(s)
+ assert_equal(Rational(4903887,2), d.ajd)
+ assert_equal(0, d.send(:offset))
+ assert_equal(Date::GREGORIAN, d.start)
+
+ s = "\x04\bu:\rDateTime`\x04\b[\bo:\rRational\a:\x0F@numeratorl+\b\xC9\xB0\x81\xBD\x02\x00:\x11@denominatori\x02\xC0\x12o;\x00\a;\x06i\b;\ai\ro:\x13Date::Infinity\x06:\a@di\xFA"
+ d = Marshal.load(s)
+ assert_equal(Rational(11769327817,4800), d.ajd)
+ assert_equal(Rational(9,24), d.offset)
+ assert_equal(Date::GREGORIAN, d.start)
+ end
+
+ def test_marshal192
s = "\x04\bU:\tDate[\bU:\rRational[\ai\x03\xCF\xD3Ji\ai\x00o:\x13Date::Infinity\x06:\a@di\xFA"
d = Marshal.load(s)
assert_equal(Rational(4903887,2), d.ajd)
diff --git a/test/dbm/test_dbm.rb b/test/dbm/test_dbm.rb
index 79c8ae2150..9f7604be15 100644
--- a/test/dbm/test_dbm.rb
+++ b/test/dbm/test_dbm.rb
@@ -68,7 +68,7 @@ if defined? DBM
assert_instance_of(DBM, @dbm = DBM.new(@path))
end
def teardown
- assert_nil(@dbm.close)
+ assert_nil(@dbm.close) unless @dbm.closed?
ObjectSpace.each_object(DBM) do |obj|
obj.close unless obj.closed?
end
@@ -87,12 +87,55 @@ if defined? DBM
end
end
- def have_fork?
- begin
- fork{}
- true
- rescue NotImplementedError
- false
+ def test_dbmfile_suffix
+ @dbm.close
+ prefix = File.basename(@path)
+ suffixes = Dir.entries(@tmpdir).grep(/\A#{Regexp.escape prefix}/) { $' }.sort
+ pagname = "#{@path}.pag"
+ dirname = "#{@path}.dir"
+ dbname = "#{@path}.db"
+ case DBM::VERSION
+ when /\bNDBM\b/
+ assert_equal(%w[.dir .pag], suffixes)
+ assert(File.zero?(pagname))
+ assert(File.zero?(dirname))
+ when /\bGDBM\b/
+ assert_equal(%w[.dir .pag], suffixes)
+ assert(!File.zero?(pagname))
+ assert(!File.zero?(dirname))
+ pag = File.binread(pagname, 16)
+ pag_magics = [
+ 0x13579ace, # GDBM_OMAGIC
+ 0x13579acd, # GDBM_MAGIC32
+ 0x13579acf, # GDBM_MAGIC64
+ ]
+ assert_operator(pag_magics, :include?,
+ pag.unpack("i")[0]) # native endian, native int.
+ if !File.identical?(pagname, dirname)
+ dir = File.binread(dirname, 16)
+ assert_equal("GDBM", dir[0, 4])
+ end
+ when /\bBerkeley DB\b/
+ assert_equal(%w[.db], suffixes)
+ assert(!File.zero?(dbname))
+ db = File.binread(dbname, 16)
+ assert(db[0,4].unpack("N") == [0x00061561] || # Berkeley DB 1
+ db[12,4].unpack("L") == [0x00061561]) # Berkeley DBM 2 or later.
+ when /\bQDBM\b/
+ assert_equal(%w[.dir .pag], suffixes)
+ assert(!File.zero?(pagname))
+ assert(!File.zero?(dirname))
+ dir = File.binread(dirname, 16)
+ assert_equal("[depot]\0\v", dir[0, 9])
+ pag = File.binread(pagname, 16)
+ if [1].pack("s") == "\x00\x01" # big endian
+ assert_equal("[DEPOT]\n\f", pag[0, 9])
+ else # little endian
+ assert_equal("[depot]\n\f", pag[0, 9])
+ end
+ end
+ if suffixes == %w[.db]
+ assert_match(/\bBerkeley DB\b/, DBM::VERSION)
end
end
@@ -522,6 +565,10 @@ if defined? DBM
FileUtils.remove_entry_secure @tmproot if File.directory?(@tmproot)
end
+ def test_version
+ assert_instance_of(String, DBM::VERSION)
+ end
+
def test_reader_open_notexist
assert_raise(Errno::ENOENT) {
DBM.open("#{@tmproot}/a", 0666, DBM::READER)
diff --git a/test/digest/test_digest.rb b/test/digest/test_digest.rb
index 661129083a..86f9147428 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
@@ -25,21 +26,27 @@ module TestDigest
def test_s_hexdigest
self.class::DATA.each do |str, hexdigest|
- assert_equal(hexdigest, self.class::ALGO.hexdigest(str))
+ actual = self.class::ALGO.hexdigest(str)
+ assert_equal(hexdigest, actual)
+ assert_equal(Encoding::US_ASCII, actual.encoding)
end
end
def test_s_base64digest
self.class::DATA.each do |str, hexdigest|
digest = [hexdigest].pack("H*")
- assert_equal([digest].pack("m0"), self.class::ALGO.base64digest(str))
+ actual = self.class::ALGO.base64digest(str)
+ assert_equal([digest].pack("m0"), actual)
+ assert_equal(Encoding::US_ASCII, actual.encoding)
end
end
def test_s_digest
self.class::DATA.each do |str, hexdigest|
digest = [hexdigest].pack("H*")
- assert_equal(digest, self.class::ALGO.digest(str))
+ actual = self.class::ALGO.digest(str)
+ assert_equal(digest, actual)
+ assert_equal(Encoding::BINARY, actual.encoding)
end
end
@@ -72,6 +79,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" }
@@ -87,6 +104,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
@@ -132,6 +166,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 577fd7a455..2992e28877 100644
--- a/test/digest/test_digest_extend.rb
+++ b/test/digest/test_digest_extend.rb
@@ -49,6 +49,7 @@ class TestDigestExtend < Test::Unit::TestCase
(0..0xff).to_a.map { |c| sprintf("%02x", c ) }.join(''),
Digest.hexencode((0..0xff).to_a.map { |c| c.chr }.join(''))
)
+ assert_equal(Encoding::US_ASCII, Digest.hexencode("\1\2").encoding)
end
def test_class_reset
diff --git a/test/dl/test_base.rb b/test/dl/test_base.rb
index 0642f0ed89..a07056d142 100644
--- a/test/dl/test_base.rb
+++ b/test/dl/test_base.rb
@@ -1,6 +1,7 @@
+# -*- coding: us-ascii -*-
require 'test/unit'
-require 'dl'
require_relative '../ruby/envutil'
+EnvUtil.suppress_warning {require 'dl'}
libc_so = libm_so = nil
@@ -32,6 +33,12 @@ when /darwin/
when /kfreebsd/
libc_so = "/lib/libc.so.0.1"
libm_so = "/lib/libm.so.1"
+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 /bsd|dragonfly/
libc_so = "/usr/lib/libc.so"
libm_so = "/usr/lib/libm.so"
@@ -126,5 +133,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_c_struct_entry.rb b/test/dl/test_c_struct_entry.rb
new file mode 100644
index 0000000000..b2f1f94419
--- /dev/null
+++ b/test/dl/test_c_struct_entry.rb
@@ -0,0 +1,55 @@
+# -*- coding: us-ascii -*-
+require_relative 'test_base'
+
+EnvUtil.suppress_warning {require 'dl/struct'}
+
+module DL
+ class TestCStructEntity < TestBase
+ def test_class_size
+ types = [TYPE_DOUBLE, TYPE_CHAR]
+
+ size = CStructEntity.size types
+
+ alignments = types.map { |type| PackInfo::ALIGN_MAP[type] }
+
+ expected = PackInfo.align 0, alignments[0]
+ expected += PackInfo::SIZE_MAP[TYPE_DOUBLE]
+
+ expected = PackInfo.align expected, alignments[1]
+ expected += PackInfo::SIZE_MAP[TYPE_CHAR]
+
+ expected = PackInfo.align expected, alignments.max
+
+ assert_equal expected, size
+ end
+
+ def test_class_size_with_count
+ size = CStructEntity.size([[TYPE_DOUBLE, 2], [TYPE_CHAR, 20]])
+
+ types = [TYPE_DOUBLE, TYPE_CHAR]
+ alignments = types.map { |type| PackInfo::ALIGN_MAP[type] }
+
+ expected = PackInfo.align 0, alignments[0]
+ expected += PackInfo::SIZE_MAP[TYPE_DOUBLE] * 2
+
+ expected = PackInfo.align expected, alignments[1]
+ expected += PackInfo::SIZE_MAP[TYPE_CHAR] * 20
+
+ expected = PackInfo.align expected, alignments.max
+
+ assert_equal expected, size
+ end
+
+ def test_set_ctypes
+ union = CStructEntity.malloc [TYPE_INT, TYPE_LONG]
+ union.assign_names %w[int long]
+
+ # this test is roundabout because the stored ctypes are not accessible
+ union['long'] = 1
+ union['int'] = 2
+
+ assert_equal 1, union['long']
+ assert_equal 2, union['int']
+ end
+ end
+end
diff --git a/test/dl/test_c_union_entity.rb b/test/dl/test_c_union_entity.rb
new file mode 100644
index 0000000000..09f7c60e4c
--- /dev/null
+++ b/test/dl/test_c_union_entity.rb
@@ -0,0 +1,31 @@
+require_relative 'test_base'
+
+require 'dl/struct'
+
+module DL
+ class TestCUnionEntity < TestBase
+ def test_class_size
+ size = CUnionEntity.size([TYPE_DOUBLE, TYPE_CHAR])
+
+ assert_equal SIZEOF_DOUBLE, size
+ end
+
+ def test_class_size_with_count
+ size = CUnionEntity.size([[TYPE_DOUBLE, 2], [TYPE_CHAR, 20]])
+
+ assert_equal SIZEOF_CHAR * 20, size
+ end
+
+ def test_set_ctypes
+ union = CUnionEntity.malloc [TYPE_INT, TYPE_LONG]
+ union.assign_names %w[int long]
+
+ # this test is roundabout because the stored ctypes are not accessible
+ union['long'] = 1
+ assert_equal 1, union['long']
+
+ union['int'] = 1
+ assert_equal 1, union['int']
+ end
+ end
+end
diff --git a/test/dl/test_callback.rb b/test/dl/test_callback.rb
index ed3be661e7..8ae652b95a 100644
--- a/test/dl/test_callback.rb
+++ b/test/dl/test_callback.rb
@@ -25,7 +25,7 @@ module DL
func = CFunc.new(addr, TYPE_VOIDP, 'test')
f = Function.new(func, [TYPE_VOIDP])
ptr = CPtr['blah']
- assert_equal ptr, f.call(ptr)
+ assert_equal ptr.to_i, f.call(ptr).to_i
end
def test_callback_return_arbitrary
@@ -48,8 +48,11 @@ module DL
func = CFunc.new(addr, TYPE_VOID, 'test')
f = Function.new(func, [TYPE_VOIDP])
- f.call(dlwrap('foo'))
- assert_equal 'foo', called_with
+ # Don't remove local variable arg.
+ # This necessary to protect objects from GC.
+ arg = 'foo'
+ f.call(dlwrap(arg))
+ assert_equal arg, called_with
end
def test_call_callback
diff --git a/test/dl/test_cfunc.rb b/test/dl/test_cfunc.rb
index c0bab45700..39fa8133a2 100644
--- a/test/dl/test_cfunc.rb
+++ b/test/dl/test_cfunc.rb
@@ -72,7 +72,7 @@ module DL
Thread.new do
f = Function.new(@cf, [TYPE_VOIDP, TYPE_VOIDP])
assert_nil CFunc.last_error
- str = f.call("000", "123")
+ f.call("000", "123")
assert_not_nil CFunc.last_error
end.join
end
diff --git a/test/dl/test_cparser.rb b/test/dl/test_cparser.rb
index 3be727a759..a4deb6733e 100644
--- a/test/dl/test_cparser.rb
+++ b/test/dl/test_cparser.rb
@@ -4,10 +4,30 @@ require 'dl/cparser'
module DL
class TestCParser < TestBase
- include DL::CParser
+ include CParser
def test_uint_ctype
- assert_equal(-DL::TYPE_INT, parse_ctype('uint'))
+ assert_equal(-TYPE_INT, parse_ctype('uint'))
+ end
+
+ def test_size_t_ctype
+ assert_equal(TYPE_SIZE_T, parse_ctype("size_t"))
+ end
+
+ def test_ssize_t_ctype
+ assert_equal(TYPE_SSIZE_T, parse_ctype("ssize_t"))
+ end
+
+ def test_ptrdiff_t_ctype
+ assert_equal(TYPE_PTRDIFF_T, parse_ctype("ptrdiff_t"))
+ end
+
+ def test_intptr_t_ctype
+ assert_equal(TYPE_INTPTR_T, parse_ctype("intptr_t"))
+ end
+
+ def test_uintptr_t_ctype
+ assert_equal(TYPE_UINTPTR_T, parse_ctype("uintptr_t"))
end
end
end
diff --git a/test/dl/test_dl2.rb b/test/dl/test_dl2.rb
index 1d6e39114f..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)
@@ -28,20 +19,11 @@ class TestDL < TestBase
assert_equal ptr_id, ptr.to_i
cfunc = CFunc.new(@libc['strcpy'], TYPE_VOIDP, 'strcpy')
- x = cfunc.call([ptr_id,str].pack("l!p").unpack("l!*"))
+ cfunc.call([ptr_id,str].pack("l!p").unpack("l!*"))
assert_equal("abc\0", ptr[0,4])
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"
@@ -51,20 +33,11 @@ class TestDL < TestBase
assert_equal ptr_id, ptr.to_i
cfunc = CFunc.new(@libc['strcpy'], TYPE_VOIDP, 'strcpy')
- x = cfunc.call([ptr_id,str].pack("l!p").unpack("l!*"))
+ cfunc.call([ptr_id,str].pack("l!p").unpack("l!*"))
assert_equal("abc\0", ptr[0,4])
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!*"))
@@ -151,5 +124,17 @@ class TestDL < TestBase
ary2 = dlunwrap(addr)
assert_equal(ary, ary2)
end
+
+ def test_type_size_t
+ assert_equal(DL::TYPE_SSIZE_T, DL::TYPE_SIZE_T.abs)
+ end
+
+ def test_type_uintptr_t
+ assert_equal(-DL::TYPE_INTPTR_T, DL::TYPE_UINTPTR_T)
+ end
+
+ def test_sizeof_uintptr_t
+ assert_equal(DL::SIZEOF_VOIDP, DL::SIZEOF_INTPTR_T)
+ end
end
end # module DL
diff --git a/test/dl/test_func.rb b/test/dl/test_func.rb
index 4e69dea10d..3b5ad3394f 100644
--- a/test/dl/test_func.rb
+++ b/test/dl/test_func.rb
@@ -157,7 +157,7 @@ module DL
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_INT, TYPE_INT, TYPE_VOIDP])
+ [TYPE_VOIDP, TYPE_SIZE_T, TYPE_SIZE_T, TYPE_VOIDP])
buff = "9341"
qsort.call(buff, buff.size, 1, cb)
assert_equal("1349", buff)
@@ -175,7 +175,7 @@ module DL
cb = TempFunction.new(CFunc.new(0, TYPE_INT, '<callback>qsort'),
[TYPE_VOIDP, TYPE_VOIDP])
qsort = Function.new(CFunc.new(@libc['qsort'], TYPE_VOID, 'qsort'),
- [TYPE_VOIDP, TYPE_INT, TYPE_INT, TYPE_VOIDP])
+ [TYPE_VOIDP, TYPE_SIZE_T, TYPE_SIZE_T, TYPE_VOIDP])
buff = "9341"
qsort.call(buff, buff.size, 1, cb){|x,y| CPtr.new(x)[0] <=> CPtr.new(y)[0]}
assert_equal("1349", buff)
diff --git a/test/dl/test_handle.rb b/test/dl/test_handle.rb
index cc4df49c84..4ef93adf41 100644
--- a/test/dl/test_handle.rb
+++ b/test/dl/test_handle.rb
@@ -1,4 +1,5 @@
require_relative 'test_base'
+require_relative '../ruby/envutil'
module DL
class TestHandle < TestBase
@@ -158,9 +159,11 @@ module DL
# interface, below, should be used, since getpid() is a function and not a
# data object.)
# --- FreeBSD 8.0 dlsym(3)
- require 'objspace'
- handle = DL::Handle::NEXT
- assert_not_nil handle['Init_objspace']
+ assert_in_out_err(['RUBYOPT' => '-W0'], <<-INPUT, /\A#<DL::Handle:0x[0-9a-f]+>\z/)
+ require 'dl'
+ require 'objspace'
+ print DL::Handle::NEXT.inspect
+ INPUT
end
end unless /mswin|mingw/ =~ RUBY_PLATFORM
diff --git a/test/dl/test_import.rb b/test/dl/test_import.rb
index 26b9f3c803..8b3f39b851 100644
--- a/test/dl/test_import.rb
+++ b/test/dl/test_import.rb
@@ -1,3 +1,4 @@
+# coding: US-ASCII
require_relative 'test_base'
require 'dl/import'
@@ -34,7 +35,7 @@ module DL
]
CallCallback = bind("void call_callback(void*, void*)"){|ptr1, ptr2|
- f = Function.new(CFunc.new(ptr1.to_i, DL::TYPE_VOID, "<anonymous>"), [TYPE_VOIDP])
+ f = Function.new(CFunc.new(ptr1.to_i, TYPE_VOID, "<anonymous>"), [TYPE_VOIDP])
f.call(ptr2)
}
CarriedFunction = bind("void callback_function(void*)", :carried, 0)
@@ -44,7 +45,7 @@ module DL
def test_ensure_call_dlload
err = assert_raises(RuntimeError) do
Class.new do
- extend DL::Importer
+ extend Importer
extern "void *strcpy(char*, char*)"
end
end
@@ -58,7 +59,7 @@ module DL
end
def test_sizeof()
- assert_equal(DL::SIZEOF_VOIDP, LIBC.sizeof("FILE*"))
+ assert_equal(SIZEOF_VOIDP, LIBC.sizeof("FILE*"))
assert_equal(LIBC::MyStruct.size(), LIBC.sizeof(LIBC::MyStruct))
end
@@ -70,7 +71,7 @@ module DL
end
def test_io()
- if( RUBY_PLATFORM != DL::BUILD_RUBY_PLATFORM )
+ if( RUBY_PLATFORM != BUILD_RUBY_PLATFORM )
return
end
io_in,io_out = IO.pipe()
diff --git a/test/drb/drbtest.rb b/test/drb/drbtest.rb
index b9285b58ec..8ca575089f 100644
--- a/test/drb/drbtest.rb
+++ b/test/drb/drbtest.rb
@@ -63,9 +63,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
@@ -73,17 +73,31 @@ module DRbCore
def teardown
@ext.stop_service if defined?(@ext) && @ext
DRbService.manager.unregist(@service_name)
- signal = /mswin|mingw/ =~ RUBY_PLATFORM ? :INT : :TERM
+ 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
- begin
- Process.kill signal, th.pid
- rescue Errno::ESRCH
+ 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
+end
+
+module DRbCore
+ include DRbBase
def test_00_DRbObject
ro = DRbObject.new(nil, 'druby://localhost:12345')
@@ -128,11 +142,7 @@ module DRbCore
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('DRbEx::', obj.name)
assert_raise(DRb::DRbUnknownError) do
@there.unknown_error
@@ -282,26 +292,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)
- signal = /mswin|mingw/ =~ RUBY_PLATFORM ? :INT : :TERM
- Thread.list.each {|th|
- if th.respond_to?(:pid) && th[:drb_service] == @service_name
- begin
- Process.kill signal, th.pid
- rescue Errno::ESRCH
- end
- th.join
- end
- }
- end
+ include DRbBase
def test_01
assert_kind_of(DRb::DRbObject, @there)
diff --git a/test/drb/ignore_test_drb.rb b/test/drb/ignore_test_drb.rb
index d0bb1f49b0..217c1c3f6b 100644
--- a/test/drb/ignore_test_drb.rb
+++ b/test/drb/ignore_test_drb.rb
@@ -4,21 +4,7 @@ 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
diff --git a/test/drb/test_drb.rb b/test/drb/test_drb.rb
index dc9a47d221..573818558a 100644
--- a/test/drb/test_drb.rb
+++ b/test/drb/test_drb.rb
@@ -2,16 +2,19 @@ require_relative 'drbtest'
class TestDRbCore < Test::Unit::TestCase
include DRbCore
-end
-class TestDRbYield < Test::Unit::TestCase
def setup
- @ext = DRbService.ext_service('ut_drb.rb')
- @there = @ext.front
+ setup_service 'ut_drb.rb'
+ super
end
+end
- def teardown
- @ext.stop_service if @ext
+class TestDRbYield < Test::Unit::TestCase
+ include DRbBase
+
+ def setup
+ setup_service 'ut_drb.rb'
+ super
end
def test_01_one
@@ -177,12 +180,19 @@ end
class TestDRbAry < Test::Unit::TestCase
include DRbAry
+
+ def setup
+ setup_service 'ut_array.rb'
+ super
+ 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 +202,7 @@ class TestDRbMServer < Test::Unit::TestCase
@server.each do |s|
s.stop_service
end
- @ext.stop_service if @ext
+ super
end
def test_01
@@ -202,9 +212,7 @@ 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
end
@@ -258,13 +266,11 @@ class TestDRbEval # < Test::Unit::TestCase
end
class TestDRbLarge < Test::Unit::TestCase
- def setup
- @ext = DRbService.ext_service('ut_large.rb')
- @there = @ext.front
- end
+ include DRbBase
- def teardown
- @ext.stop_service if @ext
+ def setup
+ setup_service 'ut_large.rb'
+ super
end
def test_01_large_ary
@@ -302,15 +308,13 @@ 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
- end
-
def test_bug4409
foo = @there.foo
assert(@there.foo?(foo))
diff --git a/test/drb/test_drbssl.rb b/test/drb/test_drbssl.rb
index 6322434eaa..a54e2234ba 100644
--- a/test/drb/test_drbssl.rb
+++ b/test/drb/test_drbssl.rb
@@ -36,9 +36,8 @@ 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 test_02_unknown
@@ -54,9 +53,8 @@ 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
end
diff --git a/test/drb/test_drbunix.rb b/test/drb/test_drbunix.rb
index 1fba033aca..ffc09e25b3 100644
--- a/test/drb/test_drbunix.rb
+++ b/test/drb/test_drbunix.rb
@@ -20,9 +20,8 @@ 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 test_02_unknown
@@ -38,9 +37,8 @@ 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
end
diff --git a/test/drb/ut_array.rb b/test/drb/ut_array.rb
index 6d9778ffbc..8ff001dd9f 100644
--- a/test/drb/ut_array.rb
+++ b/test/drb/ut_array.rb
@@ -8,7 +8,7 @@ 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
end
diff --git a/test/drb/ut_array_drbssl.rb b/test/drb/ut_array_drbssl.rb
index 5644af5600..8ece677c54 100644
--- a/test/drb/ut_array_drbssl.rb
+++ b/test/drb/ut_array_drbssl.rb
@@ -9,7 +9,18 @@ if __FILE__ == $0
it
end
+ TEST_KEY_DH1024 = OpenSSL::PKey::DH.new <<-_end_of_pem_
+-----BEGIN DH PARAMETERS-----
+MIGHAoGBAKnKQ8MNK6nYZzLrrcuTsLxuiJGXoOO5gT+tljOTbHBuiktdMTITzIY0
+pFxIvjG05D7HoBZQfrR0c92NGWPkAiCkhQKB8JCbPVzwNLDy6DZ0pmofDKrEsYHG
+AQjjxMXhwULlmuR/K+WwlaZPiLIBYalLAZQ7ZbOPeVkJ8ePao0eLAgEC
+-----END DH PARAMETERS-----
+ _end_of_pem_
+
+ TEST_KEY_DH1024.priv_key = OpenSSL::BN.new("48561834C67E65FFD2A9B47F41E5E78FDC95C387428FDB1E4B0188B64D1643C3A8D3455B945B7E8C4D166010C7C2CE23BFB9BEF43D0348FE7FA5284B0225E7FE1537546D114E3D8A4411B9B9351AB451E1A358F50ED61B1F00DA29336EEBBD649980AC86D76AF8BBB065298C2052672EEF3EF13AB47A15275FC2836F3AC74CEA", 16)
+
config = Hash.new
+ config[:SSLTmpDhCallback] = proc { TEST_KEY_DH1024 }
config[:SSLVerifyMode] = OpenSSL::SSL::VERIFY_PEER
config[:SSLVerifyCallback] = lambda{|ok,x509_store|
true
@@ -17,7 +28,7 @@ if __FILE__ == $0
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
end
diff --git a/test/drb/ut_drb.rb b/test/drb/ut_drb.rb
index f5720cfca2..c6cc0590f1 100644
--- a/test/drb/ut_drb.rb
+++ b/test/drb/ut_drb.rb
@@ -32,6 +32,8 @@ class DRbEx
class UError < RuntimeError; end
def initialize
+ @xary2_hash = nil
+ @hash = nil
@hello = 'hello'
end
attr_reader :hello
@@ -157,4 +159,5 @@ if __FILE__ == $0
DRb.start_service('druby://localhost:0', 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_drb_drbssl.rb b/test/drb/ut_drb_drbssl.rb
index 0a2191e71a..c3a3eb075d 100644
--- a/test/drb/ut_drb_drbssl.rb
+++ b/test/drb/ut_drb_drbssl.rb
@@ -1,4 +1,4 @@
-require "#{File.dirname(File.expand_path(__FILE__))}/ut_drb"
+require_relative "ut_drb"
require 'drb/ssl'
if __FILE__ == $0
@@ -8,7 +8,18 @@ if __FILE__ == $0
it
end
+ TEST_KEY_DH1024 = OpenSSL::PKey::DH.new <<-_end_of_pem_
+-----BEGIN DH PARAMETERS-----
+MIGHAoGBAKnKQ8MNK6nYZzLrrcuTsLxuiJGXoOO5gT+tljOTbHBuiktdMTITzIY0
+pFxIvjG05D7HoBZQfrR0c92NGWPkAiCkhQKB8JCbPVzwNLDy6DZ0pmofDKrEsYHG
+AQjjxMXhwULlmuR/K+WwlaZPiLIBYalLAZQ7ZbOPeVkJ8ePao0eLAgEC
+-----END DH PARAMETERS-----
+ _end_of_pem_
+
+ TEST_KEY_DH1024.priv_key = OpenSSL::BN.new("48561834C67E65FFD2A9B47F41E5E78FDC95C387428FDB1E4B0188B64D1643C3A8D3455B945B7E8C4D166010C7C2CE23BFB9BEF43D0348FE7FA5284B0225E7FE1537546D114E3D8A4411B9B9351AB451E1A358F50ED61B1F00DA29336EEBBD649980AC86D76AF8BBB065298C2052672EEF3EF13AB47A15275FC2836F3AC74CEA", 16)
+
config = Hash.new
+ config[:SSLTmpDhCallback] = proc { TEST_KEY_DH1024 }
config[:SSLVerifyMode] = OpenSSL::SSL::VERIFY_PEER
config[:SSLVerifyCallback] = lambda{|ok,x509_store|
true
diff --git a/test/drb/ut_eq.rb b/test/drb/ut_eq.rb
index 330af95289..0f68ac1649 100644
--- a/test/drb/ut_eq.rb
+++ b/test/drb/ut_eq.rb
@@ -24,7 +24,7 @@ if __FILE__ == $0
it
end
- DRb.start_service('druby://:0', Bar.new)
+ DRb.start_service('druby://localhost:0', Bar.new)
es = DRb::ExtServ.new(ARGV.shift, ARGV.shift)
DRb.thread.join
end
diff --git a/test/dtrace/dummy.rb b/test/dtrace/dummy.rb
new file mode 100644
index 0000000000..e85614228c
--- /dev/null
+++ b/test/dtrace/dummy.rb
@@ -0,0 +1 @@
+# this is a dummy file used by test/dtrace/test_require.rb
diff --git a/test/dtrace/helper.rb b/test/dtrace/helper.rb
new file mode 100644
index 0000000000..318857c8dd
--- /dev/null
+++ b/test/dtrace/helper.rb
@@ -0,0 +1,51 @@
+# -*- coding: us-ascii -*-
+require 'test/unit'
+require 'tempfile'
+require_relative '../ruby/envutil'
+
+if Process.euid == 0
+ ok = true
+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 < Test::Unit::TestCase
+ INCLUDE = File.expand_path('..', File.dirname(__FILE__))
+
+ def trap_probe d_program, ruby_program
+ d = Tempfile.new(%w'probe .d')
+ d.write d_program
+ d.flush
+
+ rb = Tempfile.new(%w'probed .rb')
+ rb.write ruby_program
+ rb.flush
+
+ d_path = d.path
+ rb_path = rb.path
+
+ cmd = ["dtrace", "-q", "-s", d_path, "-c", "#{EnvUtil.rubybin} -I#{INCLUDE} #{rb_path}"]
+ 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)
+ rb.close(true)
+ yield(d_path, rb_path, probes)
+ 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
new file mode 100644
index 0000000000..d849bcc0c7
--- /dev/null
+++ b/test/dtrace/test_array_create.rb
@@ -0,0 +1,35 @@
+require_relative 'helper'
+
+module DTrace
+ class TestArrayCreate < TestCase
+ def test_lit
+ trap_probe(probe, '[]') { |_,rbfile,saw|
+ saw = saw.map(&:split).find_all { |num, file, line|
+ file == rbfile && num == '0'
+ }
+ assert_equal([rbfile], saw.map { |line| line[1] })
+ assert_equal(['1'], saw.map { |line| line[2] })
+ }
+ end
+
+ def test_many_lit
+ trap_probe(probe, '[1,2,3,4]') { |_,rbfile,saw|
+ saw = saw.map(&:split).find_all { |num, file, line|
+ file == rbfile && num == '4' && line == '1'
+ }
+ assert_operator saw.length, :>, 0
+ }
+ end
+
+ private
+ def probe type = 'array'
+ <<-eoprobe
+ruby$target:::#{type}-create
+/arg1/
+{
+ printf("%d %s %d\\n", arg0, copyinstr(arg1), arg2);
+}
+ eoprobe
+ end
+ end
+end if defined?(DTrace::TestCase)
diff --git a/test/dtrace/test_cmethod.rb b/test/dtrace/test_cmethod.rb
new file mode 100644
index 0000000000..0a9107fa38
--- /dev/null
+++ b/test/dtrace/test_cmethod.rb
@@ -0,0 +1,49 @@
+require_relative 'helper'
+
+module DTrace
+ class TestCMethod < TestCase
+ def test_entry
+ probe = <<-eoprobe
+ruby$target:::cmethod-entry
+{
+ printf("%s %s %s %d\\n", copyinstr(arg0), copyinstr(arg1), copyinstr(arg2), arg3);
+}
+ eoprobe
+
+ trap_probe(probe, ruby_program) { |d_file, rb_file, probes|
+ foo_calls = probes.map { |line| line.split }.find_all { |row|
+ row[1] == 'times'
+ }
+
+ assert_equal 1, foo_calls.length
+ }
+ end
+
+ def test_exit
+ probe = <<-eoprobe
+ruby$target:::cmethod-return
+{
+ printf("%s %s %s %d\\n", copyinstr(arg0), copyinstr(arg1), copyinstr(arg2), arg3);
+}
+ eoprobe
+
+ trap_probe(probe, ruby_program) { |d_file, rb_file, probes|
+ foo_calls = probes.map { |line| line.split }.find_all { |row|
+ row[1] == 'times'
+ }
+
+ assert_equal 1, foo_calls.length
+ }
+ end
+
+ def ruby_program
+ <<-eoruby
+ class Foo
+ def self.foo; end
+ end
+ 10.times { Foo.foo }
+ eoruby
+ end
+ end
+end if defined?(DTrace::TestCase)
+
diff --git a/test/dtrace/test_function_entry.rb b/test/dtrace/test_function_entry.rb
new file mode 100644
index 0000000000..74aee64b02
--- /dev/null
+++ b/test/dtrace/test_function_entry.rb
@@ -0,0 +1,87 @@
+require_relative 'helper'
+
+module DTrace
+ class TestFunctionEntry < TestCase
+ def test_function_entry
+ probe = <<-eoprobe
+ruby$target:::method-entry
+/arg0 && arg1 && arg2/
+{
+ printf("%s %s %s %d\\n", copyinstr(arg0), copyinstr(arg1), copyinstr(arg2), arg3);
+}
+ eoprobe
+
+ trap_probe(probe, ruby_program) { |d_file, rb_file, probes|
+ foo_calls = probes.map { |line| line.split }.find_all { |row|
+ row.first == 'Foo' && row[1] == 'foo'
+ }
+
+ assert_equal 10, foo_calls.length
+ line = '2'
+ foo_calls.each { |f| assert_equal line, f[3] }
+ foo_calls.each { |f| assert_equal rb_file, f[2] }
+ }
+ end
+
+ def test_function_return
+ probe = <<-eoprobe
+ruby$target:::method-return
+/arg0 && arg1 && arg2/
+{
+ printf("%s %s %s %d\\n", copyinstr(arg0), copyinstr(arg1), copyinstr(arg2), arg3);
+}
+ eoprobe
+
+ trap_probe(probe, ruby_program) { |d_file, rb_file, probes|
+ foo_calls = probes.map { |line| line.split }.find_all { |row|
+ row.first == 'Foo' && row[1] == 'foo'
+ }
+
+ assert_equal 10, foo_calls.length
+ line = '2'
+ foo_calls.each { |f| assert_equal line, f[3] }
+ foo_calls.each { |f| assert_equal rb_file, f[2] }
+ }
+ end
+
+ def test_return_from_raise
+ program = <<-eoruby
+ class Foo
+ def bar; raise; end
+ def baz
+ bar
+ rescue
+ end
+ end
+
+ Foo.new.baz
+ eoruby
+
+ probe = <<-eoprobe
+ruby$target:::method-return
+/arg0 && arg1 && arg2/
+{
+ printf("%s %s %s %d\\n", copyinstr(arg0), copyinstr(arg1), copyinstr(arg2), arg3);
+}
+ eoprobe
+
+ trap_probe(probe, program) { |d_file, rb_file, probes|
+ foo_calls = probes.map { |line| line.split }.find_all { |row|
+ row.first == 'Foo' && row[1] == 'bar'
+ }
+ assert foo_calls.any?
+ }
+ end
+
+ private
+ def ruby_program
+ <<-eoruby
+ class Foo
+ def foo; end
+ end
+ x = Foo.new
+ 10.times { x.foo }
+ eoruby
+ end
+ end
+end if defined?(DTrace::TestCase)
diff --git a/test/dtrace/test_gc.rb b/test/dtrace/test_gc.rb
new file mode 100644
index 0000000000..2f58a11096
--- /dev/null
+++ b/test/dtrace/test_gc.rb
@@ -0,0 +1,26 @@
+require_relative 'helper'
+
+module DTrace
+ class TestGC < TestCase
+ %w{
+ gc-mark-begin
+ gc-mark-end
+ gc-sweep-begin
+ gc-sweep-end
+ }.each do |probe_name|
+ define_method(:"test_#{probe_name.gsub(/-/, '_')}") do
+ probe = "ruby$target:::#{probe_name} { printf(\"#{probe_name}\\n\"); }"
+
+ trap_probe(probe, ruby_program) { |_, _, saw|
+ assert_operator saw.length, :>, 0
+ }
+
+ end
+ end
+
+ private
+ def ruby_program
+ "100000.times { Object.new }"
+ end
+ end
+end if defined?(DTrace::TestCase)
diff --git a/test/dtrace/test_hash_create.rb b/test/dtrace/test_hash_create.rb
new file mode 100644
index 0000000000..2cceded38f
--- /dev/null
+++ b/test/dtrace/test_hash_create.rb
@@ -0,0 +1,52 @@
+require_relative 'helper'
+
+module DTrace
+ class TestHashCreate < TestCase
+ def test_hash_new
+ trap_probe(probe, 'Hash.new') { |_,rbfile,saw|
+ saw = saw.map(&:split).find_all { |num, file, line|
+ file == rbfile && num == '0'
+ }
+ assert_operator saw.length, :>, 0
+ }
+ end
+
+ def test_hash_lit
+ trap_probe(probe, '{}') { |_,rbfile,saw|
+ saw = saw.map(&:split).find_all { |num, file, line|
+ file == rbfile && num == '0'
+ }
+ assert_operator saw.length, :>, 0
+ }
+ end
+
+ def test_hash_lit_elements
+ trap_probe(probe, '{ :foo => :bar }') { |_,rbfile,saw|
+ saw = saw.map(&:split).find_all { |num, file, line|
+ file == rbfile && num == '2'
+ }
+ assert_operator saw.length, :>, 0
+ }
+ end
+
+ def test_hash_lit_elements_string
+ trap_probe(probe, '{ :foo => :bar, :bar => "baz" }') { |_,rbfile,saw|
+ saw = saw.map(&:split).find_all { |num, file, line|
+ file == rbfile && num == '4'
+ }
+ assert_operator saw.length, :>, 0
+ }
+ end
+
+ private
+ def probe
+ <<-eoprobe
+ruby$target:::hash-create
+/arg1/
+{
+ printf("%d %s %d\\n", arg0, copyinstr(arg1), arg2);
+}
+ eoprobe
+ end
+ end
+end if defined?(DTrace::TestCase)
diff --git a/test/dtrace/test_load.rb b/test/dtrace/test_load.rb
new file mode 100644
index 0000000000..cceb0c2925
--- /dev/null
+++ b/test/dtrace/test_load.rb
@@ -0,0 +1,52 @@
+require_relative 'helper'
+require 'tempfile'
+
+module DTrace
+ class TestLoad < TestCase
+ def setup
+ super
+ @rbfile = Tempfile.new(['omg', 'rb'])
+ @rbfile.write 'x = 10'
+ end
+
+ def teardown
+ super
+ @rbfile.close(true) if @rbfile
+ end
+
+ def test_load_entry
+ probe = <<-eoprobe
+ruby$target:::load-entry
+{
+ printf("%s %s %d\\n", copyinstr(arg0), copyinstr(arg1), arg2);
+}
+ eoprobe
+ trap_probe(probe, program) { |dpath, rbpath, saw|
+ saw = saw.map(&:split).find_all { |loaded, _, _|
+ loaded == @rbfile.path
+ }
+ assert_equal 10, saw.length
+ }
+ end
+
+ def test_load_return
+ probe = <<-eoprobe
+ruby$target:::load-return
+{
+ printf("%s\\n", copyinstr(arg0));
+}
+ eoprobe
+ trap_probe(probe, program) { |dpath, rbpath, saw|
+ saw = saw.map(&:split).find_all { |loaded, _, _|
+ loaded == @rbfile.path
+ }
+ assert_equal 10, saw.length
+ }
+ end
+
+ private
+ def program
+ "10.times { load '#{@rbfile.path}' }"
+ 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
new file mode 100644
index 0000000000..2be9611613
--- /dev/null
+++ b/test/dtrace/test_object_create_start.rb
@@ -0,0 +1,35 @@
+require_relative 'helper'
+
+module DTrace
+ class TestObjectCreateStart < TestCase
+ def test_object_create_start
+ trap_probe(probe, '10.times { Object.new }') { |_,rbfile,saw|
+ saw = saw.map(&:split).find_all { |_, file, _|
+ file == rbfile
+ }
+ assert_equal 10, saw.length
+ }
+ end
+
+ def test_object_create_start_name
+ trap_probe(probe, 'Hash.new') { |_,rbfile,saw|
+ saw = saw.map(&:split).find_all { |klass, file, line|
+ file == rbfile
+ }
+ assert_equal(%w{ Hash }, saw.map(&:first))
+ assert_equal([rbfile], saw.map { |line| line[1] })
+ assert_equal(['1'], saw.map { |line| line[2] })
+ }
+ end
+
+ private
+ def probe
+ <<-eoprobe
+ruby$target:::object-create
+{
+ printf("%s %s %d\\n", copyinstr(arg0), copyinstr(arg1), arg2);
+}
+ eoprobe
+ end
+ end
+end if defined?(DTrace::TestCase)
diff --git a/test/dtrace/test_raise.rb b/test/dtrace/test_raise.rb
new file mode 100644
index 0000000000..48fdbf14d1
--- /dev/null
+++ b/test/dtrace/test_raise.rb
@@ -0,0 +1,29 @@
+require_relative 'helper'
+
+module DTrace
+ class TestRaise < TestCase
+ def test_raise
+ probe = <<-eoprobe
+ruby$target:::raise
+{
+ printf("%s %s %d\\n", copyinstr(arg0), copyinstr(arg1), arg2);
+}
+ eoprobe
+ trap_probe(probe, program) { |dpath, rbpath, saw|
+ saw = saw.map(&:split).find_all { |_, source_file, _|
+ source_file == rbpath
+ }
+ assert_equal 10, saw.length
+ saw.each do |klass, _, source_line|
+ assert_equal 'RuntimeError', klass
+ assert_equal '1', source_line
+ end
+ }
+ end
+
+ private
+ def program
+ '10.times { raise rescue nil }'
+ end
+ end
+end if defined?(DTrace::TestCase)
diff --git a/test/dtrace/test_require.rb b/test/dtrace/test_require.rb
new file mode 100644
index 0000000000..46a1d7652a
--- /dev/null
+++ b/test/dtrace/test_require.rb
@@ -0,0 +1,34 @@
+require_relative 'helper'
+
+module DTrace
+ class TestRequire < TestCase
+ def test_require_entry
+ probe = <<-eoprobe
+ruby$target:::require-entry
+{
+ printf("%s %s %d\\n", copyinstr(arg0), copyinstr(arg1), arg2);
+}
+ eoprobe
+ trap_probe(probe, ruby_program) { |d_file, rb_file, saw|
+ required = saw.map { |s| s.split }.find_all do |(required, _)|
+ required == 'dtrace/dummy'
+ end
+ assert_equal 10, required.length
+ }
+ end
+
+ def test_require_return
+ probe = <<-eoprobe
+ruby$target:::require-return
+{
+ printf("%s\\n", copyinstr(arg0));
+}
+ eoprobe
+ end
+
+ private
+ def ruby_program
+ "10.times { require 'dtrace/dummy' }"
+ end
+ end
+end if defined?(DTrace::TestCase)
diff --git a/test/dtrace/test_singleton_function.rb b/test/dtrace/test_singleton_function.rb
new file mode 100644
index 0000000000..9e118f65b7
--- /dev/null
+++ b/test/dtrace/test_singleton_function.rb
@@ -0,0 +1,55 @@
+require_relative 'helper'
+
+module DTrace
+ class TestSingletonFunctionEntry < TestCase
+ def test_entry
+ probe = <<-eoprobe
+ruby$target:::method-entry
+/strstr(copyinstr(arg0), "Foo") != NULL/
+{
+ printf("%s %s %s %d\\n", copyinstr(arg0), copyinstr(arg1), copyinstr(arg2), arg3);
+}
+ eoprobe
+
+ trap_probe(probe, ruby_program) { |d_file, rb_file, probes|
+ foo_calls = probes.map { |line| line.split }.find_all { |row|
+ row.first == 'Foo' && row[1] == 'foo'
+ }
+
+ assert_equal 10, foo_calls.length
+ line = '2'
+ foo_calls.each { |f| assert_equal line, f[3] }
+ foo_calls.each { |f| assert_equal rb_file, f[2] }
+ }
+ end
+
+ def test_exit
+ probe = <<-eoprobe
+ruby$target:::method-return
+{
+ printf("%s %s %s %d\\n", copyinstr(arg0), copyinstr(arg1), copyinstr(arg2), arg3);
+}
+ eoprobe
+
+ trap_probe(probe, ruby_program) { |d_file, rb_file, probes|
+ foo_calls = probes.map { |line| line.split }.find_all { |row|
+ row.first == 'Foo' && row[1] == 'foo'
+ }
+
+ assert_equal 10, foo_calls.length
+ line = '2'
+ foo_calls.each { |f| assert_equal line, f[3] }
+ foo_calls.each { |f| assert_equal rb_file, f[2] }
+ }
+ end
+
+ def ruby_program
+ <<-eoruby
+ class Foo
+ def self.foo; end
+ end
+ 10.times { Foo.foo }
+ eoruby
+ end
+ end
+end if defined?(DTrace::TestCase)
diff --git a/test/dtrace/test_string.rb b/test/dtrace/test_string.rb
new file mode 100644
index 0000000000..873d5ac364
--- /dev/null
+++ b/test/dtrace/test_string.rb
@@ -0,0 +1,27 @@
+require_relative 'helper'
+
+module DTrace
+ class TestStringProbes < TestCase
+ def test_object_create_start_string_lit
+ trap_probe(probe, '"omglolwutbbq"') { |_,rbfile,saw|
+ saw = saw.map(&:split).find_all { |klass, file, line, len|
+ file == rbfile && len == '12' && line == '1'
+ }
+ assert_equal(%w{ String }, saw.map(&:first))
+ assert_equal([rbfile], saw.map { |line| line[1] })
+ assert_equal(['1'], saw.map { |line| line[2] })
+ }
+ end
+
+ private
+ def probe
+ <<-eoprobe
+ruby$target:::string-create
+/arg1/
+{
+ printf("String %s %d %d\\n", copyinstr(arg1), arg2, arg0);
+}
+ eoprobe
+ end
+ end
+end if defined?(DTrace::TestCase)
diff --git a/test/erb/test_erb.rb b/test/erb/test_erb.rb
index 05d255623a..65efd39191 100644
--- a/test/erb/test_erb.rb
+++ b/test/erb/test_erb.rb
@@ -1,3 +1,4 @@
+# -*- coding: us-ascii -*-
require 'test/unit'
require 'erb'
@@ -37,6 +38,27 @@ class TestERB < Test::Unit::TestCase
}
assert_match(/\Atest filename:1\b/, e.backtrace[0])
end
+
+ def test_html_escape
+ assert_equal(" !&quot;\#$%&amp;&#39;()*+,-./0123456789:;&lt;=&gt;?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~",
+ ERB::Util.html_escape(" !\"\#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"))
+
+ assert_equal("", ERB::Util.html_escape(""))
+ assert_equal("abc", ERB::Util.html_escape("abc"))
+ assert_equal("&lt;&lt;", ERB::Util.html_escape("<\<"))
+
+ assert_equal("", ERB::Util.html_escape(nil))
+ assert_equal("123", ERB::Util.html_escape(123))
+ end
+
+ def test_concurrent_default_binding
+ template1 = 'one <%= ERB.new(template2).result %>'
+
+ eval 'template2 = "two"', TOPLEVEL_BINDING
+
+ bug7046 = '[ruby-core:47638]'
+ assert_equal("one two", ERB.new(template1).result, bug7046)
+ end
end
class TestERBCore < Test::Unit::TestCase
@@ -49,7 +71,13 @@ class TestERBCore < Test::Unit::TestCase
_test_core(0)
_test_core(1)
_test_core(2)
- _test_core(3)
+ orig = $VERBOSE
+ begin
+ $VERBOSE = false
+ _test_core(3)
+ ensure
+ $VERBOSE = orig
+ end
end
def _test_core(safe)
@@ -157,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
@@ -182,26 +205,26 @@ EOS
%n = 1
<%= n%>
EOS
- assert_equal("1\n", ERB.new(src, nil, '%').result)
+ assert_equal("1\n", ERB.new(src, nil, '%').result(binding))
src = <<EOS
<%
%>
EOS
ans = "\n"
- assert_equal(ans, ERB.new(src, nil, '%').result)
+ assert_equal(ans, ERB.new(src, nil, '%').result(binding))
src = "<%\n%>"
# ans = "\n"
ans = ""
- assert_equal(ans, ERB.new(src, nil, '%').result)
+ assert_equal(ans, ERB.new(src, nil, '%').result(binding))
src = <<EOS
<%
n = 1
%><%= n%>
EOS
- assert_equal("1\n", ERB.new(src, nil, '%').result)
+ assert_equal("1\n", ERB.new(src, nil, '%').result(binding))
src = <<EOS
%n = 1
@@ -212,12 +235,12 @@ end%>
%%%
EOS
ans = <<EOS
-%
+%\s
% %%><%0
% %%><%1
%%
EOS
- assert_equal(ans, ERB.new(src, nil, '%').result)
+ assert_equal(ans, ERB.new(src, nil, '%').result(binding))
end
def test_def_erb_method
@@ -300,7 +323,7 @@ EOS
def test_keep_lineno
src = <<EOS
-Hello,
+Hello,\s
% x = "World"
<%= x%>
% raise("lineno")
@@ -316,21 +339,21 @@ EOS
src = <<EOS
%>
-Hello,
+Hello,\s
<% x = "World%%>
"%>
<%= x%>
EOS
ans = <<EOS
-%>Hello,
+%>Hello,\s
World%>
EOS
assert_equal(ans, ERB.new(src, nil, '>').result)
ans = <<EOS
%>
-Hello,
+Hello,\s
World%>
EOS
@@ -338,7 +361,7 @@ EOS
ans = <<EOS
%>
-Hello,
+Hello,\s
World%>
@@ -346,7 +369,7 @@ EOS
assert_equal(ans, ERB.new(src).result)
src = <<EOS
-Hello,
+Hello,\s
<% x = "World%%>
"%>
<%= x%>
@@ -381,7 +404,7 @@ EOS
% y = 'Hello'
<%- x = "World%%>
"-%>
-<%= x %><%- x = nil -%>
+<%= x %><%- x = nil -%>\s
<% raise("lineno") %>
EOS
@@ -417,19 +440,19 @@ NotSkip <%- y = x -%> NotSkip
<%- up = w.upcase -%>
* <%= up %>
<%- end -%>
-KeepNewLine <%- z = nil -%>
+KeepNewLine <%- z = nil -%>\s
EOS
ans = <<EOS
NotSkip NotSkip
* HELLO
* WORLD
- NotSkip
+ NotSkip\s
* hello
* HELLO
* world
* WORLD
-KeepNewLine
+KeepNewLine \s
EOS
assert_equal(ans, ERB.new(src, nil, '-').result)
assert_equal(ans, ERB.new(src, nil, '-%').result)
diff --git a/test/etc/test_etc.rb b/test/etc/test_etc.rb
index 5bc8db431c..c105122af1 100644
--- a/test/etc/test_etc.rb
+++ b/test/etc/test_etc.rb
@@ -76,13 +76,18 @@ class TestEtc < Test::Unit::TestCase
end
def test_getgrgid
- groups = {}
- Etc.group do |s|
- groups[s.gid] ||= s
+ # group database is not unique on GID, and which entry will be
+ # returned by getgrgid() is not specified.
+ groups = Hash.new {[]}
+ # on MacOSX, same entries are returned from /etc/group and Open
+ # Directory.
+ Etc.group {|s| groups[s.gid] |= [s]}
+ groups.each_pair do |gid, s|
+ assert_include(s, Etc.getgrgid(gid))
end
- groups.each_value do |s|
- assert_equal(s, Etc.getgrgid(s.gid))
- assert_equal(s, Etc.getgrgid) if Process.egid == s.gid
+ s = groups[Process.egid]
+ unless s.empty?
+ assert_include(s, Etc.getgrgid)
end
end
diff --git a/test/fiddle/helper.rb b/test/fiddle/helper.rb
index ad69f55e69..404c137f97 100644
--- a/test/fiddle/helper.rb
+++ b/test/fiddle/helper.rb
@@ -1,5 +1,4 @@
require 'minitest/autorun'
-require 'dl'
require 'fiddle'
# FIXME: this is stolen from DL and needs to be refactored.
@@ -35,6 +34,12 @@ when /darwin/
when /kfreebsd/
libc_so = "/lib/libc.so.0.1"
libm_so = "/lib/libm.so.1"
+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 /bsd|dragonfly/
libc_so = "/usr/lib/libc.so"
libm_so = "/usr/lib/libm.so"
@@ -104,8 +109,14 @@ Fiddle::LIBM_SO = libm_so
module Fiddle
class TestCase < MiniTest::Unit::TestCase
def setup
- @libc = DL.dlopen(LIBC_SO)
- @libm = DL.dlopen(LIBM_SO)
+ @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
new file mode 100644
index 0000000000..de5449b43d
--- /dev/null
+++ b/test/fiddle/test_c_struct_entry.rb
@@ -0,0 +1,76 @@
+begin
+ require_relative 'helper'
+ require 'fiddle/struct'
+rescue LoadError
+end
+
+module Fiddle
+ class TestCStructEntity < TestCase
+ def test_class_size
+ types = [TYPE_DOUBLE, TYPE_CHAR]
+
+ size = CStructEntity.size types
+
+ alignments = types.map { |type| PackInfo::ALIGN_MAP[type] }
+
+ expected = PackInfo.align 0, alignments[0]
+ expected += PackInfo::SIZE_MAP[TYPE_DOUBLE]
+
+ expected = PackInfo.align expected, alignments[1]
+ expected += PackInfo::SIZE_MAP[TYPE_CHAR]
+
+ expected = PackInfo.align expected, alignments.max
+
+ assert_equal expected, size
+ end
+
+ def test_class_size_with_count
+ size = CStructEntity.size([[TYPE_DOUBLE, 2], [TYPE_CHAR, 20]])
+
+ types = [TYPE_DOUBLE, TYPE_CHAR]
+ alignments = types.map { |type| PackInfo::ALIGN_MAP[type] }
+
+ expected = PackInfo.align 0, alignments[0]
+ expected += PackInfo::SIZE_MAP[TYPE_DOUBLE] * 2
+
+ expected = PackInfo.align expected, alignments[1]
+ expected += PackInfo::SIZE_MAP[TYPE_CHAR] * 20
+
+ expected = PackInfo.align expected, alignments.max
+
+ assert_equal expected, size
+ end
+
+ def test_set_ctypes
+ union = CStructEntity.malloc [TYPE_INT, TYPE_LONG]
+ union.assign_names %w[int long]
+
+ # this test is roundabout because the stored ctypes are not accessible
+ union['long'] = 1
+ union['int'] = 2
+
+ assert_equal 1, union['long']
+ assert_equal 2, union['int']
+ end
+
+ def test_aref_pointer_array
+ team = CStructEntity.malloc([[TYPE_VOIDP, 2]])
+ team.assign_names(["names"])
+ alice = Fiddle::Pointer.malloc(6)
+ alice[0, 6] = "Alice\0"
+ bob = Fiddle::Pointer.malloc(4)
+ bob[0, 4] = "Bob\0"
+ team["names"] = [alice, bob]
+ assert_equal(["Alice", "Bob"], team["names"].map(&:to_s))
+ end
+
+ def test_aref_pointer
+ user = CStructEntity.malloc([TYPE_VOIDP])
+ user.assign_names(["name"])
+ alice = Fiddle::Pointer.malloc(6)
+ alice[0, 6] = "Alice\0"
+ user["name"] = alice
+ assert_equal("Alice", user["name"].to_s)
+ end
+ end
+end if defined?(Fiddle)
diff --git a/test/fiddle/test_c_union_entity.rb b/test/fiddle/test_c_union_entity.rb
new file mode 100644
index 0000000000..165c4ecacb
--- /dev/null
+++ b/test/fiddle/test_c_union_entity.rb
@@ -0,0 +1,34 @@
+begin
+ require_relative 'helper'
+ require 'fiddle/struct'
+rescue LoadError
+end
+
+
+module Fiddle
+ class TestCUnionEntity < TestCase
+ def test_class_size
+ size = CUnionEntity.size([TYPE_DOUBLE, TYPE_CHAR])
+
+ assert_equal SIZEOF_DOUBLE, size
+ end
+
+ def test_class_size_with_count
+ size = CUnionEntity.size([[TYPE_DOUBLE, 2], [TYPE_CHAR, 20]])
+
+ assert_equal SIZEOF_CHAR * 20, size
+ end
+
+ def test_set_ctypes
+ union = CUnionEntity.malloc [TYPE_INT, TYPE_LONG]
+ union.assign_names %w[int long]
+
+ # this test is roundabout because the stored ctypes are not accessible
+ union['long'] = 1
+ assert_equal 1, union['long']
+
+ union['int'] = 1
+ assert_equal 1, union['int']
+ end
+ end
+end if defined?(Fiddle)
diff --git a/test/fiddle/test_closure.rb b/test/fiddle/test_closure.rb
index 381b3f96c1..56839e7b63 100644
--- a/test/fiddle/test_closure.rb
+++ b/test/fiddle/test_closure.rb
@@ -57,8 +57,8 @@ module Fiddle
end
%w[INT SHORT CHAR LONG LONG_LONG].each do |name|
- type = DL.const_get("TYPE_#{name}") rescue next
- size = DL.const_get("SIZEOF_#{name}")
+ type = Fiddle.const_get("TYPE_#{name}") rescue next
+ size = Fiddle.const_get("SIZEOF_#{name}")
[[type, size-1, name], [-type, size, "unsigned_"+name]].each do |t, s, n|
define_method("test_conversion_#{n.downcase}") do
arg = nil
diff --git a/test/fiddle/test_cparser.rb b/test/fiddle/test_cparser.rb
new file mode 100644
index 0000000000..666d8c89d6
--- /dev/null
+++ b/test/fiddle/test_cparser.rb
@@ -0,0 +1,35 @@
+begin
+ require_relative 'helper'
+ require 'fiddle/cparser'
+rescue LoadError
+end
+
+module Fiddle
+ class TestCParser < TestCase
+ include CParser
+
+ def test_uint_ctype
+ assert_equal(-TYPE_INT, parse_ctype('uint'))
+ end
+
+ def test_size_t_ctype
+ assert_equal(TYPE_SIZE_T, parse_ctype("size_t"))
+ end
+
+ def test_ssize_t_ctype
+ assert_equal(TYPE_SSIZE_T, parse_ctype("ssize_t"))
+ end
+
+ def test_ptrdiff_t_ctype
+ assert_equal(TYPE_PTRDIFF_T, parse_ctype("ptrdiff_t"))
+ end
+
+ def test_intptr_t_ctype
+ assert_equal(TYPE_INTPTR_T, parse_ctype("intptr_t"))
+ end
+
+ def test_uintptr_t_ctype
+ assert_equal(TYPE_UINTPTR_T, parse_ctype("uintptr_t"))
+ end
+ end
+end if defined?(Fiddle)
diff --git a/test/fiddle/test_fiddle.rb b/test/fiddle/test_fiddle.rb
index 21609933d2..4c6ab97b12 100644
--- a/test/fiddle/test_fiddle.rb
+++ b/test/fiddle/test_fiddle.rb
@@ -4,22 +4,6 @@ rescue LoadError
end
class TestFiddle < Fiddle::TestCase
- def test_constants_match
- [
- :TYPE_VOID,
- :TYPE_VOIDP,
- :TYPE_CHAR,
- :TYPE_SHORT,
- :TYPE_INT,
- :TYPE_LONG,
- :TYPE_LONG_LONG,
- :TYPE_FLOAT,
- :TYPE_DOUBLE,
- ].each do |name|
- assert_equal(DL.const_get(name), Fiddle.const_get(name))
- end
- end
-
def test_windows_constant
require 'rbconfig'
if RbConfig::CONFIG['host_os'] =~ /mswin|mingw/
diff --git a/test/fiddle/test_func.rb b/test/fiddle/test_func.rb
new file mode 100644
index 0000000000..529aaa8baf
--- /dev/null
+++ b/test/fiddle/test_func.rb
@@ -0,0 +1,92 @@
+begin
+ require_relative 'helper'
+rescue LoadError
+end
+
+module Fiddle
+ class TestFunc < TestCase
+ def test_random
+ f = Function.new(@libc['srand'], [-TYPE_LONG], TYPE_VOID)
+ assert_nil f.call(10)
+ end
+
+ def test_syscall_with_tainted_string
+ f = Function.new(@libc['system'], [TYPE_VOIDP], TYPE_INT)
+ assert_raises(SecurityError) do
+ Thread.new {
+ $SAFE = 1
+ f.call("uname -rs".taint)
+ }.join
+ end
+ end
+
+ def test_sinf
+ begin
+ f = Function.new(@libm['sinf'], [TYPE_FLOAT], TYPE_FLOAT)
+ rescue Fiddle::DLError
+ skip "libm may not have sinf()"
+ end
+ assert_in_delta 1.0, f.call(90 * Math::PI / 180), 0.0001
+ end
+
+ def test_sin
+ f = Function.new(@libm['sin'], [TYPE_DOUBLE], TYPE_DOUBLE)
+ assert_in_delta 1.0, f.call(90 * Math::PI / 180), 0.0001
+ end
+
+ def test_string
+ stress, GC.stress = GC.stress, true
+ f = Function.new(@libc['strcpy'], [TYPE_VOIDP, TYPE_VOIDP], TYPE_VOIDP)
+ buff = "000"
+ str = f.call(buff, "123")
+ assert_equal("123", buff)
+ assert_equal("123", str.to_s)
+ ensure
+ GC.stress = stress
+ end
+
+ def test_isdigit
+ f = Function.new(@libc['isdigit'], [TYPE_INT], TYPE_INT)
+ r1 = f.call(?1.ord)
+ r2 = f.call(?2.ord)
+ rr = f.call(?r.ord)
+ assert_operator r1, :>, 0
+ assert_operator r2, :>, 0
+ assert_equal 0, rr
+ end
+
+ def test_atof
+ f = Function.new(@libc['atof'], [TYPE_VOIDP], TYPE_DOUBLE)
+ r = f.call("12.34")
+ assert_includes(12.00..13.00, r)
+ end
+
+ def test_strtod
+ f = Function.new(@libc['strtod'], [TYPE_VOIDP, TYPE_VOIDP], TYPE_DOUBLE)
+ buff1 = Pointer["12.34"]
+ buff2 = buff1 + 4
+ r = f.call(buff1, - buff2)
+ assert_in_delta(12.34, r, 0.001)
+ end
+
+ def test_qsort1
+ cb = Class.new(Closure) {
+ def call(x, y)
+ Pointer.new(x)[0] <=> Pointer.new(y)[0]
+ end
+ }.new(TYPE_INT, [TYPE_VOIDP, TYPE_VOIDP])
+
+ qsort = Function.new(@libc['qsort'],
+ [TYPE_VOIDP, TYPE_SIZE_T, TYPE_SIZE_T, TYPE_VOIDP],
+ TYPE_VOID)
+ buff = "9341"
+ qsort.call(buff, buff.size, 1, cb)
+ assert_equal("1349", buff)
+
+ bug4929 = '[ruby-core:37395]'
+ buff = "9341"
+ EnvUtil.under_gc_stress {qsort.call(buff, buff.size, 1, cb)}
+ assert_equal("1349", buff, bug4929)
+ end
+ end
+end if defined?(Fiddle)
diff --git a/test/fiddle/test_function.rb b/test/fiddle/test_function.rb
index 04c94fb5cb..f7a49dc6fa 100644
--- a/test/fiddle/test_function.rb
+++ b/test/fiddle/test_function.rb
@@ -15,6 +15,11 @@ module Fiddle
assert_equal Function::DEFAULT, func.abi
end
+ def test_name
+ func = Function.new(@libm['sin'], [TYPE_DOUBLE], TYPE_DOUBLE, name: 'sin')
+ assert_equal 'sin', func.name
+ end
+
def test_argument_errors
assert_raises(TypeError) do
Function.new(@libm['sin'], TYPE_DOUBLE, TYPE_DOUBLE)
diff --git a/test/fiddle/test_handle.rb b/test/fiddle/test_handle.rb
new file mode 100644
index 0000000000..2af3e5c903
--- /dev/null
+++ b/test/fiddle/test_handle.rb
@@ -0,0 +1,189 @@
+begin
+ require_relative 'helper'
+rescue LoadError
+end
+
+module Fiddle
+ class TestHandle < TestCase
+ include Fiddle
+
+ def test_to_i
+ handle = Fiddle::Handle.new(LIBC_SO)
+ assert_kind_of Integer, handle.to_i
+ end
+
+ def test_static_sym_secure
+ assert_raises(SecurityError) do
+ Thread.new do
+ $SAFE = 2
+ Fiddle::Handle.sym('calloc')
+ end.join
+ end
+ end
+
+ def test_static_sym_unknown
+ assert_raises(DLError) { Fiddle::Handle.sym('fooo') }
+ assert_raises(DLError) { Fiddle::Handle['fooo'] }
+ end
+
+ def test_static_sym
+ 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']
+ rescue
+ # NetBSD
+ require 'objspace'
+ refute_nil Fiddle::Handle.sym('Init_objspace')
+ assert_equal Fiddle::Handle.sym('Init_objspace'), Fiddle::Handle['Init_objspace']
+ end
+ end
+
+ def test_sym_closed_handle
+ handle = Fiddle::Handle.new(LIBC_SO)
+ handle.close
+ assert_raises(DLError) { handle.sym("calloc") }
+ assert_raises(DLError) { handle["calloc"] }
+ end
+
+ def test_sym_unknown
+ handle = Fiddle::Handle.new(LIBC_SO)
+ assert_raises(DLError) { handle.sym('fooo') }
+ assert_raises(DLError) { handle['fooo'] }
+ end
+
+ def test_sym_with_bad_args
+ handle = Handle.new(LIBC_SO)
+ assert_raises(TypeError) { handle.sym(nil) }
+ assert_raises(TypeError) { handle[nil] }
+ end
+
+ def test_sym_secure
+ assert_raises(SecurityError) do
+ Thread.new do
+ $SAFE = 2
+ handle = Handle.new(LIBC_SO)
+ handle.sym('calloc')
+ end.join
+ end
+ end
+
+ def test_sym
+ handle = Handle.new(LIBC_SO)
+ refute_nil handle.sym('calloc')
+ refute_nil handle['calloc']
+ end
+
+ def test_handle_close
+ handle = Handle.new(LIBC_SO)
+ assert_equal 0, handle.close
+ end
+
+ def test_handle_close_twice
+ handle = Handle.new(LIBC_SO)
+ handle.close
+ assert_raises(DLError) do
+ handle.close
+ end
+ end
+
+ def test_dlopen_returns_handle
+ assert_instance_of Handle, dlopen(LIBC_SO)
+ end
+
+ def test_dlopen_safe
+ assert_raises(SecurityError) do
+ Thread.new do
+ $SAFE = 2
+ dlopen(LIBC_SO)
+ end.join
+ end
+ end
+
+ def test_initialize_safe
+ assert_raises(SecurityError) do
+ Thread.new do
+ $SAFE = 2
+ Handle.new(LIBC_SO)
+ end.join
+ end
+ end
+
+ def test_initialize_noargs
+ handle = Handle.new
+ refute_nil handle['rb_str_new']
+ end
+
+ def test_initialize_flags
+ handle = Handle.new(LIBC_SO, RTLD_LAZY | RTLD_GLOBAL)
+ refute_nil handle['calloc']
+ end
+
+ def test_enable_close
+ handle = Handle.new(LIBC_SO)
+ assert !handle.close_enabled?, 'close is enabled'
+
+ handle.enable_close
+ assert handle.close_enabled?, 'close is not enabled'
+ end
+
+ def test_disable_close
+ handle = Handle.new(LIBC_SO)
+
+ handle.enable_close
+ assert handle.close_enabled?, 'close is enabled'
+ handle.disable_close
+ assert !handle.close_enabled?, 'close is enabled'
+ end
+
+ def test_NEXT
+ begin
+ # Linux / Darwin
+ #
+ # There are two special pseudo-handles, RTLD_DEFAULT and RTLD_NEXT. The former will find
+ # the first occurrence of the desired symbol using the default library search order. The
+ # latter will find the next occurrence of a function in the search order after the current
+ # library. This allows one to provide a wrapper around a function in another shared
+ # library.
+ # --- Ubuntu Linux 8.04 dlsym(3)
+ handle = Handle::NEXT
+ refute_nil handle['malloc']
+ rescue
+ # BSD
+ #
+ # If dlsym() is called with the special handle RTLD_NEXT, then the search
+ # for the symbol is limited to the shared objects which were loaded after
+ # the one issuing the call to dlsym(). Thus, if the function is called
+ # from the main program, all the shared libraries are searched. If it is
+ # called from a shared library, all subsequent shared libraries are
+ # searched. RTLD_NEXT is useful for implementing wrappers around library
+ # functions. For example, a wrapper function getpid() could access the
+ # "real" getpid() with dlsym(RTLD_NEXT, "getpid"). (Actually, the dlfunc()
+ # interface, below, should be used, since getpid() is a function and not a
+ # data object.)
+ # --- FreeBSD 8.0 dlsym(3)
+ require 'objspace'
+ handle = Handle::NEXT
+ refute_nil handle['Init_objspace']
+ end
+ end unless /mswin|mingw/ =~ RUBY_PLATFORM
+
+ def test_DEFAULT
+ skip "Handle::DEFAULT is not supported" if /mswin|mingw/ =~ RUBY_PLATFORM
+ handle = Handle::DEFAULT
+ refute_nil handle['malloc']
+ end unless /mswin|mingw/ =~ RUBY_PLATFORM
+
+ def test_dlerror
+ # FreeBSD (at least 7.2 to 7.2) calls nsdispatch(3) when it calls
+ # getaddrinfo(3). And nsdispatch(3) doesn't call dlerror(3) even if
+ # it calls _nss_cache_cycle_prevention_function with dlsym(3).
+ # So our Fiddle::Handle#sym must call dlerror(3) before call dlsym.
+ # 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')
+ end if /freebsd/=~ RUBY_PLATFORM
+ end
+end if defined?(Fiddle)
diff --git a/test/fiddle/test_import.rb b/test/fiddle/test_import.rb
new file mode 100644
index 0000000000..62985cfcd3
--- /dev/null
+++ b/test/fiddle/test_import.rb
@@ -0,0 +1,140 @@
+# coding: US-ASCII
+begin
+ require_relative 'helper'
+ require 'fiddle/import'
+rescue LoadError
+end
+
+module Fiddle
+ module LIBC
+ extend Importer
+ dlload LIBC_SO, LIBM_SO
+
+ typealias 'string', 'char*'
+ typealias 'FILE*', 'void*'
+
+ extern "void *strcpy(char*, char*)"
+ extern "int isdigit(int)"
+ extern "double atof(string)"
+ extern "unsigned long strtoul(char*, char **, int)"
+ extern "int qsort(void*, unsigned long, unsigned long, void*)"
+ extern "int fprintf(FILE*, char*)"
+ extern "int gettimeofday(timeval*, timezone*)" rescue nil
+
+ BoundQsortCallback = bind("void *bound_qsort_callback(void*, void*)"){|ptr1,ptr2| ptr1[0] <=> ptr2[0]}
+ Timeval = struct [
+ "long tv_sec",
+ "long tv_usec",
+ ]
+ Timezone = struct [
+ "int tz_minuteswest",
+ "int tz_dsttime",
+ ]
+ MyStruct = struct [
+ "short num[5]",
+ "char c",
+ "unsigned char buff[7]",
+ ]
+
+ CallCallback = bind("void call_callback(void*, void*)"){ | ptr1, ptr2|
+ f = Function.new(ptr1.to_i, [TYPE_VOIDP], TYPE_VOID)
+ f.call(ptr2)
+ }
+ end
+
+ class TestImport < TestCase
+ def test_ensure_call_dlload
+ err = assert_raises(RuntimeError) do
+ Class.new do
+ extend Importer
+ extern "void *strcpy(char*, char*)"
+ end
+ end
+ assert_match(/call dlload before/, err.message)
+ end
+
+ def test_malloc()
+ s1 = LIBC::Timeval.malloc()
+ s2 = LIBC::Timeval.malloc()
+ refute_equal(s1.to_ptr.to_i, s2.to_ptr.to_i)
+ end
+
+ def test_sizeof()
+ 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()))
+ end
+
+ def test_unsigned_result()
+ d = (2 ** 31) + 1
+
+ r = LIBC.strtoul(d.to_s, 0, 0)
+ assert_equal(d, r)
+ end
+
+ def test_io()
+ if( RUBY_PLATFORM != BUILD_RUBY_PLATFORM )
+ return
+ end
+ io_in,io_out = IO.pipe()
+ LIBC.fprintf(io_out, "hello")
+ io_out.flush()
+ io_out.close()
+ str = io_in.read()
+ io_in.close()
+ assert_equal("hello", str)
+ end
+
+ def test_value()
+ i = LIBC.value('int', 2)
+ assert_equal(2, i.value)
+
+ d = LIBC.value('double', 2.0)
+ assert_equal(2.0, d.value)
+
+ ary = LIBC.value('int[3]', [0,1,2])
+ assert_equal([0,1,2], ary.value)
+ end
+
+ def test_struct()
+ s = LIBC::MyStruct.malloc()
+ s.num = [0,1,2,3,4]
+ s.c = ?a.ord
+ s.buff = "012345\377"
+ assert_equal([0,1,2,3,4], s.num)
+ assert_equal(?a.ord, s.c)
+ assert_equal([?0.ord,?1.ord,?2.ord,?3.ord,?4.ord,?5.ord,?\377.ord], s.buff)
+ end
+
+ def test_gettimeofday()
+ if( defined?(LIBC.gettimeofday) )
+ timeval = LIBC::Timeval.malloc()
+ timezone = LIBC::Timezone.malloc()
+ LIBC.gettimeofday(timeval, timezone)
+ cur = Time.now()
+ assert(cur.to_i - 2 <= timeval.tv_sec && timeval.tv_sec <= cur.to_i)
+ end
+ end
+
+ def test_strcpy()
+ buff = "000"
+ str = LIBC.strcpy(buff, "123")
+ assert_equal("123", buff)
+ assert_equal("123", str.to_s)
+ end
+
+ def test_isdigit
+ r1 = LIBC.isdigit(?1.ord)
+ r2 = LIBC.isdigit(?2.ord)
+ rr = LIBC.isdigit(?r.ord)
+ assert_operator(r1, :>, 0)
+ assert_operator(r2, :>, 0)
+ assert_equal(0, rr)
+ end
+
+ def test_atof
+ r = LIBC.atof("12.34")
+ assert_includes(12.00..13.00, r)
+ end
+ end
+end if defined?(Fiddle)
diff --git a/test/fiddle/test_pointer.rb b/test/fiddle/test_pointer.rb
new file mode 100644
index 0000000000..1d908f64d9
--- /dev/null
+++ b/test/fiddle/test_pointer.rb
@@ -0,0 +1,234 @@
+begin
+ require_relative 'helper'
+ require_relative '../ruby/envutil'
+rescue LoadError
+end
+
+module Fiddle
+ class TestPointer < TestCase
+ def dlwrap arg
+ Fiddle.dlwrap arg
+ end
+
+ include Test::Unit::Assertions
+
+ def test_cptr_to_int
+ null = Fiddle::NULL
+ assert_equal(null.to_i, null.to_int)
+ end
+
+ def test_malloc_free_func_int
+ free = Fiddle::Function.new(Fiddle::RUBY_FREE, [TYPE_VOIDP], TYPE_VOID)
+ assert_equal free.to_i, Fiddle::RUBY_FREE.to_i
+
+ ptr = Pointer.malloc(10, free.to_i)
+ assert_equal 10, ptr.size
+ assert_equal free.to_i, ptr.free.to_i
+ end
+
+ def test_malloc_free_func
+ free = Fiddle::Function.new(Fiddle::RUBY_FREE, [TYPE_VOIDP], TYPE_VOID)
+
+ ptr = Pointer.malloc(10, free)
+ assert_equal 10, ptr.size
+ assert_equal free.to_i, ptr.free.to_i
+ end
+
+ def test_to_str
+ str = "hello world"
+ ptr = Pointer[str]
+
+ assert_equal 3, ptr.to_str(3).length
+ assert_equal str, ptr.to_str
+
+ ptr[5] = 0
+ assert_equal "hello\0world", ptr.to_str
+ end
+
+ def test_to_s
+ str = "hello world"
+ ptr = Pointer[str]
+
+ assert_equal 3, ptr.to_s(3).length
+ assert_equal str, ptr.to_s
+
+ ptr[5] = 0
+ assert_equal 'hello', ptr.to_s
+ end
+
+ def test_minus
+ str = "hello world"
+ ptr = Pointer[str]
+ assert_equal ptr.to_s, (ptr + 3 - 3).to_s
+ end
+
+ # TODO: what if the pointer size is 0? raise an exception? do we care?
+ def test_plus
+ str = "hello world"
+ ptr = Pointer[str]
+ new_str = ptr + 3
+ assert_equal 'lo world', new_str.to_s
+ end
+
+ def test_inspect
+ ptr = Pointer.new(0)
+ inspect = ptr.inspect
+ assert_match(/size=#{ptr.size}/, inspect)
+ assert_match(/free=#{sprintf("%#x", ptr.free.to_i)}/, inspect)
+ assert_match(/ptr=#{sprintf("%#x", ptr.to_i)}/, inspect)
+ end
+
+ def test_to_ptr_string
+ str = "hello world"
+ ptr = Pointer[str]
+ assert ptr.tainted?, 'pointer should be tainted'
+ assert_equal str.length, ptr.size
+ assert_equal 'hello', ptr[0,5]
+ end
+
+ def test_to_ptr_io
+ buf = Pointer.malloc(10)
+ File.open(__FILE__, 'r') do |f|
+ ptr = Pointer.to_ptr f
+ fread = Function.new(@libc['fread'],
+ [TYPE_VOIDP, TYPE_INT, TYPE_INT, TYPE_VOIDP],
+ TYPE_INT)
+ fread.call(buf.to_i, Fiddle::SIZEOF_CHAR, buf.size - 1, ptr.to_i)
+ end
+
+ File.open(__FILE__, 'r') do |f|
+ assert_equal f.read(9), buf.to_s
+ end
+ end
+
+ def test_to_ptr_with_ptr
+ ptr = Pointer.new 0
+ ptr2 = Pointer.to_ptr Struct.new(:to_ptr).new(ptr)
+ assert_equal ptr, ptr2
+
+ assert_raises(Fiddle::DLError) do
+ Pointer.to_ptr Struct.new(:to_ptr).new(nil)
+ end
+ end
+
+ def test_to_ptr_with_num
+ ptr = Pointer.new 0
+ assert_equal ptr, Pointer[0]
+ end
+
+ def test_equals
+ ptr = Pointer.new 0
+ ptr2 = Pointer.new 0
+ assert_equal ptr2, ptr
+ end
+
+ def test_not_equals
+ ptr = Pointer.new 0
+ refute_equal 10, ptr, '10 should not equal the pointer'
+ end
+
+ def test_cmp
+ ptr = Pointer.new 0
+ assert_nil(ptr <=> 10, '10 should not be comparable')
+ end
+
+ def test_ref_ptr
+ ary = [0,1,2,4,5]
+ addr = Pointer.new(dlwrap(ary))
+ assert_equal addr.to_i, addr.ref.ptr.to_i
+
+ assert_equal addr.to_i, (+ (- addr)).to_i
+ end
+
+ def test_to_value
+ ary = [0,1,2,4,5]
+ addr = Pointer.new(dlwrap(ary))
+ assert_equal ary, addr.to_value
+ end
+
+ def test_free
+ ptr = Pointer.malloc(4)
+ assert_nil ptr.free
+ end
+
+ def test_free=
+ assert_normal_exit(<<-"End", '[ruby-dev:39269]')
+ require 'fiddle'
+ Fiddle::LIBC_SO = #{Fiddle::LIBC_SO.dump}
+ Fiddle::LIBM_SO = #{Fiddle::LIBM_SO.dump}
+ include Fiddle
+ @libc = dlopen(LIBC_SO)
+ @libm = dlopen(LIBM_SO)
+ free = Fiddle::Function.new(Fiddle::RUBY_FREE, [TYPE_VOIDP], TYPE_VOID)
+ ptr = Fiddle::Pointer.malloc(4)
+ ptr.free = free
+ free.ptr
+ ptr.free.ptr
+ End
+
+ free = Function.new(Fiddle::RUBY_FREE, [TYPE_VOIDP], TYPE_VOID)
+ ptr = Pointer.malloc(4)
+ ptr.free = free
+
+ assert_equal free.ptr, ptr.free.ptr
+ end
+
+ def test_null?
+ ptr = Pointer.new(0)
+ assert ptr.null?
+ end
+
+ def test_size
+ ptr = Pointer.malloc(4)
+ assert_equal 4, ptr.size
+ Fiddle.free ptr.to_i
+ end
+
+ def test_size=
+ ptr = Pointer.malloc(4)
+ ptr.size = 10
+ assert_equal 10, ptr.size
+ Fiddle.free ptr.to_i
+ end
+
+ def test_aref_aset
+ check = Proc.new{|str,ptr|
+ assert_equal(str.size(), ptr.size())
+ assert_equal(str, ptr.to_s())
+ assert_equal(str[0,2], ptr.to_s(2))
+ assert_equal(str[0,2], ptr[0,2])
+ assert_equal(str[1,2], ptr[1,2])
+ assert_equal(str[1,0], ptr[1,0])
+ assert_equal(str[0].ord, ptr[0])
+ assert_equal(str[1].ord, ptr[1])
+ }
+ str = 'abc'
+ ptr = Pointer[str]
+ check.call(str, ptr)
+
+ str[0] = "c"
+ assert_equal 'c'.ord, ptr[0] = "c".ord
+ check.call(str, ptr)
+
+ str[0,2] = "aa"
+ assert_equal 'aa', ptr[0,2] = "aa"
+ check.call(str, ptr)
+
+ ptr2 = Pointer['cdeeee']
+ str[0,2] = "cd"
+ assert_equal ptr2, ptr[0,2] = ptr2
+ check.call(str, ptr)
+
+ ptr3 = Pointer['vvvv']
+ str[0,2] = "vv"
+ assert_equal ptr3.to_i, ptr[0,2] = ptr3.to_i
+ check.call(str, ptr)
+ end
+
+ def test_null_pointer
+ nullpo = Pointer.new(0)
+ assert_raise(DLError) {nullpo[0]}
+ assert_raise(DLError) {nullpo[0] = 1}
+ end
+ end
+end if defined?(Fiddle)
diff --git a/test/fileutils/fileasserts.rb b/test/fileutils/fileasserts.rb
index e8c5fa4369..c60606ee7f 100644
--- a/test/fileutils/fileasserts.rb
+++ b/test/fileutils/fileasserts.rb
@@ -3,17 +3,8 @@
module Test
module Unit
module FileAssertions
-
- def _wrap_assertion
- yield
- end
-
def assert_same_file(from, to, message=nil)
- _wrap_assertion {
- assert_block("file #{from} != #{to}#{message&&': '}#{message||''}") {
- File.read(from) == File.read(to)
- }
- }
+ assert_equal(File.read(from), File.read(to), "file #{from} != #{to}#{message&&': '}#{message||''}")
end
def assert_same_entry(from, to, message=nil)
@@ -28,78 +19,75 @@ module Test
end
def assert_file_exist(path, message=nil)
- _wrap_assertion {
- assert_block("file not exist: #{path}#{message&&': '}#{message||''}") {
- File.exist?(path)
- }
- }
+ assert(File.exist?(path), "file not exist: #{path}#{message&&': '}#{message||''}")
end
def assert_file_not_exist(path, message=nil)
- _wrap_assertion {
- assert_block("file not exist: #{path}#{message&&': '}#{message||''}") {
- not File.exist?(path)
- }
- }
+ assert(!File.exist?(path), "file exist: #{path}#{message&&': '}#{message||''}")
end
def assert_directory(path, message=nil)
- _wrap_assertion {
- assert_block("is not directory: #{path}#{message&&': '}#{message||''}") {
- File.directory?(path)
- }
- }
+ assert(File.directory?(path), "is not directory: #{path}#{message&&': '}#{message||''}")
end
def assert_symlink(path, message=nil)
- _wrap_assertion {
- assert_block("is not a symlink: #{path}#{message&&': '}#{message||''}") {
- File.symlink?(path)
- }
- }
+ assert(File.symlink?(path), "is not a symlink: #{path}#{message&&': '}#{message||''}")
end
- def assert_not_symlink(path)
- _wrap_assertion {
- assert_block("is a symlink: #{path}#{message&&': '}#{message||''}") {
- not File.symlink?(path)
- }
- }
+ def assert_not_symlink(path, message=nil)
+ assert(!File.symlink?(path), "is a symlink: #{path}#{message&&': '}#{message||''}")
end
def assert_equal_time(expected, actual, message=nil)
- _wrap_assertion {
- expected_str = expected.to_s
- actual_str = actual.to_s
- if expected_str == actual_str
- expected_str << " (nsec=#{expected.nsec})"
- actual_str << " (nsec=#{actual.nsec})"
- end
- full_message = build_message(message, <<EOT)
+ expected_str = expected.to_s
+ actual_str = actual.to_s
+ if expected_str == actual_str
+ expected_str << " (nsec=#{expected.nsec})"
+ actual_str << " (nsec=#{actual.nsec})"
+ end
+ full_message = build_message(message, <<EOT)
<#{expected_str}> expected but was
<#{actual_str}>.
EOT
- assert_block(full_message) { expected == actual }
- }
+ assert_equal(expected, actual, full_message)
end
def assert_equal_timestamp(expected, actual, message=nil)
- _wrap_assertion {
- expected_str = expected.to_s
- actual_str = actual.to_s
- if expected_str == actual_str
- expected_str << " (nsec=#{expected.nsec})"
- actual_str << " (nsec=#{actual.nsec})"
- end
- full_message = build_message(message, <<EOT)
+ expected_str = expected.to_s
+ actual_str = actual.to_s
+ if expected_str == actual_str
+ expected_str << " (nsec=#{expected.nsec})"
+ actual_str << " (nsec=#{actual.nsec})"
+ end
+ full_message = build_message(message, <<EOT)
<#{expected_str}> expected but was
<#{actual_str}>.
EOT
- # subsecond timestamp is not portable.
- assert_block(full_message) { expected.tv_sec == actual.tv_sec }
- }
+ # subsecond timestamp is not portable.
+ 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
end
end
end
diff --git a/test/fileutils/test_dryrun.rb b/test/fileutils/test_dryrun.rb
index 85badbdb06..03f6bed387 100644
--- a/test/fileutils/test_dryrun.rb
+++ b/test/fileutils/test_dryrun.rb
@@ -2,26 +2,16 @@
require 'fileutils'
require 'test/unit'
-require_relative 'clobber'
+require_relative 'visibility_tests'
class TestFileUtilsDryRun < Test::Unit::TestCase
include FileUtils::DryRun
- include TestFileUtils::Clobber
+ include TestFileUtils::Visibility
- def test_visibility
- FileUtils::METHODS.each do |m|
- assert_equal true, FileUtils::DryRun.respond_to?(m, true),
- "FileUtils::DryRun.#{m} not defined"
- assert_equal true, FileUtils::DryRun.respond_to?(m, false),
- "FileUtils::DryRun.#{m} not public"
- end
- FileUtils::METHODS.each do |m|
- assert_equal true, respond_to?(m, true),
- "FileUtils::DryRun\##{m} is not defined"
- assert_equal true, FileUtils::DryRun.private_method_defined?(m),
- "FileUtils::DryRun\##{m} is not private"
- end
+ def setup
+ super
+ @fu_module = FileUtils::DryRun
end
end
diff --git a/test/fileutils/test_fileutils.rb b/test/fileutils/test_fileutils.rb
index d4068e5c86..c5f8734fea 100644
--- a/test/fileutils/test_fileutils.rb
+++ b/test/fileutils/test_fileutils.rb
@@ -9,6 +9,21 @@ require 'test/unit'
class TestFileUtils < Test::Unit::TestCase
TMPROOT = "#{Dir.tmpdir}/fileutils.rb.#{$$}"
include Test::Unit::FileAssertions
+
+ def assert_output_lines(expected, fu = self, message=nil)
+ old = fu.instance_variable_get(:@fileutils_output)
+ read, write = IO.pipe
+ fu.instance_variable_set(:@fileutils_output, write)
+ th = Thread.new { read.read }
+
+ yield
+
+ 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
end
prevdir = Dir.pwd
@@ -105,9 +120,8 @@ class TestFileUtils
end
def teardown
- tmproot = Dir.pwd
Dir.chdir @prevdir
- my_rm_rf tmproot
+ my_rm_rf TMPROOT
end
@@ -235,9 +249,19 @@ 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
+ bug7246 = '[ruby-core:48603]'
+ mkdir 'tmp/cptmp'
+ mkdir 'tmp/cptmp/d1'
+ chmod 0745, 'tmp/cptmp/d1'
+ mkdir 'tmp/cptmp/d2'
+ chmod 0700, 'tmp/cptmp/d2'
+ cp_r 'tmp/cptmp', 'tmp/cptmp2', :preserve => true
+ 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
@@ -325,6 +349,19 @@ class TestFileUtils
assert_equal 'SLdest', File.readlink('tmp/cpr_dest2/symlink')
end if have_symlink?
+ def test_cp_r_symlink_preserve
+ mkdir 'tmp/cross'
+ mkdir 'tmp/cross/a'
+ mkdir 'tmp/cross/b'
+ touch 'tmp/cross/a/f'
+ touch 'tmp/cross/b/f'
+ ln_s '../a/f', 'tmp/cross/b/l'
+ ln_s '../b/f', 'tmp/cross/a/l'
+ assert_nothing_raised {
+ cp_r 'tmp/cross', 'tmp/cross2', :preserve => true
+ }
+ end if have_symlink?
+
def test_cp_r_pathname
# pathname
touch 'tmp/cprtmp'
@@ -728,14 +765,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?
@@ -792,23 +834,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?
@@ -827,12 +871,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'
@@ -888,39 +932,67 @@ 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.
# see /usr/src/sys/ufs/ufs/ufs_chmod()
- # NetBSD and OpenBSD also denies it.
- if /freebsd|netbsd|openbsd/ !~ RUBY_PLATFORM
+ # 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?
@@ -930,15 +1002,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?
@@ -948,18 +1020,38 @@ 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
+
+ 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
+ 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
@@ -1104,6 +1196,10 @@ class TestFileUtils
uptodate? 'tmp/a', ['tmp/b', Pathname.new('tmp/c')]
uptodate? Pathname.new('tmp/a'), [Pathname.new('tmp/b'), Pathname.new('tmp/c')]
}
+ # [Bug #6708] [ruby-core:46256]
+ assert_raise_with_message(ArgumentError, "wrong number of arguments (3 for 2)") {
+ uptodate?('new',['old', 'oldest'], {})
+ }
end
def test_cd
@@ -1144,6 +1240,27 @@ class TestFileUtils
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/fileutils/test_nowrite.rb b/test/fileutils/test_nowrite.rb
index 8ca9e89fa7..946eed3b6c 100644
--- a/test/fileutils/test_nowrite.rb
+++ b/test/fileutils/test_nowrite.rb
@@ -2,25 +2,16 @@
require 'fileutils'
require 'test/unit'
-require_relative 'clobber'
+require_relative 'visibility_tests'
class TestFileUtilsNoWrite < Test::Unit::TestCase
include FileUtils::NoWrite
- include TestFileUtils::Clobber
+ include TestFileUtils::Visibility
- def test_visibility
- FileUtils::METHODS.each do |m|
- assert_equal true, FileUtils::NoWrite.respond_to?(m, true),
- "FileUtils::NoWrite.#{m} is not defined"
- assert_equal true, FileUtils::NoWrite.respond_to?(m, false),
- "FileUtils::NoWrite.#{m} is not public"
- end
- FileUtils::METHODS.each do |m|
- assert_equal true, respond_to?(m, true),
- "FileUtils::NoWrite\##{m} is not defined"
- assert_equal true, FileUtils::NoWrite.private_method_defined?(m),
- "FileUtils::NoWrite\##{m} is not private"
- end
+ def setup
+ super
+ @fu_module = FileUtils::NoWrite
end
+
end
diff --git a/test/fileutils/test_verbose.rb b/test/fileutils/test_verbose.rb
index e60e85ea4e..fb069bcf14 100644
--- a/test/fileutils/test_verbose.rb
+++ b/test/fileutils/test_verbose.rb
@@ -2,24 +2,16 @@
require 'test/unit'
require 'fileutils'
+require_relative 'visibility_tests'
class TestFileUtilsVerbose < Test::Unit::TestCase
include FileUtils::Verbose
+ include TestFileUtils::Visibility
- def test_visibility
- FileUtils::METHODS.each do |m|
- assert_equal true, FileUtils::Verbose.respond_to?(m, true),
- "FileUtils::Verbose.#{m} is not defined"
- assert_equal true, FileUtils::Verbose.respond_to?(m, false),
- "FileUtils::Verbose.#{m} is not public"
- end
- FileUtils::METHODS.each do |m|
- assert_equal true, respond_to?(m, true),
- "FileUtils::Verbose.#{m} is not defined"
- assert_equal true, FileUtils::Verbose.private_method_defined?(m),
- "FileUtils::Verbose.#{m} is not private"
- end
+ def setup
+ super
+ @fu_module = FileUtils::Verbose
end
end
diff --git a/test/fileutils/visibility_tests.rb b/test/fileutils/visibility_tests.rb
new file mode 100644
index 0000000000..a140614674
--- /dev/null
+++ b/test/fileutils/visibility_tests.rb
@@ -0,0 +1,41 @@
+require 'test/unit'
+require 'fileutils'
+
+class TestFileUtils < Test::Unit::TestCase
+end
+
+##
+# These tests are reused in the FileUtils::Verbose, FileUtils::NoWrite and
+# FileUtils::DryRun tests
+
+module TestFileUtils::Visibility
+
+ FileUtils::METHODS.each do |m|
+ define_method "test_singleton_visibility_#{m}" do
+ assert @fu_module.respond_to?(m, true),
+ "FileUtils::Verbose.#{m} is not defined"
+ assert @fu_module.respond_to?(m, false),
+ "FileUtils::Verbose.#{m} is not public"
+ end
+
+ define_method "test_visibility_#{m}" do
+ assert respond_to?(m, true),
+ "FileUtils::Verbose\##{m} is not defined"
+ assert @fu_module.private_method_defined?(m),
+ "FileUtils::Verbose\##{m} is not private"
+ end
+ end
+
+ FileUtils::StreamUtils_.private_instance_methods.each do |m|
+ define_method "test_singleton_visibility_#{m}" do
+ assert @fu_module.respond_to?(m, true),
+ "FileUtils::Verbose\##{m} is not defined"
+ end
+
+ define_method "test_visibility_#{m}" do
+ assert respond_to?(m, true),
+ "FileUtils::Verbose\##{m} is not defined"
+ end
+ end
+
+end
diff --git a/test/gdbm/test_gdbm.rb b/test/gdbm/test_gdbm.rb
index 621101c9b3..b406d59dc2 100644
--- a/test/gdbm/test_gdbm.rb
+++ b/test/gdbm/test_gdbm.rb
@@ -1,14 +1,13 @@
-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
@@ -86,15 +85,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 +134,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 = GDBM.open("#{@tmpdir}/#{@prefix}", 0644))
- sleep 2
- }
- begin
- sleep 1
- assert_raise(Errno::EWOULDBLOCK) {
- begin
- assert_instance_of(GDBM, gdbm2 = 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 +180,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 = 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
- p Dir.glob("#{@tmpdir}/#{@prefix}*") if $DEBUG
+ STDERR.puts Dir.glob("#{dbname}*") if $DEBUG
- pid = fork() {
- assert_instance_of(GDBM, 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/iconv/test_basic.rb b/test/iconv/test_basic.rb
deleted file mode 100644
index 2575b22eb9..0000000000
--- a/test/iconv/test_basic.rb
+++ /dev/null
@@ -1,59 +0,0 @@
-require File.expand_path("../utils.rb", __FILE__)
-
-class TestIconv::Basic < TestIconv
- def test_euc2sjis
- iconv = Iconv.open('SHIFT_JIS', 'EUC-JP')
- str = iconv.iconv(EUCJ_STR)
- str << iconv.iconv(nil)
- assert_equal(SJIS_STR, str)
- iconv.close
- end
-
- def test_close
- iconv = Iconv.new('Shift_JIS', 'EUC-JP')
- output = ""
- begin
- output += iconv.iconv(EUCJ_STR)
- output += iconv.iconv(nil)
- ensure
- assert_respond_to(iconv, :close)
- assert_equal("", iconv.close)
- assert_equal(SJIS_STR, output)
- end
- end
-
- def test_open_without_block
- assert_respond_to(Iconv, :open)
- iconv = Iconv.open('SHIFT_JIS', 'EUC-JP')
- str = iconv.iconv(EUCJ_STR)
- str << iconv.iconv(nil)
- assert_equal(SJIS_STR, str )
- iconv.close
- end
-
- def test_open_with_block
- input = "#{EUCJ_STR}\n"*2
- output = ""
- Iconv.open("Shift_JIS", "EUC-JP") do |cd|
- input.each_line do |s|
- output << cd.iconv(s)
- end
- output << cd.iconv(nil)
- end
- assert_equal("#{SJIS_STR}\n"*2, output)
- end
-
- def test_invalid_arguments
- assert_raise(TypeError) { Iconv.new(nil, 'Shift_JIS') }
- assert_raise(TypeError) { Iconv.new('Shift_JIS', nil) }
- assert_raise(TypeError) { Iconv.open(nil, 'Shift_JIS') }
- assert_raise(TypeError) { Iconv.open('Shift_JIS', nil) }
- end
-
- def test_unknown_encoding
- assert_raise(Iconv::InvalidEncoding) { Iconv.iconv("utf-8", "X-UKNOWN", "heh") }
- assert_raise(Iconv::InvalidEncoding, '[ruby-dev:39487]') {
- Iconv.iconv("X-UNKNOWN-1", "X-UNKNOWN-2") {break}
- }
- end
-end if defined?(TestIconv)
diff --git a/test/iconv/test_option.rb b/test/iconv/test_option.rb
deleted file mode 100644
index e81df9d850..0000000000
--- a/test/iconv/test_option.rb
+++ /dev/null
@@ -1,43 +0,0 @@
-require File.expand_path("../utils.rb", __FILE__)
-
-class TestIconv::Option < TestIconv
- def test_ignore_option
- begin
- iconv = Iconv.new('SHIFT_JIS', 'EUC-JP')
- iconv.transliterate?
- rescue NotImplementedError
- return
- end
- iconv = Iconv.new('SHIFT_JIS', 'EUC-JP//ignore')
- str = iconv.iconv(EUCJ_STR)
- str << iconv.iconv(nil)
- assert_equal(SJIS_STR, str)
- iconv.close
-
- iconv = Iconv.new('SHIFT_JIS//IGNORE', 'EUC-JP//ignore')
- str = iconv.iconv(EUCJ_STR)
- str << iconv.iconv(nil)
- assert_equal(SJIS_STR, str)
- iconv.close
- end
-
- def test_translit_option
- begin
- iconv = Iconv.new('SHIFT_JIS', 'EUC-JP')
- iconv.transliterate?
- rescue NotImplementedError
- return
- end
- iconv = Iconv.new('SHIFT_JIS', 'EUC-JP//ignore')
- str = iconv.iconv(EUCJ_STR)
- str << iconv.iconv(nil)
- assert_equal(SJIS_STR, str)
- iconv.close
-
- iconv = Iconv.new('SHIFT_JIS//TRANSLIT', 'EUC-JP//translit//ignore')
- str = iconv.iconv(EUCJ_STR)
- str << iconv.iconv(nil)
- assert_equal(SJIS_STR, str)
- iconv.close
- end
-end if defined?(TestIconv)
diff --git a/test/iconv/test_partial.rb b/test/iconv/test_partial.rb
deleted file mode 100644
index a98960b070..0000000000
--- a/test/iconv/test_partial.rb
+++ /dev/null
@@ -1,41 +0,0 @@
-require File.expand_path("../utils.rb", __FILE__)
-
-class TestIconv::Partial < TestIconv
- def test_partial_ascii
- c = Iconv.open(ASCII, ASCII)
- ref = '[ruby-core:17092]'
- rescue
- return
- else
- assert_equal("abc", c.iconv("abc"))
- assert_equal("c", c.iconv("abc", 2), "#{ref}: with start")
- assert_equal("c", c.iconv("abc", 2, 1), "#{ref}: with start, length")
- assert_equal("c", c.iconv("abc", 2, 5), "#{ref}: with start, longer length")
- assert_equal("bc", c.iconv("abc", -2), "#{ref}: with nagative start")
- assert_equal("b", c.iconv("abc", -2, 1), "#{ref}: with nagative start, length")
- assert_equal("bc", c.iconv("abc", -2, 5), "#{ref}: with nagative start, longer length")
- assert_equal("", c.iconv("abc", 5), "#{ref}: with OOB")
- assert_equal("", c.iconv("abc", 5, 2), "#{ref}: with OOB, length")
- ensure
- c.close if c
- end
-
- def test_partial_euc2sjis
- c = Iconv.open('SHIFT_JIS', 'EUC-JP')
- rescue
- return
- else
- assert_equal(SJIS_STR[0, 2], c.iconv(EUCJ_STR, 0, 2))
- assert_equal(SJIS_STR, c.iconv(EUCJ_STR, 0, 20))
- assert_equal(SJIS_STR[2..-1], c.iconv(EUCJ_STR, 2))
- assert_equal(SJIS_STR[2, 2], c.iconv(EUCJ_STR, 2, 2))
- assert_equal(SJIS_STR[2..-1], c.iconv(EUCJ_STR, 2, 20))
- assert_equal(SJIS_STR[-4..-1], c.iconv(EUCJ_STR, -4))
- assert_equal(SJIS_STR[-4, 2], c.iconv(EUCJ_STR, -4, 2))
- assert_equal(SJIS_STR[-4..-1], c.iconv(EUCJ_STR, -4, 20))
- assert_equal("", c.iconv(EUCJ_STR, 20))
- assert_equal("", c.iconv(EUCJ_STR, 20, 2))
- ensure
- c.close
- end
-end if defined?(TestIconv)
diff --git a/test/iconv/utils.rb b/test/iconv/utils.rb
deleted file mode 100644
index 5f72dd3aea..0000000000
--- a/test/iconv/utils.rb
+++ /dev/null
@@ -1,29 +0,0 @@
-begin
- verbose, $VERBOSE = $VERBOSE, nil
- require 'iconv'
-rescue LoadError
-else
- require 'test/unit'
-ensure
- $VERBOSE = verbose
-end
-
-class TestIconv < ::Test::Unit::TestCase
- if defined?(::Encoding) and String.method_defined?(:force_encoding)
- def self.encode(str, enc)
- str.force_encoding(enc)
- end
- else
- def self.encode(str, enc)
- str
- end
- end
-
- def default_test
- self.class == TestIconv or super
- end
-
- ASCII = "ascii"
- EUCJ_STR = encode("\xa4\xa2\xa4\xa4\xa4\xa6\xa4\xa8\xa4\xaa", "EUC-JP").freeze
- SJIS_STR = encode("\x82\xa0\x82\xa2\x82\xa4\x82\xa6\x82\xa8", "Shift_JIS").freeze
-end if defined?(::Iconv)
diff --git a/test/io/console/test_io_console.rb b/test/io/console/test_io_console.rb
index cb2bbcc3a6..a9de376a2b 100644
--- a/test/io/console/test_io_console.rb
+++ b/test/io/console/test_io_console.rb
@@ -25,6 +25,48 @@ class TestIO_Console < Test::Unit::TestCase
}
end
+ def test_raw_minchar
+ len = 0
+ th = nil
+ helper {|m, s|
+ assert_equal([nil, 0], [s.getch(min: 0), len])
+ main = Thread.current
+ go = false
+ th = Thread.start {
+ len += 1
+ m.print("a")
+ m.flush
+ sleep 0.01 until go and main.stop?
+ len += 10
+ m.print("1234567890")
+ m.flush
+ }
+ assert_equal(["a", 1], [s.getch(min: 1), len])
+ go = true
+ assert_equal(["1", 11], [s.getch, len])
+ }
+ ensure
+ th.kill if th and th.alive?
+ end
+
+ def test_raw_timeout
+ len = 0
+ th = nil
+ helper {|m, s|
+ assert_equal([nil, 0], [s.getch(min: 0, time: 0.1), len])
+ main = Thread.current
+ th = Thread.start {
+ sleep 0.01 until main.stop?
+ 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])
+ }
+ ensure
+ th.kill if th and th.alive?
+ end
+
def test_cooked
helper {|m, s|
assert_send([s, :echo?])
@@ -181,6 +223,9 @@ class TestIO_Console < Test::Unit::TestCase
else
def test_sync
r, w, pid = PTY.spawn(EnvUtil.rubybin, "-rio/console", "-e", "p IO.console.class")
+ rescue RuntimeError
+ skip $!
+ else
con = r.gets.chomp
Process.wait(pid)
assert_match("File", con)
@@ -219,14 +264,22 @@ class TestIO_Console < Test::Unit::TestCase
t2.close
cmd = NOCTTY + [
'--disable=gems',
- '-rio/console',
- '-e', 'open(ARGV[0], "w") {|f| f.puts IO.console.inspect}',
- '-e', 'File.unlink(ARGV[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)
+ 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!
@@ -236,8 +289,14 @@ end if defined?(IO.console)
class TestIO_Console < Test::Unit::TestCase
def test_stringio_getch
- assert_ruby_status(%w"--disable=gems -rstringio -rio/console", "exit(StringIO.method_defined?(:getch))")
- assert_ruby_status(%w"--disable=gems -rio/console -rstringio", "exit(StringIO.method_defined?(:getch))")
- assert_ruby_status(%w"--disable=gems -rstringio", "exit(!StringIO.method_defined?(:getch))")
+ assert_separately %w"--disable=gems -rstringio -rio/console", %q{
+ assert_operator(StringIO, :method_defined?, :getch)
+ }
+ assert_separately %w"--disable=gems -rio/console -rstringio", %q{
+ assert_operator(StringIO, :method_defined?, :getch)
+ }
+ assert_separately %w"--disable=gems -rstringio", %q{
+ assert_not_operator(StringIO, :method_defined?, :getch)
+ }
end
end
diff --git a/test/io/wait/test_io_wait.rb b/test/io/wait/test_io_wait.rb
index 3cf967e467..46097e00c6 100644
--- a/test/io/wait/test_io_wait.rb
+++ b/test/io/wait/test_io_wait.rb
@@ -1,3 +1,4 @@
+# -*- coding: us-ascii -*-
require 'test/unit'
require 'timeout'
require 'socket'
@@ -69,4 +70,39 @@ class TestIOWait < Test::Unit::TestCase
Thread.new { sleep 0.01; @w.close }
assert_nil @r.wait
end
+
+ def test_wait_writable
+ assert_equal @w, @w.wait_writable
+ end
+
+ def test_wait_writable_timeout
+ assert_equal @w, @w.wait_writable(0.01)
+ written = fill_pipe
+ assert_nil @w.wait_writable(0.01)
+ @r.read(written)
+ assert_equal @w, @w.wait_writable(0.01)
+ end
+
+ def test_wait_writable_EPIPE
+ fill_pipe
+ @r.close
+ assert_equal @w, @w.wait_writable
+ end
+
+ def test_wait_writable_closed
+ @w.close
+ assert_raises(IOError) { @w.wait_writable }
+ end
+
+private
+
+ def fill_pipe
+ written = 0
+ buf = " " * 4096
+ begin
+ written += @w.write_nonblock(buf)
+ rescue Errno::EAGAIN, Errno::EWOULDBLOCK
+ return written
+ end while true
+ end
end if IO.method_defined?(:wait)
diff --git a/test/json/fixtures/fail18.json b/test/json/fixtures/fail18.json
index e2d130c6eb..ebc11eb4c2 100644
--- a/test/json/fixtures/fail18.json
+++ b/test/json/fixtures/fail18.json
@@ -1 +1 @@
-[[[[[[[[[[[[[[[[[[[["Too deep"]]]]]]]]]]]]]]]]]]]]
+[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[["Too deep"]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]
diff --git a/test/json/test_json.rb b/test/json/test_json.rb
index fa96130656..6af6b32208 100755
--- a/test/json/test_json.rb
+++ b/test/json/test_json.rb
@@ -1,10 +1,11 @@
#!/usr/bin/env ruby
-# -*- coding: utf-8 -*-
+# encoding: utf-8
require 'test/unit'
require File.join(File.dirname(__FILE__), 'setup_variant')
require 'stringio'
require 'tempfile'
+require 'ostruct'
unless Array.method_defined?(:permutation)
begin
@@ -20,7 +21,7 @@ unless Array.method_defined?(:permutation)
end
end
-class TC_JSON < Test::Unit::TestCase
+class TestJSON < Test::Unit::TestCase
include JSON
def setup
@@ -108,6 +109,10 @@ class TC_JSON < Test::Unit::TestCase
def test_parse_json_primitive_values
assert_raise(JSON::ParserError) { JSON.parse('') }
assert_raise(JSON::ParserError) { JSON.parse('', :quirks_mode => true) }
+ assert_raise(TypeError) { JSON::Parser.new(nil).parse }
+ assert_raise(TypeError) { JSON::Parser.new(nil, :quirks_mode => true).parse }
+ assert_raise(TypeError) { JSON.parse(nil) }
+ assert_raise(TypeError) { JSON.parse(nil, :quirks_mode => true) }
assert_raise(JSON::ParserError) { JSON.parse(' /* foo */ ') }
assert_raise(JSON::ParserError) { JSON.parse(' /* foo */ ', :quirks_mode => true) }
parser = JSON::Parser.new('null')
@@ -216,13 +221,41 @@ class TC_JSON < Test::Unit::TestCase
end
end
- def test_parse_array_custom_class
+ class SubArrayWrapper
+ def initialize
+ @data = []
+ end
+
+ attr_reader :data
+
+ def [](index)
+ @data[index]
+ end
+
+ def <<(value)
+ @data << value
+ @shifted = true
+ end
+
+ def shifted?
+ @shifted
+ end
+ end
+
+ def test_parse_array_custom_array_derived_class
res = parse('[1,2]', :array_class => SubArray)
assert_equal([1,2], res)
assert_equal(SubArray, res.class)
assert res.shifted?
end
+ def test_parse_array_custom_non_array_derived_class
+ res = parse('[1,2]', :array_class => SubArrayWrapper)
+ assert_equal([1,2], res.data)
+ assert_equal(SubArrayWrapper, res.class)
+ assert res.shifted?
+ end
+
def test_parse_object
assert_equal({}, parse('{}'))
assert_equal({}, parse(' { } '))
@@ -254,14 +287,46 @@ class TC_JSON < Test::Unit::TestCase
end
end
- def test_parse_object_custom_class
+ class SubOpenStruct < OpenStruct
+ def [](k)
+ __send__(k)
+ end
+
+ def []=(k, v)
+ @item_set = true
+ __send__("#{k}=", v)
+ end
+
+ def item_set?
+ @item_set
+ end
+ end
+
+ def test_parse_object_custom_hash_derived_class
res = parse('{"foo":"bar"}', :object_class => SubHash)
assert_equal({"foo" => "bar"}, res)
assert_equal(SubHash, res.class)
assert res.item_set?
end
- def test_generation_of_core_subclasses_with_new_to_json
+ def test_parse_object_custom_non_hash_derived_class
+ res = parse('{"foo":"bar"}', :object_class => SubOpenStruct)
+ assert_equal "bar", res.foo
+ assert_equal(SubOpenStruct, res.class)
+ assert res.item_set?
+ end
+
+ def test_parse_generic_object
+ res = parse('{"foo":"bar", "baz":{}}', :object_class => JSON::GenericObject)
+ assert_equal(JSON::GenericObject, res.class)
+ assert_equal "bar", res.foo
+ assert_equal "bar", res["foo"]
+ assert_equal "bar", res[:foo]
+ assert_equal "bar", res.to_hash[:foo]
+ assert_equal(JSON::GenericObject, res.baz.class)
+ end
+
+ def test_generate_core_subclasses_with_new_to_json
obj = SubHash2["foo" => SubHash2["bar" => true]]
obj_json = JSON(obj)
obj_again = JSON.parse(obj_json, :create_additions => true)
@@ -272,12 +337,12 @@ class TC_JSON < Test::Unit::TestCase
assert_equal ["foo"], JSON(JSON(SubArray2["foo"]), :create_additions => true)
end
- def test_generation_of_core_subclasses_with_default_to_json
+ def test_generate_core_subclasses_with_default_to_json
assert_equal '{"foo":"bar"}', JSON(SubHash["foo" => "bar"])
assert_equal '["foo"]', JSON(SubArray["foo"])
end
- def test_generation_of_core_subclasses
+ def test_generate_of_core_subclasses
obj = SubHash["foo" => SubHash["bar" => true]]
obj_json = JSON(obj)
obj_again = JSON(obj_json)
@@ -381,12 +446,12 @@ EOT
assert_raises(JSON::NestingError) { JSON.parse '[[]]', :max_nesting => 1 }
assert_raises(JSON::NestingError) { JSON.parser.new('[[]]', :max_nesting => 1).parse }
assert_equal [[]], JSON.parse('[[]]', :max_nesting => 2)
- too_deep = '[[[[[[[[[[[[[[[[[[[["Too deep"]]]]]]]]]]]]]]]]]]]]'
+ too_deep = '[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[["Too deep"]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]'
too_deep_ary = eval too_deep
assert_raises(JSON::NestingError) { JSON.parse too_deep }
assert_raises(JSON::NestingError) { JSON.parser.new(too_deep).parse }
- assert_raises(JSON::NestingError) { JSON.parse too_deep, :max_nesting => 19 }
- ok = JSON.parse too_deep, :max_nesting => 20
+ assert_raises(JSON::NestingError) { JSON.parse too_deep, :max_nesting => 100 }
+ ok = JSON.parse too_deep, :max_nesting => 101
assert_equal too_deep_ary, ok
ok = JSON.parse too_deep, :max_nesting => nil
assert_equal too_deep_ary, ok
@@ -397,8 +462,8 @@ EOT
assert_raises(JSON::NestingError) { JSON.generate [[]], :max_nesting => 1 }
assert_equal '[[]]', JSON.generate([[]], :max_nesting => 2)
assert_raises(JSON::NestingError) { JSON.generate too_deep_ary }
- assert_raises(JSON::NestingError) { JSON.generate too_deep_ary, :max_nesting => 19 }
- ok = JSON.generate too_deep_ary, :max_nesting => 20
+ assert_raises(JSON::NestingError) { JSON.generate too_deep_ary, :max_nesting => 100 }
+ ok = JSON.generate too_deep_ary, :max_nesting => 101
assert_equal too_deep, ok
ok = JSON.generate too_deep_ary, :max_nesting => nil
assert_equal too_deep, ok
@@ -424,8 +489,8 @@ EOT
stringio = StringIO.new(@json)
stringio.rewind
assert_equal @hash, JSON.load(stringio)
- assert_raise(NoMethodError) { JSON.load(nil) }
- assert_raise(JSON::ParserError) {JSON.load('') }
+ assert_equal nil, JSON.load(nil)
+ assert_equal nil, JSON.load('')
end
def test_load_with_options
@@ -434,19 +499,19 @@ EOT
assert_equal symbol_hash, JSON.load(small_hash, nil, :symbolize_names => true)
end
- def test_load_dump
- too_deep = '[[[[[[[[[[[[[[[[[[[[]]]]]]]]]]]]]]]]]]]]'
+ def test_dump
+ too_deep = '[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]'
assert_equal too_deep, JSON.dump(eval(too_deep))
assert_kind_of String, Marshal.dump(eval(too_deep))
- assert_raises(ArgumentError) { JSON.dump(eval(too_deep), 19) }
- assert_raises(ArgumentError) { Marshal.dump(eval(too_deep), 19) }
- assert_equal too_deep, JSON.dump(eval(too_deep), 20)
- assert_kind_of String, Marshal.dump(eval(too_deep), 20)
+ assert_raises(ArgumentError) { JSON.dump(eval(too_deep), 100) }
+ assert_raises(ArgumentError) { Marshal.dump(eval(too_deep), 100) }
+ assert_equal too_deep, JSON.dump(eval(too_deep), 101)
+ assert_kind_of String, Marshal.dump(eval(too_deep), 101)
output = StringIO.new
JSON.dump(eval(too_deep), output)
assert_equal too_deep, output.string
output = StringIO.new
- JSON.dump(eval(too_deep), output, 20)
+ JSON.dump(eval(too_deep), output, 101)
assert_equal too_deep, output.string
end
diff --git a/test/json/test_json_addition.rb b/test/json/test_json_addition.rb
index 37dba6b085..a30f06addd 100755
--- a/test/json/test_json_addition.rb
+++ b/test/json/test_json_addition.rb
@@ -3,10 +3,14 @@
require 'test/unit'
require File.join(File.dirname(__FILE__), 'setup_variant')
-require 'json/add/core.rb'
+require 'json/add/core'
+require 'json/add/complex'
+require 'json/add/rational'
+require 'json/add/bigdecimal'
+require 'json/add/ostruct'
require 'date'
-class TC_JSONAddition < Test::Unit::TestCase
+class TestJSONAddition < Test::Unit::TestCase
include JSON
class A
@@ -60,7 +64,7 @@ class TC_JSONAddition < Test::Unit::TestCase
def to_json(*args)
{
- 'json_class' => 'TC_JSONAddition::Nix',
+ 'json_class' => 'TestJSONAddition::Nix',
}.to_json(*args)
end
end
@@ -92,7 +96,7 @@ class TC_JSONAddition < Test::Unit::TestCase
a_hash = JSON.parse(json, :create_additions => false)
assert_kind_of Hash, a_hash
assert_equal(
- {"args"=>[666], "json_class"=>"TC_JSONAddition::A"}.sort_by { |k,| k },
+ {"args"=>[666], "json_class"=>"TestJSONAddition::A"}.sort_by { |k,| k },
a_hash.sort_by { |k,| k }
)
end
@@ -101,7 +105,7 @@ class TC_JSONAddition < Test::Unit::TestCase
b = B.new
assert !B.json_creatable?
json = generate(b)
- assert_equal({ "json_class"=>"TC_JSONAddition::B" }, JSON.parse(json))
+ assert_equal({ "json_class"=>"TestJSONAddition::B" }, JSON.parse(json))
end
def test_extended_json_fail2
@@ -123,7 +127,7 @@ class TC_JSONAddition < Test::Unit::TestCase
json_raw_object = raw.to_json_raw_object
hash = { 'json_class' => 'String', 'raw'=> raw_array }
assert_equal hash, json_raw_object
- assert_match(/\A\{.*\}\Z/, json)
+ assert_match(/\A\{.*\}\z/, json)
assert_match(/"json_class":"String"/, json)
assert_match(/"raw":\[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,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,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\]/, json)
raw_again = JSON.parse(json, :create_additions => true)
@@ -172,4 +176,21 @@ class TC_JSONAddition < Test::Unit::TestCase
d = DateTime.civil(2008, 6, 17, 11, 48, 32, Rational(12,24))
assert_equal d, JSON.parse(d.to_json, :create_additions => true)
end
+
+ def test_rational_complex
+ assert_equal Rational(2, 9), JSON.parse(JSON(Rational(2, 9)), :create_additions => true)
+ assert_equal Complex(2, 9), JSON.parse(JSON(Complex(2, 9)), :create_additions => true)
+ end
+
+ def test_bigdecimal
+ assert_equal BigDecimal('3.141', 23), JSON(JSON(BigDecimal('3.141', 23)), :create_additions => true)
+ assert_equal BigDecimal('3.141', 666), JSON(JSON(BigDecimal('3.141', 666)), :create_additions => true)
+ end
+
+ def test_ostruct
+ o = OpenStruct.new
+ # XXX this won't work; o.foo = { :bar => true }
+ o.foo = { 'bar' => true }
+ assert_equal o, JSON.parse(JSON(o), :create_additions => true)
+ end
end
diff --git a/test/json/test_json_encoding.rb b/test/json/test_json_encoding.rb
index 7af5e63a73..fa7d878920 100644
--- a/test/json/test_json_encoding.rb
+++ b/test/json/test_json_encoding.rb
@@ -1,10 +1,10 @@
#!/usr/bin/env ruby
-# -*- coding: utf-8 -*-
+# encoding: utf-8
require 'test/unit'
require File.join(File.dirname(__FILE__), 'setup_variant')
-class TC_JSONEncoding < Test::Unit::TestCase
+class TestJSONEncoding < Test::Unit::TestCase
include JSON
def setup
diff --git a/test/json/test_json_fixtures.rb b/test/json/test_json_fixtures.rb
index e9df8f5b1c..584dffdfdb 100755
--- a/test/json/test_json_fixtures.rb
+++ b/test/json/test_json_fixtures.rb
@@ -1,10 +1,10 @@
#!/usr/bin/env ruby
-# -*- coding: utf-8 -*-
+# encoding: utf-8
require 'test/unit'
require File.join(File.dirname(__FILE__), 'setup_variant')
-class TC_JSONFixtures < Test::Unit::TestCase
+class TestJSONFixtures < Test::Unit::TestCase
def setup
fixtures = File.join(File.dirname(__FILE__), 'fixtures/*.json')
passed, failed = Dir[fixtures].partition { |f| f['pass'] }
diff --git a/test/json/test_json_generate.rb b/test/json/test_json_generate.rb
index da96603d61..618b933bac 100755
--- a/test/json/test_json_generate.rb
+++ b/test/json/test_json_generate.rb
@@ -1,10 +1,10 @@
#!/usr/bin/env ruby
-# -*- coding: utf-8 -*-
+# encoding: utf-8
require 'test/unit'
require File.join(File.dirname(__FILE__), 'setup_variant')
-class TC_JSONGenerate < Test::Unit::TestCase
+class TestJSONGenerate < Test::Unit::TestCase
include JSON
def setup
@@ -43,6 +43,8 @@ EOT
def test_generate
json = generate(@hash)
assert_equal(JSON.parse(@json2), JSON.parse(json))
+ json = JSON[@hash]
+ assert_equal(JSON.parse(@json2), JSON.parse(json))
parsed_json = parse(json)
assert_equal(@hash, parsed_json)
json = generate({1=>2})
@@ -121,48 +123,51 @@ EOT
def test_pretty_state
state = PRETTY_STATE_PROTOTYPE.dup
assert_equal({
- :allow_nan => false,
- :array_nl => "\n",
- :ascii_only => false,
- :quirks_mode => false,
- :depth => 0,
- :indent => " ",
- :max_nesting => 19,
- :object_nl => "\n",
- :space => " ",
- :space_before => "",
+ :allow_nan => false,
+ :array_nl => "\n",
+ :ascii_only => false,
+ :buffer_initial_length => 1024,
+ :quirks_mode => false,
+ :depth => 0,
+ :indent => " ",
+ :max_nesting => 100,
+ :object_nl => "\n",
+ :space => " ",
+ :space_before => "",
}.sort_by { |n,| n.to_s }, state.to_h.sort_by { |n,| n.to_s })
end
def test_safe_state
state = SAFE_STATE_PROTOTYPE.dup
assert_equal({
- :allow_nan => false,
- :array_nl => "",
- :ascii_only => false,
- :quirks_mode => false,
- :depth => 0,
- :indent => "",
- :max_nesting => 19,
- :object_nl => "",
- :space => "",
- :space_before => "",
+ :allow_nan => false,
+ :array_nl => "",
+ :ascii_only => false,
+ :buffer_initial_length => 1024,
+ :quirks_mode => false,
+ :depth => 0,
+ :indent => "",
+ :max_nesting => 100,
+ :object_nl => "",
+ :space => "",
+ :space_before => "",
}.sort_by { |n,| n.to_s }, state.to_h.sort_by { |n,| n.to_s })
end
def test_fast_state
state = FAST_STATE_PROTOTYPE.dup
assert_equal({
- :allow_nan => false,
- :array_nl => "",
- :ascii_only => false,
- :quirks_mode => false,
- :depth => 0,
- :indent => "",
- :max_nesting => 0,
- :object_nl => "",
- :space => "",
- :space_before => "",
+ :allow_nan => false,
+ :array_nl => "",
+ :ascii_only => false,
+ :buffer_initial_length => 1024,
+ :quirks_mode => false,
+ :depth => 0,
+ :indent => "",
+ :max_nesting => 0,
+ :object_nl => "",
+ :space => "",
+ :space_before => "",
}.sort_by { |n,| n.to_s }, state.to_h.sort_by { |n,| n.to_s })
end
@@ -195,19 +200,124 @@ EOT
s = JSON.state.new
assert_equal 0, s.depth
assert_raises(JSON::NestingError) { ary.to_json(s) }
- assert_equal 19, s.depth
+ assert_equal 100, s.depth
+ end
+
+ def test_buffer_initial_length
+ s = JSON.state.new
+ assert_equal 1024, s.buffer_initial_length
+ s.buffer_initial_length = 0
+ assert_equal 1024, s.buffer_initial_length
+ s.buffer_initial_length = -1
+ assert_equal 1024, s.buffer_initial_length
+ s.buffer_initial_length = 128
+ assert_equal 128, s.buffer_initial_length
end
def test_gc
- bignum_too_long_to_embed_as_string = 1234567890123456789012345
- expect = bignum_too_long_to_embed_as_string.to_s
- stress, GC.stress = GC.stress, true
+ require_relative '../ruby/envutil.rb'
+ assert_in_out_err(%w[-rjson --disable-gems], <<-EOS, [], [])
+ bignum_too_long_to_embed_as_string = 1234567890123456789012345
+ expect = bignum_too_long_to_embed_as_string.to_s
+ GC.stress = true
- 10.times do |i|
- tmp = bignum_too_long_to_embed_as_string.to_json
- assert_equal expect, tmp
- end
- ensure
- GC.stress = stress
+ 10.times do |i|
+ tmp = bignum_too_long_to_embed_as_string.to_json
+ raise "'\#{expect}' is expected, but '\#{tmp}'" unless tmp == expect
+ end
+ EOS
end if GC.respond_to?(:stress=)
+
+ def test_configure_using_configure_and_merge
+ numbered_state = {
+ :indent => "1",
+ :space => '2',
+ :space_before => '3',
+ :object_nl => '4',
+ :array_nl => '5'
+ }
+ state1 = JSON.state.new
+ state1.merge(numbered_state)
+ assert_equal '1', state1.indent
+ assert_equal '2', state1.space
+ assert_equal '3', state1.space_before
+ assert_equal '4', state1.object_nl
+ assert_equal '5', state1.array_nl
+ state2 = JSON.state.new
+ state2.configure(numbered_state)
+ assert_equal '1', state2.indent
+ assert_equal '2', state2.space
+ assert_equal '3', state2.space_before
+ assert_equal '4', state2.object_nl
+ 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
+ Bignum.class_eval do
+ def to_s
+ end
+ end
+ begin
+ JSON::Ext::Generator::State.new.generate(1<<64)
+ exit 1
+ rescue TypeError
+ exit 0
+ end
+ end
+ _, status = Process.waitpid2(pid)
+ assert status.success?
+ rescue NotImplementedError
+ # forking to avoid modifying core class of a parent process and
+ # introducing race conditions of tests are run in parallel
+ end
+ end
+
+ def test_hash_likeness_set_symbol
+ state = JSON.state.new
+ assert_equal nil, state[:foo]
+ assert_equal nil.class, state[:foo].class
+ assert_equal nil, state['foo']
+ state[:foo] = :bar
+ assert_equal :bar, state[:foo]
+ assert_equal :bar, state['foo']
+ state_hash = state.to_hash
+ assert_kind_of Hash, state_hash
+ assert_equal :bar, state_hash[:foo]
+ end
+
+ def test_hash_likeness_set_string
+ state = JSON.state.new
+ assert_equal nil, state[:foo]
+ assert_equal nil, state['foo']
+ state['foo'] = :bar
+ assert_equal :bar, state[:foo]
+ assert_equal :bar, state['foo']
+ state_hash = state.to_hash
+ 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
new file mode 100644
index 0000000000..c43c7762be
--- /dev/null
+++ b/test/json/test_json_generic_object.rb
@@ -0,0 +1,75 @@
+#!/usr/bin/env ruby
+# encoding: utf-8
+
+require 'test/unit'
+require File.join(File.dirname(__FILE__), 'setup_variant')
+class TestJSONGenericObject < Test::Unit::TestCase
+ include JSON
+
+ def setup
+ @go = GenericObject[ :a => 1, :b => 2 ]
+ end
+
+ def test_attributes
+ assert_equal 1, @go.a
+ assert_equal 1, @go[:a]
+ assert_equal 2, @go.b
+ assert_equal 2, @go[:b]
+ assert_nil @go.c
+ assert_nil @go[:c]
+ end
+
+ def test_generate_json
+ switch_json_creatable do
+ assert_equal @go, JSON(JSON(@go), :create_additions => true)
+ end
+ end
+
+ def test_parse_json
+ assert_kind_of Hash, JSON('{ "json_class": "JSON::GenericObject", "a": 1, "b": 2 }', :create_additions => true)
+ switch_json_creatable do
+ assert_equal @go, l = JSON('{ "json_class": "JSON::GenericObject", "a": 1, "b": 2 }', :create_additions => true)
+ assert_equal 1, l.a
+ assert_equal @go, l = JSON('{ "a": 1, "b": 2 }', :object_class => GenericObject)
+ assert_equal 1, l.a
+ assert_equal GenericObject[:a => GenericObject[:b => 2]],
+ l = JSON('{ "a": { "b": 2 } }', :object_class => GenericObject)
+ assert_equal 2, l.a.b
+ end
+ end
+
+ def test_from_hash
+ result = GenericObject.from_hash(
+ :foo => { :bar => { :baz => true }, :quux => [ { :foobar => true } ] })
+ assert_kind_of GenericObject, result.foo
+ assert_kind_of GenericObject, result.foo.bar
+ assert_equal true, result.foo.bar.baz
+ assert_kind_of GenericObject, result.foo.quux.first
+ assert_equal true, result.foo.quux.first.foobar
+ 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
+ JSON::GenericObject.json_creatable = true
+ yield
+ ensure
+ JSON::GenericObject.json_creatable = false
+ end
+end
diff --git a/test/json/test_json_string_matching.rb b/test/json/test_json_string_matching.rb
index 7335c0e82b..c233df8c2c 100644
--- a/test/json/test_json_string_matching.rb
+++ b/test/json/test_json_string_matching.rb
@@ -1,12 +1,12 @@
#!/usr/bin/env ruby
-# -*- coding: utf-8 -*-
+# encoding: utf-8
require 'test/unit'
require File.join(File.dirname(__FILE__), 'setup_variant')
require 'stringio'
require 'time'
-class TestJsonStringMatching < Test::Unit::TestCase
+class TestJSONStringMatching < Test::Unit::TestCase
include JSON
class TestTime < ::Time
diff --git a/test/json/test_json_unicode.rb b/test/json/test_json_unicode.rb
index ace56cae36..8352d5c6c6 100755
--- a/test/json/test_json_unicode.rb
+++ b/test/json/test_json_unicode.rb
@@ -1,10 +1,10 @@
#!/usr/bin/env ruby
-# -*- coding: utf-8 -*-
+# encoding: utf-8
require 'test/unit'
require File.join(File.dirname(__FILE__), 'setup_variant')
-class TC_JSONUnicode < Test::Unit::TestCase
+class TestJSONUnicode < Test::Unit::TestCase
include JSON
def test_unicode
diff --git a/test/logger/test_logger.rb b/test/logger/test_logger.rb
index 8fc02f8899..04bf779538 100644
--- a/test/logger/test_logger.rb
+++ b/test/logger/test_logger.rb
@@ -1,6 +1,8 @@
+# coding: US-ASCII
require 'test/unit'
require 'logger'
require 'tempfile'
+require_relative '../ruby/envutil'
class TestLoggerSeverity < Test::Unit::TestCase
@@ -40,13 +42,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
- 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
@@ -125,7 +126,7 @@ class TestLogger < Test::Unit::TestCase
end
logger.formatter = o
line = log_raw(logger, :info, "foo")
- assert_equal("<<INFO-foo>>\n", line)
+ assert_equal("<""<INFO-foo>>\n", line)
end
def test_initialize
@@ -353,11 +354,13 @@ class TestLogDevice < Test::Unit::TestCase
end
def test_shifting_size
- logfile = File.basename(__FILE__) + '_1.log'
+ 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)
@@ -385,11 +388,13 @@ class TestLogDevice < Test::Unit::TestCase
File.unlink(logfile1)
File.unlink(logfile2)
- logfile = File.basename(__FILE__) + '_2.log'
+ 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))
@@ -468,6 +473,88 @@ class TestLogDevice < Test::Unit::TestCase
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'
+ 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)
+ 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
+
+ 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/matrix/test_vector.rb b/test/matrix/test_vector.rb
index 582509fd20..18660df574 100644
--- a/test/matrix/test_vector.rb
+++ b/test/matrix/test_vector.rb
@@ -131,4 +131,19 @@ class TestVector < Test::Unit::TestCase
assert_equal("Vector[1, 2, 3]", @v1.inspect)
end
+ def test_magnitude
+ assert_in_epsilon(3.7416573867739413, @v1.norm)
+ assert_in_epsilon(3.7416573867739413, @v4.norm)
+ end
+
+ def test_complex_magnitude
+ bug6966 = '[ruby-dev:46100]'
+ v = Vector[Complex(0,1), 0]
+ assert_equal(1.0, v.norm, bug6966)
+ end
+
+ def test_rational_magnitude
+ v = Vector[Rational(1,2), 0]
+ assert_equal(0.5, v.norm)
+ end
end
diff --git a/test/minitest/metametameta.rb b/test/minitest/metametameta.rb
new file mode 100644
index 0000000000..65eece07ca
--- /dev/null
+++ b/test/minitest/metametameta.rb
@@ -0,0 +1,74 @@
+# 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'
+require 'minitest/autorun'
+
+class MiniTest::Unit::TestCase
+ def clean s
+ s.gsub(/^ {6}/, '')
+ end
+end
+
+class MetaMetaMetaTestCase < MiniTest::Unit::TestCase
+ def assert_report expected, flags = %w[--seed 42]
+ header = clean <<-EOM
+ Run options: #{flags.map { |s| s =~ /\|/ ? s.inspect : s }.join " "}
+
+ # Running tests:
+
+ EOM
+
+ with_output do
+ @tu.run flags
+ end
+
+ output = @output.string.dup
+ output.sub!(/Finished tests in .*/, "Finished tests in 0.00")
+ output.sub!(/Loaded suite .*/, 'Loaded suite blah')
+
+ output.gsub!(/ = \d+.\d\d s = /, ' = 0.00 s = ')
+ output.gsub!(/0x[A-Fa-f0-9]+/, '0xXXX')
+
+ if windows? then
+ output.gsub!(/\[(?:[A-Za-z]:)?[^\]:]+:\d+\]/, '[FILE:LINE]')
+ output.gsub!(/^(\s+)(?:[A-Za-z]:)?[^:]+:\d+:in/, '\1FILE:LINE:in')
+ else
+ output.gsub!(/\[[^\]:]+:\d+\]/, '[FILE:LINE]')
+ output.gsub!(/^(\s+)[^:]+:\d+:in/, '\1FILE:LINE:in')
+ end
+
+ assert_equal header + expected, output
+ end
+
+ def setup
+ super
+ srand 42
+ MiniTest::Unit::TestCase.reset
+ @tu = MiniTest::Unit.new
+
+ MiniTest::Unit.runner = nil # protect the outer runner from the inner tests
+ end
+
+ def teardown
+ super
+ end
+
+ def with_output
+ 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_benchmark.rb b/test/minitest/test_minitest_benchmark.rb
index cdd7c3c640..8f0aab4904 100644
--- a/test/minitest/test_minitest_benchmark.rb
+++ b/test/minitest/test_minitest_benchmark.rb
@@ -1,3 +1,4 @@
+# encoding: utf-8
######################################################################
# This file is imported from the minitest project.
# DO NOT make modifications in this repo. They _will_ be reverted!
@@ -50,6 +51,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]
@@ -116,4 +133,3 @@ class TestMiniTestBenchmark < MiniTest::Unit::TestCase
assert_in_delta exp_b, b
end
end
-
diff --git a/test/minitest/test_minitest_mock.rb b/test/minitest/test_minitest_mock.rb
index b6e801c3aa..53216d1aaa 100644
--- a/test/minitest/test_minitest_mock.rb
+++ b/test/minitest/test_minitest_mock.rb
@@ -1,15 +1,15 @@
+# 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!
+
def setup
@mock = MiniTest::Mock.new.expect(:foo, nil)
@mock.expect(:meaning_of_life, 42)
@@ -26,7 +26,7 @@ class TestMiniTestMock < MiniTest::Unit::TestCase
def test_blow_up_if_not_called
@mock.foo
- util_verify_bad
+ util_verify_bad "expected meaning_of_life() => 42, got []"
end
def test_not_blow_up_if_everything_called
@@ -46,7 +46,7 @@ class TestMiniTestMock < MiniTest::Unit::TestCase
@mock.meaning_of_life
@mock.expect(:bar, true)
- util_verify_bad
+ util_verify_bad "expected bar() => true, got []"
end
def test_blow_up_on_wrong_number_of_arguments
@@ -71,6 +71,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])
@@ -84,13 +86,26 @@ class TestMiniTestMock < MiniTest::Unit::TestCase
@mock.meaning_of_life
@mock.expect(:sum, 3, [1, 2])
- @mock.sum(2, 4)
+ e = assert_raises MockExpectationError do
+ @mock.sum(2, 4)
+ end
+
+ exp = "mocked method :sum called with unexpected arguments [2, 4]"
+ assert_equal exp, e.message
+ end
+
+ def test_expect_with_non_array_args
+ e = assert_raises ArgumentError do
+ @mock.expect :blah, 3, false
+ end
- util_verify_bad
+ assert_equal "args must be an array", e.message
end
def test_respond_appropriately
assert @mock.respond_to?(:foo)
+ assert @mock.respond_to?(:foo, true)
+ assert @mock.respond_to?('foo')
assert !@mock.respond_to?(:bar)
end
@@ -141,14 +156,257 @@ class TestMiniTestMock < MiniTest::Unit::TestCase
def test_verify_raises_with_strict_args
mock = MiniTest::Mock.new
mock.expect :strict_expectation, true, [2]
- mock.strict_expectation 1
- util_verify_bad
+ e = assert_raises MockExpectationError do
+ mock.strict_expectation 1
+ end
+
+ exp = "mocked method :strict_expectation called with unexpected arguments [1]"
+ assert_equal exp, e.message
+ end
+
+ def test_method_missing_empty
+ mock = MiniTest::Mock.new
+
+ mock.expect :a, nil
+
+ mock.a
+
+ e = assert_raises MockExpectationError do
+ mock.a
+ end
+
+ assert_equal "No more expects available for :a: []", e.message
+ end
+
+ def test_same_method_expects_are_verified_when_all_called
+ mock = MiniTest::Mock.new
+ mock.expect :foo, nil, [:bar]
+ mock.expect :foo, nil, [:baz]
+
+ mock.foo :bar
+ mock.foo :baz
+
+ assert mock.verify
+ end
+
+ def test_same_method_expects_blow_up_when_not_all_called
+ mock = MiniTest::Mock.new
+ mock.expect :foo, nil, [:bar]
+ mock.expect :foo, nil, [:baz]
+
+ mock.foo :bar
+
+ e = assert_raises(MockExpectationError) { mock.verify }
+
+ exp = "expected foo(:baz) => nil, got [foo(:bar) => nil]"
+
+ assert_equal exp, e.message
end
- def util_verify_bad
- assert_raises MockExpectationError do
+ def test_verify_passes_when_mock_block_returns_true
+ mock = MiniTest::Mock.new
+ mock.expect :foo, nil do
+ true
+ end
+
+ mock.foo
+
+ assert mock.verify
+ end
+
+ def test_mock_block_is_passed_function_params
+ arg1, arg2, arg3 = :bar, [1,2,3], {:a => 'a'}
+ mock = MiniTest::Mock.new
+ mock.expect :foo, nil do |a1, a2, a3|
+ a1 == arg1 &&
+ a2 == arg2 &&
+ a3 == arg3
+ end
+
+ mock.foo arg1, arg2, arg3
+
+ assert mock.verify
+ end
+
+ def test_verify_fails_when_mock_block_returns_false
+ mock = MiniTest::Mock.new
+ mock.expect :foo, nil do
+ false
+ end
+
+ e = assert_raises(MockExpectationError) { mock.foo }
+ exp = "mocked method :foo failed block w/ []"
+
+ assert_equal exp, e.message
+ end
+
+ def test_mock_block_throws_if_args_passed
+ mock = MiniTest::Mock.new
+
+ e = assert_raises(ArgumentError) do
+ mock.expect :foo, nil, [:a, :b, :c] do
+ true
+ end
+ end
+
+ exp = "args ignored when block given"
+
+ assert_equal exp, e.message
+ end
+
+ def test_mock_returns_retval_when_called_with_block
+ mock = MiniTest::Mock.new
+ mock.expect(:foo, 32) do
+ true
+ end
+
+ rs = mock.foo
+
+ assert_equal rs, 32
+ end
+
+ def util_verify_bad exp
+ e = assert_raises MockExpectationError do
@mock.verify
end
+
+ assert_equal exp, e.message
+ end
+end
+
+require "minitest/metametameta"
+
+class TestMiniTestStub < MiniTest::Unit::TestCase
+ parallelize_me!
+
+ def setup
+ super
+ MiniTest::Unit::TestCase.reset
+
+ @tc = MiniTest::Unit::TestCase.new 'fake tc'
+ @assertion_count = 1
+ end
+
+ def teardown
+ super
+ assert_equal @assertion_count, @tc._assertions
+ end
+
+ class Time
+ def self.now
+ 24
+ end
+ end
+
+ def assert_stub val_or_callable
+ @assertion_count += 1
+
+ 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
+
+ slow_clapper = Class.new do
+ def slow_clap
+ sleep 3
+ :clap
+ end
+ end.new
+
+ 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
+
+ def test_stub_value
+ assert_stub 42
+ end
+
+ def test_stub_block
+ assert_stub lambda { 42 }
+ end
+
+ def test_stub_block_args
+ @assertion_count += 1
+
+ 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
+ end
+
+ def test_stub_callable
+ obj = Object.new
+
+ def obj.call
+ 42
+ end
+
+ assert_stub obj
+ end
+
+ def test_stub_yield_self
+ obj = "foo"
+
+ val = obj.stub :to_s, "bar" do |s|
+ s.to_s
+ end
+
+ @tc.assert_equal "bar", val
+ end
+
+ def test_dynamic_method
+ @assertion_count = 2
+
+ dynamic = Class.new do
+ def self.respond_to?(meth)
+ meth == :found
+ end
+
+ def self.method_missing(meth, *args, &block)
+ if meth == :found
+ false
+ else
+ super
+ end
+ end
+ end
+
+ val = dynamic.stub(:found, true) do |s|
+ s.found
+ end
+
+ @tc.assert_equal true, val
+ @tc.assert_equal false, dynamic.found
end
end
diff --git a/test/minitest/test_minitest_spec.rb b/test/minitest/test_minitest_spec.rb
index d9f6368a80..e39d96d50a 100644
--- a/test/minitest/test_minitest_spec.rb
+++ b/test/minitest/test_minitest_spec.rb
@@ -1,28 +1,119 @@
+# encoding: utf-8
######################################################################
# This file is imported from the minitest project.
# DO NOT make modifications in this repo. They _will_ be reverted!
# File a patch instead and assign it to Ryan Davis.
######################################################################
-require 'minitest/autorun'
-require 'stringio'
+# encoding: utf-8
+require "minitest/autorun"
+require "stringio"
class MiniSpecA < MiniTest::Spec; end
-class MiniSpecB < MiniTest::Spec; end
+class MiniSpecB < MiniTest::Unit::TestCase; extend MiniTest::Spec::DSL; end
+class MiniSpecC < MiniSpecB; end
+class NamedExampleA < MiniSpecA; end
+class NamedExampleB < MiniSpecB; end
+class NamedExampleC < MiniSpecC; 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
+ self._assertions.must_equal @assertion_count if passed? and not skipped?
+ 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
- # TODO: figure out how the hell to write a test for this
- # it "will skip if there is no block"
+ 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
@@ -53,156 +144,390 @@ describe MiniTest::Spec do
bad = %w[not raise throw send output be_silent]
- expected_wonts = expected_musts.map { |m| m.sub(/^must/, 'wont') }
+ 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
- proc { (6 * 9).must_equal(42) }.must_raise MiniTest::Assertion
+
+ 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
+
+ x = maglev? ? "1.0000000000000001e-05" : "1.0e-05"
+ assert_triggered "Expected |42 - 42.0| (0.0) to not be <= #{x}." do
+ (6 * 7.0).wont_be_close_to 42, 0.00001
+ end
+
+ assert_triggered "msg.\nExpected |42 - 42.0| (0.0) to not be <= #{x}." 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
+
+ x = maglev? ? "0.042000000000000003" : "0.042"
+ assert_triggered "Expected |42 - 42.0| (0.0) to not be <= #{x}." do
+ (6 * 7.0).wont_be_within_epsilon 42
+ end
+
+ x = maglev? ? "0.00042000000000000002" : "0.00042"
+ assert_triggered "Expected |42 - 42.0| (0.0) to not be <= #{x}." do
+ (6 * 7.0).wont_be_within_epsilon 42, 0.00001
+ end
+
+ assert_triggered "msg.\nExpected |42 - 42.0| (0.0) to not be <= #{x}." 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
- proc { 42.002.must_be_close_to 42.0 }.must_raise MiniTest::Assertion
+
+ assert_triggered "Expected |0.0 - 0.01| (0.01) to be <= 0.001." do
+ (1.0 / 100).must_be_close_to 0.0
+ end
+
+ x = maglev? ? "9.9999999999999995e-07" : "1.0e-06"
+ assert_triggered "Expected |0.0 - 0.001| (0.001) to be <= #{x}." 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 <= #{x}." do
+ (1.0 / 1000).must_be_close_to 0.0, 0.000001, "msg"
+ end
end
- it "needs to verify types of objects" do
- (6 * 7).must_be_instance_of(Fixnum).must_equal true
- proc { (6 * 7).must_be_instance_of String }.must_raise MiniTest::Assertion
+ 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 = 6
+ @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
- proc { (6 * 7).must_be_kind_of String }.must_raise MiniTest::Assertion
+
+ 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 regexp matches" do
- @assertion_count = 6
+ it "needs to verify mismatch" do
+ @assertion_count += 3 # match is 2
- "blah".must_match(/\w+/).must_equal true
- proc { "blah".must_match(/\d+/) }.must_raise MiniTest::Assertion
+ "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
- proc { 42.must_be_nil }.must_raise MiniTest::Assertion
+
+ 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 using any operator" do
- 41.must_be(:<, 42).must_equal true
- proc { 42.must_be(:<, 41) }.must_raise MiniTest::Assertion
+ 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 catch an expected exception" do
- @assertion_count = 2
+ it "needs to verify non-identity" do
+ 1.wont_be_same_as(2).must_equal false
- proc { raise "blah" }.must_raise RuntimeError
- proc { raise MiniTest::Assertion }.must_raise MiniTest::Assertion
+ 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 catch an unexpected exception" do
- @assertion_count = 2
+ it "needs to verify non-nil" do
+ 42.wont_be_nil.must_equal false
- proc {
- proc { raise MiniTest::Assertion }.must_raise(RuntimeError)
- }.must_raise MiniTest::Assertion
+ 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 raise if an expected exception is not raised" do
- @assertion_count = 2
+ 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
- proc { proc { 42 }.must_raise(RuntimeError) }.must_raise MiniTest::Assertion
+ assert_triggered "msg.\nExpected \"\" to not respond to to_s." do
+ "".wont_respond_to :to_s, "msg"
+ end
end
- it "needs to be able to catch a MiniTest::Assertion exception" do
- @assertion_count = 2
+ it "needs to verify output in stderr" do
+ @assertion_count -= 1 # no msg
- proc { 1.wont_equal 1 }.must_raise MiniTest::Assertion
+ 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 using respond_to" do
- 42.must_respond_to(:+).must_equal true
- proc { 42.must_respond_to(:clear) }.must_raise MiniTest::Assertion
+ 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 identity" do
- 1.must_be_same_as(1).must_equal true
- proc { 1.must_be_same_as 2 }.must_raise MiniTest::Assertion
+ 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 = 6
+ @assertion_count += 2 # 2 extra tests
proc { throw :blah }.must_throw(:blah).must_equal true
- proc { proc { }.must_throw(:blah) }.must_raise MiniTest::Assertion
- proc { proc { throw :xxx }.must_throw(:blah) }.must_raise MiniTest::Assertion
- end
- it "needs to verify inequality" do
- 42.wont_equal(6 * 9).must_equal false
- proc { 1.wont_equal 1 }.must_raise MiniTest::Assertion
- end
+ assert_triggered "Expected :blah to have been thrown." do
+ proc { }.must_throw :blah
+ end
- it "needs to verify mismatch" do
- @assertion_count = 6
- "blah".wont_match(/\d+/).must_equal false
- proc { "blah".wont_match(/\w+/) }.must_raise MiniTest::Assertion
- end
+ assert_triggered "Expected :blah to have been thrown, not :xxx." do
+ proc { throw :xxx }.must_throw :blah
+ end
- it "needs to verify non-nil" do
- 42.wont_be_nil.must_equal false
- proc { nil.wont_be_nil }.must_raise MiniTest::Assertion
- end
+ assert_triggered "msg.\nExpected :blah to have been thrown." do
+ proc { }.must_throw :blah, "msg"
+ end
- it "needs to verify non-identity" do
- 1.wont_be_same_as(2).must_equal false
- proc { 1.wont_be_same_as 1 }.must_raise MiniTest::Assertion
+ 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 output in stdout" do
- proc { print "blah" }.must_output("blah").must_equal true
+ it "needs to verify types of objects" do
+ (6 * 7).must_be_instance_of(Fixnum).must_equal true
- proc {
- proc { print "xxx" }.must_output("blah")
- }.must_raise MiniTest::Assertion
+ 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 output in stderr" do
- proc { $stderr.print "blah" }.must_output(nil, "blah").must_equal true
+ it "needs to verify using any (negative) predicate" do
+ @assertion_count -= 1 # doesn"t take a message
- proc {
- proc { $stderr.print "xxx" }.must_output(nil, "blah")
- }.must_raise MiniTest::Assertion
+ "blah".wont_be(:empty?).must_equal false
+
+ assert_triggered "Expected \"\" to not be empty?." do
+ "".wont_be :empty?
+ end
end
- it "needs to ensure silence" do
- @assertion_count = 5
+ it "needs to verify using any binary operator" do
+ @assertion_count -= 1 # no msg
- proc { }.must_be_silent.must_equal true
+ 41.must_be(:<, 42).must_equal true
- proc {
- proc { print "xxx" }.must_be_silent
- }.must_raise MiniTest::Assertion
+ assert_triggered "Expected 42 to be < 41." do
+ 42.must_be(:<, 41)
+ end
end
- it "needs to be sensible about must_include order" do
- @assertion_count = 6
- [1, 2, 3].must_include(2).must_equal true
- proc { [1, 2, 3].must_include 5 }.must_raise MiniTest::Assertion
+ 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 be sensible about wont_include order" do
- @assertion_count = 6
- [1, 2, 3].wont_include(5).must_equal false
- proc { [1, 2, 3].wont_include 2 }.must_raise MiniTest::Assertion
+ 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
@@ -252,11 +577,28 @@ describe MiniTest::Spec, :subject do
end
end
-class TestMeta < MiniTest::Unit::TestCase
- def test_setup
- srand 42
- MiniTest::Unit::TestCase.reset
+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!
def util_structure
x = y = z = nil
@@ -277,6 +619,9 @@ class TestMeta < MiniTest::Unit::TestCase
before { before_list << 3 }
after { after_list << 3 }
it "inner-it" do end
+
+ it {} # ignore me
+ specify {} # anonymous it
end
end
end
@@ -316,67 +661,78 @@ class TestMeta < MiniTest::Unit::TestCase
MiniTest::Spec::TYPES.replace original_types
end
+ def test_name
+ spec_a = describe ExampleA do; end
+ spec_b = describe ExampleB, :random_method do; end
+
+ assert_equal "ExampleA", spec_a.name
+ assert_equal "ExampleB::random_method", spec_b.name
+ end
+
+ def test_name2
+ assert_equal "NamedExampleA", NamedExampleA.name
+ assert_equal "NamedExampleB", NamedExampleB.name
+ assert_equal "NamedExampleC", NamedExampleC.name
+
+ spec_a = describe ExampleA do; end
+ spec_b = describe ExampleB, :random_method do; end
+
+ assert_equal "ExampleA", spec_a.name
+ assert_equal "ExampleB::random_method", spec_b.name
+ 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", 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 "top-level thingy", x.desc
+ assert_equal "inner thingy", y.desc
assert_equal "very inner thingy", z.desc
- top_methods = %w(test_0001_top_level_it)
- inner_methods = %w(test_0001_inner_it)
+ 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 {|o| o.to_s }
- assert_equal inner_methods, y.instance_methods(false).sort.map {|o| o.to_s }
- assert_equal inner_methods, z.instance_methods(false).sort.map {|o| o.to_s }
+ 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
- tc = z.new(nil)
+ @tu = MiniTest::Unit.new
+ MiniTest::Unit.runner = nil # protect the outer runner from the inner tests
- tc.run_setup_hooks
- tc.run_teardown_hooks
+ 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_children
- MiniTest::Spec.children.clear
-
- 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
-
def test_describe_first_structure
- x = y = z = nil
+ x = x1 = x2 = y = z = nil
x = describe "top-level thingy" do
y = describe "first thingy" do end
- it "top-level-it" do end
+ x1 = it "top level it" do end
+ x2 = it "не латинÑкие буквы-и-ÑпецÑимволы&ã„ã£ãŸ α, β, γ, δ, ε hello!!! world" do end
z = describe "second thingy" do end
end
- assert_equal ['test_0001_top_level_it'],
- x.instance_methods.grep(/^test/).map {|o| o.to_s}
+ 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
@@ -394,4 +750,62 @@ class TestMeta < MiniTest::Unit::TestCase
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
+
+require "minitest/metametameta"
+
+class TestSpecInTestCase < MetaMetaMetaTestCase
+ def setup
+ super
+
+ @tc = MiniTest::Unit::TestCase.new "fake tc"
+ @assertion_count = 1
+ end
+
+ def util_assert_triggered expected, klass = MiniTest::Assertion # REFACTOR
+ 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
+
+ def teardown # REFACTOR
+ assert_equal(@assertion_count, @tc._assertions,
+ "expected #{@assertion_count} assertions to be fired during the test, not #{@tc._assertions}") if @tc.passed?
+ 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
end
diff --git a/test/minitest/test_minitest_unit.rb b/test/minitest/test_minitest_unit.rb
index c921ca749e..0f29614e87 100644
--- a/test/minitest/test_minitest_unit.rb
+++ b/test/minitest/test_minitest_unit.rb
@@ -1,22 +1,22 @@
+# 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 'stringio'
require 'pathname'
-require 'minitest/unit'
-
-MiniTest::Unit.autorun
+require 'minitest/metametameta'
module MyModule; end
class AnError < StandardError; include MyModule; end
class ImmutableString < String; def inspect; super.freeze; end; end
-class TestMiniTestUnit < MiniTest::Unit::TestCase
- pwd = Pathname.new(File.expand_path(Dir.pwd))
- basedir = Pathname.new(File.expand_path(MiniTest::MINI_DIR)) + 'mini'
+class TestMiniTestUnit < MetaMetaMetaTestCase
+ parallelize_me!
+
+ 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
MINITEST_BASE_DIR = basedir[/\A\./] ? basedir : "./#{basedir}"
BT_MIDDLE = ["#{MINITEST_BASE_DIR}/test.rb:161:in `each'",
@@ -24,45 +24,13 @@ class TestMiniTestUnit < MiniTest::Unit::TestCase
"#{MINITEST_BASE_DIR}/test.rb:139:in `run'",
"#{MINITEST_BASE_DIR}/test.rb:106:in `run'"]
- def assert_report expected = nil
- expected ||= "Run options: --seed 42
-
-# Running tests:
-
-.
-
-Finished tests in 0.00
-
-1 tests, 1 assertions, 0 failures, 0 errors, 0 skips
-"
- output = @output.string.sub(/Finished tests in .*/, "Finished tests in 0.00")
- output.sub!(/Loaded suite .*/, 'Loaded suite blah')
- output.sub!(/^(\s+)(?:#{Regexp.union(__FILE__, File.expand_path(__FILE__))}):\d+:/o, '\1FILE:LINE:')
- output.sub!(/\[(?:#{Regexp.union(__FILE__, File.expand_path(__FILE__))}):\d+\]/o, '[FILE:LINE]')
- assert_equal(expected, output)
- end
-
- def setup
- srand 42
- MiniTest::Unit::TestCase.reset
- @tu = MiniTest::Unit.new
- @output = StringIO.new("")
- MiniTest::Unit.runner = nil # protect the outer runner from the inner tests
- MiniTest::Unit.output = @output
- end
-
- def teardown
- MiniTest::Unit.output = $stdout
- Object.send :remove_const, :ATestCase if defined? ATestCase
- 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
@@ -82,7 +50,7 @@ Finished tests in 0.00
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
@@ -105,7 +73,7 @@ Finished tests in 0.00
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
@@ -138,7 +106,7 @@ Finished tests in 0.00
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
@@ -186,12 +154,131 @@ Finished tests in 0.00
bt = util_expand_bt bt
ex = ["-e:1"]
- fu = MiniTest::filter_backtrace(bt)
+ fu = MiniTest::filter_backtrace bt
assert_equal ex, fu
end
+ def test_default_runner_is_minitest_unit
+ 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
+ if RUBY_VERSION >= '1.9.0' then
+ bt.map { |f| (f =~ /^\./) ? File.expand_path(f) : f }
+ else
+ bt
+ end
+ end
+end
+
+class TestMiniTestUnitInherited < MetaMetaMetaTestCase
+ def with_overridden_include
+ Class.class_eval do
+ def inherited_with_hacks klass
+ throw :inherited_hook
+ end
+
+ alias inherited_without_hacks inherited
+ alias inherited inherited_with_hacks
+ alias IGNORE_ME! inherited # 1.8 bug. god I love venture bros
+ end
+
+ yield
+ ensure
+ Class.class_eval do
+ alias inherited inherited_without_hacks
+
+ undef_method :inherited_with_hacks
+ undef_method :inherited_without_hacks
+ end
+
+ refute_respond_to Class, :inherited_with_hacks
+ refute_respond_to Class, :inherited_without_hacks
+ end
+
+ def test_inherited_hook_plays_nice_with_others
+ with_overridden_include do
+ assert_throws :inherited_hook do
+ Class.new MiniTest::Unit::TestCase
+ end
+ end
+ end
+end
+
+class TestMiniTestRunner < MetaMetaMetaTestCase
+ # do not parallelize this suite... it just can't handle it.
+
+ def test_class_test_suites
+ @assertion_count = 0
+
+ tc = Class.new(MiniTest::Unit::TestCase)
+
+ assert_equal 1, MiniTest::Unit::TestCase.test_suites.size
+ assert_equal [tc], MiniTest::Unit::TestCase.test_suites
+ end
+
+ def test_run_test
+ Class.new MiniTest::Unit::TestCase do
+ attr_reader :foo
+
+ def run_test name
+ @foo = "hi mom!"
+ super
+ @foo = "okay"
+ end
+
+ def test_something
+ assert_equal "hi mom!", foo
+ end
+ end
+
+ expected = clean <<-EOM
+ .
+
+ Finished tests in 0.00
+
+ 1 tests, 1 assertions, 0 failures, 0 errors, 0 skips
+ EOM
+
+ assert_report expected
+ end
+
def test_run_error
- tc = Class.new(MiniTest::Unit::TestCase) do
+ Class.new MiniTest::Unit::TestCase do
def test_something
assert true
end
@@ -201,30 +288,24 @@ Finished tests in 0.00
end
end
- Object.const_set(:ATestCase, tc)
-
- @tu.run %w[--seed 42]
+ expected = clean <<-EOM
+ E.
- expected = "Run options: --seed 42
+ Finished tests in 0.00
-# Running tests:
+ 1) Error:
+ #<Class:0xXXX>#test_error:
+ RuntimeError: unhandled exception
+ FILE:LINE:in \`test_error\'
-E.
+ 2 tests, 1 assertions, 0 failures, 1 errors, 0 skips
+ EOM
-Finished tests in 0.00
-
- 1) Error:
-test_error(ATestCase):
-RuntimeError: unhandled exception
- FILE:LINE:in `test_error'
-
-2 tests, 1 assertions, 0 failures, 1 errors, 0 skips
-"
assert_report expected
end
def test_run_error_teardown
- tc = Class.new(MiniTest::Unit::TestCase) do
+ Class.new MiniTest::Unit::TestCase do
def test_something
assert true
end
@@ -234,30 +315,24 @@ RuntimeError: unhandled exception
end
end
- Object.const_set(:ATestCase, tc)
-
- @tu.run %w[--seed 42]
+ expected = clean <<-EOM
+ E
- expected = "Run options: --seed 42
+ Finished tests in 0.00
-# Running tests:
+ 1) Error:
+ #<Class:0xXXX>#test_something:
+ RuntimeError: unhandled exception
+ FILE:LINE:in \`teardown\'
-E
+ 1 tests, 1 assertions, 0 failures, 1 errors, 0 skips
+ EOM
-Finished tests in 0.00
-
- 1) Error:
-test_something(ATestCase):
-RuntimeError: unhandled exception
- FILE:LINE:in `teardown'
-
-1 tests, 1 assertions, 0 failures, 1 errors, 0 skips
-"
assert_report expected
end
def test_run_failing
- tc = Class.new(MiniTest::Unit::TestCase) do
+ Class.new MiniTest::Unit::TestCase do
def test_something
assert true
end
@@ -267,29 +342,23 @@ RuntimeError: unhandled exception
end
end
- Object.const_set(:ATestCase, tc)
-
- @tu.run %w[--seed 42]
+ expected = clean <<-EOM
+ F.
- expected = "Run options: --seed 42
+ Finished tests in 0.00
-# Running tests:
+ 1) Failure:
+ #<Class:0xXXX>#test_failure [FILE:LINE]:
+ Failed assertion, no message given.
-F.
+ 2 tests, 2 assertions, 1 failures, 0 errors, 0 skips
+ EOM
-Finished tests in 0.00
-
- 1) Failure:
-test_failure(ATestCase) [FILE:LINE]:
-Failed assertion, no message given.
-
-2 tests, 2 assertions, 1 failures, 0 errors, 0 skips
-"
assert_report expected
end
def test_run_failing_filtered
- tc = Class.new(MiniTest::Unit::TestCase) do
+ Class.new MiniTest::Unit::TestCase do
def test_something
assert true
end
@@ -299,39 +368,96 @@ Failed assertion, no message given.
end
end
- Object.const_set(:ATestCase, tc)
+ expected = clean <<-EOM
+ .
+
+ Finished tests in 0.00
+
+ 1 tests, 1 assertions, 0 failures, 0 errors, 0 skips
+ EOM
+
+ 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)
- @tu.run %w[--name /some|thing/ --seed 42]
+ 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
+ .
- expected = "Run options: --name \"/some|thing/\" --seed 42
+ Finished tests in 0.00
-# Running tests:
+ 1 tests, 1 assertions, 0 failures, 0 errors, 0 skips
+ EOM
-.
+ assert_filtering "/Beta#test_something/", expected
+ end
-Finished tests in 0.00
+ def test_run_filtered_including_suite_name_string
+ expected = clean <<-EOM
+ .
-1 tests, 1 assertions, 0 failures, 0 errors, 0 skips
-"
- assert_report expected
+ 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
- tc = Class.new(MiniTest::Unit::TestCase) do
+ Class.new MiniTest::Unit::TestCase do
def test_something
assert true
end
end
- Object.const_set(:ATestCase, tc)
+ expected = clean <<-EOM
+ .
+
+ Finished tests in 0.00
- @tu.run %w[--seed 42]
+ 1 tests, 1 assertions, 0 failures, 0 errors, 0 skips
+ EOM
- assert_report
+ assert_report expected
end
def test_run_skip
- tc = Class.new(MiniTest::Unit::TestCase) do
+ Class.new MiniTest::Unit::TestCase do
def test_something
assert true
end
@@ -341,25 +467,19 @@ Finished tests in 0.00
end
end
- Object.const_set(:ATestCase, tc)
+ expected = clean <<-EOM
+ S.
- @tu.run %w[--seed 42]
+ Finished tests in 0.00
- expected = "Run options: --seed 42
+ 2 tests, 1 assertions, 0 failures, 0 errors, 1 skips
+ EOM
-# Running tests:
-
-S.
-
-Finished tests in 0.00
-
-2 tests, 1 assertions, 0 failures, 0 errors, 1 skips
-"
assert_report expected
end
def test_run_skip_verbose
- tc = Class.new(MiniTest::Unit::TestCase) do
+ Class.new MiniTest::Unit::TestCase do
def test_something
assert true
end
@@ -369,46 +489,33 @@ Finished tests in 0.00
end
end
- Object.const_set(:ATestCase, tc)
-
- @tu.run %w[--seed 42 --verbose]
+ expected = clean <<-EOM
+ #<Class:0xXXX>#test_skip = 0.00 s = S
+ #<Class:0xXXX>#test_something = 0.00 s = .
- expected = "Run options: --seed 42 --verbose
-# Running tests:
+ Finished tests in 0.00
-ATestCase#test_skip = 0.00 s = S
-ATestCase#test_something = 0.00 s = .
+ 1) Skipped:
+ #<Class:0xXXX>#test_skip [FILE:LINE]:
+ not yet
+ 2 tests, 1 assertions, 0 failures, 0 errors, 1 skips
+ EOM
-Finished tests in 0.00
-
- 1) Skipped:
-test_skip(ATestCase) [FILE:LINE]:
-not yet
-
-2 tests, 1 assertions, 0 failures, 0 errors, 1 skips
-"
- assert_report expected
- end
-
- def test_default_runner_is_minitest_unit
- assert_instance_of MiniTest::Unit, MiniTest::Unit.runner
+ assert_report expected, %w[--seed 42 --verbose]
end
def test_run_with_other_runner
-
- runner = Class.new(MiniTest::Unit) do
- # Run once before each suite
- def _run_suite(suite, type)
- begin
- suite.before_suite
- super(suite, type)
- end
+ MiniTest::Unit.runner = Class.new MiniTest::Unit do
+ def _run_suite suite, type
+ suite.before_suite # Run once before each suite
+ super suite, type
end
- end
+ end.new
- tc = Class.new(MiniTest::Unit::TestCase) do
+ Class.new MiniTest::Unit::TestCase do
+ def self.name; "wacky!" end
def self.before_suite
MiniTest::Unit.output.puts "Running #{self.name} tests"
@@ -424,143 +531,180 @@ not yet
end
end
- Object.const_set(:ATestCase, tc)
- MiniTest::Unit.runner = runner.new
- @tu.run %w[--seed 42]
-
- # We should only see 'running ATestCase tests' once
- expected = "Run options: --seed 42
-
-# Running tests:
+ expected = clean <<-EOM
+ Running wacky! tests
+ ..
-Running ATestCase tests
-..
+ Finished tests in 0.00
-Finished tests in 0.00
+ 2 tests, 2 assertions, 0 failures, 0 errors, 0 skips
+ EOM
-2 tests, 2 assertions, 0 failures, 0 errors, 0 skips
-"
assert_report expected
end
- def with_overridden_include
- Class.class_eval do
- def inherited_with_hacks klass
- throw :inherited_hook
- end
+ require 'monitor'
- alias inherited_without_hacks inherited
- alias inherited inherited_with_hacks
- alias IGNORE_ME! inherited # 1.8 bug. god I love venture bros
+ class Latch
+ def initialize count = 1
+ @count = count
+ @lock = Monitor.new
+ @cv = @lock.new_cond
end
- yield
-
- ensure
- Class.class_eval do
- alias inherited inherited_without_hacks
+ def release
+ @lock.synchronize do
+ @count -= 1 if @count > 0
+ @cv.broadcast if @count == 0
+ end
+ end
- undef_method :inherited_with_hacks
- undef_method :inherited_without_hacks
+ def await
+ @lock.synchronize { @cv.wait_while { @count > 0 } }
end
+ end
- refute_respond_to Class, :inherited_with_hacks
- refute_respond_to Class, :inherited_without_hacks
+ def test_parallel_each_size
+ assert_equal 0, ParallelEach.new([]).size
end
- def test_inherited_hook_plays_nice_with_others
- with_overridden_include do
- assert_throws :inherited_hook do
- Class.new MiniTest::Unit::TestCase
+ def test_run_parallel
+ skip "I don't have ParallelEach debugged yet" if maglev?
+
+ 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
- def test_setup_hooks
- call_order = []
+class TestMiniTestUnitOrder < MetaMetaMetaTestCase
+ # do not parallelize this suite... it just can't handle it.
- tc = Class.new(MiniTest::Unit::TestCase) do
+ def test_before_setup
+ call_order = []
+ Class.new MiniTest::Unit::TestCase do
define_method :setup do
super()
- call_order << :method
+ call_order << :setup
end
- define_method :test2 do
- call_order << :test2
+ define_method :before_setup do
+ call_order << :before_setup
end
- define_method :test1 do
- call_order << :test1
- end
+ def test_omg; assert true; end
end
- tc.add_setup_hook lambda { call_order << :proc }
+ with_output do
+ @tu.run %w[--seed 42]
+ end
- argument = nil
+ expected = [:before_setup, :setup]
+ assert_equal expected, call_order
+ end
- tc.add_setup_hook do |arg|
- argument = arg
- call_order << :block
- end
+ def test_after_teardown
+ call_order = []
+ Class.new MiniTest::Unit::TestCase do
+ define_method :teardown do
+ super()
+ call_order << :teardown
+ end
- @tu.run %w[--seed 42]
+ define_method :after_teardown do
+ call_order << :after_teardown
+ end
- assert_kind_of tc, argument
+ def test_omg; assert true; end
+ end
- expected = [:method, :proc, :block, :test1,
- :method, :proc, :block, :test2]
+ with_output do
+ @tu.run %w[--seed 42]
+ end
+ expected = [:teardown, :after_teardown]
assert_equal expected, call_order
end
- def test_teardown_hooks
+ def test_all_teardowns_are_guaranteed_to_run
call_order = []
+ Class.new MiniTest::Unit::TestCase do
+ define_method :after_teardown do
+ super()
+ call_order << :after_teardown
+ raise
+ end
- tc = Class.new(MiniTest::Unit::TestCase) do
define_method :teardown do
super()
- call_order << :method
+ call_order << :teardown
+ raise
end
- define_method :test2 do
- call_order << :test2
+ define_method :before_teardown do
+ super()
+ call_order << :before_teardown
+ raise
end
- define_method :test1 do
- call_order << :test1
- end
+ def test_omg; assert true; end
end
- tc.add_teardown_hook lambda { call_order << :proc }
-
- argument = nil
-
- tc.add_teardown_hook do |arg|
- argument = arg
- call_order << :block
+ with_output do
+ @tu.run %w[--seed 42]
end
- @tu.run %w[--seed 42]
-
- assert_kind_of tc, argument
-
- expected = [:test1, :block, :proc, :method,
- :test2, :block, :proc, :method]
-
+ expected = [:before_teardown, :teardown, :after_teardown]
assert_equal expected, call_order
end
- def test_setup_and_teardown_hooks_survive_inheritance
+ def test_setup_and_teardown_survive_inheritance
call_order = []
- parent = Class.new(MiniTest::Unit::TestCase) do
+ parent = Class.new MiniTest::Unit::TestCase do
define_method :setup do
- super()
call_order << :setup_method
end
define_method :teardown do
- super()
call_order << :teardown_method
end
@@ -569,34 +713,29 @@ Finished tests in 0.00
end
end
- parent.add_setup_hook { call_order << :setup_hook }
- parent.add_teardown_hook { call_order << :teardown_hook }
-
_ = Class.new parent
- parent.add_setup_hook { call_order << :setup_after }
- parent.add_teardown_hook { call_order << :teardown_after }
-
- @tu.run %w[--seed 42]
+ with_output do
+ @tu.run %w[--seed 42]
+ end
# Once for the parent class, once for the child
- expected = [:setup_method, :setup_hook, :setup_after, :test,
- :teardown_after, :teardown_hook, :teardown_method] * 2
+ expected = [:setup_method, :test, :teardown_method] * 2
assert_equal expected, call_order
end
-
- def util_expand_bt bt
- if RUBY_VERSION =~ /^1\.9/ then
- bt.map { |f| (f =~ /^\./) ? File.expand_path(f) : f }
- else
- bt
- end
- end
end
class TestMiniTestUnitTestCase < MiniTest::Unit::TestCase
+ # 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
+
def setup
+ super
+
MiniTest::Unit::TestCase.reset
@tc = MiniTest::Unit::TestCase.new 'fake tc'
@@ -606,8 +745,16 @@ 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
- Object.send :remove_const, :ATestCase if defined? ATestCase
+ "expected #{@assertion_count} assertions to be fired during the test, not #{@tc._assertions}") if @tc.passed?
+ end
+
+ def non_verbose
+ orig_verbose = $VERBOSE
+ $VERBOSE = false
+
+ yield
+ ensure
+ $VERBOSE = orig_verbose
end
def test_assert
@@ -628,20 +775,6 @@ class TestMiniTestUnitTestCase < MiniTest::Unit::TestCase
end
end
- def test_assert_block
- @tc.assert_block do
- true
- end
- end
-
- def test_assert_block_triggered
- util_assert_triggered "blah.\nExpected block to return true value." do
- @tc.assert_block "blah" do
- false
- end
- end
- end
-
def test_assert_empty
@assertion_count = 2
@@ -660,7 +793,33 @@ class TestMiniTestUnitTestCase < MiniTest::Unit::TestCase
@tc.assert_equal 1, 1
end
+ def test_assert_equal_different_collection_array_hex_invisible
+ object1 = Object.new
+ object2 = Object.new
+ msg = "No visible difference in the Array#inspect output.
+ You should look at the implementation of #== on Array or its members.
+ [#<Object:0xXXXXXX>]".gsub(/^ +/, "")
+ util_assert_triggered msg do
+ @tc.assert_equal [object1], [object2]
+ end
+ end
+
+ def test_assert_equal_different_collection_hash_hex_invisible
+ h1, h2 = {}, {}
+ h1[1] = Object.new
+ h2[1] = Object.new
+ msg = "No visible difference in the Hash#inspect output.
+ You should look at the implementation of #== on Hash or its members.
+ {1=>#<Object:0xXXXXXX>}".gsub(/^ +/, "")
+
+ util_assert_triggered msg do
+ @tc.assert_equal h1, h2
+ end
+ 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
@@ -694,8 +853,8 @@ class TestMiniTestUnitTestCase < MiniTest::Unit::TestCase
o1 = Object.new
o2 = Object.new
- msg = "No visible difference.
- You should look at your implementation of Object#==.
+ msg = "No visible difference in the Object#inspect output.
+ You should look at the implementation of #== on Object or its members.
#<Object:0xXXXXXX>".gsub(/^ +/, "")
util_assert_triggered msg do
@@ -720,8 +879,8 @@ class TestMiniTestUnitTestCase < MiniTest::Unit::TestCase
end
def test_assert_equal_different_long_invisible
- msg = "No visible difference.
- You should look at your implementation of String#==.
+ msg = "No visible difference in the String#inspect output.
+ You should look at the implementation of #== on String or its members.
\"blahblahblahblahblahblahblahblahblahblah\"".gsub(/^ +/, "")
util_assert_triggered msg do
@@ -773,14 +932,23 @@ 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
def test_assert_in_epsilon
- @assertion_count = 8
+ @assertion_count = 10
@tc.assert_in_epsilon 10000, 9991
@tc.assert_in_epsilon 9991, 10000
@@ -791,14 +959,34 @@ class TestMiniTestUnitTestCase < MiniTest::Unit::TestCase
@tc.assert_in_epsilon 9999.1, 10000, 0.0001
@tc.assert_in_epsilon 1.0, 1.0001, 0.0001
@tc.assert_in_epsilon 1.0001, 1.0, 0.0001
+
+ @tc.assert_in_epsilon(-1, -1)
+ @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 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
+
def test_assert_includes
@assertion_count = 2
@@ -841,7 +1029,7 @@ class TestMiniTestUnitTestCase < MiniTest::Unit::TestCase
@tc.assert_match(/\w+/, "blah blah blah")
end
- def test_assert_match_object
+ def test_assert_match_matcher_object
@assertion_count = 2
pattern = Object.new
@@ -850,6 +1038,15 @@ class TestMiniTestUnitTestCase < MiniTest::Unit::TestCase
@tc.assert_match pattern, 5
end
+ def test_assert_match_matchee_to_str
+ @assertion_count = 2
+
+ obj = Object.new
+ def obj.to_str; "blah" end
+
+ @tc.assert_match "blah", obj
+ end
+
def test_assert_match_object_triggered
@assertion_count = 2
@@ -883,6 +1080,13 @@ class TestMiniTestUnitTestCase < MiniTest::Unit::TestCase
@tc.assert_operator 2, :>, 1
end
+ def test_assert_operator_bad_object
+ bad = Object.new
+ def bad.==(other) true end
+
+ @tc.assert_operator bad, :equal?, bad
+ end
+
def test_assert_operator_triggered
util_assert_triggered "Expected 2 to be < 1." do
@tc.assert_operator 2, :<, 1
@@ -898,6 +1102,15 @@ class TestMiniTestUnitTestCase < MiniTest::Unit::TestCase
end
end
+ def test_assert_output_both_regexps
+ @assertion_count = 4
+
+ @tc.assert_output(/y.y/, /bl.h/) do
+ print "yay"
+ $stderr.print "blah"
+ end
+ end
+
def test_assert_output_err
@tc.assert_output nil, "blah" do
$stderr.print "blah"
@@ -919,7 +1132,7 @@ class TestMiniTestUnitTestCase < MiniTest::Unit::TestCase
end
def test_assert_output_triggered_both
- util_assert_triggered util_msg("yay", "boo", "In stdout") do
+ util_assert_triggered util_msg("blah", "blah blah", "In stderr") do
@tc.assert_output "yay", "blah" do
print "boo"
$stderr.print "blah blah"
@@ -943,12 +1156,28 @@ class TestMiniTestUnitTestCase < MiniTest::Unit::TestCase
end
end
+ def test_assert_predicate
+ @tc.assert_predicate "", :empty?
+ end
+
+ def test_assert_predicate_triggered
+ util_assert_triggered 'Expected "blah" to be empty?.' do
+ @tc.assert_predicate "blah", :empty?
+ end
+ end
+
def test_assert_raises
@tc.assert_raises RuntimeError do
raise "blah"
end
end
+ def test_assert_raises_module
+ @tc.assert_raises MyModule do
+ raise AnError
+ end
+ end
+
##
# *sigh* This is quite an odd scenario, but it is from real (albeit
# ugly) test code in ruby-core:
@@ -969,12 +1198,6 @@ class TestMiniTestUnitTestCase < MiniTest::Unit::TestCase
end
end
- def test_assert_raises_module
- @tc.assert_raises MyModule do
- raise AnError
- end
- end
-
def test_assert_raises_triggered_different
e = assert_raises MiniTest::Assertion do
@tc.assert_raises RuntimeError do
@@ -982,15 +1205,17 @@ class TestMiniTestUnitTestCase < MiniTest::Unit::TestCase
end
end
- expected = "[RuntimeError] exception expected, not
-Class: <SyntaxError>
-Message: <\"icky\">
----Backtrace---
-FILE:LINE:in `test_assert_raises_triggered_different'
----------------"
+ expected = clean <<-EOM.chomp
+ [RuntimeError] exception expected, not
+ Class: <SyntaxError>
+ Message: <\"icky\">
+ ---Backtrace---
+ FILE:LINE:in \`test_assert_raises_triggered_different\'
+ ---------------
+ EOM
actual = e.message.gsub(/^.+:\d+/, 'FILE:LINE')
- actual.gsub!(/block \(\d+ levels\) in /, '') if RUBY_VERSION =~ /^1\.9/
+ actual.gsub!(/block \(\d+ levels\) in /, '') if RUBY_VERSION >= '1.9.0'
assert_equal expected, actual
end
@@ -1002,18 +1227,20 @@ FILE:LINE:in `test_assert_raises_triggered_different'
end
end
- expected = "XXX
-[RuntimeError] exception expected, not
-Class: <SyntaxError>
-Message: <\"icky\">
----Backtrace---
-FILE:LINE:in `test_assert_raises_triggered_different_msg'
----------------"
+ expected = clean <<-EOM
+ XXX.
+ [RuntimeError] exception expected, not
+ Class: <SyntaxError>
+ Message: <\"icky\">
+ ---Backtrace---
+ FILE:LINE:in \`test_assert_raises_triggered_different_msg\'
+ ---------------
+ EOM
actual = e.message.gsub(/^.+:\d+/, 'FILE:LINE')
- actual.gsub!(/block \(\d+ levels\) in /, '') if RUBY_VERSION =~ /^1\.9/
+ actual.gsub!(/block \(\d+ levels\) in /, '') if RUBY_VERSION >= '1.9.0'
- assert_equal expected, actual
+ assert_equal expected.chomp, actual
end
def test_assert_raises_triggered_none
@@ -1035,7 +1262,7 @@ FILE:LINE:in `test_assert_raises_triggered_different_msg'
end
end
- expected = "XXX\nMiniTest::Assertion expected but nothing was raised."
+ expected = "XXX.\nMiniTest::Assertion expected but nothing was raised."
assert_equal expected, e.message
end
@@ -1047,15 +1274,17 @@ FILE:LINE:in `test_assert_raises_triggered_different_msg'
end
end
- expected = "[StandardError] exception expected, not
-Class: <AnError>
-Message: <\"AnError\">
----Backtrace---
-FILE:LINE:in `test_assert_raises_triggered_subclass'
----------------"
+ expected = clean <<-EOM.chomp
+ [StandardError] exception expected, not
+ Class: <AnError>
+ Message: <\"AnError\">
+ ---Backtrace---
+ FILE:LINE:in \`test_assert_raises_triggered_subclass\'
+ ---------------
+ EOM
actual = e.message.gsub(/^.+:\d+/, 'FILE:LINE')
- actual.gsub!(/block \(\d+ levels\) in /, '') if RUBY_VERSION =~ /^1\.9/
+ actual.gsub!(/block \(\d+ levels\) in /, '') if RUBY_VERSION >= '1.9.0'
assert_equal expected, actual
end
@@ -1113,8 +1342,6 @@ FILE:LINE:in `test_assert_raises_triggered_subclass'
end
def test_assert_silent_triggered_err
- @assertion_count = 2
-
util_assert_triggered util_msg("", "blah blah", "In stderr") do
@tc.assert_silent do
$stderr.print "blah blah"
@@ -1123,6 +1350,8 @@ FILE:LINE:in `test_assert_raises_triggered_subclass'
end
def test_assert_silent_triggered_out
+ @assertion_count = 2
+
util_assert_triggered util_msg("", "blah blah", "In stdout") do
@tc.assert_silent do
print "blah blah"
@@ -1131,14 +1360,14 @@ FILE:LINE:in `test_assert_raises_triggered_subclass'
end
def test_assert_throws
- @tc.assert_throws(:blah) do
+ @tc.assert_throws :blah do
throw :blah
end
end
def test_assert_throws_different
util_assert_triggered 'Expected :blah to have been thrown, not :not_blah.' do
- @tc.assert_throws(:blah) do
+ @tc.assert_throws :blah do
throw :not_blah
end
end
@@ -1146,7 +1375,7 @@ FILE:LINE:in `test_assert_raises_triggered_subclass'
def test_assert_throws_unthrown
util_assert_triggered 'Expected :blah to have been thrown.' do
- @tc.assert_throws(:blah) do
+ @tc.assert_throws :blah do
# do nothing
end
end
@@ -1155,17 +1384,30 @@ FILE:LINE:in `test_assert_raises_triggered_subclass'
def test_capture_io
@assertion_count = 0
- orig_verbose = $VERBOSE
- $VERBOSE = false
- out, err = capture_io do
- puts 'hi'
- warn 'bye!'
+ non_verbose do
+ out, err = capture_io do
+ puts 'hi'
+ $stderr.puts 'bye!'
+ end
+
+ assert_equal "hi\n", out
+ assert_equal "bye!\n", err
end
+ end
- assert_equal "hi\n", out
- assert_equal "bye!\n", err
- ensure
- $VERBOSE = orig_verbose
+ 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")
+ end
+
+ assert_equal "hi\n", out
+ assert_equal "bye!\n", err
+ end
end
def test_class_asserts_match_refutes
@@ -1174,10 +1416,15 @@ FILE:LINE:in `test_assert_raises_triggered_subclass'
methods = MiniTest::Assertions.public_instance_methods
methods.map! { |m| m.to_s } if Symbol === methods.first
- ignores = %w(assert_block assert_no_match assert_not_equal
- assert_not_nil assert_not_same assert_nothing_raised
- assert_nothing_thrown assert_output assert_raise
- assert_raises assert_send assert_silent assert_throws)
+ # These don't have corresponding refutes _on purpose_. They're
+ # useless and will never be added, so don't bother.
+ 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
+ ignores += %w[assert_no_match assert_not_equal assert_not_nil
+ assert_not_same assert_nothing_raised
+ assert_nothing_thrown assert_raise]
asserts = methods.grep(/^assert/).sort - ignores
refutes = methods.grep(/^refute/).sort - ignores
@@ -1186,23 +1433,6 @@ FILE:LINE:in `test_assert_raises_triggered_subclass'
assert_empty asserts.map { |n| n.sub(/^assert/, 'refute') } - refutes
end
- def test_class_inherited
- @assertion_count = 0
-
- Object.const_set(:ATestCase, Class.new(MiniTest::Unit::TestCase))
-
- assert_equal [ATestCase], MiniTest::Unit::TestCase.test_suites
- end
-
- def test_class_test_suites
- @assertion_count = 0
-
- Object.const_set(:ATestCase, Class.new(MiniTest::Unit::TestCase))
-
- assert_equal 1, MiniTest::Unit::TestCase.test_suites.size
- assert_equal [ATestCase], MiniTest::Unit::TestCase.test_suites
- end
-
def test_flunk
util_assert_triggered 'Epic Fail!' do
@tc.flunk
@@ -1222,6 +1452,36 @@ FILE:LINE:in `test_assert_raises_triggered_subclass'
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
@@ -1268,18 +1528,19 @@ FILE:LINE:in `test_assert_raises_triggered_subclass'
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
@@ -1326,7 +1587,7 @@ FILE:LINE:in `test_assert_raises_triggered_subclass'
@tc.refute_match(/\d+/, "blah blah blah")
end
- def test_refute_match_object
+ def test_refute_match_matcher_object
@assertion_count = 2
@tc.refute_match Object.new, 5 # default #=~ returns false
end
@@ -1360,10 +1621,27 @@ FILE:LINE:in `test_assert_raises_triggered_subclass'
end
end
+ def test_refute_predicate
+ @tc.refute_predicate "42", :empty?
+ end
+
+ def test_refute_predicate_triggered
+ util_assert_triggered 'Expected "" to not be empty?.' do
+ @tc.refute_predicate "", :empty?
+ end
+ end
+
def test_refute_operator
@tc.refute_operator 2, :<, 1
end
+ def test_refute_operator_bad_object
+ bad = Object.new
+ def bad.==(other) true end
+
+ @tc.refute_operator true, :equal?, bad
+ end
+
def test_refute_operator_triggered
util_assert_triggered "Expected 2 to not be > 1." do
@tc.refute_operator 2, :>, 1
@@ -1401,21 +1679,27 @@ FILE:LINE:in `test_assert_raises_triggered_subclass'
def test_test_methods_random
@assertion_count = 0
- sample_test_case = Class.new(MiniTest::Unit::TestCase) do
+ sample_test_case = Class.new MiniTest::Unit::TestCase do
+ def self.test_order; :random; end
def test_test1; assert "does not matter" end
def test_test2; assert "does not matter" end
def test_test3; assert "does not matter" end
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
def test_test_methods_sorted
@assertion_count = 0
- sample_test_case = Class.new(MiniTest::Unit::TestCase) do
+ sample_test_case = Class.new MiniTest::Unit::TestCase do
def self.test_order; :sorted end
def test_test3; assert "does not matter" end
def test_test2; assert "does not matter" end
@@ -1426,13 +1710,36 @@ FILE:LINE:in `test_assert_raises_triggered_subclass'
assert_equal expected, sample_test_case.test_methods
end
+ def test_i_suck_and_my_tests_are_order_dependent_bang_sets_test_order_alpha
+ @assertion_count = 0
+
+ shitty_test_case = Class.new MiniTest::Unit::TestCase
+
+ shitty_test_case.i_suck_and_my_tests_are_order_dependent!
+
+ assert_equal :alpha, shitty_test_case.test_order
+ end
+
+ def test_i_suck_and_my_tests_are_order_dependent_bang_does_not_warn
+ @assertion_count = 0
+
+ shitty_test_case = Class.new MiniTest::Unit::TestCase
+
+ def shitty_test_case.test_order ; :lol end
+
+ assert_silent do
+ shitty_test_case.i_suck_and_my_tests_are_order_dependent!
+ end
+ end
+
def util_assert_triggered expected, klass = MiniTest::Assertion
- e = assert_raises(klass) do
+ e = assert_raises klass do
yield
end
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
@@ -1452,3 +1759,109 @@ FILE:LINE:in `test_assert_raises_triggered_subclass'
MiniTest::Assertions.diff = old_diff
end
end
+
+class TestMiniTestGuard < MiniTest::Unit::TestCase
+ parallelize_me!
+
+ def test_mri_eh
+ assert self.class.mri? "ruby blah"
+ assert self.mri? "ruby blah"
+ end
+
+ def test_jruby_eh
+ assert self.class.jruby? "java"
+ assert self.jruby? "java"
+ end
+
+ def test_rubinius_eh
+ assert self.class.rubinius? "rbx"
+ assert self.rubinius? "rbx"
+ end
+
+ def test_windows_eh
+ assert self.class.windows? "mswin"
+ 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 e058294841..e011ece1cf 100644
--- a/test/misc/test_ruby_mode.rb
+++ b/test/misc/test_ruby_mode.rb
@@ -118,7 +118,6 @@ class TestRubyMode
end
def test_array_literal
- skip
assert_indent('
|foo = [
| bar
@@ -138,5 +137,45 @@ class TestRubyMode
| end
|')
end
+
+ def test_begin_end
+ assert_indent('
+ |begin
+ | a[b]
+ |end
+ |', '
+ |begin
+ | a[b]
+ | end
+ |')
+ end
+
+ def test_array_after_paren_and_space
+ assert_indent('
+ |class A
+ | def foo
+ | foo( [])
+ | end
+ |end
+ |', '
+ |class A
+ | def foo
+ |foo( [])
+ |end
+ | end
+ |')
+ end
+
+ def test_spread_arguments
+ assert_indent('
+ |foo(1,
+ | 2,
+ | 3)
+ |', '
+ |foo(1,
+ | 2,
+ | 3)
+ |')
+ end
end
end if TestRubyMode::EMACS
diff --git a/test/mkmf/base.rb b/test/mkmf/base.rb
index a9d3aec338..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,15 +12,14 @@ $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
def initialize
@buffer = ""
@filter = nil
@out = true
+ @origin = nil
end
def clear
@buffer.clear
@@ -33,8 +34,10 @@ class TestMkmf < Test::Unit::TestCase
initialize_copy(io)
when File
@out = false
+ @origin.reopen(io) if @origin
when IO
@out = true
+ @origin.reopen(io) if @origin
else
@out = false
end
@@ -50,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
@@ -67,7 +66,7 @@ class TestMkmf < Test::Unit::TestCase
}
mkconfig = {
"hdrdir" => "$(top_srcdir)/include",
- "srcdir" => "$(top_srcdir)/ext/#{$mdir}",
+ "srcdir" => "$(top_srcdir)",
"topdir" => $topdir,
}
rbconfig0.each_pair {|key, val| rbconfig[key] ||= val.dup}
@@ -78,7 +77,7 @@ class TestMkmf < Test::Unit::TestCase
remove_const(:MAKEFILE_CONFIG)
const_set(:MAKEFILE_CONFIG, mkconfig)
}
- Object.class_eval {
+ MakeMakefile.class_eval {
remove_const(:CONFIG)
const_set(:CONFIG, mkconfig)
}
@@ -101,22 +100,23 @@ class TestMkmf < Test::Unit::TestCase
remove_const(:MAKEFILE_CONFIG)
const_set(:MAKEFILE_CONFIG, mkconfig0)
}
- Object.class_eval {
+ MakeMakefile.class_eval {
remove_const(:CONFIG)
const_set(:CONFIG, mkconfig0)
}
Logging.quiet = @quiet
Logging.log_close
+ FileUtils.rm_f("mkmf.log")
Dir.chdir(@curdir)
FileUtils.rm_rf(@tmpdir)
end
def mkmf(*args, &block)
@stdout.clear
- stdout, $stdout = $stdout, @stdout
+ stdout, @stdout.origin, $stdout = @stdout.origin, $stdout, @stdout
@mkmfobj.instance_eval(*args, &block)
ensure
- $stdout = stdout
+ $stdout, @stdout.origin = @stdout.origin, stdout
end
def config_value(name)
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_constant.rb b/test/mkmf/test_constant.rb
new file mode 100644
index 0000000000..fd1f940c44
--- /dev/null
+++ b/test/mkmf/test_constant.rb
@@ -0,0 +1,37 @@
+require_relative 'base'
+
+class TestMkmf
+ class TestTryConstant < TestMkmf
+ def test_simple
+ assert_equal( 0, mkmf {try_constant("0")}, MKMFLOG)
+ assert_equal( 1, mkmf {try_constant("1")}, MKMFLOG)
+ assert_equal(-1, mkmf {try_constant("-1")}, MKMFLOG)
+ end
+
+ def test_sizeof
+ assert_equal(config_value("SIZEOF_INT").to_i, mkmf {try_constant("sizeof(int)")}, MKMFLOG)
+ assert_equal(config_value("SIZEOF_LONG").to_i, mkmf {try_constant("sizeof(long)")}, MKMFLOG)
+ assert_equal(config_value("SIZEOF_VOIDP").to_i, mkmf {try_constant("sizeof(void*)")}, MKMFLOG)
+ assert_equal(config_value("SIZEOF_VALUE").to_i, mkmf {try_constant("sizeof(Qnil)")}, MKMFLOG)
+ end
+
+ def test_long
+ sizeof_int = config_value("SIZEOF_INT").to_i
+ sizeof_long = config_value("SIZEOF_LONG").to_i
+ if sizeof_long > sizeof_int
+ type = 'long'
+ else
+ sizeof_long_long = config_value("SIZEOF_LONG_LONG").to_i
+ return if !sizeof_long_long or sizeof_long_long <= sizeof_int
+ type = 'LONG_LONG'
+ end
+
+ decl = "#define CONFTEST_VALUE (unsigned #{type})(((unsigned #{type})1)<<(CHAR_BIT*sizeof(int)))"
+ assert_operator(mkmf {try_constant("CONFTEST_VALUE", [[decl]])}, :>, 0, MKMFLOG)
+ end
+
+ def test_large_unsigned
+ assert_operator(mkmf {try_constant("1U<<(CHAR_BIT*sizeof(int)-1)")}, :>, 0, MKMFLOG)
+ end
+ end
+end
diff --git a/test/mkmf/test_convertible.rb b/test/mkmf/test_convertible.rb
index 3ad36b3c6b..eec2d12c66 100644
--- a/test/mkmf/test_convertible.rb
+++ b/test/mkmf/test_convertible.rb
@@ -27,6 +27,8 @@ class TestMkmf
assert_include($defs, "-DNUM2TEST1T=NUM2#{u}#{type.upcase}")
end
end
+ ensure
+ File.unlink("confdefs.h")
end
end
end
diff --git a/test/mkmf/test_framework.rb b/test/mkmf/test_framework.rb
new file mode 100644
index 0000000000..48e8bf7213
--- /dev/null
+++ b/test/mkmf/test_framework.rb
@@ -0,0 +1,46 @@
+require_relative 'base'
+
+class TestMkmf
+ class TestHaveFramework < TestMkmf
+ def create_framework(fw, hdrname = "#{fw}.h")
+ Dir.mktmpdir("frameworks") do |dir|
+ fwdir = "#{dir}/#{fw}.framework"
+ hdrdir = "#{fwdir}/Headers"
+ FileUtils.mkdir_p(hdrdir)
+ File.write("#{hdrdir}/#{hdrname}", "")
+ src = "#{fwdir}/main.c"
+ File.write(src, "void #{fw}(void) {}")
+ cmd = LINK_SO.dup
+ RbConfig.expand(cmd, RbConfig::CONFIG.merge("OBJS"=>src))
+ cmd.gsub!("$@", "#{fwdir}/#{fw}")
+ cmd.gsub!(/ -bundle /, ' -dynamiclib ')
+ assert(xsystem(cmd), MKMFLOG)
+ $INCFLAGS << " " << "-F#{dir}".quote
+ yield fw, hdrname
+ end
+ end
+
+ def test_core_foundation_framework
+ assert(have_framework("CoreFoundation"), mkmflog("try as Objective-C"))
+ end
+
+ def test_multi_frameworks
+ assert(have_framework("CoreFoundation"), mkmflog("try as Objective-C"))
+ assert(have_framework("Cocoa"), mkmflog("try as Objective-C"))
+ end
+
+ def test_empty_framework
+ create_framework("MkmfTest") do |fw|
+ assert(have_framework(fw), MKMFLOG)
+ end
+ end
+
+ def test_different_name_header
+ 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)
+ end
+ end
+ end
+end if /darwin/ =~ RUBY_PLATFORM
diff --git a/test/mkmf/test_have_func.rb b/test/mkmf/test_have_func.rb
new file mode 100644
index 0000000000..8049ffba18
--- /dev/null
+++ b/test/mkmf/test_have_func.rb
@@ -0,0 +1,14 @@
+require_relative 'base'
+require 'tempfile'
+
+class TestMkmf
+ class TestHaveFunc < TestMkmf
+ def test_have_func
+ assert_equal(true, have_func("ruby_init"), MKMFLOG)
+ end
+
+ def test_not_have_func
+ assert_equal(false, have_func("no_ruby_init"), MKMFLOG)
+ end
+ end
+end
diff --git a/test/mkmf/test_have_library.rb b/test/mkmf/test_have_library.rb
new file mode 100644
index 0000000000..bf17b85f61
--- /dev/null
+++ b/test/mkmf/test_have_library.rb
@@ -0,0 +1,55 @@
+require_relative 'base'
+require 'tempfile'
+
+class TestMkmf
+ class TestHaveLibrary < TestMkmf
+ LIBRARY_NAME = 'mkmftest'
+ HEADER_NAME = "#{LIBRARY_NAME}.h"
+ FUNC_NAME = 'ruby_mkmftest_foo'
+ ARPREFIX = config_string('LIBRUBY_A') {|lib| lib[/\A\w+/]}
+
+ def create_library(libname = LIBRARY_NAME)
+ lib = "#{ARPREFIX}#{libname}.#{$LIBEXT}"
+ open(HEADER_NAME, "w") do |hdr|
+ hdr.puts "void #{FUNC_NAME}(void);"
+ hdr.puts "void #{FUNC_NAME}_fake(void);"
+ end
+ create_tmpsrc("#include \"#{HEADER_NAME}\"\n""void #{FUNC_NAME}(void) {}")
+ 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|
+ command = "#{ranlib} #{lib}"
+ assert(xsystem(command), "ranlib failed: #{command}")
+ end
+ end
+
+ def assert_have_library(*args)
+ assert_equal(true, have_library(LIBRARY_NAME, *args), MKMFLOG)
+ end
+
+ def assert_not_have_library(*args)
+ assert_equal(false, have_library(LIBRARY_NAME, *args), MKMFLOG)
+ end
+
+ def test_have_library
+ create_library
+ assert_have_library
+ end
+
+ def test_have_library_with_name
+ create_library
+ assert_have_library(FUNC_NAME, HEADER_NAME)
+ end
+
+ def test_not_have_library
+ assert_not_have_library
+ end
+
+ def test_not_have_library_with_name
+ create_library
+ assert_not_have_library("#{FUNC_NAME}_fake", HEADER_NAME)
+ end
+ end
+end
diff --git a/test/mkmf/test_have_macro.rb b/test/mkmf/test_have_macro.rb
new file mode 100644
index 0000000000..43c4029f70
--- /dev/null
+++ b/test/mkmf/test_have_macro.rb
@@ -0,0 +1,35 @@
+require_relative 'base'
+require 'tempfile'
+
+class TestMkmf
+ class TestHaveMacro < TestMkmf
+ MACRO_NAME = "RUBY_MKMFTEST_FOOBAR"
+
+ def test_have_macro_opt
+ assert_equal(true, have_macro(MACRO_NAME, nil, "-D#{MACRO_NAME}"), MKMFLOG)
+ end
+
+ def test_have_macro_header
+ Tempfile.create(%w"test_mkmf .h", ".") do |tmp|
+ tmp.puts("#undef #{MACRO_NAME}")
+ tmp.puts("#define #{MACRO_NAME} 1")
+ tmp.close
+ base = File.basename(tmp.path)
+ assert_equal(true, have_macro(MACRO_NAME, base, "-I."), MKMFLOG)
+ end
+ end
+
+ def test_not_have_macro_opt
+ assert_equal(false, have_macro(MACRO_NAME, nil, "-U#{MACRO_NAME}"), MKMFLOG)
+ end
+
+ def test_not_have_macro_header
+ Tempfile.create(%w"test_mkmf .h", ".") do |tmp|
+ tmp.puts("#undef #{MACRO_NAME}")
+ tmp.close
+ base = File.basename(tmp.path)
+ assert_equal(false, have_macro(MACRO_NAME, base, "-I."), MKMFLOG)
+ end
+ end
+ end
+end
diff --git a/test/mkmf/test_libs.rb b/test/mkmf/test_libs.rb
new file mode 100644
index 0000000000..27674dfd26
--- /dev/null
+++ b/test/mkmf/test_libs.rb
@@ -0,0 +1,86 @@
+require_relative 'base'
+
+class TestMkmf
+ class TestLibs < TestMkmf
+ def test_split_libs
+ assert_equal(%w[-lfoo -lbar], split_libs("-lfoo -lbar"))
+ assert_equal(%w[-ObjC -framework\ Ruby], split_libs("-ObjC -framework Ruby"), 'Bug #6987')
+ end
+
+ def assert_in_order(array, x, y, mesg = nil)
+ mesg = "#{x} must proceed to #{y}#{': ' if mesg}#{mesg}"
+ assert_operator(array.index(x), :<, array.rindex(y), mesg)
+ end
+
+ def test_merge_simple
+ bug = '[ruby-dev:21765]'
+ assert_equal([], merge_libs(%w[]))
+ assert_equal(%w[a b], merge_libs(%w[a], %w[b]))
+ array = merge_libs(%w[a c], %w[b])
+ assert_in_order(array, "a", "c", bug)
+ end
+
+ def test_merge_seq
+ bug = '[ruby-dev:21765]'
+ array = merge_libs(%w[a c d], %w[c b e])
+ assert_in_order(array, "a", "c", bug)
+ assert_in_order(array, "c", "d", bug)
+ assert_in_order(array, "c", "b", bug)
+ assert_in_order(array, "b", "e", bug)
+ end
+
+ def test_merge_seq_pre
+ bug = '[ruby-dev:21765]'
+ array = merge_libs(%w[a c d], %w[b c d e])
+ assert_in_order(array, "a", "c", bug)
+ assert_in_order(array, "c", "d", bug)
+ assert_in_order(array, "b", "c", bug)
+ assert_in_order(array, "d", "e", bug)
+ end
+
+ def test_merge_cyclic
+ bug = '[ruby-dev:21765]'
+ array = merge_libs(%w[a c d], %w[b c b])
+ assert_in_order(array, "a", "c", bug)
+ assert_in_order(array, "c", "d", bug)
+ assert_in_order(array, "b", "c", bug)
+ assert_in_order(array, "c", "b", bug)
+ end
+
+ def test_merge_cyclic_2
+ bug = '[ruby-dev:21765]'
+ array = merge_libs(%w[a c a d], %w[b c b])
+ assert_in_order(array, "a", "c", bug)
+ assert_in_order(array, "c", "a", bug)
+ assert_in_order(array, "c", "d", bug)
+ assert_in_order(array, "a", "d", bug)
+ assert_in_order(array, "b", "c", bug)
+ assert_in_order(array, "c", "b", bug)
+ end
+
+ def test_merge_reversal
+ bug = '[ruby-dev:22440]'
+ array = merge_libs(%w[a b c], %w[c d a])
+ assert_in_order(array, "a", "b" , bug)
+ assert_in_order(array, "c", "d" , bug)
+ ## assume that a and c have no dependency
+ end
+
+ def test_merge_reversal_followed
+ bug7467 = '[ruby-core:50314] [Bug #7467]'
+ array = nil
+ assert_nothing_raised(bug7467) {
+ array = merge_libs(%w[a b c d e f g h], %w[d c d e], [])
+ }
+ assert_in_order(array, "a", "b", bug7467)
+ assert_in_order(array, "b", "c", bug7467)
+ assert_in_order(array, "c", "d", bug7467)
+ assert_in_order(array, "d", "e", bug7467)
+ assert_in_order(array, "e", "f", bug7467)
+ assert_in_order(array, "f", "g", bug7467)
+ assert_in_order(array, "g", "h", bug7467)
+ assert_in_order(array, "d", "c", bug7467)
+ assert_in_order(array, "c", "e", bug7467)
+ end
+ end
+end if RUBY_ENGINE == "ruby"
diff --git a/test/mkmf/test_signedness.rb b/test/mkmf/test_signedness.rb
index ad0495a2b5..8d58073698 100644
--- a/test/mkmf/test_signedness.rb
+++ b/test/mkmf/test_signedness.rb
@@ -22,6 +22,8 @@ class TestMkmf
assert_include($defs, "-DSIGNEDNESS_OF_TEST1_T=#{expect}")
end
end
+ ensure
+ File.unlink("confdefs.h")
end
end
end
diff --git a/test/mkmf/test_sizeof.rb b/test/mkmf/test_sizeof.rb
index 30f6fd5400..c0144226d5 100644
--- a/test/mkmf/test_sizeof.rb
+++ b/test/mkmf/test_sizeof.rb
@@ -40,6 +40,8 @@ class TestMkmf
f.puts "typedef struct {int x, y;} test1_t;"
}
assert_equal(2 * @sizeof_int, mkmf {check_sizeof("test1_t", "confdefs.h")}, MKMFLOG)
+ ensure
+ File.unlink("confdefs.h")
end
end
end
diff --git a/test/net/ftp/test_ftp.rb b/test/net/ftp/test_ftp.rb
new file mode 100644
index 0000000000..f25e10747b
--- /dev/null
+++ b/test/net/ftp/test_ftp.rb
@@ -0,0 +1,813 @@
+require "net/ftp"
+require "test/unit"
+require "ostruct"
+require "stringio"
+
+class FTPTest < Test::Unit::TestCase
+ SERVER_ADDR = "127.0.0.1"
+
+ def setup
+ @thread = nil
+ end
+
+ def teardown
+ if @thread
+ @thread.join
+ end
+ end
+
+ def test_not_connected
+ ftp = Net::FTP.new
+ assert_raise(Net::FTPConnectionError) do
+ ftp.quit
+ end
+ end
+
+ def test_connect_fail
+ server = create_ftp_server { |sock|
+ sock.print("421 Service not available, closing control connection.\r\n")
+ }
+ begin
+ ftp = Net::FTP.new
+ assert_raise(Net::FTPTempError){ ftp.connect(SERVER_ADDR, server.port) }
+ ensure
+ ftp.close if ftp
+ server.close
+ end
+ end
+
+ def test_parse227
+ ftp = Net::FTP.new
+ host, port = ftp.send(:parse227, "227 Entering Passive Mode (192,168,0,1,12,34)")
+ assert_equal("192.168.0.1", host)
+ assert_equal(3106, port)
+ assert_raise(Net::FTPReplyError) do
+ ftp.send(:parse227, "500 Syntax error")
+ end
+ assert_raise(Net::FTPProtoError) do
+ ftp.send(:parse227, "227 Entering Passive Mode")
+ end
+ assert_raise(Net::FTPProtoError) do
+ ftp.send(:parse227, "227 Entering Passive Mode (192,168,0,1,12,34,56)")
+ end
+ assert_raise(Net::FTPProtoError) do
+ ftp.send(:parse227, "227 Entering Passive Mode (192,168,0,1)")
+ end
+ assert_raise(Net::FTPProtoError) do
+ ftp.send(:parse227, "227 ) foo bar (")
+ end
+ end
+
+ def test_parse228
+ ftp = Net::FTP.new
+ host, port = ftp.send(:parse228, "228 Entering Long Passive Mode (4,4,192,168,0,1,2,12,34)")
+ assert_equal("192.168.0.1", host)
+ assert_equal(3106, port)
+ host, port = ftp.send(:parse228, "228 Entering Long Passive Mode (6,16,16,128,0,0,0,0,0,0,0,8,8,0,32,12,65,122,2,12,34)")
+ assert_equal("1080:0000:0000:0000:0008:0800:200c:417a", host)
+ assert_equal(3106, port)
+ assert_raise(Net::FTPReplyError) do
+ ftp.send(:parse228, "500 Syntax error")
+ end
+ assert_raise(Net::FTPProtoError) do
+ ftp.send(:parse228, "228 Entering Passive Mode")
+ end
+ assert_raise(Net::FTPProtoError) do
+ ftp.send(:parse228, "228 Entering Long Passive Mode (6,4,192,168,0,1,2,12,34)")
+ end
+ assert_raise(Net::FTPProtoError) do
+ ftp.send(:parse228, "228 Entering Long Passive Mode (4,4,192,168,0,1,3,12,34,56)")
+ end
+ assert_raise(Net::FTPProtoError) do
+ ftp.send(:parse228, "228 Entering Long Passive Mode (4,16,16,128,0,0,0,0,0,0,0,8,8,0,32,12,65,122,2,12,34)")
+ end
+ assert_raise(Net::FTPProtoError) do
+ ftp.send(:parse228, "228 Entering Long Passive Mode (6,16,16,128,0,0,0,0,0,0,0,8,8,0,32,12,65,122,3,12,34,56)")
+ end
+ assert_raise(Net::FTPProtoError) do
+ ftp.send(:parse228, "228 Entering Long Passive Mode (6,16,16,128,0,0,0,0,0,0,0,8,8,0,32,12,65,122,2,12,34,56)")
+ end
+ assert_raise(Net::FTPProtoError) do
+ ftp.send(:parse227, "227 ) foo bar (")
+ end
+ end
+
+ def test_parse229
+ ftp = Net::FTP.new
+ sock = OpenStruct.new
+ sock.peeraddr = [nil, nil, nil, "1080:0000:0000:0000:0008:0800:200c:417a"]
+ ftp.instance_variable_set(:@sock, sock)
+ host, port = ftp.send(:parse229, "229 Entering Passive Mode (|||3106|)")
+ assert_equal("1080:0000:0000:0000:0008:0800:200c:417a", host)
+ assert_equal(3106, port)
+ host, port = ftp.send(:parse229, "229 Entering Passive Mode (!!!3106!)")
+ assert_equal("1080:0000:0000:0000:0008:0800:200c:417a", host)
+ assert_equal(3106, port)
+ host, port = ftp.send(:parse229, "229 Entering Passive Mode (~~~3106~)")
+ assert_equal("1080:0000:0000:0000:0008:0800:200c:417a", host)
+ assert_equal(3106, port)
+ assert_raise(Net::FTPReplyError) do
+ ftp.send(:parse229, "500 Syntax error")
+ end
+ assert_raise(Net::FTPProtoError) do
+ ftp.send(:parse229, "229 Entering Passive Mode")
+ end
+ assert_raise(Net::FTPProtoError) do
+ ftp.send(:parse229, "229 Entering Passive Mode (|!!3106!)")
+ end
+ assert_raise(Net::FTPProtoError) do
+ ftp.send(:parse229, "229 Entering Passive Mode ( 3106 )")
+ end
+ assert_raise(Net::FTPProtoError) do
+ ftp.send(:parse229, "229 Entering Passive Mode (\x7f\x7f\x7f3106\x7f)")
+ end
+ assert_raise(Net::FTPProtoError) do
+ ftp.send(:parse229, "229 ) foo bar (")
+ end
+ end
+
+ def test_parse_pasv_port
+ ftp = Net::FTP.new
+ assert_equal(12, ftp.send(:parse_pasv_port, "12"))
+ assert_equal(3106, ftp.send(:parse_pasv_port, "12,34"))
+ assert_equal(795192, ftp.send(:parse_pasv_port, "12,34,56"))
+ assert_equal(203569230, ftp.send(:parse_pasv_port, "12,34,56,78"))
+ end
+
+ def test_login
+ commands = []
+ server = create_ftp_server { |sock|
+ sock.print("220 (test_ftp).\r\n")
+ commands.push(sock.gets)
+ sock.print("331 Please specify the password.\r\n")
+ commands.push(sock.gets)
+ sock.print("230 Login successful.\r\n")
+ commands.push(sock.gets)
+ sock.print("200 Switching to Binary mode.\r\n")
+ }
+ begin
+ begin
+ ftp = Net::FTP.new
+ ftp.connect(SERVER_ADDR, server.port)
+ ftp.login
+ assert_match(/\AUSER /, commands.shift)
+ assert_match(/\APASS /, commands.shift)
+ assert_equal("TYPE I\r\n", commands.shift)
+ assert_equal(nil, commands.shift)
+ ensure
+ ftp.close if ftp
+ end
+ ensure
+ server.close
+ end
+ end
+
+ def test_login_fail1
+ commands = []
+ server = create_ftp_server { |sock|
+ sock.print("220 (test_ftp).\r\n")
+ commands.push(sock.gets)
+ sock.print("502 Command not implemented.\r\n")
+ }
+ begin
+ begin
+ ftp = Net::FTP.new
+ ftp.connect(SERVER_ADDR, server.port)
+ assert_raise(Net::FTPPermError){ ftp.login }
+ ensure
+ ftp.close if ftp
+ end
+ ensure
+ server.close
+ end
+ end
+
+ def test_login_fail2
+ commands = []
+ server = create_ftp_server { |sock|
+ sock.print("220 (test_ftp).\r\n")
+ commands.push(sock.gets)
+ sock.print("331 Please specify the password.\r\n")
+ commands.push(sock.gets)
+ sock.print("530 Not logged in.\r\n")
+ }
+ begin
+ begin
+ ftp = Net::FTP.new
+ ftp.connect(SERVER_ADDR, server.port)
+ assert_raise(Net::FTPPermError){ ftp.login }
+ ensure
+ ftp.close if ftp
+ end
+ ensure
+ server.close
+ end
+ end
+
+ # TODO: How can we test open_timeout? sleep before accept cannot delay
+ # connections.
+ def _test_open_timeout_exceeded
+ commands = []
+ server = create_ftp_server(0.2) { |sock|
+ sock.print("220 (test_ftp).\r\n")
+ commands.push(sock.gets)
+ sock.print("331 Please specify the password.\r\n")
+ commands.push(sock.gets)
+ sock.print("230 Login successful.\r\n")
+ commands.push(sock.gets)
+ sock.print("200 Switching to Binary mode.\r\n")
+ }
+ begin
+ begin
+ ftp = Net::FTP.new
+ ftp.open_timeout = 0.1
+ ftp.connect(SERVER_ADDR, server.port)
+ assert_raise(Net::OpenTimeout) do
+ ftp.login
+ end
+ assert_match(/\AUSER /, commands.shift)
+ assert_match(/\APASS /, commands.shift)
+ assert_equal(nil, commands.shift)
+ ensure
+ ftp.close if ftp
+ end
+ ensure
+ server.close
+ end
+ end
+
+ def test_read_timeout_exceeded
+ commands = []
+ server = create_ftp_server { |sock|
+ sock.print("220 (test_ftp).\r\n")
+ commands.push(sock.gets)
+ sleep(0.1)
+ sock.print("331 Please specify the password.\r\n")
+ commands.push(sock.gets)
+ sleep(0.3)
+ sock.print("230 Login successful.\r\n")
+ commands.push(sock.gets)
+ sleep(0.1)
+ sock.print("200 Switching to Binary mode.\r\n")
+ }
+ begin
+ begin
+ ftp = Net::FTP.new
+ ftp.read_timeout = 0.2
+ ftp.connect(SERVER_ADDR, server.port)
+ assert_raise(Net::ReadTimeout) do
+ ftp.login
+ end
+ assert_match(/\AUSER /, commands.shift)
+ assert_match(/\APASS /, commands.shift)
+ assert_equal(nil, commands.shift)
+ ensure
+ ftp.close if ftp
+ end
+ ensure
+ server.close
+ end
+ end
+
+ def test_read_timeout_not_exceeded
+ commands = []
+ server = create_ftp_server { |sock|
+ sock.print("220 (test_ftp).\r\n")
+ commands.push(sock.gets)
+ sleep(0.1)
+ sock.print("331 Please specify the password.\r\n")
+ commands.push(sock.gets)
+ sleep(0.1)
+ sock.print("230 Login successful.\r\n")
+ commands.push(sock.gets)
+ sleep(0.1)
+ sock.print("200 Switching to Binary mode.\r\n")
+ }
+ begin
+ begin
+ ftp = Net::FTP.new
+ ftp.read_timeout = 0.2
+ ftp.connect(SERVER_ADDR, server.port)
+ ftp.login
+ assert_match(/\AUSER /, commands.shift)
+ assert_match(/\APASS /, commands.shift)
+ assert_equal("TYPE I\r\n", commands.shift)
+ assert_equal(nil, commands.shift)
+ ensure
+ ftp.close
+ assert_equal(0.2, ftp.read_timeout)
+ end
+ ensure
+ server.close
+ end
+ end
+
+ def test_list_read_timeout_exceeded
+ 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)
+ sock.print("331 Please specify the password.\r\n")
+ commands.push(sock.gets)
+ sock.print("230 Login successful.\r\n")
+ commands.push(sock.gets)
+ sock.print("200 Switching to Binary mode.\r\n")
+ commands.push(sock.gets)
+ 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("150 Here comes the directory listing.\r\n")
+ begin
+ conn = TCPSocket.new(host, port)
+ list_lines.each_with_index do |l, i|
+ if i == 1
+ sleep(0.5)
+ else
+ sleep(0.1)
+ end
+ conn.print(l, "\r\n")
+ end
+ rescue Errno::EPIPE
+ ensure
+ assert_nil($!)
+ conn.close
+ end
+ sock.print("226 Directory send OK.\r\n")
+ }
+ begin
+ begin
+ ftp = Net::FTP.new
+ ftp.read_timeout = 0.2
+ ftp.connect(SERVER_ADDR, server.port)
+ ftp.login
+ assert_match(/\AUSER /, commands.shift)
+ assert_match(/\APASS /, commands.shift)
+ assert_equal("TYPE I\r\n", commands.shift)
+ assert_raise(Net::ReadTimeout) do
+ ftp.list
+ end
+ assert_equal("TYPE A\r\n", commands.shift)
+ assert_match(/\APORT /, commands.shift)
+ assert_equal("LIST\r\n", commands.shift)
+ assert_equal(nil, commands.shift)
+ ensure
+ ftp.close if ftp
+ end
+ ensure
+ server.close
+ end
+ end
+
+ def test_list_read_timeout_not_exceeded
+ 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)
+ sock.print("331 Please specify the password.\r\n")
+ commands.push(sock.gets)
+ sock.print("230 Login successful.\r\n")
+ commands.push(sock.gets)
+ sock.print("200 Switching to Binary mode.\r\n")
+ commands.push(sock.gets)
+ 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("150 Here comes the directory listing.\r\n")
+ conn = TCPSocket.new(host, port)
+ list_lines.each do |l|
+ sleep(0.1)
+ conn.print(l, "\r\n")
+ end
+ conn.close
+ sock.print("226 Directory send OK.\r\n")
+ commands.push(sock.gets)
+ sock.print("200 Switching to Binary mode.\r\n")
+ }
+ begin
+ begin
+ ftp = Net::FTP.new
+ ftp.read_timeout = 0.2
+ ftp.connect(SERVER_ADDR, server.port)
+ ftp.login
+ assert_match(/\AUSER /, commands.shift)
+ assert_match(/\APASS /, commands.shift)
+ assert_equal("TYPE I\r\n", commands.shift)
+ assert_equal(list_lines, ftp.list)
+ assert_equal("TYPE A\r\n", commands.shift)
+ assert_match(/\APORT /, commands.shift)
+ assert_equal("LIST\r\n", commands.shift)
+ assert_equal("TYPE I\r\n", commands.shift)
+ assert_equal(nil, commands.shift)
+ ensure
+ ftp.close if ftp
+ end
+ ensure
+ server.close
+ end
+ end
+
+ 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)
+ sock.print("331 Please specify the password.\r\n")
+ commands.push(sock.gets)
+ sock.print("230 Login successful.\r\n")
+ commands.push(sock.gets)
+ sock.print("200 Switching to Binary mode.\r\n")
+ commands.push(sock.gets)
+ 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")
+ commands.push(sock.gets)
+ sock.print("200 Switching to Binary mode.\r\n")
+ }
+ begin
+ begin
+ ftp = Net::FTP.new
+ ftp.read_timeout = 0.2
+ ftp.connect(SERVER_ADDR, server.port)
+ ftp.login
+ assert_match(/\AUSER /, commands.shift)
+ assert_match(/\APASS /, commands.shift)
+ assert_equal("TYPE I\r\n", commands.shift)
+ assert_raise(Net::FTPPermError){ ftp.list }
+ assert_equal("TYPE A\r\n", commands.shift)
+ assert_match(/\APORT /, commands.shift)
+ assert_equal("LIST\r\n", commands.shift)
+ assert_equal("TYPE I\r\n", commands.shift)
+ assert_equal(nil, commands.shift)
+ ensure
+ ftp.close if ftp
+ end
+ ensure
+ server.close
+ end
+ end
+
+ def test_retrbinary_read_timeout_exceeded
+ 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)
+ sock.print("331 Please specify the password.\r\n")
+ commands.push(sock.gets)
+ sock.print("230 Login successful.\r\n")
+ commands.push(sock.gets)
+ 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("150 Opening BINARY mode data connection for foo (#{binary_data.size} bytes)\r\n")
+ conn = TCPSocket.new(host, port)
+ sleep(0.1)
+ conn.print(binary_data[0,1024])
+ sleep(0.5)
+ conn.print(binary_data[1024, 1024]) rescue nil # may raise EPIPE or something
+ conn.close
+ sock.print("226 Transfer complete.\r\n")
+ }
+ begin
+ begin
+ ftp = Net::FTP.new
+ ftp.read_timeout = 0.2
+ ftp.connect(SERVER_ADDR, server.port)
+ ftp.login
+ assert_match(/\AUSER /, commands.shift)
+ assert_match(/\APASS /, commands.shift)
+ assert_equal("TYPE I\r\n", commands.shift)
+ buf = ""
+ assert_raise(Net::ReadTimeout) do
+ ftp.retrbinary("RETR foo", 1024) do |s|
+ buf << s
+ end
+ end
+ assert_equal(1024, buf.bytesize)
+ assert_equal(binary_data[0, 1024], buf)
+ assert_match(/\APORT /, commands.shift)
+ assert_equal("RETR foo\r\n", commands.shift)
+ assert_equal(nil, commands.shift)
+ ensure
+ ftp.close unless ftp.closed?
+ end
+ ensure
+ server.close
+ end
+ end
+
+ def test_retrbinary_read_timeout_not_exceeded
+ 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)
+ sock.print("331 Please specify the password.\r\n")
+ commands.push(sock.gets)
+ sock.print("230 Login successful.\r\n")
+ commands.push(sock.gets)
+ 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("150 Opening BINARY mode data connection for foo (#{binary_data.size} bytes)\r\n")
+ conn = TCPSocket.new(host, port)
+ binary_data.scan(/.{1,1024}/nm) do |s|
+ sleep(0.1)
+ conn.print(s)
+ end
+ conn.shutdown(Socket::SHUT_WR)
+ conn.read
+ conn.close
+ sock.print("226 Transfer complete.\r\n")
+ }
+ begin
+ begin
+ ftp = Net::FTP.new
+ ftp.read_timeout = 0.2
+ ftp.connect(SERVER_ADDR, server.port)
+ ftp.login
+ assert_match(/\AUSER /, commands.shift)
+ assert_match(/\APASS /, commands.shift)
+ assert_equal("TYPE I\r\n", commands.shift)
+ buf = ""
+ ftp.retrbinary("RETR foo", 1024) do |s|
+ buf << s
+ end
+ assert_equal(binary_data.bytesize, buf.bytesize)
+ assert_equal(binary_data, buf)
+ assert_match(/\APORT /, commands.shift)
+ assert_equal("RETR foo\r\n", commands.shift)
+ assert_equal(nil, commands.shift)
+ ensure
+ ftp.close if ftp
+ end
+ ensure
+ server.close
+ end
+ end
+
+ 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)
+ sock.print("331 Please specify the password.\r\n")
+ commands.push(sock.gets)
+ sock.print("230 Login successful.\r\n")
+ commands.push(sock.gets)
+ 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")
+ }
+ begin
+ begin
+ ftp = Net::FTP.new
+ ftp.read_timeout = 0.2
+ ftp.connect(SERVER_ADDR, server.port)
+ ftp.login
+ assert_match(/\AUSER /, commands.shift)
+ assert_match(/\APASS /, commands.shift)
+ assert_equal("TYPE I\r\n", commands.shift)
+ assert_raise(Net::FTPPermError){ ftp.retrbinary("RETR foo", 1024) }
+ assert_match(/\APORT /, commands.shift)
+ assert_equal("RETR foo\r\n", commands.shift)
+ assert_equal(nil, commands.shift)
+ ensure
+ ftp.close if ftp
+ end
+ ensure
+ server.close
+ end
+ end
+
+ def test_storbinary
+ 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)
+ sock.print("331 Please specify the password.\r\n")
+ commands.push(sock.gets)
+ sock.print("230 Login successful.\r\n")
+ commands.push(sock.gets)
+ 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("150 Opening BINARY mode data connection for foo\r\n")
+ conn = TCPSocket.new(host, port)
+ stored_data = conn.read
+ conn.close
+ sock.print("226 Transfer complete.\r\n")
+ }
+ begin
+ begin
+ ftp = Net::FTP.new
+ ftp.read_timeout = 0.2
+ ftp.connect(SERVER_ADDR, server.port)
+ ftp.login
+ assert_match(/\AUSER /, commands.shift)
+ assert_match(/\APASS /, commands.shift)
+ assert_equal("TYPE I\r\n", commands.shift)
+ ftp.storbinary("STOR foo", StringIO.new(binary_data), 1024)
+ assert_equal(binary_data, stored_data)
+ assert_match(/\APORT /, commands.shift)
+ assert_equal("STOR foo\r\n", commands.shift)
+ assert_equal(nil, commands.shift)
+ ensure
+ ftp.close if ftp
+ end
+ ensure
+ server.close
+ end
+ end
+
+ 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)
+ sock.print("331 Please specify the password.\r\n")
+ commands.push(sock.gets)
+ sock.print("230 Login successful.\r\n")
+ commands.push(sock.gets)
+ 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")
+ }
+ begin
+ begin
+ ftp = Net::FTP.new
+ ftp.read_timeout = 0.2
+ ftp.connect(SERVER_ADDR, server.port)
+ ftp.login
+ assert_match(/\AUSER /, commands.shift)
+ assert_match(/\APASS /, commands.shift)
+ assert_equal("TYPE I\r\n", commands.shift)
+ assert_raise(Net::FTPTempError){ ftp.storbinary("STOR foo", StringIO.new(binary_data), 1024) }
+ assert_match(/\APORT /, commands.shift)
+ assert_equal("STOR foo\r\n", commands.shift)
+ assert_equal(nil, commands.shift)
+ ensure
+ ftp.close if ftp
+ end
+ ensure
+ server.close
+ end
+ end
+
+ def test_abort
+ commands = []
+ server = create_ftp_server { |sock|
+ sock.print("220 (test_ftp).\r\n")
+ commands.push(sock.gets)
+ sock.print("331 Please specify the password.\r\n")
+ commands.push(sock.gets)
+ sock.print("230 Login successful.\r\n")
+ commands.push(sock.gets)
+ sock.print("200 Switching to Binary mode.\r\n")
+ commands.push(sock.recv(1024))
+ sock.print("225 No transfer to ABOR.\r\n")
+ }
+ begin
+ begin
+ ftp = Net::FTP.new
+ #ftp.read_timeout = 0.2
+ ftp.connect(SERVER_ADDR, server.port)
+ ftp.login
+ assert_match(/\AUSER /, commands.shift)
+ assert_match(/\APASS /, commands.shift)
+ assert_equal("TYPE I\r\n", commands.shift)
+ ftp.abort
+ assert_equal("ABOR\r", commands.shift)
+ assert_equal(nil, commands.shift)
+ ensure
+ ftp.close if ftp
+ end
+ ensure
+ server.close
+ end
+ end
+
+ def test_status
+ commands = []
+ server = create_ftp_server { |sock|
+ sock.print("220 (test_ftp).\r\n")
+ commands.push(sock.gets)
+ sock.print("331 Please specify the password.\r\n")
+ commands.push(sock.gets)
+ sock.print("230 Login successful.\r\n")
+ commands.push(sock.gets)
+ sock.print("200 Switching to Binary mode.\r\n")
+ commands.push(sock.recv(1024))
+ sock.print("211 End of status\r\n")
+ }
+ begin
+ begin
+ ftp = Net::FTP.new
+ ftp.read_timeout = 0.2
+ ftp.connect(SERVER_ADDR, server.port)
+ ftp.login
+ assert_match(/\AUSER /, commands.shift)
+ assert_match(/\APASS /, commands.shift)
+ assert_equal("TYPE I\r\n", commands.shift)
+ ftp.status
+ assert_equal("STAT\r", commands.shift)
+ assert_equal(nil, commands.shift)
+ ensure
+ ftp.close if ftp
+ end
+ ensure
+ server.close
+ end
+ end
+
+ private
+
+
+ def create_ftp_server(sleep_time = nil)
+ server = TCPServer.new(SERVER_ADDR, 0)
+ @thread = Thread.start do
+ begin
+ if sleep_time
+ sleep(sleep_time)
+ end
+ sock = server.accept
+ begin
+ yield(sock)
+ sock.shutdown(Socket::SHUT_WR)
+ sock.read_timeout = 1
+ sock.read unless sock.eof?
+ ensure
+ sock.close
+ end
+ rescue
+ end
+ end
+ def server.port
+ addr[1]
+ end
+ return server
+ end
+end
diff --git a/test/net/http/test_http.rb b/test/net/http/test_http.rb
index 2d8166883e..6c847dba7e 100644
--- a/test/net/http/test_http.rb
+++ b/test/net/http/test_http.rb
@@ -1,9 +1,195 @@
-# $Id$
-
+# coding: US-ASCII
require 'test/unit'
require 'net/http'
require 'stringio'
require_relative 'utils'
+require_relative '../../ruby/envutil'
+
+class TestNetHTTP < Test::Unit::TestCase
+
+ def test_class_Proxy
+ no_proxy_class = Net::HTTP.Proxy nil
+
+ assert_equal Net::HTTP, no_proxy_class
+
+ proxy_class = Net::HTTP.Proxy 'proxy.example', 8000, 'user', 'pass'
+
+ refute_equal Net::HTTP, proxy_class
+
+ assert_operator proxy_class, :<, Net::HTTP
+
+ assert_equal 'proxy.example', proxy_class.proxy_address
+ assert_equal 8000, proxy_class.proxy_port
+ assert_equal 'user', proxy_class.proxy_user
+ assert_equal 'pass', proxy_class.proxy_pass
+
+ http = proxy_class.new 'example'
+
+ refute http.proxy_from_env?
+
+
+ proxy_class = Net::HTTP.Proxy 'proxy.example'
+ assert_equal 'proxy.example', proxy_class.proxy_address
+ assert_equal 80, proxy_class.proxy_port
+ end
+
+ def test_class_Proxy_from_ENV
+ clean_http_proxy_env do
+ ENV['http_proxy'] = 'http://proxy.example:8000'
+
+ # These are ignored on purpose. See Bug 4388 and Feature 6546
+ ENV['http_proxy_user'] = 'user'
+ ENV['http_proxy_pass'] = 'pass'
+
+ proxy_class = Net::HTTP.Proxy :ENV
+
+ refute_equal Net::HTTP, proxy_class
+
+ assert_operator proxy_class, :<, Net::HTTP
+
+ assert_nil proxy_class.proxy_address
+ assert_nil proxy_class.proxy_user
+ assert_nil proxy_class.proxy_pass
+
+ refute_equal 8000, proxy_class.proxy_port
+
+ http = proxy_class.new 'example'
+
+ assert http.proxy_from_env?
+ end
+ end
+
+ def test_edit_path
+ http = Net::HTTP.new 'example', nil, nil
+
+ edited = http.send :edit_path, '/path'
+
+ assert_equal '/path', edited
+
+ http.use_ssl = true
+
+ edited = http.send :edit_path, '/path'
+
+ assert_equal '/path', edited
+ end
+
+ def test_edit_path_proxy
+ http = Net::HTTP.new 'example', nil, 'proxy.example'
+
+ edited = http.send :edit_path, '/path'
+
+ assert_equal 'http://example/path', edited
+
+ http.use_ssl = true
+
+ edited = http.send :edit_path, '/path'
+
+ assert_equal '/path', edited
+ end
+
+ def test_proxy_address
+ clean_http_proxy_env do
+ http = Net::HTTP.new 'example', nil, 'proxy.example'
+ assert_equal 'proxy.example', http.proxy_address
+
+ http = Net::HTTP.new 'example', nil
+ assert_equal nil, http.proxy_address
+ end
+ end
+
+ def test_proxy_address_ENV
+ clean_http_proxy_env do
+ ENV['http_proxy'] = 'http://proxy.example:8000'
+
+ http = Net::HTTP.new 'example'
+
+ assert_equal 'proxy.example', http.proxy_address
+ end
+ end
+
+ def test_proxy_eh_no_proxy
+ clean_http_proxy_env do
+ assert_equal false, Net::HTTP.new('example', nil, nil).proxy?
+ end
+ end
+
+ def test_proxy_eh_ENV
+ clean_http_proxy_env do
+ ENV['http_proxy'] = 'http://proxy.example:8000'
+
+ http = Net::HTTP.new 'example'
+
+ assert_equal true, http.proxy?
+ end
+ end
+
+ def test_proxy_eh_ENV_none_set
+ clean_http_proxy_env do
+ assert_equal false, Net::HTTP.new('example').proxy?
+ end
+ end
+
+ def test_proxy_eh_ENV_no_proxy
+ clean_http_proxy_env do
+ ENV['http_proxy'] = 'http://proxy.example:8000'
+ ENV['no_proxy'] = 'example'
+
+ assert_equal false, Net::HTTP.new('example').proxy?
+ end
+ end
+
+ def test_proxy_port
+ clean_http_proxy_env do
+ http = Net::HTTP.new 'exmaple', nil, 'proxy.example'
+ assert_equal 'proxy.example', http.proxy_address
+ assert_equal 80, http.proxy_port
+ http = Net::HTTP.new 'exmaple', nil, 'proxy.example', 8000
+ assert_equal 8000, http.proxy_port
+ http = Net::HTTP.new 'exmaple', nil
+ assert_equal nil, http.proxy_port
+ end
+ end
+
+ def test_proxy_port_ENV
+ clean_http_proxy_env do
+ ENV['http_proxy'] = 'http://proxy.example:8000'
+
+ http = Net::HTTP.new 'example'
+
+ assert_equal 8000, http.proxy_port
+ end
+ end
+
+ def test_newobj
+ clean_http_proxy_env do
+ ENV['http_proxy'] = 'http://proxy.example:8000'
+
+ http = Net::HTTP.newobj 'example'
+
+ assert_equal false, http.proxy?
+ end
+ end
+
+ def clean_http_proxy_env
+ orig = {
+ 'http_proxy' => ENV['http_proxy'],
+ 'http_proxy_user' => ENV['http_proxy_user'],
+ 'http_proxy_pass' => ENV['http_proxy_pass'],
+ 'no_proxy' => ENV['no_proxy'],
+ }
+
+ orig.each_key do |key|
+ ENV.delete key
+ end
+
+ yield
+ ensure
+ orig.each do |key, value|
+ ENV[key] = value
+ end
+ end
+
+end
module TestNetHTTP_version_1_1_methods
@@ -44,8 +230,10 @@ module TestNetHTTP_version_1_1_methods
assert_equal $test_net_http_data, res.body
assert_nothing_raised {
- res, body = http.get('/', { 'User-Agent' => 'test' }.freeze)
+ http.get('/', { 'User-Agent' => 'test' }.freeze)
}
+
+ assert res.decode_content, '[Bug #7924]' if Net::HTTP::HAVE_ZLIB
end
def _test_get__iter(http)
@@ -106,8 +294,11 @@ module TestNetHTTP_version_1_1_methods
def test_get2
start {|http|
http.get2('/') {|res|
- assert_kind_of Net::HTTPResponse, res
- assert_kind_of Net::HTTPResponse, res.header
+ EnvUtil.suppress_warning do
+ assert_kind_of Net::HTTPResponse, res
+ assert_kind_of Net::HTTPResponse, res.header
+ end
+
unless self.is_a?(TestNetHTTP_v1_2_chunked)
assert_not_nil res['content-length']
end
@@ -125,14 +316,16 @@ module TestNetHTTP_version_1_1_methods
start {|http|
_test_post__base http
_test_post__file http
+ _test_post__no_data http
}
end
def _test_post__base(http)
uheader = {}
uheader['Accept'] = 'application/octet-stream'
+ uheader['Content-Type'] = 'application/x-www-form-urlencoded'
data = 'post data'
- res = http.post('/', data)
+ res = http.post('/', data, uheader)
assert_kind_of Net::HTTPResponse, res
assert_kind_of String, res.body
assert_equal data, res.body
@@ -142,10 +335,20 @@ module TestNetHTTP_version_1_1_methods
def _test_post__file(http)
data = 'post data'
f = StringIO.new
- http.post('/', data, nil, f)
+ http.post('/', data, {'content-type' => 'application/x-www-form-urlencoded'}, f)
assert_equal data, f.string
end
+ def _test_post__no_data(http)
+ unless self.is_a?(TestNetHTTP_v1_2_chunked)
+ EnvUtil.suppress_warning do
+ data = nil
+ res = http.post('/', data)
+ assert_not_equal '411', res.code
+ end
+ end
+ end
+
def test_s_post_form
url = "http://#{config('host')}:#{config('port')}/"
res = Net::HTTP.post_form(
@@ -182,8 +385,9 @@ module TestNetHTTP_version_1_1_methods
def _test_patch__base(http)
uheader = {}
uheader['Accept'] = 'application/octet-stream'
+ uheader['Content-Type'] = 'application/x-www-form-urlencoded'
data = 'patch data'
- res = http.patch('/', data)
+ res = http.patch('/', data, uheader)
assert_kind_of Net::HTTPResponse, res
assert_kind_of String, res.body
assert_equal data, res.body
@@ -193,16 +397,16 @@ 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]"
- # listen for connections... but deliberately do not complete SSL handshake
- TCPServer.open(0) {|server|
+ # 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 = 1
- conn.open_timeout = 1
+ conn.read_timeout = 0.01
+ conn.open_timeout = 0.1
th = Thread.new do
- assert_raise(Timeout::Error) {
+ assert_raise(Net::ReadTimeout) {
conn.get('/')
}
end
@@ -217,11 +421,14 @@ module TestNetHTTP_version_1_2_methods
def test_request
start {|http|
_test_request__GET http
+ _test_request__accept_encoding http
_test_request__file http
# _test_request__range http # WEBrick does not support Range: header.
_test_request__HEAD http
_test_request__POST http
_test_request__stream_body http
+ _test_request__uri http
+ _test_request__uri_host http
}
end
@@ -236,6 +443,24 @@ module TestNetHTTP_version_1_2_methods
end
assert_equal $test_net_http_data.size, res.body.size
assert_equal $test_net_http_data, res.body
+
+ assert res.decode_content, 'Bug #7831' if Net::HTTP::HAVE_ZLIB
+ }
+ end
+
+ def _test_request__accept_encoding(http)
+ req = Net::HTTP::Get.new('/', 'accept-encoding' => 'deflate')
+ http.request(req) {|res|
+ assert_kind_of Net::HTTPResponse, res
+ assert_kind_of String, res.body
+ unless self.is_a?(TestNetHTTP_v1_2_chunked)
+ assert_not_nil res['content-length']
+ assert_equal $test_net_http_data.size, res['content-length'].to_i
+ end
+ assert_equal $test_net_http_data.size, res.body.size
+ assert_equal $test_net_http_data, res.body
+
+ refute res.decode_content, 'Bug #7831' if Net::HTTP::HAVE_ZLIB
}
end
@@ -277,6 +502,7 @@ module TestNetHTTP_version_1_2_methods
data = 'post data'
req = Net::HTTP::Post.new('/')
req['Accept'] = $test_net_http_data_type
+ req['Content-Type'] = 'application/x-www-form-urlencoded'
http.request(req, data) {|res|
assert_kind_of Net::HTTPResponse, res
unless self.is_a?(TestNetHTTP_v1_2_chunked)
@@ -291,6 +517,7 @@ module TestNetHTTP_version_1_2_methods
req = Net::HTTP::Post.new('/')
data = $test_net_http_data
req.content_length = data.size
+ req['Content-Type'] = 'application/x-www-form-urlencoded'
req.body_stream = StringIO.new(data)
res = http.request(req)
assert_kind_of Net::HTTPResponse, res
@@ -299,6 +526,51 @@ module TestNetHTTP_version_1_2_methods
assert_equal data, res.body
end
+ def _test_request__path(http)
+ uri = URI 'https://example/'
+ req = Net::HTTP::Get.new('/')
+
+ res = http.request(req)
+
+ assert_kind_of URI::Generic, req.uri
+
+ refute_equal uri, req.uri
+
+ assert_equal uri, res.uri
+
+ refute_same uri, req.uri
+ refute_same req.uri, res.uri
+ end
+
+ def _test_request__uri(http)
+ uri = URI 'https://example/'
+ req = Net::HTTP::Get.new(uri)
+
+ res = http.request(req)
+
+ assert_kind_of URI::Generic, req.uri
+
+ refute_equal uri, req.uri
+
+ assert_equal req.uri, res.uri
+
+ refute_same uri, req.uri
+ refute_same req.uri, res.uri
+ end
+
+ def _test_request__uri_host(http)
+ uri = URI 'http://example/'
+
+ req = Net::HTTP::Get.new(uri)
+ req['host'] = 'other.example'
+
+ res = http.request(req)
+
+ assert_kind_of URI::Generic, req.uri
+
+ assert_equal URI("http://example:#{http.port}"), res.uri
+ end
+
def test_send_request
start {|http|
_test_send_request__GET http
@@ -318,7 +590,7 @@ module TestNetHTTP_version_1_2_methods
def _test_send_request__POST(http)
data = 'aaabbb cc ddddddddddd lkjoiu4j3qlkuoa'
- res = http.send_request('POST', '/', data)
+ res = http.send_request('POST', '/', data, 'content-type' => 'application/x-www-form-urlencoded')
assert_kind_of Net::HTTPResponse, res
assert_kind_of String, res.body
assert_equal data.size, res.body.size
@@ -327,15 +599,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"
@@ -355,10 +627,11 @@ 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)
+ }
}
end
@@ -384,12 +657,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
@@ -397,28 +670,29 @@ 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)
+ }
}
end
end
@@ -426,7 +700,6 @@ end
class TestNetHTTP_v1_2 < Test::Unit::TestCase
CONFIG = {
'host' => '127.0.0.1',
- 'port' => 0,
'proxy_host' => nil,
'proxy_port' => nil,
}
@@ -444,7 +717,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,
@@ -460,7 +732,6 @@ class TestNetHTTP_v1_2_chunked < Test::Unit::TestCase
end
def test_chunked_break
- i = 0
assert_nothing_raised("[ruby-core:29229]") {
start {|http|
http.request_get('/') {|res|
@@ -476,7 +747,6 @@ end
class TestNetHTTPContinue < Test::Unit::TestCase
CONFIG = {
'host' => '127.0.0.1',
- 'port' => 0,
'proxy_host' => nil,
'proxy_port' => nil,
'chunked' => true,
@@ -498,8 +768,9 @@ class TestNetHTTPContinue < Test::Unit::TestCase
res.body = req.query['body']
}
start {|http|
+ uheader = {'content-type' => 'application/x-www-form-urlencoded', 'expect' => '100-continue'}
http.continue_timeout = 0.2
- http.request_post('/continue', 'body=BODY', 'expect' => '100-continue') {|res|
+ http.request_post('/continue', 'body=BODY', uheader) {|res|
assert_equal('BODY', res.read_body)
}
}
@@ -514,8 +785,9 @@ class TestNetHTTPContinue < Test::Unit::TestCase
res.body = req.query['body']
}
start {|http|
+ uheader = {'content-type' => 'application/x-www-form-urlencoded', 'expect' => '100-continue'}
http.continue_timeout = 0
- http.request_post('/continue', 'body=BODY', 'expect' => '100-continue') {|res|
+ http.request_post('/continue', 'body=BODY', uheader) {|res|
assert_equal('BODY', res.read_body)
}
}
@@ -529,8 +801,9 @@ class TestNetHTTPContinue < Test::Unit::TestCase
res.body = req.query['body']
}
start {|http|
+ uheader = {'content-type' => 'application/x-www-form-urlencoded', 'expect' => '100-continue'}
http.continue_timeout = 0
- http.request_post('/continue', 'body=ERROR', 'expect' => '100-continue') {|res|
+ http.request_post('/continue', 'body=ERROR', uheader) {|res|
assert_equal('ERROR', res.read_body)
}
}
@@ -544,8 +817,9 @@ class TestNetHTTPContinue < Test::Unit::TestCase
res.body = req.query['body']
}
start {|http|
+ uheader = {'content-type' => 'application/x-www-form-urlencoded', 'expect' => '100-continue'}
http.continue_timeout = 0.5
- http.request_post('/continue', 'body=ERROR', 'expect' => '100-continue') {|res|
+ http.request_post('/continue', 'body=ERROR', uheader) {|res|
assert_equal('ERROR', res.read_body)
}
}
@@ -553,3 +827,92 @@ class TestNetHTTPContinue < Test::Unit::TestCase
assert_not_match(/HTTP\/1.1 100 continue/, @debug.string)
end
end
+
+class TestNetHTTPKeepAlive < Test::Unit::TestCase
+ CONFIG = {
+ 'host' => '127.0.0.1',
+ 'proxy_host' => nil,
+ 'proxy_port' => nil,
+ 'RequestTimeout' => 1,
+ }
+
+ include TestNetHTTPUtils
+
+ def test_keep_alive_get_auto_reconnect
+ start {|http|
+ res = http.get('/')
+ http.keep_alive_timeout = 1
+ assert_kind_of Net::HTTPResponse, res
+ assert_kind_of String, res.body
+ sleep 1.5
+ assert_nothing_raised {
+ res = http.get('/')
+ }
+ assert_kind_of Net::HTTPResponse, res
+ assert_kind_of String, res.body
+ }
+ end
+
+ def test_keep_alive_get_auto_retry
+ start {|http|
+ res = http.get('/')
+ http.keep_alive_timeout = 5
+ assert_kind_of Net::HTTPResponse, res
+ assert_kind_of String, res.body
+ sleep 1.5
+ res = http.get('/')
+ assert_kind_of Net::HTTPResponse, res
+ assert_kind_of String, res.body
+ }
+ end
+
+ def test_keep_alive_server_close
+ def @server.run(sock)
+ sock.close
+ end
+
+ start {|http|
+ assert_raises(EOFError, Errno::ECONNRESET, IOError) {
+ http.get('/')
+ }
+ }
+ end
+end
+
+class TestNetHTTPLocalBind < Test::Unit::TestCase
+ CONFIG = {
+ 'host' => 'localhost',
+ 'proxy_host' => nil,
+ 'proxy_port' => nil,
+ }
+
+ include TestNetHTTPUtils
+
+ def test_bind_to_local_host
+ @server.mount_proc('/show_ip') { |req, res| res.body = req.remote_ip }
+
+ http = Net::HTTP.new(config('host'), config('port'))
+ http.local_host = Addrinfo.tcp(config('host'), config('port')).ip_address
+ assert_not_nil(http.local_host)
+ assert_nil(http.local_port)
+
+ res = http.get('/show_ip')
+ assert_equal(http.local_host, res.body)
+ end
+
+ def test_bind_to_local_port
+ @server.mount_proc('/show_port') { |req, res| res.body = req.peeraddr[1].to_s }
+
+ http = Net::HTTP.new(config('host'), config('port'))
+ http.local_host = Addrinfo.tcp(config('host'), config('port')).ip_address
+ 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)
+
+ res = http.get('/show_port')
+ assert_equal(http.local_port, res.body)
+ end
+end
+
diff --git a/test/net/http/test_http_request.rb b/test/net/http/test_http_request.rb
new file mode 100644
index 0000000000..1dcb847c3f
--- /dev/null
+++ b/test/net/http/test_http_request.rb
@@ -0,0 +1,79 @@
+require 'net/http'
+require 'test/unit'
+require 'stringio'
+
+class HTTPRequestTest < Test::Unit::TestCase
+
+ def test_initialize_GET
+ req = Net::HTTP::Get.new '/'
+
+ assert_equal 'GET', req.method
+ refute req.request_body_permitted?
+ assert req.response_body_permitted?
+
+ expected = {
+ 'accept' => %w[*/*],
+ 'user-agent' => %w[Ruby],
+ }
+
+ expected['accept-encoding'] = %w[gzip;q=1.0,deflate;q=0.6,identity;q=0.3] if
+ Net::HTTP::HAVE_ZLIB
+
+ assert_equal expected, req.to_hash
+ end
+
+ def test_initialize_GET_range
+ req = Net::HTTP::Get.new '/', 'Range' => 'bytes=0-9'
+
+ assert_equal 'GET', req.method
+ refute req.request_body_permitted?
+ assert req.response_body_permitted?
+
+ expected = {
+ 'accept' => %w[*/*],
+ 'user-agent' => %w[Ruby],
+ 'range' => %w[bytes=0-9],
+ }
+
+ assert_equal expected, req.to_hash
+ end
+
+ def test_initialize_HEAD
+ req = Net::HTTP::Head.new '/'
+
+ assert_equal 'HEAD', req.method
+ refute req.request_body_permitted?
+ refute req.response_body_permitted?
+
+ expected = {
+ 'accept' => %w[*/*],
+ 'user-agent' => %w[Ruby],
+ }
+
+ assert_equal expected, req.to_hash
+ end
+
+ def test_initialize_accept_encoding
+ req1 = Net::HTTP::Get.new '/'
+
+ assert req1.decode_content, 'Bug #7831 - automatically decode content'
+
+ req2 = Net::HTTP::Get.new '/', 'accept-encoding' => 'identity'
+
+ refute req2.decode_content,
+ 'Bug #7381 - do not decode content if the user overrides'
+ end if Net::HTTP::HAVE_ZLIB
+
+ def test_header_set
+ req = Net::HTTP::Get.new '/'
+
+ assert req.decode_content, 'Bug #7831 - automatically decode content'
+
+ req['accept-encoding'] = 'identity'
+
+ refute req.decode_content,
+ 'Bug #7831 - do not decode content if the user overrides'
+ end if Net::HTTP::HAVE_ZLIB
+
+end
+
diff --git a/test/net/http/test_httpheader.rb b/test/net/http/test_httpheader.rb
index 379c9bd1ad..062387189d 100644
--- a/test/net/http/test_httpheader.rb
+++ b/test/net/http/test_httpheader.rb
@@ -156,15 +156,32 @@ class HTTPHeaderTest < Test::Unit::TestCase
end
def test_range
- try_range(1..5, '1-5')
- try_range(234..567, '234-567')
- try_range(-5..-1, '-5')
- try_range(1..-1, '1-')
+ try_range([1..5], '1-5')
+ try_invalid_range('5-1')
+ try_range([234..567], '234-567')
+ try_range([-5..-1], '-5')
+ try_invalid_range('-0')
+ try_range([1..-1], '1-')
+ try_range([0..0,-1..-1], '0-0,-1')
+ try_range([1..2, 3..4], '1-2,3-4')
+ try_range([1..2, 3..4], '1-2 , 3-4')
+ try_range([1..2, 1..4], '1-2,1-4')
+
+ try_invalid_range('invalid')
+ try_invalid_range(' 12-')
+ try_invalid_range('12- ')
+ try_invalid_range('123-abc')
+ try_invalid_range('abc-123')
end
def try_range(r, s)
@c['range'] = "bytes=#{s}"
- assert_equal r, Array(@c.range)[0]
+ assert_equal r, @c.range
+ end
+
+ def try_invalid_range(s)
+ @c['range'] = "bytes=#{s}"
+ assert_raise(Net::HTTPHeaderSyntaxError, s){ @c.range }
end
def test_range=
diff --git a/test/net/http/test_httpresponse.rb b/test/net/http/test_httpresponse.rb
index ab6fdd0ea9..974f8296cc 100644
--- a/test/net/http/test_httpresponse.rb
+++ b/test/net/http/test_httpresponse.rb
@@ -1,10 +1,11 @@
+# coding: US-ASCII
require 'net/http'
require 'test/unit'
require 'stringio'
class HTTPResponseTest < Test::Unit::TestCase
def test_singleline_header
- io = dummy_io(<<EOS.gsub(/\n/, "\r\n"))
+ io = dummy_io(<<EOS)
HTTP/1.1 200 OK
Content-Length: 5
Connection: close
@@ -12,12 +13,12 @@ Connection: close
hello
EOS
res = Net::HTTPResponse.read_new(io)
- assert_equal('5', res.header['content-length'])
- assert_equal('close', res.header['connection'])
+ assert_equal('5', res['content-length'])
+ assert_equal('close', res['connection'])
end
def test_multiline_header
- io = dummy_io(<<EOS.gsub(/\n/, "\r\n"))
+ io = dummy_io(<<EOS)
HTTP/1.1 200 OK
X-Foo: XXX
YYY
@@ -28,13 +29,226 @@ X-Bar:
hello
EOS
res = Net::HTTPResponse.read_new(io)
- assert_equal('XXX YYY', res.header['x-foo'])
- assert_equal('XXX YYY', res.header['x-bar'])
+ assert_equal('XXX YYY', res['x-foo'])
+ assert_equal('XXX YYY', res['x-bar'])
+ end
+
+ def test_read_body
+ io = dummy_io(<<EOS)
+HTTP/1.1 200 OK
+Connection: close
+Content-Length: 5
+
+hello
+EOS
+
+ res = Net::HTTPResponse.read_new(io)
+
+ body = nil
+
+ res.reading_body io, true do
+ body = res.read_body
+ end
+
+ assert_equal 'hello', body
+ end
+
+ def test_read_body_block
+ io = dummy_io(<<EOS)
+HTTP/1.1 200 OK
+Connection: close
+Content-Length: 5
+
+hello
+EOS
+
+ res = Net::HTTPResponse.read_new(io)
+
+ body = ''
+
+ res.reading_body io, true do
+ res.read_body do |chunk|
+ body << chunk
+ end
+ end
+
+ assert_equal 'hello', body
+ end
+
+ def test_read_body_content_encoding_deflate
+ io = dummy_io(<<EOS)
+HTTP/1.1 200 OK
+Connection: close
+Content-Encoding: deflate
+Content-Length: 13
+
+x\x9C\xCBH\xCD\xC9\xC9\a\x00\x06,\x02\x15
+EOS
+
+ res = Net::HTTPResponse.read_new(io)
+ res.decode_content = true
+
+ body = nil
+
+ res.reading_body io, true do
+ body = res.read_body
+ end
+
+ if Net::HTTP::HAVE_ZLIB
+ assert_equal nil, res['content-encoding']
+ assert_equal 'hello', body
+ else
+ assert_equal 'deflate', res['content-encoding']
+ assert_equal "x\x9C\xCBH\xCD\xC9\xC9\a\x00\x06,\x02\x15", body
+ end
+ end
+
+ def test_read_body_content_encoding_deflate_chunked
+ io = dummy_io(<<EOS)
+HTTP/1.1 200 OK
+Connection: close
+Content-Encoding: deflate
+Transfer-Encoding: chunked
+
+6
+x\x9C\xCBH\xCD\xC9
+7
+\xC9\a\x00\x06,\x02\x15
+0
+
+EOS
+
+ res = Net::HTTPResponse.read_new(io)
+ res.decode_content = true
+
+ body = nil
+
+ res.reading_body io, true do
+ body = res.read_body
+ end
+
+ if Net::HTTP::HAVE_ZLIB
+ assert_equal nil, res['content-encoding']
+ assert_equal 'hello', body
+ else
+ assert_equal 'deflate', res['content-encoding']
+ assert_equal "x\x9C\xCBH\xCD\xC9\xC9\a\x00\x06,\x02\x15", body
+ end
+ end
+
+ def test_read_body_content_encoding_deflate_disabled
+ io = dummy_io(<<EOS)
+HTTP/1.1 200 OK
+Connection: close
+Content-Encoding: deflate
+Content-Length: 13
+
+x\x9C\xCBH\xCD\xC9\xC9\a\x00\x06,\x02\x15
+EOS
+
+ res = Net::HTTPResponse.read_new(io)
+ res.decode_content = false # user set accept-encoding in request
+
+ body = nil
+
+ res.reading_body io, true do
+ body = res.read_body
+ end
+
+ assert_equal 'deflate', res['content-encoding'], 'Bug #7831'
+ assert_equal "x\x9C\xCBH\xCD\xC9\xC9\a\x00\x06,\x02\x15", body, 'Bug #7381'
+ end
+
+ def test_read_body_content_encoding_deflate_no_length
+ io = dummy_io(<<EOS)
+HTTP/1.1 200 OK
+Connection: close
+Content-Encoding: deflate
+
+x\x9C\xCBH\xCD\xC9\xC9\a\x00\x06,\x02\x15
+EOS
+
+ res = Net::HTTPResponse.read_new(io)
+ res.decode_content = true
+
+ body = nil
+
+ res.reading_body io, true do
+ body = res.read_body
+ end
+
+ if Net::HTTP::HAVE_ZLIB
+ assert_equal nil, res['content-encoding']
+ assert_equal 'hello', body
+ else
+ assert_equal 'deflate', res['content-encoding']
+ assert_equal "x\x9C\xCBH\xCD\xC9\xC9\a\x00\x06,\x02\x15\r\n", body
+ end
+ end
+
+ def test_read_body_content_encoding_deflate_content_range
+ io = dummy_io(<<EOS)
+HTTP/1.1 200 OK
+Accept-Ranges: bytes
+Connection: close
+Content-Encoding: gzip
+Content-Length: 10
+Content-Range: bytes 0-9/55
+
+\x1F\x8B\b\x00\x00\x00\x00\x00\x00\x03
+EOS
+
+ res = Net::HTTPResponse.read_new(io)
+
+ body = nil
+
+ res.reading_body io, true do
+ body = res.read_body
+ end
+
+ assert_equal "\x1F\x8B\b\x00\x00\x00\x00\x00\x00\x03", body
+ end
+
+ def test_read_body_string
+ io = dummy_io(<<EOS)
+HTTP/1.1 200 OK
+Connection: close
+Content-Length: 5
+
+hello
+EOS
+
+ res = Net::HTTPResponse.read_new(io)
+
+ body = ''
+
+ res.reading_body io, true do
+ res.read_body body
+ end
+
+ assert_equal 'hello', body
+ end
+
+ def test_uri_equals
+ uri = URI 'http://example'
+
+ response = Net::HTTPResponse.new '1.1', 200, 'OK'
+
+ response.uri = nil
+
+ assert_nil response.uri
+
+ response.uri = uri
+
+ assert_equal uri, response.uri
+ refute_same uri, response.uri
end
private
def dummy_io(str)
+ str = str.gsub(/\n/, "\r\n")
+
Net::BufferedIO.new(StringIO.new(str))
end
end
diff --git a/test/net/http/test_httpresponses.rb b/test/net/http/test_httpresponses.rb
new file mode 100644
index 0000000000..bf7fbeef11
--- /dev/null
+++ b/test/net/http/test_httpresponses.rb
@@ -0,0 +1,24 @@
+require 'net/http'
+require 'test/unit'
+
+class HTTPResponsesTest < Test::Unit::TestCase
+ def test_status_code_classes
+ Net::HTTPResponse::CODE_TO_OBJ.each_pair { |code, klass|
+ case code
+ when /\A1\d\d\z/
+ group = Net::HTTPInformation
+ when /\A2\d\d\z/
+ group = Net::HTTPSuccess
+ when /\A3\d\d\z/
+ group = Net::HTTPRedirection
+ when /\A4\d\d\z/
+ group = Net::HTTPClientError
+ when /\A5\d\d\z/
+ group = Net::HTTPServerError
+ else
+ flunk "Unknown HTTP status code: #{code} => #{klass.name}"
+ end
+ assert(klass < group, "#{klass.name} (#{code}) must inherit from #{group.name}")
+ }
+ end
+end
diff --git a/test/net/http/test_https.rb b/test/net/http/test_https.rb
index 2f2c699ba2..0a448dd95d 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,
@@ -59,6 +58,31 @@ class TestNetHTTPS < Test::Unit::TestCase
skip $!
end
+ def test_session_reuse
+ http = Net::HTTP.new("localhost", config("port"))
+ http.use_ssl = true
+ http.verify_callback = Proc.new do |preverify_ok, store_ctx|
+ store_ctx.current_cert.to_der == config('ssl_certificate').to_der
+ end
+
+ http.start
+ http.get("/")
+ http.finish
+
+ http.start
+ http.get("/")
+ http.finish # three times due to possible bug in OpenSSL 0.9.8
+
+ http.start
+ http.get("/")
+
+ socket = http.instance_variable_get(:@socket).io
+
+ assert socket.session_reused?
+ rescue SystemCallError
+ skip $!
+ end
+
if ENV["RUBY_OPENSSL_TEST_ALL"]
def test_verify
http = Net::HTTP.new("ssl.netlab.jp", 443)
@@ -103,23 +127,23 @@ class TestNetHTTPS < Test::Unit::TestCase
ex = assert_raise(OpenSSL::SSL::SSLError){
http.request_get("/") {|res| }
}
- assert_match(/hostname does not match/, ex.message)
+ assert_match(/hostname \"127.0.0.1\" does not match/, ex.message)
end
def test_timeout_during_SSL_handshake
bug4246 = "expected the SSL connection to have timed out but have not. [ruby-core:34203]"
# listen for connections... but deliberately do not complete SSL handshake
- TCPServer.open(0) {|server|
+ TCPServer.open('localhost', 0) {|server|
port = server.addr[1]
conn = Net::HTTP.new('localhost', port)
conn.use_ssl = true
- conn.read_timeout = 1
- conn.open_timeout = 1
+ conn.read_timeout = 0.01
+ conn.open_timeout = 0.01
th = Thread.new do
- assert_raise(Timeout::Error) {
+ assert_raise(Net::OpenTimeout) {
conn.get('/')
}
end
diff --git a/test/net/http/test_https_proxy.rb b/test/net/http/test_https_proxy.rb
index 5618830587..57cabf05e0 100644
--- a/test/net/http/test_https_proxy.rb
+++ b/test/net/http/test_https_proxy.rb
@@ -6,6 +6,12 @@ require 'test/unit'
class HTTPSProxyTest < Test::Unit::TestCase
def test_https_proxy_authentication
+ begin
+ OpenSSL
+ rescue LoadError
+ skip 'autoload problem. see [ruby-dev:45021][Bug #5786]'
+ end
+
t = nil
TCPServer.open("127.0.0.1", 0) {|serv|
_, port, _, _ = serv.addr
diff --git a/test/net/http/utils.rb b/test/net/http/utils.rb
index db01b18ddd..592bbd21cc 100644
--- a/test/net/http/utils.rb
+++ b/test/net/http/utils.rb
@@ -46,24 +46,26 @@ 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')
+ server_config[:RequestTimeout] = config('RequestTimeout') if config('RequestTimeout')
if defined?(OpenSSL) and config('ssl_enable')
server_config.update({
:SSLEnable => true,
:SSLCertificate => config('ssl_certificate'),
:SSLPrivateKey => config('ssl_private_key'),
+ :SSLTmpDhCallback => proc { OpenSSL::TestUtils::TEST_KEY_DH1024 },
})
end
@server = WEBrick::HTTPServer.new(server_config)
@server.mount('/', Servlet, config('chunked'))
@server.start
- @config['port'] = @server[:Port] if @config['port'] == 0
+ @config['port'] = @server[:Port]
n_try_max = 5
begin
TCPSocket.open(config('host'), config('port')).close
diff --git a/test/net/imap/test_imap.rb b/test/net/imap/test_imap.rb
index c67886fed4..9484ab8f6c 100644
--- a/test/net/imap/test_imap.rb
+++ b/test/net/imap/test_imap.rb
@@ -18,16 +18,26 @@ class IMAPTest < Test::Unit::TestCase
end
def test_encode_utf7
+ assert_equal("foo", Net::IMAP.encode_utf7("foo"))
+ assert_equal("&-", Net::IMAP.encode_utf7("&"))
+
utf8 = "\357\274\241\357\274\242\357\274\243".force_encoding("UTF-8")
s = Net::IMAP.encode_utf7(utf8)
- assert_equal("&,yH,Iv8j-".force_encoding("UTF-8"), s)
+ assert_equal("&,yH,Iv8j-", s)
+ s = Net::IMAP.encode_utf7("foo&#{utf8}-bar".encode("EUC-JP"))
+ assert_equal("foo&-&,yH,Iv8j--bar", s)
utf8 = "\343\201\202&".force_encoding("UTF-8")
s = Net::IMAP.encode_utf7(utf8)
- assert_equal("&MEI-&-".force_encoding("UTF-8"), s)
+ assert_equal("&MEI-&-", s)
+ s = Net::IMAP.encode_utf7(utf8.encode("EUC-JP"))
+ assert_equal("&MEI-&-", s)
end
def test_decode_utf7
+ assert_equal("&", Net::IMAP.decode_utf7("&-"))
+ assert_equal("&-", Net::IMAP.decode_utf7("&--"))
+
s = Net::IMAP.decode_utf7("&,yH,Iv8j-")
utf8 = "\357\274\241\357\274\242\357\274\243".force_encoding("UTF-8")
assert_equal(utf8, s)
@@ -45,8 +55,8 @@ class IMAPTest < Test::Unit::TestCase
assert_match(/\A24-Jul-2009 01:23 [+\-]\d{4}\z/, s)
end
- def test_imaps_unknown_ca
- if defined?(OpenSSL)
+ if defined?(OpenSSL::SSL::SSLError)
+ def test_imaps_unknown_ca
assert_raise(OpenSSL::SSL::SSLError) do
imaps_test do |port|
begin
@@ -59,10 +69,8 @@ class IMAPTest < Test::Unit::TestCase
end
end
end
- end
- def test_imaps_with_ca_file
- if defined?(OpenSSL)
+ def test_imaps_with_ca_file
assert_nothing_raised do
imaps_test do |port|
begin
@@ -75,10 +83,8 @@ class IMAPTest < Test::Unit::TestCase
end
end
end
- end
- def test_imaps_verify_none
- if defined?(OpenSSL)
+ def test_imaps_verify_none
assert_nothing_raised do
imaps_test do |port|
Net::IMAP.new(SERVER_ADDR,
@@ -87,10 +93,8 @@ class IMAPTest < Test::Unit::TestCase
end
end
end
- end
- def test_imaps_post_connection_check
- if defined?(OpenSSL)
+ def test_imaps_post_connection_check
assert_raise(OpenSSL::SSL::SSLError) do
imaps_test do |port|
# SERVER_ADDR is different from the hostname in the certificate,
@@ -103,20 +107,20 @@ class IMAPTest < Test::Unit::TestCase
end
end
- def test_starttls
- imap = nil
- if defined?(OpenSSL)
+ if defined?(OpenSSL::SSL)
+ def test_starttls
+ imap = nil
starttls_test do |port|
imap = Net::IMAP.new("localhost", :port => port)
imap.starttls(:ca_file => CA_FILE)
imap
end
- end
- rescue SystemCallError
- skip $!
- ensure
- if imap && !imap.disconnected?
- imap.disconnect
+ rescue SystemCallError
+ skip $!
+ ensure
+ if imap && !imap.disconnected?
+ imap.disconnect
+ end
end
end
@@ -418,6 +422,33 @@ class IMAPTest < Test::Unit::TestCase
end
end
+ def test_connection_closed_without_greeting
+ server = create_tcp_server
+ port = server.addr[1]
+ Thread.start do
+ begin
+ sock = server.accept
+ sock.close
+ rescue
+ end
+ end
+ begin
+ assert_raise(Net::IMAP::Error) do
+ Net::IMAP.new(SERVER_ADDR, :port => port)
+ end
+ ensure
+ server.close
+ end
+ end
+
+ def test_default_port
+ assert_equal(143, Net::IMAP.default_port)
+ assert_equal(143, Net::IMAP.default_imap_port)
+ assert_equal(993, Net::IMAP.default_tls_port)
+ assert_equal(993, Net::IMAP.default_ssl_port)
+ assert_equal(993, Net::IMAP.default_imaps_port)
+ end
+
private
def imaps_test
diff --git a/test/net/imap/test_imap_response_parser.rb b/test/net/imap/test_imap_response_parser.rb
index 1547a05b2e..cecc015133 100644
--- a/test/net/imap/test_imap_response_parser.rb
+++ b/test/net/imap/test_imap_response_parser.rb
@@ -91,11 +91,11 @@ EOF
def test_search_response_of_yahoo
parser = Net::IMAP::ResponseParser.new
response = parser.parse(<<EOF.gsub(/\n/, "\r\n").taint)
-* SEARCH 1
+* SEARCH 1\s
EOF
assert_equal [1], response.data
response = parser.parse(<<EOF.gsub(/\n/, "\r\n").taint)
-* SEARCH 1 2 3
+* SEARCH 1 2 3\s
EOF
assert_equal [1, 2, 3], response.data
end
@@ -117,6 +117,113 @@ EOF
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)
+* 123 FETCH (UNKNOWN 92285)
+EOF
+ }
+ assert_match(/ for \{123\}/, e.message)
+ end
+
+ def test_msg_att_rfc822_text
+ parser = Net::IMAP::ResponseParser.new
+ response = parser.parse(<<EOF.gsub(/\n/, "\r\n").taint)
+* 123 FETCH (RFC822 {5}
+foo
+)
+EOF
+ assert_equal("foo\r\n", response.data.attr["RFC822"])
+ response = parser.parse(<<EOF.gsub(/\n/, "\r\n").taint)
+* 123 FETCH (RFC822[] {5}
+foo
+)
+EOF
+ assert_equal("foo\r\n", response.data.attr["RFC822"])
+ end
+
+ # [Bug #6397] [ruby-core:44849]
+ def test_body_type_attachment
+ parser = Net::IMAP::ResponseParser.new
+ response = parser.parse(<<EOF.gsub(/\n/, "\r\n").taint)
+* 980 FETCH (UID 2862 BODYSTRUCTURE ((("TEXT" "PLAIN" ("CHARSET" "iso-8859-1") NIL NIL "7BIT" 416 21 NIL NIL NIL)("TEXT" "HTML" ("CHARSET" "iso-8859-1") NIL NIL "7BIT" 1493 32 NIL NIL NIL) "ALTERNATIVE" ("BOUNDARY" "Boundary_(ID_IaecgfnXwG5bn3x8lIeGIQ)") NIL NIL)("MESSAGE" "RFC822" ("NAME" "Fw_ ____ _____ ____.eml") NIL NIL "7BIT" 1980088 NIL ("ATTACHMENT" ("FILENAME" "Fw_ ____ _____ ____.eml")) NIL) "MIXED" ("BOUNDARY" "Boundary_(ID_eDdLc/j0mBIzIlR191pHjA)") NIL NIL))
+EOF
+ assert_equal("Fw_ ____ _____ ____.eml",
+ response.data.attr["BODYSTRUCTURE"].parts[1].body.param["FILENAME"])
+ end
+
+ def assert_parseable(s)
+ parser = Net::IMAP::ResponseParser.new
+ parser.parse(s.gsub(/\n/, "\r\n").taint)
+ end
+
+ # [Bug #7146]
+ def test_msg_delivery_status
+ # This was part of a larger response that caused crashes, but this was the
+ # minimal test case to demonstrate it
+ assert_parseable <<EOF
+* 4902 FETCH (BODY (("MESSAGE" "DELIVERY-STATUS" NIL NIL NIL "7BIT" 324) "REPORT"))
+EOF
+ end
+
+ # [Bug #7147]
+ def test_msg_with_message_rfc822_attachment
+ assert_parseable <<EOF
+* 5441 FETCH (BODY ((("TEXT" "PLAIN" ("CHARSET" "iso-8859-1") NIL NIL "QUOTED-PRINTABLE" 69 1)("TEXT" "HTML" ("CHARSET" "iso-8859-1") NIL NIL "QUOTED-PRINTABLE" 455 12) "ALTERNATIVE")("MESSAGE" "RFC822" ("NAME" "ATT00026.eml") NIL NIL "7BIT" 4079755) "MIXED"))
+EOF
+ end
+
+ # [Bug #7153]
+ def test_msg_body_mixed
+ assert_parseable <<EOF
+* 1038 FETCH (BODY ("MIXED"))
+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
diff --git a/test/net/protocol/test_protocol.rb b/test/net/protocol/test_protocol.rb
index d8f816edff..f6ee4941cf 100644
--- a/test/net/protocol/test_protocol.rb
+++ b/test/net/protocol/test_protocol.rb
@@ -1,4 +1,3 @@
-# coding: utf-8
require "test/unit"
require "net/protocol"
require "stringio"
diff --git a/test/net/smtp/test_smtp.rb b/test/net/smtp/test_smtp.rb
index 8af6a37d53..0b8d657559 100644
--- a/test/net/smtp/test_smtp.rb
+++ b/test/net/smtp/test_smtp.rb
@@ -1,8 +1,26 @@
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_esmtp
smtp = Net::SMTP.new 'localhost', 25
assert smtp.esmtp
@@ -12,5 +30,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 04a33817de..850b523862 100644
--- a/test/objspace/test_objspace.rb
+++ b/test/objspace/test_objspace.rb
@@ -1,5 +1,6 @@
require "test/unit"
require "objspace"
+require_relative "../ruby/envutil"
class TestObjSpace < Test::Unit::TestCase
def test_memsize_of
@@ -17,6 +18,21 @@ class TestObjSpace < Test::Unit::TestCase
f.close
assert_kind_of(Integer, ObjectSpace.memsize_of(/a/.match("a")))
assert_kind_of(Integer, ObjectSpace.memsize_of(Struct.new(:a)))
+
+ assert_operator(ObjectSpace.memsize_of(Regexp.new("(a)"*1000).match("a"*1000)),
+ :>,
+ ObjectSpace.memsize_of(//.match("")))
+ end
+
+ def test_argf_memsize
+ size = ObjectSpace.memsize_of(ARGF)
+ assert_kind_of(Integer, size)
+ assert_operator(size, :>, 0)
+ argf = ARGF.dup
+ argf.inplace_mode = nil
+ size = ObjectSpace.memsize_of(argf)
+ argf.inplace_mode = "inplace_mode_suffix"
+ assert_equal(size + 20, ObjectSpace.memsize_of(argf))
end
def test_memsize_of_all
@@ -42,7 +58,9 @@ class TestObjSpace < Test::Unit::TestCase
assert_equal(false, res.empty?)
arg = {}
ObjectSpace.count_nodes(arg)
- assert_equal(false, arg.empty?)
+ assert_not_empty(arg)
+ bug8014 = '[ruby-core:53130] [Bug #8014]'
+ assert_empty(arg.select {|k, v| !(Symbol === k && Integer === v)}, bug8014)
end
def test_count_tdata_objects
@@ -52,4 +70,200 @@ class TestObjSpace < Test::Unit::TestCase
ObjectSpace.count_tdata_objects(arg)
assert_equal(false, arg.empty?)
end
+
+ def test_reachable_objects_from
+ assert_separately %w[--disable-gem -robjspace], __FILE__, __LINE__, <<-'eom'
+ assert_equal(nil, ObjectSpace.reachable_objects_from(nil))
+ assert_equal([Array, 'a', 'b', 'c'], ObjectSpace.reachable_objects_from(['a', 'b', 'c']))
+
+ assert_equal([Array, 'a', 'a', 'a'], ObjectSpace.reachable_objects_from(['a', 'a', 'a']))
+ assert_equal([Array, 'a', 'a'], ObjectSpace.reachable_objects_from(['a', v = 'a', v]))
+ assert_equal([Array, 'a'], ObjectSpace.reachable_objects_from([v = 'a', v, v]))
+
+ long_ary = Array.new(1_000){''}
+ max = 0
+
+ ObjectSpace.each_object{|o|
+ refs = ObjectSpace.reachable_objects_from(o)
+ max = [refs.size, max].max
+
+ unless refs.nil?
+ refs.each_with_index {|ro, i|
+ assert_not_nil(ro, "#{i}: this referenced object is internal object")
+ }
+ end
+ }
+ assert_operator(max, :>=, long_ary.size+1, "1000 elems + Array class")
+ 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|
+ ObjectSpace.reachable_objects_from(o).each{|reached_obj|
+ size = ObjectSpace.memsize_of(reached_obj)
+ assert_kind_of(Integer, size)
+ assert_operator(size, :>=, 0)
+ }
+ }
+ eom
+ end
+
+ def test_trace_object_allocations
+ 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_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[-robjspace], <<-'end;', /\A[1-9]/, timeout: 2)
+ stress, GC.stress = GC.stress, false
+ count = 0
+ ObjectSpace.after_gc_start_hook = proc {count += 1}
+ begin
+ GC.stress = true
+ 3.times {Object.new}
+ ensure
+ GC.stress = stress
+ ObjectSpace.after_gc_start_hook = nil
+ end
+ puts count
+ end;
+ end
+ 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 = /"value":"TEST STRING", "encoding":"UTF-8", "file":"-", "line":4, "method":"dump_my_heap_please"/
+ assert_in_out_err(%w[-robjspace], <<-'end;', entry)
+ def dump_my_heap_please
+ ObjectSpace.trace_object_allocations_start
+ GC.start
+ "TEST STRING".force_encoding("UTF-8")
+ ObjectSpace.dump_all(output: :stdout)
+ end
+
+ dump_my_heap_please
+ end;
+
+ assert_in_out_err(%w[-robjspace], <<-'end;') do |(output), (error)|
+ def dump_my_heap_please
+ ObjectSpace.trace_object_allocations_start
+ GC.start
+ "TEST STRING".force_encoding("UTF-8")
+ ObjectSpace.dump_all().path
+ end
+
+ puts dump_my_heap_please
+ end;
+ skip if /is not supported/ =~ error
+ assert_match(entry, File.read(output))
+ File.unlink(output)
+ end
+ end
end
diff --git a/test/open-uri/test_open-uri.rb b/test/open-uri/test_open-uri.rb
index 5f501d16cc..21dd96960a 100644
--- a/test/open-uri/test_open-uri.rb
+++ b/test/open-uri/test_open-uri.rb
@@ -2,7 +2,10 @@ require 'test/unit'
require 'open-uri'
require 'webrick'
require 'webrick/httpproxy'
-require 'zlib'
+begin
+ require 'zlib'
+rescue LoadError
+end
class TestOpenURI < Test::Unit::TestCase
@@ -21,10 +24,13 @@ class TestOpenURI < Test::Unit::TestCase
:Port => 0})
_, port, _, host = srv.listeners[0].addr
begin
- th = srv.start
+ srv.start
yield srv, dr, "http://#{host}:#{port}"
ensure
srv.shutdown
+ until srv.status == :Stop
+ sleep 0.1
+ end
end
}
end
@@ -52,7 +58,7 @@ class TestOpenURI < Test::Unit::TestCase
def test_200
with_http {|srv, dr, url|
- open("#{dr}/foo200", "w") {|f| f << "foo200" }
+ srv.mount_proc("/foo200", lambda { |req, res| res.body = "foo200" } )
open("#{url}/foo200") {|f|
assert_equal("200", f.status[0])
assert_equal("foo200", f.read)
@@ -63,7 +69,7 @@ class TestOpenURI < Test::Unit::TestCase
def test_200big
with_http {|srv, dr, url|
content = "foo200big"*10240
- open("#{dr}/foo200big", "w") {|f| f << content }
+ srv.mount_proc("/foo200big", lambda { |req, res| res.body = content } )
open("#{url}/foo200big") {|f|
assert_equal("200", f.status[0])
assert_equal(content, f.read)
@@ -80,7 +86,7 @@ class TestOpenURI < Test::Unit::TestCase
def test_open_uri
with_http {|srv, dr, url|
- open("#{dr}/foo_ou", "w") {|f| f << "foo_ou" }
+ srv.mount_proc("/foo_ou", lambda { |req, res| res.body = "foo_ou" } )
u = URI("#{url}/foo_ou")
open(u) {|f|
assert_equal("200", f.status[0])
@@ -110,7 +116,7 @@ class TestOpenURI < Test::Unit::TestCase
end
}
begin
- assert_raise(Timeout::Error) { URI("http://127.0.0.1:#{port}/foo/bar").read(:read_timeout=>0.01) }
+ assert_raise(Net::ReadTimeout) { URI("http://127.0.0.1:#{port}/foo/bar").read(:read_timeout=>0.1) }
ensure
Thread.kill(th)
th.join
@@ -124,7 +130,7 @@ class TestOpenURI < Test::Unit::TestCase
def test_mode
with_http {|srv, dr, url|
- open("#{dr}/mode", "w") {|f| f << "mode" }
+ srv.mount_proc("/mode", lambda { |req, res| res.body = "mode" } )
open("#{url}/mode", "r") {|f|
assert_equal("200", f.status[0])
assert_equal("mode", f.read)
@@ -146,13 +152,13 @@ class TestOpenURI < Test::Unit::TestCase
def test_without_block
with_http {|srv, dr, url|
- open("#{dr}/without_block", "w") {|g| g << "without_block" }
+ srv.mount_proc("/without_block", lambda { |req, res| res.body = "without_block" } )
begin
f = open("#{url}/without_block")
assert_equal("200", f.status[0])
assert_equal("without_block", f.read)
ensure
- f.close
+ f.close if f && !f.closed?
end
}
end
@@ -196,8 +202,8 @@ class TestOpenURI < Test::Unit::TestCase
_, proxy_port, _, proxy_host = proxy.listeners[0].addr
proxy_url = "http://#{proxy_host}:#{proxy_port}/"
begin
- th = proxy.start
- open("#{dr}/proxy", "w") {|f| f << "proxy" }
+ 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])
assert_equal("proxy", f.read)
@@ -249,8 +255,8 @@ class TestOpenURI < Test::Unit::TestCase
_, proxy_port, _, proxy_host = proxy.listeners[0].addr
proxy_url = "http://#{proxy_host}:#{proxy_port}/"
begin
- th = proxy.start
- open("#{dr}/proxy", "w") {|f| f << "proxy" }
+ 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])
assert_match(/#{Regexp.quote url}/, log); log.clear
@@ -419,7 +425,7 @@ class TestOpenURI < Test::Unit::TestCase
def test_uri_read
with_http {|srv, dr, url|
- open("#{dr}/uriread", "w") {|f| f << "uriread" }
+ srv.mount_proc("/uriread", lambda { |req, res| res.body = "uriread" } )
data = URI("#{url}/uriread").read
assert_equal("200", data.status[0])
assert_equal("uriread", data)
@@ -482,56 +488,36 @@ class TestOpenURI < Test::Unit::TestCase
srv.mount_proc("/data2/") {|req, res| res.body = content_gz; res['content-encoding'] = 'gzip'; res.chunked = true }
srv.mount_proc("/noce/") {|req, res| res.body = content_gz }
open("#{url}/data/") {|f|
- assert_equal ['gzip'], f.content_encoding
- assert_equal(content_gz, f.read.force_encoding("ascii-8bit"))
+ assert_equal [], f.content_encoding
+ assert_equal(content, f.read)
}
open("#{url}/data2/") {|f|
- assert_equal ['gzip'], f.content_encoding
- assert_equal(content_gz, f.read.force_encoding("ascii-8bit"))
+ assert_equal [], f.content_encoding
+ assert_equal(content, f.read)
}
open("#{url}/noce/") {|f|
assert_equal [], f.content_encoding
assert_equal(content_gz, f.read.force_encoding("ascii-8bit"))
}
}
- end
+ end if defined?(Zlib::GzipWriter)
- # 192.0.2.0/24 is TEST-NET. [RFC3330]
-
- def test_find_proxy
- assert_nil(URI("http://192.0.2.1/").find_proxy)
- assert_nil(URI("ftp://192.0.2.1/").find_proxy)
- with_env('http_proxy'=>'http://127.0.0.1:8080') {
- assert_equal(URI('http://127.0.0.1:8080'), URI("http://192.0.2.1/").find_proxy)
- assert_nil(URI("ftp://192.0.2.1/").find_proxy)
- }
- with_env('ftp_proxy'=>'http://127.0.0.1:8080') {
- assert_nil(URI("http://192.0.2.1/").find_proxy)
- assert_equal(URI('http://127.0.0.1:8080'), URI("ftp://192.0.2.1/").find_proxy)
- }
- with_env('REQUEST_METHOD'=>'GET') {
- assert_nil(URI("http://192.0.2.1/").find_proxy)
- }
- with_env('CGI_HTTP_PROXY'=>'http://127.0.0.1:8080', 'REQUEST_METHOD'=>'GET') {
- assert_equal(URI('http://127.0.0.1:8080'), URI("http://192.0.2.1/").find_proxy)
- }
- with_env('http_proxy'=>'http://127.0.0.1:8080', 'no_proxy'=>'192.0.2.2') {
- assert_equal(URI('http://127.0.0.1:8080'), URI("http://192.0.2.1/").find_proxy)
- assert_nil(URI("http://192.0.2.2/").find_proxy)
+ 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
- def test_find_proxy_case_sensitive_env
- with_env('http_proxy'=>'http://127.0.0.1:8080', 'REQUEST_METHOD'=>'GET') {
- assert_equal(URI('http://127.0.0.1:8080'), URI("http://192.0.2.1/").find_proxy)
- }
- with_env('HTTP_PROXY'=>'http://127.0.0.1:8081', 'REQUEST_METHOD'=>'GET') {
- assert_nil(nil, URI("http://192.0.2.1/").find_proxy)
- }
- with_env('http_proxy'=>'http://127.0.0.1:8080', 'HTTP_PROXY'=>'http://127.0.0.1:8081', 'REQUEST_METHOD'=>'GET') {
- assert_equal(URI('http://127.0.0.1:8080'), URI("http://192.0.2.1/").find_proxy)
- }
- end unless RUBY_PLATFORM =~ /mswin|mingw/
+ # 192.0.2.0/24 is TEST-NET. [RFC3330]
def test_ftp_invalid_request
assert_raise(ArgumentError) { URI("ftp://127.0.0.1/").read }
@@ -555,7 +541,7 @@ class TestOpenURI < Test::Unit::TestCase
assert_equal("CWD foo\r\n", s.gets); s.print "250 CWD successful\r\n"
assert_equal("PASV\r\n", s.gets)
TCPServer.open("127.0.0.1", 0) {|data_serv|
- _, data_serv_port, _, data_serv_host = data_serv.addr
+ _, data_serv_port, _, _ = data_serv.addr
hi = data_serv_port >> 8
lo = data_serv_port & 0xff
s.print "227 Entering Passive Mode (127,0,0,1,#{hi},#{lo}).\r\n"
@@ -638,7 +624,7 @@ class TestOpenURI < Test::Unit::TestCase
assert_equal("SIZE bar\r\n", s.gets); s.print "213 #{content.bytesize}\r\n"
assert_equal("PASV\r\n", s.gets)
TCPServer.open("127.0.0.1", 0) {|data_serv|
- _, data_serv_port, _, data_serv_host = data_serv.addr
+ _, data_serv_port, _, _ = data_serv.addr
hi = data_serv_port >> 8
lo = data_serv_port & 0xff
s.print "227 Entering Passive Mode (127,0,0,1,#{hi},#{lo}).\r\n"
diff --git a/test/open-uri/test_ssl.rb b/test/open-uri/test_ssl.rb
index 64fc214ce5..f3e1f48de7 100644
--- a/test/open-uri/test_ssl.rb
+++ b/test/open-uri/test_ssl.rb
@@ -1,13 +1,18 @@
require 'test/unit'
require 'open-uri'
-require 'openssl'
require 'stringio'
require 'webrick'
-require 'webrick/https'
+begin
+ require 'openssl'
+ require 'webrick/https'
+rescue LoadError
+end
require 'webrick/httpproxy'
class TestOpenURISSL < Test::Unit::TestCase
+end
+class TestOpenURISSL
NullLog = Object.new
def NullLog.<<(arg)
end
@@ -26,10 +31,13 @@ class TestOpenURISSL < Test::Unit::TestCase
:Port => 0})
_, port, _, host = srv.listeners[0].addr
begin
- th = srv.start
+ srv.start
yield srv, dr, "https://#{host}:#{port}"
ensure
srv.shutdown
+ until srv.status == :Stop
+ sleep 0.1
+ end
end
}
end
@@ -48,7 +56,7 @@ class TestOpenURISSL < Test::Unit::TestCase
with_https {|srv, dr, url|
cacert_filename = "#{dr}/cacert.pem"
open(cacert_filename, "w") {|f| f << CA_CERT }
- open("#{dr}/data", "w") {|f| f << "ddd" }
+ srv.mount_proc("/data", lambda { |req, res| res.body = "ddd" } )
open("#{url}/data", :ssl_ca_cert => cacert_filename) {|f|
assert_equal("200", f.status[0])
assert_equal("ddd", f.read)
@@ -77,8 +85,8 @@ class TestOpenURISSL < Test::Unit::TestCase
:Port => 0})
_, p_port, _, p_host = prxy.listeners[0].addr
begin
- th = prxy.start
- open("#{dr}/proxy", "w") {|f| f << "proxy" }
+ 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])
assert_equal("proxy", f.read)
@@ -93,11 +101,14 @@ class TestOpenURISSL < Test::Unit::TestCase
sio.truncate(0); sio.rewind
ensure
prxy.shutdown
+ until prxy.status == :Stop
+ sleep 0.1
+ end
end
}
end
-end
+end if defined?(OpenSSL)
# mkdir demoCA demoCA/private demoCA/newcerts
# touch demoCA/index.txt
diff --git a/test/openssl/test_asn1.rb b/test/openssl/test_asn1.rb
index 811fe387fa..3ea2638b0b 100644
--- a/test/openssl/test_asn1.rb
+++ b/test/openssl/test_asn1.rb
@@ -200,7 +200,7 @@ class OpenSSL::TestASN1 < Test::Unit::TestCase
def test_encode_nil
m = OpenSSL::ASN1
- [
+ [
m::Boolean, m::Integer, m::BitString, m::OctetString,
m::ObjectId, m::Enumerated, m::UTF8String, m::UTCTime,
m::GeneralizedTime, m::Sequence, m::Set
@@ -247,7 +247,7 @@ rEzBQ0F9dUyqQ9gyRg8KHhDfv9HzT1d/rnUZMkoombwYBRIUChGCYV0GnJcan2Zm
assert_equal(false, prim.infinite_length)
prim.infinite_length = true
flunk('Could set infinite length on primitive value')
- rescue NoMethodError => e
+ rescue NoMethodError
#ok
end
end
@@ -263,6 +263,14 @@ rEzBQ0F9dUyqQ9gyRg8KHhDfv9HzT1d/rnUZMkoombwYBRIUChGCYV0GnJcan2Zm
end
end
+ def test_decode_utctime
+ expected = Time.at 1374535380
+ assert_equal expected, OpenSSL::ASN1.decode("\x17\v1307222323Z").value
+
+ expected += 17
+ assert_equal expected, OpenSSL::ASN1.decode("\x17\r130722232317Z").value
+ end
+
def test_create_inf_length_primitive
expected = %w{ 24 80 04 01 61 00 00 }
raw = [expected.join('')].pack('H*')
diff --git a/test/openssl/test_bn.rb b/test/openssl/test_bn.rb
index 7136de9a27..27bbcdfeaf 100644
--- a/test/openssl/test_bn.rb
+++ b/test/openssl/test_bn.rb
@@ -3,9 +3,38 @@ require_relative 'utils'
if defined?(OpenSSL)
class OpenSSL::TestBN < Test::Unit::TestCase
- 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_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_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_buffering.rb b/test/openssl/test_buffering.rb
index 1e2197533a..c4894e1291 100644
--- a/test/openssl/test_buffering.rb
+++ b/test/openssl/test_buffering.rb
@@ -70,7 +70,6 @@ class OpenSSL::TestBuffering < Test::Unit::TestCase
def test_getc
@io.syswrite('abc')
- res = []
assert_equal(?a, @io.getc)
assert_equal(?b, @io.getc)
assert_equal(?c, @io.getc)
diff --git a/test/openssl/test_cipher.rb b/test/openssl/test_cipher.rb
index eb2f4fec57..156fa2a9c9 100644
--- a/test/openssl/test_cipher.rb
+++ b/test/openssl/test_cipher.rb
@@ -3,6 +3,25 @@ require_relative 'utils'
if defined?(OpenSSL)
class OpenSSL::TestCipher < Test::Unit::TestCase
+
+ class << self
+
+ def has_cipher?(name)
+ ciphers = OpenSSL::Cipher.ciphers
+ # redefine method so we can use the cached ciphers value from the closure
+ # and need not recompute the list each time
+ define_singleton_method :has_cipher? do |name|
+ ciphers.include?(name)
+ end
+ has_cipher?(name)
+ end
+
+ def has_ciphers?(list)
+ list.all? { |name| has_cipher?(name) }
+ end
+
+ end
+
def setup
@c1 = OpenSSL::Cipher::Cipher.new("DES-EDE3-CBC")
@c2 = OpenSSL::Cipher::DES.new(:EDE3, "CBC")
@@ -69,9 +88,22 @@ class OpenSSL::TestCipher < Test::Unit::TestCase
assert_raise(RuntimeError) {OpenSSL::Cipher.allocate.final}
end
+ def test_ctr_if_exists
+ begin
+ cipher = OpenSSL::Cipher.new('aes-128-ctr')
+ cipher.encrypt
+ cipher.pkcs5_keyivgen('password')
+ c = cipher.update('hello,world') + cipher.final
+ cipher.decrypt
+ cipher.pkcs5_keyivgen('password')
+ assert_equal('hello,world', cipher.update(c) + cipher.final)
+ end
+ end if has_cipher?('aes-128-ctr')
+
if OpenSSL::OPENSSL_VERSION_NUMBER > 0x00907000
def test_ciphers
OpenSSL::Cipher.ciphers.each{|name|
+ next if /netbsd/ =~ RUBY_PLATFORM && /idea|rc5/i =~ name
assert(OpenSSL::Cipher::Cipher.new(name).is_a?(OpenSSL::Cipher::Cipher))
}
end
@@ -100,6 +132,124 @@ class OpenSSL::TestCipher < Test::Unit::TestCase
end
end
end
+
+ if has_ciphers?(['aes-128-gcm', 'aes-192-gcm', 'aes-256-gcm'])
+
+ def test_authenticated
+ cipher = OpenSSL::Cipher.new('aes-128-gcm')
+ assert(cipher.authenticated?)
+ cipher = OpenSSL::Cipher.new('aes-128-cbc')
+ refute(cipher.authenticated?)
+ end
+
+ def test_aes_gcm
+ ['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)
+
+ cipher.auth_data = "aad"
+ ct = cipher.update(pt) + cipher.final
+ tag = cipher.auth_tag
+ assert_equal(16, tag.size)
+
+ decipher = new_decryptor(algo, key, iv)
+ decipher.auth_tag = tag
+ decipher.auth_data = "aad"
+
+ assert_equal(pt, decipher.update(ct) + decipher.final)
+ end
+ end
+
+ def test_aes_gcm_short_tag
+ ['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)
+
+ cipher.auth_data = "aad"
+ ct = cipher.update(pt) + cipher.final
+ tag = cipher.auth_tag(8)
+ assert_equal(8, tag.size)
+
+ decipher = new_decryptor(algo, key, iv)
+ decipher.auth_tag = tag
+ decipher.auth_data = "aad"
+
+ assert_equal(pt, decipher.update(ct) + decipher.final)
+ end
+ end
+
+ def test_aes_gcm_wrong_tag
+ pt = "You should all use Authenticated Encryption!"
+ cipher, key, iv = new_encryptor('aes-128-gcm')
+
+ cipher.auth_data = "aad"
+ ct = cipher.update(pt) + cipher.final
+ tag = cipher.auth_tag
+
+ decipher = new_decryptor('aes-128-gcm', key, iv)
+ tag.setbyte(-1, (tag.getbyte(-1) + 1) & 0xff)
+ decipher.auth_tag = tag
+ decipher.auth_data = "aad"
+
+ assert_raise OpenSSL::Cipher::CipherError do
+ decipher.update(ct) + decipher.final
+ end
+ end
+
+ def test_aes_gcm_wrong_auth_data
+ pt = "You should all use Authenticated Encryption!"
+ cipher, key, iv = new_encryptor('aes-128-gcm')
+
+ cipher.auth_data = "aad"
+ ct = cipher.update(pt) + cipher.final
+ tag = cipher.auth_tag
+
+ decipher = new_decryptor('aes-128-gcm', key, iv)
+ decipher.auth_tag = tag
+ decipher.auth_data = "daa"
+
+ assert_raise OpenSSL::Cipher::CipherError do
+ decipher.update(ct) + decipher.final
+ end
+ end
+
+ def test_aes_gcm_wrong_ciphertext
+ pt = "You should all use Authenticated Encryption!"
+ cipher, key, iv = new_encryptor('aes-128-gcm')
+
+ cipher.auth_data = "aad"
+ ct = cipher.update(pt) + cipher.final
+ tag = cipher.auth_tag
+
+ decipher = new_decryptor('aes-128-gcm', key, iv)
+ decipher.auth_tag = tag
+ decipher.auth_data = "aad"
+
+ assert_raise OpenSSL::Cipher::CipherError do
+ decipher.update(ct[0..-2] << ct[-1].succ) + decipher.final
+ end
+ end
+
+ end
+
+ private
+
+ def new_encryptor(algo)
+ cipher = OpenSSL::Cipher.new(algo)
+ cipher.encrypt
+ key = cipher.random_key
+ iv = cipher.random_iv
+ [cipher, key, iv]
+ end
+
+ def new_decryptor(algo, key, iv)
+ OpenSSL::Cipher.new(algo).tap do |cipher|
+ cipher.decrypt
+ cipher.key = key
+ cipher.iv = iv
+ end
+ end
+
end
end
diff --git a/test/openssl/test_config.rb b/test/openssl/test_config.rb
index 1ed455c14e..1cd3cb6391 100644
--- a/test/openssl/test_config.rb
+++ b/test/openssl/test_config.rb
@@ -12,10 +12,16 @@ dir = ./demoCA
certs = ./certs
__EOD__
file.close
+ @tmpfile = file
@it = OpenSSL::Config.new(file.path)
end
+ def teardown
+ @tmpfile.unlink
+ end
+
def test_constants
+ assert(defined?(OpenSSL::Config::DEFAULT_CONFIG_FILE))
config_file = OpenSSL::Config::DEFAULT_CONFIG_FILE
skip "DEFAULT_CONFIG_FILE may return a wrong path on your platforms. [Bug #6830]" unless File.readable?(config_file)
assert_nothing_raised do
@@ -115,11 +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)
+ 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
@@ -129,11 +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)
+ 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 81085d2c9c..86c30d973c 100644
--- a/test/openssl/test_digest.rb
+++ b/test/openssl/test_digest.rb
@@ -103,6 +103,14 @@ class OpenSSL::TestDigest < Test::Unit::TestCase
end
end
+ def test_openssl_digest
+ assert_equal OpenSSL::Digest::MD5, OpenSSL::Digest("MD5")
+
+ assert_raises NameError do
+ OpenSSL::Digest("no such digest")
+ end
+ end
+
private
def check_digest(oid)
diff --git a/test/openssl/test_engine.rb b/test/openssl/test_engine.rb
index 6d90e34398..46a2948cbf 100644
--- a/test/openssl/test_engine.rb
+++ b/test/openssl/test_engine.rb
@@ -1,15 +1,75 @@
require_relative 'utils'
-if defined?(OpenSSL)
-
class OpenSSL::TestEngine < Test::Unit::TestCase
+ def teardown
+ OpenSSL::Engine.cleanup # [ruby-core:40669]
+ assert_equal(0, OpenSSL::Engine.engines.size)
+ end
+
def test_engines_free # [ruby-dev:44173]
- OpenSSL::Engine.load
+ OpenSSL::Engine.load("openssl")
OpenSSL::Engine.engines
OpenSSL::Engine.engines
end
-end
+ def test_openssl_engine_builtin
+ engine = OpenSSL::Engine.load("openssl")
+ assert_equal(true, engine)
+ assert_equal(1, OpenSSL::Engine.engines.size)
+ end
+
+ def test_openssl_engine_by_id_string
+ engine = get_engine
+ assert_not_nil(engine)
+ assert_equal(1, OpenSSL::Engine.engines.size)
+ end
+
+ def test_openssl_engine_id_name_inspect
+ engine = get_engine
+ assert_equal("openssl", engine.id)
+ assert_not_nil(engine.name)
+ assert_not_nil(engine.inspect)
+ end
+
+ def test_openssl_engine_digest_sha1
+ engine = get_engine
+ digest = engine.digest("SHA1")
+ assert_not_nil(digest)
+ data = "test"
+ assert_equal(OpenSSL::Digest::SHA1.digest(data), digest.digest(data))
+ end
+
+ def test_openssl_engine_cipher_rc4
+ engine = get_engine
+ algo = "RC4" #AES is not supported by openssl Engine (<=1.0.0e)
+ data = "a" * 1000
+ key = OpenSSL::Random.random_bytes(16)
+ # suppress message from openssl Engine's RC4 cipher [ruby-core:41026]
+ err_back = $stderr.dup
+ $stderr.reopen(IO::NULL)
+ encrypted = crypt_data(data, key, :encrypt) { engine.cipher(algo) }
+ decrypted = crypt_data(encrypted, key, :decrypt) { OpenSSL::Cipher.new(algo) }
+ assert_equal(data, decrypted)
+ ensure
+ if err_back
+ $stderr.reopen(err_back)
+ err_back.close
+ end
+ end
+
+ private
+
+ def get_engine
+ OpenSSL::Engine.by_id("openssl")
+ end
+
+ def crypt_data(data, key, mode)
+ cipher = yield
+ cipher.send mode
+ cipher.key = key
+ cipher.update(data) + cipher.final
+ end
+
+end if defined?(OpenSSL)
-end
diff --git a/test/openssl/test_fips.rb b/test/openssl/test_fips.rb
new file mode 100644
index 0000000000..882647f7e1
--- /dev/null
+++ b/test/openssl/test_fips.rb
@@ -0,0 +1,14 @@
+require_relative 'utils'
+
+if defined?(OpenSSL)
+
+class OpenSSL::TestFIPS < Test::Unit::TestCase
+
+ def test_fips_mode_is_reentrant
+ OpenSSL.fips_mode = false
+ OpenSSL.fips_mode = false
+ end
+
+end
+
+end
diff --git a/test/openssl/test_ns_spki.rb b/test/openssl/test_ns_spki.rb
index 3bcf3e6fbe..7cddefad6d 100644
--- a/test/openssl/test_ns_spki.rb
+++ b/test/openssl/test_ns_spki.rb
@@ -30,6 +30,7 @@ class OpenSSL::TestNSSPI < Test::Unit::TestCase
assert_equal("RandomString", spki.challenge)
assert_equal(key1.public_key.to_der, spki.public_key.to_der)
assert(spki.verify(spki.public_key))
+ assert_not_nil(spki.to_text)
end
def test_decode_data
diff --git a/test/openssl/test_pair.rb b/test/openssl/test_pair.rb
index 940fa0c0db..933f61292c 100644
--- a/test/openssl/test_pair.rb
+++ b/test/openssl/test_pair.rb
@@ -6,13 +6,12 @@ require 'socket'
require_relative '../ruby/ut_eof'
module SSLPair
- DHParam = OpenSSL::PKey::DH.new(128)
def server
host = "127.0.0.1"
port = 0
ctx = OpenSSL::SSL::SSLContext.new()
ctx.ciphers = "ADH"
- ctx.tmp_dh_callback = proc { DHParam }
+ ctx.tmp_dh_callback = proc { OpenSSL::TestUtils::TEST_KEY_DH1024 }
tcps = TCPServer.new(host, port)
ssls = OpenSSL::SSL::SSLServer.new(tcps, ctx)
return ssls
@@ -142,7 +141,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
@@ -157,19 +156,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
@@ -177,6 +205,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"
@@ -187,12 +235,22 @@ class OpenSSL::TestPair < Test::Unit::TestCase
}
end
+ 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 test_connect_accept_nonblock
host = "127.0.0.1"
port = 0
ctx = OpenSSL::SSL::SSLContext.new()
ctx.ciphers = "ADH"
- ctx.tmp_dh_callback = proc { DHParam }
+ ctx.tmp_dh_callback = proc { OpenSSL::TestUtils::TEST_KEY_DH1024 }
serv = TCPServer.new(host, port)
port = serv.connect_address.ip_port
diff --git a/test/openssl/test_pkcs12.rb b/test/openssl/test_pkcs12.rb
index 64e7530700..25ff606384 100644
--- a/test/openssl/test_pkcs12.rb
+++ b/test/openssl/test_pkcs12.rb
@@ -16,7 +16,7 @@ module OpenSSL
["subjectKeyIdentifier","hash",false],
["authorityKeyIdentifier","keyid:always",false],
]
-
+
@cacert = issue_cert(ca, TEST_KEY_RSA2048, 1, now, now+3600, ca_exts,
nil, nil, OpenSSL::Digest::SHA1.new)
@@ -40,7 +40,7 @@ Li8JsX5yIiuVYaBg/6ha3tOg4TCa5K/3r3tVliRZ2Es=
_EOS_
@inter_cacert = issue_cert(inter_ca, inter_ca_key, 2, now, now+3600, ca_exts,
- @ca_cert, TEST_KEY_RSA2048, OpenSSL::Digest::SHA1.new)
+ @cacert, TEST_KEY_RSA2048, OpenSSL::Digest::SHA1.new)
exts = [
["keyUsage","digitalSignature",true],
@@ -108,7 +108,7 @@ Li8JsX5yIiuVYaBg/6ha3tOg4TCa5K/3r3tVliRZ2Es=
assert_equal chain.size, decoded.ca_certs.size
assert_include_cert @cacert, decoded.ca_certs
assert_include_cert @inter_cacert, decoded.ca_certs
- assert_cert @mycert, decoded.certificate
+ assert_cert @mycert, decoded.certificate
assert_equal TEST_KEY_RSA1024.to_der, decoded.key.to_der
end
diff --git a/test/openssl/test_pkcs5.rb b/test/openssl/test_pkcs5.rb
new file mode 100644
index 0000000000..30fa3e5b0a
--- /dev/null
+++ b/test/openssl/test_pkcs5.rb
@@ -0,0 +1,97 @@
+require_relative 'utils'
+
+class OpenSSL::TestPKCS5 < Test::Unit::TestCase
+
+ def test_pbkdf2_hmac_sha1_rfc6070_c_1_len_20
+ p ="password"
+ s = "salt"
+ c = 1
+ dk_len = 20
+ raw = %w{ 0c 60 c8 0f 96 1f 0e 71
+ f3 a9 b5 24 af 60 12 06
+ 2f e0 37 a6 }
+ expected = [raw.join('')].pack('H*')
+ value = OpenSSL::PKCS5.pbkdf2_hmac_sha1(p, s, c, dk_len)
+ assert_equal(expected, value)
+ end
+
+ def test_pbkdf2_hmac_sha1_rfc6070_c_2_len_20
+ p ="password"
+ s = "salt"
+ c = 2
+ dk_len = 20
+ raw = %w{ ea 6c 01 4d c7 2d 6f 8c
+ cd 1e d9 2a ce 1d 41 f0
+ d8 de 89 57 }
+ expected = [raw.join('')].pack('H*')
+ value = OpenSSL::PKCS5.pbkdf2_hmac_sha1(p, s, c, dk_len)
+ assert_equal(expected, value)
+ end
+
+ def test_pbkdf2_hmac_sha1_rfc6070_c_4096_len_20
+ p ="password"
+ s = "salt"
+ c = 4096
+ dk_len = 20
+ raw = %w{ 4b 00 79 01 b7 65 48 9a
+ be ad 49 d9 26 f7 21 d0
+ 65 a4 29 c1 }
+ expected = [raw.join('')].pack('H*')
+ value = OpenSSL::PKCS5.pbkdf2_hmac_sha1(p, s, c, dk_len)
+ assert_equal(expected, value)
+ end
+
+# takes too long!
+# def test_pbkdf2_hmac_sha1_rfc6070_c_16777216_len_20
+# p ="password"
+# s = "salt"
+# c = 16777216
+# dk_len = 20
+# raw = %w{ ee fe 3d 61 cd 4d a4 e4
+# e9 94 5b 3d 6b a2 15 8c
+# 26 34 e9 84 }
+# expected = [raw.join('')].pack('H*')
+# value = OpenSSL::PKCS5.pbkdf2_hmac_sha1(p, s, c, dk_len)
+# assert_equal(expected, value)
+# end
+
+ def test_pbkdf2_hmac_sha1_rfc6070_c_4096_len_25
+ p ="passwordPASSWORDpassword"
+ s = "saltSALTsaltSALTsaltSALTsaltSALTsalt"
+ c = 4096
+ dk_len = 25
+
+ raw = %w{ 3d 2e ec 4f e4 1c 84 9b
+ 80 c8 d8 36 62 c0 e4 4a
+ 8b 29 1a 96 4c f2 f0 70
+ 38 }
+ expected = [raw.join('')].pack('H*')
+ value = OpenSSL::PKCS5.pbkdf2_hmac_sha1(p, s, c, dk_len)
+ assert_equal(expected, value)
+ end
+
+ def test_pbkdf2_hmac_sha1_rfc6070_c_4096_len_16
+ p ="pass\0word"
+ s = "sa\0lt"
+ c = 4096
+ dk_len = 16
+ raw = %w{ 56 fa 6a a7 55 48 09 9d
+ cc 37 d7 f0 34 25 e0 c3 }
+ expected = [raw.join('')].pack('H*')
+ value = OpenSSL::PKCS5.pbkdf2_hmac_sha1(p, s, c, dk_len)
+ assert_equal(expected, value)
+ end
+
+ def test_pbkdf2_hmac_sha256_c_20000_len_32
+ #unfortunately no official test vectors available yet for SHA-2
+ p ="password"
+ s = OpenSSL::Random.random_bytes(16)
+ c = 20000
+ dk_len = 32
+ digest = OpenSSL::Digest::SHA256.new
+ value1 = OpenSSL::PKCS5.pbkdf2_hmac(p, s, c, dk_len, digest)
+ value2 = OpenSSL::PKCS5.pbkdf2_hmac(p, s, c, dk_len, digest)
+ assert_equal(value1, value2)
+ end if OpenSSL::PKCS5.respond_to?(:pbkdf2_hmac)
+
+end if defined?(OpenSSL)
diff --git a/test/openssl/test_pkcs7.rb b/test/openssl/test_pkcs7.rb
index b17cbda0b2..4a6692a74c 100644
--- a/test/openssl/test_pkcs7.rb
+++ b/test/openssl/test_pkcs7.rb
@@ -146,7 +146,7 @@ class OpenSSL::TestPKCS7 < Test::Unit::TestCase
assert_equal(3, recip[1].serial)
assert_equal(data, p7.decrypt(@rsa1024, @ee2_cert))
end
-
+
def test_graceful_parsing_failure #[ruby-core:43250]
contents = File.read(__FILE__)
assert_raise(ArgumentError) { OpenSSL::PKCS7.new(contents) }
diff --git a/test/openssl/test_pkey_dh.rb b/test/openssl/test_pkey_dh.rb
index bcba400efe..160a131c06 100644
--- a/test/openssl/test_pkey_dh.rb
+++ b/test/openssl/test_pkey_dh.rb
@@ -3,13 +3,23 @@ require_relative 'utils'
if defined?(OpenSSL)
class OpenSSL::TestPKeyDH < Test::Unit::TestCase
+
+ NEW_KEYLEN = 256
+
def test_new
- dh = OpenSSL::PKey::DH.new(256)
+ dh = OpenSSL::PKey::DH.new(NEW_KEYLEN)
assert_key(dh)
end
+ def test_new_break
+ assert_nil(OpenSSL::PKey::DH.new(NEW_KEYLEN) { break })
+ assert_raises(RuntimeError) do
+ OpenSSL::PKey::DH.new(NEW_KEYLEN) { raise }
+ end
+ end
+
def test_to_der
- dh = OpenSSL::PKey::DH.new(256)
+ dh = OpenSSL::TestUtils::TEST_KEY_DH1024
der = dh.to_der
dh2 = OpenSSL::PKey::DH.new(der)
assert_equal_params(dh, dh2)
@@ -17,7 +27,7 @@ class OpenSSL::TestPKeyDH < Test::Unit::TestCase
end
def test_to_pem
- dh = OpenSSL::PKey::DH.new(256)
+ dh = OpenSSL::TestUtils::TEST_KEY_DH1024
pem = dh.to_pem
dh2 = OpenSSL::PKey::DH.new(pem)
assert_equal_params(dh, dh2)
@@ -25,7 +35,7 @@ class OpenSSL::TestPKeyDH < Test::Unit::TestCase
end
def test_public_key
- dh = OpenSSL::PKey::DH.new(256)
+ dh = OpenSSL::TestUtils::TEST_KEY_DH1024
public_key = dh.public_key
assert_no_key(public_key) #implies public_key.public? is false!
assert_equal(dh.to_der, public_key.to_der)
@@ -33,14 +43,14 @@ class OpenSSL::TestPKeyDH < Test::Unit::TestCase
end
def test_generate_key
- dh = OpenSSL::TestUtils::TEST_KEY_DH512.public_key # creates a copy
+ dh = OpenSSL::TestUtils::TEST_KEY_DH512_PUB.public_key # creates a copy
assert_no_key(dh)
dh.generate_key!
assert_key(dh)
end
def test_key_exchange
- dh = OpenSSL::TestUtils::TEST_KEY_DH512
+ dh = OpenSSL::TestUtils::TEST_KEY_DH512_PUB
dh2 = dh.public_key
dh.generate_key!
dh2.generate_key!
diff --git a/test/openssl/test_pkey_dsa.rb b/test/openssl/test_pkey_dsa.rb
index e498e3c03a..555637e7a4 100644
--- a/test/openssl/test_pkey_dsa.rb
+++ b/test/openssl/test_pkey_dsa.rb
@@ -22,6 +22,13 @@ class OpenSSL::TestPKeyDSA < Test::Unit::TestCase
assert_equal([], OpenSSL.errors)
end
+ def test_new_break
+ assert_nil(OpenSSL::PKey::DSA.new(512) { break })
+ assert_raise(RuntimeError) do
+ OpenSSL::PKey::DSA.new(512) { raise }
+ end
+ end
+
def test_sys_sign_verify
key = OpenSSL::TestUtils::TEST_KEY_DSA256
data = 'Sign me!'
@@ -211,6 +218,15 @@ YNMbNw==
assert_equal([], OpenSSL.errors)
end
+ def test_export_password_length
+ key = OpenSSL::TestUtils::TEST_KEY_DSA256
+ assert_raise(OpenSSL::OpenSSLError) do
+ key.export(OpenSSL::Cipher.new('AES-128-CBC'), 'sec')
+ end
+ pem = key.export(OpenSSL::Cipher.new('AES-128-CBC'), 'secr')
+ assert(pem)
+ end
+
private
def check_sign_verify(digest)
diff --git a/test/openssl/test_pkey_ec.rb b/test/openssl/test_pkey_ec.rb
index e63f617140..5ceea4c867 100644
--- a/test/openssl/test_pkey_ec.rb
+++ b/test/openssl/test_pkey_ec.rb
@@ -7,28 +7,29 @@ class OpenSSL::TestEC < Test::Unit::TestCase
@data1 = 'foo'
@data2 = 'bar' * 1000 # data too long for DSA sig
- @group1 = OpenSSL::PKey::EC::Group.new('secp112r1')
- @group2 = OpenSSL::PKey::EC::Group.new('sect163k1')
- @group3 = OpenSSL::PKey::EC::Group.new('prime256v1')
+ @groups = []
+ @keys = []
- @key1 = OpenSSL::PKey::EC.new
- @key1.group = @group1
- @key1.generate_key
+ OpenSSL::PKey::EC.builtin_curves.each do |curve, comment|
+ next if curve.start_with?("Oakley") # Oakley curves are not suitable for ECDSA
+ group = OpenSSL::PKey::EC::Group.new(curve)
- @key2 = OpenSSL::PKey::EC.new(@group2.curve_name)
- @key2.generate_key
+ key = OpenSSL::PKey::EC.new(group)
+ key.generate_key
- @key3 = OpenSSL::PKey::EC.new(@group3)
- @key3.generate_key
-
- @groups = [@group1, @group2, @group3]
- @keys = [@key1, @key2, @key3]
+ @groups << group
+ @keys << key
+ end
end
def compare_keys(k1, k2)
assert_equal(k1.to_pem, k2.to_pem)
end
+ def test_builtin_curves
+ assert(!OpenSSL::PKey::EC.builtin_curves.empty?)
+ end
+
def test_curve_names
@groups.each_with_index do |group, idx|
key = @keys[idx]
@@ -44,11 +45,12 @@ class OpenSSL::TestEC < Test::Unit::TestCase
end
end
- def test_encoding
+ def test_group_encoding
for group in @groups
for meth in [:to_der, :to_pem]
txt = group.send(meth)
gr = OpenSSL::PKey::EC::Group.new(txt)
+
assert_equal(txt, gr.send(meth))
assert_equal(group.generator.to_bn, gr.generator.to_bn)
@@ -58,7 +60,9 @@ class OpenSSL::TestEC < Test::Unit::TestCase
assert_equal(group.degree, gr.degree)
end
end
+ end
+ def test_key_encoding
for key in @keys
group = key.group
@@ -119,7 +123,7 @@ class OpenSSL::TestEC < Test::Unit::TestCase
assert_equal(a, b)
end
end
-
+
def test_read_private_key_der
ec = OpenSSL::TestUtils::TEST_KEY_EC_P256V1
der = ec.to_der
@@ -175,6 +179,31 @@ class OpenSSL::TestEC < Test::Unit::TestCase
assert_equal([], OpenSSL.errors)
end
+ def test_export_password_length
+ key = OpenSSL::TestUtils::TEST_KEY_EC_P256V1
+ assert_raise(OpenSSL::OpenSSLError) do
+ key.export(OpenSSL::Cipher.new('AES-128-CBC'), 'sec')
+ end
+ pem = key.export(OpenSSL::Cipher.new('AES-128-CBC'), 'secr')
+ assert(pem)
+ end
+
+ def test_ec_point_mul
+ ec = OpenSSL::TestUtils::TEST_KEY_EC_P256V1
+ p1 = ec.public_key
+ bn1 = OpenSSL::BN.new('10')
+ bn2 = OpenSSL::BN.new('20')
+
+ p2 = p1.mul(bn1)
+ assert(p1.group == p2.group)
+ p2 = p1.mul(bn1, bn2)
+ assert(p1.group == p2.group)
+ p2 = p1.mul([bn1, bn2], [p1])
+ assert(p1.group == p2.group)
+ p2 = p1.mul([bn1, bn2], [p1], bn2)
+ assert(p1.group == p2.group)
+ end
+
# test Group: asn1_flag, point_conversion
end
diff --git a/test/openssl/test_pkey_rsa.rb b/test/openssl/test_pkey_rsa.rb
index 5ba14229af..1881525c02 100644
--- a/test/openssl/test_pkey_rsa.rb
+++ b/test/openssl/test_pkey_rsa.rb
@@ -48,6 +48,25 @@ class OpenSSL::TestPKeyRSA < Test::Unit::TestCase
assert_equal([], OpenSSL.errors)
end
+ def test_new_exponent_default
+ assert_equal(65537, OpenSSL::PKey::RSA.new(512).e)
+ end
+
+ def test_new_with_exponent
+ 1.upto(30) do |idx|
+ e = (2 ** idx) + 1
+ key = OpenSSL::PKey::RSA.new(512, e)
+ assert_equal(e, key.e)
+ end
+ end
+
+ def test_new_break
+ assert_nil(OpenSSL::PKey::RSA.new(1024) { break })
+ assert_raise(RuntimeError) do
+ OpenSSL::PKey::RSA.new(1024) { raise }
+ end
+ end
+
def test_sign_verify
key = OpenSSL::TestUtils::TEST_KEY_RSA1024
digest = OpenSSL::Digest::SHA1.new
@@ -214,6 +233,26 @@ AwEAAQ==
assert_equal([], OpenSSL.errors)
end
+ def test_read_private_key_pem_pw_exception
+ pem = OpenSSL::TestUtils::TEST_KEY_RSA1024.to_pem(OpenSSL::Cipher.new('AES-128-CBC'), 'secret')
+ # it raises an ArgumentError from PEM reading. The exception raised inside are ignored for now.
+ assert_raise(ArgumentError) do
+ OpenSSL::PKey.read(pem) do
+ raise RuntimeError
+ end
+ end
+ assert_equal([], OpenSSL.errors)
+ end
+
+ def test_export_password_length
+ key = OpenSSL::TestUtils::TEST_KEY_RSA1024
+ assert_raise(OpenSSL::OpenSSLError) do
+ key.export(OpenSSL::Cipher.new('AES-128-CBC'), 'sec')
+ end
+ pem = key.export(OpenSSL::Cipher.new('AES-128-CBC'), 'secr')
+ assert(pem)
+ end
+
private
def check_PUBKEY(asn1, key)
diff --git a/test/openssl/test_ssl.rb b/test/openssl/test_ssl.rb
index cf0f1b7bba..64efa8dd33 100644
--- a/test/openssl/test_ssl.rb
+++ b/test/openssl/test_ssl.rb
@@ -3,6 +3,11 @@ require_relative "utils"
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)
@@ -27,16 +32,14 @@ class OpenSSL::TestSSL < OpenSSL::SSLTestCase
def test_ssl_read_nonblock
start_server(PORT, OpenSSL::SSL::VERIFY_NONE, true) { |server, port|
- sock = TCPSocket.new("127.0.0.1", port)
- ssl = OpenSSL::SSL::SSLSocket.new(sock)
- ssl.sync_close = true
- ssl.connect
- assert_raise(IO::WaitReadable) { ssl.read_nonblock(100) }
- ssl.write("abc\n")
- IO.select [ssl]
- assert_equal('a', ssl.read_nonblock(1))
- assert_equal("bc\n", ssl.read_nonblock(100))
- assert_raise(IO::WaitReadable) { ssl.read_nonblock(100) }
+ server_connect(port) { |ssl|
+ assert_raise(IO::WaitReadable) { ssl.read_nonblock(100) }
+ ssl.write("abc\n")
+ IO.select [ssl]
+ assert_equal('a', ssl.read_nonblock(1))
+ assert_equal("bc\n", ssl.read_nonblock(100))
+ assert_raise(IO::WaitReadable) { ssl.read_nonblock(100) }
+ }
}
end
@@ -60,50 +63,45 @@ class OpenSSL::TestSSL < OpenSSL::SSLTestCase
def test_read_and_write
start_server(PORT, OpenSSL::SSL::VERIFY_NONE, true){|server, port|
- sock = TCPSocket.new("127.0.0.1", port)
- ssl = OpenSSL::SSL::SSLSocket.new(sock)
- ssl.sync_close = true
- ssl.connect
-
- # syswrite and sysread
- ITERATIONS.times{|i|
- str = "x" * 100 + "\n"
- ssl.syswrite(str)
- assert_equal(str, ssl.sysread(str.size))
-
- 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)
- }
+ server_connect(port) { |ssl|
+ # syswrite and sysread
+ ITERATIONS.times{|i|
+ str = "x" * 100 + "\n"
+ ssl.syswrite(str)
+ assert_equal(str, ssl.sysread(str.size))
+
+ 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)
+ }
- # puts and gets
- ITERATIONS.times{
- str = "x" * 100 + "\n"
- ssl.puts(str)
- assert_equal(str, ssl.gets)
+ # puts and gets
+ ITERATIONS.times{
+ str = "x" * 100 + "\n"
+ ssl.puts(str)
+ assert_equal(str, ssl.gets)
- str = "x" * 100
- ssl.puts(str)
- assert_equal(str, ssl.gets("\n", 100))
- assert_equal("\n", ssl.gets)
- }
+ str = "x" * 100
+ ssl.puts(str)
+ assert_equal(str, ssl.gets("\n", 100))
+ assert_equal("\n", ssl.gets)
+ }
- # read and write
- ITERATIONS.times{|i|
- str = "x" * 100 + "\n"
- ssl.write(str)
- assert_equal(str, ssl.read(str.size))
-
- str = "x" * i * 100 + "\n"
- buf = ""
- ssl.write(str)
- assert_equal(buf.object_id, ssl.read(str.size, buf).object_id)
- assert_equal(str, buf)
+ # read and write
+ ITERATIONS.times{|i|
+ str = "x" * 100 + "\n"
+ ssl.write(str)
+ assert_equal(str, ssl.read(str.size))
+
+ str = "x" * i * 100 + "\n"
+ buf = ""
+ ssl.write(str)
+ assert_equal(buf.object_id, ssl.read(str.size, buf).object_id)
+ assert_equal(str, buf)
+ }
}
-
- ssl.close
}
end
@@ -119,13 +117,11 @@ class OpenSSL::TestSSL < OpenSSL::SSLTestCase
ctx = OpenSSL::SSL::SSLContext.new
ctx.key = @cli_key
ctx.cert = @cli_cert
- sock = TCPSocket.new("127.0.0.1", port)
- ssl = OpenSSL::SSL::SSLSocket.new(sock, ctx)
- ssl.sync_close = true
- ssl.connect
- ssl.puts("foo")
- assert_equal("foo\n", ssl.gets)
- ssl.close
+
+ server_connect(port, ctx) { |ssl|
+ ssl.puts("foo")
+ assert_equal("foo\n", ssl.gets)
+ }
called = nil
ctx = OpenSSL::SSL::SSLContext.new
@@ -133,14 +129,12 @@ class OpenSSL::TestSSL < OpenSSL::SSLTestCase
called = true
[@cli_cert, @cli_key]
}
- sock = TCPSocket.new("127.0.0.1", port)
- ssl = OpenSSL::SSL::SSLSocket.new(sock, ctx)
- ssl.sync_close = true
- ssl.connect
- assert(called)
- ssl.puts("foo")
- assert_equal("foo\n", ssl.gets)
- ssl.close
+
+ server_connect(port, ctx) { |ssl|
+ assert(called)
+ ssl.puts("foo")
+ assert_equal("foo\n", ssl.gets)
+ }
}
end
@@ -157,12 +151,7 @@ class OpenSSL::TestSSL < OpenSSL::SSLTestCase
client_ca_from_server = sslconn.client_ca
[@cli_cert, @cli_key]
end
- sock = TCPSocket.new("127.0.0.1", port)
- ssl = OpenSSL::SSL::SSLSocket.new(sock, ctx)
- ssl.sync_close = true
- ssl.connect
- assert_equal([@ca], client_ca_from_server)
- ssl.close
+ server_connect(port, ctx) { |ssl| assert_equal([@ca], client_ca_from_server) }
}
end
@@ -273,7 +262,7 @@ class OpenSSL::TestSSL < OpenSSL::SSLTestCase
ctx = OpenSSL::SSL::SSLContext.new
ctx.set_params
assert_equal(OpenSSL::SSL::VERIFY_PEER, ctx.verify_mode)
- assert_equal(OpenSSL::SSL::OP_ALL, ctx.options)
+ assert_equal(TLS_DEFAULT_OPS, ctx.options)
ciphers = ctx.ciphers
ciphers_versions = ciphers.collect{|_, v, _, _| v }
ciphers_names = ciphers.collect{|v, _, _, _| v }
@@ -289,19 +278,18 @@ class OpenSSL::TestSSL < OpenSSL::SSLTestCase
sslerr = OpenSSL::SSL::SSLError
start_server(PORT, OpenSSL::SSL::VERIFY_NONE, true){|server, port|
- sock = TCPSocket.new("127.0.0.1", port)
- ssl = OpenSSL::SSL::SSLSocket.new(sock)
- ssl.connect
- assert_raise(sslerr){ssl.post_connection_check("localhost.localdomain")}
- assert_raise(sslerr){ssl.post_connection_check("127.0.0.1")}
- assert(ssl.post_connection_check("localhost"))
- assert_raise(sslerr){ssl.post_connection_check("foo.example.com")}
-
- cert = ssl.peer_cert
- assert(!OpenSSL::SSL.verify_certificate_identity(cert, "localhost.localdomain"))
- assert(!OpenSSL::SSL.verify_certificate_identity(cert, "127.0.0.1"))
- assert(OpenSSL::SSL.verify_certificate_identity(cert, "localhost"))
- assert(!OpenSSL::SSL.verify_certificate_identity(cert, "foo.example.com"))
+ server_connect(port) { |ssl|
+ assert_raise(sslerr){ssl.post_connection_check("localhost.localdomain")}
+ assert_raise(sslerr){ssl.post_connection_check("127.0.0.1")}
+ assert(ssl.post_connection_check("localhost"))
+ assert_raise(sslerr){ssl.post_connection_check("foo.example.com")}
+
+ cert = ssl.peer_cert
+ assert(!OpenSSL::SSL.verify_certificate_identity(cert, "localhost.localdomain"))
+ assert(!OpenSSL::SSL.verify_certificate_identity(cert, "127.0.0.1"))
+ assert(OpenSSL::SSL.verify_certificate_identity(cert, "localhost"))
+ assert(!OpenSSL::SSL.verify_certificate_identity(cert, "foo.example.com"))
+ }
}
now = Time.now
@@ -313,19 +301,18 @@ class OpenSSL::TestSSL < OpenSSL::SSLTestCase
@svr_cert = issue_cert(@svr, @svr_key, 4, now, now+1800, exts,
@ca_cert, @ca_key, OpenSSL::Digest::SHA1.new)
start_server(PORT, OpenSSL::SSL::VERIFY_NONE, true){|server, port|
- sock = TCPSocket.new("127.0.0.1", port)
- ssl = OpenSSL::SSL::SSLSocket.new(sock)
- ssl.connect
- assert(ssl.post_connection_check("localhost.localdomain"))
- assert(ssl.post_connection_check("127.0.0.1"))
- assert_raise(sslerr){ssl.post_connection_check("localhost")}
- assert_raise(sslerr){ssl.post_connection_check("foo.example.com")}
-
- cert = ssl.peer_cert
- assert(OpenSSL::SSL.verify_certificate_identity(cert, "localhost.localdomain"))
- assert(OpenSSL::SSL.verify_certificate_identity(cert, "127.0.0.1"))
- assert(!OpenSSL::SSL.verify_certificate_identity(cert, "localhost"))
- assert(!OpenSSL::SSL.verify_certificate_identity(cert, "foo.example.com"))
+ server_connect(port) { |ssl|
+ assert(ssl.post_connection_check("localhost.localdomain"))
+ assert(ssl.post_connection_check("127.0.0.1"))
+ assert_raise(sslerr){ssl.post_connection_check("localhost")}
+ assert_raise(sslerr){ssl.post_connection_check("foo.example.com")}
+
+ cert = ssl.peer_cert
+ assert(OpenSSL::SSL.verify_certificate_identity(cert, "localhost.localdomain"))
+ assert(OpenSSL::SSL.verify_certificate_identity(cert, "127.0.0.1"))
+ assert(!OpenSSL::SSL.verify_certificate_identity(cert, "localhost"))
+ assert(!OpenSSL::SSL.verify_certificate_identity(cert, "foo.example.com"))
+ }
}
now = Time.now
@@ -336,21 +323,49 @@ class OpenSSL::TestSSL < OpenSSL::SSLTestCase
@svr_cert = issue_cert(@svr, @svr_key, 5, now, now+1800, exts,
@ca_cert, @ca_key, OpenSSL::Digest::SHA1.new)
start_server(PORT, OpenSSL::SSL::VERIFY_NONE, true){|server, port|
- sock = TCPSocket.new("127.0.0.1", port)
- ssl = OpenSSL::SSL::SSLSocket.new(sock)
- ssl.connect
- assert(ssl.post_connection_check("localhost.localdomain"))
- assert_raise(sslerr){ssl.post_connection_check("127.0.0.1")}
- assert_raise(sslerr){ssl.post_connection_check("localhost")}
- assert_raise(sslerr){ssl.post_connection_check("foo.example.com")}
- cert = ssl.peer_cert
- assert(OpenSSL::SSL.verify_certificate_identity(cert, "localhost.localdomain"))
- assert(!OpenSSL::SSL.verify_certificate_identity(cert, "127.0.0.1"))
- assert(!OpenSSL::SSL.verify_certificate_identity(cert, "localhost"))
- assert(!OpenSSL::SSL.verify_certificate_identity(cert, "foo.example.com"))
+ server_connect(port) { |ssl|
+ assert(ssl.post_connection_check("localhost.localdomain"))
+ assert_raise(sslerr){ssl.post_connection_check("127.0.0.1")}
+ assert_raise(sslerr){ssl.post_connection_check("localhost")}
+ assert_raise(sslerr){ssl.post_connection_check("foo.example.com")}
+ cert = ssl.peer_cert
+ assert(OpenSSL::SSL.verify_certificate_identity(cert, "localhost.localdomain"))
+ assert(!OpenSSL::SSL.verify_certificate_identity(cert, "127.0.0.1"))
+ assert(!OpenSSL::SSL.verify_certificate_identity(cert, "localhost"))
+ assert(!OpenSSL::SSL.verify_certificate_identity(cert, "foo.example.com"))
+ }
}
end
+ def test_verify_certificate_identity
+ [true, false].each do |criticality|
+ cert = create_null_byte_SAN_certificate(criticality)
+ assert_equal(false, OpenSSL::SSL.verify_certificate_identity(cert, 'www.example.com'))
+ assert_equal(true, OpenSSL::SSL.verify_certificate_identity(cert, "www.example.com\0.evil.com"))
+ assert_equal(false, OpenSSL::SSL.verify_certificate_identity(cert, '192.168.7.255'))
+ assert_equal(true, OpenSSL::SSL.verify_certificate_identity(cert, '192.168.7.1'))
+ assert_equal(false, OpenSSL::SSL.verify_certificate_identity(cert, '13::17'))
+ assert_equal(true, OpenSSL::SSL.verify_certificate_identity(cert, '13:0:0:0:0:0:0:17'))
+ end
+ end
+
+ # Create NULL byte SAN certificate
+ def create_null_byte_SAN_certificate(critical = false)
+ ef = OpenSSL::X509::ExtensionFactory.new
+ cert = OpenSSL::X509::Certificate.new
+ cert.subject = OpenSSL::X509::Name.parse "/DC=some/DC=site/CN=Some Site"
+ ext = ef.create_ext('subjectAltName', 'DNS:placeholder,IP:192.168.7.1,IP:13::17', critical)
+ ext_asn1 = OpenSSL::ASN1.decode(ext.to_der)
+ san_list_der = ext_asn1.value.reduce(nil) { |memo,val| val.tag == 4 ? val.value : memo }
+ san_list_asn1 = OpenSSL::ASN1.decode(san_list_der)
+ san_list_asn1.value[0].value = "www.example.com\0.evil.com"
+ pos = critical ? 2 : 1
+ ext_asn1.value[pos].value = san_list_asn1.to_der
+ real_ext = OpenSSL::X509::Extension.new ext_asn1
+ cert.add_extension(real_ext)
+ cert
+ end
+
def test_tlsext_hostname
return unless OpenSSL::SSL::SSLSocket.instance_methods.include?(:hostname)
@@ -375,22 +390,17 @@ class OpenSSL::TestSSL < OpenSSL::SSLTestCase
start_server(PORT, OpenSSL::SSL::VERIFY_NONE, true, :ctx_proc => ctx_proc, :server_proc => server_proc) do |server, port|
2.times do |i|
- sock = TCPSocket.new("127.0.0.1", port)
ctx = OpenSSL::SSL::SSLContext.new
if defined?(OpenSSL::SSL::OP_NO_TICKET)
# disable RFC4507 support
ctx.options = OpenSSL::SSL::OP_NO_TICKET
end
- ssl = OpenSSL::SSL::SSLSocket.new(sock, ctx)
- ssl.sync_close = true
- ssl.hostname = (i & 1 == 0) ? 'foo.example.com' : 'bar.example.com'
- ssl.connect
-
- str = "x" * 100 + "\n"
- ssl.puts(str)
- assert_equal(str, ssl.gets)
-
- ssl.close
+ server_connect(port, ctx) { |ssl|
+ ssl.hostname = (i & 1 == 0) ? 'foo.example.com' : 'bar.example.com'
+ str = "x" * 100 + "\n"
+ ssl.puts(str)
+ assert_equal(str, ssl.gets)
+ }
end
end
end
@@ -412,32 +422,205 @@ class OpenSSL::TestSSL < OpenSSL::SSLTestCase
ssl.close
}
start_server(PORT, OpenSSL::SSL::VERIFY_NONE, true, :server_proc => server_proc){|server, port|
- sock = TCPSocket.new("127.0.0.1", port)
- ssl = OpenSSL::SSL::SSLSocket.new(sock)
- ssl.sync_close = true
- ssl.connect
- str = auml * i
- num_written = ssl.write(str)
- ssl.close
+ server_connect(port) { |ssl|
+ str = auml * i
+ num_written = ssl.write(str)
+ }
}
}
end
def test_unset_OP_ALL
ctx_proc = Proc.new { |ctx|
- ctx.options = OpenSSL::SSL::OP_ALL & ~OpenSSL::SSL::OP_DONT_INSERT_EMPTY_FRAGMENTS
+ # If OP_DONT_INSERT_EMPTY_FRAGMENTS is not defined, this test is
+ # redundant because the default options already are equal to OP_ALL.
+ # But it also degrades gracefully, so keep it
+ ctx.options = OpenSSL::SSL::OP_ALL
}
start_server(PORT, OpenSSL::SSL::VERIFY_NONE, true, :ctx_proc => ctx_proc){|server, port|
- sock = TCPSocket.new("127.0.0.1", port)
- ssl = OpenSSL::SSL::SSLSocket.new(sock)
- ssl.sync_close = true
- ssl.connect
- ssl.puts('hello')
- assert_equal("hello\n", ssl.gets)
- ssl.close
+ server_connect(port) { |ssl|
+ ssl.puts('hello')
+ assert_equal("hello\n", ssl.gets)
+ }
+ }
+ end
+
+ # different OpenSSL versions react differently when facing a SSL/TLS version
+ # that has been marked as forbidden, therefore either of these may be raised
+ HANDSHAKE_ERRORS = [OpenSSL::SSL::SSLError, Errno::ECONNRESET]
+
+if OpenSSL::SSL::SSLContext::METHODS.include? :TLSv1
+
+ def test_forbid_ssl_v3_for_client
+ ctx_proc = Proc.new { |ctx| ctx.options = OpenSSL::SSL::OP_ALL | OpenSSL::SSL::OP_NO_SSLv3 }
+ start_server_version(:SSLv23, ctx_proc) { |server, port|
+ ctx = OpenSSL::SSL::SSLContext.new
+ ctx.ssl_version = :SSLv3
+ assert_raise(*HANDSHAKE_ERRORS) { server_connect(port, ctx) }
+ }
+ end
+
+ def test_forbid_ssl_v3_from_server
+ start_server_version(:SSLv3) { |server, port|
+ ctx = OpenSSL::SSL::SSLContext.new
+ ctx.options = OpenSSL::SSL::OP_ALL | OpenSSL::SSL::OP_NO_SSLv3
+ assert_raise(*HANDSHAKE_ERRORS) { server_connect(port, ctx) }
+ }
+ end
+
+end
+
+if OpenSSL::SSL::SSLContext::METHODS.include? :TLSv1_1
+
+ def test_tls_v1_1
+ start_server_version(:TLSv1_1) { |server, port|
+ server_connect(port) { |ssl| assert_equal("TLSv1.1", ssl.ssl_version) }
+ }
+ end
+
+ def test_forbid_tls_v1_for_client
+ ctx_proc = Proc.new { |ctx| ctx.options = OpenSSL::SSL::OP_ALL | OpenSSL::SSL::OP_NO_TLSv1 }
+ start_server_version(:SSLv23, ctx_proc) { |server, port|
+ ctx = OpenSSL::SSL::SSLContext.new
+ ctx.ssl_version = :TLSv1
+ assert_raise(*HANDSHAKE_ERRORS) { server_connect(port, ctx) }
+ }
+ end
+
+ def test_forbid_tls_v1_from_server
+ start_server_version(:TLSv1) { |server, port|
+ ctx = OpenSSL::SSL::SSLContext.new
+ ctx.options = OpenSSL::SSL::OP_ALL | OpenSSL::SSL::OP_NO_TLSv1
+ assert_raise(*HANDSHAKE_ERRORS) { server_connect(port, ctx) }
+ }
+ end
+
+end
+
+if OpenSSL::SSL::SSLContext::METHODS.include? :TLSv1_2
+
+ def test_tls_v1_2
+ start_server_version(:TLSv1_2) { |server, port|
+ ctx = OpenSSL::SSL::SSLContext.new
+ ctx.ssl_version = :TLSv1_2_client
+ server_connect(port, ctx) { |ssl| assert_equal("TLSv1.2", ssl.ssl_version) }
+ }
+ end if OpenSSL::OPENSSL_VERSION_NUMBER > 0x10001000
+
+ def test_forbid_tls_v1_1_for_client
+ ctx_proc = Proc.new { |ctx| ctx.options = OpenSSL::SSL::OP_ALL | OpenSSL::SSL::OP_NO_TLSv1_1 }
+ start_server_version(:SSLv23, ctx_proc) { |server, port|
+ ctx = OpenSSL::SSL::SSLContext.new
+ ctx.ssl_version = :TLSv1_1
+ assert_raise(*HANDSHAKE_ERRORS) { server_connect(port, ctx) }
+ }
+ end if defined?(OpenSSL::SSL::OP_NO_TLSv1_1)
+
+ def test_forbid_tls_v1_1_from_server
+ start_server_version(:TLSv1_1) { |server, port|
+ ctx = OpenSSL::SSL::SSLContext.new
+ ctx.options = OpenSSL::SSL::OP_ALL | OpenSSL::SSL::OP_NO_TLSv1_1
+ assert_raise(*HANDSHAKE_ERRORS) { server_connect(port, ctx) }
+ }
+ end if defined?(OpenSSL::SSL::OP_NO_TLSv1_1)
+
+ def test_forbid_tls_v1_2_for_client
+ ctx_proc = Proc.new { |ctx| ctx.options = OpenSSL::SSL::OP_ALL | OpenSSL::SSL::OP_NO_TLSv1_2 }
+ start_server_version(:SSLv23, ctx_proc) { |server, port|
+ ctx = OpenSSL::SSL::SSLContext.new
+ ctx.ssl_version = :TLSv1_2
+ assert_raise(*HANDSHAKE_ERRORS) { server_connect(port, ctx) }
+ }
+ end if defined?(OpenSSL::SSL::OP_NO_TLSv1_2)
+
+ def test_forbid_tls_v1_2_from_server
+ start_server_version(:TLSv1_2) { |server, port|
+ ctx = OpenSSL::SSL::SSLContext.new
+ ctx.options = OpenSSL::SSL::OP_ALL | OpenSSL::SSL::OP_NO_TLSv1_2
+ assert_raise(*HANDSHAKE_ERRORS) { server_connect(port, ctx) }
+ }
+ end if defined?(OpenSSL::SSL::OP_NO_TLSv1_2)
+
+end
+
+ def test_renegotiation_cb
+ num_handshakes = 0
+ renegotiation_cb = Proc.new { |ssl| num_handshakes += 1 }
+ ctx_proc = Proc.new { |ctx| ctx.renegotiation_cb = renegotiation_cb }
+ start_server_version(:SSLv23, ctx_proc) { |server, port|
+ server_connect(port) { |ssl|
+ assert_equal(1, num_handshakes)
+ }
+ }
+ end
+
+if OpenSSL::OPENSSL_VERSION_NUMBER > 0x10001000
+
+ def test_npn_protocol_selection_ary
+ advertised = ["http/1.1", "spdy/2"]
+ ctx_proc = Proc.new { |ctx| ctx.npn_protocols = advertised }
+ start_server_version(:SSLv23, ctx_proc) { |server, port|
+ selector = lambda { |which|
+ ctx = OpenSSL::SSL::SSLContext.new
+ ctx.npn_select_cb = -> (protocols) { protocols.send(which) }
+ server_connect(port, ctx) { |ssl|
+ assert_equal(advertised.send(which), ssl.npn_protocol)
+ }
+ }
+ selector.call(:first)
+ selector.call(:last)
+ }
+ end
+
+ def test_npn_protocol_selection_enum
+ advertised = Object.new
+ def advertised.each
+ yield "http/1.1"
+ yield "spdy/2"
+ end
+ ctx_proc = Proc.new { |ctx| ctx.npn_protocols = advertised }
+ start_server_version(:SSLv23, ctx_proc) { |server, port|
+ selector = lambda { |selected, which|
+ ctx = OpenSSL::SSL::SSLContext.new
+ ctx.npn_select_cb = -> (protocols) { protocols.to_a.send(which) }
+ server_connect(port, ctx) { |ssl|
+ assert_equal(selected, ssl.npn_protocol)
+ }
+ }
+ selector.call("http/1.1", :first)
+ selector.call("spdy/2", :last)
+ }
+ end
+
+ def test_npn_protocol_selection_cancel
+ ctx_proc = Proc.new { |ctx| ctx.npn_protocols = ["http/1.1"] }
+ start_server_version(:SSLv23, ctx_proc) { |server, port|
+ ctx = OpenSSL::SSL::SSLContext.new
+ ctx.npn_select_cb = -> (protocols) { raise RuntimeError.new }
+ assert_raise(RuntimeError) { server_connect(port, ctx) }
}
end
+ def test_npn_advertised_protocol_too_long
+ ctx_proc = Proc.new { |ctx| ctx.npn_protocols = ["a" * 256] }
+ start_server_version(:SSLv23, ctx_proc) { |server, port|
+ ctx = OpenSSL::SSL::SSLContext.new
+ ctx.npn_select_cb = -> (protocols) { protocols.first }
+ assert_raise(*HANDSHAKE_ERRORS) { server_connect(port, ctx) }
+ }
+ end
+
+ def test_npn_selected_protocol_too_long
+ ctx_proc = Proc.new { |ctx| ctx.npn_protocols = ["http/1.1"] }
+ start_server_version(:SSLv23, ctx_proc) { |server, port|
+ ctx = OpenSSL::SSL::SSLContext.new
+ ctx.npn_select_cb = -> (protocols) { "a" * 256 }
+ assert_raise(*HANDSHAKE_ERRORS) { server_connect(port, ctx) }
+ }
+ end
+
+end
+
def test_invalid_shutdown_by_gc
assert_nothing_raised {
start_server(PORT, OpenSSL::SSL::VERIFY_NONE, true){|server, port|
@@ -465,6 +648,32 @@ class OpenSSL::TestSSL < OpenSSL::SSLTestCase
}
end
+ private
+
+ def start_server_version(version, ctx_proc=nil, server_proc=nil, &blk)
+ ctx_wrap = Proc.new { |ctx|
+ ctx.ssl_version = version
+ ctx_proc.call(ctx) if ctx_proc
+ }
+ start_server(
+ PORT,
+ OpenSSL::SSL::VERIFY_NONE,
+ true,
+ :ctx_proc => ctx_wrap,
+ :server_proc => server_proc,
+ &blk
+ )
+ end
+
+ def server_connect(port, ctx=nil)
+ sock = TCPSocket.new("127.0.0.1", port)
+ ssl = ctx ? OpenSSL::SSL::SSLSocket.new(sock, ctx) : OpenSSL::SSL::SSLSocket.new(sock)
+ ssl.sync_close = true
+ ssl.connect
+ yield ssl
+ ensure
+ ssl.close
+ end
end
end
diff --git a/test/openssl/test_ssl_session.rb b/test/openssl/test_ssl_session.rb
index 12c6152f9b..69a3a0d876 100644
--- a/test/openssl/test_ssl_session.rb
+++ b/test/openssl/test_ssl_session.rb
@@ -3,6 +3,43 @@ require_relative "utils"
if defined?(OpenSSL)
class OpenSSL::TestSSLSession < OpenSSL::SSLTestCase
+ def test_session_equals
+ session = OpenSSL::SSL::Session.new <<-SESSION
+-----BEGIN SSL SESSION PARAMETERS-----
+MIIDFgIBAQICAwEEAgA5BCCY3pW6iTkPoD5SENuztz/gZjhvey6XnHbsxd22k0Ol
+dgQw8uaN3hCRnlhoIKPWInCFzrp/tQsDRFs9jDjc9pwpy/oKHmJdQQMQA1g8FYnO
+gpdVoQYCBE52ikKiBAICASyjggKOMIICijCCAXKgAwIBAgIBAjANBgkqhkiG9w0B
+AQUFADA9MRMwEQYKCZImiZPyLGQBGRYDb3JnMRkwFwYKCZImiZPyLGQBGRYJcnVi
+eS1sYW5nMQswCQYDVQQDDAJDQTAeFw0xMTA5MTkwMDE4MTBaFw0xMTA5MTkwMDQ4
+MTBaMEQxEzARBgoJkiaJk/IsZAEZFgNvcmcxGTAXBgoJkiaJk/IsZAEZFglydWJ5
+LWxhbmcxEjAQBgNVBAMMCWxvY2FsaG9zdDCBnzANBgkqhkiG9w0BAQEFAAOBjQAw
+gYkCgYEAy8LEsNRApz7U/j5DoB4XBgO9Z8Atv5y/OVQRp0ag8Tqo1YewsWijxEWB
+7JOATwpBN267U4T1nPZIxxEEO7n/WNa2ws9JWsjah8ssEBFSxZqdXKSLf0N4Hi7/
+GQ/aYoaMCiQ8jA4jegK2FJmXM71uPe+jFN/peeBOpRfyXxRFOYcCAwEAAaMSMBAw
+DgYDVR0PAQH/BAQDAgWgMA0GCSqGSIb3DQEBBQUAA4IBAQARC7GP7InX1t7VEXz2
+I8RI57S0/HSJL4fDIYP3zFpitHX1PZeo+7XuzMilvPjjBo/ky9Jzo8TYiY+N+JEz
+mY/A/zPA4ZsJ7KYj6/FEdIc/vRlS0CvsbClbNjw1jl/PoB2FLr2b3uuBcZEsyZeP
+yq154ijq37Ajf8K5Mi5FgshoP41BPtRPj+VVf61rv1IcEnNWdDCS6DR4XsaNC+zt
+G6AqCqkytIXWRuDw6n6vYLF3A/tn2sldLo7/scY0PMDNbo63O/LTxkDHmPhSkD68
+8m9SsMeTR+RCiDEZWFPVcAH/8mDfi+5k8uN3qS+gOU/PPrmHGgl5ykiSFgqs4v61
+tddwpBAEDjcwMzA5NTYzMTU1MzAwpQMCARM=
+-----END SSL SESSION PARAMETERS-----
+ SESSION
+
+ start_server(PORT, OpenSSL::SSL::VERIFY_NONE, true) { |_, port|
+ ctx = OpenSSL::SSL::SSLContext.new
+ ctx.session_cache_mode = OpenSSL::SSL::SSLContext::SESSION_CACHE_CLIENT
+ ctx.session_id_context = self.object_id.to_s
+
+ sock = TCPSocket.new '127.0.0.1', port
+ ssl = OpenSSL::SSL::SSLSocket.new sock, ctx
+ ssl.session = session
+
+ assert_equal session, ssl.session
+ sock.close
+ }
+ end
+
def test_session
start_server(PORT, OpenSSL::SSL::VERIFY_NONE, true) do |server, port|
sock = TCPSocket.new("127.0.0.1", port)
@@ -98,7 +135,7 @@ __EOS__
def test_session_timeout
sess = OpenSSL::SSL::Session.new(DUMMY_SESSION_NO_EXT)
assert_raise(TypeError) do
- sess.timeout = (now = Time.now)
+ sess.timeout = Time.now
end
sess.timeout = 1
assert_equal(1, sess.timeout.to_i)
@@ -300,8 +337,8 @@ __EOS__
}
server_proc = Proc.new { |c, ssl|
- session = ssl.session
- stats = c.session_cache_stats
+ ssl.session
+ c.session_cache_stats
readwrite_loop(c, ssl)
}
start_server(PORT, OpenSSL::SSL::VERIFY_NONE, true, :ctx_proc => ctx_proc, :server_proc => server_proc) do |server, port|
@@ -314,9 +351,12 @@ __EOS__
ssl.connect
last_client_session = ssl.session
ssl.close
- Thread.pass # try to ensure server calls callbacks
- assert(called.delete(:new))
- assert(called.delete(:remove))
+ timeout(5) do
+ Thread.pass until called.key?(:new)
+ assert(called.delete(:new))
+ Thread.pass until called.key?(:remove)
+ assert(called.delete(:remove))
+ end
end
end
assert(called[:get1])
diff --git a/test/openssl/test_x509cert.rb b/test/openssl/test_x509cert.rb
index 80c31f4d13..dd5751eb48 100644
--- a/test/openssl/test_x509cert.rb
+++ b/test/openssl/test_x509cert.rb
@@ -38,9 +38,10 @@ class OpenSSL::TestX509Certificate < Test::Unit::TestCase
]
sha1 = OpenSSL::Digest::SHA1.new
- dss1 = OpenSSL::Digest::DSS1.new
+ dsa_digest = OpenSSL::TestUtils::DSA_SIGNATURE_DIGEST.new
+
[
- [@rsa1024, sha1], [@rsa2048, sha1], [@dsa256, dss1], [@dsa512, dss1],
+ [@rsa1024, sha1], [@rsa2048, sha1], [@dsa256, dsa_digest], [@dsa512, dsa_digest]
].each{|pk, digest|
cert = issue_cert(@ca, pk, 1, Time.now, Time.now+3600, exts,
nil, nil, digest)
@@ -145,7 +146,7 @@ class OpenSSL::TestX509Certificate < Test::Unit::TestCase
assert_equal(false, cert.verify(@rsa2048))
cert = issue_cert(@ca, @dsa512, 1, Time.now, Time.now+3600, [],
- nil, nil, OpenSSL::Digest::DSS1.new)
+ nil, nil, OpenSSL::TestUtils::DSA_SIGNATURE_DIGEST.new)
assert_equal(false, certificate_error_returns_false { cert.verify(@rsa1024) })
assert_equal(false, certificate_error_returns_false { cert.verify(@rsa2048) })
assert_equal(false, cert.verify(@dsa256))
@@ -166,20 +167,20 @@ class OpenSSL::TestX509Certificate < Test::Unit::TestCase
end
assert_raise(OpenSSL::X509::CertificateError){
- cert = issue_cert(@ca, @dsa512, 1, Time.now, Time.now+3600, [],
- nil, nil, OpenSSL::Digest::MD5.new)
+ issue_cert(@ca, @dsa512, 1, Time.now, Time.now+3600, [],
+ nil, nil, OpenSSL::Digest::MD5.new)
}
end
def test_dsig_algorithm_mismatch
assert_raise(OpenSSL::X509::CertificateError) do
- cert = issue_cert(@ca, @rsa2048, 1, Time.now, Time.now+3600, [],
- nil, nil, OpenSSL::Digest::DSS1.new)
+ issue_cert(@ca, @rsa2048, 1, Time.now, Time.now+3600, [],
+ nil, nil, OpenSSL::Digest::DSS1.new)
end if OpenSSL::OPENSSL_VERSION_NUMBER < 0x10001000 # [ruby-core:42949]
assert_raise(OpenSSL::X509::CertificateError) do
- cert = issue_cert(@ca, @dsa512, 1, Time.now, Time.now+3600, [],
- nil, nil, OpenSSL::Digest::MD5.new)
+ issue_cert(@ca, @dsa512, 1, Time.now, Time.now+3600, [],
+ nil, nil, OpenSSL::Digest::MD5.new)
end
end
diff --git a/test/openssl/test_x509crl.rb b/test/openssl/test_x509crl.rb
index 56508e0a12..d5024751d2 100644
--- a/test/openssl/test_x509crl.rb
+++ b/test/openssl/test_x509crl.rb
@@ -101,7 +101,6 @@ class OpenSSL::TestX509CRL < Test::Unit::TestCase
assert_equal(false, revoked[3].extensions[0].critical?)
assert_equal(false, revoked[4].extensions[0].critical?)
- crl = OpenSSL::X509::CRL.new(crl.to_der)
assert_equal("Key Compromise", revoked[0].extensions[0].value)
assert_equal("CA Compromise", revoked[1].extensions[0].value)
assert_equal("Affiliation Changed", revoked[2].extensions[0].value)
@@ -198,9 +197,9 @@ class OpenSSL::TestX509CRL < Test::Unit::TestCase
assert_equal(false, crl.verify(@rsa2048))
cert = issue_cert(@ca, @dsa512, 1, Time.now, Time.now+3600, [],
- nil, nil, OpenSSL::Digest::DSS1.new)
+ nil, nil, OpenSSL::TestUtils::DSA_SIGNATURE_DIGEST.new)
crl = issue_crl([], 1, Time.now, Time.now+1600, [],
- cert, @dsa512, OpenSSL::Digest::DSS1.new)
+ cert, @dsa512, OpenSSL::TestUtils::DSA_SIGNATURE_DIGEST.new)
assert_equal(false, crl_error_returns_false { crl.verify(@rsa1024) })
assert_equal(false, crl_error_returns_false { crl.verify(@rsa2048) })
assert_equal(false, crl.verify(@dsa256))
diff --git a/test/openssl/test_x509name.rb b/test/openssl/test_x509name.rb
index 90c09929ce..de35fc303a 100644
--- a/test/openssl/test_x509name.rb
+++ b/test/openssl/test_x509name.rb
@@ -1,3 +1,4 @@
+# coding: US-ASCII
require_relative 'utils'
if defined?(OpenSSL)
@@ -339,7 +340,7 @@ class OpenSSL::TestX509Name < Test::Unit::TestCase
n1 = OpenSSL::X509::Name.parse 'CN=a'
n2 = OpenSSL::X509::Name.parse 'CN=b'
- assert_equal -1, n1 <=> n2
+ assert_equal(-1, n1 <=> n2)
end
def name_hash(name)
diff --git a/test/openssl/test_x509req.rb b/test/openssl/test_x509req.rb
index 882a1d7356..e6c89c5e81 100644
--- a/test/openssl/test_x509req.rb
+++ b/test/openssl/test_x509req.rb
@@ -26,7 +26,7 @@ class OpenSSL::TestX509Request < Test::Unit::TestCase
req = OpenSSL::X509::Request.new(req.to_der)
assert_equal(@rsa1024.public_key.to_der, req.public_key.to_der)
- req = issue_csr(0, @dn, @dsa512, OpenSSL::Digest::DSS1.new)
+ req = issue_csr(0, @dn, @dsa512, OpenSSL::TestUtils::DSA_SIGNATURE_DIGEST.new)
assert_equal(@dsa512.public_key.to_der, req.public_key.to_der)
req = OpenSSL::X509::Request.new(req.to_der)
assert_equal(@dsa512.public_key.to_der, req.public_key.to_der)
@@ -115,7 +115,7 @@ class OpenSSL::TestX509Request < Test::Unit::TestCase
req.subject = OpenSSL::X509::Name.parse("/C=JP/CN=FooBar")
assert_equal(false, req.verify(@rsa2048))
- req = issue_csr(0, @dn, @dsa512, OpenSSL::Digest::DSS1.new)
+ 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) })
assert_equal(false, req.verify(@dsa256))
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 c4c0a0c040..ba9714b3fc 100644
--- a/test/openssl/utils.rb
+++ b/test/openssl/utils.rb
@@ -1,5 +1,10 @@
begin
require "openssl"
+
+ # Disable FIPS mode for tests for installations
+ # where FIPS mode would be enabled by default.
+ # Has no effect on all other installations.
+ OpenSSL.fips_mode=false
rescue LoadError
end
require "test/unit"
@@ -92,13 +97,27 @@ CeBUl+MahZtn9fO1JKdF4qJmS39dXnpENg==
end
- TEST_KEY_DH512 = OpenSSL::PKey::DH.new <<-_end_of_pem_
+ TEST_KEY_DH512_PUB = OpenSSL::PKey::DH.new <<-_end_of_pem_
-----BEGIN DH PARAMETERS-----
MEYCQQDmWXGPqk76sKw/edIOdhAQD4XzjJ+AR/PTk2qzaGs+u4oND2yU5D2NN4wr
aPgwHyJBiK1/ebK3tYcrSKrOoRyrAgEC
-----END DH PARAMETERS-----
_end_of_pem_
+ TEST_KEY_DH1024 = OpenSSL::PKey::DH.new <<-_end_of_pem_
+-----BEGIN DH PARAMETERS-----
+MIGHAoGBAKnKQ8MNK6nYZzLrrcuTsLxuiJGXoOO5gT+tljOTbHBuiktdMTITzIY0
+pFxIvjG05D7HoBZQfrR0c92NGWPkAiCkhQKB8JCbPVzwNLDy6DZ0pmofDKrEsYHG
+AQjjxMXhwULlmuR/K+WwlaZPiLIBYalLAZQ7ZbOPeVkJ8ePao0eLAgEC
+-----END DH PARAMETERS-----
+ _end_of_pem_
+
+ TEST_KEY_DH1024.priv_key = OpenSSL::BN.new("48561834C67E65FFD2A9B47F41E5E78FDC95C387428FDB1E4B0188B64D1643C3A8D3455B945B7E8C4D166010C7C2CE23BFB9BEF43D0348FE7FA5284B0225E7FE1537546D114E3D8A4411B9B9351AB451E1A358F50ED61B1F00DA29336EEBBD649980AC86D76AF8BBB065298C2052672EEF3EF13AB47A15275FC2836F3AC74CEA", 16)
+
+ DSA_SIGNATURE_DIGEST = OpenSSL::OPENSSL_VERSION_NUMBER > 0x10000000 ?
+ OpenSSL::Digest::SHA1 :
+ OpenSSL::Digest::DSS1
+
module_function
def issue_cert(dn, key, serial, not_before, not_after, extensions,
@@ -235,10 +254,9 @@ aPgwHyJBiK1/ebK3tYcrSKrOoRyrAgEC
server_proc.call(ctx, ssl)
end
end
- rescue Errno::EBADF, IOError, Errno::EINVAL, Errno::ECONNABORTED, Errno::ENOTSOCK
+ rescue Errno::EBADF, IOError, Errno::EINVAL, Errno::ECONNABORTED, Errno::ENOTSOCK, Errno::ECONNRESET
end
- DHParam = OpenSSL::PKey::DH.new(128)
def start_server(port0, verify_mode, start_immediately, args = {}, &block)
ctx_proc = args[:ctx_proc]
server_proc = args[:server_proc]
@@ -252,7 +270,7 @@ aPgwHyJBiK1/ebK3tYcrSKrOoRyrAgEC
#ctx.extra_chain_cert = [ ca_cert ]
ctx.cert = @svr_cert
ctx.key = @svr_key
- ctx.tmp_dh_callback = proc { DHParam }
+ ctx.tmp_dh_callback = proc { OpenSSL::TestUtils::TEST_KEY_DH1024 }
ctx.verify_mode = verify_mode
ctx_proc.call(ctx) if ctx_proc
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_autoconf.rb b/test/optparse/test_autoconf.rb
new file mode 100644
index 0000000000..cb9c938609
--- /dev/null
+++ b/test/optparse/test_autoconf.rb
@@ -0,0 +1,63 @@
+require 'test/unit'
+require 'optparse/ac'
+
+class TestOptionParser < Test::Unit::TestCase; end
+
+class TestOptionParser::AutoConf < Test::Unit::TestCase
+ def setup
+ @opt = OptionParser::AC.new
+ @foo = @bar = self.class
+ @opt.ac_arg_enable("foo", "foo option") {|x| @foo = x}
+ @opt.ac_arg_disable("bar", "bar option") {|x| @bar = x}
+ @opt.ac_arg_with("zot", "zot option") {|x| @zot = x}
+ end
+
+ class DummyOutput < String
+ alias write <<
+ end
+ def no_error(*args)
+ $stderr, stderr = DummyOutput.new, $stderr
+ assert_nothing_raised(*args) {return yield}
+ ensure
+ stderr, $stderr = $stderr, stderr
+ $!.backtrace.delete_if {|e| /\A#{Regexp.quote(__FILE__)}:#{__LINE__-2}/o =~ e} if $!
+ assert_empty(stderr)
+ end
+
+ def test_enable
+ @opt.parse!(%w"--enable-foo")
+ assert_equal(true, @foo)
+ @opt.parse!(%w"--enable-bar")
+ assert_equal(true, @bar)
+ end
+
+ def test_disable
+ @opt.parse!(%w"--disable-foo")
+ assert_equal(false, @foo)
+ @opt.parse!(%w"--disable-bar")
+ assert_equal(false, @bar)
+ end
+
+ def test_with
+ @opt.parse!(%w"--with-zot=foobar")
+ assert_equal("foobar", @zot)
+ @opt.parse!(%w"--without-zot")
+ assert_nil(@zot)
+ end
+
+ def test_without
+ @opt.parse!(%w"--without-zot")
+ assert_nil(@zot)
+ assert_raise(OptionParser::NeedlessArgument) {@opt.parse!(%w"--without-zot=foobar")}
+ end
+
+ def test_help
+ help = @opt.help
+ assert_match(/--enable-foo/, help)
+ assert_match(/--disable-bar/, help)
+ assert_match(/--with-zot/, help)
+ assert_not_match(/--disable-foo/, help)
+ assert_not_match(/--enable-bar/, help)
+ assert_not_match(/--without/, help)
+ 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/optparse/test_summary.rb b/test/optparse/test_summary.rb
index d7771733a3..54fd194bbd 100644
--- a/test/optparse/test_summary.rb
+++ b/test/optparse/test_summary.rb
@@ -35,4 +35,12 @@ class TestOptionParser::SummaryTest < TestOptionParser
assert_equal("foo\nbar\n", o.to_s)
assert_equal(["foo\n", "bar"], o.to_a)
end
+
+ def test_summary_containing_space
+ # test for r35467. OptionParser#to_a shouldn't split str by spaces.
+ bug6348 = '[ruby-dev:45568]'
+ o = OptionParser.new("foo bar")
+ assert_equal("foo bar\n", o.to_s, bug6348)
+ assert_equal(["foo bar"], o.to_a, bug6348)
+ end
end
diff --git a/test/ostruct/test_ostruct.rb b/test/ostruct/test_ostruct.rb
index dca2382b2b..14bc2b2da8 100644
--- a/test/ostruct/test_ostruct.rb
+++ b/test/ostruct/test_ostruct.rb
@@ -2,6 +2,13 @@ require 'test/unit'
require 'ostruct'
class TC_OpenStruct < Test::Unit::TestCase
+ def test_initialize
+ h = {name: "John Smith", age: 70, pension: 300}
+ assert_equal h, OpenStruct.new(h).to_h
+ assert_equal h, OpenStruct.new(OpenStruct.new(h)).to_h
+ assert_equal h, OpenStruct.new(Struct.new(*h.keys).new(*h.values)).to_h
+ end
+
def test_equality
o1 = OpenStruct.new
o2 = OpenStruct.new
@@ -39,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
@@ -61,16 +68,71 @@ 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_method_missing_handles_square_bracket_equals
- o = OpenStruct.new
- assert_raise(NoMethodError) { o[:foo] = :bar }
+ def test_setter
+ os = OpenStruct.new
+ os[:foo] = :bar
+ assert_equal :bar, os.foo
+ os['foo'] = :baz
+ assert_equal :baz, os.foo
end
- def test_method_missing_handles_square_brackets
- o = OpenStruct.new
- assert_raise(NoMethodError) { o[:foo] }
+ def test_getter
+ os = OpenStruct.new
+ os.foo = :bar
+ assert_equal :bar, os[:foo]
+ assert_equal :bar, os['foo']
end
+ def test_to_h
+ h = {name: "John Smith", age: 70, pension: 300}
+ os = OpenStruct.new(h)
+ to_h = os.to_h
+ assert_equal(h, to_h)
+
+ to_h[:age] = 71
+ assert_equal(70, os.age)
+ assert_equal(70, h[:age])
+
+ assert_equal(h, OpenStruct.new("name" => "John Smith", "age" => 70, pension: 300).to_h)
+ end
+
+ def test_each_pair
+ h = {name: "John Smith", age: 70, pension: 300}
+ 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
+ os1 = OpenStruct.new age: 70
+ os2 = OpenStruct.new age: 70.0
+ assert_equal os1, os2
+ assert_equal false, os1.eql?(os2)
+ assert_not_equal os1.hash, os2.hash
+ 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 61d288d68d..ec9dfa1d59 100644
--- a/test/pathname/test_pathname.rb
+++ b/test/pathname/test_pathname.rb
@@ -710,7 +710,25 @@ class TestPathname < Test::Unit::TestCase
def test_binread
with_tmpchdir('rubytest-pathname') {|dir|
open("a", "w") {|f| f.write "abc" }
- assert_equal("abc", Pathname("a").binread)
+ str = Pathname("a").binread
+ assert_equal("abc", str)
+ assert_equal(Encoding::ASCII_8BIT, str.encoding)
+ }
+ 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
@@ -1231,6 +1249,10 @@ 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 {|v| a << v }; a.sort!
assert_equal([Pathname("d"), Pathname("d/x"), Pathname("d/y")], a)
+ a = Pathname(".").find.sort
+ 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)
}
end
diff --git a/test/profile_test_all.rb b/test/profile_test_all.rb
index 54e916b73b..08de7bb129 100644
--- a/test/profile_test_all.rb
+++ b/test/profile_test_all.rb
@@ -1,52 +1,90 @@
-require 'objspace'
-
#
# purpose:
# Profile memory usage of each tests.
#
# usage:
-# RUBY_TEST_ALL_PROFILE=true make test-all
+# RUBY_TEST_ALL_PROFILE=[file] make test-all
#
# output:
-# ./test_all_profile
+# [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/self/statm (if it exists)
+# - /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
- $test_all_profile_out = open('test_all_profile', 'w')
- $test_all_profile_gc_stat_hash = {}
+ 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 = []
- 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")}"
+ 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
- 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
+
+ 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
+ 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/test/psych/handlers/test_recorder.rb b/test/psych/handlers/test_recorder.rb
new file mode 100644
index 0000000000..96b8eac1fc
--- /dev/null
+++ b/test/psych/handlers/test_recorder.rb
@@ -0,0 +1,25 @@
+require 'psych/helper'
+require 'psych/handlers/recorder'
+
+module Psych
+ module Handlers
+ class TestRecorder < TestCase
+ def test_replay
+ yaml = "--- foo\n...\n"
+ output = StringIO.new
+
+ recorder = Psych::Handlers::Recorder.new
+ parser = Psych::Parser.new recorder
+ parser.parse yaml
+
+ assert_equal 5, recorder.events.length
+
+ emitter = Psych::Emitter.new output
+ recorder.events.each do |m, args|
+ emitter.send m, *args
+ end
+ assert_equal yaml, output.string
+ end
+ end
+ end
+end
diff --git a/test/psych/helper.rb b/test/psych/helper.rb
index 8108e993c1..11b2216b20 100644
--- a/test/psych/helper.rb
+++ b/test/psych/helper.rb
@@ -2,9 +2,39 @@ require 'minitest/autorun'
require 'stringio'
require 'tempfile'
require 'date'
+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
@@ -30,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,10 +84,31 @@ module Psych
end
end
-require 'psych'
-
-# FIXME: remove this when syck is removed
-o = Object.new
-a = o.method(:psych_to_yaml)
-b = o.method(:to_yaml)
-raise "psych should define to_yaml" unless a == b
+# 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 aa4773bce4..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
@@ -24,8 +24,8 @@ EOYAML
def test_mri_compatibility_object_with_ivars
yaml = <<EOYAML
----
-- &id001 !ruby/object:ObjectWithInstanceVariables
+---
+- &id001 !ruby/object:ObjectWithInstanceVariables
var1: test1
var2: test2
- *id001
@@ -33,7 +33,7 @@ EOYAML
EOYAML
result = Psych.load yaml
- result.each do |el|
+ result.each do |el|
assert_same(result[0], el)
assert_equal('test1', el.var1)
assert_equal('test2', el.var2)
@@ -42,8 +42,8 @@ EOYAML
def test_mri_compatibility_substring_with_ivars
yaml = <<EOYAML
----
-- &id001 !str:SubStringWithInstanceVariables
+---
+- &id001 !str:SubStringWithInstanceVariables
str: test
"@var1": test
- *id001
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..9a8e37bc67 100644
--- a/test/psych/test_date_time.rb
+++ b/test/psych/test_date_time.rb
@@ -1,4 +1,4 @@
-require 'psych/helper'
+require_relative 'helper'
require 'date'
module Psych
@@ -13,5 +13,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 cfce0825e9..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
- yaml_as 'helloworld'
+ 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..e370606c77 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
@@ -50,58 +50,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
-
- File.open(t.path, 'rb', :encoding => 'UTF-16LE') do |f|
- assert_equal "ã“ã‚“ã«ã¡ã¯ï¼", Psych.load(f)
- end
+ Tempfile.create(['utf16le', 'yml']) {|t|
+ t.binmode
+ t.write '--- ã“ã‚“ã«ã¡ã¯ï¼'.encode('UTF-16LE')
+ t.close
- 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
+ Tempfile.create(['utf8', 'yml']) {|t|
+ 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
-
- 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 +110,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 +182,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
index b52fd0959b..33a67432eb 100644
--- a/test/psych/test_engine_manager.rb
+++ b/test/psych/test_engine_manager.rb
@@ -1,12 +1,8 @@
-require 'psych/helper'
+require_relative 'helper'
require 'yaml'
module Psych
class TestEngineManager < TestCase
- def teardown
- YAML::ENGINE.yamler = 'syck'
- end
-
def test_bad_engine
assert_raises(ArgumentError) do
YAML::ENGINE.yamler = 'foooo'
@@ -19,12 +15,6 @@ module Psych
assert_equal 'psych', YAML::ENGINE.yamler
end
- def test_set_syck
- YAML::ENGINE.yamler = 'syck'
- assert_equal ::Syck, YAML
- assert_equal 'syck', YAML::ENGINE.yamler
- end
-
A = Struct.new(:name)
def test_dump_types
diff --git a/test/psych/test_exception.rb b/test/psych/test_exception.rb
index c6d98d7a99..a9fe5c43d1 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
@@ -56,27 +56,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
@@ -126,5 +126,26 @@ module Psych
assert_equal 1, w.foo
assert_nil w.bar
end
+
+ def test_psych_syntax_error
+ Tempfile.create(['parsefile', 'yml']) do |t|
+ t.binmode
+ t.write '--- `'
+ t.close
+
+ begin
+ Psych.parse_file t.path
+ rescue StandardError
+ assert true # count assertion
+ ensure
+ return unless $!
+
+ ancestors = $!.class.ancestors.inspect
+
+ flunk "Psych::SyntaxError not rescued by StandardError: #{ancestors}"
+ end
+ end
+ end
+
end
end
diff --git a/test/psych/test_hash.rb b/test/psych/test_hash.rb
index 4bd4edfc8c..dac7f8d7d8 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
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 bf5968ff86..ba8d2e77b3 100644
--- a/test/psych/test_merge_keys.rb
+++ b/test/psych/test_merge_keys.rb
@@ -1,7 +1,76 @@
-require 'psych/helper'
+require_relative 'helper'
module Psych
class TestMergeKeys < TestCase
+ class Product
+ attr_reader :bar
+ 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
+development:
+ <<: *defaults
+ eoyml
+ assert_equal({'<<' => nil }, Psych.load(yaml)['development'])
+ end
+
+ def test_merge_array
+ yaml = <<-eoyml
+foo: &hello
+- 1
+baz:
+ <<: *hello
+ eoyml
+ assert_equal({'<<' => [1]}, Psych.load(yaml)['baz'])
+ end
+
+ def test_merge_is_not_partial
+ yaml = <<-eoyml
+default: &default
+ hello: world
+foo: &hello
+- 1
+baz:
+ <<: [*hello, *default]
+ eoyml
+ doc = Psych.load yaml
+ refute doc['baz'].key? 'hello'
+ assert_equal({'<<' => [[1], {"hello"=>"world"}]}, Psych.load(yaml)['baz'])
+ end
+
+ def test_merge_seq_nil
+ yaml = <<-eoyml
+foo: &hello
+baz:
+ <<: [*hello]
+ eoyml
+ assert_equal({'<<' => [nil]}, Psych.load(yaml)['baz'])
+ end
+
+ def test_bad_seq_merge
+ yaml = <<-eoyml
+defaults: &defaults [1, 2, 3]
+development:
+ <<: *defaults
+ eoyml
+ assert_equal({'<<' => [1,2,3]}, Psych.load(yaml)['development'])
+ end
+
def test_missing_merge_key
yaml = <<-eoyml
bar:
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 bae723aca9..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
@@ -7,6 +7,19 @@ module Psych
# http://yaml.org/type/float.html
# http://yaml.org/type/int.html
class TestNumeric < TestCase
+ def setup
+ @old_debug = $DEBUG
+ $DEBUG = true
+ end
+
+ def teardown
+ $DEBUG = @old_debug
+ end
+
+ def test_load_float_with_dot
+ assert_equal 1.0, Psych.load('--- 1.')
+ end
+
def test_non_float_with_0
str = Psych.load('--- 090')
assert_equal '090', str
@@ -21,5 +34,12 @@ module Psych
decimal = BigDecimal("12.34")
assert_cycle decimal
end
+
+ def test_does_not_attempt_numeric
+ str = Psych.load('--- 4 roses')
+ assert_equal '4 roses', str
+ str = Psych.load('--- 1.1.1')
+ assert_equal '1.1.1', str
+ end
end
end
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 77cc96e29d..9e2cf08ad0 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
@@ -28,14 +28,14 @@ module Psych
def assert_reference_trip obj
yml = Psych.dump([obj, obj])
- assert_match(/\*\d+/, yml)
+ assert_match(/\*-?\d+/, yml)
data = Psych.load yml
assert_equal data.first.object_id, data.last.object_id
end
def test_float_references
data = Psych.load <<-eoyml
----
+---\s
- &name 1.2
- *name
eoyml
@@ -56,7 +56,7 @@ module Psych
def test_regexp_references
data = Psych.load <<-eoyml
----
+---\s
- &name !ruby/regexp /pattern/i
- *name
eoyml
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 d8c53f2d0d..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
@@ -32,6 +32,13 @@ module Psych
@handler.parser = @parser
end
+ def test_ast_roundtrip
+ parser = Psych.parser
+ parser.parse('null')
+ ast = parser.handler.root
+ assert_match(/^null/, ast.yaml)
+ end
+
def test_exception_memory_leak
yaml = <<-eoyaml
%YAML 1.1
diff --git a/test/psych/test_psych.rb b/test/psych/test_psych.rb
index 99866998e0..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'
@@ -20,7 +20,7 @@ class TestPsych < Psych::TestCase
def test_canonical
yml = Psych.dump({:a => {'b' => 'c'}}, {:canonical => true})
- assert_match(/\? ! "b/, yml)
+ assert_match(/\? "b/, yml)
end
def test_header
@@ -64,7 +64,7 @@ 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
@@ -125,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 cf0dfff6aa..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
@@ -21,6 +21,17 @@ module Psych
end
end
+ def test_scan_bad_time
+ [ '2001-12-15T02:59:73.1Z',
+ '2001-12-14t90:59:43.10-05:00',
+ '2001-92-14 21:59:43.10 -5',
+ '2001-12-15 92:59:43.10',
+ '2011-02-24 81:17:06 -0800',
+ ].each do |time_str|
+ assert_equal time_str, @ss.tokenize(time_str)
+ end
+ end
+
def test_scan_bad_dates
x = '2000-15-01'
assert_equal x, @ss.tokenize(x)
@@ -87,5 +98,9 @@ module Psych
def test_scan_true
assert_equal true, ss.tokenize('true')
end
+
+ def test_scan_strings_starting_with_underscores
+ assert_equal "_100", ss.tokenize('_100')
+ end
end
end
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 77aefc6dae..84326da8d3 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
@@ -9,6 +9,52 @@ module Psych
attr_accessor :val
end
+ class Z < String
+ def initialize
+ force_encoding Encoding::US_ASCII
+ end
+ 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
@@ -28,6 +74,12 @@ module Psych
assert_equal X, x.class
end
+ def test_empty_character_subclass
+ assert_match "!ruby/string:#{Z}", Psych.dump(Z.new)
+ x = Psych.load Psych.dump Z.new
+ assert_equal Z, x.class
+ end
+
def test_subclass_with_attributes
y = Psych.load Psych.dump Y.new.tap {|y| y.val = 1}
assert_equal Y, y.class
@@ -40,8 +92,8 @@ module Psych
assert_equal '01:03:05', Psych.load(yaml)
end
- def test_tagged_binary_should_be_dumped_as_binary
- string = "hello world!"
+ def test_nonascii_string_as_binary
+ string = "hello \x80 world!"
string.force_encoding 'ascii-8bit'
yml = Psych.dump string
assert_match(/binary/, yml)
@@ -69,6 +121,13 @@ module Psych
assert_equal string, Psych.load(yml)
end
+ def test_ascii_only_8bit_string
+ string = "abc".encode(Encoding::ASCII_8BIT)
+ yml = Psych.dump string
+ refute_match(/binary/, yml)
+ assert_equal string, Psych.load(yml)
+ end
+
def test_string_with_ivars
food = "is delicious"
ivar = "on rock and roll"
@@ -83,6 +142,10 @@ module Psych
assert_cycle string
end
+ def test_float_confusion
+ assert_cycle '1.'
+ end
+
def binary_string percentage = 0.31, length = 100
string = ''
(percentage * length).to_i.times do |i|
diff --git a/test/psych/test_struct.rb b/test/psych/test_struct.rb
index 39e38f7dfd..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
@@ -24,9 +24,7 @@ module Psych
loaded = Psych.load(Psych.dump(ss))
assert_instance_of(StructSubclass, loaded.foo)
- # FIXME: This seems to cause an infinite loop. wtf. Must report a bug
- # in ruby.
- # assert_equal(ss, loaded)
+ assert_equal(ss, loaded)
end
def test_roundtrip
diff --git a/test/psych/test_symbol.rb b/test/psych/test_symbol.rb
index 3226141d02..2b4470d184 100644
--- a/test/psych/test_symbol.rb
+++ b/test/psych/test_symbol.rb
@@ -1,4 +1,4 @@
-require 'psych/helper'
+require_relative 'helper'
module Psych
class TestSymbol < TestCase
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 807c058d2e..ba86807aaf 100644
--- a/test/psych/test_yaml.rb
+++ b/test/psych/test_yaml.rb
@@ -1,8 +1,8 @@
-# -*- mode: ruby; ruby-indent-level: 4; tab-width: 4 -*-
+# -*- coding: us-ascii; mode: ruby; ruby-indent-level: 4; tab-width: 4 -*-
# vim:sw=4:ts=4
# $Id$
#
-require 'psych/helper'
+require_relative 'helper'
require 'ostruct'
# [ruby-core:01946]
@@ -1266,4 +1266,24 @@ EOY
Psych.load("2000-01-01 00:00:00.#{"0"*1000} +00:00\n")
# '[ruby-core:13735]'
end
+
+ def test_multiline_string_uses_literal_style
+ yaml = Psych.dump("multi\nline\nstring")
+ assert_match("|", yaml)
+ end
+
+ def test_string_starting_with_non_word_character_uses_double_quotes_without_exclamation_mark
+ yaml = Psych.dump("@123'abc")
+ refute_match("!", yaml)
+ end
+
+ def test_string_dump_with_colon
+ yaml = Psych.dump 'x: foo'
+ refute_match '!', yaml
+ end
+
+ def test_string_dump_starting_with_star
+ yaml = Psych.dump '*foo'
+ refute_match '!', yaml
+ end
end
diff --git a/test/psych/test_yamldbm.rb b/test/psych/test_yamldbm.rb
new file mode 100644
index 0000000000..dba9eee2a9
--- /dev/null
+++ b/test/psych/test_yamldbm.rb
@@ -0,0 +1,197 @@
+# -*- coding: UTF-8 -*-
+
+require_relative 'helper'
+require 'tmpdir'
+
+begin
+ require 'yaml/dbm'
+rescue LoadError
+end
+
+module Psych
+ ::Psych::DBM = ::YAML::DBM unless defined?(::Psych::DBM)
+
+ 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")
+ @yamldbm = YAML::DBM.new(@yamldbm_file)
+ end
+
+ def teardown
+ YAML::ENGINE.yamler = @engine
+ @yamldbm.clear
+ @yamldbm.close
+ FileUtils.remove_entry_secure @dir
+ end
+
+ def make_tmp_filename(prefix)
+ @dir + "/" + prefix + File.basename(__FILE__) + ".#{$$}.test"
+ end
+
+ def test_store
+ @yamldbm.store('a','b')
+ @yamldbm.store('c','d')
+ assert_equal 'b', @yamldbm['a']
+ assert_equal 'd', @yamldbm['c']
+ assert_nil @yamldbm['e']
+ end
+
+ def test_store_using_carret
+ @yamldbm['a'] = 'b'
+ @yamldbm['c'] = 'd'
+ assert_equal 'b', @yamldbm['a']
+ assert_equal 'd', @yamldbm['c']
+ assert_nil @yamldbm['e']
+ end
+
+ def test_to_a
+ @yamldbm['a'] = 'b'
+ @yamldbm['c'] = 'd'
+ assert_equal([['a','b'],['c','d']], @yamldbm.to_a.sort)
+ end
+
+ def test_to_hash
+ @yamldbm['a'] = 'b'
+ @yamldbm['c'] = 'd'
+ assert_equal({'a'=>'b','c'=>'d'}, @yamldbm.to_hash)
+ end
+
+ def test_has_value?
+ @yamldbm['a'] = 'b'
+ @yamldbm['c'] = 'd'
+ assert_equal true, @yamldbm.has_value?('b')
+ assert_equal true, @yamldbm.has_value?('d')
+ assert_equal false, @yamldbm.has_value?('f')
+ end
+
+ # Note:
+ # YAML::DBM#index makes warning from internal of ::DBM#index.
+ # It says 'DBM#index is deprecated; use DBM#key', but DBM#key
+ # behaves not same as DBM#index.
+ #
+ # def test_index
+ # @yamldbm['a'] = 'b'
+ # @yamldbm['c'] = 'd'
+ # assert_equal 'a', @yamldbm.index('b')
+ # assert_equal 'c', @yamldbm.index('d')
+ # assert_nil @yamldbm.index('f')
+ # end
+
+ def test_key
+ skip 'only on ruby 2.0.0' if RUBY_VERSION < '2.0.0'
+ @yamldbm['a'] = 'b'
+ @yamldbm['c'] = 'd'
+ assert_equal 'a', @yamldbm.key('b')
+ assert_equal 'c', @yamldbm.key('d')
+ assert_nil @yamldbm.key('f')
+ end
+
+ def test_fetch
+ assert_equal('bar', @yamldbm['foo']='bar')
+ assert_equal('bar', @yamldbm.fetch('foo'))
+ assert_nil @yamldbm.fetch('bar')
+ assert_equal('baz', @yamldbm.fetch('bar', 'baz'))
+ assert_equal('foobar', @yamldbm.fetch('bar') {|key| 'foo' + key })
+ end
+
+ def test_shift
+ @yamldbm['a'] = 'b'
+ @yamldbm['c'] = 'd'
+ assert_equal([['a','b'], ['c','d']],
+ [@yamldbm.shift, @yamldbm.shift].sort)
+ assert_nil @yamldbm.shift
+ end
+
+ def test_invert
+ @yamldbm['a'] = 'b'
+ @yamldbm['c'] = 'd'
+ assert_equal({'b'=>'a','d'=>'c'}, @yamldbm.invert)
+ end
+
+ def test_update
+ @yamldbm['a'] = 'b'
+ @yamldbm['c'] = 'd'
+ @yamldbm.update({'c'=>'d','e'=>'f'})
+ assert_equal 'b', @yamldbm['a']
+ assert_equal 'd', @yamldbm['c']
+ assert_equal 'f', @yamldbm['e']
+ end
+
+ def test_replace
+ @yamldbm['a'] = 'b'
+ @yamldbm['c'] = 'd'
+ @yamldbm.replace({'c'=>'d','e'=>'f'})
+ assert_nil @yamldbm['a']
+ assert_equal 'd', @yamldbm['c']
+ assert_equal 'f', @yamldbm['e']
+ end
+
+ def test_delete
+ @yamldbm['a'] = 'b'
+ @yamldbm['c'] = 'd'
+ assert_equal 'b', @yamldbm.delete('a')
+ assert_nil @yamldbm['a']
+ assert_equal 'd', @yamldbm['c']
+ assert_nil @yamldbm.delete('e')
+ end
+
+ def test_delete_if
+ @yamldbm['a'] = 'b'
+ @yamldbm['c'] = 'd'
+ @yamldbm['e'] = 'f'
+
+ @yamldbm.delete_if {|k,v| k == 'a'}
+ assert_nil @yamldbm['a']
+ assert_equal 'd', @yamldbm['c']
+ assert_equal 'f', @yamldbm['e']
+
+ @yamldbm.delete_if {|k,v| v == 'd'}
+ assert_nil @yamldbm['c']
+ assert_equal 'f', @yamldbm['e']
+
+ @yamldbm.delete_if {|k,v| false }
+ assert_equal 'f', @yamldbm['e']
+ end
+
+ def test_reject
+ @yamldbm['a'] = 'b'
+ @yamldbm['c'] = 'd'
+ @yamldbm['e'] = 'f'
+ assert_equal({'c'=>'d','e'=>'f'}, @yamldbm.reject {|k,v| k == 'a'})
+ assert_equal({'a'=>'b','e'=>'f'}, @yamldbm.reject {|k,v| v == 'd'})
+ assert_equal({'a'=>'b','c'=>'d','e'=>'f'}, @yamldbm.reject {false})
+ end
+
+ def test_values
+ assert_equal [], @yamldbm.values
+ @yamldbm['a'] = 'b'
+ @yamldbm['c'] = 'd'
+ assert_equal ['b','d'], @yamldbm.values.sort
+ end
+
+ def test_values_at
+ @yamldbm['a'] = 'b'
+ @yamldbm['c'] = 'd'
+ assert_equal ['b','d'], @yamldbm.values_at('a','c')
+ end
+
+ def test_selsct
+ @yamldbm['a'] = 'b'
+ @yamldbm['c'] = 'd'
+ @yamldbm['e'] = 'f'
+ assert_equal(['b','d'], @yamldbm.select('a','c'))
+ end
+
+ def test_selsct_with_block
+ @yamldbm['a'] = 'b'
+ @yamldbm['c'] = 'd'
+ @yamldbm['e'] = 'f'
+ assert_equal([['a','b']], @yamldbm.select {|k,v| k == 'a'})
+ assert_equal([['c','d']], @yamldbm.select {|k,v| v == 'd'})
+ assert_equal([], @yamldbm.select {false})
+ end
+ end
+end if defined?(YAML::DBM) && defined?(Psych)
diff --git a/test/syck/test_yamlstore.rb b/test/psych/test_yamlstore.rb
index 8a52c00828..19471b1e35 100644
--- a/test/syck/test_yamlstore.rb
+++ b/test/psych/test_yamlstore.rb
@@ -1,18 +1,26 @@
-require 'test/unit'
+require_relative 'helper'
require 'yaml/store'
-Syck::Store = YAML::Store unless defined?(Syck::Store)
+require 'tmpdir'
-module Syck
- class YAMLStoreTest < Test::Unit::TestCase
+module Psych
+ Psych::Store = YAML::Store unless defined?(Psych::Store)
+
+ class YAMLStoreTest < TestCase
def setup
- @engine, YAML::ENGINE.yamler = YAML::ENGINE.yamler, 'syck'
- @yamlstore_file = "yamlstore.tmp.#{Process.pid}"
+ @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")
@yamlstore = YAML::Store.new(@yamlstore_file)
end
def teardown
YAML::ENGINE.yamler = @engine
- File.unlink(@yamlstore_file) rescue nil
+ FileUtils.remove_entry_secure @dir
+ end
+
+ def make_tmp_filename(prefix)
+ @dir + "/" + prefix + File.basename(__FILE__) + ".#{$$}.test"
end
def test_opening_new_file_in_readonly_mode_should_result_in_empty_values
@@ -69,11 +77,11 @@ module Syck
end
def test_writing_inside_readonly_transaction_raises_error
- assert_raise(PStore::Error) do
+ assert_raises(PStore::Error) do
@yamlstore.transaction(true) do
@yamlstore[:foo] = "bar"
end
end
end
end
-end
+end if defined?(Psych)
diff --git a/test/psych/visitors/test_to_ruby.rb b/test/psych/visitors/test_to_ruby.rb
index 5b0702cf1a..c13d980468 100644
--- a/test/psych/visitors/test_to_ruby.rb
+++ b/test/psych/visitors/test_to_ruby.rb
@@ -1,3 +1,4 @@
+# coding: US-ASCII
require 'psych/helper'
module Psych
@@ -5,7 +6,7 @@ module Psych
class TestToRuby < TestCase
def setup
super
- @visitor = ToRuby.new
+ @visitor = ToRuby.create
end
def test_object
@@ -17,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
@@ -87,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 df775635bf..40702bce79 100644
--- a/test/psych/visitors/test_yaml_tree.rb
+++ b/test/psych/visitors/test_yaml_tree.rb
@@ -5,7 +5,25 @@ module Psych
class TestYAMLTree < TestCase
def setup
super
- @v = Visitors::YAMLTree.new
+ @v = Visitors::YAMLTree.create
+ end
+
+ def test_tree_can_be_called_twice
+ @v.start
+ @v << Object.new
+ t = @v.tree
+ assert_equal t, @v.tree
+ end
+
+ def test_yaml_tree_can_take_an_emitter
+ io = StringIO.new
+ e = Psych::Emitter.new io
+ v = Visitors::YAMLTree.create({}, e)
+ v.start
+ v << "hello world"
+ v.finish
+
+ assert_match "hello world", io.string
end
def test_binary_formatting
diff --git a/test/rake/helper.rb b/test/rake/helper.rb
index 65443fc111..74cab7559f 100644
--- a/test/rake/helper.rb
+++ b/test/rake/helper.rb
@@ -1,4 +1,5 @@
require 'rubygems'
+$:.unshift File.expand_path('../../lib', __FILE__)
begin
gem 'minitest'
@@ -10,9 +11,12 @@ require 'rake'
require 'tmpdir'
require File.expand_path('../file_creation', __FILE__)
+require_relative 'support/ruby_runner'
+require_relative 'support/rakefile_definitions'
+
begin
- require 'test/ruby/envutil'
-rescue LoadError
+ require_relative '../ruby/envutil'
+rescue NoMethodError, LoadError
# for ruby trunk
end
@@ -30,15 +34,32 @@ class Rake::TestCase < MiniTest::Unit::TestCase
def setup
ARGV.clear
- @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']
+ test_dir = File.basename File.dirname File.expand_path __FILE__
+
+ @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'
+ @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'
@@ -56,22 +77,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
@@ -97,396 +118,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"
+ include RakefileDefinitions
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
-
-end
-
diff --git a/test/rake/support/rakefile_definitions.rb b/test/rake/support/rakefile_definitions.rb
new file mode 100644
index 0000000000..5cc2ae1293
--- /dev/null
+++ b/test/rake/support/rakefile_definitions.rb
@@ -0,0 +1,444 @@
+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_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_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..404e61a668
--- /dev/null
+++ b/test/rake/support/ruby_runner.rb
@@ -0,0 +1,33 @@
+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
+
+ 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_private_reader.rb b/test/rake/test_private_reader.rb
new file mode 100644
index 0000000000..f86d4249b2
--- /dev/null
+++ b/test/rake/test_private_reader.rb
@@ -0,0 +1,42 @@
+require File.expand_path('../helper', __FILE__)
+require 'rake/private_reader'
+
+class TestPrivateAttrs < Rake::TestCase
+
+ class Sample
+ include Rake::PrivateReader
+
+ private_reader :reader, :a
+
+ def initialize
+ @reader = :RVALUE
+ end
+
+ def get_reader
+ reader
+ end
+
+ end
+
+ def setup
+ super
+ @sample = Sample.new
+ end
+
+ def test_private_reader_is_private
+ assert_private do @sample.reader end
+ assert_private do @sample.a end
+ end
+
+ def test_private_reader_returns_data
+ assert_equal :RVALUE, @sample.get_reader
+ end
+
+ private
+
+ def assert_private
+ ex = assert_raises(NoMethodError) do yield end
+ assert_match(/private/, ex.message)
+ end
+
+end
diff --git a/test/rake/test_rake_application.rb b/test/rake/test_rake_application.rb
index b5d8c652c4..aa5ed39f80 100644
--- a/test/rake/test_rake_application.rb
+++ b/test/rake/test_rake_application.rb
@@ -9,13 +9,6 @@ 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)
- end
-
def test_display_tasks
@app.options.show_tasks = :tasks
@app.options.show_task_pattern = //
@@ -30,13 +23,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 +39,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 +54,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 +73,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 +116,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
@@ -252,7 +247,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 +255,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,7 +291,7 @@ 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'
@@ -309,6 +304,37 @@ class TestRakeApplication < Rake::TestCase
assert @app.options.trace
end
+ def test_handle_options_trace_default_is_stderr
+ ARGV.clear
+ ARGV << "--trace"
+
+ @app.handle_options
+
+ assert_equal STDERR, @app.options.trace_output
+ assert @app.options.trace
+ end
+
+ def test_handle_options_trace_overrides_to_stdout
+ ARGV.clear
+ ARGV << "--trace=stdout"
+
+ @app.handle_options
+
+ assert_equal STDOUT, @app.options.trace_output
+ assert @app.options.trace
+ end
+
+ def test_handle_options_trace_does_not_eat_following_task_names
+ assert !@app.options.trace
+
+ ARGV.clear
+ ARGV << "--trace" << "sometask"
+
+ @app.handle_options
+ assert ARGV.include?("sometask")
+ assert @app.options.trace
+ end
+
def test_good_run
ran = false
@@ -385,6 +411,18 @@ class TestRakeApplication < Rake::TestCase
ARGV.clear
end
+ def test_bad_run_with_backtrace
+ @app.intern(Rake::Task, "default").enhance { fail }
+ ARGV.clear
+ ARGV << '-f' << '-s' << '--backtrace'
+ assert_raises(SystemExit) {
+ _, err = capture_io { @app.run }
+ refute_match(/see full trace/, err)
+ }
+ ensure
+ ARGV.clear
+ end
+
def test_run_with_bad_options
@app.intern(Rake::Task, "default").enhance { fail }
ARGV.clear
@@ -396,15 +434,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
@@ -486,4 +515,3 @@ class TestRakeApplication < Rake::TestCase
end
end
-
diff --git a/test/rake/test_rake_application_options.rb b/test/rake/test_rake_application_options.rb
index c1471f443e..b3220b8a97 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,17 +22,16 @@ 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.classic_namespace
+ assert_nil opts.backtrace
assert_nil opts.dryrun
assert_nil opts.ignore_system
assert_nil opts.load_system
+ assert_nil opts.always_multitask
assert_nil opts.nosearch
assert_equal ['rakelib'], opts.rakelib
assert_nil opts.show_prereqs
@@ -40,6 +39,7 @@ class TestRakeApplicationOptions < Rake::TestCase
assert_nil opts.show_tasks
assert_nil opts.silent
assert_nil opts.trace
+ assert_nil opts.thread_pool_size
assert_equal ['rakelib'], opts.rakelib
assert ! Rake::FileUtilsExt.verbose_flag
assert ! Rake::FileUtilsExt.nowrite_flag
@@ -110,6 +110,18 @@ class TestRakeApplicationOptions < Rake::TestCase
assert_equal :exit, @exit
end
+ def test_jobs
+ flags(['--jobs', '4'], ['-j', '4']) do |opts|
+ assert_equal 4, opts.thread_pool_size
+ end
+ flags(['--jobs', 'asdas'], ['-j', 'asdas']) do |opts|
+ assert_equal 2, opts.thread_pool_size
+ end
+ flags('--jobs', '-j') do |opts|
+ assert_equal 2, opts.thread_pool_size
+ end
+ end
+
def test_libdir
flags(['--libdir', 'xx'], ['-I', 'xx'], ['-Ixx']) do |opts|
$:.include?('xx')
@@ -118,6 +130,12 @@ class TestRakeApplicationOptions < Rake::TestCase
$:.delete('xx')
end
+ def test_multitask
+ flags('--multitask', '-m') do |opts|
+ assert_equal opts.always_multitask, true
+ end
+ end
+
def test_rakefile
flags(['--rakefile', 'RF'], ['--rakefile=RF'], ['-f', 'RF'], ['-fRF']) do |opts|
assert_equal ['RF'], @app.instance_eval { @rakefiles }
@@ -125,7 +143,12 @@ class TestRakeApplicationOptions < Rake::TestCase
end
def test_rakelib
- flags(['--rakelibdir', 'A:B:C'], ['--rakelibdir=A:B:C'], ['-R', 'A:B:C'], ['-RA:B:C']) do |opts|
+ dirs = %w(A B C).join(File::PATH_SEPARATOR)
+ flags(
+ ['--rakelibdir', dirs],
+ ["--rakelibdir=#{dirs}"],
+ ['-R', dirs],
+ ["-R#{dirs}"]) do |opts|
assert_equal ['A', 'B', 'C'], opts.rakelib
end
end
@@ -164,9 +187,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
@@ -177,9 +201,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
@@ -197,12 +222,91 @@ class TestRakeApplicationOptions < Rake::TestCase
def test_trace
flags('--trace', '-t') do |opts|
- assert opts.trace
+ assert opts.trace, "should enable trace option"
+ assert opts.backtrace, "should enabled backtrace option"
+ assert_equal $stderr, opts.trace_output
assert Rake::FileUtilsExt.verbose_flag
assert ! Rake::FileUtilsExt.nowrite_flag
end
end
+ def test_trace_with_stdout
+ flags('--trace=stdout', '-tstdout') do |opts|
+ assert opts.trace, "should enable trace option"
+ assert opts.backtrace, "should enabled backtrace option"
+ assert_equal $stdout, opts.trace_output
+ assert Rake::FileUtilsExt.verbose_flag
+ assert ! Rake::FileUtilsExt.nowrite_flag
+ end
+ end
+
+ def test_trace_with_stderr
+ flags('--trace=stderr', '-tstderr') do |opts|
+ assert opts.trace, "should enable trace option"
+ assert opts.backtrace, "should enabled backtrace option"
+ assert_equal $stderr, opts.trace_output
+ assert Rake::FileUtilsExt.verbose_flag
+ assert ! Rake::FileUtilsExt.nowrite_flag
+ end
+ end
+
+ def test_trace_with_error
+ ex = assert_raises(Rake::CommandLineOptionError) do
+ flags('--trace=xyzzy') do |opts| end
+ end
+ assert_match(/un(known|recognized).*\btrace\b.*xyzzy/i, ex.message)
+ end
+
+ def test_trace_with_following_task_name
+ flags(['--trace', 'taskname'], ['-t', 'taskname']) do |opts|
+ assert opts.trace, "should enable trace option"
+ assert opts.backtrace, "should enabled backtrace option"
+ assert_equal $stderr, opts.trace_output
+ assert Rake::FileUtilsExt.verbose_flag
+ assert_equal ['taskname'], @app.top_level_tasks
+ end
+ end
+
+ def test_backtrace
+ flags('--backtrace') do |opts|
+ assert opts.backtrace, "should enable backtrace option"
+ assert_equal $stderr, opts.trace_output
+ assert ! opts.trace, "should not enable trace option"
+ end
+ end
+
+ def test_backtrace_with_stdout
+ flags('--backtrace=stdout') do |opts|
+ assert opts.backtrace, "should enable backtrace option"
+ assert_equal $stdout, opts.trace_output
+ assert ! opts.trace, "should not enable trace option"
+ end
+ end
+
+ def test_backtrace_with_stderr
+ flags('--backtrace=stderr') do |opts|
+ assert opts.backtrace, "should enable backtrace option"
+ assert_equal $stderr, opts.trace_output
+ assert ! opts.trace, "should not enable trace option"
+ end
+ end
+
+ def test_backtrace_with_error
+ ex = assert_raises(Rake::CommandLineOptionError) do
+ flags('--backtrace=xyzzy') do |opts| end
+ end
+ assert_match(/un(known|recognized).*\bbacktrace\b.*xyzzy/i, ex.message)
+ end
+
+ def test_backtrace_with_following_task_name
+ flags(['--backtrace', 'taskname']) do |opts|
+ assert ! opts.trace, "should enable trace option"
+ assert opts.backtrace, "should enabled backtrace option"
+ assert_equal $stderr, opts.trace_output
+ assert_equal ['taskname'], @app.top_level_tasks
+ end
+ end
+
def test_trace_rules
flags('--rules') do |opts|
assert opts.trace_rules
@@ -213,10 +317,17 @@ class TestRakeApplicationOptions < Rake::TestCase
flags('--tasks', '-T') do |opts|
assert_equal :tasks, opts.show_tasks
assert_equal(//.to_s, opts.show_task_pattern.to_s)
+ assert_equal nil, opts.show_all_tasks
end
flags(['--tasks', 'xyz'], ['-Txyz']) do |opts|
assert_equal :tasks, opts.show_tasks
assert_equal(/xyz/.to_s, opts.show_task_pattern.to_s)
+ assert_equal nil, opts.show_all_tasks
+ end
+ flags(['--tasks', 'xyz', '--comments']) do |opts|
+ assert_equal :tasks, opts.show_tasks
+ assert_equal(/xyz/.to_s, opts.show_task_pattern.to_s)
+ assert_equal false, opts.show_all_tasks
end
end
@@ -224,10 +335,17 @@ class TestRakeApplicationOptions < Rake::TestCase
flags('--where', '-W') do |opts|
assert_equal :lines, opts.show_tasks
assert_equal(//.to_s, opts.show_task_pattern.to_s)
+ assert_equal true, opts.show_all_tasks
end
flags(['--where', 'xyz'], ['-Wxyz']) do |opts|
assert_equal :lines, opts.show_tasks
assert_equal(/xyz/.to_s, opts.show_task_pattern.to_s)
+ assert_equal true, opts.show_all_tasks
+ end
+ flags(['--where', 'xyz', '--comments'], ['-Wxyz', '--comments']) do |opts|
+ assert_equal :lines, opts.show_tasks
+ assert_equal(/xyz/.to_s, opts.show_task_pattern.to_s)
+ assert_equal false, opts.show_all_tasks
end
end
@@ -238,18 +356,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
@@ -258,22 +374,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
@@ -303,11 +403,34 @@ 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
+ Rake.add_rakelib 'app/task', 'other'
+
+ libs = Rake.application.options.rakelib
+
+ assert libs.include?("app/task")
+ assert libs.include?("other")
+ end
+
+ private
+
def flags(*sets)
sets.each do |set|
ARGV.clear
@@ -332,4 +455,3 @@ class TestRakeApplicationOptions < Rake::TestCase
@app.options
end
end
-
diff --git a/test/rake/test_rake_backtrace.rb b/test/rake/test_rake_backtrace.rb
new file mode 100644
index 0000000000..8db3b5ab54
--- /dev/null
+++ b/test/rake/test_rake_backtrace.rb
@@ -0,0 +1,113 @@
+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']
+ paths = [path + ":12"]
+
+ actual = Rake::Backtrace.collapse(paths)
+
+ assert_equal [], actual
+ end
+
+ def test_near_system_dir_isnt_suppressed
+ path = RbConfig::CONFIG['rubylibprefix']
+ 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
+
+ def invoke(*args)
+ rake(*args)
+ @err
+ end
+
+ def test_single_collapse
+ rakefile %q{
+ task :foo do
+ raise "foooo!"
+ end
+ }
+
+ lines = invoke("foo").split("\n")
+
+ assert_equal "rake aborted!", lines[0]
+ assert_equal "foooo!", lines[1]
+ assert_something_matches %r!\A#{Regexp.quote Dir.pwd}/Rakefile:3!i, lines
+ assert_something_matches %r!\ATasks:!, lines
+ end
+
+ def test_multi_collapse
+ rakefile %q{
+ task :foo do
+ Rake.application.invoke_task(:bar)
+ end
+ task :bar do
+ raise "barrr!"
+ end
+ }
+
+ lines = invoke("foo").split("\n")
+
+ assert_equal "rake aborted!", lines[0]
+ assert_equal "barrr!", lines[1]
+ assert_something_matches %r!\A#{Regexp.quote Dir.pwd}/Rakefile:6!i, lines
+ assert_something_matches %r!\A#{Regexp.quote Dir.pwd}/Rakefile:3!i, lines
+ assert_something_matches %r!\ATasks:!, lines
+ end
+
+ def test_suppress_option
+ rakefile %q{
+ task :baz do
+ raise "bazzz!"
+ end
+ }
+
+ lines = invoke("baz").split("\n")
+ assert_equal "rake aborted!", lines[0]
+ assert_equal "bazzz!", lines[1]
+ assert_something_matches %r!Rakefile!i, lines
+
+ 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]
+ end
+
+ private
+
+ # Assert that the pattern matches at least one line in +lines+.
+ def assert_something_matches(pattern, lines)
+ lines.each do |ln|
+ if pattern =~ ln
+ assert_match pattern, ln
+ return
+ end
+ end
+ 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..5e38950d38 100644
--- a/test/rake/test_rake_clean.rb
+++ b/test/rake/test_rake_clean.rb
@@ -2,13 +2,51 @@ 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
+
+ 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_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 631882c69d..8ae7537b50 100644
--- a/test/rake/test_rake_directory_task.rb
+++ b/test/rake/test_rake_directory_task.rb
@@ -36,11 +36,22 @@ class TestRakeDirectoryTask < Rake::TestCase
assert_nil Task['c:/'].comment
assert_equal "WIN32 DESC", Task['c:/a/b/c'].comment
assert_nil Task['c:/a/b'].comment
- verbose(false) {
- Task['c:/a/b'].invoke
- }
- assert File.exist?('c:/a/b')
- refute File.exist?('c:/a/b/c')
end
end
+
+ def test_can_use_blocks
+ runlist = []
+
+ t1 = directory("a/b/c" => :t2) { |t| runlist << t.name }
+ task(:t2) { |t| runlist << t.name }
+
+ verbose(false) {
+ t1.invoke
+ }
+
+ assert_equal Task["a/b/c"], t1
+ assert_equal FileCreationTask, Task["a/b/c"].class
+ assert_equal ["t2", "a/b/c"], runlist
+ 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..899f3bc509 100644
--- a/test/rake/test_rake_file_list.rb
+++ b/test/rake/test_rake_file_list.rb
@@ -166,7 +166,7 @@ class TestRakeFileList < Rake::TestCase
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 +404,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 +482,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 +503,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 +519,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 +609,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 +625,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 e586551237..fa3241b78b 100644
--- a/test/rake/test_rake_file_task.rb
+++ b/test/rake/test_rake_file_task.rb
@@ -26,7 +26,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
@@ -41,13 +41,30 @@ class TestRakeFileTask < Rake::TestCase
assert ! t1.needed?, "Should not need to rebuild new file because of old"
end
+ def test_file_times_new_depend_on_regular_task_timestamps
+ load_phony
+
+ name = "dummy"
+ task name
+
+ create_timed_files(NEWFILE)
+
+ t1 = Rake.application.intern(FileTask, NEWFILE).enhance([name])
+
+ assert t1.needed?, "depending on non-file task uses Time.now"
+
+ task(name => :phony)
+
+ 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"
@@ -62,7 +79,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
@@ -95,8 +112,11 @@ 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
-end
+ def load_phony
+ load File.join(@rake_lib, "rake/phony.rb")
+ end
+end
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 3764709f38..f2ce2f78f0 100644
--- a/test/rake/test_rake_functional.rb
+++ b/test/rake/test_rake_functional.rb
@@ -3,12 +3,10 @@ require 'fileutils'
require 'open3'
class TestRakeFunctional < Rake::TestCase
+ include RubyRunner
def setup
- @rake_path = File.expand_path("../../../bin/rake", __FILE__)
- lib_path = File.expand_path("../../../lib", __FILE__)
- @ruby_options = ["-I#{lib_path}", "-I."]
- @verbose = ENV['VERBOSE']
+ super
if @verbose
puts
@@ -17,8 +15,6 @@ class TestRakeFunctional < Rake::TestCase
puts @__name__
puts '-' * 80
end
-
- super
end
def test_rake_default
@@ -70,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
@@ -417,34 +413,54 @@ class TestRakeFunctional < Rake::TestCase
assert_equal "1\n", @out
end
- private
+ def can_detect_signals?
+ 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?)
+ end
+ status.respond_to?(:signaled?) && status.signaled?
+ 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)
+ def test_signal_propagation_in_tests
+ if can_detect_signals?
+ rakefile_test_signal
+ rake
+ assert_match(/ATEST/, @out)
+ refute_match(/BTEST/, @out)
+ else
+ skip "Signal detect seems broken on this system"
+ end
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_path] + rake_options
+ def test_failing_test_sets_exit_status
+ skip if uncertain_exit_status?
+ rakefile_failing_test_task
+ rake
+ assert @exit.exitstatus > 0, "should be non-zero"
end
- # Low level ruby command runner ...
- def run_ruby(option_list)
- puts "COMMAND: [#{RUBY} #{option_list.join ' '}]" if @verbose
+ def test_stand_alone_filelist
+ rakefile_stand_alone_filelist
- inn, out, err = Open3.popen3(Gem.ruby, *option_list)
- inn.close
+ run_ruby @ruby_options + ["stand_alone_filelist.rb"]
- @out = out.read
- @err = err.read
+ assert_match(/^stand_alone_filelist\.rb$/, @out)
+ assert_equal 0, @exit.exitstatus unless uncertain_exit_status?
+ end
+
+ private
- puts "OUTPUT: [#{@out}]" if @verbose
- puts "ERROR: [#{@err}]" if @verbose
- puts "PWD: [#{Dir.pwd}]" if @verbose
+ # We are unable to accurately verify that Rake returns a proper
+ # error exit status using popen3 in Ruby 1.8.7 and JRuby. This
+ # predicate function can be used to skip tests or assertions as
+ # needed.
+ def uncertain_exit_status?
+ RUBY_VERSION < "1.9" || defined?(JRUBY_VERSION)
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 cac235b9d3..fe10caf1db 100644
--- a/test/rake/test_rake_multi_task.rb
+++ b/test/rake/test_rake_multi_task.rb
@@ -47,5 +47,12 @@ class TestRakeMultiTask < Rake::TestCase
assert @runs.index("B0") < @runs.index("B1")
assert @runs.index("B1") < @runs.index("B2")
end
-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[: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..3ab977d013 100644
--- a/test/rake/test_rake_name_space.rb
+++ b/test/rake/test_rake_name_space.rb
@@ -38,6 +38,6 @@ 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
end
diff --git a/test/rake/test_rake_path_map.rb b/test/rake/test_rake_path_map.rb
index 32ffb854b1..b76a9491f9 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_rake_test_loader.rb b/test/rake/test_rake_rake_test_loader.rb
index be3c7da61f..0485c4c8ac 100644
--- a/test/rake/test_rake_rake_test_loader.rb
+++ b/test/rake/test_rake_rake_test_loader.rb
@@ -3,19 +3,18 @@ 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'
ARGV.replace %w[foo.rb test_*.rb -v]
- load File.expand_path('../../../lib/rake/rake_test_loader.rb', __FILE__)
+ load File.join(@rake_lib, 'rake/rake_test_loader.rb')
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
new file mode 100644
index 0000000000..d295266540
--- /dev/null
+++ b/test/rake/test_rake_reduce_compat.rb
@@ -0,0 +1,26 @@
+require File.expand_path('../helper', __FILE__)
+require 'open3'
+
+class TestRakeReduceCompat < Rake::TestCase
+ include RubyRunner
+
+ def invoke_normal(task_name)
+ rake task_name.to_s
+ @out
+ end
+
+ def test_no_deprecated_dsl
+ rakefile %q{
+ task :check_task do
+ Module.new { p defined?(task) }
+ end
+
+ task :check_file do
+ Module.new { p defined?(file) }
+ end
+ }
+
+ 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..376b99889c 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,44 @@ 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
+
+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 a5bc693237..2ab995a6ff 100644
--- a/test/rake/test_rake_task.rb
+++ b/test/rake/test_rake_task.rb
@@ -32,7 +32,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
@@ -40,8 +39,8 @@ class TestRakeTask < Rake::TestCase
def test_invoke
runlist = []
t1 = task(:t1 => [:t2, :t3]) { |t| runlist << t.name; 3321 }
- t2 = task(:t2) { |t| runlist << t.name }
- t3 = task(:t3) { |t| runlist << t.name }
+ task(:t2) { |t| runlist << t.name }
+ task(:t3) { |t| runlist << t.name }
assert_equal ["t2", "t3"], t1.prerequisites
t1.invoke
assert_equal ["t2", "t3", "t1"], runlist
@@ -88,8 +87,8 @@ class TestRakeTask < Rake::TestCase
def test_no_double_invoke
runlist = []
t1 = task(:t1 => [:t2, :t3]) { |t| runlist << t.name; 3321 }
- t2 = task(:t2 => [:t3]) { |t| runlist << t.name }
- t3 = task(:t3) { |t| runlist << t.name }
+ task(:t2 => [:t3]) { |t| runlist << t.name }
+ task(:t3) { |t| runlist << t.name }
t1.invoke
assert_equal ["t3", "t2", "t1"], runlist
end
@@ -104,10 +103,12 @@ class TestRakeTask < Rake::TestCase
end
def test_clear
+ desc "a task"
t = task("t" => "a") { }
t.clear
assert t.prerequisites.empty?, "prerequisites should be empty"
assert t.actions.empty?, "actions should be empty"
+ assert_nil t.comment, "comments should be empty"
end
def test_clear_prerequisites
@@ -123,6 +124,22 @@ class TestRakeTask < Rake::TestCase
assert t.actions.empty?, "actions should be empty"
end
+ def test_clear_comments
+ desc "the original foo"
+ task :foo => [:x] do
+ # Dummy action
+ end
+
+ task(:foo).clear_comments
+
+ desc "a slightly different foo"
+ task :foo
+
+ assert_equal "a slightly different foo", task(:foo).comment
+ assert_equal ["x"], task(:foo).prerequisites
+ assert_equal 1, task(:foo).actions.size
+ end
+
def test_find
task :tfind
assert_equal "tfind", Task[:tfind].name
@@ -139,8 +156,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
@@ -149,7 +166,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
@@ -186,7 +203,7 @@ class TestRakeTask < Rake::TestCase
def test_prerequiste_tasks_fails_if_prerequisites_are_undefined
a = task :a => ["b", "c"]
- b = task :b
+ task :b
assert_raises(RuntimeError) do
a.prerequisite_tasks
end
@@ -203,11 +220,36 @@ class TestRakeTask < Rake::TestCase
assert_equal [b, c], a.prerequisite_tasks
end
- def test_timestamp_returns_now_if_all_prereqs_have_no_times
+ 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
+ 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
+ task :c
+
assert_in_delta Time.now, a.timestamp, 0.1, 'computer too slow?'
end
@@ -220,7 +262,39 @@ 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
+ mx = Mutex.new
+ result = []
+
+ t_a = task(:a) do |t|
+ sleep 0.02
+ mx.synchronize { result << t.name }
+ end
+
+ t_b = task(:b) do |t|
+ mx.synchronize { result << t.name }
+ end
+
+ t_c = task(:c => [:a, :b]) do |t|
+ mx.synchronize { result << t.name }
+ end
+
+ t_c.invoke
+
+ # task should always run in order
+ assert_equal ['a', 'b', 'c'], result
+
+ [t_a, t_b, t_c].each { |t| t.reenable }
+ result.clear
+
+ Rake.application.options.always_multitask = true
+ t_c.invoke
+
+ # with multitask, task 'b' should grab the mutex first
+ assert_equal ['b', 'a', 'c'], result
end
def test_investigation_output
@@ -233,6 +307,30 @@ 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_extended_comments
desc %{
@@ -244,7 +342,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)
@@ -258,10 +356,21 @@ 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
-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
+end
diff --git a/test/rake/test_rake_task_arguments.rb b/test/rake/test_rake_task_arguments.rb
index 7001a4aeb2..061178e23e 100644
--- a/test/rake/test_rake_task_arguments.rb
+++ b/test/rake/test_rake_task_arguments.rb
@@ -26,8 +26,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 +85,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..5ec4c0e65c 100644
--- a/test/rake/test_rake_task_manager.rb
+++ b/test/rake/test_rake_task_manager.rb
@@ -37,7 +37,7 @@ 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_anonymous_namespace
@@ -55,7 +55,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
@@ -93,7 +93,7 @@ class TestRakeTaskManager < Rake::TestCase
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 +101,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 +114,19 @@ 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"]
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 +135,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 +156,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 ce81a4c1a8..9d56ffbe8a 100644
--- a/test/rake/test_rake_task_with_arguments.rb
+++ b/test/rake/test_rake_task_with_arguments.rb
@@ -33,21 +33,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
- t = 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 +81,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,19 +121,19 @@ 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
value = nil
- pre = task(:pre, :rev) { |t, args| value = args.rev }
+ task(:pre, :rev) { |t, args| value = args.rev }
t = task(:t, [:name, :rev] => [:pre])
t.invoke("bill", "1.2")
assert_equal "1.2", value
end
- def test_args_not_passed_if_no_prereq_names
- pre = task(:pre) { |t, args|
+ def test_args_not_passed_if_no_prereq_names_on_task
+ task(:pre) { |t, args|
assert_equal({}, args.to_hash)
assert_equal "bill", args.name
}
@@ -151,8 +141,17 @@ class TestRakeTaskWithArguments < Rake::TestCase
t.invoke("bill", "1.2")
end
+ def test_args_not_passed_if_no_prereq_names_on_multitask
+ task(:pre) { |t, args|
+ assert_equal({}, args.to_hash)
+ assert_equal "bill", args.name
+ }
+ t = multitask(:t, [:name, :rev] => [:pre])
+ t.invoke("bill", "1.2")
+ end
+
def test_args_not_passed_if_no_arg_names
- pre = task(:pre, :rev) { |t, args|
+ task(:pre, :rev) { |t, args|
assert_equal({}, args.to_hash)
}
t = task(:t => [:pre])
@@ -170,4 +169,3 @@ class TestRakeTaskWithArguments < Rake::TestCase
# HACK no assertions
end
end
-
diff --git a/test/rake/test_rake_test_task.rb b/test/rake/test_rake_test_task.rb
index 1a6d23e425..637accc291 100644
--- a/test/rake/test_rake_test_task.rb
+++ b/test/rake/test_rake_test_task.rb
@@ -28,7 +28,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 = '*'
@@ -117,4 +117,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
new file mode 100644
index 0000000000..93f32fb35a
--- /dev/null
+++ b/test/rake/test_rake_thread_pool.rb
@@ -0,0 +1,142 @@
+require File.expand_path('../helper', __FILE__)
+require 'rake/thread_pool'
+require 'test/unit/assertions'
+
+class TestRakeTestThreadPool < Rake::TestCase
+ include Rake
+
+ def test_pool_executes_in_current_thread_for_zero_threads
+ pool = ThreadPool.new(0)
+ 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 }
+ 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.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]
+ end
+
+ def test_pool_creates_the_correct_number_of_threads
+ pool = ThreadPool.new(2)
+ threads = Set.new
+ t_mutex = Mutex.new
+ 10.times.each do
+ pool.future do
+ sleep 0.02
+ t_mutex.synchronize { threads << Thread.current }
+ end
+ end
+ pool.join
+ assert_equal 2, threads.count
+ end
+
+ def test_pool_future_does_not_duplicate_arguments
+ pool = ThreadPool.new(2)
+ obj = Object.new
+ captured = nil
+ pool.future(obj) { |var| captured = var }
+ pool.join
+ assert_equal obj, captured
+ end
+
+ def test_pool_join_empties_queue
+ pool = ThreadPool.new(2)
+ repeat = 25
+ repeat.times {
+ pool.future do
+ repeat.times {
+ pool.future do
+ repeat.times {
+ pool.future do end
+ }
+ end
+ }
+ end
+ }
+
+ pool.join
+ 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|
+ raise CustomError if count < 1
+ pool.future(count - 1, &deep_exception_block).value
+ end
+
+ assert_raises(CustomError) do
+ pool.future(2, &deep_exception_block).value
+ end
+ end
+
+ def test_pool_prevents_deadlock
+ pool = ThreadPool.new(5)
+
+ common_dependency_a = pool.future { sleep 0.2 }
+ 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.map {
+ pool.future {
+ common_dependency_b.value
+ sleep(rand() * 0.01)
+ }
+ }
+
+ futures_b.each { |f| f.value }
+ pool.join
+ end
+
+ def test_pool_reports_correct_results
+ pool = ThreadPool.new(7)
+
+ a = 18
+ b = 5
+ c = 3
+
+ result = a.times.map do
+ pool.future do
+ b.times.map do
+ pool.future { sleep rand * 0.001; c }
+ end.reduce(0) { |m, f| m + f.value }
+ end
+ end.reduce(0) { |m, f| m + f.value }
+
+ assert_equal a * b * c, result
+ pool.join
+ end
+
+end
diff --git a/test/rake/test_rake_top_level_functions.rb b/test/rake/test_rake_top_level_functions.rb
index 1ed1af02e3..fee702dc13 100644
--- a/test/rake/test_rake_top_level_functions.rb
+++ b/test/rake/test_rake_top_level_functions.rb
@@ -23,7 +23,7 @@ class TestRakeTopLevelFunctions < Rake::TestCase
def test_namespace
block = proc do end
- namespace("xyz", &block)
+ namespace("xyz", &block)
expected = [
[[:in_namespace, 'xyz'], block]
@@ -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
new file mode 100644
index 0000000000..bb5879cff5
--- /dev/null
+++ b/test/rake/test_thread_history_display.rb
@@ -0,0 +1,101 @@
+require File.expand_path('../helper', __FILE__)
+
+require 'rake/thread_history_display'
+
+class TestThreadHistoryDisplay < Rake::TestCase
+ def setup
+ super
+ @time = 1_000_000
+ @stats = []
+ @display = Rake::ThreadHistoryDisplay.new(@stats)
+ end
+
+ def test_banner
+ out, _ = capture_io do
+ @display.show
+ end
+ assert_match(/Job History/i, out)
+ end
+
+ def test_item_queued
+ @stats << event(:item_queued, :item_id => 123)
+ out, _ = capture_io do
+ @display.show
+ end
+ assert_match(/^ *1000000 +A +item_queued +item_id:1$/, out)
+ end
+
+ def test_item_dequeued
+ @stats << event(:item_dequeued, :item_id => 123)
+ out, _ = capture_io do
+ @display.show
+ end
+ assert_match(/^ *1000000 +A +item_dequeued +item_id:1$/, out)
+ end
+
+ def test_multiple_items
+ @stats << event(:item_queued, :item_id => 123)
+ @stats << event(:item_queued, :item_id => 124)
+ out, _ = capture_io do
+ @display.show
+ end
+ assert_match(/^ *1000000 +A +item_queued +item_id:1$/, out)
+ assert_match(/^ *1000001 +A +item_queued +item_id:2$/, out)
+ end
+
+ def test_waiting
+ @stats << event(:waiting, :item_id => 123)
+ out, _ = capture_io do
+ @display.show
+ end
+ assert_match(/^ *1000000 +A +waiting +item_id:1$/, out)
+ end
+
+ def test_continue
+ @stats << event(:continue, :item_id => 123)
+ out, _ = capture_io do
+ @display.show
+ end
+ assert_match(/^ *1000000 +A +continue +item_id:1$/, out)
+ end
+
+ def test_thread_deleted
+ @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)
+ end
+
+ def test_thread_created
+ @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)
+ end
+
+ private
+
+ def event(type, data = {})
+ result = {
+ :event => type,
+ :time => @time / 1_000_000.0,
+ :data => data,
+ :thread => Thread.current.object_id
+ }
+ @time += 1
+ result
+ end
+
+end
diff --git a/test/rake/test_trace_output.rb b/test/rake/test_trace_output.rb
new file mode 100644
index 0000000000..f9aead989d
--- /dev/null
+++ b/test/rake/test_trace_output.rb
@@ -0,0 +1,52 @@
+require File.expand_path('../helper', __FILE__)
+require 'stringio'
+
+class TestTraceOutput < Rake::TestCase
+ include Rake::TraceOutput
+
+ class PrintSpy
+ attr_reader :result, :calls
+
+ def initialize
+ @result = ""
+ @calls = 0
+ end
+
+ def print(string)
+ @result << string
+ @calls += 1
+ end
+ end
+
+ def test_trace_issues_single_io_for_args_with_empty_args
+ spy = PrintSpy.new
+ trace_on(spy)
+ assert_equal "\n", spy.result
+ assert_equal 1, spy.calls
+ end
+
+ def test_trace_issues_single_io_for_args_multiple_strings
+ spy = PrintSpy.new
+ trace_on(spy, "HI\n", "LO")
+ assert_equal "HI\nLO\n", spy.result
+ 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"
+ spy = PrintSpy.new
+ trace_on(spy, "HI\r", "LO")
+ assert_equal "HI\rLO\r", spy.result
+ assert_equal 1, spy.calls
+ ensure
+ $\ = old_sep
+ end
+end
diff --git a/test/rdoc/MarkdownTest_1.0.3/Amps and angle encoding.text b/test/rdoc/MarkdownTest_1.0.3/Amps and angle encoding.text
new file mode 100644
index 0000000000..0e9527f931
--- /dev/null
+++ b/test/rdoc/MarkdownTest_1.0.3/Amps and angle encoding.text
@@ -0,0 +1,21 @@
+AT&T has an ampersand in their name.
+
+AT&amp;T is another way to write it.
+
+This & that.
+
+4 < 5.
+
+6 > 5.
+
+Here's a [link] [1] with an ampersand in the URL.
+
+Here's a link with an amersand in the link text: [AT&T] [2].
+
+Here's an inline [link](/script?foo=1&bar=2).
+
+Here's an inline [link](</script?foo=1&bar=2>).
+
+
+[1]: http://example.com/?foo=1&bar=2
+[2]: http://att.com/ "AT&T" \ No newline at end of file
diff --git a/test/rdoc/MarkdownTest_1.0.3/Auto links.text b/test/rdoc/MarkdownTest_1.0.3/Auto links.text
new file mode 100644
index 0000000000..abbc48869d
--- /dev/null
+++ b/test/rdoc/MarkdownTest_1.0.3/Auto links.text
@@ -0,0 +1,13 @@
+Link: <http://example.com/>.
+
+With an ampersand: <http://example.com/?foo=1&bar=2>
+
+* In a list?
+* <http://example.com/>
+* It should.
+
+> Blockquoted: <http://example.com/>
+
+Auto-links should not occur here: `<http://example.com/>`
+
+ or here: <http://example.com/> \ No newline at end of file
diff --git a/test/rdoc/MarkdownTest_1.0.3/Backslash escapes.text b/test/rdoc/MarkdownTest_1.0.3/Backslash escapes.text
new file mode 100644
index 0000000000..5b014cb33d
--- /dev/null
+++ b/test/rdoc/MarkdownTest_1.0.3/Backslash escapes.text
@@ -0,0 +1,120 @@
+These should all get escaped:
+
+Backslash: \\
+
+Backtick: \`
+
+Asterisk: \*
+
+Underscore: \_
+
+Left brace: \{
+
+Right brace: \}
+
+Left bracket: \[
+
+Right bracket: \]
+
+Left paren: \(
+
+Right paren: \)
+
+Greater-than: \>
+
+Hash: \#
+
+Period: \.
+
+Bang: \!
+
+Plus: \+
+
+Minus: \-
+
+
+
+These should not, because they occur within a code block:
+
+ Backslash: \\
+
+ Backtick: \`
+
+ Asterisk: \*
+
+ Underscore: \_
+
+ Left brace: \{
+
+ Right brace: \}
+
+ Left bracket: \[
+
+ Right bracket: \]
+
+ Left paren: \(
+
+ Right paren: \)
+
+ Greater-than: \>
+
+ Hash: \#
+
+ Period: \.
+
+ Bang: \!
+
+ Plus: \+
+
+ Minus: \-
+
+
+Nor should these, which occur in code spans:
+
+Backslash: `\\`
+
+Backtick: `` \` ``
+
+Asterisk: `\*`
+
+Underscore: `\_`
+
+Left brace: `\{`
+
+Right brace: `\}`
+
+Left bracket: `\[`
+
+Right bracket: `\]`
+
+Left paren: `\(`
+
+Right paren: `\)`
+
+Greater-than: `\>`
+
+Hash: `\#`
+
+Period: `\.`
+
+Bang: `\!`
+
+Plus: `\+`
+
+Minus: `\-`
+
+
+These should get escaped, even though they're matching pairs for
+other Markdown constructs:
+
+\*asterisks\*
+
+\_underscores\_
+
+\`backticks\`
+
+This is a code span with a literal backslash-backtick sequence: `` \` ``
+
+This is a tag with unescaped backticks <span attr='`ticks`'>bar</span>.
+
+This is a tag with backslashes <span attr='\\backslashes\\'>bar</span>.
diff --git a/test/rdoc/MarkdownTest_1.0.3/Blockquotes with code blocks.text b/test/rdoc/MarkdownTest_1.0.3/Blockquotes with code blocks.text
new file mode 100644
index 0000000000..c31d171049
--- /dev/null
+++ b/test/rdoc/MarkdownTest_1.0.3/Blockquotes with code blocks.text
@@ -0,0 +1,11 @@
+> Example:
+>
+> sub status {
+> print "working";
+> }
+>
+> Or:
+>
+> sub status {
+> return "working";
+> }
diff --git a/test/rdoc/MarkdownTest_1.0.3/Code Blocks.text b/test/rdoc/MarkdownTest_1.0.3/Code Blocks.text
new file mode 100644
index 0000000000..b54b09285a
--- /dev/null
+++ b/test/rdoc/MarkdownTest_1.0.3/Code Blocks.text
@@ -0,0 +1,14 @@
+ code block on the first line
+
+Regular text.
+
+ code block indented by spaces
+
+Regular text.
+
+ the lines in this block
+ all contain trailing spaces
+
+Regular Text.
+
+ code block on the last line \ No newline at end of file
diff --git a/test/rdoc/MarkdownTest_1.0.3/Code Spans.text b/test/rdoc/MarkdownTest_1.0.3/Code Spans.text
new file mode 100644
index 0000000000..750a1973df
--- /dev/null
+++ b/test/rdoc/MarkdownTest_1.0.3/Code Spans.text
@@ -0,0 +1,6 @@
+`<test a="` content of attribute `">`
+
+Fix for backticks within HTML tag: <span attr='`ticks`'>like this</span>
+
+Here's how you put `` `backticks` `` in a code span.
+
diff --git a/test/rdoc/MarkdownTest_1.0.3/Hard-wrapped paragraphs with list-like lines.text b/test/rdoc/MarkdownTest_1.0.3/Hard-wrapped paragraphs with list-like lines.text
new file mode 100644
index 0000000000..f8a5b27bf4
--- /dev/null
+++ b/test/rdoc/MarkdownTest_1.0.3/Hard-wrapped paragraphs with list-like lines.text
@@ -0,0 +1,8 @@
+In Markdown 1.0.0 and earlier. Version
+8. This line turns into a list item.
+Because a hard-wrapped line in the
+middle of a paragraph looked like a
+list item.
+
+Here's one with a bullet.
+* criminey.
diff --git a/test/rdoc/MarkdownTest_1.0.3/Horizontal rules.text b/test/rdoc/MarkdownTest_1.0.3/Horizontal rules.text
new file mode 100644
index 0000000000..1594bda27b
--- /dev/null
+++ b/test/rdoc/MarkdownTest_1.0.3/Horizontal rules.text
@@ -0,0 +1,67 @@
+Dashes:
+
+---
+
+ ---
+
+ ---
+
+ ---
+
+ ---
+
+- - -
+
+ - - -
+
+ - - -
+
+ - - -
+
+ - - -
+
+
+Asterisks:
+
+***
+
+ ***
+
+ ***
+
+ ***
+
+ ***
+
+* * *
+
+ * * *
+
+ * * *
+
+ * * *
+
+ * * *
+
+
+Underscores:
+
+___
+
+ ___
+
+ ___
+
+ ___
+
+ ___
+
+_ _ _
+
+ _ _ _
+
+ _ _ _
+
+ _ _ _
+
+ _ _ _
diff --git a/test/rdoc/MarkdownTest_1.0.3/Inline HTML (Advanced).text b/test/rdoc/MarkdownTest_1.0.3/Inline HTML (Advanced).text
new file mode 100644
index 0000000000..86b7206d2a
--- /dev/null
+++ b/test/rdoc/MarkdownTest_1.0.3/Inline HTML (Advanced).text
@@ -0,0 +1,15 @@
+Simple block on one line:
+
+<div>foo</div>
+
+And nested without indentation:
+
+<div>
+<div>
+<div>
+foo
+</div>
+<div style=">"/>
+</div>
+<div>bar</div>
+</div>
diff --git a/test/rdoc/MarkdownTest_1.0.3/Inline HTML (Simple).text b/test/rdoc/MarkdownTest_1.0.3/Inline HTML (Simple).text
new file mode 100644
index 0000000000..14aa2dc272
--- /dev/null
+++ b/test/rdoc/MarkdownTest_1.0.3/Inline HTML (Simple).text
@@ -0,0 +1,69 @@
+Here's a simple block:
+
+<div>
+ foo
+</div>
+
+This should be a code block, though:
+
+ <div>
+ foo
+ </div>
+
+As should this:
+
+ <div>foo</div>
+
+Now, nested:
+
+<div>
+ <div>
+ <div>
+ foo
+ </div>
+ </div>
+</div>
+
+This should just be an HTML comment:
+
+<!-- Comment -->
+
+Multiline:
+
+<!--
+Blah
+Blah
+-->
+
+Code block:
+
+ <!-- Comment -->
+
+Just plain comment, with trailing spaces on the line:
+
+<!-- foo -->
+
+Code:
+
+ <hr />
+
+Hr's:
+
+<hr>
+
+<hr/>
+
+<hr />
+
+<hr>
+
+<hr/>
+
+<hr />
+
+<hr class="foo" id="bar" />
+
+<hr class="foo" id="bar"/>
+
+<hr class="foo" id="bar" >
+
diff --git a/test/rdoc/MarkdownTest_1.0.3/Inline HTML comments.text b/test/rdoc/MarkdownTest_1.0.3/Inline HTML comments.text
new file mode 100644
index 0000000000..41d830d038
--- /dev/null
+++ b/test/rdoc/MarkdownTest_1.0.3/Inline HTML comments.text
@@ -0,0 +1,13 @@
+Paragraph one.
+
+<!-- This is a simple comment -->
+
+<!--
+ This is another comment.
+-->
+
+Paragraph two.
+
+<!-- one comment block -- -- with two comments -->
+
+The end.
diff --git a/test/rdoc/MarkdownTest_1.0.3/Links, inline style.text b/test/rdoc/MarkdownTest_1.0.3/Links, inline style.text
new file mode 100644
index 0000000000..09017a90c7
--- /dev/null
+++ b/test/rdoc/MarkdownTest_1.0.3/Links, inline style.text
@@ -0,0 +1,12 @@
+Just a [URL](/url/).
+
+[URL and title](/url/ "title").
+
+[URL and title](/url/ "title preceded by two spaces").
+
+[URL and title](/url/ "title preceded by a tab").
+
+[URL and title](/url/ "title has spaces afterward" ).
+
+
+[Empty]().
diff --git a/test/rdoc/MarkdownTest_1.0.3/Links, reference style.text b/test/rdoc/MarkdownTest_1.0.3/Links, reference style.text
new file mode 100644
index 0000000000..341ec88e3d
--- /dev/null
+++ b/test/rdoc/MarkdownTest_1.0.3/Links, reference style.text
@@ -0,0 +1,71 @@
+Foo [bar] [1].
+
+Foo [bar][1].
+
+Foo [bar]
+[1].
+
+[1]: /url/ "Title"
+
+
+With [embedded [brackets]] [b].
+
+
+Indented [once][].
+
+Indented [twice][].
+
+Indented [thrice][].
+
+Indented [four][] times.
+
+ [once]: /url
+
+ [twice]: /url
+
+ [thrice]: /url
+
+ [four]: /url
+
+
+[b]: /url/
+
+* * *
+
+[this] [this] should work
+
+So should [this][this].
+
+And [this] [].
+
+And [this][].
+
+And [this].
+
+But not [that] [].
+
+Nor [that][].
+
+Nor [that].
+
+[Something in brackets like [this][] should work]
+
+[Same with [this].]
+
+In this case, [this](/somethingelse/) points to something else.
+
+Backslashing should suppress \[this] and [this\].
+
+[this]: foo
+
+
+* * *
+
+Here's one where the [link
+breaks] across lines.
+
+Here's another where the [link
+breaks] across lines, but with a line-ending space.
+
+
+[link breaks]: /url/
diff --git a/test/rdoc/MarkdownTest_1.0.3/Links, shortcut references.text b/test/rdoc/MarkdownTest_1.0.3/Links, shortcut references.text
new file mode 100644
index 0000000000..8c44c98fee
--- /dev/null
+++ b/test/rdoc/MarkdownTest_1.0.3/Links, shortcut references.text
@@ -0,0 +1,20 @@
+This is the [simple case].
+
+[simple case]: /simple
+
+
+
+This one has a [line
+break].
+
+This one has a [line
+break] with a line-ending space.
+
+[line break]: /foo
+
+
+[this] [that] and the [other]
+
+[this]: /this
+[that]: /that
+[other]: /other
diff --git a/test/rdoc/MarkdownTest_1.0.3/Literal quotes in titles.text b/test/rdoc/MarkdownTest_1.0.3/Literal quotes in titles.text
new file mode 100644
index 0000000000..29d0e4235b
--- /dev/null
+++ b/test/rdoc/MarkdownTest_1.0.3/Literal quotes in titles.text
@@ -0,0 +1,7 @@
+Foo [bar][].
+
+Foo [bar](/url/ "Title with "quotes" inside").
+
+
+ [bar]: /url/ "Title with "quotes" inside"
+
diff --git a/test/rdoc/MarkdownTest_1.0.3/Markdown Documentation - Basics.text b/test/rdoc/MarkdownTest_1.0.3/Markdown Documentation - Basics.text
new file mode 100644
index 0000000000..486055ca7f
--- /dev/null
+++ b/test/rdoc/MarkdownTest_1.0.3/Markdown Documentation - Basics.text
@@ -0,0 +1,306 @@
+Markdown: Basics
+================
+
+<ul id="ProjectSubmenu">
+ <li><a href="/projects/markdown/" title="Markdown Project Page">Main</a></li>
+ <li><a class="selected" title="Markdown Basics">Basics</a></li>
+ <li><a href="/projects/markdown/syntax" title="Markdown Syntax Documentation">Syntax</a></li>
+ <li><a href="/projects/markdown/license" title="Pricing and License Information">License</a></li>
+ <li><a href="/projects/markdown/dingus" title="Online Markdown Web Form">Dingus</a></li>
+</ul>
+
+
+Getting the Gist of Markdown's Formatting Syntax
+------------------------------------------------
+
+This page offers a brief overview of what it's like to use Markdown.
+The [syntax page] [s] provides complete, detailed documentation for
+every feature, but Markdown should be very easy to pick up simply by
+looking at a few examples of it in action. The examples on this page
+are written in a before/after style, showing example syntax and the
+HTML output produced by Markdown.
+
+It's also helpful to simply try Markdown out; the [Dingus] [d] is a
+web application that allows you type your own Markdown-formatted text
+and translate it to XHTML.
+
+**Note:** This document is itself written using Markdown; you
+can [see the source for it by adding '.text' to the URL] [src].
+
+ [s]: /projects/markdown/syntax "Markdown Syntax"
+ [d]: /projects/markdown/dingus "Markdown Dingus"
+ [src]: /projects/markdown/basics.text
+
+
+## Paragraphs, Headers, Blockquotes ##
+
+A paragraph is simply one or more consecutive lines of text, separated
+by one or more blank lines. (A blank line is any line that looks like a
+blank line -- a line containing nothing spaces or tabs is considered
+blank.) Normal paragraphs should not be intended with spaces or tabs.
+
+Markdown offers two styles of headers: *Setext* and *atx*.
+Setext-style headers for `<h1>` and `<h2>` are created by
+"underlining" with equal signs (`=`) and hyphens (`-`), respectively.
+To create an atx-style header, you put 1-6 hash marks (`#`) at the
+beginning of the line -- the number of hashes equals the resulting
+HTML header level.
+
+Blockquotes are indicated using email-style '`>`' angle brackets.
+
+Markdown:
+
+ A First Level Header
+ ====================
+
+ A Second Level Header
+ ---------------------
+
+ Now is the time for all good men to come to
+ the aid of their country. This is just a
+ regular paragraph.
+
+ The quick brown fox jumped over the lazy
+ dog's back.
+
+ ### Header 3
+
+ > This is a blockquote.
+ >
+ > This is the second paragraph in the blockquote.
+ >
+ > ## This is an H2 in a blockquote
+
+
+Output:
+
+ <h1>A First Level Header</h1>
+
+ <h2>A Second Level Header</h2>
+
+ <p>Now is the time for all good men to come to
+ the aid of their country. This is just a
+ regular paragraph.</p>
+
+ <p>The quick brown fox jumped over the lazy
+ dog's back.</p>
+
+ <h3>Header 3</h3>
+
+ <blockquote>
+ <p>This is a blockquote.</p>
+
+ <p>This is the second paragraph in the blockquote.</p>
+
+ <h2>This is an H2 in a blockquote</h2>
+ </blockquote>
+
+
+
+### Phrase Emphasis ###
+
+Markdown uses asterisks and underscores to indicate spans of emphasis.
+
+Markdown:
+
+ Some of these words *are emphasized*.
+ Some of these words _are emphasized also_.
+
+ Use two asterisks for **strong emphasis**.
+ Or, if you prefer, __use two underscores instead__.
+
+Output:
+
+ <p>Some of these words <em>are emphasized</em>.
+ Some of these words <em>are emphasized also</em>.</p>
+
+ <p>Use two asterisks for <strong>strong emphasis</strong>.
+ Or, if you prefer, <strong>use two underscores instead</strong>.</p>
+
+
+
+## Lists ##
+
+Unordered (bulleted) lists use asterisks, pluses, and hyphens (`*`,
+`+`, and `-`) as list markers. These three markers are
+interchangable; this:
+
+ * Candy.
+ * Gum.
+ * Booze.
+
+this:
+
+ + Candy.
+ + Gum.
+ + Booze.
+
+and this:
+
+ - Candy.
+ - Gum.
+ - Booze.
+
+all produce the same output:
+
+ <ul>
+ <li>Candy.</li>
+ <li>Gum.</li>
+ <li>Booze.</li>
+ </ul>
+
+Ordered (numbered) lists use regular numbers, followed by periods, as
+list markers:
+
+ 1. Red
+ 2. Green
+ 3. Blue
+
+Output:
+
+ <ol>
+ <li>Red</li>
+ <li>Green</li>
+ <li>Blue</li>
+ </ol>
+
+If you put blank lines between items, you'll get `<p>` tags for the
+list item text. You can create multi-paragraph list items by indenting
+the paragraphs by 4 spaces or 1 tab:
+
+ * A list item.
+
+ With multiple paragraphs.
+
+ * Another item in the list.
+
+Output:
+
+ <ul>
+ <li><p>A list item.</p>
+ <p>With multiple paragraphs.</p></li>
+ <li><p>Another item in the list.</p></li>
+ </ul>
+
+
+
+### Links ###
+
+Markdown supports two styles for creating links: *inline* and
+*reference*. With both styles, you use square brackets to delimit the
+text you want to turn into a link.
+
+Inline-style links use parentheses immediately after the link text.
+For example:
+
+ This is an [example link](http://example.com/).
+
+Output:
+
+ <p>This is an <a href="http://example.com/">
+ example link</a>.</p>
+
+Optionally, you may include a title attribute in the parentheses:
+
+ This is an [example link](http://example.com/ "With a Title").
+
+Output:
+
+ <p>This is an <a href="http://example.com/" title="With a Title">
+ example link</a>.</p>
+
+Reference-style links allow you to refer to your links by names, which
+you define elsewhere in your document:
+
+ I get 10 times more traffic from [Google][1] than from
+ [Yahoo][2] or [MSN][3].
+
+ [1]: http://google.com/ "Google"
+ [2]: http://search.yahoo.com/ "Yahoo Search"
+ [3]: http://search.msn.com/ "MSN Search"
+
+Output:
+
+ <p>I get 10 times more traffic from <a href="http://google.com/"
+ title="Google">Google</a> than from <a href="http://search.yahoo.com/"
+ title="Yahoo Search">Yahoo</a> or <a href="http://search.msn.com/"
+ title="MSN Search">MSN</a>.</p>
+
+The title attribute is optional. Link names may contain letters,
+numbers and spaces, but are *not* case sensitive:
+
+ I start my morning with a cup of coffee and
+ [The New York Times][NY Times].
+
+ [ny times]: http://www.nytimes.com/
+
+Output:
+
+ <p>I start my morning with a cup of coffee and
+ <a href="http://www.nytimes.com/">The New York Times</a>.</p>
+
+
+### Images ###
+
+Image syntax is very much like link syntax.
+
+Inline (titles are optional):
+
+ ![alt text](/path/to/img.jpg "Title")
+
+Reference-style:
+
+ ![alt text][id]
+
+ [id]: /path/to/img.jpg "Title"
+
+Both of the above examples produce the same output:
+
+ <img src="/path/to/img.jpg" alt="alt text" title="Title" />
+
+
+
+### Code ###
+
+In a regular paragraph, you can create code span by wrapping text in
+backtick quotes. Any ampersands (`&`) and angle brackets (`<` or
+`>`) will automatically be translated into HTML entities. This makes
+it easy to use Markdown to write about HTML example code:
+
+ I strongly recommend against using any `<blink>` tags.
+
+ I wish SmartyPants used named entities like `&mdash;`
+ instead of decimal-encoded entites like `&#8212;`.
+
+Output:
+
+ <p>I strongly recommend against using any
+ <code>&lt;blink&gt;</code> tags.</p>
+
+ <p>I wish SmartyPants used named entities like
+ <code>&amp;mdash;</code> instead of decimal-encoded
+ entites like <code>&amp;#8212;</code>.</p>
+
+
+To specify an entire block of pre-formatted code, indent every line of
+the block by 4 spaces or 1 tab. Just like with code spans, `&`, `<`,
+and `>` characters will be escaped automatically.
+
+Markdown:
+
+ If you want your page to validate under XHTML 1.0 Strict,
+ you've got to put paragraph tags in your blockquotes:
+
+ <blockquote>
+ <p>For example.</p>
+ </blockquote>
+
+Output:
+
+ <p>If you want your page to validate under XHTML 1.0 Strict,
+ you've got to put paragraph tags in your blockquotes:</p>
+
+ <pre><code>&lt;blockquote&gt;
+ &lt;p&gt;For example.&lt;/p&gt;
+ &lt;/blockquote&gt;
+ </code></pre>
diff --git a/test/rdoc/MarkdownTest_1.0.3/Markdown Documentation - Syntax.text b/test/rdoc/MarkdownTest_1.0.3/Markdown Documentation - Syntax.text
new file mode 100644
index 0000000000..57360a16c8
--- /dev/null
+++ b/test/rdoc/MarkdownTest_1.0.3/Markdown Documentation - Syntax.text
@@ -0,0 +1,888 @@
+Markdown: Syntax
+================
+
+<ul id="ProjectSubmenu">
+ <li><a href="/projects/markdown/" title="Markdown Project Page">Main</a></li>
+ <li><a href="/projects/markdown/basics" title="Markdown Basics">Basics</a></li>
+ <li><a class="selected" title="Markdown Syntax Documentation">Syntax</a></li>
+ <li><a href="/projects/markdown/license" title="Pricing and License Information">License</a></li>
+ <li><a href="/projects/markdown/dingus" title="Online Markdown Web Form">Dingus</a></li>
+</ul>
+
+
+* [Overview](#overview)
+ * [Philosophy](#philosophy)
+ * [Inline HTML](#html)
+ * [Automatic Escaping for Special Characters](#autoescape)
+* [Block Elements](#block)
+ * [Paragraphs and Line Breaks](#p)
+ * [Headers](#header)
+ * [Blockquotes](#blockquote)
+ * [Lists](#list)
+ * [Code Blocks](#precode)
+ * [Horizontal Rules](#hr)
+* [Span Elements](#span)
+ * [Links](#link)
+ * [Emphasis](#em)
+ * [Code](#code)
+ * [Images](#img)
+* [Miscellaneous](#misc)
+ * [Backslash Escapes](#backslash)
+ * [Automatic Links](#autolink)
+
+
+**Note:** This document is itself written using Markdown; you
+can [see the source for it by adding '.text' to the URL][src].
+
+ [src]: /projects/markdown/syntax.text
+
+* * *
+
+<h2 id="overview">Overview</h2>
+
+<h3 id="philosophy">Philosophy</h3>
+
+Markdown is intended to be as easy-to-read and easy-to-write as is feasible.
+
+Readability, however, is emphasized above all else. A Markdown-formatted
+document should be publishable as-is, as plain text, without looking
+like it's been marked up with tags or formatting instructions. While
+Markdown's syntax has been influenced by several existing text-to-HTML
+filters -- including [Setext] [1], [atx] [2], [Textile] [3], [reStructuredText] [4],
+[Grutatext] [5], and [EtText] [6] -- the single biggest source of
+inspiration for Markdown's syntax is the format of plain text email.
+
+ [1]: http://docutils.sourceforge.net/mirror/setext.html
+ [2]: http://www.aaronsw.com/2002/atx/
+ [3]: http://textism.com/tools/textile/
+ [4]: http://docutils.sourceforge.net/rst.html
+ [5]: http://www.triptico.com/software/grutatxt.html
+ [6]: http://ettext.taint.org/doc/
+
+To this end, Markdown's syntax is comprised entirely of punctuation
+characters, which punctuation characters have been carefully chosen so
+as to look like what they mean. E.g., asterisks around a word actually
+look like \*emphasis\*. Markdown lists look like, well, lists. Even
+blockquotes look like quoted passages of text, assuming you've ever
+used email.
+
+
+
+<h3 id="html">Inline HTML</h3>
+
+Markdown's syntax is intended for one purpose: to be used as a
+format for *writing* for the web.
+
+Markdown is not a replacement for HTML, or even close to it. Its
+syntax is very small, corresponding only to a very small subset of
+HTML tags. The idea is *not* to create a syntax that makes it easier
+to insert HTML tags. In my opinion, HTML tags are already easy to
+insert. The idea for Markdown is to make it easy to read, write, and
+edit prose. HTML is a *publishing* format; Markdown is a *writing*
+format. Thus, Markdown's formatting syntax only addresses issues that
+can be conveyed in plain text.
+
+For any markup that is not covered by Markdown's syntax, you simply
+use HTML itself. There's no need to preface it or delimit it to
+indicate that you're switching from Markdown to HTML; you just use
+the tags.
+
+The only restrictions are that block-level HTML elements -- e.g. `<div>`,
+`<table>`, `<pre>`, `<p>`, etc. -- must be separated from surrounding
+content by blank lines, and the start and end tags of the block should
+not be indented with tabs or spaces. Markdown is smart enough not
+to add extra (unwanted) `<p>` tags around HTML block-level tags.
+
+For example, to add an HTML table to a Markdown article:
+
+ This is a regular paragraph.
+
+ <table>
+ <tr>
+ <td>Foo</td>
+ </tr>
+ </table>
+
+ This is another regular paragraph.
+
+Note that Markdown formatting syntax is not processed within block-level
+HTML tags. E.g., you can't use Markdown-style `*emphasis*` inside an
+HTML block.
+
+Span-level HTML tags -- e.g. `<span>`, `<cite>`, or `<del>` -- can be
+used anywhere in a Markdown paragraph, list item, or header. If you
+want, you can even use HTML tags instead of Markdown formatting; e.g. if
+you'd prefer to use HTML `<a>` or `<img>` tags instead of Markdown's
+link or image syntax, go right ahead.
+
+Unlike block-level HTML tags, Markdown syntax *is* processed within
+span-level tags.
+
+
+<h3 id="autoescape">Automatic Escaping for Special Characters</h3>
+
+In HTML, there are two characters that demand special treatment: `<`
+and `&`. Left angle brackets are used to start tags; ampersands are
+used to denote HTML entities. If you want to use them as literal
+characters, you must escape them as entities, e.g. `&lt;`, and
+`&amp;`.
+
+Ampersands in particular are bedeviling for web writers. If you want to
+write about 'AT&T', you need to write '`AT&amp;T`'. You even need to
+escape ampersands within URLs. Thus, if you want to link to:
+
+ http://images.google.com/images?num=30&q=larry+bird
+
+you need to encode the URL as:
+
+ http://images.google.com/images?num=30&amp;q=larry+bird
+
+in your anchor tag `href` attribute. Needless to say, this is easy to
+forget, and is probably the single most common source of HTML validation
+errors in otherwise well-marked-up web sites.
+
+Markdown allows you to use these characters naturally, taking care of
+all the necessary escaping for you. If you use an ampersand as part of
+an HTML entity, it remains unchanged; otherwise it will be translated
+into `&amp;`.
+
+So, if you want to include a copyright symbol in your article, you can write:
+
+ &copy;
+
+and Markdown will leave it alone. But if you write:
+
+ AT&T
+
+Markdown will translate it to:
+
+ AT&amp;T
+
+Similarly, because Markdown supports [inline HTML](#html), if you use
+angle brackets as delimiters for HTML tags, Markdown will treat them as
+such. But if you write:
+
+ 4 < 5
+
+Markdown will translate it to:
+
+ 4 &lt; 5
+
+However, inside Markdown code spans and blocks, angle brackets and
+ampersands are *always* encoded automatically. This makes it easy to use
+Markdown to write about HTML code. (As opposed to raw HTML, which is a
+terrible format for writing about HTML syntax, because every single `<`
+and `&` in your example code needs to be escaped.)
+
+
+* * *
+
+
+<h2 id="block">Block Elements</h2>
+
+
+<h3 id="p">Paragraphs and Line Breaks</h3>
+
+A paragraph is simply one or more consecutive lines of text, separated
+by one or more blank lines. (A blank line is any line that looks like a
+blank line -- a line containing nothing but spaces or tabs is considered
+blank.) Normal paragraphs should not be intended with spaces or tabs.
+
+The implication of the "one or more consecutive lines of text" rule is
+that Markdown supports "hard-wrapped" text paragraphs. This differs
+significantly from most other text-to-HTML formatters (including Movable
+Type's "Convert Line Breaks" option) which translate every line break
+character in a paragraph into a `<br />` tag.
+
+When you *do* want to insert a `<br />` break tag using Markdown, you
+end a line with two or more spaces, then type return.
+
+Yes, this takes a tad more effort to create a `<br />`, but a simplistic
+"every line break is a `<br />`" rule wouldn't work for Markdown.
+Markdown's email-style [blockquoting][bq] and multi-paragraph [list items][l]
+work best -- and look better -- when you format them with hard breaks.
+
+ [bq]: #blockquote
+ [l]: #list
+
+
+
+<h3 id="header">Headers</h3>
+
+Markdown supports two styles of headers, [Setext] [1] and [atx] [2].
+
+Setext-style headers are "underlined" using equal signs (for first-level
+headers) and dashes (for second-level headers). For example:
+
+ This is an H1
+ =============
+
+ This is an H2
+ -------------
+
+Any number of underlining `=`'s or `-`'s will work.
+
+Atx-style headers use 1-6 hash characters at the start of the line,
+corresponding to header levels 1-6. For example:
+
+ # This is an H1
+
+ ## This is an H2
+
+ ###### This is an H6
+
+Optionally, you may "close" atx-style headers. This is purely
+cosmetic -- you can use this if you think it looks better. The
+closing hashes don't even need to match the number of hashes
+used to open the header. (The number of opening hashes
+determines the header level.) :
+
+ # This is an H1 #
+
+ ## This is an H2 ##
+
+ ### This is an H3 ######
+
+
+<h3 id="blockquote">Blockquotes</h3>
+
+Markdown uses email-style `>` characters for blockquoting. If you're
+familiar with quoting passages of text in an email message, then you
+know how to create a blockquote in Markdown. It looks best if you hard
+wrap the text and put a `>` before every line:
+
+ > This is a blockquote with two paragraphs. Lorem ipsum dolor sit amet,
+ > consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus.
+ > Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus.
+ >
+ > Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse
+ > id sem consectetuer libero luctus adipiscing.
+
+Markdown allows you to be lazy and only put the `>` before the first
+line of a hard-wrapped paragraph:
+
+ > This is a blockquote with two paragraphs. Lorem ipsum dolor sit amet,
+ consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus.
+ Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus.
+
+ > Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse
+ id sem consectetuer libero luctus adipiscing.
+
+Blockquotes can be nested (i.e. a blockquote-in-a-blockquote) by
+adding additional levels of `>`:
+
+ > This is the first level of quoting.
+ >
+ > > This is nested blockquote.
+ >
+ > Back to the first level.
+
+Blockquotes can contain other Markdown elements, including headers, lists,
+and code blocks:
+
+ > ## This is a header.
+ >
+ > 1. This is the first list item.
+ > 2. This is the second list item.
+ >
+ > Here's some example code:
+ >
+ > return shell_exec("echo $input | $markdown_script");
+
+Any decent text editor should make email-style quoting easy. For
+example, with BBEdit, you can make a selection and choose Increase
+Quote Level from the Text menu.
+
+
+<h3 id="list">Lists</h3>
+
+Markdown supports ordered (numbered) and unordered (bulleted) lists.
+
+Unordered lists use asterisks, pluses, and hyphens -- interchangably
+-- as list markers:
+
+ * Red
+ * Green
+ * Blue
+
+is equivalent to:
+
+ + Red
+ + Green
+ + Blue
+
+and:
+
+ - Red
+ - Green
+ - Blue
+
+Ordered lists use numbers followed by periods:
+
+ 1. Bird
+ 2. McHale
+ 3. Parish
+
+It's important to note that the actual numbers you use to mark the
+list have no effect on the HTML output Markdown produces. The HTML
+Markdown produces from the above list is:
+
+ <ol>
+ <li>Bird</li>
+ <li>McHale</li>
+ <li>Parish</li>
+ </ol>
+
+If you instead wrote the list in Markdown like this:
+
+ 1. Bird
+ 1. McHale
+ 1. Parish
+
+or even:
+
+ 3. Bird
+ 1. McHale
+ 8. Parish
+
+you'd get the exact same HTML output. The point is, if you want to,
+you can use ordinal numbers in your ordered Markdown lists, so that
+the numbers in your source match the numbers in your published HTML.
+But if you want to be lazy, you don't have to.
+
+If you do use lazy list numbering, however, you should still start the
+list with the number 1. At some point in the future, Markdown may support
+starting ordered lists at an arbitrary number.
+
+List markers typically start at the left margin, but may be indented by
+up to three spaces. List markers must be followed by one or more spaces
+or a tab.
+
+To make lists look nice, you can wrap items with hanging indents:
+
+ * Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
+ Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi,
+ viverra nec, fringilla in, laoreet vitae, risus.
+ * Donec sit amet nisl. Aliquam semper ipsum sit amet velit.
+ Suspendisse id sem consectetuer libero luctus adipiscing.
+
+But if you want to be lazy, you don't have to:
+
+ * Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
+ Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi,
+ viverra nec, fringilla in, laoreet vitae, risus.
+ * Donec sit amet nisl. Aliquam semper ipsum sit amet velit.
+ Suspendisse id sem consectetuer libero luctus adipiscing.
+
+If list items are separated by blank lines, Markdown will wrap the
+items in `<p>` tags in the HTML output. For example, this input:
+
+ * Bird
+ * Magic
+
+will turn into:
+
+ <ul>
+ <li>Bird</li>
+ <li>Magic</li>
+ </ul>
+
+But this:
+
+ * Bird
+
+ * Magic
+
+will turn into:
+
+ <ul>
+ <li><p>Bird</p></li>
+ <li><p>Magic</p></li>
+ </ul>
+
+List items may consist of multiple paragraphs. Each subsequent
+paragraph in a list item must be intended by either 4 spaces
+or one tab:
+
+ 1. This is a list item with two paragraphs. Lorem ipsum dolor
+ sit amet, consectetuer adipiscing elit. Aliquam hendrerit
+ mi posuere lectus.
+
+ Vestibulum enim wisi, viverra nec, fringilla in, laoreet
+ vitae, risus. Donec sit amet nisl. Aliquam semper ipsum
+ sit amet velit.
+
+ 2. Suspendisse id sem consectetuer libero luctus adipiscing.
+
+It looks nice if you indent every line of the subsequent
+paragraphs, but here again, Markdown will allow you to be
+lazy:
+
+ * This is a list item with two paragraphs.
+
+ This is the second paragraph in the list item. You're
+ only required to indent the first line. Lorem ipsum dolor
+ sit amet, consectetuer adipiscing elit.
+
+ * Another item in the same list.
+
+To put a blockquote within a list item, the blockquote's `>`
+delimiters need to be indented:
+
+ * A list item with a blockquote:
+
+ > This is a blockquote
+ > inside a list item.
+
+To put a code block within a list item, the code block needs
+to be indented *twice* -- 8 spaces or two tabs:
+
+ * A list item with a code block:
+
+ <code goes here>
+
+
+It's worth noting that it's possible to trigger an ordered list by
+accident, by writing something like this:
+
+ 1986. What a great season.
+
+In other words, a *number-period-space* sequence at the beginning of a
+line. To avoid this, you can backslash-escape the period:
+
+ 1986\. What a great season.
+
+
+
+<h3 id="precode">Code Blocks</h3>
+
+Pre-formatted code blocks are used for writing about programming or
+markup source code. Rather than forming normal paragraphs, the lines
+of a code block are interpreted literally. Markdown wraps a code block
+in both `<pre>` and `<code>` tags.
+
+To produce a code block in Markdown, simply indent every line of the
+block by at least 4 spaces or 1 tab. For example, given this input:
+
+ This is a normal paragraph:
+
+ This is a code block.
+
+Markdown will generate:
+
+ <p>This is a normal paragraph:</p>
+
+ <pre><code>This is a code block.
+ </code></pre>
+
+One level of indentation -- 4 spaces or 1 tab -- is removed from each
+line of the code block. For example, this:
+
+ Here is an example of AppleScript:
+
+ tell application "Foo"
+ beep
+ end tell
+
+will turn into:
+
+ <p>Here is an example of AppleScript:</p>
+
+ <pre><code>tell application "Foo"
+ beep
+ end tell
+ </code></pre>
+
+A code block continues until it reaches a line that is not indented
+(or the end of the article).
+
+Within a code block, ampersands (`&`) and angle brackets (`<` and `>`)
+are automatically converted into HTML entities. This makes it very
+easy to include example HTML source code using Markdown -- just paste
+it and indent it, and Markdown will handle the hassle of encoding the
+ampersands and angle brackets. For example, this:
+
+ <div class="footer">
+ &copy; 2004 Foo Corporation
+ </div>
+
+will turn into:
+
+ <pre><code>&lt;div class="footer"&gt;
+ &amp;copy; 2004 Foo Corporation
+ &lt;/div&gt;
+ </code></pre>
+
+Regular Markdown syntax is not processed within code blocks. E.g.,
+asterisks are just literal asterisks within a code block. This means
+it's also easy to use Markdown to write about Markdown's own syntax.
+
+
+
+<h3 id="hr">Horizontal Rules</h3>
+
+You can produce a horizontal rule tag (`<hr />`) by placing three or
+more hyphens, asterisks, or underscores on a line by themselves. If you
+wish, you may use spaces between the hyphens or asterisks. Each of the
+following lines will produce a horizontal rule:
+
+ * * *
+
+ ***
+
+ *****
+
+ - - -
+
+ ---------------------------------------
+
+ _ _ _
+
+
+* * *
+
+<h2 id="span">Span Elements</h2>
+
+<h3 id="link">Links</h3>
+
+Markdown supports two style of links: *inline* and *reference*.
+
+In both styles, the link text is delimited by [square brackets].
+
+To create an inline link, use a set of regular parentheses immediately
+after the link text's closing square bracket. Inside the parentheses,
+put the URL where you want the link to point, along with an *optional*
+title for the link, surrounded in quotes. For example:
+
+ This is [an example](http://example.com/ "Title") inline link.
+
+ [This link](http://example.net/) has no title attribute.
+
+Will produce:
+
+ <p>This is <a href="http://example.com/" title="Title">
+ an example</a> inline link.</p>
+
+ <p><a href="http://example.net/">This link</a> has no
+ title attribute.</p>
+
+If you're referring to a local resource on the same server, you can
+use relative paths:
+
+ See my [About](/about/) page for details.
+
+Reference-style links use a second set of square brackets, inside
+which you place a label of your choosing to identify the link:
+
+ This is [an example][id] reference-style link.
+
+You can optionally use a space to separate the sets of brackets:
+
+ This is [an example] [id] reference-style link.
+
+Then, anywhere in the document, you define your link label like this,
+on a line by itself:
+
+ [id]: http://example.com/ "Optional Title Here"
+
+That is:
+
+* Square brackets containing the link identifier (optionally
+ indented from the left margin using up to three spaces);
+* followed by a colon;
+* followed by one or more spaces (or tabs);
+* followed by the URL for the link;
+* optionally followed by a title attribute for the link, enclosed
+ in double or single quotes.
+
+The link URL may, optionally, be surrounded by angle brackets:
+
+ [id]: <http://example.com/> "Optional Title Here"
+
+You can put the title attribute on the next line and use extra spaces
+or tabs for padding, which tends to look better with longer URLs:
+
+ [id]: http://example.com/longish/path/to/resource/here
+ "Optional Title Here"
+
+Link definitions are only used for creating links during Markdown
+processing, and are stripped from your document in the HTML output.
+
+Link definition names may constist of letters, numbers, spaces, and punctuation -- but they are *not* case sensitive. E.g. these two links:
+
+ [link text][a]
+ [link text][A]
+
+are equivalent.
+
+The *implicit link name* shortcut allows you to omit the name of the
+link, in which case the link text itself is used as the name.
+Just use an empty set of square brackets -- e.g., to link the word
+"Google" to the google.com web site, you could simply write:
+
+ [Google][]
+
+And then define the link:
+
+ [Google]: http://google.com/
+
+Because link names may contain spaces, this shortcut even works for
+multiple words in the link text:
+
+ Visit [Daring Fireball][] for more information.
+
+And then define the link:
+
+ [Daring Fireball]: http://daringfireball.net/
+
+Link definitions can be placed anywhere in your Markdown document. I
+tend to put them immediately after each paragraph in which they're
+used, but if you want, you can put them all at the end of your
+document, sort of like footnotes.
+
+Here's an example of reference links in action:
+
+ I get 10 times more traffic from [Google] [1] than from
+ [Yahoo] [2] or [MSN] [3].
+
+ [1]: http://google.com/ "Google"
+ [2]: http://search.yahoo.com/ "Yahoo Search"
+ [3]: http://search.msn.com/ "MSN Search"
+
+Using the implicit link name shortcut, you could instead write:
+
+ I get 10 times more traffic from [Google][] than from
+ [Yahoo][] or [MSN][].
+
+ [google]: http://google.com/ "Google"
+ [yahoo]: http://search.yahoo.com/ "Yahoo Search"
+ [msn]: http://search.msn.com/ "MSN Search"
+
+Both of the above examples will produce the following HTML output:
+
+ <p>I get 10 times more traffic from <a href="http://google.com/"
+ title="Google">Google</a> than from
+ <a href="http://search.yahoo.com/" title="Yahoo Search">Yahoo</a>
+ or <a href="http://search.msn.com/" title="MSN Search">MSN</a>.</p>
+
+For comparison, here is the same paragraph written using
+Markdown's inline link style:
+
+ I get 10 times more traffic from [Google](http://google.com/ "Google")
+ than from [Yahoo](http://search.yahoo.com/ "Yahoo Search") or
+ [MSN](http://search.msn.com/ "MSN Search").
+
+The point of reference-style links is not that they're easier to
+write. The point is that with reference-style links, your document
+source is vastly more readable. Compare the above examples: using
+reference-style links, the paragraph itself is only 81 characters
+long; with inline-style links, it's 176 characters; and as raw HTML,
+it's 234 characters. In the raw HTML, there's more markup than there
+is text.
+
+With Markdown's reference-style links, a source document much more
+closely resembles the final output, as rendered in a browser. By
+allowing you to move the markup-related metadata out of the paragraph,
+you can add links without interrupting the narrative flow of your
+prose.
+
+
+<h3 id="em">Emphasis</h3>
+
+Markdown treats asterisks (`*`) and underscores (`_`) as indicators of
+emphasis. Text wrapped with one `*` or `_` will be wrapped with an
+HTML `<em>` tag; double `*`'s or `_`'s will be wrapped with an HTML
+`<strong>` tag. E.g., this input:
+
+ *single asterisks*
+
+ _single underscores_
+
+ **double asterisks**
+
+ __double underscores__
+
+will produce:
+
+ <em>single asterisks</em>
+
+ <em>single underscores</em>
+
+ <strong>double asterisks</strong>
+
+ <strong>double underscores</strong>
+
+You can use whichever style you prefer; the lone restriction is that
+the same character must be used to open and close an emphasis span.
+
+Emphasis can be used in the middle of a word:
+
+ un*fucking*believable
+
+But if you surround an `*` or `_` with spaces, it'll be treated as a
+literal asterisk or underscore.
+
+To produce a literal asterisk or underscore at a position where it
+would otherwise be used as an emphasis delimiter, you can backslash
+escape it:
+
+ \*this text is surrounded by literal asterisks\*
+
+
+
+<h3 id="code">Code</h3>
+
+To indicate a span of code, wrap it with backtick quotes (`` ` ``).
+Unlike a pre-formatted code block, a code span indicates code within a
+normal paragraph. For example:
+
+ Use the `printf()` function.
+
+will produce:
+
+ <p>Use the <code>printf()</code> function.</p>
+
+To include a literal backtick character within a code span, you can use
+multiple backticks as the opening and closing delimiters:
+
+ ``There is a literal backtick (`) here.``
+
+which will produce this:
+
+ <p><code>There is a literal backtick (`) here.</code></p>
+
+The backtick delimiters surrounding a code span may include spaces --
+one after the opening, one before the closing. This allows you to place
+literal backtick characters at the beginning or end of a code span:
+
+ A single backtick in a code span: `` ` ``
+
+ A backtick-delimited string in a code span: `` `foo` ``
+
+will produce:
+
+ <p>A single backtick in a code span: <code>`</code></p>
+
+ <p>A backtick-delimited string in a code span: <code>`foo`</code></p>
+
+With a code span, ampersands and angle brackets are encoded as HTML
+entities automatically, which makes it easy to include example HTML
+tags. Markdown will turn this:
+
+ Please don't use any `<blink>` tags.
+
+into:
+
+ <p>Please don't use any <code>&lt;blink&gt;</code> tags.</p>
+
+You can write this:
+
+ `&#8212;` is the decimal-encoded equivalent of `&mdash;`.
+
+to produce:
+
+ <p><code>&amp;#8212;</code> is the decimal-encoded
+ equivalent of <code>&amp;mdash;</code>.</p>
+
+
+
+<h3 id="img">Images</h3>
+
+Admittedly, it's fairly difficult to devise a "natural" syntax for
+placing images into a plain text document format.
+
+Markdown uses an image syntax that is intended to resemble the syntax
+for links, allowing for two styles: *inline* and *reference*.
+
+Inline image syntax looks like this:
+
+ ![Alt text](/path/to/img.jpg)
+
+ ![Alt text](/path/to/img.jpg "Optional title")
+
+That is:
+
+* An exclamation mark: `!`;
+* followed by a set of square brackets, containing the `alt`
+ attribute text for the image;
+* followed by a set of parentheses, containing the URL or path to
+ the image, and an optional `title` attribute enclosed in double
+ or single quotes.
+
+Reference-style image syntax looks like this:
+
+ ![Alt text][id]
+
+Where "id" is the name of a defined image reference. Image references
+are defined using syntax identical to link references:
+
+ [id]: url/to/image "Optional title attribute"
+
+As of this writing, Markdown has no syntax for specifying the
+dimensions of an image; if this is important to you, you can simply
+use regular HTML `<img>` tags.
+
+
+* * *
+
+
+<h2 id="misc">Miscellaneous</h2>
+
+<h3 id="autolink">Automatic Links</h3>
+
+Markdown supports a shortcut style for creating "automatic" links for URLs and email addresses: simply surround the URL or email address with angle brackets. What this means is that if you want to show the actual text of a URL or email address, and also have it be a clickable link, you can do this:
+
+ <http://example.com/>
+
+Markdown will turn this into:
+
+ <a href="http://example.com/">http://example.com/</a>
+
+Automatic links for email addresses work similarly, except that
+Markdown will also perform a bit of randomized decimal and hex
+entity-encoding to help obscure your address from address-harvesting
+spambots. For example, Markdown will turn this:
+
+ <address@example.com>
+
+into something like this:
+
+ <a href="&#x6D;&#x61;i&#x6C;&#x74;&#x6F;:&#x61;&#x64;&#x64;&#x72;&#x65;
+ &#115;&#115;&#64;&#101;&#120;&#x61;&#109;&#x70;&#x6C;e&#x2E;&#99;&#111;
+ &#109;">&#x61;&#x64;&#x64;&#x72;&#x65;&#115;&#115;&#64;&#101;&#120;&#x61;
+ &#109;&#x70;&#x6C;e&#x2E;&#99;&#111;&#109;</a>
+
+which will render in a browser as a clickable link to "address@example.com".
+
+(This sort of entity-encoding trick will indeed fool many, if not
+most, address-harvesting bots, but it definitely won't fool all of
+them. It's better than nothing, but an address published in this way
+will probably eventually start receiving spam.)
+
+
+
+<h3 id="backslash">Backslash Escapes</h3>
+
+Markdown allows you to use backslash escapes to generate literal
+characters which would otherwise have special meaning in Markdown's
+formatting syntax. For example, if you wanted to surround a word with
+literal asterisks (instead of an HTML `<em>` tag), you can backslashes
+before the asterisks, like this:
+
+ \*literal asterisks\*
+
+Markdown provides backslash escapes for the following characters:
+
+ \ backslash
+ ` backtick
+ * asterisk
+ _ underscore
+ {} curly braces
+ [] square brackets
+ () parentheses
+ # hash mark
+ + plus sign
+ - minus sign (hyphen)
+ . dot
+ ! exclamation mark
+
diff --git a/test/rdoc/MarkdownTest_1.0.3/Nested blockquotes.text b/test/rdoc/MarkdownTest_1.0.3/Nested blockquotes.text
new file mode 100644
index 0000000000..ed3c624ffb
--- /dev/null
+++ b/test/rdoc/MarkdownTest_1.0.3/Nested blockquotes.text
@@ -0,0 +1,5 @@
+> foo
+>
+> > bar
+>
+> foo
diff --git a/test/rdoc/MarkdownTest_1.0.3/Ordered and unordered lists.text b/test/rdoc/MarkdownTest_1.0.3/Ordered and unordered lists.text
new file mode 100644
index 0000000000..7f3b49777f
--- /dev/null
+++ b/test/rdoc/MarkdownTest_1.0.3/Ordered and unordered lists.text
@@ -0,0 +1,131 @@
+## Unordered
+
+Asterisks tight:
+
+* asterisk 1
+* asterisk 2
+* asterisk 3
+
+
+Asterisks loose:
+
+* asterisk 1
+
+* asterisk 2
+
+* asterisk 3
+
+* * *
+
+Pluses tight:
+
++ Plus 1
++ Plus 2
++ Plus 3
+
+
+Pluses loose:
+
++ Plus 1
+
++ Plus 2
+
++ Plus 3
+
+* * *
+
+
+Minuses tight:
+
+- Minus 1
+- Minus 2
+- Minus 3
+
+
+Minuses loose:
+
+- Minus 1
+
+- Minus 2
+
+- Minus 3
+
+
+## Ordered
+
+Tight:
+
+1. First
+2. Second
+3. Third
+
+and:
+
+1. One
+2. Two
+3. Three
+
+
+Loose using tabs:
+
+1. First
+
+2. Second
+
+3. Third
+
+and using spaces:
+
+1. One
+
+2. Two
+
+3. Three
+
+Multiple paragraphs:
+
+1. Item 1, graf one.
+
+ Item 2. graf two. The quick brown fox jumped over the lazy dog's
+ back.
+
+2. Item 2.
+
+3. Item 3.
+
+
+
+## Nested
+
+* Tab
+ * Tab
+ * Tab
+
+Here's another:
+
+1. First
+2. Second:
+ * Fee
+ * Fie
+ * Foe
+3. Third
+
+Same thing but with paragraphs:
+
+1. First
+
+2. Second:
+ * Fee
+ * Fie
+ * Foe
+
+3. Third
+
+
+This was an error in Markdown 1.0.1:
+
+* this
+
+ * sub
+
+ that
diff --git a/test/rdoc/MarkdownTest_1.0.3/Strong and em together.text b/test/rdoc/MarkdownTest_1.0.3/Strong and em together.text
new file mode 100644
index 0000000000..95ee690dbe
--- /dev/null
+++ b/test/rdoc/MarkdownTest_1.0.3/Strong and em together.text
@@ -0,0 +1,7 @@
+***This is strong and em.***
+
+So is ***this*** word.
+
+___This is strong and em.___
+
+So is ___this___ word.
diff --git a/test/rdoc/MarkdownTest_1.0.3/Tabs.text b/test/rdoc/MarkdownTest_1.0.3/Tabs.text
new file mode 100644
index 0000000000..589d1136e1
--- /dev/null
+++ b/test/rdoc/MarkdownTest_1.0.3/Tabs.text
@@ -0,0 +1,21 @@
++ this is a list item
+ indented with tabs
+
++ this is a list item
+ indented with spaces
+
+Code:
+
+ this code block is indented by one tab
+
+And:
+
+ this code block is indented by two tabs
+
+And:
+
+ + this is an example list item
+ indented with tabs
+
+ + this is an example list item
+ indented with spaces
diff --git a/test/rdoc/MarkdownTest_1.0.3/Tidyness.text b/test/rdoc/MarkdownTest_1.0.3/Tidyness.text
new file mode 100644
index 0000000000..5f18b8da21
--- /dev/null
+++ b/test/rdoc/MarkdownTest_1.0.3/Tidyness.text
@@ -0,0 +1,5 @@
+> A list within a blockquote:
+>
+> * asterisk 1
+> * asterisk 2
+> * asterisk 3
diff --git a/test/rdoc/test.ja.largedoc b/test/rdoc/test.ja.largedoc
new file mode 100644
index 0000000000..a9c6c4691c
--- /dev/null
+++ b/test/rdoc/test.ja.largedoc
@@ -0,0 +1,3 @@
+# -*- coding: utf-8 -*-
+ å¾è¼©ï¼ˆã‚ãŒã¯ã„)ã¯çŒ«ã§ã‚る。åå‰ã¯ã¾ã ç„¡ã„。
+ ã©ã“ã§ç”Ÿã‚ŒãŸã‹ã¨ã‚“ã¨è¦‹å½“(ã‘ã‚“ã¨ã†ï¼‰ãŒã¤ã‹ã¬ã€‚何ã§ã‚‚è–„æš—ã„ã˜ã‚ã˜ã‚ã—ãŸæ‰€ã§ãƒ‹ãƒ£ãƒ¼ãƒ‹ãƒ£ãƒ¼æ³£ã„ã¦ã„ãŸäº‹ã ã‘ã¯è¨˜æ†¶ã—ã¦ã„る。å¾è¼©ã¯ã“ã“ã§å§‹ã‚ã¦äººé–“ã¨ã„ã†ã‚‚ã®ã‚’見ãŸã€‚ã—ã‹ã‚‚ã‚ã¨ã§èžãã¨ãã‚Œã¯æ›¸ç”Ÿã¨ã„ã†äººé–“中ã§ä¸€ç•ªç°æ‚ªï¼ˆã©ã†ã‚ã)ãªç¨®æ—ã§ã‚ã£ãŸãã†ã ã€‚ã“ã®æ›¸ç”Ÿã¨ã„ã†ã®ã¯æ™‚々我々をæ•(ã¤ã‹ã¾ï¼‰ãˆã¦ç…®ï¼ˆã«ï¼‰ã¦é£Ÿã†ã¨ã„ã†è©±ã§ã‚る。ã—ã‹ã—ãã®å½“時ã¯ä½•ã¨ã„ã†è€ƒã‚‚ãªã‹ã£ãŸã‹ã‚‰åˆ¥æ®µæã—ã„ã¨ã‚‚æ€ã‚ãªã‹ã£ãŸã€‚ãŸã å½¼ã®æŽŒï¼ˆã¦ã®ã²ã‚‰ï¼‰ã«è¼‰ã›ã‚‰ã‚Œã¦ã‚¹ãƒ¼ã¨æŒã¡ä¸Šã’ã‚‰ã‚ŒãŸæ™‚何ã ã‹ãƒ•ワフワã—ãŸæ„Ÿã˜ãŒã‚ã£ãŸã°ã‹ã‚Šã§ã‚る。掌ã®ä¸Šã§å°‘ã—è½ã¡ã¤ã„ã¦æ›¸ç”Ÿã®é¡”を見ãŸã®ãŒã„ã‚ゆる人間ã¨ã„ã†ã‚‚ã®ã®è¦‹å§‹ï¼ˆã¿ã¯ã˜ã‚)ã§ã‚ã‚ã†ã€‚ã“ã®æ™‚妙ãªã‚‚ã®ã ã¨æ€ã£ãŸæ„Ÿã˜ãŒä»Šã§ã‚‚残ã£ã¦ã„る。第一毛をもã£ã¦è£…飾ã•れã¹ãã¯ãšã®é¡”ãŒã¤ã‚‹ã¤ã‚‹ã—ã¦ã¾ã‚‹ã§è–¬ç¼¶ï¼ˆã‚„ã‹ã‚“)ã ã€‚ãã®å¾Œï¼ˆã”)猫ã«ã‚‚ã ã„ã¶é€¢ï¼ˆã‚)ã£ãŸãŒã“ã‚“ãªç‰‡è¼ªï¼ˆã‹ãŸã‚)ã«ã¯ä¸€åº¦ã‚‚出会(ã§ã)ã‚ã—ãŸäº‹ãŒãªã„。ã®ã¿ãªã‚‰ãšé¡”ã®çœŸä¸­ãŒã‚ã¾ã‚Šã«çªèµ·ã—ã¦ã„る。ãã†ã—ã¦ãã®ç©´ã®ä¸­ã‹ã‚‰æ™‚々ã·ã†ã·ã†ã¨ç…™ï¼ˆã‘むり)をå¹ã。ã©ã†ã‚‚咽(む)ã›ã½ãã¦å®Ÿã«å¼±ã£ãŸã€‚ã“れãŒäººé–“ã®é£²ã‚€ç…™è‰ï¼ˆãŸã°ã“)ã¨ã„ã†ã‚‚ã®ã§ã‚る事ã¯ã‚ˆã†ã‚„ãã“ã®é ƒçŸ¥ã£ãŸã€‚
diff --git a/test/rdoc/test_attribute_manager.rb b/test/rdoc/test_attribute_manager.rb
index 25e8ca5e04..8832a5d515 100644
--- a/test/rdoc/test_attribute_manager.rb
+++ b/test/rdoc/test_attribute_manager.rb
@@ -1,27 +1,26 @@
-require 'rubygems'
-require 'minitest/autorun'
-require 'rdoc'
-require 'rdoc/markup'
-require 'rdoc/markup/formatter'
-require 'rdoc/markup/attribute_manager'
+require 'rdoc/test_case'
-class TestAttributeManager < MiniTest::Unit::TestCase # HACK fix test name
+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
+ @formatter = RDoc::Markup::Formatter.new @options
@formatter.add_tag :BOLD, '<B>', '</B>'
@formatter.add_tag :EM, '<EM>', '</EM>'
- @formatter.add_tag :TT, '<TT>', '</TT>'
+ @formatter.add_tag :TT, '<CODE>', '</CODE>'
end
def test_convert_attrs_ignores_code
- assert_equal 'foo <TT>__send__</TT> bar', output('foo <code>__send__</code> bar')
+ assert_equal 'foo <CODE>__send__</CODE> bar', output('foo <code>__send__</code> bar')
end
def test_convert_attrs_ignores_tt
- assert_equal 'foo <TT>__send__</TT> bar', output('foo <tt>__send__</tt> bar')
+ assert_equal 'foo <CODE>__send__</CODE> bar', output('foo <tt>__send__</tt> bar')
end
def test_convert_attrs_preserves_double
@@ -30,7 +29,7 @@ class TestAttributeManager < MiniTest::Unit::TestCase # HACK fix test name
end
def test_convert_attrs_does_not_ignore_after_tt
- assert_equal 'the <TT>IF:</TT><EM>key</EM> directive', output('the <tt>IF:</tt>_key_ directive')
+ assert_equal 'the <CODE>IF:</CODE><EM>key</EM> directive', output('the <tt>IF:</tt>_key_ directive')
end
def test_initial_word_pairs
@@ -73,38 +72,39 @@ class TestAttributeManager < MiniTest::Unit::TestCase # HACK fix test name
end
def test_add_special
- @am.add_special("WikiWord", :WIKIWORD)
+ @am.add_special "WikiWord", :WIKIWORD
specials = @am.special
- assert_equal(1,specials.size)
- assert(specials.has_key?("WikiWord"))
+
+ assert_equal 1, specials.size
+ assert specials.assoc "WikiWord"
end
def test_escapes
- assert_equal '<TT>text</TT>', output('<tt>text</tt>')
- assert_equal '<tt>text</tt>', output('\\<tt>text</tt>')
- assert_equal '<tt>', output('\\<tt>')
- assert_equal '<TT><tt></TT>', output('<tt>\\<tt></tt>')
- assert_equal '<TT>\\<tt></TT>', 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 <TT>\\s</TT> matches space',
+ 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 <TT><tt>text</TT></tt> for code',
+ assert_equal 'use <CODE><tt>text</CODE></tt> for code',
output('use <tt>\\<tt>text</tt></tt> for code')
- assert_equal '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><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 <TT>+text+</TT> for code',
+ assert_equal 'use <CODE>+text+</CODE> for code',
output('use <tt>\\+text+</tt> for code')
- assert_equal 'use <tt><TT>text</TT></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')
diff --git a/test/rdoc/test_rdoc_any_method.rb b/test/rdoc/test_rdoc_any_method.rb
index c0feccef95..77acfbee17 100644
--- a/test/rdoc/test_rdoc_any_method.rb
+++ b/test/rdoc/test_rdoc_any_method.rb
@@ -1,8 +1,6 @@
require File.expand_path '../xref_test_case', __FILE__
-require 'rdoc/code_objects'
-require 'rdoc/generator/markup'
-class RDocAnyMethodTest < XrefTestCase
+class TestRDocAnyMethod < XrefTestCase
def test_aref
m = RDoc::AnyMethod.new nil, 'method?'
@@ -40,41 +38,48 @@ 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'),
- RDoc::RubyToken::TkDEF. new(0, 0, 0, 'KW'),
- RDoc::RubyToken::TkIVAR. new(0, 0, 0, 'IVAR'),
- RDoc::RubyToken::TkOp. new(0, 0, 0, 'Op'),
- RDoc::RubyToken::TkId. new(0, 0, 0, 'Id'),
- RDoc::RubyToken::TkNode. new(0, 0, 0, 'Node'),
- RDoc::RubyToken::TkCOMMENT. new(0, 0, 0, 'COMMENT'),
- RDoc::RubyToken::TkREGEXP. new(0, 0, 0, 'REGEXP'),
- RDoc::RubyToken::TkSTRING. new(0, 0, 0, 'STRING'),
- RDoc::RubyToken::TkVal. new(0, 0, 0, 'Val'),
- RDoc::RubyToken::TkBACKSLASH.new(0, 0, 0, '\\'),
]
@c2_a.collect_tokens
@c2_a.add_tokens(*tokens)
- expected = [
- '<span class="ruby-constant">CONSTANT</span>',
- '<span class="ruby-keyword">KW</span>',
- '<span class="ruby-ivar">IVAR</span>',
- '<span class="ruby-operator">Op</span>',
- '<span class="ruby-identifier">Id</span>',
- '<span class="ruby-node">Node</span>',
- '<span class="ruby-comment">COMMENT</span>',
- '<span class="ruby-regexp">REGEXP</span>',
- '<span class="ruby-string">STRING</span>',
- '<span class="ruby-value">Val</span>',
- '\\'
- ].join
+ expected = '<span class="ruby-constant">CONSTANT</span>'
assert_equal expected, @c2_a.markup_code
end
@@ -84,7 +89,9 @@ method(a, b) { |c, d| ... }
end
def test_marshal_dump
- top_level = RDoc::TopLevel.new 'file.rb'
+ @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'
@@ -92,20 +99,23 @@ method(a, b) { |c, d| ... }
m.params = 'param'
m.record_location top_level
- cm = RDoc::ClassModule.new 'Klass'
+ 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 Marshal.dump m
+ loaded.store = @store
comment = RDoc::Markup::Document.new(
RDoc::Markup::Paragraph.new('this is a comment'))
assert_equal m, loaded
- assert_equal [al_m], loaded.aliases
+ 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
@@ -115,51 +125,72 @@ method(a, b) { |c, d| ... }
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
end
- def test_marshal_load
- instance_method = Marshal.load Marshal.dump(@c1.method_list.last)
-
- assert_equal 'C1#m', instance_method.full_name
- assert_equal 'C1', instance_method.parent_name
- assert_equal '(foo)', instance_method.params
+ def test_marshal_load_aliased_method
+ aliased_method = Marshal.load Marshal.dump(@c2_a)
- aliased_method = Marshal.load Marshal.dump(@c2.method_list.last)
+ 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
+ def test_marshal_load_class_method
class_method = Marshal.load Marshal.dump(@c1.method_list.first)
assert_equal 'C1::m', class_method.full_name
assert_equal 'C1', class_method.parent_name
assert_equal '()', class_method.params
+ assert class_method.display?
+ end
+
+ def test_marshal_load_instance_method
+ instance_method = Marshal.load Marshal.dump(@c1.method_list.last)
+
+ assert_equal 'C1#m', instance_method.full_name
+ assert_equal 'C1', instance_method.parent_name
+ assert_equal '(foo)', instance_method.params
+ assert instance_method.display?
end
def test_marshal_load_version_0
+ @store.path = Dir.tmpdir
+ top_level = @store.add_file 'file.rb'
+
m = RDoc::AnyMethod.new nil, 'method'
- cm = RDoc::ClassModule.new 'Klass'
+
+ 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[\x0Fi\x00I" \
- "\"\vmethod\x06:\x06EF\"\x11Klass#method0:\vpublic" \
- "o:\eRDoc::Markup::Document\x06:\v@parts[\x06" \
- "o:\x1CRDoc::Markup::Paragraph\x06;\t[\x06I" \
- "\"\x16this is a comment\x06;\x06FI" \
- "\"\rcall_seq\x06;\x06FI\"\x0Fsome_block\x06;\x06F" \
- "[\x06[\aI\"\faliased\x06;\x06Fo;\b\x06;\t[\x06" \
- "o;\n\x06;\t[\x06I\"\x12alias comment\x06;\x06FI" \
+ loaded = Marshal.load "\x04\bU:\x14RDoc::AnyMethod[\x0Fi\x00I" +
+ "\"\vmethod\x06:\x06EF\"\x11Klass#method0:\vpublic" +
+ "o:\eRDoc::Markup::Document\x06:\v@parts[\x06" +
+ "o:\x1CRDoc::Markup::Paragraph\x06;\t[\x06I" +
+ "\"\x16this is a comment\x06;\x06FI" +
+ "\"\rcall_seq\x06;\x06FI\"\x0Fsome_block\x06;\x06F" +
+ "[\x06[\aI\"\faliased\x06;\x06Fo;\b\x06;\t[\x06" +
+ "o;\n\x06;\t[\x06I\"\x12alias comment\x06;\x06FI" +
"\"\nparam\x06;\x06F"
+ loaded.store = @store
+
comment = RDoc::Markup::Document.new(
RDoc::Markup::Paragraph.new('this is a comment'))
assert_equal m, loaded
- assert_equal [al_m], loaded.aliases
+ 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
@@ -169,6 +200,65 @@ method(a, b) { |c, d| ... }
assert_equal nil, loaded.singleton # defaults to nil
assert_equal :public, loaded.visibility
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
@@ -177,6 +267,22 @@ method(a, b) { |c, d| ... }
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
@@ -200,6 +306,15 @@ method(a, b) { |c, d| ... }
assert_equal %w[a b c d], m.param_list
end
+ def test_param_list_default
+ m = RDoc::AnyMethod.new nil, 'method'
+ m.parent = @c1
+
+ m.params = '(b = default)'
+
+ assert_equal %w[b], m.param_list
+ end
+
def test_param_list_params
m = RDoc::AnyMethod.new nil, 'method'
m.parent = @c1
@@ -259,5 +374,58 @@ method(a, b) { |c, d| ... }
assert_equal 'C1', @c1.method_list.last.parent_name
end
+ def test_store_equals
+ loaded = Marshal.load Marshal.dump(@c1.method_list.last)
+
+ loaded.store = @store
+
+ assert_equal @store, loaded.file.store
+ end
+
+ def test_superclass_method
+ m3 = RDoc::AnyMethod.new '', 'no_super'
+
+ m2 = RDoc::AnyMethod.new '', 'supers'
+ m2.calls_super = true
+
+ m1 = RDoc::AnyMethod.new '', 'supers'
+
+ c1 = RDoc::NormalClass.new 'Outer'
+ c1.store = @store
+ c1.add_method m1
+
+ c2 = RDoc::NormalClass.new 'Inner', c1
+ c2.store = @store
+ c2.add_method m2
+ c2.add_method m3
+
+ assert_nil m3.superclass_method,
+ 'no superclass method for no_super'
+
+ assert_equal m1, m2.superclass_method,
+ 'superclass method missing for supers'
+ end
+
+ def test_superclass_method_multilevel
+ m2 = RDoc::AnyMethod.new '', 'supers'
+ m2.calls_super = true
+
+ m1 = RDoc::AnyMethod.new '', 'supers'
+
+ c1 = RDoc::NormalClass.new 'Outer'
+ c1.store = @store
+ c1.add_method m1
+
+ c2 = RDoc::NormalClass.new 'Middle', c1
+ c2.store = @store
+
+ c3 = RDoc::NormalClass.new 'Inner', c2
+ c3.store = @store
+ c3.add_method m2
+
+ assert_equal m1, m2.superclass_method,
+ 'superclass method missing for supers'
+ end
+
end
diff --git a/test/rdoc/test_rdoc_attr.rb b/test/rdoc/test_rdoc_attr.rb
index b69d8c6499..a4922df06c 100644
--- a/test/rdoc/test_rdoc_attr.rb
+++ b/test/rdoc/test_rdoc_attr.rb
@@ -1,10 +1,10 @@
-require 'rubygems'
-require 'minitest/autorun'
-require 'rdoc/rdoc'
+require 'rdoc/test_case'
-class TestRDocAttr < MiniTest::Unit::TestCase
+class TestRDocAttr < RDoc::TestCase
def setup
+ super
+
@a = RDoc::Attr.new nil, 'attr', 'RW', ''
end
@@ -43,15 +43,18 @@ class TestRDocAttr < MiniTest::Unit::TestCase
end
def test_marshal_dump
- tl = RDoc::TopLevel.new 'file.rb'
+ tl = @store.add_file 'file.rb'
@a.comment = 'this is a comment'
@a.record_location tl
- cm = RDoc::ClassModule.new 'Klass'
+ cm = tl.add_class RDoc::NormalClass, 'Klass'
cm.add_attribute @a
+ section = cm.sections.first
+
loaded = Marshal.load Marshal.dump @a
+ loaded.store = @store
assert_equal @a, loaded
@@ -65,31 +68,58 @@ class TestRDocAttr < MiniTest::Unit::TestCase
assert_equal 'RW', loaded.rw
assert_equal false, loaded.singleton
assert_equal :public, loaded.visibility
+ assert_equal tl, loaded.file
+ assert_equal cm, loaded.parent
+ assert_equal section, loaded.section
+ end
+
+ def test_marshal_dump_singleton
+ tl = @store.add_file 'file.rb'
+
+ @a.comment = 'this is a comment'
+ @a.record_location tl
+
+ cm = tl.add_class RDoc::NormalClass, 'Klass'
+ cm.add_attribute @a
+
+ section = cm.sections.first
@a.rw = 'R'
@a.singleton = true
@a.visibility = :protected
loaded = Marshal.load Marshal.dump @a
+ loaded.store = @store
assert_equal @a, loaded
+ comment = RDoc::Markup::Document.new(
+ RDoc::Markup::Paragraph.new('this is a comment'))
+
assert_equal comment, loaded.comment
assert_equal 'Klass::attr', loaded.full_name
assert_equal 'attr', loaded.name
assert_equal 'R', loaded.rw
assert_equal true, loaded.singleton
assert_equal :protected, loaded.visibility
+ assert_equal tl, loaded.file
+ assert_equal cm, loaded.parent
+ assert_equal section, loaded.section
end
def test_marshal_load_version_1
- data = "\x04\bU:\x0FRDoc::Attr[\fi\x06I\"\tattr\x06:\x06EF" \
- "\"\x0FKlass#attrI\"\aRW\x06;\x06F:\vpublic" \
- "o:\eRDoc::Markup::Document\x06:\v@parts[\x06" \
- "o:\x1CRDoc::Markup::Paragraph\x06;\t[\x06I" \
+ tl = @store.add_file 'file.rb'
+ cm = tl.add_class RDoc::NormalClass, 'Klass'
+ section = cm.sections.first
+
+ data = "\x04\bU:\x0FRDoc::Attr[\fi\x06I\"\tattr\x06:\x06EF" +
+ "\"\x0FKlass#attrI\"\aRW\x06;\x06F:\vpublic" +
+ "o:\eRDoc::Markup::Document\x06:\v@parts[\x06" +
+ "o:\x1CRDoc::Markup::Paragraph\x06;\t[\x06I" +
"\"\x16this is a comment\x06;\x06FF"
loaded = Marshal.load data
+ loaded.store = @store
comment = RDoc::Markup::Document.new(
RDoc::Markup::Paragraph.new('this is a comment'))
@@ -101,7 +131,44 @@ class TestRDocAttr < MiniTest::Unit::TestCase
assert_equal false, loaded.singleton
assert_equal :public, loaded.visibility
- assert_equal nil, loaded.file # version 2
+ # version 2
+ assert_nil loaded.file
+
+ # version 3
+ assert_equal cm, loaded.parent
+ assert_equal section, loaded.section
+
+ assert loaded.display?
+ end
+
+ def test_marshal_load_version_2
+ tl = @store.add_file 'file.rb'
+ cm = tl.add_class RDoc::NormalClass, 'Klass'
+ section = cm.sections.first
+
+ loaded = Marshal.load "\x04\bU:\x0FRDoc::Attr[\ri\aI\"\tattr\x06" +
+ ":\x06ETI\"\x0FKlass#attr\x06;\x06TI\"\aRW\x06" +
+ ";\x06T:\vpublico:\eRDoc::Markup::Document\a" +
+ ":\v@parts[\x06o:\x1CRDoc::Markup::Paragraph\x06;" +
+ "\t[\x06I\"\x16this is a comment\x06;\x06T:\n" +
+ "@file0FI\"\ffile.rb\x06;\x06T"
+ loaded.store = @store
+
+ comment = doc(para('this is a comment'))
+
+ assert_equal comment, loaded.comment
+ assert_equal 'Klass#attr', loaded.full_name
+ assert_equal 'attr', loaded.name
+ assert_equal 'RW', loaded.rw
+ assert_equal false, loaded.singleton
+ assert_equal :public, loaded.visibility
+ assert_equal tl, loaded.file
+
+ # version 3
+ assert_equal cm, loaded.parent
+ assert_equal section, loaded.section
+
+ assert loaded.display?
end
def test_params
diff --git a/test/rdoc/test_rdoc_class_module.rb b/test/rdoc/test_rdoc_class_module.rb
index 7d32a91580..0e06587dc6 100644
--- a/test/rdoc/test_rdoc_class_module.rb
+++ b/test/rdoc/test_rdoc_class_module.rb
@@ -1,25 +1,11 @@
-require 'pp'
require File.expand_path '../xref_test_case', __FILE__
class TestRDocClassModule < XrefTestCase
- def setup
- super
-
- @RM = RDoc::Markup
- 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
- tl1 = RDoc::TopLevel.new 'one.rb'
- tl2 = RDoc::TopLevel.new 'two.rb'
- tl3 = RDoc::TopLevel.new 'three.rb'
+ tl1 = @store.add_file 'one.rb'
+ tl2 = @store.add_file 'two.rb'
+ tl3 = @store.add_file 'three.rb'
cm = RDoc::ClassModule.new 'Klass'
cm.add_comment '# comment 1', tl1
@@ -40,8 +26,26 @@ class TestRDocClassModule < XrefTestCase
assert_equal "comment 1\n---\ncomment 2\n---\n* comment 3", cm.comment
end
+ def test_add_comment_comment
+ cm = RDoc::ClassModule.new 'Klass'
+
+ cm.add_comment comment('comment'), @top_level
+
+ assert_equal 'comment', cm.comment.text
+ end
+
+ def test_add_comment_duplicate
+ tl1 = @store.add_file 'one.rb'
+
+ cm = RDoc::ClassModule.new 'Klass'
+ cm.add_comment '# comment 1', tl1
+ cm.add_comment '# comment 2', tl1
+
+ assert_equal [['comment 2', tl1]], cm.comment_location
+ end
+
def test_add_comment_stopdoc
- tl = RDoc::TopLevel.new 'file.rb'
+ tl = @store.add_file 'file.rb'
cm = RDoc::ClassModule.new 'Klass'
cm.stop_doc
@@ -52,7 +56,7 @@ class TestRDocClassModule < XrefTestCase
end
def test_ancestors
- assert_equal [@parent], @child.ancestors
+ assert_equal [@parent, "Object"], @child.ancestors
end
def test_comment_equals
@@ -70,14 +74,63 @@ class TestRDocClassModule < XrefTestCase
assert_equal "comment 1\n---\ncomment 2\n---\n* comment 3", cm.comment
end
+ def test_comment_equals_comment
+ cm = RDoc::ClassModule.new 'Klass'
+
+ cm.comment = comment 'comment'
+
+ assert_equal 'comment', cm.comment.text
+ end
+
+ def test_docuent_self_or_methods
+ assert @c1.document_self_or_methods
+
+ @c1.document_self = false
+
+ assert @c1.document_self_or_methods
+
+ @c1_m.document_self = false
+
+ assert @c1.document_self_or_methods
+
+ @c1__m.document_self = false
+
+ refute @c1.document_self_or_methods
+ end
+
+ def test_documented_eh
+ cm = RDoc::ClassModule.new 'C'
+
+ refute cm.documented?, 'no comments, no markers'
+
+ cm.add_comment '', @top_level
+
+ refute cm.documented?, 'empty comment'
+
+ cm.add_comment 'hi', @top_level
+
+ assert cm.documented?, 'commented'
+
+ cm.comment_location.clear
+
+ refute cm.documented?, 'no comment'
+
+ cm.document_self = nil # notify :nodoc:
+
+ assert cm.documented?, ':nodoc:'
+ end
+
def test_each_ancestor
- ancestors = []
+ assert_equal [@parent], @child.each_ancestor.to_a
+ end
- @child.each_ancestor do |mod|
- ancestors << mod
- end
+ def test_each_ancestor_cycle
+ m_incl = RDoc::Include.new 'M', nil
- assert_equal [@parent], ancestors
+ m = @top_level.add_module RDoc::NormalModule, 'M'
+ m.add_include m_incl
+
+ assert_empty m.each_ancestor.to_a
end
# handle making a short module alias of yourself
@@ -89,7 +142,7 @@ class TestRDocClassModule < XrefTestCase
end
def test_from_module_comment
- tl = RDoc::TopLevel.new 'file.rb'
+ tl = @store.add_file 'file.rb'
klass = tl.add_class RDoc::NormalModule, 'Klass'
klass.add_comment 'really a class', tl
@@ -99,11 +152,13 @@ class TestRDocClassModule < XrefTestCase
end
def test_marshal_dump
- tl = RDoc::TopLevel.new 'file.rb'
+ @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.document_self = true
cm.record_location tl
a1 = RDoc::Attr.new nil, 'a1', 'RW', ''
@@ -120,20 +175,32 @@ class TestRDocClassModule < XrefTestCase
i1 = RDoc::Include.new 'I1', ''
i1.record_location tl
+ e1 = RDoc::Extend.new 'E1', ''
+ e1.record_location tl
+
+ section_comment = RDoc::Comment.new('section comment')
+ section_comment.location = tl
+
+ assert_equal 1, cm.sections.length, 'sanity, default section only'
+ s0 = cm.sections.first
+ s1 = cm.add_section 'section', section_comment
+
cm.add_attribute a1
cm.add_attribute a2
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
inner = RDoc::Markup::Document.new(
RDoc::Markup::Paragraph.new('this is a comment'))
- inner.file = tl.absolute_name
+ inner.file = tl
comment = RDoc::Markup::Document.new inner
@@ -142,9 +209,15 @@ class TestRDocClassModule < XrefTestCase
assert_equal [c1], loaded.constants
assert_equal 'Namespace::Klass', loaded.full_name
assert_equal [i1], loaded.includes
+ assert_equal [e1], loaded.extends
assert_equal [m1], loaded.method_list
assert_equal 'Klass', loaded.name
assert_equal 'Super', loaded.superclass
+ assert_equal [tl], loaded.in_files
+ assert_equal 'Namespace', loaded.parent.name
+
+ expected = { nil => s0, 'section' => s1 }
+ assert_equal expected, loaded.sections_hash
assert_equal tl, loaded.attributes.first.file
@@ -152,11 +225,66 @@ class TestRDocClassModule < XrefTestCase
assert_equal tl, loaded.includes.first.file
+ assert_equal tl, loaded.extends.first.file
+
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 = RDoc::TopLevel.new 'file.rb'
+ tl = @store.add_file 'file.rb'
ns = tl.add_module RDoc::NormalModule, 'Namespace'
cm = ns.add_class RDoc::NormalClass, 'Klass', 'Super'
@@ -165,25 +293,29 @@ class TestRDocClassModule < XrefTestCase
c = RDoc::Constant.new('C1', nil, '')
i = RDoc::Include.new('I1', '')
+ s0 = cm.sections.first
+
cm.add_attribute a
cm.add_method m
cm.add_constant c
cm.add_include i
cm.add_comment 'this is a comment', tl
- loaded = Marshal.load "\x04\bU:\x16RDoc::NormalClass[\x0Ei\x00\"\nKlass" \
- "\"\x15Namespace::KlassI\"\nSuper\x06:\x06EF" \
- "o:\eRDoc::Markup::Document\x06:\v@parts[\x06" \
- "o:\x1CRDoc::Markup::Paragraph\x06;\b[\x06I" \
- "\"\x16this is a comment\x06;\x06F[\x06[\aI" \
- "\"\aa1\x06;\x06FI\"\aRW\x06;\x06F[\x06[\aI" \
- "\"\aC1\x06;\x06Fo;\a\x06;\b[\x00[\x06[\aI" \
- "\"\aI1\x06;\x06Fo;\a\x06;\b[\x00[\a[\aI" \
- "\"\nclass\x06;\x06F[\b[\a:\vpublic[\x00[\a" \
- ":\x0Eprotected[\x00[\a:\fprivate[\x00[\aI" \
- "\"\rinstance\x06;\x06F[\b[\a;\n[\x06I" \
+ loaded = Marshal.load "\x04\bU:\x16RDoc::NormalClass[\x0Ei\x00\"\nKlass" +
+ "\"\x15Namespace::KlassI\"\nSuper\x06:\x06EF" +
+ "o:\eRDoc::Markup::Document\x06:\v@parts[\x06" +
+ "o:\x1CRDoc::Markup::Paragraph\x06;\b[\x06I" +
+ "\"\x16this is a comment\x06;\x06F[\x06[\aI" +
+ "\"\aa1\x06;\x06FI\"\aRW\x06;\x06F[\x06[\aI" +
+ "\"\aC1\x06;\x06Fo;\a\x06;\b[\x00[\x06[\aI" +
+ "\"\aI1\x06;\x06Fo;\a\x06;\b[\x00[\a[\aI" +
+ "\"\nclass\x06;\x06F[\b[\a:\vpublic[\x00[\a" +
+ ":\x0Eprotected[\x00[\a:\fprivate[\x00[\aI" +
+ "\"\rinstance\x06;\x06F[\b[\a;\n[\x06I" +
"\"\am1\x06;\x06F[\a;\v[\x00[\a;\f[\x00"
+ loaded.store = @store
+
assert_equal cm, loaded
comment = RDoc::Markup::Document.new(
@@ -197,12 +329,302 @@ class TestRDocClassModule < XrefTestCase
assert_equal [m], loaded.method_list
assert_equal 'Klass', loaded.name
assert_equal 'Super', loaded.superclass
- assert_equal nil, loaded.file
+ assert_nil loaded.file
+ assert_empty loaded.in_files
+ assert_nil loaded.parent
+ assert loaded.current_section
+
+ expected = { nil => s0 }
+ assert_equal expected, loaded.sections_hash
+
+ assert loaded.display?
+ end
+
+ def test_marshal_load_version_1
+ 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
+ a2 = RDoc::Attr.new nil, 'a2', 'RW', '', true
+ a2.record_location tl
+
+ m1 = RDoc::AnyMethod.new nil, 'm1'
+ m1.record_location tl
+
+ c1 = RDoc::Constant.new 'C1', nil, ''
+ c1.record_location tl
+
+ i1 = RDoc::Include.new 'I1', ''
+ i1.record_location tl
+
+ s0 = cm.sections.first
+
+ cm.add_attribute a1
+ cm.add_attribute a2
+ cm.add_method m1
+ cm.add_constant c1
+ cm.add_include i1
+ cm.add_comment 'this is a comment', tl
+
+ loaded = Marshal.load "\x04\bU:\x16RDoc::NormalClass[\x0Ei\x06I\"\nKlass" +
+ "\x06:\x06EFI\"\x15Namespace::Klass\x06;\x06FI" +
+ "\"\nSuper\x06;\x06Fo:\eRDoc::Markup::Document\a" +
+ ":\v@parts[\x06o;\a\a;\b[\x06o" +
+ ":\x1CRDoc::Markup::Paragraph\x06;\b" +
+ "[\x06I\"\x16this is a comment\x06;\x06F" +
+ ":\n@fileI\"\ffile.rb\x06;\x06F;\n0[\a[\nI" +
+ "\"\aa2\x06;\x06FI\"\aRW\x06;\x06F:\vpublicT@\x11" +
+ "[\nI\"\aa1\x06;\x06FI\"\aRW\x06;\x06F;\vF@\x11" +
+ "[\x06[\bI\"\aC1\x06;\x06Fo;\a\a;\b[\x00;\n0@\x11" +
+ "[\x06[\bI\"\aI1\x06;\x06Fo;\a\a;\b[\x00;\n0@\x11" +
+ "[\a[\aI\"\nclass\x06;\x06F[\b[\a;\v[\x00" +
+ "[\a:\x0Eprotected[\x00[\a:\fprivate[\x00[\aI" +
+ "\"\rinstance\x06;\x06F[\b[\a;\v[\x06[\aI" +
+ "\"\am1\x06;\x06F@\x11[\a;\f[\x00[\a;\r[\x00"
+
+ loaded.store = @store
+
+ assert_equal cm, loaded
+
+ inner = RDoc::Markup::Document.new(
+ RDoc::Markup::Paragraph.new('this is a comment'))
+ inner.file = tl
+
+ comment = RDoc::Markup::Document.new inner
+
+ assert_equal [a2, a1], loaded.attributes.sort
+ assert_equal comment, loaded.comment
+ assert_equal [c1], loaded.constants
+ assert_equal 'Namespace::Klass', loaded.full_name
+ assert_equal [i1], loaded.includes
+ assert_empty loaded.extends
+ assert_equal [m1], loaded.method_list
+ assert_equal 'Klass', loaded.name
+ assert_equal 'Super', loaded.superclass
+ assert_empty loaded.in_files
+ assert_nil loaded.parent
+ assert loaded.current_section
+
+ assert_equal tl, loaded.attributes.first.file
+ assert_equal tl, loaded.constants.first.file
+ assert_equal tl, loaded.includes.first.file
+ assert_equal tl, loaded.method_list.first.file
+
+ expected = { nil => s0 }
+ assert_equal expected, loaded.sections_hash
+ end
+
+ def test_marshal_load_version_2
+ 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
+ a2 = RDoc::Attr.new nil, 'a2', 'RW', '', true
+ a2.record_location tl
+
+ m1 = RDoc::AnyMethod.new nil, 'm1'
+ m1.record_location tl
+
+ c1 = RDoc::Constant.new 'C1', nil, ''
+ c1.record_location tl
+
+ i1 = RDoc::Include.new 'I1', ''
+ i1.record_location tl
+
+ e1 = RDoc::Extend.new 'E1', ''
+ e1.record_location tl
+
+ s0 = cm.sections.first
+
+ cm.add_attribute a1
+ cm.add_attribute a2
+ 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 "\x04\bU:\x16RDoc::NormalClass[\x0Fi\aI\"\nKlass" +
+ "\x06:\x06EFI\"\x15Namespace::Klass\x06;\x06FI" +
+ "\"\nSuper\x06;\x06Fo:\eRDoc::Markup::Document\a" +
+ ":\v@parts[\x06o;\a\a;\b[\x06o" +
+ ":\x1CRDoc::Markup::Paragraph\x06;\b" +
+ "[\x06I\"\x16this is a comment\x06;\x06F" +
+ ":\n@fileI\"\ffile.rb\x06;\x06F;\n0[\a[\nI" +
+ "\"\aa2\x06;\x06FI\"\aRW\x06;\x06F:\vpublicT@\x11" +
+ "[\nI\"\aa1\x06;\x06FI\"\aRW\x06;\x06F;\vF@\x11" +
+ "[\x06[\bI\"\aC1\x06;\x06Fo;\a\a;\b[\x00;\n0@\x11" +
+ "[\x06[\bI\"\aI1\x06;\x06Fo;\a\a;\b[\x00;\n0@\x11" +
+ "[\a[\aI\"\nclass\x06;\x06F[\b[\a;\v[\x00" +
+ "[\a:\x0Eprotected[\x00[\a:\fprivate[\x00[\aI" +
+ "\"\rinstance\x06;\x06F[\b[\a;\v[\x06[\aI" +
+ "\"\am1\x06;\x06F@\x11[\a;\f[\x00[\a;\r[\x00" +
+ "[\x06[\bI\"\aE1\x06;\x06Fo;\a\a;\b[\x00;\n0@\x11"
+
+ loaded.store = @store
+
+ assert_equal cm, loaded
+
+ inner = RDoc::Markup::Document.new(
+ RDoc::Markup::Paragraph.new('this is a comment'))
+ inner.file = tl
+
+ comment = RDoc::Markup::Document.new inner
+
+ assert_equal [a2, a1], loaded.attributes.sort
+ assert_equal comment, loaded.comment
+ assert_equal [c1], loaded.constants
+ assert_equal 'Namespace::Klass', loaded.full_name
+ assert_equal [i1], loaded.includes
+ assert_equal [e1], loaded.extends
+ assert_equal [m1], loaded.method_list
+ assert_equal 'Klass', loaded.name
+ assert_equal 'Super', loaded.superclass
+ assert_empty loaded.in_files
+ assert_nil loaded.parent
+ assert loaded.current_section
+
+ assert_equal tl, loaded.attributes. first.file
+ assert_equal tl, loaded.constants. first.file
+ assert_equal tl, loaded.includes. first.file
+ assert_equal tl, loaded.extends. first.file
+ assert_equal tl, loaded.method_list.first.file
+
+ expected = { nil => s0 }
+ assert_equal expected, loaded.sections_hash
+ end
+
+ def test_marshal_load_version_3
+ 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
+ a2 = RDoc::Attr.new nil, 'a2', 'RW', '', true
+ a2.record_location tl
+
+ m1 = RDoc::AnyMethod.new nil, 'm1'
+ m1.record_location tl
+
+ c1 = RDoc::Constant.new 'C1', nil, ''
+ c1.record_location tl
+
+ i1 = RDoc::Include.new 'I1', ''
+ i1.record_location tl
+
+ e1 = RDoc::Extend.new 'E1', ''
+ e1.record_location tl
+
+ section_comment = RDoc::Comment.new('section comment')
+ section_comment.location = tl
+
+ assert_equal 1, cm.sections.length, 'sanity, default section only'
+ s0 = cm.sections.first
+ s1 = cm.add_section 'section', section_comment
+
+ cm.add_attribute a1
+ cm.add_attribute a2
+ 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 "\x04\bU:\x16RDoc::NormalClass[\x13i\bI\"\nKlass" +
+ "\x06:\x06ETI\"\x15Namespace::Klass\x06;\x06TI" +
+ "\"\nSuper\x06;\x06To:\eRDoc::Markup::Document\a" +
+ ":\v@parts[\x06o;\a\a;\b[\x06o" +
+ ":\x1CRDoc::Markup::Paragraph\x06;\b[\x06I" +
+ "\"\x16this is a comment\x06;\x06T:\n@fileI" +
+ "\"\ffile.rb\x06;\x06T;\n0[\a[\nI\"\aa2\x06;" +
+ "\x06TI\"\aRW\x06;\x06T:\vpublicT@\x11[\nI" +
+ "\"\aa1\x06;\x06TI\"\aRW\x06;\x06T;\vF@\x11" +
+ "[\x06U:\x13RDoc::Constant[\x0Fi\x00I\"\aC1\x06" +
+ ";\x06TI\"\x19Namespace::Klass::C1\x06;\x06T00o" +
+ ";\a\a;\b[\x00;\n0@\x11@\ac\x16RDoc::NormalClass0" +
+ "[\x06[\bI\"\aI1\x06;\x06To;\a\a;\b[\x00;\n0@\x11" +
+ "[\a[\aI\"\nclass\x06;\x06T[\b[\a;\v[\x00[\a" +
+ ":\x0Eprotected[\x00[\a:\fprivate[\x00[\aI" +
+ "\"\rinstance\x06;\x06T[\b[\a;\v[\x06[\aI" +
+ "\"\am1\x06;\x06T@\x11[\a;\r[\x00[\a;\x0E[\x00" +
+ "[\x06[\bI\"\aE1\x06;\x06To;\a\a;\b[\x00;\n0@\x11" +
+ "[\aU:\eRDoc::Context::Section[\bi\x000o;\a\a;\b" +
+ "[\x00;\n0U;\x0F[\bi\x00I\"\fsection\x06;\x06To" +
+ ";\a\a;\b[\x06o;\a\a;\b[\x06o;\t\x06;\b[\x06I" +
+ "\"\x14section comment\x06;\x06T;\n@\x11;\n0" +
+ "[\x06@\x11I\"\x0ENamespace\x06" +
+ ";\x06Tc\x17RDoc::NormalModule"
+
+ loaded.store = @store
+
+ assert_equal cm, loaded
+
+ inner = RDoc::Markup::Document.new(
+ RDoc::Markup::Paragraph.new('this is a comment'))
+ inner.file = tl
+
+ comment = RDoc::Markup::Document.new inner
+
+ assert_equal [a2, a1], loaded.attributes.sort
+ assert_equal comment, loaded.comment
+ assert_equal [c1], loaded.constants
+ assert_equal 'Namespace::Klass', loaded.full_name
+ assert_equal [i1], loaded.includes
+ assert_equal [e1], loaded.extends
+ assert_equal [m1], loaded.method_list
+ assert_equal 'Klass', loaded.name
+ assert_equal 'Super', loaded.superclass
+ assert_equal 'Namespace', loaded.parent.name
+ assert loaded.current_section
+
+ expected = {
+ nil => s0,
+ 'section' => s1,
+ }
+
+ assert_equal expected, loaded.sections_hash
+ assert_equal [tl], loaded.in_files
+
+ assert_equal tl, loaded.attributes. first.file
+ assert_equal tl, loaded.constants. first.file
+ assert_equal tl, loaded.includes. first.file
+ assert_equal tl, loaded.extends. first.file
+ assert_equal tl, loaded.method_list.first.file
+ end
+
+ def test_merge
+ tl = @store.add_file 'one.rb'
+ p1 = tl.add_class RDoc::NormalClass, 'Parent'
+ c1 = p1.add_class RDoc::NormalClass, 'Klass'
+
+ c2 = RDoc::NormalClass.new 'Klass'
+
+ c2.merge c1
+
+ assert_equal 'Parent', c1.parent_name, 'original parent name'
+ assert_equal 'Parent', c2.parent_name, 'merged parent name'
+
+ assert c1.current_section, 'original current_section'
+ assert c2.current_section, 'merged current_section'
end
def test_merge_attributes
- tl1 = RDoc::TopLevel.new 'one.rb'
- tl2 = RDoc::TopLevel.new 'two.rb'
+ tl1 = @store.add_file 'one.rb'
+ tl2 = @store.add_file 'two.rb'
cm1 = RDoc::ClassModule.new 'Klass'
@@ -237,7 +659,7 @@ class TestRDocClassModule < XrefTestCase
end
def test_merge_attributes_version_0
- tl1 = RDoc::TopLevel.new 'one.rb'
+ tl1 = @store.add_file 'one.rb'
cm1 = RDoc::ClassModule.new 'Klass'
@@ -270,7 +692,7 @@ class TestRDocClassModule < XrefTestCase
end
def test_merge_collections_drop
- tl = RDoc::TopLevel.new 'file'
+ tl = @store.add_file 'file'
cm1 = RDoc::ClassModule.new 'C'
cm1.record_location tl
@@ -297,17 +719,21 @@ class TestRDocClassModule < XrefTestCase
end
def test_merge_comment
- tl1 = RDoc::TopLevel.new 'one.rb'
- tl2 = RDoc::TopLevel.new 'two.rb'
+ tl1 = @store.add_file 'one.rb'
+ tl2 = @store.add_file 'two.rb'
- cm1 = RDoc::ClassModule.new 'Klass'
+ cm1 = tl1.add_class RDoc::ClassModule, 'Klass'
cm1.add_comment 'klass 1', tl1
+ cm1.record_location tl1
- cm2 = RDoc::ClassModule.new 'Klass'
+ cm2 = tl1.add_class RDoc::NormalClass, 'Klass'
cm2.add_comment 'klass 2', tl2
cm2.add_comment 'klass 3', tl1
+ cm2.record_location tl1
+ cm2.record_location tl2
cm2 = Marshal.load Marshal.dump cm2
+ cm2.store = @store
cm1.merge cm2
@@ -322,7 +748,7 @@ class TestRDocClassModule < XrefTestCase
end
def test_merge_comment_version_0
- tl = RDoc::TopLevel.new 'file.rb'
+ tl = @store.add_file 'file.rb'
cm1 = RDoc::ClassModule.new 'Klass'
cm1.add_comment 'klass 1', tl
@@ -347,17 +773,19 @@ class TestRDocClassModule < XrefTestCase
end
def test_merge_constants
- tl1 = RDoc::TopLevel.new 'one.rb'
- tl2 = RDoc::TopLevel.new 'two.rb'
+ tl1 = @store.add_file 'one.rb'
+ tl2 = @store.add_file 'two.rb'
- cm1 = RDoc::ClassModule.new 'Klass'
+ cm1 = tl1.add_class RDoc::ClassModule, 'Klass'
const = cm1.add_constant RDoc::Constant.new('C1', nil, 'one')
const.record_location tl1
const = cm1.add_constant RDoc::Constant.new('C3', nil, 'one')
const.record_location tl1
- cm2 = RDoc::ClassModule.new 'Klass'
+ store = RDoc::Store.new
+ tl = store.add_file 'one.rb'
+ cm2 = tl.add_class RDoc::ClassModule, 'Klass'
cm2.instance_variable_set :@comment, @RM::Document.new
const = cm2.add_constant RDoc::Constant.new('C2', nil, 'two')
@@ -381,16 +809,18 @@ class TestRDocClassModule < XrefTestCase
end
def test_merge_constants_version_0
- tl1 = RDoc::TopLevel.new 'one.rb'
+ tl1 = @store.add_file 'one.rb'
- cm1 = RDoc::ClassModule.new 'Klass'
+ cm1 = tl1.add_class RDoc::ClassModule, 'Klass'
const = cm1.add_constant RDoc::Constant.new('C1', nil, 'one')
const.record_location tl1
const = cm1.add_constant RDoc::Constant.new('C3', nil, 'one')
const.record_location tl1
- cm2 = RDoc::ClassModule.new 'Klass'
+ store = RDoc::Store.new
+ tl = store.add_file 'one.rb'
+ cm2 = tl.add_class RDoc::ClassModule, 'Klass'
cm2.instance_variable_set :@comment, @RM::Document.new
const = cm2.add_constant RDoc::Constant.new('C2', nil, 'two')
@@ -411,18 +841,55 @@ class TestRDocClassModule < XrefTestCase
assert_equal expected, cm1.constants.sort
end
+ def test_merge_extends
+ tl1 = @store.add_file 'one.rb'
+ cm1 = tl1.add_class RDoc::ClassModule, 'Klass'
+
+ ext = cm1.add_extend RDoc::Extend.new('I1', 'one')
+ ext.record_location tl1
+ ext = cm1.add_extend RDoc::Extend.new('I3', 'one')
+ ext.record_location tl1
+
+ tl2 = @store.add_file 'two.rb'
+ tl2.store = RDoc::Store.new
+
+ cm2 = tl2.add_class RDoc::ClassModule, 'Klass'
+ cm2.instance_variable_set :@comment, @RM::Document.new
+
+ ext = cm2.add_extend RDoc::Extend.new('I2', 'two')
+ ext.record_location tl2
+ ext = cm2.add_extend RDoc::Extend.new('I3', 'one')
+ ext.record_location tl1
+ ext = cm2.add_extend RDoc::Extend.new('I4', 'one')
+ ext.record_location tl1
+
+ cm1.merge cm2
+
+ expected = [
+ RDoc::Extend.new('I2', 'two'),
+ RDoc::Extend.new('I3', 'one'),
+ RDoc::Extend.new('I4', 'one'),
+ ]
+
+ expected.each do |a| a.parent = cm1 end
+
+ assert_equal expected, cm1.extends.sort
+ end
+
def test_merge_includes
- tl1 = RDoc::TopLevel.new 'one.rb'
- tl2 = RDoc::TopLevel.new 'two.rb'
+ tl1 = @store.add_file 'one.rb'
- cm1 = RDoc::ClassModule.new 'Klass'
+ cm1 = tl1.add_class RDoc::ClassModule, 'Klass'
incl = cm1.add_include RDoc::Include.new('I1', 'one')
incl.record_location tl1
incl = cm1.add_include RDoc::Include.new('I3', 'one')
incl.record_location tl1
- cm2 = RDoc::ClassModule.new 'Klass'
+ tl2 = @store.add_file 'two.rb'
+ tl2.store = RDoc::Store.new
+
+ cm2 = tl2.add_class RDoc::ClassModule, 'Klass'
cm2.instance_variable_set :@comment, @RM::Document.new
incl = cm2.add_include RDoc::Include.new('I2', 'two')
@@ -446,16 +913,19 @@ class TestRDocClassModule < XrefTestCase
end
def test_merge_includes_version_0
- tl1 = RDoc::TopLevel.new 'one.rb'
+ tl1 = @store.add_file 'one.rb'
- cm1 = RDoc::ClassModule.new 'Klass'
+ cm1 = tl1.add_class RDoc::ClassModule, 'Klass'
incl = cm1.add_include RDoc::Include.new('I1', 'one')
incl.record_location tl1
incl = cm1.add_include RDoc::Include.new('I3', 'one')
incl.record_location tl1
- cm2 = RDoc::ClassModule.new 'Klass'
+ tl2 = @store.add_file 'one.rb'
+ tl2.store = RDoc::Store.new
+
+ cm2 = tl2.add_class RDoc::ClassModule, 'Klass'
cm2.instance_variable_set :@comment, @RM::Document.new
incl = cm2.add_include RDoc::Include.new('I2', 'two')
@@ -477,10 +947,10 @@ class TestRDocClassModule < XrefTestCase
end
def test_merge_methods
- tl1 = RDoc::TopLevel.new 'one.rb'
- tl2 = RDoc::TopLevel.new 'two.rb'
+ tl1 = @store.add_file 'one.rb'
+ tl2 = @store.add_file 'two.rb'
- cm1 = RDoc::ClassModule.new 'Klass'
+ cm1 = tl1.add_class RDoc::NormalClass, 'Klass'
meth = cm1.add_method RDoc::AnyMethod.new(nil, 'm1')
meth.record_location tl1
@@ -488,6 +958,7 @@ class TestRDocClassModule < XrefTestCase
meth.record_location tl1
cm2 = RDoc::ClassModule.new 'Klass'
+ cm2.store = @store
cm2.instance_variable_set :@comment, @RM::Document.new
meth = cm2.add_method RDoc::AnyMethod.new(nil, 'm2')
@@ -511,9 +982,9 @@ class TestRDocClassModule < XrefTestCase
end
def test_merge_methods_version_0
- tl1 = RDoc::TopLevel.new 'one.rb'
+ tl1 = @store.add_file 'one.rb'
- cm1 = RDoc::ClassModule.new 'Klass'
+ cm1 = tl1.add_class RDoc::NormalClass, 'Klass'
meth = cm1.add_method RDoc::AnyMethod.new(nil, 'm1')
meth.record_location tl1
@@ -521,6 +992,7 @@ class TestRDocClassModule < XrefTestCase
meth.record_location tl1
cm2 = RDoc::ClassModule.new 'Klass'
+ cm2.store = @store
cm2.instance_variable_set :@comment, @RM::Document.new
meth = cm2.add_method RDoc::AnyMethod.new(nil, 'm2')
@@ -541,49 +1013,176 @@ class TestRDocClassModule < XrefTestCase
assert_equal expected, cm1.method_list.sort
end
+ def test_merge_sections
+ store1 = @store
+
+ tl1_1 = store1.add_file 'one.rb'
+
+ cm1 = tl1_1.add_class RDoc::ClassModule, 'Klass'
+ cm1.record_location tl1_1
+
+ s1_0 = cm1.sections.first
+ s1_1 = cm1.add_section 'section 1', comment('comment 1', tl1_1)
+ cm1.add_section 'section 2', comment('comment 2 a', tl1_1)
+ cm1.add_section 'section 4', comment('comment 4 a', tl1_1)
+
+ store2 = RDoc::Store.new
+ tl2_1 = store2.add_file 'one.rb'
+ tl2_2 = store2.add_file 'two.rb'
+
+ cm2 = tl2_1.add_class RDoc::ClassModule, 'Klass'
+ cm2.record_location tl2_1
+ cm2.record_location tl2_2
+
+ cm2.sections.first
+ s2_2 = cm2.add_section 'section 2', comment('comment 2 b', tl2_1)
+ s2_3 = cm2.add_section 'section 3', comment('comment 3', tl2_2)
+ cm2.add_section 'section 4', comment('comment 4 b', tl2_2)
+
+ cm1.merge cm2
+
+ expected = [
+ s1_0,
+ s1_1,
+ s2_2,
+ s2_3,
+ RDoc::Context::Section.new(cm1, 'section 4', nil)
+ ]
+
+ merged_sections = cm1.sections.sort_by do |s|
+ s.title || ''
+ end
+
+ assert_equal expected, merged_sections
+
+ assert_equal [comment('comment 2 b', tl2_1)],
+ cm1.sections_hash['section 2'].comments
+
+ expected_s4_comments = [
+ comment('comment 4 a', tl2_1),
+ comment('comment 4 b', tl2_2),
+ ]
+
+ assert_equal expected_s4_comments, cm1.sections_hash['section 4'].comments
+ end
+
+ def test_merge_sections_overlap
+ store1 = @store
+
+ tl1_1 = store1.add_file 'one.rb'
+ tl1_3 = store1.add_file 'three.rb'
+
+ cm1 = tl1_1.add_class RDoc::ClassModule, 'Klass'
+ cm1.record_location tl1_1
+
+ cm1.add_section 'section', comment('comment 1 a', tl1_1)
+ cm1.add_section 'section', comment('comment 3', tl1_3)
+
+ store2 = RDoc::Store.new
+ tl2_1 = store2.add_file 'one.rb'
+ tl2_2 = store2.add_file 'two.rb'
+ tl2_3 = store2.add_file 'three.rb'
+
+ cm2 = tl2_1.add_class RDoc::ClassModule, 'Klass'
+ cm2.record_location tl2_1
+ cm2.record_location tl2_2
+
+ s2_0 = cm2.sections.first
+ s2_1 = cm2.add_section 'section', comment('comment 1 b', tl1_1)
+ cm2.add_section 'section', comment('comment 2', tl2_2)
+
+ cm1.merge_sections cm2
+
+ expected = [
+ s2_0,
+ s2_1,
+ ]
+
+ merged_sections = cm1.sections.sort_by do |s|
+ s.title || ''
+ end
+
+ assert_equal expected, merged_sections
+
+ expected = [
+ comment('comment 1 b', tl2_1),
+ comment('comment 3', tl2_3),
+ comment('comment 2', tl2_2),
+ ]
+
+ comments = cm1.sections_hash['section'].comments
+
+ assert_equal expected, comments.sort_by { |c| c.file.name }
+ end
+
def test_parse
- tl1 = RDoc::TopLevel.new 'one.rb'
- tl2 = RDoc::TopLevel.new 'two.rb'
+ tl1 = @store.add_file 'one.rb'
+ tl2 = @store.add_file 'two.rb'
cm = RDoc::ClassModule.new 'Klass'
cm.add_comment 'comment 1', tl1
cm.add_comment 'comment 2', tl2
doc1 = @RM::Document.new @RM::Paragraph.new 'comment 1'
- doc1.file = tl1.absolute_name
+ doc1.file = tl1
doc2 = @RM::Document.new @RM::Paragraph.new 'comment 2'
- doc2.file = tl2.absolute_name
+ doc2.file = tl2
expected = @RM::Document.new doc1, doc2
assert_equal expected, cm.parse(cm.comment_location)
end
- def test_parse_comment_location
- tl1 = RDoc::TopLevel.new 'one.rb'
- tl2 = RDoc::TopLevel.new 'two.rb'
+ def test_parse_comment
+ tl1 = @store.add_file 'one.rb'
+
+ cm = RDoc::ClassModule.new 'Klass'
+ cm.comment = comment 'comment 1', tl1
+
+ doc = @RM::Document.new @RM::Paragraph.new 'comment 1'
+ doc.file = tl1
+
+ assert_equal doc, cm.parse(cm.comment)
+ end
+
+ def test_parse_comment_format
+ tl1 = @store.add_file 'one.rb'
cm = RDoc::ClassModule.new 'Klass'
+ cm.comment = comment 'comment ((*1*))', tl1
+ cm.comment.format = 'rd'
+
+ doc = @RM::Document.new @RM::Paragraph.new 'comment <em>1</em>'
+ doc.file = tl1
+
+ assert_equal doc, cm.parse(cm.comment)
+ end
+
+ def test_parse_comment_location
+ tl1 = @store.add_file 'one.rb'
+ tl2 = @store.add_file 'two.rb'
+
+ cm = tl1.add_class RDoc::NormalClass, 'Klass'
cm.add_comment 'comment 1', tl1
cm.add_comment 'comment 2', tl2
cm = Marshal.load Marshal.dump cm
doc1 = @RM::Document.new @RM::Paragraph.new 'comment 1'
- doc1.file = tl1.absolute_name
+ doc1.file = tl1
doc2 = @RM::Document.new @RM::Paragraph.new 'comment 2'
- doc2.file = tl2.absolute_name
+ doc2.file = tl2
assert_same cm.comment_location, cm.parse(cm.comment_location)
end
def test_remove_nodoc_children
- parent = RDoc::ClassModule.new 'A'
+ parent = @top_level.add_class RDoc::ClassModule, 'A'
parent.modules_hash.replace 'B' => true, 'C' => true
- RDoc::TopLevel.all_modules_hash.replace 'A::B' => true
+ @store.modules_hash.replace 'A::B' => true
parent.classes_hash.replace 'D' => true, 'E' => true
- RDoc::TopLevel.all_classes_hash.replace 'A::D' => true
+ @store.classes_hash.replace 'A::D' => true
parent.remove_nodoc_children
@@ -591,6 +1190,83 @@ class TestRDocClassModule < XrefTestCase
assert_equal %w[D], parent.classes_hash.keys
end
+ def test_search_record
+ @c2_c3.add_comment 'This is a comment.', @xref_data
+
+ expected = [
+ 'C3',
+ 'C2::C3',
+ 'C2::C3',
+ '',
+ 'C2/C3.html',
+ '',
+ "<p>This is a comment.\n"
+ ]
+
+ assert_equal expected, @c2_c3.search_record
+ end
+
+ def test_search_record_merged
+ @c2_c3.add_comment 'comment A', @store.add_file('a.rb')
+ @c2_c3.add_comment 'comment B', @store.add_file('b.rb')
+
+ expected = [
+ 'C3',
+ 'C2::C3',
+ 'C2::C3',
+ '',
+ 'C2/C3.html',
+ '',
+ "<p>comment A\n<p>comment B\n"
+ ]
+
+ assert_equal expected, @c2_c3.search_record
+ end
+
+ def test_store_equals
+ # version 2
+ loaded = Marshal.load "\x04\bU:\x16RDoc::NormalClass[\x0Fi\aI\"\nKlass" +
+ "\x06:\x06EFI\"\x15Namespace::Klass\x06;\x06FI" +
+ "\"\nSuper\x06;\x06Fo:\eRDoc::Markup::Document\a" +
+ ":\v@parts[\x06o;\a\a;\b[\x06o" +
+ ":\x1CRDoc::Markup::Paragraph\x06;\b" +
+ "[\x06I\"\x16this is a comment\x06;\x06F" +
+ ":\n@fileI\"\ffile.rb\x06;\x06F;\n0[\a[\nI" +
+ "\"\aa2\x06;\x06FI\"\aRW\x06;\x06F:\vpublicT@\x11" +
+ "[\nI\"\aa1\x06;\x06FI\"\aRW\x06;\x06F;\vF@\x11" +
+ "[\x06[\bI\"\aC1\x06;\x06Fo;\a\a;\b[\x00;\n0@\x11" +
+ "[\x06[\bI\"\aI1\x06;\x06Fo;\a\a;\b[\x00;\n0@\x11" +
+ "[\a[\aI\"\nclass\x06;\x06F[\b[\a;\v[\x00" +
+ "[\a:\x0Eprotected[\x00[\a:\fprivate[\x00[\aI" +
+ "\"\rinstance\x06;\x06F[\b[\a;\v[\x06[\aI" +
+ "\"\am1\x06;\x06F@\x11[\a;\f[\x00[\a;\r[\x00" +
+ "[\x06[\bI\"\aE1\x06;\x06Fo;\a\a;\b[\x00;\n0@\x11"
+
+ loaded.store = @store
+
+ assert_same @store, loaded.store
+
+ a = loaded.attributes.first
+ assert_same @store, a.store
+ assert_same @store, a.file.store
+
+ c = loaded.constants.first
+ assert_same @store, c.store
+ assert_same @store, c.file.store
+
+ i = loaded.includes.first
+ assert_same @store, i.store
+ assert_same @store, i.file.store
+
+ e = loaded.extends.first
+ assert_same @store, e.store
+ assert_same @store, e.file.store
+
+ m = loaded.method_list.first
+ assert_same @store, m.store
+ assert_same @store, m.file.store
+ end
+
def test_superclass
assert_equal @c3_h1, @c3_h2.superclass
end
@@ -668,6 +1344,30 @@ class TestRDocClassModule < XrefTestCase
assert_equal 'O1::A1', o1_a1_m.full_name
end
+ def test_update_aliases_reparent_root
+ store = RDoc::Store.new
+
+ top_level = store.add_file 'file.rb'
+
+ klass = top_level.add_class RDoc::NormalClass, 'Klass'
+ object = top_level.add_class RDoc::NormalClass, 'Object'
+
+ const = RDoc::Constant.new 'A', nil, ''
+ const.record_location top_level
+ const.is_alias_for = klass
+
+ top_level.add_module_alias klass, 'A', top_level
+
+ object.add_constant const
+
+ object.update_aliases
+
+ assert_equal %w[A Klass Object], store.classes_hash.keys.sort
+
+ assert_equal 'A', store.classes_hash['A'].full_name
+ assert_equal 'Klass', store.classes_hash['Klass'].full_name
+ end
+
def test_update_includes
a = RDoc::Include.new 'M1', nil
b = RDoc::Include.new 'M2', nil
@@ -681,16 +1381,30 @@ class TestRDocClassModule < XrefTestCase
@m1_m2.document_self = nil
assert @m1_m2.remove_from_documentation?
- assert RDoc::TopLevel.all_modules_hash.key? @m1_m2.full_name
- refute RDoc::TopLevel.all_modules_hash[@m1_m2.full_name].nil?
- RDoc::TopLevel.remove_nodoc RDoc::TopLevel.all_modules_hash
- refute RDoc::TopLevel.all_modules_hash.key? @m1_m2.full_name
+ assert @store.modules_hash.key? @m1_m2.full_name
+ refute @store.modules_hash[@m1_m2.full_name].nil?
+
+ @store.remove_nodoc @store.modules_hash
+ refute @store.modules_hash.key? @m1_m2.full_name
@c1.update_includes
assert_equal [a, c], @c1.includes
end
+ def test_update_includes_trim
+ a = RDoc::Include.new 'D::M', nil
+ b = RDoc::Include.new 'D::M', nil
+
+ @c1.add_include a
+ @c1.add_include b
+ @c1.ancestors # cache included modules
+
+ @c1.update_includes
+
+ assert_equal [a], @c1.includes
+ end
+
def test_update_includes_with_colons
a = RDoc::Include.new 'M1', nil
b = RDoc::Include.new 'M1::M2', nil
@@ -704,15 +1418,75 @@ class TestRDocClassModule < XrefTestCase
@m1_m2.document_self = nil
assert @m1_m2.remove_from_documentation?
- assert RDoc::TopLevel.all_modules_hash.key? @m1_m2.full_name
- refute RDoc::TopLevel.all_modules_hash[@m1_m2.full_name].nil?
- RDoc::TopLevel.remove_nodoc RDoc::TopLevel.all_modules_hash
- refute RDoc::TopLevel.all_modules_hash.key? @m1_m2.full_name
+ assert @store.modules_hash.key? @m1_m2.full_name
+ refute @store.modules_hash[@m1_m2.full_name].nil?
+ @store.remove_nodoc @store.modules_hash
+ refute @store.modules_hash.key? @m1_m2.full_name
@c1.update_includes
assert_equal [a, c], @c1.includes
end
+ def test_update_extends
+ a = RDoc::Extend.new 'M1', nil
+ b = RDoc::Extend.new 'M2', nil
+ c = RDoc::Extend.new 'C', nil
+
+ @c1.add_extend a
+ @c1.add_extend b
+ @c1.add_extend c
+ @c1.each_extend do |extend| extend.module end # cache extended modules
+
+ @m1_m2.document_self = nil
+ assert @m1_m2.remove_from_documentation?
+
+ assert @store.modules_hash.key? @m1_m2.full_name
+ refute @store.modules_hash[@m1_m2.full_name].nil?
+ @store.remove_nodoc @store.modules_hash
+ refute @store.modules_hash.key? @m1_m2.full_name
+
+ @c1.update_extends
+
+ assert_equal [a, b, c], @c1.extends
+ end
+
+ def test_update_extends_trim
+ a = RDoc::Extend.new 'D::M', nil
+ b = RDoc::Extend.new 'D::M', nil
+
+ @c1.add_extend a
+ @c1.add_extend b
+ @c1.each_extend do |extend| extend.module end # cache extended modules
+
+ @c1.update_extends
+
+ assert_equal [a], @c1.extends
+ end
+
+ def test_update_extends_with_colons
+ a = RDoc::Extend.new 'M1', nil
+ b = RDoc::Extend.new 'M1::M2', nil
+ c = RDoc::Extend.new 'C', nil
+
+ @c1.add_extend a
+ @c1.add_extend b
+ @c1.add_extend c
+ @c1.each_extend do |extend| extend.module end # cache extended modules
+
+ @m1_m2.document_self = nil
+ assert @m1_m2.remove_from_documentation?
+
+ assert @store.modules_hash.key? @m1_m2.full_name
+ refute @store.modules_hash[@m1_m2.full_name].nil?
+
+ @store.remove_nodoc @store.modules_hash
+ refute @store.modules_hash.key? @m1_m2.full_name
+
+ @c1.update_extends
+
+ assert_equal [a, c], @c1.extends
+ end
+
end
diff --git a/test/rdoc/test_rdoc_code_object.rb b/test/rdoc/test_rdoc_code_object.rb
index c7a37488cc..2fb6ac23a5 100644
--- a/test/rdoc/test_rdoc_code_object.rb
+++ b/test/rdoc/test_rdoc_code_object.rb
@@ -1,9 +1,6 @@
# coding: US-ASCII
-require 'rubygems'
-require 'minitest/autorun'
require File.expand_path '../xref_test_case', __FILE__
-require 'rdoc/code_object'
class TestRDocCodeObject < XrefTestCase
@@ -32,6 +29,16 @@ class TestRDocCodeObject < XrefTestCase
assert_equal 'I am a comment', @co.comment
end
+ def test_comment_equals_comment
+ @co.comment = comment ''
+
+ assert_equal '', @co.comment.text
+
+ @co.comment = comment 'I am a comment'
+
+ assert_equal 'I am a comment', @co.comment.text
+ end
+
def test_comment_equals_document
doc = RDoc::Markup::Document.new
@co.comment = doc
@@ -93,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
@@ -152,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
@@ -167,7 +218,7 @@ class TestRDocCodeObject < XrefTestCase
def test_file_name
assert_equal nil, @co.file_name
- @co.record_location RDoc::TopLevel.new 'lib/file.rb'
+ @co.record_location @store.add_file 'lib/file.rb'
assert_equal 'lib/file.rb', @co.file_name
end
@@ -188,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
@@ -222,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
@@ -256,6 +327,33 @@ 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
+
+ @co.parent = parent
+ @co.instance_variable_set :@section, section
+
+ assert_equal section, @co.section
+
+ @co.instance_variable_set :@section, nil
+ @co.instance_variable_set :@section_title, nil
+
+ assert_equal section, @co.section
+
+ @co.instance_variable_set :@section, nil
+ @co.instance_variable_set :@section_title, 'new title'
+
+ assert_equal 'new title', @co.section.title
+ end
+
def test_start_doc
@co.document_self = false
@co.document_children = false
@@ -276,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
@@ -284,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_comment.rb b/test/rdoc/test_rdoc_comment.rb
new file mode 100644
index 0000000000..2a1318b66c
--- /dev/null
+++ b/test/rdoc/test_rdoc_comment.rb
@@ -0,0 +1,504 @@
+# coding: us-ascii
+
+require 'rdoc/test_case'
+
+class TestRDocComment < RDoc::TestCase
+
+ def setup
+ super
+
+ @top_level = @store.add_file 'file.rb'
+ @comment = RDoc::Comment.new
+ @comment.location = @top_level
+ @comment.text = 'this is a comment'
+ end
+
+ def test_empty_eh
+ refute_empty @comment
+
+ @comment = ''
+
+ assert_empty @comment
+ end
+
+ def test_equals2
+ assert_equal @comment, @comment.dup
+
+ c2 = @comment.dup
+ c2.text = nil
+
+ refute_equal @comment, c2
+
+ c3 = @comment.dup
+ c3.location = nil
+
+ refute_equal @comment, c3
+ end
+
+ def test_extract_call_seq
+ m = RDoc::AnyMethod.new nil, 'm'
+
+ comment = RDoc::Comment.new <<-COMMENT, @top_level
+call-seq:
+ bla => true or false
+
+moar comment
+ COMMENT
+
+ comment.extract_call_seq m
+
+ assert_equal "bla => true or false\n", m.call_seq
+ end
+
+ def test_extract_call_seq_blank
+ m = RDoc::AnyMethod.new nil, 'm'
+
+ comment = RDoc::Comment.new <<-COMMENT, @top_level
+call-seq:
+ bla => true or false
+
+ COMMENT
+
+ comment.extract_call_seq m
+
+ assert_equal "bla => true or false\n", m.call_seq
+ end
+
+ def test_extract_call_seq_commented
+ m = RDoc::AnyMethod.new nil, 'm'
+
+ comment = RDoc::Comment.new <<-COMMENT, @top_level
+# call-seq:
+# bla => true or false
+#
+# moar comment
+ COMMENT
+
+ comment.extract_call_seq m
+
+ assert_equal nil, m.call_seq
+ end
+
+ def test_extract_call_seq_no_blank
+ m = RDoc::AnyMethod.new nil, 'm'
+
+ comment = RDoc::Comment.new <<-COMMENT, @top_level
+call-seq:
+ bla => true or false
+ COMMENT
+
+ comment.extract_call_seq m
+
+ assert_equal "bla => true or false\n", m.call_seq
+ end
+
+ def test_extract_call_seq_undent
+ m = RDoc::AnyMethod.new nil, 'm'
+
+ comment = RDoc::Comment.new <<-COMMENT, @top_level
+call-seq:
+ bla => true or false
+moar comment
+ COMMENT
+
+ comment.extract_call_seq m
+
+ assert_equal "bla => true or false\nmoar comment\n", m.call_seq
+ end
+
+ def test_extract_call_seq_c
+ comment = RDoc::Comment.new <<-COMMENT
+call-seq:
+ commercial() -> Date <br />
+ commercial(cwyear, cweek=41, cwday=5, sg=nil) -> Date [ruby 1.8] <br />
+ commercial(cwyear, cweek=1, cwday=1, sg=nil) -> Date [ruby 1.9]
+
+If no arguments are given:
+* ruby 1.8: returns a +Date+ for 1582-10-15 (the Day of Calendar Reform in
+ Italy)
+* ruby 1.9: returns a +Date+ for julian day 0
+
+Otherwise, returns a +Date+ for the commercial week year, commercial week,
+and commercial week day given. Ignores the 4th argument.
+ COMMENT
+
+ method_obj = RDoc::AnyMethod.new nil, 'blah'
+
+ comment.extract_call_seq method_obj
+
+ expected = <<-CALL_SEQ.chomp
+commercial() -> Date <br />
+commercial(cwyear, cweek=41, cwday=5, sg=nil) -> Date [ruby 1.8] <br />
+commercial(cwyear, cweek=1, cwday=1, sg=nil) -> Date [ruby 1.9]
+
+ CALL_SEQ
+
+ assert_equal expected, method_obj.call_seq
+ end
+
+ def test_extract_call_seq_c_no_blank
+ comment = RDoc::Comment.new <<-COMMENT
+call-seq:
+ commercial() -> Date <br />
+ commercial(cwyear, cweek=41, cwday=5, sg=nil) -> Date [ruby 1.8] <br />
+ commercial(cwyear, cweek=1, cwday=1, sg=nil) -> Date [ruby 1.9]
+ COMMENT
+
+ method_obj = RDoc::AnyMethod.new nil, 'blah'
+
+ comment.extract_call_seq method_obj
+
+ expected = <<-CALL_SEQ.chomp
+commercial() -> Date <br />
+commercial(cwyear, cweek=41, cwday=5, sg=nil) -> Date [ruby 1.8] <br />
+commercial(cwyear, cweek=1, cwday=1, sg=nil) -> Date [ruby 1.9]
+
+ CALL_SEQ
+
+ assert_equal expected, method_obj.call_seq
+ end
+
+ def test_extract_call_seq_c_separator
+ comment = RDoc::Comment.new <<-'COMMENT'
+call-seq:
+ ARGF.readlines(sep=$/) -> array
+ ARGF.readlines(limit) -> array
+ ARGF.readlines(sep, limit) -> array
+
+ ARGF.to_a(sep=$/) -> array
+ ARGF.to_a(limit) -> array
+ ARGF.to_a(sep, limit) -> array
+
+Reads +ARGF+'s current file in its entirety, returning an +Array+ of its
+lines, one line per element. Lines are assumed to be separated by _sep_.
+
+ lines = ARGF.readlines
+ lines[0] #=> "This is line one\n"
+
+ COMMENT
+
+ method_obj = RDoc::AnyMethod.new nil, 'blah'
+
+ comment.extract_call_seq method_obj
+
+ expected = <<-CALL_SEQ
+ARGF.readlines(sep=$/) -> array
+ARGF.readlines(limit) -> array
+ARGF.readlines(sep, limit) -> array
+ARGF.to_a(sep=$/) -> array
+ARGF.to_a(limit) -> array
+ARGF.to_a(sep, limit) -> array
+ CALL_SEQ
+
+ assert_equal expected, method_obj.call_seq
+
+ expected = <<-'COMMENT'
+
+Reads +ARGF+'s current file in its entirety, returning an +Array+ of its
+lines, one line per element. Lines are assumed to be separated by _sep_.
+
+ lines = ARGF.readlines
+ lines[0] #=> "This is line one\n"
+
+ COMMENT
+
+ assert_equal expected, comment.text
+ end
+
+ def test_force_encoding
+ skip "Encoding not implemented" unless Object.const_defined? :Encoding
+
+ @comment.force_encoding Encoding::UTF_8
+
+ assert_equal Encoding::UTF_8, @comment.text.encoding
+ end
+
+ def test_format
+ assert_equal 'rdoc', @comment.format
+ end
+
+ def test_format_equals
+ c = comment 'content'
+ document = c.parse
+
+ c.format = RDoc::RD
+
+ assert_equal RDoc::RD, c.format
+ refute_same document, c.parse
+ end
+
+ def test_initialize_copy
+ copy = @comment.dup
+
+ refute_same @comment.text, copy.text
+ assert_same @comment.location, copy.location
+ end
+
+ def test_location
+ assert_equal @top_level, @comment.location
+ end
+
+ def test_normalize
+ @comment.text = <<-TEXT
+ # comment
+ TEXT
+
+ assert_same @comment, @comment.normalize
+
+ assert_equal 'comment', @comment.text
+ end
+
+ def test_normalize_twice
+ @comment.text = <<-TEXT
+ # comment
+ TEXT
+
+ @comment.normalize
+
+ text = @comment.text
+
+ @comment.normalize
+
+ assert_same text, @comment.text, 'normalize not cached'
+ end
+
+ def test_normalize_document
+ @comment.text = nil
+ @comment.document = @RM::Document.new
+
+ assert_same @comment, @comment.normalize
+
+ assert_nil @comment.text
+ end
+
+ def test_normalize_eh
+ refute @comment.normalized?
+
+ @comment.normalize
+
+ assert @comment.normalized?
+ end
+
+ def test_text
+ assert_equal 'this is a comment', @comment.text
+ end
+
+ def test_text_equals
+ @comment.text = 'other'
+
+ assert_equal 'other', @comment.text
+ refute @comment.normalized?
+ end
+
+ def test_text_equals_no_text
+ c = RDoc::Comment.new nil, @top_level
+ c.document = @RM::Document.new
+
+ e = assert_raises RDoc::Error do
+ c.text = 'other'
+ end
+
+ assert_equal 'replacing document-only comment is not allowed', e.message
+ end
+
+ def test_text_equals_parsed
+ document = @comment.parse
+
+ @comment.text = 'other'
+
+ refute_equal document, @comment.parse
+ end
+
+ def test_tomdoc_eh
+ refute @comment.tomdoc?
+
+ @comment.format = 'tomdoc'
+
+ assert @comment.tomdoc?
+ end
+
+ def test_parse
+ parsed = @comment.parse
+
+ expected = @RM::Document.new(
+ @RM::Paragraph.new('this is a comment'))
+
+ expected.file = @top_level
+
+ assert_equal expected, parsed
+ assert_same parsed, @comment.parse
+ end
+
+ def test_parse_rd
+ c = comment 'it ((*works*))'
+ c.format = 'rd'
+
+ expected =
+ @RM::Document.new(
+ @RM::Paragraph.new('it <em>works</em>'))
+ expected.file = @top_level
+
+ assert_equal expected, c.parse
+ end
+
+ def test_remove_private_encoding
+ skip "Encoding not implemented" unless Object.const_defined? :Encoding
+
+ comment = RDoc::Comment.new <<-EOS, @top_level
+# This is text
+#--
+# this is private
+ EOS
+
+ comment.force_encoding Encoding::IBM437
+
+ comment.remove_private
+
+ assert_equal Encoding::IBM437, comment.text.encoding
+ end
+
+ def test_remove_private_hash
+ @comment.text = <<-TEXT
+#--
+# private
+#++
+# public
+ TEXT
+
+ @comment.remove_private
+
+ assert_equal "# public\n", @comment.text
+ end
+
+ def test_remove_private_hash_trail
+ comment = RDoc::Comment.new <<-EOS, @top_level
+# This is text
+#--
+# this is private
+ EOS
+
+ expected = RDoc::Comment.new <<-EOS, @top_level
+# This is text
+ EOS
+
+ comment.remove_private
+
+ assert_equal expected, comment
+ end
+
+ def test_remove_private_long
+ comment = RDoc::Comment.new <<-EOS, @top_level
+#-----
+#++
+# this is text
+#-----
+ EOS
+
+ expected = RDoc::Comment.new <<-EOS, @top_level
+# this is text
+ EOS
+
+ comment.remove_private
+
+ assert_equal expected, comment
+ end
+
+ def test_remove_private_rule
+ comment = RDoc::Comment.new <<-EOS, @top_level
+# This is text with a rule:
+# ---
+# this is also text
+ EOS
+
+ expected = comment.dup
+
+ comment.remove_private
+
+ assert_equal expected, comment
+ end
+
+ def test_remove_private_star
+ @comment.text = <<-TEXT
+/*
+ *--
+ * private
+ *++
+ * public
+ */
+ TEXT
+
+ @comment.remove_private
+
+ assert_equal "/*\n * public\n */\n", @comment.text
+ end
+
+ def test_remove_private_star2
+ @comment.text = <<-TEXT
+/*--
+ * private
+ *++
+ * public
+ */
+ TEXT
+
+ @comment.remove_private
+
+ assert_equal "/*--\n * private\n *++\n * public\n */\n", @comment.text
+ end
+
+ def test_remove_private_toggle
+ comment = RDoc::Comment.new <<-EOS, @top_level
+# This is text
+#--
+# this is private
+#++
+# This is text again.
+ EOS
+
+ expected = RDoc::Comment.new <<-EOS, @top_level
+# This is text
+# This is text again.
+ EOS
+
+ comment.remove_private
+
+ assert_equal expected, comment
+ end
+
+ def test_remove_private_toggle_encoding
+ skip "Encoding not implemented" unless Object.const_defined? :Encoding
+
+ comment = RDoc::Comment.new <<-EOS, @top_level
+# This is text
+#--
+# this is private
+#++
+# This is text again.
+ EOS
+
+ comment.force_encoding Encoding::IBM437
+
+ comment.remove_private
+
+ assert_equal Encoding::IBM437, comment.text.encoding
+ end
+
+ def test_remove_private_toggle_encoding_ruby_bug?
+ skip "Encoding not implemented" unless Object.const_defined? :Encoding
+
+ comment = RDoc::Comment.new <<-EOS, @top_level
+#--
+# this is private
+#++
+# This is text again.
+ EOS
+
+ comment.force_encoding Encoding::IBM437
+
+ comment.remove_private
+
+ assert_equal Encoding::IBM437, comment.text.encoding
+ end
+
+end
+
diff --git a/test/rdoc/test_rdoc_constant.rb b/test/rdoc/test_rdoc_constant.rb
index b915f5cc7a..5c347f62ae 100644
--- a/test/rdoc/test_rdoc_constant.rb
+++ b/test/rdoc/test_rdoc_constant.rb
@@ -8,6 +8,142 @@ class TestRDocConstant < XrefTestCase
@const = @c1.constants.first
end
+ def test_full_name
+ assert_equal 'C1::CONST', @const.full_name
+ end
+
+ def test_is_alias_for
+ top_level = @store.add_file 'file.rb'
+
+ c = RDoc::Constant.new 'CONST', nil, 'comment'
+ top_level.add_constant c
+
+ assert_nil c.is_alias_for
+
+ c.is_alias_for = 'C1'
+
+ assert_equal @c1, c.is_alias_for
+
+ c.is_alias_for = 'unknown'
+
+ assert_equal 'unknown', c.is_alias_for
+ end
+
+ def test_marshal_dump
+ top_level = @store.add_file 'file.rb'
+
+ c = RDoc::Constant.new 'CONST', nil, 'this is a comment'
+ c.record_location top_level
+
+ aliased = top_level.add_class RDoc::NormalClass, 'Aliased'
+ c.is_alias_for = aliased
+
+ cm = top_level.add_class RDoc::NormalClass, 'Klass'
+ cm.add_constant c
+
+ section = cm.sections.first
+
+ loaded = Marshal.load Marshal.dump c
+ loaded.store = @store
+
+ comment = doc(para('this is a comment'))
+
+ assert_equal c, loaded
+
+ assert_equal aliased, loaded.is_alias_for
+ assert_equal comment, loaded.comment
+ assert_equal top_level, loaded.file
+ assert_equal 'Klass::CONST', loaded.full_name
+ assert_equal 'CONST', loaded.name
+ assert_nil loaded.visibility
+ assert_equal cm, loaded.parent
+ assert_equal section, loaded.section
+ end
+
+ def test_marshal_load
+ top_level = @store.add_file 'file.rb'
+
+ c = RDoc::Constant.new 'CONST', nil, 'this is a comment'
+ c.record_location top_level
+
+ cm = top_level.add_class RDoc::NormalClass, 'Klass'
+ cm.add_constant c
+
+ section = cm.sections.first
+
+ loaded = Marshal.load Marshal.dump c
+ loaded.store = @store
+
+ comment = doc(para('this is a comment'))
+
+ assert_equal c, loaded
+
+ assert_nil loaded.is_alias_for
+ assert_equal comment, loaded.comment
+ assert_equal top_level, loaded.file
+ assert_equal 'Klass::CONST', loaded.full_name
+ assert_equal 'CONST', loaded.name
+ assert_nil loaded.visibility
+ assert_equal cm, loaded.parent
+ assert_equal section, loaded.section
+
+ assert loaded.display?
+ end
+
+ def test_marshal_load_version_0
+ top_level = @store.add_file 'file.rb'
+
+ aliased = top_level.add_class RDoc::NormalClass, 'Aliased'
+ cm = top_level.add_class RDoc::NormalClass, 'Klass'
+ section = cm.sections.first
+
+ loaded = Marshal.load "\x04\bU:\x13RDoc::Constant[\x0Fi\x00I" +
+ "\"\nCONST\x06:\x06ETI\"\x11Klass::CONST\x06" +
+ ";\x06T0I\"\fAliased\x06;\x06To" +
+ ":\eRDoc::Markup::Document\a:\v@parts[\x06o" +
+ ":\x1CRDoc::Markup::Paragraph\x06;\b[\x06I" +
+ "\"\x16this is a comment\x06;\x06T:\n@file0I" +
+ "\"\ffile.rb\x06;\x06TI\"\nKlass\x06" +
+ ";\x06Tc\x16RDoc::NormalClass0"
+
+ loaded.store = @store
+
+ comment = doc(para('this is a comment'))
+
+ assert_equal aliased, loaded.is_alias_for
+ assert_equal comment, loaded.comment
+ assert_equal top_level, loaded.file
+ assert_equal 'Klass::CONST', loaded.full_name
+ assert_equal 'CONST', loaded.name
+ assert_nil loaded.visibility
+ assert_equal cm, loaded.parent
+ assert_equal section, loaded.section
+
+ assert loaded.display?
+ end
+
+ def test_marshal_round_trip
+ top_level = @store.add_file 'file.rb'
+
+ c = RDoc::Constant.new 'CONST', nil, 'this is a comment'
+ c.record_location top_level
+ c.is_alias_for = 'Unknown'
+
+ cm = top_level.add_class RDoc::NormalClass, 'Klass'
+ cm.add_constant c
+
+ section = cm.sections.first
+
+ loaded = Marshal.load Marshal.dump c
+ loaded.store = @store
+
+ reloaded = Marshal.load Marshal.dump loaded
+ reloaded.store = @store
+
+ assert_equal section, reloaded.section
+ assert_equal 'Unknown', reloaded.is_alias_for
+ end
+
def test_path
assert_equal 'C1.html#CONST', @const.path
end
diff --git a/test/rdoc/test_rdoc_context.rb b/test/rdoc/test_rdoc_context.rb
index 2fb8ef7bb7..c6c5e2f109 100644
--- a/test/rdoc/test_rdoc_context.rb
+++ b/test/rdoc/test_rdoc_context.rb
@@ -1,5 +1,3 @@
-require 'rubygems'
-require 'minitest/autorun'
require File.expand_path '../xref_test_case', __FILE__
class TestRDocContext < XrefTestCase
@@ -8,6 +6,10 @@ class TestRDocContext < XrefTestCase
super
@context = RDoc::Context.new
+ @context.store = @store
+
+ @enumerator = # 1.8 vs 1.9
+ Object.const_defined?(:Enumerator) ? Enumerator : Enumerable::Enumerator
end
def test_initialize
@@ -39,8 +41,16 @@ 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 = RDoc::TopLevel.new 'file.rb'
+ top_level = @store.add_file 'file.rb'
attr = RDoc::Attr.new nil, 'old_name', 'R', ''
@@ -60,7 +70,7 @@ class TestRDocContext < XrefTestCase
end
def test_add_alias_method
- top_level = RDoc::TopLevel.new 'file.rb'
+ top_level = @store.add_file 'file.rb'
meth = RDoc::AnyMethod.new nil, 'old_name'
meth.singleton = false
@@ -103,7 +113,7 @@ class TestRDocContext < XrefTestCase
@c1.add_class RDoc::NormalClass, 'Klass', 'Object'
assert_includes @c1.classes.map { |k| k.full_name }, 'C1::Klass'
- assert_includes RDoc::TopLevel.classes.map { |k| k.full_name }, 'C1::Klass'
+ assert_includes @store.all_classes.map { |k| k.full_name }, 'C1::Klass'
end
def test_add_class_basic_object
@@ -142,7 +152,7 @@ class TestRDocContext < XrefTestCase
@c1.add_class RDoc::NormalClass, 'Klass', 'Object'
assert_includes @c1.classes.map { |k| k.full_name }, 'C1::Klass'
- assert_includes RDoc::TopLevel.classes.map { |k| k.full_name }, 'C1::Klass'
+ assert_includes @store.all_classes.map { |k| k.full_name }, 'C1::Klass'
end
def test_add_class_superclass
@@ -163,9 +173,9 @@ class TestRDocContext < XrefTestCase
refute_includes @c1.modules.map { |k| k.full_name }, 'C1::Klass',
'c1 modules'
- assert_includes RDoc::TopLevel.classes.map { |k| k.full_name }, 'C1::Klass',
+ assert_includes @store.all_classes.map { |k| k.full_name }, 'C1::Klass',
'TopLevel classes'
- refute_includes RDoc::TopLevel.modules.map { |k| k.full_name }, 'C1::Klass',
+ refute_includes @store.all_modules.map { |k| k.full_name }, 'C1::Klass',
'TopLevel modules'
end
@@ -176,6 +186,13 @@ class TestRDocContext < XrefTestCase
assert_equal [const], @context.constants
end
+ def test_add_extend
+ ext = RDoc::Extend.new 'Name', 'comment'
+ @context.add_extend ext
+
+ assert_equal [ext], @context.extends
+ end
+
def test_add_include
incl = RDoc::Include.new 'Name', 'comment'
@context.add_include incl
@@ -183,16 +200,6 @@ class TestRDocContext < XrefTestCase
assert_equal [incl], @context.includes
end
- def test_add_include_twice
- incl1 = RDoc::Include.new 'Name', 'comment'
- @context.add_include incl1
-
- incl2 = RDoc::Include.new 'Name', 'comment'
- @context.add_include incl2
-
- assert_equal [incl1], @context.includes
- end
-
def test_add_method
meth = RDoc::AnyMethod.new nil, 'old_name'
meth.visibility = nil
@@ -217,6 +224,59 @@ class TestRDocContext < XrefTestCase
assert_equal %w[old_name new_name], @context.method_list.map { |m| m.name }
end
+ def test_add_method_duplicate
+ @store.rdoc.options.verbosity = 2
+
+ meth1 = RDoc::AnyMethod.new nil, 'name'
+ meth1.record_location @store.add_file 'first.rb'
+ meth1.visibility = nil
+ meth1.comment = comment 'first'
+
+ @context.add_method meth1
+
+ meth2 = RDoc::AnyMethod.new nil, 'name'
+ meth2.record_location @store.add_file 'second.rb'
+ meth2.comment = comment 'second'
+
+ _, err = verbose_capture_io do
+ @context.add_method meth2
+ end
+
+ expected = 'Duplicate method (unknown)#name in file second.rb, ' \
+ 'previously in file first.rb'
+
+ assert_equal expected, err.chomp
+
+ method = @context.method_list.first
+
+ assert_equal 'first', method.comment.text
+ end
+
+ def test_add_method_duplicate_loading
+ @context.store = nil
+
+ meth1 = RDoc::AnyMethod.new nil, 'name'
+ meth1.record_location @store.add_file 'first.rb'
+ meth1.visibility = nil
+ meth1.comment = comment 'first'
+
+ @context.add_method meth1
+
+ meth2 = RDoc::AnyMethod.new nil, 'name'
+ meth2.record_location @store.add_file 'second.rb'
+ meth2.comment = comment 'second'
+
+ _, err = verbose_capture_io do
+ @context.add_method meth2
+ end
+
+ assert_empty err
+
+ method = @context.method_list.first
+
+ assert_equal 'first', method.comment.text
+ end
+
def test_add_module
@c1.add_module RDoc::NormalModule, 'Mod'
@@ -224,18 +284,35 @@ class TestRDocContext < XrefTestCase
end
def test_add_module_alias
- tl = RDoc::TopLevel.new 'file.rb'
+ tl = @store.add_file 'file.rb'
c3_c4 = @c2.add_module_alias @c2_c3, 'C4', tl
- c4 = @c2.find_module_named('C4')
-
alias_constant = @c2.constants.first
- assert_equal c4, c3_c4
+ assert_equal 'C2::C4', c3_c4.full_name
assert_equal tl, alias_constant.file
end
+ def test_add_module_alias_top_level
+ store = RDoc::Store.new
+
+ top_level = store.add_file 'file.rb'
+
+ klass = top_level.add_class RDoc::NormalClass, 'Klass'
+ klass.comment = 'klass comment'
+
+ object = top_level.add_class RDoc::NormalClass, 'Object'
+
+ top_level.add_module_alias klass, 'A', top_level
+
+ refute_empty object.constants
+
+ constant = object.constants.first
+
+ assert_equal 'klass comment', constant.comment
+ end
+
def test_add_module_class
k = @c1.add_class RDoc::NormalClass, 'Klass', nil
m = @c1.add_module RDoc::NormalModule, 'Klass'
@@ -255,18 +332,20 @@ class TestRDocContext < XrefTestCase
def test_add_section
default_section = @context.sections.first
- @context.add_section nil, '# comment'
+ @context.add_section nil, comment('comment', @top_level)
assert_equal 1, @context.sections.length
- assert_equal '# comment', @context.sections.first.comment
+ assert_equal [comment("comment", @top_level)],
+ @context.sections.first.comments
- @context.add_section nil, '# new comment'
+ @context.add_section nil, comment('new comment', @top_level)
assert_equal 1, @context.sections.length
- assert_equal "# comment\n# ---\n# new comment",
- @context.sections.first.comment
+ assert_equal [comment('comment', @top_level),
+ comment('new comment', @top_level)],
+ @context.sections.first.comments
- @context.add_section 'other', ''
+ @context.add_section 'other', comment('', @top_level)
assert_equal 2, @context.sections.length
@@ -275,6 +354,23 @@ class TestRDocContext < XrefTestCase
assert_equal default_section, @context.current_section
end
+ def test_add_section_no_comment
+ default_section = @context.sections.first
+
+ @context.add_section nil
+
+ assert_equal 1, @context.sections.length
+
+ @context.add_section 'other'
+
+ assert_equal 2, @context.sections.length
+
+ new_section = @context.sections.find { |section| section.title == 'other' }
+
+ assert new_section
+ assert_equal default_section, @context.current_section
+ end
+
def test_add_to
incl = RDoc::Include.new 'Name', 'comment'
arr = []
@@ -288,7 +384,8 @@ class TestRDocContext < XrefTestCase
def test_add_to_temporary_section
incl = RDoc::Include.new 'Name', 'comment'
arr = []
- section = @context.add_section 'temporary', ''
+ section =
+ @context.add_section 'temporary', RDoc::Comment.new('', @top_level)
@context.temporary_section = section
@context.add_to arr, incl
@@ -316,19 +413,30 @@ class TestRDocContext < XrefTestCase
refute_includes arr, incl
end
+ def bench_add_include
+ cm = RDoc::ClassModule.new 'Klass'
+
+ assert_performance_linear 0.9 do |count|
+ count.times do |i|
+ cm.add_include RDoc::Include.new("N::M#{i}", nil)
+ end
+ end
+ end
+
def test_child_name
assert_equal 'C1::C1', @c1.child_name('C1')
end
def test_classes
assert_equal %w[C2::C3], @c2.classes.map { |k| k.full_name }
- assert_equal %w[C3::H1 C3::H2], @c3.classes.map { |k| k.full_name }
+ assert_equal %w[C3::H1 C3::H2], @c3.classes.map { |k| k.full_name }.sort
end
def test_current_section
default_section = @context.current_section
- new_section = @context.add_section 'other', ''
+ new_section =
+ @context.add_section 'other', RDoc::Comment.new('', @top_level)
@context.temporary_section = new_section
assert_equal new_section, @context.current_section
@@ -338,7 +446,7 @@ class TestRDocContext < XrefTestCase
def test_defined_in_eh
assert @c1.defined_in?(@c1.top_level)
- refute @c1.defined_in?(RDoc::TopLevel.new('name.rb'))
+ refute @c1.defined_in?(@store.add_file('name.rb'))
end
def test_equals2
@@ -347,6 +455,10 @@ class TestRDocContext < XrefTestCase
refute_equal @c2_c3, @c3
end
+ def test_each_method_enumerator
+ assert_kind_of @enumerator, @c1.each_method
+ end
+
def test_each_section
sects = []
consts = []
@@ -375,6 +487,10 @@ class TestRDocContext < XrefTestCase
assert_equal expected_attrs, attrs
end
+ def test_each_section_enumerator
+ assert_kind_of @enumerator, @c1.each_section
+ end
+
def test_find_attribute_named
assert_equal nil, @c1.find_attribute_named('none')
assert_equal 'R', @c1.find_attribute_named('attr').rw
@@ -448,6 +564,16 @@ class TestRDocContext < XrefTestCase
assert_equal @c1__m, @c1.find_symbol('::m')
end
+ def test_find_symbol_module
+ assert_nil @m1_m2.find_symbol_module 'N'
+ assert_nil @m1_m2.find_symbol_module 'M2::M1'
+
+ @m1_m2.parent = nil # loaded from legacy ri store
+
+ assert_nil @m1_m2.find_symbol_module 'N'
+ assert_nil @m1_m2.find_symbol_module 'M2::M1'
+ end
+
def test_fully_documented_eh
context = RDoc::Context.new
@@ -573,6 +699,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
@@ -650,14 +785,51 @@ class TestRDocContext < XrefTestCase
assert_equal [@pub, @prot, @priv], methods
end
+ def test_section_contents
+ default = @context.sections.first
+ @context.add_method RDoc::AnyMethod.new(nil, 'm1')
+
+ b = @context.add_section 'B'
+ m = @context.add_method RDoc::AnyMethod.new(nil, 'm2')
+ m.section = b
+
+ assert_equal [default, b], @context.section_contents
+ end
+
+ def test_section_contents_no_default
+ @context = RDoc::Context.new
+ b = @context.add_section 'B'
+ m = @context.add_method RDoc::AnyMethod.new(nil, 'm')
+ m.section = b
+
+ assert_equal [b], @context.section_contents
+ end
+
+ def test_section_contents_only_default
+ @context = RDoc::Context.new
+
+ @context.add_method RDoc::AnyMethod.new(nil, 'm')
+
+ assert_empty @context.section_contents
+ end
+
+ def test_section_contents_unused
+ @context = RDoc::Context.new
+
+ @context.add_method RDoc::AnyMethod.new(nil, 'm')
+ @context.add_section 'B'
+
+ assert_empty @context.section_contents
+ end
+
def test_set_current_section
default_section = @context.sections.first
- @context.set_current_section nil, ''
+ @context.set_current_section nil, RDoc::Comment.new('', @top_level)
assert_equal default_section, @context.current_section
- @context.set_current_section 'other', ''
+ @context.set_current_section 'other', RDoc::Comment.new('', @top_level)
new_section = @context.sections.find { |section|
section != default_section
@@ -666,6 +838,38 @@ class TestRDocContext < XrefTestCase
assert_equal new_section, @context.current_section
end
+ def test_sort_sections
+ c = RDoc::Context.new
+ c.add_section 'C'
+ c.add_section 'A'
+ c.add_section 'B'
+
+ titles = c.sort_sections.map { |section| section.title }
+
+ assert_equal [nil, 'A', 'B', 'C'], titles
+ end
+
+ def test_sort_sections_tomdoc
+ c = RDoc::Context.new
+ c.add_section 'Public'
+ c.add_section 'Internal'
+ c.add_section 'Deprecated'
+
+ titles = c.sort_sections.map { |section| section.title }
+
+ assert_equal [nil, 'Public', 'Internal', 'Deprecated'], titles
+ end
+
+ def test_sort_sections_tomdoc_missing
+ c = RDoc::Context.new
+ c.add_section 'Internal'
+ c.add_section 'Public'
+
+ titles = c.sort_sections.map { |section| section.title }
+
+ assert_equal [nil, 'Public', 'Internal'], titles
+ end
+
def util_visibilities
@pub = RDoc::AnyMethod.new nil, 'pub'
@prot = RDoc::AnyMethod.new nil, 'prot'
diff --git a/test/rdoc/test_rdoc_context_section.rb b/test/rdoc/test_rdoc_context_section.rb
index d37a4d222e..b8f8c7f756 100644
--- a/test/rdoc/test_rdoc_context_section.rb
+++ b/test/rdoc/test_rdoc_context_section.rb
@@ -1,14 +1,42 @@
-require 'rubygems'
-require 'cgi'
-require 'minitest/autorun'
-require 'rdoc'
-require 'rdoc/code_objects'
+require 'rdoc/test_case'
-class TestRDocContextSection < MiniTest::Unit::TestCase
+class TestRDocContextSection < RDoc::TestCase
def setup
+ super
+
+ @top_level = @store.add_file 'file.rb'
+
+ @klass = @top_level.add_class RDoc::NormalClass, 'Object'
+
@S = RDoc::Context::Section
- @s = @S.new nil, 'section', '# comment'
+ @s = @S.new @klass, 'section', comment('# comment', @top_level)
+ end
+
+ def test_add_comment
+ file1 = @store.add_file 'file1.rb'
+
+ klass = file1.add_class RDoc::NormalClass, 'Klass'
+
+ c1 = RDoc::Comment.new "# :section: section\n", file1
+ c2 = RDoc::Comment.new "# hello\n", file1
+ c3 = RDoc::Comment.new "# world\n", file1
+
+ s = @S.new klass, 'section', c1
+
+ assert_empty s.comments
+
+ s.add_comment nil
+
+ assert_empty s.comments
+
+ s.add_comment c2
+
+ assert_equal [c2], s.comments
+
+ s.add_comment c3
+
+ assert_equal [c2, c3], s.comments
end
def test_aref
@@ -19,31 +47,79 @@ class TestRDocContextSection < MiniTest::Unit::TestCase
assert_equal 'one+two', @S.new(nil, 'one two', nil).aref
end
- def test_comment_equals
- @s.comment = "# :section: section\n"
+ def test_extract_comment
+ assert_equal '', @s.extract_comment(comment('')).text
+ assert_equal '', @s.extract_comment(comment("# :section: b\n")).text
+ assert_equal '# c', @s.extract_comment(comment("# :section: b\n# c")).text
+ assert_equal '# c',
+ @s.extract_comment(comment("# a\n# :section: b\n# c")).text
+ end
+
+ def test_marshal_dump
+ loaded = Marshal.load Marshal.dump @s
+
+ expected = RDoc::Comment.new('comment', @top_level).parse
+ expected = doc(expected)
- assert_equal "# comment", @s.comment
+ assert_equal 'section', loaded.title
+ assert_equal expected, loaded.comments
+ assert_nil loaded.parent, 'parent is set manually'
+ end
- @s.comment = "# :section: section\n# other"
+ def test_marshal_dump_no_comment
+ s = @S.new @klass, 'section', comment('')
- assert_equal "# comment\n# ---\n# other", @s.comment
+ loaded = Marshal.load Marshal.dump s
+
+ assert_equal 'section', loaded.title
+ assert_empty loaded.comments
+ assert_nil loaded.parent, 'parent is set manually'
+ end
- s = @S.new nil, nil, nil
+ def test_marshal_load_version_0
+ loaded = Marshal.load "\x04\bU:\eRDoc::Context::Section" +
+ "[\bi\x00I\"\fsection\x06:\x06EFo" +
+ ":\eRDoc::Markup::Document\a:\v@parts" +
+ "[\x06o;\a\a;\b[\x06o" +
+ ":\x1CRDoc::Markup::Paragraph\x06;\b" +
+ "[\x06I\"\fcomment\x06;\x06F:\n@fileI" +
+ "\"\ffile.rb\x06;\x06F;\n0"
- s.comment = "# :section:\n# other"
+ expected = doc RDoc::Comment.new('comment', @top_level).parse
- assert_equal "# other", s.comment
+ assert_equal 'section', loaded.title
+ assert_equal expected, loaded.comments
+ assert_nil loaded.parent, 'parent is set manually'
end
- def test_extract_comment
- assert_equal '', @s.extract_comment('')
- assert_equal '', @s.extract_comment("# :section: b\n")
- assert_equal '# c', @s.extract_comment("# :section: b\n# c")
- assert_equal '# c', @s.extract_comment("# a\n# :section: b\n# c")
+ def test_remove_comment_array
+ other = @store.add_file 'other.rb'
+
+ other_comment = comment('bogus', other)
+
+ @s.add_comment other_comment
+
+ @s.remove_comment comment('bogus', @top_level)
+
+ assert_equal [other_comment], @s.comments
+ end
+
+ def test_remove_comment_document
+ other = @store.add_file 'other.rb'
+
+ other_comment = comment('bogus', other)
+
+ @s.add_comment other_comment
+
+ loaded = Marshal.load Marshal.dump @s
+
+ loaded.remove_comment comment('bogus', @top_level)
+
+ assert_equal doc(other_comment.parse), loaded.comments
end
def test_sequence
- _, err = capture_io do
+ _, err = verbose_capture_io do
assert_match(/\ASEC\d{5}\Z/, @s.sequence)
end
diff --git a/test/rdoc/test_rdoc_cross_reference.rb b/test/rdoc/test_rdoc_cross_reference.rb
index 06062ba125..99fc224d88 100644
--- a/test/rdoc/test_rdoc_cross_reference.rb
+++ b/test/rdoc/test_rdoc_cross_reference.rb
@@ -1,5 +1,3 @@
-require 'rubygems'
-require 'minitest/autorun'
require File.expand_path '../xref_test_case', __FILE__
class TestRDocCrossReference < XrefTestCase
@@ -18,6 +16,15 @@ class TestRDocCrossReference < XrefTestCase
assert_equal name, @xref.resolve(name, name)
end
+ def test_METHOD_REGEXP_STR
+ re = /#{RDoc::CrossReference::METHOD_REGEXP_STR}/
+
+ %w'=== [] []= << >>'.each do |x|
+ re =~ x
+ assert_equal x, $&
+ end
+ end
+
def test_resolve_C2
@xref = RDoc::CrossReference.new @c2
@@ -95,7 +102,7 @@ class TestRDocCrossReference < XrefTestCase
end
def test_resolve_file
- assert_ref @xref_data, 'xref_data.rb'
+ refute_ref 'xref_data.rb'
end
def test_resolve_method
@@ -131,6 +138,37 @@ class TestRDocCrossReference < XrefTestCase
assert_ref @c2_c3_m, '::C2::C3#m(*)'
end
+ def test_resolve_method_equals3
+ m = RDoc::AnyMethod.new '', '==='
+ @c1.add_method m
+
+ assert_ref m, '==='
+ end
+
+ def test_resolve_page
+ page = @store.add_file 'README.txt'
+ page.parser = RDoc::Parser::Simple
+
+ assert_ref page, 'README'
+ end
+
+ def test_resolve_percent
+ i_percent = RDoc::AnyMethod.new nil, '%'
+ i_percent.singleton = false
+ @c1.add_method i_percent
+
+ c_percent = RDoc::AnyMethod.new nil, '%'
+ c_percent.singleton = true
+ @c1.add_method c_percent
+
+ assert_ref i_percent, '%'
+ assert_ref i_percent, '#%'
+ assert_ref c_percent, '::%'
+
+ assert_ref i_percent, 'C1#%'
+ assert_ref c_percent, 'C1::%'
+ end
+
def test_resolve_no_ref
assert_equal '', @xref.resolve('', '')
diff --git a/test/rdoc/test_rdoc_encoding.rb b/test/rdoc/test_rdoc_encoding.rb
index b5ffd7714c..89277585ec 100644
--- a/test/rdoc/test_rdoc_encoding.rb
+++ b/test/rdoc/test_rdoc_encoding.rb
@@ -1,15 +1,12 @@
# coding: US-ASCII
-require 'rubygems'
-require 'minitest/autorun'
-require 'rdoc'
-require 'rdoc/encoding'
+require 'rdoc/test_case'
-require 'tempfile'
-
-class TestRDocEncoding < MiniTest::Unit::TestCase
+class TestRDocEncoding < RDoc::TestCase
def setup
+ super
+
@tempfile = Tempfile.new 'test_rdoc_encoding'
end
@@ -56,7 +53,7 @@ class TestRDocEncoding < MiniTest::Unit::TestCase
contents = :junk
- _, err = capture_io do
+ _, err = verbose_capture_io do
contents = RDoc::Encoding.read_file @tempfile.path, Encoding::US_ASCII
end
@@ -100,6 +97,22 @@ class TestRDocEncoding < MiniTest::Unit::TestCase
assert_equal Encoding::UTF_8, content.encoding
end
+ def test_class_read_file_encoding_invalid
+ skip "Encoding not implemented" unless Object.const_defined? :Encoding
+
+ @tempfile.write "# coding: ascii\nM\xE4r"
+ @tempfile.flush
+
+ contents = :junk
+ _, err = verbose_capture_io do
+ contents = RDoc::Encoding.read_file @tempfile.path, Encoding::UTF_8
+ end
+
+ assert_equal "unable to convert \"\\xE4\" on US-ASCII for #{@tempfile.path}, skipping\n", err
+
+ assert_nil contents
+ end
+
def test_class_read_file_encoding_with_signature
skip "Encoding not implemented" unless defined? ::Encoding
@@ -151,7 +164,7 @@ class TestRDocEncoding < MiniTest::Unit::TestCase
RDoc::Encoding.set_encoding s
- assert_equal "# more comments", s
+ assert_equal "#!/bin/ruby\n# more comments", s
end
def test_class_set_encoding_bad
diff --git a/test/rdoc/test_rdoc_extend.rb b/test/rdoc/test_rdoc_extend.rb
new file mode 100644
index 0000000000..149931549d
--- /dev/null
+++ b/test/rdoc/test_rdoc_extend.rb
@@ -0,0 +1,94 @@
+require File.expand_path '../xref_test_case', __FILE__
+
+class TestRDocExtend < XrefTestCase
+
+ def setup
+ super
+
+ @ext = RDoc::Extend.new 'M1', 'comment'
+ @ext.parent = @m1
+ @ext.store = @store
+ end
+
+ def test_module
+ assert_equal @m1, @ext.module
+ assert_equal 'Unknown', RDoc::Extend.new('Unknown', 'comment').module
+ end
+
+ def test_module_extended
+ m1 = @xref_data.add_module RDoc::NormalModule, 'Mod1'
+ m1.add_module RDoc::NormalModule, 'Mod3'
+ m1_m2 = m1.add_module RDoc::NormalModule, 'Mod2'
+ m1_m2_m3 = m1_m2.add_module RDoc::NormalModule, 'Mod3'
+ m1_m2_m3.add_module RDoc::NormalModule, 'Mod4'
+ m1_m2.add_module RDoc::NormalModule, 'Mod4'
+ m1_m2_k0 = m1_m2.add_class RDoc::NormalClass, 'Klass0'
+ m1_m2_k0_m4 = m1_m2_k0.add_module RDoc::NormalModule, 'Mod4'
+ m1_m2_k0_m4.add_module RDoc::NormalModule, 'Mod6'
+ m1_m2_k0.add_module RDoc::NormalModule, 'Mod5'
+
+ e0_m4 = RDoc::Extend.new 'Mod4', nil
+ e0_m5 = RDoc::Extend.new 'Mod5', nil
+ e0_m6 = RDoc::Extend.new 'Mod6', nil
+ e0_m1 = RDoc::Extend.new 'Mod1', nil
+ e0_m2 = RDoc::Extend.new 'Mod2', nil
+ e0_m3 = RDoc::Extend.new 'Mod3', nil
+
+ m1_m2_k0.add_extend e0_m4
+ m1_m2_k0.add_extend e0_m5
+ m1_m2_k0.add_extend e0_m6
+ m1_m2_k0.add_extend e0_m1
+ m1_m2_k0.add_extend e0_m2
+ m1_m2_k0.add_extend e0_m3
+
+ assert_equal [e0_m4, e0_m5, e0_m6, e0_m1, e0_m2, e0_m3], m1_m2_k0.extends
+ assert_equal ['Object'], m1_m2_k0.ancestors
+
+ m1_k1 = m1.add_class RDoc::NormalClass, 'Klass1'
+
+ e1_m1 = RDoc::Extend.new 'Mod1', nil
+ e1_m2 = RDoc::Extend.new 'Mod2', nil
+ e1_m3 = RDoc::Extend.new 'Mod3', nil
+ e1_m4 = RDoc::Extend.new 'Mod4', nil
+ e1_k0_m4 = RDoc::Extend.new 'Klass0::Mod4', nil
+
+ m1_k1.add_extend e1_m1
+ m1_k1.add_extend e1_m2
+ m1_k1.add_extend e1_m3
+ m1_k1.add_extend e1_m4
+ m1_k1.add_extend e1_k0_m4
+
+ assert_equal [e1_m1, e1_m2, e1_m3, e1_m4, e1_k0_m4], m1_k1.extends
+ assert_equal ['Object'], m1_k1.ancestors
+
+ m1_k2 = m1.add_class RDoc::NormalClass, 'Klass2'
+
+ e2_m1 = RDoc::Extend.new 'Mod1', nil
+ e2_m2 = RDoc::Extend.new 'Mod2', nil
+ e2_m3 = RDoc::Extend.new 'Mod3', nil
+ e2_k0_m4 = RDoc::Extend.new 'Klass0::Mod4', nil
+
+ m1_k2.add_extend e2_m1
+ m1_k2.add_extend e2_m3
+ m1_k2.add_extend e2_m2
+ m1_k2.add_extend e2_k0_m4
+
+ assert_equal [e2_m1, e2_m3, e2_m2, e2_k0_m4], m1_k2.extends
+ assert_equal ['Object'], m1_k2.ancestors
+
+ m1_k3 = m1.add_class RDoc::NormalClass, 'Klass3'
+
+ e3_m1 = RDoc::Extend.new 'Mod1', nil
+ e3_m2 = RDoc::Extend.new 'Mod2', nil
+ e3_m4 = RDoc::Extend.new 'Mod4', nil
+
+ m1_k3.add_extend e3_m1
+ m1_k3.add_extend e3_m2
+ m1_k3.add_extend e3_m4
+
+ assert_equal [e3_m1, e3_m2, e3_m4], m1_k3.extends
+ assert_equal ['Object'], m1_k3.ancestors
+ end
+
+end
+
diff --git a/test/rdoc/test_rdoc_generator_darkfish.rb b/test/rdoc/test_rdoc_generator_darkfish.rb
index faea1ae34a..79c52f0805 100644
--- a/test/rdoc/test_rdoc_generator_darkfish.rb
+++ b/test/rdoc/test_rdoc_generator_darkfish.rb
@@ -1,16 +1,12 @@
-require 'minitest/autorun'
-require 'rdoc/rdoc'
-require 'rdoc/generator/darkfish'
-require 'tmpdir'
-require 'fileutils'
+require 'rdoc/test_case'
-class TestRDocGeneratorDarkfish < MiniTest::Unit::TestCase
+class TestRDocGeneratorDarkfish < RDoc::TestCase
def setup
- @pwd = Dir.pwd
+ super
+
@lib_dir = "#{@pwd}/lib"
$LOAD_PATH.unshift @lib_dir # ensure we load from this RDoc
- RDoc::TopLevel.reset
@options = RDoc::Options.new
@options.option_parser = OptionParser.new
@@ -22,22 +18,27 @@ class TestRDocGeneratorDarkfish < MiniTest::Unit::TestCase
@options.generator = RDoc::Generator::Darkfish
$LOAD_PATH.each do |path|
- darkfish_dir = File.join path, 'rdoc/generator/template/darkfish'
+ darkfish_dir = File.join path, 'rdoc/generator/template/darkfish/'
next unless File.directory? darkfish_dir
@options.template_dir = darkfish_dir
break
end
- rd = RDoc::RDoc.new
- rd.options = @options
- RDoc::RDoc.current = rd
+ @rdoc.options = @options
+
+ @g = @options.generator.new @store, @options
+ @rdoc.generator = @g
- @g = @options.generator.new @options
+ @top_level = @store.add_file 'file.rb'
+ @top_level.parser = RDoc::Parser::Ruby
+ @klass = @top_level.add_class RDoc::NormalClass, 'Klass'
- rd.generator = @g
+ @alias_constant = RDoc::Constant.new 'A', nil, ''
+ @alias_constant.record_location @top_level
- @top_level = RDoc::TopLevel.new 'file.rb'
- @klass = @top_level.add_class RDoc::NormalClass, 'Object'
+ @top_level.add_constant @alias_constant
+
+ @klass.add_module_alias @klass, 'A', @top_level
@meth = RDoc::AnyMethod.new nil, 'method'
@meth_bang = RDoc::AnyMethod.new nil, 'method!'
@@ -49,77 +50,180 @@ class TestRDocGeneratorDarkfish < MiniTest::Unit::TestCase
@ignored = @top_level.add_class RDoc::NormalClass, 'Ignored'
@ignored.ignore
+
+ @store.complete :private
+
+ @object = @store.find_class_or_module 'Object'
+ @klass_alias = @store.find_class_or_module 'Klass::A'
end
def teardown
+ super
+
$LOAD_PATH.shift
Dir.chdir @pwd
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
- top_level = RDoc::TopLevel.new 'file.rb'
+ top_level = @store.add_file 'file.rb'
top_level.add_class @klass.class, @klass.name
- @g.generate [top_level]
+ @g.generate
assert_file 'index.html'
assert_file 'Object.html'
- assert_file 'file_rb.html'
+ 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.default_external.name
+ 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(/<meta content="text\/html; charset=#{encoding}"/,
- File.read('file_rb.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
def test_generate_dry_run
- @options.dry_run = true
- top_level = RDoc::TopLevel.new 'file.rb'
+ @g.dry_run = true
+ top_level = @store.add_file 'file.rb'
top_level.add_class @klass.class, @klass.name
- @g.generate [top_level]
+ @g.generate
refute_file 'index.html'
refute_file 'Object.html'
- refute_file 'file_rb.html'
+ end
+
+ def test_generate_static
+ FileUtils.mkdir_p 'dir/images'
+ FileUtils.touch 'dir/images/image.png'
+ FileUtils.mkdir_p 'file'
+ FileUtils.touch 'file/file.txt'
+
+ @options.static_path = [
+ File.expand_path('dir'),
+ File.expand_path('file/file.txt'),
+ ]
+
+ @g.generate
+
+ assert_file 'images/image.png'
+ assert_file 'file.txt'
+ end
+
+ def test_generate_static_dry_run
+ FileUtils.mkdir 'static'
+ FileUtils.touch 'static/image.png'
+
+ @options.static_path = [File.expand_path('static')]
+ @g.dry_run = true
+
+ @g.generate
+
+ 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
+
+ assert_equal [@klass_alias, @ignored, @klass, @object],
+ @g.classes.sort_by { |klass| klass.full_name }
+ assert_equal [@top_level], @g.files
+ assert_equal [@meth, @meth, @meth_bang, @meth_bang], @g.methods
+ assert_equal [@klass_alias, @klass, @object], @g.modsort
end
def test_template_for
- classpage = Pathname.new @options.template_dir + '/classpage.rhtml'
+ classpage = Pathname.new @options.template_dir + 'class.rhtml'
- template = @g.send(:template_for, classpage)
+ template = @g.send(:template_for, classpage, true, RDoc::ERBIO)
assert_kind_of RDoc::ERBIO, template
assert_same template, @g.send(:template_for, classpage)
end
def test_template_for_dry_run
- classpage = Pathname.new @options.template_dir + '/classpage.rhtml'
+ classpage = Pathname.new @options.template_dir + 'class.rhtml'
- template = @g.send(:template_for, classpage)
+ template = @g.send(:template_for, classpage, true, ERB)
assert_kind_of ERB, template
assert_same template, @g.send(:template_for, classpage)
end
+ def test_template_for_partial
+ partial = Pathname.new @options.template_dir + '_sidebar_classes.rhtml'
+
+ template = @g.send(:template_for, partial, false, RDoc::ERBPartial)
+
+ assert_kind_of RDoc::ERBPartial, template
+
+ 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
new file mode 100644
index 0000000000..214e4a0d91
--- /dev/null
+++ b/test/rdoc/test_rdoc_generator_json_index.rb
@@ -0,0 +1,264 @@
+# coding: US-ASCII
+
+require 'rdoc/test_case'
+
+class TestRDocGeneratorJsonIndex < RDoc::TestCase
+
+ def setup
+ super
+
+ @tmpdir = File.join Dir.tmpdir, "test_rdoc_generator_darkfish_#{$$}"
+ FileUtils.mkdir_p @tmpdir
+
+ @options = RDoc::Options.new
+ @options.files = []
+ # JsonIndex is used in conjunction with another generator
+ @options.setup_generator 'darkfish'
+ @options.template_dir = ''
+ @options.op_dir = @tmpdir
+ @options.option_parser = OptionParser.new
+ @options.finish
+
+ @darkfish = RDoc::Generator::Darkfish.new @store, @options
+ @g = RDoc::Generator::JsonIndex.new @darkfish, @options
+
+ @rdoc.options = @options
+ @rdoc.generator = @g
+
+ @top_level = @store.add_file 'file.rb'
+ @top_level.parser = RDoc::Parser::Ruby
+
+ @klass = @top_level.add_class RDoc::NormalClass, 'C'
+
+ @meth = @klass.add_method RDoc::AnyMethod.new(nil, 'meth')
+ @meth.record_location @top_level
+
+ @nest_klass = @klass.add_class RDoc::NormalClass, 'D'
+ @nest_klass.record_location @top_level
+
+ @nest_meth = @nest_klass.add_method RDoc::AnyMethod.new(nil, 'meth')
+
+ @ignored = @top_level.add_class RDoc::NormalClass, 'Ignored'
+ @ignored.ignore
+
+ @page = @store.add_file 'page.rdoc'
+ @page.parser = RDoc::Parser::Simple
+
+ @top_levels = [@top_level, @page].sort
+ @klasses = [@klass, @nest_klass, @ignored]
+
+ Dir.chdir @tmpdir
+ end
+
+ def teardown
+ super
+
+ Dir.chdir @pwd
+ FileUtils.rm_rf @tmpdir
+ end
+
+ def test_build_index
+ index = @g.build_index
+
+ expected = {
+ :index => {
+ :searchIndex => %w[c d meth() meth() page],
+ :longSearchIndex => %w[c c::d c#meth() c::d#meth()],
+ :info => [
+ @klass.search_record[2..-1],
+ @nest_klass.search_record[2..-1],
+ @meth.search_record[2..-1],
+ @nest_meth.search_record[2..-1],
+ @page.search_record[2..-1],
+ ],
+ },
+ }
+
+ expected[:index][:longSearchIndex] << ''
+
+ assert_equal expected, index
+ end
+
+ def test_class_dir
+ assert_equal @darkfish.class_dir, @g.class_dir
+ end
+
+ def test_file_dir
+ assert_equal @darkfish.file_dir, @g.file_dir
+ end
+
+ def test_generate
+ @g.generate
+
+ assert_file 'js/searcher.js'
+ assert_file 'js/navigation.js'
+ assert_file 'js/search_index.js'
+
+ json = File.read 'js/search_index.js'
+
+ json =~ /\Avar search_data = /
+
+ assignment = $&
+ index = $'
+
+ refute_empty assignment
+
+ index = JSON.parse index
+
+ info = [
+ @klass.search_record[2..-1],
+ @nest_klass.search_record[2..-1],
+ @meth.search_record[2..-1],
+ @nest_meth.search_record[2..-1],
+ @page.search_record[2..-1],
+ ]
+
+ expected = {
+ 'index' => {
+ 'searchIndex' => [
+ 'c',
+ 'd',
+ 'meth()',
+ 'meth()',
+ 'page',
+ ],
+ 'longSearchIndex' => [
+ 'c',
+ 'c::d',
+ 'c#meth()',
+ 'c::d#meth()',
+ '',
+ ],
+ 'info' => info,
+ },
+ }
+
+ assert_equal expected, index
+ end
+
+ def test_generate_utf_8
+ skip "Encoding not implemented" unless Object.const_defined? :Encoding
+
+ text = "5\xB0"
+ text.force_encoding Encoding::ISO_8859_1
+ @klass.add_comment comment(text), @top_level
+
+ @g.generate
+
+ json = File.read 'js/search_index.js'
+ json.force_encoding Encoding::UTF_8
+
+ json =~ /\Avar search_data = /
+
+ index = $'
+
+ index = JSON.parse index
+
+ klass_record = @klass.search_record[2..-1]
+ klass_record[-1] = "<p>5\xc2\xb0\n"
+ klass_record.last.force_encoding Encoding::UTF_8
+
+ info = [
+ klass_record,
+ @nest_klass.search_record[2..-1],
+ @meth.search_record[2..-1],
+ @nest_meth.search_record[2..-1],
+ @page.search_record[2..-1],
+ ]
+
+ expected = {
+ 'index' => {
+ 'searchIndex' => [
+ 'c',
+ 'd',
+ 'meth()',
+ 'meth()',
+ 'page',
+ ],
+ 'longSearchIndex' => [
+ 'c',
+ 'c::d',
+ 'c#meth()',
+ 'c::d#meth()',
+ '',
+ ],
+ 'info' => info,
+ },
+ }
+
+ assert_equal expected, index
+ end
+
+ def test_index_classes
+ @g.reset @top_levels, @klasses
+
+ @g.index_classes
+
+ expected = {
+ :searchIndex => %w[c d],
+ :longSearchIndex => %w[c c::d],
+ :info => [
+ @klass.search_record[2..-1],
+ @nest_klass.search_record[2..-1],
+ ],
+ }
+
+ assert_equal expected, @g.index
+ end
+
+ def test_index_classes_nodoc
+ @klass.document_self = false
+ @nest_klass.document_self = false
+ @meth.document_self = false
+ @nest_meth.document_self = false
+
+ @g.reset @top_levels, @klasses
+
+ @g.index_classes
+
+ expected = {
+ :searchIndex => [],
+ :longSearchIndex => [],
+ :info => [],
+ }
+
+ assert_equal expected, @g.index
+ end
+
+ def test_index_methods
+ @g.reset @top_levels, @klasses
+
+ @g.index_methods
+
+ expected = {
+ :searchIndex => %w[meth() meth()],
+ :longSearchIndex => %w[c#meth() c::d#meth()],
+ :info => [
+ @meth.search_record[2..-1],
+ @nest_meth.search_record[2..-1],
+ ],
+ }
+
+ assert_equal expected, @g.index
+ end
+
+ def test_index_pages
+ @g.reset @top_levels, @klasses
+
+ @g.index_pages
+
+ expected = {
+ :searchIndex => %w[page],
+ :longSearchIndex => [''],
+ :info => [@page.search_record[2..-1]],
+ }
+
+ assert_equal expected, @g.index
+ end
+
+ def test_search_string
+ assert_equal 'cd', @g.search_string('C d')
+ end
+
+end
+
diff --git a/test/rdoc/test_rdoc_generator_markup.rb b/test/rdoc/test_rdoc_generator_markup.rb
new file mode 100644
index 0000000000..b3b5c04588
--- /dev/null
+++ b/test/rdoc/test_rdoc_generator_markup.rb
@@ -0,0 +1,59 @@
+require 'rdoc/test_case'
+
+class TestRDocGeneratorMarkup < RDoc::TestCase
+
+ include RDoc::Text
+ include RDoc::Generator::Markup
+
+ attr_reader :store
+
+ def setup
+ super
+
+ @options = RDoc::Options.new
+ @rdoc.options = @options
+
+ @parent = self
+ @path = '/index.html'
+ @symbols = {}
+ end
+
+ def test_aref_to
+ assert_equal 'Foo/Bar.html', aref_to('Foo/Bar.html')
+ end
+
+ def test_as_href
+ assert_equal '../index.html', as_href('Foo/Bar.html')
+ end
+
+ def test_cvs_url
+ assert_equal 'http://example/this_page',
+ cvs_url('http://example/', 'this_page')
+
+ assert_equal 'http://example/?page=this_page&foo=bar',
+ cvs_url('http://example/?page=%s&foo=bar', 'this_page')
+ end
+
+ def test_description
+ @comment = '= Hello'
+
+ links = '<span><a href="#label-Hello">&para;</a> ' +
+ '<a href="#documentation">&uarr;</a></span>'
+
+ assert_equal "\n<h1 id=\"label-Hello\">Hello#{links}</h1>\n", description
+ end
+
+ def test_formatter
+ assert_kind_of RDoc::Markup::ToHtmlCrossref, formatter
+ refute formatter.show_hash
+ assert_same self, formatter.context
+ end
+
+ attr_reader :path
+
+ def find_symbol name
+ @symbols[name]
+ end
+
+end
+
diff --git a/test/rdoc/test_rdoc_generator_ri.rb b/test/rdoc/test_rdoc_generator_ri.rb
index 2be006843c..f8ac97337d 100644
--- a/test/rdoc/test_rdoc_generator_ri.rb
+++ b/test/rdoc/test_rdoc_generator_ri.rb
@@ -1,26 +1,22 @@
-require 'rubygems'
-require 'minitest/autorun'
-require 'rdoc/rdoc'
-require 'rdoc/generator/ri'
-require 'tmpdir'
-require 'fileutils'
+require 'rdoc/test_case'
-class TestRDocGeneratorRI < MiniTest::Unit::TestCase
+class TestRDocGeneratorRI < RDoc::TestCase
def setup
- @options = RDoc::Options.new
- @options.encoding = Encoding::UTF_8 if Object.const_defined? :Encoding
+ super
- @pwd = Dir.pwd
- RDoc::TopLevel.reset
+ @options = RDoc::Options.new
+ if Object.const_defined? :Encoding then
+ @options.encoding = Encoding::UTF_8
+ @store.encoding = Encoding::UTF_8
+ end
@tmpdir = File.join Dir.tmpdir, "test_rdoc_generator_ri_#{$$}"
FileUtils.mkdir_p @tmpdir
- Dir.chdir @tmpdir
- @g = RDoc::Generator::RI.new @options
+ @g = RDoc::Generator::RI.new @store, @options
- @top_level = RDoc::TopLevel.new 'file.rb'
+ @top_level = @store.add_file 'file.rb'
@klass = @top_level.add_class RDoc::NormalClass, 'Object'
@meth = RDoc::AnyMethod.new nil, 'method'
@@ -35,23 +31,19 @@ class TestRDocGeneratorRI < MiniTest::Unit::TestCase
@klass.add_method @meth
@klass.add_method @meth_bang
@klass.add_attribute @attr
+
+ Dir.chdir @tmpdir
end
def teardown
+ super
+
Dir.chdir @pwd
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 nil
+ @g.generate
assert_file File.join(@tmpdir, 'cache.ri')
@@ -70,16 +62,15 @@ class TestRDocGeneratorRI < MiniTest::Unit::TestCase
end
def test_generate_dry_run
- @options.dry_run = true
- @g = RDoc::Generator::RI.new @options
+ @store.dry_run = true
+ @g = RDoc::Generator::RI.new @store, @options
- top_level = RDoc::TopLevel.new 'file.rb'
+ top_level = @store.add_file 'file.rb'
top_level.add_class @klass.class, @klass.name
- @g.generate nil
+ @g.generate
refute_file File.join(@tmpdir, 'cache.ri')
-
refute_file File.join(@tmpdir, 'Object')
end
diff --git a/test/rdoc/test_rdoc_include.rb b/test/rdoc/test_rdoc_include.rb
index 71eaf9abf8..464a698018 100644
--- a/test/rdoc/test_rdoc_include.rb
+++ b/test/rdoc/test_rdoc_include.rb
@@ -7,6 +7,8 @@ class TestRDocInclude < XrefTestCase
@inc = RDoc::Include.new 'M1', 'comment'
@inc.parent = @m1
+ @inc.record_location @top_level
+ @inc.store = @store
end
def test_module
@@ -92,5 +94,15 @@ class TestRDocInclude < XrefTestCase
assert_equal [m1_m2_m4, m1_m2, m1, 'Object'], m1_k3.ancestors
end
+ def test_store_equals
+ incl = RDoc::Include.new 'M', nil
+ incl.record_location RDoc::TopLevel.new @top_level.name
+
+ incl.store = @store
+
+ assert_same @top_level, incl.file
+ assert_same @store, incl.file.store
+ end
+
end
diff --git a/test/rdoc/test_rdoc_markdown.rb b/test/rdoc/test_rdoc_markdown.rb
new file mode 100644
index 0000000000..ea5dc73387
--- /dev/null
+++ b/test/rdoc/test_rdoc_markdown.rb
@@ -0,0 +1,980 @@
+# coding: UTF-8
+
+require 'rdoc/test_case'
+require 'rdoc/markup/block_quote'
+require 'rdoc/markdown'
+
+class TestRDocMarkdown < RDoc::TestCase
+
+ def setup
+ @RM = RDoc::Markup
+
+ @parser = RDoc::Markdown.new
+
+ @to_html = RDoc::Markup::ToHtml.new(RDoc::Options.new, nil)
+ end
+
+ def test_class_parse
+ doc = RDoc::Markdown.parse "hello\n\nworld"
+
+ expected = doc(para("hello"), para("world"))
+
+ assert_equal expected, doc
+ end
+
+ def test_emphasis
+ assert_equal '_word_', @parser.emphasis('word')
+ assert_equal '<em>two words</em>', @parser.emphasis('two words')
+ assert_equal '<em>*bold*</em>', @parser.emphasis('*bold*')
+ end
+
+ def test_parse_auto_link_email
+ doc = parse "Autolink: <nobody-0+_./!%~$@example>"
+
+ expected = doc(para("Autolink: mailto:nobody-0+_./!%~$@example"))
+
+ assert_equal expected, doc
+ end
+
+ def test_parse_auto_link_url
+ doc = parse "Autolink: <http://example>"
+
+ expected = doc(para("Autolink: http://example"))
+
+ assert_equal expected, doc
+ end
+
+ def test_parse_block_quote
+ doc = parse <<-BLOCK_QUOTE
+> this is
+> a block quote
+ BLOCK_QUOTE
+
+ expected =
+ doc(
+ block(
+ para("this is\na block quote")))
+
+ assert_equal expected, doc
+ end
+
+ def test_parse_block_quote_continue
+ doc = parse <<-BLOCK_QUOTE
+> this is
+a block quote
+ BLOCK_QUOTE
+
+ expected =
+ doc(
+ block(
+ para("this is\na block quote")))
+
+ assert_equal expected, doc
+ end
+
+ def test_parse_block_quote_list
+ doc = parse <<-BLOCK_QUOTE
+> text
+>
+> * one
+> * two
+ BLOCK_QUOTE
+
+ expected =
+ doc(
+ block(
+ para("text"),
+ list(:BULLET,
+ item(nil, para("one")),
+ item(nil, para("two")))))
+
+ assert_equal expected, doc
+ end
+
+ def test_parse_block_quote_newline
+ doc = parse <<-BLOCK_QUOTE
+> this is
+a block quote
+
+ BLOCK_QUOTE
+
+ expected =
+ doc(
+ block(
+ para("this is\na block quote")))
+
+ assert_equal expected, doc
+ end
+
+ def test_parse_block_quote_separate
+ doc = parse <<-BLOCK_QUOTE
+> this is
+a block quote
+
+> that continues
+ BLOCK_QUOTE
+
+ expected =
+ doc(
+ block(
+ para("this is\na block quote"),
+ para("that continues")))
+
+ assert_equal expected, doc
+ end
+
+ def test_parse_char_entity
+ doc = parse '&pi; &nn;'
+
+ expected = doc(para('Ï€ &nn;'))
+
+ assert_equal expected, doc
+ end
+
+ def test_parse_code
+ doc = parse "Code: `text`"
+
+ expected = doc(para("Code: <code>text</code>"))
+
+ assert_equal expected, doc
+ end
+
+ def test_parse_code_github
+ doc = parse <<-MD
+Example:
+
+```
+code goes here
+```
+ MD
+
+ expected =
+ doc(
+ para("Example:"),
+ verb("code goes here\n"))
+
+ assert_equal expected, doc
+ end
+
+ def test_parse_code_github_format
+ doc = parse <<-MD
+Example:
+
+``` ruby
+code goes here
+```
+ MD
+
+ code = verb("code goes here\n")
+ code.format = :ruby
+
+ expected =
+ doc(
+ para("Example:"),
+ code)
+
+ assert_equal expected, doc
+ end
+
+ def test_parse_definition_list
+ doc = parse <<-MD
+one
+: This is a definition
+
+two
+: This is another definition
+ MD
+
+ expected = doc(
+ list(:NOTE,
+ item(%w[one], para("This is a definition")),
+ item(%w[two], para("This is another definition"))))
+
+ assert_equal expected, doc
+ end
+
+ def test_parse_definition_list_indents
+ doc = parse <<-MD
+zero
+: Indented zero characters
+
+one
+ : Indented one characters
+
+two
+ : Indented two characters
+
+three
+ : Indented three characters
+
+four
+ : Indented four characters
+
+ MD
+
+ expected = doc(
+ list(:NOTE,
+ item(%w[zero], para("Indented zero characters")),
+ item(%w[one], para("Indented one characters")),
+ item(%w[two], para("Indented two characters")),
+ item(%w[three], para("Indented three characters"))),
+ para("four\n : Indented four characters"))
+
+ assert_equal expected, doc
+ end
+
+ def test_parse_definition_list_multi_description
+ doc = parse <<-MD
+label
+: This is a definition
+
+: This is another definition
+ MD
+
+ expected = doc(
+ list(:NOTE,
+ item(%w[label], para("This is a definition")),
+ item(nil, para("This is another definition"))))
+
+ assert_equal expected, doc
+ end
+
+ def test_parse_definition_list_multi_label
+ doc = parse <<-MD
+one
+two
+: This is a definition
+ MD
+
+ expected = doc(
+ list(:NOTE,
+ item(%w[one two], para("This is a definition"))))
+
+ assert_equal expected, doc
+ end
+
+ def test_parse_definition_list_multi_line
+ doc = parse <<-MD
+one
+: This is a definition
+that extends to two lines
+
+two
+: This is another definition
+that also extends to two lines
+ MD
+
+ expected = doc(
+ list(:NOTE,
+ item(%w[one],
+ para("This is a definition\nthat extends to two lines")),
+ item(%w[two],
+ para("This is another definition\nthat also extends to two lines"))))
+
+ assert_equal expected, doc
+ end
+
+ def test_parse_definition_list_no
+ @parser.definition_lists = false
+
+ doc = parse <<-MD
+one
+: This is a definition
+
+two
+: This is another definition
+ MD
+
+ expected = doc(
+ para("one\n: This is a definition"),
+ para("two\n: This is another definition"))
+
+ assert_equal expected, doc
+ end
+
+ def test_parse_entity_dec
+ doc = parse "Entity: &#65;"
+
+ expected = doc(para("Entity: A"))
+
+ assert_equal expected, doc
+ end
+
+ def test_parse_entity_hex
+ doc = parse "Entity: &#x41;"
+
+ expected = doc(para("Entity: A"))
+
+ assert_equal expected, doc
+ end
+
+ def test_parse_entity_named
+ doc = parse "Entity: &pi;"
+
+ expected = doc(para("Entity: π"))
+
+ assert_equal expected, doc
+ end
+
+ def test_parse_emphasis_star
+ doc = parse "it *works*\n"
+
+ expected = @RM::Document.new(
+ @RM::Paragraph.new("it _works_"))
+
+ assert_equal expected, doc
+ end
+
+ def test_parse_emphasis_underscore
+ doc = parse "it _works_\n"
+
+ expected =
+ doc(
+ para("it _works_"))
+
+ assert_equal expected, doc
+ end
+
+ def test_parse_emphasis_underscore_embedded
+ doc = parse "foo_bar bar_baz\n"
+
+ expected =
+ doc(
+ para("foo_bar bar_baz"))
+
+ assert_equal expected, doc
+ end
+
+ def test_parse_emphasis_underscore_in_word
+ doc = parse "it foo_bar_baz\n"
+
+ expected =
+ doc(
+ para("it foo_bar_baz"))
+
+ assert_equal expected, doc
+ end
+
+ def test_parse_escape
+ assert_equal doc(para("Backtick: `")), parse("Backtick: \\`")
+
+ assert_equal doc(para("Backslash: \\")), parse("Backslash: \\\\")
+
+ assert_equal doc(para("Colon: :")), parse("Colon: \\:")
+ end
+
+ def test_parse_heading_atx
+ doc = parse "# heading\n"
+
+ expected = @RM::Document.new(
+ @RM::Heading.new(1, "heading"))
+
+ assert_equal expected, doc
+ end
+
+ def test_parse_heading_setext_dash
+ doc = parse <<-MD
+heading
+---
+ MD
+
+ expected = @RM::Document.new(
+ @RM::Heading.new(2, "heading"))
+
+ assert_equal expected, doc
+ end
+
+ def test_parse_heading_setext_equals
+ doc = parse <<-MD
+heading
+===
+ MD
+
+ expected = @RM::Document.new(
+ @RM::Heading.new(1, "heading"))
+
+ assert_equal expected, doc
+ end
+
+ def test_parse_html
+ @parser.html = true
+
+ doc = parse "<address>Links here</address>\n"
+
+ expected = doc(
+ @RM::Raw.new("<address>Links here</address>"))
+
+ assert_equal expected, doc
+ end
+
+ def test_parse_html_hr
+ @parser.html = true
+
+ doc = parse "<hr>\n"
+
+ expected = doc(raw("<hr>"))
+
+ assert_equal expected, doc
+ end
+
+ def test_parse_html_no_html
+ @parser.html = false
+
+ doc = parse "<address>Links here</address>\n"
+
+ expected = doc()
+
+ assert_equal expected, doc
+ end
+
+ def test_parse_image
+ doc = parse "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
+
+ def test_parse_line_break
+ doc = parse "Some text \nwith extra lines"
+
+ expected = doc(
+ para("Some text", hard_break, "with extra lines"))
+
+ assert_equal expected, doc
+ end
+
+ def test_parse_link_reference_id
+ doc = parse <<-MD
+This is [an example][id] reference-style link.
+
+[id]: http://example.com "Optional Title Here"
+ MD
+
+ expected = doc(
+ para("This is {an example}[http://example.com] reference-style link."))
+
+ assert_equal expected, doc
+ end
+
+ def test_parse_link_reference_id_adjacent
+ doc = parse <<-MD
+[this] [this] should work
+
+[this]: example
+ MD
+
+ expected = doc(
+ para("{this}[example] should work"))
+
+ assert_equal expected, doc
+ end
+
+ def test_parse_link_reference_id_eof
+ doc = parse <<-MD.chomp
+This is [an example][id] reference-style link.
+
+[id]: http://example.com "Optional Title Here"
+ MD
+
+ expected = doc(
+ para("This is {an example}[http://example.com] reference-style link."))
+
+ assert_equal expected, doc
+ end
+
+ def test_parse_link_reference_id_many
+ doc = parse <<-MD
+This is [an example][id] reference-style link.
+
+And [another][id].
+
+[id]: http://example.com "Optional Title Here"
+ MD
+
+ expected = doc(
+ para("This is {an example}[http://example.com] reference-style link."),
+ para("And {another}[http://example.com]."))
+
+ assert_equal expected, doc
+ end
+
+ def test_parse_link_reference_implicit
+ doc = parse <<-MD
+This is [an example][] reference-style link.
+
+[an example]: http://example.com "Optional Title Here"
+ MD
+
+ expected = doc(
+ para("This is {an example}[http://example.com] reference-style link."))
+
+ assert_equal expected, doc
+ end
+
+ def test_parse_list_bullet
+ doc = parse <<-MD
+* one
+* two
+ MD
+
+ expected = doc(
+ list(:BULLET,
+ item(nil, para("one")),
+ item(nil, para("two"))))
+
+ assert_equal expected, doc
+ end
+
+ def test_parse_list_bullet_auto_link
+ doc = parse <<-MD
+* <http://example/>
+ MD
+
+ expected = doc(
+ list(:BULLET,
+ item(nil, para("http://example/"))))
+
+ assert_equal expected, doc
+ end
+
+ def test_parse_list_bullet_continue
+ doc = parse <<-MD
+* one
+
+* two
+ MD
+
+ expected = doc(
+ list(:BULLET,
+ item(nil, para("one")),
+ item(nil, para("two"))))
+
+ assert_equal expected, doc
+ end
+
+ def test_parse_list_bullet_multiline
+ doc = parse <<-MD
+* one
+ two
+ MD
+
+ expected = doc(
+ list(:BULLET,
+ item(nil, para("one\n two"))))
+
+ assert_equal expected, doc
+ end
+
+ def test_parse_list_bullet_nest
+ doc = parse <<-MD
+* outer
+ * inner
+ MD
+
+ expected = doc(
+ list(:BULLET,
+ item(nil,
+ para("outer"),
+ list(:BULLET,
+ item(nil,
+ para("inner"))))))
+
+ assert_equal expected, doc
+ end
+
+ def test_parse_list_bullet_nest_loose
+ doc = parse <<-MD
+* outer
+
+ * inner
+ MD
+
+ expected = doc(
+ list(:BULLET,
+ item(nil,
+ para("outer"),
+ list(:BULLET,
+ item(nil, para("inner"))))))
+
+ assert_equal expected, doc
+ end
+
+ def test_parse_list_bullet_nest_continue
+ doc = parse <<-MD
+* outer
+ * inner
+ continue inner
+* outer 2
+ MD
+
+ expected = doc(
+ list(:BULLET,
+ item(nil,
+ para("outer"),
+ list(:BULLET,
+ item(nil,
+ para("inner\n continue inner")))),
+ item(nil,
+ para("outer 2"))))
+
+ assert_equal expected, doc
+ end
+
+ def test_parse_list_number
+ doc = parse <<-MD
+1. one
+1. two
+ MD
+
+ expected = doc(
+ list(:NUMBER,
+ item(nil, para("one")),
+ item(nil, para("two"))))
+
+ assert_equal expected, doc
+ end
+
+ def test_parse_list_number_continue
+ doc = parse <<-MD
+1. one
+
+1. two
+ MD
+
+ expected = doc(
+ list(:NUMBER,
+ item(nil, para("one")),
+ item(nil, para("two"))))
+
+ assert_equal expected, doc
+ end
+
+ def test_parse_note
+ @parser.notes = true
+
+ doc = parse <<-MD
+Some text.[^1]
+
+[^1]: With a footnote
+ MD
+
+ expected = doc(
+ para("Some text.{*1}[rdoc-label:foottext-1:footmark-1]"),
+ @RM::Rule.new(1),
+ para("{^1}[rdoc-label:footmark-1:foottext-1] With a footnote"))
+
+ assert_equal expected, doc
+ end
+
+ def test_parse_note_indent
+ @parser.notes = true
+
+ doc = parse <<-MD
+Some text.[^1]
+
+[^1]: With a footnote
+
+ more
+ MD
+
+ expected = doc(
+ para("Some text.{*1}[rdoc-label:foottext-1:footmark-1]"),
+ rule(1),
+ para("{^1}[rdoc-label:footmark-1:foottext-1] With a footnote\n\nmore"))
+
+ assert_equal expected, doc
+ end
+
+ def test_parse_note_inline
+ @parser.notes = true
+
+ doc = parse <<-MD
+Some text. ^[With a footnote]
+ MD
+
+ expected = doc(
+ para("Some text. {*1}[rdoc-label:foottext-1:footmark-1]"),
+ @RM::Rule.new(1),
+ para("{^1}[rdoc-label:footmark-1:foottext-1] With a footnote"))
+
+ assert_equal expected, doc
+ end
+
+ def test_parse_note_no_notes
+ @parser.notes = false
+
+ assert_raises RuntimeError do # TODO use a real error
+ parse "Some text.[^1]"
+ end
+ end
+
+ def test_parse_note_multiple
+ @parser.notes = true
+
+ doc = parse <<-MD
+Some text[^1]
+with inline notes^[like this]
+and an extra note.[^2]
+
+[^1]: With a footnote
+
+[^2]: Which should be numbered correctly
+ MD
+
+ expected = doc(
+ para("Some text{*1}[rdoc-label:foottext-1:footmark-1]\n" +
+ "with inline notes{*2}[rdoc-label:foottext-2:footmark-2]\n" +
+ "and an extra note.{*3}[rdoc-label:foottext-3:footmark-3]"),
+
+ rule(1),
+
+ para("{^1}[rdoc-label:footmark-1:foottext-1] With a footnote"),
+ para("{^2}[rdoc-label:footmark-2:foottext-2] like this"),
+ para("{^3}[rdoc-label:footmark-3:foottext-3] " +
+ "Which should be numbered correctly"))
+
+ assert_equal expected, doc
+ end
+
+ def test_parse_paragraph
+ doc = parse "it worked\n"
+
+ expected = doc(para("it worked"))
+
+ assert_equal expected, doc
+ end
+
+ def test_parse_paragraph_break_on_newline
+ @parser.break_on_newline = true
+
+ doc = parse "one\ntwo\n"
+
+ expected = doc(para("one", hard_break, "two"))
+
+ assert_equal expected, doc
+
+ doc = parse "one \ntwo\nthree\n"
+
+ expected = doc(para("one", hard_break, "two", hard_break, "three"))
+
+ assert_equal expected, doc
+ end
+
+ def test_parse_paragraph_stars
+ doc = parse "it worked ****\n"
+
+ expected = @RM::Document.new(
+ @RM::Paragraph.new("it worked ****"))
+
+ assert_equal expected, doc
+ end
+
+ def test_parse_paragraph_html
+ @parser.html = true
+
+ doc = parse "<address>Links here</address>"
+
+ expected = doc(raw("<address>Links here</address>"))
+
+ assert_equal expected, doc
+ end
+
+ def test_parse_paragraph_html_no_html
+ @parser.html = false
+
+ doc = parse "<address>Links here</address>"
+
+ expected = doc()
+
+ assert_equal expected, doc
+ end
+
+ def test_parse_paragraph_indent_one
+ doc = parse <<-MD
+ text
+ MD
+
+ expected = doc(para("text"))
+
+ assert_equal expected, doc
+ end
+
+ def test_parse_paragraph_indent_two
+ doc = parse <<-MD
+ text
+ MD
+
+ expected = doc(para("text"))
+
+ assert_equal expected, doc
+ end
+
+ def test_parse_paragraph_indent_three
+ doc = parse <<-MD
+ text
+ MD
+
+ expected = doc(para("text"))
+
+ assert_equal expected, doc
+ end
+
+ def test_parse_paragraph_multiline
+ doc = parse "one\ntwo"
+
+ expected = doc(para("one\ntwo"))
+
+ assert_equal expected, doc
+ end
+
+ def test_parse_paragraph_two
+ doc = parse "one\n\ntwo"
+
+ expected = @RM::Document.new(
+ @RM::Paragraph.new("one"),
+ @RM::Paragraph.new("two"))
+
+ assert_equal expected, doc
+ end
+
+ def test_parse_plain
+ doc = parse "it worked"
+
+ expected = @RM::Document.new(
+ @RM::Paragraph.new("it worked"))
+
+ assert_equal expected, doc
+ end
+
+ def test_parse_reference_link_embedded_bracket
+ doc = parse "With [embedded [brackets]] [b].\n\n[b]: /url/\n"
+
+ expected =
+ doc(
+ para("With {embedded [brackets]}[/url/]."))
+
+ assert_equal expected, doc
+ end
+
+ def test_parse_rule_dash
+ doc = parse "- - -\n\n"
+
+ expected = @RM::Document.new(@RM::Rule.new(1))
+
+ assert_equal expected, doc
+ end
+
+ def test_parse_rule_underscore
+ doc = parse "_ _ _\n\n"
+
+ expected = @RM::Document.new(@RM::Rule.new(1))
+
+ assert_equal expected, doc
+ end
+
+ def test_parse_rule_star
+ doc = parse "* * *\n\n"
+
+ expected = @RM::Document.new(@RM::Rule.new(1))
+
+ assert_equal expected, doc
+ end
+
+ def test_parse_strong_star
+ doc = parse "it **works**\n"
+
+ expected = @RM::Document.new(
+ @RM::Paragraph.new("it *works*"))
+
+ assert_equal expected, doc
+ end
+
+ def test_parse_strong_underscore
+ doc = parse "it __works__\n"
+
+ expected = @RM::Document.new(
+ @RM::Paragraph.new("it *works*"))
+
+ assert_equal expected, doc
+ end
+
+ def test_parse_strong_emphasis_star
+ doc = parse "it ***works***\n"
+
+ expected = @RM::Document.new(
+ @RM::Paragraph.new("it <b>_works_</b>"))
+
+ assert_equal expected, doc
+ end
+
+ def test_parse_strong_emphasis_underscore
+ doc = parse "it ___works___\n"
+
+ expected = @RM::Document.new(
+ @RM::Paragraph.new("it <b>_works_</b>"))
+
+ assert_equal expected, doc
+ end
+
+ def test_parse_style
+ @parser.css = true
+
+ doc = parse "<style>h1 { color: red }</style>\n"
+
+ expected = doc(
+ @RM::Raw.new("<style>h1 { color: red }</style>"))
+
+ assert_equal expected, doc
+ end
+
+ def test_parse_style_disabled
+ doc = parse "<style>h1 { color: red }</style>\n"
+
+ expected = doc()
+
+ assert_equal expected, doc
+ end
+
+ def test_parse_verbatim
+ doc = parse <<-MD
+ text
+ MD
+
+ expected = doc(verb("text\n"))
+
+ assert_equal expected, doc
+ end
+
+ def test_parse_verbatim_eof
+ doc = parse " text"
+
+ expected = doc(verb("text\n"))
+
+ assert_equal expected, doc
+ end
+
+ def test_strong
+ assert_equal '*word*', @parser.strong('word')
+ assert_equal '<b>two words</b>', @parser.strong('two words')
+ assert_equal '<b>_emphasis_</b>', @parser.strong('_emphasis_')
+ end
+
+ def parse text
+ @parser.parse text
+ end
+
+end
+
diff --git a/test/rdoc/test_rdoc_markdown_test.rb b/test/rdoc/test_rdoc_markdown_test.rb
new file mode 100644
index 0000000000..d464cba263
--- /dev/null
+++ b/test/rdoc/test_rdoc_markdown_test.rb
@@ -0,0 +1,1884 @@
+require 'rubygems'
+require 'minitest/autorun'
+require 'pp'
+
+require 'rdoc'
+require 'rdoc/markdown'
+
+class TestRDocMarkdownTest < RDoc::TestCase
+
+ MARKDOWN_TEST_PATH = File.expand_path '../MarkdownTest_1.0.3/', __FILE__
+
+ def setup
+ super
+
+ @parser = RDoc::Markdown.new
+ end
+
+ def test_amps_and_angle_encoding
+ input = File.read "#{MARKDOWN_TEST_PATH}/Amps and angle encoding.text"
+
+ doc = @parser.parse input
+
+ expected =
+ doc(
+ para("AT&T has an ampersand in their name."),
+ para("AT&T is another way to write it."),
+ para("This & that."),
+ para("4 < 5."),
+ para("6 > 5."),
+ para("Here's a {link}[http://example.com/?foo=1&bar=2] with " +
+ "an ampersand in the URL."),
+ para("Here's a link with an amersand in the link text: " +
+ "{AT&T}[http://att.com/]."),
+ para("Here's an inline {link}[/script?foo=1&bar=2]."),
+ para("Here's an inline {link}[/script?foo=1&bar=2]."))
+
+ assert_equal expected, doc
+ end
+
+ def test_auto_links
+ input = File.read "#{MARKDOWN_TEST_PATH}/Auto links.text"
+
+ doc = @parser.parse input
+
+ # TODO verify rdoc auto-links too
+ expected =
+ doc(
+ para("Link: http://example.com/."),
+ para("With an ampersand: http://example.com/?foo=1&bar=2"),
+ list(:BULLET,
+ item(nil, para("In a list?")),
+ item(nil, para("http://example.com/")),
+ item(nil, para("It should."))),
+ block(
+ para("Blockquoted: http://example.com/")),
+ para("Auto-links should not occur here: " +
+ "<code><http://example.com/></code>"),
+ verb("or here: <http://example.com/>\n"))
+
+ assert_equal expected, doc
+ end
+
+ def test_backslash_escapes
+ input = File.read "#{MARKDOWN_TEST_PATH}/Backslash escapes.text"
+
+ doc = @parser.parse input
+
+ expected =
+ doc(
+ para("These should all get escaped:"),
+
+ para("Backslash: \\"),
+ para("Backtick: `"),
+ para("Asterisk: *"),
+ para("Underscore: _"),
+ para("Left brace: {"),
+ para("Right brace: }"),
+ para("Left bracket: ["),
+ para("Right bracket: ]"),
+ para("Left paren: ("),
+ para("Right paren: )"),
+ para("Greater-than: >"),
+ para("Hash: #"),
+ para("Period: ."),
+ para("Bang: !"),
+ para("Plus: +"),
+ para("Minus: -"),
+
+ para("These should not, because they occur within a code block:"),
+
+ verb("Backslash: \\\\\n",
+ "\n",
+ "Backtick: \\`\n",
+ "\n",
+ "Asterisk: \\*\n",
+ "\n",
+ "Underscore: \\_\n",
+ "\n",
+ "Left brace: \\{\n",
+ "\n",
+ "Right brace: \\}\n",
+ "\n",
+ "Left bracket: \\[\n",
+ "\n",
+ "Right bracket: \\]\n",
+ "\n",
+ "Left paren: \\(\n",
+ "\n",
+ "Right paren: \\)\n",
+ "\n",
+ "Greater-than: \\>\n",
+ "\n",
+ "Hash: \\#\n",
+ "\n",
+ "Period: \\.\n",
+ "\n",
+ "Bang: \\!\n",
+ "\n",
+ "Plus: \\+\n",
+ "\n",
+ "Minus: \\-\n"),
+
+ para("Nor should these, which occur in code spans:"),
+
+ para("Backslash: <code>\\\\</code>"),
+ para("Backtick: <code>\\`</code>"),
+ para("Asterisk: <code>\\*</code>"),
+ para("Underscore: <code>\\_</code>"),
+ para("Left brace: <code>\\{</code>"),
+ para("Right brace: <code>\\}</code>"),
+ para("Left bracket: <code>\\[</code>"),
+ para("Right bracket: <code>\\]</code>"),
+ para("Left paren: <code>\\(</code>"),
+ para("Right paren: <code>\\)</code>"),
+ para("Greater-than: <code>\\></code>"),
+ para("Hash: <code>\\#</code>"),
+ para("Period: <code>\\.</code>"),
+ para("Bang: <code>\\!</code>"),
+ para("Plus: <code>\\+</code>"),
+ para("Minus: <code>\\-</code>"),
+
+ para("These should get escaped, even though they're matching pairs for\n" +
+ "other Markdown constructs:"),
+
+ para("\*asterisks\*"),
+ para("\_underscores\_"),
+ para("`backticks`"),
+
+ para("This is a code span with a literal backslash-backtick " +
+ "sequence: <code>\\`</code>"),
+
+ para("This is a tag with unescaped backticks " +
+ "<span attr='`ticks`'>bar</span>."),
+
+ para("This is a tag with backslashes " +
+ "<span attr='\\\\backslashes\\\\'>bar</span>."))
+
+ assert_equal expected, doc
+ end
+
+ def test_blockquotes_with_code_blocks
+ input = File.read "#{MARKDOWN_TEST_PATH}/Blockquotes with code blocks.text"
+
+ doc = @parser.parse input
+
+ expected =
+ doc(
+ block(
+ para("Example:"),
+ verb("sub status {\n",
+ " print \"working\";\n",
+ "}\n"),
+ para("Or:"),
+ verb("sub status {\n",
+ " return \"working\";\n",
+ "}\n")))
+
+ assert_equal expected, doc
+ end
+
+ def test_code_blocks
+ input = File.read "#{MARKDOWN_TEST_PATH}/Code Blocks.text"
+
+ doc = @parser.parse input
+
+ expected =
+ doc(
+ verb("code block on the first line\n"),
+ para("Regular text."),
+
+ verb("code block indented by spaces\n"),
+ para("Regular text."),
+
+ verb("the lines in this block \n",
+ "all contain trailing spaces \n"),
+ para("Regular Text."),
+
+ verb("code block on the last line\n"))
+
+ assert_equal expected, doc
+ end
+
+ def test_code_spans
+ input = File.read "#{MARKDOWN_TEST_PATH}/Code Spans.text"
+
+ doc = @parser.parse input
+
+ expected = doc(
+ para("<code><test a=\"</code> content of attribute <code>\"></code>"),
+ para("Fix for backticks within HTML tag: " +
+ "<span attr='`ticks`'>like this</span>"),
+ para("Here's how you put <code>`backticks`</code> in a code span."))
+
+ assert_equal expected, doc
+ end
+
+ def test_hard_wrapped_paragraphs_with_list_like_lines
+ input = File.read "#{MARKDOWN_TEST_PATH}/Hard-wrapped paragraphs with list-like lines.text"
+
+ doc = @parser.parse input
+
+ expected =
+ doc(
+ para("In Markdown 1.0.0 and earlier. Version\n" +
+ "8. This line turns into a list item.\n" +
+ "Because a hard-wrapped line in the\n" +
+ "middle of a paragraph looked like a\n" +
+ "list item."),
+ para("Here's one with a bullet.\n" +
+ "* criminey."))
+
+ assert_equal expected, doc
+ end
+
+ def test_horizontal_rules
+ input = File.read "#{MARKDOWN_TEST_PATH}/Horizontal rules.text"
+
+ doc = @parser.parse input
+
+ expected =
+ doc(
+ para("Dashes:"),
+
+ rule(1),
+ rule(1),
+ rule(1),
+ rule(1),
+ verb("---\n"),
+
+ rule(1),
+ rule(1),
+ rule(1),
+ rule(1),
+ verb("- - -\n"),
+
+ para("Asterisks:"),
+
+ rule(1),
+ rule(1),
+ rule(1),
+ rule(1),
+ verb("***\n"),
+
+ rule(1),
+ rule(1),
+ rule(1),
+ rule(1),
+ verb("* * *\n"),
+
+ para("Underscores:"),
+
+ rule(1),
+ rule(1),
+ rule(1),
+ rule(1),
+ verb("___\n"),
+
+ rule(1),
+ rule(1),
+ rule(1),
+ rule(1),
+ verb("_ _ _\n"))
+
+ assert_equal expected, doc
+ end
+
+ def test_inline_html_advanced
+ input = File.read "#{MARKDOWN_TEST_PATH}/Inline HTML (Advanced).text"
+
+ @parser.html = true
+
+ doc = @parser.parse input
+
+ expected =
+ doc(
+ para("Simple block on one line:"),
+ raw("<div>foo</div>"),
+ para("And nested without indentation:"),
+ raw(<<-RAW.chomp))
+<div>
+<div>
+<div>
+foo
+</div>
+<div style=">"/>
+</div>
+<div>bar</div>
+</div>
+ RAW
+
+ assert_equal expected, doc
+ end
+
+ def test_inline_html_simple
+ input = File.read "#{MARKDOWN_TEST_PATH}/Inline HTML (Simple).text"
+
+ @parser.html = true
+
+ doc = @parser.parse input
+
+ expected =
+ doc(
+ para("Here's a simple block:"),
+ raw("<div>\n\tfoo\n</div>"),
+
+ para("This should be a code block, though:"),
+ verb("<div>\n",
+ "\tfoo\n",
+ "</div>\n"),
+
+ para("As should this:"),
+ verb("<div>foo</div>\n"),
+
+ para("Now, nested:"),
+ raw("<div>\n\t<div>\n\t\t<div>\n\t\t\tfoo\n" +
+ "\t\t</div>\n\t</div>\n</div>"),
+
+ para("This should just be an HTML comment:"),
+ raw("<!-- Comment -->"),
+
+ para("Multiline:"),
+ raw("<!--\nBlah\nBlah\n-->"),
+
+ para("Code block:"),
+ verb("<!-- Comment -->\n"),
+
+ para("Just plain comment, with trailing spaces on the line:"),
+ raw("<!-- foo -->"),
+
+ para("Code:"),
+ verb("<hr />\n"),
+
+ para("Hr's:"),
+ raw("<hr>"),
+ raw("<hr/>"),
+ raw("<hr />"),
+
+ raw("<hr>"),
+ raw("<hr/>"),
+ raw("<hr />"),
+
+ raw("<hr class=\"foo\" id=\"bar\" />"),
+ raw("<hr class=\"foo\" id=\"bar\"/>"),
+ raw("<hr class=\"foo\" id=\"bar\" >"))
+
+ assert_equal expected, doc
+ end
+
+ def test_inline_html_comments
+ input = File.read "#{MARKDOWN_TEST_PATH}/Inline HTML comments.text"
+
+ doc = @parser.parse input
+
+ expected =
+ doc(
+ para("Paragraph one."),
+
+ raw("<!-- This is a simple comment -->"),
+
+ raw("<!--\n\tThis is another comment.\n-->"),
+
+ para("Paragraph two."),
+
+ raw("<!-- one comment block -- -- with two comments -->"),
+
+ para("The end."))
+
+ assert_equal expected, doc
+ end
+
+ def test_links_inline_style
+ input = File.read "#{MARKDOWN_TEST_PATH}/Links, inline style.text"
+
+ doc = @parser.parse input
+
+ expected =
+ doc(
+ para("Just a {URL}[/url/]."),
+ para("{URL and title}[/url/]."),
+ para("{URL and title}[/url/]."),
+ para("{URL and title}[/url/]."),
+ para("{URL and title}[/url/]."),
+ para("{Empty}[]."))
+
+ assert_equal expected, doc
+ end
+
+ def test_links_reference_style
+ input = File.read "#{MARKDOWN_TEST_PATH}/Links, reference style.text"
+
+ doc = @parser.parse input
+
+ expected =
+ doc(
+ para("Foo {bar}[/url/]."),
+ para("Foo {bar}[/url/]."),
+ para("Foo {bar}[/url/]."),
+
+ para("With {embedded [brackets]}[/url/]."),
+
+ para("Indented {once}[/url]."),
+ para("Indented {twice}[/url]."),
+ para("Indented {thrice}[/url]."),
+ para("Indented [four][] times."),
+
+ verb("[four]: /url\n"),
+
+ rule(1),
+
+ para("{this}[foo] should work"),
+ para("So should {this}[foo]."),
+ para("And {this}[foo]."),
+ para("And {this}[foo]."),
+ para("And {this}[foo]."),
+
+ para("But not [that] []."),
+ para("Nor [that][]."),
+ para("Nor [that]."),
+
+ para("[Something in brackets like {this}[foo] should work]"),
+ para("[Same with {this}[foo].]"),
+
+ para("In this case, {this}[/somethingelse/] points to something else."),
+ para("Backslashing should suppress [this] and [this]."),
+
+ rule(1),
+
+ para("Here's one where the {link breaks}[/url/] across lines."),
+ para("Here's another where the {link breaks}[/url/] across lines, " +
+ "but with a line-ending space."))
+
+ assert_equal expected, doc
+ end
+
+ def test_links_shortcut_references
+ input = File.read "#{MARKDOWN_TEST_PATH}/Links, shortcut references.text"
+
+ doc = @parser.parse input
+
+ expected =
+ doc(
+ para("This is the {simple case}[/simple]."),
+ para("This one has a {line break}[/foo]."),
+ para("This one has a {line break}[/foo] with a line-ending space."),
+ para("{this}[/that] and the {other}[/other]"))
+
+ assert_equal expected, doc
+ end
+
+ def test_literal_quotes_in_titles
+ input = File.read "#{MARKDOWN_TEST_PATH}/Literal quotes in titles.text"
+
+ doc = @parser.parse input
+
+ # TODO support title attribute
+ expected =
+ doc(
+ para("Foo {bar}[/url/]."),
+ para("Foo {bar}[/url/]."))
+
+ assert_equal expected, doc
+ end
+
+ def test_markdown_documentation_basics
+ input = File.read "#{MARKDOWN_TEST_PATH}/Markdown Documentation - Basics.text"
+
+ doc = @parser.parse input
+
+ expected =
+ doc(
+ head(1, "Markdown: Basics"),
+
+ raw(<<-RAW.chomp),
+<ul id="ProjectSubmenu">
+ <li><a href="/projects/markdown/" title="Markdown Project Page">Main</a></li>
+ <li><a class="selected" title="Markdown Basics">Basics</a></li>
+ <li><a href="/projects/markdown/syntax" title="Markdown Syntax Documentation">Syntax</a></li>
+ <li><a href="/projects/markdown/license" title="Pricing and License Information">License</a></li>
+ <li><a href="/projects/markdown/dingus" title="Online Markdown Web Form">Dingus</a></li>
+</ul>
+ RAW
+
+ head(2, "Getting the Gist of Markdown's Formatting Syntax"),
+
+ para("This page offers a brief overview of what it's like to use Markdown.\n" +
+ "The {syntax page}[/projects/markdown/syntax] provides complete, detailed documentation for\n" +
+ "every feature, but Markdown should be very easy to pick up simply by\n" +
+ "looking at a few examples of it in action. The examples on this page\n" +
+ "are written in a before/after style, showing example syntax and the\n" +
+ "HTML output produced by Markdown."),
+
+ para("It's also helpful to simply try Markdown out; the {Dingus}[/projects/markdown/dingus] is a\n" +
+ "web application that allows you type your own Markdown-formatted text\n" +
+ "and translate it to XHTML."),
+
+ para("<b>Note:</b> This document is itself written using Markdown; you\n" +
+ "can {see the source for it by adding '.text' to the URL}[/projects/markdown/basics.text]."),
+
+ head(2, "Paragraphs, Headers, Blockquotes"),
+
+ para("A paragraph is simply one or more consecutive lines of text, separated\n" +
+ "by one or more blank lines. (A blank line is any line that looks like a\n" +
+ "blank line -- a line containing nothing spaces or tabs is considered\n" +
+ "blank.) Normal paragraphs should not be intended with spaces or tabs."),
+
+ para("Markdown offers two styles of headers: _Setext_ and _atx_.\n" +
+ "Setext-style headers for <code><h1></code> and <code><h2></code> are created by\n" +
+ "\"underlining\" with equal signs (<code>=</code>) and hyphens (<code>-</code>), respectively.\n" +
+ "To create an atx-style header, you put 1-6 hash marks (<code>#</code>) at the\n" +
+ "beginning of the line -- the number of hashes equals the resulting\n" +
+ "HTML header level."),
+
+ para("Blockquotes are indicated using email-style '<code>></code>' angle brackets."),
+
+ para("Markdown:"),
+
+ verb("A First Level Header\n",
+ "====================\n",
+ "\n",
+ "A Second Level Header\n",
+ "---------------------\n",
+ "\n",
+ "Now is the time for all good men to come to\n",
+ "the aid of their country. This is just a\n",
+ "regular paragraph.\n",
+ "\n",
+ "The quick brown fox jumped over the lazy\n",
+ "dog's back.\n",
+ "\n",
+ "### Header 3\n",
+ "\n",
+ "> This is a blockquote.\n",
+ "> \n",
+ "> This is the second paragraph in the blockquote.\n",
+ ">\n",
+ "> ## This is an H2 in a blockquote\n"),
+
+ para("Output:"),
+
+ verb("<h1>A First Level Header</h1>\n",
+ "\n",
+ "<h2>A Second Level Header</h2>\n",
+ "\n",
+ "<p>Now is the time for all good men to come to\n",
+ "the aid of their country. This is just a\n",
+ "regular paragraph.</p>\n",
+ "\n",
+ "<p>The quick brown fox jumped over the lazy\n",
+ "dog's back.</p>\n",
+ "\n",
+ "<h3>Header 3</h3>\n",
+ "\n",
+ "<blockquote>\n",
+ " <p>This is a blockquote.</p>\n",
+ "\n",
+ " <p>This is the second paragraph in the blockquote.</p>\n",
+ "\n",
+ " <h2>This is an H2 in a blockquote</h2>\n",
+ "</blockquote>\n"),
+
+ head(3, "Phrase Emphasis"),
+ para("Markdown uses asterisks and underscores to indicate spans of emphasis."),
+
+ para("Markdown:"),
+
+ verb("Some of these words *are emphasized*.\n",
+ "Some of these words _are emphasized also_.\n",
+ "\n",
+ "Use two asterisks for **strong emphasis**.\n",
+ "Or, if you prefer, __use two underscores instead__.\n"),
+
+ para("Output:"),
+
+ verb("<p>Some of these words <em>are emphasized</em>.\n",
+ "Some of these words <em>are emphasized also</em>.</p>\n",
+ "\n",
+ "<p>Use two asterisks for <strong>strong emphasis</strong>.\n",
+ "Or, if you prefer, <strong>use two underscores instead</strong>.</p>\n"),
+
+ head(2, "Lists"),
+
+ para("Unordered (bulleted) lists use asterisks, pluses, and hyphens (<code>*</code>,\n" +
+ "<code>+</code>, and <code>-</code>) as list markers. These three markers are\n" +
+ "interchangable; this:"),
+
+ verb("* Candy.\n",
+ "* Gum.\n",
+ "* Booze.\n"),
+
+ para("this:"),
+
+ verb("+ Candy.\n",
+ "+ Gum.\n",
+ "+ Booze.\n"),
+
+ para("and this:"),
+
+ verb("- Candy.\n",
+ "- Gum.\n",
+ "- Booze.\n"),
+
+ para("all produce the same output:"),
+
+ verb("<ul>\n",
+ "<li>Candy.</li>\n",
+ "<li>Gum.</li>\n",
+ "<li>Booze.</li>\n",
+ "</ul>\n"),
+
+ para("Ordered (numbered) lists use regular numbers, followed by periods, as\n" +
+ "list markers:"),
+
+ verb("1. Red\n",
+ "2. Green\n",
+ "3. Blue\n"),
+
+ para("Output:"),
+
+ verb("<ol>\n",
+ "<li>Red</li>\n",
+ "<li>Green</li>\n",
+ "<li>Blue</li>\n",
+ "</ol>\n"),
+
+ para("If you put blank lines between items, you'll get <code><p></code> tags for the\n" +
+ "list item text. You can create multi-paragraph list items by indenting\n" +
+ "the paragraphs by 4 spaces or 1 tab:"),
+
+ verb("* A list item.\n",
+ "\n",
+ " With multiple paragraphs.\n",
+ "\n",
+ "* Another item in the list.\n"),
+
+ para("Output:"),
+
+ verb("<ul>\n",
+ "<li><p>A list item.</p>\n",
+ "<p>With multiple paragraphs.</p></li>\n",
+ "<li><p>Another item in the list.</p></li>\n",
+ "</ul>\n"),
+
+ head(3, "Links"),
+
+ para("Markdown supports two styles for creating links: _inline_ and\n" +
+ "_reference_. With both styles, you use square brackets to delimit the\n" +
+ "text you want to turn into a link."),
+
+ para("Inline-style links use parentheses immediately after the link text.\n" +
+ "For example:"),
+
+ verb("This is an [example link](http://example.com/).\n"),
+
+ para("Output:"),
+
+ verb("<p>This is an <a href=\"http://example.com/\">\n",
+ "example link</a>.</p>\n"),
+
+ para("Optionally, you may include a title attribute in the parentheses:"),
+
+ verb("This is an [example link](http://example.com/ \"With a Title\").\n"),
+
+ para("Output:"),
+
+ verb("<p>This is an <a href=\"http://example.com/\" title=\"With a Title\">\n",
+ "example link</a>.</p>\n"),
+
+ para("Reference-style links allow you to refer to your links by names, which\n" +
+ "you define elsewhere in your document:"),
+
+ verb("I get 10 times more traffic from [Google][1] than from\n",
+ "[Yahoo][2] or [MSN][3].\n",
+ "\n",
+ "[1]: http://google.com/ \"Google\"\n",
+ "[2]: http://search.yahoo.com/ \"Yahoo Search\"\n",
+ "[3]: http://search.msn.com/ \"MSN Search\"\n"),
+
+ para("Output:"),
+
+ verb("<p>I get 10 times more traffic from <a href=\"http://google.com/\"\n",
+ "title=\"Google\">Google</a> than from <a href=\"http://search.yahoo.com/\"\n",
+ "title=\"Yahoo Search\">Yahoo</a> or <a href=\"http://search.msn.com/\"\n",
+ "title=\"MSN Search\">MSN</a>.</p>\n"),
+
+ para("The title attribute is optional. Link names may contain letters,\n" +
+ "numbers and spaces, but are _not_ case sensitive:"),
+
+ verb("I start my morning with a cup of coffee and\n",
+ "[The New York Times][NY Times].\n",
+ "\n",
+ "[ny times]: http://www.nytimes.com/\n"),
+
+ para("Output:"),
+
+ verb("<p>I start my morning with a cup of coffee and\n",
+ "<a href=\"http://www.nytimes.com/\">The New York Times</a>.</p>\n"),
+
+ head(3, "Images"),
+
+ para("Image syntax is very much like link syntax."),
+
+ para("Inline (titles are optional):"),
+
+ verb("![alt text](/path/to/img.jpg \"Title\")\n"),
+
+ para("Reference-style:"),
+
+ verb("![alt text][id]\n",
+ "\n",
+ "[id]: /path/to/img.jpg \"Title\"\n"),
+
+ para("Both of the above examples produce the same output:"),
+
+ verb("<img src=\"/path/to/img.jpg\" alt=\"alt text\" title=\"Title\" />\n"),
+
+ head(3, "Code"),
+
+ para("In a regular paragraph, you can create code span by wrapping text in\n" +
+ "backtick quotes. Any ampersands (<code>&</code>) and angle brackets (<code><</code> or\n" +
+ "<code>></code>) will automatically be translated into HTML entities. This makes\n" +
+ "it easy to use Markdown to write about HTML example code:"),
+
+ verb(
+ "I strongly recommend against using any `<blink>` tags.\n",
+ "\n",
+ "I wish SmartyPants used named entities like `&mdash;`\n",
+ "instead of decimal-encoded entites like `&#8212;`.\n"),
+
+ para("Output:"),
+
+ verb("<p>I strongly recommend against using any\n",
+ "<code>&lt;blink&gt;</code> tags.</p>\n",
+ "\n",
+ "<p>I wish SmartyPants used named entities like\n",
+ "<code>&amp;mdash;</code> instead of decimal-encoded\n",
+ "entites like <code>&amp;#8212;</code>.</p>\n"),
+
+ para("To specify an entire block of pre-formatted code, indent every line of\n" +
+ "the block by 4 spaces or 1 tab. Just like with code spans, <code>&</code>, <code><</code>,\n" +
+ "and <code>></code> characters will be escaped automatically."),
+
+ para("Markdown:"),
+
+ verb("If you want your page to validate under XHTML 1.0 Strict,\n",
+ "you've got to put paragraph tags in your blockquotes:\n",
+ "\n",
+ " <blockquote>\n",
+ " <p>For example.</p>\n",
+ " </blockquote>\n"),
+
+ para("Output:"),
+
+ verb("<p>If you want your page to validate under XHTML 1.0 Strict,\n",
+ "you've got to put paragraph tags in your blockquotes:</p>\n",
+ "\n",
+ "<pre><code>&lt;blockquote&gt;\n",
+ " &lt;p&gt;For example.&lt;/p&gt;\n",
+ "&lt;/blockquote&gt;\n",
+ "</code></pre>\n"))
+
+ assert_equal expected, doc
+ end
+
+ def test_markdown_documentation_syntax
+ input = File.read "#{MARKDOWN_TEST_PATH}/Markdown Documentation - Syntax.text"
+
+ doc = @parser.parse input
+
+ expected =
+ doc(
+ head(1, "Markdown: Syntax"),
+
+ raw(<<-RAW.chomp),
+<ul id="ProjectSubmenu">
+ <li><a href="/projects/markdown/" title="Markdown Project Page">Main</a></li>
+ <li><a href="/projects/markdown/basics" title="Markdown Basics">Basics</a></li>
+ <li><a class="selected" title="Markdown Syntax Documentation">Syntax</a></li>
+ <li><a href="/projects/markdown/license" title="Pricing and License Information">License</a></li>
+ <li><a href="/projects/markdown/dingus" title="Online Markdown Web Form">Dingus</a></li>
+</ul>
+ RAW
+
+ list(:BULLET,
+ item(nil,
+ para("{Overview}[#overview]"),
+ list(:BULLET,
+ item(nil,
+ para("{Philosophy}[#philosophy]")),
+ item(nil,
+ para("{Inline HTML}[#html]")),
+ item(nil,
+ para("{Automatic Escaping for Special Characters}[#autoescape]")))),
+ item(nil,
+ para("{Block Elements}[#block]"),
+ list(:BULLET,
+ item(nil,
+ para("{Paragraphs and Line Breaks}[#p]")),
+ item(nil,
+ para("{Headers}[#header]")),
+ item(nil,
+ para("{Blockquotes}[#blockquote]")),
+ item(nil,
+ para("{Lists}[#list]")),
+ item(nil,
+ para("{Code Blocks}[#precode]")),
+ item(nil,
+ para("{Horizontal Rules}[#hr]")))),
+ item(nil,
+ para("{Span Elements}[#span]"),
+ list(:BULLET,
+ item(nil,
+ para("{Links}[#link]")),
+ item(nil,
+ para("{Emphasis}[#em]")),
+ item(nil,
+ para("{Code}[#code]")),
+ item(nil,
+ para("{Images}[#img]")))),
+ item(nil,
+ para("{Miscellaneous}[#misc]"),
+ list(:BULLET,
+ item(nil,
+ para("{Backslash Escapes}[#backslash]")),
+ item(nil,
+ para("{Automatic Links}[#autolink]"))))),
+
+ para("<b>Note:</b> This document is itself written using Markdown; you\n" +
+ "can {see the source for it by adding '.text' to the URL}[/projects/markdown/syntax.text]."),
+
+ rule(1),
+
+ raw("<h2 id=\"overview\">Overview</h2>"),
+
+ raw("<h3 id=\"philosophy\">Philosophy</h3>"),
+
+ para("Markdown is intended to be as easy-to-read and easy-to-write as is feasible."),
+
+ para("Readability, however, is emphasized above all else. A Markdown-formatted\n" +
+ "document should be publishable as-is, as plain text, without looking\n" +
+ "like it's been marked up with tags or formatting instructions. While\n" +
+ "Markdown's syntax has been influenced by several existing text-to-HTML\n" +
+ "filters -- including {Setext}[http://docutils.sourceforge.net/mirror/setext.html], {atx}[http://www.aaronsw.com/2002/atx/], {Textile}[http://textism.com/tools/textile/], {reStructuredText}[http://docutils.sourceforge.net/rst.html],\n" +
+ "{Grutatext}[http://www.triptico.com/software/grutatxt.html], and {EtText}[http://ettext.taint.org/doc/] -- the single biggest source of\n" +
+ "inspiration for Markdown's syntax is the format of plain text email."),
+
+ para("To this end, Markdown's syntax is comprised entirely of punctuation\n" +
+ "characters, which punctuation characters have been carefully chosen so\n" +
+ "as to look like what they mean. E.g., asterisks around a word actually\n" +
+ "look like \*emphasis\*. Markdown lists look like, well, lists. Even\n" +
+ "blockquotes look like quoted passages of text, assuming you've ever\n" +
+ "used email."),
+
+ raw("<h3 id=\"html\">Inline HTML</h3>"),
+
+ para("Markdown's syntax is intended for one purpose: to be used as a\n" +
+ "format for _writing_ for the web."),
+
+ para("Markdown is not a replacement for HTML, or even close to it. Its\n" +
+ "syntax is very small, corresponding only to a very small subset of\n" +
+ "HTML tags. The idea is _not_ to create a syntax that makes it easier\n" +
+ "to insert HTML tags. In my opinion, HTML tags are already easy to\n" +
+ "insert. The idea for Markdown is to make it easy to read, write, and\n" +
+ "edit prose. HTML is a _publishing_ format; Markdown is a _writing_\n" +
+ "format. Thus, Markdown's formatting syntax only addresses issues that\n" +
+ "can be conveyed in plain text."),
+
+ para("For any markup that is not covered by Markdown's syntax, you simply\n" +
+ "use HTML itself. There's no need to preface it or delimit it to\n" +
+ "indicate that you're switching from Markdown to HTML; you just use\n" +
+ "the tags."),
+
+ para("The only restrictions are that block-level HTML elements -- e.g. <code><div></code>,\n" +
+ "<code><table></code>, <code><pre></code>, <code><p></code>, etc. -- must be separated from surrounding\n" +
+ "content by blank lines, and the start and end tags of the block should\n" +
+ "not be indented with tabs or spaces. Markdown is smart enough not\n" +
+ "to add extra (unwanted) <code><p></code> tags around HTML block-level tags."),
+
+ para("For example, to add an HTML table to a Markdown article:"),
+
+ verb("This is a regular paragraph.\n",
+ "\n",
+ "<table>\n",
+ " <tr>\n",
+ " <td>Foo</td>\n",
+ " </tr>\n",
+ "</table>\n",
+ "\n",
+ "This is another regular paragraph.\n"),
+
+ para("Note that Markdown formatting syntax is not processed within block-level\n" +
+ "HTML tags. E.g., you can't use Markdown-style <code>*emphasis*</code> inside an\n" +
+ "HTML block."),
+
+ para("Span-level HTML tags -- e.g. <code><span></code>, <code><cite></code>, or <code><del></code> -- can be\n" +
+ "used anywhere in a Markdown paragraph, list item, or header. If you\n" +
+ "want, you can even use HTML tags instead of Markdown formatting; e.g. if\n" +
+ "you'd prefer to use HTML <code><a></code> or <code><img></code> tags instead of Markdown's\n" +
+ "link or image syntax, go right ahead."),
+
+ para("Unlike block-level HTML tags, Markdown syntax _is_ processed within\n" +
+ "span-level tags."),
+
+ raw("<h3 id=\"autoescape\">Automatic Escaping for Special Characters</h3>"),
+
+ para("In HTML, there are two characters that demand special treatment: <code><</code>\n" +
+ "and <code>&</code>. Left angle brackets are used to start tags; ampersands are\n" +
+ "used to denote HTML entities. If you want to use them as literal\n" +
+ "characters, you must escape them as entities, e.g. <code>&lt;</code>, and\n" +
+ "<code>&amp;</code>."),
+
+ para("Ampersands in particular are bedeviling for web writers. If you want to\n" +
+ "write about 'AT&T', you need to write '<code>AT&amp;T</code>'. You even need to\n" +
+ "escape ampersands within URLs. Thus, if you want to link to:"),
+
+ verb("http://images.google.com/images?num=30&q=larry+bird\n"),
+
+ para("you need to encode the URL as:"),
+
+ verb("http://images.google.com/images?num=30&amp;q=larry+bird\n"),
+
+ para("in your anchor tag <code>href</code> attribute. Needless to say, this is easy to\n" +
+ "forget, and is probably the single most common source of HTML validation\n" +
+ "errors in otherwise well-marked-up web sites."),
+
+ para("Markdown allows you to use these characters naturally, taking care of\n" +
+ "all the necessary escaping for you. If you use an ampersand as part of\n" +
+ "an HTML entity, it remains unchanged; otherwise it will be translated\n" +
+ "into <code>&amp;</code>."),
+
+ para("So, if you want to include a copyright symbol in your article, you can write:"),
+
+ verb("&copy;\n"),
+
+ para("and Markdown will leave it alone. But if you write:"),
+
+ verb("AT&T\n"),
+
+ para("Markdown will translate it to:"),
+
+ verb("AT&amp;T\n"),
+
+ para("Similarly, because Markdown supports {inline HTML}[#html], if you use\n" +
+ "angle brackets as delimiters for HTML tags, Markdown will treat them as\n" +
+ "such. But if you write:"),
+
+ verb("4 < 5\n"),
+
+ para("Markdown will translate it to:"),
+
+ verb("4 &lt; 5\n"),
+
+ para("However, inside Markdown code spans and blocks, angle brackets and\n" +
+ "ampersands are _always_ encoded automatically. This makes it easy to use\n" +
+ "Markdown to write about HTML code. (As opposed to raw HTML, which is a\n" +
+ "terrible format for writing about HTML syntax, because every single <code><</code>\n" +
+ "and <code>&</code> in your example code needs to be escaped.)"),
+
+ rule(1),
+
+ raw("<h2 id=\"block\">Block Elements</h2>"),
+
+ raw("<h3 id=\"p\">Paragraphs and Line Breaks</h3>"),
+
+ para("A paragraph is simply one or more consecutive lines of text, separated\n" +
+ "by one or more blank lines. (A blank line is any line that looks like a\n" +
+ "blank line -- a line containing nothing but spaces or tabs is considered\n" +
+ "blank.) Normal paragraphs should not be intended with spaces or tabs."),
+
+ para("The implication of the \"one or more consecutive lines of text\" rule is\n" +
+ "that Markdown supports \"hard-wrapped\" text paragraphs. This differs\n" +
+ "significantly from most other text-to-HTML formatters (including Movable\n" +
+ "Type's \"Convert Line Breaks\" option) which translate every line break\n" +
+ "character in a paragraph into a <code><br /></code> tag."),
+
+ para("When you _do_ want to insert a <code><br /></code> break tag using Markdown, you\n" +
+ "end a line with two or more spaces, then type return."),
+
+ para("Yes, this takes a tad more effort to create a <code><br /></code>, but a simplistic\n" +
+ "\"every line break is a <code><br /></code>\" rule wouldn't work for Markdown.\n" +
+ "Markdown's email-style {blockquoting}[#blockquote] and multi-paragraph {list items}[#list]\n" +
+ "work best -- and look better -- when you format them with hard breaks."),
+
+ raw("<h3 id=\"header\">Headers</h3>"),
+
+ para("Markdown supports two styles of headers, {Setext}[http://docutils.sourceforge.net/mirror/setext.html] and {atx}[http://www.aaronsw.com/2002/atx/]."),
+
+ para("Setext-style headers are \"underlined\" using equal signs (for first-level\n" +
+ "headers) and dashes (for second-level headers). For example:"),
+
+ verb("This is an H1\n",
+ "=============\n",
+ "\n",
+ "This is an H2\n",
+ "-------------\n"),
+
+ para("Any number of underlining <code>=</code>'s or <code>-</code>'s will work."),
+
+ para("Atx-style headers use 1-6 hash characters at the start of the line,\n" +
+ "corresponding to header levels 1-6. For example:"),
+
+ verb("# This is an H1\n",
+ "\n",
+ "## This is an H2\n",
+ "\n",
+ "###### This is an H6\n"),
+
+ para("Optionally, you may \"close\" atx-style headers. This is purely\n" +
+ "cosmetic -- you can use this if you think it looks better. The\n" +
+ "closing hashes don't even need to match the number of hashes\n" +
+ "used to open the header. (The number of opening hashes\n" +
+ "determines the header level.) :"),
+
+ verb("# This is an H1 #\n",
+ "\n",
+ "## This is an H2 ##\n",
+ "\n",
+ "### This is an H3 ######\n"),
+
+ raw("<h3 id=\"blockquote\">Blockquotes</h3>"),
+
+ para(
+ "Markdown uses email-style <code>></code> characters for blockquoting. If you're\n" +
+ "familiar with quoting passages of text in an email message, then you\n" +
+ "know how to create a blockquote in Markdown. It looks best if you hard\n" +
+ "wrap the text and put a <code>></code> before every line:"),
+
+ verb("> This is a blockquote with two paragraphs. Lorem ipsum dolor sit amet,\n",
+ "> consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus.\n",
+ "> Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus.\n",
+ "> \n",
+ "> Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse\n",
+ "> id sem consectetuer libero luctus adipiscing.\n"),
+
+ para("Markdown allows you to be lazy and only put the <code>></code> before the first\n" +
+ "line of a hard-wrapped paragraph:"),
+
+ verb("> This is a blockquote with two paragraphs. Lorem ipsum dolor sit amet,\n",
+ "consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus.\n",
+ "Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus.\n",
+ "\n",
+ "> Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse\n",
+ "id sem consectetuer libero luctus adipiscing.\n"),
+
+ para("Blockquotes can be nested (i.e. a blockquote-in-a-blockquote) by\n" +
+ "adding additional levels of <code>></code>:"),
+
+ verb("> This is the first level of quoting.\n",
+ ">\n",
+ "> > This is nested blockquote.\n",
+ ">\n",
+ "> Back to the first level.\n"),
+
+ para("Blockquotes can contain other Markdown elements, including headers, lists,\n" +
+ "and code blocks:"),
+
+ verb("> ## This is a header.\n",
+ "> \n",
+ "> 1. This is the first list item.\n",
+ "> 2. This is the second list item.\n",
+ "> \n",
+ "> Here's some example code:\n",
+ "> \n",
+ "> return shell_exec(\"echo $input | $markdown_script\");\n"),
+
+ para("Any decent text editor should make email-style quoting easy. For\n" +
+ "example, with BBEdit, you can make a selection and choose Increase\n" +
+ "Quote Level from the Text menu."),
+
+ raw("<h3 id=\"list\">Lists</h3>"),
+
+ para("Markdown supports ordered (numbered) and unordered (bulleted) lists."),
+
+ para("Unordered lists use asterisks, pluses, and hyphens -- interchangably\n" +
+ "-- as list markers:"),
+
+ verb("* Red\n",
+ "* Green\n",
+ "* Blue\n"),
+
+ para("is equivalent to:"),
+
+ verb("+ Red\n",
+ "+ Green\n",
+ "+ Blue\n"),
+
+ para("and:"),
+
+ verb("- Red\n",
+ "- Green\n",
+ "- Blue\n"),
+
+ para("Ordered lists use numbers followed by periods:"),
+
+ verb("1. Bird\n",
+ "2. McHale\n",
+ "3. Parish\n"),
+
+ para("It's important to note that the actual numbers you use to mark the\n" +
+ "list have no effect on the HTML output Markdown produces. The HTML\n" +
+ "Markdown produces from the above list is:"),
+
+ verb("<ol>\n",
+ "<li>Bird</li>\n",
+ "<li>McHale</li>\n",
+ "<li>Parish</li>\n",
+ "</ol>\n"),
+
+ para("If you instead wrote the list in Markdown like this:"),
+
+ verb("1. Bird\n",
+ "1. McHale\n",
+ "1. Parish\n"),
+
+ para("or even:"),
+
+ verb("3. Bird\n",
+ "1. McHale\n",
+ "8. Parish\n"),
+
+ para("you'd get the exact same HTML output. The point is, if you want to,\n" +
+ "you can use ordinal numbers in your ordered Markdown lists, so that\n" +
+ "the numbers in your source match the numbers in your published HTML.\n" +
+ "But if you want to be lazy, you don't have to."),
+
+ para("If you do use lazy list numbering, however, you should still start the\n" +
+ "list with the number 1. At some point in the future, Markdown may support\n" +
+ "starting ordered lists at an arbitrary number."),
+
+ para("List markers typically start at the left margin, but may be indented by\n" +
+ "up to three spaces. List markers must be followed by one or more spaces\n" +
+ "or a tab."),
+
+ para("To make lists look nice, you can wrap items with hanging indents:"),
+
+ verb("* Lorem ipsum dolor sit amet, consectetuer adipiscing elit.\n",
+ " Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi,\n",
+ " viverra nec, fringilla in, laoreet vitae, risus.\n",
+ "* Donec sit amet nisl. Aliquam semper ipsum sit amet velit.\n",
+ " Suspendisse id sem consectetuer libero luctus adipiscing.\n"),
+
+ para("But if you want to be lazy, you don't have to:"),
+
+ verb("* Lorem ipsum dolor sit amet, consectetuer adipiscing elit.\n",
+ "Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi,\n",
+ "viverra nec, fringilla in, laoreet vitae, risus.\n",
+ "* Donec sit amet nisl. Aliquam semper ipsum sit amet velit.\n",
+ "Suspendisse id sem consectetuer libero luctus adipiscing.\n"),
+
+ para("If list items are separated by blank lines, Markdown will wrap the\n" +
+ "items in <code><p></code> tags in the HTML output. For example, this input:"),
+
+ verb("* Bird\n",
+ "* Magic\n"),
+
+ para("will turn into:"),
+
+ verb("<ul>\n",
+ "<li>Bird</li>\n",
+ "<li>Magic</li>\n",
+ "</ul>\n"),
+
+ para("But this:"),
+
+ verb("* Bird\n",
+ "\n",
+ "* Magic\n"),
+
+ para("will turn into:"),
+
+ verb("<ul>\n",
+ "<li><p>Bird</p></li>\n",
+ "<li><p>Magic</p></li>\n",
+ "</ul>\n"),
+
+ para("List items may consist of multiple paragraphs. Each subsequent\n" +
+ "paragraph in a list item must be intended by either 4 spaces\n" +
+ "or one tab:"),
+
+ verb("1. This is a list item with two paragraphs. Lorem ipsum dolor\n",
+ " sit amet, consectetuer adipiscing elit. Aliquam hendrerit\n",
+ " mi posuere lectus.\n",
+ "\n",
+ " Vestibulum enim wisi, viverra nec, fringilla in, laoreet\n",
+ " vitae, risus. Donec sit amet nisl. Aliquam semper ipsum\n",
+ " sit amet velit.\n",
+ "\n",
+ "2. Suspendisse id sem consectetuer libero luctus adipiscing.\n"),
+
+ para("It looks nice if you indent every line of the subsequent\n" +
+ "paragraphs, but here again, Markdown will allow you to be\n" +
+ "lazy:"),
+
+ verb("* This is a list item with two paragraphs.\n",
+ "\n",
+ " This is the second paragraph in the list item. You're\n",
+ "only required to indent the first line. Lorem ipsum dolor\n",
+ "sit amet, consectetuer adipiscing elit.\n",
+ "\n",
+ "* Another item in the same list.\n"),
+
+ para("To put a blockquote within a list item, the blockquote's <code>></code>\n" +
+ "delimiters need to be indented:"),
+
+ verb("* A list item with a blockquote:\n",
+ "\n",
+ " > This is a blockquote\n",
+ " > inside a list item.\n"),
+
+ para(
+ "To put a code block within a list item, the code block needs\n" +
+ "to be indented _twice_ -- 8 spaces or two tabs:"),
+
+ verb("* A list item with a code block:\n",
+ "\n",
+ " <code goes here>\n"),
+
+ para("It's worth noting that it's possible to trigger an ordered list by\n" +
+ "accident, by writing something like this:"),
+
+ verb("1986. What a great season.\n"),
+
+ para("In other words, a <em>number-period-space</em> sequence at the beginning of a\n" +
+ "line. To avoid this, you can backslash-escape the period:"),
+
+ verb("1986\\. What a great season.\n"),
+
+ raw("<h3 id=\"precode\">Code Blocks</h3>"),
+
+ para("Pre-formatted code blocks are used for writing about programming or\n" +
+ "markup source code. Rather than forming normal paragraphs, the lines\n" +
+ "of a code block are interpreted literally. Markdown wraps a code block\n" +
+ "in both <code><pre></code> and <code><code></code> tags."),
+
+ para("To produce a code block in Markdown, simply indent every line of the\n" +
+ "block by at least 4 spaces or 1 tab. For example, given this input:"),
+
+ verb("This is a normal paragraph:\n",
+ "\n",
+ " This is a code block.\n"),
+
+ para("Markdown will generate:"),
+
+ verb("<p>This is a normal paragraph:</p>\n",
+ "\n",
+ "<pre><code>This is a code block.\n",
+ "</code></pre>\n"),
+
+ para("One level of indentation -- 4 spaces or 1 tab -- is removed from each\n" +
+ "line of the code block. For example, this:"),
+
+ verb("Here is an example of AppleScript:\n",
+ "\n",
+ " tell application \"Foo\"\n",
+ " beep\n",
+ " end tell\n"),
+
+ para("will turn into:"),
+
+ verb("<p>Here is an example of AppleScript:</p>\n",
+ "\n",
+ "<pre><code>tell application \"Foo\"\n",
+ " beep\n",
+ "end tell\n",
+ "</code></pre>\n"),
+
+ para("A code block continues until it reaches a line that is not indented\n" +
+ "(or the end of the article)."),
+
+ para("Within a code block, ampersands (<code>&</code>) and angle brackets (<code><</code> and <code>></code>)\n" +
+ "are automatically converted into HTML entities. This makes it very\n" +
+ "easy to include example HTML source code using Markdown -- just paste\n" +
+ "it and indent it, and Markdown will handle the hassle of encoding the\n" +
+ "ampersands and angle brackets. For example, this:"),
+
+ verb(" <div class=\"footer\">\n",
+ " &copy; 2004 Foo Corporation\n",
+ " </div>\n"),
+
+ para("will turn into:"),
+
+ verb("<pre><code>&lt;div class=\"footer\"&gt;\n",
+ " &amp;copy; 2004 Foo Corporation\n",
+ "&lt;/div&gt;\n",
+ "</code></pre>\n"),
+
+ para("Regular Markdown syntax is not processed within code blocks. E.g.,\n" +
+ "asterisks are just literal asterisks within a code block. This means\n" +
+ "it's also easy to use Markdown to write about Markdown's own syntax."),
+
+ raw("<h3 id=\"hr\">Horizontal Rules</h3>"),
+
+ para("You can produce a horizontal rule tag (<code><hr /></code>) by placing three or\n" +
+ "more hyphens, asterisks, or underscores on a line by themselves. If you\n" +
+ "wish, you may use spaces between the hyphens or asterisks. Each of the\n" +
+ "following lines will produce a horizontal rule:"),
+
+ verb("* * *\n",
+ "\n",
+ "***\n",
+ "\n",
+ "*****\n",
+ "\n",
+ "- - -\n",
+ "\n",
+ "---------------------------------------\n",
+ "\n",
+ "_ _ _\n"),
+
+ rule(1),
+
+ raw("<h2 id=\"span\">Span Elements</h2>"),
+
+ raw("<h3 id=\"link\">Links</h3>"),
+
+ para("Markdown supports two style of links: _inline_ and _reference_."),
+
+ para("In both styles, the link text is delimited by [square brackets]."),
+
+ para("To create an inline link, use a set of regular parentheses immediately\n" +
+ "after the link text's closing square bracket. Inside the parentheses,\n" +
+ "put the URL where you want the link to point, along with an _optional_\n" +
+ "title for the link, surrounded in quotes. For example:"),
+
+ verb("This is [an example](http://example.com/ \"Title\") inline link.\n",
+ "\n",
+ "[This link](http://example.net/) has no title attribute.\n"),
+
+ para("Will produce:"),
+
+ verb("<p>This is <a href=\"http://example.com/\" title=\"Title\">\n",
+ "an example</a> inline link.</p>\n",
+ "\n",
+ "<p><a href=\"http://example.net/\">This link</a> has no\n",
+ "title attribute.</p>\n"),
+
+ para("If you're referring to a local resource on the same server, you can\n" +
+ "use relative paths:"),
+
+ verb("See my [About](/about/) page for details.\n"),
+
+ para("Reference-style links use a second set of square brackets, inside\n" +
+ "which you place a label of your choosing to identify the link:"),
+
+ verb("This is [an example][id] reference-style link.\n"),
+
+ para("You can optionally use a space to separate the sets of brackets:"),
+
+ verb("This is [an example] [id] reference-style link.\n"),
+
+ para("Then, anywhere in the document, you define your link label like this,\n" +
+ "on a line by itself:"),
+
+ verb("[id]: http://example.com/ \"Optional Title Here\"\n"),
+
+ para("That is:"),
+
+ list(:BULLET,
+ item(nil,
+ para("Square brackets containing the link identifier (optionally\n" +
+ "indented from the left margin using up to three spaces);")),
+ item(nil,
+ para("followed by a colon;")),
+ item(nil,
+ para("followed by one or more spaces (or tabs);")),
+ item(nil,
+ para("followed by the URL for the link;")),
+ item(nil,
+ para("optionally followed by a title attribute for the link, enclosed\n" +
+ "in double or single quotes."))),
+
+ para("The link URL may, optionally, be surrounded by angle brackets:"),
+
+ verb("[id]: <http://example.com/> \"Optional Title Here\"\n"),
+
+ para("You can put the title attribute on the next line and use extra spaces\n" +
+ "or tabs for padding, which tends to look better with longer URLs:"),
+
+ verb("[id]: http://example.com/longish/path/to/resource/here\n",
+ " \"Optional Title Here\"\n"),
+
+ para("Link definitions are only used for creating links during Markdown\n" +
+ "processing, and are stripped from your document in the HTML output."),
+
+ para("Link definition names may constist of letters, numbers, spaces, and punctuation -- but they are _not_ case sensitive. E.g. these two links:"),
+
+ verb("[link text][a]\n",
+ "[link text][A]\n"),
+
+ para("are equivalent."),
+
+ para("The <em>implicit link name</em> shortcut allows you to omit the name of the\n" +
+ "link, in which case the link text itself is used as the name.\n" +
+ "Just use an empty set of square brackets -- e.g., to link the word\n" +
+ "\"Google\" to the google.com web site, you could simply write:"),
+
+ verb("[Google][]\n"),
+
+ para("And then define the link:"),
+
+ verb("[Google]: http://google.com/\n"),
+
+ para("Because link names may contain spaces, this shortcut even works for\n" +
+ "multiple words in the link text:"),
+
+
+ verb("Visit [Daring Fireball][] for more information.\n"),
+
+ para("And then define the link:"),
+
+ verb("[Daring Fireball]: http://daringfireball.net/\n"),
+
+ para("Link definitions can be placed anywhere in your Markdown document. I\n" +
+ "tend to put them immediately after each paragraph in which they're\n" +
+ "used, but if you want, you can put them all at the end of your\n" +
+ "document, sort of like footnotes."),
+
+ para("Here's an example of reference links in action:"),
+
+ verb("I get 10 times more traffic from [Google] [1] than from\n",
+ "[Yahoo] [2] or [MSN] [3].\n",
+ "\n",
+ " [1]: http://google.com/ \"Google\"\n",
+ " [2]: http://search.yahoo.com/ \"Yahoo Search\"\n",
+ " [3]: http://search.msn.com/ \"MSN Search\"\n"),
+
+ para("Using the implicit link name shortcut, you could instead write:"),
+
+ verb("I get 10 times more traffic from [Google][] than from\n",
+ "[Yahoo][] or [MSN][].\n",
+ "\n",
+ " [google]: http://google.com/ \"Google\"\n",
+ " [yahoo]: http://search.yahoo.com/ \"Yahoo Search\"\n",
+ " [msn]: http://search.msn.com/ \"MSN Search\"\n"),
+
+ para("Both of the above examples will produce the following HTML output:"),
+
+ verb("<p>I get 10 times more traffic from <a href=\"http://google.com/\"\n",
+ "title=\"Google\">Google</a> than from\n",
+ "<a href=\"http://search.yahoo.com/\" title=\"Yahoo Search\">Yahoo</a>\n",
+ "or <a href=\"http://search.msn.com/\" title=\"MSN Search\">MSN</a>.</p>\n"),
+
+ para("For comparison, here is the same paragraph written using\n" +
+ "Markdown's inline link style:"),
+
+ verb("I get 10 times more traffic from [Google](http://google.com/ \"Google\")\n",
+ "than from [Yahoo](http://search.yahoo.com/ \"Yahoo Search\") or\n",
+ "[MSN](http://search.msn.com/ \"MSN Search\").\n"),
+
+ para("The point of reference-style links is not that they're easier to\n" +
+ "write. The point is that with reference-style links, your document\n" +
+ "source is vastly more readable. Compare the above examples: using\n" +
+ "reference-style links, the paragraph itself is only 81 characters\n" +
+ "long; with inline-style links, it's 176 characters; and as raw HTML,\n" +
+ "it's 234 characters. In the raw HTML, there's more markup than there\n" +
+ "is text."),
+
+ para("With Markdown's reference-style links, a source document much more\n" +
+ "closely resembles the final output, as rendered in a browser. By\n" +
+ "allowing you to move the markup-related metadata out of the paragraph,\n" +
+ "you can add links without interrupting the narrative flow of your\n" +
+ "prose."),
+
+ raw("<h3 id=\"em\">Emphasis</h3>"),
+
+ para("Markdown treats asterisks (<code>*</code>) and underscores (<code>_</code>) as indicators of\n" +
+ "emphasis. Text wrapped with one <code>*</code> or <code>_</code> will be wrapped with an\n" +
+ "HTML <code><em></code> tag; double <code>*</code>'s or <code>_</code>'s will be wrapped with an HTML\n" +
+ "<code><strong></code> tag. E.g., this input:"),
+
+ verb("*single asterisks*\n",
+ "\n",
+ "_single underscores_\n",
+ "\n",
+ "**double asterisks**\n",
+ "\n",
+ "__double underscores__\n"),
+
+ para("will produce:"),
+
+ verb("<em>single asterisks</em>\n",
+ "\n",
+ "<em>single underscores</em>\n",
+ "\n",
+ "<strong>double asterisks</strong>\n",
+ "\n",
+ "<strong>double underscores</strong>\n"),
+
+ para("You can use whichever style you prefer; the lone restriction is that\n" +
+ "the same character must be used to open and close an emphasis span."),
+
+ para("Emphasis can be used in the middle of a word:"),
+
+ verb("un*fucking*believable\n"),
+
+ para("But if you surround an <code>*</code> or <code>_</code> with spaces, it'll be treated as a\n" +
+ "literal asterisk or underscore."),
+
+ para("To produce a literal asterisk or underscore at a position where it\n" +
+ "would otherwise be used as an emphasis delimiter, you can backslash\n" +
+ "escape it:"),
+
+ verb("\\*this text is surrounded by literal asterisks\\*\n"),
+
+ raw("<h3 id=\"code\">Code</h3>"),
+
+ para("To indicate a span of code, wrap it with backtick quotes (<code>`</code>).\n" +
+ "Unlike a pre-formatted code block, a code span indicates code within a\n" +
+ "normal paragraph. For example:"),
+
+ verb("Use the `printf()` function.\n"),
+
+ para("will produce:"),
+
+ verb("<p>Use the <code>printf()</code> function.</p>\n"),
+
+ para("To include a literal backtick character within a code span, you can use\n" +
+ "multiple backticks as the opening and closing delimiters:"),
+
+ verb("``There is a literal backtick (`) here.``\n"),
+
+ para("which will produce this:"),
+
+ verb("<p><code>There is a literal backtick (`) here.</code></p>\n"),
+
+ para("The backtick delimiters surrounding a code span may include spaces --\n" +
+ "one after the opening, one before the closing. This allows you to place\n" +
+ "literal backtick characters at the beginning or end of a code span:"),
+
+ verb("A single backtick in a code span: `` ` ``\n",
+ "\n",
+ "A backtick-delimited string in a code span: `` `foo` ``\n"),
+
+ para("will produce:"),
+
+ verb("<p>A single backtick in a code span: <code>`</code></p>\n",
+ "\n",
+ "<p>A backtick-delimited string in a code span: <code>`foo`</code></p>\n"),
+
+ para("With a code span, ampersands and angle brackets are encoded as HTML\n" +
+ "entities automatically, which makes it easy to include example HTML\n" +
+ "tags. Markdown will turn this:"),
+
+ verb("Please don't use any `<blink>` tags.\n"),
+
+ para("into:"),
+
+ verb("<p>Please don't use any <code>&lt;blink&gt;</code> tags.</p>\n"),
+
+ para("You can write this:"),
+
+ verb("`&#8212;` is the decimal-encoded equivalent of `&mdash;`.\n"),
+
+ para("to produce:"),
+
+ verb( "<p><code>&amp;#8212;</code> is the decimal-encoded\n",
+ "equivalent of <code>&amp;mdash;</code>.</p>\n"),
+
+ raw("<h3 id=\"img\">Images</h3>"),
+
+ para("Admittedly, it's fairly difficult to devise a \"natural\" syntax for\n" +
+ "placing images into a plain text document format."),
+
+ para("Markdown uses an image syntax that is intended to resemble the syntax\n" +
+ "for links, allowing for two styles: _inline_ and _reference_."),
+
+ para("Inline image syntax looks like this:"),
+
+ verb("![Alt text](/path/to/img.jpg)\n",
+ "\n",
+ "![Alt text](/path/to/img.jpg \"Optional title\")\n"),
+
+ para("That is:"),
+
+ list(:BULLET,
+ item(nil,
+ para("An exclamation mark: <code>!</code>;")),
+ item(nil,
+ para("followed by a set of square brackets, containing the <code>alt</code>\n" +
+ "attribute text for the image;")),
+ item(nil,
+ para("followed by a set of parentheses, containing the URL or path to\n" +
+ "the image, and an optional <code>title</code> attribute enclosed in double\n" +
+ "or single quotes."))),
+
+ para("Reference-style image syntax looks like this:"),
+
+ verb("![Alt text][id]\n"),
+
+ para("Where \"id\" is the name of a defined image reference. Image references\n" +
+ "are defined using syntax identical to link references:"),
+
+ verb("[id]: url/to/image \"Optional title attribute\"\n"),
+
+ para("As of this writing, Markdown has no syntax for specifying the\n" +
+ "dimensions of an image; if this is important to you, you can simply\n" +
+ "use regular HTML <code><img></code> tags."),
+
+ rule(1),
+
+ raw("<h2 id=\"misc\">Miscellaneous</h2>"),
+
+ raw("<h3 id=\"autolink\">Automatic Links</h3>"),
+
+ para("Markdown supports a shortcut style for creating \"automatic\" links for URLs and email addresses: simply surround the URL or email address with angle brackets. What this means is that if you want to show the actual text of a URL or email address, and also have it be a clickable link, you can do this:"),
+
+ verb("<http://example.com/>\n"),
+
+ para("Markdown will turn this into:"),
+
+ verb("<a href=\"http://example.com/\">http://example.com/</a>\n"),
+
+ para("Automatic links for email addresses work similarly, except that\n" +
+ "Markdown will also perform a bit of randomized decimal and hex\n" +
+ "entity-encoding to help obscure your address from address-harvesting\n" +
+ "spambots. For example, Markdown will turn this:"),
+
+ verb("<address@example.com>\n"),
+
+ para("into something like this:"),
+
+ verb("<a href=\"&#x6D;&#x61;i&#x6C;&#x74;&#x6F;:&#x61;&#x64;&#x64;&#x72;&#x65;\n",
+ "&#115;&#115;&#64;&#101;&#120;&#x61;&#109;&#x70;&#x6C;e&#x2E;&#99;&#111;\n",
+ "&#109;\">&#x61;&#x64;&#x64;&#x72;&#x65;&#115;&#115;&#64;&#101;&#120;&#x61;\n",
+ "&#109;&#x70;&#x6C;e&#x2E;&#99;&#111;&#109;</a>\n"),
+
+ para("which will render in a browser as a clickable link to \"address@example.com\"."),
+
+ para("(This sort of entity-encoding trick will indeed fool many, if not\n" +
+ "most, address-harvesting bots, but it definitely won't fool all of\n" +
+ "them. It's better than nothing, but an address published in this way\n" +
+ "will probably eventually start receiving spam.)"),
+
+ raw("<h3 id=\"backslash\">Backslash Escapes</h3>"),
+
+ para("Markdown allows you to use backslash escapes to generate literal\n" +
+ "characters which would otherwise have special meaning in Markdown's\n" +
+ "formatting syntax. For example, if you wanted to surround a word with\n" +
+ "literal asterisks (instead of an HTML <code><em></code> tag), you can backslashes\n" +
+ "before the asterisks, like this:"),
+
+ verb("\\*literal asterisks\\*\n"),
+
+ para("Markdown provides backslash escapes for the following characters:"),
+
+ verb("\\ backslash\n",
+ "` backtick\n",
+ "* asterisk\n",
+ "_ underscore\n",
+ "{} curly braces\n",
+ "[] square brackets\n",
+ "() parentheses\n",
+ "# hash mark\n",
+ "+ plus sign\n",
+ "- minus sign (hyphen)\n",
+ ". dot\n",
+ "! exclamation mark\n"))
+
+ assert_equal expected, doc
+ end
+
+ def test_nested_blockquotes
+ input = File.read "#{MARKDOWN_TEST_PATH}/Nested blockquotes.text"
+
+ doc = @parser.parse input
+
+ expected =
+ doc(
+ block(
+ para("foo"),
+ block(
+ para("bar")),
+ para("foo")))
+
+ assert_equal expected, doc
+ end
+
+ def test_ordered_and_unordered_lists
+ input = File.read "#{MARKDOWN_TEST_PATH}/Ordered and unordered lists.text"
+
+ doc = @parser.parse input
+
+ expected =
+ doc(
+ head(2, 'Unordered'),
+
+ para('Asterisks tight:'),
+ list(:BULLET,
+ item(nil, para("asterisk 1")),
+ item(nil, para("asterisk 2")),
+ item(nil, para("asterisk 3"))),
+ para('Asterisks loose:'),
+ list(:BULLET,
+ item(nil, para("asterisk 1")),
+ item(nil, para("asterisk 2")),
+ item(nil, para("asterisk 3"))),
+
+ rule(1),
+
+ para("Pluses tight:"),
+ list(:BULLET,
+ item(nil, para("Plus 1")),
+ item(nil, para("Plus 2")),
+ item(nil, para("Plus 3"))),
+ para("Pluses loose:"),
+ list(:BULLET,
+ item(nil, para("Plus 1")),
+ item(nil, para("Plus 2")),
+ item(nil, para("Plus 3"))),
+
+ rule(1),
+
+ para("Minuses tight:"),
+ list(:BULLET,
+ item(nil, para("Minus 1")),
+ item(nil, para("Minus 2")),
+ item(nil, para("Minus 3"))),
+ para("Minuses loose:"),
+ list(:BULLET,
+ item(nil, para("Minus 1")),
+ item(nil, para("Minus 2")),
+ item(nil, para("Minus 3"))),
+
+ head(2, "Ordered"),
+
+ para("Tight:"),
+ list(:NUMBER,
+ item(nil, para("First")),
+ item(nil, para("Second")),
+ item(nil, para("Third"))),
+ para("and:"),
+ list(:NUMBER,
+ item(nil, para("One")),
+ item(nil, para("Two")),
+ item(nil, para("Three"))),
+
+ para("Loose using tabs:"),
+ list(:NUMBER,
+ item(nil, para("First")),
+ item(nil, para("Second")),
+ item(nil, para("Third"))),
+ para("and using spaces:"),
+ list(:NUMBER,
+ item(nil, para("One")),
+ item(nil, para("Two")),
+ item(nil, para("Three"))),
+
+ para("Multiple paragraphs:"),
+ list(:NUMBER,
+ item(nil,
+ para("Item 1, graf one."),
+ para("Item 2. graf two. The quick brown fox " +
+ "jumped over the lazy dog's\nback.")),
+ item(nil, para("Item 2.")),
+ item(nil, para("Item 3."))),
+
+ head(2, "Nested"),
+ list(:BULLET,
+ item(nil,
+ para("Tab"),
+ list(:BULLET,
+ item(nil,
+ para("Tab"),
+ list(:BULLET,
+ item(nil,
+ para("Tab"))))))),
+
+ para("Here's another:"),
+ list(:NUMBER,
+ item(nil, para("First")),
+ item(nil, para("Second:"),
+ list(:BULLET,
+ item(nil, para("Fee")),
+ item(nil, para("Fie")),
+ item(nil, para("Foe")))),
+ item(nil, para("Third"))),
+
+ para("Same thing but with paragraphs:"),
+ list(:NUMBER,
+ item(nil, para("First")),
+ item(nil, para("Second:"),
+ list(:BULLET,
+ item(nil, para("Fee")),
+ item(nil, para("Fie")),
+ item(nil, para("Foe")))),
+ item(nil, para("Third"))),
+
+ para("This was an error in Markdown 1.0.1:"),
+ list(:BULLET,
+ item(nil,
+ para("this"),
+ list(:BULLET,
+ item(nil, para("sub"))),
+ para("that"))))
+
+ assert_equal expected, doc
+ end
+
+ def test_strong_and_em_together
+ input = File.read "#{MARKDOWN_TEST_PATH}/Strong and em together.text"
+
+ doc = @parser.parse input
+
+ expected =
+ doc(
+ para("<b><em>This is strong and em.</em></b>"),
+ para("So is <b>_this_</b> word."),
+ para("<b><em>This is strong and em.</em></b>"),
+ para("So is <b>_this_</b> word."))
+
+ assert_equal expected, doc
+ end
+
+ def test_tabs
+ input = File.read "#{MARKDOWN_TEST_PATH}/Tabs.text"
+
+ doc = @parser.parse input
+
+ expected =
+ doc(
+ list(:BULLET,
+ item(nil,
+ para("this is a list item\nindented with tabs")),
+ item(nil,
+ para("this is a list item\nindented with spaces"))),
+
+ para("Code:"),
+
+ verb("this code block is indented by one tab\n"),
+
+ para("And:"),
+
+ verb("\tthis code block is indented by two tabs\n"),
+
+ para("And:"),
+
+ verb(
+ "+\tthis is an example list item\n",
+ "\tindented with tabs\n",
+ "\n",
+ "+ this is an example list item\n",
+ " indented with spaces\n"))
+
+ assert_equal expected, doc
+ end
+
+ def test_tidyness
+ input = File.read "#{MARKDOWN_TEST_PATH}/Tidyness.text"
+
+ doc = @parser.parse input
+
+ expected =
+ doc(
+ block(
+ para("A list within a blockquote:"),
+ list(:BULLET,
+ item(nil, para("asterisk 1")),
+ item(nil, para("asterisk 2")),
+ item(nil, para("asterisk 3")))))
+
+ assert_equal expected, doc
+ end
+
+end
+
diff --git a/test/rdoc/test_rdoc_markup.rb b/test/rdoc/test_rdoc_markup.rb
index ae6c11e7da..5c28a2c6e6 100644
--- a/test/rdoc/test_rdoc_markup.rb
+++ b/test/rdoc/test_rdoc_markup.rb
@@ -1,9 +1,13 @@
-require 'rubygems'
-require 'minitest/autorun'
-require 'rdoc/markup'
-require 'rdoc/markup/to_test'
+require 'rdoc/test_case'
-class TestRDocMarkup < MiniTest::Unit::TestCase
+class TestRDocMarkup < RDoc::TestCase
+
+ def test_class_parse
+ expected = @RM::Document.new(
+ @RM::Paragraph.new('hello'))
+
+ assert_equal expected, RDoc::Markup.parse('hello')
+ end
def test_convert
str = <<-STR
@@ -44,7 +48,7 @@ the time
m = RDoc::Markup.new
m.add_word_pair '{', '}', :STRIKE
- tt = RDoc::Markup::ToTest.new m
+ tt = RDoc::Markup::ToTest.new nil, m
tt.add_tag :STRIKE, 'STRIKE ', ' STRIKE'
out = m.convert str, tt
diff --git a/test/rdoc/test_rdoc_markup_attribute_manager.rb b/test/rdoc/test_rdoc_markup_attribute_manager.rb
index b65457fc7e..9fe4476229 100644
--- a/test/rdoc/test_rdoc_markup_attribute_manager.rb
+++ b/test/rdoc/test_rdoc_markup_attribute_manager.rb
@@ -1,13 +1,10 @@
-require 'rubygems'
-require 'minitest/autorun'
-require 'rdoc'
-require 'rdoc/markup'
-require 'rdoc/markup/inline'
-require 'rdoc/markup/to_html_crossref'
+require 'rdoc/test_case'
-class TestRDocMarkupAttributeManager < MiniTest::Unit::TestCase
+class TestRDocMarkupAttributeManager < RDoc::TestCase
def setup
+ super
+
@am = RDoc::Markup::AttributeManager.new
@bold_on = @am.changed_attribute_by_name([], [:BOLD])
@@ -29,11 +26,17 @@ class TestRDocMarkupAttributeManager < MiniTest::Unit::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)
- crossref_bitmap = RDoc::Markup::Attribute.bitmap_for(:_SPECIAL_) |
- RDoc::Markup::Attribute.bitmap_for(:CROSSREF)
+ crossref_bitmap = @am.attributes.bitmap_for(:_SPECIAL_) |
+ @am.attributes.bitmap_for(:CROSSREF)
[ @am.changed_attribute_by_name([], [:CROSSREF, :_SPECIAL_]),
RDoc::Markup::Special.new(crossref_bitmap, text),
@@ -47,6 +50,21 @@ class TestRDocMarkupAttributeManager < MiniTest::Unit::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'
@@ -63,6 +81,20 @@ class TestRDocMarkupAttributeManager < MiniTest::Unit::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'
@@ -154,6 +186,56 @@ class TestRDocMarkupAttributeManager < MiniTest::Unit::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>")
@@ -194,6 +276,38 @@ class TestRDocMarkupAttributeManager < MiniTest::Unit::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'))
@@ -212,7 +326,7 @@ class TestRDocMarkupAttributeManager < MiniTest::Unit::TestCase
end
def test_special
- @am.add_special(RDoc::Markup::ToHtmlCrossref::CROSSREF_REGEXP, :CROSSREF)
+ @am.add_special(RDoc::CrossReference::CROSSREF_REGEXP, :CROSSREF)
#
# The apostrophes in "cats'" and "dogs'" suppress the flagging of these
@@ -236,5 +350,9 @@ class TestRDocMarkupAttributeManager < MiniTest::Unit::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_attributes.rb b/test/rdoc/test_rdoc_markup_attributes.rb
new file mode 100644
index 0000000000..636e0cca68
--- /dev/null
+++ b/test/rdoc/test_rdoc_markup_attributes.rb
@@ -0,0 +1,39 @@
+require 'rdoc/test_case'
+
+class TestRDocMarkupAttributes < RDoc::TestCase
+
+ def setup
+ super
+
+ @as = RDoc::Markup::Attributes.new
+ end
+
+ def test_bitmap_for
+ assert_equal 2, @as.bitmap_for('two')
+ assert_equal 2, @as.bitmap_for('two')
+ assert_equal 4, @as.bitmap_for('three')
+ end
+
+ def test_as_string
+ @as.bitmap_for 'two'
+ @as.bitmap_for 'three'
+
+ assert_equal 'none', @as.as_string(0)
+ assert_equal '_SPECIAL_', @as.as_string(1)
+ assert_equal 'two', @as.as_string(2)
+ assert_equal '_SPECIAL_,two', @as.as_string(3)
+ end
+
+ def test_each_name_of
+ @as.bitmap_for 'two'
+ @as.bitmap_for 'three'
+
+ assert_equal %w[], @as.each_name_of(0).to_a
+ assert_equal %w[], @as.each_name_of(1).to_a
+ assert_equal %w[two], @as.each_name_of(2).to_a
+ assert_equal %w[three], @as.each_name_of(4).to_a
+ assert_equal %w[two three], @as.each_name_of(6).to_a
+ end
+
+end
+
diff --git a/test/rdoc/test_rdoc_markup_document.rb b/test/rdoc/test_rdoc_markup_document.rb
index 9eea019ae4..718ae6d4c4 100644
--- a/test/rdoc/test_rdoc_markup_document.rb
+++ b/test/rdoc/test_rdoc_markup_document.rb
@@ -1,20 +1,11 @@
-require 'pp'
-require 'rubygems'
-require 'minitest/autorun'
-require 'rdoc/markup'
+require 'rdoc/test_case'
-class TestRDocMarkupDocument < MiniTest::Unit::TestCase
+class TestRDocMarkupDocument < RDoc::TestCase
def setup
- @RM = RDoc::Markup
- @d = @RM::Document.new
- end
+ super
- def mu_pp obj
- s = ''
- s = PP.pp obj, s
- s.force_encoding Encoding.default_external if defined? Encoding
- s.chomp
+ @d = @RM::Document.new
end
def test_append
@@ -47,6 +38,21 @@ class TestRDocMarkupDocument < MiniTest::Unit::TestCase
end
end
+ def test_concat
+ @d.concat [@RM::BlankLine.new, @RM::BlankLine.new]
+
+ refute_empty @d
+ end
+
+ def test_each
+ a = @RM::Document.new
+ b = @RM::Document.new(@RM::Paragraph.new('hi'))
+
+ @d.push a, b
+
+ assert_equal [a, b], @d.map { |sub_doc| sub_doc }
+ end
+
def test_empty_eh
assert_empty @d
@@ -82,6 +88,18 @@ class TestRDocMarkupDocument < MiniTest::Unit::TestCase
assert_equal @d, d2
end
+ def test_file_equals
+ @d.file = 'file.rb'
+
+ assert_equal 'file.rb', @d.file
+ end
+
+ def test_file_equals_top_level
+ @d.file = @store.add_file 'file.rb'
+
+ assert_equal 'file.rb', @d.file
+ end
+
def test_lt2
@d << @RM::BlankLine.new
@@ -148,5 +166,42 @@ class TestRDocMarkupDocument < MiniTest::Unit::TestCase
refute_empty @d
end
+ def test_table_of_contents
+ doc = @RM::Document.new(
+ @RM::Heading.new(1, 'A'),
+ @RM::Paragraph.new('B'),
+ @RM::Heading.new(2, 'C'),
+ @RM::Paragraph.new('D'),
+ @RM::Heading.new(1, 'E'),
+ @RM::Paragraph.new('F'))
+
+ expected = [
+ @RM::Heading.new(1, 'A'),
+ @RM::Heading.new(2, 'C'),
+ @RM::Heading.new(1, 'E'),
+ ]
+
+ assert_equal expected, doc.table_of_contents
+ end
+
+ def test_table_of_contents_omit_headings_below
+ document = doc(
+ head(1, 'A'),
+ para('B'),
+ head(2, 'C'),
+ para('D'),
+ head(1, 'E'),
+ para('F'))
+
+ document.omit_headings_below = 1
+
+ expected = [
+ head(1, 'A'),
+ head(1, 'E'),
+ ]
+
+ assert_equal expected, document.table_of_contents
+ end
+
end
diff --git a/test/rdoc/test_rdoc_markup_formatter.rb b/test/rdoc/test_rdoc_markup_formatter.rb
index 73e75e2aa1..d01a42fca6 100644
--- a/test/rdoc/test_rdoc_markup_formatter.rb
+++ b/test/rdoc/test_rdoc_markup_formatter.rb
@@ -1,17 +1,13 @@
-require 'rubygems'
-require 'minitest/autorun'
-require 'rdoc'
-require 'rdoc/markup'
-require 'rdoc/markup/formatter'
+require 'rdoc/test_case'
-class TestRDocMarkupFormatter < MiniTest::Unit::TestCase
+class TestRDocMarkupFormatter < RDoc::TestCase
class ToTest < RDoc::Markup::Formatter
def initialize markup
- super
+ super nil, markup
- add_tag :TT, '<tt>', '</tt>'
+ add_tag :TT, '<code>', '</code>'
end
def accept_paragraph paragraph
@@ -37,20 +33,142 @@ class TestRDocMarkupFormatter < MiniTest::Unit::TestCase
end
def setup
- @markup = RDoc::Markup.new
+ super
+
+ @markup = @RM.new
@markup.add_special(/[A-Z]+/, :CAPS)
+ @attribute_manager = @markup.attribute_manager
+ @attributes = @attribute_manager.attributes
+
@to = ToTest.new @markup
- @caps = RDoc::Markup::Attribute.bitmap_for :CAPS
- @special = RDoc::Markup::Attribute.bitmap_for :_SPECIAL_
- @tt = RDoc::Markup::Attribute.bitmap_for :TT
+ @caps = @attributes.bitmap_for :CAPS
+ @special = @attributes.bitmap_for :_SPECIAL_
+ @tt = @attributes.bitmap_for :TT
+ end
+
+ def test_class_gen_relative_url
+ def gen(from, to)
+ RDoc::Markup::ToHtml.gen_relative_url from, to
+ end
+
+ assert_equal 'a.html', gen('a.html', 'a.html')
+ assert_equal 'b.html', gen('a.html', 'b.html')
+
+ assert_equal 'd.html', gen('a/c.html', 'a/d.html')
+ assert_equal '../a.html', gen('a/c.html', 'a.html')
+ assert_equal 'a/c.html', gen('a.html', 'a/c.html')
+ end
+
+ def special_names
+ @attribute_manager.special.map do |_, mask|
+ @attributes.as_string mask
+ end
+ end
+
+ def test_add_special_RDOCLINK
+ @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 'example/foo', url
+ assert_equal nil, id
+ end
+
+ def test_parse_url_anchor
+ scheme, url, id = @to.parse_url '#foottext-1'
+
+ assert_equal nil, scheme
+ assert_equal '#foottext-1', url
+ assert_equal nil, id
+ end
+
+ def test_parse_url_link
+ scheme, url, id = @to.parse_url 'link:README.txt'
+
+ assert_equal 'link', scheme
+ assert_equal 'README.txt', url
+ assert_equal nil, id
+ end
+
+ def test_parse_url_link_id
+ scheme, url, id = @to.parse_url 'link:README.txt#label-foo'
+
+ assert_equal 'link', scheme
+ assert_equal 'README.txt#label-foo', url
+ assert_equal nil, id
+ end
+
+ def test_parse_url_rdoc_label
+ scheme, url, id = @to.parse_url 'rdoc-label:foo'
+
+ assert_equal 'link', scheme
+ assert_equal '#foo', url
+ assert_equal nil, id
+
+ scheme, url, id = @to.parse_url 'rdoc-label:foo:bar'
+
+ assert_equal 'link', scheme
+ assert_equal '#foo', url
+ assert_equal ' id="bar"', id
+ end
+
+ def test_parse_url_scheme
+ scheme, url, id = @to.parse_url 'http://example/foo'
+
+ assert_equal 'http', scheme
+ assert_equal 'http://example/foo', url
+ assert_equal nil, id
+
+ scheme, url, id = @to.parse_url 'https://example/foo'
+
+ assert_equal 'https', scheme
+ assert_equal 'https://example/foo', url
+ assert_equal nil, id
end
def test_convert_tt_special
- converted = @to.convert '<tt>AAA</tt>'
+ converted = @to.convert '<code>AAA</code>'
- assert_equal '<tt>AAA</tt>', converted
+ assert_equal '<code>AAA</code>', converted
end
end
diff --git a/test/rdoc/test_rdoc_markup_hard_break.rb b/test/rdoc/test_rdoc_markup_hard_break.rb
new file mode 100644
index 0000000000..b9f7873160
--- /dev/null
+++ b/test/rdoc/test_rdoc_markup_hard_break.rb
@@ -0,0 +1,31 @@
+require 'rdoc/test_case'
+
+class TestRDocMarkupHardBreak < RDoc::TestCase
+
+ def setup
+ super
+
+ @hb = RDoc::Markup::HardBreak.new
+ end
+
+ def test_accept
+ visitor = Object.new
+
+ def visitor.accept_hard_break(obj) @obj = obj end
+ def visitor.obj() @obj end
+
+ @hb.accept visitor
+
+ assert_same @hb, visitor.obj
+ end
+
+ def test_equals2
+ other = RDoc::Markup::HardBreak.new
+
+ assert_equal @hb, other
+
+ refute_equal @hb, Object.new
+ end
+
+end
+
diff --git a/test/rdoc/test_rdoc_markup_heading.rb b/test/rdoc/test_rdoc_markup_heading.rb
new file mode 100644
index 0000000000..ff53ff5ac3
--- /dev/null
+++ b/test/rdoc/test_rdoc_markup_heading.rb
@@ -0,0 +1,29 @@
+require 'rdoc/test_case'
+
+class TestRDocMarkupHeading < RDoc::TestCase
+
+ def setup
+ super
+
+ @h = RDoc::Markup::Heading.new 1, 'Hello *Friend*!'
+ end
+
+ def test_aref
+ 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
+
+end
+
diff --git a/test/rdoc/test_rdoc_markup_include.rb b/test/rdoc/test_rdoc_markup_include.rb
new file mode 100644
index 0000000000..37a5b320e9
--- /dev/null
+++ b/test/rdoc/test_rdoc_markup_include.rb
@@ -0,0 +1,19 @@
+require 'rdoc/test_case'
+
+class TestRDocMarkupInclude < RDoc::TestCase
+
+ def setup
+ super
+
+ @include = @RM::Include.new 'file', [Dir.tmpdir]
+ end
+
+ def test_equals2
+ assert_equal @include, @RM::Include.new('file', [Dir.tmpdir])
+ refute_equal @include, @RM::Include.new('file', %w[.])
+ refute_equal @include, @RM::Include.new('other', [Dir.tmpdir])
+ refute_equal @include, Object.new
+ end
+
+end
+
diff --git a/test/rdoc/test_rdoc_markup_indented_paragraph.rb b/test/rdoc/test_rdoc_markup_indented_paragraph.rb
index e3e2b630e1..d8dd795e5b 100644
--- a/test/rdoc/test_rdoc_markup_indented_paragraph.rb
+++ b/test/rdoc/test_rdoc_markup_indented_paragraph.rb
@@ -1,11 +1,10 @@
-require 'pp'
-require 'rubygems'
-require 'minitest/autorun'
-require 'rdoc/markup'
+require 'rdoc/test_case'
-class TestRDocMarkupIndentedParagraph < MiniTest::Unit::TestCase
+class TestRDocMarkupIndentedParagraph < RDoc::TestCase
def setup
+ super
+
@IP = RDoc::Markup::IndentedParagraph
end
@@ -36,5 +35,19 @@ class TestRDocMarkupIndentedParagraph < MiniTest::Unit::TestCase
refute_equal one, two
end
+ def test_text
+ paragraph = @IP.new(2, 'hello', ' world')
+
+ assert_equal 'hello world', paragraph.text
+ end
+
+ def test_text_break
+ paragraph = @IP.new(2, 'hello', hard_break, 'world')
+
+ assert_equal 'helloworld', paragraph.text
+
+ assert_equal "hello\n world", paragraph.text("\n")
+ end
+
end
diff --git a/test/rdoc/test_rdoc_markup_paragraph.rb b/test/rdoc/test_rdoc_markup_paragraph.rb
index 6ae1ad9a84..8de1c3cff5 100644
--- a/test/rdoc/test_rdoc_markup_paragraph.rb
+++ b/test/rdoc/test_rdoc_markup_paragraph.rb
@@ -1,9 +1,6 @@
-require 'pp'
-require 'rubygems'
-require 'minitest/autorun'
-require 'rdoc/markup'
+require 'rdoc/test_case'
-class TestRDocMarkupParagraph < MiniTest::Unit::TestCase
+class TestRDocMarkupParagraph < RDoc::TestCase
def test_accept
visitor = Object.new
@@ -14,7 +11,21 @@ class TestRDocMarkupParagraph < MiniTest::Unit::TestCase
paragraph.accept visitor
- assert_equal paragraph, visitor.obj
+ assert_same paragraph, visitor.obj
+ end
+
+ def test_text
+ paragraph = para('hello', ' world')
+
+ assert_equal 'hello world', paragraph.text
+ end
+
+ def test_text_break
+ paragraph = para('hello', hard_break, 'world')
+
+ assert_equal 'helloworld', paragraph.text
+
+ assert_equal "hello\nworld", paragraph.text("\n")
end
end
diff --git a/test/rdoc/test_rdoc_markup_parser.rb b/test/rdoc/test_rdoc_markup_parser.rb
index e214c4defc..d27fb42f9a 100644
--- a/test/rdoc/test_rdoc_markup_parser.rb
+++ b/test/rdoc/test_rdoc_markup_parser.rb
@@ -1,22 +1,15 @@
# coding: utf-8
-require 'pp'
-require 'rubygems'
-require 'minitest/autorun'
-require 'rdoc/markup'
+require 'rdoc/test_case'
-class TestRDocMarkupParser < MiniTest::Unit::TestCase
+class TestRDocMarkupParser < RDoc::TestCase
def setup
- @RM = RDoc::Markup
- @RMP = @RM::Parser
- end
+ super
+
+ @have_byteslice = ''.respond_to? :byteslice
- def mu_pp(obj)
- s = ''
- s = PP.pp obj, s
- s = s.force_encoding(Encoding.default_external) if defined? Encoding
- s.chomp
+ @RMP = @RM::Parser
end
def test_build_heading
@@ -30,6 +23,19 @@ class TestRDocMarkupParser < MiniTest::Unit::TestCase
assert_equal @RM::Heading.new(3, 'heading three'), parser.build_heading(3)
end
+ def test_char_pos
+ parser = @RMP.new
+ s = parser.setup_scanner 'cät'
+
+ s.scan(/\S+/)
+
+ if @have_byteslice or @have_encoding then
+ assert_equal 3, parser.char_pos(s.pos)
+ else
+ assert_equal 4, parser.char_pos(s.pos)
+ end
+ end
+
def test_get
parser = util_parser
@@ -148,13 +154,11 @@ the time
STR
expected = [
- @RM::List.new(:BULLET, *[
- @RM::ListItem.new(nil,
- @RM::Paragraph.new('l1', 'l1+')),
- @RM::ListItem.new(nil,
- @RM::Paragraph.new('l2')),
- ]),
- ]
+ list(:BULLET,
+ item(nil,
+ para('l1 ', 'l1+')),
+ item(nil,
+ para('l2')))]
assert_equal expected, @RMP.parse(str).parts
end
@@ -191,16 +195,16 @@ the time
STR
expected = [
- @RM::List.new(:BULLET, *[
- @RM::ListItem.new(nil,
- @RM::Paragraph.new('l1'),
- @RM::List.new(:BULLET, *[
- @RM::ListItem.new(nil,
- @RM::Paragraph.new('l1.1', 'text'),
- @RM::Verbatim.new("code\n", " code\n"),
- @RM::Paragraph.new('text'))])),
- @RM::ListItem.new(nil,
- @RM::Paragraph.new('l2'))])]
+ list(:BULLET,
+ item(nil,
+ para('l1'),
+ list(:BULLET,
+ item(nil,
+ para('l1.1 ', 'text'),
+ verb("code\n", " code\n"),
+ para('text')))),
+ item(nil,
+ para('l2')))]
assert_equal expected, @RMP.parse(str).parts
end
@@ -326,11 +330,11 @@ the time
STR
expected = [
- @RM::List.new(:LABEL, *[
- @RM::ListItem.new('one',
- @RM::Paragraph.new('item one')),
- @RM::ListItem.new('two',
- @RM::Paragraph.new('item two'))])]
+ list(:LABEL,
+ item(%w[one],
+ para('item one')),
+ item(%w[two],
+ para('item two')))]
assert_equal expected, @RMP.parse(str).parts
end
@@ -343,19 +347,33 @@ the time
STR
expected = [
- @RM::List.new(:LABEL, *[
- @RM::ListItem.new('cat',
- @RM::Paragraph.new('l1'),
- @RM::List.new(:BULLET, *[
- @RM::ListItem.new(nil,
- @RM::Paragraph.new('l1.1'))])),
- @RM::ListItem.new('dog',
- @RM::Paragraph.new('l2'))])]
+ list(:LABEL,
+ item(%w[cat],
+ para('l1'),
+ list(:BULLET,
+ item(nil,
+ para('l1.1')))),
+ item(%w[dog],
+ para('l2')))]
assert_equal expected, @RMP.parse(str).parts
end
- def test_parse_label_multiline
+ def test_parse_label_multi_label
+ str = <<-STR
+[one]
+[two] some description
+ STR
+
+ expected = [
+ list(:LABEL,
+ item(%w[one two],
+ para('some description')))]
+
+ assert_equal expected, @RMP.parse(str).parts
+ end
+
+ def test_parse_label_multi_line
str = <<-STR
[cat] l1
continuation
@@ -363,11 +381,11 @@ the time
STR
expected = [
- @RM::List.new(:LABEL, *[
- @RM::ListItem.new('cat',
- @RM::Paragraph.new('l1', 'continuation')),
- @RM::ListItem.new('dog',
- @RM::Paragraph.new('l2'))])]
+ list(:LABEL,
+ item(%w[cat],
+ para('l1 ', 'continuation')),
+ item(%w[dog],
+ para('l2')))]
assert_equal expected, @RMP.parse(str).parts
end
@@ -381,12 +399,11 @@ the time
STR
expected = [
- @RM::List.new(:LABEL, *[
- @RM::ListItem.new('one',
- @RM::Paragraph.new('item one')),
- @RM::ListItem.new('two',
- @RM::Paragraph.new('item two')),
- ])]
+ list(:LABEL,
+ item(%w[one],
+ para('item one')),
+ item(%w[two],
+ para('item two')))]
assert_equal expected, @RMP.parse(str).parts
end
@@ -443,6 +460,17 @@ a. æ–°ã—ã„æ©Ÿèƒ½
assert_equal expected, @RMP.parse(str).parts
end
+ def test_parse_line_break
+ str = "now is\nthe time \nfor all"
+
+ expected = [
+ para('now is ', 'the time'),
+ blank_line,
+ para('for all')]
+
+ assert_equal expected, @RMP.parse(str).parts
+ end
+
def test_parse_list_list_1
str = <<-STR
10. para 1
@@ -456,16 +484,16 @@ a. æ–°ã—ã„æ©Ÿèƒ½
STR
expected = [
- @RM::List.new(:NUMBER, *[
- @RM::ListItem.new(nil, *[
- @RM::Paragraph.new('para 1'),
- @RM::BlankLine.new,
- @RM::List.new(:LABEL, *[
- @RM::ListItem.new('label 1', *[
- @RM::Paragraph.new('para 1.1'),
- @RM::BlankLine.new,
- @RM::Verbatim.new("code\n"),
- @RM::Paragraph.new('para 1.2')])])])])]
+ list(:NUMBER,
+ item(nil,
+ para('para 1'),
+ blank_line,
+ list(:LABEL,
+ item(%w[label\ 1],
+ para('para 1.1'),
+ blank_line,
+ verb("code\n"),
+ para('para 1.2')))))]
assert_equal expected, @RMP.parse(str).parts
end
@@ -479,15 +507,15 @@ a. æ–°ã—ã„æ©Ÿèƒ½
STR
expected = [
- @RM::List.new(:NUMBER, *[
- @RM::ListItem.new(nil, *[
- @RM::Paragraph.new('para'),
- @RM::BlankLine.new,
- @RM::List.new(:NOTE, *[
- @RM::ListItem.new('label 1',
- @RM::Paragraph.new('text 1')),
- @RM::ListItem.new('label 2',
- @RM::Paragraph.new('text 2'))])])])]
+ list(:NUMBER,
+ item(nil,
+ para('para'),
+ blank_line,
+ list(:NOTE,
+ item(%w[label\ 1],
+ para('text 1')),
+ item(%w[label\ 2],
+ para('text 2')))))]
assert_equal expected, @RMP.parse(str).parts
end
@@ -546,11 +574,11 @@ two:: item two
STR
expected = [
- @RM::List.new(:NOTE, *[
- @RM::ListItem.new('one',
- @RM::Paragraph.new('item one')),
- @RM::ListItem.new('two',
- @RM::Paragraph.new('item two'))])]
+ list(:NOTE,
+ item(%w[one],
+ para('item one')),
+ item(%w[two],
+ para('item two')))]
assert_equal expected, @RMP.parse(str).parts
end
@@ -562,11 +590,9 @@ two::
STR
expected = [
- @RM::List.new(:NOTE, *[
- @RM::ListItem.new('one',
- @RM::BlankLine.new),
- @RM::ListItem.new('two',
- @RM::BlankLine.new)])]
+ list(:NOTE,
+ item(%w[one two],
+ blank_line))]
assert_equal expected, @RMP.parse(str).parts
end
@@ -577,11 +603,11 @@ one:: two::
STR
expected = [
- @RM::List.new(:NOTE, *[
- @RM::ListItem.new('one',
- @RM::List.new(:NOTE, *[
- @RM::ListItem.new('two',
- @RM::BlankLine.new)]))])]
+ list(:NOTE,
+ item(%w[one],
+ list(:NOTE,
+ item(%w[two],
+ blank_line))))]
assert_equal expected, @RMP.parse(str).parts
end
@@ -594,14 +620,14 @@ one:: two::
STR
expected = [
- @RM::List.new(:NUMBER, *[
- @RM::ListItem.new(nil,
- @RM::Paragraph.new('l1'),
- @RM::List.new(:BULLET, *[
- @RM::ListItem.new(nil,
- @RM::Paragraph.new('l1.1'))])),
- @RM::ListItem.new(nil,
- @RM::Paragraph.new('l2'))])]
+ list(:NUMBER,
+ item(nil,
+ para('l1'),
+ list(:BULLET,
+ item(nil,
+ para('l1.1')))),
+ item(nil,
+ para('l2')))]
assert_equal expected, @RMP.parse(str).parts
end
@@ -623,7 +649,7 @@ for all good men
def test_parse_paragraph_multiline
str = "now is the time\nfor all good men"
- expected = @RM::Paragraph.new 'now is the time for all good men'
+ expected = @RM::Paragraph.new 'now is the time ', 'for all good men'
assert_equal [expected], @RMP.parse(str).parts
end
@@ -1185,6 +1211,38 @@ the time
assert_equal expected, @RMP.tokenize(str)
end
+ def test_tokenize_label_newline
+ str = <<-STR
+[cat]
+ l1
+ STR
+
+ expected = [
+ [:LABEL, 'cat', 0, 0],
+ [:NEWLINE, "\n", 5, 0],
+ [:TEXT, 'l1', 2, 1],
+ [:NEWLINE, "\n", 4, 1],
+ ]
+
+ assert_equal expected, @RMP.tokenize(str)
+ end
+
+ def test_tokenize_label_newline_windows
+ str = <<-STR
+[cat]\r
+ l1\r
+ STR
+
+ expected = [
+ [:LABEL, 'cat', 0, 0],
+ [:NEWLINE, "\n", 6, 0],
+ [:TEXT, 'l1', 2, 1],
+ [:NEWLINE, "\n", 5, 1],
+ ]
+
+ assert_equal expected, @RMP.tokenize(str)
+ end
+
def test_tokenize_lalpha
str = <<-STR
a. l1
@@ -1203,6 +1261,53 @@ b. l1.1
assert_equal expected, @RMP.tokenize(str)
end
+ def test_tokenize_line_break
+ str = "now is\nthe time \nfor all\n"
+
+ expected = [
+ [:TEXT, 'now is', 0, 0],
+ [:NEWLINE, "\n", 6, 0],
+ [:TEXT, 'the time', 0, 1],
+ [:BREAK, " ", 8, 1],
+ [:NEWLINE, "\n", 10, 1],
+ [:TEXT, 'for all', 0, 2],
+ [:NEWLINE, "\n", 7, 2],
+ ]
+
+ assert_equal expected, @RMP.tokenize(str)
+ end
+
+ def test_tokenize_line_break_long
+ str = "now is\nthe time \nfor all\n"
+
+ expected = [
+ [:TEXT, 'now is', 0, 0],
+ [:NEWLINE, "\n", 6, 0],
+ [:TEXT, 'the time ', 0, 1],
+ [:BREAK, ' ', 9, 1],
+ [:NEWLINE, "\n", 11, 1],
+ [:TEXT, 'for all', 0, 2],
+ [:NEWLINE, "\n", 7, 2],
+ ]
+
+ assert_equal expected, @RMP.tokenize(str)
+ end
+
+ def test_tokenize_line_break_no_short
+ str = "now is\nthe time \nfor all\n"
+
+ expected = [
+ [:TEXT, 'now is', 0, 0],
+ [:NEWLINE, "\n", 6, 0],
+ [:TEXT, 'the time ', 0, 1],
+ [:NEWLINE, "\n", 9, 1],
+ [:TEXT, 'for all', 0, 2],
+ [:NEWLINE, "\n", 7, 2],
+ ]
+
+ assert_equal expected, @RMP.tokenize(str)
+ end
+
def test_tokenize_note
str = <<-STR
cat:: l1
@@ -1237,6 +1342,64 @@ dog::
assert_equal expected, @RMP.tokenize(str)
end
+ def test_tokenize_note_newline
+ str = <<-STR
+cat::
+ l1
+ STR
+
+ expected = [
+ [:NOTE, 'cat', 0, 0],
+ [:NEWLINE, "\n", 5, 0],
+ [:TEXT, 'l1', 2, 1],
+ [:NEWLINE, "\n", 4, 1],
+ ]
+
+ assert_equal expected, @RMP.tokenize(str)
+ end
+
+ def test_tokenize_note_utf_8
+ skip 'Encoding not implemented' unless @have_encoding
+
+ str = <<-STR
+cät:: l1a
+ l1b
+døg:: l2a
+ l2b
+ STR
+
+ expected = [
+ [:NOTE, 'cät', 0, 0],
+ [:TEXT, 'l1a', 6, 0],
+ [:NEWLINE, "\n", 9, 0],
+ [:TEXT, 'l1b', 6, 1],
+ [:NEWLINE, "\n", 9, 1],
+ [:NOTE, 'døg', 0, 2],
+ [:TEXT, 'l2a', 6, 2],
+ [:NEWLINE, "\n", 9, 2],
+ [:TEXT, 'l2b', 6, 3],
+ [:NEWLINE, "\n", 9, 3],
+ ]
+
+ assert_equal expected, @RMP.tokenize(str)
+ end
+
+ def test_tokenize_note_newline_windows
+ str = <<-STR
+cat::\r
+ l1\r
+ STR
+
+ expected = [
+ [:NOTE, 'cat', 0, 0],
+ [:NEWLINE, "\n", 6, 0],
+ [:TEXT, 'l1', 2, 1],
+ [:NEWLINE, "\n", 5, 1],
+ ]
+
+ assert_equal expected, @RMP.tokenize(str)
+ end
+
def test_tokenize_note_not
str = <<-STR
Cat::Dog
@@ -1363,6 +1526,24 @@ for all
assert_equal expected, @RMP.tokenize(str)
end
+ def test_tokenize_rule_windows
+ str = <<-STR
+---\r
+
+--- blah ---\r
+ STR
+
+ expected = [
+ [:RULE, 1, 0, 0],
+ [:NEWLINE, "\n", 4, 0],
+ [:NEWLINE, "\n", 0, 1],
+ [:TEXT, "--- blah ---", 0, 2],
+ [:NEWLINE, "\n", 13, 2],
+ ]
+
+ assert_equal expected, @RMP.tokenize(str)
+ end
+
def test_tokenize_ualpha
str = <<-STR
A. l1
@@ -1438,6 +1619,19 @@ Example heading:
assert_equal expected, @RMP.tokenize(str)
end
+ def test_token_pos
+ parser = @RMP.new
+ s = parser.setup_scanner 'cät'
+
+ s.scan(/\S+/)
+
+ if @have_encoding or @have_byteslice then
+ assert_equal [3, 0], parser.token_pos(s.pos)
+ else
+ assert_equal [4, 0], parser.token_pos(s.pos)
+ end
+ end
+
# HACK move to Verbatim test case
def test_verbatim_normalize
v = @RM::Verbatim.new "foo\n", "\n", "\n", "bar\n"
diff --git a/test/rdoc/test_rdoc_markup_pre_process.rb b/test/rdoc/test_rdoc_markup_pre_process.rb
index 34867c8c6b..a241d0dec3 100644
--- a/test/rdoc/test_rdoc_markup_pre_process.rb
+++ b/test/rdoc/test_rdoc_markup_pre_process.rb
@@ -1,30 +1,37 @@
# coding: utf-8
-require 'tempfile'
-require 'rubygems'
-require 'minitest/autorun'
-require 'rdoc/markup/pre_process'
-require 'rdoc/code_objects'
-require 'rdoc/options'
+require 'rdoc/test_case'
-class TestRDocMarkupPreProcess < MiniTest::Unit::TestCase
+class TestRDocMarkupPreProcess < RDoc::TestCase
def setup
- RDoc::Markup::PreProcess.registered.clear
+ super
@tempfile = Tempfile.new 'test_rdoc_markup_pre_process'
@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
- RDoc::Markup::PreProcess.registered.clear
+ super
@tempfile.close
end
+ def test_class_register
+ RDoc::Markup::PreProcess.register 'for_test' do raise 'fail' end
+
+ assert_equal %w[for_test], RDoc::Markup::PreProcess.registered.keys
+ end
+
+ def test_class_post_process
+ RDoc::Markup::PreProcess.post_process do end
+
+ assert_equal 1, RDoc::Markup::PreProcess.post_processors.length
+ end
+
def test_include_file
@tempfile.write <<-INCLUDE
# -*- mode: rdoc; coding: utf-8; fill-column: 74; -*-
@@ -65,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
@@ -73,6 +92,50 @@ contents of a string.
assert_equal "#\n", text
end
+ def test_handle_comment
+ text = "# :main: M\n"
+ c = comment text
+
+ out = @pp.handle c
+
+ assert_same out, text
+ assert_equal "#\n", text
+ end
+
+ def test_handle_markup
+ c = comment ':markup: rd'
+
+ @pp.handle c
+
+ assert_equal 'rd', c.format
+ end
+
+ def test_handle_markup_empty
+ c = comment ':markup:'
+
+ @pp.handle c
+
+ assert_equal 'rdoc', c.format
+ end
+
+ def test_handle_post_process
+ cd = RDoc::CodeObject.new
+
+ RDoc::Markup::PreProcess.post_process do |text, code_object|
+ code_object.metadata[:stuff] = text
+
+ :junk
+ end
+
+ text = "# a b c\n"
+
+ out = @pp.handle text, cd
+
+ assert_same out, text
+ assert_equal "# a b c\n", text
+ assert_equal "# a b c\n", cd.metadata[:stuff]
+ end
+
def test_handle_unregistered
text = "# :x: y\n"
out = @pp.handle text
@@ -84,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
@@ -106,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 4e57b7df39..43bfe0c3b1 100644
--- a/test/rdoc/test_rdoc_markup_raw.rb
+++ b/test/rdoc/test_rdoc_markup_raw.rb
@@ -1,20 +1,11 @@
-require 'pp'
-require 'rubygems'
-require 'minitest/autorun'
-require 'rdoc/markup'
+require 'rdoc/test_case'
-class TestRDocMarkupRaw < MiniTest::Unit::TestCase
+class TestRDocMarkupRaw < RDoc::TestCase
def setup
- @RM = RDoc::Markup
- @p = @RM::Raw.new
- end
+ super
- def mu_pp obj
- s = ''
- s = PP.pp obj, s
- s.force_encoding Encoding.default_external if defined? Encoding
- s.chomp
+ @p = @RM::Raw.new
end
def test_push
@@ -23,5 +14,9 @@ class TestRDocMarkupRaw < MiniTest::Unit::TestCase
assert_equal @RM::Raw.new('hi', 'there'), @p
end
+ def test_pretty_print
+ assert_equal '[raw: ]', mu_pp(@p)
+ end
+
end
diff --git a/test/rdoc/test_rdoc_markup_to_ansi.rb b/test/rdoc/test_rdoc_markup_to_ansi.rb
index f60d1999c2..5afaf94350 100644
--- a/test/rdoc/test_rdoc_markup_to_ansi.rb
+++ b/test/rdoc/test_rdoc_markup_to_ansi.rb
@@ -1,7 +1,4 @@
-require 'rubygems'
-require 'rdoc/markup/text_formatter_test_case'
-require 'rdoc/markup/to_ansi'
-require 'minitest/autorun'
+require 'rdoc/test_case'
class TestRDocMarkupToAnsi < RDoc::Markup::TextFormatterTestCase
@@ -18,6 +15,10 @@ class TestRDocMarkupToAnsi < RDoc::Markup::TextFormatterTestCase
assert_equal "\e[0m\n", @to.res.join
end
+ def accept_block_quote
+ assert_equal "\e[0m> quote\n", @to.res.join
+ end
+
def accept_document
assert_equal "\e[0mhello\n", @to.res.join
end
@@ -67,7 +68,7 @@ class TestRDocMarkupToAnsi < RDoc::Markup::TextFormatterTestCase
end
def accept_list_item_end_label
- assert_equal "\e[0m", @to.res.join
+ assert_equal "\e[0mcat:\n", @to.res.join
assert_equal 0, @to.indent, 'indent'
end
@@ -77,7 +78,7 @@ class TestRDocMarkupToAnsi < RDoc::Markup::TextFormatterTestCase
end
def accept_list_item_end_note
- assert_equal "\e[0m", @to.res.join
+ assert_equal "\e[0mcat:\n", @to.res.join
assert_equal 0, @to.indent, 'indent'
end
@@ -245,10 +246,28 @@ class TestRDocMarkupToAnsi < RDoc::Markup::TextFormatterTestCase
@to.res.join
end
+ def accept_list_item_start_note_multi_description
+ assert_equal "\e[0mlabel:\n description one\n\n description two\n\n",
+ @to.res.join
+ end
+
+ def accept_list_item_start_note_multi_label
+ assert_equal "\e[0mone\ntwo:\n two headers\n\n",
+ @to.res.join
+ end
+
def accept_paragraph_b
assert_equal "\e[0mreg \e[1mbold words\e[m reg\n", @to.end_accepting
end
+ def accept_paragraph_br
+ assert_equal "\e[0mone\ntwo\n", @to.end_accepting
+ end
+
+ def accept_paragraph_break
+ assert_equal "\e[0mhello\nworld\n", @to.end_accepting
+ end
+
def accept_paragraph_i
assert_equal "\e[0mreg \e[4mitalic words\e[m reg\n", @to.end_accepting
end
@@ -328,5 +347,23 @@ words words words words
assert_equal expected, @to.end_accepting
end
+ # functional test
+ def test_convert_list_note
+ note_list = <<-NOTE_LIST
+foo ::
+bar ::
+ hi
+ NOTE_LIST
+
+ expected = <<-EXPECTED
+\e[0mfoo
+bar:
+ hi
+
+ EXPECTED
+
+ assert_equal expected, @to.convert(note_list)
+ end
+
end
diff --git a/test/rdoc/test_rdoc_markup_to_bs.rb b/test/rdoc/test_rdoc_markup_to_bs.rb
index 35a9266b5d..f2e6352b69 100644
--- a/test/rdoc/test_rdoc_markup_to_bs.rb
+++ b/test/rdoc/test_rdoc_markup_to_bs.rb
@@ -1,7 +1,4 @@
-require 'rubygems'
-require 'rdoc/markup/text_formatter_test_case'
-require 'rdoc/markup/to_bs'
-require 'minitest/autorun'
+require 'rdoc/test_case'
class TestRDocMarkupToBs < RDoc::Markup::TextFormatterTestCase
@@ -18,6 +15,10 @@ class TestRDocMarkupToBs < RDoc::Markup::TextFormatterTestCase
assert_equal "\n", @to.res.join
end
+ def accept_block_quote
+ assert_equal "> quote\n", @to.res.join
+ end
+
def accept_document
assert_equal "hello\n", @to.res.join
end
@@ -68,7 +69,7 @@ class TestRDocMarkupToBs < RDoc::Markup::TextFormatterTestCase
end
def accept_list_item_end_label
- assert_equal "\n", @to.res.join
+ assert_equal "cat:\n", @to.res.join
assert_equal 0, @to.indent, 'indent'
end
@@ -78,7 +79,7 @@ class TestRDocMarkupToBs < RDoc::Markup::TextFormatterTestCase
end
def accept_list_item_end_note
- assert_equal "\n", @to.res.join
+ assert_equal "cat:\n", @to.res.join
assert_equal 0, @to.indent, 'indent'
end
@@ -252,12 +253,32 @@ class TestRDocMarkupToBs < RDoc::Markup::TextFormatterTestCase
assert_equal "teletype:\n teletype description\n\n", @to.res.join
end
+ def accept_list_item_start_note_multi_description
+ assert_equal "label:\n description one\n\n description two\n\n",
+ @to.res.join
+ end
+
+ def accept_list_item_start_note_multi_label
+ assert_equal "one\ntwo:\n two headers\n\n", @to.res.join
+ end
+
def accept_paragraph_b
skip "No String#chars, upgrade your ruby" unless ''.respond_to? :chars
assert_equal "reg b\bbo\bol\bld\bd \b w\bwo\bor\brd\bds\bs reg\n",
@to.end_accepting
end
+ def accept_paragraph_br
+ skip "No String#chars, upgrade your ruby" unless ''.respond_to? :chars
+ assert_equal "one\ntwo\n", @to.end_accepting
+ end
+
+ def accept_paragraph_break
+ skip "No String#chars, upgrade your ruby" unless ''.respond_to? :chars
+ assert_equal "hello\nworld\n",
+ @to.end_accepting
+ end
+
def accept_paragraph_i
skip "No String#chars, upgrade your ruby" unless ''.respond_to? :chars
assert_equal "reg _\bi_\bt_\ba_\bl_\bi_\bc_\b _\bw_\bo_\br_\bd_\bs reg\n",
diff --git a/test/rdoc/test_rdoc_markup_to_html.rb b/test/rdoc/test_rdoc_markup_to_html.rb
index 2cb16e88ae..b1addc5dcb 100644
--- a/test/rdoc/test_rdoc_markup_to_html.rb
+++ b/test/rdoc/test_rdoc_markup_to_html.rb
@@ -1,7 +1,4 @@
-require 'rubygems'
-require 'rdoc/markup/formatter_test_case'
-require 'rdoc/markup/to_html'
-require 'minitest/autorun'
+require 'rdoc/test_case'
class TestRDocMarkupToHtml < RDoc::Markup::FormatterTestCase
@@ -10,56 +7,71 @@ class TestRDocMarkupToHtml < RDoc::Markup::FormatterTestCase
def setup
super
- @to = RDoc::Markup::ToHtml.new
- end
-
- def test_class_gen_relative_url
- def gen(from, to)
- RDoc::Markup::ToHtml.gen_relative_url from, to
- end
-
- assert_equal 'a.html', gen('a.html', 'a.html')
- assert_equal 'b.html', gen('a.html', 'b.html')
-
- assert_equal 'd.html', gen('a/c.html', 'a/d.html')
- assert_equal '../a.html', gen('a/c.html', 'a.html')
- assert_equal 'a/c.html', gen('a.html', 'a/c.html')
+ @to = RDoc::Markup::ToHtml.new @options
end
def accept_blank_line
assert_empty @to.res.join
end
+ def accept_block_quote
+ assert_equal "\n<blockquote>\n<p>quote</p>\n</blockquote>\n", @to.res.join
+ end
+
def accept_document
assert_equal "\n<p>hello</p>\n", @to.res.join
end
def accept_heading
- assert_equal "\n<h5>Hello</h5>\n", @to.res.join
+ links = '<span><a href="#label-Hello">&para;</a> ' +
+ '<a href="#documentation">&uarr;</a></span>'
+ expected = "\n<h5 id=\"label-Hello\">Hello#{links}</h5>\n"
+
+ assert_equal expected, @to.res.join
end
def accept_heading_1
- assert_equal "\n<h1>Hello</h1>\n", @to.res.join
+ links = '<span><a href="#label-Hello">&para;</a> ' +
+ '<a href="#documentation">&uarr;</a></span>'
+
+ assert_equal "\n<h1 id=\"label-Hello\">Hello#{links}</h1>\n", @to.res.join
end
def accept_heading_2
- assert_equal "\n<h2>Hello</h2>\n", @to.res.join
+ links = '<span><a href="#label-Hello">&para;</a> ' +
+ '<a href="#documentation">&uarr;</a></span>'
+
+ assert_equal "\n<h2 id=\"label-Hello\">Hello#{links}</h2>\n", @to.res.join
end
def accept_heading_3
- assert_equal "\n<h3>Hello</h3>\n", @to.res.join
+ links = '<span><a href="#label-Hello">&para;</a> ' +
+ '<a href="#documentation">&uarr;</a></span>'
+
+ assert_equal "\n<h3 id=\"label-Hello\">Hello#{links}</h3>\n", @to.res.join
end
def accept_heading_4
- assert_equal "\n<h4>Hello</h4>\n", @to.res.join
+ links = '<span><a href="#label-Hello">&para;</a> ' +
+ '<a href="#documentation">&uarr;</a></span>'
+
+ assert_equal "\n<h4 id=\"label-Hello\">Hello#{links}</h4>\n", @to.res.join
end
def accept_heading_b
- assert_equal "\n<h1><b>Hello</b></h1>\n", @to.res.join
+ links = '<span><a href="#label-Hello">&para;</a> ' +
+ '<a href="#documentation">&uarr;</a></span>'
+ inner = "<strong>Hello</strong>"
+
+ assert_equal "\n<h1 id=\"label-Hello\">#{inner}#{links}</h1>\n",
+ @to.res.join
end
def accept_heading_suppressed_crossref
- assert_equal "\n<h1>Hello</h1>\n", @to.res.join
+ links = '<span><a href="#label-Hello">&para;</a> ' +
+ '<a href="#documentation">&uarr;</a></span>'
+
+ assert_equal "\n<h1 id=\"label-Hello\">Hello#{links}</h1>\n", @to.res.join
end
def accept_list_end_bullet
@@ -73,14 +85,14 @@ class TestRDocMarkupToHtml < RDoc::Markup::FormatterTestCase
assert_equal [], @to.list
assert_equal [], @to.in_list_entry
- assert_equal "<dl class=\"rdoc-list\"></dl>\n", @to.res.join
+ assert_equal "<dl class=\"rdoc-list label-list\"></dl>\n", @to.res.join
end
def accept_list_end_lalpha
assert_equal [], @to.list
assert_equal [], @to.in_list_entry
- assert_equal "<ol style=\"display: lower-alpha\"></ol>\n", @to.res.join
+ assert_equal "<ol style=\"list-style-type: lower-alpha\"></ol>\n", @to.res.join
end
def accept_list_end_number
@@ -94,14 +106,14 @@ class TestRDocMarkupToHtml < RDoc::Markup::FormatterTestCase
assert_equal [], @to.list
assert_equal [], @to.in_list_entry
- assert_equal "<table class=\"rdoc-list\"></table>\n", @to.res.join
+ assert_equal "<dl class=\"rdoc-list note-list\"></dl>\n", @to.res.join
end
def accept_list_end_ualpha
assert_equal [], @to.list
assert_equal [], @to.in_list_entry
- assert_equal "<ol style=\"display: upper-alpha\"></ol>\n", @to.res.join
+ assert_equal "<ol style=\"list-style-type: upper-alpha\"></ol>\n", @to.res.join
end
def accept_list_item_end_bullet
@@ -117,7 +129,7 @@ class TestRDocMarkupToHtml < RDoc::Markup::FormatterTestCase
end
def accept_list_item_end_note
- assert_equal %w[</td></tr>], @to.in_list_entry
+ assert_equal %w[</dd>], @to.in_list_entry
end
def accept_list_item_end_number
@@ -133,24 +145,49 @@ class TestRDocMarkupToHtml < RDoc::Markup::FormatterTestCase
end
def accept_list_item_start_label
- assert_equal "<dl class=\"rdoc-list\"><dt>cat</dt>\n<dd>", @to.res.join
+ assert_equal "<dl class=\"rdoc-list label-list\"><dt>cat\n<dd>", @to.res.join
end
def accept_list_item_start_lalpha
- assert_equal "<ol style=\"display: lower-alpha\"><li>", @to.res.join
+ assert_equal "<ol style=\"list-style-type: lower-alpha\"><li>", @to.res.join
end
def accept_list_item_start_note
- assert_equal "<table class=\"rdoc-list\"><tr><td class=\"rdoc-term\"><p>cat</p></td>\n<td>",
+ assert_equal "<dl class=\"rdoc-list note-list\"><dt>cat\n<dd>",
@to.res.join
end
def accept_list_item_start_note_2
expected = <<-EXPECTED
-<table class="rdoc-list"><tr><td class="rdoc-term"><p><tt>teletype</tt></p></td>
-<td>
+<dl class="rdoc-list note-list"><dt><code>teletype</code>
+<dd>
<p>teletype description</p>
-</td></tr></table>
+</dd></dl>
+ EXPECTED
+
+ assert_equal expected, @to.res.join
+ end
+
+ def accept_list_item_start_note_multi_description
+ expected = <<-EXPECTED
+<dl class="rdoc-list note-list"><dt>label
+<dd>
+<p>description one</p>
+</dd><dd>
+<p>description two</p>
+</dd></dl>
+ EXPECTED
+
+ assert_equal expected, @to.res.join
+ end
+
+ def accept_list_item_start_note_multi_label
+ expected = <<-EXPECTED
+<dl class="rdoc-list note-list"><dt>one
+<dt>two
+<dd>
+<p>two headers</p>
+</dd></dl>
EXPECTED
assert_equal expected, @to.res.join
@@ -161,7 +198,7 @@ class TestRDocMarkupToHtml < RDoc::Markup::FormatterTestCase
end
def accept_list_item_start_ualpha
- assert_equal "<ol style=\"display: upper-alpha\"><li>", @to.res.join
+ assert_equal "<ol style=\"list-style-type: upper-alpha\"><li>", @to.res.join
end
def accept_list_start_bullet
@@ -175,21 +212,21 @@ class TestRDocMarkupToHtml < RDoc::Markup::FormatterTestCase
assert_equal [:LABEL], @to.list
assert_equal [false], @to.in_list_entry
- assert_equal '<dl class="rdoc-list">', @to.res.join
+ assert_equal '<dl class="rdoc-list label-list">', @to.res.join
end
def accept_list_start_lalpha
assert_equal [:LALPHA], @to.list
assert_equal [false], @to.in_list_entry
- assert_equal "<ol style=\"display: lower-alpha\">", @to.res.join
+ assert_equal "<ol style=\"list-style-type: lower-alpha\">", @to.res.join
end
def accept_list_start_note
assert_equal [:NOTE], @to.list
assert_equal [false], @to.in_list_entry
- assert_equal "<table class=\"rdoc-list\">", @to.res.join
+ assert_equal "<dl class=\"rdoc-list note-list\">", @to.res.join
end
def accept_list_start_number
@@ -203,7 +240,7 @@ class TestRDocMarkupToHtml < RDoc::Markup::FormatterTestCase
assert_equal [:UALPHA], @to.list
assert_equal [false], @to.in_list_entry
- assert_equal "<ol style=\"display: upper-alpha\">", @to.res.join
+ assert_equal "<ol style=\"list-style-type: upper-alpha\">", @to.res.join
end
def accept_paragraph
@@ -211,7 +248,15 @@ class TestRDocMarkupToHtml < RDoc::Markup::FormatterTestCase
end
def accept_paragraph_b
- assert_equal "\n<p>reg <b>bold words</b> reg</p>\n", @to.res.join
+ assert_equal "\n<p>reg <strong>bold words</strong> reg</p>\n", @to.res.join
+ end
+
+ def accept_paragraph_br
+ assert_equal "\n<p>one<br>two</p>\n", @to.res.join
+ end
+
+ def accept_paragraph_break
+ assert_equal "\n<p>hello<br> world</p>\n", @to.res.join
end
def accept_paragraph_i
@@ -219,11 +264,11 @@ class TestRDocMarkupToHtml < RDoc::Markup::FormatterTestCase
end
def accept_paragraph_plus
- assert_equal "\n<p>reg <tt>teletype</tt> reg</p>\n", @to.res.join
+ assert_equal "\n<p>reg <code>teletype</code> reg</p>\n", @to.res.join
end
def accept_paragraph_star
- assert_equal "\n<p>reg <b>bold</b> reg</p>\n", @to.res.join
+ assert_equal "\n<p>reg <strong>bold</strong> reg</p>\n", @to.res.join
end
def accept_paragraph_underscore
@@ -243,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
@@ -297,20 +342,242 @@ class TestRDocMarkupToHtml < RDoc::Markup::FormatterTestCase
assert_equal expected, @to.end_accepting
end
+ def test_accept_heading_7
+ @to.start_accepting
+
+ @to.accept_heading @RM::Heading.new(7, 'Hello')
+
+ links = '<span><a href="#label-Hello">&para;</a> ' +
+ '<a href="#documentation">&uarr;</a></span>'
+
+ assert_equal "\n<h6 id=\"label-Hello\">Hello#{links}</h6>\n", @to.res.join
+ end
+
+ def test_accept_heading_aref_class
+ @to.code_object = RDoc::NormalClass.new 'Foo'
+ @to.start_accepting
+
+ @to.accept_heading head(1, 'Hello')
+
+ links = '<span><a href="#class-Foo-label-Hello">&para;</a> ' +
+ '<a href="#documentation">&uarr;</a></span>'
+
+ assert_equal "\n<h1 id=\"class-Foo-label-Hello\">Hello#{links}</h1>\n",
+ @to.res.join
+ end
+
+ def test_accept_heading_aref_method
+ @to.code_object = RDoc::AnyMethod.new nil, 'foo'
+ @to.start_accepting
+
+ @to.accept_heading @RM::Heading.new(1, 'Hello')
+
+ links = '<span><a href="#method-i-foo-label-Hello">&para;</a> ' +
+ '<a href="#documentation">&uarr;</a></span>'
+
+ assert_equal "\n<h1 id=\"method-i-foo-label-Hello\">Hello#{links}</h1>\n",
+ @to.res.join
+ end
+
+ def test_accept_heading_pipe
+ @options.pipe = true
+
+ @to.start_accepting
+
+ @to.accept_heading @RM::Heading.new(1, 'Hello')
+
+ 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")
+
+ @to.start_accepting
+ @to.accept_verbatim verb
+
+ expected = <<-EXPECTED
+
+<pre class="ruby"><span class="ruby-keyword">class</span> <span class="ruby-constant">C</span>
+<span class="ruby-keyword">end</span>
+</pre>
+ EXPECTED
+
+ assert_equal expected, @to.res.join
+ end
+
+ def test_accept_verbatim_parseable_error
+ verb = @RM::Verbatim.new("a % 09 # => blah\n")
+
+ @to.start_accepting
+ @to.accept_verbatim verb
+
+ inner = CGI.escapeHTML "a % 09 # => blah"
+
+ expected = <<-EXPECTED
+
+<pre>#{inner}
+</pre>
+ EXPECTED
+
+ 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
+
+ @to.start_accepting
+ @to.accept_verbatim verb
+
+ expected = <<-EXPECTED
+
+<pre class="ruby"><span class="ruby-value">1</span> <span class="ruby-operator">+</span> <span class="ruby-value">1</span>
+</pre>
+ EXPECTED
+
+ assert_equal expected, @to.res.join
+ end
+
def test_convert_string
assert_equal '&lt;&gt;', @to.convert_string('<>')
end
+ def test_convert_HYPERLINK_irc
+ result = @to.convert 'irc://irc.freenode.net/#ruby-lang'
+
+ assert_equal "\n<p><a href=\"irc://irc.freenode.net/#ruby-lang\">irc.freenode.net/#ruby-lang</a></p>\n", result
+ end
+
+ def test_convert_RDOCLINK_label_label
+ result = @to.convert 'rdoc-label:label-One'
+
+ assert_equal "\n<p><a href=\"#label-One\">One</a></p>\n", result
+ end
+
+ 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
+ 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
+ end
+
+ def test_convert_RDOCLINK_ref
+ result = @to.convert 'rdoc-ref:C'
+
+ assert_equal "\n<p>C</p>\n", result
+ end
+
+ def test_convert_TIDYLINK_footnote
+ result = @to.convert 'text{*1}[rdoc-label:foottext-1:footmark-1]'
+
+ 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
+ result = @to.convert '{foo}[rdoc-label:foottext-1]'
+
+ assert_equal "\n<p><a href=\"#foottext-1\">foo</a></p>\n", result
+ end
+
+ def test_convert_TIDYLINK_irc
+ result = @to.convert '{ruby-lang}[irc://irc.freenode.net/#ruby-lang]'
+
+ assert_equal "\n<p><a href=\"irc://irc.freenode.net/#ruby-lang\">ruby-lang</a></p>\n", result
+ end
+
def test_gen_url
assert_equal '<a href="example">example</a>',
@to.gen_url('link:example', 'example')
end
- def test_gem_url_image_url
+ def test_gen_url_rdoc_label
+ assert_equal '<a href="#foottext-1">example</a>',
+ @to.gen_url('rdoc-label:foottext-1', 'example')
+ end
+
+ def test_gen_url_rdoc_label_id
+ assert_equal '<sup><a id="footmark-1" href="#foottext-1">example</a></sup>',
+ @to.gen_url('rdoc-label:foottext-1:footmark-1', 'example')
+ end
+
+ def test_gen_url_image_url
assert_equal '<img src="http://example.com/image.png" />', @to.gen_url('http://example.com/image.png', 'ignored')
end
- def test_gem_url_ssl_image_url
+ def test_gen_url_ssl_image_url
assert_equal '<img src="https://example.com/image.png" />', @to.gen_url('https://example.com/image.png', 'ignored')
end
@@ -322,6 +589,14 @@ class TestRDocMarkupToHtml < RDoc::Markup::FormatterTestCase
assert_equal '<a href="README.txt">README.txt</a>', link
end
+ def test_handle_special_HYPERLINK_irc
+ special = RDoc::Markup::Special.new 0, 'irc://irc.freenode.net/#ruby-lang'
+
+ link = @to.handle_special_HYPERLINK special
+
+ assert_equal '<a href="irc://irc.freenode.net/#ruby-lang">irc.freenode.net/#ruby-lang</a>', link
+ end
+
def test_list_verbatim_2
str = "* one\n verb1\n verb2\n* two\n"
@@ -339,8 +614,21 @@ verb2</pre>
assert_equal expected, @m.convert(str, @to)
end
+ def test_parseable_eh
+ assert @to.parseable?('def x() end'), 'def'
+ assert @to.parseable?('class C end'), 'class'
+ assert @to.parseable?('module M end'), 'module'
+ assert @to.parseable?('a # => blah'), '=>'
+ assert @to.parseable?('x { |y| ... }'), '{ |x|'
+ assert @to.parseable?('x do |y| ... end'), 'do |x|'
+ refute @to.parseable?('* 1'), '* 1'
+ refute @to.parseable?('# only a comment'), '# only a comment'
+ refute @to.parseable?('<% require "foo" %>'), 'ERB'
+ refute @to.parseable?('class="foo"'), 'HTML class'
+ end
+
def test_to_html
- assert_equal "\n<p><tt>--</tt></p>\n", util_format("<tt>--</tt>")
+ assert_equal "\n<p><code>--</code></p>\n", util_format("<tt>--</tt>")
end
def util_format text
diff --git a/test/rdoc/test_rdoc_markup_to_html_crossref.rb b/test/rdoc/test_rdoc_markup_to_html_crossref.rb
index 4f122512ac..872daea1dc 100644
--- a/test/rdoc/test_rdoc_markup_to_html_crossref.rb
+++ b/test/rdoc/test_rdoc_markup_to_html_crossref.rb
@@ -1,8 +1,3 @@
-require 'rubygems'
-require 'minitest/autorun'
-require 'rdoc/rdoc'
-require 'rdoc/code_objects'
-require 'rdoc/markup/to_html_crossref'
require File.expand_path '../xref_test_case', __FILE__
class TestRDocMarkupToHtmlCrossref < XrefTestCase
@@ -10,25 +5,100 @@ class TestRDocMarkupToHtmlCrossref < XrefTestCase
def setup
super
- @to = RDoc::Markup::ToHtmlCrossref.new 'index.html', @c1, true
+ @options.hyperlink_all = true
+
+ @to = RDoc::Markup::ToHtmlCrossref.new @options, 'index.html', @c1
end
def test_convert_CROSSREF
result = @to.convert 'C1'
- assert_equal "\n<p><a href=\"C1.html\">C1</a></p>\n", result
+ assert_equal para("<a href=\"C1.html\">C1</a>"), result
+ end
+
+ def test_convert_CROSSREF_label
+ result = @to.convert 'C1@foo'
+ assert_equal para("<a href=\"C1.html#label-foo\">foo at C1</a>"), result
+
+ result = @to.convert 'C1#m@foo'
+ assert_equal para("<a href=\"C1.html#method-i-m-label-foo\">foo at C1#m</a>"),
+ result
end
- def test_convert_HYPERLINK_rdoc_ref
+ def test_convert_CROSSREF_label_period
+ result = @to.convert 'C1@foo.'
+ assert_equal para("<a href=\"C1.html#label-foo\">foo at C1</a>."), result
+ end
+
+ def test_convert_CROSSREF_label_space
+ result = @to.convert 'C1@foo+bar'
+ assert_equal para("<a href=\"C1.html#label-foo+bar\">foo bar at C1</a>"),
+ 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'
- assert_equal "\n<p><a href=\"C1.html\">C1</a></p>\n", result
+ assert_equal para("<a href=\"C1.html\">C1</a>"), result
+ end
+
+ def test_convert_RDOCLINK_rdoc_ref_method
+ result = @to.convert 'rdoc-ref:C1#m'
+
+ assert_equal para("<a href=\"C1.html#method-i-m\">#m</a>"), result
+ end
+
+ def test_convert_RDOCLINK_rdoc_ref_method_label
+ result = @to.convert 'rdoc-ref:C1#m@foo'
+
+ assert_equal para("<a href=\"C1.html#method-i-m-label-foo\">foo at C1#m</a>"),
+ result, 'rdoc-ref:C1#m@foo'
+ end
+
+ def test_convert_RDOCLINK_rdoc_ref_method_percent
+ m = @c1.add_method RDoc::AnyMethod.new nil, '%'
+ m.singleton = false
+
+ result = @to.convert 'rdoc-ref:C1#%'
+
+ assert_equal para("<a href=\"C1.html#method-i-25\">#%</a>"), result
+
+ m.singleton = true
+
+ result = @to.convert 'rdoc-ref:C1::%'
+
+ assert_equal para("<a href=\"C1.html#method-c-25\">::%</a>"), result
+ end
+
+ def test_convert_RDOCLINK_rdoc_ref_method_percent_label
+ m = @c1.add_method RDoc::AnyMethod.new nil, '%'
+ m.singleton = false
+
+ result = @to.convert 'rdoc-ref:C1#%@f'
+
+ assert_equal para("<a href=\"C1.html#method-i-25-label-f\">f at C1#%</a>"),
+ result
+
+ m.singleton = true
+
+ result = @to.convert 'rdoc-ref:C1::%@f'
+
+ assert_equal para("<a href=\"C1.html#method-c-25-label-f\">f at C1::%</a>"),
+ result
end
- def test_convert_TIDYLINK_rdoc_ref
- result = @to.convert '{foo}[rdoc-ref:C1]'
+ def test_convert_RDOCLINK_rdoc_ref_label
+ result = @to.convert 'rdoc-ref:C1@foo'
- assert_equal "\n<p><a href=\"C1.html\">foo</a></p>\n", result
+ assert_equal para("<a href=\"C1.html#label-foo\">foo at C1</a>"), result,
+ 'rdoc-ref:C1@foo'
end
def test_gen_url
@@ -43,6 +113,11 @@ class TestRDocMarkupToHtmlCrossref < XrefTestCase
assert_equal "<a href=\"C2/C3.html\">C2::C3</a>", SPECIAL('C2::C3')
end
+ def test_handle_special_CROSSREF_label
+ assert_equal "<a href=\"C1.html#method-i-m-label-foo\">foo at C1#m</a>",
+ SPECIAL('C1#m@foo')
+ end
+
def test_handle_special_CROSSREF_show_hash_false
@to.show_hash = false
@@ -51,8 +126,10 @@ class TestRDocMarkupToHtmlCrossref < XrefTestCase
end
def test_handle_special_HYPERLINK_rdoc
- RDoc::TopLevel.new 'README.txt'
- @to = RDoc::Markup::ToHtmlCrossref.new 'C2.html', @c2, true
+ readme = @store.add_file 'README.txt'
+ readme.parser = RDoc::Parser::Simple
+
+ @to = RDoc::Markup::ToHtmlCrossref.new @options, 'C2.html', @c2
link = @to.handle_special_HYPERLINK hyper 'C2::C3'
@@ -68,8 +145,10 @@ class TestRDocMarkupToHtmlCrossref < XrefTestCase
end
def test_handle_special_TIDYLINK_rdoc
- RDoc::TopLevel.new 'README.txt'
- @to = RDoc::Markup::ToHtmlCrossref.new 'C2.html', @c2, true
+ readme = @store.add_file 'README.txt'
+ readme.parser = RDoc::Parser::Simple
+
+ @to = RDoc::Markup::ToHtmlCrossref.new @options, 'C2.html', @c2
link = @to.handle_special_TIDYLINK tidy 'C2::C3'
@@ -79,15 +158,51 @@ class TestRDocMarkupToHtmlCrossref < XrefTestCase
assert_equal '<a href="C4.html">tidy</a>', link
+ link = @to.handle_special_TIDYLINK tidy 'C1#m'
+
+ assert_equal '<a href="C1.html#method-i-m">tidy</a>', link
+
link = @to.handle_special_TIDYLINK tidy 'README.txt'
assert_equal '<a href="README_txt.html">tidy</a>', link
end
+ def test_handle_special_TIDYLINK_label
+ link = @to.handle_special_TIDYLINK tidy 'C1#m@foo'
+
+ assert_equal "<a href=\"C1.html#method-i-m-label-foo\">tidy</a>",
+ link, 'C1#m@foo'
+ end
+
+ def test_to_html_CROSSREF_email
+ @options.hyperlink_all = false
+
+ @to = RDoc::Markup::ToHtmlCrossref.new @options, 'index.html', @c1
+
+ result = @to.to_html 'first.last@example.com'
+
+ assert_equal 'first.last@example.com', result
+ end
+
+ def test_to_html_CROSSREF_email_hyperlink_all
+ result = @to.to_html 'first.last@example.com'
+
+ assert_equal 'first.last@example.com', result
+ end
+
def test_link
assert_equal 'n', @to.link('n', 'n')
- assert_equal '<a href="C1.html#method-c-m">m</a>', @to.link('m', 'm')
+ assert_equal '<a href="C1.html#method-c-m">::m</a>', @to.link('m', 'm')
+ end
+
+ def test_link_class_method_full
+ assert_equal '<a href="Parent.html#method-c-m">Parent.m</a>',
+ @to.link('Parent::m', 'Parent::m')
+ end
+
+ def para text
+ "\n<p>#{text}</p>\n"
end
def SPECIAL text
diff --git a/test/rdoc/test_rdoc_markup_to_html_snippet.rb b/test/rdoc/test_rdoc_markup_to_html_snippet.rb
new file mode 100644
index 0000000000..4bb8ed1b47
--- /dev/null
+++ b/test/rdoc/test_rdoc_markup_to_html_snippet.rb
@@ -0,0 +1,710 @@
+require 'rdoc/test_case'
+
+class TestRDocMarkupToHtmlSnippet < RDoc::Markup::FormatterTestCase
+
+ add_visitor_tests
+
+ def setup
+ super
+
+ @to = RDoc::Markup::ToHtmlSnippet.new @options, 100, 100
+ @ellipsis = @to.to_html '...'
+ end
+
+ def accept_blank_line
+ assert_empty @to.res.join
+ end
+
+ def accept_block_quote
+ assert_equal "\n<blockquote><p>quote\n</blockquote>\n", @to.res.join
+
+ assert_equal 5, @to.characters
+ end
+
+ def accept_document
+ assert_equal "<p>hello\n", @to.res.join
+ assert_equal 5, @to.characters
+ end
+
+ def accept_heading
+ assert_equal "<p>Hello\n", @to.res.join
+ assert_equal 5, @to.characters
+ end
+
+ def accept_heading_1
+ assert_equal "<p>Hello\n", @to.res.join
+ assert_equal 5, @to.characters
+ end
+
+ def accept_heading_2
+ assert_equal "<p>Hello\n", @to.res.join
+ assert_equal 5, @to.characters
+ end
+
+ def accept_heading_3
+ assert_equal "<p>Hello\n", @to.res.join
+ assert_equal 5, @to.characters
+ end
+
+ def accept_heading_4
+ assert_equal "<p>Hello\n", @to.res.join
+ assert_equal 5, @to.characters
+ end
+
+ def accept_heading_b
+ assert_equal "<p><strong>Hello</strong>\n",
+ @to.res.join
+ assert_equal 5, @to.characters
+ end
+
+ def accept_heading_suppressed_crossref
+ assert_equal "<p>Hello\n", @to.res.join
+ assert_equal 5, @to.characters
+ end
+
+ def accept_list_end_bullet
+ assert_equal [], @to.list
+ assert_equal [], @to.in_list_entry
+
+ assert_equal "\n", @to.res.join
+ assert_equal 0, @to.characters
+ end
+
+ def accept_list_end_label
+ assert_equal [], @to.list
+ assert_equal [], @to.in_list_entry
+
+ assert_equal "\n", @to.res.join
+ assert_equal 0, @to.characters
+ end
+
+ def accept_list_end_lalpha
+ assert_equal [], @to.list
+ assert_equal [], @to.in_list_entry
+
+ assert_equal "\n", @to.res.join
+ assert_equal 0, @to.characters
+ end
+
+ def accept_list_end_number
+ assert_equal [], @to.list
+ assert_equal [], @to.in_list_entry
+
+ assert_equal "\n", @to.res.join
+ assert_equal 0, @to.characters
+ end
+
+ def accept_list_end_note
+ assert_equal [], @to.list
+ assert_equal [], @to.in_list_entry
+
+ assert_equal "\n", @to.res.join
+ assert_equal 0, @to.characters
+ end
+
+ def accept_list_end_ualpha
+ assert_equal [], @to.list
+ assert_equal [], @to.in_list_entry
+
+ assert_equal "\n", @to.res.join
+ assert_equal 0, @to.characters
+ end
+
+ def accept_list_item_end_bullet
+ assert_equal [''], @to.in_list_entry
+ assert_equal 0, @to.characters
+ end
+
+ def accept_list_item_end_label
+ assert_equal [''], @to.in_list_entry
+ assert_equal 4, @to.characters
+ end
+
+ def accept_list_item_end_lalpha
+ assert_equal [''], @to.in_list_entry
+ assert_equal 0, @to.characters
+ end
+
+ def accept_list_item_end_note
+ assert_equal [''], @to.in_list_entry
+ assert_equal 4, @to.characters
+ end
+
+ def accept_list_item_end_number
+ assert_equal [''], @to.in_list_entry
+ assert_equal 0, @to.characters
+ end
+
+ def accept_list_item_end_ualpha
+ assert_equal [''], @to.in_list_entry
+ assert_equal 0, @to.characters
+ end
+
+ def accept_list_item_start_bullet
+ assert_equal "<p>", @to.res.join
+ assert_equal 0, @to.characters
+ end
+
+ def accept_list_item_start_label
+ assert_equal "<p>cat &mdash; ", @to.res.join
+ assert_equal 4, @to.characters
+ end
+
+ def accept_list_item_start_lalpha
+ assert_equal "<p>", @to.res.join
+ assert_equal 0, @to.characters
+ end
+
+ def accept_list_item_start_note
+ assert_equal "<p>cat &mdash; ",
+ @to.res.join
+ assert_equal 4, @to.characters
+ end
+
+ def accept_list_item_start_note_2
+ expected = <<-EXPECTED
+<p><code>teletype</code> &mdash; teletype description
+
+ EXPECTED
+
+ assert_equal expected, @to.res.join
+ assert_equal 29, @to.characters
+ end
+
+ def accept_list_item_start_note_multi_description
+ expected = <<-EXPECTED
+<p>label &mdash; description one
+<p>description two
+
+ EXPECTED
+
+ assert_equal expected, @to.res.join
+ assert_equal 37, @to.characters
+ end
+
+ def accept_list_item_start_note_multi_label
+ expected = <<-EXPECTED
+<p>one, two &mdash; two headers
+
+ EXPECTED
+
+ assert_equal expected, @to.res.join
+ assert_equal 18, @to.characters
+ end
+
+ def accept_list_item_start_number
+ assert_equal "<p>", @to.res.join
+ assert_equal 0, @to.characters
+ end
+
+ def accept_list_item_start_ualpha
+ assert_equal "<p>", @to.res.join
+ assert_equal 0, @to.characters
+ end
+
+ def accept_list_start_bullet
+ assert_equal [:BULLET], @to.list
+ assert_equal [''], @to.in_list_entry
+
+ assert_equal '', @to.res.join
+ assert_equal 0, @to.characters
+ end
+
+ def accept_list_start_label
+ assert_equal [:LABEL], @to.list
+ assert_equal [''], @to.in_list_entry
+
+ assert_equal '', @to.res.join
+ assert_equal 0, @to.characters
+ end
+
+ def accept_list_start_lalpha
+ assert_equal [:LALPHA], @to.list
+ assert_equal [''], @to.in_list_entry
+
+ assert_equal '', @to.res.join
+ assert_equal 0, @to.characters
+ end
+
+ def accept_list_start_note
+ assert_equal [:NOTE], @to.list
+ assert_equal [''], @to.in_list_entry
+
+ assert_equal '', @to.res.join
+ assert_equal 0, @to.characters
+ end
+
+ def accept_list_start_number
+ assert_equal [:NUMBER], @to.list
+ assert_equal [''], @to.in_list_entry
+
+ assert_equal '', @to.res.join
+ assert_equal 0, @to.characters
+ end
+
+ def accept_list_start_ualpha
+ assert_equal [:UALPHA], @to.list
+ assert_equal [''], @to.in_list_entry
+
+ assert_equal '', @to.res.join
+ assert_equal 0, @to.characters
+ end
+
+ def accept_paragraph
+ assert_equal "<p>hi\n", @to.res.join
+
+ assert_equal 2, @to.characters
+ end
+
+ def accept_paragraph_b
+ assert_equal "<p>reg <strong>bold words</strong> reg\n", @to.res.join
+
+ assert_equal 18, @to.characters
+ end
+
+ def accept_paragraph_br
+ assert_equal "<p>one<br>two\n", @to.res.join
+
+ assert_equal 6, @to.characters
+ end
+
+ def accept_paragraph_break
+ assert_equal "<p>hello<br>\nworld\n", @to.res.join
+
+ assert_equal 11, @to.characters
+ end
+
+ def accept_paragraph_i
+ assert_equal "<p>reg <em>italic words</em> reg\n", @to.res.join
+
+ assert_equal 20, @to.characters
+ end
+
+ def accept_paragraph_plus
+ assert_equal "<p>reg <code>teletype</code> reg\n", @to.res.join
+
+ assert_equal 16, @to.characters
+ end
+
+ def accept_paragraph_star
+ assert_equal "<p>reg <strong>bold</strong> reg\n", @to.res.join
+
+ assert_equal 12, @to.characters
+ end
+
+ def accept_paragraph_underscore
+ assert_equal "<p>reg <em>italic</em> reg\n", @to.res.join
+
+ assert_equal 14, @to.characters
+ end
+
+ def accept_raw
+ assert_equal '', @to.res.join
+ assert_equal 0, @to.characters
+ end
+
+ def accept_rule
+ assert_empty @to.res
+ assert_equal 0, @to.characters
+ end
+
+ def accept_verbatim
+ assert_equal "\n<pre>hi\n world</pre>\n", @to.res.join
+ assert_equal 10, @to.characters
+ end
+
+ def end_accepting
+ assert_equal 'hi', @to.res.join
+ end
+
+ def start_accepting
+ assert_equal [], @to.res
+ assert_equal [], @to.in_list_entry
+ assert_equal [], @to.list
+ assert_equal 0, @to.characters
+ end
+
+ def list_nested
+ expected = <<-EXPECTED
+<p>l1
+<p>l1.1
+
+<p>l2
+
+ EXPECTED
+
+ assert_equal expected, @to.res.join
+ assert_equal 8, @to.characters
+ end
+
+ def list_verbatim
+ expected = <<-EXPECTED
+<p>list stuff
+
+<pre>* list
+ with
+
+ second
+
+ 1. indented
+ 2. numbered
+
+ third
+
+* second</pre>
+
+ EXPECTED
+
+ assert_equal expected, @to.end_accepting
+ assert_equal 81, @to.characters
+ end
+
+ def test_accept_heading_7
+ @to.start_accepting
+
+ @to.accept_heading @RM::Heading.new(7, 'Hello')
+
+ assert_equal "<p>Hello\n", @to.res.join
+ assert_equal 5, @to.characters
+ end
+
+ def test_accept_heading_aref_class
+ @to.code_object = RDoc::NormalClass.new 'Foo'
+ @to.start_accepting
+
+ @to.accept_heading @RM::Heading.new(1, 'Hello')
+
+ assert_equal "<p>Hello\n",
+ @to.res.join
+ assert_equal 5, @to.characters
+ end
+
+ def test_accept_heading_aref_method
+ @to.code_object = RDoc::AnyMethod.new nil, 'foo'
+ @to.start_accepting
+
+ @to.accept_heading @RM::Heading.new(1, 'Hello')
+
+ assert_equal "<p>Hello\n",
+ @to.res.join
+ assert_equal 5, @to.characters
+ end
+
+ def test_accept_verbatim_ruby
+ options = RDoc::Options.new
+ rdoc = RDoc::RDoc.new
+ rdoc.options = options
+ RDoc::RDoc.current = rdoc
+
+ verb = @RM::Verbatim.new("class C\n", "end\n")
+
+ @to.start_accepting
+ @to.accept_verbatim verb
+
+ expected = <<-EXPECTED
+
+<pre class="ruby"><span class="ruby-keyword">class</span> <span class="ruby-constant">C</span>
+<span class="ruby-keyword">end</span>
+</pre>
+ EXPECTED
+
+ assert_equal expected, @to.res.join
+ assert_equal 11, @to.characters
+ end
+
+ def test_accept_verbatim_ruby_error
+ options = RDoc::Options.new
+ rdoc = RDoc::RDoc.new
+ rdoc.options = options
+ RDoc::RDoc.current = rdoc
+
+ verb = @RM::Verbatim.new("a % 09 # => blah\n")
+
+ @to.start_accepting
+ @to.accept_verbatim verb
+
+ inner = CGI.escapeHTML "a % 09 # => blah"
+
+ expected = <<-EXPECTED
+
+<pre>#{inner}
+</pre>
+ EXPECTED
+
+ assert_equal expected, @to.res.join
+ assert_equal 16, @to.characters
+ end
+
+ def test_add_paragraph
+ @to = RDoc::Markup::ToHtmlSnippet.new @options, 0, 3
+ assert_throws :done do
+ @to.add_paragraph
+ @to.add_paragraph
+ @to.add_paragraph
+ end
+
+ assert_equal 3, @to.paragraphs
+ end
+
+ def test_convert_limit
+ rdoc = <<-RDOC
+= Hello
+
+This is some text, it *will* be cut off after 100 characters and an ellipsis
+must follow
+
+So there you have it
+ RDOC
+
+ expected = <<-EXPECTED
+<p>Hello
+<p>This is some text, it <strong>will</strong> be cut off after 100 characters
+and an ellipsis must follow
+<p>So there you #{@ellipsis}
+ EXPECTED
+
+ actual = @to.convert rdoc
+
+ assert_equal expected, actual
+ assert_equal 111, @to.characters, 'snippet character length'
+ end
+
+ def test_convert_limit_2
+ rdoc = <<-RDOC
+Outputs formatted RI data for the class or method +name+.
+
+Returns true if +name+ was found, false if it was not an alternative could
+be guessed, raises an error if +name+ couldn't be guessed.
+ RDOC
+
+ expected = <<-EXPECTED
+<p>Outputs formatted RI data for the class or method <code>name</code>.
+<p>Returns true if <code>name</code> was found, false if it was #{@ellipsis}
+ EXPECTED
+
+ actual = @to.convert rdoc
+
+ assert_equal expected, actual
+ assert_equal 159, @to.characters, 'snippet character length'
+ end
+
+ def test_convert_limit_paragraphs
+ @to = RDoc::Markup::ToHtmlSnippet.new @options, 100, 3
+
+ rdoc = <<-RDOC
+= \RDoc - Ruby Documentation System
+
+* {RDoc Project Page}[https://github.com/rdoc/rdoc/]
+* {RDoc Documentation}[http://docs.seattlerb.org/rdoc]
+* {RDoc Bug Tracker}[https://github.com/rdoc/rdoc/issues]
+
+== DESCRIPTION:
+
+RDoc produces HTML and command-line documentation for Ruby projects. RDoc
+includes the +rdoc+ and +ri+ tools for generating and displaying online
+documentation.
+
+See RDoc for a description of RDoc's markup and basic use.
+ RDOC
+
+ expected = <<-EXPECTED
+<p>RDoc - Ruby Documentation System
+<p>RDoc Project Page
+<p>RDoc Documentation
+ EXPECTED
+
+ actual = @to.convert rdoc
+
+ assert_equal expected, actual
+ assert_equal 67, @to.characters
+ end
+
+ def test_convert_limit_in_tag
+ @to = RDoc::Markup::ToHtmlSnippet.new @options, 4
+ rdoc = "* ab *c* d\n"
+
+ expected = "<p>ab <strong>c</strong> #{@ellipsis}\n\n"
+
+ actual = @to.convert rdoc
+
+ assert_equal 4, @to.characters
+ assert_equal expected, actual
+ end
+
+ def test_convert_limit_verbatim
+ rdoc = <<-RDOC
+= Hello There
+
+This is some text, it *will* be cut off after 100 characters
+
+ This one is cut off in this verbatim section
+ RDOC
+
+ expected = <<-EXPECTED
+<p>Hello There
+<p>This is some text, it <strong>will</strong> be cut off after 100 characters
+
+<pre>This one is cut off in this verbatim ...</pre>
+ EXPECTED
+
+ actual = @to.convert rdoc
+
+ assert_equal expected, actual
+ assert_equal 113, @to.characters
+ end
+
+ def test_convert_limit_verbatim_2
+ rdoc = <<-RDOC
+Extracts the class, selector and method name parts from +name+ like
+Foo::Bar#baz.
+
+NOTE: Given Foo::Bar, Bar is considered a class even though it may be a
+ method
+ RDOC
+
+ expected = <<-EXPECTED
+<p>Extracts the class, selector and method name parts from <code>name</code>
+like Foo::Bar#baz.
+<p>NOTE: Given Foo::Bar, #{@ellipsis}
+ EXPECTED
+
+ actual = @to.convert rdoc
+
+ assert_equal expected, actual
+ assert_equal 101, @to.characters
+ end
+
+ def test_convert_limit_verbatim_multiline
+ rdoc = <<-RDOC
+Look for directives in a normal comment block:
+
+ # :stopdoc:
+ # Don't display comment from this point forward
+
+This routine modifies its +comment+ parameter.
+ RDOC
+
+ inner = CGI.escapeHTML "# Don't display comment from this point forward"
+ expected = <<-EXPECTED
+<p>Look for directives in a normal comment block:
+
+<pre># :stopdoc:
+#{inner}</pre>
+ EXPECTED
+
+ actual = @to.convert rdoc
+
+ assert_equal expected, actual
+ assert_equal 105, @to.characters
+ end
+
+ def test_convert_limit_over
+ @to = RDoc::Markup::ToHtmlSnippet.new @options, 4
+ rdoc = "* text\n" * 2
+
+ expected = "<p>text\n"
+ expected.chomp!
+ expected << " #{@ellipsis}\n"
+
+ actual = @to.convert rdoc
+
+ assert_equal 4, @to.characters
+ assert_equal expected, actual
+ end
+
+ def test_convert_string
+ assert_equal '&lt;&gt;', @to.convert_string('<>')
+ end
+
+ def test_convert_RDOCLINK_label_label
+ result = @to.convert 'rdoc-label:label-One'
+
+ assert_equal "<p>One\n", result
+ assert_equal 3, @to.characters
+ end
+
+ def test_convert_RDOCLINK_label_foottext
+ result = @to.convert 'rdoc-label:foottext-1'
+
+ 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 1, @to.characters
+ end
+
+ def test_convert_RDOCLINK_ref
+ result = @to.convert 'rdoc-ref:C'
+
+ assert_equal "<p>C\n", result
+ assert_equal 1, @to.characters
+ end
+
+ def test_convert_TIDYLINK_rdoc_label
+ result = @to.convert '{foo}[rdoc-label:foottext-1]'
+
+ assert_equal "<p>foo\n", result
+ assert_equal 3, @to.characters
+ end
+
+ def test_handle_special_HYPERLINK_link
+ special = RDoc::Markup::Special.new 0, 'link:README.txt'
+
+ link = @to.handle_special_HYPERLINK special
+
+ assert_equal 'README.txt', link
+ end
+
+ def test_list_verbatim_2
+ str = "* one\n verb1\n verb2\n* two\n"
+
+ expected = <<-EXPECTED
+<p>one
+
+<pre>verb1
+verb2</pre>
+<p>two
+
+ EXPECTED
+
+ assert_equal expected, @m.convert(str, @to)
+ assert_equal 17, @to.characters
+ end
+
+ def test_on_tags
+ on = RDoc::Markup::AttrChanger.new 2, 0
+
+ @to.on_tags [], on
+
+ assert_equal 2, @to.mask
+ end
+
+ def test_off_tags
+ on = RDoc::Markup::AttrChanger.new 2, 0
+ off = RDoc::Markup::AttrChanger.new 0, 2
+
+ @to.on_tags [], on
+ @to.off_tags [], off
+
+ assert_equal 0, @to.mask
+ end
+
+ def test_to_html
+ assert_equal "<p><code>--</code>\n", util_format("<tt>--</tt>")
+ assert_equal 2, @to.characters
+ end
+
+ def util_format text
+ paragraph = RDoc::Markup::Paragraph.new text
+
+ @to.start_accepting
+ @to.accept_paragraph paragraph
+ @to.end_accepting
+ end
+
+end
+
diff --git a/test/rdoc/test_rdoc_markup_to_joined_paragraph.rb b/test/rdoc/test_rdoc_markup_to_joined_paragraph.rb
new file mode 100644
index 0000000000..148edb1772
--- /dev/null
+++ b/test/rdoc/test_rdoc_markup_to_joined_paragraph.rb
@@ -0,0 +1,32 @@
+require 'rdoc/test_case'
+
+class TestRDocMarkupToJoinedParagraph < RDoc::TestCase
+
+ def setup
+ super
+
+ @to = RDoc::Markup::ToJoinedParagraph.new
+ end
+
+ def test_accept_paragraph
+ parsed = para('hello', ' ', 'world')
+
+ @to.accept_paragraph parsed
+
+ expected = para('hello world')
+
+ assert_equal expected, parsed
+ end
+
+ def test_accept_paragraph_break
+ parsed = para('hello', ' ', 'world', hard_break, 'everyone')
+
+ @to.accept_paragraph parsed
+
+ expected = para('hello world', hard_break, 'everyone')
+
+ assert_equal expected, parsed
+ end
+
+end
+
diff --git a/test/rdoc/test_rdoc_markup_to_label.rb b/test/rdoc/test_rdoc_markup_to_label.rb
new file mode 100644
index 0000000000..5fb358bee3
--- /dev/null
+++ b/test/rdoc/test_rdoc_markup_to_label.rb
@@ -0,0 +1,112 @@
+require 'rdoc/test_case'
+
+class TestRDocMarkupToLabel < RDoc::Markup::FormatterTestCase
+
+ add_visitor_tests
+
+ def setup
+ super
+
+ @to = RDoc::Markup::ToLabel.new
+ end
+
+ def empty
+ assert_empty @to.res
+ end
+
+ def end_accepting
+ assert_equal %w[hi], @to.res
+ end
+
+ alias accept_blank_line empty
+ alias accept_block_quote empty
+ alias accept_document empty
+ alias accept_heading empty
+ alias accept_heading_1 empty
+ alias accept_heading_2 empty
+ alias accept_heading_3 empty
+ alias accept_heading_4 empty
+ alias accept_heading_b empty
+ alias accept_heading_suppressed_crossref empty
+ alias accept_list_end_bullet empty
+ alias accept_list_end_label empty
+ alias accept_list_end_lalpha empty
+ alias accept_list_end_note empty
+ alias accept_list_end_number empty
+ alias accept_list_end_ualpha empty
+ alias accept_list_item_end_bullet empty
+ alias accept_list_item_end_label empty
+ alias accept_list_item_end_lalpha empty
+ alias accept_list_item_end_note empty
+ alias accept_list_item_end_number empty
+ alias accept_list_item_end_ualpha empty
+ alias accept_list_item_start_bullet empty
+ alias accept_list_item_start_label empty
+ alias accept_list_item_start_lalpha empty
+ alias accept_list_item_start_note empty
+ alias accept_list_item_start_note_2 empty
+ alias accept_list_item_start_note_multi_description empty
+ alias accept_list_item_start_note_multi_label empty
+ alias accept_list_item_start_number empty
+ alias accept_list_item_start_ualpha empty
+ alias accept_list_start_bullet empty
+ alias accept_list_start_label empty
+ alias accept_list_start_lalpha empty
+ alias accept_list_start_note empty
+ alias accept_list_start_number empty
+ alias accept_list_start_ualpha empty
+ alias accept_paragraph empty
+ alias accept_paragraph_b empty
+ alias accept_paragraph_br empty
+ alias accept_paragraph_break empty
+ alias accept_paragraph_i empty
+ alias accept_paragraph_plus empty
+ alias accept_paragraph_star empty
+ alias accept_paragraph_underscore empty
+ alias accept_raw empty
+ alias accept_rule empty
+ alias accept_verbatim empty
+ alias list_nested empty
+ alias list_verbatim empty
+ alias start_accepting empty
+
+ def test_convert_bold
+ assert_equal 'bold', @to.convert('<b>bold</b>')
+ assert_equal 'bold', @to.convert('*bold*')
+ end
+
+ def test_convert_crossref
+ assert_equal 'SomeClass', @to.convert('SomeClass')
+ assert_equal 'SomeClass', @to.convert('\\SomeClass')
+
+ assert_equal 'some_method', @to.convert('some_method')
+ assert_equal 'some_method', @to.convert('\\some_method')
+
+ assert_equal '%23some_method', @to.convert('#some_method')
+ assert_equal '%23some_method', @to.convert('\\#some_method')
+ end
+
+ def test_convert_em
+ assert_equal 'em', @to.convert('<em>em</em>')
+ assert_equal 'em', @to.convert('*em*')
+ end
+
+ def test_convert_em_dash # for HTML conversion
+ assert_equal '--', @to.convert('--')
+ end
+
+ def test_convert_escape
+ assert_equal 'a+%3E+b', @to.convert('a > b')
+ end
+
+ def test_convert_tidylink
+ assert_equal 'text', @to.convert('{text}[stuff]')
+ assert_equal 'text', @to.convert('text[stuff]')
+ end
+
+ def test_convert_tt
+ assert_equal 'tt', @to.convert('<tt>tt</tt>')
+ end
+
+end
+
diff --git a/test/rdoc/test_rdoc_markup_to_markdown.rb b/test/rdoc/test_rdoc_markup_to_markdown.rb
new file mode 100644
index 0000000000..442bb19e9c
--- /dev/null
+++ b/test/rdoc/test_rdoc_markup_to_markdown.rb
@@ -0,0 +1,389 @@
+require 'rdoc/test_case'
+
+class TestRDocMarkupToMarkdown < RDoc::Markup::TextFormatterTestCase
+
+ add_visitor_tests
+ add_text_tests
+
+ def setup
+ super
+
+ @to = RDoc::Markup::ToMarkdown.new
+ end
+
+ def accept_blank_line
+ assert_equal "\n", @to.res.join
+ end
+
+ def accept_block_quote
+ assert_equal "> quote\n", @to.res.join
+ end
+
+ def accept_document
+ assert_equal "hello\n", @to.res.join
+ end
+
+ def accept_heading
+ assert_equal "##### Hello\n", @to.res.join
+ end
+
+ def accept_list_end_bullet
+ assert_empty @to.list_index
+ assert_empty @to.list_type
+ assert_empty @to.list_width
+ end
+
+ def accept_list_end_label
+ assert_empty @to.list_index
+ assert_empty @to.list_type
+ assert_empty @to.list_width
+ end
+
+ def accept_list_end_lalpha
+ assert_empty @to.list_index
+ assert_empty @to.list_type
+ assert_empty @to.list_width
+ end
+
+ def accept_list_end_note
+ assert_empty @to.list_index
+ assert_empty @to.list_type
+ assert_empty @to.list_width
+ end
+
+ def accept_list_end_number
+ assert_empty @to.list_index
+ assert_empty @to.list_type
+ assert_empty @to.list_width
+ end
+
+ def accept_list_end_ualpha
+ assert_empty @to.list_index
+ assert_empty @to.list_type
+ assert_empty @to.list_width
+ end
+
+ def accept_list_item_end_bullet
+ assert_equal 0, @to.indent, 'indent'
+ end
+
+ def accept_list_item_end_label
+ assert_equal "cat\n: ", @to.res.join
+ assert_equal 0, @to.indent, 'indent'
+ end
+
+ def accept_list_item_end_lalpha
+ assert_equal 0, @to.indent, 'indent'
+ assert_equal 2, @to.list_index.last
+ end
+
+ def accept_list_item_end_note
+ assert_equal "cat\n: ", @to.res.join
+ assert_equal 0, @to.indent, 'indent'
+ end
+
+ def accept_list_item_end_number
+ assert_equal 0, @to.indent, 'indent'
+ assert_equal 2, @to.list_index.last
+ end
+
+ def accept_list_item_end_ualpha
+ assert_equal 0, @to.indent, 'indent'
+ assert_equal 2, @to.list_index.last
+ end
+
+ def accept_list_item_start_bullet
+ assert_equal [""], @to.res
+ assert_equal '* ', @to.prefix
+ end
+
+ def accept_list_item_start_label
+ assert_equal [""], @to.res
+ assert_equal "cat\n: ", @to.prefix
+
+ assert_equal 4, @to.indent
+ end
+
+ def accept_list_item_start_lalpha
+ assert_equal [""], @to.res
+ assert_equal '1. ', @to.prefix
+
+ assert_equal 1, @to.list_index.last
+ assert_equal 4, @to.indent
+ end
+
+ def accept_list_item_start_note
+ assert_equal [""], @to.res
+ assert_equal "cat\n: ", @to.prefix
+
+ assert_equal 4, @to.indent
+ end
+
+ def accept_list_item_start_number
+ assert_equal [""], @to.res
+ assert_equal '1. ', @to.prefix
+
+ assert_equal 1, @to.list_index.last
+ assert_equal 4, @to.indent
+ end
+
+ def accept_list_item_start_ualpha
+ assert_equal [""], @to.res
+ assert_equal '1. ', @to.prefix
+
+ assert_equal 1, @to.list_index.last
+ assert_equal 4, @to.indent
+ end
+
+ def accept_list_start_bullet
+ assert_equal "", @to.res.join
+ assert_equal [nil], @to.list_index
+ assert_equal [:BULLET], @to.list_type
+ assert_equal [4], @to.list_width
+ end
+
+ def accept_list_start_label
+ assert_equal "", @to.res.join
+ assert_equal [nil], @to.list_index
+ assert_equal [:LABEL], @to.list_type
+ assert_equal [4], @to.list_width
+ end
+
+ def accept_list_start_lalpha
+ assert_equal "", @to.res.join
+ assert_equal [1], @to.list_index
+ assert_equal [:LALPHA], @to.list_type
+ assert_equal [4], @to.list_width
+ end
+
+ def accept_list_start_note
+ assert_equal "", @to.res.join
+ assert_equal [nil], @to.list_index
+ assert_equal [:NOTE], @to.list_type
+ assert_equal [4], @to.list_width
+ end
+
+ def accept_list_start_number
+ assert_equal "", @to.res.join
+ assert_equal [1], @to.list_index
+ assert_equal [:NUMBER], @to.list_type
+ assert_equal [4], @to.list_width
+ end
+
+ def accept_list_start_ualpha
+ assert_equal "", @to.res.join
+ assert_equal [1], @to.list_index
+ assert_equal [:UALPHA], @to.list_type
+ assert_equal [4], @to.list_width
+ end
+
+ def accept_paragraph
+ assert_equal "hi\n", @to.res.join
+ end
+
+ def accept_raw
+ raw = <<-RAW.rstrip
+<table>
+<tr><th>Name<th>Count
+<tr><td>a<td>1
+<tr><td>b<td>2
+</table>
+ RAW
+
+ assert_equal raw, @to.res.join
+ end
+
+ def accept_rule
+ assert_equal "---\n", @to.res.join
+ end
+
+ def accept_verbatim
+ assert_equal " hi\n world\n\n", @to.res.join
+ end
+
+ def end_accepting
+ assert_equal "hi", @to.end_accepting
+ end
+
+ def start_accepting
+ assert_equal 0, @to.indent
+ assert_equal [""], @to.res
+ assert_empty @to.list_index
+ assert_empty @to.list_type
+ assert_empty @to.list_width
+ end
+
+ def accept_heading_1
+ assert_equal "# Hello\n", @to.end_accepting
+ end
+
+ def accept_heading_2
+ assert_equal "## Hello\n", @to.end_accepting
+ end
+
+ def accept_heading_3
+ assert_equal "### Hello\n", @to.end_accepting
+ end
+
+ def accept_heading_4
+ assert_equal "#### Hello\n", @to.end_accepting
+ end
+
+ def accept_heading_indent
+ assert_equal " # Hello\n", @to.end_accepting
+ end
+
+ def accept_heading_b
+ assert_equal "# **Hello**\n", @to.end_accepting
+ end
+
+ def accept_heading_suppressed_crossref
+ assert_equal "# Hello\n", @to.end_accepting
+ end
+
+ def accept_list_item_start_note_2
+ assert_equal "`teletype`\n: teletype description\n\n", @to.res.join
+ end
+
+ def accept_list_item_start_note_multi_description
+ assert_equal "label\n: description one\n\n: description two\n\n",
+ @to.res.join
+ end
+
+ def accept_list_item_start_note_multi_label
+ assert_equal "one\ntwo\n: two headers\n\n", @to.res.join
+ end
+
+ def accept_paragraph_b
+ assert_equal "reg **bold words** reg\n", @to.end_accepting
+ end
+
+ def accept_paragraph_br
+ assert_equal "one \ntwo\n", @to.end_accepting
+ end
+
+ def accept_paragraph_break
+ assert_equal "hello \nworld\n", @to.end_accepting
+ end
+
+ def accept_paragraph_i
+ assert_equal "reg *italic words* reg\n", @to.end_accepting
+ end
+
+ def accept_paragraph_indent
+ expected = <<-EXPECTED
+ words words words words words words words words words words words words
+ words words words words words words words words words words words words
+ words words words words words words
+ EXPECTED
+
+ assert_equal expected, @to.end_accepting
+ end
+
+ def accept_paragraph_plus
+ assert_equal "reg `teletype` reg\n", @to.end_accepting
+ end
+
+ def accept_paragraph_star
+ assert_equal "reg **bold** reg\n", @to.end_accepting
+ end
+
+ def accept_paragraph_underscore
+ assert_equal "reg *italic* reg\n", @to.end_accepting
+ end
+
+ def accept_paragraph_wrap
+ expected = <<-EXPECTED
+words words words words words words words words words words words words words
+words words words words words words words words words words words words words
+words words words words
+ EXPECTED
+
+ assert_equal expected, @to.end_accepting
+ end
+
+ def accept_rule_indent
+ assert_equal " ---\n", @to.end_accepting
+ end
+
+ def accept_verbatim_indent
+ assert_equal " hi\n world\n\n", @to.end_accepting
+ end
+
+ def accept_verbatim_big_indent
+ assert_equal " hi\n world\n\n", @to.end_accepting
+ end
+
+ def list_nested
+ expected = <<-EXPECTED
+* l1
+ * l1.1
+
+* l2
+
+ EXPECTED
+
+ assert_equal expected, @to.end_accepting
+ end
+
+ def list_verbatim
+ expected = <<-EXPECTED # HACK overblown
+* list stuff
+
+ * list
+ with
+
+ second
+
+ 1. indented
+ 2. numbered
+
+ third
+
+ * second
+
+
+ EXPECTED
+
+ assert_equal expected, @to.end_accepting
+ end
+
+ def test_convert_RDOCLINK
+ result = @to.convert 'rdoc-garbage:C'
+
+ 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]'
+
+ expected = "[DSL](http://en.wikipedia.org/wiki/Domain-specific_language)\n"
+
+ assert_equal expected, result
+ end
+
+ def test_handle_rdoc_link_label_footmark
+ assert_equal '[^1]:', @to.handle_rdoc_link('rdoc-label:footmark-1:x')
+ end
+
+ def test_handle_rdoc_link_label_foottext
+ assert_equal '[^1]', @to.handle_rdoc_link('rdoc-label:foottext-1:x')
+ end
+
+ def test_handle_rdoc_link_label_label
+ assert_equal '[x](#label-x)', @to.handle_rdoc_link('rdoc-label:label-x')
+ end
+
+ def test_handle_rdoc_link_ref
+ assert_equal 'x', @to.handle_rdoc_link('rdoc-ref:x')
+ end
+
+end
+
diff --git a/test/rdoc/test_rdoc_markup_to_rdoc.rb b/test/rdoc/test_rdoc_markup_to_rdoc.rb
index 06cae078c6..4b60d0133e 100644
--- a/test/rdoc/test_rdoc_markup_to_rdoc.rb
+++ b/test/rdoc/test_rdoc_markup_to_rdoc.rb
@@ -1,7 +1,4 @@
-require 'rubygems'
-require 'rdoc/markup/text_formatter_test_case'
-require 'rdoc/markup/to_rdoc'
-require 'minitest/autorun'
+require 'rdoc/test_case'
class TestRDocMarkupToRDoc < RDoc::Markup::TextFormatterTestCase
@@ -18,6 +15,10 @@ class TestRDocMarkupToRDoc < RDoc::Markup::TextFormatterTestCase
assert_equal "\n", @to.res.join
end
+ def accept_block_quote
+ assert_equal "> quote\n", @to.res.join
+ end
+
def accept_document
assert_equal "hello\n", @to.res.join
end
@@ -67,7 +68,7 @@ class TestRDocMarkupToRDoc < RDoc::Markup::TextFormatterTestCase
end
def accept_list_item_end_label
- assert_equal "\n", @to.res.join
+ assert_equal "cat:\n", @to.res.join
assert_equal 0, @to.indent, 'indent'
end
@@ -77,7 +78,7 @@ class TestRDocMarkupToRDoc < RDoc::Markup::TextFormatterTestCase
end
def accept_list_item_end_note
- assert_equal "\n", @to.res.join
+ assert_equal "cat:\n", @to.res.join
assert_equal 0, @to.indent, 'indent'
end
@@ -244,10 +245,27 @@ class TestRDocMarkupToRDoc < RDoc::Markup::TextFormatterTestCase
assert_equal "<tt>teletype</tt>:\n teletype description\n\n", @to.res.join
end
+ def accept_list_item_start_note_multi_description
+ assert_equal "label:\n description one\n\n description two\n\n",
+ @to.res.join
+ end
+
+ def accept_list_item_start_note_multi_label
+ assert_equal "one\ntwo:\n two headers\n\n", @to.res.join
+ end
+
def accept_paragraph_b
assert_equal "reg <b>bold words</b> reg\n", @to.end_accepting
end
+ def accept_paragraph_br
+ assert_equal "one\ntwo\n", @to.end_accepting
+ end
+
+ def accept_paragraph_break
+ assert_equal "hello\nworld\n", @to.end_accepting
+ end
+
def accept_paragraph_i
assert_equal "reg <em>italic words</em> reg\n", @to.end_accepting
end
@@ -327,6 +345,24 @@ words words words words
assert_equal expected, @to.end_accepting
end
+ # functional test
+ def test_convert_list_note
+ note_list = <<-NOTE_LIST
+foo ::
+bar ::
+ hi
+ NOTE_LIST
+
+ expected = <<-EXPECTED
+foo
+bar:
+ hi
+
+ EXPECTED
+
+ assert_equal expected, @to.convert(note_list)
+ end
+
def test_accept_indented_paragraph
ip = RDoc::Markup::IndentedParagraph.new 2, 'cats are cool'
diff --git a/test/rdoc/test_rdoc_markup_to_table_of_contents.rb b/test/rdoc/test_rdoc_markup_to_table_of_contents.rb
new file mode 100644
index 0000000000..ba17b845a7
--- /dev/null
+++ b/test/rdoc/test_rdoc_markup_to_table_of_contents.rb
@@ -0,0 +1,126 @@
+require 'rdoc/test_case'
+
+class TestRDocMarkupToTableOfContents < RDoc::Markup::FormatterTestCase
+
+ add_visitor_tests
+
+ def setup
+ super
+
+ @to = RDoc::Markup::ToTableOfContents.new
+ end
+
+ def end_accepting
+ assert_equal %w[hi], @to.res
+ end
+
+ def empty
+ assert_empty @to.res
+ end
+
+ def accept_heading
+ assert_equal [@RM::Heading.new(5, 'Hello')], @to.res
+ end
+
+ def accept_heading_1
+ assert_equal [@RM::Heading.new(1, 'Hello')], @to.res
+ end
+
+ def accept_heading_2
+ assert_equal [@RM::Heading.new(2, 'Hello')], @to.res
+ end
+
+ def accept_heading_3
+ assert_equal [@RM::Heading.new(3, 'Hello')], @to.res
+ end
+
+ def accept_heading_4
+ assert_equal [@RM::Heading.new(4, 'Hello')], @to.res
+ end
+
+ def accept_heading_b
+ assert_equal [@RM::Heading.new(1, '*Hello*')], @to.res
+ end
+
+ def accept_heading_suppressed_crossref
+ assert_equal [@RM::Heading.new(1, '\\Hello')], @to.res
+ end
+
+ alias accept_blank_line empty
+ alias accept_block_quote empty
+ alias accept_document empty
+ alias accept_list_end_bullet empty
+ alias accept_list_end_label empty
+ alias accept_list_end_lalpha empty
+ alias accept_list_end_note empty
+ alias accept_list_end_number empty
+ alias accept_list_end_ualpha empty
+ alias accept_list_item_end_bullet empty
+ alias accept_list_item_end_label empty
+ alias accept_list_item_end_lalpha empty
+ alias accept_list_item_end_note empty
+ alias accept_list_item_end_number empty
+ alias accept_list_item_end_ualpha empty
+ alias accept_list_item_start_bullet empty
+ alias accept_list_item_start_label empty
+ alias accept_list_item_start_lalpha empty
+ alias accept_list_item_start_note empty
+ alias accept_list_item_start_note_2 empty
+ alias accept_list_item_start_note_multi_description empty
+ alias accept_list_item_start_note_multi_label empty
+ alias accept_list_item_start_number empty
+ alias accept_list_item_start_ualpha empty
+ alias accept_list_start_bullet empty
+ alias accept_list_start_label empty
+ alias accept_list_start_lalpha empty
+ alias accept_list_start_note empty
+ alias accept_list_start_number empty
+ alias accept_list_start_ualpha empty
+ alias accept_paragraph empty
+ alias accept_paragraph_b empty
+ alias accept_paragraph_br empty
+ alias accept_paragraph_break empty
+ alias accept_paragraph_i empty
+ alias accept_paragraph_plus empty
+ alias accept_paragraph_star empty
+ alias accept_paragraph_underscore empty
+ alias accept_raw empty
+ alias accept_rule empty
+ alias accept_verbatim empty
+ alias list_nested empty
+ alias list_verbatim empty
+ alias start_accepting empty
+
+ def test_accept_document_omit_headings_below
+ document = doc
+ document.omit_headings_below = 2
+
+ @to.accept_document document
+
+ assert_equal 2, @to.omit_headings_below
+ end
+
+ def test_accept_heading_suppressed
+ @to.start_accepting
+ @to.omit_headings_below = 4
+
+ suppressed = head 5, 'Hello'
+
+ @to.accept_heading suppressed
+
+ assert_empty @to.res
+ end
+
+ def test_suppressed_eh
+ @to.omit_headings_below = nil
+
+ refute @to.suppressed? head(1, '')
+
+ @to.omit_headings_below = 1
+
+ refute @to.suppressed? head(1, '')
+ assert @to.suppressed? head(2, '')
+ end
+
+end
+
diff --git a/test/rdoc/test_rdoc_markup_to_tt_only.rb b/test/rdoc/test_rdoc_markup_to_tt_only.rb
index f5bb662897..2e950dd1b0 100644
--- a/test/rdoc/test_rdoc_markup_to_tt_only.rb
+++ b/test/rdoc/test_rdoc_markup_to_tt_only.rb
@@ -1,7 +1,4 @@
-require 'rubygems'
-require 'rdoc/markup/formatter_test_case'
-require 'rdoc/markup/to_tt_only'
-require 'minitest/autorun'
+require 'rdoc/test_case'
class TestRDocMarkupToTtOnly < RDoc::Markup::FormatterTestCase
@@ -17,6 +14,10 @@ class TestRDocMarkupToTtOnly < RDoc::Markup::FormatterTestCase
assert_empty @to.end_accepting
end
+ def accept_block_quote
+ assert_empty @to.end_accepting
+ end
+
def accept_document
assert_equal [], @to.res
end
@@ -125,6 +126,10 @@ class TestRDocMarkupToTtOnly < RDoc::Markup::FormatterTestCase
assert_empty @to.end_accepting
end
+ def accept_paragraph_break
+ assert_empty @to.end_accepting
+ end
+
def accept_raw
assert_empty @to.end_accepting
end
@@ -177,10 +182,22 @@ class TestRDocMarkupToTtOnly < RDoc::Markup::FormatterTestCase
assert_equal [nil, 'teletype', nil], @to.res
end
+ def accept_list_item_start_note_multi_description
+ assert_empty @to.res
+ end
+
+ def accept_list_item_start_note_multi_label
+ assert_empty @to.res
+ end
+
def accept_paragraph_b
assert_empty @to.end_accepting
end
+ def accept_paragraph_br
+ assert_empty @to.end_accepting
+ end
+
def accept_paragraph_i
assert_empty @to.end_accepting
end
diff --git a/test/rdoc/test_rdoc_markup_verbatim.rb b/test/rdoc/test_rdoc_markup_verbatim.rb
new file mode 100644
index 0000000000..781d52849a
--- /dev/null
+++ b/test/rdoc/test_rdoc_markup_verbatim.rb
@@ -0,0 +1,29 @@
+require 'rdoc/test_case'
+
+class TestRDocMarkupVerbatim < RDoc::TestCase
+
+ def test_equals2
+ v1 = verb('1 + 1')
+ v2 = verb('1 + 1')
+ v3 = verb('1 + 2')
+ v4 = verb('1 + 1')
+ v4.format = :ruby
+
+ assert_equal v1, v2
+
+ refute_equal v1, v3
+ refute_equal v1, v4
+ end
+
+ def test_ruby_eh
+ verbatim = RDoc::Markup::Verbatim.new
+
+ refute verbatim.ruby?
+
+ verbatim.format = :ruby
+
+ assert verbatim.ruby?
+ end
+
+end
+
diff --git a/test/rdoc/test_rdoc_method_attr.rb b/test/rdoc/test_rdoc_method_attr.rb
index 007a3f6b35..a91ebc23d7 100644
--- a/test/rdoc/test_rdoc_method_attr.rb
+++ b/test/rdoc/test_rdoc_method_attr.rb
@@ -2,6 +2,10 @@ require File.expand_path '../xref_test_case', __FILE__
class TestRDocMethodAttr < XrefTestCase
+ 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')
@@ -111,12 +115,49 @@ class TestRDocMethodAttr < XrefTestCase
assert_nil @m1_m.find_method_or_attribute 'm'
end
+ def test_full_name
+ assert_equal 'C1#m', @c1_m.full_name
+ 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)
+
+ assert_equal 'C1#m', @c1_m.output_name(@c2)
+ assert_equal 'C1.m', @c1__m.output_name(@c2)
+ end
+
+ def test_search_record
+ @c1_m.comment = 'This is a comment.'
+
+ expected = [
+ 'm',
+ 'C1#m',
+ 'm',
+ 'C1',
+ 'C1.html#method-i-m',
+ '(foo)',
+ "<p>This is a comment.\n",
+ ]
+
+ assert_equal expected, @c1_m.search_record
+ end
+
+ def test_equals2
+ assert_equal @c1_m, @c1_m
+ refute_equal @c1_m, @parent_m
+ 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
assert_equal 'RDoc::AnyMethod: C1::m', @c1__m.to_s
end
-
end
diff --git a/test/rdoc/test_rdoc_normal_class.rb b/test/rdoc/test_rdoc_normal_class.rb
index bd0d67e19c..9f8896831b 100644
--- a/test/rdoc/test_rdoc_normal_class.rb
+++ b/test/rdoc/test_rdoc_normal_class.rb
@@ -2,15 +2,39 @@ require File.expand_path '../xref_test_case', __FILE__
class TestRDocNormalClass < XrefTestCase
- def test_ancestors_class
- top_level = RDoc::TopLevel.new 'file.rb'
- klass = top_level.add_class RDoc::NormalClass, 'Klass'
+ def test_ancestors
+ klass = @top_level.add_class RDoc::NormalClass, 'Klass'
incl = RDoc::Include.new 'Incl', ''
- sub_klass = klass.add_class RDoc::NormalClass, 'SubClass', 'Klass'
+ sub_klass = @top_level.add_class RDoc::NormalClass, 'SubClass'
+ sub_klass.superclass = klass
sub_klass.add_include incl
- assert_equal [incl.name, klass], sub_klass.ancestors
+ assert_equal [incl.name, klass, 'Object'], sub_klass.ancestors
+ end
+
+ 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
+
+ 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
+ c3.add_include incl
+
+ assert_equal [incl.name, c2], c3.direct_ancestors
end
def test_definition
diff --git a/test/rdoc/test_rdoc_normal_module.rb b/test/rdoc/test_rdoc_normal_module.rb
index 975bf911fe..1944564596 100644
--- a/test/rdoc/test_rdoc_normal_module.rb
+++ b/test/rdoc/test_rdoc_normal_module.rb
@@ -9,7 +9,7 @@ class TestRDocNormalModule < XrefTestCase
end
def test_ancestors_module
- top_level = RDoc::TopLevel.new 'file.rb'
+ top_level = @store.add_file 'file.rb'
mod = top_level.add_module RDoc::NormalModule, 'Mod'
incl = RDoc::Include.new 'Incl', ''
@@ -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 763f50b5f0..f4929604f7 100644
--- a/test/rdoc/test_rdoc_options.rb
+++ b/test/rdoc/test_rdoc_options.rb
@@ -1,56 +1,126 @@
-require 'rubygems'
-require 'minitest/autorun'
-require 'rdoc/options'
+require 'rdoc/test_case'
-require 'fileutils'
-require 'tmpdir'
-
-class TestRDocOptions < MiniTest::Unit::TestCase
+class TestRDocOptions < RDoc::TestCase
def setup
+ super
+
@options = RDoc::Options.new
@generators = RDoc::RDoc::GENERATORS.dup
end
def teardown
+ super
+
RDoc::RDoc::GENERATORS.replace @generators
end
def test_check_files
skip "assumes UNIX permission model" if /mswin|mingw/ =~ RUBY_PLATFORM
+
out, err = capture_io do
- Dir.mktmpdir do |dir|
- Dir.chdir dir do
- FileUtils.touch 'unreadable'
- FileUtils.chmod 0, 'unreadable'
+ temp_dir do
+ FileUtils.touch 'unreadable'
+ FileUtils.chmod 0, 'unreadable'
- @options.files = %w[nonexistent unreadable]
+ @options.files = %w[nonexistent unreadable]
- @options.check_files
- end
+ @options.check_files
end
end
assert_empty @options.files
- assert_equal '', out
+ assert_empty out
+ assert_empty err
+ end
+
+ def test_check_files_warn
+ @options.verbosity = 2
- expected = <<-EXPECTED
-file 'nonexistent' not found
-file 'unreadable' not readable
- EXPECTED
+ out, err = verbose_capture_io do
+ @options.files = %w[nonexistent]
- assert_equal expected, err
+ @options.check_files
+ end
+
+ assert_empty out
+ assert_equal "file 'nonexistent' not found\n", err
+ assert_empty @options.files
end
def test_dry_run_default
refute @options.dry_run
end
+ def test_encode_with
+ coder = {}
+ class << coder; alias add []=; end
+
+ @options.encode_with coder
+
+ 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',
+ '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
+ end
+
+ def test_encode_with_trim_paths
+ subdir = nil
+ coder = {}
+ class << coder; alias add []=; end
+
+ temp_dir do |dir|
+ FileUtils.mkdir 'project'
+ FileUtils.mkdir 'dir'
+ FileUtils.touch 'file'
+
+ Dir.chdir 'project' do
+ subdir = File.expand_path 'subdir'
+ FileUtils.mkdir 'subdir'
+ @options.parse %w[
+ --copy subdir
+ --copy ../file
+ --copy ../
+ --copy /
+ --include subdir
+ --include ../dir
+ --include ../
+ --include /
+ ]
+
+ @options.encode_with coder
+ end
+ end
+
+ assert_equal [subdir], coder['rdoc_include']
+
+ assert_equal [subdir], coder['static_path']
+ end
+
def test_encoding_default
skip "Encoding not implemented" unless Object.const_defined? :Encoding
- assert_equal Encoding.default_external, @options.encoding
+ assert_equal Encoding::UTF_8, @options.encoding
end
def test_generator_descriptions
@@ -67,6 +137,65 @@ file 'unreadable' not readable
assert_equal expected, @options.generator_descriptions
end
+ def test_init_with_encoding
+ skip "Encoding not implemented" unless Object.const_defined? :Encoding
+ RDoc.load_yaml
+
+ @options.encoding = Encoding::IBM437
+
+ options = YAML.load YAML.dump @options
+
+ assert_equal Encoding::IBM437, options.encoding
+ end
+
+ def test_init_with_trim_paths
+ RDoc.load_yaml
+
+ yaml = <<-YAML
+--- !ruby/object:RDoc::Options
+static_path:
+- /etc
+rdoc_include:
+- /etc
+ YAML
+
+ options = YAML.load yaml
+
+ assert_empty options.rdoc_include
+ assert_empty options.static_path
+ end
+
+ def test_parse_copy_files_file_relative
+ file = File.basename __FILE__
+ expected = File.expand_path __FILE__
+
+ Dir.chdir File.expand_path('..', __FILE__) do
+ @options.parse %W[--copy-files #{file}]
+
+ assert_equal [expected], @options.static_path
+ end
+ end
+
+ def test_parse_copy_files_file_absolute
+ @options.parse %W[--copy-files #{File.expand_path __FILE__}]
+
+ assert_equal [File.expand_path(__FILE__)], @options.static_path
+ end
+
+ def test_parse_copy_files_directory_relative
+ @options.parse %w[--copy-files .]
+
+ assert_equal [@pwd], @options.static_path
+ end
+
+ def test_parse_copy_files_directory_absolute
+ @options.parse %w[--copy-files /]
+
+ assert_equal 1, @options.static_path.length
+
+ assert_match %r%^([A-Z]:)?/$%i, @options.static_path.first
+ end
+
def test_parse_coverage
@options.parse %w[--dcov]
@@ -238,6 +367,20 @@ file 'unreadable' not readable
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]
@@ -275,6 +418,39 @@ file 'unreadable' not readable
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]
@@ -286,6 +462,95 @@ file 'unreadable' not readable
assert_equal 'MAIN', @options.main_page
end
+ def test_parse_markup
+ out, err = capture_io do
+ @options.parse %w[--markup tomdoc]
+ end
+
+ assert_empty out
+ assert_empty err
+
+ assert_equal 'tomdoc', @options.markup
+ end
+
+ def test_parse_page_dir
+ assert_nil @options.page_dir
+
+ out, err = capture_io do
+ @options.parse %W[--page-dir #{Dir.tmpdir}]
+ end
+
+ assert_empty out
+ assert_empty err
+
+ expected =
+ Pathname(Dir.tmpdir).expand_path.relative_path_from @options.root
+
+ assert_equal expected, @options.page_dir
+ assert_equal [Dir.tmpdir], @options.files
+ end
+
+ def test_parse_page_dir_root
+ assert_nil @options.page_dir
+
+ Dir.mktmpdir do |dir|
+ abs_root = dir
+ abs_page_dir = File.join dir, 'pages'
+ FileUtils.mkdir abs_page_dir
+
+ out, err = capture_io do
+ @options.parse %W[--page-dir #{abs_page_dir} --root #{abs_root}]
+ end
+
+ assert_empty out
+ assert_empty err
+
+ assert_equal Pathname('pages'), @options.page_dir
+ assert_equal [abs_page_dir], @options.files
+ 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
+
+ out, err = capture_io do
+ @options.parse %W[--root #{Dir.tmpdir}]
+ end
+
+ assert_empty out
+ 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
out, err = capture_io do
@options.parse %w[--template darkfish]
@@ -337,6 +602,48 @@ file 'unreadable' not readable
$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
+
+ Dir.chdir tmpdir do
+ e = assert_raises SystemExit do
+ @options.parse %w[--write-options]
+ end
+
+ assert_equal 0, e.status
+
+ assert File.exist? '.rdoc_options'
+ end
+ ensure
+ FileUtils.rm_rf tmpdir
+ end
+
+ def test_parse_extension_alias
+ out, err = capture_io do
+ @options.parse %w[--extension foobar=rdoc]
+ end
+
+ assert_includes RDoc::Parser.parsers, [/\.foobar$/, RDoc::Parser::Simple]
+
+ assert_empty out
+ assert_empty err
+ end
+
def test_setup_generator
test_generator = Class.new do
def self.setup_options op
@@ -388,5 +695,53 @@ file 'unreadable' not readable
refute @options.update_output_dir
end
+ def test_warn
+ out, err = capture_io do
+ @options.warn "warnings off"
+ end
+
+ assert_empty out
+ assert_empty err
+
+ @options.verbosity = 2
+
+ out, err = verbose_capture_io do
+ @options.warn "warnings on"
+ end
+
+ assert_empty out
+ assert_equal "warnings on\n", err
+ end
+
+ def test_write_options
+ temp_dir do |dir|
+ @options.write_options
+
+ assert File.exist? '.rdoc_options'
+
+ assert_equal @options, YAML.load(File.read('.rdoc_options'))
+ 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
+
end
diff --git a/test/rdoc/test_rdoc_parser.rb b/test/rdoc/test_rdoc_parser.rb
index e0629e37b6..b9bff9c327 100644
--- a/test/rdoc/test_rdoc_parser.rb
+++ b/test/rdoc/test_rdoc_parser.rb
@@ -1,14 +1,18 @@
-require 'rubygems'
-require 'minitest/autorun'
-require 'rdoc/parser'
-require 'rdoc/parser/ruby'
-require 'tmpdir'
+# -*- coding: us-ascii -*-
-class TestRDocParser < MiniTest::Unit::TestCase
+require 'rdoc/test_case'
+
+class TestRDocParser < RDoc::TestCase
def setup
+ super
+
@RP = RDoc::Parser
@binary_dat = File.expand_path '../binary.dat', __FILE__
+
+ @fn = 'file.rb'
+ @top_level = RDoc::TopLevel.new @fn
+ @options = RDoc::Options.new
end
def test_class_binary_eh_marshal
@@ -29,8 +33,18 @@ class TestRDocParser < MiniTest::Unit::TestCase
end
def test_class_binary_large_japanese_rdoc
- file_name = File.expand_path '../test.ja.large.rdoc', __FILE__
- assert !@RP.binary?(file_name)
+ skip "Encoding not implemented" unless Object.const_defined? :Encoding
+
+ capture_io do
+ begin
+ extenc, Encoding.default_external =
+ Encoding.default_external, Encoding::US_ASCII
+ file_name = File.expand_path '../test.ja.largedoc', __FILE__
+ assert !@RP.binary?(file_name)
+ ensure
+ Encoding.default_external = extenc
+ end
+ end
end
def test_class_binary_japanese_rdoc
@@ -47,7 +61,7 @@ class TestRDocParser < MiniTest::Unit::TestCase
assert_equal @RP::Simple, @RP.can_parse(readme_file_name)
- assert_nil @RP.can_parse(@binary_dat)
+ assert_equal @RP::Simple, @RP.can_parse(@binary_dat)
jtest_file_name = File.expand_path '../test.ja.txt', __FILE__
assert_equal @RP::Simple, @RP.can_parse(jtest_file_name)
@@ -57,6 +71,72 @@ class TestRDocParser < MiniTest::Unit::TestCase
readme_file_name = File.expand_path '../README', __FILE__
assert_equal @RP::Simple, @RP.can_parse(readme_file_name)
+
+ jtest_largerdoc_file_name = File.expand_path '../test.ja.largedoc', __FILE__
+ assert_equal @RP::Simple, @RP.can_parse(jtest_largerdoc_file_name)
+
+ @RP.alias_extension 'rdoc', 'largedoc'
+ assert_equal @RP::Simple, @RP.can_parse(jtest_largerdoc_file_name)
+ end
+
+ def test_class_for_executable
+ temp_dir do
+ content = "#!/usr/bin/env ruby -w\n"
+ open 'app', 'w' do |io| io.write content end
+ app = @store.add_file 'app'
+
+ parser = @RP.for app, 'app', content, @options, :stats
+
+ assert_kind_of RDoc::Parser::Ruby, parser
+
+ assert_equal 'app', parser.file_name
+ end
+ end
+
+ def test_class_for_forbidden
+ skip 'chmod not supported' if Gem.win_platform?
+
+ Tempfile.open 'forbidden' do |io|
+ begin
+ File.chmod 0000, io.path
+ forbidden = @store.add_file io.path
+
+ parser = @RP.for forbidden, 'forbidden', '', @options, :stats
+
+ assert_nil parser
+ ensure
+ File.chmod 0400, io.path
+ end
+ end
+ 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
+
+ def test_can_parse_modeline
+ readme_ext = File.join Dir.tmpdir, "README.EXT.#{$$}"
+
+ open readme_ext, 'w' do |io|
+ io.puts "# README.EXT - -*- rdoc -*- created at: Mon Aug 7 16:45:54 JST 1995"
+ io.puts
+ io.puts "This document explains how to make extension libraries for Ruby."
+ end
+
+ assert_equal RDoc::Parser::Simple, @RP.can_parse(readme_ext)
+ ensure
+ File.unlink readme_ext
end
##
@@ -67,6 +147,58 @@ class TestRDocParser < MiniTest::Unit::TestCase
assert_nil @RP.can_parse(hidden_zip)
end
+ def test_check_modeline
+ readme_ext = File.join Dir.tmpdir, "README.EXT.#{$$}"
+
+ open readme_ext, 'w' do |io|
+ io.puts "# README.EXT - -*- RDoc -*- created at: Mon Aug 7 16:45:54 JST 1995"
+ io.puts
+ io.puts "This document explains how to make extension libraries for Ruby."
+ end
+
+ assert_equal 'rdoc', @RP.check_modeline(readme_ext)
+ ensure
+ File.unlink readme_ext
+ end
+
+ def test_check_modeline_coding
+ readme_ext = File.join Dir.tmpdir, "README.EXT.#{$$}"
+
+ open readme_ext, 'w' do |io|
+ io.puts "# -*- coding: utf-8 -*-"
+ end
+
+ assert_nil @RP.check_modeline readme_ext
+ ensure
+ File.unlink readme_ext
+ end
+
+ def test_check_modeline_with_other
+ readme_ext = File.join Dir.tmpdir, "README.EXT.#{$$}"
+
+ open readme_ext, 'w' do |io|
+ io.puts "# README.EXT - -*- mode: RDoc; indent-tabs-mode: nil -*-"
+ io.puts
+ io.puts "This document explains how to make extension libraries for Ruby."
+ end
+
+ assert_equal 'rdoc', @RP.check_modeline(readme_ext)
+ ensure
+ File.unlink readme_ext
+ end
+
+ def test_check_modeline_no_modeline
+ readme_ext = File.join Dir.tmpdir, "README.EXT.#{$$}"
+
+ open readme_ext, 'w' do |io|
+ io.puts "This document explains how to make extension libraries for Ruby."
+ end
+
+ assert_nil @RP.check_modeline(readme_ext)
+ ensure
+ File.unlink readme_ext
+ end
+
def test_class_for_binary
rp = @RP.dup
@@ -79,5 +211,92 @@ class TestRDocParser < MiniTest::Unit::TestCase
assert_nil @RP.for(nil, @binary_dat, nil, nil, nil)
end
+ def test_class_for_markup
+ content = <<-CONTENT
+# coding: utf-8 markup: rd
+ CONTENT
+
+ parser = @RP.for @top_level, __FILE__, content, @options, nil
+
+ assert_kind_of @RP::RD, parser
+ end
+
+ def test_class_use_markup
+ content = <<-CONTENT
+# coding: utf-8 markup: rd
+ CONTENT
+
+ parser = @RP.use_markup content
+
+ assert_equal @RP::RD, parser
+ end
+
+ def test_class_use_markup_markdown
+ content = <<-CONTENT
+# coding: utf-8 markup: markdown
+ CONTENT
+
+ parser = @RP.use_markup content
+
+ assert_equal @RP::Ruby, parser
+ end
+
+ def test_class_use_markup_modeline
+ content = <<-CONTENT
+# -*- coding: utf-8 -*-
+# markup: rd
+ CONTENT
+
+ parser = @RP.use_markup content
+
+ assert_equal @RP::RD, parser
+ end
+
+ def test_class_use_markup_modeline_shebang
+ content = <<-CONTENT
+#!/bin/sh
+/* -*- coding: utf-8 -*-
+ * markup: rd
+ */
+ CONTENT
+
+ parser = @RP.use_markup content
+
+ assert_equal @RP::RD, parser
+ end
+
+ def test_class_use_markup_shebang
+ content = <<-CONTENT
+#!/usr/bin/env ruby
+# coding: utf-8 markup: rd
+ CONTENT
+
+ parser = @RP.use_markup content
+
+ assert_equal @RP::RD, parser
+ end
+
+ def test_class_use_markup_tomdoc
+ content = <<-CONTENT
+# coding: utf-8 markup: tomdoc
+ CONTENT
+
+ parser = @RP.use_markup content
+
+ assert_equal @RP::Ruby, parser
+ end
+
+ def test_class_use_markup_none
+ parser = @RP.use_markup ''
+
+ assert_nil parser
+ end
+
+ def test_initialize
+ @RP.new @top_level, @fn, '', @options, nil
+
+ assert_equal @RP, @top_level.parser
+ end
+
end
diff --git a/test/rdoc/test_rdoc_parser_c.rb b/test/rdoc/test_rdoc_parser_c.rb
index 438eeee2ab..99be1cdead 100644
--- a/test/rdoc/test_rdoc_parser_c.rb
+++ b/test/rdoc/test_rdoc_parser_c.rb
@@ -1,9 +1,4 @@
-require 'stringio'
-require 'tempfile'
-require 'rubygems'
-require 'minitest/autorun'
-require 'rdoc/options'
-require 'rdoc/parser/c'
+require 'rdoc/test_case'
=begin
TODO: test call-seq parsing
@@ -45,45 +40,95 @@ assert call-seq correct
=end
-class RDoc::Parser::C
- attr_accessor :classes
-
- public :do_classes, :do_constants
-end
-
-class TestRDocParserC < MiniTest::Unit::TestCase
+class TestRDocParserC < RDoc::TestCase
def setup
+ super
+
@tempfile = Tempfile.new self.class.name
filename = @tempfile.path
- @top_level = RDoc::TopLevel.new filename
+ @top_level = @store.add_file filename
@fn = filename
@options = RDoc::Options.new
- @stats = RDoc::Stats.new 0
-
- RDoc::Parser::C.reset
- RDoc::TopLevel.reset
+ @options.verbosity = 2
+ @stats = RDoc::Stats.new @store, 0
end
def teardown
+ super
+
@tempfile.close
end
def test_class_can_parse
c_parser = RDoc::Parser::C
- assert_equal c_parser, c_parser.can_parse('file.C')
- assert_equal c_parser, c_parser.can_parse('file.CC')
- assert_equal c_parser, c_parser.can_parse('file.H')
- assert_equal c_parser, c_parser.can_parse('file.HH')
- assert_equal c_parser, c_parser.can_parse('file.c')
- assert_equal c_parser, c_parser.can_parse('file.cc')
- assert_equal c_parser, c_parser.can_parse('file.cpp')
- assert_equal c_parser, c_parser.can_parse('file.cxx')
- assert_equal c_parser, c_parser.can_parse('file.h')
- assert_equal c_parser, c_parser.can_parse('file.hh')
- assert_equal c_parser, c_parser.can_parse('file.y')
+ temp_dir do
+ FileUtils.touch 'file.C'
+ assert_equal c_parser, c_parser.can_parse('file.C')
+
+ FileUtils.touch 'file.CC'
+ assert_equal c_parser, c_parser.can_parse('file.CC')
+
+ FileUtils.touch 'file.H'
+ assert_equal c_parser, c_parser.can_parse('file.H')
+
+ FileUtils.touch 'file.HH'
+ assert_equal c_parser, c_parser.can_parse('file.HH')
+
+ FileUtils.touch 'file.c'
+ assert_equal c_parser, c_parser.can_parse('file.c')
+
+ FileUtils.touch 'file.cc'
+ assert_equal c_parser, c_parser.can_parse('file.cc')
+
+ FileUtils.touch 'file.cpp'
+ assert_equal c_parser, c_parser.can_parse('file.cpp')
+
+ FileUtils.touch 'file.cxx'
+ assert_equal c_parser, c_parser.can_parse('file.cxx')
+
+ FileUtils.touch 'file.h'
+ assert_equal c_parser, c_parser.can_parse('file.h')
+
+ FileUtils.touch 'file.hh'
+ assert_equal c_parser, c_parser.can_parse('file.hh')
+
+ FileUtils.touch 'file.y'
+ assert_equal c_parser, c_parser.can_parse('file.y')
+ end
+ end
+
+ def test_initialize
+ some_ext = @top_level.add_class RDoc::NormalClass, 'SomeExt'
+ @top_level.add_class RDoc::SingleClass, 'SomeExtSingle'
+
+ @store.cache[:c_class_variables] = {
+ @fn => { 'cSomeExt' => 'SomeExt' }
+ }
+
+ @store.cache[:c_singleton_class_variables] = {
+ @fn => { 'cSomeExtSingle' => 'SomeExtSingle' }
+ }
+
+ parser = RDoc::Parser::C.new @top_level, @fn, '', @options, @stats
+
+ expected = { 'cSomeExt' => some_ext }
+ assert_equal expected, parser.classes
+
+ expected = { 'cSomeExtSingle' => 'SomeExtSingle' }
+ assert_equal expected, parser.singleton_classes
+
+ expected = {
+ 'cSomeExt' => 'SomeExt',
+ 'cSomeExtSingle' => 'SomeExtSingle',
+ }
+ known_classes = parser.known_classes.delete_if do |key, _|
+ RDoc::KNOWN_CLASSES.keys.include? key
+ end
+
+ assert_equal expected, known_classes
end
def test_do_attr_rb_attr
@@ -116,18 +161,18 @@ void Init_Blah(void) {
accessor = attrs.shift
assert_equal 'accessor', accessor.name
assert_equal 'RW', accessor.rw
- assert_equal 'This is an accessor', accessor.comment
+ assert_equal 'This is an accessor', accessor.comment.text
assert_equal @top_level, accessor.file
reader = attrs.shift
assert_equal 'reader', reader.name
assert_equal 'R', reader.rw
- assert_equal 'This is a reader', reader.comment
+ assert_equal 'This is a reader', reader.comment.text
writer = attrs.shift
assert_equal 'writer', writer.name
assert_equal 'W', writer.rw
- assert_equal 'This is a writer', writer.comment
+ assert_equal 'This is a writer', writer.comment.text
end
def test_do_attr_rb_define_attr
@@ -150,7 +195,7 @@ void Init_Blah(void) {
accessor = attrs.shift
assert_equal 'accessor', accessor.name
assert_equal 'RW', accessor.rw
- assert_equal 'This is an accessor', accessor.comment
+ assert_equal 'This is an accessor', accessor.comment.text
assert_equal @top_level, accessor.file
end
@@ -211,7 +256,7 @@ void Init_Blah(void) {
assert_equal 'bleh', methods.last.name
assert methods.last.singleton
assert_equal 'blah', methods.last.is_alias_for.name
- assert_equal 'This should show up as an alias', methods.last.comment
+ assert_equal 'This should show up as an alias', methods.last.comment.text
end
def test_do_classes_boot_class
@@ -223,7 +268,7 @@ VALUE cFoo = boot_defclass("Foo", rb_cObject);
EOF
klass = util_get_class content, 'cFoo'
- assert_equal "this is the Foo boot class", klass.comment
+ assert_equal "this is the Foo boot class", klass.comment.text
assert_equal 'Object', klass.superclass
end
@@ -236,7 +281,7 @@ VALUE cFoo = boot_defclass("Foo", 0);
EOF
klass = util_get_class content, 'cFoo'
- assert_equal "this is the Foo boot class", klass.comment
+ assert_equal "this is the Foo boot class", klass.comment.text
assert_equal nil, klass.superclass
end
@@ -247,11 +292,11 @@ void Init_Blah(void) {
}
EOF
- _, err = capture_io do
+ _, err = verbose_capture_io do
refute util_get_class(content, 'cDate')
end
- assert_equal "Enclosing class/module \"cDate\" for alias b a not known\n",
+ assert_equal "Enclosing class or module \"cDate\" for alias b a is not known\n",
err
end
@@ -264,7 +309,21 @@ VALUE cFoo = rb_define_class("Foo", rb_cObject);
EOF
klass = util_get_class content, 'cFoo'
- assert_equal "this is the Foo class", klass.comment
+ assert_equal "this is the Foo class", klass.comment.text
+ end
+
+ def test_do_classes_struct
+ content = <<-EOF
+/* Document-class: Foo
+ * this is the Foo class
+ */
+VALUE cFoo = rb_struct_define_without_accessor(
+ "Foo", rb_cObject, foo_alloc,
+ "some", "various", "fields", NULL);
+ EOF
+
+ klass = util_get_class content, 'cFoo'
+ assert_equal "this is the Foo class", klass.comment.text
end
def test_do_classes_class_under
@@ -277,7 +336,7 @@ VALUE cFoo = rb_define_class_under(rb_mKernel, "Foo", rb_cObject);
klass = util_get_class content, 'cFoo'
assert_equal 'Kernel::Foo', klass.full_name
- assert_equal "this is the Foo class under Kernel", klass.comment
+ assert_equal "this is the Foo class under Kernel", klass.comment.text
end
def test_do_classes_class_under_rb_path2class
@@ -292,7 +351,7 @@ VALUE cFoo = rb_define_class_under(rb_mKernel, "Foo", rb_path2class("A::B"));
assert_equal 'Kernel::Foo', klass.full_name
assert_equal 'A::B', klass.superclass
- assert_equal 'this is Kernel::Foo < A::B', klass.comment
+ assert_equal 'this is Kernel::Foo < A::B', klass.comment.text
end
def test_do_classes_singleton
@@ -315,7 +374,7 @@ VALUE mFoo = rb_define_module("Foo");
EOF
klass = util_get_class content, 'mFoo'
- assert_equal "this is the Foo module", klass.comment
+ assert_equal "this is the Foo module", klass.comment.text
end
def test_do_classes_module_under
@@ -327,7 +386,7 @@ VALUE mFoo = rb_define_module_under(rb_mKernel, "Foo");
EOF
klass = util_get_class content, 'mFoo'
- assert_equal "this is the Foo module under Kernel", klass.comment
+ assert_equal "this is the Foo module under Kernel", klass.comment.text
end
def test_do_constants
@@ -377,6 +436,12 @@ void Init_foo(){
*/
rb_define_const(cFoo, "MULTILINE_NOT_EMPTY", INT2FIX(1));
+ /*
+ * Multiline comment goes here because this comment spans multiple lines.
+ * 1: However, the value extraction should only happen for the first line
+ */
+ rb_define_const(cFoo, "MULTILINE_COLON_ON_SECOND_LINE", INT2FIX(1));
+
}
EOF
@@ -393,7 +458,7 @@ void Init_foo(){
assert_equal @top_level, constants.first.file
- constants = constants.map { |c| [c.name, c.value, c.comment] }
+ constants = constants.map { |c| [c.name, c.value, c.comment.text] }
assert_equal ['PERFECT', '300', 'The highest possible score in bowling '],
constants.shift
@@ -426,6 +491,13 @@ Multiline comment goes here because this comment spans multiple lines.
assert_equal ['MULTILINE_VALUE', '1', comment], constants.shift
assert_equal ['MULTILINE_NOT_EMPTY', 'INT2FIX(1)', comment], constants.shift
+ comment = <<-EOF.chomp
+Multiline comment goes here because this comment spans multiple lines.
+1: However, the value extraction should only happen for the first line
+ EOF
+ assert_equal ['MULTILINE_COLON_ON_SECOND_LINE', 'INT2FIX(1)', comment],
+ constants.shift
+
assert constants.empty?, constants.inspect
end
@@ -445,6 +517,7 @@ void Init_curses(){
@parser = util_parser content
+ @parser.do_modules
@parser.do_classes
@parser.do_constants
@@ -455,7 +528,36 @@ void Init_curses(){
assert_equal 'COLOR_BLACK', constants.first.name
assert_equal 'UINT2NUM(COLOR_BLACK)', constants.first.value
- assert_equal 'Value of the color black', constants.first.comment
+ assert_equal 'Value of the color black', constants.first.comment.text
+ end
+
+ def test_do_constants_file
+ content = <<-EOF
+void Init_File(void) {
+ /* Document-const: LOCK_SH
+ *
+ * Shared lock
+ */
+ rb_file_const("LOCK_SH", INT2FIX(LOCK_SH));
+}
+ EOF
+
+ @parser = util_parser content
+
+ @parser.do_modules
+ @parser.do_classes
+ @parser.do_constants
+
+ klass = @parser.classes['rb_mFConst']
+
+ constants = klass.constants
+ refute_empty klass.constants
+
+ constant = constants.first
+
+ assert_equal 'LOCK_SH', constant.name
+ assert_equal 'INT2FIX(LOCK_SH)', constant.value
+ assert_equal 'Shared lock', constant.comment.text
end
def test_do_includes
@@ -472,7 +574,7 @@ Init_foo() {
incl = klass.includes.first
assert_equal 'Inc', incl.name
- assert_equal '', incl.comment
+ assert_equal '', incl.comment.text
assert_equal @top_level, incl.file
end
@@ -491,7 +593,7 @@ void Init_Blah(void) {
klass = nil
- _, err = capture_io do
+ _, err = verbose_capture_io do
klass = util_get_class content, 'cDate'
end
@@ -513,7 +615,7 @@ void Init_Blah(void) {
klass = nil
- _, err = capture_io do
+ _, err = verbose_capture_io do
klass = util_get_class content, 'cDate'
end
@@ -535,7 +637,7 @@ void Init_Blah(void) {
klass = nil
- _, err = capture_io do
+ _, err = verbose_capture_io do
klass = util_get_class content, 'cDate'
end
@@ -563,12 +665,63 @@ void Init_Blah(void) {
assert methods.first.singleton
end
+ def test_do_missing
+ parser = util_parser
+
+ klass_a = @top_level.add_class RDoc::ClassModule, 'A'
+ parser.classes['a'] = klass_a
+
+ parser.enclosure_dependencies['c'] << 'b'
+ parser.enclosure_dependencies['b'] << 'a'
+ parser.enclosure_dependencies['d'] << 'a'
+
+ parser.missing_dependencies['d'] = ['d', :class, 'D', 'Object', 'a']
+ parser.missing_dependencies['c'] = ['c', :class, 'C', 'Object', 'b']
+ parser.missing_dependencies['b'] = ['b', :class, 'B', 'Object', 'a']
+
+ parser.do_missing
+
+ assert_equal %w[A A::B A::B::C A::D],
+ @store.all_classes_and_modules.map { |m| m.full_name }.sort
+ end
+
+ def test_do_missing_cycle
+ parser = util_parser
+
+ klass_a = @top_level.add_class RDoc::ClassModule, 'A'
+ parser.classes['a'] = klass_a
+
+ parser.enclosure_dependencies['c'] << 'b'
+ parser.enclosure_dependencies['b'] << 'a'
+
+ parser.missing_dependencies['c'] = ['c', :class, 'C', 'Object', 'b']
+ parser.missing_dependencies['b'] = ['b', :class, 'B', 'Object', 'a']
+
+ parser.enclosure_dependencies['y'] << 'z'
+ parser.enclosure_dependencies['z'] << 'y'
+
+ parser.missing_dependencies['y'] = ['y', :class, 'Y', 'Object', 'z']
+ parser.missing_dependencies['z'] = ['z', :class, 'Z', 'Object', 'y']
+
+ _, err = verbose_capture_io do
+ parser.do_missing
+ end
+
+ expected = 'Unable to create class Y (y), class Z (z) ' +
+ 'due to a cyclic class or module creation'
+
+ assert_equal expected, err.chomp
+
+ assert_equal %w[A A::B A::B::C],
+ @store.all_classes_and_modules.map { |m| m.full_name }.sort
+ end
+
def test_find_alias_comment
- parser = util_parser ''
+ parser = util_parser
comment = parser.find_alias_comment 'C', '[]', 'index'
- assert_equal '', comment
+ assert_equal '', comment.text
parser = util_parser <<-C
/*
@@ -580,27 +733,28 @@ rb_define_alias(C, "[]", "index");
comment = parser.find_alias_comment 'C', '[]', 'index'
- assert_equal "/*\n * comment\n */\n\n", comment
+ assert_equal "/*\n * comment\n */\n\n", comment.text
end
- def test_find_class_comment_include
+ def test_find_class_comment
@options.rdoc_include << File.dirname(__FILE__)
content = <<-EOF
/*
- * a comment for class Foo
- *
- * :include: test.txt
+ * Comment 1
*/
-void
-Init_Foo(void) {
- VALUE foo = rb_define_class("Foo", rb_cObject);
-}
+foo = rb_define_class("MyClassName1", rb_cObject);
+
+/*
+ * Comment 2
+ */
+bar = rb_define_class("MyClassName2", rb_cObject);
EOF
- klass = util_get_class content, 'foo'
+ util_get_class content
- assert_equal "a comment for class Foo\n\ntest file", klass.comment
+ assert_equal "Comment 1", @parser.classes['foo'].comment.text
+ assert_equal "Comment 2", @parser.classes['bar'].comment.text
end
def test_find_class_comment_init
@@ -616,7 +770,7 @@ Init_Foo(void) {
klass = util_get_class content, 'foo'
- assert_equal "a comment for class Foo", klass.comment
+ assert_equal "a comment for class Foo", klass.comment.text
end
def test_find_class_comment_define_class
@@ -629,7 +783,7 @@ VALUE foo = rb_define_class("Foo", rb_cObject);
klass = util_get_class content, 'foo'
- assert_equal "a comment for class Foo", klass.comment
+ assert_equal "a comment for class Foo", klass.comment.text
end
def test_find_class_comment_define_class_Init_Foo
@@ -648,7 +802,7 @@ Init_Foo(void) {
klass = util_get_class content, 'foo'
- assert_equal "a comment for class Foo on Init", klass.comment
+ assert_equal "a comment for class Foo on Init", klass.comment.text
end
def test_find_class_comment_define_class_Init_Foo_no_void
@@ -667,7 +821,7 @@ Init_Foo() {
klass = util_get_class content, 'foo'
- assert_equal "a comment for class Foo on Init", klass.comment
+ assert_equal "a comment for class Foo on Init", klass.comment.text
end
def test_find_class_comment_define_class_bogus_comment
@@ -687,7 +841,42 @@ Init_Foo(void) {
klass = util_get_class content, 'foo'
- assert_equal '', klass.comment
+ assert_equal '', klass.comment.text
+ end
+
+ def test_find_class_comment_define_class_under
+ content = <<-EOF
+/*
+ * a comment for class Foo
+ */
+VALUE foo = rb_define_class_under(rb_cObject, "Foo", rb_cObject);
+ EOF
+
+ klass = util_get_class content, 'foo'
+
+ assert_equal "a comment for class Foo", klass.comment.text
+ end
+
+ def test_find_class_comment_define_class_under_Init
+ content = <<-EOF
+/*
+ * a comment for class Foo on Init
+ */
+void
+Init_Foo(void) {
+ /*
+ * a comment for class Foo on rb_define_class
+ */
+ VALUE foo = rb_define_class_under(rb_cObject, "Foo", rb_cObject);
+}
+ EOF
+
+ klass = util_get_class content, 'foo'
+
+ # the inner comment is used since Object::Foo is not necessarily the same
+ # thing as "Foo" for Init_
+ assert_equal "a comment for class Foo on rb_define_class",
+ klass.comment.text
end
def test_find_const_comment_rb_define
@@ -702,7 +891,7 @@ rb_define_const(cFoo, "CONST", value);
comment = parser.find_const_comment 'const', 'CONST'
- assert_equal "/*\n * A comment\n */\n", comment
+ assert_equal "/*\n * A comment\n */\n", comment.text
end
def test_find_const_comment_document_const
@@ -718,7 +907,7 @@ rb_define_const(cFoo, "CONST", value);
comment = parser.find_const_comment nil, 'CONST'
- assert_equal " *\n * A comment\n */", comment
+ assert_equal "/*\n *\n * A comment\n */", comment.text
end
def test_find_const_comment_document_const_full_name
@@ -734,7 +923,7 @@ rb_define_const(cFoo, "CONST", value);
comment = parser.find_const_comment nil, 'CONST', 'Foo'
- assert_equal " *\n * A comment\n */", comment
+ assert_equal "/*\n *\n * A comment\n */", comment.text
end
def test_find_body
@@ -759,7 +948,7 @@ Init_Foo(void) {
assert_equal 'my_method', other_function.name
assert_equal "a comment for other_function",
- other_function.comment
+ other_function.comment.text
assert_equal '()', other_function.params
code = other_function.token_stream.first.text
@@ -807,6 +996,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
@@ -832,7 +1051,7 @@ Init_Foo(void) {
other_function = klass.method_list.first
assert_equal 'my_method', other_function.name
- assert_equal 'a comment for rb_other_function', other_function.comment
+ assert_equal 'a comment for rb_other_function', other_function.comment.text
assert_equal '()', other_function.params
assert_equal 118, other_function.offset
assert_equal 8, other_function.line
@@ -866,7 +1085,7 @@ Init_Foo(void) {
other_function = klass.method_list.first
assert_equal 'my_method', other_function.name
- assert_equal 'a comment for other_function', other_function.comment
+ assert_equal 'a comment for other_function', other_function.comment.text
assert_equal '()', other_function.params
assert_equal 39, other_function.offset
assert_equal 4, other_function.line
@@ -904,11 +1123,11 @@ Init_Foo(void) {
bar = methods.first
assert_equal 'Foo#bar', bar.full_name
- assert_equal "a comment for bar", bar.comment
+ assert_equal "a comment for bar", bar.comment.text
baz = methods.last
assert_equal 'Foo#baz', baz.full_name
- assert_equal "a comment for bar", baz.comment
+ assert_equal "a comment for bar", baz.comment.text
end
def test_find_body_document_method_equals
@@ -938,7 +1157,7 @@ Init_zlib() {
bar = methods.first
assert_equal 'Zlib::GzipWriter#mtime=', bar.full_name
- assert_equal 'A comment', bar.comment
+ assert_equal 'A comment', bar.comment.text
end
def test_find_body_document_method_same
@@ -979,73 +1198,37 @@ Init_Foo(void) {
s_bar = methods.first
assert_equal 'Foo::bar', s_bar.full_name
- assert_equal "a comment for Foo::bar", s_bar.comment
+ assert_equal "a comment for Foo::bar", s_bar.comment.text
bar = methods.last
assert_equal 'Foo#bar', bar.full_name
- assert_equal "a comment for Foo#bar", bar.comment
+ assert_equal "a comment for Foo#bar", bar.comment.text
end
def test_find_modifiers_call_seq
- comment = <<-COMMENT
-/* call-seq:
- * commercial() -> Date <br />
- * commercial(cwyear, cweek=41, cwday=5, sg=nil) -> Date [ruby 1.8] <br />
- * commercial(cwyear, cweek=1, cwday=1, sg=nil) -> Date [ruby 1.9]
- *
- * If no arguments are given:
- * * ruby 1.8: returns a +Date+ for 1582-10-15 (the Day of Calendar Reform in
- * Italy)
- * * ruby 1.9: returns a +Date+ for julian day 0
- *
- * Otherwise, returns a +Date+ for the commercial week year, commercial week,
- * and commercial week day given. Ignores the 4th argument.
- */
-
- COMMENT
-
- parser = util_parser ''
- method_obj = RDoc::AnyMethod.new nil, 'blah'
-
- parser.find_modifiers comment, method_obj
+ comment = RDoc::Comment.new <<-COMMENT
+call-seq:
+ commercial() -> Date <br />
- expected = <<-CALL_SEQ.chomp
-commercial() -> Date <br />
-commercial(cwyear, cweek=41, cwday=5, sg=nil) -> Date [ruby 1.8] <br />
-commercial(cwyear, cweek=1, cwday=1, sg=nil) -> Date [ruby 1.9]
-
- CALL_SEQ
-
- assert_equal expected, method_obj.call_seq
- end
-
- def test_find_modifiers_call_seq_no_blank
- comment = <<-COMMENT
-/* call-seq:
- * commercial() -> Date <br />
- * commercial(cwyear, cweek=41, cwday=5, sg=nil) -> Date [ruby 1.8] <br />
- * commercial(cwyear, cweek=1, cwday=1, sg=nil) -> Date [ruby 1.9]
- */
+If no arguments are given:
COMMENT
- parser = util_parser ''
+ parser = util_parser
method_obj = RDoc::AnyMethod.new nil, 'blah'
parser.find_modifiers comment, method_obj
expected = <<-CALL_SEQ.chomp
commercial() -> Date <br />
-commercial(cwyear, cweek=41, cwday=5, sg=nil) -> Date [ruby 1.8] <br />
-commercial(cwyear, cweek=1, cwday=1, sg=nil) -> Date [ruby 1.9]
-
+
CALL_SEQ
assert_equal expected, method_obj.call_seq
end
def test_find_modifiers_nodoc
- comment = <<-COMMENT
+ comment = RDoc::Comment.new <<-COMMENT
/* :nodoc:
*
* Blah
@@ -1053,7 +1236,7 @@ commercial(cwyear, cweek=1, cwday=1, sg=nil) -> Date [ruby 1.9]
COMMENT
- parser = util_parser ''
+ parser = util_parser
method_obj = RDoc::AnyMethod.new nil, 'blah'
parser.find_modifiers comment, method_obj
@@ -1062,7 +1245,7 @@ commercial(cwyear, cweek=1, cwday=1, sg=nil) -> Date [ruby 1.9]
end
def test_find_modifiers_yields
- comment = <<-COMMENT
+ comment = RDoc::Comment.new <<-COMMENT
/* :yields: a, b
*
* Blah
@@ -1070,22 +1253,14 @@ commercial(cwyear, cweek=1, cwday=1, sg=nil) -> Date [ruby 1.9]
COMMENT
- parser = util_parser ''
+ parser = util_parser
method_obj = RDoc::AnyMethod.new nil, 'blah'
parser.find_modifiers comment, method_obj
assert_equal 'a, b', method_obj.block_params
- expected = <<-EXPECTED
-/*
- *
- * Blah
- */
-
- EXPECTED
-
- assert_equal expected, comment
+ assert_equal "\n\nBlah", comment.text
end
def test_handle_method_args_minus_1
@@ -1206,14 +1381,89 @@ void Init_Blah(void) {
end
def test_look_for_directives_in
- parser = util_parser ''
+ parser = util_parser
- comment = "# :markup: not_rdoc\n"
+ comment = RDoc::Comment.new "# :other: not_handled\n"
parser.look_for_directives_in @top_level, comment
- assert_equal "# :markup: not_rdoc\n", comment
- assert_equal 'not_rdoc', @top_level.metadata['markup']
+ assert_equal "# :other: not_handled\n", comment.text
+ assert_equal 'not_handled', @top_level.metadata['other']
+ end
+
+ def test_load_variable_map
+ some_ext = @top_level.add_class RDoc::NormalClass, 'SomeExt'
+ @top_level.add_class RDoc::NormalClass, 'OtherExt'
+
+ @store.cache[:c_class_variables][@fn] = { 'cSomeExt' => 'SomeExt' }
+ @store.cache[:c_class_variables]['other.c'] = { 'cOtherExt' => 'OtherExt' }
+
+ parser = util_parser
+
+ map = parser.load_variable_map :c_class_variables
+
+ expected = { 'cSomeExt' => some_ext }
+
+ assert_equal expected, map
+
+ assert_equal 'SomeExt', parser.known_classes['cSomeExt']
+ assert_nil parser.known_classes['cOtherExt']
+ end
+
+ def test_load_variable_map_empty
+ parser = util_parser
+
+ map = parser.load_variable_map :c_class_variables
+
+ assert_empty map
+ end
+
+ def test_load_variable_map_legacy
+ @store.cache[:c_class_variables] = nil
+
+ parser = util_parser
+
+ map = parser.load_variable_map :c_class_variables
+
+ assert_empty map
+ end
+
+ def test_load_variable_map_singleton
+ @top_level.add_class RDoc::NormalClass, 'SomeExt'
+ @top_level.add_class RDoc::NormalClass, 'OtherExt'
+
+ @store.cache[:c_singleton_class_variables][@fn] =
+ { 'cSomeExt' => 'SomeExt' }
+ @store.cache[:c_singleton_class_variables]['other.c'] =
+ { 'cOtherExt' => 'OtherExt' }
+
+ parser = util_parser
+
+ map = parser.load_variable_map :c_singleton_class_variables
+
+ expected = { 'cSomeExt' => 'SomeExt' }
+
+ assert_equal expected, map
+
+ assert_equal 'SomeExt', parser.known_classes['cSomeExt']
+ assert_nil parser.known_classes['cOtherExt']
+ end
+
+ def test_load_variable_map_trim
+ a = @top_level.add_class RDoc::NormalClass, 'A'
+
+ @store.cache[:c_class_variables][@fn] = {
+ 'cA' => 'A',
+ 'cB' => 'B',
+ }
+
+ parser = util_parser
+
+ map = parser.load_variable_map :c_class_variables
+
+ expected = { 'cA' => a }
+
+ assert_equal expected, map
end
def test_define_method
@@ -1240,7 +1490,7 @@ Init_IO(void) {
klass = util_get_class content, 'rb_cIO'
read_method = klass.method_list.first
assert_equal "read", read_method.name
- assert_equal "Method Comment! ", read_method.comment
+ assert_equal "Method Comment! ", read_method.comment.text
assert_equal "rb_io_s_read", read_method.c_function
assert read_method.singleton
end
@@ -1271,7 +1521,7 @@ Init_IO(void) {
klass = util_get_class content, 'rb_cIO'
read_method = klass.method_list.first
assert_equal "read", read_method.name
- assert_equal "Method Comment! ", read_method.comment
+ assert_equal "Method Comment! ", read_method.comment.text
assert_equal "rb_io_s_read", read_method.c_function
assert read_method.singleton
end
@@ -1301,7 +1551,7 @@ Init_IO(void) {
read_method = klass.method_list.first
assert_equal 'IO#read', read_method.full_name
assert_equal :private, read_method.visibility
- assert_equal "Method Comment! ", read_method.comment
+ assert_equal "Method Comment! ", read_method.comment.text
end
def test_define_method_private_singleton
@@ -1329,7 +1579,7 @@ Init_IO(void) {
klass = util_get_class content, 'rb_cIO'
read_method = klass.method_list.first
assert_equal "read", read_method.name
- assert_equal "Method Comment! ", read_method.comment
+ assert_equal "Method Comment! ", read_method.comment.text
assert_equal :private, read_method.visibility
assert read_method.singleton
end
@@ -1359,12 +1609,12 @@ Init_IO(void) {
klass = util_get_class content, 'rb_cIO'
read_method = klass.method_list.first
assert_equal "read", read_method.name
- assert_equal "Method Comment! ", read_method.comment
+ assert_equal "Method Comment! ", read_method.comment.text
assert read_method.singleton
end
def test_rb_scan_args
- parser = util_parser ''
+ parser = util_parser
assert_equal '(p1)',
parser.rb_scan_args('rb_scan_args(a, b, "1",)')
@@ -1422,13 +1672,152 @@ Init_IO(void) {
parser.rb_scan_args('rb_scan_args(a, b, "*:&",)')
end
- def util_get_class(content, name)
+ def test_scan
+ parser = util_parser <<-C
+void Init(void) {
+ mM = rb_define_module("M");
+ cC = rb_define_class("C", rb_cObject);
+ sC = rb_singleton_class(cC);
+}
+ C
+
+ parser.scan
+
+ expected = {
+ @fn => {
+ 'mM' => 'M',
+ 'cC' => 'C', }}
+ assert_equal expected, @store.c_class_variables
+
+ expected = {
+ @fn => {
+ 'sC' => 'C' } }
+ 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) {
+ mA = rb_define_module("A");
+}
+
+void b(void) {
+ cB = rb_define_class_under(mA, "B", rb_cObject);
+}
+
+void c(void) {
+ mC = rb_define_module_under(cB, "C");
+}
+
+void d(void) {
+ mD = rb_define_class_under(mC, "D");
+}
+ C
+
+ parser.scan
+
+ assert_equal %w[A A::B A::B::C],
+ @store.all_classes_and_modules.map { |m| m.full_name }.sort
+ end
+
+ def util_get_class content, name = nil
@parser = util_parser content
@parser.scan
- @parser.classes[name]
+
+ @parser.classes[name] if name
end
- def util_parser(content)
+ def util_parser content = ''
RDoc::Parser::C.new @top_level, @fn, content, @options, @stats
end
diff --git a/test/rdoc/test_rdoc_parser_changelog.rb b/test/rdoc/test_rdoc_parser_changelog.rb
new file mode 100644
index 0000000000..e6fa7a06c6
--- /dev/null
+++ b/test/rdoc/test_rdoc_parser_changelog.rb
@@ -0,0 +1,315 @@
+require 'rdoc/test_case'
+
+class TestRDocParserChangeLog < RDoc::TestCase
+
+ def setup
+ super
+
+ @tempfile = Tempfile.new 'ChangeLog'
+ @top_level = @store.add_file @tempfile.path
+ @options = RDoc::Options.new
+ @stats = RDoc::Stats.new @store, 0
+ end
+
+ def teardown
+ @tempfile.close
+ end
+
+ def test_class_can_parse
+ parser = RDoc::Parser::ChangeLog
+
+ temp_dir do
+ FileUtils.touch 'ChangeLog'
+ assert_equal parser, parser.can_parse('ChangeLog')
+
+ assert_equal parser, parser.can_parse(@tempfile.path)
+
+ FileUtils.touch 'ChangeLog.rb'
+ assert_equal RDoc::Parser::Ruby, parser.can_parse('ChangeLog.rb')
+ end
+ end
+
+ def test_continue_entry_body
+ parser = util_parser
+
+ entry_body = ['a']
+
+ parser.continue_entry_body entry_body, 'b'
+
+ assert_equal ['a b'], entry_body
+ end
+
+ def test_continue_entry_body_empty
+ parser = util_parser
+
+ entry_body = []
+
+ parser.continue_entry_body entry_body, ''
+
+ assert_empty entry_body
+ end
+
+ def test_continue_entry_body_function
+ parser = util_parser
+
+ entry_body = ['file: (func1)']
+
+ parser.continue_entry_body entry_body, '(func2): blah'
+
+ assert_equal ['file: (func1, func2): blah'], entry_body
+ end
+
+ def test_create_document
+ parser = util_parser
+
+ groups = {
+ '2012-12-04' => [
+ ['Tue Dec 4 08:33:46 2012 Eric Hodel <drbrain@segment7.net>',
+ %w[a:one b:two]],
+ ['Tue Dec 4 08:32:10 2012 Eric Hodel <drbrain@segment7.net>',
+ %w[c:three d:four]]],
+ '2012-12-03' => [
+ ['Mon Dec 3 20:28:02 2012 Koichi Sasada <ko1@atdot.net>',
+ %w[e:five f:six]]],
+ }
+
+ expected =
+ doc(
+ head(1, File.basename(@tempfile.path)),
+ blank_line,
+ head(2, '2012-12-04'),
+ blank_line,
+ head(3, 'Tue Dec 4 08:33:46 2012 Eric Hodel <drbrain@segment7.net>'),
+ blank_line,
+ list(:NOTE, item('a', para('one')), item('b', para('two'))),
+ head(3, 'Tue Dec 4 08:32:10 2012 Eric Hodel <drbrain@segment7.net>'),
+ blank_line,
+ list(:NOTE, item('c', para('three')), item('d', para('four'))),
+ head(2, '2012-12-03'),
+ blank_line,
+ head(3, 'Mon Dec 3 20:28:02 2012 Koichi Sasada <ko1@atdot.net>'),
+ blank_line,
+ list(:NOTE, item('e', para('five')), item('f', para('six'))))
+
+ expected.file = @top_level
+
+ document = parser.create_document(groups)
+
+ assert_equal expected, document
+
+ assert_equal 2, document.omit_headings_below
+
+ headings = document.parts.select do |part|
+ RDoc::Markup::Heading === part and part.level == 2
+ end
+
+ refute headings.all? { |heading| heading.text.frozen? }
+ end
+
+ def test_create_entries
+ parser = util_parser
+
+ entries = [
+ ['Tue Dec 1 02:03:04 2012 Eric Hodel <drbrain@segment7.net>',
+ %w[a:one b:two]],
+ ['Tue Dec 5 06:07:08 2012 Eric Hodel <drbrain@segment7.net>',
+ %w[c:three d:four]],
+ ]
+
+ expected = [
+ head(3, 'Tue Dec 1 02:03:04 2012 Eric Hodel <drbrain@segment7.net>'),
+ blank_line,
+ list(:NOTE, item('a', para('one')), item('b', para('two'))),
+ head(3, 'Tue Dec 5 06:07:08 2012 Eric Hodel <drbrain@segment7.net>'),
+ blank_line,
+ list(:NOTE, item('c', para('three')), item('d', para('four'))),
+ ]
+
+ entries = parser.create_entries(entries)
+ assert_equal expected, entries
+ end
+
+ def test_create_entries_colons
+ parser = util_parser
+
+ entries = [
+ ['Wed Dec 5 12:17:11 2012 Naohisa Goto <ngotogenome@gmail.com>',
+ ['func.rb (DL::Function#bind): log stuff [ruby-core:50562]']],
+ ]
+
+ expected = [
+ head(3,
+ 'Wed Dec 5 12:17:11 2012 Naohisa Goto <ngotogenome@gmail.com>'),
+ blank_line,
+ list(:NOTE,
+ item('func.rb (DL::Function#bind)',
+ para('log stuff [ruby-core:50562]')))]
+
+ assert_equal expected, parser.create_entries(entries)
+ end
+
+ def test_create_items
+ parser = util_parser
+
+ items = [
+ 'README.EXT: Converted to RDoc format',
+ 'README.EXT.ja: ditto',
+ ]
+
+ expected =
+ list(:NOTE,
+ item('README.EXT',
+ para('Converted to RDoc format')),
+ item('README.EXT.ja',
+ para('ditto')))
+
+ assert_equal expected, parser.create_items(items)
+ end
+
+ def test_group_entries
+ parser = util_parser
+
+ entries = [
+ [ 'Tue Dec 4 08:33:46 2012 Eric Hodel <drbrain@segment7.net>',
+ %w[one two]],
+ [ 'Tue Dec 4 08:32:10 2012 Eric Hodel <drbrain@segment7.net>',
+ %w[three four]],
+ [ 'Mon Dec 3 20:28:02 2012 Koichi Sasada <ko1@atdot.net>',
+ %w[five six]],
+ [ '2008-01-30 H.J. Lu <hongjiu.lu@intel.com>',
+ %w[seven eight]]]
+
+ expected = {
+ '2012-12-04' => [
+ ['Tue Dec 4 08:33:46 2012 Eric Hodel <drbrain@segment7.net>',
+ %w[one two]],
+ ['Tue Dec 4 08:32:10 2012 Eric Hodel <drbrain@segment7.net>',
+ %w[three four]]],
+ '2012-12-03' => [
+ ['Mon Dec 3 20:28:02 2012 Koichi Sasada <ko1@atdot.net>',
+ %w[five six]]],
+ '2008-01-30' => [
+ ['2008-01-30 H.J. Lu <hongjiu.lu@intel.com>',
+ %w[seven eight]]],
+ }
+
+ assert_equal expected, parser.group_entries(entries)
+ end
+
+ def test_parse_entries
+ parser = util_parser <<-ChangeLog
+Tue Dec 4 08:33:46 2012 Eric Hodel <drbrain@segment7.net>
+
+ * README.EXT: Converted to RDoc format
+ * README.EXT.ja: ditto
+
+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.
+
+Other note that will be ignored
+
+ ChangeLog
+
+ expected = [
+ [ 'Tue Dec 4 08:33:46 2012 Eric Hodel <drbrain@segment7.net>',
+ [ 'README.EXT: Converted to RDoc format',
+ 'README.EXT.ja: ditto']],
+ [ '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.']]]
+
+ assert_equal expected, parser.parse_entries
+ end
+
+ def test_parse_entries_bad_time
+ parser = util_parser <<-ChangeLog
+2008-01-30 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR libffi/34612
+ * src/x86/sysv.S (ffi_closure_SYSV): Pop 4 byte from stack when
+ returning struct.
+
+ ChangeLog
+
+ expected = [
+ [ '2008-01-30 H.J. Lu <hongjiu.lu@intel.com>',
+ [ 'src/x86/sysv.S (ffi_closure_SYSV): Pop 4 byte from stack when ' +
+ 'returning struct.']]
+ ]
+
+ assert_equal expected, parser.parse_entries
+ end
+
+ def test_parse_entries_gnu
+ parser = util_parser <<-ChangeLog
+1998-08-17 Richard Stallman <rms@gnu.org>
+
+* register.el (insert-register): Return nil.
+(jump-to-register): Likewise.
+
+* sort.el (sort-subr): Return nil.
+
+* keyboard.c (menu_bar_items, tool_bar_items)
+(Fexecute_extended_command): Deal with 'keymap' property.
+ ChangeLog
+
+ expected = [
+ [ '1998-08-17 Richard Stallman <rms@gnu.org>',
+ [ 'register.el (insert-register): Return nil.',
+ '(jump-to-register): Likewise.',
+ 'sort.el (sort-subr): Return nil.',
+ 'keyboard.c (menu_bar_items, tool_bar_items, ' +
+ 'Fexecute_extended_command): Deal with \'keymap\' property.']]]
+
+ assert_equal expected, parser.parse_entries
+ end
+
+ def test_scan
+ parser = util_parser <<-ChangeLog
+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
+
+Mon Dec 3 20:37:22 2012 Koichi Sasada <ko1@atdot.net>
+
+ * vm_exec.c: check VM_COLLECT_USAGE_DETAILS.
+
+ ChangeLog
+
+ parser.scan
+
+ expected = doc(
+ head(1, File.basename(@tempfile.path)),
+ blank_line,
+ head(2, '2012-12-04'),
+ blank_line,
+ head(3, 'Tue Dec 4 08:32:10 2012 Eric Hodel <drbrain@segment7.net>'),
+ blank_line,
+ list(:NOTE,
+ item('lib/rdoc/ri/driver.rb', para('Fixed ri page display for ' +
+ 'files with extensions.')),
+ item('test/rdoc/test_rdoc_ri_driver.rb', para('Test for above'))),
+ head(2, '2012-12-03'),
+ blank_line,
+ head(3, 'Mon Dec 3 20:37:22 2012 Koichi Sasada <ko1@atdot.net>'),
+ blank_line,
+ list(:NOTE,
+ item('vm_exec.c', para('check VM_COLLECT_USAGE_DETAILS.'))))
+
+ expected.file = @top_level
+
+ assert_equal expected, @top_level.comment
+ end
+
+ def util_parser content = ''
+ RDoc::Parser::ChangeLog.new \
+ @top_level, @tempfile.path, content, @options, @stats
+ end
+
+end
+
diff --git a/test/rdoc/test_rdoc_parser_markdown.rb b/test/rdoc/test_rdoc_parser_markdown.rb
new file mode 100644
index 0000000000..597407ff68
--- /dev/null
+++ b/test/rdoc/test_rdoc_parser_markdown.rb
@@ -0,0 +1,61 @@
+require 'rdoc/test_case'
+
+class TestRDocParserMarkdown < RDoc::TestCase
+
+ def setup
+ super
+
+ @RP = RDoc::Parser
+
+ @tempfile = Tempfile.new self.class.name
+ filename = @tempfile.path
+
+ @top_level = @store.add_file filename
+ @fn = filename
+ @options = RDoc::Options.new
+ @stats = RDoc::Stats.new @store, 0
+ end
+
+ def teardown
+ super
+
+ @tempfile.close
+ end
+
+ def test_file
+ assert_kind_of RDoc::Parser::Text, util_parser('')
+ end
+
+ def test_class_can_parse
+ temp_dir do
+ FileUtils.touch 'foo.md'
+ assert_equal @RP::Markdown, @RP.can_parse('foo.md')
+ FileUtils.touch 'foo.md.ja'
+ assert_equal @RP::Markdown, @RP.can_parse('foo.md.ja')
+
+ FileUtils.touch 'foo.markdown'
+ assert_equal @RP::Markdown, @RP.can_parse('foo.markdown')
+ FileUtils.touch 'foo.markdown.ja'
+ assert_equal @RP::Markdown, @RP.can_parse('foo.markdown.ja')
+ end
+ end
+
+ def test_scan
+ parser = util_parser 'it *really* works'
+
+ expected =
+ @RM::Document.new(
+ @RM::Paragraph.new('it _really_ works'))
+ expected.file = @top_level
+
+ parser.scan
+
+ assert_equal expected, @top_level.comment.parse
+ end
+
+ def util_parser content
+ RDoc::Parser::Markdown.new @top_level, @fn, content, @options, @stats
+ end
+
+end
+
diff --git a/test/rdoc/test_rdoc_parser_rd.rb b/test/rdoc/test_rdoc_parser_rd.rb
new file mode 100644
index 0000000000..bed47950fb
--- /dev/null
+++ b/test/rdoc/test_rdoc_parser_rd.rb
@@ -0,0 +1,55 @@
+require 'rdoc/test_case'
+
+class TestRDocParserRd < RDoc::TestCase
+
+ def setup
+ super
+
+ @RP = RDoc::Parser
+
+ @tempfile = Tempfile.new self.class.name
+ filename = @tempfile.path
+
+ @top_level = @store.add_file filename
+ @fn = filename
+ @options = RDoc::Options.new
+ @stats = RDoc::Stats.new @store, 0
+ end
+
+ def teardown
+ super
+
+ @tempfile.close
+ end
+
+ def test_file
+ assert_kind_of RDoc::Parser::Text, util_parser('')
+ end
+
+ def test_class_can_parse
+ temp_dir do
+ FileUtils.touch 'foo.rd'
+ assert_equal @RP::RD, @RP.can_parse('foo.rd')
+
+ FileUtils.touch 'foo.rd.ja'
+ assert_equal @RP::RD, @RP.can_parse('foo.rd.ja')
+ end
+ end
+
+ def test_scan
+ parser = util_parser 'it ((*really*)) works'
+
+ expected = doc(para('it <em>really</em> works'))
+ expected.file = @top_level
+
+ parser.scan
+
+ assert_equal expected, @top_level.comment.parse
+ end
+
+ def util_parser content
+ RDoc::Parser::RD.new @top_level, @fn, content, @options, @stats
+ end
+
+end
+
diff --git a/test/rdoc/test_rdoc_parser_ruby.rb b/test/rdoc/test_rdoc_parser_ruby.rb
index 6086b3ec13..397885806c 100644
--- a/test/rdoc/test_rdoc_parser_ruby.rb
+++ b/test/rdoc/test_rdoc_parser_ruby.rb
@@ -1,17 +1,12 @@
# coding: utf-8
-require 'stringio'
-require 'tempfile'
-require 'rubygems'
-require 'minitest/autorun'
+require 'rdoc/test_case'
-require 'rdoc/options'
-require 'rdoc/parser/ruby'
-require 'rdoc/stats'
-
-class TestRDocParserRuby < MiniTest::Unit::TestCase
+class TestRDocParserRuby < RDoc::TestCase
def setup
+ super
+
@tempfile = Tempfile.new self.class.name
@filename = @tempfile.path
@@ -19,15 +14,21 @@ class TestRDocParserRuby < MiniTest::Unit::TestCase
@tempfile2 = Tempfile.new self.class.name
@filename2 = @tempfile2.path
- util_top_level
+ @top_level = @store.add_file @filename
+ @top_level2 = @store.add_file @filename2
+
@options = RDoc::Options.new
@options.quiet = true
@options.option_parser = OptionParser.new
- @stats = RDoc::Stats.new 0
+ @comment = RDoc::Comment.new '', @top_level
+
+ @stats = RDoc::Stats.new @store, 0
end
def teardown
+ super
+
@tempfile.close
@tempfile2.close
end
@@ -42,7 +43,7 @@ class C; end
comment = p.collect_first_comment
- assert_equal "# first\n", comment
+ assert_equal RDoc::Comment.new("# first\n", @top_level), comment
end
def test_collect_first_comment_encoding
@@ -59,67 +60,76 @@ class C; end
comment = p.collect_first_comment
- assert_equal Encoding::CP852, comment.encoding
+ assert_equal Encoding::CP852, comment.text.encoding
end
- def test_extract_call_seq
- m = RDoc::AnyMethod.new nil, 'm'
- p = util_parser ''
+ def test_get_class_or_module
+ ctxt = RDoc::Context.new
+ ctxt.store = @store
- comment = <<-COMMENT
- # call-seq:
- # bla => true or false
- #
- # moar comment
- COMMENT
+ cont, name_t, given_name = util_parser('A') .get_class_or_module ctxt
- p.extract_call_seq comment, m
+ assert_equal ctxt, cont
+ assert_equal 'A', name_t.text
+ assert_equal 'A', given_name
- assert_equal "bla => true or false\n", m.call_seq
- end
+ cont, name_t, given_name = util_parser('B::C') .get_class_or_module ctxt
- def test_extract_call_seq_blank
- m = RDoc::AnyMethod.new nil, 'm'
- p = util_parser ''
+ b = @store.find_module_named('B')
+ assert_equal b, cont
+ assert_equal [@top_level], b.in_files
+ assert_equal 'C', name_t.text
+ assert_equal 'B::C', given_name
- comment = <<-COMMENT
- # call-seq:
- # bla => true or false
- #
- COMMENT
+ cont, name_t, given_name = util_parser('D:: E').get_class_or_module ctxt
- p.extract_call_seq comment, m
+ assert_equal @store.find_module_named('D'), cont
+ assert_equal 'E', name_t.text
+ assert_equal 'D::E', given_name
- assert_equal "bla => true or false\n", m.call_seq
+ assert_raises NoMethodError do
+ util_parser("A::\nB").get_class_or_module ctxt
+ end
end
- def test_extract_call_seq_no_blank
- m = RDoc::AnyMethod.new nil, 'm'
- p = util_parser ''
+ def test_get_class_or_module_document_children
+ ctxt = @top_level.add_class RDoc::NormalClass, 'A'
+ ctxt.stop_doc
- comment = <<-COMMENT
- # call-seq:
- # bla => true or false
- COMMENT
+ util_parser('B::C').get_class_or_module ctxt
+
+ b = @store.find_module_named('A::B')
+ assert b.ignored?
- p.extract_call_seq comment, m
+ d = @top_level.add_class RDoc::NormalClass, 'A::D'
- assert_equal "bla => true or false\n", m.call_seq
+ util_parser('D::E').get_class_or_module ctxt
+
+ refute d.ignored?
end
- def test_extract_call_seq_undent
- m = RDoc::AnyMethod.new nil, 'm'
- p = util_parser ''
+ def test_get_class_or_module_ignore_constants
+ ctxt = RDoc::Context.new
+ ctxt.store = @store
- comment = <<-COMMENT
- # call-seq:
- # bla => true or false
- # moar comment
- COMMENT
+ util_parser('A') .get_class_or_module ctxt, true
+ util_parser('A::B').get_class_or_module ctxt, true
+
+ assert_empty ctxt.constants
+ assert_empty @store.modules_hash.keys
+ assert_empty @store.classes_hash.keys
+ end
- p.extract_call_seq comment, m
+ def test_get_class_specification
+ assert_equal 'A', util_parser('A') .get_class_specification
+ assert_equal 'A::B', util_parser('A::B').get_class_specification
+ assert_equal '::A', util_parser('::A').get_class_specification
- assert_equal "bla => true or false\nmoar comment\n", m.call_seq
+ assert_equal 'self', util_parser('self').get_class_specification
+
+ assert_equal '', util_parser('').get_class_specification
+
+ assert_equal '', util_parser('$g').get_class_specification
end
def test_get_symbol_or_name
@@ -146,162 +156,64 @@ class C; end
assert_equal '/', @parser.get_symbol_or_name
end
- def test_look_for_directives_in_attr
- util_parser ""
-
- comment = "# :attr: my_attr\n"
-
- @parser.look_for_directives_in @top_level, comment
-
- assert_equal "# :attr: my_attr\n", comment
-
- comment = "# :attr_reader: my_method\n"
-
- @parser.look_for_directives_in @top_level, comment
+ 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'
- assert_equal "# :attr_reader: my_method\n", comment
-
- comment = "# :attr_writer: my_method\n"
-
- @parser.look_for_directives_in @top_level, comment
-
- assert_equal "# :attr_writer: my_method\n", comment
- end
-
- def test_remove_private_comments
util_parser ''
- comment = <<-EOS
-# This is text
-#--
-# this is private
- EOS
-
- expected = <<-EOS
-# This is text
- EOS
-
- @parser.remove_private_comments(comment)
+ @parser.suppress_parents c, a
- assert_equal expected, comment
+ assert c.suppressed?
+ assert b.suppressed?
+ refute a.suppressed?
end
- def test_remove_private_comments_encoding
- skip "Encoding not implemented" unless Object.const_defined? :Encoding
+ 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 ''
- comment = <<-EOS
-# This is text
-#--
-# this is private
- EOS
- comment.force_encoding Encoding::IBM437
-
- @parser.remove_private_comments comment
+ @parser.suppress_parents c, a
- assert_equal Encoding::IBM437, comment.encoding
+ assert c.suppressed?
+ refute b.suppressed?
+ refute a.suppressed?
end
- def test_remove_private_comments_long
- util_parser ''
-
- comment = <<-EOS
-#-----
-#++
-# this is text
-#-----
- EOS
-
- expected = <<-EOS
-# this is text
- EOS
-
- @parser.remove_private_comments(comment)
-
- assert_equal expected, comment
- end
-
- def test_remove_private_comments_rule
- util_parser ''
-
- comment = <<-EOS
-# This is text with a rule:
-# ---
-# this is also text
- EOS
-
- expected = comment.dup
-
- @parser.remove_private_comments(comment)
-
- assert_equal expected, comment
- end
-
- def test_remove_private_comments_toggle
- util_parser ''
-
- comment = <<-EOS
-# This is text
-#--
-# this is private
-#++
-# This is text again.
- EOS
-
- expected = <<-EOS
-# This is text
-# This is text again.
- EOS
-
- @parser.remove_private_comments(comment)
-
- assert_equal expected, comment
- end
-
- def test_remove_private_comments_toggle_encoding
- skip "Encoding not implemented" unless Object.const_defined? :Encoding
-
- util_parser ''
+ def test_look_for_directives_in_attr
+ util_parser ""
- comment = <<-EOS
-# This is text
-#--
-# this is private
-#++
-# This is text again.
- EOS
+ comment = RDoc::Comment.new "# :attr: my_attr\n", @top_level
- comment.force_encoding Encoding::IBM437
+ @parser.look_for_directives_in @top_level, comment
- @parser.remove_private_comments comment
+ assert_equal "# :attr: my_attr\n", comment.text
- assert_equal Encoding::IBM437, comment.encoding
- end
+ comment = RDoc::Comment.new "# :attr_reader: my_method\n", @top_level
- def test_remove_private_comments_toggle_encoding_ruby_bug?
- skip "Encoding not implemented" unless Object.const_defined? :Encoding
+ @parser.look_for_directives_in @top_level, comment
- util_parser ''
+ assert_equal "# :attr_reader: my_method\n", comment.text
- comment = <<-EOS
-#--
-# this is private
-#++
-# This is text again.
- EOS
+ comment = RDoc::Comment.new "# :attr_writer: my_method\n", @top_level
- comment.force_encoding Encoding::IBM437
-
- @parser.remove_private_comments comment
+ @parser.look_for_directives_in @top_level, comment
- assert_equal Encoding::IBM437, comment.encoding
+ assert_equal "# :attr_writer: my_method\n", comment.text
end
def test_look_for_directives_in_commented
util_parser ""
- comment = "# how to make a section:\n# # :section: new section\n"
+ comment = RDoc::Comment.new <<-COMMENT, @top_level
+# how to make a section:
+# # :section: new section
+ COMMENT
@parser.look_for_directives_in @top_level, comment
@@ -310,43 +222,48 @@ class C; end
assert_equal nil, section.comment
assert_equal "# how to make a section:\n# # :section: new section\n",
- comment
+ comment.text
end
def test_look_for_directives_in_method
util_parser ""
- comment = "# :method: my_method\n"
+ comment = RDoc::Comment.new "# :method: my_method\n", @top_level
@parser.look_for_directives_in @top_level, comment
- assert_equal "# :method: my_method\n", comment
+ assert_equal "# :method: my_method\n", comment.text
- comment = "# :singleton-method: my_method\n"
+ comment = RDoc::Comment.new "# :singleton-method: my_method\n", @top_level
@parser.look_for_directives_in @top_level, comment
- assert_equal "# :singleton-method: my_method\n", comment
+ assert_equal "# :singleton-method: my_method\n", comment.text
end
def test_look_for_directives_in_section
util_parser ""
- comment = "# :section: new section\n# woo stuff\n"
+ comment = RDoc::Comment.new <<-COMMENT, @top_level
+# :section: new section
+# woo stuff
+ COMMENT
@parser.look_for_directives_in @top_level, comment
section = @top_level.current_section
assert_equal 'new section', section.title
- assert_equal "# woo stuff\n", section.comment
+ assert_equal [comment("# woo stuff\n", @top_level)], section.comments
- assert_equal '', comment
+ assert_empty comment
end
def test_look_for_directives_in_unhandled
util_parser ""
- @parser.look_for_directives_in @top_level, "# :unhandled: blah\n"
+ comment = RDoc::Comment.new "# :unhandled: blah\n", @top_level
+
+ @parser.look_for_directives_in @top_level, comment
assert_equal 'blah', @top_level.metadata['unhandled']
end
@@ -420,7 +337,7 @@ class C; end
klass = RDoc::NormalClass.new 'Foo'
klass.parent = @top_level
- comment = "##\n# my attr\n"
+ comment = RDoc::Comment.new "##\n# my attr\n", @top_level
util_parser "attr :foo, :bar"
@@ -432,7 +349,7 @@ class C; end
foo = klass.attributes.first
assert_equal 'foo', foo.name
- assert_equal 'my attr', foo.comment
+ assert_equal 'my attr', foo.comment.text
assert_equal @top_level, foo.file
assert_equal 0, foo.offset
assert_equal 1, foo.line
@@ -443,7 +360,7 @@ class C; end
klass.parent = @top_level
klass.stop_doc
- comment = "##\n# my attr\n"
+ comment = RDoc::Comment.new "##\n# my attr\n", @top_level
util_parser "attr :foo, :bar"
@@ -458,7 +375,7 @@ class C; end
klass = RDoc::NormalClass.new 'Foo'
klass.parent = @top_level
- comment = "##\n# my attr\n"
+ comment = RDoc::Comment.new "##\n# my attr\n", @top_level
util_parser "attr_accessor :foo, :bar"
@@ -471,7 +388,7 @@ class C; end
foo = klass.attributes.first
assert_equal 'foo', foo.name
assert_equal 'RW', foo.rw
- assert_equal 'my attr', foo.comment
+ assert_equal 'my attr', foo.comment.text
assert_equal @top_level, foo.file
assert_equal 0, foo.offset
assert_equal 1, foo.line
@@ -479,14 +396,14 @@ class C; end
bar = klass.attributes.last
assert_equal 'bar', bar.name
assert_equal 'RW', bar.rw
- assert_equal 'my attr', bar.comment
+ assert_equal 'my attr', bar.comment.text
end
def test_parse_attr_accessor_nodoc
klass = RDoc::NormalClass.new 'Foo'
klass.parent = @top_level
- comment = "##\n# my attr\n"
+ comment = RDoc::Comment.new "##\n# my attr\n", @top_level
util_parser "attr_accessor :foo, :bar # :nodoc:"
@@ -497,12 +414,29 @@ 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
klass.stop_doc
- comment = "##\n# my attr\n"
+ comment = RDoc::Comment.new "##\n# my attr\n", @top_level
util_parser "attr_accessor :foo, :bar"
@@ -517,7 +451,7 @@ class C; end
klass = RDoc::NormalClass.new 'Foo'
klass.parent = @top_level
- comment = "##\n# my attr\n"
+ comment = RDoc::Comment.new "##\n# my attr\n", @top_level
util_parser "attr_writer :foo, :bar"
@@ -530,20 +464,20 @@ class C; end
foo = klass.attributes.first
assert_equal 'foo', foo.name
assert_equal 'W', foo.rw
- assert_equal "my attr", foo.comment
+ assert_equal "my attr", foo.comment.text
assert_equal @top_level, foo.file
bar = klass.attributes.last
assert_equal 'bar', bar.name
assert_equal 'W', bar.rw
- assert_equal "my attr", bar.comment
+ assert_equal "my attr", bar.comment.text
end
def test_parse_meta_attr
klass = RDoc::NormalClass.new 'Foo'
klass.parent = @top_level
- comment = "##\n# :attr: \n# my method\n"
+ comment = RDoc::Comment.new "##\n# :attr: \n# my method\n", @top_level
util_parser "add_my_method :foo, :bar"
@@ -555,7 +489,7 @@ class C; end
foo = klass.attributes.first
assert_equal 'foo', foo.name
assert_equal 'RW', foo.rw
- assert_equal "my method", foo.comment
+ assert_equal "my method", foo.comment.text
assert_equal @top_level, foo.file
end
@@ -563,7 +497,8 @@ class C; end
klass = RDoc::NormalClass.new 'Foo'
klass.parent = @top_level
- comment = "##\n# :attr_accessor: \n# my method\n"
+ comment =
+ RDoc::Comment.new "##\n# :attr_accessor: \n# my method\n", @top_level
util_parser "add_my_method :foo, :bar"
@@ -575,7 +510,7 @@ class C; end
foo = klass.attributes.first
assert_equal 'foo', foo.name
assert_equal 'RW', foo.rw
- assert_equal 'my method', foo.comment
+ assert_equal 'my method', foo.comment.text
assert_equal @top_level, foo.file
end
@@ -583,7 +518,7 @@ class C; end
klass = RDoc::NormalClass.new 'Foo'
klass.parent = @top_level
- comment = "##\n# :attr: foo\n# my method\n"
+ comment = RDoc::Comment.new "##\n# :attr: foo\n# my method\n", @top_level
util_parser "add_my_method :foo, :bar"
@@ -595,7 +530,7 @@ class C; end
foo = klass.attributes.first
assert_equal 'foo', foo.name
assert_equal 'RW', foo.rw
- assert_equal 'my method', foo.comment
+ assert_equal 'my method', foo.comment.text
assert_equal @top_level, foo.file
end
@@ -603,7 +538,8 @@ class C; end
klass = RDoc::NormalClass.new 'Foo'
klass.parent = @top_level
- comment = "##\n# :attr_reader: \n# my method\n"
+ comment =
+ RDoc::Comment.new "##\n# :attr_reader: \n# my method\n", @top_level
util_parser "add_my_method :foo, :bar"
@@ -614,7 +550,7 @@ class C; end
foo = klass.attributes.first
assert_equal 'foo', foo.name
assert_equal 'R', foo.rw
- assert_equal 'my method', foo.comment
+ assert_equal 'my method', foo.comment.text
assert_equal @top_level, foo.file
end
@@ -623,7 +559,7 @@ class C; end
klass.parent = @top_level
klass.stop_doc
- comment = "##\n# :attr: \n# my method\n"
+ comment = RDoc::Comment.new "##\n# :attr: \n# my method\n", @top_level
util_parser "add_my_method :foo, :bar"
@@ -638,7 +574,8 @@ class C; end
klass = RDoc::NormalClass.new 'Foo'
klass.parent = @top_level
- comment = "##\n# :attr_writer: \n# my method\n"
+ comment =
+ RDoc::Comment.new "##\n# :attr_writer: \n# my method\n", @top_level
util_parser "add_my_method :foo, :bar"
@@ -649,12 +586,12 @@ class C; end
foo = klass.attributes.first
assert_equal 'foo', foo.name
assert_equal 'W', foo.rw
- assert_equal "my method", foo.comment
+ assert_equal "my method", foo.comment.text
assert_equal @top_level, foo.file
end
def test_parse_class
- comment = "##\n# my class\n"
+ comment = RDoc::Comment.new "##\n# my class\n", @top_level
util_parser "class Foo\nend"
@@ -664,12 +601,32 @@ class C; end
foo = @top_level.classes.first
assert_equal 'Foo', foo.full_name
- assert_equal 'my class', foo.comment
+ assert_equal 'my class', foo.comment.text
assert_equal [@top_level], foo.in_files
assert_equal 0, foo.offset
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
@@ -681,7 +638,7 @@ end
tk = @parser.get_tk
- @parser.parse_class @top_level, RDoc::Parser::Ruby::NORMAL, tk, ''
+ @parser.parse_class @top_level, RDoc::Parser::Ruby::NORMAL, tk, @comment
foo = @top_level.classes.first
assert_equal 'Foo', foo.full_name
@@ -691,6 +648,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
@@ -712,7 +692,7 @@ end
tk = @parser.get_tk
- @parser.parse_class @top_level, RDoc::Parser::Ruby::NORMAL, tk, ''
+ @parser.parse_class @top_level, RDoc::Parser::Ruby::NORMAL, tk, @comment
foo = @top_level.classes.first
assert_equal 'Foo', foo.full_name
@@ -721,7 +701,7 @@ end
end
def test_parse_class_nodoc
- comment = "##\n# my class\n"
+ comment = RDoc::Comment.new "##\n# my class\n", @top_level
util_parser "class Foo # :nodoc:\nend"
@@ -737,10 +717,23 @@ end
assert_equal 1, foo.line
end
+ def test_parse_class_single_root
+ comment = RDoc::Comment.new "##\n# my class\n", @top_level
+
+ util_parser "class << ::Foo\nend"
+
+ tk = @parser.get_tk
+
+ @parser.parse_class @top_level, RDoc::Parser::Ruby::NORMAL, tk, comment
+
+ foo = @store.all_modules.first
+ assert_equal 'Foo', foo.full_name
+ end
+
def test_parse_class_stopdoc
@top_level.stop_doc
- comment = "##\n# my class\n"
+ comment = RDoc::Comment.new "##\n# my class\n", @top_level
util_parser "class Foo\nend"
@@ -772,7 +765,7 @@ end
tk = @parser.get_tk
- @parser.parse_class @top_level, RDoc::Parser::Ruby::NORMAL, tk, ''
+ @parser.parse_class @top_level, RDoc::Parser::Ruby::NORMAL, tk, @comment
foo = @top_level.classes.first
assert_equal 'Foo', foo.full_name
@@ -780,7 +773,7 @@ end
assert_equal 2, foo.method_list.length
end
- def test_parse_const_fail_w_meta
+ def test_parse_const_fail_w_meta_method
util_parser <<-CLASS
class ConstFailMeta
##
@@ -794,7 +787,7 @@ end
tk = @parser.get_tk
- @parser.parse_class @top_level, RDoc::Parser::Ruby::NORMAL, tk, ''
+ @parser.parse_class @top_level, RDoc::Parser::Ruby::NORMAL, tk, @comment
const_fail_meta = @top_level.classes.first
assert_equal 'ConstFailMeta', const_fail_meta.full_name
@@ -802,22 +795,42 @@ end
assert_equal 1, const_fail_meta.attributes.length
end
+ def test_parse_const_third_party
+ util_parser <<-CLASS
+class A
+ true if B::C
+ true if D::E::F
+end
+ CLASS
+
+ tk = @parser.get_tk
+
+ @parser.parse_class @top_level, RDoc::Parser::Ruby::NORMAL, tk, @comment
+
+ a = @top_level.classes.first
+ assert_equal 'A', a.full_name
+
+ visible = @store.all_modules.reject { |mod| mod.suppressed? }
+ visible = visible.map { |mod| mod.full_name }
+
+ assert_empty visible
+ end
+
def test_parse_class_nested_superclass
- util_top_level
foo = @top_level.add_module RDoc::NormalModule, 'Foo'
util_parser "class Bar < Super\nend"
tk = @parser.get_tk
- @parser.parse_class foo, RDoc::Parser::Ruby::NORMAL, tk, ''
+ @parser.parse_class foo, RDoc::Parser::Ruby::NORMAL, tk, @comment
bar = foo.classes.first
assert_equal 'Super', bar.superclass
end
def test_parse_module
- comment = "##\n# my module\n"
+ comment = RDoc::Comment.new "##\n# my module\n", @top_level
util_parser "module Foo\nend"
@@ -827,13 +840,13 @@ end
foo = @top_level.modules.first
assert_equal 'Foo', foo.full_name
- assert_equal 'my module', foo.comment
+ assert_equal 'my module', foo.comment.text
end
def test_parse_module_nodoc
@top_level.stop_doc
- comment = "##\n# my module\n"
+ comment = RDoc::Comment.new "##\n# my module\n", @top_level
util_parser "module Foo # :nodoc:\nend"
@@ -849,7 +862,7 @@ end
def test_parse_module_stopdoc
@top_level.stop_doc
- comment = "##\n# my module\n"
+ comment = RDoc::Comment.new "##\n# my module\n", @top_level
util_parser "module Foo\nend"
@@ -859,7 +872,7 @@ end
foo = @top_level.modules.first
assert_equal 'Foo', foo.full_name
- assert_equal 'my module', foo.comment
+ assert_empty foo.comment
end
def test_parse_class_colon3
@@ -872,9 +885,24 @@ end
util_parser code
- @parser.parse_class @top_level, false, @parser.get_tk, ''
+ @parser.parse_class @top_level, false, @parser.get_tk, @comment
+
+ assert_equal %w[A B], @store.all_classes.map { |c| c.full_name }.sort
+ end
+
+ def test_parse_class_colon3_self_reference
+ code = <<-CODE
+class A::B
+ class ::A
+ end
+end
+ CODE
+
+ util_parser code
+
+ @parser.parse_class @top_level, false, @parser.get_tk, @comment
- assert_equal %w[A B], RDoc::TopLevel.classes.map { |c| c.full_name }
+ assert_equal %w[A A::B], @store.all_classes.map { |c| c.full_name }.sort
end
def test_parse_class_single
@@ -891,23 +919,44 @@ end
util_parser code
- @parser.parse_class @top_level, false, @parser.get_tk, ''
+ @parser.parse_class @top_level, false, @parser.get_tk, @comment
+
+ assert_equal %w[A], @store.all_classes.map { |c| c.full_name }
- assert_equal %w[A], RDoc::TopLevel.classes.map { |c| c.full_name }
- assert_equal %w[A::B A::d], RDoc::TopLevel.modules.map { |c| c.full_name }
+ modules = @store.all_modules.sort_by { |c| c.full_name }
+ assert_equal %w[A::B A::d], modules.map { |c| c.full_name }
- b = RDoc::TopLevel.modules.first
+ b = modules.first
assert_equal 10, b.offset
assert_equal 2, b.line
# make sure method/alias was not added to enclosing class/module
- a = RDoc::TopLevel.all_classes_hash['A']
+ a = @store.classes_hash['A']
assert_empty a.method_list
# make sure non-constant-named module will be removed from documentation
- d = RDoc::TopLevel.all_modules_hash['A::d']
+ d = @store.modules_hash['A::d']
assert d.remove_from_documentation?
+ end
+ def test_parse_class_single_gvar
+ code = <<-CODE
+class << $g
+ def m
+ end
+end
+ CODE
+
+ util_parser code
+
+ @parser.parse_class @top_level, false, @parser.get_tk, ''
+
+ assert_empty @store.all_classes
+ mod = @store.all_modules.first
+
+ refute mod.document_self
+
+ assert_empty mod.method_list
end
# TODO this is really a Context#add_class test
@@ -925,13 +974,16 @@ end
util_parser code
- @parser.parse_module @top_level, false, @parser.get_tk, ''
+ @parser.parse_module @top_level, false, @parser.get_tk, @comment
- assert_equal %w[A], RDoc::TopLevel.modules.map { |c| c.full_name }
- assert_equal %w[A::B A::C A::Object], RDoc::TopLevel.classes.map { |c| c.full_name }.sort
- assert_equal 'Object', RDoc::TopLevel.classes_hash['A::B'].superclass
- assert_equal 'Object', RDoc::TopLevel.classes_hash['A::Object'].superclass
- assert_equal 'A::Object', RDoc::TopLevel.classes_hash['A::C'].superclass.full_name
+ assert_equal %w[A],
+ @store.all_modules.map { |c| c.full_name }
+ assert_equal %w[A::B A::C A::Object],
+ @store.all_classes.map { |c| c.full_name }.sort
+
+ assert_equal 'Object', @store.classes_hash['A::B'].superclass
+ assert_equal 'Object', @store.classes_hash['A::Object'].superclass
+ assert_equal 'A::Object', @store.classes_hash['A::C'].superclass.full_name
end
def test_parse_class_mistaken_for_module
@@ -954,7 +1006,7 @@ end
@parser.scan
- assert_equal %w[Foo::Baz], RDoc::TopLevel.modules_hash.keys
+ assert_equal %w[Foo::Baz], @store.modules_hash.keys
assert_empty @top_level.modules
foo = @top_level.classes.first
@@ -968,9 +1020,9 @@ end
end
def test_parse_class_definition_encountered_after_class_reference
- # The code below is not strictly legal Ruby (Foo must have been defined
- # before Foo.bar is encountered), but RDoc might encounter Foo.bar before
- # Foo if they live in different files.
+ # The code below is not legal Ruby (Foo must have been defined before
+ # Foo.bar is encountered), but RDoc might encounter Foo.bar before Foo if
+ # they live in different files.
code = <<-EOF
def Foo.bar
@@ -984,9 +1036,8 @@ end
@parser.scan
- assert_empty RDoc::TopLevel.modules_hash
- # HACK why does it fail?
- #assert_empty @top_level.modules
+ assert_empty @store.modules_hash
+ assert_empty @store.all_modules
foo = @top_level.classes.first
assert_equal 'Foo', foo.full_name
@@ -997,13 +1048,14 @@ end
end
def test_parse_module_relative_to_top_level_namespace
- comment = <<-EOF
+ comment = RDoc::Comment.new <<-EOF, @top_level
#
# Weirdly named module
#
EOF
- code = comment + <<-EOF
+ code = <<-EOF
+#{comment.text}
module ::Foo
class Helper
end
@@ -1015,7 +1067,7 @@ EOF
foo = @top_level.modules.first
assert_equal 'Foo', foo.full_name
- assert_equal 'Weirdly named module', foo.comment
+ assert_equal 'Weirdly named module', foo.comment.text
helper = foo.classes.first
assert_equal 'Foo::Helper', helper.full_name
@@ -1025,7 +1077,7 @@ EOF
klass = RDoc::NormalClass.new 'Foo'
klass.parent = @top_level
- comment = "##\n# :attr: foo\n# my attr\n"
+ comment = RDoc::Comment.new "##\n# :attr: foo\n# my attr\n", @top_level
util_parser "\n"
@@ -1036,7 +1088,7 @@ EOF
foo = klass.attributes.first
assert_equal 'foo', foo.name
assert_equal 'RW', foo.rw
- assert_equal 'my attr', foo.comment
+ assert_equal 'my attr', foo.comment.text
assert_equal @top_level, foo.file
assert_equal 0, foo.offset
assert_equal 1, foo.line
@@ -1053,12 +1105,29 @@ 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
klass.stop_doc
- comment = "##\n# :attr: foo\n# my attr\n"
+ comment = RDoc::Comment.new "##\n# :attr: foo\n# my attr\n", @top_level
util_parser "\n"
@@ -1073,7 +1142,7 @@ EOF
klass = RDoc::NormalClass.new 'Foo'
klass.parent = @top_level
- comment = "##\n# :method: foo\n# my method\n"
+ comment = RDoc::Comment.new "##\n# :method: foo\n# my method\n", @top_level
util_parser "\n"
@@ -1083,7 +1152,7 @@ EOF
foo = klass.method_list.first
assert_equal 'foo', foo.name
- assert_equal 'my method', foo.comment
+ assert_equal 'my method', foo.comment.text
assert_equal @top_level, foo.file
assert_equal 0, foo.offset
assert_equal 1, foo.line
@@ -1106,20 +1175,38 @@ EOF
assert_equal klass.current_section, foo.section
stream = [
- tk(:COMMENT, 1, 1, nil, "# File #{@top_level.absolute_name}, line 1"),
+ tk(:COMMENT, 0, 1, 1, nil,
+ "# File #{@top_level.relative_name}, line 1"),
RDoc::Parser::Ruby::NEWLINE_TOKEN,
- tk(:SPACE, 1, 1, nil, ''),
+ tk(:SPACE, 0, 1, 1, nil, ''),
]
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
klass.stop_doc
- comment = "##\n# :method: foo\n# my method\n"
+ comment = RDoc::Comment.new "##\n# :method: foo\n# my method\n", @top_level
util_parser "\n"
@@ -1131,15 +1218,13 @@ EOF
end
def test_parse_constant
- util_top_level
-
klass = @top_level.add_class RDoc::NormalClass, 'Foo'
util_parser "A = v"
tk = @parser.get_tk
- @parser.parse_constant klass, tk, ''
+ @parser.parse_constant klass, tk, @comment
foo = klass.constants.first
@@ -1150,52 +1235,78 @@ EOF
end
def test_parse_constant_attrasgn
- util_top_level
-
klass = @top_level.add_class RDoc::NormalClass, 'Foo'
util_parser "A[k] = v"
tk = @parser.get_tk
- @parser.parse_constant klass, tk, ''
+ @parser.parse_constant klass, tk, @comment
assert klass.constants.empty?
end
def test_parse_constant_alias
- util_top_level
klass = @top_level.add_class RDoc::NormalClass, 'Foo'
- cB = klass.add_class RDoc::NormalClass, 'B'
+ klass.add_class RDoc::NormalClass, 'B'
util_parser "A = B"
tk = @parser.get_tk
- @parser.parse_constant klass, tk, ''
+ @parser.parse_constant klass, tk, @comment
- assert_equal cB, klass.find_module_named('A')
+ assert_equal 'Foo::A', klass.find_module_named('A').full_name
end
def test_parse_constant_alias_same_name
foo = @top_level.add_class RDoc::NormalClass, 'Foo'
- top_bar = @top_level.add_class RDoc::NormalClass, 'Bar'
+ @top_level.add_class RDoc::NormalClass, 'Bar'
bar = foo.add_class RDoc::NormalClass, 'Bar'
- assert RDoc::TopLevel.find_class_or_module('::Bar')
+ assert @store.find_class_or_module('::Bar')
util_parser "A = ::Bar"
tk = @parser.get_tk
- @parser.parse_constant foo, tk, ''
+ @parser.parse_constant foo, tk, @comment
- assert_equal top_bar, bar.find_module_named('A')
+ assert_equal 'A', bar.find_module_named('A').full_name
end
- def test_parse_constant_stopdoc
- util_top_level
+ def test_parse_constant_in_method
+ klass = @top_level.add_class RDoc::NormalClass, 'Foo'
+
+ util_parser 'A::B = v'
+
+ tk = @parser.get_tk
+
+ @parser.parse_constant klass, tk, @comment, true
+
+ assert_empty klass.constants
+ assert_empty @store.modules_hash.keys
+ assert_equal %w[Foo], @store.classes_hash.keys
+ end
+
+ def test_parse_constant_rescue
+ klass = @top_level.add_class RDoc::NormalClass, 'Foo'
+
+ util_parser "A => e"
+
+ tk = @parser.get_tk
+
+ @parser.parse_constant klass, tk, @comment
+
+ assert_empty klass.constants
+ assert_empty klass.modules
+
+ assert_empty @store.modules_hash.keys
+ assert_equal %w[Foo], @store.classes_hash.keys
+ end
+
+ def test_parse_constant_stopdoc
klass = @top_level.add_class RDoc::NormalClass, 'Foo'
klass.stop_doc
@@ -1203,28 +1314,69 @@ EOF
tk = @parser.get_tk
- @parser.parse_constant klass, tk, ''
+ @parser.parse_constant klass, tk, @comment
assert_empty klass.constants
end
- def test_parse_include
+ def test_parse_comment_nested
+ content = <<-CONTENT
+A::B::C = 1
+ CONTENT
+
+ util_parser content
+
+ tk = @parser.get_tk
+
+ parsed = @parser.parse_constant @top_level, tk, 'comment'
+
+ assert parsed
+
+ a = @top_level.find_module_named 'A'
+ b = a.find_module_named 'B'
+ c = b.constants.first
+
+ assert_equal 'A::B::C', c.full_name
+ assert_equal 'comment', c.comment
+ end
+
+ def test_parse_extend_or_include_extend
klass = RDoc::NormalClass.new 'C'
klass.parent = @top_level
- comment = "# my include\n"
+ comment = RDoc::Comment.new "# my extend\n", @top_level
+
+ util_parser "extend I"
+
+ @parser.get_tk # extend
+
+ @parser.parse_extend_or_include RDoc::Extend, klass, comment
+
+ assert_equal 1, klass.extends.length
+
+ 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_or_include_include
+ klass = RDoc::NormalClass.new 'C'
+ klass.parent = @top_level
+
+ comment = RDoc::Comment.new "# my include\n", @top_level
util_parser "include I"
@parser.get_tk # include
- @parser.parse_include klass, comment
+ @parser.parse_extend_or_include RDoc::Include, klass, comment
assert_equal 1, klass.includes.length
incl = klass.includes.first
assert_equal 'I', incl.name
- assert_equal 'my include', incl.comment
+ assert_equal 'my include', incl.comment.text
assert_equal @top_level, incl.file
end
@@ -1232,7 +1384,7 @@ EOF
klass = RDoc::NormalClass.new 'Foo'
klass.parent = @top_level
- comment = "##\n# my method\n"
+ comment = RDoc::Comment.new "##\n# my method\n", @top_level
util_parser "add_my_method :foo, :bar\nadd_my_method :baz"
@@ -1242,7 +1394,7 @@ EOF
foo = klass.method_list.first
assert_equal 'foo', foo.name
- assert_equal 'my method', foo.comment
+ assert_equal 'my method', foo.comment.text
assert_equal @top_level, foo.file
assert_equal 0, foo.offset
assert_equal 1, foo.line
@@ -1265,16 +1417,17 @@ EOF
assert_equal klass.current_section, foo.section
stream = [
- tk(:COMMENT, 1, 1, nil, "# File #{@top_level.absolute_name}, line 1"),
+ tk(:COMMENT, 0, 1, 1, nil,
+ "# File #{@top_level.relative_name}, line 1"),
RDoc::Parser::Ruby::NEWLINE_TOKEN,
- tk(:SPACE, 1, 1, nil, ''),
- tk(:IDENTIFIER, 1, 0, 'add_my_method', 'add_my_method'),
- tk(:SPACE, 1, 13, nil, ' '),
- tk(:SYMBOL, 1, 14, nil, ':foo'),
- tk(:COMMA, 1, 18, nil, ','),
- tk(:SPACE, 1, 19, nil, ' '),
- tk(:SYMBOL, 1, 20, nil, ':bar'),
- tk(:NL, 1, 24, nil, "\n"),
+ tk(:SPACE, 0, 1, 1, nil, ''),
+ tk(:IDENTIFIER, 0, 1, 0, 'add_my_method', 'add_my_method'),
+ tk(:SPACE, 0, 1, 13, nil, ' '),
+ tk(:SYMBOL, 0, 1, 14, nil, ':foo'),
+ tk(:COMMA, 0, 1, 18, nil, ','),
+ tk(:SPACE, 0, 1, 19, nil, ' '),
+ tk(:SYMBOL, 0, 1, 20, nil, ':bar'),
+ tk(:NL, 0, 1, 24, nil, "\n"),
]
assert_equal stream, foo.token_stream
@@ -1284,7 +1437,7 @@ EOF
klass = RDoc::NormalClass.new 'Foo'
klass.parent = @top_level
- comment = "##\n# my method\n"
+ comment = RDoc::Comment.new "##\n# my method\n", @top_level
content = <<-CONTENT
inline(:my_method) do |*args|
@@ -1298,14 +1451,31 @@ end
@parser.parse_meta_method klass, RDoc::Parser::Ruby::NORMAL, tk, comment
- assert_nil @parser.get_tk
+ assert_equal tk(:NL, 0, 3, 3, 3, "\n"), @parser.get_tk
+ end
+
+ def test_parse_meta_method_define_method
+ klass = RDoc::NormalClass.new 'Foo'
+ comment = RDoc::Comment.new "##\n# my method\n", @top_level
+
+ util_parser "define_method :foo do end"
+
+ tk = @parser.get_tk
+
+ @parser.parse_meta_method klass, RDoc::Parser::Ruby::NORMAL, tk, comment
+
+ foo = klass.method_list.first
+ assert_equal 'foo', foo.name
+ assert_equal 'my method', foo.comment.text
+ assert_equal @top_level, foo.file
end
def test_parse_meta_method_name
klass = RDoc::NormalClass.new 'Foo'
klass.parent = @top_level
- comment = "##\n# :method: woo_hoo!\n# my method\n"
+ comment =
+ RDoc::Comment.new "##\n# :method: woo_hoo!\n# my method\n", @top_level
util_parser "add_my_method :foo, :bar\nadd_my_method :baz"
@@ -1315,7 +1485,7 @@ end
foo = klass.method_list.first
assert_equal 'woo_hoo!', foo.name
- assert_equal 'my method', foo.comment
+ assert_equal 'my method', foo.comment.text
assert_equal @top_level, foo.file
end
@@ -1323,7 +1493,8 @@ end
klass = RDoc::NormalClass.new 'Foo'
klass.parent = @top_level
- comment = "##\n# :singleton-method:\n# my method\n"
+ comment =
+ RDoc::Comment.new "##\n# :singleton-method:\n# my method\n", @top_level
util_parser "add_my_method :foo, :bar\nadd_my_method :baz"
@@ -1334,7 +1505,7 @@ end
foo = klass.method_list.first
assert_equal 'foo', foo.name
assert_equal true, foo.singleton, 'singleton method'
- assert_equal 'my method', foo.comment
+ assert_equal 'my method', foo.comment.text
assert_equal @top_level, foo.file
end
@@ -1342,7 +1513,9 @@ end
klass = RDoc::NormalClass.new 'Foo'
klass.parent = @top_level
- comment = "##\n# :singleton-method: woo_hoo!\n# my method\n"
+ comment =
+ RDoc::Comment.new "##\n# :singleton-method: woo_hoo!\n# my method\n",
+ @top_level
util_parser "add_my_method :foo, :bar\nadd_my_method :baz"
@@ -1353,13 +1526,13 @@ end
foo = klass.method_list.first
assert_equal 'woo_hoo!', foo.name
assert_equal true, foo.singleton, 'singleton method'
- assert_equal 'my method', foo.comment
+ assert_equal 'my method', foo.comment.text
assert_equal @top_level, foo.file
end
def test_parse_meta_method_string_name
klass = RDoc::NormalClass.new 'Foo'
- comment = "##\n# my method\n"
+ comment = RDoc::Comment.new "##\n# my method\n", @top_level
util_parser "add_my_method 'foo'"
@@ -1369,7 +1542,7 @@ end
foo = klass.method_list.first
assert_equal 'foo', foo.name
- assert_equal 'my method', foo.comment
+ assert_equal 'my method', foo.comment.text
assert_equal @top_level, foo.file
end
@@ -1378,7 +1551,7 @@ end
klass.parent = @top_level
klass.stop_doc
- comment = "##\n# my method\n"
+ comment = RDoc::Comment.new "##\n# my method\n", @top_level
util_parser "add_my_method :foo, :bar\nadd_my_method :baz"
@@ -1391,7 +1564,7 @@ end
def test_parse_meta_method_unknown
klass = RDoc::NormalClass.new 'Foo'
- comment = "##\n# my method\n"
+ comment = RDoc::Comment.new "##\n# my method\n", @top_level
util_parser "add_my_method ('foo')"
@@ -1401,7 +1574,7 @@ end
foo = klass.method_list.first
assert_equal 'unknown', foo.name
- assert_equal 'my method', foo.comment
+ assert_equal 'my method', foo.comment.text
assert_equal @top_level, foo.file
end
@@ -1409,7 +1582,7 @@ end
klass = RDoc::NormalClass.new 'Foo'
klass.parent = @top_level
- comment = "##\n# my method\n"
+ comment = RDoc::Comment.new "##\n# my method\n", @top_level
util_parser "def foo() :bar end"
@@ -1419,7 +1592,7 @@ end
foo = klass.method_list.first
assert_equal 'foo', foo.name
- assert_equal 'my method', foo.comment
+ assert_equal 'my method', foo.comment.text
assert_equal @top_level, foo.file
assert_equal 0, foo.offset
assert_equal 1, foo.line
@@ -1442,19 +1615,20 @@ end
assert_equal klass.current_section, foo.section
stream = [
- tk(:COMMENT, 1, 1, nil, "# File #{@top_level.absolute_name}, line 1"),
+ tk(:COMMENT, 0, 1, 1, nil,
+ "# File #{@top_level.relative_name}, line 1"),
RDoc::Parser::Ruby::NEWLINE_TOKEN,
- tk(:SPACE, 1, 1, nil, ''),
- tk(:DEF, 1, 0, 'def', 'def'),
- tk(:SPACE, 1, 3, nil, ' '),
- tk(:IDENTIFIER, 1, 4, 'foo', 'foo'),
- tk(:LPAREN, 1, 7, nil, '('),
- tk(:RPAREN, 1, 8, nil, ')'),
- tk(:SPACE, 1, 9, nil, ' '),
- tk(:COLON, 1, 10, nil, ':'),
- tk(:IDENTIFIER, 1, 11, 'bar', 'bar'),
- tk(:SPACE, 1, 14, nil, ' '),
- tk(:END, 1, 15, 'end', 'end'),
+ tk(:SPACE, 0, 1, 1, nil, ''),
+ tk(:DEF, 0, 1, 0, 'def', 'def'),
+ tk(:SPACE, 3, 1, 3, nil, ' '),
+ tk(:IDENTIFIER, 4, 1, 4, 'foo', 'foo'),
+ tk(:LPAREN, 7, 1, 7, nil, '('),
+ tk(:RPAREN, 8, 1, 8, nil, ')'),
+ tk(:SPACE, 9, 1, 9, nil, ' '),
+ tk(:COLON, 10, 1, 10, nil, ':'),
+ tk(:IDENTIFIER, 11, 1, 11, 'bar', 'bar'),
+ tk(:SPACE, 14, 1, 14, nil, ' '),
+ tk(:END, 15, 1, 15, 'end', 'end'),
]
assert_equal stream, foo.token_stream
@@ -1468,19 +1642,49 @@ end
tk = @parser.get_tk
- @parser.parse_method klass, RDoc::Parser::Ruby::NORMAL, tk, ''
+ @parser.parse_method klass, RDoc::Parser::Ruby::NORMAL, tk, @comment
assert klass.aliases.empty?
end
+ def test_parse_method_ampersand
+ klass = RDoc::NormalClass.new 'Foo'
+ klass.parent = @top_level
+
+ util_parser "def self.&\nend"
+
+ tk = @parser.get_tk
+
+ @parser.parse_method klass, RDoc::Parser::Ruby::NORMAL, tk, @comment
+
+ ampersand = klass.method_list.first
+ assert_equal '&', ampersand.name
+ assert ampersand.singleton
+ end
+
+ def test_parse_method_constant
+ c = RDoc::Constant.new 'CONST', nil, ''
+ m = @top_level.add_class RDoc::NormalModule, 'M'
+ m.add_constant c
+
+ util_parser "def CONST.m() end"
+
+ tk = @parser.get_tk
+
+ @parser.parse_method m, RDoc::Parser::Ruby::NORMAL, tk, @comment
+
+ assert_empty @store.modules_hash.keys
+ assert_equal %w[M], @store.classes_hash.keys
+ end
+
def test_parse_method_false
util_parser "def false.foo() :bar end"
tk = @parser.get_tk
- @parser.parse_method @top_level, RDoc::Parser::Ruby::NORMAL, tk, ''
+ @parser.parse_method @top_level, RDoc::Parser::Ruby::NORMAL, tk, @comment
- klass = RDoc::TopLevel.find_class_named 'FalseClass'
+ klass = @store.find_class_named 'FalseClass'
foo = klass.method_list.first
assert_equal 'foo', foo.name
@@ -1494,9 +1698,9 @@ end
tk = @parser.get_tk
- @parser.parse_method klass, RDoc::Parser::Ruby::NORMAL, tk, ''
+ @parser.parse_method klass, RDoc::Parser::Ruby::NORMAL, tk, @comment
- assert klass.method_list.empty?
+ assert_empty klass.method_list
end
def test_parse_method_gvar
@@ -1504,9 +1708,25 @@ end
tk = @parser.get_tk
- @parser.parse_method @top_level, RDoc::Parser::Ruby::NORMAL, tk, ''
+ @parser.parse_method @top_level, RDoc::Parser::Ruby::NORMAL, tk, @comment
+
+ assert @top_level.method_list.empty?
+ end
+
+ def test_parse_method_gvar_insane
+ util_parser "def $stdout.foo() class << $other; end; end"
+
+ tk = @parser.get_tk
+
+ @parser.parse_method @top_level, RDoc::Parser::Ruby::NORMAL, tk, @comment
assert @top_level.method_list.empty?
+
+ assert_empty @store.all_classes
+
+ assert_equal 1, @store.all_modules.length
+
+ refute @store.all_modules.first.document_self
end
def test_parse_method_internal_gvar
@@ -1517,7 +1737,7 @@ end
tk = @parser.get_tk
- @parser.parse_method klass, RDoc::Parser::Ruby::NORMAL, tk, ''
+ @parser.parse_method klass, RDoc::Parser::Ruby::NORMAL, tk, @comment
assert_equal 1, klass.method_list.length
end
@@ -1530,7 +1750,7 @@ end
tk = @parser.get_tk
- @parser.parse_method klass, RDoc::Parser::Ruby::NORMAL, tk, ''
+ @parser.parse_method klass, RDoc::Parser::Ruby::NORMAL, tk, @comment
assert_equal 1, klass.method_list.length
end
@@ -1543,7 +1763,7 @@ end
tk = @parser.get_tk
- @parser.parse_method klass, RDoc::Parser::Ruby::NORMAL, tk, ''
+ @parser.parse_method klass, RDoc::Parser::Ruby::NORMAL, tk, @comment
assert_equal 1, klass.method_list.length
end
@@ -1553,14 +1773,42 @@ end
tk = @parser.get_tk
- @parser.parse_method @top_level, RDoc::Parser::Ruby::NORMAL, tk, ''
+ @parser.parse_method @top_level, RDoc::Parser::Ruby::NORMAL, tk, @comment
- klass = RDoc::TopLevel.find_class_named 'NilClass'
+ klass = @store.find_class_named 'NilClass'
foo = klass.method_list.first
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
@@ -1569,7 +1817,7 @@ end
tk = @parser.get_tk
- @parser.parse_method klass, RDoc::Parser::Ruby::NORMAL, tk, ''
+ @parser.parse_method klass, RDoc::Parser::Ruby::NORMAL, tk, @comment
foo = klass.method_list.first
assert_equal '(arg1, arg2 = {})', foo.params
@@ -1584,7 +1832,7 @@ end
tk = @parser.get_tk
- @parser.parse_method klass, RDoc::Parser::Ruby::NORMAL, tk, ''
+ @parser.parse_method klass, RDoc::Parser::Ruby::NORMAL, tk, @comment
foo = klass.method_list.first
assert_equal '(arg1, arg2)', foo.params
@@ -1598,18 +1846,33 @@ end
tk = @parser.get_tk
- @parser.parse_method klass, RDoc::Parser::Ruby::NORMAL, tk, ''
+ @parser.parse_method klass, RDoc::Parser::Ruby::NORMAL, tk, @comment
foo = klass.method_list.first
assert_equal '(arg1, arg2, arg3)', foo.params
end
+ def test_parse_method_star
+ klass = RDoc::NormalClass.new 'Foo'
+ klass.parent = @top_level
+
+ util_parser "def self.*\nend"
+
+ tk = @parser.get_tk
+
+ @parser.parse_method klass, RDoc::Parser::Ruby::NORMAL, tk, @comment
+
+ ampersand = klass.method_list.first
+ assert_equal '*', ampersand.name
+ assert ampersand.singleton
+ end
+
def test_parse_method_stopdoc
klass = RDoc::NormalClass.new 'Foo'
klass.parent = @top_level
klass.stop_doc
- comment = "##\n# my method\n"
+ comment = RDoc::Comment.new "##\n# my method\n", @top_level
util_parser "def foo() :bar end"
@@ -1627,9 +1890,9 @@ end
tk = @parser.get_tk
- @parser.parse_method klass, RDoc::Parser::Ruby::NORMAL, tk, ''
+ @parser.parse_method klass, RDoc::Parser::Ruby::NORMAL, tk, @comment
- object = RDoc::TopLevel.find_class_named 'Object'
+ object = @store.find_class_named 'Object'
foo = object.method_list.first
assert_equal 'Object#foo', foo.full_name
@@ -1643,9 +1906,9 @@ end
tk = @parser.get_tk
- @parser.parse_method klass, RDoc::Parser::Ruby::NORMAL, tk, ''
+ @parser.parse_method klass, RDoc::Parser::Ruby::NORMAL, tk, @comment
- object = RDoc::TopLevel.find_class_named 'Object'
+ object = @store.find_class_named 'Object'
foo = object.method_list.first
assert_equal 'Object::foo', foo.full_name
@@ -1656,9 +1919,9 @@ end
tk = @parser.get_tk
- @parser.parse_method @top_level, RDoc::Parser::Ruby::NORMAL, tk, ''
+ @parser.parse_method @top_level, RDoc::Parser::Ruby::NORMAL, tk, @comment
- klass = RDoc::TopLevel.find_class_named 'TrueClass'
+ klass = @store.find_class_named 'TrueClass'
foo = klass.method_list.first
assert_equal 'foo', foo.name
@@ -1677,12 +1940,30 @@ end
tk = @parser.get_tk
- @parser.parse_method klass, RDoc::Parser::Ruby::NORMAL, tk, ''
+ @parser.parse_method klass, RDoc::Parser::Ruby::NORMAL, tk, @comment
omega = klass.method_list.first
assert_equal "def \317\211", omega.text
end
+ def test_parse_method_dummy
+ util_parser ".method() end"
+
+ @parser.parse_method_dummy @top_level
+
+ assert_nil @parser.get_tk
+ end
+
+ def test_parse_method_or_yield_parameters_hash
+ util_parser "({})\n"
+
+ m = RDoc::AnyMethod.new nil, 'm'
+
+ result = @parser.parse_method_or_yield_parameters m
+
+ assert_equal '({})', result
+ end
+
def test_parse_statements_class_if
util_parser <<-CODE
module Foo
@@ -1695,7 +1976,7 @@ module Foo
end
CODE
- @parser.parse_statements @top_level, RDoc::Parser::Ruby::NORMAL, nil, ''
+ @parser.parse_statements @top_level, RDoc::Parser::Ruby::NORMAL, nil
foo = @top_level.modules.first
assert_equal 'Foo', foo.full_name, 'module Foo'
@@ -1706,18 +1987,44 @@ end
end
def test_parse_statements_class_nested
- comment = "##\n# my method\n"
+ comment = RDoc::Comment.new "##\n# my method\n", @top_level
- util_parser "module Foo\n#{comment}class Bar\nend\nend"
+ util_parser "module Foo\n#{comment.text}class Bar\nend\nend"
- @parser.parse_statements @top_level, RDoc::Parser::Ruby::NORMAL, nil, ''
+ @parser.parse_statements @top_level, RDoc::Parser::Ruby::NORMAL
foo = @top_level.modules.first
assert_equal 'Foo', foo.full_name, 'module Foo'
bar = foo.classes.first
assert_equal 'Foo::Bar', bar.full_name, 'class Foo::Bar'
- assert_equal 'my method', bar.comment
+ assert_equal 'my method', bar.comment.text
+ end
+
+ def test_parse_statements_def_percent_string_pound
+ util_parser "class C\ndef a\n%r{#}\nend\ndef b() end\nend"
+
+ @parser.parse_statements @top_level, RDoc::Parser::Ruby::NORMAL
+
+ x = @top_level.classes.first
+
+ assert_equal 2, x.method_list.length
+ a = x.method_list.first
+
+ expected = [
+ tk(:COMMENT, 0, 2, 1, nil, "# File #{@filename}, line 2"),
+ tk(:NL, 0, 0, 0, nil, "\n"),
+ tk(:SPACE, 0, 1, 1, nil, ''),
+ tk(:DEF, 8, 2, 0, 'def', 'def'),
+ tk(:SPACE, 11, 2, 3, nil, ' '),
+ tk(:IDENTIFIER, 12, 2, 4, 'a', 'a'),
+ tk(:NL, 13, 2, 5, nil, "\n"),
+ tk(:DREGEXP, 14, 3, 0, nil, '%r{#}'),
+ tk(:NL, 19, 3, 5, nil, "\n"),
+ tk(:END, 20, 4, 0, 'end', 'end'),
+ ]
+
+ assert_equal expected, a.token_stream
end
def test_parse_statements_encoding
@@ -1738,8 +2045,26 @@ end
foo = @top_level.classes.first.method_list.first
assert_equal 'foo', foo.name
- assert_equal 'this is my method', foo.comment
- assert_equal Encoding::CP852, foo.comment.encoding
+ assert_equal 'this is my method', foo.comment.text
+ 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
@@ -1822,8 +2147,25 @@ EOF
assert_equal 'unknown', @top_level.classes.first.external_aliases[0].old_name
end
- def test_parse_statements_identifier_constant
+ def test_parse_statements_identifier_args
+ comment = "##\n# :args: x\n# :method: b\n# my method\n"
+
+ util_parser "module M\n#{comment}def_delegator :a, :b, :b\nend"
+
+ @parser.parse_statements @top_level, RDoc::Parser::Ruby::NORMAL
+
+ m = @top_level.modules.first
+ assert_equal 'M', m.full_name
+
+ b = m.method_list.first
+ assert_equal 'M#b', b.full_name
+ assert_equal 'x', b.params
+ assert_equal 'my method', b.comment.text
+ assert_nil m.params, 'Module parameter not removed'
+ end
+
+ def test_parse_statements_identifier_constant
sixth_constant = <<-EOF
Class.new do
rule :file do
@@ -1934,6 +2276,24 @@ EOF
assert_equal 'RW', foo.rw
end
+ def test_parse_statements_identifier_define_method
+ util_parser <<-RUBY
+class C
+ ##
+ # :method: a
+ define_method :a do end
+ ##
+ # :method: b
+ define_method :b do end
+end
+ RUBY
+
+ @parser.parse_statements @top_level
+ c = @top_level.classes.first
+
+ assert_equal %w[a b], c.method_list.map { |m| m.name }
+ end
+
def test_parse_statements_identifier_include
content = "class Foo\ninclude Bar\nend"
@@ -1991,10 +2351,10 @@ end
@parser.parse_statements @top_level
- date, date_time = @top_level.classes
+ date, date_time = @top_level.classes.sort_by { |c| c.full_name }
date_now = date.method_list.first
- date_time_now = date_time.method_list.first
+ date_time_now = date_time.method_list.sort_by { |m| m.full_name }.first
assert_equal :private, date_now.visibility
assert_equal :public, date_time_now.visibility
@@ -2016,10 +2376,11 @@ end
@parser.parse_statements @top_level
- date, date_time = @top_level.classes
+ # TODO sort classes by default
+ date, date_time = @top_level.classes.sort_by { |c| c.full_name }
date_now = date.method_list.first
- date_time_now = date_time.method_list.first
+ date_time_now = date_time.method_list.sort_by { |m| m.full_name }.first
assert_equal :public, date_now.visibility, date_now.full_name
assert_equal :private, date_time_now.visibility, date_time_now.full_name
@@ -2035,9 +2396,25 @@ end
assert_equal 1, @top_level.requires.length
end
- def test_parse_statements_stopdoc_TkALIAS
- util_top_level
+ def test_parse_statements_identifier_yields
+ comment = "##\n# :yields: x\n# :method: b\n# my method\n"
+
+ util_parser "module M\n#{comment}def_delegator :a, :b, :b\nend"
+
+ @parser.parse_statements @top_level, RDoc::Parser::Ruby::NORMAL
+ m = @top_level.modules.first
+ assert_equal 'M', m.full_name
+
+ b = m.method_list.first
+ assert_equal 'M#b', b.full_name
+ assert_equal 'x', b.block_params
+ assert_equal 'my method', b.comment.text
+
+ assert_nil m.params, 'Module parameter not removed'
+ end
+
+ def test_parse_statements_stopdoc_TkALIAS
klass = @top_level.add_class RDoc::NormalClass, 'Foo'
util_parser "\n# :stopdoc:\nalias old new"
@@ -2049,8 +2426,6 @@ end
end
def test_parse_statements_stopdoc_TkIDENTIFIER_alias_method
- util_top_level
-
klass = @top_level.add_class RDoc::NormalClass, 'Foo'
util_parser "\n# :stopdoc:\nalias_method :old :new"
@@ -2062,8 +2437,6 @@ end
end
def test_parse_statements_stopdoc_TkIDENTIFIER_metaprogrammed
- util_top_level
-
klass = @top_level.add_class RDoc::NormalClass, 'Foo'
util_parser "\n# :stopdoc:\n# attr :meta"
@@ -2075,8 +2448,6 @@ end
end
def test_parse_statements_stopdoc_TkCONSTANT
- util_top_level
-
klass = @top_level.add_class RDoc::NormalClass, 'Foo'
util_parser "\n# :stopdoc:\nA = v"
@@ -2087,8 +2458,6 @@ end
end
def test_parse_statements_stopdoc_TkDEF
- util_top_level
-
klass = @top_level.add_class RDoc::NormalClass, 'Foo'
util_parser "\n# :stopdoc:\ndef m\n end"
@@ -2098,6 +2467,25 @@ end
assert_empty klass.method_list
end
+ def test_parse_statements_super
+ m = RDoc::AnyMethod.new '', 'm'
+ util_parser 'super'
+
+ @parser.parse_statements @top_level, RDoc::Parser::Ruby::NORMAL, m
+
+ assert m.calls_super
+ end
+
+ def test_parse_statements_super_no_method
+ content = "super"
+
+ util_parser content
+
+ @parser.parse_statements @top_level
+
+ assert_nil @parser.get_tk
+ end
+
def test_parse_statements_while_begin
util_parser <<-RUBY
class A
@@ -2162,6 +2550,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"
@@ -2220,12 +2618,104 @@ end
tk = @parser.get_tk
- @parser.parse_method klass, RDoc::Parser::Ruby::NORMAL, tk, ''
+ @parser.parse_method klass, RDoc::Parser::Ruby::NORMAL, tk, @comment
foo = klass.method_list.first
assert_equal 'nth(i)', foo.block_params
end
+ def test_read_directive
+ parser = util_parser '# :category: test'
+
+ directive, value = parser.read_directive %w[category]
+
+ assert_equal 'category', directive
+ assert_equal 'test', value
+
+ assert_kind_of RDoc::RubyToken::TkNL, parser.get_tk
+ end
+
+ def test_read_directive_allow
+ parser = util_parser '# :category: test'
+
+ directive = parser.read_directive []
+
+ assert_nil directive
+
+ assert_kind_of RDoc::RubyToken::TkNL, parser.get_tk
+ end
+
+ def test_read_directive_empty
+ parser = util_parser '# test'
+
+ directive = parser.read_directive %w[category]
+
+ assert_nil directive
+
+ assert_kind_of RDoc::RubyToken::TkNL, parser.get_tk
+ end
+
+ def test_read_directive_no_comment
+ parser = util_parser ''
+
+ directive = parser.read_directive %w[category]
+
+ assert_nil directive
+
+ assert_kind_of RDoc::RubyToken::TkNL, parser.get_tk
+ end
+
+ def test_read_directive_one_liner
+ parser = util_parser '; end # :category: test'
+
+ directive, value = parser.read_directive %w[category]
+
+ assert_equal 'category', directive
+ assert_equal 'test', value
+
+ assert_kind_of RDoc::RubyToken::TkSEMICOLON, parser.get_tk
+ end
+
+ def test_read_documentation_modifiers
+ c = RDoc::Context.new
+
+ parser = util_parser '# :category: test'
+
+ parser.read_documentation_modifiers c, %w[category]
+
+ assert_equal 'test', c.current_section.title
+ end
+
+ def test_read_documentation_modifiers_notnew
+ m = RDoc::AnyMethod.new nil, 'initialize'
+
+ parser = util_parser '# :notnew: test'
+
+ parser.read_documentation_modifiers m, %w[notnew]
+
+ assert m.dont_rename_initialize
+ end
+
+ def test_read_documentation_modifiers_not_dash_new
+ m = RDoc::AnyMethod.new nil, 'initialize'
+
+ parser = util_parser '# :not-new: test'
+
+ parser.read_documentation_modifiers m, %w[not-new]
+
+ assert m.dont_rename_initialize
+ end
+
+ def test_read_documentation_modifiers_not_new
+ m = RDoc::AnyMethod.new nil, 'initialize'
+
+ parser = util_parser '# :not_new: test'
+
+ parser.read_documentation_modifiers m, %w[not_new]
+
+ assert m.dont_rename_initialize
+ end
+
def test_sanity_integer
util_parser '1'
assert_equal '1', @parser.get_tk.text
@@ -2255,7 +2745,7 @@ end
def test_sanity_interpolation_curly
util_parser '%{ #{} }'
- assert_equal '%{ #{} }', @parser.get_tk.text
+ assert_equal '%Q{ #{} }', @parser.get_tk.text
assert_equal RDoc::RubyToken::TkNL, @parser.get_tk.class
end
@@ -2312,11 +2802,11 @@ end
foo = @top_level.classes.first
- assert_equal 'Foo comment', foo.comment
+ assert_equal 'Foo comment', foo.comment.text
m = foo.method_list.first
- assert_equal 'm comment', m.comment
+ assert_equal 'm comment', m.comment.text
end
def test_scan_block_comment_nested # Issue #41
@@ -2338,12 +2828,12 @@ end
foo = @top_level.modules.first
assert_equal 'Foo', foo.full_name
- assert_equal 'findmeindoc', foo.comment
+ assert_equal 'findmeindoc', foo.comment.text
bar = foo.classes.first
assert_equal 'Foo::Bar', bar.full_name
- assert_equal '', bar.comment
+ assert_equal '', bar.comment.text
end
def test_scan_block_comment_notflush
@@ -2386,11 +2876,140 @@ end
foo = @top_level.classes.first
assert_equal "= DESCRIPTION\n\nThis is a simple test class\n\n= RUMPUS\n\nIs a silly word",
- foo.comment
+ foo.comment.text
m = foo.method_list.first
- assert_equal 'A nice girl', m.comment
+ 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
+ def m
+ A
+ B::C
+ end
+end
+ CONTENT
+
+ util_parser content
+
+ @parser.scan
+
+ m = @top_level.modules.first
+
+ assert_empty m.constants
+
+ assert_empty @store.classes_hash.keys
+ assert_equal %w[M], @store.modules_hash.keys
+ end
+
+ def test_scan_constant_in_rescue
+ content = <<-CONTENT # newline is after M is important
+module M
+ def m
+ rescue A::B
+ rescue A::C => e
+ rescue A::D, A::E
+ rescue A::F,
+ A::G
+ rescue H
+ rescue I => e
+ rescue J, K
+ rescue L =>
+ e
+ rescue M;
+ rescue N,
+ O => e
+ end
+end
+ CONTENT
+
+ util_parser content
+
+ @parser.scan
+
+ m = @top_level.modules.first
+
+ assert_empty m.constants
+
+ assert_empty @store.classes_hash.keys
+ assert_equal %w[M], @store.modules_hash.keys
+ end
+
+ def test_scan_constant_nodoc
+ content = <<-CONTENT # newline is after M is important
+module M
+
+ C = v # :nodoc:
+end
+ CONTENT
+
+ util_parser content
+
+ @parser.scan
+
+ c = @top_level.modules.first.constants.first
+
+ assert c.documented?
+ end
+
+ def test_scan_constant_nodoc_block
+ content = <<-CONTENT # newline is after M is important
+module M
+
+ C = v do # :nodoc:
+ end
+end
+ CONTENT
+
+ util_parser content
+
+ @parser.scan
+
+ c = @top_level.modules.first.constants.first
+
+ 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
@@ -2415,6 +3034,226 @@ 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*
+class C
+ # :markup: rd
+ # ((*radical*))
+ def m
+ end
+end
+ CONTENT
+
+ util_parser content
+
+ @parser.scan
+
+ c = @top_level.classes.first
+
+ assert_equal 'rdoc', c.comment.format
+
+ assert_equal 'rd', c.method_list.first.comment.format
+ end
+
+ def test_scan_markup_first_comment
+ content = <<-CONTENT
+# :markup: rd
+
+# ((*awesome*))
+class C
+ # ((*radical*))
+ def m
+ end
+end
+ CONTENT
+
+ util_parser content
+
+ @parser.scan
+
+ c = @top_level.classes.first
+
+ assert_equal 'rd', c.comment.format
+
+ 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
+
+class C
+
+ # Signature
+ #
+ # find_by_<field>[_and_<field>...](args)
+ #
+ # field - A field name.
+
+end
+
+ RUBY
+
+ @parser.scan
+
+ c = @top_level.classes.first
+
+ m = c.method_list.first
+
+ assert_equal "find_by_<field>[_and_<field>...]", m.name
+ assert_equal "find_by_<field>[_and_<field>...](args)\n", m.call_seq
+
+ expected =
+ doc(
+ head(3, 'Signature'),
+ list(:NOTE,
+ item(%w[field],
+ para('A field name.'))))
+ expected.file = @top_level
+
+ assert_equal expected, m.comment.parse
+ end
+
+ def test_scan_stopdoc
+ util_parser <<-RUBY
+class C
+ # :stopdoc:
+ class Hidden
+ end
+end
+ RUBY
+
+ @parser.scan
+
+ c = @top_level.classes.first
+
+ hidden = c.classes.first
+
+ refute hidden.document_self
+ assert hidden.ignored?
+ end
+
+ def test_scan_stopdoc_class_alias
+ util_parser <<-RUBY
+# :stopdoc:
+module A
+ B = C
+end
+ RUBY
+
+ @parser.scan
+
+ assert_empty @store.all_classes
+
+ assert_equal 1, @store.all_modules.length
+ m = @store.all_modules.first
+
+ assert m.ignored?
+ end
+
+ def test_scan_stopdoc_nested
+ util_parser <<-RUBY
+# :stopdoc:
+class A::B
+end
+ RUBY
+
+ @parser.scan
+
+ a = @store.modules_hash['A']
+ a_b = @store.classes_hash['A::B']
+
+ refute a.document_self, 'A is inside stopdoc'
+ assert a.ignored?, 'A is inside stopdoc'
+
+ refute a_b.document_self, 'A::B is inside stopdoc'
+ assert a_b.ignored?, 'A::B is inside stopdoc'
+ end
+
+ def test_scan_struct_self_brackets
+ util_parser <<-RUBY
+class C < M.m
+ def self.[]
+ end
+end
+ RUBY
+
+ @parser.scan
+
+ c = @store.find_class_named 'C'
+ 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
+ refute c_b.singleton
+ end
+
def test_stopdoc_after_comment
util_parser <<-EOS
module Bar
@@ -2433,21 +3272,21 @@ class C
foo = @top_level.modules.first.modules.first
assert_equal 'Foo', foo.name
- assert_equal 'hello', foo.comment
+ assert_equal 'hello', foo.comment.text
baz = @top_level.modules.first.classes.first
assert_equal 'Baz', baz.name
- assert_equal 'there', baz.comment
+ assert_equal 'there', baz.comment.text
end
- def tk(klass, line, char, name, text)
+ def tk klass, scan, line, char, name, text
klass = RDoc::RubyToken.const_get "Tk#{klass.to_s.upcase}"
token = if klass.instance_method(:initialize).arity == 3 then
- raise ArgumentError, "name not used for #{klass}" unless name.nil?
- klass.new nil, line, char
+ raise ArgumentError, "name not used for #{klass}" if name
+ klass.new scan, line, char
else
- klass.new nil, line, char, name
+ klass.new scan, line, char, name
end
token.set_text text
@@ -2467,11 +3306,5 @@ class C
second_file_content, @options, @stats
end
- def util_top_level
- RDoc::TopLevel.reset
- @top_level = RDoc::TopLevel.new @filename
- @top_level2 = RDoc::TopLevel.new @filename2
- end
-
end
diff --git a/test/rdoc/test_rdoc_parser_simple.rb b/test/rdoc/test_rdoc_parser_simple.rb
index 8cedfaa2fc..356ea07504 100644
--- a/test/rdoc/test_rdoc_parser_simple.rb
+++ b/test/rdoc/test_rdoc_parser_simple.rb
@@ -1,24 +1,22 @@
-require 'tempfile'
-require 'rubygems'
-require 'minitest/autorun'
-require 'rdoc/options'
-require 'rdoc/parser'
+require 'rdoc/test_case'
-class TestRDocParserSimple < MiniTest::Unit::TestCase
+class TestRDocParserSimple < RDoc::TestCase
def setup
+ super
+
@tempfile = Tempfile.new self.class.name
filename = @tempfile.path
- @top_level = RDoc::TopLevel.new filename
+ @top_level = @store.add_file filename
@fn = filename
@options = RDoc::Options.new
- @stats = RDoc::Stats.new 0
-
- RDoc::TopLevel.reset
+ @stats = RDoc::Stats.new @store, 0
end
def teardown
+ super
+
@tempfile.close
end
@@ -45,7 +43,7 @@ Regular expressions (<i>regexp</i>s) are patterns which describe the
contents of a string.
TEXT
- assert_equal expected, @top_level.comment
+ assert_equal expected, @top_level.comment.text
end
# RDoc stops processing comments if it finds a comment line CONTAINING
@@ -74,21 +72,39 @@ contents of a string.
# # ---
def test_remove_private_comments
- parser = util_parser ''
- text = "foo\n\n--\nbar\n++\n\nbaz\n"
+ parser = util_parser "foo\n\n--\nbar\n++\n\nbaz\n"
+
+ parser.scan
- expected = "foo\n\n\n\nbaz\n"
+ expected = "foo\n\n\nbaz"
- assert_equal expected, parser.remove_private_comments(text)
+ assert_equal expected, @top_level.comment.text
+ end
+
+ def test_remove_private_comments_rule
+ parser = util_parser "foo\n---\nbar"
+
+ parser.scan
+
+ expected = "foo\n---\nbar"
+
+ assert_equal expected, @top_level.comment.text
end
def test_remove_private_comments_star
- parser = util_parser ''
+ parser = util_parser "* foo\n* bar\n"
+
+ parser.scan
- text = "* foo\n* bar\n"
- expected = text.dup
+ assert_equal "* foo\n* bar", @top_level.comment.text
+ end
+
+ def test_scan
+ parser = util_parser 'it *really* works'
+
+ parser.scan
- assert_equal expected, parser.remove_private_comments(text)
+ assert_equal 'it *really* works', @top_level.comment.text
end
def util_parser(content)
diff --git a/test/rdoc/test_rdoc_rd.rb b/test/rdoc/test_rdoc_rd.rb
new file mode 100644
index 0000000000..d917a63661
--- /dev/null
+++ b/test/rdoc/test_rdoc_rd.rb
@@ -0,0 +1,30 @@
+require 'rdoc/test_case'
+
+class TestRDocRd < RDoc::TestCase
+
+ def test_class_parse
+ expected =
+ @RM::Document.new(
+ @RM::Paragraph.new('hello'))
+
+ assert_equal expected, RDoc::RD.parse("hello")
+ end
+
+ def test_class_parse_begin_end
+ expected =
+ @RM::Document.new(
+ @RM::Paragraph.new('hello'))
+
+ assert_equal expected, RDoc::RD.parse("=begin\nhello\n=end\n")
+ end
+
+ def test_class_parse_newline
+ expected =
+ @RM::Document.new(
+ @RM::Paragraph.new('hello'))
+
+ assert_equal expected, RDoc::RD.parse("hello\n")
+ end
+
+end
+
diff --git a/test/rdoc/test_rdoc_rd_block_parser.rb b/test/rdoc/test_rdoc_rd_block_parser.rb
new file mode 100644
index 0000000000..7aa44925e8
--- /dev/null
+++ b/test/rdoc/test_rdoc_rd_block_parser.rb
@@ -0,0 +1,533 @@
+require 'rdoc/test_case'
+
+class TestRDocRdBlockParser < RDoc::TestCase
+
+ def setup
+ super
+
+ @block_parser = RDoc::RD::BlockParser.new
+ end
+
+ def test_add_footnote
+ index = @block_parser.add_footnote 'context'
+
+ assert_equal 1, index
+
+ expected = [
+ para('{^1}[rdoc-label:footmark-1:foottext-1]', ' ', 'context'),
+ blank_line,
+ ]
+
+ assert_equal expected, @block_parser.footnotes
+
+ index = @block_parser.add_footnote 'other'
+
+ assert_equal 2, index
+ end
+
+ def test_parse_desclist
+ list = <<-LIST
+:one
+ desc one
+:two
+ desc two
+ LIST
+
+ expected =
+ doc(
+ list(:NOTE,
+ item("one", para("desc one")),
+ item("two", para("desc two"))))
+
+ assert_equal expected, parse(list)
+ end
+
+ def test_parse_enumlist
+ list = <<-LIST
+(1) one
+(1) two
+ LIST
+
+ expected =
+ doc(
+ list(:NUMBER,
+ item(nil, para("one")),
+ item(nil, para("two"))))
+
+ assert_equal expected, parse(list)
+ end
+
+ def test_parse_enumlist_paragraphs
+ list = <<-LIST
+(1) one
+
+ two
+ LIST
+
+ expected =
+ doc(
+ list(:NUMBER,
+ item(nil,
+ para("one"),
+ para("two"))))
+
+ assert_equal expected, parse(list)
+ end
+
+ def test_parse_enumlist_multiline
+ list = <<-LIST
+(1) one
+ two
+ LIST
+
+ contents = "one\n two" # 1.8 vs 1.9
+
+ expected =
+ doc(
+ list(:NUMBER,
+ item(nil, para(*contents))))
+
+ assert_equal expected, parse(list)
+ end
+
+ def test_parse_enumlist_verbatim
+ list = <<-LIST
+(1) item
+ verbatim
+ LIST
+
+ expected =
+ doc(
+ list(:NUMBER,
+ item(nil,
+ para("item"),
+ verb("verbatim\n"))))
+
+ assert_equal expected, parse(list)
+ end
+
+ def test_parse_enumlist_verbatim_continue
+ list = <<-LIST
+(1) one
+ verbatim
+ two
+ LIST
+
+ expected =
+ doc(
+ list(:NUMBER,
+ item(nil,
+ para("one"),
+ verb("verbatim\n"),
+ para("two"))))
+
+ assert_equal expected, parse(list)
+ end
+
+ def test_parse_footnote
+ expected =
+ doc(
+ para("{*1}[rdoc-label:foottext-1:footmark-1]"),
+ rule(1),
+ para("{^1}[rdoc-label:footmark-1:foottext-1]", " ", "text"),
+ blank_line)
+
+ assert_equal expected, parse("((-text-))")
+ end
+
+ def test_parse_include
+ @block_parser.include_path = [Dir.tmpdir]
+
+ expected = doc(@RM::Include.new("parse_include", [Dir.tmpdir]))
+
+ assert_equal expected, parse("<<< parse_include")
+ end
+
+ def test_parse_include_subtree
+ @block_parser.include_path = [Dir.tmpdir]
+
+ expected =
+ doc(
+ blank_line,
+ para("include <em>worked</em>"),
+ blank_line,
+ blank_line)
+
+ Tempfile.open %w[parse_include .rd] do |io|
+ io.puts "=begin\ninclude ((*worked*))\n=end"
+ io.flush
+
+ str = <<-STR
+<<< #{File.basename io.path}
+ STR
+
+ assert_equal expected, parse(str)
+ end
+ end
+
+ def test_parse_heading
+ assert_equal doc(head(1, "H")), parse("= H")
+ assert_equal doc(head(2, "H")), parse("== H")
+ assert_equal doc(head(3, "H")), parse("=== H")
+ assert_equal doc(head(4, "H")), parse("==== H")
+ assert_equal doc(head(5, "H")), parse("+ H")
+ assert_equal doc(head(6, "H")), parse("++ H")
+ end
+
+ def test_parse_itemlist
+ list = <<-LIST
+* one
+* two
+ LIST
+
+ expected =
+ doc(
+ list(:BULLET,
+ item(nil, para("one")),
+ item(nil, para("two"))))
+
+ assert_equal expected, parse(list)
+ end
+
+ def test_parse_itemlist_multiline
+ list = <<-LIST
+* one
+ two
+ LIST
+
+ contents = "one\n two" # 1.8 vs 1.9
+
+ expected =
+ doc(
+ list(:BULLET,
+ item(nil, para(*contents))))
+
+ assert_equal expected, parse(list)
+ end
+
+ def test_parse_itemlist_nest
+ list = <<-LIST
+* one
+ * inner
+* two
+ LIST
+
+ expected =
+ doc(
+ list(:BULLET,
+ item(nil,
+ para("one"),
+ list(:BULLET,
+ item(nil, para("inner")))),
+ item(nil,
+ para("two"))))
+
+ assert_equal expected, parse(list)
+ end
+
+ def test_parse_itemlist_paragraphs
+ list = <<-LIST
+* one
+
+ two
+ LIST
+
+ expected =
+ doc(
+ list(:BULLET,
+ item(nil,
+ para("one"),
+ para("two"))))
+
+ assert_equal expected, parse(list)
+ end
+
+ def test_parse_itemlist_verbatim
+ list = <<-LIST
+* item
+ verbatim
+ LIST
+
+ expected =
+ doc(
+ list(:BULLET,
+ item(nil,
+ para("item"),
+ verb("verbatim\n"))))
+
+ assert_equal expected, parse(list)
+ end
+
+ def test_parse_itemlist_verbatim_continue
+ list = <<-LIST
+* one
+ verbatim
+ two
+ LIST
+
+ expected =
+ doc(
+ list(:BULLET,
+ item(nil,
+ para("one"),
+ verb("verbatim\n"),
+ para("two"))))
+
+ assert_equal expected, parse(list)
+ end
+
+ def test_parse_lists
+ list = <<-LIST
+(1) one
+(1) two
+* three
+* four
+(1) five
+(1) six
+ LIST
+
+ expected =
+ doc(
+ list(:NUMBER,
+ item(nil, para("one")),
+ item(nil, para("two"))),
+ list(:BULLET,
+ item(nil, para("three")),
+ item(nil, para("four"))),
+ list(:NUMBER,
+ item(nil, para("five")),
+ item(nil, para("six"))))
+
+ assert_equal expected, parse(list)
+ end
+
+ def test_parse_lists_nest
+ list = <<-LIST
+(1) one
+(1) two
+ * three
+ * four
+(1) five
+(1) six
+ LIST
+
+ expected =
+ doc(
+ list(:NUMBER,
+ item(nil, para("one")),
+ item(nil,
+ para("two"),
+ list(:BULLET,
+ item(nil, para("three")),
+ item(nil, para("four")))),
+ item(nil, para("five")),
+ item(nil, para("six"))))
+
+ assert_equal expected, parse(list)
+ end
+
+ def test_parse_lists_nest_verbatim
+ list = <<-LIST
+(1) one
+(1) two
+ * three
+ * four
+ verbatim
+(1) five
+(1) six
+ LIST
+
+ expected =
+ doc(
+ list(:NUMBER,
+ item(nil, para("one")),
+ item(nil,
+ para("two"),
+ list(:BULLET,
+ item(nil, para("three")),
+ item(nil, para("four"))),
+ verb("verbatim\n")),
+ item(nil, para("five")),
+ item(nil, para("six"))))
+
+ assert_equal expected, parse(list)
+ end
+
+ def test_parse_lists_nest_verbatim2
+ list = <<-LIST
+(1) one
+(1) two
+ * three
+ * four
+ verbatim
+(1) five
+(1) six
+ LIST
+
+ expected =
+ doc(
+ list(:NUMBER,
+ item(nil, para("one")),
+ item(nil,
+ para("two"),
+ list(:BULLET,
+ item(nil, para("three")),
+ item(nil, para("four"))),
+ verb("verbatim\n")),
+ item(nil, para("five")),
+ item(nil, para("six"))))
+
+ assert_equal expected, parse(list)
+ end
+
+ def test_parse_methodlist
+ list = <<-LIST
+--- Array#each {|i| ... }
+ yield block for each item.
+--- Array#index(val)
+ return index of first item which equals with val. if it hasn't
+ same item, return nil.
+ LIST
+
+ expected =
+ doc(
+ list(:LABEL,
+ item(
+ "<tt>Array#each {|i| ... }</tt>",
+ para("yield block for each item.")),
+ item(
+ "<tt>Array#index(val)</tt>",
+ para("return index of first item which equals with val. if it hasn't same item, return nil."))))
+
+ assert_equal expected, parse(list)
+ end
+
+ def test_parse_methodlist_empty
+ list = <<-LIST
+--- A#b
+
+ LIST
+
+ expected =
+ doc(
+ list(:LABEL,
+ item("<tt>A#b</tt>")))
+
+ assert_equal expected, parse(list)
+ end
+
+ def test_parse_methodlist_paragraph
+ list = <<-LIST
+--- A#b
+
+ one
+ LIST
+
+ expected =
+ doc(
+ list(:LABEL,
+ item(
+ "<tt>A#b</tt>",
+ para("one"))))
+
+ assert_equal expected, parse(list)
+ end
+
+ def test_parse_methodlist_paragraph2
+ list = <<-LIST.chomp
+--- A#b
+
+ one
+two
+ LIST
+
+ expected =
+ doc(
+ list(:LABEL,
+ item(
+ "<tt>A#b</tt>",
+ para("one"))),
+ para("two"))
+
+ assert_equal expected, parse(list)
+ end
+
+ def test_parse_methodlist_paragraph_verbatim
+ list = <<-LIST.chomp
+--- A#b
+
+ text
+ verbatim
+ LIST
+
+ expected =
+ doc(
+ list(:LABEL,
+ item(
+ "<tt>A#b</tt>",
+ para("text"),
+ verb("verbatim\n"))))
+
+ assert_equal expected, parse(list)
+ end
+
+ def test_parse_verbatim
+ assert_equal doc(verb("verbatim\n")), parse(" verbatim")
+ end
+
+ def test_parse_verbatim_blankline
+ expected = doc(verb("one\n", "\n", "two\n"))
+
+ verbatim = <<-VERBATIM
+ one
+
+ two
+ VERBATIM
+
+ assert_equal expected, parse(verbatim)
+ end
+
+ def test_parse_verbatim_indent
+ expected = doc(verb("one\n", " two\n"))
+
+ verbatim = <<-VERBATIM
+ one
+ two
+ VERBATIM
+
+ assert_equal expected, parse(verbatim)
+ end
+
+ def test_parse_verbatim_multi
+ expected = doc(verb("one\n", "two\n"))
+
+ verbatim = <<-VERBATIM
+ one
+ two
+ VERBATIM
+
+ assert_equal expected, parse(verbatim)
+ end
+
+ def test_parse_textblock
+ assert_equal doc(para("text")), parse("text")
+ end
+
+ def test_parse_textblock_multi
+ expected = doc(para("one two"))
+
+ assert_equal expected, parse("one\ntwo")
+ end
+
+ def parse text
+ text = ["=begin", text, "=end"].join "\n"
+
+ doc = @block_parser.parse text.lines.to_a
+
+ assert_equal blank_line, doc.parts.shift, "=begin blankline"
+ assert_equal blank_line, doc.parts.pop, "=end blankline"
+
+ doc
+ end
+
+end
diff --git a/test/rdoc/test_rdoc_rd_inline.rb b/test/rdoc/test_rdoc_rd_inline.rb
new file mode 100644
index 0000000000..d601ecca1a
--- /dev/null
+++ b/test/rdoc/test_rdoc_rd_inline.rb
@@ -0,0 +1,63 @@
+require 'rdoc/test_case'
+
+class TestRDocRdInline < RDoc::TestCase
+
+ def setup
+ super
+
+ @inline = RDoc::RD::Inline.new '+text+', 'text'
+ end
+
+ def test_class_new
+ inline = RDoc::RD::Inline.new @inline
+
+ refute_equal inline.rdoc, inline.reference
+ end
+
+ def test_initialize
+ inline = RDoc::RD::Inline.new 'text'
+
+ assert_equal inline.rdoc, inline.reference
+ refute_same inline.rdoc, inline.reference
+ end
+
+ def test_initialize_inline
+ inline = RDoc::RD::Inline.new @inline
+
+ assert_equal '+text+', inline.rdoc
+ assert_equal 'text', inline.reference
+ end
+
+ def test_append_inline
+ out = @inline.append @inline
+
+ assert_same @inline, out
+
+ assert_equal '+text++text+', @inline.rdoc
+ assert_equal 'texttext', @inline.reference
+ end
+
+ def test_append_string
+ @inline.append ' more'
+
+ assert_equal '+text+ more', @inline.rdoc
+ assert_equal 'text more', @inline.reference
+ end
+
+ def test_equals2
+ assert_equal @inline, RDoc::RD::Inline.new('+text+', 'text')
+ refute_equal @inline, RDoc::RD::Inline.new('+text+', 'other')
+ refute_equal @inline, RDoc::RD::Inline.new('+other+', 'text')
+ refute_equal @inline, Object.new
+ end
+
+ def test_inspect
+ assert_equal '(inline: +text+)', @inline.inspect
+ end
+
+ def test_to_s
+ assert_equal '+text+', @inline.to_s
+ end
+
+end
+
diff --git a/test/rdoc/test_rdoc_rd_inline_parser.rb b/test/rdoc/test_rdoc_rd_inline_parser.rb
new file mode 100644
index 0000000000..e4a765b4fb
--- /dev/null
+++ b/test/rdoc/test_rdoc_rd_inline_parser.rb
@@ -0,0 +1,177 @@
+require 'rdoc/test_case'
+
+class TestRDocRdInlineParser < RDoc::TestCase
+
+ def setup
+ super
+
+ @block_parser = RDoc::RD::BlockParser.new
+ @block_parser.instance_variable_set :@i, 0
+ @inline_parser = RDoc::RD::InlineParser.new @block_parser
+ end
+
+ def test_parse
+ assert_equal 'regular <em>emphasis</em>', parse('regular ((*emphasis*))')
+ end
+
+ def test_parse_code
+ assert_equal '<code>text</code>', parse('(({text}))')
+ end
+
+ def test_parse_em
+ assert_equal '<em>text</em>', parse('((*text*))')
+ end
+
+ def test_parse_footnote
+ assert_equal '{*1}[rdoc-label:foottext-1:footmark-1]', parse('((-text-))')
+
+ expected = [
+ @RM::Paragraph.new('{^1}[rdoc-label:footmark-1:foottext-1]', ' ', 'text'),
+ blank_line,
+ ]
+
+ assert_equal expected, @block_parser.footnotes
+ end
+
+ def test_parse_index
+ assert_equal '<span id="label-text">text</span>', parse('((:text:))')
+
+ assert_includes @block_parser.labels, 'text'
+ end
+
+ def test_parse_kbd
+ assert_equal '<tt>text</tt>', parse('((%text%))')
+ end
+
+ def test_parse_multiple
+ assert_equal '<em>one</em> <em>two</em>', parse('((*one*)) ((*two*))')
+ end
+
+ def test_parse_newline
+ assert_equal "one\ntwo", parse("one\ntwo")
+ end
+
+ def test_parse_quote
+ assert_equal 'one " two', parse('one " two')
+ end
+
+ def test_parse_ref
+ assert_equal '{text}[rdoc-label:text]', parse('((<text>))')
+ end
+
+ def test_parse_ref_em
+ assert_equal '{<em>text</em>}[rdoc-label:text]', parse('((<((*text*))>))')
+ end
+
+ def test_parse_ref_filename_quote
+ assert_equal '{RD/foo}[rdoc-label:RD/foo]', parse('((<RD/"foo">))')
+ end
+
+ def test_parse_ref_filename
+ assert_equal '{RD}[rdoc-label:RD/]', parse('((<RD/>))')
+ end
+
+ def test_parse_ref_quote
+ assert_equal '{text \\"}[rdoc-label:text \\"]', parse('((<text \">))')
+ end
+
+ def test_parse_ref_quote_content
+ assert_equal '{<em>text</em>}[rdoc-label:text]',
+ parse('((<"((*text*))">))')
+ end
+
+ def test_parse_ref_quote_content_multi
+ assert_equal '{<em>one</em> <em>two</em>}[rdoc-label:one two]',
+ parse('((<"((*one*)) ((*two*))">))')
+ end
+
+ def test_parse_ref_substitute
+ assert_equal '{text}[rdoc-label:thing]', parse('((<text|thing>))')
+ end
+
+ def test_parse_ref_substitute_element_quote
+ assert_equal '{text}[rdoc-label:"RD"]',
+ parse('((<text|"RD">))')
+ end
+
+ def test_parse_ref_substitute_filename
+ assert_equal '{text}[rdoc-label:RD/]', parse('((<text|RD/>))')
+ end
+
+ def test_parse_ref_substitute_filename_label
+ assert_equal '{text}[rdoc-label:RD/label]',
+ parse('((<text|RD/label>))')
+ end
+
+ def test_parse_ref_substitute_filename_quote
+ assert_equal '{text}[rdoc-label:"RD"/]', parse('((<text|"RD"/>))')
+ end
+
+ def test_parse_ref_substitute_multi_content
+ assert_equal '{<em>one</em> two}[rdoc-label:thing]',
+ parse('((<((*one*)) two|thing>))')
+ end
+
+ def test_parse_ref_substitute_multi_content2
+ assert_equal '{<em>one</em> \\" two}[rdoc-label:thing]',
+ parse('((<((*one*)) \" two|thing>))')
+ end
+
+ def test_parse_ref_substitute_multi_content3
+ assert_equal '{<em>one</em> \\" <em>two</em>}[rdoc-label:thing]',
+ parse('((<((*one*)) \" ((*two*))|thing>))')
+ end
+
+ def test_parse_ref_substitute_quote
+ assert_equal '{one | two}[rdoc-label:thing]',
+ parse('((<"one | two"|thing>))')
+ end
+
+ def test_parse_ref_substitute_quote_content
+ assert_equal '{<em>text</em>}[rdoc-label:thing]',
+ parse('((<"((*text*))"|thing>))')
+ end
+
+ def test_parse_ref_substitute_url
+ assert_equal '{text}[http://example]',
+ parse('((<text|URL:http://example>))')
+ end
+
+ def test_parse_ref_url
+ assert_equal '{http://example}[http://example]',
+ parse('((<URL:http://example>))')
+ end
+
+ def test_parse_var
+ assert_equal '+text+', parse('((|text|))')
+ end
+
+ def test_parse_verb
+ assert_equal '<tt>text</tt>', parse("(('text'))")
+ end
+
+ def test_parse_verb_backslash
+ assert_equal "<tt>(('text'))</tt>", parse("(('(('text\\'))'))")
+ end
+
+ def test_parse_verb_backslash_backslash
+ assert_equal '<tt>text \\</tt>', parse("(('text \\\\'))")
+ end
+
+ def test_parse_verb_backslash_quote
+ assert_equal '<tt>text "</tt>', parse("(('text \\\"'))")
+ end
+
+ def test_parse_verb_emphasis
+ assert_equal '<tt>((*emphasis*))</tt>', parse("(('((*emphasis*))'))")
+ end
+
+ def test_parse_verb_multiple
+ assert_equal '<tt>((*text*))</tt>', parse("(('((*text*))'))")
+ end
+
+ def parse text
+ @inline_parser.parse text
+ end
+
+end
diff --git a/test/rdoc/test_rdoc_rdoc.rb b/test/rdoc/test_rdoc_rdoc.rb
index aedccc9dbf..b36e47398b 100644
--- a/test/rdoc/test_rdoc_rdoc.rb
+++ b/test/rdoc/test_rdoc_rdoc.rb
@@ -1,51 +1,120 @@
-require 'rubygems'
-require 'minitest/autorun'
-require 'rdoc/rdoc'
+require 'rdoc/test_case'
-require 'fileutils'
-require 'tempfile'
-require 'tmpdir'
-
-class TestRDocRDoc < MiniTest::Unit::TestCase
+class TestRDocRDoc < RDoc::TestCase
def setup
- RDoc::TopLevel.reset
+ super
@rdoc = RDoc::RDoc.new
@rdoc.options = RDoc::Options.new
- @stats = RDoc::Stats.new 0, 0
+ @stats = RDoc::Stats.new @store, 0, 0
@rdoc.instance_variable_set :@stats, @stats
end
- def test_class_reset
- tl = RDoc::TopLevel.new 'file.rb'
- tl.add_class RDoc::NormalClass, 'C'
- tl.add_class RDoc::NormalModule, 'M'
+ def test_document # functional test
+ options = RDoc::Options.new
+ options.files = [File.expand_path('../xref_data.rb', __FILE__)]
+ options.setup_generator 'ri'
+ options.main_page = 'MAIN_PAGE.rdoc'
+ options.root = Pathname File.expand_path('..', __FILE__)
+ options.title = 'title'
+
+ rdoc = RDoc::RDoc.new
- c = RDoc::Parser::C
- enclosure_classes = c.send :class_variable_get, :@@enclosure_classes
- enclosure_classes['A'] = 'B'
- known_bodies = c.send :class_variable_get, :@@known_bodies
- known_bodies['A'] = 'B'
+ temp_dir do
+ options.op_dir = 'ri'
+
+ capture_io do
+ rdoc.document options
+ end
- RDoc::RDoc.reset
+ assert File.directory? 'ri'
+ assert_equal rdoc, rdoc.store.rdoc
+ end
- assert_empty RDoc::TopLevel.all_classes_hash
- assert_empty RDoc::TopLevel.all_files_hash
- assert_empty RDoc::TopLevel.all_modules_hash
+ store = rdoc.store
- assert_empty c.send :class_variable_get, :@@enclosure_classes
- assert_empty c.send :class_variable_get, :@@known_bodies
+ assert_equal 'MAIN_PAGE.rdoc', store.main
+ assert_equal 'title', store.title
end
def test_gather_files
- file = File.expand_path __FILE__
- assert_equal [file], @rdoc.gather_files([file, file])
+ a = File.expand_path __FILE__
+ b = File.expand_path '../test_rdoc_text.rb', __FILE__
+
+ assert_equal [a, b], @rdoc.gather_files([b, a, b])
+ end
+
+ def test_handle_pipe
+ $stdin = StringIO.new "hello"
+
+ out, = capture_io do
+ @rdoc.handle_pipe
+ end
+
+ assert_equal "\n<p>hello</p>\n", out
+ ensure
+ $stdin = STDIN
+ end
+
+ def test_handle_pipe_rd
+ $stdin = StringIO.new "=begin\nhello\n=end"
+
+ @rdoc.options.markup = 'rd'
+
+ out, = capture_io do
+ @rdoc.handle_pipe
+ end
+
+ assert_equal "\n<p>hello</p>\n", out
+ ensure
+ $stdin = STDIN
+ end
+
+ def test_load_options
+ temp_dir do
+ options = RDoc::Options.new
+ options.markup = 'tomdoc'
+ options.write_options
+
+ options = @rdoc.load_options
+
+ assert_equal 'tomdoc', options.markup
+ end
+ end
+
+ def test_load_options_invalid
+ temp_dir do
+ open '.rdoc_options', 'w' do |io|
+ io.write "a: !ruby.yaml.org,2002:str |\nfoo"
+ end
+
+ e = assert_raises RDoc::Error do
+ @rdoc.load_options
+ end
+
+ options_file = File.expand_path '.rdoc_options'
+ assert_equal "#{options_file} is not a valid rdoc options file", e.message
+ end
+ end
+
+ def load_options_no_file
+ temp_dir do
+ options = @rdoc.load_options
+
+ assert_kind_of RDoc::Options, options
+ end
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 }
@@ -62,9 +131,126 @@ class TestRDocRDoc < MiniTest::Unit::TestCase
assert_empty files
end
+ def test_normalized_file_list_non_file_directory
+ dev = defined?(File::NULL) ? File::NULL : '/dev/stdin'
+ skip "#{dev} is not a character special" unless
+ File.chardev? dev
+
+ files = nil
+
+ out, err = verbose_capture_io do
+ files = @rdoc.normalized_file_list [dev]
+ end
+
+ files = files.map { |file| File.expand_path file }
+
+ assert_empty files
+
+ assert_empty out
+ assert_match %r"^rdoc can't parse", err
+ assert_match %r"#{dev}$", err
+ end
+
+ def test_parse_file
+ @rdoc.store = RDoc::Store.new
+
+ temp_dir do |dir|
+ @rdoc.options.root = Pathname(Dir.pwd)
+
+ open 'test.txt', 'w' do |io|
+ io.puts 'hi'
+ end
+
+ top_level = @rdoc.parse_file 'test.txt'
+
+ assert_equal 'test.txt', top_level.absolute_name
+ assert_equal 'test.txt', top_level.relative_name
+ 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
+
+ temp_dir do |dir|
+ FileUtils.mkdir 'pages'
+ @rdoc.options.page_dir = Pathname('pages')
+ @rdoc.options.root = Pathname(Dir.pwd)
+
+ open 'pages/test.txt', 'w' do |io|
+ io.puts 'hi'
+ end
+
+ top_level = @rdoc.parse_file 'pages/test.txt'
+
+ assert_equal 'pages/test.txt', top_level.absolute_name
+ assert_equal 'test.txt', top_level.relative_name
+ end
+ end
+
+ def test_parse_file_relative
+ pwd = Dir.pwd
+
+ @rdoc.store = RDoc::Store.new
+
+ temp_dir do |dir|
+ @rdoc.options.root = Pathname(dir)
+
+ open 'test.txt', 'w' do |io|
+ io.puts 'hi'
+ end
+
+ test_txt = File.join dir, 'test.txt'
+
+ Dir.chdir pwd do
+ top_level = @rdoc.parse_file test_txt
+
+ assert_equal test_txt, top_level.absolute_name
+ assert_equal 'test.txt', top_level.relative_name
+ end
+ end
+ end
+
def test_parse_file_encoding
skip "Encoding not implemented" unless Object.const_defined? :Encoding
@rdoc.options.encoding = Encoding::ISO_8859_1
+ @rdoc.store = RDoc::Store.new
Tempfile.open 'test.txt' do |io|
io.write 'hi'
@@ -76,6 +262,33 @@ class TestRDocRDoc < MiniTest::Unit::TestCase
end
end
+ def test_parse_file_forbidden
+ skip 'chmod not supported' if Gem.win_platform?
+
+ @rdoc.store = RDoc::Store.new
+
+ Tempfile.open 'test.txt' do |io|
+ io.write 'hi'
+ io.rewind
+
+ File.chmod 0000, io.path
+
+ begin
+ top_level = :bug
+
+ _, err = capture_io do
+ top_level = @rdoc.parse_file io.path
+ end
+
+ assert_match "Unable to read #{io.path},", err
+
+ assert_nil top_level
+ ensure
+ File.chmod 0400, io.path
+ end
+ end
+ end
+
def test_remove_unparseable
file_list = %w[
blah.class
@@ -89,9 +302,35 @@ class TestRDocRDoc < MiniTest::Unit::TestCase
assert_empty @rdoc.remove_unparseable file_list
end
- def test_setup_output_dir
- skip "No Dir::mktmpdir, upgrade your ruby" unless Dir.respond_to? :mktmpdir
+ def test_remove_unparseable_tags_emacs
+ temp_dir do
+ open 'TAGS', 'wb' do |io| # emacs
+ io.write "\f\nlib/foo.rb,43\n"
+ end
+
+ file_list = %w[
+ TAGS
+ ]
+ assert_empty @rdoc.remove_unparseable file_list
+ end
+ end
+
+ def test_remove_unparseable_tags_vim
+ temp_dir do
+ open 'TAGS', 'w' do |io| # emacs
+ io.write "!_TAG_"
+ end
+
+ file_list = %w[
+ TAGS
+ ]
+
+ assert_empty @rdoc.remove_unparseable file_list
+ end
+ end
+
+ def test_setup_output_dir
Dir.mktmpdir {|d|
path = File.join d, 'testdir'
@@ -105,8 +344,6 @@ class TestRDocRDoc < MiniTest::Unit::TestCase
end
def test_setup_output_dir_dry_run
- skip "No Dir::mktmpdir, upgrade your ruby" unless Dir.respond_to? :mktmpdir
-
@rdoc.options.dry_run = true
Dir.mktmpdir do |d|
@@ -119,8 +356,6 @@ class TestRDocRDoc < MiniTest::Unit::TestCase
end
def test_setup_output_dir_exists
- skip "No Dir::mktmpdir, upgrade your ruby" unless Dir.respond_to? :mktmpdir
-
Dir.mktmpdir {|path|
open @rdoc.output_flag_file(path), 'w' do |io|
io.puts Time.at 0
@@ -135,8 +370,6 @@ class TestRDocRDoc < MiniTest::Unit::TestCase
end
def test_setup_output_dir_exists_empty_created_rid
- skip "No Dir::mktmpdir, upgrade your ruby" unless Dir.respond_to? :mktmpdir
-
Dir.mktmpdir {|path|
open @rdoc.output_flag_file(path), 'w' do end
@@ -162,8 +395,6 @@ class TestRDocRDoc < MiniTest::Unit::TestCase
end
def test_setup_output_dir_exists_not_rdoc
- skip "No Dir::mktmpdir, upgrade your ruby" unless Dir.respond_to? :mktmpdir
-
Dir.mktmpdir do |dir|
e = assert_raises RDoc::Error do
@rdoc.setup_output_dir dir, false
@@ -174,8 +405,6 @@ class TestRDocRDoc < MiniTest::Unit::TestCase
end
def test_update_output_dir
- skip "No Dir::mktmpdir, upgrade your ruby" unless Dir.respond_to? :mktmpdir
-
Dir.mktmpdir do |d|
@rdoc.update_output_dir d, Time.now, {}
@@ -184,8 +413,6 @@ class TestRDocRDoc < MiniTest::Unit::TestCase
end
def test_update_output_dir_dont
- skip "No Dir::mktmpdir, upgrade your ruby" unless Dir.respond_to? :mktmpdir
-
Dir.mktmpdir do |d|
@rdoc.options.update_output_dir = false
@rdoc.update_output_dir d, Time.now, {}
@@ -195,8 +422,6 @@ class TestRDocRDoc < MiniTest::Unit::TestCase
end
def test_update_output_dir_dry_run
- skip "No Dir::mktmpdir, upgrade your ruby" unless Dir.respond_to? :mktmpdir
-
Dir.mktmpdir do |d|
@rdoc.options.dry_run = true
@rdoc.update_output_dir d, Time.now, {}
diff --git a/test/rdoc/test_rdoc_ri_driver.rb b/test/rdoc/test_rdoc_ri_driver.rb
index e219993e57..d0987a01c3 100644
--- a/test/rdoc/test_rdoc_ri_driver.rb
+++ b/test/rdoc/test_rdoc_ri_driver.rb
@@ -1,16 +1,9 @@
-require 'pp'
-require 'rubygems'
-require 'minitest/autorun'
-require 'tmpdir'
-require 'fileutils'
-require 'stringio'
-require 'rdoc/ri/driver'
-require 'rdoc/rdoc'
+require 'rdoc/test_case'
-class TestRDocRIDriver < MiniTest::Unit::TestCase
+class TestRDocRIDriver < RDoc::TestCase
def setup
- @RM = RDoc::Markup
+ super
@tmpdir = File.join Dir.tmpdir, "test_rdoc_ri_driver_#{$$}"
@home_ri = File.join @tmpdir, 'dot_ri'
@@ -23,14 +16,22 @@ class TestRDocRIDriver < MiniTest::Unit::TestCase
ENV['HOME'] = @tmpdir
ENV.delete 'RI'
- @options = RDoc::RI::Driver.process_args []
- @options[:home] = @tmpdir
+ @options = RDoc::RI::Driver.default_options
+ @options[:use_system] = false
+ @options[:use_site] = false
+ @options[:use_home] = false
+ @options[:use_gems] = false
+
+ @options[:home] = @tmpdir
@options[:use_stdout] = true
- @options[:formatter] = @RM::ToRdoc
+ @options[:formatter] = @RM::ToRdoc
+
@driver = RDoc::RI::Driver.new @options
end
def teardown
+ super
+
ENV['HOME'] = @orig_home
ENV['RI'] = @orig_ri
FileUtils.rm_rf @tmpdir
@@ -45,18 +46,11 @@ class TestRDocRIDriver < MiniTest::Unit::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
out, = capture_io do
- RDoc::RI::Driver.dump @store.cache_path
+ RDoc::RI::Driver.dump @store1.cache_path
end
assert_match %r%:class_methods%, out
@@ -85,8 +79,8 @@ class TestRDocRIDriver < MiniTest::Unit::TestCase
expected = @RM::Document.new(
@RM::Rule.new(1),
@RM::Paragraph.new('Also found in:'),
- @RM::Verbatim.new("ruby core\n",
- "~/.ri\n"))
+ @RM::Verbatim.new("ruby core", "\n",
+ "~/.rdoc", "\n"))
assert_equal expected, out
end
@@ -107,26 +101,44 @@ class TestRDocRIDriver < MiniTest::Unit::TestCase
def test_add_from
util_store
- @store.type = :system
+ @store1.type = :system
out = @RM::Document.new
- @driver.add_from out, @store
+ @driver.add_from out, @store1
expected = @RM::Document.new @RM::Paragraph.new("(from ruby core)")
assert_equal expected, out
end
- def test_add_includes_empty
+ def test_add_extends
+ util_store
+
out = @RM::Document.new
- @driver.add_includes out, []
+ @driver.add_extends out, [[[@cFooExt], @store1]]
+
+ expected = @RM::Document.new(
+ @RM::Rule.new(1),
+ @RM::Heading.new(1, "Extended by:"),
+ @RM::Paragraph.new("Ext (from #{@store1.friendly_path})"),
+ @RM::BlankLine.new,
+ @RM::Paragraph.new("Extend thingy"),
+ @RM::BlankLine.new)
+
+ assert_equal expected, out
+ end
+
+ def test_add_extension_modules_empty
+ out = @RM::Document.new
+
+ @driver.add_extension_modules out, 'Includes', []
assert_empty out
end
- def test_add_includes_many
+ def test_add_extension_modules_many
util_store
out = @RM::Document.new
@@ -134,23 +146,23 @@ class TestRDocRIDriver < MiniTest::Unit::TestCase
enum = RDoc::Include.new 'Enumerable', nil
@cFoo.add_include enum
- @driver.add_includes out, [[[@cFooInc, enum], @store]]
+ @driver.add_extension_modules out, 'Includes', [[[@cFooInc, enum], @store1]]
expected = @RM::Document.new(
@RM::Rule.new(1),
@RM::Heading.new(1, "Includes:"),
- @RM::Paragraph.new("(from #{@store.friendly_path})"),
+ @RM::Paragraph.new("(from #{@store1.friendly_path})"),
@RM::BlankLine.new,
@RM::Paragraph.new("Inc"),
@RM::BlankLine.new,
@RM::Paragraph.new("Include thingy"),
@RM::BlankLine.new,
- @RM::Verbatim.new("Enumerable\n"))
+ @RM::Verbatim.new("Enumerable", "\n"))
assert_equal expected, out
end
- def test_add_includes_many_no_doc
+ def test_add_extension_modules_many_no_doc
util_store
out = @RM::Document.new
@@ -159,29 +171,29 @@ class TestRDocRIDriver < MiniTest::Unit::TestCase
@cFoo.add_include enum
@cFooInc.instance_variable_set :@comment, ''
- @driver.add_includes out, [[[@cFooInc, enum], @store]]
+ @driver.add_extension_modules out, 'Includes', [[[@cFooInc, enum], @store1]]
expected = @RM::Document.new(
@RM::Rule.new(1),
@RM::Heading.new(1, "Includes:"),
- @RM::Paragraph.new("(from #{@store.friendly_path})"),
- @RM::Verbatim.new("Inc\n",
- "Enumerable\n"))
+ @RM::Paragraph.new("(from #{@store1.friendly_path})"),
+ @RM::Verbatim.new("Inc", "\n",
+ "Enumerable", "\n"))
assert_equal expected, out
end
- def test_add_includes_one
+ def test_add_extension_modules_one
util_store
out = @RM::Document.new
- @driver.add_includes out, [[[@cFooInc], @store]]
+ @driver.add_extension_modules out, 'Includes', [[[@cFooInc], @store1]]
expected = @RM::Document.new(
@RM::Rule.new(1),
@RM::Heading.new(1, "Includes:"),
- @RM::Paragraph.new("Inc (from #{@store.friendly_path})"),
+ @RM::Paragraph.new("Inc (from #{@store1.friendly_path})"),
@RM::BlankLine.new,
@RM::Paragraph.new("Include thingy"),
@RM::BlankLine.new)
@@ -189,6 +201,137 @@ class TestRDocRIDriver < MiniTest::Unit::TestCase
assert_equal expected, out
end
+ def test_add_includes
+ util_store
+
+ out = @RM::Document.new
+
+ @driver.add_includes out, [[[@cFooInc], @store1]]
+
+ expected = @RM::Document.new(
+ @RM::Rule.new(1),
+ @RM::Heading.new(1, "Includes:"),
+ @RM::Paragraph.new("Inc (from #{@store1.friendly_path})"),
+ @RM::BlankLine.new,
+ @RM::Paragraph.new("Include thingy"),
+ @RM::BlankLine.new)
+
+ assert_equal expected, out
+ end
+
+ def test_add_method
+ util_store
+
+ out = doc
+
+ @driver.add_method out, 'Foo::Bar#blah'
+
+ expected =
+ doc(
+ head(1, 'Foo::Bar#blah'),
+ blank_line,
+ para('(from ~/.rdoc)'),
+ head(3, 'Implementation from Bar'),
+ rule(1),
+ verb("blah(5) => 5\n",
+ "blah(6) => 6\n"),
+ rule(1),
+ blank_line,
+ blank_line)
+
+ assert_equal expected, out
+ end
+
+ def test_add_method_attribute
+ util_store
+
+ out = doc
+
+ @driver.add_method out, 'Foo::Bar#attr'
+
+ expected =
+ doc(
+ head(1, 'Foo::Bar#attr'),
+ blank_line,
+ para('(from ~/.rdoc)'),
+ rule(1),
+ blank_line,
+ blank_line)
+
+ assert_equal expected, out
+ end
+
+ def test_add_method_inherited
+ util_multi_store
+
+ out = doc
+
+ @driver.add_method out, 'Bar#inherit'
+
+ expected =
+ doc(
+ head(1, 'Bar#inherit'),
+ blank_line,
+ para('(from ~/.rdoc)'),
+ head(3, 'Implementation from Foo'),
+ rule(1),
+ blank_line,
+ blank_line)
+
+ assert_equal expected, out
+ end
+
+ def test_add_method_overriden
+ util_multi_store
+
+ out = doc
+
+ @driver.add_method out, 'Bar#override'
+
+ expected =
+ doc(
+ head(1, 'Bar#override'),
+ blank_line,
+ para("(from #{@store2.path})"),
+ rule(1),
+ blank_line,
+ para('must be displayed'),
+ blank_line,
+ blank_line)
+
+ assert_equal expected, out
+ end
+
+ def test_add_method_documentation
+ util_store
+
+ out = doc()
+
+ missing = RDoc::AnyMethod.new nil, 'missing'
+ @cFoo.add_method missing
+
+ @driver.add_method_documentation out, @cFoo
+
+ expected =
+ doc(
+ head(1, 'Foo#inherit'),
+ blank_line,
+ para('(from ~/.rdoc)'),
+ rule(1),
+ blank_line,
+ blank_line,
+ head(1, 'Foo#override'),
+ blank_line,
+ para('(from ~/.rdoc)'),
+ rule(1),
+ blank_line,
+ para('must not be displayed in Bar#override'),
+ blank_line,
+ blank_line)
+
+ assert_equal expected, out
+ end
+
def test_add_method_list
out = @RM::Document.new
@@ -241,35 +384,48 @@ class TestRDocRIDriver < MiniTest::Unit::TestCase
expected = {
'Ambiguous' => [@store1, @store2],
'Bar' => [@store2],
- 'Foo' => [@store1],
+ 'Ext' => [@store1],
+ 'Foo' => [@store1, @store2],
'Foo::Bar' => [@store1],
'Foo::Baz' => [@store1, @store2],
'Inc' => [@store1],
}
- assert_equal expected, @driver.classes
+ classes = @driver.classes
+
+ assert_equal expected.keys.sort, classes.keys.sort
+
+ expected.each do |klass, stores|
+ assert_equal stores, classes[klass].sort_by { |store| store.path },
+ "mismatch for #{klass}"
+ end
end
def test_class_document
util_store
- tl1 = RDoc::TopLevel.new 'one.rb'
- tl2 = RDoc::TopLevel.new 'two.rb'
+ tl1 = @store1.add_file 'one.rb'
+ tl2 = @store1.add_file 'two.rb'
@cFoo.add_comment 'one', tl1
@cFoo.add_comment 'two', tl2
- @store.save_class @cFoo
+
+ @store1.save_class @cFoo
found = [
- [@store, @store.load_class(@cFoo.full_name)]
+ [@store1, @store1.load_class(@cFoo.full_name)]
]
- out = @driver.class_document @cFoo.full_name, found, [], []
+ extends = [[[@cFooExt], @store1]]
+ includes = [[[@cFooInc], @store1]]
+
+ out = @driver.class_document @cFoo.full_name, found, [], includes, extends
expected = @RM::Document.new
@driver.add_class expected, 'Foo', []
- @driver.add_includes expected, []
- @driver.add_from expected, @store
+ @driver.add_includes expected, includes
+ @driver.add_extends expected, extends
+ @driver.add_from expected, @store1
expected << @RM::Rule.new(1)
doc = @RM::Document.new(@RM::Paragraph.new('one'))
@@ -375,6 +531,32 @@ class TestRDocRIDriver < MiniTest::Unit::TestCase
assert_match %r%^ attr_accessor attr%, out
assert_equal 1, out.scan(/-\n/).length
+
+ refute_match %r%Foo::Bar#blah%, out
+ end
+
+ def test_display_class_all
+ util_store
+
+ @driver.show_all = true
+
+ out, = capture_io do
+ @driver.display_class 'Foo::Bar'
+ end
+
+ assert_match %r%^= Foo::Bar%, out
+ assert_match %r%^\(from%, out
+
+ assert_match %r%^= Class methods:%, out
+ assert_match %r%^ new%, out
+ assert_match %r%^= Instance methods:%, out
+ assert_match %r%^ blah%, out
+ assert_match %r%^= Attributes:%, out
+ assert_match %r%^ attr_accessor attr%, out
+
+ assert_equal 6, out.scan(/-\n/).length
+
+ assert_match %r%Foo::Bar#blah%, out
end
def test_display_class_ambiguous
@@ -421,6 +603,14 @@ class TestRDocRIDriver < MiniTest::Unit::TestCase
assert_match %r%^= Inc$%, out
end
+ def test_display_class_page
+ out, = capture_io do
+ @driver.display_class 'ruby:README'
+ end
+
+ assert_empty out
+ end
+
def test_display_method
util_store
@@ -499,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
@@ -509,6 +707,121 @@ Foo::Bar#bother
assert_match %r%things.*stuff%, out
end
+ def test_display_page
+ util_store
+
+ out, = capture_io do
+ @driver.display_page 'home:README.rdoc'
+ end
+
+ assert_match %r%= README%, out
+ end
+
+ def test_display_page_add_extension
+ util_store
+
+ out, = capture_io do
+ @driver.display_page 'home:README'
+ end
+
+ assert_match %r%= README%, out
+ end
+
+ def test_display_page_ambiguous
+ util_store
+
+ other = @store1.add_file 'README.md'
+ other.parser = RDoc::Parser::Simple
+ other.comment =
+ doc(
+ head(1, 'README.md'),
+ para('This is the other README'))
+
+ @store1.save_page other
+
+ out, = capture_io do
+ @driver.display_page 'home:README'
+ end
+
+ assert_match %r%= README pages in ~/\.rdoc%, out
+ assert_match %r%README\.rdoc%, out
+ assert_match %r%README\.md%, out
+ end
+
+ def test_display_page_extension
+ util_store
+
+ other = @store1.add_file 'README.EXT'
+ other.parser = RDoc::Parser::Simple
+ other.comment =
+ doc(
+ head(1, 'README.EXT'),
+ para('This is the other README'))
+
+ @store1.save_page other
+
+ out, = capture_io do
+ @driver.display_page 'home:README.EXT'
+ end
+
+ assert_match 'other README', out
+ end
+
+ def test_display_page_ignore_directory
+ util_store
+
+ other = @store1.add_file 'doc/globals.rdoc'
+ other.parser = RDoc::Parser::Simple
+ other.comment =
+ doc(
+ head(1, 'globals.rdoc'),
+ para('Globals go here'))
+
+ @store1.save_page other
+
+ out, = capture_io do
+ @driver.display_page 'home:globals'
+ end
+
+ assert_match %r%= globals\.rdoc%, out
+ end
+
+ def test_display_page_missing
+ util_store
+
+ out, = capture_io do
+ @driver.display_page 'home:missing'
+ end
+
+ out, = capture_io do
+ @driver.display_page_list @store1
+ end
+
+ assert_match %r%= Pages in ~/\.rdoc%, out
+ assert_match %r%README\.rdoc%, out
+ end
+
+ def test_display_page_list
+ util_store
+
+ other = @store1.add_file 'OTHER.rdoc'
+ other.parser = RDoc::Parser::Simple
+ other.comment =
+ doc(
+ head(1, 'OTHER'),
+ para('This is OTHER'))
+
+ @store1.save_page other
+
+ out, = capture_io do
+ @driver.display_page_list @store1
+ end
+
+ assert_match %r%= Pages in ~/\.rdoc%, out
+ assert_match %r%README\.rdoc%, out
+ assert_match %r%OTHER\.rdoc%, out
+ end
+
def test_expand_class
util_store
@@ -532,6 +845,17 @@ Foo::Bar#bother
end
assert_equal 'Z', e.name
+
+ @driver.stores << RDoc::Store.new(nil, :system)
+
+ assert_equal 'ruby:README', @driver.expand_name('ruby:README')
+ assert_equal 'ruby:', @driver.expand_name('ruby:')
+
+ e = assert_raises RDoc::RI::Driver::NotFoundError do
+ @driver.expand_name 'nonexistent_gem:'
+ end
+
+ assert_equal 'nonexistent_gem', e.name
end
def test_find_methods
@@ -544,7 +868,7 @@ Foo::Bar#bother
end
expected = [
- [@store, 'Foo::Bar', 'Foo::Bar', :both, nil],
+ [@store1, 'Foo::Bar', 'Foo::Bar', :both, nil],
]
assert_equal expected, items
@@ -560,11 +884,12 @@ Foo::Bar#bother
end
expected = [
- [@store, 'Ambiguous', 'Ambiguous', :both, 'blah'],
- [@store, 'Foo', 'Foo', :both, 'blah'],
- [@store, 'Foo::Bar', 'Foo::Bar', :both, 'blah'],
- [@store, 'Foo::Baz', 'Foo::Baz', :both, 'blah'],
- [@store, 'Inc', 'Inc', :both, 'blah'],
+ [@store1, 'Ambiguous', 'Ambiguous', :both, 'blah'],
+ [@store1, 'Ext', 'Ext', :both, 'blah'],
+ [@store1, 'Foo', 'Foo', :both, 'blah'],
+ [@store1, 'Foo::Bar', 'Foo::Bar', :both, 'blah'],
+ [@store1, 'Foo::Baz', 'Foo::Baz', :both, 'blah'],
+ [@store1, 'Inc', 'Inc', :both, 'blah'],
]
assert_equal expected, items
@@ -596,11 +921,29 @@ Foo::Bar#bother
assert_equal found, sorted
end
+ def test_find_store
+ @driver.stores << RDoc::Store.new(nil, :system)
+ @driver.stores << RDoc::Store.new('doc/gem-1.0/ri', :gem)
+
+ assert_equal 'ruby', @driver.find_store('ruby')
+ assert_equal 'gem-1.0', @driver.find_store('gem-1.0')
+ assert_equal 'gem-1.0', @driver.find_store('gem')
+
+ e = assert_raises RDoc::RI::Driver::NotFoundError do
+ @driver.find_store 'nonexistent'
+ end
+
+ assert_equal 'nonexistent', e.name
+ end
+
def test_formatter
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)
@@ -609,20 +952,21 @@ Foo::Bar#bother
driver.instance_variable_set :@paging, true
assert_instance_of @RM::ToBs, driver.formatter(StringIO.new)
-
- driver.instance_variable_set :@formatter_klass, @RM::ToHtml
-
- assert_instance_of @RM::ToHtml, driver.formatter(tty)
end
def test_in_path_eh
path = ENV['PATH']
- refute @driver.in_path?('/nonexistent')
+ test_path = File.expand_path '..', __FILE__
- ENV['PATH'] = File.expand_path '..', __FILE__
+ temp_dir do |dir|
+ nonexistent = File.join dir, 'nonexistent'
+ refute @driver.in_path?(nonexistent)
- assert @driver.in_path?(File.basename(__FILE__))
+ ENV['PATH'] = test_path
+
+ assert @driver.in_path?(File.basename(__FILE__))
+ end
ensure
ENV['PATH'] = path
end
@@ -658,7 +1002,7 @@ Foo::Bar#bother
@driver.list_known_classes
end
- assert_equal "Ambiguous\nFoo\nFoo::Bar\nFoo::Baz\nInc\n", out
+ assert_equal "Ambiguous\nExt\nFoo\nFoo::Bar\nFoo::Baz\nInc\n", out
end
def test_list_known_classes_name
@@ -700,15 +1044,15 @@ Foo::Bar#bother
index = RDoc::AnyMethod.new nil, '[]'
index.record_location @top_level
@cFoo.add_method index
- @store.save_method @cFoo, index
+ @store1.save_method @cFoo, index
c_index = RDoc::AnyMethod.new nil, '[]'
c_index.singleton = true
c_index.record_location @top_level
@cFoo.add_method c_index
- @store.save_method @cFoo, c_index
+ @store1.save_method @cFoo, c_index
- @store.save_cache
+ @store1.save_cache
assert_equal %w[Foo#[]], @driver.list_methods_matching('Foo#[]')
assert_equal %w[Foo::[]], @driver.list_methods_matching('Foo::[]')
@@ -717,7 +1061,7 @@ Foo::Bar#bother
def test_load_method
util_store
- method = @driver.load_method(@store, :instance_methods, 'Foo', '#',
+ method = @driver.load_method(@store1, :instance_methods, 'Foo', '#',
'inherit')
assert_equal @inherit, method
@@ -735,11 +1079,11 @@ Foo::Bar#bother
def test_load_methods_matching
util_store
- expected = [[@store, [@inherit]]]
+ expected = [[@store1, [@inherit]]]
assert_equal expected, @driver.load_methods_matching('Foo#inherit')
- expected = [[@store, [@blah]]]
+ expected = [[@store1, [@blah]]]
assert_equal expected, @driver.load_methods_matching('.blah')
@@ -754,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
@@ -768,6 +1123,20 @@ Foo::Bar#bother
refute @driver.paging?
end
+ # this test is too fragile. Perhaps using Process.spawn will make this
+ # reliable
+ def _test_page_in_presence_of_child_status
+ skip 'this test hangs on travis-ci.org' if ENV['CI']
+ @driver.use_stdout = false
+
+ with_dummy_pager do
+ @driver.page do |io|
+ refute_equal $stdout, io
+ assert @driver.paging?
+ end
+ end
+ end
+
def test_page_stdout
@driver.use_stdout = true
@@ -798,6 +1167,28 @@ Foo::Bar#bother
assert_equal 'foo', meth, '::foo method'
end
+ def test_parse_name_page
+ klass, type, meth = @driver.parse_name 'ruby:README'
+
+ assert_equal 'ruby', klass, 'ruby project'
+ assert_equal ':', type, 'ruby type'
+ assert_equal 'README', meth, 'ruby page'
+
+ klass, type, meth = @driver.parse_name 'ruby:'
+
+ assert_equal 'ruby', klass, 'ruby project'
+ assert_equal ':', type, 'ruby type'
+ assert_equal nil, meth, 'ruby page'
+ end
+
+ def test_parse_name_page_extenson
+ klass, type, meth = @driver.parse_name 'ruby:README.EXT'
+
+ assert_equal 'ruby', klass, 'ruby project'
+ assert_equal ':', type, 'ruby type'
+ assert_equal 'README.EXT', meth, 'ruby page'
+ end
+
def test_parse_name_single_class
klass, type, meth = @driver.parse_name 'Foo'
@@ -958,13 +1349,11 @@ Foo::Bar#bother
def util_multi_store
util_store
- @store1 = @store
-
- @top_level = RDoc::TopLevel.new 'file.rb'
-
@home_ri2 = "#{@home_ri}2"
@store2 = RDoc::RI::Store.new @home_ri2
+ @top_level = @store2.add_file 'file.rb'
+
# as if seen in a namespace like class Ambiguous::Other
@mAmbiguous = @top_level.add_module RDoc::NormalModule, 'Ambiguous'
@@ -980,29 +1369,31 @@ Foo::Bar#bother
@override.comment = 'must be displayed'
@override.record_location @top_level
- @store2.save_class @mAmbiguous
- @store2.save_class @cBar
- @store2.save_class @cFoo_Baz
-
- @store2.save_method @cBar, @override
- @store2.save_method @cBar, @baz
-
- @store2.save_cache
+ @store2.save
@driver.stores = [@store1, @store2]
-
- RDoc::RDoc.reset
end
def util_store
- @store = RDoc::RI::Store.new @home_ri
+ @store1 = RDoc::RI::Store.new @home_ri, :home
- @top_level = RDoc::TopLevel.new 'file.rb'
+ @top_level = @store1.add_file 'file.rb'
+
+ @readme = @store1.add_file 'README.rdoc'
+ @readme.parser = RDoc::Parser::Simple
+ @readme.comment =
+ doc(
+ head(1, 'README'),
+ para('This is a README'))
@cFoo = @top_level.add_class RDoc::NormalClass, 'Foo'
+ @mExt = @top_level.add_module RDoc::NormalModule, 'Ext'
@mInc = @top_level.add_module RDoc::NormalModule, 'Inc'
@cAmbiguous = @top_level.add_class RDoc::NormalClass, 'Ambiguous'
+ doc = @RM::Document.new @RM::Paragraph.new('Extend thingy')
+ @cFooExt = @cFoo.add_extend RDoc::Extend.new('Ext', doc)
+ @cFooExt.record_location @top_level
doc = @RM::Document.new @RM::Paragraph.new('Include thingy')
@cFooInc = @cFoo.add_include RDoc::Include.new('Inc', doc)
@cFooInc.record_location @top_level
@@ -1033,28 +1424,12 @@ Foo::Bar#bother
# overriden by Bar in multi_store
@overriden = @cFoo.add_method RDoc::AnyMethod.new(nil, 'override')
- @overriden.comment = 'must not be displayed'
+ @overriden.comment = 'must not be displayed in Bar#override'
@overriden.record_location @top_level
- @store.save_class @cFoo
- @store.save_class @cFoo_Bar
- @store.save_class @cFoo_Baz
- @store.save_class @mInc
- @store.save_class @cAmbiguous
-
- @store.save_method @cFoo_Bar, @blah
- @store.save_method @cFoo_Bar, @bother
- @store.save_method @cFoo_Bar, @new
- @store.save_method @cFoo_Bar, @attr
-
- @store.save_method @cFoo, @inherit
- @store.save_method @cFoo, @overriden
-
- @store.save_cache
-
- @driver.stores = [@store]
+ @store1.save
- RDoc::RDoc.reset
+ @driver.stores = [@store1]
end
end
diff --git a/test/rdoc/test_rdoc_ri_paths.rb b/test/rdoc/test_rdoc_ri_paths.rb
index e6f33d7d5e..e377b0b1d0 100644
--- a/test/rdoc/test_rdoc_ri_paths.rb
+++ b/test/rdoc/test_rdoc_ri_paths.rb
@@ -1,42 +1,154 @@
-require 'rubygems'
-require 'minitest/autorun'
-require 'tmpdir'
-require 'fileutils'
-require 'rdoc/ri/paths'
+require 'rdoc/test_case'
-class TestRDocRIPaths < MiniTest::Unit::TestCase
+class TestRDocRIPaths < RDoc::TestCase
def setup
- RDoc::RI::Paths.instance_variable_set :@gemdirs, %w[/nonexistent/gemdir]
+ super
+
+ @orig_gem_path = Gem.path
+
+ @tempdir = File.join Dir.tmpdir, "test_rdoc_ri_paths_#{$$}"
+ Gem.use_paths @tempdir
+ Gem.ensure_gem_subdirectories @tempdir
+
+ specs = [
+ @rake_10 = Gem::Specification.new('rake', '10.0.1'),
+ @rdoc_4_0 = Gem::Specification.new('rdoc', '4.0'),
+ @rdoc_3_12 = Gem::Specification.new('rdoc', '3.12'),
+ @nodoc = Gem::Specification.new('nodoc', '1.0'),
+ ]
+
+ specs.each do |spec|
+ spec.loaded_from = spec.spec_file
+
+ open spec.spec_file, 'w' do |file|
+ file.write spec.to_ruby_for_cache
+ end
+
+ FileUtils.mkdir_p File.join(spec.doc_dir, 'ri') unless
+ spec.name == 'nodoc'
+ end
+
+ Gem::Specification.reset
+ Gem::Specification.all = specs
end
def teardown
- RDoc::RI::Paths.instance_variable_set :@gemdirs, nil
+ super
+
+ Gem.use_paths(*@orig_gem_path)
+ Gem::Specification.reset
+ FileUtils.rm_rf @tempdir
+ end
+
+ def test_class_each
+ enum = RDoc::RI::Paths.each true, true, true, :all
+
+ path = enum.map { |dir,| dir }
+
+ assert_equal RDoc::RI::Paths.system_dir, path.shift
+ assert_equal RDoc::RI::Paths.site_dir, path.shift
+ assert_equal RDoc::RI::Paths.home_dir, path.shift
+ assert_equal File.join(@nodoc.doc_dir, 'ri'), path.shift
+ assert_equal File.join(@rake_10.doc_dir, 'ri'), path.shift
+ assert_equal File.join(@rdoc_4_0.doc_dir, 'ri'), path.shift
+ assert_equal File.join(@rdoc_3_12.doc_dir, 'ri'), path.shift
+ assert_empty path
+ end
+
+ def test_class_gemdirs_latest
+ Dir.chdir @tempdir do
+ gemdirs = RDoc::RI::Paths.gemdirs :latest
+
+ expected = [
+ File.join(@rake_10.doc_dir, 'ri'),
+ File.join(@rdoc_4_0.doc_dir, 'ri'),
+ ]
+
+ assert_equal expected, gemdirs
+ end
+ end
+
+ def test_class_gemdirs_legacy
+ Dir.chdir @tempdir do
+ gemdirs = RDoc::RI::Paths.gemdirs true
+
+ expected = [
+ File.join(@rake_10.doc_dir, 'ri'),
+ File.join(@rdoc_4_0.doc_dir, 'ri'),
+ ]
+
+ assert_equal expected, gemdirs
+ end
+ end
+
+ def test_class_gemdirs_all
+ Dir.chdir @tempdir do
+ gemdirs = RDoc::RI::Paths.gemdirs :all
+
+ expected = [
+ File.join(@nodoc.doc_dir, 'ri'),
+ File.join(@rake_10.doc_dir, 'ri'),
+ File.join(@rdoc_4_0.doc_dir, 'ri'),
+ File.join(@rdoc_3_12.doc_dir, 'ri'),
+ ]
+
+ assert_equal expected, gemdirs
+ end
+ end
+
+ def test_class_gem_dir
+ dir = RDoc::RI::Paths.gem_dir 'rake', '10.0.1'
+
+ expected = File.join @rake_10.doc_dir, 'ri'
+
+ assert_equal expected, dir
+ end
+
+ def test_class_home_dir
+ dir = RDoc::RI::Paths.home_dir
+
+ assert_equal RDoc::RI::Paths::HOMEDIR, dir
end
def test_class_path_nonexistent
- path = RDoc::RI::Paths.path true, true, true, true, '/nonexistent'
+ temp_dir do |dir|
+ nonexistent = File.join dir, 'nonexistent'
+ dir = RDoc::RI::Paths.path true, true, true, true, nonexistent
- refute_includes path, '/nonexistent'
+ refute_includes dir, nonexistent
+ end
end
def test_class_raw_path
path = RDoc::RI::Paths.raw_path true, true, true, true
- assert_equal RDoc::RI::Paths::SYSDIR, path.shift
- assert_equal RDoc::RI::Paths::SITEDIR, path.shift
- assert_equal RDoc::RI::Paths::HOMEDIR, path.shift
- assert_equal '/nonexistent/gemdir', path.shift
+ assert_equal RDoc::RI::Paths.system_dir, path.shift
+ assert_equal RDoc::RI::Paths.site_dir, path.shift
+ assert_equal RDoc::RI::Paths.home_dir, path.shift
+ assert_equal File.join(@rake_10.doc_dir, 'ri'), path.shift
end
def test_class_raw_path_extra_dirs
path = RDoc::RI::Paths.raw_path true, true, true, true, '/nonexistent'
- assert_equal '/nonexistent', path.shift
- assert_equal RDoc::RI::Paths::SYSDIR, path.shift
- assert_equal RDoc::RI::Paths::SITEDIR, path.shift
- assert_equal RDoc::RI::Paths::HOMEDIR, path.shift
- assert_equal '/nonexistent/gemdir', path.shift
+ assert_equal '/nonexistent', path.shift
+ assert_equal RDoc::RI::Paths.system_dir, path.shift
+ assert_equal RDoc::RI::Paths.site_dir, path.shift
+ assert_equal RDoc::RI::Paths.home_dir, path.shift
+ assert_equal File.join(@rake_10.doc_dir, 'ri'), path.shift
+ end
+
+ def test_class_site_dir
+ dir = RDoc::RI::Paths.site_dir
+
+ assert_equal File.join(RDoc::RI::Paths::BASE, 'site'), dir
+ end
+
+ def test_class_system_dir
+ dir = RDoc::RI::Paths.system_dir
+
+ assert_equal File.join(RDoc::RI::Paths::BASE, 'system'), dir
end
end
diff --git a/test/rdoc/test_rdoc_ri_store.rb b/test/rdoc/test_rdoc_ri_store.rb
deleted file mode 100644
index 23e441b633..0000000000
--- a/test/rdoc/test_rdoc_ri_store.rb
+++ /dev/null
@@ -1,473 +0,0 @@
-require 'rubygems'
-require 'minitest/autorun'
-require 'rdoc/rdoc'
-require 'rdoc/ri'
-require 'rdoc/markup'
-require 'tmpdir'
-require 'fileutils'
-require 'pp'
-
-class TestRDocRIStore < MiniTest::Unit::TestCase
-
- OBJECT_ANCESTORS = defined?(::BasicObject) ? %w[BasicObject] : []
-
- def setup
- RDoc::TopLevel.reset
-
- @tmpdir = File.join Dir.tmpdir, "test_rdoc_ri_store_#{$$}"
- @s = RDoc::RI::Store.new @tmpdir
-
- @top_level = RDoc::TopLevel.new 'file.rb'
-
- @klass = @top_level.add_class RDoc::NormalClass, 'Object'
- @klass.add_comment 'original', @top_level
-
- @cmeth = RDoc::AnyMethod.new nil, 'cmethod'
- @cmeth.singleton = true
- @cmeth.record_location @top_level
-
- @meth = RDoc::AnyMethod.new nil, 'method'
- @meth.record_location @top_level
-
- @meth_bang = RDoc::AnyMethod.new nil, 'method!'
- @meth_bang.record_location @top_level
-
- @attr = RDoc::Attr.new nil, 'attr', 'RW', ''
- @attr.record_location @top_level
-
- @klass.add_method @cmeth
- @klass.add_method @meth
- @klass.add_method @meth_bang
- @klass.add_attribute @attr
-
- @nest_klass = @klass.add_class RDoc::NormalClass, 'SubClass'
- @nest_meth = RDoc::AnyMethod.new nil, 'method'
- @nest_meth.record_location @top_level
-
- @nest_incl = RDoc::Include.new 'Incl', ''
- @nest_incl.record_location @top_level
-
- @nest_klass.add_method @nest_meth
- @nest_klass.add_include @nest_incl
-
- @RM = RDoc::Markup
- end
-
- def teardown
- 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 = {}
- imethods ||= { 'Object' => %w[method method!] }
- cmethods ||= { 'Object' => %w[cmethod] }
- attrs ||= { 'Object' => ['attr_accessor attr'] }
-
- # this is sort-of a hack
- @s.clean_cache_collection ancestors
-
- expected = {
- :ancestors => ancestors,
- :attributes => attrs,
- :class_methods => cmethods,
- :encoding => nil,
- :instance_methods => imethods,
- :modules => modules,
- }
-
- @s.save_cache
-
- 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_attributes
- @s.cache[:attributes]['Object'] = %w[attr]
-
- expected = { 'Object' => %w[attr] }
-
- assert_equal expected, @s.attributes
- end
-
- def test_class_file
- assert_equal File.join(@tmpdir, 'Object', 'cdesc-Object.ri'),
- @s.class_file('Object')
- assert_equal File.join(@tmpdir, 'Object', 'SubClass', 'cdesc-SubClass.ri'),
- @s.class_file('Object::SubClass')
- end
-
- def test_class_methods
- @s.cache[:class_methods]['Object'] = %w[method]
-
- expected = { 'Object' => %w[method] }
-
- assert_equal expected, @s.class_methods
- end
-
- def test_class_path
- assert_equal File.join(@tmpdir, 'Object'), @s.class_path('Object')
- assert_equal File.join(@tmpdir, 'Object', 'SubClass'),
- @s.class_path('Object::SubClass')
- end
-
- def test_dry_run
- refute @s.dry_run
-
- @s.dry_run = true
-
- assert @s.dry_run
- end
-
- def test_friendly_path
- @s.path = @tmpdir
- @s.type = nil
- assert_equal @s.path, @s.friendly_path
-
- @s.type = :extra
- assert_equal @s.path, @s.friendly_path
-
- @s.type = :system
- assert_equal "ruby core", @s.friendly_path
-
- @s.type = :site
- assert_equal "ruby site", @s.friendly_path
-
- @s.type = :home
- assert_equal "~/.ri", @s.friendly_path
-
- @s.type = :gem
- @s.path = "#{@tmpdir}/gem_repository/doc/gem_name-1.0/ri"
- assert_equal "gem gem_name-1.0", @s.friendly_path
- end
-
- def test_instance_methods
- @s.cache[:instance_methods]['Object'] = %w[method]
-
- expected = { 'Object' => %w[method] }
-
- assert_equal expected, @s.instance_methods
- end
-
- def test_load_cache
- cache = {
- :encoding => :encoding_value,
- :methods => %w[Object#method],
- :modules => %w[Object],
- }
-
- Dir.mkdir @tmpdir
-
- open File.join(@tmpdir, 'cache.ri'), 'wb' do |io|
- Marshal.dump cache, io
- end
-
- @s.load_cache
-
- assert_equal cache, @s.cache
-
- assert_equal :encoding_value, @s.encoding
- end
-
- def test_load_cache_encoding_differs
- skip "Encoding not implemented" unless Object.const_defined? :Encoding
-
- cache = {
- :encoding => Encoding::ISO_8859_1,
- :methods => %w[Object#method],
- :modules => %w[Object],
- }
-
- Dir.mkdir @tmpdir
-
- open File.join(@tmpdir, 'cache.ri'), 'wb' do |io|
- Marshal.dump cache, io
- end
-
- @s.encoding = Encoding::UTF_8
-
- @s.load_cache
-
- assert_equal cache, @s.cache
-
- assert_equal Encoding::UTF_8, @s.encoding
- end
-
- def test_load_cache_no_cache
- cache = {
- :ancestors => {},
- :attributes => {},
- :class_methods => {},
- :encoding => nil,
- :instance_methods => {},
- :modules => [],
- }
-
- @s.load_cache
-
- assert_equal cache, @s.cache
- end
-
- def test_load_class
- @s.save_class @klass
-
- assert_equal @klass, @s.load_class('Object')
- end
-
- def test_load_method_bang
- @s.save_method @klass, @meth_bang
-
- meth = @s.load_method('Object', '#method!')
- assert_equal @meth_bang, meth
- end
-
- def test_method_file
- assert_equal File.join(@tmpdir, 'Object', 'method-i.ri'),
- @s.method_file('Object', 'Object#method')
-
- assert_equal File.join(@tmpdir, 'Object', 'method%21-i.ri'),
- @s.method_file('Object', 'Object#method!')
-
- assert_equal File.join(@tmpdir, 'Object', 'SubClass', 'method%21-i.ri'),
- @s.method_file('Object::SubClass', 'Object::SubClass#method!')
-
- assert_equal File.join(@tmpdir, 'Object', 'method-c.ri'),
- @s.method_file('Object', 'Object::method')
- end
-
- def test_save_cache
- @s.save_class @klass
- @s.save_method @klass, @meth
- @s.save_method @klass, @cmeth
- @s.save_class @nest_klass
- @s.encoding = :encoding_value
-
- @s.save_cache
-
- assert_file File.join(@tmpdir, 'cache.ri')
-
- expected = {
- :attributes => { 'Object' => ['attr_accessor attr'] },
- :class_methods => { 'Object' => %w[cmethod] },
- :instance_methods => {
- 'Object' => %w[method method!],
- 'Object::SubClass' => %w[method],
- },
- :modules => %w[Object Object::SubClass],
- :ancestors => {
- 'Object::SubClass' => %w[Incl Object],
- },
- :encoding => :encoding_value,
- }
-
- expected[:ancestors]['Object'] = %w[BasicObject] if defined?(::BasicObject)
-
- open File.join(@tmpdir, 'cache.ri'), 'rb' do |io|
- cache = Marshal.load io.read
-
- assert_equal expected, cache
- end
- end
-
- def test_save_cache_dry_run
- @s.dry_run = true
-
- @s.save_class @klass
- @s.save_method @klass, @meth
- @s.save_method @klass, @cmeth
- @s.save_class @nest_klass
-
- @s.save_cache
-
- refute_file File.join(@tmpdir, 'cache.ri')
- end
-
- def test_save_cache_duplicate_methods
- @s.save_method @klass, @meth
- @s.save_method @klass, @meth
-
- @s.save_cache
-
- assert_cache({ 'Object' => %w[method] }, {}, {}, [])
- end
-
- def test_save_class
- @s.save_class @klass
-
- assert_directory File.join(@tmpdir, 'Object')
- assert_file File.join(@tmpdir, 'Object', 'cdesc-Object.ri')
-
- assert_cache nil, nil, nil, %w[Object], 'Object' => OBJECT_ANCESTORS
-
- assert_equal @klass, @s.load_class('Object')
- end
-
- def test_save_class_basic_object
- @klass.instance_variable_set :@superclass, nil
-
- @s.save_class @klass
-
- assert_directory File.join(@tmpdir, 'Object')
- assert_file File.join(@tmpdir, 'Object', 'cdesc-Object.ri')
-
- assert_cache(nil, nil, nil, %w[Object])
-
- assert_equal @klass, @s.load_class('Object')
- end
-
- def test_save_class_delete
- # save original
- @s.save_class @klass
- @s.save_method @klass, @meth
- @s.save_method @klass, @meth_bang
- @s.save_method @klass, @cmeth
- @s.save_cache
-
- klass = RDoc::NormalClass.new 'Object'
-
- meth = klass.add_method RDoc::AnyMethod.new(nil, 'replace')
- meth.record_location @top_level
-
- # load original, save newly updated class
- @s = RDoc::RI::Store.new @tmpdir
- @s.load_cache
- @s.save_class klass
- @s.save_cache
-
- # load from disk again
- @s = RDoc::RI::Store.new @tmpdir
- @s.load_cache
-
- @s.load_class 'Object'
-
- assert_cache({ 'Object' => %w[replace] }, {},
- { 'Object' => %w[attr_accessor\ attr] }, %w[Object],
- 'Object' => OBJECT_ANCESTORS)
-
- refute File.exist? @s.method_file(@klass.full_name, @meth.full_name)
- refute File.exist? @s.method_file(@klass.full_name, @meth_bang.full_name)
- refute File.exist? @s.method_file(@klass.full_name, @cmeth.full_name)
- end
-
- def test_save_class_dry_run
- @s.dry_run = true
-
- @s.save_class @klass
-
- refute_file File.join(@tmpdir, 'Object')
- refute_file File.join(@tmpdir, 'Object', 'cdesc-Object.ri')
- end
-
- def test_save_class_merge
- @s.save_class @klass
-
- klass = RDoc::NormalClass.new 'Object'
- klass.add_comment 'new comment', @top_level
-
- s = RDoc::RI::Store.new @tmpdir
- s.save_class klass
-
- s = RDoc::RI::Store.new @tmpdir
-
- inner = @RM::Document.new @RM::Paragraph.new 'new comment'
- inner.file = @top_level.absolute_name
-
- document = @RM::Document.new inner
-
- assert_equal document, s.load_class('Object').comment
- end
-
- # This is a functional test
- def test_save_class_merge_constant
- tl = RDoc::TopLevel.new 'file.rb'
- klass = RDoc::NormalClass.new 'C'
- klass.add_comment 'comment', tl
-
- const = klass.add_constant RDoc::Constant.new('CONST', nil, nil)
- const.record_location tl
-
- @s.save_class klass
-
- RDoc::RDoc.reset
-
- klass2 = RDoc::NormalClass.new 'C'
- klass2.record_location tl
-
- s = RDoc::RI::Store.new @tmpdir
- s.save_class klass2
-
- s = RDoc::RI::Store.new @tmpdir
-
- result = s.load_class 'C'
-
- assert_empty result.constants
- end
-
- def test_save_class_methods
- @s.save_class @klass
-
- assert_directory File.join(@tmpdir, 'Object')
- assert_file File.join(@tmpdir, 'Object', 'cdesc-Object.ri')
-
- assert_cache nil, nil, nil, %w[Object], 'Object' => OBJECT_ANCESTORS
-
- assert_equal @klass, @s.load_class('Object')
- end
-
- def test_save_class_nested
- @s.save_class @nest_klass
-
- assert_directory File.join(@tmpdir, 'Object', 'SubClass')
- assert_file File.join(@tmpdir, 'Object', 'SubClass', 'cdesc-SubClass.ri')
-
- assert_cache({ 'Object::SubClass' => %w[method] }, {}, {},
- %w[Object::SubClass], 'Object::SubClass' => %w[Incl Object])
- end
-
- def test_save_method
- @s.save_method @klass, @meth
-
- assert_directory File.join(@tmpdir, 'Object')
- assert_file File.join(@tmpdir, 'Object', 'method-i.ri')
-
- assert_cache({ 'Object' => %w[method] }, {}, {}, [])
-
- assert_equal @meth, @s.load_method('Object', '#method')
- end
-
- def test_save_method_dry_run
- @s.dry_run = true
-
- @s.save_method @klass, @meth
-
- refute_file File.join(@tmpdir, 'Object')
- refute_file File.join(@tmpdir, 'Object', 'method-i.ri')
- end
-
- def test_save_method_nested
- @s.save_method @nest_klass, @nest_meth
-
- assert_directory File.join(@tmpdir, 'Object', 'SubClass')
- assert_file File.join(@tmpdir, 'Object', 'SubClass', 'method-i.ri')
-
- assert_cache({ 'Object::SubClass' => %w[method] }, {}, {}, [])
- end
-
-end
-
diff --git a/test/rdoc/test_rdoc_ruby_lex.rb b/test/rdoc/test_rdoc_ruby_lex.rb
index 4398f4119f..22cf0f6295 100644
--- a/test/rdoc/test_rdoc_ruby_lex.rb
+++ b/test/rdoc/test_rdoc_ruby_lex.rb
@@ -1,9 +1,394 @@
-require 'rubygems'
-require 'minitest/autorun'
-require 'rdoc/rdoc'
-require 'rdoc/ruby_lex'
+# coding: UTF-8
+
+require 'rdoc/test_case'
+
+class TestRDocRubyLex < RDoc::TestCase
+
+ def setup
+ @TK = RDoc::RubyToken
+ end
+
+ def test_class_tokenize
+ tokens = RDoc::RubyLex.tokenize "def x() end", nil
+
+ expected = [
+ @TK::TkDEF .new( 0, 1, 0, "def"),
+ @TK::TkSPACE .new( 3, 1, 3, " "),
+ @TK::TkIDENTIFIER.new( 4, 1, 4, "x"),
+ @TK::TkLPAREN .new( 5, 1, 5, "("),
+ @TK::TkRPAREN .new( 6, 1, 6, ")"),
+ @TK::TkSPACE .new( 7, 1, 7, " "),
+ @TK::TkEND .new( 8, 1, 8, "end"),
+ @TK::TkNL .new(11, 1, 11, "\n"),
+ ]
+
+ assert_equal expected, tokens
+ end
+
+ def test_class_tokenize___END__
+ tokens = RDoc::RubyLex.tokenize '__END__', nil
+
+ expected = [
+ @TK::TkEND_OF_SCRIPT.new(0, 1, 0, '__END__'),
+ @TK::TkNL .new(7, 1, 7, "\n"),
+ ]
+
+ assert_equal expected, tokens
+ end
+
+ def test_class_tokenize_character_literal
+ tokens = RDoc::RubyLex.tokenize "?\\", nil
+
+ expected = [
+ @TK::TkCHAR.new( 0, 1, 0, "?\\"),
+ @TK::TkNL .new( 2, 1, 2, "\n"),
+ ]
+
+ assert_equal expected, tokens
+ end
+
+ def test_class_tokenize_def_heredoc
+ tokens = RDoc::RubyLex.tokenize <<-'RUBY', nil
+def x
+ <<E
+Line 1
+Line 2
+E
+end
+ RUBY
+
+ expected = [
+ @TK::TkDEF .new( 0, 1, 0, 'def'),
+ @TK::TkSPACE .new( 3, 1, 3, ' '),
+ @TK::TkIDENTIFIER.new( 4, 1, 4, 'x'),
+ @TK::TkNL .new( 5, 1, 5, "\n"),
+ @TK::TkSPACE .new( 6, 2, 0, ' '),
+ @TK::TkHEREDOC .new( 8, 2, 2,
+ %Q{<<E\nLine 1\nLine 2\nE}),
+ @TK::TkNL .new(27, 5, 28, "\n"),
+ @TK::TkEND .new(28, 6, 0, 'end'),
+ @TK::TkNL .new(31, 6, 28, "\n"),
+ ]
+
+ assert_equal expected, tokens
+ end
+
+ def test_class_tokenize_hash_symbol
+ tokens = RDoc::RubyLex.tokenize '{ class:"foo" }', nil
+
+ expected = [
+ @TK::TkLBRACE .new( 0, 1, 0, '{'),
+ @TK::TkSPACE .new( 1, 1, 1, ' '),
+ @TK::TkIDENTIFIER.new( 2, 1, 2, 'class'),
+ @TK::TkSYMBEG .new( 7, 1, 7, ':'),
+ @TK::TkSTRING .new( 8, 1, 8, '"foo"'),
+ @TK::TkSPACE .new(13, 1, 13, ' '),
+ @TK::TkRBRACE .new(14, 1, 14, '}'),
+ @TK::TkNL .new(15, 1, 15, "\n"),
+ ]
+
+ assert_equal expected, tokens
+ end
+
+ def test_class_tokenize_heredoc_CR_NL
+ tokens = RDoc::RubyLex.tokenize <<-RUBY, nil
+string = <<-STRING\r
+Line 1\r
+Line 2\r
+ STRING\r
+ RUBY
+
+ expected = [
+ @TK::TkIDENTIFIER.new( 0, 1, 0, 'string'),
+ @TK::TkSPACE .new( 6, 1, 6, ' '),
+ @TK::TkASSIGN .new( 7, 1, 7, '='),
+ @TK::TkSPACE .new( 8, 1, 8, ' '),
+ @TK::TkHEREDOC .new( 9, 1, 9,
+ %Q{<<-STRING\nLine 1\nLine 2\n STRING}),
+ @TK::TkSPACE .new(44, 4, 45, "\r"),
+ @TK::TkNL .new(45, 4, 46, "\n"),
+ ]
+
+ assert_equal expected, tokens
+ end
+
+ def test_class_tokenize_heredoc_call
+ tokens = RDoc::RubyLex.tokenize <<-'RUBY', nil
+string = <<-STRING.chomp
+Line 1
+Line 2
+ STRING
+ RUBY
+
+ expected = [
+ @TK::TkIDENTIFIER.new( 0, 1, 0, 'string'),
+ @TK::TkSPACE .new( 6, 1, 6, ' '),
+ @TK::TkASSIGN .new( 7, 1, 7, '='),
+ @TK::TkSPACE .new( 8, 1, 8, ' '),
+ @TK::TkSTRING .new( 9, 1, 9, %Q{"Line 1\nLine 2\n"}),
+ @TK::TkDOT .new(41, 4, 42, '.'),
+ @TK::TkIDENTIFIER.new(42, 4, 43, 'chomp'),
+ @TK::TkNL .new(47, 4, 48, "\n"),
+ ]
+
+ assert_equal expected, tokens
+ end
+
+ def test_class_tokenize_heredoc_indent
+ tokens = RDoc::RubyLex.tokenize <<-'RUBY', nil
+string = <<-STRING
+Line 1
+Line 2
+ STRING
+ RUBY
+
+ expected = [
+ @TK::TkIDENTIFIER.new( 0, 1, 0, 'string'),
+ @TK::TkSPACE .new( 6, 1, 6, ' '),
+ @TK::TkASSIGN .new( 7, 1, 7, '='),
+ @TK::TkSPACE .new( 8, 1, 8, ' '),
+ @TK::TkHEREDOC .new( 9, 1, 9,
+ %Q{<<-STRING\nLine 1\nLine 2\n STRING}),
+ @TK::TkNL .new(41, 4, 42, "\n"),
+ ]
+
+ 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
+%N
+U
+ RUBY
+
+ expected = [
+ @TK::TkIDENTIFIER.new( 0, 1, 0, 'a'),
+ @TK::TkSPACE .new( 1, 1, 1, ' '),
+ @TK::TkIDENTIFIER.new( 2, 1, 2, 'b'),
+ @TK::TkSPACE .new( 3, 1, 3, ' '),
+ @TK::TkHEREDOC .new( 4, 1, 4, %Q{<<-U\n%N\nU}),
+ @TK::TkNL .new(13, 3, 14, "\n"),
+ ]
+
+ assert_equal expected, tokens
+ end
+
+ def test_class_tokenize_identifier_high_unicode
+ tokens = RDoc::RubyLex.tokenize 'ð–’', nil
+
+ expected = @TK::TkIDENTIFIER.new(0, 1, 0, 'ð–’')
+
+ assert_equal expected, tokens.first
+ end
+
+ def test_class_tokenize_percent_1
+ tokens = RDoc::RubyLex.tokenize 'v%10==10', nil
+
+ expected = [
+ @TK::TkIDENTIFIER.new(0, 1, 0, 'v'),
+ @TK::TkMOD.new( 1, 1, 1, '%'),
+ @TK::TkINTEGER.new( 2, 1, 2, '10'),
+ @TK::TkEQ.new( 4, 1, 4, '=='),
+ @TK::TkINTEGER.new( 6, 1, 6, '10'),
+ @TK::TkNL.new( 8, 1, 8, "\n"),
+ ]
+
+ assert_equal expected, tokens
+ end
+
+ def test_class_tokenize_percent_r
+ tokens = RDoc::RubyLex.tokenize '%r[hi]', nil
+
+ expected = [
+ @TK::TkREGEXP.new( 0, 1, 0, '%r[hi]'),
+ @TK::TkNL .new( 6, 1, 6, "\n"),
+ ]
+
+ assert_equal expected, tokens
+ end
+
+ def test_class_tokenize_percent_w
+ 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
+
+ expected = [
+ @TK::TkREGEXP.new( 0, 1, 0, "/hay/"),
+ @TK::TkNL .new( 5, 1, 5, "\n"),
+ ]
+
+ 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
+
+ expected = [
+ @TK::TkREGEXP.new( 0, 1, 0, "/[csh](..) [csh]\\1 in/"),
+ @TK::TkNL .new(22, 1, 22, "\n"),
+ ]
+
+ assert_equal expected, tokens
+ end
+
+ def test_class_tokenize_regexp_escape
+ tokens = RDoc::RubyLex.tokenize "/\\//", nil
+
+ expected = [
+ @TK::TkREGEXP.new( 0, 1, 0, "/\\//"),
+ @TK::TkNL .new( 4, 1, 4, "\n"),
+ ]
+
+ assert_equal expected, tokens
+ end
+
+ def test_class_tokenize_string
+ tokens = RDoc::RubyLex.tokenize "'hi'", nil
+
+ expected = [
+ @TK::TkSTRING.new( 0, 1, 0, "'hi'"),
+ @TK::TkNL .new( 4, 1, 4, "\n"),
+ ]
+
+ 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
-class TestRubyLex < MiniTest::Unit::TestCase
def test_unary_minus
ruby_lex = RDoc::RubyLex.new("-1", nil)
assert_equal("-1", ruby_lex.token.value)
@@ -20,4 +405,6 @@ class TestRubyLex < MiniTest::Unit::TestCase
2.times { ruby_lex.token } # skip "0" and "+"
assert_equal("-0.1", ruby_lex.token.value)
end
+
end
+
diff --git a/test/rdoc/test_rdoc_ruby_token.rb b/test/rdoc/test_rdoc_ruby_token.rb
new file mode 100644
index 0000000000..ed8c8275ba
--- /dev/null
+++ b/test/rdoc/test_rdoc_ruby_token.rb
@@ -0,0 +1,19 @@
+require 'rdoc/test_case'
+
+class TestRDocRubyToken < RDoc::TestCase
+
+ def test_Token_text
+ token = RDoc::RubyToken::Token.new 0, 0, 0, 'text'
+
+ assert_equal 'text', token.text
+ end
+
+ def test_TkOp_name
+ token = RDoc::RubyToken::TkOp.new 0, 0, 0, '&'
+
+ assert_equal '&', token.text
+ assert_equal '&', token.name
+ end
+
+end
+
diff --git a/test/rdoc/test_rdoc_rubygems_hook.rb b/test/rdoc/test_rdoc_rubygems_hook.rb
index e8f8621820..cee0810ab4 100644
--- a/test/rdoc/test_rdoc_rubygems_hook.rb
+++ b/test/rdoc/test_rdoc_rubygems_hook.rb
@@ -1,17 +1,26 @@
-require 'rubygems/test_case'
require 'rubygems'
+require 'rubygems/test_case'
require 'rdoc/rubygems_hook'
class TestRDocRubygemsHook < Gem::TestCase
def setup
super
+
skip 'requires RubyGems 1.9+' unless
Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.9')
- @a = quick_spec 'a'
+ @a = util_spec 'a', 2 do |s|
+ s.rdoc_options = %w[--main MyTitle]
+ s.extra_rdoc_files = %w[README]
+ end
- @rdoc = RDoc::RubygemsHook.new @a
+ write_file File.join(@tempdir, 'lib', 'a.rb')
+ write_file File.join(@tempdir, 'README')
+
+ install_gem @a
+
+ @hook = RDoc::RubygemsHook.new @a
begin
RDoc::RubygemsHook.load_rdoc
@@ -23,8 +32,8 @@ class TestRDocRubygemsHook < Gem::TestCase
end
def test_initialize
- assert @rdoc.generate_rdoc
- assert @rdoc.generate_ri
+ refute @hook.generate_rdoc
+ assert @hook.generate_ri
rdoc = RDoc::RubygemsHook.new @a, false, false
@@ -40,7 +49,7 @@ class TestRDocRubygemsHook < Gem::TestCase
-p
]
- @rdoc.delete_legacy_args args
+ @hook.delete_legacy_args args
assert_empty args
end
@@ -49,26 +58,53 @@ class TestRDocRubygemsHook < Gem::TestCase
options = RDoc::Options.new
options.files = []
- @rdoc.instance_variable_set :@rdoc, @rdoc.new_rdoc
- @rdoc.instance_variable_set :@file_info, []
+ rdoc = @hook.new_rdoc
+ rdoc.store = RDoc::Store.new
+ @hook.instance_variable_set :@rdoc, rdoc
+ @hook.instance_variable_set :@file_info, []
- @rdoc.document 'darkfish', options, @a.doc_dir('rdoc')
+ @hook.document 'darkfish', options, @a.doc_dir('rdoc')
- assert @rdoc.rdoc_installed?
+ assert @hook.rdoc_installed?
end
def test_generate
FileUtils.mkdir_p @a.doc_dir
FileUtils.mkdir_p File.join(@a.gem_dir, 'lib')
- @rdoc.generate
+ @hook.generate
- assert @rdoc.rdoc_installed?
- assert @rdoc.ri_installed?
+ refute @hook.rdoc_installed?
+ assert @hook.ri_installed?
- rdoc = @rdoc.instance_variable_get :@rdoc
+ rdoc = @hook.instance_variable_get :@rdoc
refute rdoc.options.hyperlink_all
+ assert_equal Pathname(@a.full_gem_path), rdoc.options.root
+ assert_equal %w[README lib], rdoc.options.files.sort
+
+ assert_equal 'MyTitle', rdoc.store.main
+ end
+
+ def test_generate_all
+ @hook.generate_rdoc = true
+ @hook.generate_ri = true
+
+ FileUtils.mkdir_p @a.doc_dir
+ FileUtils.mkdir_p File.join(@a.gem_dir, 'lib')
+
+ @hook.generate
+
+ assert @hook.rdoc_installed?
+ assert @hook.ri_installed?
+
+ rdoc = @hook.instance_variable_get :@rdoc
+
+ refute rdoc.options.hyperlink_all
+ assert_equal Pathname(@a.full_gem_path), rdoc.options.root
+ assert_equal %w[README lib], rdoc.options.files.sort
+
+ assert_equal 'MyTitle', rdoc.store.main
end
def test_generate_configuration_rdoc_array
@@ -77,9 +113,9 @@ class TestRDocRubygemsHook < Gem::TestCase
FileUtils.mkdir_p @a.doc_dir
FileUtils.mkdir_p File.join(@a.gem_dir, 'lib')
- @rdoc.generate
+ @hook.generate
- rdoc = @rdoc.instance_variable_get :@rdoc
+ rdoc = @hook.instance_variable_get :@rdoc
assert rdoc.options.hyperlink_all
end
@@ -90,21 +126,35 @@ class TestRDocRubygemsHook < Gem::TestCase
FileUtils.mkdir_p @a.doc_dir
FileUtils.mkdir_p File.join(@a.gem_dir, 'lib')
- @rdoc.generate
+ @hook.generate
- rdoc = @rdoc.instance_variable_get :@rdoc
+ rdoc = @hook.instance_variable_get :@rdoc
assert rdoc.options.hyperlink_all
end
+ def test_generate_default_gem
+ skip 'RubyGems 2 required' unless @a.respond_to? :default_gem?
+ @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?
+ refute @hook.ri_installed?
+ end
+
def test_generate_disabled
- @rdoc.generate_rdoc = false
- @rdoc.generate_ri = false
+ @hook.generate_rdoc = false
+ @hook.generate_ri = false
- @rdoc.generate
+ @hook.generate
- refute @rdoc.rdoc_installed?
- refute @rdoc.ri_installed?
+ refute @hook.rdoc_installed?
+ refute @hook.ri_installed?
end
def test_generate_force
@@ -112,11 +162,11 @@ class TestRDocRubygemsHook < Gem::TestCase
FileUtils.mkdir_p @a.doc_dir 'rdoc'
FileUtils.mkdir_p File.join(@a.gem_dir, 'lib')
- @rdoc.force = true
+ @hook.force = true
- @rdoc.generate
+ @hook.generate
- assert_path_exists File.join(@a.doc_dir('rdoc'), 'index.html')
+ refute_path_exists File.join(@a.doc_dir('rdoc'), 'index.html')
assert_path_exists File.join(@a.doc_dir('ri'), 'cache.ri')
end
@@ -125,32 +175,32 @@ class TestRDocRubygemsHook < Gem::TestCase
FileUtils.mkdir_p @a.doc_dir 'rdoc'
FileUtils.mkdir_p File.join(@a.gem_dir, 'lib')
- @rdoc.generate
+ @hook.generate
refute_path_exists File.join(@a.doc_dir('rdoc'), 'index.html')
refute_path_exists File.join(@a.doc_dir('ri'), 'cache.ri')
end
def test_new_rdoc
- assert_kind_of RDoc::RDoc, @rdoc.new_rdoc
+ assert_kind_of RDoc::RDoc, @hook.new_rdoc
end
def test_rdoc_installed?
- refute @rdoc.rdoc_installed?
+ refute @hook.rdoc_installed?
FileUtils.mkdir_p @a.doc_dir 'rdoc'
- assert @rdoc.rdoc_installed?
+ assert @hook.rdoc_installed?
end
def test_remove
FileUtils.mkdir_p @a.doc_dir 'rdoc'
FileUtils.mkdir_p @a.doc_dir 'ri'
- @rdoc.remove
+ @hook.remove
- refute @rdoc.rdoc_installed?
- refute @rdoc.ri_installed?
+ refute @hook.rdoc_installed?
+ refute @hook.ri_installed?
assert_path_exists @a.doc_dir
end
@@ -161,24 +211,24 @@ class TestRDocRubygemsHook < Gem::TestCase
FileUtils.chmod 0, @a.base_dir
e = assert_raises Gem::FilePermissionError do
- @rdoc.remove
+ @hook.remove
end
assert_equal @a.base_dir, e.directory
ensure
- FileUtils.chmod 0755, @a.base_dir
+ FileUtils.chmod(0755, @a.base_dir) if File.directory?(@a.base_dir)
end
def test_ri_installed?
- refute @rdoc.ri_installed?
+ refute @hook.ri_installed?
FileUtils.mkdir_p @a.doc_dir 'ri'
- assert @rdoc.ri_installed?
+ assert @hook.ri_installed?
end
def test_setup
- @rdoc.setup
+ @hook.setup
assert_path_exists @a.doc_dir
end
@@ -189,12 +239,15 @@ class TestRDocRubygemsHook < Gem::TestCase
FileUtils.chmod 0, @a.doc_dir
e = assert_raises Gem::FilePermissionError do
- @rdoc.setup
+ @hook.setup
end
assert_equal @a.doc_dir, e.directory
ensure
- FileUtils.chmod 0755, @a.doc_dir
+ if File.exist? @a.doc_dir
+ FileUtils.chmod 0755, @a.doc_dir
+ FileUtils.rm_r @a.doc_dir
+ end
end
end
diff --git a/test/rdoc/test_rdoc_servlet.rb b/test/rdoc/test_rdoc_servlet.rb
new file mode 100644
index 0000000000..143e2f225b
--- /dev/null
+++ b/test/rdoc/test_rdoc_servlet.rb
@@ -0,0 +1,535 @@
+require 'rdoc/test_case'
+
+class TestRDocServlet < RDoc::TestCase
+
+ def setup
+ super
+
+ @orig_gem_path = Gem.path
+
+ @tempdir = File.join Dir.tmpdir, "test_rdoc_servlet_#{$$}"
+ Gem.use_paths @tempdir
+ Gem.ensure_gem_subdirectories @tempdir
+
+ @spec = Gem::Specification.new 'spec', '1.0'
+ @spec.loaded_from = @spec.spec_file
+
+ Gem::Specification.reset
+ Gem::Specification.all = [@spec]
+
+ @server = {}
+ def @server.mount(*) end
+
+ @stores = {}
+ @cache = Hash.new { |hash, store| hash[store] = {} }
+
+ @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'
+
+ def @req.path= path
+ instance_variable_set :@path, path
+ end
+
+ @req.instance_variable_set :@header, Hash.new { |h, k| h[k] = [] }
+
+ @base = File.join @tempdir, 'base'
+ @system_dir = File.join @tempdir, 'base', 'system'
+ @home_dir = File.join @tempdir, 'home'
+ @gem_doc_dir = File.join @tempdir, 'doc'
+
+ @orig_base = RDoc::RI::Paths::BASE
+ RDoc::RI::Paths::BASE.replace @base
+ @orig_ri_path_homedir = RDoc::RI::Paths::HOMEDIR
+ RDoc::RI::Paths::HOMEDIR.replace @home_dir
+
+ RDoc::RI::Paths.instance_variable_set \
+ :@gemdirs, %w[/nonexistent/gems/example-1.0/ri]
+ end
+
+ def teardown
+ super
+
+ Gem.use_paths(*@orig_gem_path)
+ Gem::Specification.reset
+
+ FileUtils.rm_rf @tempdir
+
+ RDoc::RI::Paths::BASE.replace @orig_base
+ RDoc::RI::Paths::HOMEDIR.replace @orig_ri_path_homedir
+ RDoc::RI::Paths.instance_variable_set :@gemdirs, nil
+ end
+
+ def test_asset
+ temp_dir do
+ now = Time.now
+
+ open 'rdoc.css', 'w' do |io| io.write 'h1 { color: red }' end
+ File.utime now, now, 'rdoc.css'
+
+ @s.asset_dirs[:darkfish] = '.'
+
+ @req.path = 'rdoc.css'
+
+ @s.asset :darkfish, @req, @res
+
+ assert_equal 'h1 { color: red }', @res.body
+ assert_equal 'text/css', @res.content_type
+ assert_equal now.httpdate, @res['last-modified']
+ end
+ end
+
+ def test_do_GET
+ touch_system_cache_path
+
+ @req.path = '/ruby/Missing.html'
+
+ @s.do_GET @req, @res
+
+ assert_equal 404, @res.status
+ end
+
+ def test_do_GET_asset_darkfish
+ temp_dir do
+ FileUtils.touch 'rdoc.css'
+
+ @s.asset_dirs[:darkfish] = '.'
+
+ @req.path = '/rdoc.css'
+
+ @s.do_GET @req, @res
+
+ assert_equal 'text/css', @res.content_type
+ end
+ end
+
+ def test_do_GET_asset_json_index
+ temp_dir do
+ FileUtils.mkdir 'js'
+ FileUtils.touch 'js/navigation.js'
+
+ @s.asset_dirs[:json_index] = '.'
+
+ @req.path = '/js/navigation.js'
+
+ @s.do_GET @req, @res
+
+ assert_equal 'application/javascript', @res.content_type
+ end
+ end
+
+ def test_do_GET_error
+ touch_system_cache_path
+
+ def @req.path() raise 'no' end
+
+ @s.do_GET @req, @res
+
+ assert_equal 500, @res.status
+ end
+
+ def test_do_GET_mount_path
+ @s = RDoc::Servlet.new @server, @stores, @cache, '/mount/path'
+
+ temp_dir do
+ FileUtils.touch 'rdoc.css'
+
+ @s.asset_dirs[:darkfish] = '.'
+
+ @req.path = '/mount/path/rdoc.css'
+
+ @s.do_GET @req, @res
+
+ assert_equal 'text/css', @res.content_type
+ 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]
+ @req.path = '/ruby/Missing.html'
+
+ assert_raises WEBrick::HTTPStatus::NotModified do
+ @s.do_GET @req, @res
+ end
+ end
+
+ def test_do_GET_root
+ touch_system_cache_path
+
+ @req.path = '/'
+
+ @s.do_GET @req, @res
+
+ assert_equal 'text/html', @res.content_type
+ assert_match %r%<title>Local RDoc Documentation</title>%, @res.body
+ end
+
+ def test_do_GET_root_search
+ touch_system_cache_path
+
+ @req.path = '/js/search_index.js'
+
+ @s.do_GET @req, @res
+
+ assert_equal 'application/javascript', @res.content_type
+ end
+
+ def test_documentation_page_class
+ store = RDoc::Store.new
+
+ generator = @s.generator_for store
+
+ file = store.add_file 'file.rb'
+ klass = file.add_class RDoc::NormalClass, 'Klass'
+ klass.add_class RDoc::NormalClass, 'Sub'
+
+ @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" role="document" class="class">%, @res.body
+ end
+
+ def test_documentation_page_not_found
+ store = RDoc::Store.new
+
+ generator = @s.generator_for store
+
+ @req.path = '/ruby/Missing.html'
+
+ @s.documentation_page store, generator, 'Missing.html', @req, @res
+
+ assert_equal 404, @res.status
+ end
+
+ def test_documentation_page_page
+ store = RDoc::Store.new
+
+ generator = @s.generator_for store
+
+ readme = store.add_file 'README.rdoc'
+ readme.parser = RDoc::Parser::Simple
+
+ @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
+ end
+
+ def test_documentation_source
+ store, path = @s.documentation_source '/ruby/Object.html'
+
+ assert_equal @system_dir, store.path
+
+ assert_equal 'Object.html', path
+ end
+
+ def test_documentation_source_cached
+ cached_store = RDoc::Store.new
+
+ @stores['ruby'] = cached_store
+
+ store, path = @s.documentation_source '/ruby/Object.html'
+
+ assert_same cached_store, store
+
+ assert_equal 'Object.html', path
+ end
+
+ def test_error
+ e = RuntimeError.new 'foo'
+ e.set_backtrace caller
+
+ @s.error e, @req, @res
+
+ assert_equal 'text/html', @res.content_type
+ assert_equal 500, @res.status
+ assert_match %r%<title>Error%, @res.body
+ end
+
+ def test_generator_for
+ store = RDoc::Store.new
+ store.main = 'MAIN_PAGE.rdoc'
+ store.title = 'Title'
+
+ generator = @s.generator_for store
+
+ refute generator.file_output
+
+ assert_equal '..', generator.asset_rel_path
+
+ assert_equal 'MAIN_PAGE.rdoc', @s.options.main_page
+ assert_equal 'Title', @s.options.title
+
+ assert_kind_of RDoc::RDoc, store.rdoc
+ assert_same generator, store.rdoc.generator
+ end
+
+ def test_if_modified_since
+ skip 'File.utime on directory not supported' if Gem.win_platform?
+
+ temp_dir do
+ now = Time.now
+ File.utime now, now, '.'
+
+ @s.if_modified_since @req, @res, '.'
+
+ assert_equal now.to_i, Time.parse(@res['last-modified']).to_i
+ end
+ end
+
+ def test_if_modified_since_not_modified
+ skip 'File.utime on directory not supported' if Gem.win_platform?
+
+ temp_dir do
+ now = Time.now
+ File.utime now, now, '.'
+
+ @req.header['if-modified-since'] = [(now + 10).httpdate]
+
+ assert_raises WEBrick::HTTPStatus::NotModified do
+ @s.if_modified_since @req, @res, '.'
+ end
+
+ assert_equal now.to_i, Time.parse(@res['last-modified']).to_i
+ end
+ end
+
+ 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,
+ File.join(@base, 'site')],
+ ['Home Documentation', 'home/', false, :home,
+ RDoc::RI::Paths::HOMEDIR],
+ ['spec-1.0', 'spec-1.0/', false, :gem,
+ File.join(@spec.doc_dir, 'ri')],
+ ]
+
+ assert_equal expected, @s.installed_docs
+ end
+
+ def test_not_found
+ generator = @s.generator_for RDoc::Store.new
+
+ @req.path = '/ruby/Missing.html'
+
+ @s.not_found generator, @req, @res
+
+ assert_equal 404, @res.status
+ assert_match %r%<title>Not Found</title>%, @res.body
+ 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],
+ [File.join(@spec.doc_dir, 'ri'), :gem],
+ ]
+
+ assert_equal expected, paths.to_a
+ end
+
+ def test_root
+ @s.root @req, @res
+
+ assert_equal 'text/html', @res.content_type
+ assert_match %r%<title>Local RDoc Documentation</title>%, @res.body
+ end
+
+ def test_root_search
+ touch_system_cache_path
+ touch_extra_cache_path
+
+ @s.root_search @req, @res
+
+ assert_equal 'application/javascript', @res.content_type
+
+ @res.body =~ /\{.*\}/
+
+ index = JSON.parse $&
+
+ 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'],
+ ],
+ }
+ }
+
+ assert_equal expected, index
+ end
+
+ def test_show_documentation_index
+ touch_system_cache_path
+
+ @req.path = '/ruby'
+
+ @s.show_documentation @req, @res
+
+ assert_equal 'text/html', @res.content_type
+ assert_match %r%<title>Standard Library Documentation%, @res.body
+ end
+
+ def test_show_documentation_table_of_contents
+ touch_system_cache_path
+
+ @req.path = '/ruby/table_of_contents.html'
+
+ @s.show_documentation @req, @res
+
+ assert_equal 'text/html', @res.content_type
+ assert_match %r%<title>Table of Contents - Standard Library Documentation%,
+ @res.body
+ end
+
+ def test_show_documentation_page
+ touch_system_cache_path
+
+ @req.path = '/ruby/Missing.html'
+
+ @s.show_documentation @req, @res
+
+ assert_equal 404, @res.status
+ end
+
+ def test_show_documentation_search_index
+ touch_system_cache_path
+
+ @req.path = '/ruby/js/search_index.js'
+
+ @s.show_documentation @req, @res
+
+ assert_equal 'application/javascript', @res.content_type
+ assert_match %r%\Avar search_data =%, @res.body
+ 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
+ assert_equal :gem, store.type
+ end
+
+ def test_store_for_home
+ store = @s.store_for 'home'
+
+ assert_equal @home_dir, store.path
+ assert_equal :home, store.type
+ end
+
+ 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 gem "missing". Are you sure you installed it?',
+ e.message
+ end
+
+ def test_store_for_ruby
+ store = @s.store_for 'ruby'
+
+ assert_equal @system_dir, store.path
+ assert_equal :system, store.type
+ end
+
+ def test_store_for_site
+ store = @s.store_for 'site'
+
+ assert_equal File.join(@base, 'site'), store.path
+ 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'
+
+ FileUtils.mkdir_p File.dirname store.cache_path
+
+ 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 0bf08334da..7d336bedc8 100644
--- a/test/rdoc/test_rdoc_stats.rb
+++ b/test/rdoc/test_rdoc_stats.rb
@@ -1,165 +1,227 @@
-require 'rubygems'
-require 'minitest/autorun'
-require 'rdoc/stats'
-require 'rdoc/code_objects'
-require 'rdoc/markup'
-require 'rdoc/parser'
+require 'rdoc/test_case'
-class TestRDocStats < MiniTest::Unit::TestCase
+class TestRDocStats < RDoc::TestCase
def setup
- RDoc::TopLevel.reset
+ super
- @s = RDoc::Stats.new 0
+ @s = RDoc::Stats.new @store, 0
+
+ @tl = @store.add_file 'file.rb'
+ @tl.parser = RDoc::Parser::Ruby
+ end
+
+ def test_doc_stats
+ c = RDoc::CodeObject.new
+
+ assert_equal [1, 1], @s.doc_stats([c])
+ end
+
+ def test_doc_stats_documented
+ c = RDoc::CodeObject.new
+ c.comment = comment 'x'
+
+ assert_equal [1, 0], @s.doc_stats([c])
+ end
+
+ def test_doc_stats_display_eh
+ c = RDoc::CodeObject.new
+ c.ignore
+
+ assert_equal [0, 0], @s.doc_stats([c])
end
def test_report_attr
- tl = RDoc::TopLevel.new 'file.rb'
- c = tl.add_class RDoc::NormalClass, 'C'
- c.record_location tl
- c.add_comment 'C', tl
+ c = @tl.add_class RDoc::NormalClass, 'C'
+ c.record_location @tl
+ c.add_comment 'C', @tl
a = RDoc::Attr.new nil, 'a', 'RW', nil
- a.record_location tl
+ a.record_location @tl
c.add_attribute a
- RDoc::TopLevel.complete :public
+ @store.complete :public
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
def test_report_attr_documented
- tl = RDoc::TopLevel.new 'file.rb'
- c = tl.add_class RDoc::NormalClass, 'C'
- c.record_location tl
- c.add_comment 'C', tl
+ c = @tl.add_class RDoc::NormalClass, 'C'
+ c.record_location @tl
+ c.add_comment 'C', @tl
a = RDoc::Attr.new nil, 'a', 'RW', 'a'
- a.record_location tl
+ a.record_location @tl
c.add_attribute a
- RDoc::TopLevel.complete :public
+ @store.complete :public
report = @s.report
assert_equal @s.great_job, report
end
+ def test_report_attr_line
+ c = @tl.add_class RDoc::NormalClass, 'C'
+ c.record_location @tl
+ c.add_comment 'C', @tl
+
+ a = RDoc::Attr.new nil, 'a', 'RW', nil
+ a.record_location @tl
+ a.line = 3
+ c.add_attribute a
+
+ @store.complete :public
+
+ assert_match '# in file file.rb:3', @s.report.accept(to_rdoc)
+ end
+
def test_report_constant
- tl = RDoc::TopLevel.new 'file.rb'
- m = tl.add_module RDoc::NormalModule, 'M'
- m.record_location tl
- m.add_comment 'M', tl
+ m = @tl.add_module RDoc::NormalModule, 'M'
+ m.record_location @tl
+ m.add_comment 'M', @tl
c = RDoc::Constant.new 'C', nil, nil
- c.record_location tl
+ c.record_location @tl
m.add_constant c
- RDoc::TopLevel.complete :public
+ @store.complete :public
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
def test_report_constant_alias
- tl = RDoc::TopLevel.new 'file.rb'
- mod = tl.add_module RDoc::NormalModule, 'M'
+ mod = @tl.add_module RDoc::NormalModule, 'M'
- c = tl.add_class RDoc::NormalClass, 'C'
+ c = @tl.add_class RDoc::NormalClass, 'C'
mod.add_constant c
ca = RDoc::Constant.new 'CA', nil, nil
ca.is_alias_for = c
- tl.add_constant ca
+ @tl.add_constant ca
- RDoc::TopLevel.complete :public
+ @store.complete :public
report = @s.report
# 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
- tl = RDoc::TopLevel.new 'file.rb'
- m = tl.add_module RDoc::NormalModule, 'M'
- m.record_location tl
- m.comment = 'M'
+ m = @tl.add_module RDoc::NormalModule, 'M'
+ m.record_location @tl
+ m.add_comment 'M', @tl
c = RDoc::Constant.new 'C', nil, 'C'
- c.record_location tl
+ c.record_location @tl
m.add_constant c
- RDoc::TopLevel.complete :public
+ @store.complete :public
report = @s.report
assert_equal @s.great_job, report
end
+ def test_report_constant_line
+ m = @tl.add_module RDoc::NormalModule, 'M'
+ m.record_location @tl
+ m.add_comment 'M', @tl
+
+ c = RDoc::Constant.new 'C', nil, nil
+ c.record_location @tl
+ c.line = 5
+ m.add_constant c
+
+ @store.complete :public
+
+ assert_match '# in file file.rb:5', @s.report.accept(to_rdoc)
+ end
+
def test_report_class
- tl = RDoc::TopLevel.new 'file.rb'
- c = tl.add_class RDoc::NormalClass, 'C'
- c.record_location tl
+ c = @tl.add_class RDoc::NormalClass, 'C'
+ c.record_location @tl
m = RDoc::AnyMethod.new nil, 'm'
- m.record_location tl
+ m.record_location @tl
c.add_method m
m.comment = 'm'
- RDoc::TopLevel.complete :public
+ @store.complete :public
report = @s.report
- expected = <<-EXPECTED
-The following items are not documented:
+ 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)
-# in files:
-# file.rb
+ assert_equal expected, report
+ end
-class C
-end
- EXPECTED
+ def test_report_skip_object
+ c = @tl.add_class RDoc::NormalClass, 'Object'
+ c.record_location @tl
- assert_equal expected, report
+ m = RDoc::AnyMethod.new nil, 'm'
+ m.record_location @tl
+ c.add_method m
+ m.comment = 'm'
+
+ @store.complete :public
+
+ refute_match %r%^class Object$%, @s.report.accept(to_rdoc)
end
def test_report_class_documented
- tl = RDoc::TopLevel.new 'file.rb'
- c = tl.add_class RDoc::NormalClass, 'C'
- c.record_location tl
- c.add_comment 'C', tl
+ c = @tl.add_class RDoc::NormalClass, 'C'
+ c.record_location @tl
+ c.add_comment 'C', @tl
m = RDoc::AnyMethod.new nil, 'm'
- m.record_location tl
+ m.record_location @tl
c.add_method m
m.comment = 'm'
- RDoc::TopLevel.complete :public
+ @store.complete :public
report = @s.report
@@ -167,120 +229,128 @@ end
end
def test_report_class_documented_level_1
- tl = RDoc::TopLevel.new 'file.rb'
- c1 = tl.add_class RDoc::NormalClass, 'C1'
- c1.record_location tl
- c1.add_comment 'C1', tl
+ c1 = @tl.add_class RDoc::NormalClass, 'C1'
+ c1.record_location @tl
+ c1.add_comment 'C1', @tl
m1 = RDoc::AnyMethod.new nil, 'm1'
- m1.record_location tl
+ m1.record_location @tl
c1.add_method m1
m1.comment = 'm1'
- c2 = tl.add_class RDoc::NormalClass, 'C2'
- c2.record_location tl
+ c2 = @tl.add_class RDoc::NormalClass, 'C2'
+ c2.record_location @tl
m2 = RDoc::AnyMethod.new nil, 'm2'
- m2.record_location tl
+ m2.record_location @tl
c2.add_method m2
m2.comment = 'm2'
- RDoc::TopLevel.complete :public
+ @store.complete :public
@s.coverage_level = 1
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
def test_report_class_empty
- tl = RDoc::TopLevel.new 'file.rb'
- tl.add_class RDoc::NormalClass, 'C'
+ @tl.add_class RDoc::NormalClass, 'C'
- RDoc::TopLevel.complete :public
+ @store.complete :public
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
def test_report_class_empty_2
- tl = RDoc::TopLevel.new 'file.rb'
- c1 = tl.add_class RDoc::NormalClass, 'C1'
- c1.record_location tl
+ c1 = @tl.add_class RDoc::NormalClass, 'C1'
+ c1.record_location @tl
- c2 = tl.add_class RDoc::NormalClass, 'C2'
- c2.record_location tl
- c2.add_comment 'C2', tl
+ c2 = @tl.add_class RDoc::NormalClass, 'C2'
+ c2.record_location @tl
+ c2.add_comment 'C2', @tl
- RDoc::TopLevel.complete :public
+ @store.complete :public
@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
def test_report_class_method_documented
- tl = RDoc::TopLevel.new 'file.rb'
- c = tl.add_class RDoc::NormalClass, 'C'
- c.record_location tl
+ c = @tl.add_class RDoc::NormalClass, 'C'
+ c.record_location @tl
m = RDoc::AnyMethod.new nil, 'm'
- m.record_location tl
+ m.record_location @tl
c.add_method m
m.comment = 'm'
- RDoc::TopLevel.complete :public
+ @store.complete :public
report = @s.report
- expected = <<-EXPECTED
-The following items are not documented:
+ 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)
-# in files:
-# file.rb
+ assert_equal expected, report
+ end
-class C
-end
- EXPECTED
+ def test_report_class_module_ignore
+ c = @tl.add_class RDoc::NormalClass, 'C'
+ c.ignore
- assert_equal expected, report
+ @store.complete :public
+
+ report = @s.report_class_module c
+
+ assert_nil report
end
def test_report_empty
- RDoc::TopLevel.complete :public
+ @store.complete :public
report = @s.report
@@ -288,106 +358,158 @@ end
end
def test_report_method
- tl = RDoc::TopLevel.new 'file.rb'
- c = tl.add_class RDoc::NormalClass, 'C'
- c.record_location tl
- c.add_comment 'C', tl
+ c = @tl.add_class RDoc::NormalClass, 'C'
+ c.record_location @tl
+ c.add_comment 'C', @tl
m1 = RDoc::AnyMethod.new nil, 'm1'
- m1.record_location tl
+ m1.record_location @tl
c.add_method m1
m2 = RDoc::AnyMethod.new nil, 'm2'
- m2.record_location tl
+ m2.record_location @tl
c.add_method m2
m2.comment = 'm2'
- RDoc::TopLevel.complete :public
+ @store.complete :public
report = @s.report
- expected = <<-EXPECTED
-The following items are not documented:
+ 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)
-class C # is documented
+ assert_equal expected, report
+ end
- # in file file.rb
- def m1; end
+ def test_report_method_class
+ c = @tl.add_class RDoc::NormalClass, 'C'
+ c.record_location @tl
+ c.add_comment 'C', @tl
-end
- EXPECTED
+ m1 = RDoc::AnyMethod.new nil, 'm1'
+ m1.record_location @tl
+ m1.singleton = true
+ c.add_method m1
+
+ m2 = RDoc::AnyMethod.new nil, 'm2'
+ m2.record_location @tl
+ m2.singleton = true
+ c.add_method m2
+ m2.comment = 'm2'
+
+ @store.complete :public
+
+ report = @s.report
+
+ 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
def test_report_method_documented
- tl = RDoc::TopLevel.new 'file.rb'
- c = tl.add_class RDoc::NormalClass, 'C'
- c.record_location tl
- c.add_comment 'C', tl
+ c = @tl.add_class RDoc::NormalClass, 'C'
+ c.record_location @tl
+ c.add_comment 'C', @tl
m = RDoc::AnyMethod.new nil, 'm'
- m.record_location tl
+ m.record_location @tl
c.add_method m
m.comment = 'm'
- RDoc::TopLevel.complete :public
+ @store.complete :public
report = @s.report
assert_equal @s.great_job, report
end
+ def test_report_method_line
+ c = @tl.add_class RDoc::NormalClass, 'C'
+ c.record_location @tl
+ c.add_comment 'C', @tl
+
+ m1 = RDoc::AnyMethod.new nil, 'm1'
+ m1.record_location @tl
+ m1.line = 4
+ c.add_method m1
+
+ @store.complete :public
+
+ assert_match '# in file file.rb:4', @s.report.accept(to_rdoc)
+ end
+
def test_report_method_parameters
- tl = RDoc::TopLevel.new 'file.rb'
- c = tl.add_class RDoc::NormalClass, 'C'
- c.record_location tl
- c.add_comment 'C', tl
+ c = @tl.add_class RDoc::NormalClass, 'C'
+ c.record_location @tl
+ c.add_comment 'C', @tl
m1 = RDoc::AnyMethod.new nil, 'm1'
- m1.record_location tl
+ m1.record_location @tl
m1.params = '(p1, p2)'
m1.comment = 'Stuff with +p1+'
c.add_method m1
m2 = RDoc::AnyMethod.new nil, 'm2'
- m2.record_location tl
+ m2.record_location @tl
c.add_method m2
m2.comment = 'm2'
- RDoc::TopLevel.complete :public
+ @store.complete :public
@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
def test_report_method_parameters_documented
- tl = RDoc::TopLevel.new 'file.rb'
- c = tl.add_class RDoc::NormalClass, 'C'
- c.record_location tl
- c.add_comment 'C', tl
+ @tl.parser = RDoc::Parser::Ruby
+ c = @tl.add_class RDoc::NormalClass, 'C'
+ c.record_location @tl
+ c.add_comment 'C', @tl
m = RDoc::AnyMethod.new nil, 'm'
- m.record_location tl
+ m.record_location @tl
m.params = '(p1)'
m.comment = 'Stuff with +p1+'
c.add_method m
- RDoc::TopLevel.complete :public
+ @store.complete :public
@s.coverage_level = 1
report = @s.report
@@ -396,13 +518,12 @@ end
end
def test_report_method_parameters_yield
- tl = RDoc::TopLevel.new 'file.rb'
- c = tl.add_class RDoc::NormalClass, 'C'
- c.record_location tl
- c.add_comment 'C', tl
+ c = @tl.add_class RDoc::NormalClass, 'C'
+ c.record_location @tl
+ c.add_comment 'C', @tl
m = RDoc::AnyMethod.new nil, 'm'
- m.record_location tl
+ m.record_location @tl
m.call_seq = <<-SEQ
m(a) { |c| ... }
m(a, b) { |c, d| ... }
@@ -410,62 +531,63 @@ m(a, b) { |c, d| ... }
m.comment = 'Stuff with +a+, yields +c+ for you to do stuff with'
c.add_method m
- RDoc::TopLevel.complete :public
+ @store.complete :public
@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
def test_summary
- tl = RDoc::TopLevel.new 'file.rb'
- c = tl.add_class RDoc::NormalClass, 'C'
- c.record_location tl
+ c = @tl.add_class RDoc::NormalClass, 'C'
+ c.record_location @tl
- m = tl.add_module RDoc::NormalModule, 'M'
- m.record_location tl
+ m = @tl.add_module RDoc::NormalModule, 'M'
+ m.record_location @tl
a = RDoc::Attr.new nil, 'a', 'RW', nil
- a.record_location tl
+ a.record_location @tl
c.add_attribute a
c_c = RDoc::Constant.new 'C', nil, nil
- c_c.record_location tl
+ c_c.record_location @tl
c.add_constant c_c
m = RDoc::AnyMethod.new nil, 'm'
- m.record_location tl
+ m.record_location @tl
c.add_method m
- RDoc::TopLevel.complete :public
+ @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
@@ -473,28 +595,27 @@ Total: 5 (5 undocumented)
end
def test_summary_level_false
- tl = RDoc::TopLevel.new 'file.rb'
- c = tl.add_class RDoc::NormalClass, 'C'
- c.record_location tl
+ c = @tl.add_class RDoc::NormalClass, 'C'
+ c.record_location @tl
- RDoc::TopLevel.complete :public
+ @store.complete :public
@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
@@ -502,42 +623,45 @@ Total: 1 (1 undocumented)
end
def test_summary_level_1
- tl = RDoc::TopLevel.new 'file.rb'
- c = tl.add_class RDoc::NormalClass, 'C'
- c.record_location tl
- c.add_comment 'C', tl
+ c = @tl.add_class RDoc::NormalClass, 'C'
+ c.record_location @tl
+ c.add_comment 'C', @tl
m = RDoc::AnyMethod.new nil, 'm'
- m.record_location tl
+ m.record_location @tl
m.params = '(p1, p2)'
m.comment = 'Stuff with +p1+'
c.add_method m
- RDoc::TopLevel.complete :public
+ @store.complete :public
@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
new file mode 100644
index 0000000000..bd565e7149
--- /dev/null
+++ b/test/rdoc/test_rdoc_store.rb
@@ -0,0 +1,993 @@
+require File.expand_path '../xref_test_case', __FILE__
+
+class TestRDocStore < XrefTestCase
+
+ OBJECT_ANCESTORS = defined?(::BasicObject) ? %w[BasicObject] : []
+
+ def setup
+ super
+
+ @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'
+
+ @page = @s.add_file 'README.txt'
+ @page.parser = RDoc::Parser::Simple
+ @page.comment = RDoc::Comment.new 'This is a page', @page
+
+ @klass = @top_level.add_class RDoc::NormalClass, 'Object'
+ @klass.add_comment 'original', @top_level
+ @klass.record_location @top_level
+
+ @cmeth = RDoc::AnyMethod.new nil, 'cmethod'
+ @cmeth.singleton = true
+ @cmeth.record_location @top_level
+
+ @meth_comment = RDoc::Comment.new 'method comment'
+ @meth_comment.location = @top_level
+
+ @meth = RDoc::AnyMethod.new nil, 'method'
+ @meth.record_location @top_level
+ @meth.comment = @meth_comment
+
+ @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
+
+ @meth_bang.add_alias @meth_bang_alias, @klass
+
+ @attr_comment = RDoc::Comment.new 'attribute comment'
+ @attr_comment.location = @top_level
+
+ @attr = RDoc::Attr.new nil, 'attr', 'RW', ''
+ @attr.record_location @top_level
+ @attr.comment = @attr_comment
+
+ @klass.add_method @cmeth
+ @klass.add_method @meth
+ @klass.add_method @meth_bang
+ @klass.add_attribute @attr
+
+ @nest_klass = @klass.add_class RDoc::NormalClass, 'SubClass'
+ @nest_meth = RDoc::AnyMethod.new nil, 'method'
+ @nest_meth.record_location @top_level
+
+ @nest_incl = RDoc::Include.new 'Incl', ''
+ @nest_incl.record_location @top_level
+
+ @nest_klass.add_method @nest_meth
+ @nest_klass.add_include @nest_incl
+
+ @mod = @top_level.add_module RDoc::NormalModule, 'Mod'
+ @mod.record_location @top_level
+ end
+
+ def teardown
+ super
+
+ FileUtils.rm_rf @tmpdir
+ end
+
+ def assert_cache imethods, cmethods, attrs, modules,
+ ancestors = {}, pages = [], main = nil, title = nil
+ imethods ||= { 'Object' => %w[method method! method_bang] }
+ cmethods ||= { 'Object' => %w[cmethod] }
+ attrs ||= { 'Object' => ['attr_accessor attr'] }
+
+ # this is sort-of a hack
+ @s.clean_cache_collection ancestors
+
+ expected = {
+ :ancestors => ancestors,
+ :attributes => attrs,
+ :class_methods => cmethods,
+ :c_class_variables => {},
+ :c_singleton_class_variables => {},
+ :encoding => nil,
+ :instance_methods => imethods,
+ :modules => modules,
+ :pages => pages,
+ :main => main,
+ :title => title,
+ }
+
+ @s.save_cache
+
+ assert_equal expected, @s.cache
+ end
+
+ def test_add_c_enclosure
+ @s.add_c_enclosure 'cC1', @c1
+
+ expected = { 'cC1' => @c1 }
+
+ assert_equal expected, @s.c_enclosure_classes
+ end
+
+ def test_add_c_variables
+ options = RDoc::Options.new
+
+ c_file = @s.add_file 'ext.c'
+
+ some_ext = c_file.add_class RDoc::NormalClass, 'SomeExt'
+ c_file.add_class RDoc::SingleClass, 'SomeExtSingle'
+
+ c_parser = RDoc::Parser::C.new c_file, 'ext.c', '', options, nil
+
+ c_parser.classes['cSomeExt'] = some_ext
+ c_parser.singleton_classes['s_cSomeExt'] = 'SomeExtSingle'
+
+ @s.add_c_variables c_parser
+
+ expected = { 'ext.c' => { 'cSomeExt' => 'SomeExt' } }
+
+ assert_equal expected, @s.c_class_variables
+
+ expected = { 'ext.c' => { 's_cSomeExt' => 'SomeExtSingle' } }
+
+ assert_equal expected, @s.c_singleton_class_variables
+ end
+
+ def test_add_file
+ top_level = @store.add_file 'file.rb'
+
+ assert_kind_of RDoc::TopLevel, top_level
+ assert_equal @store, top_level.store
+ assert_equal 'file.rb', top_level.name
+ assert_includes @store.all_files, top_level
+
+ assert_same top_level, @store.add_file('file.rb')
+ refute_same top_level, @store.add_file('other.rb')
+ end
+
+ def test_add_file_relative
+ top_level = @store.add_file 'path/file.rb', 'file.rb'
+
+ assert_kind_of RDoc::TopLevel, top_level
+ assert_equal @store, top_level.store
+
+ assert_equal 'path/file.rb', top_level.absolute_name
+ assert_equal 'file.rb', top_level.relative_name
+
+ assert_includes @store.all_files, top_level
+
+ assert_same top_level, @store.add_file('file.rb')
+ refute_same top_level, @store.add_file('other.rb')
+ end
+
+ def test_all_classes_and_modules
+ expected = %w[
+ C1 C2 C2::C3 C2::C3::H1 C3 C3::H1 C3::H2 C4 C4::C4 C5 C5::C1
+ Child
+ M1 M1::M2
+ Parent
+ ]
+
+ assert_equal expected,
+ @store.all_classes_and_modules.map { |m| m.full_name }.sort
+ end
+
+ def test_all_files
+ assert_equal %w[xref_data.rb],
+ @store.all_files.map { |m| m.full_name }.sort
+ end
+
+ def test_all_modules
+ assert_equal %w[M1 M1::M2],
+ @store.all_modules.map { |m| m.full_name }.sort
+ end
+
+ def test_attributes
+ @s.cache[:attributes]['Object'] = %w[attr]
+
+ expected = { 'Object' => %w[attr] }
+
+ assert_equal expected, @s.attributes
+ end
+
+ def test_class_file
+ assert_equal File.join(@tmpdir, 'Object', 'cdesc-Object.ri'),
+ @s.class_file('Object')
+ assert_equal File.join(@tmpdir, 'Object', 'SubClass', 'cdesc-SubClass.ri'),
+ @s.class_file('Object::SubClass')
+ end
+
+ def test_class_methods
+ @s.cache[:class_methods]['Object'] = %w[method]
+
+ expected = { 'Object' => %w[method] }
+
+ assert_equal expected, @s.class_methods
+ end
+
+ def test_class_path
+ assert_equal File.join(@tmpdir, 'Object'), @s.class_path('Object')
+ assert_equal File.join(@tmpdir, 'Object', 'SubClass'),
+ @s.class_path('Object::SubClass')
+ end
+
+ def test_classes
+ expected = %w[
+ C1 C2 C2::C3 C2::C3::H1 C3 C3::H1 C3::H2 C4 C4::C4 C5 C5::C1
+ Child
+ Parent
+ ]
+
+ assert_equal expected, @store.all_classes.map { |m| m.full_name }.sort
+ end
+
+ def test_complete
+ @c2.add_module_alias @c2_c3, 'A1', @top_level
+
+ @store.complete :public
+
+ a1 = @xref_data.find_class_or_module 'C2::A1'
+
+ assert_equal 'C2::A1', a1.full_name
+ 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'
+
+ @s.add_c_enclosure 'cC1', @c1
+
+ assert_equal @c1, @s.find_c_enclosure('cC1')
+ end
+
+ def test_find_c_enclosure_from_cache
+ @s.save_class @klass
+ @s.classes_hash.clear
+
+ assert_nil @s.find_c_enclosure 'cObject'
+
+ @s.c_enclosure_names['cObject'] = 'Object'
+
+ klass = @s.find_c_enclosure('cObject')
+ assert_equal @klass, klass
+
+ assert_empty klass.comment_location
+ assert_equal @top_level, klass.parent
+
+ assert_includes @s.c_enclosure_classes, 'cObject'
+ end
+
+ def test_find_c_enclosure_from_cache_legacy
+ @klass.in_files.clear
+ @s.save_class @klass
+ @s.classes_hash.clear
+
+ assert_nil @s.find_c_enclosure 'cObject'
+
+ @s.c_enclosure_names['cObject'] = 'Object'
+
+ assert_nil @s.find_c_enclosure('cObject')
+ end
+
+ def test_find_class_named
+ assert_equal @c1, @store.find_class_named('C1')
+
+ assert_equal @c2_c3, @store.find_class_named('C2::C3')
+ end
+
+ def test_find_class_named_from
+ assert_equal @c5_c1, @store.find_class_named_from('C1', 'C5')
+
+ assert_equal @c1, @store.find_class_named_from('C1', 'C4')
+ end
+
+ def test_find_class_or_module
+ assert_equal @m1, @store.find_class_or_module('M1')
+ assert_equal @c1, @store.find_class_or_module('C1')
+
+ assert_equal @m1, @store.find_class_or_module('::M1')
+ assert_equal @c1, @store.find_class_or_module('::C1')
+ end
+
+ def test_find_file_named
+ assert_equal @xref_data, @store.find_file_named(@file_name)
+ end
+
+ def test_find_module_named
+ assert_equal @m1, @store.find_module_named('M1')
+ assert_equal @m1_m2, @store.find_module_named('M1::M2')
+ end
+
+ def test_find_text_page
+ page = @store.add_file 'PAGE.txt'
+ page.parser = RDoc::Parser::Simple
+
+ assert_nil @store.find_text_page 'no such page'
+
+ assert_equal page, @store.find_text_page('PAGE.txt')
+ end
+
+ def test_friendly_path
+ @s.path = @tmpdir
+ @s.type = nil
+ assert_equal @s.path, @s.friendly_path
+
+ @s.type = :extra
+ assert_equal @s.path, @s.friendly_path
+
+ @s.type = :system
+ assert_equal "ruby core", @s.friendly_path
+
+ @s.type = :site
+ assert_equal "ruby site", @s.friendly_path
+
+ @s.type = :home
+ assert_equal "~/.rdoc", @s.friendly_path
+
+ @s.type = :gem
+ @s.path = "#{@tmpdir}/gem_repository/doc/gem_name-1.0/ri"
+ assert_equal "gem gem_name-1.0", @s.friendly_path
+ end
+
+ def test_dry_run
+ refute @s.dry_run
+
+ @s.dry_run = true
+
+ assert @s.dry_run
+ end
+
+ def test_instance_methods
+ @s.cache[:instance_methods]['Object'] = %w[method]
+
+ expected = { 'Object' => %w[method] }
+
+ assert_equal expected, @s.instance_methods
+ end
+
+ def test_load_all
+ FileUtils.mkdir_p @tmpdir
+
+ @s.save
+
+ s = RDoc::Store.new @tmpdir
+
+ s.load_all
+
+ assert_equal [@klass, @nest_klass], s.all_classes.sort
+ assert_equal [@mod], s.all_modules.sort
+ assert_equal [@page, @top_level], s.all_files.sort
+
+ methods = s.all_classes_and_modules.map do |mod|
+ mod.method_list
+ end.flatten.sort
+
+ _meth_bang_alias = RDoc::AnyMethod.new nil, 'method_bang'
+ _meth_bang_alias.parent = @klass
+
+ assert_equal [@meth, @meth_bang, _meth_bang_alias, @nest_meth, @cmeth],
+ methods.sort_by { |m| m.full_name }
+
+ method = methods.find { |m| m == @meth }
+ assert_equal @meth_comment.parse, method.comment
+
+ assert_equal @klass, methods.last.parent
+
+ attributes = s.all_classes_and_modules.map do |mod|
+ mod.attributes
+ end.flatten.sort
+
+ assert_equal [@attr], attributes
+
+ assert_equal @attr_comment.parse, attributes.first.comment
+ end
+
+ def test_load_cache
+ cache = {
+ :c_class_variables =>
+ { 'file.c' => { 'cKlass' => 'Klass' } },
+ :c_singleton_class_variables =>
+ { 'file.c' => { 'sKlass' => 'KlassSingle' } },
+ :encoding => :encoding_value,
+ :methods => { "Object" => %w[Object#method] },
+ :main => @page.full_name,
+ :modules => %w[Object],
+ :pages => [],
+ }
+
+ Dir.mkdir @tmpdir
+
+ open File.join(@tmpdir, 'cache.ri'), 'wb' do |io|
+ Marshal.dump cache, io
+ end
+
+ @s.load_cache
+
+ assert_equal cache, @s.cache
+
+ assert_equal :encoding_value, @s.encoding
+ assert_equal 'README.txt', @s.main
+
+ expected = { 'file.c' => { 'cKlass' => 'Klass' } }
+ assert_equal expected, @s.cache[:c_class_variables]
+
+ expected = { 'file.c' => { 'sKlass' => 'KlassSingle' } }
+ assert_equal expected, @s.cache[:c_singleton_class_variables]
+
+ expected = { 'cKlass' => 'Klass' }
+ assert_equal expected, @s.c_enclosure_names
+ end
+
+ def test_load_cache_encoding_differs
+ skip "Encoding not implemented" unless Object.const_defined? :Encoding
+
+ cache = {
+ :c_class_variables => {},
+ :c_singleton_class_variables => {},
+ :encoding => Encoding::ISO_8859_1,
+ :main => nil,
+ :methods => { "Object" => %w[Object#method] },
+ :modules => %w[Object],
+ :pages => [],
+ }
+
+ Dir.mkdir @tmpdir
+
+ open File.join(@tmpdir, 'cache.ri'), 'wb' do |io|
+ Marshal.dump cache, io
+ end
+
+ @s.encoding = Encoding::UTF_8
+
+ @s.load_cache
+
+ assert_equal cache, @s.cache
+
+ assert_equal Encoding::UTF_8, @s.encoding
+ end
+
+ def test_load_cache_no_cache
+ cache = {
+ :ancestors => {},
+ :attributes => {},
+ :class_methods => {},
+ :c_class_variables => {},
+ :c_singleton_class_variables => {},
+ :encoding => nil,
+ :instance_methods => {},
+ :main => nil,
+ :modules => [],
+ :pages => [],
+ :title => nil,
+ }
+
+ @s.load_cache
+
+ assert_equal cache, @s.cache
+ end
+
+ def test_load_cache_legacy
+ cache = {
+ :ancestors => {},
+ :attributes => {},
+ :class_methods => {},
+ :encoding => :encoding_value,
+ :instance_methods => { "Object" => %w[Object#method] },
+ :modules => %w[Object],
+ # no :pages
+ # no :main
+ # no :c_class_variables
+ # no :c_singleton_class_variables
+ }
+
+ Dir.mkdir @tmpdir
+
+ open File.join(@tmpdir, 'cache.ri'), 'wb' do |io|
+ Marshal.dump cache, io
+ end
+
+ @s.load_cache
+
+ expected = {
+ :ancestors => {},
+ :attributes => {},
+ :class_methods => {},
+ :c_class_variables => {},
+ :c_singleton_class_variables => {},
+ :encoding => :encoding_value,
+ :instance_methods => { "Object" => %w[Object#method] },
+ :main => nil,
+ :modules => %w[Object],
+ :pages => [],
+ }
+
+ assert_equal expected, @s.cache
+
+ assert_equal :encoding_value, @s.encoding
+ assert_nil @s.main
+ end
+
+ def test_load_class
+ @s.save_class @klass
+ @s.classes_hash.clear
+
+ assert_equal @klass, @s.load_class('Object')
+
+ assert_includes @s.classes_hash, 'Object'
+ end
+
+ def test_load_method
+ @s.save_method @klass, @meth_bang
+
+ meth = @s.load_method('Object', '#method!')
+ assert_equal @meth_bang, meth
+ assert_equal @klass, meth.parent
+ assert_equal @s, meth.store
+ end
+
+ def test_load_method_legacy
+ @s.save_method @klass, @meth
+
+ file = @s.method_file @klass.full_name, @meth.full_name
+
+ open file, 'wb' do |io|
+ io.write "\x04\bU:\x14RDoc::AnyMethod[\x0Fi\x00I" +
+ "\"\vmethod\x06:\x06EF\"\x11Klass#method0:\vpublic" +
+ "o:\eRDoc::Markup::Document\x06:\v@parts[\x06" +
+ "o:\x1CRDoc::Markup::Paragraph\x06;\t[\x06I" +
+ "\"\x16this is a comment\x06;\x06FI" +
+ "\"\rcall_seq\x06;\x06FI\"\x0Fsome_block\x06;\x06F" +
+ "[\x06[\aI\"\faliased\x06;\x06Fo;\b\x06;\t[\x06" +
+ "o;\n\x06;\t[\x06I\"\x12alias comment\x06;\x06FI" +
+ "\"\nparam\x06;\x06F"
+ end
+
+ meth = @s.load_method('Object', '#method')
+ assert_equal 'Klass#method', meth.full_name
+ assert_equal @klass, meth.parent
+ assert_equal @s, meth.store
+ end
+
+ def test_load_page
+ @s.save_page @page
+
+ assert_equal @page, @s.load_page('README.txt')
+ end
+
+ def test_main
+ assert_equal nil, @s.main
+
+ @s.main = 'README.txt'
+
+ assert_equal 'README.txt', @s.main
+ end
+
+ def test_method_file
+ assert_equal File.join(@tmpdir, 'Object', 'method-i.ri'),
+ @s.method_file('Object', 'Object#method')
+
+ assert_equal File.join(@tmpdir, 'Object', 'method%21-i.ri'),
+ @s.method_file('Object', 'Object#method!')
+
+ assert_equal File.join(@tmpdir, 'Object', 'SubClass', 'method%21-i.ri'),
+ @s.method_file('Object::SubClass', 'Object::SubClass#method!')
+
+ assert_equal File.join(@tmpdir, 'Object', 'method-c.ri'),
+ @s.method_file('Object', 'Object::method')
+ end
+
+ def test_module_names
+ @s.save_class @klass
+
+ assert_equal %w[Object], @s.module_names
+ end
+
+ def test_page
+ page = @store.add_file 'PAGE.txt'
+ page.parser = RDoc::Parser::Simple
+
+ assert_nil @store.page 'no such page'
+
+ assert_equal page, @store.page('PAGE')
+ end
+
+ def test_save
+ FileUtils.mkdir_p @tmpdir
+
+ @s.save
+
+ assert_directory File.join(@tmpdir, 'Object')
+
+ assert_file File.join(@tmpdir, 'Object', 'cdesc-Object.ri')
+ assert_file File.join(@tmpdir, 'Object', 'method-i.ri')
+ assert_file File.join(@tmpdir, 'page-README_txt.ri')
+
+ assert_file File.join(@tmpdir, 'cache.ri')
+
+ expected = {
+ :ancestors => {
+ 'Object::SubClass' => %w[Incl Object],
+ },
+ :attributes => { 'Object' => ['attr_accessor attr'] },
+ :class_methods => { 'Object' => %w[cmethod] },
+ :c_class_variables => {},
+ :c_singleton_class_variables => {},
+ :instance_methods => {
+ 'Object' => %w[attr method method! method_bang],
+ 'Object::SubClass' => %w[method],
+ },
+ :main => nil,
+ :modules => %w[Mod Object Object::SubClass],
+ :encoding => nil,
+ :pages => %w[README.txt],
+ :title => nil,
+ }
+
+ expected[:ancestors]['Object'] = %w[BasicObject] if defined?(::BasicObject)
+
+ open File.join(@tmpdir, 'cache.ri'), 'rb' do |io|
+ cache = Marshal.load io.read
+
+ assert_equal expected, cache
+ end
+ end
+
+ def test_save_cache
+ @s.save_class @klass
+ @s.save_method @klass, @meth
+ @s.save_method @klass, @cmeth
+ @s.save_class @nest_klass
+ @s.save_page @page
+ @s.encoding = :encoding_value
+ @s.main = @page.full_name
+ @s.title = 'title'
+
+ options = RDoc::Options.new
+
+ c_file = @s.add_file 'ext.c'
+
+ some_ext = c_file.add_class RDoc::NormalClass, 'SomeExt'
+ c_file.add_class RDoc::SingleClass, 'SomeExtSingle'
+
+ c_parser = RDoc::Parser::C.new c_file, 'ext.c', '', options, nil
+
+ c_parser.classes['cSomeExt'] = some_ext
+ c_parser.singleton_classes['s_cSomeExt'] = 'SomeExtSingle'
+
+ @s.add_c_variables c_parser
+
+ @s.save_cache
+
+ assert_file File.join(@tmpdir, 'cache.ri')
+
+ c_class_variables = {
+ 'ext.c' => {
+ 'cSomeExt' => 'SomeExt'
+ }
+ }
+
+ c_singleton_class_variables = {
+ 'ext.c' => {
+ 's_cSomeExt' => 'SomeExtSingle'
+ }
+ }
+
+ expected = {
+ :ancestors => {
+ 'Object::SubClass' => %w[Incl Object],
+ },
+ :attributes => { 'Object' => ['attr_accessor attr'] },
+ :class_methods => { 'Object' => %w[cmethod] },
+ :c_class_variables => c_class_variables,
+ :c_singleton_class_variables => c_singleton_class_variables,
+ :instance_methods => {
+ 'Object' => %w[method method! method_bang],
+ 'Object::SubClass' => %w[method],
+ },
+ :main => @page.full_name,
+ :modules => %w[Object Object::SubClass],
+ :encoding => :encoding_value,
+ :pages => %w[README.txt],
+ :title => 'title',
+ }
+
+ expected[:ancestors]['Object'] = %w[BasicObject] if defined?(::BasicObject)
+
+ open File.join(@tmpdir, 'cache.ri'), 'rb' do |io|
+ cache = Marshal.load io.read
+
+ assert_equal expected, cache
+ end
+ end
+
+ def test_save_cache_dry_run
+ @s.dry_run = true
+
+ @s.save_class @klass
+ @s.save_method @klass, @meth
+ @s.save_method @klass, @cmeth
+ @s.save_class @nest_klass
+
+ @s.save_cache
+
+ refute_file File.join(@tmpdir, 'cache.ri')
+ end
+
+ def test_save_cache_duplicate_methods
+ @s.save_method @klass, @meth
+ @s.save_method @klass, @meth
+
+ @s.save_cache
+
+ assert_cache({ 'Object' => %w[method] }, {}, {}, [])
+ end
+
+ def test_save_cache_duplicate_pages
+ @s.save_page @page
+ @s.save_page @page
+
+ @s.save_cache
+
+ assert_cache({}, {}, {}, [], {}, %w[README.txt])
+ end
+
+ def test_save_class
+ @s.save_class @klass
+
+ assert_directory File.join(@tmpdir, 'Object')
+ assert_file File.join(@tmpdir, 'Object', 'cdesc-Object.ri')
+
+ assert_cache nil, nil, nil, %w[Object], 'Object' => OBJECT_ANCESTORS
+
+ assert_equal @klass, @s.load_class('Object')
+ end
+
+ def test_save_class_basic_object
+ @klass.instance_variable_set :@superclass, nil
+
+ @s.save_class @klass
+
+ assert_directory File.join(@tmpdir, 'Object')
+ assert_file File.join(@tmpdir, 'Object', 'cdesc-Object.ri')
+
+ assert_cache(nil, nil, nil, %w[Object])
+
+ assert_equal @klass, @s.load_class('Object')
+ end
+
+ def test_save_class_delete
+ # save original
+ @s.save_class @klass
+ @s.save_method @klass, @meth
+ @s.save_method @klass, @meth_bang
+ @s.save_method @klass, @cmeth
+ @s.save_method @klass, @attr
+ @s.save_cache
+
+ klass = RDoc::NormalClass.new 'Object'
+
+ meth = klass.add_method RDoc::AnyMethod.new(nil, 'replace')
+ meth.record_location @top_level
+
+ # load original, save newly updated class
+ @s = RDoc::RI::Store.new @tmpdir
+ @s.load_cache
+ @s.save_class klass
+ @s.save_cache
+
+ # load from disk again
+ @s = RDoc::RI::Store.new @tmpdir
+ @s.load_cache
+
+ @s.load_class 'Object'
+
+ assert_cache({ 'Object' => %w[replace] }, {},
+ { 'Object' => %w[attr_accessor\ attr] }, %w[Object],
+ 'Object' => OBJECT_ANCESTORS)
+
+ # assert these files were deleted
+ refute_file @s.method_file(@klass.full_name, @meth.full_name)
+ refute_file @s.method_file(@klass.full_name, @meth_bang.full_name)
+ refute_file @s.method_file(@klass.full_name, @cmeth.full_name)
+
+ # assert these files were not deleted
+ assert_file @s.method_file(@klass.full_name, @attr.full_name)
+ end
+
+ def test_save_class_dry_run
+ @s.dry_run = true
+
+ @s.save_class @klass
+
+ refute_file File.join(@tmpdir, 'Object')
+ refute_file File.join(@tmpdir, 'Object', 'cdesc-Object.ri')
+ end
+
+ def test_save_class_loaded
+ @s.save
+
+ assert_directory File.join(@tmpdir, 'Object')
+ assert_file File.join(@tmpdir, 'Object', 'cdesc-Object.ri')
+
+ assert_file @s.method_file(@klass.full_name, @attr.full_name)
+ assert_file @s.method_file(@klass.full_name, @cmeth.full_name)
+ assert_file @s.method_file(@klass.full_name, @meth.full_name)
+ assert_file @s.method_file(@klass.full_name, @meth_bang.full_name)
+
+ s = RDoc::Store.new @s.path
+ s.load_cache
+
+ loaded = s.load_class 'Object'
+
+ assert_equal @klass, loaded
+
+ s.save_class loaded
+
+ s = RDoc::Store.new @s.path
+ s.load_cache
+
+ reloaded = s.load_class 'Object'
+
+ assert_equal @klass, reloaded
+
+ # assert these files were not deleted. Bug #171
+ assert_file s.method_file(@klass.full_name, @attr.full_name)
+ assert_file s.method_file(@klass.full_name, @cmeth.full_name)
+ assert_file s.method_file(@klass.full_name, @meth.full_name)
+ assert_file s.method_file(@klass.full_name, @meth_bang.full_name)
+ end
+
+ def test_save_class_merge
+ @s.save_class @klass
+
+ klass = RDoc::NormalClass.new 'Object'
+ klass.add_comment 'new comment', @top_level
+
+ s = RDoc::RI::Store.new @tmpdir
+ s.save_class klass
+
+ s = RDoc::RI::Store.new @tmpdir
+
+ inner = @RM::Document.new @RM::Paragraph.new 'new comment'
+ inner.file = @top_level
+
+ document = @RM::Document.new inner
+
+ assert_equal document, s.load_class('Object').comment_location
+ end
+
+ # This is a functional test
+ def test_save_class_merge_constant
+ store = RDoc::Store.new
+ tl = store.add_file 'file.rb'
+
+ klass = tl.add_class RDoc::NormalClass, 'C'
+ klass.add_comment 'comment', tl
+
+ const = klass.add_constant RDoc::Constant.new('CONST', nil, nil)
+ const.record_location tl
+
+ @s.save_class klass
+
+ # separate parse run, independent store
+ store = RDoc::Store.new
+ tl = store.add_file 'file.rb'
+ klass2 = tl.add_class RDoc::NormalClass, 'C'
+ klass2.record_location tl
+
+ s = RDoc::RI::Store.new @tmpdir
+ s.save_class klass2
+
+ # separate `ri` run, independent store
+ s = RDoc::RI::Store.new @tmpdir
+
+ result = s.load_class 'C'
+
+ assert_empty result.constants
+ end
+
+ def test_save_class_methods
+ @s.save_class @klass
+
+ assert_directory File.join(@tmpdir, 'Object')
+ assert_file File.join(@tmpdir, 'Object', 'cdesc-Object.ri')
+
+ assert_cache nil, nil, nil, %w[Object], 'Object' => OBJECT_ANCESTORS
+
+ assert_equal @klass, @s.load_class('Object')
+ end
+
+ def test_save_class_nested
+ @s.save_class @nest_klass
+
+ assert_directory File.join(@tmpdir, 'Object', 'SubClass')
+ assert_file File.join(@tmpdir, 'Object', 'SubClass', 'cdesc-SubClass.ri')
+
+ assert_cache({ 'Object::SubClass' => %w[method] }, {}, {},
+ %w[Object::SubClass], 'Object::SubClass' => %w[Incl Object])
+ end
+
+ def test_save_method
+ @s.save_method @klass, @meth
+
+ assert_directory File.join(@tmpdir, 'Object')
+ assert_file File.join(@tmpdir, 'Object', 'method-i.ri')
+
+ assert_cache({ 'Object' => %w[method] }, {}, {}, [])
+
+ assert_equal @meth, @s.load_method('Object', '#method')
+ end
+
+ def test_save_method_dry_run
+ @s.dry_run = true
+
+ @s.save_method @klass, @meth
+
+ refute_file File.join(@tmpdir, 'Object')
+ refute_file File.join(@tmpdir, 'Object', 'method-i.ri')
+ end
+
+ def test_save_method_nested
+ @s.save_method @nest_klass, @nest_meth
+
+ assert_directory File.join(@tmpdir, 'Object', 'SubClass')
+ assert_file File.join(@tmpdir, 'Object', 'SubClass', 'method-i.ri')
+
+ assert_cache({ 'Object::SubClass' => %w[method] }, {}, {}, [])
+ end
+
+ def test_save_page
+ @s.save_page @page
+
+ assert_file File.join(@tmpdir, 'page-README_txt.ri')
+
+ assert_cache({}, {}, {}, [], {}, %w[README.txt])
+ end
+
+ def test_save_page_file
+ @s.save_page @top_level
+
+ refute_file File.join(@tmpdir, 'page-file_rb.ri')
+ end
+
+ def test_source
+ @s.path = @tmpdir
+ @s.type = nil
+ assert_equal @s.path, @s.source
+
+ @s.type = :extra
+ assert_equal @s.path, @s.source
+
+ @s.type = :system
+ assert_equal "ruby", @s.source
+
+ @s.type = :site
+ assert_equal "site", @s.source
+
+ @s.type = :home
+ assert_equal "home", @s.source
+
+ @s.type = :gem
+ @s.path = "#{@tmpdir}/gem_repository/doc/gem_name-1.0/ri"
+ assert_equal "gem_name-1.0", @s.source
+ end
+
+ def test_title
+ assert_equal nil, @s.title
+
+ @s.title = 'rdoc'
+
+ assert_equal 'rdoc', @s.title
+ end
+
+end
+
diff --git a/test/rdoc/test_rdoc_task.rb b/test/rdoc/test_rdoc_task.rb
index c17a5c8b38..8faf3f7d92 100644
--- a/test/rdoc/test_rdoc_task.rb
+++ b/test/rdoc/test_rdoc_task.rb
@@ -1,10 +1,11 @@
-require 'rubygems'
-require 'minitest/autorun'
-require 'rdoc/task'
+require 'rdoc/test_case'
+require 'rake'
-class TestRDocTask < MiniTest::Unit::TestCase
+class TestRDocTask < RDoc::TestCase
def setup
+ super
+
Rake::Task.clear
@t = RDoc::Task.new
@@ -15,13 +16,13 @@ class TestRDocTask < MiniTest::Unit::TestCase
end
def test_inline_source
- _, err = capture_io do
+ _, err = verbose_capture_io do
assert @t.inline_source
end
assert_equal "RDoc::Task#inline_source is deprecated\n", err
- _, err = capture_io do
+ _, err = verbose_capture_io do
@t.inline_source = false
end
@@ -32,6 +33,14 @@ class TestRDocTask < MiniTest::Unit::TestCase
end
end
+ def test_markup_option
+ rdoc_task = RDoc::Task.new do |rd|
+ rd.markup = "tomdoc"
+ end
+
+ assert_equal %w[-o html --markup tomdoc], rdoc_task.option_list
+ end
+
def test_tasks_creation
RDoc::Task.new
assert Rake::Task[:rdoc]
diff --git a/test/rdoc/test_rdoc_text.rb b/test/rdoc/test_rdoc_text.rb
index e11c995e59..b0c464a659 100644
--- a/test/rdoc/test_rdoc_text.rb
+++ b/test/rdoc/test_rdoc_text.rb
@@ -1,16 +1,19 @@
# coding: utf-8
-require 'rubygems'
-require 'minitest/autorun'
-require 'rdoc'
-require 'rdoc/text'
-require 'rdoc/markup'
-require 'rdoc/markup/formatter'
+require 'rdoc/test_case'
-class TestRDocText < MiniTest::Unit::TestCase
+class TestRDocText < RDoc::TestCase
include RDoc::Text
+ def setup
+ super
+
+ @options = RDoc::Options.new
+
+ @top_level = @store.add_file 'file.rb'
+ end
+
def test_self_encode_fallback
skip "Encoding not implemented" unless Object.const_defined? :Encoding
@@ -110,13 +113,19 @@ The comments associated with
assert_equal Encoding::US_ASCII, result.encoding
end
- def test_markup
- def formatter() RDoc::Markup::ToHtml.new end
+ def test_markup_string
+ out = markup('hi').gsub("\n", '')
+
+ assert_equal '<p>hi</p>', out
+ end
+
+ def test_markup_comment
+ out = markup(comment('hi')).gsub("\n", '')
- assert_equal "<p>hi</p>", markup('hi').gsub("\n", '')
+ assert_equal '<p>hi</p>', out
end
- def test_normalize_comment
+ def test_normalize_comment_hash
text = <<-TEXT
##
# we don't worry too much.
@@ -133,10 +142,57 @@ The comments associated with
assert_equal expected, normalize_comment(text)
end
+ def test_normalize_comment_stars_single_space
+ text = <<-TEXT
+/*
+ * we don't worry too much.
+ *
+ * The comments associated with
+ */
+ TEXT
+
+ expected = <<-EXPECTED.rstrip
+we don't worry too much.
+
+The comments associated with
+ EXPECTED
+
+ assert_equal expected, normalize_comment(text)
+ end
+
+ def test_normalize_comment_stars_single_double_space
+ text = <<-TEXT
+/*
+ * we don't worry too much.
+ *
+ * The comments associated with
+ */
+ TEXT
+
+ expected = <<-EXPECTED.rstrip
+we don't worry too much.
+
+The comments associated with
+ EXPECTED
+
+ assert_equal expected, normalize_comment(text)
+ end
+
def test_parse
assert_kind_of RDoc::Markup::Document, parse('hi')
end
+ def test_parse_comment
+ expected = RDoc::Markup::Document.new
+ expected.file = @top_level
+
+ c = comment ''
+ parsed = parse c
+
+ assert_equal expected, parsed
+ assert_same parsed, parse(c)
+ end
+
def test_parse_document
assert_equal RDoc::Markup::Document.new, parse(RDoc::Markup::Document.new)
end
@@ -149,10 +205,81 @@ The comments associated with
assert_equal RDoc::Markup::Document.new, parse("#\n")
end
+ def test_parse_format_markdown
+ expected =
+ @RM::Document.new(
+ @RM::Paragraph.new('it _works_'))
+
+ parsed = parse 'it *works*', 'markdown'
+
+ assert_equal expected, parsed
+ end
+
+ def test_parse_format_rd
+ expected =
+ @RM::Document.new(
+ @RM::Paragraph.new('it <em>works</em>'))
+
+ parsed = parse 'it ((*works*))', 'rd'
+
+ assert_equal expected, parsed
+ end
+
+ def test_parse_format_tomdoc
+ code = verb('1 + 1')
+ code.format = :ruby
+
+ expected =
+ doc(
+ para('It does a thing'),
+ blank_line,
+ head(3, 'Examples'),
+ blank_line,
+ code)
+
+ text = <<-TOMDOC
+It does a thing
+
+Examples
+
+ 1 + 1
+ TOMDOC
+
+ parsed = parse text, 'tomdoc'
+
+ assert_equal expected, parsed
+ end
+
def test_parse_newline
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 = <<-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
##
@@ -309,6 +436,24 @@ The comments associated with
assert_equal Encoding::BINARY, result.encoding
end
+ def test_strip_stars_no_stars
+ text = <<-TEXT
+* we don't worry too much.
+
+The comments associated with
+
+ TEXT
+
+ expected = <<-EXPECTED
+* we don't worry too much.
+
+The comments associated with
+
+ EXPECTED
+
+ assert_equal expected, strip_stars(text)
+ end
+
def test_to_html_apostrophe
assert_equal '‘a', to_html("'a")
assert_equal 'a’', to_html("a'")
@@ -320,6 +465,10 @@ The comments associated with
assert_equal 'S', to_html('\\S')
end
+ def test_to_html_br
+ assert_equal '<br>', to_html('<br>')
+ end
+
def test_to_html_copyright
assert_equal '©', to_html('(c)')
end
@@ -386,12 +535,20 @@ The comments associated with
end
def test_to_html_tt_tag_mismatch
- _, err = capture_io do
+ _, err = verbose_capture_io do
assert_equal '<tt>hi', to_html('<tt>hi')
end
assert_equal "mismatched <tt> tag\n", err
end
+ def formatter
+ RDoc::Markup::ToHtml.new @options
+ end
+
+ def options
+ @options
+ end
+
end
diff --git a/test/rdoc/test_rdoc_token_stream.rb b/test/rdoc/test_rdoc_token_stream.rb
new file mode 100644
index 0000000000..3c1a225c25
--- /dev/null
+++ b/test/rdoc/test_rdoc_token_stream.rb
@@ -0,0 +1,42 @@
+require 'rdoc/test_case'
+
+class TestRDocTokenStream < RDoc::TestCase
+
+ def test_class_to_html
+ tokens = [
+ RDoc::RubyToken::TkCONSTANT. new(0, 0, 0, 'CONSTANT'),
+ RDoc::RubyToken::TkDEF. new(0, 0, 0, 'KW'),
+ RDoc::RubyToken::TkIVAR. new(0, 0, 0, 'IVAR'),
+ RDoc::RubyToken::TkOp. new(0, 0, 0, 'Op'),
+ RDoc::RubyToken::TkId. new(0, 0, 0, 'Id'),
+ RDoc::RubyToken::TkNode. new(0, 0, 0, 'Node'),
+ RDoc::RubyToken::TkCOMMENT. new(0, 0, 0, 'COMMENT'),
+ RDoc::RubyToken::TkREGEXP. new(0, 0, 0, 'REGEXP'),
+ RDoc::RubyToken::TkSTRING. new(0, 0, 0, 'STRING'),
+ RDoc::RubyToken::TkVal. new(0, 0, 0, 'Val'),
+ RDoc::RubyToken::TkBACKSLASH.new(0, 0, 0, '\\'),
+ ]
+
+ expected = [
+ '<span class="ruby-constant">CONSTANT</span>',
+ '<span class="ruby-keyword">KW</span>',
+ '<span class="ruby-ivar">IVAR</span>',
+ '<span class="ruby-operator">Op</span>',
+ '<span class="ruby-identifier">Id</span>',
+ '<span class="ruby-node">Node</span>',
+ '<span class="ruby-comment">COMMENT</span>',
+ '<span class="ruby-regexp">REGEXP</span>',
+ '<span class="ruby-string">STRING</span>',
+ '<span class="ruby-value">Val</span>',
+ '\\'
+ ].join
+
+ assert_equal expected, RDoc::TokenStream.to_html(tokens)
+ end
+
+ def test_class_to_html_empty
+ assert_equal '', RDoc::TokenStream.to_html([])
+ end
+
+end
+
diff --git a/test/rdoc/test_rdoc_tom_doc.rb b/test/rdoc/test_rdoc_tom_doc.rb
new file mode 100644
index 0000000000..63d3a5e79e
--- /dev/null
+++ b/test/rdoc/test_rdoc_tom_doc.rb
@@ -0,0 +1,520 @@
+require 'rdoc/test_case'
+
+class TestRDocTomDoc < RDoc::TestCase
+
+ def setup
+ super
+
+ @top_level = @store.add_file 'file.rb'
+
+ @TD = RDoc::TomDoc
+ @td = @TD.new
+ end
+
+ def test_class_add_post_processor
+ RDoc::TomDoc.add_post_processor
+
+ pp = RDoc::Markup::PreProcess.new __FILE__, []
+
+ text = "# Public: Do some stuff\n"
+
+ comment = RDoc::Comment.new text, nil
+ comment.format = 'tomdoc'
+
+ parent = RDoc::Context.new
+
+ pp.handle comment, parent
+
+ method = parent.add_method RDoc::AnyMethod.new(nil, 'm')
+
+ assert_equal 'Public', method.section.title
+ assert_equal "# Do some stuff\n", comment.text
+ end
+
+ def test_class_signature
+ c = comment <<-COMMENT
+Signature
+
+ method_<here>(args)
+
+here - something
+ COMMENT
+ c.format = 'tomdoc'
+
+ signature = @TD.signature c
+
+ assert_equal "method_<here>(args)\n", signature
+ end
+
+ def test_class_signature_no_space
+ c = comment <<-COMMENT
+Signature
+ method_<here>(args)
+
+here - something
+ COMMENT
+ c.format = 'tomdoc'
+
+ signature = @TD.signature c
+
+ assert_equal "method_<here>(args)\n", signature
+
+ expected =
+ doc(
+ head(3, 'Signature'),
+ list(:NOTE,
+ item(%w[here],
+ para('something'))))
+ expected.file = @top_level
+
+ assert_equal expected, c.parse
+ end
+
+ def test_class_signature_none
+ c = comment ''
+ c.format = 'tomdoc'
+
+ assert_nil @TD.signature c
+ end
+
+ def test_class_rdoc
+ c = comment <<-COMMENT
+=== Signature
+
+ method_<here>(args)
+
+here - something
+ COMMENT
+ c.format = 'rdoc'
+
+ signature = @TD.signature c
+
+ assert_nil signature
+ end
+
+ def test_class_signature_two_space
+ c = comment <<-COMMENT
+Signature
+
+
+ method_<here>(args)
+
+here - something
+ COMMENT
+ c.format = 'tomdoc'
+
+ signature = @TD.signature c
+
+ assert_equal "method_<here>(args)\n", signature
+
+ expected =
+ doc(
+ head(3, 'Signature'),
+ list(:NOTE,
+ item(%w[here],
+ para('something'))))
+ expected.file = @top_level
+
+ assert_equal expected, c.parse
+ end
+
+ def test_parse_paragraph
+ text = "Public: Do some stuff\n"
+
+ expected =
+ @RM::Document.new(
+ @RM::Paragraph.new('Do some stuff'))
+
+ 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.
+
+name - name of argument
+description - arguments description
+ TEXT
+
+ expected =
+ doc(
+ para('Create new Arg object.'),
+ blank_line,
+ list(:NOTE,
+ item(%w[name],
+ para('name of argument')),
+ item(%w[description],
+ para('arguments description'))))
+
+ assert_equal expected, @TD.parse(text)
+ end
+
+ def test_parse_arguments_array
+ text = <<-TEXT
+Create new Arg object.
+
+names[] - names of arguments
+ TEXT
+
+ expected =
+ doc(
+ para('Create new Arg object.'),
+ blank_line,
+ list(:NOTE,
+ item(%w[names[]],
+ para('names of arguments'))))
+
+ assert_equal expected, @TD.parse(text)
+ end
+
+ def test_parse_arguments_multiline
+ text = <<-TEXT
+Do some stuff
+
+foo - A comment goes here
+ and is more than one line
+ TEXT
+
+ expected =
+ doc(
+ para('Do some stuff'),
+ blank_line,
+ list(:NOTE,
+ item(%w[foo],
+ para('A comment goes here', ' ', 'and is more than one line'))))
+
+ assert_equal expected, @TD.parse(text)
+ end
+
+ def test_parse_arguments_nested
+ text = <<-TEXT
+Do some stuff
+
+foo - A comment goes here
+ :bar - bar documentation
+ TEXT
+
+ expected =
+ doc(
+ para('Do some stuff'),
+ blank_line,
+ list(:NOTE,
+ item(%w[foo],
+ para('A comment goes here'),
+ list(:NOTE,
+ item(%w[:bar],
+ para('bar documentation'))))))
+
+ assert_equal expected, @TD.parse(text)
+ end
+
+ def test_parse_examples
+ text = <<-TEXT
+Do some stuff
+
+Examples
+
+ 1 + 1
+ TEXT
+
+ code = verb("1 + 1\n")
+ code.format = :ruby
+
+ expected =
+ doc(
+ para('Do some stuff'),
+ blank_line,
+ head(3, 'Examples'),
+ blank_line,
+ code)
+
+ document = @TD.parse(text)
+ assert_equal expected, document
+ assert document.parts.last.ruby?
+ end
+
+ def test_parse_examples_signature
+ text = <<-TEXT
+Do some stuff
+
+Examples
+
+ 1 + 1
+
+Signature
+
+ foo(args)
+ TEXT
+
+ code1 = verb("1 + 1\n")
+ code1.format = :ruby
+
+ code2 = verb("foo(args)\n")
+
+ expected =
+ doc(
+ para('Do some stuff'),
+ blank_line,
+ head(3, 'Examples'),
+ blank_line,
+ code1,
+ head(3, 'Signature'),
+ blank_line,
+ code2)
+
+ document = @TD.parse text
+
+ assert_equal expected, document
+ end
+
+ def test_parse_returns
+ text = <<-TEXT
+Do some stuff
+
+Returns a thing
+
+Returns another thing
+ TEXT
+
+ expected =
+ 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
+
+ def test_parse_returns_multiline
+ text = <<-TEXT
+Do some stuff
+
+Returns a thing
+ that is multiline
+ TEXT
+
+ expected =
+ 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
+
+ def test_parse_signature
+ text = <<-TEXT
+Do some stuff
+
+Signature
+
+ some_method(args)
+ TEXT
+
+ expected =
+ @RM::Document.new(
+ @RM::Paragraph.new('Do some stuff'),
+ @RM::BlankLine.new,
+ @RM::Heading.new(3, 'Signature'),
+ @RM::BlankLine.new,
+ @RM::Verbatim.new("some_method(args)\n"))
+
+ assert_equal expected, @TD.parse(text)
+ end
+
+ def test_tokenize_paragraph
+ @td.tokenize "Public: Do some stuff\n"
+
+ expected = [
+ [:TEXT, "Do some stuff", 0, 0],
+ [:NEWLINE, "\n", 13, 0],
+ ]
+
+ 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.
+
+name - name of argument
+description - arguments description
+ TEXT
+
+ expected = [
+ [:TEXT, "Create new Arg object.", 0, 0],
+ [:NEWLINE, "\n", 22, 0],
+ [:NEWLINE, "\n", 0, 1],
+ [:NOTE, "name", 0, 2],
+ [:TEXT, "name of argument", 14, 2],
+ [:NEWLINE, "\n", 30, 2],
+ [:NOTE, "description", 0, 3],
+ [:TEXT, "arguments description", 14, 3],
+ [:NEWLINE, "\n", 35, 3],
+ ]
+
+ assert_equal expected, @td.tokens
+ end
+
+ def test_tokenize_arguments_array
+ @td.tokenize <<-TEXT
+Create new Arg object.
+
+names[stuff] - names of arguments
+ TEXT
+
+ expected = [
+ [:TEXT, "Create new Arg object.", 0, 0],
+ [:NEWLINE, "\n", 22, 0],
+ [:NEWLINE, "\n", 0, 1],
+ [:NOTE, "names[stuff]", 0, 2],
+ [:TEXT, "names of arguments", 15, 2],
+ [:NEWLINE, "\n", 33, 2],
+ ]
+
+ assert_equal expected, @td.tokens
+ end
+
+ def test_tokenize_arguments_multiline
+ @td.tokenize <<-TEXT
+Do some stuff
+
+foo - A comment goes here
+ and is more than one line
+ TEXT
+
+ expected = [
+ [:TEXT, "Do some stuff", 0, 0],
+ [:NEWLINE, "\n", 13, 0],
+ [:NEWLINE, "\n", 0, 1],
+ [:NOTE, "foo", 0, 2],
+ [:TEXT, "A comment goes here", 6, 2],
+ [:NEWLINE, "\n", 25, 2],
+ [:TEXT, "and is more than one line", 2, 3],
+ [:NEWLINE, "\n", 27, 3],
+ ]
+
+ assert_equal expected, @td.tokens
+ end
+
+ def test_tokenize_arguments_nested
+ @td.tokenize <<-TEXT
+Do some stuff
+
+foo - A comment goes here
+ :bar - bar documentation
+ TEXT
+
+ expected = [
+ [:TEXT, "Do some stuff", 0, 0],
+ [:NEWLINE, "\n", 13, 0],
+ [:NEWLINE, "\n", 0, 1],
+ [:NOTE, "foo", 0, 2],
+ [:TEXT, "A comment goes here", 6, 2],
+ [:NEWLINE, "\n", 25, 2],
+ [:NOTE, ":bar", 6, 3],
+ [:TEXT, "bar documentation", 13, 3],
+ [:NEWLINE, "\n", 30, 3],
+ ]
+
+ assert_equal expected, @td.tokens
+ end
+
+ def test_tokenize_examples
+ @td.tokenize <<-TEXT
+Do some stuff
+
+Examples
+
+ 1 + 1
+ TEXT
+
+ expected = [
+ [:TEXT, "Do some stuff", 0, 0],
+ [:NEWLINE, "\n", 13, 0],
+ [:NEWLINE, "\n", 0, 1],
+ [:HEADER, 3, 0, 2],
+ [:TEXT, "Examples", 0, 2],
+ [:NEWLINE, "\n", 8, 2],
+ [:NEWLINE, "\n", 0, 3],
+ [:TEXT, "1 + 1", 2, 4],
+ [:NEWLINE, "\n", 7, 4],
+ ]
+
+ assert_equal expected, @td.tokens
+ end
+
+ def test_tokenize_returns
+ @td.tokenize <<-TEXT
+Do some stuff
+
+Returns a thing
+ TEXT
+
+ expected = [
+ [:TEXT, "Do some stuff", 0, 0],
+ [:NEWLINE, "\n", 13, 0],
+ [:NEWLINE, "\n", 0, 1],
+ [:TEXT, "Returns a thing", 0, 2],
+ [:NEWLINE, "\n", 15, 2],
+ ]
+
+ assert_equal expected, @td.tokens
+ end
+
+ def test_tokenize_returns_multiline
+ @td.tokenize <<-TEXT
+Do some stuff
+
+Returns a thing
+ that is multiline
+ TEXT
+
+ expected = [
+ [:TEXT, "Do some stuff", 0, 0],
+ [:NEWLINE, "\n", 13, 0],
+ [:NEWLINE, "\n", 0, 1],
+ [:TEXT, "Returns a thing", 0, 2],
+ [:NEWLINE, "\n", 15, 2],
+ [:TEXT, "that is multiline", 2, 3],
+ [:NEWLINE, "\n", 19, 3],
+ ]
+
+ assert_equal expected, @td.tokens
+ end
+
+end
+
diff --git a/test/rdoc/test_rdoc_top_level.rb b/test/rdoc/test_rdoc_top_level.rb
index 9e68bc4bdd..f3ee6a4784 100644
--- a/test/rdoc/test_rdoc_top_level.rb
+++ b/test/rdoc/test_rdoc_top_level.rb
@@ -1,5 +1,3 @@
-require 'rubygems'
-require 'minitest/autorun'
require File.expand_path '../xref_test_case', __FILE__
class TestRDocTopLevel < XrefTestCase
@@ -7,102 +5,29 @@ class TestRDocTopLevel < XrefTestCase
def setup
super
- @top_level = RDoc::TopLevel.new 'path/top_level.rb'
+ @top_level = @store.add_file 'path/top_level.rb'
+ @top_level.parser = RDoc::Parser::Ruby
end
- def test_class_all_classes_and_modules
- expected = %w[
- C1 C2 C2::C3 C2::C3::H1 C3 C3::H1 C3::H2 C4 C4::C4 C5 C5::C1
- Child
- M1 M1::M2
- Parent
- ]
-
- assert_equal expected,
- RDoc::TopLevel.all_classes_and_modules.map { |m| m.full_name }.sort
- end
-
- def test_class_classes
- expected = %w[
- C1 C2 C2::C3 C2::C3::H1 C3 C3::H1 C3::H2 C4 C4::C4 C5 C5::C1
- Child Parent
- ]
-
- assert_equal expected, RDoc::TopLevel.classes.map { |m| m.full_name }.sort
- end
-
- def test_class_complete
- @c2.add_module_alias @c2_c3, 'A1', @top_level
-
- RDoc::TopLevel.complete :public
-
- a1 = @xref_data.find_class_or_module 'C2::A1'
+ def test_initialize
+ t = RDoc::TopLevel.new 'path/file.rb'
- assert_equal 'C2::A1', a1.full_name
- refute_empty a1.aliases
+ assert_equal 'path/file.rb', t.absolute_name
+ assert_equal 'path/file.rb', t.relative_name
end
- def test_class_files
- assert_equal %w[path/top_level.rb xref_data.rb],
- RDoc::TopLevel.files.map { |m| m.full_name }.sort
- end
-
- def test_class_find_class_named
- assert_equal @c1, RDoc::TopLevel.find_class_named('C1')
-
- assert_equal @c2_c3, RDoc::TopLevel.find_class_named('C2::C3')
- end
-
- def test_class_find_class_named_from
- assert_equal @c5_c1, RDoc::TopLevel.find_class_named_from('C1', 'C5')
-
- assert_equal @c1, RDoc::TopLevel.find_class_named_from('C1', 'C4')
- end
-
- def test_class_find_class_or_module
- assert_equal @m1, RDoc::TopLevel.find_class_or_module('M1')
- assert_equal @c1, RDoc::TopLevel.find_class_or_module('C1')
-
- assert_equal @m1, RDoc::TopLevel.find_class_or_module('::M1')
- assert_equal @c1, RDoc::TopLevel.find_class_or_module('::C1')
- end
+ def test_initialize_relative
+ t = RDoc::TopLevel.new 'path/file.rb', 'file.rb'
- def test_class_find_file_named
- assert_equal @xref_data, RDoc::TopLevel.find_file_named(@file_name)
- end
-
- def test_class_find_module_named
- assert_equal @m1, RDoc::TopLevel.find_module_named('M1')
- assert_equal @m1_m2, RDoc::TopLevel.find_module_named('M1::M2')
- end
-
- def test_class_modules
- assert_equal %w[M1 M1::M2],
- RDoc::TopLevel.modules.map { |m| m.full_name }.sort
- end
-
- def test_class_new
- tl1 = RDoc::TopLevel.new 'file.rb'
- tl2 = RDoc::TopLevel.new 'file.rb'
- tl3 = RDoc::TopLevel.new 'other.rb'
-
- assert_same tl1, tl2
- refute_same tl1, tl3
- end
-
- def test_class_reset
- RDoc::TopLevel.reset
-
- assert_empty RDoc::TopLevel.classes
- assert_empty RDoc::TopLevel.modules
- assert_empty RDoc::TopLevel.files
+ assert_equal 'path/file.rb', t.absolute_name
+ assert_equal 'file.rb', t.relative_name
end
def test_add_alias
a = RDoc::Alias.new nil, 'old', 'new', nil
@top_level.add_alias a
- object = RDoc::TopLevel.find_class_named 'Object'
+ object = @store.find_class_named 'Object'
expected = { '#old' => [a] }
assert_equal expected, object.unmatched_alias_lists
assert_includes object.in_files, @top_level
@@ -114,7 +39,7 @@ class TestRDocTopLevel < XrefTestCase
a = RDoc::Alias.new nil, 'old', 'new', nil
@top_level.add_alias a
- object = RDoc::TopLevel.find_class_named('Object')
+ object = @store.find_class_named('Object')
assert_empty object.unmatched_alias_lists
assert_includes object.in_files, @top_level
end
@@ -123,7 +48,7 @@ class TestRDocTopLevel < XrefTestCase
const = RDoc::Constant.new 'C', nil, nil
@top_level.add_constant const
- object = RDoc::TopLevel.find_class_named 'Object'
+ object = @store.find_class_named 'Object'
assert_equal [const], object.constants
assert_includes object.in_files, @top_level
end
@@ -134,7 +59,7 @@ class TestRDocTopLevel < XrefTestCase
const = RDoc::Constant.new 'C', nil, nil
@top_level.add_constant const
- object = RDoc::TopLevel.find_class_named 'Object'
+ object = @store.find_class_named 'Object'
assert_empty object.constants
assert_includes object.in_files, @top_level
end
@@ -143,7 +68,7 @@ class TestRDocTopLevel < XrefTestCase
include = RDoc::Include.new 'C', nil
@top_level.add_include include
- object = RDoc::TopLevel.find_class_named 'Object'
+ object = @store.find_class_named 'Object'
assert_equal [include], object.includes
assert_includes object.in_files, @top_level
end
@@ -154,7 +79,7 @@ class TestRDocTopLevel < XrefTestCase
include = RDoc::Include.new 'C', nil
@top_level.add_include include
- object = RDoc::TopLevel.find_class_named('Object')
+ object = @store.find_class_named('Object')
assert_empty object.includes
assert_includes object.in_files, @top_level
end
@@ -163,7 +88,7 @@ class TestRDocTopLevel < XrefTestCase
method = RDoc::AnyMethod.new nil, 'm'
@top_level.add_method method
- object = RDoc::TopLevel.find_class_named 'Object'
+ object = @store.find_class_named 'Object'
assert_equal [method], object.method_list
assert_includes object.in_files, @top_level
end
@@ -174,7 +99,7 @@ class TestRDocTopLevel < XrefTestCase
method = RDoc::AnyMethod.new nil, 'm'
@top_level.add_method method
- object = RDoc::TopLevel.find_class_named('Object')
+ object = @store.find_class_named('Object')
assert_empty object.method_list
assert_includes object.in_files, @top_level
end
@@ -183,9 +108,18 @@ class TestRDocTopLevel < XrefTestCase
assert_equal 'top_level.rb', @top_level.base_name
end
+ def test_display_eh
+ refute @top_level.display?
+
+ page = @store.add_file 'README.txt'
+ page.parser = RDoc::Parser::Simple
+
+ assert page.display?
+ end
+
def test_eql_eh
- top_level2 = RDoc::TopLevel.new 'path/top_level.rb'
- other_level = RDoc::TopLevel.new 'path/other_level.rb'
+ top_level2 = @store.add_file 'path/top_level.rb'
+ other_level = @store.add_file 'path/other_level.rb'
assert_operator @top_level, :eql?, top_level2
@@ -193,8 +127,8 @@ class TestRDocTopLevel < XrefTestCase
end
def test_equals2
- top_level2 = RDoc::TopLevel.new 'path/top_level.rb'
- other_level = RDoc::TopLevel.new 'path/other_level.rb'
+ top_level2 = @store.add_file 'path/top_level.rb'
+ other_level = @store.add_file 'path/other_level.rb'
assert_equal @top_level, top_level2
@@ -213,8 +147,8 @@ class TestRDocTopLevel < XrefTestCase
end
def test_hash
- tl2 = RDoc::TopLevel.new 'path/top_level.rb'
- tl3 = RDoc::TopLevel.new 'other/top_level.rb'
+ tl2 = @store.add_file 'path/top_level.rb'
+ tl3 = @store.add_file 'other/top_level.rb'
assert_equal @top_level.hash, tl2.hash
refute_equal @top_level.hash, tl3.hash
@@ -232,9 +166,122 @@ class TestRDocTopLevel < XrefTestCase
assert_equal 0, @top_level.last_modified
end
+ def test_marshal_dump
+ page = @store.add_file 'README.txt'
+ page.parser = RDoc::Parser::Simple
+ page.comment = RDoc::Comment.new 'This is a page', page
+
+ loaded = Marshal.load Marshal.dump page
+
+ comment = RDoc::Markup::Document.new(
+ RDoc::Markup::Paragraph.new('This is a page'))
+ comment.file = loaded
+
+ assert_equal page, loaded
+
+ assert_equal 'README.txt', loaded.absolute_name
+ assert_equal 'README.txt', loaded.relative_name
+
+ assert_equal RDoc::Parser::Simple, loaded.parser
+
+ assert_equal comment, loaded.comment
+ end
+
+ def test_marshal_load_version_0
+ loaded = Marshal.load "\x04\bU:\x13RDoc::TopLevel" +
+ "[\ti\x00I\"\x0FREADME.txt\x06:\x06EF" +
+ "c\x19RDoc::Parser::Simple" +
+ "o:\eRDoc::Markup::Document\a:\v@parts" +
+ "[\x06o:\x1CRDoc::Markup::Paragraph\x06;\b" +
+ "[\x06I\"\x13This is a page\x06;\x06F:\n@file@\a"
+
+ comment = RDoc::Markup::Document.new(
+ RDoc::Markup::Paragraph.new('This is a page'))
+ comment.file = loaded
+
+ assert_equal 'README.txt', loaded.absolute_name
+ assert_equal 'README.txt', loaded.relative_name
+
+ assert_equal RDoc::Parser::Simple, loaded.parser
+
+ assert_equal comment, loaded.comment
+
+ assert loaded.display?
+ end
+
def test_name
assert_equal 'top_level.rb', @top_level.name
end
+ def test_page_name
+ assert_equal 'top_level', @top_level.page_name
+
+ tl = @store.add_file 'README.ja'
+
+ assert_equal 'README.ja', tl.page_name
+
+ tl = @store.add_file 'Rakefile'
+
+ assert_equal 'Rakefile', tl.page_name
+ end
+
+ def test_page_name_trim_extension
+ tl = @store.add_file 'README.ja.rdoc'
+
+ assert_equal 'README.ja', tl.page_name
+
+ tl = @store.add_file 'README.ja.md'
+
+ assert_equal 'README.ja', tl.page_name
+
+ tl = @store.add_file 'README.txt'
+
+ assert_equal 'README', tl.page_name
+ end
+
+ def test_search_record
+ assert_nil @xref_data.search_record
+ end
+
+ def test_search_record_page
+ page = @store.add_file 'README.txt'
+ page.parser = RDoc::Parser::Simple
+ page.comment = 'This is a comment.'
+
+ expected = [
+ 'README',
+ '',
+ 'README',
+ '',
+ 'README_txt.html',
+ '',
+ "<p>This is a comment.\n",
+ ]
+
+ assert_equal expected, page.search_record
+ end
+
+ def test_text_eh
+ refute @xref_data.text?
+
+ rd = @store.add_file 'rd_format.rd'
+ rd.parser = RDoc::Parser::RD
+
+ assert rd.text?
+
+ simple = @store.add_file 'simple.txt'
+ simple.parser = RDoc::Parser::Simple
+
+ assert simple.text?
+ end
+
+ def test_text_eh_no_parser
+ refute @xref_data.text?
+
+ rd = @store.add_file 'rd_format.rd'
+
+ refute rd.text?
+ end
+
end
diff --git a/test/rdoc/xref_test_case.rb b/test/rdoc/xref_test_case.rb
index a001700d3b..a56fa71268 100644
--- a/test/rdoc/xref_test_case.rb
+++ b/test/rdoc/xref_test_case.rb
@@ -1,26 +1,23 @@
ENV['RDOC_TEST'] = 'yes'
-require 'rubygems'
-require 'minitest/autorun'
require 'rdoc'
-require 'rdoc/stats'
-require 'rdoc/options'
-require 'rdoc/code_objects'
-require 'rdoc/parser/ruby'
require File.expand_path '../xref_data', __FILE__
-class XrefTestCase < MiniTest::Unit::TestCase
+class XrefTestCase < RDoc::TestCase
def setup
- RDoc::TopLevel.reset
-
- @file_name = 'xref_data.rb'
- @xref_data = RDoc::TopLevel.new @file_name
+ super
@options = RDoc::Options.new
@options.quiet = true
- stats = RDoc::Stats.new 0
+ @rdoc.options = @options
+
+ @file_name = 'xref_data.rb'
+ @xref_data = @store.add_file @file_name
+ @top_level = @xref_data
+
+ stats = RDoc::Stats.new @store, 0
parser = RDoc::Parser::Ruby.new @xref_data, @file_name, XREF_DATA, @options,
stats
@@ -30,9 +27,8 @@ class XrefTestCase < MiniTest::Unit::TestCase
generator = Object.new
def generator.class_dir() nil end
def generator.file_dir() nil end
- rdoc = RDoc::RDoc.new
- RDoc::RDoc.current = rdoc
- rdoc.generator = generator
+ @rdoc.options = @options
+ @rdoc.generator = generator
@c1 = @xref_data.find_module_named 'C1'
@c1_m = @c1.method_list.last # C1#m
diff --git a/test/readline/test_readline.rb b/test/readline/test_readline.rb
index fe8aa0e843..4909205215 100644
--- a/test/readline/test_readline.rb
+++ b/test/readline/test_readline.rb
@@ -1,86 +1,29 @@
begin
require "readline"
-=begin
- class << Readline
- [
- "line_buffer",
- "point",
- "set_screen_size",
- "get_screen_size",
- "vi_editing_mode",
- "emacs_editing_mode",
- "completion_append_character=",
- "completion_append_character",
- "basic_word_break_characters=",
- "basic_word_break_characters",
- "completer_word_break_characters=",
- "completer_word_break_characters",
- "basic_quote_characters=",
- "basic_quote_characters",
- "completer_quote_characters=",
- "completer_quote_characters",
- "filename_quote_characters=",
- "filename_quote_characters",
- "refresh_line",
- ].each do |method_name|
- define_method(method_name.to_sym) do |*args|
- raise NotImplementedError
- end
- end
- end
-=end
rescue LoadError
else
require "test/unit"
require "tempfile"
+ require "timeout"
end
class TestReadline < Test::Unit::TestCase
- def teardown
- Readline.instance_variable_set("@completion_proc", nil)
+ INPUTRC = "INPUTRC"
+
+ def setup
+ @inputrc, ENV[INPUTRC] = ENV[INPUTRC], IO::NULL
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"],
- ]
- 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
+ def teardown
+ ENV[INPUTRC] = @inputrc
+ Readline.instance_variable_set("@completion_proc", nil)
+ begin
+ Readline.delete_text
+ Readline.point = 0
+ rescue NotImplementedError
end
+ Readline.input = nil
+ Readline.output = nil
end
if !/EditLine/n.match(Readline::VERSION)
@@ -88,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])
@@ -106,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
@@ -134,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"]
}
@@ -153,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
@@ -222,7 +159,7 @@ class TestReadline < Test::Unit::TestCase
rescue NotimplementedError
end
end
- end
+ end if !/EditLine/n.match(Readline::VERSION)
def test_get_screen_size
begin
@@ -307,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)
@@ -320,13 +260,14 @@ class TestReadline < Test::Unit::TestCase
ensure
Readline.completion_case_fold = completion_case_fold
Readline.completion_append_character = append_character
- end
+ end if !/EditLine/n.match(Readline::VERSION)
# basic_word_break_characters
# completer_word_break_characters
# basic_quote_characters
# completer_quote_characters
# filename_quote_characters
+ # special_prefixes
def test_some_characters_methods
method_names = [
"basic_word_break_characters",
@@ -334,6 +275,7 @@ class TestReadline < Test::Unit::TestCase
"basic_quote_characters",
"completer_quote_characters",
"filename_quote_characters",
+ "special_prefixes",
]
method_names.each do |method_name|
begin
@@ -365,6 +307,147 @@ class TestReadline < Test::Unit::TestCase
end
end
+ def test_pre_input_hook
+ begin
+ pr = proc {}
+ Readline.pre_input_hook = pr
+ assert_equal(pr, Readline.pre_input_hook)
+ Readline.pre_input_hook = nil
+ assert_nil(Readline.pre_input_hook)
+ rescue NotImplementedError
+ 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
+ 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
+ with_temp_stdio {|stdin, stdout|
+ begin
+ 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
+ }
+ end if !/EditLine|\A4\.3\z/n.match(Readline::VERSION)
+
+ def test_input_metachar
+ bug6601 = '[ruby-core:45682]'
+ Readline::HISTORY << "hello"
+ wo = nil
+ line = with_pipe do |r, w|
+ wo = w.dup
+ wo.write("\C-re\ef\n")
+ end
+ assert_equal("hello", line, bug6601)
+ ensure
+ wo.close
+ Readline.delete_text
+ Readline::HISTORY.clear
+ end if !/EditLine/n.match(Readline::VERSION)
+
+ def test_input_metachar_multibyte
+ 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"
+ Readline::HISTORY << "\u3046\u3093"
+ open(IO::NULL, 'w') do |null|
+ IO.pipe do |r, w|
+ Readline.input = r
+ Readline.output = null
+ w << "\cr\u3093\n\n"
+ w << "\cr\u3042\u3093"
+ w.reopen(IO::NULL)
+ assert_equal("\u3046\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
+ Readline.delete_text
+ Readline::HISTORY.clear
+ end if !/EditLine/n.match(Readline::VERSION)
+
private
def replace_stdio(stdin_path, stdout_path)
@@ -372,13 +455,16 @@ class TestReadline < Test::Unit::TestCase
open(stdout_path, "w"){|stdout|
orig_stdin = STDIN.dup
orig_stdout = STDOUT.dup
+ orig_stderr = STDERR.dup
STDIN.reopen(stdin)
STDOUT.reopen(stdout)
+ STDERR.reopen(stdout)
begin
Readline.input = STDIN
Readline.output = STDOUT
yield
ensure
+ STDERR.reopen(orig_stderr)
STDIN.reopen(orig_stdin)
STDOUT.reopen(orig_stdout)
orig_stdin.close
@@ -389,22 +475,28 @@ class TestReadline < Test::Unit::TestCase
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
+ stderr = nil
IO.pipe do |r, w|
yield(r, w)
Readline.input = r
Readline.output = w.reopen(IO::NULL)
+ stderr = STDERR.dup
+ STDERR.reopen(w)
Readline.readline
end
ensure
+ if stderr
+ STDERR.reopen(stderr)
+ stderr.close
+ end
Readline.input = STDIN
Readline.output = STDOUT
end
@@ -412,4 +504,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 a5d8c686da..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)
@@ -94,7 +59,7 @@ class Readline::TestHistory < Test::Unit::TestCase
end
def test_get__out_of_range
- lines = push_history(5)
+ push_history(5)
invalid_indexes = [5, 6, 100, -6, -7, -100]
invalid_indexes.each do |i|
assert_raise(IndexError, "i=<#{i}>") do
@@ -113,7 +78,7 @@ class Readline::TestHistory < Test::Unit::TestCase
def test_set
begin
- lines = push_history(5)
+ push_history(5)
5.times do |i|
expected = "set: #{i}"
HISTORY[i] = expected
@@ -128,7 +93,7 @@ class Readline::TestHistory < Test::Unit::TestCase
HISTORY[0] = "set: 0"
end
- lines = push_history(5)
+ push_history(5)
invalid_indexes = [5, 6, 100, -6, -7, -100]
invalid_indexes.each do |i|
assert_raise(IndexError, NotImplementedError, "index=<#{i}>") do
@@ -277,7 +242,7 @@ class Readline::TestHistory < Test::Unit::TestCase
HISTORY.delete_at(0)
end
- lines = push_history(5)
+ push_history(5)
invalid_indexes = [5, 6, 100, -6, -7, -100]
invalid_indexes.each do |i|
assert_raise(IndexError, NotImplementedError, "index=<#{i}>") do
diff --git a/test/resolv/test_dns.rb b/test/resolv/test_dns.rb
index 9a9c33ea84..0d9565ef68 100644
--- a/test/resolv/test_dns.rb
+++ b/test/resolv/test_dns.rb
@@ -23,6 +23,12 @@ class TestResolvDNS < Test::Unit::TestCase
end
def test_query_ipv4_address
+ begin
+ OpenSSL
+ rescue LoadError
+ skip 'autoload problem. see [ruby-dev:45021][Bug #5786]'
+ end if defined?(OpenSSL)
+
with_udp('127.0.0.1', 0) {|u|
_, server_port, _, server_address = u.addr
begin
@@ -105,6 +111,32 @@ class TestResolvDNS < Test::Unit::TestCase
}
end
+ def test_query_ipv4_address_timeout
+ with_udp('127.0.0.1', 0) {|u|
+ _, port , _, host = u.addr
+ start = nil
+ rv = Resolv::DNS.open(:nameserver_port => [[host, port]]) {|dns|
+ dns.timeouts = 0.1
+ start = Time.now
+ dns.getresources("foo.example.org", Resolv::DNS::Resource::IN::A)
+ }
+ t2 = Time.now
+ diff = t2 - start
+ assert rv.empty?, "unexpected: #{rv.inspect} (expected empty)"
+ assert_operator 0.1, :<=, diff
+
+ rv = Resolv::DNS.open(:nameserver_port => [[host, port]]) {|dns|
+ dns.timeouts = [ 0.1, 0.2 ]
+ start = Time.now
+ dns.getresources("foo.example.org", Resolv::DNS::Resource::IN::A)
+ }
+ t2 = Time.now
+ diff = t2 - start
+ assert rv.empty?, "unexpected: #{rv.inspect} (expected empty)"
+ assert_operator 0.3, :<=, diff
+ }
+ end
+
def test_no_server
u = UDPSocket.new
u.bind("127.0.0.1", 0)
diff --git a/test/rexml/data/testsrc.xml b/test/rexml/data/testsrc.xml
index e18ba20dae..9c7a78212f 100644
--- a/test/rexml/data/testsrc.xml
+++ b/test/rexml/data/testsrc.xml
@@ -1,64 +1,64 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<!DOCTYPE rss PUBLIC "-//Netscape Communications//DTD RSS 0.91//EN"
- "http://my.netscape.com/publish/formats/rss-0.91.dtd">
-<rss version="0.91">
- <channel>
- <title>xmlhack</title>
- <link>http://www.xmlhack.com</link>
- <description>Developer news from the XML community</description>
- <language>en-us</language>
- <copyright>Copyright 1999-2001, xmlhack team.</copyright>
- <managingEditor>editor@xmlhack.com</managingEditor>
- <webMaster>webmaster@xmlhack.com</webMaster>
- <image>
- <title>xmlhack</title>
- <url>http://www.xmlhack.com/images/mynetscape88.gif</url>
- <link>http://www.xmlhack.com</link>
- <width>88</width>
- <height>31</height>
- <description>News, opinions, tips and issues concerning XML development</description>
- </image>
-<item x='0'>
-<title>Experimental non-XML syntax for RELAX NG</title>
-<link>http://www.xmlhack.com/read.php?item=1343</link>
-<description>
- James Clark has announced the release of an experimental non-XML syntax for RELAX
- NG and a Java translator implementation that converts
- instances of the syntax into RELAX NG's XML syntax.
-</description>
-<category>Schemas</category>
-</item>
-<item x='1'>
-<title>Long-awaited entity-resolver Java classes finally released</title>
-<link>http://www.xmlhack.com/read.php?item=1342</link>
-<description>Norman Walsh has
- announced the release of SAX entityResolver() and JAXP
- URIResolver() Java
- classes he wrote to implement the OASIS XML Catalogs
- Committee Specification (in addition to the TR9401 and
- Apache XCatalogs specifications).
-</description>
-<category>SGML/XML</category>
-<category>Java</category>
-</item>
-<item x='3'>
-
-<title>Beepcore-C framework released</title>
-<link>http://www.xmlhack.com/read.php?item=1341</link>
-<description>Invisible Worlds have announced the publication of Beepcore-C, an implementation of the BEEP framework written in C.</description>
-<category>Protocols</category>
-<category>C++</category>
-</item>
-<item>
-<title>SVG and XSL-FO by example</title>
-<link>http://www.xmlhack.com/read.php?item=1340</link>
-<description>Jirka Jirat has announced the
-addition of an XSL-FO and SVG examples repository to the Zvon developer
-reference site.</description>
-<category>SVG</category>
-<category>XSL-FO</category>
-</item>
-
-
-</channel>
-</rss>
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE rss PUBLIC "-//Netscape Communications//DTD RSS 0.91//EN"
+ "http://my.netscape.com/publish/formats/rss-0.91.dtd">
+<rss version="0.91">
+ <channel>
+ <title>xmlhack</title>
+ <link>http://www.xmlhack.com</link>
+ <description>Developer news from the XML community</description>
+ <language>en-us</language>
+ <copyright>Copyright 1999-2001, xmlhack team.</copyright>
+ <managingEditor>editor@xmlhack.com</managingEditor>
+ <webMaster>webmaster@xmlhack.com</webMaster>
+ <image>
+ <title>xmlhack</title>
+ <url>http://www.xmlhack.com/images/mynetscape88.gif</url>
+ <link>http://www.xmlhack.com</link>
+ <width>88</width>
+ <height>31</height>
+ <description>News, opinions, tips and issues concerning XML development</description>
+ </image>
+<item x='0'>
+<title>Experimental non-XML syntax for RELAX NG</title>
+<link>http://www.xmlhack.com/read.php?item=1343</link>
+<description>
+ James Clark has announced the release of an experimental non-XML syntax for RELAX
+ NG and a Java translator implementation that converts
+ instances of the syntax into RELAX NG's XML syntax.
+</description>
+<category>Schemas</category>
+</item>
+<item x='1'>
+<title>Long-awaited entity-resolver Java classes finally released</title>
+<link>http://www.xmlhack.com/read.php?item=1342</link>
+<description>Norman Walsh has
+ announced the release of SAX entityResolver() and JAXP
+ URIResolver() Java
+ classes he wrote to implement the OASIS XML Catalogs
+ Committee Specification (in addition to the TR9401 and
+ Apache XCatalogs specifications).
+</description>
+<category>SGML/XML</category>
+<category>Java</category>
+</item>
+<item x='3'>
+
+<title>Beepcore-C framework released</title>
+<link>http://www.xmlhack.com/read.php?item=1341</link>
+<description>Invisible Worlds have announced the publication of Beepcore-C, an implementation of the BEEP framework written in C.</description>
+<category>Protocols</category>
+<category>C++</category>
+</item>
+<item>
+<title>SVG and XSL-FO by example</title>
+<link>http://www.xmlhack.com/read.php?item=1340</link>
+<description>Jirka Jirat has announced the
+addition of an XSL-FO and SVG examples repository to the Zvon developer
+reference site.</description>
+<category>SVG</category>
+<category>XSL-FO</category>
+</item>
+
+
+</channel>
+</rss>
diff --git a/test/rexml/data/ticket_61.xml b/test/rexml/data/ticket_61.xml
index 10ab7ebb4b..4df1cc9b86 100644
--- a/test/rexml/data/ticket_61.xml
+++ b/test/rexml/data/ticket_61.xml
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="iso-8859-1"?>
-<HTML>
-<body onload="RunOnLoads()" ms_positioning="FlowLayout"><form id="CollectiveForm" name="CollectiveForm" action="Matter_List.aspx" method="post" defaultbutton="btSearch"><input type="hidden" name="LinkID"/> <input type="hidden" name="Param"/><input type="hidden" name="__EVENTTARGET"/> <input type="hidden" name="__EVENTARGUMENT"/><input type="hidden" value="dDwtMjA3ODMxNDk3NDt0PDtsPGk8MD47aTwxPjs+O2w8dDxAPC9BSU1TL3N0eWxlc2hlZXRzL0RhdGFDZXJ0U3R5bGUuYXNweDs+Ozs+O3Q8cDxsPGRlZmF1bHRCdXR0b247PjtsPGJ0U2VhcmNoOz4+O2w8aTwxPjtpPDM+O2k8ND47aTw4PjtpPDExPjtpPDEzPjtpPDE1Pjs+O2w8dDxAPC9BSU1TL2ltYWdlcy9oZWFkZXItYWltc2xvZ28uZ2lmOy9BSU1TL2ltYWdlcy9oZWFkZXItYmtnZC5naWY7Pjs7Pjt0PEA8L0FJTVMvaW1hZ2VzL2hlYWRlci1yaWdodGVuZC5naWY7Oz47Oz47dDw7bDxpPDI+Oz47bDx0PDtsPGk8MT47aTwyPjs+O2w8dDxwPDtwPGw8b25wcm9wZXJ0eWNoYW5nZTs+O2w8Q29sbGVjdGl2ZVZhbGlkYXRpb25TdW1tYXJ5X09uUHJvcGVydHlDaGFuZ2UoKTs+Pj47Oz47dDxAPC9BSU1TL2ltYWdlcy9hbGVydExlZnRUb3AuZ2lmOy9BSU1TL2ltYWdlcy9hbGVydEhvcml6b250YWwuZ2lmOy9BSU1TL2ltYWdlcy9hbGVydC5naWY7L0FJTVMvaW1hZ2VzL2FsZXJ0SG9yaXpvbnRhbC5naWY7L0FJTVMvaW1hZ2VzL2FsZXJ0UmlnaHRUb3AuZ2lmOy9BSU1TL2ltYWdlcy9hbGVydExlZnRWZXJ0aWNhbC5naWY7L0FJTVMvaW1hZ2VzL2FsZXJ0UmlnaHRWZXJ0aWNhbC5naWY7L0FJTVMvaW1hZ2VzL2FsZXJ0TGVmdEJvdHRvbS5naWY7L0FJTVMvaW1hZ2VzL2FsZXJ0SG9yaXpvbnRhbC5naWY7L0FJTVMvaW1hZ2VzL2FsZXJ0UmlnaHRCb3R0b20uZ2lmOz47Oz47Pj47Pj47dDw7bDxpPDE+O2k8Mz47aTw3Pjs+O2w8dDxwPHA8bDxUZXh0O2luRXJyb3JTdGF0ZTs+O2w8WTtvPGY+Oz4+O3A8bDxvbmNoYW5nZTtjdXJyZW50dmFsdWU7PjtsPEluZGljYXRlQ2hhbmdlZCh0aGlzLCcnKVw7O1k7Pj4+Ozs+O3Q8cDxwPGw8VGV4dDtpbkVycm9yU3RhdGU7PjtsPE9wZW47bzxmPjs+PjtwPGw8b25jaGFuZ2U7Y3VycmVudHZhbHVlOz47bDxJbmRpY2F0ZUNoYW5nZWQodGhpcywnJylcOztPcGVuOz4+Pjs7Pjt0PHA8cDxsPFRvb2xUaXA7PjtsPFxlOz4+Oz47Oz47Pj47dDw7bDxpPDE+O2k8Mz47aTw1PjtpPDY+O2k8Nz47PjtsPHQ8cDxwPGw8aW5FcnJvclN0YXRlO1RleHQ7PjtsPG88Zj47XGU7Pj47cDxsPG9uY2hhbmdlO2N1cnJlbnR2YWx1ZTs+O2w8SW5kaWNhdGVDaGFuZ2VkKHRoaXMsJycpXDs7XGU7Pj4+Ozs+O3Q8cDxwPGw8aW5FcnJvclN0YXRlO1RleHQ7PjtsPG88Zj47XGU7Pj47cDxsPG9uY2hhbmdlO2N1cnJlbnR2YWx1ZTs+O2w8SW5kaWNhdGVDaGFuZ2VkKHRoaXMsJycpXDs7XGU7Pj4+Ozs+O3Q8cDxwPGw8aW5FcnJvclN0YXRlO1RleHQ7PjtsPG88Zj47XGU7Pj47cDxsPG9uY2hhbmdlO2N1cnJlbnR2YWx1ZTs+O2w8SW5kaWNhdGVDaGFuZ2VkKHRoaXMsJycpXDs7XGU7Pj4+Ozs+O3Q8QDxQcm9mZXNzaW9uYWwgaW4gQ2hhcmdlOz47Oz47dDxwPHA8bDxpbkVycm9yU3RhdGU7VGV4dDs+O2w8bzxmPjtcZTs+PjtwPGw8b25jaGFuZ2U7Y3VycmVudHZhbHVlOz47bDxJbmRpY2F0ZUNoYW5nZWQodGhpcywnJylcOztcZTs+Pj47Oz47Pj47dDxAMDxwPHA8bDxEYXRhS2V5cztQYWdpbmdWaWV3O1RvdGFsUmVjb3JkcztQYWdlQ291bnQ7UGFnZVNpemU7U29ydERpcmVjdGlvbjtVbmlxdWVJZDtTb3J0RXhwcmVzc2lvbjtDdXJyZW50UGFnZTtfIUl0ZW1Db3VudDtfIURhdGFTb3VyY2VJdGVtQ291bnQ7TWF4UGFnZU1vZGU7PjtsPGw8PjtPcGVuO2k8MD47aTwwPjtpPDIwPjtpPDE+O2MxNjA4M2Y4LTkwZjgtNDQ1Ni04YzM0LTc5ZTFhNjg2ZDhlMjttYXR0ZXJfbm87aTwxPjtpPC0xPjtpPC0xPjtEYXRhQ2VydC5XZWIuQ29udHJvbHMuTWF4UGFnZU1vZGUsIERhdGFDZXJ0LldlYiwgVmVyc2lvbj0xLjYuMi4xNCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1udWxsPE5PUk1BTD47Pj47PjtAMDw7OztAMDxwPGw8SGVhZGVyVGV4dDs+O2w8UHJvZmVzc2lvbmFsIGluIENoYXJnZTs+Pjs7Ozs+O0AwPHA8bDxWaXNpYmxlOz47bDxvPHQ+Oz4+Ozs7Oz47Oz47Ozs7Ozs7Ozs+Ozs+O3Q8QDwvQUlNUy9pbWFnZXMvZm9vdGVyLWJrZ2QuZ2lmOy9BSU1TL2ltYWdlcy9mb290ZXItYmtnZC5naWY7MjAwNjs7Pjs7Pjs+Pjs+Pjs+2T4SCaJMpmBYZKv3iwMGME7j8M0=" name="__VIEWSTATE"/> <input id="PageGuid" type="hidden" value="659179a1-bdcc-41f3-8f27-0495ae9356fd" name="PageGuid"/> <table style="BORDER-COLLAPSE: collapse" height="100%" cellSpacing="0" cellPadding="0" width="100%" border="0"><tbody ><tr ><td ><table cellSpacing="0" cellPadding="0" width="100%" border="0"><tbody ><tr ><td vAlign="top" align="left" width="325"><br /></td><td align="right" background="/AIMS/images/header-bkgd.gif"><table style="DISPLAY: inline" cellSpacing="0" cellPadding="0" border="0"><tbody ><tr ><td ><img src="/Aims/images/nav-leftend.gif"/></td><td background="/Aims/images/nav-center.gif"><span ><table id="NavControl__ctl0_group_1" style="Z-INDEX: 999" onmouseout="if (document.readyState == 'complete') aspnm_groupMsOut('NavControl__ctl0_group_1', null, null, 0);" cellSpacing="0" cellPadding="0" border="0"><tbody ><tr ></tr></tbody></table></span><span ><table style="LEFT: 0px; VISIBILITY: hidden; POSITION: absolute; TOP: 0px"><tbody ><tr ><td ><br /></td></tr></tbody></table></span><span ><table class="MenuGroup" id="NavControl__ctl1_group_1" style="Z-INDEX: 999" onmouseout="if (document.readyState == 'complete') aspnm_groupMsOut('NavControl__ctl1_group_1', null, null, 250);" cellSpacing="0" cellPadding="0" border="0"><tbody ><tr ><td class="MenuItem" onmousemove="return false;" id="NavControl__ctl1_item_1" ondblclick="return false;" onmouseover="this.className='MenuItemOver';if (document.readyState == 'complete') aspnm_itemMsOver('NavControl__ctl1_item_1', 'NavControl__ctl1_group_2', 'belowleft', 0, 0, 250, null);" onclick="aspnm_hideAllGroups();Link_OnClick(this.id, '10', '', 'MyWork/Inbox.aspx'); " onmouseout="this.className='MenuItem';if (document.readyState == 'complete') aspnm_itemMsOut('NavControl__ctl1_item_1', 'NavControl__ctl1_group_1', 'NavControl__ctl1_group_2', 250, null);">MY WORK</td><td class="MenuItem" onmousemove="return false;" id="NavControl__ctl1_item_6" ondblclick="return false;" onmouseover="this.className='MenuItemOver';if (document.readyState == 'complete') aspnm_itemMsOver('NavControl__ctl1_item_6', 'NavControl__ctl1_group_7', 'belowleft', 0, 0, 250, null);" onclick="aspnm_hideAllGroups();Link_OnClick(this.id, '1', '', 'Matter/Matter_List.aspx'); " onmouseout="this.className='MenuItem';if (document.readyState == 'complete') aspnm_itemMsOut('NavControl__ctl1_item_6', 'NavControl__ctl1_group_1', 'NavControl__ctl1_group_7', 250, null);">MATTER</td><td class="MenuItem" onmousemove="return false;" id="NavControl__ctl1_item_7" ondblclick="return false;" onmouseover="this.className='MenuItemOver';if (document.readyState == 'complete') aspnm_itemMsOver('NavControl__ctl1_item_7', 'NavControl__ctl1_group_8', 'belowleft', 0, 0, 250, null);" onclick="aspnm_hideAllGroups();Link_OnClick(this.id, '2', '', 'Administrator/Admin_Home.aspx'); " onmouseout="this.className='MenuItem';if (document.readyState == 'complete') aspnm_itemMsOut('NavControl__ctl1_item_7', 'NavControl__ctl1_group_1', 'NavControl__ctl1_group_8', 250, null);">ADMINISTRATOR</td><td class="MenuItem" onmousemove="return false;" id="NavControl__ctl1_item_20" ondblclick="return false;" onmouseover="this.className='MenuItemOver';if (document.readyState == 'complete') aspnm_itemMsOver('NavControl__ctl1_item_20', 'NavControl__ctl1_group_21', 'belowleft', 0, 0, 250, null);" onclick="aspnm_hideAllGroups();Link_OnClick(this.id, '15', '', 'MyWork/AIE.aspx?ClearForm=true'); " onmouseout="this.className='MenuItem';if (document.readyState == 'complete') aspnm_itemMsOut('NavControl__ctl1_item_20', 'NavControl__ctl1_group_1', 'NavControl__ctl1_group_21', 250, null);">AIE</td><td class="MenuItem" onmousemove="return false;" id="NavControl__ctl1_item_21" ondblclick="return false;" onmouseover="this.className='MenuItemOver';if (document.readyState == 'complete') aspnm_itemMsOver('NavControl__ctl1_item_21', 'NavControl__ctl1_group_22', 'belowleft', 0, 0, 250, null);" onclick="aspnm_hideAllGroups();Link_OnClick(this.id, '16', '', 'Reports/ReportsFrontPage.aspx'); " onmouseout="this.className='MenuItem';if (document.readyState == 'complete') aspnm_itemMsOut('NavControl__ctl1_item_21', 'NavControl__ctl1_group_1', 'NavControl__ctl1_group_22', 250, null);">REPORTS</td><td class="MenuItem" onmousemove="return false;" id="NavControl__ctl1_item_22" ondblclick="return false;" onmouseover="this.className='MenuItemOver';if (document.readyState == 'complete') aspnm_itemMsOver('NavControl__ctl1_item_22', 'NavControl__ctl1_group_23', 'belowleft', 0, 0, 250, null);" onclick="aspnm_hideAllGroups();Link_OnClick(this.id, '17', '', 'javascript:window.open(&quot;[appRoot]/Documentation/PubAIMS_3_02/AIMS_Master_Page.htm&quot;)'); " onmouseout="this.className='MenuItem';if (document.readyState == 'complete') aspnm_itemMsOut('NavControl__ctl1_item_22', 'NavControl__ctl1_group_1', 'NavControl__ctl1_group_23', 250, null);">HELP</td><td class="MenuItem" onmousemove="return false;" id="NavControl__ctl1_item_23" ondblclick="return false;" onmouseover="this.className='MenuItemOver';if (document.readyState == 'complete') aspnm_itemMsOver('NavControl__ctl1_item_23', 'NavControl__ctl1_group_24', 'belowleft', 0, 0, 250, null);" onclick="aspnm_hideAllGroups();Link_OnClick(this.id, '34', '', 'Logon.aspx'); " onmouseout="this.className='MenuItem';if (document.readyState == 'complete') aspnm_itemMsOut('NavControl__ctl1_item_23', 'NavControl__ctl1_group_1', 'NavControl__ctl1_group_24', 250, null);">LOGOFF</td></tr></tbody></table></span><span ><table class="MenuGroup" id="NavControl__ctl1_group_2" onmouseover="aspnm_groupMsOver('NavControl__ctl1_group_2')" style="Z-INDEX: 999; LEFT: 0px; VISIBILITY: hidden; POSITION: absolute; TOP: 0px" onmouseout="if (document.readyState == 'complete') aspnm_groupMsOut('NavControl__ctl1_group_2', 'NavControl__ctl1_item_1', 'NavControl__ctl1_group_1', 250, null);" cellSpacing="0" cellPadding="0" border="0"><tbody ><tr ><td class="MenuItem" onmousemove="return false;" id="NavControl__ctl1_item_2" ondblclick="return false;" onmouseover="this.className='MenuItemOver';if (document.readyState == 'complete') aspnm_itemMsOver('NavControl__ctl1_item_2', 'NavControl__ctl1_group_3', 'rightdown', 0, 0, 250, null);" onclick="aspnm_hideAllGroups();Link_OnClick(this.id, '11', '', 'MyWork/Inbox.aspx'); " onmouseout="this.className='MenuItem';if (document.readyState == 'complete') aspnm_itemMsOut('NavControl__ctl1_item_2', 'NavControl__ctl1_group_2', 'NavControl__ctl1_group_3', 250, null);">INBOX</td></tr><tr ><td class="MenuItem" onmousemove="return false;" id="NavControl__ctl1_item_3" ondblclick="return false;" onmouseover="this.className='MenuItemOver';if (document.readyState == 'complete') aspnm_itemMsOver('NavControl__ctl1_item_3', 'NavControl__ctl1_group_4', 'rightdown', 0, 0, 250, null);" onclick="aspnm_hideAllGroups();Link_OnClick(this.id, '12', '', 'MyWork/Coordinator.aspx'); " onmouseout="this.className='MenuItem';if (document.readyState == 'complete') aspnm_itemMsOut('NavControl__ctl1_item_3', 'NavControl__ctl1_group_2', 'NavControl__ctl1_group_4', 250, null);">COORDINATOR</td></tr><tr ><td class="MenuItem" onmousemove="return false;" id="NavControl__ctl1_item_4" ondblclick="return false;" onmouseover="this.className='MenuItemOver';if (document.readyState == 'complete') aspnm_itemMsOver('NavControl__ctl1_item_4', 'NavControl__ctl1_group_5', 'rightdown', 0, 0, 250, null);" onclick="aspnm_hideAllGroups();Link_OnClick(this.id, '13', '', 'MyWork/ErrorManagement.aspx'); " onmouseout="this.className='MenuItem';if (document.readyState == 'complete') aspnm_itemMsOut('NavControl__ctl1_item_4', 'NavControl__ctl1_group_2', 'NavControl__ctl1_group_5', 250, null);">ERROR MANAGER</td></tr><tr ><td class="MenuItem" onmousemove="return false;" id="NavControl__ctl1_item_5" ondblclick="return false;" onmouseover="this.className='MenuItemOver';if (document.readyState == 'complete') aspnm_itemMsOver('NavControl__ctl1_item_5', 'NavControl__ctl1_group_6', 'rightdown', 0, 0, 250, null);" onclick="aspnm_hideAllGroups();Link_OnClick(this.id, '14', '', 'MyWork/Invoice_Search.aspx'); " onmouseout="this.className='MenuItem';if (document.readyState == 'complete') aspnm_itemMsOut('NavControl__ctl1_item_5', 'NavControl__ctl1_group_2', 'NavControl__ctl1_group_6', 250, null);">SEARCH</td></tr></tbody></table><table class="MenuGroup" id="NavControl__ctl1_group_3" onmouseover="aspnm_groupMsOver('NavControl__ctl1_group_3')" style="Z-INDEX: 999; LEFT: 0px; VISIBILITY: hidden; POSITION: absolute; TOP: 0px" onmouseout="if (document.readyState == 'complete') aspnm_groupMsOut('NavControl__ctl1_group_3', 'NavControl__ctl1_item_2', 'NavControl__ctl1_group_2', 250, null);" cellSpacing="0" cellPadding="0" border="0"><tbody ></tbody></table><table class="MenuGroup" id="NavControl__ctl1_group_4" onmouseover="aspnm_groupMsOver('NavControl__ctl1_group_4')" style="Z-INDEX: 999; LEFT: 0px; VISIBILITY: hidden; POSITION: absolute; TOP: 0px" onmouseout="if (document.readyState == 'complete') aspnm_groupMsOut('NavControl__ctl1_group_4', 'NavControl__ctl1_item_3', 'NavControl__ctl1_group_2', 250, null);" cellSpacing="0" cellPadding="0" border="0"><tbody ></tbody></table><table class="MenuGroup" id="NavControl__ctl1_group_5" onmouseover="aspnm_groupMsOver('NavControl__ctl1_group_5')" style="Z-INDEX: 999; LEFT: 0px; VISIBILITY: hidden; POSITION: absolute; TOP: 0px" onmouseout="if (document.readyState == 'complete') aspnm_groupMsOut('NavControl__ctl1_group_5', 'NavControl__ctl1_item_4', 'NavControl__ctl1_group_2', 250, null);" cellSpacing="0" cellPadding="0" border="0"><tbody ></tbody></table><table class="MenuGroup" id="NavControl__ctl1_group_6" onmouseover="aspnm_groupMsOver('NavControl__ctl1_group_6')" style="Z-INDEX: 999; LEFT: 0px; VISIBILITY: hidden; POSITION: absolute; TOP: 0px" onmouseout="if (document.readyState == 'complete') aspnm_groupMsOut('NavControl__ctl1_group_6', 'NavControl__ctl1_item_5', 'NavControl__ctl1_group_2', 250, null);" cellSpacing="0" cellPadding="0" border="0"><tbody ></tbody></table><table class="MenuGroup" id="NavControl__ctl1_group_7" onmouseover="aspnm_groupMsOver('NavControl__ctl1_group_7')" style="Z-INDEX: 999; LEFT: 0px; VISIBILITY: hidden; POSITION: absolute; TOP: 0px" onmouseout="if (document.readyState == 'complete') aspnm_groupMsOut('NavControl__ctl1_group_7', 'NavControl__ctl1_item_6', 'NavControl__ctl1_group_1', 250, null);" cellSpacing="0" cellPadding="0" border="0"><tbody ></tbody></table><table class="MenuGroup" id="NavControl__ctl1_group_8" onmouseover="aspnm_groupMsOver('NavControl__ctl1_group_8')" style="Z-INDEX: 999; LEFT: 0px; VISIBILITY: hidden; POSITION: absolute; TOP: 0px" onmouseout="if (document.readyState == 'complete') aspnm_groupMsOut('NavControl__ctl1_group_8', 'NavControl__ctl1_item_7', 'NavControl__ctl1_group_1', 250, null);" cellSpacing="0" cellPadding="0" border="0"><tbody ><tr ><td class="MenuItem" onmousemove="return false;" id="NavControl__ctl1_item_8" ondblclick="return false;" onmouseover="this.className='MenuItemOver';if (document.readyState == 'complete') aspnm_itemMsOver('NavControl__ctl1_item_8', 'NavControl__ctl1_group_9', 'rightdown', 0, 0, 250, null);" onclick="aspnm_hideAllGroups();Link_OnClick(this.id, '19', '', 'Administrator/GeneralSettings_View.aspx'); " onmouseout="this.className='MenuItem';if (document.readyState == 'complete') aspnm_itemMsOut('NavControl__ctl1_item_8', 'NavControl__ctl1_group_8', 'NavControl__ctl1_group_9', 250, null);">GENERAL SETTINGS</td></tr><tr ><td class="MenuItem" onmousemove="return false;" id="NavControl__ctl1_item_9" ondblclick="return false;" onmouseover="this.className='MenuItemOver';if (document.readyState == 'complete') aspnm_itemMsOver('NavControl__ctl1_item_9', 'NavControl__ctl1_group_10', 'rightdown', 0, 0, 250, null);" onclick="aspnm_hideAllGroups();Link_OnClick(this.id, '30', '', 'Integration/Log_View.aspx'); " onmouseout="this.className='MenuItem';if (document.readyState == 'complete') aspnm_itemMsOut('NavControl__ctl1_item_9', 'NavControl__ctl1_group_8', 'NavControl__ctl1_group_10', 250, null);">INTEGRATION LOG</td></tr><tr ><td class="MenuItem" onmousemove="return false;" id="NavControl__ctl1_item_10" ondblclick="return false;" onmouseover="this.className='MenuItemOver';if (document.readyState == 'complete') aspnm_itemMsOver('NavControl__ctl1_item_10', 'NavControl__ctl1_group_11', 'rightdown', 0, 0, 250, null);" onclick="aspnm_hideAllGroups();Link_OnClick(this.id, '20', '', 'Administrator/Lookup_List.aspx'); " onmouseout="this.className='MenuItem';if (document.readyState == 'complete') aspnm_itemMsOut('NavControl__ctl1_item_10', 'NavControl__ctl1_group_8', 'NavControl__ctl1_group_11', 250, null);">LOOKUPS</td></tr><tr ><td class="MenuItem" onmousemove="return false;" id="NavControl__ctl1_item_11" ondblclick="return false;" onmouseover="this.className='MenuItemOver';if (document.readyState == 'complete') aspnm_itemMsOver('NavControl__ctl1_item_11', 'NavControl__ctl1_group_12', 'rightdown', 0, 0, 250, null);" onclick="aspnm_hideAllGroups();Link_OnClick(this.id, '37', '', 'NotificationLog/Log_View.aspx'); " onmouseout="this.className='MenuItem';if (document.readyState == 'complete') aspnm_itemMsOut('NavControl__ctl1_item_11', 'NavControl__ctl1_group_8', 'NavControl__ctl1_group_12', 250, null);">NOTIFICATION LOG</td></tr><tr ><td class="MenuItem" onmousemove="return false;" id="NavControl__ctl1_item_12" ondblclick="return false;" onmouseover="this.className='MenuItemOver';if (document.readyState == 'complete') aspnm_itemMsOver('NavControl__ctl1_item_12', 'NavControl__ctl1_group_13', 'rightdown', 0, 0, 250, null);" onclick="aspnm_hideAllGroups();Link_OnClick(this.id, '7', '', 'Administrator/MatterType_List.aspx'); " onmouseout="this.className='MenuItem';if (document.readyState == 'complete') aspnm_itemMsOut('NavControl__ctl1_item_12', 'NavControl__ctl1_group_8', 'NavControl__ctl1_group_13', 250, null);">MATTER TYPES</td></tr><tr ><td class="MenuItem" onmousemove="return false;" id="NavControl__ctl1_item_13" ondblclick="return false;" onmouseover="this.className='MenuItemOver';if (document.readyState == 'complete') aspnm_itemMsOver('NavControl__ctl1_item_13', 'NavControl__ctl1_group_14', 'rightdown', 0, 0, 250, null);" onclick="aspnm_hideAllGroups();Link_OnClick(this.id, '6', '', 'Professional/Prof_List.aspx'); " onmouseout="this.className='MenuItem';if (document.readyState == 'complete') aspnm_itemMsOut('NavControl__ctl1_item_13', 'NavControl__ctl1_group_8', 'NavControl__ctl1_group_14', 250, null);">PROFESSIONALS</td></tr><tr ><td class="MenuItem" onmousemove="return false;" id="NavControl__ctl1_item_14" ondblclick="return false;" onmouseover="this.className='MenuItemOver';if (document.readyState == 'complete') aspnm_itemMsOver('NavControl__ctl1_item_14', 'NavControl__ctl1_group_15', 'rightdown', 0, 0, 250, null);" onclick="aspnm_hideAllGroups();Link_OnClick(this.id, '9', '', 'Vendor/Vendor_List.aspx'); " onmouseout="this.className='MenuItem';if (document.readyState == 'complete') aspnm_itemMsOut('NavControl__ctl1_item_14', 'NavControl__ctl1_group_8', 'NavControl__ctl1_group_15', 250, null);">VENDORS</td></tr><tr ><td class="MenuItem" onmousemove="return false;" id="NavControl__ctl1_item_15" ondblclick="return false;" onmouseover="this.className='MenuItemOver';if (document.readyState == 'complete') aspnm_itemMsOver('NavControl__ctl1_item_15', 'NavControl__ctl1_group_16', 'rightdown', 0, 0, 250, null);" onclick="aspnm_hideAllGroups();Link_OnClick(this.id, '32', '', 'Workflow/WorkflowTitle_List.aspx'); " onmouseout="this.className='MenuItem';if (document.readyState == 'complete') aspnm_itemMsOut('NavControl__ctl1_item_15', 'NavControl__ctl1_group_8', 'NavControl__ctl1_group_16', 250, null);">WORKFLOW TITLES</td></tr><tr ><td class="MenuItem" onmousemove="return false;" id="NavControl__ctl1_item_16" ondblclick="return false;" onmouseover="this.className='MenuItemOver';if (document.readyState == 'complete') aspnm_itemMsOver('NavControl__ctl1_item_16', 'NavControl__ctl1_group_17', 'rightdown', 0, 0, 250, null);" onclick="aspnm_hideAllGroups();Link_OnClick(this.id, '36', '', 'Professional/Prof_SubList.aspx'); " onmouseout="this.className='MenuItem';if (document.readyState == 'complete') aspnm_itemMsOut('NavControl__ctl1_item_16', 'NavControl__ctl1_group_8', 'NavControl__ctl1_group_17', 250, null);">WORKFLOW SEARCH-REPLACE</td></tr><tr ><td class="MenuItem" onmousemove="return false;" id="NavControl__ctl1_item_17" ondblclick="return false;" onmouseover="this.className='MenuItemOver';if (document.readyState == 'complete') aspnm_itemMsOver('NavControl__ctl1_item_17', 'NavControl__ctl1_group_18', 'rightdown', 0, 0, 250, null);" onclick="aspnm_hideAllGroups();Link_OnClick(this.id, '5', '', 'Workgroup/Workgroup_List.aspx'); " onmouseout="this.className='MenuItem';if (document.readyState == 'complete') aspnm_itemMsOut('NavControl__ctl1_item_17', 'NavControl__ctl1_group_8', 'NavControl__ctl1_group_18', 250, null);">WORKGROUPS</td></tr><tr ><td class="MenuItem" onmousemove="return false;" id="NavControl__ctl1_item_18" ondblclick="return false;" onmouseover="this.className='MenuItemOver';if (document.readyState == 'complete') aspnm_itemMsOver('NavControl__ctl1_item_18', 'NavControl__ctl1_group_19', 'rightdown', 0, 0, 250, null);" onclick="aspnm_hideAllGroups();Link_OnClick(this.id, '33', '', 'Administrator/System_View.aspx'); " onmouseout="this.className='MenuItem';if (document.readyState == 'complete') aspnm_itemMsOut('NavControl__ctl1_item_18', 'NavControl__ctl1_group_8', 'NavControl__ctl1_group_19', 250, null);">SYSTEM POLICY</td></tr><tr ><td class="MenuItem" onmousemove="return false;" id="NavControl__ctl1_item_19" ondblclick="return false;" onmouseover="this.className='MenuItemOver';if (document.readyState == 'complete') aspnm_itemMsOver('NavControl__ctl1_item_19', 'NavControl__ctl1_group_20', 'rightdown', 0, 0, 250, null);" onclick="aspnm_hideAllGroups();Link_OnClick(this.id, '18', '', 'Timekeeper/TimekeeperClassification_List.aspx'); " onmouseout="this.className='MenuItem';if (document.readyState == 'complete') aspnm_itemMsOut('NavControl__ctl1_item_19', 'NavControl__ctl1_group_8', 'NavControl__ctl1_group_20', 250, null);">TIMEKEEPER CLASSIFICATIONS</td></tr></tbody></table><table class="MenuGroup" id="NavControl__ctl1_group_9" onmouseover="aspnm_groupMsOver('NavControl__ctl1_group_9')" style="Z-INDEX: 999; LEFT: 0px; VISIBILITY: hidden; POSITION: absolute; TOP: 0px" onmouseout="if (document.readyState == 'complete') aspnm_groupMsOut('NavControl__ctl1_group_9', 'NavControl__ctl1_item_8', 'NavControl__ctl1_group_8', 250, null);" cellSpacing="0" cellPadding="0" border="0"><tbody ></tbody></table><table class="MenuGroup" id="NavControl__ctl1_group_10" onmouseover="aspnm_groupMsOver('NavControl__ctl1_group_10')" style="Z-INDEX: 999; LEFT: 0px; VISIBILITY: hidden; POSITION: absolute; TOP: 0px" onmouseout="if (document.readyState == 'complete') aspnm_groupMsOut('NavControl__ctl1_group_10', 'NavControl__ctl1_item_9', 'NavControl__ctl1_group_8', 250, null);" cellSpacing="0" cellPadding="0" border="0"><tbody ></tbody></table><table class="MenuGroup" id="NavControl__ctl1_group_11" onmouseover="aspnm_groupMsOver('NavControl__ctl1_group_11')" style="Z-INDEX: 999; LEFT: 0px; VISIBILITY: hidden; POSITION: absolute; TOP: 0px" onmouseout="if (document.readyState == 'complete') aspnm_groupMsOut('NavControl__ctl1_group_11', 'NavControl__ctl1_item_10', 'NavControl__ctl1_group_8', 250, null);" cellSpacing="0" cellPadding="0" border="0"><tbody ></tbody></table><table class="MenuGroup" id="NavControl__ctl1_group_12" onmouseover="aspnm_groupMsOver('NavControl__ctl1_group_12')" style="Z-INDEX: 999; LEFT: 0px; VISIBILITY: hidden; POSITION: absolute; TOP: 0px" onmouseout="if (document.readyState == 'complete') aspnm_groupMsOut('NavControl__ctl1_group_12', 'NavControl__ctl1_item_11', 'NavControl__ctl1_group_8', 250, null);" cellSpacing="0" cellPadding="0" border="0"><tbody ></tbody></table><table class="MenuGroup" id="NavControl__ctl1_group_13" onmouseover="aspnm_groupMsOver('NavControl__ctl1_group_13')" style="Z-INDEX: 999; LEFT: 0px; VISIBILITY: hidden; POSITION: absolute; TOP: 0px" onmouseout="if (document.readyState == 'complete') aspnm_groupMsOut('NavControl__ctl1_group_13', 'NavControl__ctl1_item_12', 'NavControl__ctl1_group_8', 250, null);" cellSpacing="0" cellPadding="0" border="0"><tbody ></tbody></table><table class="MenuGroup" id="NavControl__ctl1_group_14" onmouseover="aspnm_groupMsOver('NavControl__ctl1_group_14')" style="Z-INDEX: 999; LEFT: 0px; VISIBILITY: hidden; POSITION: absolute; TOP: 0px" onmouseout="if (document.readyState == 'complete') aspnm_groupMsOut('NavControl__ctl1_group_14', 'NavControl__ctl1_item_13', 'NavControl__ctl1_group_8', 250, null);" cellSpacing="0" cellPadding="0" border="0"><tbody ></tbody></table><table class="MenuGroup" id="NavControl__ctl1_group_15" onmouseover="aspnm_groupMsOver('NavControl__ctl1_group_15')" style="Z-INDEX: 999; LEFT: 0px; VISIBILITY: hidden; POSITION: absolute; TOP: 0px" onmouseout="if (document.readyState == 'complete') aspnm_groupMsOut('NavControl__ctl1_group_15', 'NavControl__ctl1_item_14', 'NavControl__ctl1_group_8', 250, null);" cellSpacing="0" cellPadding="0" border="0"><tbody ></tbody></table><table class="MenuGroup" id="NavControl__ctl1_group_16" onmouseover="aspnm_groupMsOver('NavControl__ctl1_group_16')" style="Z-INDEX: 999; LEFT: 0px; VISIBILITY: hidden; POSITION: absolute; TOP: 0px" onmouseout="if (document.readyState == 'complete') aspnm_groupMsOut('NavControl__ctl1_group_16', 'NavControl__ctl1_item_15', 'NavControl__ctl1_group_8', 250, null);" cellSpacing="0" cellPadding="0" border="0"><tbody ></tbody></table><table class="MenuGroup" id="NavControl__ctl1_group_17" onmouseover="aspnm_groupMsOver('NavControl__ctl1_group_17')" style="Z-INDEX: 999; LEFT: 0px; VISIBILITY: hidden; POSITION: absolute; TOP: 0px" onmouseout="if (document.readyState == 'complete') aspnm_groupMsOut('NavControl__ctl1_group_17', 'NavControl__ctl1_item_16', 'NavControl__ctl1_group_8', 250, null);" cellSpacing="0" cellPadding="0" border="0"><tbody ></tbody></table><table class="MenuGroup" id="NavControl__ctl1_group_18" onmouseover="aspnm_groupMsOver('NavControl__ctl1_group_18')" style="Z-INDEX: 999; LEFT: 0px; VISIBILITY: hidden; POSITION: absolute; TOP: 0px" onmouseout="if (document.readyState == 'complete') aspnm_groupMsOut('NavControl__ctl1_group_18', 'NavControl__ctl1_item_17', 'NavControl__ctl1_group_8', 250, null);" cellSpacing="0" cellPadding="0" border="0"><tbody ></tbody></table><table class="MenuGroup" id="NavControl__ctl1_group_19" onmouseover="aspnm_groupMsOver('NavControl__ctl1_group_19')" style="Z-INDEX: 999; LEFT: 0px; VISIBILITY: hidden; POSITION: absolute; TOP: 0px" onmouseout="if (document.readyState == 'complete') aspnm_groupMsOut('NavControl__ctl1_group_19', 'NavControl__ctl1_item_18', 'NavControl__ctl1_group_8', 250, null);" cellSpacing="0" cellPadding="0" border="0"><tbody ></tbody></table><table class="MenuGroup" id="NavControl__ctl1_group_20" onmouseover="aspnm_groupMsOver('NavControl__ctl1_group_20')" style="Z-INDEX: 999; LEFT: 0px; VISIBILITY: hidden; POSITION: absolute; TOP: 0px" onmouseout="if (document.readyState == 'complete') aspnm_groupMsOut('NavControl__ctl1_group_20', 'NavControl__ctl1_item_19', 'NavControl__ctl1_group_8', 250, null);" cellSpacing="0" cellPadding="0" border="0"><tbody ></tbody></table><table class="MenuGroup" id="NavControl__ctl1_group_21" onmouseover="aspnm_groupMsOver('NavControl__ctl1_group_21')" style="Z-INDEX: 999; LEFT: 0px; VISIBILITY: hidden; POSITION: absolute; TOP: 0px" onmouseout="if (document.readyState == 'complete') aspnm_groupMsOut('NavControl__ctl1_group_21', 'NavControl__ctl1_item_20', 'NavControl__ctl1_group_1', 250, null);" cellSpacing="0" cellPadding="0" border="0"><tbody ></tbody></table><table class="MenuGroup" id="NavControl__ctl1_group_22" onmouseover="aspnm_groupMsOver('NavControl__ctl1_group_22')" style="Z-INDEX: 999; LEFT: 0px; VISIBILITY: hidden; POSITION: absolute; TOP: 0px" onmouseout="if (document.readyState == 'complete') aspnm_groupMsOut('NavControl__ctl1_group_22', 'NavControl__ctl1_item_21', 'NavControl__ctl1_group_1', 250, null);" cellSpacing="0" cellPadding="0" border="0"><tbody ></tbody></table><table class="MenuGroup" id="NavControl__ctl1_group_23" onmouseover="aspnm_groupMsOver('NavControl__ctl1_group_23')" style="Z-INDEX: 999; LEFT: 0px; VISIBILITY: hidden; POSITION: absolute; TOP: 0px" onmouseout="if (document.readyState == 'complete') aspnm_groupMsOut('NavControl__ctl1_group_23', 'NavControl__ctl1_item_22', 'NavControl__ctl1_group_1', 250, null);" cellSpacing="0" cellPadding="0" border="0"><tbody ></tbody></table><table class="MenuGroup" id="NavControl__ctl1_group_24" onmouseover="aspnm_groupMsOver('NavControl__ctl1_group_24')" style="Z-INDEX: 999; LEFT: 0px; VISIBILITY: hidden; POSITION: absolute; TOP: 0px" onmouseout="if (document.readyState == 'complete') aspnm_groupMsOut('NavControl__ctl1_group_24', 'NavControl__ctl1_item_23', 'NavControl__ctl1_group_1', 250, null);" cellSpacing="0" cellPadding="0" border="0"><tbody ></tbody></table><table style="LEFT: 0px; VISIBILITY: hidden; POSITION: absolute; TOP: 0px"><tbody ><tr ><td ><br /></td></tr></tbody></table></span></td><td ><img src="/Aims/images/nav-rightend.gif"/></td></tr></tbody></table></td><td vAlign="top" align="left" width="20"><img height="70" alt="" src="/AIMS/images/header-rightend.gif" width="20" border="0"/></td></tr></tbody></table></td></tr><tr ><td width="100%" height="100%"><table height="100%" width="100%" border="0"><tbody ><tr ><td vAlign="top" align="middle"><table border="0"><tbody ><tr ><td align="left"><center ><div id="CustomValidationSummary" style="DISPLAY: none"><div style="DISPLAY: none"></div><table style="BORDER-COLLAPSE: collapse" cellSpacing="0" cellPadding="0"><tbody ><tr ><td ><img src="/AIMS/images/alertLeftTop.gif"/><br /><br /></td><td ><table style="BORDER-COLLAPSE: collapse" cellSpacing="0" cellPadding="0"><tbody ><tr ><td width="50%" background="/AIMS/images/alertHorizontal.gif"><br /><br /></td><td ><img src="/AIMS/images/alert.gif"/><br /><br /></td><td width="50%" background="/AIMS/images/alertHorizontal.gif"><br /><br /></td></tr></tbody></table><br /><br /></td><td ><img src="/AIMS/images/alertRightTop.gif"/><br /><br /></td></tr><tr ><td background="/AIMS/images/alertLeftVertical.gif"><br /><br /></td><td vAlign="center" align="middle"><div id="ValidationSummaryHeader">     Header Text    <br /><br /></div><div id="ValidationSummaryItem" style="DISPLAY: none">    - Item Text    <br /></div><br /><br /></td><td background="/AIMS/images/alertRightVertical.gif"><br /><br /></td></tr><tr ><td ><img src="/AIMS/images/alertLeftBottom.gif"/><br /><br /></td><td background="/AIMS/images/alertHorizontal.gif"><br /><br /></td><td ><img src="/AIMS/images/alertRightBottom.gif"/><br /><br /></td></tr></tbody></table></div></center><input id="Version_FetchMatterVendorSummaryBO" type="hidden" value="0" name="Version_FetchMatterVendorSummaryBO"/><input id="Version_DocumentBO" type="hidden" value="0" name="Version_DocumentBO"/><input id="Version_MatterBO" type="hidden" value="0" name="Version_MatterBO"/><input id="Version_CustomSettingsBO" type="hidden" value="0" name="Version_CustomSettingsBO"/> <table class="Clear"><tbody ><tr ><td class="Title">List Matters</td></tr></tbody></table><br /><div id="Panel1" style="WIDTH: 400px; HEIGHT: 21px"><span class="DCViewListActive">Open</span> <span class="DCViewListActive"> |</span> <a class="DCViewListInactive" id="DCViewLink2" onclick="setView('Closed',this);" href="javascript:__doPostBack('DCViewLink2','')" pagecontext="">Closed</a> <span class="DCViewListActive"> |</span> <a class="DCViewListInactive" id="DCViewLink3" onclick="setView('All',this);" href="javascript:__doPostBack('DCViewLink3','')" pagecontext="">All</a> </div></td></tr><tr ><td ><div id="pnOpen" style="DISPLAY: block; WIDTH: 160px"><table class="Normal"><tbody ><tr class="Header"><td class="Header">Open Matters </td><td align="right"><table class="Invisible"><tbody ><tr ><td ><div id="DCImageButton1" title="Add Matter" onclick="DCImageButton1_onclick(this);return true;" anchorclicked="false"><table style="BORDER-COLLAPSE: collapse" cellSpacing="0" cellPadding="0" width="28" border="0"><tbody ><tr ><td width="1%"><img src="/AIMS/images/bt2Left26gray.gif" border="0"/></td><td style="PADDING-RIGHT: 2px; PADDING-LEFT: 4px" vAlign="center" align="middle" width="98%" background="/AIMS/images/bt2Center26gray.gif"><a class="ButtonText" id="imgbtaDCImageButton1" href="#AimsStandardLink"><nobr ><div class="ButtonText" id="dvbtDCImageButton1Text" style="DISPLAY: inline">Add</div></nobr></a></td><td style="PADDING-RIGHT: 4px; PADDING-LEFT: 2px" vAlign="center" align="middle" width="98%" background="/AIMS/images/bt2Center26gray.gif"><img id="imgbtDCImageButton1" src="/AIMS/images/add.gif" border="0"/></td><td width="1%"><img src="/AIMS/images/bt2Right26gray.gif" border="0"/></td></tr></tbody></table></div></td><td ><div id="DCCollapseButton1" title="" onclick="DCCollapseButton1_onclick(this);return true;" anchorclicked="false"><table style="BORDER-COLLAPSE: collapse" cellSpacing="0" cellPadding="0" width="0" border="0"><tbody ><tr ><td width="1%"><img src="/AIMS/images/bt2Left26gray.gif" border="0"/></td><td style="PADDING-RIGHT: 4px; PADDING-LEFT: 4px" vAlign="center" align="middle" width="98%" background="/AIMS/images/bt2Center26gray.gif"><a class="ButtonText" id="imgbtaDCCollapseButton1" href="#AimsStandardLink"><img id="imgbtDCCollapseButton1" src="/AIMS/images/blue-chevron_up.gif" border="0"/></a></td><td width="1%"><img src="/AIMS/images/bt2Right26gray.gif" border="0"/></td></tr></tbody></table></div><input id="SearchState" type="hidden" value="False" name="SearchState"/></td></tr></tbody></table></td></tr></tbody></table></div><div id="panelSearch" style="DISPLAY: block"><table class="Normal" id="Table1"><tbody ><tr class="Report"><td class="Report"><br /></td><td class="Report"><br /></td><td class="Report"><br /></td><td class="Report" style="WIDTH: 287px"><br /></td><td class="Report"><br /></td></tr><tr class="Report"><td class="Report"><br /></td><td class="Report"><br /></td><td class="Report"><br /></td><td class="Report" style="WIDTH: 283px"><br /></td><td class="Report" align="right"><br /></td></tr></tbody></table></div></td></tr></tbody></table></td></tr></tbody></table></td></tr><tr ><td ><table cellSpacing="0" cellPadding="0" width="100%"><tbody ><tr ><td vAlign="top" align="left" background="/AIMS/images/footer-bkgd.gif" colSpan="3"><img height="17" alt="" src="/AIMS/images/footer-bkgd.gif" width="50" border="0"/></td></tr><tr ><td vAlign="top" align="left" colSpan="3"><font face="verdana" color="#666666" size="1"><br /></font></td></tr></tbody></table></td></tr></tbody></table><input id="ViewLinkId" type="hidden" name="ViewLinkId"/><input id="View" type="hidden" value="Default" name="View"/><input id="CausesValidation" type="hidden" name="CausesValidation"/><input id="RenderLocation" type="hidden" value="Server" name="RenderLocation"/> </form></body>
-</HTML>
+<?xml version="1.0" encoding="iso-8859-1"?>
+<HTML>
+<body onload="RunOnLoads()" ms_positioning="FlowLayout"><form id="CollectiveForm" name="CollectiveForm" action="Matter_List.aspx" method="post" defaultbutton="btSearch"><input type="hidden" name="LinkID"/> <input type="hidden" name="Param"/><input type="hidden" name="__EVENTTARGET"/> <input type="hidden" name="__EVENTARGUMENT"/><input type="hidden" value="dDwtMjA3ODMxNDk3NDt0PDtsPGk8MD47aTwxPjs+O2w8dDxAPC9BSU1TL3N0eWxlc2hlZXRzL0RhdGFDZXJ0U3R5bGUuYXNweDs+Ozs+O3Q8cDxsPGRlZmF1bHRCdXR0b247PjtsPGJ0U2VhcmNoOz4+O2w8aTwxPjtpPDM+O2k8ND47aTw4PjtpPDExPjtpPDEzPjtpPDE1Pjs+O2w8dDxAPC9BSU1TL2ltYWdlcy9oZWFkZXItYWltc2xvZ28uZ2lmOy9BSU1TL2ltYWdlcy9oZWFkZXItYmtnZC5naWY7Pjs7Pjt0PEA8L0FJTVMvaW1hZ2VzL2hlYWRlci1yaWdodGVuZC5naWY7Oz47Oz47dDw7bDxpPDI+Oz47bDx0PDtsPGk8MT47aTwyPjs+O2w8dDxwPDtwPGw8b25wcm9wZXJ0eWNoYW5nZTs+O2w8Q29sbGVjdGl2ZVZhbGlkYXRpb25TdW1tYXJ5X09uUHJvcGVydHlDaGFuZ2UoKTs+Pj47Oz47dDxAPC9BSU1TL2ltYWdlcy9hbGVydExlZnRUb3AuZ2lmOy9BSU1TL2ltYWdlcy9hbGVydEhvcml6b250YWwuZ2lmOy9BSU1TL2ltYWdlcy9hbGVydC5naWY7L0FJTVMvaW1hZ2VzL2FsZXJ0SG9yaXpvbnRhbC5naWY7L0FJTVMvaW1hZ2VzL2FsZXJ0UmlnaHRUb3AuZ2lmOy9BSU1TL2ltYWdlcy9hbGVydExlZnRWZXJ0aWNhbC5naWY7L0FJTVMvaW1hZ2VzL2FsZXJ0UmlnaHRWZXJ0aWNhbC5naWY7L0FJTVMvaW1hZ2VzL2FsZXJ0TGVmdEJvdHRvbS5naWY7L0FJTVMvaW1hZ2VzL2FsZXJ0SG9yaXpvbnRhbC5naWY7L0FJTVMvaW1hZ2VzL2FsZXJ0UmlnaHRCb3R0b20uZ2lmOz47Oz47Pj47Pj47dDw7bDxpPDE+O2k8Mz47aTw3Pjs+O2w8dDxwPHA8bDxUZXh0O2luRXJyb3JTdGF0ZTs+O2w8WTtvPGY+Oz4+O3A8bDxvbmNoYW5nZTtjdXJyZW50dmFsdWU7PjtsPEluZGljYXRlQ2hhbmdlZCh0aGlzLCcnKVw7O1k7Pj4+Ozs+O3Q8cDxwPGw8VGV4dDtpbkVycm9yU3RhdGU7PjtsPE9wZW47bzxmPjs+PjtwPGw8b25jaGFuZ2U7Y3VycmVudHZhbHVlOz47bDxJbmRpY2F0ZUNoYW5nZWQodGhpcywnJylcOztPcGVuOz4+Pjs7Pjt0PHA8cDxsPFRvb2xUaXA7PjtsPFxlOz4+Oz47Oz47Pj47dDw7bDxpPDE+O2k8Mz47aTw1PjtpPDY+O2k8Nz47PjtsPHQ8cDxwPGw8aW5FcnJvclN0YXRlO1RleHQ7PjtsPG88Zj47XGU7Pj47cDxsPG9uY2hhbmdlO2N1cnJlbnR2YWx1ZTs+O2w8SW5kaWNhdGVDaGFuZ2VkKHRoaXMsJycpXDs7XGU7Pj4+Ozs+O3Q8cDxwPGw8aW5FcnJvclN0YXRlO1RleHQ7PjtsPG88Zj47XGU7Pj47cDxsPG9uY2hhbmdlO2N1cnJlbnR2YWx1ZTs+O2w8SW5kaWNhdGVDaGFuZ2VkKHRoaXMsJycpXDs7XGU7Pj4+Ozs+O3Q8cDxwPGw8aW5FcnJvclN0YXRlO1RleHQ7PjtsPG88Zj47XGU7Pj47cDxsPG9uY2hhbmdlO2N1cnJlbnR2YWx1ZTs+O2w8SW5kaWNhdGVDaGFuZ2VkKHRoaXMsJycpXDs7XGU7Pj4+Ozs+O3Q8QDxQcm9mZXNzaW9uYWwgaW4gQ2hhcmdlOz47Oz47dDxwPHA8bDxpbkVycm9yU3RhdGU7VGV4dDs+O2w8bzxmPjtcZTs+PjtwPGw8b25jaGFuZ2U7Y3VycmVudHZhbHVlOz47bDxJbmRpY2F0ZUNoYW5nZWQodGhpcywnJylcOztcZTs+Pj47Oz47Pj47dDxAMDxwPHA8bDxEYXRhS2V5cztQYWdpbmdWaWV3O1RvdGFsUmVjb3JkcztQYWdlQ291bnQ7UGFnZVNpemU7U29ydERpcmVjdGlvbjtVbmlxdWVJZDtTb3J0RXhwcmVzc2lvbjtDdXJyZW50UGFnZTtfIUl0ZW1Db3VudDtfIURhdGFTb3VyY2VJdGVtQ291bnQ7TWF4UGFnZU1vZGU7PjtsPGw8PjtPcGVuO2k8MD47aTwwPjtpPDIwPjtpPDE+O2MxNjA4M2Y4LTkwZjgtNDQ1Ni04YzM0LTc5ZTFhNjg2ZDhlMjttYXR0ZXJfbm87aTwxPjtpPC0xPjtpPC0xPjtEYXRhQ2VydC5XZWIuQ29udHJvbHMuTWF4UGFnZU1vZGUsIERhdGFDZXJ0LldlYiwgVmVyc2lvbj0xLjYuMi4xNCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1udWxsPE5PUk1BTD47Pj47PjtAMDw7OztAMDxwPGw8SGVhZGVyVGV4dDs+O2w8UHJvZmVzc2lvbmFsIGluIENoYXJnZTs+Pjs7Ozs+O0AwPHA8bDxWaXNpYmxlOz47bDxvPHQ+Oz4+Ozs7Oz47Oz47Ozs7Ozs7Ozs+Ozs+O3Q8QDwvQUlNUy9pbWFnZXMvZm9vdGVyLWJrZ2QuZ2lmOy9BSU1TL2ltYWdlcy9mb290ZXItYmtnZC5naWY7MjAwNjs7Pjs7Pjs+Pjs+Pjs+2T4SCaJMpmBYZKv3iwMGME7j8M0=" name="__VIEWSTATE"/> <input id="PageGuid" type="hidden" value="659179a1-bdcc-41f3-8f27-0495ae9356fd" name="PageGuid"/> <table style="BORDER-COLLAPSE: collapse" height="100%" cellSpacing="0" cellPadding="0" width="100%" border="0"><tbody ><tr ><td ><table cellSpacing="0" cellPadding="0" width="100%" border="0"><tbody ><tr ><td vAlign="top" align="left" width="325"><br /></td><td align="right" background="/AIMS/images/header-bkgd.gif"><table style="DISPLAY: inline" cellSpacing="0" cellPadding="0" border="0"><tbody ><tr ><td ><img src="/Aims/images/nav-leftend.gif"/></td><td background="/Aims/images/nav-center.gif"><span ><table id="NavControl__ctl0_group_1" style="Z-INDEX: 999" onmouseout="if (document.readyState == 'complete') aspnm_groupMsOut('NavControl__ctl0_group_1', null, null, 0);" cellSpacing="0" cellPadding="0" border="0"><tbody ><tr ></tr></tbody></table></span><span ><table style="LEFT: 0px; VISIBILITY: hidden; POSITION: absolute; TOP: 0px"><tbody ><tr ><td ><br /></td></tr></tbody></table></span><span ><table class="MenuGroup" id="NavControl__ctl1_group_1" style="Z-INDEX: 999" onmouseout="if (document.readyState == 'complete') aspnm_groupMsOut('NavControl__ctl1_group_1', null, null, 250);" cellSpacing="0" cellPadding="0" border="0"><tbody ><tr ><td class="MenuItem" onmousemove="return false;" id="NavControl__ctl1_item_1" ondblclick="return false;" onmouseover="this.className='MenuItemOver';if (document.readyState == 'complete') aspnm_itemMsOver('NavControl__ctl1_item_1', 'NavControl__ctl1_group_2', 'belowleft', 0, 0, 250, null);" onclick="aspnm_hideAllGroups();Link_OnClick(this.id, '10', '', 'MyWork/Inbox.aspx'); " onmouseout="this.className='MenuItem';if (document.readyState == 'complete') aspnm_itemMsOut('NavControl__ctl1_item_1', 'NavControl__ctl1_group_1', 'NavControl__ctl1_group_2', 250, null);">MY WORK</td><td class="MenuItem" onmousemove="return false;" id="NavControl__ctl1_item_6" ondblclick="return false;" onmouseover="this.className='MenuItemOver';if (document.readyState == 'complete') aspnm_itemMsOver('NavControl__ctl1_item_6', 'NavControl__ctl1_group_7', 'belowleft', 0, 0, 250, null);" onclick="aspnm_hideAllGroups();Link_OnClick(this.id, '1', '', 'Matter/Matter_List.aspx'); " onmouseout="this.className='MenuItem';if (document.readyState == 'complete') aspnm_itemMsOut('NavControl__ctl1_item_6', 'NavControl__ctl1_group_1', 'NavControl__ctl1_group_7', 250, null);">MATTER</td><td class="MenuItem" onmousemove="return false;" id="NavControl__ctl1_item_7" ondblclick="return false;" onmouseover="this.className='MenuItemOver';if (document.readyState == 'complete') aspnm_itemMsOver('NavControl__ctl1_item_7', 'NavControl__ctl1_group_8', 'belowleft', 0, 0, 250, null);" onclick="aspnm_hideAllGroups();Link_OnClick(this.id, '2', '', 'Administrator/Admin_Home.aspx'); " onmouseout="this.className='MenuItem';if (document.readyState == 'complete') aspnm_itemMsOut('NavControl__ctl1_item_7', 'NavControl__ctl1_group_1', 'NavControl__ctl1_group_8', 250, null);">ADMINISTRATOR</td><td class="MenuItem" onmousemove="return false;" id="NavControl__ctl1_item_20" ondblclick="return false;" onmouseover="this.className='MenuItemOver';if (document.readyState == 'complete') aspnm_itemMsOver('NavControl__ctl1_item_20', 'NavControl__ctl1_group_21', 'belowleft', 0, 0, 250, null);" onclick="aspnm_hideAllGroups();Link_OnClick(this.id, '15', '', 'MyWork/AIE.aspx?ClearForm=true'); " onmouseout="this.className='MenuItem';if (document.readyState == 'complete') aspnm_itemMsOut('NavControl__ctl1_item_20', 'NavControl__ctl1_group_1', 'NavControl__ctl1_group_21', 250, null);">AIE</td><td class="MenuItem" onmousemove="return false;" id="NavControl__ctl1_item_21" ondblclick="return false;" onmouseover="this.className='MenuItemOver';if (document.readyState == 'complete') aspnm_itemMsOver('NavControl__ctl1_item_21', 'NavControl__ctl1_group_22', 'belowleft', 0, 0, 250, null);" onclick="aspnm_hideAllGroups();Link_OnClick(this.id, '16', '', 'Reports/ReportsFrontPage.aspx'); " onmouseout="this.className='MenuItem';if (document.readyState == 'complete') aspnm_itemMsOut('NavControl__ctl1_item_21', 'NavControl__ctl1_group_1', 'NavControl__ctl1_group_22', 250, null);">REPORTS</td><td class="MenuItem" onmousemove="return false;" id="NavControl__ctl1_item_22" ondblclick="return false;" onmouseover="this.className='MenuItemOver';if (document.readyState == 'complete') aspnm_itemMsOver('NavControl__ctl1_item_22', 'NavControl__ctl1_group_23', 'belowleft', 0, 0, 250, null);" onclick="aspnm_hideAllGroups();Link_OnClick(this.id, '17', '', 'javascript:window.open(&quot;[appRoot]/Documentation/PubAIMS_3_02/AIMS_Master_Page.htm&quot;)'); " onmouseout="this.className='MenuItem';if (document.readyState == 'complete') aspnm_itemMsOut('NavControl__ctl1_item_22', 'NavControl__ctl1_group_1', 'NavControl__ctl1_group_23', 250, null);">HELP</td><td class="MenuItem" onmousemove="return false;" id="NavControl__ctl1_item_23" ondblclick="return false;" onmouseover="this.className='MenuItemOver';if (document.readyState == 'complete') aspnm_itemMsOver('NavControl__ctl1_item_23', 'NavControl__ctl1_group_24', 'belowleft', 0, 0, 250, null);" onclick="aspnm_hideAllGroups();Link_OnClick(this.id, '34', '', 'Logon.aspx'); " onmouseout="this.className='MenuItem';if (document.readyState == 'complete') aspnm_itemMsOut('NavControl__ctl1_item_23', 'NavControl__ctl1_group_1', 'NavControl__ctl1_group_24', 250, null);">LOGOFF</td></tr></tbody></table></span><span ><table class="MenuGroup" id="NavControl__ctl1_group_2" onmouseover="aspnm_groupMsOver('NavControl__ctl1_group_2')" style="Z-INDEX: 999; LEFT: 0px; VISIBILITY: hidden; POSITION: absolute; TOP: 0px" onmouseout="if (document.readyState == 'complete') aspnm_groupMsOut('NavControl__ctl1_group_2', 'NavControl__ctl1_item_1', 'NavControl__ctl1_group_1', 250, null);" cellSpacing="0" cellPadding="0" border="0"><tbody ><tr ><td class="MenuItem" onmousemove="return false;" id="NavControl__ctl1_item_2" ondblclick="return false;" onmouseover="this.className='MenuItemOver';if (document.readyState == 'complete') aspnm_itemMsOver('NavControl__ctl1_item_2', 'NavControl__ctl1_group_3', 'rightdown', 0, 0, 250, null);" onclick="aspnm_hideAllGroups();Link_OnClick(this.id, '11', '', 'MyWork/Inbox.aspx'); " onmouseout="this.className='MenuItem';if (document.readyState == 'complete') aspnm_itemMsOut('NavControl__ctl1_item_2', 'NavControl__ctl1_group_2', 'NavControl__ctl1_group_3', 250, null);">INBOX</td></tr><tr ><td class="MenuItem" onmousemove="return false;" id="NavControl__ctl1_item_3" ondblclick="return false;" onmouseover="this.className='MenuItemOver';if (document.readyState == 'complete') aspnm_itemMsOver('NavControl__ctl1_item_3', 'NavControl__ctl1_group_4', 'rightdown', 0, 0, 250, null);" onclick="aspnm_hideAllGroups();Link_OnClick(this.id, '12', '', 'MyWork/Coordinator.aspx'); " onmouseout="this.className='MenuItem';if (document.readyState == 'complete') aspnm_itemMsOut('NavControl__ctl1_item_3', 'NavControl__ctl1_group_2', 'NavControl__ctl1_group_4', 250, null);">COORDINATOR</td></tr><tr ><td class="MenuItem" onmousemove="return false;" id="NavControl__ctl1_item_4" ondblclick="return false;" onmouseover="this.className='MenuItemOver';if (document.readyState == 'complete') aspnm_itemMsOver('NavControl__ctl1_item_4', 'NavControl__ctl1_group_5', 'rightdown', 0, 0, 250, null);" onclick="aspnm_hideAllGroups();Link_OnClick(this.id, '13', '', 'MyWork/ErrorManagement.aspx'); " onmouseout="this.className='MenuItem';if (document.readyState == 'complete') aspnm_itemMsOut('NavControl__ctl1_item_4', 'NavControl__ctl1_group_2', 'NavControl__ctl1_group_5', 250, null);">ERROR MANAGER</td></tr><tr ><td class="MenuItem" onmousemove="return false;" id="NavControl__ctl1_item_5" ondblclick="return false;" onmouseover="this.className='MenuItemOver';if (document.readyState == 'complete') aspnm_itemMsOver('NavControl__ctl1_item_5', 'NavControl__ctl1_group_6', 'rightdown', 0, 0, 250, null);" onclick="aspnm_hideAllGroups();Link_OnClick(this.id, '14', '', 'MyWork/Invoice_Search.aspx'); " onmouseout="this.className='MenuItem';if (document.readyState == 'complete') aspnm_itemMsOut('NavControl__ctl1_item_5', 'NavControl__ctl1_group_2', 'NavControl__ctl1_group_6', 250, null);">SEARCH</td></tr></tbody></table><table class="MenuGroup" id="NavControl__ctl1_group_3" onmouseover="aspnm_groupMsOver('NavControl__ctl1_group_3')" style="Z-INDEX: 999; LEFT: 0px; VISIBILITY: hidden; POSITION: absolute; TOP: 0px" onmouseout="if (document.readyState == 'complete') aspnm_groupMsOut('NavControl__ctl1_group_3', 'NavControl__ctl1_item_2', 'NavControl__ctl1_group_2', 250, null);" cellSpacing="0" cellPadding="0" border="0"><tbody ></tbody></table><table class="MenuGroup" id="NavControl__ctl1_group_4" onmouseover="aspnm_groupMsOver('NavControl__ctl1_group_4')" style="Z-INDEX: 999; LEFT: 0px; VISIBILITY: hidden; POSITION: absolute; TOP: 0px" onmouseout="if (document.readyState == 'complete') aspnm_groupMsOut('NavControl__ctl1_group_4', 'NavControl__ctl1_item_3', 'NavControl__ctl1_group_2', 250, null);" cellSpacing="0" cellPadding="0" border="0"><tbody ></tbody></table><table class="MenuGroup" id="NavControl__ctl1_group_5" onmouseover="aspnm_groupMsOver('NavControl__ctl1_group_5')" style="Z-INDEX: 999; LEFT: 0px; VISIBILITY: hidden; POSITION: absolute; TOP: 0px" onmouseout="if (document.readyState == 'complete') aspnm_groupMsOut('NavControl__ctl1_group_5', 'NavControl__ctl1_item_4', 'NavControl__ctl1_group_2', 250, null);" cellSpacing="0" cellPadding="0" border="0"><tbody ></tbody></table><table class="MenuGroup" id="NavControl__ctl1_group_6" onmouseover="aspnm_groupMsOver('NavControl__ctl1_group_6')" style="Z-INDEX: 999; LEFT: 0px; VISIBILITY: hidden; POSITION: absolute; TOP: 0px" onmouseout="if (document.readyState == 'complete') aspnm_groupMsOut('NavControl__ctl1_group_6', 'NavControl__ctl1_item_5', 'NavControl__ctl1_group_2', 250, null);" cellSpacing="0" cellPadding="0" border="0"><tbody ></tbody></table><table class="MenuGroup" id="NavControl__ctl1_group_7" onmouseover="aspnm_groupMsOver('NavControl__ctl1_group_7')" style="Z-INDEX: 999; LEFT: 0px; VISIBILITY: hidden; POSITION: absolute; TOP: 0px" onmouseout="if (document.readyState == 'complete') aspnm_groupMsOut('NavControl__ctl1_group_7', 'NavControl__ctl1_item_6', 'NavControl__ctl1_group_1', 250, null);" cellSpacing="0" cellPadding="0" border="0"><tbody ></tbody></table><table class="MenuGroup" id="NavControl__ctl1_group_8" onmouseover="aspnm_groupMsOver('NavControl__ctl1_group_8')" style="Z-INDEX: 999; LEFT: 0px; VISIBILITY: hidden; POSITION: absolute; TOP: 0px" onmouseout="if (document.readyState == 'complete') aspnm_groupMsOut('NavControl__ctl1_group_8', 'NavControl__ctl1_item_7', 'NavControl__ctl1_group_1', 250, null);" cellSpacing="0" cellPadding="0" border="0"><tbody ><tr ><td class="MenuItem" onmousemove="return false;" id="NavControl__ctl1_item_8" ondblclick="return false;" onmouseover="this.className='MenuItemOver';if (document.readyState == 'complete') aspnm_itemMsOver('NavControl__ctl1_item_8', 'NavControl__ctl1_group_9', 'rightdown', 0, 0, 250, null);" onclick="aspnm_hideAllGroups();Link_OnClick(this.id, '19', '', 'Administrator/GeneralSettings_View.aspx'); " onmouseout="this.className='MenuItem';if (document.readyState == 'complete') aspnm_itemMsOut('NavControl__ctl1_item_8', 'NavControl__ctl1_group_8', 'NavControl__ctl1_group_9', 250, null);">GENERAL SETTINGS</td></tr><tr ><td class="MenuItem" onmousemove="return false;" id="NavControl__ctl1_item_9" ondblclick="return false;" onmouseover="this.className='MenuItemOver';if (document.readyState == 'complete') aspnm_itemMsOver('NavControl__ctl1_item_9', 'NavControl__ctl1_group_10', 'rightdown', 0, 0, 250, null);" onclick="aspnm_hideAllGroups();Link_OnClick(this.id, '30', '', 'Integration/Log_View.aspx'); " onmouseout="this.className='MenuItem';if (document.readyState == 'complete') aspnm_itemMsOut('NavControl__ctl1_item_9', 'NavControl__ctl1_group_8', 'NavControl__ctl1_group_10', 250, null);">INTEGRATION LOG</td></tr><tr ><td class="MenuItem" onmousemove="return false;" id="NavControl__ctl1_item_10" ondblclick="return false;" onmouseover="this.className='MenuItemOver';if (document.readyState == 'complete') aspnm_itemMsOver('NavControl__ctl1_item_10', 'NavControl__ctl1_group_11', 'rightdown', 0, 0, 250, null);" onclick="aspnm_hideAllGroups();Link_OnClick(this.id, '20', '', 'Administrator/Lookup_List.aspx'); " onmouseout="this.className='MenuItem';if (document.readyState == 'complete') aspnm_itemMsOut('NavControl__ctl1_item_10', 'NavControl__ctl1_group_8', 'NavControl__ctl1_group_11', 250, null);">LOOKUPS</td></tr><tr ><td class="MenuItem" onmousemove="return false;" id="NavControl__ctl1_item_11" ondblclick="return false;" onmouseover="this.className='MenuItemOver';if (document.readyState == 'complete') aspnm_itemMsOver('NavControl__ctl1_item_11', 'NavControl__ctl1_group_12', 'rightdown', 0, 0, 250, null);" onclick="aspnm_hideAllGroups();Link_OnClick(this.id, '37', '', 'NotificationLog/Log_View.aspx'); " onmouseout="this.className='MenuItem';if (document.readyState == 'complete') aspnm_itemMsOut('NavControl__ctl1_item_11', 'NavControl__ctl1_group_8', 'NavControl__ctl1_group_12', 250, null);">NOTIFICATION LOG</td></tr><tr ><td class="MenuItem" onmousemove="return false;" id="NavControl__ctl1_item_12" ondblclick="return false;" onmouseover="this.className='MenuItemOver';if (document.readyState == 'complete') aspnm_itemMsOver('NavControl__ctl1_item_12', 'NavControl__ctl1_group_13', 'rightdown', 0, 0, 250, null);" onclick="aspnm_hideAllGroups();Link_OnClick(this.id, '7', '', 'Administrator/MatterType_List.aspx'); " onmouseout="this.className='MenuItem';if (document.readyState == 'complete') aspnm_itemMsOut('NavControl__ctl1_item_12', 'NavControl__ctl1_group_8', 'NavControl__ctl1_group_13', 250, null);">MATTER TYPES</td></tr><tr ><td class="MenuItem" onmousemove="return false;" id="NavControl__ctl1_item_13" ondblclick="return false;" onmouseover="this.className='MenuItemOver';if (document.readyState == 'complete') aspnm_itemMsOver('NavControl__ctl1_item_13', 'NavControl__ctl1_group_14', 'rightdown', 0, 0, 250, null);" onclick="aspnm_hideAllGroups();Link_OnClick(this.id, '6', '', 'Professional/Prof_List.aspx'); " onmouseout="this.className='MenuItem';if (document.readyState == 'complete') aspnm_itemMsOut('NavControl__ctl1_item_13', 'NavControl__ctl1_group_8', 'NavControl__ctl1_group_14', 250, null);">PROFESSIONALS</td></tr><tr ><td class="MenuItem" onmousemove="return false;" id="NavControl__ctl1_item_14" ondblclick="return false;" onmouseover="this.className='MenuItemOver';if (document.readyState == 'complete') aspnm_itemMsOver('NavControl__ctl1_item_14', 'NavControl__ctl1_group_15', 'rightdown', 0, 0, 250, null);" onclick="aspnm_hideAllGroups();Link_OnClick(this.id, '9', '', 'Vendor/Vendor_List.aspx'); " onmouseout="this.className='MenuItem';if (document.readyState == 'complete') aspnm_itemMsOut('NavControl__ctl1_item_14', 'NavControl__ctl1_group_8', 'NavControl__ctl1_group_15', 250, null);">VENDORS</td></tr><tr ><td class="MenuItem" onmousemove="return false;" id="NavControl__ctl1_item_15" ondblclick="return false;" onmouseover="this.className='MenuItemOver';if (document.readyState == 'complete') aspnm_itemMsOver('NavControl__ctl1_item_15', 'NavControl__ctl1_group_16', 'rightdown', 0, 0, 250, null);" onclick="aspnm_hideAllGroups();Link_OnClick(this.id, '32', '', 'Workflow/WorkflowTitle_List.aspx'); " onmouseout="this.className='MenuItem';if (document.readyState == 'complete') aspnm_itemMsOut('NavControl__ctl1_item_15', 'NavControl__ctl1_group_8', 'NavControl__ctl1_group_16', 250, null);">WORKFLOW TITLES</td></tr><tr ><td class="MenuItem" onmousemove="return false;" id="NavControl__ctl1_item_16" ondblclick="return false;" onmouseover="this.className='MenuItemOver';if (document.readyState == 'complete') aspnm_itemMsOver('NavControl__ctl1_item_16', 'NavControl__ctl1_group_17', 'rightdown', 0, 0, 250, null);" onclick="aspnm_hideAllGroups();Link_OnClick(this.id, '36', '', 'Professional/Prof_SubList.aspx'); " onmouseout="this.className='MenuItem';if (document.readyState == 'complete') aspnm_itemMsOut('NavControl__ctl1_item_16', 'NavControl__ctl1_group_8', 'NavControl__ctl1_group_17', 250, null);">WORKFLOW SEARCH-REPLACE</td></tr><tr ><td class="MenuItem" onmousemove="return false;" id="NavControl__ctl1_item_17" ondblclick="return false;" onmouseover="this.className='MenuItemOver';if (document.readyState == 'complete') aspnm_itemMsOver('NavControl__ctl1_item_17', 'NavControl__ctl1_group_18', 'rightdown', 0, 0, 250, null);" onclick="aspnm_hideAllGroups();Link_OnClick(this.id, '5', '', 'Workgroup/Workgroup_List.aspx'); " onmouseout="this.className='MenuItem';if (document.readyState == 'complete') aspnm_itemMsOut('NavControl__ctl1_item_17', 'NavControl__ctl1_group_8', 'NavControl__ctl1_group_18', 250, null);">WORKGROUPS</td></tr><tr ><td class="MenuItem" onmousemove="return false;" id="NavControl__ctl1_item_18" ondblclick="return false;" onmouseover="this.className='MenuItemOver';if (document.readyState == 'complete') aspnm_itemMsOver('NavControl__ctl1_item_18', 'NavControl__ctl1_group_19', 'rightdown', 0, 0, 250, null);" onclick="aspnm_hideAllGroups();Link_OnClick(this.id, '33', '', 'Administrator/System_View.aspx'); " onmouseout="this.className='MenuItem';if (document.readyState == 'complete') aspnm_itemMsOut('NavControl__ctl1_item_18', 'NavControl__ctl1_group_8', 'NavControl__ctl1_group_19', 250, null);">SYSTEM POLICY</td></tr><tr ><td class="MenuItem" onmousemove="return false;" id="NavControl__ctl1_item_19" ondblclick="return false;" onmouseover="this.className='MenuItemOver';if (document.readyState == 'complete') aspnm_itemMsOver('NavControl__ctl1_item_19', 'NavControl__ctl1_group_20', 'rightdown', 0, 0, 250, null);" onclick="aspnm_hideAllGroups();Link_OnClick(this.id, '18', '', 'Timekeeper/TimekeeperClassification_List.aspx'); " onmouseout="this.className='MenuItem';if (document.readyState == 'complete') aspnm_itemMsOut('NavControl__ctl1_item_19', 'NavControl__ctl1_group_8', 'NavControl__ctl1_group_20', 250, null);">TIMEKEEPER CLASSIFICATIONS</td></tr></tbody></table><table class="MenuGroup" id="NavControl__ctl1_group_9" onmouseover="aspnm_groupMsOver('NavControl__ctl1_group_9')" style="Z-INDEX: 999; LEFT: 0px; VISIBILITY: hidden; POSITION: absolute; TOP: 0px" onmouseout="if (document.readyState == 'complete') aspnm_groupMsOut('NavControl__ctl1_group_9', 'NavControl__ctl1_item_8', 'NavControl__ctl1_group_8', 250, null);" cellSpacing="0" cellPadding="0" border="0"><tbody ></tbody></table><table class="MenuGroup" id="NavControl__ctl1_group_10" onmouseover="aspnm_groupMsOver('NavControl__ctl1_group_10')" style="Z-INDEX: 999; LEFT: 0px; VISIBILITY: hidden; POSITION: absolute; TOP: 0px" onmouseout="if (document.readyState == 'complete') aspnm_groupMsOut('NavControl__ctl1_group_10', 'NavControl__ctl1_item_9', 'NavControl__ctl1_group_8', 250, null);" cellSpacing="0" cellPadding="0" border="0"><tbody ></tbody></table><table class="MenuGroup" id="NavControl__ctl1_group_11" onmouseover="aspnm_groupMsOver('NavControl__ctl1_group_11')" style="Z-INDEX: 999; LEFT: 0px; VISIBILITY: hidden; POSITION: absolute; TOP: 0px" onmouseout="if (document.readyState == 'complete') aspnm_groupMsOut('NavControl__ctl1_group_11', 'NavControl__ctl1_item_10', 'NavControl__ctl1_group_8', 250, null);" cellSpacing="0" cellPadding="0" border="0"><tbody ></tbody></table><table class="MenuGroup" id="NavControl__ctl1_group_12" onmouseover="aspnm_groupMsOver('NavControl__ctl1_group_12')" style="Z-INDEX: 999; LEFT: 0px; VISIBILITY: hidden; POSITION: absolute; TOP: 0px" onmouseout="if (document.readyState == 'complete') aspnm_groupMsOut('NavControl__ctl1_group_12', 'NavControl__ctl1_item_11', 'NavControl__ctl1_group_8', 250, null);" cellSpacing="0" cellPadding="0" border="0"><tbody ></tbody></table><table class="MenuGroup" id="NavControl__ctl1_group_13" onmouseover="aspnm_groupMsOver('NavControl__ctl1_group_13')" style="Z-INDEX: 999; LEFT: 0px; VISIBILITY: hidden; POSITION: absolute; TOP: 0px" onmouseout="if (document.readyState == 'complete') aspnm_groupMsOut('NavControl__ctl1_group_13', 'NavControl__ctl1_item_12', 'NavControl__ctl1_group_8', 250, null);" cellSpacing="0" cellPadding="0" border="0"><tbody ></tbody></table><table class="MenuGroup" id="NavControl__ctl1_group_14" onmouseover="aspnm_groupMsOver('NavControl__ctl1_group_14')" style="Z-INDEX: 999; LEFT: 0px; VISIBILITY: hidden; POSITION: absolute; TOP: 0px" onmouseout="if (document.readyState == 'complete') aspnm_groupMsOut('NavControl__ctl1_group_14', 'NavControl__ctl1_item_13', 'NavControl__ctl1_group_8', 250, null);" cellSpacing="0" cellPadding="0" border="0"><tbody ></tbody></table><table class="MenuGroup" id="NavControl__ctl1_group_15" onmouseover="aspnm_groupMsOver('NavControl__ctl1_group_15')" style="Z-INDEX: 999; LEFT: 0px; VISIBILITY: hidden; POSITION: absolute; TOP: 0px" onmouseout="if (document.readyState == 'complete') aspnm_groupMsOut('NavControl__ctl1_group_15', 'NavControl__ctl1_item_14', 'NavControl__ctl1_group_8', 250, null);" cellSpacing="0" cellPadding="0" border="0"><tbody ></tbody></table><table class="MenuGroup" id="NavControl__ctl1_group_16" onmouseover="aspnm_groupMsOver('NavControl__ctl1_group_16')" style="Z-INDEX: 999; LEFT: 0px; VISIBILITY: hidden; POSITION: absolute; TOP: 0px" onmouseout="if (document.readyState == 'complete') aspnm_groupMsOut('NavControl__ctl1_group_16', 'NavControl__ctl1_item_15', 'NavControl__ctl1_group_8', 250, null);" cellSpacing="0" cellPadding="0" border="0"><tbody ></tbody></table><table class="MenuGroup" id="NavControl__ctl1_group_17" onmouseover="aspnm_groupMsOver('NavControl__ctl1_group_17')" style="Z-INDEX: 999; LEFT: 0px; VISIBILITY: hidden; POSITION: absolute; TOP: 0px" onmouseout="if (document.readyState == 'complete') aspnm_groupMsOut('NavControl__ctl1_group_17', 'NavControl__ctl1_item_16', 'NavControl__ctl1_group_8', 250, null);" cellSpacing="0" cellPadding="0" border="0"><tbody ></tbody></table><table class="MenuGroup" id="NavControl__ctl1_group_18" onmouseover="aspnm_groupMsOver('NavControl__ctl1_group_18')" style="Z-INDEX: 999; LEFT: 0px; VISIBILITY: hidden; POSITION: absolute; TOP: 0px" onmouseout="if (document.readyState == 'complete') aspnm_groupMsOut('NavControl__ctl1_group_18', 'NavControl__ctl1_item_17', 'NavControl__ctl1_group_8', 250, null);" cellSpacing="0" cellPadding="0" border="0"><tbody ></tbody></table><table class="MenuGroup" id="NavControl__ctl1_group_19" onmouseover="aspnm_groupMsOver('NavControl__ctl1_group_19')" style="Z-INDEX: 999; LEFT: 0px; VISIBILITY: hidden; POSITION: absolute; TOP: 0px" onmouseout="if (document.readyState == 'complete') aspnm_groupMsOut('NavControl__ctl1_group_19', 'NavControl__ctl1_item_18', 'NavControl__ctl1_group_8', 250, null);" cellSpacing="0" cellPadding="0" border="0"><tbody ></tbody></table><table class="MenuGroup" id="NavControl__ctl1_group_20" onmouseover="aspnm_groupMsOver('NavControl__ctl1_group_20')" style="Z-INDEX: 999; LEFT: 0px; VISIBILITY: hidden; POSITION: absolute; TOP: 0px" onmouseout="if (document.readyState == 'complete') aspnm_groupMsOut('NavControl__ctl1_group_20', 'NavControl__ctl1_item_19', 'NavControl__ctl1_group_8', 250, null);" cellSpacing="0" cellPadding="0" border="0"><tbody ></tbody></table><table class="MenuGroup" id="NavControl__ctl1_group_21" onmouseover="aspnm_groupMsOver('NavControl__ctl1_group_21')" style="Z-INDEX: 999; LEFT: 0px; VISIBILITY: hidden; POSITION: absolute; TOP: 0px" onmouseout="if (document.readyState == 'complete') aspnm_groupMsOut('NavControl__ctl1_group_21', 'NavControl__ctl1_item_20', 'NavControl__ctl1_group_1', 250, null);" cellSpacing="0" cellPadding="0" border="0"><tbody ></tbody></table><table class="MenuGroup" id="NavControl__ctl1_group_22" onmouseover="aspnm_groupMsOver('NavControl__ctl1_group_22')" style="Z-INDEX: 999; LEFT: 0px; VISIBILITY: hidden; POSITION: absolute; TOP: 0px" onmouseout="if (document.readyState == 'complete') aspnm_groupMsOut('NavControl__ctl1_group_22', 'NavControl__ctl1_item_21', 'NavControl__ctl1_group_1', 250, null);" cellSpacing="0" cellPadding="0" border="0"><tbody ></tbody></table><table class="MenuGroup" id="NavControl__ctl1_group_23" onmouseover="aspnm_groupMsOver('NavControl__ctl1_group_23')" style="Z-INDEX: 999; LEFT: 0px; VISIBILITY: hidden; POSITION: absolute; TOP: 0px" onmouseout="if (document.readyState == 'complete') aspnm_groupMsOut('NavControl__ctl1_group_23', 'NavControl__ctl1_item_22', 'NavControl__ctl1_group_1', 250, null);" cellSpacing="0" cellPadding="0" border="0"><tbody ></tbody></table><table class="MenuGroup" id="NavControl__ctl1_group_24" onmouseover="aspnm_groupMsOver('NavControl__ctl1_group_24')" style="Z-INDEX: 999; LEFT: 0px; VISIBILITY: hidden; POSITION: absolute; TOP: 0px" onmouseout="if (document.readyState == 'complete') aspnm_groupMsOut('NavControl__ctl1_group_24', 'NavControl__ctl1_item_23', 'NavControl__ctl1_group_1', 250, null);" cellSpacing="0" cellPadding="0" border="0"><tbody ></tbody></table><table style="LEFT: 0px; VISIBILITY: hidden; POSITION: absolute; TOP: 0px"><tbody ><tr ><td ><br /></td></tr></tbody></table></span></td><td ><img src="/Aims/images/nav-rightend.gif"/></td></tr></tbody></table></td><td vAlign="top" align="left" width="20"><img height="70" alt="" src="/AIMS/images/header-rightend.gif" width="20" border="0"/></td></tr></tbody></table></td></tr><tr ><td width="100%" height="100%"><table height="100%" width="100%" border="0"><tbody ><tr ><td vAlign="top" align="middle"><table border="0"><tbody ><tr ><td align="left"><center ><div id="CustomValidationSummary" style="DISPLAY: none"><div style="DISPLAY: none"></div><table style="BORDER-COLLAPSE: collapse" cellSpacing="0" cellPadding="0"><tbody ><tr ><td ><img src="/AIMS/images/alertLeftTop.gif"/><br /><br /></td><td ><table style="BORDER-COLLAPSE: collapse" cellSpacing="0" cellPadding="0"><tbody ><tr ><td width="50%" background="/AIMS/images/alertHorizontal.gif"><br /><br /></td><td ><img src="/AIMS/images/alert.gif"/><br /><br /></td><td width="50%" background="/AIMS/images/alertHorizontal.gif"><br /><br /></td></tr></tbody></table><br /><br /></td><td ><img src="/AIMS/images/alertRightTop.gif"/><br /><br /></td></tr><tr ><td background="/AIMS/images/alertLeftVertical.gif"><br /><br /></td><td vAlign="center" align="middle"><div id="ValidationSummaryHeader">     Header Text    <br /><br /></div><div id="ValidationSummaryItem" style="DISPLAY: none">    - Item Text    <br /></div><br /><br /></td><td background="/AIMS/images/alertRightVertical.gif"><br /><br /></td></tr><tr ><td ><img src="/AIMS/images/alertLeftBottom.gif"/><br /><br /></td><td background="/AIMS/images/alertHorizontal.gif"><br /><br /></td><td ><img src="/AIMS/images/alertRightBottom.gif"/><br /><br /></td></tr></tbody></table></div></center><input id="Version_FetchMatterVendorSummaryBO" type="hidden" value="0" name="Version_FetchMatterVendorSummaryBO"/><input id="Version_DocumentBO" type="hidden" value="0" name="Version_DocumentBO"/><input id="Version_MatterBO" type="hidden" value="0" name="Version_MatterBO"/><input id="Version_CustomSettingsBO" type="hidden" value="0" name="Version_CustomSettingsBO"/> <table class="Clear"><tbody ><tr ><td class="Title">List Matters</td></tr></tbody></table><br /><div id="Panel1" style="WIDTH: 400px; HEIGHT: 21px"><span class="DCViewListActive">Open</span> <span class="DCViewListActive"> |</span> <a class="DCViewListInactive" id="DCViewLink2" onclick="setView('Closed',this);" href="javascript:__doPostBack('DCViewLink2','')" pagecontext="">Closed</a> <span class="DCViewListActive"> |</span> <a class="DCViewListInactive" id="DCViewLink3" onclick="setView('All',this);" href="javascript:__doPostBack('DCViewLink3','')" pagecontext="">All</a> </div></td></tr><tr ><td ><div id="pnOpen" style="DISPLAY: block; WIDTH: 160px"><table class="Normal"><tbody ><tr class="Header"><td class="Header">Open Matters </td><td align="right"><table class="Invisible"><tbody ><tr ><td ><div id="DCImageButton1" title="Add Matter" onclick="DCImageButton1_onclick(this);return true;" anchorclicked="false"><table style="BORDER-COLLAPSE: collapse" cellSpacing="0" cellPadding="0" width="28" border="0"><tbody ><tr ><td width="1%"><img src="/AIMS/images/bt2Left26gray.gif" border="0"/></td><td style="PADDING-RIGHT: 2px; PADDING-LEFT: 4px" vAlign="center" align="middle" width="98%" background="/AIMS/images/bt2Center26gray.gif"><a class="ButtonText" id="imgbtaDCImageButton1" href="#AimsStandardLink"><nobr ><div class="ButtonText" id="dvbtDCImageButton1Text" style="DISPLAY: inline">Add</div></nobr></a></td><td style="PADDING-RIGHT: 4px; PADDING-LEFT: 2px" vAlign="center" align="middle" width="98%" background="/AIMS/images/bt2Center26gray.gif"><img id="imgbtDCImageButton1" src="/AIMS/images/add.gif" border="0"/></td><td width="1%"><img src="/AIMS/images/bt2Right26gray.gif" border="0"/></td></tr></tbody></table></div></td><td ><div id="DCCollapseButton1" title="" onclick="DCCollapseButton1_onclick(this);return true;" anchorclicked="false"><table style="BORDER-COLLAPSE: collapse" cellSpacing="0" cellPadding="0" width="0" border="0"><tbody ><tr ><td width="1%"><img src="/AIMS/images/bt2Left26gray.gif" border="0"/></td><td style="PADDING-RIGHT: 4px; PADDING-LEFT: 4px" vAlign="center" align="middle" width="98%" background="/AIMS/images/bt2Center26gray.gif"><a class="ButtonText" id="imgbtaDCCollapseButton1" href="#AimsStandardLink"><img id="imgbtDCCollapseButton1" src="/AIMS/images/blue-chevron_up.gif" border="0"/></a></td><td width="1%"><img src="/AIMS/images/bt2Right26gray.gif" border="0"/></td></tr></tbody></table></div><input id="SearchState" type="hidden" value="False" name="SearchState"/></td></tr></tbody></table></td></tr></tbody></table></div><div id="panelSearch" style="DISPLAY: block"><table class="Normal" id="Table1"><tbody ><tr class="Report"><td class="Report"><br /></td><td class="Report"><br /></td><td class="Report"><br /></td><td class="Report" style="WIDTH: 287px"><br /></td><td class="Report"><br /></td></tr><tr class="Report"><td class="Report"><br /></td><td class="Report"><br /></td><td class="Report"><br /></td><td class="Report" style="WIDTH: 283px"><br /></td><td class="Report" align="right"><br /></td></tr></tbody></table></div></td></tr></tbody></table></td></tr></tbody></table></td></tr><tr ><td ><table cellSpacing="0" cellPadding="0" width="100%"><tbody ><tr ><td vAlign="top" align="left" background="/AIMS/images/footer-bkgd.gif" colSpan="3"><img height="17" alt="" src="/AIMS/images/footer-bkgd.gif" width="50" border="0"/></td></tr><tr ><td vAlign="top" align="left" colSpan="3"><font face="verdana" color="#666666" size="1"><br /></font></td></tr></tbody></table></td></tr></tbody></table><input id="ViewLinkId" type="hidden" name="ViewLinkId"/><input id="View" type="hidden" value="Default" name="View"/><input id="CausesValidation" type="hidden" name="CausesValidation"/><input id="RenderLocation" type="hidden" value="Server" name="RenderLocation"/> </form></body>
+</HTML>
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..7d527a5fe8
--- /dev/null
+++ b/test/rexml/parse/test_document_type_declaration.rb
@@ -0,0 +1,47 @@
+require "test/unit"
+require "rexml/document"
+
+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
diff --git a/test/rexml/parse/test_notation_declaration.rb b/test/rexml/parse/test_notation_declaration.rb
new file mode 100644
index 0000000000..45688858c0
--- /dev/null
+++ b/test/rexml/parse/test_notation_declaration.rb
@@ -0,0 +1,97 @@
+require 'test/unit'
+require 'rexml/document'
+
+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
diff --git a/test/rexml/parser/test_sax2.rb b/test/rexml/parser/test_sax2.rb
new file mode 100644
index 0000000000..f836c060c8
--- /dev/null
+++ b/test/rexml/parser/test_sax2.rb
@@ -0,0 +1,200 @@
+require "test/unit"
+require "rexml/parsers/sax2parser"
+require "rexml/sax2listener"
+
+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
diff --git a/test/rexml/parser/test_tree.rb b/test/rexml/parser/test_tree.rb
new file mode 100644
index 0000000000..c1a1dbb580
--- /dev/null
+++ b/test/rexml/parser/test_tree.rb
@@ -0,0 +1,40 @@
+require "test/unit"
+require "rexml/document"
+require "rexml/parsers/treeparser"
+
+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
diff --git a/test/rexml/parser/test_ultra_light.rb b/test/rexml/parser/test_ultra_light.rb
new file mode 100644
index 0000000000..852aa5bf6d
--- /dev/null
+++ b/test/rexml/parser/test_ultra_light.rb
@@ -0,0 +1,67 @@
+require "test/unit"
+require "rexml/parsers/ultralightparser"
+
+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
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..f9c09876f7 100644
--- a/test/rexml/test_attributes.rb
+++ b/test/rexml/test_attributes.rb
@@ -195,4 +195,26 @@ class AttributesTester < Test::Unit::TestCase
doc.add_element 'a', { 'v' => 'x & y' }
assert doc.to_s.index(';')
end
+
+ 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
diff --git a/test/rexml/test_attributes_mixin.rb b/test/rexml/test_attributes_mixin.rb
index 50899d0607..f0659eb6ed 100644
--- a/test/rexml/test_attributes_mixin.rb
+++ b/test/rexml/test_attributes_mixin.rb
@@ -1,6 +1,3 @@
-#! /usr/local/bin/ruby
-
-
require 'test/unit'
require 'rexml/document'
diff --git a/test/rexml/test_changing_encoding.rb b/test/rexml/test_changing_encoding.rb
index c6c1f59a1a..fdcc075c37 100644
--- a/test/rexml/test_changing_encoding.rb
+++ b/test/rexml/test_changing_encoding.rb
@@ -1,4 +1,3 @@
-#!/usr/bin/ruby -Ku
# -*- coding: utf-8 -*-
require 'rexml/encoding'
diff --git a/test/rexml/test_contrib.rb b/test/rexml/test_contrib.rb
index 7d00202c95..d97b5a7753 100644
--- a/test/rexml/test_contrib.rb
+++ b/test/rexml/test_contrib.rb
@@ -1,6 +1,6 @@
# coding: binary
-require "rexml_test_utils"
+require_relative "rexml_test_utils"
require "rexml/document"
require "rexml/parseexception"
@@ -221,7 +221,7 @@ DELIMITER
<type>Book</type>
<year>2000</year>
</entry>"
- desired_result_tree = Document.new desired_result_string
+ Document.new desired_result_string
xpath = "/biblio/entry[not(author)]"
result = XPath.first(doc, xpath)
assert_equal desired_result_string, result.to_s
@@ -438,7 +438,7 @@ EOF
end
def test_whitespace_after_xml_decl
- d = Document.new <<EOL
+ Document.new <<EOL
<?xml version='1.0'?>
<blo>
<wak>
@@ -506,13 +506,13 @@ EOL
b << c
a << b
- REXML::Formatters::Pretty.new.write(a,s="")
+ REXML::Formatters::Pretty.new.write(a,"")
end
def test_pos
require 'tempfile'
- testfile = Tempfile.new("tidal")
- testdata = %Q{<calibration>
+ Tempfile.create("tidal") {|testfile|
+ testdata = %Q{<calibration>
<section name="parameters">
<param name="barpress">760</param>
<param name="hertz">50</param>
@@ -520,12 +520,12 @@ EOL
</calibration>
}
- testfile.puts testdata
- testfile.rewind
- assert_nothing_raised do
- d = REXML::Document.new(testfile)
- end
- testfile.close(true)
+ testfile.puts testdata
+ testfile.rewind
+ assert_nothing_raised do
+ REXML::Document.new(testfile)
+ end
+ }
end
def test_deep_clone
diff --git a/test/rexml/test_core.rb b/test/rexml/test_core.rb
index e530cc16c6..7040ad60bf 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,7 +9,7 @@ require "rexml/source"
require "rexml/formatters/pretty"
require "rexml/undefinednamespaceexception"
-require "listener"
+require_relative "listener"
class Tester < Test::Unit::TestCase
include REXMLTestUtils
@@ -1176,34 +1176,34 @@ EOL
element0
element0
element0
- element0
+ element0\s
<element1>
element1
element1
element1
element1
- element1
+ element1\s
<element2>
element2
element2
element2
element2
- element2
+ element2\s
<element3>
element3
element3
element3
element3
- element3
+ element3\s
<element4>
element4
element4
element4
element4
element4
-
+ \s
<element5>
- element5 element5 element5 element5 element5
+ element5 element5 element5 element5 element5\s
</element5>
</element4>
</element3>
diff --git a/test/rexml/test_doctype.rb b/test/rexml/test_doctype.rb
index 0a87c0a304..6473ce17e5 100644
--- a/test/rexml/test_doctype.rb
+++ b/test/rexml/test_doctype.rb
@@ -1,6 +1,3 @@
-#! /usr/local/bin/ruby
-
-
require 'test/unit'
require 'rexml/document'
diff --git a/test/rexml/test_document.rb b/test/rexml/test_document.rb
index ab0b1e4e96..cec9452373 100644
--- a/test/rexml/test_document.rb
+++ b/test/rexml/test_document.rb
@@ -65,24 +65,24 @@ EOF
assert_raise(RuntimeError) do
doc.root.children.first.value
end
- REXML::Document.entity_expansion_limit = 100
- assert_equal(100, REXML::Document.entity_expansion_limit)
+ 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
+ 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::Document.entity_expansion_limit = 3
+ 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::Document.entity_expansion_limit = 10000
+ REXML::Security.entity_expansion_limit = 10000
end
def test_tag_in_cdata_with_not_ascii_only_but_ascii8bit_encoding_source
@@ -106,4 +106,214 @@ EOX
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)
+<?xml version="1.0" encoding="UTF-8"?>
+<message>Hello world!</message>
+EOX
+ end
+
+ 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
+
+ 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
+
+ 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
+
+ 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"
+
+ @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
+
+ 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
+
+ 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
+
+ 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
+
+ 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)
+<?xml version='1.0' encoding='SHIFT_JIS'?>
+<message>#{japanese_text}</message>
+EOX
+ end
+ end
+ end
+
+ 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
+
+ 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
+
+ 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)
+ end
+ end
+
+ 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
+
+ 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
+
+ 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)
+ end
+ end
+
+ 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)
+
+ 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)
+ end
+ end
+ end
end
diff --git a/test/rexml/test_encoding.rb b/test/rexml/test_encoding.rb
index 8b93460e6c..a3fda1e392 100644
--- a/test/rexml/test_encoding.rb
+++ b/test/rexml/test_encoding.rb
@@ -1,6 +1,6 @@
# coding: binary
-require "rexml_test_utils"
+require_relative "rexml_test_utils"
require 'rexml/source'
require 'rexml/document'
@@ -10,8 +10,9 @@ class EncodingTester < Test::Unit::TestCase
include REXML
def setup
+ @encoded_root = "<a><b>\346</b></a>"
@encoded = "<?xml version='1.0' encoding='ISO-8859-3'?>"+
- "<a><b>\346</b></a>"
+ @encoded_root
@not_encoded = "<a><b>ĉ</b></a>"
end
@@ -59,7 +60,7 @@ class EncodingTester < Test::Unit::TestCase
doc = Document.new( @not_encoded )
doc.write( Output.new( out="", "ISO-8859-3" ) )
out.force_encoding(::Encoding::ASCII_8BIT)
- assert_equal( @encoded, out )
+ assert_equal( "<?xml version='1.0'?>#{@encoded_root}", out )
end
# * Given an encoded document, accessing text and attribute nodes
diff --git a/test/rexml/test_entity.rb b/test/rexml/test_entity.rb
index 5900fac7a8..7b9f39495f 100644
--- a/test/rexml/test_entity.rb
+++ b/test/rexml/test_entity.rb
@@ -164,4 +164,24 @@ class EntityTester < Test::Unit::TestCase
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
diff --git a/test/rexml/test_jaxen.rb b/test/rexml/test_jaxen.rb
index 222cf79c60..05cb818a6b 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"
diff --git a/test/rexml/test_light.rb b/test/rexml/test_light.rb
index 1b56159254..9ce0fb52d8 100644
--- a/test/rexml/test_light.rb
+++ b/test/rexml/test_light.rb
@@ -1,4 +1,4 @@
-require "rexml_test_utils"
+require_relative "rexml_test_utils"
require "rexml/light/node"
require "rexml/parsers/lightparser"
diff --git a/test/rexml/test_lightparser.rb b/test/rexml/test_lightparser.rb
index ee33dc08fd..c32c1b8ee7 100644
--- a/test/rexml/test_lightparser.rb
+++ b/test/rexml/test_lightparser.rb
@@ -1,4 +1,4 @@
-require 'rexml_test_utils'
+require_relative 'rexml_test_utils'
require 'rexml/parsers/lightparser'
class LightParserTester < Test::Unit::TestCase
@@ -7,6 +7,6 @@ class LightParserTester < Test::Unit::TestCase
def test_parsing
f = File.new(fixture_path("documentation.xml"))
parser = REXML::Parsers::LightParser.new( f )
- root = parser.parse
+ parser.parse
end
end
diff --git a/test/rexml/test_listener.rb b/test/rexml/test_listener.rb
index 0afbdcd5ff..a3d763c5da 100644
--- a/test/rexml/test_listener.rb
+++ b/test/rexml/test_listener.rb
@@ -1,6 +1,6 @@
# coding: binary
-require 'rexml_test_utils'
+require_relative 'rexml_test_utils'
require 'rexml/document'
require 'rexml/streamlistener'
@@ -82,16 +82,16 @@ class BaseTester < Test::Unit::TestCase
end
def test_accents
- source = '<?xml version="1.0" encoding="ISO-8859-1"?>
+ source = %[<?xml version="1.0" encoding="ISO-8859-1"?>
<g>
-<f a="é" />
-</g>'
+<f a="\xE9" />
+</g>]
doc = REXML::Document.new( source )
a = doc.elements['/g/f'].attribute('a')
if a.value.respond_to? :force_encoding
a.value.force_encoding('binary')
end
- assert_equal( 'é', a.value)
+ assert_equal( "\xC3\xA9", a.value)
doc = REXML::Document.parse_stream(
File::new(fixture_path("stream_accents.xml")),
AccentListener::new
diff --git a/test/rexml/test_namespace.rb b/test/rexml/test_namespace.rb
index 6ab16b6342..f855203fc8 100644
--- a/test/rexml/test_namespace.rb
+++ b/test/rexml/test_namespace.rb
@@ -1,4 +1,4 @@
-require "rexml_test_utils"
+require_relative "rexml_test_utils"
require "rexml/document"
diff --git a/test/rexml/test_notationdecl_mixin.rb b/test/rexml/test_notationdecl_mixin.rb
deleted file mode 100644
index 68dcc555ac..0000000000
--- a/test/rexml/test_notationdecl_mixin.rb
+++ /dev/null
@@ -1,58 +0,0 @@
-#! /usr/local/bin/ruby
-
-
-require 'test/unit'
-require 'rexml/document'
-
-class TestNotationDeclMixin < Test::Unit::TestCase
- def setup
- @pubid1 = "TEST1"
- @pubid2 = "TEST2"
- @sysid2 = "urn:x-henrikmartensson.org:test2"
- @pubid3 = "TEST3"
- @pubid4 = "TEST4"
- @sysid4 = "urn:x-henrikmartensson.org:test4"
- @pubid5 = "TEST5"
- @sysid5 = "urn:x-henrikmartensson.org:test5"
- @pubid6 = "TEST6"
- @sysid6 = "urn:x-henrikmartensson.org:test6"
- @sysid7 = "urn:x-henrikmartensson.org:test7"
- doc_string = <<-"XMLEND"
- <!DOCTYPE r SYSTEM "urn:x-henrikmartensson:test" [
- <!NOTATION n1 PUBLIC "#{@pubid1}">
- <!NOTATION n2 PUBLIC "#{@pubid2}" "#{@sysid2}">
- <!NOTATION n3 PUBLIC '#{@pubid3}'>
- <!NOTATION n4 PUBLIC '#{@pubid4}' '#{@sysid4}'>
- <!NOTATION n5 PUBLIC "#{@pubid5}" '#{@sysid5}'>
- <!NOTATION n6 PUBLIC '#{@pubid6}' "#{@sysid6}">
- <!NOTATION n7 SYSTEM "#{@sysid7}">
- ]>
- <r/>
- XMLEND
- @doctype = REXML::Document.new(doc_string).doctype
- end
-
- def test_name
- assert_equal('n1', @doctype.notation('n1').name)
- end
-
- def test_public_2
- assert_equal(@pubid1, @doctype.notation('n1').public)
- assert_equal(@pubid2, @doctype.notation('n2').public)
- assert_equal(@pubid3, @doctype.notation('n3').public)
- assert_equal(@pubid4, @doctype.notation('n4').public)
- assert_equal(@pubid5, @doctype.notation('n5').public)
- assert_equal(@pubid6, @doctype.notation('n6').public)
- assert_nil(@doctype.notation('n7').public)
- end
-
- def test_system_2
- assert_equal(@sysid2, @doctype.notation('n2').system)
- assert_nil(@doctype.notation('n3').system)
- assert_equal(@sysid4, @doctype.notation('n4').system)
- assert_equal(@sysid5, @doctype.notation('n5').system)
- assert_equal(@sysid6, @doctype.notation('n6').system)
- assert_equal(@sysid7, @doctype.notation('n7').system)
- end
-
-end
diff --git a/test/rexml/test_notationdecl_parsetest.rb b/test/rexml/test_notationdecl_parsetest.rb
deleted file mode 100644
index 2e86d322e0..0000000000
--- a/test/rexml/test_notationdecl_parsetest.rb
+++ /dev/null
@@ -1,23 +0,0 @@
-#! /usr/bin/ruby
-
-require 'test/unit'
-require 'rexml/document'
-
-class TestNotationDecl < Test::Unit::TestCase
- def setup
- doc_string = <<-'XMLEND'
- <!DOCTYPE r SYSTEM "urn:x-henrikmartensson:test" [
- <!NOTATION n1 PUBLIC "-//HM//NOTATION TEST1//EN" 'urn:x-henrikmartensson.org:test5'>
- <!NOTATION n2 PUBLIC '-//HM//NOTATION TEST2//EN' "urn:x-henrikmartensson.org:test6">
- ]>
- <r/>
- XMLEND
- @doctype = REXML::Document.new(doc_string).doctype
- end
-
- def test_notation
- assert(@doctype.notation('n1'), "Testing notation n1")
- assert(@doctype.notation('n2'), "Testing notation n2")
- end
-
-end
diff --git a/test/rexml/test_order.rb b/test/rexml/test_order.rb
index a87b1c2728..3fcbf9778b 100644
--- a/test/rexml/test_order.rb
+++ b/test/rexml/test_order.rb
@@ -1,6 +1,9 @@
-require 'rexml_test_utils'
+require_relative 'rexml_test_utils'
require 'rexml/document'
-require 'zlib'
+begin
+ require 'zlib'
+rescue LoadError
+end
class OrderTester < Test::Unit::TestCase
include REXMLTestUtils
@@ -98,5 +101,5 @@ END
assert_equal( actual[count], n ) unless n =~ /Arrive at/
count += 1
}
- end
+ end if defined?(Zlib::GzipReader)
end
diff --git a/test/rexml/test_pullparser.rb b/test/rexml/test_pullparser.rb
index bfce60f268..03c95642e4 100644
--- a/test/rexml/test_pullparser.rb
+++ b/test/rexml/test_pullparser.rb
@@ -33,7 +33,7 @@ class PullParserTester < Test::Unit::TestCase
source = "<a><b></a>"
parser = REXML::Parsers::PullParser.new(source)
assert_raise(ParseException, "Parsing should have failed") {
- results = parser.pull while parser.has_next?
+ parser.pull while parser.has_next?
}
end
@@ -63,7 +63,7 @@ class PullParserTester < Test::Unit::TestCase
def test_peek_unshift
source = "<a><b/></a>"
- pp = REXML::Parsers::PullParser.new(source)
+ REXML::Parsers::PullParser.new(source)
# FINISH ME!
end
diff --git a/test/rexml/test_rexml_issuezilla.rb b/test/rexml/test_rexml_issuezilla.rb
index a0ebfa77dd..2a12006bac 100644
--- a/test/rexml/test_rexml_issuezilla.rb
+++ b/test/rexml/test_rexml_issuezilla.rb
@@ -1,4 +1,4 @@
-require 'rexml_test_utils'
+require_relative 'rexml_test_utils'
require 'rexml/document'
class TestIssuezillaParsing < Test::Unit::TestCase
diff --git a/test/rexml/test_sax.rb b/test/rexml/test_sax.rb
index 8873e1703d..4a9db404d0 100644
--- a/test/rexml/test_sax.rb
+++ b/test/rexml/test_sax.rb
@@ -1,4 +1,4 @@
-require "rexml_test_utils"
+require_relative "rexml_test_utils"
require 'rexml/sax2listener'
require 'rexml/parsers/sax2parser'
require 'rexml/document'
diff --git a/test/rexml/test_stream.rb b/test/rexml/test_stream.rb
index 3f876aed35..0ae1bc6df2 100644
--- a/test/rexml/test_stream.rb
+++ b/test/rexml/test_stream.rb
@@ -63,6 +63,29 @@ class StreamTester < Test::Unit::TestCase
assert( listener.events[:elementdecl] )
assert( listener.events[:notationdecl] )
end
+
+ def test_entity
+ listener = MyListener.new
+ class << listener
+ attr_accessor :entities
+ def entity(content)
+ @entities << content
+ end
+ end
+ listener.entities = []
+
+ source = StringIO.new(<<-XML)
+<!DOCTYPE root [
+<!ENTITY % ISOLat2
+ SYSTEM "http://www.xml.com/iso/isolat2-xml.entities" >
+%ISOLat2;
+]>
+<root/>
+ XML
+ REXML::Document.parse_stream(source, listener)
+
+ assert_equal(["ISOLat2"], listener.entities)
+ end
end
diff --git a/test/rexml/test_text.rb b/test/rexml/test_text.rb
new file mode 100644
index 0000000000..81bc56bb7f
--- /dev/null
+++ b/test/rexml/test_text.rb
@@ -0,0 +1,19 @@
+require "rexml/text"
+
+class TextTester < Test::Unit::TestCase
+ include REXML
+
+ def test_shift_operator_chain
+ text = Text.new("original\r\n")
+ text << "append1\r\n" << "append2\r\n"
+ assert_equal("original\nappend1\nappend2\n", text.to_s)
+ end
+
+ def test_shift_operator_cache
+ text = Text.new("original\r\n")
+ text << "append1\r\n" << "append2\r\n"
+ assert_equal("original\nappend1\nappend2\n", text.to_s)
+ text << "append3\r\n" << "append4\r\n"
+ assert_equal("original\nappend1\nappend2\nappend3\nappend4\n", text.to_s)
+ end
+end
diff --git a/test/rexml/test_xml_declaration_parent_child.rb b/test/rexml/test_xml_declaration.rb
index d883e105c1..eb717bf937 100644
--- a/test/rexml/test_xml_declaration_parent_child.rb
+++ b/test/rexml/test_xml_declaration.rb
@@ -1,4 +1,4 @@
-#!/usr/bin/env ruby
+# -*- coding: utf-8 -*-
#
# Created by Henrik MÃ¥rtensson on 2007-02-18.
# Copyright (c) 2007. All rights reserved.
@@ -18,15 +18,15 @@ class TestXmlDeclaration < Test::Unit::TestCase
@xml_declaration = @doc.children[0]
end
- def test_xml_declaration_is_first_child
+ def test_is_first_child
assert_kind_of(REXML::XMLDecl, @xml_declaration)
end
- def test_xml_declaration_has_document_as_parent
+ def test_has_document_as_parent
assert_kind_of(REXML::Document, @xml_declaration.parent)
end
- def test_xml_declaration_has_sibling
+ def test_has_sibling
assert_kind_of(REXML::XMLDecl, @root.previous_sibling.previous_sibling)
assert_kind_of(REXML::Element, @xml_declaration.next_sibling.next_sibling)
end
diff --git a/test/rexml/test_xpath.rb b/test/rexml/test_xpath.rb
index ad09fcafb2..927909a5f2 100644
--- a/test/rexml/test_xpath.rb
+++ b/test/rexml/test_xpath.rb
@@ -1,4 +1,4 @@
-require "rexml_test_utils"
+require_relative "rexml_test_utils"
require "rexml/document"
@@ -219,7 +219,7 @@ class XPathTester < Test::Unit::TestCase
for line in File.new(xpathtests)
line.strip!
begin
- rt = doc.root
+ doc.root
#puts "#"*80
#print "\nDoing #{line} " ; $stdout.flush
doc.elements.each(line) do |el|
@@ -332,7 +332,7 @@ class XPathTester < Test::Unit::TestCase
</foo>
EOF
doc = Document.new source
- result = XPath.each( doc, "//bar" ) {
+ XPath.each( doc, "//bar" ) {
fail "'bar' should match nothing in this case"
}
@@ -523,7 +523,7 @@ class XPathTester < Test::Unit::TestCase
# examples from http://www.w3.org/TR/xpath#function-substring
doc = Document.new('<test string="12345" />')
- d = Document.new("<a b='1'/>")
+ 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]')
@@ -589,7 +589,7 @@ class XPathTester < Test::Unit::TestCase
def test_name
assert_raise( UndefinedNamespaceException, "x should be undefined" ) {
- d = REXML::Document.new("<a x='foo'><b/><x:b/></a>")
+ REXML::Document.new("<a x='foo'><b/><x:b/></a>")
}
d = REXML::Document.new("<a xmlns:x='foo'><b/><x:b/></a>")
assert_equal 1, d.root.elements.to_a('*[name() = "b"]').size
diff --git a/test/rexml/test_xpathtext.rb b/test/rexml/test_xpathtext.rb
index c3393987f2..87441cb6d5 100644
--- a/test/rexml/test_xpathtext.rb
+++ b/test/rexml/test_xpathtext.rb
@@ -14,7 +14,7 @@ class XpathTestCase < Test::Unit::TestCase
def test_text_as_element
node1 = REXML::Element.new('a', @doc)
node2 = REXML::Element.new('b', node1)
- textnode = REXML::Text.new('test', false, node2)
+ REXML::Text.new('test', false, node2)
assert_equal(1, @doc.elements.size, "doc owns 1 element node1")
assert_same(node1, @doc.elements[1], "doc owns 1 element node1")
assert_equal(1, node1.elements.size, "node1 owns 1 element node2")
diff --git a/test/rinda/test_rinda.rb b/test/rinda/test_rinda.rb
index e49a685bc9..2bda9cc363 100644
--- a/test/rinda/test_rinda.rb
+++ b/test/rinda/test_rinda.rb
@@ -2,6 +2,7 @@ require 'test/unit'
require 'drb/drb'
require 'drb/eq'
+require 'rinda/ring'
require 'rinda/tuplespace'
require 'singleton'
@@ -49,7 +50,7 @@ class MockClock
end
def rewind
- now ,= @ts.take([nil, :now])
+ @ts.take([nil, :now])
@ts.write([@inf, :now])
@ts.take([nil, :now])
@now = 2
@@ -75,7 +76,7 @@ module Time
module_function :at
def now
- @m ? @m.now : 2
+ defined?(@m) && @m ? @m.now : 2
end
module_function :now
@@ -150,7 +151,7 @@ module TupleSpaceTestModule
assert(!tmpl.match({"message"=>"Hello", "no_name"=>"Foo"}))
assert_raise(Rinda::InvalidHashTupleKey) do
- tmpl = Rinda::Template.new({:message=>String, "name"=>String})
+ Rinda::Template.new({:message=>String, "name"=>String})
end
tmpl = Rinda::Template.new({"name"=>String})
assert_equal(1, tmpl.size)
@@ -262,7 +263,7 @@ module TupleSpaceTestModule
end
def test_core_01
- 5.times do |n|
+ 5.times do
@ts.write([:req, 2])
end
@@ -297,7 +298,7 @@ module TupleSpaceTestModule
s
end
- 5.times do |n|
+ 5.times do
@ts.write([:req, 2])
end
@@ -310,7 +311,7 @@ module TupleSpaceTestModule
notify1 = @ts.notify(nil, [:req, Integer])
notify2 = @ts.notify(nil, {"message"=>String, "name"=>String})
- 5.times do |n|
+ 5.times do
@ts.write([:req, 2])
end
@@ -477,8 +478,222 @@ class TupleSpaceProxyTest < Test::Unit::TestCase
@ts.take({'head' => 1, 'tail' => 2}, 0))
end
+ def test_take_bug_8215
+ require_relative '../ruby/envutil'
+ service = DRb.start_service(nil, @ts_base)
+
+ uri = service.uri
+
+ args = [EnvUtil.rubybin, *%W[-rdrb/drb -rdrb/eq -rrinda/ring -rrinda/tuplespace -e]]
+
+ take = spawn(*args, <<-'end;', uri)
+ uri = ARGV[0]
+ DRb.start_service
+ ro = DRbObject.new_with_uri(uri)
+ ts = Rinda::TupleSpaceProxy.new(ro)
+ th = Thread.new do
+ ts.take([:test_take, nil])
+ end
+ Kernel.sleep(0.1)
+ th.raise(Interrupt) # causes loss of the taken tuple
+ ts.write([:barrier, :continue])
+ Kernel.sleep
+ end;
+
+ @ts_base.take([:barrier, :continue])
+
+ write = spawn(*args, <<-'end;', uri)
+ uri = ARGV[0]
+ DRb.start_service
+ ro = DRbObject.new_with_uri(uri)
+ ts = Rinda::TupleSpaceProxy.new(ro)
+ ts.write([:test_take, 42])
+ end;
+
+ status = Process.wait(write)
+
+ assert_equal([[:test_take, 42]], @ts_base.read_all([:test_take, nil]),
+ '[bug:8215] tuple lost')
+ ensure
+ signal = /mswin|mingw/ =~ RUBY_PLATFORM ? "KILL" : "TERM"
+ Process.kill(signal, write) if write && status.nil?
+ Process.kill(signal, take) if take
+ Process.wait(write) if write && status.nil?
+ Process.wait(take) if take
+ end
+
@server = DRb.primary_server || DRb.start_service
end
+module RingIPv6
+ def prepare_ipv6(r)
+ begin
+ Socket.getifaddrs.each do |ifaddr|
+ next unless ifaddr.addr
+ next unless ifaddr.addr.ipv6_linklocal?
+ next if ifaddr.name[0, 2] == "lo"
+ r.multicast_interface = ifaddr.ifindex
+ return ifaddr
+ end
+ rescue NotImplementedError
+ # ifindex() function may not be implemented on Windows.
+ return if
+ Socket.ip_address_list.any? { |addrinfo| addrinfo.ipv6? }
+ end
+ skip 'IPv6 not available'
+ end
+end
+
+class TestRingServer < Test::Unit::TestCase
+
+ def setup
+ @port = Rinda::Ring_PORT
+
+ @ts = Rinda::TupleSpace.new
+ @rs = Rinda::RingServer.new(@ts, [], @port)
+ end
+ def teardown
+ # implementation-dependent
+ @ts.instance_eval{@keeper.kill if @keeper}
+ @rs.shutdown
+ end
+
+ def test_make_socket_unicast
+ v4 = @rs.make_socket('127.0.0.1')
+
+ assert_equal('127.0.0.1', v4.local_address.ip_address)
+ assert_equal(@port, v4.local_address.ip_port)
+ end
+
+ def test_make_socket_ipv4_multicast
+ v4mc = @rs.make_socket('239.0.0.1')
+
+ if Socket.const_defined?(:SO_REUSEPORT) then
+ assert(v4mc.getsockopt(:SOCKET, :SO_REUSEPORT).bool)
+ else
+ assert(v4mc.getsockopt(:SOCKET, :SO_REUSEADDR).bool)
+ end
+
+ assert_equal('0.0.0.0', v4mc.local_address.ip_address)
+ assert_equal(@port, v4mc.local_address.ip_port)
+ end
+
+ def test_make_socket_ipv6_multicast
+ skip 'IPv6 not available' unless
+ Socket.ip_address_list.any? { |addrinfo| addrinfo.ipv6? }
+
+ begin
+ v6mc = @rs.make_socket('ff02::1')
+ rescue Errno::EADDRNOTAVAIL
+ return # IPv6 address for multicast not available
+ end
+
+ if Socket.const_defined?(:SO_REUSEPORT) then
+ assert v6mc.getsockopt(:SOCKET, :SO_REUSEPORT).bool
+ else
+ assert v6mc.getsockopt(:SOCKET, :SO_REUSEADDR).bool
+ end
+
+ assert_equal('::1', v6mc.local_address.ip_address)
+ assert_equal(@port, v6mc.local_address.ip_port)
+ end
+
+ def test_ring_server_ipv4_multicast
+ @rs = Rinda::RingServer.new(@ts, [['239.0.0.1', '0.0.0.0']], @port)
+ v4mc = @rs.instance_variable_get('@sockets').first
+
+ if Socket.const_defined?(:SO_REUSEPORT) then
+ assert(v4mc.getsockopt(:SOCKET, :SO_REUSEPORT).bool)
+ else
+ assert(v4mc.getsockopt(:SOCKET, :SO_REUSEADDR).bool)
+ end
+
+ assert_equal('0.0.0.0', v4mc.local_address.ip_address)
+ assert_equal(@port, v4mc.local_address.ip_port)
+ end
+
+ def test_ring_server_ipv6_multicast
+ skip 'IPv6 not available' unless
+ Socket.ip_address_list.any? { |addrinfo| addrinfo.ipv6? }
+
+ begin
+ @rs = Rinda::RingServer.new(@ts, [['ff02::1', '::1', 0]], @port)
+ rescue Errno::EADDRNOTAVAIL
+ return # IPv6 address for multicast not available
+ end
+
+ v6mc = @rs.instance_variable_get('@sockets').first
+
+ if Socket.const_defined?(:SO_REUSEPORT) then
+ assert v6mc.getsockopt(:SOCKET, :SO_REUSEPORT).bool
+ else
+ assert v6mc.getsockopt(:SOCKET, :SO_REUSEADDR).bool
+ end
+
+ assert_equal('::1', v6mc.local_address.ip_address)
+ assert_equal(@port, v6mc.local_address.ip_port)
+ end
+
+ def test_shutdown
+ @rs.shutdown
+
+ assert_nil(@rs.do_reply, 'otherwise should hang forever')
+ end
+
+end
+
+class TestRingFinger < Test::Unit::TestCase
+ include RingIPv6
+
+ def setup
+ @rf = Rinda::RingFinger.new
+ end
+
+ def test_make_socket_unicast
+ v4 = @rf.make_socket('127.0.0.1')
+
+ assert(v4.getsockopt(:SOL_SOCKET, :SO_BROADCAST).bool)
+ end
+
+ def test_make_socket_ipv4_multicast
+ v4mc = @rf.make_socket('239.0.0.1')
+
+ assert_equal(1, v4mc.getsockopt(:IPPROTO_IP, :IP_MULTICAST_LOOP).ipv4_multicast_loop)
+ assert_equal(1, v4mc.getsockopt(:IPPROTO_IP, :IP_MULTICAST_TTL).ipv4_multicast_ttl)
+ end
+
+ def test_make_socket_ipv6_multicast
+ ifaddr = prepare_ipv6(@rf)
+ begin
+ v6mc = @rf.make_socket("ff02::1")
+ rescue Errno::EINVAL
+ # somehow Debian 6.0.7 needs ifname
+ v6mc = @rf.make_socket("ff02::1%#{ifaddr.name}")
+ end
+
+ assert_equal(1, v6mc.getsockopt(:IPPROTO_IPV6, :IPV6_MULTICAST_LOOP).int)
+ assert_equal(1, v6mc.getsockopt(:IPPROTO_IPV6, :IPV6_MULTICAST_HOPS).int)
+ end
+
+ def test_make_socket_ipv4_multicast_hops
+ @rf.multicast_hops = 2
+ v4mc = @rf.make_socket('239.0.0.1')
+ assert_equal(2, v4mc.getsockopt(:IPPROTO_IP, :IP_MULTICAST_TTL).ipv4_multicast_ttl)
+ end
+
+ def test_make_socket_ipv6_multicast_hops
+ ifaddr = prepare_ipv6(@rf)
+ @rf.multicast_hops = 2
+ begin
+ v6mc = @rf.make_socket("ff02::1")
+ rescue Errno::EINVAL
+ # somehow Debian 6.0.7 needs ifname
+ v6mc = @rf.make_socket("ff02::1%#{ifaddr.name}")
+ end
+ assert_equal(2, v6mc.getsockopt(:IPPROTO_IPV6, :IPV6_MULTICAST_HOPS).int)
+ end
+
+end
+
end
diff --git a/test/ripper/dummyparser.rb b/test/ripper/dummyparser.rb
index 8a706b558a..1403203dae 100644
--- a/test/ripper/dummyparser.rb
+++ b/test/ripper/dummyparser.rb
@@ -151,7 +151,7 @@ class DummyParser < Ripper
"&#{var}"
end
- def on_params(required, optional, rest, more, block)
+ def on_params(required, optional, rest, more, keyword, keyword_rest, block)
args = NodeList.new
required.each do |req|
diff --git a/test/ripper/test_files.rb b/test/ripper/test_files.rb
index 9aa45221dd..a00359360e 100644
--- a/test/ripper/test_files.rb
+++ b/test/ripper/test_files.rb
@@ -1,27 +1,24 @@
-begin
- require 'ripper'
- require 'find'
- require 'test/unit'
- ripper_test = true
- module TestRipper; end
-rescue LoadError
-end
+require 'test/unit'
+require_relative '../ruby/envutil'
+module TestRipper; end
class TestRipper::Generic < Test::Unit::TestCase
- SRCDIR = File.dirname(File.dirname(File.dirname(File.expand_path(__FILE__))))
-
- class Parser < Ripper
- PARSER_EVENTS.each {|n| eval "def on_#{n}(*args) r = [:#{n}, *args]; r.inspect; Object.new end" }
- SCANNER_EVENTS.each {|n| eval "def on_#{n}(*args) r = [:#{n}, *args]; r.inspect; Object.new end" }
- end
-
- TEST_RATIO = 0.05
-
def test_parse_files
- Find.find("#{SRCDIR}/lib", "#{SRCDIR}/ext", "#{SRCDIR}/sample", "#{SRCDIR}/test") {|n|
- next if /\.rb\z/ !~ n || !File.file?(n)
- next if TEST_RATIO < rand
- assert_nothing_raised("ripper failed to parse: #{n.inspect}") { Parser.new(File.read(n)).parse }
- }
+ srcdir = File.expand_path("../../..", __FILE__)
+ assert_separately(%W[--disable-gem -rripper -r#{__dir__}/../ruby/envutil - #{srcdir}],
+ __FILE__, __LINE__, <<-'eom', timeout: Float::INFINITY)
+ TEST_RATIO = 0.05 # testing all files needs too long time...
+ class Parser < Ripper
+ PARSER_EVENTS.each {|n| eval "def on_#{n}(*args) r = [:#{n}, *args]; r.inspect; Object.new end" }
+ SCANNER_EVENTS.each {|n| eval "def on_#{n}(*args) r = [:#{n}, *args]; r.inspect; Object.new end" }
+ end
+ dir = ARGV.shift
+ for script in Dir["#{dir}/{lib,sample,ext,test}/**/*.rb"].sort
+ next if TEST_RATIO < rand
+ assert_nothing_raised("ripper failed to parse: #{script.inspect}") {
+ Parser.new(File.read(script)).parse
+ }
+ end
+ eom
end
-end if ripper_test
+end
diff --git a/test/ripper/test_parser_events.rb b/test/ripper/test_parser_events.rb
index af41d3e6a4..c9b5690245 100644
--- a/test/ripper/test_parser_events.rb
+++ b/test/ripper/test_parser_events.rb
@@ -24,6 +24,10 @@ class TestRipper::ParserEvents < Test::Unit::TestCase
dp.parse.to_s
end
+ def compile_error(str)
+ parse(str, :compile_error) {|e, msg| return msg}
+ end
+
def test_program
thru_program = false
assert_equal '[void()]', parse('', :on_program) {thru_program = true}
@@ -146,6 +150,12 @@ class TestRipper::ParserEvents < Test::Unit::TestCase
assert_equal true, thru_assoc_new
end
+ def test_assoc_splat
+ thru_assoc_splat = false
+ parse('m(**h)', :on_assoc_splat) {thru_assoc_splat = true}
+ assert_equal true, thru_assoc_splat
+ end
+
def test_aref_field
assert_equal '[assign(aref_field(vcall(a),[1]),2)]', parse('a[1]=2')
end
@@ -349,14 +359,14 @@ class TestRipper::ParserEvents < Test::Unit::TestCase
def test_heredoc
bug1921 = '[ruby-core:24855]'
thru_heredoc_beg = false
- tree = parse("<<EOS\nheredoc\nEOS\n", :on_heredoc_beg) {thru_heredoc_beg = true}
+ tree = parse("<""<EOS\nheredoc\nEOS\n", :on_heredoc_beg) {thru_heredoc_beg = true}
assert_equal true, thru_heredoc_beg
assert_match(/string_content\(\),heredoc\n/, tree, bug1921)
heredoc = nil
- parse("<<EOS\nheredoc1\nheredoc2\nEOS\n", :on_string_add) {|e, n, s| heredoc = s}
+ parse("<""<EOS\nheredoc1\nheredoc2\nEOS\n", :on_string_add) {|e, n, s| heredoc = s}
assert_equal("heredoc1\nheredoc2\n", heredoc, bug1921)
heredoc = nil
- parse("<<-EOS\nheredoc1\nheredoc2\n\tEOS\n", :on_string_add) {|e, n, s| heredoc = s}
+ parse("<""<-EOS\nheredoc1\nheredoc2\n\tEOS\n", :on_string_add) {|e, n, s| heredoc = s}
assert_equal("heredoc1\nheredoc2\n", heredoc, bug1921)
end
@@ -693,12 +703,15 @@ class TestRipper::ParserEvents < Test::Unit::TestCase
thru_opassign = false
parse('a ||= b', :on_opassign) {thru_opassign = true}
assert_equal true, thru_opassign
+ thru_opassign = false
+ parse('a::X ||= c 1', :on_opassign) {thru_opassign = true}
+ assert_equal true, thru_opassign
end
def test_opassign_error
thru_opassign = []
- events = [:on_opassign, :on_assign_error]
- parse('a::X ||= c 1', events) {|a,*b|
+ events = [:on_opassign]
+ parse('$~ ||= 1', events) {|a,*b|
thru_opassign << a
}
assert_equal events, thru_opassign
@@ -749,12 +762,36 @@ class TestRipper::ParserEvents < Test::Unit::TestCase
assert_equal true, thru_qwords_add
end
+ def test_qsymbols_add
+ thru_qsymbols_add = false
+ parse('%i[a]', :on_qsymbols_add) {thru_qsymbols_add = true}
+ assert_equal true, thru_qsymbols_add
+ end
+
+ def test_symbols_add
+ thru_symbols_add = false
+ parse('%I[a]', :on_symbols_add) {thru_symbols_add = true}
+ assert_equal true, thru_symbols_add
+ end
+
def test_qwords_new
thru_qwords_new = false
parse('%w[]', :on_qwords_new) {thru_qwords_new = true}
assert_equal true, thru_qwords_new
end
+ def test_qsymbols_new
+ thru_qsymbols_new = false
+ parse('%i[]', :on_qsymbols_new) {thru_qsymbols_new = true}
+ assert_equal true, thru_qsymbols_new
+ end
+
+ def test_symbols_new
+ thru_symbols_new = false
+ parse('%I[]', :on_symbols_new) {thru_symbols_new = true}
+ assert_equal true, thru_symbols_new
+ end
+
def test_redo
thru_redo = false
parse('redo', :on_redo) {thru_redo = true}
@@ -783,8 +820,8 @@ class TestRipper::ParserEvents < Test::Unit::TestCase
thru_rescue = false
parsed = parse('begin; 1; rescue => e; 2; end', :on_rescue) {thru_rescue = true}
assert_equal true, thru_rescue
- assert_match /1.*rescue/, parsed
- assert_match /rescue\(,var_field\(e\),\[2\]\)/, parsed
+ assert_match(/1.*rescue/, parsed)
+ assert_match(/rescue\(,var_field\(e\),\[2\]\)/, parsed)
end
def test_rescue_mod
@@ -1116,7 +1153,6 @@ class TestRipper::ParserEvents < Test::Unit::TestCase
def test_local_variables
cmd = 'command(w,[regexp_literal(regexp_add(regexp_new(),25 # ),/)])'
div = 'binary(ref(w),/,25)'
- var = '[w]'
bug1939 = '[ruby-core:24923]'
assert_equal("[#{cmd}]", parse('w /25 # /'), bug1939)
@@ -1135,8 +1171,20 @@ class TestRipper::ParserEvents < Test::Unit::TestCase
end
def test_unterminated_regexp
- compile_error = false
- parse('/', :compile_error) {|e, msg| compile_error = msg}
- assert_equal("unterminated regexp meets end of file", compile_error)
+ assert_equal("unterminated regexp meets end of file", compile_error('/'))
+ end
+
+ def test_invalid_instance_variable_name
+ assert_equal("`@1' is not allowed as an instance variable name", compile_error('@1'))
+ assert_equal("`@%' is not allowed as an instance variable name", compile_error('@%'))
+ end
+
+ def test_invalid_class_variable_name
+ assert_equal("`@@1' is not allowed as a class variable name", compile_error('@@1'))
+ assert_equal("`@@%' is not allowed as a class variable name", compile_error('@@%'))
+ end
+
+ def test_invalid_global_variable_name
+ assert_equal("`$%' is not allowed as a global variable name", compile_error('$%'))
end
end if ripper_test
diff --git a/test/ripper/test_ripper.rb b/test/ripper/test_ripper.rb
index 72dc52d087..1d6e8934ef 100644
--- a/test/ripper/test_ripper.rb
+++ b/test/ripper/test_ripper.rb
@@ -17,7 +17,7 @@ class TestRipper::Ripper < Test::Unit::TestCase
end
def test_encoding
- assert_equal Encoding::US_ASCII, @ripper.encoding
+ assert_equal Encoding::UTF_8, @ripper.encoding
end
def test_end_seen_eh
diff --git a/test/ripper/test_scanner_events.rb b/test/ripper/test_scanner_events.rb
index c92ec494ed..2474588f76 100644
--- a/test/ripper/test_scanner_events.rb
+++ b/test/ripper/test_scanner_events.rb
@@ -32,10 +32,10 @@ class TestRipper::ScannerEvents < Test::Unit::TestCase
Ripper.tokenize('1')
assert_equal ['1', ';', 'def', ' ', 'm', '(', 'arg', ')', 'end'],
Ripper.tokenize("1;def m(arg)end")
- assert_equal ['print', '(', '<<EOS', ')', "\n", "heredoc\n", "EOS\n"],
- Ripper.tokenize("print(<<EOS)\nheredoc\nEOS\n")
- assert_equal ['print', '(', ' ', '<<EOS', ')', "\n", "heredoc\n", "EOS\n"],
- Ripper.tokenize("print( <<EOS)\nheredoc\nEOS\n")
+ assert_equal ['print', '(', '<<''EOS', ')', "\n", "heredoc\n", "EOS\n"],
+ Ripper.tokenize("print(<<""EOS)\nheredoc\nEOS\n")
+ assert_equal ['print', '(', ' ', '<<''EOS', ')', "\n", "heredoc\n", "EOS\n"],
+ Ripper.tokenize("print( <<""EOS)\nheredoc\nEOS\n")
assert_equal ["\#\n", "\n", "\#\n", "\n", "nil", "\n"],
Ripper.tokenize("\#\n\n\#\n\nnil\n")
end
@@ -61,15 +61,15 @@ class TestRipper::ScannerEvents < Test::Unit::TestCase
[[2, 1], :on_nl, "\n"],
[[3, 0], :on_int, "3"]],
Ripper.lex("1\n2\n3")
- assert_equal [[[1, 0], :on_heredoc_beg, "<<EOS"],
+ assert_equal [[[1, 0], :on_heredoc_beg, "<<""EOS"],
[[1, 5], :on_nl, "\n"],
[[2, 0], :on_tstring_content, "heredoc\n"],
[[3, 0], :on_heredoc_end, "EOS"]],
- Ripper.lex("<<EOS\nheredoc\nEOS")
- assert_equal [[[1, 0], :on_heredoc_beg, "<<EOS"],
+ Ripper.lex("<<""EOS\nheredoc\nEOS")
+ assert_equal [[[1, 0], :on_heredoc_beg, "<<""EOS"],
[[1, 5], :on_nl, "\n"],
[[2, 0], :on_heredoc_end, "EOS"]],
- Ripper.lex("<<EOS\nEOS"),
+ Ripper.lex("<<""EOS\nEOS"),
"bug#4543"
assert_equal [[[1, 0], :on_regexp_beg, "/"],
[[1, 1], :on_tstring_content, "foo\nbar"],
@@ -87,31 +87,42 @@ class TestRipper::ScannerEvents < Test::Unit::TestCase
[[1, 1], :on_tstring_content, "\u3042\n\u3044"],
[[2, 3], :on_tstring_end, "'"]],
Ripper.lex("'\u3042\n\u3044'")
+ assert_equal [[[1, 0], :on_rational, "1r"],
+ [[1, 2], :on_nl, "\n"],
+ [[2, 0], :on_imaginary, "2i"],
+ [[2, 2], :on_nl, "\n"],
+ [[3, 0], :on_imaginary, "3ri"],
+ [[3, 3], :on_nl, "\n"],
+ [[4, 0], :on_rational, "4.2r"],
+ [[4, 4], :on_nl, "\n"],
+ [[5, 0], :on_imaginary, "5.6ri"],
+ ],
+ Ripper.lex("1r\n2i\n3ri\n4.2r\n5.6ri")
end
def test_location
- validate_location ""
- validate_location " "
- validate_location "@"
- validate_location "\n"
- validate_location "\r\n"
- validate_location "\n\n\n\n\n\r\n\n\n"
- validate_location "\n;\n;\n;\n;\n"
- validate_location "nil"
- validate_location "@ivar"
- validate_location "1;2;3"
- validate_location "1\n2\n3"
- validate_location "1\n2\n3\n"
- validate_location "def m(a) nil end"
- validate_location "if true then false else nil end"
- validate_location "BEGIN{print nil}"
- validate_location "%w(a b\nc\r\nd \ne )"
- validate_location %Q["a\nb\r\nc"]
- validate_location "print(<<EOS)\nheredoc\nEOS\n"
- validate_location "print(<<-\"EOS\")\nheredoc\n EOS\n"
- end
-
- def validate_location(src)
+ assert_location ""
+ assert_location " "
+ assert_location ":"
+ assert_location "\n"
+ assert_location "\r\n"
+ assert_location "\n\n\n\n\n\r\n\n\n"
+ assert_location "\n;\n;\n;\n;\n"
+ assert_location "nil"
+ assert_location "@ivar"
+ assert_location "1;2;3"
+ assert_location "1\n2\n3"
+ assert_location "1\n2\n3\n"
+ assert_location "def m(a) nil end"
+ assert_location "if true then false else nil end"
+ assert_location "BEGIN{print nil}"
+ assert_location "%w(a b\nc\r\nd \ne )"
+ assert_location %Q["a\nb\r\nc"]
+ assert_location "print(<<""EOS)\nheredoc\nEOS\n"
+ assert_location "print(<<-\"EOS\")\nheredoc\n EOS\n"
+ end
+
+ def assert_location(src)
buf = ''
Ripper.lex(src).each do |pos, type, tok|
line, col = *pos
@@ -140,7 +151,7 @@ class TestRipper::ScannerEvents < Test::Unit::TestCase
assert_equal [],
scan('comma', %q[".,.,.,.,.,.,.."])
assert_equal [],
- scan('comma', "<<EOS\n,,,,,,,,,,\nEOS")
+ scan('comma', "<<""EOS\n,,,,,,,,,,\nEOS")
end
def test_period
@@ -206,12 +217,10 @@ class TestRipper::ScannerEvents < Test::Unit::TestCase
assert_equal ['#{'],
scan('embexpr_beg', '%Q[#{expr}]')
assert_equal ['#{'],
- scan('embexpr_beg', "m(<<EOS)\n\#{expr}\nEOS")
+ scan('embexpr_beg', "m(<<""EOS)\n\#{expr}\nEOS")
end
def test_embexpr_end
-=begin
- # currently detected as "rbrace"
assert_equal [],
scan('embexpr_end', '')
assert_equal ['}'],
@@ -221,8 +230,7 @@ class TestRipper::ScannerEvents < Test::Unit::TestCase
assert_equal ['}'],
scan('embexpr_end', '%Q[#{expr}]')
assert_equal ['}'],
- scan('embexpr_end', "m(<<EOS)\n\#{expr}\nEOS")
-=end
+ scan('embexpr_end', "m(<<""EOS)\n\#{expr}\nEOS")
end
def test_embvar
@@ -267,6 +275,13 @@ class TestRipper::ScannerEvents < Test::Unit::TestCase
scan('float', 'm(a,b,1.0,c,d)')
end
+ def test_rational
+ assert_equal [],
+ scan('rational', '')
+ assert_equal ['1r', '10r', '10.1r'],
+ scan('rational', 'm(1r,10r,10.1r)')
+ end
+
def test_gvar
assert_equal [],
scan('gvar', '')
@@ -289,6 +304,13 @@ class TestRipper::ScannerEvents < Test::Unit::TestCase
scan('ident', 'm(lvar, @ivar, @@cvar, $gvar)')
end
+ def test_imaginary
+ assert_equal [],
+ scan('imaginary', '')
+ assert_equal ['1i', '10ri', '10.0i', '10.1ri'],
+ scan('imaginary', 'm(1i,10ri,10.0i,10.1ri)')
+ end
+
def test_int
assert_equal [],
scan('int', '')
@@ -483,8 +505,8 @@ class TestRipper::ScannerEvents < Test::Unit::TestCase
scan('op', '1 < 1')
assert_equal ['<='],
scan('op', '1 <= 1')
- assert_equal ['<<'],
- scan('op', '1 << 1')
+ assert_equal ['<''<'],
+ scan('op', '1 <''< 1')
assert_equal ['>>'],
scan('op', '1 >> 1')
assert_equal ['+'],
@@ -611,6 +633,28 @@ class TestRipper::ScannerEvents < Test::Unit::TestCase
scan('qwords_beg', '%w( w w w )')
end
+ def test_qsymbols_beg
+ assert_equal [],
+ scan('qsymbols_beg', '')
+ assert_equal ['%i('],
+ scan('qsymbols_beg', '%i()')
+ assert_equal ['%i('],
+ scan('qsymbols_beg', '%i(w w w)')
+ assert_equal ['%i( '],
+ scan('qsymbols_beg', '%i( w w w )')
+ end
+
+ def test_symbols_beg
+ assert_equal [],
+ scan('symbols_beg', '')
+ assert_equal ['%I('],
+ scan('symbols_beg', '%I()')
+ assert_equal ['%I('],
+ scan('symbols_beg', '%I(w w w)')
+ assert_equal ['%I( '],
+ scan('symbols_beg', '%I( w w w )')
+ end
+
# FIXME: Close paren must not present (`words_end' scanner event?).
def test_words_sep
assert_equal [],
@@ -628,35 +672,35 @@ class TestRipper::ScannerEvents < Test::Unit::TestCase
def test_heredoc_beg
assert_equal [],
scan('heredoc_beg', '')
- assert_equal ['<<EOS'],
- scan('heredoc_beg', "<<EOS\nheredoc\nEOS")
- assert_equal ['<<EOS'],
- scan('heredoc_beg', "<<EOS\nheredoc\nEOS\n")
- assert_equal ['<<EOS'],
- scan('heredoc_beg', "<<EOS\nheredoc\nEOS \n")
- assert_equal ['<<-EOS'],
- scan('heredoc_beg', "<<-EOS\nheredoc\n\tEOS \n")
- assert_equal ['<<"EOS"'],
- scan('heredoc_beg', '<<"EOS"'"\nheredoc\nEOS")
- assert_equal ["<<'EOS'"],
- scan('heredoc_beg', "<<'EOS'\nheredoc\nEOS")
- assert_equal ['<<`EOS`'],
- scan('heredoc_beg', "<<`EOS`\nheredoc\nEOS")
- assert_equal ['<<" "'],
- scan('heredoc_beg', '<<" "'"\nheredoc\nEOS")
+ assert_equal ['<<''EOS'],
+ scan('heredoc_beg', "<<""EOS\nheredoc\nEOS")
+ assert_equal ['<<''EOS'],
+ scan('heredoc_beg', "<<""EOS\nheredoc\nEOS\n")
+ assert_equal ['<<''EOS'],
+ scan('heredoc_beg', "<<""EOS\nheredoc\nEOS \n")
+ assert_equal ['<<''-EOS'],
+ scan('heredoc_beg', "<<""-EOS\nheredoc\n\tEOS \n")
+ assert_equal ['<<''"EOS"'],
+ scan('heredoc_beg', '<<''"EOS"'"\nheredoc\nEOS")
+ assert_equal ["<<""'EOS'"],
+ scan('heredoc_beg', "<<""'EOS'\nheredoc\nEOS")
+ assert_equal ['<<''`EOS`'],
+ scan('heredoc_beg', "<<""`EOS`\nheredoc\nEOS")
+ assert_equal ['<<''" "'],
+ scan('heredoc_beg', '<<''" "'"\nheredoc\nEOS")
end
def test_tstring_content_HEREDOC
assert_equal [],
scan('tstring_content', '')
assert_equal ["heredoc\n"],
- scan('tstring_content', "<<EOS\nheredoc\nEOS")
+ scan('tstring_content', "<<""EOS\nheredoc\nEOS")
assert_equal ["heredoc\n"],
- scan('tstring_content', "<<EOS\nheredoc\nEOS\n")
+ scan('tstring_content', "<<""EOS\nheredoc\nEOS\n")
assert_equal ["here\ndoc \nEOS \n"],
- scan('tstring_content', "<<EOS\nhere\ndoc \nEOS \n")
+ scan('tstring_content', "<<""EOS\nhere\ndoc \nEOS \n")
assert_equal ["heredoc\n\tEOS \n"],
- scan('tstring_content', "<<-EOS\nheredoc\n\tEOS \n")
+ scan('tstring_content', "<<""-EOS\nheredoc\n\tEOS \n")
bug7255 = '[ruby-core:48703]'
assert_equal ["there\n""heredoc", "\n"],
scan('tstring_content', "<<""EOS\n""there\n""heredoc\#{foo}\nEOS"),
@@ -670,16 +714,16 @@ class TestRipper::ScannerEvents < Test::Unit::TestCase
assert_equal [],
scan('heredoc_end', '')
assert_equal ["EOS"],
- scan('heredoc_end', "<<EOS\nEOS"),
+ scan('heredoc_end', "<<""EOS\nEOS"),
"bug#4543"
assert_equal ["EOS"],
- scan('heredoc_end', "<<EOS\nheredoc\nEOS")
+ scan('heredoc_end', "<<""EOS\nheredoc\nEOS")
assert_equal ["EOS\n"],
- scan('heredoc_end', "<<EOS\nheredoc\nEOS\n")
+ scan('heredoc_end', "<<""EOS\nheredoc\nEOS\n")
assert_equal [],
- scan('heredoc_end', "<<EOS\nheredoc\nEOS \n")
+ scan('heredoc_end', "<<""EOS\nheredoc\nEOS \n")
assert_equal [],
- scan('heredoc_end', "<<-EOS\nheredoc\n\tEOS \n")
+ scan('heredoc_end', "<<""-EOS\nheredoc\n\tEOS \n")
end
def test_semicolon
@@ -823,8 +867,8 @@ class TestRipper::ScannerEvents < Test::Unit::TestCase
def test_CHAR
assert_equal [],
scan('CHAR', "")
- assert_equal ["@"],
- scan('CHAR', "@")
+ assert_equal ["?a"],
+ scan('CHAR', "?a")
assert_equal [],
scan('CHAR', "@ivar")
end
diff --git a/test/rss/rss-assertions.rb b/test/rss/rss-assertions.rb
index 86f9dd87c0..5763a55eb1 100644
--- a/test/rss/rss-assertions.rb
+++ b/test/rss/rss-assertions.rb
@@ -332,7 +332,7 @@ EOA
_wrap_assertion do
[nil, "text", "html"].each do |type|
attr = ""
- attr = " type=\"#{type}\""if type
+ attr = " type=\"#{type}\"" if type
assert_parse(generator.call(<<-EOA), :nothing_raised)
<#{tag_name}#{attr}/>
EOA
@@ -972,7 +972,7 @@ EOA
feed_readers) do |maker|
yield maker
targets = chain_reader(maker, maker_readers)
- target = targets.new_child
+ targets.new_child
end
end
diff --git a/test/rss/rss-testcase.rb b/test/rss/rss-testcase.rb
index 6a7093a8da..2e39433d4a 100644
--- a/test/rss/rss-testcase.rb
+++ b/test/rss/rss-testcase.rb
@@ -1,7 +1,7 @@
require "erb"
require "test/unit"
-require 'rss-assertions'
+require_relative 'rss-assertions'
require "rss"
@@ -186,7 +186,7 @@ EORSS
elems = ["<link>#{res}</link>"]
elems << "<title>title of #{res}</title>"
elems = elems.join("\n")
- item = "<item>\n#{elems}\n</item>"
+ "<item>\n#{elems}\n</item>"
end.join("\n")
end
diff --git a/test/rss/test_1.0.rb b/test/rss/test_1.0.rb
index 4b496adfcd..758eecf51d 100644
--- a/test/rss/test_1.0.rb
+++ b/test/rss/test_1.0.rb
@@ -1,6 +1,6 @@
require "rexml/document"
-require "rss-testcase"
+require_relative "rss-testcase"
require "rss/1.0"
@@ -54,9 +54,6 @@ module RSS
def test_channel
about = "http://hoge.com"
- title = "fugafuga"
- link = "http://hoge.com"
- description = "fugafugafugafuga"
resource = "http://hoge.com/hoge.png"
item_title = "item title"
@@ -72,9 +69,18 @@ module RSS
rss_item.link = item_link
rss_item.about = item_link
+ h = {
+ 'title' => "fugafuga",
+ 'link' => "http://hoge.com",
+ 'description' => "fugafugafugafuga",
+ 'image' => image,
+ 'items' => items,
+ 'textinput' => textinput,
+ }
+
channel = RDF::Channel.new(about)
%w(title link description image items textinput).each do |x|
- channel.__send__("#{x}=", instance_eval(x))
+ channel.__send__("#{x}=", h[x])
end
doc = REXML::Document.new(make_RDF(<<-EOR))
@@ -96,7 +102,7 @@ EOR
assert_equal(@rdf_uri, res.namespace)
value = res.value
else
- excepted = instance_eval(x)
+ excepted = h[x]
value = elem.text
end
assert_equal(excepted, value)
@@ -199,13 +205,15 @@ EOR
def test_image
about = "http://hoge.com"
- title = "fugafuga"
- url = "http://hoge.com/hoge"
- link = "http://hoge.com/fuga"
+ h = {
+ 'title' => "fugafuga",
+ 'url' => "http://hoge.com/hoge",
+ 'link' => "http://hoge.com/fuga",
+ }
image = RDF::Image.new(about)
%w(title url link).each do |x|
- image.__send__("#{x}=", instance_eval(x))
+ image.__send__("#{x}=", h[x])
end
doc = REXML::Document.new(make_RDF(image.to_s))
@@ -216,19 +224,21 @@ EOR
elem = i.elements[x]
assert_equal(x, elem.name)
assert_equal(@uri, elem.namespace)
- assert_equal(instance_eval(x), elem.text)
+ assert_equal(h[x], elem.text)
end
end
def test_item
about = "http://hoge.com"
- title = "fugafuga"
- link = "http://hoge.com/fuga"
- description = "hogehogehoge"
+ h = {
+ 'title' => "fugafuga",
+ 'link' => "http://hoge.com/fuga",
+ 'description' => "hogehogehoge",
+ }
item = RDF::Item.new(about)
%w(title link description).each do |x|
- item.__send__("#{x}=", instance_eval(x))
+ item.__send__("#{x}=", h[x])
end
doc = REXML::Document.new(make_RDF(item.to_s))
@@ -239,20 +249,22 @@ EOR
elem = i.elements[x]
assert_equal(x, elem.name)
assert_equal(@uri, elem.namespace)
- assert_equal(instance_eval(x), elem.text)
+ assert_equal(h[x], elem.text)
end
end
def test_textinput
about = "http://hoge.com"
- title = "fugafuga"
- link = "http://hoge.com/fuga"
- name = "foo"
- description = "hogehogehoge"
+ h = {
+ 'title' => "fugafuga",
+ 'link' => "http://hoge.com/fuga",
+ 'name' => "foo",
+ 'description' => "hogehogehoge",
+ }
textinput = RDF::Textinput.new(about)
%w(title link name description).each do |x|
- textinput.__send__("#{x}=", instance_eval(x))
+ textinput.__send__("#{x}=", h[x])
end
doc = REXML::Document.new(make_RDF(textinput.to_s))
@@ -263,7 +275,7 @@ EOR
elem = t.elements[x]
assert_equal(x, elem.name)
assert_equal(@uri, elem.namespace)
- assert_equal(instance_eval(x), elem.text)
+ assert_equal(h[x], elem.text)
end
end
diff --git a/test/rss/test_2.0.rb b/test/rss/test_2.0.rb
index ed83ca6cf7..37285cefa3 100644
--- a/test/rss/test_2.0.rb
+++ b/test/rss/test_2.0.rb
@@ -1,6 +1,6 @@
require "rexml/document"
-require "rss-testcase"
+require_relative "rss-testcase"
module RSS
class TestRSS20Core < TestCase
@@ -53,16 +53,22 @@ module RSS
end
def test_channel
- title = "fugafuga"
- link = "http://hoge.com"
- description = "fugafugafugafuga"
-
- language = "en-us"
- copyright = "Copyright 2002, Spartanburg Herald-Journal"
- managingEditor = "geo@herald.com (George Matesky)"
- webMaster = "betty@herald.com (Betty Guernsey)"
- pubDate = Time.parse("Sat, 07 Sep 2002 00:00:01 GMT")
- lastBuildDate = Time.parse("Sat, 07 Sep 2002 09:42:31 GMT")
+ h = {
+ 'title' => "fugafuga",
+ 'link' => "http://hoge.com",
+ 'description' => "fugafugafugafuga",
+
+ 'language' => "en-us",
+ 'copyright' => "Copyright 2002, Spartanburg Herald-Journal",
+ 'managingEditor' => "geo@herald.com (George Matesky)",
+ 'webMaster' => "betty@herald.com (Betty Guernsey)",
+ 'pubDate' => Time.parse("Sat, 07 Sep 2002 00:00:01 GMT"),
+ 'lastBuildDate' => Time.parse("Sat, 07 Sep 2002 09:42:31 GMT"),
+ 'generator' => "MightyInHouse Content System v2.3",
+ 'docs' => "http://blogs.law.harvard.edu/tech/rss",
+ 'ttl' => "60",
+ 'rating' => '(PICS-1.1 "http://www.rsac.org/ratingsv01.html" l gen true comment "RSACi North America Server" for "http://www.rsac.org" on "1996.04.16T08:15-0500" r (n 0 s 0 v 0 l 0))',
+ }
categories = [
{
:content => "Newspapers",
@@ -72,12 +78,6 @@ module RSS
:content => "1765",
}
]
- generator = "MightyInHouse Content System v2.3"
- docs = "http://blogs.law.harvard.edu/tech/rss"
-
- ttl = "60"
-
- rating = '(PICS-1.1 "http://www.rsac.org/ratingsv01.html" l gen true comment "RSACi North America Server" for "http://www.rsac.org" on "1996.04.16T08:15-0500" r (n 0 s 0 v 0 l 0))'
channel = Rss::Channel.new
@@ -85,7 +85,7 @@ module RSS
managingEditor webMaster pubDate lastBuildDate
generator docs ttl rating)
elems.each do |x|
- value = instance_eval(x)
+ value = h[x]
value = value.rfc822 if %w(pubDate lastBuildDate).include?(x)
channel.__send__("#{x}=", value)
end
@@ -101,7 +101,7 @@ module RSS
elem = c.elements[x]
assert_equal(x, elem.name)
assert_equal("", elem.namespace)
- expected = instance_eval(x)
+ expected = h[x]
case x
when "pubDate", "lastBuildDate"
assert_equal(expected, Time.parse(elem.text))
@@ -236,10 +236,14 @@ module RSS
end
def test_item
- title = "fugafuga"
- link = "http://hoge.com/"
- description = "text hoge fuga"
- author = "oprah@oxygen.net"
+ h = {
+ 'title' => "fugafuga",
+ 'link' => "http://hoge.com/",
+ 'description' => "text hoge fuga",
+ 'author' => "oprah@oxygen.net",
+ 'comments' => "http://www.myblog.org/cgi-local/mt/mt-comments.cgi?entry_id=290",
+ 'pubDate' => Time.parse("Sat, 07 Sep 2002 00:00:01 GMT"),
+ }
categories = [
{
:content => "Newspapers",
@@ -249,8 +253,6 @@ module RSS
:content => "1765",
}
]
- comments = "http://www.myblog.org/cgi-local/mt/mt-comments.cgi?entry_id=290"
- pubDate = Time.parse("Sat, 07 Sep 2002 00:00:01 GMT")
channel = Rss::Channel.new
channel.title = "title"
@@ -262,7 +264,7 @@ module RSS
elems = %w(title link description author comments pubDate)
elems.each do |x|
- value = instance_eval(x)
+ value = h[x]
value = value.rfc822 if x == "pubDate"
item.__send__("#{x}=", value)
end
@@ -279,7 +281,7 @@ module RSS
elem = item_elem.elements[x]
assert_equal(x, elem.name)
assert_equal("", elem.namespace)
- expected = instance_eval(x)
+ expected = h[x]
case x
when "pubDate"
assert_equal(expected, Time.parse(elem.text))
diff --git a/test/rss/test_accessor.rb b/test/rss/test_accessor.rb
index f2b8508a6d..ea15316a5d 100644
--- a/test/rss/test_accessor.rb
+++ b/test/rss/test_accessor.rb
@@ -1,4 +1,4 @@
-require "rss-testcase"
+require_relative "rss-testcase"
require "rss/1.0"
require "rss/2.0"
diff --git a/test/rss/test_atom.rb b/test/rss/test_atom.rb
index 80da69bd94..557cb80324 100644
--- a/test/rss/test_atom.rb
+++ b/test/rss/test_atom.rb
@@ -1,6 +1,6 @@
require "rexml/document"
-require "rss-testcase"
+require_relative "rss-testcase"
require "rss/atom"
@@ -453,11 +453,13 @@ module RSS
def assert_atom_link_to_s(target_class)
_wrap_assertion do
href = "http://example.com/atom.xml"
- rel = "self"
- type = "application/atom+xml"
- hreflang = "ja"
- title = "Atom Feed"
- length = "801"
+ optvs = {
+ 'rel' => "self",
+ 'type' => "application/atom+xml",
+ 'hreflang' => "ja",
+ 'title' => "Atom Feed",
+ 'length' => "801",
+ }
link = target_class.new
assert_equal("", link.to_s)
@@ -472,24 +474,24 @@ module RSS
rest = optional_arguments.reject {|x| x == name}
link = target_class.new
- link.__send__("#{name}=", eval(name))
+ link.__send__("#{name}=", optvs[name])
assert_equal("", link.to_s)
rest.each do |n|
- link.__send__("#{n}=", eval(n))
+ link.__send__("#{n}=", optvs[n])
assert_equal("", link.to_s)
end
link = target_class.new
link.href = href
- link.__send__("#{name}=", eval(name))
- attrs = [["href", href], [name, eval(name)]]
+ link.__send__("#{name}=", optvs[name])
+ attrs = [["href", href], [name, optvs[name]]]
xml = REXML::Document.new(link.to_s).root
assert_rexml_element([], attrs, nil, xml)
rest.each do |n|
- link.__send__("#{n}=", eval(n))
- attrs << [n, eval(n)]
+ link.__send__("#{n}=", optvs[n])
+ attrs << [n, optvs[n]]
xml = REXML::Document.new(link.to_s).root
assert_rexml_element([], attrs, nil, xml)
end
diff --git a/test/rss/test_content.rb b/test/rss/test_content.rb
index f59b0c8e83..13f22a2152 100644
--- a/test/rss/test_content.rb
+++ b/test/rss/test_content.rb
@@ -1,7 +1,7 @@
require "cgi"
require "rexml/document"
-require "rss-testcase"
+require_relative "rss-testcase"
require "rss/content"
diff --git a/test/rss/test_dublincore.rb b/test/rss/test_dublincore.rb
index 22b81483f4..eb03d84957 100644
--- a/test/rss/test_dublincore.rb
+++ b/test/rss/test_dublincore.rb
@@ -1,7 +1,7 @@
require "cgi"
require "rexml/document"
-require "rss-testcase"
+require_relative "rss-testcase"
require "rss/1.0"
require "rss/dublincore"
@@ -149,14 +149,8 @@ EOR
plural_suffix = dc_plural_suffix(name, check_backward_compatibility)
plural_reader = "dc_#{name}#{plural_suffix}"
- values = parent.__send__(plural_reader).collect do |x|
- val = x.value
- if val.kind_of?(String)
- CGI.escapeHTML(val)
- else
- val
- end
- end
+ values = parent.__send__(plural_reader).collect(&:value)
+ value = CGI.unescapeHTML(value) if value.kind_of?(String)
assert_equal([value, value], values)
end
end
@@ -170,9 +164,7 @@ EOR
parent = chain_reader(feed, parent_readers)
DC_ELEMENTS.each do |name, value|
parsed_value = parent.__send__("dc_#{name}")
- if parsed_value.kind_of?(String)
- parsed_value = CGI.escapeHTML(parsed_value)
- end
+ value = CGI.unescapeHTML(value) if value.kind_of?(String)
assert_equal(value, parsed_value)
if name == :date
t = Time.iso8601("2003-01-01T02:30:23+09:00")
@@ -206,9 +198,7 @@ EOR
parents.each do |parent_readers|
parent = chain_reader(feed, parent_readers)
parsed_value = parent.__send__("dc_#{name}")
- if parsed_value.kind_of?(String)
- parsed_value = CGI.escapeHTML(parsed_value)
- end
+ value = CGI.unescapeHTML(value) if value.kind_of?(String)
assert_equal(value, parsed_value)
plural_suffix = dc_plural_suffix(name, check_backward_compatibility)
@@ -269,8 +259,8 @@ EOR
parent = feed_root.elements[target_xpath]
parent.each_element do |elem|
if elem.namespace == DC_URI
- assert_equal(CGI.escapeHTML(elem.text),
- DC_ELEMENTS[elem.name.intern].to_s)
+ assert_equal(elem.text,
+ CGI.unescapeHTML(DC_ELEMENTS[elem.name.intern].to_s))
end
end
end
diff --git a/test/rss/test_image.rb b/test/rss/test_image.rb
index 101b7ffda2..d8f0b26103 100644
--- a/test/rss/test_image.rb
+++ b/test/rss/test_image.rb
@@ -1,7 +1,7 @@
require "cgi"
require "rexml/document"
-require "rss-testcase"
+require_relative "rss-testcase"
require "rss/1.0"
require "rss/image"
diff --git a/test/rss/test_inherit.rb b/test/rss/test_inherit.rb
index f73096f478..8b640dc319 100644
--- a/test/rss/test_inherit.rb
+++ b/test/rss/test_inherit.rb
@@ -1,4 +1,4 @@
-require "rss-testcase"
+require_relative "rss-testcase"
require "rss/1.0"
diff --git a/test/rss/test_itunes.rb b/test/rss/test_itunes.rb
index 283459d910..ec06337f7d 100644
--- a/test/rss/test_itunes.rb
+++ b/test/rss/test_itunes.rb
@@ -1,7 +1,7 @@
require "cgi"
require "rexml/document"
-require "rss-testcase"
+require_relative "rss-testcase"
require "rss/2.0"
require "rss/itunes"
diff --git a/test/rss/test_maker_0.9.rb b/test/rss/test_maker_0.9.rb
index c36a0be580..f6e39c60b7 100644
--- a/test/rss/test_maker_0.9.rb
+++ b/test/rss/test_maker_0.9.rb
@@ -1,4 +1,4 @@
-require "rss-testcase"
+require_relative "rss-testcase"
require "rss/maker"
diff --git a/test/rss/test_maker_1.0.rb b/test/rss/test_maker_1.0.rb
index b465556979..b31abb9908 100644
--- a/test/rss/test_maker_1.0.rb
+++ b/test/rss/test_maker_1.0.rb
@@ -1,4 +1,4 @@
-require "rss-testcase"
+require_relative "rss-testcase"
require "rss/maker"
diff --git a/test/rss/test_maker_2.0.rb b/test/rss/test_maker_2.0.rb
index 705270df4e..48c0f91f48 100644
--- a/test/rss/test_maker_2.0.rb
+++ b/test/rss/test_maker_2.0.rb
@@ -1,4 +1,4 @@
-require "rss-testcase"
+require_relative "rss-testcase"
require "rss/maker"
@@ -445,7 +445,7 @@ module RSS
def test_pubDate_without_description
title = "TITLE"
link = "http://hoge.com/"
- description = "text hoge fuga"
+ # description = "text hoge fuga"
author = "oprah@oxygen.net"
pubDate = Time.now
@@ -529,13 +529,13 @@ module RSS
end
def test_not_valid_guid
- content = "http://inessential.com/2002/09/01.php#a2"
+ # content = "http://inessential.com/2002/09/01.php#a2"
rss = RSS::Maker.make("2.0") do |maker|
setup_dummy_channel(maker)
setup_dummy_item(maker)
- guid = maker.items.last.guid
+ # guid = maker.items.last.guid
# guid.content = content
end
assert_nil(rss.channel.items.last.guid)
@@ -662,7 +662,7 @@ module RSS
end
def test_not_valid_category
- content = "Grateful Dead"
+ # content = "Grateful Dead"
rss = RSS::Maker.make("2.0") do |maker|
setup_dummy_channel(maker)
diff --git a/test/rss/test_maker_atom_entry.rb b/test/rss/test_maker_atom_entry.rb
index 4275bdc685..9618723e62 100644
--- a/test/rss/test_maker_atom_entry.rb
+++ b/test/rss/test_maker_atom_entry.rb
@@ -1,4 +1,4 @@
-require "rss-testcase"
+require_relative "rss-testcase"
require "rss/maker"
diff --git a/test/rss/test_maker_atom_feed.rb b/test/rss/test_maker_atom_feed.rb
index 58a55c43ff..d86600113d 100644
--- a/test/rss/test_maker_atom_feed.rb
+++ b/test/rss/test_maker_atom_feed.rb
@@ -1,4 +1,4 @@
-require "rss-testcase"
+require_relative "rss-testcase"
require "rss/maker"
diff --git a/test/rss/test_maker_content.rb b/test/rss/test_maker_content.rb
index 393adcb715..ba884f16a3 100644
--- a/test/rss/test_maker_content.rb
+++ b/test/rss/test_maker_content.rb
@@ -1,4 +1,4 @@
-require "rss-testcase"
+require_relative "rss-testcase"
require "rss/maker"
diff --git a/test/rss/test_maker_dc.rb b/test/rss/test_maker_dc.rb
index 626ec8d753..977350ca75 100644
--- a/test/rss/test_maker_dc.rb
+++ b/test/rss/test_maker_dc.rb
@@ -1,4 +1,4 @@
-require "rss-testcase"
+require_relative "rss-testcase"
require "rss/maker"
diff --git a/test/rss/test_maker_image.rb b/test/rss/test_maker_image.rb
index 4fba2cf795..d01654c91b 100644
--- a/test/rss/test_maker_image.rb
+++ b/test/rss/test_maker_image.rb
@@ -1,4 +1,4 @@
-require "rss-testcase"
+require_relative "rss-testcase"
require "rss/maker"
diff --git a/test/rss/test_maker_itunes.rb b/test/rss/test_maker_itunes.rb
index 21a4dd1f29..f19e30d012 100644
--- a/test/rss/test_maker_itunes.rb
+++ b/test/rss/test_maker_itunes.rb
@@ -1,4 +1,4 @@
-require "rss-testcase"
+require_relative "rss-testcase"
require "rss/maker"
diff --git a/test/rss/test_maker_slash.rb b/test/rss/test_maker_slash.rb
index f2fbf9a231..ea95a99b68 100644
--- a/test/rss/test_maker_slash.rb
+++ b/test/rss/test_maker_slash.rb
@@ -1,4 +1,4 @@
-require "rss-testcase"
+require_relative "rss-testcase"
require "rss/maker"
diff --git a/test/rss/test_maker_sy.rb b/test/rss/test_maker_sy.rb
index 3f026b5c9c..7117e3af0c 100644
--- a/test/rss/test_maker_sy.rb
+++ b/test/rss/test_maker_sy.rb
@@ -1,4 +1,4 @@
-require "rss-testcase"
+require_relative "rss-testcase"
require "rss/maker"
diff --git a/test/rss/test_maker_taxo.rb b/test/rss/test_maker_taxo.rb
index c5cf18adc1..4c4c2e336a 100644
--- a/test/rss/test_maker_taxo.rb
+++ b/test/rss/test_maker_taxo.rb
@@ -1,4 +1,4 @@
-require "rss-testcase"
+require_relative "rss-testcase"
require "rss/maker"
diff --git a/test/rss/test_maker_trackback.rb b/test/rss/test_maker_trackback.rb
index d9fe2ad01d..411bf319ca 100644
--- a/test/rss/test_maker_trackback.rb
+++ b/test/rss/test_maker_trackback.rb
@@ -1,4 +1,4 @@
-require "rss-testcase"
+require_relative "rss-testcase"
require "rss/maker"
diff --git a/test/rss/test_maker_xml-stylesheet.rb b/test/rss/test_maker_xml-stylesheet.rb
index c1dd6f71ed..4f7c62aaeb 100644
--- a/test/rss/test_maker_xml-stylesheet.rb
+++ b/test/rss/test_maker_xml-stylesheet.rb
@@ -1,4 +1,4 @@
-require "rss-testcase"
+require_relative "rss-testcase"
require "rss/maker"
diff --git a/test/rss/test_parser.rb b/test/rss/test_parser.rb
index 2e8c9be4d3..8d8d1e1970 100644
--- a/test/rss/test_parser.rb
+++ b/test/rss/test_parser.rb
@@ -1,6 +1,6 @@
-require "fileutils"
+require "tempfile"
-require "rss-testcase"
+require_relative "rss-testcase"
require "rss/1.0"
require "rss/dublincore"
@@ -15,13 +15,15 @@ module RSS
#{make_textinput}
#{make_image}
EOR
- @rss_file = "rss10.rdf"
- File.open(@rss_file, "w") {|f| f.print(@rss10)}
+ @rss_tmp = Tempfile.new(%w"rss10- .rdf")
+ @rss_tmp.print(@rss10)
+ @rss_tmp.close
+ @rss_file = @rss_tmp.path.untaint
end
def teardown
Parser.default_parser = @_default_parser
- FileUtils.rm_f(@rss_file)
+ @rss_tmp.close(true)
end
def test_default_parser
diff --git a/test/rss/test_parser_1.0.rb b/test/rss/test_parser_1.0.rb
index dca10e6f40..2efecdaf35 100644
--- a/test/rss/test_parser_1.0.rb
+++ b/test/rss/test_parser_1.0.rb
@@ -1,4 +1,4 @@
-require "rss-testcase"
+require_relative "rss-testcase"
require "rss/1.0"
require "rss/dublincore"
diff --git a/test/rss/test_parser_2.0.rb b/test/rss/test_parser_2.0.rb
index 249347d3dc..68c7d1cca0 100644
--- a/test/rss/test_parser_2.0.rb
+++ b/test/rss/test_parser_2.0.rb
@@ -1,4 +1,4 @@
-require "rss-testcase"
+require_relative "rss-testcase"
require "rss/2.0"
diff --git a/test/rss/test_parser_atom_entry.rb b/test/rss/test_parser_atom_entry.rb
index c2572d7a3b..352fbbe7f9 100644
--- a/test/rss/test_parser_atom_entry.rb
+++ b/test/rss/test_parser_atom_entry.rb
@@ -1,4 +1,4 @@
-require "rss-testcase"
+require_relative "rss-testcase"
require "rss/atom"
diff --git a/test/rss/test_parser_atom_feed.rb b/test/rss/test_parser_atom_feed.rb
index 4358cc8898..a5731b2f67 100644
--- a/test/rss/test_parser_atom_feed.rb
+++ b/test/rss/test_parser_atom_feed.rb
@@ -1,4 +1,4 @@
-require "rss-testcase"
+require_relative "rss-testcase"
require "rss/atom"
diff --git a/test/rss/test_setup_maker_0.9.rb b/test/rss/test_setup_maker_0.9.rb
index 0bcb0cbdc9..2714b9cece 100644
--- a/test/rss/test_setup_maker_0.9.rb
+++ b/test/rss/test_setup_maker_0.9.rb
@@ -1,4 +1,4 @@
-require "rss-testcase"
+require_relative "rss-testcase"
require "rss/maker"
diff --git a/test/rss/test_setup_maker_1.0.rb b/test/rss/test_setup_maker_1.0.rb
index 9f7bb1c1e8..0408ca911e 100644
--- a/test/rss/test_setup_maker_1.0.rb
+++ b/test/rss/test_setup_maker_1.0.rb
@@ -1,4 +1,4 @@
-require "rss-testcase"
+require_relative "rss-testcase"
require "rss/maker"
diff --git a/test/rss/test_setup_maker_2.0.rb b/test/rss/test_setup_maker_2.0.rb
index 17a066a8a0..fcf1f57836 100644
--- a/test/rss/test_setup_maker_2.0.rb
+++ b/test/rss/test_setup_maker_2.0.rb
@@ -1,4 +1,4 @@
-require "rss-testcase"
+require_relative "rss-testcase"
require "rss/maker"
diff --git a/test/rss/test_setup_maker_atom_entry.rb b/test/rss/test_setup_maker_atom_entry.rb
index 6f3df65f3f..ec9df5e70a 100644
--- a/test/rss/test_setup_maker_atom_entry.rb
+++ b/test/rss/test_setup_maker_atom_entry.rb
@@ -1,4 +1,4 @@
-require "rss-testcase"
+require_relative "rss-testcase"
require "rss/maker"
diff --git a/test/rss/test_setup_maker_atom_feed.rb b/test/rss/test_setup_maker_atom_feed.rb
index 978b3cf123..ad2c6939d2 100644
--- a/test/rss/test_setup_maker_atom_feed.rb
+++ b/test/rss/test_setup_maker_atom_feed.rb
@@ -1,4 +1,4 @@
-require "rss-testcase"
+require_relative "rss-testcase"
require "rss/maker"
diff --git a/test/rss/test_setup_maker_itunes.rb b/test/rss/test_setup_maker_itunes.rb
index 1f0372d6e7..509d94f13b 100644
--- a/test/rss/test_setup_maker_itunes.rb
+++ b/test/rss/test_setup_maker_itunes.rb
@@ -1,4 +1,4 @@
-require "rss-testcase"
+require_relative "rss-testcase"
require "rss/maker"
diff --git a/test/rss/test_setup_maker_slash.rb b/test/rss/test_setup_maker_slash.rb
index 07fa5bb342..cd12db9f91 100644
--- a/test/rss/test_setup_maker_slash.rb
+++ b/test/rss/test_setup_maker_slash.rb
@@ -1,4 +1,4 @@
-require "rss-testcase"
+require_relative "rss-testcase"
require "rss/maker"
diff --git a/test/rss/test_slash.rb b/test/rss/test_slash.rb
index aec0a868f5..757e7879f2 100644
--- a/test/rss/test_slash.rb
+++ b/test/rss/test_slash.rb
@@ -1,7 +1,7 @@
require "cgi"
require "rexml/document"
-require "rss-testcase"
+require_relative "rss-testcase"
require "rss/1.0"
require "rss/slash"
diff --git a/test/rss/test_syndication.rb b/test/rss/test_syndication.rb
index 69d6f44464..17875f1954 100644
--- a/test/rss/test_syndication.rb
+++ b/test/rss/test_syndication.rb
@@ -1,7 +1,7 @@
require "cgi"
require "rexml/document"
-require "rss-testcase"
+require_relative "rss-testcase"
require "rss/1.0"
require "rss/syndication"
diff --git a/test/rss/test_taxonomy.rb b/test/rss/test_taxonomy.rb
index 0370555d87..34937e4367 100644
--- a/test/rss/test_taxonomy.rb
+++ b/test/rss/test_taxonomy.rb
@@ -1,6 +1,6 @@
require "cgi"
-require "rss-testcase"
+require_relative "rss-testcase"
require "rss/1.0"
require "rss/2.0"
diff --git a/test/rss/test_to_s.rb b/test/rss/test_to_s.rb
index 4b38737bef..4ef83ce18b 100644
--- a/test/rss/test_to_s.rb
+++ b/test/rss/test_to_s.rb
@@ -1,6 +1,6 @@
require "rexml/document"
-require "rss-testcase"
+require_relative "rss-testcase"
require "rss/maker"
require "rss/1.0"
diff --git a/test/rss/test_trackback.rb b/test/rss/test_trackback.rb
index 433e884deb..8560c254f0 100644
--- a/test/rss/test_trackback.rb
+++ b/test/rss/test_trackback.rb
@@ -1,7 +1,7 @@
require "cgi"
require "rexml/document"
-require "rss-testcase"
+require_relative "rss-testcase"
require "rss/1.0"
require "rss/2.0"
diff --git a/test/rss/test_version.rb b/test/rss/test_version.rb
index 17679012d3..d2175ab76a 100644
--- a/test/rss/test_version.rb
+++ b/test/rss/test_version.rb
@@ -1,4 +1,4 @@
-require "rss-testcase"
+require_relative "rss-testcase"
module RSS
class TestVersion < TestCase
diff --git a/test/rss/test_xml-stylesheet.rb b/test/rss/test_xml-stylesheet.rb
index 6edafaeaa0..c67922f4ec 100644
--- a/test/rss/test_xml-stylesheet.rb
+++ b/test/rss/test_xml-stylesheet.rb
@@ -1,6 +1,6 @@
require "rexml/document"
-require "rss-testcase"
+require_relative "rss-testcase"
require "rss/1.0"
require "rss/xml-stylesheet"
diff --git a/test/ruby/allpairs.rb b/test/ruby/allpairs.rb
index 6cb2729b19..27b6f5988f 100644
--- a/test/ruby/allpairs.rb
+++ b/test/ruby/allpairs.rb
@@ -66,7 +66,6 @@ module AllPairs
def each_index(*vs)
n = vs.length
max_v = vs.max
- prime = make_prime(max_v)
h = {}
make_large_block(max_v, n) {|row|
row = vs.zip(row).map {|v, i| i % v }
diff --git a/test/ruby/enc/test_euc_jp.rb b/test/ruby/enc/test_euc_jp.rb
index 1ccc55ccb9..510ee4611e 100644
--- a/test/ruby/enc/test_euc_jp.rb
+++ b/test/ruby/enc/test_euc_jp.rb
@@ -5,7 +5,7 @@ require "test/unit"
class TestEUC_JP < Test::Unit::TestCase
def test_mbc_case_fold
assert_match(/(£á)(a)\1\2/i, "£áa£áA")
- assert_no_match(/(£á)(a)\1\2/i, "£áa£ÁA")
+ assert_match(/(£á)(a)\1\2/i, "£áa£ÁA")
end
def test_property
diff --git a/test/ruby/enc/test_shift_jis.rb b/test/ruby/enc/test_shift_jis.rb
index 54ef67dd44..1bd47fa859 100644
--- a/test/ruby/enc/test_shift_jis.rb
+++ b/test/ruby/enc/test_shift_jis.rb
@@ -5,7 +5,7 @@ require "test/unit"
class TestShiftJIS < Test::Unit::TestCase
def test_mbc_case_fold
assert_match(/(‚)(a)\1\2/i, "‚a‚A")
- assert_no_match(/(‚)(a)\1\2/i, "‚a‚`A")
+ assert_match(/(‚)(a)\1\2/i, "‚a‚`A")
end
def test_property
diff --git a/test/ruby/enc/test_utf16.rb b/test/ruby/enc/test_utf16.rb
index 90a8314067..7d2197da98 100644
--- a/test/ruby/enc/test_utf16.rb
+++ b/test/ruby/enc/test_utf16.rb
@@ -49,7 +49,7 @@ class TestUTF16 < Test::Unit::TestCase
#{encdump expected} expected but not equal to
#{encdump actual}.
EOT
- assert_block(full_message) { expected == actual }
+ assert_equal(expected, actual, full_message)
end
# tests start
diff --git a/test/ruby/enc/test_utf32.rb b/test/ruby/enc/test_utf32.rb
index 3d4a458512..29a2240598 100644
--- a/test/ruby/enc/test_utf32.rb
+++ b/test/ruby/enc/test_utf32.rb
@@ -15,7 +15,7 @@ class TestUTF32 < Test::Unit::TestCase
#{encdump expected} expected but not equal to
#{encdump actual}.
EOT
- assert_block(full_message) { expected == actual }
+ assert_equal(expected, actual, full_message)
end
def test_substr
diff --git a/test/ruby/envutil.rb b/test/ruby/envutil.rb
index 73f0101ac1..7424997e84 100644
--- a/test/ruby/envutil.rb
+++ b/test/ruby/envutil.rb
@@ -1,11 +1,10 @@
+# -*- coding: us-ascii -*-
require "open3"
require "timeout"
+require "test/unit"
module EnvUtil
def rubybin
- unless ENV["RUBYOPT"]
-
- end
if ruby = ENV["RUBY"]
return ruby
end
@@ -30,19 +29,18 @@ module EnvUtil
LANG_ENVS = %w"LANG LC_ALL LC_CTYPE"
- def invoke_ruby(args, stdin_data="", capture_stdout=false, capture_stderr=false, opt={})
+ def invoke_ruby(args, stdin_data = "", capture_stdout = false, capture_stderr = false,
+ encoding: nil, timeout: 10, reprieve: 1, **opt)
in_c, in_p = IO.pipe
out_p, out_c = IO.pipe if capture_stdout
err_p, err_c = IO.pipe if capture_stderr && capture_stderr != :merge_to_stdout
- opt = opt.dup
opt[:in] = in_c
opt[:out] = out_c if capture_stdout
opt[:err] = capture_stderr == :merge_to_stdout ? out_c : err_c if capture_stderr
- if enc = opt.delete(:encoding)
- out_p.set_encoding(enc) if out_p
- err_p.set_encoding(enc) if err_p
+ if encoding
+ out_p.set_encoding(encoding) if out_p
+ err_p.set_encoding(encoding) if err_p
end
- timeout = opt.delete(:timeout) || 10
c = "C"
child_env = {}
LANG_ENVS.each {|lc| child_env[lc] = c}
@@ -50,7 +48,7 @@ module EnvUtil
child_env.update(args.shift)
end
args = [args] if args.kind_of?(String)
- pid = spawn(child_env, EnvUtil.rubybin, *args, opt)
+ pid = spawn(child_env, EnvUtil.rubybin, *args, **opt)
in_c.close
out_c.close if capture_stdout
err_c.close if capture_stderr && capture_stderr != :merge_to_stdout
@@ -59,13 +57,28 @@ module EnvUtil
else
th_stdout = Thread.new { out_p.read } if capture_stdout
th_stderr = Thread.new { err_p.read } if capture_stderr && capture_stderr != :merge_to_stdout
- in_p.write stdin_data.to_str
+ in_p.write stdin_data.to_str unless stdin_data.empty?
in_p.close
if (!th_stdout || th_stdout.join(timeout)) && (!th_stderr || th_stderr.join(timeout))
stdout = th_stdout.value if capture_stdout
stderr = th_stderr.value if capture_stderr && capture_stderr != :merge_to_stdout
else
- raise Timeout::Error
+ signal = /mswin|mingw/ =~ RUBY_PLATFORM ? :KILL : :TERM
+ begin
+ Process.kill signal, pid
+ Timeout.timeout((reprieve unless signal == :KILL)) do
+ Process.wait(pid)
+ end
+ rescue Errno::ESRCH
+ break
+ rescue Timeout::Error
+ raise if signal == :KILL
+ signal = :KILL
+ else
+ break
+ end while true
+ bt = caller_locations
+ raise Timeout::Error, "execution of #{bt.shift.label} expired", bt.map(&:to_s)
end
out_p.close if capture_stdout
err_p.close if capture_stderr && capture_stderr != :merge_to_stdout
@@ -74,11 +87,14 @@ module EnvUtil
return stdout, stderr, status
end
ensure
+ [th_stdout, th_stderr].each do |th|
+ th.kill if th
+ end
[in_c, in_p, out_c, out_p, err_c, err_p].each do |io|
io.close if io && !io.closed?
end
[th_stdout, th_stderr].each do |th|
- (th.kill; th.join) if th
+ th.join if th
end
end
module_function :invoke_ruby
@@ -94,9 +110,9 @@ module EnvUtil
end
stderr, $stderr, verbose, $VERBOSE = $stderr, stderr, $VERBOSE, true
yield stderr
+ return $stderr
ensure
stderr, $stderr, $VERBOSE = $stderr, stderr, verbose
- return stderr
end
module_function :verbose_warning
@@ -108,32 +124,137 @@ module EnvUtil
end
module_function :suppress_warning
- def under_gc_stress
- stress, GC.stress = GC.stress, true
+ def under_gc_stress(stress = true)
+ stress, GC.stress = GC.stress, stress
yield
ensure
GC.stress = stress
end
module_function :under_gc_stress
+
+ 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
+ module_function :with_default_external
+
+ 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
+ module_function :with_default_internal
+
+ if /darwin/ =~ RUBY_PLATFORM
+ DIAGNOSTIC_REPORTS_PATH = File.expand_path("~/Library/Logs/DiagnosticReports")
+ DIAGNOSTIC_REPORTS_TIMEFORMAT = '%Y-%m-%d-%H%M%S'
+ def self.diagnostic_reports(signame, cmd, pid, now)
+ return unless %w[ABRT QUIT SEGV ILL].include?(signame)
+ cmd = File.basename(cmd)
+ path = DIAGNOSTIC_REPORTS_PATH
+ timeformat = DIAGNOSTIC_REPORTS_TIMEFORMAT
+ pat = "#{path}/#{cmd}_#{now.strftime(timeformat)}[-_]*.crash"
+ first = true
+ 3.times do
+ first ? (first = false) : sleep(1)
+ Dir.glob(pat) do |name|
+ log = File.read(name) rescue next
+ if /\AProcess:\s+#{cmd} \[#{pid}\]$/ =~ log
+ File.unlink(name)
+ File.unlink("#{path}/.#{File.basename(name)}.plist")
+ return log
+ end
+ end
+ end
+ nil
+ end
+ else
+ def self.diagnostic_reports(signame, cmd, pid, now)
+ end
+ end
end
module Test
module Unit
module Assertions
public
- def assert_normal_exit(testsrc, message = '', opt = {})
- if opt.include?(:child_env)
- opt = opt.dup
- child_env = [opt.delete(:child_env)] || []
+ def assert_valid_syntax(code, fname = caller_locations(1, 1)[0], mesg = fname.to_s)
+ code = code.dup.force_encoding("ascii-8bit")
+ code.sub!(/\A(?:\xef\xbb\xbf)?(\s*\#.*$)*(\n)?/n) {
+ "#$&#{"\n" if $1 && !$2}BEGIN{throw tag, :ok}\n"
+ }
+ code.force_encoding(Encoding::UTF_8)
+ verbose, $VERBOSE = $VERBOSE, nil
+ yield if defined?(yield)
+ case
+ when Array === fname
+ fname, line = *fname
+ when defined?(fname.path) && defined?(fname.lineno)
+ fname, line = fname.path, fname.lineno
+ else
+ line = 0
+ end
+ assert_nothing_raised(SyntaxError, mesg) do
+ assert_equal(:ok, catch {|tag| eval(code, binding, fname, line)}, mesg)
+ end
+ ensure
+ $VERBOSE = verbose
+ end
+
+ def assert_syntax_error(code, error, fname = caller_locations(1, 1)[0], mesg = fname.to_s)
+ code = code.dup.force_encoding("ascii-8bit")
+ code.sub!(/\A(?:\xef\xbb\xbf)?(\s*\#.*$)*(\n)?/n) {
+ "#$&#{"\n" if $1 && !$2}BEGIN{throw tag, :ng}\n"
+ }
+ code.force_encoding("us-ascii")
+ verbose, $VERBOSE = $VERBOSE, nil
+ yield if defined?(yield)
+ case
+ when Array === fname
+ fname, line = *fname
+ when defined?(fname.path) && defined?(fname.lineno)
+ fname, line = fname.path, fname.lineno
+ else
+ line = 0
+ end
+ e = assert_raise(SyntaxError, mesg) do
+ catch {|tag| eval(code, binding, fname, line)}
+ end
+ assert_match(error, e.message, mesg)
+ ensure
+ $VERBOSE = verbose
+ end
+
+ def assert_normal_exit(testsrc, message = '', child_env: nil, **opt)
+ assert_valid_syntax(testsrc, caller_locations(1, 1)[0])
+ if child_env
+ child_env = [child_env]
else
child_env = []
end
- out, _, status = EnvUtil.invoke_ruby(child_env + %W'-W0', testsrc, true, :merge_to_stdout, opt)
+ out, _, status = EnvUtil.invoke_ruby(child_env + %W'-W0', testsrc, true, :merge_to_stdout, **opt)
+ assert !status.signaled?, FailDesc[status, message, out]
+ end
+
+ FailDesc = proc do |status, message = "", out = ""|
pid = status.pid
+ now = Time.now
faildesc = proc do
signo = status.termsig
- signame = Signal.list.invert[signo]
+ signame = Signal.signame(signo)
sigdesc = "signal #{signo}"
+ log = EnvUtil.diagnostic_reports(signame, EnvUtil.rubybin, pid, now)
if signame
sigdesc = "SIG#{signame} (#{sigdesc})"
end
@@ -141,53 +262,168 @@ module Test
sigdesc << " (core dumped)"
end
full_message = ''
- if !message.empty?
+ if message and !message.empty?
full_message << message << "\n"
end
full_message << "pid #{pid} killed by #{sigdesc}"
- if !out.empty?
- out << "\n" if /\n\z/ !~ out
+ if out and !out.empty?
full_message << "\n#{out.gsub(/^/, '| ')}"
+ full_message << "\n" if /\n\z/ !~ full_message
+ end
+ if log
+ full_message << "\n#{log.gsub(/^/, '| ')}"
end
full_message
end
- assert !status.signaled?, faildesc
+ faildesc
end
- def assert_in_out_err(args, test_stdin = "", test_stdout = [], test_stderr = [], message = nil, opt={})
- stdout, stderr, status = EnvUtil.invoke_ruby(args, test_stdin, true, true, opt)
+ def assert_in_out_err(args, test_stdin = "", test_stdout = [], test_stderr = [], message = nil, **opt)
+ stdout, stderr, status = EnvUtil.invoke_ruby(args, test_stdin, true, true, **opt)
+ if signo = status.termsig
+ EnvUtil.diagnostic_reports(Signal.signame(signo), EnvUtil.rubybin, status.pid, Time.now)
+ end
if block_given?
- yield(stdout.lines.map {|l| l.chomp }, stderr.lines.map {|l| l.chomp })
+ raise "test_stdout ignored, use block only or without block" if test_stdout != []
+ raise "test_stderr ignored, use block only or without block" if test_stderr != []
+ yield(stdout.lines.map {|l| l.chomp }, stderr.lines.map {|l| l.chomp }, status)
else
- if test_stdout.is_a?(Regexp)
- assert_match(test_stdout, stdout, message)
- else
- assert_equal(test_stdout, stdout.lines.map {|l| l.chomp }, message)
- end
- if test_stderr.is_a?(Regexp)
- assert_match(test_stderr, stderr, message)
- else
- assert_equal(test_stderr, stderr.lines.map {|l| l.chomp }, message)
+ errs = []
+ [[test_stdout, stdout], [test_stderr, stderr]].each do |exp, act|
+ begin
+ if exp.is_a?(Regexp)
+ assert_match(exp, act, message)
+ else
+ assert_equal(exp, act.lines.map {|l| l.chomp }, message)
+ end
+ rescue MiniTest::Assertion => e
+ errs << e.message
+ message = nil
+ end
end
+ raise MiniTest::Assertion, errs.join("\n---\n") unless errs.empty?
status
end
end
- def assert_ruby_status(args, test_stdin="", message=nil, opt={})
- _, _, status = EnvUtil.invoke_ruby(args, test_stdin, false, false, opt)
- m = message ? "#{message} (#{status.inspect})" : "ruby exit status is not success: #{status.inspect}"
- assert(status.success?, m)
+ def assert_ruby_status(args, test_stdin="", message=nil, **opt)
+ out, _, status = EnvUtil.invoke_ruby(args, test_stdin, true, :merge_to_stdout, **opt)
+ assert(!status.signaled?, FailDesc[status, message, out])
+ message ||= "ruby exit status is not success:"
+ assert(status.success?, "#{message} (#{status.inspect})")
end
- def assert_warn(msg)
+ ABORT_SIGNALS = Signal.list.values_at(*%w"ILL ABRT BUS SEGV")
+
+ def assert_separately(args, file = nil, line = nil, src, ignore_stderr: nil, **opt)
+ unless file and line
+ loc, = caller_locations(1,1)
+ file ||= loc.path
+ line ||= loc.lineno
+ end
+ line -= 2
+ src = <<eom
+# -*- coding: #{src.encoding}; -*-
+ require #{__dir__.dump}'/envutil';include Test::Unit::Assertions;begin
+#{src}
+ ensure
+ puts [Marshal.dump($!)].pack('m'), "assertions=\#{self._assertions}"
+ end
+ class Test::Unit::Runner
+ @@stop_auto_run = true
+ end
+eom
+ args = args.dup
+ args.insert((Hash === args.first ? 1 : 0), "--disable=gems", *$:.map {|l| "-I#{l}"})
+ stdout, stderr, status = EnvUtil.invoke_ruby(args, src, true, true, **opt)
+ abort = status.coredump? || (status.signaled? && ABORT_SIGNALS.include?(status.termsig))
+ assert(!abort, FailDesc[status, stderr])
+ self._assertions += stdout[/^assertions=(\d+)/, 1].to_i
+ begin
+ res = Marshal.load(stdout.unpack("m")[0])
+ rescue => marshal_error
+ ignore_stderr = nil
+ end
+ if res
+ res.backtrace.each do |l|
+ l.sub!(/\A-:(\d+)/){"#{file}:#{line + $1.to_i}"}
+ end
+ raise res
+ end
+
+ # really is it succeed?
+ unless ignore_stderr
+ # the body of assert_separately must not output anything to detect errror
+ assert_equal("", stderr, "assert_separately failed with error message")
+ end
+ assert_equal(0, status, "assert_separately failed: '#{stderr}'")
+ raise marshal_error if marshal_error
+ end
+
+ def assert_warning(pat, msg = nil)
stderr = EnvUtil.verbose_warning { yield }
- assert(msg === stderr, "warning message #{stderr.inspect} is expected to match #{msg.inspect}")
+ msg = message(msg) {diff stderr, pat}
+ assert(pat === stderr, msg)
+ end
+
+ def assert_warn(*args)
+ assert_warning(*args) {$VERBOSE = false; yield}
end
+ def assert_no_memory_leak(args, prepare, code, message=nil, limit: 1.5, **opt)
+ token = "\e[7;1m#{$$.to_s}:#{Time.now.strftime('%s.%L')}:#{rand(0x10000).to_s(16)}:\e[m"
+ token_dump = token.dump
+ token_re = Regexp.quote(token)
+ envs = args.shift if Array === args and Hash === args.first
+ args = [
+ "--disable=gems",
+ "-r", File.expand_path("../memory_status", __FILE__),
+ *args,
+ "-v", "-",
+ ]
+ args.unshift(envs) if envs
+ cmd = [
+ 'END {STDERR.puts '"#{token_dump}"'"FINAL=#{Memory::Status.new.size}"}',
+ prepare,
+ 'STDERR.puts('"#{token_dump}"'"START=#{$initial_size = Memory::Status.new.size}")',
+ code,
+ ].join("\n")
+ _, err, status = EnvUtil.invoke_ruby(args, cmd, true, true, **opt)
+ before = err.sub!(/^#{token_re}START=(\d+)\n/, '') && $1.to_i
+ after = err.sub!(/^#{token_re}FINAL=(\d+)\n/, '') && $1.to_i
+ assert_equal([true, ""], [status.success?, err], message)
+ assert_operator(after.fdiv(before), :<, limit, message)
+ end
def assert_is_minus_zero(f)
assert(1.0/f == -Float::INFINITY, "#{f} is not -0.0")
end
+
+ def assert_file
+ AssertFile
+ end
+
+ class << (AssertFile = Struct.new(:failure_message).new)
+ include Assertions
+ def assert_file_predicate(predicate, *args)
+ if /\Anot_/ =~ predicate
+ predicate = $'
+ neg = " not"
+ end
+ result = File.__send__(predicate, *args)
+ result = !result if neg
+ mesg = "Expected file " << args.shift.inspect
+ mesg << mu_pp(args) unless args.empty?
+ mesg << "#{neg} to be #{predicate}"
+ mesg << " #{failure_message}" if failure_message
+ assert(result, mesg)
+ end
+ alias method_missing assert_file_predicate
+
+ def for(message)
+ clone.tap {|a| a.failure_message = message}
+ end
+ end
end
end
end
diff --git a/test/ruby/lbtest.rb b/test/ruby/lbtest.rb
index df7872dc76..225e9b2f1a 100644
--- a/test/ruby/lbtest.rb
+++ b/test/ruby/lbtest.rb
@@ -36,13 +36,14 @@ lb = LocalBarrier.new(n)
(n - 1).times do |i|
Thread.start do
sleep((rand(n) + 1) / 10.0)
- puts "#{i}: done"
+ print "#{i}: done\n"
lb.sync
- puts "#{i}: cont"
+ print "#{i}: cont\n"
end
end
lb.sync
-puts "#{n-1}: cone"
+print "#{n-1}: cont\n"
+# lb.join # [ruby-dev:30653]
-puts "exit."
+print "exit.\n"
diff --git a/test/ruby/marshaltestlib.rb b/test/ruby/marshaltestlib.rb
index 39471aac64..665d365a9a 100644
--- a/test/ruby/marshaltestlib.rb
+++ b/test/ruby/marshaltestlib.rb
@@ -1,6 +1,6 @@
# coding: utf-8
module MarshalTestLib
- # include this module to a Test::Unit::TestCase and definde encode(o) and
+ # include this module to a Test::Unit::TestCase and define encode(o) and
# decode(s) methods. e.g.
#
# def encode(o)
@@ -40,6 +40,14 @@ module MarshalTestLib
end
end
+ def marshal_equal_with_ancestry(o1, msg = nil)
+ marshal_equal(o1, msg) do |o|
+ ancestry = o.singleton_class.ancestors
+ ancestry[ancestry.index(o.singleton_class)] = :singleton_class
+ ancestry
+ end
+ end
+
class MyObject; def initialize(v) @v = v end; attr_reader :v; end
def test_object
o1 = Object.new
@@ -54,24 +62,26 @@ module MarshalTestLib
def test_object_extend
o1 = Object.new
o1.extend(Mod1)
- marshal_equal(o1) { |o|
- (class << self; self; end).ancestors
- }
+ marshal_equal_with_ancestry(o1)
o1.extend(Mod2)
- marshal_equal(o1) { |o|
- (class << self; self; end).ancestors
- }
+ marshal_equal_with_ancestry(o1)
end
def test_object_subclass_extend
o1 = MyObject.new(2)
o1.extend(Mod1)
- marshal_equal(o1) { |o|
- (class << self; self; end).ancestors
- }
+ marshal_equal_with_ancestry(o1)
o1.extend(Mod2)
- marshal_equal(o1) { |o|
- (class << self; self; end).ancestors
+ marshal_equal_with_ancestry(o1)
+ end
+
+ def test_object_prepend
+ bug8041 = '[ruby-core:53202] [Bug #8041]'
+
+ o1 = MyObject.new(42)
+ o1.singleton_class.class_eval {prepend Mod1}
+ assert_nothing_raised(ArgumentError, bug8041) {
+ marshal_equal_with_ancestry(o1, bug8041)
}
end
@@ -141,25 +151,17 @@ module MarshalTestLib
def test_hash_extend
o1 = Hash.new
o1.extend(Mod1)
- marshal_equal(o1) { |o|
- (class << self; self; end).ancestors
- }
+ marshal_equal_with_ancestry(o1)
o1.extend(Mod2)
- marshal_equal(o1) { |o|
- (class << self; self; end).ancestors
- }
+ marshal_equal_with_ancestry(o1)
end
def test_hash_subclass_extend
o1 = MyHash.new(2)
o1.extend(Mod1)
- marshal_equal(o1) { |o|
- (class << self; self; end).ancestors
- }
+ marshal_equal_with_ancestry(o1)
o1.extend(Mod2)
- marshal_equal(o1) { |o|
- (class << self; self; end).ancestors
- }
+ marshal_equal_with_ancestry(o1)
end
def test_bignum
@@ -178,22 +180,6 @@ module MarshalTestLib
marshal_equal(0x3fff_ffff)
end
- def test_fixnum_ivar
- o1 = 1
- o1.instance_eval { @iv = 2 }
- marshal_equal(o1) {|o| o.instance_eval { @iv }}
- ensure
- 1.instance_eval { remove_instance_variable("@iv") }
- end
-
- def test_fixnum_ivar_self
- o1 = 1
- o1.instance_eval { @iv = 1 }
- marshal_equal(o1) {|o| o.instance_eval { @iv }}
- ensure
- 1.instance_eval { remove_instance_variable("@iv") }
- end
-
def test_float
marshal_equal(-1.0)
marshal_equal(0.0)
@@ -207,30 +193,6 @@ module MarshalTestLib
marshal_equal(NegativeZero) {|o| 1.0/o}
end
- def test_float_ivar
- o1 = 1.23
- o1.instance_eval { @iv = 1 }
- marshal_equal(o1) {|o| o.instance_eval { @iv }}
- end
-
- def test_float_ivar_self
- o1 = 5.5
- o1.instance_eval { @iv = o1 }
- marshal_equal(o1) {|o| o.instance_eval { @iv }}
- end
-
- def test_float_extend
- o1 = 0.0/0.0
- o1.extend(Mod1)
- marshal_equal(o1) { |o|
- (class << self; self; end).ancestors
- }
- o1.extend(Mod2)
- marshal_equal(o1) { |o|
- (class << self; self; end).ancestors
- }
- end
-
class MyRange < Range; def initialize(v, *args) super(*args); @v = v; end end
def test_range
marshal_equal(1..2)
@@ -277,7 +239,7 @@ module MarshalTestLib
str = MyString.new(10, "b")
str.instance_eval { @v = str }
marshal_equal(str) { |o|
- assert_equal(o.__id__, o.instance_eval { @v }.__id__)
+ assert_same(o, o.instance_eval { @v })
o.instance_eval { @v }
}
end
@@ -287,36 +249,17 @@ module MarshalTestLib
o.extend(Mod1)
str = MyString.new(o, "c")
marshal_equal(str) { |v|
- assert(v.instance_eval { @v }.kind_of?(Mod1))
+ assert_kind_of(Mod1, v.instance_eval { @v })
}
end
MyStruct = Struct.new("MyStruct", :a, :b)
- if RUBY_VERSION < "1.8.0"
- # Struct#== is not defined in ruby/1.6
- class MyStruct
- def ==(rhs)
- return true if __id__ == rhs.__id__
- return false unless rhs.is_a?(::Struct)
- return false if self.class != rhs.class
- members.each do |member|
- return false if self.__send__(member) != rhs.__send__(member)
- end
- return true
- end
- end
- end
class MySubStruct < MyStruct; def initialize(v, *args) super(*args); @v = v; end end
def test_struct
marshal_equal(MyStruct.new(1,2))
end
def test_struct_subclass
- if RUBY_VERSION < "1.8.0"
- # Substruct instance cannot be dumped in ruby/1.6
- # ::Marshal.dump(MySubStruct.new(10, 1, 2)) #=> uninitialized struct
- return false
- end
marshal_equal(MySubStruct.new(10,1,2))
end
@@ -329,13 +272,9 @@ module MarshalTestLib
def test_struct_subclass_extend
o1 = MyStruct.new
o1.extend(Mod1)
- marshal_equal(o1) { |o|
- (class << self; self; end).ancestors
- }
+ marshal_equal_with_ancestry(o1)
o1.extend(Mod2)
- marshal_equal(o1) { |o|
- (class << self; self; end).ancestors
- }
+ marshal_equal_with_ancestry(o1)
end
def test_symbol
@@ -426,6 +365,11 @@ module MarshalTestLib
o = Object.new
def o.m() end
assert_raise(TypeError) { marshaltest(o) }
+
+ bug8043 = '[ruby-core:53206] [Bug #8043]'
+ class << o; prepend Mod1; end
+ assert_raise(TypeError, bug8043) {marshaltest(o)}
+
o = Object.new
c = class << o
@v = 1
@@ -444,7 +388,7 @@ module MarshalTestLib
o = Object.new
o.extend Mod1
o.extend Mod2
- marshal_equal(o) {|obj| class << obj; ancestors end}
+ marshal_equal_with_ancestry(o)
o = Object.new
o.extend Module.new
assert_raise(TypeError) { marshaltest(o) }
@@ -457,7 +401,7 @@ module MarshalTestLib
o = ""
o.extend Mod1
o.extend Mod2
- marshal_equal(o) {|obj| class << obj; ancestors end}
+ marshal_equal_with_ancestry(o)
o = ""
o.extend Module.new
assert_raise(TypeError) { marshaltest(o) }
@@ -485,20 +429,6 @@ module MarshalTestLib
end
MyStruct2 = Struct.new(:a, :b)
- if RUBY_VERSION < "1.8.0"
- # Struct#== is not defined in ruby/1.6
- class MyStruct2
- def ==(rhs)
- return true if __id__ == rhs.__id__
- return false unless rhs.is_a?(::Struct)
- return false if self.class != rhs.class
- members.each do |member|
- return false if self.__send__(member) != rhs.__send__(member)
- end
- return true
- end
- end
- end
def test_struct_toplevel
o = MyStruct2.new(1,2)
marshal_equal(o)
diff --git a/test/ruby/memory_status.rb b/test/ruby/memory_status.rb
index f504c0a736..cb2e9e094c 100644
--- a/test/ruby/memory_status.rb
+++ b/test/ruby/memory_status.rb
@@ -1,13 +1,15 @@
+require_relative "envutil"
+
module Memory
keys = []
vals = []
case
- when File.exist?(procfile = "/proc/self/status")
+ when File.exist?(procfile = "/proc/self/status") && (pat = /^Vm(\w+):\s+(\d+)/) =~ File.binread(procfile)
PROC_FILE = procfile
- VM_PAT = /^Vm(\w+):\s+(\d+)/
+ VM_PAT = pat
def self.read_status
- IO.foreach(PROC_FILE) do |l|
+ IO.foreach(PROC_FILE, encoding: Encoding::ASCII_8BIT) do |l|
yield($1.downcase.intern, $2.to_i * 1024) if VM_PAT =~ l
end
end
@@ -15,18 +17,34 @@ module Memory
read_status {|k, v| keys << k; vals << v}
when /mswin|mingw/ =~ RUBY_PLATFORM
- require 'dl/import'
- require 'dl/types'
+ begin
+ require 'fiddle/import'
+ rescue LoadError
+ EnvUtil.suppress_warning do
+ require 'dl/import'
+ end
+ end
+ begin
+ require 'fiddle/types'
+ rescue LoadError
+ EnvUtil.suppress_warning do
+ require 'dl/types'
+ end
+ end
module Win32
- extend DL::Importer
+ begin
+ extend Fiddle::Importer
+ rescue NameError
+ extend DL::Importer
+ end
dlload "kernel32.dll", "psapi.dll"
- include DL::Win32Types
- if [nil].pack('p').bytesize == 8
- typealias "SIZE_T", "DWORD64"
- else
- typealias "SIZE_T", "DWORD32"
+ begin
+ include Fiddle::Win32Types
+ rescue NameError
+ include DL::Win32Types
end
+ typealias "SIZE_T", "size_t"
PROCESS_MEMORY_COUNTERS = struct [
"DWORD cb",
diff --git a/test/ruby/test_alias.rb b/test/ruby/test_alias.rb
index 6320121bce..0fd8d5f89b 100644
--- a/test/ruby/test_alias.rb
+++ b/test/ruby/test_alias.rb
@@ -52,16 +52,6 @@ class TestAlias < Test::Unit::TestCase
end
end
- def test_JVN_83768862
- d = lambda {
- $SAFE = 4
- dclass = Class.new(C)
- dclass.send(:alias_method, :mm, :m)
- dclass.new
- }.call
- assert_raise(SecurityError) { d.mm }
- end
-
def test_nonexistmethod
assert_raise(NameError){
Class.new{
@@ -104,4 +94,29 @@ class TestAlias < Test::Unit::TestCase
end
assert_equal(:ok, d.new.bar)
end
+
+ module SuperInAliasedModuleMethod
+ module M
+ def foo
+ super << :M
+ end
+
+ alias bar foo
+ end
+
+ class Base
+ def foo
+ [:Base]
+ end
+ end
+
+ class Derived < Base
+ include M
+ end
+ end
+
+ # [ruby-dev:46028]
+ def test_super_in_aliased_module_method # fails in 1.8
+ assert_equal([:Base, :M], SuperInAliasedModuleMethod::Derived.new.bar)
+ end
end
diff --git a/test/ruby/test_argf.rb b/test/ruby/test_argf.rb
index 1f824152e0..fb869561a1 100644
--- a/test/ruby/test_argf.rb
+++ b/test/ruby/test_argf.rb
@@ -2,50 +2,52 @@ require 'test/unit'
require 'timeout'
require 'tmpdir'
require 'tempfile'
+require 'fileutils'
require_relative 'envutil'
class TestArgf < Test::Unit::TestCase
def setup
- @t1 = Tempfile.new("argf-foo")
+ @tmpdir = Dir.mktmpdir
+ @tmp_count = 0
+ @t1 = make_tempfile0("argf-foo")
@t1.binmode
@t1.puts "1"
@t1.puts "2"
@t1.close
- @t2 = Tempfile.new("argf-bar")
+ @t2 = make_tempfile0("argf-bar")
@t2.binmode
@t2.puts "3"
@t2.puts "4"
@t2.close
- @t3 = Tempfile.new("argf-baz")
+ @t3 = make_tempfile0("argf-baz")
@t3.binmode
@t3.puts "5"
@t3.puts "6"
@t3.close
- @tmps = [@t1, @t2, @t3]
end
def teardown
- @tmps.each {|t|
- bak = t.path + ".bak"
- File.unlink bak if File.file? bak
- t.close(true)
- }
+ FileUtils.rmtree(@tmpdir)
+ end
+
+ def make_tempfile0(basename)
+ @tmp_count += 1
+ open("#{@tmpdir}/#{basename}-#{@tmp_count}", "w")
end
def make_tempfile
- t = Tempfile.new("argf-qux")
+ t = make_tempfile0("argf-qux")
t.puts "foo"
t.puts "bar"
t.puts "baz"
t.close
- @tmps << t
t
end
- def ruby(*args)
+ def ruby(*args, external_encoding: Encoding::UTF_8)
args = ['-e', '$>.write($<.read)'] if args.empty?
ruby = EnvUtil.rubybin
- f = IO.popen([ruby] + args, 'r+')
+ f = IO.popen([ruby] + args, 'r+', external_encoding: external_encoding)
yield(f)
ensure
f.close unless !f || f.closed?
@@ -245,8 +247,6 @@ class TestArgf < Test::Unit::TestCase
end
def test_inplace_stdin
- t = make_tempfile
-
assert_in_out_err(["-", "-"], <<-INPUT, [], /Can't do inplace edit for stdio; skipping/)
ARGF.inplace_mode = '.bak'
f = ARGF.dup
@@ -257,8 +257,6 @@ class TestArgf < Test::Unit::TestCase
end
def test_inplace_stdin2
- t = make_tempfile
-
assert_in_out_err(["-"], <<-INPUT, [], /Can't do inplace edit for stdio/)
ARGF.inplace_mode = '.bak'
while line = ARGF.gets
@@ -417,11 +415,11 @@ class TestArgf < Test::Unit::TestCase
end
end
- t1 = Tempfile.new("argf-foo")
+ t1 = open("#{@tmpdir}/argf-hoge", "w")
t1.binmode
t1.puts "foo"
t1.close
- t2 = Tempfile.new("argf-bar")
+ t2 = open("#{@tmpdir}/argf-moge", "w")
t2.binmode
t2.puts "bar"
t2.close
@@ -446,6 +444,16 @@ class TestArgf < Test::Unit::TestCase
end
end
+ def test_read2_with_not_empty_buffer
+ ruby('-e', <<-SRC, @t1.path, @t2.path, @t3.path) do |f|
+ s = "0123456789"
+ ARGF.read(8, s)
+ p s
+ SRC
+ assert_equal("\"1\\n2\\n3\\n4\\n\"\n", f.read)
+ end
+ end
+
def test_read3
ruby('-e', <<-SRC, @t1.path, @t2.path, @t3.path) do |f|
nil while ARGF.gets
@@ -463,6 +471,8 @@ class TestArgf < Test::Unit::TestCase
loop do
s << ARGF.readpartial(1)
t = ""; ARGF.readpartial(1, t); s << t
+ # not empty buffer
+ u = "abcdef"; ARGF.readpartial(1, u); s << u
end
rescue EOFError
puts s
@@ -669,6 +679,49 @@ class TestArgf < Test::Unit::TestCase
end
end
+ def test_skip_in_each_line
+ ruby('-e', <<-SRC, @t1.path, @t2.path, @t3.path) do |f|
+ ARGF.each_line {|l| print l; ARGF.skip}
+ SRC
+ assert_equal("1\n3\n5\n", f.read, '[ruby-list:49185]')
+ end
+ ruby('-e', <<-SRC, @t1.path, @t2.path, @t3.path) do |f|
+ ARGF.each_line {|l| ARGF.skip; puts [l, ARGF.gets].map {|s| s ? s.chomp : s.inspect}.join("+")}
+ SRC
+ assert_equal("1+3\n4+5\n6+nil\n", f.read, '[ruby-list:49185]')
+ end
+ end
+
+ def test_skip_in_each_byte
+ ruby('-e', <<-SRC, @t1.path, @t2.path, @t3.path) do |f|
+ ARGF.each_byte {|l| print l; ARGF.skip}
+ SRC
+ assert_equal("135".unpack("C*").join(""), f.read, '[ruby-list:49185]')
+ end
+ end
+
+ def test_skip_in_each_char
+ [[@t1, "\u{3042}"], [@t2, "\u{3044}"], [@t3, "\u{3046}"]].each do |f, s|
+ File.write(f.path, s, mode: "w:utf-8")
+ end
+ ruby('-Eutf-8', '-e', <<-SRC, @t1.path, @t2.path, @t3.path) do |f|
+ ARGF.each_char {|l| print l; ARGF.skip}
+ SRC
+ assert_equal("\u{3042 3044 3046}", f.read, '[ruby-list:49185]')
+ end
+ end
+
+ def test_skip_in_each_codepoint
+ [[@t1, "\u{3042}"], [@t2, "\u{3044}"], [@t3, "\u{3046}"]].each do |f, s|
+ File.write(f.path, s, mode: "w:utf-8")
+ end
+ ruby('-Eutf-8', '-Eutf-8', '-e', <<-SRC, @t1.path, @t2.path, @t3.path) do |f|
+ ARGF.each_codepoint {|l| printf "%x:", l; ARGF.skip}
+ SRC
+ assert_equal("3042:3044:3046:", f.read, '[ruby-list:49185]')
+ end
+ end
+
def test_close
ruby('-e', <<-SRC, @t1.path, @t2.path, @t3.path) do |f|
ARGF.close
@@ -746,8 +799,7 @@ class TestArgf < Test::Unit::TestCase
end
argf = ARGF.class.new(*paths)
paths.each do |path|
- e = assert_raise(Errno::ENOENT) {argf.gets}
- assert_match(/- #{Regexp.quote(path)}\z/, e.message)
+ assert_raise_with_message(Errno::ENOENT, /- #{Regexp.quote(path)}\z/) {argf.gets}
end
assert_nil(argf.gets, bug4274)
end
@@ -757,26 +809,44 @@ class TestArgf < Test::Unit::TestCase
assert_ruby_status(["-e", "2.times {STDIN.tty?; readlines}"], "", bug5952)
end
+ def test_lines
+ ruby('-W1', '-e', <<-SRC, @t1.path, @t2.path, @t3.path) do |f|
+ $stderr = $stdout
+ s = []
+ ARGF.lines {|l| s << l }
+ p s
+ SRC
+ assert_match(/deprecated/, f.gets)
+ assert_equal("[\"1\\n\", \"2\\n\", \"3\\n\", \"4\\n\", \"5\\n\", \"6\\n\"]\n", f.read)
+ end
+ end
+
def test_bytes
- ruby('-e', <<-SRC, @t1.path, @t2.path, @t3.path) do |f|
+ ruby('-W1', '-e', <<-SRC, @t1.path, @t2.path, @t3.path) do |f|
+ $stderr = $stdout
print Marshal.dump(ARGF.bytes.to_a)
SRC
+ assert_match(/deprecated/, f.gets)
assert_equal([49, 10, 50, 10, 51, 10, 52, 10, 53, 10, 54, 10], Marshal.load(f.read))
end
end
def test_chars
- ruby('-e', <<-SRC, @t1.path, @t2.path, @t3.path) do |f|
+ ruby('-W1', '-e', <<-SRC, @t1.path, @t2.path, @t3.path) do |f|
+ $stderr = $stdout
print [Marshal.dump(ARGF.chars.to_a)].pack('m')
SRC
+ assert_match(/deprecated/, f.gets)
assert_equal(["1", "\n", "2", "\n", "3", "\n", "4", "\n", "5", "\n", "6", "\n"], Marshal.load(f.read.unpack('m').first))
end
end
def test_codepoints
- ruby('-e', <<-SRC, @t1.path, @t2.path, @t3.path) do |f|
+ ruby('-W1', '-e', <<-SRC, @t1.path, @t2.path, @t3.path) do |f|
+ $stderr = $stdout
print Marshal.dump(ARGF.codepoints.to_a)
SRC
+ assert_match(/deprecated/, f.gets)
assert_equal([49, 10, 50, 10, 51, 10, 52, 10, 53, 10, 54, 10], Marshal.load(f.read))
end
end
diff --git a/test/ruby/test_arity.rb b/test/ruby/test_arity.rb
new file mode 100644
index 0000000000..18ef9b2d03
--- /dev/null
+++ b/test/ruby/test_arity.rb
@@ -0,0 +1,71 @@
+require 'test/unit'
+
+class TestArity < Test::Unit::TestCase
+ def err_mess(method_proc = nil, argc = 0)
+ args = (1..argc).to_a
+ err = assert_raise(ArgumentError) do
+ case method_proc
+ when nil
+ yield
+ when Symbol
+ method(method_proc).call(*args)
+ else
+ method_proc.call(*args)
+ end
+ end
+ s = err.to_s
+ assert s =~ /wrong number of arguments \((.*)\)/, "Unexpected ArgumentError's message: #{s}"
+ $1
+ end
+
+ def a
+ end
+
+ def b(a, b, c, d=1, e=2, f, g, h, i, &block)
+ end
+
+ def c(a, b, c, d=1, e=2, *rest)
+ end
+
+ def d(a, b: 42)
+ end
+
+ def e(a, b:42, **c)
+ end
+
+ def f(a, b, c=1, *rest, d: 3)
+ end
+
+ def test_method_err_mess
+ assert_equal "1 for 0", err_mess(:a, 1)
+ assert_equal "10 for 7..9", err_mess(:b, 10)
+ assert_equal "2 for 3+", err_mess(:c, 2)
+ assert_equal "2 for 1", err_mess(:d, 2)
+ assert_equal "0 for 1", err_mess(:d, 0)
+ assert_equal "2 for 1", err_mess(:e, 2)
+ assert_equal "0 for 1", err_mess(:e, 0)
+ assert_equal "1 for 2+", err_mess(:f, 1)
+ end
+
+ def test_proc_err_mess
+ assert_equal "0 for 1..2", err_mess(->(b, c=42){}, 0)
+ assert_equal "1 for 2+", err_mess(->(a, b, c=42, *d){}, 1)
+ assert_equal "3 for 4+", err_mess(->(a, b, *c, d, e){}, 3)
+ assert_equal "3 for 1..2", err_mess(->(b, c=42){}, 3)
+ assert_equal "1 for 0", err_mess(->(&block){}, 1)
+ # Double checking:
+ p = Proc.new{|b, c=42| :ok}
+ assert_equal :ok, p.call(1, 2, 3)
+ assert_equal :ok, p.call
+ end
+
+ def test_message_change_issue_6085
+ assert_equal "3 for 1..2", err_mess{ SignalException.new(1, "", nil) }
+ assert_equal "1 for 0", err_mess{ Hash.new(1){} }
+ assert_equal "3 for 1..2", err_mess{ Module.send :define_method, 1, 2, 3 }
+ assert_equal "1 for 2", err_mess{ "".sub!(//) }
+ assert_equal "0 for 1..2", err_mess{ "".sub!{} }
+ assert_equal "0 for 1+", err_mess{ exec }
+ assert_equal "0 for 1+", err_mess{ Struct.new }
+ end
+end
diff --git a/test/ruby/test_array.rb b/test/ruby/test_array.rb
index 28d3e4156b..d7e1c365dd 100644
--- a/test/ruby/test_array.rb
+++ b/test/ruby/test_array.rb
@@ -1,3 +1,4 @@
+# coding: US-ASCII
require 'test/unit'
require_relative 'envutil'
@@ -12,6 +13,17 @@ class TestArray < Test::Unit::TestCase
$VERBOSE = @verbose
end
+ def test_percent_i
+ assert_equal([:foo, :bar], %i[foo bar])
+ assert_equal([:"\"foo"], %i["foo])
+ end
+
+ def test_percent_I
+ x = 10
+ assert_equal([:foo, :b10], %I[foo b#{x}])
+ assert_equal([:"\"foo10"], %I["foo#{x}])
+ end
+
def test_0_literal
assert_equal([1, 2, 3, 4], [1, 2] + [3, 4])
assert_equal([1, 2, 1, 2], [1, 2] * 2)
@@ -270,17 +282,17 @@ class TestArray < Test::Unit::TestCase
end
def test_EQUAL # '=='
- assert(@cls[] == @cls[])
- assert(@cls[1] == @cls[1])
- assert(@cls[1, 1, 2, 2] == @cls[1, 1, 2, 2])
- assert(@cls[1.0, 1.0, 2.0, 2.0] == @cls[1, 1, 2, 2])
+ assert_operator(@cls[], :==, @cls[])
+ assert_operator(@cls[1], :==, @cls[1])
+ assert_operator(@cls[1, 1, 2, 2], :==, @cls[1, 1, 2, 2])
+ assert_operator(@cls[1.0, 1.0, 2.0, 2.0], :==, @cls[1, 1, 2, 2])
end
def test_VERY_EQUAL # '==='
- assert(@cls[] === @cls[])
- assert(@cls[1] === @cls[1])
- assert(@cls[1, 1, 2, 2] === @cls[1, 1, 2, 2])
- assert(@cls[1.0, 1.0, 2.0, 2.0] === @cls[1, 1, 2, 2])
+ assert_operator(@cls[], :===, @cls[])
+ assert_operator(@cls[1], :===, @cls[1])
+ assert_operator(@cls[1, 1, 2, 2], :===, @cls[1, 1, 2, 2])
+ assert_operator(@cls[1.0, 1.0, 2.0, 2.0], :===, @cls[1, 1, 2, 2])
end
def test_AREF # '[]'
@@ -414,6 +426,18 @@ class TestArray < Test::Unit::TestCase
a = @cls[1, 2, 3]
a[-1, 0] = a
assert_equal([1, 2, 1, 2, 3, 3], a)
+
+ a = @cls[]
+ a[5,0] = [5]
+ assert_equal([nil, nil, nil, nil, nil, 5], a)
+
+ a = @cls[1]
+ a[1,0] = [2]
+ assert_equal([1, 2], a)
+
+ a = @cls[1]
+ a[1,1] = [2]
+ assert_equal([1, 2], a)
end
def test_assoc
@@ -452,20 +476,16 @@ class TestArray < Test::Unit::TestCase
def test_clone
for taint in [ false, true ]
- for untrust in [ false, true ]
- for frozen in [ false, true ]
- a = @cls[*(0..99).to_a]
- a.taint if taint
- a.untrust if untrust
- a.freeze if frozen
- b = a.clone
-
- assert_equal(a, b)
- assert(a.__id__ != b.__id__)
- assert_equal(a.frozen?, b.frozen?)
- assert_equal(a.untrusted?, b.untrusted?)
- assert_equal(a.tainted?, b.tainted?)
- end
+ for frozen in [ false, true ]
+ a = @cls[*(0..99).to_a]
+ a.taint if taint
+ a.freeze if frozen
+ b = a.clone
+
+ assert_equal(a, b)
+ assert_not_equal(a.__id__, b.__id__)
+ assert_equal(a.frozen?, b.frozen?)
+ assert_equal(a.tainted?, b.tainted?)
end
end
end
@@ -552,6 +572,29 @@ class TestArray < Test::Unit::TestCase
assert_equal(3, a.count {|x| x % 2 == 1 })
assert_equal(2, a.count(1) {|x| x % 2 == 1 })
assert_raise(ArgumentError) { a.count(0, 1) }
+
+ bug8654 = '[ruby-core:56072]'
+ assert_in_out_err [], <<-EOS, ["0"], [], bug8654
+ a1 = []
+ a2 = Array.new(100) { |i| i }
+ a2.count do |i|
+ p i
+ a2.replace(a1) if i == 0
+ end
+ EOS
+
+ assert_in_out_err [], <<-EOS, ["[]", "0"], [], bug8654
+ ARY = Array.new(100) { |i| i }
+ class Fixnum
+ alias old_equal ==
+ def == other
+ ARY.replace([]) if self.equal?(0)
+ p ARY
+ self.equal?(other)
+ end
+ end
+ p ARY.count(42)
+ EOS
end
def test_delete
@@ -574,6 +617,14 @@ class TestArray < Test::Unit::TestCase
a = @cls[*('cab'..'cat').to_a]
assert_equal(99, a.delete('cup') { 99 } )
assert_equal(@cls[*('cab'..'cat').to_a], a)
+
+ o = Object.new
+ def o.==(other); true; end
+ o2 = Object.new
+ def o2.==(other); true; end
+ a = @cls[1, o, o2, 2]
+ assert_equal(o2, a.delete(42))
+ assert_equal([1, 2], a)
end
def test_delete_at
@@ -623,7 +674,7 @@ class TestArray < Test::Unit::TestCase
b = a.dup
assert_equal(a, b)
- assert(a.__id__ != b.__id__)
+ assert_not_equal(a.__id__, b.__id__)
assert_equal(false, b.frozen?)
assert_equal(a.tainted?, b.tainted?)
end
@@ -671,15 +722,15 @@ class TestArray < Test::Unit::TestCase
end
def test_empty?
- assert(@cls[].empty?)
- assert(!@cls[1].empty?)
+ assert_empty(@cls[])
+ assert_not_empty(@cls[1])
end
def test_eql?
- assert(@cls[].eql?(@cls[]))
- assert(@cls[1].eql?(@cls[1]))
- assert(@cls[1, 1, 2, 2].eql?(@cls[1, 1, 2, 2]))
- assert(!@cls[1.0, 1.0, 2.0, 2.0].eql?(@cls[1, 1, 2, 2]))
+ assert_send([@cls[], :eql?, @cls[]])
+ assert_send([@cls[1], :eql?, @cls[1]])
+ assert_send([@cls[1, 1, 2, 2], :eql?, @cls[1, 1, 2, 2]])
+ assert_not_send([@cls[1.0, 1.0, 2.0, 2.0], :eql?, @cls[1, 1, 2, 2]])
end
def test_fill
@@ -724,10 +775,8 @@ class TestArray < Test::Unit::TestCase
a6 = @cls[[1, 2], 3]
a6.taint
- a6.untrust
a7 = a6.flatten
assert_equal(true, a7.tainted?)
- assert_equal(true, a7.untrusted?)
a8 = @cls[[1, 2], 3]
a9 = a8.flatten(0)
@@ -858,18 +907,18 @@ class TestArray < Test::Unit::TestCase
a1 = @cls[ 'cat', 'dog' ]
a2 = @cls[ 'cat', 'dog' ]
a3 = @cls[ 'dog', 'cat' ]
- assert(a1.hash == a2.hash)
- assert(a1.hash != a3.hash)
+ assert_equal(a1.hash, a2.hash)
+ assert_not_equal(a1.hash, a3.hash)
end
def test_include?
a = @cls[ 'cat', 99, /a/, @cls[ 1, 2, 3] ]
- assert(a.include?('cat'))
- assert(a.include?(99))
- assert(a.include?(/a/))
- assert(a.include?([1,2,3]))
- assert(!a.include?('ca'))
- assert(!a.include?([1,2]))
+ assert_include(a, 'cat')
+ assert_include(a, 99)
+ assert_include(a, /a/)
+ assert_include(a, [1,2,3])
+ assert_not_include(a, 'ca')
+ assert_not_include(a, [1,2])
end
def test_index
@@ -900,25 +949,36 @@ class TestArray < Test::Unit::TestCase
$, = ""
a = @cls[1, 2]
assert_equal("12", a.join)
+ assert_equal("12", a.join(nil))
assert_equal("1,2", a.join(','))
$, = ""
a = @cls[1, 2, 3]
assert_equal("123", a.join)
+ assert_equal("123", a.join(nil))
assert_equal("1,2,3", a.join(','))
$, = ":"
a = @cls[1, 2, 3]
assert_equal("1:2:3", a.join)
+ assert_equal("1:2:3", a.join(nil))
assert_equal("1,2,3", a.join(','))
$, = ""
a = @cls[1, 2, 3]
a.taint
- a.untrust
s = a.join
assert_equal(true, s.tainted?)
- assert_equal(true, s.untrusted?)
+
+ bug5902 = '[ruby-core:42161]'
+ sep = ":".taint
+
+ s = @cls[].join(sep)
+ assert_equal(false, s.tainted?, bug5902)
+ s = @cls[1].join(sep)
+ assert_equal(false, s.tainted?, bug5902)
+ s = @cls[1, 2].join(sep)
+ assert_equal(true, s.tainted?, bug5902)
e = ''.force_encoding('EUC-JP')
u = ''.force_encoding('UTF-8')
@@ -1330,6 +1390,22 @@ class TestArray < Test::Unit::TestCase
end
end
+ def test_sort_bang_with_freeze
+ ary = []
+ o1 = Object.new
+ o1.singleton_class.class_eval {
+ define_method(:<=>) {|v|
+ ary.freeze
+ 1
+ }
+ }
+ o2 = o1.dup
+ ary << o1 << o2
+ orig = ary.dup
+ assert_raise(RuntimeError, "frozen during comparison") {ary.sort!}
+ assert_equal(orig, ary, "must not be modified once frozen")
+ end
+
def test_to_a
a = @cls[ 1, 2, 3 ]
a_id = a.__id__
@@ -1380,6 +1456,21 @@ class TestArray < Test::Unit::TestCase
$, = nil
end
+ def test_to_h
+ kvp = Object.new
+ def kvp.to_ary
+ [:obtained, :via_to_ary]
+ end
+ array = [
+ [:key, :value],
+ [:ignore_me],
+ [:ignore, :me, :too],
+ :ignore_me,
+ kvp,
+ ]
+ assert_equal({key: :value, obtained: :via_to_ary}, array.to_h)
+ end
+
def test_uniq
a = []
b = a.uniq
@@ -1505,6 +1596,15 @@ class TestArray < Test::Unit::TestCase
assert_equal(nil, b)
end
+ def test_uniq_bang_with_freeze
+ ary = [1,2]
+ orig = ary.dup
+ assert_raise(RuntimeError, "frozen during comparison") {
+ ary.uniq! {|v| ary.freeze; 1}
+ }
+ assert_equal(orig, ary, "must not be modified once frozen")
+ end
+
def test_unshift
a = @cls[]
assert_equal(@cls['cat'], a.unshift('cat'))
@@ -1624,8 +1724,8 @@ class TestArray < Test::Unit::TestCase
[2,2,2,2],[2,2,2,3],[2,2,3,3],[2,3,3,3],[3,3,3,3]],
a.repeated_combination(4).to_a.sort)
assert_equal(@cls[], a.repeated_combination(-1).to_a)
- assert_equal("abcde".each_char.to_a.repeated_combination(5).map{|a|a.sort}.sort,
- "edcba".each_char.to_a.repeated_combination(5).map{|a|a.sort}.sort)
+ assert_equal("abcde".each_char.to_a.repeated_combination(5).map{|e|e.sort}.sort,
+ "edcba".each_char.to_a.repeated_combination(5).map{|e|e.sort}.sort)
assert_equal(@cls[].repeated_combination(0).to_a, @cls[[]])
assert_equal(@cls[].repeated_combination(1).to_a, @cls[])
@@ -1659,19 +1759,6 @@ class TestArray < Test::Unit::TestCase
assert_equal([3,4,5,0], [1,2,3,4,5,0].drop_while {|i| i < 3 })
end
- def test_modify_check
- a = []
- a.freeze
- assert_raise(RuntimeError) { a.shift }
- a = [1, 2]
- assert_raise(SecurityError) do
- Thread.new do
- $SAFE = 4
- a.shift
- end.value
- end
- end
-
LONGP = [127, 63, 31, 15, 7].map {|x| 2**x-1 }.find do |x|
begin
[].first(x)
@@ -1722,6 +1809,11 @@ class TestArray < Test::Unit::TestCase
assert_raise(ArgumentError) { [0].first(-1) }
end
+ def test_last2
+ assert_equal([0], [0].last(2))
+ assert_raise(ArgumentError) { [0].last(-1) }
+ end
+
def test_shift2
assert_equal(0, ([0] * 16).shift)
# check
@@ -1818,7 +1910,9 @@ class TestArray < Test::Unit::TestCase
def test_values_at2
a = [0, 1, 2, 3, 4, 5]
assert_equal([1, 2, 3], a.values_at(1..3))
- assert_equal([], a.values_at(7..8))
+ assert_equal([nil, nil], a.values_at(7..8))
+ bug6203 = '[ruby-core:43678]'
+ assert_equal([4, 5, nil, nil], a.values_at(4..7), bug6203)
assert_equal([nil], a.values_at(2**31-1))
end
@@ -1861,13 +1955,22 @@ class TestArray < Test::Unit::TestCase
ary = Object.new
def ary.to_a; [1, 2]; end
- assert_raise(NoMethodError){ %w(a b).zip(ary) }
+ assert_raise(TypeError) {%w(a b).zip(ary)}
def ary.each; [3, 4].each{|e|yield e}; end
assert_equal([['a', 3], ['b', 4]], %w(a b).zip(ary))
def ary.to_ary; [5, 6]; end
assert_equal([['a', 5], ['b', 6]], %w(a b).zip(ary))
end
+ def test_zip_bug
+ bug8153 = "ruby-core:53650"
+ r = 1..1
+ def r.respond_to?(*)
+ super
+ end
+ assert_equal [[42, 1]], [42].zip(r), bug8153
+ end
+
def test_transpose
assert_equal([[1, :a], [2, :b], [3, :c]],
[[1, 2, 3], [:a, :b, :c]].transpose)
@@ -1894,6 +1997,20 @@ class TestArray < Test::Unit::TestCase
assert_not_equal([0, 1, 2], [0, 1, 3])
end
+ A = Array.new(3, &:to_s)
+ B = A.dup
+
+ def test_equal_resize
+ o = Object.new
+ def o.==(o)
+ A.clear
+ B.clear
+ true
+ end
+ A[1] = o
+ assert_equal(A, B)
+ end
+
def test_hash2
a = []
a << a
@@ -1947,14 +2064,27 @@ class TestArray < Test::Unit::TestCase
alias rand call
end
assert_raise(RuntimeError) {ary.shuffle!(random: gen)}
+
+ zero = Object.new
+ def zero.to_int
+ 0
+ end
+ gen_to_int = proc do |max|
+ zero
+ end
+ class << gen_to_int
+ alias rand call
+ end
+ ary = (0...10000).to_a
+ assert_equal(ary.rotate, ary.shuffle(random: gen_to_int))
end
def test_sample
100.times do
- assert([0, 1, 2].include?([2, 1, 0].sample))
+ assert_include([0, 1, 2], [2, 1, 0].sample)
samples = [2, 1, 0].sample(2)
samples.each{|sample|
- assert([0, 1, 2].include?(sample))
+ assert_include([0, 1, 2], sample)
}
end
@@ -1990,15 +2120,15 @@ class TestArray < Test::Unit::TestCase
def test_sample_random
ary = (0...10000).to_a
assert_raise(ArgumentError) {ary.sample(1, 2, random: nil)}
- gen0 = proc do
- 0.5
+ gen0 = proc do |max|
+ max/2
end
class << gen0
alias rand call
end
- gen1 = proc do
+ gen1 = proc do |max|
ary.replace([])
- 0.5
+ max/2
end
class << gen1
alias rand call
@@ -2030,6 +2160,19 @@ class TestArray < Test::Unit::TestCase
assert_equal([5000, 0, 5001, 2, 5002, 4, 5003, 6, 5004, 8, 5005], ary.sample(11, random: gen0))
ary.sample(11, random: gen1) # implementation detail, may change in the future
assert_equal([], ary)
+
+ half = Object.new
+ def half.to_int
+ 5000
+ end
+ gen_to_int = proc do |max|
+ half
+ end
+ class << gen_to_int
+ alias rand call
+ end
+ ary = (0...10000).to_a
+ assert_equal(5000, ary.sample(random: gen_to_int))
end
def test_cycle
@@ -2060,9 +2203,7 @@ class TestArray < Test::Unit::TestCase
end
def test_combination2
- assert_nothing_raised do
- (0..100).to_a.combination(50) { break }
- end
+ assert_equal(:called, (0..100).to_a.combination(50) { break :called }, "[ruby-core:29240] ... must be yielded even if 100C50 > signed integer")
end
def test_product2
@@ -2087,10 +2228,8 @@ class TestArray < Test::Unit::TestCase
def test_inspect
a = @cls[1, 2, 3]
a.taint
- a.untrust
s = a.inspect
assert_equal(true, s.tainted?)
- assert_equal(true, s.untrusted?)
end
def test_initialize2
@@ -2181,9 +2320,43 @@ class TestArray < Test::Unit::TestCase
assert_equal([], a.rotate!(13))
assert_equal([], a.rotate!(-13))
a = [].freeze
- e = assert_raise(RuntimeError) {a.rotate!}
- assert_match(/can't modify frozen/, e.message)
+ assert_raise_with_message(RuntimeError, /can't modify frozen/) {a.rotate!}
a = [1,2,3]
assert_raise(ArgumentError) { a.rotate!(1, 1) }
end
+
+ def test_bsearch_typechecks_return_values
+ assert_raise(TypeError) do
+ [1, 2, 42, 100, 666].bsearch{ "not ok" }
+ end
+ assert_equal [1, 2, 42, 100, 666].bsearch{}, [1, 2, 42, 100, 666].bsearch{false}
+ end
+
+ def test_bsearch_with_no_block
+ enum = [1, 2, 42, 100, 666].bsearch
+ assert_nil enum.size
+ assert_equal 42, enum.each{|x| x >= 33 }
+ end
+
+ def test_bsearch_in_find_minimum_mode
+ a = [0, 4, 7, 10, 12]
+ assert_equal(4, a.bsearch {|x| x >= 4 })
+ assert_equal(7, a.bsearch {|x| x >= 6 })
+ assert_equal(0, a.bsearch {|x| x >= -1 })
+ assert_equal(nil, a.bsearch {|x| x >= 100 })
+ end
+
+ def test_bsearch_in_find_any_mode
+ a = [0, 4, 7, 10, 12]
+ assert_include([4, 7], a.bsearch {|x| 1 - x / 4 })
+ assert_equal(nil, a.bsearch {|x| 4 - x / 2 })
+ assert_equal(nil, a.bsearch {|x| 1 })
+ assert_equal(nil, a.bsearch {|x| -1 })
+
+ assert_include([4, 7], a.bsearch {|x| (1 - x / 4) * (2**100) })
+ assert_equal(nil, a.bsearch {|x| 1 * (2**100) })
+ assert_equal(nil, a.bsearch {|x| (-1) * (2**100) })
+
+ assert_include([4, 7], a.bsearch {|x| (2**100).coerce((1 - x / 4) * (2**100)).first })
+ end
end
diff --git a/test/ruby/test_autoload.rb b/test/ruby/test_autoload.rb
index e175e57006..1931df45c5 100644
--- a/test/ruby/test_autoload.rb
+++ b/test/ruby/test_autoload.rb
@@ -1,4 +1,6 @@
require 'test/unit'
+require 'tempfile'
+require 'thread'
require_relative 'envutil'
class TestAutoload < Test::Unit::TestCase
@@ -53,4 +55,122 @@ p Foo::Bar
assert_equal(tmpfile, b.autoload?(:X), bug4565)
}
end
+
+ def test_require_explicit
+ Tempfile.create(['autoload', '.rb']) {|file|
+ file.puts 'class Object; AutoloadTest = 1; end'
+ file.close
+ add_autoload(file.path)
+ begin
+ assert_nothing_raised do
+ assert(require file.path)
+ assert_equal(1, ::AutoloadTest)
+ end
+ ensure
+ remove_autoload_constant
+ end
+ }
+ end
+
+ def test_threaded_accessing_constant
+ Tempfile.create(['autoload', '.rb']) {|file|
+ file.puts 'sleep 0.5; class AutoloadTest; X = 1; end'
+ file.close
+ add_autoload(file.path)
+ begin
+ assert_nothing_raised do
+ t1 = Thread.new { ::AutoloadTest::X }
+ t2 = Thread.new { ::AutoloadTest::X }
+ [t1, t2].each(&:join)
+ end
+ ensure
+ remove_autoload_constant
+ end
+ }
+ end
+
+ def test_threaded_accessing_inner_constant
+ Tempfile.create(['autoload', '.rb']) {|file|
+ file.puts 'class AutoloadTest; sleep 0.5; X = 1; end'
+ file.close
+ add_autoload(file.path)
+ begin
+ assert_nothing_raised do
+ t1 = Thread.new { ::AutoloadTest::X }
+ t2 = Thread.new { ::AutoloadTest::X }
+ [t1, t2].each(&:join)
+ end
+ ensure
+ remove_autoload_constant
+ end
+ }
+ end
+
+ def test_nameerror_when_autoload_did_not_define_the_constant
+ Tempfile.create(['autoload', '.rb']) {|file|
+ file.puts ''
+ file.close
+ add_autoload(file.path)
+ begin
+ assert_raise(NameError) do
+ AutoloadTest
+ end
+ ensure
+ remove_autoload_constant
+ end
+ }
+ end
+
+ def test_override_autoload
+ Tempfile.create(['autoload', '.rb']) {|file|
+ file.puts ''
+ file.close
+ add_autoload(file.path)
+ begin
+ eval %q(class AutoloadTest; end)
+ assert_equal(Class, AutoloadTest.class)
+ ensure
+ remove_autoload_constant
+ end
+ }
+ end
+
+ def test_override_while_autoloading
+ Tempfile.create(['autoload', '.rb']) {|file|
+ file.puts 'class AutoloadTest; sleep 0.5; end'
+ file.close
+ add_autoload(file.path)
+ begin
+ # while autoloading...
+ t = Thread.new { AutoloadTest }
+ sleep 0.1
+ # override it
+ EnvUtil.suppress_warning {
+ eval %q(AutoloadTest = 1)
+ }
+ t.join
+ assert_equal(1, AutoloadTest)
+ ensure
+ remove_autoload_constant
+ end
+ }
+ end
+
+ def add_autoload(path)
+ (@autoload_paths ||= []) << path
+ eval <<-END
+ class ::Object
+ autoload :AutoloadTest, #{path.dump}
+ end
+ END
+ end
+
+ def remove_autoload_constant
+ $".replace($" - @autoload_paths)
+ eval <<-END
+ class ::Object
+ remove_const(:AutoloadTest)
+ end
+ END
+ end
end
diff --git a/test/ruby/test_backtrace.rb b/test/ruby/test_backtrace.rb
new file mode 100644
index 0000000000..91dec4a943
--- /dev/null
+++ b/test/ruby/test_backtrace.rb
@@ -0,0 +1,165 @@
+require 'test/unit'
+require 'thread'
+
+class TestBacktrace < Test::Unit::TestCase
+ def test_exception
+ bt = Fiber.new{
+ begin
+ raise
+ rescue => e
+ e.backtrace
+ end
+ }.resume
+ assert_equal(1, bt.size)
+ assert_match(/.+:\d+:.+/, bt[0])
+ end
+
+ def test_caller_lev
+ cs = []
+ Fiber.new{
+ Proc.new{
+ cs << caller(0)
+ cs << caller(1)
+ cs << caller(2)
+ cs << caller(3)
+ cs << caller(4)
+ cs << caller(5)
+ }.call
+ }.resume
+ assert_equal(3, cs[0].size)
+ assert_equal(2, cs[1].size)
+ assert_equal(1, cs[2].size)
+ assert_equal(0, cs[3].size)
+ assert_equal(nil, cs[4])
+
+ #
+ max = 7
+ rec = lambda{|n|
+ if n > 0
+ 1.times{
+ rec[n-1]
+ }
+ else
+ (max*3).times{|i|
+ total_size = caller(0).size
+ c = caller(i)
+ if c
+ assert_equal(total_size - i, caller(i).size, "[ruby-dev:45673]")
+ end
+ }
+ end
+ }
+ bt = Fiber.new{
+ rec[max]
+ }.resume
+ end
+
+ def test_caller_lev_and_n
+ m = 10
+ rec = lambda{|n|
+ if n < 0
+ (m*6).times{|lev|
+ (m*6).times{|n|
+ t = caller(0).size
+ r = caller(lev, n)
+ r = r.size if r.respond_to? :size
+
+ # STDERR.puts [t, lev, n, r].inspect
+ if n == 0
+ assert_equal(0, r, [t, lev, n, r].inspect)
+ elsif t < lev
+ assert_equal(nil, r, [t, lev, n, r].inspect)
+ else
+ if t - lev > n
+ assert_equal(n, r, [t, lev, n, r].inspect)
+ else
+ assert_equal(t - lev, r, [t, lev, n, r].inspect)
+ end
+ end
+ }
+ }
+ else
+ rec[n-1]
+ end
+ }
+ rec[m]
+ end
+
+ def test_caller_with_nil_length
+ assert_equal caller(0), caller(0, nil)
+ end
+
+ def test_caller_locations
+ cs = caller(0); locs = caller_locations(0).map{|loc|
+ loc.to_s
+ }
+ assert_equal(cs, locs)
+ end
+
+ def test_caller_locations_with_range
+ cs = caller(0,2); locs = caller_locations(0..1).map { |loc|
+ loc.to_s
+ }
+ assert_equal(cs, locs)
+ end
+
+ def test_caller_locations_to_s_inspect
+ cs = caller(0); locs = caller_locations(0)
+ cs.zip(locs){|str, loc|
+ assert_equal(str, loc.to_s)
+ assert_equal(str.inspect, loc.inspect)
+ }
+ end
+
+ def th_rec q, n=10
+ if n > 1
+ th_rec q, n-1
+ else
+ q.pop
+ end
+ end
+
+ def test_thread_backtrace
+ begin
+ q = Queue.new
+ th = Thread.new{
+ th_rec q
+ }
+ sleep 0.5
+ th_backtrace = th.backtrace
+ th_locations = th.backtrace_locations
+
+ assert_equal(10, th_backtrace.count{|e| e =~ /th_rec/})
+ assert_equal(th_backtrace, th_locations.map{|e| e.to_s})
+ assert_equal(th_backtrace, th.backtrace(0))
+ assert_equal(th_locations.map{|e| e.to_s},
+ th.backtrace_locations(0).map{|e| e.to_s})
+ th_backtrace.size.times{|n|
+ assert_equal(n, th.backtrace(0, n).size)
+ assert_equal(n, th.backtrace_locations(0, n).size)
+ }
+ n = th_backtrace.size
+ assert_equal(n, th.backtrace(0, n + 1).size)
+ assert_equal(n, th.backtrace_locations(0, n + 1).size)
+ ensure
+ q << true
+ end
+ end
+
+ def test_thread_backtrace_locations_with_range
+ begin
+ q = Queue.new
+ th = Thread.new{
+ th_rec q
+ }
+ sleep 0.5
+ bt = th.backtrace(0,2)
+ locs = th.backtrace_locations(0..1).map { |loc|
+ loc.to_s
+ }
+ assert_equal(bt, locs)
+ ensure
+ q << true
+ end
+ end
+end
diff --git a/test/ruby/test_basicinstructions.rb b/test/ruby/test_basicinstructions.rb
index 7e57530d72..4a1dc9ce12 100644
--- a/test/ruby/test_basicinstructions.rb
+++ b/test/ruby/test_basicinstructions.rb
@@ -85,7 +85,9 @@ class TestBasicInstructions < Test::Unit::TestCase
s = "OK"
prev = nil
3.times do
- assert_equal prev.object_id, (prev ||= /#{s}/o).object_id if prev
+ re = /#{s}/o
+ assert_same prev, re if prev
+ prev = re
end
end
@@ -500,6 +502,7 @@ class TestBasicInstructions < Test::Unit::TestCase
class OP
attr_reader :x
+ attr_accessor :foo
def x=(x)
@x = x
:Bug1996
@@ -600,6 +603,19 @@ class TestBasicInstructions < Test::Unit::TestCase
assert_equal 4, x[0]
end
+ def test_send_opassign
+ return if defined?(RUBY_ENGINE) and RUBY_ENGINE != "ruby"
+
+ bug7773 = '[ruby-core:51821]'
+ x = OP.new
+ assert_equal 42, x.foo = 42, bug7773
+ assert_equal 42, x.foo, bug7773
+ assert_equal -6, x.send(:foo=, -6), bug7773
+ assert_equal -6, x.foo, bug7773
+ assert_equal :Bug1996, x.send(:x=, :case_when_setter_returns_other_value), bug7773
+ assert_equal :case_when_setter_returns_other_value, x.x, bug7773
+ end
+
def test_backref
/re/ =~ 'not match'
assert_nil $~
@@ -681,5 +697,4 @@ class TestBasicInstructions < Test::Unit::TestCase
assert_equal [], [*a]
assert_equal [1], [1, *a]
end
-
end
diff --git a/test/ruby/test_beginendblock.rb b/test/ruby/test_beginendblock.rb
index b590835a2d..30db5024cc 100644
--- a/test/ruby/test_beginendblock.rb
+++ b/test/ruby/test_beginendblock.rb
@@ -16,34 +16,33 @@ class TestBeginEndBlock < Test::Unit::TestCase
result = IO.popen([ruby, target]){|io|io.read}
assert_equal(%w(b1 b2-1 b2 main b3-1 b3 b4 e1 e1-1 e4 e4-2 e4-1 e4-1-1 e3 e2), result.split)
- input = Tempfile.new(self.class.name)
- inputpath = input.path
- input.close
- result = IO.popen([ruby, "-n", "-eBEGIN{p :begin}", "-eEND{p :end}", inputpath]){|io|io.read}
- assert_equal(%w(:begin), result.split)
- result = IO.popen([ruby, "-p", "-eBEGIN{p :begin}", "-eEND{p :end}", inputpath]){|io|io.read}
- assert_equal(%w(:begin), result.split)
- input.open
- input.puts "foo\nbar"
- input.close
- result = IO.popen([ruby, "-n", "-eBEGIN{p :begin}", "-eEND{p :end}", inputpath]){|io|io.read}
- assert_equal(%w(:begin :end), result.split)
- result = IO.popen([ruby, "-p", "-eBEGIN{p :begin}", "-eEND{p :end}", inputpath]){|io|io.read}
- assert_equal(%w(:begin foo bar :end), result.split)
+ Tempfile.create(self.class.name) {|input|
+ inputpath = input.path
+ result = IO.popen([ruby, "-n", "-eBEGIN{p :begin}", "-eEND{p :end}", inputpath]){|io|io.read}
+ assert_equal(%w(:begin), result.split)
+ result = IO.popen([ruby, "-p", "-eBEGIN{p :begin}", "-eEND{p :end}", inputpath]){|io|io.read}
+ assert_equal(%w(:begin), result.split)
+ input.puts "foo\nbar"
+ input.close
+ result = IO.popen([ruby, "-n", "-eBEGIN{p :begin}", "-eEND{p :end}", inputpath]){|io|io.read}
+ assert_equal(%w(:begin :end), result.split)
+ result = IO.popen([ruby, "-p", "-eBEGIN{p :begin}", "-eEND{p :end}", inputpath]){|io|io.read}
+ assert_equal(%w(:begin foo bar :end), result.split)
+ }
end
def test_begininmethod
- assert_raise(SyntaxError) do
+ assert_raise_with_message(SyntaxError, /BEGIN is permitted only at toplevel/) do
eval("def foo; BEGIN {}; end")
end
- assert_raise(SyntaxError) do
+ assert_raise_with_message(SyntaxError, /BEGIN is permitted only at toplevel/) do
eval('eval("def foo; BEGIN {}; end")')
end
end
def test_begininclass
- assert_raise(SyntaxError) do
+ assert_raise_with_message(SyntaxError, /BEGIN is permitted only at toplevel/) do
eval("class TestBeginEndBlock; BEGIN {}; end")
end
end
@@ -51,10 +50,10 @@ class TestBeginEndBlock < Test::Unit::TestCase
def test_endblockwarn
ruby = EnvUtil.rubybin
# Use Tempfile to create temporary file path.
- launcher = Tempfile.new(self.class.name)
- errout = Tempfile.new(self.class.name)
+ Tempfile.create(self.class.name) {|launcher|
+ Tempfile.create(self.class.name) {|errout|
- launcher << <<EOF
+ launcher << <<EOF
# -*- coding: #{ruby.encoding.name} -*-
errout = ARGV.shift
STDERR.reopen(File.open(errout, "w"))
@@ -62,17 +61,18 @@ STDERR.sync = true
Dir.chdir(#{q(DIR)})
system("#{ruby}", "endblockwarn_rb")
EOF
- launcher.close
- launcherpath = launcher.path
- errout.close
- erroutpath = errout.path
- system(ruby, launcherpath, erroutpath)
- expected = <<EOW
+ launcher.close
+ launcherpath = launcher.path
+ errout.close
+ erroutpath = errout.path
+ system(ruby, launcherpath, erroutpath)
+ expected = <<EOW
endblockwarn_rb:2: warning: END in method; use at_exit
(eval):2: warning: END in method; use at_exit
EOW
- assert_equal(expected, File.read(erroutpath))
- # expecting Tempfile to unlink launcher and errout file.
+ assert_equal(expected, File.read(erroutpath))
+ }
+ }
end
def test_raise_in_at_exit
@@ -82,18 +82,33 @@ EOW
'-e', 'raise %[SomethingElse]']) {|f|
f.read
}
+ status = $?
assert_match(/SomethingBad/, out, "[ruby-core:9675]")
assert_match(/SomethingElse/, out, "[ruby-core:9675]")
+ assert_not_predicate(status, :success?)
+ end
+
+ def test_exitcode_in_at_exit
+ bug8501 = '[ruby-core:55365] [Bug #8501]'
+ ruby = EnvUtil.rubybin
+ out = IO.popen([ruby, '-e', 'STDERR.reopen(STDOUT)',
+ '-e', 'o = Object.new; def o.inspect; raise "[Bug #8501]"; end',
+ '-e', 'at_exit{o.nope}']) {|f|
+ f.read
+ }
+ status = $?
+ assert_match(/undefined method `nope'/, out, bug8501)
+ assert_not_predicate(status, :success?, bug8501)
end
- def test_should_propagate_exit_code
+ def test_propagate_exit_code
ruby = EnvUtil.rubybin
assert_equal false, system(ruby, '-e', 'at_exit{exit 2}')
assert_equal 2, $?.exitstatus
assert_nil $?.termsig
end
- def test_should_propagate_signaled
+ def test_propagate_signaled
ruby = EnvUtil.rubybin
out = IO.popen(
[ruby,
@@ -126,24 +141,24 @@ EOW
end
def test_nested_at_exit
- t = Tempfile.new(["test_nested_at_exit_", ".rb"])
- t.puts "at_exit { puts :outer0 }"
- t.puts "at_exit { puts :outer1_begin; at_exit { puts :inner1 }; puts :outer1_end }"
- t.puts "at_exit { puts :outer2_begin; at_exit { puts :inner2 }; puts :outer2_end }"
- t.puts "at_exit { puts :outer3 }"
- t.flush
-
- expected = [ "outer3",
- "outer2_begin",
- "outer2_end",
- "inner2",
- "outer1_begin",
- "outer1_end",
- "inner1",
- "outer0" ]
-
- assert_in_out_err(t.path, "", expected, [], "[ruby-core:35237]")
- t.close
+ Tempfile.create(["test_nested_at_exit_", ".rb"]) {|t|
+ t.puts "at_exit { puts :outer0 }"
+ t.puts "at_exit { puts :outer1_begin; at_exit { puts :inner1 }; puts :outer1_end }"
+ t.puts "at_exit { puts :outer2_begin; at_exit { puts :inner2 }; puts :outer2_end }"
+ t.puts "at_exit { puts :outer3 }"
+ t.flush
+
+ expected = [ "outer3",
+ "outer2_begin",
+ "outer2_end",
+ "inner2",
+ "outer1_begin",
+ "outer1_end",
+ "inner1",
+ "outer0" ]
+
+ assert_in_out_err(t.path, "", expected, [], "[ruby-core:35237]")
+ }
end
def test_rescue_at_exit
@@ -158,4 +173,15 @@ EOW
assert_equal(["", "", 42], [out, err, status.exitstatus], "#{bug5218}: #{ex}")
end
end
+
+ def test_callcc_at_exit
+ bug9110 = '[ruby-core:58329][Bug #9110]'
+ script = <<EOS
+require "continuation"
+c = nil
+at_exit { c.call }
+at_exit { callcc {|_c| c = _c } }
+EOS
+ assert_normal_exit(script, bug9110)
+ end
end
diff --git a/test/ruby/test_bignum.rb b/test/ruby/test_bignum.rb
index 582a7b2366..2c6eda0d8e 100644
--- a/test/ruby/test_bignum.rb
+++ b/test/ruby/test_bignum.rb
@@ -27,8 +27,8 @@ class TestBignum < Test::Unit::TestCase
$x = fact(40)
assert_equal($x, $x)
assert_equal($x, fact(40))
- assert($x < $x+2)
- assert($x > $x-2)
+ assert_operator($x, :<, $x+2)
+ assert_operator($x, :>, $x-2)
assert_equal(815915283247897734345611269596115894272000000000, $x)
assert_not_equal(815915283247897734345611269596115894272000000001, $x)
assert_equal(815915283247897734345611269596115894272000000001, $x+1)
@@ -106,19 +106,45 @@ class TestBignum < Test::Unit::TestCase
assert_equal("nd075ib45k86g" ,18446744073709551616.to_s(31), "[ruby-core:10686]")
assert_equal("1777777777777777777777" ,18446744073709551615.to_s(8))
assert_equal("-1777777777777777777777" ,-18446744073709551615.to_s(8))
+ assert_match(/\A10{99}1\z/, (10**100+1).to_s)
+ assert_match(/\A10{900}9{100}\z/, (10**1000+(10**100-1)).to_s)
+ end
+
+ b = 2**64
+ b *= b until Bignum === b
+
+ T_ZERO = b.coerce(0).first
+ T_ONE = b.coerce(1).first
+ T_MONE = b.coerce(-1).first
+ T31 = b.coerce(2**31).first # 2147483648
+ T31P = b.coerce(T31 - 1).first # 2147483647
+ T32 = b.coerce(2**32).first # 4294967296
+ T32P = b.coerce(T32 - 1).first # 4294967295
+ T64 = b.coerce(2**64).first # 18446744073709551616
+ T64P = b.coerce(T64 - 1).first # 18446744073709551615
+ T1024 = b.coerce(2**1024).first
+ T1024P = b.coerce(T1024 - 1).first
+
+ f = b
+ while Bignum === f-1
+ f = f >> 1
+ end
+ FIXNUM_MAX = f-1
+
+ def test_prepare
+ assert_instance_of(Bignum, T_ZERO)
+ assert_instance_of(Bignum, T_ONE)
+ assert_instance_of(Bignum, T_MONE)
+ assert_instance_of(Bignum, T31)
+ assert_instance_of(Bignum, T31P)
+ assert_instance_of(Bignum, T32)
+ assert_instance_of(Bignum, T32P)
+ assert_instance_of(Bignum, T64)
+ assert_instance_of(Bignum, T64P)
+ assert_instance_of(Bignum, T1024)
+ assert_instance_of(Bignum, T1024P)
end
-
- T_ZERO = (2**32).coerce(0).first
- T_ONE = (2**32).coerce(1).first
- T_MONE = (2**32).coerce(-1).first
- T31 = 2**31 # 2147483648
- T31P = T31 - 1 # 2147483647
- T32 = 2**32 # 4294967296
- T32P = T32 - 1 # 4294967295
- T64 = 2**64 # 18446744073709551616
- T64P = T64 - 1 # 18446744073709551615
-
def test_big_2comp
assert_equal("-4294967296", (~T32P).to_s)
assert_equal("..f00000000", "%x" % -T32)
@@ -180,24 +206,24 @@ class TestBignum < Test::Unit::TestCase
end
def test_cmp
- assert(T31P > 1)
- assert(T31P < 2147483648.0)
- assert(T31P < T64P)
- assert(T64P > T31P)
+ assert_operator(T31P, :>, 1)
+ assert_operator(T31P, :<, 2147483648.0)
+ assert_operator(T31P, :<, T64P)
+ assert_operator(T64P, :>, T31P)
assert_raise(ArgumentError) { T31P < "foo" }
- assert(T64 < (1.0/0.0))
- assert(!(T64 > (1.0/0.0)))
+ assert_operator(T64, :<, (1.0/0.0))
+ assert_not_operator(T64, :>, (1.0/0.0))
end
def test_eq
- assert(T31P != 1)
- assert(T31P == 2147483647.0)
- assert(T31P != "foo")
- assert(2**77889 != (1.0/0.0), '[ruby-core:31603]')
+ assert_not_equal(T31P, 1)
+ assert_equal(T31P, 2147483647.0)
+ assert_not_equal(T31P, "foo")
+ assert_not_equal(2**77889, (1.0/0.0), '[ruby-core:31603]')
end
def test_eql
- assert(T31P.eql?(T31P))
+ assert_send([T31P, :eql?, T31P])
end
def test_convert
@@ -360,10 +386,19 @@ class TestBignum < Test::Unit::TestCase
assert_equal(0, T32 / T64)
end
+ def test_divide
+ bug5490 = '[ruby-core:40429]'
+ assert_raise(ZeroDivisionError, bug5490) {T1024./(0)}
+ assert_equal(Float::INFINITY, T1024./(0.0), bug5490)
+ end
+
def test_div
assert_equal(T32.to_f, T32 / 1.0)
assert_raise(TypeError) { T32 / "foo" }
assert_equal(0x20000000, 0x40000001.div(2.0), "[ruby-dev:34553]")
+ bug5490 = '[ruby-core:40429]'
+ assert_raise(ZeroDivisionError, bug5490) {T1024.div(0)}
+ assert_raise(ZeroDivisionError, bug5490) {T1024.div(0.0)}
end
def test_idiv
@@ -386,6 +421,8 @@ class TestBignum < Test::Unit::TestCase
end
def test_quo
+ assert_kind_of(Float, T32.quo(1.0))
+
assert_equal(T32.to_f, T32.quo(1))
assert_equal(T32.to_f, T32.quo(1.0))
assert_equal(T32.to_f, T32.quo(T_ONE))
@@ -393,11 +430,11 @@ class TestBignum < Test::Unit::TestCase
assert_raise(TypeError) { T32.quo("foo") }
assert_equal(1024**1024, (1024**1024).quo(1))
- assert_equal(1024**1024, (1024**1024).quo(1.0))
+ assert_equal(Float::INFINITY, (1024**1024).quo(1.0))
assert_equal(1024**1024*2, (1024**1024*2).quo(1))
inf = 1 / 0.0; nan = inf / inf
- assert((1024**1024*2).quo(nan).nan?)
+ assert_send([(1024**1024*2).quo(nan), :nan?])
end
def test_pow
@@ -425,6 +462,7 @@ class TestBignum < Test::Unit::TestCase
assert_equal(T32 + T31, T32 | T31)
assert_equal(-T31, (-T32) | (-T31))
assert_equal(T64 + T32, T32 | T64)
+ assert_equal(FIXNUM_MAX, T_ZERO | FIXNUM_MAX)
end
def test_xor
@@ -434,6 +472,48 @@ class TestBignum < Test::Unit::TestCase
assert_equal(T64 + T32, T32 ^ T64)
end
+ class DummyNumeric < Numeric
+ def to_int
+ 1
+ end
+ end
+
+ def test_and_with_float
+ assert_raise(TypeError) { T1024 & 1.5 }
+ end
+
+ def test_and_with_rational
+ assert_raise(TypeError, "#1792") { T1024 & Rational(3, 2) }
+ end
+
+ def test_and_with_nonintegral_numeric
+ assert_raise(TypeError, "#1792") { T1024 & DummyNumeric.new }
+ end
+
+ def test_or_with_float
+ assert_raise(TypeError) { T1024 | 1.5 }
+ end
+
+ def test_or_with_rational
+ assert_raise(TypeError, "#1792") { T1024 | Rational(3, 2) }
+ end
+
+ def test_or_with_nonintegral_numeric
+ assert_raise(TypeError, "#1792") { T1024 | DummyNumeric.new }
+ end
+
+ def test_xor_with_float
+ assert_raise(TypeError) { T1024 ^ 1.5 }
+ end
+
+ def test_xor_with_rational
+ assert_raise(TypeError, "#1792") { T1024 ^ Rational(3, 2) }
+ end
+
+ def test_xor_with_nonintegral_numeric
+ assert_raise(TypeError, "#1792") { T1024 ^ DummyNumeric.new }
+ end
+
def test_shift2
assert_equal(2**33, (2**32) << 1)
assert_equal(2**31, (2**32) << -1)
@@ -455,6 +535,11 @@ class TestBignum < Test::Unit::TestCase
assert_equal(-1, -(2**31) >> 32)
end
+ def test_shift_bigshift
+ big = 2**300
+ assert_equal(2**65538 / (2**65537), 2**65538 >> big.coerce(65537).first)
+ end
+
def test_aref
assert_equal(0, (2**32)[0])
assert_equal(0, (2**32)[2**32])
@@ -478,7 +563,7 @@ class TestBignum < Test::Unit::TestCase
end
def test_size
- assert(T31P.size.is_a?(Integer))
+ assert_kind_of(Integer, T31P.size)
end
def test_odd
@@ -491,33 +576,65 @@ class TestBignum < Test::Unit::TestCase
assert_equal(true, (2**32).even?)
end
- def assert_interrupt
+ def test_interrupt_during_to_s
+ if defined?(Bignum::GMP_VERSION)
+ return # GMP doesn't support interrupt during an operation.
+ end
time = Time.now
start_flag = false
end_flag = false
+ num = (65536 ** 65536)
thread = Thread.new do
start_flag = true
- yield
+ num.to_s
end_flag = true
end
- Thread.pass until start_flag
+ sleep 0.001 until start_flag
thread.raise
thread.join rescue nil
time = Time.now - time
- assert_equal([true, false], [start_flag, end_flag])
+ skip "too fast cpu" if end_flag
assert_operator(time, :<, 10)
end
- def test_interrupt
- assert_interrupt {(65536 ** 65536).to_s}
+ def test_interrupt_during_bigdivrem
+ if defined?(Bignum::GMP_VERSION)
+ return # GMP doesn't support interrupt during an operation.
+ end
+ return unless Process.respond_to?(:kill)
+ begin
+ trace = []
+ oldtrap = Signal.trap(:INT) {|sig| trace << :int }
+ a = 456 ** 100
+ b = 123 ** 100
+ c = nil
+ 100.times do |n|
+ a **= 3
+ b **= 3
+ trace.clear
+ th = Thread.new do
+ sleep 0.1; Process.kill :INT, $$
+ sleep 0.1; Process.kill :INT, $$
+ end
+ c = a / b
+ trace << :end
+ th.join
+ if trace == [:int, :int, :end]
+ assert_equal(a / b, c)
+ return
+ end
+ end
+ skip "cannot create suitable test case"
+ ensure
+ Signal.trap(:INT, oldtrap) if oldtrap
+ end
end
def test_too_big_to_s
if (big = 2**31-1).is_a?(Fixnum)
return
end
- e = assert_raise(RangeError) {(1 << big).to_s}
- assert_match(/too big to convert/, e.message)
+ assert_raise_with_message(RangeError, /too big to convert/) {(1 << big).to_s}
end
def test_fix_fdiv
@@ -537,7 +654,7 @@ class TestBignum < Test::Unit::TestCase
def test_float_fdiv
b = 1E+300.to_i
assert_equal(b, (b ** 2).fdiv(b))
- assert(@big.fdiv(0.0 / 0.0).nan?)
+ assert_send([@big.fdiv(0.0 / 0.0), :nan?])
assert_in_delta(1E+300, (10**500).fdiv(1E+200), 1E+285)
end
@@ -546,4 +663,49 @@ class TestBignum < Test::Unit::TestCase
def o.coerce(x); [x, 2**100]; end
assert_equal((2**200).to_f, (2**300).fdiv(o))
end
+
+ def test_singleton_method
+ # this test assumes 32bit/64bit platform
+ assert_raise(TypeError) { a = 1 << 64; def a.foo; end }
+ end
+
+ def test_frozen
+ assert_equal(true, (2**100).frozen?)
+ end
+
+ def test_bitwise_and_with_integer_mimic_object
+ def (obj = Object.new).to_int
+ 10
+ end
+ assert_raise(TypeError, '[ruby-core:39491]') { T1024 & obj }
+
+ def obj.coerce(other)
+ [other, 10]
+ end
+ assert_equal(T1024 & 10, T1024 & obj)
+ end
+
+ def test_bitwise_or_with_integer_mimic_object
+ def (obj = Object.new).to_int
+ 10
+ end
+ assert_raise(TypeError, '[ruby-core:39491]') { T1024 | obj }
+
+ def obj.coerce(other)
+ [other, 10]
+ end
+ assert_equal(T1024 | 10, T1024 | obj)
+ end
+
+ def test_bitwise_xor_with_integer_mimic_object
+ def (obj = Object.new).to_int
+ 10
+ end
+ assert_raise(TypeError, '[ruby-core:39491]') { T1024 ^ obj }
+
+ def obj.coerce(other)
+ [other, 10]
+ end
+ assert_equal(T1024 ^ 10, T1024 ^ obj)
+ end
end
diff --git a/test/ruby/test_class.rb b/test/ruby/test_class.rb
index 3d894da03c..b40cab8050 100644
--- a/test/ruby/test_class.rb
+++ b/test/ruby/test_class.rb
@@ -105,6 +105,32 @@ class TestClass < Test::Unit::TestCase
end
end
+ def test_extend_object
+ c = Class.new
+ assert_raise(TypeError) do
+ Module.instance_method(:extend_object).bind(c).call(Object.new)
+ end
+ end
+
+ def test_append_features
+ c = Class.new
+ assert_raise(TypeError) do
+ Module.instance_method(:append_features).bind(c).call(Module.new)
+ end
+ end
+
+ def test_prepend_features
+ c = Class.new
+ assert_raise(TypeError) do
+ Module.instance_method(:prepend_features).bind(c).call(Module.new)
+ end
+ end
+
+ def test_module_specific_methods
+ assert_empty(Class.private_instance_methods(true) &
+ [:module_function, :extend_object, :append_features, :prepend_features])
+ end
+
def test_method_redefinition
feature2155 = '[ruby-dev:39400]'
@@ -118,23 +144,21 @@ class TestClass < Test::Unit::TestCase
assert_match(/:#{line}: warning: method redefined; discarding old foo/, stderr)
assert_match(/:#{line-1}: warning: previous definition of foo/, stderr, feature2155)
- stderr = EnvUtil.verbose_warning do
+ assert_warning '' do
Class.new do
def foo; end
alias bar foo
def foo; end
end
end
- assert_equal("", stderr)
- stderr = EnvUtil.verbose_warning do
+ assert_warning '' do
Class.new do
def foo; end
alias bar foo
alias bar foo
end
end
- assert_equal("", stderr)
line = __LINE__+4
stderr = EnvUtil.verbose_warning do
@@ -146,22 +170,20 @@ class TestClass < Test::Unit::TestCase
assert_match(/:#{line}: warning: method redefined; discarding old foo/, stderr)
assert_match(/:#{line-1}: warning: previous definition of foo/, stderr, feature2155)
- stderr = EnvUtil.verbose_warning do
+ assert_warning '' do
Class.new do
define_method(:foo) do end
alias bar foo
alias bar foo
end
end
- assert_equal("", stderr)
- stderr = EnvUtil.verbose_warning do
+ assert_warning '' do
Class.new do
def foo; end
undef foo
end
end
- assert_equal("", stderr)
end
def test_check_inheritable
@@ -187,6 +209,8 @@ class TestClass < Test::Unit::TestCase
def test_singleton_class
assert_raise(TypeError) { 1.extend(Module.new) }
+ assert_raise(TypeError) { 1.0.extend(Module.new) }
+ assert_raise(TypeError) { (2.0**1000).extend(Module.new) }
assert_raise(TypeError) { :foo.extend(Module.new) }
assert_in_out_err([], <<-INPUT, %w(:foo :foo true true), [])
@@ -203,6 +227,8 @@ class TestClass < Test::Unit::TestCase
def test_uninitialized
assert_raise(TypeError) { Class.allocate.new }
assert_raise(TypeError) { Class.allocate.superclass }
+ bug6863 = '[ruby-core:47148]'
+ assert_raise(TypeError, bug6863) { Class.new(Class.allocate) }
end
def test_nonascii_name
@@ -259,8 +285,16 @@ class TestClass < Test::Unit::TestCase
assert_equal(42, PrivateClass.new.foo)
end
+ StrClone = String.clone
+ Class.new(StrClone)
+
+ def test_cloned_class
+ bug5274 = StrClone.new("[ruby-dev:44460]")
+ assert_equal(bug5274, Marshal.load(Marshal.dump(bug5274)))
+ end
+
def test_cannot_reinitialize_class_with_initialize_copy # [ruby-core:50869]
- assert_in_out_err([], <<-RUBY, ["Object"], [])
+ assert_in_out_err([], <<-'end;', ["Object"], [])
class Class
def initialize_copy(*); super; end
end
@@ -271,6 +305,77 @@ class TestClass < Test::Unit::TestCase
A.send(:initialize_copy, Class.new(B)) rescue nil
p A.superclass
- RUBY
+ end;
+ end
+
+ module M
+ C = 1
+
+ def self.m
+ C
+ end
+ end
+
+ def test_constant_access_from_method_in_cloned_module # [ruby-core:47834]
+ m = M.dup
+ assert_equal 1, m::C
+ assert_equal 1, m.m
+ end
+
+ def test_invalid_superclass
+ assert_raise(TypeError) do
+ eval <<-'end;'
+ class C < nil
+ end
+ end;
+ end
+
+ assert_raise(TypeError) do
+ eval <<-'end;'
+ class C < false
+ end
+ end;
+ end
+
+ assert_raise(TypeError) do
+ eval <<-'end;'
+ class C < true
+ end
+ end;
+ end
+
+ assert_raise(TypeError) do
+ eval <<-'end;'
+ class C < 0
+ end
+ end;
+ end
+
+ assert_raise(TypeError) do
+ eval <<-'end;'
+ class C < ""
+ end
+ end;
+ end
+ end
+
+ def test_cloned_singleton_method_added
+ bug5283 = '[ruby-dev:44477]'
+ added = []
+ c = Class.new
+ c.singleton_class.class_eval do
+ define_method(:singleton_method_added) {|mid| added << [self, mid]}
+ def foo; :foo; end
+ end
+ added.clear
+ d = c.clone
+ assert_empty(added.grep(->(k) {c == k[0]}), bug5283)
+ assert_equal(:foo, d.foo)
+ end
+
+ def test_singleton_class_p
+ feature7609 = '[ruby-core:51087] [Feature #7609]'
+ assert_predicate(self.singleton_class, :singleton_class?, feature7609)
+ assert_not_predicate(self.class, :singleton_class?, feature7609)
end
end
diff --git a/test/ruby/test_comparable.rb b/test/ruby/test_comparable.rb
index 00ce6b485a..747f1e29a7 100644
--- a/test/ruby/test_comparable.rb
+++ b/test/ruby/test_comparable.rb
@@ -69,4 +69,18 @@ class TestComparable < Test::Unit::TestCase
assert_raise(ArgumentError) { 1.0 < nil }
assert_raise(ArgumentError) { 1.0 < Object.new }
end
+
+ def test_inversed_compare
+ bug7870 = '[ruby-core:52305] [Bug #7870]'
+ assert_nothing_raised(SystemStackError, bug7870) {
+ assert_nil(Time.new <=> "")
+ }
+ end
+
+ def test_no_cmp
+ bug9003 = '[ruby-core:57736] [Bug #9003]'
+ assert_nothing_raised(SystemStackError, bug9003) {
+ @o <=> @o.dup
+ }
+ end
end
diff --git a/test/ruby/test_complex.rb b/test/ruby/test_complex.rb
index b2f9e8dff0..0a7828b85f 100644
--- a/test/ruby/test_complex.rb
+++ b/test/ruby/test_complex.rb
@@ -658,9 +658,20 @@ class Complex_Test < Test::Unit::TestCase
end
bug3656 = '[ruby-core:31622]'
- assert_raise(TypeError, bug3656) {
- Complex(1,2).marshal_load(0)
- }
+ c = Complex(1,2)
+ c.freeze
+ assert(c.frozen?)
+ result = c.marshal_load([2,3]) rescue :fail
+ assert_equal(:fail, result, bug3656)
+ assert_equal(Complex(1,2), c)
+ end
+
+ def test_marshal_compatibility
+ bug6625 = '[ruby-core:45775]'
+ dump = "\x04\x08o:\x0cComplex\x07:\x0a@reali\x06:\x0b@imagei\x07"
+ assert_nothing_raised(bug6625) do
+ assert_equal(Complex(1, 2), Marshal.load(dump), bug6625)
+ end
end
def test_parse
@@ -1020,7 +1031,7 @@ class Complex_Test < Test::Unit::TestCase
end
assert_equal(Complex(0.5,1.0), Complex(1,2).quo(2))
- unless $".grep(/(\A|\/)complex/).empty?
+ unless $".grep(/(?:\A|(?<!add)\/)complex/).empty?
assert_equal(Complex(0,2), Math.sqrt(-4.0))
# assert_equal(true, Math.sqrt(-4.0).inexact?)
assert_equal(Complex(0,2), Math.sqrt(-4))
@@ -1143,6 +1154,7 @@ class Complex_Test < Test::Unit::TestCase
assert_equal('-1.0-0.0i', Complex(-1.0, -0.0).to_s)
assert_in_delta(Math::PI, Complex(-0.0).arg, 0.001)
assert_equal(Complex(2e3, 2e4), '2e3+2e4i'.to_c)
+ assert_raise(ArgumentError){ Complex('--8i')}
end
def test_known_bug
diff --git a/test/ruby/test_const.rb b/test/ruby/test_const.rb
index 3708a5a0ca..dab45b7e08 100644
--- a/test/ruby/test_const.rb
+++ b/test/ruby/test_const.rb
@@ -1,3 +1,4 @@
+# -*- coding: us-ascii -*-
require 'test/unit'
class TestConst < Test::Unit::TestCase
@@ -45,4 +46,13 @@ class TestConst < Test::Unit::TestCase
assert defined?(TEST4)
assert_equal 8, TEST4
end
+
+ def test_redefinition
+ c = Class.new
+ c.const_set(:X, 1)
+ assert_output(nil, <<-WARNING) {c.const_set(:X, 2)}
+#{__FILE__}:#{__LINE__-1}: warning: already initialized constant #{c}::X
+#{__FILE__}:#{__LINE__-3}: warning: previous definition of X was here
+WARNING
+ end
end
diff --git a/test/ruby/test_continuation.rb b/test/ruby/test_continuation.rb
index 64390d8177..52d8de482c 100644
--- a/test/ruby/test_continuation.rb
+++ b/test/ruby/test_continuation.rb
@@ -78,10 +78,17 @@ class TestContinuation < Test::Unit::TestCase
end
def tracing_with_set_trace_func
+ orig_thread = Thread.current
cont = nil
func = lambda do |*args|
- @memo += 1
- cont.call(nil)
+ if orig_thread == Thread.current
+ if cont
+ @memo += 1
+ c = cont
+ cont = nil
+ c.call(nil)
+ end
+ end
end
cont = callcc { |cc| cc }
if cont
@@ -102,8 +109,12 @@ class TestContinuation < Test::Unit::TestCase
def tracing_with_thread_set_trace_func
cont = nil
func = lambda do |*args|
- @memo += 1
- cont.call(nil)
+ if cont
+ @memo += 1
+ c = cont
+ cont = nil
+ c.call(nil)
+ end
end
cont = callcc { |cc| cc }
if cont
diff --git a/test/ruby/test_defined.rb b/test/ruby/test_defined.rb
index 2552626b9e..6c63c7fb27 100644
--- a/test/ruby/test_defined.rb
+++ b/test/ruby/test_defined.rb
@@ -1,4 +1,5 @@
require 'test/unit'
+require_relative 'envutil'
class TestDefined < Test::Unit::TestCase
class Foo
@@ -84,6 +85,24 @@ class TestDefined < Test::Unit::TestCase
assert_equal 'global-variable', defined?($+)
assert_equal 'global-variable', defined?($1)
assert_equal nil, defined?($2)
+
+ assert_equal("nil", defined?(nil))
+ assert_equal("true", defined?(true))
+ assert_equal("false", defined?(false))
+ assert_equal("expression", defined?(1))
+
+ bug8224 = '[ruby-core:54024] [Bug #8224]'
+ (1..3).each do |level|
+ expr = "("*level+")"*level
+ assert_equal("nil", eval("defined? #{expr}"), "#{bug8224} defined? #{expr}")
+ assert_equal("nil", eval("defined?(#{expr})"), "#{bug8224} defined?(#{expr})")
+ end
+ end
+
+ def test_defined_impl_specific
+ feature7035 = '[ruby-core:47558]' # not spec
+ assert_predicate(defined?(Foo), :frozen?, feature7035)
+ assert_same(defined?(Foo), defined?(Array), feature7035)
end
class TestAutoloadedSuperclass
@@ -136,4 +155,58 @@ class TestDefined < Test::Unit::TestCase
bug5786 = '[ruby-dev:45021]'
assert_nil(defined?(raise("[Bug#5786]")::A), bug5786)
end
+
+ def test_define_method
+ bug6644 = '[ruby-core:45831]'
+ a = Class.new do
+ def self.def_f!;
+ singleton_class.send(:define_method, :f) { defined? super }
+ end
+ end
+ aa = Class.new(a)
+ a.def_f!
+ assert_nil(a.f)
+ assert_nil(aa.f)
+ aa.def_f!
+ assert_equal("super", aa.f, bug6644)
+ assert_nil(a.f, bug6644)
+ end
+
+ def test_super_in_included_method
+ c0 = Class.new do
+ def m
+ end
+ end
+ m1 = Module.new do
+ def m
+ defined?(super)
+ end
+ end
+ c = Class.new(c0) do include m1
+ def m
+ super
+ end
+ end
+ assert_equal("super", c.new.m)
+ end
+
+ def test_super_in_block
+ bug8367 = '[ruby-core:54769] [Bug #8367]'
+ c = Class.new do
+ def x; end
+ end
+
+ m = Module.new do
+ def b; yield; end
+ def x; b {return defined?(super)}; end
+ end
+
+ o = c.new
+ o.extend(m)
+ assert_equal("super", o.x)
+ end
+
+ def test_super_toplevel
+ assert_separately([], "assert_nil(defined?(super))")
+ end
end
diff --git a/test/ruby/test_dir.rb b/test/ruby/test_dir.rb
index b688cc4dd0..0948ae748d 100644
--- a/test/ruby/test_dir.rb
+++ b/test/ruby/test_dir.rb
@@ -2,14 +2,13 @@ require 'test/unit'
require 'tmpdir'
require 'fileutils'
-require 'pathname'
class TestDir < Test::Unit::TestCase
def setup
@verbose = $VERBOSE
$VERBOSE = nil
- @root = Pathname.new(Dir.mktmpdir('__test_dir__')).realpath.to_s
+ @root = File.realpath(Dir.mktmpdir('__test_dir__'))
@nodir = File.join(@root, "dummy")
for i in ?a..?z
if i.ord % 2 == 0
@@ -43,15 +42,6 @@ class TestDir < Test::Unit::TestCase
end
end
- def test_JVN_13947696
- b = lambda {
- d = Dir.open('.')
- $SAFE = 4
- d.close
- }
- assert_raise(SecurityError) { b.call }
- end
-
def test_nodir
assert_raise(Errno::ENOENT) { Dir.open(@nodir) }
end
@@ -90,12 +80,6 @@ class TestDir < Test::Unit::TestCase
d.rewind
b = (0..5).map { d.read }
assert_equal(a, b)
- assert_raise(SecurityError) do
- Thread.new do
- $SAFE = 4
- d.rewind
- end.join
- end
ensure
d.close
end
@@ -164,16 +148,14 @@ class TestDir < Test::Unit::TestCase
assert_equal([File.join(@root, "a")], Dir.glob(File.join(@root, 'a\\')))
assert_equal((?a..?f).map {|f| File.join(@root, f) }.sort, Dir.glob(File.join(@root, '[abc/def]')).sort)
-
- d = "\u{3042}\u{3044}".encode("utf-16le")
- assert_raise(Encoding::CompatibilityError) {Dir.glob(d)}
- m = Class.new {define_method(:to_path) {d}}
- assert_raise(Encoding::CompatibilityError) {Dir.glob(m.new)}
end
def test_glob_recursive
bug6977 = '[ruby-core:47418]'
+ bug8006 = '[ruby-core:53108] [Bug #8006]'
Dir.chdir(@root) do
+ assert_include(Dir.glob("a/**/*", File::FNM_DOTMATCH), "a/.", bug8006)
+
FileUtils.mkdir_p("a/b/c/d/e/f")
assert_equal(["a/b/c/d/e/f"], Dir.glob("a/**/e/f"), bug6977)
assert_equal(["a/b/c/d/e/f"], Dir.glob("a/**/d/e/f"), bug6977)
@@ -182,6 +164,15 @@ class TestDir < Test::Unit::TestCase
assert_equal(["a/b/c/d/e/f"], Dir.glob("a/**/c/?/e/f"), bug6977)
assert_equal(["a/b/c/d/e/f"], Dir.glob("a/**/c/**/d/e/f"), bug6977)
assert_equal(["a/b/c/d/e/f"], Dir.glob("a/**/c/**/d/e/f"), bug6977)
+
+ bug8283 = '[ruby-core:54387] [Bug #8283]'
+ dirs = ["a/.x", "a/b/.y"]
+ FileUtils.mkdir_p(dirs)
+ dirs.map {|dir| open("#{dir}/z", "w") {}}
+ assert_equal([], Dir.glob("a/**/z").sort, bug8283)
+ assert_equal(["a/.x/z"], Dir.glob("a/**/.x/z"), bug8283)
+ assert_equal(["a/.x/z"], Dir.glob("a/.x/**/z"), bug8283)
+ assert_equal(["a/b/.y/z"], Dir.glob("a/**/.y/z"), bug8283)
end
end
@@ -225,4 +216,30 @@ class TestDir < Test::Unit::TestCase
Dir.glob(File.join(@root, "**/"))
end
+ def test_glob_metachar
+ bug8597 = '[ruby-core:55764] [Bug #8597]'
+ assert_empty(Dir.glob(File.join(@root, "<")), bug8597)
+ end
+
+ def test_home
+ env_home = ENV["HOME"]
+ env_logdir = ENV["LOGDIR"]
+ ENV.delete("HOME")
+ ENV.delete("LOGDIR")
+
+ assert_raise(ArgumentError) { Dir.home }
+ assert_raise(ArgumentError) { Dir.home("") }
+ ENV["HOME"] = @nodir
+ assert_nothing_raised(ArgumentError) {
+ assert_equal(@nodir, Dir.home)
+ assert_equal(@nodir, Dir.home(""))
+ }
+ %W[no:such:user \u{7559 5b88}:\u{756a}].each do |user|
+ assert_raise_with_message(ArgumentError, /#{user}/) {Dir.home(user)}
+ end
+ ensure
+ ENV["HOME"] = env_home
+ ENV["LOGDIR"] = env_logdir
+ end
+
end
diff --git a/test/ruby/test_dir_m17n.rb b/test/ruby/test_dir_m17n.rb
index 2cf1c15441..a8fab3d216 100644
--- a/test/ruby/test_dir_m17n.rb
+++ b/test/ruby/test_dir_m17n.rb
@@ -13,28 +13,32 @@ class TestDir_M17N < Test::Unit::TestCase
def create_and_check_raw_file_name(code, encoding)
with_tmpdir { |dir|
- create_file_program = %Q[
+ assert_separately(["-E#{encoding}"], <<-EOS, :chdir=>dir)
filename = #{code}.chr('UTF-8').force_encoding("#{encoding}")
File.open(filename, "w") {}
opts = {:encoding => Encoding.default_external} if /mswin|mingw/ =~ RUBY_PLATFORM
ents = Dir.entries(".", opts)
- exit ents.include?(filename)
- ]
- assert_ruby_status(["-E#{encoding}"], create_file_program, nil, :chdir=>dir)
+ assert_include(ents, filename)
+ EOS
- test_file_program = %Q[
+ assert_separately(%w[-EASCII-8BIT], <<-EOS, :chdir=>dir)
filename = #{code}.chr('UTF-8').force_encoding("ASCII-8BIT")
opts = {:encoding => Encoding.default_external} if /mswin|mingw/ =~ RUBY_PLATFORM
ents = Dir.entries(".", opts)
expected_filename = #{code}.chr('UTF-8').encode(Encoding.find("filesystem")) rescue expected_filename = "?"
expected_filename = expected_filename.force_encoding("ASCII-8BIT")
- result = ents.include?(filename) || (/mswin|mingw/ =~ RUBY_PLATFORM && ents.include?(expected_filename))
- if !result && /mswin|mingw/ =~ RUBY_PLATFORM
- exit Dir.entries(".", {:encoding => Encoding.find("filesystem")}).include?(expected_filename)
+ if /mswin|mingw/ =~ RUBY_PLATFORM
+ case
+ when ents.include?(filename)
+ when ents.include?(expected_filename)
+ filename = expected_filename
+ else
+ ents = Dir.entries(".", {:encoding => Encoding.find("filesystem")})
+ filename = expected_filename
+ end
end
- exit result
- ]
- assert_ruby_status(%w[-EASCII-8BIT], test_file_program, nil, :chdir=>dir)
+ assert_include(ents, filename)
+ EOS
}
end
@@ -42,69 +46,67 @@ class TestDir_M17N < Test::Unit::TestCase
def test_filename_extutf8
with_tmpdir {|d|
- assert_ruby_status(%w[-EUTF-8], <<-'EOS', nil, :chdir=>d)
+ assert_separately(%w[-EUTF-8], <<-'EOS', :chdir=>d)
filename = "\u3042"
File.open(filename, "w") {}
opts = {:encoding => Encoding.default_external} if /mswin|mingw/ =~ RUBY_PLATFORM
ents = Dir.entries(".", opts)
- exit ents.include?(filename)
+ assert_include(ents, filename)
EOS
}
end
def test_filename_extutf8_invalid
with_tmpdir {|d|
- assert_ruby_status(%w[-EASCII-8BIT], <<-'EOS', nil, :chdir=>d)
+ assert_separately(%w[-EASCII-8BIT], <<-'EOS', :chdir=>d)
filename = "\xff".force_encoding("ASCII-8BIT") # invalid byte sequence as UTF-8
File.open(filename, "w") {}
opts = {:encoding => Encoding.default_external} if /mswin|mingw/ =~ RUBY_PLATFORM
ents = Dir.entries(".", opts)
- exit ents.include?(filename) || (/darwin/ =~ RUBY_PLATFORM && ents.include?("%FF"))
+ filename = "%FF" if /darwin/ =~ RUBY_PLATFORM && ents.include?("%FF")
+ assert_include(ents, filename)
EOS
- assert_ruby_status(%w[-EUTF-8], <<-'EOS', nil, :chdir=>d)
+ assert_separately(%w[-EUTF-8], <<-'EOS', :chdir=>d)
filename = "\xff".force_encoding("UTF-8") # invalid byte sequence as UTF-8
File.open(filename, "w") {}
opts = {:encoding => Encoding.default_external} if /mswin|mingw/ =~ RUBY_PLATFORM
ents = Dir.entries(".", opts)
- exit ents.include?(filename) || (/darwin/ =~ RUBY_PLATFORM && ents.include?("%FF"))
+ filename = "%FF" if /darwin/ =~ RUBY_PLATFORM && ents.include?("%FF")
+ assert_include(ents, filename)
EOS
}
end unless /mswin|mingw/ =~ RUBY_PLATFORM
def test_filename_as_bytes_extutf8
with_tmpdir {|d|
- assert_ruby_status(%w[-EUTF-8], <<-'EOS', nil, :chdir=>d)
+ assert_separately(%w[-EUTF-8], <<-'EOS', :chdir=>d)
filename = "\xc2\xa1".force_encoding("utf-8")
File.open(filename, "w") {}
opts = {:encoding => Encoding.default_external} if /mswin|mingw/ =~ RUBY_PLATFORM
ents = Dir.entries(".", opts)
- exit ents.include?(filename)
+ assert_include(ents, filename)
EOS
- assert_ruby_status(%w[-EUTF-8], <<-'EOS', nil, :chdir=>d)
- if /mswin|mingw/ =~ RUBY_PLATFORM
+ assert_separately(%w[-EUTF-8], <<-'EOS', :chdir=>d)
+ if /mswin|mingw|darwin/ =~ RUBY_PLATFORM
filename = "\x8f\xa2\xc2".force_encoding("euc-jp")
else
filename = "\xc2\xa1".force_encoding("euc-jp")
end
- begin
+ assert_nothing_raised(Errno::ENOENT) do
open(filename) {}
- exit true
- rescue Errno::ENOENT
- exit false
end
EOS
# no meaning test on windows
- unless /mswin|mingw/ =~ RUBY_PLATFORM
- assert_ruby_status(%w[-EUTF-8], <<-'EOS', nil, :chdir=>d)
+ unless /mswin|mingw|darwin/ =~ RUBY_PLATFORM
+ assert_separately(%W[-EUTF-8], <<-'EOS', :chdir=>d)
filename1 = "\xc2\xa1".force_encoding("utf-8")
filename2 = "\xc2\xa1".force_encoding("euc-jp")
filename3 = filename1.encode("euc-jp")
filename4 = filename2.encode("utf-8")
- s1 = File.stat(filename1) rescue nil
- s2 = File.stat(filename2) rescue nil
- s3 = File.stat(filename3) rescue nil
- s4 = File.stat(filename4) rescue nil
- exit((s1 && s2 && !s3 && !s4) ? true : false)
+ assert_file.stat(filename1)
+ assert_file.stat(filename2)
+ assert_file.not_exist?(filename3)
+ assert_file.not_exist?(filename4)
EOS
end
}
@@ -114,26 +116,23 @@ class TestDir_M17N < Test::Unit::TestCase
def test_filename_extutf8_inteucjp_representable
with_tmpdir {|d|
- assert_ruby_status(%w[-EUTF-8], <<-'EOS', nil, :chdir=>d)
+ assert_separately(%w[-EUTF-8], <<-'EOS', :chdir=>d)
filename = "\u3042"
File.open(filename, "w") {}
opts = {:encoding => Encoding.default_external} if /mswin|mingw/ =~ RUBY_PLATFORM
ents = Dir.entries(".", opts)
- exit ents.include?(filename)
+ assert_include(ents, filename)
EOS
- assert_ruby_status(%w[-EUTF-8:EUC-JP], <<-'EOS', nil, :chdir=>d)
+ assert_separately(%w[-EUTF-8:EUC-JP], <<-'EOS', :chdir=>d)
filename = "\xA4\xA2".force_encoding("euc-jp")
opts = {:encoding => Encoding.default_external} if /mswin|mingw/ =~ RUBY_PLATFORM
ents = Dir.entries(".", opts)
- exit ents.include?(filename)
+ assert_include(ents, filename)
EOS
- assert_ruby_status(%w[-EUTF-8:EUC-JP], <<-'EOS', nil, :chdir=>d)
+ assert_separately(%w[-EUTF-8:EUC-JP], <<-'EOS', :chdir=>d)
filename = "\xA4\xA2".force_encoding("euc-jp")
- begin
+ assert_nothing_raised(Errno::ENOENT) do
open(filename) {}
- exit true
- rescue Errno::ENOENT
- exit false
end
EOS
}
@@ -141,30 +140,31 @@ class TestDir_M17N < Test::Unit::TestCase
def test_filename_extutf8_inteucjp_unrepresentable
with_tmpdir {|d|
- assert_ruby_status(%w[-EUTF-8], <<-'EOS', nil, :chdir=>d)
+ assert_separately(%w[-EUTF-8], <<-'EOS', :chdir=>d)
filename1 = "\u2661" # WHITE HEART SUIT which is not representable in EUC-JP
filename2 = "\u3042" # HIRAGANA LETTER A which is representable in EUC-JP
File.open(filename1, "w") {}
File.open(filename2, "w") {}
opts = {:encoding => Encoding.default_external} if /mswin|mingw/ =~ RUBY_PLATFORM
ents = Dir.entries(".", opts)
- exit ents.include?(filename1) && ents.include?(filename2)
+ assert_include(ents, filename1)
+ assert_include(ents, filename2)
EOS
- assert_ruby_status(%w[-EUTF-8:EUC-JP], <<-'EOS', nil, :chdir=>d)
+ assert_separately(%w[-EUTF-8:EUC-JP], <<-'EOS', :chdir=>d)
filename1 = "\u2661" # WHITE HEART SUIT which is not representable in EUC-JP
filename2 = "\xA4\xA2".force_encoding("euc-jp") # HIRAGANA LETTER A in EUC-JP
opts = {:encoding => Encoding.default_external} if /mswin|mingw/ =~ RUBY_PLATFORM
ents = Dir.entries(".", opts)
- exit ents.include?(filename1) && ents.include?(filename2)
+ assert_include(ents, filename1)
+ assert_include(ents, filename2)
EOS
- assert_ruby_status(%w[-EUTF-8:EUC-JP], <<-'EOS', nil, :chdir=>d)
+ assert_separately(%w[-EUTF-8:EUC-JP], <<-'EOS', :chdir=>d)
filename1 = "\u2661" # WHITE HEART SUIT which is not representable in EUC-JP
filename2 = "\u3042" # HIRAGANA LETTER A which is representable in EUC-JP
filename3 = "\xA4\xA2".force_encoding("euc-jp") # HIRAGANA LETTER A in EUC-JP
- s1 = File.stat(filename1) rescue nil
- s2 = File.stat(filename2) rescue nil
- s3 = File.stat(filename3) rescue nil
- exit((s1 && s2 && s3) ? true : false)
+ assert_file.stat(filename1)
+ assert_file.stat(filename2)
+ assert_file.stat(filename3)
EOS
}
end
@@ -173,39 +173,49 @@ class TestDir_M17N < Test::Unit::TestCase
def test_filename_bytes_euc_jp
with_tmpdir {|d|
- assert_ruby_status(%w[-EEUC-JP], <<-'EOS', nil, :chdir=>d)
+ assert_separately(%w[-EEUC-JP], <<-'EOS', :chdir=>d)
filename = "\xA4\xA2".force_encoding("euc-jp")
File.open(filename, "w") {}
opts = {:encoding => Encoding.default_external} if /mswin|mingw/ =~ RUBY_PLATFORM
ents = Dir.entries(".", opts)
ents.each {|e| e.force_encoding("ASCII-8BIT") }
- exit ents.include?(filename.force_encoding("ASCII-8BIT")) ||
- (/darwin/ =~ RUBY_PLATFORM && ents.include?("%A4%A2".force_encoding("ASCII-8BIT")))
+ if /darwin/ =~ RUBY_PLATFORM
+ filename = filename.encode("utf-8")
+ end
+ assert_include(ents, filename.force_encoding("ASCII-8BIT"))
EOS
}
end
def test_filename_euc_jp
with_tmpdir {|d|
- assert_ruby_status(%w[-EEUC-JP], <<-'EOS', nil, :chdir=>d)
+ assert_separately(%w[-EEUC-JP], <<-'EOS', :chdir=>d)
filename = "\xA4\xA2".force_encoding("euc-jp")
File.open(filename, "w") {}
opts = {:encoding => Encoding.default_external} if /mswin|mingw/ =~ RUBY_PLATFORM
ents = Dir.entries(".", opts)
- exit ents.include?(filename) || (/darwin/ =~ RUBY_PLATFORM && ents.include?("%A4%A2".force_encoding("euc-jp")))
+ if /darwin/ =~ RUBY_PLATFORM
+ filename = filename.encode("utf-8").force_encoding("euc-jp")
+ end
+ assert_include(ents, filename)
EOS
- assert_ruby_status(%w[-EASCII-8BIT], <<-'EOS', nil, :chdir=>d)
+ assert_separately(%w[-EASCII-8BIT], <<-'EOS', :chdir=>d)
filename = "\xA4\xA2".force_encoding('ASCII-8BIT')
win_expected_filename = filename.encode(Encoding.find("filesystem"), "euc-jp") rescue "?"
opts = {:encoding => Encoding.default_external} if /mswin|mingw/ =~ RUBY_PLATFORM
ents = Dir.entries(".", opts)
- result = ents.include?(filename) ||
- (/darwin/ =~ RUBY_PLATFORM && ents.include?("%A4%A2".force_encoding("ASCII-8BIT"))) ||
- (/mswin|mingw/ =~ RUBY_PLATFORM && ents.include?(win_expected_filename.force_encoding("ASCII-8BIT")))
- if !result && /mswin|mingw/ =~ RUBY_PLATFORM
- exit Dir.entries(".", {:encoding => Encoding.find("filesystem")}).include?(win_expected_filename)
+ unless ents.include?(filename)
+ case RUBY_PLATFORM
+ when /darwin/
+ filename = filename.encode("utf-8", "euc-jp").b
+ when /mswin|mingw/
+ if ents.include?(win_expected_filename.dup.force_encoding("ASCII-8BIT"))
+ ents = Dir.entries(".", {:encoding => Encoding.find("filesystem")})
+ filename = win_expected_filename
+ end
+ end
end
- exit result
+ assert_include(ents, filename)
EOS
}
end
@@ -224,18 +234,24 @@ class TestDir_M17N < Test::Unit::TestCase
def test_filename_ext_euc_jp_and_int_utf_8
with_tmpdir {|d|
- assert_ruby_status(%w[-EEUC-JP], <<-'EOS', nil, :chdir=>d)
+ assert_separately(%w[-EEUC-JP], <<-'EOS', :chdir=>d)
filename = "\xA4\xA2".force_encoding("euc-jp")
File.open(filename, "w") {}
opts = {:encoding => Encoding.default_external} if /mswin|mingw/ =~ RUBY_PLATFORM
ents = Dir.entries(".", opts)
- exit ents.include?(filename) || (/darwin/ =~ RUBY_PLATFORM && ents.include?("%A4%A2".force_encoding("euc-jp")))
+ if /darwin/ =~ RUBY_PLATFORM
+ filename = filename.encode("utf-8", "euc-jp").force_encoding("euc-jp")
+ end
+ assert_include(ents, filename)
EOS
- assert_ruby_status(%w[-EEUC-JP:UTF-8], <<-'EOS', nil, :chdir=>d)
+ assert_separately(%w[-EEUC-JP:UTF-8], <<-'EOS', :chdir=>d)
filename = "\u3042"
opts = {:encoding => Encoding.default_external} if /mswin|mingw/ =~ RUBY_PLATFORM
ents = Dir.entries(".", opts)
- exit ents.include?(filename) || (/darwin/ =~ RUBY_PLATFORM && ents.include?("%A4%A2"))
+ if /darwin/ =~ RUBY_PLATFORM
+ filename = filename.force_encoding("euc-jp")
+ end
+ assert_include(ents, filename)
EOS
}
end
@@ -262,4 +278,54 @@ class TestDir_M17N < Test::Unit::TestCase
}
assert_equal(paths.map(&:encoding), encs, bug6072)
end
+
+ def test_glob_incompatible
+ d = "\u{3042}\u{3044}".encode("utf-16le")
+ assert_raise(Encoding::CompatibilityError) {Dir.glob(d)}
+ m = Class.new {define_method(:to_path) {d}}
+ assert_raise(Encoding::CompatibilityError) {Dir.glob(m.new)}
+ end
+
+ def test_glob_compose
+ bug7267 = '[ruby-core:48745] [Bug #7267]'
+
+ pp = Object.new.extend(Test::Unit::Assertions)
+ def pp.mu_pp(str) #:nodoc:
+ str.dump
+ end
+
+ with_tmpdir {|d|
+ orig = %W"d\u{e9}tente x\u{304c 304e 3050 3052 3054}"
+ orig.each {|n| open(n, "w") {}}
+ orig.each do |o|
+ n = Dir.glob("#{o[0..0]}*")[0]
+ pp.assert_equal(o, n, bug7267)
+ end
+ }
+ end
+
+ def test_entries_compose
+ bug7267 = '[ruby-core:48745] [Bug #7267]'
+
+ pp = Object.new.extend(Test::Unit::Assertions)
+ def pp.mu_pp(ary) #:nodoc:
+ '[' << ary.map {|str| "#{str.dump}(#{str.encoding})"}.join(', ') << ']'
+ end
+
+ with_tmpdir {|d|
+ orig = %W"d\u{e9}tente x\u{304c 304e 3050 3052 3054}"
+ orig.each {|n| open(n, "w") {}}
+ if /mswin|mingw/ =~ RUBY_PLATFORM
+ opts = {:encoding => Encoding.default_external}
+ orig.map! {|o| o.encode(Encoding.find("filesystem")) rescue o.tr("^a-z", "?")}
+ else
+ enc = Encoding.find("filesystem")
+ enc = Encoding::ASCII_8BIT if enc == Encoding::US_ASCII
+ orig.each {|o| o.force_encoding(enc) }
+ end
+ ents = Dir.entries(".", opts).reject {|n| /\A\./ =~ n}
+ ents.sort!
+ pp.assert_equal(orig, ents, bug7267)
+ }
+ end
end
diff --git a/test/ruby/test_econv.rb b/test/ruby/test_econv.rb
index f667d733a0..72a5af5334 100644
--- a/test/ruby/test_econv.rb
+++ b/test/ruby/test_econv.rb
@@ -1,5 +1,5 @@
require 'test/unit'
-require 'envutil'
+require_relative 'envutil'
class TestEncodingConverter < Test::Unit::TestCase
def check_ec(edst, esrc, eres, dst, src, ec, off, len, opts=nil)
@@ -44,9 +44,9 @@ class TestEncodingConverter < Test::Unit::TestCase
def test_asciicompat_encoding_iso2022jp
acenc = Encoding::Converter.asciicompat_encoding("ISO-2022-JP")
- str = "\e$B~~\(B".force_encoding("iso-2022-jp")
+ str = "\e$B~~\e(B".force_encoding("iso-2022-jp")
str2 = str.encode(acenc)
- str3 = str.encode("ISO-2022-JP")
+ str3 = str2.encode("ISO-2022-JP")
assert_equal(str, str3)
end
@@ -147,7 +147,7 @@ class TestEncodingConverter < Test::Unit::TestCase
def test_nil_source_buffer
ec = Encoding::Converter.new("UTF-8", "EUC-JP")
- ret = ec.primitive_convert(nil, dst="", nil, 10)
+ ret = ec.primitive_convert(nil, "", nil, 10)
assert_equal(:finished, ret)
end
@@ -475,44 +475,44 @@ class TestEncodingConverter < Test::Unit::TestCase
def test_errinfo_invalid_euc_jp
ec = Encoding::Converter.new("EUC-JP", "Shift_JIS")
- ec.primitive_convert(src="\xff", dst="", nil, 10)
+ ec.primitive_convert("\xff", "", nil, 10)
assert_errinfo(:invalid_byte_sequence, "EUC-JP", "Shift_JIS", "\xFF", "", ec)
end
def test_errinfo_invalid_euc_jp2
ec = Encoding::Converter.new("EUC-JP", "ISO-8859-1")
- ec.primitive_convert(src="\xff", dst="", nil, 10)
+ ec.primitive_convert("\xff", "", nil, 10)
assert_errinfo(:invalid_byte_sequence, "EUC-JP", "UTF-8", "\xFF", "", ec)
end
def test_errinfo_undefined_hiragana
ec = Encoding::Converter.new("EUC-JP", "ISO-8859-1")
- ec.primitive_convert(src="\xa4\xa2", dst="", nil, 10)
+ ec.primitive_convert("\xa4\xa2", "", nil, 10)
assert_errinfo(:undefined_conversion, "UTF-8", "ISO-8859-1", "\xE3\x81\x82", "", ec)
end
def test_errinfo_invalid_partial_character
ec = Encoding::Converter.new("EUC-JP", "ISO-8859-1")
- ec.primitive_convert(src="\xa4", dst="", nil, 10)
+ ec.primitive_convert("\xa4", "", nil, 10)
assert_errinfo(:incomplete_input, "EUC-JP", "UTF-8", "\xA4", "", ec)
end
def test_errinfo_valid_partial_character
ec = Encoding::Converter.new("EUC-JP", "ISO-8859-1")
- ec.primitive_convert(src="\xa4", dst="", nil, 10, :partial_input=>true)
+ ec.primitive_convert("\xa4", "", nil, 10, :partial_input=>true)
assert_errinfo(:source_buffer_empty, nil, nil, nil, nil, ec)
end
def test_errinfo_invalid_utf16be
ec = Encoding::Converter.new("UTF-16BE", "UTF-8")
- ec.primitive_convert(src="\xd8\x00\x00@", dst="", nil, 10)
+ ec.primitive_convert(src="\xd8\x00\x00@", "", nil, 10)
assert_errinfo(:invalid_byte_sequence, "UTF-16BE", "UTF-8", "\xD8\x00", "\x00", ec)
assert_equal("@", src)
end
def test_errinfo_invalid_utf16le
ec = Encoding::Converter.new("UTF-16LE", "UTF-8")
- ec.primitive_convert(src="\x00\xd8@\x00", dst="", nil, 10)
+ ec.primitive_convert(src="\x00\xd8@\x00", "", nil, 10)
assert_errinfo(:invalid_byte_sequence, "UTF-16LE", "UTF-8", "\x00\xD8", "@\x00", ec)
assert_equal("", src)
end
@@ -599,7 +599,7 @@ class TestEncodingConverter < Test::Unit::TestCase
def test_putback2
ec = Encoding::Converter.new("utf-16le", "euc-jp")
- ret = ec.primitive_convert(src="\x00\xd8\x21\x00", dst="", nil, nil)
+ ret = ec.primitive_convert("\x00\xd8\x21\x00", "", nil, nil)
assert_equal(:invalid_byte_sequence, ret)
assert_equal("\x00".force_encoding("utf-16le"), ec.putback(1))
assert_equal("\x21".force_encoding("utf-16le"), ec.putback(1))
@@ -705,20 +705,20 @@ class TestEncodingConverter < Test::Unit::TestCase
def test_last_error1
ec = Encoding::Converter.new("sjis", "euc-jp")
assert_equal(nil, ec.last_error)
- assert_equal(:incomplete_input, ec.primitive_convert(src="fo\x81", dst="", nil, nil))
+ assert_equal(:incomplete_input, ec.primitive_convert("fo\x81", "", nil, nil))
assert_kind_of(Encoding::InvalidByteSequenceError, ec.last_error)
end
def test_last_error2
ec = Encoding::Converter.new("sjis", "euc-jp")
- assert_equal("fo", ec.convert(src="fo\x81"))
+ assert_equal("fo", ec.convert("fo\x81"))
assert_raise(Encoding::InvalidByteSequenceError) { ec.finish }
assert_kind_of(Encoding::InvalidByteSequenceError, ec.last_error)
end
def test_us_ascii
ec = Encoding::Converter.new("UTF-8", "US-ASCII")
- ec.primitive_convert(src="\u{3042}", dst="")
+ ec.primitive_convert("\u{3042}", "")
err = ec.last_error
assert_kind_of(Encoding::UndefinedConversionError, err)
assert_equal("\u{3042}", err.error_char)
@@ -726,7 +726,7 @@ class TestEncodingConverter < Test::Unit::TestCase
def test_88591
ec = Encoding::Converter.new("UTF-8", "ISO-8859-1")
- ec.primitive_convert(src="\u{3042}", dst="")
+ ec.primitive_convert("\u{3042}", "")
err = ec.last_error
assert_kind_of(Encoding::UndefinedConversionError, err)
assert_equal("\u{3042}", err.error_char)
@@ -911,21 +911,14 @@ class TestEncodingConverter < Test::Unit::TestCase
end
def test_default_external
- cmd = <<EOS
+ Encoding.list.grep(->(enc) {/\AISO-8859-\d+\z/i =~ enc.name}) do |enc|
+ assert_separately(%W[--disable=gems -d - #{enc.name}], <<-EOS, ignore_stderr: true)
Encoding.default_external = ext = ARGV[0]
Encoding.default_internal = int ='utf-8'
- begin
+ assert_nothing_raised do
Encoding::Converter.new(ext, int)
- ensure
- Marshal.dump($!, STDOUT)
- STDOUT.flush
end
-EOS
- Encoding.list.grep(->(enc) {/^ISO-8859-\d(?:[0-5])?\z/i =~ enc.name}) do |enc|
- error = IO.popen([EnvUtil.rubybin, "-e", cmd, enc.name]) do |child|
- Marshal.load(child)
- end
- assert_nil(error)
+ EOS
end
end
end
diff --git a/test/ruby/test_encoding.rb b/test/ruby/test_encoding.rb
index ef2dc39c4d..0a5a9ce197 100644
--- a/test/ruby/test_encoding.rb
+++ b/test/ruby/test_encoding.rb
@@ -100,11 +100,6 @@ class TestEncoding < Test::Unit::TestCase
assert_equal(str, str2, '[ruby-dev:38596]')
end
- def test_unsafe
- bug5279 = '[ruby-dev:44469]'
- assert_ruby_status([], '$SAFE=4; "a".encode("utf-16be")', bug5279)
- end
-
def test_compatible_p
ua = "abc".force_encoding(Encoding::UTF_8)
assert_equal(Encoding::UTF_8, Encoding.compatible?(ua, :abc))
@@ -113,4 +108,13 @@ class TestEncoding < Test::Unit::TestCase
asc = "b".force_encoding(Encoding::US_ASCII)
assert_equal(Encoding::ASCII_8BIT, Encoding.compatible?(bin, asc))
end
+
+ def test_errinfo_after_autoload
+ bug9038 = '[ruby-core:57949] [Bug #9038]'
+ assert_separately(%w[--disable=gems], <<-"end;")
+ assert_raise_with_message(SyntaxError, /unknown regexp option - Q/, #{bug9038.dump}) {
+ eval("/regexp/sQ")
+ }
+ end;
+ end
end
diff --git a/test/ruby/test_enum.rb b/test/ruby/test_enum.rb
index d5353f680c..b86ae274d1 100644
--- a/test/ruby/test_enum.rb
+++ b/test/ruby/test_enum.rb
@@ -1,5 +1,6 @@
require 'test/unit'
require 'continuation'
+require 'stringio'
class TestEnumerable < Test::Unit::TestCase
def setup
@@ -12,6 +13,16 @@ class TestEnumerable < Test::Unit::TestCase
yield 3
yield 1
yield 2
+ self
+ end
+ end
+ @empty = Object.new
+ class << @empty
+ attr_reader :block
+ include Enumerable
+ def each(&block)
+ @block = block
+ self
end
end
@verbose = $VERBOSE
@@ -22,11 +33,29 @@ class TestEnumerable < Test::Unit::TestCase
$VERBOSE = @verbose
end
+ def assert_not_warn
+ begin
+ org_stderr = $stderr
+ v = $VERBOSE
+ $stderr = StringIO.new(warn = '')
+ $VERBOSE = true
+ yield
+ ensure
+ $stderr = org_stderr
+ $VERBOSE = v
+ end
+ assert_equal("", warn)
+ end
+
def test_grep
assert_equal([1, 2, 1, 2], @obj.grep(1..2))
a = []
@obj.grep(2) {|x| a << x }
assert_equal([2, 2], a)
+
+ bug5801 = '[ruby-dev:45041]'
+ @empty.grep(//)
+ assert_nothing_raised(bug5801) {100.times {@empty.block.call}}
end
def test_count
@@ -74,6 +103,33 @@ class TestEnumerable < Test::Unit::TestCase
assert_equal([1, 2, 3, 1, 2], @obj.to_a)
end
+ def test_to_h
+ assert_equal({}, @obj.to_h)
+ obj = Object.new
+ def obj.each(*args)
+ yield args
+ yield [:key, :value]
+ yield [:ignore_me]
+ yield [:ignore, :me, :too]
+ yield :other_key, :other_value
+ yield :ignore_me
+ yield :ignore, :me, :too
+ yield
+ kvp = Object.new
+ def kvp.to_ary
+ [:obtained, :via_to_ary]
+ end
+ yield kvp
+ end
+ obj.extend Enumerable
+ assert_equal({
+ :hello => :world,
+ :key => :value,
+ :other_key => :other_value,
+ :obtained => :via_to_ary,
+ }, obj.to_h(:hello, :world))
+ end
+
def test_inject
assert_equal(12, @obj.inject {|z, x| z * x })
assert_equal(48, @obj.inject {|z, x| z * 2 + x })
@@ -94,6 +150,7 @@ class TestEnumerable < Test::Unit::TestCase
def test_first
assert_equal(1, @obj.first)
assert_equal([1, 2, 3], @obj.first(3))
+ assert_nil(@empty.first)
end
def test_sort
@@ -247,7 +304,7 @@ class TestEnumerable < Test::Unit::TestCase
ary = Object.new
def ary.to_a; [1, 2]; end
- assert_raise(NoMethodError){ %w(a b).zip(ary) }
+ assert_raise(TypeError) {%w(a b).zip(ary)}
def ary.each; [3, 4].each{|e|yield e}; end
assert_equal([[1, 3], [2, 4], [3, nil], [1, nil], [2, nil]], @obj.zip(ary))
def ary.to_ary; [5, 6]; end
@@ -260,6 +317,10 @@ class TestEnumerable < Test::Unit::TestCase
def test_take_while
assert_equal([1,2], @obj.take_while {|x| x <= 2})
+
+ bug5801 = '[ruby-dev:45040]'
+ @empty.take_while {true}
+ assert_nothing_raised(bug5801) {100.times {@empty.block.call}}
end
def test_drop
@@ -383,6 +444,7 @@ class TestEnumerable < Test::Unit::TestCase
ss = %w[abc defg h ijk l mno pqr st u vw xy z]
assert_equal([%w[abc defg h], %w[ijk l], %w[mno], %w[pqr st u vw xy z]],
ss.slice_before(/\A...\z/).to_a)
+ assert_not_warn{ss.slice_before(/\A...\z/).to_a}
end
end
diff --git a/test/ruby/test_enumerator.rb b/test/ruby/test_enumerator.rb
index 10ba2f184e..e1b23792bd 100644
--- a/test/ruby/test_enumerator.rb
+++ b/test/ruby/test_enumerator.rb
@@ -1,4 +1,5 @@
require 'test/unit'
+require_relative 'envutil'
class TestEnumerator < Test::Unit::TestCase
def setup
@@ -9,10 +10,13 @@ class TestEnumerator < Test::Unit::TestCase
a.each {|x| yield x }
end
end
+ @sized = @obj.clone
+ def @sized.size
+ 42
+ end
end
def enum_test obj
- i = 0
obj.map{|e|
e
}.sort
@@ -57,9 +61,22 @@ class TestEnumerator < Test::Unit::TestCase
def test_initialize
assert_equal([1, 2, 3], @obj.to_enum(:foo, 1, 2, 3).to_a)
- assert_equal([1, 2, 3], Enumerator.new(@obj, :foo, 1, 2, 3).to_a)
+ _, err = capture_io do
+ assert_equal([1, 2, 3], Enumerator.new(@obj, :foo, 1, 2, 3).to_a)
+ end
+ assert_match 'Enumerator.new without a block is deprecated', err
assert_equal([1, 2, 3], Enumerator.new { |y| i = 0; loop { y << (i += 1) } }.take(3))
assert_raise(ArgumentError) { Enumerator.new }
+
+ enum = @obj.to_enum
+ assert_raise(NoMethodError) { enum.each {} }
+ enum.freeze
+ assert_raise(RuntimeError) {
+ capture_io do
+ # warning: Enumerator.new without a block is deprecated; use Object#to_enum
+ enum.__send__(:initialize, @obj, :foo)
+ end
+ }
end
def test_initialize_copy
@@ -97,6 +114,26 @@ class TestEnumerator < Test::Unit::TestCase
assert_equal([[1,5],[2,6],[3,7]], @obj.to_enum(:foo, 1, 2, 3).with_index(5).to_a)
end
+ def test_with_index_large_offset
+ bug8010 = '[ruby-dev:47131] [Bug #8010]'
+ s = 1 << (8*1.size-2)
+ assert_equal([[1,s],[2,s+1],[3,s+2]], @obj.to_enum(:foo, 1, 2, 3).with_index(s).to_a, bug8010)
+ s <<= 1
+ assert_equal([[1,s],[2,s+1],[3,s+2]], @obj.to_enum(:foo, 1, 2, 3).with_index(s).to_a, bug8010)
+ end
+
+ def test_with_index_nonnum_offset
+ bug8010 = '[ruby-dev:47131] [Bug #8010]'
+ s = Object.new
+ def s.to_int; 1 end
+ assert_equal([[1,1],[2,2],[3,3]], @obj.to_enum(:foo, 1, 2, 3).with_index(s).to_a, bug8010)
+ end
+
+ def test_with_index_string_offset
+ bug8010 = '[ruby-dev:47131] [Bug #8010]'
+ assert_raise(TypeError, bug8010){ @obj.to_enum(:foo, 1, 2, 3).with_index('1').to_a }
+ end
+
def test_with_object
obj = [0, 1]
ret = (1..10).each.with_object(obj) {|i, memo|
@@ -238,6 +275,18 @@ class TestEnumerator < Test::Unit::TestCase
assert_equal([1,2], e.next_values)
end
+ def test_each_arg
+ o = Object.new
+ def o.each(ary)
+ ary << 1
+ yield
+ end
+ ary = []
+ e = o.to_enum.each(ary)
+ e.next
+ assert_equal([1], ary)
+ end
+
def test_feed
o = Object.new
def o.each(ary)
@@ -336,7 +385,7 @@ class TestEnumerator < Test::Unit::TestCase
e = (0..10).each_cons(2)
assert_equal("#<Enumerator: 0..10:each_cons(2)>", e.inspect)
- e = Enumerator.new {|y| x = y.yield; 10 }
+ e = Enumerator.new {|y| y.yield; 10 }
assert_match(/\A#<Enumerator: .*:each>/, e.inspect)
a = []
@@ -346,6 +395,20 @@ class TestEnumerator < Test::Unit::TestCase
e.inspect)
end
+ def test_inspect_verbose
+ bug6214 = '[ruby-dev:45449]'
+ assert_warning("", bug6214) { "".bytes.inspect }
+ assert_warning("", bug6214) { [].lazy.inspect }
+ end
+
+ def test_inspect_encoding
+ c = Class.new{define_method("\u{3042}"){}}
+ e = c.new.enum_for("\u{3042}")
+ s = assert_nothing_raised(Encoding::CompatibilityError) {break e.inspect}
+ assert_equal(Encoding::UTF_8, s.encoding)
+ assert_match(/\A#<Enumerator: .*:\u{3042}>\z/, s)
+ end
+
def test_generator
# note: Enumerator::Generator is a class just for internal
g = Enumerator::Generator.new {|y| y << 1 << 2 << 3; :foo }
@@ -356,6 +419,18 @@ class TestEnumerator < Test::Unit::TestCase
a = []
assert_equal(:foo, g2.each {|x| a << x })
assert_equal([1, 2, 3], a)
+
+ g.freeze
+ assert_raise(RuntimeError) {
+ g.__send__ :initialize, proc { |y| y << 4 << 5 }
+ }
+ end
+
+ def test_generator_args
+ g = Enumerator::Generator.new {|y, x| y << 1 << 2 << 3; x }
+ a = []
+ assert_equal(:bar, g.each(:bar) {|x| a << x })
+ assert_equal([1, 2, 3], a)
end
def test_yielder
@@ -373,5 +448,159 @@ class TestEnumerator < Test::Unit::TestCase
assert_raise(LocalJumpError) { Enumerator::Yielder.new }
end
+
+ def test_size
+ assert_equal nil, Enumerator.new{}.size
+ assert_equal 42, Enumerator.new(->{42}){}.size
+ obj = Object.new
+ def obj.call; 42; end
+ assert_equal 42, Enumerator.new(obj){}.size
+ assert_equal 42, Enumerator.new(42){}.size
+ assert_equal 1 << 70, Enumerator.new(1 << 70){}.size
+ assert_equal Float::INFINITY, Enumerator.new(Float::INFINITY){}.size
+ assert_equal nil, Enumerator.new(nil){}.size
+ assert_raise(TypeError) { Enumerator.new("42"){} }
+
+ assert_equal nil, @obj.to_enum(:foo, 0, 1).size
+ assert_equal 2, @obj.to_enum(:foo, 0, 1){ 2 }.size
+ end
+
+ def test_size_for_enum_created_by_enumerators
+ enum = to_enum{ 42 }
+ assert_equal 42, enum.with_index.size
+ assert_equal 42, enum.with_object(:foo).size
+ end
+
+ def test_size_for_enum_created_from_array
+ arr = %w[hello world]
+ %i[each each_with_index reverse_each sort_by! sort_by map map!
+ keep_if reject! reject select! select delete_if].each do |method|
+ assert_equal arr.size, arr.send(method).size
+ end
+ end
+
+ def test_size_for_enum_created_from_enumerable
+ %i[find_all reject map flat_map partition group_by sort_by min_by max_by
+ minmax_by each_with_index reverse_each each_entry].each do |method|
+ assert_equal nil, @obj.send(method).size
+ assert_equal 42, @sized.send(method).size
+ end
+ assert_equal nil, @obj.each_with_object(nil).size
+ assert_equal 42, @sized.each_with_object(nil).size
+ end
+
+ def test_size_for_enum_created_from_hash
+ h = {a: 1, b: 2, c: 3}
+ %i[delete_if reject! select select! keep_if each each_key each_pair].each do |method|
+ assert_equal 3, h.send(method).size
+ end
+ end
+
+ def test_size_for_enum_created_from_env
+ %i[each_pair reject! delete_if select select! keep_if].each do |method|
+ assert_equal ENV.size, ENV.send(method).size
+ end
+ end
+
+ def test_size_for_enum_created_from_struct
+ s = Struct.new(:foo, :bar, :baz).new(1, 2)
+ %i[each each_pair select].each do |method|
+ assert_equal 3, s.send(method).size
+ end
+ end
+
+ def check_consistency_for_combinatorics(method)
+ [ [], [:a, :b, :c, :d, :e] ].product([-2, 0, 2, 5, 6]) do |array, arg|
+ assert_equal array.send(method, arg).to_a.size, array.send(method, arg).size,
+ "inconsistent size for #{array}.#{method}(#{arg})"
+ end
+ end
+
+ def test_size_for_array_combinatorics
+ check_consistency_for_combinatorics(:permutation)
+ assert_equal 24, [0, 1, 2, 4].permutation.size
+ assert_equal 2933197128679486453788761052665610240000000,
+ (1..42).to_a.permutation(30).size # 1.upto(42).inject(:*) / 1.upto(12).inject(:*)
+
+ check_consistency_for_combinatorics(:combination)
+ assert_equal 28258808871162574166368460400,
+ (1..100).to_a.combination(42).size
+ # 1.upto(100).inject(:*) / 1.upto(42).inject(:*) / 1.upto(58).inject(:*)
+
+ check_consistency_for_combinatorics(:repeated_permutation)
+ assert_equal 291733167875766667063796853374976,
+ (1..42).to_a.repeated_permutation(20).size # 42 ** 20
+
+ check_consistency_for_combinatorics(:repeated_combination)
+ assert_equal 28258808871162574166368460400,
+ (1..59).to_a.repeated_combination(42).size
+ # 1.upto(100).inject(:*) / 1.upto(42).inject(:*) / 1.upto(58).inject(:*)
+ end
+
+ def test_size_for_cycle
+ assert_equal Float::INFINITY, [:foo].cycle.size
+ assert_equal 10, [:foo, :bar].cycle(5).size
+ assert_equal 0, [:foo, :bar].cycle(-10).size
+ assert_equal 0, [].cycle.size
+ assert_equal 0, [].cycle(5).size
+
+ assert_equal nil, @obj.cycle.size
+ assert_equal nil, @obj.cycle(5).size
+ assert_equal Float::INFINITY, @sized.cycle.size
+ assert_equal 126, @sized.cycle(3).size
+ end
+
+ def test_size_for_loops
+ assert_equal Float::INFINITY, loop.size
+ assert_equal 42, 42.times.size
+ end
+
+ def test_size_for_each_slice
+ assert_equal nil, @obj.each_slice(3).size
+ assert_equal 6, @sized.each_slice(7).size
+ assert_equal 5, @sized.each_slice(10).size
+ assert_equal 1, @sized.each_slice(70).size
+ assert_raise(ArgumentError){ @obj.each_slice(0).size }
+ end
+
+ def test_size_for_each_cons
+ assert_equal nil, @obj.each_cons(3).size
+ assert_equal 33, @sized.each_cons(10).size
+ assert_equal 0, @sized.each_cons(70).size
+ assert_raise(ArgumentError){ @obj.each_cons(0).size }
+ end
+
+ def test_size_for_step
+ assert_equal 42, 5.step(46).size
+ assert_equal 4, 1.step(10, 3).size
+ assert_equal 3, 1.step(9, 3).size
+ assert_equal 0, 1.step(-11).size
+ assert_equal 0, 1.step(-11, 2).size
+ assert_equal 7, 1.step(-11, -2).size
+ assert_equal 7, 1.step(-11.1, -2).size
+ assert_equal 0, 42.step(Float::INFINITY, -2).size
+ assert_equal 1, 42.step(55, Float::INFINITY).size
+ assert_equal 1, 42.step(Float::INFINITY, Float::INFINITY).size
+ assert_equal 14, 0.1.step(4.2, 0.3).size
+ assert_equal Float::INFINITY, 42.step(Float::INFINITY, 2).size
+
+ assert_equal 10, (1..10).step.size
+ assert_equal 4, (1..10).step(3).size
+ assert_equal 3, (1...10).step(3).size
+ assert_equal Float::INFINITY, (42..Float::INFINITY).step(2).size
+ assert_raise(ArgumentError){ (1..10).step(-2).size }
+ end
+
+ def test_size_for_downup_to
+ assert_equal 0, 1.upto(-100).size
+ assert_equal 102, 1.downto(-100).size
+ assert_equal Float::INFINITY, 42.upto(Float::INFINITY).size
+ end
+
+ def test_size_for_string
+ assert_equal 5, 'hello'.each_byte.size
+ assert_equal 5, 'hello'.each_char.size
+ assert_equal 5, 'hello'.each_codepoint.size
+ end
end
diff --git a/test/ruby/test_env.rb b/test/ruby/test_env.rb
index 9166f4df6c..17c5d57d25 100644
--- a/test/ruby/test_env.rb
+++ b/test/ruby/test_env.rb
@@ -103,7 +103,10 @@ class TestEnv < Test::Unit::TestCase
ENV["test"] = "foo"
assert_equal("foo", ENV.fetch("test"))
ENV.delete("test")
- assert_raise(KeyError) { ENV.fetch("test") }
+ feature8649 = '[ruby-core:56062] [Feature #8649]'
+ assert_raise_with_message(KeyError, 'key not found: "test"', feature8649) do
+ ENV.fetch("test")
+ end
assert_equal("foo", ENV.fetch("test", "foo"))
assert_equal("bar", ENV.fetch("test") { "bar" })
assert_equal("bar", ENV.fetch("test", "foo") { "bar" })
@@ -114,12 +117,6 @@ class TestEnv < Test::Unit::TestCase
end
def test_aset
- assert_raise(SecurityError) do
- Thread.new do
- $SAFE = 4
- ENV["test"] = "foo"
- end.join
- end
assert_nothing_raised { ENV["test"] = nil }
assert_equal(nil, ENV["test"])
assert_raise(ArgumentError) { ENV["foo\0bar"] = "test" }
@@ -140,8 +137,7 @@ class TestEnv < Test::Unit::TestCase
end
def test_keys
- a = nil
- assert_block { a = ENV.keys }
+ a = ENV.keys
assert_kind_of(Array, a)
a.each {|k| assert_kind_of(String, k) }
end
@@ -151,8 +147,7 @@ class TestEnv < Test::Unit::TestCase
end
def test_values
- a = nil
- assert_block { a = ENV.values }
+ a = ENV.values
assert_kind_of(Array, a)
a.each {|k| assert_kind_of(String, k) }
end
@@ -272,15 +267,15 @@ class TestEnv < Test::Unit::TestCase
def test_empty_p
ENV.clear
- assert(ENV.empty?)
+ assert_predicate(ENV, :empty?)
ENV["test"] = "foo"
- assert(!ENV.empty?)
+ assert_not_predicate(ENV, :empty?)
end
def test_has_key
- assert(!ENV.has_key?("test"))
+ assert_not_send([ENV, :has_key?, "test"])
ENV["test"] = "foo"
- assert(ENV.has_key?("test"))
+ assert_send([ENV, :has_key?, "test"])
assert_raise(ArgumentError) { ENV.has_key?("foo\0bar") }
end
@@ -300,9 +295,9 @@ class TestEnv < Test::Unit::TestCase
def test_has_value2
ENV.clear
- assert(!ENV.has_value?("foo"))
+ assert_not_send([ENV, :has_value?, "foo"])
ENV["test"] = "foo"
- assert(ENV.has_value?("foo"))
+ assert_send([ENV, :has_value?, "foo"])
end
def test_rassoc
@@ -327,6 +322,10 @@ class TestEnv < Test::Unit::TestCase
assert_equal(h, ENV.to_hash)
end
+ def test_to_h
+ assert_equal(ENV.to_hash, ENV.to_h)
+ end
+
def test_reject
h1 = {}
ENV.each_pair {|k, v| h1[k] = v }
@@ -394,13 +393,19 @@ class TestEnv < Test::Unit::TestCase
if /mswin|mingw/ =~ RUBY_PLATFORM
def test_win32_blocksize
- len = 32767 - ENV.to_a.flatten.inject(0) {|r,e| r + e.size + 2 }
+ keys = []
+ len = 32767 - ENV.to_a.flatten.inject(0) {|r,e| r + e.bytesize + 1}
val = "bar" * 1000
key = nil
+ while (len -= val.size + (key="foo#{len}").size + 2) > 0
+ keys << key
+ ENV[key] = val
+ end
1.upto(12) {|i|
- ENV[key] = val while (len -= val.size + (key="foo#{len}").size + 2) > 0
assert_raise(Errno::EINVAL) { ENV[key] = val }
}
+ ensure
+ keys.each {|k| ENV.delete(k)}
end
end
end
diff --git a/test/ruby/test_eval.rb b/test/ruby/test_eval.rb
index 299165fb34..cba9ce42f8 100644
--- a/test/ruby/test_eval.rb
+++ b/test/ruby/test_eval.rb
@@ -127,72 +127,68 @@ class TestEval < Test::Unit::TestCase
}
end
- def forall_TYPE(mid)
- objects = [Object.new, [], nil, true, false, 77, :sym] # TODO: check
+ def forall_TYPE
+ objects = [Object.new, [], nil, true, false] # TODO: check
objects.each do |obj|
obj.instance_variable_set :@ivar, 12
- send mid, obj
+ yield obj
end
end
def test_instance_eval_string_basic
- forall_TYPE :instance_eval_string_basic_i
- end
-
- def instance_eval_string_basic_i(o)
- assert_equal nil, o.instance_eval("nil")
- assert_equal true, o.instance_eval("true")
- assert_equal false, o.instance_eval("false")
- assert_equal o, o.instance_eval("self")
- assert_equal 1, o.instance_eval("1")
- assert_equal :sym, o.instance_eval(":sym")
-
- assert_equal 11, o.instance_eval("11")
- assert_equal 12, o.instance_eval("@ivar")
- assert_equal 13, o.instance_eval("@@cvar")
- assert_equal 14, o.instance_eval("$gvar__eval")
- assert_equal 15, o.instance_eval("Const")
- assert_equal 16, o.instance_eval("7 + 9")
- assert_equal 17, o.instance_eval("17.to_i")
- assert_equal "18", o.instance_eval(%q("18"))
- assert_equal "19", o.instance_eval(%q("1#{9}"))
-
- 1.times {
- assert_equal 12, o.instance_eval("@ivar")
- assert_equal 13, o.instance_eval("@@cvar")
- assert_equal 14, o.instance_eval("$gvar__eval")
- assert_equal 15, o.instance_eval("Const")
- }
+ forall_TYPE do |o|
+ assert_equal nil, o.instance_eval("nil")
+ assert_equal true, o.instance_eval("true")
+ assert_equal false, o.instance_eval("false")
+ assert_equal o, o.instance_eval("self")
+ assert_equal 1, o.instance_eval("1")
+ assert_equal :sym, o.instance_eval(":sym")
+
+ assert_equal 11, o.instance_eval("11")
+ assert_equal 12, o.instance_eval("@ivar")
+ assert_equal 13, o.instance_eval("@@cvar")
+ assert_equal 14, o.instance_eval("$gvar__eval")
+ assert_equal 15, o.instance_eval("Const")
+ assert_equal 16, o.instance_eval("7 + 9")
+ assert_equal 17, o.instance_eval("17.to_i")
+ assert_equal "18", o.instance_eval(%q("18"))
+ assert_equal "19", o.instance_eval(%q("1#{9}"))
+
+ 1.times {
+ assert_equal 12, o.instance_eval("@ivar")
+ assert_equal 13, o.instance_eval("@@cvar")
+ assert_equal 14, o.instance_eval("$gvar__eval")
+ assert_equal 15, o.instance_eval("Const")
+ }
+ end
end
def test_instance_eval_block_basic
- forall_TYPE :instance_eval_block_basic_i
- end
-
- def instance_eval_block_basic_i(o)
- assert_equal nil, o.instance_eval { nil }
- assert_equal true, o.instance_eval { true }
- assert_equal false, o.instance_eval { false }
- assert_equal o, o.instance_eval { self }
- assert_equal 1, o.instance_eval { 1 }
- assert_equal :sym, o.instance_eval { :sym }
-
- assert_equal 11, o.instance_eval { 11 }
- assert_equal 12, o.instance_eval { @ivar }
- assert_equal 13, o.instance_eval { @@cvar }
- assert_equal 14, o.instance_eval { $gvar__eval }
- assert_equal 15, o.instance_eval { Const }
- assert_equal 16, o.instance_eval { 7 + 9 }
- assert_equal 17, o.instance_eval { 17.to_i }
- assert_equal "18", o.instance_eval { "18" }
- assert_equal "19", o.instance_eval { "1#{9}" }
-
- 1.times {
- assert_equal 12, o.instance_eval { @ivar }
- assert_equal 13, o.instance_eval { @@cvar }
- assert_equal 14, o.instance_eval { $gvar__eval }
- assert_equal 15, o.instance_eval { Const }
- }
+ forall_TYPE do |o|
+ assert_equal nil, o.instance_eval { nil }
+ assert_equal true, o.instance_eval { true }
+ assert_equal false, o.instance_eval { false }
+ assert_equal o, o.instance_eval { self }
+ assert_equal 1, o.instance_eval { 1 }
+ assert_equal :sym, o.instance_eval { :sym }
+
+ assert_equal 11, o.instance_eval { 11 }
+ assert_equal 12, o.instance_eval { @ivar }
+ assert_equal 13, o.instance_eval { @@cvar }
+ assert_equal 14, o.instance_eval { $gvar__eval }
+ assert_equal 15, o.instance_eval { Const }
+ assert_equal 16, o.instance_eval { 7 + 9 }
+ assert_equal 17, o.instance_eval { 17.to_i }
+ assert_equal "18", o.instance_eval { "18" }
+ assert_equal "19", o.instance_eval { "1#{9}" }
+
+ 1.times {
+ assert_equal 12, o.instance_eval { @ivar }
+ assert_equal 13, o.instance_eval { @@cvar }
+ assert_equal 14, o.instance_eval { $gvar__eval }
+ assert_equal 15, o.instance_eval { Const }
+ }
+ end
end
def test_instance_eval_cvar
@@ -204,6 +200,40 @@ class TestEval < Test::Unit::TestCase
end
end
+ def test_instance_eval_method
+ bug2788 = '[ruby-core:28324]'
+ [Object.new, [], nil, true, false].each do |o|
+ assert_nothing_raised(TypeError, "#{bug2788} (#{o.inspect})") do
+ o.instance_eval {
+ def defd_using_instance_eval() :ok end
+ }
+ end
+ assert_equal(:ok, o.defd_using_instance_eval)
+ class << o
+ remove_method :defd_using_instance_eval
+ end
+ end
+ end
+
+ def test_instance_eval_on_argf_singleton_class
+ bug8188 = '[ruby-core:53839] [Bug #8188]'
+ assert_warning('', bug8188) do
+ ARGF.singleton_class.instance_eval{}
+ end
+ end
+
+ class Foo
+ Bar = 2
+ end
+
+ def test_instance_eval_const
+ bar = nil
+ assert_nothing_raised(NameError) do
+ bar = Foo.new.instance_eval("Bar")
+ end
+ assert_equal(2, bar)
+ end
+
#
# From ruby/test/ruby/test_eval.rb
#
@@ -218,9 +248,9 @@ class TestEval < Test::Unit::TestCase
def test_eval_orig
assert_nil(eval(""))
- $bad=false
- eval 'while false; $bad = true; print "foo\n" end'
- assert(!$bad)
+ bad=false
+ eval 'while false; bad = true; print "foo\n" end'
+ assert(!bad)
assert(eval('TRUE'))
assert(eval('true'))
@@ -243,34 +273,34 @@ class TestEval < Test::Unit::TestCase
assert_equal(5, eval("i"))
assert(eval("defined? i"))
- $x = test_ev
- assert_equal("local1", eval("local1", $x)) # normal local var
- assert_equal("local2", eval("local2", $x)) # nested local var
- $bad = true
+ x = test_ev
+ assert_equal("local1", eval("local1", x)) # normal local var
+ assert_equal("local2", eval("local2", x)) # nested local var
+ bad = true
begin
p eval("local1")
rescue NameError # must raise error
- $bad = false
+ bad = false
end
- assert(!$bad)
+ assert(!bad)
# !! use class_eval to avoid nested definition
- self.class.class_eval %q(
+ x = self.class.class_eval %q(
module EvTest
EVTEST1 = 25
evtest2 = 125
- $x = binding
+ binding
end
)
- assert_equal(25, eval("EVTEST1", $x)) # constant in module
- assert_equal(125, eval("evtest2", $x)) # local var in module
- $bad = true
+ assert_equal(25, eval("EVTEST1", x)) # constant in module
+ assert_equal(125, eval("evtest2", x)) # local var in module
+ bad = true
begin
eval("EVTEST1")
rescue NameError # must raise error
- $bad = false
+ bad = false
end
- assert(!$bad)
+ assert(!bad)
if false
# Ruby 2.0 doesn't see Proc as Binding
@@ -280,10 +310,10 @@ class TestEval < Test::Unit::TestCase
x = proc{proc{}}.call
eval "i4 = 22", x
assert_equal(22, eval("i4", x))
- $x = []
+ t = []
x = proc{proc{}}.call
- eval "(0..9).each{|i5| $x[i5] = proc{i5*2}}", x
- assert_equal(8, $x[4].call)
+ eval "(0..9).each{|i5| t[i5] = proc{i5*2}}", x
+ assert_equal(8, t[4].call)
end
x = binding
@@ -292,10 +322,10 @@ class TestEval < Test::Unit::TestCase
x = proc{binding}.call
eval "i = 22", x
assert_equal(22, eval("i", x))
- $x = []
+ t = []
x = proc{binding}.call
- eval "(0..9).each{|i5| $x[i5] = proc{i5*2}}", x
- assert_equal(8, $x[4].call)
+ eval "(0..9).each{|i5| t[i5] = proc{i5*2}}", x
+ assert_equal(8, t[4].call)
x = proc{binding}.call
eval "for i6 in 1..1; j6=i6; end", x
assert(eval("defined? i6", x))
@@ -384,6 +414,24 @@ class TestEval < Test::Unit::TestCase
assert_equal("ok", x)
end
+ def test_define_method_toplevel
+ feature6609 = '[ruby-core:45715]'
+ main = eval("self", TOPLEVEL_BINDING)
+ assert_nothing_raised(NoMethodError, feature6609) do
+ main.instance_eval do
+ define_method("feature6609_block") {feature6609}
+ end
+ end
+ assert_equal(feature6609, feature6609_block)
+
+ assert_nothing_raised(NoMethodError, feature6609) do
+ main.instance_eval do
+ define_method("feature6609_method", Object.instance_method(:feature6609_block))
+ end
+ end
+ assert_equal(feature6609, feature6609_method)
+ end
+
def test_eval_using_integer_as_binding
assert_raise(TypeError) { eval("", 1) }
end
@@ -392,16 +440,6 @@ class TestEval < Test::Unit::TestCase
assert_raise(RuntimeError) { eval("raise ''") }
end
- def test_eval_using_untainted_binding_under_safe4
- assert_raise(SecurityError) do
- Thread.new do
- b = binding
- $SAFE = 4
- eval("", b)
- end.join
- end
- end
-
def test_eval_with_toplevel_binding # [ruby-dev:37142]
ruby("-e", "x = 0; eval('p x', TOPLEVEL_BINDING)") do |f|
f.close_write
@@ -430,4 +468,9 @@ class TestEval < Test::Unit::TestCase
result = foo.instance_eval(&foo_pr)
assert_equal(1, result, 'Bug #3786, Bug #3860, [ruby-core:32501]')
end
+
+ def test_file_encoding
+ fname = "\u{3042}".encode("euc-jp")
+ assert_equal(fname, eval("__FILE__", nil, fname, 1))
+ end
end
diff --git a/test/ruby/test_exception.rb b/test/ruby/test_exception.rb
index 281dc70fbe..4eddd0bbe2 100644
--- a/test/ruby/test_exception.rb
+++ b/test/ruby/test_exception.rb
@@ -3,41 +3,44 @@ require 'tempfile'
require_relative 'envutil'
class TestException < Test::Unit::TestCase
- def test_exception
+ def test_exception_rescued
begin
raise "this must be handled"
assert(false)
rescue
assert(true)
end
+ end
- $bad = true
+ def test_exception_retry
+ bad = true
begin
raise "this must be handled no.2"
rescue
- if $bad
- $bad = false
+ if bad
+ bad = false
retry
assert(false)
end
end
assert(true)
+ end
- # exception in rescue clause
- $string = "this must be handled no.3"
- e = assert_raise(RuntimeError) do
+ def test_exception_in_rescue
+ string = "this must be handled no.3"
+ assert_raise_with_message(RuntimeError, string) do
begin
raise "exception in rescue clause"
rescue
- raise $string
+ raise string
end
assert(false)
end
- assert_equal($string, e.message)
+ end
- # exception in ensure clause
- $string = "exception in ensure clause"
- e = assert_raise(RuntimeError) do
+ def test_exception_in_ensure
+ string = "exception in ensure clause"
+ assert_raise_with_message(RuntimeError, string) do
begin
raise "this must be handled no.4"
ensure
@@ -47,64 +50,70 @@ class TestException < Test::Unit::TestCase
end
assert(false)
end
- assert_equal($string, e.message)
+ end
- $bad = true
+ def test_exception_ensure
+ bad = true
begin
begin
raise "this must be handled no.5"
ensure
- $bad = false
+ bad = false
end
rescue
end
- assert(!$bad)
+ assert(!bad)
+ end
- $bad = true
+ def test_exception_ensure_2 # just duplication?
+ bad = true
begin
begin
raise "this must be handled no.6"
ensure
- $bad = false
+ bad = false
end
rescue
end
- assert(!$bad)
+ assert(!bad)
+ end
- $bad = true
+ def test_break_ensure
+ bad = true
while true
begin
break
ensure
- $bad = false
+ bad = false
end
end
- assert(!$bad)
+ assert(!bad)
+ end
+ def test_catch_throw
assert(catch(:foo) {
- loop do
- loop do
- throw :foo, true
- break
- end
- break
- assert(false) # should no reach here
- end
- false
- })
+ loop do
+ loop do
+ throw :foo, true
+ break
+ end
+ break
+ assert(false) # should no reach here
+ end
+ false
+ })
end
def test_catch_throw_in_require
bug7185 = '[ruby-dev:46234]'
- t = Tempfile.open(["dep", ".rb"])
- t.puts("throw :extdep, 42")
- t.close
- assert_equal(42, catch(:extdep) {require t.path}, bug7185)
- ensure
- t.close! if t
+ Tempfile.create(["dep", ".rb"]) {|t|
+ t.puts("throw :extdep, 42")
+ t.close
+ assert_equal(42, catch(:extdep) {require t.path}, bug7185)
+ }
end
- def test_else
+ def test_else_no_exception
begin
assert(true)
rescue
@@ -112,7 +121,9 @@ class TestException < Test::Unit::TestCase
else
assert(true)
end
+ end
+ def test_else_raised
begin
assert(true)
raise
@@ -122,7 +133,9 @@ class TestException < Test::Unit::TestCase
else
assert(false)
end
+ end
+ def test_else_nested_no_exception
begin
assert(true)
begin
@@ -138,7 +151,9 @@ class TestException < Test::Unit::TestCase
else
assert(true)
end
+ end
+ def test_else_nested_rescued
begin
assert(true)
begin
@@ -156,7 +171,9 @@ class TestException < Test::Unit::TestCase
else
assert(true)
end
+ end
+ def test_else_nested_unrescued
begin
assert(true)
begin
@@ -174,7 +191,9 @@ class TestException < Test::Unit::TestCase
else
assert(false)
end
+ end
+ def test_else_nested_rescued_reraise
begin
assert(true)
begin
@@ -234,27 +253,8 @@ class TestException < Test::Unit::TestCase
INPUT
end
- def test_safe4
- cmd = proc{raise SystemExit}
- safe0_p = proc{|*args| args}
-
- test_proc = proc {
- $SAFE = 4
- begin
- cmd.call
- rescue SystemExit => e
- safe0_p["SystemExit: #{e.inspect}"]
- raise e
- rescue Exception => e
- safe0_p["Exception (NOT SystemExit): #{e.inspect}"]
- raise e
- end
- }
- assert_raise(SystemExit, '[ruby-dev:38760]') {test_proc.call}
- end
-
def test_thread_signal_location
- stdout, stderr, status = EnvUtil.invoke_ruby("-d", <<-RUBY, false, true)
+ _, stderr, _ = EnvUtil.invoke_ruby("--disable-gems -d", <<-RUBY, false, true)
Thread.start do
begin
Process.kill(:INT, $$)
@@ -288,6 +288,17 @@ end.join
assert_equal(e.inspect, e.new.inspect)
end
+ def test_to_s
+ e = StandardError.new("foo")
+ assert_equal("foo", e.to_s)
+
+ def (s = Object.new).to_s
+ "bar"
+ end
+ e = StandardError.new(s)
+ assert_equal("bar", e.to_s)
+ end
+
def test_set_backtrace
e = Exception.new
@@ -306,40 +317,132 @@ end.join
exit
rescue SystemExit => e
end
- assert(e.success?)
+ assert_send([e, :success?], "success by default")
+
+ begin
+ exit(true)
+ rescue SystemExit => e
+ end
+ assert_send([e, :success?], "true means success")
+
+ begin
+ exit(false)
+ rescue SystemExit => e
+ end
+ assert_not_send([e, :success?], "false means failure")
begin
abort
rescue SystemExit => e
end
- assert(!e.success?)
+ assert_not_send([e, :success?], "abort means failure")
end
def test_nomethoderror
bug3237 = '[ruby-core:29948]'
str = "\u2600"
id = :"\u2604"
- e = assert_raise(NoMethodError) {str.__send__(id)}
- assert_equal("undefined method `#{id}' for #{str.inspect}:String", e.message, bug3237)
+ msg = "undefined method `#{id}' for #{str.inspect}:String"
+ assert_raise_with_message(NoMethodError, msg, bug3237) do
+ str.__send__(id)
+ end
end
def test_errno
assert_equal(Encoding.find("locale"), Errno::EINVAL.new.message.encoding)
end
+ def test_too_many_args_in_eval
+ bug5720 = '[ruby-core:41520]'
+ arg_string = (0...140000).to_a.join(", ")
+ assert_raise(SystemStackError, bug5720) {eval "raise(#{arg_string})"}
+ end
+
+ def test_systemexit_new
+ e0 = SystemExit.new
+ assert_equal(0, e0.status)
+ assert_equal("SystemExit", e0.message)
+ ei = SystemExit.new(3)
+ assert_equal(3, ei.status)
+ assert_equal("SystemExit", ei.message)
+ es = SystemExit.new("msg")
+ assert_equal(0, es.status)
+ assert_equal("msg", es.message)
+ eis = SystemExit.new(7, "msg")
+ assert_equal(7, eis.status)
+ assert_equal("msg", eis.message)
+
+ bug5728 = '[ruby-dev:44951]'
+ et = SystemExit.new(true)
+ assert_equal(true, et.success?, bug5728)
+ assert_equal("SystemExit", et.message, bug5728)
+ ef = SystemExit.new(false)
+ assert_equal(false, ef.success?, bug5728)
+ assert_equal("SystemExit", ef.message, bug5728)
+ ets = SystemExit.new(true, "msg")
+ assert_equal(true, ets.success?, bug5728)
+ assert_equal("msg", ets.message, bug5728)
+ efs = SystemExit.new(false, "msg")
+ assert_equal(false, efs.success?, bug5728)
+ assert_equal("msg", efs.message, bug5728)
+ end
+
def test_exception_in_name_error_to_str
bug5575 = '[ruby-core:41612]'
- t = Tempfile.new(["test_exception_in_name_error_to_str", ".rb"])
- t.puts <<-EOC
+ Tempfile.create(["test_exception_in_name_error_to_str", ".rb"]) do |t|
+ t.puts <<-EOC
begin
BasicObject.new.inspect
rescue
$!.inspect
end
EOC
- t.close
- assert_nothing_raised(NameError, bug5575) do
- load(t.path)
+ t.close
+ assert_nothing_raised(NameError, bug5575) do
+ load(t.path)
+ end
+ end
+ end
+
+ def test_equal
+ bug5865 = '[ruby-core:41979]'
+ assert_equal(RuntimeError.new("a"), RuntimeError.new("a"), bug5865)
+ assert_not_equal(RuntimeError.new("a"), StandardError.new("a"), bug5865)
+ end
+
+ def test_exception_in_exception_equal
+ bug5865 = '[ruby-core:41979]'
+ Tempfile.create(["test_exception_in_exception_equal", ".rb"]) do |t|
+ t.puts <<-EOC
+ o = Object.new
+ def o.exception(arg)
+ end
+ _ = RuntimeError.new("a") == o
+ EOC
+ t.close
+ assert_nothing_raised(ArgumentError, bug5865) do
+ load(t.path)
+ end
+ end
+ end
+
+ Bug4438 = '[ruby-core:35364]'
+
+ def test_rescue_single_argument
+ assert_raise(TypeError, Bug4438) do
+ begin
+ raise
+ rescue 1
+ end
+ end
+ end
+
+ def test_rescue_splat_argument
+ assert_raise(TypeError, Bug4438) do
+ begin
+ raise
+ rescue *Array(1)
+ end
end
end
@@ -354,7 +457,7 @@ end.join
assert_equal(false, s.tainted?,
"#{exc}#to_s should not propagate taintness")
end
-
+
o = Object.new
def o.to_str
"foo"
@@ -365,31 +468,52 @@ end.join
assert_equal(false, s.tainted?)
end
- def test_exception_to_s_should_not_propagate_untrustedness
- favorite_lang = "Ruby"
+ def m;
+ m &->{return 0};
+ 42;
+ end
- for exc in [Exception, NameError]
- assert_raise(SecurityError) do
- lambda {
- $SAFE = 4
- exc.new(favorite_lang).to_s
- favorite_lang.replace("Python")
- }.call
- end
- end
+ def test_stackoverflow
+ assert_raise(SystemStackError){m}
+ end
- assert_raise(SecurityError) do
- lambda {
- $SAFE = 4
- o = Object.new
- o.singleton_class.send(:define_method, :to_str) {
- favorite_lang
- }
- NameError.new(o).to_s
- favorite_lang.replace("Python")
- }.call
- end
+ def test_machine_stackoverflow
+ bug9109 = '[ruby-dev:47804] [Bug #9109]'
+ assert_separately([], <<-SRC)
+ assert_raise(SystemStackError, #{bug9109.dump}) {
+ h = {a: ->{h[:a].call}}
+ h[:a].call
+ }
+ SRC
+ end
- assert_equal("Ruby", favorite_lang)
+ def test_cause
+ msg = "[Feature #8257]"
+ cause = nil
+ e = assert_raise(StandardError) {
+ begin
+ raise msg
+ rescue => e
+ cause = e.cause
+ raise StandardError
+ end
+ }
+ assert_nil(cause, msg)
+ cause = e.cause
+ assert_instance_of(RuntimeError, cause, msg)
+ assert_equal(msg, cause.message, msg)
+ end
+
+ def test_cause_reraised
+ msg = "[Feature #8257]"
+ cause = nil
+ e = assert_raise(RuntimeError) {
+ begin
+ raise msg
+ rescue => e
+ raise e
+ end
+ }
+ assert_not_same(e, e.cause, "#{msg}: should not be recursive")
end
end
diff --git a/test/ruby/test_fiber.rb b/test/ruby/test_fiber.rb
index 49736f5a89..6c5bb891a2 100644
--- a/test/ruby/test_fiber.rb
+++ b/test/ruby/test_fiber.rb
@@ -5,7 +5,6 @@ require_relative './envutil'
class TestFiber < Test::Unit::TestCase
def test_normal
- f = Fiber.current
assert_equal(:ok2,
Fiber.new{|e|
assert_equal(:ok1, e)
@@ -34,33 +33,36 @@ class TestFiber < Test::Unit::TestCase
end
def test_many_fibers
- max = 10000
+ max = 10_000
assert_equal(max, max.times{
Fiber.new{}
})
+ GC.start # force collect created fibers
assert_equal(max,
max.times{|i|
Fiber.new{
}.resume
}
)
+ GC.start # force collect created fibers
end
def test_many_fibers_with_threads
- max = 1000
- @cnt = 0
- (1..100).map{|ti|
- Thread.new{
- max.times{|i|
- Fiber.new{
- @cnt += 1
- }.resume
+ assert_normal_exit <<-SRC, timeout: 60
+ max = 1000
+ @cnt = 0
+ (1..100).map{|ti|
+ Thread.new{
+ max.times{|i|
+ Fiber.new{
+ @cnt += 1
+ }.resume
+ }
}
+ }.each{|t|
+ t.join
}
- }.each{|t|
- t.join
- }
- assert_equal(:ok, :ok)
+ SRC
end
def test_error
@@ -77,7 +79,7 @@ class TestFiber < Test::Unit::TestCase
f.resume
}
assert_raise(RuntimeError){
- f = Fiber.new{
+ Fiber.new{
@c = callcc{|c| @c = c}
}.resume
@c.call # cross fiber callcc
@@ -188,6 +190,11 @@ class TestFiber < Test::Unit::TestCase
f2 = Fiber.new{ f1.resume }
f1.transfer
}, '[ruby-dev:40833]'
+ assert_normal_exit %q{
+ require 'fiber'
+ Fiber.new{}.resume
+ 1.times{Fiber.current.transfer}
+ }
end
def test_resume_root_fiber
@@ -211,24 +218,42 @@ class TestFiber < Test::Unit::TestCase
def test_no_valid_cfp
bug5083 = '[ruby-dev:44208]'
- error = assert_raise(RuntimeError) do
- Fiber.new(&Module.method(:nesting)).resume
- end
- assert_equal("Can't call on top of Fiber or Thread", error.message, bug5083)
- error = assert_raise(RuntimeError) do
- Fiber.new(&Module.method(:undef_method)).resume(:to_s)
- end
- assert_equal("Can't call on top of Fiber or Thread", error.message, bug5083)
+ assert_equal([], Fiber.new(&Module.method(:nesting)).resume)
+ assert_instance_of(Class, Fiber.new(&Class.new.method(:undef_method)).resume(:to_s))
+ end
+
+ def test_prohibit_resume_transfered_fiber
+ assert_raise(FiberError){
+ root_fiber = Fiber.current
+ f = Fiber.new{
+ root_fiber.transfer
+ }
+ f.transfer
+ f.resume
+ }
+ assert_raise(FiberError){
+ g=nil
+ f=Fiber.new{
+ g.resume
+ g.resume
+ }
+ g=Fiber.new{
+ f.resume
+ f.resume
+ }
+ f.transfer
+ }
end
def test_fork_from_fiber
begin
- Process.fork{}
+ pid = Process.fork{}
rescue NotImplementedError
return
+ else
+ Process.wait(pid)
end
bug5700 = '[ruby-core:41456]'
- pid = nil
assert_nothing_raised(bug5700) do
Fiber.new{ pid = fork {} }.resume
end
@@ -236,5 +261,85 @@ class TestFiber < Test::Unit::TestCase
assert_equal(0, status.exitstatus, bug5700)
assert_equal(false, status.signaled?, bug5700)
end
+
+ def test_exit_in_fiber
+ bug5993 = '[ruby-dev:45218]'
+ assert_nothing_raised(bug5993) do
+ Thread.new{ Fiber.new{ Thread.exit }.resume; raise "unreachable" }.join
+ end
+ end
+
+ def test_fatal_in_fiber
+ assert_in_out_err(["-r-test-/fatal/rb_fatal", "-e", <<-EOS], "", [], /ok/)
+ Fiber.new{
+ rb_fatal "ok"
+ }.resume
+ puts :ng # unreachable.
+ EOS
+ end
+
+ def invoke_rec script, vm_stack_size, machine_stack_size, use_length = true
+ env = {}
+ env['RUBY_FIBER_VM_STACK_SIZE'] = vm_stack_size.to_s if vm_stack_size
+ env['RUBY_FIBER_MACHINE_STACK_SIZE'] = machine_stack_size.to_s if machine_stack_size
+ out, err = EnvUtil.invoke_ruby([env, '-e', script], '', true, true)
+ use_length ? out.length : out
+ end
+
+ def test_stack_size
+ h_default = eval(invoke_rec('p RubyVM::DEFAULT_PARAMS', nil, nil, false))
+ h_0 = eval(invoke_rec('p RubyVM::DEFAULT_PARAMS', 0, 0, false))
+ h_large = eval(invoke_rec('p RubyVM::DEFAULT_PARAMS', 1024 * 1024 * 10, 1024 * 1024 * 10, false))
+
+ assert(h_default[:fiber_vm_stack_size] > h_0[:fiber_vm_stack_size])
+ assert(h_default[:fiber_vm_stack_size] < h_large[:fiber_vm_stack_size])
+ assert(h_default[:fiber_machine_stack_size] >= h_0[:fiber_machine_stack_size])
+ assert(h_default[:fiber_machine_stack_size] <= h_large[:fiber_machine_stack_size])
+
+ # check VM machine stack size
+ script = '$stdout.sync=true; def rec; print "."; rec; end; Fiber.new{rec}.resume'
+ size_default = invoke_rec script, nil, nil
+ assert_operator(size_default, :>, 0)
+ size_0 = invoke_rec script, 0, nil
+ assert_operator(size_default, :>, size_0)
+ size_large = invoke_rec script, 1024 * 1024 * 10, nil
+ assert_operator(size_default, :<, size_large)
+
+ return if /mswin|mingw/ =~ RUBY_PLATFORM
+
+ # check machine stack size
+ # Note that machine stack size may not change size (depend on OSs)
+ script = '$stdout.sync=true; def rec; print "."; 1.times{1.times{1.times{rec}}}; end; Fiber.new{rec}.resume'
+ vm_stack_size = 1024 * 1024
+ size_default = invoke_rec script, vm_stack_size, nil
+ size_0 = invoke_rec script, vm_stack_size, 0
+ assert_operator(size_default, :>=, size_0)
+ size_large = invoke_rec script, vm_stack_size, 1024 * 1024 * 10
+ assert_operator(size_default, :<=, size_large)
+ end
+
+ def test_separate_lastmatch
+ bug7678 = '[ruby-core:51331]'
+ /a/ =~ "a"
+ m1 = $~
+ m2 = nil
+ Fiber.new do
+ /b/ =~ "b"
+ m2 = $~
+ end.resume
+ assert_equal("b", m2[0])
+ assert_equal(m1, $~, bug7678)
+ end
+
+ def test_separate_lastline
+ bug7678 = '[ruby-core:51331]'
+ $_ = s1 = "outer"
+ s2 = nil
+ Fiber.new do
+ s2 = "inner"
+ end.resume
+ assert_equal("inner", s2)
+ assert_equal(s1, $_, bug7678)
+ end
end
diff --git a/test/ruby/test_file.rb b/test/ruby/test_file.rb
index b888233bbe..41debbbb1c 100644
--- a/test/ruby/test_file.rb
+++ b/test/ruby/test_file.rb
@@ -1,5 +1,7 @@
require 'test/unit'
require 'tempfile'
+require "thread"
+require_relative 'envutil'
require_relative 'ut_eof'
class TestFile < Test::Unit::TestCase
@@ -28,10 +30,11 @@ class TestFile < Test::Unit::TestCase
include TestEOF
def open_file(content)
- f = Tempfile.new("test-eof")
- f << content
- f.rewind
- yield f
+ Tempfile.create("test-eof") {|f|
+ f << content
+ f.rewind
+ yield f
+ }
end
alias open_file_rw open_file
@@ -39,33 +42,32 @@ class TestFile < Test::Unit::TestCase
def test_empty_file_bom
bug6487 = '[ruby-core:45203]'
- f = Tempfile.new(__method__.to_s)
- f.close
- assert File.exist? f.path
- assert_nothing_raised(bug6487) {File.read(f.path, mode: 'r:utf-8')}
- assert_nothing_raised(bug6487) {File.read(f.path, mode: 'r:bom|utf-8')}
- f.close(true)
+ Tempfile.create(__method__.to_s) {|f|
+ assert_file.exist?(f.path)
+ assert_nothing_raised(bug6487) {File.read(f.path, mode: 'r:utf-8')}
+ assert_nothing_raised(bug6487) {File.read(f.path, mode: 'r:bom|utf-8')}
+ }
end
def assert_bom(bytes, name)
bug6487 = '[ruby-core:45203]'
- f = Tempfile.new(name.to_s)
- f.sync = true
- expected = ""
- result = nil
- bytes[0...-1].each do |x|
- f.write x
- f.write ' '
- f.pos -= 1
- expected << x
+ Tempfile.create(name.to_s) {|f|
+ f.sync = true
+ expected = ""
+ result = nil
+ bytes[0...-1].each do |x|
+ f.write x
+ f.write ' '
+ f.pos -= 1
+ expected << x
+ assert_nothing_raised(bug6487) {result = File.read(f.path, mode: 'rb:bom|utf-8')}
+ assert_equal("#{expected} ".force_encoding("utf-8"), result)
+ end
+ f.write bytes[-1]
assert_nothing_raised(bug6487) {result = File.read(f.path, mode: 'rb:bom|utf-8')}
- assert_equal("#{expected} ".force_encoding("utf-8"), result)
- end
- f.write bytes[-1]
- assert_nothing_raised(bug6487) {result = File.read(f.path, mode: 'rb:bom|utf-8')}
- assert_equal '', result, "valid bom"
- f.close(true)
+ assert_equal '', result, "valid bom"
+ }
end
def test_bom_8
@@ -89,104 +91,138 @@ class TestFile < Test::Unit::TestCase
end
def test_truncate_wbuf
- f = Tempfile.new("test-truncate")
- f.print "abc"
- f.truncate(0)
- f.print "def"
- f.flush
- assert_equal("\0\0\0def", File.read(f.path), "[ruby-dev:24191]")
- f.close
+ Tempfile.create("test-truncate") {|f|
+ f.print "abc"
+ f.truncate(0)
+ f.print "def"
+ f.flush
+ assert_equal("\0\0\0def", File.read(f.path), "[ruby-dev:24191]")
+ }
end
def test_truncate_rbuf
- f = Tempfile.new("test-truncate")
- f.puts "abc"
- f.puts "def"
- f.close
- f.open
- assert_equal("abc\n", f.gets)
- f.truncate(3)
- assert_equal(nil, f.gets, "[ruby-dev:24197]")
+ Tempfile.create("test-truncate") {|f|
+ f.puts "abc"
+ f.puts "def"
+ f.rewind
+ assert_equal("abc\n", f.gets)
+ f.truncate(3)
+ assert_equal(nil, f.gets, "[ruby-dev:24197]")
+ }
end
def test_truncate_beyond_eof
- f = Tempfile.new("test-truncate")
- f.print "abc"
- f.truncate 10
- assert_equal("\0" * 7, f.read(100), "[ruby-dev:24532]")
+ Tempfile.create("test-truncate") {|f|
+ f.print "abc"
+ f.truncate 10
+ assert_equal("\0" * 7, f.read(100), "[ruby-dev:24532]")
+ }
+ end
+
+ def test_truncate_size
+ Tempfile.create("test-truncate") do |f|
+ q1 = Queue.new
+ q2 = Queue.new
+
+ Thread.new do
+ data = ''
+ 64.times do |i|
+ data << i.to_s
+ f.rewind
+ f.print data
+ f.truncate(data.bytesize)
+ q1.push data.bytesize
+ q2.pop
+ end
+ q1.push nil
+ end
+
+ while size = q1.pop
+ assert_equal size, File.size(f.path)
+ assert_equal size, f.size
+ q2.push true
+ end
+ end
end
def test_read_all_extended_file
[nil, {:textmode=>true}, {:binmode=>true}].each do |mode|
- f = Tempfile.new("test-extended-file", mode)
- assert_nil(f.getc)
- f.print "a"
- f.rewind
- assert_equal("a", f.read, "mode = <#{mode}>")
+ Tempfile.create("test-extended-file", mode) {|f|
+ assert_nil(f.getc)
+ f.print "a"
+ f.rewind
+ assert_equal("a", f.read, "mode = <#{mode}>")
+ }
end
end
def test_gets_extended_file
[nil, {:textmode=>true}, {:binmode=>true}].each do |mode|
- f = Tempfile.new("test-extended-file", mode)
- assert_nil(f.getc)
- f.print "a"
- f.rewind
- assert_equal("a", f.gets("a"), "mode = <#{mode}>")
+ Tempfile.create("test-extended-file", mode) {|f|
+ assert_nil(f.getc)
+ f.print "a"
+ f.rewind
+ assert_equal("a", f.gets("a"), "mode = <#{mode}>")
+ }
end
end
def test_gets_para_extended_file
[nil, {:textmode=>true}, {:binmode=>true}].each do |mode|
- f = Tempfile.new("test-extended-file", mode)
- assert_nil(f.getc)
- f.print "\na"
- f.rewind
- assert_equal("a", f.gets(""), "mode = <#{mode}>")
+ Tempfile.create("test-extended-file", mode) {|f|
+ assert_nil(f.getc)
+ f.print "\na"
+ f.rewind
+ assert_equal("a", f.gets(""), "mode = <#{mode}>")
+ }
end
end
def test_each_char_extended_file
[nil, {:textmode=>true}, {:binmode=>true}].each do |mode|
- f = Tempfile.new("test-extended-file", mode)
- assert_nil(f.getc)
- f.print "a"
- f.rewind
- result = []
- f.each_char {|b| result << b }
- assert_equal([?a], result, "mode = <#{mode}>")
+ Tempfile.create("test-extended-file", mode) {|f|
+ assert_nil(f.getc)
+ f.print "a"
+ f.rewind
+ result = []
+ f.each_char {|b| result << b }
+ assert_equal([?a], result, "mode = <#{mode}>")
+ }
end
end
def test_each_byte_extended_file
[nil, {:textmode=>true}, {:binmode=>true}].each do |mode|
- f = Tempfile.new("test-extended-file", mode)
- assert_nil(f.getc)
- f.print "a"
- f.rewind
- result = []
- f.each_byte {|b| result << b.chr }
- assert_equal([?a], result, "mode = <#{mode}>")
+ Tempfile.create("test-extended-file", mode) {|f|
+ assert_nil(f.getc)
+ f.print "a"
+ f.rewind
+ result = []
+ f.each_byte {|b| result << b.chr }
+ assert_equal([?a], result, "mode = <#{mode}>")
+ }
end
end
def test_getc_extended_file
[nil, {:textmode=>true}, {:binmode=>true}].each do |mode|
- f = Tempfile.new("test-extended-file", mode)
- assert_nil(f.getc)
- f.print "a"
- f.rewind
- assert_equal(?a, f.getc, "mode = <#{mode}>")
+ Tempfile.create("test-extended-file", mode) {|f|
+ assert_nil(f.getc)
+ f.print "a"
+ f.rewind
+ assert_equal(?a, f.getc, "mode = <#{mode}>")
+ }
end
end
def test_getbyte_extended_file
[nil, {:textmode=>true}, {:binmode=>true}].each do |mode|
- f = Tempfile.new("test-extended-file", mode)
- assert_nil(f.getc)
- f.print "a"
- f.rewind
- assert_equal(?a, f.getbyte.chr, "mode = <#{mode}>")
+ Tempfile.create("test-extended-file", mode) {|f|
+ assert_nil(f.getc)
+ f.print "a"
+ f.rewind
+ assert_equal(?a, f.getbyte.chr, "mode = <#{mode}>")
+ }
end
end
@@ -212,7 +248,7 @@ class TestFile < Test::Unit::TestCase
def test_realpath
Dir.mktmpdir('rubytest-realpath') {|tmpdir|
realdir = File.realpath(tmpdir)
- tst = realdir.sub(/#{Regexp.escape(File::SEPARATOR)}/, '\0\0\0')
+ tst = realdir + (File::SEPARATOR*3 + ".")
assert_equal(realdir, File.realpath(tst))
assert_equal(realdir, File.realpath(".", tst))
if File::ALT_SEPARATOR
@@ -225,11 +261,34 @@ class TestFile < Test::Unit::TestCase
def test_realdirpath
Dir.mktmpdir('rubytest-realdirpath') {|tmpdir|
realdir = File.realpath(tmpdir)
- tst = realdir.sub(/#{Regexp.escape(File::SEPARATOR)}/, '\0\0\0')
+ tst = realdir + (File::SEPARATOR*3 + ".")
assert_equal(realdir, File.realdirpath(tst))
assert_equal(realdir, File.realdirpath(".", tst))
assert_equal(File.join(realdir, "foo"), File.realdirpath("foo", tst))
}
+ begin
+ result = File.realdirpath("bar", "//:/foo")
+ rescue SystemCallError
+ else
+ if result.start_with?("//")
+ assert_equal("//:/foo/bar", result)
+ end
+ end
+ end
+
+ def test_utime_with_minus_time_segv
+ bug5596 = '[ruby-dev:44838]'
+ assert_in_out_err([], <<-EOS, [bug5596], [])
+ require "tempfile"
+ t = Time.at(-1)
+ begin
+ Tempfile.create('test_utime_with_minus_time_segv') {|f|
+ File.utime(t, t, f)
+ }
+ rescue
+ end
+ puts '#{bug5596}'
+ EOS
end
def test_utime
@@ -261,13 +320,67 @@ class TestFile < Test::Unit::TestCase
end
end
+ def test_file_open_permissions
+ Dir.mktmpdir(__method__.to_s) do |tmpdir|
+ tmp = File.join(tmpdir, 'x')
+ File.open(tmp, :mode => IO::RDWR | IO::CREAT | IO::BINARY,
+ :encoding => Encoding::ASCII_8BIT) do |x|
+
+ assert x.autoclose?
+ assert_equal Encoding::ASCII_8BIT, x.external_encoding
+ assert x.write 'hello'
+
+ x.seek 0, IO::SEEK_SET
+
+ assert_equal 'hello', x.read
+
+ end
+ end
+ end
+
+ def test_file_open_double_mode
+ assert_raise_with_message(ArgumentError, 'mode specified twice') {
+ File.open("a", 'w', :mode => 'rw+')
+ }
+ end
+
+ def test_conflicting_encodings
+ Dir.mktmpdir(__method__.to_s) do |tmpdir|
+ tmp = File.join(tmpdir, 'x')
+ File.open(tmp, 'wb', :encoding => Encoding::EUC_JP) do |x|
+ assert_equal Encoding::EUC_JP, x.external_encoding
+ end
+ end
+ end
+
+ def test_untainted_path
+ bug5374 = '[ruby-core:39745]'
+ cwd = ("./"*40+".".taint).dup.untaint
+ in_safe = proc {|safe| $SAFE = safe; File.stat(cwd)}
+ assert_not_send([cwd, :tainted?])
+ (0..1).each do |level|
+ assert_nothing_raised(SecurityError, bug5374) {in_safe[level]}
+ end
+ end
+
+ if /(bcc|ms|cyg)win|mingw|emx/ =~ RUBY_PLATFORM
+ def test_long_unc
+ feature3399 = '[ruby-core:30623]'
+ path = File.expand_path(__FILE__)
+ path.sub!(%r'\A//', 'UNC/')
+ assert_nothing_raised(Errno::ENOENT, feature3399) do
+ File.stat("//?/#{path}")
+ end
+ end
+ end
+
def test_open_nul
Dir.mktmpdir(__method__.to_s) do |tmpdir|
path = File.join(tmpdir, "foo")
assert_raise(ArgumentError) do
open(path + "\0bar", "w") {}
end
- refute File.exist?(path)
+ assert_file.not_exist?(path)
end
end
end
diff --git a/test/ruby/test_file_exhaustive.rb b/test/ruby/test_file_exhaustive.rb
index df7140f24a..069e5592ca 100644
--- a/test/ruby/test_file_exhaustive.rb
+++ b/test/ruby/test_file_exhaustive.rb
@@ -1,7 +1,7 @@
-# -*- coding: us-ascii -*-
require "test/unit"
require "fileutils"
require "tmpdir"
+require_relative "envutil"
class TestFileExhaustive < Test::Unit::TestCase
DRIVE = Dir.pwd[%r'\A(?:[a-z]:|//[^/]+/[^/]+)'i]
@@ -108,6 +108,28 @@ class TestFileExhaustive < Test::Unit::TestCase
assert_kind_of(File::Stat, File.open(@file) {|f| f.lstat})
end
+ def test_stat_drive_root
+ assert_nothing_raised { File.stat(DRIVE + "/") }
+ assert_nothing_raised { File.stat(DRIVE + "/.") }
+ assert_nothing_raised { File.stat(DRIVE + "/..") }
+ assert_raise(Errno::ENOENT) { File.stat(DRIVE + "/...") }
+ # want to test the root of empty drive, but there is no method to test it...
+ end if DRIVE
+
+ def test_stat_dotted_prefix
+ Dir.mktmpdir do |dir|
+ prefix = File.join(dir, "...a")
+ Dir.mkdir(prefix)
+ assert_file.exist?(prefix)
+
+ assert_nothing_raised { File.stat(prefix) }
+
+ Dir.chdir(dir) do
+ assert_nothing_raised { File.stat(File.basename(prefix)) }
+ end
+ end
+ end if /mswin|mingw|cygwin/ =~ RUBY_PLATFORM
+
def test_directory_p
assert(File.directory?(@dir))
assert(!(File.directory?(@dir+"/...")))
@@ -148,9 +170,9 @@ class TestFileExhaustive < Test::Unit::TestCase
end
def test_exist_p
- assert(File.exist?(@dir))
- assert(File.exist?(@file))
- assert(!(File.exist?(@nofile)))
+ assert_file.exist?(@dir)
+ assert_file.exist?(@file)
+ assert_file.not_exist?(@nofile)
end
def test_readable_p
@@ -377,8 +399,8 @@ class TestFileExhaustive < Test::Unit::TestCase
def test_rename
assert_equal(0, File.rename(@file, @nofile))
- assert(!(File.exist?(@file)))
- assert(File.exist?(@nofile))
+ assert_file.not_exist?(@file)
+ assert_file.exist?(@nofile)
assert_equal(0, File.rename(@nofile, @file))
assert_raise(Errno::ENOENT) { File.rename(@nofile, @file) }
end
@@ -413,6 +435,46 @@ class TestFileExhaustive < Test::Unit::TestCase
end
end
+ def test_expand_path_encoding
+ drive = (DRIVE ? 'C:' : '')
+ if Encoding.find("filesystem") == Encoding::CP1251
+ a = "#{drive}/\u3042\u3044\u3046\u3048\u304a".encode("cp932")
+ else
+ a = "#{drive}/\u043f\u0440\u0438\u0432\u0435\u0442".encode("cp1251")
+ end
+ assert_equal(a, File.expand_path(a))
+ a = "#{drive}/\225\\\\"
+ if File::ALT_SEPARATOR == '\\'
+ [%W"cp437 #{drive}/\225", %W"cp932 #{drive}/\225\\"]
+ else
+ [["cp437", a], ["cp932", a]]
+ end.each do |cp, expected|
+ assert_equal(expected.force_encoding(cp), File.expand_path(a.dup.force_encoding(cp)), cp)
+ end
+
+ path = "\u3042\u3044\u3046\u3048\u304a".encode("EUC-JP")
+ assert_equal("#{Dir.pwd}/#{path}".encode("CP932"), File.expand_path(path).encode("CP932"))
+
+ path = "\u3042\u3044\u3046\u3048\u304a".encode("CP51932")
+ assert_equal("#{Dir.pwd}/#{path}", File.expand_path(path))
+
+ assert_incompatible_encoding {|d| File.expand_path(d)}
+ end
+
+ def test_expand_path_encoding_filesystem
+ home = ENV["HOME"]
+ ENV["HOME"] = "#{DRIVE}/UserHome"
+
+ path = "~".encode("US-ASCII")
+ dir = "C:/".encode("IBM437")
+ fs = Encoding.find("filesystem")
+
+ assert_equal fs, File.expand_path(path).encoding
+ assert_equal fs, File.expand_path(path, dir).encoding
+ ensure
+ ENV["HOME"] = home
+ end
+
UnknownUserHome = "~foo_bar_baz_unknown_user_wahaha".freeze
def test_expand_path_home
@@ -457,6 +519,33 @@ class TestFileExhaustive < Test::Unit::TestCase
ENV["HOME"] = home
end
+ if /mswin|mingw/ =~ RUBY_PLATFORM
+ def test_expand_path_home_memory_leak_in_path
+ assert_no_memory_leak_at_expand_path_home('', 'in path')
+ end
+
+ def test_expand_path_home_memory_leak_in_base
+ assert_no_memory_leak_at_expand_path_home('".",', 'in base')
+ end
+
+ def assert_no_memory_leak_at_expand_path_home(arg, message)
+ prep = 'ENV["HOME"] = "foo"*100'
+ assert_no_memory_leak([], prep, <<-TRY, "memory leaked at non-absolute home #{message}")
+ 10000.times do
+ begin
+ File.expand_path(#{arg}"~/a")
+ rescue ArgumentError => e
+ next
+ ensure
+ abort("ArgumentError (non-absolute home) expected") unless e
+ end
+ end
+ GC.start
+ TRY
+ end
+ end
+
+
def test_expand_path_remove_trailing_alternative_data
assert_equal File.join(@rootdir, "aaa"), File.expand_path("#{@rootdir}/aaa::$DATA")
assert_equal File.join(@rootdir, "aa:a"), File.expand_path("#{@rootdir}/aa:a:$DATA")
@@ -493,7 +582,6 @@ class TestFileExhaustive < Test::Unit::TestCase
if DRIVE
# cleanup dots only on Windows
assert_equal(File.join(Dir.pwd, "a"), File.expand_path("a."), bug)
- skip "FIXME"
assert_equal(File.join(Dir.pwd, "a"), File.expand_path("a.."), bug)
else
assert_equal(File.join(Dir.pwd, "a."), File.expand_path("a."), bug)
@@ -608,6 +696,25 @@ class TestFileExhaustive < Test::Unit::TestCase
assert_raise(ArgumentError, bug) { File.expand_path("~anything") }
end if DRIVE
+ def test_expand_path_for_existent_username
+ user = ENV['USER']
+ skip "ENV['USER'] is not set" unless user
+ assert_equal(ENV['HOME'], File.expand_path("~#{user}"))
+ end unless DRIVE
+
+ def test_expand_path_error_for_nonexistent_username
+ user = "\u{3086 3046 3066 3044}:\u{307F 3084 304A 3046}"
+ assert_raise_with_message(ArgumentError, /#{user}/) {File.expand_path("~#{user}")}
+ end unless DRIVE
+
+ def test_expand_path_error_for_non_absolute_home
+ old_home = ENV["HOME"]
+ ENV["HOME"] = "./UserHome"
+ assert_raise_with_message(ArgumentError, /non-absolute home/) {File.expand_path("~")}
+ ensure
+ ENV["HOME"] = old_home
+ end
+
def test_expand_path_raises_a_type_error_if_not_passed_a_string_type
assert_raise(TypeError) { File.expand_path(1) }
assert_raise(TypeError) { File.expand_path(nil) }
@@ -680,6 +787,9 @@ class TestFileExhaustive < Test::Unit::TestCase
s = "foo\x93_a".force_encoding("cp932")
assert_equal(s, File.basename(s, "_a"))
+
+ s = "\u4032.\u3024"
+ assert_equal(s, File.basename(s, ".\x95\\".force_encoding("cp932")))
end
def test_dirname
@@ -731,10 +841,14 @@ class TestFileExhaustive < Test::Unit::TestCase
s = "foo" + File::SEPARATOR + "bar" + File::SEPARATOR + "baz"
assert_equal(s, File.join("foo", "bar", "baz"))
assert_equal(s, File.join(["foo", "bar", "baz"]))
+
o = Object.new
def o.to_path; "foo"; end
assert_equal(s, File.join(o, "bar", "baz"))
assert_equal(s, File.join("foo" + File::SEPARATOR, "bar", File::SEPARATOR + "baz"))
+ end
+
+ def test_join_alt_separator
if File::ALT_SEPARATOR == '\\'
a = "\225\\"
b = "foo"
@@ -744,23 +858,41 @@ class TestFileExhaustive < Test::Unit::TestCase
end
end
+ def test_join_ascii_incompatible
+ bug7168 = '[ruby-core:48012]'
+ names = %w"a b".map {|s| s.encode(Encoding::UTF_16LE)}
+ assert_raise(Encoding::CompatibilityError, bug7168) {File.join(*names)}
+ assert_raise(Encoding::CompatibilityError, bug7168) {File.join(names)}
+
+ a = Object.new
+ b = names[1]
+ names = [a, "b"]
+ a.singleton_class.class_eval do
+ define_method(:to_path) do
+ names[1] = b
+ "a"
+ end
+ end
+ assert_raise(Encoding::CompatibilityError, bug7168) {File.join(names)}
+ end
+
def test_truncate
assert_equal(0, File.truncate(@file, 1))
- assert(File.exist?(@file))
+ assert_file.exist?(@file)
assert_equal(1, File.size(@file))
assert_equal(0, File.truncate(@file, 0))
- assert(File.exist?(@file))
- assert(File.zero?(@file))
+ assert_file.exist?(@file)
+ assert_file.zero?(@file)
make_file("foo", @file)
assert_raise(Errno::ENOENT) { File.truncate(@nofile, 0) }
f = File.new(@file, "w")
assert_equal(0, f.truncate(2))
- assert(File.exist?(@file))
+ assert_file.exist?(@file)
assert_equal(2, File.size(@file))
assert_equal(0, f.truncate(0))
- assert(File.exist?(@file))
- assert(File.zero?(@file))
+ assert_file.exist?(@file)
+ assert_file.zero?(@file)
f.close
make_file("foo", @file)
@@ -1023,15 +1155,6 @@ class TestFileExhaustive < Test::Unit::TestCase
assert_nothing_raised { ENV["PATH"] }
end
- def test_find_file
- assert_raise(SecurityError) do
- Thread.new do
- $SAFE = 4
- load(@file)
- end.join
- end
- end
-
def test_size
assert_equal(3, File.open(@file) {|f| f.size })
File.open(@file, "a") do |f|
diff --git a/test/ruby/test_fixnum.rb b/test/ruby/test_fixnum.rb
index 2aee65c211..c016b2f4e0 100644
--- a/test/ruby/test_fixnum.rb
+++ b/test/ruby/test_fixnum.rb
@@ -157,6 +157,7 @@ class TestFixnum < Test::Unit::TestCase
assert_equal(0, 1 / (2**32))
assert_equal(0, 1.div(2**32))
+ assert_kind_of(Float, 1.quo(2.0))
assert_equal(0.5, 1.quo(2.0))
assert_equal(0.5, 1 / 2.0)
assert_equal(0, 1.div(2.0))
@@ -229,4 +230,73 @@ class TestFixnum < Test::Unit::TestCase
assert(!(1.send(:<=, 0.0)))
assert_raise(ArgumentError) { 1.send(:<=, nil) }
end
+
+ class DummyNumeric < Numeric
+ def to_int
+ 1
+ end
+ end
+
+ def test_and_with_float
+ assert_raise(TypeError) { 1 & 1.5 }
+ end
+
+ def test_and_with_rational
+ assert_raise(TypeError, "#1792") { 1 & Rational(3, 2) }
+ end
+
+ def test_and_with_nonintegral_numeric
+ assert_raise(TypeError, "#1792") { 1 & DummyNumeric.new }
+ end
+
+ def test_or_with_float
+ assert_raise(TypeError) { 1 | 1.5 }
+ end
+
+ def test_or_with_rational
+ assert_raise(TypeError, "#1792") { 1 | Rational(3, 2) }
+ end
+
+ def test_or_with_nonintegral_numeric
+ assert_raise(TypeError, "#1792") { 1 | DummyNumeric.new }
+ end
+
+ def test_xor_with_float
+ assert_raise(TypeError) { 1 ^ 1.5 }
+ end
+
+ def test_xor_with_rational
+ assert_raise(TypeError, "#1792") { 1 ^ Rational(3, 2) }
+ end
+
+ def test_xor_with_nonintegral_numeric
+ assert_raise(TypeError, "#1792") { 1 ^ DummyNumeric.new }
+ end
+
+ def test_singleton_method
+ assert_raise(TypeError) { a = 1; def a.foo; end }
+ end
+
+ def test_frozen
+ assert_equal(true, 1.frozen?)
+ end
+
+ def assert_eql(a, b, mess)
+ assert a.eql?(b), "expected #{a} & #{b} to be eql? #{mess}"
+ end
+
+ def test_power_of_1_and_minus_1
+ bug5715 = '[ruby-core:41498]'
+ big = 1 << 66
+ assert_eql 1, 1 ** -big , bug5715
+ assert_eql 1, (-1) ** -big , bug5715
+ assert_eql -1, (-1) ** -(big+1) , bug5715
+ end
+
+ def test_power_of_0
+ bug5713 = '[ruby-core:41494]'
+ big = 1 << 66
+ assert_raise(ZeroDivisionError, bug5713) { 0 ** -big }
+ assert_raise(ZeroDivisionError, bug5713) { 0 ** Rational(-2,3) }
+ end
end
diff --git a/test/ruby/test_flip.rb b/test/ruby/test_flip.rb
index bd14228a8c..fc62d93ae6 100644
--- a/test/ruby/test_flip.rb
+++ b/test/ruby/test_flip.rb
@@ -18,4 +18,25 @@ class TestFlip < Test::Unit::TestCase
v = eval("vs.select {|n| if n==3..n==6 then 1 end}")
assert_equal([*3..6], v, bug7671)
end
+
+ def test_shared_thread
+ ff = proc {|n| true if n==3..n==5}
+ v = 1..9
+ a = true
+ th = Thread.new {
+ v.select {|i|
+ Thread.pass while a
+ ff[i].tap {a = true}
+ }
+ }
+ v1 = v.select {|i|
+ Thread.pass until a
+ ff[i].tap {a = false}
+ }
+ v2 = th.value
+ expected = [3, 4, 5]
+ mesg = 'flip-flop should be separated per threads'
+ assert_equal(expected, v1, mesg)
+ assert_equal(expected, v2, mesg)
+ end
end
diff --git a/test/ruby/test_float.rb b/test/ruby/test_float.rb
index d2cee75433..798185b44a 100644
--- a/test/ruby/test_float.rb
+++ b/test/ruby/test_float.rb
@@ -57,6 +57,55 @@ class TestFloat < Test::Unit::TestCase
assert_equal(a == b, b == a)
end
+ def test_cmp_int
+ 100.times {|i|
+ int0 = 1 << i
+ [int0, -int0].each {|int|
+ flt = int.to_f
+ bigger = int + 1
+ smaller = int - 1
+ assert_operator(flt, :==, int)
+ assert_operator(flt, :>, smaller)
+ assert_operator(flt, :>=, smaller)
+ assert_operator(flt, :<, bigger)
+ assert_operator(flt, :<=, bigger)
+ assert_equal(0, flt <=> int)
+ assert_equal(-1, flt <=> bigger)
+ assert_equal(1, flt <=> smaller)
+ assert_operator(int, :==, flt)
+ assert_operator(bigger, :>, flt)
+ assert_operator(bigger, :>=, flt)
+ assert_operator(smaller, :<, flt)
+ assert_operator(smaller, :<=, flt)
+ assert_equal(0, int <=> flt)
+ assert_equal(-1, smaller <=> flt)
+ assert_equal(1, bigger <=> flt)
+ [
+ [int, flt + 0.5, bigger],
+ [smaller, flt - 0.5, int]
+ ].each {|smaller2, flt2, bigger2|
+ next if flt2 == flt2.round
+ assert_operator(flt2, :!=, smaller2)
+ assert_operator(flt2, :!=, bigger2)
+ assert_operator(flt2, :>, smaller2)
+ assert_operator(flt2, :>=, smaller2)
+ assert_operator(flt2, :<, bigger2)
+ assert_operator(flt2, :<=, bigger2)
+ assert_equal(-1, flt2 <=> bigger2)
+ assert_equal(1, flt2 <=> smaller2)
+ assert_operator(smaller2, :!=, flt2)
+ assert_operator(bigger2, :!=, flt2)
+ assert_operator(bigger2, :>, flt2)
+ assert_operator(bigger2, :>=, flt2)
+ assert_operator(smaller2, :<, flt2)
+ assert_operator(smaller2, :<=, flt2)
+ assert_equal(-1, smaller2 <=> flt2)
+ assert_equal(1, bigger2 <=> flt2)
+ }
+ }
+ }
+ end
+
def test_strtod
a = Float("0")
assert(a.abs < Float::EPSILON)
@@ -106,10 +155,12 @@ class TestFloat < Test::Unit::TestCase
assert_equal(31.0*2**1019, Float("0x0."+("0"*600)+"1fp3427"))
assert_equal(-31.0*2**1019, Float("-0x0."+("0"*268)+"1fp2099"))
assert_equal(-31.0*2**1019, Float("-0x0."+("0"*600)+"1fp3427"))
- assert_equal(31.0*2**-1027, Float("0x1f"+("0"*268)+".0p-2099"))
- assert_equal(31.0*2**-1027, Float("0x1f"+("0"*600)+".0p-3427"))
- assert_equal(-31.0*2**-1027, Float("-0x1f"+("0"*268)+".0p-2099"))
- assert_equal(-31.0*2**-1027, Float("-0x1f"+("0"*600)+".0p-3427"))
+ suppress_warning do
+ assert_equal(31.0*2**-1027, Float("0x1f"+("0"*268)+".0p-2099"))
+ assert_equal(31.0*2**-1027, Float("0x1f"+("0"*600)+".0p-3427"))
+ assert_equal(-31.0*2**-1027, Float("-0x1f"+("0"*268)+".0p-2099"))
+ assert_equal(-31.0*2**-1027, Float("-0x1f"+("0"*600)+".0p-3427"))
+ end
end
def test_divmod
@@ -196,7 +247,7 @@ class TestFloat < Test::Unit::TestCase
end
def test_modulo3
- bug6044 = '[ruby-core:42726]'
+ bug6048 = '[ruby-core:42726]'
assert_equal(4.2, 4.2.send(:%, Float::INFINITY))
assert_equal(4.2, 4.2 % Float::INFINITY)
assert_is_minus_zero(-0.0 % 4.2)
@@ -464,15 +515,16 @@ class TestFloat < Test::Unit::TestCase
def test_round
VS.each {|f|
+ msg = "round(#{f})"
i = f.round
if f < 0
- assert_operator(i, :<, 0)
+ assert_operator(i, :<, 0, msg)
else
- assert_operator(i, :>, 0)
+ assert_operator(i, :>, 0, msg)
end
d = f - i
- assert_operator(-0.5, :<=, d)
- assert_operator(d, :<=, 0.5)
+ assert_operator(-0.5, :<=, d, msg)
+ assert_operator(d, :<=, 0.5, msg)
}
end
@@ -506,7 +558,7 @@ class TestFloat < Test::Unit::TestCase
end
def test_num2dbl
- assert_raise(TypeError) do
+ assert_raise(ArgumentError) do
1.0.step(2.0, "0.5") {}
end
assert_raise(TypeError) do
@@ -519,4 +571,52 @@ class TestFloat < Test::Unit::TestCase
sleep(0.1+0.1+0.1+0.1+0.1+0.1+0.1+0.1+0.1+0.1)
end
end
+
+ def test_step
+ 1000.times do
+ a = rand
+ b = a+rand*1000
+ s = (b - a) / 10
+ assert_equal(11, (a..b).step(s).to_a.length)
+ end
+
+ (1.0..12.7).step(1.3).each do |n|
+ assert_operator(n, :<=, 12.7)
+ end
+
+ assert_equal([5.0, 4.0, 3.0, 2.0], 5.0.step(1.5, -1).to_a)
+ end
+
+ def test_step2
+ assert_equal([0.0], 0.0.step(1.0, Float::INFINITY).to_a)
+ end
+
+ def test_step_excl
+ 1000.times do
+ a = rand
+ b = a+rand*1000
+ s = (b - a) / 10
+ assert_equal(10, (a...b).step(s).to_a.length)
+ end
+
+ assert_equal([1.0, 2.9, 4.8, 6.699999999999999], (1.0...6.8).step(1.9).to_a)
+
+ e = 1+1E-12
+ (1.0 ... e).step(1E-16) do |n|
+ assert_operator(n, :<=, e)
+ end
+ end
+
+ def test_singleton_method
+ # flonum on 64bit platform
+ assert_raise(TypeError) { a = 1.0; def a.foo; end }
+ # always not flonum
+ assert_raise(TypeError) { a = Float::INFINITY; def a.foo; end }
+ end
+
+ def test_long_string
+ assert_separately([], <<-'end;')
+ assert_in_epsilon(10.0, ("1."+"1"*300000).to_f*9)
+ end;
+ end
end
diff --git a/test/ruby/test_fnmatch.rb b/test/ruby/test_fnmatch.rb
index e5f5ba6a4f..15e5d79e35 100644
--- a/test/ruby/test_fnmatch.rb
+++ b/test/ruby/test_fnmatch.rb
@@ -1,4 +1,5 @@
require 'test/unit'
+require_relative 'envutil'
class TestFnmatch < Test::Unit::TestCase
@@ -10,97 +11,122 @@ class TestFnmatch < Test::Unit::TestCase
end
end
def test_fnmatch
- assert(File.fnmatch('\[1\]' , '[1]'), "[ruby-dev:22819]")
- assert(File.fnmatch('*?', 'a'), "[ruby-dev:22815]")
- assert(File.fnmatch('*/', 'a/'))
- assert(File.fnmatch('\[1\]' , '[1]', File::FNM_PATHNAME))
- assert(File.fnmatch('*?', 'a', File::FNM_PATHNAME))
- assert(File.fnmatch('*/', 'a/', File::FNM_PATHNAME))
+ assert_file.for("[ruby-dev:22819]").fnmatch('\[1\]' , '[1]')
+ assert_file.for("[ruby-dev:22815]").fnmatch('*?', 'a')
+ assert_file.fnmatch('*/', 'a/')
+ assert_file.fnmatch('\[1\]' , '[1]', File::FNM_PATHNAME)
+ assert_file.fnmatch('*?', 'a', File::FNM_PATHNAME)
+ assert_file.fnmatch('*/', 'a/', File::FNM_PATHNAME)
# text
- assert(File.fnmatch('cat', 'cat'))
- assert(!File.fnmatch('cat', 'category'))
- assert(!File.fnmatch('cat', 'wildcat'))
+ assert_file.fnmatch('cat', 'cat')
+ assert_file.not_fnmatch('cat', 'category')
+ assert_file.not_fnmatch('cat', 'wildcat')
# '?' matches any one character
- assert(File.fnmatch('?at', 'cat'))
- assert(File.fnmatch('c?t', 'cat'))
- assert(File.fnmatch('ca?', 'cat'))
- assert(File.fnmatch('?a?', 'cat'))
- assert(!File.fnmatch('c??t', 'cat'))
- assert(!File.fnmatch('??at', 'cat'))
- assert(!File.fnmatch('ca??', 'cat'))
+ assert_file.fnmatch('?at', 'cat')
+ assert_file.fnmatch('c?t', 'cat')
+ assert_file.fnmatch('ca?', 'cat')
+ assert_file.fnmatch('?a?', 'cat')
+ assert_file.not_fnmatch('c??t', 'cat')
+ assert_file.not_fnmatch('??at', 'cat')
+ assert_file.not_fnmatch('ca??', 'cat')
# '*' matches any number (including 0) of any characters
- assert(File.fnmatch('c*', 'cats'))
- assert(File.fnmatch('c*ts', 'cats'))
- assert(File.fnmatch('*ts', 'cats'))
- assert(File.fnmatch('*c*a*t*s*', 'cats'))
- assert(!File.fnmatch('c*t', 'cats'))
- assert(!File.fnmatch('*abc', 'abcabz'))
- assert(File.fnmatch('*abz', 'abcabz'))
- assert(!File.fnmatch('a*abc', 'abc'))
- assert(File.fnmatch('a*bc', 'abc'))
- assert(!File.fnmatch('a*bc', 'abcd'))
+ assert_file.fnmatch('c*', 'cats')
+ assert_file.fnmatch('c*ts', 'cats')
+ assert_file.fnmatch('*ts', 'cats')
+ assert_file.fnmatch('*c*a*t*s*', 'cats')
+ assert_file.not_fnmatch('c*t', 'cats')
+ assert_file.not_fnmatch('*abc', 'abcabz')
+ assert_file.fnmatch('*abz', 'abcabz')
+ assert_file.not_fnmatch('a*abc', 'abc')
+ assert_file.fnmatch('a*bc', 'abc')
+ assert_file.not_fnmatch('a*bc', 'abcd')
# [seq] : matches any character listed between bracket
# [!seq] or [^seq] : matches any character except those listed between bracket
bracket_test("bd-gikl-mosv-x", "bdefgiklmosvwx")
# escaping character
- assert(File.fnmatch('\?', '?'))
- assert(!File.fnmatch('\?', '\?'))
- assert(!File.fnmatch('\?', 'a'))
- assert(!File.fnmatch('\?', '\a'))
- assert(File.fnmatch('\*', '*'))
- assert(!File.fnmatch('\*', '\*'))
- assert(!File.fnmatch('\*', 'cats'))
- assert(!File.fnmatch('\*', '\cats'))
- assert(File.fnmatch('\a', 'a'))
- assert(!File.fnmatch('\a', '\a'))
- assert(File.fnmatch('[a\-c]', 'a'))
- assert(File.fnmatch('[a\-c]', '-'))
- assert(File.fnmatch('[a\-c]', 'c'))
- assert(!File.fnmatch('[a\-c]', 'b'))
- assert(!File.fnmatch('[a\-c]', '\\'))
+ assert_file.fnmatch('\?', '?')
+ assert_file.not_fnmatch('\?', '\?')
+ assert_file.not_fnmatch('\?', 'a')
+ assert_file.not_fnmatch('\?', '\a')
+ assert_file.fnmatch('\*', '*')
+ assert_file.not_fnmatch('\*', '\*')
+ assert_file.not_fnmatch('\*', 'cats')
+ assert_file.not_fnmatch('\*', '\cats')
+ assert_file.fnmatch('\a', 'a')
+ assert_file.not_fnmatch('\a', '\a')
+ assert_file.fnmatch('[a\-c]', 'a')
+ assert_file.fnmatch('[a\-c]', '-')
+ assert_file.fnmatch('[a\-c]', 'c')
+ assert_file.not_fnmatch('[a\-c]', 'b')
+ assert_file.not_fnmatch('[a\-c]', '\\')
# escaping character loses its meaning if FNM_NOESCAPE is set
- assert(!File.fnmatch('\?', '?', File::FNM_NOESCAPE))
- assert(File.fnmatch('\?', '\?', File::FNM_NOESCAPE))
- assert(!File.fnmatch('\?', 'a', File::FNM_NOESCAPE))
- assert(File.fnmatch('\?', '\a', File::FNM_NOESCAPE))
- assert(!File.fnmatch('\*', '*', File::FNM_NOESCAPE))
- assert(File.fnmatch('\*', '\*', File::FNM_NOESCAPE))
- assert(!File.fnmatch('\*', 'cats', File::FNM_NOESCAPE))
- assert(File.fnmatch('\*', '\cats', File::FNM_NOESCAPE))
- assert(!File.fnmatch('\a', 'a', File::FNM_NOESCAPE))
- assert(File.fnmatch('\a', '\a', File::FNM_NOESCAPE))
- assert(File.fnmatch('[a\-c]', 'a', File::FNM_NOESCAPE))
- assert(!File.fnmatch('[a\-c]', '-', File::FNM_NOESCAPE))
- assert(File.fnmatch('[a\-c]', 'c', File::FNM_NOESCAPE))
- assert(File.fnmatch('[a\-c]', 'b', File::FNM_NOESCAPE)) # '\\' < 'b' < 'c'
- assert(File.fnmatch('[a\-c]', '\\', File::FNM_NOESCAPE))
+ assert_file.not_fnmatch('\?', '?', File::FNM_NOESCAPE)
+ assert_file.fnmatch('\?', '\?', File::FNM_NOESCAPE)
+ assert_file.not_fnmatch('\?', 'a', File::FNM_NOESCAPE)
+ assert_file.fnmatch('\?', '\a', File::FNM_NOESCAPE)
+ assert_file.not_fnmatch('\*', '*', File::FNM_NOESCAPE)
+ assert_file.fnmatch('\*', '\*', File::FNM_NOESCAPE)
+ assert_file.not_fnmatch('\*', 'cats', File::FNM_NOESCAPE)
+ assert_file.fnmatch('\*', '\cats', File::FNM_NOESCAPE)
+ assert_file.not_fnmatch('\a', 'a', File::FNM_NOESCAPE)
+ assert_file.fnmatch('\a', '\a', File::FNM_NOESCAPE)
+ assert_file.fnmatch('[a\-c]', 'a', File::FNM_NOESCAPE)
+ assert_file.not_fnmatch('[a\-c]', '-', File::FNM_NOESCAPE)
+ assert_file.fnmatch('[a\-c]', 'c', File::FNM_NOESCAPE)
+ assert_file.fnmatch('[a\-c]', 'b', File::FNM_NOESCAPE) # '\\' < 'b' < 'c'
+ assert_file.fnmatch('[a\-c]', '\\', File::FNM_NOESCAPE)
# case is ignored if FNM_CASEFOLD is set
- assert(!File.fnmatch('cat', 'CAT'))
- assert(File.fnmatch('cat', 'CAT', File::FNM_CASEFOLD))
- assert(!File.fnmatch('[a-z]', 'D'))
- assert(File.fnmatch('[a-z]', 'D', File::FNM_CASEFOLD))
- assert(!File.fnmatch('[abc]', 'B'))
- assert(File.fnmatch('[abc]', 'B', File::FNM_CASEFOLD))
+ assert_file.not_fnmatch('cat', 'CAT')
+ assert_file.fnmatch('cat', 'CAT', File::FNM_CASEFOLD)
+ assert_file.not_fnmatch('[a-z]', 'D')
+ assert_file.fnmatch('[a-z]', 'D', File::FNM_CASEFOLD)
+ assert_file.not_fnmatch('[abc]', 'B')
+ assert_file.fnmatch('[abc]', 'B', File::FNM_CASEFOLD)
# wildcard doesn't match '/' if FNM_PATHNAME is set
- assert(File.fnmatch('foo?boo', 'foo/boo'))
- assert(File.fnmatch('foo*', 'foo/boo'))
- assert(!File.fnmatch('foo?boo', 'foo/boo', File::FNM_PATHNAME))
- assert(!File.fnmatch('foo*', 'foo/boo', File::FNM_PATHNAME))
+ assert_file.fnmatch('foo?boo', 'foo/boo')
+ assert_file.fnmatch('foo*', 'foo/boo')
+ assert_file.not_fnmatch('foo?boo', 'foo/boo', File::FNM_PATHNAME)
+ assert_file.not_fnmatch('foo*', 'foo/boo', File::FNM_PATHNAME)
# wildcard matches leading period if FNM_DOTMATCH is set
- assert(!File.fnmatch('*', '.profile'))
- assert(File.fnmatch('*', '.profile', File::FNM_DOTMATCH))
- assert(File.fnmatch('.*', '.profile'))
- assert(File.fnmatch('*', 'dave/.profile'))
- assert(File.fnmatch('*/*', 'dave/.profile'))
- assert(!File.fnmatch('*/*', 'dave/.profile', File::FNM_PATHNAME))
- assert(File.fnmatch('*/*', 'dave/.profile', File::FNM_PATHNAME | File::FNM_DOTMATCH))
+ assert_file.not_fnmatch('*', '.profile')
+ assert_file.fnmatch('*', '.profile', File::FNM_DOTMATCH)
+ assert_file.fnmatch('.*', '.profile')
+ assert_file.fnmatch('*', 'dave/.profile')
+ assert_file.fnmatch('*/*', 'dave/.profile')
+ assert_file.not_fnmatch('*/*', 'dave/.profile', File::FNM_PATHNAME)
+ assert_file.fnmatch('*/*', 'dave/.profile', File::FNM_PATHNAME | File::FNM_DOTMATCH)
# recursive matching
- assert(File.fnmatch('**/foo', 'a/b/c/foo', File::FNM_PATHNAME))
- assert(File.fnmatch('**/foo', '/foo', File::FNM_PATHNAME))
- assert(!File.fnmatch('**/foo', 'a/.b/c/foo', File::FNM_PATHNAME))
- assert(File.fnmatch('**/foo', 'a/.b/c/foo', File::FNM_PATHNAME | File::FNM_DOTMATCH))
- assert(File.fnmatch('**/foo', '/root/foo', File::FNM_PATHNAME))
- assert(File.fnmatch('**/foo', 'c:/root/foo', File::FNM_PATHNAME))
+ assert_file.fnmatch('**/foo', 'a/b/c/foo', File::FNM_PATHNAME)
+ assert_file.fnmatch('**/foo', '/foo', File::FNM_PATHNAME)
+ assert_file.not_fnmatch('**/foo', 'a/.b/c/foo', File::FNM_PATHNAME)
+ assert_file.fnmatch('**/foo', 'a/.b/c/foo', File::FNM_PATHNAME | File::FNM_DOTMATCH)
+ assert_file.fnmatch('**/foo', '/root/foo', File::FNM_PATHNAME)
+ assert_file.fnmatch('**/foo', 'c:/root/foo', File::FNM_PATHNAME)
end
+ def test_extglob
+ feature5422 = '[ruby-core:40037]'
+ assert_file.for(feature5422).not_fnmatch?( "{.g,t}*", ".gem")
+ assert_file.for(feature5422).fnmatch?("{.g,t}*", ".gem", File::FNM_EXTGLOB)
+ end
+
+ def test_unmatched_encoding
+ bug7911 = '[ruby-dev:47069] [Bug #7911]'
+ path = "\u{3042}"
+ pattern_ascii = 'a'.encode('US-ASCII')
+ pattern_eucjp = path.encode('EUC-JP')
+ assert_nothing_raised(ArgumentError, bug7911) do
+ assert_file.not_fnmatch(pattern_ascii, path)
+ assert_file.not_fnmatch(pattern_eucjp, path)
+ assert_file.not_fnmatch(pattern_ascii, path, File::FNM_CASEFOLD)
+ assert_file.not_fnmatch(pattern_eucjp, path, File::FNM_CASEFOLD)
+ assert_file.fnmatch("{*,#{pattern_ascii}}", path, File::FNM_EXTGLOB)
+ assert_file.fnmatch("{*,#{pattern_eucjp}}", path, File::FNM_EXTGLOB)
+ end
+ end
+
+ def test_unicode
+ assert_file.fnmatch("[a-\u3042]*", "\u3042")
+ assert_file.not_fnmatch("[a-\u3042]*", "\u3043")
+ end
end
diff --git a/test/ruby/test_gc.rb b/test/ruby/test_gc.rb
index f04e7e0255..4218dab888 100644
--- a/test/ruby/test_gc.rb
+++ b/test/ruby/test_gc.rb
@@ -64,11 +64,23 @@ class TestGc < Test::Unit::TestCase
assert_equal(arg, res)
assert_equal(false, res.empty?)
assert_kind_of(Integer, res[:count])
+
+ stat, count = {}, {}
+ GC.start
+ GC.stat(stat)
+ ObjectSpace.count_objects(count)
+ assert_equal(count[:TOTAL]-count[:FREE], stat[:heap_live_num])
+ assert_equal(count[:FREE], stat[:heap_free_num])
+
+ # measure again without GC.start
+ 1000.times{ "a" + "b" }
+ GC.stat(stat)
+ ObjectSpace.count_objects(count)
+ assert_equal(count[:FREE], stat[:heap_free_num])
end
def test_singleton_method
- prev_stress = GC.stress
- assert_nothing_raised("[ruby-dev:42832]") do
+ assert_in_out_err(%w[--disable-gems], <<-EOS, [], [], "[ruby-dev:42832]")
GC.stress = true
10.times do
obj = Object.new
@@ -76,9 +88,22 @@ class TestGc < Test::Unit::TestCase
def obj.bar() raise "obj.foo is called, but this is obj.bar" end
obj.foo
end
- end
- ensure
- GC.stress = prev_stress
+ EOS
+ end
+
+ def test_singleton_method_added
+ assert_in_out_err(%w[--disable-gems], <<-EOS, [], [], "[ruby-dev:44436]")
+ class BasicObject
+ undef singleton_method_added
+ def singleton_method_added(mid)
+ raise
+ end
+ end
+ b = proc {}
+ class << b; end
+ b.clone rescue nil
+ GC.start
+ EOS
end
def test_gc_parameter
@@ -95,7 +120,25 @@ class TestGc < Test::Unit::TestCase
assert_in_out_err([env, "-e", "exit"], "", [], [], "[ruby-core:39795]")
assert_in_out_err([env, "-W0", "-e", "exit"], "", [], [], "[ruby-core:39795]")
assert_in_out_err([env, "-W1", "-e", "exit"], "", [], [], "[ruby-core:39795]")
- assert_in_out_err([env, "-w", "-e", "exit"], "", [], /heap_min_slots=100000/, "[ruby-core:39795]")
+ assert_in_out_err([env, "-w", "-e", "exit"], "", [], /HEAP_MIN_SLOTS=100000/, "[ruby-core:39795]")
+
+ env = {
+ "RUBY_HEAP_SLOTS_GROWTH_FACTOR" => "2.0",
+ "RUBY_HEAP_SLOTS_GROWTH_MAX" => "10000"
+ }
+ assert_normal_exit("exit", "", :child_env => env)
+ assert_in_out_err([env, "-w", "-e", "exit"], "", [], /HEAP_SLOTS_GROWTH_FACTOR=2.0/, "")
+ assert_in_out_err([env, "-w", "-e", "exit"], "", [], /HEAP_SLOTS_GROWTH_MAX=10000/, "[ruby-core:57928]")
+
+ env = {
+ "RUBY_GC_MALLOC_LIMIT" => "60000000",
+ "RUBY_GC_MALLOC_LIMIT_MAX" => "160000000",
+ "RUBY_GC_MALLOC_LIMIT_GROWTH_FACTOR" => "2.0"
+ }
+ assert_normal_exit("exit", "", :child_env => env)
+ assert_in_out_err([env, "-w", "-e", "exit"], "", [], /RUBY_GC_MALLOC_LIMIT=6000000/, "")
+ assert_in_out_err([env, "-w", "-e", "exit"], "", [], /RUBY_GC_MALLOC_LIMIT_MAX=16000000/, "")
+ assert_in_out_err([env, "-w", "-e", "exit"], "", [], /RUBY_GC_MALLOC_LIMIT_GROWTH_FACTOR=2.0/, "")
end
def test_profiler_enabled
@@ -107,9 +150,49 @@ class TestGc < Test::Unit::TestCase
GC::Profiler.disable
end
+ def test_profiler_clear
+ assert_separately %w[--disable-gem], __FILE__, __LINE__, <<-'eom'
+ GC::Profiler.enable
+
+ GC.start
+ assert_equal(1, GC::Profiler.raw_data.size)
+ GC::Profiler.clear
+ assert_equal(0, GC::Profiler.raw_data.size)
+
+ 200.times{ GC.start }
+ assert_equal(200, GC::Profiler.raw_data.size)
+ GC::Profiler.clear
+ assert_equal(0, GC::Profiler.raw_data.size)
+ eom
+ end
+
+ def test_profiler_total_time
+ GC::Profiler.enable
+ GC::Profiler.clear
+
+ GC.start
+ assert_operator(GC::Profiler.total_time, :>, 0)
+ ensure
+ GC::Profiler.disable
+ end
+
def test_finalizing_main_thread
assert_in_out_err(%w[--disable-gems], <<-EOS, ["\"finalize\""], [], "[ruby-dev:46647]")
ObjectSpace.define_finalizer(Thread.main) { p 'finalize' }
EOS
end
+
+ def test_expand_heap
+ assert_separately %w[--disable-gem], __FILE__, __LINE__, <<-'eom'
+ base_length = GC.stat[:heap_length]
+ (base_length * 500).times{ 'a' }
+ GC.start
+ assert_equal base_length, GC.stat[:heap_length], "invalid heap expanding"
+
+ a = []
+ (base_length * 500).times{ a << 'a' }
+ GC.start
+ assert base_length < GC.stat[:heap_length]
+ eom
+ end
end
diff --git a/test/ruby/test_hash.rb b/test/ruby/test_hash.rb
index 82272cb301..c8cf5c6fbf 100644
--- a/test/ruby/test_hash.rb
+++ b/test/ruby/test_hash.rb
@@ -1,11 +1,13 @@
+# -*- coding: us-ascii -*-
require 'test/unit'
require 'continuation'
+require_relative 'envutil'
class TestHash < Test::Unit::TestCase
def test_hash
- x = {1=>2, 2=>4, 3=>6}
- y = {1=>2, 2=>4, 3=>6} # y = {1, 2, 2, 4, 3, 6} # 1.9 doesn't support
+ x = @cls[1=>2, 2=>4, 3=>6]
+ y = @cls[1=>2, 2=>4, 3=>6] # y = {1, 2, 2, 4, 3, 6} # 1.9 doesn't support
assert_equal(2, x[1])
@@ -19,8 +21,8 @@ class TestHash < Test::Unit::TestCase
end)
assert_equal(3, x.length)
- assert(x.has_key?(1))
- assert(x.has_value?(4))
+ assert_send([x, :has_key?, 1])
+ assert_send([x, :has_value?, 4])
assert_equal([4,6], x.values_at(2,3))
assert_equal({1=>2, 2=>4, 3=>6}, x)
@@ -77,7 +79,7 @@ class TestHash < Test::Unit::TestCase
# From rubicon
def setup
- @cls = Hash
+ @cls ||= Hash
@h = @cls[
1 => 'one', 2 => 'two', 3 => 'three',
self => 'self', true => 'true', nil => 'nil',
@@ -91,6 +93,30 @@ class TestHash < Test::Unit::TestCase
$VERBOSE = @verbose
end
+ def test_bad_initialize_copy
+ h = Class.new(Hash) {
+ def initialize_copy(h)
+ super(Object.new)
+ end
+ }.new
+ assert_raise(TypeError) { h.dup }
+ end
+
+ def test_clear_initialize_copy
+ h = @cls[1=>2]
+ h.instance_eval {initialize_copy({})}
+ assert_empty(h)
+ end
+
+ def test_dup_will_rehash
+ set1 = @cls[]
+ set2 = @cls[set1 => true]
+
+ set1[set1] = true
+
+ assert_equal set2, set2.dup
+ end
+
def test_s_AREF
h = @cls["a" => 100, "b" => 200]
assert_equal(100, h['a'])
@@ -188,17 +214,17 @@ class TestHash < Test::Unit::TestCase
h2 = @cls[ "a" => 1, "c" => 2, 7 => 35 ]
h3 = @cls[ "a" => 1, "c" => 2, 7 => 35 ]
h4 = @cls[ ]
- assert(h1 == h1)
- assert(h2 == h2)
- assert(h3 == h3)
- assert(h4 == h4)
- assert(!(h1 == h2))
- assert(h2 == h3)
- assert(!(h3 == h4))
+ assert_equal(h1, h1)
+ assert_equal(h2, h2)
+ assert_equal(h3, h3)
+ assert_equal(h4, h4)
+ assert_not_equal(h1, h2)
+ assert_equal(h2, h3)
+ assert_not_equal(h3, h4)
end
def test_clear
- assert(@h.size > 0)
+ assert_operator(@h.size, :>, 0)
@h.clear
assert_equal(0, @h.size)
assert_nil(@h[1])
@@ -206,20 +232,16 @@ class TestHash < Test::Unit::TestCase
def test_clone
for taint in [ false, true ]
- for untrust in [ false, true ]
- for frozen in [ false, true ]
- a = @h.clone
- a.taint if taint
- a.untrust if untrust
- a.freeze if frozen
- b = a.clone
-
- assert_equal(a, b)
- assert(a.__id__ != b.__id__)
- assert_equal(a.frozen?, b.frozen?)
- assert_equal(a.untrusted?, b.untrusted?)
- assert_equal(a.tainted?, b.tainted?)
- end
+ for frozen in [ false, true ]
+ a = @h.clone
+ a.taint if taint
+ a.freeze if frozen
+ b = a.clone
+
+ assert_equal(a, b)
+ assert_not_same(a, b)
+ assert_equal(a.frozen?, b.frozen?)
+ assert_equal(a.tainted?, b.tainted?)
end
end
end
@@ -291,31 +313,37 @@ class TestHash < Test::Unit::TestCase
end
def test_keep_if
- h = {1=>2,3=>4,5=>6}
+ h = @cls[1=>2,3=>4,5=>6]
assert_equal({3=>4,5=>6}, h.keep_if {|k, v| k + v >= 7 })
- h = {1=>2,3=>4,5=>6}
+ h = @cls[1=>2,3=>4,5=>6]
assert_equal({1=>2,3=>4,5=>6}, h.keep_if{true})
end
def test_dup
for taint in [ false, true ]
- for untrust in [ false, true ]
- for frozen in [ false, true ]
- a = @h.dup
- a.taint if taint
- a.freeze if frozen
- b = a.dup
-
- assert_equal(a, b)
- assert(a.__id__ != b.__id__)
- assert_equal(false, b.frozen?)
- assert_equal(a.tainted?, b.tainted?)
- assert_equal(a.untrusted?, b.untrusted?)
- end
+ for frozen in [ false, true ]
+ a = @h.dup
+ a.taint if taint
+ a.freeze if frozen
+ b = a.dup
+
+ assert_equal(a, b)
+ assert_not_same(a, b)
+ assert_equal(false, b.frozen?)
+ assert_equal(a.tainted?, b.tainted?)
end
end
end
+ def test_dup_equality
+ h = @cls['k' => 'v']
+ assert_equal(h, h.dup)
+ h1 = @cls[h => 1]
+ assert_equal(h1, h1.dup)
+ h[1] = 2
+ assert_equal(h1, h1.dup)
+ end
+
def test_each
count = 0
@cls[].each { |k, v| count + 1 }
@@ -326,6 +354,11 @@ class TestHash < Test::Unit::TestCase
assert_equal(v, h.delete(k))
end
assert_equal(@cls[], h)
+
+ h = @cls[]
+ h[1] = 1
+ h[2] = 2
+ assert_equal([[1,1],[2,2]], h.each.to_a)
end
def test_each_key
@@ -368,8 +401,8 @@ class TestHash < Test::Unit::TestCase
end
def test_empty?
- assert(@cls[].empty?)
- assert(!@h.empty?)
+ assert_empty(@cls[])
+ assert_not_empty(@h)
end
def test_fetch
@@ -390,27 +423,27 @@ class TestHash < Test::Unit::TestCase
end
def test_key2?
- assert(!@cls[].key?(1))
- assert(!@cls[].key?(nil))
- assert(@h.key?(nil))
- assert(@h.key?(1))
- assert(!@h.key?('gumby'))
+ assert_not_send([@cls[], :key?, 1])
+ assert_not_send([@cls[], :key?, nil])
+ assert_send([@h, :key?, nil])
+ assert_send([@h, :key?, 1])
+ assert_not_send([@h, :key?, 'gumby'])
end
def test_value?
- assert(!@cls[].value?(1))
- assert(!@cls[].value?(nil))
- assert(@h.value?('one'))
- assert(@h.value?(nil))
- assert(!@h.value?('gumby'))
+ assert_not_send([@cls[], :value?, 1])
+ assert_not_send([@cls[], :value?, nil])
+ assert_send([@h, :value?, 'one'])
+ assert_send([@h, :value?, nil])
+ assert_not_send([@h, :value?, 'gumby'])
end
def test_include?
- assert(!@cls[].include?(1))
- assert(!@cls[].include?(nil))
- assert(@h.include?(nil))
- assert(@h.include?(1))
- assert(!@h.include?('gumby'))
+ assert_not_send([@cls[], :include?, 1])
+ assert_not_send([@cls[], :include?, nil])
+ assert_send([@h, :include?, nil])
+ assert_send([@h, :include?, 1])
+ assert_not_send([@h, :include?, 'gumby'])
end
def test_key
@@ -424,11 +457,11 @@ class TestHash < Test::Unit::TestCase
def test_values_at
res = @h.values_at('dog', 'cat', 'horse')
- assert(res.length == 3)
+ assert_equal(3, res.length)
assert_equal([nil, nil, nil], res)
res = @h.values_at
- assert(res.length == 0)
+ assert_equal(0, res.length)
res = @h.values_at(3, 2, 1, nil)
assert_equal 4, res.length
@@ -447,7 +480,7 @@ class TestHash < Test::Unit::TestCase
assert_equal(nil, h['nil'])
h.each do |k, v|
- assert(@h.key?(v)) # not true in general, but works here
+ assert_send([@h, :key?, v]) # not true in general, but works here
end
h = @cls[ 'a' => 1, 'b' => 2, 'c' => 1].invert
@@ -457,11 +490,11 @@ class TestHash < Test::Unit::TestCase
end
def test_key?
- assert(!@cls[].key?(1))
- assert(!@cls[].key?(nil))
- assert(@h.key?(nil))
- assert(@h.key?(1))
- assert(!@h.key?('gumby'))
+ assert_not_send([@cls[], :key?, 1])
+ assert_not_send([@cls[], :key?, nil])
+ assert_send([@h, :key?, nil])
+ assert_send([@h, :key?, 1])
+ assert_not_send([@h, :key?, 'gumby'])
end
def test_keys
@@ -480,11 +513,11 @@ class TestHash < Test::Unit::TestCase
end
def test_member?
- assert(!@cls[].member?(1))
- assert(!@cls[].member?(nil))
- assert(@h.member?(nil))
- assert(@h.member?(1))
- assert(!@h.member?('gumby'))
+ assert_not_send([@cls[], :member?, 1])
+ assert_not_send([@cls[], :member?, nil])
+ assert_send([@h, :member?, nil])
+ assert_send([@h, :member?, 1])
+ assert_not_send([@h, :member?, 'gumby'])
end
def test_rehash
@@ -555,7 +588,7 @@ class TestHash < Test::Unit::TestCase
@h.length.times {
k, v = h.shift
- assert(@h.key?(k))
+ assert_send([@h, :key?, k])
assert_equal(@h[k], v)
}
@@ -622,15 +655,27 @@ class TestHash < Test::Unit::TestCase
h = @cls[ 1=>2, 3=>4, 5=>6 ]
h.taint
- h.untrust
a = h.to_a
assert_equal(true, a.tainted?)
- assert_equal(true, a.untrusted?)
end
def test_to_hash
h = @h.to_hash
assert_equal(@h, h)
+ assert_instance_of(@cls, h)
+ end
+
+ def test_to_h
+ h = @h.to_h
+ assert_equal(@h, h)
+ assert_instance_of(Hash, h)
+ end
+
+ def test_nil_to_h
+ h = nil.to_h
+ assert_equal({}, h)
+ assert_nil(h.default)
+ assert_nil(h.default_proc)
end
def test_to_s
@@ -662,11 +707,11 @@ class TestHash < Test::Unit::TestCase
end
def test_value2?
- assert(!@cls[].value?(1))
- assert(!@cls[].value?(nil))
- assert(@h.value?(nil))
- assert(@h.value?('one'))
- assert(!@h.value?('gumby'))
+ assert_not_send([@cls[], :value?, 1])
+ assert_not_send([@cls[], :value?, nil])
+ assert_send([@h, :value?, nil])
+ assert_send([@h, :value?, 'one'])
+ assert_not_send([@h, :value?, 'gumby'])
end
def test_values
@@ -679,16 +724,6 @@ class TestHash < Test::Unit::TestCase
assert_equal([], expected - vals)
end
- def test_security_check
- h = {}
- assert_raise(SecurityError) do
- Thread.new do
- $SAFE = 4
- h[1] = 1
- end.join
- end
- end
-
def test_intialize_wrong_arguments
assert_raise(ArgumentError) do
Hash.new(0) { }
@@ -696,19 +731,22 @@ class TestHash < Test::Unit::TestCase
end
def test_create
- assert_equal({1=>2, 3=>4}, Hash[[[1,2],[3,4]]])
+ assert_equal({1=>2, 3=>4}, @cls[[[1,2],[3,4]]])
assert_raise(ArgumentError) { Hash[0, 1, 2] }
- assert_equal({1=>2, 3=>4}, Hash[1,2,3,4])
+ assert_warning(/wrong element type Fixnum at 1 /) {@cls[[[1, 2], 3]]}
+ bug5406 = '[ruby-core:39945]'
+ assert_raise(ArgumentError, bug5406) { @cls[[[1, 2], [3, 4, 5]]] }
+ assert_equal({1=>2, 3=>4}, @cls[1,2,3,4])
o = Object.new
def o.to_hash() {1=>2} end
- assert_equal({1=>2}, Hash[o], "[ruby-dev:34555]")
+ assert_equal({1=>2}, @cls[o], "[ruby-dev:34555]")
end
def test_rehash2
- h = {1 => 2, 3 => 4}
+ h = @cls[1 => 2, 3 => 4]
assert_equal(h.dup, h.rehash)
assert_raise(RuntimeError) { h.each { h.rehash } }
- assert_equal({}, {}.rehash)
+ assert_equal({}, @cls[].rehash)
end
def test_fetch2
@@ -716,57 +754,69 @@ class TestHash < Test::Unit::TestCase
end
def test_default_proc
- h = Hash.new {|hh, k| hh + k + "baz" }
+ h = @cls.new {|hh, k| hh + k + "baz" }
assert_equal("foobarbaz", h.default_proc.call("foo", "bar"))
- h = {}
+ assert_nil(h.default_proc = nil)
+ assert_nil(h.default_proc)
+ h.default_proc = ->(h, k){ true }
+ assert(h[:nope])
+ h = @cls[]
assert_nil(h.default_proc)
end
def test_shift2
- h = Hash.new {|hh, k| :foo }
+ h = @cls.new {|hh, k| :foo }
h[1] = 2
assert_equal([1, 2], h.shift)
assert_equal(:foo, h.shift)
assert_equal(:foo, h.shift)
- h = Hash.new(:foo)
+ h = @cls.new(:foo)
h[1] = 2
assert_equal([1, 2], h.shift)
assert_equal(:foo, h.shift)
assert_equal(:foo, h.shift)
- h = {1=>2}
+ h =@cls[1=>2]
h.each { assert_equal([1, 2], h.shift) }
end
+ def test_shift_none
+ h = @cls.new {|hh, k| "foo"}
+ def h.default(k = nil)
+ super.upcase
+ end
+ assert_equal("FOO", h.shift)
+ end
+
def test_reject_bang2
- assert_equal({1=>2}, {1=>2,3=>4}.reject! {|k, v| k + v == 7 })
- assert_nil({1=>2,3=>4}.reject! {|k, v| k == 5 })
- assert_nil({}.reject! { })
+ assert_equal({1=>2}, @cls[1=>2,3=>4].reject! {|k, v| k + v == 7 })
+ assert_nil(@cls[1=>2,3=>4].reject! {|k, v| k == 5 })
+ assert_nil(@cls[].reject! { })
end
def test_select
- assert_equal({3=>4,5=>6}, {1=>2,3=>4,5=>6}.select {|k, v| k + v >= 7 })
+ assert_equal({3=>4,5=>6}, @cls[1=>2,3=>4,5=>6].select {|k, v| k + v >= 7 })
end
def test_select!
- h = {1=>2,3=>4,5=>6}
+ h = @cls[1=>2,3=>4,5=>6]
assert_equal(h, h.select! {|k, v| k + v >= 7 })
assert_equal({3=>4,5=>6}, h)
- h = {1=>2,3=>4,5=>6}
+ h = @cls[1=>2,3=>4,5=>6]
assert_equal(nil, h.select!{true})
end
def test_clear2
- assert_equal({}, {1=>2,3=>4,5=>6}.clear)
- h = {1=>2,3=>4,5=>6}
+ assert_equal({}, @cls[1=>2,3=>4,5=>6].clear)
+ h = @cls[1=>2,3=>4,5=>6]
h.each { h.clear }
assert_equal({}, h)
end
def test_replace2
- h1 = Hash.new { :foo }
- h2 = {}
+ h1 = @cls.new { :foo }
+ h2 = @cls.new
h2.replace h1
assert_equal(:foo, h2[0])
@@ -779,71 +829,91 @@ class TestHash < Test::Unit::TestCase
end
def test_size2
- assert_equal(0, {}.size)
+ assert_equal(0, @cls[].size)
end
def test_equal2
- assert({} != 0)
+ assert_not_equal(0, @cls[])
o = Object.new
- def o.to_hash; {}; end
+ o.instance_variable_set(:@cls, @cls)
+ def o.to_hash; @cls[]; end
def o.==(x); true; end
- assert({} == o)
+ assert_equal({}, o)
def o.==(x); false; end
- assert({} != o)
+ assert_not_equal({}, o)
- h1 = {1=>2}; h2 = {3=>4}
- assert(h1 != h2)
- h1 = {1=>2}; h2 = {1=>4}
- assert(h1 != h2)
+ h1 = @cls[1=>2]; h2 = @cls[3=>4]
+ assert_not_equal(h1, h2)
+ h1 = @cls[1=>2]; h2 = @cls[1=>4]
+ assert_not_equal(h1, h2)
end
def test_eql
- assert(!({}.eql?(0)))
+ assert_not_send([@cls[], :eql?, 0])
o = Object.new
- def o.to_hash; {}; end
+ o.instance_variable_set(:@cls, @cls)
+ def o.to_hash; @cls[]; end
def o.eql?(x); true; end
- assert({}.eql?(o))
+ assert_send([@cls[], :eql?, o])
def o.eql?(x); false; end
- assert(!({}.eql?(o)))
+ assert_not_send([@cls[], :eql?, o])
end
def test_hash2
- assert_kind_of(Integer, {}.hash)
- h = {1=>2}
+ assert_kind_of(Integer, @cls[].hash)
+ h = @cls[1=>2]
h.shift
assert_equal({}.hash, h.hash, '[ruby-core:38650]')
end
def test_update2
- h1 = {1=>2, 3=>4}
+ h1 = @cls[1=>2, 3=>4]
h2 = {1=>3, 5=>7}
h1.update(h2) {|k, v1, v2| k + v1 + v2 }
assert_equal({1=>6, 3=>4, 5=>7}, h1)
end
def test_merge
- h1 = {1=>2, 3=>4}
+ h1 = @cls[1=>2, 3=>4]
h2 = {1=>3, 5=>7}
assert_equal({1=>3, 3=>4, 5=>7}, h1.merge(h2))
assert_equal({1=>6, 3=>4, 5=>7}, h1.merge(h2) {|k, v1, v2| k + v1 + v2 })
end
def test_assoc
- assert_equal([3,4], {1=>2, 3=>4, 5=>6}.assoc(3))
- assert_nil({1=>2, 3=>4, 5=>6}.assoc(4))
+ assert_equal([3,4], @cls[1=>2, 3=>4, 5=>6].assoc(3))
+ assert_nil(@cls[1=>2, 3=>4, 5=>6].assoc(4))
+ assert_equal([1.0,1], @cls[1.0=>1].assoc(1))
+ end
+
+ def test_assoc_compare_by_identity
+ h = @cls[]
+ h.compare_by_identity
+ h["a"] = 1
+ h["a"] = 2
+ assert_equal(["a",1], h.assoc("a"))
end
def test_rassoc
- assert_equal([3,4], {1=>2, 3=>4, 5=>6}.rassoc(4))
+ assert_equal([3,4], @cls[1=>2, 3=>4, 5=>6].rassoc(4))
assert_nil({1=>2, 3=>4, 5=>6}.rassoc(3))
end
def test_flatten
- assert_equal([[1], [2]], {[1] => [2]}.flatten)
+ assert_equal([[1], [2]], @cls[[1] => [2]].flatten)
+
+ a = @cls[1=> "one", 2 => [2,"two"], 3 => [3, ["three"]]]
+ assert_equal([1, "one", 2, [2, "two"], 3, [3, ["three"]]], a.flatten)
+ assert_equal([1, "one", 2, [2, "two"], 3, [3, ["three"]]], a.flatten(-1))
+ assert_equal([1, "one", 2, [2, "two"], 3, [3, ["three"]]], a.flatten(0))
+ assert_equal([1, "one", 2, [2, "two"], 3, [3, ["three"]]], a.flatten(1))
+ assert_equal([1, "one", 2, 2, "two", 3, 3, ["three"]], a.flatten(2))
+ assert_equal([1, "one", 2, 2, "two", 3, 3, "three"], a.flatten(3))
+ assert_raise(TypeError){ a.flatten(Object) }
end
def test_callcc
- h = {1=>2}
+ h = @cls[1=>2]
c = nil
f = false
h.each { callcc {|c2| c = c2 } }
@@ -853,7 +923,7 @@ class TestHash < Test::Unit::TestCase
end
assert_raise(RuntimeError) { h.each { h.rehash } }
- h = {1=>2}
+ h = @cls[1=>2]
c = nil
assert_raise(RuntimeError) do
h.each { callcc {|c2| c = c2 } }
@@ -862,15 +932,84 @@ class TestHash < Test::Unit::TestCase
end
end
+ def test_callcc_iter_level
+ bug9105 = '[ruby-dev:47803] [Bug #9105]'
+ h = @cls[1=>2, 3=>4]
+ c = nil
+ f = false
+ h.each {callcc {|c2| c = c2}}
+ unless f
+ f = true
+ c.call
+ end
+ assert_nothing_raised(RuntimeError, bug9105) do
+ h.each {|i, j|
+ h.delete(i);
+ assert_not_equal(false, i, bug9105)
+ }
+ end
+ end
+
+ def test_callcc_escape
+ bug9105 = '[ruby-dev:47803] [Bug #9105]'
+ assert_nothing_raised(RuntimeError, bug9105) do
+ h=@cls[]
+ cnt=0
+ c = callcc {|c|c}
+ h[cnt] = true
+ h.each{|i|
+ cnt+=1
+ c.call if cnt == 1
+ }
+ end
+ end
+
+ def test_callcc_reenter
+ bug9105 = '[ruby-dev:47803] [Bug #9105]'
+ assert_nothing_raised(RuntimeError, bug9105) do
+ h = @cls[1=>2,3=>4]
+ c = nil
+ f = false
+ h.each { |i|
+ callcc {|c2| c = c2 } unless c
+ h.delete(1) if f
+ }
+ unless f
+ f = true
+ c.call
+ end
+ end
+ end
+
+ def test_threaded_iter_level
+ bug9105 = '[ruby-dev:47807] [Bug #9105]'
+ h = @cls[1=>2]
+ 2.times.map {
+ f = false
+ th = Thread.start {h.each {f = true; sleep}}
+ Thread.pass until f
+ Thread.pass until th.stop?
+ th
+ }.each {|th| th.run; th.join}
+ assert_nothing_raised(RuntimeError, bug9105) do
+ h[5] = 6
+ end
+ assert_equal(6, h[5], bug9105)
+ end
+
def test_compare_by_identity
a = "foo"
- assert(!{}.compare_by_identity?)
- h = { a => "bar" }
- assert(!h.compare_by_identity?)
+ assert_not_predicate(@cls[], :compare_by_identity?)
+ h = @cls[a => "bar"]
+ assert_not_predicate(h, :compare_by_identity?)
h.compare_by_identity
- assert(h.compare_by_identity?)
+ assert_predicate(h, :compare_by_identity?)
#assert_equal("bar", h[a])
assert_nil(h["foo"])
+
+ bug8703 = '[ruby-core:56256] [Bug #8703] copied identhash'
+ h.clear
+ assert_predicate(h.dup, :compare_by_identity?, bug8703)
end
class ObjWithHash
@@ -886,29 +1025,29 @@ class TestHash < Test::Unit::TestCase
end
def test_hash_hash
- assert_equal({0=>2,11=>1}.hash, {11=>1,0=>2}.hash)
+ assert_equal({0=>2,11=>1}.hash, @cls[11=>1,0=>2].hash)
o1 = ObjWithHash.new(0,1)
o2 = ObjWithHash.new(11,1)
- assert_equal({o1=>1,o2=>2}.hash, {o2=>2,o1=>1}.hash)
+ assert_equal({o1=>1,o2=>2}.hash, @cls[o2=>2,o1=>1].hash)
end
def test_hash_bignum_hash
x = 2<<(32-3)-1
- assert_equal({x=>1}.hash, {x=>1}.hash)
+ assert_equal({x=>1}.hash, @cls[x=>1].hash)
x = 2<<(64-3)-1
- assert_equal({x=>1}.hash, {x=>1}.hash)
+ assert_equal({x=>1}.hash, @cls[x=>1].hash)
o = Object.new
def o.hash; 2 << 100; end
- assert_equal({x=>1}.hash, {x=>1}.hash)
+ assert_equal({o=>1}.hash, @cls[o=>1].hash)
end
def test_hash_poped
- assert_nothing_raised { eval("a = 1; {a => a}; a") }
+ assert_nothing_raised { eval("a = 1; @cls[a => a]; a") }
end
def test_recursive_key
- h = {}
+ h = @cls[]
assert_nothing_raised { h[h] = :foo }
h.rehash
assert_equal(:foo, h[h])
@@ -916,8 +1055,18 @@ class TestHash < Test::Unit::TestCase
def test_inverse_hash
feature4262 = '[ruby-core:34334]'
- [{1=>2}, {123=>"abc"}].each do |h|
+ [@cls[1=>2], @cls[123=>"abc"]].each do |h|
assert_not_equal(h.hash, h.invert.hash, feature4262)
end
end
+
+ class TestSubHash < TestHash
+ class SubHash < Hash
+ end
+
+ def setup
+ @cls = SubHash
+ super
+ end
+ end
end
diff --git a/test/ruby/test_ifunless.rb b/test/ruby/test_ifunless.rb
index bffc794512..e144ff8efd 100644
--- a/test/ruby/test_ifunless.rb
+++ b/test/ruby/test_ifunless.rb
@@ -2,13 +2,13 @@ require 'test/unit'
class TestIfunless < Test::Unit::TestCase
def test_if_unless
- $x = 'test';
- assert(if $x == $x then true else false end)
- $bad = false
- unless $x == $x
- $bad = true
+ x = 'test';
+ assert(if x == x then true else false end)
+ bad = false
+ unless x == x
+ bad = true
end
- assert(!$bad)
- assert(unless $x != $x then true else false end)
+ assert(!bad)
+ assert(unless x != x then true else false end)
end
end
diff --git a/test/ruby/test_integer.rb b/test/ruby/test_integer.rb
index 7f8212ebf0..e23b3929a0 100644
--- a/test/ruby/test_integer.rb
+++ b/test/ruby/test_integer.rb
@@ -90,6 +90,13 @@ class TestInteger < Test::Unit::TestCase
assert_equal(2 ** 50, Integer(2.0 ** 50))
assert_raise(TypeError) { Integer(nil) }
+
+ bug6192 = '[ruby-core:43566]'
+ assert_raise(Encoding::CompatibilityError, bug6192) {Integer("0".encode("utf-16be"))}
+ assert_raise(Encoding::CompatibilityError, bug6192) {Integer("0".encode("utf-16le"))}
+ assert_raise(Encoding::CompatibilityError, bug6192) {Integer("0".encode("utf-32be"))}
+ assert_raise(Encoding::CompatibilityError, bug6192) {Integer("0".encode("utf-32le"))}
+ assert_raise(Encoding::CompatibilityError, bug6192) {Integer("0".encode("iso-2022-jp"))}
end
def test_int_p
@@ -198,4 +205,76 @@ class TestInteger < Test::Unit::TestCase
assert_equal(-1111_1111_1111_1111_1111_1111_1111_1110, (-1111_1111_1111_1111_1111_1111_1111_1111).round(-1))
assert_equal(Bignum, (-1111_1111_1111_1111_1111_1111_1111_1111).round(-1).class)
end
+
+ def test_bitwise_and_with_integer_mimic_object
+ def (obj = Object.new).to_int
+ 10
+ end
+ assert_raise(TypeError, '[ruby-core:39491]') { 3 & obj }
+
+ def obj.coerce(other)
+ [other, 10]
+ end
+ assert_equal(3 & 10, 3 & obj)
+ end
+
+ def test_bitwise_or_with_integer_mimic_object
+ def (obj = Object.new).to_int
+ 10
+ end
+ assert_raise(TypeError, '[ruby-core:39491]') { 3 | obj }
+
+ def obj.coerce(other)
+ [other, 10]
+ end
+ assert_equal(3 | 10, 3 | obj)
+ end
+
+ def test_bitwise_xor_with_integer_mimic_object
+ def (obj = Object.new).to_int
+ 10
+ end
+ assert_raise(TypeError, '[ruby-core:39491]') { 3 ^ obj }
+
+ def obj.coerce(other)
+ [other, 10]
+ end
+ assert_equal(3 ^ 10, 3 ^ obj)
+ end
+
+ def test_bit_length
+ assert_equal(13, (-2**12-1).bit_length)
+ assert_equal(12, (-2**12).bit_length)
+ assert_equal(12, (-2**12+1).bit_length)
+ assert_equal(9, -0x101.bit_length)
+ assert_equal(8, -0x100.bit_length)
+ assert_equal(8, -0xff.bit_length)
+ assert_equal(1, -2.bit_length)
+ assert_equal(0, -1.bit_length)
+ assert_equal(0, 0.bit_length)
+ assert_equal(1, 1.bit_length)
+ assert_equal(8, 0xff.bit_length)
+ assert_equal(9, 0x100.bit_length)
+ assert_equal(9, 0x101.bit_length)
+ assert_equal(12, (2**12-1).bit_length)
+ assert_equal(13, (2**12).bit_length)
+ assert_equal(13, (2**12+1).bit_length)
+
+ assert_equal(10001, (-2**10000-1).bit_length)
+ assert_equal(10000, (-2**10000).bit_length)
+ assert_equal(10000, (-2**10000+1).bit_length)
+ assert_equal(10000, (2**10000-1).bit_length)
+ assert_equal(10001, (2**10000).bit_length)
+ assert_equal(10001, (2**10000+1).bit_length)
+
+ 2.upto(1000) {|i|
+ n = 2**i
+ assert_equal(i+1, (-n-1).bit_length, "(#{-n-1}).bit_length")
+ assert_equal(i, (-n).bit_length, "(#{-n}).bit_length")
+ assert_equal(i, (-n+1).bit_length, "(#{-n+1}).bit_length")
+ assert_equal(i, (n-1).bit_length, "#{n-1}.bit_length")
+ assert_equal(i+1, (n).bit_length, "#{n}.bit_length")
+ assert_equal(i+1, (n+1).bit_length, "#{n+1}.bit_length")
+ }
+ end
end
diff --git a/test/ruby/test_integer_comb.rb b/test/ruby/test_integer_comb.rb
index c057deb36f..548102d034 100644
--- a/test/ruby/test_integer_comb.rb
+++ b/test/ruby/test_integer_comb.rb
@@ -106,6 +106,8 @@ class TestIntegerComb < Test::Unit::TestCase
]
#VS.map! {|v| 0x4000000000000000.coerce(v)[0] }
+ #VS.concat VS.find_all {|v| Fixnum === v }.map {|v| 0x4000000000000000.coerce(v)[0] }
+ #VS.sort! {|a, b| a.abs <=> b.abs }
min = -1
min *= 2 while min.class == Fixnum
@@ -185,6 +187,7 @@ class TestIntegerComb < Test::Unit::TestCase
c = a * b
check_class(c)
assert_equal(b * a, c, "#{a} * #{b}")
+ assert_equal(b.send(:*, a), c, "#{a} * #{b}")
assert_equal(b, c / a, "(#{a} * #{b}) / #{a}") if a != 0
assert_equal(a.abs * b.abs, (a * b).abs, "(#{a} * #{b}).abs")
assert_equal((a-100)*(b-100)+(a-100)*100+(b-100)*100+10000, c, "#{a} * #{b}")
diff --git a/test/ruby/test_io.rb b/test/ruby/test_io.rb
index da6c904028..c86384ee0b 100644
--- a/test/ruby/test_io.rb
+++ b/test/ruby/test_io.rb
@@ -1,3 +1,4 @@
+# coding: US-ASCII
require 'test/unit'
require 'tmpdir'
require "fcntl"
@@ -10,19 +11,22 @@ require 'weakref'
require_relative 'envutil'
class TestIO < Test::Unit::TestCase
- def have_close_on_exec?
- begin
+ module Feature
+ def have_close_on_exec?
$stdin.close_on_exec?
true
rescue NotImplementedError
false
end
- end
- def have_nonblock?
- IO.method_defined?("nonblock=")
+ def have_nonblock?
+ IO.method_defined?("nonblock=")
+ end
end
+ include Feature
+ extend Feature
+
def pipe(wp, rp)
re, we = nil, nil
r, w = IO.pipe
@@ -205,25 +209,26 @@ class TestIO < Test::Unit::TestCase
end
def test_ungetbyte
- t = make_tempfile
- t.open
- t.binmode
- t.ungetbyte(0x41)
- assert_equal(-1, t.pos)
- assert_equal(0x41, t.getbyte)
- t.rewind
- assert_equal(0, t.pos)
- t.ungetbyte("qux")
- assert_equal(-3, t.pos)
- assert_equal("quxfoo\n", t.gets)
- assert_equal(4, t.pos)
- t.set_encoding("utf-8")
- t.ungetbyte(0x89)
- t.ungetbyte(0x8e)
- t.ungetbyte("\xe7")
- t.ungetbyte("\xe7\xb4\x85")
- assert_equal(-2, t.pos)
- assert_equal("\u7d05\u7389bar\n", t.gets)
+ make_tempfile {|t|
+ t.open
+ t.binmode
+ t.ungetbyte(0x41)
+ assert_equal(-1, t.pos)
+ assert_equal(0x41, t.getbyte)
+ t.rewind
+ assert_equal(0, t.pos)
+ t.ungetbyte("qux")
+ assert_equal(-3, t.pos)
+ assert_equal("quxfoo\n", t.gets)
+ assert_equal(4, t.pos)
+ t.set_encoding("utf-8")
+ t.ungetbyte(0x89)
+ t.ungetbyte(0x8e)
+ t.ungetbyte("\xe7")
+ t.ungetbyte("\xe7\xb4\x85")
+ assert_equal(-2, t.pos)
+ assert_equal("\u7d05\u7389bar\n", t.gets)
+ }
end
def test_each_byte
@@ -237,23 +242,38 @@ class TestIO < Test::Unit::TestCase
end
def test_each_byte_with_seek
- t = make_tempfile
- bug5119 = '[ruby-core:38609]'
- i = 0
- open(t.path) do |f|
- f.each_byte {i = f.pos}
- end
- assert_equal(12, i, bug5119)
+ make_tempfile {|t|
+ bug5119 = '[ruby-core:38609]'
+ i = 0
+ open(t.path) do |f|
+ f.each_byte {i = f.pos}
+ end
+ assert_equal(12, i, bug5119)
+ }
end
def test_each_codepoint
- t = make_tempfile
- bug2959 = '[ruby-core:28650]'
- a = ""
- File.open(t, 'rt') {|f|
- f.each_codepoint {|c| a << c}
+ make_tempfile {|t|
+ bug2959 = '[ruby-core:28650]'
+ a = ""
+ File.open(t, 'rt') {|f|
+ f.each_codepoint {|c| a << c}
+ }
+ assert_equal("foo\nbar\nbaz\n", a, bug2959)
+ }
+ end
+
+ def test_codepoints
+ make_tempfile {|t|
+ bug2959 = '[ruby-core:28650]'
+ a = ""
+ File.open(t, 'rt') {|f|
+ assert_warn(/deprecated/) {
+ f.codepoints {|c| a << c}
+ }
+ }
+ assert_equal("foo\nbar\nbaz\n", a, bug2959)
}
- assert_equal("foo\nbar\nbaz\n", a, bug2959)
end
def test_rubydev33072
@@ -265,63 +285,100 @@ class TestIO < Test::Unit::TestCase
end
end
- def test_copy_stream
+ def with_srccontent(content = "baz")
+ src = "src"
mkcdtmpdir {
+ File.open(src, "w") {|f| f << content }
+ yield src, content
+ }
+ end
- content = "foobar"
- File.open("src", "w") {|f| f << content }
- ret = IO.copy_stream("src", "dst")
+ def test_copy_stream_small
+ with_srccontent("foobar") {|src, content|
+ ret = IO.copy_stream(src, "dst")
assert_equal(content.bytesize, ret)
assert_equal(content, File.read("dst"))
+ }
+ end
+
+ def test_copy_stream_smaller
+ with_srccontent {|src, content|
# overwrite by smaller file.
- content = "baz"
- File.open("src", "w") {|f| f << content }
- ret = IO.copy_stream("src", "dst")
+ dst = "dst"
+ File.open(dst, "w") {|f| f << "foobar"}
+
+ ret = IO.copy_stream(src, dst)
assert_equal(content.bytesize, ret)
- assert_equal(content, File.read("dst"))
+ assert_equal(content, File.read(dst))
- ret = IO.copy_stream("src", "dst", 2)
+ ret = IO.copy_stream(src, dst, 2)
assert_equal(2, ret)
- assert_equal(content[0,2], File.read("dst"))
+ assert_equal(content[0,2], File.read(dst))
- ret = IO.copy_stream("src", "dst", 0)
+ ret = IO.copy_stream(src, dst, 0)
assert_equal(0, ret)
- assert_equal("", File.read("dst"))
+ assert_equal("", File.read(dst))
- ret = IO.copy_stream("src", "dst", nil, 1)
+ ret = IO.copy_stream(src, dst, nil, 1)
assert_equal(content.bytesize-1, ret)
- assert_equal(content[1..-1], File.read("dst"))
+ assert_equal(content[1..-1], File.read(dst))
+ }
+ end
+ def test_copy_stream_noent
+ with_srccontent {|src, content|
assert_raise(Errno::ENOENT) {
IO.copy_stream("nodir/foo", "dst")
}
assert_raise(Errno::ENOENT) {
- IO.copy_stream("src", "nodir/bar")
+ IO.copy_stream(src, "nodir/bar")
}
+ }
+ end
+ def test_copy_stream_pipe
+ with_srccontent {|src, content|
pipe(proc do |w|
- ret = IO.copy_stream("src", w)
+ ret = IO.copy_stream(src, w)
assert_equal(content.bytesize, ret)
w.close
end, proc do |r|
assert_equal(content, r.read)
end)
+ }
+ end
+ def test_copy_stream_write_pipe
+ with_srccontent {|src, content|
with_pipe {|r, w|
w.close
- assert_raise(IOError) { IO.copy_stream("src", w) }
+ assert_raise(IOError) { IO.copy_stream(src, w) }
}
+ }
+ end
+
+ def with_pipecontent
+ mkcdtmpdir {
+ yield "abc"
+ }
+ end
- pipe_content = "abc"
+ def test_copy_stream_pipe_to_file
+ with_pipecontent {|pipe_content|
+ dst = "dst"
with_read_pipe(pipe_content) {|r|
- ret = IO.copy_stream(r, "dst")
+ ret = IO.copy_stream(r, dst)
assert_equal(pipe_content.bytesize, ret)
- assert_equal(pipe_content, File.read("dst"))
+ assert_equal(pipe_content, File.read(dst))
}
+ }
+ end
- with_read_pipe("abc") {|r1|
+ def test_copy_stream_read_pipe
+ with_pipecontent {|pipe_content|
+ with_read_pipe(pipe_content) {|r1|
assert_equal("a", r1.getc)
pipe(proc do |w2|
w2.sync = false
@@ -334,7 +391,7 @@ class TestIO < Test::Unit::TestCase
end)
}
- with_read_pipe("abc") {|r1|
+ with_read_pipe(pipe_content) {|r1|
assert_equal("a", r1.getc)
pipe(proc do |w2|
w2.sync = false
@@ -347,7 +404,7 @@ class TestIO < Test::Unit::TestCase
end)
}
- with_read_pipe("abc") {|r1|
+ with_read_pipe(pipe_content) {|r1|
assert_equal("a", r1.getc)
pipe(proc do |w2|
ret = IO.copy_stream(r1, w2)
@@ -358,7 +415,7 @@ class TestIO < Test::Unit::TestCase
end)
}
- with_read_pipe("abc") {|r1|
+ with_read_pipe(pipe_content) {|r1|
assert_equal("a", r1.getc)
pipe(proc do |w2|
ret = IO.copy_stream(r1, w2, 1)
@@ -369,7 +426,7 @@ class TestIO < Test::Unit::TestCase
end)
}
- with_read_pipe("abc") {|r1|
+ with_read_pipe(pipe_content) {|r1|
assert_equal("a", r1.getc)
pipe(proc do |w2|
ret = IO.copy_stream(r1, w2, 0)
@@ -394,16 +451,24 @@ class TestIO < Test::Unit::TestCase
assert_equal("bcdef", r2.read)
end)
end)
+ }
+ end
+ def test_copy_stream_file_to_pipe
+ with_srccontent {|src, content|
pipe(proc do |w|
- ret = IO.copy_stream("src", w, 1, 1)
+ ret = IO.copy_stream(src, w, 1, 1)
assert_equal(1, ret)
w.close
end, proc do |r|
assert_equal(content[1,1], r.read)
end)
+ }
+ end
- if have_nonblock?
+ if have_nonblock?
+ def test_copy_stream_pipe_nonblock
+ mkcdtmpdir {
with_read_pipe("abc") {|r1|
assert_equal("a", r1.getc)
with_pipe {|r2, w2|
@@ -421,25 +486,51 @@ class TestIO < Test::Unit::TestCase
assert_equal("a" * s + "bc", t.value)
}
}
- end
+ }
+ end
+ end
- bigcontent = "abc" * 123456
- File.open("bigsrc", "w") {|f| f << bigcontent }
- ret = IO.copy_stream("bigsrc", "bigdst")
+ def with_bigcontent
+ yield "abc" * 123456
+ end
+
+ def with_bigsrc
+ mkcdtmpdir {
+ with_bigcontent {|bigcontent|
+ bigsrc = "bigsrc"
+ File.open("bigsrc", "w") {|f| f << bigcontent }
+ yield bigsrc, bigcontent
+ }
+ }
+ end
+
+ def test_copy_stream_bigcontent
+ with_bigsrc {|bigsrc, bigcontent|
+ ret = IO.copy_stream(bigsrc, "bigdst")
assert_equal(bigcontent.bytesize, ret)
assert_equal(bigcontent, File.read("bigdst"))
+ }
+ end
- File.unlink("bigdst")
- ret = IO.copy_stream("bigsrc", "bigdst", nil, 100)
+ def test_copy_stream_bigcontent_chop
+ with_bigsrc {|bigsrc, bigcontent|
+ ret = IO.copy_stream(bigsrc, "bigdst", nil, 100)
assert_equal(bigcontent.bytesize-100, ret)
assert_equal(bigcontent[100..-1], File.read("bigdst"))
+ }
+ end
- File.unlink("bigdst")
- ret = IO.copy_stream("bigsrc", "bigdst", 30000, 100)
+ def test_copy_stream_bigcontent_mid
+ with_bigsrc {|bigsrc, bigcontent|
+ ret = IO.copy_stream(bigsrc, "bigdst", 30000, 100)
assert_equal(30000, ret)
assert_equal(bigcontent[100, 30000], File.read("bigdst"))
+ }
+ end
- File.open("bigsrc") {|f|
+ def test_copy_stream_bigcontent_fpos
+ with_bigsrc {|bigsrc, bigcontent|
+ File.open(bigsrc) {|f|
begin
assert_equal(0, f.pos)
ret = IO.copy_stream(f, "bigdst", nil, 10)
@@ -454,16 +545,35 @@ class TestIO < Test::Unit::TestCase
#skip "pread(2) is not implemtented."
end
}
+ }
+ end
+ def test_copy_stream_closed_pipe
+ with_srccontent {|src,|
with_pipe {|r, w|
w.close
- assert_raise(IOError) { IO.copy_stream("src", w) }
+ assert_raise(IOError) { IO.copy_stream(src, w) }
}
+ }
+ end
- megacontent = "abc" * 1234567
- File.open("megasrc", "w") {|f| f << megacontent }
+ def with_megacontent
+ yield "abc" * 1234567
+ end
- if have_nonblock?
+ def with_megasrc
+ mkcdtmpdir {
+ with_megacontent {|megacontent|
+ megasrc = "megasrc"
+ File.open(megasrc, "w") {|f| f << megacontent }
+ yield megasrc, megacontent
+ }
+ }
+ end
+
+ if have_nonblock?
+ def test_copy_stream_megacontent_nonblock
+ with_megacontent {|megacontent|
with_pipe {|r1, w1|
with_pipe {|r2, w2|
begin
@@ -481,8 +591,12 @@ class TestIO < Test::Unit::TestCase
assert_equal(megacontent, t2.value)
}
}
- end
+ }
+ end
+ end
+ def test_copy_stream_megacontent_pipe_to_file
+ with_megasrc {|megasrc, megacontent|
with_pipe {|r1, w1|
with_pipe {|r2, w2|
t1 = Thread.new { w1 << megacontent; w1.close }
@@ -494,10 +608,14 @@ class TestIO < Test::Unit::TestCase
assert_equal(megacontent, t2.value)
}
}
+ }
+ end
+ def test_copy_stream_megacontent_file_to_pipe
+ with_megasrc {|megasrc, megacontent|
with_pipe {|r, w|
t = Thread.new { r.read }
- ret = IO.copy_stream("megasrc", w)
+ ret = IO.copy_stream(megasrc, w)
assert_equal(megacontent.bytesize, ret)
w.close
assert_equal(megacontent, t.value)
@@ -534,42 +652,46 @@ class TestIO < Test::Unit::TestCase
end
end
- def test_copy_stream_socket
- return unless defined? UNIXSocket
- mkcdtmpdir {
-
- content = "foobar"
- File.open("src", "w") {|f| f << content }
-
+ def test_copy_stream_socket1
+ with_srccontent("foobar") {|src, content|
with_socketpair {|s1, s2|
- ret = IO.copy_stream("src", s1)
+ ret = IO.copy_stream(src, s1)
assert_equal(content.bytesize, ret)
s1.close
assert_equal(content, s2.read)
}
+ }
+ end if defined? UNIXSocket
- bigcontent = "abc" * 123456
- File.open("bigsrc", "w") {|f| f << bigcontent }
-
+ def test_copy_stream_socket2
+ with_bigsrc {|bigsrc, bigcontent|
with_socketpair {|s1, s2|
t = Thread.new { s2.read }
- ret = IO.copy_stream("bigsrc", s1)
+ ret = IO.copy_stream(bigsrc, s1)
assert_equal(bigcontent.bytesize, ret)
s1.close
result = t.value
assert_equal(bigcontent, result)
}
+ }
+ end if defined? UNIXSocket
+ def test_copy_stream_socket3
+ with_bigsrc {|bigsrc, bigcontent|
with_socketpair {|s1, s2|
t = Thread.new { s2.read }
- ret = IO.copy_stream("bigsrc", s1, 10000)
+ ret = IO.copy_stream(bigsrc, s1, 10000)
assert_equal(10000, ret)
s1.close
result = t.value
assert_equal(bigcontent[0,10000], result)
}
+ }
+ end if defined? UNIXSocket
- File.open("bigsrc") {|f|
+ def test_copy_stream_socket4
+ with_bigsrc {|bigsrc, bigcontent|
+ File.open(bigsrc) {|f|
assert_equal(0, f.pos)
with_socketpair {|s1, s2|
t = Thread.new { s2.read }
@@ -581,8 +703,12 @@ class TestIO < Test::Unit::TestCase
assert_equal(bigcontent[100..-1], result)
}
}
+ }
+ end if defined? UNIXSocket
- File.open("bigsrc") {|f|
+ def test_copy_stream_socket5
+ with_bigsrc {|bigsrc, bigcontent|
+ File.open(bigsrc) {|f|
assert_equal(bigcontent[0,100], f.read(100))
assert_equal(100, f.pos)
with_socketpair {|s1, s2|
@@ -595,54 +721,65 @@ class TestIO < Test::Unit::TestCase
assert_equal(bigcontent[100..-1], result)
}
}
+ }
+ end if defined? UNIXSocket
+ def test_copy_stream_socket6
+ mkcdtmpdir {
megacontent = "abc" * 1234567
File.open("megasrc", "w") {|f| f << megacontent }
- if have_nonblock?
- with_socketpair {|s1, s2|
- begin
- s1.nonblock = true
- rescue Errno::EBADF
- skip "nonblocking IO for pipe is not implemented"
- end
- t = Thread.new { s2.read }
- ret = IO.copy_stream("megasrc", s1)
- assert_equal(megacontent.bytesize, ret)
- s1.close
- result = t.value
- assert_equal(megacontent, result)
- }
- with_socketpair {|s1, s2|
+ with_socketpair {|s1, s2|
+ begin
+ s1.nonblock = true
+ rescue Errno::EBADF
+ skip "nonblocking IO for pipe is not implemented"
+ end
+ t = Thread.new { s2.read }
+ ret = IO.copy_stream("megasrc", s1)
+ assert_equal(megacontent.bytesize, ret)
+ s1.close
+ result = t.value
+ assert_equal(megacontent, result)
+ }
+ }
+ end if defined? UNIXSocket
+
+ def test_copy_stream_socket7
+ GC.start
+ mkcdtmpdir {
+ megacontent = "abc" * 1234567
+ File.open("megasrc", "w") {|f| f << megacontent }
+
+ with_socketpair {|s1, s2|
+ begin
+ s1.nonblock = true
+ rescue Errno::EBADF
+ skip "nonblocking IO for pipe is not implemented"
+ end
+ trapping_usr1 do
+ nr = 30
begin
- s1.nonblock = true
- rescue Errno::EBADF
- skip "nonblocking IO for pipe is not implemented"
- end
- trapping_usr1 do
- nr = 30
- begin
- pid = fork do
- s1.close
- IO.select([s2])
- Process.kill(:USR1, Process.ppid)
- s2.read
- end
- s2.close
- nr.times do
- assert_equal megacontent.bytesize, IO.copy_stream("megasrc", s1)
- end
- assert_equal(1, @usr1_rcvd)
- ensure
+ pid = fork do
s1.close
- _, status = Process.waitpid2(pid) if pid
+ IO.select([s2])
+ Process.kill(:USR1, Process.ppid)
+ s2.read
end
- assert status.success?, status.inspect
+ s2.close
+ nr.times do
+ assert_equal megacontent.bytesize, IO.copy_stream("megasrc", s1)
+ end
+ assert_equal(1, @usr1_rcvd)
+ ensure
+ s1.close
+ _, status = Process.waitpid2(pid) if pid
end
- }
- end
+ assert status.success?, status.inspect
+ end
+ }
}
- end
+ end if defined? UNIXSocket and IO.method_defined?("nonblock=")
def test_copy_stream_strio
src = StringIO.new("abcd")
@@ -720,6 +857,47 @@ class TestIO < Test::Unit::TestCase
}
end
+ def test_copy_stream_write_in_binmode
+ bug8767 = '[ruby-core:56518] [Bug #8767]'
+ mkcdtmpdir {
+ EnvUtil.with_default_internal(Encoding::UTF_8) do
+ # StringIO to object with to_path
+ bytes = "\xDE\xAD\xBE\xEF".force_encoding(Encoding::ASCII_8BIT)
+ src = StringIO.new(bytes)
+ dst = Object.new
+ def dst.to_path
+ "qux"
+ end
+ assert_nothing_raised(bug8767) {
+ IO.copy_stream(src, dst)
+ }
+ assert_equal(bytes, File.binread("qux"), bug8767)
+ assert_equal(4, src.pos, bug8767)
+ end
+ }
+ end
+
+ def test_copy_stream_read_in_binmode
+ bug8767 = '[ruby-core:56518] [Bug #8767]'
+ mkcdtmpdir {
+ EnvUtil.with_default_internal(Encoding::UTF_8) do
+ # StringIO to object with to_path
+ bytes = "\xDE\xAD\xBE\xEF".force_encoding(Encoding::ASCII_8BIT)
+ File.binwrite("qux", bytes)
+ dst = StringIO.new
+ src = Object.new
+ def src.to_path
+ "qux"
+ end
+ assert_nothing_raised(bug8767) {
+ IO.copy_stream(src, dst)
+ }
+ assert_equal(bytes, dst.string.b, bug8767)
+ assert_equal(4, dst.pos, bug8767)
+ end
+ }
+ end
+
class Rot13IO
def initialize(io)
@io = io
@@ -827,6 +1005,28 @@ class TestIO < Test::Unit::TestCase
}
end
+ class Bug5237
+ attr_reader :count
+ def initialize
+ @count = 0
+ end
+
+ def read(bytes, buffer)
+ @count += 1
+ buffer.replace "this is a test"
+ nil
+ end
+ end
+
+ def test_copy_stream_broken_src_read_eof
+ src = Bug5237.new
+ dst = StringIO.new
+ assert_equal 0, src.count
+ th = Thread.new { IO.copy_stream(src, dst) }
+ flunk("timeout") unless th.join(10)
+ assert_equal 1, src.count
+ end
+
def test_copy_stream_dst_rbuf
mkcdtmpdir {
pipe(proc do |w|
@@ -845,24 +1045,18 @@ class TestIO < Test::Unit::TestCase
}
end
- def safe_4
- t = Thread.new do
- $SAFE = 4
- yield
- end
- unless t.join(10)
- t.kill
- flunk("timeout in safe_4")
- end
- end
-
def ruby(*args)
args = ['-e', '$>.write($<.read)'] if args.empty?
ruby = EnvUtil.rubybin
f = IO.popen([ruby] + args, 'r+')
+ pid = f.pid
yield(f)
ensure
f.close unless !f || f.closed?
+ begin
+ Process.wait(pid)
+ rescue Errno::ECHILD, Errno::ESRCH
+ end
end
def test_try_convert
@@ -928,9 +1122,6 @@ class TestIO < Test::Unit::TestCase
def test_inspect
with_pipe do |r, w|
assert_match(/^#<IO:fd \d+>$/, r.inspect)
- assert_raise(SecurityError) do
- safe_4 { r.inspect }
- end
end
end
@@ -950,7 +1141,7 @@ class TestIO < Test::Unit::TestCase
with_pipe do |r, w|
s = ""
t = Thread.new { r.readpartial(5, s) }
- Thread.pass until s.size == 5
+ Thread.pass until t.stop?
assert_raise(RuntimeError) { s.clear }
w.write "foobarbaz"
w.close
@@ -969,6 +1160,27 @@ class TestIO < Test::Unit::TestCase
}
end
+ def test_readpartial_with_not_empty_buffer
+ pipe(proc do |w|
+ w.write "foob"
+ w.close
+ end, proc do |r|
+ r.readpartial(5, s = "01234567")
+ assert_equal("foob", s)
+ end)
+ end
+
+ def test_readpartial_buffer_error
+ with_pipe do |r, w|
+ s = ""
+ t = Thread.new { r.readpartial(5, s) }
+ Thread.pass until t.stop?
+ t.kill
+ t.value
+ assert_equal("", s)
+ end
+ end
+
def test_read
pipe(proc do |w|
w.write "foobarbaz"
@@ -985,7 +1197,7 @@ class TestIO < Test::Unit::TestCase
with_pipe do |r, w|
s = ""
t = Thread.new { r.read(5, s) }
- Thread.pass until s.size == 5
+ Thread.pass until t.stop?
assert_raise(RuntimeError) { s.clear }
w.write "foobarbaz"
w.close
@@ -993,6 +1205,27 @@ class TestIO < Test::Unit::TestCase
end
end
+ def test_read_with_not_empty_buffer
+ pipe(proc do |w|
+ w.write "foob"
+ w.close
+ end, proc do |r|
+ r.read(nil, s = "01234567")
+ assert_equal("foob", s)
+ end)
+ end
+
+ def test_read_buffer_error
+ with_pipe do |r, w|
+ s = ""
+ t = Thread.new { r.read(5, s) }
+ Thread.pass until t.stop?
+ t.kill
+ t.value
+ assert_equal("", s)
+ end
+ end
+
def test_write_nonblock
skip "IO#write_nonblock is not supported on file/pipe." if /mswin|bccwin|mingw/ =~ RUBY_PLATFORM
pipe(proc do |w|
@@ -1003,6 +1236,26 @@ class TestIO < Test::Unit::TestCase
end)
end
+ def test_read_nonblock_with_not_empty_buffer
+ skip "IO#read_nonblock is not supported on file/pipe." if /mswin|bccwin|mingw/ =~ RUBY_PLATFORM
+ with_pipe {|r, w|
+ w.write "foob"
+ w.close
+ r.read_nonblock(5, s = "01234567")
+ assert_equal("foob", s)
+ }
+ end
+
+ def test_write_nonblock_simple_no_exceptions
+ skip "IO#write_nonblock is not supported on file/pipe." if /mswin|bccwin|mingw/ =~ RUBY_PLATFORM
+ pipe(proc do |w|
+ w.write_nonblock('1', exception: false)
+ w.close
+ end, proc do |r|
+ assert_equal("1", r.read)
+ end)
+ end
+
def test_read_nonblock_error
return if !have_nonblock?
skip "IO#read_nonblock is not supported on file/pipe." if /mswin|bccwin|mingw/ =~ RUBY_PLATFORM
@@ -1013,6 +1266,41 @@ class TestIO < Test::Unit::TestCase
assert_kind_of(IO::WaitReadable, $!)
end
}
+
+ with_pipe {|r, w|
+ begin
+ r.read_nonblock 4096, ""
+ rescue Errno::EWOULDBLOCK
+ assert_kind_of(IO::WaitReadable, $!)
+ end
+ }
+ end
+
+ def test_read_nonblock_no_exceptions
+ return if !have_nonblock?
+ skip "IO#read_nonblock is not supported on file/pipe." if /mswin|bccwin|mingw/ =~ RUBY_PLATFORM
+ with_pipe {|r, w|
+ assert_equal :wait_readable, r.read_nonblock(4096, exception: false)
+ w.puts "HI!"
+ assert_equal "HI!\n", r.read_nonblock(4096, exception: false)
+ w.close
+ assert_equal nil, r.read_nonblock(4096, exception: false)
+ }
+ end
+
+ def test_read_nonblock_with_buffer_no_exceptions
+ return if !have_nonblock?
+ skip "IO#read_nonblock is not supported on file/pipe." if /mswin|bccwin|mingw/ =~ RUBY_PLATFORM
+ with_pipe {|r, w|
+ assert_equal :wait_readable, r.read_nonblock(4096, "", exception: false)
+ w.puts "HI!"
+ buf = "buf"
+ value = r.read_nonblock(4096, buf, exception: false)
+ assert_equal value, "HI!\n"
+ assert buf.equal?(value)
+ w.close
+ assert_equal nil, r.read_nonblock(4096, "", exception: false)
+ }
end
def test_write_nonblock_error
@@ -1029,13 +1317,27 @@ class TestIO < Test::Unit::TestCase
}
end
+ def test_write_nonblock_no_exceptions
+ return if !have_nonblock?
+ skip "IO#write_nonblock is not supported on file/pipe." if /mswin|bccwin|mingw/ =~ RUBY_PLATFORM
+ with_pipe {|r, w|
+ loop {
+ ret = w.write_nonblock("a"*100000, exception: false)
+ if ret.is_a?(Symbol)
+ assert_equal :wait_writable, ret
+ break
+ end
+ }
+ }
+ end
+
def test_gets
pipe(proc do |w|
w.write "foobarbaz"
w.close
end, proc do |r|
assert_equal("", r.gets(0))
- assert_equal("foobarbaz", s = r.gets(9))
+ assert_equal("foobarbaz", r.gets(9))
end)
end
@@ -1054,14 +1356,6 @@ class TestIO < Test::Unit::TestCase
end
end
- def test_close_read_security_error
- with_pipe do |r, w|
- assert_raise(SecurityError) do
- safe_4 { r.close_read }
- end
- end
- end
-
def test_close_read_non_readable
with_pipe do |r, w|
assert_raise(IOError) do
@@ -1078,18 +1372,23 @@ class TestIO < Test::Unit::TestCase
end
end
- def test_close_write_security_error
+ def test_close_write_non_readable
with_pipe do |r, w|
- assert_raise(SecurityError) do
- safe_4 { r.close_write }
+ assert_raise(IOError) do
+ r.close_write
end
end
end
- def test_close_write_non_readable
- with_pipe do |r, w|
- assert_raise(IOError) do
- r.close_write
+ def test_close_read_write_separately
+ bug = '[ruby-list:49598]'
+ (1..10).each do |i|
+ assert_nothing_raised(IOError, "#{bug} trying ##{i}") do
+ IO.popen(EnvUtil.rubybin, "r+") {|f|
+ th = Thread.new {f.close_write}
+ f.close_read
+ th.join
+ }
end
end
end
@@ -1110,6 +1409,17 @@ class TestIO < Test::Unit::TestCase
assert_raise(IOError) { pipe.pid }
end
+ def test_pid_after_close_read
+ pid1 = pid2 = nil
+ IO.popen("exit ;", "r+") do |io|
+ pid1 = io.pid
+ io.close_read
+ pid2 = io.pid
+ end
+ assert_not_nil(pid1)
+ assert_equal(pid1, pid2)
+ end
+
def make_tempfile
t = Tempfile.new("test_io")
t.binmode
@@ -1117,42 +1427,50 @@ class TestIO < Test::Unit::TestCase
t.puts "bar"
t.puts "baz"
t.close
- t
+ if block_given?
+ begin
+ yield t
+ ensure
+ t.close(true)
+ end
+ else
+ t
+ end
end
def test_set_lineno
- t = make_tempfile
-
- ruby("-e", <<-SRC, t.path) do |f|
- open(ARGV[0]) do |f|
- p $.
- f.gets; p $.
- f.gets; p $.
- f.lineno = 1000; p $.
- f.gets; p $.
- f.gets; p $.
- f.rewind; p $.
- f.gets; p $.
- f.gets; p $.
- f.gets; p $.
- f.gets; p $.
+ make_tempfile {|t|
+ ruby("-e", <<-SRC, t.path) do |f|
+ open(ARGV[0]) do |f|
+ p $.
+ f.gets; p $.
+ f.gets; p $.
+ f.lineno = 1000; p $.
+ f.gets; p $.
+ f.gets; p $.
+ f.rewind; p $.
+ f.gets; p $.
+ f.gets; p $.
+ f.gets; p $.
+ f.gets; p $.
+ end
+ SRC
+ assert_equal("0,1,2,2,1001,1001,1001,1,2,3,3", f.read.chomp.gsub("\n", ","))
end
- SRC
- assert_equal("0,1,2,2,1001,1001,1001,1,2,3,3", f.read.chomp.gsub("\n", ","))
- end
- pipe(proc do |w|
- w.puts "foo"
- w.puts "bar"
- w.puts "baz"
- w.close
- end, proc do |r|
- r.gets; assert_equal(1, $.)
- r.gets; assert_equal(2, $.)
- r.lineno = 1000; assert_equal(2, $.)
- r.gets; assert_equal(1001, $.)
- r.gets; assert_equal(1001, $.)
- end)
+ pipe(proc do |w|
+ w.puts "foo"
+ w.puts "bar"
+ w.puts "baz"
+ w.close
+ end, proc do |r|
+ r.gets; assert_equal(1, $.)
+ r.gets; assert_equal(2, $.)
+ r.lineno = 1000; assert_equal(2, $.)
+ r.gets; assert_equal(1001, $.)
+ r.gets; assert_equal(1001, $.)
+ end)
+ }
end
def test_readline
@@ -1184,21 +1502,28 @@ class TestIO < Test::Unit::TestCase
end
def test_lines
+ verbose, $VERBOSE = $VERBOSE, nil
pipe(proc do |w|
w.puts "foo"
w.puts "bar"
w.puts "baz"
w.close
end, proc do |r|
- e = r.lines
+ e = nil
+ assert_warn(/deprecated/) {
+ e = r.lines
+ }
assert_equal("foo\n", e.next)
assert_equal("bar\n", e.next)
assert_equal("baz\n", e.next)
assert_raise(StopIteration) { e.next }
end)
+ ensure
+ $VERBOSE = verbose
end
def test_bytes
+ verbose, $VERBOSE = $VERBOSE, nil
pipe(proc do |w|
w.binmode
w.puts "foo"
@@ -1206,27 +1531,38 @@ class TestIO < Test::Unit::TestCase
w.puts "baz"
w.close
end, proc do |r|
- e = r.bytes
+ e = nil
+ assert_warn(/deprecated/) {
+ e = r.bytes
+ }
(%w(f o o) + ["\n"] + %w(b a r) + ["\n"] + %w(b a z) + ["\n"]).each do |c|
assert_equal(c.ord, e.next)
end
assert_raise(StopIteration) { e.next }
end)
+ ensure
+ $VERBOSE = verbose
end
def test_chars
+ verbose, $VERBOSE = $VERBOSE, nil
pipe(proc do |w|
w.puts "foo"
w.puts "bar"
w.puts "baz"
w.close
end, proc do |r|
- e = r.chars
+ e = nil
+ assert_warn(/deprecated/) {
+ e = r.chars
+ }
(%w(f o o) + ["\n"] + %w(b a r) + ["\n"] + %w(b a z) + ["\n"]).each do |c|
assert_equal(c, e.next)
end
assert_raise(StopIteration) { e.next }
end)
+ ensure
+ $VERBOSE = verbose
end
def test_readbyte
@@ -1262,6 +1598,8 @@ class TestIO < Test::Unit::TestCase
def test_close_on_exec
skip "IO\#close_on_exec is not implemented." unless have_close_on_exec?
ruby do |f|
+ assert_equal(true, f.close_on_exec?)
+ f.close_on_exec = false
assert_equal(false, f.close_on_exec?)
f.close_on_exec = true
assert_equal(true, f.close_on_exec?)
@@ -1270,12 +1608,16 @@ class TestIO < Test::Unit::TestCase
end
with_pipe do |r, w|
+ assert_equal(true, r.close_on_exec?)
+ r.close_on_exec = false
assert_equal(false, r.close_on_exec?)
r.close_on_exec = true
assert_equal(true, r.close_on_exec?)
r.close_on_exec = false
assert_equal(false, r.close_on_exec?)
+ assert_equal(true, w.close_on_exec?)
+ w.close_on_exec = false
assert_equal(false, w.close_on_exec?)
w.close_on_exec = true
assert_equal(true, w.close_on_exec?)
@@ -1284,132 +1626,215 @@ class TestIO < Test::Unit::TestCase
end
end
- def test_close_security_error
- with_pipe do |r, w|
- assert_raise(SecurityError) do
- safe_4 { r.close }
- end
- end
- end
-
def test_pos
- t = make_tempfile
+ make_tempfile {|t|
- open(t.path, IO::RDWR|IO::CREAT|IO::TRUNC, 0600) do |f|
- f.write "Hello"
- assert_equal(5, f.pos)
- end
- open(t.path, IO::RDWR|IO::CREAT|IO::TRUNC, 0600) do |f|
- f.sync = true
- f.read
- f.write "Hello"
- assert_equal(5, f.pos)
- end
+ open(t.path, IO::RDWR|IO::CREAT|IO::TRUNC, 0600) do |f|
+ f.write "Hello"
+ assert_equal(5, f.pos)
+ end
+ open(t.path, IO::RDWR|IO::CREAT|IO::TRUNC, 0600) do |f|
+ f.sync = true
+ f.read
+ f.write "Hello"
+ assert_equal(5, f.pos)
+ end
+ }
end
def test_pos_with_getc
bug6179 = '[ruby-core:43497]'
- t = make_tempfile
- ["", "t", "b"].each do |mode|
- open(t.path, "w#{mode}") do |f|
- f.write "0123456789\n"
- end
-
- open(t.path, "r#{mode}") do |f|
- assert_equal 0, f.pos, "mode=r#{mode}"
- assert_equal '0', f.getc, "mode=r#{mode}"
- assert_equal 1, f.pos, "mode=r#{mode}"
- assert_equal '1', f.getc, "mode=r#{mode}"
- assert_equal 2, f.pos, "mode=r#{mode}"
- assert_equal '2', f.getc, "mode=r#{mode}"
- assert_equal 3, f.pos, "mode=r#{mode}"
- assert_equal '3', f.getc, "mode=r#{mode}"
- assert_equal 4, f.pos, "mode=r#{mode}"
- assert_equal '4', f.getc, "mode=r#{mode}"
+ make_tempfile {|t|
+ ["", "t", "b"].each do |mode|
+ open(t.path, "w#{mode}") do |f|
+ f.write "0123456789\n"
+ end
+
+ open(t.path, "r#{mode}") do |f|
+ assert_equal 0, f.pos, "mode=r#{mode}"
+ assert_equal '0', f.getc, "mode=r#{mode}"
+ assert_equal 1, f.pos, "mode=r#{mode}"
+ assert_equal '1', f.getc, "mode=r#{mode}"
+ assert_equal 2, f.pos, "mode=r#{mode}"
+ assert_equal '2', f.getc, "mode=r#{mode}"
+ assert_equal 3, f.pos, "mode=r#{mode}"
+ assert_equal '3', f.getc, "mode=r#{mode}"
+ assert_equal 4, f.pos, "mode=r#{mode}"
+ assert_equal '4', f.getc, "mode=r#{mode}"
+ end
end
- end
+ }
end
- def test_sysseek
- t = make_tempfile
+ def test_seek
+ make_tempfile {|t|
+ open(t.path) { |f|
+ f.seek(9)
+ assert_equal("az\n", f.read)
+ }
- open(t.path) do |f|
- f.sysseek(-4, IO::SEEK_END)
- assert_equal("baz\n", f.read)
- end
+ open(t.path) { |f|
+ f.seek(9, IO::SEEK_SET)
+ assert_equal("az\n", f.read)
+ }
- open(t.path) do |f|
- a = [f.getc, f.getc, f.getc]
- a.reverse_each {|c| f.ungetc c }
- assert_raise(IOError) { f.sysseek(1) }
- end
+ open(t.path) { |f|
+ f.seek(-4, IO::SEEK_END)
+ assert_equal("baz\n", f.read)
+ }
+
+ open(t.path) { |f|
+ assert_equal("foo\n", f.gets)
+ f.seek(2, IO::SEEK_CUR)
+ assert_equal("r\nbaz\n", f.read)
+ }
+
+ if defined?(IO::SEEK_DATA)
+ open(t.path) { |f|
+ assert_equal("foo\n", f.gets)
+ f.seek(0, IO::SEEK_DATA)
+ assert_equal("foo\nbar\nbaz\n", f.read)
+ }
+ end
+
+ if defined?(IO::SEEK_HOLE)
+ open(t.path) { |f|2
+ assert_equal("foo\n", f.gets)
+ f.seek(0, IO::SEEK_HOLE)
+ assert_equal("", f.read)
+ }
+ end
+ }
end
- def test_syswrite
- t = make_tempfile
+ def test_seek_symwhence
+ make_tempfile {|t|
+ open(t.path) { |f|
+ f.seek(9, :SET)
+ assert_equal("az\n", f.read)
+ }
- open(t.path, "w") do |f|
- o = Object.new
- def o.to_s; "FOO\n"; end
- f.syswrite(o)
- end
- assert_equal("FOO\n", File.read(t.path))
+ open(t.path) { |f|
+ f.seek(-4, :END)
+ assert_equal("baz\n", f.read)
+ }
+
+ open(t.path) { |f|
+ assert_equal("foo\n", f.gets)
+ f.seek(2, :CUR)
+ assert_equal("r\nbaz\n", f.read)
+ }
+
+ if defined?(IO::SEEK_DATA)
+ open(t.path) { |f|
+ assert_equal("foo\n", f.gets)
+ f.seek(0, :DATA)
+ assert_equal("foo\nbar\nbaz\n", f.read)
+ }
+ end
+
+ if defined?(IO::SEEK_HOLE)
+ open(t.path) { |f|
+ assert_equal("foo\n", f.gets)
+ f.seek(0, :HOLE)
+ assert_equal("", f.read)
+ }
+ end
+ }
+ end
+
+ def test_sysseek
+ make_tempfile {|t|
+ open(t.path) do |f|
+ f.sysseek(-4, IO::SEEK_END)
+ assert_equal("baz\n", f.read)
+ end
+
+ open(t.path) do |f|
+ a = [f.getc, f.getc, f.getc]
+ a.reverse_each {|c| f.ungetc c }
+ assert_raise(IOError) { f.sysseek(1) }
+ end
+ }
+ end
+
+ def test_syswrite
+ make_tempfile {|t|
+ open(t.path, "w") do |f|
+ o = Object.new
+ def o.to_s; "FOO\n"; end
+ f.syswrite(o)
+ end
+ assert_equal("FOO\n", File.read(t.path))
+ }
end
def test_sysread
- t = make_tempfile
+ make_tempfile {|t|
+ open(t.path) do |f|
+ a = [f.getc, f.getc, f.getc]
+ a.reverse_each {|c| f.ungetc c }
+ assert_raise(IOError) { f.sysread(1) }
+ end
+ }
+ end
- open(t.path) do |f|
- a = [f.getc, f.getc, f.getc]
- a.reverse_each {|c| f.ungetc c }
- assert_raise(IOError) { f.sysread(1) }
- end
+ def test_sysread_with_not_empty_buffer
+ pipe(proc do |w|
+ w.write "foob"
+ w.close
+ end, proc do |r|
+ r.sysread( 5, s = "01234567" )
+ assert_equal( "foob", s )
+ end)
end
def test_flag
- t = make_tempfile
-
- assert_raise(ArgumentError) do
- open(t.path, "z") { }
- end
+ make_tempfile {|t|
+ assert_raise(ArgumentError) do
+ open(t.path, "z") { }
+ end
- assert_raise(ArgumentError) do
- open(t.path, "rr") { }
- end
+ assert_raise(ArgumentError) do
+ open(t.path, "rr") { }
+ end
+ }
end
def test_sysopen
- t = make_tempfile
+ make_tempfile {|t|
+ fd = IO.sysopen(t.path)
+ assert_kind_of(Integer, fd)
+ f = IO.for_fd(fd)
+ assert_equal("foo\nbar\nbaz\n", f.read)
+ f.close
- fd = IO.sysopen(t.path)
- assert_kind_of(Integer, fd)
- f = IO.for_fd(fd)
- assert_equal("foo\nbar\nbaz\n", f.read)
- f.close
+ fd = IO.sysopen(t.path, "w", 0666)
+ assert_kind_of(Integer, fd)
+ if defined?(Fcntl::F_GETFL)
+ f = IO.for_fd(fd)
+ else
+ f = IO.for_fd(fd, 0666)
+ end
+ f.write("FOO\n")
+ f.close
- fd = IO.sysopen(t.path, "w", 0666)
- assert_kind_of(Integer, fd)
- if defined?(Fcntl::F_GETFL)
+ fd = IO.sysopen(t.path, "r")
+ assert_kind_of(Integer, fd)
f = IO.for_fd(fd)
- else
- f = IO.for_fd(fd, 0666)
- end
- f.write("FOO\n")
- f.close
-
- fd = IO.sysopen(t.path, "r")
- assert_kind_of(Integer, fd)
- f = IO.for_fd(fd)
- assert_equal("FOO\n", f.read)
- f.close
+ assert_equal("FOO\n", f.read)
+ f.close
+ }
end
- def try_fdopen(fd, autoclose = true, level = 100)
+ def try_fdopen(fd, autoclose = true, level = 50)
if level > 0
- f = try_fdopen(fd, autoclose, level - 1)
- GC.start
- f
+ begin
+ 1.times {return try_fdopen(fd, autoclose, level - 1)}
+ ensure
+ GC.start
+ end
else
WeakRef.new(IO.for_fd(fd, autoclose: autoclose))
end
@@ -1419,21 +1844,23 @@ class TestIO < Test::Unit::TestCase
feature2250 = '[ruby-core:26222]'
pre = 'ft2250'
- t = Tempfile.new(pre)
- f = IO.for_fd(t.fileno)
- assert_equal(true, f.autoclose?)
- f.autoclose = false
- assert_equal(false, f.autoclose?)
- f.close
- assert_nothing_raised(Errno::EBADF, feature2250) {t.close}
-
- t.open
- f = IO.for_fd(t.fileno, autoclose: false)
- assert_equal(false, f.autoclose?)
- f.autoclose = true
- assert_equal(true, f.autoclose?)
- f.close
- assert_raise(Errno::EBADF, feature2250) {t.close}
+ Dir.mktmpdir {|d|
+ t = open("#{d}/#{pre}", "w")
+ f = IO.for_fd(t.fileno)
+ assert_equal(true, f.autoclose?)
+ f.autoclose = false
+ assert_equal(false, f.autoclose?)
+ f.close
+ assert_nothing_raised(Errno::EBADF, feature2250) {t.close}
+
+ t = open("#{d}/#{pre}", "w")
+ f = IO.for_fd(t.fileno, autoclose: false)
+ assert_equal(false, f.autoclose?)
+ f.autoclose = true
+ assert_equal(true, f.autoclose?)
+ f.close
+ assert_raise(Errno::EBADF, feature2250) {t.close}
+ }
end
def test_autoclose_true_closed_by_finalizer
@@ -1451,6 +1878,8 @@ class TestIO < Test::Unit::TestCase
rescue WeakRef::RefError
assert_raise(Errno::EBADF, feature2250) {t.close}
end
+ ensure
+ t.unlink
end
def test_autoclose_false_closed_by_finalizer
@@ -1465,6 +1894,8 @@ class TestIO < Test::Unit::TestCase
rescue WeakRef::RefError
assert_nothing_raised(Errno::EBADF, feature2250) {t.close}
end
+ ensure
+ t.unlink
end
def test_open_redirect
@@ -1487,48 +1918,42 @@ class TestIO < Test::Unit::TestCase
end
def test_reopen
- t = make_tempfile
-
- with_pipe do |r, w|
- assert_raise(SecurityError) do
- safe_4 { r.reopen(t.path) }
- end
- end
-
- open(__FILE__) do |f|
- f.gets
- assert_nothing_raised {
- f.reopen(t.path)
- assert_equal("foo\n", f.gets)
- }
- end
-
- open(__FILE__) do |f|
- f.gets
- f2 = open(t.path)
- begin
- f2.gets
+ make_tempfile {|t|
+ open(__FILE__) do |f|
+ f.gets
assert_nothing_raised {
- f.reopen(f2)
- assert_equal("bar\n", f.gets, '[ruby-core:24240]')
+ f.reopen(t.path)
+ assert_equal("foo\n", f.gets)
}
- ensure
- f2.close
end
- end
- open(__FILE__) do |f|
- f2 = open(t.path)
- begin
- f.reopen(f2)
- assert_equal("foo\n", f.gets)
- assert_equal("bar\n", f.gets)
- f.reopen(f2)
- assert_equal("baz\n", f.gets, '[ruby-dev:39479]')
- ensure
- f2.close
+ open(__FILE__) do |f|
+ f.gets
+ f2 = open(t.path)
+ begin
+ f2.gets
+ assert_nothing_raised {
+ f.reopen(f2)
+ assert_equal("bar\n", f.gets, '[ruby-core:24240]')
+ }
+ ensure
+ f2.close
+ end
end
- end
+
+ open(__FILE__) do |f|
+ f2 = open(t.path)
+ begin
+ f.reopen(f2)
+ assert_equal("foo\n", f.gets)
+ assert_equal("bar\n", f.gets)
+ f.reopen(f2)
+ assert_equal("baz\n", f.gets, '[ruby-dev:39479]')
+ ensure
+ f2.close
+ end
+ end
+ }
end
def test_reopen_inherit
@@ -1544,60 +1969,148 @@ End
}
end
- def test_foreach
- a = []
- IO.foreach("|" + EnvUtil.rubybin + " -e 'puts :foo; puts :bar; puts :baz'") {|x| a << x }
- assert_equal(["foo\n", "bar\n", "baz\n"], a)
+ def test_reopen_mode
+ feature7067 = '[ruby-core:47694]'
+ make_tempfile {|t|
+ open(__FILE__) do |f|
+ assert_nothing_raised {
+ f.reopen(t.path, "r")
+ assert_equal("foo\n", f.gets)
+ }
+ end
+
+ open(__FILE__) do |f|
+ assert_nothing_raised(feature7067) {
+ f.reopen(t.path, File::RDONLY)
+ assert_equal("foo\n", f.gets)
+ }
+ end
+ }
+ end
+
+ def test_reopen_opt
+ feature7103 = '[ruby-core:47806]'
+ make_tempfile {|t|
+ open(__FILE__) do |f|
+ assert_nothing_raised(feature7103) {
+ f.reopen(t.path, "r", binmode: true)
+ }
+ assert_equal("foo\n", f.gets)
+ end
+ open(__FILE__) do |f|
+ assert_nothing_raised(feature7103) {
+ f.reopen(t.path, autoclose: false)
+ }
+ assert_equal("foo\n", f.gets)
+ end
+ }
+ end
+
+ def make_tempfile_for_encoding
t = make_tempfile
+ open(t.path, "rb+:utf-8") {|f| f.puts "\u7d05\u7389bar\n"}
+ if block_given?
+ yield t
+ else
+ t
+ end
+ ensure
+ t.close(true) if t and block_given?
+ end
- a = []
- IO.foreach(t.path) {|x| a << x }
- assert_equal(["foo\n", "bar\n", "baz\n"], a)
+ def test_reopen_encoding
+ make_tempfile_for_encoding {|t|
+ open(__FILE__) {|f|
+ f.reopen(t.path, "r:utf-8")
+ s = f.gets
+ assert_equal(Encoding::UTF_8, s.encoding)
+ assert_equal("\u7d05\u7389bar\n", s)
+ }
- a = []
- IO.foreach(t.path, {:mode => "r" }) {|x| a << x }
- assert_equal(["foo\n", "bar\n", "baz\n"], a)
+ open(__FILE__) {|f|
+ f.reopen(t.path, "r:UTF-8:EUC-JP")
+ s = f.gets
+ assert_equal(Encoding::EUC_JP, s.encoding)
+ assert_equal("\xB9\xC8\xB6\xCCbar\n".force_encoding(Encoding::EUC_JP), s)
+ }
+ }
+ end
- a = []
- IO.foreach(t.path, {:open_args => [] }) {|x| a << x }
- assert_equal(["foo\n", "bar\n", "baz\n"], a)
+ def test_reopen_opt_encoding
+ feature7103 = '[ruby-core:47806]'
+ make_tempfile_for_encoding {|t|
+ open(__FILE__) {|f|
+ assert_nothing_raised(feature7103) {f.reopen(t.path, encoding: "ASCII-8BIT")}
+ s = f.gets
+ assert_equal(Encoding::ASCII_8BIT, s.encoding)
+ assert_equal("\xe7\xb4\x85\xe7\x8e\x89bar\n", s)
+ }
+ open(__FILE__) {|f|
+ assert_nothing_raised(feature7103) {f.reopen(t.path, encoding: "UTF-8:EUC-JP")}
+ s = f.gets
+ assert_equal(Encoding::EUC_JP, s.encoding)
+ assert_equal("\xB9\xC8\xB6\xCCbar\n".force_encoding(Encoding::EUC_JP), s)
+ }
+ }
+ end
+
+ def test_foreach
a = []
- IO.foreach(t.path, {:open_args => ["r"] }) {|x| a << x }
+ IO.foreach("|" + EnvUtil.rubybin + " -e 'puts :foo; puts :bar; puts :baz'") {|x| a << x }
assert_equal(["foo\n", "bar\n", "baz\n"], a)
- a = []
- IO.foreach(t.path, "b") {|x| a << x }
- assert_equal(["foo\nb", "ar\nb", "az\n"], a)
+ make_tempfile {|t|
+ a = []
+ IO.foreach(t.path) {|x| a << x }
+ assert_equal(["foo\n", "bar\n", "baz\n"], a)
- a = []
- IO.foreach(t.path, 3) {|x| a << x }
- assert_equal(["foo", "\n", "bar", "\n", "baz", "\n"], a)
+ a = []
+ IO.foreach(t.path, {:mode => "r" }) {|x| a << x }
+ assert_equal(["foo\n", "bar\n", "baz\n"], a)
- a = []
- IO.foreach(t.path, "b", 3) {|x| a << x }
- assert_equal(["foo", "\nb", "ar\n", "b", "az\n"], a)
+ a = []
+ IO.foreach(t.path, {:open_args => [] }) {|x| a << x }
+ assert_equal(["foo\n", "bar\n", "baz\n"], a)
+
+ a = []
+ IO.foreach(t.path, {:open_args => ["r"] }) {|x| a << x }
+ assert_equal(["foo\n", "bar\n", "baz\n"], a)
+
+ a = []
+ IO.foreach(t.path, "b") {|x| a << x }
+ assert_equal(["foo\nb", "ar\nb", "az\n"], a)
+
+ a = []
+ IO.foreach(t.path, 3) {|x| a << x }
+ assert_equal(["foo", "\n", "bar", "\n", "baz", "\n"], a)
+
+ a = []
+ IO.foreach(t.path, "b", 3) {|x| a << x }
+ assert_equal(["foo", "\nb", "ar\n", "b", "az\n"], a)
- bug = '[ruby-dev:31525]'
- assert_raise(ArgumentError, bug) {IO.foreach}
+ bug = '[ruby-dev:31525]'
+ assert_raise(ArgumentError, bug) {IO.foreach}
- a = nil
- assert_nothing_raised(ArgumentError, bug) {a = IO.foreach(t.path).to_a}
- assert_equal(["foo\n", "bar\n", "baz\n"], a, bug)
+ a = nil
+ assert_nothing_raised(ArgumentError, bug) {a = IO.foreach(t.path).to_a}
+ assert_equal(["foo\n", "bar\n", "baz\n"], a, bug)
- bug6054 = '[ruby-dev:45267]'
- e = assert_raise(IOError, bug6054) {IO.foreach(t.path, mode:"w").next}
- assert_match(/not opened for reading/, e.message, bug6054)
+ bug6054 = '[ruby-dev:45267]'
+ assert_raise_with_message(IOError, /not opened for reading/, bug6054) do
+ IO.foreach(t.path, mode:"w").next
+ end
+ }
end
def test_s_readlines
- t = make_tempfile
-
- assert_equal(["foo\n", "bar\n", "baz\n"], IO.readlines(t.path))
- assert_equal(["foo\nb", "ar\nb", "az\n"], IO.readlines(t.path, "b"))
- assert_equal(["fo", "o\n", "ba", "r\n", "ba", "z\n"], IO.readlines(t.path, 2))
- assert_equal(["fo", "o\n", "b", "ar", "\nb", "az", "\n"], IO.readlines(t.path, "b", 2))
+ make_tempfile {|t|
+ assert_equal(["foo\n", "bar\n", "baz\n"], IO.readlines(t.path))
+ assert_equal(["foo\nb", "ar\nb", "az\n"], IO.readlines(t.path, "b"))
+ assert_equal(["fo", "o\n", "ba", "r\n", "ba", "z\n"], IO.readlines(t.path, 2))
+ assert_equal(["fo", "o\n", "b", "ar", "\nb", "az", "\n"], IO.readlines(t.path, "b", 2))
+ }
end
def test_printf
@@ -1610,9 +2123,11 @@ End
end
def test_print
- t = make_tempfile
-
- assert_in_out_err(["-", t.path], "print while $<.gets", %w(foo bar baz), [])
+ make_tempfile {|t|
+ assert_in_out_err(["-", t.path],
+ "print while $<.gets",
+ %w(foo bar baz), [])
+ }
end
def test_print_separators
@@ -1677,30 +2192,32 @@ End
def test_initialize
return unless defined?(Fcntl::F_GETFL)
- t = make_tempfile
+ make_tempfile {|t|
- fd = IO.sysopen(t.path, "w")
- assert_kind_of(Integer, fd)
- %w[r r+ w+ a+].each do |mode|
- assert_raise(Errno::EINVAL, "#{mode} [ruby-dev:38571]") {IO.new(fd, mode)}
- end
- f = IO.new(fd, "w")
- f.write("FOO\n")
- f.close
+ fd = IO.sysopen(t.path, "w")
+ assert_kind_of(Integer, fd)
+ %w[r r+ w+ a+].each do |mode|
+ assert_raise(Errno::EINVAL, "#{mode} [ruby-dev:38571]") {IO.new(fd, mode)}
+ end
+ f = IO.new(fd, "w")
+ f.write("FOO\n")
+ f.close
- assert_equal("FOO\n", File.read(t.path))
+ assert_equal("FOO\n", File.read(t.path))
+ }
end
def test_reinitialize
- t = make_tempfile
- f = open(t.path)
- begin
- assert_raise(RuntimeError) do
- f.instance_eval { initialize }
+ make_tempfile {|t|
+ f = open(t.path)
+ begin
+ assert_raise(RuntimeError) do
+ f.instance_eval { initialize }
+ end
+ ensure
+ f.close
end
- ensure
- f.close
- end
+ }
end
def test_new_with_block
@@ -1726,11 +2243,11 @@ End
end
def test_s_read
- t = make_tempfile
-
- assert_equal("foo\nbar\nbaz\n", File.read(t.path))
- assert_equal("foo\nba", File.read(t.path, 6))
- assert_equal("bar\n", File.read(t.path, 4, 4))
+ make_tempfile {|t|
+ assert_equal("foo\nbar\nbaz\n", File.read(t.path))
+ assert_equal("foo\nba", File.read(t.path, 6))
+ assert_equal("bar\n", File.read(t.path, 4, 4))
+ }
end
def test_uninitialized
@@ -1758,14 +2275,16 @@ End
end
def test_tainted
- t = make_tempfile
- assert(File.read(t.path, 4).tainted?, '[ruby-dev:38826]')
- assert(File.open(t.path) {|f| f.read(4)}.tainted?, '[ruby-dev:38826]')
+ make_tempfile {|t|
+ assert(File.read(t.path, 4).tainted?, '[ruby-dev:38826]')
+ assert(File.open(t.path) {|f| f.read(4)}.tainted?, '[ruby-dev:38826]')
+ }
end
def test_binmode_after_closed
- t = make_tempfile
- assert_raise(IOError) {t.binmode}
+ make_tempfile {|t|
+ assert_raise(IOError) {t.binmode}
+ }
end
def test_threaded_flush
@@ -1778,7 +2297,7 @@ End
10.times.map do
Thread.start do
assert_in_out_err([], src) {|stdout, stderr|
- assert_no_match(/hi.*hi/, stderr.join)
+ assert_no_match(/hi.*hi/, stderr.join, bug3585)
}
end
end.each {|th| th.join}
@@ -1787,17 +2306,19 @@ End
def test_flush_in_finalizer1
require 'tempfile'
bug3910 = '[ruby-dev:42341]'
- t = Tempfile.new("bug3910")
- path = t.path
- t.close
- fds = []
- assert_nothing_raised(TypeError, bug3910) do
- 500.times {
- f = File.open(path, "w")
- fds << f.fileno
- f.print "hoge"
- }
- end
+ Tempfile.open("bug3910") {|t|
+ path = t.path
+ t.close
+ fds = []
+ assert_nothing_raised(TypeError, bug3910) do
+ 500.times {
+ f = File.open(path, "w")
+ fds << f.fileno
+ f.print "hoge"
+ }
+ end
+ t.unlink
+ }
ensure
GC.start
end
@@ -1805,82 +2326,91 @@ End
def test_flush_in_finalizer2
require 'tempfile'
bug3910 = '[ruby-dev:42341]'
- t = Tempfile.new("bug3910")
- path = t.path
- t.close
- 1.times do
- io = open(path,"w")
- io.print "hoge"
- end
- assert_nothing_raised(TypeError, bug3910) do
- GC.start
- end
+ Tempfile.open("bug3910") {|t|
+ path = t.path
+ t.close
+ 1.times do
+ io = open(path,"w")
+ io.print "hoge"
+ end
+ assert_nothing_raised(TypeError, bug3910) do
+ GC.start
+ end
+ t.unlink
+ }
end
def test_readlines_limit_0
bug4024 = '[ruby-dev:42538]'
- t = make_tempfile
- open(t.path, "r") do |io|
- assert_raise(ArgumentError, bug4024) do
- io.readlines(0)
+ make_tempfile {|t|
+ open(t.path, "r") do |io|
+ assert_raise(ArgumentError, bug4024) do
+ io.readlines(0)
+ end
end
- end
+ }
end
def test_each_line_limit_0
bug4024 = '[ruby-dev:42538]'
- t = make_tempfile
- open(t.path, "r") do |io|
- assert_raise(ArgumentError, bug4024) do
- io.each_line(0).next
+ make_tempfile {|t|
+ open(t.path, "r") do |io|
+ assert_raise(ArgumentError, bug4024) do
+ io.each_line(0).next
+ end
end
- end
+ }
end
def test_advise
- t = make_tempfile
- assert_raise(ArgumentError, "no arguments") { t.advise }
- %w{normal random sequential willneed dontneed noreuse}.map(&:to_sym).each do |adv|
- [[0,0], [0, 20], [400, 2]].each do |offset, len|
- open(make_tempfile.path) do |t|
- assert_equal(t.advise(adv, offset, len), nil)
- assert_raise(ArgumentError, "superfluous arguments") do
- t.advise(adv, offset, len, offset)
- end
- assert_raise(TypeError, "wrong type for first argument") do
- t.advise(adv.to_s, offset, len)
- end
- assert_raise(TypeError, "wrong type for last argument") do
- t.advise(adv, offset, Array(len))
+ make_tempfile {|tf|
+ assert_raise(ArgumentError, "no arguments") { tf.advise }
+ %w{normal random sequential willneed dontneed noreuse}.map(&:to_sym).each do |adv|
+ [[0,0], [0, 20], [400, 2]].each do |offset, len|
+ open(tf.path) do |t|
+ assert_equal(t.advise(adv, offset, len), nil)
+ assert_raise(ArgumentError, "superfluous arguments") do
+ t.advise(adv, offset, len, offset)
+ end
+ assert_raise(TypeError, "wrong type for first argument") do
+ t.advise(adv.to_s, offset, len)
+ end
+ assert_raise(TypeError, "wrong type for last argument") do
+ t.advise(adv, offset, Array(len))
+ end
+ assert_raise(RangeError, "last argument too big") do
+ t.advise(adv, offset, 9999e99)
+ end
end
- assert_raise(RangeError, "last argument too big") do
- t.advise(adv, offset, 9999e99)
+ assert_raise(IOError, "closed file") do
+ make_tempfile {|tf2|
+ tf2.advise(adv.to_sym, offset, len)
+ }
end
end
- assert_raise(IOError, "closed file") do
- make_tempfile.advise(adv.to_sym, offset, len)
- end
end
- end
+ }
end
def test_invalid_advise
feature4204 = '[ruby-dev:42887]'
- t = make_tempfile
- %w{Normal rand glark will_need zzzzzzzzzzzz \u2609}.map(&:to_sym).each do |adv|
- [[0,0], [0, 20], [400, 2]].each do |offset, len|
- open(make_tempfile.path) do |t|
- assert_raise(NotImplementedError, feature4204) { t.advise(adv, offset, len) }
+ make_tempfile {|tf|
+ %w{Normal rand glark will_need zzzzzzzzzzzz \u2609}.map(&:to_sym).each do |adv|
+ [[0,0], [0, 20], [400, 2]].each do |offset, len|
+ open(tf.path) do |t|
+ assert_raise(NotImplementedError, feature4204) { t.advise(adv, offset, len) }
+ end
end
end
- end
+ }
end
- def test_fcntl_lock
+ def test_fcntl_lock_linux
return if /x86_64-linux/ !~ RUBY_PLATFORM # A binary form of struct flock depend on platform
+ return if [nil].pack("p").bytesize != 8 # Return if x32 platform.
pad=0
- Tempfile.open(self.class.name) do |f|
+ Tempfile.create(self.class.name) do |f|
r, w = IO.pipe
pid = fork do
r.close
@@ -1909,6 +2439,52 @@ End
end
end
+ def test_fcntl_lock_freebsd
+ return if /freebsd/ !~ RUBY_PLATFORM # A binary form of struct flock depend on platform
+
+ start = 12
+ len = 34
+ sysid = 0
+ Tempfile.create(self.class.name) do |f|
+ r, w = IO.pipe
+ pid = fork do
+ r.close
+ lock = [start, len, 0, Fcntl::F_WRLCK, IO::SEEK_SET, sysid].pack("qqis!s!i!")
+ f.fcntl Fcntl::F_SETLKW, lock
+ w.syswrite "."
+ sleep
+ end
+ w.close
+ assert_equal ".", r.read(1)
+ r.close
+
+ getlock = [0, 0, 0, Fcntl::F_WRLCK, 0, 0].pack("qqis!s!i!")
+ f.fcntl Fcntl::F_GETLK, getlock
+
+ start, len, lockpid, ptype, whence, sysid = getlock.unpack("qqis!s!i!")
+
+ assert_equal(ptype, Fcntl::F_WRLCK)
+ assert_equal(whence, IO::SEEK_SET)
+ assert_equal(start, 12)
+ assert_equal(len, 34)
+ assert_equal(pid, lockpid)
+
+ Process.kill :TERM, pid
+ Process.waitpid2(pid)
+ end
+ end
+
+ def test_fcntl_dupfd
+ Tempfile.create(self.class.name) do |f|
+ fd = f.fcntl(Fcntl::F_DUPFD, 63)
+ begin
+ assert_operator(fd, :>=, 63)
+ ensure
+ IO.for_fd(fd).close
+ end
+ end
+ end
+
def test_cross_thread_close_fd
skip "cross thread close causes hung-up if pipe." if /mswin|bccwin|mingw/ =~ RUBY_PLATFORM
with_pipe do |r,w|
@@ -1928,25 +2504,18 @@ End
end
def test_cross_thread_close_stdio
- with_pipe do |r,w|
- pid = fork do
+ assert_separately([], <<-'end;')
+ IO.pipe do |r,w|
$stdin.reopen(r)
r.close
read_thread = Thread.new do
- begin
- $stdin.read(1)
- rescue => e
- e
- end
+ $stdin.read(1)
end
sleep(0.1) until read_thread.stop?
$stdin.close
- read_thread.join
- exit(IOError === read_thread.value)
+ assert_raise(IOError) {read_thread.join}
end
- assert Process.waitpid2(pid)[1].success?
- end
- rescue NotImplementedError
+ end;
end
def test_open_mode
@@ -2024,32 +2593,76 @@ End
end
def test_race_between_read
- file = Tempfile.new("test")
- path = file.path
- file.close
- write_file = File.open(path, "wt")
- read_file = File.open(path, "rt")
-
- threads = []
- 10.times do |i|
- threads << Thread.new {write_file.print(i)}
- threads << Thread.new {read_file.read}
+ Tempfile.create("test") {|file|
+ begin
+ path = file.path
+ file.close
+ write_file = File.open(path, "wt")
+ read_file = File.open(path, "rt")
+
+ threads = []
+ 10.times do |i|
+ threads << Thread.new {write_file.print(i)}
+ threads << Thread.new {read_file.read}
+ end
+ threads.each {|t| t.join}
+ assert(true, "[ruby-core:37197]")
+ ensure
+ read_file.close
+ write_file.close
+ end
+ }
+ end
+
+ def test_warn
+ assert_warning "warning\n" do
+ warn "warning"
+ end
+
+ assert_warning '' do
+ warn
+ end
+
+ assert_warning "[Feature #5029]\n[ruby-core:38070]\n" do
+ warn "[Feature #5029]", "[ruby-core:38070]"
end
- threads.each {|t| t.join}
- assert(true, "[ruby-core:37197]")
- ensure
- read_file.close
- write_file.close
- file.close!
+ end
+
+ def test_cloexec
+ return unless defined? Fcntl::FD_CLOEXEC
+ open(__FILE__) {|f|
+ assert(f.close_on_exec?)
+ g = f.dup
+ begin
+ assert(g.close_on_exec?)
+ f.reopen(g)
+ assert(f.close_on_exec?)
+ ensure
+ g.close
+ end
+ g = IO.new(f.fcntl(Fcntl::F_DUPFD))
+ begin
+ assert(g.close_on_exec?)
+ ensure
+ g.close
+ end
+ }
+ IO.pipe {|r,w|
+ assert(r.close_on_exec?)
+ assert(w.close_on_exec?)
+ }
end
def test_ioctl_linux
return if /linux/ !~ RUBY_PLATFORM
+ # Alpha, mips, sparc and ppc have an another ioctl request number scheme.
+ # So, hardcoded 0x80045200 may fail.
+ return if /^i.?86|^x86_64/ !~ RUBY_PLATFORM
assert_nothing_raised do
File.open('/dev/urandom'){|f1|
entropy_count = ""
- # get entropy count
+ # RNDGETENTCNT(0x80045200) mean "get entropy count".
f1.ioctl(0x80045200, entropy_count)
}
end
@@ -2080,13 +2693,13 @@ End
def test_setpos
mkcdtmpdir {
- File.open("tmp.txt", "w") {|f|
+ File.open("tmp.txt", "wb") {|f|
f.puts "a"
f.puts "bc"
f.puts "def"
}
pos1 = pos2 = pos3 = nil
- File.open("tmp.txt") {|f|
+ File.open("tmp.txt", "rb") {|f|
assert_equal("a\n", f.gets)
pos1 = f.pos
assert_equal("bc\n", f.gets)
@@ -2095,21 +2708,26 @@ End
pos3 = f.pos
assert_equal(nil, f.gets)
}
- File.open("tmp.txt") {|f|
+ File.open("tmp.txt", "rb") {|f|
f.pos = pos1
assert_equal("bc\n", f.gets)
assert_equal("def\n", f.gets)
assert_equal(nil, f.gets)
}
- File.open("tmp.txt") {|f|
+ File.open("tmp.txt", "rb") {|f|
f.pos = pos2
assert_equal("def\n", f.gets)
assert_equal(nil, f.gets)
}
- File.open("tmp.txt") {|f|
+ File.open("tmp.txt", "rb") {|f|
f.pos = pos3
assert_equal(nil, f.gets)
}
+ File.open("tmp.txt", "rb") {|f|
+ f.pos = File.size("tmp.txt")
+ s = "not empty string "
+ assert_equal("", f.read(0,s))
+ }
}
end
@@ -2122,6 +2740,112 @@ End
assert_equal(2, $stderr.fileno)
end
+ def test_sysread_locktmp
+ bug6099 = '[ruby-dev:45297]'
+ buf = " " * 100
+ data = "a" * 100
+ with_pipe do |r,w|
+ th = Thread.new {r.sysread(100, buf)}
+ Thread.pass until th.stop?
+ buf.replace("")
+ assert_empty(buf, bug6099)
+ w.write(data)
+ Thread.pass while th.alive?
+ th.join
+ end
+ assert_equal(data, buf, bug6099)
+ end
+
+ def test_readpartial_locktmp
+ skip "nonblocking mode is not supported for pipe on this platform" if /mswin|bccwin|mingw/ =~ RUBY_PLATFORM
+ bug6099 = '[ruby-dev:45297]'
+ buf = " " * 100
+ data = "a" * 100
+ with_pipe do |r,w|
+ r.fcntl(Fcntl::F_SETFL, Fcntl::O_NONBLOCK)
+ th = Thread.new {r.readpartial(100, buf)}
+ Thread.pass until th.stop?
+ buf.replace("")
+ assert_empty(buf, bug6099)
+ w.write(data)
+ Thread.pass while th.alive?
+ th.join
+ end
+ assert_equal(data, buf, bug6099)
+ rescue RuntimeError # can't modify string; temporarily locked
+ end
+
+ def test_advise_pipe
+ # we don't know if other platforms have a real posix_fadvise()
+ return if /linux/ !~ RUBY_PLATFORM
+ with_pipe do |r,w|
+ # Linux 2.6.15 and earlier returned EINVAL instead of ESPIPE
+ assert_raise(Errno::ESPIPE, Errno::EINVAL) { r.advise(:willneed) }
+ assert_raise(Errno::ESPIPE, Errno::EINVAL) { w.advise(:willneed) }
+ end
+ end
+
+ def assert_buffer_not_raise_shared_string_error
+ bug6764 = '[ruby-core:46586]'
+ size = 28
+ data = [*"a".."z", *"A".."Z"].shuffle.join("")
+ t = Tempfile.new("test_io")
+ t.write(data)
+ t.close
+ w = Tempfile.new("test_io")
+ assert_nothing_raised(RuntimeError, bug6764) do
+ File.open(t.path, "r") do |r|
+ buf = ''
+ while yield(r, size, buf)
+ w << buf
+ end
+ end
+ end
+ w.close
+ assert_equal(data, w.open.read, bug6764)
+ ensure
+ t.close!
+ w.close!
+ end
+
+ def test_read_buffer_not_raise_shared_string_error
+ assert_buffer_not_raise_shared_string_error do |r, size, buf|
+ r.read(size, buf)
+ end
+ end
+
+ def test_sysread_buffer_not_raise_shared_string_error
+ assert_buffer_not_raise_shared_string_error do |r, size, buf|
+ begin
+ r.sysread(size, buf)
+ rescue EOFError
+ nil
+ end
+ end
+ end
+
+ def test_readpartial_buffer_not_raise_shared_string_error
+ assert_buffer_not_raise_shared_string_error do |r, size, buf|
+ begin
+ r.readpartial(size, buf)
+ rescue EOFError
+ nil
+ end
+ end
+ end
+
+ def test_puts_recursive_ary
+ bug5986 = '[ruby-core:42444]'
+ c = Class.new {
+ def to_ary
+ [self]
+ end
+ }
+ s = StringIO.new
+ s.puts(c.new)
+ assert_equal("[...]\n", s.string, bug5986)
+ end
+
def test_io_select_with_many_files
bug8080 = '[ruby-core:53349]'
@@ -2163,19 +2887,85 @@ End
def test_write_32bit_boundary
bug8431 = '[ruby-core:55098] [Bug #8431]'
make_tempfile {|t|
- assert_separately(["-", bug8431, t.path], <<-"end;", timeout: 30)
- msg = ARGV.shift
- f = open(ARGV[0], "wb")
- f.seek(0xffff_ffff)
- begin
- # this will consume very long time or fail by ENOSPC on a
- # filesystem which sparse file is not supported
- f.write('1')
- rescue SystemCallError
- else
- assert_equal(0x1_0000_0000, f.tell, msg)
+ def t.close(unlink_now = false)
+ # TODO: Tempfile should deal with this delay on Windows?
+ # NOTE: re-opening with O_TEMPORARY does not work.
+ path = self.path
+ ret = super
+ if unlink_now
+ begin
+ File.unlink(path)
+ rescue Errno::ENOENT
+ rescue Errno::EACCES
+ sleep(2)
+ retry
+ end
end
- end;
+ ret
+ end
+
+ begin
+ assert_separately(["-", bug8431, t.path], <<-"end;", timeout: 30)
+ msg = ARGV.shift
+ f = open(ARGV[0], "wb")
+ f.seek(0xffff_ffff)
+ begin
+ # this will consume very long time or fail by ENOSPC on a
+ # filesystem which sparse file is not supported
+ f.write('1')
+ pos = f.tell
+ rescue Errno::ENOSPC
+ skip "non-sparse file system"
+ rescue SystemCallError
+ else
+ assert_equal(0x1_0000_0000, pos, msg)
+ end
+ end;
+ rescue Timeout::Error
+ skip "Timeout because of slow file writing"
+ end
}
end if /mswin|mingw/ =~ RUBY_PLATFORM
+
+ def test_read_unlocktmp_ensure
+ bug8669 = '[ruby-core:56121] [Bug #8669]'
+
+ str = ""
+ r, = IO.pipe
+ t = Thread.new { r.read(nil, str) }
+ sleep 0.1 until t.stop?
+ t.raise
+ sleep 0.1 while t.alive?
+ assert_nothing_raised(RuntimeError, bug8669) { str.clear }
+ ensure
+ t.kill
+ end
+
+ def test_readpartial_unlocktmp_ensure
+ bug8669 = '[ruby-core:56121] [Bug #8669]'
+
+ str = ""
+ r, = IO.pipe
+ t = Thread.new { r.readpartial(4096, str) }
+ sleep 0.1 until t.stop?
+ t.raise
+ sleep 0.1 while t.alive?
+ assert_nothing_raised(RuntimeError, bug8669) { str.clear }
+ ensure
+ t.kill
+ end
+
+ def test_sysread_unlocktmp_ensure
+ bug8669 = '[ruby-core:56121] [Bug #8669]'
+
+ str = ""
+ r, = IO.pipe
+ t = Thread.new { r.sysread(4096, str) }
+ sleep 0.1 until t.stop?
+ t.raise
+ sleep 0.1 while t.alive?
+ assert_nothing_raised(RuntimeError, bug8669) { str.clear }
+ ensure
+ t.kill
+ end
end
diff --git a/test/ruby/test_io_m17n.rb b/test/ruby/test_io_m17n.rb
index c22f665286..45fa98e897 100644
--- a/test/ruby/test_io_m17n.rb
+++ b/test/ruby/test_io_m17n.rb
@@ -1,3 +1,4 @@
+# coding: US-ASCII
require 'test/unit'
require 'tmpdir'
require 'timeout'
@@ -71,7 +72,7 @@ class TestIO_M17N < Test::Unit::TestCase
#{encdump expected} expected but not equal to
#{encdump actual}.
EOT
- assert_block(full_message) { expected == actual }
+ assert_equal(expected, actual, full_message)
end
def test_open_r
@@ -104,6 +105,42 @@ EOT
}
end
+ def test_open_r_ascii8bit
+ with_tmpdir {
+ generate_file('tmp', "")
+ EnvUtil.with_default_external(Encoding::ASCII_8BIT) do
+ EnvUtil.with_default_internal(Encoding::UTF_8) do
+ open("tmp", "r") {|f|
+ assert_equal(Encoding::ASCII_8BIT, f.external_encoding)
+ assert_equal(nil, f.internal_encoding)
+ }
+ open("tmp", "r:ascii-8bit") {|f|
+ assert_equal(Encoding::ASCII_8BIT, f.external_encoding)
+ assert_equal(nil, f.internal_encoding)
+ }
+ open("tmp", "r:ascii-8bit:utf-16") {|f|
+ assert_equal(Encoding::ASCII_8BIT, f.external_encoding)
+ assert_equal(nil, f.internal_encoding)
+ }
+ end
+ EnvUtil.with_default_internal(nil) do
+ open("tmp", "r") {|f|
+ assert_equal(Encoding::ASCII_8BIT, f.external_encoding)
+ assert_equal(nil, f.internal_encoding)
+ }
+ open("tmp", "r:ascii-8bit") {|f|
+ assert_equal(Encoding::ASCII_8BIT, f.external_encoding)
+ assert_equal(nil, f.internal_encoding)
+ }
+ open("tmp", "r:ascii-8bit:utf-16") {|f|
+ assert_equal(Encoding::ASCII_8BIT, f.external_encoding)
+ assert_equal(nil, f.internal_encoding)
+ }
+ end
+ end
+ }
+ end
+
def test_open_r_enc_in_opt
with_tmpdir {
generate_file('tmp', "")
@@ -478,14 +515,13 @@ EOT
with_tmpdir {
src = "\u3042"
generate_file('tmp', src)
- defext = Encoding.default_external
- Encoding.default_external = Encoding::UTF_8
- open("tmp", "rt") {|f|
- s = f.getc
- assert_equal(true, s.valid_encoding?)
- assert_equal("\u3042", s)
- }
- Encoding.default_external = defext
+ EnvUtil.with_default_external(Encoding::UTF_8) do
+ open("tmp", "rt") {|f|
+ s = f.getc
+ assert_equal(true, s.valid_encoding?)
+ assert_equal("\u3042", s)
+ }
+ end
}
end
@@ -493,17 +529,16 @@ EOT
with_tmpdir {
src = "\xE3\x81"
generate_file('tmp', src)
- defext = Encoding.default_external
- Encoding.default_external = Encoding::UTF_8
- open("tmp", "rt") {|f|
- s = f.getc
- assert_equal(false, s.valid_encoding?)
- assert_equal("\xE3".force_encoding("UTF-8"), s)
- s = f.getc
- assert_equal(false, s.valid_encoding?)
- assert_equal("\x81".force_encoding("UTF-8"), s)
- }
- Encoding.default_external = defext
+ EnvUtil.with_default_external(Encoding::UTF_8) do
+ open("tmp", "rt") {|f|
+ s = f.getc
+ assert_equal(false, s.valid_encoding?)
+ assert_equal("\xE3".force_encoding("UTF-8"), s)
+ s = f.getc
+ assert_equal(false, s.valid_encoding?)
+ assert_equal("\x81".force_encoding("UTF-8"), s)
+ }
+ end
}
end
@@ -728,10 +763,12 @@ EOT
assert_equal(eucjp, r.read)
end)
- e = assert_raise(ArgumentError) {with_pipe("UTF-8", "UTF-8".encode("UTF-32BE")) {}}
- assert_match(/invalid name encoding/, e.message)
- e = assert_raise(ArgumentError) {with_pipe("UTF-8".encode("UTF-32BE")) {}}
- assert_match(/invalid name encoding/, e.message)
+ assert_raise_with_message(ArgumentError, /invalid name encoding/) do
+ with_pipe("UTF-8", "UTF-8".encode("UTF-32BE")) {}
+ end
+ assert_raise_with_message(ArgumentError, /invalid name encoding/) do
+ with_pipe("UTF-8".encode("UTF-32BE")) {}
+ end
ENCS.each {|enc|
pipe(enc,
@@ -984,6 +1021,33 @@ EOT
end)
end
+ def test_set_encoding_identical
+ #bug5568 = '[ruby-core:40727]'
+ bug6324 = '[ruby-core:44455]'
+ open(__FILE__, "r") do |f|
+ assert_warning('', bug6324) {
+ f.set_encoding("eucjp:euc-jp")
+ }
+ assert_warning('', bug6324) {
+ f.set_encoding("eucjp", "euc-jp")
+ }
+ assert_warning('', bug6324) {
+ f.set_encoding(Encoding::EUC_JP, "euc-jp")
+ }
+ assert_warning('', bug6324) {
+ f.set_encoding("eucjp", Encoding::EUC_JP)
+ }
+ assert_warning('', bug6324) {
+ f.set_encoding(Encoding::EUC_JP, Encoding::EUC_JP)
+ }
+ nonstr = Object.new
+ def nonstr.to_str; "eucjp"; end
+ assert_warning('', bug6324) {
+ f.set_encoding(nonstr, nonstr)
+ }
+ end
+ end
+
def test_set_encoding_undef
pipe(proc do |w|
w << "\ufffd"
@@ -1042,6 +1106,46 @@ EOT
f.set_encoding("iso-2022-jp")
}
}
+ assert_nothing_raised {
+ open(__FILE__, "r", binmode: true) {|f|
+ assert_equal(Encoding::ASCII_8BIT, f.external_encoding)
+ f.set_encoding("iso-2022-jp")
+ }
+ }
+ assert_raise(ArgumentError) {
+ open(__FILE__, "rb", binmode: true) {|f|
+ f.set_encoding("iso-2022-jp")
+ }
+ }
+ assert_raise(ArgumentError) {
+ open(__FILE__, "rb", binmode: false) {|f|
+ f.set_encoding("iso-2022-jp")
+ }
+ }
+ end
+
+ def test_set_encoding_unsupported
+ bug5567 = '[ruby-core:40726]'
+ IO.pipe do |r, w|
+ assert_nothing_raised(bug5567) do
+ assert_warning(/Unsupported/, bug5567) {r.set_encoding("fffffffffffxx")}
+ assert_warning(/Unsupported/, bug5567) {r.set_encoding("fffffffffffxx", "us-ascii")}
+ assert_warning(/Unsupported/, bug5567) {r.set_encoding("us-ascii", "fffffffffffxx")}
+ end
+ end
+ end
+
+ def test_textmode_twice
+ assert_raise(ArgumentError) {
+ open(__FILE__, "rt", textmode: true) {|f|
+ f.set_encoding("iso-2022-jp")
+ }
+ }
+ assert_raise(ArgumentError) {
+ open(__FILE__, "rt", textmode: false) {|f|
+ f.set_encoding("iso-2022-jp")
+ }
+ }
end
def test_write_conversion_fixenc
@@ -1338,7 +1442,12 @@ EOT
end
def test_both_textmode_binmode
- assert_raise(ArgumentError) { open("not-exist", "r", :textmode=>true, :binmode=>true) }
+ bug5918 = '[ruby-core:42199]'
+ assert_raise(ArgumentError, bug5918) { open("not-exist", "r", :textmode=>true, :binmode=>true) }
+ assert_raise(ArgumentError, bug5918) { open("not-exist", "rt", :binmode=>true) }
+ assert_raise(ArgumentError, bug5918) { open("not-exist", "rt", :binmode=>false) }
+ assert_raise(ArgumentError, bug5918) { open("not-exist", "rb", :textmode=>true) }
+ assert_raise(ArgumentError, bug5918) { open("not-exist", "rb", :textmode=>false) }
end
def test_textmode_decode_universal_newline_read
@@ -1608,7 +1717,7 @@ EOT
u16 = "\x85\x35\0\r\x00\xa2\0\r\0\n\0\n".force_encoding("utf-16be")
i = "\e$B\x42\x22\e(B\r\e$B\x21\x71\e(B\r\n\n".force_encoding("iso-2022-jp")
n = system_newline
- un = n.encode("utf-16be").force_encoding("ascii-8bit")
+ n.encode("utf-16be").force_encoding("ascii-8bit")
assert_write("a\rb\r#{n}c#{n}", "wt", a)
assert_write("\xc2\xa2", "wt", e)
@@ -1926,6 +2035,7 @@ EOT
def test_strip_bom
with_tmpdir {
text = "\uFEFFa"
+ stripped = "a"
%w/UTF-8 UTF-16BE UTF-16LE UTF-32BE UTF-32LE/.each do |name|
path = '%s-bom.txt' % name
content = text.encode(name)
@@ -1933,11 +2043,32 @@ EOT
result = File.read(path, mode: 'rb:BOM|UTF-8')
assert_equal(content[1].force_encoding("ascii-8bit"),
result.force_encoding("ascii-8bit"))
+ result = File.read(path, mode: 'rb:BOM|UTF-8:UTF-8')
+ assert_equal(Encoding::UTF_8, result.encoding)
+ assert_equal(stripped, result)
end
bug3407 = '[ruby-core:30641]'
- result = File.read('UTF-8-bom.txt', encoding: 'BOM|UTF-8')
+ path = 'UTF-8-bom.txt'
+ result = File.read(path, encoding: 'BOM|UTF-8')
assert_equal("a", result.force_encoding("ascii-8bit"), bug3407)
+
+ bug8323 = '[ruby-core:54563] [Bug #8323]'
+ expected = "a\xff".force_encoding("utf-8")
+ open(path, 'ab') {|f| f.write("\xff")}
+ result = File.read(path, encoding: 'BOM|UTF-8')
+ assert_not_predicate(result, :valid_encoding?, bug8323)
+ assert_equal(expected, result, bug8323)
+ result = File.read(path, encoding: 'BOM|UTF-8:UTF-8')
+ assert_not_predicate(result, :valid_encoding?, bug8323)
+ assert_equal(expected, result, bug8323)
+
+ path = 'ascii.txt'
+ generate_file(path, stripped)
+ result = File.read(path, encoding: 'BOM|UTF-8')
+ assert_equal(stripped, result, bug8323)
+ result = File.read(path, encoding: 'BOM|UTF-8:UTF-8')
+ assert_equal(stripped, result, bug8323)
}
end
@@ -2067,7 +2198,7 @@ EOT
open("a", "wb") {|f| f.puts "a"}
open("a", "rt") {|f| f.getc}
}
- assert(c.ascii_only?, bug4557)
+ assert_predicate(c, :ascii_only?, bug4557)
end
def test_getc_conversion
@@ -2076,7 +2207,7 @@ EOT
open("a", "wb") {|f| f.putc "\xe1"}
open("a", "r:iso-8859-1:utf-8") {|f| f.getc}
}
- refute(c.ascii_only?, bug8516)
+ assert_not_predicate(c, :ascii_only?, bug8516)
assert_equal(1, c.size, bug8516)
end
diff --git a/test/ruby/test_iseq.rb b/test/ruby/test_iseq.rb
new file mode 100644
index 0000000000..f8f186175f
--- /dev/null
+++ b/test/ruby/test_iseq.rb
@@ -0,0 +1,119 @@
+require 'test/unit'
+require_relative 'envutil'
+
+class TestISeq < Test::Unit::TestCase
+ ISeq = RubyVM::InstructionSequence
+
+ def test_no_linenum
+ bug5894 = '[ruby-dev:45130]'
+ assert_normal_exit('p RubyVM::InstructionSequence.compile("1", "mac", "", 0).to_a', bug5894)
+ end
+
+ def lines src
+ body = RubyVM::InstructionSequence.new(src).to_a[13]
+ lines = body.find_all{|e| e.kind_of? Fixnum}
+ end
+
+ def test_to_a_lines
+ src = <<-EOS
+ p __LINE__ # 1
+ p __LINE__ # 2
+ # 3
+ p __LINE__ # 4
+ EOS
+ assert_equal [1, 2, 4], lines(src)
+
+ src = <<-EOS
+ # 1
+ p __LINE__ # 2
+ # 3
+ p __LINE__ # 4
+ # 5
+ EOS
+ assert_equal [2, 4], lines(src)
+
+ src = <<-EOS
+ 1 # should be optimized out
+ 2 # should be optimized out
+ p __LINE__ # 3
+ p __LINE__ # 4
+ 5 # should be optimized out
+ 6 # should be optimized out
+ p __LINE__ # 7
+ 8 # should be optimized out
+ 9
+ EOS
+ assert_equal [3, 4, 7, 9], lines(src)
+ end
+
+ def test_unsupport_type
+ ary = RubyVM::InstructionSequence.compile("p").to_a
+ ary[9] = :foobar
+ assert_raise_with_message(TypeError, /:foobar/) {RubyVM::InstructionSequence.load(ary)}
+ end if defined?(RubyVM::InstructionSequence.load)
+
+ def test_disasm_encoding
+ src = "\u{3042} = 1; \u{3042}"
+ enc, Encoding.default_internal = Encoding.default_internal, src.encoding
+ assert_equal(src.encoding, RubyVM::InstructionSequence.compile(src).disasm.encoding)
+ src.encode!(Encoding::Shift_JIS)
+ assert_equal(true, RubyVM::InstructionSequence.compile(src).disasm.ascii_only?)
+ ensure
+ Encoding.default_internal = enc
+ end
+
+ LINE_BEFORE_METHOD = __LINE__
+ def method_test_line_trace
+
+ a = 1
+
+ b = 2
+
+ end
+
+ def test_line_trace
+ iseq = ISeq.compile \
+ %q{ a = 1
+ b = 2
+ c = 3
+ # d = 4
+ e = 5
+ # f = 6
+ g = 7
+
+ }
+ assert_equal([1, 2, 3, 5, 7], iseq.line_trace_all)
+ iseq.line_trace_specify(1, true) # line 2
+ iseq.line_trace_specify(3, true) # line 5
+
+ result = []
+ TracePoint.new(:specified_line){|tp|
+ result << tp.lineno
+ }.enable{
+ iseq.eval
+ }
+ assert_equal([2, 5], result)
+
+ iseq = ISeq.of(self.class.instance_method(:method_test_line_trace))
+ assert_equal([LINE_BEFORE_METHOD + 3, LINE_BEFORE_METHOD + 5], iseq.line_trace_all)
+ end if false # TODO: now, it is only for C APIs.
+
+ LINE_OF_HERE = __LINE__
+ def test_location
+ iseq = ISeq.of(method(:test_location))
+
+ assert_equal(__FILE__, iseq.path)
+ assert(/#{__FILE__}/ =~ iseq.absolute_path)
+ assert_equal("test_location", iseq.label)
+ assert_equal("test_location", iseq.base_label)
+ assert_equal(LINE_OF_HERE+1, iseq.first_lineno)
+
+ line = __LINE__
+ iseq = ISeq.of(Proc.new{})
+ assert_equal(__FILE__, iseq.path)
+ assert(/#{__FILE__}/ =~ iseq.absolute_path)
+ assert_equal("test_location", iseq.base_label)
+ assert_equal("block in test_location", iseq.label)
+ assert_equal(line+1, iseq.first_lineno)
+ end
+end
diff --git a/test/ruby/test_iterator.rb b/test/ruby/test_iterator.rb
index 362becc0e0..34652db2bb 100644
--- a/test/ruby/test_iterator.rb
+++ b/test/ruby/test_iterator.rb
@@ -25,14 +25,14 @@ class TestIterator < Test::Unit::TestCase
end
def test_array
- $x = [1, 2, 3, 4]
- $y = []
+ x = [1, 2, 3, 4]
+ y = []
# iterator over array
- for i in $x
- $y.push i
+ for i in x
+ y.push i
end
- assert_equal($x, $y)
+ assert_equal(x, y)
end
def tt
@@ -79,36 +79,36 @@ class TestIterator < Test::Unit::TestCase
assert(done)
done = false
- $bad = false
+ bad = false
loop {
break if done
done = true
next
- $bad = true # should not reach here
+ bad = true # should not reach here
}
- assert(!$bad)
+ assert(!bad)
done = false
- $bad = false
+ bad = false
loop {
break if done
done = true
redo
- $bad = true # should not reach here
+ bad = true # should not reach here
}
- assert(!$bad)
+ assert(!bad)
- $x = []
+ x = []
for i in 1 .. 7
- $x.push i
+ x.push i
end
- assert_equal(7, $x.size)
- assert_equal([1, 2, 3, 4, 5, 6, 7], $x)
+ assert_equal(7, x.size)
+ assert_equal([1, 2, 3, 4, 5, 6, 7], x)
end
def test_append_method_to_built_in_class
- $x = [[1,2],[3,4],[5,6]]
- assert_equal($x.iter_test1{|x|x}, $x.iter_test2{|x|x})
+ x = [[1,2],[3,4],[5,6]]
+ assert_equal(x.iter_test1{|x|x}, x.iter_test2{|x|x})
end
class IterTest
diff --git a/test/ruby/test_keyword.rb b/test/ruby/test_keyword.rb
new file mode 100644
index 0000000000..dd4f6d1b42
--- /dev/null
+++ b/test/ruby/test_keyword.rb
@@ -0,0 +1,418 @@
+require 'test/unit'
+require_relative 'envutil'
+
+class TestKeywordArguments < Test::Unit::TestCase
+ def f1(str: "foo", num: 424242)
+ [str, num]
+ end
+
+ def test_f1
+ assert_equal(["foo", 424242], f1)
+ assert_equal(["bar", 424242], f1(str: "bar"))
+ assert_equal(["foo", 111111], f1(num: 111111))
+ assert_equal(["bar", 111111], f1(str: "bar", num: 111111))
+ assert_raise(ArgumentError) { f1(str: "bar", check: true) }
+ assert_raise(ArgumentError) { f1("string") }
+ end
+
+
+ def f2(x, str: "foo", num: 424242)
+ [x, str, num]
+ end
+
+ def test_f2
+ assert_equal([:xyz, "foo", 424242], f2(:xyz))
+ assert_equal([{"bar"=>42}, "foo", 424242], f2("bar"=>42))
+ end
+
+
+ def f3(str: "foo", num: 424242, **h)
+ [str, num, h]
+ end
+
+ def test_f3
+ assert_equal(["foo", 424242, {}], f3)
+ assert_equal(["bar", 424242, {}], f3(str: "bar"))
+ assert_equal(["foo", 111111, {}], f3(num: 111111))
+ assert_equal(["bar", 111111, {}], f3(str: "bar", num: 111111))
+ assert_equal(["bar", 424242, {:check=>true}], f3(str: "bar", check: true))
+ assert_raise(ArgumentError) { f3("string") }
+ end
+
+
+ define_method(:f4) {|str: "foo", num: 424242| [str, num] }
+
+ def test_f4
+ assert_equal(["foo", 424242], f4)
+ assert_equal(["bar", 424242], f4(str: "bar"))
+ assert_equal(["foo", 111111], f4(num: 111111))
+ assert_equal(["bar", 111111], f4(str: "bar", num: 111111))
+ assert_raise(ArgumentError) { f4(str: "bar", check: true) }
+ assert_raise(ArgumentError) { f4("string") }
+ end
+
+
+ define_method(:f5) {|str: "foo", num: 424242, **h| [str, num, h] }
+
+ def test_f5
+ assert_equal(["foo", 424242, {}], f5)
+ assert_equal(["bar", 424242, {}], f5(str: "bar"))
+ assert_equal(["foo", 111111, {}], f5(num: 111111))
+ assert_equal(["bar", 111111, {}], f5(str: "bar", num: 111111))
+ assert_equal(["bar", 424242, {:check=>true}], f5(str: "bar", check: true))
+ assert_raise(ArgumentError) { f5("string") }
+ end
+
+
+ def f6(str: "foo", num: 424242, **h, &blk)
+ [str, num, h, blk]
+ end
+
+ def test_f6 # [ruby-core:40518]
+ assert_equal(["foo", 424242, {}, nil], f6)
+ assert_equal(["bar", 424242, {}, nil], f6(str: "bar"))
+ assert_equal(["foo", 111111, {}, nil], f6(num: 111111))
+ assert_equal(["bar", 111111, {}, nil], f6(str: "bar", num: 111111))
+ assert_equal(["bar", 424242, {:check=>true}, nil], f6(str: "bar", check: true))
+ a = f6 {|x| x + 42 }
+ assert_equal(["foo", 424242, {}], a[0, 3])
+ assert_equal(43, a.last.call(1))
+ end
+
+ def f7(*r, str: "foo", num: 424242, **h)
+ [r, str, num, h]
+ end
+
+ def test_f7 # [ruby-core:41772]
+ assert_equal([[], "foo", 424242, {}], f7)
+ assert_equal([[], "bar", 424242, {}], f7(str: "bar"))
+ assert_equal([[], "foo", 111111, {}], f7(num: 111111))
+ assert_equal([[], "bar", 111111, {}], f7(str: "bar", num: 111111))
+ assert_equal([[1], "foo", 424242, {}], f7(1))
+ assert_equal([[1, 2], "foo", 424242, {}], f7(1, 2))
+ assert_equal([[1, 2, 3], "foo", 424242, {}], f7(1, 2, 3))
+ assert_equal([[1], "bar", 424242, {}], f7(1, str: "bar"))
+ assert_equal([[1, 2], "bar", 424242, {}], f7(1, 2, str: "bar"))
+ assert_equal([[1, 2, 3], "bar", 424242, {}], f7(1, 2, 3, str: "bar"))
+ end
+
+ define_method(:f8) { |opt = :ion, *rest, key: :word|
+ [opt, rest, key]
+ }
+
+ def test_f8
+ assert_equal([:ion, [], :word], f8)
+ assert_equal([1, [], :word], f8(1))
+ assert_equal([1, [2], :word], f8(1, 2))
+ end
+
+ def f9(r, o=42, *args, p, k: :key, **kw, &b)
+ [r, o, args, p, k, kw, b]
+ end
+
+ def test_f9
+ assert_equal([1, 42, [], 2, :key, {}, nil], f9(1, 2))
+ assert_equal([1, 2, [], 3, :key, {}, nil], f9(1, 2, 3))
+ assert_equal([1, 2, [3], 4, :key, {}, nil], f9(1, 2, 3, 4))
+ assert_equal([1, 2, [3, 4], 5, :key, {str: "bar"}, nil], f9(1, 2, 3, 4, 5, str: "bar"))
+ end
+
+ def test_method_parameters
+ assert_equal([[:key, :str], [:key, :num]], method(:f1).parameters);
+ assert_equal([[:req, :x], [:key, :str], [:key, :num]], method(:f2).parameters);
+ assert_equal([[:key, :str], [:key, :num], [:keyrest, :h]], method(:f3).parameters);
+ assert_equal([[:key, :str], [:key, :num]], method(:f4).parameters);
+ assert_equal([[:key, :str], [:key, :num], [:keyrest, :h]], method(:f5).parameters);
+ assert_equal([[:key, :str], [:key, :num], [:keyrest, :h], [:block, :blk]], method(:f6).parameters);
+ assert_equal([[:rest, :r], [:key, :str], [:key, :num], [:keyrest, :h]], method(:f7).parameters);
+ assert_equal([[:opt, :opt], [:rest, :rest], [:key, :key]], method(:f8).parameters) # [Bug #7540] [ruby-core:50735]
+ assert_equal([[:req, :r], [:opt, :o], [:rest, :args], [:req, :p], [:key, :k],
+ [:keyrest, :kw], [:block, :b]], method(:f9).parameters)
+ end
+
+ def test_lambda
+ f = ->(str: "foo", num: 424242) { [str, num] }
+ assert_equal(["foo", 424242], f[])
+ assert_equal(["bar", 424242], f[str: "bar"])
+ assert_equal(["foo", 111111], f[num: 111111])
+ assert_equal(["bar", 111111], f[str: "bar", num: 111111])
+ end
+
+
+ def p1
+ Proc.new do |str: "foo", num: 424242|
+ [str, num]
+ end
+ end
+
+ def test_p1
+ assert_equal(["foo", 424242], p1[])
+ assert_equal(["bar", 424242], p1[str: "bar"])
+ assert_equal(["foo", 111111], p1[num: 111111])
+ assert_equal(["bar", 111111], p1[str: "bar", num: 111111])
+ assert_raise(ArgumentError) { p1[str: "bar", check: true] }
+ assert_equal(["foo", 424242], p1["string"] )
+ end
+
+
+ def p2
+ Proc.new do |x, str: "foo", num: 424242|
+ [x, str, num]
+ end
+ end
+
+ def test_p2
+ assert_equal([nil, "foo", 424242], p2[])
+ assert_equal([:xyz, "foo", 424242], p2[:xyz])
+ end
+
+
+ def p3
+ Proc.new do |str: "foo", num: 424242, **h|
+ [str, num, h]
+ end
+ end
+
+ def test_p3
+ assert_equal(["foo", 424242, {}], p3[])
+ assert_equal(["bar", 424242, {}], p3[str: "bar"])
+ assert_equal(["foo", 111111, {}], p3[num: 111111])
+ assert_equal(["bar", 111111, {}], p3[str: "bar", num: 111111])
+ assert_equal(["bar", 424242, {:check=>true}], p3[str: "bar", check: true])
+ assert_equal(["foo", 424242, {}], p3["string"])
+ end
+
+
+ def p4
+ Proc.new do |str: "foo", num: 424242, **h, &blk|
+ [str, num, h, blk]
+ end
+ end
+
+ def test_p4
+ assert_equal(["foo", 424242, {}, nil], p4[])
+ assert_equal(["bar", 424242, {}, nil], p4[str: "bar"])
+ assert_equal(["foo", 111111, {}, nil], p4[num: 111111])
+ assert_equal(["bar", 111111, {}, nil], p4[str: "bar", num: 111111])
+ assert_equal(["bar", 424242, {:check=>true}, nil], p4[str: "bar", check: true])
+ a = p4.call {|x| x + 42 }
+ assert_equal(["foo", 424242, {}], a[0, 3])
+ assert_equal(43, a.last.call(1))
+ end
+
+
+ def p5
+ Proc.new do |*r, str: "foo", num: 424242, **h|
+ [r, str, num, h]
+ end
+ end
+
+ def test_p5
+ assert_equal([[], "foo", 424242, {}], p5[])
+ assert_equal([[], "bar", 424242, {}], p5[str: "bar"])
+ assert_equal([[], "foo", 111111, {}], p5[num: 111111])
+ assert_equal([[], "bar", 111111, {}], p5[str: "bar", num: 111111])
+ assert_equal([[1], "foo", 424242, {}], p5[1])
+ assert_equal([[1, 2], "foo", 424242, {}], p5[1, 2])
+ assert_equal([[1, 2, 3], "foo", 424242, {}], p5[1, 2, 3])
+ assert_equal([[1], "bar", 424242, {}], p5[1, str: "bar"])
+ assert_equal([[1, 2], "bar", 424242, {}], p5[1, 2, str: "bar"])
+ assert_equal([[1, 2, 3], "bar", 424242, {}], p5[1, 2, 3, str: "bar"])
+ end
+
+
+ def p6
+ Proc.new do |o1, o2=42, *args, p, k: :key, **kw, &b|
+ [o1, o2, args, p, k, kw, b]
+ end
+ end
+
+ def test_p6
+ assert_equal([nil, 42, [], nil, :key, {}, nil], p6[])
+ assert_equal([1, 42, [], 2, :key, {}, nil], p6[1, 2])
+ assert_equal([1, 2, [], 3, :key, {}, nil], p6[1, 2, 3])
+ assert_equal([1, 2, [3], 4, :key, {}, nil], p6[1, 2, 3, 4])
+ assert_equal([1, 2, [3, 4], 5, :key, {str: "bar"}, nil], p6[1, 2, 3, 4, 5, str: "bar"])
+ end
+
+ def test_proc_parameters
+ assert_equal([[:key, :str], [:key, :num]], p1.parameters);
+ assert_equal([[:opt, :x], [:key, :str], [:key, :num]], p2.parameters);
+ assert_equal([[:key, :str], [:key, :num], [:keyrest, :h]], p3.parameters);
+ assert_equal([[:key, :str], [:key, :num], [:keyrest, :h], [:block, :blk]], p4.parameters);
+ assert_equal([[:rest, :r], [:key, :str], [:key, :num], [:keyrest, :h]], p5.parameters);
+ assert_equal([[:opt, :o1], [:opt, :o2], [:rest, :args], [:opt, :p], [:key, :k],
+ [:keyrest, :kw], [:block, :b]], p6.parameters)
+ end
+
+ def m1(*args)
+ yield(*args)
+ end
+
+ def test_block
+ blk = Proc.new {|str: "foo", num: 424242| [str, num] }
+ assert_equal(["foo", 424242], m1(&blk))
+ assert_equal(["bar", 424242], m1(str: "bar", &blk))
+ assert_equal(["foo", 111111], m1(num: 111111, &blk))
+ assert_equal(["bar", 111111], m1(str: "bar", num: 111111, &blk))
+ end
+
+ def rest_keyrest(*args, **opt)
+ return *args, opt
+ end
+
+ def test_rest_keyrest
+ bug7665 = '[ruby-core:51278]'
+ bug8463 = '[ruby-core:55203] [Bug #8463]'
+ expect = [*%w[foo bar], {zzz: 42}]
+ assert_equal(expect, rest_keyrest(*expect), bug7665)
+ pr = proc {|*args, **opt| next *args, opt}
+ assert_equal(expect, pr.call(*expect), bug7665)
+ assert_equal(expect, pr.call(expect), bug8463)
+ pr = proc {|a, *b, **opt| next a, *b, opt}
+ assert_equal(expect, pr.call(expect), bug8463)
+ pr = proc {|a, **opt| next a, opt}
+ assert_equal(expect.values_at(0, -1), pr.call(expect), bug8463)
+ end
+
+ def test_bare_kwrest
+ # valid syntax, but its semantics is undefined
+ assert_valid_syntax("def bug7662(**) end")
+ assert_valid_syntax("def bug7662(*, **) end")
+ assert_valid_syntax("def bug7662(a, **) end")
+ end
+
+ def test_without_paren
+ bug7942 = '[ruby-core:52820] [Bug #7942]'
+ assert_valid_syntax("def bug7942 a: 1; end")
+ assert_valid_syntax("def bug7942 a: 1, **; end")
+
+ o = Object.new
+ eval("def o.bug7942 a: 1; a; end", nil, __FILE__, __LINE__)
+ assert_equal(1, o.bug7942(), bug7942)
+ assert_equal(42, o.bug7942(a: 42), bug7942)
+
+ o = Object.new
+ eval("def o.bug7942 a: 1, **; a; end", nil, __FILE__, __LINE__)
+ assert_equal(1, o.bug7942(), bug7942)
+ assert_equal(42, o.bug7942(a: 42), bug7942)
+ end
+
+ def test_required_keyword
+ feature7701 = '[ruby-core:51454] [Feature #7701] required keyword argument'
+ o = Object.new
+ assert_nothing_raised(SyntaxError, feature7701) do
+ eval("def o.foo(a:) a; end")
+ eval("def o.bar(a:,**b) [a, b]; end")
+ end
+ assert_raise(ArgumentError, feature7701) {o.foo}
+ assert_equal(42, o.foo(a: 42), feature7701)
+ assert_equal([[:keyreq, :a]], o.method(:foo).parameters, feature7701)
+
+ bug8139 = '[ruby-core:53608] [Bug #8139] required keyword argument with rest hash'
+ assert_equal([42, {}], o.bar(a: 42), feature7701)
+ assert_equal([[:keyreq, :a], [:keyrest, :b]], o.method(:bar).parameters, feature7701)
+ assert_raise(ArgumentError, bug8139) {o.bar(c: bug8139)}
+ assert_raise(ArgumentError, bug8139) {o.bar}
+ end
+
+ def test_block_required_keyword
+ feature7701 = '[ruby-core:51454] [Feature #7701] required keyword argument'
+ b = assert_nothing_raised(SyntaxError, feature7701) do
+ break eval("proc {|a:| a}")
+ end
+ assert_raise(ArgumentError, feature7701) {b.call}
+ assert_equal(42, b.call(a: 42), feature7701)
+ assert_equal([[:keyreq, :a]], b.parameters, feature7701)
+
+ bug8139 = '[ruby-core:53608] [Bug #8139] required keyword argument with rest hash'
+ b = assert_nothing_raised(SyntaxError, feature7701) do
+ break eval("proc {|a:, **b| [a, b]}")
+ end
+ assert_equal([42, {}], b.call(a: 42), feature7701)
+ assert_equal([[:keyreq, :a], [:keyrest, :b]], b.parameters, feature7701)
+ assert_raise(ArgumentError, bug8139) {b.call(c: bug8139)}
+ assert_raise(ArgumentError, bug8139) {b.call}
+ end
+
+ def test_super_with_keyword
+ bug8236 = '[ruby-core:54094] [Bug #8236]'
+ base = Class.new do
+ def foo(*args)
+ args
+ end
+ end
+ a = Class.new(base) do
+ def foo(arg, bar: 'x')
+ super
+ end
+ end
+ b = Class.new(base) do
+ def foo(*args, bar: 'x')
+ super
+ end
+ end
+ assert_equal([42, {:bar=>"x"}], a.new.foo(42), bug8236)
+ assert_equal([42, {:bar=>"x"}], b.new.foo(42), bug8236)
+ end
+
+ def test_zsuper_only_named_kwrest
+ bug8416 = '[ruby-core:55033] [Bug #8416]'
+ base = Class.new do
+ def foo(**h)
+ h
+ end
+ end
+ a = Class.new(base) do
+ def foo(**h)
+ super
+ end
+ end
+ assert_equal({:bar=>"x"}, a.new.foo(bar: "x"), bug8416)
+ end
+
+ def test_zsuper_only_anonymous_kwrest
+ bug8416 = '[ruby-core:55033] [Bug #8416]'
+ base = Class.new do
+ def foo(**h)
+ h
+ end
+ end
+ a = Class.new(base) do
+ def foo(**)
+ super
+ end
+ end
+ assert_equal({:bar=>"x"}, a.new.foo(bar: "x"), bug8416)
+ end
+
+ def test_precedence_of_keyword_arguments
+ bug8040 = '[ruby-core:53199] [Bug #8040]'
+ a = Class.new do
+ def foo(x, **h)
+ [x, h]
+ end
+ end
+ assert_equal([{}, {}], a.new.foo({}))
+ assert_equal([{}, {:bar=>"x"}], a.new.foo({}, bar: "x"))
+ end
+
+ def test_gced_object_in_stack
+ bug8964 = '[ruby-dev:47729] [Bug #8964]'
+ assert_normal_exit %q{
+ def m(a: [])
+ end
+ GC.stress = true
+ tap { m }
+ GC.start
+ tap { m }
+ }, bug8964
+ assert_normal_exit %q{
+ prc = Proc.new {|a: []|}
+ GC.stress = true
+ tap { prc.call }
+ GC.start
+ tap { prc.call }
+ }, bug8964
+ end
+end
diff --git a/test/ruby/test_lambda.rb b/test/ruby/test_lambda.rb
index ae12c6d609..24efa71bc1 100644
--- a/test/ruby/test_lambda.rb
+++ b/test/ruby/test_lambda.rb
@@ -70,4 +70,67 @@ class TestLambdaParameters < Test::Unit::TestCase
BasicObject.new.instance_eval {->() {called = true}.()}
assert_equal(true, called, bug5966)
end
+
+ def test_location_on_error
+ bug6151 = '[ruby-core:43314]'
+ called = 0
+ line, f = __LINE__, lambda do
+ called += 1
+ true
+ end
+ e = assert_raise(ArgumentError) do
+ f.call(42)
+ end
+ assert_send([e.backtrace.first, :start_with?, "#{__FILE__}:#{line}:"], bug6151)
+ assert_equal(0, called)
+ e = assert_raise(ArgumentError) do
+ 42.times(&f)
+ end
+ assert_send([e.backtrace.first, :start_with?, "#{__FILE__}:#{line}:"], bug6151)
+ assert_equal(0, called)
+ end
+
+ def return_in_current(val)
+ 1.tap &->(*) {return 0}
+ val
+ end
+
+ def yield_block
+ yield
+ end
+
+ def return_in_callee(val)
+ yield_block &->(*) {return 0}
+ val
+ end
+
+ def test_return
+ feature8693 = '[ruby-core:56193] [Feature #8693]'
+ assert_equal(42, return_in_current(42), feature8693)
+ assert_equal(42, return_in_callee(42), feature8693)
+ end
+
+ def test_do_lambda_source_location
+ exp_lineno = __LINE__ + 3
+ lmd = ->(x,
+ y,
+ z) do
+ #
+ end
+ file, lineno = lmd.source_location
+ assert_match(/^#{ Regexp.quote(__FILE__) }$/, file)
+ assert_equal(exp_lineno, lineno, "must be at the beginning of the block")
+ end
+
+ def test_brace_lambda_source_location
+ exp_lineno = __LINE__ + 3
+ lmd = ->(x,
+ y,
+ z) {
+ #
+ }
+ file, lineno = lmd.source_location
+ assert_match(/^#{ Regexp.quote(__FILE__) }$/, file)
+ assert_equal(exp_lineno, lineno, "must be at the beginning of the block")
+ end
end
diff --git a/test/ruby/test_lazy_enumerator.rb b/test/ruby/test_lazy_enumerator.rb
new file mode 100644
index 0000000000..760db95f7b
--- /dev/null
+++ b/test/ruby/test_lazy_enumerator.rb
@@ -0,0 +1,493 @@
+require 'test/unit'
+require_relative 'envutil'
+
+class TestLazyEnumerator < Test::Unit::TestCase
+ class Step
+ include Enumerable
+ attr_reader :current, :args
+
+ def initialize(enum)
+ @enum = enum
+ @current = nil
+ @args = nil
+ end
+
+ def each(*args)
+ @args = args
+ @enum.each {|i| @current = i; yield i}
+ end
+ end
+
+ def test_initialize
+ assert_equal([1, 2, 3], [1, 2, 3].lazy.to_a)
+ assert_equal([1, 2, 3], Enumerator::Lazy.new([1, 2, 3]){|y, v| y << v}.to_a)
+ assert_raise(ArgumentError) { Enumerator::Lazy.new([1, 2, 3]) }
+
+ a = [1, 2, 3].lazy
+ a.freeze
+ assert_raise(RuntimeError) {
+ a.__send__ :initialize, [4, 5], &->(y, *v) { y << yield(*v) }
+ }
+ end
+
+ def test_each_args
+ a = Step.new(1..3)
+ assert_equal(1, a.lazy.each(4).first)
+ assert_equal([4], a.args)
+ end
+
+ def test_each_line
+ name = lineno = nil
+ File.open(__FILE__) do |f|
+ f.each("").map do |paragraph|
+ paragraph[/\A\s*(.*)/, 1]
+ end.find do |line|
+ if name = line[/^class\s+(\S+)/, 1]
+ lineno = f.lineno
+ true
+ end
+ end
+ end
+ assert_equal(self.class.name, name)
+ assert_operator(lineno, :>, 2)
+
+ name = lineno = nil
+ File.open(__FILE__) do |f|
+ f.lazy.each("").map do |paragraph|
+ paragraph[/\A\s*(.*)/, 1]
+ end.find do |line|
+ if name = line[/^class\s+(\S+)/, 1]
+ lineno = f.lineno
+ true
+ end
+ end
+ end
+ assert_equal(self.class.name, name)
+ assert_equal(2, lineno)
+ end
+
+ def test_select
+ a = Step.new(1..6)
+ assert_equal(4, a.select {|x| x > 3}.first)
+ assert_equal(6, a.current)
+ assert_equal(4, a.lazy.select {|x| x > 3}.first)
+ assert_equal(4, a.current)
+
+ a = Step.new(['word', nil, 1])
+ assert_raise(TypeError) {a.select {|x| "x"+x}.first}
+ assert_equal(nil, a.current)
+ assert_equal("word", a.lazy.select {|x| "x"+x}.first)
+ assert_equal("word", a.current)
+ end
+
+ def test_select_multiple_values
+ e = Enumerator.new { |yielder|
+ for i in 1..5
+ yielder.yield(i, i.to_s)
+ end
+ }
+ assert_equal([[2, "2"], [4, "4"]],
+ e.select {|x| x[0] % 2 == 0})
+ assert_equal([[2, "2"], [4, "4"]],
+ e.lazy.select {|x| x[0] % 2 == 0}.force)
+ end
+
+ def test_map
+ a = Step.new(1..3)
+ assert_equal(2, a.map {|x| x * 2}.first)
+ assert_equal(3, a.current)
+ assert_equal(2, a.lazy.map {|x| x * 2}.first)
+ assert_equal(1, a.current)
+ end
+
+ def test_flat_map
+ a = Step.new(1..3)
+ assert_equal(2, a.flat_map {|x| [x * 2]}.first)
+ assert_equal(3, a.current)
+ assert_equal(2, a.lazy.flat_map {|x| [x * 2]}.first)
+ assert_equal(1, a.current)
+ end
+
+ def test_flat_map_nested
+ a = Step.new(1..3)
+ assert_equal([1, "a"],
+ a.flat_map {|x| ("a".."c").map {|y| [x, y]}}.first)
+ assert_equal(3, a.current)
+ assert_equal([1, "a"],
+ a.lazy.flat_map {|x| ("a".."c").lazy.map {|y| [x, y]}}.first)
+ assert_equal(1, a.current)
+ end
+
+ def test_flat_map_to_ary
+ to_ary = Class.new {
+ def initialize(value)
+ @value = value
+ end
+
+ def to_ary
+ [:to_ary, @value]
+ end
+ }
+ assert_equal([:to_ary, 1, :to_ary, 2, :to_ary, 3],
+ [1, 2, 3].flat_map {|x| to_ary.new(x)})
+ assert_equal([:to_ary, 1, :to_ary, 2, :to_ary, 3],
+ [1, 2, 3].lazy.flat_map {|x| to_ary.new(x)}.force)
+ end
+
+ def test_flat_map_non_array
+ assert_equal(["1", "2", "3"], [1, 2, 3].flat_map {|x| x.to_s})
+ assert_equal(["1", "2", "3"], [1, 2, 3].lazy.flat_map {|x| x.to_s}.force)
+ end
+
+ def test_flat_map_hash
+ assert_equal([{?a=>97}, {?b=>98}, {?c=>99}], [?a, ?b, ?c].flat_map {|x| {x=>x.ord}})
+ assert_equal([{?a=>97}, {?b=>98}, {?c=>99}], [?a, ?b, ?c].lazy.flat_map {|x| {x=>x.ord}}.force)
+ end
+
+ def test_reject
+ a = Step.new(1..6)
+ assert_equal(4, a.reject {|x| x < 4}.first)
+ assert_equal(6, a.current)
+ assert_equal(4, a.lazy.reject {|x| x < 4}.first)
+ assert_equal(4, a.current)
+
+ a = Step.new(['word', nil, 1])
+ assert_equal(nil, a.reject {|x| x}.first)
+ assert_equal(1, a.current)
+ assert_equal(nil, a.lazy.reject {|x| x}.first)
+ assert_equal(nil, a.current)
+ end
+
+ def test_reject_multiple_values
+ e = Enumerator.new { |yielder|
+ for i in 1..5
+ yielder.yield(i, i.to_s)
+ end
+ }
+ assert_equal([[2, "2"], [4, "4"]],
+ e.reject {|x| x[0] % 2 != 0})
+ assert_equal([[2, "2"], [4, "4"]],
+ e.lazy.reject {|x| x[0] % 2 != 0}.force)
+ end
+
+ def test_grep
+ a = Step.new('a'..'f')
+ assert_equal('c', a.grep(/c/).first)
+ assert_equal('f', a.current)
+ assert_equal('c', a.lazy.grep(/c/).first)
+ assert_equal('c', a.current)
+ assert_equal(%w[a e], a.grep(proc {|x| /[aeiou]/ =~ x}))
+ assert_equal(%w[a e], a.lazy.grep(proc {|x| /[aeiou]/ =~ x}).to_a)
+ end
+
+ def test_grep_with_block
+ a = Step.new('a'..'f')
+ assert_equal('C', a.grep(/c/) {|i| i.upcase}.first)
+ assert_equal('C', a.lazy.grep(/c/) {|i| i.upcase}.first)
+ end
+
+ def test_grep_multiple_values
+ e = Enumerator.new { |yielder|
+ 3.times { |i|
+ yielder.yield(i, i.to_s)
+ }
+ }
+ assert_equal([[2, "2"]], e.grep(proc {|x| x == [2, "2"]}))
+ assert_equal([[2, "2"]], e.lazy.grep(proc {|x| x == [2, "2"]}).force)
+ assert_equal(["22"],
+ e.lazy.grep(proc {|x| x == [2, "2"]}, &:join).force)
+ end
+
+ def test_zip
+ a = Step.new(1..3)
+ assert_equal([1, "a"], a.zip("a".."c").first)
+ assert_equal(3, a.current)
+ assert_equal([1, "a"], a.lazy.zip("a".."c").first)
+ assert_equal(1, a.current)
+ end
+
+ def test_zip_short_arg
+ a = Step.new(1..5)
+ assert_equal([5, nil], a.zip("a".."c").last)
+ assert_equal([5, nil], a.lazy.zip("a".."c").force.last)
+ end
+
+ def test_zip_without_arg
+ a = Step.new(1..3)
+ assert_equal([1], a.zip.first)
+ assert_equal(3, a.current)
+ assert_equal([1], a.lazy.zip.first)
+ assert_equal(1, a.current)
+ end
+
+ def test_zip_bad_arg
+ a = Step.new(1..3)
+ assert_raise(TypeError){ a.lazy.zip(42) }
+ end
+
+ def test_zip_with_block
+ # zip should be eager when a block is given
+ a = Step.new(1..3)
+ ary = []
+ assert_equal(nil, a.lazy.zip("a".."c") {|x, y| ary << [x, y]})
+ assert_equal(a.zip("a".."c"), ary)
+ assert_equal(3, a.current)
+ end
+
+ def test_take
+ a = Step.new(1..10)
+ assert_equal(1, a.take(5).first)
+ assert_equal(5, a.current)
+ assert_equal(1, a.lazy.take(5).first)
+ assert_equal(1, a.current)
+ assert_equal((1..5).to_a, a.lazy.take(5).force)
+ assert_equal(5, a.current)
+ a = Step.new(1..10)
+ assert_equal([], a.lazy.take(0).force)
+ assert_equal(nil, a.current)
+ end
+
+ def test_take_recycle
+ bug6428 = '[ruby-dev:45634]'
+ a = Step.new(1..10)
+ take5 = a.lazy.take(5)
+ assert_equal((1..5).to_a, take5.force, bug6428)
+ assert_equal((1..5).to_a, take5.force, bug6428)
+ end
+
+ def test_take_nested
+ bug7696 = '[ruby-core:51470]'
+ a = Step.new(1..10)
+ take5 = a.lazy.take(5)
+ assert_equal([*(1..5)]*5, take5.flat_map{take5}.force, bug7696)
+ end
+
+ def test_drop_while_nested
+ bug7696 = '[ruby-core:51470]'
+ a = Step.new(1..10)
+ drop5 = a.lazy.drop_while{|x| x < 6}
+ assert_equal([*(6..10)]*5, drop5.flat_map{drop5}.force, bug7696)
+ end
+
+ def test_drop_nested
+ bug7696 = '[ruby-core:51470]'
+ a = Step.new(1..10)
+ drop5 = a.lazy.drop(5)
+ assert_equal([*(6..10)]*5, drop5.flat_map{drop5}.force, bug7696)
+ end
+
+ def test_zip_nested
+ bug7696 = '[ruby-core:51470]'
+ enum = ('a'..'z').each
+ enum.next
+ zip = (1..3).lazy.zip(enum, enum)
+ assert_equal([[1, 'a', 'a'], [2, 'b', 'b'], [3, 'c', 'c']]*3, zip.flat_map{zip}.force, bug7696)
+ end
+
+ def test_zip_lazy_on_args
+ zip = Step.new(1..2).lazy.zip(42..Float::INFINITY)
+ assert_equal [[1, 42], [2, 43]], zip.force
+ end
+
+ def test_zip_efficient_on_array_args
+ ary = [42, :foo]
+ %i[to_enum enum_for lazy each].each do |forbid|
+ ary.define_singleton_method(forbid){ fail "#{forbid} was called"}
+ end
+ zip = Step.new(1..2).lazy.zip(ary)
+ assert_equal [[1, 42], [2, :foo]], zip.force
+ end
+
+ def test_zip_nonsingle
+ bug8735 = '[ruby-core:56383] [Bug #8735]'
+
+ obj = Object.new
+ def obj.each
+ yield
+ yield 1, 2
+ end
+
+ assert_equal(obj.to_enum.zip(obj.to_enum), obj.to_enum.lazy.zip(obj.to_enum).force, bug8735)
+ end
+
+ def test_take_rewound
+ bug7696 = '[ruby-core:51470]'
+ e=(1..42).lazy.take(2)
+ assert_equal 1, e.next
+ assert_equal 2, e.next
+ e.rewind
+ assert_equal 1, e.next
+ assert_equal 2, e.next
+ end
+
+ def test_take_while
+ a = Step.new(1..10)
+ assert_equal(1, a.take_while {|i| i < 5}.first)
+ assert_equal(5, a.current)
+ assert_equal(1, a.lazy.take_while {|i| i < 5}.first)
+ assert_equal(1, a.current)
+ assert_equal((1..4).to_a, a.lazy.take_while {|i| i < 5}.to_a)
+ end
+
+ def test_drop
+ a = Step.new(1..10)
+ assert_equal(6, a.drop(5).first)
+ assert_equal(10, a.current)
+ assert_equal(6, a.lazy.drop(5).first)
+ assert_equal(6, a.current)
+ assert_equal((6..10).to_a, a.lazy.drop(5).to_a)
+ end
+
+ def test_drop_while
+ a = Step.new(1..10)
+ assert_equal(5, a.drop_while {|i| i % 5 > 0}.first)
+ assert_equal(10, a.current)
+ assert_equal(5, a.lazy.drop_while {|i| i % 5 > 0}.first)
+ assert_equal(5, a.current)
+ assert_equal((5..10).to_a, a.lazy.drop_while {|i| i % 5 > 0}.to_a)
+ end
+
+ def test_drop_and_take
+ assert_equal([4, 5], (1..Float::INFINITY).lazy.drop(3).take(2).to_a)
+ end
+
+ def test_cycle
+ a = Step.new(1..3)
+ assert_equal("1", a.cycle(2).map(&:to_s).first)
+ assert_equal(3, a.current)
+ assert_equal("1", a.lazy.cycle(2).map(&:to_s).first)
+ assert_equal(1, a.current)
+ end
+
+ def test_cycle_with_block
+ # cycle should be eager when a block is given
+ a = Step.new(1..3)
+ ary = []
+ assert_equal(nil, a.lazy.cycle(2) {|i| ary << i})
+ assert_equal(a.cycle(2).to_a, ary)
+ assert_equal(3, a.current)
+ end
+
+ def test_cycle_chain
+ a = 1..3
+ assert_equal([1,2,3,1,2,3,1,2,3,1], a.lazy.cycle.take(10).force)
+ assert_equal([2,2,2,2,2,2,2,2,2,2], a.lazy.cycle.select {|x| x == 2}.take(10).force)
+ assert_equal([2,2,2,2,2,2,2,2,2,2], a.lazy.select {|x| x == 2}.cycle.take(10).force)
+ end
+
+ def test_force
+ assert_equal([1, 2, 3], (1..Float::INFINITY).lazy.take(3).force)
+ end
+
+ def test_inspect
+ assert_equal("#<Enumerator::Lazy: 1..10>", (1..10).lazy.inspect)
+ assert_equal('#<Enumerator::Lazy: #<Enumerator: "foo":each_char>>',
+ "foo".each_char.lazy.inspect)
+ assert_equal("#<Enumerator::Lazy: #<Enumerator::Lazy: 1..10>:map>",
+ (1..10).lazy.map {}.inspect)
+ assert_equal("#<Enumerator::Lazy: #<Enumerator::Lazy: 1..10>:take(0)>",
+ (1..10).lazy.take(0).inspect)
+ assert_equal("#<Enumerator::Lazy: #<Enumerator::Lazy: 1..10>:take(3)>",
+ (1..10).lazy.take(3).inspect)
+ assert_equal('#<Enumerator::Lazy: #<Enumerator::Lazy: "a".."c">:grep(/b/)>',
+ ("a".."c").lazy.grep(/b/).inspect)
+ assert_equal("#<Enumerator::Lazy: #<Enumerator::Lazy: 1..10>:cycle(3)>",
+ (1..10).lazy.cycle(3).inspect)
+ assert_equal("#<Enumerator::Lazy: #<Enumerator::Lazy: 1..10>:cycle>",
+ (1..10).lazy.cycle.inspect)
+ assert_equal("#<Enumerator::Lazy: #<Enumerator::Lazy: 1..10>:cycle(3)>",
+ (1..10).lazy.cycle(3).inspect)
+ l = (1..10).lazy.map {}.collect {}.flat_map {}.collect_concat {}.select {}.find_all {}.reject {}.grep(1).zip(?a..?c).take(10).take_while {}.drop(3).drop_while {}.cycle(3)
+ assert_equal(<<EOS.chomp, l.inspect)
+#<Enumerator::Lazy: #<Enumerator::Lazy: #<Enumerator::Lazy: #<Enumerator::Lazy: #<Enumerator::Lazy: #<Enumerator::Lazy: #<Enumerator::Lazy: #<Enumerator::Lazy: #<Enumerator::Lazy: #<Enumerator::Lazy: #<Enumerator::Lazy: #<Enumerator::Lazy: #<Enumerator::Lazy: #<Enumerator::Lazy: #<Enumerator::Lazy: 1..10>:map>:collect>:flat_map>:collect_concat>:select>:find_all>:reject>:grep(1)>:zip("a".."c")>:take(10)>:take_while>:drop(3)>:drop_while>:cycle(3)>
+EOS
+ end
+
+ def test_lazy_to_enum
+ lazy = [1, 2, 3].lazy
+ def lazy.foo(*args)
+ yield args
+ yield args
+ end
+ enum = lazy.to_enum(:foo, :hello, :world)
+ assert_equal Enumerator::Lazy, enum.class
+ assert_equal nil, enum.size
+ assert_equal [[:hello, :world], [:hello, :world]], enum.to_a
+
+ assert_equal [1, 2, 3], lazy.to_enum.to_a
+ end
+
+ def test_size
+ lazy = [1, 2, 3].lazy
+ assert_equal 3, lazy.size
+ assert_equal 42, Enumerator::Lazy.new([],->{42}){}.size
+ assert_equal 42, Enumerator::Lazy.new([],42){}.size
+ assert_equal 42, Enumerator::Lazy.new([],42){}.lazy.size
+ assert_equal 42, lazy.to_enum{ 42 }.size
+
+ %i[map collect].each do |m|
+ assert_equal 3, lazy.send(m){}.size
+ end
+ assert_equal 3, lazy.zip([4]).size
+ %i[flat_map collect_concat select find_all reject take_while drop_while].each do |m|
+ assert_equal nil, lazy.send(m){}.size
+ end
+ assert_equal nil, lazy.grep(//).size
+
+ assert_equal 2, lazy.take(2).size
+ assert_equal 3, lazy.take(4).size
+ assert_equal 4, loop.lazy.take(4).size
+ assert_equal nil, lazy.select{}.take(4).size
+
+ assert_equal 1, lazy.drop(2).size
+ assert_equal 0, lazy.drop(4).size
+ assert_equal Float::INFINITY, loop.lazy.drop(4).size
+ assert_equal nil, lazy.select{}.drop(4).size
+
+ assert_equal 0, lazy.cycle(0).size
+ assert_equal 6, lazy.cycle(2).size
+ assert_equal 3 << 80, 4.times.inject(lazy){|enum| enum.cycle(1 << 20)}.size
+ assert_equal Float::INFINITY, lazy.cycle.size
+ assert_equal Float::INFINITY, loop.lazy.cycle(4).size
+ assert_equal Float::INFINITY, loop.lazy.cycle.size
+ assert_equal nil, lazy.select{}.cycle(4).size
+ assert_equal nil, lazy.select{}.cycle.size
+ end
+
+ def test_map_zip
+ bug7507 = '[ruby-core:50545]'
+ assert_ruby_status(["-e", "GC.stress = true", "-e", "(1..10).lazy.map{}.zip(){}"], "", bug7507)
+ assert_ruby_status(["-e", "GC.stress = true", "-e", "(1..10).lazy.map{}.zip().to_a"], "", bug7507)
+ end
+
+ def test_require_block
+ %i[select reject drop_while take_while map flat_map].each do |method|
+ assert_raise(ArgumentError){ [].lazy.send(method) }
+ end
+ end
+
+ def test_laziness_conservation
+ bug7507 = '[ruby-core:51510]'
+ {
+ slice_before: //,
+ with_index: nil,
+ cycle: nil,
+ each_with_object: 42,
+ each_slice: 42,
+ each_entry: nil,
+ each_cons: 42,
+ }.each do |method, arg|
+ assert_equal Enumerator::Lazy, [].lazy.send(method, *arg).class, bug7507
+ end
+ assert_equal Enumerator::Lazy, [].lazy.chunk{}.class, bug7507
+ end
+
+ def test_no_warnings
+ le = (1..3).lazy
+ assert_warning("") {le.zip([4,5,6]).force}
+ assert_warning("") {le.zip(4..6).force}
+ assert_warning("") {le.take(1).force}
+ assert_warning("") {le.drop(1).force}
+ assert_warning("") {le.drop_while{false}.force}
+ end
+end
diff --git a/test/ruby/test_literal.rb b/test/ruby/test_literal.rb
index e7a7c76891..e4c35e03d9 100644
--- a/test/ruby/test_literal.rb
+++ b/test/ruby/test_literal.rb
@@ -1,4 +1,6 @@
+# -*- coding: us-ascii -*-
require 'test/unit'
+require_relative 'envutil'
class TestRubyLiteral < Test::Unit::TestCase
@@ -186,6 +188,148 @@ class TestRubyLiteral < Test::Unit::TestCase
assert_equal "literal", h["string"]
end
+ def test_big_array_and_hash_literal
+ assert_normal_exit %q{GC.disable=true; x = nil; raise if eval("[#{(1..1_000_000).map{'x'}.join(", ")}]").size != 1_000_000}, "", timeout: 300, child_env: %[--disable-gems]
+ assert_normal_exit %q{GC.disable=true; x = nil; raise if eval("[#{(1..1_000_000).to_a.join(", ")}]").size != 1_000_000}, "", timeout: 300, child_env: %[--disable-gems]
+ assert_normal_exit %q{GC.disable=true; x = nil; raise if eval("{#{(1..1_000_000).map{|n| "#{n} => x"}.join(', ')}}").size != 1_000_000}, "", timeout: 300, child_env: %[--disable-gems]
+ assert_normal_exit %q{GC.disable=true; x = nil; raise if eval("{#{(1..1_000_000).map{|n| "#{n} => #{n}"}.join(', ')}}").size != 1_000_000}, "", timeout: 300, child_env: %[--disable-gems]
+
+ bug7466 = '[ruby-dev:46658]'
+ h = {
+ 0xFE042 => 0xE5CD,
+ 0xFE043 => 0xE5CD,
+ 0xFE045 => 0xEA94,
+ 0xFE046 => 0xE4E3,
+ 0xFE047 => 0xE4E2,
+ 0xFE048 => 0xEA96,
+ 0xFE049 => 0x3013,
+ 0xFE04A => 0xEB36,
+ 0xFE04B => 0xEB37,
+ 0xFE04C => 0xEB38,
+ 0xFE04D => 0xEB49,
+ 0xFE04E => 0xEB82,
+ 0xFE04F => 0xE4D2,
+ 0xFE050 => 0xEB35,
+ 0xFE051 => 0xEAB9,
+ 0xFE052 => 0xEABA,
+ 0xFE053 => 0xE4D4,
+ 0xFE054 => 0xE4CD,
+ 0xFE055 => 0xEABB,
+ 0xFE056 => 0xEABC,
+ 0xFE057 => 0xEB32,
+ 0xFE058 => 0xEB33,
+ 0xFE059 => 0xEB34,
+ 0xFE05A => 0xEB39,
+ 0xFE05B => 0xEB5A,
+ 0xFE190 => 0xE5A4,
+ 0xFE191 => 0xE5A5,
+ 0xFE192 => 0xEAD0,
+ 0xFE193 => 0xEAD1,
+ 0xFE194 => 0xEB47,
+ 0xFE195 => 0xE509,
+ 0xFE196 => 0xEAA0,
+ 0xFE197 => 0xE50B,
+ 0xFE198 => 0xEAA1,
+ 0xFE199 => 0xEAA2,
+ 0xFE19A => 0x3013,
+ 0xFE19B => 0xE4FC,
+ 0xFE19C => 0xE4FA,
+ 0xFE19D => 0xE4FC,
+ 0xFE19E => 0xE4FA,
+ 0xFE19F => 0xE501,
+ 0xFE1A0 => 0x3013,
+ 0xFE1A1 => 0xE5DD,
+ 0xFE1A2 => 0xEADB,
+ 0xFE1A3 => 0xEAE9,
+ 0xFE1A4 => 0xEB13,
+ 0xFE1A5 => 0xEB14,
+ 0xFE1A6 => 0xEB15,
+ 0xFE1A7 => 0xEB16,
+ 0xFE1A8 => 0xEB17,
+ 0xFE1A9 => 0xEB18,
+ 0xFE1AA => 0xEB19,
+ 0xFE1AB => 0xEB1A,
+ 0xFE1AC => 0xEB44,
+ 0xFE1AD => 0xEB45,
+ 0xFE1AE => 0xE4CB,
+ 0xFE1AF => 0xE5BF,
+ 0xFE1B0 => 0xE50E,
+ 0xFE1B1 => 0xE4EC,
+ 0xFE1B2 => 0xE4EF,
+ 0xFE1B3 => 0xE4F8,
+ 0xFE1B4 => 0x3013,
+ 0xFE1B5 => 0x3013,
+ 0xFE1B6 => 0xEB1C,
+ 0xFE1B9 => 0xEB7E,
+ 0xFE1D3 => 0xEB22,
+ 0xFE7DC => 0xE4D8,
+ 0xFE1D4 => 0xEB23,
+ 0xFE1D5 => 0xEB24,
+ 0xFE1D6 => 0xEB25,
+ 0xFE1CC => 0xEB1F,
+ 0xFE1CD => 0xEB20,
+ 0xFE1CE => 0xE4D9,
+ 0xFE1CF => 0xE48F,
+ 0xFE1C5 => 0xE5C7,
+ 0xFE1C6 => 0xEAEC,
+ 0xFE1CB => 0xEB1E,
+ 0xFE1DA => 0xE4DD,
+ 0xFE1E1 => 0xEB57,
+ 0xFE1E2 => 0xEB58,
+ 0xFE1E3 => 0xE492,
+ 0xFE1C9 => 0xEB1D,
+ 0xFE1D9 => 0xE4D3,
+ 0xFE1DC => 0xE5D4,
+ 0xFE1BA => 0xE4E0,
+ 0xFE1BB => 0xEB76,
+ 0xFE1C8 => 0xE4E0,
+ 0xFE1DD => 0xE5DB,
+ 0xFE1BC => 0xE4DC,
+ 0xFE1D8 => 0xE4DF,
+ 0xFE1BD => 0xE49A,
+ 0xFE1C7 => 0xEB1B,
+ 0xFE1C2 => 0xE5C2,
+ 0xFE1C0 => 0xE5C0,
+ 0xFE1B8 => 0xE4DB,
+ 0xFE1C3 => 0xE470,
+ 0xFE1BE => 0xE4D8,
+ 0xFE1C4 => 0xE4D9,
+ 0xFE1B7 => 0xE4E1,
+ 0xFE1BF => 0xE4DE,
+ 0xFE1C1 => 0xE5C1,
+ 0xFE1CA => 0x3013,
+ 0xFE1D0 => 0xE4E1,
+ 0xFE1D1 => 0xEB21,
+ 0xFE1D2 => 0xE4D7,
+ 0xFE1D7 => 0xE4DA,
+ 0xFE1DB => 0xE4EE,
+ 0xFE1DE => 0xEB3F,
+ 0xFE1DF => 0xEB46,
+ 0xFE1E0 => 0xEB48,
+ 0xFE336 => 0xE4FB,
+ 0xFE320 => 0xE472,
+ 0xFE321 => 0xEB67,
+ 0xFE322 => 0xEACA,
+ 0xFE323 => 0xEAC0,
+ 0xFE324 => 0xE5AE,
+ 0xFE325 => 0xEACB,
+ 0xFE326 => 0xEAC9,
+ 0xFE327 => 0xE5C4,
+ 0xFE328 => 0xEAC1,
+ 0xFE329 => 0xE4E7,
+ 0xFE32A => 0xE4E7,
+ 0xFE32B => 0xEACD,
+ 0xFE32C => 0xEACF,
+ 0xFE32D => 0xEACE,
+ 0xFE32E => 0xEAC7,
+ 0xFE32F => 0xEAC8,
+ 0xFE330 => 0xE471,
+ 0xFE331 => "[Bug #7466]",
+ }
+ k = h.keys
+ assert_equal([129, 0xFE331], [k.size, k.last], bug7466)
+ end
+
def test_range
assert_instance_of Range, (1..2)
assert_equal(1..2, 1..2)
diff --git a/test/ruby/test_m17n.rb b/test/ruby/test_m17n.rb
index 699c8151dd..c65d763988 100644
--- a/test/ruby/test_m17n.rb
+++ b/test/ruby/test_m17n.rb
@@ -1,5 +1,6 @@
+# coding: US-ASCII
require 'test/unit'
-require 'stringio'
+require_relative 'envutil'
class TestM17N < Test::Unit::TestCase
def assert_encoding(encname, actual, message=nil)
@@ -23,17 +24,6 @@ class TestM17N < Test::Unit::TestCase
assert_equal(a(bytes), a(actual), message)
end
- def assert_warning(pat, mesg=nil)
- begin
- org_stderr = $stderr
- $stderr = StringIO.new(warn = '')
- yield
- ensure
- $stderr = org_stderr
- end
- assert_match(pat, warn, mesg)
- end
-
def assert_regexp_generic_encoding(r)
assert(!r.fixed_encoding?)
%w[ASCII-8BIT EUC-JP Windows-31J UTF-8].each {|ename|
@@ -205,31 +195,35 @@ class TestM17N < Test::Unit::TestCase
end
def test_string_inspect_encoding
- orig_int = Encoding.default_internal
- orig_ext = Encoding.default_external
- Encoding.default_internal = nil
- [Encoding::UTF_8, Encoding::EUC_JP, Encoding::Windows_31J, Encoding::GB18030].
- each do |e|
- Encoding.default_external = e
- str = "\x81\x30\x81\x30".force_encoding('GB18030')
- assert_equal(Encoding::GB18030 == e ? %{"#{str}"} : '"\x{81308130}"', str.inspect)
- str = e("\xa1\x8f\xa1\xa1")
- expected = "\"\\xA1\x8F\xA1\xA1\"".force_encoding("EUC-JP")
- assert_equal(Encoding::EUC_JP == e ? expected : "\"\\xA1\\x{8FA1A1}\"", str.inspect)
- str = s("\x81@")
- assert_equal(Encoding::Windows_31J == e ? %{"#{str}"} : '"\x{8140}"', str.inspect)
- str = "\u3042\u{10FFFD}"
- assert_equal(Encoding::UTF_8 == e ? %{"#{str}"} : '"\u3042\u{10FFFD}"', str.inspect)
- end
- Encoding.default_external = Encoding::UTF_8
- [Encoding::UTF_16BE, Encoding::UTF_16LE, Encoding::UTF_32BE, Encoding::UTF_32LE,
- Encoding::UTF8_SOFTBANK].each do |e|
- str = "abc".encode(e)
- assert_equal('"abc"', str.inspect)
+ EnvUtil.suppress_warning do
+ begin
+ orig_int = Encoding.default_internal
+ orig_ext = Encoding.default_external
+ Encoding.default_internal = nil
+ [Encoding::UTF_8, Encoding::EUC_JP, Encoding::Windows_31J, Encoding::GB18030].
+ each do |e|
+ Encoding.default_external = e
+ str = "\x81\x30\x81\x30".force_encoding('GB18030')
+ assert_equal(Encoding::GB18030 == e ? %{"#{str}"} : '"\x{81308130}"', str.inspect)
+ str = e("\xa1\x8f\xa1\xa1")
+ expected = "\"\\xA1\x8F\xA1\xA1\"".force_encoding("EUC-JP")
+ assert_equal(Encoding::EUC_JP == e ? expected : "\"\\xA1\\x{8FA1A1}\"", str.inspect)
+ str = s("\x81@")
+ assert_equal(Encoding::Windows_31J == e ? %{"#{str}"} : '"\x{8140}"', str.inspect)
+ str = "\u3042\u{10FFFD}"
+ assert_equal(Encoding::UTF_8 == e ? %{"#{str}"} : '"\u3042\u{10FFFD}"', str.inspect)
+ end
+ Encoding.default_external = Encoding::UTF_8
+ [Encoding::UTF_16BE, Encoding::UTF_16LE, Encoding::UTF_32BE, Encoding::UTF_32LE,
+ Encoding::UTF8_SOFTBANK].each do |e|
+ str = "abc".encode(e)
+ assert_equal('"abc"', str.inspect)
+ end
+ ensure
+ Encoding.default_internal = orig_int
+ Encoding.default_external = orig_ext
+ end
end
- ensure
- Encoding.default_internal = orig_int
- Encoding.default_external = orig_ext
end
def test_utf_16_32_inspect
@@ -256,6 +250,53 @@ class TestM17N < Test::Unit::TestCase
end
end
+ def test_object_utf16_32_inspect
+ EnvUtil.suppress_warning do
+ begin
+ orig_int = Encoding.default_internal
+ orig_ext = Encoding.default_external
+ Encoding.default_internal = nil
+ Encoding.default_external = Encoding::UTF_8
+ o = Object.new
+ [Encoding::UTF_16BE, Encoding::UTF_16LE, Encoding::UTF_32BE, Encoding::UTF_32LE].each do |e|
+ o.instance_eval "undef inspect;def inspect;'abc'.encode('#{e}');end"
+ assert_raise(Encoding::CompatibilityError) { [o].inspect }
+ end
+ ensure
+ Encoding.default_internal = orig_int
+ Encoding.default_external = orig_ext
+ end
+ end
+ end
+
+ def test_object_inspect_external
+ orig_v, $VERBOSE = $VERBOSE, false
+ orig_int, Encoding.default_internal = Encoding.default_internal, nil
+ orig_ext = Encoding.default_external
+ o = Object.new
+
+ Encoding.default_external = Encoding::UTF_16BE
+ def o.inspect
+ "abc"
+ end
+ assert_nothing_raised(Encoding::CompatibilityError) { [o].inspect }
+
+ def o.inspect
+ "abc".encode(Encoding.default_external)
+ end
+ assert_raise(Encoding::CompatibilityError) { [o].inspect }
+
+ Encoding.default_external = Encoding::US_ASCII
+ def o.inspect
+ "\u3042"
+ end
+ assert_raise(Encoding::CompatibilityError) { [o].inspect }
+ ensure
+ Encoding.default_internal = orig_int
+ Encoding.default_external = orig_ext
+ $VERBOSE = orig_v
+ end
+
def test_str_dump
[
e("\xfe"),
@@ -930,6 +971,15 @@ class TestM17N < Test::Unit::TestCase
assert_equal("\u{439}", "a\u{439}bcdefghijklmnop"[1, 1][0, 1], bug2379)
end
+ def test_str_aref_force_encoding
+ bug5836 = '[ruby-core:41896]'
+ Encoding.list.each do |enc|
+ next unless enc.ascii_compatible?
+ s = "abc".force_encoding(enc)
+ assert_equal("", s[3, 1], bug5836)
+ end
+ end
+
def test_aset
s = e("\xa3\xb0\xa3\xb1\xa3\xb2\xa3\xb3\xa3\xb4")
assert_raise(Encoding::CompatibilityError){s["\xb0\xa3"] = "foo"}
@@ -1180,7 +1230,7 @@ class TestM17N < Test::Unit::TestCase
def test_symbol_op
ops = %w"
- .. ... + - +(binary) -(binary) * / % ** +@ -@ | ^ & ! <=> > >= < <= ==
+ .. ... + - * / % ** +@ -@ | ^ & ! <=> > >= < <= ==
=== != =~ !~ ~ ! [] []= << >> :: `
"
ops.each do |op|
@@ -1216,8 +1266,8 @@ class TestM17N < Test::Unit::TestCase
def test_env
locale_encoding = Encoding.find("locale")
ENV.each {|k, v|
- assert_equal(locale_encoding, k.encoding)
- assert_equal(locale_encoding, v.encoding)
+ assert_equal(locale_encoding, k.encoding, k)
+ assert_equal(locale_encoding, v.encoding, v)
}
end
@@ -1415,10 +1465,13 @@ class TestM17N < Test::Unit::TestCase
assert_equal(1, a.force_encoding("utf-8").size, '[ruby-core:22437]')
b = "".force_encoding("ascii-8bit") << 0xC3.chr << 0xB6.chr
assert_equal(1, b.force_encoding("utf-8").size, '[ruby-core:22437]')
+
+ assert_raise(TypeError){ ''.force_encoding(nil) }
end
def test_combchar_codepoint
assert_equal([0x30BB, 0x309A], "\u30BB\u309A".codepoints.to_a)
+ assert_equal([0x30BB, 0x309A], "\u30BB\u309A".codepoints.to_a)
end
def each_encoding(*strings)
@@ -1428,4 +1481,76 @@ class TestM17N < Test::Unit::TestCase
yield(*strs)
end
end
+
+ def test_str_b
+ s = "\u3042"
+ assert_equal(a("\xE3\x81\x82"), s.b)
+ assert_equal(Encoding::ASCII_8BIT, s.b.encoding)
+ s.taint
+ assert_equal(true, s.b.tainted?)
+ s = "abc".b
+ assert_equal(true, s.b.ascii_only?)
+ end
+
+ def test_scrub
+ str = "\u3042\u3044"
+ assert_not_same(str, str.scrub)
+ str.force_encoding(Encoding::ISO_2022_JP) # dummy encoding
+ assert_not_same(str, str.scrub)
+ assert_nothing_raised(ArgumentError) {str.scrub(nil)}
+
+ assert_equal("\uFFFD\uFFFD\uFFFD", u("\x80\x80\x80").scrub)
+ assert_equal("\uFFFDA", u("\xF4\x80\x80A").scrub)
+
+ # exapmles in Unicode 6.1.0 D93b
+ assert_equal("\x41\uFFFD\uFFFD\x41\uFFFD\x41",
+ u("\x41\xC0\xAF\x41\xF4\x80\x80\x41").scrub)
+ assert_equal("\x41\uFFFD\uFFFD\uFFFD\x41",
+ u("\x41\xE0\x9F\x80\x41").scrub)
+ assert_equal("\u0061\uFFFD\uFFFD\uFFFD\u0062\uFFFD\u0063\uFFFD\uFFFD\u0064",
+ u("\x61\xF1\x80\x80\xE1\x80\xC2\x62\x80\x63\x80\xBF\x64").scrub)
+ assert_equal("abcdefghijklmnopqrstuvwxyz\u0061\uFFFD\uFFFD\uFFFD\u0062\uFFFD\u0063\uFFFD\uFFFD\u0064",
+ u("abcdefghijklmnopqrstuvwxyz\x61\xF1\x80\x80\xE1\x80\xC2\x62\x80\x63\x80\xBF\x64").scrub)
+
+ assert_equal("\u3042\u3013", u("\xE3\x81\x82\xE3\x81").scrub("\u3013"))
+ assert_raise(Encoding::CompatibilityError){ u("\xE3\x81\x82\xE3\x81").scrub(e("\xA4\xA2")) }
+ assert_raise(TypeError){ u("\xE3\x81\x82\xE3\x81").scrub(1) }
+ assert_raise(ArgumentError){ u("\xE3\x81\x82\xE3\x81\x82\xE3\x81").scrub(u("\x81")) }
+ assert_equal(e("\xA4\xA2\xA2\xAE"), e("\xA4\xA2\xA4").scrub(e("\xA2\xAE")))
+
+ assert_equal("\u3042<e381>", u("\xE3\x81\x82\xE3\x81").scrub{|x|'<'+x.unpack('H*')[0]+'>'})
+ assert_raise(Encoding::CompatibilityError){ u("\xE3\x81\x82\xE3\x81").scrub{e("\xA4\xA2")} }
+ assert_raise(TypeError){ u("\xE3\x81\x82\xE3\x81").scrub{1} }
+ assert_raise(ArgumentError){ u("\xE3\x81\x82\xE3\x81\x82\xE3\x81").scrub{u("\x81")} }
+ assert_equal(e("\xA4\xA2\xA2\xAE"), e("\xA4\xA2\xA4").scrub{e("\xA2\xAE")})
+
+ assert_equal(u("\x81"), u("a\x81").scrub {|c| break c})
+ assert_raise(ArgumentError) {u("a\x81").scrub {|c| c}}
+
+ assert_equal("\uFFFD\u3042".encode("UTF-16BE"),
+ "\xD8\x00\x30\x42".force_encoding(Encoding::UTF_16BE).
+ scrub)
+ assert_equal("\uFFFD\u3042".encode("UTF-16LE"),
+ "\x00\xD8\x42\x30".force_encoding(Encoding::UTF_16LE).
+ scrub)
+ assert_equal("\uFFFD".encode("UTF-32BE"),
+ "\xff".force_encoding(Encoding::UTF_32BE).
+ scrub)
+ assert_equal("\uFFFD".encode("UTF-32LE"),
+ "\xff".force_encoding(Encoding::UTF_32LE).
+ scrub)
+ end
+
+ def test_scrub_bang
+ str = "\u3042\u3044"
+ assert_same(str, str.scrub!)
+ str.force_encoding(Encoding::ISO_2022_JP) # dummy encoding
+ assert_same(str, str.scrub!)
+ assert_nothing_raised(ArgumentError) {str.scrub!(nil)}
+
+ str = u("\x80\x80\x80")
+ str.scrub!
+ assert_same(str, str.scrub!)
+ assert_equal("\uFFFD\uFFFD\uFFFD", str)
+ end
end
diff --git a/test/ruby/test_m17n_comb.rb b/test/ruby/test_m17n_comb.rb
index 6eec6a6bea..fd715240e8 100644
--- a/test/ruby/test_m17n_comb.rb
+++ b/test/ruby/test_m17n_comb.rb
@@ -1,5 +1,4 @@
require 'test/unit'
-require 'stringio'
require_relative 'allpairs'
class TestM17NComb < Test::Unit::TestCase
@@ -8,10 +7,11 @@ class TestM17NComb < Test::Unit::TestCase
end
module AESU
- def a(str) str.dup.force_encoding("ASCII-8BIT") end
- def e(str) str.dup.force_encoding("EUC-JP") end
- def s(str) str.dup.force_encoding("Shift_JIS") end
- def u(str) str.dup.force_encoding("UTF-8") end
+ def a(str) str.dup.force_encoding(Encoding::US_ASCII) end
+ def b(str) str.b end
+ def e(str) str.dup.force_encoding(Encoding::EUC_JP) end
+ def s(str) str.dup.force_encoding(Encoding::SJIS) end
+ def u(str) str.dup.force_encoding(Encoding::UTF_8) end
end
include AESU
extend AESU
@@ -20,72 +20,16 @@ class TestM17NComb < Test::Unit::TestCase
assert_instance_of(String, actual, message)
enc = Encoding.find(enc) if String === enc
assert_equal(enc, actual.encoding, message)
- assert_equal(a(bytes), a(actual), message)
- end
-
- def assert_warning(pat, mesg=nil)
- begin
- org_stderr = $stderr
- $stderr = StringIO.new(warn = '')
- yield
- ensure
- $stderr = org_stderr
- end
- assert_match(pat, warn, mesg)
- end
-
- def assert_regexp_generic_encoding(r)
- assert(!r.fixed_encoding?)
- %w[ASCII-8BIT EUC-JP Shift_JIS UTF-8].each {|ename|
- # "\xc2\xa1" is a valid sequence for ASCII-8BIT, EUC-JP, Shift_JIS and UTF-8.
- assert_nothing_raised { r =~ "\xc2\xa1".force_encoding(ename) }
- }
- end
-
- def assert_regexp_fixed_encoding(r)
- assert(r.fixed_encoding?)
- %w[ASCII-8BIT EUC-JP Shift_JIS UTF-8].each {|ename|
- enc = Encoding.find(ename)
- if enc == r.encoding
- assert_nothing_raised { r =~ "\xc2\xa1".force_encoding(enc) }
- else
- assert_raise(ArgumentError) { r =~ "\xc2\xa1".force_encoding(enc) }
- end
- }
- end
-
- def assert_regexp_generic_ascii(r)
- assert_encoding("ASCII-8BIT", r.encoding)
- assert_regexp_generic_encoding(r)
- end
-
- def assert_regexp_fixed_ascii8bit(r)
- assert_encoding("ASCII-8BIT", r.encoding)
- assert_regexp_fixed_encoding(r)
- end
-
- def assert_regexp_fixed_eucjp(r)
- assert_encoding("EUC-JP", r.encoding)
- assert_regexp_fixed_encoding(r)
- end
-
- def assert_regexp_fixed_sjis(r)
- assert_encoding("Shift_JIS", r.encoding)
- assert_regexp_fixed_encoding(r)
- end
-
- def assert_regexp_fixed_utf8(r)
- assert_encoding("UTF-8", r.encoding)
- assert_regexp_fixed_encoding(r)
+ assert_equal(b(bytes), b(actual), message)
end
STRINGS = [
- a(""), e(""), s(""), u(""),
- a("a"), e("a"), s("a"), u("a"),
- a("."), e("."), s("."), u("."),
+ b(""), e(""), s(""), u(""),
+ b("a"), e("a"), s("a"), u("a"),
+ b("."), e("."), s("."), u("."),
# single character
- a("\x80"), a("\xff"),
+ b("\x80"), b("\xff"),
e("\xa1\xa1"), e("\xfe\xfe"),
e("\x8e\xa1"), e("\x8e\xfe"),
e("\x8f\xa1\xa1"), e("\x8f\xfe\xfe"),
@@ -94,7 +38,7 @@ class TestM17NComb < Test::Unit::TestCase
u("\xc2\x80"), u("\xf4\x8f\xbf\xbf"),
# same byte sequence
- a("\xc2\xa1"), e("\xc2\xa1"), s("\xc2\xa1"), u("\xc2\xa1"),
+ b("\xc2\xa1"), e("\xc2\xa1"), s("\xc2\xa1"), u("\xc2\xa1"),
s("\x81A"), # mutibyte character which contains "A"
s("\x81a"), # mutibyte character which contains "a"
@@ -106,11 +50,13 @@ class TestM17NComb < Test::Unit::TestCase
# for transitivity test
u("\xe0\xa0\xa1"), e("\xe0\xa0\xa1"), s("\xe0\xa0\xa1"), # [ruby-dev:32693]
- e("\xa1\xa1"), a("\xa1\xa1"), s("\xa1\xa1"), # [ruby-dev:36484]
+ e("\xa1\xa1"), b("\xa1\xa1"), s("\xa1\xa1"), # [ruby-dev:36484]
+ ]
- #"aa".force_encoding("utf-16be"),
- #"aaaa".force_encoding("utf-32be"),
- #"aaa".force_encoding("utf-32be"),
+ WSTRINGS = [
+ "aa".force_encoding("utf-16be"),
+ "aaaa".force_encoding("utf-32be"),
+ "aaa".force_encoding("utf-32be"),
]
def combination(*args, &b)
@@ -141,7 +87,7 @@ class TestM17NComb < Test::Unit::TestCase
r
end
- def enccall(recv, meth, *args, &block)
+ def assert_enccall(recv, meth, *args, &block)
desc = ''
if String === recv
desc << encdump(recv)
@@ -170,6 +116,7 @@ class TestM17NComb < Test::Unit::TestCase
}
result
end
+ alias enccall assert_enccall
def assert_str_enc_propagation(t, s1, s2)
if !s1.ascii_only?
@@ -254,7 +201,7 @@ class TestM17NComb < Test::Unit::TestCase
def test_str_new
STRINGS.each {|s|
t = String.new(s)
- assert_strenc(a(s), s.encoding, t)
+ assert_strenc(b(s), s.encoding, t)
}
end
@@ -265,7 +212,7 @@ class TestM17NComb < Test::Unit::TestCase
else
t = enccall(s1, :+, s2)
assert(t.valid_encoding?) if s1.valid_encoding? && s2.valid_encoding?
- assert_equal(a(s1) + a(s2), a(t))
+ assert_equal(b(s1) + b(s2), b(t))
assert_str_enc_propagation(t, s1, s2)
end
}
@@ -276,17 +223,17 @@ class TestM17NComb < Test::Unit::TestCase
[0,1,2].each {|n|
t = s * n
assert(t.valid_encoding?) if s.valid_encoding?
- assert_strenc(a(s) * n, s.encoding, t)
+ assert_strenc(b(s) * n, s.encoding, t)
}
}
end
def test_sprintf_s
STRINGS.each {|s|
- assert_strenc(a(s), s.encoding, "%s".force_encoding(s.encoding) % s)
+ assert_strenc(b(s), s.encoding, "%s".force_encoding(s.encoding) % s)
if !s.empty? # xxx
- t = enccall(a("%s"), :%, s)
- assert_strenc(a(s), (a('')+s).encoding, t)
+ t = enccall(b("%s"), :%, s)
+ assert_strenc(b(s), (b('')+s).encoding, t)
end
}
end
@@ -318,7 +265,7 @@ class TestM17NComb < Test::Unit::TestCase
def test_str_eq
combination(STRINGS, STRINGS) {|s1, s2|
desc_eq = "#{encdump s1} == #{encdump s2}"
- if a(s1) == a(s2) and
+ if b(s1) == b(s2) and
(s1.ascii_only? && s2.ascii_only? or
s1.encoding == s2.encoding) then
assert(s1 == s2, desc_eq)
@@ -340,7 +287,7 @@ class TestM17NComb < Test::Unit::TestCase
if s1.ascii_only? || s2.ascii_only? || s1.encoding == s2.encoding
s << s2
assert(s.valid_encoding?) if s1.valid_encoding? && s2.valid_encoding?
- assert_equal(a(s), a(s1) + a(s2))
+ assert_equal(b(s), b(s1) + b(s2))
assert_str_enc_propagation(s, s1, s2)
else
assert_raise(Encoding::CompatibilityError) { s << s2 }
@@ -389,7 +336,7 @@ class TestM17NComb < Test::Unit::TestCase
if t != nil
assert(t.valid_encoding?) if s1.valid_encoding? && s2.valid_encoding?
assert_equal(s2, t)
- assert_match(/#{Regexp.escape(a(s2))}/, a(s1))
+ assert_match(/#{Regexp.escape(b(s2))}/, b(s1))
if s1.valid_encoding?
assert_match(/#{Regexp.escape(s2)}/, s1)
end
@@ -466,7 +413,7 @@ class TestM17NComb < Test::Unit::TestCase
else
t[i] = s2
assert(t.valid_encoding?) if s1.valid_encoding? && s2.valid_encoding?
- assert(a(t).index(a(s2)))
+ assert(b(t).index(b(s2)))
if s1.valid_encoding? && s2.valid_encoding?
if i == s1.length && s2.empty?
assert_nil(t[i])
@@ -495,7 +442,7 @@ class TestM17NComb < Test::Unit::TestCase
else
assert(t.valid_encoding?) if s1.valid_encoding? && s2.valid_encoding?
t[i,len] = s2
- assert(a(t).index(a(s2)))
+ assert(b(t).index(b(s2)))
if s1.valid_encoding? && s2.valid_encoding?
if i == s1.length && s2.empty?
assert_nil(t[i])
@@ -554,7 +501,7 @@ class TestM17NComb < Test::Unit::TestCase
else
enccall(t, :[]=, first..last, s2)
assert(t.valid_encoding?) if s1.valid_encoding? && s2.valid_encoding?
- assert(a(t).index(a(s2)))
+ assert(b(t).index(b(s2)))
if s1.valid_encoding? && s2.valid_encoding?
if first < 0
assert_equal(s2, t[s1.length+first, s2.length])
@@ -581,7 +528,7 @@ class TestM17NComb < Test::Unit::TestCase
else
enccall(t, :[]=, first...last, s2)
assert(t.valid_encoding?) if s1.valid_encoding? && s2.valid_encoding?
- assert(a(t).index(a(s2)))
+ assert(b(t).index(b(s2)))
if s1.valid_encoding? && s2.valid_encoding?
if first < 0
assert_equal(s2, t[s1.length+first, s2.length])
@@ -625,7 +572,7 @@ class TestM17NComb < Test::Unit::TestCase
t2.capitalize!
assert_equal(t1, t2)
r = s.downcase
- r = enccall(r, :sub, /\A[a-z]/) {|ch| a(ch).upcase }
+ r = enccall(r, :sub, /\A[a-z]/) {|ch| b(ch).upcase }
assert_equal(r, t1)
}
end
@@ -642,7 +589,7 @@ class TestM17NComb < Test::Unit::TestCase
def test_str_center
combination(STRINGS, [0,1,2,3,10]) {|s1, width|
t = s1.center(width)
- assert(a(t).index(a(s1)))
+ assert(b(t).index(b(s1)))
}
combination(STRINGS, [0,1,2,3,10], STRINGS) {|s1, width, s2|
if s2.empty?
@@ -655,7 +602,7 @@ class TestM17NComb < Test::Unit::TestCase
end
t = enccall(s1, :center, width, s2)
assert(t.valid_encoding?) if s1.valid_encoding? && s2.valid_encoding?
- assert(a(t).index(a(s1)))
+ assert(b(t).index(b(s1)))
assert_str_enc_propagation(t, s1, s2) if (t != s1)
}
end
@@ -663,7 +610,7 @@ class TestM17NComb < Test::Unit::TestCase
def test_str_ljust
combination(STRINGS, [0,1,2,3,10]) {|s1, width|
t = s1.ljust(width)
- assert(a(t).index(a(s1)))
+ assert(b(t).index(b(s1)))
}
combination(STRINGS, [0,1,2,3,10], STRINGS) {|s1, width, s2|
if s2.empty?
@@ -676,7 +623,7 @@ class TestM17NComb < Test::Unit::TestCase
end
t = enccall(s1, :ljust, width, s2)
assert(t.valid_encoding?) if s1.valid_encoding? && s2.valid_encoding?
- assert(a(t).index(a(s1)))
+ assert(b(t).index(b(s1)))
assert_str_enc_propagation(t, s1, s2) if (t != s1)
}
end
@@ -684,7 +631,7 @@ class TestM17NComb < Test::Unit::TestCase
def test_str_rjust
combination(STRINGS, [0,1,2,3,10]) {|s1, width|
t = s1.rjust(width)
- assert(a(t).index(a(s1)))
+ assert(b(t).index(b(s1)))
}
combination(STRINGS, [0,1,2,3,10], STRINGS) {|s1, width, s2|
if s2.empty?
@@ -697,7 +644,7 @@ class TestM17NComb < Test::Unit::TestCase
end
t = enccall(s1, :rjust, width, s2)
assert(t.valid_encoding?) if s1.valid_encoding? && s2.valid_encoding?
- assert(a(t).index(a(s1)))
+ assert(b(t).index(b(s1)))
assert_str_enc_propagation(t, s1, s2) if (t != s1)
}
end
@@ -726,7 +673,7 @@ class TestM17NComb < Test::Unit::TestCase
t = nil
assert_nothing_raised(desc) { t = s.chop }
assert(t.valid_encoding?) if s.valid_encoding?
- assert(a(s).index(a(t)))
+ assert(b(s).index(b(t)))
t2 = s.dup
t2.chop!
assert_equal(t, t2)
@@ -747,7 +694,7 @@ class TestM17NComb < Test::Unit::TestCase
t = s.clone
assert_equal(s, t)
assert_equal(s.encoding, t.encoding)
- assert_equal(a(s), a(t))
+ assert_equal(b(s), b(t))
}
end
@@ -756,7 +703,7 @@ class TestM17NComb < Test::Unit::TestCase
t = s.dup
assert_equal(s, t)
assert_equal(s.encoding, t.encoding)
- assert_equal(a(s), a(t))
+ assert_equal(b(s), b(t))
}
end
@@ -771,7 +718,7 @@ class TestM17NComb < Test::Unit::TestCase
next
end
n = enccall(s1, :count, s2)
- n0 = a(s1).count(a(s2))
+ n0 = b(s1).count(b(s2))
assert_operator(n, :<=, n0)
}
end
@@ -779,7 +726,8 @@ class TestM17NComb < Test::Unit::TestCase
def test_str_crypt
begin
# glibc 2.16 or later denies salt contained other than [0-9A-Za-z./] #7312
- glibcver = `#{RbConfig::CONFIG["libdir"]}/libc.so.6`[/\AGNU C Library.*version ([0-9.]+)/, 1].split('.').map(&:to_i)
+ glibcpath = `ldd #{RbConfig.ruby}`[/\S+\/libc.so\S+/]
+ glibcver = `#{glibcpath}`[/\AGNU C Library.*version ([0-9.]+)/, 1].split('.').map(&:to_i)
strict_crypt = (glibcver <=> [2, 16]) > -1
rescue
end
@@ -788,12 +736,12 @@ class TestM17NComb < Test::Unit::TestCase
if strict_crypt
next unless salt.ascii_only? && /\A[0-9a-zA-Z.\/]+\z/ =~ salt
end
- if a(salt).length < 2
+ if b(salt).length < 2
assert_raise(ArgumentError) { str.crypt(salt) }
next
end
t = str.crypt(salt)
- assert_equal(a(str).crypt(a(salt)), t, "#{encdump(str)}.crypt(#{encdump(salt)})")
+ assert_equal(b(str).crypt(b(salt)), t, "#{encdump(str)}.crypt(#{encdump(salt)})")
assert_encoding('ASCII-8BIT', t.encoding)
}
end
@@ -844,23 +792,18 @@ class TestM17NComb < Test::Unit::TestCase
assert(t.valid_encoding?)
assert(t.ascii_only?)
u = eval(t)
- assert_equal(a(s), a(u))
+ assert_equal(b(s), b(u))
}
end
def test_str_each_line
combination(STRINGS, STRINGS) {|s1, s2|
- if !s1.valid_encoding? || !s2.valid_encoding?
- assert_raise(ArgumentError, Encoding::CompatibilityError) { s1.each_line(s2) {} }
- next
- end
if !s1.ascii_only? && !s2.ascii_only? && s1.encoding != s2.encoding
assert_raise(Encoding::CompatibilityError) { s1.each_line(s2) {} }
next
end
lines = []
enccall(s1, :each_line, s2) {|line|
- assert(line.valid_encoding?)
assert_equal(s1.encoding, line.encoding)
lines << line
}
@@ -877,7 +820,7 @@ class TestM17NComb < Test::Unit::TestCase
s.each_byte {|b|
bytes << b
}
- a(s).split(//).each_with_index {|ch, i|
+ b(s).split(//).each_with_index {|ch, i|
assert_equal(ch.ord, bytes[i])
}
}
@@ -896,7 +839,7 @@ class TestM17NComb < Test::Unit::TestCase
def test_str_hex
STRINGS.each {|s|
t = s.hex
- t2 = a(s)[/\A[0-9a-fA-Fx]*/].hex
+ t2 = b(s)[/\A[0-9a-fA-Fx]*/].hex
assert_equal(t2, t)
}
end
@@ -911,7 +854,7 @@ class TestM17NComb < Test::Unit::TestCase
end
t = enccall(s1, :include?, s2)
if t
- assert(a(s1).include?(a(s2)))
+ assert(b(s1).include?(b(s2)))
assert(s1.index(s2))
assert(s1.rindex(s2))
else
@@ -992,7 +935,7 @@ class TestM17NComb < Test::Unit::TestCase
end
if t
#puts "#{encdump s1}.rindex(#{encdump s2}, #{pos}) => #{t}"
- assert(a(s1).index(a(s2)))
+ assert(b(s1).index(b(s2)))
pos2 = pos
pos2 += s1.length if pos < 0
re = /\A(.{0,#{pos2}})#{Regexp.escape(s2)}/m
@@ -1044,7 +987,7 @@ class TestM17NComb < Test::Unit::TestCase
def test_str_intern
STRINGS.each {|s|
- if /\0/ =~ a(s)
+ if /\0/ =~ b(s)
assert_raise(ArgumentError) { s.intern }
elsif s.valid_encoding?
sym = s.intern
@@ -1065,7 +1008,7 @@ class TestM17NComb < Test::Unit::TestCase
def test_str_oct
STRINGS.each {|s|
t = s.oct
- t2 = a(s)[/\A[0-9a-fA-FxX]*/].oct
+ t2 = b(s)[/\A[0-9a-fA-FxX]*/].oct
assert_equal(t2, t)
}
end
@@ -1173,10 +1116,10 @@ class TestM17NComb < Test::Unit::TestCase
end
t = enccall(s1, :split, s2)
t.each {|r|
- assert(a(s1).include?(a(r)))
+ assert(b(s1).include?(b(r)))
assert_equal(s1.encoding, r.encoding)
}
- assert(a(s1).include?(t.map {|u| a(u) }.join(a(s2))))
+ assert(b(s1).include?(t.map {|u| b(u) }.join(b(s2))))
if s1.valid_encoding? && s2.valid_encoding?
t.each {|r|
assert(r.valid_encoding?)
@@ -1230,7 +1173,7 @@ class TestM17NComb < Test::Unit::TestCase
def test_str_sum
STRINGS.each {|s|
- assert_equal(a(s).sum, s.sum)
+ assert_equal(b(s).sum, s.sum)
}
end
@@ -1303,6 +1246,20 @@ class TestM17NComb < Test::Unit::TestCase
}
end
+ def test_tr_sjis
+ expected = "\x83}\x83~\x83\x80\x83\x81\x83\x82".force_encoding(Encoding::SJIS)
+ source = "\xCF\xD0\xD1\xD2\xD3".force_encoding(Encoding::SJIS)
+ from = "\xCF-\xD3".force_encoding(Encoding::SJIS)
+ to = "\x83}-\x83\x82".force_encoding(Encoding::SJIS)
+ assert_equal(expected, source.tr(from, to))
+
+ expected = "\x84}\x84~\x84\x80\x84\x81\x84\x82".force_encoding(Encoding::SJIS)
+ source = "\x84M\x84N\x84O\x84P\x84Q".force_encoding(Encoding::SJIS)
+ from = "\x84@-\x84`".force_encoding(Encoding::SJIS)
+ to = "\x84p-\x84\x91".force_encoding(Encoding::SJIS)
+ assert_equal(expected, source.tr(from, to))
+ end
+
def test_tr_s
combination(STRINGS, STRINGS, STRINGS) {|s1, s2, s3|
desc = "#{encdump s1}.tr_s(#{encdump s2}, #{encdump s3})"
@@ -1369,6 +1326,19 @@ class TestM17NComb < Test::Unit::TestCase
s = t
}
}
+
+ Encoding.list.each do |enc|
+ next if enc.dummy?
+ {"A"=>"B", "A1"=>"A2", "A9"=>"B0", "9"=>"10", "Z"=>"AA"}.each do |orig, expected|
+ s = orig.encode(enc)
+ assert_strenc(expected.encode(enc), enc, s.succ, proc {"#{orig.dump}.encode(#{enc}).succ"})
+ end
+ end
+ end
+
+ def test_str_succ2
+ assert_equal(a("\x01\x00"), a("\x7f").succ)
+ assert_equal(b("\x01\x00"), b("\xff").succ)
end
def test_str_hash
diff --git a/test/ruby/test_marshal.rb b/test/ruby/test_marshal.rb
index 0f3f794572..7bd259329d 100644
--- a/test/ruby/test_marshal.rb
+++ b/test/ruby/test_marshal.rb
@@ -62,8 +62,8 @@ class TestMarshal < Test::Unit::TestCase
def test_struct_invalid_members
TestMarshal.const_set :StructInvalidMembers, Struct.new(:a)
- Marshal.load("\004\bIc&TestMarshal::StructInvalidMembers\006:\020__members__\"\bfoo")
assert_raise(TypeError, "[ruby-dev:31759]") {
+ Marshal.load("\004\bIc&TestMarshal::StructInvalidMembers\006:\020__members__\"\bfoo")
TestMarshal::StructInvalidMembers.members
}
end
@@ -84,10 +84,9 @@ class TestMarshal < Test::Unit::TestCase
def test_too_long_string
data = Marshal.dump(C.new("a".force_encoding("ascii-8bit")))
data[-2, 1] = "\003\377\377\377"
- e = assert_raise(ArgumentError, "[ruby-dev:32054]") {
+ assert_raise_with_message(ArgumentError, "marshal data too short", "[ruby-dev:32054]") {
Marshal.load(data)
}
- assert_equal("marshal data too short", e.message)
end
@@ -103,16 +102,16 @@ class TestMarshal < Test::Unit::TestCase
def test_pipe
o1 = C.new("a" * 10000)
- r, w = IO.pipe
- t = Thread.new { Marshal.load(r) }
- Marshal.dump(o1, w)
- o2 = t.value
+ o2 = IO.pipe do |r, w|
+ Thread.new {Marshal.dump(o1, w)}
+ Marshal.load(r)
+ end
assert_equal(o1.str, o2.str)
- r, w = IO.pipe
- t = Thread.new { Marshal.load(r) }
- Marshal.dump(o1, w, 2)
- o2 = t.value
+ o2 = IO.pipe do |r, w|
+ Thread.new {Marshal.dump(o1, w, 2)}
+ Marshal.load(r)
+ end
assert_equal(o1.str, o2.str)
assert_raise(TypeError) { Marshal.dump("foo", Object.new) }
@@ -187,83 +186,58 @@ class TestMarshal < Test::Unit::TestCase
end
end
- def test_taint_and_untrust
+ def test_taint
x = Object.new
x.taint
- x.untrust
s = Marshal.dump(x)
assert_equal(true, s.tainted?)
- assert_equal(true, s.untrusted?)
y = Marshal.load(s)
assert_equal(true, y.tainted?)
- assert_equal(true, y.untrusted?)
end
- def test_taint_and_untrust_each_object
+ def test_taint_each_object
x = Object.new
obj = [[x]]
# clean object causes crean stream
assert_equal(false, obj.tainted?)
- assert_equal(false, obj.untrusted?)
assert_equal(false, obj.first.tainted?)
- assert_equal(false, obj.first.untrusted?)
assert_equal(false, obj.first.first.tainted?)
- assert_equal(false, obj.first.first.untrusted?)
s = Marshal.dump(obj)
assert_equal(false, s.tainted?)
- assert_equal(false, s.untrusted?)
- # tainted/untrusted object causes tainted/untrusted stream
+ # tainted object causes tainted stream
x.taint
- x.untrust
assert_equal(false, obj.tainted?)
- assert_equal(false, obj.untrusted?)
assert_equal(false, obj.first.tainted?)
- assert_equal(false, obj.first.untrusted?)
assert_equal(true, obj.first.first.tainted?)
- assert_equal(true, obj.first.first.untrusted?)
t = Marshal.dump(obj)
assert_equal(true, t.tainted?)
- assert_equal(true, t.untrusted?)
# clean stream causes clean objects
assert_equal(false, s.tainted?)
- assert_equal(false, s.untrusted?)
y = Marshal.load(s)
assert_equal(false, y.tainted?)
- assert_equal(false, y.untrusted?)
assert_equal(false, y.first.tainted?)
- assert_equal(false, y.first.untrusted?)
assert_equal(false, y.first.first.tainted?)
- assert_equal(false, y.first.first.untrusted?)
- # tainted/untrusted stream causes tainted/untrusted objects
+ # tainted stream causes tainted objects
assert_equal(true, t.tainted?)
- assert_equal(true, t.untrusted?)
y = Marshal.load(t)
assert_equal(true, y.tainted?)
- assert_equal(true, y.untrusted?)
assert_equal(true, y.first.tainted?)
- assert_equal(true, y.first.untrusted?)
assert_equal(true, y.first.first.tainted?)
- assert_equal(true, y.first.first.untrusted?)
# same tests by different senario
s.taint
- s.untrust
assert_equal(true, s.tainted?)
- assert_equal(true, s.untrusted?)
y = Marshal.load(s)
assert_equal(true, y.tainted?)
- assert_equal(true, y.untrusted?)
assert_equal(true, y.first.tainted?)
- assert_equal(true, y.first.untrusted?)
assert_equal(true, y.first.first.tainted?)
- assert_equal(true, y.first.first.untrusted?)
end
- def test_symbol
+ def test_symbol2
[:ruby, :"\u{7d05}\u{7389}"].each do |sym|
assert_equal(sym, Marshal.load(Marshal.dump(sym)), '[ruby-core:24788]')
end
@@ -321,7 +295,7 @@ class TestMarshal < Test::Unit::TestCase
end
end
- def test_regexp
+ def test_regexp2
assert_equal(/\\u/, Marshal.load("\004\b/\b\\\\u\000"))
assert_equal(/u/, Marshal.load("\004\b/\a\\u\000"))
assert_equal(/u/, Marshal.load("\004\bI/\a\\u\000\006:\016@encoding\"\vEUC-JP"))
@@ -333,10 +307,11 @@ class TestMarshal < Test::Unit::TestCase
assert_equal(c, Marshal.load(Marshal.dump(c)), bug2109)
assert_nothing_raised(ArgumentError, '[ruby-dev:40386]') do
- re = Tempfile.open("marshal_regexp") do |f|
+ re = Tempfile.create("marshal_regexp") do |f|
f.binmode.write("\x04\bI/\x00\x00\x06:\rencoding\"\rUS-ASCII")
- f.close
- Marshal.load(f.open.binmode)
+ f.rewind
+ re2 = Marshal.load(f)
+ re2
end
assert_equal(//, re)
end
@@ -455,6 +430,15 @@ class TestMarshal < Test::Unit::TestCase
assert_equal(o1, o2)
end
+ def test_marshal_symbol_ascii8bit
+ bug6209 = '[ruby-core:43762]'
+ o1 = "\xff".force_encoding("ASCII-8BIT").intern
+ m = Marshal.dump(o1)
+ o2 = nil
+ assert_nothing_raised(EncodingError, bug6209) {o2 = Marshal.load(m)}
+ assert_equal(o1, o2, bug6209)
+ end
+
class PrivateClass
def initialize(foo)
@foo = foo
@@ -484,6 +468,13 @@ class TestMarshal < Test::Unit::TestCase
assert_raise(ArgumentError){Marshal.load("\x04\bU:\rRational[\bi\x00i\x00i\x00")}
end
+ def test_marshal_flonum_reference
+ bug7348 = '[ruby-core:49323]'
+ e = []
+ ary = [ [2.0, e], [e] ]
+ assert_equal(ary, Marshal.load(Marshal.dump(ary)), bug7348)
+ end
+
class TestClass
end
@@ -494,11 +485,114 @@ class TestMarshal < Test::Unit::TestCase
bug7325 = '[ruby-core:49198]'
for c in [TestClass, TestModule]
assert(!c.tainted?)
- assert(!c.untrusted?)
- c2 = Marshal.load(Marshal.dump(c).taint.untrust)
+ c2 = Marshal.load(Marshal.dump(c).taint)
assert_same(c, c2)
assert(!c.tainted?, bug7325)
- assert(!c.untrusted?, bug7325)
+ end
+ end
+
+ class Bug7627 < Struct.new(:bar)
+ attr_accessor :foo
+
+ def marshal_dump; 'dump'; end # fake dump data
+ def marshal_load(*); end # do nothing
+ end
+
+ def test_marshal_dump_struct_ivar
+ bug7627 = '[ruby-core:51163]'
+ obj = Bug7627.new
+ obj.foo = '[Bug #7627]'
+
+ dump = Marshal.dump(obj)
+ loaded = Marshal.load(dump)
+
+ assert_equal(obj, loaded, bug7627)
+ assert_nil(loaded.foo, bug7627)
+ end
+
+ class LoadData
+ attr_reader :data
+ def initialize(data)
+ @data = data
+ end
+ alias marshal_dump data
+ alias marshal_load initialize
+ end
+
+ class Bug8276 < LoadData
+ def initialize(*)
+ super
+ freeze
+ end
+ alias marshal_load initialize
+ end
+
+ class FrozenData < LoadData
+ def marshal_load(data)
+ super
+ data.instance_variables.each do |iv|
+ instance_variable_set(iv, data.instance_variable_get(iv))
+ end
+ freeze
+ end
+ end
+
+ def test_marshal_dump_excess_encoding
+ bug8276 = '[ruby-core:54334] [Bug #8276]'
+ t = Bug8276.new(bug8276)
+ s = Marshal.dump(t)
+ assert_nothing_raised(RuntimeError, bug8276) {s = Marshal.load(s)}
+ assert_equal(t.data, s.data, bug8276)
+ end
+
+ def test_marshal_dump_ivar
+ s = "data with ivar"
+ s.instance_variable_set(:@t, 42)
+ t = Bug8276.new(s)
+ s = Marshal.dump(t)
+ assert_raise(RuntimeError) {Marshal.load(s)}
+ end
+
+ def test_marshal_load_ivar
+ s = "data with ivar"
+ s.instance_variable_set(:@t, 42)
+ hook = ->(v) {
+ if LoadData === v
+ assert_send([v, :instance_variable_defined?, :@t], v.class.name)
+ assert_equal(42, v.instance_variable_get(:@t), v.class.name)
+ end
+ v
+ }
+ [LoadData, FrozenData].each do |klass|
+ t = klass.new(s)
+ d = Marshal.dump(t)
+ v = assert_nothing_raised(RuntimeError) {break Marshal.load(d, hook)}
+ assert_send([v, :instance_variable_defined?, :@t], klass.name)
+ assert_equal(42, v.instance_variable_get(:@t), klass.name)
+ end
+ end
+
+ def test_class_ivar
+ assert_raise(TypeError) {Marshal.load("\x04\x08Ic\x1bTestMarshal::TestClass\x06:\x0e@ivar_bug\"\x08bug")}
+ assert_raise(TypeError) {Marshal.load("\x04\x08IM\x1bTestMarshal::TestClass\x06:\x0e@ivar_bug\"\x08bug")}
+ assert_not_operator(TestClass, :instance_variable_defined?, :@bug)
+ end
+
+ def test_module_ivar
+ assert_raise(TypeError) {Marshal.load("\x04\x08Im\x1cTestMarshal::TestModule\x06:\x0e@ivar_bug\"\x08bug")}
+ assert_raise(TypeError) {Marshal.load("\x04\x08IM\x1cTestMarshal::TestModule\x06:\x0e@ivar_bug\"\x08bug")}
+ assert_not_operator(TestModule, :instance_variable_defined?, :@bug)
+ end
+
+ class TestForRespondToFalse
+ def respond_to?(a)
+ false
+ end
+ end
+
+ def test_marshal_respond_to_arity
+ assert_nothing_raised(ArgumentError, '[Bug #7722]') do
+ Marshal.dump(TestForRespondToFalse.new)
end
end
end
diff --git a/test/ruby/test_math.rb b/test/ruby/test_math.rb
index 3895eec7f5..a715769380 100644
--- a/test/ruby/test_math.rb
+++ b/test/ruby/test_math.rb
@@ -136,6 +136,7 @@ class TestMath < Test::Unit::TestCase
check(0, Math.log(1, 10))
check(1, Math.log(10, 10))
check(2, Math.log(100, 10))
+ check(Math.log(2.0 ** 64), Math.log(1 << 64))
assert_equal(1.0/0, Math.log(1.0/0))
assert_nothing_raised { assert_infinity(-Math.log(+0.0)) }
assert_nothing_raised { assert_infinity(-Math.log(-0.0)) }
@@ -147,6 +148,7 @@ class TestMath < Test::Unit::TestCase
check(0, Math.log2(1))
check(1, Math.log2(2))
check(2, Math.log2(4))
+ check(Math.log2(2.0 ** 64), Math.log2(1 << 64))
assert_equal(1.0/0, Math.log2(1.0/0))
assert_nothing_raised { assert_infinity(-Math.log2(+0.0)) }
assert_nothing_raised { assert_infinity(-Math.log2(-0.0)) }
@@ -157,6 +159,7 @@ class TestMath < Test::Unit::TestCase
check(0, Math.log10(1))
check(1, Math.log10(10))
check(2, Math.log10(100))
+ check(Math.log10(2.0 ** 64), Math.log10(1 << 64))
assert_equal(1.0/0, Math.log10(1.0/0))
assert_nothing_raised { assert_infinity(-Math.log10(+0.0)) }
assert_nothing_raised { assert_infinity(-Math.log10(-0.0)) }
diff --git a/test/ruby/test_method.rb b/test/ruby/test_method.rb
index ea6c5f2164..18c25f14d1 100644
--- a/test/ruby/test_method.rb
+++ b/test/ruby/test_method.rb
@@ -1,3 +1,4 @@
+# -*- coding: us-ascii -*-
require 'test/unit'
require_relative 'envutil'
@@ -31,12 +32,16 @@ class TestMethod < Test::Unit::TestCase
end
class T
def initialize; end
+ def initialize_copy(*) super end
+ def initialize_clone(*) super end
+ def initialize_dup(*) super end
+ def respond_to_missing?(*) super end
def normal_method; end
end
module M
def func; end
module_function :func
- def meth; end
+ def meth; :meth end
end
def mv1() end
@@ -90,6 +95,20 @@ class TestMethod < Test::Unit::TestCase
assert_equal(:m, Class.new {define_method(:m) {__method__}}.new.m)
assert_equal(:m, Class.new {define_method(:m) {tap{return __method__}}}.new.m)
assert_nil(eval("class TestCallee; __method__; end"))
+
+ assert_equal(:test_callee, __callee__)
+ [
+ ["method", Class.new {def m; __callee__; end},],
+ ["block", Class.new {def m; tap{return __callee__}; end},],
+ ["define_method", Class.new {define_method(:m) {__callee__}}],
+ ["define_method block", Class.new {define_method(:m) {tap{return __callee__}}}],
+ ].each do |mesg, c|
+ c.class_eval {alias m2 m}
+ o = c.new
+ assert_equal(:m, o.m, mesg)
+ assert_equal(:m2, o.m2, mesg)
+ end
+ assert_nil(eval("class TestCallee; __callee__; end"))
end
def test_method_in_define_method_block
@@ -158,6 +177,7 @@ class TestMethod < Test::Unit::TestCase
o = Object.new
def o.foo; end
assert_kind_of(Integer, o.method(:foo).hash)
+ assert_equal(Array.instance_method(:map).hash, Array.instance_method(:collect).hash)
end
def test_receiver_name_owner
@@ -169,6 +189,12 @@ class TestMethod < Test::Unit::TestCase
assert_equal(class << o; self; end, m.owner)
assert_equal(:foo, m.unbind.name)
assert_equal(class << o; self; end, m.unbind.owner)
+ class << o
+ alias bar foo
+ end
+ m = o.method(:bar)
+ assert_equal(:bar, m.name)
+ assert_equal(:foo, m.original_name)
end
def test_instance_method
@@ -186,6 +212,10 @@ class TestMethod < Test::Unit::TestCase
def o.bar; end
m = o.method(:bar).unbind
assert_raise(TypeError) { m.bind(Object.new) }
+
+ feature4254 = '[ruby-core:34267]'
+ m = M.instance_method(:meth)
+ assert_equal(:meth, m.bind(Object.new).call, feature4254)
end
def test_define_method
@@ -208,7 +238,9 @@ class TestMethod < Test::Unit::TestCase
assert_raise(TypeError) do
Class.new.class_eval { define_method(:bar, o.method(:bar)) }
end
+ end
+ def test_define_singleton_method
o = Object.new
def o.foo(c)
c.class_eval { define_method(:foo) }
@@ -228,12 +260,64 @@ class TestMethod < Test::Unit::TestCase
assert_raise(TypeError) do
Module.new.module_eval {define_method(:foo, Base.instance_method(:foo))}
end
+ end
- assert_raise(TypeError) do
- Class.new.class_eval {define_method(:meth, M.instance_method(:meth))}
+ def test_define_singleton_method_with_extended_method
+ bug8686 = "[ruby-core:56174]"
+
+ m = Module.new do
+ extend self
+
+ def a
+ "a"
+ end
+ end
+
+ assert_nothing_raised do
+ m.define_singleton_method(:a, m.method(:a))
end
end
+ def test_define_method_transplating
+ feature4254 = '[ruby-core:34267]'
+ m = Module.new {define_method(:meth, M.instance_method(:meth))}
+ assert_equal(:meth, Object.new.extend(m).meth, feature4254)
+ c = Class.new {define_method(:meth, M.instance_method(:meth))}
+ assert_equal(:meth, c.new.meth, feature4254)
+ end
+
+ def test_define_method_visibility
+ c = Class.new do
+ public
+ define_method(:foo) {:foo}
+ protected
+ define_method(:bar) {:bar}
+ private
+ define_method(:baz) {:baz}
+ end
+
+ assert_equal(true, c.public_method_defined?(:foo))
+ assert_equal(false, c.public_method_defined?(:bar))
+ assert_equal(false, c.public_method_defined?(:baz))
+
+ assert_equal(false, c.protected_method_defined?(:foo))
+ assert_equal(true, c.protected_method_defined?(:bar))
+ assert_equal(false, c.protected_method_defined?(:baz))
+
+ assert_equal(false, c.private_method_defined?(:foo))
+ assert_equal(false, c.private_method_defined?(:bar))
+ assert_equal(true, c.private_method_defined?(:baz))
+
+ m = Module.new do
+ module_function
+ define_method(:foo) {:foo}
+ end
+ assert_equal(true, m.respond_to?(:foo))
+ assert_equal(false, m.public_method_defined?(:foo))
+ assert_equal(false, m.protected_method_defined?(:foo))
+ assert_equal(true, m.private_method_defined?(:foo))
+ end
+
def test_super_in_proc_from_define_method
c1 = Class.new {
def m
@@ -257,15 +341,6 @@ class TestMethod < Test::Unit::TestCase
assert_equal(:bar, m.clone.bar)
end
- def test_call
- o = Object.new
- def o.foo; p 1; end
- def o.bar(x); x; end
- m = o.method(:foo)
- m.taint
- assert_raise(SecurityError) { m.call }
- end
-
def test_inspect
o = Object.new
def o.foo; end
@@ -285,6 +360,12 @@ class TestMethod < Test::Unit::TestCase
c2.class_eval { private :foo }
m2 = c2.new.method(:foo)
assert_equal("#<Method: #{ c2.inspect }(#{ c.inspect })#foo>", m2.inspect)
+
+ bug7806 = '[ruby-core:52048] [Bug #7806]'
+ c3 = Class.new(c)
+ c3.class_eval { alias bar foo }
+ m3 = c3.new.method(:bar)
+ assert_equal("#<Method: #{ c3.inspect }#bar(foo)>", m3.inspect, bug7806)
end
def test_callee_top_level
@@ -312,6 +393,10 @@ class TestMethod < Test::Unit::TestCase
def test_default_accessibility
assert T.public_instance_methods.include?(:normal_method), 'normal methods are public by default'
assert !T.public_instance_methods.include?(:initialize), '#initialize is private'
+ assert !T.public_instance_methods.include?(:initialize_copy), '#initialize_copy is private'
+ assert !T.public_instance_methods.include?(:initialize_clone), '#initialize_clone is private'
+ assert !T.public_instance_methods.include?(:initialize_dup), '#initialize_dup is private'
+ assert !T.public_instance_methods.include?(:respond_to_missing?), '#respond_to_missing? is private'
assert !M.public_instance_methods.include?(:func), 'module methods are private by default'
assert M.public_instance_methods.include?(:meth), 'normal methods are public by default'
end
@@ -420,7 +505,7 @@ class TestMethod < Test::Unit::TestCase
assert_equal(true, respond_to?(:mv1))
assert_equal(false, respond_to?(:mv2))
- assert_equal(true, respond_to?(:mv3))
+ assert_equal(false, respond_to?(:mv3))
assert_equal(true, respond_to?(:mv1, true))
assert_equal(true, respond_to?(:mv2, true))
@@ -442,7 +527,7 @@ class TestMethod < Test::Unit::TestCase
assert_equal(true, v.respond_to?(:mv1))
assert_equal(false, v.respond_to?(:mv2))
- assert_equal(true, v.respond_to?(:mv3))
+ assert_equal(false, v.respond_to?(:mv3))
assert_equal(true, v.respond_to?(:mv1, true))
assert_equal(true, v.respond_to?(:mv2, true))
@@ -469,7 +554,102 @@ class TestMethod < Test::Unit::TestCase
define_singleton_method(:reverse, target.method(:reverse).to_proc)
end
end
- 1000.times {p = Bug6171.new('test'); 10000.times {p.reverse}}
+ 100.times {p = Bug6171.new('test'); 1000.times {p.reverse}}
EOC
end
+
+ def test___dir__
+ assert_instance_of String, __dir__
+ assert_equal(File.dirname(File.realpath(__FILE__)), __dir__)
+ bug8436 = '[ruby-core:55123] [Bug #8436]'
+ assert_equal(__dir__, eval("__dir__", binding), bug8436)
+ bug8662 = '[ruby-core:56099] [Bug #8662]'
+ assert_equal("arbitrary", eval("__dir__", binding, "arbitrary/file.rb"), bug8662)
+ end
+
+ def test_alias_owner
+ bug7613 = '[ruby-core:51105]'
+ c = Class.new {
+ def foo
+ end
+ }
+ x = c.new
+ class << x
+ alias bar foo
+ end
+ assert_equal(c, x.method(:foo).owner)
+ assert_equal(x.singleton_class, x.method(:bar).owner)
+ assert(x.method(:foo) != x.method(:bar), bug7613)
+ end
+
+ def test_included
+ m = Module.new {
+ def foo
+ end
+ }
+ c = Class.new {
+ def foo
+ end
+ include m
+ }
+ assert_equal(c, c.instance_method(:foo).owner)
+ end
+
+ def test_prepended
+ bug7836 = '[ruby-core:52160] [Bug #7836]'
+ bug7988 = '[ruby-core:53038] [Bug #7988]'
+ m = Module.new {
+ def foo
+ end
+ }
+ c = Class.new {
+ def foo
+ end
+ prepend m
+ }
+ assert_raise(NameError, bug7988) {Module.new{prepend m}.instance_method(:bar)}
+ end
+
+ def test_gced_bmethod
+ assert_normal_exit %q{
+ require 'irb'
+ IRB::Irb.module_eval do
+ define_method(:eval_input) do
+ IRB::Irb.module_eval { alias_method :eval_input, :to_s }
+ GC.start
+ Kernel
+ end
+ end
+ IRB.start
+ }, '[Bug #7825]'
+ end
+
+ def test_unlinked_method_entry_in_method_object_bug
+ bug8100 = '[ruby-core:53640] [Bug #8100]'
+ begin
+ assert_normal_exit %q{
+ loop do
+ def x
+ "hello" * 1000
+ end
+ method(:x).call
+ end
+ }, bug8100, timeout: 2
+ rescue Timeout::Error => e
+ else
+ end
+ assert_raise(Timeout::Error, bug8100) {raise e if e}
+ end
+
+ def test_singleton_method
+ feature8391 = '[ruby-core:54914] [Feature #8391]'
+ c1 = Class.new
+ c1.class_eval { def foo; :foo; end }
+ o = c1.new
+ def o.bar; :bar; end
+ assert_nothing_raised(NameError) {o.method(:foo)}
+ assert_raise(NameError, feature8391) {o.singleton_method(:foo)}
+ m = assert_nothing_raised(NameError, feature8391) {break o.singleton_method(:bar)}
+ assert_equal(:bar, m.call, feature8391)
+ end
end
diff --git a/test/ruby/test_module.rb b/test/ruby/test_module.rb
index 6673852d9c..e8172d580c 100644
--- a/test/ruby/test_module.rb
+++ b/test/ruby/test_module.rb
@@ -64,25 +64,6 @@ class TestModule < Test::Unit::TestCase
# Support stuff
- def remove_pp_mixins(list)
- list.reject {|c| c == PP::ObjectMixin }
- end
-
- def remove_json_mixins(list)
- list.reject {|c| c.to_s.start_with?("JSON") }
- end
-
- def remove_rake_mixins(list)
- list.reject {|c|
- name = c.name
- name.start_with?("Rake") or name.start_with?("FileUtils")
- }
- end
-
- def remove_minitest_mixins(list)
- list.reject {|c| c.to_s.start_with?("MiniTest") }
- end
-
module Mixin
MIXIN = 1
def mixin
@@ -220,10 +201,11 @@ class TestModule < Test::Unit::TestCase
assert_equal([User, Mixin], User.ancestors)
assert_equal([Mixin], Mixin.ancestors)
- assert_equal([Object, Kernel, BasicObject],
- remove_minitest_mixins(remove_rake_mixins(remove_json_mixins(remove_pp_mixins(Object.ancestors)))))
- assert_equal([String, Comparable, Object, Kernel, BasicObject],
- remove_minitest_mixins(remove_rake_mixins(remove_json_mixins(remove_pp_mixins(String.ancestors)))))
+ ancestors = Object.ancestors
+ mixins = ancestors - [Object, Kernel, BasicObject]
+ mixins << JSON::Ext::Generator::GeneratorMethods::String if defined?(JSON::Ext::Generator::GeneratorMethods::String)
+ assert_equal([Object, Kernel, BasicObject], ancestors - mixins)
+ assert_equal([String, Comparable, Object, Kernel, BasicObject], String.ancestors - mixins)
end
CLASS_EVAL = 2
@@ -258,9 +240,67 @@ class TestModule < Test::Unit::TestCase
assert(!Math.const_defined?("IP"))
end
+ def test_bad_constants
+ [
+ "#<Class:0x7b8b718b>",
+ ":Object",
+ "",
+ ":",
+ ["String::", "[Bug #7573]"],
+ "\u3042",
+ ].each do |name, msg|
+ expected = "wrong constant name %s" % quote(name)
+ msg = "#{msg}#{': ' if msg}wrong constant name #{name.dump}"
+ assert_raise_with_message(NameError, expected, msg) {
+ Object.const_get name
+ }
+ end
+ end
+
+ def test_leading_colons
+ assert_equal Object, AClass.const_get('::Object')
+ end
+
def test_const_get
assert_equal(Math::PI, Math.const_get("PI"))
assert_equal(Math::PI, Math.const_get(:PI))
+
+ n = Object.new
+ def n.to_str; @count = defined?(@count) ? @count + 1 : 1; "PI"; end
+ def n.count; @count; end
+ assert_equal(Math::PI, Math.const_get(n))
+ assert_equal(1, n.count)
+ end
+
+ def test_nested_get
+ assert_equal Other, Object.const_get([self.class, Other].join('::'))
+ assert_equal User::USER, self.class.const_get([User, 'USER'].join('::'))
+ end
+
+ def test_nested_get_symbol
+ const = [self.class, Other].join('::').to_sym
+ assert_raise(NameError) {Object.const_get(const)}
+
+ const = [User, 'USER'].join('::').to_sym
+ assert_raise(NameError) {self.class.const_get(const)}
+ end
+
+ def test_nested_get_const_missing
+ classes = []
+ klass = Class.new {
+ define_singleton_method(:const_missing) { |name|
+ classes << name
+ klass
+ }
+ }
+ klass.const_get("Foo::Bar::Baz")
+ assert_equal [:Foo, :Bar, :Baz], classes
+ end
+
+ def test_nested_bad_class
+ assert_raise(TypeError) do
+ self.class.const_get([User, 'USER', 'Foo'].join('::'))
+ end
end
def test_const_set
@@ -270,6 +310,20 @@ class TestModule < Test::Unit::TestCase
assert_equal(99, Other::KOALA)
Other.const_set("WOMBAT", "Hi")
assert_equal("Hi", Other::WOMBAT)
+
+ n = Object.new
+ def n.to_str; @count = defined?(@count) ? @count + 1 : 1; "HOGE"; end
+ def n.count; @count; end
+ def n.count=(v); @count=v; end
+ assert(!Other.const_defined?(:HOGE))
+ Other.const_set(n, 999)
+ assert_equal(1, n.count)
+ n.count = 0
+ assert_equal(999, Other.const_get(n))
+ assert_equal(1, n.count)
+ n.count = 0
+ assert_equal(true, Other.const_defined?(n))
+ assert_equal(1, n.count)
end
def test_constants
@@ -277,13 +331,52 @@ class TestModule < Test::Unit::TestCase
assert_equal([:MIXIN, :USER], User.constants.sort)
end
+ def test_dup
+ bug6454 = '[ruby-core:45132]'
+
+ a = Module.new
+ Other.const_set :BUG6454, a
+ b = a.dup
+ Other.const_set :BUG6454_dup, b
+
+ assert_equal "TestModule::Other::BUG6454_dup", b.inspect, bug6454
+ end
+
+ def test_dup_anonymous
+ bug6454 = '[ruby-core:45132]'
+
+ a = Module.new
+ original = a.inspect
+
+ b = a.dup
+
+ refute_equal original, b.inspect, bug6454
+ end
+
+ def test_public_include
+ assert_nothing_raised('#8846') do
+ Module.new.include(Module.new { def foo; end }).instance_methods == [:foo]
+ end
+ end
+
+ def test_include_toplevel
+ assert_separately([], <<-EOS)
+ Mod = Module.new {def foo; :include_foo end}
+ TOPLEVEL_BINDING.eval('include Mod')
+
+ assert_equal(:include_foo, TOPLEVEL_BINDING.eval('foo'))
+ assert_equal([Object, Mod], Object.ancestors.slice(0, 2))
+ EOS
+ end
+
def test_included_modules
assert_equal([], Mixin.included_modules)
assert_equal([Mixin], User.included_modules)
- assert_equal([Kernel],
- remove_minitest_mixins(remove_rake_mixins(remove_json_mixins(remove_pp_mixins(Object.included_modules)))))
- assert_equal([Comparable, Kernel],
- remove_minitest_mixins(remove_rake_mixins(remove_json_mixins(remove_pp_mixins(String.included_modules)))))
+
+ mixins = Object.included_modules - [Kernel]
+ mixins << JSON::Ext::Generator::GeneratorMethods::String if defined?(JSON::Ext::Generator::GeneratorMethods::String)
+ assert_equal([Kernel], Object.included_modules - mixins)
+ assert_equal([Comparable, Kernel], String.included_modules - mixins)
end
def test_instance_methods
@@ -355,6 +448,27 @@ class TestModule < Test::Unit::TestCase
assert_equal("TestModule::User", User.name)
end
+ def test_classpath
+ m = Module.new
+ n = Module.new
+ m.const_set(:N, n)
+ assert_nil(m.name)
+ assert_nil(n.name)
+ assert_equal([:N], m.constants)
+ m.module_eval("module O end")
+ assert_equal([:N, :O], m.constants)
+ m.module_eval("class C; end")
+ assert_equal([:N, :O, :C], m.constants)
+ assert_nil(m::N.name)
+ assert_match(/\A#<Module:.*>::O\z/, m::O.name)
+ assert_match(/\A#<Module:.*>::C\z/, m::C.name)
+ self.class.const_set(:M, m)
+ prefix = self.class.name + "::M::"
+ assert_equal(prefix+"N", m.const_get(:N).name)
+ assert_equal(prefix+"O", m.const_get(:O).name)
+ assert_equal(prefix+"C", m.const_get(:C).name)
+ end
+
def test_private_class_method
assert_raise(ExpectedException) { AClass.cm1 }
assert_raise(ExpectedException) { AClass.cm3 }
@@ -476,6 +590,9 @@ class TestModule < Test::Unit::TestCase
assert_raise(NameError) { c2::Bar }
assert_raise(NameError) { c2.const_get(:Bar) }
assert_raise(NameError) { c2.const_get(:Bar, false) }
+ assert_raise(NameError) { c2.const_get("Bar", false) }
+ assert_raise(NameError) { c2.const_get("BaR11", false) }
+ assert_raise(NameError) { Object.const_get("BaR11", false) }
c1.instance_eval do
def const_missing(x)
@@ -487,6 +604,11 @@ class TestModule < Test::Unit::TestCase
assert_equal(:Bar, c2::Bar)
assert_equal(:Bar, c2.const_get(:Bar))
assert_equal(:Bar, c2.const_get(:Bar, false))
+ assert_equal(:Bar, c2.const_get("Bar"))
+ assert_equal(:Bar, c2.const_get("Bar", false))
+
+ v = c2.const_get("Bar11", false)
+ assert_equal("Bar11".to_sym, v)
assert_raise(NameError) { c1.const_get(:foo) }
end
@@ -494,11 +616,30 @@ class TestModule < Test::Unit::TestCase
def test_const_set_invalid_name
c1 = Class.new
assert_raise(NameError) { c1.const_set(:foo, :foo) }
+ assert_raise(NameError) { c1.const_set("bar", :foo) }
+ assert_raise(TypeError) { c1.const_set(1, :foo) }
end
def test_const_get_invalid_name
c1 = Class.new
+ assert_raise(NameError) { c1.const_get(:foo) }
+ bug5084 = '[ruby-dev:44200]'
+ assert_raise(TypeError, bug5084) { c1.const_get(1) }
+ bug7574 = '[ruby-dev:46749]'
+ assert_raise_with_message(NameError, "wrong constant name \"String\\u0000\"", bug7574) {
+ Object.const_get("String\0")
+ }
+ end
+
+ def test_const_defined_invalid_name
+ c1 = Class.new
assert_raise(NameError) { c1.const_defined?(:foo) }
+ bug5084 = '[ruby-dev:44200]'
+ assert_raise(TypeError, bug5084) { c1.const_defined?(1) }
+ bug7574 = '[ruby-dev:46749]'
+ assert_raise_with_message(NameError, "wrong constant name \"String\\u0000\"", bug7574) {
+ Object.const_defined?("String\0")
+ }
end
def test_const_get_no_inherited
@@ -561,14 +702,35 @@ class TestModule < Test::Unit::TestCase
c.class_eval('@@foo = :foo')
assert_equal(:foo, c.class_variable_get(:@@foo))
assert_raise(NameError) { c.class_variable_get(:@@bar) } # c.f. instance_variable_get
+ assert_raise(NameError) { c.class_variable_get(:'@@') }
+ assert_raise(NameError) { c.class_variable_get('@@') }
assert_raise(NameError) { c.class_variable_get(:foo) }
+ assert_raise(NameError) { c.class_variable_get("bar") }
+ assert_raise(TypeError) { c.class_variable_get(1) }
+
+ n = Object.new
+ def n.to_str; @count = defined?(@count) ? @count + 1 : 1; "@@foo"; end
+ def n.count; @count; end
+ assert_equal(:foo, c.class_variable_get(n))
+ assert_equal(1, n.count)
end
def test_class_variable_set
c = Class.new
c.class_variable_set(:@@foo, :foo)
assert_equal(:foo, c.class_eval('@@foo'))
+ assert_raise(NameError) { c.class_variable_set(:'@@', 1) }
+ assert_raise(NameError) { c.class_variable_set('@@', 1) }
assert_raise(NameError) { c.class_variable_set(:foo, 1) }
+ assert_raise(NameError) { c.class_variable_set("bar", 1) }
+ assert_raise(TypeError) { c.class_variable_set(1, 1) }
+
+ n = Object.new
+ def n.to_str; @count = defined?(@count) ? @count + 1 : 1; "@@foo"; end
+ def n.count; @count; end
+ c.class_variable_set(n, :bar)
+ assert_equal(:bar, c.class_eval('@@foo'))
+ assert_equal(1, n.count)
end
def test_class_variable_defined
@@ -576,7 +738,16 @@ class TestModule < Test::Unit::TestCase
c.class_eval('@@foo = :foo')
assert_equal(true, c.class_variable_defined?(:@@foo))
assert_equal(false, c.class_variable_defined?(:@@bar))
+ assert_raise(NameError) { c.class_variable_defined?(:'@@') }
+ assert_raise(NameError) { c.class_variable_defined?('@@') }
assert_raise(NameError) { c.class_variable_defined?(:foo) }
+ assert_raise(NameError) { c.class_variable_defined?("bar") }
+ assert_raise(TypeError) { c.class_variable_defined?(1) }
+ n = Object.new
+ def n.to_str; @count = defined?(@count) ? @count + 1 : 1; "@@foo"; end
+ def n.count; @count; end
+ assert_equal(true, c.class_variable_defined?(n))
+ assert_equal(1, n.count)
end
def test_remove_class_variable
@@ -613,13 +784,6 @@ class TestModule < Test::Unit::TestCase
end
def test_undef
- assert_raise(SecurityError) do
- Thread.new do
- $SAFE = 4
- Class.instance_eval { undef_method(:foo) }
- end.join
- end
-
c = Class.new
assert_raise(NameError) do
c.instance_eval { undef_method(:foo) }
@@ -636,7 +800,7 @@ class TestModule < Test::Unit::TestCase
end
%w(object_id __send__ initialize).each do |n|
- assert_in_out_err([], <<-INPUT, [], /warning: undefining `#{n}' may cause serious problems$/)
+ assert_in_out_err([], <<-INPUT, [], %r"warning: undefining `#{n}' may cause serious problems$")
$VERBOSE = false
Class.new.instance_eval { undef_method(:#{n}) }
INPUT
@@ -714,19 +878,6 @@ class TestModule < Test::Unit::TestCase
assert_equal(true, c.private_method_defined?(:baz))
end
- def test_change_visibility_under_safe4
- c = Class.new
- c.class_eval do
- def foo; end
- end
- assert_raise(SecurityError) do
- Thread.new do
- $SAFE = 4
- c.class_eval { private :foo }
- end.join
- end
- end
-
def test_top_public_private
assert_in_out_err([], <<-INPUT, %w([:foo] [:bar]), [])
private
@@ -823,24 +974,6 @@ class TestModule < Test::Unit::TestCase
assert_equal(false, m.include?(m))
end
- def test_include_under_safe4
- m = Module.new
- c1 = Class.new
- assert_raise(SecurityError) do
- lambda {
- $SAFE = 4
- c1.instance_eval { include(m) }
- }.call
- end
- assert_nothing_raised do
- lambda {
- $SAFE = 4
- c2 = Class.new
- c2.instance_eval { include(m) }
- }.call
- end
- end
-
def test_send
a = AClass.new
assert_equal(:aClass, a.__send__(:aClass))
@@ -965,23 +1098,21 @@ class TestModule < Test::Unit::TestCase
assert_match(/:#{line}: warning: method redefined; discarding old foo/, stderr)
assert_match(/:#{line-1}: warning: previous definition of foo/, stderr, feature2155)
- stderr = EnvUtil.verbose_warning do
+ assert_warning '' do
Module.new do
def foo; end
alias bar foo
def foo; end
end
end
- assert_equal("", stderr)
- stderr = EnvUtil.verbose_warning do
+ assert_warning '' do
Module.new do
def foo; end
alias bar foo
alias bar foo
end
end
- assert_equal("", stderr)
line = __LINE__+4
stderr = EnvUtil.verbose_warning do
@@ -993,31 +1124,28 @@ class TestModule < Test::Unit::TestCase
assert_match(/:#{line}: warning: method redefined; discarding old foo/, stderr)
assert_match(/:#{line-1}: warning: previous definition of foo/, stderr, feature2155)
- stderr = EnvUtil.verbose_warning do
+ assert_warning '' do
Module.new do
define_method(:foo) do end
alias bar foo
- alias barf oo
+ alias bar foo
end
end
- assert_equal("", stderr)
- stderr = EnvUtil.verbose_warning do
+ assert_warning('', '[ruby-dev:39397]') do
Module.new do
module_function
def foo; end
module_function :foo
end
end
- assert_equal("", stderr, '[ruby-dev:39397]')
- stderr = EnvUtil.verbose_warning do
+ assert_warning '' do
Module.new do
def foo; end
undef foo
end
end
- assert_equal("", stderr)
end
def test_protected_singleton_method
@@ -1063,6 +1191,14 @@ class TestModule < Test::Unit::TestCase
assert_equal(1, c.x, bug3406)
end
+ def test_attr_writer_with_no_arguments
+ bug8540 = "[ruby-core:55543]"
+ c = Class.new do
+ attr_writer :foo
+ end
+ assert_raise(ArgumentError) { c.new.send :foo= }
+ end
+
def test_private_constant
c = Class.new
c.const_set(:FOO, "foo")
@@ -1090,6 +1226,15 @@ class TestModule < Test::Unit::TestCase
assert_equal("bar", c.class_eval("BAR"))
end
+ def test_private_constant_with_no_args
+ assert_in_out_err([], <<-RUBY, [], ["-:3: warning: private_constant with no argument is just ignored"])
+ $-w = true
+ class X
+ private_constant
+ end
+ RUBY
+ end
+
class PrivateClass
end
private_constant :PrivateClass
@@ -1221,6 +1366,420 @@ class TestModule < Test::Unit::TestCase
assert_in_out_err([], src, ["NameError"], [])
end
+ module M0
+ def m1; [:M0] end
+ end
+ module M1
+ def m1; [:M1, *super] end
+ end
+ module M2
+ def m1; [:M2, *super] end
+ end
+ M3 = Module.new do
+ def m1; [:M3, *super] end
+ end
+ module M4
+ def m1; [:M4, *super] end
+ end
+ class C
+ def m1; end
+ end
+ class C0 < C
+ include M0
+ prepend M1
+ def m1; [:C0, *super] end
+ end
+ class C1 < C0
+ prepend M2, M3
+ include M4
+ def m1; [:C1, *super] end
+ end
+
+ def test_prepend
+ obj = C0.new
+ expected = [:M1,:C0,:M0]
+ assert_equal(expected, obj.m1)
+ obj = C1.new
+ expected = [:M2,:M3,:C1,:M4,:M1,:C0,:M0]
+ assert_equal(expected, obj.m1)
+ end
+
+ def test_public_prepend
+ assert_nothing_raised('#8846') do
+ Class.new.prepend(Module.new)
+ end
+ end
+
+ def test_prepend_inheritance
+ bug6654 = '[ruby-core:45914]'
+ a = labeled_module("a")
+ b = labeled_module("b") {include a}
+ c = labeled_class("c") {prepend b}
+ assert_operator(c, :<, b, bug6654)
+ assert_operator(c, :<, a, bug6654)
+ bug8357 = '[ruby-core:54736] [Bug #8357]'
+ b = labeled_module("b") {prepend a}
+ c = labeled_class("c") {include b}
+ assert_operator(c, :<, b, bug8357)
+ assert_operator(c, :<, a, bug8357)
+ bug8357 = '[ruby-core:54742] [Bug #8357]'
+ assert_kind_of(b, c.new, bug8357)
+ end
+
+ def test_prepend_instance_methods
+ bug6655 = '[ruby-core:45915]'
+ assert_equal(Object.instance_methods, Class.new {prepend Module.new}.instance_methods, bug6655)
+ end
+
+ def test_prepend_singleton_methods
+ o = Object.new
+ o.singleton_class.class_eval {prepend Module.new}
+ assert_equal([], o.singleton_methods)
+ end
+
+ def test_prepend_remove_method
+ c = Class.new do
+ prepend Module.new {def foo; end}
+ end
+ assert_raise(NameError) do
+ c.class_eval do
+ remove_method(:foo)
+ end
+ end
+ c.class_eval do
+ def foo; end
+ end
+ removed = nil
+ c.singleton_class.class_eval do
+ define_method(:method_removed) {|id| removed = id}
+ end
+ assert_nothing_raised(NoMethodError, NameError, '[Bug #7843]') do
+ c.class_eval do
+ remove_method(:foo)
+ end
+ end
+ assert_equal(:foo, removed)
+ end
+
+ def test_prepend_class_ancestors
+ bug6658 = '[ruby-core:45919]'
+ m = labeled_module("m")
+ c = labeled_class("c") {prepend m}
+ assert_equal([m, c], c.ancestors[0, 2], bug6658)
+
+ bug6662 = '[ruby-dev:45868]'
+ c2 = labeled_class("c2", c)
+ anc = c2.ancestors
+ assert_equal([c2, m, c, Object], anc[0..anc.index(Object)], bug6662)
+ end
+
+ def test_prepend_module_ancestors
+ bug6659 = '[ruby-dev:45861]'
+ m0 = labeled_module("m0") {def x; [:m0, *super] end}
+ m1 = labeled_module("m1") {def x; [:m1, *super] end; prepend m0}
+ m2 = labeled_module("m2") {def x; [:m2, *super] end; prepend m1}
+ c0 = labeled_class("c0") {def x; [:c0] end}
+ c1 = labeled_class("c1") {def x; [:c1] end; prepend m2}
+ c2 = labeled_class("c2", c0) {def x; [:c2, *super] end; include m2}
+
+ assert_equal([m0, m1], m1.ancestors, bug6659)
+
+ bug6662 = '[ruby-dev:45868]'
+ assert_equal([m0, m1, m2], m2.ancestors, bug6662)
+ assert_equal([m0, m1, m2, c1], c1.ancestors[0, 4], bug6662)
+ assert_equal([:m0, :m1, :m2, :c1], c1.new.x)
+ assert_equal([c2, m0, m1, m2, c0], c2.ancestors[0, 5], bug6662)
+ assert_equal([:c2, :m0, :m1, :m2, :c0], c2.new.x)
+
+ m3 = labeled_module("m3") {include m1; prepend m1}
+ assert_equal([m3, m0, m1], m3.ancestors)
+ m3 = labeled_module("m3") {prepend m1; include m1}
+ assert_equal([m0, m1, m3], m3.ancestors)
+ m3 = labeled_module("m3") {prepend m1; prepend m1}
+ assert_equal([m0, m1, m3], m3.ancestors)
+ m3 = labeled_module("m3") {include m1; include m1}
+ assert_equal([m3, m0, m1], m3.ancestors)
+ end
+
+ def labeled_module(name, &block)
+ Module.new do
+ singleton_class.class_eval {define_method(:to_s) {name}; alias inspect to_s}
+ class_eval(&block) if block
+ end
+ end
+
+ def labeled_class(name, superclass = Object, &block)
+ Class.new(superclass) do
+ singleton_class.class_eval {define_method(:to_s) {name}; alias inspect to_s}
+ class_eval(&block) if block
+ end
+ end
+
+ def test_prepend_instance_methods_false
+ bug6660 = '[ruby-dev:45863]'
+ assert_equal([:m1], Class.new{ prepend Module.new; def m1; end }.instance_methods(false), bug6660)
+ assert_equal([:m1], Class.new(Class.new{def m2;end}){ prepend Module.new; def m1; end }.instance_methods(false), bug6660)
+ end
+
+ def test_cyclic_prepend
+ bug7841 = '[ruby-core:52205] [Bug #7841]'
+ m1 = Module.new
+ m2 = Module.new
+ m1.instance_eval { prepend(m2) }
+ assert_raise(ArgumentError, bug7841) do
+ m2.instance_eval { prepend(m1) }
+ end
+ end
+
+ def test_prepend_optmethod
+ bug7983 = '[ruby-dev:47124] [Bug #7983]'
+ assert_separately [], %{
+ module M
+ def /(other)
+ to_f / other
+ end
+ end
+ Fixnum.send(:prepend, M)
+ assert_equal(0.5, 1 / 2, "#{bug7983}")
+ }
+ assert_equal(0, 1 / 2)
+ end
+
+ def test_prepend_visibility
+ bug8005 = '[ruby-core:53106] [Bug #8005]'
+ c = Class.new do
+ prepend Module.new {}
+ def foo() end
+ protected :foo
+ end
+ a = c.new
+ assert_respond_to a, [:foo, true], bug8005
+ assert_nothing_raised(NoMethodError, bug8005) {a.send :foo}
+ end
+
+ def test_prepend_visibility_inherited
+ bug8238 = '[ruby-core:54105] [Bug #8238]'
+ assert_separately [], <<-"end;", timeout: 3
+ class A
+ def foo() A; end
+ private :foo
+ end
+ class B < A
+ public :foo
+ prepend Module.new
+ end
+ assert_equal(A, B.new.foo, "#{bug8238}")
+ end;
+ end
+
+ def test_prepend_included_modules
+ bug8025 = '[ruby-core:53158] [Bug #8025]'
+ mixin = labeled_module("mixin")
+ c = labeled_module("c") {prepend mixin}
+ im = c.included_modules
+ assert_not_include(im, c, bug8025)
+ assert_include(im, mixin, bug8025)
+ c1 = labeled_class("c1") {prepend mixin}
+ c2 = labeled_class("c2", c1)
+ im = c2.included_modules
+ assert_not_include(im, c1, bug8025)
+ assert_not_include(im, c2, bug8025)
+ assert_include(im, mixin, bug8025)
+ end
+
+ def test_class_variables
+ m = Module.new
+ m.class_variable_set(:@@foo, 1)
+ m2 = Module.new
+ m2.send(:include, m)
+ m2.class_variable_set(:@@bar, 2)
+ assert_equal([:@@foo], m.class_variables)
+ assert_equal([:@@bar, :@@foo], m2.class_variables)
+ assert_equal([:@@bar, :@@foo], m2.class_variables(true))
+ assert_equal([:@@bar], m2.class_variables(false))
+ end
+
+ Bug6891 = '[ruby-core:47241]'
+
+ def test_extend_module_with_protected_method
+ list = []
+
+ x = Class.new {
+ @list = list
+
+ extend Module.new {
+ protected
+
+ def inherited(klass)
+ @list << "protected"
+ super(klass)
+ end
+ }
+
+ extend Module.new {
+ def inherited(klass)
+ @list << "public"
+ super(klass)
+ end
+ }
+ }
+
+ assert_nothing_raised(NoMethodError, Bug6891) {Class.new(x)}
+ assert_equal(['public', 'protected'], list)
+ end
+
+ def test_extend_module_with_protected_bmethod
+ list = []
+
+ x = Class.new {
+ extend Module.new {
+ protected
+
+ define_method(:inherited) do |klass|
+ list << "protected"
+ super(klass)
+ end
+ }
+
+ extend Module.new {
+ define_method(:inherited) do |klass|
+ list << "public"
+ super(klass)
+ end
+ }
+ }
+
+ assert_nothing_raised(NoMethodError, Bug6891) {Class.new(x)}
+ assert_equal(['public', 'protected'], list)
+ end
+
+ def test_invalid_attr
+ %W[
+ foo?
+ @foo
+ @@foo
+ $foo
+ \u3042$
+ ].each do |name|
+ assert_raise_with_message(NameError, /#{Regexp.quote(quote(name))}/) do
+ Module.new { attr_accessor name.to_sym }
+ end
+ end
+ end
+
+ private def quote(name)
+ encoding = Encoding.default_internal || Encoding.default_external
+ (name.encoding == encoding || name.ascii_only?) ? name : name.inspect
+ end
+
+ class AttrTest
+ class << self
+ attr_accessor :cattr
+ end
+ attr_accessor :iattr
+ def ivar
+ @ivar
+ end
+ end
+
+ def test_uninitialized_instance_variable
+ a = AttrTest.new
+ assert_warning(/instance variable @ivar not initialized/) do
+ assert_nil(a.ivar)
+ end
+ a.instance_variable_set(:@ivar, 42)
+ assert_warning '' do
+ assert_equal(42, a.ivar)
+ end
+ end
+
+ def test_uninitialized_attr
+ a = AttrTest.new
+ assert_warning '' do
+ assert_nil(a.iattr)
+ end
+ a.iattr = 42
+ assert_warning '' do
+ assert_equal(42, a.iattr)
+ end
+ end
+
+ def test_uninitialized_attr_class
+ assert_warning '' do
+ assert_nil(AttrTest.cattr)
+ end
+ AttrTest.cattr = 42
+ assert_warning '' do
+ assert_equal(42, AttrTest.cattr)
+ end
+ end
+
+ def test_uninitialized_attr_non_object
+ a = Class.new(Array) do
+ attr_accessor :iattr
+ end.new
+ assert_warning '' do
+ assert_nil(a.iattr)
+ end
+ a.iattr = 42
+ assert_warning '' do
+ assert_equal(42, a.iattr)
+ end
+ end
+
+ def test_remove_const
+ m = Module.new
+ assert_raise(NameError){ m.instance_eval { remove_const(:__FOO__) } }
+ end
+
+ def test_private_top_methods
+ assert_top_method_is_private(:include)
+ assert_top_method_is_private(:public)
+ assert_top_method_is_private(:private)
+ assert_top_method_is_private(:define_method)
+ end
+
+ module PrivateConstantReopen
+ PRIVATE_CONSTANT = true
+ private_constant :PRIVATE_CONSTANT
+ end
+
+ def test_private_constant_reopen
+ assert_raise(NameError) do
+ eval <<-EOS, TOPLEVEL_BINDING
+ module TestModule::PrivateConstantReopen::PRIVATE_CONSTANT
+ end
+ EOS
+ end
+ assert_raise(NameError) do
+ eval <<-EOS, TOPLEVEL_BINDING
+ class TestModule::PrivateConstantReopen::PRIVATE_CONSTANT
+ end
+ EOS
+ end
+ end
+
+ def test_singleton_class_ancestors
+ feature8035 = '[ruby-core:53171]'
+ obj = Object.new
+ assert_equal [obj.singleton_class, Object], obj.singleton_class.ancestors.first(2), feature8035
+
+ mod = Module.new
+ obj.extend mod
+ assert_equal [obj.singleton_class, mod, Object], obj.singleton_class.ancestors.first(3)
+
+ obj = Object.new
+ obj.singleton_class.send :prepend, mod
+ assert_equal [mod, obj.singleton_class, Object], obj.singleton_class.ancestors.first(3)
+ end
+
+ def test_visibility_by_public_class_method
+ bug8284 = '[ruby-core:54404] [Bug #8284]'
+ assert_raise(NoMethodError) {Object.define_method}
+ Module.new.public_class_method(:define_method)
+ assert_raise(NoMethodError, bug8284) {Object.define_method}
+ end
+
def test_include_module_with_constants_invalidates_method_cache
assert_in_out_err([], <<-RUBY, %w(123 456), [])
A = 123
@@ -1240,4 +1799,53 @@ class TestModule < Test::Unit::TestCase
puts Foo.a
RUBY
end
+
+ def test_return_value_of_define_method
+ retvals = []
+ Class.new.class_eval do
+ retvals << define_method(:foo){}
+ retvals << define_method(:bar, instance_method(:foo))
+ end
+ assert_equal :foo, retvals[0]
+ assert_equal :bar, retvals[1]
+ end
+
+ def test_return_value_of_define_singleton_method
+ retvals = []
+ Class.new do
+ retvals << define_singleton_method(:foo){}
+ retvals << define_singleton_method(:bar, method(:foo))
+ end
+ assert_equal :foo, retvals[0]
+ assert_equal :bar, retvals[1]
+ end
+
+ def test_prepend_gc
+ assert_separately [], %{
+ module Foo
+ end
+ class Object
+ prepend Foo
+ end
+ GC.start # make created T_ICLASS old (or remembered shady)
+ class Object # add methods into T_ICLASS (need WB if it is old)
+ def foo; end
+ attr_reader :bar
+ end
+ 1_000_000.times{''} # cause GC
+ }
+ end
+
+ private
+
+ def assert_top_method_is_private(method)
+ assert_separately [], %{
+ methods = singleton_class.private_instance_methods(false)
+ assert_include(methods, :#{method}, ":#{method} should be private")
+
+ assert_raise_with_message(NoMethodError, "private method `#{method}' called for main:Object") {
+ self.#{method}
+ }
+ }
+ end
end
diff --git a/test/ruby/test_not.rb b/test/ruby/test_not.rb
new file mode 100644
index 0000000000..486075bf83
--- /dev/null
+++ b/test/ruby/test_not.rb
@@ -0,0 +1,12 @@
+require 'test/unit'
+
+class TestIfunless < Test::Unit::TestCase
+ def test_not_with_grouped_expression
+ assert_equal(false, (not (true)))
+ assert_equal(true, (not (false)))
+ end
+
+ def test_not_with_empty_grouped_expression
+ assert_equal(true, (not ()))
+ end
+end
diff --git a/test/ruby/test_notimp.rb b/test/ruby/test_notimp.rb
index c29119eac9..9721723b29 100644
--- a/test/ruby/test_notimp.rb
+++ b/test/ruby/test_notimp.rb
@@ -1,4 +1,5 @@
require 'test/unit'
+require 'timeout'
require 'tmpdir'
class TestNotImplement < Test::Unit::TestCase
@@ -20,13 +21,32 @@ class TestNotImplement < Test::Unit::TestCase
end
def test_call_fork
- if Process.respond_to?(:fork)
- assert_nothing_raised {
+ GC.start
+ pid = nil
+ ps =
+ case RUBY_PLATFORM
+ when /linux/ # assume Linux Distribution uses procps
+ proc {`ps -eLf #{pid}`}
+ when /freebsd/
+ proc {`ps -lH #{pid}`}
+ when /darwin/
+ proc {`ps -lM #{pid}`}
+ else
+ proc {`ps -l #{pid}`}
+ end
+ assert_nothing_raised(Timeout::Error, ps) do
+ Timeout.timeout(5) {
pid = fork {}
Process.wait pid
+ pid = nil
}
end
- end
+ ensure
+ if pid
+ Process.kill(:KILL, pid)
+ Process.wait pid
+ end
+ end if Process.respond_to?(:fork)
def test_call_lchmod
if File.respond_to?(:lchmod)
diff --git a/test/ruby/test_numeric.rb b/test/ruby/test_numeric.rb
index 9667046916..e82269165b 100644
--- a/test/ruby/test_numeric.rb
+++ b/test/ruby/test_numeric.rb
@@ -54,7 +54,20 @@ class TestNumeric < Test::Unit::TestCase
end
def test_quo
- assert_raise(ArgumentError) {DummyNumeric.new.quo(1)}
+ assert_raise(TypeError) {DummyNumeric.new.quo(1)}
+ end
+
+ def test_quo_ruby_core_41575
+ x = DummyNumeric.new
+ rat = 84.quo(1)
+ DummyNumeric.class_eval do
+ define_method(:to_r) { rat }
+ end
+ assert_equal(2.quo(1), x.quo(42), '[ruby-core:41575]')
+ ensure
+ DummyNumeric.class_eval do
+ remove_method :to_r
+ end
end
def test_divmod
@@ -180,41 +193,74 @@ class TestNumeric < Test::Unit::TestCase
end
end
- def test_step
- a = []
- 1.step(10) {|x| a << x }
- assert_equal([1, 2, 3, 4, 5, 6, 7, 8, 9, 10], a)
+ def assert_step(expected, (from, *args), inf: false)
+ enum = from.step(*args)
+ size = enum.size
+ xsize = expected.size
- a = []
- 1.step(10, 2) {|x| a << x }
- assert_equal([1, 3, 5, 7, 9], a)
+ if inf
+ assert_send [size, :infinite?], "step size: +infinity"
+ assert_send [size, :>, 0], "step size: +infinity"
- assert_raise(ArgumentError) { 1.step(10, 1, 0) { } }
- assert_raise(ArgumentError) { 1.step(10, 0) { } }
-
- a = []
- 10.step(1, -2) {|x| a << x }
- assert_equal([10, 8, 6, 4, 2], a)
+ a = []
+ from.step(*args) { |x| a << x; break if a.size == xsize }
+ assert_equal expected, a, "step"
- a = []
- 1.0.step(10.0, 2.0) {|x| a << x }
- assert_equal([1.0, 3.0, 5.0, 7.0, 9.0], a)
+ a = []
+ enum.each { |x| a << x; break if a.size == xsize }
+ assert_equal expected, a, "step enumerator"
+ else
+ assert_equal expected.size, size, "step size"
- a = []
- 1.step(10, 2**32) {|x| a << x }
- assert_equal([1], a)
+ a = []
+ from.step(*args) { |x| a << x }
+ assert_equal expected, a, "step"
- a = []
- 10.step(1, -(2**32)) {|x| a << x }
- assert_equal([10], a)
-
- a = []
- 1.step(0, Float::INFINITY) {|x| a << x }
- assert_equal([], a)
+ a = []
+ enum.each { |x| a << x }
+ assert_equal expected, a, "step enumerator"
+ end
+ end
- a = []
- 0.step(1, -Float::INFINITY) {|x| a << x }
- assert_equal([], a)
+ def test_step
+ assert_raise(ArgumentError) { 1.step(10, 1, 0) { } }
+ assert_raise(ArgumentError) { 1.step(10, 1, 0).size }
+ assert_raise(ArgumentError) { 1.step(10, 0) { } }
+ assert_raise(ArgumentError) { 1.step(10, 0).size }
+ assert_raise(ArgumentError) { 1.step(10, "1") { } }
+ assert_raise(ArgumentError) { 1.step(10, "1").size }
+ assert_raise(TypeError) { 1.step(10, nil) { } }
+ assert_raise(TypeError) { 1.step(10, nil).size }
+ assert_nothing_raised { 1.step(by: 0, to: nil) }
+ assert_nothing_raised { 1.step(by: 0, to: nil).size }
+ assert_nothing_raised { 1.step(by: 0) }
+ assert_nothing_raised { 1.step(by: 0).size }
+ assert_nothing_raised { 1.step(by: nil) }
+ assert_nothing_raised { 1.step(by: nil).size }
+
+ assert_step [1, 2, 3, 4, 5, 6, 7, 8, 9, 10], [1, 10]
+ assert_step [1, 2, 3, 4, 5, 6, 7, 8, 9, 10], [1, to: 10]
+ assert_step [1, 2, 3, 4, 5, 6, 7, 8, 9, 10], [1, to: 10, by: nil]
+ assert_step [1, 3, 5, 7, 9], [1, 10, 2]
+ assert_step [1, 3, 5, 7, 9], [1, to: 10, by: 2]
+
+ assert_step [10, 8, 6, 4, 2], [10, 1, -2]
+ assert_step [10, 8, 6, 4, 2], [10, to: 1, by: -2]
+ assert_step [1.0, 3.0, 5.0, 7.0, 9.0], [1.0, 10.0, 2.0]
+ assert_step [1.0, 3.0, 5.0, 7.0, 9.0], [1.0, to: 10.0, by: 2.0]
+ assert_step [1], [1, 10, 2**32]
+ assert_step [1], [1, to: 10, by: 2**32]
+
+ assert_step [3, 3, 3, 3], [3, by: 0], inf: true
+ assert_step [10], [10, 1, -(2**32)]
+
+ assert_step [], [1, 0, Float::INFINITY]
+ assert_step [], [0, 1, -Float::INFINITY]
+ assert_step [10], [10, to: 1, by: -(2**32)]
+
+ assert_step [10, 11, 12, 13], [10], inf: true
+ assert_step [10, 9, 8, 7], [10, by: -1], inf: true
+ assert_step [10, 9, 8, 7], [10, by: -1, to: nil], inf: true
end
def test_num2long
@@ -224,7 +270,7 @@ class TestNumeric < Test::Unit::TestCase
assert_raise(TypeError) { 1 & 9223372036854777856.0 }
o = Object.new
def o.to_int; 1; end
- assert_equal(1, 1 & o)
+ assert_raise(TypeError) { assert_equal(1, 1 & o) }
end
def test_eql
diff --git a/test/ruby/test_object.rb b/test/ruby/test_object.rb
index 3705df21c1..55f3ef2b16 100644
--- a/test/ruby/test_object.rb
+++ b/test/ruby/test_object.rb
@@ -1,3 +1,4 @@
+# -*- coding: us-ascii -*-
require 'test/unit'
require_relative 'envutil'
@@ -21,6 +22,17 @@ class TestObject < Test::Unit::TestCase
end
end
+ def test_init_dupclone
+ cls = Class.new do
+ def initialize_clone(orig); throw :initialize_clone; end
+ def initialize_dup(orig); throw :initialize_dup; end
+ end
+
+ obj = cls.new
+ assert_throws(:initialize_clone) {obj.clone}
+ assert_throws(:initialize_dup) {obj.dup}
+ end
+
def test_instance_of
assert_raise(TypeError) { 1.instance_of?(1) }
end
@@ -40,21 +52,11 @@ class TestObject < Test::Unit::TestCase
assert_raise(RuntimeError) { o.untaint }
end
- def test_freeze_under_safe_4
- o = Object.new
- assert_raise(SecurityError) do
- Thread.new do
- $SAFE = 4
- o.freeze
- end.join
- end
- end
-
def test_freeze_immediate
- assert_equal(false, 1.frozen?)
+ assert_equal(true, 1.frozen?)
1.freeze
assert_equal(true, 1.frozen?)
- assert_equal(false, 2.frozen?)
+ assert_equal(true, 2.frozen?)
end
def test_nil_to_f
@@ -147,19 +149,49 @@ class TestObject < Test::Unit::TestCase
assert_equal([:foo2], (o2.public_methods(false) - o0.public_methods(false)).sort)
end
+ def test_methods_prepend
+ bug8044 = '[ruby-core:53207] [Bug #8044]'
+ o = Object.new
+ def o.foo; end
+ assert_equal([:foo], o.methods(false))
+ class << o; prepend Module.new; end
+ assert_equal([:foo], o.methods(false), bug8044)
+ end
+
def test_instance_variable_get
o = Object.new
o.instance_eval { @foo = :foo }
assert_equal(:foo, o.instance_variable_get(:@foo))
assert_equal(nil, o.instance_variable_get(:@bar))
+ assert_raise(NameError) { o.instance_variable_get('@') }
+ assert_raise(NameError) { o.instance_variable_get(:'@') }
assert_raise(NameError) { o.instance_variable_get(:foo) }
+ assert_raise(NameError) { o.instance_variable_get("bar") }
+ assert_raise(TypeError) { o.instance_variable_get(1) }
+
+ n = Object.new
+ def n.to_str; @count = defined?(@count) ? @count + 1 : 1; "@foo"; end
+ def n.count; @count; end
+ assert_equal(:foo, o.instance_variable_get(n))
+ assert_equal(1, n.count)
end
def test_instance_variable_set
o = Object.new
o.instance_variable_set(:@foo, :foo)
assert_equal(:foo, o.instance_eval { @foo })
+ assert_raise(NameError) { o.instance_variable_set(:'@', 1) }
+ assert_raise(NameError) { o.instance_variable_set('@', 1) }
assert_raise(NameError) { o.instance_variable_set(:foo, 1) }
+ assert_raise(NameError) { o.instance_variable_set("bar", 1) }
+ assert_raise(TypeError) { o.instance_variable_set(1, 1) }
+
+ n = Object.new
+ def n.to_str; @count = defined?(@count) ? @count + 1 : 1; "@foo"; end
+ def n.count; @count; end
+ o.instance_variable_set(n, :bar)
+ assert_equal(:bar, o.instance_eval { @foo })
+ assert_equal(1, n.count)
end
def test_instance_variable_defined
@@ -167,13 +199,23 @@ class TestObject < Test::Unit::TestCase
o.instance_eval { @foo = :foo }
assert_equal(true, o.instance_variable_defined?(:@foo))
assert_equal(false, o.instance_variable_defined?(:@bar))
+ assert_raise(NameError) { o.instance_variable_defined?(:'@') }
+ assert_raise(NameError) { o.instance_variable_defined?('@') }
assert_raise(NameError) { o.instance_variable_defined?(:foo) }
+ assert_raise(NameError) { o.instance_variable_defined?("bar") }
+ assert_raise(TypeError) { o.instance_variable_defined?(1) }
+
+ n = Object.new
+ def n.to_str; @count = defined?(@count) ? @count + 1 : 1; "@foo"; end
+ def n.count; @count; end
+ assert_equal(true, o.instance_variable_defined?(n))
+ assert_equal(1, n.count)
end
def test_remove_instance_variable
o = Object.new
o.instance_eval { @foo = :foo }
- o.instance_eval { remove_instance_variable(:@foo) }
+ o.remove_instance_variable(:@foo)
assert_equal(false, o.instance_variable_defined?(:@foo))
end
@@ -197,6 +239,19 @@ class TestObject < Test::Unit::TestCase
assert_equal([o], Array(o))
end
+ def test_convert_hash
+ assert_equal({}, Hash(nil))
+ assert_equal({}, Hash([]))
+ assert_equal({key: :value}, Hash(key: :value))
+ assert_raise(TypeError) { Hash([1,2]) }
+ assert_raise(TypeError) { Hash(Object.new) }
+ o = Object.new
+ def o.to_hash; {a: 1, b: 2}; end
+ assert_equal({a: 1, b: 2}, Hash(o))
+ def o.to_hash; 9; end
+ assert_raise(TypeError) { Hash(o) }
+ end
+
def test_to_integer
o = Object.new
def o.to_i; nil; end
@@ -223,17 +278,6 @@ class TestObject < Test::Unit::TestCase
assert_equal(1+3+5+7+9, n)
end
- def test_add_method_under_safe4
- o = Object.new
- assert_raise(SecurityError) do
- Thread.new do
- $SAFE = 4
- def o.foo
- end
- end.join
- end
- end
-
def test_redefine_method_under_verbose
assert_in_out_err([], <<-INPUT, %w(2), /warning: method redefined; discarding old foo$/)
$VERBOSE = true
@@ -257,20 +301,6 @@ class TestObject < Test::Unit::TestCase
end
def test_remove_method
- assert_raise(SecurityError) do
- Thread.new do
- $SAFE = 4
- Object.instance_eval { remove_method(:foo) }
- end.join
- end
-
- assert_raise(SecurityError) do
- Thread.new do
- $SAFE = 4
- Class.instance_eval { remove_method(:foo) }
- end.join
- end
-
c = Class.new
c.freeze
assert_raise(RuntimeError) do
@@ -346,16 +376,29 @@ class TestObject < Test::Unit::TestCase
assert_nothing_raised(bug2494) {[b].flatten}
end
+ def test_respond_to_missing_string
+ c = Class.new do
+ def respond_to_missing?(id, priv)
+ !(id !~ /\Agadzoks\d+\z/) ^ priv
+ end
+ end
+ foo = c.new
+ assert_equal(false, foo.respond_to?("gadzooks16"))
+ assert_equal(true, foo.respond_to?("gadzooks17", true))
+ assert_equal(true, foo.respond_to?("gadzoks16"))
+ assert_equal(false, foo.respond_to?("gadzoks17", true))
+ end
+
def test_respond_to_missing
c = Class.new do
- def respond_to_missing?(id, priv=false)
+ def respond_to_missing?(id, priv)
if id == :foobar
true
else
false
end
end
- def method_missing(id,*args)
+ def method_missing(id, *args)
if id == :foobar
return [:foo, *args]
else
@@ -434,6 +477,23 @@ class TestObject < Test::Unit::TestCase
assert_equal([[:respond_to?, :to_ary]], called, '[bug:6000]')
end
+ def test_implicit_respond_to_arity_3
+ p = Object.new
+
+ called = []
+ p.singleton_class.class_eval do
+ define_method(:respond_to?) do |a, b, c|
+ called << [:respond_to?, a, b, c]
+ false
+ end
+ end
+
+ msg = 'respond_to? must accept 1 or 2 arguments (requires 3)'
+ assert_raise_with_message(ArgumentError, msg, '[bug:6000]') do
+ [[p]].flatten
+ end
+ end
+
def test_method_missing_passed_block
bug5731 = '[ruby-dev:44961]'
@@ -489,6 +549,52 @@ class TestObject < Test::Unit::TestCase
assert_raise(ArgumentError) { 1.send }
end
+ def test_send_with_block
+ x = :ng
+ 1.send(:times) { x = :ok }
+ assert_equal(:ok, x)
+
+ x = :ok
+ o = Object.new
+ def o.inspect
+ yield if block_given?
+ super
+ end
+ begin
+ nil.public_send(o) { x = :ng }
+ rescue
+ end
+ assert_equal(:ok, x)
+ end
+
+ def test_public_send
+ c = Class.new do
+ def pub
+ :ok
+ end
+
+ def invoke(m)
+ public_send(m)
+ end
+
+ protected
+ def prot
+ :ng
+ end
+
+ private
+ def priv
+ :ng
+ end
+ end.new
+ assert_equal(:ok, c.public_send(:pub))
+ assert_raise(NoMethodError) {c.public_send(:priv)}
+ assert_raise(NoMethodError) {c.public_send(:prot)}
+ assert_raise(NoMethodError) {c.invoke(:priv)}
+ bug7499 = '[ruby-core:50489]'
+ assert_raise(NoMethodError, bug7499) {c.invoke(:prot)}
+ end
+
def test_no_superclass_method
bug2312 = '[ruby-dev:39581]'
@@ -551,117 +657,83 @@ class TestObject < Test::Unit::TestCase
end
def test_untrusted
- obj = lambda {
- $SAFE = 4
- x = Object.new
- x.instance_eval { @foo = 1 }
- x
- }.call
- assert_equal(true, obj.untrusted?)
- assert_equal(true, obj.tainted?)
-
- x = Object.new
- assert_equal(false, x.untrusted?)
- assert_raise(SecurityError) do
- lambda {
- $SAFE = 4
- x.instance_eval { @foo = 1 }
- }.call
+ verbose = $VERBOSE
+ $VERBOSE = false
+ begin
+ obj = Object.new
+ assert_equal(false, obj.untrusted?)
+ assert_equal(false, obj.tainted?)
+ obj.untrust
+ assert_equal(true, obj.untrusted?)
+ assert_equal(true, obj.tainted?)
+ obj.trust
+ assert_equal(false, obj.untrusted?)
+ assert_equal(false, obj.tainted?)
+ obj.taint
+ assert_equal(true, obj.untrusted?)
+ assert_equal(true, obj.tainted?)
+ obj.untaint
+ assert_equal(false, obj.untrusted?)
+ assert_equal(false, obj.tainted?)
+ ensure
+ $VERBOSE = verbose
end
-
- x = Object.new
- x.taint
- assert_raise(SecurityError) do
- lambda {
- $SAFE = 4
- x.instance_eval { @foo = 1 }
- }.call
- end
-
- x.untrust
- assert_equal(true, x.untrusted?)
- assert_nothing_raised do
- lambda {
- $SAFE = 4
- x.instance_eval { @foo = 1 }
- }.call
- end
-
- x.trust
- assert_equal(false, x.untrusted?)
- assert_raise(SecurityError) do
- lambda {
- $SAFE = 4
- x.instance_eval { @foo = 1 }
- }.call
- end
-
- a = Object.new
- a.untrust
- assert_equal(true, a.untrusted?)
- b = a.dup
- assert_equal(true, b.untrusted?)
- c = a.clone
- assert_equal(true, c.untrusted?)
-
- a = Object.new
- b = lambda {
- $SAFE = 4
- a.dup
- }.call
- assert_equal(true, b.untrusted?)
-
- a = Object.new
- b = lambda {
- $SAFE = 4
- a.clone
- }.call
- assert_equal(true, b.untrusted?)
end
def test_to_s
x = Object.new
x.taint
- x.untrust
s = x.to_s
- assert_equal(true, s.untrusted?)
assert_equal(true, s.tainted?)
+
+ x = eval(<<-EOS)
+ class ToS\u{3042}
+ new.to_s
+ end
+ EOS
+ assert_match(/\bToS\u{3042}:/, x)
end
- def test_exec_recursive
- Thread.current[:__recursive_key__] = nil
- a = [[]]
- a.inspect
+ def test_inspect
+ x = Object.new
+ assert_match(/\A#<Object:0x\h+>\z/, x.inspect)
- assert_nothing_raised do
- -> do
- $SAFE = 4
- begin
- a.hash
- rescue ArgumentError
- end
- end.call
+ x.instance_variable_set(:@ivar, :value)
+ assert_match(/\A#<Object:0x\h+ @ivar=:value>\z/, x.inspect)
+
+ x = Object.new
+ x.instance_variable_set(:@recur, x)
+ assert_match(/\A#<Object:0x\h+ @recur=#<Object:0x\h+ \.\.\.>>\z/, x.inspect)
+
+ x = Object.new
+ x.instance_variable_set(:@foo, "value")
+ x.instance_variable_set(:@bar, 42)
+ assert_match(/\A#<Object:0x\h+ (?:@foo="value", @bar=42|@bar=42, @foo="value")>\z/, x.inspect)
+
+ # #inspect does not call #to_s anymore
+ feature6130 = '[ruby-core:43238]'
+ x = Object.new
+ def x.to_s
+ "to_s"
end
+ assert_match(/\A#<Object:0x\h+>\z/, x.inspect, feature6130)
- -> do
- assert_nothing_raised do
- $SAFE = 4
- a.inspect
+ x = eval(<<-EOS)
+ class Inspect\u{3042}
+ new.inspect
end
- end.call
+ EOS
+ assert_match(/\bInspect\u{3042}:/, x)
- -> do
- o = Object.new
- def o.to_ary(x); end
- def o.==(x); $SAFE = 4; false; end
- a = [[o]]
- b = []
- b << b
-
- assert_nothing_raised do
- b == a
+ x = eval(<<-EOS)
+ class Inspect\u{3042}
+ def initialize
+ @\u{3044} = 42
+ end
+ new.inspect
end
- end.call
+ EOS
+ assert_match(/\bInspect\u{3042}:.* @\u{3044}=42\b/, x)
end
def test_singleton_class
@@ -684,4 +756,53 @@ class TestObject < Test::Unit::TestCase
:foo.singleton_class
end
end
+
+ def test_redef_method_missing
+ bug5473 = '[ruby-core:40287]'
+ ['ArgumentError.new("bug5473")', 'ArgumentError, "bug5473"', '"bug5473"'].each do |code|
+ out, err, status = EnvUtil.invoke_ruby([], <<-SRC, true, true)
+ class ::Object
+ def method_missing(m, *a, &b)
+ raise #{code}
+ end
+ end
+
+ p((1.foo rescue $!))
+ SRC
+ assert_send([status, :success?], bug5473)
+ assert_equal("", err, bug5473)
+ assert_equal((eval("raise #{code}") rescue $!.inspect), out.chomp, bug5473)
+ end
+ end
+
+ def assert_not_initialize_copy
+ a = yield
+ b = yield
+ assert_nothing_raised("copy") {a.instance_eval {initialize_copy(b)}}
+ c = a.dup.freeze
+ assert_raise(RuntimeError, "frozen") {c.instance_eval {initialize_copy(b)}}
+ d = a.dup.trust
+ [a, b, c, d]
+ end
+
+ def test_bad_initialize_copy
+ assert_not_initialize_copy {Object.new}
+ assert_not_initialize_copy {[].to_enum}
+ assert_not_initialize_copy {Enumerator::Generator.new {}}
+ assert_not_initialize_copy {Enumerator::Yielder.new {}}
+ assert_not_initialize_copy {File.stat(__FILE__)}
+ assert_not_initialize_copy {open(__FILE__)}.each(&:close)
+ assert_not_initialize_copy {ARGF.class.new}
+ assert_not_initialize_copy {Random.new}
+ assert_not_initialize_copy {//}
+ assert_not_initialize_copy {/.*/.match("foo")}
+ st = Struct.new(:foo)
+ assert_not_initialize_copy {st.new}
+ end
+
+ def test_type_error_message
+ issue = "Bug #7539"
+ assert_raise_with_message(TypeError, "can't convert Array into Integer") {Integer([42])}
+ assert_raise_with_message(TypeError, 'no implicit conversion of Array into Integer') {[].first([42])}
+ end
end
diff --git a/test/ruby/test_objectspace.rb b/test/ruby/test_objectspace.rb
index 24731a7a50..ce3c2aab9e 100644
--- a/test/ruby/test_objectspace.rb
+++ b/test/ruby/test_objectspace.rb
@@ -64,5 +64,38 @@ End
!b
END
assert_raise(ArgumentError) { ObjectSpace.define_finalizer([], Object.new) }
+
+ code = proc do |priv|
+ <<-"CODE"
+ fin = Object.new
+ class << fin
+ #{priv}def call(id)
+ puts "finalized"
+ end
+ end
+ ObjectSpace.define_finalizer([], fin)
+ CODE
+ end
+ assert_in_out_err([], code[""], ["finalized"])
+ assert_in_out_err([], code["private "], ["finalized"])
+ end
+
+ def test_each_object
+ assert_separately([], <<-End)
+ GC.disable
+ eval('begin; 1.times{}; rescue; ensure; end')
+ arys = []
+ ObjectSpace.each_object(Array){|ary|
+ arys << ary
+ }
+ GC.enable
+ arys.each{|ary|
+ begin
+ assert_equal(String, ary.inspect.class) # should not cause SEGV
+ rescue RuntimeError
+ # rescue "can't modify frozen File" error.
+ end
+ }
+ End
end
end
diff --git a/test/ruby/test_optimization.rb b/test/ruby/test_optimization.rb
index ed604e7bc3..a3b4aedcdc 100644
--- a/test/ruby/test_optimization.rb
+++ b/test/ruby/test_optimization.rb
@@ -85,6 +85,14 @@ class TestRubyOptimization < Test::Unit::TestCase
assert_equal 6, "string".length
end
+ def test_string_empty?
+ assert_equal true, "".empty?
+ assert_equal false, "string".empty?
+ assert_nil redefine_method('String', 'empty?') { "string".empty? }
+ assert_equal true, "".empty?
+ assert_equal false, "string".empty?
+ end
+
def test_string_plus
assert_equal "", "" + ""
assert_equal "x", "x" + ""
@@ -116,11 +124,21 @@ class TestRubyOptimization < Test::Unit::TestCase
assert_equal 3, [1,2,3].length
end
+ def test_array_empty?
+ assert_equal true, [].empty?
+ assert_equal false, [1,2,3].empty?
+ end
+
def test_hash_length
assert_equal 0, {}.length
assert_equal 1, {1=>1}.length
end
+ def test_hash_empty?
+ assert_equal true, {}.empty?
+ assert_equal false, {1=>1}.empty?
+ end
+
class MyObj
def ==(other)
true
@@ -160,4 +178,25 @@ class TestRubyOptimization < Test::Unit::TestCase
EOF
assert_equal(9131, Tailcall.new.fact(3000).to_s.size, bug4082)
end
+
+ def test_tailcall_with_block
+ bug6901 = '[ruby-dev:46065]'
+
+ option = {
+ tailcall_optimization: true,
+ trace_instruction: false,
+ }
+ iseq = RubyVM::InstructionSequence.new(<<-EOF, "Bug#6901", bug6901, nil, option).eval
+ def identity(val)
+ val
+ end
+
+ def delay
+ -> {
+ identity(yield)
+ }
+ end
+ EOF
+ assert_equal(123, delay { 123 }.call, bug6901)
+ end
end
diff --git a/test/ruby/test_pack.rb b/test/ruby/test_pack.rb
index c862215cb4..7848eb5e62 100644
--- a/test/ruby/test_pack.rb
+++ b/test/ruby/test_pack.rb
@@ -1,3 +1,4 @@
+# coding: US-ASCII
require 'test/unit'
class TestPack < Test::Unit::TestCase
@@ -280,6 +281,9 @@ class TestPack < Test::Unit::TestCase
assert_equal(["1"], "\x80".unpack("B1"))
assert_equal(["10"], "\x80".unpack("B2"))
assert_equal(["100"], "\x80".unpack("B3"))
+
+ assert_equal(Encoding::US_ASCII, "\xff\x00".unpack("b*")[0].encoding)
+ assert_equal(Encoding::US_ASCII, "\xff\x00".unpack("B*")[0].encoding)
end
def test_pack_unpack_hH
@@ -320,6 +324,9 @@ class TestPack < Test::Unit::TestCase
assert_equal(["10e"], "\x10\xef".unpack("H3"))
assert_equal(["10ef"], "\x10\xef".unpack("H4"))
assert_equal(["10ef"], "\x10\xef".unpack("H5"))
+
+ assert_equal(Encoding::US_ASCII, "\x10\xef".unpack("h*")[0].encoding)
+ assert_equal(Encoding::US_ASCII, "\x10\xef".unpack("H*")[0].encoding)
end
def test_pack_unpack_cC
@@ -396,8 +403,17 @@ class TestPack < Test::Unit::TestCase
assert_equal([578437695752307201, -506097522914230529], s2.unpack("q*"))
assert_equal([578437695752307201, 17940646550795321087], s1.unpack("Q*"))
+ # Note: q! and Q! should not work on platform which has no long long type.
+ # Is there a such platform now?
+ s1 = [578437695752307201, -506097522914230529].pack("q!*")
+ s2 = [578437695752307201, 17940646550795321087].pack("Q!*")
+ assert_equal([578437695752307201, -506097522914230529], s2.unpack("q!*"))
+ assert_equal([578437695752307201, 17940646550795321087], s1.unpack("Q!*"))
+
assert_equal(8, [1].pack("q").bytesize)
assert_equal(8, [1].pack("Q").bytesize)
+ assert_operator(8, :<=, [1].pack("q!").bytesize)
+ assert_operator(8, :<=, [1].pack("Q!").bytesize)
end
def test_pack_unpack_nN
@@ -496,6 +512,10 @@ class TestPack < Test::Unit::TestCase
assert_equal("M86%A86%A86%A86%A86%A86%A86%A86%A86%A86%A86%A86%A86%A86%A86%A\n!80``\n", ["a"*46].pack("u0"))
assert_equal("M86%A86%A86%A86%A86%A86%A86%A86%A86%A86%A86%A86%A86%A86%A86%A\n!80``\n", ["a"*46].pack("u1"))
assert_equal("M86%A86%A86%A86%A86%A86%A86%A86%A86%A86%A86%A86%A86%A86%A86%A\n!80``\n", ["a"*46].pack("u2"))
+ assert_equal(<<EXPECTED, ["a"*80].pack("u68"))
+_86%A86%A86%A86%A86%A86%A86%A86%A86%A86%A86%A86%A86%A86%A86%A86%A86%A86%A86%A86%A86%A
+186%A86%A86%A86%A86%A86$`
+EXPECTED
assert_equal([""], "".unpack("u"))
assert_equal(["a"], "!80``\n".unpack("u"))
@@ -525,6 +545,10 @@ class TestPack < Test::Unit::TestCase
assert_equal(["\377"], "/w==\n".unpack("m"))
assert_equal(["\377\377"], "//8=\n".unpack("m"))
assert_equal(["\377\377\377"], "////\n".unpack("m"))
+ assert_equal([""], "A\n".unpack("m"))
+ assert_equal(["\0"], "AA\n".unpack("m"))
+ assert_equal(["\0"], "AA=\n".unpack("m"))
+ assert_equal(["\0\0"], "AAA\n".unpack("m"))
end
def test_pack_unpack_m0
@@ -568,10 +592,18 @@ class TestPack < Test::Unit::TestCase
assert_equal(["a"*1023], (("a"*73+"=\n")*14+"a=\n").unpack("M"))
assert_equal(["\x0a"], "=0a=\n".unpack("M"))
assert_equal(["\x0a"], "=0A=\n".unpack("M"))
- assert_equal([""], "=0Z=\n".unpack("M"))
- assert_equal([""], "=\r\n".unpack("M"))
+ assert_equal(["=0Z=\n"], "=0Z=\n".unpack("M"))
assert_equal([""], "=\r\n".unpack("M"))
assert_equal(["\xC6\xF7"], "=C6=F7".unpack('M*'))
+
+ assert_equal(["pre123after"], "pre=31=32=33after".unpack("M"))
+ assert_equal(["preafter"], "pre=\nafter".unpack("M"))
+ assert_equal(["preafter"], "pre=\r\nafter".unpack("M"))
+ assert_equal(["pre="], "pre=".unpack("M"))
+ assert_equal(["pre=\r"], "pre=\r".unpack("M"))
+ assert_equal(["pre=hoge"], "pre=hoge".unpack("M"))
+ assert_equal(["pre==31after"], "pre==31after".unpack("M"))
+ assert_equal(["pre===31after"], "pre===31after".unpack("M"))
end
def test_pack_unpack_P2
@@ -612,28 +644,6 @@ class TestPack < Test::Unit::TestCase
assert_equal([0x100000000], "\220\200\200\200\000".unpack("w"), [0x100000000])
end
-
- def test_pack_unpack_M
- assert_equal(["pre123after"], "pre=31=32=33after".unpack("M"))
- assert_equal(["preafter"], "pre=\nafter".unpack("M"))
- assert_equal(["preafter"], "pre=\r\nafter".unpack("M"))
- assert_equal(["pre="], "pre=".unpack("M"))
- assert_equal(["pre=\r"], "pre=\r".unpack("M"))
- assert_equal(["pre=hoge"], "pre=hoge".unpack("M"))
- assert_equal(["pre==31after"], "pre==31after".unpack("M"))
- assert_equal(["pre===31after"], "pre===31after".unpack("M"))
- end
-
- def test_modify_under_safe4
- s = "foo"
- assert_raise(SecurityError) do
- Thread.new do
- $SAFE = 4
- s.clear
- end.join
- end
- end
-
def test_length_too_big
assert_raise(RangeError) { [].pack("C100000000000000000000") }
end
@@ -651,4 +661,43 @@ class TestPack < Test::Unit::TestCase
assert_nil("".unpack("i") {|x| result = x}, bug4059)
assert_equal(:ok, result)
end
+
+ def test_pack_garbage
+ verbose = $VERBOSE
+ $VERBOSE = false
+
+ assert_silent do
+ assert_equal "\000", [0].pack("*U")
+ end
+
+ $VERBOSE = true
+
+ _, err = capture_io do
+ assert_equal "\000", [0].pack("*U")
+ end
+
+ assert_match %r%unknown pack directive '\*' in '\*U'$%, err
+ ensure
+ $VERBOSE = verbose
+ end
+
+ def test_unpack_garbage
+ verbose = $VERBOSE
+ $VERBOSE = false
+
+ assert_silent do
+ assert_equal [0], "\000".unpack("*U")
+ end
+
+ $VERBOSE = true
+
+ _, err = capture_io do
+ assert_equal [0], "\000".unpack("*U")
+ end
+
+ assert_match %r%unknown unpack directive '\*' in '\*U'$%, err
+ ensure
+ $VERBOSE = verbose
+ end
+
end
diff --git a/test/ruby/test_parse.rb b/test/ruby/test_parse.rb
index 14990be12c..d4ab596782 100644
--- a/test/ruby/test_parse.rb
+++ b/test/ruby/test_parse.rb
@@ -1,3 +1,4 @@
+# coding: US-ASCII
require 'test/unit'
require 'stringio'
@@ -12,7 +13,7 @@ class TestParse < Test::Unit::TestCase
end
def test_else_without_rescue
- x = eval <<-END
+ x = eval <<-END, nil, __FILE__, __LINE__+1
begin
else
42
@@ -23,7 +24,7 @@ class TestParse < Test::Unit::TestCase
def test_alias_backref
assert_raise(SyntaxError) do
- eval <<-END
+ eval <<-END, nil, __FILE__, __LINE__+1
alias $foo $1
END
end
@@ -36,7 +37,7 @@ class TestParse < Test::Unit::TestCase
a = false
b = c = d = true
assert_nothing_raised do
- eval <<-END
+ eval <<-END, nil, __FILE__, __LINE__+1
a &&= t.foo 42
b &&= t.foo 42
c &&= t.foo nil
@@ -51,7 +52,7 @@ class TestParse < Test::Unit::TestCase
a = [nil, nil, true, true]
assert_nothing_raised do
- eval <<-END
+ eval <<-END, nil, __FILE__, __LINE__+1
a[0] ||= t.foo 42
a[1] &&= t.foo 42
a[2] ||= t.foo 42
@@ -67,7 +68,7 @@ class TestParse < Test::Unit::TestCase
o.foo = o.Foo = o::baz = nil
o.bar = o.Bar = o::qux = 1
assert_nothing_raised do
- eval <<-END
+ eval <<-END, nil, __FILE__, __LINE__+1
o.foo ||= t.foo 42
o.bar &&= t.foo 42
o.Foo ||= t.foo 42
@@ -81,7 +82,7 @@ class TestParse < Test::Unit::TestCase
assert_equal([42, 42], [o::baz, o::qux])
assert_raise(SyntaxError) do
- eval <<-END
+ eval <<-END, nil, __FILE__, __LINE__+1
$1 ||= t.foo 42
END
end
@@ -90,7 +91,7 @@ class TestParse < Test::Unit::TestCase
a = b = nil
assert_nothing_raised do
- eval <<-END
+ eval <<-END, nil, __FILE__, __LINE__+1
a = t.bar "foo" do
"bar"
end.gsub "ob", "OB"
@@ -104,7 +105,7 @@ class TestParse < Test::Unit::TestCase
a = nil
assert_nothing_raised do
- t.instance_eval <<-END
+ t.instance_eval <<-END, __FILE__, __LINE__+1
a = bar "foo" do "bar" end
END
end
@@ -112,7 +113,7 @@ class TestParse < Test::Unit::TestCase
a = nil
assert_nothing_raised do
- eval <<-END
+ eval <<-END, nil, __FILE__, __LINE__+1
a = t::bar "foo" do "bar" end
END
end
@@ -136,7 +137,7 @@ class TestParse < Test::Unit::TestCase
end
assert_nothing_raised do
- eval <<-END
+ eval <<-END, nil, __FILE__, __LINE__+1
c::foo, c::bar = 1, 2
c.Foo, c.Bar = 1, 2
c::FOO, c::BAR = 1, 2
@@ -149,7 +150,7 @@ class TestParse < Test::Unit::TestCase
def test_dynamic_constant_assignment
assert_raise(SyntaxError) do
- Object.new.instance_eval <<-END
+ Object.new.instance_eval <<-END, __FILE__, __LINE__+1
def foo
self::FOO, self::BAR = 1, 2
::FOO, ::BAR = 1, 2
@@ -158,13 +159,13 @@ class TestParse < Test::Unit::TestCase
end
assert_raise(SyntaxError) do
- eval <<-END
+ eval <<-END, nil, __FILE__, __LINE__+1
$1, $2 = 1, 2
END
end
assert_raise(SyntaxError) do
- Object.new.instance_eval <<-END
+ Object.new.instance_eval <<-END, __FILE__, __LINE__+1
def foo
::FOO = 1
end
@@ -172,16 +173,18 @@ class TestParse < Test::Unit::TestCase
end
c = Class.new
- assert_raise(SyntaxError) do
- eval <<-END
+ assert_nothing_raised(SyntaxError) do
+ eval <<-END, nil, __FILE__, __LINE__+1
+ if false
c::FOO &= 1
::FOO &= 1
+ end
END
end
c = Class.new
assert_raise(SyntaxError) do
- eval <<-END
+ eval <<-END, nil, __FILE__, __LINE__+1
$1 &= 1
END
end
@@ -189,13 +192,13 @@ class TestParse < Test::Unit::TestCase
def test_class_module
assert_raise(SyntaxError) do
- eval <<-END
+ eval <<-END, nil, __FILE__, __LINE__+1
class foo; end
END
end
assert_raise(SyntaxError) do
- eval <<-END
+ eval <<-END, nil, __FILE__, __LINE__+1
def foo
class Foo; end
module Bar; end
@@ -204,7 +207,7 @@ class TestParse < Test::Unit::TestCase
end
assert_raise(SyntaxError) do
- eval <<-END
+ eval <<-END, nil, __FILE__, __LINE__+1
class Foo Bar; end
END
end
@@ -217,7 +220,7 @@ class TestParse < Test::Unit::TestCase
a = nil
assert_nothing_raised do
- o.instance_eval <<-END
+ o.instance_eval <<-END, __FILE__, __LINE__+1
undef >, /
END
end
@@ -231,7 +234,7 @@ class TestParse < Test::Unit::TestCase
o.foo = o.Foo = o::baz = nil
o.bar = o.Bar = o::qux = 1
assert_nothing_raised do
- eval <<-END
+ eval <<-END, nil, __FILE__, __LINE__+1
o.foo ||= 42
o.bar &&= 42
o.Foo ||= 42
@@ -246,7 +249,7 @@ class TestParse < Test::Unit::TestCase
a = nil
assert_nothing_raised do
- eval <<-END
+ eval <<-END, nil, __FILE__, __LINE__+1
a = -2.0 ** 2
END
end
@@ -259,7 +262,7 @@ class TestParse < Test::Unit::TestCase
a = nil
assert_nothing_raised do
- eval <<-END
+ eval <<-END, nil, __FILE__, __LINE__+1
o.foo 1 do|; a| a = 42 end
END
end
@@ -268,25 +271,25 @@ class TestParse < Test::Unit::TestCase
def test_bad_arg
assert_raise(SyntaxError) do
- eval <<-END
+ eval <<-END, nil, __FILE__, __LINE__+1
def foo(FOO); end
END
end
assert_raise(SyntaxError) do
- eval <<-END
+ eval <<-END, nil, __FILE__, __LINE__+1
def foo(@foo); end
END
end
assert_raise(SyntaxError) do
- eval <<-END
+ eval <<-END, nil, __FILE__, __LINE__+1
def foo($foo); end
END
end
assert_raise(SyntaxError) do
- eval <<-END
+ eval <<-END, nil, __FILE__, __LINE__+1
def foo(@@foo); end
END
end
@@ -295,7 +298,7 @@ class TestParse < Test::Unit::TestCase
def o.foo(*r); yield(*r); end
assert_raise(SyntaxError) do
- eval <<-END
+ eval <<-END, nil, __FILE__, __LINE__+1
o.foo 1 {|; @a| @a = 42 }
END
end
@@ -304,7 +307,7 @@ class TestParse < Test::Unit::TestCase
def test_do_lambda
a = b = nil
assert_nothing_raised do
- eval <<-END
+ eval <<-END, nil, __FILE__, __LINE__+1
a = -> do
b = 42
end
@@ -320,7 +323,7 @@ class TestParse < Test::Unit::TestCase
a = b = nil
assert_nothing_raised do
- o.instance_eval <<-END
+ o.instance_eval <<-END, __FILE__, __LINE__+1
a = foo 1 do 42 end.to_s
b = foo 1 do 42 end::to_s
END
@@ -332,7 +335,7 @@ class TestParse < Test::Unit::TestCase
def test_call_method
a = b = nil
assert_nothing_raised do
- eval <<-END
+ eval <<-END, nil, __FILE__, __LINE__+1
a = proc {|x| x + "bar" }.("foo")
b = proc {|x| x + "bar" }::("foo")
END
@@ -358,6 +361,17 @@ class TestParse < Test::Unit::TestCase
assert_equal("foo 1 bar", "foo #$1 bar")
end
+ def test_dstr_disallowd_variable
+ bug8375 = '[ruby-core:54885] [Bug #8375]'
+ %w[@ @1 @@. @@ @@1 @@. $ $%].each do |src|
+ src = '#'+src+' '
+ str = assert_nothing_raised(SyntaxError, "#{bug8375} #{src.dump}") do
+ break eval('"'+src+'"')
+ end
+ assert_equal(src, str, bug8375)
+ end
+ end
+
def test_dsym
assert_nothing_raised { eval(':""') }
end
@@ -366,7 +380,7 @@ class TestParse < Test::Unit::TestCase
o = Object.new
assert_nothing_raised do
- eval <<-END
+ eval <<-END, nil, __FILE__, __LINE__+1
def o.foo(a=42,*r,z,&b); b.call(r.inject(a*1000+z*100, :+)); end
END
end
@@ -377,7 +391,7 @@ class TestParse < Test::Unit::TestCase
assert_raise(ArgumentError) { o.foo() }
assert_nothing_raised do
- eval <<-END
+ eval <<-END, nil, __FILE__, __LINE__+1
def o.foo(a=42,z,&b); b.call(a*1000+z*100); end
END
end
@@ -386,7 +400,7 @@ class TestParse < Test::Unit::TestCase
assert_raise(ArgumentError) { o.foo() }
assert_nothing_raised do
- eval <<-END
+ eval <<-END, nil, __FILE__, __LINE__+1
def o.foo(*r,z,&b); b.call(r.inject(z*100, :+)); end
END
end
@@ -398,19 +412,19 @@ class TestParse < Test::Unit::TestCase
def test_duplicate_argument
assert_raise(SyntaxError) do
- eval <<-END
+ eval <<-END, nil, __FILE__, __LINE__+1
1.times {|&b?| }
END
end
assert_raise(SyntaxError) do
- eval <<-END
+ eval <<-END, nil, __FILE__, __LINE__+1
1.times {|a, a|}
END
end
assert_raise(SyntaxError) do
- eval <<-END
+ eval <<-END, nil, __FILE__, __LINE__+1
def foo(a, a); end
END
end
@@ -418,7 +432,7 @@ class TestParse < Test::Unit::TestCase
def test_define_singleton_error
assert_raise(SyntaxError) do
- eval <<-END
+ eval <<-END, nil, __FILE__, __LINE__+1
def ("foo").foo; end
END
end
@@ -428,17 +442,17 @@ class TestParse < Test::Unit::TestCase
t = Object.new
assert_nothing_raised do
- eval <<-END
+ eval <<-END, nil, __FILE__, __LINE__+1
def t.`(x); "foo" + x + "bar"; end
END
end
a = b = nil
assert_nothing_raised do
- eval <<-END
+ eval <<-END, nil, __FILE__, __LINE__+1
a = t.` "zzz"
1.times {|;z| t.` ("zzz") }
END
- t.instance_eval <<-END
+ t.instance_eval <<-END, __FILE__, __LINE__+1
b = `zzz`
END
end
@@ -509,7 +523,7 @@ class TestParse < Test::Unit::TestCase
def test_parse_string
assert_raise(SyntaxError) do
- eval <<-END
+ eval <<-END, nil, __FILE__, __LINE__+1
/
END
end
@@ -524,13 +538,14 @@ class TestParse < Test::Unit::TestCase
)
end
- assert_raise(SyntaxError) do
- eval %q(
+ assert_nothing_raised(SyntaxError) do
+ x = eval %q(
<<FOO
#$
FOO
)
end
+ assert_equal "\#$\n", x
assert_raise(SyntaxError) do
eval %Q(
@@ -550,14 +565,15 @@ FOO
)
end
- assert_raise(SyntaxError) do
- eval %q(
+ assert_nothing_raised(SyntaxError) do
+ x = eval %q(
<<FOO
#$
foo
FOO
)
end
+ assert_equal "\#$\nfoo\n", x
assert_nothing_raised do
eval "x = <<""FOO\r\n1\r\nFOO"
@@ -568,7 +584,7 @@ FOO
def test_magic_comment
x = nil
assert_nothing_raised do
- eval <<-END
+ eval <<-END, nil, __FILE__, __LINE__+1
# coding = utf-8
x = __ENCODING__
END
@@ -576,7 +592,7 @@ x = __ENCODING__
assert_equal(Encoding.find("UTF-8"), x)
assert_raise(ArgumentError) do
- eval <<-END
+ eval <<-END, nil, __FILE__, __LINE__+1
# coding = foobarbazquxquux_dummy_enconding
x = __ENCODING__
END
@@ -595,7 +611,7 @@ x = __ENCODING__
def test_dot_in_next_line
x = nil
assert_nothing_raised do
- eval <<-END
+ eval <<-END, nil, __FILE__, __LINE__+1
x = 1
.to_s
END
@@ -611,7 +627,7 @@ x = __ENCODING__
def test_embedded_rd
assert_raise(SyntaxError) do
- eval <<-END
+ eval <<-END, nil, __FILE__, __LINE__+1
=begin
END
end
@@ -675,7 +691,7 @@ x = __ENCODING__
eval %q(__ENCODING__ = 1)
end
assert_raise(SyntaxError) do
- eval <<-END
+ eval <<-END, nil, __FILE__, __LINE__+1
def foo
FOO = 1
end
@@ -685,7 +701,7 @@ x = __ENCODING__
def test_block_dup
assert_raise(SyntaxError) do
- eval <<-END
+ eval <<-END, nil, __FILE__, __LINE__+1
foo(&proc{}) {}
END
end
@@ -693,7 +709,7 @@ x = __ENCODING__
def test_set_backref
assert_raise(SyntaxError) do
- eval <<-END
+ eval <<-END, nil, __FILE__, __LINE__+1
$& = 1
END
end
@@ -706,7 +722,7 @@ x = __ENCODING__
end
r = nil
assert_nothing_raised do
- eval <<-END
+ eval <<-END, nil, __FILE__, __LINE__+1
o[&proc{|x| r = x }] = 1
END
end
@@ -736,25 +752,19 @@ x = __ENCODING__
eval %q(1; next; 2)
end
- o = Object.new
- assert_nothing_raised do
- eval <<-END
- x = def o.foo; end
- END
- end
- assert_equal($stderr.string.lines.to_a.size, 14)
+ assert_equal(13, $stderr.string.lines.to_a.size)
$stderr = stderr
end
def test_assign_in_conditional
assert_raise(SyntaxError) do
- eval <<-END
+ eval <<-END, nil, __FILE__, __LINE__+1
(x, y = 1, 2) ? 1 : 2
END
end
assert_nothing_raised do
- eval <<-END
+ eval <<-END, nil, __FILE__, __LINE__+1
if @x = true
1
else
@@ -766,33 +776,33 @@ x = __ENCODING__
def test_literal_in_conditional
assert_nothing_raised do
- eval <<-END
+ eval <<-END, nil, __FILE__, __LINE__+1
"foo" ? 1 : 2
END
end
assert_nothing_raised do
x = "bar"
- eval <<-END
+ eval <<-END, nil, __FILE__, __LINE__+1
/foo#{x}baz/ ? 1 : 2
END
end
assert_nothing_raised do
- eval <<-END
+ eval <<-END, nil, __FILE__, __LINE__+1
(true..false) ? 1 : 2
END
end
assert_nothing_raised do
- eval <<-END
+ eval <<-END, nil, __FILE__, __LINE__+1
("foo".."bar") ? 1 : 2
END
end
assert_nothing_raised do
x = "bar"
- eval <<-END
+ eval <<-END, nil, __FILE__, __LINE__+1
:"foo#{"x"}baz" ? 1 : 2
END
end
@@ -800,7 +810,7 @@ x = __ENCODING__
def test_no_blockarg
assert_raise(SyntaxError) do
- eval <<-END
+ eval <<-END, nil, __FILE__, __LINE__+1
yield(&:+)
END
end
@@ -825,4 +835,18 @@ x = __ENCODING__
c.instance_eval { remove_class_variable(:@var) }
end
end
+
+ def test_method_block_location
+ bug5614 = '[ruby-core:40936]'
+ expected = nil
+ e = assert_raise(NoMethodError) do
+ 1.times do
+ expected = __LINE__+1
+ end.print do
+ #
+ end
+ end
+ actual = e.backtrace.first[/\A#{Regexp.quote(__FILE__)}:(\d+):/o, 1].to_i
+ assert_equal(expected, actual, bug5614)
+ end
end
diff --git a/test/ruby/test_proc.rb b/test/ruby/test_proc.rb
index 7560ce94ef..1bc360c9e8 100644
--- a/test/ruby/test_proc.rb
+++ b/test/ruby/test_proc.rb
@@ -36,9 +36,9 @@ class TestProc < Test::Unit::TestCase
}.call
assert(!defined?(iii)) # out of scope
- loop{iii=5; assert(eval("defined? iii")); break}
+ loop{iii=iii=5; assert(eval("defined? iii")); break}
loop {
- iii = 10
+ iii=iii = 10
def self.dyna_var_check
loop {
assert(!defined?(iii))
@@ -63,13 +63,39 @@ class TestProc < Test::Unit::TestCase
assert_equal(0, proc{}.arity)
assert_equal(0, proc{||}.arity)
assert_equal(1, proc{|x|}.arity)
+ assert_equal(0, proc{|x=1|}.arity)
assert_equal(2, proc{|x, y|}.arity)
+ assert_equal(1, proc{|x=0, y|}.arity)
+ assert_equal(0, proc{|x=0, y=0|}.arity)
+ assert_equal(1, proc{|x, y=0|}.arity)
assert_equal(-2, proc{|x, *y|}.arity)
+ assert_equal(-1, proc{|x=0, *y|}.arity)
assert_equal(-1, proc{|*x|}.arity)
assert_equal(-1, proc{|*|}.arity)
assert_equal(-3, proc{|x, *y, z|}.arity)
+ assert_equal(-2, proc{|x=0, *y, z|}.arity)
+ assert_equal(2, proc{|(x, y), z|[x,y]}.arity)
+ assert_equal(1, proc{|(x, y), z=0|[x,y]}.arity)
assert_equal(-4, proc{|x, *y, z, a|}.arity)
+ assert_equal(0, lambda{}.arity)
+ assert_equal(0, lambda{||}.arity)
+ assert_equal(1, lambda{|x|}.arity)
+ assert_equal(-1, lambda{|x=1|}.arity) # different from proc
+ assert_equal(2, lambda{|x, y|}.arity)
+ assert_equal(-2, lambda{|x=0, y|}.arity) # different from proc
+ assert_equal(-1, lambda{|x=0, y=0|}.arity) # different from proc
+ assert_equal(-2, lambda{|x, y=0|}.arity) # different from proc
+ assert_equal(-2, lambda{|x, *y|}.arity)
+ assert_equal(-1, lambda{|x=0, *y|}.arity)
+ assert_equal(-1, lambda{|*x|}.arity)
+ assert_equal(-1, lambda{|*|}.arity)
+ assert_equal(-3, lambda{|x, *y, z|}.arity)
+ assert_equal(-2, lambda{|x=0, *y, z|}.arity)
+ assert_equal(2, lambda{|(x, y), z|[x,y]}.arity)
+ assert_equal(-2, lambda{|(x, y), z=0|[x,y]}.arity)
+ assert_equal(-4, lambda{|x, *y, z, a|}.arity)
+
assert_arity(0) {}
assert_arity(0) {||}
assert_arity(1) {|x|}
@@ -275,6 +301,22 @@ class TestProc < Test::Unit::TestCase
end, 'moved from btest/knownbug, [ruby-core:15551]')
end
+ def test_curry_instance_exec
+ a = lambda { |x, y| [x + y, self] }
+ b = a.curry.call(1)
+ result = instance_exec 2, &b
+
+ assert_equal(3, result[0])
+ assert_equal(self, result[1])
+ end
+
+ def test_curry_optional_params
+ obj = Object.new
+ def obj.foo(a, b=42); end
+ assert_raise(ArgumentError) { obj.method(:foo).to_proc.curry(3) }
+ assert_raise(ArgumentError) { ->(a, b=42){}.curry(3) }
+ end
+
def test_dup_clone
b = proc {|x| x + "bar" }
class << b; attr_accessor :foo; end
@@ -305,7 +347,7 @@ class TestProc < Test::Unit::TestCase
assert_equal(:foo, bc.foo)
b = nil
- 1.times { x, y, z = 1, 2, 3; b = binding }
+ 1.times { x, y, z = 1, 2, 3; [x,y,z]; b = binding }
assert_equal([1, 2, 3], b.eval("[x, y, z]"))
end
@@ -344,19 +386,13 @@ class TestProc < Test::Unit::TestCase
t.kill
end
- def test_eq2
- b1 = proc { }
- b2 = b1.dup
- assert(b1 == b2)
- end
-
def test_to_proc
b = proc { :foo }
assert_equal(:foo, b.to_proc.call)
end
def test_localjump_error
- o = Object.new
+ o = o = Object.new
def foo; yield; end
exc = foo rescue $!
assert_nil(exc.exit_value)
@@ -422,7 +458,7 @@ class TestProc < Test::Unit::TestCase
assert_equal [[1,2,3]], r
end
- def test_proc_args_rest_and_post
+ def test_proc_args_pos_rest_post
pr = proc {|a,b,*c,d,e|
[a,b,c,d,e]
}
@@ -445,7 +481,30 @@ class TestProc < Test::Unit::TestCase
assert_equal [1, 2, [3, 4, 5], 6,7], pr.call([1,2,3,4,5,6,7])
end
- def test_proc_args_opt
+ def test_proc_args_rest_post
+ pr = proc {|*a,b,c|
+ [a,b,c]
+ }
+ assert_equal [[], nil, nil], pr.call()
+ assert_equal [[], 1, nil], pr.call(1)
+ assert_equal [[], 1, 2], pr.call(1,2)
+ assert_equal [[1], 2, 3], pr.call(1,2,3)
+ assert_equal [[1, 2], 3, 4], pr.call(1,2,3,4)
+ assert_equal [[1, 2, 3], 4, 5], pr.call(1,2,3,4,5)
+ assert_equal [[1, 2, 3, 4], 5, 6], pr.call(1,2,3,4,5,6)
+ assert_equal [[1, 2, 3, 4, 5], 6,7], pr.call(1,2,3,4,5,6,7)
+
+ assert_equal [[], nil, nil], pr.call([])
+ assert_equal [[], 1, nil], pr.call([1])
+ assert_equal [[], 1, 2], pr.call([1,2])
+ assert_equal [[1], 2, 3], pr.call([1,2,3])
+ assert_equal [[1, 2], 3, 4], pr.call([1,2,3,4])
+ assert_equal [[1, 2, 3], 4, 5], pr.call([1,2,3,4,5])
+ assert_equal [[1, 2, 3, 4], 5, 6], pr.call([1,2,3,4,5,6])
+ assert_equal [[1, 2, 3, 4, 5], 6,7], pr.call([1,2,3,4,5,6,7])
+ end
+
+ def test_proc_args_pos_opt
pr = proc {|a,b,c=:c|
[a,b,c]
}
@@ -466,7 +525,44 @@ class TestProc < Test::Unit::TestCase
assert_equal [1, 2, 3], pr.call([1,2,3,4,5,6])
end
- def test_proc_args_opt_and_post
+ def test_proc_args_opt
+ pr = proc {|a=:a,b=:b,c=:c|
+ [a,b,c]
+ }
+ assert_equal [:a, :b, :c], pr.call()
+ assert_equal [1, :b, :c], pr.call(1)
+ assert_equal [1, 2, :c], pr.call(1,2)
+ assert_equal [1, 2, 3], pr.call(1,2,3)
+ assert_equal [1, 2, 3], pr.call(1,2,3,4)
+ assert_equal [1, 2, 3], pr.call(1,2,3,4,5)
+ assert_equal [1, 2, 3], pr.call(1,2,3,4,5,6)
+
+ assert_equal [:a, :b, :c], pr.call([])
+ assert_equal [1, :b, :c], pr.call([1])
+ assert_equal [1, 2, :c], pr.call([1,2])
+ assert_equal [1, 2, 3], pr.call([1,2,3])
+ assert_equal [1, 2, 3], pr.call([1,2,3,4])
+ assert_equal [1, 2, 3], pr.call([1,2,3,4,5])
+ assert_equal [1, 2, 3], pr.call([1,2,3,4,5,6])
+ end
+
+ def test_proc_args_opt_signle
+ bug7621 = '[ruby-dev:46801]'
+ pr = proc {|a=:a|
+ a
+ }
+ assert_equal :a, pr.call()
+ assert_equal 1, pr.call(1)
+ assert_equal 1, pr.call(1,2)
+
+ assert_equal [], pr.call([]), bug7621
+ assert_equal [1], pr.call([1]), bug7621
+ assert_equal [1, 2], pr.call([1,2]), bug7621
+ assert_equal [1, 2, 3], pr.call([1,2,3]), bug7621
+ assert_equal [1, 2, 3, 4], pr.call([1,2,3,4]), bug7621
+ end
+
+ def test_proc_args_pos_opt_post
pr = proc {|a,b,c=:c,d,e|
[a,b,c,d,e]
}
@@ -487,7 +583,28 @@ class TestProc < Test::Unit::TestCase
assert_equal [1, 2, 3, 4, 5], pr.call([1,2,3,4,5,6])
end
- def test_proc_args_opt_and_rest
+ def test_proc_args_opt_post
+ pr = proc {|a=:a,b=:b,c=:c,d,e|
+ [a,b,c,d,e]
+ }
+ assert_equal [:a, :b, :c, nil, nil], pr.call()
+ assert_equal [:a, :b, :c, 1, nil], pr.call(1)
+ assert_equal [:a, :b, :c, 1, 2], pr.call(1,2)
+ assert_equal [1, :b, :c, 2, 3], pr.call(1,2,3)
+ assert_equal [1, 2, :c, 3, 4], pr.call(1,2,3,4)
+ assert_equal [1, 2, 3, 4, 5], pr.call(1,2,3,4,5)
+ assert_equal [1, 2, 3, 4, 5], pr.call(1,2,3,4,5,6)
+
+ assert_equal [:a, :b, :c, nil, nil], pr.call([])
+ assert_equal [:a, :b, :c, 1, nil], pr.call([1])
+ assert_equal [:a, :b, :c, 1, 2], pr.call([1,2])
+ assert_equal [1, :b, :c, 2, 3], pr.call([1,2,3])
+ assert_equal [1, 2, :c, 3, 4], pr.call([1,2,3,4])
+ assert_equal [1, 2, 3, 4, 5], pr.call([1,2,3,4,5])
+ assert_equal [1, 2, 3, 4, 5], pr.call([1,2,3,4,5,6])
+ end
+
+ def test_proc_args_pos_opt_rest
pr = proc {|a,b,c=:c,*d|
[a,b,c,d]
}
@@ -506,7 +623,26 @@ class TestProc < Test::Unit::TestCase
assert_equal [1, 2, 3, [4, 5]], pr.call([1,2,3,4,5])
end
- def test_proc_args_opt_and_rest_and_post
+ def test_proc_args_opt_rest
+ pr = proc {|a=:a,b=:b,c=:c,*d|
+ [a,b,c,d]
+ }
+ assert_equal [:a, :b, :c, []], pr.call()
+ assert_equal [1, :b, :c, []], pr.call(1)
+ assert_equal [1, 2, :c, []], pr.call(1,2)
+ assert_equal [1, 2, 3, []], pr.call(1,2,3)
+ assert_equal [1, 2, 3, [4]], pr.call(1,2,3,4)
+ assert_equal [1, 2, 3, [4, 5]], pr.call(1,2,3,4,5)
+
+ assert_equal [:a, :b, :c, []], pr.call([])
+ assert_equal [1, :b, :c, []], pr.call([1])
+ assert_equal [1, 2, :c, []], pr.call([1,2])
+ assert_equal [1, 2, 3, []], pr.call([1,2,3])
+ assert_equal [1, 2, 3, [4]], pr.call([1,2,3,4])
+ assert_equal [1, 2, 3, [4, 5]], pr.call([1,2,3,4,5])
+ end
+
+ def test_proc_args_pos_opt_rest_post
pr = proc {|a,b,c=:c,*d,e|
[a,b,c,d,e]
}
@@ -527,7 +663,28 @@ class TestProc < Test::Unit::TestCase
assert_equal [1, 2, 3, [4,5], 6], pr.call([1,2,3,4,5,6])
end
- def test_proc_args_block
+ def test_proc_args_opt_rest_post
+ pr = proc {|a=:a,b=:b,c=:c,*d,e|
+ [a,b,c,d,e]
+ }
+ assert_equal [:a, :b, :c, [], nil], pr.call()
+ assert_equal [:a, :b, :c, [], 1], pr.call(1)
+ assert_equal [1, :b, :c, [], 2], pr.call(1,2)
+ assert_equal [1, 2, :c, [], 3], pr.call(1,2,3)
+ assert_equal [1, 2, 3, [], 4], pr.call(1,2,3,4)
+ assert_equal [1, 2, 3, [4], 5], pr.call(1,2,3,4,5)
+ assert_equal [1, 2, 3, [4,5], 6], pr.call(1,2,3,4,5,6)
+
+ assert_equal [:a, :b, :c, [], nil], pr.call([])
+ assert_equal [:a, :b, :c, [], 1], pr.call([1])
+ assert_equal [1, :b, :c, [], 2], pr.call([1,2])
+ assert_equal [1, 2, :c, [], 3], pr.call([1,2,3])
+ assert_equal [1, 2, 3, [], 4], pr.call([1,2,3,4])
+ assert_equal [1, 2, 3, [4], 5], pr.call([1,2,3,4,5])
+ assert_equal [1, 2, 3, [4,5], 6], pr.call([1,2,3,4,5,6])
+ end
+
+ def test_proc_args_pos_block
pr = proc {|a,b,&c|
[a, b, c.class, c&&c.call(:x)]
}
@@ -537,6 +694,12 @@ class TestProc < Test::Unit::TestCase
assert_equal [1, 2, NilClass, nil], pr.call(1,2,3)
assert_equal [1, 2, NilClass, nil], pr.call(1,2,3,4)
+ assert_equal [nil, nil, NilClass, nil], pr.call([])
+ assert_equal [1, nil, NilClass, nil], pr.call([1])
+ assert_equal [1, 2, NilClass, nil], pr.call([1,2])
+ assert_equal [1, 2, NilClass, nil], pr.call([1,2,3])
+ assert_equal [1, 2, NilClass, nil], pr.call([1,2,3,4])
+
assert_equal [nil, nil, Proc, :proc], (pr.call(){ :proc })
assert_equal [1, nil, Proc, :proc], (pr.call(1){ :proc })
assert_equal [1, 2, Proc, :proc], (pr.call(1, 2){ :proc })
@@ -550,7 +713,7 @@ class TestProc < Test::Unit::TestCase
assert_equal [1, 2, Proc, :x], (pr.call(1, 2, 3, 4){|x| x})
end
- def test_proc_args_rest_and_block
+ def test_proc_args_pos_rest_block
pr = proc {|a,b,*c,&d|
[a, b, c, d.class, d&&d.call(:x)]
}
@@ -573,7 +736,24 @@ class TestProc < Test::Unit::TestCase
assert_equal [1, 2, [3,4], Proc, :x], (pr.call(1, 2, 3, 4){|x| x})
end
- def test_proc_args_rest_and_post_and_block
+ def test_proc_args_rest_block
+ pr = proc {|*c,&d|
+ [c, d.class, d&&d.call(:x)]
+ }
+ assert_equal [[], NilClass, nil], pr.call()
+ assert_equal [[1], NilClass, nil], pr.call(1)
+ assert_equal [[1, 2], NilClass, nil], pr.call(1,2)
+
+ assert_equal [[], Proc, :proc], (pr.call(){ :proc })
+ assert_equal [[1], Proc, :proc], (pr.call(1){ :proc })
+ assert_equal [[1, 2], Proc, :proc], (pr.call(1, 2){ :proc })
+
+ assert_equal [[], Proc, :x], (pr.call(){|x| x})
+ assert_equal [[1], Proc, :x], (pr.call(1){|x| x})
+ assert_equal [[1, 2], Proc, :x], (pr.call(1, 2){|x| x})
+ end
+
+ def test_proc_args_pos_rest_post_block
pr = proc {|a,b,*c,d,e,&f|
[a, b, c, d, e, f.class, f&&f.call(:x)]
}
@@ -602,7 +782,30 @@ class TestProc < Test::Unit::TestCase
assert_equal [1, 2, [3,4], 5, 6, Proc, :x], (pr.call(1, 2, 3, 4, 5, 6){|x| x})
end
- def test_proc_args_opt_and_block
+ def test_proc_args_rest_post_block
+ pr = proc {|*c,d,e,&f|
+ [c, d, e, f.class, f&&f.call(:x)]
+ }
+ assert_equal [[], nil, nil, NilClass, nil], pr.call()
+ assert_equal [[], 1, nil, NilClass, nil], pr.call(1)
+ assert_equal [[], 1, 2, NilClass, nil], pr.call(1,2)
+ assert_equal [[1], 2, 3, NilClass, nil], pr.call(1,2,3)
+ assert_equal [[1, 2], 3, 4, NilClass, nil], pr.call(1,2,3,4)
+
+ assert_equal [[], nil, nil, Proc, :proc], (pr.call(){ :proc })
+ assert_equal [[], 1, nil, Proc, :proc], (pr.call(1){ :proc })
+ assert_equal [[], 1, 2, Proc, :proc], (pr.call(1, 2){ :proc })
+ assert_equal [[1], 2, 3, Proc, :proc], (pr.call(1, 2, 3){ :proc })
+ assert_equal [[1, 2], 3, 4, Proc, :proc], (pr.call(1, 2, 3, 4){ :proc })
+
+ assert_equal [[], nil, nil, Proc, :x], (pr.call(){|x| x})
+ assert_equal [[], 1, nil, Proc, :x], (pr.call(1){|x| x})
+ assert_equal [[], 1, 2, Proc, :x], (pr.call(1, 2){|x| x})
+ assert_equal [[1], 2, 3, Proc, :x], (pr.call(1, 2, 3){|x| x})
+ assert_equal [[1, 2], 3, 4, Proc, :x], (pr.call(1, 2, 3, 4){|x| x})
+ end
+
+ def test_proc_args_pos_opt_block
pr = proc {|a,b,c=:c,d=:d,&e|
[a, b, c, d, e.class, e&&e.call(:x)]
}
@@ -628,7 +831,33 @@ class TestProc < Test::Unit::TestCase
assert_equal [1, 2, 3, 4, Proc, :x], (pr.call(1, 2, 3, 4, 5){|x| x})
end
- def test_proc_args_opt_and_post_and_block
+ def test_proc_args_opt_block
+ pr = proc {|a=:a,b=:b,c=:c,d=:d,&e|
+ [a, b, c, d, e.class, e&&e.call(:x)]
+ }
+ assert_equal [:a, :b, :c, :d, NilClass, nil], pr.call()
+ assert_equal [1, :b, :c, :d, NilClass, nil], pr.call(1)
+ assert_equal [1, 2, :c, :d, NilClass, nil], pr.call(1,2)
+ assert_equal [1, 2, 3, :d, NilClass, nil], pr.call(1,2,3)
+ assert_equal [1, 2, 3, 4, NilClass, nil], pr.call(1,2,3,4)
+ assert_equal [1, 2, 3, 4, NilClass, nil], pr.call(1,2,3,4,5)
+
+ assert_equal [:a, :b, :c, :d, Proc, :proc], (pr.call(){ :proc })
+ assert_equal [1, :b, :c, :d, Proc, :proc], (pr.call(1){ :proc })
+ assert_equal [1, 2, :c, :d, Proc, :proc], (pr.call(1, 2){ :proc })
+ assert_equal [1, 2, 3, :d, Proc, :proc], (pr.call(1, 2, 3){ :proc })
+ assert_equal [1, 2, 3, 4, Proc, :proc], (pr.call(1, 2, 3, 4){ :proc })
+ assert_equal [1, 2, 3, 4, Proc, :proc], (pr.call(1, 2, 3, 4, 5){ :proc })
+
+ assert_equal [:a, :b, :c, :d, Proc, :x], (pr.call(){|x| x})
+ assert_equal [1, :b, :c, :d, Proc, :x], (pr.call(1){|x| x})
+ assert_equal [1, 2, :c, :d, Proc, :x], (pr.call(1, 2){|x| x})
+ assert_equal [1, 2, 3, :d, Proc, :x], (pr.call(1, 2, 3){|x| x})
+ assert_equal [1, 2, 3, 4, Proc, :x], (pr.call(1, 2, 3, 4){|x| x})
+ assert_equal [1, 2, 3, 4, Proc, :x], (pr.call(1, 2, 3, 4, 5){|x| x})
+ end
+
+ def test_proc_args_pos_opt_post_block
pr = proc {|a,b,c=:c,d=:d,e,f,&g|
[a, b, c, d, e, f, g.class, g&&g.call(:x)]
}
@@ -660,7 +889,39 @@ class TestProc < Test::Unit::TestCase
assert_equal [1, 2, 3, 4, 5, 6, Proc, :x], (pr.call(1, 2, 3, 4, 5, 6, 7){|x| x})
end
- def test_proc_args_opt_and_block2
+ def test_proc_args_opt_post_block
+ pr = proc {|a=:a,b=:b,c=:c,d=:d,e,f,&g|
+ [a, b, c, d, e, f, g.class, g&&g.call(:x)]
+ }
+ assert_equal [:a, :b, :c, :d, nil, nil, NilClass, nil], pr.call()
+ assert_equal [:a, :b, :c, :d, 1, nil, NilClass, nil], pr.call(1)
+ assert_equal [:a, :b, :c, :d, 1, 2, NilClass, nil], pr.call(1,2)
+ assert_equal [1, :b, :c, :d, 2, 3, NilClass, nil], pr.call(1,2,3)
+ assert_equal [1, 2, :c, :d, 3, 4, NilClass, nil], pr.call(1,2,3,4)
+ assert_equal [1, 2, 3, :d, 4, 5, NilClass, nil], pr.call(1,2,3,4,5)
+ assert_equal [1, 2, 3, 4, 5, 6, NilClass, nil], pr.call(1,2,3,4,5,6)
+ assert_equal [1, 2, 3, 4, 5, 6, NilClass, nil], pr.call(1,2,3,4,5,6,7)
+
+ assert_equal [:a, :b, :c, :d, nil, nil, Proc, :proc], (pr.call(){ :proc })
+ assert_equal [:a, :b, :c, :d, 1, nil, Proc, :proc], (pr.call(1){ :proc })
+ assert_equal [:a, :b, :c, :d, 1, 2, Proc, :proc], (pr.call(1, 2){ :proc })
+ assert_equal [1, :b, :c, :d, 2, 3, Proc, :proc], (pr.call(1, 2, 3){ :proc })
+ assert_equal [1, 2, :c, :d, 3, 4, Proc, :proc], (pr.call(1, 2, 3, 4){ :proc })
+ assert_equal [1, 2, 3, :d, 4, 5, Proc, :proc], (pr.call(1, 2, 3, 4, 5){ :proc })
+ assert_equal [1, 2, 3, 4, 5, 6, Proc, :proc], (pr.call(1, 2, 3, 4, 5, 6){ :proc })
+ assert_equal [1, 2, 3, 4, 5, 6, Proc, :proc], (pr.call(1, 2, 3, 4, 5, 6, 7){ :proc })
+
+ assert_equal [:a, :b, :c, :d, nil, nil, Proc, :x], (pr.call(){|x| x})
+ assert_equal [:a, :b, :c, :d, 1, nil, Proc, :x], (pr.call(1){|x| x})
+ assert_equal [:a, :b, :c, :d, 1, 2, Proc, :x], (pr.call(1, 2){|x| x})
+ assert_equal [1, :b, :c, :d, 2, 3, Proc, :x], (pr.call(1, 2, 3){|x| x})
+ assert_equal [1, 2, :c, :d, 3, 4, Proc, :x], (pr.call(1, 2, 3, 4){|x| x})
+ assert_equal [1, 2, 3, :d, 4, 5, Proc, :x], (pr.call(1, 2, 3, 4, 5){|x| x})
+ assert_equal [1, 2, 3, 4, 5, 6, Proc, :x], (pr.call(1, 2, 3, 4, 5, 6){|x| x})
+ assert_equal [1, 2, 3, 4, 5, 6, Proc, :x], (pr.call(1, 2, 3, 4, 5, 6, 7){|x| x})
+ end
+
+ def test_proc_args_pos_opt_rest_block
pr = proc {|a,b,c=:c,d=:d,*e,&f|
[a, b, c, d, e, f.class, f&&f.call(:x)]
}
@@ -689,7 +950,36 @@ class TestProc < Test::Unit::TestCase
assert_equal [1, 2, 3, 4, [5,6], Proc, :x], (pr.call(1, 2, 3, 4, 5, 6){|x| x})
end
- def test_proc_args_opt_and_rest_and_post_and_block
+ def test_proc_args_opt_rest_block
+ pr = proc {|a=:a,b=:b,c=:c,d=:d,*e,&f|
+ [a, b, c, d, e, f.class, f&&f.call(:x)]
+ }
+ assert_equal [:a, :b, :c, :d, [], NilClass, nil], pr.call()
+ assert_equal [1, :b, :c, :d, [], NilClass, nil], pr.call(1)
+ assert_equal [1, 2, :c, :d, [], NilClass, nil], pr.call(1,2)
+ assert_equal [1, 2, 3, :d, [], NilClass, nil], pr.call(1,2,3)
+ assert_equal [1, 2, 3, 4, [], NilClass, nil], pr.call(1,2,3,4)
+ assert_equal [1, 2, 3, 4, [5], NilClass, nil], pr.call(1,2,3,4,5)
+ assert_equal [1, 2, 3, 4, [5,6], NilClass, nil], pr.call(1,2,3,4,5,6)
+
+ assert_equal [:a, :b, :c, :d, [], Proc, :proc], (pr.call(){ :proc })
+ assert_equal [1, :b, :c, :d, [], Proc, :proc], (pr.call(1){ :proc })
+ assert_equal [1, 2, :c, :d, [], Proc, :proc], (pr.call(1, 2){ :proc })
+ assert_equal [1, 2, 3, :d, [], Proc, :proc], (pr.call(1, 2, 3){ :proc })
+ assert_equal [1, 2, 3, 4, [], Proc, :proc], (pr.call(1, 2, 3, 4){ :proc })
+ assert_equal [1, 2, 3, 4, [5], Proc, :proc], (pr.call(1, 2, 3, 4, 5){ :proc })
+ assert_equal [1, 2, 3, 4, [5,6], Proc, :proc], (pr.call(1, 2, 3, 4, 5, 6){ :proc })
+
+ assert_equal [:a, :b, :c, :d, [], Proc, :x], (pr.call(){|x| x})
+ assert_equal [1, :b, :c, :d, [], Proc, :x], (pr.call(1){|x| x})
+ assert_equal [1, 2, :c, :d, [], Proc, :x], (pr.call(1, 2){|x| x})
+ assert_equal [1, 2, 3, :d, [], Proc, :x], (pr.call(1, 2, 3){|x| x})
+ assert_equal [1, 2, 3, 4, [], Proc, :x], (pr.call(1, 2, 3, 4){|x| x})
+ assert_equal [1, 2, 3, 4, [5], Proc, :x], (pr.call(1, 2, 3, 4, 5){|x| x})
+ assert_equal [1, 2, 3, 4, [5,6], Proc, :x], (pr.call(1, 2, 3, 4, 5, 6){|x| x})
+ end
+
+ def test_proc_args_pos_opt_rest_post_block
pr = proc {|a,b,c=:c,d=:d,*e,f,g,&h|
[a, b, c, d, e, f, g, h.class, h&&h.call(:x)]
}
@@ -724,7 +1014,42 @@ class TestProc < Test::Unit::TestCase
assert_equal [1, 2, 3, 4, [5,6], 7, 8, Proc, :x], (pr.call(1, 2, 3, 4, 5, 6, 7, 8){|x| x})
end
- def test_proc_args_unleashed
+ def test_proc_args_opt_rest_post_block
+ pr = proc {|a=:a,b=:b,c=:c,d=:d,*e,f,g,&h|
+ [a, b, c, d, e, f, g, h.class, h&&h.call(:x)]
+ }
+ assert_equal [:a, :b, :c, :d, [], nil, nil, NilClass, nil], pr.call()
+ assert_equal [:a, :b, :c, :d, [], 1, nil, NilClass, nil], pr.call(1)
+ assert_equal [:a, :b, :c, :d, [], 1, 2, NilClass, nil], pr.call(1,2)
+ assert_equal [1, :b, :c, :d, [], 2, 3, NilClass, nil], pr.call(1,2,3)
+ assert_equal [1, 2, :c, :d, [], 3, 4, NilClass, nil], pr.call(1,2,3,4)
+ assert_equal [1, 2, 3, :d, [], 4, 5, NilClass, nil], pr.call(1,2,3,4,5)
+ assert_equal [1, 2, 3, 4, [], 5, 6, NilClass, nil], pr.call(1,2,3,4,5,6)
+ assert_equal [1, 2, 3, 4, [5], 6, 7, NilClass, nil], pr.call(1,2,3,4,5,6,7)
+ assert_equal [1, 2, 3, 4, [5,6], 7, 8, NilClass, nil], pr.call(1,2,3,4,5,6,7,8)
+
+ assert_equal [:a, :b, :c, :d, [], nil, nil, Proc, :proc], (pr.call(){ :proc })
+ assert_equal [:a, :b, :c, :d, [], 1, nil, Proc, :proc], (pr.call(1){ :proc })
+ assert_equal [:a, :b, :c, :d, [], 1, 2, Proc, :proc], (pr.call(1, 2){ :proc })
+ assert_equal [1, :b, :c, :d, [], 2, 3, Proc, :proc], (pr.call(1, 2, 3){ :proc })
+ assert_equal [1, 2, :c, :d, [], 3, 4, Proc, :proc], (pr.call(1, 2, 3, 4){ :proc })
+ assert_equal [1, 2, 3, :d, [], 4, 5, Proc, :proc], (pr.call(1, 2, 3, 4, 5){ :proc })
+ assert_equal [1, 2, 3, 4, [], 5, 6, Proc, :proc], (pr.call(1, 2, 3, 4, 5, 6){ :proc })
+ assert_equal [1, 2, 3, 4, [5], 6, 7, Proc, :proc], (pr.call(1, 2, 3, 4, 5, 6, 7){ :proc })
+ assert_equal [1, 2, 3, 4, [5,6], 7, 8, Proc, :proc], (pr.call(1, 2, 3, 4, 5, 6, 7, 8){ :proc })
+
+ assert_equal [:a, :b, :c, :d, [], nil, nil, Proc, :x], (pr.call(){|x| x})
+ assert_equal [:a, :b, :c, :d, [], 1, nil, Proc, :x], (pr.call(1){|x| x})
+ assert_equal [:a, :b, :c, :d, [], 1, 2, Proc, :x], (pr.call(1, 2){|x| x})
+ assert_equal [1, :b, :c, :d, [], 2, 3, Proc, :x], (pr.call(1, 2, 3){|x| x})
+ assert_equal [1, 2, :c, :d, [], 3, 4, Proc, :x], (pr.call(1, 2, 3, 4){|x| x})
+ assert_equal [1, 2, 3, :d, [], 4, 5, Proc, :x], (pr.call(1, 2, 3, 4, 5){|x| x})
+ assert_equal [1, 2, 3, 4, [], 5, 6, Proc, :x], (pr.call(1, 2, 3, 4, 5, 6){|x| x})
+ assert_equal [1, 2, 3, 4, [5], 6, 7, Proc, :x], (pr.call(1, 2, 3, 4, 5, 6, 7){|x| x})
+ assert_equal [1, 2, 3, 4, [5,6], 7, 8, Proc, :x], (pr.call(1, 2, 3, 4, 5, 6, 7, 8){|x| x})
+ end
+
+ def test_proc_args_pos_unleashed
r = proc {|a,b=1,*c,d,e|
[a,b,c,d,e]
}.call(1,2,3,4,5)
@@ -743,7 +1068,7 @@ class TestProc < Test::Unit::TestCase
assert_equal([[:opt, :a], [:rest, :b], [:opt, :c]], proc {|a, *b, c|}.parameters)
assert_equal([[:opt, :a], [:rest, :b], [:opt, :c], [:block, :d]], proc {|a, *b, c, &d|}.parameters)
assert_equal([[:opt, :a], [:opt, :b], [:rest, :c], [:opt, :d], [:block, :e]], proc {|a, b=:b, *c, d, &e|}.parameters)
- assert_equal([[:opt, nil], [:block, :b]], proc {|(a), &b|}.parameters)
+ assert_equal([[:opt, nil], [:block, :b]], proc {|(a), &b|a}.parameters)
assert_equal([[:opt, :a], [:opt, :b], [:opt, :c], [:opt, :d], [:rest, :e], [:opt, :f], [:opt, :g], [:block, :h]], proc {|a,b,c=:c,d=:d,*e,f,g,&h|}.parameters)
assert_equal([[:req]], method(:putc).parameters)
@@ -760,7 +1085,7 @@ class TestProc < Test::Unit::TestCase
def pmo5(a, *b, c) end
def pmo6(a, *b, c, &d) end
def pmo7(a, b = :b, *c, d, &e) end
- def pma1((a), &b) end
+ def pma1((a), &b) a; end
def test_bound_parameters
@@ -826,6 +1151,20 @@ class TestProc < Test::Unit::TestCase
assert_equal(@@line_of_attr_accessor_source_location_test, lineno)
end
+ def block_source_location_test(*args, &block)
+ block.source_location
+ end
+
+ def test_block_source_location
+ exp_lineno = __LINE__ + 3
+ file, lineno = block_source_location_test(1,
+ 2,
+ 3) do
+ end
+ assert_match(/^#{ Regexp.quote(__FILE__) }$/, file)
+ assert_equal(exp_lineno, lineno)
+ end
+
def test_splat_without_respond_to
def (obj = Object.new).respond_to?(m,*); false end
[obj].each do |a, b|
@@ -834,7 +1173,7 @@ class TestProc < Test::Unit::TestCase
end
def test_curry_with_trace
- bug3751 = '[ruby-core:31871]'
+ # bug3751 = '[ruby-core:31871]'
set_trace_func(proc {})
test_curry
ensure
@@ -868,4 +1207,38 @@ class TestProc < Test::Unit::TestCase
bug8345 = '[ruby-core:54688] [Bug #8345]'
assert_normal_exit('def proc; end; ->{}.curry', bug8345)
end
+
+ def get_binding if: 1, case: 2, when: 3, begin: 4, end: 5
+ a = 0
+ binding
+ end
+
+ def test_local_variable_get
+ b = get_binding
+ assert_equal(0, b.local_variable_get(:a))
+ assert_raise(NameError){ b.local_variable_get(:b) }
+
+ # access keyword named local variables
+ assert_equal(1, b.local_variable_get(:if))
+ assert_equal(2, b.local_variable_get(:case))
+ assert_equal(3, b.local_variable_get(:when))
+ assert_equal(4, b.local_variable_get(:begin))
+ assert_equal(5, b.local_variable_get(:end))
+ end
+
+ def test_local_variable_set
+ b = get_binding
+ b.local_variable_set(:a, 10)
+ b.local_variable_set(:b, 20)
+ assert_equal(10, b.local_variable_get(:a))
+ assert_equal(20, b.local_variable_get(:b))
+ assert_equal(10, b.eval("a"))
+ assert_equal(20, b.eval("b"))
+ end
+
+ def test_local_variable_defined?
+ b = get_binding
+ assert_equal(true, b.local_variable_defined?(:a))
+ assert_equal(false, b.local_variable_defined?(:b))
+ end
end
diff --git a/test/ruby/test_process.rb b/test/ruby/test_process.rb
index d1e2e1984d..3edc089177 100644
--- a/test/ruby/test_process.rb
+++ b/test/ruby/test_process.rb
@@ -1,6 +1,5 @@
require 'test/unit'
-require 'tmpdir'
-require 'pathname'
+require 'tempfile'
require 'timeout'
require_relative 'envutil'
require 'rbconfig'
@@ -17,6 +16,9 @@ class TestProcess < Test::Unit::TestCase
end
def windows?
+ self.class.windows?
+ end
+ def self.windows?
return /mswin|mingw|bccwin/ =~ RUBY_PLATFORM
end
@@ -28,7 +30,7 @@ class TestProcess < Test::Unit::TestCase
def with_tmpchdir
Dir.mktmpdir {|d|
- d = Pathname.new(d).realpath.to_s
+ d = File.realpath(d)
Dir.chdir(d) {
yield d
}
@@ -235,6 +237,8 @@ class TestProcess < Test::Unit::TestCase
MANDATORY_ENVS << 'LD_PRELOAD'
when /mswin|mingw/
MANDATORY_ENVS.concat(%w[HOME USER TMPDIR])
+ when /darwin/
+ MANDATORY_ENVS.concat(ENV.keys.grep(/\A__CF_/))
end
if e = RbConfig::CONFIG['LIBPATHENV']
MANDATORY_ENVS << e
@@ -303,6 +307,78 @@ class TestProcess < Test::Unit::TestCase
end
end
+ def _test_execopts_env_popen(cmd)
+ message = cmd.inspect
+ IO.popen({"FOO"=>"BAR"}, cmd) {|io|
+ assert_equal('FOO=BAR', io.read[/^FOO=.*/], message)
+ }
+
+ old = ENV["hmm"]
+ begin
+ ENV["hmm"] = "fufu"
+ IO.popen(cmd) {|io| assert_match(/^hmm=fufu$/, io.read, message)}
+ IO.popen({"hmm"=>""}, cmd) {|io| assert_match(/^hmm=$/, io.read, message)}
+ IO.popen({"hmm"=>nil}, cmd) {|io| assert_not_match(/^hmm=/, io.read, message)}
+ ENV["hmm"] = ""
+ IO.popen(cmd) {|io| assert_match(/^hmm=$/, io.read, message)}
+ IO.popen({"hmm"=>""}, cmd) {|io| assert_match(/^hmm=$/, io.read, message)}
+ IO.popen({"hmm"=>nil}, cmd) {|io| assert_not_match(/^hmm=/, io.read, message)}
+ ENV["hmm"] = nil
+ IO.popen(cmd) {|io| assert_not_match(/^hmm=/, io.read, message)}
+ IO.popen({"hmm"=>""}, cmd) {|io| assert_match(/^hmm=$/, io.read, message)}
+ IO.popen({"hmm"=>nil}, cmd) {|io| assert_not_match(/^hmm=/, io.read, message)}
+ ensure
+ ENV["hmm"] = old
+ end
+ end
+
+ def test_execopts_env_popen_vector
+ _test_execopts_env_popen(ENVCOMMAND)
+ end
+
+ def test_execopts_env_popen_string
+ with_tmpchdir do |d|
+ open('test-script', 'w') do |f|
+ ENVCOMMAND.each_with_index do |cmd, i|
+ next if i.zero? or cmd == "-e"
+ f.puts cmd
+ end
+ end
+ _test_execopts_env_popen("#{RUBY} test-script")
+ end
+ end
+
+ def test_execopts_preserve_env_on_exec_failure
+ with_tmpchdir {|d|
+ write_file 's', <<-"End"
+ ENV["mgg"] = nil
+ prog = "./nonexistent"
+ begin
+ Process.exec({"mgg" => "mggoo"}, [prog, prog])
+ rescue Errno::ENOENT
+ end
+ open('out', 'w') {|f|
+ f.print ENV["mgg"].inspect
+ }
+ End
+ system(RUBY, 's')
+ assert_equal(nil.inspect, File.read('out'),
+ "[ruby-core:44093] [ruby-trunk - Bug #6249]")
+ }
+ end
+
+ def test_execopts_env_single_word
+ with_tmpchdir {|d|
+ open("test_execopts_env_single_word.rb", "w") {|f|
+ f.puts "print ENV['hgga']"
+ }
+ system({"hgga"=>"ugu"}, RUBY,
+ :in => 'test_execopts_env_single_word.rb',
+ :out => 'test_execopts_env_single_word.out')
+ assert_equal('ugu', File.read('test_execopts_env_single_word.out'))
+ }
+ end
+
def test_execopts_unsetenv_others
h = {}
MANDATORY_ENVS.each {|k| e = ENV[k] and h[k] = e}
@@ -327,6 +403,16 @@ class TestProcess < Test::Unit::TestCase
}
end
+ def test_execopts_open_chdir
+ with_tmpchdir {|d|
+ Dir.mkdir "foo"
+ system(*PWD, :chdir => "foo", :out => "open_chdir_test")
+ assert_file.exist?("open_chdir_test")
+ assert_file.not_exist?("foo/open_chdir_test")
+ assert_equal("#{d}/foo", File.read("open_chdir_test").chomp)
+ }
+ end
+
UMASK = [RUBY, '-e', 'printf "%04o\n", File.umask']
def test_execopts_umask
@@ -465,8 +551,8 @@ class TestProcess < Test::Unit::TestCase
h = {}
ios.length.times {|i| h[ios[i]] = ios[(i-1)%ios.length] }
h2 = h.invert
- rios = pipes.map {|r, w| r }
- wios = pipes.map {|r, w| w }
+ _rios = pipes.map {|r, w| r }
+ wios = pipes.map {|r, w| w }
child_wfds = wios.map {|w| h2[w].fileno }
pid = spawn(RUBY, "-e",
"[#{child_wfds.join(',')}].each {|fd| IO.new(fd, 'w').puts fd }", h)
@@ -481,8 +567,8 @@ class TestProcess < Test::Unit::TestCase
h = {}
ios.length.times {|i| h[ios[i]] = ios[(i+1)%ios.length] }
h2 = h.invert
- rios = pipes.map {|r, w| r }
- wios = pipes.map {|r, w| w }
+ _rios = pipes.map {|r, w| r }
+ wios = pipes.map {|r, w| w }
child_wfds = wios.map {|w| h2[w].fileno }
pid = spawn(RUBY, "-e",
"[#{child_wfds.join(',')}].each {|fd| IO.new(fd, 'w').puts fd }", h)
@@ -590,7 +676,6 @@ class TestProcess < Test::Unit::TestCase
end
def test_popen_fork
- return if /freebsd/ =~ RUBY_PLATFORM # this test freeze in FreeBSD
IO.popen("-") {|io|
if !io
puts "fooo"
@@ -604,7 +689,7 @@ class TestProcess < Test::Unit::TestCase
def test_fd_inheritance
skip "inheritance of fd other than stdin,stdout and stderr is not supported" if windows?
with_pipe {|r, w|
- system(RUBY, '-e', 'IO.new(ARGV[0].to_i, "w").puts(:ba)', w.fileno.to_s)
+ system(RUBY, '-e', 'IO.new(ARGV[0].to_i, "w").puts(:ba)', w.fileno.to_s, w=>w)
w.close
assert_equal("ba\n", r.read)
}
@@ -620,8 +705,9 @@ class TestProcess < Test::Unit::TestCase
write_file("s", <<-"End")
exec(#{RUBY.dump}, '-e',
'IO.new(ARGV[0].to_i, "w").puts("bu") rescue nil',
- #{w.fileno.to_s.dump})
+ #{w.fileno.to_s.dump}, :close_others=>false)
End
+ w.close_on_exec = false
Process.wait spawn(RUBY, "s", :close_others=>false)
w.close
assert_equal("bu\n", r.read)
@@ -661,6 +747,7 @@ class TestProcess < Test::Unit::TestCase
File.unlink("err")
}
with_pipe {|r, w|
+ w.close_on_exec = false
Process.wait spawn(RUBY, '-e', 'IO.new(ARGV[0].to_i, "w").puts("bi")', w.fileno.to_s, :close_others=>false)
w.close
assert_equal("bi\n", r.read)
@@ -687,6 +774,7 @@ class TestProcess < Test::Unit::TestCase
Process.wait
}
with_pipe {|r, w|
+ w.close_on_exec = false
io = IO.popen([RUBY, "-e", "STDERR.reopen(STDOUT); IO.new(#{w.fileno}, 'w').puts('mo')", :close_others=>false])
w.close
errmsg = io.read
@@ -695,6 +783,7 @@ class TestProcess < Test::Unit::TestCase
Process.wait
}
with_pipe {|r, w|
+ w.close_on_exec = false
io = IO.popen([RUBY, "-e", "STDERR.reopen(STDOUT); IO.new(#{w.fileno}, 'w').puts('mo')", :close_others=>nil])
w.close
errmsg = io.read
@@ -721,6 +810,18 @@ class TestProcess < Test::Unit::TestCase
end
end
+ def test_execopts_redirect_tempfile
+ bug6269 = '[ruby-core:44181]'
+ Tempfile.create("execopts") do |tmp|
+ pid = assert_nothing_raised(ArgumentError, bug6269) do
+ break spawn(RUBY, "-e", "print $$", out: tmp)
+ end
+ Process.wait(pid)
+ tmp.rewind
+ assert_equal(pid.to_s, tmp.read)
+ end
+ end
+
def test_execopts_duplex_io
IO.popen("#{RUBY} -e ''", "r+") {|duplex|
assert_raise(ArgumentError) { system("#{RUBY} -e ''", duplex=>STDOUT) }
@@ -826,6 +927,25 @@ class TestProcess < Test::Unit::TestCase
}
end
+ def test_popen_wordsplit_beginning_and_trailing_spaces
+ with_tmpchdir {|d|
+ write_file("script", <<-'End')
+ print "fufumm pid=#{$$} ppid=#{Process.ppid}"
+ exit 7
+ End
+ str = " #{RUBY} script "
+ io = IO.popen(str)
+ pid = io.pid
+ result = io.read
+ io.close
+ status = $?
+ assert_equal(pid, status.pid)
+ assert(status.exited?)
+ assert_equal(7, status.exitstatus)
+ assert_equal("fufumm pid=#{status.pid} ppid=#{$$}", result)
+ }
+ end
+
def test_exec_wordsplit
with_tmpchdir {|d|
write_file("script", <<-'End')
@@ -1070,6 +1190,7 @@ class TestProcess < Test::Unit::TestCase
pid = spawn(RUBY, "foo")
Thread.new { sleep 1; Process.kill(:SIGQUIT, pid) }
Process.wait(pid)
+ t = Time.now
s = $?
assert_equal([false, true, false],
[s.exited?, s.signaled?, s.stopped?],
@@ -1081,6 +1202,7 @@ class TestProcess < Test::Unit::TestCase
s.inspect])
assert_equal(false, s.exited?)
assert_equal(nil, s.success?)
+ EnvUtil.diagnostic_reports("QUIT", RUBY, pid, t)
end
end
@@ -1159,9 +1281,29 @@ class TestProcess < Test::Unit::TestCase
end
def test_geteuid
+ assert_kind_of(Integer, Process.euid)
+ end
+
+ def test_seteuid
+ assert_nothing_raised(TypeError) {Process.euid += 0}
+ rescue NotImplementedError
+ end
+
+ def test_seteuid_name
+ user = ENV["USER"] or return
+ assert_nothing_raised(TypeError) {Process.euid = user}
+ rescue NotImplementedError
+ end
+
+ def test_getegid
assert_kind_of(Integer, Process.egid)
end
+ def test_setegid
+ assert_nothing_raised(TypeError) {Process.egid += 0}
+ rescue NotImplementedError
+ end
+
def test_uid_re_exchangeable_p
r = Process::UID.re_exchangeable?
assert(true == r || false == r)
@@ -1214,13 +1356,13 @@ class TestProcess < Test::Unit::TestCase
Dir.chdir("vd") {
dir = "#{d}/vd"
# OpenSolaris cannot remove the current directory.
- system(RUBY, "--disable-gems", "-e", "Dir.chdir '..'; Dir.rmdir #{dir.dump}")
+ system(RUBY, "--disable-gems", "-e", "Dir.chdir '..'; Dir.rmdir #{dir.dump}", err: File::NULL)
system({"RUBYLIB"=>nil}, RUBY, "--disable-gems", "-e", "exit true")
status = $?
}
assert(status.success?, "[ruby-dev:38105]")
}
- end unless /mswin|bccwin|mingw/ =~ RUBY_PLATFORM
+ end
def test_fallback_to_sh
feature = '[ruby-core:32745]'
@@ -1233,22 +1375,48 @@ class TestProcess < Test::Unit::TestCase
open("tmp_script.#{$$}", "w") {|f| f.puts "echo $#: $@"; f.chmod(0755)}
result = IO.popen(["./tmp_script.#{$$}", "a b", "c"]) {|f| f.read}
assert_equal("2: a b c\n", result, feature)
+
+ open("tmp_script.#{$$}", "w") {|f| f.puts "echo $hghg"; f.chmod(0755)}
+ result = IO.popen([{"hghg" => "mogomogo"}, "./tmp_script.#{$$}", "a b", "c"]) {|f| f.read}
+ assert_equal("mogomogo\n", result, feature)
+
end
end if File.executable?("/bin/sh")
- def test_too_long_path
+ def test_spawn_too_long_path
bug4314 = '[ruby-core:34842]'
- exs = [Errno::ENOENT]
- exs << Errno::E2BIG if defined?(Errno::E2BIG)
- assert_raise(*exs, bug4314) {Process.spawn("a" * 10_000_000)}
+ assert_fail_too_long_path(%w"echo", bug4314)
end
- def test_too_long_path2
- skip
+ def test_aspawn_too_long_path
bug4315 = '[ruby-core:34833]'
+ assert_fail_too_long_path(%w"echo |", bug4315)
+ end
+
+ def assert_fail_too_long_path((cmd, sep), mesg)
+ sep ||= ""
+ min = 1_000 / (cmd.size + sep.size)
+ cmds = Array.new(min, cmd)
exs = [Errno::ENOENT]
exs << Errno::E2BIG if defined?(Errno::E2BIG)
- assert_raise(*exs, bug4315) {Process.spawn('"a"|'*10_000_000)}
+ EnvUtil.suppress_warning do
+ assert_raise(*exs, mesg) do
+ begin
+ loop do
+ Process.spawn(cmds.join(sep), [STDOUT, STDERR]=>File::NULL)
+ min = [cmds.size, min].max
+ cmds *= 100
+ end
+ rescue NoMemoryError
+ size = cmds.size
+ raise if min >= size - 1
+ min = [min, size /= 2].max
+ cmds[size..-1] = []
+ raise if size < 250
+ retry
+ end
+ end
+ end
end
def test_system_sigpipe
@@ -1308,7 +1476,16 @@ class TestProcess < Test::Unit::TestCase
assert_equal("ok?\n", data)
end
- if File.directory?("/proc/self/task")
+ def test_daemon_pid
+ cpid, dpid = IO.popen("-", "r+") do |f|
+ break f.pid, Integer(f.read) if f
+ Process.daemon(false, true)
+ puts $$
+ end
+ assert_not_equal(cpid, dpid)
+ end
+
+ if File.directory?("/proc/self/task") && /netbsd[a-z]*[1-6]/ !~ RUBY_PLATFORM
def test_daemon_no_threads
pid, data = IO.popen("-", "r+") do |f|
break f.pid, f.readlines if f
@@ -1319,9 +1496,28 @@ class TestProcess < Test::Unit::TestCase
assert_equal(2, data.size, bug4920)
assert_not_include(data.map(&:to_i), pid)
end
+ else # darwin
+ def test_daemon_no_threads
+ data = Timeout.timeout(3) do
+ IO.popen("-") do |f|
+ break f.readlines.map(&:chomp) if f
+ th = Thread.start {sleep 3}
+ Process.daemon(true, true)
+ puts Thread.list.size, th.status.inspect
+ end
+ end
+ assert_equal(["1", "false"], data)
+ end
end
end
+ def test_popen_cloexec
+ return unless defined? Fcntl::FD_CLOEXEC
+ IO.popen([RUBY, "-e", ""]) {|io|
+ assert(io.close_on_exec?)
+ }
+ end
+
def test_execopts_new_pgroup
return unless windows?
@@ -1330,4 +1526,304 @@ class TestProcess < Test::Unit::TestCase
assert_nothing_raised { spawn(*TRUECOMMAND, :new_pgroup=>true) }
assert_nothing_raised { IO.popen([*TRUECOMMAND, :new_pgroup=>true]) {} }
end
+
+ def test_execopts_uid
+ feature6975 = '[ruby-core:47414]'
+
+ [30000, [Process.uid, ENV["USER"]]].each do |uid, user|
+ if user
+ assert_nothing_raised(feature6975) do
+ begin
+ system(*TRUECOMMAND, uid: user)
+ rescue Errno::EPERM, NotImplementedError
+ end
+ end
+ end
+
+ assert_nothing_raised(feature6975) do
+ begin
+ system(*TRUECOMMAND, uid: uid)
+ rescue Errno::EPERM, NotImplementedError
+ end
+ end
+
+ assert_nothing_raised(feature6975) do
+ begin
+ u = IO.popen([RUBY, "-e", "print Process.uid", uid: user||uid], &:read)
+ assert_equal(uid.to_s, u, feature6975)
+ rescue Errno::EPERM, NotImplementedError
+ end
+ end
+ end
+ end
+
+ def test_execopts_gid
+ skip "Process.groups not implemented on Windows platform" if windows?
+ feature6975 = '[ruby-core:47414]'
+
+ [30000, *Process.groups.map {|g| g = Etc.getgrgid(g); [g.name, g.gid]}].each do |group, gid|
+ assert_nothing_raised(feature6975) do
+ begin
+ system(*TRUECOMMAND, gid: group)
+ rescue Errno::EPERM, NotImplementedError
+ end
+ end
+
+ gid = "#{gid || group}"
+ assert_nothing_raised(feature6975) do
+ begin
+ g = IO.popen([RUBY, "-e", "print Process.gid", gid: group], &:read)
+ assert_equal(gid, g, feature6975)
+ rescue Errno::EPERM, NotImplementedError
+ end
+ end
+ end
+ end
+
+ def test_sigpipe
+ system(RUBY, "-e", "")
+ with_pipe {|r, w|
+ r.close
+ assert_raise(Errno::EPIPE) { w.print "a" }
+ }
+ end
+
+ def test_sh_comment
+ IO.popen("echo a # fofoof") {|f|
+ assert_equal("a\n", f.read)
+ }
+ end if File.executable?("/bin/sh")
+
+ def test_sh_env
+ IO.popen("foofoo=barbar env") {|f|
+ lines = f.readlines
+ assert_operator(lines, :include?, "foofoo=barbar\n")
+ }
+ end if File.executable?("/bin/sh")
+
+ def test_sh_exec
+ IO.popen("exec echo exexexec") {|f|
+ assert_equal("exexexec\n", f.read)
+ }
+ end if File.executable?("/bin/sh")
+
+ def test_setsid
+ return unless Process.respond_to?(:setsid)
+ return unless Process.respond_to?(:getsid)
+ # OpenBSD doesn't allow Process::getsid(pid) when pid is in
+ # different session.
+ return if /openbsd/ =~ RUBY_PLATFORM
+
+ IO.popen([RUBY, "-e", <<EOS]) do|io|
+ Marshal.dump(Process.getsid, STDOUT)
+ newsid = Process.setsid
+ Marshal.dump(newsid, STDOUT)
+ STDOUT.flush
+ # getsid() on MacOS X return ESRCH when target process is zombie
+ # even if it is valid process id.
+ sleep
+EOS
+ begin
+ # test Process.getsid() w/o arg
+ assert_equal(Marshal.load(io), Process.getsid)
+
+ # test Process.setsid return value and Process::getsid(pid)
+ assert_equal(Marshal.load(io), Process.getsid(io.pid))
+ ensure
+ Process.kill(:KILL, io.pid) rescue nil
+ Process.wait(io.pid)
+ end
+ end
+ end
+
+ def test_spawn_nonascii
+ bug1771 = '[ruby-core:24309] [Bug #1771]'
+
+ with_tmpchdir do
+ [
+ "\u{7d05 7389}",
+ "zuf\u{00E4}llige_\u{017E}lu\u{0165}ou\u{010D}k\u{00FD}_\u{10D2 10D0 10DB 10D4 10DD 10E0 10D4 10D1}_\u{0440 0430 0437 043B 043E 0433 0430}_\u{548C 65B0 52A0 5761 4EE5 53CA 4E1C}",
+ "c\u{1EE7}a",
+ ].each do |name|
+ msg = "#{bug1771} #{name}"
+ exename = "./#{name}.exe"
+ FileUtils.cp(ENV["COMSPEC"], exename)
+ assert_equal(true, system("#{exename} /c exit"), msg)
+ system("#{exename} /c exit 12")
+ assert_equal(12, $?.exitstatus, msg)
+ _, status = Process.wait2(Process.spawn("#{exename} /c exit 42"))
+ assert_equal(42, status.exitstatus, msg)
+ assert_equal("ok\n", `#{exename} /c echo ok`, msg)
+ assert_equal("ok\n", IO.popen("#{exename} /c echo ok", &:read), msg)
+ assert_equal("ok\n", IO.popen(%W"#{exename} /c echo ok", &:read), msg)
+ File.binwrite("#{name}.txt", "ok")
+ assert_equal("ok", `type #{name}.txt`)
+ end
+ end
+ end if windows?
+
+ def test_clock_gettime
+ t1 = Process.clock_gettime(Process::CLOCK_REALTIME, :nanosecond)
+ t2 = Time.now; t2 = t2.tv_sec * 1000000000 + t2.tv_nsec
+ t3 = Process.clock_gettime(Process::CLOCK_REALTIME, :nanosecond)
+ assert_operator(t1, :<=, t2)
+ assert_operator(t2, :<=, t3)
+ assert_raise(Errno::EINVAL) { Process.clock_gettime(:foo) }
+ end
+
+ def test_clock_gettime_constants
+ Process.constants.grep(/\ACLOCK_/).each {|n|
+ c = Process.const_get(n)
+ begin
+ t = Process.clock_gettime(c)
+ rescue Errno::EINVAL
+ next
+ end
+ assert_kind_of(Float, t, "Process.clock_gettime(Process::#{n})")
+ }
+ end
+
+ def test_clock_gettime_GETTIMEOFDAY_BASED_CLOCK_REALTIME
+ n = :GETTIMEOFDAY_BASED_CLOCK_REALTIME
+ t = Process.clock_gettime(n)
+ assert_kind_of(Float, t, "Process.clock_gettime(:#{n})")
+ end
+
+ def test_clock_gettime_TIME_BASED_CLOCK_REALTIME
+ n = :TIME_BASED_CLOCK_REALTIME
+ t = Process.clock_gettime(n)
+ assert_kind_of(Float, t, "Process.clock_gettime(:#{n})")
+ end
+
+ def test_clock_gettime_TIMES_BASED_CLOCK_MONOTONIC
+ n = :TIMES_BASED_CLOCK_MONOTONIC
+ begin
+ t = Process.clock_gettime(n)
+ rescue Errno::EINVAL
+ return
+ end
+ assert_kind_of(Float, t, "Process.clock_gettime(:#{n})")
+ end
+
+ def test_clock_gettime_GETRUSAGE_BASED_CLOCK_PROCESS_CPUTIME_ID
+ n = :GETRUSAGE_BASED_CLOCK_PROCESS_CPUTIME_ID
+ begin
+ t = Process.clock_gettime(n)
+ rescue Errno::EINVAL
+ return
+ end
+ assert_kind_of(Float, t, "Process.clock_gettime(:#{n})")
+ end
+
+ def test_clock_gettime_TIMES_BASED_CLOCK_PROCESS_CPUTIME_ID
+ n = :TIMES_BASED_CLOCK_PROCESS_CPUTIME_ID
+ begin
+ t = Process.clock_gettime(n)
+ rescue Errno::EINVAL
+ return
+ end
+ assert_kind_of(Float, t, "Process.clock_gettime(:#{n})")
+ end
+
+ def test_clock_gettime_CLOCK_BASED_CLOCK_PROCESS_CPUTIME_ID
+ n = :CLOCK_BASED_CLOCK_PROCESS_CPUTIME_ID
+ t = Process.clock_gettime(n)
+ assert_kind_of(Float, t, "Process.clock_gettime(:#{n})")
+ end
+
+ def test_clock_gettime_MACH_ABSOLUTE_TIME_BASED_CLOCK_MONOTONIC
+ n = :MACH_ABSOLUTE_TIME_BASED_CLOCK_MONOTONIC
+ begin
+ t = Process.clock_gettime(n)
+ rescue Errno::EINVAL
+ return
+ end
+ assert_kind_of(Float, t, "Process.clock_gettime(:#{n})")
+ end
+
+ def test_clock_getres
+ r = Process.clock_getres(Process::CLOCK_REALTIME, :nanosecond)
+ assert_kind_of(Integer, r)
+ assert_raise(Errno::EINVAL) { Process.clock_getres(:foo) }
+ end
+
+ def test_clock_getres_constants
+ Process.constants.grep(/\ACLOCK_/).each {|n|
+ c = Process.const_get(n)
+ begin
+ t = Process.clock_getres(c)
+ rescue Errno::EINVAL
+ next
+ end
+ assert_kind_of(Float, t, "Process.clock_getres(Process::#{n})")
+ }
+ end
+
+ def test_clock_getres_GETTIMEOFDAY_BASED_CLOCK_REALTIME
+ n = :GETTIMEOFDAY_BASED_CLOCK_REALTIME
+ t = Process.clock_getres(n)
+ assert_kind_of(Float, t, "Process.clock_getres(:#{n})")
+ assert_equal(1000, Process.clock_getres(n, :nanosecond))
+ end
+
+ def test_clock_getres_TIME_BASED_CLOCK_REALTIME
+ n = :TIME_BASED_CLOCK_REALTIME
+ t = Process.clock_getres(n)
+ assert_kind_of(Float, t, "Process.clock_getres(:#{n})")
+ assert_equal(1000000000, Process.clock_getres(n, :nanosecond))
+ end
+
+ def test_clock_getres_TIMES_BASED_CLOCK_MONOTONIC
+ n = :TIMES_BASED_CLOCK_MONOTONIC
+ begin
+ t = Process.clock_getres(n)
+ rescue Errno::EINVAL
+ return
+ end
+ assert_kind_of(Float, t, "Process.clock_getres(:#{n})")
+ f = Process.clock_getres(n, :hertz)
+ assert_equal(0, f - f.floor)
+ end
+
+ def test_clock_getres_GETRUSAGE_BASED_CLOCK_PROCESS_CPUTIME_ID
+ n = :GETRUSAGE_BASED_CLOCK_PROCESS_CPUTIME_ID
+ begin
+ t = Process.clock_getres(n)
+ rescue Errno::EINVAL
+ return
+ end
+ assert_kind_of(Float, t, "Process.clock_getres(:#{n})")
+ assert_equal(1000, Process.clock_getres(n, :nanosecond))
+ end
+
+ def test_clock_getres_TIMES_BASED_CLOCK_PROCESS_CPUTIME_ID
+ n = :TIMES_BASED_CLOCK_PROCESS_CPUTIME_ID
+ begin
+ t = Process.clock_getres(n)
+ rescue Errno::EINVAL
+ return
+ end
+ assert_kind_of(Float, t, "Process.clock_getres(:#{n})")
+ f = Process.clock_getres(n, :hertz)
+ assert_equal(0, f - f.floor)
+ end
+
+ def test_clock_getres_CLOCK_BASED_CLOCK_PROCESS_CPUTIME_ID
+ n = :CLOCK_BASED_CLOCK_PROCESS_CPUTIME_ID
+ t = Process.clock_getres(n)
+ assert_kind_of(Float, t, "Process.clock_getres(:#{n})")
+ f = Process.clock_getres(n, :hertz)
+ assert_equal(0, f - f.floor)
+ end
+
+ def test_clock_getres_MACH_ABSOLUTE_TIME_BASED_CLOCK_MONOTONIC
+ n = :MACH_ABSOLUTE_TIME_BASED_CLOCK_MONOTONIC
+ begin
+ t = Process.clock_getres(n)
+ rescue Errno::EINVAL
+ return
+ end
+ assert_kind_of(Float, t, "Process.clock_getres(:#{n})")
+ end
+
end
diff --git a/test/ruby/test_rand.rb b/test/ruby/test_rand.rb
index c7139818de..a98eaab13c 100644
--- a/test/ruby/test_rand.rb
+++ b/test/ruby/test_rand.rb
@@ -1,4 +1,5 @@
require 'test/unit'
+require_relative 'envutil'
class TestRand < Test::Unit::TestCase
def assert_random_int(ws, m, init = 0)
@@ -170,12 +171,13 @@ class TestRand < Test::Unit::TestCase
def test_shuffle
srand(0)
- assert_equal([1,4,2,5,3], [1,2,3,4,5].shuffle)
- assert_equal([1,4,2,5,3], [1,2,3,4,5].shuffle(random: Random.new(0)))
+ result = [*1..5].shuffle
+ assert_equal([*1..5], result.sort)
+ assert_equal(result, [*1..5].shuffle(random: Random.new(0)))
end
def test_big_seed
- assert_random_int(%w(1143843490), 0x100000000, 2**1000000-1)
+ assert_random_int(%w(2757555016), 0x100000000, 2**1000000-1)
end
def test_random_gc
@@ -435,6 +437,7 @@ END
end
def test_rand_reseed_on_fork
+ GC.start
bug5661 = '[ruby-core:41209]'
assert_fork_status(1, bug5661) {Random.rand(4)}
@@ -481,7 +484,44 @@ END
def test_marshal
bug3656 = '[ruby-core:31622]'
assert_raise(TypeError, bug3656) {
- Random.new.marshal_load(0)
+ Random.new.__send__(:marshal_load, 0)
}
end
+
+ def test_initialize_frozen
+ r = Random.new(0)
+ r.freeze
+ assert_raise(RuntimeError, '[Bug #6540]') do
+ r.__send__(:initialize, r)
+ end
+ end
+
+ def test_marshal_load_frozen
+ r = Random.new(0)
+ d = r.__send__(:marshal_dump)
+ r.freeze
+ assert_raise(RuntimeError, '[Bug #6540]') do
+ r.__send__(:marshal_load, d)
+ end
+ end
+
+ def test_random_ulong_limited
+ def (gen = Object.new).rand(*) 1 end
+ assert_equal([2], (1..100).map {[1,2,3].sample(random: gen)}.uniq)
+
+ def (gen = Object.new).rand(*) 100 end
+ assert_raise_with_message(RangeError, /big 100\z/) {[1,2,3].sample(random: gen)}
+
+ bug7903 = '[ruby-dev:47061] [Bug #7903]'
+ def (gen = Object.new).rand(*) -1 end
+ assert_raise_with_message(RangeError, /small -1\z/, bug7903) {[1,2,3].sample(random: gen)}
+
+ bug7935 = '[ruby-core:52779] [Bug #7935]'
+ class << (gen = Object.new)
+ def rand(limit) @limit = limit; 0 end
+ attr_reader :limit
+ end
+ [1, 2].sample(1, random: gen)
+ assert_equal(2, gen.limit, bug7935)
+ end
end
diff --git a/test/ruby/test_range.rb b/test/ruby/test_range.rb
index 738c7cdb85..914baf9ecf 100644
--- a/test/ruby/test_range.rb
+++ b/test/ruby/test_range.rb
@@ -1,6 +1,8 @@
require 'test/unit'
require 'delegate'
require 'timeout'
+require 'bigdecimal'
+require_relative 'envutil'
class TestRange < Test::Unit::TestCase
def test_range_string
@@ -80,6 +82,7 @@ class TestRange < Test::Unit::TestCase
def test_initialize_twice
r = eval("1..2")
assert_raise(NameError) { r.instance_eval { initialize 3, 4 } }
+ assert_raise(NameError) { r.instance_eval { initialize_copy 3..4 } }
end
def test_uninitialized_range
@@ -248,6 +251,16 @@ class TestRange < Test::Unit::TestCase
def test_first_last
assert_equal([0, 1, 2], (0..10).first(3))
assert_equal([8, 9, 10], (0..10).last(3))
+ assert_equal(0, (0..10).first)
+ assert_equal(10, (0..10).last)
+ assert_equal("a", ("a".."c").first)
+ assert_equal("c", ("a".."c").last)
+ assert_equal(0, (2..0).last)
+
+ assert_equal([0, 1, 2], (0...10).first(3))
+ assert_equal([7, 8, 9], (0...10).last(3))
+ assert_equal(0, (0...10).first)
+ assert_equal("a", ("a"..."c").first)
end
def test_to_s
@@ -347,4 +360,202 @@ class TestRange < Test::Unit::TestCase
assert !x.eql?(z)
}
end
+
+ def test_size
+ assert_equal 42, (1..42).size
+ assert_equal 41, (1...42).size
+ assert_equal 6, (1...6.3).size
+ assert_equal 5, (1.1...6).size
+ assert_equal 42, (1..42).each.size
+ end
+
+ def test_bsearch_typechecks_return_values
+ assert_raise(TypeError) do
+ (1..42).bsearch{ "not ok" }
+ end
+ assert_equal (1..42).bsearch{}, (1..42).bsearch{false}
+ end
+
+ def test_bsearch_with_no_block
+ enum = (42...666).bsearch
+ assert_nil enum.size
+ assert_equal 200, enum.each{|x| x >= 200 }
+ end
+
+ def test_bsearch_for_other_numerics
+ assert_raise(TypeError) {
+ (Rational(-1,2)..Rational(9,4)).bsearch
+ }
+ assert_raise(TypeError) {
+ (BigDecimal('0.5')..BigDecimal('2.25')).bsearch
+ }
+ end
+
+ def test_bsearch_for_fixnum
+ ary = [3, 4, 7, 9, 12]
+ assert_equal(0, (0...ary.size).bsearch {|i| ary[i] >= 2 })
+ assert_equal(1, (0...ary.size).bsearch {|i| ary[i] >= 4 })
+ assert_equal(2, (0...ary.size).bsearch {|i| ary[i] >= 6 })
+ assert_equal(3, (0...ary.size).bsearch {|i| ary[i] >= 8 })
+ assert_equal(4, (0...ary.size).bsearch {|i| ary[i] >= 10 })
+ assert_equal(nil, (0...ary.size).bsearch {|i| ary[i] >= 100 })
+ assert_equal(0, (0...ary.size).bsearch {|i| true })
+ assert_equal(nil, (0...ary.size).bsearch {|i| false })
+
+ ary = [0, 100, 100, 100, 200]
+ assert_equal(1, (0...ary.size).bsearch {|i| ary[i] >= 100 })
+ end
+
+ def test_bsearch_for_float
+ inf = Float::INFINITY
+ assert_in_delta(10.0, (0.0...100.0).bsearch {|x| x > 0 && Math.log(x / 10) >= 0 }, 0.0001)
+ assert_in_delta(10.0, (0.0...inf).bsearch {|x| x > 0 && Math.log(x / 10) >= 0 }, 0.0001)
+ assert_in_delta(-10.0, (-inf..100.0).bsearch {|x| x >= 0 || Math.log(-x / 10) < 0 }, 0.0001)
+ assert_in_delta(10.0, (-inf..inf).bsearch {|x| x > 0 && Math.log(x / 10) >= 0 }, 0.0001)
+ assert_equal(nil, (-inf..5).bsearch {|x| x > 0 && Math.log(x / 10) >= 0 }, 0.0001)
+
+ assert_in_delta(10.0, (-inf.. 10).bsearch {|x| x > 0 && Math.log(x / 10) >= 0 }, 0.0001)
+ assert_equal(nil, (-inf...10).bsearch {|x| x > 0 && Math.log(x / 10) >= 0 }, 0.0001)
+
+ assert_equal(nil, (-inf..inf).bsearch { false })
+ assert_equal(-inf, (-inf..inf).bsearch { true })
+
+ assert_equal(inf, (0..inf).bsearch {|x| x == inf })
+ assert_equal(nil, (0...inf).bsearch {|x| x == inf })
+
+ v = (-inf..0).bsearch {|x| x != -inf }
+ assert_operator(-Float::MAX, :>=, v)
+ assert_operator(-inf, :<, v)
+
+ v = (0.0..1.0).bsearch {|x| x > 0 } # the nearest positive value to 0.0
+ assert_in_delta(0, v, 0.0001)
+ assert_operator(0, :<, v)
+ assert_equal(0.0, (-1.0..0.0).bsearch {|x| x >= 0 })
+ assert_equal(nil, (-1.0...0.0).bsearch {|x| x >= 0 })
+
+ v = (0..Float::MAX).bsearch {|x| x >= Float::MAX }
+ assert_in_delta(Float::MAX, v)
+ assert_equal(nil, v.infinite?)
+
+ v = (0..inf).bsearch {|x| x >= Float::MAX }
+ assert_in_delta(Float::MAX, v)
+ assert_equal(nil, v.infinite?)
+
+ v = (-Float::MAX..0).bsearch {|x| x > -Float::MAX }
+ assert_operator(-Float::MAX, :<, v)
+ assert_equal(nil, v.infinite?)
+
+ v = (-inf..0).bsearch {|x| x >= -Float::MAX }
+ assert_in_delta(-Float::MAX, v)
+ assert_equal(nil, v.infinite?)
+
+ v = (-inf..0).bsearch {|x| x > -Float::MAX }
+ assert_operator(-Float::MAX, :<, v)
+ assert_equal(nil, v.infinite?)
+
+ assert_in_delta(1.0, (0.0..inf).bsearch {|x| Math.log(x) >= 0 })
+ assert_in_delta(7.0, (0.0..10).bsearch {|x| 7.0 - x })
+ end
+
+ def check_bsearch_values(range, search)
+ from, to = range.begin, range.end
+ cmp = range.exclude_end? ? :< : :<=
+
+ # (0) trivial test
+ r = Range.new(to, from, range.exclude_end?).bsearch do |x|
+ fail "#{to}, #{from}, #{range.exclude_end?}, #{x}"
+ end
+ assert_equal nil, r
+
+ r = (to...to).bsearch do
+ fail
+ end
+ assert_equal nil, r
+
+ # prepare for others
+ yielded = []
+ r = range.bsearch do |val|
+ yielded << val
+ val >= search
+ end
+
+ # (1) log test
+ max = case from
+ when Float then 65
+ when Integer then Math.log(to-from+(range.exclude_end? ? 0 : 1), 2).to_i + 1
+ end
+ assert yielded.size <= max
+
+ # (2) coverage test
+ expect = if search < from
+ from
+ elsif search.send(cmp, to)
+ search
+ else
+ nil
+ end
+ assert_equal expect, r
+
+ # (3) uniqueness test
+ assert_equal nil, yielded.uniq!
+
+ # (4) end of range test
+ case
+ when range.exclude_end?
+ assert !yielded.include?(to)
+ assert r != to
+ when search >= to
+ assert yielded.include?(to)
+ assert_equal search == to ? to : nil, r
+ end
+
+ # start of range test
+ if search <= from
+ assert yielded.include?(from)
+ assert_equal from, r
+ end
+
+ # (5) out of range test
+ yielded.each do |val|
+ assert from <= val && val.send(cmp, to)
+ end
+ end
+
+ def test_range_bsearch_for_floats
+ ints = [-1 << 100, -123456789, -42, -1, 0, 1, 42, 123456789, 1 << 100]
+ floats = [-Float::INFINITY, -Float::MAX, -42.0, -4.2, -Float::EPSILON, -Float::MIN, 0.0, Float::MIN, Float::EPSILON, Math::PI, 4.2, 42.0, Float::MAX, Float::INFINITY]
+
+ [ints, floats].each do |values|
+ values.combination(2).to_a.product(values).each do |(from, to), search|
+ check_bsearch_values(from..to, search)
+ check_bsearch_values(from...to, search)
+ end
+ end
+ end
+
+ def test_bsearch_for_bignum
+ bignum = 2**100
+ ary = [3, 4, 7, 9, 12]
+ assert_equal(bignum + 0, (bignum...bignum+ary.size).bsearch {|i| ary[i - bignum] >= 2 })
+ assert_equal(bignum + 1, (bignum...bignum+ary.size).bsearch {|i| ary[i - bignum] >= 4 })
+ assert_equal(bignum + 2, (bignum...bignum+ary.size).bsearch {|i| ary[i - bignum] >= 6 })
+ assert_equal(bignum + 3, (bignum...bignum+ary.size).bsearch {|i| ary[i - bignum] >= 8 })
+ assert_equal(bignum + 4, (bignum...bignum+ary.size).bsearch {|i| ary[i - bignum] >= 10 })
+ assert_equal(nil, (bignum...bignum+ary.size).bsearch {|i| ary[i - bignum] >= 100 })
+ assert_equal(bignum + 0, (bignum...bignum+ary.size).bsearch {|i| true })
+ assert_equal(nil, (bignum...bignum+ary.size).bsearch {|i| false })
+
+ assert_raise(TypeError) { ("a".."z").bsearch {} }
+ end
+
+ def test_bsearch_with_mathn
+ assert_separately ['-r', 'mathn'], %q{
+ msg = '[ruby-core:25740]'
+ answer = (1..(1 << 100)).bsearch{|x|
+ assert_predicate(x, :integer?, msg)
+ x >= 42
+ }
+ assert_equal(42, answer, msg)
+ }
+ end
end
diff --git a/test/ruby/test_rational.rb b/test/ruby/test_rational.rb
index 70aab03c38..0496c0afe3 100644
--- a/test/ruby/test_rational.rb
+++ b/test/ruby/test_rational.rb
@@ -828,9 +828,19 @@ class Rational_Test < Test::Unit::TestCase
}
bug3656 = '[ruby-core:31622]'
- assert_raise(TypeError, bug3656) {
- Rational(1,2).marshal_load(0)
- }
+ c = Rational(1,2)
+ c.freeze
+ assert(c.frozen?)
+ result = c.marshal_load([2,3]) rescue :fail
+ assert_equal(:fail, result, bug3656)
+ end
+
+ def test_marshal_compatibility
+ bug6625 = '[ruby-core:45775]'
+ dump = "\x04\x08o:\x0dRational\x07:\x11@denominatori\x07:\x0f@numeratori\x06"
+ assert_nothing_raised(bug6625) do
+ assert_equal(Rational(1, 2), Marshal.load(dump), bug6625)
+ end
end
def test_parse
@@ -1133,6 +1143,26 @@ class Rational_Test < Test::Unit::TestCase
assert_equal(1.0, Rational(n + 2, n + 1).to_f, '[ruby-dev:33852]')
end
+ def test_power_of_1_and_minus_1
+ bug5715 = '[ruby-core:41498]'
+ big = 1 << 66
+ one = Rational( 1, 1)
+ assert_eql one, one ** -big , bug5715
+ assert_eql one, (-one) ** -big , bug5715
+ assert_eql -one, (-one) ** -(big+1) , bug5715
+ assert_equal Complex, ((-one) ** Rational(1,3)).class
+ end
+
+ def test_power_of_0
+ bug5713 = '[ruby-core:41494]'
+ big = 1 << 66
+ zero = Rational(0, 1)
+ assert_eql zero, zero ** big
+ assert_eql zero, zero ** Rational(2, 3)
+ assert_raise(ZeroDivisionError, bug5713) { Rational(0, 1) ** -big }
+ assert_raise(ZeroDivisionError, bug5713) { Rational(0, 1) ** Rational(-2,3) }
+ end
+
def test_known_bug
end
diff --git a/test/ruby/test_refinement.rb b/test/ruby/test_refinement.rb
new file mode 100644
index 0000000000..98dae15f00
--- /dev/null
+++ b/test/ruby/test_refinement.rb
@@ -0,0 +1,1115 @@
+require 'test/unit'
+require_relative 'envutil'
+
+# to supress warnings for future calls of Module#refine
+EnvUtil.suppress_warning do
+ Module.new {
+ refine(Object) {}
+ }
+end
+
+class TestRefinement < Test::Unit::TestCase
+ class Foo
+ def x
+ return "Foo#x"
+ end
+
+ def y
+ return "Foo#y"
+ end
+
+ def a
+ return "Foo#a"
+ end
+
+ def call_x
+ return x
+ end
+ end
+
+ module FooExt
+ refine Foo do
+ def x
+ return "FooExt#x"
+ end
+
+ def y
+ return "FooExt#y " + super
+ end
+
+ def z
+ return "FooExt#z"
+ end
+
+ def a
+ return "FooExt#a"
+ end
+ end
+ end
+
+ module FooExt2
+ refine Foo do
+ def x
+ return "FooExt2#x"
+ end
+
+ def y
+ return "FooExt2#y " + super
+ end
+
+ def z
+ return "FooExt2#z"
+ end
+ end
+ end
+
+ class FooSub < Foo
+ def x
+ return "FooSub#x"
+ end
+
+ def y
+ return "FooSub#y " + super
+ end
+ end
+
+ eval <<-EOF, TOPLEVEL_BINDING
+ using TestRefinement::FooExt
+
+ class TestRefinement::FooExtClient
+ def self.invoke_x_on(foo)
+ return foo.x
+ end
+
+ def self.invoke_y_on(foo)
+ return foo.y
+ end
+
+ def self.invoke_z_on(foo)
+ return foo.z
+ end
+
+ def self.send_z_on(foo)
+ return foo.send(:z)
+ end
+
+ def self.method_z(foo)
+ return foo.method(:z)
+ end
+
+ def self.invoke_call_x_on(foo)
+ return foo.call_x
+ end
+ end
+ EOF
+
+ eval <<-EOF, TOPLEVEL_BINDING
+ using TestRefinement::FooExt
+ using TestRefinement::FooExt2
+
+ class TestRefinement::FooExtClient2
+ def self.invoke_y_on(foo)
+ return foo.y
+ end
+
+ def self.invoke_a_on(foo)
+ return foo.a
+ end
+ end
+ EOF
+
+ def test_override
+ foo = Foo.new
+ assert_equal("Foo#x", foo.x)
+ assert_equal("FooExt#x", FooExtClient.invoke_x_on(foo))
+ assert_equal("Foo#x", foo.x)
+ end
+
+ def test_super
+ foo = Foo.new
+ assert_equal("Foo#y", foo.y)
+ assert_equal("FooExt#y Foo#y", FooExtClient.invoke_y_on(foo))
+ assert_equal("Foo#y", foo.y)
+ end
+
+ def test_super_not_chained
+ foo = Foo.new
+ assert_equal("Foo#y", foo.y)
+ assert_equal("FooExt2#y Foo#y", FooExtClient2.invoke_y_on(foo))
+ assert_equal("Foo#y", foo.y)
+ end
+
+ def test_using_same_class_refinements
+ foo = Foo.new
+ assert_equal("Foo#a", foo.a)
+ assert_equal("FooExt#a", FooExtClient2.invoke_a_on(foo))
+ assert_equal("Foo#a", foo.a)
+ end
+
+ def test_new_method
+ foo = Foo.new
+ assert_raise(NoMethodError) { foo.z }
+ assert_equal("FooExt#z", FooExtClient.invoke_z_on(foo))
+ assert_raise(NoMethodError) { foo.z }
+ end
+
+ module RespondTo
+ class Super
+ def foo
+ end
+ end
+
+ class Sub < Super
+ end
+
+ module M
+ refine Sub do
+ def foo
+ end
+ end
+ end
+ end
+
+ def test_send_should_not_use_refinements
+ foo = Foo.new
+ assert_raise(NoMethodError) { foo.send(:z) }
+ assert_raise(NoMethodError) { FooExtClient.send_z_on(foo) }
+ assert_raise(NoMethodError) { foo.send(:z) }
+
+ assert_equal(true, RespondTo::Sub.new.respond_to?(:foo))
+ end
+
+ def test_method_should_not_use_refinements
+ foo = Foo.new
+ assert_raise(NameError) { foo.method(:z) }
+ assert_raise(NameError) { FooExtClient.method_z(foo) }
+ assert_raise(NameError) { foo.method(:z) }
+ end
+
+ def test_no_local_rebinding
+ foo = Foo.new
+ assert_equal("Foo#x", foo.call_x)
+ assert_equal("Foo#x", FooExtClient.invoke_call_x_on(foo))
+ assert_equal("Foo#x", foo.call_x)
+ end
+
+ def test_subclass_is_prior
+ sub = FooSub.new
+ assert_equal("FooSub#x", sub.x)
+ assert_equal("FooSub#x", FooExtClient.invoke_x_on(sub))
+ assert_equal("FooSub#x", sub.x)
+ end
+
+ def test_super_in_subclass
+ sub = FooSub.new
+ assert_equal("FooSub#y Foo#y", sub.y)
+ # not "FooSub#y FooExt#y Foo#y"
+ assert_equal("FooSub#y Foo#y", FooExtClient.invoke_y_on(sub))
+ assert_equal("FooSub#y Foo#y", sub.y)
+ end
+
+ def test_new_method_on_subclass
+ sub = FooSub.new
+ assert_raise(NoMethodError) { sub.z }
+ assert_equal("FooExt#z", FooExtClient.invoke_z_on(sub))
+ assert_raise(NoMethodError) { sub.z }
+ end
+
+ def test_module_eval
+ foo = Foo.new
+ assert_equal("Foo#x", foo.x)
+ assert_equal("Foo#x", FooExt.module_eval { foo.x })
+ assert_equal("Foo#x", FooExt.module_eval("foo.x"))
+ assert_equal("Foo#x", foo.x)
+ end
+
+ def test_instance_eval_without_refinement
+ foo = Foo.new
+ ext_client = FooExtClient.new
+ assert_equal("Foo#x", foo.x)
+ assert_equal("Foo#x", ext_client.instance_eval { foo.x })
+ assert_equal("Foo#x", foo.x)
+ end
+
+ module FixnumSlashExt
+ refine Fixnum do
+ def /(other) quo(other) end
+ end
+ end
+
+ def test_override_builtin_method
+ assert_equal(0, 1 / 2)
+ assert_equal(Rational(1, 2), eval_using(FixnumSlashExt, "1 / 2"))
+ assert_equal(0, 1 / 2)
+ end
+
+ module FixnumPlusExt
+ refine Fixnum do
+ def self.method_added(*args); end
+ def +(other) "overriden" end
+ end
+ end
+
+ def test_override_builtin_method_with_method_added
+ assert_equal(3, 1 + 2)
+ assert_equal("overriden", eval_using(FixnumPlusExt, "1 + 2"))
+ assert_equal(3, 1 + 2)
+ end
+
+ def test_return_value_of_refine
+ mod = nil
+ result = nil
+ m = Module.new {
+ result = refine(Object) {
+ mod = self
+ }
+ }
+ assert_equal mod, result
+ end
+
+ module RefineSameClass
+ REFINEMENT1 = refine(Fixnum) {
+ def foo; return "foo" end
+ }
+ REFINEMENT2 = refine(Fixnum) {
+ def bar; return "bar" end
+ }
+ REFINEMENT3 = refine(String) {
+ def baz; return "baz" end
+ }
+ end
+
+ def test_refine_same_class_twice
+ assert_equal("foo", eval_using(RefineSameClass, "1.foo"))
+ assert_equal("bar", eval_using(RefineSameClass, "1.bar"))
+ assert_equal(RefineSameClass::REFINEMENT1, RefineSameClass::REFINEMENT2)
+ assert_not_equal(RefineSameClass::REFINEMENT1, RefineSameClass::REFINEMENT3)
+ end
+
+ module FixnumFooExt
+ refine Fixnum do
+ def foo; "foo"; end
+ end
+ end
+
+ def test_respond_to_should_not_use_refinements
+ assert_equal(false, 1.respond_to?(:foo))
+ assert_equal(false, eval_using(FixnumFooExt, "1.respond_to?(:foo)"))
+ end
+
+ module StringCmpExt
+ refine String do
+ def <=>(other) return 0 end
+ end
+ end
+
+ module ArrayEachExt
+ refine Array do
+ def each
+ super do |i|
+ yield 2 * i
+ end
+ end
+ end
+ end
+
+ def test_builtin_method_no_local_rebinding
+ assert_equal(false, eval_using(StringCmpExt, '"1" >= "2"'))
+ assert_equal(1, eval_using(ArrayEachExt, "[1, 2, 3].min"))
+ end
+
+ module RefinePrependedClass
+ module M1
+ def foo
+ super << :m1
+ end
+ end
+
+ class C
+ prepend M1
+
+ def foo
+ [:c]
+ end
+ end
+
+ module M2
+ refine C do
+ def foo
+ super << :m2
+ end
+ end
+ end
+ end
+
+ def test_refine_prepended_class
+ x = eval_using(RefinePrependedClass::M2,
+ "TestRefinement::RefinePrependedClass::C.new.foo")
+ assert_equal([:c, :m1, :m2], x)
+ end
+
+ def test_refine_module
+ m1 = Module.new
+ assert_raise(TypeError) do
+ Module.new {
+ refine m1 do
+ def foo
+ :m2
+ end
+ end
+ }
+ end
+ end
+
+ def test_refine_neither_class_nor_module
+ assert_raise(TypeError) do
+ Module.new {
+ refine Object.new do
+ end
+ }
+ end
+ assert_raise(TypeError) do
+ Module.new {
+ refine 123 do
+ end
+ }
+ end
+ assert_raise(TypeError) do
+ Module.new {
+ refine "foo" do
+ end
+ }
+ end
+ end
+
+ def test_refine_in_class
+ assert_raise(NoMethodError) do
+ Class.new {
+ refine Fixnum do
+ def foo
+ "c"
+ end
+ end
+ }
+ end
+ end
+
+ def test_main_using
+ assert_in_out_err([], <<-INPUT, %w(:C :M), [])
+ class C
+ def foo
+ :C
+ end
+ end
+
+ module M
+ refine C do
+ def foo
+ :M
+ end
+ end
+ end
+
+ c = C.new
+ p c.foo
+ using M
+ p c.foo
+ INPUT
+ end
+
+ def test_main_using_is_private
+ assert_raise(NoMethodError) do
+ eval("self.using Module.new", TOPLEVEL_BINDING)
+ end
+ end
+
+ def test_no_kernel_using
+ assert_raise(NoMethodError) do
+ using Module.new
+ end
+ end
+
+ class UsingClass
+ end
+
+ def test_module_using_class
+ c = Class.new
+ assert_raise(TypeError) do
+ eval("using TestRefinement::UsingClass", TOPLEVEL_BINDING)
+ end
+ end
+
+ def test_refine_without_block
+ c1 = Class.new
+ assert_raise_with_message(ArgumentError, "no block given") {
+ Module.new do
+ refine c1
+ end
+ }
+ end
+
+ module Inspect
+ module M
+ Fixnum = refine(Fixnum) {}
+ end
+ end
+
+ def test_inspect
+ assert_equal("#<refinement:Fixnum@TestRefinement::Inspect::M>",
+ Inspect::M::Fixnum.inspect)
+ end
+
+ def test_using_method_cache
+ assert_in_out_err([], <<-INPUT, %w(:M1 :M2), [])
+ class C
+ def foo
+ "original"
+ end
+ end
+
+ module M1
+ refine C do
+ def foo
+ :M1
+ end
+ end
+ end
+
+ module M2
+ refine C do
+ def foo
+ :M2
+ end
+ end
+ end
+
+ c = C.new
+ using M1
+ p c.foo
+ using M2
+ p c.foo
+ INPUT
+ end
+
+ module RedefineRefinedMethod
+ class C
+ def foo
+ "original"
+ end
+ end
+
+ module M
+ refine C do
+ def foo
+ "refined"
+ end
+ end
+ end
+
+ class C
+ def foo
+ "redefined"
+ end
+ end
+ end
+
+ def test_redefine_refined_method
+ x = eval_using(RedefineRefinedMethod::M,
+ "TestRefinement::RedefineRefinedMethod::C.new.foo")
+ assert_equal("refined", x)
+ end
+
+ module StringExt
+ refine String do
+ def foo
+ "foo"
+ end
+ end
+ end
+
+ module RefineScoping
+ refine String do
+ def foo
+ "foo"
+ end
+
+ def RefineScoping.call_in_refine_block
+ "".foo
+ end
+ end
+
+ def self.call_outside_refine_block
+ "".foo
+ end
+ end
+
+ def test_refine_scoping
+ assert_equal("foo", RefineScoping.call_in_refine_block)
+ assert_raise(NoMethodError) do
+ RefineScoping.call_outside_refine_block
+ end
+ end
+
+ module StringRecursiveLength
+ refine String do
+ def recursive_length
+ if empty?
+ 0
+ else
+ self[1..-1].recursive_length + 1
+ end
+ end
+ end
+ end
+
+ def test_refine_recursion
+ x = eval_using(StringRecursiveLength, "'foo'.recursive_length")
+ assert_equal(3, x)
+ end
+
+ module ToJSON
+ refine Integer do
+ def to_json; to_s; end
+ end
+
+ refine Array do
+ def to_json; "[" + map { |i| i.to_json }.join(",") + "]" end
+ end
+
+ refine Hash do
+ def to_json; "{" + map { |k, v| k.to_s.dump + ":" + v.to_json }.join(",") + "}" end
+ end
+ end
+
+ def test_refine_mutual_recursion
+ x = eval_using(ToJSON, "[{1=>2}, {3=>4}].to_json")
+ assert_equal('[{"1":2},{"3":4}]', x)
+ end
+
+ def test_refine_with_proc
+ assert_raise(ArgumentError) do
+ Module.new {
+ refine(String, &Proc.new {})
+ }
+ end
+ end
+
+ def test_using_in_module
+ assert_raise(RuntimeError) do
+ eval(<<-EOF, TOPLEVEL_BINDING)
+ $main = self
+ module M
+ end
+ module M2
+ $main.send(:using, M)
+ end
+ EOF
+ end
+ end
+
+ def test_using_in_method
+ assert_raise(RuntimeError) do
+ eval(<<-EOF, TOPLEVEL_BINDING)
+ $main = self
+ module M
+ end
+ def call_using_in_method
+ $main.send(:using, M)
+ end
+ call_using_in_method
+ EOF
+ end
+ end
+
+ module IncludeIntoRefinement
+ class C
+ def bar
+ return "C#bar"
+ end
+
+ def baz
+ return "C#baz"
+ end
+ end
+
+ module Mixin
+ def foo
+ return "Mixin#foo"
+ end
+
+ def bar
+ return super << " Mixin#bar"
+ end
+
+ def baz
+ return super << " Mixin#baz"
+ end
+ end
+
+ module M
+ refine C do
+ include Mixin
+
+ def baz
+ return super << " M#baz"
+ end
+ end
+ end
+ end
+
+ eval <<-EOF, TOPLEVEL_BINDING
+ using TestRefinement::IncludeIntoRefinement::M
+
+ module TestRefinement::IncludeIntoRefinement::User
+ def self.invoke_foo_on(x)
+ x.foo
+ end
+
+ def self.invoke_bar_on(x)
+ x.bar
+ end
+
+ def self.invoke_baz_on(x)
+ x.baz
+ end
+ end
+ EOF
+
+ def test_include_into_refinement
+ x = IncludeIntoRefinement::C.new
+ assert_equal("Mixin#foo", IncludeIntoRefinement::User.invoke_foo_on(x))
+ assert_equal("C#bar Mixin#bar",
+ IncludeIntoRefinement::User.invoke_bar_on(x))
+ assert_equal("C#baz Mixin#baz M#baz",
+ IncludeIntoRefinement::User.invoke_baz_on(x))
+ end
+
+ module PrependIntoRefinement
+ class C
+ def bar
+ return "C#bar"
+ end
+
+ def baz
+ return "C#baz"
+ end
+ end
+
+ module Mixin
+ def foo
+ return "Mixin#foo"
+ end
+
+ def bar
+ return super << " Mixin#bar"
+ end
+
+ def baz
+ return super << " Mixin#baz"
+ end
+ end
+
+ module M
+ refine C do
+ prepend Mixin
+
+ def baz
+ return super << " M#baz"
+ end
+ end
+ end
+ end
+
+ eval <<-EOF, TOPLEVEL_BINDING
+ using TestRefinement::PrependIntoRefinement::M
+
+ module TestRefinement::PrependIntoRefinement::User
+ def self.invoke_foo_on(x)
+ x.foo
+ end
+
+ def self.invoke_bar_on(x)
+ x.bar
+ end
+
+ def self.invoke_baz_on(x)
+ x.baz
+ end
+ end
+ EOF
+
+ def test_prepend_into_refinement
+ x = PrependIntoRefinement::C.new
+ assert_equal("Mixin#foo", PrependIntoRefinement::User.invoke_foo_on(x))
+ assert_equal("C#bar Mixin#bar",
+ PrependIntoRefinement::User.invoke_bar_on(x))
+ assert_equal("C#baz M#baz Mixin#baz",
+ PrependIntoRefinement::User.invoke_baz_on(x))
+ end
+
+ module PrependAfterRefine
+ class C
+ def foo
+ "original"
+ end
+ end
+
+ module M
+ refine C do
+ def foo
+ "refined"
+ end
+
+ def bar
+ "refined"
+ end
+ end
+ end
+
+ module Mixin
+ def foo
+ "mixin"
+ end
+
+ def bar
+ "mixin"
+ end
+ end
+
+ class C
+ prepend Mixin
+ end
+ end
+
+ def test_prepend_after_refine
+ x = eval_using(PrependAfterRefine::M,
+ "TestRefinement::PrependAfterRefine::C.new.foo")
+ assert_equal("refined", x)
+ assert_equal("mixin", TestRefinement::PrependAfterRefine::C.new.foo)
+ y = eval_using(PrependAfterRefine::M,
+ "TestRefinement::PrependAfterRefine::C.new.bar")
+ assert_equal("refined", y)
+ assert_equal("mixin", TestRefinement::PrependAfterRefine::C.new.bar)
+ end
+
+ module SuperInBlock
+ class C
+ def foo(*args)
+ [:foo, *args]
+ end
+ end
+
+ module R
+ refine C do
+ def foo(*args)
+ tap do
+ return super(:ref, *args)
+ end
+ end
+ end
+ end
+ end
+
+ def test_super_in_block
+ bug7925 = '[ruby-core:52750] [Bug #7925]'
+ x = eval_using(SuperInBlock::R,
+ "TestRefinement:: SuperInBlock::C.new.foo(#{bug7925.dump})")
+ assert_equal([:foo, :ref, bug7925], x, bug7925)
+ end
+
+ module ModuleUsing
+ using FooExt
+
+ def self.invoke_x_on(foo)
+ return foo.x
+ end
+
+ def self.invoke_y_on(foo)
+ return foo.y
+ end
+
+ def self.invoke_z_on(foo)
+ return foo.z
+ end
+
+ def self.send_z_on(foo)
+ return foo.send(:z)
+ end
+
+ def self.method_z(foo)
+ return foo.method(:z)
+ end
+
+ def self.invoke_call_x_on(foo)
+ return foo.call_x
+ end
+ end
+
+ def test_module_using
+ foo = Foo.new
+ assert_equal("Foo#x", foo.x)
+ assert_equal("Foo#y", foo.y)
+ assert_raise(NoMethodError) { foo.z }
+ assert_equal("FooExt#x", ModuleUsing.invoke_x_on(foo))
+ assert_equal("FooExt#y Foo#y", ModuleUsing.invoke_y_on(foo))
+ assert_equal("FooExt#z", ModuleUsing.invoke_z_on(foo))
+ assert_equal("Foo#x", foo.x)
+ assert_equal("Foo#y", foo.y)
+ assert_raise(NoMethodError) { foo.z }
+ end
+
+ def test_module_using_in_method
+ assert_raise(RuntimeError) do
+ Module.new.send(:using, FooExt)
+ end
+ end
+
+ def test_module_using_invalid_self
+ assert_raise(RuntimeError) do
+ eval <<-EOF, TOPLEVEL_BINDING
+ module TestRefinement::TestModuleUsingInvalidSelf
+ Module.new.send(:using, TestRefinement::FooExt)
+ end
+ EOF
+ end
+ end
+
+ class Bar
+ end
+
+ module BarExt
+ refine Bar do
+ def x
+ return "BarExt#x"
+ end
+ end
+ end
+
+ module FooBarExt
+ include FooExt
+ include BarExt
+ end
+
+ module FooBarExtClient
+ using FooBarExt
+
+ def self.invoke_x_on(foo)
+ return foo.x
+ end
+ end
+
+ def test_module_inclusion
+ foo = Foo.new
+ assert_equal("FooExt#x", FooBarExtClient.invoke_x_on(foo))
+ bar = Bar.new
+ assert_equal("BarExt#x", FooBarExtClient.invoke_x_on(bar))
+ end
+
+ module FooFoo2Ext
+ include FooExt
+ include FooExt2
+ end
+
+ module FooFoo2ExtClient
+ using FooFoo2Ext
+
+ def self.invoke_x_on(foo)
+ return foo.x
+ end
+
+ def self.invoke_y_on(foo)
+ return foo.y
+ end
+ end
+
+ def test_module_inclusion2
+ foo = Foo.new
+ assert_equal("FooExt2#x", FooFoo2ExtClient.invoke_x_on(foo))
+ assert_equal("FooExt2#y Foo#y", FooFoo2ExtClient.invoke_y_on(foo))
+ end
+
+ def test_eval_scoping
+ assert_in_out_err([], <<-INPUT, ["HELLO WORLD", "dlrow olleh", "HELLO WORLD"], [])
+ module M
+ refine String do
+ def upcase
+ reverse
+ end
+ end
+ end
+
+ puts "hello world".upcase
+ puts eval(%{using M; "hello world".upcase})
+ puts "hello world".upcase
+ INPUT
+ end
+
+ def test_eval_with_binding_scoping
+ assert_in_out_err([], <<-INPUT, ["HELLO WORLD", "dlrow olleh", "HELLO WORLD"], [])
+ module M
+ refine String do
+ def upcase
+ reverse
+ end
+ end
+ end
+
+ puts "hello world".upcase
+ puts eval(%{using M; "hello world".upcase}, TOPLEVEL_BINDING)
+ puts eval(%{"hello world".upcase}, TOPLEVEL_BINDING)
+ INPUT
+ end
+
+ def test_case_dispatch_is_aware_of_refinements
+ assert_in_out_err([], <<-RUBY, ["refinement used"], [])
+ module RefineSymbol
+ refine Symbol do
+ def ===(other)
+ true
+ end
+ end
+ end
+
+ using RefineSymbol
+
+ case :a
+ when :b
+ puts "refinement used"
+ else
+ puts "refinement not used"
+ end
+ RUBY
+ end
+
+ def test_refine_after_using
+ assert_separately([], <<-"end;")
+ bug8880 = '[ruby-core:57079] [Bug #8880]'
+ module Test
+ refine(String) do
+ end
+ end
+ using Test
+ def t
+ 'Refinements are broken!'.chop!
+ end
+ t
+ module Test
+ refine(String) do
+ def chop!
+ self.sub!(/broken/, 'fine')
+ end
+ end
+ end
+ assert_equal('Refinements are fine!', t, bug8880)
+ end;
+ end
+
+ def test_instance_methods
+ bug8881 = '[ruby-core:57080] [Bug #8881]'
+ assert_not_include(Foo.instance_methods(false), :z, bug8881)
+ assert_not_include(FooSub.instance_methods(true), :z, bug8881)
+ end
+
+ def test_method_defined
+ assert_not_send([Foo, :method_defined?, :z])
+ assert_not_send([FooSub, :method_defined?, :z])
+ end
+
+ def test_undef_refined_method
+ bug8966 = '[ruby-core:57466] [Bug #8966]'
+
+ assert_in_out_err([], <<-INPUT, ["NameError"], [], bug8966)
+ module Foo
+ refine Object do
+ def foo
+ puts "foo"
+ end
+ end
+ end
+
+ using Foo
+
+ class Object
+ begin
+ undef foo
+ rescue Exception => e
+ p e.class
+ end
+ end
+ INPUT
+
+ assert_in_out_err([], <<-INPUT, ["NameError"], [], bug8966)
+ module Foo
+ refine Object do
+ def foo
+ puts "foo"
+ end
+ end
+ end
+
+ # without `using Foo'
+
+ class Object
+ begin
+ undef foo
+ rescue Exception => e
+ p e.class
+ end
+ end
+ INPUT
+ end
+
+ def test_refine_undefed_method_and_call
+ assert_in_out_err([], <<-INPUT, ["NoMethodError"], [])
+ class Foo
+ def foo
+ end
+
+ undef foo
+ end
+
+ module FooExt
+ refine Foo do
+ def foo
+ end
+ end
+ end
+
+ begin
+ Foo.new.foo
+ rescue => e
+ p e.class
+ end
+ INPUT
+ end
+
+ def test_refine_undefed_method_and_send
+ assert_in_out_err([], <<-INPUT, ["NoMethodError"], [])
+ class Foo
+ def foo
+ end
+
+ undef foo
+ end
+
+ module FooExt
+ refine Foo do
+ def foo
+ end
+ end
+ end
+
+ begin
+ Foo.new.send(:foo)
+ rescue => e
+ p e.class
+ end
+ INPUT
+ end
+
+ private
+
+ def eval_using(mod, s)
+ eval("using #{mod}; #{s}", TOPLEVEL_BINDING)
+ end
+end
diff --git a/test/ruby/test_regexp.rb b/test/ruby/test_regexp.rb
index 3073a98b89..b0efe38d8c 100644
--- a/test/ruby/test_regexp.rb
+++ b/test/ruby/test_regexp.rb
@@ -1,3 +1,4 @@
+# coding: US-ASCII
require 'test/unit'
require_relative 'envutil'
@@ -63,6 +64,14 @@ class TestRegexp < Test::Unit::TestCase
def test_to_s
assert_equal '(?-mix:\x00)', Regexp.new("\0").to_s
+
+ str = "abcd\u3042"
+ [:UTF_16BE, :UTF_16LE, :UTF_32BE, :UTF_32LE].each do |es|
+ enc = Encoding.const_get(es)
+ rs = Regexp.new(str.encode(enc)).to_s
+ assert_equal("(?-mix:abcd\u3042)".encode(enc), rs)
+ assert_equal(enc, rs.encoding)
+ end
end
def test_union
@@ -77,6 +86,11 @@ class TestRegexp < Test::Unit::TestCase
end
end
+ def test_word_boundary
+ assert_match(/\u3042\b /, "\u3042 ")
+ assert_not_match(/\u3042\ba/, "\u3042a")
+ end
+
def test_named_capture
m = /&(?<foo>.*?);/.match("aaa &amp; yyy")
assert_equal("amp", m["foo"])
@@ -150,7 +164,56 @@ class TestRegexp < Test::Unit::TestCase
end
def test_source
+ bug5484 = '[ruby-core:40364]'
assert_equal('', //.source)
+ assert_equal('\:', /\:/.source, bug5484)
+ assert_equal(':', %r:\::.source, bug5484)
+ end
+
+ def test_source_escaped
+ expected, result = "$*+.?^|".each_char.map {|c|
+ [
+ ["\\#{c}", "\\#{c}", 1],
+ begin
+ re = eval("%r#{c}\\#{c}#{c}", nil, __FILE__, __LINE__)
+ t = eval("/\\#{c}/", nil, __FILE__, __LINE__).source
+ rescue SyntaxError => e
+ [e, t, nil]
+ else
+ [re.source, t, re =~ "a#{c}a"]
+ end
+ ]
+ }.transpose
+ assert_equal(expected, result)
+ end
+
+ def test_source_escaped_paren
+ bug7610 = '[ruby-core:51088] [Bug #7610]'
+ bug8133 = '[ruby-core:53578] [Bug #8133]'
+ [
+ ["(", ")", bug7610], ["[", "]", bug8133],
+ ["{", "}", bug8133], ["<", ">", bug8133],
+ ].each do |lparen, rparen, bug|
+ s = "\\#{lparen}a\\#{rparen}"
+ assert_equal(/#{s}/, eval("%r#{lparen}#{s}#{rparen}"), bug)
+ end
+ end
+
+ def test_source_unescaped
+ expected, result = "!\"#%&',-/:;=@_`~".each_char.map {|c|
+ [
+ ["#{c}", "\\#{c}", 1],
+ begin
+ re = eval("%r#{c}\\#{c}#{c}", nil, __FILE__, __LINE__)
+ t = eval("%r{\\#{c}}", nil, __FILE__, __LINE__).source
+ rescue SyntaxError => e
+ [e, t, nil]
+ else
+ [re.source, t, re =~ "a#{c}a"]
+ end
+ ]
+ }.transpose
+ assert_equal(expected, result)
end
def test_inspect
@@ -285,14 +348,6 @@ class TestRegexp < Test::Unit::TestCase
def test_initialize
assert_raise(ArgumentError) { Regexp.new }
assert_equal(/foo/, Regexp.new(/foo/, Regexp::IGNORECASE))
- re = /foo/
- assert_raise(SecurityError) do
- Thread.new { $SAFE = 4; re.instance_eval { initialize(re) } }.join
- end
- re.taint
- assert_raise(SecurityError) do
- Thread.new { $SAFE = 4; re.instance_eval { initialize(re) } }.join
- end
assert_equal(Encoding.find("US-ASCII"), Regexp.new("b..", nil, "n").encoding)
assert_equal("bar", "foobarbaz"[Regexp.new("b..", nil, "n")])
@@ -325,7 +380,7 @@ class TestRegexp < Test::Unit::TestCase
assert_equal(/a/, eval(%q(s="\u0061";/#{s}/n)))
assert_raise(RegexpError) { s = "\u3042"; eval(%q(/#{s}/n)) }
assert_raise(RegexpError) { s = "\u0061"; eval(%q(/\u3042#{s}/n)) }
- assert_raise(RegexpError) { s1=[0xff].pack("C"); s2="\u3042"; eval(%q(/#{s1}#{s2}/)) }
+ assert_raise(RegexpError) { s1=[0xff].pack("C"); s2="\u3042"; eval(%q(/#{s1}#{s2}/)); [s1, s2] }
assert_raise(ArgumentError) { s = '\x'; /#{ s }/ }
@@ -364,9 +419,11 @@ class TestRegexp < Test::Unit::TestCase
end
def test_equal
- assert_equal(true, /abc/ == /abc/)
- assert_equal(false, /abc/ == /abc/m)
- assert_equal(false, /abc/ == /abd/)
+ bug5484 = '[ruby-core:40364]'
+ assert_equal(/abc/, /abc/)
+ assert_not_equal(/abc/, /abc/m)
+ assert_not_equal(/abc/, /abd/)
+ assert_equal(/\/foo/, Regexp.new('/foo'), bug5484)
end
def test_match
@@ -443,6 +500,12 @@ class TestRegexp < Test::Unit::TestCase
assert_equal('foo[\z]baz', "foobarbaz".sub!(/(b..)/, '[\z]'))
end
+ def test_regsub_K
+ bug8856 = '[ruby-dev:47694] [Bug #8856]'
+ result = "foobarbazquux/foobarbazquux".gsub(/foo\Kbar/, "")
+ assert_equal('foobazquux/foobazquux', result, bug8856)
+ end
+
def test_KCODE
assert_nil($KCODE)
assert_nothing_raised { $KCODE = nil }
@@ -488,12 +551,12 @@ class TestRegexp < Test::Unit::TestCase
def test_taint
m = Thread.new do
"foo"[/foo/]
- $SAFE = 4
+ $SAFE = 3
/foo/.match("foo")
end.value
assert(m.tainted?)
assert_nothing_raised('[ruby-core:26137]') {
- m = proc {$SAFE = 4; %r"#{ }"o}.call
+ m = proc {$SAFE = 3; %r"#{ }"o}.call
}
assert(m.tainted?)
end
@@ -530,7 +593,7 @@ class TestRegexp < Test::Unit::TestCase
check(/\A\80\z/, "80", ["\100", ""])
check(/\A\77\z/, "?")
check(/\A\78\z/, "\7" + '8', ["\100", ""])
- check(/\A\Qfoo\E\z/, "QfooE")
+ check(eval('/\A\Qfoo\E\z/'), "QfooE")
check(/\Aa++\z/, "aaa")
check('\Ax]\z', "x]")
check(/x#foo/x, "x", "#foo")
@@ -704,9 +767,9 @@ class TestRegexp < Test::Unit::TestCase
def test_posix_bracket
check(/\A[[:alpha:]0]\z/, %w(0 a), %w(1 .))
- check(/\A[[:^alpha:]0]\z/, %w(0 1 .), "a")
- check(/\A[[:alpha\:]]\z/, %w(a l p h a :), %w(b 0 1 .))
- check(/\A[[:alpha:foo]0]\z/, %w(0 a), %w(1 .))
+ check(eval('/\A[[:^alpha:]0]\z/'), %w(0 1 .), "a")
+ check(eval('/\A[[:alpha\:]]\z/'), %w(a l p h a :), %w(b 0 1 .))
+ check(eval('/\A[[:alpha:foo]0]\z/'), %w(0 a), %w(1 .))
check(/\A[[:xdigit:]&&[:alpha:]]\z/, "a", %w(g 0))
check('\A[[:abcdefghijklmnopqrstu:]]+\z', "[]")
failcheck('[[:alpha')
@@ -843,18 +906,24 @@ class TestRegexp < Test::Unit::TestCase
end
def test_dup_warn
- assert_warn(/duplicated/) { Regexp.new('[\u3042\u3043\u3042]') }
- assert_warn(/duplicated/) { Regexp.new('[\u3042\u3043\u3043]') }
- assert_warn(/\A\z/) { Regexp.new('[\u3042\u3044\u3043]') }
- assert_warn(/\A\z/) { Regexp.new('[\u3042\u3045\u3043]') }
- assert_warn(/\A\z/) { Regexp.new('[\u3042\u3045\u3044]') }
- assert_warn(/\A\z/) { Regexp.new('[\u3042\u3045\u3043-\u3044]') }
- assert_warn(/duplicated/) { Regexp.new('[\u3042\u3045\u3042-\u3043]') }
- assert_warn(/duplicated/) { Regexp.new('[\u3042\u3045\u3044-\u3045]') }
- assert_warn(/\A\z/) { Regexp.new('[\u3042\u3046\u3044]') }
- assert_warn(/duplicated/) { Regexp.new('[\u1000-\u2000\u3042-\u3046\u3044]') }
- assert_warn(/duplicated/) { Regexp.new('[\u3044\u3041-\u3047]') }
- assert_warn(/duplicated/) { Regexp.new('[\u3042\u3044\u3046\u3041-\u3047]') }
+ assert_warning(/duplicated/) { Regexp.new('[\u3042\u3043\u3042]') }
+ assert_warning(/duplicated/) { Regexp.new('[\u3042\u3043\u3043]') }
+ assert_warning(/\A\z/) { Regexp.new('[\u3042\u3044\u3043]') }
+ assert_warning(/\A\z/) { Regexp.new('[\u3042\u3045\u3043]') }
+ assert_warning(/\A\z/) { Regexp.new('[\u3042\u3045\u3044]') }
+ assert_warning(/\A\z/) { Regexp.new('[\u3042\u3045\u3043-\u3044]') }
+ assert_warning(/duplicated/) { Regexp.new('[\u3042\u3045\u3042-\u3043]') }
+ assert_warning(/duplicated/) { Regexp.new('[\u3042\u3045\u3044-\u3045]') }
+ assert_warning(/\A\z/) { Regexp.new('[\u3042\u3046\u3044]') }
+ assert_warning(/duplicated/) { Regexp.new('[\u1000-\u2000\u3042-\u3046\u3044]') }
+ assert_warning(/duplicated/) { Regexp.new('[\u3044\u3041-\u3047]') }
+ assert_warning(/duplicated/) { Regexp.new('[\u3042\u3044\u3046\u3041-\u3047]') }
+
+ bug7471 = '[ruby-core:50344]'
+ assert_warning('', bug7471) { Regexp.new('[\D]') =~ "\u3042" }
+
+ bug8151 = '[ruby-core:53649]'
+ assert_warning(/\A\z/, bug8151) { Regexp.new('(?:[\u{33}])').to_s }
end
def test_property_warn
@@ -873,4 +942,116 @@ class TestRegexp < Test::Unit::TestCase
# use Regexp.new instead of literal to ignore a parser warning.
check(Regexp.new('[0-1-\\s]'), [' ', '-'], ['2', 'a'], bug6853)
end
+
+ def test_error_message_on_failed_conversion
+ bug7539 = '[ruby-core:50733]'
+ assert_equal false, /x/=== 42
+ assert_raise_with_message(TypeError, 'no implicit conversion of Fixnum into String', bug7539) {
+ Regexp.quote(42)
+ }
+ end
+
+ def test_conditional_expression
+ bug8583 = '[ruby-dev:47480] [Bug #8583]'
+
+ conds = {"xy"=>true, "yx"=>true, "xx"=>false, "yy"=>false}
+ assert_match_each(/\A((x)|(y))(?(2)y|x)\z/, conds, bug8583)
+ assert_match_each(/\A((?<x>x)|(?<y>y))(?(<x>)y|x)\z/, conds, bug8583)
+ end
+
+ def test_options_in_look_behind
+ assert_nothing_raised {
+ assert_match_at("(?<=(?i)ab)cd", "ABcd", [[2,4]])
+ assert_match_at("(?<=(?i:ab))cd", "ABcd", [[2,4]])
+ assert_match_at("(?<!(?i)ab)cd", "aacd", [[2,4]])
+ assert_match_at("(?<!(?i:ab))cd", "aacd", [[2,4]])
+
+ assert_not_match("(?<=(?i)ab)cd", "ABCD")
+ assert_not_match("(?<=(?i:ab))cd", "ABCD")
+ assert_not_match("(?<!(?i)ab)cd", "ABcd")
+ assert_not_match("(?<!(?i:ab))cd", "ABcd")
+ }
+ end
+
+ def test_once
+ pr1 = proc{|i| /#{i}/o}
+ assert_equal(/0/, pr1.call(0))
+ assert_equal(/0/, pr1.call(1))
+ assert_equal(/0/, pr1.call(2))
+
+ # recursive
+ pr2 = proc{|i|
+ if i > 0
+ /#{pr2.call(i-1).to_s}#{i}/
+ else
+ //
+ end
+ }
+ assert_equal(/(?-mix:(?-mix:(?-mix:)1)2)3/, pr2.call(3))
+
+ # multi-thread
+ m = Mutex.new
+ pr3 = proc{|i|
+ /#{m.unlock; sleep 0.5; i}/o
+ }
+ ary = []
+ n = 0
+ th1 = Thread.new{m.lock; ary << pr3.call(n+=1)}
+ th2 = Thread.new{m.lock; ary << pr3.call(n+=1)}
+ th1.join; th2.join
+ assert_equal([/1/, /1/], ary)
+
+ # escape
+ pr4 = proc{|i|
+ catch(:xyzzy){
+ /#{throw :xyzzy, i}/o =~ ""
+ :ng
+ }
+ }
+ assert_equal(0, pr4.call(0))
+ assert_equal(1, pr4.call(1))
+ end
+
+ def test_eq_tilde_can_be_overridden
+ assert_separately([], <<-RUBY)
+ class Regexp
+ undef =~
+ def =~(str)
+ "foo"
+ end
+ end
+
+ assert_equal("foo", // =~ "")
+ RUBY
+ end
+
+ # This assertion is for porting x2() tests in testpy.py of Onigmo.
+ def assert_match_at(re, str, positions, msg = nil)
+ re = Regexp.new(re) unless re.is_a?(Regexp)
+
+ match = re.match(str)
+
+ assert_not_nil match, message(msg) {
+ "Expected #{re.inspect} to match #{str.inspect}"
+ }
+
+ if match
+ actual_positions = (0...match.size).map { |i|
+ [match.begin(i), match.end(i)]
+ }
+
+ assert_equal positions, actual_positions, message(msg) {
+ "Expected #{re.inspect} to match #{str.inspect} at: #{positions.inspect}"
+ }
+ end
+ end
+
+ def assert_match_each(re, conds, msg = nil)
+ errs = conds.select {|str, match| match ^ (re =~ str)}
+ msg = message(msg) {
+ "Expected #{re.inspect} to\n" +
+ errs.map {|str, match| "\t#{'not ' unless match}match #{str.inspect}"}.join(",\n")
+ }
+ assert(errs.empty?, msg)
+ end
end
diff --git a/test/ruby/test_require.rb b/test/ruby/test_require.rb
index 58a9ee26b6..bca9604640 100644
--- a/test/ruby/test_require.rb
+++ b/test/ruby/test_require.rb
@@ -5,26 +5,33 @@ require_relative 'envutil'
require 'tmpdir'
class TestRequire < Test::Unit::TestCase
- def test_require_invalid_shared_object
- t = Tempfile.new(["test_ruby_test_require", ".so"])
- t.puts "dummy"
- t.close
+ def test_load_error_path
+ filename = "should_not_exist"
+ error = assert_raise(LoadError) do
+ require filename
+ end
+ assert_equal filename, error.path
+ end
- assert_in_out_err([], <<-INPUT, %w(:ok), [])
- begin
- require \"#{ t.path }\"
- rescue LoadError
- p :ok
- end
- INPUT
+ def test_require_invalid_shared_object
+ Tempfile.create(["test_ruby_test_require", ".so"]) {|t|
+ t.puts "dummy"
+ t.close
+
+ assert_separately([], <<-INPUT)
+ $:.replace([IO::NULL])
+ assert_raise(LoadError) do
+ require \"#{ t.path }\"
+ end
+ INPUT
+ }
end
def test_require_too_long_filename
- assert_in_out_err(["RUBYOPT"=>nil], <<-INPUT, %w(:ok), [])
- begin
+ assert_separately(["RUBYOPT"=>nil], <<-INPUT)
+ $:.replace([IO::NULL])
+ assert_raise(LoadError) do
require '#{ "foo/" * 10000 }foo'
- rescue LoadError
- p :ok
end
INPUT
@@ -42,8 +49,69 @@ class TestRequire < Test::Unit::TestCase
def test_require_nonascii
bug3758 = '[ruby-core:31915]'
- e = assert_raise(LoadError, bug3758) {require "\u{221e}"}
- assert_match(/\u{221e}\z/, e.message, bug3758)
+ ["\u{221e}", "\x82\xa0".force_encoding("cp932")].each do |path|
+ assert_raise_with_message(LoadError, /#{path}\z/, bug3758) {require path}
+ end
+ end
+
+ def test_require_nonascii_path
+ bug8165 = '[ruby-core:53733] [Bug #8165]'
+ encoding = 'filesystem'
+ assert_require_nonascii_path(encoding, bug8165)
+ end
+
+ def test_require_nonascii_path_utf8
+ bug8676 = '[ruby-core:56136] [Bug #8676]'
+ encoding = Encoding::UTF_8
+ return if Encoding.find('filesystem') == encoding
+ assert_require_nonascii_path(encoding, bug8676)
+ end
+
+ def test_require_nonascii_path_shift_jis
+ bug8676 = '[ruby-core:56136] [Bug #8676]'
+ encoding = Encoding::Shift_JIS
+ return if Encoding.find('filesystem') == encoding
+ assert_require_nonascii_path(encoding, bug8676)
+ end
+
+ case RUBY_PLATFORM
+ when /cygwin/, /mswin/, /mingw/, /darwin/
+ def self.ospath_encoding(path)
+ Encoding::UTF_8
+ end
+ else
+ def self.ospath_encoding(path)
+ path.encoding
+ end
+ end
+
+ def assert_require_nonascii_path(encoding, bug)
+ Dir.mktmpdir {|tmp|
+ dir = "\u3042" * 5
+ begin
+ require_path = File.join(tmp, dir, 'foo.rb').encode(encoding)
+ rescue
+ skip "cannot convert path encoding to #{encoding}"
+ end
+ Dir.mkdir(File.dirname(require_path))
+ open(require_path, "wb") {|f| f.puts '$:.push __FILE__'}
+ begin
+ load_path = $:.dup
+ features = $".dup
+ # leave paths for require encoding objects
+ bug = "#{bug} require #{encoding} path"
+ require_path = "#{require_path}"
+ $:.clear
+ assert_nothing_raised(LoadError, bug) {
+ assert(require(require_path), bug)
+ assert_equal(self.class.ospath_encoding(require_path), $:.last.encoding, '[Bug #8753]')
+ assert(!require(require_path), bug)
+ }
+ ensure
+ $:.replace(load_path)
+ $".replace(features)
+ end
+ }
end
def test_require_path_home_1
@@ -75,26 +143,45 @@ class TestRequire < Test::Unit::TestCase
def test_require_path_home_3
env_rubypath, env_home = ENV["RUBYPATH"], ENV["HOME"]
- t = Tempfile.new(["test_ruby_test_require", ".rb"])
- t.puts "p :ok"
- t.close
-
- ENV["RUBYPATH"] = "~"
- ENV["HOME"] = t.path
- assert_in_out_err(%w(-S test_ruby_test_require), "", [], /\(LoadError\)/)
+ Tempfile.create(["test_ruby_test_require", ".rb"]) {|t|
+ t.puts "p :ok"
+ t.close
- ENV["HOME"], name = File.split(t.path)
- assert_in_out_err(["-S", name], "", %w(:ok), [])
+ ENV["RUBYPATH"] = "~"
+ ENV["HOME"] = t.path
+ assert_in_out_err(%w(-S test_ruby_test_require), "", [], /\(LoadError\)/)
+ ENV["HOME"], name = File.split(t.path)
+ assert_in_out_err(["-S", name], "", %w(:ok), [])
+ }
ensure
env_rubypath ? ENV["RUBYPATH"] = env_rubypath : ENV.delete("RUBYPATH")
env_home ? ENV["HOME"] = env_home : ENV.delete("HOME")
end
def test_require_with_unc
- assert(system(File.expand_path(EnvUtil.rubybin).sub(/\A(\w):/, '//127.0.0.1/\1$/'), "-rabbrev", "-e0"))
+ ruby = File.expand_path(EnvUtil.rubybin).sub(/\A(\w):/, '//127.0.0.1/\1$/')
+ skip "local drive #$1: is not shared" unless File.exist?(ruby)
+ pid = nil
+ assert_nothing_raised {pid = spawn(ruby, "-rabbrev", "-e0")}
+ ret, status = Process.wait2(pid)
+ assert_equal(pid, ret)
+ assert_predicate(status, :success?)
end if /mswin|mingw/ =~ RUBY_PLATFORM
+ def test_require_twice
+ Dir.mktmpdir do |tmp|
+ req = File.join(tmp, "very_long_file_name.rb")
+ File.write(req, "p :ok\n")
+ assert_file.exist?(req)
+ req[/.rb$/i] = ""
+ assert_in_out_err(['--disable-gems'], <<-INPUT, %w(:ok), [])
+ require "#{req}"
+ require "#{req}"
+ INPUT
+ end
+ end
+
def test_define_class
begin
require "socket"
@@ -102,33 +189,24 @@ class TestRequire < Test::Unit::TestCase
return
end
- assert_in_out_err([], <<-INPUT, %w(:ok), [])
+ assert_separately([], <<-INPUT)
BasicSocket = 1
- begin
+ assert_raise(TypeError) do
require 'socket'
- p :ng
- rescue TypeError
- p :ok
end
INPUT
- assert_in_out_err([], <<-INPUT, %w(:ok), [])
+ assert_separately([], <<-INPUT)
class BasicSocket; end
- begin
+ assert_raise(TypeError) do
require 'socket'
- p :ng
- rescue TypeError
- p :ok
end
INPUT
- assert_in_out_err([], <<-INPUT, %w(:ok), [])
+ assert_separately([], <<-INPUT)
class BasicSocket < IO; end
- begin
+ assert_nothing_raised do
require 'socket'
- p :ok
- rescue Exception
- p :ng
end
INPUT
end
@@ -140,36 +218,27 @@ class TestRequire < Test::Unit::TestCase
return
end
- assert_in_out_err([], <<-INPUT, %w(:ok), [])
+ assert_separately([], <<-INPUT)
module Zlib; end
Zlib::Error = 1
- begin
+ assert_raise(TypeError) do
require 'zlib'
- p :ng
- rescue TypeError
- p :ok
end
INPUT
- assert_in_out_err([], <<-INPUT, %w(:ok), [])
+ assert_separately([], <<-INPUT)
module Zlib; end
class Zlib::Error; end
- begin
+ assert_raise(NameError) do
require 'zlib'
- p :ng
- rescue NameError
- p :ok
end
INPUT
- assert_in_out_err([], <<-INPUT, %w(:ok), [])
+ assert_separately([], <<-INPUT)
module Zlib; end
class Zlib::Error < StandardError; end
- begin
+ assert_nothing_raised do
require 'zlib'
- p :ok
- rescue Exception
- p :ng
end
INPUT
end
@@ -181,13 +250,10 @@ class TestRequire < Test::Unit::TestCase
return
end
- assert_in_out_err([], <<-INPUT, %w(:ok), [])
+ assert_separately([], <<-INPUT)
Zlib = 1
- begin
+ assert_raise(TypeError) do
require 'zlib'
- p :ng
- rescue TypeError
- p :ok
end
INPUT
end
@@ -199,96 +265,85 @@ class TestRequire < Test::Unit::TestCase
return
end
- assert_in_out_err([], <<-INPUT, %w(:ok), [])
+ assert_separately([], <<-INPUT)
class BasicSocket < IO; end
class Socket < BasicSocket; end
Socket::Constants = 1
- begin
+ assert_raise(TypeError) do
require 'socket'
- p :ng
- rescue TypeError
- p :ok
end
INPUT
end
def test_load
- t = Tempfile.new(["test_ruby_test_require", ".rb"])
- t.puts "module Foo; end"
- t.puts "at_exit { p :wrap_end }"
- t.puts "at_exit { raise 'error in at_exit test' }"
- t.puts "p :ok"
- t.close
-
- assert_in_out_err([], <<-INPUT, %w(:ok :end :wrap_end), /error in at_exit test/)
- load(#{ t.path.dump }, true)
- GC.start
- p :end
- INPUT
-
- assert_raise(ArgumentError) { at_exit }
+ Tempfile.create(["test_ruby_test_require", ".rb"]) {|t|
+ t.puts "module Foo; end"
+ t.puts "at_exit { p :wrap_end }"
+ t.puts "at_exit { raise 'error in at_exit test' }"
+ t.puts "p :ok"
+ t.close
+
+ assert_in_out_err([], <<-INPUT, %w(:ok :end :wrap_end), /error in at_exit test/)
+ load(#{ t.path.dump }, true)
+ GC.start
+ p :end
+ INPUT
+
+ assert_raise(ArgumentError) { at_exit }
+ }
end
def test_load2 # [ruby-core:25039]
- t = Tempfile.new(["test_ruby_test_require", ".rb"])
- t.puts "Hello = 'hello'"
- t.puts "class Foo"
- t.puts " p Hello"
- t.puts "end"
- t.close
-
- assert_in_out_err([], <<-INPUT, %w("hello"), [])
- load(#{ t.path.dump }, true)
- INPUT
+ Tempfile.create(["test_ruby_test_require", ".rb"]) {|t|
+ t.puts "Hello = 'hello'"
+ t.puts "class Foo"
+ t.puts " p Hello"
+ t.puts "end"
+ t.close
+
+ assert_in_out_err([], <<-INPUT, %w("hello"), [])
+ load(#{ t.path.dump }, true)
+ INPUT
+ }
end
def test_tainted_loadpath
- t = Tempfile.new(["test_ruby_test_require", ".rb"])
- abs_dir, file = File.split(t.path)
- abs_dir = File.expand_path(abs_dir).untaint
-
- assert_in_out_err([], <<-INPUT, %w(:ok), [])
- abs_dir = "#{ abs_dir }"
- $: << abs_dir
- require "#{ file }"
- p :ok
- INPUT
-
- assert_in_out_err([], <<-INPUT, %w(:ok), [])
- abs_dir = "#{ abs_dir }"
- $: << abs_dir.taint
- require "#{ file }"
- p :ok
- INPUT
-
- assert_in_out_err([], <<-INPUT, %w(:ok), [])
- abs_dir = "#{ abs_dir }"
- $: << abs_dir.taint
- $SAFE = 1
- begin
- require "#{ file }"
- rescue SecurityError
- p :ok
- end
- INPUT
-
- assert_in_out_err([], <<-INPUT, %w(:ok), [])
- abs_dir = "#{ abs_dir }"
- $: << abs_dir.taint
- $SAFE = 1
- begin
- require "#{ file }"
- rescue SecurityError
- p :ok
- end
- INPUT
-
- assert_in_out_err([], <<-INPUT, %w(:ok), [])
- abs_dir = "#{ abs_dir }"
- $: << abs_dir << 'elsewhere'.taint
- require "#{ file }"
- p :ok
- INPUT
+ Tempfile.create(["test_ruby_test_require", ".rb"]) {|t|
+ abs_dir, file = File.split(t.path)
+ abs_dir = File.expand_path(abs_dir).untaint
+
+ assert_separately([], <<-INPUT)
+ abs_dir = "#{ abs_dir }"
+ $: << abs_dir
+ assert_nothing_raised {require "#{ file }"}
+ INPUT
+
+ assert_separately([], <<-INPUT)
+ abs_dir = "#{ abs_dir }"
+ $: << abs_dir.taint
+ assert_nothing_raised {require "#{ file }"}
+ INPUT
+
+ assert_separately([], <<-INPUT)
+ abs_dir = "#{ abs_dir }"
+ $: << abs_dir.taint
+ $SAFE = 1
+ assert_raise(SecurityError) {require "#{ file }"}
+ INPUT
+
+ assert_separately([], <<-INPUT)
+ abs_dir = "#{ abs_dir }"
+ $: << abs_dir.taint
+ $SAFE = 1
+ assert_raise(SecurityError) {require "#{ file }"}
+ INPUT
+
+ assert_separately([], <<-INPUT)
+ abs_dir = "#{ abs_dir }"
+ $: << abs_dir << 'elsewhere'.taint
+ assert_nothing_raised {require "#{ file }"}
+ INPUT
+ }
end
def test_relative
@@ -324,7 +379,7 @@ class TestRequire < Test::Unit::TestCase
File.open("a/tst.rb", "w") {|f| f.puts 'require_relative "lib"' }
begin
File.symlink("../a/tst.rb", "b/tst.rb")
- result = IO.popen([EnvUtil.rubybin, "b/tst.rb"]).read
+ result = IO.popen([EnvUtil.rubybin, "b/tst.rb"], &:read)
assert_equal("a/lib.rb\n", result, "[ruby-dev:40040]")
rescue NotImplementedError
skip "File.symlink is not implemented"
@@ -340,6 +395,78 @@ class TestRequire < Test::Unit::TestCase
bug3756)
end
+ def test_race_exception
+ bug5754 = '[ruby-core:41618]'
+ path = nil
+ stderr = $stderr
+ verbose = $VERBOSE
+ Tempfile.create(%w"bug5754 .rb") {|tmp|
+ path = tmp.path
+ tmp.print %{\
+ th = Thread.current
+ t = th[:t]
+ scratch = th[:scratch]
+
+ if scratch.empty?
+ scratch << :pre
+ Thread.pass until t.stop?
+ raise RuntimeError
+ else
+ scratch << :post
+ end
+ }
+ tmp.close
+
+ class << (output = "")
+ alias write concat
+ end
+ $stderr = output
+
+ start = false
+
+ scratch = []
+ t1_res = nil
+ t2_res = nil
+
+ t1 = Thread.new do
+ Thread.pass until start
+ begin
+ require(path)
+ rescue RuntimeError
+ end
+
+ t1_res = require(path)
+ end
+
+ t2 = Thread.new do
+ Thread.pass until scratch[0]
+ t2_res = require(path)
+ end
+
+ t1[:scratch] = t2[:scratch] = scratch
+ t1[:t] = t2
+ t2[:t] = t1
+
+ $VERBOSE = true
+ start = true
+
+ assert_nothing_raised(ThreadError, bug5754) {t1.join}
+ assert_nothing_raised(ThreadError, bug5754) {t2.join}
+
+ $VERBOSE = false
+
+ assert_equal(true, (t1_res ^ t2_res), bug5754 + " t1:#{t1_res} t2:#{t2_res}")
+ assert_equal([:pre, :post], scratch, bug5754)
+
+ assert_match(/circular require/, output)
+ assert_match(/in #{__method__}'$/o, output)
+ }
+ ensure
+ $VERBOSE = verbose
+ $stderr = stderr
+ $".delete(path)
+ end
+
def test_loaded_features_encoding
bug6377 = '[ruby-core:44750]'
loadpath = $:.dup
@@ -350,10 +477,192 @@ class TestRequire < Test::Unit::TestCase
$: << tmp
open(File.join(tmp, "foo.rb"), "w") {}
require "foo"
- assert_not_equal(Encoding::ASCII_8BIT, $"[0].encoding, bug6377)
+ assert(Encoding.compatible?(tmp, $"[0]), bug6377)
}
ensure
$:.replace(loadpath)
$".replace(features)
end
+
+ def test_require_changed_current_dir
+ bug7158 = '[ruby-core:47970]'
+ Dir.mktmpdir {|tmp|
+ Dir.chdir(tmp) {
+ Dir.mkdir("a")
+ Dir.mkdir("b")
+ open(File.join("a", "foo.rb"), "w") {}
+ open(File.join("b", "bar.rb"), "w") {|f|
+ f.puts "p :ok"
+ }
+ assert_in_out_err([], <<-INPUT, %w(:ok), [], bug7158)
+ $:.replace([IO::NULL])
+ $: << "."
+ Dir.chdir("a")
+ require "foo"
+ Dir.chdir("../b")
+ p :ng unless require "bar"
+ Dir.chdir("..")
+ p :ng if require "b/bar"
+ INPUT
+ }
+ }
+ end
+
+ def test_require_not_modified_load_path
+ bug7158 = '[ruby-core:47970]'
+ Dir.mktmpdir {|tmp|
+ Dir.chdir(tmp) {
+ open("foo.rb", "w") {}
+ assert_in_out_err([], <<-INPUT, %w(:ok), [], bug7158)
+ $:.replace([IO::NULL])
+ a = Object.new
+ def a.to_str
+ "#{tmp}"
+ end
+ $: << a
+ require "foo"
+ last_path = $:.pop
+ p :ok if last_path == a && last_path.class == Object
+ INPUT
+ }
+ }
+ end
+
+ def test_require_changed_home
+ bug7158 = '[ruby-core:47970]'
+ Dir.mktmpdir {|tmp|
+ Dir.chdir(tmp) {
+ open("foo.rb", "w") {}
+ Dir.mkdir("a")
+ open(File.join("a", "bar.rb"), "w") {}
+ assert_in_out_err([], <<-INPUT, %w(:ok), [], bug7158)
+ $:.replace([IO::NULL])
+ $: << '~'
+ ENV['HOME'] = "#{tmp}"
+ require "foo"
+ ENV['HOME'] = "#{tmp}/a"
+ p :ok if require "bar"
+ INPUT
+ }
+ }
+ end
+
+ def test_require_to_path_redefined_in_load_path
+ bug7158 = '[ruby-core:47970]'
+ Dir.mktmpdir {|tmp|
+ Dir.chdir(tmp) {
+ open("foo.rb", "w") {}
+ assert_in_out_err(["RUBYOPT"=>nil], <<-INPUT, %w(:ok), [], bug7158)
+ $:.replace([IO::NULL])
+ a = Object.new
+ def a.to_path
+ "bar"
+ end
+ $: << a
+ begin
+ require "foo"
+ p [:ng, $LOAD_PATH, ENV['RUBYLIB']]
+ rescue LoadError
+ end
+ def a.to_path
+ "#{tmp}"
+ end
+ p :ok if require "foo"
+ INPUT
+ }
+ }
+ end
+
+ def test_require_to_str_redefined_in_load_path
+ bug7158 = '[ruby-core:47970]'
+ Dir.mktmpdir {|tmp|
+ Dir.chdir(tmp) {
+ open("foo.rb", "w") {}
+ assert_in_out_err(["RUBYOPT"=>nil], <<-INPUT, %w(:ok), [], bug7158)
+ $:.replace([IO::NULL])
+ a = Object.new
+ def a.to_str
+ "foo"
+ end
+ $: << a
+ begin
+ require "foo"
+ p [:ng, $LOAD_PATH, ENV['RUBYLIB']]
+ rescue LoadError
+ end
+ def a.to_str
+ "#{tmp}"
+ end
+ p :ok if require "foo"
+ INPUT
+ }
+ }
+ end
+
+ def assert_require_with_shared_array_modified(add, del)
+ bug7383 = '[ruby-core:49518]'
+ Dir.mktmpdir {|tmp|
+ Dir.chdir(tmp) {
+ open("foo.rb", "w") {}
+ Dir.mkdir("a")
+ open(File.join("a", "bar.rb"), "w") {}
+ assert_in_out_err([], <<-INPUT, %w(:ok), [], bug7383)
+ $:.replace([IO::NULL])
+ $:.#{add} "#{tmp}"
+ $:.#{add} "#{tmp}/a"
+ require "foo"
+ $:.#{del}
+ # Expanded load path cache should be rebuilt.
+ begin
+ require "bar"
+ rescue LoadError
+ p :ok
+ end
+ INPUT
+ }
+ }
+ end
+
+ def test_require_with_array_pop
+ assert_require_with_shared_array_modified("push", "pop")
+ end
+
+ def test_require_with_array_shift
+ assert_require_with_shared_array_modified("unshift", "shift")
+ end
+
+ def test_require_local_var_on_toplevel
+ bug7536 = '[ruby-core:50701]'
+ Dir.mktmpdir {|tmp|
+ Dir.chdir(tmp) {
+ open("bar.rb", "w") {|f| f.puts 'TOPLEVEL_BINDING.eval("lib = 2")' }
+ assert_in_out_err(%w[-r./bar.rb], <<-INPUT, %w([:lib] 2), [], bug7536)
+ puts TOPLEVEL_BINDING.eval("local_variables").inspect
+ puts TOPLEVEL_BINDING.eval("lib").inspect
+ INPUT
+ }
+ }
+ end
+
+ def test_require_with_loaded_features_pop
+ bug7530 = '[ruby-core:50645]'
+ Tempfile.create(%w'bug-7530- .rb') {|script|
+ script.close
+ assert_in_out_err([{"RUBYOPT" => nil}, "-", script.path], <<-INPUT, %w(:ok), [], bug7530)
+ PATH = ARGV.shift
+ THREADS = 2
+ ITERATIONS_PER_THREAD = 1000
+
+ THREADS.times.map {
+ Thread.new do
+ ITERATIONS_PER_THREAD.times do
+ require PATH
+ $".pop
+ end
+ end
+ }.each(&:join)
+ p :ok
+ INPUT
+ }
+ end
end
diff --git a/test/ruby/test_rubyoptions.rb b/test/ruby/test_rubyoptions.rb
index 5533ac2c8e..0b1ed8fadb 100644
--- a/test/ruby/test_rubyoptions.rb
+++ b/test/ruby/test_rubyoptions.rb
@@ -1,8 +1,8 @@
+# -*- coding: us-ascii -*-
require 'test/unit'
require 'tmpdir'
require 'tempfile'
-require 'pathname'
require_relative 'envutil'
@@ -15,7 +15,7 @@ class TestRubyOptions < Test::Unit::TestCase
def with_tmpchdir
Dir.mktmpdir {|d|
- d = Pathname.new(d).realpath.to_s
+ d = File.realpath(d)
Dir.chdir(d) {
yield d
}
@@ -29,11 +29,16 @@ class TestRubyOptions < Test::Unit::TestCase
def test_usage
assert_in_out_err(%w(-h)) do |r, e|
assert_operator(r.size, :<=, 24)
+ longer = r[1..-1].select {|x| x.size > 80}
+ assert_equal([], longer)
assert_equal([], e)
end
+ end
+ def test_usage_long
assert_in_out_err(%w(--help)) do |r, e|
- assert_operator(r.size, :<=, 24)
+ longer = r[1..-1].select {|x| x.size > 80}
+ assert_equal([], longer)
assert_equal([], e)
end
end
@@ -121,9 +126,17 @@ class TestRubyOptions < Test::Unit::TestCase
assert_in_out_err(%w(-KU), "p '\u3042'") do |r, e|
assert_equal("\"\u3042\"", r.join.force_encoding(Encoding::UTF_8))
end
- assert_in_out_err(%w(-KE -e) + [""], "", [], [])
- assert_in_out_err(%w(-KS -e) + [""], "", [], [])
- assert_in_out_err(%w(-KN -e) + [""], "", [], [])
+ line = '-eputs"\xc2\xa1".encoding'
+ env = {'RUBYOPT' => nil}
+ assert_in_out_err([env, '-Ke', line], "", ["EUC-JP"], [])
+ assert_in_out_err([env, '-KE', line], "", ["EUC-JP"], [])
+ assert_in_out_err([env, '-Ks', line], "", ["Windows-31J"], [])
+ assert_in_out_err([env, '-KS', line], "", ["Windows-31J"], [])
+ assert_in_out_err([env, '-Ku', line], "", ["UTF-8"], [])
+ assert_in_out_err([env, '-KU', line], "", ["UTF-8"], [])
+ assert_in_out_err([env, '-Kn', line], "", ["ASCII-8BIT"], [])
+ assert_in_out_err([env, '-KN', line], "", ["ASCII-8BIT"], [])
+ assert_in_out_err([env, '-wKe', line], "", ["EUC-JP"], /-K/)
end
def test_version
@@ -191,14 +204,21 @@ class TestRubyOptions < Test::Unit::TestCase
end
def test_encoding
- assert_in_out_err(%w(-Eutf-8), "p '\u3042'", [], /invalid multibyte char/)
-
assert_in_out_err(%w(--encoding), "", [], /missing argument for --encoding/)
assert_in_out_err(%w(--encoding test_ruby_test_rubyoptions_foobarbazqux), "", [],
/unknown encoding name - test_ruby_test_rubyoptions_foobarbazqux \(RuntimeError\)/)
- assert_in_out_err(%w(--encoding utf-8), "p '\u3042'", [], /invalid multibyte char/)
+ if /mswin|mingw/ =~ RUBY_PLATFORM &&
+ (str = "\u3042".force_encoding(Encoding.find("locale"))).valid_encoding?
+ # This result depends on locale because LANG=C doesn't affect locale
+ # on Windows.
+ out, err = [str], []
+ else
+ out, err = [], /invalid multibyte char/
+ end
+ assert_in_out_err(%w(-Eutf-8), "puts '\u3042'", out, err)
+ assert_in_out_err(%w(--encoding utf-8), "puts '\u3042'", out, err)
end
def test_syntax_check
@@ -250,20 +270,21 @@ class TestRubyOptions < Test::Unit::TestCase
rubypath_orig = ENV['RUBYPATH']
path_orig = ENV['PATH']
- t = Tempfile.new(["test_ruby_test_rubyoption", ".rb"])
- t.puts "p 1"
- t.close
+ Tempfile.create(["test_ruby_test_rubyoption", ".rb"]) {|t|
+ t.puts "p 1"
+ t.close
- @verbose = $VERBOSE
- $VERBOSE = nil
+ @verbose = $VERBOSE
+ $VERBOSE = nil
- ENV['PATH'] = File.dirname(t.path)
+ ENV['PATH'] = File.dirname(t.path)
- assert_in_out_err(%w(-S) + [File.basename(t.path)], "", %w(1), [])
+ assert_in_out_err(%w(-S) + [File.basename(t.path)], "", %w(1), [])
- ENV['RUBYPATH'] = File.dirname(t.path)
+ ENV['RUBYPATH'] = File.dirname(t.path)
- assert_in_out_err(%w(-S) + [File.basename(t.path)], "", %w(1), [])
+ assert_in_out_err(%w(-S) + [File.basename(t.path)], "", %w(1), [])
+ }
ensure
if rubypath_orig
@@ -276,7 +297,6 @@ class TestRubyOptions < Test::Unit::TestCase
else
ENV.delete('PATH')
end
- t.close(true) if t
$VERBOSE = @verbose
end
@@ -287,7 +307,7 @@ class TestRubyOptions < Test::Unit::TestCase
assert_in_out_err([], "#! /test_r_u_b_y_test_r_u_b_y_options_foobarbazqux -foo -bar\r\np 1\r\n",
[], /: no Ruby script found in input/)
- assert_in_out_err([], "#!ruby -KU -Eutf-8\r\np \"\u3042\"\r\n") do |r, e|
+ assert_in_out_err([{'RUBYOPT' => nil}], "#!ruby -KU -Eutf-8\r\np \"\u3042\"\r\n") do |r, e|
assert_equal("\"\u3042\"", r.join.force_encoding(Encoding::UTF_8))
assert_equal([], e)
end
@@ -312,68 +332,89 @@ class TestRubyOptions < Test::Unit::TestCase
end
def test_assignment_in_conditional
- t = Tempfile.new(["test_ruby_test_rubyoption", ".rb"])
- t.puts "if a = 1"
- t.puts "end"
- t.puts "0.times do"
- t.puts " if b = 2"
- t.puts " a += b"
- t.puts " end"
- t.puts "end"
- t.close
- err = ["#{t.path}:1: warning: found = in conditional, should be ==",
- "#{t.path}:4: warning: found = in conditional, should be =="]
- err = /\A(#{Regexp.quote(t.path)}):1(: warning: found = in conditional, should be ==)\n\1:4\2\Z/
- bug2136 = '[ruby-dev:39363]'
- assert_in_out_err(["-w", t.path], "", [], err, bug2136)
- assert_in_out_err(["-wr", t.path, "-e", ""], "", [], err, bug2136)
- ensure
- t.close(true) if t
+ Tempfile.create(["test_ruby_test_rubyoption", ".rb"]) {|t|
+ t.puts "if a = 1"
+ t.puts "end"
+ t.puts "0.times do"
+ t.puts " if b = 2"
+ t.puts " a += b"
+ t.puts " end"
+ t.puts "end"
+ t.flush
+ warning = ' warning: found = in conditional, should be =='
+ err = ["#{t.path}:1:#{warning}",
+ "#{t.path}:4:#{warning}",
+ ]
+ bug2136 = '[ruby-dev:39363]'
+ assert_in_out_err(["-w", t.path], "", [], err, bug2136)
+ assert_in_out_err(["-wr", t.path, "-e", ""], "", [], err, bug2136)
+
+ t.rewind
+ t.truncate(0)
+ t.puts "if a = ''; end"
+ t.puts "if a = []; end"
+ t.puts "if a = [1]; end"
+ t.puts "if a = [a]; end"
+ t.puts "if a = {}; end"
+ t.puts "if a = {1=>2}; end"
+ t.puts "if a = {3=>a}; end"
+ t.flush
+ err = ["#{t.path}:1:#{warning}",
+ "#{t.path}:2:#{warning}",
+ "#{t.path}:3:#{warning}",
+ "#{t.path}:5:#{warning}",
+ "#{t.path}:6:#{warning}",
+ ]
+ feature4299 = '[ruby-dev:43083]'
+ assert_in_out_err(["-w", t.path], "", [], err, feature4299)
+ assert_in_out_err(["-wr", t.path, "-e", ""], "", [], err, feature4299)
+ }
end
def test_indentation_check
- t = Tempfile.new(["test_ruby_test_rubyoption", ".rb"])
- t.puts "begin"
- t.puts " end"
- t.close
- err = ["#{t.path}:2: warning: mismatched indentations at 'end' with 'begin' at 1"]
- assert_in_out_err(["-w", t.path], "", [], err)
- assert_in_out_err(["-wr", t.path, "-e", ""], "", [], err)
-
- t.open
- t.puts "# -*- warn-indent: false -*-"
- t.puts "begin"
- t.puts " end"
- t.close
- assert_in_out_err(["-w", t.path], "", [], [], '[ruby-core:25442]')
-
- err = ["#{t.path}:4: warning: mismatched indentations at 'end' with 'begin' at 3"]
- t.open
- t.puts "# -*- warn-indent: false -*-"
- t.puts "# -*- warn-indent: true -*-"
- t.puts "begin"
- t.puts " end"
- t.close
- assert_in_out_err(["-w", t.path], "", [], err, '[ruby-core:25442]')
-
- err = ["#{t.path}:4: warning: mismatched indentations at 'end' with 'begin' at 2"]
- t.open
- t.puts "# -*- warn-indent: true -*-"
- t.puts "begin"
- t.puts "# -*- warn-indent: false -*-"
- t.puts " end"
- t.close
- assert_in_out_err(["-w", t.path], "", [], [], '[ruby-core:25442]')
- ensure
- t.close(true) if t
+ Tempfile.create(["test_ruby_test_rubyoption", ".rb"]) {|t|
+ t.puts "begin"
+ t.puts " end"
+ t.flush
+ err = ["#{t.path}:2: warning: mismatched indentations at 'end' with 'begin' at 1"]
+ assert_in_out_err(["-w", t.path], "", [], err)
+ assert_in_out_err(["-wr", t.path, "-e", ""], "", [], err)
+
+ t.rewind
+ t.puts "# -*- warn-indent: false -*-"
+ t.puts "begin"
+ t.puts " end"
+ t.flush
+ assert_in_out_err(["-w", t.path], "", [], [], '[ruby-core:25442]')
+
+ err = ["#{t.path}:4: warning: mismatched indentations at 'end' with 'begin' at 3"]
+ t.rewind
+ t.puts "# -*- warn-indent: false -*-"
+ t.puts "# -*- warn-indent: true -*-"
+ t.puts "begin"
+ t.puts " end"
+ t.flush
+ assert_in_out_err(["-w", t.path], "", [], err, '[ruby-core:25442]')
+
+ err = ["#{t.path}:4: warning: mismatched indentations at 'end' with 'begin' at 2"]
+ t.rewind
+ t.puts "# -*- warn-indent: true -*-"
+ t.puts "begin"
+ t.puts "# -*- warn-indent: false -*-"
+ t.puts " end"
+ t.flush
+ assert_in_out_err(["-w", t.path], "", [], [], '[ruby-core:25442]')
+ }
end
def test_notfound
notexist = "./notexist.rb"
- rubybin = Regexp.quote(EnvUtil.rubybin)
+ rubybin = EnvUtil.rubybin.dup
+ rubybin.gsub!(%r(/), '\\') if /mswin|mingw/ =~ RUBY_PLATFORM
+ rubybin = Regexp.quote(rubybin)
pat = Regexp.quote(notexist)
bug1573 = '[ruby-core:23717]'
- assert_equal(false, File.exist?(notexist))
+ assert_file.not_exist?(notexist)
assert_in_out_err(["-r", notexist, "-ep"], "", [], /.* -- #{pat} \(LoadError\)/, bug1573)
assert_in_out_err([notexist], "", [], /#{rubybin}:.* -- #{pat} \(LoadError\)/, bug1573)
end
@@ -421,17 +462,41 @@ class TestRubyOptions < Test::Unit::TestCase
skip "platform dependent feature" if /linux|freebsd|netbsd|openbsd|darwin/ !~ RUBY_PLATFORM
with_tmpchdir do
- write_file("test-script", "$0 = 'hello world'; sleep 60")
+ write_file("test-script", "$0 = 'hello world'; /test-script/ =~ Process.argv0 or $0 = 'Process.argv0 changed!'; sleep 60")
pid = spawn(EnvUtil.rubybin, "test-script")
- sleep 0.1
- ps = `ps -p #{pid} -o command`
+ ps = nil
+ 10.times do
+ sleep 0.1
+ ps = `ps -p #{pid} -o command`
+ break if /hello world/ =~ ps
+ end
assert_match(/hello world/, ps)
Process.kill :KILL, pid
+ Process.wait(pid)
end
end
- def test_segv_test
+ def test_setproctitle
+ skip "platform dependent feature" if /linux|freebsd|netbsd|openbsd|darwin/ !~ RUBY_PLATFORM
+
+ with_tmpchdir do
+ write_file("test-script", "$_0 = $0.dup; Process.setproctitle('hello world'); $0 == $_0 or Process.setproctitle('$0 changed!'); sleep 60")
+
+ pid = spawn(EnvUtil.rubybin, "test-script")
+ ps = nil
+ 10.times do
+ sleep 0.1
+ ps = `ps -p #{pid} -o command`
+ break if /hello world/ =~ ps
+ end
+ assert_match(/hello world/, ps)
+ Process.kill :KILL, pid
+ Process.wait(pid)
+ end
+ end
+
+ module SEGVTest
opts = {}
if /mswin|mingw/ =~ RUBY_PLATFORM
additional = '[\s\w\.\']*'
@@ -439,10 +504,13 @@ class TestRubyOptions < Test::Unit::TestCase
opts[:rlimit_core] = 0
additional = ""
end
- assert_in_out_err(["-e", "Process.kill :SEGV, $$"], "", [],
+ ExecOptions = opts.freeze
+
+ ExpectedStderr =
%r(\A
-e:(?:1:)?\s\[BUG\]\sSegmentation\sfault\n
#{ Regexp.quote(RUBY_DESCRIPTION) }\n\n
+ (?:--\s(?:.+\n)*\n)?
--\sControl\sframe\sinformation\s-+\n
(?:c:.*\n)*
(?:
@@ -459,26 +527,58 @@ class TestRubyOptions < Test::Unit::TestCase
\[NOTE\]\n
You\smay\shave\sencountered\sa\sbug\sin\sthe\sRuby\sinterpreter\sor\sextension\slibraries.\n
Bug\sreports\sare\swelcome.\n
- For\sdetails:\shttp:\/\/www.ruby-lang.org/bugreport.html\n
+ For\sdetails:\shttp:\/\/.*\.ruby-lang\.org/.*\n
\n
(?:#{additional})
\z
- )x,
- nil,
- opts)
+ )x
+ end
+
+ def test_segv_test
+ opts = SEGVTest::ExecOptions.dup
+ expected_stderr = SEGVTest::ExpectedStderr
+
+ assert_in_out_err(["--disable-gems", "-e", "Process.kill :SEGV, $$"], "", [], expected_stderr, nil, opts)
+ end
+
+ def test_segv_loaded_features
+ opts = SEGVTest::ExecOptions.dup
+
+ bug7402 = '[ruby-core:49573]'
+ status = assert_in_out_err(['-e', 'class Bogus; def to_str; exit true; end; end',
+ '-e', '$".clear',
+ '-e', '$".unshift Bogus.new',
+ '-e', '(p $"; abort) unless $".size == 1',
+ '-e', 'Process.kill :SEGV, $$'],
+ "", [], /#<Bogus:/,
+ nil,
+ opts)
+ assert_not_predicate(status, :success?, "segv but success #{bug7402}")
+ end
+
+ def test_segv_setproctitle
+ opts = SEGVTest::ExecOptions.dup
+ expected_stderr = SEGVTest::ExpectedStderr
+
+ bug7597 = '[ruby-dev:46786]'
+ Tempfile.create(["test_ruby_test_bug7597", ".rb"]) {|t|
+ t.write "f" * 100
+ t.flush
+ assert_in_out_err(["--disable-gems", "-e", "$0=ARGV[0]; Process.kill :SEGV, $$", t.path],
+ "", [], expected_stderr, bug7597, opts)
+ }
end
def test_DATA
- t = Tempfile.new(["test_ruby_test_rubyoption", ".rb"])
- t.puts "puts DATA.read.inspect"
- t.puts "__END__"
- t.puts "foo"
- t.puts "bar"
- t.puts "baz"
- t.close
- assert_in_out_err([t.path], "", %w("foo\\nbar\\nbaz\\n"), [])
- ensure
- t.close(true) if t
+ Tempfile.create(["test_ruby_test_rubyoption", ".rb"]) {|t|
+ t.puts "puts DATA.read.inspect"
+ t.puts "__END__"
+ t.puts "foo"
+ t.puts "bar"
+ t.puts "baz"
+ t.flush
+ assert_in_out_err([t.path], "", %w("foo\\nbar\\nbaz\\n"), [])
+ }
end
def test_unused_variable
@@ -489,8 +589,13 @@ class TestRubyOptions < Test::Unit::TestCase
assert_in_out_err(["-we", "1.times do\n a=1\nend"], "", [], [], feature3446)
assert_in_out_err(["-we", "def foo\n 1.times do\n a=1\n end\nend"], "", [], ["-e:3: warning: assigned but unused variable - a"], feature3446)
assert_in_out_err(["-we", "def foo\n"" 1.times do |a| end\n""end"], "", [], [])
+ feature6693 = '[ruby-core:46160]'
+ assert_in_out_err(["-we", "def foo\n _a=1\nend"], "", [], [], feature6693)
bug7408 = '[ruby-core:49659]'
assert_in_out_err(["-we", "def foo\n a=1\n :a\nend"], "", [], ["-e:2: warning: assigned but unused variable - a"], bug7408)
+ feature7730 = '[ruby-core:51580]'
+ assert_in_out_err(["-w", "-"], "a=1", [], ["-:1: warning: assigned but unused variable - a"], feature7730)
+ assert_in_out_err(["-w", "-"], "eval('a=1')", [], [], feature7730)
end
def test_shadowing_variable
@@ -502,6 +607,9 @@ class TestRubyOptions < Test::Unit::TestCase
["-e:3: warning: shadowing outer local variable - a",
"-e:2: warning: assigned but unused variable - a",
], bug4130)
+ feature6693 = '[ruby-core:46160]'
+ assert_in_out_err(["-we", "def foo\n"" _a=1\n"" 1.times do |_a| end\n""end"],
+ "", [], [], feature6693)
end
def test_script_from_stdin
@@ -556,6 +664,11 @@ class TestRubyOptions < Test::Unit::TestCase
end
end
+ def test_script_is_directory
+ feature2408 = '[ruby-core:26925]'
+ assert_in_out_err(%w[.], "", [], /Is a directory -- \./, feature2408)
+ end
+
def test_pflag_gsub
bug7157 = '[ruby-core:47967]'
assert_in_out_err(['-p', '-e', 'gsub(/t.*/){"TEST"}'], %[test], %w[TEST], [], bug7157)
diff --git a/test/ruby/test_settracefunc.rb b/test/ruby/test_settracefunc.rb
index d6c6d06f38..e85f36f6f0 100644
--- a/test/ruby/test_settracefunc.rb
+++ b/test/ruby/test_settracefunc.rb
@@ -1,4 +1,5 @@
require 'test/unit'
+require_relative 'envutil'
class TestSetTraceFunc < Test::Unit::TestCase
def setup
@@ -7,23 +8,30 @@ class TestSetTraceFunc < Test::Unit::TestCase
:trace_instruction => true,
:specialized_instruction => false
}
+ @target_thread = Thread.current
end
def teardown
set_trace_func(nil)
RubyVM::InstructionSequence.compile_option = @original_compile_option
+ @target_thread = nil
+ end
+
+ def target_thread?
+ Thread.current == @target_thread
end
def test_c_call
events = []
- eval <<-EOF.gsub(/^.*?: /, "")
+ name = "#{self.class}\##{__method__}"
+ eval <<-EOF.gsub(/^.*?: /, ""), nil, name
1: set_trace_func(Proc.new { |event, file, lineno, mid, binding, klass|
- 2: events << [event, lineno, mid, klass]
+ 2: events << [event, lineno, mid, klass] if file == name
3: })
4: x = 1 + 1
5: set_trace_func(nil)
EOF
- assert_equal(["c-return", 3, :set_trace_func, Kernel],
+ assert_equal(["c-return", 1, :set_trace_func, Kernel],
events.shift)
assert_equal(["line", 4, __method__, self.class],
events.shift)
@@ -40,9 +48,10 @@ class TestSetTraceFunc < Test::Unit::TestCase
def test_call
events = []
- eval <<-EOF.gsub(/^.*?: /, "")
+ name = "#{self.class}\##{__method__}"
+ eval <<-EOF.gsub(/^.*?: /, ""), nil, name
1: set_trace_func(Proc.new { |event, file, lineno, mid, binding, klass|
- 2: events << [event, lineno, mid, klass]
+ 2: events << [event, lineno, mid, klass] if file == name
3: })
4: def add(x, y)
5: x + y
@@ -50,7 +59,7 @@ class TestSetTraceFunc < Test::Unit::TestCase
7: x = add(1, 1)
8: set_trace_func(nil)
EOF
- assert_equal(["c-return", 3, :set_trace_func, Kernel],
+ assert_equal(["c-return", 1, :set_trace_func, Kernel],
events.shift)
assert_equal(["line", 4, __method__, self.class],
events.shift)
@@ -79,9 +88,10 @@ class TestSetTraceFunc < Test::Unit::TestCase
def test_class
events = []
- eval <<-EOF.gsub(/^.*?: /, "")
+ name = "#{self.class}\##{__method__}"
+ eval <<-EOF.gsub(/^.*?: /, ""), nil, name
1: set_trace_func(Proc.new { |event, file, lineno, mid, binding, klass|
- 2: events << [event, lineno, mid, klass]
+ 2: events << [event, lineno, mid, klass] if file == name
3: })
4: class Foo
5: def bar
@@ -90,7 +100,7 @@ class TestSetTraceFunc < Test::Unit::TestCase
8: x = Foo.new.bar
9: set_trace_func(nil)
EOF
- assert_equal(["c-return", 3, :set_trace_func, Kernel],
+ assert_equal(["c-return", 1, :set_trace_func, Kernel],
events.shift)
assert_equal(["line", 4, __method__, self.class],
events.shift)
@@ -131,19 +141,20 @@ class TestSetTraceFunc < Test::Unit::TestCase
def test_return # [ruby-dev:38701]
events = []
- eval <<-EOF.gsub(/^.*?: /, "")
+ name = "#{self.class}\##{__method__}"
+ eval <<-EOF.gsub(/^.*?: /, ""), nil, name
1: set_trace_func(Proc.new { |event, file, lineno, mid, binding, klass|
- 2: events << [event, lineno, mid, klass]
+ 2: events << [event, lineno, mid, klass] if file == name
3: })
- 4: def foo(a)
+ 4: def meth_return(a)
5: return if a
6: return
7: end
- 8: foo(true)
- 9: foo(false)
+ 8: meth_return(true)
+ 9: meth_return(false)
10: set_trace_func(nil)
EOF
- assert_equal(["c-return", 3, :set_trace_func, Kernel],
+ assert_equal(["c-return", 1, :set_trace_func, Kernel],
events.shift)
assert_equal(["line", 4, __method__, self.class],
events.shift)
@@ -153,19 +164,19 @@ class TestSetTraceFunc < Test::Unit::TestCase
events.shift)
assert_equal(["line", 8, __method__, self.class],
events.shift)
- assert_equal(["call", 4, :foo, self.class],
+ assert_equal(["call", 4, :meth_return, self.class],
events.shift)
- assert_equal(["line", 5, :foo, self.class],
+ assert_equal(["line", 5, :meth_return, self.class],
events.shift)
- assert_equal(["return", 5, :foo, self.class],
+ assert_equal(["return", 5, :meth_return, self.class],
events.shift)
assert_equal(["line", 9, :test_return, self.class],
events.shift)
- assert_equal(["call", 4, :foo, self.class],
+ assert_equal(["call", 4, :meth_return, self.class],
events.shift)
- assert_equal(["line", 5, :foo, self.class],
+ assert_equal(["line", 5, :meth_return, self.class],
events.shift)
- assert_equal(["return", 7, :foo, self.class],
+ assert_equal(["return", 7, :meth_return, self.class],
events.shift)
assert_equal(["line", 10, :test_return, self.class],
events.shift)
@@ -176,18 +187,19 @@ class TestSetTraceFunc < Test::Unit::TestCase
def test_return2 # [ruby-core:24463]
events = []
- eval <<-EOF.gsub(/^.*?: /, "")
+ name = "#{self.class}\##{__method__}"
+ eval <<-EOF.gsub(/^.*?: /, ""), nil, name
1: set_trace_func(Proc.new { |event, file, lineno, mid, binding, klass|
- 2: events << [event, lineno, mid, klass]
+ 2: events << [event, lineno, mid, klass] if file == name
3: })
- 4: def foo
+ 4: def meth_return2
5: a = 5
6: return a
7: end
- 8: foo
+ 8: meth_return2
9: set_trace_func(nil)
EOF
- assert_equal(["c-return", 3, :set_trace_func, Kernel],
+ assert_equal(["c-return", 1, :set_trace_func, Kernel],
events.shift)
assert_equal(["line", 4, __method__, self.class],
events.shift)
@@ -197,13 +209,13 @@ class TestSetTraceFunc < Test::Unit::TestCase
events.shift)
assert_equal(["line", 8, __method__, self.class],
events.shift)
- assert_equal(["call", 4, :foo, self.class],
+ assert_equal(["call", 4, :meth_return2, self.class],
events.shift)
- assert_equal(["line", 5, :foo, self.class],
+ assert_equal(["line", 5, :meth_return2, self.class],
events.shift)
- assert_equal(["line", 6, :foo, self.class],
+ assert_equal(["line", 6, :meth_return2, self.class],
events.shift)
- assert_equal(["return", 7, :foo, self.class],
+ assert_equal(["return", 7, :meth_return2, self.class],
events.shift)
assert_equal(["line", 9, :test_return2, self.class],
events.shift)
@@ -214,9 +226,10 @@ class TestSetTraceFunc < Test::Unit::TestCase
def test_raise
events = []
- eval <<-EOF.gsub(/^.*?: /, "")
+ name = "#{self.class}\##{__method__}"
+ eval <<-EOF.gsub(/^.*?: /, ""), nil, name
1: set_trace_func(Proc.new { |event, file, lineno, mid, binding, klass|
- 2: events << [event, lineno, mid, klass]
+ 2: events << [event, lineno, mid, klass] if file == name
3: })
4: begin
5: raise TypeError, "error"
@@ -224,7 +237,7 @@ class TestSetTraceFunc < Test::Unit::TestCase
7: end
8: set_trace_func(nil)
EOF
- assert_equal(["c-return", 3, :set_trace_func, Kernel],
+ assert_equal(["c-return", 1, :set_trace_func, Kernel],
events.shift)
assert_equal(["line", 4, __method__, self.class],
events.shift)
@@ -244,10 +257,6 @@ class TestSetTraceFunc < Test::Unit::TestCase
events.shift)
assert_equal(["c-return", 5, :backtrace, Exception],
events.shift)
- assert_equal(["c-call", 5, :set_backtrace, Exception],
- events.shift)
- assert_equal(["c-return", 5, :set_backtrace, Exception],
- events.shift)
assert_equal(["raise", 5, :test_raise, TestSetTraceFunc],
events.shift)
assert_equal(["c-return", 5, :raise, Kernel],
@@ -265,15 +274,16 @@ class TestSetTraceFunc < Test::Unit::TestCase
def test_break # [ruby-core:27606] [Bug #2610]
events = []
- eval <<-EOF.gsub(/^.*?: /, "")
+ name = "#{self.class}\##{__method__}"
+ eval <<-EOF.gsub(/^.*?: /, ""), nil, name
1: set_trace_func(Proc.new { |event, file, lineno, mid, binding, klass|
- 2: events << [event, lineno, mid, klass]
+ 2: events << [event, lineno, mid, klass] if file == name
3: })
4: [1,2,3].any? {|n| n}
8: set_trace_func(nil)
EOF
- [["c-return", 3, :set_trace_func, Kernel],
+ [["c-return", 1, :set_trace_func, Kernel],
["line", 4, __method__, self.class],
["c-call", 4, :any?, Enumerable],
["c-call", 4, :each, Array],
@@ -300,18 +310,21 @@ class TestSetTraceFunc < Test::Unit::TestCase
prc = Proc.new { |event, file, lineno, mid, binding, klass|
events[:set] << [event, lineno, mid, klass, :set]
}
+ prc = prc # suppress warning
prc2 = Proc.new { |event, file, lineno, mid, binding, klass|
events[:add] << [event, lineno, mid, klass, :add]
}
+ prc2 = prc2 # suppress warning
th = Thread.new do
th = Thread.current
- eval <<-EOF.gsub(/^.*?: /, "")
+ name = "#{self.class}\##{__method__}"
+ eval <<-EOF.gsub(/^.*?: /, ""), nil, name
1: th.set_trace_func(prc)
2: th.add_trace_func(prc2)
3: class ThreadTraceInnerClass
4: def foo
- 5: x = 1 + 1
+ 5: _x = 1 + 1
6: end
7: end
8: ThreadTraceInnerClass.new.foo
@@ -357,17 +370,18 @@ class TestSetTraceFunc < Test::Unit::TestCase
def test_trace_defined_method
events = []
- eval <<-EOF.gsub(/^.*?: /, "")
+ name = "#{self.class}\##{__method__}"
+ eval <<-EOF.gsub(/^.*?: /, ""), nil, name
1: class FooBar; define_method(:foobar){}; end
2: fb = FooBar.new
3: set_trace_func(Proc.new { |event, file, lineno, mid, binding, klass|
- 4: events << [event, lineno, mid, klass]
+ 4: events << [event, lineno, mid, klass] if file == name
5: })
6: fb.foobar
7: set_trace_func(nil)
EOF
- [["c-return", 5, :set_trace_func, Kernel],
+ [["c-return", 3, :set_trace_func, Kernel],
["line", 6, __method__, self.class],
["call", 6, :foobar, FooBar],
["return", 6, :foobar, FooBar],
@@ -392,4 +406,622 @@ class TestSetTraceFunc < Test::Unit::TestCase
class << self
define_method(:method_added, Module.method(:method_added))
end
+
+ def trace_by_tracepoint *trace_events
+ events = []
+ trace = nil
+ xyzzy = nil
+ _local_var = :outer
+ raised_exc = nil
+ method = :trace_by_tracepoint
+ _get_data = lambda{|tp|
+ case tp.event
+ when :return, :c_return
+ tp.return_value
+ when :raise
+ tp.raised_exception
+ else
+ :nothing
+ end
+ }
+ _defined_class = lambda{|tp|
+ klass = tp.defined_class
+ begin
+ # If it is singleton method, then return original class
+ # to make compatible with set_trace_func().
+ # This is very ad-hoc hack. I hope I can make more clean test on it.
+ case klass.inspect
+ when /Class:TracePoint/; return TracePoint
+ when /Class:Exception/; return Exception
+ else klass
+ end
+ rescue Exception => e
+ e
+ end if klass
+ }
+
+ trace = nil
+ begin
+ eval <<-EOF.gsub(/^.*?: /, ""), nil, 'xyzzy'
+ 1: trace = TracePoint.trace(*trace_events){|tp| next if !target_thread?
+ 2: events << [tp.event, tp.lineno, tp.path, _defined_class.(tp), tp.method_id, tp.self, tp.binding.eval("_local_var"), _get_data.(tp)] if tp.path == 'xyzzy'
+ 3: }
+ 4: 1.times{|;_local_var| _local_var = :inner
+ 5: tap{}
+ 6: }
+ 7: class XYZZY
+ 8: _local_var = :XYZZY_outer
+ 9: def foo
+ 10: _local_var = :XYZZY_foo
+ 11: bar
+ 12: end
+ 13: def bar
+ 14: _local_var = :XYZZY_bar
+ 15: tap{}
+ 16: end
+ 17: end
+ 18: xyzzy = XYZZY.new
+ 19: xyzzy.foo
+ 20: begin; raise RuntimeError; rescue RuntimeError => raised_exc; end
+ 21: trace.disable
+ EOF
+ self.class.class_eval{remove_const(:XYZZY)}
+ ensure
+ trace.disable if trace && trace.enabled?
+ end
+
+ answer_events = [
+ #
+ [:c_return, 1, "xyzzy", TracePoint, :trace, TracePoint, :outer, trace],
+ [:line, 4, 'xyzzy', self.class, method, self, :outer, :nothing],
+ [:c_call, 4, 'xyzzy', Integer, :times, 1, :outer, :nothing],
+ [:line, 4, 'xyzzy', self.class, method, self, nil, :nothing],
+ [:line, 5, 'xyzzy', self.class, method, self, :inner, :nothing],
+ [:c_call, 5, 'xyzzy', Kernel, :tap, self, :inner, :nothing],
+ [:c_return, 5, "xyzzy", Kernel, :tap, self, :inner, self],
+ [:c_return, 4, "xyzzy", Integer, :times, 1, :outer, 1],
+ [:line, 7, 'xyzzy', self.class, method, self, :outer, :nothing],
+ [:c_call, 7, "xyzzy", Class, :inherited, Object, :outer, :nothing],
+ [:c_return, 7, "xyzzy", Class, :inherited, Object, :outer, nil],
+ [:class, 7, "xyzzy", nil, nil, xyzzy.class, nil, :nothing],
+ [:line, 8, "xyzzy", nil, nil, xyzzy.class, nil, :nothing],
+ [:line, 9, "xyzzy", nil, nil, xyzzy.class, :XYZZY_outer, :nothing],
+ [:c_call, 9, "xyzzy", Module, :method_added, xyzzy.class, :XYZZY_outer, :nothing],
+ [:c_return, 9, "xyzzy", Module, :method_added, xyzzy.class, :XYZZY_outer, nil],
+ [:line, 13, "xyzzy", nil, nil, xyzzy.class, :XYZZY_outer, :nothing],
+ [:c_call, 13, "xyzzy", Module, :method_added, xyzzy.class, :XYZZY_outer, :nothing],
+ [:c_return,13, "xyzzy", Module, :method_added, xyzzy.class, :XYZZY_outer, nil],
+ [:end, 17, "xyzzy", nil, nil, xyzzy.class, :XYZZY_outer, :nothing],
+ [:line, 18, "xyzzy", TestSetTraceFunc, method, self, :outer, :nothing],
+ [:c_call, 18, "xyzzy", Class, :new, xyzzy.class, :outer, :nothing],
+ [:c_call, 18, "xyzzy", BasicObject, :initialize, xyzzy, :outer, :nothing],
+ [:c_return,18, "xyzzy", BasicObject, :initialize, xyzzy, :outer, nil],
+ [:c_return,18, "xyzzy", Class, :new, xyzzy.class, :outer, xyzzy],
+ [:line, 19, "xyzzy", TestSetTraceFunc, method, self, :outer, :nothing],
+ [:call, 9, "xyzzy", xyzzy.class, :foo, xyzzy, nil, :nothing],
+ [:line, 10, "xyzzy", xyzzy.class, :foo, xyzzy, nil, :nothing],
+ [:line, 11, "xyzzy", xyzzy.class, :foo, xyzzy, :XYZZY_foo, :nothing],
+ [:call, 13, "xyzzy", xyzzy.class, :bar, xyzzy, nil, :nothing],
+ [:line, 14, "xyzzy", xyzzy.class, :bar, xyzzy, nil, :nothing],
+ [:line, 15, "xyzzy", xyzzy.class, :bar, xyzzy, :XYZZY_bar, :nothing],
+ [:c_call, 15, "xyzzy", Kernel, :tap, xyzzy, :XYZZY_bar, :nothing],
+ [:c_return,15, "xyzzy", Kernel, :tap, xyzzy, :XYZZY_bar, xyzzy],
+ [:return, 16, "xyzzy", xyzzy.class, :bar, xyzzy, :XYZZY_bar, xyzzy],
+ [:return, 12, "xyzzy", xyzzy.class, :foo, xyzzy, :XYZZY_foo, xyzzy],
+ [:line, 20, "xyzzy", TestSetTraceFunc, method, self, :outer, :nothing],
+ [:line, 20, "xyzzy", TestSetTraceFunc, method, self, :outer, :nothing],
+ [:c_call, 20, "xyzzy", Kernel, :raise, self, :outer, :nothing],
+ [:c_call, 20, "xyzzy", Exception, :exception, RuntimeError, :outer, :nothing],
+ [:c_call, 20, "xyzzy", Exception, :initialize, raised_exc, :outer, :nothing],
+ [:c_return,20, "xyzzy", Exception, :initialize, raised_exc, :outer, raised_exc],
+ [:c_return,20, "xyzzy", Exception, :exception, RuntimeError, :outer, raised_exc],
+ [:c_call, 20, "xyzzy", Exception, :backtrace, raised_exc, :outer, :nothing],
+ [:c_return,20, "xyzzy", Exception, :backtrace, raised_exc, :outer, nil],
+ [:raise, 20, "xyzzy", TestSetTraceFunc, :trace_by_tracepoint, self, :outer, raised_exc],
+ [:c_return,20, "xyzzy", Kernel, :raise, self, :outer, nil],
+ [:c_call, 20, "xyzzy", Module, :===, RuntimeError,:outer, :nothing],
+ [:c_return,20, "xyzzy", Module, :===, RuntimeError,:outer, true],
+ [:line, 21, "xyzzy", TestSetTraceFunc, method, self, :outer, :nothing],
+ [:c_call, 21, "xyzzy", TracePoint, :disable, trace, :outer, :nothing],
+ ]
+
+ return events, answer_events
+ end
+
+ def trace_by_set_trace_func
+ events = []
+ trace = nil
+ trace = trace
+ xyzzy = nil
+ xyzzy = xyzzy
+ _local_var = :outer
+ eval <<-EOF.gsub(/^.*?: /, ""), nil, 'xyzzy'
+ 1: set_trace_func(lambda{|event, file, line, id, binding, klass|
+ 2: events << [event, line, file, klass, id, binding.eval('self'), binding.eval("_local_var")] if file == 'xyzzy'
+ 3: })
+ 4: 1.times{|;_local_var| _local_var = :inner
+ 5: tap{}
+ 6: }
+ 7: class XYZZY
+ 8: _local_var = :XYZZY_outer
+ 9: def foo
+ 10: _local_var = :XYZZY_foo
+ 11: bar
+ 12: end
+ 13: def bar
+ 14: _local_var = :XYZZY_bar
+ 15: tap{}
+ 16: end
+ 17: end
+ 18: xyzzy = XYZZY.new
+ 19: xyzzy.foo
+ 20: begin; raise RuntimeError; rescue RuntimeError => raised_exc; end
+ 21: set_trace_func(nil)
+ EOF
+ self.class.class_eval{remove_const(:XYZZY)}
+ return events
+ end
+
+ def test_tracepoint
+ events1, answer_events = *trace_by_tracepoint(:line, :class, :end, :call, :return, :c_call, :c_return, :raise)
+
+ mesg = events1.map{|e|
+ if false
+ p [:event, e[0]]
+ p [:line_file, e[1], e[2]]
+ p [:id, e[4]]
+ end
+ "#{e[0]} - #{e[2]}:#{e[1]} id: #{e[4]}"
+ }.join("\n")
+ answer_events.zip(events1){|answer, event|
+ assert_equal answer, event, mesg
+ }
+
+ events2 = trace_by_set_trace_func
+ events1.zip(events2){|ev1, ev2|
+ ev2[0] = ev2[0].sub('-', '_').to_sym
+ assert_equal ev1[0..2], ev2[0..2], ev1.inspect
+
+ # event, line, file, klass, id, binding.eval('self'), binding.eval("_local_var")
+ assert_equal ev1[3].nil?, ev2[3].nil? # klass
+ assert_equal ev1[4].nil?, ev2[4].nil? # id
+ assert_equal ev1[6], ev2[6] # _local_var
+ }
+
+ [:line, :class, :end, :call, :return, :c_call, :c_return, :raise].each{|event|
+ events1, answer_events = *trace_by_tracepoint(event)
+ answer_events.find_all{|e| e[0] == event}.zip(events1){|answer_line, event_line|
+ assert_equal answer_line, event_line
+ }
+ }
+ end
+
+ def test_tracepoint_object_id
+ tps = []
+ trace = TracePoint.trace(){|tp|
+ next if !target_thread?
+ tps << tp
+ }
+ tap{}
+ tap{}
+ tap{}
+ trace.disable
+
+ # passed tp is unique, `trace' object which is genereted by TracePoint.trace
+ tps.each{|tp|
+ assert_equal trace, tp
+ }
+ end
+
+ def test_tracepoint_access_from_outside
+ tp_store = nil
+ trace = TracePoint.trace(){|tp|
+ next if !target_thread?
+ tp_store = tp
+ }
+ tap{}
+ trace.disable
+
+ assert_raise(RuntimeError){tp_store.lineno}
+ assert_raise(RuntimeError){tp_store.event}
+ assert_raise(RuntimeError){tp_store.path}
+ assert_raise(RuntimeError){tp_store.method_id}
+ assert_raise(RuntimeError){tp_store.defined_class}
+ assert_raise(RuntimeError){tp_store.binding}
+ assert_raise(RuntimeError){tp_store.self}
+ assert_raise(RuntimeError){tp_store.return_value}
+ assert_raise(RuntimeError){tp_store.raised_exception}
+ end
+
+ def foo
+ end
+
+ def test_tracepoint_enable
+ ary = []
+ trace = TracePoint.new(:call){|tp|
+ next if !target_thread?
+ ary << tp.method_id
+ }
+ foo
+ trace.enable{
+ foo
+ }
+ foo
+ assert_equal([:foo], ary)
+
+ trace = TracePoint.new{}
+ begin
+ assert_equal(false, trace.enable)
+ assert_equal(true, trace.enable)
+ trace.enable{}
+ assert_equal(true, trace.enable)
+ ensure
+ trace.disable
+ end
+ end
+
+ def test_tracepoint_disable
+ ary = []
+ trace = TracePoint.trace(:call){|tp|
+ next if !target_thread?
+ ary << tp.method_id
+ }
+ foo
+ trace.disable{
+ foo
+ }
+ foo
+ trace.disable
+ assert_equal([:foo, :foo], ary)
+
+ trace = TracePoint.new{}
+ trace.enable{
+ assert_equal(true, trace.disable)
+ assert_equal(false, trace.disable)
+ trace.disable{}
+ assert_equal(false, trace.disable)
+ }
+ end
+
+ def test_tracepoint_enabled
+ trace = TracePoint.trace(:call){|tp|
+ #
+ }
+ assert_equal(true, trace.enabled?)
+ trace.disable{
+ assert_equal(false, trace.enabled?)
+ trace.enable{
+ assert_equal(true, trace.enabled?)
+ }
+ }
+ trace.disable
+ assert_equal(false, trace.enabled?)
+ end
+
+ def method_test_tracepoint_return_value obj
+ obj
+ end
+
+ def test_tracepoint_return_value
+ trace = TracePoint.new(:call, :return){|tp|
+ next if !target_thread?
+ next if tp.path != __FILE__
+ case tp.event
+ when :call
+ assert_raise(RuntimeError) {tp.return_value}
+ when :return
+ assert_equal("xyzzy", tp.return_value)
+ end
+ }
+ trace.enable{
+ method_test_tracepoint_return_value "xyzzy"
+ }
+ end
+
+ class XYZZYException < Exception; end
+ def method_test_tracepoint_raised_exception err
+ raise err
+ end
+
+ def test_tracepoint_raised_exception
+ trace = TracePoint.new(:call, :return){|tp|
+ next if !target_thread?
+ case tp.event
+ when :call, :return
+ assert_raise(RuntimeError) { tp.raised_exception }
+ when :raise
+ assert_equal(XYZZYError, tp.raised_exception)
+ end
+ }
+ trace.enable{
+ begin
+ method_test_tracepoint_raised_exception XYZZYException
+ rescue XYZZYException
+ # ok
+ else
+ raise
+ end
+ }
+ end
+
+ def method_for_test_tracepoint_block
+ yield
+ end
+
+ def test_tracepoint_block
+ events = []
+ TracePoint.new(:call, :return, :c_call, :b_call, :c_return, :b_return){|tp|
+ next if !target_thread?
+ events << [
+ tp.event, tp.method_id, tp.defined_class, tp.self.class,
+ /return/ =~ tp.event ? tp.return_value : nil
+ ]
+ }.enable{
+ 1.times{
+ 3
+ }
+ method_for_test_tracepoint_block{
+ 4
+ }
+ }
+ # pp events
+ # expected_events =
+ [[:b_call, :test_tracepoint_block, TestSetTraceFunc, TestSetTraceFunc, nil],
+ [:c_call, :times, Integer, Fixnum, nil],
+ [:b_call, :test_tracepoint_block, TestSetTraceFunc, TestSetTraceFunc, nil],
+ [:b_return, :test_tracepoint_block, TestSetTraceFunc, TestSetTraceFunc, 3],
+ [:c_return, :times, Integer, Fixnum, 1],
+ [:call, :method_for_test_tracepoint_block, TestSetTraceFunc, TestSetTraceFunc, nil],
+ [:b_call, :test_tracepoint_block, TestSetTraceFunc, TestSetTraceFunc, nil],
+ [:b_return, :test_tracepoint_block, TestSetTraceFunc, TestSetTraceFunc, 4],
+ [:return, :method_for_test_tracepoint_block, TestSetTraceFunc, TestSetTraceFunc, 4],
+ [:b_return, :test_tracepoint_block, TestSetTraceFunc, TestSetTraceFunc, 4]
+ ].zip(events){|expected, actual|
+ assert_equal(expected, actual)
+ }
+ end
+
+ def test_tracepoint_thread
+ events = []
+ thread_self = nil
+ created_thread = nil
+ TracePoint.new(:thread_begin, :thread_end){|tp|
+ events << [Thread.current,
+ tp.event,
+ tp.lineno, #=> 0
+ tp.path, #=> nil
+ tp.binding, #=> nil
+ tp.defined_class, #=> nil,
+ tp.self.class # tp.self return creating/ending thread
+ ]
+ }.enable{
+ created_thread = Thread.new{thread_self = self}
+ created_thread.join
+ }
+ events.reject!{|i| i[0] != created_thread}
+ assert_equal(self, thread_self)
+ assert_equal([created_thread, :thread_begin, 0, nil, nil, nil, Thread], events[0])
+ assert_equal([created_thread, :thread_end, 0, nil, nil, nil, Thread], events[1])
+ assert_equal(2, events.size)
+ end
+
+ def test_tracepoint_inspect
+ events = []
+ trace = TracePoint.new{|tp|
+ next if !target_thread?
+ events << [tp.event, tp.inspect]
+ }
+ assert_equal("#<TracePoint:disabled>", trace.inspect)
+ trace.enable{
+ assert_equal("#<TracePoint:enabled>", trace.inspect)
+ Thread.new{}.join
+ }
+ assert_equal("#<TracePoint:disabled>", trace.inspect)
+ events.each{|(ev, str)|
+ case ev
+ when :line
+ assert_match(/ in /, str)
+ when :call, :c_call
+ assert_match(/call \`/, str) # #<TracePoint:c_call `inherited'@../trunk/test.rb:11>
+ when :return, :c_return
+ assert_match(/return \`/, str) # #<TracePoint:return `m'@../trunk/test.rb:3>
+ when /thread/
+ assert_match(/\#<Thread:/, str) # #<TracePoint:thread_end of #<Thread:0x87076c0>>
+ else
+ assert_match(/\#<TracePoint:/, str)
+ end
+ }
+ end
+
+ def test_tracepoint_exception_at_line
+ assert_raise(RuntimeError) do
+ TracePoint.new(:line) {
+ next if !target_thread?
+ raise
+ }.enable {
+ 1
+ }
+ end
+ end
+
+ def test_tracepoint_exception_at_return
+ assert_nothing_raised(Timeout::Error, 'infinite trace') do
+ assert_normal_exit('def m; end; TracePoint.new(:return) {raise}.enable {m}', '', timeout: 3)
+ end
+ end
+
+ def test_tracepoint_with_multithreads
+ assert_nothing_raised do
+ TracePoint.new{
+ 10.times{
+ Thread.pass
+ }
+ }.enable do
+ (1..10).map{
+ Thread.new{
+ 1000.times{
+ }
+ }
+ }.each{|th|
+ th.join
+ }
+ end
+ end
+ end
+
+ class FOO_ERROR < RuntimeError; end
+ class BAR_ERROR < RuntimeError; end
+ def m1_test_trace_point_at_return_when_exception
+ m2_test_trace_point_at_return_when_exception
+ end
+ def m2_test_trace_point_at_return_when_exception
+ raise BAR_ERROR
+ end
+
+ def test_trace_point_at_return_when_exception
+ bug_7624 = '[ruby-core:51128] [ruby-trunk - Bug #7624]'
+ TracePoint.new{|tp|
+ next if !target_thread?
+ if tp.event == :return &&
+ tp.method_id == :m2_test_trace_point_at_return_when_exception
+ raise FOO_ERROR
+ end
+ }.enable do
+ assert_raise(FOO_ERROR, bug_7624) do
+ m1_test_trace_point_at_return_when_exception
+ end
+ end
+
+ bug_7668 = '[Bug #7668]'
+ ary = []
+ trace = TracePoint.new{|tp|
+ next if !target_thread?
+ ary << tp.event
+ raise
+ }
+ begin
+ trace.enable{
+ 1.times{
+ raise
+ }
+ }
+ rescue
+ assert_equal([:b_call, :b_return], ary, bug_7668)
+ end
+ end
+
+ def m1_for_test_trace_point_binding_in_ifunc(arg)
+ arg + nil
+ rescue
+ end
+
+ def m2_for_test_trace_point_binding_in_ifunc(arg)
+ arg.inject(:+)
+ rescue
+ end
+
+ def test_trace_point_binding_in_ifunc
+ bug7774 = '[ruby-dev:46908]'
+ src = %q{
+ tp = TracePoint.new(:raise) do |tp|
+ tp.binding
+ end
+ tp.enable do
+ obj = Object.new
+ class << obj
+ include Enumerable
+ def each
+ yield 1
+ end
+ end
+ %s
+ end
+ }
+ assert_normal_exit src % %q{obj.zip({}) {}}, bug7774
+ assert_normal_exit src % %q{
+ require 'continuation'
+ begin
+ c = nil
+ obj.sort_by {|x| callcc {|c2| c ||= c2 }; x }
+ c.call
+ rescue RuntimeError
+ end
+ }, bug7774
+
+ # TracePoint
+ tp_b = nil
+ TracePoint.new(:raise) do |tp|
+ next if !target_thread?
+ tp_b = tp.binding
+ end.enable do
+ m1_for_test_trace_point_binding_in_ifunc(0)
+ assert_equal(self, eval('self', tp_b), '[ruby-dev:46960]')
+
+ m2_for_test_trace_point_binding_in_ifunc([0, nil])
+ assert_equal(self, eval('self', tp_b), '[ruby-dev:46960]')
+ end
+
+ # set_trace_func
+ stf_b = nil
+ set_trace_func ->(event, file, line, id, binding, klass) do
+ stf_b = binding if event == 'raise'
+ end
+ begin
+ m1_for_test_trace_point_binding_in_ifunc(0)
+ assert_equal(self, eval('self', stf_b), '[ruby-dev:46960]')
+
+ m2_for_test_trace_point_binding_in_ifunc([0, nil])
+ assert_equal(self, eval('self', stf_b), '[ruby-dev:46960]')
+ ensure
+ set_trace_func(nil)
+ end
+ end
+
+ def test_tracepoint_b_return_with_next
+ n = 0
+ TracePoint.new(:b_return){
+ next if !target_thread?
+ n += 1
+ }.enable{
+ 3.times{
+ next
+ } # 3 times b_retun
+ } # 1 time b_return
+
+ assert_equal 4, n
+ end
+
+ def test_tracepoint_b_return_with_lambda
+ n = 0
+ TracePoint.new(:b_return){
+ next if !target_thread?
+ n+=1
+ }.enable{
+ lambda{
+ return
+ }.call # n += 1 #=> 1
+ 3.times{
+ lambda{
+ return # n += 3 #=> 4
+ }.call
+ } # n += 3 #=> 7
+ begin
+ lambda{
+ raise
+ }.call # n += 1 #=> 8
+ rescue
+ # ignore
+ end # n += 1 #=> 9
+ }
+
+ assert_equal 9, n
+ end
+
+ def test_isolated_raise_in_trace
+ bug9088 = '[ruby-dev:47793] [Bug #9088]'
+ assert_ruby_status([], <<-END, bug9088)
+ set_trace_func proc {raise rescue nil}
+ 1.times {break}
+ END
+ end
end
diff --git a/test/ruby/test_signal.rb b/test/ruby/test_signal.rb
index c226fdd611..c7bcc4a375 100644
--- a/test/ruby/test_signal.rb
+++ b/test/ruby/test_signal.rb
@@ -4,17 +4,7 @@ require 'tempfile'
require_relative 'envutil'
class TestSignal < Test::Unit::TestCase
- def have_fork?
- begin
- Process.fork {}
- return true
- rescue NotImplementedError
- return false
- end
- end
-
def test_signal
- return unless Process.respond_to?(:kill)
begin
x = 0
oldtrap = Signal.trap(:INT) {|sig| x = 2 }
@@ -26,70 +16,64 @@ class TestSignal < Test::Unit::TestCase
assert_equal 2, x
Signal.trap(:INT) { raise "Interrupt" }
- ex = assert_raise(RuntimeError) {
+ assert_raise_with_message(RuntimeError, /Interrupt/) {
Process.kill :INT, Process.pid
sleep 0.1
}
- assert_kind_of Exception, ex
- assert_match(/Interrupt/, ex.message)
ensure
Signal.trap :INT, oldtrap if oldtrap
end
- end
+ end if Process.respond_to?(:kill)
def test_signal_process_group
- return unless Process.respond_to?(:kill)
- return unless Process.respond_to?(:pgroup) # for mswin32
-
bug4362 = '[ruby-dev:43169]'
assert_nothing_raised(bug4362) do
- pid = Process.spawn(EnvUtil.rubybin, '-e', '"sleep 10"', :pgroup => true)
+ pid = Process.spawn(EnvUtil.rubybin, '-e', 'sleep 10', :pgroup => true)
Process.kill(:"-TERM", pid)
Process.waitpid(pid)
assert_equal(true, $?.signaled?)
assert_equal(Signal.list["TERM"], $?.termsig)
end
- end
+ end if Process.respond_to?(:kill) and
+ Process.respond_to?(:pgroup) # for mswin32
def test_exit_action
- return unless have_fork? # skip this test
- begin
- r, w = IO.pipe
- r0, w0 = IO.pipe
- pid = Process.spawn(EnvUtil.rubybin, '-e', <<-'End', 3=>w, 4=>r0)
- w = IO.new(3, "w")
- r0 = IO.new(4, "r")
- Signal.trap(:USR1, "EXIT")
- w.syswrite("a")
+ if Signal.list[sig = "USR1"]
+ term = :TERM
+ else
+ sig = "INT"
+ term = :KILL
+ end
+ IO.popen([EnvUtil.rubybin, '-e', <<-"End"], 'r+') do |io|
+ Signal.trap(:#{sig}, "EXIT")
+ STDOUT.syswrite("a")
Thread.start { sleep(2) }
- r0.sysread(4096)
+ STDIN.sysread(4096)
End
- r.sysread(1)
+ pid = io.pid
+ io.sysread(1)
sleep 0.1
assert_nothing_raised("[ruby-dev:26128]") {
- Process.kill(:USR1, pid)
+ Process.kill(term, pid)
begin
Timeout.timeout(3) {
Process.waitpid pid
}
rescue Timeout::Error
- Process.kill(:TERM, pid)
+ if term
+ Process.kill(term, pid)
+ term = (:KILL if term != :KILL)
+ retry
+ end
raise
end
}
- ensure
- r.close
- w.close
- r0.close
- w0.close
end
- end
+ end if Process.respond_to?(:kill)
def test_invalid_signal_name
- return unless Process.respond_to?(:kill)
-
assert_raise(ArgumentError) { Process.kill(:XXXXXXXXXX, $$) }
- end
+ end if Process.respond_to?(:kill)
def test_signal_exception
assert_raise(ArgumentError) { SignalException.new }
@@ -108,7 +92,6 @@ class TestSignal < Test::Unit::TestCase
end
def test_signal2
- return unless Process.respond_to?(:kill)
begin
x = false
oldtrap = Signal.trap(:INT) {|sig| x = true }
@@ -141,10 +124,9 @@ class TestSignal < Test::Unit::TestCase
ensure
Signal.trap(:INT, oldtrap) if oldtrap
end
- end
+ end if Process.respond_to?(:kill)
def test_trap
- return unless Process.respond_to?(:kill)
begin
oldtrap = Signal.trap(:INT) {|sig| }
@@ -182,20 +164,15 @@ class TestSignal < Test::Unit::TestCase
ensure
Signal.trap(:INT, oldtrap) if oldtrap
end
- end
+ end if Process.respond_to?(:kill)
def test_kill_immediately_before_termination
- return unless have_fork? # skip this test
-
- r, w = IO.pipe
- pid = Process.fork do
- r.close
- Signal.trap(:USR1) { w.syswrite("foo") }
- Process.kill :USR1, $$
- end
- w.close
- assert_equal(r.read, "foo")
- end
+ Signal.list[sig = "USR1"] or sig = "INT"
+ assert_in_out_err(["-e", <<-"end;"], "", %w"foo")
+ Signal.trap(:#{sig}) { STDOUT.syswrite("foo") }
+ Process.kill :#{sig}, $$
+ end;
+ end if Process.respond_to?(:kill)
def test_signal_requiring
t = Tempfile.new(%w"require_ensure_test .rb")
@@ -207,7 +184,8 @@ th = Thread.new do
begin
require ARGV[0]
ensure
- Marshal.dump($!, STDOUT)
+ err = $! ? [$!, $!.backtrace] : $!
+ Marshal.dump(err, STDOUT)
STDOUT.flush
end
end
@@ -219,5 +197,72 @@ EOS
end
t.close!
assert_nil(error)
+ end if Process.respond_to?(:kill)
+
+ def test_reserved_signal
+ assert_raise(ArgumentError) {
+ Signal.trap(:SEGV) {}
+ }
+ assert_raise(ArgumentError) {
+ Signal.trap(:BUS) {}
+ }
+ assert_raise(ArgumentError) {
+ Signal.trap(:ILL) {}
+ }
+ assert_raise(ArgumentError) {
+ Signal.trap(:FPE) {}
+ }
+ assert_raise(ArgumentError) {
+ Signal.trap(:VTALRM) {}
+ }
end
+
+ def test_signame
+ 10.times do
+ IO.popen([EnvUtil.rubybin, "-e", <<EOS, :err => File::NULL]) do |child|
+ Signal.trap("INT") do |signo|
+ signame = Signal.signame(signo)
+ Marshal.dump(signame, STDOUT)
+ STDOUT.flush
+ exit 0
+ end
+ Process.kill("INT", $$)
+ sleep 1 # wait signal deliver
+EOS
+
+ signame = Marshal.load(child)
+ assert_equal(signame, "INT")
+ end
+ end
+ end if Process.respond_to?(:kill)
+
+ def test_trap_puts
+ assert_in_out_err([], <<-INPUT, ["a"*10000], [])
+ Signal.trap(:INT) {
+ # for enable internal io mutex
+ STDOUT.sync = false
+ # larger than internal io buffer
+ print "a"*10000
+ }
+ Process.kill :INT, $$
+ sleep 0.1
+ INPUT
+ end if Process.respond_to?(:kill)
+
+ def test_hup_me
+ # [Bug #7951] [ruby-core:52864]
+ # This is MRI specific spec. ruby has no guarantee
+ # that signal will be deliverd synchronously.
+ # This ugly workaround was introduced to don't break
+ # compatibility against silly example codes.
+ assert_raise(SignalException) {
+ Process.kill('HUP', Process.pid)
+ }
+ bug8137 = '[ruby-dev:47182] [Bug #8137]'
+ assert_nothing_raised(bug8137) {
+ Timeout.timeout(1) {
+ Process.kill(0, Process.pid)
+ }
+ }
+ end if Process.respond_to?(:kill) and Signal.list.key?('HUP')
end
diff --git a/test/ruby/test_sleep.rb b/test/ruby/test_sleep.rb
index 989ced92c7..fdf08aafa1 100644
--- a/test/ruby/test_sleep.rb
+++ b/test/ruby/test_sleep.rb
@@ -6,8 +6,15 @@ class TestSleep < Test::Unit::TestCase
start = Time.now
sleep 5
slept = Time.now-start
- bottom = /linux/ =~ RUBY_PLATFORM && /Linux ([\d.]+)/ =~ `uname -sr` && ($1.split('.')<=>%w/2 6 18/)<1 ? 4.99 : 5.0
- assert_operator(bottom, :<=, slept)
+ bottom =
+ case RUBY_PLATFORM
+ when /linux/
+ 4.98 if /Linux ([\d.]+)/ =~ `uname -sr` && ($1.split('.')<=>%w/2 6 18/)<1
+ when /mswin|mingw/
+ 4.98
+ end
+ bottom ||= 5.0
+ assert_operator(slept, :>=, bottom)
assert_operator(slept, :<=, 6.0, "[ruby-core:18015]: longer than expected")
ensure
GC.enable
diff --git a/test/ruby/test_sprintf.rb b/test/ruby/test_sprintf.rb
index 218d2188b7..aba71153ee 100644
--- a/test/ruby/test_sprintf.rb
+++ b/test/ruby/test_sprintf.rb
@@ -323,12 +323,54 @@ class TestSprintf < Test::Unit::TestCase
assert(b1 == b2, "[ruby-dev:33224]")
end
- def test_named
+ def test_named_untyped
assert_equal("value", sprintf("%<key>s", :key => "value"))
- assert_raise(ArgumentError) {sprintf("%1$<key2>s", :key => "value")}
- assert_raise(ArgumentError) {sprintf("%<key><key2>s", :key => "value")}
+ assert_raise_with_message(ArgumentError, "named<key2> after numbered") {sprintf("%1$<key2>s", :key => "value")}
+ assert_raise_with_message(ArgumentError, "named<key2> after unnumbered(2)") {sprintf("%s%s%<key2>s", "foo", "bar", :key => "value")}
+ assert_raise_with_message(ArgumentError, "named<key2> after <key>") {sprintf("%<key><key2>s", :key => "value")}
+ assert_raise_with_message(KeyError, "key<key> not found") {sprintf("%<key>s", {})}
+ end
+
+ def test_named_untyped_enc
+ key = "\u{3012}"
+ [Encoding::UTF_8, Encoding::EUC_JP].each do |enc|
+ k = key.encode(enc)
+ e = assert_raise_with_message(ArgumentError, "named<#{k}> after numbered") {sprintf("%1$<#{k}>s", key: "value")}
+ assert_equal(enc, e.message.encoding)
+ e = assert_raise_with_message(ArgumentError, "named<#{k}> after unnumbered(2)") {sprintf("%s%s%<#{k}>s", "foo", "bar", key: "value")}
+ assert_equal(enc, e.message.encoding)
+ e = assert_raise_with_message(ArgumentError, "named<#{k}> after <key>") {sprintf("%<key><#{k}>s", key: "value")}
+ assert_equal(enc, e.message.encoding)
+ e = assert_raise_with_message(ArgumentError, "named<key> after <#{k}>") {sprintf("%<#{k}><key>s", k.to_sym => "value")}
+ assert_equal(enc, e.message.encoding)
+ e = assert_raise_with_message(KeyError, "key<#{k}> not found") {sprintf("%<#{k}>s", {})}
+ assert_equal(enc, e.message.encoding)
+ end
+ end
+
+ def test_named_typed
assert_equal("value", sprintf("%{key}", :key => "value"))
- assert_raise(ArgumentError) {sprintf("%1${key2}", :key => "value")}
+ assert_raise_with_message(ArgumentError, "named{key2} after numbered") {sprintf("%1${key2}", :key => "value")}
+ assert_raise_with_message(ArgumentError, "named{key2} after unnumbered(2)") {sprintf("%s%s%{key2}", "foo", "bar", :key => "value")}
+ assert_raise_with_message(ArgumentError, "named{key2} after <key>") {sprintf("%<key>{key2}", :key => "value")}
assert_equal("value{key2}", sprintf("%{key}{key2}", :key => "value"))
+ assert_raise_with_message(KeyError, "key{key} not found") {sprintf("%{key}", {})}
+ end
+
+ def test_named_typed_enc
+ key = "\u{3012}"
+ [Encoding::UTF_8, Encoding::EUC_JP].each do |enc|
+ k = key.encode(enc)
+ e = assert_raise_with_message(ArgumentError, "named{#{k}} after numbered") {sprintf("%1${#{k}}s", key: "value")}
+ assert_equal(enc, e.message.encoding)
+ e = assert_raise_with_message(ArgumentError, "named{#{k}} after unnumbered(2)") {sprintf("%s%s%{#{k}}s", "foo", "bar", key: "value")}
+ assert_equal(enc, e.message.encoding)
+ e = assert_raise_with_message(ArgumentError, "named{#{k}} after <key>") {sprintf("%<key>{#{k}}s", key: "value")}
+ assert_equal(enc, e.message.encoding)
+ e = assert_raise_with_message(ArgumentError, "named{key} after <#{k}>") {sprintf("%<#{k}>{key}s", k.to_sym => "value")}
+ assert_equal(enc, e.message.encoding)
+ e = assert_raise_with_message(KeyError, "key{#{k}} not found") {sprintf("%{#{k}}", {})}
+ assert_equal(enc, e.message.encoding)
+ end
end
end
diff --git a/test/ruby/test_sprintf_comb.rb b/test/ruby/test_sprintf_comb.rb
index 261732bcbc..c58ddf4f15 100644
--- a/test/ruby/test_sprintf_comb.rb
+++ b/test/ruby/test_sprintf_comb.rb
@@ -107,7 +107,9 @@ class TestSprintfComb < Test::Unit::TestCase
]
VS.reverse!
- def combination(*args, &b)
+ FLAGS = [['', ' '], ['', '#'], ['', '+'], ['', '-'], ['', '0']]
+
+ def self.combination(*args, &b)
#AllPairs.exhaustive_each(*args, &b)
AllPairs.each(*args, &b)
end
@@ -268,17 +270,8 @@ class TestSprintfComb < Test::Unit::TestCase
str
end
- def test_format_integer
- combination(
- %w[B b d o X x],
- [nil, 0, 5, 20],
- ["", ".", ".0", ".8", ".20"],
- ['', ' '],
- ['', '#'],
- ['', '+'],
- ['', '-'],
- ['', '0']) {|type, width, precision, sp, hs, pl, mi, zr|
- format = "%#{sp}#{hs}#{pl}#{mi}#{zr}#{width}#{precision}#{type}"
+ def self.assertions_format_integer(format)
+ proc {
VS.each {|v|
r = sprintf format, v
e = emu_int format, v
@@ -293,6 +286,14 @@ class TestSprintfComb < Test::Unit::TestCase
}
end
+ combination(%w[B b d o X x],
+ [nil, 0, 5, 20],
+ ["", ".", ".0", ".8", ".20"],
+ *FLAGS) {|type, width, precision, sp, hs, pl, mi, zr|
+ format = "%#{sp}#{hs}#{pl}#{mi}#{zr}#{width}#{precision}#{type}"
+ define_method("test_format_integer(#{format})", assertions_format_integer(format))
+ }
+
FLOAT_VALUES = [
-1e100,
-123456789.0,
@@ -526,17 +527,8 @@ class TestSprintfComb < Test::Unit::TestCase
end
- def test_format_float
- combination(
- %w[e E f g G],
- [nil, 0, 5, 20],
- ["", ".", ".0", ".8", ".20", ".200"],
- ['', ' '],
- ['', '#'],
- ['', '+'],
- ['', '-'],
- ['', '0']) {|type, width, precision, sp, hs, pl, mi, zr|
- format = "%#{sp}#{hs}#{pl}#{mi}#{zr}#{width}#{precision}#{type}"
+ def self.assertions_format_float(format)
+ proc {
FLOAT_VALUES.each {|v|
r = sprintf format, v
e = emu_float format, v
@@ -550,4 +542,12 @@ class TestSprintfComb < Test::Unit::TestCase
}
}
end
+
+ combination(%w[e E f g G],
+ [nil, 0, 5, 20],
+ ["", ".", ".0", ".8", ".20", ".200", ".9999"],
+ *FLAGS) {|type, width, precision, sp, hs, pl, mi, zr|
+ format = "%#{sp}#{hs}#{pl}#{mi}#{zr}#{width}#{precision}#{type}"
+ define_method("test_format_float(#{format})", assertions_format_float(format))
+ }
end
diff --git a/test/ruby/test_string.rb b/test/ruby/test_string.rb
index 6185e23c90..537af2fded 100644
--- a/test/ruby/test_string.rb
+++ b/test/ruby/test_string.rb
@@ -6,6 +6,7 @@ def pre_1_7_1
end
class TestString < Test::Unit::TestCase
+ ENUMERATOR_WANTARRAY = RUBY_VERSION >= "3.0.0"
def initialize(*args)
@cls = String
@@ -170,8 +171,9 @@ class TestString < Test::Unit::TestCase
o = Object.new
def o.to_str; "bar"; end
- assert_nil("foo" <=> o)
+ assert_equal(1, "foo" <=> o)
+ class << o;remove_method :to_str;end
def o.<=>(x); nil; end
assert_nil("foo" <=> o)
@@ -181,22 +183,22 @@ class TestString < Test::Unit::TestCase
class << o;remove_method :<=>;end
def o.<=>(x); 2**100; end
- assert_equal(-(2**100), "foo" <=> o)
+ assert_equal(-1, "foo" <=> o)
end
def test_EQUAL # '=='
- assert_equal(false, S("foo") == :foo)
- assert(S("abcdef") == S("abcdef"))
+ assert_not_equal(:foo, S("foo"))
+ assert_equal(S("abcdef"), S("abcdef"))
pre_1_7_1 do
$= = true
- assert(S("CAT") == S('cat'))
- assert(S("CaT") == S('cAt'))
+ assert_equal(S("CAT"), S('cat'))
+ assert_equal(S("CaT"), S('cAt'))
$= = false
end
- assert(S("CAT") != S('cat'))
- assert(S("CaT") != S('cAt'))
+ assert_not_equal(S("CAT"), S('cat'))
+ assert_not_equal(S("CaT"), S('cAt'))
o = Object.new
def o.to_str; end
@@ -209,7 +211,7 @@ class TestString < Test::Unit::TestCase
def test_LSHIFT # '<<'
assert_equal(S("world!"), S("world") << 33)
- assert_equal(S("world!"), S("world") << S('!'))
+ assert_equal(S("world!"), S("world") << S("!"))
s = "a"
10.times {|i|
@@ -278,11 +280,12 @@ class TestString < Test::Unit::TestCase
end
def casetest(a, b, rev=false)
+ msg = proc {"#{a} should#{' not' if rev} match #{b}"}
case a
when b
- assert(!rev)
+ assert(!rev, msg)
else
- assert(rev)
+ assert(rev, msg)
end
end
@@ -449,20 +452,16 @@ class TestString < Test::Unit::TestCase
def test_clone
for taint in [ false, true ]
- for untrust in [ false, true ]
- for frozen in [ false, true ]
- a = S("Cool")
- a.taint if taint
- a.untrust if untrust
- a.freeze if frozen
- b = a.clone
-
- assert_equal(a, b)
- assert(a.__id__ != b.__id__)
- assert_equal(a.frozen?, b.frozen?)
- assert_equal(a.untrusted?, b.untrusted?)
- assert_equal(a.tainted?, b.tainted?)
- end
+ for frozen in [ false, true ]
+ a = S("Cool")
+ a.taint if taint
+ a.freeze if frozen
+ b = a.clone
+
+ assert_equal(a, b)
+ assert_not_same(a, b)
+ assert_equal(a.frozen?, b.frozen?)
+ assert_equal(a.tainted?, b.tainted?)
end
end
@@ -473,6 +472,12 @@ class TestString < Test::Unit::TestCase
def test_concat
assert_equal(S("world!"), S("world").concat(33))
assert_equal(S("world!"), S("world").concat(S('!')))
+
+ bug7090 = '[ruby-core:47751]'
+ result = S("").force_encoding(Encoding::UTF_16LE)
+ result << 0x0300
+ expected = S("\u0300".encode(Encoding::UTF_16LE))
+ assert_equal(expected, result, bug7090)
end
def test_count
@@ -483,15 +488,22 @@ class TestString < Test::Unit::TestCase
assert_equal(4, a.count(S("ej-m")))
assert_equal(0, S("y").count(S("a\\-z")))
assert_equal(5, "abc\u{3042 3044 3046}".count("^a"))
+ assert_equal(1, "abc\u{3042 3044 3046}".count("\u3042"))
assert_equal(5, "abc\u{3042 3044 3046}".count("^\u3042"))
assert_equal(2, "abc\u{3042 3044 3046}".count("a-z", "^a"))
+ assert_equal(0, "abc\u{3042 3044 3046}".count("a", "\u3042"))
+ assert_equal(0, "abc\u{3042 3044 3046}".count("\u3042", "a"))
+ assert_equal(0, "abc\u{3042 3044 3046}".count("\u3042", "\u3044"))
+ assert_equal(4, "abc\u{3042 3044 3046}".count("^a", "^\u3044"))
+ assert_equal(4, "abc\u{3042 3044 3046}".count("^\u3044", "^a"))
+ assert_equal(4, "abc\u{3042 3044 3046}".count("^\u3042", "^\u3044"))
assert_raise(ArgumentError) { "foo".count }
end
def test_crypt
assert_equal(S('aaGUC/JkO9/Sc'), S("mypassword").crypt(S("aa")))
- assert(S('aaGUC/JkO9/Sc') != S("mypassword").crypt(S("ab")))
+ assert_not_equal(S('aaGUC/JkO9/Sc'), S("mypassword").crypt(S("ab")))
end
def test_delete
@@ -508,6 +520,9 @@ class TestString < Test::Unit::TestCase
assert_equal("a", "abc\u{3042 3044 3046}".delete("^a"))
assert_equal("bc\u{3042 3044 3046}", "abc\u{3042 3044 3046}".delete("a"))
assert_equal("\u3042", "abc\u{3042 3044 3046}".delete("^\u3042"))
+
+ bug6160 = '[ruby-dev:45374]'
+ assert_equal("", '\\'.delete('\\'), bug6160)
end
def test_delete!
@@ -570,20 +585,16 @@ class TestString < Test::Unit::TestCase
def test_dup
for taint in [ false, true ]
- for untrust in [ false, true ]
- for frozen in [ false, true ]
- a = S("hello")
- a.taint if taint
- a.untrust if untrust
- a.freeze if frozen
- b = a.dup
-
- assert_equal(a, b)
- assert(a.__id__ != b.__id__)
- assert(!b.frozen?)
- assert_equal(a.tainted?, b.tainted?)
- assert_equal(a.untrusted?, b.untrusted?)
- end
+ for frozen in [ false, true ]
+ a = S("hello")
+ a.taint if taint
+ a.freeze if frozen
+ b = a.dup
+
+ assert_equal(a, b)
+ assert_not_same(a, b)
+ assert_not_predicate(b, :frozen?)
+ assert_equal(a.tainted?, b.tainted?)
end
end
end
@@ -610,49 +621,183 @@ class TestString < Test::Unit::TestCase
end
def test_each_byte
+ s = S("ABC")
+
res = []
- S("ABC").each_byte {|x| res << x }
+ assert_equal s.object_id, s.each_byte {|x| res << x }.object_id
assert_equal(65, res[0])
assert_equal(66, res[1])
assert_equal(67, res[2])
+
+ assert_equal 65, s.each_byte.next
+ end
+
+ def test_bytes
+ s = S("ABC")
+ assert_equal [65, 66, 67], s.bytes
+
+ if ENUMERATOR_WANTARRAY
+ assert_warn(/block not used/) {
+ assert_equal [65, 66, 67], s.bytes {}
+ }
+ else
+ assert_warning(/deprecated/) {
+ res = []
+ assert_equal s.object_id, s.bytes {|x| res << x }.object_id
+ assert_equal(65, res[0])
+ assert_equal(66, res[1])
+ assert_equal(67, res[2])
+ }
+ end
+ end
+
+ def test_each_codepoint
+ # Single byte optimization
+ assert_equal 65, S("ABC").each_codepoint.next
+
+ s = S("\u3042\u3044\u3046")
+
+ res = []
+ assert_equal s.object_id, s.each_codepoint {|x| res << x }.object_id
+ assert_equal(0x3042, res[0])
+ assert_equal(0x3044, res[1])
+ assert_equal(0x3046, res[2])
+
+ assert_equal 0x3042, s.each_codepoint.next
+ end
+
+ def test_codepoints
+ # Single byte optimization
+ assert_equal [65, 66, 67], S("ABC").codepoints
+
+ s = S("\u3042\u3044\u3046")
+ assert_equal [0x3042, 0x3044, 0x3046], s.codepoints
+
+ if ENUMERATOR_WANTARRAY
+ assert_warn(/block not used/) {
+ assert_equal [0x3042, 0x3044, 0x3046], s.codepoints {}
+ }
+ else
+ assert_warning(/deprecated/) {
+ res = []
+ assert_equal s.object_id, s.codepoints {|x| res << x }.object_id
+ assert_equal(0x3042, res[0])
+ assert_equal(0x3044, res[1])
+ assert_equal(0x3046, res[2])
+ }
+ end
+ end
+
+ def test_each_char
+ s = S("ABC")
+
+ res = []
+ assert_equal s.object_id, s.each_char {|x| res << x }.object_id
+ assert_equal("A", res[0])
+ assert_equal("B", res[1])
+ assert_equal("C", res[2])
+
+ assert_equal "A", S("ABC").each_char.next
+ end
+
+ def test_chars
+ s = S("ABC")
+ assert_equal ["A", "B", "C"], s.chars
+
+ if ENUMERATOR_WANTARRAY
+ assert_warn(/block not used/) {
+ assert_equal ["A", "B", "C"], s.chars {}
+ }
+ else
+ assert_warning(/deprecated/) {
+ res = []
+ assert_equal s.object_id, s.chars {|x| res << x }.object_id
+ assert_equal("A", res[0])
+ assert_equal("B", res[1])
+ assert_equal("C", res[2])
+ }
+ end
end
def test_each_line
save = $/
$/ = "\n"
res=[]
- S("hello\nworld").lines.each {|x| res << x}
+ S("hello\nworld").each_line {|x| res << x}
assert_equal(S("hello\n"), res[0])
assert_equal(S("world"), res[1])
res=[]
- S("hello\n\n\nworld").lines(S('')).each {|x| res << x}
+ S("hello\n\n\nworld").each_line(S('')) {|x| res << x}
assert_equal(S("hello\n\n\n"), res[0])
assert_equal(S("world"), res[1])
$/ = "!"
res=[]
- S("hello!world").lines.each {|x| res << x}
+ S("hello!world").each_line {|x| res << x}
assert_equal(S("hello!"), res[0])
assert_equal(S("world"), res[1])
+ $/ = "ab"
+
+ res=[]
+ S("a").lines.each {|x| res << x}
+ assert_equal(1, res.size)
+ assert_equal(S("a"), res[0])
+
$/ = save
s = nil
"foo\nbar".each_line(nil) {|s2| s = s2 }
assert_equal("foo\nbar", s)
+
+ assert_equal "hello\n", S("hello\nworld").each_line.next
+ assert_equal "hello\nworld", S("hello\nworld").each_line(nil).next
+
+ bug7646 = "[ruby-dev:46827]"
+ assert_nothing_raised(bug7646) do
+ "\n\u0100".each_line("\n") {}
+ end
+ end
+
+ def test_lines
+ s = S("hello\nworld")
+ assert_equal ["hello\n", "world"], s.lines
+ assert_equal ["hello\nworld"], s.lines(nil)
+
+ if ENUMERATOR_WANTARRAY
+ assert_warn(/block not used/) {
+ assert_equal ["hello\n", "world"], s.lines {}
+ }
+ else
+ assert_warning(/deprecated/) {
+ res = []
+ assert_equal s.object_id, s.lines {|x| res << x }.object_id
+ assert_equal(S("hello\n"), res[0])
+ assert_equal(S("world"), res[1])
+ }
+ end
end
def test_empty?
- assert(S("").empty?)
- assert(!S("not").empty?)
+ assert_empty(S(""))
+ assert_not_empty(S("not"))
+ end
+
+ def test_end_with?
+ assert_send([S("hello"), :end_with?, S("llo")])
+ assert_not_send([S("hello"), :end_with?, S("ll")])
+ assert_send([S("hello"), :end_with?, S("el"), S("lo")])
+
+ bug5536 = '[ruby-core:40623]'
+ assert_raise(TypeError, bug5536) {S("str").end_with? :not_convertible_to_string}
end
def test_eql?
a = S("hello")
- assert(a.eql?(S("hello")))
- assert(a.eql?(a))
+ assert_operator(a, :eql?, S("hello"))
+ assert_operator(a, :eql?, a)
end
def test_gsub
@@ -665,9 +810,7 @@ class TestString < Test::Unit::TestCase
a = S("hello")
a.taint
- a.untrust
- assert(a.gsub(/./, S('X')).tainted?)
- assert(a.gsub(/./, S('X')).untrusted?)
+ assert_predicate(a.gsub(/./, S('X')), :tainted?)
assert_equal("z", "abc".gsub(/./, "a" => "z"), "moved from btest/knownbug")
@@ -710,10 +853,8 @@ class TestString < Test::Unit::TestCase
r = S('X')
r.taint
- r.untrust
a.gsub!(/./, r)
- assert(a.tainted?)
- assert(a.untrusted?)
+ assert_predicate(a, :tainted?)
a = S("hello")
assert_nil(a.sub!(S('X'), S('Y')))
@@ -741,7 +882,7 @@ class TestString < Test::Unit::TestCase
def test_hash
assert_equal(S("hello").hash, S("hello").hash)
- assert(S("hello").hash != S("helLO").hash)
+ assert_not_equal(S("hello").hash, S("helLO").hash)
bug4104 = '[ruby-core:33500]'
assert_not_equal(S("a").hash, S("a\0").hash, bug4104)
end
@@ -769,10 +910,10 @@ class TestString < Test::Unit::TestCase
end
def test_include?
- assert( S("foobar").include?(?f))
- assert( S("foobar").include?(S("foo")))
- assert(!S("foobar").include?(S("baz")))
- assert(!S("foobar").include?(?z))
+ assert_include(S("foobar"), ?f)
+ assert_include(S("foobar"), S("foo"))
+ assert_not_include(S("foobar"), S("baz"))
+ assert_not_include(S("foobar"), ?z)
end
def test_index
@@ -792,6 +933,20 @@ class TestString < Test::Unit::TestCase
assert_nil(S("hello").index(S("z")))
assert_nil(S("hello").index(/z./))
+ assert_equal(0, S("").index(S("")))
+ assert_equal(0, S("").index(//))
+ assert_nil(S("").index(S("hello")))
+ assert_nil(S("").index(/hello/))
+ assert_equal(0, S("hello").index(S("")))
+ assert_equal(0, S("hello").index(//))
+
+ s = S("long") * 1000 << "x"
+ assert_nil(s.index(S("y")))
+ assert_equal(4 * 1000, s.index(S("x")))
+ s << "yx"
+ assert_equal(4 * 1000, s.index(S("x")))
+ assert_equal(4 * 1000, s.index(S("xyx")))
+
o = Object.new
def o.to_str; "bar"; end
assert_equal(3, "foobarbarbaz".index(o))
@@ -803,7 +958,7 @@ class TestString < Test::Unit::TestCase
def test_intern
assert_equal(:koala, S("koala").intern)
- assert(:koala != S("Koala").intern)
+ assert_not_equal(:koala, S("Koala").intern)
end
def test_length
@@ -888,11 +1043,9 @@ class TestString < Test::Unit::TestCase
a = S("foo")
a.taint
- a.untrust
b = a.replace(S("xyz"))
assert_equal(S("xyz"), b)
- assert(b.tainted?)
- assert(b.untrusted?)
+ assert_predicate(b, :tainted?)
s = "foo" * 100
s2 = ("bar" * 100).dup
@@ -986,11 +1139,9 @@ class TestString < Test::Unit::TestCase
a = S("hello")
a.taint
- a.untrust
res = []
a.scan(/./) { |w| res << w }
- assert(res[0].tainted?, '[ruby-core:33338] #4087')
- assert(res[0].untrusted?, '[ruby-core:33338] #4087')
+ assert_predicate(res[0], :tainted?, '[ruby-core:33338] #4087')
end
def test_size
@@ -1170,6 +1321,17 @@ class TestString < Test::Unit::TestCase
s = S("a:".force_encoding(enc))
assert_equal([enc]*2, s.split(":", 2).map(&:encoding), bug6206)
end
+
+ bug8642 = '[ruby-core:56036] [Bug #8642]'
+ [
+ Encoding::UTF_16BE, Encoding::UTF_16LE,
+ Encoding::UTF_32BE, Encoding::UTF_32LE,
+ ].each do |enc|
+ s = S("abc,def".encode(enc))
+ assert_equal(["abc", "def"].map {|c| c.encode(enc)},
+ s.split(",".encode(enc)),
+ "#{bug8642} in #{enc.name}")
+ end
end
def test_squeeze
@@ -1197,6 +1359,15 @@ class TestString < Test::Unit::TestCase
assert_nil(a.squeeze!)
end
+ def test_start_with?
+ assert_send([S("hello"), :start_with?, S("hel")])
+ assert_not_send([S("hello"), :start_with?, S("el")])
+ assert_send([S("hello"), :start_with?, S("el"), S("he")])
+
+ bug5536 = '[ruby-core:40623]'
+ assert_raise(TypeError, bug5536) {S("str").start_with? :not_convertible_to_string}
+ end
+
def test_strip
assert_equal(S("x"), S(" x ").strip)
assert_equal(S("x"), S(" \n\r\t x \t\r\n\n ").strip)
@@ -1264,10 +1435,8 @@ class TestString < Test::Unit::TestCase
a = S("hello")
a.taint
- a.untrust
x = a.sub(/./, S('X'))
- assert(x.tainted?)
- assert(x.untrusted?)
+ assert_predicate(x, :tainted?)
o = Object.new
def o.to_str; "bar"; end
@@ -1308,10 +1477,8 @@ class TestString < Test::Unit::TestCase
r = S('X')
r.taint
- r.untrust
a.sub!(/./, r)
- assert(a.tainted?)
- assert(a.untrusted?)
+ assert_predicate(a, :tainted?)
end
def test_succ
@@ -1330,7 +1497,7 @@ class TestString < Test::Unit::TestCase
assert_equal("abce", "abcd".succ)
assert_equal("THX1139", "THX1138".succ)
- assert_equal("<<koalb>>", "<<koala>>".succ)
+ assert_equal("<\<koalb>>", "<\<koala>>".succ)
assert_equal("2000aaa", "1999zzz".succ)
assert_equal("AAAA0000", "ZZZ9999".succ)
assert_equal("**+", "***".succ)
@@ -1385,7 +1552,7 @@ class TestString < Test::Unit::TestCase
n += S("\001")
assert_equal(16, n.sum(17))
n[0] = 2.chr
- assert(15 != n.sum)
+ assert_not_equal(15, n.sum)
end
def check_sum(str, bits=16)
@@ -1468,6 +1635,13 @@ class TestString < Test::Unit::TestCase
assert_equal(0x4000000000000000, "4611686018427387904".to_i(10))
assert_equal(1, "1__2".to_i(10))
assert_equal(1, "1_z".to_i(10))
+
+ bug6192 = '[ruby-core:43566]'
+ assert_raise(Encoding::CompatibilityError, bug6192) {"0".encode("utf-16be").to_i}
+ assert_raise(Encoding::CompatibilityError, bug6192) {"0".encode("utf-16le").to_i}
+ assert_raise(Encoding::CompatibilityError, bug6192) {"0".encode("utf-32be").to_i}
+ assert_raise(Encoding::CompatibilityError, bug6192) {"0".encode("utf-32le").to_i}
+ assert_raise(Encoding::CompatibilityError, bug6192) {"0".encode("iso-2022-jp").to_i}
end
def test_to_s
@@ -1506,6 +1680,10 @@ class TestString < Test::Unit::TestCase
assert_equal(true, "\u0101".tr("\u0101", "a").ascii_only?)
assert_equal(true, "\u3041".tr("\u3041", "a").ascii_only?)
assert_equal(false, "\u3041\u3042".tr("\u3041", "a").ascii_only?)
+
+ bug6156 = '[ruby-core:43335]'
+ str, range, star = %w[b a-z *].map{|s|s.encode("utf-16le")}
+ assert_equal(star, str.tr(range, star), bug6156)
end
def test_tr!
@@ -1753,10 +1931,6 @@ class TestString < Test::Unit::TestCase
assert_nil(l.slice!(/\A.*\n/), "[ruby-dev:31665]")
end
- def test_end_with?
- assert("abc".end_with?("c"))
- end
-
def test_times2
s1 = ''
100.times {|n|
@@ -1779,7 +1953,7 @@ class TestString < Test::Unit::TestCase
def test_match_method
assert_equal("bar", "foobarbaz".match(/bar/).to_s)
- o = /foo/
+ o = Regexp.new('foo')
def o.match(x, y, z); x + y + z; end
assert_equal("foobarbaz", "foo".match(o, "bar", "baz"))
x = nil
@@ -1803,6 +1977,14 @@ class TestString < Test::Unit::TestCase
assert_instance_of(String, s.to_s)
end
+ def test_inspect_nul
+ bug8290 = '[ruby-core:54458]'
+ s = "\0" + "12"
+ assert_equal '"\u000012"', s.inspect, bug8290
+ s = "\0".b + "12"
+ assert_equal '"\x0012"', s.inspect, bug8290
+ end
+
def test_partition
assert_equal(%w(he l lo), "hello".partition(/l/))
assert_equal(%w(he l lo), "hello".partition("l"))
@@ -1816,6 +1998,9 @@ class TestString < Test::Unit::TestCase
s = S("a:".force_encoding(enc))
assert_equal([enc]*3, s.partition("|").map(&:encoding), bug6206)
end
+
+ assert_equal(["\u30E6\u30FC\u30B6", "@", "\u30C9\u30E1.\u30A4\u30F3"],
+ "\u30E6\u30FC\u30B6@\u30C9\u30E1.\u30A4\u30F3".partition(/[@.]/))
end
def test_rpartition
@@ -1831,6 +2016,10 @@ class TestString < Test::Unit::TestCase
s = S("a:".force_encoding(enc))
assert_equal([enc]*3, s.rpartition("|").map(&:encoding), bug6206)
end
+
+ bug8138 = '[ruby-dev:47183]'
+ assert_equal(["\u30E6\u30FC\u30B6@\u30C9\u30E1", ".", "\u30A4\u30F3"],
+ "\u30E6\u30FC\u30B6@\u30C9\u30E1.\u30A4\u30F3".rpartition(/[@.]/), bug8138)
end
def test_setter
@@ -1935,11 +2124,15 @@ class TestString < Test::Unit::TestCase
assert_equal('"ab\\"c"', "ab\"c".encode(e).inspect, bug4081)
end
begin
+ verbose, $VERBOSE = $VERBOSE, nil
ext = Encoding.default_external
Encoding.default_external = "us-ascii"
+ $VERBOSE = verbose
i = "abc\"\\".force_encoding("utf-8").inspect
ensure
+ $VERBOSE = nil
Encoding.default_external = ext
+ $VERBOSE = verbose
end
assert_equal('"abc\\"\\\\"', i, bug4081)
end
@@ -1997,7 +2190,37 @@ class TestString < Test::Unit::TestCase
assert_equal(u("\x82")+("\u3042"*9), ("\u3042"*10).byteslice(2, 28))
bug7954 = '[ruby-dev:47108]'
- assert_equal(false, "\u3042".byteslice(0, 2).valid_encoding?)
- assert_equal(false, ("\u3042"*10).byteslice(0, 20).valid_encoding?)
+ assert_equal(false, "\u3042".byteslice(0, 2).valid_encoding?, bug7954)
+ assert_equal(false, ("\u3042"*10).byteslice(0, 20).valid_encoding?, bug7954)
+ end
+
+ def test_unknown_string_option
+ str = nil
+ assert_nothing_raised(SyntaxError) do
+ eval(%{
+ str = begin"hello"end
+ })
+ end
+ assert_equal "hello", str
+ end
+
+ def test_eq_tilde_can_be_overridden
+ assert_separately([], <<-RUBY)
+ class String
+ undef =~
+ def =~(str)
+ "foo"
+ end
+ end
+
+ assert_equal("foo", "" =~ //)
+ RUBY
+ end
+end
+
+class TestString2 < TestString
+ def initialize(*args)
+ super
+ @cls = S2
end
end
diff --git a/test/ruby/test_stringchar.rb b/test/ruby/test_stringchar.rb
index 44c8634c02..4cae57f85f 100644
--- a/test/ruby/test_stringchar.rb
+++ b/test/ruby/test_stringchar.rb
@@ -30,12 +30,12 @@ class TestStringchar < Test::Unit::TestCase
assert(/(\s+\d+){2}/ =~ " 1 2"); assert_equal(" 1 2", $&)
assert(/(?:\s+\d+){2}/ =~ " 1 2"); assert_equal(" 1 2", $&)
- $x = <<END;
+ x = <<END;
ABCD
ABCD
END
- $x.gsub!(/((.|\n)*?)B((.|\n)*?)D/m ,'\1\3')
- assert_equal("AC\nAC\n", $x)
+ x.gsub!(/((.|\n)*?)B((.|\n)*?)D/m ,'\1\3')
+ assert_equal("AC\nAC\n", x)
assert_match(/foo(?=(bar)|(baz))/, "foobar")
assert_match(/foo(?=(bar)|(baz))/, "foobaz")
@@ -56,12 +56,12 @@ END
assert_equal('-', foo * 1)
assert_equal('', foo * 0)
- $x = "a.gif"
- assert_equal("gif", $x.sub(/.*\.([^\.]+)$/, '\1'))
- assert_equal("b.gif", $x.sub(/.*\.([^\.]+)$/, 'b.\1'))
- assert_equal("", $x.sub(/.*\.([^\.]+)$/, '\2'))
- assert_equal("ab", $x.sub(/.*\.([^\.]+)$/, 'a\2b'))
- assert_equal("<a.gif>", $x.sub(/.*\.([^\.]+)$/, '<\&>'))
+ x = "a.gif"
+ assert_equal("gif", x.sub(/.*\.([^\.]+)$/, '\1'))
+ assert_equal("b.gif", x.sub(/.*\.([^\.]+)$/, 'b.\1'))
+ assert_equal("", x.sub(/.*\.([^\.]+)$/, '\2'))
+ assert_equal("ab", x.sub(/.*\.([^\.]+)$/, 'a\2b'))
+ assert_equal("<a.gif>", x.sub(/.*\.([^\.]+)$/, '<\&>'))
end
def test_char
@@ -78,16 +78,16 @@ END
assert_equal("abc", "abcc".squeeze!("a-z"))
assert_equal("ad", "abcd".delete!("bc"))
- $x = "abcdef"
- $y = [ ?a, ?b, ?c, ?d, ?e, ?f ]
- $bad = false
- $x.each_byte {|i|
- if i.chr != $y.shift
- $bad = true
+ x = "abcdef"
+ y = [ ?a, ?b, ?c, ?d, ?e, ?f ]
+ bad = false
+ x.each_byte {|i|
+ if i.chr != y.shift
+ bad = true
break
end
}
- assert(!$bad)
+ assert(!bad)
s = "a string"
s[0..s.size]="another string"
diff --git a/test/ruby/test_struct.rb b/test/ruby/test_struct.rb
index 49dcdb45b2..0c4eafc14a 100644
--- a/test/ruby/test_struct.rb
+++ b/test/ruby/test_struct.rb
@@ -1,10 +1,12 @@
+# -*- coding: us-ascii -*-
require 'test/unit'
require 'timeout'
+require_relative 'envutil'
-class TestStruct < Test::Unit::TestCase
+module TestStruct
def test_struct
- struct_test = Struct.new("Test", :foo, :bar)
- assert_equal(Struct::Test, struct_test)
+ struct_test = @Struct.new("Test", :foo, :bar)
+ assert_equal(@Struct::Test, struct_test)
test = struct_test.new(1, 2)
assert_equal(1, test.foo)
@@ -27,7 +29,7 @@ class TestStruct < Test::Unit::TestCase
def test_morethan10members
list = %w( a b c d e f g h i j k l m n o p )
until list.empty?
- c = Struct.new(* list.map {|ch| ch.intern }).new
+ c = @Struct.new(* list.map {|ch| ch.intern }).new
list.each do |ch|
c.__send__(ch)
end
@@ -39,7 +41,7 @@ class TestStruct < Test::Unit::TestCase
names = [:a, :b, :c, :d]
1.upto(4) {|n|
fields = names[0, n]
- klass = Struct.new(*fields)
+ klass = @Struct.new(*fields)
o = klass.new(*(0...n).to_a)
fields.each_with_index {|name, i|
assert_equal(i, o[name])
@@ -52,39 +54,28 @@ class TestStruct < Test::Unit::TestCase
end
def test_inherit
- klass = Struct.new(:a)
+ klass = @Struct.new(:a)
klass2 = Class.new(klass)
o = klass2.new(1)
assert_equal(1, o.a)
end
def test_members
- klass = Struct.new(:a)
+ klass = @Struct.new(:a)
o = klass.new(1)
assert_equal([:a], klass.members)
assert_equal([:a], o.members)
end
def test_ref
- klass = Struct.new(:a)
+ klass = @Struct.new(:a)
o = klass.new(1)
assert_equal(1, o[:a])
assert_raise(NameError) { o[:b] }
end
- def test_modify
- klass = Struct.new(:a)
- o = klass.new(1)
- assert_raise(SecurityError) do
- Thread.new do
- $SAFE = 4
- o.a = 2
- end.value
- end
- end
-
def test_set
- klass = Struct.new(:a)
+ klass = @Struct.new(:a)
o = klass.new(1)
o[:a] = 2
assert_equal(2, o[:a])
@@ -92,61 +83,77 @@ class TestStruct < Test::Unit::TestCase
end
def test_struct_new
- assert_raise(NameError) { Struct.new("foo") }
- assert_nothing_raised { Struct.new("Foo") }
- Struct.instance_eval { remove_const(:Foo) }
- assert_nothing_raised { Struct.new(:a) { } }
- assert_raise(RuntimeError) { Struct.new(:a) { raise } }
+ assert_raise(NameError) { @Struct.new("foo") }
+ assert_nothing_raised { @Struct.new("Foo") }
+ @Struct.instance_eval { remove_const(:Foo) }
+ assert_nothing_raised { @Struct.new(:a) { } }
+ assert_raise(RuntimeError) { @Struct.new(:a) { raise } }
assert_equal([:utime, :stime, :cutime, :cstime], Process.times.members)
end
def test_initialize
- klass = Struct.new(:a)
+ klass = @Struct.new(:a)
assert_raise(ArgumentError) { klass.new(1, 2) }
end
def test_each
- klass = Struct.new(:a, :b)
+ klass = @Struct.new(:a, :b)
o = klass.new(1, 2)
assert_equal([1, 2], o.each.to_a)
end
def test_each_pair
- klass = Struct.new(:a, :b)
+ klass = @Struct.new(:a, :b)
o = klass.new(1, 2)
assert_equal([[:a, 1], [:b, 2]], o.each_pair.to_a)
+ bug7382 = '[ruby-dev:46533]'
+ a = []
+ o.each_pair {|x| a << x}
+ assert_equal([[:a, 1], [:b, 2]], a, bug7382)
end
def test_inspect
- klass = Struct.new(:a)
+ klass = @Struct.new(:a)
o = klass.new(1)
assert_equal("#<struct a=1>", o.inspect)
o.a = o
assert_match(/^#<struct a=#<struct #<.*?>:...>>$/, o.inspect)
- Struct.new("Foo", :a)
- o = Struct::Foo.new(1)
- assert_equal("#<struct Struct::Foo a=1>", o.inspect)
- Struct.instance_eval { remove_const(:Foo) }
+ @Struct.new("Foo", :a)
+ o = @Struct::Foo.new(1)
+ assert_equal("#<struct #@Struct::Foo a=1>", o.inspect)
+ @Struct.instance_eval { remove_const(:Foo) }
- klass = Struct.new(:a, :b)
+ klass = @Struct.new(:a, :b)
o = klass.new(1, 2)
assert_equal("#<struct a=1, b=2>", o.inspect)
- klass = Struct.new(:@a)
+ klass = @Struct.new(:@a)
o = klass.new(1)
+ assert_equal(1, o.__send__(:@a))
assert_equal("#<struct :@a=1>", o.inspect)
+ o.__send__(:"@a=", 2)
+ assert_equal(2, o.__send__(:@a))
+ assert_equal("#<struct :@a=2>", o.inspect)
+ o.__send__("@a=", 3)
+ assert_equal(3, o.__send__(:@a))
+ assert_equal("#<struct :@a=3>", o.inspect)
+
+ methods = klass.instance_methods(false)
+ assert_equal([:@a, :"@a="].inspect, methods.inspect, '[Bug #8756]')
+ assert_include(methods, :@a)
+ assert_include(methods, :"@a=")
end
def test_init_copy
- klass = Struct.new(:a)
+ klass = @Struct.new(:a)
o = klass.new(1)
assert_equal(o, o.dup)
end
def test_aref
- klass = Struct.new(:a)
+ klass = @Struct.new(:a)
o = klass.new(1)
assert_equal(1, o[0])
assert_raise(IndexError) { o[-2] }
@@ -154,7 +161,7 @@ class TestStruct < Test::Unit::TestCase
end
def test_aset
- klass = Struct.new(:a)
+ klass = @Struct.new(:a)
o = klass.new(1)
o[0] = 2
assert_equal(2, o[:a])
@@ -163,22 +170,22 @@ class TestStruct < Test::Unit::TestCase
end
def test_values_at
- klass = Struct.new(:a, :b, :c, :d, :e, :f)
+ klass = @Struct.new(:a, :b, :c, :d, :e, :f)
o = klass.new(1, 2, 3, 4, 5, 6)
assert_equal([2, 4, 6], o.values_at(1, 3, 5))
assert_equal([2, 3, 4, 3, 4, 5], o.values_at(1..3, 2...5))
end
def test_select
- klass = Struct.new(:a, :b, :c, :d, :e, :f)
+ klass = @Struct.new(:a, :b, :c, :d, :e, :f)
o = klass.new(1, 2, 3, 4, 5, 6)
assert_equal([1, 3, 5], o.select {|v| v % 2 != 0 })
assert_raise(ArgumentError) { o.select(1) }
end
def test_equal
- klass1 = Struct.new(:a)
- klass2 = Struct.new(:a, :b)
+ klass1 = @Struct.new(:a)
+ klass2 = @Struct.new(:a, :b)
o1 = klass1.new(1)
o2 = klass1.new(1)
o3 = klass2.new(1)
@@ -187,14 +194,14 @@ class TestStruct < Test::Unit::TestCase
end
def test_hash
- klass = Struct.new(:a)
+ klass = @Struct.new(:a)
o = klass.new(1)
assert(o.hash.is_a?(Fixnum))
end
def test_eql
- klass1 = Struct.new(:a)
- klass2 = Struct.new(:a, :b)
+ klass1 = @Struct.new(:a)
+ klass2 = @Struct.new(:a, :b)
o1 = klass1.new(1)
o2 = klass1.new(1)
o3 = klass2.new(1)
@@ -203,26 +210,47 @@ class TestStruct < Test::Unit::TestCase
end
def test_size
- klass = Struct.new(:a)
+ klass = @Struct.new(:a)
o = klass.new(1)
assert_equal(1, o.size)
end
def test_error
assert_raise(TypeError){
- Struct.new(0)
+ @Struct.new(0)
}
end
+ def test_redefinition_warning
+ @Struct.new("RedefinitionWarning")
+ e = EnvUtil.verbose_warning do
+ @Struct.new("RedefinitionWarning")
+ end
+ assert_match(/redefining constant #@Struct::RedefinitionWarning/, e)
+ end
+
def test_nonascii
- struct_test = Struct.new("R\u{e9}sum\u{e9}", :"r\u{e9}sum\u{e9}")
- assert_equal(Struct.const_get("R\u{e9}sum\u{e9}"), struct_test, '[ruby-core:24849]')
+ struct_test = @Struct.new("R\u{e9}sum\u{e9}", :"r\u{e9}sum\u{e9}")
+ assert_equal(@Struct.const_get("R\u{e9}sum\u{e9}"), struct_test, '[ruby-core:24849]')
a = struct_test.new(42)
- assert_equal("#<struct Struct::R\u{e9}sum\u{e9} r\u{e9}sum\u{e9}=42>", a.inspect, '[ruby-core:24849]')
+ assert_equal("#<struct #@Struct::R\u{e9}sum\u{e9} r\u{e9}sum\u{e9}=42>", a.inspect, '[ruby-core:24849]')
+ e = EnvUtil.verbose_warning do
+ @Struct.new("R\u{e9}sum\u{e9}", :"r\u{e9}sum\u{e9}")
+ end
+ assert_nothing_raised(Encoding::CompatibilityError) do
+ assert_match(/redefining constant #@Struct::R\u{e9}sum\u{e9}/, e)
+ end
+ end
+
+ def test_junk
+ struct_test = @Struct.new("Foo", "a\000")
+ o = struct_test.new(1)
+ assert_equal(1, o.send("a\000"))
+ @Struct.instance_eval { remove_const(:Foo) }
end
def test_comparison_when_recursive
- klass1 = Struct.new(:a, :b, :c)
+ klass1 = @Struct.new(:a, :b, :c)
x = klass1.new(1, 2, nil); x.c = x
y = klass1.new(1, 2, nil); y.c = y
@@ -249,4 +277,29 @@ class TestStruct < Test::Unit::TestCase
assert !x.eql?(z)
}
end
+
+ def test_to_h
+ klass = @Struct.new(:a, :b, :c, :d, :e, :f)
+ o = klass.new(1, 2, 3, 4, 5, 6)
+ assert_equal({a:1, b:2, c:3, d:4, e:5, f:6}, o.to_h)
+ end
+
+ class TopStruct < Test::Unit::TestCase
+ include TestStruct
+
+ def initialize(*)
+ super
+ @Struct = Struct
+ end
+ end
+
+ class SubStruct < Test::Unit::TestCase
+ include TestStruct
+ SubStruct = Class.new(Struct)
+
+ def initialize(*)
+ super
+ @Struct = SubStruct
+ end
+ end
end
diff --git a/test/ruby/test_super.rb b/test/ruby/test_super.rb
index 743b71d73f..846f40946d 100644
--- a/test/ruby/test_super.rb
+++ b/test/ruby/test_super.rb
@@ -1,4 +1,5 @@
require 'test/unit'
+require_relative 'envutil'
class TestSuper < Test::Unit::TestCase
class Base
@@ -6,6 +7,7 @@ class TestSuper < Test::Unit::TestCase
def double(a, b) [a,b] end
def array(*a) a end
def optional(a = 0) a end
+ def keyword(**a) a end
end
class Single1 < Base
def single(*) super end
@@ -49,6 +51,18 @@ class TestSuper < Test::Unit::TestCase
class Optional5 < Base
def array(a = 1, b = 2, *) super end
end
+ class Keyword1 < Base
+ def keyword(foo: "keyword1") super end
+ end
+ class Keyword2 < Base
+ def keyword(foo: "keyword2")
+ foo = "changed1"
+ x = super
+ foo = "changed2"
+ y = super
+ [x, y]
+ end
+ end
def test_single1
assert_equal(1, Single1.new.single(1))
@@ -111,6 +125,14 @@ class TestSuper < Test::Unit::TestCase
assert_equal([9, 8], Optional5.new.array(9, 8))
assert_equal([9, 8, 7], Optional5.new.array(9, 8, 7))
end
+ def test_keyword1
+ assert_equal({foo: "keyword1"}, Keyword1.new.keyword)
+ bug8008 = '[ruby-core:53114] [Bug #8008]'
+ assert_equal({foo: bug8008}, Keyword1.new.keyword(foo: bug8008))
+ end
+ def test_keyword2
+ assert_equal([{foo: "changed1"}, {foo: "changed2"}], Keyword2.new.keyword)
+ end
class A
def tt(aa)
@@ -130,14 +152,13 @@ class TestSuper < Test::Unit::TestCase
a = A.new
a.uu(12)
assert_equal("A#tt", a.tt(12), "[ruby-core:3856]")
- e = assert_raise(RuntimeError, "[ruby-core:24244]") {
+ assert_raise_with_message(RuntimeError, /implicit argument passing of super from method defined by define_method/, "[ruby-core:24244]") {
lambda {
- Class.new do
- define_method(:a) {super}.call
- end
+ Class.new {
+ define_method(:a) {super}
+ }.new.a
}.call
}
- assert_match(/implicit argument passing of super from method defined by define_method/, e.message)
end
class SubSeq
@@ -184,4 +205,206 @@ class TestSuper < Test::Unit::TestCase
mid.subseq
end
end
+
+ module DoubleInclude
+ class Base
+ def foo
+ [:Base]
+ end
+ end
+
+ module Override
+ def foo
+ super << :Override
+ end
+ end
+
+ class A < Base
+ end
+
+ class B < A
+ end
+
+ B.send(:include, Override)
+ A.send(:include, Override)
+ end
+
+ # [Bug #3351]
+ def test_double_include
+ assert_equal([:Base, :Override], DoubleInclude::B.new.foo)
+ # should be changed as follows?
+ # assert_equal([:Base, :Override, :Override], DoubleInclude::B.new.foo)
+ end
+
+ module DoubleInclude2
+ class Base
+ def foo
+ [:Base]
+ end
+ end
+
+ module Override
+ def foo
+ super << :Override
+ end
+ end
+
+ class A < Base
+ def foo
+ super << :A
+ end
+ end
+
+ class B < A
+ def foo
+ super << :B
+ end
+ end
+
+ B.send(:include, Override)
+ A.send(:include, Override)
+ end
+
+ def test_double_include2
+ assert_equal([:Base, :Override, :A, :Override, :B],
+ DoubleInclude2::B.new.foo)
+ end
+
+ def test_super_in_instance_eval
+ super_class = Class.new {
+ def foo
+ return [:super, self]
+ end
+ }
+ sub_class = Class.new(super_class) {
+ def foo
+ x = Object.new
+ x.instance_eval do
+ super()
+ end
+ end
+ }
+ obj = sub_class.new
+ assert_raise(TypeError) do
+ obj.foo
+ end
+ end
+
+ def test_super_in_instance_eval_with_define_method
+ super_class = Class.new {
+ def foo
+ return [:super, self]
+ end
+ }
+ sub_class = Class.new(super_class) {
+ define_method(:foo) do
+ x = Object.new
+ x.instance_eval do
+ super()
+ end
+ end
+ }
+ obj = sub_class.new
+ assert_raise(TypeError) do
+ obj.foo
+ end
+ end
+
+ def test_super_in_orphan_block
+ super_class = Class.new {
+ def foo
+ return [:super, self]
+ end
+ }
+ sub_class = Class.new(super_class) {
+ def foo
+ x = Object.new
+ lambda { super() }
+ end
+ }
+ obj = sub_class.new
+ assert_equal([:super, obj], obj.foo.call)
+ end
+
+ def test_super_in_orphan_block_with_instance_eval
+ super_class = Class.new {
+ def foo
+ return [:super, self]
+ end
+ }
+ sub_class = Class.new(super_class) {
+ def foo
+ x = Object.new
+ x.instance_eval do
+ lambda { super() }
+ end
+ end
+ }
+ obj = sub_class.new
+ assert_raise(TypeError) do
+ obj.foo.call
+ end
+ end
+
+ def test_yielding_super
+ a = Class.new { def yielder; yield; end }
+ x = Class.new { define_singleton_method(:hello) { 'hi' } }
+ y = Class.new(x) {
+ define_singleton_method(:hello) {
+ m = a.new
+ m.yielder { super() }
+ }
+ }
+ assert_equal 'hi', y.hello
+ end
+
+ def test_super_in_thread
+ hoge = Class.new {
+ def bar; 'hoge'; end
+ }
+ foo = Class.new(hoge) {
+ def bar; Thread.new { super }.join.value; end
+ }
+
+ assert_equal 'hoge', foo.new.bar
+ end
+
+ def assert_super_in_block(type)
+ bug7064 = '[ruby-core:47680]'
+ assert_normal_exit "#{type} {super}", bug7064
+ end
+
+ def test_super_in_at_exit
+ assert_super_in_block("at_exit")
+ end
+ def test_super_in_END
+ assert_super_in_block("END")
+ end
+
+ def test_super_in_BEGIN
+ assert_super_in_block("BEGIN")
+ end
+
+ class X
+ def foo(*args)
+ args
+ end
+ end
+
+ class Y < X
+ define_method(:foo) do |*args|
+ super(*args)
+ end
+ end
+
+ def test_super_splat
+ # [ruby-list:49575]
+ y = Y.new
+ assert_equal([1, 2], y.foo(1, 2))
+ assert_equal([1, false], y.foo(1, false))
+ assert_equal([1, 2, 3, 4, 5], y.foo(1, 2, 3, 4, 5))
+ assert_equal([false, true], y.foo(false, true))
+ assert_equal([false, false], y.foo(false, false))
+ assert_equal([1, 2, 3, false, 5], y.foo(1, 2, 3, false, 5))
+ end
end
diff --git a/test/ruby/test_symbol.rb b/test/ruby/test_symbol.rb
index 23c50e6778..7f261b68bb 100644
--- a/test/ruby/test_symbol.rb
+++ b/test/ruby/test_symbol.rb
@@ -64,11 +64,10 @@ class TestSymbol < Test::Unit::TestCase
def test_inspect_dollar
# 4) :$- always treats next character literally:
- sym = "$-".intern
- assert_nothing_raised(SyntaxError) {assert_equal(sym, eval(':$-'))}
- assert_nothing_raised(SyntaxError) {assert_equal(sym, eval(":$-\n"))}
- assert_nothing_raised(SyntaxError) {assert_equal(sym, eval(":$- "))}
- assert_nothing_raised(SyntaxError) {assert_equal(sym, eval(":$-#"))}
+ assert_raise(SyntaxError) {eval ':$-'}
+ assert_raise(SyntaxError) {eval ":$-\n"}
+ assert_raise(SyntaxError) {eval ":$- "}
+ assert_raise(SyntaxError) {eval ":$-#"}
assert_raise(SyntaxError) {eval ':$-('}
end
@@ -79,6 +78,19 @@ class TestSymbol < Test::Unit::TestCase
assert_inspect_evaled(':$1')
end
+ def test_inspect
+ valid = %W{$a @a @@a < << <= <=> > >> >= =~ == === * ** + +@ - -@
+ | ^ & / % ~ \` [] []= ! != !~ a a? a! a= A A? A! A=}
+ valid.each do |sym|
+ assert_equal(':' + sym, sym.intern.inspect)
+ end
+
+ invalid = %w{$a? $a! $a= @a? @a! @a= @@a? @@a! @@a= =}
+ invalid.each do |sym|
+ assert_equal(':"' + sym + '"', sym.intern.inspect)
+ end
+ end
+
def test_to_proc
assert_equal %w(1 2 3), (1..3).map(&:to_s)
[
@@ -175,4 +187,23 @@ class TestSymbol < Test::Unit::TestCase
assert_equal(':"\\u3042\\u3044\\u3046"', "\u3042\u3044\u3046".encode(e).to_sym.inspect)
end
end
+
+ def test_symbol_encoding
+ assert_equal(Encoding::US_ASCII, "$-A".force_encoding("iso-8859-15").intern.encoding)
+ assert_equal(Encoding::US_ASCII, "foobar~!".force_encoding("iso-8859-15").intern.encoding)
+ assert_equal(Encoding::UTF_8, "\u{2192}".intern.encoding)
+ assert_raise(EncodingError) {"\xb0a".force_encoding("utf-8").intern}
+ end
+
+ def test_singleton_method
+ assert_raise(TypeError) { a = :foo; def a.foo; end }
+ end
+
+ def test_frozen_symbol
+ assert_equal(true, :foo.frozen?)
+ assert_equal(true, :each.frozen?)
+ assert_equal(true, :+.frozen?)
+ assert_equal(true, "foo#{Time.now.to_i}".to_sym.frozen?)
+ assert_equal(true, :foo.to_sym.frozen?)
+ end
end
diff --git a/test/ruby/test_syntax.rb b/test/ruby/test_syntax.rb
index d924679c7f..04fcd20a56 100644
--- a/test/ruby/test_syntax.rb
+++ b/test/ruby/test_syntax.rb
@@ -1,26 +1,27 @@
require 'test/unit'
+require_relative 'envutil'
class TestSyntax < Test::Unit::TestCase
- def assert_valid_syntax(code, fname, mesg = fname)
- code = code.dup.force_encoding("ascii-8bit")
- code.sub!(/\A(?:\xef\xbb\xbf)?(\s*\#.*$)*(\n)?/n) {
- "#$&#{"\n" if $1 && !$2}BEGIN{throw tag, :ok}\n"
- }
- code.force_encoding("us-ascii")
- verbose, $VERBOSE = $VERBOSE, nil
- assert_nothing_raised(SyntaxError, mesg) do
- assert_equal(:ok, catch {|tag| eval(code, binding, fname, 0)}, mesg)
- end
- ensure
- $VERBOSE = verbose
- end
-
- def test_syntax
- assert_nothing_raised(Exception) do
- for script in Dir[File.expand_path("../../../{lib,sample,ext,test}/**/*.rb", __FILE__)].sort
+ def assert_syntax_files(test)
+ srcdir = File.expand_path("../../..", __FILE__)
+ srcdir = File.join(srcdir, test)
+ assert_separately(%W[--disable-gem -r#{__dir__}/envutil - #{srcdir}],
+ __FILE__, __LINE__, <<-'eom', timeout: Float::INFINITY)
+ dir = ARGV.shift
+ for script in Dir["#{dir}/**/*.rb"].sort
assert_valid_syntax(IO::read(script), script)
end
- end
+ eom
+ end
+
+ def test_syntax_lib; assert_syntax_files("lib"); end
+ def test_syntax_sample; assert_syntax_files("sample"); end
+ def test_syntax_ext; assert_syntax_files("ext"); end
+ def test_syntax_test; assert_syntax_files("test"); end
+
+ def test_defined_empty_argument
+ bug8220 = '[ruby-core:53999] [Bug #8220]'
+ assert_ruby_status(%w[--disable-gem], 'puts defined? ()', bug8220)
end
def test_must_ascii_compatible
@@ -55,13 +56,351 @@ class TestSyntax < Test::Unit::TestCase
f.close!
end
+ def test_newline_in_block_parameters
+ bug = '[ruby-dev:45292]'
+ ["", "a", "a, b"].product(["", ";x", [";", "x"]]) do |params|
+ params = ["|", *params, "|"].join("\n")
+ assert_valid_syntax("1.times{#{params}}", __FILE__, "#{bug} #{params.inspect}")
+ end
+ end
+
+ tap do |_,
+ bug6115 = '[ruby-dev:45308]',
+ blockcall = '["elem"].each_with_object [] do end',
+ methods = [['map', 'no'], ['inject([])', 'with']],
+ blocks = [['do end', 'do'], ['{}', 'brace']],
+ *|
+ [%w'. dot', %w':: colon'].product(methods, blocks) do |(c, n1), (m, n2), (b, n3)|
+ m = m.tr_s('()', ' ').strip if n2 == 'do'
+ name = "test_#{n3}_block_after_blockcall_#{n1}_#{n2}_arg"
+ code = "#{blockcall}#{c}#{m} #{b}"
+ define_method(name) {assert_valid_syntax(code, bug6115)}
+ end
+ end
+
+ def test_keyword_rest
+ bug5989 = '[ruby-core:42455]'
+ assert_valid_syntax("def kwrest_test(**a) a; end", __FILE__, bug5989)
+ assert_valid_syntax("def kwrest_test2(**a, &b) end", __FILE__, bug5989)
+ o = Object.new
+ def o.kw(**a) a end
+ assert_equal({}, o.kw, bug5989)
+ assert_equal({foo: 1}, o.kw(foo: 1), bug5989)
+ assert_equal({foo: 1, bar: 2}, o.kw(foo: 1, bar: 2), bug5989)
+ EnvUtil.under_gc_stress do
+ eval("def o.m(k: 0) k end")
+ end
+ assert_equal(42, o.m(k: 42), '[ruby-core:45744]')
+ bug7922 = '[ruby-core:52744] [Bug #7922]'
+ def o.bug7922(**) end
+ assert_nothing_raised(ArgumentError, bug7922) {o.bug7922(foo: 42)}
+ end
+
+ def test_keyword_splat
+ assert_valid_syntax("foo(**h)", __FILE__)
+ o = Object.new
+ def o.kw(k1: 1, k2: 2) [k1, k2] end
+ h = {k1: 11, k2: 12}
+ assert_equal([11, 12], o.kw(**h))
+ assert_equal([11, 22], o.kw(k2: 22, **h))
+ assert_equal([11, 12], o.kw(**h, **{k2: 22}))
+ assert_equal([11, 22], o.kw(**{k2: 22}, **h))
+ h = {k3: 31}
+ assert_raise(ArgumentError) {o.kw(**h)}
+ h = {"k1"=>11, k2: 12}
+ assert_raise(TypeError) {o.kw(**h)}
+ end
+
+ def test_warn_grouped_expression
+ bug5214 = '[ruby-core:39050]'
+ assert_warning("", bug5214) do
+ assert_valid_syntax("foo \\\n(\n true)", "test") {$VERBOSE = true}
+ end
+ end
+
+ def test_warn_unreachable
+ assert_warning("test:3: warning: statement not reached\n") do
+ code = "loop do\n" "break\n" "foo\n" "end"
+ assert_valid_syntax(code, "test") {$VERBOSE = true}
+ end
+ end
+
+ def test_warn_balanced
+ warning = <<WARN
+test:1: warning: `%s' after local variable or literal is interpreted as binary operator
+test:1: warning: even though it seems like %s
+WARN
+ [
+ [:**, "argument prefix"],
+ [:*, "argument prefix"],
+ [:<<, "here document"],
+ [:&, "argument prefix"],
+ [:+, "unary operator"],
+ [:-, "unary operator"],
+ [:/, "regexp literal"],
+ [:%, "string literal"],
+ ].each do |op, syn|
+ assert_warning(warning % [op, syn]) do
+ assert_valid_syntax("puts 1 #{op}0", "test") {$VERBOSE = true}
+ end
+ end
+ end
+
+ def test_cmd_symbol_after_keyword
+ bug6347 = '[ruby-dev:45563]'
+ assert_not_label(:foo, 'if true then not_label:foo end', bug6347)
+ assert_not_label(:foo, 'if false; else not_label:foo end', bug6347)
+ assert_not_label(:foo, 'begin not_label:foo end', bug6347)
+ assert_not_label(:foo, 'begin ensure not_label:foo end', bug6347)
+ end
+
+ def test_cmd_symbol_in_string
+ bug6347 = '[ruby-dev:45563]'
+ assert_not_label(:foo, '"#{not_label:foo}"', bug6347)
+ end
+
+ def test_cmd_symbol_singleton_class
+ bug6347 = '[ruby-dev:45563]'
+ @not_label = self
+ assert_not_label(:foo, 'class << not_label:foo; end', bug6347)
+ end
+
+ def test_cmd_symbol_superclass
+ bug6347 = '[ruby-dev:45563]'
+ @not_label = Object
+ assert_not_label(:foo, 'class Foo < not_label:foo; end', bug6347)
+ end
+
+ def test_duplicated_arg
+ assert_syntax_error("def foo(a, a) end", /duplicated argument name/)
+ end
+
+ def test_duplicated_rest
+ assert_syntax_error("def foo(a, *a) end", /duplicated argument name/)
+ end
+
+ def test_duplicated_opt
+ assert_syntax_error("def foo(a, a=1) end", /duplicated argument name/)
+ end
+
+ def test_duplicated_opt_rest
+ assert_syntax_error("def foo(a=1, *a) end", /duplicated argument name/)
+ end
+
+ def test_duplicated_rest_opt
+ assert_syntax_error("def foo(*a, a=1) end", /duplicated argument name/)
+ end
+
+ def test_duplicated_rest_post
+ assert_syntax_error("def foo(*a, a) end", /duplicated argument name/)
+ end
+
+ def test_duplicated_opt_post
+ assert_syntax_error("def foo(a=1, a) end", /duplicated argument name/)
+ end
+
+ def test_duplicated_kw
+ assert_syntax_error("def foo(a, a: 1) end", /duplicated argument name/)
+ end
+
+ def test_duplicated_rest_kw
+ assert_syntax_error("def foo(*a, a: 1) end", /duplicated argument name/)
+ end
+
+ def test_duplicated_opt_kw
+ assert_syntax_error("def foo(a=1, a: 1) end", /duplicated argument name/)
+ end
+
+ def test_duplicated_kw_kwrest
+ assert_syntax_error("def foo(a: 1, **a) end", /duplicated argument name/)
+ end
+
+ def test_duplicated_rest_kwrest
+ assert_syntax_error("def foo(*a, **a) end", /duplicated argument name/)
+ end
+
+ def test_duplicated_opt_kwrest
+ assert_syntax_error("def foo(a=1, **a) end", /duplicated argument name/)
+ end
+
+ def test_duplicated_when
+ w = 'warning: duplicated when clause is ignored'
+ assert_warning(/3: #{w}.+4: #{w}.+4: #{w}.+5: #{w}.+5: #{w}/m){
+ eval %q{
+ case 1
+ when 1, 1
+ when 1, 1
+ when 1, 1
+ end
+ }
+ }
+ assert_warning(/#{w}/){#/3: #{w}.+4: #{w}.+5: #{w}.+5: #{w}/m){
+ a = 1
+ eval %q{
+ case 1
+ when 1, 1
+ when 1, a
+ when 1, 1
+ end
+ }
+ }
+ end
+
+ def test_lambda_with_space
+ feature6390 = '[ruby-dev:45605]'
+ assert_valid_syntax("-> (x, y) {}", __FILE__, feature6390)
+ end
+
+ def test_do_block_in_cmdarg_begin
+ bug6419 = '[ruby-dev:45631]'
+ assert_valid_syntax("p begin 1.times do 1 end end", __FILE__, bug6419)
+ end
+
def test_reserved_method_no_args
bug6403 = '[ruby-dev:45626]'
assert_valid_syntax("def self; :foo; end", __FILE__, bug6403)
end
+ def test_unassignable
+ gvar = global_variables
+ %w[self nil true false __FILE__ __LINE__ __ENCODING__].each do |kwd|
+ assert_raise(SyntaxError) {eval("#{kwd} = nil")}
+ assert_equal(gvar, global_variables)
+ end
+ end
+
+ Bug7559 = '[ruby-dev:46737]'
+
+ def test_lineno_command_call_quote
+ expected = __LINE__ + 1
+ actual = caller_lineno "a
+b
+c
+d
+e"
+ assert_equal(expected, actual, "#{Bug7559}: ")
+ end
+
+ def test_lineno_after_heredoc
+ bug7559 = '[ruby-dev:46737]'
+ expected, _, actual = __LINE__, <<eom, __LINE__
+ a
+ b
+ c
+ d
+eom
+ assert_equal(expected, actual, bug7559)
+ end
+
+ def test_lineno_operation_brace_block
+ expected = __LINE__ + 1
+ actual = caller_lineno\
+ {}
+ assert_equal(expected, actual)
+ end
+
+ def assert_constant_reassignment_nested(preset, op, expected, err = [], bug = '[Bug #5449]')
+ [
+ ["p ", ""], # no-pop
+ ["", "p Foo::Bar"], # pop
+ ].each do |p1, p2|
+ src = <<-EOM.gsub(/^\s*\n/, '')
+ class Foo
+ #{"Bar = " + preset if preset}
+ end
+ #{p1}Foo::Bar #{op}= 42
+ #{p2}
+ EOM
+ msg = "\# #{bug}\n#{src}"
+ assert_valid_syntax(src, caller_locations(1, 1)[0].path, msg)
+ assert_in_out_err([], src, expected, err, msg)
+ end
+ end
+
+ def test_constant_reassignment_nested
+ already = /already initialized constant Foo::Bar/
+ uninitialized = /uninitialized constant Foo::Bar/
+ assert_constant_reassignment_nested(nil, "||", %w[42])
+ assert_constant_reassignment_nested("false", "||", %w[42], already)
+ assert_constant_reassignment_nested("true", "||", %w[true])
+ assert_constant_reassignment_nested(nil, "&&", [], uninitialized)
+ assert_constant_reassignment_nested("false", "&&", %w[false])
+ assert_constant_reassignment_nested("true", "&&", %w[42], already)
+ assert_constant_reassignment_nested(nil, "+", [], uninitialized)
+ assert_constant_reassignment_nested("false", "+", [], /undefined method/)
+ assert_constant_reassignment_nested("11", "+", %w[53], already)
+ end
+
+ def assert_constant_reassignment_toplevel(preset, op, expected, err = [], bug = '[Bug #5449]')
+ [
+ ["p ", ""], # no-pop
+ ["", "p ::Bar"], # pop
+ ].each do |p1, p2|
+ src = <<-EOM.gsub(/^\s*\n/, '')
+ #{"Bar = " + preset if preset}
+ class Foo
+ #{p1}::Bar #{op}= 42
+ #{p2}
+ end
+ EOM
+ msg = "\# #{bug}\n#{src}"
+ assert_valid_syntax(src, caller_locations(1, 1)[0].path, msg)
+ assert_in_out_err([], src, expected, err, msg)
+ end
+ end
+
+ def test_constant_reassignment_toplevel
+ already = /already initialized constant Bar/
+ uninitialized = /uninitialized constant Bar/
+ assert_constant_reassignment_toplevel(nil, "||", %w[42])
+ assert_constant_reassignment_toplevel("false", "||", %w[42], already)
+ assert_constant_reassignment_toplevel("true", "||", %w[true])
+ assert_constant_reassignment_toplevel(nil, "&&", [], uninitialized)
+ assert_constant_reassignment_toplevel("false", "&&", %w[false])
+ assert_constant_reassignment_toplevel("true", "&&", %w[42], already)
+ assert_constant_reassignment_toplevel(nil, "+", [], uninitialized)
+ assert_constant_reassignment_toplevel("false", "+", [], /undefined method/)
+ assert_constant_reassignment_toplevel("11", "+", %w[53], already)
+ end
+
+ def test_integer_suffix
+ ["1if true", "begin 1end"].each do |src|
+ assert_valid_syntax(src)
+ assert_equal(1, eval(src), src)
+ end
+ end
+
+ def test_value_of_def
+ assert_separately [], <<-EOS
+ assert_equal(:foo, (def foo; end))
+ assert_equal(:foo, (def (Object.new).foo; end))
+ EOS
+ end
+
+ def test_heredoc_cr
+ assert_syntax_error("puts <<""EOS\n""ng\n""EOS\r""NO\n", /can't find string "EOS" anywhere before EOF/)
+ end
+
+ def test__END___cr
+ assert_syntax_error("__END__\r<<<<<\n", /unexpected <</)
+ end
+
+ def test_warning_for_cr
+ feature8699 = '[ruby-core:56240] [Feature #8699]'
+ assert_warning(/encountered \\r/, feature8699) do
+ eval("\r""__id__\r")
+ end
+ end
+
private
+ def not_label(x) @result = x; @not_label ||= nil end
+ def assert_not_label(expected, src, message = nil)
+ @result = nil
+ assert_nothing_raised(SyntaxError, message) {eval(src)}
+ assert_equal(expected, @result, message)
+ end
+
def make_tmpsrc(f, src)
f.open
f.truncate(0)
@@ -86,4 +425,8 @@ class TestSyntax < Test::Unit::TestCase
const_set(:SCRIPT_LINES__, script_lines) if script_lines
end
end
+
+ def caller_lineno(*)
+ caller_locations(1, 1)[0].lineno
+ end
end
diff --git a/test/ruby/test_system.rb b/test/ruby/test_system.rb
index f1372781cf..db19a3c2cd 100644
--- a/test/ruby/test_system.rb
+++ b/test/ruby/test_system.rb
@@ -84,30 +84,34 @@ class TestSystem < Test::Unit::TestCase
ENV["PATH"] = path
end
File.unlink tmpfilename
+
+ testname = '[ruby-core:44505]'
+ assert_match /Windows/, `ver`, testname
+ assert_equal 0, $?.to_i, testname
end
}
end
def test_system_at
- if /mswin|mingw/ =~ RUBY_PLATFORM
- bug4393 = '[ruby-core:35218]'
+ if /mswin|mingw/ =~ RUBY_PLATFORM
+ bug4393 = '[ruby-core:35218]'
- # @ + builtin command
- assert_equal("foo\n", `@echo foo`, bug4393);
- assert_equal("foo\n", `@@echo foo`, bug4393);
- assert_equal("@@foo\n", `@@echo @@foo`, bug4393);
+ # @ + builtin command
+ assert_equal("foo\n", `@echo foo`, bug4393);
+ assert_equal("foo\n", `@@echo foo`, bug4393);
+ assert_equal("@@foo\n", `@@echo @@foo`, bug4393);
- # @ + non builtin command
- Dir.mktmpdir("ruby_script_tmp") {|tmpdir|
- tmpfilename = "#{tmpdir}/ruby_script_tmp.#{$$}"
+ # @ + non builtin command
+ Dir.mktmpdir("ruby_script_tmp") {|tmpdir|
+ tmpfilename = "#{tmpdir}/ruby_script_tmp.#{$$}"
- tmp = open(tmpfilename, "w")
- tmp.print "foo\nbar\nbaz\n@foo";
- tmp.close
+ tmp = open(tmpfilename, "w")
+ tmp.print "foo\nbar\nbaz\n@foo";
+ tmp.close
- assert_match(/\Abar\nbaz\n?\z/, `@@findstr "ba" #{tmpfilename.gsub("/", "\\")}`, bug4393);
- }
- end
+ assert_match(/\Abar\nbaz\n?\z/, `@@findstr "ba" #{tmpfilename.gsub("/", "\\")}`, bug4393);
+ }
+ end
end
def test_system_redirect_win
@@ -115,11 +119,31 @@ class TestSystem < Test::Unit::TestCase
return
end
- cmd = "%WINDIR%/system32/ping.exe \"BFI3CHL671\" > out.txt 2>NUL"
- assert_equal(false, system(cmd), '[ruby-talk:258939]');
-
- cmd = "\"%WINDIR%/system32/ping.exe BFI3CHL671\" > out.txt 2>NUL"
- assert_equal(false, system(cmd), '[ruby-talk:258939]');
+ Dir.mktmpdir("ruby_script_tmp") do |tmpdir|
+ cmd = nil
+ message = proc do
+ [
+ '[ruby-talk:258939]',
+ "out.txt:",
+ *File.readlines("out.txt").map{|s|" "+s.inspect},
+ "err.txt:",
+ *File.readlines("err.txt").map{|s|" "+s.inspect},
+ "system(#{cmd.inspect})"
+ ].join("\n")
+ end
+ class << message
+ alias to_s call
+ end
+ Dir.chdir(tmpdir) do
+ open("input.txt", "w") {|f| f.puts "BFI3CHL671"}
+ cmd = "%WINDIR%/system32/find.exe \"BFI3CHL671\" input.txt > out.txt 2>err.txt"
+ assert_equal(true, system(cmd), message)
+ cmd = "\"%WINDIR%/system32/find.exe\" \"BFI3CHL671\" input.txt > out.txt 2>err.txt"
+ assert_equal(true, system(cmd), message)
+ cmd = "\"%WINDIR%/system32/find.exe BFI3CHL671\" input.txt > out.txt 2>err.txt"
+ assert_equal(false, system(cmd), message)
+ end
+ end
end
def test_empty_evstr
diff --git a/test/ruby/test_thread.rb b/test/ruby/test_thread.rb
index e8cb3b1722..ab1b81a8fe 100644
--- a/test/ruby/test_thread.rb
+++ b/test/ruby/test_thread.rb
@@ -1,3 +1,4 @@
+# -*- coding: us-ascii -*-
require 'test/unit'
require 'thread'
require_relative 'envutil'
@@ -7,7 +8,6 @@ class TestThread < Test::Unit::TestCase
Threads = []
def self.new(*)
th = super
- th.abort_on_exception = true
Threads << th
th
end
@@ -27,192 +27,90 @@ class TestThread < Test::Unit::TestCase
end
end
- def test_mutex_synchronize
- m = Mutex.new
- r = 0
- max = 10
- (1..max).map{
- Thread.new{
- i=0
- while i<max*max
- i+=1
- m.synchronize{
- r += 1
- }
- end
- }
- }.each{|e|
- e.join
- }
- assert_equal(max * max * max, r)
- end
+ def test_main_thread_variable_in_enumerator
+ assert_equal Thread.main, Thread.current
- def test_condvar
- mutex = Mutex.new
- condvar = ConditionVariable.new
- result = []
- mutex.synchronize do
- t = Thread.new do
- mutex.synchronize do
- result << 1
- condvar.signal
- end
- end
+ Thread.current.thread_variable_set :foo, "bar"
- result << 0
- condvar.wait(mutex)
- result << 2
- t.join
- end
- assert_equal([0, 1, 2], result)
- end
-
- def test_condvar_wait_not_owner
- mutex = Mutex.new
- condvar = ConditionVariable.new
+ thread, value = Fiber.new {
+ Fiber.yield [Thread.current, Thread.current.thread_variable_get(:foo)]
+ }.resume
- assert_raise(ThreadError) { condvar.wait(mutex) }
+ assert_equal Thread.current, thread
+ assert_equal Thread.current.thread_variable_get(:foo), value
end
- def test_condvar_wait_exception_handling
- # Calling wait in the only thread running should raise a ThreadError of
- # 'stopping only thread'
- mutex = Mutex.new
- condvar = ConditionVariable.new
+ def test_thread_variable_in_enumerator
+ Thread.new {
+ Thread.current.thread_variable_set :foo, "bar"
- locked = false
- thread = Thread.new do
- Thread.current.abort_on_exception = false
- mutex.synchronize do
- begin
- condvar.wait(mutex)
- rescue Exception
- locked = mutex.locked?
- raise
- end
- end
- end
-
- until thread.stop?
- sleep(0.1)
- end
+ thread, value = Fiber.new {
+ Fiber.yield [Thread.current, Thread.current.thread_variable_get(:foo)]
+ }.resume
- thread.raise Interrupt, "interrupt a dead condition variable"
- assert_raise(Interrupt) { thread.value }
- assert(locked)
+ assert_equal Thread.current, thread
+ assert_equal Thread.current.thread_variable_get(:foo), value
+ }.join
end
- def test_condvar_wait_and_broadcast
- nr_threads = 3
- threads = Array.new
- mutex = Mutex.new
- condvar = ConditionVariable.new
- result = []
-
- nr_threads.times do |i|
- threads[i] = Thread.new do
- mutex.synchronize do
- result << "C1"
- condvar.wait mutex
- result << "C2"
- end
- end
- end
- sleep 0.1
- mutex.synchronize do
- result << "P1"
- condvar.broadcast
- result << "P2"
- end
- nr_threads.times do |i|
- threads[i].join
- end
-
- assert_equal ["C1", "C1", "C1", "P1", "P2", "C2", "C2", "C2"], result
- end
-
-# Hmm.. don't we have a way of catch fatal exception?
-#
-# def test_cv_wait_deadlock
-# mutex = Mutex.new
-# cv = ConditionVariable.new
-#
-# assert_raises(fatal) {
-# mutex.lock
-# cv.wait mutex
-# mutex.unlock
-# }
-# end
-
- def test_condvar_wait_deadlock_2
- nr_threads = 3
- threads = Array.new
- mutex = Mutex.new
- condvar = ConditionVariable.new
+ def test_thread_variables
+ assert_equal [], Thread.new { Thread.current.thread_variables }.join.value
- nr_threads.times do |i|
- if (i != 0)
- mutex.unlock
- end
- threads[i] = Thread.new do
- mutex.synchronize do
- condvar.wait mutex
- end
- end
- mutex.lock
- end
-
- assert_raise(Timeout::Error) do
- Timeout.timeout(0.1) { condvar.wait mutex }
- end
- mutex.unlock rescue
- threads[i].each.join
+ t = Thread.new {
+ Thread.current.thread_variable_set(:foo, "bar")
+ Thread.current.thread_variables
+ }
+ assert_equal [:foo], t.join.value
end
- def test_condvar_timed_wait
- mutex = Mutex.new
- condvar = ConditionVariable.new
- timeout = 0.3
- locked = false
-
- t0 = Time.now
- mutex.synchronize do
- begin
- condvar.wait(mutex, timeout)
- ensure
- locked = mutex.locked?
- end
- end
- t1 = Time.now
- t = t1-t0
+ def test_thread_variable?
+ refute Thread.new { Thread.current.thread_variable?("foo") }.join.value
+ t = Thread.new {
+ Thread.current.thread_variable_set("foo", "bar")
+ }.join
- assert_block { timeout*0.9 < t && t < timeout*1.1 }
- assert(locked)
+ assert t.thread_variable?("foo")
+ assert t.thread_variable?(:foo)
+ refute t.thread_variable?(:bar)
end
- def test_condvar_nolock
- mutex = Mutex.new
- condvar = ConditionVariable.new
-
- assert_raise(ThreadError) { condvar.wait(mutex) }
+ def test_thread_variable_strings_and_symbols_are_the_same_key
+ t = Thread.new {}.join
+ t.thread_variable_set("foo", "bar")
+ assert_equal "bar", t.thread_variable_get(:foo)
end
- def test_condvar_nolock_2
- mutex = Mutex.new
- condvar = ConditionVariable.new
-
- Thread.new do
- assert_raise(ThreadError) {condvar.wait(mutex)}
- end.join
+ def test_thread_variable_frozen
+ t = Thread.new { }.join
+ t.freeze
+ assert_raise(RuntimeError) do
+ t.thread_variable_set(:foo, "bar")
+ end
end
- def test_condvar_nolock_3
- mutex = Mutex.new
- condvar = ConditionVariable.new
+ def test_mutex_synchronize
+ m = Mutex.new
+ r = 0
+ max = 10
+ (1..max).map{
+ Thread.new{
+ i=0
+ while i<max*max
+ i+=1
+ m.synchronize{
+ r += 1
+ }
+ end
+ }
+ }.each{|e|
+ e.join
+ }
+ assert_equal(max * max * max, r)
+ end
- Thread.new do
- assert_raise(ThreadError) {condvar.wait(mutex, 0.1)}
- end.join
+ def test_mutex_synchronize_yields_no_block_params
+ bug8097 = '[ruby-core:53424] [Bug #8097]'
+ assert_empty(Mutex.new.synchronize {|*params| break params}, bug8097)
end
def test_local_barrier
@@ -222,19 +120,18 @@ class TestThread < Test::Unit::TestCase
require 'envutil'
$:.shift
3.times {
- result = `#{EnvUtil.rubybin} #{lbtest}`
- assert(!$?.coredump?, '[ruby-dev:30653]')
- assert_equal("exit.", result[/.*\Z/], '[ruby-dev:30653]')
+ `#{EnvUtil.rubybin} #{lbtest}`
+ assert_not_predicate($?, :coredump?, '[ruby-dev:30653]')
}
end
def test_priority
c1 = c2 = 0
t1 = Thread.new { loop { c1 += 1 } }
- t1.priority = -1
+ t1.priority = 3
t2 = Thread.new { loop { c2 += 1 } }
t2.priority = -3
- assert_equal(-1, t1.priority)
+ assert_equal(3, t1.priority)
assert_equal(-3, t2.priority)
sleep 0.5
5.times do
@@ -431,30 +328,27 @@ class TestThread < Test::Unit::TestCase
a = ::Thread.new { raise("die now") }
b = Thread.new { Thread.stop }
c = Thread.new { Thread.exit }
- d = Thread.new { sleep }
e = Thread.current
sleep 0.5
assert_equal(nil, a.status)
- assert(a.stop?)
+ assert_predicate(a, :stop?)
assert_equal("sleep", b.status)
- assert(b.stop?)
+ assert_predicate(b, :stop?)
assert_equal(false, c.status)
assert_match(/^#<TestThread::Thread:.* dead>$/, c.inspect)
- assert(c.stop?)
+ assert_predicate(c, :stop?)
- d.kill
- assert_equal(["aborting", false], [d.status, d.stop?])
-
- assert_equal(["run", false], [e.status, e.stop?])
+ es1 = e.status
+ es2 = e.stop?
+ assert_equal(["run", false], [es1, es2])
ensure
a.kill if a
b.kill if b
c.kill if c
- d.kill if d
end
def test_safe_level
@@ -488,16 +382,6 @@ class TestThread < Test::Unit::TestCase
end
def test_thread_local_security
- t = Thread.new { sleep }
-
- assert_raise(SecurityError) do
- Thread.new { $SAFE = 4; t[:foo] }.join
- end
-
- assert_raise(SecurityError) do
- Thread.new { $SAFE = 4; t[:foo] = :baz }.join
- end
-
assert_raise(RuntimeError) do
Thread.new do
Thread.current[:foo] = :bar
@@ -593,7 +477,7 @@ class TestThread < Test::Unit::TestCase
raise "recursive_outer should short circuit intermediate calls"
end
assert_nothing_raised {arr.hash}
- assert(obj[:visited])
+ assert(obj[:visited], "obj.hash was not called")
end
def test_thread_instance_variable
@@ -608,66 +492,198 @@ class TestThread < Test::Unit::TestCase
def test_no_valid_cfp
skip 'with win32ole, cannot run this testcase because win32ole redefines Thread#intialize' if defined?(WIN32OLE)
bug5083 = '[ruby-dev:44208]'
- error = assert_raise(RuntimeError) do
- Thread.new(&Module.method(:nesting)).join
- end
- assert_equal("Can't call on top of Fiber or Thread", error.message, bug5083)
- error = assert_raise(RuntimeError) do
- Thread.new(:to_s, &Module.method(:undef_method)).join
+ assert_equal([], Thread.new(&Module.method(:nesting)).value)
+ assert_instance_of(Thread, Thread.new(:to_s, &Class.new.method(:undef_method)).join)
+ end
+
+ def make_handle_interrupt_test_thread1 flag
+ r = []
+ ready_p = false
+ th = Thread.new{
+ begin
+ Thread.handle_interrupt(RuntimeError => flag){
+ begin
+ ready_p = true
+ sleep 0.5
+ rescue
+ r << :c1
+ end
+ }
+ rescue
+ r << :c2
+ end
+ }
+ Thread.pass until ready_p
+ th.raise
+ begin
+ th.join
+ rescue
+ r << :c3
end
- assert_equal("Can't call on top of Fiber or Thread", error.message, bug5083)
+ r
end
-end
-class TestThreadGroup < Test::Unit::TestCase
- def test_thread_init
- thgrp = ThreadGroup.new
- Thread.new{
- thgrp.add(Thread.current)
- assert_equal(thgrp, Thread.new{sleep 1}.group)
- }.join
+ def test_handle_interrupt
+ [[:never, :c2],
+ [:immediate, :c1],
+ [:on_blocking, :c1]].each{|(flag, c)|
+ assert_equal([flag, c], [flag] + make_handle_interrupt_test_thread1(flag))
+ }
+ # TODO: complex cases are needed.
end
- def test_frozen_thgroup
- thgrp = ThreadGroup.new
+ def test_handle_interrupt_invalid_argument
+ assert_raise(ArgumentError) {
+ Thread.handle_interrupt(RuntimeError => :immediate) # no block
+ }
+ assert_raise(ArgumentError) {
+ Thread.handle_interrupt(RuntimeError => :xyzzy) {}
+ }
+ assert_raise(TypeError) {
+ Thread.handle_interrupt([]) {} # array
+ }
+ end
- t = Thread.new{1}
- Thread.new{
- thgrp.add(Thread.current)
- thgrp.freeze
- assert_raise(ThreadError) do
- Thread.new{1}.join
- end
- assert_raise(ThreadError) do
- thgrp.add(t)
- end
- assert_raise(ThreadError) do
- ThreadGroup.new.add Thread.current
- end
- }.join
- t.join
+ def for_test_handle_interrupt_with_return
+ Thread.handle_interrupt(Object => :never){
+ Thread.current.raise RuntimeError.new("have to be rescured")
+ return
+ }
+ rescue
end
- def test_enclosed_thgroup
- thgrp = ThreadGroup.new
- assert_equal(false, thgrp.enclosed?)
+ def test_handle_interrupt_with_return
+ assert_nothing_raised do
+ for_test_handle_interrupt_with_return
+ _dummy_for_check_ints=nil
+ end
+ end
- t = Thread.new{1}
- Thread.new{
- thgrp.add(Thread.current)
- thgrp.enclose
- assert_equal(true, thgrp.enclosed?)
- assert_nothing_raised do
- Thread.new{1}.join
- end
- assert_raise(ThreadError) do
- thgrp.add t
+ def test_handle_interrupt_with_break
+ assert_nothing_raised do
+ begin
+ Thread.handle_interrupt(Object => :never){
+ Thread.current.raise RuntimeError.new("have to be rescured")
+ break
+ }
+ rescue
end
- assert_raise(ThreadError) do
- ThreadGroup.new.add Thread.current
+ _dummy_for_check_ints=nil
+ end
+ end
+
+ def test_handle_interrupt_blocking
+ r=:ng
+ e=Class.new(Exception)
+ th_s = Thread.current
+ begin
+ th = Thread.start{
+ Thread.handle_interrupt(Object => :on_blocking){
+ begin
+ Thread.current.raise RuntimeError
+ r=:ok
+ sleep
+ ensure
+ th_s.raise e
+ end
+ }
+ }
+ sleep 1
+ r=:ng
+ th.raise RuntimeError
+ th.join
+ rescue e
+ end
+ assert_equal(:ok,r)
+ end
+
+ def test_handle_interrupt_and_io
+ assert_in_out_err([], <<-INPUT, %w(ok), [])
+ th_waiting = true
+
+ t = Thread.new {
+ Thread.handle_interrupt(RuntimeError => :on_blocking) {
+ nil while th_waiting
+ # async interrupt should be raised _before_ writing puts arguments
+ puts "ng"
+ }
+ }
+
+ sleep 0.1
+ t.raise RuntimeError
+ th_waiting = false
+ t.join rescue nil
+ puts "ok"
+ INPUT
+ end
+
+ def test_handle_interrupt_and_p
+ assert_in_out_err([], <<-INPUT, %w(:ok :ok), [])
+ th_waiting = true
+
+ t = Thread.new {
+ Thread.handle_interrupt(RuntimeError => :on_blocking) {
+ nil while th_waiting
+ # p shouldn't provide interruptible point
+ p :ok
+ p :ok
+ }
+ }
+
+ sleep 0.1
+ t.raise RuntimeError
+ th_waiting = false
+ t.join rescue nil
+ INPUT
+ end
+
+ def test_handle_interrupted?
+ q = Queue.new
+ Thread.handle_interrupt(RuntimeError => :never){
+ th = Thread.new{
+ q.push :e
+ begin
+ begin
+ sleep 0.5
+ rescue => e
+ q.push :ng1
+ end
+ begin
+ Thread.handle_interrupt(Object => :immediate){} if Thread.pending_interrupt?
+ rescue RuntimeError => e
+ q.push :ok
+ end
+ rescue => e
+ q.push :ng2
+ ensure
+ q.push :ng3
+ end
+ }
+ q.pop
+ th.raise
+ th.join
+ assert_equal(:ok, q.pop)
+ }
+ end
+
+ def test_thread_timer_and_ensure
+ assert_normal_exit(<<_eom, 'r36492', timeout: 3)
+ flag = false
+ t = Thread.new do
+ begin
+ sleep
+ ensure
+ 1 until flag
end
- }.join
+ end
+
+ Thread.pass until t.status == "sleep"
+
+ t.kill
+ t.alive? == true
+ flag = true
t.join
+_eom
end
def test_uninitialized
@@ -693,7 +709,7 @@ class TestThreadGroup < Test::Unit::TestCase
cmd = 'r,=IO.pipe; Thread.start {Thread.pass until Thread.main.stop?; puts; STDOUT.flush}; r.read'
opt = {}
opt[:new_pgroup] = true if /mswin|mingw/ =~ RUBY_PLATFORM
- s, err = EnvUtil.invoke_ruby(['-e', cmd], "", true, true, opt) do |in_p, out_p, err_p, cpid|
+ s, _err = EnvUtil.invoke_ruby(['-e', cmd], "", true, true, opt) do |in_p, out_p, err_p, cpid|
out_p.gets
pid = cpid
Process.kill(:SIGINT, pid)
@@ -701,13 +717,227 @@ class TestThreadGroup < Test::Unit::TestCase
[$?, err_p.read]
end
t1 = Time.now.to_f
- assert_equal(pid, s.pid)
- unless /mswin|mingw/ =~ RUBY_PLATFORM
- # status of signal is not supported on Windows
- assert_equal([false, true, false, Signal.list["INT"]],
- [s.exited?, s.signaled?, s.stopped?, s.termsig],
- "[s.exited?, s.signaled?, s.stopped?, s.termsig]")
+ assert_equal(pid, s.pid, bug5757)
+ assert_equal([false, true, false, Signal.list["INT"]],
+ [s.exited?, s.signaled?, s.stopped?, s.termsig],
+ "[s.exited?, s.signaled?, s.stopped?, s.termsig]")
+ assert_in_delta(t1 - t0, 1, 1, bug5757)
+ end
+
+ def test_thread_join_in_trap
+ assert_separately [], <<-'EOS'
+ assert_nothing_raised{
+ t = Thread.new{ sleep 0.2; Process.kill(:INT, $$) }
+
+ Signal.trap :INT do
+ t.join
+ end
+
+ t.join
+ }
+ EOS
+
+ assert_separately [], <<-'EOS'
+ assert_equal(:normal_end,
+ begin
+ t = Thread.new{ sleep 0.2; Process.kill(:INT, $$); :normal_end }
+
+ Signal.trap :INT do
+ t.value
+ end
+ t.value
+ end
+ )
+ EOS
+ end
+
+ def test_thread_join_current
+ assert_raise(ThreadError) do
+ Thread.current.join
end
- assert_in_delta(t1 - t0, 1, 1)
end
+
+ def test_thread_join_main_thread
+ assert_raise(ThreadError) do
+ Thread.new(Thread.current) {|t|
+ t.join
+ }.join
+ end
+ end
+
+ def test_main_thread_status_at_exit
+ assert_in_out_err([], <<-INPUT, %w(false), [])
+Thread.new(Thread.current) {|mth|
+ begin
+ sleep 0.1
+ ensure
+ p mth.alive?
+ end
+}
+ INPUT
+ end
+
+ def test_thread_status_in_trap
+ # when running trap handler, Thread#status must show "run"
+ # Even though interrupted from sleeping function
+ assert_in_out_err([], <<-INPUT, %w(sleep run), [])
+ Signal.trap(:INT) {
+ puts Thread.current.status
+ }
+
+ Thread.new(Thread.current) {|mth|
+ sleep 0.01
+ puts mth.status
+ Process.kill(:INT, $$)
+ }
+ sleep 0.1
+ INPUT
+ end
+
+ # Bug #7450
+ def test_thread_status_raise_after_kill
+ ary = []
+
+ t = Thread.new {
+ begin
+ ary << Thread.current.status
+ sleep #1
+ ensure
+ begin
+ ary << Thread.current.status
+ sleep #2
+ ensure
+ ary << Thread.current.status
+ end
+ end
+ }
+
+ begin
+ sleep 0.01
+ t.kill # wake up sleep #1
+ sleep 0.01
+ t.raise "wakeup" # wake up sleep #2
+ sleep 0.01
+ assert_equal(ary, ["run", "aborting", "aborting"])
+ ensure
+ t.join rescue nil
+ end
+ end
+
+ def test_mutex_owned
+ mutex = Mutex.new
+
+ assert_equal(mutex.owned?, false)
+ mutex.synchronize {
+ # Now, I have the mutex
+ assert_equal(mutex.owned?, true)
+ }
+ assert_equal(mutex.owned?, false)
+ end
+
+ def test_mutex_owned2
+ begin
+ mutex = Mutex.new
+ th = Thread.new {
+ # lock forever
+ mutex.lock
+ sleep
+ }
+
+ sleep 0.01 until th.status == "sleep"
+ # acquired another thread.
+ assert_equal(mutex.locked?, true)
+ assert_equal(mutex.owned?, false)
+ ensure
+ th.kill if th
+ end
+ end
+
+ def test_mutex_unlock_on_trap
+ assert_in_out_err([], <<-INPUT, %w(locked unlocked false), [])
+ m = Mutex.new
+
+ Signal.trap("INT") { |signo|
+ m.unlock
+ puts "unlocked"
+ }
+
+ m.lock
+ puts "locked"
+ Process.kill("INT", $$)
+ sleep 0.01
+ puts m.locked?
+ INPUT
+ end
+
+ def invoke_rec script, vm_stack_size, machine_stack_size, use_length = true
+ env = {}
+ env['RUBY_THREAD_VM_STACK_SIZE'] = vm_stack_size.to_s if vm_stack_size
+ env['RUBY_THREAD_MACHINE_STACK_SIZE'] = machine_stack_size.to_s if machine_stack_size
+ out, = EnvUtil.invoke_ruby([env, '-e', script], '', true, true)
+ use_length ? out.length : out
+ end
+
+ def test_stack_size
+ h_default = eval(invoke_rec('p RubyVM::DEFAULT_PARAMS', nil, nil, false))
+ h_0 = eval(invoke_rec('p RubyVM::DEFAULT_PARAMS', 0, 0, false))
+ h_large = eval(invoke_rec('p RubyVM::DEFAULT_PARAMS', 1024 * 1024 * 10, 1024 * 1024 * 10, false))
+
+ assert_operator(h_default[:thread_vm_stack_size], :>, h_0[:thread_vm_stack_size],
+ "0 thread_vm_stack_size")
+ assert_operator(h_default[:thread_vm_stack_size], :<, h_large[:thread_vm_stack_size],
+ "large thread_vm_stack_size")
+ assert_operator(h_default[:thread_machine_stack_size], :>=, h_0[:thread_machine_stack_size],
+ "0 thread_machine_stack_size")
+ assert_operator(h_default[:thread_machine_stack_size], :<=, h_large[:thread_machine_stack_size],
+ "large thread_machine_stack_size")
+
+ # check VM machine stack size
+ script = 'def rec; print "."; STDOUT.flush; rec; end; rec'
+ size_default = invoke_rec script, nil, nil
+ assert_operator(size_default, :>, 0, "default size")
+ size_0 = invoke_rec script, 0, nil
+ assert_operator(size_default, :>, size_0, "0 size")
+ size_large = invoke_rec script, 1024 * 1024 * 10, nil
+ assert_operator(size_default, :<, size_large, "large size")
+
+ return if /mswin|mingw/ =~ RUBY_PLATFORM
+
+ # check machine stack size
+ # Note that machine stack size may not change size (depend on OSs)
+ script = 'def rec; print "."; STDOUT.flush; 1.times{1.times{1.times{rec}}}; end; Thread.new{rec}.join'
+ vm_stack_size = 1024 * 1024
+ size_default = invoke_rec script, vm_stack_size, nil
+ size_0 = invoke_rec script, vm_stack_size, 0
+ assert_operator(size_default, :>=, size_0, "0 size")
+ size_large = invoke_rec script, vm_stack_size, 1024 * 1024 * 10
+ assert_operator(size_default, :<=, size_large, "large size")
+ end
+
+ def test_blocking_mutex_unlocked_on_fork
+ bug8433 = '[ruby-core:55102] [Bug #8433]'
+
+ mutex = Mutex.new
+ flag = false
+ mutex.lock
+
+ th = Thread.new do
+ mutex.synchronize do
+ flag = true
+ sleep
+ end
+ end
+
+ Thread.pass until th.stop?
+ mutex.unlock
+
+ pid = Process.fork do
+ exit(mutex.locked?)
+ end
+
+ th.kill
+
+ pid, status = Process.waitpid2(pid)
+ assert_equal(false, status.success?, bug8433)
+ end if Process.respond_to?(:fork)
end
diff --git a/test/ruby/test_threadgroup.rb b/test/ruby/test_threadgroup.rb
new file mode 100644
index 0000000000..e29c477247
--- /dev/null
+++ b/test/ruby/test_threadgroup.rb
@@ -0,0 +1,55 @@
+require 'test/unit'
+require 'thread'
+require_relative 'envutil'
+
+class TestThreadGroup < Test::Unit::TestCase
+ def test_thread_init
+ thgrp = ThreadGroup.new
+ Thread.new{
+ thgrp.add(Thread.current)
+ assert_equal(thgrp, Thread.new{sleep 1}.group)
+ }.join
+ end
+
+ def test_frozen_thgroup
+ thgrp = ThreadGroup.new
+
+ t = Thread.new{1}
+ Thread.new{
+ thgrp.add(Thread.current)
+ thgrp.freeze
+ assert_raise(ThreadError) do
+ Thread.new{1}.join
+ end
+ assert_raise(ThreadError) do
+ thgrp.add(t)
+ end
+ assert_raise(ThreadError) do
+ ThreadGroup.new.add Thread.current
+ end
+ }.join
+ t.join
+ end
+
+ def test_enclosed_thgroup
+ thgrp = ThreadGroup.new
+ assert_equal(false, thgrp.enclosed?)
+
+ t = Thread.new{1}
+ Thread.new{
+ thgrp.add(Thread.current)
+ thgrp.enclose
+ assert_equal(true, thgrp.enclosed?)
+ assert_nothing_raised do
+ Thread.new{1}.join
+ end
+ assert_raise(ThreadError) do
+ thgrp.add t
+ end
+ assert_raise(ThreadError) do
+ ThreadGroup.new.add Thread.current
+ end
+ }.join
+ t.join
+ end
+end
diff --git a/test/ruby/test_time.rb b/test/ruby/test_time.rb
index 03172149ea..ec6986a824 100644
--- a/test/ruby/test_time.rb
+++ b/test/ruby/test_time.rb
@@ -3,6 +3,7 @@ require 'rational'
require 'delegate'
require 'timeout'
require 'delegate'
+require_relative 'envutil'
class TestTime < Test::Unit::TestCase
def setup
@@ -14,6 +15,15 @@ class TestTime < Test::Unit::TestCase
$VERBOSE = @verbose
end
+ def in_timezone(zone)
+ orig_zone = ENV['TZ']
+
+ ENV['TZ'] = zone
+ yield
+ ensure
+ ENV['TZ'] = orig_zone
+ end
+
def no_leap_seconds?
# 1972-06-30T23:59:60Z is the first leap second.
Time.utc(1972, 7, 1, 0, 0, 0) - Time.utc(1972, 6, 30, 23, 59, 59) == 1
@@ -94,15 +104,13 @@ class TestTime < Test::Unit::TestCase
assert_equal(31536000, Time.utc(1971, 1, 1, 0, 0, 0).tv_sec)
assert_equal(78796799, Time.utc(1972, 6, 30, 23, 59, 59).tv_sec)
- # 1972-06-30T23:59:60Z is the first leap second.
- if Time.utc(1972, 7, 1, 0, 0, 0) - Time.utc(1972, 6, 30, 23, 59, 59) == 1
- # no leap second.
+ if no_leap_seconds?
assert_equal(78796800, Time.utc(1972, 7, 1, 0, 0, 0).tv_sec)
assert_equal(78796801, Time.utc(1972, 7, 1, 0, 0, 1).tv_sec)
assert_equal(946684800, Time.utc(2000, 1, 1, 0, 0, 0).tv_sec)
assert_equal(0x7fffffff, Time.utc(2038, 1, 19, 3, 14, 7).tv_sec)
+ assert_equal(0x80000000, Time.utc(2038, 1, 19, 3, 14, 8).tv_sec)
else
- # leap seconds supported.
assert_equal(2, Time.utc(1972, 7, 1, 0, 0, 0) - Time.utc(1972, 6, 30, 23, 59, 59))
assert_equal(78796800, Time.utc(1972, 6, 30, 23, 59, 60).tv_sec)
assert_equal(78796801, Time.utc(1972, 7, 1, 0, 0, 0).tv_sec)
@@ -291,6 +299,18 @@ class TestTime < Test::Unit::TestCase
assert_equal(29700, t2.utc_offset, bug)
end
+ def test_marshal_zone
+ t = Time.utc(2013, 2, 24)
+ assert_equal('UTC', t.zone)
+ assert_equal('UTC', Marshal.load(Marshal.dump(t)).zone)
+
+ in_timezone('JST-9') do
+ t = Time.local(2013, 2, 24)
+ assert_equal('JST', Time.local(2013, 2, 24).zone)
+ assert_equal('JST', Marshal.load(Marshal.dump(t)).zone)
+ end
+ end
+
def test_marshal_to_s
t1 = Time.new(2011,11,8, 0,42,25, 9*3600)
t2 = Time.at(Marshal.load(Marshal.dump(t1)))
@@ -298,21 +318,37 @@ class TestTime < Test::Unit::TestCase
"[ruby-dev:44827] [Bug #5586]")
end
- # Sat Jan 01 00:00:00 UTC 2000
- T2000 = Time.at(946684800).gmtime
+ Bug8795 = '[ruby-core:56648] [Bug #8795]'
- def test_security_error
- assert_raise(SecurityError) do
- Thread.new do
- t = Time.gm(2000)
- $SAFE = 4
- t.localtime
- end.join
+ def test_marshal_broken_offset
+ data = "\x04\bIu:\tTime\r\xEFF\x1C\x80\x00\x00\x00\x00\x06:\voffset"
+ t1 = t2 = nil
+ in_timezone('UTC') do
+ assert_nothing_raised(TypeError, ArgumentError, Bug8795) do
+ t1 = Marshal.load(data + "T")
+ t2 = Marshal.load(data + "\"\x0ebadoffset")
+ end
+ assert_equal(0, t1.utc_offset)
+ assert_equal(0, t2.utc_offset)
+ end
+ end
+
+ def test_marshal_broken_zone
+ data = "\x04\bIu:\tTime\r\xEFF\x1C\x80\x00\x00\x00\x00\x06:\tzone"
+ t1 = t2 = nil
+ in_timezone('UTC') do
+ assert_nothing_raised(TypeError, ArgumentError, Bug8795) do
+ t1 = Marshal.load(data + "T")
+ t2 = Marshal.load(data + "\"\b\0\0\0")
+ end
+ assert_equal('UTC', t1.zone)
+ assert_equal('UTC', t2.zone)
end
end
def test_at3
- assert_equal(T2000, Time.at(T2000))
+ t2000 = get_t2000
+ assert_equal(t2000, Time.at(t2000))
# assert_raise(RangeError) do
# Time.at(2**31-1, 1_000_000)
# Time.at(2**63-1, 1_000_000)
@@ -324,13 +360,14 @@ class TestTime < Test::Unit::TestCase
end
def test_utc_or_local
- assert_equal(T2000, Time.gm(2000))
- assert_equal(T2000, Time.gm(0, 0, 0, 1, 1, 2000, :foo, :bar, false, :baz))
- assert_equal(T2000, Time.gm(2000, "jan"))
- assert_equal(T2000, Time.gm(2000, "1"))
- assert_equal(T2000, Time.gm(2000, 1, 1, 0, 0, 0, 0))
- assert_equal(T2000, Time.gm(2000, 1, 1, 0, 0, 0, "0"))
- assert_equal(T2000, Time.gm(2000, 1, 1, 0, 0, "0", :foo, :foo))
+ t2000 = get_t2000
+ assert_equal(t2000, Time.gm(2000))
+ assert_equal(t2000, Time.gm(0, 0, 0, 1, 1, 2000, :foo, :bar, false, :baz))
+ assert_equal(t2000, Time.gm(2000, "jan"))
+ assert_equal(t2000, Time.gm(2000, "1"))
+ assert_equal(t2000, Time.gm(2000, 1, 1, 0, 0, 0, 0))
+ assert_equal(t2000, Time.gm(2000, 1, 1, 0, 0, 0, "0"))
+ assert_equal(t2000, Time.gm(2000, 1, 1, 0, 0, "0", :foo, :foo))
assert_raise(ArgumentError) { Time.gm(2000, 1, 1, 0, 0, -1, :foo, :foo) }
assert_raise(ArgumentError) { Time.gm(2000, 1, 1, 0, 0, -1.0, :foo, :foo) }
assert_raise(RangeError) do
@@ -351,7 +388,7 @@ class TestTime < Test::Unit::TestCase
assert_raise(ArgumentError) { Time.gm(2000, 13) }
t = Time.local(2000)
- assert_equal(t.gmt_offset, T2000 - t)
+ assert_equal(t.gmt_offset, t2000 - t)
assert_equal(-4427700000, Time.utc(-4427700000,12,1).year)
assert_equal(-2**30+10, Time.utc(-2**30+10,1,1).year)
@@ -368,18 +405,21 @@ class TestTime < Test::Unit::TestCase
end
def test_to_f
- assert_equal(946684800.0, T2000.to_f)
+ t2000 = Time.at(946684800).gmtime
+ assert_equal(946684800.0, t2000.to_f)
end
def test_cmp
- assert_equal(-1, T2000 <=> Time.gm(2001))
- assert_equal(1, T2000 <=> Time.gm(1999))
- assert_nil(T2000 <=> 0)
+ t2000 = get_t2000
+ assert_equal(-1, t2000 <=> Time.gm(2001))
+ assert_equal(1, t2000 <=> Time.gm(1999))
+ assert_nil(t2000 <=> 0)
end
def test_eql
- assert(T2000.eql?(T2000))
- assert(!T2000.eql?(Time.gm(2001)))
+ t2000 = get_t2000
+ assert(t2000.eql?(t2000))
+ assert(!t2000.eql?(Time.gm(2001)))
end
def test_utc_p
@@ -389,7 +429,8 @@ class TestTime < Test::Unit::TestCase
end
def test_hash
- assert_kind_of(Integer, T2000.hash)
+ t2000 = get_t2000
+ assert_kind_of(Integer, t2000.hash)
end
def test_reinitialize
@@ -402,9 +443,10 @@ class TestTime < Test::Unit::TestCase
end
def test_init_copy
- assert_equal(T2000, T2000.dup)
+ t2000 = get_t2000
+ assert_equal(t2000, t2000.dup)
assert_raise(TypeError) do
- T2000.instance_eval { initialize_copy(nil) }
+ t2000.instance_eval { initialize_copy(nil) }
end
end
@@ -446,22 +488,31 @@ class TestTime < Test::Unit::TestCase
end
def test_asctime
- assert_equal("Sat Jan 1 00:00:00 2000", T2000.asctime)
+ t2000 = get_t2000
+ assert_equal("Sat Jan 1 00:00:00 2000", t2000.asctime)
+ assert_equal(Encoding::US_ASCII, t2000.asctime.encoding)
assert_kind_of(String, Time.at(0).asctime)
end
def test_to_s
- assert_equal("2000-01-01 00:00:00 UTC", T2000.to_s)
+ t2000 = get_t2000
+ assert_equal("2000-01-01 00:00:00 UTC", t2000.to_s)
+ assert_equal(Encoding::US_ASCII, t2000.to_s.encoding)
assert_kind_of(String, Time.at(946684800).getlocal.to_s)
assert_equal(Time.at(946684800).getlocal.to_s, Time.at(946684800).to_s)
end
+ def test_zone
+ assert_equal(Encoding.find('locale'), Time.now.zone.encoding)
+ end
+
def test_plus_minus_succ
- # assert_raise(RangeError) { T2000 + 10000000000 }
- # assert_raise(RangeError) T2000 - 3094168449 }
- # assert_raise(RangeError) { T2000 + 1200798848 }
- assert_raise(TypeError) { T2000 + Time.now }
- assert_equal(T2000 + 1, T2000.succ)
+ t2000 = get_t2000
+ # assert_raise(RangeError) { t2000 + 10000000000 }
+ # assert_raise(RangeError) t2000 - 3094168449 }
+ # assert_raise(RangeError) { t2000 + 1200798848 }
+ assert_raise(TypeError) { t2000 + Time.now }
+ assert_equal(t2000 + 1, t2000.succ)
end
def test_plus_type
@@ -490,26 +541,27 @@ class TestTime < Test::Unit::TestCase
end
def test_readers
- assert_equal(0, T2000.sec)
- assert_equal(0, T2000.min)
- assert_equal(0, T2000.hour)
- assert_equal(1, T2000.mday)
- assert_equal(1, T2000.mon)
- assert_equal(2000, T2000.year)
- assert_equal(6, T2000.wday)
- assert_equal(1, T2000.yday)
- assert_equal(false, T2000.isdst)
- assert_equal("UTC", T2000.zone)
- assert_equal(Encoding.find("locale"), T2000.zone.encoding)
- assert_equal(0, T2000.gmt_offset)
- assert(!T2000.sunday?)
- assert(!T2000.monday?)
- assert(!T2000.tuesday?)
- assert(!T2000.wednesday?)
- assert(!T2000.thursday?)
- assert(!T2000.friday?)
- assert(T2000.saturday?)
- assert_equal([0, 0, 0, 1, 1, 2000, 6, 1, false, "UTC"], T2000.to_a)
+ t2000 = get_t2000
+ assert_equal(0, t2000.sec)
+ assert_equal(0, t2000.min)
+ assert_equal(0, t2000.hour)
+ assert_equal(1, t2000.mday)
+ assert_equal(1, t2000.mon)
+ assert_equal(2000, t2000.year)
+ assert_equal(6, t2000.wday)
+ assert_equal(1, t2000.yday)
+ assert_equal(false, t2000.isdst)
+ assert_equal("UTC", t2000.zone)
+ assert_equal(Encoding.find("locale"), t2000.zone.encoding)
+ assert_equal(0, t2000.gmt_offset)
+ assert(!t2000.sunday?)
+ assert(!t2000.monday?)
+ assert(!t2000.tuesday?)
+ assert(!t2000.wednesday?)
+ assert(!t2000.thursday?)
+ assert(!t2000.friday?)
+ assert(t2000.saturday?)
+ assert_equal([0, 0, 0, 1, 1, 2000, 6, 1, false, "UTC"], t2000.to_a)
t = Time.at(946684800).getlocal
assert_equal(t.sec, Time.at(946684800).sec)
@@ -535,51 +587,68 @@ class TestTime < Test::Unit::TestCase
end
def test_strftime
+ t2000 = get_t2000
t = Time.at(946684800).getlocal
- assert_equal("Sat", T2000.strftime("%a"))
- assert_equal("Saturday", T2000.strftime("%A"))
- assert_equal("Jan", T2000.strftime("%b"))
- assert_equal("January", T2000.strftime("%B"))
- assert_kind_of(String, T2000.strftime("%c"))
- assert_equal("01", T2000.strftime("%d"))
- assert_equal("00", T2000.strftime("%H"))
- assert_equal("12", T2000.strftime("%I"))
- assert_equal("001", T2000.strftime("%j"))
- assert_equal("01", T2000.strftime("%m"))
- assert_equal("00", T2000.strftime("%M"))
- assert_equal("AM", T2000.strftime("%p"))
- assert_equal("00", T2000.strftime("%S"))
- assert_equal("00", T2000.strftime("%U"))
- assert_equal("00", T2000.strftime("%W"))
- assert_equal("6", T2000.strftime("%w"))
- assert_equal("01/01/00", T2000.strftime("%x"))
- assert_equal("00:00:00", T2000.strftime("%X"))
- assert_equal("00", T2000.strftime("%y"))
- assert_equal("2000", T2000.strftime("%Y"))
- assert_equal("UTC", T2000.strftime("%Z"))
- assert_equal("%", T2000.strftime("%%"))
- assert_equal("0", T2000.strftime("%-S"))
-
- assert_equal("", T2000.strftime(""))
- assert_equal("foo\0bar\x0000\x0000\x0000", T2000.strftime("foo\0bar\0%H\0%M\0%S"))
- assert_equal("foo" * 1000, T2000.strftime("foo" * 1000))
+ assert_equal("Sat", t2000.strftime("%a"))
+ assert_equal("Saturday", t2000.strftime("%A"))
+ assert_equal("Jan", t2000.strftime("%b"))
+ assert_equal("January", t2000.strftime("%B"))
+ assert_kind_of(String, t2000.strftime("%c"))
+ assert_equal("01", t2000.strftime("%d"))
+ assert_equal("00", t2000.strftime("%H"))
+ assert_equal("12", t2000.strftime("%I"))
+ assert_equal("001", t2000.strftime("%j"))
+ assert_equal("01", t2000.strftime("%m"))
+ assert_equal("00", t2000.strftime("%M"))
+ assert_equal("AM", t2000.strftime("%p"))
+ assert_equal("00", t2000.strftime("%S"))
+ assert_equal("00", t2000.strftime("%U"))
+ assert_equal("00", t2000.strftime("%W"))
+ assert_equal("6", t2000.strftime("%w"))
+ assert_equal("01/01/00", t2000.strftime("%x"))
+ assert_equal("00:00:00", t2000.strftime("%X"))
+ assert_equal("00", t2000.strftime("%y"))
+ assert_equal("2000", t2000.strftime("%Y"))
+ assert_equal("UTC", t2000.strftime("%Z"))
+ assert_equal("%", t2000.strftime("%%"))
+ assert_equal("0", t2000.strftime("%-S"))
+
+ assert_equal("", t2000.strftime(""))
+ assert_equal("foo\0bar\x0000\x0000\x0000", t2000.strftime("foo\0bar\0%H\0%M\0%S"))
+ assert_equal("foo" * 1000, t2000.strftime("foo" * 1000))
t = Time.mktime(2000, 1, 1)
assert_equal("Sat", t.strftime("%a"))
+ end
+ def test_strftime_subsec
t = Time.at(946684800, 123456.789)
assert_equal("123", t.strftime("%3N"))
assert_equal("123456", t.strftime("%6N"))
assert_equal("123456789", t.strftime("%9N"))
assert_equal("1234567890", t.strftime("%10N"))
assert_equal("123456789", t.strftime("%0N"))
+ end
+
+ def test_strftime_sec
+ t = get_t2000.getlocal
assert_equal("000", t.strftime("%3S"))
+ end
+
+ def test_strftime_seconds_from_epoch
+ t = Time.at(946684800, 123456.789)
assert_equal("946684800", t.strftime("%s"))
assert_equal("946684800", t.utc.strftime("%s"))
+ end
+ def test_strftime_zone
t = Time.mktime(2001, 10, 1)
assert_equal("2001-10-01", t.strftime("%F"))
+ assert_equal(Encoding::UTF_8, t.strftime("\u3042%Z").encoding)
+ assert_equal(true, t.strftime("\u3042%Z").valid_encoding?)
+ end
+ def test_strftime_flags
t = Time.mktime(2001, 10, 1, 2, 0, 0)
assert_equal("01", t.strftime("%d"))
assert_equal("01", t.strftime("%0d"))
@@ -620,7 +689,14 @@ class TestTime < Test::Unit::TestCase
assert_equal(" 2", t.strftime("%l"))
assert_equal("02", t.strftime("%0l"))
assert_equal(" 2", t.strftime("%_l"))
+ end
+
+ def test_strftime_invalid_flags
+ t = Time.mktime(2001, 10, 1, 2, 0, 0)
+ assert_equal("%4^p", t.strftime("%4^p"), 'prec after flag')
+ end
+ def test_strftime_year
t = Time.utc(1,1,4)
assert_equal("0001", t.strftime("%Y"))
assert_equal("0001", t.strftime("%G"))
@@ -632,32 +708,42 @@ class TestTime < Test::Unit::TestCase
t = Time.utc(-1,1,4)
assert_equal("-0001", t.strftime("%Y"))
assert_equal("-0001", t.strftime("%G"))
+ end
+ def test_strftime_weeknum
# [ruby-dev:37155]
t = Time.mktime(1970, 1, 18)
assert_equal("0", t.strftime("%w"))
assert_equal("7", t.strftime("%u"))
+ end
+ def test_strftime_ctrlchar
# [ruby-dev:37160]
- assert_equal("\t", T2000.strftime("%t"))
- assert_equal("\t", T2000.strftime("%0t"))
- assert_equal("\t", T2000.strftime("%1t"))
- assert_equal(" \t", T2000.strftime("%3t"))
- assert_equal("00\t", T2000.strftime("%03t"))
- assert_equal("\n", T2000.strftime("%n"))
- assert_equal("\n", T2000.strftime("%0n"))
- assert_equal("\n", T2000.strftime("%1n"))
- assert_equal(" \n", T2000.strftime("%3n"))
- assert_equal("00\n", T2000.strftime("%03n"))
-
+ t2000 = get_t2000
+ assert_equal("\t", t2000.strftime("%t"))
+ assert_equal("\t", t2000.strftime("%0t"))
+ assert_equal("\t", t2000.strftime("%1t"))
+ assert_equal(" \t", t2000.strftime("%3t"))
+ assert_equal("00\t", t2000.strftime("%03t"))
+ assert_equal("\n", t2000.strftime("%n"))
+ assert_equal("\n", t2000.strftime("%0n"))
+ assert_equal("\n", t2000.strftime("%1n"))
+ assert_equal(" \n", t2000.strftime("%3n"))
+ assert_equal("00\n", t2000.strftime("%03n"))
+ end
+
+ def test_strftime_weekflags
# [ruby-dev:37162]
- assert_equal("SAT", T2000.strftime("%#a"))
- assert_equal("SATURDAY", T2000.strftime("%#A"))
- assert_equal("JAN", T2000.strftime("%#b"))
- assert_equal("JANUARY", T2000.strftime("%#B"))
- assert_equal("JAN", T2000.strftime("%#h"))
+ t2000 = get_t2000
+ assert_equal("SAT", t2000.strftime("%#a"))
+ assert_equal("SATURDAY", t2000.strftime("%#A"))
+ assert_equal("JAN", t2000.strftime("%#b"))
+ assert_equal("JANUARY", t2000.strftime("%#B"))
+ assert_equal("JAN", t2000.strftime("%#h"))
assert_equal("FRIDAY", Time.local(2008,1,4).strftime("%#A"))
+ end
+ def test_strftime_rational
t = Time.utc(2000,3,14, 6,53,"58.979323846".to_r) # Pi Day
assert_equal("03/14/2000 6:53:58.97932384600000000000000000000",
t.strftime("%m/%d/%Y %l:%M:%S.%29N"))
@@ -677,44 +763,88 @@ class TestTime < Test::Unit::TestCase
t.strftime("%m/%d/%Y %l:%M:%S.%9N"))
assert_equal("03/14/1592 6:53:58.97932384",
t.strftime("%m/%d/%Y %l:%M:%S.%8N"))
+ end
+ def test_strftime_far_future
# [ruby-core:33985]
assert_equal("3000000000", Time.at(3000000000).strftime('%s'))
+ end
+ def test_strftime_too_wide
bug4457 = '[ruby-dev:43285]'
assert_raise(Errno::ERANGE, bug4457) {Time.now.strftime('%8192z')}
+ end
+ def test_strfimte_zoneoffset
+ t2000 = get_t2000
+ t = t2000.getlocal("+09:00:00")
+ assert_equal("+0900", t.strftime("%z"))
+ assert_equal("+09:00", t.strftime("%:z"))
+ assert_equal("+09:00:00", t.strftime("%::z"))
+ assert_equal("+09", t.strftime("%:::z"))
+
+ t = t2000.getlocal("+09:00:01")
+ assert_equal("+0900", t.strftime("%z"))
+ assert_equal("+09:00", t.strftime("%:z"))
+ assert_equal("+09:00:01", t.strftime("%::z"))
+ assert_equal("+09:00:01", t.strftime("%:::z"))
+ end
+
+ def test_strftime_padding
bug4458 = '[ruby-dev:43287]'
- t = T2000.getlocal("+09:00")
+ t2000 = get_t2000
+ t = t2000.getlocal("+09:00")
+ assert_equal("+0900", t.strftime("%z"))
+ assert_equal("+09:00", t.strftime("%:z"))
assert_equal(" +900", t.strftime("%_10z"), bug4458)
assert_equal("+000000900", t.strftime("%10z"), bug4458)
- assert_equal(" +9:00", t.strftime("%_:10z"), bug4458)
- assert_equal("+000009:00", t.strftime("%:10z"), bug4458)
- assert_equal(" +9:00:00", t.strftime("%_::10z"), bug4458)
- assert_equal("+009:00:00", t.strftime("%::10z"), bug4458)
- t = T2000.getlocal("-05:00")
+ assert_equal(" +9:00", t.strftime("%_10:z"), bug4458)
+ assert_equal("+000009:00", t.strftime("%10:z"), bug4458)
+ assert_equal(" +9:00:00", t.strftime("%_10::z"), bug4458)
+ assert_equal("+009:00:00", t.strftime("%10::z"), bug4458)
+ assert_equal("+000000009", t.strftime("%10:::z"))
+ t = t2000.getlocal("-05:00")
+ assert_equal("-0500", t.strftime("%z"))
+ assert_equal("-05:00", t.strftime("%:z"))
assert_equal(" -500", t.strftime("%_10z"), bug4458)
assert_equal("-000000500", t.strftime("%10z"), bug4458)
- assert_equal(" -5:00", t.strftime("%_:10z"), bug4458)
- assert_equal("-000005:00", t.strftime("%:10z"), bug4458)
- assert_equal(" -5:00:00", t.strftime("%_::10z"), bug4458)
- assert_equal("-005:00:00", t.strftime("%::10z"), bug4458)
+ assert_equal(" -5:00", t.strftime("%_10:z"), bug4458)
+ assert_equal("-000005:00", t.strftime("%10:z"), bug4458)
+ assert_equal(" -5:00:00", t.strftime("%_10::z"), bug4458)
+ assert_equal("-005:00:00", t.strftime("%10::z"), bug4458)
+ assert_equal("-000000005", t.strftime("%10:::z"))
bug6323 = '[ruby-core:44447]'
- t = T2000.getlocal("+00:36")
+ t = t2000.getlocal("+00:36")
assert_equal(" +036", t.strftime("%_10z"), bug6323)
assert_equal("+000000036", t.strftime("%10z"), bug6323)
- assert_equal(" +0:36", t.strftime("%_:10z"), bug6323)
- assert_equal("+000000:36", t.strftime("%:10z"), bug6323)
- assert_equal(" +0:36:00", t.strftime("%_::10z"), bug6323)
- assert_equal("+000:36:00", t.strftime("%::10z"), bug6323)
- t = T2000.getlocal("-00:55")
+ assert_equal(" +0:36", t.strftime("%_10:z"), bug6323)
+ assert_equal("+000000:36", t.strftime("%10:z"), bug6323)
+ assert_equal(" +0:36:00", t.strftime("%_10::z"), bug6323)
+ assert_equal("+000:36:00", t.strftime("%10::z"), bug6323)
+ assert_equal("+000000:36", t.strftime("%10:::z"))
+ t = t2000.getlocal("-00:55")
assert_equal(" -055", t.strftime("%_10z"), bug6323)
assert_equal("-000000055", t.strftime("%10z"), bug6323)
- assert_equal(" -0:55", t.strftime("%_:10z"), bug6323)
- assert_equal("-000000:55", t.strftime("%:10z"), bug6323)
- assert_equal(" -0:55:00", t.strftime("%_::10z"), bug6323)
- assert_equal("-000:55:00", t.strftime("%::10z"), bug6323)
+ assert_equal(" -0:55", t.strftime("%_10:z"), bug6323)
+ assert_equal("-000000:55", t.strftime("%10:z"), bug6323)
+ assert_equal(" -0:55:00", t.strftime("%_10::z"), bug6323)
+ assert_equal("-000:55:00", t.strftime("%10::z"), bug6323)
+ assert_equal("-000000:55", t.strftime("%10:::z"))
+ end
+
+ def test_strftime_invalid_modifier
+ t2000 = get_t2000
+ t = t2000.getlocal("+09:00")
+ assert_equal("%:y", t.strftime("%:y"), 'invalid conversion after : modifier')
+ assert_equal("%:0z", t.strftime("%:0z"), 'flag after : modifier')
+ assert_equal("%:10z", t.strftime("%:10z"), 'prec after : modifier')
+ assert_equal("%Ob", t.strftime("%Ob"), 'invalid conversion after locale modifier')
+ assert_equal("%Eb", t.strftime("%Eb"), 'invalid conversion after locale modifier')
+ assert_equal("%O0y", t.strftime("%O0y"), 'flag after locale modifier')
+ assert_equal("%E0y", t.strftime("%E0y"), 'flag after locale modifier')
+ assert_equal("%O10y", t.strftime("%O10y"), 'prec after locale modifier')
+ assert_equal("%E10y", t.strftime("%E10y"), 'prec after locale modifier')
end
def test_delegate
@@ -768,7 +898,7 @@ class TestTime < Test::Unit::TestCase
bug5012 = "[ruby-dev:44071]"
t0 = Time.now
- class <<t0; end
+ class << t0; end
t1 = t0.getlocal
def t0.m
@@ -777,4 +907,99 @@ class TestTime < Test::Unit::TestCase
assert_raise(NoMethodError, bug5012) { t1.m }
end
+
+ def test_sec_str
+ bug6193 = '[ruby-core:43569]'
+ t = nil
+ assert_nothing_raised(bug6193) {t = Time.new(2012, 1, 2, 3, 4, "5")}
+ assert_equal(Time.new(2012, 1, 2, 3, 4, 5), t, bug6193)
+ end
+
+ def test_past
+ [
+ [-(1 << 100), 1, 1, 0, 0, 0],
+ [-4000, 1, 1, 0, 0, 0],
+ [-3000, 1, 1, 0, 0, 0],
+ ].each {|year, mon, day, hour, min, sec|
+ t = Time.utc(year, mon, day, hour, min, sec)
+ assert_equal(year, t.year)
+ assert_equal(mon, t.mon)
+ assert_equal(day, t.day)
+ assert_equal(hour, t.hour)
+ assert_equal(min, t.min)
+ assert_equal(sec, t.sec)
+ }
+ end
+
+ def test_1901
+ assert_equal(-0x80000001, Time.utc(1901, 12, 13, 20, 45, 51).tv_sec)
+ [
+ [1901, 12, 13, 20, 45, 50],
+ [1901, 12, 13, 20, 45, 51],
+ [1901, 12, 13, 20, 45, 52], # -0x80000000
+ [1901, 12, 13, 20, 45, 53],
+ ].each {|year, mon, day, hour, min, sec|
+ t = Time.utc(year, mon, day, hour, min, sec)
+ assert_equal(year, t.year)
+ assert_equal(mon, t.mon)
+ assert_equal(day, t.day)
+ assert_equal(hour, t.hour)
+ assert_equal(min, t.min)
+ assert_equal(sec, t.sec)
+ }
+ end
+
+ def test_1970
+ assert_equal(0, Time.utc(1970, 1, 1, 0, 0, 0).tv_sec)
+ [
+ [1969, 12, 31, 23, 59, 59],
+ [1970, 1, 1, 0, 0, 0],
+ [1970, 1, 1, 0, 0, 1],
+ ].each {|year, mon, day, hour, min, sec|
+ t = Time.utc(year, mon, day, hour, min, sec)
+ assert_equal(year, t.year)
+ assert_equal(mon, t.mon)
+ assert_equal(day, t.day)
+ assert_equal(hour, t.hour)
+ assert_equal(min, t.min)
+ assert_equal(sec, t.sec)
+ }
+ end
+
+ def test_2038
+ if no_leap_seconds?
+ assert_equal(0x80000000, Time.utc(2038, 1, 19, 3, 14, 8).tv_sec)
+ end
+ [
+ [2038, 1, 19, 3, 14, 7],
+ [2038, 1, 19, 3, 14, 8],
+ [2038, 1, 19, 3, 14, 9],
+ [2039, 1, 1, 0, 0, 0],
+ ].each {|year, mon, day, hour, min, sec|
+ t = Time.utc(year, mon, day, hour, min, sec)
+ assert_equal(year, t.year)
+ assert_equal(mon, t.mon)
+ assert_equal(day, t.day)
+ assert_equal(hour, t.hour)
+ assert_equal(min, t.min)
+ assert_equal(sec, t.sec)
+ }
+ end
+
+ def test_future
+ [
+ [3000, 1, 1, 0, 0, 0],
+ [4000, 1, 1, 0, 0, 0],
+ [1 << 100, 1, 1, 0, 0, 0],
+ ].each {|year, mon, day, hour, min, sec|
+ t = Time.utc(year, mon, day, hour, min, sec)
+ assert_equal(year, t.year)
+ assert_equal(mon, t.mon)
+ assert_equal(day, t.day)
+ assert_equal(hour, t.hour)
+ assert_equal(min, t.min)
+ assert_equal(sec, t.sec)
+ }
+ end
+
end
diff --git a/test/ruby/test_time_tz.rb b/test/ruby/test_time_tz.rb
index 42c4607bf3..bb69af87b4 100644
--- a/test/ruby/test_time_tz.rb
+++ b/test/ruby/test_time_tz.rb
@@ -1,8 +1,18 @@
require 'test/unit'
class TestTimeTZ < Test::Unit::TestCase
- def with_tz(tz)
- if /linux/ =~ RUBY_PLATFORM || ENV["RUBY_FORCE_TIME_TZ_TEST"] == "yes"
+ has_right_tz = true
+ force_tz_test = ENV["RUBY_FORCE_TIME_TZ_TEST"] == "yes"
+ case RUBY_PLATFORM
+ when /linux/
+ force_tz_test = true
+ when /darwin|freebsd/
+ has_right_tz = false
+ force_tz_test = true
+ end
+
+ if force_tz_test
+ def with_tz(tz)
old = ENV["TZ"]
begin
ENV["TZ"] = tz
@@ -10,7 +20,9 @@ class TestTimeTZ < Test::Unit::TestCase
ensure
ENV["TZ"] = old
end
- else
+ end
+ else
+ def with_tz(tz)
if ENV["TZ"] == tz
yield
end
@@ -60,10 +72,12 @@ class TestTimeTZ < Test::Unit::TestCase
include Util
extend Util
- def time_to_s(t)
- if RUBY_VERSION < "1.9"
+ if RUBY_VERSION < "1.9"
+ def time_to_s(t)
t.strftime("%Y-%m-%d %H:%M:%S ") + format_gmtoff(t.gmtoff)
- else
+ end
+ else
+ def time_to_s(t)
t.to_s
end
end
@@ -112,7 +126,7 @@ class TestTimeTZ < Test::Unit::TestCase
end
def test_canada_newfoundland
- with_tz(tz="Canada/Newfoundland") {
+ with_tz(tz="America/St_Johns") {
assert_time_constructor(tz, "2007-11-03 23:00:59 -0230", :new, [2007,11,3,23,0,59,:dst])
assert_time_constructor(tz, "2007-11-03 23:01:00 -0230", :new, [2007,11,3,23,1,0,:dst])
assert_time_constructor(tz, "2007-11-03 23:59:59 -0230", :new, [2007,11,3,23,59,59,:dst])
@@ -139,7 +153,7 @@ class TestTimeTZ < Test::Unit::TestCase
with_tz(tz="Europe/Lisbon") {
assert_equal("LMT", Time.new(-0x1_0000_0000_0000_0000).zone)
}
- end
+ end if has_right_tz
def test_europe_moscow
with_tz(tz="Europe/Moscow") {
@@ -164,7 +178,7 @@ class TestTimeTZ < Test::Unit::TestCase
assert_time_constructor(tz, "2009-01-01 00:00:00 UTC", :utc, [2008,12,31,24,0,0])
assert_time_constructor(tz, "2009-01-01 00:00:00 UTC", :utc, [2009,1,1,0,0,0])
}
- end
+ end if has_right_tz
def test_right_america_los_angeles
with_tz(tz="right/America/Los_Angeles") {
@@ -172,7 +186,7 @@ class TestTimeTZ < Test::Unit::TestCase
assert_time_constructor(tz, "2008-12-31 15:59:60 -0800", :local, [2008,12,31,15,59,60])
assert_time_constructor(tz, "2008-12-31 16:00:00 -0800", :local, [2008,12,31,16,0,0])
}
- end
+ end if has_right_tz
MON2NUM = {
"Jan" => 1, "Feb" => 2, "Mar" => 3, "Apr" => 4, "May" => 5, "Jun" => 6,
@@ -186,9 +200,9 @@ class TestTimeTZ < Test::Unit::TestCase
s.sub(/gen_/) { "gen" + "_#{hint}_".gsub(/[^0-9A-Za-z]+/, '_') }
end
- def self.gen_zdump_test
+ def self.gen_zdump_test(data)
sample = []
- ZDUMP_SAMPLE.each_line {|line|
+ data.each_line {|line|
next if /\A\#/ =~ line || /\A\s*\z/ =~ line
/\A(\S+)\s+
\S+\s+(\S+)\s+(\d+)\s+(\d\d):(\d\d):(\d\d)\s+(\d+)\s+UTC
@@ -274,7 +288,7 @@ class TestTimeTZ < Test::Unit::TestCase
}
end
- ZDUMP_SAMPLE = <<'End'
+ gen_zdump_test <<'End'
America/Lima Sun Apr 1 03:59:59 1990 UTC = Sat Mar 31 23:59:59 1990 PEST isdst=1 gmtoff=-14400
America/Lima Sun Apr 1 04:00:00 1990 UTC = Sat Mar 31 23:00:00 1990 PET isdst=0 gmtoff=-18000
America/Lima Sat Jan 1 04:59:59 1994 UTC = Fri Dec 31 23:59:59 1993 PET isdst=0 gmtoff=-18000
@@ -302,10 +316,10 @@ Asia/Tokyo Sat May 5 16:59:59 1951 UTC = Sun May 6 01:59:59 1951 JST isdst=0
Asia/Tokyo Sat May 5 17:00:00 1951 UTC = Sun May 6 03:00:00 1951 JDT isdst=1 gmtoff=36000
Asia/Tokyo Fri Sep 7 15:59:59 1951 UTC = Sat Sep 8 01:59:59 1951 JDT isdst=1 gmtoff=36000
Asia/Tokyo Fri Sep 7 16:00:00 1951 UTC = Sat Sep 8 01:00:00 1951 JST isdst=0 gmtoff=32400
-Canada/Newfoundland Sun Mar 11 03:30:59 2007 UTC = Sun Mar 11 00:00:59 2007 NST isdst=0 gmtoff=-12600
-Canada/Newfoundland Sun Mar 11 03:31:00 2007 UTC = Sun Mar 11 01:01:00 2007 NDT isdst=1 gmtoff=-9000
-Canada/Newfoundland Sun Nov 4 02:30:59 2007 UTC = Sun Nov 4 00:00:59 2007 NDT isdst=1 gmtoff=-9000
-Canada/Newfoundland Sun Nov 4 02:31:00 2007 UTC = Sat Nov 3 23:01:00 2007 NST isdst=0 gmtoff=-12600
+America/St_Johns Sun Mar 11 03:30:59 2007 UTC = Sun Mar 11 00:00:59 2007 NST isdst=0 gmtoff=-12600
+America/St_Johns Sun Mar 11 03:31:00 2007 UTC = Sun Mar 11 01:01:00 2007 NDT isdst=1 gmtoff=-9000
+America/St_Johns Sun Nov 4 02:30:59 2007 UTC = Sun Nov 4 00:00:59 2007 NDT isdst=1 gmtoff=-9000
+America/St_Johns Sun Nov 4 02:31:00 2007 UTC = Sat Nov 3 23:01:00 2007 NST isdst=0 gmtoff=-12600
Europe/Brussels Sun Apr 30 22:59:59 1916 UTC = Sun Apr 30 23:59:59 1916 CET isdst=0 gmtoff=3600
Europe/Brussels Sun Apr 30 23:00:00 1916 UTC = Mon May 1 01:00:00 1916 CEST isdst=1 gmtoff=7200
Europe/Brussels Sat Sep 30 22:59:59 1916 UTC = Sun Oct 1 00:59:59 1916 CEST isdst=1 gmtoff=7200
@@ -326,6 +340,8 @@ Europe/Moscow Sat Sep 26 18:59:59 1992 UTC = Sat Sep 26 22:59:59 1992 MSD isdst
Europe/Moscow Sat Sep 26 19:00:00 1992 UTC = Sat Sep 26 22:00:00 1992 MSK isdst=0 gmtoff=10800
Pacific/Kiritimati Sun Jan 1 09:59:59 1995 UTC = Sat Dec 31 23:59:59 1994 LINT isdst=0 gmtoff=-36000
Pacific/Kiritimati Sun Jan 1 10:00:00 1995 UTC = Mon Jan 2 00:00:00 1995 LINT isdst=0 gmtoff=50400
+End
+ gen_zdump_test <<'End' if has_right_tz
right/America/Los_Angeles Fri Jun 30 23:59:60 1972 UTC = Fri Jun 30 16:59:60 1972 PDT isdst=1 gmtoff=-25200
right/America/Los_Angeles Wed Dec 31 23:59:60 2008 UTC = Wed Dec 31 15:59:60 2008 PST isdst=0 gmtoff=-28800
#right/Asia/Tokyo Fri Jun 30 23:59:60 1972 UTC = Sat Jul 1 08:59:60 1972 JST isdst=0 gmtoff=32400
@@ -334,5 +350,4 @@ right/Europe/Paris Fri Jun 30 23:59:60 1972 UTC = Sat Jul 1 00:59:60 1972 CET
right/Europe/Paris Wed Dec 31 23:59:60 2008 UTC = Thu Jan 1 00:59:60 2009 CET isdst=0 gmtoff=3600
Europe/Lisbon Mon Jan 1 00:36:31 1912 UTC = Sun Dec 31 23:59:59 1911 LMT isdst=0 gmtoff=-2192
End
- gen_zdump_test
end
diff --git a/test/ruby/test_transcode.rb b/test/ruby/test_transcode.rb
index d6e5852743..25c9d24663 100644
--- a/test/ruby/test_transcode.rb
+++ b/test/ruby/test_transcode.rb
@@ -2,6 +2,7 @@
# some of the comments are in UTF-8
require 'test/unit'
+require_relative 'envutil'
class TestTranscode < Test::Unit::TestCase
def test_errors
assert_raise(Encoding::ConverterNotFoundError) { 'abc'.encode('foo', 'bar') }
@@ -29,16 +30,16 @@ class TestTranscode < Test::Unit::TestCase
end
def test_noargument
- default_default_internal = Encoding.default_internal
- Encoding.default_internal = nil
- assert_equal("\u3042".encode, "\u3042")
- assert_equal("\xE3\x81\x82\x81".force_encoding("utf-8").encode,
- "\xE3\x81\x82\x81".force_encoding("utf-8"))
- Encoding.default_internal = 'EUC-JP'
- assert_equal("\u3042".encode, "\xA4\xA2".force_encoding('EUC-JP'))
- assert_equal("\xE3\x81\x82\x81".force_encoding("utf-8").encode,
- "\xA4\xA2?".force_encoding('EUC-JP'))
- Encoding.default_internal = default_default_internal
+ EnvUtil.with_default_internal(nil) do
+ assert_equal("\u3042".encode, "\u3042")
+ assert_equal("\xE3\x81\x82\x81".force_encoding("utf-8").encode,
+ "\xE3\x81\x82\x81".force_encoding("utf-8"))
+ end
+ EnvUtil.with_default_internal('EUC-JP') do
+ assert_equal("\u3042".encode, "\xA4\xA2".force_encoding('EUC-JP'))
+ assert_equal("\xE3\x81\x82\x81".force_encoding("utf-8").encode,
+ "\xA4\xA2?".force_encoding('EUC-JP'))
+ end
end
def test_length
@@ -51,7 +52,7 @@ class TestTranscode < Test::Unit::TestCase
end
def check_both_ways(utf8, raw, encoding)
- assert_equal(utf8.force_encoding('utf-8'), raw.encode('utf-8', encoding),utf8.dump)
+ assert_equal(utf8.force_encoding('utf-8'), raw.encode('utf-8', encoding),utf8.dump+raw.dump)
assert_equal(raw.force_encoding(encoding), utf8.encode(encoding, 'utf-8'))
end
@@ -60,13 +61,42 @@ class TestTranscode < Test::Unit::TestCase
assert_equal(str2.force_encoding(enc2), str1.encode(enc2, enc1))
end
+ def test_encoding_of_ascii_originating_from_binary
+ binary_string = [0x82, 0x74, 0x68, 0x69, 0x73, 0x20, 0x69, 0x73, 0x20,
+ 0x61, 0x20, 0x76, 0x65, 0x72, 0x79, 0x20, 0x6c, 0x6f,
+ 0x6e, 0x67, 0x20, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67]
+ class << binary_string
+ # create a copy on write substring that contains
+ # just the ascii characters (i.e. this is...), in JRuby
+ # the underlying string have the same buffer backing
+ # it up, but the offset of the string will be 1 instead
+ # of 0.
+ def make_cow_substring
+ pack('C27').slice(1, 26)
+ end
+ end
+
+ ascii_string = binary_string.make_cow_substring
+ assert_equal("this is a very long string", ascii_string)
+ assert_equal(Encoding::ASCII_8BIT, ascii_string.encoding)
+ utf8_string = nil
+ assert_nothing_raised("JRUBY-6764") do
+ utf8_string = ascii_string.encode(Encoding::UTF_8)
+ end
+ assert_equal("this is a very long string", utf8_string)
+ assert_equal(Encoding::UTF_8, utf8_string.encoding)
+ end
+
def test_encodings
check_both_ways("\u307E\u3064\u3082\u3068 \u3086\u304D\u3072\u308D",
"\x82\xdc\x82\xc2\x82\xe0\x82\xc6 \x82\xe4\x82\xab\x82\xd0\x82\xeb", 'shift_jis') # ã¾ã¤ã‚‚㨠ゆãã²ã‚
check_both_ways("\u307E\u3064\u3082\u3068 \u3086\u304D\u3072\u308D",
"\xa4\xde\xa4\xc4\xa4\xe2\xa4\xc8 \xa4\xe6\xa4\xad\xa4\xd2\xa4\xed", 'euc-jp')
+ check_both_ways("\u307E\u3064\u3082\u3068 \u3086\u304D\u3072\u308D",
+ "\xa4\xde\xa4\xc4\xa4\xe2\xa4\xc8 \xa4\xe6\xa4\xad\xa4\xd2\xa4\xed", 'euc-jis-2004')
check_both_ways("\u677E\u672C\u884C\u5F18", "\x8f\xbc\x96\x7b\x8d\x73\x8d\x4f", 'shift_jis') # æ¾æœ¬è¡Œå¼˜
check_both_ways("\u677E\u672C\u884C\u5F18", "\xbe\xbe\xcb\xdc\xb9\xd4\xb9\xb0", 'euc-jp')
+ check_both_ways("\u677E\u672C\u884C\u5F18", "\xbe\xbe\xcb\xdc\xb9\xd4\xb9\xb0", 'euc-jis-2004')
check_both_ways("D\u00FCrst", "D\xFCrst", 'iso-8859-1') # Dürst
check_both_ways("D\u00FCrst", "D\xFCrst", 'iso-8859-2')
check_both_ways("D\u00FCrst", "D\xFCrst", 'iso-8859-3')
@@ -83,6 +113,7 @@ class TestTranscode < Test::Unit::TestCase
check_both_ways("\u0643\u062A\u0628", "\xE3\xCA\xC8", 'iso-8859-6') # كتب
check_both_ways("\u65E5\u8A18", "\x93\xFA\x8BL", 'shift_jis') # 日記
check_both_ways("\u65E5\u8A18", "\xC6\xFC\xB5\xAD", 'euc-jp')
+ check_both_ways("\u65E5\u8A18", "\xC6\xFC\xB5\xAD", 'euc-jis-2004')
check_both_ways("\uC560\uC778\uAD6C\uD568\u0020\u6734\uC9C0\uC778",
"\xBE\xD6\xC0\xCE\xB1\xB8\xC7\xD4\x20\xDA\xD3\xC1\xF6\xC0\xCE", 'euc-kr') # ì• ì¸êµ¬í•¨ 朴지ì¸
check_both_ways("\uC544\uD58F\uD58F\u0020\uB620\uBC29\uD6BD\uB2D8\u0020\uC0AC\uB791\uD716",
@@ -1155,9 +1186,15 @@ class TestTranscode < Test::Unit::TestCase
assert_equal("\uFFFD!",
"\xff!".encode("utf-8", "euc-jp", :invalid=>:replace))
assert_equal("\uFFFD!",
+ "\xff!".encode("utf-8", "euc-jis-2004", :invalid=>:replace))
+ assert_equal("\uFFFD!",
"\xa1!".encode("utf-8", "euc-jp", :invalid=>:replace))
assert_equal("\uFFFD!",
+ "\xa1!".encode("utf-8", "euc-jis-2004", :invalid=>:replace))
+ assert_equal("\uFFFD!",
"\x8f\xa1!".encode("utf-8", "euc-jp", :invalid=>:replace))
+ assert_equal("\uFFFD!",
+ "\x8f\xa1!".encode("utf-8", "euc-jis-2004", :invalid=>:replace))
assert_equal("?",
"\xdc\x00".encode("EUC-JP", "UTF-16BE", :invalid=>:replace), "[ruby-dev:35776]")
@@ -1174,6 +1211,7 @@ class TestTranscode < Test::Unit::TestCase
def test_invalid_replace_string
assert_equal("a<x>A", "a\x80A".encode("us-ascii", "euc-jp", :invalid=>:replace, :replace=>"<x>"))
+ assert_equal("a<x>A", "a\x80A".encode("us-ascii", "euc-jis-2004", :invalid=>:replace, :replace=>"<x>"))
end
def test_undef_replace
@@ -1288,6 +1326,64 @@ class TestTranscode < Test::Unit::TestCase
check_both_ways("\u795E\u6797\u7FA9\u535A", "\xBF\xC0\xCE\xD3\xB5\xC1\xC7\xEE", 'euc-jp') # 神林義åš
end
+ def test_euc_jis_2004
+ check_both_ways("\u3000", "\xA1\xA1", 'euc-jis-2004') # full-width space
+ check_both_ways("\u00D7", "\xA1\xDF", 'euc-jis-2004') # ×
+ check_both_ways("\u00F7", "\xA1\xE0", 'euc-jis-2004') # ÷
+ check_both_ways("\u25C7", "\xA1\xFE", 'euc-jis-2004') # â—‡
+ check_both_ways("\u25C6", "\xA2\xA1", 'euc-jis-2004') # â—†
+ check_both_ways("\uFF07", "\xA2\xAF", 'euc-jis-2004') # '
+ check_both_ways("\u309F", "\xA2\xB9", 'euc-jis-2004') # ゟ
+ check_both_ways("\u2284", "\xA2\xC2", 'euc-jis-2004') # ⊄
+ check_both_ways("\u2306", "\xA2\xC9", 'euc-jis-2004') # ⌆
+ check_both_ways("\u2295", "\xA2\xD1", 'euc-jis-2004') # ⊕
+ check_both_ways("\u3017", "\xA2\xDB", 'euc-jis-2004') # 〗
+ check_both_ways("\u2262", "\xA2\xEB", 'euc-jis-2004') # ≢
+ check_both_ways("\u2194", "\xA2\xF1", 'euc-jis-2004') # ↔
+ check_both_ways("\u266E", "\xA2\xFA", 'euc-jis-2004') # â™®
+ check_both_ways("\u2669", "\xA2\xFD", 'euc-jis-2004') # ♩
+ check_both_ways("\u25EF", "\xA2\xFE", 'euc-jis-2004') # â—¯
+ check_both_ways("\u2935", "\xA3\xAF", 'euc-jis-2004') # ⤵
+ check_both_ways("\u29BF", "\xA3\xBA", 'euc-jis-2004') # ⦿
+ check_both_ways("\u2022", "\xA3\xC0", 'euc-jis-2004') # •
+ check_both_ways("\u2213", "\xA3\xDB", 'euc-jis-2004') # ∓
+ check_both_ways("\u2127", "\xA3\xE0", 'euc-jis-2004') # â„§
+ check_both_ways("\u30A0", "\xA3\xFB", 'euc-jis-2004') # ã‚ 
+ check_both_ways("\uFF54", "\xA3\xF4", 'euc-jis-2004') # ï½”
+ assert_raise(Encoding::UndefinedConversionError) { "\xA5\xF7".encode("utf-8", 'euc-jis-2004') }
+ check_both_ways("\u2664", "\xA6\xB9", 'euc-jis-2004') # ♤
+ check_both_ways("\u2663", "\xA6\xC0", 'euc-jis-2004') # ♣
+ check_both_ways("\u03C2", "\xA6\xD9", 'euc-jis-2004') # Ï‚
+ check_both_ways("\u23BE", "\xA7\xC2", 'euc-jis-2004') # ⎾
+ check_both_ways("\u23CC", "\xA7\xD0", 'euc-jis-2004') # âŒ
+ check_both_ways("\u30F7", "\xA7\xF2", 'euc-jis-2004') # ヷ
+ check_both_ways("\u3251", "\xA8\xC1", 'euc-jis-2004') # ㉑
+ check_both_ways("\u{20B9F}", "\xCF\xD4", 'euc-jis-2004') # ð ®‘
+ check_both_ways("\u541E", "\xCF\xFE", 'euc-jis-2004') # åž
+ check_both_ways("\u6A97", "\xDD\xA1", 'euc-jis-2004') # 檗
+ check_both_ways("\u6BEF", "\xDD\xDF", 'euc-jis-2004') # 毯
+ check_both_ways("\u9EBE", "\xDD\xE0", 'euc-jis-2004') # 麾
+ check_both_ways("\u6CBE", "\xDD\xFE", 'euc-jis-2004') # æ²¾
+ check_both_ways("\u6CBA", "\xDE\xA1", 'euc-jis-2004') # 沺
+ check_both_ways("\u6ECC", "\xDE\xFE", 'euc-jis-2004') # 滌
+ check_both_ways("\u6F3E", "\xDF\xA1", 'euc-jis-2004') # æ¼¾
+ check_both_ways("\u70DD", "\xDF\xDF", 'euc-jis-2004') # çƒ
+ check_both_ways("\u70D9", "\xDF\xE0", 'euc-jis-2004') # 烙
+ check_both_ways("\u71FC", "\xDF\xFE", 'euc-jis-2004') # 燼
+ check_both_ways("\u71F9", "\xE0\xA1", 'euc-jis-2004') # 燹
+ check_both_ways("\u73F1", "\xE0\xFE", 'euc-jis-2004') # ç±
+ check_both_ways("\u5653", "\xF4\xA7", 'euc-jis-2004') # 噓
+ #check_both_ways("\u9ADC", "\xFC\xE3", 'euc-jp') # 髜 (IBM extended)
+
+ check_both_ways("\u9DD7", "\xFE\xE5", 'euc-jis-2004') # é·—
+ check_both_ways("\u{2000B}", "\xAE\xA2", 'euc-jis-2004') # 𠀋
+ check_both_ways("\u{2A6B2}", "\x8F\xFE\xF6", 'euc-jis-2004') # 𪚲
+
+ check_both_ways("\u677E\u672C\u884C\u5F18", "\xBE\xBE\xCB\xDC\xB9\xD4\xB9\xB0", 'euc-jis-2004') # æ¾æœ¬è¡Œå¼˜
+ check_both_ways("\u9752\u5C71\u5B66\u9662\u5927\u5B66", "\xC0\xC4\xBB\xB3\xB3\xD8\xB1\xA1\xC2\xE7\xB3\xD8", 'euc-jis-2004') # é’山学院大学
+ check_both_ways("\u795E\u6797\u7FA9\u535A", "\xBF\xC0\xCE\xD3\xB5\xC1\xC7\xEE", 'euc-jis-2004') # 神林義åš
+ end
+
def test_eucjp_ms
check_both_ways("\u2116", "\xAD\xE2", 'eucJP-ms') # NUMERO SIGN
check_both_ways("\u221A", "\xA2\xE5", 'eucJP-ms') # SQUARE ROOT
@@ -1931,11 +2027,13 @@ class TestTranscode < Test::Unit::TestCase
end
def test_utf8_mac
- assert_equal("\u{fb4d}", "\u05DB\u05BF".encode("UTF-8", "UTF8-MAC"))
- assert_equal("\u{1ff7}", "\u03C9\u0345\u0342".encode("UTF-8", "UTF8-MAC"))
+ # composition exclusion
+ assert_equal("\u05DB\u05BF", "\u05DB\u05BF".encode("UTF-8", "UTF8-MAC")) #"\u{fb4d}"
+
+ assert_equal("\u{1ff7}", "\u03C9\u0342\u0345".encode("UTF-8", "UTF8-MAC"))
assert_equal("\u05DB\u05BF", "\u{fb4d}".encode("UTF8-MAC").force_encoding("UTF-8"))
- assert_equal("\u03C9\u0345\u0342", "\u{1ff7}".encode("UTF8-MAC").force_encoding("UTF-8"))
+ assert_equal("\u03C9\u0342\u0345", "\u{1ff7}".encode("UTF8-MAC").force_encoding("UTF-8"))
check_both_ways("\u{e9 74 e8}", "e\u0301te\u0300", 'UTF8-MAC')
end
@@ -1965,4 +2063,21 @@ class TestTranscode < Test::Unit::TestCase
end
assert_equal("U+3042", "\u{3042}".encode("US-ASCII", fallback: fallback.method(:escape)))
end
+
+ bug8940 = '[ruby-core:57318] [Bug #8940]'
+ %w[UTF-32 UTF-16].each do |enc|
+ define_method("test_pseudo_encoding_inspect(#{enc})") do
+ assert_normal_exit("'aaa'.encode('#{enc}').inspect", bug8940)
+ assert_equal(4, 'aaa'.encode(enc).length, "should count in #{enc} with BOM")
+ end
+ end
+
+ def test_encode_with_invalid_chars
+ bug8995 = '[ruby-dev:47747]'
+ EnvUtil.with_default_internal(Encoding::UTF_8) do
+ str = "\xff".force_encoding('utf-8')
+ assert_equal str, str.encode, bug8995
+ assert_equal "\ufffd", str.encode(invalid: :replace), bug8995
+ end
+ end
end
diff --git a/test/ruby/test_unicode_escape.rb b/test/ruby/test_unicode_escape.rb
index 088f81ce14..2561b49486 100644
--- a/test/ruby/test_unicode_escape.rb
+++ b/test/ruby/test_unicode_escape.rb
@@ -1,6 +1,7 @@
# -*- coding: utf-8 -*-
require 'test/unit'
+require_relative 'envutil'
class TestUnicodeEscape < Test::Unit::TestCase
def test_basic
@@ -47,7 +48,8 @@ EOS
# \u in %x strings
assert_match(/^("?)A\1$/, `echo "\u0041"`) #"
assert_match(/^("?)A\1$/, %x{echo "\u0041"}) #"
- assert_match(/^("?)ü\1$/, `echo "\u{FC}"`.force_encoding("utf-8")) #"
+ assert_match(/^("?)ü\1$/,
+ `#{EnvUtil.rubybin} -e "#coding:utf-8\nputs \\"\\u{FC}\\""`.force_encoding("utf-8")) #"
# \u in quoted symbols
assert_equal(:A, :"\u0041")
diff --git a/test/ruby/test_whileuntil.rb b/test/ruby/test_whileuntil.rb
index 5628317cb8..9731879122 100644
--- a/test/ruby/test_whileuntil.rb
+++ b/test/ruby/test_whileuntil.rb
@@ -1,5 +1,6 @@
require 'test/unit'
require 'tmpdir'
+require_relative 'envutil'
class TestWhileuntil < Test::Unit::TestCase
def test_while
@@ -68,7 +69,7 @@ class TestWhileuntil < Test::Unit::TestCase
tmp.close
File.unlink tmpfilename or `/bin/rm -f "#{tmpfilename}"`
- assert(!File.exist?(tmpfilename))
+ assert_file.not_exist?(tmpfilename)
}
end
diff --git a/test/ruby/test_yield.rb b/test/ruby/test_yield.rb
index 3337aea078..143ee55a9f 100644
--- a/test/ruby/test_yield.rb
+++ b/test/ruby/test_yield.rb
@@ -379,4 +379,15 @@ class TestRubyYieldGen < Test::Unit::TestCase
}
end
+ def test_block_with_mock
+ y = Object.new
+ def y.s(a)
+ yield(a)
+ end
+ m = Object.new
+ def m.method_missing(*a)
+ super
+ end
+ assert_equal [m, nil], y.s(m){|a,b|[a,b]}
+ end
end
diff --git a/test/rubygems/alternate_cert.pem b/test/rubygems/alternate_cert.pem
new file mode 100644
index 0000000000..a5a82910d9
--- /dev/null
+++ b/test/rubygems/alternate_cert.pem
@@ -0,0 +1,18 @@
+-----BEGIN CERTIFICATE-----
+MIIC9zCCAd+gAwIBAgIBADANBgkqhkiG9w0BAQUFADAtMRIwEAYDVQQDDAlhbHRl
+cm5hdGUxFzAVBgoJkiaJk/IsZAEZFgdleGFtcGxlMCAXDTEyMTIwODAwMDAwMFoY
+Dzk5OTkxMjMxMjM1OTU5WjAtMRIwEAYDVQQDDAlhbHRlcm5hdGUxFzAVBgoJkiaJ
+k/IsZAEZFgdleGFtcGxlMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA
+vZQipBa1xH3M9OonkrUYhGZeX9UHAcJhe6jJbUr/uHXkh1Tu2ERWNnblm85upqBf
+jyZEnKer7uBcwwkkvmisVgC8uBECymsBxuEIw0rfiKYEnLu0B6SiWFYz3dYPS92b
+BK7Vks2/kNyXUmLLGoZ3id2K0eK5C/AJ0j+p84OqPnVhylsjrZmXfIZrh7lkHhgC
+IrzPefjE3pOloi/tz6fh2ktb0FYKQMfweT3Ba2TMeflG13PEOW80AD5w0THxDutG
+G0zPNCDyDEoT7UU1a3B3RMHYuUxEk1GUEYWq9L6a6SMpZISWTSpCp0Ww1QB55PON
+iCCn+o6vcIy46jI71dATAQIDAQABoyAwHjAcBgNVHREEFTATgRFhbHRlcm5hdGVA
+ZXhhbXBsZTANBgkqhkiG9w0BAQUFAAOCAQEAtiOe4Ws0hQdxlPCHcngMoWeWMg/d
+EtYHy1vD9oTOEGax6y319ShFNzCTG5Mk9dVXdVTrwml9+SrqmLbcckzr05TpSq3t
+JcNjx+qMwU31655DY+r2Le1mbrhhXilLJ++KjhaIzeqmA55MFLNBdMrApL0v2Tf9
+e9aiL8W8jXPX24uJd5eaFTsPV3NfcYV/iDyf1zv2Fe3NO8e0V1luQxJd3v+ILlRo
+YAkm2DK83G++YkvgsopRdOFfFsY3Gb6XtL87iGOWRbdNK90pThpfORcKoTus7QLx
+l7vsHsOJF5NZwLiBF9ufKH6fUV3Fy25JwB/z8kR8Bkplcl0F8jpJYrd6NQ==
+-----END CERTIFICATE-----
diff --git a/test/rubygems/alternate_cert_32.pem b/test/rubygems/alternate_cert_32.pem
new file mode 100644
index 0000000000..6ef8999ee7
--- /dev/null
+++ b/test/rubygems/alternate_cert_32.pem
@@ -0,0 +1,18 @@
+-----BEGIN CERTIFICATE-----
+MIIC9TCCAd2gAwIBAgIBATANBgkqhkiG9w0BAQUFADAtMRIwEAYDVQQDDAlhbHRl
+cm5hdGUxFzAVBgoJkiaJk/IsZAEZFgdleGFtcGxlMB4XDTEyMTIwODAwMDAwMFoX
+DTM4MDExOTAzMTQwN1owLTESMBAGA1UEAwwJYWx0ZXJuYXRlMRcwFQYKCZImiZPy
+LGQBGRYHZXhhbXBsZTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAL2U
+IqQWtcR9zPTqJ5K1GIRmXl/VBwHCYXuoyW1K/7h15IdU7thEVjZ25ZvObqagX48m
+RJynq+7gXMMJJL5orFYAvLgRAsprAcbhCMNK34imBJy7tAekolhWM93WD0vdmwSu
+1ZLNv5Dcl1JiyxqGd4nditHiuQvwCdI/qfODqj51YcpbI62Zl3yGa4e5ZB4YAiK8
+z3n4xN6TpaIv7c+n4dpLW9BWCkDH8Hk9wWtkzHn5RtdzxDlvNAA+cNEx8Q7rRhtM
+zzQg8gxKE+1FNWtwd0TB2LlMRJNRlBGFqvS+mukjKWSElk0qQqdFsNUAeeTzjYgg
+p/qOr3CMuOoyO9XQEwECAwEAAaMgMB4wHAYDVR0RBBUwE4ERYWx0ZXJuYXRlQGV4
+YW1wbGUwDQYJKoZIhvcNAQEFBQADggEBABB+jdfwANRtIQKCvv+1VnYm+3QSfshy
+TI5Kk50TphheDJ7VbYyTmOxPUTsFzn0cX8zD1jBOtdVdyy6u7qUHOw6ZrDKdgg4I
+95lJJibFrVXeazTByHhe31u08lMfp/6kdYwSornHUWmEHhAT60nvSbkLblW/jgPo
+i1pFY5hcGJAE6kFQLQpjgl8TbUTioA8wYOKJA5ITItBXO7fYMQKDS2jYR3JMiNLR
+FxgN8SzSUB0S7deI5O9fMLYL006zHP5u0qcZjVFvFJdtt3WsqDUu8E6O4QgVwvq1
+MPNUBfuNdMek1LnIUZgr7Jek+0wvbnZCGyEaVakcV74cq8fjEgWr3C0=
+-----END CERTIFICATE-----
diff --git a/test/rubygems/alternate_key.pem b/test/rubygems/alternate_key.pem
new file mode 100644
index 0000000000..14ca734aba
--- /dev/null
+++ b/test/rubygems/alternate_key.pem
@@ -0,0 +1,27 @@
+-----BEGIN RSA PRIVATE KEY-----
+MIIEowIBAAKCAQEAvZQipBa1xH3M9OonkrUYhGZeX9UHAcJhe6jJbUr/uHXkh1Tu
+2ERWNnblm85upqBfjyZEnKer7uBcwwkkvmisVgC8uBECymsBxuEIw0rfiKYEnLu0
+B6SiWFYz3dYPS92bBK7Vks2/kNyXUmLLGoZ3id2K0eK5C/AJ0j+p84OqPnVhylsj
+rZmXfIZrh7lkHhgCIrzPefjE3pOloi/tz6fh2ktb0FYKQMfweT3Ba2TMeflG13PE
+OW80AD5w0THxDutGG0zPNCDyDEoT7UU1a3B3RMHYuUxEk1GUEYWq9L6a6SMpZISW
+TSpCp0Ww1QB55PONiCCn+o6vcIy46jI71dATAQIDAQABAoIBAArXgfOoaNTH7QTE
+r2awfKp1wEfywufS2ghcasiZVW6TL3Kd5NrxbYzH1/HFKIbW/SAOrDXZUPfkVOnC
+iBtrmQ+CE0jjkClLXVqmW/3vNkF2XSUphu44+B/dLjItn8pS7h6icQxoP+Bk/TJ0
++/CUaBm2Vc4TDUolfCpOAcYvbXkM3BL+N/XN2JHX52D2ljXtryrNm/sFnabUVo96
+ghWqln8TqpYTagcs/JkEQ5YxwqFuBLofz3SgzCnf8ub8WTIpYhWzWZ4yHjZSL7AS
+54mkJarKWMUYcL/Qeuy1U9vxLrbC9V7cPzSkzYxPZF7XlYaJcAbItX182ufZ1uNX
+3JlQS5ECgYEA+6fbg+WKy5AazEs8YokPjq1X1P01o95KUWFg+68ALowQXEYcExew
+PG0BKW11WrR6Bnn41++13k8Qsrq7Tl8ynCO6ANhoWAxUksdJDAuEgQqpFuRXwa/D
+d++8WlWD4XYqLwiE+h72alE/Ce/SdfPPsyBeHtXo7fih378WyZn7K9cCgYEAwNnw
+zjndLtj9bxd4awHHWgQ7QpKCmtLMGlg7Teo9aODMO80G3h8NEEG6Ou6LHn88tqgH
+yu0WcjJmhINAzNzmABdw+WuV4C94glwtXctQ0w4byuLOaKSh3ggWUnKf56A2KyPh
+JHPe/+A1DTKAgBvU/i5Vx0kZBkUMiiEVcIOgHOcCgYBNkt6998IjIdbA5uhET4+2
+IYUTqMIiM2GhWG026CkcMBzS9OGumPzAg7F5/b3RKhT7bhnhJolfb+vrzFf0vq+x
+JeouXIc9rP9dB4Vi6yH7TTf2UIkksXOFwybCid3PYEd8nBmxqF25RDY0b/LmXTPH
+OdEJnFLjGGN9vz/dAVRFnQKBgQC8hE8hSO8uHG+haRANim+VTw2exhllvypFlnpi
+b9gX7ae3zXQpLbFXcujZMtZLuZVf+GGlvJ10hFAyuRtfJ5CuBjwplUGtJLpotDKk
+vVsE9YW1joC3SjfxE3a+oc4uXi6VfT1YpOwYtNMnU3bJxGsxDZpMdOhBeL4JSM3s
+br7VgQKBgBDdJHRQOkP41Iq7CjcheTJMeXsQJt+HLHSIpEkxi8v/9bLKPbRVRo7e
+8mmEr9mvjrNLVZMrQpgngRGbFzcdi9iDv+4m0OKU7BGZyWy1gtlUV77FqsL7EEl3
+gdM670c2kkrni5DdpTLpNgF6zRKK7ArZ6kSgmuEYJCGHHlpbkg3f
+-----END RSA PRIVATE KEY-----
diff --git a/test/rubygems/bad_rake.rb b/test/rubygems/bad_rake.rb
new file mode 100644
index 0000000000..379a4c986e
--- /dev/null
+++ b/test/rubygems/bad_rake.rb
@@ -0,0 +1 @@
+exit 1
diff --git a/test/rubygems/ca_cert.pem b/test/rubygems/ca_cert.pem
index 5acdcf8f32..5207531bc2 100644
--- a/test/rubygems/ca_cert.pem
+++ b/test/rubygems/ca_cert.pem
@@ -43,3 +43,26 @@ ySjIblqVQkPuzebv3Ror6ZnVDukn96Mg7kP4u6zgxOeqlJGRe1M949SS9Vudjl8X
SF4aZUUB9pQGhsqQJVqaz2OlhGOp9D0q54xko/rekjAIcuDjl1mdX4F2WRrzpUmZ
uY/bPeOBYiVsOYVe
-----END CERTIFICATE-----
+
+-----BEGIN CERTIFICATE-----
+MIIDtTCCAp2gAwIBAgIJANz6ehBcVuuiMA0GCSqGSIb3DQEBBQUAMEUxCzAJBgNV
+BAYTAkFVMRMwEQYDVQQIEwpTb21lLVN0YXRlMSEwHwYDVQQKExhJbnRlcm5ldCBX
+aWRnaXRzIFB0eSBMdGQwHhcNMTMwNTAxMTQ0NTQxWhcNMjMwMzEwMTQ0NTQxWjBF
+MQswCQYDVQQGEwJBVTETMBEGA1UECBMKU29tZS1TdGF0ZTEhMB8GA1UEChMYSW50
+ZXJuZXQgV2lkZ2l0cyBQdHkgTHRkMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIB
+CgKCAQEAzlpZwhEYoALOEKU4lmMw5l3YI/gadzDOoELtdcidvVvovKK8IIOTDwbA
+3XcjwV0UPGEPOK4Uk1aD0EKkOQVg8ivSre2a3FFGffs2kXck+doJMzAA+pf8tvFk
+QsETVOurOp74GN+er2xbbRSDVxQKq6d+QTe1E60btyXQS5M1Nt5SvLn8dazZJgvv
+3yzJQ1IOQl+xeEO0WVVhPIx5Mx3VtjjcDyl8aewPkYkzia6UOrAyQZnl5sIzWGOb
+kYKCNeKjTPepzlbMx0dN6jBupPYGNB+4FYY9GezInjGbRP5np5382wd3EWwsVzic
+Nau8kXHTL2r7GzNvoy0p//iPCqx9FQIDAQABo4GnMIGkMB0GA1UdDgQWBBS7B027
+H/ZIkW3ngm1SrR0X/aTCwDB1BgNVHSMEbjBsgBS7B027H/ZIkW3ngm1SrR0X/aTC
+wKFJpEcwRTELMAkGA1UEBhMCQVUxEzARBgNVBAgTClNvbWUtU3RhdGUxITAfBgNV
+BAoTGEludGVybmV0IFdpZGdpdHMgUHR5IEx0ZIIJANz6ehBcVuuiMAwGA1UdEwQF
+MAMBAf8wDQYJKoZIhvcNAQEFBQADggEBAC0glUrUiylTfuOWlwkQvi74oiYC5CzW
+Jfusg6o/Gg1XEuJhaHiYMsK/do16gSc6Za3934rHQbYu3mesyFkCWF9kD4J6/hEO
+OQL8xmmgN7wS6GXy6oIODpny0MgnFrV4gd1aEx69NIfL/wXaM8Gw2sj1TnuGLs8+
+HFmWLRRH3WSR7ZLnqYzPVJwhHu8vtZBL9HZk1J6xyq00Nwi2Cz5WdiHamgaza3TS
+OgBdWwDeSClwhrTJni4d30dbq+eNMByIZ7QNGBQivpFzDxeNV/2UBrTU0CilKG5Q
+j7ZwknfKeA4xUTd8TMK3vKab5JJCfjbXOTHZQsYUcEEGSjOMS8/YVQs=
+-----END CERTIFICATE-----
diff --git a/test/rubygems/child_cert.pem b/test/rubygems/child_cert.pem
new file mode 100644
index 0000000000..3079a9e604
--- /dev/null
+++ b/test/rubygems/child_cert.pem
@@ -0,0 +1,18 @@
+-----BEGIN CERTIFICATE-----
+MIIC7DCCAdSgAwIBAgIBAjANBgkqhkiG9w0BAQUFADAqMQ8wDQYDVQQDDAZub2Jv
+ZHkxFzAVBgoJkiaJk/IsZAEZFgdleGFtcGxlMCAXDTEyMTIwODAwMDAwMFoYDzk5
+OTkxMjMxMjM1OTU5WjApMQ4wDAYDVQQDDAVjaGlsZDEXMBUGCgmSJomT8ixkARkW
+B2V4YW1wbGUwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDKf7+1q0cR
+MhC/RM6Whpon/5IxuSve3CCxxdN0LcSbUisFMlf28Zj+S545SKFc6gHFcnYLZZsy
+Gm4FWEd4DhNpg/kgoDPuPGwQp2DEOvKnnneB/Shj8V+6oLrjXaZFAu8Q916c5/BL
+z+PlHIIsO/Q865XOK+5z1sZi0xval8QT7u4Usrcy86gevflCbpBAWkNPa/DZDqA9
+nk0vB2XDSHvhavcrYLfDrYAnFz3wiZ70LYQrmdeOqkPpaiw//Qpzqp+vtuF2br6U
+iYWpN+dhdFsIxAwIE5kWZ1kk6OBJ4kHvr+Sh8Oqbf6WFBhW/lQa9wldA0xhNwhGr
+1FDEfC+0g/BvAgMBAAGjHDAaMBgGA1UdEQQRMA+BDWNoaWxkQGV4YW1wbGUwDQYJ
+KoZIhvcNAQEFBQADggEBAGuRKUhUhtmObY00za/qw71wjqtNZad5+k9acM/xh/my
++YEBSlj8ZIWD1H0kUmAO0Pmwab6ziFA8IrAo0N1D897o7eP83KzVeVxoJi1g+8rS
+u16bF7cC5zT9S/N/ZNTVz9ERjRAD7MdcbXEikKPaqjqzZBViClqpO8YQ6Z9bFgXk
+gV9plX1ki17H+EuXNs21gqsy+8NAxTlXKuF5JKriBOQ9XW62496F/yZPw6XQ50My
+R21cOLiDdoXDmS4Wo7bJ+sbR3N1JbhqZ7Wt9DkQnMtXw4xOcFM5PsVIsmn1KhGGp
+v8GAxxUMzFoPvsx+XcV9TWjR1seYlXnvdlx65YYtZg8=
+-----END CERTIFICATE-----
diff --git a/test/rubygems/child_cert_32.pem b/test/rubygems/child_cert_32.pem
new file mode 100644
index 0000000000..35ba720d6c
--- /dev/null
+++ b/test/rubygems/child_cert_32.pem
@@ -0,0 +1,18 @@
+-----BEGIN CERTIFICATE-----
+MIIC6jCCAdKgAwIBAgIBAzANBgkqhkiG9w0BAQUFADAqMQ8wDQYDVQQDDAZub2Jv
+ZHkxFzAVBgoJkiaJk/IsZAEZFgdleGFtcGxlMB4XDTEyMTIwODAwMDAwMFoXDTM4
+MDExOTAzMTQwN1owKTEOMAwGA1UEAwwFY2hpbGQxFzAVBgoJkiaJk/IsZAEZFgdl
+eGFtcGxlMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAyn+/tatHETIQ
+v0TOloaaJ/+SMbkr3twgscXTdC3Em1IrBTJX9vGY/kueOUihXOoBxXJ2C2WbMhpu
+BVhHeA4TaYP5IKAz7jxsEKdgxDryp553gf0oY/FfuqC6412mRQLvEPdenOfwS8/j
+5RyCLDv0POuVzivuc9bGYtMb2pfEE+7uFLK3MvOoHr35Qm6QQFpDT2vw2Q6gPZ5N
+Lwdlw0h74Wr3K2C3w62AJxc98Ime9C2EK5nXjqpD6WosP/0Kc6qfr7bhdm6+lImF
+qTfnYXRbCMQMCBOZFmdZJOjgSeJB76/kofDqm3+lhQYVv5UGvcJXQNMYTcIRq9RQ
+xHwvtIPwbwIDAQABoxwwGjAYBgNVHREEETAPgQ1jaGlsZEBleGFtcGxlMA0GCSqG
+SIb3DQEBBQUAA4IBAQAzsudxe1TkFtYmCmnT2LVeafo6dVinRJGmdSWeUfNfqRM4
+fgDVg21ym/4Y/bIW3W2lPe9aYNk/leCkh1rewf5XWAQtJTD0+2Ssn/YsxFi62H2l
+RLdDC/t21zG2rNAlYhGc1P4gPFdrqRVkGMYy4Wl6QFBG9U6431NcUKfA+o3uYveh
+8ANbIItQF1FWKGClKeg4FpbPfHRzLtBV+zR8hXX0pxi7Eqwn6IME9jyAoAI2QOqU
+5QVCToPWFFKmn29djnLIq6oG8AS0o1dtiJbyqNgB5yarJFX+P6ym1jvTEmWAzk8v
+N5++ztI1NWdWhtzhEJkJrzRu3Q0yYIPJaJ+mY9vp
+-----END CERTIFICATE-----
diff --git a/test/rubygems/child_key.pem b/test/rubygems/child_key.pem
new file mode 100644
index 0000000000..c56d0699c8
--- /dev/null
+++ b/test/rubygems/child_key.pem
@@ -0,0 +1,27 @@
+-----BEGIN RSA PRIVATE KEY-----
+MIIEogIBAAKCAQEAyn+/tatHETIQv0TOloaaJ/+SMbkr3twgscXTdC3Em1IrBTJX
+9vGY/kueOUihXOoBxXJ2C2WbMhpuBVhHeA4TaYP5IKAz7jxsEKdgxDryp553gf0o
+Y/FfuqC6412mRQLvEPdenOfwS8/j5RyCLDv0POuVzivuc9bGYtMb2pfEE+7uFLK3
+MvOoHr35Qm6QQFpDT2vw2Q6gPZ5NLwdlw0h74Wr3K2C3w62AJxc98Ime9C2EK5nX
+jqpD6WosP/0Kc6qfr7bhdm6+lImFqTfnYXRbCMQMCBOZFmdZJOjgSeJB76/kofDq
+m3+lhQYVv5UGvcJXQNMYTcIRq9RQxHwvtIPwbwIDAQABAoIBAEJkNgerG0bRAlqj
+hZQml35LtbPlwTN1OqbudFCf/NjrzL0Mb3jAZ2fghQTFAlrDQkdpKri73HFF5xKL
+igsbmlO6+EAxJjWSy9998SUFKq+4LfiJduelqLw4nG2VM8Fmn9kRMY0CIm/IvjBM
+84TrNz2OA/SvxKNoJG0cSAKYRao+00s+xNIu8lr6CqvXqnFO6gzbxQvJ0J0TnKVf
+AezArZZI3VaPXmC8yo2U6v9r7/2txr12QnDPDk9YMwJ7OR+7qzujAPvtHy44t4en
+AsTetle9AXveIBC7zpl0pp27wN8tKIdh8n+jxPfES9ecn4FjfreWiwzzZSSCitqQ
+p7cQdTkCgYEA9U/y38KUjV05FO7AeeMJYmy/o3WxjcZF8lUtuCsGzogD0JbnNj7R
+BF9TwlNnkeSJsPYKMG17dnoZhgY3J96mWhQbEH9CyXNdgQladE9/qH9gCCW9BXyo
+z3urNc77F/44J+1OoegpWGS8Hdm7OGsESLF1wLet+5cRbVHtU2brqQMCgYEA01JK
+AnATj+vACcAtr1Gu9eGE/6EqAM+H/bfQzGtqkxEmY8QihW//XWH/vOZDVZZYLUoc
+9MkSUHNGwZ7ESAgoZWc1D5xxp3sT2+vV192TS+QBe3TT5AXhAGH9uL+qz7Gz4ihH
+ebt4p49u5SJVY+3vv+nck/YgEiBw4PrfwSdugSUCgYB86U/XpoH0FaMKSKRTrErM
+BmnytuxJL8vQIJVeMPKPWezvWtey5HuUCWJiEgwr2r5OEIqRrD3wzy2N9D5Dm/kC
+5zf8x4BfidHz8apQjWaIiwuAOo8saxSeSe+dP57V0coQcqLWiJv8+ZZccNEHYl7V
+ER/PmPgLoxnpm40IKeEXtwKBgCwUEAfuJMZyYD4obd8R5LK49ar0jPRaVX1gqBbb
+mQFQJHfO43x93gA2fseCKC1kDMR1nxCYGE/bm7irSznTKcns+y5kbXiHvZ6z1IkQ
+WLcNuhlsRv5bE5Gm3ut4X0KvSFw2FqKXrhUVYAY/YRxU9xtKxo2+WvYs+h6TdbSu
+auhZAoGAThhKJW0Rf+LX1zlVaq+GXrj2rkYVSBwChMHbmmp49q6crldfLi15KbI/
+LRoUwjnQLQVNT0j090/rlNVv+pcQLqZ/pDHXQOMwrYuhbbLsda/FqTo3Qb/XnwHX
+qRrjdgGk5OC3gJt8EaHHdq+ty/eF4xQ0fUPMvIj8fwowxGyextI=
+-----END RSA PRIVATE KEY-----
diff --git a/test/rubygems/client.pem b/test/rubygems/client.pem
new file mode 100644
index 0000000000..63a52c574a
--- /dev/null
+++ b/test/rubygems/client.pem
@@ -0,0 +1,49 @@
+-----BEGIN CERTIFICATE-----
+MIIDgTCCAmmgAwIBAgICEAIwDQYJKoZIhvcNAQEFBQAwRTELMAkGA1UEBhMCQVUx
+EzARBgNVBAgTClNvbWUtU3RhdGUxITAfBgNVBAoTGEludGVybmV0IFdpZGdpdHMg
+UHR5IEx0ZDAeFw0xMzA1MDExNTAxMzFaFw0yMzAzMTAxNTAxMzFaMEUxCzAJBgNV
+BAYTAkFVMRMwEQYDVQQIEwpTb21lLVN0YXRlMSEwHwYDVQQKExhJbnRlcm5ldCBX
+aWRnaXRzIFB0eSBMdGQwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCw
++lcrpdWcloQCgAlxcM3GjvBxZ3yjzi6SgXKRBSi54i0J1LXxznWKcJ5P/O1+j+7i
+LjHK+OWqsa0+EbKTwSu+0tx20h0z++YJF9GWEoCwT5aH1kor/0+EQLgYnxBaF8GC
+2xAbkRkWmbSu2aLDIey3lg7lqAazYqdS2wH0UjSDjFKDLxz9LwpfFm0yGL3DgwLW
++dobYkgt1A6F/8Pz6D2FjwYKcM8JE6w7KJSJDUvXcv2E18wmhZ/qF/MtFAF4coB1
+f5ALnz8YqY6eyDF5aY/VfaHZvXdirLlMH6/miie9GBVMnJWF0ah5ssbsMvcpmnDJ
+qkiYju2e1oLFEE7zztU/AgMBAAGjezB5MAkGA1UdEwQCMAAwLAYJYIZIAYb4QgEN
+BB8WHU9wZW5TU0wgR2VuZXJhdGVkIENlcnRpZmljYXRlMB0GA1UdDgQWBBTcOELj
+hSUdiLrdRF3CFZDZkWaGzDAfBgNVHSMEGDAWgBS7B027H/ZIkW3ngm1SrR0X/aTC
+wDANBgkqhkiG9w0BAQUFAAOCAQEAlQMzHlnT6L1qqA4hL6tABPbiMsVwXyKCcfNB
+zBn82Wkxgbg7Mp31fbR6/qvGeXOtaX6IdPdgtVf8nh1NURk0MmFBP+gfnwfNBD+m
+Q1cldDt9kY2LGIrPii40xbugF1/xqEYcZMgXU08aEvQ2IHX46J8wZoqMa2KhrU8/
+mzY0F+UEFOGWtKDgUzz3dyBPsdzVrX+SXULwH0lqZX8Nsw5LyfrlVt3xQvS5Ogm4
+kYlt8kqhF8lUS3WTbuADrIs3NaDPRWSs1iLRRFgosgUtHN7tkrkrVaHeBo0KbAJG
+mMqtxSY0XZI9WBxffP9UtoY3EiTWNVWLtuCN3OSvryP6NDe4BA==
+-----END CERTIFICATE-----
+
+-----BEGIN RSA PRIVATE KEY-----
+MIIEowIBAAKCAQEAsPpXK6XVnJaEAoAJcXDNxo7wcWd8o84ukoFykQUoueItCdS1
+8c51inCeT/ztfo/u4i4xyvjlqrGtPhGyk8ErvtLcdtIdM/vmCRfRlhKAsE+Wh9ZK
+K/9PhEC4GJ8QWhfBgtsQG5EZFpm0rtmiwyHst5YO5agGs2KnUtsB9FI0g4xSgy8c
+/S8KXxZtMhi9w4MC1vnaG2JILdQOhf/D8+g9hY8GCnDPCROsOyiUiQ1L13L9hNfM
+JoWf6hfzLRQBeHKAdX+QC58/GKmOnsgxeWmP1X2h2b13Yqy5TB+v5oonvRgVTJyV
+hdGoebLG7DL3KZpwyapImI7tntaCxRBO887VPwIDAQABAoIBAFOpdG3gzlNg3/Ti
+nBQxdEVqKwYhGs3A2UlOwl8F5lPBNPNRx9UQeYZBaMV9VrQezJnFpqpB8Sg5KCGQ
+ci/hAJIL0kalW0LI0Nz5ko10H7u5U/rQ9W1JG0j041JYV32Pf14husKdXBPQA5co
+sQW30tSSrmYogUpp15mWiJz8A3EvqiCTlQv5JwwMFGnjVl8+HNfuLghK/vqY/Eb9
+YmwTKxPFejqN7E0Mud2ylNiuPTSLwBy8UvV9uxOlDc6lMyZjVRO0woiEzrjw5dKF
+yf5tUkICRcPkekcx+XtpGrCMlRLl770bZBZX+YNmbYXVWhFp09cNR+U0KZqPNcDp
+jg73vXECgYEA3huOKzfHGt3qUdMlEHd1FvQhW9fYIrmUSnuVYQJOnY8lFfKfmrOH
+gpwOIHDNiVHYlhAJaNocCLYx4hWHgZXarY7NKxmlY2+Vp8mcCIf2Cw3Kr/sFklUJ
+KpiRxqEPGR7U4C/E31kkH/C+w7m9Zh3ndhltU2Pki9/Eq0lk8YClMMkCgYEAy/vU
+jxzviIk8bll5uCIuXJyCfao7ywaZABbL6a20kdVGKrHj57O/OJ2WZVwBihhB7OS+
+QsKC/J8LrUJkobOFtQvQ8O23uep5rB6kqCkXsXCG4SCl2L5xZySBp/qhiqbuMwvp
+EAWPSIA6UNoR0J2rDYVmq6jtY526wQf5ivE8IccCgYEAphfzJAyNH2FOZixArmS2
+shiUjasG3UjsRRrP5YClK5wtPpF2m2if8KMkyUux2HvVPLr3XmqkxjsBaLFy6QwY
+QOvmL9H45Tg/sP7KaXLLIw8IQLu2OezPcwQvF1u//6gXxyLR1bhClIQjFBjlMuUv
+/xgasl6kPZlz6Cd1jkgGwEkCgYAI1IT2EQWZfn9cM4leXDRvk+LeN8FQ35897r6z
+Be78JSRdcsfv3ssXU1MQXjQ+2x/3dkt6LltnPidOP8KFcXUHSlSoKVI7vRe5SLZO
+BUFeUAW2tygWwt+73Eu0jtfxXZqQISLcq7DxLYPYvifpRPoDotO3+J8WIdzUwFig
+GCNHPwKBgHqXOyRef7ykVUCptMf61/BvNU8NP1f9PkKQBMYQZC39UwqEQ675QBUh
+hSG9t/kyc44zUVmBeKIlWHVyLQ83Dv+ennz/D9t7tstet0VMKvALNdiVT0sjFKN7
+1VINygCeFkqrlTXlOwFcRSo1gHn3/JIrhSgRuYKHSf0GZOcN6d9l
+-----END RSA PRIVATE KEY-----
diff --git a/test/rubygems/data/null-type.gemspec.rz b/test/rubygems/data/null-type.gemspec.rz
index b1d0a6d7cd..bad99289d1 100644
--- a/test/rubygems/data/null-type.gemspec.rz
+++ b/test/rubygems/data/null-type.gemspec.rz
Binary files differ
diff --git a/test/rubygems/encrypted_private_key.pem b/test/rubygems/encrypted_private_key.pem
new file mode 100644
index 0000000000..2a9affd18b
--- /dev/null
+++ b/test/rubygems/encrypted_private_key.pem
@@ -0,0 +1,30 @@
+-----BEGIN RSA PRIVATE KEY-----
+Proc-Type: 4,ENCRYPTED
+DEK-Info: DES-CBC,27887B3B3BAA3B18
+
+GUZSuxjWdx6b35JMzppCBpAfK3l9IV9D3Oculgz8yT8+qFY5iXiij+fdBQ1fgUdl
+nT3f1wC5Cj1adIQq3UYo4+MK1p3HGKYB/H600YVHNvOgnLaMybSW0uyeKwoweZrC
+mRqN41O8slS6tFY3/BdKXV8qnT7SDl28rYFejVm3Ocb9PtrREA7H48089hME2+yF
+xm8VvGWsHTfdMO9gei4aAU6OVNxvOttc6fMOV3JZYmuKRiVX8Y6y4m+YLA8rTGG7
+kiUi/Ik1YjNa4aVef8kS/xX9sfO3+Q14vE/eOU6qt0u+6zYQcyJvC9grkWolokK0
+ak/yRIDW+irVAK1niEtwnPFSs3koKemwuh2VDMX5GddLJCQmV5Ne4beI6obWVXJY
+6qaKQTMK/BulsoBnxc8Ql9izulfqpRUpWBNUBllhWg/wxnzRxzraPIlLchV6j8aa
+klRVJy1kxgnlk5+RYsDNiNyWBTB0y81Op3svA5oB05dX0AcWEoFoQruLl448IQiC
+WlQV/uDZrqqDu6JAA4D9VNpZuHB6IsGEqaRi4veWwkICbgblOLFpYS4TIxbpNqMT
+8AX7IpDEPL3Rv1NMaByfbBA2VI2HeEPELU0ietwU0KOHcxHJv8QV9ZtppeTiL3pb
+cqYdfcw89eI9h4gy5p4zrrUJM60ONC2DppRmCPZzaFqVajX2DpoEuNZGW+ZUMp3g
+l300ChvAIRjriU/ju6qmVCrJqJNG5zThAvlK/SapBSKly7vSV7q7HlVzM7Dkanqh
++aYl5MwbaSKCcQ7F2uGNgsdollQpAS3iRC1FRe06IkIaL+BzdqFc++qt36ALPiBa
+zhgjT6dTP0iRIoc1dANsJ13rmlLrEEetmIWTeEpKiVCRBHRVu8BPLtIGmiDT+0c9
+d5lwrtdha3SOq5tafqufTQ7Yxi2XteuVSFwDSmzP9l+fBXMYRWPW1otHwg42nPhn
+9SvXl3MJtYKpbzvO5IeqZ0OdTNz+gZwroCBy0ZaIPSYi88LRUzWKDp7gbqBA/ouL
+UEX5T5J4vnXJfPdTmISorPmQblqdFG+A2qCmyou6RumdKHYg/uCeMFNkLDzexTC4
+LooO0clIKKlNFktdkIq3mEaZbSf4UdVSfxRfvbLWXR1orE6ObHpJamuDFWYwWrMY
+qH4asefD8j3lmB1lwpsAbyWeOtIMGnxO6ayo2jzpQQuTVduMCR/HREuoT/6klKiT
+T58OWLa7/GHdoPv0HFNktPNXsgpmdC37IoRZhgbiTSJV6y1gEgdM3reJFXPNXTN6
+q/QCAl5UZWBEmTA2CHvrmekN58X5dv1JEl/RIKtevP/7SZp/TtJMjkKqc1Nvx8EZ
+4pvkMdlbY8cwATORSUdGPCGtPy5x+aDuQWgHOz3G/gGNmGQy98CD3AucI9tcbTiz
+VPdsnumUvkhD5suZCTEBa8JI5d/nCY7/hA6n58fC2eojIFchgtUuJoOFb6GYHItA
+V1couQWj89PubyDPbS0vjxkiCxEk3CK1eDPsjHs/8NEcn582DXkKThZZvfwUu4sR
+EzPlmAeU38pCpJ7jWZtpaAttMTRXMzIY9O0bzU+K3DrtG85OQ6c48g==
+-----END RSA PRIVATE KEY-----
diff --git a/test/rubygems/expired_cert.pem b/test/rubygems/expired_cert.pem
new file mode 100644
index 0000000000..3578be835a
--- /dev/null
+++ b/test/rubygems/expired_cert.pem
@@ -0,0 +1,18 @@
+-----BEGIN CERTIFICATE-----
+MIIC7DCCAdSgAwIBAgIBBDANBgkqhkiG9w0BAQUFADAqMQ8wDQYDVQQDDAZub2Jv
+ZHkxFzAVBgoJkiaJk/IsZAEZFgdleGFtcGxlMB4XDTcwMDEwMTAwMDAwMFoXDTcw
+MDEwMTAwMDAwMFowKjEPMA0GA1UEAwwGbm9ib2R5MRcwFQYKCZImiZPyLGQBGRYH
+ZXhhbXBsZTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKdlNYcvFB6x
+gpT8QcnMybVelGLUKyQL/hQPTK9J5FyqB8hEDLt2ruMwKsHU6fu/mgG+sLvHF1nq
+WhZADhn6rwCfNP03025vktOZ6iJfU60vytY/f3gkiGNkP21l0hz0+Ms15f+52gk+
+sFXqwGBbDteI0x57UsHi+KAN67QuPDnthYDtwhXIA5pcdx2wH+NW8F82HEZvm1hc
+pA75BDVk4vPxnpDfvPOKSYn9dWghmUtaPmqyVvs8XkDxHDfY54/D3ziPehP+zQzE
+g8C07Sq/z6vLSOQ3uaYn0nBDuNE6XP3ijJ4Zvs2eJEdOMyS1H3CsnkWiePCrLtKd
+w8d/F+D5bocCAwEAAaMdMBswGQYDVR0RBBIwEIEObm9ib2R5QGV4YW1wbGUwDQYJ
+KoZIhvcNAQEFBQADggEBABksVqMxMq/VKjS5Z1tr6G5GlcgvpNjUb+OOEfBc66vK
+Bv3aPrmNR6IE/+o2r0tTIJh4npeE9ASL+Ht0/sphdpOuzfOToPnmptIxHEWg4ub4
+n2qDasmQGDi96xLBZe4DV/5I4WkIQiuyXubVkriRLygng4VRohgFWVfLok9OXhYB
+1NAEIXj9NVKIwFmrOgQEPNYdCVL0U82GhbhbB79gSzvRA2hJOuXhTGLgiAp+lstn
+ppWlcNsg/t1JhJ2unBk9XhhrqUEBQxQcvA2jt1KnlpY/x+ubfB86J6D6l4ve9plE
+uXBltZ2qNFM70SWsPzohQxHfyzmIRKQLM3PXjbma/Lg=
+-----END CERTIFICATE-----
diff --git a/test/rubygems/future_cert.pem b/test/rubygems/future_cert.pem
new file mode 100644
index 0000000000..4f3d8607e2
--- /dev/null
+++ b/test/rubygems/future_cert.pem
@@ -0,0 +1,18 @@
+-----BEGIN CERTIFICATE-----
+MIIC8DCCAdigAwIBAgIBBjANBgkqhkiG9w0BAQUFADAqMQ8wDQYDVQQDDAZub2Jv
+ZHkxFzAVBgoJkiaJk/IsZAEZFgdleGFtcGxlMCIYDzk5OTkxMjMxMjM1OTU5WhgP
+OTk5OTEyMzEyMzU5NTlaMCoxDzANBgNVBAMMBm5vYm9keTEXMBUGCgmSJomT8ixk
+ARkWB2V4YW1wbGUwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCnZTWH
+LxQesYKU/EHJzMm1XpRi1CskC/4UD0yvSeRcqgfIRAy7dq7jMCrB1On7v5oBvrC7
+xxdZ6loWQA4Z+q8AnzT9N9Nub5LTmeoiX1OtL8rWP394JIhjZD9tZdIc9PjLNeX/
+udoJPrBV6sBgWw7XiNMee1LB4vigDeu0Ljw57YWA7cIVyAOaXHcdsB/jVvBfNhxG
+b5tYXKQO+QQ1ZOLz8Z6Q37zzikmJ/XVoIZlLWj5qslb7PF5A8Rw32OePw984j3oT
+/s0MxIPAtO0qv8+ry0jkN7mmJ9JwQ7jROlz94oyeGb7NniRHTjMktR9wrJ5Fonjw
+qy7SncPHfxfg+W6HAgMBAAGjHTAbMBkGA1UdEQQSMBCBDm5vYm9keUBleGFtcGxl
+MA0GCSqGSIb3DQEBBQUAA4IBAQAErYGXM7S3B8i9n4U+RJoxSel/BmQ6lS09uqqr
+2wWTwzkAmupsBuXJmNt1/Z2CZ/ogf/YPYeD5KBuUNtxNGchD+ngws6TnKWZ3kyOi
+MVX7Ec7gTMFSuXSNOz/9MCMjIF4elglB6X2M5IVRqoTP/FHwlGxLx1+aIGnls5uJ
+HELoCi7uaWPHjzF9pfDmqV3FXG2jQuqIngGwIJR1/JzxcNfWW4g2fGOJ1eTNJmRK
+nDXHd2hotbar4+QIoFwMh1nSGx3v3FdqzM6bWvt2r3VK4a9E5FIyNpQ0gC4JInjL
+TlIXGWEwzE3I0sWH6EbnE74VTi96oFXntWqqMcmMJYFLHcun
+-----END CERTIFICATE-----
diff --git a/test/rubygems/future_cert_32.pem b/test/rubygems/future_cert_32.pem
new file mode 100644
index 0000000000..b7325f14b2
--- /dev/null
+++ b/test/rubygems/future_cert_32.pem
@@ -0,0 +1,18 @@
+-----BEGIN CERTIFICATE-----
+MIIC7DCCAdSgAwIBAgIBBzANBgkqhkiG9w0BAQUFADAqMQ8wDQYDVQQDDAZub2Jv
+ZHkxFzAVBgoJkiaJk/IsZAEZFgdleGFtcGxlMB4XDTM4MDExOTAzMTQwN1oXDTM4
+MDExOTAzMTQwN1owKjEPMA0GA1UEAwwGbm9ib2R5MRcwFQYKCZImiZPyLGQBGRYH
+ZXhhbXBsZTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKdlNYcvFB6x
+gpT8QcnMybVelGLUKyQL/hQPTK9J5FyqB8hEDLt2ruMwKsHU6fu/mgG+sLvHF1nq
+WhZADhn6rwCfNP03025vktOZ6iJfU60vytY/f3gkiGNkP21l0hz0+Ms15f+52gk+
+sFXqwGBbDteI0x57UsHi+KAN67QuPDnthYDtwhXIA5pcdx2wH+NW8F82HEZvm1hc
+pA75BDVk4vPxnpDfvPOKSYn9dWghmUtaPmqyVvs8XkDxHDfY54/D3ziPehP+zQzE
+g8C07Sq/z6vLSOQ3uaYn0nBDuNE6XP3ijJ4Zvs2eJEdOMyS1H3CsnkWiePCrLtKd
+w8d/F+D5bocCAwEAAaMdMBswGQYDVR0RBBIwEIEObm9ib2R5QGV4YW1wbGUwDQYJ
+KoZIhvcNAQEFBQADggEBAGrtVuj/iourBMAH2bQI6sQsuCJcL5HN6IXCoAcQyQEI
+LR/roZyHI3fg+FfTzUII7wxPSneo4soSKXYxQYuE1JYPxTcQE5lFv9jbzl6eplsN
+LcAMnrjB4xJoRkSg4mbPxwEICngnWRQuY+lOsquSkRXAAl+5bW/OBfxr8XWcGjmG
+ZRGmOwKzUiv7p7zyJkkEFb7m6ugg0GKop23jtv6Rou5+2lXLBqm8T0de30pM0arM
+vAnd2a8UbPnmR0DzrCtksU62UIqhVoFFicntdaEiBF/Pk9YhLCfTXwInWL8+p48r
+PBzrKMTb56YQZXVAG9aypn42pnPCMPC4ojCxfC0N3n0=
+-----END CERTIFICATE-----
diff --git a/test/rubygems/good_rake.rb b/test/rubygems/good_rake.rb
new file mode 100644
index 0000000000..ca916d098d
--- /dev/null
+++ b/test/rubygems/good_rake.rb
@@ -0,0 +1 @@
+exit 0
diff --git a/test/rubygems/grandchild_cert.pem b/test/rubygems/grandchild_cert.pem
new file mode 100644
index 0000000000..5e5fe0113e
--- /dev/null
+++ b/test/rubygems/grandchild_cert.pem
@@ -0,0 +1,18 @@
+-----BEGIN CERTIFICATE-----
+MIIC9TCCAd2gAwIBAgIBCDANBgkqhkiG9w0BAQUFADApMQ4wDAYDVQQDDAVjaGls
+ZDEXMBUGCgmSJomT8ixkARkWB2V4YW1wbGUwIBcNMTIxMjA4MDAwMDAwWhgPOTk5
+OTEyMzEyMzU5NTlaMC4xEzARBgNVBAMMCmdyYW5kY2hpbGQxFzAVBgoJkiaJk/Is
+ZAEZFgdleGFtcGxlMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAkfgy
+EbzcRpXvpNA0s75R8gOVk7ENEPX5uXUElbzHbVEmHkC/NFsWZXV0vxGFfZrrnEkT
+Y2kDaMMkfZX9rriRIvsZpxyqrdX87QfQTZ1ktDoytVnd+gw9A6AXB6PR7uoPymso
+f/lZYJ8BWP9fIU39nogiptFqsgkpOtKSFjJfMILkcMAeBPs2B5HV5l4oLrpJ7Ns/
+0vazCXGakTByAXNKBagJWR43gh+RUQWF6Uh04VQTQ7ENGWI83088SKAPtCCcgKxr
+ROHI025S7o7vEfDEqEn+gtu+4ndaLuRp+2AmF3YK8dEDiLXrrvEvG1r4+gIB/6tS
+MUfkkJtBleZrDoIAgQIDAQABoyEwHzAdBgNVHREEFjAUgRJncmFuZGNoaWxkQGV4
+YW1wbGUwDQYJKoZIhvcNAQEFBQADggEBAFNdoYo7A9eThXpNy1buoVpeVR19VpEG
+nvzen8ipQ7uGQ/62aBvJlqgj2/xFKWidtMNH8769SY94ePembHWABFvVBZpMU5ZO
+LYuC5rUSpJcxfw6T5eLytYHOAr56kWjQB6AVF4mQ5IavQ0MoHsm1RZ7L9amNQY1J
+zFIJpN4/T4wJ/+M58zCUFKg0aC3uUcYRgc44xhxmzceUoI3H8Bx1gqfuVM9KleLA
+Bi/BdD6GTQ16stbQP/fso5kjwAUr2x0NttwkzO0Sd7y3G7RXCmJux3zQrdu+3HoF
+edxj9I39tX+v8AbCFl2vO162ZGwLGewdk1FImb28c96t3B17jL1U/H4=
+-----END CERTIFICATE-----
diff --git a/test/rubygems/grandchild_cert_32.pem b/test/rubygems/grandchild_cert_32.pem
new file mode 100644
index 0000000000..e4486a74ad
--- /dev/null
+++ b/test/rubygems/grandchild_cert_32.pem
@@ -0,0 +1,18 @@
+-----BEGIN CERTIFICATE-----
+MIIC8zCCAdugAwIBAgIBCTANBgkqhkiG9w0BAQUFADApMQ4wDAYDVQQDDAVjaGls
+ZDEXMBUGCgmSJomT8ixkARkWB2V4YW1wbGUwHhcNMTIxMjA4MDAwMDAwWhcNMzgw
+MTE5MDMxNDA3WjAuMRMwEQYDVQQDDApncmFuZGNoaWxkMRcwFQYKCZImiZPyLGQB
+GRYHZXhhbXBsZTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAJH4MhG8
+3EaV76TQNLO+UfIDlZOxDRD1+bl1BJW8x21RJh5AvzRbFmV1dL8RhX2a65xJE2Np
+A2jDJH2V/a64kSL7Gaccqq3V/O0H0E2dZLQ6MrVZ3foMPQOgFwej0e7qD8prKH/5
+WWCfAVj/XyFN/Z6IIqbRarIJKTrSkhYyXzCC5HDAHgT7NgeR1eZeKC66SezbP9L2
+swlxmpEwcgFzSgWoCVkeN4IfkVEFhelIdOFUE0OxDRliPN9PPEigD7QgnICsa0Th
+yNNuUu6O7xHwxKhJ/oLbvuJ3Wi7kaftgJhd2CvHRA4i1667xLxta+PoCAf+rUjFH
+5JCbQZXmaw6CAIECAwEAAaMhMB8wHQYDVR0RBBYwFIESZ3JhbmRjaGlsZEBleGFt
+cGxlMA0GCSqGSIb3DQEBBQUAA4IBAQAu14Hgglh3K914FUFC+O2HRQdgK+JaeZJ+
+vjaPxzpXcwlIMqTTphjWMk0b55iOQohXHYewYg9ToErYGfqGURH4MVSCJr+LecZX
+xuty8JC6KvTaVGfZNPIkCF92LupleV7YVg9Ew4KvCZGrodXr+XlWHpJWx7KJT+1Z
+yUC36boJUj+VDtnqq9weUgtfkh/RFoZdlRK76WiaGzKuNFBJz3n0yBhzDcMo+av3
+GeSEx8C1eu/01U8ZO5PK49HuMdNJFpB3W18gGOzT9eqDfTIEdEsrTG5cxlEgQUBW
+jHFnqSBK5LgPAqRP6GRdBW4ZtZ4yS/7+n8otsvFGwXPHOSSvtoNu
+-----END CERTIFICATE-----
diff --git a/test/rubygems/grandchild_key.pem b/test/rubygems/grandchild_key.pem
new file mode 100644
index 0000000000..a9b9aef624
--- /dev/null
+++ b/test/rubygems/grandchild_key.pem
@@ -0,0 +1,27 @@
+-----BEGIN RSA PRIVATE KEY-----
+MIIEpgIBAAKCAQEAkfgyEbzcRpXvpNA0s75R8gOVk7ENEPX5uXUElbzHbVEmHkC/
+NFsWZXV0vxGFfZrrnEkTY2kDaMMkfZX9rriRIvsZpxyqrdX87QfQTZ1ktDoytVnd
++gw9A6AXB6PR7uoPymsof/lZYJ8BWP9fIU39nogiptFqsgkpOtKSFjJfMILkcMAe
+BPs2B5HV5l4oLrpJ7Ns/0vazCXGakTByAXNKBagJWR43gh+RUQWF6Uh04VQTQ7EN
+GWI83088SKAPtCCcgKxrROHI025S7o7vEfDEqEn+gtu+4ndaLuRp+2AmF3YK8dED
+iLXrrvEvG1r4+gIB/6tSMUfkkJtBleZrDoIAgQIDAQABAoIBAQCFbg4+vpfQghBM
+ZPI399oqUvJwziA2h9Kdn4TwZ18Y41vnvaHKdxUS63orihWvSmTjOL1bWsv+AJuj
+nO8GvroU8tlxM7glLX2FImZb/GrogGaH9bz+bB995+IFXs9xCE4k5y1fRgxYUSDH
+PLC13ffe6WxbdwSD9/HTTlaxqZvv1+UWxyYD0CSwopww5YdqISkVHq2UsmszK49X
+hn6zzK+DT4YA04Tbv2Go9kCYLmsgrL2/dPJulDtJhX3AckbdkodSlBAmxe7XsKEO
+TEzNDGgPZyZ+MXttBnLt1vk8ZrSJWcFG+E6DMbGUZ7rz6g98bUS1LI6PiqIp5BfS
+sr0cGQl9AoGBAMGj7SCp1GMo8wOJpzzSGJ4PCc/fpG9NcTBqtmoUTuvMk4frkGXJ
+dSS68KB0t0EGStbUFIZuylchC7RSzXs0uOZxkgaGcJT5qXXFP0Djy3/qoQMnJ2Yl
+uhD6UsetPXbozK6MPs3mh9VqSDNbf2AM034nTod3I9sV471HZLwAhQk7AoGBAMD6
+Mmvy8DEa62VDTW6P1f4b6Pi6dOiZhGbNz5Xlh5jHplSMYReQGBVmr9szrV7qytGP
+ZcBhEqTc53u2mEhSmRXQflRxJ7U2m8Xl3DClhxELHNGCJ9jEY52M4ZDJkvGj5v3t
+pbTbE/g3zxmAaYZCOKIzYv5bSSStNpauxdomxuFzAoGBAJFohH97qEZSELJ+YrwU
+VHIUfty/Zt5BvBaMe7CK0XzWIY72gHc+4Z2UV29WVeoZTIenuEX+2ii1YvGlIDI9
+s/8wF2SY/d+Q3wTV+prCtCS5TvFsLHTTLbbkEtdoqvgo9tK3881wKF5FMjSGp867
+svFPmPO2rpEtDdgrzWQzy7LTAoGBAK077Sea3qQ2VjqBQHGQDbofs/QU7f4gUgs3
+lrIpaqBsGZSssDxGzlfn5tYQfgJHI+sbn2wjuGjnJaaZM/s4qtQ6Zi3Hpq22aAAv
+aIsDDUzvfN9WyA5/vi0g2xzu10q0qBgrziWcxUB+WRu7ev9bUxvIpYVQzUhvdiGu
+o05CoSahAoGBAKoCGMGKkub+LnWazPkN2BAS6LblV+JIYWRI+DSGpz0UBk4Br546
+ozZq2GsLCQYWJabJ5RE9Are6rl9AvFQXMaWywOBe3TUz7SmLIxMjWpXKiX5YIFkS
+tOiEEmET4ZYS87flEmldnmeDFLHHbMLOw5S0dJa4PyFRn6j9su8d8mWw
+-----END RSA PRIVATE KEY-----
diff --git a/test/rubygems/insure_session.rb b/test/rubygems/insure_session.rb
deleted file mode 100644
index 8a6df89246..0000000000
--- a/test/rubygems/insure_session.rb
+++ /dev/null
@@ -1,43 +0,0 @@
-require 'rubygems'
-
-def install_session
- path_to_gem = File.join("redist", "session.gem")
- begin
- Gem::Installer.new(path_to_gem).install
- rescue Errno::EACCES => ex
- puts
- puts "*****************************************************************"
- puts "Unable to install Gem 'Session'."
- puts "Reason: #{ex.message}"
- puts "Try running:"
- puts
- puts " gem -Li #{path_to_gem}"
- puts
- puts "with the appropriate admin privileges."
- puts "*****************************************************************"
- puts
- exit
- end
- gem 'session'
-end
-
-begin
- require 'session'
-rescue LoadError => e
- puts
- puts "Required Gem 'Session' missing."
- puts "We can attempt to install from the RubyGems Distribution,"
- puts "but installation may require admin privileges on your system."
- puts
- print "Install now from RubyGems distribution? [Yn]"
- answer = gets
- if(answer =~ /^y/i || answer =~ /^[^a-zA-Z0-9]$/) then
- install_session
- puts
- puts "Retry running the functional tests."
- exit(0)
- else
- puts "Test cancelled...quitting"
- exit(1)
- end
-end
diff --git a/test/rubygems/invalid_client.pem b/test/rubygems/invalid_client.pem
new file mode 100644
index 0000000000..e0d39519d9
--- /dev/null
+++ b/test/rubygems/invalid_client.pem
@@ -0,0 +1,49 @@
+-----BEGIN CERTIFICATE-----
+MIIDgTCCAmmgAwIBAgICEAIwDQYJKoZIhvcNAQEFBQAwRTELMAkGA1UEBhMCQVUx
+EzARBgNVBAgTClNvbWUtU3RhdGUxITAfBgNVBAoTGEludGVybmV0IFdpZGdpdHMg
+UHR5IEx0ZDAeFw0xMzA1MDExNTAxMzFaFw0yMzAzMTAxNTAxMzFaMEUxCzAJBgNV
+BAYTAkFVMRMwEQYDVQQIEwpTb21lLVN0YXRlMSEwHwYDVQQKExhJbnRlcm5ldCBX
+aWRnaXRzIFB0eXXXdGQwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCw
++lcrpdWcloQCgAlxcM3GjvBxZ3yjzi6SgXKRBSi54i0J1LXxznWKcJ5P/O1+j+7i
+LjHK+OWqsa0+EbKTwSu+0tx20h0z++YJF9GWEoCwT5aH1kor/0+EQLgYnxBaF8GC
+2xAbkRkWmbSu2aLDIey3lg7lqAazYqdS2wH0UjSDjFKDLxz9LwpfFm0yGL3DgwLW
++dobYkgt1A6F/8Pz6D2FjwYKcM8JE6w7KJSJDUvXcv2E18wmhZ/qF/MtFAF4coB1
+f5ALnz8YqY6eyDF5aY/VfaHZvXdirLlMH6/miie9GBVMnJWF0ah5ssbsMvcpmnDJ
+qkiYju2e1oLFEE7zztU/AgMBAAGjezB5MAkGA1UdEwQCMAAwLAYJYIZIAYb4QgEN
+BB8WHU9wZW5TU0wgR2VuZXJhdGVkIENlcnRpZmljYXRlMB0GA1UdDgQWBBTcOELj
+hSUdiLrdRF3CFZDZkWaGzDAfBgNVHSMEGDAWgBS7B027H/ZIkW3ngm1SrR0X/aTC
+wDANBgkqhkiG9w0BAQUFAAOCAQEAlQMzHlnT6L1qqA4hL6tABPbiMsVwXyKCcfNB
+zBn82Wkxgbg7Mp31fbR6/qvGeXOtaX6IdPdgtVf8nh1NURk0MmFBP+gfnwfNBD+m
+Q1cldDt9kY2LGIrPii40xbugF1/xqEYcZMgXU08aEvQ2IHX46J8wZoqMa2KhrU8/
+mzY0F+UEFOGWtKDgUzz3dyBPsdzVrX+SXULwH0lqZX8Nsw5LyfrlVt3xQvS5Ogm4
+kYlt8kqhF8lUS3WTbuADrIs3NaDPRWSs1iLRRFgosgUtHN7tkrkrVaHeBo0KbAJG
+mMqtxSY0XZI9WBxffP9UtoY3EiTWNVWLtuCN3OSvryP6NDe4BA==
+-----END CERTIFICATE-----
+
+-----BEGIN RSA PRIVATE KEY-----
+MIIEowIBAAKCAQEAsPpXK6XVnJaEAoAJcXDNxo7wcWd8o84ukoFykQUoueItCdS1
+8c51inCeT/ztfo/u4i4xyvjlqrGtPhGyk8ErvtLcdtIdM/vmCRfRlhKAsE+Wh9ZK
+K/9PhEC4GJ8QWhfBgtsQG5EZFpm0rtmiwyHst5YO5agGs2KnUtsB9FI0g4xSgy8c
+/S8KXxZtMhi9w4MC1vnaG2JILdQOhf/D8+g9hY8GCnDPCROsOyiUiQ1L13L9hNfM
+JoWf6hfzLRQBeHKAdX+QC58/GKmOnsgxeWmP1X2h2b13Yqy5TB+v5oonvRgVTJyV
+hdGoebLG7DL3KZpwyapImI7tntaCxRBO887VPwIDAQABAoIBAFOpdG3gzlNg3/Ti
+nBQxdEVqKwYhGs3A2UlOwl8F5lPBNPNRx9UQeYZBaMV9VrQezJnFpqpB8Sg5KCGQ
+ci/hAJIL0kalW0LI0Nz5ko10H7u5U/rQ9W1JG0j041JYV32Pf14husKdXBPQA5co
+sQW30tSSrmYogUpp15mWiJz8A3EvqiCTlQv5JwwMFGnjVl8+HNfuLghK/vqY/Eb9
+YmwTKxPFejqN7E0Mud2ylNiuPTSLwBy8UvV9uxOlDc6lMyZjVRO0woiEzrjw5dKF
+yf5tUkICRcPkekcx+XtpGrCMlRLl770bZBZX+YNmbYXVWhFp09cNR+U0KZqPNcDp
+jg73vXECgYEA3huOKzfHGt3qUdMlEHd1FvQhW9fYIrmUSnuVYQJOnY8lFfKfmrOH
+gpwOIHDNiVHYlhAJaNocCLYx4hWHgZXarY7NKxmlY2+Vp8mcCIf2Cw3Kr/sFklUJ
+KpiRxqEPGR7U4C/E31kkH/C+w7m9Zh3ndhltU2Pki9/Eq0lk8YClMMkCgYEAy/vU
+jxzviIk8bll5uCIuXJyCfao7ywaZABbL6a20kdVGKrHj57O/OJ2WZVwBihhB7OS+
+QsKC/J8LrUJkobOFtQvQ8O23uep5rB6kqCkXsXCG4SCl2L5xZySBp/qhiqbuMwvp
+EAWPSIA6UNoR0J2rDYVmq6jtY526wQf5ivE8IccCgYEAphfzJAyNH2FOZixArmS2
+shiUjasG3UjsRRrP5YClK5wtPpF2m2if8KMkyUux2HvVPLr3XmqkxjsBaLFy6QwY
+QOvmL9H45Tg/sP7KaXLLIw8IQLu2OezPcwQvF1u//6gXxyLR1bhClIQjFBjlMuUv
+/xgasl6kPZlz6Cd1jkgGwEkCgYAI1IT2EQWZfn9cM4leXDRvk+LeN8FQ35897r6z
+Be78JSRdcsfv3ssXU1MQXjQ+2x/3dkt6LltnPidOP8KFcXUHSlSoKVI7vRe5SLZO
+BUFeUAW2tygWwt+73Eu0jtfxXZqQISLcq7DxLYPYvifpRPoDotO3+J8WIdzUwFig
+GCNHPwKBgHqXOyRef7ykVUCptMf61/BvNU8NP1f9PkKQBMYQZC39UwqEQ675QBUh
+hSG9t/kyc44zUVmBeKIlWHVyLQ83Dv+ennz/D9t7tstet0VMKvALNdiVT0sjFKN7
+1VINygCeFkqrlTXlOwFcRSo1gHn3/JIrhSgRuYKHSf0GZOcN6d9l
+-----END RSA PRIVATE KEY-----
diff --git a/test/rubygems/invalid_issuer_cert.pem b/test/rubygems/invalid_issuer_cert.pem
new file mode 100644
index 0000000000..31812aa2a3
--- /dev/null
+++ b/test/rubygems/invalid_issuer_cert.pem
@@ -0,0 +1,18 @@
+-----BEGIN CERTIFICATE-----
+MIIC8DCCAdigAwIBAgIBCjANBgkqhkiG9w0BAQUFADAqMQ8wDQYDVQQDDAZub2Jv
+ZHkxFzAVBgoJkiaJk/IsZAEZFgdleGFtcGxlMCAXDTEyMTIwODAwMDAwMFoYDzk5
+OTkxMjMxMjM1OTU5WjArMRAwDgYDVQQDDAdpbnZhbGlkMRcwFQYKCZImiZPyLGQB
+GRYHZXhhbXBsZTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAM0ycOSh
+SOKDGhDlPZ3+JAWwp7KB2ps/VlLhIsZl0uAHzCAGPNI1I46gmla1g7Gh429fYeJ0
+VgeRTxI/rRWNJ0HX2I9jhaJqAkiOqV5Rk6RkJv/0lU1VSu1IBjKRmV6qXiNeBWA8
+duEPNdd6zKX7UoKcYgmG3BMDuEy67AqWUgZOjc9WUnd6i+mwWciMuNqul69vMvB5
+go4c/rgtp1Y3PhLDIrheYP9s+Bza1MNp0FUFlrPnL5gzZTsP/IX2u7kF3CEhKCZX
+ZPX0oZc/pbqIS2OuQ9T6ft6StSwA+9IhAyCeJ9bGyBYK78SyiSfELKyGKbk74SmR
+AqjpN2PJX3o/gk8CAwEAAaMeMBwwGgYDVR0RBBMwEYEPaW52YWxpZEBleGFtcGxl
+MA0GCSqGSIb3DQEBBQUAA4IBAQAfnWXhF0gpfdJPgYtgA8gUdezW9pImBWlWaZmX
+DJhdGBe4pAtsGYHCC1B2lcyRYhQQEibfFrtHeJk1O/vmVw7cuIltVxkpof/0hWA2
+zqpO7UWjYuVxxaZuWGF6MhFWLHLHq1Q8ppXEcMPyP/mGcf3bjYmyFk0f1IslTMVn
+2CJPXO2k8v07dH1ljgcM9X0wmPILQzDzLAJzwPD1iB602ODuie9xXH6ySaVU0n9p
++EJfW1GZysdbcUJ36osY0AO8kjjFbgJG/kM34WFGDixm+jDfMvZTsxlRZc2XNBgS
+2PWvb4CJ1kDwIoMzdSt9MavbvSHkxJllplpUpQqv0Or1Dh9y
+-----END CERTIFICATE-----
diff --git a/test/rubygems/invalid_issuer_cert_32.pem b/test/rubygems/invalid_issuer_cert_32.pem
new file mode 100644
index 0000000000..3a06ceb4fa
--- /dev/null
+++ b/test/rubygems/invalid_issuer_cert_32.pem
@@ -0,0 +1,18 @@
+-----BEGIN CERTIFICATE-----
+MIIC7jCCAdagAwIBAgIBCzANBgkqhkiG9w0BAQUFADAqMQ8wDQYDVQQDDAZub2Jv
+ZHkxFzAVBgoJkiaJk/IsZAEZFgdleGFtcGxlMB4XDTEyMTIwODAwMDAwMFoXDTM4
+MDExOTAzMTQwN1owKzEQMA4GA1UEAwwHaW52YWxpZDEXMBUGCgmSJomT8ixkARkW
+B2V4YW1wbGUwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDNMnDkoUji
+gxoQ5T2d/iQFsKeygdqbP1ZS4SLGZdLgB8wgBjzSNSOOoJpWtYOxoeNvX2HidFYH
+kU8SP60VjSdB19iPY4WiagJIjqleUZOkZCb/9JVNVUrtSAYykZleql4jXgVgPHbh
+DzXXesyl+1KCnGIJhtwTA7hMuuwKllIGTo3PVlJ3eovpsFnIjLjarpevbzLweYKO
+HP64LadWNz4SwyK4XmD/bPgc2tTDadBVBZaz5y+YM2U7D/yF9ru5BdwhISgmV2T1
+9KGXP6W6iEtjrkPU+n7ekrUsAPvSIQMgnifWxsgWCu/EsoknxCyshim5O+EpkQKo
+6TdjyV96P4JPAgMBAAGjHjAcMBoGA1UdEQQTMBGBD2ludmFsaWRAZXhhbXBsZTAN
+BgkqhkiG9w0BAQUFAAOCAQEAPNSZx48cauKsTdhSwdzYSnIYjzPT6ZxoJXCpX8hu
+uOwyZ85i5nSX8rQvjv3IAtQpKQ+1G6odOXkt+zMz1z4dtpo3uEydpWOFKESna1vy
+d3qF+iWUxY8varWOi0lE6ZfFVDsrruVz9m9dcTm2MlGspBeUZrHH2BixEr1/pUAI
+DdBtptZ5qNIxZ4GQJGqrw9j410hjKwm0xV8eWP/D6N640bTzZu06iZbO49exmMSc
+eH3jJMmynviDK3H+GqXIrnSbjbo5hRbEGv0FlYBQijYQw0ttp416Go7kS6cCPSy3
+nUPSMSPr+o5WqU1BKxIdJJSHVZIUk7LfKDOo7LUOJhygwA==
+-----END CERTIFICATE-----
diff --git a/test/rubygems/invalid_key.pem b/test/rubygems/invalid_key.pem
new file mode 100644
index 0000000000..74bedabcda
--- /dev/null
+++ b/test/rubygems/invalid_key.pem
@@ -0,0 +1,27 @@
+-----BEGIN RSA PRIVATE KEY-----
+MIIEpAIBAAKCAQEAzTJw5KFI4oMaEOU9nf4kBbCnsoHamz9WUuEixmXS4AfMIAY8
+0jUjjqCaVrWDsaHjb19h4nRWB5FPEj+tFY0nQdfYj2OFomoCSI6pXlGTpGQm//SV
+TVVK7UgGMpGZXqpeI14FYDx24Q8113rMpftSgpxiCYbcEwO4TLrsCpZSBk6Nz1ZS
+d3qL6bBZyIy42q6Xr28y8HmCjhz+uC2nVjc+EsMiuF5g/2z4HNrUw2nQVQWWs+cv
+mDNlOw/8hfa7uQXcISEoJldk9fShlz+luohLY65D1Pp+3pK1LAD70iEDIJ4n1sbI
+FgrvxLKJJ8QsrIYpuTvhKZECqOk3Y8lfej+CTwIDAQABAoIBAFo5I4pjoDh4jK2B
+HmapqA0Yb6P9lLFOWBZ5B2FUxDPdOdOa6oNC+i9sTnBxv0YLeIUv20pG/My3B51u
+ghxHxEsfLQlfKRMQqZBdqfrew5w0rTE9yagHKLrMQG1bt6P4JQxH+vUloN+0YGgu
+hm005EKpoDGwKnPx3sdeKQs+rTI37fGLw40ZPSod2B7UkSna4/u/uXa1yFbONlqq
+P4ozsDd1xoCaBJfwie2h93KneSPwyHHumlVgbFAJcQycuD5qproYbea9PppppQ+4
+17M9ccuQpS2j9rZWgk7+KqwLrYqzajmtHoQH4zkBYd0JQ4ywGKg307xDhppMZpq3
+uMqnXgECgYEA9iYB7vX91Q3HsRtUAd0aZ91lDIv9RXBP+PuK3OUrtChdtZx7Mih3
+uTgtfVEnP7bxgnPpwecnF4Ncginuu7TBtxjoztFjuFNzk/8Fz/J3i/H3oB0SdjhL
+uqVa6P4hPak7FnWynZHivuuIe+eKYLvK0TCMbYaz6G81xi0Whtbm498CgYEA1Wja
+PgscP/9YykCC6eRP+ixo6chGzSNJR+WRW9CJYpXEicPlaT5AI3nSZVXXSLvXIbq9
+NoExPu47pDzr9Gd02qYmFWUOolUa21W4s/x4d7lU+wJzS6ZNTFoC8woZagL2kZ5G
++we5ifbUz7eG+ahZODGMGA9BJVT3PI6zPdKtr5ECgYEAy0ORnypGBXUOrUMa+TsD
+fjfGJTlI2dmoQLw/7K/Wijw3PizNUxs12p74eZ7VYXkKMKbVpwjiMDmK3/YOrbTT
+rwaD4Z3p0iIftFwJCbJ5Y/hZez/mqfdNGgFIdFS/UHL6V060RAhfjTdlCqSmkcEh
+9+M2Y4+z60JCzrcW/hxiqFMCgYEAj9ntwoSatkjZAPwbQq2ze18UGQH3N6/hZaVJ
+JiqbcOijYnm52gcsFL25JLWIOG7lxMarZGIRX+oWKc8m/cf+7KOyaBmGk8XqJI7T
+wf8c9RboQYqVTRj8YcsK0eis2NjGe8HE9tFuL6FCMgHz6bWg7k/3rwAZWaC8RwWp
+rLKmgQECgYBXGjEvogVeYMgnpzjoaa99wvfp6FtbRx1jZ+FOSBoH5uCRDalD5Q16
+0UVnoPcnj0Hi7Hvvl6jTLesRW/LDra5Hqyxs4yuSBagEUFv/PvY0eYGZ5egGZgaa
+PlVmxgk33xYXar8wGHLkstwqZY/OqT89cKvJqeLKMb0G2Re13oPVww==
+-----END RSA PRIVATE KEY-----
diff --git a/test/rubygems/invalid_signer_cert.pem b/test/rubygems/invalid_signer_cert.pem
new file mode 100644
index 0000000000..6d6c648d32
--- /dev/null
+++ b/test/rubygems/invalid_signer_cert.pem
@@ -0,0 +1,18 @@
+-----BEGIN CERTIFICATE-----
+MIIC8TCCAdmgAwIBAgIBDDANBgkqhkiG9w0BAQUFADArMRAwDgYDVQQDDAdpbnZh
+bGlkMRcwFQYKCZImiZPyLGQBGRYHZXhhbXBsZTAgFw0xMjEyMDgwMDAwMDBaGA85
+OTk5MTIzMTIzNTk1OVowKzEQMA4GA1UEAwwHaW52YWxpZDEXMBUGCgmSJomT8ixk
+ARkWB2V4YW1wbGUwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDNMnDk
+oUjigxoQ5T2d/iQFsKeygdqbP1ZS4SLGZdLgB8wgBjzSNSOOoJpWtYOxoeNvX2Hi
+dFYHkU8SP60VjSdB19iPY4WiagJIjqleUZOkZCb/9JVNVUrtSAYykZleql4jXgVg
+PHbhDzXXesyl+1KCnGIJhtwTA7hMuuwKllIGTo3PVlJ3eovpsFnIjLjarpevbzLw
+eYKOHP64LadWNz4SwyK4XmD/bPgc2tTDadBVBZaz5y+YM2U7D/yF9ru5BdwhISgm
+V2T19KGXP6W6iEtjrkPU+n7ekrUsAPvSIQMgnifWxsgWCu/EsoknxCyshim5O+Ep
+kQKo6TdjyV96P4JPAgMBAAGjHjAcMBoGA1UdEQQTMBGBD2ludmFsaWRAZXhhbXBs
+ZTANBgkqhkiG9w0BAQUFAAOCAQEAd0sGT1z4eppqGMxGdx5ZjXRbgKJZNwz2jHGJ
+CbceA4slPLQOwLXKscXm7QkhMg7L0SJWX2WgLbY/Re5jrexgXnM/fxiIW/wLo5Bv
+V+ajcbZt0uC5scX9DSpwUftlQiMIARbwWb5Lg4UDzT3nB44BgrUIx/YC2084BSsb
+Lrr3YNW4ZGyxN6qVIILCemg3YpsmFspQtsCdRUsn/5Hjc0J05qA6XDSNXRZYYGA2
+tstMcYuwmhp6WjIEWU0i6t84ZKzOrNm2qwjhT6nYYJvvKQtexa1W/WTM5IHKcxiA
+oWnrRCZWt33UtHF4//zjXSJm0S8gb8FDRicxS5CbDiVe20GDkA==
+-----END CERTIFICATE-----
diff --git a/test/rubygems/invalid_signer_cert_32.pem b/test/rubygems/invalid_signer_cert_32.pem
new file mode 100644
index 0000000000..0f4ddcf50e
--- /dev/null
+++ b/test/rubygems/invalid_signer_cert_32.pem
@@ -0,0 +1,18 @@
+-----BEGIN CERTIFICATE-----
+MIIC7zCCAdegAwIBAgIBDTANBgkqhkiG9w0BAQUFADArMRAwDgYDVQQDDAdpbnZh
+bGlkMRcwFQYKCZImiZPyLGQBGRYHZXhhbXBsZTAeFw0xMjEyMDgwMDAwMDBaFw0z
+ODAxMTkwMzE0MDdaMCsxEDAOBgNVBAMMB2ludmFsaWQxFzAVBgoJkiaJk/IsZAEZ
+FgdleGFtcGxlMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAzTJw5KFI
+4oMaEOU9nf4kBbCnsoHamz9WUuEixmXS4AfMIAY80jUjjqCaVrWDsaHjb19h4nRW
+B5FPEj+tFY0nQdfYj2OFomoCSI6pXlGTpGQm//SVTVVK7UgGMpGZXqpeI14FYDx2
+4Q8113rMpftSgpxiCYbcEwO4TLrsCpZSBk6Nz1ZSd3qL6bBZyIy42q6Xr28y8HmC
+jhz+uC2nVjc+EsMiuF5g/2z4HNrUw2nQVQWWs+cvmDNlOw/8hfa7uQXcISEoJldk
+9fShlz+luohLY65D1Pp+3pK1LAD70iEDIJ4n1sbIFgrvxLKJJ8QsrIYpuTvhKZEC
+qOk3Y8lfej+CTwIDAQABox4wHDAaBgNVHREEEzARgQ9pbnZhbGlkQGV4YW1wbGUw
+DQYJKoZIhvcNAQEFBQADggEBAE8RJTY1E6DBOEt5azE9wQGJ7yrWJNHLhtP0nmkd
+eaIraloJcqss86qgbH4NY81mvm7nhB6/UEcbm218b6roTDOEjvBp1sKtZ7sqt+J0
+gFqAocBStTkPucmbsDr0B6bUmeHxgpCt+QoaOh6Fwh5yizfpl9i7oMU4QLhf1eZ3
+K1PrPvUle2JFfzJ3SFDlU9C/oA9yDQGnJ7efUCFKvg9M9CzgAHFJyQNb/47tmqHF
+2uxSwEy+ADbD0fPw0r5zkejEimBHWcaTHxqQ12GhS5PkUBYm/qW9a6wyBBO2nO6u
+Tr1zrCDc728aPjN4Qh76xUy/hyCcSgXalhz1LMHgv0VDx/M=
+-----END CERTIFICATE-----
diff --git a/test/rubygems/invalidchild_cert.pem b/test/rubygems/invalidchild_cert.pem
new file mode 100644
index 0000000000..5a79c83396
--- /dev/null
+++ b/test/rubygems/invalidchild_cert.pem
@@ -0,0 +1,18 @@
+-----BEGIN CERTIFICATE-----
+MIIC+TCCAeGgAwIBAgIBDjANBgkqhkiG9w0BAQUFADApMQ4wDAYDVQQDDAVjaGls
+ZDEXMBUGCgmSJomT8ixkARkWB2V4YW1wbGUwIBcNMTIxMjA4MDAwMDAwWhgPOTk5
+OTEyMzEyMzU5NTlaMDAxFTATBgNVBAMMDGludmFsaWRjaGlsZDEXMBUGCgmSJomT
+8ixkARkWB2V4YW1wbGUwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDl
+rDAlDZwmP6Zxc4sSaOdSRRXJBmbQubxmWpqU8bXrTKCkvg1l/2U6weJIS52zW6Te
+Zok7Uus5jywyeNSJ/MBHb7X5ytAPQsvLu/3WFwaVfHJzimQI4vtmx9+CDgZzipYp
+ett7IF18He8DPiFur1xCn8pp0qOOV8mXL/8TpUgJfmaOJosqgFqorj5niqF52IwJ
+vtur/gwpq2xpCtYaCUB/dFzzefLV37kt58S6jTmZnYf4kIdFKhhyTeGmDRf/wOz+
+kK/H/aKtpsYgzI//bo+bsuWNFceIdWrdCBr63cVs4ql7VN7p2xfn9ckEfwH6wFut
+QLquA/6fRkgUFF8fxUiHAgMBAAGjIzAhMB8GA1UdEQQYMBaBFGludmFsaWRjaGls
+ZEBleGFtcGxlMA0GCSqGSIb3DQEBBQUAA4IBAQBvNQFrG8ye8vyHmnfX5n3++OEu
+k6a+Jr8BlLL3jqI8LPmANGgd4May7HXua4bVZjAx+EtChXd1jcCP8pJ1AZaSHZIF
+icdhxfKjD6JfvgVQOKQluOfDJ0Tg1GyONZK29m7fOrsHbB+OIaJhsce3MEXdGVpF
+cppM3lEaI2PGaASWf3gqVOytTdRFqMStaDWY5rfy+LxgBeGkw9GjUkdMxdFZBs00
+dunhXTI8pk/QyqGhoDH3/iHansIB6CCH9C5gysEuFErp/mpvobCVn1aLcs7EY6vC
+1BZL1LMVJ8fL1gGwpgDe6R+X5oba/wzwt3wXrC2e4r9zy2qtWgfS/REYA49B
+-----END CERTIFICATE-----
diff --git a/test/rubygems/invalidchild_cert_32.pem b/test/rubygems/invalidchild_cert_32.pem
new file mode 100644
index 0000000000..126b60a325
--- /dev/null
+++ b/test/rubygems/invalidchild_cert_32.pem
@@ -0,0 +1,18 @@
+-----BEGIN CERTIFICATE-----
+MIIC9zCCAd+gAwIBAgIBDzANBgkqhkiG9w0BAQUFADApMQ4wDAYDVQQDDAVjaGls
+ZDEXMBUGCgmSJomT8ixkARkWB2V4YW1wbGUwHhcNMTIxMjA4MDAwMDAwWhcNMzgw
+MTE5MDMxNDA3WjAwMRUwEwYDVQQDDAxpbnZhbGlkY2hpbGQxFzAVBgoJkiaJk/Is
+ZAEZFgdleGFtcGxlMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA5aww
+JQ2cJj+mcXOLEmjnUkUVyQZm0Lm8ZlqalPG160ygpL4NZf9lOsHiSEuds1uk3maJ
+O1LrOY8sMnjUifzAR2+1+crQD0LLy7v91hcGlXxyc4pkCOL7Zsffgg4Gc4qWKXrb
+eyBdfB3vAz4hbq9cQp/KadKjjlfJly//E6VICX5mjiaLKoBaqK4+Z4qhediMCb7b
+q/4MKatsaQrWGglAf3Rc83ny1d+5LefEuo05mZ2H+JCHRSoYck3hpg0X/8Ds/pCv
+x/2irabGIMyP/26Pm7LljRXHiHVq3Qga+t3FbOKpe1Te6dsX5/XJBH8B+sBbrUC6
+rgP+n0ZIFBRfH8VIhwIDAQABoyMwITAfBgNVHREEGDAWgRRpbnZhbGlkY2hpbGRA
+ZXhhbXBsZTANBgkqhkiG9w0BAQUFAAOCAQEAn81wRiztOz+u74TbUqBfkpG4QMZW
+4mjGbM9eF6swyQ3fpdJO9hM9VK8V46IIoxqp5sqd9j2ZB7DAB1Fr84LD1NopWPZD
+Ui07O/qfwX360alIBwRsRKdZJdH0YykXZErPbMkQOk8SM4SVD0yUoGea6HwHBwKs
+UXK9LDhTm73o7k0md34dwa0s/rG0cUhfVuDWB2cZ6o5Y6B4ZXcTMG60QAoH763NP
+eyBzrlfIz/03O6K7HKGgQc35WaMeNXovrZcOWHgtpSjev5Ugu7LnLiTYOwn82c3r
+7bjGiFG4g6k7aSzHigUasqG0v7NLz1ZQ1mgMTIqwXWRap0RCuIJl11UF4g==
+-----END CERTIFICATE-----
diff --git a/test/rubygems/invalidchild_key.pem b/test/rubygems/invalidchild_key.pem
new file mode 100644
index 0000000000..9706c9566e
--- /dev/null
+++ b/test/rubygems/invalidchild_key.pem
@@ -0,0 +1,27 @@
+-----BEGIN RSA PRIVATE KEY-----
+MIIEpgIBAAKCAQEA5awwJQ2cJj+mcXOLEmjnUkUVyQZm0Lm8ZlqalPG160ygpL4N
+Zf9lOsHiSEuds1uk3maJO1LrOY8sMnjUifzAR2+1+crQD0LLy7v91hcGlXxyc4pk
+COL7Zsffgg4Gc4qWKXrbeyBdfB3vAz4hbq9cQp/KadKjjlfJly//E6VICX5mjiaL
+KoBaqK4+Z4qhediMCb7bq/4MKatsaQrWGglAf3Rc83ny1d+5LefEuo05mZ2H+JCH
+RSoYck3hpg0X/8Ds/pCvx/2irabGIMyP/26Pm7LljRXHiHVq3Qga+t3FbOKpe1Te
+6dsX5/XJBH8B+sBbrUC6rgP+n0ZIFBRfH8VIhwIDAQABAoIBAQC59hllZwev0Ims
+AqnwVhA2hMmG4zAMgNcS6PmQ78Ukp/7KZTfkBk6orKPTdaZSuzla+hrTdegPyuU2
+WK9+qq/lJ4ZootakBKmOZMC6wBoMn57r/nnQ2DhGmD9YxpJiqyu6mkdsAmCvRm1o
+ar4XKNXC/C6gUHUto9cOG0alWYZiZ/VMe/nhPTChr2Dhd+bavO1yx7/CxB+VQMfQ
+l6ihbv//3KgPJAElbaI7jfOGzX6KlwXSGf70REmZQnPGN4/n46/dLFFuA1HzcA5Z
+37NU1zgN2nIrXld8rsR1mSy6EwU46sW3AkEwv6SUajCjz7PCmmWxRaQErGJjZrUq
+sujNj5RBAoGBAPgdiY+6B7WvmLlCBCwI4PXjgRQ/6A1Ycgvi1LdSQzccSHddogNI
+tWKa0pIrYyH7y7jB/UzstFSnsOXAf4H6Xt70VUrFPq1/dRRw1CtSLA1sFspBAD8v
+aGl9R0XqWOk1t60mfgES9b4LJu46cTm7UMfyC7EbWkqHYWqf15umRgwrAoGBAOz4
+nZGqBVBW/ERDs+Imf9NcwDeuwllQ0S9ZBPHF///SQ4Rscz2Bl8GhjhTHldLNJg9k
+HjP8W2BOPas66K3WM+WC3AiGrdJfs6Ju3r27X4wA0hnNc6bcoRaoSNRaqThSkgCH
+l34l7yrB1gwpa5HlIfYXjHfJ7coX7WRMQK7wmVsVAoGBAJ/Y97z/DuSAgpYn7+Qm
+vDfuIETZfzjJ2H/L3VtVxjQFJrKwQiZ3e1RRhoPhK/bC79bSM8yRWwSHHLKIOB2X
+HfPp2eFX/i9sxBMtNaPLRtJG5s/a3LvYYR5FNdvXRPzKPNFy0Q8EFgofyS8Fu9iD
+02FdkSbDBoKpgZtd61w93TcNAoGBAKtM4SKeRC8aYku6oTtW10pkHvNhmk5UVJMk
+h6V6mx9D0NjWSMvqdVhcv8eXq19yOxQfLJIp16gbhwrTj8WyNVuwp/xl1xtfYQyH
+lu6Sl3QuV7KdSQATN0OYrOUNEIyNa8uEOOfQ5j4DVwb9niwd9dnelgU17HYNq+a4
+FH4hoMotAoGBAJk/9+RPAdxqJsr/oVp9E4wU9ffpZ2Lr0faN7/WqBFPPhhFOMWu2
+zj8fcRaP/9Wv9g2xK/GfCKhrX8FMfq/NMkZsNx6V3W0M8Zbarp9ZvA4Sj0OvsZAO
+J1NQjkvFjMCE0A29jtjY1zRmLzoC+Ds7Ola8IOKvAN8SM1X/CC6bOgGz
+-----END RSA PRIVATE KEY-----
diff --git a/test/rubygems/plugin/exception/rubygems_plugin.rb b/test/rubygems/plugin/exception/rubygems_plugin.rb
index affa72f09c..16c417e84d 100644
--- a/test/rubygems/plugin/exception/rubygems_plugin.rb
+++ b/test/rubygems/plugin/exception/rubygems_plugin.rb
@@ -1,2 +1,2 @@
TestGem::TEST_PLUGIN_EXCEPTION = :loaded
-raise Exception.new('boom') \ No newline at end of file
+raise Exception.new('boom')
diff --git a/test/rubygems/plugin/standarderror/rubygems_plugin.rb b/test/rubygems/plugin/standarderror/rubygems_plugin.rb
index d36849f144..4b577a6518 100644
--- a/test/rubygems/plugin/standarderror/rubygems_plugin.rb
+++ b/test/rubygems/plugin/standarderror/rubygems_plugin.rb
@@ -1,2 +1,2 @@
TestGem::TEST_PLUGIN_STANDARDERROR = :loaded
-raise StandardError.new('boom') \ No newline at end of file
+raise StandardError.new('boom')
diff --git a/test/rubygems/private_key.pem b/test/rubygems/private_key.pem
index 95b3dc76d8..c6ed3fc24e 100644
--- a/test/rubygems/private_key.pem
+++ b/test/rubygems/private_key.pem
@@ -1,27 +1,27 @@
-----BEGIN RSA PRIVATE KEY-----
-MIIEpAIBAAKCAQEAm24C6xixiAxO+i1f3L8XRMwrmLkt6BvT60mZ7g8HsklH3af7
-KNHA6vo/G6sujs2UsNO4HY8BTEneiVOXXWQlcsJ+Z5wEPlIu4zFueAmLefx+n9lE
-ulNIUDoyUenKX4spoMRnX8k4lXL05ho/6JFq0JdDY2DmAaQ4vvTz5mh9kZiybtHQ
-fzcpbA51uY+sjdQRCPDHyUUfh0SmWJlLYMwcBdVeCiGUPBLi+iP5x1btO4uiJK6Q
-IMaV1H3SUCYtKGQKl7qwFd8k8ZBcHYOtmK61tupg3vqWQc0em6SxPj5lws8+1MVK
-twBNIDx24jF4ntxBRNKMZ7FN5SHbobAgDYkPAQIDAQABAoIBAGQilgK8X/PUajVH
-clEXU3hhSV0VQHwfIYKeYms6h6zXBVPKW0dLC0zXeDztJgueasMZQ67XaPCrTpGO
-px/l2zJ6F1HM8/bqn4aDXDY9f/xRLYryQRMBgL8fHzgitNylHWaT4j2Vt7yg2SI9
-mxrMRNKqASJPVR+Nm3l6+n9gpjVb99wEucWplPPHI6KhXLYPZOqSwt+zaH5roz3k
-UQmMs0Bs4hF1SzVl0n+KNoXHOwswVrmBWXgWvm2OhnwY2e26jfejc8toJc/ShAJ7
-C9exnrdimcgEKbd22Sum4G00CDYhcrG5LHHqkgwifcAEVctrvBZBZHGgpxlO8a8U
-eF2Vr7kCgYEAykdrBlzp7Fn9xzUInBQ3NXTTYAq51lpuJdmHQmPuTSY0buoHkd9f
-xbUCZ2qR9QAesrx4hI0qGLetc8IOKDoWx2rPepCCvO3Kx61o1SB5fAvBue03qVoq
-HqACX3Uk24Em8zAz9xuP13ETH/wU7sUbUxRHMCre6ZDmlxn4g5l+Nl8CgYEAxLVl
-22yBx0dfRr3UsHY9rxll2gIlnfnYfiJzq8wetzt/TfztRV5ILz7FyWqL5d7IoqkA
-fT2V4HAasRJASnKohwJe7z5M/H2ExwkGNFvY+jefb2CoUl5WouK9AlhbqBk3zmHi
-sY5GqQkAp/kHMntEin+sErJw6mkgAGdser3a9p8CgYEAqi31w++tunRnxw4+RRnY
-7Pdx0k6T1NxV6TAe1ONAHNY0rM/mOHqml65W7GzDiU1lhlh8SIB/VzZJDqfHw15D
-xdh94A7uf0bMILwrA4wDyTIW9Xa3Kpq57vQNqwPiU25QN69pOM+Ob+IpBfLOJafc
-+kOINOUMj5Kh/aQS6Zzci58CgYEAk24dlFKEBjbRCvU2FrfYTYcsljPru7ZJc2gg
-588J6m0WYf5CWy5pzbcviGFpzvSlzXv7GOLylQ+QgcxbETFUbDPzsT4xd0AgJwj1
-dIKuYgMUZOa94VZBer2TydEtiRS1heJJhKhM/1329u4nXceTvHYqIq1JAfeee48I
-eAoZtaMCgYBz1FjWFQnMTD5nmyPEEZneoBPAR5+9jwOps+IYOoHtazoMFszzd0qo
-JZW3Ihn9KRrVSxfFApKS/ZwjiZ+tJUk7DE/v/0l0sszefY7s8b0pL1lpeZSoL71e
-QoG1WLXUiDV3BRlmyOAF1h3p12KRTLgwubN51ajECwcs3QwE+ZT8Gg==
+MIIEowIBAAKCAQEAp2U1hy8UHrGClPxByczJtV6UYtQrJAv+FA9Mr0nkXKoHyEQM
+u3au4zAqwdTp+7+aAb6wu8cXWepaFkAOGfqvAJ80/TfTbm+S05nqIl9TrS/K1j9/
+eCSIY2Q/bWXSHPT4yzXl/7naCT6wVerAYFsO14jTHntSweL4oA3rtC48Oe2FgO3C
+FcgDmlx3HbAf41bwXzYcRm+bWFykDvkENWTi8/GekN+884pJif11aCGZS1o+arJW
++zxeQPEcN9jnj8PfOI96E/7NDMSDwLTtKr/Pq8tI5De5pifScEO40Tpc/eKMnhm+
+zZ4kR04zJLUfcKyeRaJ48Ksu0p3Dx38X4PluhwIDAQABAoIBAAx09qfJtBiYoxwN
+LaQjzjrl/+re2RsEnXLGtLEysYDH0m5vyfbFXTxg4D2uZ38pgf9xPluq9CznyK5x
+M9txEUbdkibp2Z0VRnrisE7Ag0yXCuQos4awSUoEMsgkVJ99B2qv5x7BqN0ZQiwS
+nSBOhms5rmRNTxpIlrHqd0jgS/EPggnqVzNcM4/K8PJFthwEBKDmzOyiRByvz54Y
+shzOnTjGtV2oGNgwpzmCXce1yO7dh2IdKnSnmeFwyU88GxEYnGh5MIFuTiyErP72
+k6iEUfiXy0hxk/iXmKs8UyD1lVnwTNWcZcpV8yw4a06Z6nkSnwQm0SSOVIo/w35V
+jdVdUkECgYEA3GhZ70MD/Q47GFvz6BovwQvxhjFN+nIEbBfi7OTkuXprKdhVhjaR
+nERPZpZjHWrcfgbFcvPY7/GJLTPN/VF1nhOsOZpzfAmCgBujRXrzlAGpU877ZNJA
+QKPgzo+iv/RsQCIdrzF1gwHkqD2v1HRLaqb2+dVumiG4Qp3NXgasT2cCgYEAwm1U
+uRDXgQKGODeLK8eSVpfMjD5umBVu7m4D3ZmipbN6sMBxGMAlsU40eQ7DBFH0AFft
+s2D88JdjlwoOrbXYYpOc6iWD/QkygJfPpA9VQx92hv8KBd82gLHuXYMd0T0G3yZO
+gPPioeRgl2TvgVCfjn6AYr3Ubt3rB5aBlSplE+ECgYEAiXhcf6rg1fkGSs8vddi/
+aDy2y+f8pvRuZa0QUIkDT9xW8qaH0Uo/z6ObknTCJRr9o209wdDtwdp4oMTq+dDQ
+92N1zAfVd8vGpXiXgUKKognXPvqeOegZQzfzg2J7NBaTXfzpXtgOX0PTBkxTWsOe
+NkslR/YjIedeMc6SxM6MsokCgYA3mTYyGevWe5dQOin1IgPp+UzICg5sNSzcx98Z
+HpcRVWrPYqi00DW3J0sAF0WTVbA17O8PbbvHPTOAfKLH8Alp3xZvKr08vcWQWllJ
+bA0Qvc2SOxptpXAbi0ZDvXvoWtA9PeITJCr56qnogTewPhLyl6A1HF3EOne8WsDB
+nDb9YQKBgEyUDWhDBGXUfQN0fWy5ksqCCeHXQzvt6aEUstWvkkbnnarUfLAhBIqC
+2B6omokICmWzvAfDt3UsRbb3QJUBxbbVsZVM7Vr+kY2cQ1Ma093I/2mXDoq3bV+j
+LZM5+Uc7xSfiCi1hbVhGm96DXofudddo86W5mhXp3xhcQP1Fl4JZ
-----END RSA PRIVATE KEY-----
diff --git a/test/rubygems/public_cert.pem b/test/rubygems/public_cert.pem
index 9b7c3d8e98..5642a6f4ef 100644
--- a/test/rubygems/public_cert.pem
+++ b/test/rubygems/public_cert.pem
@@ -1,20 +1,18 @@
-----BEGIN CERTIFICATE-----
-MIIDNjCCAh6gAwIBAgIBADANBgkqhkiG9w0BAQUFADBBMRAwDgYDVQQDDAdkcmJy
-YWluMRgwFgYKCZImiZPyLGQBGRYIc2VnbWVudDcxEzARBgoJkiaJk/IsZAEZFgNu
-ZXQwHhcNMDcxMjIxMDIwNDE0WhcNMDgxMjIwMDIwNDE0WjBBMRAwDgYDVQQDDAdk
-cmJyYWluMRgwFgYKCZImiZPyLGQBGRYIc2VnbWVudDcxEzARBgoJkiaJk/IsZAEZ
-FgNuZXQwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCbbgLrGLGIDE76
-LV/cvxdEzCuYuS3oG9PrSZnuDweySUfdp/so0cDq+j8bqy6OzZSw07gdjwFMSd6J
-U5ddZCVywn5nnAQ+Ui7jMW54CYt5/H6f2US6U0hQOjJR6cpfiymgxGdfyTiVcvTm
-Gj/okWrQl0NjYOYBpDi+9PPmaH2RmLJu0dB/NylsDnW5j6yN1BEI8MfJRR+HRKZY
-mUtgzBwF1V4KIZQ8EuL6I/nHVu07i6IkrpAgxpXUfdJQJi0oZAqXurAV3yTxkFwd
-g62YrrW26mDe+pZBzR6bpLE+PmXCzz7UxUq3AE0gPHbiMXie3EFE0oxnsU3lIduh
-sCANiQ8BAgMBAAGjOTA3MAkGA1UdEwQCMAAwCwYDVR0PBAQDAgSwMB0GA1UdDgQW
-BBS5k4Z75VSpdM0AclG2UvzFA/VW5DANBgkqhkiG9w0BAQUFAAOCAQEAHagT4lfX
-kP/hDaiwGct7XPuVGbrOsKRVD59FF5kETBxEc9UQ1clKWngf8JoVuEoKD774dW19
-bU0GOVWO+J6FMmT/Cp7nuFJ79egMf/gy4gfUfQMuvfcr6DvZUPIs9P/TlK59iMYF
-DIOQ3DxdF3rMzztNUCizN4taVscEsjCcgW6WkUJnGdqlu3OHWpQxZBJkBTjPCoc6
-UW6on70SFPmAy/5Cq0OJNGEWBfgD9q7rrs/X8GGwUWqXb85RXnUVi/P8Up75E0ag
-14jEc90kN+C7oI/AGCBN0j6JnEtYIEJZibjjDJTSMWlUKKkj30kq7hlUC2CepJ4v
-x52qPcexcYZR7w==
+MIIC7jCCAdagAwIBAgIBEDANBgkqhkiG9w0BAQUFADAqMQ8wDQYDVQQDDAZub2Jv
+ZHkxFzAVBgoJkiaJk/IsZAEZFgdleGFtcGxlMCAXDTEyMTIwODAwMDAwMFoYDzk5
+OTkxMjMxMjM1OTU5WjAqMQ8wDQYDVQQDDAZub2JvZHkxFzAVBgoJkiaJk/IsZAEZ
+FgdleGFtcGxlMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAp2U1hy8U
+HrGClPxByczJtV6UYtQrJAv+FA9Mr0nkXKoHyEQMu3au4zAqwdTp+7+aAb6wu8cX
+WepaFkAOGfqvAJ80/TfTbm+S05nqIl9TrS/K1j9/eCSIY2Q/bWXSHPT4yzXl/7na
+CT6wVerAYFsO14jTHntSweL4oA3rtC48Oe2FgO3CFcgDmlx3HbAf41bwXzYcRm+b
+WFykDvkENWTi8/GekN+884pJif11aCGZS1o+arJW+zxeQPEcN9jnj8PfOI96E/7N
+DMSDwLTtKr/Pq8tI5De5pifScEO40Tpc/eKMnhm+zZ4kR04zJLUfcKyeRaJ48Ksu
+0p3Dx38X4PluhwIDAQABox0wGzAZBgNVHREEEjAQgQ5ub2JvZHlAZXhhbXBsZTAN
+BgkqhkiG9w0BAQUFAAOCAQEAVmEqsyWID85F39fRKe09sFfguIAUJ8H7/8N9lHP/
+dBLbHmESgPaqh0u57Ys3Jf73ecVtJ93CYJlescvytg16rzLpbEwrojvJwYtLLeLP
+Nx0pKopmJ5+/wxvymrmq149mc9esQXgS1SSAN0X3mcYLNcsAQj4p1vG/1Q8GxMO3
+F655Dqj/8RFXDQOM6yEjRTaOrm1bYGSENog3K7aVGcfYfQeFf97QBId84Ov8B1NY
+EmZsUGqvGkMzfj7y7sWBlFqeZl8HUtGp9dFW7ONg+Ui8Gtqdxv43YFdEg3cA7juj
+X9Abwpdj93pgmleN6zEyT0hYx5S7/dadxLgZat+NTpXnrA==
-----END CERTIFICATE-----
diff --git a/test/rubygems/public_cert_32.pem b/test/rubygems/public_cert_32.pem
new file mode 100644
index 0000000000..dcc8a62214
--- /dev/null
+++ b/test/rubygems/public_cert_32.pem
@@ -0,0 +1,18 @@
+-----BEGIN CERTIFICATE-----
+MIIC7DCCAdSgAwIBAgIBETANBgkqhkiG9w0BAQUFADAqMQ8wDQYDVQQDDAZub2Jv
+ZHkxFzAVBgoJkiaJk/IsZAEZFgdleGFtcGxlMB4XDTEyMTIwODAwMDAwMFoXDTM4
+MDExOTAzMTQwN1owKjEPMA0GA1UEAwwGbm9ib2R5MRcwFQYKCZImiZPyLGQBGRYH
+ZXhhbXBsZTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKdlNYcvFB6x
+gpT8QcnMybVelGLUKyQL/hQPTK9J5FyqB8hEDLt2ruMwKsHU6fu/mgG+sLvHF1nq
+WhZADhn6rwCfNP03025vktOZ6iJfU60vytY/f3gkiGNkP21l0hz0+Ms15f+52gk+
+sFXqwGBbDteI0x57UsHi+KAN67QuPDnthYDtwhXIA5pcdx2wH+NW8F82HEZvm1hc
+pA75BDVk4vPxnpDfvPOKSYn9dWghmUtaPmqyVvs8XkDxHDfY54/D3ziPehP+zQzE
+g8C07Sq/z6vLSOQ3uaYn0nBDuNE6XP3ijJ4Zvs2eJEdOMyS1H3CsnkWiePCrLtKd
+w8d/F+D5bocCAwEAAaMdMBswGQYDVR0RBBIwEIEObm9ib2R5QGV4YW1wbGUwDQYJ
+KoZIhvcNAQEFBQADggEBABx3grWVpcJ2RRP/vhT9X7xxdAeEwNahEb4pqHcN57Mm
+S1vH1anaNk9BK4sZLf82Ers6DeGQC8PrBunwBvCdOhFvBMBgcUDGzjJgMyc4RXmi
+0WQPtWXjntXtNm3mlvJM7k4ezMLZwUIRL7+UQXewdM778phZdDVoqpuInAiz/A/x
++gJvTJF4lUVf7wEwNljrRIIOGZaX1S/qJb1rw+hugbB6kA2WLJehsZfzSNxaM+cT
+LlgUh2luXvX1ZSwMQJ1SrZQ9rZLwuaBV2kcVUfAi0peQ03ETZdhjrMRmIbpa+iw5
+vmviY+p7FvjhkwCrVNjiF0CEtPAL3dGi2YHBMDkWY3U=
+-----END CERTIFICATE-----
diff --git a/test/rubygems/public_key.pem b/test/rubygems/public_key.pem
new file mode 100644
index 0000000000..7c29dcd614
--- /dev/null
+++ b/test/rubygems/public_key.pem
@@ -0,0 +1,9 @@
+-----BEGIN PUBLIC KEY-----
+MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAp2U1hy8UHrGClPxByczJ
+tV6UYtQrJAv+FA9Mr0nkXKoHyEQMu3au4zAqwdTp+7+aAb6wu8cXWepaFkAOGfqv
+AJ80/TfTbm+S05nqIl9TrS/K1j9/eCSIY2Q/bWXSHPT4yzXl/7naCT6wVerAYFsO
+14jTHntSweL4oA3rtC48Oe2FgO3CFcgDmlx3HbAf41bwXzYcRm+bWFykDvkENWTi
+8/GekN+884pJif11aCGZS1o+arJW+zxeQPEcN9jnj8PfOI96E/7NDMSDwLTtKr/P
+q8tI5De5pifScEO40Tpc/eKMnhm+zZ4kR04zJLUfcKyeRaJ48Ksu0p3Dx38X4Plu
+hwIDAQAB
+-----END PUBLIC KEY-----
diff --git a/test/rubygems/rubygems/commands/crash_command.rb b/test/rubygems/rubygems/commands/crash_command.rb
index e77b3fcd72..624be9fd32 100644
--- a/test/rubygems/rubygems/commands/crash_command.rb
+++ b/test/rubygems/rubygems/commands/crash_command.rb
@@ -2,4 +2,4 @@ class Gem::Commands::CrashCommand < Gem::Command
raise "crash"
-end \ No newline at end of file
+end
diff --git a/test/rubygems/specifications/bar-0.0.2.gemspec b/test/rubygems/specifications/bar-0.0.2.gemspec
new file mode 100644
index 0000000000..ceefa4ed16
--- /dev/null
+++ b/test/rubygems/specifications/bar-0.0.2.gemspec
@@ -0,0 +1,9 @@
+# -*- encoding: utf-8 -*-
+
+Gem::Specification.new do |s|
+ s.name = "bar"
+ s.version = "0.0.2"
+ s.platform = "ruby"
+ s.require_paths = ["lib"]
+ s.summary = "A very bar gem"
+end
diff --git a/test/rubygems/specifications/foo-0.0.1.gemspec b/test/rubygems/specifications/foo-0.0.1.gemspec
new file mode 100644
index 0000000000..7fbc56429f
--- /dev/null
+++ b/test/rubygems/specifications/foo-0.0.1.gemspec
Binary files differ
diff --git a/test/rubygems/test_bundled_ca.rb b/test/rubygems/test_bundled_ca.rb
new file mode 100644
index 0000000000..711cd1b8f2
--- /dev/null
+++ b/test/rubygems/test_bundled_ca.rb
@@ -0,0 +1,60 @@
+require 'rubygems/test_case'
+require 'net/https'
+require 'rubygems/request'
+
+# = Testing Bundled CA
+#
+# The tested hosts are explained in detail here: https://github.com/rubygems/rubygems/commit/5e16a5428f973667cabfa07e94ff939e7a83ebd9
+#
+class TestBundledCA < Gem::TestCase
+
+ THIS_FILE = File.expand_path __FILE__
+
+ def bundled_certificate_store
+ store = OpenSSL::X509::Store.new
+
+ ssl_cert_glob =
+ File.expand_path '../../../lib/rubygems/ssl_certs/*.pem', THIS_FILE
+
+ Dir[ssl_cert_glob].each do |ssl_cert|
+ store.add_file ssl_cert
+ end
+
+ store
+ end
+
+ def assert_https(host)
+ if self.respond_to? :_assertions # minitest <= 4
+ self._assertions += 1
+ else # minitest >= 5
+ self.assertions += 1
+ end
+ http = Net::HTTP.new(host, 443)
+ http.use_ssl = true
+ http.verify_mode = OpenSSL::SSL::VERIFY_PEER
+ http.cert_store = bundled_certificate_store
+ http.get('/')
+ rescue Errno::ENOENT, Errno::ETIMEDOUT
+ skip "#{host} seems offline, I can't tell whether ssl would work."
+ rescue OpenSSL::SSL::SSLError => e
+ # Only fail for certificate verification errors
+ if e.message =~ /certificate verify failed/
+ flunk "#{host} is not verifiable using the included certificates. Error was: #{e.message}"
+ end
+ raise
+ end
+
+ def test_accessing_rubygems
+ assert_https('rubygems.org')
+ end
+
+ def test_accessing_cloudfront
+ assert_https('d2chzxaqi4y7f8.cloudfront.net')
+ end
+
+ def test_accessing_s3
+ assert_https('s3.amazonaws.com')
+ end
+
+end if ENV['TRAVIS']
+
diff --git a/test/rubygems/test_config.rb b/test/rubygems/test_config.rb
index fae1a6ff54..7829e90dcf 100644
--- a/test/rubygems/test_config.rb
+++ b/test/rubygems/test_config.rb
@@ -4,12 +4,10 @@ require 'rubygems'
class TestConfig < Gem::TestCase
def test_datadir
- _, err = capture_io do
- datadir = RbConfig::CONFIG['datadir']
- assert_equal "#{datadir}/xyz", RbConfig.datadir('xyz')
- end
-
- assert_match(/deprecate/, err)
+ util_make_gems
+ spec = Gem::Specification.find_by_name("a")
+ spec.activate
+ assert_equal "#{spec.full_gem_path}/data/a", Gem.datadir('a')
end
end
diff --git a/test/rubygems/test_deprecate.rb b/test/rubygems/test_deprecate.rb
new file mode 100644
index 0000000000..ed4e9aa5ff
--- /dev/null
+++ b/test/rubygems/test_deprecate.rb
@@ -0,0 +1,76 @@
+require 'rubygems/test_case'
+# require 'rubygems/builder'
+# require 'rubygems/package'
+require 'rubygems/deprecate'
+
+class TestDeprecate < Gem::TestCase
+
+ def setup
+ super
+
+ # Gem::Deprecate.saved_warnings.clear
+ @original_skip = Gem::Deprecate.skip
+ Gem::Deprecate.skip = false
+ end
+
+ def teardown
+ super
+
+ # Gem::Deprecate.saved_warnings.clear
+ Gem::Deprecate.skip = @original_skip
+ end
+
+ def test_defaults
+ assert_equal false, @original_skip
+ end
+
+ def test_assignment
+ Gem::Deprecate.skip = false
+ assert_equal false, Gem::Deprecate.skip
+
+ Gem::Deprecate.skip = true
+ assert_equal true, Gem::Deprecate.skip
+
+ Gem::Deprecate.skip = nil
+ assert([true,false].include? Gem::Deprecate.skip)
+ end
+
+ def test_skip
+ Gem::Deprecate.skip_during do
+ assert_equal true, Gem::Deprecate.skip
+ end
+
+ Gem::Deprecate.skip = nil
+ end
+
+ class Thing
+ extend Gem::Deprecate
+ attr_accessor :message
+ def foo
+ @message = "foo"
+ end
+ def bar
+ @message = "bar"
+ end
+ deprecate :foo, :bar, 2099, 3
+ end
+
+ def test_deprecated_method_calls_the_old_method
+ capture_io do
+ thing = Thing.new
+ thing.foo
+ assert_equal "foo", thing.message
+ end
+ end
+
+ def test_deprecated_method_outputs_a_warning
+ out, err = capture_io do
+ thing = Thing.new
+ thing.foo
+ end
+
+ assert_equal "", out
+ assert_match(/Thing#foo is deprecated; use bar instead\./, err)
+ assert_match(/on or after 2099-03-01/, err)
+ end
+end
diff --git a/test/rubygems/test_gem.rb b/test/rubygems/test_gem.rb
index b7c7f41eb6..44b6c4a18b 100644
--- a/test/rubygems/test_gem.rb
+++ b/test/rubygems/test_gem.rb
@@ -1,224 +1,80 @@
+# coding: US-ASCII
require 'rubygems/test_case'
require 'rubygems'
-require 'rubygems/gem_openssl'
+require 'rubygems/command'
require 'rubygems/installer'
require 'pathname'
require 'tmpdir'
+# TODO: push this up to test_case.rb once battle tested
+$SAFE=1
+$LOAD_PATH.map! do |path|
+ path.dup.untaint
+end
+
class TestGem < Gem::TestCase
+ PLUGINS_LOADED = []
+
def setup
super
- @additional = %w[a b].map { |d| File.join @tempdir, d }
- @default_dir_re = if RUBY_VERSION > '1.9' then
- %r|/.*?[Rr]uby.*?/[Gg]ems/[0-9.]+|
- else
- %r|/[Rr]uby/[Gg]ems/[0-9.]+|
- end
-
- util_remove_interrupt_command
- end
-
- 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
+ PLUGINS_LOADED.clear
- loaded = Gem.loaded_specs.values.map(&:full_name)
+ common_installer_setup
- assert_equal expected.sort, loaded.sort if expected
- end
-
- def test_self_activate
- foo = util_spec 'foo', '1'
-
- assert_activate %w[foo-1], foo
- end
-
- def loaded_spec_names
- Gem.loaded_specs.values.map(&:full_name).sort
- end
-
- def unresolved_names
- Gem.unresolved_deps.values.map(&:to_s).sort
- end
-
- # TODO: move these to specification
- def test_self_activate_via_require
- a1 = new_spec "a", "1", "b" => "= 1"
- b1 = new_spec "b", "1", nil, "lib/b/c.rb"
- b2 = new_spec "b", "2", nil, "lib/b/c.rb"
-
- install_specs a1, b1, b2
-
- a1.activate
- require "b/c"
-
- assert_equal %w(a-1 b-1), loaded_spec_names
- end
-
- # TODO: move these to specification
- def test_self_activate_deep_unambiguous
- a1 = new_spec "a", "1", "b" => "= 1"
- b1 = new_spec "b", "1", "c" => "= 1"
- b2 = new_spec "b", "2", "c" => "= 2"
- c1 = new_spec "c", "1"
- c2 = new_spec "c", "2"
-
- install_specs a1, b1, b2, c1, c2
-
- a1.activate
- assert_equal %w(a-1 b-1 c-1), loaded_spec_names
- end
+ ENV.delete 'RUBYGEMS_GEMDEPS'
+ @additional = %w[a b].map { |d| File.join @tempdir, d }
- def save_loaded_features
- old_loaded_features = $LOADED_FEATURES.dup
- yield
- ensure
- $LOADED_FEATURES.replace old_loaded_features
+ util_remove_interrupt_command
end
- # TODO: move these to specification
- def test_self_activate_ambiguous_direct
+ def test_self_finish_resolve
save_loaded_features do
a1 = new_spec "a", "1", "b" => "> 0"
- b1 = new_spec("b", "1", { "c" => ">= 1" }, "lib/d.rb")
- b2 = new_spec("b", "2", { "c" => ">= 2" }, "lib/d.rb")
+ b1 = new_spec "b", "1", "c" => ">= 1"
+ b2 = new_spec "b", "2", "c" => ">= 2"
c1 = new_spec "c", "1"
c2 = new_spec "c", "2"
- Gem::Specification.reset
install_specs a1, b1, b2, c1, c2
a1.activate
- assert_equal %w(a-1), loaded_spec_names
- assert_equal ["b (> 0)"], unresolved_names
-
- require "d"
-
- assert_equal %w(a-1 b-2 c-2), loaded_spec_names
- assert_equal [], unresolved_names
- end
- end
- # TODO: move these to specification
- def test_self_activate_ambiguous_indirect
- save_loaded_features do
- a1 = new_spec "a", "1", "b" => "> 0"
- b1 = new_spec "b", "1", "c" => ">= 1"
- b2 = new_spec "b", "2", "c" => ">= 2"
- c1 = new_spec "c", "1", nil, "lib/d.rb"
- c2 = new_spec "c", "2", nil, "lib/d.rb"
-
- install_specs a1, b1, b2, c1, c2
-
- a1.activate
assert_equal %w(a-1), loaded_spec_names
assert_equal ["b (> 0)"], unresolved_names
- require "d"
+ Gem.finish_resolve
assert_equal %w(a-1 b-2 c-2), loaded_spec_names
assert_equal [], unresolved_names
end
end
- # TODO: move these to specification
- def test_self_activate_ambiguous_unrelated
+ def test_self_finish_resolve_wtf
save_loaded_features do
- a1 = new_spec "a", "1", "b" => "> 0"
- b1 = new_spec "b", "1", "c" => ">= 1"
- b2 = new_spec "b", "2", "c" => ">= 2"
- c1 = new_spec "c", "1"
+ a1 = new_spec "a", "1", "b" => "> 0", "d" => "> 0" # this
+ b1 = new_spec "b", "1", { "c" => ">= 1" }, "lib/b.rb" # this
+ b2 = new_spec "b", "2", { "c" => ">= 2" }, "lib/b.rb"
+ c1 = new_spec "c", "1" # this
c2 = new_spec "c", "2"
- d1 = new_spec "d", "1", nil, "lib/d.rb"
+ d1 = new_spec "d", "1", { "c" => "< 2" }, "lib/d.rb"
+ d2 = new_spec "d", "2", { "c" => "< 2" }, "lib/d.rb" # this
- install_specs a1, b1, b2, c1, c2, d1
+ install_specs a1, b1, b2, c1, c2, d1, d2
a1.activate
- assert_equal %w(a-1), loaded_spec_names
- assert_equal ["b (> 0)"], unresolved_names
-
- require "d"
-
- assert_equal %w(a-1 d-1), loaded_spec_names
- assert_equal ["b (> 0)"], unresolved_names
- end
- end
-
- # TODO: move these to specification
- def test_self_activate_ambiguous_indirect_conflict
- save_loaded_features do
- a1 = new_spec "a", "1", "b" => "> 0"
- a2 = new_spec "a", "2", "b" => "> 0"
- b1 = new_spec "b", "1", "c" => ">= 1"
- b2 = new_spec "b", "2", "c" => ">= 2"
- c1 = new_spec "c", "1", nil, "lib/d.rb"
- c2 = new_spec("c", "2", { "a" => "1" }, "lib/d.rb") # conflicts with a-2
-
- install_specs a1, a2, b1, b2, c1, c2
- a2.activate
- assert_equal %w(a-2), loaded_spec_names
- assert_equal ["b (> 0)"], unresolved_names
-
- require "d"
-
- assert_equal %w(a-2 b-1 c-1), loaded_spec_names
- assert_equal [], unresolved_names
- end
- end
-
- # TODO: move these to specification
- def test_require_already_activated
- save_loaded_features do
- a1 = new_spec "a", "1", nil, "lib/d.rb"
-
- install_specs a1 # , a2, b1, b2, c1, c2
-
- a1.activate
assert_equal %w(a-1), loaded_spec_names
- assert_equal [], unresolved_names
+ assert_equal ["b (> 0)", "d (> 0)"], unresolved_names
- assert require "d"
+ Gem.finish_resolve
- assert_equal %w(a-1), loaded_spec_names
+ assert_equal %w(a-1 b-1 c-1 d-2), loaded_spec_names
assert_equal [], unresolved_names
end
end
- # TODO: move these to specification
- def test_require_already_activated_indirect_conflict
- save_loaded_features do
- a1 = new_spec "a", "1", "b" => "> 0"
- a2 = new_spec "a", "2", "b" => "> 0"
- b1 = new_spec "b", "1", "c" => ">= 1"
- b2 = new_spec "b", "2", "c" => ">= 2"
- c1 = new_spec "c", "1", nil, "lib/d.rb"
- c2 = new_spec("c", "2", { "a" => "1" }, "lib/d.rb") # conflicts with a-2
-
- install_specs a1, a2, b1, b2, c1, c2
-
- a1.activate
- c1.activate
- assert_equal %w(a-1 c-1), loaded_spec_names
- assert_equal ["b (> 0)"], unresolved_names
-
- assert require "d"
-
- assert_equal %w(a-1 c-1), loaded_spec_names
- assert_equal ["b (> 0)"], unresolved_names
- end
- end
-
def test_require_missing
save_loaded_features do
assert_raises ::LoadError do
@@ -241,231 +97,6 @@ class TestGem < Gem::TestCase
end
end
- # TODO: move these to specification
- def test_self_activate_loaded
- foo = util_spec 'foo', '1'
-
- assert foo.activate
- refute foo.activate
- end
-
- ##
- # [A] depends on
- # [B] >= 1.0 (satisfied by 2.0)
- # [C] depends on nothing
-
- def test_self_activate_unrelated
- a = util_spec 'a', '1.0', 'b' => '>= 1.0'
- util_spec 'b', '1.0'
- c = util_spec 'c', '1.0'
-
- assert_activate %w[b-1.0 c-1.0 a-1.0], a, c, "b"
- end
-
- ##
- # [A] depends on
- # [B] >= 1.0 (satisfied by 2.0)
- # [C] = 1.0 depends on
- # [B] ~> 1.0
- #
- # and should resolve using b-1.0
- # TODO: move these to specification
-
- def test_self_activate_over
- a = util_spec 'a', '1.0', 'b' => '>= 1.0', 'c' => '= 1.0'
- util_spec 'b', '1.0'
- util_spec 'b', '1.1'
- util_spec 'b', '2.0'
- util_spec 'c', '1.0', 'b' => '~> 1.0'
-
- a.activate
-
- assert_equal %w[a-1.0 c-1.0], loaded_spec_names
- assert_equal ["b (>= 1.0, ~> 1.0)"], unresolved_names
- end
-
- ##
- # [A] depends on
- # [B] ~> 1.0 (satisfied by 1.1)
- # [C] = 1.0 depends on
- # [B] = 1.0
- #
- # and should resolve using b-1.0
- #
- # TODO: this is not under, but over... under would require depth
- # first resolve through a dependency that is later pruned.
-
- def test_self_activate_under
- a, _ = util_spec 'a', '1.0', 'b' => '~> 1.0', 'c' => '= 1.0'
- util_spec 'b', '1.0'
- util_spec 'b', '1.1'
- c, _ = util_spec 'c', '1.0', 'b' => '= 1.0'
-
- assert_activate %w[b-1.0 c-1.0 a-1.0], a, c, "b"
- end
-
- ##
- # [A1] depends on
- # [B] > 0 (satisfied by 2.0)
- # [B1] depends on
- # [C] > 0 (satisfied by 1.0)
- # [B2] depends on nothing!
- # [C1] depends on nothing
-
- def test_self_activate_dropped
- a1, = util_spec 'a', '1', 'b' => nil
- util_spec 'b', '1', 'c' => nil
- util_spec 'b', '2'
- util_spec 'c', '1'
-
- assert_activate %w[b-2 a-1], a1, "b"
- end
-
- ##
- # [A] depends on
- # [B] >= 1.0 (satisfied by 1.1) depends on
- # [Z]
- # [C] >= 1.0 depends on
- # [B] = 1.0
- #
- # and should backtrack to resolve using b-1.0, pruning Z from the
- # resolve.
-
- def test_self_activate_raggi_the_edgecase_generator
- a, _ = util_spec 'a', '1.0', 'b' => '>= 1.0', 'c' => '>= 1.0'
- util_spec 'b', '1.0'
- util_spec 'b', '1.1', 'z' => '>= 1.0'
- c, _ = util_spec 'c', '1.0', 'b' => '= 1.0'
-
- assert_activate %w[b-1.0 c-1.0 a-1.0], a, c, "b"
- end
-
- def test_self_activate_conflict
- util_spec 'b', '1.0'
- util_spec 'b', '2.0'
-
- gem "b", "= 1.0"
-
- assert_raises Gem::LoadError do
- gem "b", "= 2.0"
- end
- end
-
- ##
- # [A] depends on
- # [C] = 1.0 depends on
- # [B] = 2.0
- # [B] ~> 1.0 (satisfied by 1.0)
-
- def test_self_activate_checks_dependencies
- a, _ = util_spec 'a', '1.0'
- a.add_dependency 'c', '= 1.0'
- a.add_dependency 'b', '~> 1.0'
-
- util_spec 'b', '1.0'
- util_spec 'b', '2.0'
- c, _ = util_spec 'c', '1.0', 'b' => '= 2.0'
-
- e = assert_raises Gem::LoadError do
- assert_activate nil, a, c, "b"
- end
-
- expected = "can't satisfy 'b (~> 1.0)', already activated 'b-2.0'"
- assert_equal expected, e.message
- end
-
- ##
- # [A] depends on
- # [B] ~> 1.0 (satisfied by 1.0)
- # [C] = 1.0 depends on
- # [B] = 2.0
-
- def test_self_activate_divergent
- a, _ = util_spec 'a', '1.0', 'b' => '~> 1.0', 'c' => '= 1.0'
- util_spec 'b', '1.0'
- util_spec 'b', '2.0'
- c, _ = util_spec 'c', '1.0', 'b' => '= 2.0'
-
- e = assert_raises Gem::LoadError do
- assert_activate nil, a, c, "b"
- end
-
- assert_match(/Unable to activate c-1.0,/, e.message)
- assert_match(/because b-1.0 conflicts with b .= 2.0/, e.message)
- end
-
- ##
- # DOC
-
- def test_self_activate_platform_alternate
- @x1_m = util_spec 'x', '1' do |s|
- s.platform = Gem::Platform.new %w[cpu my_platform 1]
- end
-
- @x1_o = util_spec 'x', '1' do |s|
- s.platform = Gem::Platform.new %w[cpu other_platform 1]
- end
-
- @w1 = util_spec 'w', '1', 'x' => nil
-
- util_set_arch 'cpu-my_platform1'
-
- assert_activate %w[x-1-cpu-my_platform-1 w-1], @w1, @x1_m
- end
-
- ##
- # DOC
-
- def test_self_activate_platform_bump
- @y1 = util_spec 'y', '1'
-
- @y1_1_p = util_spec 'y', '1.1' do |s|
- s.platform = Gem::Platform.new %w[cpu my_platform 1]
- end
-
- @z1 = util_spec 'z', '1', 'y' => nil
-
- assert_activate %w[y-1 z-1], @z1, @y1
- end
-
- ##
- # [C] depends on
- # [A] = 1.a
- # [B] = 1.0 depends on
- # [A] >= 0 (satisfied by 1.a)
-
- def test_self_activate_prerelease
- @c1_pre = util_spec 'c', '1.a', "a" => "1.a", "b" => "1"
- @a1_pre = util_spec 'a', '1.a'
- @b1 = util_spec 'b', '1' do |s|
- s.add_dependency 'a'
- s.add_development_dependency 'aa'
- end
-
- assert_activate %w[a-1.a b-1 c-1.a], @c1_pre, @a1_pre, @b1
- end
-
- ##
- # DOC
-
- def test_self_activate_old_required
- e1, = util_spec 'e', '1', 'd' => '= 1'
- @d1 = util_spec 'd', '1'
- @d2 = util_spec 'd', '2'
-
- assert_activate %w[d-1 e-1], e1, "d"
- end
-
- def test_self_available?
- util_make_gems
- Gem::Deprecate.skip_during do
- assert(Gem.available?("a"))
- assert(Gem.available?("a", "1"))
- assert(Gem.available?("a", ">1"))
- assert(!Gem.available?("monkeys"))
- end
- end
-
def test_self_bin_path_no_exec_name
e = assert_raises ArgumentError do
Gem.bin_path 'a'
@@ -485,7 +116,7 @@ class TestGem < Gem::TestCase
end
def test_self_bin_path_nonexistent_binfile
- quick_spec 'a', '2' do |s|
+ util_spec 'a', '2' do |s|
s.executables = ['exec']
end
assert_raises(Gem::GemNotFoundException) do
@@ -494,7 +125,7 @@ class TestGem < Gem::TestCase
end
def test_self_bin_path_no_bin_file
- quick_spec 'a', '1'
+ util_spec 'a', '1'
assert_raises(ArgumentError) do
Gem.bin_path('a', nil, '1')
end
@@ -508,7 +139,7 @@ class TestGem < Gem::TestCase
def test_self_bin_path_bin_file_gone_in_latest
util_exec_gem
- quick_spec 'a', '10' do |s|
+ util_spec 'a', '10' do |s|
s.executables = []
end
# Should not find a-10's non-abin (bug)
@@ -523,14 +154,8 @@ class TestGem < Gem::TestCase
def test_self_bindir_default_dir
default = Gem.default_dir
- bindir = if defined?(RUBY_FRAMEWORK_VERSION) then
- '/usr/bin'
- else
- RbConfig::CONFIG['bindir']
- end
- assert_equal bindir, Gem.bindir(default)
- assert_equal bindir, Gem.bindir(Pathname.new(default))
+ assert_equal Gem.default_bindir, Gem.bindir(default)
end
def test_self_clear_paths
@@ -558,7 +183,7 @@ class TestGem < Gem::TestCase
fp.puts 'blah'
end
- foo = quick_spec 'foo' do |s| s.files = %w[data/foo.txt] end
+ foo = util_spec 'foo' do |s| s.files = %w[data/foo.txt] end
install_gem foo
end
@@ -573,10 +198,6 @@ class TestGem < Gem::TestCase
assert_nil Gem.datadir('xyzzy')
end
- def test_self_default_dir
- assert_match @default_dir_re, Gem.default_dir
- end
-
def test_self_default_exec_format
orig_RUBY_INSTALL_NAME = Gem::ConfigMap[:ruby_install_name]
Gem::ConfigMap[:ruby_install_name] = 'ruby'
@@ -605,7 +226,26 @@ class TestGem < Gem::TestCase
end
def test_self_default_sources
- assert_equal %w[http://rubygems.org/], Gem.default_sources
+ assert_equal %w[https://rubygems.org/], Gem.default_sources
+ end
+
+ def test_self_detect_gemdeps
+ rubygems_gemdeps, ENV['RUBYGEMS_GEMDEPS'] = ENV['RUBYGEMS_GEMDEPS'], '-'
+
+ FileUtils.mkdir_p 'detect/a/b'
+ FileUtils.mkdir_p 'detect/a/Isolate'
+
+ FileUtils.touch 'detect/Isolate'
+
+ begin
+ Dir.chdir 'detect/a/b'
+
+ assert_empty Gem.detect_gemdeps
+ ensure
+ Dir.chdir @tempdir
+ end
+ ensure
+ ENV['RUBYGEMS_GEMDEPS'] = rubygems_gemdeps
end
def test_self_dir
@@ -618,9 +258,26 @@ class TestGem < Gem::TestCase
Gem.ensure_gem_subdirectories @gemhome
- assert File.directory? File.join(@gemhome, "cache")
+ assert_path_exists File.join @gemhome, 'build_info'
+ assert_path_exists File.join @gemhome, 'cache'
+ assert_path_exists File.join @gemhome, 'doc'
+ assert_path_exists File.join @gemhome, 'extensions'
+ assert_path_exists File.join @gemhome, 'gems'
+ assert_path_exists File.join @gemhome, 'specifications'
end
+ def test_self_ensure_gem_directories_permissions
+ FileUtils.rm_r @gemhome
+ Gem.use_paths @gemhome
+
+ Gem.ensure_gem_subdirectories @gemhome, 0750
+
+ assert File.directory? File.join(@gemhome, "cache")
+
+ assert_equal 0750, File::Stat.new(@gemhome).mode & 0777
+ assert_equal 0750, File::Stat.new(File.join(@gemhome, "cache")).mode & 0777
+ end unless win_platform?
+
def test_self_ensure_gem_directories_safe_permissions
FileUtils.rm_r @gemhome
Gem.use_paths @gemhome
@@ -681,17 +338,22 @@ class TestGem < Gem::TestCase
end
end
- def test_ensure_ssl_available
- orig_Gem_ssl_available = Gem.ssl_available?
+ def test_self_extension_install_dir_shared
+ enable_shared, RbConfig::CONFIG['ENABLE_SHARED'] =
+ RbConfig::CONFIG['ENABLE_SHARED'], 'yes'
+
+ assert_equal Gem.ruby_api_version, Gem.extension_api_version
+ ensure
+ RbConfig::CONFIG['ENABLE_SHARED'] = enable_shared
+ end
- Gem.ssl_available = true
- Gem.ensure_ssl_available
+ def test_self_extension_install_dir_static
+ enable_shared, RbConfig::CONFIG['ENABLE_SHARED'] =
+ RbConfig::CONFIG['ENABLE_SHARED'], 'no'
- Gem.ssl_available = false
- e = assert_raises Gem::Exception do Gem.ensure_ssl_available end
- assert_equal 'SSL is not installed on this system', e.message
+ assert_equal "#{Gem.ruby_api_version}-static", Gem.extension_api_version
ensure
- Gem.ssl_available = orig_Gem_ssl_available
+ RbConfig::CONFIG['ENABLE_SHARED'] = enable_shared
end
def test_self_find_files
@@ -712,9 +374,7 @@ class TestGem < Gem::TestCase
spec
}
- # HACK should be Gem.refresh
- Gem.searcher = nil
- Gem::Specification.reset
+ Gem.refresh
expected = [
File.expand_path('test/rubygems/sff/discover.rb', @@project_dir),
@@ -728,8 +388,75 @@ class TestGem < Gem::TestCase
assert_equal cwd, $LOAD_PATH.shift
end
+ def test_self_find_latest_files
+ cwd = File.expand_path("test/rubygems", @@project_dir)
+ $LOAD_PATH.unshift cwd
+
+ discover_path = File.join 'lib', 'sff', 'discover.rb'
+
+ _, foo2 = %w(1 2).map { |version|
+ spec = quick_gem 'sff', version do |s|
+ s.files << discover_path
+ end
+
+ write_file(File.join 'gems', spec.full_name, discover_path) do |fp|
+ fp.puts "# #{spec.full_name}"
+ end
+
+ spec
+ }
+
+ Gem.refresh
+
+ expected = [
+ File.expand_path('test/rubygems/sff/discover.rb', @@project_dir),
+ File.join(foo2.full_gem_path, discover_path),
+ ]
+
+ assert_equal expected, Gem.find_latest_files('sff/discover')
+ assert_equal expected, Gem.find_latest_files('sff/**.rb'), '[ruby-core:31730]'
+ ensure
+ assert_equal cwd, $LOAD_PATH.shift
+ end
+
+ def test_self_latest_spec_for
+ gems = spec_fetcher do |fetcher|
+ fetcher.spec 'a', 1
+ fetcher.spec 'a', '3.a'
+ fetcher.spec 'a', 2
+ end
+
+ spec = Gem.latest_spec_for 'a'
+
+ assert_equal gems['a-2'], spec
+ end
+
+ def test_self_latest_rubygems_version
+ spec_fetcher do |fetcher|
+ fetcher.spec 'rubygems-update', '1.8.23'
+ fetcher.spec 'rubygems-update', '1.8.24'
+ fetcher.spec 'rubygems-update', '2.0.0.preview3'
+ end
+
+ version = Gem.latest_rubygems_version
+
+ assert_equal Gem::Version.new('1.8.24'), version
+ end
+
+ def test_self_latest_version_for
+ spec_fetcher do |fetcher|
+ fetcher.spec 'a', 1
+ fetcher.spec 'a', 2
+ fetcher.spec 'a', '3.a'
+ end
+
+ version = Gem.latest_version_for 'a'
+
+ assert_equal Gem::Version.new(2), version
+ end
+
def test_self_loaded_specs
- foo = quick_spec 'foo'
+ foo = util_spec 'foo'
install_gem foo
foo.activate
@@ -756,7 +483,7 @@ class TestGem < Gem::TestCase
Gem.instance_variable_set :@paths, nil
- assert_equal [Gem.dir, *Gem.default_path].uniq, Gem.path
+ assert_equal [Gem.default_path, Gem.dir].flatten.uniq, Gem.path
ensure
Object.const_set :APPLE_GEM_HOME, orig_APPLE_GEM_HOME if orig_APPLE_GEM_HOME
end
@@ -795,10 +522,11 @@ class TestGem < Gem::TestCase
ENV['GEM_PATH'] = @additional.join(File::PATH_SEPARATOR)
- assert_equal [Gem.dir, *@additional], Gem.path
+ assert_equal @additional, Gem.path[0,2]
assert_equal path_count + @additional.size, Gem.path.size,
"extra path components: #{Gem.path[2..-1].inspect}"
+ assert_equal Gem.dir, Gem.path.last
end
def test_self_path_duplicate
@@ -811,7 +539,8 @@ class TestGem < Gem::TestCase
assert_equal @gemhome, Gem.dir
- assert_equal [Gem.dir, *@additional], Gem.path
+ paths = [Gem.dir]
+ assert_equal @additional + paths, Gem.path
end
def test_self_path_overlap
@@ -823,7 +552,8 @@ class TestGem < Gem::TestCase
assert_equal @gemhome, Gem.dir
- assert_equal [Gem.dir, *@additional], Gem.path
+ paths = [Gem.dir]
+ assert_equal @additional + paths, Gem.path
end
def test_self_platforms
@@ -871,6 +601,27 @@ class TestGem < Gem::TestCase
assert_includes Gem::Specification.all_names, @a1.full_name
end
+ def test_self_refresh_keeps_loaded_specs_activated
+ util_make_gems
+
+ a1_spec = @a1.spec_file
+ moved_path = File.join @tempdir, File.basename(a1_spec)
+
+ FileUtils.mv a1_spec, moved_path
+
+ Gem.refresh
+
+ s = Gem::Specification.first
+ s.activate
+
+ Gem.refresh
+
+ Gem::Specification.each{|spec| assert spec.activated? if spec == s}
+
+ Gem.loaded_specs.delete(s)
+ Gem.refresh
+ end
+
def test_self_ruby_escaping_spaces_in_path
orig_ruby = Gem.ruby
orig_bindir = Gem::ConfigMap[:bindir]
@@ -909,6 +660,22 @@ class TestGem < Gem::TestCase
Gem::ConfigMap[:EXEEXT] = orig_exe_ext
end
+ def test_self_ruby_api_version
+ orig_MAJOR, Gem::ConfigMap[:MAJOR] = Gem::ConfigMap[:MAJOR], '1'
+ orig_MINOR, Gem::ConfigMap[:MINOR] = Gem::ConfigMap[:MINOR], '2'
+ orig_TEENY, Gem::ConfigMap[:TEENY] = Gem::ConfigMap[:TEENY], '3'
+
+ Gem.instance_variable_set :@ruby_api_version, nil
+
+ assert_equal '1.2.3', Gem.ruby_api_version
+ ensure
+ Gem.instance_variable_set :@ruby_api_version, nil
+
+ Gem::ConfigMap[:MAJOR] = orig_MAJOR
+ Gem::ConfigMap[:MINOR] = orig_MINOR
+ Gem::ConfigMap[:TEENY] = orig_TEENY
+ end
+
def test_self_ruby_version_1_8_5
util_set_RUBY_VERSION '1.8.5'
@@ -933,6 +700,10 @@ class TestGem < Gem::TestCase
util_restore_RUBY_VERSION
end
+ def test_self_rubygems_version
+ assert_equal Gem::Version.new(Gem::VERSION), Gem.rubygems_version
+ end
+
def test_self_paths_eq
other = File.join @tempdir, 'other'
path = [@userhome, other].join File::PATH_SEPARATOR
@@ -943,7 +714,7 @@ class TestGem < Gem::TestCase
ENV["GEM_HOME"] = @gemhome
Gem.paths = { "GEM_PATH" => path }
- assert_equal [@gemhome, @userhome, other], Gem.path
+ assert_equal [@userhome, other, @gemhome], Gem.path
end
def test_self_paths_eq_nonexistent_home
@@ -956,13 +727,71 @@ class TestGem < Gem::TestCase
Gem.paths = { "GEM_PATH" => other }
- assert_equal [@gemhome, other], Gem.path
+ assert_equal [other, @gemhome], Gem.path
end
- def test_self_source_index
- Gem::Deprecate.skip_during do
- assert_kind_of Gem::SourceIndex, Gem.source_index
- end
+ def test_self_post_build
+ assert_equal 1, Gem.post_build_hooks.length
+
+ Gem.post_build do |installer| end
+
+ assert_equal 2, Gem.post_build_hooks.length
+ end
+
+ def test_self_post_install
+ assert_equal 1, Gem.post_install_hooks.length
+
+ Gem.post_install do |installer| end
+
+ assert_equal 2, Gem.post_install_hooks.length
+ end
+
+ def test_self_done_installing
+ assert_empty Gem.done_installing_hooks
+
+ Gem.done_installing do |gems| end
+
+ assert_equal 1, Gem.done_installing_hooks.length
+ end
+
+ def test_self_post_reset
+ assert_empty Gem.post_reset_hooks
+
+ Gem.post_reset { }
+
+ assert_equal 1, Gem.post_reset_hooks.length
+ end
+
+ def test_self_post_uninstall
+ assert_equal 1, Gem.post_uninstall_hooks.length
+
+ Gem.post_uninstall do |installer| end
+
+ assert_equal 2, Gem.post_uninstall_hooks.length
+ end
+
+ def test_self_pre_install
+ assert_equal 1, Gem.pre_install_hooks.length
+
+ Gem.pre_install do |installer| end
+
+ assert_equal 2, Gem.pre_install_hooks.length
+ end
+
+ def test_self_pre_reset
+ assert_empty Gem.pre_reset_hooks
+
+ Gem.pre_reset { }
+
+ assert_equal 1, Gem.pre_reset_hooks.length
+ end
+
+ def test_self_pre_uninstall
+ assert_equal 1, Gem.pre_uninstall_hooks.length
+
+ Gem.pre_uninstall do |installer| end
+
+ assert_equal 2, Gem.pre_uninstall_hooks.length
end
def test_self_sources
@@ -982,19 +811,7 @@ class TestGem < Gem::TestCase
Gem.try_activate 'a_file'
end
- assert_match %r%Could not find b %, e.message
- end
-
- def test_ssl_available_eh
- orig_Gem_ssl_available = Gem.ssl_available?
-
- Gem.ssl_available = true
- assert_equal true, Gem.ssl_available?
-
- Gem.ssl_available = false
- assert_equal false, Gem.ssl_available?
- ensure
- Gem.ssl_available = orig_Gem_ssl_available
+ assert_match %r%Could not find 'b' %, e.message
end
def test_self_use_paths
@@ -1003,12 +820,14 @@ class TestGem < Gem::TestCase
Gem.use_paths @gemhome, @additional
assert_equal @gemhome, Gem.dir
- assert_equal [Gem.dir, *@additional], Gem.path
+ assert_equal @additional + [Gem.dir], Gem.path
end
def test_self_user_dir
- assert_equal File.join(@userhome, '.gem', Gem.ruby_engine,
- Gem::ConfigMap[:ruby_version]), Gem.user_dir
+ parts = [@userhome, '.gem', Gem.ruby_engine]
+ parts << Gem::ConfigMap[:ruby_version] unless Gem::ConfigMap[:ruby_version].empty?
+
+ assert_equal File.join(parts), Gem.user_dir
end
def test_self_user_home
@@ -1019,6 +838,73 @@ class TestGem < Gem::TestCase
end
end
+ def test_self_needs
+ util_clear_gems
+ a = util_spec "a", "1"
+ b = util_spec "b", "1", "c" => nil
+ c = util_spec "c", "2"
+
+ install_specs a, b, c
+
+ Gem.needs do |r|
+ r.gem "a"
+ r.gem "b", "= 1"
+ end
+
+ activated = Gem::Specification.map { |x| x.full_name }
+
+ assert_equal %w!a-1 b-1 c-2!, activated.sort
+ end
+
+ def test_self_needs_picks_up_unresolved_deps
+ save_loaded_features do
+ util_clear_gems
+ a = util_spec "a", "1"
+ b = util_spec "b", "1", "c" => nil
+ c = util_spec "c", "2"
+ d = new_spec "d", "1", {'e' => '= 1'}, "lib/d.rb"
+ e = util_spec "e", "1"
+
+ install_specs a, b, c, d, e
+
+ Gem.needs do |r|
+ r.gem "a"
+ r.gem "b", "= 1"
+
+ require 'd'
+ end
+
+ assert_equal %w!a-1 b-1 c-2 d-1 e-1!, loaded_spec_names
+ end
+ end
+
+ def test_self_gunzip
+ input = "\x1F\x8B\b\0\xED\xA3\x1AQ\0\x03\xCBH" +
+ "\xCD\xC9\xC9\a\0\x86\xA6\x106\x05\0\0\0"
+
+ output = Gem.gunzip input
+
+ assert_equal 'hello', output
+
+ return unless Object.const_defined? :Encoding
+
+ assert_equal Encoding::BINARY, output.encoding
+ end
+
+ def test_self_gzip
+ input = 'hello'
+
+ output = Gem.gzip input
+
+ zipped = StringIO.new output
+
+ assert_equal 'hello', Zlib::GzipReader.new(zipped).read
+
+ return unless Object.const_defined? :Encoding
+
+ assert_equal Encoding::BINARY, output.encoding
+ end
+
if Gem.win_platform? && '1.9' > RUBY_VERSION
# Ruby 1.9 properly handles ~ path expansion, so no need to run such tests.
def test_self_user_home_userprofile
@@ -1068,14 +954,20 @@ class TestGem < Gem::TestCase
Dir.chdir @tempdir do
FileUtils.mkdir_p 'lib'
File.open plugin_path, "w" do |fp|
- fp.puts "class TestGem; TEST_SPEC_PLUGIN_LOAD = :loaded; end"
+ fp.puts "class TestGem; PLUGINS_LOADED << 'plugin'; end"
end
- foo = quick_spec 'foo', '1' do |s|
+ foo1 = util_spec 'foo', '1' do |s|
s.files << plugin_path
end
- install_gem foo
+ install_gem foo1
+
+ foo2 = util_spec 'foo', '2' do |s|
+ s.files << plugin_path
+ end
+
+ install_gem foo2
end
Gem.searcher = nil
@@ -1085,7 +977,7 @@ class TestGem < Gem::TestCase
Gem.load_plugins
- assert_equal :loaded, TEST_SPEC_PLUGIN_LOAD
+ assert_equal %w[plugin], PLUGINS_LOADED
end
def test_load_env_plugins
@@ -1105,23 +997,6 @@ class TestGem < Gem::TestCase
assert_equal :loaded, TEST_PLUGIN_EXCEPTION rescue nil
end
- def test_latest_load_paths
- spec = quick_spec 'a', '4' do |s|
- s.require_paths = ["lib"]
- end
-
- install_gem spec
-
- # @exec_path = File.join spec.full_gem_path, spec.bindir, 'exec'
- # @abin_path = File.join spec.full_gem_path, spec.bindir, 'abin'
- # FileUtils.mkdir_p File.join(stem, "gems", "test-3")
-
- Gem::Deprecate.skip_during do
- expected = [File.join(@gemhome, "gems", "a-4", "lib")]
- assert_equal expected, Gem.latest_load_paths
- end
- end
-
def test_gem_path_ordering
refute_equal Gem.dir, Gem.user_dir
@@ -1202,6 +1077,246 @@ class TestGem < Gem::TestCase
"Wrong spec selected"
end
+ def test_auto_activation_of_specific_gemdeps_file
+ util_clear_gems
+
+ a = new_spec "a", "1", nil, "lib/a.rb"
+ b = new_spec "b", "1", nil, "lib/b.rb"
+ c = new_spec "c", "1", nil, "lib/c.rb"
+
+ install_specs a, b, c
+
+ path = File.join @tempdir, "gem.deps.rb"
+
+ File.open path, "w" do |f|
+ f.puts "gem 'a'"
+ f.puts "gem 'b'"
+ f.puts "gem 'c'"
+ end
+
+ ENV['RUBYGEMS_GEMDEPS'] = path
+
+ Gem.detect_gemdeps
+
+ assert_equal %w!a-1 b-1 c-1!, loaded_spec_names
+ end
+
+ def test_auto_activation_of_detected_gemdeps_file
+ util_clear_gems
+
+ a = new_spec "a", "1", nil, "lib/a.rb"
+ b = new_spec "b", "1", nil, "lib/b.rb"
+ c = new_spec "c", "1", nil, "lib/c.rb"
+
+ install_specs a, b, c
+
+ path = File.join @tempdir, "gem.deps.rb"
+
+ File.open path, "w" do |f|
+ f.puts "gem 'a'"
+ f.puts "gem 'b'"
+ f.puts "gem 'c'"
+ end
+
+ ENV['RUBYGEMS_GEMDEPS'] = "-"
+
+ assert_equal [a,b,c], Gem.detect_gemdeps.sort_by { |s| s.name }
+ end
+
+ LIB_PATH = File.expand_path "../../../lib".untaint, __FILE__.untaint
+
+ def test_looks_for_gemdeps_files_automatically_on_start
+ util_clear_gems
+
+ a = new_spec "a", "1", nil, "lib/a.rb"
+ b = new_spec "b", "1", nil, "lib/b.rb"
+ c = new_spec "c", "1", nil, "lib/c.rb"
+
+ install_specs a, b, c
+
+ path = File.join @tempdir, "gem.deps.rb"
+
+ File.open path, "w" do |f|
+ f.puts "gem 'a'"
+ f.puts "gem 'b'"
+ f.puts "gem 'c'"
+ end
+
+ path = File.join(@tempdir, "gd-tmp")
+ install_gem a, :install_dir => path
+ install_gem b, :install_dir => path
+ install_gem c, :install_dir => path
+
+ ENV['GEM_PATH'] = path
+ ENV['RUBYGEMS_GEMDEPS'] = "-"
+
+ out = `#{Gem.ruby.dup.untaint} -I #{LIB_PATH.untaint} -rubygems -e "p Gem.loaded_specs.values.map(&:full_name).sort"`
+
+ assert_equal '["a-1", "b-1", "c-1"]', out.strip
+ end
+
+ def test_looks_for_gemdeps_files_automatically_on_start_in_parent_dir
+ util_clear_gems
+
+ a = new_spec "a", "1", nil, "lib/a.rb"
+ b = new_spec "b", "1", nil, "lib/b.rb"
+ c = new_spec "c", "1", nil, "lib/c.rb"
+
+ install_specs a, b, c
+
+ path = File.join @tempdir, "gem.deps.rb"
+
+ File.open path, "w" do |f|
+ f.puts "gem 'a'"
+ f.puts "gem 'b'"
+ f.puts "gem 'c'"
+ end
+
+ path = File.join(@tempdir, "gd-tmp")
+ install_gem a, :install_dir => path
+ install_gem b, :install_dir => path
+ install_gem c, :install_dir => path
+
+ ENV['GEM_PATH'] = path
+ ENV['RUBYGEMS_GEMDEPS'] = "-"
+
+ Dir.mkdir "sub1"
+ out = Dir.chdir "sub1" do
+ `#{Gem.ruby.dup.untaint} -I #{LIB_PATH.untaint} -rubygems -e "p Gem.loaded_specs.values.map(&:full_name).sort"`
+ end
+
+ Dir.rmdir "sub1"
+
+ assert_equal '["a-1", "b-1", "c-1"]', out.strip
+ end
+
+ def test_register_default_spec
+ Gem.clear_default_specs
+
+ old_style = Gem::Specification.new do |spec|
+ spec.files = ["foo.rb", "bar.rb"]
+ end
+
+ Gem.register_default_spec old_style
+
+ assert_equal old_style, Gem.find_unresolved_default_spec("foo.rb")
+ assert_equal old_style, Gem.find_unresolved_default_spec("bar.rb")
+ assert_equal nil, Gem.find_unresolved_default_spec("baz.rb")
+
+ Gem.clear_default_specs
+
+ new_style = Gem::Specification.new do |spec|
+ spec.files = ["lib/foo.rb", "ext/bar.rb", "bin/exec", "README"]
+ spec.require_paths = ["lib", "ext"]
+ end
+
+ Gem.register_default_spec new_style
+
+ assert_equal new_style, Gem.find_unresolved_default_spec("foo.rb")
+ assert_equal new_style, Gem.find_unresolved_default_spec("bar.rb")
+ assert_equal nil, Gem.find_unresolved_default_spec("exec")
+ assert_equal nil, Gem.find_unresolved_default_spec("README")
+ end
+
+ def test_default_gems_use_full_paths
+ begin
+ if defined?(RUBY_ENGINE) then
+ engine = RUBY_ENGINE
+ Object.send :remove_const, :RUBY_ENGINE
+ end
+ Object.const_set :RUBY_ENGINE, 'ruby'
+
+ refute Gem.default_gems_use_full_paths?
+ ensure
+ Object.send :remove_const, :RUBY_ENGINE
+ Object.const_set :RUBY_ENGINE, engine if engine
+ end
+
+ begin
+ if defined?(RUBY_ENGINE) then
+ engine = RUBY_ENGINE
+ Object.send :remove_const, :RUBY_ENGINE
+ end
+ Object.const_set :RUBY_ENGINE, 'jruby'
+ assert Gem.default_gems_use_full_paths?
+ ensure
+ Object.send :remove_const, :RUBY_ENGINE
+ Object.const_set :RUBY_ENGINE, engine if engine
+ end
+ end
+
+ def test_use_gemdeps
+ rubygems_gemdeps, ENV['RUBYGEMS_GEMDEPS'] = ENV['RUBYGEMS_GEMDEPS'], nil
+
+ spec = util_spec 'a', 1
+
+ refute spec.activated?
+
+ open 'Gemfile', 'w' do |io|
+ io.write 'gem "a"'
+ end
+
+ Gem.use_gemdeps
+
+ refute spec.activated?
+ ensure
+ ENV['RUBYGEMS_GEMDEPS'] = rubygems_gemdeps
+ end
+
+ def test_use_gemdeps_automatic
+ rubygems_gemdeps, ENV['RUBYGEMS_GEMDEPS'] = ENV['RUBYGEMS_GEMDEPS'], '-'
+
+ spec = util_spec 'a', 1
+
+ refute spec.activated?
+
+ open 'Gemfile', 'w' do |io|
+ io.write 'gem "a"'
+ end
+
+ Gem.use_gemdeps
+
+ assert spec.activated?
+ ensure
+ ENV['RUBYGEMS_GEMDEPS'] = rubygems_gemdeps
+ end
+
+ def test_use_gemdeps_disabled
+ rubygems_gemdeps, ENV['RUBYGEMS_GEMDEPS'] = ENV['RUBYGEMS_GEMDEPS'], ''
+
+ spec = util_spec 'a', 1
+
+ refute spec.activated?
+
+ open 'Gemfile', 'w' do |io|
+ io.write 'gem "a"'
+ end
+
+ Gem.use_gemdeps
+
+ refute spec.activated?
+ ensure
+ ENV['RUBYGEMS_GEMDEPS'] = rubygems_gemdeps
+ end
+
+ def test_use_gemdeps_specific
+ rubygems_gemdeps, ENV['RUBYGEMS_GEMDEPS'] = ENV['RUBYGEMS_GEMDEPS'], 'x'
+
+ spec = util_spec 'a', 1
+
+ refute spec.activated?
+
+ open 'x', 'w' do |io|
+ io.write 'gem "a"'
+ end
+
+ Gem.use_gemdeps
+
+ assert spec.activated?
+ ensure
+ ENV['RUBYGEMS_GEMDEPS'] = rubygems_gemdeps
+ end
+
def with_plugin(path)
test_plugin_path = File.expand_path("test/rubygems/plugin/#{path}",
@@project_dir)
@@ -1230,7 +1345,7 @@ class TestGem < Gem::TestCase
end
def util_exec_gem
- spec, _ = quick_spec 'a', '4' do |s|
+ spec, _ = util_spec 'a', '4' do |s|
s.executables = ['exec', 'abin']
end
@@ -1278,4 +1393,3 @@ class TestGem < Gem::TestCase
File.join Gem.dir, "cache"
end
end
-
diff --git a/test/rubygems/test_gem_available_set.rb b/test/rubygems/test_gem_available_set.rb
new file mode 100644
index 0000000000..47023b2b11
--- /dev/null
+++ b/test/rubygems/test_gem_available_set.rb
@@ -0,0 +1,106 @@
+require 'rubygems/test_case'
+require 'rubygems/available_set'
+require 'rubygems/security'
+
+class TestGemAvailableSet < Gem::TestCase
+ def setup
+ super
+
+ @source = Gem::Source.new(@gem_repo)
+ end
+
+ def test_add_and_empty
+ a1, _ = util_gem 'a', '1'
+
+ set = Gem::AvailableSet.new
+ assert set.empty?
+
+ set.add a1, @source
+
+ refute set.empty?
+
+ assert_equal [a1], set.all_specs
+ end
+
+ def test_match_platform
+ a1, _ = util_gem 'a', '1' do |g|
+ g.platform = "something-weird-yep"
+ end
+
+ a1c, _ = util_gem 'a', '2' do |g|
+ g.platform = Gem::Platform.local
+ end
+
+ a2, _ = util_gem 'a', '2'
+
+ set = Gem::AvailableSet.new
+ set.add a1, @source
+ set.add a1c, @source
+ set.add a2, @source
+
+ set.match_platform!
+
+ assert_equal [a1c, a2], set.all_specs
+ end
+
+ def test_best
+ a1, _ = util_gem 'a', '1'
+ a2, _ = util_gem 'a', '2'
+
+ set = Gem::AvailableSet.new
+ set.add a1, @source
+ set.add a2, @source
+
+ set.pick_best!
+
+ assert_equal [a2], set.all_specs
+ end
+
+ def test_remove_installed_bang
+ a1, _ = util_gem 'a', '1'
+
+ a1.activate
+
+ set = Gem::AvailableSet.new
+ set.add a1, @source
+
+ dep = Gem::Dependency.new "a", ">= 0"
+
+ set.remove_installed! dep
+
+ assert set.empty?
+ end
+
+ def test_sorted_normal_versions
+ a1, _ = util_gem 'a', '1'
+ a2, _ = util_gem 'a', '2'
+
+ set = Gem::AvailableSet.new
+ set.add a1, @source
+ set.add a2, @source
+
+ g = set.sorted
+
+ assert_equal a2, g[0].spec
+ assert_equal a1, g[1].spec
+ end
+
+ def test_sorted_respect_pre
+ a1a, _ = util_gem 'a', '1.a'
+ a1, _ = util_gem 'a', '1'
+ a2a, _ = util_gem 'a', '2.a'
+ a2, _ = util_gem 'a', '2'
+ a3a, _ = util_gem 'a', '3.a'
+
+ set = Gem::AvailableSet.new
+ set.add a1, @source
+ set.add a1a, @source
+ set.add a3a, @source
+ set.add a2a, @source
+ set.add a2, @source
+
+ g = set.sorted.map { |t| t.spec }
+
+ assert_equal [a3a, a2, a2a, a1, a1a], g
+ end
+end
diff --git a/test/rubygems/test_gem_builder.rb b/test/rubygems/test_gem_builder.rb
deleted file mode 100644
index 0b4b972367..0000000000
--- a/test/rubygems/test_gem_builder.rb
+++ /dev/null
@@ -1,44 +0,0 @@
-require 'rubygems/test_case'
-require 'rubygems/builder'
-require 'rubygems/package'
-
-class TestGemBuilder < Gem::TestCase
-
- def test_build
- builder = Gem::Builder.new quick_spec('a')
-
- use_ui @ui do
- Dir.chdir @tempdir do
- builder.build
- end
- end
-
- assert_match %r|Successfully built RubyGem\n Name: a|, @ui.output
- end
-
- def test_build_validates
- builder = Gem::Builder.new Gem::Specification.new
-
- assert_raises Gem::InvalidSpecificationException do
- builder.build
- end
- end
-
- def test_build_specification_result
- util_make_gems
-
- spec = build_gem_and_yield_spec @a1
-
- assert_operator @a1, :eql?, spec
- end
-
- def build_gem_and_yield_spec(spec)
- builder = Gem::Builder.new spec
-
- spec = Dir.chdir @tempdir do
- FileUtils.mkdir 'lib'
- File.open('lib/code.rb', 'w') { |f| f << "something" }
- Gem::Package.open(File.open(builder.build, 'rb')) { |x| x.metadata }
- end
- end
-end
diff --git a/test/rubygems/test_gem_command.rb b/test/rubygems/test_gem_command.rb
index 037640890c..712259c6cd 100644
--- a/test/rubygems/test_gem_command.rb
+++ b/test/rubygems/test_gem_command.rb
@@ -109,6 +109,16 @@ class TestGemCommand < Gem::TestCase
assert @xopt, "Should have done xopt"
end
+ def test_invoke_with_build_args
+ @cmd.when_invoked { true }
+
+ use_ui @ui do
+ @cmd.invoke_with_build_args ["-x"], ["--awesome=true"]
+ end
+
+ assert_equal ["--awesome=true"], @cmd.options[:build_args]
+ end
+
# Returning false from the command handler invokes the usage output.
def test_invoke_with_help
done = false
diff --git a/test/rubygems/test_gem_command_manager.rb b/test/rubygems/test_gem_command_manager.rb
index 6cb253d386..f6433c5cc3 100644
--- a/test/rubygems/test_gem_command_manager.rb
+++ b/test/rubygems/test_gem_command_manager.rb
@@ -6,7 +6,47 @@ class TestGemCommandManager < Gem::TestCase
def setup
super
- @command_manager = Gem::CommandManager.instance
+ @command_manager = Gem::CommandManager.new
+ end
+
+ def test_find_command
+ command = @command_manager.find_command 'install'
+
+ assert_kind_of Gem::Commands::InstallCommand, command
+
+ command = @command_manager.find_command 'ins'
+
+ assert_kind_of Gem::Commands::InstallCommand, command
+ end
+
+ def test_find_command_ambiguous
+ e = assert_raises Gem::CommandLineError do
+ @command_manager.find_command 'u'
+ end
+
+ assert_equal 'Ambiguous command u matches [uninstall, unpack, update]',
+ e.message
+ end
+
+ def test_find_command_ambiguous_exact
+ ins_command = Class.new
+ Gem::Commands.send :const_set, :InsCommand, ins_command
+
+ @command_manager.register_command :ins
+
+ command = @command_manager.find_command 'ins'
+
+ assert_kind_of ins_command, command
+ ensure
+ Gem::Commands.send :remove_const, :InsCommand
+ end
+
+ def test_find_command_unknown
+ e = assert_raises Gem::CommandLineError do
+ @command_manager.find_command 'xyz'
+ end
+
+ assert_equal 'Unknown command xyz', e.message
end
def test_run_interrupt
@@ -14,9 +54,11 @@ class TestGemCommandManager < Gem::TestCase
$: << File.expand_path("test/rubygems", @@project_dir)
Gem.load_env_plugins
+ @command_manager.register_command :interrupt
+
use_ui @ui do
assert_raises Gem::MockGemUi::TermError do
- @command_manager.run 'interrupt'
+ @command_manager.run %w[interrupt]
end
assert_equal '', ui.output
assert_equal "ERROR: Interrupted\n", ui.error
@@ -33,7 +75,7 @@ class TestGemCommandManager < Gem::TestCase
@command_manager.register_command :crash
use_ui @ui do
assert_raises Gem::MockGemUi::TermError do
- @command_manager.run 'crash'
+ @command_manager.run %w[crash]
end
assert_equal '', ui.output
err = ui.error.split("\n").first
@@ -47,13 +89,14 @@ class TestGemCommandManager < Gem::TestCase
def test_process_args_bad_arg
use_ui @ui do
assert_raises Gem::MockGemUi::TermError do
- @command_manager.process_args("--bad-arg")
+ @command_manager.process_args %w[--bad-arg]
end
end
assert_match(/invalid option: --bad-arg/i, @ui.error)
end
+ # HACK move to install command test
def test_process_args_install
#capture all install options
use_ui @ui do
@@ -64,8 +107,8 @@ class TestGemCommandManager < Gem::TestCase
end
#check defaults
- @command_manager.process_args("install")
- assert_equal true, check_options[:generate_rdoc]
+ @command_manager.process_args %w[install]
+ assert_equal %w[ri], check_options[:document].sort
assert_equal false, check_options[:force]
assert_equal :both, check_options[:domain]
assert_equal true, check_options[:wrappers]
@@ -75,9 +118,11 @@ class TestGemCommandManager < Gem::TestCase
#check settings
check_options = nil
- @command_manager.process_args(
- "install --force --local --rdoc --install-dir . --version 3.0 --no-wrapper --bindir . ")
- assert_equal true, check_options[:generate_rdoc]
+ @command_manager.process_args %w[
+ install --force --local --rdoc --install-dir .
+ --version 3.0 --no-wrapper --bindir .
+ ]
+ assert_equal %w[rdoc ri], check_options[:document].sort
assert_equal true, check_options[:force]
assert_equal :local, check_options[:domain]
assert_equal false, check_options[:wrappers]
@@ -87,21 +132,22 @@ class TestGemCommandManager < Gem::TestCase
#check remote domain
check_options = nil
- @command_manager.process_args("install --remote")
+ @command_manager.process_args %w[install --remote]
assert_equal :remote, check_options[:domain]
#check both domain
check_options = nil
- @command_manager.process_args("install --both")
+ @command_manager.process_args %w[install --both]
assert_equal :both, check_options[:domain]
#check both domain
check_options = nil
- @command_manager.process_args("install --both")
+ @command_manager.process_args %w[install --both]
assert_equal :both, check_options[:domain]
end
end
+ # HACK move to uninstall command test
def test_process_args_uninstall
#capture all uninstall options
check_options = nil
@@ -111,16 +157,17 @@ class TestGemCommandManager < Gem::TestCase
end
#check defaults
- @command_manager.process_args("uninstall")
+ @command_manager.process_args %w[uninstall]
assert_equal Gem::Requirement.default, check_options[:version]
#check settings
check_options = nil
- @command_manager.process_args("uninstall foobar --version 3.0")
+ @command_manager.process_args %w[uninstall foobar --version 3.0]
assert_equal "foobar", check_options[:args].first
assert_equal Gem::Requirement.new('3.0'), check_options[:version]
end
+ # HACK move to check command test
def test_process_args_check
#capture all check options
check_options = nil
@@ -130,17 +177,16 @@ class TestGemCommandManager < Gem::TestCase
end
#check defaults
- @command_manager.process_args("check")
- assert_equal false, check_options[:verify]
- assert_equal false, check_options[:alien]
+ @command_manager.process_args %w[check]
+ assert_equal true, check_options[:alien]
#check settings
check_options = nil
- @command_manager.process_args("check --verify foobar --alien")
- assert_equal "foobar", check_options[:verify]
+ @command_manager.process_args %w[check foobar --alien]
assert_equal true, check_options[:alien]
end
+ # HACK move to build command test
def test_process_args_build
#capture all build options
check_options = nil
@@ -150,15 +196,16 @@ class TestGemCommandManager < Gem::TestCase
end
#check defaults
- @command_manager.process_args("build")
+ @command_manager.process_args %w[build]
#NOTE: Currently no defaults
#check settings
check_options = nil
- @command_manager.process_args("build foobar.rb")
+ @command_manager.process_args %w[build foobar.rb]
assert_equal 'foobar.rb', check_options[:args].first
end
+ # HACK move to query command test
def test_process_args_query
#capture all query options
check_options = nil
@@ -168,29 +215,30 @@ class TestGemCommandManager < Gem::TestCase
end
#check defaults
- @command_manager.process_args("query")
+ @command_manager.process_args %w[query]
assert_equal(//, check_options[:name])
assert_equal :local, check_options[:domain]
assert_equal false, check_options[:details]
#check settings
check_options = nil
- @command_manager.process_args("query --name foobar --local --details")
+ @command_manager.process_args %w[query --name foobar --local --details]
assert_equal(/foobar/i, check_options[:name])
assert_equal :local, check_options[:domain]
assert_equal true, check_options[:details]
#remote domain
check_options = nil
- @command_manager.process_args("query --remote")
+ @command_manager.process_args %w[query --remote]
assert_equal :remote, check_options[:domain]
#both (local/remote) domains
check_options = nil
- @command_manager.process_args("query --both")
+ @command_manager.process_args %w[query --both]
assert_equal :both, check_options[:domain]
end
+ # HACK move to update command test
def test_process_args_update
#capture all update options
check_options = nil
@@ -200,13 +248,13 @@ class TestGemCommandManager < Gem::TestCase
end
#check defaults
- @command_manager.process_args("update")
- assert_equal true, check_options[:generate_rdoc]
+ @command_manager.process_args %w[update]
+ assert_includes check_options[:document], 'rdoc'
#check settings
check_options = nil
- @command_manager.process_args("update --force --rdoc --install-dir .")
- assert_equal true, check_options[:generate_rdoc]
+ @command_manager.process_args %w[update --force --rdoc --install-dir .]
+ assert_includes check_options[:document], 'ri'
assert_equal true, check_options[:force]
assert_equal Dir.pwd, check_options[:install_dir]
end
diff --git a/test/rubygems/test_gem_commands_build_command.rb b/test/rubygems/test_gem_commands_build_command.rb
index 5d374542ba..5f870c0765 100644
--- a/test/rubygems/test_gem_commands_build_command.rb
+++ b/test/rubygems/test_gem_commands_build_command.rb
@@ -1,13 +1,13 @@
require 'rubygems/test_case'
require 'rubygems/commands/build_command'
-require 'rubygems/format'
+require 'rubygems/package'
class TestGemCommandsBuildCommand < Gem::TestCase
def setup
super
- @gem = quick_spec 'some_gem' do |s|
+ @gem = util_spec 'some_gem' do |s|
s.rubyforge_project = 'example'
end
@@ -24,16 +24,6 @@ class TestGemCommandsBuildCommand < Gem::TestCase
util_test_build_gem @gem, gemspec_file
end
- def test_execute_yaml
- gemspec_file = File.join(@tempdir, @gem.spec_name)
-
- File.open gemspec_file, 'w' do |gs|
- gs.write @gem.to_yaml
- end
-
- util_test_build_gem @gem, gemspec_file
- end
-
def test_execute_bad_spec
@gem.date = "2010-11-08"
@@ -72,7 +62,7 @@ class TestGemCommandsBuildCommand < Gem::TestCase
assert_equal "ERROR: Gemspec file not found: some_gem\n", @ui.error
end
- def util_test_build_gem(gem, gemspec_file)
+ def util_test_build_gem(gem, gemspec_file, check_licenses=true)
@cmd.options[:args] = [gemspec_file]
use_ui @ui do
@@ -87,32 +77,34 @@ class TestGemCommandsBuildCommand < Gem::TestCase
assert_equal " Version: 2", output.shift
assert_equal " File: some_gem-2.gem", output.shift
assert_equal [], output
- assert_equal '', @ui.error
+
+ if check_licenses
+ assert_match "WARNING: licenses is empty", @ui.error
+ end
gem_file = File.join @tempdir, File.basename(gem.cache_file)
assert File.exist?(gem_file)
- spec = Gem::Format.from_file_by_path(gem_file).spec
+ spec = Gem::Package.new(gem_file).spec
assert_equal "some_gem", spec.name
assert_equal "this is a summary", spec.summary
end
def test_execute_force
- @gem.instance_variable_set :@required_rubygems_version, nil
-
gemspec_file = File.join(@tempdir, @gem.spec_name)
+ @gem.send :remove_instance_variable, :@rubygems_version
+
File.open gemspec_file, 'w' do |gs|
- gs.write @gem.to_yaml
+ gs.write @gem.to_ruby
end
@cmd.options[:args] = [gemspec_file]
@cmd.options[:force] = true
- util_test_build_gem @gem, gemspec_file
+ util_test_build_gem @gem, gemspec_file, false
end
-
end
diff --git a/test/rubygems/test_gem_commands_cert_command.rb b/test/rubygems/test_gem_commands_cert_command.rb
index 609fae8884..a158a4442b 100644
--- a/test/rubygems/test_gem_commands_cert_command.rb
+++ b/test/rubygems/test_gem_commands_cert_command.rb
@@ -2,124 +2,668 @@ require 'rubygems/test_case'
require 'rubygems/commands/cert_command'
require 'rubygems/fix_openssl_warnings' if RUBY_VERSION < "1.9"
-unless defined? OpenSSL then
- warn "`gem cert` tests are being skipped, module OpenSSL not found"
+unless defined?(OpenSSL::SSL) then
+ warn 'Skipping `gem cert` tests. openssl not found.'
end
class TestGemCommandsCertCommand < Gem::TestCase
+ ALTERNATE_CERT = load_cert 'alternate'
+
+ ALTERNATE_KEY_FILE = key_path 'alternate'
+ PRIVATE_KEY_FILE = key_path 'private'
+ PUBLIC_KEY_FILE = key_path 'public'
+
+ ALTERNATE_CERT_FILE = cert_path 'alternate'
+ CHILD_CERT_FILE = cert_path 'child'
+ PUBLIC_CERT_FILE = cert_path 'public'
+
def setup
super
- @orig_security_trust_dir = Gem::Security::OPT[:trust_dir]
- Gem::Security::OPT[:trust_dir] = @tempdir
-
@cmd = Gem::Commands::CertCommand.new
- root = File.expand_path(File.dirname(__FILE__), @@project_dir)
+ @trust_dir = Gem::Security.trust_dir
+ end
+
+ def test_certificates_matching
+ @trust_dir.trust_cert PUBLIC_CERT
+ @trust_dir.trust_cert ALTERNATE_CERT
+
+ matches = @cmd.certificates_matching ''
+
+ # HACK OpenSSL::X509::Certificate#== is Object#==, so do this the hard way
+ match = matches.next
+ assert_equal ALTERNATE_CERT.to_pem, match.first.to_pem
+ assert_equal @trust_dir.cert_path(ALTERNATE_CERT), match.last
- FileUtils.cp File.join(root, 'data', 'gem-private_key.pem'), @tempdir
- FileUtils.cp File.join(root, 'data', 'gem-public_cert.pem'), @tempdir
+ match = matches.next
+ assert_equal PUBLIC_CERT.to_pem, match.first.to_pem
+ assert_equal @trust_dir.cert_path(PUBLIC_CERT), match.last
- @cert_file_name = File.join @tempdir, 'gem-public_cert.pem'
- @pkey_file_name = File.join @tempdir, 'gem-private_key.pem'
+ assert_raises StopIteration do
+ matches.next
+ end
end
- def teardown
- Gem::Security::OPT[:trust_dir] = @orig_security_trust_dir
+ def test_certificates_matching_filter
+ @trust_dir.trust_cert PUBLIC_CERT
+ @trust_dir.trust_cert ALTERNATE_CERT
- super
+ matches = @cmd.certificates_matching 'alternate'
+
+ match = matches.next
+ assert_equal ALTERNATE_CERT.to_pem, match.first.to_pem
+ assert_equal @trust_dir.cert_path(ALTERNATE_CERT), match.last
+
+ assert_raises StopIteration do
+ matches.next
+ end
end
def test_execute_add
+ @cmd.handle_options %W[--add #{PUBLIC_CERT_FILE}]
+
use_ui @ui do
- @cmd.send :handle_options, %W[--add #{@cert_file_name}]
+ @cmd.execute
end
- assert_equal "Added '/CN=rubygems/DC=example/DC=com'\n", @ui.output
- assert_equal '', @ui.error
+ cert_path = @trust_dir.cert_path PUBLIC_CERT
+
+ assert_path_exists cert_path
+
+ assert_equal "Added '/CN=nobody/DC=example'\n", @ui.output
+ assert_empty @ui.error
end
- def test_execute_build
- FileUtils.rm @cert_file_name
- FileUtils.rm @pkey_file_name
+ def test_execute_add_twice
+ self.class.cert_path 'alternate'
+
+ @cmd.handle_options %W[
+ --add #{PUBLIC_CERT_FILE}
+ --add #{ALTERNATE_CERT_FILE}
+ ]
use_ui @ui do
- Dir.chdir @tempdir do
- @cmd.send :handle_options, %W[--build nobody@example.com]
+ @cmd.execute
+ end
+
+ expected = <<-EXPECTED
+Added '/CN=nobody/DC=example'
+Added '/CN=alternate/DC=example'
+ EXPECTED
+
+ assert_equal expected, @ui.output
+ assert_empty @ui.error
+ end
+
+ def test_execute_build
+ passphrase = 'Foo bar'
+
+ @cmd.handle_options %W[--build nobody@example.com]
+
+ @build_ui = Gem::MockGemUi.new "#{passphrase}\n#{passphrase}"
+
+ use_ui @build_ui do
+ @cmd.execute
+ end
+
+ output = @build_ui.output.split "\n"
+
+ assert_equal "Passphrase for your Private Key: ",
+ output.shift
+ assert_equal "Please repeat the passphrase for your Private Key: ",
+ output.shift
+ assert_equal "Certificate: #{File.join @tempdir, 'gem-public_cert.pem'}",
+ output.shift
+ assert_equal "Private Key: #{File.join @tempdir, 'gem-private_key.pem'}",
+ output.shift
+
+ assert_equal "Don't forget to move the key file to somewhere private!",
+ output.shift
+
+ assert_empty output
+ assert_empty @build_ui.error
+
+ assert_path_exists File.join(@tempdir, 'gem-private_key.pem')
+ assert_path_exists File.join(@tempdir, 'gem-public_cert.pem')
+ end
+
+ def test_execute_build_bad_passphrase_confirmation
+ passphrase = 'Foo bar'
+ passphrase_confirmation = 'Fu bar'
+
+ @cmd.handle_options %W[--build nobody@example.com]
+
+ @build_ui = Gem::MockGemUi.new "#{passphrase}\n#{passphrase_confirmation}"
+
+ use_ui @build_ui do
+ e = assert_raises Gem::CommandLineError do
+ @cmd.execute
end
+
+ output = @build_ui.output.split "\n"
+
+ assert_equal "Passphrase for your Private Key: ",
+ output.shift
+ assert_equal "Please repeat the passphrase for your Private Key: ",
+ output.shift
+
+ assert_empty output
+
+ assert_equal "Passphrase and passphrase confirmation don't match",
+ e.message
+
+ end
+
+ refute_path_exists File.join(@tempdir, 'gem-private_key.pem')
+ refute_path_exists File.join(@tempdir, 'gem-public_cert.pem')
+ end
+
+ def test_execute_build_key
+ @cmd.handle_options %W[
+ --build nobody@example.com
+ --private-key #{PRIVATE_KEY_FILE}
+ ]
+
+ use_ui @ui do
+ @cmd.execute
end
output = @ui.output.split "\n"
- assert_equal 'Public Cert: gem-public_cert.pem', output.shift
- assert_equal 'Private Key: gem-private_key.pem', output.shift
- assert_equal 'Don\'t forget to move the key file to somewhere private...',
+ assert_equal "Certificate: #{File.join @tempdir, 'gem-public_cert.pem'}",
output.shift
- assert_equal [], output
- assert_equal '', @ui.error
+ assert_empty output
+ assert_empty @ui.error
- assert File.exist?(File.join(@tempdir, 'gem-private_key.pem'))
- assert File.exist?(File.join(@tempdir, 'gem-public_cert.pem'))
+ assert_path_exists File.join(@tempdir, 'gem-public_cert.pem')
+ end
+
+ def test_execute_build_encrypted_key
+ @cmd.handle_options %W[
+ --build nobody@example.com
+ --private-key #{ENCRYPTED_PRIVATE_KEY_PATH}
+ ]
+
+ use_ui @ui do
+ @cmd.execute
+ end
+
+ output = @ui.output.split "\n"
+
+ assert_equal "Certificate: #{File.join @tempdir, 'gem-public_cert.pem'}",
+ output.shift
+
+ assert_empty output
+ assert_empty @ui.error
+
+ assert_path_exists File.join(@tempdir, 'gem-public_cert.pem')
end
def test_execute_certificate
use_ui @ui do
- @cmd.send :handle_options, %W[--certificate #{@cert_file_name}]
+ @cmd.handle_options %W[--certificate #{PUBLIC_CERT_FILE}]
end
assert_equal '', @ui.output
assert_equal '', @ui.error
- assert_equal File.read(@cert_file_name),
- @cmd.options[:issuer_cert].to_s
+ assert_equal PUBLIC_CERT.to_pem, @cmd.options[:issuer_cert].to_pem
end
def test_execute_list
+ @trust_dir.trust_cert PUBLIC_CERT
+ @trust_dir.trust_cert ALTERNATE_CERT
+
+ @cmd.handle_options %W[--list]
+
use_ui @ui do
- @cmd.send :handle_options, %W[--list]
+ @cmd.execute
end
- assert_equal "/CN=rubygems/DC=example/DC=com\n", @ui.output
- assert_equal '', @ui.error
+ assert_equal "/CN=alternate/DC=example\n/CN=nobody/DC=example\n",
+ @ui.output
+ assert_empty @ui.error
+ end
+
+ def test_execute_list_filter
+ @trust_dir.trust_cert PUBLIC_CERT
+ @trust_dir.trust_cert ALTERNATE_CERT
+
+ @cmd.handle_options %W[--list nobody]
+
+ use_ui @ui do
+ @cmd.execute
+ end
+
+ assert_equal "/CN=nobody/DC=example\n", @ui.output
+ assert_empty @ui.error
end
def test_execute_private_key
use_ui @ui do
- @cmd.send :handle_options, %W[--private-key #{@pkey_file_name}]
+ @cmd.send :handle_options, %W[--private-key #{PRIVATE_KEY_FILE}]
+ end
+
+ assert_equal '', @ui.output
+ assert_equal '', @ui.error
+
+ assert_equal PRIVATE_KEY.to_pem, @cmd.options[:key].to_pem
+ end
+
+ def test_execute_encrypted_private_key
+ use_ui @ui do
+ @cmd.send :handle_options, %W[--private-key #{ENCRYPTED_PRIVATE_KEY_PATH}]
end
assert_equal '', @ui.output
assert_equal '', @ui.error
- assert_equal File.read(@pkey_file_name),
- @cmd.options[:issuer_key].to_s
+ assert_equal ENCRYPTED_PRIVATE_KEY.to_pem, @cmd.options[:key].to_pem
end
def test_execute_remove
+ @trust_dir.trust_cert PUBLIC_CERT
+
+ cert_path = @trust_dir.cert_path PUBLIC_CERT
+
+ assert_path_exists cert_path
+
+ @cmd.handle_options %W[--remove nobody]
+
use_ui @ui do
- @cmd.send :handle_options, %W[--remove rubygems]
+ @cmd.execute
end
- assert_equal "Removed '/CN=rubygems/DC=example/DC=com'\n", @ui.output
+ assert_equal "Removed '/CN=nobody/DC=example'\n", @ui.output
assert_equal '', @ui.error
- refute File.exist?(@cert_file_name)
+ refute_path_exists cert_path
+ end
+
+ def test_execute_remove_multiple
+ @trust_dir.trust_cert PUBLIC_CERT
+ @trust_dir.trust_cert ALTERNATE_CERT
+
+ public_path = @trust_dir.cert_path PUBLIC_CERT
+ alternate_path = @trust_dir.cert_path ALTERNATE_CERT
+
+ assert_path_exists public_path
+ assert_path_exists alternate_path
+
+ @cmd.handle_options %W[--remove example]
+
+ use_ui @ui do
+ @cmd.execute
+ end
+
+ expected = <<-EXPECTED
+Removed '/CN=alternate/DC=example'
+Removed '/CN=nobody/DC=example'
+ EXPECTED
+
+ assert_equal expected, @ui.output
+ assert_equal '', @ui.error
+
+ refute_path_exists public_path
+ refute_path_exists alternate_path
+ end
+
+ def test_execute_remove_twice
+ @trust_dir.trust_cert PUBLIC_CERT
+ @trust_dir.trust_cert ALTERNATE_CERT
+
+ public_path = @trust_dir.cert_path PUBLIC_CERT
+ alternate_path = @trust_dir.cert_path ALTERNATE_CERT
+
+ assert_path_exists public_path
+ assert_path_exists alternate_path
+
+ @cmd.handle_options %W[--remove nobody --remove alternate]
+
+ use_ui @ui do
+ @cmd.execute
+ end
+
+ expected = <<-EXPECTED
+Removed '/CN=nobody/DC=example'
+Removed '/CN=alternate/DC=example'
+ EXPECTED
+
+ assert_equal expected, @ui.output
+ assert_equal '', @ui.error
+
+ refute_path_exists public_path
+ refute_path_exists alternate_path
end
def test_execute_sign
+ path = File.join @tempdir, 'cert.pem'
+ Gem::Security.write ALTERNATE_CERT, path, 0600
+
+ assert_equal '/CN=alternate/DC=example', ALTERNATE_CERT.issuer.to_s
+
+ @cmd.handle_options %W[
+ --private-key #{PRIVATE_KEY_FILE}
+ --certificate #{PUBLIC_CERT_FILE}
+
+ --sign #{path}
+ ]
+
use_ui @ui do
- @cmd.send :handle_options, %W[
- -K #{@pkey_file_name} -C #{@cert_file_name} --sign #{@cert_file_name}
- ]
+ @cmd.execute
end
assert_equal '', @ui.output
assert_equal '', @ui.error
- # HACK this test sucks
+ cert = OpenSSL::X509::Certificate.new File.read path
+
+ assert_equal '/CN=nobody/DC=example', cert.issuer.to_s
+
+ mask = 0100600 & (~File.umask)
+
+ assert_equal mask, File.stat(path).mode unless win_platform?
+ end
+
+ def test_execute_sign_encrypted_key
+ path = File.join @tempdir, 'cert.pem'
+ Gem::Security.write ALTERNATE_CERT, path, 0600
+
+ assert_equal '/CN=alternate/DC=example', ALTERNATE_CERT.issuer.to_s
+
+ @cmd.handle_options %W[
+ --private-key #{ENCRYPTED_PRIVATE_KEY_PATH}
+ --certificate #{PUBLIC_CERT_FILE}
+
+ --sign #{path}
+ ]
+
+ use_ui @ui do
+ @cmd.execute
+ end
+
+ assert_equal '', @ui.output
+ assert_equal '', @ui.error
+
+ cert = OpenSSL::X509::Certificate.new File.read path
+
+ assert_equal '/CN=nobody/DC=example', cert.issuer.to_s
+
+ mask = 0100600 & (~File.umask)
+
+ assert_equal mask, File.stat(path).mode unless win_platform?
+ end
+
+ def test_execute_sign_default
+ FileUtils.mkdir_p File.join Gem.user_home, '.gem'
+
+ private_key_path = File.join Gem.user_home, '.gem', 'gem-private_key.pem'
+ Gem::Security.write PRIVATE_KEY, private_key_path
+
+ public_cert_path = File.join Gem.user_home, '.gem', 'gem-public_cert.pem'
+ Gem::Security.write PUBLIC_CERT, public_cert_path
+
+ path = File.join @tempdir, 'cert.pem'
+ Gem::Security.write ALTERNATE_CERT, path, 0600
+
+ assert_equal '/CN=alternate/DC=example', ALTERNATE_CERT.issuer.to_s
+
+ @cmd.handle_options %W[--sign #{path}]
+
+ use_ui @ui do
+ @cmd.execute
+ end
+
+ assert_equal '', @ui.output
+ assert_equal '', @ui.error
+
+ cert = OpenSSL::X509::Certificate.new File.read path
+
+ assert_equal '/CN=nobody/DC=example', cert.issuer.to_s
+
+ mask = 0100600 & (~File.umask)
+
+ assert_equal mask, File.stat(path).mode unless win_platform?
+ end
+
+ def test_execute_sign_default_encrypted_key
+ FileUtils.mkdir_p File.join(Gem.user_home, '.gem')
+
+ private_key_path = File.join Gem.user_home, '.gem', 'gem-private_key.pem'
+ Gem::Security.write ENCRYPTED_PRIVATE_KEY, private_key_path, 0600, PRIVATE_KEY_PASSPHRASE
+
+ public_cert_path = File.join Gem.user_home, '.gem', 'gem-public_cert.pem'
+ Gem::Security.write PUBLIC_CERT, public_cert_path
+
+ path = File.join @tempdir, 'cert.pem'
+ Gem::Security.write ALTERNATE_CERT, path, 0600
+
+ assert_equal '/CN=alternate/DC=example', ALTERNATE_CERT.issuer.to_s
+
+ @cmd.handle_options %W[--sign #{path}]
+
+ use_ui @ui do
+ @cmd.execute
+ end
+
+ assert_equal '', @ui.output
+ assert_equal '', @ui.error
+
+ cert = OpenSSL::X509::Certificate.new File.read path
+
+ assert_equal '/CN=nobody/DC=example', cert.issuer.to_s
+
+ mask = 0100600 & (~File.umask)
+
+ assert_equal mask, File.stat(path).mode unless win_platform?
+ end
+
+ def test_execute_sign_no_cert
+ FileUtils.mkdir_p File.join Gem.user_home, '.gem'
+
+ private_key_path = File.join Gem.user_home, '.gem', 'gem-private_key.pem'
+ Gem::Security.write PRIVATE_KEY, private_key_path
+
+ path = File.join @tempdir, 'cert.pem'
+ Gem::Security.write ALTERNATE_CERT, path, 0600
+
+ assert_equal '/CN=alternate/DC=example', ALTERNATE_CERT.issuer.to_s
+
+ @cmd.handle_options %W[--sign #{path}]
+
+ use_ui @ui do
+ assert_raises Gem::MockGemUi::TermError do
+ @cmd.execute
+ end
+ end
+
+ assert_equal '', @ui.output
+
+ expected = <<-EXPECTED
+ERROR: --certificate not specified and ~/.gem/gem-public_cert.pem does not exist
+ EXPECTED
+
+ assert_equal expected, @ui.error
+ end
+
+ def test_execute_sign_no_key
+ FileUtils.mkdir_p File.join Gem.user_home, '.gem'
+
+ public_cert_path = File.join Gem.user_home, '.gem', 'gem-public_cert.pem'
+ Gem::Security.write PUBLIC_CERT, public_cert_path
+
+ path = File.join @tempdir, 'cert.pem'
+ Gem::Security.write ALTERNATE_CERT, path, 0600
+
+ assert_equal '/CN=alternate/DC=example', ALTERNATE_CERT.issuer.to_s
+
+ @cmd.handle_options %W[--sign #{path}]
+
+ use_ui @ui do
+ assert_raises Gem::MockGemUi::TermError do
+ @cmd.execute
+ end
+ end
+
+ assert_equal '', @ui.output
+
+ expected = <<-EXPECTED
+ERROR: --private-key not specified and ~/.gem/gem-private_key.pem does not exist
+ EXPECTED
+
+ assert_equal expected, @ui.error
+ end
+
+ def test_handle_options
+ @cmd.handle_options %W[
+ --add #{PUBLIC_CERT_FILE}
+ --add #{ALTERNATE_CERT_FILE}
+
+ --remove nobody
+ --remove example
+
+ --list
+ --list example
+
+ --build nobody@example
+ --build other@example
+ ]
+
+ assert_equal [PUBLIC_CERT.to_pem, ALTERNATE_CERT.to_pem],
+ @cmd.options[:add].map { |cert| cert.to_pem }
+
+ assert_equal %w[nobody example], @cmd.options[:remove]
+
+ assert_equal %w[nobody@example other@example],
+ @cmd.options[:build].map { |name| name.to_s }
+
+ assert_equal ['', 'example'], @cmd.options[:list]
+ end
+
+ def test_handle_options_add_bad
+ nonexistent = File.join @tempdir, 'nonexistent'
+ e = assert_raises OptionParser::InvalidArgument do
+ @cmd.handle_options %W[--add #{nonexistent}]
+ end
+
+ assert_equal "invalid argument: --add #{nonexistent}: does not exist",
+ e.message
+
+ bad = File.join @tempdir, 'bad'
+ FileUtils.touch bad
+
+ e = assert_raises OptionParser::InvalidArgument do
+ @cmd.handle_options %W[--add #{bad}]
+ end
+
+ assert_equal "invalid argument: --add #{bad}: invalid X509 certificate",
+ e.message
+ end
+
+ def test_handle_options_certificate
+ nonexistent = File.join @tempdir, 'nonexistent'
+ e = assert_raises OptionParser::InvalidArgument do
+ @cmd.handle_options %W[--certificate #{nonexistent}]
+ end
+
+ assert_equal "invalid argument: --certificate #{nonexistent}: does not exist",
+ e.message
+
+ bad = File.join @tempdir, 'bad'
+ FileUtils.touch bad
+
+ e = assert_raises OptionParser::InvalidArgument do
+ @cmd.handle_options %W[--certificate #{bad}]
+ end
+
+ assert_equal "invalid argument: " +
+ "--certificate #{bad}: invalid X509 certificate",
+ e.message
+ end
+
+ def test_handle_options_key_bad
+ nonexistent = File.join @tempdir, 'nonexistent'
+ e = assert_raises OptionParser::InvalidArgument do
+ @cmd.handle_options %W[--private-key #{nonexistent}]
+ end
+
+ assert_equal "invalid argument: " +
+ "--private-key #{nonexistent}: does not exist",
+ e.message
+
+ bad = File.join @tempdir, 'bad'
+ FileUtils.touch bad
+
+ e = assert_raises OptionParser::InvalidArgument do
+ @cmd.handle_options %W[--private-key #{bad}]
+ end
+
+ assert_equal "invalid argument: --private-key #{bad}: invalid RSA key",
+ e.message
+
+ e = assert_raises OptionParser::InvalidArgument do
+ @cmd.handle_options %W[--private-key #{PUBLIC_KEY_FILE}]
+ end
+
+ assert_equal "invalid argument: " +
+ "--private-key #{PUBLIC_KEY_FILE}: private key not found",
+ e.message
+ end
+
+ def test_handle_options_sign
+ @cmd.handle_options %W[
+ --private-key #{ALTERNATE_KEY_FILE}
+ --private-key #{PRIVATE_KEY_FILE}
+
+ --certificate #{ALTERNATE_CERT_FILE}
+ --certificate #{PUBLIC_CERT_FILE}
+
+ --sign #{ALTERNATE_CERT_FILE}
+ --sign #{CHILD_CERT_FILE}
+ ]
+
+ assert_equal PRIVATE_KEY.to_pem, @cmd.options[:key].to_pem
+ assert_equal PUBLIC_CERT.to_pem, @cmd.options[:issuer_cert].to_pem
+
+ assert_equal [ALTERNATE_CERT_FILE, CHILD_CERT_FILE], @cmd.options[:sign]
+ end
+
+ def test_handle_options_sign_encrypted_key
+ @cmd.handle_options %W[
+ --private-key #{ALTERNATE_KEY_FILE}
+ --private-key #{ENCRYPTED_PRIVATE_KEY_PATH}
+
+ --certificate #{ALTERNATE_CERT_FILE}
+ --certificate #{PUBLIC_CERT_FILE}
+
+ --sign #{ALTERNATE_CERT_FILE}
+ --sign #{CHILD_CERT_FILE}
+ ]
+
+ assert_equal ENCRYPTED_PRIVATE_KEY.to_pem, @cmd.options[:key].to_pem
+ assert_equal PUBLIC_CERT.to_pem, @cmd.options[:issuer_cert].to_pem
+
+ assert_equal [ALTERNATE_CERT_FILE, CHILD_CERT_FILE], @cmd.options[:sign]
+ end
+
+ def test_handle_options_sign_nonexistent
+ nonexistent = File.join @tempdir, 'nonexistent'
+ e = assert_raises OptionParser::InvalidArgument do
+ @cmd.handle_options %W[
+ --private-key #{ALTERNATE_KEY_FILE}
+
+ --certificate #{ALTERNATE_CERT_FILE}
+
+ --sign #{nonexistent}
+ ]
+ end
+
+ assert_equal "invalid argument: --sign #{nonexistent}: does not exist",
+ e.message
end
-end if defined? OpenSSL
+end if defined?(OpenSSL::SSL)
diff --git a/test/rubygems/test_gem_commands_check_command.rb b/test/rubygems/test_gem_commands_check_command.rb
index a71c1ebb92..67db6a3206 100644
--- a/test/rubygems/test_gem_commands_check_command.rb
+++ b/test/rubygems/test_gem_commands_check_command.rb
@@ -9,10 +9,60 @@ class TestGemCommandsCheckCommand < Gem::TestCase
@cmd = Gem::Commands::CheckCommand.new
end
+ def gem name
+ spec = quick_gem name do |gem|
+ gem.files = %W[lib/#{name}.rb Rakefile]
+ end
+
+ write_file File.join(*%W[gems #{spec.full_name} lib #{name}.rb])
+ write_file File.join(*%W[gems #{spec.full_name} Rakefile])
+
+ spec
+ end
+
def test_initialize
assert_equal "check", @cmd.command
assert_equal "gem check", @cmd.program_name
assert_match(/Check/, @cmd.summary)
end
+ def test_handle_options
+ @cmd.handle_options %w[--no-alien --no-gems --doctor --dry-run]
+
+ assert @cmd.options[:doctor]
+ refute @cmd.options[:alien]
+ assert @cmd.options[:dry_run]
+ refute @cmd.options[:gems]
+ end
+
+ def test_handle_options_defaults
+ @cmd.handle_options []
+
+ assert @cmd.options[:alien]
+ assert @cmd.options[:gems]
+ refute @cmd.options[:doctor]
+ refute @cmd.options[:dry_run]
+ end
+
+ def test_doctor
+ gem 'a'
+ b = gem 'b'
+
+ FileUtils.rm b.spec_file
+
+ assert_path_exists b.gem_dir
+ refute_path_exists b.spec_file
+
+ Gem.use_paths @gemhome
+
+ capture_io do
+ use_ui @ui do
+ @cmd.doctor
+ end
+ end
+
+ refute_path_exists b.gem_dir
+ refute_path_exists b.spec_file
+ end
+
end
diff --git a/test/rubygems/test_gem_commands_cleanup_command.rb b/test/rubygems/test_gem_commands_cleanup_command.rb
index 40c7b30539..fdaac545af 100644
--- a/test/rubygems/test_gem_commands_cleanup_command.rb
+++ b/test/rubygems/test_gem_commands_cleanup_command.rb
@@ -2,19 +2,34 @@ require 'rubygems/test_case'
require 'rubygems/commands/cleanup_command'
class TestGemCommandsCleanupCommand < Gem::TestCase
-
+
def setup
super
@cmd = Gem::Commands::CleanupCommand.new
- @a_1 = quick_spec 'a', 1
- @a_2 = quick_spec 'a', 2
+ @a_1 = util_spec 'a', 1
+ @a_2 = util_spec 'a', 2
install_gem @a_1
install_gem @a_2
end
+ def test_handle_options_d
+ @cmd.handle_options %w[-d]
+ assert @cmd.options[:dryrun]
+ end
+
+ def test_handle_options_dry_run
+ @cmd.handle_options %w[--dryrun]
+ assert @cmd.options[:dryrun]
+ end
+
+ def test_handle_options_n
+ @cmd.handle_options %w[-n]
+ assert @cmd.options[:dryrun]
+ end
+
def test_execute
@cmd.options[:args] = %w[a]
@@ -23,9 +38,30 @@ class TestGemCommandsCleanupCommand < Gem::TestCase
refute_path_exists @a_1.gem_dir
end
+ def test_execute_all_dependencies
+ @b_1 = util_spec 'b', 1 do |s| s.add_dependency 'a', '1' end
+ @b_2 = util_spec 'b', 2 do |s| s.add_dependency 'a', '2' end
+
+ install_gem @b_1
+ install_gem @b_2
+
+ @cmd.options[:args] = []
+
+ @cmd.execute
+
+ refute_path_exists @a_1.gem_dir
+ refute_path_exists @b_1.gem_dir
+ end
+
def test_execute_all
- @b_1 = quick_spec 'b', 1
- @b_2 = quick_spec 'b', 2
+ gemhome2 = File.join @tempdir, 'gemhome2'
+
+ Gem.ensure_gem_subdirectories gemhome2
+
+ Gem.use_paths @gemhome, gemhome2
+
+ @b_1 = util_spec 'b', 1
+ @b_2 = util_spec 'b', 2
install_gem @b_1
install_gem @b_2
@@ -34,12 +70,15 @@ class TestGemCommandsCleanupCommand < Gem::TestCase
@cmd.execute
+ assert_equal @gemhome, Gem.dir, 'GEM_HOME'
+ assert_equal [@gemhome, gemhome2], Gem.path.sort, 'GEM_PATH'
+
refute_path_exists @a_1.gem_dir
refute_path_exists @b_1.gem_dir
end
def test_execute_all_user
- @a_1_1 = quick_spec 'a', '1.1'
+ @a_1_1 = util_spec 'a', '1.1'
@a_1_1 = install_gem_user @a_1_1 # pick up user install path
Gem::Specification.dirs = [Gem.dir, Gem.user_dir]
@@ -58,7 +97,7 @@ class TestGemCommandsCleanupCommand < Gem::TestCase
def test_execute_all_user_no_sudo
FileUtils.chmod 0555, @gemhome
- @a_1_1 = quick_spec 'a', '1.1'
+ @a_1_1 = util_spec 'a', '1.1'
@a_1_1 = install_gem_user @a_1_1 # pick up user install path
Gem::Specification.dirs = [Gem.dir, Gem.user_dir]
@@ -85,5 +124,44 @@ class TestGemCommandsCleanupCommand < Gem::TestCase
assert_path_exists @a_1.gem_dir
end
+ def test_execute_keeps_older_versions_with_deps
+ @b_1 = util_spec 'b', 1
+ @b_2 = util_spec 'b', 2
+
+ @c = util_spec 'c', 1 do |s|
+ s.add_dependency 'b', '1'
+ end
+
+ install_gem @c
+ install_gem @b_1
+ install_gem @b_2
+
+ @cmd.options[:args] = []
+
+ @cmd.execute
+
+ assert_path_exists @b_1.gem_dir
+ end
+
+ def test_execute_ignore_default_gem_verbose
+ Gem.configuration.verbose = :really
+
+ @b_1 = util_spec 'b', 1
+ @b_default = new_default_spec "b", "2"
+ @b_2 = util_spec 'b', 3
+
+ install_gem @b_1
+ install_default_specs @b_default
+ install_gem @b_2
+
+ @cmd.options[:args] = []
+
+ use_ui @ui do
+ @cmd.execute
+ end
+
+ assert_match %r%^Skipped default gems: b-2%, @ui.output
+ assert_empty @ui.error
+ end
end
diff --git a/test/rubygems/test_gem_commands_contents_command.rb b/test/rubygems/test_gem_commands_contents_command.rb
index 9995bed8d7..d87e84fc82 100644
--- a/test/rubygems/test_gem_commands_contents_command.rb
+++ b/test/rubygems/test_gem_commands_contents_command.rb
@@ -91,6 +91,34 @@ class TestGemCommandsContentsCommand < Gem::TestCase
assert_equal "", @ui.error
end
+ def test_execute_missing_single
+ @cmd.options[:args] = %w[foo]
+
+ assert_raises Gem::MockGemUi::TermError do
+ use_ui @ui do
+ @cmd.execute
+ end
+ end
+
+ assert_match "Unable to find gem 'foo'", @ui.output
+ assert_empty @ui.error
+ end
+
+ def test_execute_missing_multiple
+ @cmd.options[:args] = %w[foo bar]
+
+ gem 'foo'
+
+ use_ui @ui do
+ @cmd.execute
+ end
+
+ assert_match "lib/foo.rb", @ui.output
+ assert_match "Unable to find gem 'bar'", @ui.output
+
+ assert_empty @ui.error
+ end
+
def test_execute_multiple
@cmd.options[:args] = %w[foo bar]
@@ -127,6 +155,29 @@ lib/foo.rb
assert_equal "", @ui.error
end
+ def test_execute_default_gem
+ default_gem_spec = new_default_spec("default", "2.0.0.0",
+ nil, "default/gem.rb")
+ default_gem_spec.executables = ["default_command"]
+ default_gem_spec.files += ["default_gem.so"]
+ install_default_specs(default_gem_spec)
+
+ @cmd.options[:args] = %w[default]
+
+ use_ui @ui do
+ @cmd.execute
+ end
+
+ expected = [
+ File.join(Gem::ConfigMap[:bindir], 'default_command'),
+ File.join(Gem::ConfigMap[:rubylibdir], 'default/gem.rb'),
+ File.join(Gem::ConfigMap[:archdir], 'default_gem.so')
+ ].sort.join "\n"
+
+ assert_equal expected, @ui.output.chomp
+ assert_equal "", @ui.error
+ end
+
def test_handle_options
refute @cmd.options[:lib_only]
assert @cmd.options[:prefix]
diff --git a/test/rubygems/test_gem_commands_dependency_command.rb b/test/rubygems/test_gem_commands_dependency_command.rb
index 4c559e2349..e22b240afe 100644
--- a/test/rubygems/test_gem_commands_dependency_command.rb
+++ b/test/rubygems/test_gem_commands_dependency_command.rb
@@ -8,8 +8,6 @@ class TestGemCommandsDependencyCommand < Gem::TestCase
@cmd = Gem::Commands::DependencyCommand.new
@cmd.options[:domain] = :local
-
- util_setup_fake_fetcher true
end
def test_execute
@@ -30,6 +28,13 @@ class TestGemCommandsDependencyCommand < Gem::TestCase
end
def test_execute_no_args
+ spec_fetcher do |fetcher|
+ fetcher.spec 'a', 1
+ fetcher.spec 'a', '2.a'
+ fetcher.spec 'dep_x', 1, 'x' => '>= 1'
+ fetcher.legacy_platform
+ end
+
@cmd.options[:args] = []
use_ui @ui do
@@ -41,15 +46,8 @@ Gem a-1
Gem a-2.a
-Gem a-2
-
-Gem a-3.a
-
-Gem a_evil-9
-
-Gem b-2
-
-Gem c-1.2
+Gem dep_x-1
+ x (>= 1)
Gem pl-1-x86-linux
@@ -73,7 +71,7 @@ Gem pl-1-x86-linux
end
def test_execute_pipe_format
- quick_spec 'foo' do |gem|
+ util_spec 'foo' do |gem|
gem.add_dependency 'bar', '> 1'
end
@@ -89,6 +87,13 @@ Gem pl-1-x86-linux
end
def test_execute_regexp
+ spec_fetcher do |fetcher|
+ fetcher.spec 'a', 1
+ fetcher.spec 'a', '2.a'
+ fetcher.spec 'a_evil', 9
+ fetcher.spec 'b', 2
+ end
+
@cmd.options[:args] = %w[/[ab]/]
use_ui @ui do
@@ -100,10 +105,6 @@ Gem a-1
Gem a-2.a
-Gem a-2
-
-Gem a-3.a
-
Gem a_evil-9
Gem b-2
@@ -163,17 +164,10 @@ ERROR: Only reverse dependencies for local gems are supported.
end
def test_execute_remote
- foo = quick_gem 'foo' do |gem|
- gem.add_dependency 'bar', '> 1'
+ spec_fetcher do |fetcher|
+ fetcher.spec 'foo', 2, 'bar' => '> 1'
end
- @fetcher = Gem::FakeFetcher.new
- Gem::RemoteFetcher.fetcher = @fetcher
-
- util_setup_spec_fetcher foo
-
- FileUtils.rm File.join(@gemhome, 'specifications', foo.spec_name)
-
@cmd.options[:args] = %w[foo]
@cmd.options[:domain] = :remote
@@ -189,7 +183,10 @@ ERROR: Only reverse dependencies for local gems are supported.
@fetcher = Gem::FakeFetcher.new
Gem::RemoteFetcher.fetcher = @fetcher
- util_setup_spec_fetcher @a1, @a2
+ spec_fetcher do |fetcher|
+ fetcher.spec 'a', 1
+ fetcher.spec 'a', 2
+ end
@cmd.options[:args] = %w[a]
@cmd.options[:domain] = :remote
@@ -204,11 +201,9 @@ ERROR: Only reverse dependencies for local gems are supported.
end
def test_execute_prerelease
- @fetcher = Gem::FakeFetcher.new
- Gem::RemoteFetcher.fetcher = @fetcher
-
- util_clear_gems
- util_setup_spec_fetcher @a2_pre
+ spec_fetcher do |fetcher|
+ fetcher.spec 'a', '2.a'
+ end
@cmd.options[:args] = %w[a]
@cmd.options[:domain] = :remote
diff --git a/test/rubygems/test_gem_commands_environment_command.rb b/test/rubygems/test_gem_commands_environment_command.rb
index 439057df9d..253c459d94 100644
--- a/test/rubygems/test_gem_commands_environment_command.rb
+++ b/test/rubygems/test_gem_commands_environment_command.rb
@@ -11,6 +11,7 @@ class TestGemCommandsEnvironmentCommand < Gem::TestCase
def test_execute
orig_sources = Gem.sources.dup
+ orig_path, ENV['PATH'] = ENV['PATH'], %w[/usr/local/bin /usr/bin /bin].join(File::PATH_SEPARATOR)
Gem.sources.replace %w[http://gems.example.com]
Gem.configuration['gemcutter_key'] = 'blah'
@@ -36,10 +37,17 @@ class TestGemCommandsEnvironmentCommand < Gem::TestCase
assert_match %r|"gemcutter_key" => "\*\*\*\*"|, @ui.output
assert_match %r|:verbose => |, @ui.output
assert_match %r|REMOTE SOURCES:|, @ui.output
- assert_equal '', @ui.error
+
+ assert_match %r|- SHELL PATH:|, @ui.output
+ assert_match %r|- /usr/local/bin$|, @ui.output
+ assert_match %r|- /usr/bin$|, @ui.output
+ assert_match %r|- /bin$|, @ui.output
+
+ assert_empty @ui.error
ensure
Gem.sources.replace orig_sources
+ ENV['PATH'] = orig_path
end
def test_execute_gemdir
diff --git a/test/rubygems/test_gem_commands_fetch_command.rb b/test/rubygems/test_gem_commands_fetch_command.rb
index 9017a43b80..c452e79f14 100644
--- a/test/rubygems/test_gem_commands_fetch_command.rb
+++ b/test/rubygems/test_gem_commands_fetch_command.rb
@@ -12,13 +12,13 @@ class TestGemCommandsFetchCommand < Gem::TestCase
end
def test_execute
- util_setup_fake_fetcher
- util_setup_spec_fetcher @a2
+ specs = spec_fetcher do |fetcher|
+ fetcher.gem 'a', 2
+ end
- @fetcher.data["#{@gem_repo}gems/#{@a2.file_name}"] =
- File.read(@a2.cache_file)
+ refute_path_exists File.join(@tempdir, 'cache'), 'sanity check'
- @cmd.options[:args] = [@a2.name]
+ @cmd.options[:args] = %w[a]
use_ui @ui do
Dir.chdir @tempdir do
@@ -26,22 +26,24 @@ class TestGemCommandsFetchCommand < Gem::TestCase
end
end
- assert File.exist?(File.join(@tempdir, @a2.file_name)),
- "#{@a2.full_name} not fetched"
+ a2 = specs['a-2']
+
+ assert_path_exists(File.join(@tempdir, a2.file_name),
+ "#{a2.full_name} not fetched")
+ refute_path_exists File.join(@tempdir, 'cache'),
+ 'gem repository directories must not be created'
end
- def test_execute_prerelease
- util_setup_fake_fetcher true
- util_clear_gems
- util_setup_spec_fetcher @a2, @a2_pre
+ def test_execute_latest
+ specs = spec_fetcher do |fetcher|
+ fetcher.gem 'a', 1
+ fetcher.gem 'a', 2
+ end
- @fetcher.data["#{@gem_repo}gems/#{@a2.file_name}"] =
- File.read(@a2.cache_file)
- @fetcher.data["#{@gem_repo}gems/#{@a2_pre.file_name}"] =
- File.read(@a2_pre.cache_file)
+ refute_path_exists File.join(@tempdir, 'cache'), 'sanity check'
- @cmd.options[:args] = [@a2.name]
- @cmd.options[:prerelease] = true
+ @cmd.options[:args] = %w[a]
+ @cmd.options[:version] = req('>= 0.1')
use_ui @ui do
Dir.chdir @tempdir do
@@ -49,19 +51,21 @@ class TestGemCommandsFetchCommand < Gem::TestCase
end
end
- assert File.exist?(File.join(@tempdir, @a2_pre.file_name)),
- "#{@a2_pre.full_name} not fetched"
+ a2 = specs['a-2']
+ assert_path_exists(File.join(@tempdir, a2.file_name),
+ "#{a2.full_name} not fetched")
+ refute_path_exists File.join(@tempdir, 'cache'),
+ 'gem repository directories must not be created'
end
- def test_execute_version
- util_setup_fake_fetcher
- util_setup_spec_fetcher @a1, @a2
-
- @fetcher.data["#{@gem_repo}gems/#{@a1.file_name}"] =
- File.read(@a1.cache_file)
+ def test_execute_prerelease
+ specs = spec_fetcher do |fetcher|
+ fetcher.gem 'a', 2
+ fetcher.gem 'a', '2.a'
+ end
- @cmd.options[:args] = [@a2.name]
- @cmd.options[:version] = Gem::Requirement.new '1'
+ @cmd.options[:args] = %w[a]
+ @cmd.options[:prerelease] = true
use_ui @ui do
Dir.chdir @tempdir do
@@ -69,23 +73,41 @@ class TestGemCommandsFetchCommand < Gem::TestCase
end
end
- assert File.exist?(File.join(@tempdir, @a1.file_name)),
- "#{@a1.full_name} not fetched"
+ a2 = specs['a-2']
+
+ assert_path_exists(File.join(@tempdir, a2.file_name),
+ "#{a2.full_name} not fetched")
end
- def test_execute_handles_sources_properly
- repo = "http://gems.example.com"
- @uri = URI.parse repo
+ def test_execute_specific_prerelease
+ specs = spec_fetcher do |fetcher|
+ fetcher.gem 'a', 2
+ fetcher.gem 'a', '2.a'
+ end
- Gem.sources.replace [repo]
+ @cmd.options[:args] = %w[a]
+ @cmd.options[:prerelease] = true
+ @cmd.options[:version] = "2.a"
+
+ use_ui @ui do
+ Dir.chdir @tempdir do
+ @cmd.execute
+ end
+ end
+
+ a2_pre = specs['a-2.a']
- util_setup_fake_fetcher
- util_setup_spec_fetcher @a1, @a2
+ assert_path_exists(File.join(@tempdir, a2_pre.file_name),
+ "#{a2_pre.full_name} not fetched")
+ end
- @fetcher.data["#{@gem_repo}gems/#{@a1.file_name}"] =
- File.read(@a1.cache_file)
+ def test_execute_version
+ specs = spec_fetcher do |fetcher|
+ fetcher.gem 'a', 1
+ fetcher.gem 'a', 2
+ end
- @cmd.options[:args] = [@a2.name]
+ @cmd.options[:args] = %w[a]
@cmd.options[:version] = Gem::Requirement.new '1'
use_ui @ui do
@@ -94,8 +116,10 @@ class TestGemCommandsFetchCommand < Gem::TestCase
end
end
- assert File.exist?(File.join(@tempdir, @a1.file_name)),
- "#{@a1.full_name} not fetched"
+ a1 = specs['a-1']
+
+ assert_path_exists(File.join(@tempdir, a1.file_name),
+ "#{a1.full_name} not fetched")
end
end
diff --git a/test/rubygems/test_gem_commands_generate_index_command.rb b/test/rubygems/test_gem_commands_generate_index_command.rb
index ee4cd8051e..2e478d9c9e 100644
--- a/test/rubygems/test_gem_commands_generate_index_command.rb
+++ b/test/rubygems/test_gem_commands_generate_index_command.rb
@@ -16,27 +16,9 @@ class TestGemCommandsGenerateIndexCommand < Gem::TestCase
@cmd.execute
end
- marshal = File.join @gemhome, 'Marshal.4.8'
- marshal_z = File.join @gemhome, 'Marshal.4.8.Z'
+ specs = File.join @gemhome, "specs.4.8.gz"
- assert File.exist?(marshal), marshal
- assert File.exist?(marshal_z), marshal_z
- end
-
- def test_execute_rss_update
- @cmd.options[:update] = true
- @cmd.options[:rss_host] = 'example.com'
- @cmd.options[:rss_gems_host] = 'gems.example.com'
-
- use_ui @ui do
- assert_raises Gem::MockGemUi::TermError do
- @cmd.execute
- end
- end
-
- assert_equal "ERROR: --update not compatible with RSS generation\n",
- @ui.error
- assert_empty @ui.output
+ assert File.exist?(specs), specs
end
def test_handle_options_directory
@@ -58,69 +40,6 @@ class TestGemCommandsGenerateIndexCommand < Gem::TestCase
assert_equal 'C:/nonexistent', @cmd.options[:directory]
end
- def test_handle_options_invalid
- e = assert_raises OptionParser::InvalidOption do
- @cmd.handle_options %w[--no-modern --no-legacy]
- end
-
- assert_equal 'invalid option: --no-legacy no indicies will be built',
- e.message
-
- @cmd = Gem::Commands::GenerateIndexCommand.new
- e = assert_raises OptionParser::InvalidOption do
- @cmd.handle_options %w[--no-legacy --no-modern]
- end
-
- assert_equal 'invalid option: --no-modern no indicies will be built',
- e.message
- end
-
- def test_handle_options_legacy
- @cmd.handle_options %w[--legacy]
-
- assert @cmd.options[:build_legacy]
- assert @cmd.options[:build_modern], ':build_modern not set'
- end
-
- def test_handle_options_modern
- @cmd.handle_options %w[--modern]
-
- assert @cmd.options[:build_legacy]
- assert @cmd.options[:build_modern], ':build_modern not set'
- end
-
- def test_handle_options_no_legacy
- @cmd.handle_options %w[--no-legacy]
-
- refute @cmd.options[:build_legacy]
- assert @cmd.options[:build_modern]
- end
-
- def test_handle_options_no_modern
- @cmd.handle_options %w[--no-modern]
-
- assert @cmd.options[:build_legacy]
- refute @cmd.options[:build_modern]
- end
-
- def test_handle_options_rss_gems_host
- @cmd.handle_options %w[--rss-gems-host gems.example.com]
-
- assert_equal 'gems.example.com', @cmd.options[:rss_gems_host]
- end
-
- def test_handle_options_rss_host
- @cmd.handle_options %w[--rss-host example.com]
-
- assert_equal 'example.com', @cmd.options[:rss_host]
- end
-
- def test_handle_options_rss_title
- @cmd.handle_options %w[--rss-title Example\ Gems]
-
- assert_equal 'Example Gems', @cmd.options[:rss_title]
- end
-
def test_handle_options_update
@cmd.handle_options %w[--update]
diff --git a/test/rubygems/test_gem_commands_help_command.rb b/test/rubygems/test_gem_commands_help_command.rb
index d626b1436a..3a6f2fa523 100644
--- a/test/rubygems/test_gem_commands_help_command.rb
+++ b/test/rubygems/test_gem_commands_help_command.rb
@@ -1,20 +1,24 @@
require "rubygems"
require "rubygems/test_case"
require "rubygems/commands/help_command"
-require "rubygems/format"
+require "rubygems/package"
require "rubygems/command_manager"
+require File.expand_path('../rubygems_plugin', __FILE__)
class TestGemCommandsHelpCommand < Gem::TestCase
def setup
super
@cmd = Gem::Commands::HelpCommand.new
+
+ load File.expand_path('../rubygems_plugin.rb', __FILE__) unless
+ Gem::Commands.const_defined? :InterruptCommand
end
def test_gem_help_bad
util_gem 'bad' do |out, err|
assert_equal('', out)
- assert_match(/Unknown command bad. Try gem help commands\n/, err)
+ assert_match "Unknown command bad", err
end
end
@@ -32,7 +36,12 @@ class TestGemCommandsHelpCommand < Gem::TestCase
mgr.command_names.each do |cmd|
assert_match(/\s+#{cmd}\s+\S+/, out)
end
- assert_equal '', err
+
+ if defined?(OpenSSL::SSL) then
+ assert_empty err
+
+ refute_match 'No command found for ', out
+ end
end
end
diff --git a/test/rubygems/test_gem_commands_install_command.rb b/test/rubygems/test_gem_commands_install_command.rb
index 2215d4d4ab..ed7f72d6a5 100644
--- a/test/rubygems/test_gem_commands_install_command.rb
+++ b/test/rubygems/test_gem_commands_install_command.rb
@@ -1,124 +1,110 @@
require 'rubygems/test_case'
require 'rubygems/commands/install_command'
-
-begin
- gem "rdoc"
- gem "json"
-rescue Gem::LoadError
- # ignore
-end
+require 'rubygems/rdoc'
class TestGemCommandsInstallCommand < Gem::TestCase
def setup
super
+ common_installer_setup
@cmd = Gem::Commands::InstallCommand.new
- @cmd.options[:generate_rdoc] = false
- @cmd.options[:generate_ri] = false
+ @cmd.options[:document] = []
+
+ @gemdeps = "tmp_install_gemdeps"
+ @orig_args = Gem::Command.build_args
+
+ common_installer_setup
end
- def test_execute_exclude_prerelease
- util_setup_fake_fetcher :prerelease
- util_setup_spec_fetcher
+ def teardown
+ super
- @fetcher.data["#{@gem_repo}gems/#{@a2.file_name}"] =
- read_binary(@a2.cache_file)
- @fetcher.data["#{@gem_repo}gems/#{@a2_pre.file_name}"] =
- read_binary(@a2_pre.cache_file)
+ common_installer_teardown
+
+ Gem::Command.build_args = @orig_args
+ File.unlink @gemdeps if File.file? @gemdeps
+ end
+
+ def test_execute_exclude_prerelease
+ spec_fetcher do |fetcher|
+ fetcher.gem 'a', 2
+ fetcher.gem 'a', '2.pre'
+ end
- @cmd.options[:args] = [@a2.name]
+ @cmd.options[:args] = %w[a]
use_ui @ui do
- e = assert_raises Gem::SystemExitException do
+ assert_raises Gem::MockGemUi::SystemExitException, @ui.error do
@cmd.execute
end
- assert_equal 0, e.exit_code, @ui.error
end
- assert_match(/Successfully installed #{@a2.full_name}$/, @ui.output)
- refute_match(/Successfully installed #{@a2_pre.full_name}$/, @ui.output)
+ assert_equal %w[a-2], @cmd.installed_specs.map { |spec| spec.full_name }
end
def test_execute_explicit_version_includes_prerelease
- util_setup_fake_fetcher :prerelease
- util_setup_spec_fetcher
+ specs = spec_fetcher do |fetcher|
+ fetcher.gem 'a', 2
+ fetcher.gem 'a', '2.a'
+ end
- @fetcher.data["#{@gem_repo}gems/#{@a2.file_name}"] =
- read_binary(@a2.cache_file)
- @fetcher.data["#{@gem_repo}gems/#{@a2_pre.file_name}"] =
- read_binary(@a2_pre.cache_file)
+ a2_pre = specs['a-2.a']
- @cmd.handle_options [@a2_pre.name, '--version', @a2_pre.version.to_s,
+ @cmd.handle_options [a2_pre.name, '--version', a2_pre.version.to_s,
"--no-ri", "--no-rdoc"]
assert @cmd.options[:prerelease]
- assert @cmd.options[:version].satisfied_by?(@a2_pre.version)
+ assert @cmd.options[:version].satisfied_by?(a2_pre.version)
use_ui @ui do
- e = assert_raises Gem::SystemExitException do
+ assert_raises Gem::MockGemUi::SystemExitException, @ui.error do
@cmd.execute
end
- assert_equal 0, e.exit_code, @ui.error
end
- refute_match(/Successfully installed #{@a2.full_name}$/, @ui.output)
- assert_match(/Successfully installed #{@a2_pre.full_name}$/, @ui.output)
+ assert_equal %w[a-2.a], @cmd.installed_specs.map { |spec| spec.full_name }
end
- def test_execute_include_dependencies
- @cmd.options[:include_dependencies] = true
- @cmd.options[:args] = []
-
- assert_raises Gem::CommandLineError do
- use_ui @ui do
- @cmd.execute
- end
+ def test_execute_local
+ specs = spec_fetcher do |fetcher|
+ fetcher.gem 'a', 2
end
- output = @ui.output.split "\n"
- assert_equal "INFO: `gem install -y` is now default and will be removed",
- output.shift
- assert_equal "INFO: use --ignore-dependencies to install only the gems you list",
- output.shift
- assert output.empty?, output.inspect
- end
-
- def test_execute_local
- util_setup_fake_fetcher
@cmd.options[:domain] = :local
- FileUtils.mv @a2.cache_file, @tempdir
+ FileUtils.mv specs['a-2'].cache_file, @tempdir
- @cmd.options[:args] = [@a2.name]
+ @cmd.options[:args] = %w[a]
use_ui @ui do
orig_dir = Dir.pwd
begin
Dir.chdir @tempdir
- e = assert_raises Gem::SystemExitException do
+ assert_raises Gem::MockGemUi::SystemExitException, @ui.error do
@cmd.execute
end
- assert_equal 0, e.exit_code
ensure
Dir.chdir orig_dir
end
end
- out = @ui.output.split "\n"
- assert_equal "Successfully installed #{@a2.full_name}", out.shift
- assert_equal "1 gem installed", out.shift
- assert out.empty?, out.inspect
+ assert_equal %w[a-2], @cmd.installed_specs.map { |spec| spec.full_name }
+
+ assert_match "1 gem installed", @ui.output
end
- def test_no_user_install
+ def test_execute_no_user_install
skip 'skipped on MS Windows (chmod has no effect)' if win_platform?
- util_setup_fake_fetcher
+ specs = spec_fetcher do |fetcher|
+ fetcher.gem 'a', 2
+ end
+
@cmd.options[:user_install] = false
- FileUtils.mv @a2.cache_file, @tempdir
+ FileUtils.mv specs['a-2'].cache_file, @tempdir
- @cmd.options[:args] = [@a2.name]
+ @cmd.options[:args] = %w[a]
use_ui @ui do
orig_dir = Dir.pwd
@@ -138,13 +124,14 @@ class TestGemCommandsInstallCommand < Gem::TestCase
end
def test_execute_local_missing
- util_setup_fake_fetcher
+ spec_fetcher
+
@cmd.options[:domain] = :local
@cmd.options[:args] = %w[no_such_gem]
use_ui @ui do
- e = assert_raises Gem::SystemExitException do
+ e = assert_raises Gem::MockGemUi::TermError do
@cmd.execute
end
assert_equal 2, e.exit_code
@@ -163,13 +150,12 @@ class TestGemCommandsInstallCommand < Gem::TestCase
end
def test_execute_nonexistent
- util_setup_fake_fetcher
- util_setup_spec_fetcher
+ spec_fetcher
@cmd.options[:args] = %w[nonexistent]
use_ui @ui do
- e = assert_raises Gem::SystemExitException do
+ e = assert_raises Gem::MockGemUi::TermError do
@cmd.execute
end
assert_equal 2, e.exit_code
@@ -179,13 +165,11 @@ class TestGemCommandsInstallCommand < Gem::TestCase
end
def test_execute_bad_source
- util_setup_fake_fetcher
- util_setup_spec_fetcher
+ spec_fetcher
# This is needed because we need to exercise the cache path
# within SpecFetcher
- path = File.join Gem.user_home, '.gem', 'specs', "not-there.nothing%80",
- "latest_specs.4.8"
+ path = File.join Gem.spec_cache_dir, "not-there.nothing%80", "latest_specs.4.8"
FileUtils.mkdir_p File.dirname(path)
@@ -198,7 +182,7 @@ class TestGemCommandsInstallCommand < Gem::TestCase
@cmd.options[:args] = %w[nonexistent]
use_ui @ui do
- e = assert_raises Gem::SystemExitException do
+ e = assert_raises Gem::MockGemUi::TermError do
@cmd.execute
end
assert_equal 2, e.exit_code
@@ -206,21 +190,22 @@ class TestGemCommandsInstallCommand < Gem::TestCase
errs = @ui.error.split("\n")
- assert_match(/WARNING: Error fetching data/, errs.shift)
assert_match(/ould not find a valid gem 'nonexistent'/, errs.shift)
+ assert_match(%r!Unable to download data from http://not-there.nothing!, errs.shift)
end
def test_execute_nonexistent_with_hint
misspelled = "nonexistent_with_hint"
correctly_spelled = "non_existent_with_hint"
- util_setup_fake_fetcher
- util_setup_spec_fetcher quick_spec(correctly_spelled, '2')
+ spec_fetcher do |fetcher|
+ fetcher.spec correctly_spelled, 2
+ end
@cmd.options[:args] = [misspelled]
use_ui @ui do
- e = assert_raises Gem::SystemExitException do
+ e = assert_raises Gem::MockGemUi::TermError do
@cmd.execute
end
@@ -234,109 +219,307 @@ ERROR: Possible alternatives: non_existent_with_hint
assert_equal expected, @ui.error
end
- def test_execute_prerelease
- util_setup_fake_fetcher :prerelease
- util_clear_gems
- util_setup_spec_fetcher @a2, @a2_pre
+ def test_execute_nonexistent_with_dashes
+ misspelled = "non-existent_with-hint"
+ correctly_spelled = "nonexistent-with_hint"
+
+ spec_fetcher do |fetcher|
+ fetcher.spec correctly_spelled, 2
+ fetcher.clear
+ end
+
+ @cmd.options[:args] = [misspelled]
+
+ use_ui @ui do
+ e = assert_raises Gem::MockGemUi::TermError do
+ @cmd.execute
+ end
+
+ assert_equal 2, e.exit_code
+ end
+
+ expected = ["ERROR: Could not find a valid gem 'non-existent_with-hint' (>= 0) in any repository", "ERROR: Possible alternatives: nonexistent-with_hint"]
+
+ output = @ui.error.split "\n"
+
+ assert_equal expected, output
+ end
+
+ def test_execute_conflicting_install_options
+ @cmd.options[:user_install] = true
+ @cmd.options[:install_dir] = "whatever"
+
+ use_ui @ui do
+ assert_raises Gem::MockGemUi::TermError do
+ @cmd.execute
+ end
+ end
+
+ expected = "ERROR: Use --install-dir or --user-install but not both\n"
+
+ assert_equal expected, @ui.error
+ end
+
+ def test_execute_prerelease_skipped_when_no_flag_set
+ spec_fetcher do |fetcher|
+ fetcher.gem 'a', 1
+ fetcher.gem 'a', '3.a'
+ end
- @fetcher.data["#{@gem_repo}gems/#{@a2.file_name}"] =
- read_binary(@a2.cache_file)
- @fetcher.data["#{@gem_repo}gems/#{@a2_pre.file_name}"] =
- read_binary(@a2_pre.cache_file)
+ @cmd.options[:prerelease] = false
+ @cmd.options[:args] = %w[a]
+
+ use_ui @ui do
+ assert_raises Gem::MockGemUi::SystemExitException, @ui.error do
+ @cmd.execute
+ end
+ end
+
+ assert_equal %w[a-1], @cmd.installed_specs.map { |spec| spec.full_name }
+ end
+
+ def test_execute_prerelease_wins_over_previous_ver
+ spec_fetcher do |fetcher|
+ fetcher.gem 'a', 1
+ fetcher.gem 'a', '2.a'
+ fetcher.clear
+ end
@cmd.options[:prerelease] = true
- @cmd.options[:args] = [@a2_pre.name]
+ @cmd.options[:args] = %w[a]
use_ui @ui do
- e = assert_raises Gem::SystemExitException do
+ assert_raises Gem::MockGemUi::SystemExitException, @ui.error do
@cmd.execute
end
- assert_equal 0, e.exit_code, @ui.error
end
- refute_match(/Successfully installed #{@a2.full_name}$/, @ui.output)
- assert_match(/Successfully installed #{@a2_pre.full_name}$/, @ui.output)
+ assert_equal %w[a-2.a], @cmd.installed_specs.map { |spec| spec.full_name }
end
+ def test_execute_prerelease_skipped_when_non_pre_available
+ spec_fetcher do |fetcher|
+ fetcher.gem 'a', '2.pre'
+ fetcher.gem 'a', 2
+ end
+
+ @cmd.options[:prerelease] = true
+ @cmd.options[:args] = %w[a]
+
+ use_ui @ui do
+ assert_raises Gem::MockGemUi::SystemExitException, @ui.error do
+ @cmd.execute
+ end
+ end
+
+ assert_equal %w[a-2], @cmd.installed_specs.map { |spec| spec.full_name }
+ end
+
+ def test_execute_rdoc
+ specs = spec_fetcher do |fetcher|
+ fetcher.gem 'a', 2
+ end
+
+ Gem.done_installing(&Gem::RDoc.method(:generation_hook))
+
+ @cmd.options[:document] = %w[rdoc ri]
+ @cmd.options[:domain] = :local
+
+ a2 = specs['a-2']
+ FileUtils.mv a2.cache_file, @tempdir
+
+ @cmd.options[:args] = %w[a]
+
+ use_ui @ui do
+ # Don't use Dir.chdir with a block, it warnings a lot because
+ # of a downstream Dir.chdir with a block
+ old = Dir.getwd
+
+ begin
+ Dir.chdir @tempdir
+ assert_raises Gem::MockGemUi::SystemExitException, @ui.error do
+ @cmd.execute
+ end
+ ensure
+ Dir.chdir old
+ end
+ end
+
+ wait_for_child_process_to_exit
+
+ assert_path_exists File.join(a2.doc_dir, 'ri')
+ assert_path_exists File.join(a2.doc_dir, 'rdoc')
+ end
+
+ def test_execute_saves_build_args
+ specs = spec_fetcher do |fetcher|
+ fetcher.gem 'a', 2
+ end
+
+ args = %w!--with-awesome=true --more-awesome=yes!
+
+ Gem::Command.build_args = args
+
+ a2 = specs['a-2']
+ FileUtils.mv a2.cache_file, @tempdir
+
+ @cmd.options[:domain] = :local
+
+ @cmd.options[:args] = %w[a]
+
+ use_ui @ui do
+ # Don't use Dir.chdir with a block, it warnings a lot because
+ # of a downstream Dir.chdir with a block
+ old = Dir.getwd
+
+ begin
+ Dir.chdir @tempdir
+ assert_raises Gem::MockGemUi::SystemExitException, @ui.error do
+ @cmd.execute
+ end
+ ensure
+ Dir.chdir old
+ end
+ end
+
+ path = a2.build_info_file
+ assert_path_exists path
+
+ assert_equal args, a2.build_args
+ end
+
+
def test_execute_remote
- @cmd.options[:generate_rdoc] = true
- @cmd.options[:generate_ri] = true
+ spec_fetcher do |fetcher|
+ fetcher.gem 'a', 2
+ end
+
+ @cmd.options[:args] = %w[a]
+
+ use_ui @ui do
+ assert_raises Gem::MockGemUi::SystemExitException, @ui.error do
+ @cmd.execute
+ end
+ end
- util_setup_fake_fetcher
- util_setup_spec_fetcher
+ assert_equal %w[a-2], @cmd.installed_specs.map { |spec| spec.full_name }
- @fetcher.data["#{@gem_repo}gems/#{@a2.file_name}"] =
- read_binary(@a2.cache_file)
+ assert_match "1 gem installed", @ui.output
+ end
- @cmd.options[:args] = [@a2.name]
+ def test_execute_remote_ignores_files
+ specs = spec_fetcher do |fetcher|
+ fetcher.gem 'a', 1
+ fetcher.gem 'a', 2
+ end
+
+ @cmd.options[:domain] = :remote
+
+ a1 = specs['a-1']
+ a2 = specs['a-2']
+
+ FileUtils.mv a2.cache_file, @tempdir
+
+ @fetcher.data["#{@gem_repo}gems/#{a2.file_name}"] =
+ read_binary(a1.cache_file)
+
+ @cmd.options[:args] = [a2.name]
+
+ gemdir = File.join @gemhome, 'specifications'
+
+ a2_gemspec = File.join(gemdir, "a-2.gemspec")
+ a1_gemspec = File.join(gemdir, "a-1.gemspec")
+
+ FileUtils.rm_rf a1_gemspec
+ FileUtils.rm_rf a2_gemspec
+
+ start = Dir["#{gemdir}/*"]
use_ui @ui do
- e = assert_raises Gem::SystemExitException do
- capture_io do
+ Dir.chdir @tempdir do
+ assert_raises Gem::MockGemUi::SystemExitException, @ui.error do
@cmd.execute
end
end
- assert_equal 0, e.exit_code
end
- out = @ui.output.split "\n"
- assert_equal "Successfully installed #{@a2.full_name}", out.shift
- assert_equal "1 gem installed", out.shift
- assert_equal "Installing ri documentation for #{@a2.full_name}...",
- out.shift
- assert_equal "Installing RDoc documentation for #{@a2.full_name}...",
- out.shift
- assert out.empty?, out.inspect
+ assert_equal %w[a-1], @cmd.installed_specs.map { |spec| spec.full_name }
+
+ assert_match "1 gem installed", @ui.output
+
+ fin = Dir["#{gemdir}/*"]
+
+ assert_equal [a1_gemspec], fin - start
end
def test_execute_two
- util_setup_fake_fetcher
- @cmd.options[:domain] = :local
+ specs = spec_fetcher do |fetcher|
+ fetcher.gem 'a', 2
+ fetcher.gem 'b', 2
+ end
- FileUtils.mv @a2.cache_file, @tempdir
+ FileUtils.mv specs['a-2'].cache_file, @tempdir
+ FileUtils.mv specs['b-2'].cache_file, @tempdir
- FileUtils.mv @b2.cache_file, @tempdir
+ @cmd.options[:domain] = :local
- @cmd.options[:args] = [@a2.name, @b2.name]
+ @cmd.options[:args] = %w[a b]
use_ui @ui do
orig_dir = Dir.pwd
begin
Dir.chdir @tempdir
- e = assert_raises Gem::SystemExitException do
+ assert_raises Gem::MockGemUi::SystemExitException, @ui.error do
@cmd.execute
end
- assert_equal 0, e.exit_code
ensure
Dir.chdir orig_dir
end
end
- out = @ui.output.split "\n"
- assert_equal "Successfully installed #{@a2.full_name}", out.shift
- assert_equal "Successfully installed #{@b2.full_name}", out.shift
- assert_equal "2 gems installed", out.shift
- assert out.empty?, out.inspect
+ assert_equal %w[a-2 b-2], @cmd.installed_specs.map { |spec| spec.full_name }
+
+ assert_match "2 gems installed", @ui.output
+ end
+
+ def test_execute_two_version
+ @cmd.options[:args] = %w[a b]
+ @cmd.options[:version] = Gem::Requirement.new("> 1")
+
+ use_ui @ui do
+ e = assert_raises Gem::MockGemUi::TermError do
+ @cmd.execute
+ end
+
+ assert_equal 1, e.exit_code
+ end
+
+ assert_empty @cmd.installed_specs
+
+ msg = "ERROR: Can't use --version w/ multiple gems. Use name:ver instead."
+
+ assert_empty @ui.output
+ assert_equal msg, @ui.error.chomp
end
def test_execute_conservative
- util_setup_fake_fetcher
- util_setup_spec_fetcher
+ spec_fetcher do |fetcher|
+ fetcher.gem 'b', 2
- @fetcher.data["#{@gem_repo}gems/#{@b2.file_name}"] =
- read_binary(@b2.cache_file)
+ fetcher.clear
- uninstall_gem(@b2)
+ fetcher.gem 'a', 2
+ end
@cmd.options[:conservative] = true
- @cmd.options[:args] = [@a2.name, @b2.name]
+ @cmd.options[:args] = %w[a b]
use_ui @ui do
orig_dir = Dir.pwd
begin
Dir.chdir @tempdir
- assert_raises Gem::SystemExitException do
+ assert_raises Gem::MockGemUi::SystemExitException do
@cmd.execute
end
ensure
@@ -344,11 +527,323 @@ ERROR: Possible alternatives: non_existent_with_hint
end
end
- out = @ui.output.split "\n"
+ assert_equal %w[b-2], @cmd.installed_specs.map { |spec| spec.full_name }
+
assert_equal "", @ui.error
- assert_equal "Successfully installed #{@b2.full_name}", out.shift
- assert_equal "1 gem installed", out.shift
- assert out.empty?, out.inspect
+ assert_match "1 gem installed", @ui.output
end
-end
+ def test_parses_requirement_from_gemname
+ spec_fetcher do |fetcher|
+ fetcher.gem 'a', 2
+ fetcher.gem 'b', 2
+ end
+
+ @cmd.options[:domain] = :local
+
+ req = "a:10.0"
+
+ @cmd.options[:args] = [req]
+
+ e = nil
+ use_ui @ui do
+ orig_dir = Dir.pwd
+ begin
+ Dir.chdir @tempdir
+ e = assert_raises Gem::MockGemUi::TermError do
+ @cmd.execute
+ end
+ ensure
+ Dir.chdir orig_dir
+ end
+ end
+
+ assert_equal 2, e.exit_code
+ assert_match %r!Could not find a valid gem 'a' \(= 10.0\)!, @ui.error
+ end
+
+ def test_show_errors_on_failure
+ Gem.sources.replace ["http://not-there.nothing"]
+
+ @cmd.options[:args] = ["blah"]
+
+ e = nil
+ use_ui @ui do
+ orig_dir = Dir.pwd
+ begin
+ Dir.chdir @tempdir
+ e = assert_raises Gem::MockGemUi::TermError do
+ @cmd.execute
+ end
+ ensure
+ Dir.chdir orig_dir
+ end
+ end
+
+ assert_equal 2, e.exit_code
+ assert_match %r!Could not find a valid gem 'blah' \(>= 0\)!, @ui.error
+ assert_match %r!Unable to download data from http://not-there\.nothing!, @ui.error
+ end
+
+ def test_show_source_problems_even_on_success
+ spec_fetcher do |fetcher|
+ fetcher.gem 'a', 2
+ fetcher.clear
+ end
+
+ Gem.sources << "http://nonexistent.example"
+
+ @cmd.options[:args] = %w[a]
+
+ use_ui @ui do
+ assert_raises Gem::MockGemUi::SystemExitException, @ui.error do
+ @cmd.execute
+ end
+ end
+
+ assert_equal %w[a-2], @cmd.installed_specs.map { |spec| spec.full_name }
+
+ assert_match "1 gem installed", @ui.output
+
+ e = @ui.error
+
+ x = "WARNING: Unable to pull data from 'http://nonexistent.example': no data for http://nonexistent.example/latest_specs.4.8.gz (http://nonexistent.example/latest_specs.4.8.gz)\n"
+ assert_equal x, e
+ end
+
+ def test_execute_uses_from_a_gemdeps
+ spec_fetcher do |fetcher|
+ fetcher.gem 'a', 2
+ end
+
+ File.open @gemdeps, "w" do |f|
+ f << "gem 'a'"
+ end
+
+ @cmd.options[:gemdeps] = @gemdeps
+
+ use_ui @ui do
+ assert_raises Gem::MockGemUi::SystemExitException, @ui.error do
+ @cmd.execute
+ end
+ end
+
+ assert_equal %w[], @cmd.installed_specs.map { |spec| spec.full_name }
+
+ assert_match "Using a (2)", @ui.output
+ end
+
+ def test_execute_installs_from_a_gemdeps
+ spec_fetcher do |fetcher|
+ fetcher.gem 'a', 2
+ fetcher.clear
+ end
+
+ File.open @gemdeps, "w" do |f|
+ f << "gem 'a'"
+ end
+
+ @cmd.options[:gemdeps] = @gemdeps
+
+ use_ui @ui do
+ assert_raises Gem::MockGemUi::SystemExitException, @ui.error do
+ @cmd.execute
+ end
+ end
+
+ assert_equal %w[a-2], @cmd.installed_specs.map { |spec| spec.full_name }
+
+ assert_match "Installing a (2)", @ui.output
+ end
+
+ def test_execute_installs_deps_a_gemdeps
+ spec_fetcher do |fetcher|
+ fetcher.gem 'q', '1.0'
+ fetcher.gem 'r', '2.0', 'q' => nil
+ fetcher.clear
+ end
+
+ File.open @gemdeps, "w" do |f|
+ f << "gem 'r'"
+ end
+
+ @cmd.options[:gemdeps] = @gemdeps
+
+ use_ui @ui do
+ assert_raises Gem::MockGemUi::SystemExitException, @ui.error do
+ @cmd.execute
+ end
+ end
+
+ names = @cmd.installed_specs.map { |spec| spec.full_name }
+
+ assert_equal %w[q-1.0 r-2.0], names
+
+ assert_match "Installing q (1.0)", @ui.output
+ assert_match "Installing r (2.0)", @ui.output
+ end
+
+ def test_execute_uses_deps_a_gemdeps
+ spec_fetcher do |fetcher|
+ fetcher.gem 'r', '2.0', 'q' => nil
+
+ fetcher.clear
+
+ fetcher.spec 'q', '1.0'
+ end
+
+ File.open @gemdeps, "w" do |f|
+ f << "gem 'r'"
+ end
+
+ @cmd.options[:gemdeps] = @gemdeps
+
+ use_ui @ui do
+ assert_raises Gem::MockGemUi::SystemExitException, @ui.error do
+ @cmd.execute
+ end
+ end
+
+ names = @cmd.installed_specs.map { |spec| spec.full_name }
+
+ assert_equal %w[r-2.0], names
+
+ assert_match "Using q (1.0)", @ui.output
+ assert_match "Installing r (2.0)", @ui.output
+ end
+
+ def test_execute_installs_deps_a_gemdeps_into_a_path
+ spec_fetcher do |fetcher|
+ fetcher.gem 'q', '1.0'
+ fetcher.gem 'r', '2.0', 'q' => nil
+ fetcher.clear
+ end
+
+ File.open @gemdeps, "w" do |f|
+ f << "gem 'r'"
+ end
+
+ @cmd.options[:install_dir] = "gf-path"
+ @cmd.options[:gemdeps] = @gemdeps
+
+ use_ui @ui do
+ assert_raises Gem::MockGemUi::SystemExitException, @ui.error do
+ @cmd.execute
+ end
+ end
+
+ names = @cmd.installed_specs.map { |spec| spec.full_name }
+
+ assert_equal %w[q-1.0 r-2.0], names
+
+ assert_match "Installing q (1.0)", @ui.output
+ assert_match "Installing r (2.0)", @ui.output
+
+ assert File.file?("gf-path/specifications/q-1.0.gemspec"), "not installed"
+ assert File.file?("gf-path/specifications/r-2.0.gemspec"), "not installed"
+ end
+
+ def test_execute_with_gemdeps_path_ignores_system
+ specs = spec_fetcher do |fetcher|
+ fetcher.gem 'q', '1.0'
+ fetcher.gem 'r', '2.0', 'q' => nil
+ fetcher.clear
+ end
+
+ Gem::Specification.add_specs specs['q-1.0']
+
+ File.open @gemdeps, "w" do |f|
+ f << "gem 'r'"
+ end
+
+ @cmd.options[:install_dir] = "gf-path"
+ @cmd.options[:gemdeps] = @gemdeps
+
+ use_ui @ui do
+ assert_raises Gem::MockGemUi::SystemExitException, @ui.error do
+ @cmd.execute
+ end
+ end
+
+ names = @cmd.installed_specs.map { |spec| spec.full_name }
+
+ assert_equal %w[q-1.0 r-2.0], names
+
+ assert_match "Installing q (1.0)", @ui.output
+ assert_match "Installing r (2.0)", @ui.output
+
+ assert File.file?("gf-path/specifications/q-1.0.gemspec"), "not installed"
+ assert File.file?("gf-path/specifications/r-2.0.gemspec"), "not installed"
+ end
+
+ def test_execute_uses_deps_a_gemdeps_with_a_path
+ specs = spec_fetcher do |fetcher|
+ fetcher.gem 'q', '1.0'
+ fetcher.gem 'r', '2.0', 'q' => nil
+ end
+
+ i = Gem::Installer.new specs['q-1.0'].cache_file, :install_dir => "gf-path"
+ i.install
+
+ assert File.file?("gf-path/specifications/q-1.0.gemspec"), "not installed"
+
+ File.open @gemdeps, "w" do |f|
+ f << "gem 'r'"
+ end
+
+ @cmd.options[:install_dir] = "gf-path"
+ @cmd.options[:gemdeps] = @gemdeps
+
+ use_ui @ui do
+ assert_raises Gem::MockGemUi::SystemExitException, @ui.error do
+ @cmd.execute
+ end
+ end
+
+ names = @cmd.installed_specs.map { |spec| spec.full_name }
+
+ assert_equal %w[r-2.0], names
+
+ assert_match "Using q (1.0)", @ui.output
+ assert_match "Installing r (2.0)", @ui.output
+ end
+
+ def test_handle_options_file
+ @cmd.handle_options %w[-g Gemfile]
+
+ assert_equal 'Gemfile', @cmd.options[:gemdeps]
+
+ @cmd.handle_options %w[--file gem.deps.rb]
+
+ assert_equal 'gem.deps.rb', @cmd.options[:gemdeps]
+
+ FileUtils.touch 'Isolate'
+
+ @cmd.handle_options %w[-g]
+
+ assert_equal 'Isolate', @cmd.options[:gemdeps]
+
+ FileUtils.touch 'Gemfile'
+
+ @cmd.handle_options %w[-g]
+
+ assert_equal 'Gemfile', @cmd.options[:gemdeps]
+
+ FileUtils.touch 'gem.deps.rb'
+
+ @cmd.handle_options %w[-g]
+
+ assert_equal 'gem.deps.rb', @cmd.options[:gemdeps]
+ end
+
+ def test_handle_options_without
+ @cmd.handle_options %w[--without test]
+
+ assert_equal [:test], @cmd.options[:without_groups]
+
+ @cmd.handle_options %w[--without test,development]
+
+ assert_equal [:test, :development], @cmd.options[:without_groups]
+ end
+
+end
diff --git a/test/rubygems/test_gem_commands_list_command.rb b/test/rubygems/test_gem_commands_list_command.rb
index 05afbc6f8d..b03f166e1b 100644
--- a/test/rubygems/test_gem_commands_list_command.rb
+++ b/test/rubygems/test_gem_commands_list_command.rb
@@ -8,9 +8,9 @@ class TestGemCommandsListCommand < Gem::TestCase
@cmd = Gem::Commands::ListCommand.new
- util_setup_fake_fetcher
-
- @si = util_setup_spec_fetcher @a1, @a2, @pl1
+ spec_fetcher do |fetcher|
+ fetcher.spec 'c', 1
+ end
@fetcher.data["#{@gem_repo}Marshal.#{Gem.marshal_version}"] = proc do
raise Gem::RemoteFetcher::FetchError
diff --git a/test/rubygems/test_gem_commands_mirror.rb b/test/rubygems/test_gem_commands_mirror.rb
new file mode 100644
index 0000000000..2f6fe52401
--- /dev/null
+++ b/test/rubygems/test_gem_commands_mirror.rb
@@ -0,0 +1,32 @@
+require 'rubygems/test_case'
+require 'rubygems/commands/mirror_command'
+
+class TestGemCommandsMirrorCommand < Gem::TestCase
+
+ def setup
+ super
+
+ @cmd = Gem::Commands::MirrorCommand.new
+
+ @mirror_specs = Gem::Specification.find_all_by_name('rubygems-mirror').each do |spec|
+ Gem::Specification.remove_spec spec
+ end
+ end
+
+ def teardown
+ @mirror_specs.each do |spec|
+ Gem::Specification.add_spec spec
+ end
+
+ super
+ end
+
+ def test_execute
+ use_ui @ui do
+ @cmd.execute
+ end
+
+ assert_match %r%Install the rubygems-mirror%i, @ui.error
+ end
+
+end
diff --git a/test/rubygems/test_gem_commands_outdated_command.rb b/test/rubygems/test_gem_commands_outdated_command.rb
index 72696d6549..d369c6b14b 100644
--- a/test/rubygems/test_gem_commands_outdated_command.rb
+++ b/test/rubygems/test_gem_commands_outdated_command.rb
@@ -14,18 +14,13 @@ class TestGemCommandsOutdatedCommand < Gem::TestCase
end
def test_execute
- remote_10 = quick_spec 'foo', '1.0'
- remote_20 = quick_spec 'foo', '2.0'
-
- Gem::RemoteFetcher.fetcher = @fetcher = Gem::FakeFetcher.new
-
- util_clear_gems
- util_setup_spec_fetcher remote_10, remote_20
-
- quick_gem 'foo', '0.1'
- quick_gem 'foo', '0.2'
-
- Gem::Specification.reset
+ spec_fetcher do |fetcher|
+ fetcher.spec 'foo', '1.0'
+ fetcher.spec 'foo', '2.0'
+ fetcher.clear
+ fetcher.gem 'foo', '0.1'
+ fetcher.gem 'foo', '0.2'
+ end
use_ui @ui do
@cmd.execute
diff --git a/test/rubygems/test_gem_commands_owner_command.rb b/test/rubygems/test_gem_commands_owner_command.rb
index 65fe09e09f..5d7b66137e 100644
--- a/test/rubygems/test_gem_commands_owner_command.rb
+++ b/test/rubygems/test_gem_commands_owner_command.rb
@@ -6,6 +6,7 @@ class TestGemCommandsOwnerCommand < Gem::TestCase
def setup
super
+ ENV["RUBYGEMS_HOST"] = nil
@fetcher = Gem::FakeFetcher.new
Gem::RemoteFetcher.fetcher = @fetcher
Gem.configuration.rubygems_api_key = "ed244fbf2b1a52e012da8616c512fa47f9aa5250"
@@ -34,6 +35,36 @@ EOF
assert_match %r{- user2@example.com}, @ui.output
end
+ def test_show_owners_setting_up_host_through_env_var
+ response = "- email: user1@example.com\n"
+ host = "http://rubygems.example"
+ ENV["RUBYGEMS_HOST"] = host
+
+ @fetcher.data["#{host}/api/v1/gems/freewill/owners.yaml"] = [response, 200, 'OK']
+
+ use_ui @ui do
+ @cmd.show_owners("freewill")
+ end
+
+ assert_match %r{Owners for gem: freewill}, @ui.output
+ assert_match %r{- user1@example.com}, @ui.output
+ end
+
+ def test_show_owners_setting_up_host
+ response = "- email: user1@example.com\n"
+ host = "http://rubygems.example"
+ @cmd.host = host
+
+ @fetcher.data["#{host}/api/v1/gems/freewill/owners.yaml"] = [response, 200, 'OK']
+
+ use_ui @ui do
+ @cmd.show_owners("freewill")
+ end
+
+ assert_match %r{Owners for gem: freewill}, @ui.output
+ assert_match %r{- user1@example.com}, @ui.output
+ end
+
def test_show_owners_denied
response = "You don't have permission to push to this gem"
@fetcher.data["#{Gem.host}/api/v1/gems/freewill/owners.yaml"] = [response, 403, 'Forbidden']
@@ -80,15 +111,31 @@ EOF
response = "You don't have permission to push to this gem"
@fetcher.data["#{Gem.host}/api/v1/gems/freewill/owners"] = [response, 403, 'Forbidden']
- assert_raises Gem::MockGemUi::TermError do
- use_ui @ui do
- @cmd.add_owners("freewill", ["user-new1@example.com"])
- end
+ use_ui @ui do
+ @cmd.add_owners("freewill", ["user-new1@example.com"])
end
assert_match response, @ui.output
end
+ def test_add_owner_with_host_option_through_execute
+ host = "http://rubygems.example"
+ add_owner_response = "Owner added successfully."
+ show_owners_response = "- email: user1@example.com\n"
+ @fetcher.data["#{host}/api/v1/gems/freewill/owners"] = [add_owner_response, 200, 'OK']
+ @fetcher.data["#{host}/api/v1/gems/freewill/owners.yaml"] = [show_owners_response, 200, 'OK']
+
+ @cmd.handle_options %W[--host #{host} --add user-new1@example.com freewill]
+
+ use_ui @ui do
+ @cmd.execute
+ end
+
+ assert_match add_owner_response, @ui.output
+ assert_match %r{Owners for gem: freewill}, @ui.output
+ assert_match %r{- user1@example.com}, @ui.output
+ end
+
def test_add_owners_key
response = "Owner added successfully."
@fetcher.data["#{Gem.host}/api/v1/gems/freewill/owners"] = [response, 200, 'OK']
@@ -122,10 +169,8 @@ EOF
response = "You don't have permission to push to this gem"
@fetcher.data["#{Gem.host}/api/v1/gems/freewill/owners"] = [response, 403, 'Forbidden']
- assert_raises Gem::MockGemUi::TermError do
- use_ui @ui do
- @cmd.remove_owners("freewill", ["user-remove1@example.com"])
- end
+ use_ui @ui do
+ @cmd.remove_owners("freewill", ["user-remove1@example.com"])
end
assert_match response, @ui.output
@@ -144,4 +189,16 @@ EOF
assert_equal '701229f217cdf23b1344c7b4b54ca97', @fetcher.last_request['Authorization']
end
+
+ def test_remove_owners_missing
+ response = 'Owner could not be found.'
+ @fetcher.data["#{Gem.host}/api/v1/gems/freewill/owners"] = [response, 404, 'Not Found']
+
+ use_ui @ui do
+ @cmd.remove_owners("freewill", ["missing@example"])
+ end
+
+ assert_equal "Removing missing@example: #{response}\n", @ui.output
+ end
+
end
diff --git a/test/rubygems/test_gem_commands_pristine_command.rb b/test/rubygems/test_gem_commands_pristine_command.rb
index 6bf6d5a56c..7ea2b042c9 100644
--- a/test/rubygems/test_gem_commands_pristine_command.rb
+++ b/test/rubygems/test_gem_commands_pristine_command.rb
@@ -9,20 +9,31 @@ class TestGemCommandsPristineCommand < Gem::TestCase
end
def test_execute
- a = quick_spec 'a' do |s| s.executables = %w[foo] end
+ a = util_spec 'a' do |s|
+ s.executables = %w[foo]
+ s.files = %w[bin/foo lib/a.rb]
+ end
+ write_file File.join(@tempdir, 'lib', 'a.rb') do |fp|
+ fp.puts "puts __FILE__"
+ end
write_file File.join(@tempdir, 'bin', 'foo') do |fp|
fp.puts "#!/usr/bin/ruby"
end
install_gem a
- foo_path = File.join @gemhome, 'gems', a.full_name, 'bin', 'foo'
+ foo_path = File.join @gemhome, 'gems', a.full_name, 'bin', 'foo'
+ a_rb_path = File.join @gemhome, 'gems', a.full_name, 'lib', 'a.rb'
write_file foo_path do |io|
io.puts 'I changed it!'
end
+ write_file a_rb_path do |io|
+ io.puts 'I changed it!'
+ end
+
@cmd.options[:args] = %w[a]
use_ui @ui do
@@ -30,6 +41,7 @@ class TestGemCommandsPristineCommand < Gem::TestCase
end
assert_equal "#!/usr/bin/ruby\n", File.read(foo_path), foo_path
+ assert_equal "puts __FILE__\n", File.read(a_rb_path), a_rb_path
out = @ui.output.split "\n"
@@ -39,16 +51,18 @@ class TestGemCommandsPristineCommand < Gem::TestCase
end
def test_execute_all
- a = quick_spec 'a' do |s| s.executables = %w[foo] end
+ a = util_spec 'a' do |s| s.executables = %w[foo] end
write_file File.join(@tempdir, 'bin', 'foo') do |fp|
fp.puts "#!/usr/bin/ruby"
end
install_gem a
- gem_bin = File.join @gemhome, 'gems', a.full_name, 'bin', 'foo'
+ gem_bin = File.join @gemhome, 'gems', a.full_name, 'bin', 'foo'
+ gem_stub = File.join @gemhome, 'bin', 'foo'
FileUtils.rm gem_bin
+ FileUtils.rm gem_stub
@cmd.handle_options %w[--all]
@@ -57,6 +71,7 @@ class TestGemCommandsPristineCommand < Gem::TestCase
end
assert File.exist?(gem_bin)
+ assert File.exist?(gem_stub)
out = @ui.output.split "\n"
@@ -65,8 +80,74 @@ class TestGemCommandsPristineCommand < Gem::TestCase
assert_empty out, out.inspect
end
- def test_execute_no_exetension
- a = quick_spec 'a' do |s| s.extensions << 'ext/a/extconf.rb' end
+ def test_execute_env_shebang
+ a = util_spec 'a' do |s|
+ s.executables = %w[foo]
+ s.files = %w[bin/foo]
+ end
+ write_file File.join(@tempdir, 'bin', 'foo') do |fp|
+ fp.puts "#!/usr/bin/ruby"
+ end
+
+ install_gem a
+
+ gem_exec = File.join @gemhome, 'bin', 'foo'
+
+ FileUtils.rm gem_exec
+
+ @cmd.handle_options %w[--all --env-shebang]
+
+ use_ui @ui do
+ @cmd.execute
+ end
+
+ assert_path_exists gem_exec
+
+ if win_platform?
+ assert_match %r%\A#!\s*ruby%, File.read(gem_exec)
+ else
+ assert_match %r%\A#!\s*/usr/bin/env ruby%, File.read(gem_exec)
+ end
+ end
+
+ def test_execute_extensions_explicit
+ a = util_spec 'a' do |s| s.extensions << 'ext/a/extconf.rb' end
+
+ ext_path = File.join @tempdir, 'ext', 'a', 'extconf.rb'
+ write_file ext_path do |io|
+ io.write <<-'RUBY'
+ File.open "Makefile", "w" do |f|
+ f.puts "clean:\n\techo cleaned\n"
+ f.puts "all:\n\techo built\n"
+ f.puts "install:\n\techo installed\n"
+ end
+ RUBY
+ end
+
+ b = util_spec 'b'
+
+ install_gem a
+ install_gem b
+
+ @cmd.options[:extensions] = true
+ @cmd.options[:extensions_set] = true
+ @cmd.options[:args] = []
+
+ use_ui @ui do
+ @cmd.execute
+ end
+
+ out = @ui.output.split "\n"
+
+ assert_equal 'Restoring gems to pristine condition...', out.shift
+ assert_equal 'Building native extensions. This could take a while...',
+ out.shift
+ assert_equal "Restored #{a.full_name}", out.shift
+ assert_empty out, out.inspect
+ end
+
+ def test_execute_no_extension
+ a = util_spec 'a' do |s| s.extensions << 'ext/a/extconf.rb' end
ext_path = File.join @tempdir, 'ext', 'a', 'extconf.rb'
write_file ext_path do |io|
@@ -90,9 +171,42 @@ class TestGemCommandsPristineCommand < Gem::TestCase
assert_empty out, out.inspect
end
+ def test_execute_with_extension_with_build_args
+ a = util_spec 'a' do |s| s.extensions << 'ext/a/extconf.rb' end
+
+ ext_path = File.join @tempdir, 'ext', 'a', 'extconf.rb'
+ write_file ext_path do |io|
+ io.write <<-'RUBY'
+ File.open "Makefile", "w" do |f|
+ f.puts "clean:\n\techo cleaned\n"
+ f.puts "all:\n\techo built\n"
+ f.puts "install:\n\techo installed\n"
+ end
+ RUBY
+ end
+
+ build_args = %w!--with-awesome=true --sweet!
+
+ install_gem a, :build_args => build_args
+
+ @cmd.options[:args] = %w[a]
+
+ use_ui @ui do
+ @cmd.execute
+ end
+
+ out = @ui.output.split "\n"
+
+ assert_equal 'Restoring gems to pristine condition...', out.shift
+ assert_equal "Building native extensions with: '--with-awesome=true --sweet'", out.shift
+ assert_equal "This could take a while...", out.shift
+ assert_equal "Restored #{a.full_name}", out.shift
+ assert_empty out, out.inspect
+ end
+
def test_execute_many
- a = quick_spec 'a'
- b = quick_spec 'b'
+ a = util_spec 'a'
+ b = util_spec 'b'
install_gem a
install_gem b
@@ -112,14 +226,14 @@ class TestGemCommandsPristineCommand < Gem::TestCase
end
def test_execute_many_multi_repo
- a = quick_spec 'a'
+ a = util_spec 'a'
install_gem a
Gem.clear_paths
gemhome2 = File.join @tempdir, 'gemhome2'
Gem.paths = { "GEM_PATH" => [gemhome2, @gemhome], "GEM_HOME" => gemhome2 }
- b = quick_spec 'b'
+ b = util_spec 'b'
install_gem b
@cmd.options[:args] = %w[a b]
@@ -142,24 +256,14 @@ class TestGemCommandsPristineCommand < Gem::TestCase
end
def test_execute_missing_cache_gem
- a_2 = quick_spec 'a', 2
- a_3 = quick_spec 'a', 3
-
- install_gem a_2
- install_gem a_3
-
- a_2_data = nil
- open File.join(@gemhome, 'cache', a_2.file_name), 'rb' do |fp|
- a_2_data = fp.read
+ specs = spec_fetcher do |fetcher|
+ fetcher.gem 'a', 1
+ fetcher.gem 'a', 2
+ fetcher.gem 'a', 3
+ fetcher.gem 'a', '3.a'
end
- util_setup_fake_fetcher
- util_setup_spec_fetcher a_2
-
- url = "http://gems.example.com/gems/#{a_2.file_name}"
- Gem::RemoteFetcher.fetcher.data[url] = a_2_data
-
- FileUtils.rm a_2.cache_file
+ FileUtils.rm specs['a-2'].cache_file
@cmd.options[:args] = %w[a]
@@ -195,5 +299,72 @@ class TestGemCommandsPristineCommand < Gem::TestCase
assert_match %r|at least one gem name|, e.message
end
+ def test_execute_only_executables
+ a = util_spec 'a' do |s|
+ s.executables = %w[foo]
+ s.files = %w[bin/foo lib/a.rb]
+ end
+ write_file File.join(@tempdir, 'lib', 'a.rb') do |fp|
+ fp.puts "puts __FILE__"
+ end
+ write_file File.join(@tempdir, 'bin', 'foo') do |fp|
+ fp.puts "#!/usr/bin/ruby"
+ end
+
+ install_gem a
+
+ gem_lib = File.join @gemhome, 'gems', a.full_name, 'lib', 'a.rb'
+ gem_exec = File.join @gemhome, 'bin', 'foo'
+
+ FileUtils.rm gem_exec
+ FileUtils.rm gem_lib
+
+ @cmd.handle_options %w[--all --only-executables]
+
+ use_ui @ui do
+ @cmd.execute
+ end
+
+ assert File.exist? gem_exec
+ refute File.exist? gem_lib
+ end
+
+ def test_execute_default_gem
+ default_gem_spec = new_default_spec("default", "2.0.0.0",
+ nil, "default/gem.rb")
+ install_default_specs(default_gem_spec)
+
+ @cmd.options[:args] = %w[default]
+
+ use_ui @ui do
+ @cmd.execute
+ end
+
+ assert_equal([
+ "Restoring gems to pristine condition...",
+ "Skipped default-2.0.0.0, it is a default gem",
+ ],
+ @ui.output.split("\n"))
+ assert_empty(@ui.error)
+ end
+
+ def test_handle_options
+ @cmd.handle_options %w[]
+
+ refute @cmd.options[:all]
+
+ assert @cmd.options[:extensions]
+ refute @cmd.options[:extensions_set]
+
+ assert_equal Gem::Requirement.default, @cmd.options[:version]
+ end
+
+ def test_handle_options_extensions
+ @cmd.handle_options %w[--extensions]
+
+ assert @cmd.options[:extensions]
+ assert @cmd.options[:extensions_set]
+ end
+
end
diff --git a/test/rubygems/test_gem_commands_push_command.rb b/test/rubygems/test_gem_commands_push_command.rb
index 13a107aaf3..7d3d2efb88 100644
--- a/test/rubygems/test_gem_commands_push_command.rb
+++ b/test/rubygems/test_gem_commands_push_command.rb
@@ -1,18 +1,13 @@
require 'rubygems/test_case'
require 'rubygems/commands/push_command'
-module Gem
- class << self; remove_method :latest_rubygems_version; end
-
- def self.latest_rubygems_version
- Gem::Version.new Gem::VERSION
- end
-end
-
class TestGemCommandsPushCommand < Gem::TestCase
def setup
super
+ ENV["RUBYGEMS_HOST"] = nil
+ Gem.host = Gem::DEFAULT_HOST
+ Gem.configuration.disable_default_gem_server = false
@gems_dir = File.join @tempdir, 'gems'
@cache_dir = File.join @gemhome, "cache"
@@ -23,54 +18,212 @@ class TestGemCommandsPushCommand < Gem::TestCase
"ed244fbf2b1a52e012da8616c512fa47f9aa5250"
@spec, @path = util_gem "freewill", "1.0.0"
+ @host = 'https://rubygems.example'
+ @api_key = Gem.configuration.rubygems_api_key
@fetcher = Gem::FakeFetcher.new
Gem::RemoteFetcher.fetcher = @fetcher
@cmd = Gem::Commands::PushCommand.new
+
+ class << Gem
+ alias_method :orig_latest_rubygems_version, :latest_rubygems_version
+
+ def latest_rubygems_version
+ Gem.rubygems_version
+ end
+ end
+ end
+
+ def teardown
+ super
+
+ class << Gem
+ remove_method :latest_rubygems_version
+ alias_method :latest_rubygems_version, :orig_latest_rubygems_version
+ end
end
def send_battery
use_ui @ui do
+ @cmd.instance_variable_set :@host, @host
@cmd.send_gem(@path)
end
- assert_match %r{Pushing gem to #{Gem.host}...}, @ui.output
+ assert_match %r{Pushing gem to #{@host}...}, @ui.output
assert_equal Net::HTTP::Post, @fetcher.last_request.class
assert_equal Gem.read_binary(@path), @fetcher.last_request.body
assert_equal File.size(@path), @fetcher.last_request["Content-Length"].to_i
assert_equal "application/octet-stream", @fetcher.last_request["Content-Type"]
- assert_equal Gem.configuration.rubygems_api_key, @fetcher.last_request["Authorization"]
+ assert_equal @api_key, @fetcher.last_request["Authorization"]
assert_match @response, @ui.output
end
- def test_sending_gem_default
+ def test_execute
@response = "Successfully registered gem: freewill (1.0.0)"
- @fetcher.data["#{Gem.host}/api/v1/gems"] = [@response, 200, 'OK']
+ @fetcher.data["#{Gem.host}/api/v1/gems"] = [@response, 200, 'OK']
- send_battery
+ @cmd.options[:args] = [@path]
+
+ @cmd.execute
+
+ assert_equal Net::HTTP::Post, @fetcher.last_request.class
+ assert_equal Gem.read_binary(@path), @fetcher.last_request.body
+ assert_equal "application/octet-stream",
+ @fetcher.last_request["Content-Type"]
end
- def test_sending_gem_host
+ def test_execute_host
+ host = 'https://other.example'
+
@response = "Successfully registered gem: freewill (1.0.0)"
- @fetcher.data["#{Gem.host}/api/v1/gems"] = [@response, 200, 'OK']
- @cmd.options[:host] = "#{Gem.host}"
+ @fetcher.data["#{host}/api/v1/gems"] = [@response, 200, 'OK']
+ @fetcher.data["#{Gem.host}/api/v1/gems"] =
+ ['fail', 500, 'Internal Server Error']
+
+ @cmd.options[:host] = host
+ @cmd.options[:args] = [@path]
+
+ @cmd.execute
+
+ assert_equal Net::HTTP::Post, @fetcher.last_request.class
+ assert_equal Gem.read_binary(@path), @fetcher.last_request.body
+ assert_equal "application/octet-stream",
+ @fetcher.last_request["Content-Type"]
+ end
+
+ def test_sending_when_default_host_disabled
+ Gem.configuration.disable_default_gem_server = true
+ response = "You must specify a gem server"
+
+ assert_raises Gem::MockGemUi::TermError do
+ use_ui @ui do
+ @cmd.send_gem(@path)
+ end
+ end
+
+ assert_match response, @ui.error
+ end
+
+ def test_sending_when_default_host_disabled_with_override
+ ENV["RUBYGEMS_HOST"] = @host
+ Gem.configuration.disable_default_gem_server = true
+ @response = "Successfully registered gem: freewill (1.0.0)"
+ @fetcher.data["#{@host}/api/v1/gems"] = [@response, 200, 'OK']
+
+ send_battery
+ end
+
+ def test_sending_gem_to_metadata_host
+ @host = "http://rubygems.engineyard.com"
+
+ @spec, @path = util_gem "freebird", "1.0.1" do |spec|
+ spec.metadata['default_gem_server'] = @host
+ end
+
+ @api_key = "EYKEY"
+
+ keys = {
+ :rubygems_api_key => 'KEY',
+ @host => @api_key
+ }
+
+ FileUtils.mkdir_p File.dirname Gem.configuration.credentials_path
+ open Gem.configuration.credentials_path, 'w' do |f|
+ f.write keys.to_yaml
+ end
+ Gem.configuration.load_api_keys
+ FileUtils.rm Gem.configuration.credentials_path
+
+ @response = "Successfully registered gem: freebird (1.0.1)"
+ @fetcher.data["#{@host}/api/v1/gems"] = [@response, 200, 'OK']
send_battery
end
- def test_sending_gem_ENV
+ def test_sending_gem
@response = "Successfully registered gem: freewill (1.0.0)"
- @fetcher.data["#{Gem.host}/api/v1/gems"] = [@response, 200, 'OK']
- ENV["RUBYGEMS_HOST"] = "#{Gem.host}"
+ @fetcher.data["#{@host}/api/v1/gems"] = [@response, 200, 'OK']
+
+ send_battery
+ end
+ def test_sending_gem_to_allowed_push_host
+ @host = "http://privategemserver.com"
+
+ @spec, @path = util_gem "freebird", "1.0.1" do |spec|
+ spec.metadata['allowed_push_host'] = @host
+ end
+
+ @api_key = "PRIVKEY"
+
+ keys = {
+ :rubygems_api_key => 'KEY',
+ @host => @api_key
+ }
+
+ FileUtils.mkdir_p File.dirname Gem.configuration.credentials_path
+ open Gem.configuration.credentials_path, 'w' do |f|
+ f.write keys.to_yaml
+ end
+ Gem.configuration.load_api_keys
+
+ FileUtils.rm Gem.configuration.credentials_path
+
+ @response = "Successfully registered gem: freebird (1.0.1)"
+ @fetcher.data["#{@host}/api/v1/gems"] = [@response, 200, 'OK']
send_battery
end
+ def test_sending_gem_to_disallowed_default_host
+ @spec, @path = util_gem "freebird", "1.0.1" do |spec|
+ spec.metadata['allowed_push_host'] = "https://privategemserver.com"
+ end
+
+ response = %{ERROR: "#{@host}" is not allowed by the gemspec, which only allows "https://privategemserver.com"}
+
+ assert_raises Gem::MockGemUi::TermError do
+ send_battery
+ end
+
+ assert_match response, @ui.error
+ end
+
+ def test_sending_gem_to_disallowed_push_host
+ @host = "https://somebodyelse.com"
+
+ @spec, @path = util_gem "freebird", "1.0.1" do |spec|
+ spec.metadata['allowed_push_host'] = "https://privategemserver.com"
+ end
+
+ @api_key = "PRIVKEY"
+
+ keys = {
+ :rubygems_api_key => 'KEY',
+ @host => @api_key
+ }
+
+ FileUtils.mkdir_p File.dirname Gem.configuration.credentials_path
+ open Gem.configuration.credentials_path, 'w' do |f|
+ f.write keys.to_yaml
+ end
+ Gem.configuration.load_api_keys
+
+ FileUtils.rm Gem.configuration.credentials_path
+
+ response = 'ERROR: "https://somebodyelse.com" is not allowed by the gemspec, which only allows "https://privategemserver.com"'
+
+ assert_raises Gem::MockGemUi::TermError do
+ send_battery
+ end
+
+ assert_match response, @ui.error
+ end
+
def test_raises_error_with_no_arguments
- def @cmd.sign_in; end
+ def @cmd.sign_in(*); end
assert_raises Gem::CommandLineError do
@cmd.execute
end
@@ -78,7 +231,8 @@ class TestGemCommandsPushCommand < Gem::TestCase
def test_sending_gem_denied
response = "You don't have permission to push to this gem"
- @fetcher.data["#{Gem.host}/api/v1/gems"] = [response, 403, 'Forbidden']
+ @fetcher.data["#{@host}/api/v1/gems"] = [response, 403, 'Forbidden']
+ @cmd.instance_variable_set :@host, @host
assert_raises Gem::MockGemUi::TermError do
use_ui @ui do
@@ -91,13 +245,14 @@ class TestGemCommandsPushCommand < Gem::TestCase
def test_sending_gem_key
@response = "Successfully registered gem: freewill (1.0.0)"
- @fetcher.data["#{Gem.host}/api/v1/gems"] = [@response, 200, "OK"]
+ @fetcher.data["#{@host}/api/v1/gems"] = [@response, 200, "OK"]
File.open Gem.configuration.credentials_path, 'a' do |f|
f.write ':other: 701229f217cdf23b1344c7b4b54ca97'
end
Gem.configuration.load_api_keys
@cmd.handle_options %w(-k other)
+ @cmd.instance_variable_set :@host, @host
@cmd.send_gem(@path)
assert_equal Gem.configuration.api_keys[:other],
diff --git a/test/rubygems/test_gem_commands_query_command.rb b/test/rubygems/test_gem_commands_query_command.rb
index e718c0bcbb..43fa82571d 100644
--- a/test/rubygems/test_gem_commands_query_command.rb
+++ b/test/rubygems/test_gem_commands_query_command.rb
@@ -8,9 +8,11 @@ class TestGemCommandsQueryCommand < Gem::TestCase
@cmd = Gem::Commands::QueryCommand.new
- util_setup_fake_fetcher
- util_clear_gems
- util_setup_spec_fetcher @a1, @a2, @pl1, @a3a
+ @specs = spec_fetcher do |fetcher|
+ fetcher.spec 'a', 1
+ fetcher.spec 'a', 2
+ fetcher.spec 'a', '3.a'
+ end
@fetcher.data["#{@gem_repo}Marshal.#{Gem.marshal_version}"] = proc do
raise Gem::RemoteFetcher::FetchError
@@ -18,6 +20,10 @@ class TestGemCommandsQueryCommand < Gem::TestCase
end
def test_execute
+ spec_fetcher do |fetcher|
+ fetcher.legacy_platform
+ end
+
@cmd.handle_options %w[-r]
use_ui @ui do
@@ -37,13 +43,18 @@ pl (1 i386-linux)
end
def test_execute_platform
- @a1r = @a1.dup
+ spec_fetcher do |fetcher|
+ fetcher.clear
- @a1.platform = 'x86-linux'
- @a2.platform = 'universal-darwin'
+ fetcher.spec 'a', 1
+ fetcher.spec 'a', 1 do |s|
+ s.platform = 'x86-linux'
+ end
- util_clear_gems
- util_setup_spec_fetcher @a1, @a1r, @a2, @b2, @pl1
+ fetcher.spec 'a', 2 do |s|
+ s.platform = 'universal-darwin'
+ end
+ end
@cmd.handle_options %w[-r -a]
@@ -56,8 +67,6 @@ pl (1 i386-linux)
*** REMOTE GEMS ***
a (2 universal-darwin, 1 ruby x86-linux)
-b (2)
-pl (1 i386-linux)
EOF
assert_equal expected, @ui.output
@@ -65,6 +74,10 @@ pl (1 i386-linux)
end
def test_execute_all
+ spec_fetcher do |fetcher|
+ fetcher.legacy_platform
+ end
+
@cmd.handle_options %w[-r --all]
use_ui @ui do
@@ -84,6 +97,10 @@ pl (1 i386-linux)
end
def test_execute_all_prerelease
+ spec_fetcher do |fetcher|
+ fetcher.legacy_platform
+ end
+
@cmd.handle_options %w[-r --all --prerelease]
use_ui @ui do
@@ -103,13 +120,15 @@ pl (1 i386-linux)
end
def test_execute_details
- @a2.summary = 'This is a lot of text. ' * 4
- @a2.authors = ['Abraham Lincoln', 'Hirohito']
- @a2.homepage = 'http://a.example.com/'
- @a2.rubyforge_project = 'rubygems'
+ spec_fetcher do |fetcher|
+ fetcher.spec 'a', 2 do |s|
+ s.summary = 'This is a lot of text. ' * 4
+ s.authors = ['Abraham Lincoln', 'Hirohito']
+ s.homepage = 'http://a.example.com/'
+ end
- util_clear_gems
- util_setup_spec_fetcher @a1, @a2, @pl1
+ fetcher.legacy_platform
+ end
@cmd.handle_options %w[-r -d]
@@ -123,7 +142,6 @@ pl (1 i386-linux)
a (2)
Authors: Abraham Lincoln, Hirohito
- Rubyforge: http://rubyforge.org/projects/rubygems
Homepage: http://a.example.com/
This is a lot of text. This is a lot of text. This is a lot of text.
@@ -142,16 +160,22 @@ pl (1)
end
def test_execute_details_platform
- @a1.platform = 'x86-linux'
+ spec_fetcher do |fetcher|
+ fetcher.clear
+
+ fetcher.spec 'a', 1 do |s|
+ s.platform = 'x86-linux'
+ end
- @a2.summary = 'This is a lot of text. ' * 4
- @a2.authors = ['Abraham Lincoln', 'Hirohito']
- @a2.homepage = 'http://a.example.com/'
- @a2.rubyforge_project = 'rubygems'
- @a2.platform = 'universal-darwin'
+ fetcher.spec 'a', 2 do |s|
+ s.summary = 'This is a lot of text. ' * 4
+ s.authors = ['Abraham Lincoln', 'Hirohito']
+ s.homepage = 'http://a.example.com/'
+ s.platform = 'universal-darwin'
+ end
- util_clear_gems
- util_setup_spec_fetcher @a1, @a2, @pl1
+ fetcher.legacy_platform
+ end
@cmd.handle_options %w[-r -d]
@@ -168,7 +192,6 @@ a (2, 1)
1: x86-linux
2: universal-darwin
Authors: Abraham Lincoln, Hirohito
- Rubyforge: http://rubyforge.org/projects/rubygems
Homepage: http://a.example.com/
This is a lot of text. This is a lot of text. This is a lot of text.
@@ -199,6 +222,34 @@ pl (1)
assert_equal '', @ui.error
end
+ def test_execute_installed_inverse
+ @cmd.handle_options %w[-n a --no-installed]
+
+ e = assert_raises Gem::MockGemUi::TermError do
+ use_ui @ui do
+ @cmd.execute
+ end
+ end
+
+ assert_equal "false\n", @ui.output
+ assert_equal '', @ui.error
+
+ assert_equal 1, e.exit_code
+ end
+
+ def test_execute_installed_inverse_not_installed
+ @cmd.handle_options %w[-n not_installed --no-installed]
+
+ assert_raises Gem::MockGemUi::SystemExitException do
+ use_ui @ui do
+ @cmd.execute
+ end
+ end
+
+ assert_equal "true\n", @ui.output
+ assert_equal '', @ui.error
+ end
+
def test_execute_installed_no_name
@cmd.handle_options %w[--installed]
@@ -257,7 +308,34 @@ pl (1)
assert_equal 1, e.exit_code
end
+ def test_execute_local
+ spec_fetcher do |fetcher|
+ fetcher.legacy_platform
+ end
+
+ @cmd.options[:domain] = :local
+
+ use_ui @ui do
+ @cmd.execute
+ end
+
+ expected = <<-EOF
+
+*** LOCAL GEMS ***
+
+a (3.a, 2, 1)
+pl (1 i386-linux)
+ EOF
+
+ assert_equal expected, @ui.output
+ assert_equal '', @ui.error
+ end
+
def test_execute_local_notty
+ spec_fetcher do |fetcher|
+ fetcher.legacy_platform
+ end
+
@cmd.handle_options %w[]
@ui.outs.tty = false
@@ -275,7 +353,32 @@ pl (1 i386-linux)
assert_equal '', @ui.error
end
+ def test_execute_local_quiet
+ spec_fetcher do |fetcher|
+ fetcher.legacy_platform
+ end
+
+ @cmd.options[:domain] = :local
+ Gem.configuration.verbose = false
+
+ use_ui @ui do
+ @cmd.execute
+ end
+
+ expected = <<-EOF
+a (3.a, 2, 1)
+pl (1 i386-linux)
+ EOF
+
+ assert_equal expected, @ui.output
+ assert_equal '', @ui.error
+ end
+
def test_execute_no_versions
+ spec_fetcher do |fetcher|
+ fetcher.legacy_platform
+ end
+
@cmd.handle_options %w[-r --no-versions]
use_ui @ui do
@@ -295,6 +398,10 @@ pl
end
def test_execute_notty
+ spec_fetcher do |fetcher|
+ fetcher.legacy_platform
+ end
+
@cmd.handle_options %w[-r]
@ui.outs.tty = false
@@ -331,6 +438,10 @@ a (3.a)
end
def test_execute_prerelease_local
+ spec_fetcher do |fetcher|
+ fetcher.legacy_platform
+ end
+
@cmd.handle_options %w[-l --prerelease]
use_ui @ui do
@@ -349,5 +460,209 @@ pl (1 i386-linux)
assert_equal "WARNING: prereleases are always shown locally\n", @ui.error
end
+ def test_execute_remote
+ spec_fetcher do |fetcher|
+ fetcher.legacy_platform
+ end
+
+ @cmd.options[:domain] = :remote
+
+ use_ui @ui do
+ @cmd.execute
+ end
+
+ expected = <<-EOF
+
+*** REMOTE GEMS ***
+
+a (2)
+pl (1 i386-linux)
+ EOF
+
+ assert_equal expected, @ui.output
+ assert_equal '', @ui.error
+ end
+
+ def test_execute_remote_notty
+ spec_fetcher do |fetcher|
+ fetcher.legacy_platform
+ end
+
+ @cmd.handle_options %w[]
+
+ @ui.outs.tty = false
+
+ use_ui @ui do
+ @cmd.execute
+ end
+
+ expected = <<-EOF
+a (3.a, 2, 1)
+pl (1 i386-linux)
+ EOF
+
+ assert_equal expected, @ui.output
+ assert_equal '', @ui.error
+ end
+
+ def test_execute_remote_quiet
+ spec_fetcher do |fetcher|
+ fetcher.legacy_platform
+ end
+
+ @cmd.options[:domain] = :remote
+ Gem.configuration.verbose = false
+
+ use_ui @ui do
+ @cmd.execute
+ end
+
+ expected = <<-EOF
+a (2)
+pl (1 i386-linux)
+ EOF
+
+ assert_equal expected, @ui.output
+ assert_equal '', @ui.error
+ end
+
+ def test_execute_local_details
+ spec_fetcher do |fetcher|
+ fetcher.clear
+
+ fetcher.spec 'a', 1 do |s|
+ s.platform = 'x86-linux'
+ end
+
+ fetcher.spec 'a', 2 do |s|
+ s.summary = 'This is a lot of text. ' * 4
+ s.authors = ['Abraham Lincoln', 'Hirohito']
+ s.homepage = 'http://a.example.com/'
+ s.platform = 'universal-darwin'
+ end
+
+ fetcher.legacy_platform
+ end
+
+ @cmd.handle_options %w[-l -d]
+
+ use_ui @ui do
+ @cmd.execute
+ end
+
+ str = @ui.output
+
+ str.gsub!(/\(\d\): [^\n]*/, "-")
+ str.gsub!(/at: [^\n]*/, "at: -")
+
+ expected = <<-EOF
+
+*** LOCAL GEMS ***
+
+a (2, 1)
+ Platforms:
+ 1: x86-linux
+ 2: universal-darwin
+ Authors: Abraham Lincoln, Hirohito
+ Homepage: http://a.example.com/
+ Installed at -
+ -
+
+ This is a lot of text. This is a lot of text. This is a lot of text.
+ This is a lot of text.
+
+pl (1)
+ Platform: i386-linux
+ Author: A User
+ Homepage: http://example.com
+ Installed at: -
+
+ this is a summary
+ EOF
+
+ assert_equal expected, @ui.output
+ end
+
+ def test_execute_default_details
+ spec_fetcher do |fetcher|
+ fetcher.clear
+
+ fetcher.spec 'a', 2
+ end
+
+ a1 = new_default_spec 'a', 1
+ install_default_specs a1
+
+ @cmd.handle_options %w[-l -d]
+
+ use_ui @ui do
+ @cmd.execute
+ end
+
+ expected = <<-EOF
+
+*** LOCAL GEMS ***
+
+a (2, 1)
+ Author: A User
+ Homepage: http://example.com
+ Installed at (2): #{@gemhome}
+ (1, default): #{a1.base_dir}
+
+ this is a summary
+ EOF
+
+ assert_equal expected, @ui.output
+ end
+
+ def test_make_entry
+ a_2_name = @specs['a-2'].original_name
+
+ @fetcher.data.delete \
+ "#{@gem_repo}quick/Marshal.#{Gem.marshal_version}/#{a_2_name}.gemspec.rz"
+
+ a2 = @specs['a-2']
+ entry_tuples = [
+ [Gem::NameTuple.new(a2.name, a2.version, a2.platform),
+ Gem.sources.first],
+ ]
+
+ platforms = { a2.version => [a2.platform] }
+
+ entry = @cmd.send :make_entry, entry_tuples, platforms
+
+ assert_equal 'a (2)', entry
+ end
+
+ # Test for multiple args handling!
+ def test_execute_multiple_args
+ spec_fetcher do |fetcher|
+ fetcher.legacy_platform
+ end
+
+ @cmd.handle_options %w[a pl]
+
+ use_ui @ui do
+ @cmd.execute
+ end
+
+ assert_match %r%^a %, @ui.output
+ assert_match %r%^pl %, @ui.output
+ assert_equal '', @ui.error
+ end
+
+ def test_show_gems
+ @cmd.options[:name] = //
+ @cmd.options[:domain] = :remote
+
+ use_ui @ui do
+ @cmd.send :show_gems, /a/i, false
+ end
+
+ assert_match %r%^a %, @ui.output
+ refute_match %r%^pl %, @ui.output
+ assert_empty @ui.error
+ end
+
end
diff --git a/test/rubygems/test_gem_commands_search_command.rb b/test/rubygems/test_gem_commands_search_command.rb
new file mode 100644
index 0000000000..fb8debc245
--- /dev/null
+++ b/test/rubygems/test_gem_commands_search_command.rb
@@ -0,0 +1,17 @@
+require 'rubygems/test_case'
+require 'rubygems/commands/search_command'
+
+class TestGemCommandsSearchCommand < Gem::TestCase
+
+ def setup
+ super
+
+ @cmd = Gem::Commands::SearchCommand.new
+ end
+
+ def test_initialize
+ assert_equal :remote, @cmd.defaults[:domain]
+ end
+
+end
+
diff --git a/test/rubygems/test_gem_commands_setup_command.rb b/test/rubygems/test_gem_commands_setup_command.rb
new file mode 100644
index 0000000000..9c5ee7a5a8
--- /dev/null
+++ b/test/rubygems/test_gem_commands_setup_command.rb
@@ -0,0 +1,129 @@
+# coding: UTF-8
+
+require 'rubygems/test_case'
+require 'rubygems/commands/setup_command'
+
+class TestGemCommandsSetupCommand < Gem::TestCase
+
+ def setup
+ super
+
+ @install_dir = File.join @tempdir, 'install'
+ @cmd = Gem::Commands::SetupCommand.new
+ @cmd.options[:prefix] = @install_dir
+
+ FileUtils.mkdir_p 'bin'
+ FileUtils.mkdir_p 'lib/rubygems/ssl_certs'
+
+ open 'bin/gem', 'w' do |io| io.puts '# gem' end
+ open 'lib/rubygems.rb', 'w' do |io| io.puts '# rubygems.rb' end
+ open 'lib/rubygems/test_case.rb', 'w' do |io| io.puts '# test_case.rb' end
+ open 'lib/rubygems/ssl_certs/foo.pem', 'w' do |io| io.puts 'PEM' end
+ end
+
+ def test_pem_files_in
+ assert_equal %w[rubygems/ssl_certs/foo.pem],
+ @cmd.pem_files_in('lib').sort
+ end
+
+ def test_rb_files_in
+ assert_equal %w[rubygems.rb rubygems/test_case.rb],
+ @cmd.rb_files_in('lib').sort
+ end
+
+ def test_install_lib
+ @cmd.extend FileUtils
+
+ Dir.mktmpdir 'lib' do |dir|
+ @cmd.install_lib dir
+
+ assert_path_exists File.join(dir, 'rubygems.rb')
+ assert_path_exists File.join(dir, 'rubygems/ssl_certs/foo.pem')
+ end
+ end
+
+ def test_remove_old_lib_files
+ lib = File.join @install_dir, 'lib'
+ lib_rubygems = File.join lib, 'rubygems'
+ lib_rubygems_defaults = File.join lib_rubygems, 'defaults'
+
+ securerandom_rb = File.join lib, 'securerandom.rb'
+
+ engine_defaults_rb = File.join lib_rubygems_defaults, 'jruby.rb'
+ os_defaults_rb = File.join lib_rubygems_defaults, 'operating_system.rb'
+
+ old_builder_rb = File.join lib_rubygems, 'builder.rb'
+ old_format_rb = File.join lib_rubygems, 'format.rb'
+
+ FileUtils.mkdir_p lib_rubygems_defaults
+
+ open securerandom_rb, 'w' do |io| io.puts '# securerandom.rb' end
+
+ open old_builder_rb, 'w' do |io| io.puts '# builder.rb' end
+ open old_format_rb, 'w' do |io| io.puts '# format.rb' end
+
+ open engine_defaults_rb, 'w' do |io| io.puts '# jruby.rb' end
+ open os_defaults_rb, 'w' do |io| io.puts '# operating_system.rb' end
+
+ @cmd.remove_old_lib_files lib
+
+ refute_path_exists old_builder_rb
+ refute_path_exists old_format_rb
+
+ assert_path_exists securerandom_rb
+ assert_path_exists engine_defaults_rb
+ assert_path_exists os_defaults_rb
+ end
+
+ def test_show_release_notes
+ @default_external = nil
+ capture_io do
+ @default_external, Encoding.default_external =
+ Encoding.default_external, Encoding::US_ASCII
+ end if Object.const_defined? :Encoding
+
+ @cmd.options[:previous_version] = Gem::Version.new '2.0.2'
+
+ open 'History.txt', 'w' do |io|
+ io.puts <<-History_txt
+# coding: UTF-8
+
+=== #{Gem::VERSION} / 2013-03-26
+
+* Bug fixes:
+ * Fixed release note display for LANG=C when installing rubygems
+ * π is tasty
+
+=== 2.0.2 / 2013-03-06
+
+* Bug fixes:
+ * Other bugs fixed
+
+=== 2.0.1 / 2013-03-05
+
+* Bug fixes:
+ * Yet more bugs fixed
+ History_txt
+ end
+
+ use_ui @ui do
+ @cmd.show_release_notes
+ end
+
+ expected = <<-EXPECTED
+=== 2.0.2 / 2013-03-06
+
+* Bug fixes:
+ * Other bugs fixed
+
+ EXPECTED
+
+ assert_equal expected, @ui.output
+ ensure
+ capture_io do
+ Encoding.default_external = @default_external
+ end if @default_external
+ end
+
+end
+
diff --git a/test/rubygems/test_gem_commands_sources_command.rb b/test/rubygems/test_gem_commands_sources_command.rb
index 8b439025ed..8ee0fd3cb7 100644
--- a/test/rubygems/test_gem_commands_sources_command.rb
+++ b/test/rubygems/test_gem_commands_sources_command.rb
@@ -6,7 +6,7 @@ class TestGemCommandsSourcesCommand < Gem::TestCase
def setup
super
- util_setup_fake_fetcher
+ spec_fetcher
@cmd = Gem::Commands::SourcesCommand.new
@@ -18,7 +18,6 @@ class TestGemCommandsSourcesCommand < Gem::TestCase
end
def test_execute
- util_setup_spec_fetcher
@cmd.handle_options []
use_ui @ui do
@@ -36,9 +35,9 @@ class TestGemCommandsSourcesCommand < Gem::TestCase
end
def test_execute_add
- util_setup_fake_fetcher
-
- install_specs @a1
+ spec_fetcher do |fetcher|
+ fetcher.spec 'a', 1
+ end
specs = Gem::Specification.map { |spec|
[spec.name, spec.version, spec.original_platform]
@@ -54,8 +53,6 @@ class TestGemCommandsSourcesCommand < Gem::TestCase
@cmd.handle_options %W[--add #{@new_repo}]
- util_setup_spec_fetcher
-
use_ui @ui do
@cmd.execute
end
@@ -71,19 +68,13 @@ class TestGemCommandsSourcesCommand < Gem::TestCase
end
def test_execute_add_nonexistent_source
- util_setup_fake_fetcher
-
uri = "http://beta-gems.example.com/specs.#{@marshal_version}.gz"
@fetcher.data[uri] = proc do
raise Gem::RemoteFetcher::FetchError.new('it died', uri)
end
- Gem::RemoteFetcher.fetcher = @fetcher
-
@cmd.handle_options %w[--add http://beta-gems.example.com]
- util_setup_spec_fetcher
-
use_ui @ui do
assert_raises Gem::MockGemUi::TermError do
@cmd.execute
@@ -99,11 +90,64 @@ Error fetching http://beta-gems.example.com:
assert_equal '', @ui.error
end
+ def test_execute_add_redundant_source
+ @cmd.handle_options %W[--add #{@gem_repo}]
+
+ use_ui @ui do
+ @cmd.execute
+ end
+
+ assert_equal [@gem_repo], Gem.sources
+
+ expected = <<-EOF
+source #{@gem_repo} already present in the cache
+ EOF
+
+ assert_equal expected, @ui.output
+ assert_equal '', @ui.error
+ end
+
+ def test_execute_add_http_rubygems_org
+ http_rubygems_org = 'http://rubygems.org'
+
+ spec_fetcher do |fetcher|
+ fetcher.spec 'a', 1
+ end
+
+ specs = Gem::Specification.map { |spec|
+ [spec.name, spec.version, spec.original_platform]
+ }
+
+ specs_dump_gz = StringIO.new
+ Zlib::GzipWriter.wrap specs_dump_gz do |io|
+ Marshal.dump specs, io
+ end
+
+ @fetcher.data["#{http_rubygems_org}/specs.#{@marshal_version}.gz"] =
+ specs_dump_gz.string
+
+ @cmd.handle_options %W[--add #{http_rubygems_org}]
+
+ ui = Gem::MockGemUi.new "n"
+
+ use_ui ui do
+ assert_raises Gem::MockGemUi::TermError do
+ @cmd.execute
+ end
+ end
+
+ assert_equal [@gem_repo], Gem.sources
+
+ expected = <<-EXPECTED
+ EXPECTED
+
+ assert_equal expected, @ui.output
+ assert_empty @ui.error
+ end
+
def test_execute_add_bad_uri
@cmd.handle_options %w[--add beta-gems.example.com]
- util_setup_spec_fetcher
-
use_ui @ui do
assert_raises Gem::MockGemUi::TermError do
@cmd.execute
@@ -123,32 +167,41 @@ beta-gems.example.com is not a URI
def test_execute_clear_all
@cmd.handle_options %w[--clear-all]
- util_setup_spec_fetcher
+ use_ui @ui do
+ @cmd.execute
+ end
+
+ expected = <<-EOF
+*** Removed specs cache ***
+ EOF
+
+ assert_equal expected, @ui.output
+ assert_equal '', @ui.error
- fetcher = Gem::SpecFetcher.fetcher
+ dir = Gem.spec_cache_dir
+ refute File.exist?(dir), 'cache dir removed'
+ end
- # HACK figure out how to force directory creation via fetcher
- #assert File.directory?(fetcher.dir), 'cache dir exists'
+ def test_execute_list
+ @cmd.handle_options %w[--list]
use_ui @ui do
@cmd.execute
end
expected = <<-EOF
-*** Removed specs cache ***
+*** CURRENT SOURCES ***
+
+#{@gem_repo}
EOF
assert_equal expected, @ui.output
assert_equal '', @ui.error
-
- refute File.exist?(fetcher.dir), 'cache dir removed'
end
def test_execute_remove
@cmd.handle_options %W[--remove #{@gem_repo}]
- util_setup_spec_fetcher
-
use_ui @ui do
@cmd.execute
end
@@ -162,8 +215,6 @@ beta-gems.example.com is not a URI
def test_execute_remove_no_network
@cmd.handle_options %W[--remove #{@gem_repo}]
- util_setup_fake_fetcher
-
@fetcher.data["#{@gem_repo}Marshal.#{Gem.marshal_version}"] = proc do
raise Gem::RemoteFetcher::FetchError
end
@@ -181,22 +232,9 @@ beta-gems.example.com is not a URI
def test_execute_update
@cmd.handle_options %w[--update]
- util_setup_fake_fetcher
- util_setup_spec_fetcher @a1
-
- specs = Gem::Specification.map { |spec|
- [spec.name, spec.version, spec.original_platform]
- }
-
- @fetcher.data["#{@gem_repo}specs.#{Gem.marshal_version}.gz"] =
- util_gzip Marshal.dump(specs)
-
- latest_specs = Gem::Specification.latest_specs.map { |spec|
- [spec.name, spec.version, spec.original_platform]
- }
-
- @fetcher.data["#{@gem_repo}latest_specs.#{Gem.marshal_version}.gz"] =
- util_gzip Marshal.dump(latest_specs)
+ spec_fetcher do |fetcher|
+ fetcher.gem 'a', 1
+ end
use_ui @ui do
@cmd.execute
diff --git a/test/rubygems/test_gem_commands_specification_command.rb b/test/rubygems/test_gem_commands_specification_command.rb
index 978c6fe194..80564f9dce 100644
--- a/test/rubygems/test_gem_commands_specification_command.rb
+++ b/test/rubygems/test_gem_commands_specification_command.rb
@@ -10,7 +10,7 @@ class TestGemCommandsSpecificationCommand < Gem::TestCase
end
def test_execute
- foo = quick_spec 'foo'
+ foo = util_spec 'foo'
install_specs foo
@@ -26,8 +26,8 @@ class TestGemCommandsSpecificationCommand < Gem::TestCase
end
def test_execute_all
- quick_spec 'foo', '0.0.1'
- quick_spec 'foo', '0.0.2'
+ util_spec 'foo', '0.0.1'
+ util_spec 'foo', '0.0.2'
@cmd.options[:args] = %w[foo]
@cmd.options[:all] = true
@@ -44,8 +44,8 @@ class TestGemCommandsSpecificationCommand < Gem::TestCase
end
def test_execute_all_conflicts_with_version
- quick_spec 'foo', '0.0.1'
- quick_spec 'foo', '0.0.2'
+ util_spec 'foo', '0.0.1'
+ util_spec 'foo', '0.0.2'
@cmd.options[:args] = %w[foo]
@cmd.options[:all] = true
@@ -71,12 +71,26 @@ class TestGemCommandsSpecificationCommand < Gem::TestCase
end
assert_equal '', @ui.output
- assert_equal "ERROR: Unknown gem 'foo'\n", @ui.error
+ assert_equal "ERROR: No gem matching 'foo (>= 0)' found\n", @ui.error
+ end
+
+ def test_execute_bad_name_with_version
+ @cmd.options[:args] = %w[foo]
+ @cmd.options[:version] = "1.3.2"
+
+ assert_raises Gem::MockGemUi::TermError do
+ use_ui @ui do
+ @cmd.execute
+ end
+ end
+
+ assert_equal '', @ui.output
+ assert_equal "ERROR: No gem matching 'foo (= 1.3.2)' found\n", @ui.error
end
def test_execute_exact_match
- quick_spec 'foo'
- quick_spec 'foo_bar'
+ util_spec 'foo'
+ util_spec 'foo_bar'
@cmd.options[:args] = %w[foo]
@@ -103,6 +117,24 @@ class TestGemCommandsSpecificationCommand < Gem::TestCase
assert_equal "foo", YAML.load(@ui.output)
end
+ def test_execute_file
+ foo = util_spec 'foo' do |s|
+ s.files = %w[lib/code.rb]
+ end
+
+ util_build_gem foo
+
+ @cmd.options[:args] = [foo.cache_file]
+
+ use_ui @ui do
+ @cmd.execute
+ end
+
+ assert_match %r|Gem::Specification|, @ui.output
+ assert_match %r|name: foo|, @ui.output
+ assert_equal '', @ui.error
+ end
+
def test_execute_marshal
foo = new_spec 'foo', '2'
@@ -120,14 +152,9 @@ class TestGemCommandsSpecificationCommand < Gem::TestCase
end
def test_execute_remote
- foo = quick_gem 'foo'
-
- @fetcher = Gem::FakeFetcher.new
- Gem::RemoteFetcher.fetcher = @fetcher
-
- util_setup_spec_fetcher foo
-
- FileUtils.rm File.join(@gemhome, 'specifications', foo.spec_name)
+ spec_fetcher do |fetcher|
+ fetcher.spec 'foo', 1
+ end
@cmd.options[:args] = %w[foo]
@cmd.options[:domain] = :remote
@@ -141,16 +168,10 @@ class TestGemCommandsSpecificationCommand < Gem::TestCase
end
def test_execute_remote_with_version
- foo1 = quick_gem 'foo', "1"
- foo2 = quick_gem 'foo', "2"
-
- @fetcher = Gem::FakeFetcher.new
- Gem::RemoteFetcher.fetcher = @fetcher
-
- util_setup_spec_fetcher foo1, foo2
-
- FileUtils.rm File.join(@gemhome, 'specifications', foo1.spec_name)
- FileUtils.rm File.join(@gemhome, 'specifications', foo2.spec_name)
+ spec_fetcher do |fetcher|
+ fetcher.spec 'foo', "1"
+ fetcher.spec 'foo', "2"
+ end
@cmd.options[:args] = %w[foo]
@cmd.options[:version] = "1"
@@ -166,16 +187,10 @@ class TestGemCommandsSpecificationCommand < Gem::TestCase
end
def test_execute_remote_without_prerelease
- foo = new_spec 'foo', '2.0.0'
- foo_pre = new_spec 'foo', '2.0.1.pre'
-
- install_specs foo, foo_pre
-
- @fetcher = Gem::FakeFetcher.new
- Gem::RemoteFetcher.fetcher = @fetcher
-
- util_setup_spec_fetcher foo
- util_setup_spec_fetcher foo_pre
+ spec_fetcher do |fetcher|
+ fetcher.spec 'foo', '2.0.0'
+ fetcher.spec 'foo', '2.0.1.pre'
+ end
@cmd.options[:args] = %w[foo]
@cmd.options[:domain] = :remote
@@ -193,16 +208,10 @@ class TestGemCommandsSpecificationCommand < Gem::TestCase
end
def test_execute_remote_with_prerelease
- foo = new_spec 'foo', '2.0.0'
- foo_pre = new_spec 'foo', '2.0.1.pre'
-
- install_specs foo, foo_pre
-
- @fetcher = Gem::FakeFetcher.new
- Gem::RemoteFetcher.fetcher = @fetcher
-
- util_setup_spec_fetcher foo
- util_setup_spec_fetcher foo_pre
+ spec_fetcher do |fetcher|
+ fetcher.spec 'foo', '2.0.0'
+ fetcher.spec 'foo', '2.0.1.pre'
+ end
@cmd.options[:args] = %w[foo]
@cmd.options[:domain] = :remote
@@ -221,7 +230,7 @@ class TestGemCommandsSpecificationCommand < Gem::TestCase
end
def test_execute_ruby
- foo = quick_spec 'foo'
+ foo = util_spec 'foo'
install_specs foo
diff --git a/test/rubygems/test_gem_commands_stale_command.rb b/test/rubygems/test_gem_commands_stale_command.rb
index 74f730bfa5..ca80784749 100644
--- a/test/rubygems/test_gem_commands_stale_command.rb
+++ b/test/rubygems/test_gem_commands_stale_command.rb
@@ -10,11 +10,11 @@ class TestGemCommandsStaleCommand < Gem::TestCase
def test_execute_sorts
files = %w[lib/foo_bar.rb Rakefile]
- foo_bar = quick_spec 'foo_bar' do |gem|
+ foo_bar = util_spec 'foo_bar' do |gem|
gem.files = files
end
- bar_baz = quick_spec 'bar_baz' do |gem|
+ bar_baz = util_spec 'bar_baz' do |gem|
gem.files = files
end
diff --git a/test/rubygems/test_gem_commands_uninstall_command.rb b/test/rubygems/test_gem_commands_uninstall_command.rb
index 1db6146889..6f9ec104a5 100644
--- a/test/rubygems/test_gem_commands_uninstall_command.rb
+++ b/test/rubygems/test_gem_commands_uninstall_command.rb
@@ -13,53 +13,66 @@ class TestGemCommandsUninstallCommand < Gem::InstallerTestCase
end
@cmd = Gem::Commands::UninstallCommand.new
- @cmd.options[:executables] = true
@executable = File.join(@gemhome, 'bin', 'executable')
end
- def test_execute_mulitple
- @other = quick_gem 'c'
- util_make_exec @other
- util_build_gem @other
+ def test_execute_all_named
+ util_make_gems
- @other_installer = util_installer @other, @gemhome
+ default = new_default_spec 'default', '1'
+ install_default_gems default
- ui = Gem::MockGemUi.new
- util_setup_gem ui
+ gemhome2 = "#{@gemhome}2"
- build_rake_in do
- use_ui ui do
- @other_installer.install
- end
- end
+ a_4 = util_spec 'a', 4
+ install_gem a_4, :install_dir => gemhome2
+
+ Gem::Specification.dirs = [@gemhome, gemhome2]
+
+ assert_includes Gem::Specification.all_names, 'a-1'
+ assert_includes Gem::Specification.all_names, 'a-4'
+ assert_includes Gem::Specification.all_names, 'b-2'
+ assert_includes Gem::Specification.all_names, 'default-1'
- @cmd.options[:args] = [@spec.name, @other.name]
+ @cmd.options[:all] = true
+ @cmd.options[:args] = %w[a]
use_ui @ui do
@cmd.execute
end
- output = @ui.output.split "\n"
-
- assert_includes output, "Successfully uninstalled #{@spec.full_name}"
- assert_includes output, "Successfully uninstalled #{@other.full_name}"
+ assert_equal %w[a-4 a_evil-9 b-2 c-1.2 default-1 dep_x-1 pl-1-x86-linux x-1],
+ Gem::Specification.all_names.sort
end
- def test_execute_mulitple_nonexistent
- @cmd.options[:args] = %w[x y]
+ def test_execute_dependency_order
+ c = quick_gem 'c' do |spec|
+ spec.add_dependency 'a'
+ end
- use_ui @ui do
+ util_build_gem c
+ installer = util_installer c, @gemhome
+ use_ui @ui do installer.install end
+
+ ui = Gem::MockGemUi.new
+
+ @cmd.options[:args] = %w[a c]
+ @cmd.options[:executables] = true
+
+ use_ui ui do
@cmd.execute
end
- output = @ui.output.split "\n"
+ output = ui.output.split "\n"
- assert_includes output, 'INFO: gem "x" is not installed'
- assert_includes output, 'INFO: gem "y" is not installed'
+ assert_equal 'Successfully uninstalled c-2', output.shift
+ assert_equal "Removing executable", output.shift
+ assert_equal 'Successfully uninstalled a-2', output.shift
end
def test_execute_removes_executable
ui = Gem::MockGemUi.new
+
util_setup_gem ui
build_rake_in do
@@ -79,6 +92,7 @@ class TestGemCommandsUninstallCommand < Gem::InstallerTestCase
open @executable, "wb+" do |f| f.puts "binary" end
+ @cmd.options[:executables] = true
@cmd.options[:args] = [@spec.name]
use_ui @ui do
@cmd.execute
@@ -102,6 +116,7 @@ class TestGemCommandsUninstallCommand < Gem::InstallerTestCase
formatted_executable = File.join @gemhome, 'bin', 'foo-executable-bar'
assert_equal true, File.exist?(formatted_executable)
+ @cmd.options[:executables] = true
@cmd.options[:format_executable] = true
@cmd.execute
@@ -111,7 +126,7 @@ class TestGemCommandsUninstallCommand < Gem::InstallerTestCase
end
def test_execute_prerelease
- @spec = quick_spec "pre", "2.b"
+ @spec = util_spec "pre", "2.b"
@gem = File.join @tempdir, @spec.file_name
FileUtils.touch @gem
@@ -123,6 +138,7 @@ class TestGemCommandsUninstallCommand < Gem::InstallerTestCase
end
end
+ @cmd.options[:executables] = true
@cmd.options[:args] = ["pre"]
use_ui @ui do
@@ -133,5 +149,97 @@ class TestGemCommandsUninstallCommand < Gem::InstallerTestCase
assert_match(/Successfully uninstalled/, output)
end
+ def test_execute_with_force_leaves_executable
+ ui = Gem::MockGemUi.new
+
+ util_make_gems
+ util_setup_gem ui
+
+ @cmd.options[:version] = '1'
+ @cmd.options[:force] = true
+ @cmd.options[:args] = ['a']
+
+ use_ui ui do
+ @cmd.execute
+ end
+
+ assert !Gem::Specification.all_names.include?('a')
+ assert File.exist? File.join(@gemhome, 'bin', 'executable')
+ end
+
+ def test_execute_with_force_uninstalls_all_versions
+ ui = Gem::MockGemUi.new "y\n"
+
+ util_make_gems
+ util_setup_gem ui
+
+ assert Gem::Specification.find_all_by_name('a').length > 1
+
+ @cmd.options[:force] = true
+ @cmd.options[:args] = ['a']
+
+ use_ui ui do
+ @cmd.execute
+ end
+
+ refute_includes Gem::Specification.all_names, 'a'
+ end
+
+ def test_execute_with_force_ignores_dependencies
+ ui = Gem::MockGemUi.new
+
+ util_make_gems
+ util_setup_gem ui
+
+ assert Gem::Specification.find_all_by_name('dep_x').length > 0
+ assert Gem::Specification.find_all_by_name('x').length > 0
+
+ @cmd.options[:force] = true
+ @cmd.options[:args] = ['x']
+
+ use_ui ui do
+ @cmd.execute
+ end
+
+ assert Gem::Specification.find_all_by_name('dep_x').length > 0
+ assert Gem::Specification.find_all_by_name('x').length == 0
+ end
+
+ def test_execute_all
+ util_make_gems
+
+ default = new_default_spec 'default', '1'
+ install_default_gems default
+
+ gemhome2 = "#{@gemhome}2"
+
+ a_4 = util_spec 'a', 4
+ install_gem a_4, :install_dir => gemhome2
+
+ Gem::Specification.dirs = [@gemhome, gemhome2]
+
+ assert_includes Gem::Specification.all_names, 'a-1'
+ assert_includes Gem::Specification.all_names, 'a-4'
+ assert_includes Gem::Specification.all_names, 'default-1'
+
+ @cmd.options[:all] = true
+ @cmd.options[:args] = []
+
+ use_ui @ui do
+ @cmd.execute
+ end
+
+ assert_equal %w[a-4 default-1], Gem::Specification.all_names.sort
+ end
+
+ def test_handle_options
+ @cmd.handle_options %w[]
+
+ assert_equal false, @cmd.options[:check_dev]
+ assert_equal nil, @cmd.options[:install_dir]
+ assert_equal true, @cmd.options[:user_install]
+ assert_equal Gem::Requirement.default, @cmd.options[:version]
+ end
+
end
diff --git a/test/rubygems/test_gem_commands_unpack_command.rb b/test/rubygems/test_gem_commands_unpack_command.rb
index cd8716b36b..59f6cc6c74 100644
--- a/test/rubygems/test_gem_commands_unpack_command.rb
+++ b/test/rubygems/test_gem_commands_unpack_command.rb
@@ -22,31 +22,22 @@ class TestGemCommandsUnpackCommand < Gem::TestCase
end
def test_get_path
- util_setup_fake_fetcher
- util_clear_gems
- util_setup_spec_fetcher @a1
-
- a1_data = nil
-
- open @a1.cache_file, 'rb' do |fp|
- a1_data = fp.read
+ specs = spec_fetcher do |fetcher|
+ fetcher.gem 'a', 1
end
- Gem::RemoteFetcher.fetcher.data['http://gems.example.com/gems/a-1.gem'] =
- a1_data
-
- dep = Gem::Dependency.new(@a1.name, @a1.version)
+ dep = Gem::Dependency.new 'a', 1
assert_equal(
@cmd.get_path(dep),
- @a1.cache_file,
+ specs['a-1'].cache_file,
'fetches a-1 and returns the cache path'
)
- FileUtils.rm @a1.cache_file
+ FileUtils.rm specs['a-1'].cache_file
assert_equal(
@cmd.get_path(dep),
- @a1.cache_file,
+ specs['a-1'].cache_file,
'when removed from cache, refetches a-1'
)
end
@@ -67,8 +58,9 @@ class TestGemCommandsUnpackCommand < Gem::TestCase
end
def test_execute_gem_path
- util_setup_fake_fetcher
- util_setup_spec_fetcher
+ spec_fetcher do |fetcher|
+ fetcher.gem 'a', '3.a'
+ end
Gem.clear_paths
@@ -88,8 +80,7 @@ class TestGemCommandsUnpackCommand < Gem::TestCase
end
def test_execute_gem_path_missing
- util_setup_fake_fetcher
- util_setup_spec_fetcher
+ spec_fetcher
Gem.clear_paths
@@ -109,18 +100,13 @@ class TestGemCommandsUnpackCommand < Gem::TestCase
end
def test_execute_remote
- util_setup_fake_fetcher
- util_setup_spec_fetcher @a1, @a2
- util_clear_gems
+ spec_fetcher do |fetcher|
+ fetcher.spec 'a', 1
+ fetcher.gem 'a', 2
- a2_data = nil
- open @a2.cache_file, 'rb' do |fp|
- a2_data = fp.read
+ fetcher.clear
end
- Gem::RemoteFetcher.fetcher.data['http://gems.example.com/gems/a-2.gem'] =
- a2_data
-
Gem.configuration.verbose = :really
@cmd.options[:args] = %w[a]
@@ -186,13 +172,13 @@ class TestGemCommandsUnpackCommand < Gem::TestCase
end
def test_execute_exact_match
- foo_spec = quick_spec 'foo'
- foo_bar_spec = quick_spec 'foo_bar'
+ foo_spec = util_spec 'foo'
+ foo_bar_spec = util_spec 'foo_bar'
use_ui @ui do
Dir.chdir @tempdir do
- Gem::Builder.new(foo_spec).build
- Gem::Builder.new(foo_bar_spec).build
+ Gem::Package.build foo_spec
+ Gem::Package.build foo_bar_spec
end
end
@@ -209,7 +195,7 @@ class TestGemCommandsUnpackCommand < Gem::TestCase
end
end
- assert File.exist?(File.join(@tempdir, foo_spec.full_name))
+ assert_path_exists File.join(@tempdir, foo_spec.full_name)
end
def test_handle_options_metadata
diff --git a/test/rubygems/test_gem_commands_update_command.rb b/test/rubygems/test_gem_commands_update_command.rb
index b283d484e3..7537c1c9c1 100644
--- a/test/rubygems/test_gem_commands_update_command.rb
+++ b/test/rubygems/test_gem_commands_update_command.rb
@@ -11,33 +11,35 @@ class TestGemCommandsUpdateCommand < Gem::TestCase
def setup
super
+ common_installer_setup
@cmd = Gem::Commands::UpdateCommand.new
- @cmd.options[:generate_rdoc] = false
- @cmd.options[:generate_ri] = false
+ @cmd.options[:document] = []
- util_setup_fake_fetcher
- util_clear_gems
- util_setup_spec_fetcher @a1, @a2
+ @specs = spec_fetcher do |fetcher|
+ fetcher.gem 'a', 1
+ fetcher.gem 'a', 2
+ fetcher.gem 'a', '3.a'
- @a1_path = @a1.cache_file
- @a2_path = @a2.cache_file
+ fetcher.clear
+ end
- @fetcher.data["#{@gem_repo}gems/#{File.basename @a1_path}"] =
- read_binary @a1_path
- @fetcher.data["#{@gem_repo}gems/#{File.basename @a2_path}"] =
- read_binary @a2_path
+ @a1_path = @specs['a-1'].cache_file
+ @a2_path = @specs['a-1'].cache_file
+ @a3a_path = @specs['a-3.a'].cache_file
end
def test_execute
- util_clear_gems
+ spec_fetcher do |fetcher|
+ fetcher.gem 'a', 2
+
+ fetcher.clear
- Gem::Installer.new(@a1_path).install
+ fetcher.spec 'a', 1
+ end
@cmd.options[:args] = []
- @cmd.options[:generate_rdoc] = false
- @cmd.options[:generate_ri] = false
use_ui @ui do
@cmd.execute
@@ -45,54 +47,20 @@ class TestGemCommandsUpdateCommand < Gem::TestCase
out = @ui.output.split "\n"
assert_equal "Updating installed gems", out.shift
- assert_equal "Updating #{@a2.name}", out.shift
- assert_equal "Successfully installed #{@a2.full_name}", out.shift
- assert_equal "Gems updated: #{@a2.name}", out.shift
+ assert_equal "Updating a", out.shift
+ assert_equal "Gems updated: a", out.shift
assert_empty out
end
- def util_setup_rubygem version
- gem = quick_spec('rubygems-update', version.to_s) do |s|
- s.files = %w[setup.rb]
- end
- write_file File.join(*%W[gems #{gem.original_name} setup.rb])
- util_build_gem gem
- util_setup_spec_fetcher gem
- gem
- end
-
- def util_setup_rubygem8
- @rubygem8 = util_setup_rubygem 8
- end
-
- def util_setup_rubygem9
- @rubygem9 = util_setup_rubygem 9
- end
-
- def util_setup_rubygem_current
- @rubygem_current = util_setup_rubygem Gem::VERSION
- end
-
- def util_add_to_fetcher *specs
- specs.each do |spec|
- gem_file = spec.cache_file
- file_name = File.basename gem_file
+ def test_execute_system
+ spec_fetcher do |fetcher|
+ fetcher.gem 'rubygems-update', 9 do |s| s.files = %w[setup.rb] end
- @fetcher.data["http://gems.example.com/gems/#{file_name}"] =
- Gem.read_binary gem_file
+ fetcher.clear
end
- end
-
- def test_execute_system
- util_clear_gems
- util_setup_rubygem9
- util_setup_spec_fetcher @rubygem9
- util_add_to_fetcher @rubygem9
@cmd.options[:args] = []
@cmd.options[:system] = true
- @cmd.options[:generate_rdoc] = false
- @cmd.options[:generate_ri] = false
use_ui @ui do
@cmd.execute
@@ -100,7 +68,6 @@ class TestGemCommandsUpdateCommand < Gem::TestCase
out = @ui.output.split "\n"
assert_equal "Updating rubygems-update", out.shift
- assert_equal "Successfully installed rubygems-update-9", out.shift
assert_equal "Installing RubyGems 9", out.shift
assert_equal "RubyGems system software updated", out.shift
@@ -108,15 +75,16 @@ class TestGemCommandsUpdateCommand < Gem::TestCase
end
def test_execute_system_at_latest
- util_clear_gems
- util_setup_rubygem_current
- util_setup_spec_fetcher @rubygem_current
- util_add_to_fetcher @rubygem_current
+ spec_fetcher do |fetcher|
+ fetcher.gem 'rubygems-update', Gem::VERSION do |s|
+ s.files = %w[setup.rb]
+ end
+
+ fetcher.clear
+ end
@cmd.options[:args] = []
@cmd.options[:system] = true
- @cmd.options[:generate_rdoc] = false
- @cmd.options[:generate_ri] = false
assert_raises Gem::MockGemUi::SystemExitException do
use_ui @ui do
@@ -130,16 +98,15 @@ class TestGemCommandsUpdateCommand < Gem::TestCase
end
def test_execute_system_multiple
- util_clear_gems
- util_setup_rubygem9
- util_setup_rubygem8
- util_setup_spec_fetcher @rubygem8, @rubygem9
- util_add_to_fetcher @rubygem8, @rubygem9
+ spec_fetcher do |fetcher|
+ fetcher.gem 'rubygems-update', 8 do |s| s.files = %w[setup.rb] end
+ fetcher.gem 'rubygems-update', 9 do |s| s.files = %w[setup.rb] end
+
+ fetcher.clear
+ end
@cmd.options[:args] = []
@cmd.options[:system] = true
- @cmd.options[:generate_rdoc] = false
- @cmd.options[:generate_ri] = false
use_ui @ui do
@cmd.execute
@@ -147,7 +114,6 @@ class TestGemCommandsUpdateCommand < Gem::TestCase
out = @ui.output.split "\n"
assert_equal "Updating rubygems-update", out.shift
- assert_equal "Successfully installed rubygems-update-9", out.shift
assert_equal "Installing RubyGems 9", out.shift
assert_equal "RubyGems system software updated", out.shift
@@ -155,16 +121,15 @@ class TestGemCommandsUpdateCommand < Gem::TestCase
end
def test_execute_system_specific
- util_clear_gems
- util_setup_rubygem9
- util_setup_rubygem8
- util_setup_spec_fetcher @rubygem8, @rubygem9
- util_add_to_fetcher @rubygem8, @rubygem9
+ spec_fetcher do |fetcher|
+ fetcher.gem 'rubygems-update', 8 do |s| s.files = %w[setup.rb] end
+ fetcher.gem 'rubygems-update', 9 do |s| s.files = %w[setup.rb] end
+
+ fetcher.clear
+ end
@cmd.options[:args] = []
@cmd.options[:system] = "8"
- @cmd.options[:generate_rdoc] = false
- @cmd.options[:generate_ri] = false
use_ui @ui do
@cmd.execute
@@ -172,7 +137,6 @@ class TestGemCommandsUpdateCommand < Gem::TestCase
out = @ui.output.split "\n"
assert_equal "Updating rubygems-update", out.shift
- assert_equal "Successfully installed rubygems-update-8", out.shift
assert_equal "Installing RubyGems 8", out.shift
assert_equal "RubyGems system software updated", out.shift
@@ -180,16 +144,15 @@ class TestGemCommandsUpdateCommand < Gem::TestCase
end
def test_execute_system_specifically_to_latest_version
- util_clear_gems
- util_setup_rubygem9
- util_setup_rubygem8
- util_setup_spec_fetcher @rubygem8, @rubygem9
- util_add_to_fetcher @rubygem8, @rubygem9
+ spec_fetcher do |fetcher|
+ fetcher.gem 'rubygems-update', 8 do |s| s.files = %w[setup.rb] end
+ fetcher.gem 'rubygems-update', 9 do |s| s.files = %w[setup.rb] end
+
+ fetcher.clear
+ end
@cmd.options[:args] = []
@cmd.options[:system] = "9"
- @cmd.options[:generate_rdoc] = false
- @cmd.options[:generate_ri] = false
use_ui @ui do
@cmd.execute
@@ -197,7 +160,6 @@ class TestGemCommandsUpdateCommand < Gem::TestCase
out = @ui.output.split "\n"
assert_equal "Updating rubygems-update", out.shift
- assert_equal "Successfully installed rubygems-update-9", out.shift
assert_equal "Installing RubyGems 9", out.shift
assert_equal "RubyGems system software updated", out.shift
@@ -207,8 +169,6 @@ class TestGemCommandsUpdateCommand < Gem::TestCase
def test_execute_system_with_gems
@cmd.options[:args] = %w[gem]
@cmd.options[:system] = true
- @cmd.options[:generate_rdoc] = false
- @cmd.options[:generate_ri] = false
assert_raises Gem::MockGemUi::TermError do
use_ui @ui do
@@ -228,63 +188,71 @@ class TestGemCommandsUpdateCommand < Gem::TestCase
# a2 -> c2
def test_execute_dependencies
- @a1.add_dependency 'c', '1.2'
+ spec_fetcher do |fetcher|
+ fetcher.gem 'a', 2, 'b' => 2, 'c' => 2
+ fetcher.gem 'b', 2
+ fetcher.gem 'c', 2
- @c2 = quick_spec 'c', '2' do |s|
- s.files = %w[lib/code.rb]
- s.require_paths = %w[lib]
+ fetcher.clear
+
+ fetcher.spec 'a', 1, 'c' => '1.2'
+ fetcher.spec 'c', '1.2'
end
- @a2.add_dependency 'c', '2'
- @a2.add_dependency 'b', '2'
+ Gem::Specification.reset
- @b2_path = @b2.cache_file
- @c1_2_path = @c1_2.cache_file
- @c2_path = @c2.cache_file
+ @cmd.options[:args] = []
- install_specs @a1, @a2, @b2, @c1_2, @c2
+ use_ui @ui do
+ @cmd.execute
+ end
+
+ out = @ui.output.split "\n"
+ assert_equal "Updating installed gems", out.shift
+ assert_equal "Updating a", out.shift
+ assert_equal "Gems updated: a b c",
+ out.shift
- util_build_gem @a1
- util_build_gem @a2
- util_build_gem @c2
+ assert_empty out
+ end
- @fetcher.data["#{@gem_repo}gems/#{@a1.file_name}"] = read_binary @a1_path
- @fetcher.data["#{@gem_repo}gems/#{@a2.file_name}"] = read_binary @a2_path
- @fetcher.data["#{@gem_repo}gems/#{@b2.file_name}"] = read_binary @b2_path
- @fetcher.data["#{@gem_repo}gems/#{@c1_2.file_name}"] = read_binary @c1_2_path
- @fetcher.data["#{@gem_repo}gems/#{@c2.file_name}"] = read_binary @c2_path
+ def test_execute_rdoc
+ spec_fetcher do |fetcher|
+ fetcher.gem 'a', 2
- util_setup_spec_fetcher @a1, @a2, @b2, @c1_2, @c2
+ fetcher.clear
- Gem::Installer.new(@c1_2_path).install
- Gem::Installer.new(@a1_path).install
+ fetcher.spec 'a', 1
+ end
- Gem::Specification.reset
+ Gem.done_installing(&Gem::RDoc.method(:generation_hook))
- @cmd.options[:args] = []
+ @cmd.options[:document] = %w[rdoc ri]
+
+ @cmd.options[:args] = %w[a]
use_ui @ui do
@cmd.execute
end
- out = @ui.output.split "\n"
- assert_equal "Updating installed gems", out.shift
- assert_equal "Updating #{@a2.name}", out.shift
- assert_equal "Successfully installed #{@c2.full_name}", out.shift
- assert_equal "Successfully installed #{@b2.full_name}", out.shift
- assert_equal "Successfully installed #{@a2.full_name}", out.shift
- assert_equal "Gems updated: #{@c2.name}, #{@b2.name}, #{@a2.name}",
- out.shift
+ wait_for_child_process_to_exit
- assert_empty out
+ a2 = @specs['a-2']
+
+ assert_path_exists File.join(a2.doc_dir, 'ri')
+ assert_path_exists File.join(a2.doc_dir, 'rdoc')
end
def test_execute_named
- util_clear_gems
+ spec_fetcher do |fetcher|
+ fetcher.gem 'a', 2
- Gem::Installer.new(@a1_path).install
+ fetcher.clear
- @cmd.options[:args] = [@a1.name]
+ fetcher.spec 'a', 1
+ end
+
+ @cmd.options[:args] = %w[a]
use_ui @ui do
@cmd.execute
@@ -292,19 +260,18 @@ class TestGemCommandsUpdateCommand < Gem::TestCase
out = @ui.output.split "\n"
assert_equal "Updating installed gems", out.shift
- assert_equal "Updating #{@a2.name}", out.shift
- assert_equal "Successfully installed #{@a2.full_name}", out.shift
- assert_equal "Gems updated: #{@a2.name}", out.shift
+ assert_equal "Updating a", out.shift
+ assert_equal "Gems updated: a", out.shift
assert_empty out
end
def test_execute_named_up_to_date
- util_clear_gems
-
- Gem::Installer.new(@a2_path).install
+ spec_fetcher do |fetcher|
+ fetcher.spec 'a', 2
+ end
- @cmd.options[:args] = [@a2.name]
+ @cmd.options[:args] = %w[a]
use_ui @ui do
@cmd.execute
@@ -317,10 +284,34 @@ class TestGemCommandsUpdateCommand < Gem::TestCase
assert_empty out
end
- def test_execute_up_to_date
- util_clear_gems
+ def test_execute_named_up_to_date_prerelease
+ spec_fetcher do |fetcher|
+ fetcher.gem 'a', '3.a'
+
+ fetcher.clear
- Gem::Installer.new(@a2_path).install
+ fetcher.gem 'a', 2
+ end
+
+ @cmd.options[:args] = %w[a]
+ @cmd.options[:prerelease] = true
+
+ use_ui @ui do
+ @cmd.execute
+ end
+
+ out = @ui.output.split "\n"
+ assert_equal "Updating installed gems", out.shift
+ assert_equal "Updating a", out.shift
+ assert_equal "Gems updated: a", out.shift
+
+ assert_empty out
+ end
+
+ def test_execute_up_to_date
+ spec_fetcher do |fetcher|
+ fetcher.gem 'a', 2
+ end
@cmd.options[:args] = []
@@ -335,15 +326,93 @@ class TestGemCommandsUpdateCommand < Gem::TestCase
assert_empty out
end
+ def test_execute_user_install
+ spec_fetcher do |fetcher|
+ fetcher.gem 'a', 2
+
+ fetcher.clear
+
+ fetcher.spec 'a', 1
+ end
+
+ @cmd.handle_options %w[--user-install]
+
+ use_ui @ui do
+ @cmd.execute
+ end
+
+ installer = @cmd.installer
+ user_install = installer.instance_variable_get :@user_install
+
+ assert user_install, 'user_install must be set on the installer'
+ end
+
+ def test_fetch_remote_gems
+ specs = spec_fetcher do |fetcher|
+ fetcher.gem 'a', 1
+ fetcher.gem 'a', 2
+ end
+
+ expected = [
+ [Gem::NameTuple.new('a', v(2), Gem::Platform::RUBY),
+ Gem::Source.new(@gem_repo)],
+ ]
+
+ assert_equal expected, @cmd.fetch_remote_gems(specs['a-1'])
+ end
+
+ def test_fetch_remote_gems_error
+ Gem.sources.replace %w[http://nonexistent.example]
+
+ assert_raises Gem::RemoteFetcher::FetchError do
+ @cmd.fetch_remote_gems @specs['a-1']
+ end
+ end
+
+ def test_fetch_remote_gems_mismatch
+ platform = Gem::Platform.new 'x86-freebsd9'
+
+ specs = spec_fetcher do |fetcher|
+ fetcher.spec 'a', 1
+ fetcher.spec 'a', 2
+ fetcher.spec 'a', 2 do |s| s.platform = platform end
+ end
+
+ expected = [
+ [Gem::NameTuple.new('a', v(2), Gem::Platform::RUBY),
+ Gem::Source.new(@gem_repo)],
+ ]
+
+ assert_equal expected, @cmd.fetch_remote_gems(specs['a-1'])
+ end
+
+ def test_fetch_remote_gems_prerelease
+ specs = spec_fetcher do |fetcher|
+ fetcher.gem 'a', 1
+ fetcher.gem 'a', 2
+ fetcher.gem 'a', '3.a'
+ end
+
+ @cmd.options[:prerelease] = true
+
+ expected = [
+ [Gem::NameTuple.new('a', v(2), Gem::Platform::RUBY),
+ Gem::Source.new(@gem_repo)],
+ [Gem::NameTuple.new('a', v('3.a'), Gem::Platform::RUBY),
+ Gem::Source.new(@gem_repo)],
+ ]
+
+ assert_equal expected, @cmd.fetch_remote_gems(specs['a-1'])
+ end
+
def test_handle_options_system
@cmd.handle_options %w[--system]
expected = {
- :generate_ri => true,
- :system => true,
- :force => false,
- :args => [],
- :generate_rdoc => true,
+ :args => [],
+ :document => %w[rdoc ri],
+ :force => false,
+ :system => true,
}
assert_equal expected, @cmd.options
@@ -359,14 +428,40 @@ class TestGemCommandsUpdateCommand < Gem::TestCase
@cmd.handle_options %w[--system 1.3.7]
expected = {
- :generate_ri => true,
- :system => "1.3.7",
- :force => false,
- :args => [],
- :generate_rdoc => true,
+ :args => [],
+ :document => %w[rdoc ri],
+ :force => false,
+ :system => "1.3.7",
}
assert_equal expected, @cmd.options
end
+ def test_update_rubygems_arguments
+ @cmd.options[:system] = true
+
+ arguments = @cmd.update_rubygems_arguments
+
+ assert_equal '--prefix', arguments.shift
+ assert_equal Gem.prefix, arguments.shift
+ assert_equal '--no-rdoc', arguments.shift
+ assert_equal '--no-ri', arguments.shift
+ assert_equal '--previous-version', arguments.shift
+ assert_equal Gem::VERSION, arguments.shift
+ assert_empty arguments
+ end
+
+ def test_update_rubygems_arguments_1_8_x
+ @cmd.options[:system] = '1.8.26'
+
+ arguments = @cmd.update_rubygems_arguments
+
+ assert_equal '--prefix', arguments.shift
+ assert_equal Gem.prefix, arguments.shift
+ assert_equal '--no-rdoc', arguments.shift
+ assert_equal '--no-ri', arguments.shift
+ assert_empty arguments
+ end
+
end
+
diff --git a/test/rubygems/test_gem_commands_which_command.rb b/test/rubygems/test_gem_commands_which_command.rb
index 4985395871..7ce26c861a 100644
--- a/test/rubygems/test_gem_commands_which_command.rb
+++ b/test/rubygems/test_gem_commands_which_command.rb
@@ -41,19 +41,21 @@ class TestGemCommandsWhichCommand < Gem::TestCase
util_foo_bar
- @cmd.handle_options %w[foo_bar missing]
+ @cmd.handle_options %w[foo_bar missinglib]
use_ui @ui do
- @cmd.execute
+ assert_raises Gem::MockGemUi::TermError do
+ @cmd.execute
+ end
end
assert_equal "#{@foo_bar.full_gem_path}/lib/foo_bar.rb\n", @ui.output
- assert_match %r%Can.t find ruby library file or shared library missing\n%,
+ assert_match %r%Can.t find ruby library file or shared library missinglib\n%,
@ui.error
end
def test_execute_missing
- @cmd.handle_options %w[missing]
+ @cmd.handle_options %w[missinglib]
use_ui @ui do
assert_raises Gem::MockGemUi::TermError do
@@ -62,13 +64,13 @@ class TestGemCommandsWhichCommand < Gem::TestCase
end
assert_equal '', @ui.output
- assert_match %r%Can.t find ruby library file or shared library missing\n%,
+ assert_match %r%Can.t find ruby library file or shared library missinglib\n%,
@ui.error
end
def util_foo_bar
files = %w[lib/foo_bar.rb lib/directory/baz.rb Rakefile]
- @foo_bar = quick_spec 'foo_bar' do |gem|
+ @foo_bar = util_spec 'foo_bar' do |gem|
gem.files = files
end
diff --git a/test/rubygems/test_gem_commands_yank_command.rb b/test/rubygems/test_gem_commands_yank_command.rb
new file mode 100644
index 0000000000..e627452243
--- /dev/null
+++ b/test/rubygems/test_gem_commands_yank_command.rb
@@ -0,0 +1,97 @@
+require 'rubygems/test_case'
+require 'rubygems/commands/yank_command'
+
+class TestGemCommandsYankCommand < Gem::TestCase
+ def setup
+ super
+
+ @cmd = Gem::Commands::YankCommand.new
+ @cmd.host = 'http://example'
+
+ @fetcher = Gem::RemoteFetcher.fetcher
+
+ Gem.configuration.rubygems_api_key = 'key'
+ Gem.configuration.api_keys[:KEY] = 'other'
+ end
+
+ def test_handle_options
+ @cmd.handle_options %w[a --version 1.0 --platform x86-darwin -k KEY]
+
+ assert_equal %w[a], @cmd.options[:args]
+ assert_equal 'KEY', @cmd.options[:key]
+ assert_nil @cmd.options[:platform]
+ assert_equal req('= 1.0'), @cmd.options[:version]
+ end
+
+ def test_handle_options_missing_argument
+ %w[-v --version -p --platform].each do |option|
+ assert_raises OptionParser::MissingArgument do
+ @cmd.handle_options %W[a #{option}]
+ end
+ end
+ end
+
+ def test_execute
+ yank_uri = 'http://example/api/v1/gems/yank'
+ @fetcher.data[yank_uri] = ['Successfully yanked', 200, 'OK']
+
+ @cmd.options[:args] = %w[a]
+ @cmd.options[:added_platform] = true
+ @cmd.options[:version] = req('= 1.0')
+
+ use_ui @ui do
+ @cmd.execute
+ end
+
+ assert_match %r%Yanking gem from http://example%, @ui.output
+ assert_match %r%Successfully yanked%, @ui.output
+
+ platform = Gem.platforms[1]
+ body = @fetcher.last_request.body.split('&').sort
+ assert_equal %W[gem_name=a platform=#{platform} version=1.0], body
+
+ assert_equal 'key', @fetcher.last_request['Authorization']
+
+ assert_equal [yank_uri], @fetcher.paths
+ end
+
+ def test_execute_key
+ yank_uri = 'http://example/api/v1/gems/yank'
+ @fetcher.data[yank_uri] = ['Successfully yanked', 200, 'OK']
+
+ @cmd.options[:args] = %w[a]
+ @cmd.options[:version] = req('= 1.0')
+ @cmd.options[:key] = 'KEY'
+
+ use_ui @ui do
+ @cmd.execute
+ end
+
+ body = @fetcher.last_request.body.split('&').sort
+ assert_equal %w[gem_name=a version=1.0], body
+ assert_equal 'other', @fetcher.last_request['Authorization']
+ end
+
+ def test_execute_undo
+ unyank_uri = 'http://example/api/v1/gems/unyank'
+ @fetcher.data[unyank_uri] = ['Successfully unyanked', 200, 'OK']
+
+ @cmd.options[:args] = %w[a]
+ @cmd.options[:version] = req('= 1.0')
+ @cmd.options[:undo] = true
+
+ use_ui @ui do
+ @cmd.execute
+ end
+
+ assert_match %r%Unyanking gem from http://example%, @ui.output
+ assert_match %r%Successfully unyanked%, @ui.output
+
+ body = @fetcher.last_request.body.split('&').sort
+ assert_equal %w[gem_name=a version=1.0], body
+
+ assert_equal [unyank_uri], @fetcher.paths
+ end
+
+end
+
diff --git a/test/rubygems/test_gem_config_file.rb b/test/rubygems/test_gem_config_file.rb
index 702ac95149..e9cd33579d 100644
--- a/test/rubygems/test_gem_config_file.rb
+++ b/test/rubygems/test_gem_config_file.rb
@@ -17,6 +17,9 @@ class TestGemConfigFile < Gem::TestCase
Gem::ConfigFile::OPERATING_SYSTEM_DEFAULTS.clear
Gem::ConfigFile::PLATFORM_DEFAULTS.clear
+ @env_gemrc = ENV['GEMRC']
+ ENV['GEMRC'] = ''
+
util_config_file
end
@@ -27,6 +30,8 @@ class TestGemConfigFile < Gem::TestCase
Gem::ConfigFile.send :const_set, :SYSTEM_WIDE_CONFIG_FILE,
@orig_SYSTEM_WIDE_CONFIG_FILE
+ ENV['GEMRC'] = @env_gemrc
+
super
end
@@ -35,7 +40,6 @@ class TestGemConfigFile < Gem::TestCase
assert_equal false, @cfg.backtrace
assert_equal true, @cfg.update_sources
- assert_equal false, @cfg.benchmark
assert_equal Gem::ConfigFile::DEFAULT_BULK_THRESHOLD, @cfg.bulk_threshold
assert_equal true, @cfg.verbose
assert_equal [@gem_repo], Gem.sources
@@ -43,7 +47,6 @@ class TestGemConfigFile < Gem::TestCase
File.open @temp_conf, 'w' do |fp|
fp.puts ":backtrace: true"
fp.puts ":update_sources: false"
- fp.puts ":benchmark: true"
fp.puts ":bulk_threshold: 10"
fp.puts ":verbose: false"
fp.puts ":sources:"
@@ -59,7 +62,6 @@ class TestGemConfigFile < Gem::TestCase
util_config_file
assert_equal true, @cfg.backtrace
- assert_equal true, @cfg.benchmark
assert_equal 10, @cfg.bulk_threshold
assert_equal false, @cfg.verbose
assert_equal false, @cfg.update_sources
@@ -131,6 +133,88 @@ class TestGemConfigFile < Gem::TestCase
assert_equal true, @cfg.backtrace
end
+ def test_initialize_environment_variable_override
+ File.open Gem::ConfigFile::SYSTEM_WIDE_CONFIG_FILE, 'w' do |fp|
+ fp.puts ':backtrace: false'
+ fp.puts ':verbose: false'
+ fp.puts ':bulk_threshold: 2048'
+ end
+
+ conf1 = File.join @tempdir, 'gemrc1'
+ File.open conf1, 'w' do |fp|
+ fp.puts ':backtrace: true'
+ end
+
+ conf2 = File.join @tempdir, 'gemrc2'
+ File.open conf2, 'w' do |fp|
+ fp.puts ':verbose: true'
+ end
+
+ conf3 = File.join @tempdir, 'gemrc3'
+ File.open conf3, 'w' do |fp|
+ fp.puts ':verbose: :loud'
+ end
+
+ ENV['GEMRC'] = conf1 + ':' + conf2 + ';' + conf3
+
+ util_config_file
+
+ assert_equal true, @cfg.backtrace
+ assert_equal :loud, @cfg.verbose
+ assert_equal 2048, @cfg.bulk_threshold
+ end
+
+ def test_api_keys
+ assert_nil @cfg.instance_variable_get :@api_keys
+
+ temp_cred = File.join Gem.user_home, '.gem', 'credentials'
+ FileUtils.mkdir File.dirname(temp_cred)
+ File.open temp_cred, 'w', 0600 do |fp|
+ fp.puts ':rubygems_api_key: 701229f217cdf23b1344c7b4b54ca97'
+ end
+
+ util_config_file
+
+ assert_equal({:rubygems => '701229f217cdf23b1344c7b4b54ca97'},
+ @cfg.api_keys)
+ end
+
+ def test_check_credentials_permissions
+ skip 'chmod not supported' if win_platform?
+
+ @cfg.rubygems_api_key = 'x'
+
+ File.chmod 0644, @cfg.credentials_path
+
+ use_ui @ui do
+ assert_raises Gem::MockGemUi::TermError do
+ @cfg.load_api_keys
+ end
+ end
+
+ assert_empty @ui.output
+
+ expected = <<-EXPECTED
+ERROR: Your gem push credentials file located at:
+
+\t#{@cfg.credentials_path}
+
+has file permissions of 0644 but 0600 is required.
+
+To fix this error run:
+
+\tchmod 0600 #{@cfg.credentials_path}
+
+You should reset your credentials at:
+
+\thttps://rubygems.org/profile/edit
+
+if you believe they were disclosed to a third party.
+ EXPECTED
+
+ assert_equal expected, @ui.error
+ end
+
def test_handle_arguments
args = %w[--backtrace --bunch --of --args here]
@@ -149,16 +233,6 @@ class TestGemConfigFile < Gem::TestCase
assert_equal true, @cfg.backtrace
end
- def test_handle_arguments_benchmark
- assert_equal false, @cfg.benchmark
-
- args = %w[--benchmark]
-
- @cfg.handle_arguments args
-
- assert_equal true, @cfg.benchmark
- end
-
def test_handle_arguments_debug
old_dollar_DEBUG = $DEBUG
assert_equal false, $DEBUG
@@ -174,12 +248,12 @@ class TestGemConfigFile < Gem::TestCase
def test_handle_arguments_override
File.open @temp_conf, 'w' do |fp|
- fp.puts ":benchmark: false"
+ fp.puts ":backtrace: false"
end
- util_config_file %W[--benchmark --config-file=#{@temp_conf}]
+ util_config_file %W[--backtrace --config-file=#{@temp_conf}]
- assert_equal true, @cfg.benchmark
+ assert_equal true, @cfg.backtrace
end
def test_handle_arguments_traceback
@@ -192,6 +266,32 @@ class TestGemConfigFile < Gem::TestCase
assert_equal true, @cfg.backtrace
end
+ def test_load_api_keys
+ temp_cred = File.join Gem.user_home, '.gem', 'credentials'
+ FileUtils.mkdir File.dirname(temp_cred)
+ File.open temp_cred, 'w', 0600 do |fp|
+ fp.puts ":rubygems_api_key: 701229f217cdf23b1344c7b4b54ca97"
+ fp.puts ":other: a5fdbb6ba150cbb83aad2bb2fede64c"
+ end
+
+ util_config_file
+
+ assert_equal({:rubygems => '701229f217cdf23b1344c7b4b54ca97',
+ :other => 'a5fdbb6ba150cbb83aad2bb2fede64c'}, @cfg.api_keys)
+ end
+
+ def test_load_api_keys_bad_permission
+ skip 'chmod not supported' if win_platform?
+
+ @cfg.rubygems_api_key = 'x'
+
+ File.chmod 0644, @cfg.credentials_path
+
+ assert_raises Gem::MockGemUi::TermError do
+ @cfg.load_api_keys
+ end
+ end
+
def test_really_verbose
assert_equal false, @cfg.really_verbose
@@ -204,9 +304,48 @@ class TestGemConfigFile < Gem::TestCase
assert_equal true, @cfg.really_verbose
end
+ def test_rubygems_api_key_equals
+ @cfg.rubygems_api_key = 'x'
+
+ assert_equal 'x', @cfg.rubygems_api_key
+
+ expected = {
+ :rubygems_api_key => 'x',
+ }
+
+ assert_equal expected, YAML.load_file(@cfg.credentials_path)
+
+ unless win_platform? then
+ stat = File.stat @cfg.credentials_path
+
+ assert_equal 0600, stat.mode & 0600
+ end
+ end
+
+ def test_rubygems_api_key_equals_bad_permission
+ skip 'chmod not supported' if win_platform?
+
+ @cfg.rubygems_api_key = 'x'
+
+ File.chmod 0644, @cfg.credentials_path
+
+ assert_raises Gem::MockGemUi::TermError do
+ @cfg.rubygems_api_key = 'y'
+ end
+
+ expected = {
+ :rubygems_api_key => 'x',
+ }
+
+ assert_equal expected, YAML.load_file(@cfg.credentials_path)
+
+ stat = File.stat @cfg.credentials_path
+
+ assert_equal 0644, stat.mode & 0644
+ end
+
def test_write
@cfg.backtrace = true
- @cfg.benchmark = true
@cfg.update_sources = false
@cfg.bulk_threshold = 10
@cfg.verbose = false
@@ -219,7 +358,6 @@ class TestGemConfigFile < Gem::TestCase
# These should not be written out to the config file.
assert_equal false, @cfg.backtrace, 'backtrace'
- assert_equal false, @cfg.benchmark, 'benchmark'
assert_equal Gem::ConfigFile::DEFAULT_BULK_THRESHOLD, @cfg.bulk_threshold,
'bulk_threshold'
assert_equal true, @cfg.update_sources, 'update_sources'
@@ -234,7 +372,6 @@ class TestGemConfigFile < Gem::TestCase
def test_write_from_hash
File.open @temp_conf, 'w' do |fp|
fp.puts ":backtrace: true"
- fp.puts ":benchmark: true"
fp.puts ":bulk_threshold: 10"
fp.puts ":update_sources: false"
fp.puts ":verbose: false"
@@ -246,7 +383,6 @@ class TestGemConfigFile < Gem::TestCase
util_config_file
@cfg.backtrace = :junk
- @cfg.benchmark = :junk
@cfg.update_sources = :junk
@cfg.bulk_threshold = 20
@cfg.verbose = :junk
@@ -259,7 +395,6 @@ class TestGemConfigFile < Gem::TestCase
# These should not be written out to the config file
assert_equal true, @cfg.backtrace, 'backtrace'
- assert_equal true, @cfg.benchmark, 'benchmark'
assert_equal 10, @cfg.bulk_threshold, 'bulk_threshold'
assert_equal false, @cfg.update_sources, 'update_sources'
assert_equal false, @cfg.verbose, 'verbose'
@@ -269,30 +404,16 @@ class TestGemConfigFile < Gem::TestCase
assert_equal %w[http://even-more-gems.example.com], Gem.sources
end
- def test_load_rubygems_api_key_from_credentials
- temp_cred = File.join Gem.user_home, '.gem', 'credentials'
- FileUtils.mkdir File.dirname(temp_cred)
- File.open temp_cred, 'w' do |fp|
- fp.puts ":rubygems_api_key: 701229f217cdf23b1344c7b4b54ca97"
+ def test_ignore_invalid_config_file
+ File.open @temp_conf, 'w' do |fp|
+ fp.puts "some-non-yaml-hash-string"
end
- util_config_file
-
- assert_equal "701229f217cdf23b1344c7b4b54ca97", @cfg.rubygems_api_key
- end
-
- def test_load_api_keys_from_config
- temp_cred = File.join Gem.user_home, '.gem', 'credentials'
- FileUtils.mkdir File.dirname(temp_cred)
- File.open temp_cred, 'w' do |fp|
- fp.puts ":rubygems_api_key: 701229f217cdf23b1344c7b4b54ca97"
- fp.puts ":other: a5fdbb6ba150cbb83aad2bb2fede64c"
- end
+ # Avoid writing stuff to output when running tests
+ Gem::ConfigFile.class_eval { def warn(args); end }
+ # This should not raise exception
util_config_file
-
- assert_equal({:rubygems => '701229f217cdf23b1344c7b4b54ca97',
- :other => 'a5fdbb6ba150cbb83aad2bb2fede64c'}, @cfg.api_keys)
end
def test_load_ssl_verify_mode_from_config
@@ -311,9 +432,24 @@ class TestGemConfigFile < Gem::TestCase
assert_equal('/home/me/certs', @cfg.ssl_ca_cert)
end
+ def test_load_ssl_client_cert_from_config
+ File.open @temp_conf, 'w' do |fp|
+ fp.puts ":ssl_client_cert: /home/me/mine.pem"
+ end
+ util_config_file
+ assert_equal('/home/me/mine.pem', @cfg.ssl_client_cert)
+ end
+
def util_config_file(args = @cfg_args)
@cfg = Gem::ConfigFile.new args
end
+ def test_disable_default_gem_server
+ File.open @temp_conf, 'w' do |fp|
+ fp.puts ":disable_default_gem_server: true"
+ end
+ util_config_file
+ assert_equal(true, @cfg.disable_default_gem_server)
+ end
end
diff --git a/test/rubygems/test_gem_dependency.rb b/test/rubygems/test_gem_dependency.rb
index e1ba5ffbe7..7fc4dbbebf 100644
--- a/test/rubygems/test_gem_dependency.rb
+++ b/test/rubygems/test_gem_dependency.rb
@@ -9,6 +9,15 @@ class TestGemDependency < Gem::TestCase
assert_equal req("> 1.0"), d.requirement
end
+ def test_initialize_type_bad
+ e = assert_raises ArgumentError do
+ Gem::Dependency.new 'monkey' => '1.0'
+ end
+
+ assert_equal 'dependency name must be a String, was {"monkey"=>"1.0"}',
+ e.message
+ end
+
def test_initialize_double
d = dep "pkg", "> 1.0", "< 2.0"
assert_equal req("> 1.0", "< 2.0"), d.requirement
@@ -173,5 +182,42 @@ class TestGemDependency < Gem::TestCase
assert dep('a', '= 1').specific?
end
+ def test_to_specs_suggests_other_versions
+ a = util_spec 'a', '1.0', 'b' => '>= 1.0'
+
+ a_file = File.join a.gem_dir, 'lib', 'a_file.rb'
+
+ write_file a_file do |io|
+ io.puts '# a_file.rb'
+ end
+
+ dep = Gem::Dependency.new "a", "= 2.0"
+
+ e = assert_raises Gem::LoadError do
+ dep.to_specs
+ end
+
+ assert_equal "Could not find 'a' (= 2.0) - did find: [a-1.0]", e.message
+ end
+
+ def test_to_specs_indicates_total_gem_set_size
+ a = util_spec 'a', '1.0', 'b' => '>= 1.0'
+
+ a_file = File.join a.gem_dir, 'lib', 'a_file.rb'
+
+ write_file a_file do |io|
+ io.puts '# a_file.rb'
+ end
+
+ dep = Gem::Dependency.new "b", "= 2.0"
+
+ e = assert_raises Gem::LoadError do
+ dep.to_specs
+ end
+
+ assert_equal "Could not find 'b' (= 2.0) among 1 total gem(s)", e.message
+ end
+
+
end
diff --git a/test/rubygems/test_gem_dependency_installer.rb b/test/rubygems/test_gem_dependency_installer.rb
index 03c1200b40..f8c3dd493b 100644
--- a/test/rubygems/test_gem_dependency_installer.rb
+++ b/test/rubygems/test_gem_dependency_installer.rb
@@ -6,6 +6,7 @@ class TestGemDependencyInstaller < Gem::TestCase
def setup
super
+ common_installer_setup
@gems_dir = File.join @tempdir, 'gems'
@cache_dir = File.join @gemhome, 'cache'
@@ -23,10 +24,73 @@ class TestGemDependencyInstaller < Gem::TestCase
s.add_development_dependency 'aa'
end
+ @c1, @c1_gem = util_gem 'c', '1' do |s|
+ s.add_development_dependency 'b'
+ end
+
+ @d1, @d1_gem = util_gem 'd', '1' do |s|
+ s.add_development_dependency 'c'
+ end
+
util_clear_gems
util_reset_gems
end
+ def test_available_set_for_name
+ util_setup_gems
+ p1a, = util_gem 'a', '10.a'
+ util_setup_spec_fetcher p1a, @a1, @a1_pre
+
+ inst = Gem::DependencyInstaller.new
+
+ available = inst.available_set_for 'a', Gem::Requirement.default
+
+ assert_equal %w[a-1], available.set.map { |s| s.spec.full_name }
+ end
+
+ def test_available_set_for_name_prerelease
+ util_setup_gems
+ p1a, = util_gem 'a', '10.a'
+ util_setup_spec_fetcher p1a, @a1, @a1_pre
+
+ inst = Gem::DependencyInstaller.new :prerelease => true
+
+ available = inst.available_set_for 'a', Gem::Requirement.default
+
+ assert_equal %w[a-10.a],
+ available.sorted.map { |s| s.spec.full_name }
+ end
+
+ def test_available_set_for_dep
+ util_setup_gems
+ p1a, = util_gem 'a', '10.a'
+ util_setup_spec_fetcher p1a, @a1, @a1_pre
+
+ inst = Gem::DependencyInstaller.new
+
+ dep = Gem::Dependency.new 'a', Gem::Requirement.default
+
+ available = inst.available_set_for dep, Gem::Requirement.default
+
+ assert_equal %w[a-1], available.set.map { |s| s.spec.full_name }
+ end
+
+ def test_available_set_for_dep_prerelease
+ util_setup_gems
+ p1a, = util_gem 'a', '10.a'
+ util_setup_spec_fetcher p1a, @a1, @a1_pre
+
+ inst = Gem::DependencyInstaller.new :prerelease => true
+
+ dep = Gem::Dependency.new 'a', Gem::Requirement.default
+ dep.prerelease = true
+
+ available = inst.available_set_for dep, Gem::Requirement.default
+
+ assert_equal %w[a-10.a],
+ available.sorted.map { |s| s.spec.full_name }
+ end
+
def test_install
util_setup_gems
@@ -42,6 +106,62 @@ class TestGemDependencyInstaller < Gem::TestCase
assert_equal [@a1], inst.installed_gems
end
+ def test_install_prerelease
+ util_setup_gems
+
+ p1a, gem = util_gem 'a', '10.a'
+
+ util_setup_spec_fetcher(p1a, @a1, @a1_pre)
+ util_clear_gems
+
+ p1a_data = Gem.read_binary(gem)
+
+ @fetcher.data['http://gems.example.com/gems/a-10.a.gem'] = p1a_data
+
+ dep = Gem::Dependency.new "a"
+ inst = Gem::DependencyInstaller.new :prerelease => true
+ inst.install dep
+
+ assert_equal %w[a-10.a], Gem::Specification.map(&:full_name)
+ assert_equal [p1a], inst.installed_gems
+ end
+
+ def test_install_when_only_prerelease
+ p1a, gem = util_gem 'p', '1.a'
+
+ util_setup_spec_fetcher(p1a)
+ util_clear_gems
+
+ p1a_data = Gem.read_binary(gem)
+
+ @fetcher.data['http://gems.example.com/gems/p-1.a.gem'] = p1a_data
+
+ dep = Gem::Dependency.new "p"
+ inst = Gem::DependencyInstaller.new
+ inst.install dep
+
+ assert_equal %w[], Gem::Specification.map(&:full_name)
+ assert_equal [], inst.installed_gems
+ end
+
+ def test_install_prerelease_skipped_when_normal_ver
+ util_setup_gems
+
+ util_setup_spec_fetcher(@a1, @a1_pre)
+ util_clear_gems
+
+ p1a_data = Gem.read_binary(@a1_gem)
+
+ @fetcher.data['http://gems.example.com/gems/a-1.gem'] = p1a_data
+
+ dep = Gem::Dependency.new "a"
+ inst = Gem::DependencyInstaller.new :prerelease => true
+ inst.install dep
+
+ assert_equal %w[a-1], Gem::Specification.map(&:full_name)
+ assert_equal [@a1], inst.installed_gems
+ end
+
def test_install_all_dependencies
util_setup_gems
@@ -53,7 +173,8 @@ class TestGemDependencyInstaller < Gem::TestCase
FileUtils.mv @a1_gem, @tempdir
FileUtils.mv @b1_gem, @tempdir
- FileUtils.mv e1_gem, @tempdir
+ FileUtils.mv e1_gem, @tempdir
+
inst = nil
Dir.chdir @tempdir do
@@ -61,22 +182,27 @@ class TestGemDependencyInstaller < Gem::TestCase
inst.install 'b'
end
+ assert_equal %w[b-1], inst.installed_gems.map { |s| s.full_name },
+ 'sanity check'
+
Dir.chdir @tempdir do
inst = Gem::DependencyInstaller.new
inst.install 'e'
end
- assert_equal %w[e-1 a-1], inst.installed_gems.map { |s| s.full_name }
+ assert_equal %w[a-1 e-1], inst.installed_gems.map { |s| s.full_name }
end
def test_install_cache_dir
util_setup_gems
- FileUtils.mv @a1_gem, @tempdir
- FileUtils.mv @b1_gem, @tempdir
+ dir = "dir"
+ Dir.mkdir dir
+ FileUtils.mv @a1_gem, dir
+ FileUtils.mv @b1_gem, dir
inst = nil
- Dir.chdir @tempdir do
+ Dir.chdir dir do
inst = Gem::DependencyInstaller.new :cache_dir => @tempdir
inst.install 'b'
end
@@ -97,15 +223,18 @@ class TestGemDependencyInstaller < Gem::TestCase
Gem::Specification.reset
FileUtils.mv @a1_gem, @tempdir
- FileUtils.mv a2_gem, @tempdir # not in index
+ FileUtils.mv a2_gem, @tempdir # not in index
FileUtils.mv @b1_gem, @tempdir
inst = nil
Dir.chdir @tempdir do
inst = Gem::DependencyInstaller.new
- inst.install 'a-2'
+ inst.install 'a', req("= 2")
end
+ assert_equal %w[a-2], inst.installed_gems.map { |s| s.full_name },
+ 'sanity check'
+
FileUtils.rm File.join(@tempdir, a2.file_name)
Dir.chdir @tempdir do
@@ -117,11 +246,32 @@ class TestGemDependencyInstaller < Gem::TestCase
assert_equal %w[b-1], inst.installed_gems.map { |s| s.full_name }
end
- def test_install_dependency
+ # This asserts that if a gem's dependency is satisfied by an
+ # already installed gem, RubyGems doesn't installed a newer
+ # version
+ def test_install_doesnt_upgrade_installed_depedencies
util_setup_gems
+ a2, a2_gem = util_gem 'a', '2'
+ a3, a3_gem = util_gem 'a', '3'
+
+ util_setup_spec_fetcher @a1, a3, @b1
+
+ FileUtils.rm_rf File.join(@gemhome, 'gems')
+
+ Gem::Specification.reset
+
FileUtils.mv @a1_gem, @tempdir
+ FileUtils.mv a2_gem, @tempdir # not in index
FileUtils.mv @b1_gem, @tempdir
+ FileUtils.mv a3_gem, @tempdir
+
+ Dir.chdir @tempdir do
+ Gem::DependencyInstaller.new.install 'a', req("= 2")
+ end
+
+ FileUtils.rm File.join(@tempdir, a2.file_name)
+
inst = nil
Dir.chdir @tempdir do
@@ -129,7 +279,33 @@ class TestGemDependencyInstaller < Gem::TestCase
inst.install 'b'
end
+ assert_equal %w[a-2 b-1], Gem::Specification.map(&:full_name)
+ assert_equal %w[b-1], inst.installed_gems.map { |s| s.full_name }
+ end
+
+ def test_install_dependency
+ util_setup_gems
+
+ done_installing_ran = false
+ inst = nil
+
+ Gem.done_installing do |installer, specs|
+ done_installing_ran = true
+ assert_equal inst, installer
+ assert_equal [@a1, @b1], specs
+ end
+
+ FileUtils.mv @a1_gem, @tempdir
+ FileUtils.mv @b1_gem, @tempdir
+
+ Dir.chdir @tempdir do
+ inst = Gem::DependencyInstaller.new(:build_docs_in_background => false)
+ inst.install 'b'
+ end
+
assert_equal %w[a-1 b-1], inst.installed_gems.map { |s| s.full_name }
+
+ assert done_installing_ran, 'post installs hook was not run'
end
def test_install_dependency_development
@@ -152,6 +328,50 @@ class TestGemDependencyInstaller < Gem::TestCase
assert_equal %w[a-1 aa-1 b-1], inst.installed_gems.map { |s| s.full_name }
end
+ def test_install_dependency_development_deep
+ util_setup_gems
+
+ @aa1, @aa1_gem = util_gem 'aa', '1'
+
+ util_reset_gems
+
+ FileUtils.mv @a1_gem, @tempdir
+ FileUtils.mv @aa1_gem, @tempdir
+ FileUtils.mv @b1_gem, @tempdir
+ FileUtils.mv @c1_gem, @tempdir
+ FileUtils.mv @d1_gem, @tempdir
+ inst = nil
+
+ Dir.chdir @tempdir do
+ inst = Gem::DependencyInstaller.new(:development => true)
+ inst.install 'd'
+ end
+
+ assert_equal %w[a-1 aa-1 b-1 c-1 d-1], inst.installed_gems.map { |s| s.full_name }
+ end
+
+ def test_install_dependency_development_shallow
+ util_setup_gems
+
+ @aa1, @aa1_gem = util_gem 'aa', '1'
+
+ util_reset_gems
+
+ FileUtils.mv @a1_gem, @tempdir
+ FileUtils.mv @aa1_gem, @tempdir
+ FileUtils.mv @b1_gem, @tempdir
+ FileUtils.mv @c1_gem, @tempdir
+ FileUtils.mv @d1_gem, @tempdir
+ inst = nil
+
+ Dir.chdir @tempdir do
+ inst = Gem::DependencyInstaller.new(:development => true, :dev_shallow => true)
+ inst.install 'd'
+ end
+
+ assert_equal %w[c-1 d-1], inst.installed_gems.map { |s| s.full_name }
+ end
+
def test_install_dependency_existing
util_setup_gems
@@ -168,6 +388,41 @@ class TestGemDependencyInstaller < Gem::TestCase
assert_equal %w[b-1], inst.installed_gems.map { |s| s.full_name }
end
+ def test_install_dependency_existing_extension
+ extconf_rb = File.join @gemhome, 'gems', 'e-1', 'extconf.rb'
+ FileUtils.mkdir_p File.dirname extconf_rb
+
+ open extconf_rb, 'w' do |io|
+ io.write <<-EXTCONF_RB
+ require 'mkmf'
+ create_makefile 'e'
+ EXTCONF_RB
+ end
+
+ e1 = new_spec 'e', '1', nil, 'extconf.rb' do |s|
+ s.extensions << 'extconf.rb'
+ end
+ e1_gem = File.join @tempdir, 'gems', "#{e1.full_name}.gem"
+
+ _, f1_gem = util_gem 'f', '1', 'e' => nil
+
+ Gem::Installer.new(e1_gem).install
+ FileUtils.rm_r e1.extension_install_dir
+
+ FileUtils.mv e1_gem, @tempdir
+ FileUtils.mv f1_gem, @tempdir
+ inst = nil
+
+ Dir.chdir @tempdir do
+ inst = Gem::DependencyInstaller.new
+ inst.install 'f'
+ end
+
+ assert_equal %w[f-1], inst.installed_gems.map { |s| s.full_name }
+
+ assert_path_exists e1.extension_install_dir
+ end
+
def test_install_dependency_old
_, e1_gem = util_gem 'e', '1'
_, f1_gem = util_gem 'f', '1', 'e' => nil
@@ -247,6 +502,42 @@ class TestGemDependencyInstaller < Gem::TestCase
assert_equal %w[a-1], inst.installed_gems.map { |s| s.full_name }
end
+ def test_install_minimal_deps
+ util_setup_gems
+
+ _, e1_gem = util_gem 'e', '1' do |s|
+ s.add_dependency 'b'
+ end
+
+ _, b2_gem = util_gem 'b', '2' do |s|
+ s.add_dependency 'a'
+ end
+
+ util_clear_gems
+
+ FileUtils.mv @a1_gem, @tempdir
+ FileUtils.mv @b1_gem, @tempdir
+ FileUtils.mv b2_gem, @tempdir
+ FileUtils.mv e1_gem, @tempdir
+
+ inst = nil
+
+ Dir.chdir @tempdir do
+ inst = Gem::DependencyInstaller.new :ignore_dependencies => true
+ inst.install 'b', req('= 1')
+ end
+
+ assert_equal %w[b-1], inst.installed_gems.map { |s| s.full_name },
+ 'sanity check'
+
+ Dir.chdir @tempdir do
+ inst = Gem::DependencyInstaller.new :minimal_deps => true
+ inst.install 'e'
+ end
+
+ assert_equal %w[a-1 e-1], inst.installed_gems.map { |s| s.full_name }
+ end
+
def test_install_env_shebang
util_setup_gems
@@ -280,6 +571,22 @@ class TestGemDependencyInstaller < Gem::TestCase
assert_equal %w[b-1], inst.installed_gems.map { |s| s.full_name }
end
+ def test_install_build_args
+ util_setup_gems
+
+ FileUtils.mv @a1_gem, @tempdir
+ inst = nil
+ build_args = %w[--a --b="c"]
+
+ Dir.chdir @tempdir do
+ inst = Gem::DependencyInstaller.new(
+ :build_args => build_args)
+ inst.install 'a'
+ end
+
+ assert_equal build_args.join("\n"), File.read(inst.installed_gems.first.build_info_file).strip
+ end
+
def test_install_ignore_dependencies
util_setup_gems
@@ -298,16 +605,21 @@ class TestGemDependencyInstaller < Gem::TestCase
util_setup_gems
FileUtils.mv @a1_gem, @tempdir
+ FileUtils.mv @b1_gem, @tempdir
+
+ inst = Gem::Installer.new @a1.file_name
+ inst.install
+
gemhome2 = File.join @tempdir, 'gemhome2'
Dir.mkdir gemhome2
inst = nil
Dir.chdir @tempdir do
inst = Gem::DependencyInstaller.new :install_dir => gemhome2
- inst.install 'a'
+ inst.install 'b'
end
- assert_equal %w[a-1], inst.installed_gems.map { |s| s.full_name }
+ assert_equal %w[a-1 b-1], inst.installed_gems.map { |s| s.full_name }
assert File.exist?(File.join(gemhome2, 'specifications', @a1.spec_name))
assert File.exist?(File.join(gemhome2, 'cache', @a1.file_name))
@@ -365,12 +677,12 @@ class TestGemDependencyInstaller < Gem::TestCase
inst = nil
Dir.chdir @tempdir do
- e = assert_raises Gem::DependencyError do
+ e = assert_raises Gem::UnsatisfiableDependencyError do
inst = Gem::DependencyInstaller.new :domain => :local
inst.install 'b'
end
- expected = "Unable to resolve dependencies: b requires a (>= 0)"
+ expected = "Unable to resolve dependency: 'b (= 1)' requires 'a (>= 0)'"
assert_equal expected, e.message
end
@@ -504,6 +816,17 @@ class TestGemDependencyInstaller < Gem::TestCase
assert_equal %w[a-1], inst.installed_gems.map { |s| s.full_name }
end
+ def test_install_platform_is_ignored_when_a_file_is_specified
+ _, a_gem = util_gem 'a', '1' do |s|
+ s.platform = Gem::Platform.new %w[cpu other_platform 1]
+ end
+
+ inst = Gem::DependencyInstaller.new :domain => :local
+ inst.install a_gem
+
+ assert_equal %w[a-1-cpu-other_platform-1], inst.installed_gems.map { |s| s.full_name }
+ end
+
if defined? OpenSSL then
def test_install_security_policy
util_setup_gems
@@ -517,11 +840,12 @@ class TestGemDependencyInstaller < Gem::TestCase
policy = Gem::Security::HighSecurity
inst = Gem::DependencyInstaller.new :security_policy => policy
- e = assert_raises Gem::Exception do
+ e = assert_raises Gem::Security::Exception do
inst.install 'b'
end
- assert_equal 'Unsigned gem', e.message
+ assert_equal 'unsigned gems are not allowed by the High Security policy',
+ e.message
assert_equal %w[], inst.installed_gems.map { |s| s.full_name }
end
@@ -581,7 +905,78 @@ class TestGemDependencyInstaller < Gem::TestCase
Gem::Specification.reset
- assert_equal [[@b1, @gem_repo]], inst.find_gems_with_sources(dep)
+ set = inst.find_gems_with_sources(dep)
+
+ assert_kind_of Gem::AvailableSet, set
+
+ s = set.set.first
+
+ assert_equal @b1, s.spec
+ assert_equal Gem::Source.new(@gem_repo), s.source
+ end
+
+ def test_find_spec_by_name_and_version_wildcard
+ util_gem 'a', 1
+ FileUtils.mv 'gems/a-1.gem', @tempdir
+
+ FileUtils.touch 'rdoc.gem'
+
+ inst = Gem::DependencyInstaller.new
+
+ available = inst.find_spec_by_name_and_version('*.gem')
+
+ assert_equal %w[a-1], available.each_spec.map { |spec| spec.full_name }
+ end
+
+ def test_find_spec_by_name_and_version_wildcard_bad_gem
+ FileUtils.touch 'rdoc.gem'
+
+ inst = Gem::DependencyInstaller.new
+
+ assert_raises Gem::Package::FormatError do
+ inst.find_spec_by_name_and_version '*.gem'
+ end
+ end
+
+ def test_find_spec_by_name_and_version_bad_gem
+ FileUtils.touch 'rdoc.gem'
+
+ inst = Gem::DependencyInstaller.new
+
+ e = assert_raises Gem::Package::FormatError do
+ inst.find_spec_by_name_and_version 'rdoc.gem'
+ end
+
+ full_path = File.join @tempdir, 'rdoc.gem'
+ assert_equal "package metadata is missing in #{full_path}", e.message
+ end
+
+ def test_find_spec_by_name_and_version_directory
+ Dir.mkdir 'rdoc'
+
+ inst = Gem::DependencyInstaller.new
+
+ e = assert_raises Gem::SpecificGemNotFoundException do
+ inst.find_spec_by_name_and_version 'rdoc'
+ end
+
+ assert_equal "Could not find a valid gem 'rdoc' (>= 0) " +
+ "locally or in a repository",
+ e.message
+ end
+
+ def test_find_spec_by_name_and_version_file
+ FileUtils.touch 'rdoc'
+
+ inst = Gem::DependencyInstaller.new
+
+ e = assert_raises Gem::SpecificGemNotFoundException do
+ inst.find_spec_by_name_and_version 'rdoc'
+ end
+
+ assert_equal "Could not find a valid gem 'rdoc' (>= 0) " +
+ "locally or in a repository",
+ e.message
end
def test_find_gems_with_sources_local
@@ -590,21 +985,25 @@ class TestGemDependencyInstaller < Gem::TestCase
FileUtils.mv @a1_gem, @tempdir
inst = Gem::DependencyInstaller.new
dep = Gem::Dependency.new 'a', '>= 0'
- gems = nil
+ set = nil
Dir.chdir @tempdir do
- gems = inst.find_gems_with_sources dep
+ set = inst.find_gems_with_sources dep
end
+ gems = set.sorted
+
assert_equal 2, gems.length
- remote = gems.first
- assert_equal 'a-1', remote.first.full_name, 'remote spec'
- assert_equal @gem_repo, remote.last, 'remote path'
- local = gems.last
- assert_equal 'a-1', local.first.full_name, 'local spec'
+ remote, local = gems
+
+ assert_equal 'a-1', local.spec.full_name, 'local spec'
assert_equal File.join(@tempdir, @a1.file_name),
- local.last, 'local path'
+ local.source.download(local.spec), 'local path'
+
+ assert_equal 'a-1', remote.spec.full_name, 'remote spec'
+ assert_equal Gem::Source.new(@gem_repo), remote.source, 'remote path'
+
end
def test_find_gems_with_sources_prerelease
@@ -615,7 +1014,7 @@ class TestGemDependencyInstaller < Gem::TestCase
dependency = Gem::Dependency.new('a', Gem::Requirement.default)
releases =
- installer.find_gems_with_sources(dependency).map { |gems, *| gems }
+ installer.find_gems_with_sources(dependency).all_specs
assert releases.any? { |s| s.name == 'a' and s.version.to_s == '1' }
refute releases.any? { |s| s.name == 'a' and s.version.to_s == '1.a' }
@@ -623,9 +1022,22 @@ class TestGemDependencyInstaller < Gem::TestCase
dependency.prerelease = true
prereleases =
- installer.find_gems_with_sources(dependency).map { |gems, *| gems }
+ installer.find_gems_with_sources(dependency).all_specs
+
+ assert_equal [@a1_pre, @a1], prereleases
+ end
+
+ def test_find_gems_with_sources_with_bad_source
+ Gem.sources.replace ["http://not-there.nothing"]
+
+ installer = Gem::DependencyInstaller.new
+
+ dep = Gem::Dependency.new('a')
+
+ out = installer.find_gems_with_sources(dep)
- assert_equal [@a1_pre], prereleases
+ assert out.empty?
+ assert_kind_of Gem::SourceFetchProblem, installer.errors.first
end
def assert_resolve expected, *specs
diff --git a/test/rubygems/test_gem_dependency_list.rb b/test/rubygems/test_gem_dependency_list.rb
index b6d1b2f754..d25359e84b 100644
--- a/test/rubygems/test_gem_dependency_list.rb
+++ b/test/rubygems/test_gem_dependency_list.rb
@@ -11,26 +11,17 @@ class TestGemDependencyList < Gem::TestCase
@deplist = Gem::DependencyList.new
# TODO: switch to new_spec
- @a1 = quick_spec 'a', '1'
- @a2 = quick_spec 'a', '2'
- @a3 = quick_spec 'a', '3'
+ @a1 = util_spec 'a', '1'
+ @a2 = util_spec 'a', '2'
+ @a3 = util_spec 'a', '3'
- @b1 = quick_spec 'b', '1' do |s| s.add_dependency 'a', '>= 1' end
- @b2 = quick_spec 'b', '2' do |s| s.add_dependency 'a', '>= 1' end
+ @b1 = util_spec 'b', '1' do |s| s.add_dependency 'a', '>= 1' end
+ @b2 = util_spec 'b', '2' do |s| s.add_dependency 'a', '>= 1' end
- @c1 = quick_spec 'c', '1' do |s| s.add_dependency 'b', '>= 1' end
- @c2 = quick_spec 'c', '2'
+ @c1 = util_spec 'c', '1' do |s| s.add_dependency 'b', '>= 1' end
+ @c2 = util_spec 'c', '2'
- @d1 = quick_spec 'd', '1' do |s| s.add_dependency 'c', '>= 1' end
- end
-
- def test_self_from_source_index
- util_clear_gems
- install_specs @a1, @b2
-
- deps = Gem::Deprecate.skip_during { Gem::DependencyList.from_source_index }
-
- assert_equal %w[b-2 a-1], deps.dependency_order.map { |s| s.full_name }
+ @d1 = util_spec 'd', '1' do |s| s.add_dependency 'c', '>= 1' end
end
def test_active_count
@@ -66,9 +57,9 @@ class TestGemDependencyList < Gem::TestCase
end
def test_dependency_order_development
- e1 = quick_spec 'e', '1'
- f1 = quick_spec 'f', '1'
- g1 = quick_spec 'g', '1'
+ e1 = util_spec 'e', '1'
+ f1 = util_spec 'f', '1'
+ g1 = util_spec 'g', '1'
@a1.add_dependency 'e'
@a1.add_dependency 'f'
@@ -94,7 +85,7 @@ class TestGemDependencyList < Gem::TestCase
def test_dependency_order_diamond
util_diamond
- e1 = quick_spec 'e', '1'
+ e1 = util_spec 'e', '1'
@deplist.add e1
@a1.add_dependency 'e', '>= 1'
@@ -170,13 +161,13 @@ class TestGemDependencyList < Gem::TestCase
end
def test_ok_eh_mismatch
- a1 = quick_spec 'a', '1'
- a2 = quick_spec 'a', '2'
+ a1 = util_spec 'a', '1'
+ a2 = util_spec 'a', '2'
- b = quick_spec 'b', '1' do |s| s.add_dependency 'a', '= 1' end
- c = quick_spec 'c', '1' do |s| s.add_dependency 'a', '= 2' end
+ b = util_spec 'b', '1' do |s| s.add_dependency 'a', '= 1' end
+ c = util_spec 'c', '1' do |s| s.add_dependency 'a', '= 2' end
- d = quick_spec 'd', '1' do |s|
+ d = util_spec 'd', '1' do |s|
s.add_dependency 'b'
s.add_dependency 'c'
end
diff --git a/test/rubygems/test_gem_dependency_resolution_error.rb b/test/rubygems/test_gem_dependency_resolution_error.rb
new file mode 100644
index 0000000000..0442082e6a
--- /dev/null
+++ b/test/rubygems/test_gem_dependency_resolution_error.rb
@@ -0,0 +1,28 @@
+require 'rubygems/test_case'
+
+class TestGemDependencyResolutionError < Gem::TestCase
+
+ def setup
+ super
+
+ @DR = Gem::Resolver
+
+ @spec = util_spec 'a', 2
+
+ @a1_req = @DR::DependencyRequest.new dep('a', '= 1'), nil
+ @a2_req = @DR::DependencyRequest.new dep('a', '= 2'), nil
+
+ @activated = @DR::ActivationRequest.new @spec, @a2_req
+
+ @conflict = @DR::Conflict.new @a1_req, @activated
+
+ @error = Gem::DependencyResolutionError.new @conflict
+ end
+
+ def test_message
+ assert_match %r%^conflicting dependencies a \(= 1\) and a \(= 2\)$%,
+ @error.message
+ end
+
+end
+
diff --git a/test/rubygems/test_gem_doc_manager.rb b/test/rubygems/test_gem_doc_manager.rb
deleted file mode 100644
index 226f69d9cf..0000000000
--- a/test/rubygems/test_gem_doc_manager.rb
+++ /dev/null
@@ -1,32 +0,0 @@
-require 'rubygems/test_case'
-require 'rubygems/doc_manager'
-
-class TestGemDocManager < Gem::TestCase
-
- def setup
- super
-
- @spec = quick_gem 'a', 2
- @manager = Gem::DocManager.new(@spec)
- end
-
- def test_uninstall_doc_unwritable
- path = @spec.base_dir
- orig_mode = File.stat(path).mode
-
- # File.chmod has no effect on MS Windows directories (it needs ACL).
- if win_platform?
- skip("test_uninstall_doc_unwritable skipped on MS Windows")
- else
- FileUtils.chmod 0000, path
- end
-
- assert_raises Gem::FilePermissionError do
- @manager.uninstall_doc
- end
- ensure
- FileUtils.chmod orig_mode, path
- end
-
-end
-
diff --git a/test/rubygems/test_gem_doctor.rb b/test/rubygems/test_gem_doctor.rb
new file mode 100644
index 0000000000..f4d4659c02
--- /dev/null
+++ b/test/rubygems/test_gem_doctor.rb
@@ -0,0 +1,168 @@
+require 'rubygems/test_case'
+require 'rubygems/doctor'
+
+class TestGemDoctor < Gem::TestCase
+
+ def gem name
+ spec = quick_gem name do |gem|
+ gem.files = %W[lib/#{name}.rb Rakefile]
+ end
+
+ write_file File.join(*%W[gems #{spec.full_name} lib #{name}.rb])
+ write_file File.join(*%W[gems #{spec.full_name} Rakefile])
+
+ spec
+ end
+
+ def test_doctor
+ a = gem 'a'
+ b = gem 'b'
+ c = gem 'c'
+
+ Gem.use_paths @userhome, @gemhome
+
+ FileUtils.rm b.spec_file
+
+ open c.spec_file, 'w' do |io|
+ io.write 'this will raise an exception when evaluated.'
+ end
+
+ assert_path_exists File.join(a.gem_dir, 'Rakefile')
+ assert_path_exists File.join(a.gem_dir, 'lib', 'a.rb')
+
+ assert_path_exists b.gem_dir
+ refute_path_exists b.spec_file
+
+ assert_path_exists c.gem_dir
+ assert_path_exists c.spec_file
+
+ doctor = Gem::Doctor.new @gemhome
+
+ capture_io do
+ use_ui @ui do
+ doctor.doctor
+ end
+ end
+
+ assert_path_exists File.join(a.gem_dir, 'Rakefile')
+ assert_path_exists File.join(a.gem_dir, 'lib', 'a.rb')
+
+ refute_path_exists b.gem_dir
+ refute_path_exists b.spec_file
+
+ refute_path_exists c.gem_dir
+ refute_path_exists c.spec_file
+
+ expected = <<-OUTPUT
+Checking #{@gemhome}
+Removed file specifications/c-2.gemspec
+Removed directory gems/b-2
+Removed directory gems/c-2
+
+ OUTPUT
+
+ assert_equal expected, @ui.output
+
+ assert_equal Gem.dir, @userhome
+ assert_equal Gem.path, [@gemhome, @userhome]
+ end
+
+ def test_doctor_dry_run
+ a = gem 'a'
+ b = gem 'b'
+ c = gem 'c'
+
+ Gem.use_paths @userhome, @gemhome
+
+ FileUtils.rm b.spec_file
+
+ open c.spec_file, 'w' do |io|
+ io.write 'this will raise an exception when evaluated.'
+ end
+
+ assert_path_exists File.join(a.gem_dir, 'Rakefile')
+ assert_path_exists File.join(a.gem_dir, 'lib', 'a.rb')
+
+ assert_path_exists b.gem_dir
+ refute_path_exists b.spec_file
+
+ assert_path_exists c.gem_dir
+ assert_path_exists c.spec_file
+
+ doctor = Gem::Doctor.new @gemhome, true
+
+ capture_io do
+ use_ui @ui do
+ doctor.doctor
+ end
+ end
+
+ assert_path_exists File.join(a.gem_dir, 'Rakefile')
+ assert_path_exists File.join(a.gem_dir, 'lib', 'a.rb')
+
+ assert_path_exists b.gem_dir
+ refute_path_exists b.spec_file
+
+ assert_path_exists c.gem_dir
+ assert_path_exists c.spec_file
+
+ expected = <<-OUTPUT
+Checking #{@gemhome}
+Extra file specifications/c-2.gemspec
+Extra directory gems/b-2
+Extra directory gems/c-2
+
+ OUTPUT
+
+ assert_equal expected, @ui.output
+
+ assert_equal Gem.dir, @userhome
+ assert_equal Gem.path, [@gemhome, @userhome]
+ end
+
+ def test_doctor_non_gem_home
+ other_dir = File.join @tempdir, 'other', 'dir'
+
+ FileUtils.mkdir_p other_dir
+
+ doctor = Gem::Doctor.new @tempdir
+
+ capture_io do
+ use_ui @ui do
+ doctor.doctor
+ end
+ end
+
+ assert_path_exists other_dir
+
+ expected = <<-OUTPUT
+Checking #{@tempdir}
+This directory does not appear to be a RubyGems repository, skipping
+
+ OUTPUT
+
+ assert_equal expected, @ui.output
+ end
+
+ def test_doctor_child_missing
+ doctor = Gem::Doctor.new @gemhome
+
+ doctor.doctor_child 'missing', ''
+
+ assert true # count
+ end
+
+ def test_gem_repository_eh
+ doctor = Gem::Doctor.new @gemhome
+
+ refute doctor.gem_repository?, 'no gems installed'
+
+ util_spec 'a'
+
+ doctor = Gem::Doctor.new @gemhome
+
+ assert doctor.gem_repository?, 'gems installed'
+ end
+
+end
+
diff --git a/test/rubygems/test_gem_ext_builder.rb b/test/rubygems/test_gem_ext_builder.rb
new file mode 100644
index 0000000000..3da9bc9e60
--- /dev/null
+++ b/test/rubygems/test_gem_ext_builder.rb
@@ -0,0 +1,265 @@
+require 'rubygems/test_case'
+require 'rubygems/ext'
+require 'rubygems/installer'
+
+class TestGemExtBuilder < Gem::TestCase
+
+ def setup
+ super
+
+ @ext = File.join @tempdir, 'ext'
+ @dest_path = File.join @tempdir, 'prefix'
+
+ FileUtils.mkdir_p @ext
+ FileUtils.mkdir_p @dest_path
+
+ @orig_DESTDIR = ENV['DESTDIR']
+
+ @spec = util_spec 'a'
+
+ @builder = Gem::Ext::Builder.new @spec, ''
+ end
+
+ def teardown
+ ENV['DESTDIR'] = @orig_DESTDIR
+
+ super
+ end
+
+ def test_class_make
+ ENV['DESTDIR'] = 'destination'
+ results = []
+
+ Dir.chdir @ext do
+ open 'Makefile', 'w' do |io|
+ io.puts <<-MAKEFILE
+all:
+\t@#{Gem.ruby} -e "puts %Q{all: \#{ENV['DESTDIR']}}"
+
+clean:
+\t@#{Gem.ruby} -e "puts %Q{clean: \#{ENV['DESTDIR']}}"
+
+install:
+\t@#{Gem.ruby} -e "puts %Q{install: \#{ENV['DESTDIR']}}"
+ MAKEFILE
+ end
+
+ Gem::Ext::Builder.make @dest_path, results
+ end
+
+ results = results.join "\n"
+
+ if RUBY_VERSION > '2.0' then
+ assert_match %r%"DESTDIR=#{ENV['DESTDIR']}" clean$%, results
+ assert_match %r%"DESTDIR=#{ENV['DESTDIR']}"$%, results
+ assert_match %r%"DESTDIR=#{ENV['DESTDIR']}" install$%, results
+ else
+ refute_match %r%"DESTDIR=#{ENV['DESTDIR']}" clean$%, results
+ refute_match %r%"DESTDIR=#{ENV['DESTDIR']}"$%, results
+ refute_match %r%"DESTDIR=#{ENV['DESTDIR']}" install$%, results
+ end
+
+ if /nmake/ !~ results
+ assert_match %r%^clean: destination$%, results
+ assert_match %r%^all: destination$%, results
+ assert_match %r%^install: destination$%, results
+ end
+ end
+
+ def test_class_make_no_clean
+ ENV['DESTDIR'] = 'destination'
+ results = []
+
+ Dir.chdir @ext do
+ open 'Makefile', 'w' do |io|
+ io.puts <<-MAKEFILE
+all:
+\t@#{Gem.ruby} -e "puts %Q{all: \#{ENV['DESTDIR']}}"
+
+install:
+\t@#{Gem.ruby} -e "puts %Q{install: \#{ENV['DESTDIR']}}"
+ MAKEFILE
+ end
+
+ Gem::Ext::Builder.make @dest_path, results
+ end
+
+ results = results.join "\n"
+
+ if RUBY_VERSION > '2.0' then
+ assert_match %r%"DESTDIR=#{ENV['DESTDIR']}" clean$%, results
+ assert_match %r%"DESTDIR=#{ENV['DESTDIR']}"$%, results
+ assert_match %r%"DESTDIR=#{ENV['DESTDIR']}" install$%, results
+ else
+ refute_match %r%"DESTDIR=#{ENV['DESTDIR']}" clean$%, results
+ refute_match %r%"DESTDIR=#{ENV['DESTDIR']}"$%, results
+ refute_match %r%"DESTDIR=#{ENV['DESTDIR']}" install$%, results
+ end
+ end
+
+ def test_build_extensions
+ @spec.extensions << 'ext/extconf.rb'
+
+ ext_dir = File.join @spec.gem_dir, 'ext'
+
+ FileUtils.mkdir_p ext_dir
+
+ extconf_rb = File.join ext_dir, 'extconf.rb'
+
+ open extconf_rb, 'w' do |f|
+ f.write <<-'RUBY'
+ require 'mkmf'
+
+ create_makefile 'a'
+ RUBY
+ end
+
+ ext_lib_dir = File.join ext_dir, 'lib'
+ FileUtils.mkdir ext_lib_dir
+ FileUtils.touch File.join ext_lib_dir, 'a.rb'
+
+ use_ui @ui do
+ @builder.build_extensions
+ end
+
+ assert_path_exists @spec.extension_install_dir
+ assert_path_exists @spec.gem_build_complete_path
+ assert_path_exists File.join @spec.extension_install_dir, 'gem_make.out'
+ assert_path_exists File.join @spec.extension_install_dir, 'a.rb'
+ assert_path_exists File.join @spec.gem_dir, 'lib', 'a.rb'
+ end
+
+ def test_build_extensions_none
+ use_ui @ui do
+ @builder.build_extensions
+ end
+
+ assert_equal '', @ui.output
+ assert_equal '', @ui.error
+
+ refute_path_exists File.join @spec.extension_install_dir, 'gem_make.out'
+ end
+
+ def test_build_extensions_rebuild_failure
+ FileUtils.mkdir_p @spec.extension_install_dir
+ FileUtils.touch @spec.gem_build_complete_path
+
+ @spec.extensions << nil
+
+ assert_raises Gem::Ext::BuildError do
+ use_ui @ui do
+ @builder.build_extensions
+ end
+ end
+
+ refute_path_exists @spec.gem_build_complete_path
+ end
+
+ def test_build_extensions_extconf_bad
+ @spec.extensions << 'extconf.rb'
+
+ FileUtils.mkdir_p @spec.gem_dir
+
+ e = assert_raises Gem::Ext::BuildError do
+ use_ui @ui do
+ @builder.build_extensions
+ end
+ end
+
+ assert_match(/\AERROR: Failed to build gem native extension.$/, e.message)
+
+ assert_equal "Building native extensions. This could take a while...\n",
+ @ui.output
+ assert_equal '', @ui.error
+
+ gem_make_out = File.join @spec.extension_install_dir, 'gem_make.out'
+
+ assert_match %r%#{Regexp.escape Gem.ruby} extconf\.rb%,
+ File.read(gem_make_out)
+ assert_match %r%#{Regexp.escape Gem.ruby}: No such file%,
+ File.read(gem_make_out)
+
+ refute_path_exists @spec.gem_build_complete_path
+ end
+
+ def test_build_extensions_unsupported
+ FileUtils.mkdir_p @spec.gem_dir
+ gem_make_out = File.join @spec.extension_install_dir, 'gem_make.out'
+ @spec.extensions << nil
+
+ e = assert_raises Gem::Ext::BuildError do
+ use_ui @ui do
+ @builder.build_extensions
+ end
+ end
+
+ assert_match(/^\s*No builder for extension ''$/, e.message)
+
+ assert_equal "Building native extensions. This could take a while...\n",
+ @ui.output
+ assert_equal '', @ui.error
+
+ assert_equal "No builder for extension ''\n", File.read(gem_make_out)
+
+ refute_path_exists @spec.gem_build_complete_path
+ ensure
+ FileUtils.rm_f gem_make_out
+ end
+
+ def test_build_extensions_with_build_args
+ args = ["--aa", "--bb"]
+ @builder.build_args = args
+ @spec.extensions << 'extconf.rb'
+
+ FileUtils.mkdir_p @spec.gem_dir
+
+ open File.join(@spec.gem_dir, "extconf.rb"), "w" do |f|
+ f.write <<-'RUBY'
+ puts "IN EXTCONF"
+ extconf_args = File.join File.dirname(__FILE__), 'extconf_args'
+ File.open extconf_args, 'w' do |f|
+ f.puts ARGV.inspect
+ end
+
+ File.open 'Makefile', 'w' do |f|
+ f.puts "clean:\n\techo cleaned"
+ f.puts "default:\n\techo built"
+ f.puts "install:\n\techo installed"
+ end
+ RUBY
+ end
+
+ use_ui @ui do
+ @builder.build_extensions
+ end
+
+ path = File.join @spec.gem_dir, "extconf_args"
+
+ assert_equal args.inspect, File.read(path).strip
+ assert_path_exists @spec.extension_install_dir
+ end
+
+ def test_initialize
+ build_info_dir = File.join @gemhome, 'build_info'
+
+ FileUtils.mkdir_p build_info_dir
+
+ build_info_file = File.join build_info_dir, "#{@spec.full_name}.info"
+
+ open build_info_file, 'w' do |io|
+ io.puts '--with-foo-dir=/nonexistent'
+ end
+
+ builder = Gem::Ext::Builder.new @spec
+
+ assert_equal %w[--with-foo-dir=/nonexistent], builder.build_args
+ end
+
+ def test_initialize_build_args
+ builder = Gem::Ext::Builder.new @spec, %w[--with-foo-dir=/nonexistent]
+
+ assert_equal %w[--with-foo-dir=/nonexistent], builder.build_args
+ end
+
+end
+
diff --git a/test/rubygems/test_gem_ext_cmake_builder.rb b/test/rubygems/test_gem_ext_cmake_builder.rb
new file mode 100644
index 0000000000..aaece6868b
--- /dev/null
+++ b/test/rubygems/test_gem_ext_cmake_builder.rb
@@ -0,0 +1,84 @@
+require 'rubygems/test_case'
+require 'rubygems/ext'
+
+class TestGemExtCmakeBuilder < Gem::TestCase
+
+ def setup
+ super
+
+ `cmake #{Gem::Ext::Builder.redirector}`
+
+ skip 'cmake not present' unless $?.success?
+
+ @ext = File.join @tempdir, 'ext'
+ @dest_path = File.join @tempdir, 'prefix'
+
+ FileUtils.mkdir_p @ext
+ FileUtils.mkdir_p @dest_path
+ end
+
+ def test_self_build
+ File.open File.join(@ext, 'CMakeLists.txt'), 'w' do |cmakelists|
+ cmakelists.write <<-eo_cmake
+cmake_minimum_required(VERSION 2.8)
+install (FILES test.txt DESTINATION bin)
+ eo_cmake
+ end
+
+ FileUtils.touch File.join(@ext, 'test.txt')
+
+ output = []
+
+ Dir.chdir @ext do
+ Gem::Ext::CmakeBuilder.build nil, nil, @dest_path, output
+ end
+
+ output = output.join "\n"
+
+ assert_match \
+ %r%^cmake \. -DCMAKE_INSTALL_PREFIX=#{Regexp.escape @dest_path}%, output
+ assert_match %r%#{Regexp.escape @ext}%, output
+ assert_contains_make_command '', output
+ assert_contains_make_command 'install', output
+ assert_match %r%test\.txt%, output
+ end
+
+ def test_self_build_fail
+ output = []
+
+ error = assert_raises Gem::InstallError do
+ Dir.chdir @ext do
+ Gem::Ext::CmakeBuilder.build nil, nil, @dest_path, output
+ end
+ end
+
+ output = output.join "\n"
+
+ shell_error_msg = %r{(CMake Error: .*)}
+ sh_prefix_cmake = "cmake . -DCMAKE_INSTALL_PREFIX="
+
+ assert_match 'cmake failed', error.message
+
+ assert_match %r%^#{sh_prefix_cmake}#{Regexp.escape @dest_path}%, output
+ assert_match %r%#{shell_error_msg}%, output
+ end
+
+ def test_self_build_has_makefile
+ File.open File.join(@ext, 'Makefile'), 'w' do |makefile|
+ makefile.puts "all:\n\t@echo ok\ninstall:\n\t@echo ok"
+ end
+
+ output = []
+
+ Dir.chdir @ext do
+ Gem::Ext::CmakeBuilder.build nil, nil, @dest_path, output
+ end
+
+ output = output.join "\n"
+
+ assert_contains_make_command '', output
+ assert_contains_make_command 'install', output
+ end
+
+end
+
diff --git a/test/rubygems/test_gem_ext_configure_builder.rb b/test/rubygems/test_gem_ext_configure_builder.rb
index 65d31f61af..34e9fccd46 100644
--- a/test/rubygems/test_gem_ext_configure_builder.rb
+++ b/test/rubygems/test_gem_ext_configure_builder.rb
@@ -6,7 +6,8 @@ class TestGemExtConfigureBuilder < Gem::TestCase
def setup
super
- @makefile_body = "all:\n\t@echo ok\ninstall:\n\t@echo ok"
+ @makefile_body =
+ "clean:\n\t@echo ok\nall:\n\t@echo ok\ninstall:\n\t@echo ok"
@ext = File.join @tempdir, 'ext'
@dest_path = File.join @tempdir, 'prefix'
@@ -30,9 +31,11 @@ class TestGemExtConfigureBuilder < Gem::TestCase
assert_equal "sh ./configure --prefix=#{@dest_path}", output.shift
assert_equal "", output.shift
- assert_equal make_command, output.shift
+ assert_contains_make_command 'clean', output.shift
assert_match(/^ok$/m, output.shift)
- assert_equal make_command + " install", output.shift
+ assert_contains_make_command '', output.shift
+ assert_match(/^ok$/m, output.shift)
+ assert_contains_make_command 'install', output.shift
assert_match(/^ok$/m, output.shift)
end
@@ -49,13 +52,7 @@ class TestGemExtConfigureBuilder < Gem::TestCase
shell_error_msg = %r{(\./configure: .*)|((?:Can't|cannot) open \./configure(?:: No such file or directory)?)}
sh_prefix_configure = "sh ./configure --prefix="
- expected = %r(configure failed:
-
-#{Regexp.escape sh_prefix_configure}#{Regexp.escape @dest_path}
-(?:.*?: )?#{shell_error_msg}
-)
-
- assert_match expected, error.message
+ assert_match 'configure failed', error.message
assert_equal "#{sh_prefix_configure}#{@dest_path}", output.shift
assert_match %r(#{shell_error_msg}), output.shift
@@ -76,8 +73,9 @@ class TestGemExtConfigureBuilder < Gem::TestCase
Gem::Ext::ConfigureBuilder.build nil, nil, @dest_path, output
end
- assert_equal make_command, output[0]
- assert_equal "#{make_command} install", output[2]
+ assert_contains_make_command 'clean', output[0]
+ assert_contains_make_command '', output[2]
+ assert_contains_make_command 'install', output[4]
end
end
diff --git a/test/rubygems/test_gem_ext_ext_conf_builder.rb b/test/rubygems/test_gem_ext_ext_conf_builder.rb
index c050d82f9c..aa9008c793 100644
--- a/test/rubygems/test_gem_ext_ext_conf_builder.rb
+++ b/test/rubygems/test_gem_ext_ext_conf_builder.rb
@@ -1,3 +1,5 @@
+# coding: UTF-8
+
require 'rubygems/test_case'
require 'rubygems/ext'
@@ -25,19 +27,18 @@ class TestGemExtExtConfBuilder < Gem::TestCase
output = []
Dir.chdir @ext do
- Gem::Ext::ExtConfBuilder.build 'extconf.rb', nil, @dest_path, output
+ result =
+ Gem::Ext::ExtConfBuilder.build 'extconf.rb', nil, @dest_path, output
+
+ assert_same result, output
end
assert_match(/^#{Gem.ruby} extconf.rb/, output[0])
assert_equal "creating Makefile\n", output[1]
- case RUBY_PLATFORM
- when /mswin/ then
- assert_equal "nmake", output[2]
- assert_equal "nmake install", output[4]
- else
- assert_equal "make", output[2]
- assert_equal "make install", output[4]
- end
+ assert_contains_make_command 'clean', output[2]
+ assert_contains_make_command '', output[4]
+ assert_contains_make_command 'install', output[6]
+ assert_empty Dir.glob(File.join(@ext, 'siteconf*.rb'))
end
def test_class_build_rbconfig_make_prog
@@ -54,8 +55,9 @@ class TestGemExtExtConfBuilder < Gem::TestCase
end
assert_equal "creating Makefile\n", output[1]
- assert_equal make_command, output[2]
- assert_equal "#{make_command} install", output[4]
+ assert_contains_make_command 'clean', output[2]
+ assert_contains_make_command '', output[4]
+ assert_contains_make_command 'install', output[6]
ensure
RbConfig::CONFIG['configure_args'] = configure_args
end
@@ -77,8 +79,8 @@ class TestGemExtExtConfBuilder < Gem::TestCase
end
end
- assert_equal "creating Makefile\n", output[1]
- assert_equal "anothermake", output[2]
+ assert_equal "creating Makefile\n", output[1]
+ assert_contains_make_command 'clean', output[2]
ensure
RbConfig::CONFIG['configure_args'] = configure_args
ENV['make'] = env_make
@@ -103,12 +105,52 @@ class TestGemExtExtConfBuilder < Gem::TestCase
end
end
- assert_match(/\Aextconf failed:
+ assert_equal 'extconf failed, exit code 1', error.message
-#{Gem.ruby} extconf.rb.*
-checking for main\(\) in .*?nonexistent/m, error.message)
+ assert_equal("#{Gem.ruby} extconf.rb", output[0])
+ end
- assert_match(/^#{Gem.ruby} extconf.rb/, output[0])
+ def test_class_build_unconventional
+ if vc_windows? && !nmake_found?
+ skip("test_class_build skipped - nmake not found")
+ end
+
+ File.open File.join(@ext, 'extconf.rb'), 'w' do |extconf|
+ extconf.puts <<-'EXTCONF'
+include RbConfig
+
+ruby =
+ if ENV['RUBY'] then
+ ENV['RUBY']
+ else
+ ruby_exe = "#{CONFIG['RUBY_INSTALL_NAME']}#{CONFIG['EXEEXT']}"
+ File.join CONFIG['bindir'], ruby_exe
+ end
+
+open 'Makefile', 'w' do |io|
+ io.write <<-Makefile
+clean: ruby
+all: ruby
+install: ruby
+
+ruby:
+\t#{ruby} -e0
+
+ Makefile
+end
+ EXTCONF
+ end
+
+ output = []
+
+ Dir.chdir @ext do
+ Gem::Ext::ExtConfBuilder.build 'extconf.rb', nil, @dest_path, output
+ end
+
+ assert_contains_make_command 'clean', output[2]
+ assert_contains_make_command '', output[4]
+ assert_contains_make_command 'install', output[6]
+ assert_empty Dir.glob(File.join(@ext, 'siteconf*.rb'))
end
def test_class_make
@@ -119,8 +161,10 @@ checking for main\(\) in .*?nonexistent/m, error.message)
output = []
makefile_path = File.join(@ext, 'Makefile')
File.open makefile_path, 'w' do |makefile|
+ makefile.puts "# π"
makefile.puts "RUBYARCHDIR = $(foo)$(target_prefix)"
makefile.puts "RUBYLIBDIR = $(bar)$(target_prefix)"
+ makefile.puts "clean:"
makefile.puts "all:"
makefile.puts "install:"
end
@@ -129,17 +173,9 @@ checking for main\(\) in .*?nonexistent/m, error.message)
Gem::Ext::ExtConfBuilder.make @ext, output
end
- assert_equal make_command, output[0]
- assert_equal "#{make_command} install", output[2]
-
- edited_makefile = <<-EOF
-RUBYARCHDIR = #{@ext}$(target_prefix)
-RUBYLIBDIR = #{@ext}$(target_prefix)
-all:
-install:
- EOF
-
- assert_equal edited_makefile, File.read(makefile_path)
+ assert_contains_make_command 'clean', output[0]
+ assert_contains_make_command '', output[2]
+ assert_contains_make_command 'install', output[4]
end
def test_class_make_no_Makefile
@@ -149,13 +185,7 @@ install:
end
end
- expected = <<-EOF.strip
-Makefile not found:
-
-output
- EOF
-
- assert_equal expected, error.message
+ assert_equal 'Makefile not found', error.message
end
end
diff --git a/test/rubygems/test_gem_ext_rake_builder.rb b/test/rubygems/test_gem_ext_rake_builder.rb
index d30664372d..0f4789a68f 100644
--- a/test/rubygems/test_gem_ext_rake_builder.rb
+++ b/test/rubygems/test_gem_ext_rake_builder.rb
@@ -24,18 +24,18 @@ class TestGemExtRakeBuilder < Gem::TestCase
output = []
realdir = nil # HACK /tmp vs. /private/tmp
- build_rake_in do
+ build_rake_in do |rake|
Dir.chdir @ext do
realdir = Dir.pwd
Gem::Ext::RakeBuilder.build 'mkrf_conf.rb', nil, @dest_path, output
end
- end
- output = output.join "\n"
+ output = output.join "\n"
- refute_match %r%^rake failed:%, output
- assert_match %r%^#{Regexp.escape @@ruby} mkrf_conf\.rb%, output
- assert_match %r%^#{Regexp.escape @@rake} RUBYARCHDIR=#{Regexp.escape @dest_path} RUBYLIBDIR=#{Regexp.escape @dest_path}%, output
+ refute_match %r%^rake failed:%, output
+ assert_match %r%^#{Regexp.escape @@ruby} mkrf_conf\.rb%, output
+ assert_match %r%^#{Regexp.escape rake} RUBYARCHDIR=#{Regexp.escape @dest_path} RUBYLIBDIR=#{Regexp.escape @dest_path}%, output
+ end
end
def test_class_build_fail
@@ -44,22 +44,20 @@ class TestGemExtRakeBuilder < Gem::TestCase
File.open("Rakefile","w") do |f|
f.puts "task :default do abort 'fail' end"
end
- EO_MKRF
+ EO_MKRF
end
output = []
- error = assert_raises Gem::InstallError do
- build_rake_in do
+ build_rake_in(false) do |rake|
+ error = assert_raises Gem::InstallError do
Dir.chdir @ext do
Gem::Ext::RakeBuilder.build "mkrf_conf.rb", nil, @dest_path, output
end
end
- end
- assert_match %r%^rake failed:%, error.message
- assert_match %r%^#{Regexp.escape @@ruby} mkrf_conf\.rb%, error.message
- assert_match %r%^#{Regexp.escape @@rake} RUBYARCHDIR=#{Regexp.escape @dest_path} RUBYLIBDIR=#{Regexp.escape @dest_path}%, error.message
+ assert_match %r%^rake failed%, error.message
+ end
end
end
diff --git a/test/rubygems/test_gem_format.rb b/test/rubygems/test_gem_format.rb
deleted file mode 100644
index 711527bf79..0000000000
--- a/test/rubygems/test_gem_format.rb
+++ /dev/null
@@ -1,88 +0,0 @@
-require 'rubygems/package/tar_test_case'
-require 'rubygems/simple_gem'
-require 'rubygems/format'
-
-class TestGemFormat < Gem::Package::TarTestCase
-
- def setup
- super
-
- @simple_gem = SIMPLE_GEM
- end
-
- # HACK this test should do less
- def test_class_from_file_by_path
- util_make_gems
-
- gems = Dir[File.join(@gemhome, "cache", "*.gem")]
-
- names = [@a1, @a2, @a3a, @a_evil9, @b2, @c1_2, @pl1].map do |spec|
- spec.original_name
- end
-
- gems_n_names = gems.sort.zip names
-
- gems_n_names.each do |gemfile, name|
- spec = Gem::Format.from_file_by_path(gemfile).spec
-
- assert_equal name, spec.original_name
- end
- end
-
- def test_class_from_file_by_path_corrupt
- Tempfile.open 'corrupt' do |io|
- data = Gem.gzip 'a' * 10
- io.write tar_file_header('metadata.gz', "\000x", 0644, data.length)
- io.write data
- io.rewind
-
- e = assert_raises Gem::Package::FormatError do
- Gem::Format.from_file_by_path io.path
- end
-
- sub_message = 'Gem::Package::TarInvalidError: tar is corrupt, name contains null byte'
- assert_equal "corrupt gem (#{sub_message}) in #{io.path}", e.message
- assert_equal io.path, e.path
- end
- end
-
- def test_class_from_file_by_path_empty
- util_make_gems
-
- empty_gem = File.join @tempdir, 'empty.gem'
- FileUtils.touch empty_gem
-
- assert_nil Gem::Format.from_file_by_path(empty_gem)
- end
-
- def test_class_from_file_by_path_nonexistent
- assert_raises Gem::Exception do
- Gem::Format.from_file_by_path '/a/path/that/is/nonexistent'
- end
- end
-
- def test_class_from_io_garbled
- e = assert_raises Gem::Package::FormatError do
- # subtly bogus input
- Gem::Format.from_io(StringIO.new(@simple_gem.upcase))
- end
-
- assert_equal 'no metadata found', e.message
-
- e = assert_raises Gem::Package::FormatError do
- # Totally bogus input
- Gem::Format.from_io(StringIO.new(@simple_gem.reverse))
- end
-
- assert_equal 'no metadata found', e.message
-
- e = assert_raises Gem::Package::FormatError do
- # This was intentionally screws up YAML parsing.
- Gem::Format.from_io(StringIO.new(@simple_gem.gsub(/:/, "boom")))
- end
-
- assert_equal 'no metadata found', e.message
- end
-
-end
-
diff --git a/test/rubygems/test_gem_gem_path_searcher.rb b/test/rubygems/test_gem_gem_path_searcher.rb
deleted file mode 100644
index dfabc0b885..0000000000
--- a/test/rubygems/test_gem_gem_path_searcher.rb
+++ /dev/null
@@ -1,94 +0,0 @@
-require 'rubygems/test_case'
-require 'rubygems/gem_path_searcher'
-
-class Gem::GemPathSearcher
- attr_accessor :gemspecs
- attr_accessor :lib_dirs
-end
-
-class TestGemGemPathSearcher < Gem::TestCase
- def setup
- super
-
- @foo1 = new_spec 'foo', '0.1', nil, "lib/foo.rb"
- @foo1.require_paths << 'lib2'
- path = File.join 'gems', @foo1.full_name, 'lib', 'foo.rb'
- write_file(path) { |fp| fp.puts "# #{path}" }
-
- @foo2 = new_spec 'foo', '0.2'
- @bar1 = new_spec 'bar', '0.1'
- @bar2 = new_spec 'bar', '0.2'
- @nrp = new_spec 'nil_require_paths', '0.1' do |s|
- s.require_paths = nil
- end
-
- util_setup_fake_fetcher
- Gem::Specification.reset
- util_setup_spec_fetcher @foo1, @foo2, @bar1, @bar2
-
- @fetcher = Gem::FakeFetcher.new
- Gem::RemoteFetcher.fetcher = @fetcher
-
- @gps = Gem::Deprecate.skip_during { Gem::GemPathSearcher.new }
- end
-
- def test_find
- Gem::Deprecate.skip_during do
- assert_equal @foo1, @gps.find('foo')
- end
- end
-
- def test_find_all
- Gem::Deprecate.skip_during do
- assert_equal [@foo1], @gps.find_all('foo')
- end
- end
-
- def test_init_gemspecs
- Gem::Deprecate.skip_during do
- util_clear_gems
- util_setup_spec_fetcher @foo1, @foo2, @bar1, @bar2
- expected = [@bar2, @bar1, @foo2, @foo1].map(&:full_name)
- actual = @gps.init_gemspecs.map(&:full_name)
- assert_equal expected, actual
- end
- end
-
- def test_lib_dirs_for
- Gem::Deprecate.skip_during do
- lib_dirs = @gps.lib_dirs_for(@foo1)
- expected = File.join @gemhome, 'gems', @foo1.full_name, '{lib,lib2}'
-
- assert_equal expected, lib_dirs
- end
- end
-
- def test_lib_dirs_for_nil_require_paths
- Gem::Deprecate.skip_during do
- assert_nil @gps.lib_dirs_for(@nrp)
- end
- end
-
- def test_matching_file_eh
- Gem::Deprecate.skip_during do
- refute @gps.matching_file?(@foo1, 'bar')
- assert @gps.matching_file?(@foo1, 'foo')
- end
- end
-
- def test_matching_files
- Gem::Deprecate.skip_during do
- assert_equal [], @gps.matching_files(@foo1, 'bar')
-
- expected = File.join @foo1.full_gem_path, 'lib', 'foo.rb'
-
- assert_equal [expected], @gps.matching_files(@foo1, 'foo')
- end
- end
-
- def test_matching_files_nil_require_paths
- Gem::Deprecate.skip_during do
- assert_empty @gps.matching_files(@nrp, 'foo')
- end
- end
-end
diff --git a/test/rubygems/test_gem_gem_runner.rb b/test/rubygems/test_gem_gem_runner.rb
index 044bd8868f..85ff725345 100644
--- a/test/rubygems/test_gem_gem_runner.rb
+++ b/test/rubygems/test_gem_gem_runner.rb
@@ -3,6 +3,19 @@ require 'rubygems/gem_runner'
class TestGemGemRunner < Gem::TestCase
+ def setup
+ super
+
+ @orig_args = Gem::Command.build_args
+ @runner = Gem::GemRunner.new
+ end
+
+ def teardown
+ super
+
+ Gem::Command.build_args = @orig_args
+ end
+
def test_do_configuration
Gem.clear_paths
@@ -25,17 +38,30 @@ class TestGemGemRunner < Gem::TestCase
gr = Gem::GemRunner.new
gr.send :do_configuration, %W[--config-file #{temp_conf}]
- assert_equal [other_gem_home, other_gem_path], Gem.path
+ assert_equal [other_gem_path, other_gem_home], Gem.path
assert_equal %w[--commands], Gem::Command.extra_args
- assert_equal %w[--all], Gem::DocManager.configured_args
end
- def test_build_args__are_handled
- Gem.clear_paths
+ def test_extract_build_args
+ args = %w[]
+ assert_equal [], @runner.extract_build_args(args)
+ assert_equal %w[], args
+
+ args = %w[foo]
+ assert_equal [], @runner.extract_build_args(args)
+ assert_equal %w[foo], args
+
+ args = %w[--foo]
+ assert_equal [], @runner.extract_build_args(args)
+ assert_equal %w[--foo], args
- Gem::GemRunner.new.run(%W[help -- --build_arg1 --build_arg2])
+ args = %w[--foo --]
+ assert_equal [], @runner.extract_build_args(args)
+ assert_equal %w[--foo], args
- assert_equal %w[--build_arg1 --build_arg2], Gem::Command.build_args
+ args = %w[--foo -- --bar]
+ assert_equal %w[--bar], @runner.extract_build_args(args)
+ assert_equal %w[--foo], args
end
end
diff --git a/test/rubygems/test_gem_gemcutter_utilities.rb b/test/rubygems/test_gem_gemcutter_utilities.rb
index db4ed19d08..d70ac35beb 100644
--- a/test/rubygems/test_gem_gemcutter_utilities.rb
+++ b/test/rubygems/test_gem_gemcutter_utilities.rb
@@ -15,6 +15,32 @@ class TestGemGemcutterUtilities < Gem::TestCase
@cmd.extend Gem::GemcutterUtilities
end
+ def teardown
+ ENV['RUBYGEMS_HOST'] = nil
+ Gem.configuration.rubygems_api_key = nil
+
+ super
+ end
+
+ def test_alternate_key_alternate_host
+ keys = {
+ :rubygems_api_key => 'KEY',
+ "http://rubygems.engineyard.com" => "EYKEY"
+ }
+
+ FileUtils.mkdir_p File.dirname Gem.configuration.credentials_path
+
+ open Gem.configuration.credentials_path, 'w' do |f|
+ f.write keys.to_yaml
+ end
+
+ ENV["RUBYGEMS_HOST"] = "http://rubygems.engineyard.com"
+
+ Gem.configuration.load_api_keys
+
+ assert_equal 'EYKEY', @cmd.api_key
+ end
+
def test_api_key
keys = { :rubygems_api_key => 'KEY' }
FileUtils.mkdir_p File.dirname Gem.configuration.credentials_path
@@ -44,6 +70,22 @@ class TestGemGemcutterUtilities < Gem::TestCase
assert_equal 'OTHER', @cmd.api_key
end
+ def test_host
+ assert_equal 'https://rubygems.org', @cmd.host
+ end
+
+ def test_host_RUBYGEMS_HOST
+ ENV['RUBYGEMS_HOST'] = 'https://other.example'
+
+ assert_equal 'https://other.example', @cmd.host
+ end
+
+ def test_host_RUBYGEMS_HOST_empty
+ ENV['RUBYGEMS_HOST'] = ''
+
+ assert_equal 'https://rubygems.org', @cmd.host
+ end
+
def test_sign_in
api_key = 'a5fdbb6ba150cbb83aad2bb2fede64cf040453903'
util_sign_in [api_key, 200, 'OK']
@@ -58,9 +100,38 @@ class TestGemGemcutterUtilities < Gem::TestCase
def test_sign_in_with_host
api_key = 'a5fdbb6ba150cbb83aad2bb2fede64cf040453903'
+
+ util_sign_in [api_key, 200, 'OK'], 'http://example.com', ['http://example.com']
+
+ assert_match "Enter your http://example.com credentials.",
+ @sign_in_ui.output
+ assert @fetcher.last_request["authorization"]
+ assert_match %r{Signed in.}, @sign_in_ui.output
+
+ credentials = YAML.load_file Gem.configuration.credentials_path
+ assert_equal api_key, credentials[:rubygems_api_key]
+ end
+
+ def test_sign_in_with_host_nil
+ api_key = 'a5fdbb6ba150cbb83aad2bb2fede64cf040453903'
+
+ util_sign_in [api_key, 200, 'OK'], nil, [nil]
+
+ assert_match "Enter your RubyGems.org credentials.",
+ @sign_in_ui.output
+ assert @fetcher.last_request["authorization"]
+ assert_match %r{Signed in.}, @sign_in_ui.output
+
+ credentials = YAML.load_file Gem.configuration.credentials_path
+ assert_equal api_key, credentials[:rubygems_api_key]
+ end
+
+ def test_sign_in_with_host_ENV
+ api_key = 'a5fdbb6ba150cbb83aad2bb2fede64cf040453903'
util_sign_in [api_key, 200, 'OK'], 'http://example.com'
- assert_match %r{Enter your RubyGems.org credentials.}, @sign_in_ui.output
+ assert_match "Enter your http://example.com credentials.",
+ @sign_in_ui.output
assert @fetcher.last_request["authorization"]
assert_match %r{Signed in.}, @sign_in_ui.output
@@ -106,7 +177,7 @@ class TestGemGemcutterUtilities < Gem::TestCase
assert_match %r{Access Denied.}, @sign_in_ui.output
end
- def util_sign_in response, host = nil
+ def util_sign_in response, host = nil, args = []
skip 'Always uses $stdin on windows' if Gem.win_platform?
email = 'you@example.com'
@@ -125,7 +196,11 @@ class TestGemGemcutterUtilities < Gem::TestCase
@sign_in_ui = Gem::MockGemUi.new "#{email}\n#{password}\n"
use_ui @sign_in_ui do
- @cmd.sign_in
+ if args.length > 0 then
+ @cmd.sign_in(*args)
+ else
+ @cmd.sign_in
+ end
end
end
@@ -148,4 +223,3 @@ class TestGemGemcutterUtilities < Gem::TestCase
end
end
-
diff --git a/test/rubygems/test_gem_impossible_dependencies_error.rb b/test/rubygems/test_gem_impossible_dependencies_error.rb
new file mode 100644
index 0000000000..577ee580ec
--- /dev/null
+++ b/test/rubygems/test_gem_impossible_dependencies_error.rb
@@ -0,0 +1,45 @@
+require 'rubygems/test_case'
+
+class TestGemImpossibleDependenciesError < Gem::TestCase
+
+ def test_message_conflict
+ request = dependency_request dep('net-ssh', '>= 2.0.13'), 'rye', '0.9.8'
+
+ conflicts = []
+
+ # These conflicts are lies as their dependencies does not have the correct
+ # requested-by entries, but they are suitable for testing the message.
+ # See #485 to construct a correct conflict.
+ net_ssh_2_2_2 =
+ dependency_request dep('net-ssh', '>= 2.6.5'), 'net-ssh', '2.2.2', request
+ net_ssh_2_6_5 =
+ dependency_request dep('net-ssh', '~> 2.2.2'), 'net-ssh', '2.6.5', request
+
+ conflict1 = Gem::Resolver::Conflict.new \
+ net_ssh_2_6_5, net_ssh_2_6_5.requester
+
+ conflict2 = Gem::Resolver::Conflict.new \
+ net_ssh_2_2_2, net_ssh_2_2_2.requester
+
+ conflicts << [net_ssh_2_6_5.requester.spec, conflict1]
+ conflicts << [net_ssh_2_2_2.requester.spec, conflict2]
+
+ error = Gem::ImpossibleDependenciesError.new request, conflicts
+
+ expected = <<-EXPECTED
+rye-0.9.8 requires net-ssh (>= 2.0.13) but it conflicted:
+ Activated net-ssh-2.6.5 via:
+ net-ssh-2.6.5 (>= 2.0.13), rye-0.9.8 (= 0.9.8)
+ instead of (~> 2.2.2) via:
+ net-ssh-2.6.5 (>= 2.0.13), rye-0.9.8 (= 0.9.8)
+ Activated net-ssh-2.2.2 via:
+ net-ssh-2.2.2 (>= 2.0.13), rye-0.9.8 (= 0.9.8)
+ instead of (>= 2.6.5) via:
+ net-ssh-2.2.2 (>= 2.0.13), rye-0.9.8 (= 0.9.8)
+ EXPECTED
+
+ assert_equal expected, error.message
+ end
+
+end
+
diff --git a/test/rubygems/test_gem_indexer.rb b/test/rubygems/test_gem_indexer.rb
index f5bef8fa3c..5ce0788c08 100644
--- a/test/rubygems/test_gem_indexer.rb
+++ b/test/rubygems/test_gem_indexer.rb
@@ -13,27 +13,27 @@ class TestGemIndexer < Gem::TestCase
util_clear_gems
util_make_gems
- @d2_0 = quick_spec 'd', '2.0' do |s|
+ @d2_0 = util_spec 'd', '2.0' do |s|
s.date = Gem::Specification::TODAY - 86400 * 3
end
util_build_gem @d2_0
- @d2_0_a = quick_spec 'd', '2.0.a'
+ @d2_0_a = util_spec 'd', '2.0.a'
util_build_gem @d2_0_a
- @d2_0_b = quick_spec 'd', '2.0.b'
+ @d2_0_b = util_spec 'd', '2.0.b'
util_build_gem @d2_0_b
+ @default = new_default_spec 'default', 2
+ install_default_gems @default
+
@tempdir = File.join(@tempdir, 'indexer')
gems = File.join(@tempdir, 'gems')
FileUtils.mkdir_p gems
FileUtils.mv Dir[File.join(@gemhome, "cache", '*.gem')], gems
- @indexer = Gem::Indexer.new(@tempdir,
- :rss_title => 'ExampleForge gems',
- :rss_host => 'example.com',
- :rss_gems_host => 'gems.example.com')
+ @indexer = Gem::Indexer.new(@tempdir)
end
def test_initialize
@@ -42,18 +42,10 @@ class TestGemIndexer < Gem::TestCase
@indexer.directory
indexer = Gem::Indexer.new @tempdir
- assert indexer.build_legacy
assert indexer.build_modern
- indexer = Gem::Indexer.new @tempdir, :build_legacy => false,
- :build_modern => true
- refute indexer.build_legacy
+ indexer = Gem::Indexer.new @tempdir, :build_modern => true
assert indexer.build_modern
-
- indexer = Gem::Indexer.new @tempdir, :build_legacy => true,
- :build_modern => false
- assert indexer.build_legacy
- refute indexer.build_modern
end
def test_build_indicies
@@ -73,7 +65,9 @@ class TestGemIndexer < Gem::TestCase
["b", Gem::Version.new("2"), "ruby"],
["c", Gem::Version.new("1.2"), "ruby"],
["d", Gem::Version.new("2.0"), "ruby"],
- ["pl", Gem::Version.new("1"), "i386-linux"]]
+ ["dep_x", Gem::Version.new("1"), "ruby"],
+ ["pl", Gem::Version.new("1"), "i386-linux"],
+ ["x", Gem::Version.new("1"), "ruby"]]
assert_equal expected, specs
@@ -87,7 +81,9 @@ class TestGemIndexer < Gem::TestCase
["b", Gem::Version.new("2"), "ruby"],
["c", Gem::Version.new("1.2"), "ruby"],
["d", Gem::Version.new("2.0"), "ruby"],
- ["pl", Gem::Version.new("1"), "i386-linux"]]
+ ["dep_x", Gem::Version.new("1"), "ruby"],
+ ["pl", Gem::Version.new("1"), "i386-linux"],
+ ["x", Gem::Version.new("1"), "ruby"]]
assert_equal expected, latest_specs, 'latest_specs'
end
@@ -97,9 +93,6 @@ class TestGemIndexer < Gem::TestCase
@indexer.generate_index
end
- assert_indexed @tempdir, "Marshal.#{@marshal_version}"
- assert_indexed @tempdir, "Marshal.#{@marshal_version}.Z"
-
quickdir = File.join @tempdir, 'quick'
marshal_quickdir = File.join quickdir, "Marshal.#{@marshal_version}"
@@ -116,208 +109,10 @@ class TestGemIndexer < Gem::TestCase
assert_indexed @tempdir, "latest_specs.#{@marshal_version}"
assert_indexed @tempdir, "latest_specs.#{@marshal_version}.gz"
-
- expected = <<-EOF
-<?xml version=\"1.0\"?>
-<rss version=\"2.0\">
- <channel>
- <title>ExampleForge gems</title>
- <link>http://example.com</link>
- <description>Recently released gems from http://example.com</description>
- <generator>RubyGems v#{Gem::VERSION}</generator>
- <docs>http://cyber.law.harvard.edu/rss/rss.html</docs>
- <item>
- <title>a-2</title>
- <description>
-&lt;pre&gt;This is a test description&lt;/pre&gt;
- </description>
- <author>example@example.com (A User)</author>
- <guid>a-2</guid>
- <enclosure url=\"http://gems.example.com/gems/a-2.gem\"
- length=\"3072\" type=\"application/octet-stream\" />
- <pubDate>#{@a2.date.rfc2822}</pubDate>
- <link>http://example.com</link>
- </item>
- <item>
- <title>a-3.a</title>
- <description>
-&lt;pre&gt;This is a test description&lt;/pre&gt;
- </description>
- <author>example@example.com (A User)</author>
- <guid>a-3.a</guid>
- <enclosure url=\"http://gems.example.com/gems/a-3.a.gem\"
- length=\"3072\" type=\"application/octet-stream\" />
- <pubDate>#{@a3a.date.rfc2822}</pubDate>
- <link>http://example.com</link>
- </item>
- <item>
- <title>a_evil-9</title>
- <description>
-&lt;pre&gt;This is a test description&lt;/pre&gt;
- </description>
- <author>example@example.com (A User)</author>
- <guid>a_evil-9</guid>
- <enclosure url=\"http://gems.example.com/gems/a_evil-9.gem\"
- length=\"3072\" type=\"application/octet-stream\" />
- <pubDate>#{@a_evil9.date.rfc2822}</pubDate>
- <link>http://example.com</link>
- </item>
- <item>
- <title>b-2</title>
- <description>
-&lt;pre&gt;This is a test description&lt;/pre&gt;
- </description>
- <author>example@example.com (A User)</author>
- <guid>b-2</guid>
- <enclosure url=\"http://gems.example.com/gems/b-2.gem\"
- length=\"3072\" type=\"application/octet-stream\" />
- <pubDate>#{@b2.date.rfc2822}</pubDate>
- <link>http://example.com</link>
- </item>
- <item>
- <title>c-1.2</title>
- <description>
-&lt;pre&gt;This is a test description&lt;/pre&gt;
- </description>
- <author>example@example.com (A User)</author>
- <guid>c-1.2</guid>
- <enclosure url=\"http://gems.example.com/gems/c-1.2.gem\"
- length=\"3072\" type=\"application/octet-stream\" />
- <pubDate>#{@c1_2.date.rfc2822}</pubDate>
- <link>http://example.com</link>
- </item>
- <item>
- <title>d-2.0.a</title>
- <description>
-&lt;pre&gt;This is a test description&lt;/pre&gt;
- </description>
- <author>example@example.com (A User)</author>
- <guid>d-2.0.a</guid>
- <enclosure url=\"http://gems.example.com/gems/d-2.0.a.gem\"
- length=\"3072\" type=\"application/octet-stream\" />
- <pubDate>#{@d2_0_a.date.rfc2822}</pubDate>
- <link>http://example.com</link>
- </item>
- <item>
- <title>d-2.0.b</title>
- <description>
-&lt;pre&gt;This is a test description&lt;/pre&gt;
- </description>
- <author>example@example.com (A User)</author>
- <guid>d-2.0.b</guid>
- <enclosure url=\"http://gems.example.com/gems/d-2.0.b.gem\"
- length=\"3072\" type=\"application/octet-stream\" />
- <pubDate>#{@d2_0_b.date.rfc2822}</pubDate>
- <link>http://example.com</link>
- </item>
- <item>
- <title>pl-1-x86-linux</title>
- <description>
-&lt;pre&gt;This is a test description&lt;/pre&gt;
- </description>
- <author>example@example.com (A User)</author>
- <guid>pl-1-x86-linux</guid>
- <enclosure url=\"http://gems.example.com/gems/pl-1-x86-linux.gem\"
- length=\"3072\" type=\"application/octet-stream\" />
- <pubDate>#{@pl1.date.rfc2822}</pubDate>
- <link>http://example.com</link>
- </item>
- <item>
- <title>a-1</title>
- <description>
-&lt;pre&gt;This line is really, really long. So long, in fact, that it is more than
-eighty characters long! The purpose of this line is for testing wrapping
-behavior because sometimes people don't wrap their text to eighty characters.
-Without the wrapping, the text might not look good in the RSS feed.
-
-Also, a list:
- * An entry that's actually kind of sort
- * an entry that's really long, which will probably get wrapped funny.
-That's ok, somebody wasn't thinking straight when they made it more than
-eighty characters.&lt;/pre&gt;
- </description>
- <author>example@example.com (Example), example2@example.com (Example2)</author>
- <guid>a-1</guid>
- <enclosure url=\"http://gems.example.com/gems/a-1.gem\"
- length=\"3584\" type=\"application/octet-stream\" />
- <pubDate>#{@a1.date.rfc2822}</pubDate>
- <link>http://a.example.com</link>
- </item>
- </channel>
-</rss>
- EOF
-
- gems_rss = File.read File.join(@tempdir, 'index.rss')
-
- assert_equal expected, gems_rss
- end
-
- def test_generate_index_legacy
- @indexer.build_modern = false
- @indexer.build_legacy = true
-
- use_ui @ui do
- @indexer.generate_index
- end
-
- assert_indexed @tempdir, "Marshal.#{@marshal_version}"
- assert_indexed @tempdir, "Marshal.#{@marshal_version}.Z"
-
- quickdir = File.join @tempdir, 'quick'
- marshal_quickdir = File.join quickdir, "Marshal.#{@marshal_version}"
-
- assert File.directory?(quickdir)
- assert File.directory?(marshal_quickdir)
-
- assert_indexed marshal_quickdir, "#{File.basename(@a1.spec_file)}.rz"
- assert_indexed marshal_quickdir, "#{File.basename(@a2.spec_file)}.rz"
-
- refute_indexed marshal_quickdir, "#{File.basename(@c1_2.spec_file)}"
-
- refute_indexed @tempdir, "specs.#{@marshal_version}"
- refute_indexed @tempdir, "specs.#{@marshal_version}.gz"
-
- refute_indexed @tempdir, "latest_specs.#{@marshal_version}"
- refute_indexed @tempdir, "latest_specs.#{@marshal_version}.gz"
- end
-
- def test_generate_index_legacy_back_to_back
- @indexer.build_modern = true
- @indexer.build_legacy = true
-
- use_ui @ui do
- @indexer.generate_index
- end
-
- @indexer = Gem::Indexer.new @tempdir
- @indexer.build_modern = false
- @indexer.build_legacy = true
-
- use_ui @ui do
- @indexer.generate_index
- end
-
- assert_indexed @tempdir, "Marshal.#{@marshal_version}"
- assert_indexed @tempdir, "Marshal.#{@marshal_version}.Z"
-
- quickdir = File.join @tempdir, 'quick'
- marshal_quickdir = File.join quickdir, "Marshal.#{@marshal_version}"
-
- assert File.directory?(marshal_quickdir)
-
- assert_indexed marshal_quickdir, "#{File.basename(@a1.spec_file)}.rz"
- assert_indexed marshal_quickdir, "#{File.basename(@a2.spec_file)}.rz"
-
- assert_indexed @tempdir, "specs.#{@marshal_version}"
- assert_indexed @tempdir, "specs.#{@marshal_version}.gz"
-
- assert_indexed @tempdir, "latest_specs.#{@marshal_version}"
- assert_indexed @tempdir, "latest_specs.#{@marshal_version}.gz"
end
def test_generate_index_modern
@indexer.build_modern = true
- @indexer.build_legacy = false
use_ui @ui do
@indexer.generate_index
@@ -363,7 +158,6 @@ eighty characters.&lt;/pre&gt;
def test_generate_index_modern_back_to_back
@indexer.build_modern = true
- @indexer.build_legacy = true
use_ui @ui do
@indexer.generate_index
@@ -371,15 +165,10 @@ eighty characters.&lt;/pre&gt;
@indexer = Gem::Indexer.new @tempdir
@indexer.build_modern = true
- @indexer.build_legacy = false
use_ui @ui do
@indexer.generate_index
end
-
- assert_indexed @tempdir, "Marshal.#{@marshal_version}"
- assert_indexed @tempdir, "Marshal.#{@marshal_version}.Z"
-
quickdir = File.join @tempdir, 'quick'
marshal_quickdir = File.join quickdir, "Marshal.#{@marshal_version}"
@@ -401,14 +190,13 @@ eighty characters.&lt;/pre&gt;
@indexer.generate_index
end
- assert_match %r%^\.\.\.\.\.\.\.\.\.\.$%, @ui.output
- assert_match %r%^Generating Marshal quick index gemspecs for 10 gems$%,
+ assert_match %r%^\.\.\.\.\.\.\.\.\.\.\.\.$%, @ui.output
+ assert_match %r%^Generating Marshal quick index gemspecs for 12 gems$%,
@ui.output
assert_match %r%^Complete$%, @ui.output
assert_match %r%^Generating specs index$%, @ui.output
assert_match %r%^Generating latest specs index$%, @ui.output
assert_match %r%^Generating prerelease specs index$%, @ui.output
- assert_match %r%^Generating Marshal master index$%, @ui.output
assert_match %r%^Complete$%, @ui.output
assert_match %r%^Compressing indicies$%, @ui.output
@@ -432,7 +220,9 @@ eighty characters.&lt;/pre&gt;
['b', Gem::Version.new(2), 'ruby'],
['c', Gem::Version.new('1.2'), 'ruby'],
['d', Gem::Version.new('2.0'), 'ruby'],
+ ['dep_x', Gem::Version.new(1), 'ruby'],
['pl', Gem::Version.new(1), 'i386-linux'],
+ ['x', Gem::Version.new(1), 'ruby'],
]
assert_equal expected, specs
@@ -466,7 +256,9 @@ eighty characters.&lt;/pre&gt;
['b', Gem::Version.new(2), 'ruby'],
['c', Gem::Version.new('1.2'), 'ruby'],
['d', Gem::Version.new('2.0'), 'ruby'],
+ ['dep_x', Gem::Version.new(1), 'ruby'],
['pl', Gem::Version.new(1), 'i386-linux'],
+ ['x', Gem::Version.new(1), 'ruby'],
]
assert_equal expected, latest_specs
@@ -494,6 +286,20 @@ eighty characters.&lt;/pre&gt;
prerelease_specs
end
+ ##
+ # Emulate the starting state of Gem::Specification in a live environment,
+ # where it will carry the list of system gems
+ def with_system_gems
+ Gem::Specification.reset
+
+ sys_gem = util_spec 'systemgem', '1.0'
+ util_build_gem sys_gem
+ Gem::Specification.add_spec sys_gem
+ yield
+ util_remove_gem sys_gem
+ end
+
+
def test_update_index
use_ui @ui do
@indexer.generate_index
@@ -505,11 +311,11 @@ eighty characters.&lt;/pre&gt;
assert File.directory?(quickdir)
assert File.directory?(marshal_quickdir)
- @d2_1 = quick_spec 'd', '2.1'
+ @d2_1 = util_spec 'd', '2.1'
util_build_gem @d2_1
@d2_1_tuple = [@d2_1.name, @d2_1.version, @d2_1.original_platform]
- @d2_1_a = quick_spec 'd', '2.2.a'
+ @d2_1_a = util_spec 'd', '2.2.a'
util_build_gem @d2_1_a
@d2_1_a_tuple = [@d2_1_a.name, @d2_1_a.version, @d2_1_a.original_platform]
@@ -518,30 +324,32 @@ eighty characters.&lt;/pre&gt;
FileUtils.mv @d2_1.cache_file, gems
FileUtils.mv @d2_1_a.cache_file, gems
- use_ui @ui do
- @indexer.update_index
- end
+ with_system_gems do
+ use_ui @ui do
+ @indexer.update_index
+ end
- assert_indexed marshal_quickdir, "#{File.basename(@d2_1.spec_file)}.rz"
+ assert_indexed marshal_quickdir, "#{File.basename(@d2_1.spec_file)}.rz"
- specs_index = Marshal.load Gem.read_binary(@indexer.dest_specs_index)
+ specs_index = Marshal.load Gem.read_binary(@indexer.dest_specs_index)
- assert_includes specs_index, @d2_1_tuple
- refute_includes specs_index, @d2_1_a_tuple
+ assert_includes specs_index, @d2_1_tuple
+ refute_includes specs_index, @d2_1_a_tuple
- latest_specs_index = Marshal.load \
- Gem.read_binary(@indexer.dest_latest_specs_index)
+ latest_specs_index = Marshal.load \
+ Gem.read_binary(@indexer.dest_latest_specs_index)
- assert_includes latest_specs_index, @d2_1_tuple
- assert_includes latest_specs_index,
- [@d2_0.name, @d2_0.version, @d2_0.original_platform]
- refute_includes latest_specs_index, @d2_1_a_tuple
+ assert_includes latest_specs_index, @d2_1_tuple
+ assert_includes latest_specs_index,
+ [@d2_0.name, @d2_0.version, @d2_0.original_platform]
+ refute_includes latest_specs_index, @d2_1_a_tuple
- pre_specs_index = Marshal.load \
- Gem.read_binary(@indexer.dest_prerelease_specs_index)
+ pre_specs_index = Marshal.load \
+ Gem.read_binary(@indexer.dest_prerelease_specs_index)
- assert_includes pre_specs_index, @d2_1_a_tuple
- refute_includes pre_specs_index, @d2_1_tuple
+ assert_includes pre_specs_index, @d2_1_a_tuple
+ refute_includes pre_specs_index, @d2_1_tuple
+ end
end
def assert_indexed(dir, name)
diff --git a/test/rubygems/test_gem_install_update_options.rb b/test/rubygems/test_gem_install_update_options.rb
index 473c7fee41..3f63896999 100644
--- a/test/rubygems/test_gem_install_update_options.rb
+++ b/test/rubygems/test_gem_install_update_options.rb
@@ -1,25 +1,108 @@
require 'rubygems/installer_test_case'
require 'rubygems/install_update_options'
require 'rubygems/command'
+require 'rubygems/dependency_installer'
class TestGemInstallUpdateOptions < Gem::InstallerTestCase
def setup
super
- @cmd = Gem::Command.new 'dummy', 'dummy'
+ @cmd = Gem::Command.new 'dummy', 'dummy',
+ Gem::DependencyInstaller::DEFAULT_OPTIONS
@cmd.extend Gem::InstallUpdateOptions
@cmd.add_install_update_options
end
def test_add_install_update_options
- args = %w[-i /install_to --rdoc --ri -E -f -w -P HighSecurity
- --ignore-dependencies --format-exec --include-dependencies]
+ args = %w[
+ --document
+ --format-exec
+ --ignore-dependencies
+ --rdoc
+ --ri
+ -E
+ -f
+ -i /install_to
+ -w
+ ]
+
+ args.concat %w[-P HighSecurity] if defined?(OpenSSL::SSL)
assert @cmd.handles?(args)
end
+ def test_doc
+ @cmd.handle_options %w[--doc]
+
+ assert_equal %w[ri], @cmd.options[:document].sort
+ end
+
+ def test_doc_rdoc
+ @cmd.handle_options %w[--doc=rdoc]
+
+ assert_equal %w[rdoc], @cmd.options[:document]
+
+ @cmd.handle_options %w[--doc ri]
+
+ assert_equal %w[ri], @cmd.options[:document]
+ end
+
+ def test_doc_rdoc_ri
+ @cmd.handle_options %w[--doc=rdoc,ri]
+
+ assert_equal %w[rdoc ri], @cmd.options[:document]
+ end
+
+ def test_doc_no
+ @cmd.handle_options %w[--no-doc]
+
+ assert_equal [], @cmd.options[:document]
+ end
+
+ def test_document
+ @cmd.handle_options %w[--document]
+
+ assert_equal %w[ri], @cmd.options[:document].sort
+ end
+
+ def test_document_no
+ @cmd.handle_options %w[--no-document]
+
+ assert_equal %w[], @cmd.options[:document]
+ end
+
+ def test_document_rdoc
+ @cmd.handle_options %w[--document=rdoc]
+
+ assert_equal %w[rdoc], @cmd.options[:document]
+
+ @cmd.handle_options %w[--document ri]
+
+ assert_equal %w[ri], @cmd.options[:document]
+ end
+
+ def test_rdoc
+ @cmd.handle_options %w[--rdoc]
+
+ assert_equal %w[rdoc ri], @cmd.options[:document].sort
+ end
+
+ def test_rdoc_no
+ @cmd.handle_options %w[--no-rdoc]
+
+ assert_equal %w[ri], @cmd.options[:document]
+ end
+
+ def test_ri
+ @cmd.handle_options %w[--no-ri]
+
+ assert_equal %w[], @cmd.options[:document]
+ end
+
def test_security_policy
+ skip 'openssl is missing' unless defined?(OpenSSL::SSL)
+
@cmd.handle_options %w[-P HighSecurity]
assert_equal Gem::Security::HighSecurity, @cmd.options[:security_policy]
diff --git a/test/rubygems/test_gem_installer.rb b/test/rubygems/test_gem_installer.rb
index 9b36120f8e..f0dd52cd36 100644
--- a/test/rubygems/test_gem_installer.rb
+++ b/test/rubygems/test_gem_installer.rb
@@ -2,24 +2,27 @@ require 'rubygems/installer_test_case'
class TestGemInstaller < Gem::InstallerTestCase
- def util_setup_install
- @gemhome = @installer_tmp
- Gem.use_paths @installer_tmp
+ def setup
+ super
+ common_installer_setup
- @spec = Gem::Specification.find_by_name 'a'
- @user_spec = Gem::Specification.find_by_name 'b'
+ if __name__ =~ /^test_install(_|$)/ then
+ FileUtils.rm_r @spec.gem_dir
+ FileUtils.rm_r @user_spec.gem_dir
+ end
- @installer.spec = @spec
- @installer.gem_home = @installer_tmp
- @installer.gem_dir = @spec.gem_dir
- @user_installer.spec = @user_spec
- @user_installer.gem_home = @installer_tmp
+ @config = Gem.configuration
end
- def test_app_script_text
- util_setup_install
+ def teardown
+ common_installer_teardown
+
+ super
+
+ Gem.configuration = @config
+ end
- @spec.version = 2
+ def test_app_script_text
util_make_exec @spec, ''
expected = <<-EOF
@@ -52,69 +55,137 @@ load Gem.bin_path('a', 'executable', version)
assert_equal expected, wrapper
end
- def test_build_extensions_none
- util_setup_install
+ def test_check_executable_overwrite
+ @installer.generate_bin
- use_ui @ui do
- @installer.build_extensions
+ @spec = Gem::Specification.new do |s|
+ s.files = ['lib/code.rb']
+ s.name = "a"
+ s.version = "3"
+ s.summary = "summary"
+ s.description = "desc"
+ s.require_path = 'lib'
end
- assert_equal '', @ui.output
- assert_equal '', @ui.error
+ util_make_exec
+ @installer.gem_dir = util_gem_dir @spec
+ @installer.wrappers = true
+ @installer.generate_bin
+
+ installed_exec = File.join util_inst_bindir, 'executable'
+ assert_path_exists installed_exec
- refute File.exist?('gem_make.out')
+ wrapper = File.read installed_exec
+ assert_match %r|generated by RubyGems|, wrapper
end
- def test_build_extensions_extconf_bad
- util_setup_install
+ def test_check_executable_overwrite_default_bin_dir
+ if defined?(RUBY_FRAMEWORK_VERSION)
+ orig_RUBY_FRAMEWORK_VERSION = RUBY_FRAMEWORK_VERSION
+ Object.send :remove_const, :RUBY_FRAMEWORK_VERSION
+ end
+ orig_bindir = Gem::ConfigMap[:bindir]
+ Gem::ConfigMap[:bindir] = Gem.bindir
- @spec.extensions << 'extconf.rb'
+ util_conflict_executable false
- e = assert_raises Gem::Installer::ExtensionBuildError do
- use_ui @ui do
- @installer.build_extensions
+ ui = Gem::MockGemUi.new "n\n"
+ use_ui ui do
+ e = assert_raises Gem::InstallError do
+ @installer.generate_bin
end
+
+ conflicted = File.join @gemhome, 'bin', 'executable'
+ assert_match %r%\A"executable" from a conflicts with (?:#{Regexp.quote(conflicted)}|installed executable from conflict)\z%,
+ e.message
+ end
+ ensure
+ Object.const_set :RUBY_FRAMEWORK_VERSION, orig_RUBY_FRAMEWORK_VERSION if
+ orig_RUBY_FRAMEWORK_VERSION
+ Gem::ConfigMap[:bindir] = orig_bindir
+ end
+
+ def test_check_executable_overwrite_format_executable
+ @installer.generate_bin
+
+ @spec = Gem::Specification.new do |s|
+ s.files = ['lib/code.rb']
+ s.name = "a"
+ s.version = "3"
+ s.summary = "summary"
+ s.description = "desc"
+ s.require_path = 'lib'
+ end
+
+ open File.join(util_inst_bindir, 'executable'), 'w' do |io|
+ io.write <<-EXEC
+#!/usr/local/bin/ruby
+#
+# This file was generated by RubyGems
+
+gem 'other', version
+ EXEC
end
- assert_match(/\AERROR: Failed to build gem native extension.$/, e.message)
+ util_make_exec
+ Gem::Installer.exec_format = 'foo-%s-bar'
+ @installer.gem_dir = @spec.gem_dir
+ @installer.wrappers = true
+ @installer.format_executable = true
- assert_equal "Building native extensions. This could take a while...\n",
- @ui.output
- assert_equal '', @ui.error
+ @installer.generate_bin # should not raise
- gem_make_out = File.join @gemhome, 'gems', @spec.full_name, 'gem_make.out'
+ installed_exec = File.join util_inst_bindir, 'foo-executable-bar'
+ assert_path_exists installed_exec
- assert_match %r%#{Regexp.escape Gem.ruby} extconf\.rb%,
- File.read(gem_make_out)
- assert_match %r%#{Regexp.escape Gem.ruby}: No such file%,
- File.read(gem_make_out)
+ wrapper = File.read installed_exec
+ assert_match %r|generated by RubyGems|, wrapper
end
- def test_build_extensions_unsupported
- util_setup_install
+ def test_check_executable_overwrite_other_gem
+ util_conflict_executable true
- gem_make_out = File.join @gemhome, 'gems', @spec.full_name, 'gem_make.out'
- @spec.extensions << nil
+ ui = Gem::MockGemUi.new "n\n"
- e = assert_raises Gem::Installer::ExtensionBuildError do
- use_ui @ui do
- @installer.build_extensions
+ use_ui ui do
+ e = assert_raises Gem::InstallError do
+ @installer.generate_bin
end
+
+ assert_equal '"executable" from a conflicts with installed executable from conflict',
+ e.message
end
+ end
- assert_match(/^\s*No builder for extension ''$/, e.message)
+ def test_check_executable_overwrite_other_gem_force
+ util_conflict_executable true
+ @installer.wrappers = true
+ @installer.force = true
- assert_equal "Building native extensions. This could take a while...\n",
- @ui.output
- assert_equal '', @ui.error
+ @installer.generate_bin
- assert_equal "No builder for extension ''\n", File.read(gem_make_out)
- ensure
- FileUtils.rm_f gem_make_out
+ installed_exec = File.join util_inst_bindir, 'executable'
+ assert_path_exists installed_exec
+
+ wrapper = File.read installed_exec
+ assert_match %r|generated by RubyGems|, wrapper
end
+ def test_check_executable_overwrite_other_non_gem
+ util_conflict_executable false
+ @installer.wrappers = true
+
+ @installer.generate_bin
+
+ installed_exec = File.join util_inst_bindir, 'executable'
+ assert_path_exists installed_exec
+
+ wrapper = File.read installed_exec
+ assert_match %r|generated by RubyGems|, wrapper
+ end unless Gem.win_platform?
+
def test_ensure_dependency
- util_setup_install
+ util_spec 'a'
dep = Gem::Dependency.new 'a', '>= 2'
assert @installer.ensure_dependency(@spec, dep)
@@ -127,81 +198,43 @@ load Gem.bin_path('a', 'executable', version)
assert_equal 'a requires b (> 2)', e.message
end
- def test_extract_files
- util_setup_install
-
- format = Object.new
- def format.file_entries
- [[{'size' => 7, 'mode' => 0400, 'path' => 'thefile'}, 'content']]
- end
-
- @installer.format = format
-
- @installer.extract_files
-
- thefile_path = File.join(util_gem_dir, 'thefile')
- assert_equal 'content', File.read(thefile_path)
-
- unless Gem.win_platform? then
- assert_equal 0400, File.stat(thefile_path).mode & 0777
+ def test_ensure_loadable_spec
+ a, a_gem = util_gem 'a', 2 do |s|
+ s.add_dependency 'garbage ~> 5'
end
- end
- def test_extract_files_bad_dest
- util_setup_install
+ installer = Gem::Installer.new a_gem
- @installer.gem_dir = 'somedir'
- @installer.format = nil
- e = assert_raises ArgumentError do
- @installer.extract_files
+ e = assert_raises Gem::InstallError do
+ installer.ensure_loadable_spec
end
- assert_equal 'format required to extract from', e.message
+ assert_equal "The specification for #{a.full_name} is corrupt " +
+ "(SyntaxError)", e.message
end
- def test_extract_files_relative
- util_setup_install
+ def test_ensure_loadable_spec_security_policy
+ skip 'openssl is missing' unless defined?(OpenSSL::SSL)
- format = Object.new
- def format.file_entries
- [[{'size' => 10, 'mode' => 0644, 'path' => '../thefile'}, '../thefile']]
+ _, a_gem = util_gem 'a', 2 do |s|
+ s.add_dependency 'garbage ~> 5'
end
- @installer.format = format
+ policy = Gem::Security::HighSecurity
+ installer = Gem::Installer.new a_gem, :security_policy => policy
- e = assert_raises Gem::InstallError do
- @installer.extract_files
+ assert_raises Gem::Security::Exception do
+ installer.ensure_loadable_spec
end
-
- dir = util_gem_dir
- expected = "attempt to install file into \"../thefile\" under #{dir}"
- assert_equal expected, e.message
- assert_equal false, File.file?(File.join(@tempdir, '../thefile')),
- "You may need to remove this file if you broke the test once"
end
- def test_extract_files_absolute
- util_setup_install
-
- format = Object.new
- def format.file_entries
- [[{'size' => 8, 'mode' => 0644, 'path' => '/thefile'}, '/thefile']]
- end
-
- @installer.format = format
-
- e = assert_raises Gem::InstallError do
- @installer.extract_files
- end
+ def test_extract_files
+ @installer.extract_files
- assert_equal 'attempt to install file into /thefile', e.message
- assert_equal false, File.file?(File.join('/thefile')),
- "You may need to remove this file if you broke the test once"
+ assert_path_exists File.join util_gem_dir, 'bin/executable'
end
def test_generate_bin_bindir
- util_setup_install
-
@installer.wrappers = true
@spec.executables = %w[executable]
@@ -219,7 +252,7 @@ load Gem.bin_path('a', 'executable', version)
assert_equal true, File.directory?(util_inst_bindir)
installed_exec = File.join(util_inst_bindir, 'executable')
- assert_equal true, File.exist?(installed_exec)
+ assert_path_exists installed_exec
assert_equal mask, File.stat(installed_exec).mode unless win_platform?
wrapper = File.read installed_exec
@@ -227,16 +260,15 @@ load Gem.bin_path('a', 'executable', version)
end
def test_generate_bin_bindir_with_user_install_warning
- util_setup_install
-
- bin_dir = Gem.win_platform? ? File.expand_path(ENV["WINDIR"]) : "/usr/bin"
+ bin_dir = Gem.win_platform? ? File.expand_path(ENV["WINDIR"]).upcase :
+ "/usr/bin"
options = {
:bin_dir => bin_dir,
:install_dir => "/non/existant"
}
- inst = Gem::Installer.new nil, options
+ inst = Gem::Installer.new '', options
Gem::Installer.path_warning = false
@@ -248,16 +280,14 @@ load Gem.bin_path('a', 'executable', version)
end
def test_generate_bin_script
- util_setup_install
-
@installer.wrappers = true
util_make_exec
@installer.gem_dir = util_gem_dir
@installer.generate_bin
- assert_equal true, File.directory?(util_inst_bindir)
- installed_exec = File.join(util_inst_bindir, 'executable')
- assert_equal true, File.exist?(installed_exec)
+ assert File.directory? util_inst_bindir
+ installed_exec = File.join util_inst_bindir, 'executable'
+ assert_path_exists installed_exec
assert_equal mask, File.stat(installed_exec).mode unless win_platform?
wrapper = File.read installed_exec
@@ -265,8 +295,6 @@ load Gem.bin_path('a', 'executable', version)
end
def test_generate_bin_script_format
- util_setup_install
-
@installer.format_executable = true
@installer.wrappers = true
util_make_exec
@@ -276,14 +304,12 @@ load Gem.bin_path('a', 'executable', version)
@installer.generate_bin
assert_equal true, File.directory?(util_inst_bindir)
installed_exec = File.join util_inst_bindir, 'foo-executable-bar'
- assert_equal true, File.exist?(installed_exec)
+ assert_path_exists installed_exec
ensure
Gem::Installer.exec_format = nil
end
def test_generate_bin_script_format_disabled
- util_setup_install
-
@installer.wrappers = true
util_make_exec
@installer.gem_dir = util_gem_dir
@@ -292,16 +318,13 @@ load Gem.bin_path('a', 'executable', version)
@installer.generate_bin
assert_equal true, File.directory?(util_inst_bindir)
installed_exec = File.join util_inst_bindir, 'executable'
- assert_equal true, File.exist?(installed_exec)
+ assert_path_exists installed_exec
ensure
Gem::Installer.exec_format = nil
end
def test_generate_bin_script_install_dir
- util_setup_install
-
@installer.wrappers = true
- @spec.executables = %w[executable]
gem_dir = File.join("#{@gemhome}2", "gems", @spec.full_name)
gem_bindir = File.join gem_dir, 'bin'
@@ -312,11 +335,12 @@ load Gem.bin_path('a', 'executable', version)
@installer.gem_home = "#{@gemhome}2"
@installer.gem_dir = gem_dir
+ @installer.bin_dir = File.join "#{@gemhome}2", 'bin'
@installer.generate_bin
installed_exec = File.join("#{@gemhome}2", "bin", 'executable')
- assert_equal true, File.exist?(installed_exec)
+ assert_path_exists installed_exec
assert_equal mask, File.stat(installed_exec).mode unless win_platform?
wrapper = File.read installed_exec
@@ -324,19 +348,15 @@ load Gem.bin_path('a', 'executable', version)
end
def test_generate_bin_script_no_execs
- util_setup_install
-
util_execless
@installer.wrappers = true
@installer.generate_bin
- refute File.exist?(util_inst_bindir), 'bin dir was created when not needed'
+ refute_path_exists util_inst_bindir, 'bin dir was created when not needed'
end
def test_generate_bin_script_no_perms
- util_setup_install
-
@installer.wrappers = true
util_make_exec
@@ -356,8 +376,6 @@ load Gem.bin_path('a', 'executable', version)
end
def test_generate_bin_script_no_shebang
- util_setup_install
-
@installer.wrappers = true
@spec.executables = %w[executable]
@@ -371,7 +389,7 @@ load Gem.bin_path('a', 'executable', version)
@installer.generate_bin
installed_exec = File.join @gemhome, 'bin', 'executable'
- assert_equal true, File.exist?(installed_exec)
+ assert_path_exists installed_exec
assert_equal mask, File.stat(installed_exec).mode unless win_platform?
wrapper = File.read installed_exec
@@ -381,8 +399,6 @@ load Gem.bin_path('a', 'executable', version)
end
def test_generate_bin_script_wrappers
- util_setup_install
-
@installer.wrappers = true
util_make_exec
@installer.gem_dir = util_gem_dir
@@ -398,7 +414,7 @@ load Gem.bin_path('a', 'executable', version)
@installer.generate_bin
assert_equal true, File.directory?(util_inst_bindir)
- assert_equal true, File.exist?(installed_exec)
+ assert_path_exists installed_exec
assert_equal mask, File.stat(installed_exec).mode unless win_platform?
assert_match %r|generated by RubyGems|, File.read(installed_exec)
@@ -408,8 +424,6 @@ load Gem.bin_path('a', 'executable', version)
end
def test_generate_bin_symlink
- util_setup_install
-
return if win_platform? #Windows FS do not support symlinks
@installer.wrappers = false
@@ -425,19 +439,15 @@ load Gem.bin_path('a', 'executable', version)
end
def test_generate_bin_symlink_no_execs
- util_setup_install
-
util_execless
@installer.wrappers = false
@installer.generate_bin
- refute File.exist?(util_inst_bindir)
+ refute_path_exists util_inst_bindir
end
def test_generate_bin_symlink_no_perms
- util_setup_install
-
@installer.wrappers = false
util_make_exec
@installer.gem_dir = util_gem_dir
@@ -458,8 +468,6 @@ load Gem.bin_path('a', 'executable', version)
end
def test_generate_bin_symlink_update_newer
- util_setup_install
-
return if win_platform? #Windows FS do not support symlinks
@installer.wrappers = false
@@ -480,7 +488,6 @@ load Gem.bin_path('a', 'executable', version)
s.require_path = 'lib'
end
- @spec.version = 3
util_make_exec
@installer.gem_dir = util_gem_dir @spec
@installer.generate_bin
@@ -491,8 +498,6 @@ load Gem.bin_path('a', 'executable', version)
end
def test_generate_bin_symlink_update_older
- util_setup_install
-
return if win_platform? #Windows FS do not support symlinks
@installer.wrappers = false
@@ -529,8 +534,6 @@ load Gem.bin_path('a', 'executable', version)
end
def test_generate_bin_symlink_update_remove_wrapper
- util_setup_install
-
return if win_platform? #Windows FS do not support symlinks
@installer.wrappers = true
@@ -538,8 +541,9 @@ load Gem.bin_path('a', 'executable', version)
@installer.gem_dir = util_gem_dir
@installer.generate_bin
+
installed_exec = File.join util_inst_bindir, 'executable'
- assert_equal true, File.exist?(installed_exec)
+ assert_path_exists installed_exec
@spec = Gem::Specification.new do |s|
s.files = ['lib/code.rb']
@@ -549,21 +553,21 @@ load Gem.bin_path('a', 'executable', version)
s.description = "desc"
s.require_path = 'lib'
end
+ util_make_exec
+ util_installer @spec, @gemhome
@installer.wrappers = false
- @spec.version = 3
- util_make_exec
@installer.gem_dir = util_gem_dir
+
@installer.generate_bin
- installed_exec = File.join(util_inst_bindir, 'executable')
- assert_equal(File.join(util_gem_dir, 'bin', 'executable'),
+
+ installed_exec = File.join util_inst_bindir, 'executable'
+ assert_equal(@spec.bin_file('executable'),
File.readlink(installed_exec),
"Ensure symlink moved to latest version")
end
def test_generate_bin_symlink_win32
- util_setup_install
-
old_win_platform = Gem.win_platform?
Gem.win_platform = true
@installer.wrappers = false
@@ -576,7 +580,7 @@ load Gem.bin_path('a', 'executable', version)
assert_equal true, File.directory?(util_inst_bindir)
installed_exec = File.join(util_inst_bindir, 'executable')
- assert_equal true, File.exist?(installed_exec)
+ assert_path_exists installed_exec
assert_match(/Unable to use symlinks on Windows, installing wrapper/i,
@ui.error)
@@ -588,8 +592,6 @@ load Gem.bin_path('a', 'executable', version)
end
def test_generate_bin_uses_default_shebang
- util_setup_install
-
return if win_platform? #Windows FS do not support symlinks
@installer.wrappers = true
@@ -604,7 +606,7 @@ load Gem.bin_path('a', 'executable', version)
end
def test_initialize
- spec = quick_spec 'a' do |s| s.platform = Gem::Platform.new 'mswin32' end
+ spec = util_spec 'a' do |s| s.platform = Gem::Platform.new 'mswin32' end
gem = File.join @tempdir, spec.file_name
Dir.mkdir util_inst_bindir
@@ -614,6 +616,24 @@ load Gem.bin_path('a', 'executable', version)
installer = Gem::Installer.new gem
assert_equal File.join(@gemhome, 'gems', spec.full_name), installer.gem_dir
+ assert_equal File.join(@gemhome, 'bin'), installer.bin_dir
+ end
+
+ def test_initialize_user_install
+ installer = Gem::Installer.new @gem, :user_install => true
+
+ assert_equal File.join(Gem.user_dir, 'gems', @spec.full_name),
+ installer.gem_dir
+ assert_equal Gem.bindir(Gem.user_dir), installer.bin_dir
+ end
+
+ def test_initialize_user_install_bin_dir
+ installer =
+ Gem::Installer.new @gem, :user_install => true, :bin_dir => @tempdir
+
+ assert_equal File.join(Gem.user_dir, 'gems', @spec.full_name),
+ installer.gem_dir
+ assert_equal @tempdir, installer.bin_dir
end
def test_install
@@ -627,19 +647,19 @@ load Gem.bin_path('a', 'executable', version)
rakefile = File.join gemdir, 'ext', 'a', 'Rakefile'
Gem.pre_install do |installer|
- refute File.exist?(cache_file), 'cache file must not exist yet'
+ refute_path_exists cache_file, 'cache file must not exist yet'
true
end
Gem.post_build do |installer|
- assert File.exist?(gemdir), 'gem install dir must exist'
- assert File.exist?(rakefile), 'gem executable must exist'
- refute File.exist?(stub_exe), 'gem executable must not exist'
+ assert_path_exists gemdir, 'gem install dir must exist'
+ assert_path_exists rakefile, 'gem executable must exist'
+ refute_path_exists stub_exe, 'gem executable must not exist'
true
end
Gem.post_install do |installer|
- assert File.exist?(cache_file), 'cache file must exist'
+ assert_path_exists cache_file, 'cache file must exist'
end
@newspec = nil
@@ -650,23 +670,23 @@ load Gem.bin_path('a', 'executable', version)
end
assert_equal @spec, @newspec
- assert File.exist? gemdir
- assert File.exist?(stub_exe), 'gem executable must exist'
+ assert_path_exists gemdir
+ assert_path_exists stub_exe, 'gem executable must exist'
exe = File.join gemdir, 'bin', 'executable'
- assert File.exist? exe
+ assert_path_exists exe
exe_mode = File.stat(exe).mode & 0111
assert_equal 0111, exe_mode, "0%o" % exe_mode unless win_platform?
- assert File.exist?(File.join(gemdir, 'lib', 'code.rb'))
+ assert_path_exists File.join gemdir, 'lib', 'code.rb'
- assert File.exist? rakefile
+ assert_path_exists rakefile
spec_file = File.join(@gemhome, 'specifications', @spec.spec_name)
assert_equal spec_file, @newspec.loaded_from
- assert File.exist?(spec_file)
+ assert_path_exists spec_file
assert_same @installer, @post_build_hook_arg
assert_same @installer, @post_install_hook_arg
@@ -775,7 +795,7 @@ load Gem.bin_path('a', 'executable', version)
end
gemdir = File.join(@gemhome, 'gems', @spec.full_name)
- assert File.exist?(File.join(gemdir, 'lib', 'code.rb'))
+ assert_path_exists File.join gemdir, 'lib', 'code.rb'
util_setup_gem
# Morph spec to have lib/other.rb instead of code.rb and recreate
@@ -784,7 +804,7 @@ load Gem.bin_path('a', 'executable', version)
File.open File.join('lib', 'other.rb'), 'w' do |f| f.puts '1' end
use_ui ui do
FileUtils.rm @gem
- Gem::Builder.new(@spec).build
+ Gem::Package.build @spec
end
end
@installer = Gem::Installer.new @gem
@@ -794,67 +814,9 @@ load Gem.bin_path('a', 'executable', version)
end
end
- assert File.exist?(File.join(gemdir, 'lib', 'other.rb'))
- refute(File.exist?(File.join(gemdir, 'lib', 'code.rb')),
- "code.rb from prior install of same gem shouldn't remain here")
- end
-
- def test_install_bad_gem
- gem = nil
-
- use_ui @ui do
- Dir.chdir @tempdir do Gem::Builder.new(@spec).build end
- gem = File.join @tempdir, @spec.file_name
- end
-
- gem_data = File.open gem, 'rb' do |fp| fp.read 1024 end
- File.open gem, 'wb' do |fp| fp.write gem_data end
-
- e = assert_raises Gem::InstallError do
- use_ui @ui do
- @installer = Gem::Installer.new gem
- @installer.install
- end
- end
-
- assert_equal "invalid gem format for #{gem}", e.message
- end
-
- def test_install_check_dependencies
- @spec.add_dependency 'b', '> 5'
- util_setup_gem
-
- use_ui @ui do
- assert_raises Gem::InstallError do
- @installer.install
- end
- end
- end
-
- def test_install_check_dependencies_install_dir
- gemhome2 = "#{@gemhome}2"
- @spec.add_dependency 'b'
-
- quick_gem 'b', 2
-
- FileUtils.mv @gemhome, gemhome2
-
- Gem::Specification.dirs = [gemhome2] # TODO: switch all dirs= to use_paths
-
- util_setup_gem
-
- @installer = Gem::Installer.new @gem, :install_dir => gemhome2
-
- gem_home = Gem.dir
-
- build_rake_in do
- use_ui @ui do
- @installer.install
- end
- end
-
- assert File.exist?(File.join(gemhome2, 'gems', @spec.full_name))
- assert_equal gem_home, Gem.dir
+ assert_path_exists File.join gemdir, 'lib', 'other.rb'
+ refute_path_exists File.join gemdir, 'lib', 'code.rb',
+ "code.rb from prior install of same gem shouldn't remain here"
end
def test_install_force
@@ -864,31 +826,7 @@ load Gem.bin_path('a', 'executable', version)
end
gem_dir = File.join(@gemhome, 'gems', 'old_ruby_required-1')
- assert File.exist?(gem_dir)
- end
-
- def test_install_ignore_dependencies
- Dir.mkdir util_inst_bindir
- @spec.add_dependency 'b', '> 5'
- util_setup_gem
- @installer.ignore_dependencies = true
-
- build_rake_in do
- use_ui @ui do
- assert_equal @spec, @installer.install
- end
- end
-
- gemdir = File.join @gemhome, 'gems', @spec.full_name
- assert File.exist?(gemdir)
-
- exe = File.join(gemdir, 'bin', 'executable')
- assert File.exist?(exe)
- exe_mode = File.stat(exe).mode & 0111
- assert_equal 0111, exe_mode, "0%o" % exe_mode unless win_platform?
- assert File.exist?(File.join(gemdir, 'lib', 'code.rb'))
-
- assert File.exist?(File.join(@gemhome, 'specifications', @spec.spec_name))
+ assert_path_exists gem_dir
end
def test_install_missing_dirs
@@ -897,8 +835,6 @@ load Gem.bin_path('a', 'executable', version)
FileUtils.rm_f File.join(Gem.dir, 'specifications')
use_ui @ui do
- Dir.chdir @tempdir do Gem::Builder.new(@spec).build end
-
@installer.install
end
@@ -906,8 +842,8 @@ load Gem.bin_path('a', 'executable', version)
File.directory? File.join(Gem.dir, 'docs')
File.directory? File.join(Gem.dir, 'specifications')
- assert File.exist?(File.join(@gemhome, 'cache', @spec.file_name))
- assert File.exist?(File.join(@gemhome, 'specifications', @spec.spec_name))
+ assert_path_exists File.join @gemhome, 'cache', @spec.file_name
+ assert_path_exists File.join @gemhome, 'specifications', @spec.spec_name
end
def test_install_post_build_false
@@ -928,10 +864,10 @@ load Gem.bin_path('a', 'executable', version)
end
spec_file = File.join @gemhome, 'specifications', @spec.spec_name
- refute File.exist? spec_file
+ refute_path_exists spec_file
gem_dir = File.join @gemhome, 'gems', @spec.full_name
- refute File.exist? gem_dir
+ refute_path_exists gem_dir
end
def test_install_post_build_nil
@@ -946,10 +882,10 @@ load Gem.bin_path('a', 'executable', version)
end
spec_file = File.join @gemhome, 'specifications', @spec.spec_name
- assert File.exist? spec_file
+ assert_path_exists spec_file
gem_dir = File.join @gemhome, 'gems', @spec.full_name
- assert File.exist? gem_dir
+ assert_path_exists gem_dir
end
def test_install_pre_install_false
@@ -970,7 +906,7 @@ load Gem.bin_path('a', 'executable', version)
end
spec_file = File.join @gemhome, 'specifications', @spec.spec_name
- refute File.exist? spec_file
+ refute_path_exists spec_file
end
def test_install_pre_install_nil
@@ -985,14 +921,14 @@ load Gem.bin_path('a', 'executable', version)
end
spec_file = File.join @gemhome, 'specifications', @spec.spec_name
- assert File.exist? spec_file
+ assert_path_exists spec_file
end
def test_install_with_message
@spec.post_install_message = 'I am a shiny gem!'
use_ui @ui do
- path = Gem::Builder.new(@spec).build
+ path = Gem::Package.build @spec
@installer = Gem::Installer.new path
@installer.install
@@ -1001,19 +937,193 @@ load Gem.bin_path('a', 'executable', version)
assert_match %r|I am a shiny gem!|, @ui.output
end
- def test_install_wrong_ruby_version
+ def test_install_extension_install_dir
+ gemhome2 = "#{@gemhome}2"
+
+ @spec.extensions << "extconf.rb"
+ write_file File.join(@tempdir, "extconf.rb") do |io|
+ io.write <<-RUBY
+ require "mkmf"
+ create_makefile("#{@spec.name}")
+ RUBY
+ end
+
+ @spec.files += %w[extconf.rb]
+
+ use_ui @ui do
+ path = Gem::Package.build @spec
+
+ installer = Gem::Installer.new path, :install_dir => gemhome2
+ installer.install
+ end
+
+ expected_makefile = File.join gemhome2, 'gems', @spec.full_name, 'Makefile'
+
+ assert_path_exists expected_makefile
+ end
+
+ def test_install_extension_and_script
+ @spec.extensions << "extconf.rb"
+ write_file File.join(@tempdir, "extconf.rb") do |io|
+ io.write <<-RUBY
+ require "mkmf"
+ create_makefile("#{@spec.name}")
+ RUBY
+ end
+
+ rb = File.join("lib", "#{@spec.name}.rb")
+ @spec.files += [rb]
+ write_file File.join(@tempdir, rb) do |io|
+ io.write <<-RUBY
+ # #{@spec.name}.rb
+ RUBY
+ end
+
+ Dir.mkdir(File.join("lib", @spec.name))
+ rb2 = File.join("lib", @spec.name, "#{@spec.name}.rb")
+ @spec.files << rb2
+ write_file File.join(@tempdir, rb2) do |io|
+ io.write <<-RUBY
+ # #{@spec.name}/#{@spec.name}.rb
+ RUBY
+ end
+
+ refute_path_exists File.join @spec.gem_dir, rb
+ refute_path_exists File.join @spec.gem_dir, rb2
+ use_ui @ui do
+ path = Gem::Package.build @spec
+
+ @installer = Gem::Installer.new path
+ @installer.install
+ end
+ assert_path_exists File.join @spec.gem_dir, rb
+ assert_path_exists File.join @spec.gem_dir, rb2
+ end
+
+ def test_install_extension_flat
+ skip '1.9.2 and earlier mkmf.rb does not create TOUCH' if
+ RUBY_VERSION < '1.9.3'
+
+ if RUBY_VERSION == "1.9.3" and RUBY_PATCHLEVEL <= 194
+ skip "TOUCH was introduced into 1.9.3 after p194"
+ end
+
+ @spec.require_paths = ["."]
+
+ @spec.extensions << "extconf.rb"
+
+ write_file File.join(@tempdir, "extconf.rb") do |io|
+ io.write <<-RUBY
+ require "mkmf"
+
+ CONFIG['CC'] = '$(TOUCH) $@ ||'
+ CONFIG['LDSHARED'] = '$(TOUCH) $@ ||'
+ $ruby = '#{Gem.ruby}'
+
+ create_makefile("#{@spec.name}")
+ RUBY
+ end
+
+ # empty depend file for no auto dependencies
+ @spec.files += %W"depend #{@spec.name}.c".each {|file|
+ write_file File.join(@tempdir, file)
+ }
+
+ so = File.join(@spec.gem_dir, "#{@spec.name}.#{RbConfig::CONFIG["DLEXT"]}")
+ refute_path_exists so
+ use_ui @ui do
+ path = Gem::Package.build @spec
+
+ @installer = Gem::Installer.new path
+ @installer.install
+ end
+ assert_path_exists so
+ rescue
+ puts '-' * 78
+ puts File.read File.join(@gemhome, 'gems', 'a-2', 'Makefile')
+ puts '-' * 78
+
+ path = File.join(@gemhome, 'gems', 'a-2', 'gem_make.out')
+
+ if File.exists?(path)
+ puts File.read(path)
+ puts '-' * 78
+ end
+
+ raise
+ end
+
+ def test_installation_satisfies_dependency_eh
+ util_spec 'a'
+
+ dep = Gem::Dependency.new 'a', '>= 2'
+ assert @installer.installation_satisfies_dependency?(dep)
+
+ dep = Gem::Dependency.new 'a', '> 2'
+ refute @installer.installation_satisfies_dependency?(dep)
+ end
+
+ def test_pre_install_checks_dependencies
+ @spec.add_dependency 'b', '> 5'
+ util_setup_gem
+
+ use_ui @ui do
+ assert_raises Gem::InstallError do
+ @installer.install
+ end
+ end
+ end
+
+ def test_pre_install_checks_dependencies_ignore
+ @spec.add_dependency 'b', '> 5'
+ @installer.ignore_dependencies = true
+
+ build_rake_in do
+ use_ui @ui do
+ assert @installer.pre_install_checks
+ end
+ end
+ end
+
+ def test_pre_install_checks_dependencies_install_dir
+ gemhome2 = "#{@gemhome}2"
+ @spec.add_dependency 'd'
+
+ quick_gem 'd', 2
+
+ gem = File.join @gemhome, @spec.file_name
+
+ FileUtils.mv @gemhome, gemhome2
+ FileUtils.mkdir @gemhome
+
+ FileUtils.mv File.join(gemhome2, 'cache', @spec.file_name), gem
+
+ # Don't leak any already activated gems into the installer, require
+ # that it work everything out on it's own.
+ Gem::Specification.reset
+
+ installer = Gem::Installer.new gem, :install_dir => gemhome2
+
+ build_rake_in do
+ use_ui @ui do
+ assert installer.pre_install_checks
+ end
+ end
+ end
+
+ def test_pre_install_checks_ruby_version
use_ui @ui do
installer = Gem::Installer.new old_ruby_required
e = assert_raises Gem::InstallError do
- installer.install
+ installer.pre_install_checks
end
assert_equal 'old_ruby_required requires Ruby version = 1.4.6.',
e.message
end
end
- def test_install_wrong_rubygems_version
- spec = quick_spec 'old_rubygems_required', '1' do |s|
+ def test_pre_install_checks_wrong_rubygems_version
+ spec = util_spec 'old_rubygems_required', '1' do |s|
s.required_rubygems_version = '< 0'
end
@@ -1024,26 +1134,14 @@ load Gem.bin_path('a', 'executable', version)
use_ui @ui do
@installer = Gem::Installer.new gem
e = assert_raises Gem::InstallError do
- @installer.install
+ @installer.pre_install_checks
end
assert_equal 'old_rubygems_required requires RubyGems version < 0. ' +
"Try 'gem update --system' to update RubyGems itself.", e.message
end
end
- def test_installation_satisfies_dependency_eh
- util_setup_install
-
- dep = Gem::Dependency.new 'a', '>= 2'
- assert @installer.installation_satisfies_dependency?(dep)
-
- dep = Gem::Dependency.new 'a', '> 2'
- refute @installer.installation_satisfies_dependency?(dep)
- end
-
def test_shebang
- util_setup_install
-
util_make_exec @spec, "#!/usr/bin/ruby"
shebang = @installer.shebang 'executable'
@@ -1052,8 +1150,6 @@ load Gem.bin_path('a', 'executable', version)
end
def test_shebang_arguments
- util_setup_install
-
util_make_exec @spec, "#!/usr/bin/ruby -ws"
shebang = @installer.shebang 'executable'
@@ -1062,8 +1158,6 @@ load Gem.bin_path('a', 'executable', version)
end
def test_shebang_empty
- util_setup_install
-
util_make_exec @spec, ''
shebang = @installer.shebang 'executable'
@@ -1071,8 +1165,6 @@ load Gem.bin_path('a', 'executable', version)
end
def test_shebang_env
- util_setup_install
-
util_make_exec @spec, "#!/usr/bin/env ruby"
shebang = @installer.shebang 'executable'
@@ -1081,8 +1173,6 @@ load Gem.bin_path('a', 'executable', version)
end
def test_shebang_env_arguments
- util_setup_install
-
util_make_exec @spec, "#!/usr/bin/env ruby -ws"
shebang = @installer.shebang 'executable'
@@ -1091,8 +1181,6 @@ load Gem.bin_path('a', 'executable', version)
end
def test_shebang_env_shebang
- util_setup_install
-
util_make_exec @spec, ''
@installer.env_shebang = true
@@ -1105,8 +1193,6 @@ load Gem.bin_path('a', 'executable', version)
end
def test_shebang_nested
- util_setup_install
-
util_make_exec @spec, "#!/opt/local/ruby/bin/ruby"
shebang = @installer.shebang 'executable'
@@ -1115,8 +1201,6 @@ load Gem.bin_path('a', 'executable', version)
end
def test_shebang_nested_arguments
- util_setup_install
-
util_make_exec @spec, "#!/opt/local/ruby/bin/ruby -ws"
shebang = @installer.shebang 'executable'
@@ -1125,8 +1209,6 @@ load Gem.bin_path('a', 'executable', version)
end
def test_shebang_version
- util_setup_install
-
util_make_exec @spec, "#!/usr/bin/ruby18"
shebang = @installer.shebang 'executable'
@@ -1135,8 +1217,6 @@ load Gem.bin_path('a', 'executable', version)
end
def test_shebang_version_arguments
- util_setup_install
-
util_make_exec @spec, "#!/usr/bin/ruby18 -ws"
shebang = @installer.shebang 'executable'
@@ -1145,8 +1225,6 @@ load Gem.bin_path('a', 'executable', version)
end
def test_shebang_version_env
- util_setup_install
-
util_make_exec @spec, "#!/usr/bin/env ruby18"
shebang = @installer.shebang 'executable'
@@ -1155,8 +1233,6 @@ load Gem.bin_path('a', 'executable', version)
end
def test_shebang_version_env_arguments
- util_setup_install
-
util_make_exec @spec, "#!/usr/bin/env ruby18 -ws"
shebang = @installer.shebang 'executable'
@@ -1164,43 +1240,133 @@ load Gem.bin_path('a', 'executable', version)
assert_equal "#!#{Gem.ruby} -ws", shebang
end
- def test_unpack
- util_setup_install
+ def test_shebang_custom
+ conf = Gem::ConfigFile.new []
+ conf[:custom_shebang] = 'test'
+
+ Gem.configuration = conf
+ util_make_exec @spec, "#!/usr/bin/ruby"
+
+ shebang = @installer.shebang 'executable'
+
+ assert_equal "#!test", shebang
+ end
+
+ def test_shebang_custom_with_expands
+ bin_env = win_platform? ? '' : '/usr/bin/env'
+ conf = Gem::ConfigFile.new []
+ conf[:custom_shebang] = '1 $env 2 $ruby 3 $exec 4 $name'
+
+ Gem.configuration = conf
+
+ util_make_exec @spec, "#!/usr/bin/ruby"
+
+ shebang = @installer.shebang 'executable'
+
+ assert_equal "#!1 #{bin_env} 2 #{Gem.ruby} 3 executable 4 a", shebang
+ end
+
+ def test_shebang_custom_with_expands_and_arguments
+ bin_env = win_platform? ? '' : '/usr/bin/env'
+ conf = Gem::ConfigFile.new []
+ conf[:custom_shebang] = '1 $env 2 $ruby 3 $exec'
+
+ Gem.configuration = conf
+
+ util_make_exec @spec, "#!/usr/bin/ruby -ws"
+
+ shebang = @installer.shebang 'executable'
+
+ assert_equal "#!1 #{bin_env} 2 #{Gem.ruby} -ws 3 executable", shebang
+ end
+
+ def test_unpack
util_setup_gem
dest = File.join @gemhome, 'gems', @spec.full_name
@installer.unpack dest
- assert File.exist?(File.join(dest, 'lib', 'code.rb'))
- assert File.exist?(File.join(dest, 'bin', 'executable'))
+ assert_path_exists File.join dest, 'lib', 'code.rb'
+ assert_path_exists File.join dest, 'bin', 'executable'
end
- def test_write_spec
- util_setup_install
+ def test_write_build_info_file
+ refute_path_exists @spec.build_info_file
- spec_dir = File.join @gemhome, 'specifications'
- spec_file = File.join spec_dir, @spec.spec_name
- FileUtils.rm spec_file
- refute File.exist?(spec_file)
+ @installer.build_args = %w[
+ --with-libyaml-dir /usr/local/Cellar/libyaml/0.1.4
+ ]
+
+ @installer.write_build_info_file
+
+ assert_path_exists @spec.build_info_file
+
+ expected = "--with-libyaml-dir\n/usr/local/Cellar/libyaml/0.1.4\n"
+
+ assert_equal expected, File.read(@spec.build_info_file)
+ end
+
+ def test_write_build_info_file_empty
+ refute_path_exists @spec.build_info_file
+
+ @installer.write_build_info_file
+
+ refute_path_exists @spec.build_info_file
+ end
+
+ def test_write_build_info_file_install_dir
+ installer = Gem::Installer.new @gem, :install_dir => "#{@gemhome}2"
+
+ installer.build_args = %w[
+ --with-libyaml-dir /usr/local/Cellar/libyaml/0.1.4
+ ]
+
+ installer.write_build_info_file
+
+ refute_path_exists @spec.build_info_file
+ assert_path_exists \
+ File.join("#{@gemhome}2", 'build_info', "#{@spec.full_name}.info")
+ end
+
+ def test_write_cache_file
+ cache_file = File.join @gemhome, 'cache', @spec.file_name
+ gem = File.join @gemhome, @spec.file_name
+
+ FileUtils.mv cache_file, gem
+ refute_path_exists cache_file
+
+ installer = Gem::Installer.new gem
+ installer.spec = @spec
+ installer.gem_home = @gemhome
+
+ installer.write_cache_file
+
+ assert_path_exists cache_file
+ end
+
+ def test_write_spec
+ FileUtils.rm @spec.spec_file
+ refute_path_exists @spec.spec_file
@installer.spec = @spec
@installer.gem_home = @gemhome
@installer.write_spec
- assert File.exist?(spec_file)
- assert_equal @spec, eval(File.read(spec_file))
+ assert_path_exists @spec.spec_file
+
+ loaded = Gem::Specification.load @spec.spec_file
+
+ assert_equal @spec, loaded
+
+ assert_equal Gem.rubygems_version, @spec.installed_by_version
end
def test_write_spec_writes_cached_spec
- util_setup_install
-
- spec_dir = File.join @gemhome, 'specifications'
- spec_file = File.join spec_dir, @spec.spec_name
- FileUtils.rm spec_file
- refute File.exist?(spec_file)
+ FileUtils.rm @spec.spec_file
+ refute_path_exists @spec.spec_file
@spec.files = %w[a.rb b.rb c.rb]
@@ -1212,17 +1378,39 @@ load Gem.bin_path('a', 'executable', version)
# cached specs have no file manifest:
@spec.files = []
- assert_equal @spec, eval(File.read(spec_file))
+ assert_equal @spec, eval(File.read(@spec.spec_file))
end
def test_dir
- util_setup_install
+ assert_match %r!/gemhome/gems/a-2$!, @installer.dir
+ end
+
+ def test_default_gem
+ FileUtils.rm_f File.join(Gem.dir, 'specifications')
+
+ @installer.wrappers = true
+ @installer.options[:install_as_default] = true
+ @installer.gem_dir = util_gem_dir @spec
+ @installer.generate_bin
- assert_match @installer.dir, %r!/installer/gems/a-2$!
+ use_ui @ui do
+ @installer.install
+ end
+
+ assert File.directory? util_inst_bindir
+ installed_exec = File.join util_inst_bindir, 'executable'
+ assert_path_exists installed_exec
+
+ assert File.directory? File.join(Gem.dir, 'specifications')
+ assert File.directory? File.join(Gem.dir, 'specifications', 'default')
+
+ default_spec = eval File.read File.join(Gem.dir, 'specifications', 'default', 'a-2.gemspec')
+ assert_equal Gem::Version.new("2"), default_spec.version
+ assert_equal ['bin/executable'], default_spec.files
end
def old_ruby_required
- spec = quick_spec 'old_ruby_required', '1' do |s|
+ spec = util_spec 'old_ruby_required', '1' do |s|
s.required_ruby_version = '= 1.4.6'
end
@@ -1232,12 +1420,24 @@ load Gem.bin_path('a', 'executable', version)
end
def util_execless
- @spec = quick_spec 'z'
+ @spec = util_spec 'z'
util_build_gem @spec
@installer = util_installer @spec, @gemhome
end
+ def util_conflict_executable wrappers
+ conflict = quick_gem 'conflict' do |spec|
+ util_make_exec spec
+ end
+
+ util_build_gem conflict
+
+ installer = util_installer conflict, @gemhome
+ installer.wrappers = wrappers
+ installer.generate_bin
+ end
+
def mask
0100755 & (~File.umask)
end
diff --git a/test/rubygems/test_gem_local_remote_options.rb b/test/rubygems/test_gem_local_remote_options.rb
index 0141a3150d..2b4ca806da 100644
--- a/test/rubygems/test_gem_local_remote_options.rb
+++ b/test/rubygems/test_gem_local_remote_options.rb
@@ -40,6 +40,8 @@ class TestGemLocalRemoteOptions < Gem::TestCase
end
def test_clear_sources_option_idiot_proof
+ spec_fetcher
+
@cmd.add_local_remote_options
@cmd.handle_options %W[--clear-sources]
assert_equal Gem.default_sources, Gem.sources
@@ -78,10 +80,14 @@ class TestGemLocalRemoteOptions < Gem::TestCase
s4 = URI.parse 'http://more-gems.example.com/' # Intentional duplicate
original_sources = Gem.sources.dup
+
@cmd.handle_options %W[--source #{s1} --source #{s2} --source #{s3} --source #{s4}]
- assert_equal [original_sources, s1.to_s, s2.to_s, "#{s3}/"].flatten,
- Gem.sources
+ original_sources << s1.to_s
+ original_sources << s2.to_s
+ original_sources << "#{s3}/"
+
+ assert_equal original_sources, Gem.sources
end
def test_update_sources_option
diff --git a/test/rubygems/test_gem_name_tuple.rb b/test/rubygems/test_gem_name_tuple.rb
new file mode 100644
index 0000000000..170a9c2ae0
--- /dev/null
+++ b/test/rubygems/test_gem_name_tuple.rb
@@ -0,0 +1,37 @@
+require 'rubygems/test_case'
+require 'rubygems/name_tuple'
+
+class TestGemNameTuple < Gem::TestCase
+
+ def test_full_name
+ n = Gem::NameTuple.new "a", Gem::Version.new(0), "ruby"
+ assert_equal "a-0", n.full_name
+
+ n = Gem::NameTuple.new "a", Gem::Version.new(0), nil
+ assert_equal "a-0", n.full_name
+
+ n = Gem::NameTuple.new "a", Gem::Version.new(0), ""
+ assert_equal "a-0", n.full_name
+
+ n = Gem::NameTuple.new "a", Gem::Version.new(0), "other"
+ assert_equal "a-0-other", n.full_name
+ end
+
+ def test_platform_normalization
+ n = Gem::NameTuple.new "a", Gem::Version.new(0), "ruby"
+ assert_equal "ruby", n.platform
+
+ n = Gem::NameTuple.new "a", Gem::Version.new(0), nil
+ assert_equal "ruby", n.platform
+
+ n = Gem::NameTuple.new "a", Gem::Version.new(0), ""
+ assert_equal "ruby", n.platform
+ end
+
+ def test_spec_name
+ n = Gem::NameTuple.new "a", Gem::Version.new(0), "ruby"
+ assert_equal "a-0.gemspec", n.spec_name
+ end
+
+end
+
diff --git a/test/rubygems/test_gem_package.rb b/test/rubygems/test_gem_package.rb
new file mode 100644
index 0000000000..6a328d5a53
--- /dev/null
+++ b/test/rubygems/test_gem_package.rb
@@ -0,0 +1,805 @@
+# coding: UTF-8
+
+require 'rubygems/package/tar_test_case'
+require 'rubygems/simple_gem'
+
+class TestGemPackage < Gem::Package::TarTestCase
+
+ def setup
+ super
+
+ @spec = quick_gem 'a' do |s|
+ s.description = 'Ï€'
+ s.files = %w[lib/code.rb]
+ end
+
+ util_build_gem @spec
+
+ @gem = @spec.cache_file
+
+ @destination = File.join @tempdir, 'extract'
+
+ FileUtils.mkdir_p @destination
+ end
+
+ def test_class_new_old_format
+ open 'old_format.gem', 'wb' do |io|
+ io.write SIMPLE_GEM
+ end
+
+ package = Gem::Package.new 'old_format.gem'
+
+ assert package.spec
+ end
+
+ def test_add_checksums
+ gem_io = StringIO.new
+
+ spec = Gem::Specification.new 'build', '1'
+ spec.summary = 'build'
+ spec.authors = 'build'
+ spec.files = ['lib/code.rb']
+ spec.date = Time.at 0
+ spec.rubygems_version = Gem::Version.new '0'
+
+ FileUtils.mkdir 'lib'
+
+ open 'lib/code.rb', 'w' do |io|
+ io.write '# lib/code.rb'
+ end
+
+ package = Gem::Package.new spec.file_name
+ package.spec = spec
+ package.build_time = 1 # 0 uses current time
+ package.setup_signer
+
+ Gem::Package::TarWriter.new gem_io do |gem|
+ package.add_metadata gem
+ package.add_contents gem
+ package.add_checksums gem
+ end
+
+ gem_io.rewind
+
+ reader = Gem::Package::TarReader.new gem_io
+
+ checksums = nil
+ tar = nil
+
+ reader.each_entry do |entry|
+ case entry.full_name
+ when 'checksums.yaml.gz' then
+ Zlib::GzipReader.wrap entry do |io|
+ checksums = io.read
+ end
+ when 'data.tar.gz' then
+ tar = entry.read
+ end
+ end
+
+ s = StringIO.new
+
+ package.gzip_to s do |io|
+ io.write spec.to_yaml
+ end
+
+ metadata_sha1 = Digest::SHA1.hexdigest s.string
+ metadata_sha512 = Digest::SHA512.hexdigest s.string
+
+ expected = {
+ 'SHA512' => {
+ 'metadata.gz' => metadata_sha512,
+ 'data.tar.gz' => Digest::SHA512.hexdigest(tar),
+ }
+ }
+
+ if defined?(OpenSSL::Digest) then
+ expected['SHA1'] = {
+ 'metadata.gz' => metadata_sha1,
+ 'data.tar.gz' => Digest::SHA1.hexdigest(tar),
+ }
+ end
+
+ assert_equal expected, YAML.load(checksums)
+ end
+
+ def test_add_files
+ spec = Gem::Specification.new
+ spec.files = %w[lib/code.rb lib/empty]
+
+ FileUtils.mkdir_p 'lib/empty'
+
+ open 'lib/code.rb', 'w' do |io| io.write '# lib/code.rb' end
+ open 'lib/extra.rb', 'w' do |io| io.write '# lib/extra.rb' end
+
+ package = Gem::Package.new 'bogus.gem'
+ package.spec = spec
+
+ tar = util_tar do |tar_io|
+ package.add_files tar_io
+ end
+
+ tar.rewind
+
+ files = []
+
+ Gem::Package::TarReader.new tar do |tar_io|
+ tar_io.each_entry do |entry|
+ files << entry.full_name
+ end
+ end
+
+ assert_equal %w[lib/code.rb], files
+ end
+
+ def test_build
+ spec = Gem::Specification.new 'build', '1'
+ spec.summary = 'build'
+ spec.authors = 'build'
+ spec.files = ['lib/code.rb']
+ spec.rubygems_version = :junk
+
+ FileUtils.mkdir 'lib'
+
+ open 'lib/code.rb', 'w' do |io|
+ io.write '# lib/code.rb'
+ end
+
+ package = Gem::Package.new spec.file_name
+ package.spec = spec
+
+ package.build
+
+ assert_equal Gem::VERSION, spec.rubygems_version
+ assert_path_exists spec.file_name
+
+ reader = Gem::Package.new spec.file_name
+ assert_equal spec, reader.spec
+
+ assert_equal %w[metadata.gz data.tar.gz checksums.yaml.gz],
+ reader.files
+
+ assert_equal %w[lib/code.rb], reader.contents
+ end
+
+ def test_build_auto_signed
+ skip 'openssl is missing' unless defined?(OpenSSL::SSL)
+
+ FileUtils.mkdir_p File.join(Gem.user_home, '.gem')
+
+ private_key_path = File.join Gem.user_home, '.gem', 'gem-private_key.pem'
+ Gem::Security.write PRIVATE_KEY, private_key_path
+
+ public_cert_path = File.join Gem.user_home, '.gem', 'gem-public_cert.pem'
+ FileUtils.cp PUBLIC_CERT_PATH, public_cert_path
+
+ spec = Gem::Specification.new 'build', '1'
+ spec.summary = 'build'
+ spec.authors = 'build'
+ spec.files = ['lib/code.rb']
+
+ FileUtils.mkdir 'lib'
+
+ open 'lib/code.rb', 'w' do |io|
+ io.write '# lib/code.rb'
+ end
+
+ package = Gem::Package.new spec.file_name
+ package.spec = spec
+
+ package.build
+
+ assert_equal Gem::VERSION, spec.rubygems_version
+ assert_path_exists spec.file_name
+
+ reader = Gem::Package.new spec.file_name
+ assert reader.verify
+
+ assert_equal [PUBLIC_CERT.to_pem], reader.spec.cert_chain
+
+ assert_equal %w[metadata.gz metadata.gz.sig
+ data.tar.gz data.tar.gz.sig
+ checksums.yaml.gz checksums.yaml.gz.sig],
+ reader.files
+
+ assert_equal %w[lib/code.rb], reader.contents
+ end
+
+ def test_build_auto_signed_encrypted_key
+ skip 'openssl is missing' unless defined?(OpenSSL::SSL)
+
+ FileUtils.mkdir_p File.join(Gem.user_home, '.gem')
+
+ private_key_path = File.join Gem.user_home, '.gem', 'gem-private_key.pem'
+ FileUtils.cp ENCRYPTED_PRIVATE_KEY_PATH, private_key_path
+
+ public_cert_path = File.join Gem.user_home, '.gem', 'gem-public_cert.pem'
+ Gem::Security.write PUBLIC_CERT, public_cert_path
+
+ spec = Gem::Specification.new 'build', '1'
+ spec.summary = 'build'
+ spec.authors = 'build'
+ spec.files = ['lib/code.rb']
+
+ FileUtils.mkdir 'lib'
+
+ open 'lib/code.rb', 'w' do |io|
+ io.write '# lib/code.rb'
+ end
+
+ package = Gem::Package.new spec.file_name
+ package.spec = spec
+
+ package.build
+
+ assert_equal Gem::VERSION, spec.rubygems_version
+ assert_path_exists spec.file_name
+
+ reader = Gem::Package.new spec.file_name
+ assert reader.verify
+
+ assert_equal [PUBLIC_CERT.to_pem], reader.spec.cert_chain
+
+ assert_equal %w[metadata.gz metadata.gz.sig
+ data.tar.gz data.tar.gz.sig
+ checksums.yaml.gz checksums.yaml.gz.sig],
+ reader.files
+
+ assert_equal %w[lib/code.rb], reader.contents
+ end
+
+ def test_build_invalid
+ spec = Gem::Specification.new 'build', '1'
+
+ package = Gem::Package.new spec.file_name
+ package.spec = spec
+
+ e = assert_raises Gem::InvalidSpecificationException do
+ package.build
+ end
+
+ assert_equal 'missing value for attribute summary', e.message
+ end
+
+ def test_build_signed
+ skip 'openssl is missing' unless defined?(OpenSSL::SSL)
+
+ spec = Gem::Specification.new 'build', '1'
+ spec.summary = 'build'
+ spec.authors = 'build'
+ spec.files = ['lib/code.rb']
+ spec.cert_chain = [PUBLIC_CERT.to_pem]
+ spec.signing_key = PRIVATE_KEY
+
+ FileUtils.mkdir 'lib'
+
+ open 'lib/code.rb', 'w' do |io|
+ io.write '# lib/code.rb'
+ end
+
+ package = Gem::Package.new spec.file_name
+ package.spec = spec
+
+ package.build
+
+ assert_equal Gem::VERSION, spec.rubygems_version
+ assert_path_exists spec.file_name
+
+ reader = Gem::Package.new spec.file_name
+ assert reader.verify
+
+ assert_equal spec, reader.spec
+
+ assert_equal %w[metadata.gz metadata.gz.sig
+ data.tar.gz data.tar.gz.sig
+ checksums.yaml.gz checksums.yaml.gz.sig],
+ reader.files
+
+ assert_equal %w[lib/code.rb], reader.contents
+ end
+
+ def test_build_signed_encryped_key
+ skip 'openssl is missing' unless defined?(OpenSSL::SSL)
+
+ spec = Gem::Specification.new 'build', '1'
+ spec.summary = 'build'
+ spec.authors = 'build'
+ spec.files = ['lib/code.rb']
+ spec.cert_chain = [PUBLIC_CERT.to_pem]
+ spec.signing_key = ENCRYPTED_PRIVATE_KEY
+
+ FileUtils.mkdir 'lib'
+
+ open 'lib/code.rb', 'w' do |io|
+ io.write '# lib/code.rb'
+ end
+
+ package = Gem::Package.new spec.file_name
+ package.spec = spec
+
+ package.build
+
+ assert_equal Gem::VERSION, spec.rubygems_version
+ assert_path_exists spec.file_name
+
+ reader = Gem::Package.new spec.file_name
+ assert reader.verify
+
+ assert_equal spec, reader.spec
+
+ assert_equal %w[metadata.gz metadata.gz.sig
+ data.tar.gz data.tar.gz.sig
+ checksums.yaml.gz checksums.yaml.gz.sig],
+ reader.files
+
+ assert_equal %w[lib/code.rb], reader.contents
+ end
+
+ def test_contents
+ package = Gem::Package.new @gem
+
+ assert_equal %w[lib/code.rb], package.contents
+ end
+
+ def test_extract_files
+ package = Gem::Package.new @gem
+
+ package.extract_files @destination
+
+ extracted = File.join @destination, 'lib/code.rb'
+ assert_path_exists extracted
+
+ mask = 0100666 & (~File.umask)
+
+ assert_equal mask.to_s(8), File.stat(extracted).mode.to_s(8) unless
+ win_platform?
+ end
+
+ def test_extract_files_empty
+ data_tgz = util_tar_gz do end
+
+ gem = util_tar do |tar|
+ tar.add_file 'data.tar.gz', 0644 do |io|
+ io.write data_tgz.string
+ end
+
+ tar.add_file 'metadata.gz', 0644 do |io|
+ Zlib::GzipWriter.wrap io do |gzio|
+ gzio.write @spec.to_yaml
+ end
+ end
+ end
+
+ open 'empty.gem', 'wb' do |io|
+ io.write gem.string
+ end
+
+ package = Gem::Package.new 'empty.gem'
+
+ package.extract_files @destination
+
+ assert_path_exists @destination
+ end
+
+ def test_extract_tar_gz_absolute
+ package = Gem::Package.new @gem
+
+ tgz_io = util_tar_gz do |tar|
+ tar.add_file '/absolute.rb', 0644 do |io| io.write 'hi' end
+ end
+
+ e = assert_raises Gem::Package::PathError do
+ package.extract_tar_gz tgz_io, @destination
+ end
+
+ assert_equal("installing into parent path /absolute.rb of " +
+ "#{@destination} is not allowed", e.message)
+ end
+
+ def test_extract_tar_gz_directory
+ package = Gem::Package.new @gem
+
+ tgz_io = util_tar_gz do |tar|
+ tar.mkdir 'lib', 0755
+ tar.add_file 'lib/foo.rb', 0644 do |io| io.write 'hi' end
+ tar.mkdir 'lib/foo', 0755
+ end
+
+ package.extract_tar_gz tgz_io, @destination
+
+ extracted = File.join @destination, 'lib/foo.rb'
+ assert_path_exists extracted
+
+ extracted = File.join @destination, 'lib/foo'
+ assert_path_exists extracted
+ end
+
+ def test_extract_tar_gz_dot_slash
+ package = Gem::Package.new @gem
+
+ tgz_io = util_tar_gz do |tar|
+ tar.add_file './dot_slash.rb', 0644 do |io| io.write 'hi' end
+ end
+
+ package.extract_tar_gz tgz_io, @destination
+
+ extracted = File.join @destination, 'dot_slash.rb'
+ assert_path_exists extracted
+ end
+
+ def test_extract_tar_gz_dot_file
+ package = Gem::Package.new @gem
+
+ tgz_io = util_tar_gz do |tar|
+ tar.add_file '.dot_file.rb', 0644 do |io| io.write 'hi' end
+ end
+
+ package.extract_tar_gz tgz_io, @destination
+
+ extracted = File.join @destination, '.dot_file.rb'
+ assert_path_exists extracted
+ end
+
+ def test_install_location
+ package = Gem::Package.new @gem
+
+ file = 'file.rb'
+ file.taint
+
+ destination = package.install_location file, @destination
+
+ assert_equal File.join(@destination, 'file.rb'), destination
+ refute destination.tainted?
+ end
+
+ def test_install_location_absolute
+ package = Gem::Package.new @gem
+
+ e = assert_raises Gem::Package::PathError do
+ package.install_location '/absolute.rb', @destination
+ end
+
+ assert_equal("installing into parent path /absolute.rb of " +
+ "#{@destination} is not allowed", e.message)
+ end
+
+ def test_install_location_dots
+ package = Gem::Package.new @gem
+
+ file = 'file.rb'
+
+ destination = File.join @destination, 'foo', '..', 'bar'
+
+ FileUtils.mkdir_p File.join @destination, 'foo'
+ FileUtils.mkdir_p File.expand_path destination
+
+ destination = package.install_location file, destination
+
+ # this test only fails on ruby missing File.realpath
+ assert_equal File.join(@destination, 'bar', 'file.rb'), destination
+ end
+
+ def test_install_location_extra_slash
+ skip 'no File.realpath on 1.8' if RUBY_VERSION < '1.9'
+ package = Gem::Package.new @gem
+
+ file = 'foo//file.rb'
+ file.taint
+
+ destination = @destination.sub '/', '//'
+
+ destination = package.install_location file, destination
+
+ assert_equal File.join(@destination, 'foo', 'file.rb'), destination
+ refute destination.tainted?
+ end
+
+ def test_install_location_relative
+ package = Gem::Package.new @gem
+
+ e = assert_raises Gem::Package::PathError do
+ package.install_location '../relative.rb', @destination
+ end
+
+ parent = File.expand_path File.join @destination, "../relative.rb"
+
+ assert_equal("installing into parent path #{parent} of " +
+ "#{@destination} is not allowed", e.message)
+ end
+
+ def test_load_spec
+ entry = StringIO.new Gem.gzip @spec.to_yaml
+ def entry.full_name() 'metadata.gz' end
+
+ package = Gem::Package.new 'nonexistent.gem'
+
+ spec = package.load_spec entry
+
+ assert_equal @spec, spec
+ end
+
+ def test_verify
+ package = Gem::Package.new @gem
+
+ package.verify
+
+ assert_equal @spec, package.spec
+ assert_equal %w[checksums.yaml.gz data.tar.gz metadata.gz],
+ package.files.sort
+ end
+
+ def test_verify_checksum_bad
+ data_tgz = util_tar_gz do |tar|
+ tar.add_file 'lib/code.rb', 0444 do |io|
+ io.write '# lib/code.rb'
+ end
+ end
+
+ data_tgz = data_tgz.string
+
+ gem = util_tar do |tar|
+ metadata_gz = Gem.gzip @spec.to_yaml
+
+ tar.add_file 'metadata.gz', 0444 do |io|
+ io.write metadata_gz
+ end
+
+ tar.add_file 'data.tar.gz', 0444 do |io|
+ io.write data_tgz
+ end
+
+ bogus_checksums = {
+ 'SHA1' => {
+ 'data.tar.gz' => 'bogus',
+ 'metadata.gz' => 'bogus',
+ },
+ }
+ tar.add_file 'checksums.yaml.gz', 0444 do |io|
+ Zlib::GzipWriter.wrap io do |gz_io|
+ gz_io.write YAML.dump bogus_checksums
+ end
+ end
+ end
+
+ open 'mismatch.gem', 'wb' do |io|
+ io.write gem.string
+ end
+
+ package = Gem::Package.new 'mismatch.gem'
+
+ e = assert_raises Gem::Package::FormatError do
+ package.verify
+ end
+
+ assert_equal 'SHA1 checksum mismatch for data.tar.gz in mismatch.gem',
+ e.message
+ end
+
+ def test_verify_checksum_missing
+ data_tgz = util_tar_gz do |tar|
+ tar.add_file 'lib/code.rb', 0444 do |io|
+ io.write '# lib/code.rb'
+ end
+ end
+
+ data_tgz = data_tgz.string
+
+ gem = util_tar do |tar|
+ metadata_gz = Gem.gzip @spec.to_yaml
+
+ tar.add_file 'metadata.gz', 0444 do |io|
+ io.write metadata_gz
+ end
+
+ digest = Digest::SHA1.new
+ digest << metadata_gz
+
+ checksums = {
+ 'SHA1' => {
+ 'metadata.gz' => digest.hexdigest,
+ },
+ }
+
+ tar.add_file 'checksums.yaml.gz', 0444 do |io|
+ Zlib::GzipWriter.wrap io do |gz_io|
+ gz_io.write YAML.dump checksums
+ end
+ end
+
+ tar.add_file 'data.tar.gz', 0444 do |io|
+ io.write data_tgz
+ end
+ end
+
+ open 'data_checksum_missing.gem', 'wb' do |io|
+ io.write gem.string
+ end
+
+ package = Gem::Package.new 'data_checksum_missing.gem'
+
+ assert package.verify
+ end
+
+ def test_verify_corrupt
+ Tempfile.open 'corrupt' do |io|
+ data = Gem.gzip 'a' * 10
+ io.write \
+ tar_file_header('metadata.gz', "\000x", 0644, data.length, Time.now)
+ io.write data
+ io.rewind
+
+ package = Gem::Package.new io.path
+
+ e = assert_raises Gem::Package::FormatError do
+ package.verify
+ end
+
+ assert_equal "tar is corrupt, name contains null byte in #{io.path}",
+ e.message
+ end
+ end
+
+ def test_verify_empty
+ FileUtils.touch 'empty.gem'
+
+ package = Gem::Package.new 'empty.gem'
+
+ e = assert_raises Gem::Package::FormatError do
+ package.verify
+ end
+
+ assert_equal 'package metadata is missing in empty.gem', e.message
+ end
+
+ def test_verify_nonexistent
+ package = Gem::Package.new 'nonexistent.gem'
+
+ e = assert_raises Gem::Package::FormatError do
+ package.verify
+ end
+
+ assert_match %r%^No such file or directory%, e.message
+ assert_match %r%nonexistent.gem$%, e.message
+ end
+
+ def test_verify_security_policy
+ skip 'openssl is missing' unless defined?(OpenSSL::SSL)
+
+ package = Gem::Package.new @gem
+ package.security_policy = Gem::Security::HighSecurity
+
+ e = assert_raises Gem::Security::Exception do
+ package.verify
+ end
+
+ assert_equal 'unsigned gems are not allowed by the High Security policy',
+ e.message
+
+ refute package.instance_variable_get(:@spec), '@spec must not be loaded'
+ assert_empty package.instance_variable_get(:@files), '@files must empty'
+ end
+
+ def test_verify_security_policy_low_security
+ skip 'openssl is missing' unless defined?(OpenSSL::SSL)
+
+ @spec.cert_chain = [PUBLIC_CERT.to_pem]
+ @spec.signing_key = PRIVATE_KEY
+
+ FileUtils.mkdir_p 'lib'
+ FileUtils.touch 'lib/code.rb'
+
+ build = Gem::Package.new @gem
+ build.spec = @spec
+
+ build.build
+
+ package = Gem::Package.new @gem
+ package.security_policy = Gem::Security::LowSecurity
+
+ assert package.verify
+ end
+
+ def test_verify_security_policy_checksum_missing
+ skip 'openssl is missing' unless defined?(OpenSSL::SSL)
+
+ @spec.cert_chain = [PUBLIC_CERT.to_pem]
+ @spec.signing_key = PRIVATE_KEY
+
+ build = Gem::Package.new @gem
+ build.spec = @spec
+ build.setup_signer
+
+ FileUtils.mkdir 'lib'
+ FileUtils.touch 'lib/code.rb'
+
+ open @gem, 'wb' do |gem_io|
+ Gem::Package::TarWriter.new gem_io do |gem|
+ build.add_metadata gem
+ build.add_contents gem
+
+ # write bogus data.tar.gz to foil signature
+ bogus_data = Gem.gzip 'hello'
+ gem.add_file_simple 'data.tar.gz', 0444, bogus_data.length do |io|
+ io.write bogus_data
+ end
+
+ # pre rubygems 2.0 gems do not add checksums
+ end
+ end
+
+ Gem::Security.trust_dir.trust_cert PUBLIC_CERT
+
+ package = Gem::Package.new @gem
+ package.security_policy = Gem::Security::HighSecurity
+
+ e = assert_raises Gem::Security::Exception do
+ package.verify
+ end
+
+ assert_equal 'invalid signature', e.message
+
+ refute package.instance_variable_get(:@spec), '@spec must not be loaded'
+ assert_empty package.instance_variable_get(:@files), '@files must empty'
+ end
+
+ def test_verify_truncate
+ open 'bad.gem', 'wb' do |io|
+ io.write File.read(@gem, 1024) # don't care about newlines
+ end
+
+ package = Gem::Package.new 'bad.gem'
+
+ e = assert_raises Gem::Package::FormatError do
+ package.verify
+ end
+
+ assert_equal 'package content (data.tar.gz) is missing in bad.gem',
+ e.message
+ end
+
+ # end #verify tests
+
+ def test_verify_entry
+ entry = Object.new
+ def entry.full_name() raise ArgumentError, 'whatever' end
+
+ package = Gem::Package.new @gem
+
+ e = assert_raises Gem::Package::FormatError do
+ package.verify_entry entry
+ end
+
+ assert_equal "package is corrupt, exception while verifying: whatever (ArgumentError) in #{@gem}", e.message
+ end
+
+ def test_spec
+ package = Gem::Package.new @gem
+
+ assert_equal @spec, package.spec
+ end
+
+ def util_tar
+ tar_io = StringIO.new
+
+ Gem::Package::TarWriter.new tar_io do |tar|
+ yield tar
+ end
+
+ tar_io.rewind
+
+ tar_io
+ end
+
+ def util_tar_gz(&block)
+ tar_io = util_tar(&block)
+
+ tgz_io = StringIO.new
+
+ # can't wrap TarWriter because it seeks
+ Zlib::GzipWriter.wrap tgz_io do |io| io.write tar_io.string end
+
+ StringIO.new tgz_io.string
+ end
+
+end
+
diff --git a/test/rubygems/test_gem_package_old.rb b/test/rubygems/test_gem_package_old.rb
new file mode 100644
index 0000000000..6236dbbaf2
--- /dev/null
+++ b/test/rubygems/test_gem_package_old.rb
@@ -0,0 +1,89 @@
+require 'rubygems/test_case'
+require 'rubygems/simple_gem'
+
+class TestGemPackageOld < Gem::TestCase
+
+ def setup
+ super
+
+ open 'old_format.gem', 'wb' do |io|
+ io.write SIMPLE_GEM
+ end
+
+ @package = Gem::Package::Old.new 'old_format.gem'
+ @destination = File.join @tempdir, 'extract'
+
+ FileUtils.mkdir_p @destination
+ end
+
+ def test_contents
+ assert_equal %w[lib/foo.rb lib/test.rb lib/test/wow.rb], @package.contents
+ end
+
+ def test_contents_security_policy
+ skip 'openssl is missing' unless defined?(OpenSSL::SSL)
+
+ @package.security_policy = Gem::Security::AlmostNoSecurity
+
+ assert_raises Gem::Security::Exception do
+ @package.contents
+ end
+ end
+
+ def test_extract_files
+ @package.extract_files @destination
+
+ extracted = File.join @destination, 'lib/foo.rb'
+ assert_path_exists extracted
+
+ mask = 0100644 & (~File.umask)
+
+ assert_equal mask, File.stat(extracted).mode unless win_platform?
+ end
+
+ def test_extract_files_security_policy
+ skip 'openssl is missing' unless defined?(OpenSSL::SSL)
+
+ @package.security_policy = Gem::Security::AlmostNoSecurity
+
+ assert_raises Gem::Security::Exception do
+ @package.extract_files @destination
+ end
+ end
+
+ def test_spec
+ assert_equal 'testing', @package.spec.name
+ end
+
+ def test_spec_security_policy
+ skip 'openssl is missing' unless defined?(OpenSSL::SSL)
+
+ @package.security_policy = Gem::Security::AlmostNoSecurity
+
+ assert_raises Gem::Security::Exception do
+ @package.spec
+ end
+ end
+
+ def test_verify
+ skip 'openssl is missing' unless defined?(OpenSSL::SSL)
+
+ assert @package.verify
+
+ @package.security_policy = Gem::Security::NoSecurity
+
+ assert @package.verify
+
+ @package.security_policy = Gem::Security::AlmostNoSecurity
+
+ e = assert_raises Gem::Security::Exception do
+ @package.verify
+ end
+
+ assert_equal 'old format gems do not contain signatures ' +
+ 'and cannot be verified',
+ e.message
+ end
+
+end
+
diff --git a/test/rubygems/test_gem_package_tar_input.rb b/test/rubygems/test_gem_package_tar_input.rb
deleted file mode 100644
index ee8e53712c..0000000000
--- a/test/rubygems/test_gem_package_tar_input.rb
+++ /dev/null
@@ -1,129 +0,0 @@
-require 'rubygems/package/tar_test_case'
-require 'rubygems/package/tar_input'
-
-class TestGemPackageTarInput < Gem::Package::TarTestCase
-
- # Sometimes the setgid bit doesn't take. Don't know if this is a problem on
- # all systems, or just some. But for now, we will ignore it in the tests.
- SETGID_BIT = 02000
-
- def setup
- super
-
- inner_tar = tar_file_header("bla", "", 0612, 10)
- inner_tar += "0123456789" + "\0" * 502
- inner_tar += tar_file_header("foo", "", 0636, 5)
- inner_tar += "01234" + "\0" * 507
- inner_tar += tar_dir_header("__dir__", "", 0600)
- inner_tar += "\0" * 1024
- str = TempIO.new
-
- begin
- os = Zlib::GzipWriter.new str
- os.write inner_tar
- ensure
- os.finish
- end
-
- str.rewind
-
- @file = File.join @tempdir, 'bla.tar'
-
- File.open @file, 'wb' do |f|
- f.write tar_file_header("data.tar.gz", "", 0644, str.string.size)
- f.write str.string
- f.write "\0" * ((512 - (str.string.size % 512)) % 512 )
-
- @spec = Gem::Specification.new do |spec|
- spec.author = "Mauricio :)"
- end
-
- meta = @spec.to_yaml
-
- f.write tar_file_header("metadata", "", 0644, meta.size)
- f.write meta + "\0" * (1024 - meta.size)
- f.write "\0" * 1024
- end
-
- @entry_names = %w{bla foo __dir__}
- @entry_sizes = [10, 5, 0]
- #FIXME: are these modes system dependent?
- @entry_modes = [0100612, 0100636, 040600]
- @entry_files = %W[#{@tempdir}/bla #{@tempdir}/foo]
- @entry_contents = %w[0123456789 01234]
- end
-
- def test_initialize_no_metadata_file
- Tempfile.open 'no_meta' do |io|
- io.write tar_file_header('a', '', 0644, 1)
- io.write 'a'
- io.rewind
-
- e = assert_raises Gem::Package::FormatError do
- open io.path, Gem.binary_mode do |file|
- Gem::Package::TarInput.open file do end
- end
- end
-
- assert_equal "no metadata found in #{io.path}", e.message
- assert_equal io.path, e.path
- end
- end
-
- def test_each
- open @file, 'rb' do |io|
- Gem::Package::TarInput.open io do |tar_input|
- count = 0
-
- tar_input.each_with_index do |entry, i|
- count = i
-
- assert_kind_of Gem::Package::TarReader::Entry, entry
- assert_equal @entry_names[i], entry.header.name
- assert_equal @entry_sizes[i], entry.header.size
- end
-
- assert_equal 2, count
-
- assert_equal @spec, tar_input.metadata
- end
- end
- end
-
- def test_extract_entry
- open @file, 'rb' do |io|
- Gem::Package::TarInput.open io do |tar_input|
- assert_equal @spec, tar_input.metadata
-
- count = 0
-
- tar_input.each_with_index do |entry, i|
- count = i
- tar_input.extract_entry @tempdir, entry
- name = File.join @tempdir, entry.header.name
-
- if entry.directory? then
- assert File.directory?(name)
- else
- assert File.file?(name)
- assert_equal @entry_sizes[i], File.stat(name).size
- #FIXME: win32? !!
- end
-
- unless Gem.win_platform? then
- assert_equal @entry_modes[i], File.stat(name).mode & (~SETGID_BIT)
- end
- end
-
- assert_equal 2, count
- end
- end
-
- @entry_files.each_with_index do |x, i|
- assert File.file?(x)
- assert_equal @entry_contents[i], Gem.read_binary(x)
- end
- end
-
-end
-
diff --git a/test/rubygems/test_gem_package_tar_output.rb b/test/rubygems/test_gem_package_tar_output.rb
deleted file mode 100644
index ecf25ef107..0000000000
--- a/test/rubygems/test_gem_package_tar_output.rb
+++ /dev/null
@@ -1,101 +0,0 @@
-require 'rubygems/package/tar_test_case'
-require 'rubygems/package/tar_output'
-require 'rubygems/security'
-
-class TestGemPackageTarOutput < Gem::Package::TarTestCase
-
- def setup
- super
-
- @file = File.join @tempdir, 'bla2.tar'
- end
-
- def test_self_open
- open @file, 'wb' do |tar_io|
- Gem::Package::TarOutput.open tar_io do |tar_writer|
- tar_writer.add_file_simple 'README', 0, 17 do |io|
- io.write "This is a README\n"
- end
-
- tar_writer.metadata = "This is some metadata\n"
- end
- end
-
- files = util_extract
-
- name, data = files.shift
- assert_equal 'data.tar.gz', name
-
- gz = Zlib::GzipReader.new StringIO.new(data)
-
- Gem::Package::TarReader.new gz do |tar_reader|
- tar_reader.each do |entry|
- assert_equal 'README', entry.full_name
- assert_equal "This is a README\n", entry.read
- end
- end
-
- gz.close
-
- name, data = files.shift
- assert_equal 'metadata.gz', name
-
- gz = Zlib::GzipReader.new StringIO.new(data)
- assert_equal "This is some metadata\n", gz.read
-
- assert_empty files
- ensure
- gz.close if gz
- end
-
- if defined? OpenSSL then
- def test_self_open_signed
- @private_key = File.expand_path('test/rubygems/private_key.pem', @@project_dir)
- @public_cert = File.expand_path('test/rubygems/public_cert.pem', @@project_dir)
-
- signer = Gem::Security::Signer.new @private_key, [@public_cert]
-
- open @file, 'wb' do |tar_io|
- Gem::Package::TarOutput.open tar_io, signer do |tar_writer|
- tar_writer.add_file_simple 'README', 0, 17 do |io|
- io.write "This is a README\n"
- end
-
- tar_writer.metadata = "This is some metadata\n"
- end
- end
-
- files = util_extract
-
- name, data = files.shift
- assert_equal 'data.tar.gz', name
-
- name, data = files.shift
- assert_equal 'metadata.gz', name
-
- name, data = files.shift
- assert_equal 'data.tar.gz.sig', name
-
- name, data = files.shift
- assert_equal 'metadata.gz.sig', name
-
- assert_empty files
- end
- end
-
- def util_extract
- files = []
-
- open @file, 'rb' do |io|
- Gem::Package::TarReader.new io do |tar_reader|
- tar_reader.each do |entry|
- files << [entry.full_name, entry.read]
- end
- end
- end
-
- files
- end
-
-end
-
diff --git a/test/rubygems/test_gem_package_tar_reader.rb b/test/rubygems/test_gem_package_tar_reader.rb
index 34e30441d8..5e0474c253 100644
--- a/test/rubygems/test_gem_package_tar_reader.rb
+++ b/test/rubygems/test_gem_package_tar_reader.rb
@@ -4,8 +4,8 @@ require 'rubygems/package'
class TestGemPackageTarReader < Gem::Package::TarTestCase
def test_each_entry
- tar = tar_dir_header "foo", "bar", 0
- tar << tar_file_header("bar", "baz", 0, 0)
+ tar = tar_dir_header "foo", "bar", 0, Time.now
+ tar << tar_file_header("bar", "baz", 0, 0, Time.now)
io = TempIO.new tar
@@ -25,8 +25,9 @@ class TestGemPackageTarReader < Gem::Package::TarTestCase
def test_rewind
content = ('a'..'z').to_a.join(" ")
- str = tar_file_header("lib/foo", "", 010644, content.size) + content +
- "\0" * (512 - content.size)
+ str =
+ tar_file_header("lib/foo", "", 010644, content.size, Time.now) +
+ content + "\0" * (512 - content.size)
str << "\0" * 1024
Gem::Package::TarReader.new(TempIO.new(str)) do |tar_reader|
@@ -42,5 +43,37 @@ class TestGemPackageTarReader < Gem::Package::TarTestCase
end
end
+ def test_seek
+ tar = tar_dir_header "foo", "bar", 0, Time.now
+ tar << tar_file_header("bar", "baz", 0, 0, Time.now)
+
+ io = TempIO.new tar
+
+ Gem::Package::TarReader.new io do |tar_reader|
+ tar_reader.seek 'baz/bar' do |entry|
+ assert_kind_of Gem::Package::TarReader::Entry, entry
+
+ assert_equal 'baz/bar', entry.full_name
+ end
+
+ assert_equal 0, io.pos
+ end
+ end
+
+ def test_seek_missing
+ tar = tar_dir_header "foo", "bar", 0, Time.now
+ tar << tar_file_header("bar", "baz", 0, 0, Time.now)
+
+ io = TempIO.new tar
+
+ Gem::Package::TarReader.new io do |tar_reader|
+ tar_reader.seek 'nonexistent' do |entry|
+ flunk 'entry missing but entry-found block was run'
+ end
+
+ assert_equal 0, io.pos
+ end
+ end
+
end
diff --git a/test/rubygems/test_gem_package_tar_reader_entry.rb b/test/rubygems/test_gem_package_tar_reader_entry.rb
index 92da220fa6..3c1bf7291a 100644
--- a/test/rubygems/test_gem_package_tar_reader_entry.rb
+++ b/test/rubygems/test_gem_package_tar_reader_entry.rb
@@ -9,7 +9,7 @@ class TestGemPackageTarReaderEntry < Gem::Package::TarTestCase
@contents = ('a'..'z').to_a.join * 100
@tar = ''
- @tar << tar_file_header("lib/foo", "", 0, @contents.size)
+ @tar << tar_file_header("lib/foo", "", 0, @contents.size, Time.now)
@tar << @contents
@tar << "\0" * (512 - (@tar.size % 512))
diff --git a/test/rubygems/test_gem_package_tar_writer.rb b/test/rubygems/test_gem_package_tar_writer.rb
index 88779e7079..2505d7ced1 100644
--- a/test/rubygems/test_gem_package_tar_writer.rb
+++ b/test/rubygems/test_gem_package_tar_writer.rb
@@ -1,7 +1,8 @@
require 'rubygems/package/tar_test_case'
require 'rubygems/package/tar_writer'
+require 'minitest/mock'
-class TestTarWriter < Gem::Package::TarTestCase
+class TestGemPackageTarWriter < Gem::Package::TarTestCase
def setup
super
@@ -18,29 +19,130 @@ class TestTarWriter < Gem::Package::TarTestCase
end
def test_add_file
- @tar_writer.add_file 'x', 0644 do |f| f.write 'a' * 10 end
+ Time.stub :now, Time.at(1458518157) do
+ @tar_writer.add_file 'x', 0644 do |f| f.write 'a' * 10 end
- assert_headers_equal(tar_file_header('x', '', 0644, 10),
+ assert_headers_equal(tar_file_header('x', '', 0644, 10, Time.now),
@io.string[0, 512])
+ end
+ assert_equal "aaaaaaaaaa#{"\0" * 502}", @io.string[512, 512]
+ assert_equal 1024, @io.pos
+ end
+
+ def test_add_file_digest
+ digest_algorithms = Digest::SHA1, Digest::SHA512
+
+ Time.stub :now, Time.at(1458518157) do
+ digests = @tar_writer.add_file_digest 'x', 0644, digest_algorithms do |io|
+ io.write 'a' * 10
+ end
+
+ assert_equal '3495ff69d34671d1e15b33a63c1379fdedd3a32a',
+ digests['SHA1'].hexdigest
+ assert_equal '4714870aff6c97ca09d135834fdb58a6389a50c1' \
+ '1fef8ec4afef466fb60a23ac6b7a9c92658f14df' \
+ '4993d6b40a4e4d8424196afc347e97640d68de61' \
+ 'e1cf14b0',
+ digests['SHA512'].hexdigest
+
+ assert_headers_equal(tar_file_header('x', '', 0644, 10, Time.now),
+ @io.string[0, 512])
+ end
+ assert_equal "aaaaaaaaaa#{"\0" * 502}", @io.string[512, 512]
+ assert_equal 1024, @io.pos
+ end
+
+ def test_add_file_digest_multiple
+ digest_algorithms = [Digest::SHA1, Digest::SHA512]
+
+ Time.stub :now, Time.at(1458518157) do
+ digests = @tar_writer.add_file_digest 'x', 0644, digest_algorithms do |io|
+ io.write 'a' * 10
+ end
+
+ assert_equal '3495ff69d34671d1e15b33a63c1379fdedd3a32a',
+ digests['SHA1'].hexdigest
+ assert_equal '4714870aff6c97ca09d135834fdb58a6389a50c1' \
+ '1fef8ec4afef466fb60a23ac6b7a9c92658f14df' \
+ '4993d6b40a4e4d8424196afc347e97640d68de61' \
+ 'e1cf14b0',
+ digests['SHA512'].hexdigest
+
+ assert_headers_equal(tar_file_header('x', '', 0644, 10, Time.now),
+ @io.string[0, 512])
+ end
+ assert_equal "aaaaaaaaaa#{"\0" * 502}", @io.string[512, 512]
+ assert_equal 1024, @io.pos
+ end
+
+ def test_add_file_signer
+ skip 'openssl is missing' unless defined?(OpenSSL::SSL)
+
+ signer = Gem::Security::Signer.new PRIVATE_KEY, [PUBLIC_CERT]
+
+ Time.stub :now, Time.at(1458518157) do
+ @tar_writer.add_file_signed 'x', 0644, signer do |io|
+ io.write 'a' * 10
+ end
+
+ assert_headers_equal(tar_file_header('x', '', 0644, 10, Time.now),
+ @io.string[0, 512])
+
+
+ assert_equal "aaaaaaaaaa#{"\0" * 502}", @io.string[512, 512]
+
+ digest = signer.digest_algorithm.new
+ digest.update 'a' * 10
+
+ signature = signer.sign digest.digest
+
+ assert_headers_equal(tar_file_header('x.sig', '', 0444, signature.length,
+ Time.now),
+ @io.string[1024, 512])
+ assert_equal "#{signature}#{"\0" * (512 - signature.length)}",
+ @io.string[1536, 512]
+
+ assert_equal 2048, @io.pos
+ end
+
+ end
+
+ def test_add_file_signer_empty
+ signer = Gem::Security::Signer.new nil, nil
+
+ Time.stub :now, Time.at(1458518157) do
+
+ @tar_writer.add_file_signed 'x', 0644, signer do |io|
+ io.write 'a' * 10
+ end
+
+ assert_headers_equal(tar_file_header('x', '', 0644, 10, Time.now),
+ @io.string[0, 512])
+ end
assert_equal "aaaaaaaaaa#{"\0" * 502}", @io.string[512, 512]
+
assert_equal 1024, @io.pos
end
def test_add_file_simple
- @tar_writer.add_file_simple 'x', 0644, 10 do |io| io.write "a" * 10 end
+ Time.stub :now, Time.at(1458518157) do
+ @tar_writer.add_file_simple 'x', 0644, 10 do |io| io.write "a" * 10 end
- assert_headers_equal(tar_file_header('x', '', 0644, 10),
+ assert_headers_equal(tar_file_header('x', '', 0644, 10, Time.now),
@io.string[0, 512])
+ end
assert_equal "aaaaaaaaaa#{"\0" * 502}", @io.string[512, 512]
assert_equal 1024, @io.pos
end
def test_add_file_simple_padding
- @tar_writer.add_file_simple 'x', 0, 100
+ Time.stub :now, Time.at(1458518157) do
+ @tar_writer.add_file_simple 'x', 0, 100
- assert_headers_equal tar_file_header('x', '', 0, 100),
+ assert_headers_equal tar_file_header('x', '', 0, 100, Time.now),
@io.string[0, 512]
+ end
assert_equal "\0" * 512, @io.string[512, 512]
end
@@ -99,11 +201,14 @@ class TestTarWriter < Gem::Package::TarTestCase
end
def test_mkdir
- @tar_writer.mkdir 'foo', 0644
+ Time.stub :now, Time.at(1458518157) do
+ @tar_writer.mkdir 'foo', 0644
- assert_headers_equal tar_dir_header('foo', '', 0644),
- @io.string[0, 512]
- assert_equal 512, @io.pos
+ assert_headers_equal tar_dir_header('foo', '', 0644, Time.now),
+ @io.string[0, 512]
+
+ assert_equal 512, @io.pos
+ end
end
def test_split_name
diff --git a/test/rubygems/test_gem_package_task.rb b/test/rubygems/test_gem_package_task.rb
index 35b38cdbc7..1526e825fe 100644
--- a/test/rubygems/test_gem_package_task.rb
+++ b/test/rubygems/test_gem_package_task.rb
@@ -4,16 +4,37 @@ require 'rubygems/package_task'
class TestGemPackageTask < Gem::TestCase
+ def setup
+ super
+
+ Rake.application = Rake::Application.new
+ RakeFileUtils.verbose_flag = false
+ end
+
def test_gem_package
gem = Gem::Specification.new do |g|
g.name = "pkgr"
g.version = "1.2.3"
- g.files = Rake::FileList["x"].resolve
+
+ g.authors = %w[author]
+ g.files = %w[x]
+ g.summary = 'summary'
end
+
pkg = Gem::PackageTask.new(gem) do |p|
p.package_files << "y"
end
- assert_equal ["x", "y"], pkg.package_files
+
+ assert_equal %w[x y], pkg.package_files
+
+ Dir.chdir @tempdir do
+ FileUtils.touch 'x'
+ FileUtils.touch 'y'
+
+ Rake.application['package'].invoke
+
+ assert_path_exists 'pkg/pkgr-1.2.3.gem'
+ end
end
def test_gem_package_with_current_platform
diff --git a/test/rubygems/test_gem_path_support.rb b/test/rubygems/test_gem_path_support.rb
index 830173498f..879cc98b5f 100644
--- a/test/rubygems/test_gem_path_support.rb
+++ b/test/rubygems/test_gem_path_support.rb
@@ -22,10 +22,10 @@ class TestGemPathSupport < Gem::TestCase
def test_initialize_home
ps = Gem::PathSupport.new "GEM_HOME" => "#{@tempdir}/foo"
- expected = File.join(@tempdir, "foo")
- assert_equal expected, ps.home
+ assert_equal File.join(@tempdir, "foo"), ps.home
- assert_equal [expected, *util_path], ps.path
+ expected = util_path + [File.join(@tempdir, 'foo')]
+ assert_equal expected, ps.path
end
if defined?(File::ALT_SEPARATOR) and File::ALT_SEPARATOR
@@ -43,9 +43,9 @@ class TestGemPathSupport < Gem::TestCase
assert_equal ENV["GEM_HOME"], ps.home
expected = [
- ENV["GEM_HOME"],
File.join(@tempdir, 'foo'),
File.join(@tempdir, 'bar'),
+ ENV["GEM_HOME"],
]
assert_equal expected, ps.path
@@ -61,33 +61,24 @@ class TestGemPathSupport < Gem::TestCase
assert_equal expected, ps.path
end
- def test_path_equals
- ps = Gem::PathSupport.new
-
- ps.send :path=, ['a', 'b']
-
- assert_equal [@tempdir, 'a', 'b'], ps.path
+ def util_path
+ ENV["GEM_PATH"].split(File::PATH_SEPARATOR)
end
- def test_path_equals_empty
- ps = Gem::PathSupport.new
-
- ps.send :path=, nil
+ def test_initialize_spec
+ ENV["GEM_SPEC_CACHE"] = nil
- assert_equal [@tempdir, 'something'], ps.path
- end
+ ps = Gem::PathSupport.new
+ assert_equal Gem.default_spec_cache_dir, ps.spec_cache_dir
- def test_path_equals_empty_no_GEM_PATH
- ENV.delete 'GEM_PATH'
+ ENV["GEM_SPEC_CACHE"] = 'bar'
ps = Gem::PathSupport.new
+ assert_equal ENV["GEM_SPEC_CACHE"], ps.spec_cache_dir
- ps.send :path=, nil
+ ENV["GEM_SPEC_CACHE"] = File.join @tempdir, 'spec_cache'
- assert_equal [@tempdir, *Gem.default_path], ps.path
- end
-
- def util_path
- ENV["GEM_PATH"].split(File::PATH_SEPARATOR)
+ ps = Gem::PathSupport.new "GEM_SPEC_CACHE" => "foo"
+ assert_equal "foo", ps.spec_cache_dir
end
end
diff --git a/test/rubygems/test_gem_platform.rb b/test/rubygems/test_gem_platform.rb
index f3b94ea83d..5966710dad 100644
--- a/test/rubygems/test_gem_platform.rb
+++ b/test/rubygems/test_gem_platform.rb
@@ -51,6 +51,8 @@ class TestGemPlatform < Gem::TestCase
'i386-freebsd5' => ['x86', 'freebsd', '5'],
'i386-freebsd6' => ['x86', 'freebsd', '6'],
'i386-freebsd7' => ['x86', 'freebsd', '7'],
+ 'i386-freebsd' => ['x86', 'freebsd', nil],
+ 'universal-freebsd' => ['universal', 'freebsd', nil],
'i386-java1.5' => ['x86', 'java', '1.5'],
'x86-java1.6' => ['x86', 'java', '1.6'],
'i386-java1.6' => ['x86', 'java', '1.6'],
@@ -75,6 +77,7 @@ class TestGemPlatform < Gem::TestCase
'x86_64-linux' => ['x86_64', 'linux', nil],
'x86_64-openbsd3.9' => ['x86_64', 'openbsd', '3.9'],
'x86_64-openbsd4.0' => ['x86_64', 'openbsd', '4.0'],
+ 'x86_64-openbsd' => ['x86_64', 'openbsd', nil],
}
test_cases.each do |arch, expected|
@@ -136,12 +139,6 @@ class TestGemPlatform < Gem::TestCase
assert_equal '1', platform.version
end
- def test_empty
- platform = Gem::Platform.new 'cpu-other_platform1'
- assert_respond_to platform, :empty?
- assert_equal false, Gem::Deprecate.skip_during { platform.empty? }
- end
-
def test_to_s
if win_platform? then
assert_equal 'x86-mswin32-60', Gem::Platform.local.to_s
@@ -189,6 +186,24 @@ class TestGemPlatform < Gem::TestCase
assert((x86_darwin8 === Gem::Platform.local), 'universal =~ x86')
end
+ def test_equals3_cpu_arm
+ arm = Gem::Platform.new 'arm-linux'
+ armv5 = Gem::Platform.new 'armv5-linux'
+ armv7 = Gem::Platform.new 'armv7-linux'
+
+ util_set_arch 'armv5-linux'
+ assert((arm === Gem::Platform.local), 'arm === armv5')
+ assert((armv5 === Gem::Platform.local), 'armv5 === armv5')
+ refute((armv7 === Gem::Platform.local), 'armv7 === armv5')
+ refute((Gem::Platform.local === arm), 'armv5 === arm')
+
+ util_set_arch 'armv7-linux'
+ assert((arm === Gem::Platform.local), 'arm === armv7')
+ refute((armv5 === Gem::Platform.local), 'armv5 === armv7')
+ assert((armv7 === Gem::Platform.local), 'armv7 === armv7')
+ refute((Gem::Platform.local === arm), 'armv7 === arm')
+ end
+
def test_equals3_version
util_set_arch 'i686-darwin8'
@@ -207,64 +222,71 @@ class TestGemPlatform < Gem::TestCase
def test_equals_tilde
util_set_arch 'i386-mswin32'
- assert_match 'mswin32', Gem::Platform.local
- assert_match 'i386-mswin32', Gem::Platform.local
+ assert_local_match 'mswin32'
+ assert_local_match 'i386-mswin32'
# oddballs
- assert_match 'i386-mswin32-mq5.3', Gem::Platform.local
- assert_match 'i386-mswin32-mq6', Gem::Platform.local
- refute_match 'win32-1.8.2-VC7', Gem::Platform.local
- refute_match 'win32-1.8.4-VC6', Gem::Platform.local
- refute_match 'win32-source', Gem::Platform.local
- refute_match 'windows', Gem::Platform.local
+ assert_local_match 'i386-mswin32-mq5.3'
+ assert_local_match 'i386-mswin32-mq6'
+ refute_local_match 'win32-1.8.2-VC7'
+ refute_local_match 'win32-1.8.4-VC6'
+ refute_local_match 'win32-source'
+ refute_local_match 'windows'
util_set_arch 'i686-linux'
- assert_match 'i486-linux', Gem::Platform.local
- assert_match 'i586-linux', Gem::Platform.local
- assert_match 'i686-linux', Gem::Platform.local
+ assert_local_match 'i486-linux'
+ assert_local_match 'i586-linux'
+ assert_local_match 'i686-linux'
util_set_arch 'i686-darwin8'
- assert_match 'i686-darwin8.4.1', Gem::Platform.local
- assert_match 'i686-darwin8.8.2', Gem::Platform.local
+ assert_local_match 'i686-darwin8.4.1'
+ assert_local_match 'i686-darwin8.8.2'
util_set_arch 'java'
- assert_match 'java', Gem::Platform.local
- assert_match 'jruby', Gem::Platform.local
+ assert_local_match 'java'
+ assert_local_match 'jruby'
util_set_arch 'universal-dotnet2.0'
- assert_match 'universal-dotnet', Gem::Platform.local
- assert_match 'universal-dotnet-2.0', Gem::Platform.local
- refute_match 'universal-dotnet-4.0', Gem::Platform.local
- assert_match 'dotnet', Gem::Platform.local
- assert_match 'dotnet-2.0', Gem::Platform.local
- refute_match 'dotnet-4.0', Gem::Platform.local
+ assert_local_match 'universal-dotnet'
+ assert_local_match 'universal-dotnet-2.0'
+ refute_local_match 'universal-dotnet-4.0'
+ assert_local_match 'dotnet'
+ assert_local_match 'dotnet-2.0'
+ refute_local_match 'dotnet-4.0'
util_set_arch 'universal-dotnet4.0'
- assert_match 'universal-dotnet', Gem::Platform.local
- refute_match 'universal-dotnet-2.0', Gem::Platform.local
- assert_match 'universal-dotnet-4.0', Gem::Platform.local
- assert_match 'dotnet', Gem::Platform.local
- refute_match 'dotnet-2.0', Gem::Platform.local
- assert_match 'dotnet-4.0', Gem::Platform.local
+ assert_local_match 'universal-dotnet'
+ refute_local_match 'universal-dotnet-2.0'
+ assert_local_match 'universal-dotnet-4.0'
+ assert_local_match 'dotnet'
+ refute_local_match 'dotnet-2.0'
+ assert_local_match 'dotnet-4.0'
util_set_arch 'universal-macruby-1.0'
- assert_match 'universal-macruby', Gem::Platform.local
- assert_match 'macruby', Gem::Platform.local
- refute_match 'universal-macruby-0.10', Gem::Platform.local
- assert_match 'universal-macruby-1.0', Gem::Platform.local
+ assert_local_match 'universal-macruby'
+ assert_local_match 'macruby'
+ refute_local_match 'universal-macruby-0.10'
+ assert_local_match 'universal-macruby-1.0'
util_set_arch 'powerpc-darwin'
- assert_match 'powerpc-darwin', Gem::Platform.local
+ assert_local_match 'powerpc-darwin'
util_set_arch 'powerpc-darwin7'
- assert_match 'powerpc-darwin7.9.0', Gem::Platform.local
+ assert_local_match 'powerpc-darwin7.9.0'
util_set_arch 'powerpc-darwin8'
- assert_match 'powerpc-darwin8.10.0', Gem::Platform.local
+ assert_local_match 'powerpc-darwin8.10.0'
util_set_arch 'sparc-solaris2.8'
- assert_match 'sparc-solaris2.8-mq5.3', Gem::Platform.local
+ assert_local_match 'sparc-solaris2.8-mq5.3'
+ end
+
+ def assert_local_match name
+ assert_match Gem::Platform.local, name
end
+ def refute_local_match name
+ refute_match Gem::Platform.local, name
+ end
end
diff --git a/test/rubygems/test_gem_rdoc.rb b/test/rubygems/test_gem_rdoc.rb
new file mode 100644
index 0000000000..3ff06fe0d5
--- /dev/null
+++ b/test/rubygems/test_gem_rdoc.rb
@@ -0,0 +1,269 @@
+require 'rubygems'
+require 'rubygems/test_case'
+require 'rubygems/rdoc'
+
+class TestGemRDoc < Gem::TestCase
+ Gem::RDoc.load_rdoc
+ rdoc_4 = Gem::Requirement.new('> 3').satisfied_by?(Gem::RDoc.rdoc_version)
+
+ def setup
+ super
+
+ @a = util_spec 'a' do |s|
+ s.rdoc_options = %w[--main MyTitle]
+ s.extra_rdoc_files = %w[README]
+ end
+
+ write_file File.join(@tempdir, 'lib', 'a.rb')
+ write_file File.join(@tempdir, 'README')
+
+ install_gem @a
+
+ @hook = Gem::RDoc.new @a
+
+ begin
+ Gem::RDoc.load_rdoc
+ rescue Gem::DocumentError => e
+ skip e.message
+ end
+
+ Gem.configuration[:rdoc] = nil
+ end
+
+ ##
+ # RDoc 4 ships with its own Gem::RDoc which overrides this one which is
+ # shipped for backwards compatibility.
+
+ def rdoc_4?
+ Gem::Requirement.new('>= 4.0.0.preview2').satisfied_by? \
+ @hook.class.rdoc_version
+ end
+
+ def rdoc_3?
+ Gem::Requirement.new('~> 3.0').satisfied_by? @hook.class.rdoc_version
+ end
+
+ def rdoc_3_8_or_better?
+ Gem::Requirement.new('>= 3.8').satisfied_by? @hook.class.rdoc_version
+ end
+
+ def test_initialize
+ if rdoc_4? then
+ refute @hook.generate_rdoc
+ else
+ assert @hook.generate_rdoc
+ end
+ assert @hook.generate_ri
+
+ rdoc = Gem::RDoc.new @a, false, false
+
+ refute rdoc.generate_rdoc
+ refute rdoc.generate_ri
+ end
+
+ def test_delete_legacy_args
+ args = %w[
+ --inline-source
+ --one-file
+ --promiscuous
+ -p
+ ]
+
+ @hook.delete_legacy_args args
+
+ assert_empty args
+ end
+
+ def test_document
+ skip 'RDoc 3 required' unless rdoc_3?
+
+ options = RDoc::Options.new
+ options.files = []
+
+ rdoc = @hook.new_rdoc
+ @hook.instance_variable_set :@rdoc, rdoc
+ @hook.instance_variable_set :@file_info, []
+
+ @hook.document 'darkfish', options, @a.doc_dir('rdoc')
+
+ assert @hook.rdoc_installed?
+ end unless rdoc_4
+
+ def test_generate
+ skip 'RDoc 3 required' unless rdoc_3?
+
+ FileUtils.mkdir_p @a.doc_dir
+ FileUtils.mkdir_p File.join(@a.gem_dir, 'lib')
+
+ @hook.generate
+
+ assert @hook.rdoc_installed?
+ assert @hook.ri_installed?
+
+ rdoc = @hook.instance_variable_get :@rdoc
+
+ refute rdoc.options.hyperlink_all
+ end unless rdoc_4
+
+ def test_generate_configuration_rdoc_array
+ skip 'RDoc 3 required' unless rdoc_3?
+
+ Gem.configuration[:rdoc] = %w[-A]
+
+ FileUtils.mkdir_p @a.doc_dir
+ FileUtils.mkdir_p File.join(@a.gem_dir, 'lib')
+
+ @hook.generate
+
+ rdoc = @hook.instance_variable_get :@rdoc
+
+ assert rdoc.options.hyperlink_all
+ end unless rdoc_4
+
+ def test_generate_configuration_rdoc_string
+ skip 'RDoc 3 required' unless rdoc_3?
+
+ Gem.configuration[:rdoc] = '-A'
+
+ FileUtils.mkdir_p @a.doc_dir
+ FileUtils.mkdir_p File.join(@a.gem_dir, 'lib')
+
+ @hook.generate
+
+ rdoc = @hook.instance_variable_get :@rdoc
+
+ assert rdoc.options.hyperlink_all
+ end unless rdoc_4
+
+ def test_generate_disabled
+ @hook.generate_rdoc = false
+ @hook.generate_ri = false
+
+ @hook.generate
+
+ refute @hook.rdoc_installed?
+ refute @hook.ri_installed?
+ end
+
+ def test_generate_force
+ skip 'RDoc 3 required' unless rdoc_3?
+
+ FileUtils.mkdir_p @a.doc_dir 'ri'
+ FileUtils.mkdir_p @a.doc_dir 'rdoc'
+ FileUtils.mkdir_p File.join(@a.gem_dir, 'lib')
+
+ @hook.force = true
+
+ @hook.generate
+
+ assert_path_exists File.join(@a.doc_dir('rdoc'), 'index.html')
+ assert_path_exists File.join(@a.doc_dir('ri'), 'cache.ri')
+ end unless rdoc_4
+
+ def test_generate_no_overwrite
+ skip 'RDoc 3 required' unless rdoc_3?
+
+ FileUtils.mkdir_p @a.doc_dir 'ri'
+ FileUtils.mkdir_p @a.doc_dir 'rdoc'
+ FileUtils.mkdir_p File.join(@a.gem_dir, 'lib')
+
+ @hook.generate
+
+ refute_path_exists File.join(@a.doc_dir('rdoc'), 'index.html')
+ refute_path_exists File.join(@a.doc_dir('ri'), 'cache.ri')
+ end unless rdoc_4
+
+ def test_generate_legacy
+ skip 'RDoc < 3.8 required' if rdoc_3_8_or_better?
+
+ FileUtils.mkdir_p @a.doc_dir
+ FileUtils.mkdir_p File.join(@a.gem_dir, 'lib')
+
+ @hook.generate_legacy
+
+ assert @hook.rdoc_installed?
+ assert @hook.ri_installed?
+ end unless rdoc_4
+
+ def test_legacy_rdoc
+ skip 'RDoc < 3.8 required' if rdoc_3_8_or_better?
+
+ FileUtils.mkdir_p @a.doc_dir
+ FileUtils.mkdir_p File.join(@a.gem_dir, 'lib')
+
+ @hook.legacy_rdoc '--op', @a.doc_dir('rdoc')
+
+ assert @hook.rdoc_installed?
+ end unless rdoc_4
+
+ def test_new_rdoc
+ assert_kind_of RDoc::RDoc, @hook.new_rdoc
+ end
+
+ def test_rdoc_installed?
+ refute @hook.rdoc_installed?
+
+ FileUtils.mkdir_p @a.doc_dir 'rdoc'
+
+ assert @hook.rdoc_installed?
+ end
+
+ def test_remove
+ FileUtils.mkdir_p @a.doc_dir 'rdoc'
+ FileUtils.mkdir_p @a.doc_dir 'ri'
+
+ @hook.remove
+
+ refute @hook.rdoc_installed?
+ refute @hook.ri_installed?
+
+ assert_path_exists @a.doc_dir
+ end
+
+ def test_remove_unwritable
+ skip 'chmod not supported' if Gem.win_platform?
+ FileUtils.mkdir_p @a.base_dir
+ FileUtils.chmod 0, @a.base_dir
+
+ e = assert_raises Gem::FilePermissionError do
+ @hook.remove
+ end
+
+ assert_equal @a.base_dir, e.directory
+ ensure
+ FileUtils.chmod(0755, @a.base_dir) if File.directory?(@a.base_dir)
+ end
+
+ def test_ri_installed?
+ refute @hook.ri_installed?
+
+ FileUtils.mkdir_p @a.doc_dir 'ri'
+
+ assert @hook.ri_installed?
+ end
+
+ def test_setup
+ @hook.setup
+
+ assert_path_exists @a.doc_dir
+ end
+
+ def test_setup_unwritable
+ skip 'chmod not supported' if Gem.win_platform?
+ FileUtils.mkdir_p @a.doc_dir
+ FileUtils.chmod 0, @a.doc_dir
+
+ e = assert_raises Gem::FilePermissionError do
+ @hook.setup
+ end
+
+ assert_equal @a.doc_dir, e.directory
+ ensure
+ if File.exist? @a.doc_dir
+ FileUtils.chmod 0755, @a.doc_dir
+ FileUtils.rm_r @a.doc_dir
+ end
+ end
+
+end
+
diff --git a/test/rubygems/test_gem_remote_fetcher.rb b/test/rubygems/test_gem_remote_fetcher.rb
index 6d370cfe3d..7e6d9c7693 100644
--- a/test/rubygems/test_gem_remote_fetcher.rb
+++ b/test/rubygems/test_gem_remote_fetcher.rb
@@ -1,9 +1,16 @@
require 'rubygems/test_case'
-require 'ostruct'
+
require 'webrick'
-require 'webrick/https'
+begin
+ require 'webrick/https'
+rescue LoadError => e
+ raise unless (e.respond_to?(:path) && e.path == 'openssl') ||
+ e.message =~ / -- openssl$/
+end
+
require 'rubygems/remote_fetcher'
-require 'rubygems/format'
+require 'rubygems/package'
+require 'minitest/mock'
# = Testing Proxy Settings
#
@@ -68,28 +75,20 @@ gems:
PROXY_DATA = SERVER_DATA.gsub(/0.4.11/, '0.4.2')
- # don't let 1.8 and 1.9 autotest collide
- RUBY_VERSION =~ /(\d+)\.(\d+)\.(\d+)/
- # don't let parallel runners collide
- PROXY_PORT = process_based_port + 100 + $1.to_i * 100 + $2.to_i * 10 + $3.to_i
- SERVER_PORT = process_based_port + 200 + $1.to_i * 100 + $2.to_i * 10 + $3.to_i
-
DIR = File.expand_path(File.dirname(__FILE__))
def setup
+ @proxies = %w[http_proxy HTTP_PROXY http_proxy_user HTTP_PROXY_USER http_proxy_pass HTTP_PROXY_PASS no_proxy NO_PROXY]
+ @old_proxies = @proxies.map {|k| ENV[k] }
+ @proxies.each {|k| ENV[k] = nil }
+
super
self.class.start_servers
self.class.enable_yaml = true
self.class.enable_zip = false
- ENV.delete 'http_proxy'
- ENV.delete 'HTTP_PROXY'
- ENV.delete 'http_proxy_user'
- ENV.delete 'HTTP_PROXY_USER'
- ENV.delete 'http_proxy_pass'
- ENV.delete 'HTTP_PROXY_PASS'
- base_server_uri = "http://localhost:#{SERVER_PORT}"
- @proxy_uri = "http://localhost:#{PROXY_PORT}"
+ base_server_uri = "http://localhost:#{self.class.normal_server_port}"
+ @proxy_uri = "http://localhost:#{self.class.proxy_server_port}"
@server_uri = base_server_uri + "/yaml"
@server_z_uri = base_server_uri + "/yaml.Z"
@@ -101,6 +100,7 @@ gems:
# TODO: why does the remote fetcher need it written to disk?
@a1, @a1_gem = util_gem 'a', '1' do |s| s.executables << 'a_bin' end
+ @a1.loaded_from = File.join(@gemhome, 'specifications', @a1.full_name)
Gem::RemoteFetcher.fetcher = nil
@@ -110,6 +110,7 @@ gems:
def teardown
super
Gem.configuration[:http_proxy] = nil
+ @proxies.each_with_index {|k, i| ENV[k] = @old_proxies[i] }
end
def test_self_fetcher
@@ -127,19 +128,7 @@ gems:
refute_nil fetcher
assert_kind_of Gem::RemoteFetcher, fetcher
- assert_equal proxy_uri, fetcher.instance_variable_get(:@proxy_uri).to_s
- end
-
- def test_self_fetcher_with_proxy_URI
- proxy_uri = URI.parse 'http://proxy.example.com'
- Gem.configuration[:http_proxy] = proxy_uri
- Gem::RemoteFetcher.fetcher = nil
-
- fetcher = Gem::RemoteFetcher.fetcher
- refute_nil fetcher
-
- assert_kind_of Gem::RemoteFetcher, fetcher
- assert_equal proxy_uri, fetcher.instance_variable_get(:@proxy_uri)
+ assert_equal proxy_uri, fetcher.instance_variable_get(:@proxy).to_s
end
def test_fetch_size_bad_uri
@@ -154,7 +143,7 @@ gems:
def test_fetch_size_socket_error
fetcher = Gem::RemoteFetcher.new nil
- def fetcher.connection_for(uri)
+ def fetcher.request(uri, request_class, last_modified = nil)
raise SocketError, "tarded"
end
@@ -173,6 +162,47 @@ gems:
end
end
+ def test_api_endpoint
+ uri = URI.parse "http://gems.example.com/foo"
+ target = MiniTest::Mock.new
+ target.expect :target, "blah.com"
+
+ dns = MiniTest::Mock.new
+ dns.expect :getresource, target, [String, Object]
+
+ fetch = Gem::RemoteFetcher.new nil, dns
+ assert_equal URI.parse("http://blah.com/foo"), fetch.api_endpoint(uri)
+
+ target.verify
+ dns.verify
+ end
+
+ def test_cache_update_path
+ uri = URI 'http://example/file'
+ path = File.join @tempdir, 'file'
+
+ fetcher = util_fuck_with_fetcher 'hello'
+
+ data = fetcher.cache_update_path uri, path
+
+ assert_equal 'hello', data
+
+ assert_equal 'hello', File.read(path)
+ end
+
+ def test_cache_update_path_no_update
+ uri = URI 'http://example/file'
+ path = File.join @tempdir, 'file'
+
+ fetcher = util_fuck_with_fetcher 'hello'
+
+ data = fetcher.cache_update_path uri, path, false
+
+ assert_equal 'hello', data
+
+ refute_path_exists path
+ end
+
def util_fuck_with_fetcher data, blow = false
fetcher = Gem::RemoteFetcher.fetcher
fetcher.instance_variable_set :@test_data, data
@@ -278,8 +308,8 @@ gems:
inst = Gem::RemoteFetcher.fetcher
end
- assert_equal File.join(@tempdir, @a1.file_name),
- inst.download(@a1, local_path)
+ assert_equal(File.join(@tempdir, @a1.file_name),
+ inst.download(@a1, local_path))
ensure
FileUtils.chmod 0755, @a1.cache_dir
end
@@ -305,6 +335,7 @@ gems:
s.platform = Gem::Platform::CURRENT
s.instance_variable_set :@original_platform, original_platform
end
+ e1.loaded_from = File.join(@gemhome, 'specifications', e1.full_name)
e1_data = nil
File.open e1_gem, 'rb' do |fp|
@@ -334,7 +365,7 @@ gems:
cache_path = @a1.cache_file
FileUtils.mv local_path, cache_path
- gem = Gem::Format.from_file_by_path cache_path
+ gem = Gem::Package.new cache_path
assert_equal cache_path, inst.download(gem.spec, cache_path)
end
@@ -342,7 +373,7 @@ gems:
def test_download_unsupported
inst = Gem::RemoteFetcher.fetcher
- e = assert_raises Gem::InstallError do
+ e = assert_raises ArgumentError do
inst.download @a1, 'ftp://gems.rubyforge.org'
end
@@ -371,70 +402,6 @@ gems:
assert_equal @a2.file_name, File.basename(gem)
end
- def test_explicit_proxy
- use_ui @ui do
- fetcher = Gem::RemoteFetcher.new @proxy_uri
- assert_equal PROXY_DATA.size, fetcher.fetch_size(@server_uri)
- assert_data_from_proxy fetcher.fetch_path(@server_uri)
- end
- end
-